From: support Date: Mon, 7 Mar 2022 10:13:46 +0000 (+0000) Subject: Built motion from commit a52505e5.|2.6.4 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%2011license.mail?a=commitdiff_plain;h=dfd0087a7a9a8838094aeb5058084923f4045743;p=motion2.git Built motion from commit a52505e5.|2.6.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c3a2209..6783da7 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-07T09:20:10.099Z", + "time": "2022-03-07T10:02:28.544Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f5f017e..a091943 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-07T09:20:10.099Z", + "time": "2022-03-07T10:02:28.544Z", "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 abafc5d..22d421e 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 _0x138c=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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','urlForward[body]','exports','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x1b1d83,_0x24d157){var _0x486daf=function(_0x217919){while(--_0x217919){_0x1b1d83['push'](_0x1b1d83['shift']());}};_0x486daf(++_0x24d157);}(_0x138c,0x13c));var _0xc138=function(_0x5a0cc6,_0x317d1c){_0x5a0cc6=_0x5a0cc6-0x0;var _0x7af8cd=_0x138c[_0x5a0cc6];return _0x7af8cd;};'use strict';var Sequelize=require('sequelize');module[_0xc138('0x0')]={'name':{'type':Sequelize[_0xc138('0x1')],'get':function(_0x1000a6){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xc138('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc138('0x3'),_0xc138('0x4'),_0xc138('0x5'),_0xc138('0x6'),'urlForward',_0xc138('0x7'),_0xc138('0x8'),_0xc138('0x9')]],'msg':_0xc138('0xa')}},'comment':_0xc138('0xa')},'data1':{'type':Sequelize[_0xc138('0x2')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xc138('0x2')](0x1000),'comment':_0xc138('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xc138('0xc')},'data5':{'type':Sequelize[_0xc138('0x2')](0x1000),'comments':_0xc138('0xd')},'data6':{'type':Sequelize[_0xc138('0x2')],'comments':_0xc138('0xe')},'data7':{'type':Sequelize[_0xc138('0xf')],'comments':_0xc138('0x10')}}; \ No newline at end of file +var _0x5556=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','STRING','contactManager','motionbar','jscripty','urlForward'];(function(_0x385380,_0x1a8069){var _0x1cfcd3=function(_0x516f91){while(--_0x516f91){_0x385380['push'](_0x385380['shift']());}};_0x1cfcd3(++_0x1a8069);}(_0x5556,0x138));var _0x6555=function(_0x3a1dec,_0x1f943f){_0x3a1dec=_0x3a1dec-0x0;var _0x60ede0=_0x5556[_0x3a1dec];return _0x60ede0;};'use strict';var Sequelize=require(_0x6555('0x0'));module[_0x6555('0x1')]={'name':{'type':Sequelize[_0x6555('0x2')],'get':function(_0x50e4d7){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x6555('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6555('0x4'),'integration',_0x6555('0x5'),_0x6555('0x6'),_0x6555('0x7'),_0x6555('0x8'),_0x6555('0x9'),_0x6555('0xa')]],'msg':_0x6555('0xb')}},'comment':_0x6555('0xb')},'data1':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':_0x6555('0xc')},'data3':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':_0x6555('0xd')},'data4':{'type':Sequelize[_0x6555('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x6555('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x6555('0x3')],'comments':_0x6555('0xe')},'data7':{'type':Sequelize[_0x6555('0xf')],'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 59dea49..6b0a59d 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 _0x7136=['error','name','send','body','Action','catch','destroy','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x444cdd,_0x33adf9){var _0x5ddc14=function(_0x1e638b){while(--_0x1e638b){_0x444cdd['push'](_0x444cdd['shift']());}};_0x5ddc14(++_0x33adf9);}(_0x7136,0x1c0));var _0x6713=function(_0x1bfabd,_0x58170c){_0x1bfabd=_0x1bfabd-0x0;var _0xce22c9=_0x7136[_0x1bfabd];return _0xce22c9;};'use strict';var emlformat=require(_0x6713('0x0'));var rimraf=require(_0x6713('0x1'));var zipdir=require(_0x6713('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6713('0x3'));var moment=require(_0x6713('0x4'));var BPromise=require(_0x6713('0x5'));var Mustache=require(_0x6713('0x6'));var util=require('util');var path=require(_0x6713('0x7'));var sox=require(_0x6713('0x8'));var csv=require(_0x6713('0x9'));var ejs=require(_0x6713('0xa'));var fs=require('fs');var fs_extra=require(_0x6713('0xb'));var _=require(_0x6713('0xc'));var squel=require(_0x6713('0xd'));var crypto=require(_0x6713('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6713('0xf'));var toCsv=require(_0x6713('0x9'));var querystring=require(_0x6713('0x10'));var Papa=require(_0x6713('0x11'));var Redis=require('ioredis');var authService=require(_0x6713('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6713('0x13'));var logger=require('../../config/logger')(_0x6713('0x14'));var utils=require('../../config/utils');var config=require(_0x6713('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6713('0x16'))['db'];function respondWithStatusCode(_0x4564a6,_0xe0ce69){_0xe0ce69=_0xe0ce69||0xcc;return function(_0x19cedd){if(_0x19cedd){return _0x4564a6[_0x6713('0x17')](_0xe0ce69);}return _0x4564a6[_0x6713('0x18')](_0xe0ce69)[_0x6713('0x19')]();};}function respondWithResult(_0x278532,_0x548e88){_0x548e88=_0x548e88||0xc8;return function(_0xe520c7){if(_0xe520c7){return _0x278532[_0x6713('0x18')](_0x548e88)['json'](_0xe520c7);}};}function respondWithFilteredResult(_0x1c3970,_0x43d616){return function(_0x1620ce){if(_0x1620ce){var _0x579a79=typeof _0x43d616[_0x6713('0x1a')]===_0x6713('0x1b')&&typeof _0x43d616[_0x6713('0x1c')]===_0x6713('0x1b');var _0x9bf426=_0x1620ce[_0x6713('0x1d')];var _0x219578=_0x579a79?0x0:_0x43d616[_0x6713('0x1a')];var _0xdaa8ba=_0x579a79?_0x1620ce[_0x6713('0x1d')]:_0x43d616['offset']+_0x43d616[_0x6713('0x1c')];var _0x4498d8;if(_0xdaa8ba>=_0x9bf426){_0xdaa8ba=_0x9bf426;_0x4498d8=0xc8;}else{_0x4498d8=0xce;}_0x1c3970[_0x6713('0x18')](_0x4498d8);return _0x1c3970[_0x6713('0x1e')](_0x6713('0x1f'),_0x219578+'-'+_0xdaa8ba+'/'+_0x9bf426)['json'](_0x1620ce);}return null;};}function patchUpdates(_0x13ac93){return function(_0xf00b84){try{jsonpatch[_0x6713('0x20')](_0xf00b84,_0x13ac93,!![]);}catch(_0x36c598){return BPromise['reject'](_0x36c598);}return _0xf00b84[_0x6713('0x21')]();};}function saveUpdates(_0x13a635,_0x19bcc1){return function(_0x4ca20c){if(_0x4ca20c){return _0x4ca20c[_0x6713('0x22')](_0x13a635)['then'](function(_0x308bee){return _0x308bee;});}return null;};}function removeEntity(_0x57d3cc,_0x238dfa){return function(_0xfb8cb8){if(_0xfb8cb8){return _0xfb8cb8['destroy']()[_0x6713('0x23')](function(){_0x57d3cc[_0x6713('0x18')](0xcc)[_0x6713('0x19')]();});}};}function handleEntityNotFound(_0x208147,_0x1a5451){return function(_0x4121eb){if(!_0x4121eb){_0x208147[_0x6713('0x17')](0x194);}return _0x4121eb;};}function handleError(_0x3ad7e0,_0x2abc0a){_0x2abc0a=_0x2abc0a||0x1f4;return function(_0x275c20){logger[_0x6713('0x24')](_0x275c20['stack']);if(_0x275c20[_0x6713('0x25')]){delete _0x275c20[_0x6713('0x25')];}_0x3ad7e0[_0x6713('0x18')](_0x2abc0a)[_0x6713('0x26')](_0x275c20);};}exports[_0x6713('0x22')]=function(_0x559d01,_0x4ffb3b){if(_0x559d01['body']['id']){delete _0x559d01[_0x6713('0x27')]['id'];}return db[_0x6713('0x28')]['find']({'where':{'id':_0x559d01['params']['id']}})[_0x6713('0x23')](handleEntityNotFound(_0x4ffb3b,null))[_0x6713('0x23')](saveUpdates(_0x559d01[_0x6713('0x27')],null))[_0x6713('0x23')](respondWithResult(_0x4ffb3b,null))[_0x6713('0x29')](handleError(_0x4ffb3b,null));};exports[_0x6713('0x2a')]=function(_0x4c9725,_0x23fa0b){return db[_0x6713('0x28')]['find']({'where':{'id':_0x4c9725[_0x6713('0x2b')]['id']}})[_0x6713('0x23')](handleEntityNotFound(_0x23fa0b,null))[_0x6713('0x23')](removeEntity(_0x23fa0b,null))[_0x6713('0x29')](handleError(_0x23fa0b,null));}; \ No newline at end of file +var _0xe613=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','stack','name','send','body','Action','find','catch','eml-format','rimraf','fast-json-patch'];(function(_0x482d01,_0x49c24){var _0x2f928b=function(_0x40e293){while(--_0x40e293){_0x482d01['push'](_0x482d01['shift']());}};_0x2f928b(++_0x49c24);}(_0xe613,0x111));var _0x3e61=function(_0x227588,_0x392465){_0x227588=_0x227588-0x0;var _0x1197d1=_0xe613[_0x227588];return _0x1197d1;};'use strict';var emlformat=require(_0x3e61('0x0'));var rimraf=require(_0x3e61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e61('0x2'));var rp=require(_0x3e61('0x3'));var moment=require(_0x3e61('0x4'));var BPromise=require(_0x3e61('0x5'));var Mustache=require(_0x3e61('0x6'));var util=require(_0x3e61('0x7'));var path=require(_0x3e61('0x8'));var sox=require(_0x3e61('0x9'));var csv=require(_0x3e61('0xa'));var ejs=require(_0x3e61('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e61('0xc'));var squel=require('squel');var crypto=require(_0x3e61('0xd'));var jsforce=require(_0x3e61('0xe'));var deskjs=require(_0x3e61('0xf'));var toCsv=require(_0x3e61('0xa'));var querystring=require('querystring');var Papa=require(_0x3e61('0x10'));var Redis=require(_0x3e61('0x11'));var authService=require(_0x3e61('0x12'));var qs=require(_0x3e61('0x13'));var as=require(_0x3e61('0x14'));var hardwareService=require(_0x3e61('0x15'));var logger=require(_0x3e61('0x16'))('api');var utils=require(_0x3e61('0x17'));var config=require(_0x3e61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e61('0x19'))['db'];function respondWithStatusCode(_0x52b504,_0x5205d2){_0x5205d2=_0x5205d2||0xcc;return function(_0x4bbb93){if(_0x4bbb93){return _0x52b504[_0x3e61('0x1a')](_0x5205d2);}return _0x52b504[_0x3e61('0x1b')](_0x5205d2)[_0x3e61('0x1c')]();};}function respondWithResult(_0x10e3b8,_0x3a3be8){_0x3a3be8=_0x3a3be8||0xc8;return function(_0x62e870){if(_0x62e870){return _0x10e3b8[_0x3e61('0x1b')](_0x3a3be8)[_0x3e61('0x1d')](_0x62e870);}};}function respondWithFilteredResult(_0x4c831a,_0x306ab1){return function(_0x43fc2d){if(_0x43fc2d){var _0x29d2e3=typeof _0x306ab1['offset']==='undefined'&&typeof _0x306ab1[_0x3e61('0x1e')]===_0x3e61('0x1f');var _0x236737=_0x43fc2d[_0x3e61('0x20')];var _0x21eee4=_0x29d2e3?0x0:_0x306ab1[_0x3e61('0x21')];var _0x4218a0=_0x29d2e3?_0x43fc2d[_0x3e61('0x20')]:_0x306ab1[_0x3e61('0x21')]+_0x306ab1['limit'];var _0x3487c0;if(_0x4218a0>=_0x236737){_0x4218a0=_0x236737;_0x3487c0=0xc8;}else{_0x3487c0=0xce;}_0x4c831a[_0x3e61('0x1b')](_0x3487c0);return _0x4c831a[_0x3e61('0x22')]('Content-Range',_0x21eee4+'-'+_0x4218a0+'/'+_0x236737)['json'](_0x43fc2d);}return null;};}function patchUpdates(_0x1e8159){return function(_0x1f20d2){try{jsonpatch[_0x3e61('0x23')](_0x1f20d2,_0x1e8159,!![]);}catch(_0x298e22){return BPromise['reject'](_0x298e22);}return _0x1f20d2[_0x3e61('0x24')]();};}function saveUpdates(_0x5275b1,_0xd447e9){return function(_0x13dba3){if(_0x13dba3){return _0x13dba3[_0x3e61('0x25')](_0x5275b1)[_0x3e61('0x26')](function(_0x16a466){return _0x16a466;});}return null;};}function removeEntity(_0x27d29a,_0x5f1575){return function(_0x12ea08){if(_0x12ea08){return _0x12ea08['destroy']()['then'](function(){_0x27d29a[_0x3e61('0x1b')](0xcc)[_0x3e61('0x1c')]();});}};}function handleEntityNotFound(_0x548163,_0x1d4c3d){return function(_0x40ab07){if(!_0x40ab07){_0x548163['sendStatus'](0x194);}return _0x40ab07;};}function handleError(_0x19122a,_0x1d1804){_0x1d1804=_0x1d1804||0x1f4;return function(_0x27d8e0){logger['error'](_0x27d8e0[_0x3e61('0x27')]);if(_0x27d8e0['name']){delete _0x27d8e0[_0x3e61('0x28')];}_0x19122a[_0x3e61('0x1b')](_0x1d1804)[_0x3e61('0x29')](_0x27d8e0);};}exports[_0x3e61('0x25')]=function(_0x3c55f3,_0x46f1af){if(_0x3c55f3[_0x3e61('0x2a')]['id']){delete _0x3c55f3['body']['id'];}return db[_0x3e61('0x2b')][_0x3e61('0x2c')]({'where':{'id':_0x3c55f3['params']['id']}})[_0x3e61('0x26')](handleEntityNotFound(_0x46f1af,null))[_0x3e61('0x26')](saveUpdates(_0x3c55f3[_0x3e61('0x2a')],null))['then'](respondWithResult(_0x46f1af,null))[_0x3e61('0x2d')](handleError(_0x46f1af,null));};exports['destroy']=function(_0x28a462,_0x545c45){return db['Action'][_0x3e61('0x2c')]({'where':{'id':_0x28a462['params']['id']}})[_0x3e61('0x26')](handleEntityNotFound(_0x545c45,null))['then'](removeEntity(_0x545c45,null))[_0x3e61('0x2d')](handleError(_0x545c45,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4f16d72..2ebe007 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 _0x05a0=['tools_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x5d1d25,_0x763b36){var _0x5d5dce=function(_0x4e813c){while(--_0x4e813c){_0x5d1d25['push'](_0x5d1d25['shift']());}};_0x5d5dce(++_0x763b36);}(_0x05a0,0x12d));var _0x005a=function(_0x22dffb,_0x52906e){_0x22dffb=_0x22dffb-0x0;var _0x8e5f15=_0x05a0[_0x22dffb];return _0x8e5f15;};'use strict';var _=require('lodash');var util=require(_0x005a('0x0'));var logger=require(_0x005a('0x1'))(_0x005a('0x2'));var moment=require(_0x005a('0x3'));var BPromise=require(_0x005a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x005a('0x5'));var rimraf=require(_0x005a('0x6'));var config=require(_0x005a('0x7'));var attributes=require(_0x005a('0x8'));module[_0x005a('0x9')]=function(_0x2c974d,_0x5f4b77){return _0x2c974d[_0x005a('0xa')]('Action',attributes,{'tableName':_0x005a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd21d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd21d,0x14e));var _0xdd21=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0xd21d[_0x51539c];return _0x4f7914;};'use strict';var _=require('lodash');var util=require(_0xdd21('0x0'));var logger=require(_0xdd21('0x1'))(_0xdd21('0x2'));var moment=require(_0xdd21('0x3'));var BPromise=require(_0xdd21('0x4'));var rp=require(_0xdd21('0x5'));var fs=require('fs');var path=require(_0xdd21('0x6'));var rimraf=require(_0xdd21('0x7'));var config=require(_0xdd21('0x8'));var attributes=require(_0xdd21('0x9'));module[_0xdd21('0xa')]=function(_0x1791e6,_0x55c2fc){return _0x1791e6[_0xdd21('0xb')](_0xdd21('0xc'),attributes,{'tableName':_0xdd21('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e6111f2..3ff1b46 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2c7462,_0x1d2a67){var _0x238edb=function(_0x35a6c5){while(--_0x35a6c5){_0x2c7462['push'](_0x2c7462['shift']());}};_0x238edb(++_0x1d2a67);}(_0xe14b,0x93));var _0xbe14=function(_0x3806c6,_0x8cfed){_0x3806c6=_0x3806c6-0x0;var _0x4ea3c6=_0xe14b[_0x3806c6];return _0x4ea3c6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x5dcbaa,_0xbe8cf7){_0x5dcbaa=_0x5dcbaa-0x0;var _0x553930=_0x7a54[_0x5dcbaa];return _0x553930;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7d0446b..4d246c4 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 _0x2cf6=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x420c7e,_0x2fb00d){var _0x1fdcb0=function(_0xe73be0){while(--_0xe73be0){_0x420c7e['push'](_0x420c7e['shift']());}};_0x1fdcb0(++_0x2fb00d);}(_0x2cf6,0xa3));var _0x62cf=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2cf6[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x62cf('0x0'));var util=require(_0x62cf('0x1'));var path=require(_0x62cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x62cf('0x3'));var router=express[_0x62cf('0x4')]();var fs_extra=require(_0x62cf('0x5'));var auth=require(_0x62cf('0x6'));var interaction=require(_0x62cf('0x7'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x62cf('0x8')](_0x62cf('0x9'),auth[_0x62cf('0xa')](),controller[_0x62cf('0xb')]);router[_0x62cf('0xc')]('/:id',auth[_0x62cf('0xa')](),controller[_0x62cf('0xd')]);module[_0x62cf('0xe')]=router; \ No newline at end of file +var _0x51fd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4aa11a,_0x3be0ea){var _0x26559b=function(_0x5c559c){while(--_0x5c559c){_0x4aa11a['push'](_0x4aa11a['shift']());}};_0x26559b(++_0x3be0ea);}(_0x51fd,0x1bc));var _0xd51f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x51fd[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xd51f('0x0'));var util=require('util');var path=require(_0xd51f('0x1'));var timeout=require(_0xd51f('0x2'));var express=require(_0xd51f('0x3'));var router=express['Router']();var fs_extra=require(_0xd51f('0x4'));var auth=require(_0xd51f('0x5'));var interaction=require(_0xd51f('0x6'));var config=require(_0xd51f('0x7'));var controller=require(_0xd51f('0x8'));router['put'](_0xd51f('0x9'),auth[_0xd51f('0xa')](),controller[_0xd51f('0xb')]);router[_0xd51f('0xc')](_0xd51f('0x9'),auth[_0xd51f('0xa')](),controller[_0xd51f('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 23cc12f..77ce71f 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x357fad,_0x42dbdb){var _0xd81521=function(_0x11b54a){while(--_0x11b54a){_0x357fad['push'](_0x357fad['shift']());}};_0xd81521(++_0x42dbdb);}(_0x6f47,0xc7));var _0x76f4=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6f47[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x1aa4bd,_0xf7b1ba){var _0xebaf39=function(_0x41b54e){while(--_0x41b54e){_0x1aa4bd['push'](_0x1aa4bd['shift']());}};_0xebaf39(++_0xf7b1ba);}(_0x31f0,0xb7));var _0x031f=function(_0xfca315,_0xd1fdca){_0xfca315=_0xfca315-0x0;var _0x2d1eac=_0x31f0[_0xfca315];return _0x2d1eac;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ed56831..beffbb5 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 _0xde7a=['child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','alias','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','CustomReports','UserProfileResource','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','AnalyticCustomReport','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','preview','join','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','ValidationErrorItem','output','web','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xde7a,0x15c));var _0xade7=function(_0x561088,_0x282dab){_0x561088=_0x561088-0x0;var _0x2af325=_0xde7a[_0x561088];return _0x2af325;};'use strict';var emlformat=require(_0xade7('0x0'));var rimraf=require(_0xade7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xade7('0x2'));var rp=require(_0xade7('0x3'));var moment=require(_0xade7('0x4'));var BPromise=require(_0xade7('0x5'));var Mustache=require(_0xade7('0x6'));var util=require(_0xade7('0x7'));var path=require(_0xade7('0x8'));var sox=require(_0xade7('0x9'));var csv=require(_0xade7('0xa'));var ejs=require(_0xade7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xade7('0xc'));var squel=require(_0xade7('0xd'));var crypto=require(_0xade7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xade7('0xa'));var querystring=require(_0xade7('0xf'));var Papa=require(_0xade7('0x10'));var Redis=require('ioredis');var authService=require(_0xade7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xade7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xade7('0x13'))(_0xade7('0x14'));var utils=require(_0xade7('0x15'));var config=require(_0xade7('0x16'));var licenseUtil=require(_0xade7('0x17'));var db=require(_0xade7('0x18'))['db'];var dbH=require('../../mysqldb')[_0xade7('0x19')];function respondWithStatusCode(_0x5f6e9d,_0x47cf37){_0x47cf37=_0x47cf37||0xcc;return function(_0x206009){if(_0x206009){return _0x5f6e9d[_0xade7('0x1a')](_0x47cf37);}return _0x5f6e9d[_0xade7('0x1b')](_0x47cf37)[_0xade7('0x1c')]();};}function respondWithResult(_0x2eca51,_0x4a1cf7){_0x4a1cf7=_0x4a1cf7||0xc8;return function(_0x3fb9d6){if(_0x3fb9d6){return _0x2eca51[_0xade7('0x1b')](_0x4a1cf7)[_0xade7('0x1d')](_0x3fb9d6);}};}function respondWithFilteredResult(_0x19f202,_0x375ee1){return function(_0xf07f87){if(_0xf07f87){var _0x39d0cd=typeof _0x375ee1[_0xade7('0x1e')]===_0xade7('0x1f')&&typeof _0x375ee1[_0xade7('0x20')]===_0xade7('0x1f');var _0x49251e=_0xf07f87['count'];var _0x3259fc=_0x39d0cd?0x0:_0x375ee1['offset'];var _0x2b5f00=_0x39d0cd?_0xf07f87[_0xade7('0x21')]:_0x375ee1[_0xade7('0x1e')]+_0x375ee1['limit'];var _0x324543;if(_0x2b5f00>=_0x49251e){_0x2b5f00=_0x49251e;_0x324543=0xc8;}else{_0x324543=0xce;}_0x19f202[_0xade7('0x1b')](_0x324543);return _0x19f202[_0xade7('0x22')](_0xade7('0x23'),_0x3259fc+'-'+_0x2b5f00+'/'+_0x49251e)[_0xade7('0x1d')](_0xf07f87);}return null;};}function patchUpdates(_0x1a90aa){return function(_0x12a22a){try{jsonpatch['apply'](_0x12a22a,_0x1a90aa,!![]);}catch(_0x412f6a){return BPromise['reject'](_0x412f6a);}return _0x12a22a[_0xade7('0x24')]();};}function saveUpdates(_0x71f8de,_0x131081){return function(_0x168fac){if(_0x168fac){return _0x168fac[_0xade7('0x25')](_0x71f8de)[_0xade7('0x26')](function(_0x469653){return _0x469653;});}return null;};}function removeEntity(_0x42f42d,_0x5a942b){return function(_0x482ac3){if(_0x482ac3){return _0x482ac3[_0xade7('0x27')]()['then'](function(){var _0x21bf15=_0x482ac3[_0xade7('0x28')]({'plain':!![]});var _0x306f71=_0xade7('0x29');return db[_0xade7('0x2a')][_0xade7('0x27')]({'where':{'type':_0x306f71,'resourceId':_0x21bf15['id']}})[_0xade7('0x26')](function(){return _0x482ac3;});})['then'](function(){_0x42f42d[_0xade7('0x1b')](0xcc)[_0xade7('0x1c')]();});}};}function handleEntityNotFound(_0xa07655,_0x1476fa){return function(_0x473779){if(!_0x473779){_0xa07655[_0xade7('0x1a')](0x194);}return _0x473779;};}function handleError(_0x51dce1,_0x6bbffe){_0x6bbffe=_0x6bbffe||0x1f4;return function(_0x523b4a){logger[_0xade7('0x2b')](_0x523b4a['stack']);if(_0x523b4a['name']){delete _0x523b4a['name'];}_0x51dce1['status'](_0x6bbffe)[_0xade7('0x2c')](_0x523b4a);};}exports[_0xade7('0x2d')]=function(_0x25f81c,_0x1640b4){var _0x334275={},_0x757297={},_0x4bd255={'count':0x0,'rows':[]};var _0x401c5c=_[_0xade7('0x2e')](db['AnalyticCustomReport'][_0xade7('0x2f')],function(_0x24deaf){return{'name':_0x24deaf[_0xade7('0x30')],'type':_0x24deaf[_0xade7('0x31')][_0xade7('0x32')]};});_0x757297[_0xade7('0x33')]=_[_0xade7('0x2e')](_0x401c5c,_0xade7('0x34'));_0x757297[_0xade7('0x35')]=_[_0xade7('0x36')](_0x25f81c[_0xade7('0x35')]);_0x757297[_0xade7('0x37')]=_[_0xade7('0x38')](_0x757297[_0xade7('0x33')],_0x757297['query']);_0x334275[_0xade7('0x39')]=_[_0xade7('0x38')](_0x757297[_0xade7('0x33')],qs[_0xade7('0x3a')](_0x25f81c[_0xade7('0x35')][_0xade7('0x3a')]));_0x334275[_0xade7('0x39')]=_0x334275[_0xade7('0x39')][_0xade7('0x3b')]?_0x334275[_0xade7('0x39')]:_0x757297['model'];if(!_0x25f81c[_0xade7('0x35')][_0xade7('0x3c')]('nolimit')){_0x334275['limit']=qs[_0xade7('0x20')](_0x25f81c[_0xade7('0x35')][_0xade7('0x20')]);_0x334275[_0xade7('0x1e')]=qs[_0xade7('0x1e')](_0x25f81c[_0xade7('0x35')]['offset']);}_0x334275['order']=qs[_0xade7('0x3d')](_0x25f81c[_0xade7('0x35')][_0xade7('0x3d')]);_0x334275[_0xade7('0x3e')]=qs[_0xade7('0x37')](_[_0xade7('0x3f')](_0x25f81c[_0xade7('0x35')],_0x757297['filters']),_0x401c5c);if(_0x25f81c[_0xade7('0x35')][_0xade7('0x40')]){_0x334275[_0xade7('0x3e')]=_[_0xade7('0x41')](_0x334275['where'],{'$or':_[_0xade7('0x2e')](_0x401c5c,function(_0xd7b1db){if(_0xd7b1db['type']!==_0xade7('0x42')){var _0x2f8e8f={};_0x2f8e8f[_0xd7b1db['name']]={'$like':'%'+_0x25f81c['query'][_0xade7('0x40')]+'%'};return _0x2f8e8f;}})});}_0x334275=_['merge']({},_0x334275,_0x25f81c['options']);var _0x11e8c5={'where':_0x334275[_0xade7('0x3e')]};return db['AnalyticCustomReport']['count'](_0x11e8c5)['then'](function(_0x20b345){_0x4bd255[_0xade7('0x21')]=_0x20b345;if(_0x25f81c[_0xade7('0x35')][_0xade7('0x43')]){_0x334275[_0xade7('0x44')]=[{'all':!![]}];}return db[_0xade7('0x45')][_0xade7('0x46')](_0x334275);})[_0xade7('0x26')](function(_0x10b328){_0x4bd255[_0xade7('0x47')]=_0x10b328;return _0x4bd255;})['then'](respondWithFilteredResult(_0x1640b4,_0x334275))[_0xade7('0x48')](handleError(_0x1640b4,null));};exports[_0xade7('0x49')]=function(_0x2ca539,_0x205393){var _0x502dfd={'raw':![],'where':{'id':_0x2ca539[_0xade7('0x4a')]['id']}},_0x561c5f={};_0x561c5f[_0xade7('0x33')]=_[_0xade7('0x36')](db[_0xade7('0x45')][_0xade7('0x2f')]);_0x561c5f[_0xade7('0x35')]=_[_0xade7('0x36')](_0x2ca539[_0xade7('0x35')]);_0x561c5f[_0xade7('0x37')]=_[_0xade7('0x38')](_0x561c5f[_0xade7('0x33')],_0x561c5f[_0xade7('0x35')]);_0x502dfd['attributes']=_[_0xade7('0x38')](_0x561c5f[_0xade7('0x33')],qs[_0xade7('0x3a')](_0x2ca539[_0xade7('0x35')][_0xade7('0x3a')]));_0x502dfd[_0xade7('0x39')]=_0x502dfd[_0xade7('0x39')][_0xade7('0x3b')]?_0x502dfd[_0xade7('0x39')]:_0x561c5f[_0xade7('0x33')];if(_0x2ca539[_0xade7('0x35')][_0xade7('0x43')]){_0x502dfd[_0xade7('0x44')]=[{'all':!![]}];}_0x502dfd=_[_0xade7('0x41')]({},_0x502dfd,_0x2ca539[_0xade7('0x4b')]);return db[_0xade7('0x45')][_0xade7('0x4c')](_0x502dfd)[_0xade7('0x26')](handleEntityNotFound(_0x205393,null))[_0xade7('0x26')](respondWithResult(_0x205393,null))[_0xade7('0x48')](handleError(_0x205393,null));};exports[_0xade7('0x4d')]=function(_0x2ae3db,_0x57119d){return db[_0xade7('0x45')]['create'](_0x2ae3db[_0xade7('0x4e')],{})[_0xade7('0x26')](function(_0x367df9){var _0x576f3f=_0x2ae3db[_0xade7('0x4f')][_0xade7('0x28')]({'plain':!![]});if(!_0x576f3f)throw new Error(_0xade7('0x50'));if(_0x576f3f[_0xade7('0x51')]===_0xade7('0x4f')){var _0x536859=_0x367df9['get']({'plain':!![]});var _0x3148df='Reports';return db[_0xade7('0x52')][_0xade7('0x4c')]({'where':{'name':_0x3148df,'userProfileId':_0x576f3f['userProfileId']},'raw':!![]})[_0xade7('0x26')](function(_0x4d4064){if(_0x4d4064&&_0x4d4064[_0xade7('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x536859['name'],'resourceId':_0x536859['id'],'type':_0xade7('0x29'),'sectionId':_0x4d4064['id']},{})['then'](function(){return _0x367df9;});}else{return _0x367df9;}})[_0xade7('0x48')](function(_0x305725){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x305725);throw _0x305725;});}return _0x367df9;})[_0xade7('0x26')](respondWithResult(_0x57119d,0xc9))[_0xade7('0x48')](handleError(_0x57119d,null));};exports[_0xade7('0x25')]=function(_0x2f225b,_0x11f5d9){if(_0x2f225b[_0xade7('0x4e')]['id']){delete _0x2f225b[_0xade7('0x4e')]['id'];}return db[_0xade7('0x45')][_0xade7('0x4c')]({'where':{'id':_0x2f225b[_0xade7('0x4a')]['id']}})[_0xade7('0x26')](handleEntityNotFound(_0x11f5d9,null))[_0xade7('0x26')](saveUpdates(_0x2f225b[_0xade7('0x4e')],null))[_0xade7('0x26')](respondWithResult(_0x11f5d9,null))[_0xade7('0x48')](handleError(_0x11f5d9,null));};exports[_0xade7('0x27')]=function(_0xc8e22a,_0x5473d6){return db[_0xade7('0x45')][_0xade7('0x4c')]({'where':{'id':_0xc8e22a[_0xade7('0x4a')]['id']}})[_0xade7('0x26')](handleEntityNotFound(_0x5473d6,null))[_0xade7('0x26')](removeEntity(_0x5473d6,null))[_0xade7('0x48')](handleError(_0x5473d6,null));};exports[_0xade7('0x54')]=function(_0x2eb49f,_0x58c137){var _0x4831d5=0xa;var _0x2c51ef=[_0xade7('0x55'),_0xade7('0x56'),_0xade7('0x57'),'cross_join'];var _0x12fc62={'SUM':_0xade7('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xade7('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xade7('0x5a'),'GROUP_CONCAT':_0xade7('0x5b'),'GROUP_CONCAT ASC':_0xade7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x687978={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xade7('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xade7('0x5e')};var _0x4cc6c0=function(_0x4ce4f1){return!_[_0xade7('0x5f')]([_0xade7('0x60'),_0xade7('0x61'),'IS\x20EMPTY',_0xade7('0x62')],_0x4ce4f1);};var _0x406a3d=function(_0xcf6c4c){if(!_0xcf6c4c||!_0xcf6c4c[_0xade7('0x63')]['length']){return'';}for(var _0xc6498f='(',_0x4d5255=0x0;_0x4d5255<_0xcf6c4c[_0xade7('0x63')][_0xade7('0x3b')];_0x4d5255+=0x1){_0x4d5255>0x0&&(_0xc6498f+='\x20'+_0xcf6c4c[_0xade7('0x64')]+'\x20');_0xc6498f+=_0xcf6c4c['rules'][_0x4d5255][_0xade7('0x65')]?_0x406a3d(_0xcf6c4c[_0xade7('0x63')][_0x4d5255][_0xade7('0x65')]):_0xcf6c4c[_0xade7('0x63')][_0x4d5255][_0xade7('0x66')]+'\x20'+_0xcf6c4c[_0xade7('0x63')][_0x4d5255]['condition']+(_0x4cc6c0(_0xcf6c4c[_0xade7('0x63')][_0x4d5255][_0xade7('0x67')])?'\x20'+_0xcf6c4c[_0xade7('0x63')][_0x4d5255][_0xade7('0x68')]:'');}return _0xc6498f+')';};var _0x68c83f={'where':{'id':_0x2eb49f[_0xade7('0x4a')]['id']}},_0x506d52,_0x47f06e,_0x1fdbdf,_0x4e0137,_0x484e4f;_0x68c83f=_[_0xade7('0x41')]({},_0x68c83f,_0x2eb49f['options']);return db[_0xade7('0x45')][_0xade7('0x4c')](_0x68c83f)[_0xade7('0x26')](function(_0x5d7ade){if(_0x5d7ade){_0x506d52=_0x5d7ade;return _0x5d7ade[_0xade7('0x69')]();}return null;})[_0xade7('0x26')](function(_0xd03af8){if(_0xd03af8){if(!_0xd03af8[_0xade7('0x3b')]){throw new db[(_0xade7('0x6a'))]['ValidationErrorItem'](_0xade7('0x6b'),0x193);}_0x47f06e=_0xd03af8;return db[_0xade7('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x21dc77){if(_0x21dc77){_0x1fdbdf=_[_0xade7('0x6d')](_0x21dc77,'id');var _0x158b3e;var _0x1d792b=squel[_0xade7('0x6e')]();_0x1d792b[_0xade7('0x6f')](_0x506d52[_0xade7('0x70')]);for(var _0x41650c=0x0;_0x41650c<_0x47f06e[_0xade7('0x3b')];_0x41650c+=0x1){_0x158b3e=_0x47f06e[_0x41650c][_0xade7('0x71')]?_0x1fdbdf[_0x47f06e[_0x41650c][_0xade7('0x71')]][_0xade7('0x72')]:_0x47f06e[_0x41650c][_0xade7('0x66')];_0x158b3e=_0x47f06e[_0x41650c][_0xade7('0x73')]?_['replace'](_0x12fc62[_0x47f06e[_0x41650c][_0xade7('0x73')]],'%s',_0x158b3e):_0x158b3e;_0x158b3e=_0x47f06e[_0x41650c]['format']?_[_0xade7('0x74')](_0x687978[_0x47f06e[_0x41650c][_0xade7('0x75')]],'%s',_0x158b3e):_0x158b3e;if(_0x47f06e[_0x41650c][_0xade7('0x76')]){_0x1d792b['group'](_0x158b3e);}_0x47f06e[_0x41650c][_0xade7('0x77')]&&_0x1d792b[_0xade7('0x78')](_0x158b3e,_0x47f06e[_0x41650c][_0xade7('0x77')]===_0xade7('0x79')?![]:!![]);_0x1d792b['field'](_0x158b3e,_0x47f06e[_0x41650c]['alias']||_0x158b3e);}if(_0x506d52[_0xade7('0x7a')]){_0x506d52[_0xade7('0x7a')]=JSON[_0xade7('0x7b')](_0x506d52[_0xade7('0x7a')]);for(var _0x16a49e=0x0;_0x16a49e<_0x506d52[_0xade7('0x7a')][_0xade7('0x3b')];_0x16a49e+=0x1){if(_0x506d52[_0xade7('0x7a')][_0x16a49e][_0xade7('0x31')]&&_['includes'](_0x2c51ef,_0x506d52['joins'][_0x16a49e][_0xade7('0x31')])&&_0x506d52[_0xade7('0x7a')][_0x16a49e][_0xade7('0x7c')]&&_0x506d52[_0xade7('0x7a')][_0x16a49e]['foreignTable']&&_0x506d52[_0xade7('0x7a')][_0x16a49e][_0xade7('0x7d')]){_0x1d792b[_0x506d52[_0xade7('0x7a')][_0x16a49e][_0xade7('0x31')]](_0x506d52[_0xade7('0x7a')][_0x16a49e]['foreignTable'],null,util[_0xade7('0x75')](_0xade7('0x7e'),_0x506d52[_0xade7('0x70')],_0x506d52['joins'][_0x16a49e][_0xade7('0x7c')],_0x506d52[_0xade7('0x7a')][_0x16a49e][_0xade7('0x7f')],_0x506d52['joins'][_0x16a49e]['foreignKey']));}}}if(_0x506d52[_0xade7('0x80')]){_0x506d52[_0xade7('0x80')]=JSON[_0xade7('0x7b')](_0x506d52[_0xade7('0x80')]);_0x1d792b[_0xade7('0x3e')](_0x406a3d(_0x506d52['conditions'][_0xade7('0x65')]));}_0x484e4f=_0x1d792b[_0xade7('0x81')]();_0x1d792b[_0xade7('0x20')](_0x4831d5);_0x1d792b[_0xade7('0x1e')](0x0);logger[_0xade7('0x82')]('Limited\x20Query:',_0x1d792b[_0xade7('0x83')]());return dbH[_0xade7('0x84')][_0xade7('0x35')](_0x1d792b[_0xade7('0x83')](),{'type':dbH[_0xade7('0x84')][_0xade7('0x85')][_0xade7('0x86')]});}})[_0xade7('0x26')](respondWithResult(_0x58c137,null))[_0xade7('0x48')](handleError(_0x58c137,null));};function runReport(_0x1ecd6b,_0x1bef7e,_0x45b604){var _0x17cb05=_0x1bef7e[_0xade7('0x34')];var _0x27e29e=0xa;var _0x3c95de=[_0xade7('0x55'),_0xade7('0x56'),_0xade7('0x57'),_0xade7('0x87')];var _0x546fca={'SUM':_0xade7('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xade7('0x88'),'MIN':'MIN(%s)','AVG':_0xade7('0x5a'),'GROUP_CONCAT':_0xade7('0x5b'),'GROUP_CONCAT ASC':_0xade7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x235393={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xade7('0x5d'),'HOUR':_0xade7('0x89'),'ROUND':_0xade7('0x8a'),'UNIX_TIMESTAMP':_0xade7('0x5e')};var _0x35a1c3=function(_0x5bce9b){return!_[_0xade7('0x5f')]([_0xade7('0x60'),_0xade7('0x61'),_0xade7('0x8b'),'IS\x20NOT\x20EMPTY'],_0x5bce9b);};var _0xfa3347=function(_0x4527b4){if(!_0x4527b4||!_0x4527b4['rules'][_0xade7('0x3b')]){return'';}for(var _0x1968d5='(',_0x4ae649=0x0;_0x4ae649<_0x4527b4['rules'][_0xade7('0x3b')];_0x4ae649+=0x1){_0x4ae649>0x0&&(_0x1968d5+='\x20'+_0x4527b4[_0xade7('0x64')]+'\x20');_0x1968d5+=_0x4527b4[_0xade7('0x63')][_0x4ae649]['group']?_0xfa3347(_0x4527b4[_0xade7('0x63')][_0x4ae649][_0xade7('0x65')]):_0x4527b4['rules'][_0x4ae649]['field']+'\x20'+_0x4527b4[_0xade7('0x63')][_0x4ae649][_0xade7('0x67')]+(_0x35a1c3(_0x4527b4[_0xade7('0x63')][_0x4ae649][_0xade7('0x67')])?'\x20'+_0x4527b4[_0xade7('0x63')][_0x4ae649][_0xade7('0x68')]:'');}return _0x1968d5+')';};var _0x1fbaa0={'where':{'id':_0x1ecd6b['id']}},_0x28405,_0xb0e210,_0x51e0c2,_0x39cb6d,_0x1170d3;_0x1fbaa0=_[_0xade7('0x41')]({},_0x1fbaa0,_0x45b604);return db[_0xade7('0x45')][_0xade7('0x4c')](_0x1fbaa0)[_0xade7('0x26')](function(_0x598f68){if(_0x598f68){_0x28405=_0x598f68;return _0x598f68[_0xade7('0x69')]();}return null;})[_0xade7('0x26')](function(_0x1d05a8){if(_0x1d05a8){if(!_0x1d05a8[_0xade7('0x3b')]){throw new db[(_0xade7('0x6a'))][(_0xade7('0x8c'))](_0xade7('0x6b'),0x193);}_0xb0e210=_0x1d05a8;return db[_0xade7('0x6c')][_0xade7('0x46')]({'raw':!![]});}return null;})[_0xade7('0x26')](function(_0x5cdb94){if(_0x5cdb94){_0x51e0c2=_[_0xade7('0x6d')](_0x5cdb94,'id');var _0x518598;var _0x8ea91f=squel[_0xade7('0x6e')]();_0x8ea91f[_0xade7('0x6f')](_0x28405[_0xade7('0x70')]);for(var _0x2370cb=0x0;_0x2370cb<_0xb0e210[_0xade7('0x3b')];_0x2370cb+=0x1){_0x518598=_0xb0e210[_0x2370cb]['MetricId']?_0x51e0c2[_0xb0e210[_0x2370cb][_0xade7('0x71')]]['metric']:_0xb0e210[_0x2370cb][_0xade7('0x66')];_0x518598=_0xb0e210[_0x2370cb][_0xade7('0x73')]?_[_0xade7('0x74')](_0x546fca[_0xb0e210[_0x2370cb][_0xade7('0x73')]],'%s',_0x518598):_0x518598;_0x518598=_0xb0e210[_0x2370cb][_0xade7('0x75')]?_[_0xade7('0x74')](_0x235393[_0xb0e210[_0x2370cb][_0xade7('0x75')]],'%s',_0x518598):_0x518598;if(_0xb0e210[_0x2370cb][_0xade7('0x76')]){_0x8ea91f[_0xade7('0x65')](_0x518598);}_0xb0e210[_0x2370cb][_0xade7('0x77')]&&_0x8ea91f[_0xade7('0x78')](_0x518598,_0xb0e210[_0x2370cb][_0xade7('0x77')]===_0xade7('0x79')?![]:!![]);_0x8ea91f[_0xade7('0x66')](_0x518598,_0xb0e210[_0x2370cb]['alias']||_0x518598);}if(_0x28405['joins']){_0x28405[_0xade7('0x7a')]=JSON[_0xade7('0x7b')](_0x28405[_0xade7('0x7a')]);for(var _0x2bffb3=0x0;_0x2bffb3<_0x28405[_0xade7('0x7a')][_0xade7('0x3b')];_0x2bffb3+=0x1){if(_0x28405[_0xade7('0x7a')][_0x2bffb3]['type']&&_[_0xade7('0x5f')](_0x3c95de,_0x28405[_0xade7('0x7a')][_0x2bffb3][_0xade7('0x31')])&&_0x28405['joins'][_0x2bffb3]['parentKey']&&_0x28405[_0xade7('0x7a')][_0x2bffb3]['foreignTable']&&_0x28405[_0xade7('0x7a')][_0x2bffb3][_0xade7('0x7d')]){_0x8ea91f[_0x28405['joins'][_0x2bffb3][_0xade7('0x31')]](_0x28405['joins'][_0x2bffb3][_0xade7('0x7f')],null,util[_0xade7('0x75')]('%s.%s\x20=\x20%s.%s',_0x28405[_0xade7('0x70')],_0x28405['joins'][_0x2bffb3][_0xade7('0x7c')],_0x28405[_0xade7('0x7a')][_0x2bffb3][_0xade7('0x7f')],_0x28405[_0xade7('0x7a')][_0x2bffb3][_0xade7('0x7d')]));}}}if(_0x28405[_0xade7('0x80')]){_0x28405[_0xade7('0x80')]=JSON['parse'](_0x28405[_0xade7('0x80')]);_0x8ea91f['where'](_0xfa3347(_0x28405[_0xade7('0x80')][_0xade7('0x65')]));}_0x1170d3=_0x8ea91f['clone']();_0x8ea91f[_0xade7('0x20')](_0x27e29e);_0x8ea91f[_0xade7('0x1e')](0x0);return;}})[_0xade7('0x26')](function(){if(_0x1bef7e[_0xade7('0x8d')]===_0xade7('0x8e')){return null;}var _0x2758d3=_['merge'](_0x1bef7e,{'name':_0x1bef7e[_0xade7('0x8f')]||_0x1bef7e[_0xade7('0x34')]||_0x28405[_0xade7('0x34')],'basename':_0x17cb05,'savename':util['format'](_0xade7('0x90'),_0x1bef7e[_0xade7('0x34')]||_0x28405['name'],require(_0xade7('0x91'))[_0xade7('0x92')](0x4),_0x1bef7e[_0xade7('0x8d')]||'csv'),'reportId':_0x28405['id'],'reportType':'custom'});return db[_0xade7('0x93')][_0xade7('0x4d')](_0x2758d3,{'raw':!![]});})['then'](function(_0x3bbfba){if(_0x28405[_0xade7('0x70')]===_0xade7('0x94')){_0x1170d3[_0xade7('0x3e')](_0x28405['table']+_0xade7('0x95'),_0x1bef7e['startDate'],_0x1bef7e[_0xade7('0x96')]);}else{_0x1170d3[_0xade7('0x3e')](_0x28405[_0xade7('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1bef7e[_0xade7('0x97')],_0x1bef7e[_0xade7('0x96')]);}if(_0x3bbfba){logger['info'](_0xade7('0x98'),_0x1170d3[_0xade7('0x83')]());require(_0xade7('0x99'))[_0xade7('0x9a')](path[_0xade7('0x55')](__dirname,_0xade7('0x9b'),_0x3bbfba[_0xade7('0x8d')]),[_0x3bbfba['id'],_0x1170d3[_0xade7('0x83')](),path[_0xade7('0x55')](__dirname,_0xade7('0x9c'),_0x3bbfba[_0xade7('0x9d')]),_0x17cb05]);return _0x3bbfba;}else{var _0xb78644=squel[_0xade7('0x6e')]();_0xb78644[_0xade7('0x6f')]('('+_0x1170d3[_0xade7('0x83')]()+')',_0xade7('0x9e'));_0xb78644[_0xade7('0x66')](_0xade7('0x9f'),_0xade7('0x21'));_0x1170d3[_0xade7('0x20')](_0x1bef7e[_0xade7('0x20')]||_0x27e29e);_0x1170d3['offset'](_0x1bef7e[_0xade7('0x1e')]||0x0);return dbH[_0xade7('0x84')][_0xade7('0x35')](_0xb78644[_0xade7('0x83')](),{'type':dbH['sequelize'][_0xade7('0x85')][_0xade7('0x86')]})['then'](function(_0x41c054){if(!_0x41c054[_0xade7('0x3b')]){_0x39cb6d=0x0;}else{_0x39cb6d=_0x41c054[0x0][_0xade7('0x21')]||0x0;}return dbH['sequelize'][_0xade7('0x35')](_0x1170d3[_0xade7('0x83')](),{'type':dbH['sequelize'][_0xade7('0x85')]['SELECT']});})['then'](function(_0x58e43f){return{'rows':_0x58e43f||[],'count':_0x39cb6d};});}});}exports['run']=function(_0x3f2c0e,_0x1f5e58){return runReport(_0x3f2c0e[_0xade7('0x4a')],_0x3f2c0e['query'],_0x3f2c0e[_0xade7('0x4b')])[_0xade7('0x26')](respondWithResult(_0x1f5e58,null))[_0xade7('0x48')](handleError(_0x1f5e58,null));};exports[_0xade7('0xa0')]=runReport;exports[_0xade7('0x35')]=function(_0xc14a92,_0x301f7d){var _0x16764f=0xa;var _0x2df7d7=[_0xade7('0x55'),_0xade7('0x56'),_0xade7('0x57'),_0xade7('0x87')];var _0x5917bd={'SUM':_0xade7('0x58'),'COUNT':_0xade7('0xa1'),'COUNT DISTINCT':_0xade7('0x59'),'MAX':_0xade7('0x88'),'MIN':_0xade7('0xa2'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xade7('0x5c'),'GROUP_CONCAT DESC':_0xade7('0xa3')};var _0x1678e9={'SEC_TO_TIME':_0xade7('0xa4'),'DATE':_0xade7('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xade7('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1cc52f=function(_0x29b49c){return!_[_0xade7('0x5f')](['IS\x20NULL',_0xade7('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x29b49c);};var _0x3d7b8d=function(_0x16622f){if(!_0x16622f||!_0x16622f['rules']['length']){return'';}for(var _0x49c8be='(',_0x39ce5a=0x0;_0x39ce5a<_0x16622f['rules'][_0xade7('0x3b')];_0x39ce5a+=0x1){_0x39ce5a>0x0&&(_0x49c8be+='\x20'+_0x16622f[_0xade7('0x64')]+'\x20');_0x49c8be+=_0x16622f[_0xade7('0x63')][_0x39ce5a]['group']?_0x3d7b8d(_0x16622f[_0xade7('0x63')][_0x39ce5a][_0xade7('0x65')]):_0x16622f['rules'][_0x39ce5a][_0xade7('0x66')]+'\x20'+_0x16622f['rules'][_0x39ce5a][_0xade7('0x67')]+(_0x1cc52f(_0x16622f[_0xade7('0x63')][_0x39ce5a]['condition'])?'\x20'+_0x16622f[_0xade7('0x63')][_0x39ce5a][_0xade7('0x68')]:'');}return _0x49c8be+')';};var _0x15392e={'where':{'id':_0xc14a92[_0xade7('0x4a')]['id']}},_0x252cad,_0x2e815a,_0x4f140a,_0xbd9a54,_0x41b46d;_0x15392e=_[_0xade7('0x41')]({},_0x15392e,_0xc14a92[_0xade7('0x4b')]);return db['AnalyticCustomReport'][_0xade7('0x4c')](_0x15392e)[_0xade7('0x26')](function(_0x1316fb){if(_0x1316fb){_0x252cad=_0x1316fb;return _0x1316fb[_0xade7('0x69')]();}return null;})['then'](function(_0xe661db){if(_0xe661db){if(!_0xe661db[_0xade7('0x3b')]){throw new db[(_0xade7('0x6a'))][(_0xade7('0x8c'))](_0xade7('0x6b'),0x193);}_0x2e815a=_0xe661db;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xade7('0x26')](function(_0x2a54dd){if(_0x2a54dd){_0x4f140a=_[_0xade7('0x6d')](_0x2a54dd,'id');var _0x5cb448;var _0x1bf475=squel['select']();_0x1bf475[_0xade7('0x6f')](_0x252cad[_0xade7('0x70')]);for(var _0x965e25=0x0;_0x965e25<_0x2e815a[_0xade7('0x3b')];_0x965e25+=0x1){_0x5cb448=_0x2e815a[_0x965e25]['MetricId']?_0x4f140a[_0x2e815a[_0x965e25][_0xade7('0x71')]][_0xade7('0x72')]:_0x2e815a[_0x965e25][_0xade7('0x66')];_0x5cb448=_0x2e815a[_0x965e25]['function']?_['replace'](_0x5917bd[_0x2e815a[_0x965e25][_0xade7('0x73')]],'%s',_0x5cb448):_0x5cb448;_0x5cb448=_0x2e815a[_0x965e25]['format']?_[_0xade7('0x74')](_0x1678e9[_0x2e815a[_0x965e25][_0xade7('0x75')]],'%s',_0x5cb448):_0x5cb448;if(_0x2e815a[_0x965e25][_0xade7('0x76')]){_0x1bf475['group'](_0x5cb448);}_0x2e815a[_0x965e25]['orderBy']&&_0x1bf475[_0xade7('0x78')](_0x5cb448,_0x2e815a[_0x965e25][_0xade7('0x77')]===_0xade7('0x79')?![]:!![]);_0x1bf475[_0xade7('0x66')](_0x5cb448,_0x2e815a[_0x965e25][_0xade7('0xa5')]||_0x5cb448);}if(_0x252cad[_0xade7('0x7a')]){_0x252cad[_0xade7('0x7a')]=JSON[_0xade7('0x7b')](_0x252cad[_0xade7('0x7a')]);for(var _0x3a9910=0x0;_0x3a9910<_0x252cad[_0xade7('0x7a')][_0xade7('0x3b')];_0x3a9910+=0x1){if(_0x252cad[_0xade7('0x7a')][_0x3a9910][_0xade7('0x31')]&&_[_0xade7('0x5f')](_0x2df7d7,_0x252cad['joins'][_0x3a9910][_0xade7('0x31')])&&_0x252cad['joins'][_0x3a9910]['parentKey']&&_0x252cad[_0xade7('0x7a')][_0x3a9910][_0xade7('0x7f')]&&_0x252cad['joins'][_0x3a9910][_0xade7('0x7d')]){_0x1bf475[_0x252cad['joins'][_0x3a9910]['type']](_0x252cad['joins'][_0x3a9910]['foreignTable'],null,util['format'](_0xade7('0x7e'),_0x252cad[_0xade7('0x70')],_0x252cad[_0xade7('0x7a')][_0x3a9910][_0xade7('0x7c')],_0x252cad[_0xade7('0x7a')][_0x3a9910][_0xade7('0x7f')],_0x252cad[_0xade7('0x7a')][_0x3a9910][_0xade7('0x7d')]));}}}if(_0x252cad[_0xade7('0x80')]){_0x252cad['conditions']=JSON[_0xade7('0x7b')](_0x252cad['conditions']);_0x1bf475['where'](_0x3d7b8d(_0x252cad[_0xade7('0x80')]['group']));}_0x41b46d=_0x1bf475[_0xade7('0x81')]();_0x1bf475[_0xade7('0x20')](_0x16764f);_0x1bf475['offset'](0x0);logger[_0xade7('0x82')](_0xade7('0xa6'),_0x1bf475[_0xade7('0x83')]());return dbH[_0xade7('0x84')][_0xade7('0x35')](_0x1bf475['toString'](),{'type':dbH[_0xade7('0x84')]['QueryTypes']['SELECT']});}})[_0xade7('0x26')](function(){return{'sql':_0x41b46d[_0xade7('0x83')]()};})['then'](respondWithResult(_0x301f7d,null))[_0xade7('0x48')](handleError(_0x301f7d,null));}; \ No newline at end of file +var _0x38e9=['keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','type','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','GROUP_CONCAT(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','select','table','clone','output','web','%s-%s.%s','randomstring','generate','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ValidationErrorItem','%s.%s\x20=\x20%s.%s','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','model'];(function(_0x506b51,_0x2d2b6d){var _0xca5779=function(_0x5f0fcb){while(--_0x5f0fcb){_0x506b51['push'](_0x506b51['shift']());}};_0xca5779(++_0x2d2b6d);}(_0x38e9,0x1c5));var _0x938e=function(_0x26973e,_0x4d1d08){_0x26973e=_0x26973e-0x0;var _0x26893c=_0x38e9[_0x26973e];return _0x26893c;};'use strict';var emlformat=require(_0x938e('0x0'));var rimraf=require(_0x938e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x938e('0x2'));var rp=require(_0x938e('0x3'));var moment=require(_0x938e('0x4'));var BPromise=require(_0x938e('0x5'));var Mustache=require('mustache');var util=require(_0x938e('0x6'));var path=require(_0x938e('0x7'));var sox=require(_0x938e('0x8'));var csv=require(_0x938e('0x9'));var ejs=require(_0x938e('0xa'));var fs=require('fs');var fs_extra=require(_0x938e('0xb'));var _=require('lodash');var squel=require(_0x938e('0xc'));var crypto=require(_0x938e('0xd'));var jsforce=require(_0x938e('0xe'));var deskjs=require(_0x938e('0xf'));var toCsv=require(_0x938e('0x9'));var querystring=require(_0x938e('0x10'));var Papa=require(_0x938e('0x11'));var Redis=require(_0x938e('0x12'));var authService=require(_0x938e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x938e('0x14'));var hardwareService=require(_0x938e('0x15'));var logger=require(_0x938e('0x16'))(_0x938e('0x17'));var utils=require(_0x938e('0x18'));var config=require(_0x938e('0x19'));var licenseUtil=require(_0x938e('0x1a'));var db=require(_0x938e('0x1b'))['db'];var dbH=require(_0x938e('0x1b'))[_0x938e('0x1c')];function respondWithStatusCode(_0x452293,_0x485fa7){_0x485fa7=_0x485fa7||0xcc;return function(_0x48dbf7){if(_0x48dbf7){return _0x452293[_0x938e('0x1d')](_0x485fa7);}return _0x452293[_0x938e('0x1e')](_0x485fa7)[_0x938e('0x1f')]();};}function respondWithResult(_0x5a4c23,_0x1282a4){_0x1282a4=_0x1282a4||0xc8;return function(_0x2bd82a){if(_0x2bd82a){return _0x5a4c23['status'](_0x1282a4)['json'](_0x2bd82a);}};}function respondWithFilteredResult(_0x30e031,_0x3c8475){return function(_0xbfd001){if(_0xbfd001){var _0x2761d5=typeof _0x3c8475[_0x938e('0x20')]===_0x938e('0x21')&&typeof _0x3c8475[_0x938e('0x22')]===_0x938e('0x21');var _0x3d7505=_0xbfd001[_0x938e('0x23')];var _0xae96e8=_0x2761d5?0x0:_0x3c8475[_0x938e('0x20')];var _0x5076f3=_0x2761d5?_0xbfd001[_0x938e('0x23')]:_0x3c8475['offset']+_0x3c8475[_0x938e('0x22')];var _0x518b90;if(_0x5076f3>=_0x3d7505){_0x5076f3=_0x3d7505;_0x518b90=0xc8;}else{_0x518b90=0xce;}_0x30e031[_0x938e('0x1e')](_0x518b90);return _0x30e031[_0x938e('0x24')](_0x938e('0x25'),_0xae96e8+'-'+_0x5076f3+'/'+_0x3d7505)[_0x938e('0x26')](_0xbfd001);}return null;};}function patchUpdates(_0x35ead3){return function(_0x5cf3d6){try{jsonpatch[_0x938e('0x27')](_0x5cf3d6,_0x35ead3,!![]);}catch(_0x290c2a){return BPromise[_0x938e('0x28')](_0x290c2a);}return _0x5cf3d6['save']();};}function saveUpdates(_0x385cc8,_0x226b07){return function(_0x407c15){if(_0x407c15){return _0x407c15[_0x938e('0x29')](_0x385cc8)[_0x938e('0x2a')](function(_0x9b03b4){return _0x9b03b4;});}return null;};}function removeEntity(_0x180103,_0x42eb08){return function(_0x40477a){if(_0x40477a){return _0x40477a[_0x938e('0x2b')]()[_0x938e('0x2a')](function(){var _0x17b1e9=_0x40477a['get']({'plain':!![]});var _0x52a78a=_0x938e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x52a78a,'resourceId':_0x17b1e9['id']}})['then'](function(){return _0x40477a;});})['then'](function(){_0x180103[_0x938e('0x1e')](0xcc)[_0x938e('0x1f')]();});}};}function handleEntityNotFound(_0x5e09b2,_0x444664){return function(_0x312a18){if(!_0x312a18){_0x5e09b2[_0x938e('0x1d')](0x194);}return _0x312a18;};}function handleError(_0xeb1750,_0x335a16){_0x335a16=_0x335a16||0x1f4;return function(_0x1ec01e){logger[_0x938e('0x2d')](_0x1ec01e[_0x938e('0x2e')]);if(_0x1ec01e[_0x938e('0x2f')]){delete _0x1ec01e[_0x938e('0x2f')];}_0xeb1750[_0x938e('0x1e')](_0x335a16)[_0x938e('0x30')](_0x1ec01e);};}exports[_0x938e('0x31')]=function(_0x5957c1,_0x563b1b){var _0x4f5056={},_0x4b4f70={},_0x1c9d48={'count':0x0,'rows':[]};var _0x40bfb7=_[_0x938e('0x32')](db[_0x938e('0x33')][_0x938e('0x34')],function(_0x227da6){return{'name':_0x227da6['fieldName'],'type':_0x227da6['type']['key']};});_0x4b4f70[_0x938e('0x35')]=_['map'](_0x40bfb7,'name');_0x4b4f70['query']=_[_0x938e('0x36')](_0x5957c1['query']);_0x4b4f70[_0x938e('0x37')]=_[_0x938e('0x38')](_0x4b4f70[_0x938e('0x35')],_0x4b4f70[_0x938e('0x39')]);_0x4f5056['attributes']=_[_0x938e('0x38')](_0x4b4f70[_0x938e('0x35')],qs[_0x938e('0x3a')](_0x5957c1[_0x938e('0x39')]['fields']));_0x4f5056[_0x938e('0x3b')]=_0x4f5056['attributes']['length']?_0x4f5056[_0x938e('0x3b')]:_0x4b4f70[_0x938e('0x35')];if(!_0x5957c1['query'][_0x938e('0x3c')](_0x938e('0x3d'))){_0x4f5056['limit']=qs['limit'](_0x5957c1['query'][_0x938e('0x22')]);_0x4f5056['offset']=qs[_0x938e('0x20')](_0x5957c1['query'][_0x938e('0x20')]);}_0x4f5056['order']=qs[_0x938e('0x3e')](_0x5957c1['query'][_0x938e('0x3e')]);_0x4f5056['where']=qs[_0x938e('0x37')](_[_0x938e('0x3f')](_0x5957c1[_0x938e('0x39')],_0x4b4f70['filters']),_0x40bfb7);if(_0x5957c1[_0x938e('0x39')][_0x938e('0x40')]){_0x4f5056[_0x938e('0x41')]=_[_0x938e('0x42')](_0x4f5056['where'],{'$or':_[_0x938e('0x32')](_0x40bfb7,function(_0x42a41f){if(_0x42a41f['type']!==_0x938e('0x43')){var _0xe13fda={};_0xe13fda[_0x42a41f['name']]={'$like':'%'+_0x5957c1[_0x938e('0x39')][_0x938e('0x40')]+'%'};return _0xe13fda;}})});}_0x4f5056=_['merge']({},_0x4f5056,_0x5957c1[_0x938e('0x44')]);var _0x33a0a2={'where':_0x4f5056[_0x938e('0x41')]};return db[_0x938e('0x33')][_0x938e('0x23')](_0x33a0a2)[_0x938e('0x2a')](function(_0x380f12){_0x1c9d48['count']=_0x380f12;if(_0x5957c1[_0x938e('0x39')]['includeAll']){_0x4f5056[_0x938e('0x45')]=[{'all':!![]}];}return db[_0x938e('0x33')][_0x938e('0x46')](_0x4f5056);})['then'](function(_0x4c2a77){_0x1c9d48[_0x938e('0x47')]=_0x4c2a77;return _0x1c9d48;})[_0x938e('0x2a')](respondWithFilteredResult(_0x563b1b,_0x4f5056))[_0x938e('0x48')](handleError(_0x563b1b,null));};exports[_0x938e('0x49')]=function(_0x29b054,_0x1d5c82){var _0x3a5909={'raw':![],'where':{'id':_0x29b054[_0x938e('0x4a')]['id']}},_0x3e5ed7={};_0x3e5ed7[_0x938e('0x35')]=_[_0x938e('0x36')](db[_0x938e('0x33')][_0x938e('0x34')]);_0x3e5ed7[_0x938e('0x39')]=_[_0x938e('0x36')](_0x29b054['query']);_0x3e5ed7[_0x938e('0x37')]=_['intersection'](_0x3e5ed7[_0x938e('0x35')],_0x3e5ed7['query']);_0x3a5909[_0x938e('0x3b')]=_['intersection'](_0x3e5ed7[_0x938e('0x35')],qs[_0x938e('0x3a')](_0x29b054[_0x938e('0x39')][_0x938e('0x3a')]));_0x3a5909['attributes']=_0x3a5909[_0x938e('0x3b')][_0x938e('0x4b')]?_0x3a5909[_0x938e('0x3b')]:_0x3e5ed7[_0x938e('0x35')];if(_0x29b054[_0x938e('0x39')]['includeAll']){_0x3a5909['include']=[{'all':!![]}];}_0x3a5909=_[_0x938e('0x42')]({},_0x3a5909,_0x29b054[_0x938e('0x44')]);return db['AnalyticCustomReport'][_0x938e('0x4c')](_0x3a5909)[_0x938e('0x2a')](handleEntityNotFound(_0x1d5c82,null))[_0x938e('0x2a')](respondWithResult(_0x1d5c82,null))[_0x938e('0x48')](handleError(_0x1d5c82,null));};exports[_0x938e('0x4d')]=function(_0x332aee,_0x11f66e){return db['AnalyticCustomReport'][_0x938e('0x4d')](_0x332aee['body'],{})['then'](function(_0x22fd89){var _0x38cdf3=_0x332aee[_0x938e('0x4e')][_0x938e('0x4f')]({'plain':!![]});if(!_0x38cdf3)throw new Error(_0x938e('0x50'));if(_0x38cdf3[_0x938e('0x51')]===_0x938e('0x4e')){var _0x3dd1d1=_0x22fd89[_0x938e('0x4f')]({'plain':!![]});var _0x55eae7='Reports';return db[_0x938e('0x52')][_0x938e('0x4c')]({'where':{'name':_0x55eae7,'userProfileId':_0x38cdf3[_0x938e('0x53')]},'raw':!![]})[_0x938e('0x2a')](function(_0x20e80e){if(_0x20e80e&&_0x20e80e['autoAssociation']===0x0){return db[_0x938e('0x54')]['create']({'name':_0x3dd1d1[_0x938e('0x2f')],'resourceId':_0x3dd1d1['id'],'type':_0x938e('0x2c'),'sectionId':_0x20e80e['id']},{})[_0x938e('0x2a')](function(){return _0x22fd89;});}else{return _0x22fd89;}})[_0x938e('0x48')](function(_0x4f24c0){logger[_0x938e('0x2d')](_0x938e('0x55'),_0x4f24c0);throw _0x4f24c0;});}return _0x22fd89;})[_0x938e('0x2a')](respondWithResult(_0x11f66e,0xc9))[_0x938e('0x48')](handleError(_0x11f66e,null));};exports['update']=function(_0x4a005f,_0x2e8a13){if(_0x4a005f[_0x938e('0x56')]['id']){delete _0x4a005f[_0x938e('0x56')]['id'];}return db[_0x938e('0x33')]['find']({'where':{'id':_0x4a005f[_0x938e('0x4a')]['id']}})[_0x938e('0x2a')](handleEntityNotFound(_0x2e8a13,null))[_0x938e('0x2a')](saveUpdates(_0x4a005f['body'],null))[_0x938e('0x2a')](respondWithResult(_0x2e8a13,null))[_0x938e('0x48')](handleError(_0x2e8a13,null));};exports[_0x938e('0x2b')]=function(_0x57a63a,_0x5121d6){return db['AnalyticCustomReport']['find']({'where':{'id':_0x57a63a[_0x938e('0x4a')]['id']}})[_0x938e('0x2a')](handleEntityNotFound(_0x5121d6,null))[_0x938e('0x2a')](removeEntity(_0x5121d6,null))[_0x938e('0x48')](handleError(_0x5121d6,null));};exports['preview']=function(_0x2056d6,_0x309b1c){var _0x5e8905=0xa;var _0xa8c757=[_0x938e('0x57'),_0x938e('0x58'),'right_join',_0x938e('0x59')];var _0x33d2be={'SUM':'SUM(%s)','COUNT':_0x938e('0x5a'),'COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':_0x938e('0x5d'),'AVG':_0x938e('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x938e('0x5f')};var _0x478d93={'SEC_TO_TIME':_0x938e('0x60'),'DATE':_0x938e('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':_0x938e('0x63')};var _0x2f1dc2=function(_0x2b219e){return!_[_0x938e('0x64')]([_0x938e('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x938e('0x66')],_0x2b219e);};var _0x385007=function(_0x4bcda1){if(!_0x4bcda1||!_0x4bcda1[_0x938e('0x67')][_0x938e('0x4b')]){return'';}for(var _0x112867='(',_0x540b63=0x0;_0x540b63<_0x4bcda1['rules'][_0x938e('0x4b')];_0x540b63+=0x1){_0x540b63>0x0&&(_0x112867+='\x20'+_0x4bcda1[_0x938e('0x68')]+'\x20');_0x112867+=_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x69')]?_0x385007(_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x69')]):_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6a')]+'\x20'+_0x4bcda1['rules'][_0x540b63][_0x938e('0x6b')]+(_0x2f1dc2(_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6b')])?'\x20'+_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6c')]:'');}return _0x112867+')';};var _0x118fea={'where':{'id':_0x2056d6[_0x938e('0x4a')]['id']}},_0x59606c,_0x2d9d2c,_0x59a5ee,_0x33321e,_0x31ad92;_0x118fea=_[_0x938e('0x42')]({},_0x118fea,_0x2056d6[_0x938e('0x44')]);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x118fea)['then'](function(_0x3e6273){if(_0x3e6273){_0x59606c=_0x3e6273;return _0x3e6273[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x464102){if(_0x464102){if(!_0x464102[_0x938e('0x4b')]){throw new db[(_0x938e('0x6e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d9d2c=_0x464102;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})[_0x938e('0x2a')](function(_0x43b5d8){if(_0x43b5d8){_0x59a5ee=_[_0x938e('0x70')](_0x43b5d8,'id');var _0x2961d3;var _0x2a4bb6=squel['select']();_0x2a4bb6[_0x938e('0x71')](_0x59606c['table']);for(var _0x47919e=0x0;_0x47919e<_0x2d9d2c[_0x938e('0x4b')];_0x47919e+=0x1){_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x72')]?_0x59a5ee[_0x2d9d2c[_0x47919e]['MetricId']][_0x938e('0x73')]:_0x2d9d2c[_0x47919e][_0x938e('0x6a')];_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x74')]?_[_0x938e('0x75')](_0x33d2be[_0x2d9d2c[_0x47919e][_0x938e('0x74')]],'%s',_0x2961d3):_0x2961d3;_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x76')]?_[_0x938e('0x75')](_0x478d93[_0x2d9d2c[_0x47919e][_0x938e('0x76')]],'%s',_0x2961d3):_0x2961d3;if(_0x2d9d2c[_0x47919e][_0x938e('0x77')]){_0x2a4bb6['group'](_0x2961d3);}_0x2d9d2c[_0x47919e]['orderBy']&&_0x2a4bb6[_0x938e('0x78')](_0x2961d3,_0x2d9d2c[_0x47919e][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x2a4bb6[_0x938e('0x6a')](_0x2961d3,_0x2d9d2c[_0x47919e][_0x938e('0x7b')]||_0x2961d3);}if(_0x59606c[_0x938e('0x7c')]){_0x59606c[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x59606c[_0x938e('0x7c')]);for(var _0x4ca690=0x0;_0x4ca690<_0x59606c[_0x938e('0x7c')][_0x938e('0x4b')];_0x4ca690+=0x1){if(_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7e')]&&_[_0x938e('0x64')](_0xa8c757,_0x59606c[_0x938e('0x7c')][_0x4ca690]['type'])&&_0x59606c['joins'][_0x4ca690][_0x938e('0x7f')]&&_0x59606c['joins'][_0x4ca690]['foreignTable']&&_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x80')]){_0x2a4bb6[_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7e')]](_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x81')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x59606c['table'],_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7f')],_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x81')],_0x59606c['joins'][_0x4ca690][_0x938e('0x80')]));}}}if(_0x59606c['conditions']){_0x59606c[_0x938e('0x82')]=JSON[_0x938e('0x7d')](_0x59606c[_0x938e('0x82')]);_0x2a4bb6[_0x938e('0x41')](_0x385007(_0x59606c[_0x938e('0x82')][_0x938e('0x69')]));}_0x31ad92=_0x2a4bb6['clone']();_0x2a4bb6['limit'](_0x5e8905);_0x2a4bb6[_0x938e('0x20')](0x0);logger[_0x938e('0x83')](_0x938e('0x84'),_0x2a4bb6['toString']());return dbH[_0x938e('0x85')][_0x938e('0x39')](_0x2a4bb6[_0x938e('0x86')](),{'type':dbH[_0x938e('0x85')][_0x938e('0x87')]['SELECT']});}})[_0x938e('0x2a')](respondWithResult(_0x309b1c,null))[_0x938e('0x48')](handleError(_0x309b1c,null));};function runReport(_0x3323c9,_0x1de096,_0xf528bc){var _0xd8c6eb=_0x1de096[_0x938e('0x2f')];var _0x55a67a=0xa;var _0x5d69bd=[_0x938e('0x57'),'left_join',_0x938e('0x88'),_0x938e('0x59')];var _0x46d5ac={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':_0x938e('0x5d'),'AVG':_0x938e('0x5e'),'GROUP_CONCAT':_0x938e('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ce2d7={'SEC_TO_TIME':_0x938e('0x60'),'DATE':'DATE(%s)','HOUR':_0x938e('0x8a'),'ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x28949c=function(_0xc5d731){return!_['includes']([_0x938e('0x65'),_0x938e('0x8b'),_0x938e('0x8c'),_0x938e('0x66')],_0xc5d731);};var _0x40a872=function(_0xf46f3c){if(!_0xf46f3c||!_0xf46f3c['rules'][_0x938e('0x4b')]){return'';}for(var _0x10aa33='(',_0xfce163=0x0;_0xfce163<_0xf46f3c['rules'][_0x938e('0x4b')];_0xfce163+=0x1){_0xfce163>0x0&&(_0x10aa33+='\x20'+_0xf46f3c[_0x938e('0x68')]+'\x20');_0x10aa33+=_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x69')]?_0x40a872(_0xf46f3c[_0x938e('0x67')][_0xfce163]['group']):_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6a')]+'\x20'+_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6b')]+(_0x28949c(_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6b')])?'\x20'+_0xf46f3c['rules'][_0xfce163][_0x938e('0x6c')]:'');}return _0x10aa33+')';};var _0x4a4ce1={'where':{'id':_0x3323c9['id']}},_0x2a5280,_0x5e22ad,_0x3b34d,_0x590d6d,_0x340639;_0x4a4ce1=_[_0x938e('0x42')]({},_0x4a4ce1,_0xf528bc);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x4a4ce1)[_0x938e('0x2a')](function(_0x3572a0){if(_0x3572a0){_0x2a5280=_0x3572a0;return _0x3572a0[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x14163e){if(_0x14163e){if(!_0x14163e[_0x938e('0x4b')]){throw new db['Sequelize']['ValidationErrorItem'](_0x938e('0x8d'),0x193);}_0x5e22ad=_0x14163e;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})['then'](function(_0x29a809){if(_0x29a809){_0x3b34d=_[_0x938e('0x70')](_0x29a809,'id');var _0x5f4c62;var _0x36e618=squel[_0x938e('0x8e')]();_0x36e618[_0x938e('0x71')](_0x2a5280['table']);for(var _0x5741b7=0x0;_0x5741b7<_0x5e22ad[_0x938e('0x4b')];_0x5741b7+=0x1){_0x5f4c62=_0x5e22ad[_0x5741b7]['MetricId']?_0x3b34d[_0x5e22ad[_0x5741b7][_0x938e('0x72')]][_0x938e('0x73')]:_0x5e22ad[_0x5741b7][_0x938e('0x6a')];_0x5f4c62=_0x5e22ad[_0x5741b7][_0x938e('0x74')]?_['replace'](_0x46d5ac[_0x5e22ad[_0x5741b7][_0x938e('0x74')]],'%s',_0x5f4c62):_0x5f4c62;_0x5f4c62=_0x5e22ad[_0x5741b7]['format']?_[_0x938e('0x75')](_0x4ce2d7[_0x5e22ad[_0x5741b7]['format']],'%s',_0x5f4c62):_0x5f4c62;if(_0x5e22ad[_0x5741b7]['groupBy']){_0x36e618[_0x938e('0x69')](_0x5f4c62);}_0x5e22ad[_0x5741b7][_0x938e('0x79')]&&_0x36e618[_0x938e('0x78')](_0x5f4c62,_0x5e22ad[_0x5741b7][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x36e618['field'](_0x5f4c62,_0x5e22ad[_0x5741b7][_0x938e('0x7b')]||_0x5f4c62);}if(_0x2a5280[_0x938e('0x7c')]){_0x2a5280[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x2a5280[_0x938e('0x7c')]);for(var _0x4a74ea=0x0;_0x4a74ea<_0x2a5280[_0x938e('0x7c')][_0x938e('0x4b')];_0x4a74ea+=0x1){if(_0x2a5280[_0x938e('0x7c')][_0x4a74ea]['type']&&_[_0x938e('0x64')](_0x5d69bd,_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7e')])&&_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7f')]&&_0x2a5280['joins'][_0x4a74ea][_0x938e('0x81')]&&_0x2a5280['joins'][_0x4a74ea][_0x938e('0x80')]){_0x36e618[_0x2a5280['joins'][_0x4a74ea][_0x938e('0x7e')]](_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x81')],null,util[_0x938e('0x76')]('%s.%s\x20=\x20%s.%s',_0x2a5280[_0x938e('0x8f')],_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7f')],_0x2a5280[_0x938e('0x7c')][_0x4a74ea]['foreignTable'],_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x80')]));}}}if(_0x2a5280['conditions']){_0x2a5280[_0x938e('0x82')]=JSON['parse'](_0x2a5280[_0x938e('0x82')]);_0x36e618[_0x938e('0x41')](_0x40a872(_0x2a5280['conditions'][_0x938e('0x69')]));}_0x340639=_0x36e618[_0x938e('0x90')]();_0x36e618[_0x938e('0x22')](_0x55a67a);_0x36e618[_0x938e('0x20')](0x0);return;}})[_0x938e('0x2a')](function(){if(_0x1de096[_0x938e('0x91')]===_0x938e('0x92')){return null;}var _0x42d6e2=_[_0x938e('0x42')](_0x1de096,{'name':_0x1de096['fullPath']||_0x1de096[_0x938e('0x2f')]||_0x2a5280[_0x938e('0x2f')],'basename':_0xd8c6eb,'savename':util[_0x938e('0x76')](_0x938e('0x93'),_0x1de096['name']||_0x2a5280[_0x938e('0x2f')],require(_0x938e('0x94'))[_0x938e('0x95')](0x4),_0x1de096[_0x938e('0x91')]||'csv'),'reportId':_0x2a5280['id'],'reportType':_0x938e('0x96')});return db['AnalyticExtractedReport'][_0x938e('0x4d')](_0x42d6e2,{'raw':!![]});})['then'](function(_0x21f3b4){if(_0x2a5280[_0x938e('0x8f')]===_0x938e('0x97')){_0x340639[_0x938e('0x41')](_0x2a5280[_0x938e('0x8f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1de096[_0x938e('0x98')],_0x1de096[_0x938e('0x99')]);}else{_0x340639[_0x938e('0x41')](_0x2a5280[_0x938e('0x8f')]+_0x938e('0x9a'),_0x1de096['startDate'],_0x1de096[_0x938e('0x99')]);}if(_0x21f3b4){logger[_0x938e('0x9b')](_0x938e('0x9c'),_0x340639[_0x938e('0x86')]());require(_0x938e('0x9d'))['fork'](path[_0x938e('0x57')](__dirname,_0x938e('0x9e'),_0x21f3b4[_0x938e('0x91')]),[_0x21f3b4['id'],_0x340639['toString'](),path[_0x938e('0x57')](__dirname,'../../files/reports',_0x21f3b4[_0x938e('0x9f')]),_0xd8c6eb]);return _0x21f3b4;}else{var _0x4e1a5d=squel[_0x938e('0x8e')]();_0x4e1a5d[_0x938e('0x71')]('('+_0x340639[_0x938e('0x86')]()+')',_0x938e('0xa0'));_0x4e1a5d[_0x938e('0x6a')](_0x938e('0xa1'),_0x938e('0x23'));_0x340639[_0x938e('0x22')](_0x1de096[_0x938e('0x22')]||_0x55a67a);_0x340639[_0x938e('0x20')](_0x1de096[_0x938e('0x20')]||0x0);return dbH[_0x938e('0x85')][_0x938e('0x39')](_0x4e1a5d[_0x938e('0x86')](),{'type':dbH['sequelize'][_0x938e('0x87')]['SELECT']})[_0x938e('0x2a')](function(_0x1e0e76){if(!_0x1e0e76[_0x938e('0x4b')]){_0x590d6d=0x0;}else{_0x590d6d=_0x1e0e76[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x340639[_0x938e('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x938e('0xa2')]});})['then'](function(_0x37c070){return{'rows':_0x37c070||[],'count':_0x590d6d};});}});}exports[_0x938e('0xa3')]=function(_0x46f827,_0x4e2e46){return runReport(_0x46f827[_0x938e('0x4a')],_0x46f827['query'],_0x46f827[_0x938e('0x44')])[_0x938e('0x2a')](respondWithResult(_0x4e2e46,null))[_0x938e('0x48')](handleError(_0x4e2e46,null));};exports[_0x938e('0xa4')]=runReport;exports[_0x938e('0x39')]=function(_0x12345a,_0x5a4e0b){var _0x4b0dad=0xa;var _0x59d786=[_0x938e('0x57'),_0x938e('0x58'),_0x938e('0x88'),'cross_join'];var _0x6001fd={'SUM':_0x938e('0xa5'),'COUNT':_0x938e('0x5a'),'COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x938e('0x89'),'GROUP_CONCAT ASC':_0x938e('0xa6'),'GROUP_CONCAT DESC':_0x938e('0x5f')};var _0x41f375={'SEC_TO_TIME':_0x938e('0x60'),'DATE':'DATE(%s)','HOUR':_0x938e('0x8a'),'ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3c811d=function(_0xc70ff6){return!_['includes']([_0x938e('0x65'),_0x938e('0x8b'),'IS\x20EMPTY',_0x938e('0x66')],_0xc70ff6);};var _0x2e5393=function(_0x1d439c){if(!_0x1d439c||!_0x1d439c[_0x938e('0x67')]['length']){return'';}for(var _0x41a960='(',_0x1a9686=0x0;_0x1a9686<_0x1d439c['rules']['length'];_0x1a9686+=0x1){_0x1a9686>0x0&&(_0x41a960+='\x20'+_0x1d439c[_0x938e('0x68')]+'\x20');_0x41a960+=_0x1d439c['rules'][_0x1a9686]['group']?_0x2e5393(_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x69')]):_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x6a')]+'\x20'+_0x1d439c['rules'][_0x1a9686]['condition']+(_0x3c811d(_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x6b')])?'\x20'+_0x1d439c['rules'][_0x1a9686]['value']:'');}return _0x41a960+')';};var _0x424510={'where':{'id':_0x12345a[_0x938e('0x4a')]['id']}},_0x5aca5f,_0x47e358,_0x219f30,_0x288dfa,_0x38f9ac;_0x424510=_[_0x938e('0x42')]({},_0x424510,_0x12345a['options']);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x424510)[_0x938e('0x2a')](function(_0x58f689){if(_0x58f689){_0x5aca5f=_0x58f689;return _0x58f689[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x5e0c56){if(_0x5e0c56){if(!_0x5e0c56[_0x938e('0x4b')]){throw new db[(_0x938e('0x6e'))][(_0x938e('0xa7'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x47e358=_0x5e0c56;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})['then'](function(_0x213335){if(_0x213335){_0x219f30=_[_0x938e('0x70')](_0x213335,'id');var _0x3cc393;var _0x3a28a7=squel[_0x938e('0x8e')]();_0x3a28a7[_0x938e('0x71')](_0x5aca5f[_0x938e('0x8f')]);for(var _0x13a857=0x0;_0x13a857<_0x47e358[_0x938e('0x4b')];_0x13a857+=0x1){_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x72')]?_0x219f30[_0x47e358[_0x13a857]['MetricId']]['metric']:_0x47e358[_0x13a857][_0x938e('0x6a')];_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x74')]?_['replace'](_0x6001fd[_0x47e358[_0x13a857][_0x938e('0x74')]],'%s',_0x3cc393):_0x3cc393;_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x76')]?_[_0x938e('0x75')](_0x41f375[_0x47e358[_0x13a857][_0x938e('0x76')]],'%s',_0x3cc393):_0x3cc393;if(_0x47e358[_0x13a857]['groupBy']){_0x3a28a7['group'](_0x3cc393);}_0x47e358[_0x13a857][_0x938e('0x79')]&&_0x3a28a7[_0x938e('0x78')](_0x3cc393,_0x47e358[_0x13a857][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x3a28a7[_0x938e('0x6a')](_0x3cc393,_0x47e358[_0x13a857][_0x938e('0x7b')]||_0x3cc393);}if(_0x5aca5f[_0x938e('0x7c')]){_0x5aca5f[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x5aca5f[_0x938e('0x7c')]);for(var _0x171bf8=0x0;_0x171bf8<_0x5aca5f[_0x938e('0x7c')][_0x938e('0x4b')];_0x171bf8+=0x1){if(_0x5aca5f['joins'][_0x171bf8][_0x938e('0x7e')]&&_[_0x938e('0x64')](_0x59d786,_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x7e')])&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x7f')]&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')]&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x80')]){_0x3a28a7[_0x5aca5f['joins'][_0x171bf8][_0x938e('0x7e')]](_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')],null,util[_0x938e('0x76')](_0x938e('0xa8'),_0x5aca5f[_0x938e('0x8f')],_0x5aca5f['joins'][_0x171bf8]['parentKey'],_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')],_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x80')]));}}}if(_0x5aca5f['conditions']){_0x5aca5f[_0x938e('0x82')]=JSON[_0x938e('0x7d')](_0x5aca5f['conditions']);_0x3a28a7['where'](_0x2e5393(_0x5aca5f['conditions']['group']));}_0x38f9ac=_0x3a28a7[_0x938e('0x90')]();_0x3a28a7[_0x938e('0x22')](_0x4b0dad);_0x3a28a7[_0x938e('0x20')](0x0);logger[_0x938e('0x83')](_0x938e('0x84'),_0x3a28a7[_0x938e('0x86')]());return dbH['sequelize']['query'](_0x3a28a7['toString'](),{'type':dbH['sequelize'][_0x938e('0x87')][_0x938e('0xa2')]});}})['then'](function(){return{'sql':_0x38f9ac[_0x938e('0x86')]()};})[_0x938e('0x2a')](respondWithResult(_0x5a4e0b,null))[_0x938e('0x48')](handleError(_0x5a4e0b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a649afc..6f502ea 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 _0xb8b3=['define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports'];(function(_0x5a6452,_0xbfc8b8){var _0x358889=function(_0x230ee6){while(--_0x230ee6){_0x5a6452['push'](_0x5a6452['shift']());}};_0x358889(++_0xbfc8b8);}(_0xb8b3,0x9e));var _0x3b8b=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xb8b3[_0xa3463d];return _0x50fd67;};'use strict';var _=require(_0x3b8b('0x0'));var util=require(_0x3b8b('0x1'));var logger=require(_0x3b8b('0x2'))(_0x3b8b('0x3'));var moment=require(_0x3b8b('0x4'));var BPromise=require(_0x3b8b('0x5'));var rp=require(_0x3b8b('0x6'));var fs=require('fs');var path=require(_0x3b8b('0x7'));var rimraf=require(_0x3b8b('0x8'));var config=require('../../config/environment');var attributes=require(_0x3b8b('0x9'));module[_0x3b8b('0xa')]=function(_0x5ddc5b,_0x65a78f){return _0x5ddc5b[_0x3b8b('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0x3b8b('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d05=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','AnalyticCustomReport'];(function(_0x590861,_0x42c7f3){var _0x1d0a80=function(_0x42d3de){while(--_0x42d3de){_0x590861['push'](_0x590861['shift']());}};_0x1d0a80(++_0x42c7f3);}(_0x0d05,0x171));var _0x50d0=function(_0x19fadd,_0x2757eb){_0x19fadd=_0x19fadd-0x0;var _0x247641=_0x0d05[_0x19fadd];return _0x247641;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x50d0('0x0'))(_0x50d0('0x1'));var moment=require('moment');var BPromise=require(_0x50d0('0x2'));var rp=require(_0x50d0('0x3'));var fs=require('fs');var path=require(_0x50d0('0x4'));var rimraf=require(_0x50d0('0x5'));var config=require(_0x50d0('0x6'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x132290,_0x1cf8c6){return _0x132290[_0x50d0('0x7')](_0x50d0('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9f6ddf2..a662501 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 _0xd80a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b778c,_0x5cc298){var _0xbca7d3=function(_0x5b97a9){while(--_0x5b97a9){_0x1b778c['push'](_0x1b778c['shift']());}};_0xbca7d3(++_0x5cc298);}(_0xd80a,0x197));var _0xad80=function(_0x3b565d,_0x511fce){_0x3b565d=_0x3b565d-0x0;var _0x1849d3=_0xd80a[_0x3b565d];return _0x1849d3;};'use strict';var _=require(_0xad80('0x0'));var util=require(_0xad80('0x1'));var moment=require(_0xad80('0x2'));var BPromise=require(_0xad80('0x3'));var rs=require(_0xad80('0x4'));var fs=require('fs');var Redis=require(_0xad80('0x5'));var db=require(_0xad80('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xad80('0x7'))(_0xad80('0x8'));var config=require(_0xad80('0x9'));var jayson=require(_0xad80('0xa'));var client=jayson[_0xad80('0xb')][_0xad80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39bf56,_0x106a25,_0x4d1db7){return new BPromise(function(_0x4377cf,_0x41dc59){return client['request'](_0x39bf56,_0x4d1db7)['then'](function(_0x300763){logger[_0xad80('0xd')](_0xad80('0xe'),_0x106a25,_0xad80('0xf'));logger[_0xad80('0x10')](_0xad80('0x11'),_0x106a25,_0xad80('0xf'),JSON[_0xad80('0x12')](_0x300763));if(_0x300763[_0xad80('0x13')]){if(_0x300763[_0xad80('0x13')]['code']===0x1f4){logger[_0xad80('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x106a25,_0x300763[_0xad80('0x13')][_0xad80('0x14')]);return _0x41dc59(_0x300763['error'][_0xad80('0x14')]);}logger[_0xad80('0x13')](_0xad80('0xe'),_0x106a25,_0x300763[_0xad80('0x13')]['message']);return _0x4377cf(_0x300763[_0xad80('0x13')][_0xad80('0x14')]);}else{logger['info'](_0xad80('0xe'),_0x106a25,_0xad80('0xf'));_0x4377cf(_0x300763[_0xad80('0x15')][_0xad80('0x14')]);}})[_0xad80('0x16')](function(_0x1cfa37){logger[_0xad80('0x13')](_0xad80('0xe'),_0x106a25,_0x1cfa37);_0x41dc59(_0x1cfa37);});});} \ No newline at end of file +var _0xcb85=['http','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x64bb04,_0x5f4f72){var _0x21f87d=function(_0x4a0253){while(--_0x4a0253){_0x64bb04['push'](_0x64bb04['shift']());}};_0x21f87d(++_0x5f4f72);}(_0xcb85,0xe8));var _0x5cb8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcb85[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5cb8('0x0'));var util=require('util');var moment=require(_0x5cb8('0x1'));var BPromise=require(_0x5cb8('0x2'));var rs=require(_0x5cb8('0x3'));var fs=require('fs');var Redis=require(_0x5cb8('0x4'));var db=require(_0x5cb8('0x5'))['db'];var utils=require(_0x5cb8('0x6'));var logger=require(_0x5cb8('0x7'))(_0x5cb8('0x8'));var config=require('../../config/environment');var jayson=require(_0x5cb8('0x9'));var client=jayson['client'][_0x5cb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e4fec,_0x3cf8a6,_0x5e4b51){return new BPromise(function(_0x2a1ad3,_0x28829d){return client['request'](_0x4e4fec,_0x5e4b51)[_0x5cb8('0xb')](function(_0x12519a){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0x5cb8('0xc'));logger[_0x5cb8('0xd')](_0x5cb8('0xe'),_0x3cf8a6,_0x5cb8('0xc'),JSON['stringify'](_0x12519a));if(_0x12519a['error']){if(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x10')]===0x1f4){logger['error'](_0x5cb8('0x11'),_0x3cf8a6,_0x12519a[_0x5cb8('0xf')]['message']);return _0x28829d(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);}logger[_0x5cb8('0xf')](_0x5cb8('0x11'),_0x3cf8a6,_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);return _0x2a1ad3(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);}else{logger[_0x5cb8('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0x5cb8('0xc'));_0x2a1ad3(_0x12519a[_0x5cb8('0x14')][_0x5cb8('0x12')]);}})[_0x5cb8('0x15')](function(_0xc085b){logger[_0x5cb8('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0xc085b);_0x28829d(_0xc085b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8ce0e64..3460774 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 _0x82d9=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','preview','run','query','post','put','update','delete'];(function(_0x541dfb,_0x45ebee){var _0x9607f9=function(_0x15475d){while(--_0x15475d){_0x541dfb['push'](_0x541dfb['shift']());}};_0x9607f9(++_0x45ebee);}(_0x82d9,0x1b0));var _0x982d=function(_0x2082af,_0xb25312){_0x2082af=_0x2082af-0x0;var _0x1d82b6=_0x82d9[_0x2082af];return _0x1d82b6;};'use strict';var multer=require(_0x982d('0x0'));var util=require('util');var path=require(_0x982d('0x1'));var timeout=require(_0x982d('0x2'));var express=require(_0x982d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x982d('0x4'));var interaction=require(_0x982d('0x5'));var config=require('../../config/environment');var controller=require(_0x982d('0x6'));router[_0x982d('0x7')]('/',auth[_0x982d('0x8')](),controller[_0x982d('0x9')]);router[_0x982d('0x7')](_0x982d('0xa'),auth[_0x982d('0x8')](),controller['show']);router[_0x982d('0x7')]('/:id/preview',auth[_0x982d('0x8')](),controller[_0x982d('0xb')]);router[_0x982d('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x982d('0xc')]);router[_0x982d('0x7')]('/:id/query',auth[_0x982d('0x8')](),controller[_0x982d('0xd')]);router[_0x982d('0xe')]('/',auth[_0x982d('0x8')](),controller['create']);router[_0x982d('0xf')](_0x982d('0xa'),auth[_0x982d('0x8')](),controller[_0x982d('0x10')]);router[_0x982d('0x11')](_0x982d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33f1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','/:id/query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0x33f1,0x126));var _0x133f=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0x33f1[_0x3cc05d];return _0x28b736;};'use strict';var multer=require(_0x133f('0x0'));var util=require(_0x133f('0x1'));var path=require(_0x133f('0x2'));var timeout=require(_0x133f('0x3'));var express=require(_0x133f('0x4'));var router=express[_0x133f('0x5')]();var fs_extra=require(_0x133f('0x6'));var auth=require(_0x133f('0x7'));var interaction=require(_0x133f('0x8'));var config=require(_0x133f('0x9'));var controller=require(_0x133f('0xa'));router[_0x133f('0xb')]('/',auth[_0x133f('0xc')](),controller[_0x133f('0xd')]);router[_0x133f('0xb')]('/:id',auth[_0x133f('0xc')](),controller[_0x133f('0xe')]);router[_0x133f('0xb')]('/:id/preview',auth[_0x133f('0xc')](),controller[_0x133f('0xf')]);router['get'](_0x133f('0x10'),auth['isAuthenticated'](),controller[_0x133f('0x11')]);router[_0x133f('0xb')](_0x133f('0x12'),auth['isAuthenticated'](),controller['query']);router[_0x133f('0x13')]('/',auth[_0x133f('0xc')](),controller[_0x133f('0x14')]);router[_0x133f('0x15')](_0x133f('0x16'),auth[_0x133f('0xc')](),controller[_0x133f('0x17')]);router[_0x133f('0x18')](_0x133f('0x16'),auth['isAuthenticated'](),controller[_0x133f('0x19')]);module[_0x133f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 29328b9..f3b23bb 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x5490fa,_0x42eb1c){var _0x47b560=function(_0x3f2906){while(--_0x3f2906){_0x5490fa['push'](_0x5490fa['shift']());}};_0x47b560(++_0x42eb1c);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x39cd16,_0x5dfe1c){var _0xa7b510=function(_0x3714c6){while(--_0x3714c6){_0x39cd16['push'](_0x39cd16['shift']());}};_0xa7b510(++_0x5dfe1c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3d90f1,_0xf25e08){_0x3d90f1=_0x3d90f1-0x0;var _0x3af913=_0x3f8a[_0x3d90f1];return _0x3af913;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 44bcf5e..6c0f75c 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 _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x160ed3,_0x1ee9ed){var _0x293631=function(_0x18dff4){while(--_0x18dff4){_0x160ed3['push'](_0x160ed3['shift']());}};_0x293631(++_0x1ee9ed);}(_0xf494,0x1c6));var _0x4f49=function(_0x11f4d7,_0xfabaa5){_0x11f4d7=_0x11f4d7-0x0;var _0x410105=_0xf494[_0x11f4d7];return _0x410105;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file +var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x55131f,_0x4ea454){_0x55131f=_0x55131f-0x0;var _0x136eb0=_0xc6ac[_0x55131f];return _0x136eb0;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2b9dfd8..25a374a 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 _0xda86=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','util','moment','bluebird','request-promise','path'];(function(_0x4b1e96,_0x4af1ad){var _0x50616d=function(_0x3087f7){while(--_0x3087f7){_0x4b1e96['push'](_0x4b1e96['shift']());}};_0x50616d(++_0x4af1ad);}(_0xda86,0xb6));var _0x6da8=function(_0x201859,_0x52f6e7){_0x201859=_0x201859-0x0;var _0x23896b=_0xda86[_0x201859];return _0x23896b;};'use strict';var _=require('lodash');var util=require(_0x6da8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6da8('0x1'));var BPromise=require(_0x6da8('0x2'));var rp=require(_0x6da8('0x3'));var fs=require('fs');var path=require(_0x6da8('0x4'));var rimraf=require(_0x6da8('0x5'));var config=require(_0x6da8('0x6'));var attributes=require(_0x6da8('0x7'));module[_0x6da8('0x8')]=function(_0x175f35,_0x581e34){return _0x175f35[_0x6da8('0x9')](_0x6da8('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f27=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe1269d,_0x57b7c3){var _0x261ca1=function(_0x13b234){while(--_0x13b234){_0xe1269d['push'](_0xe1269d['shift']());}};_0x261ca1(++_0x57b7c3);}(_0x5f27,0xad));var _0x75f2=function(_0x2610db,_0x1ff983){_0x2610db=_0x2610db-0x0;var _0x5dd7bb=_0x5f27[_0x2610db];return _0x5dd7bb;};'use strict';var _=require(_0x75f2('0x0'));var util=require(_0x75f2('0x1'));var logger=require(_0x75f2('0x2'))(_0x75f2('0x3'));var moment=require(_0x75f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x75f2('0x5'));var fs=require('fs');var path=require(_0x75f2('0x6'));var rimraf=require(_0x75f2('0x7'));var config=require(_0x75f2('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x75f2('0x9')]=function(_0x3c48a5,_0xecde1c){return _0x3c48a5[_0x75f2('0xa')](_0x75f2('0xb'),attributes,{'tableName':_0x75f2('0xc'),'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 65c57c8..4216eae 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 _0x1d45=['request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x41b4dc,_0x2967f9){var _0x39caa7=function(_0x4af918){while(--_0x4af918){_0x41b4dc['push'](_0x41b4dc['shift']());}};_0x39caa7(++_0x2967f9);}(_0x1d45,0x166));var _0x51d4=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x1d45[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x51d4('0x0'));var util=require('util');var moment=require(_0x51d4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51d4('0x2'));var db=require(_0x51d4('0x3'))['db'];var utils=require(_0x51d4('0x4'));var logger=require('../../config/logger')(_0x51d4('0x5'));var config=require(_0x51d4('0x6'));var jayson=require(_0x51d4('0x7'));var client=jayson[_0x51d4('0x8')][_0x51d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56dfc,_0x73c8dc,_0x4c8775){return new BPromise(function(_0x566505,_0x2c6ea1){return client[_0x51d4('0xa')](_0x56dfc,_0x4c8775)[_0x51d4('0xb')](function(_0x14d0b4){logger[_0x51d4('0xc')](_0x51d4('0xd'),_0x73c8dc,_0x51d4('0xe'));logger[_0x51d4('0xf')](_0x51d4('0x10'),_0x73c8dc,_0x51d4('0xe'),JSON[_0x51d4('0x11')](_0x14d0b4));if(_0x14d0b4['error']){if(_0x14d0b4[_0x51d4('0x12')][_0x51d4('0x13')]===0x1f4){logger['error'](_0x51d4('0xd'),_0x73c8dc,_0x14d0b4[_0x51d4('0x12')][_0x51d4('0x14')]);return _0x2c6ea1(_0x14d0b4[_0x51d4('0x12')][_0x51d4('0x14')]);}logger[_0x51d4('0x12')](_0x51d4('0xd'),_0x73c8dc,_0x14d0b4[_0x51d4('0x12')][_0x51d4('0x14')]);return _0x566505(_0x14d0b4[_0x51d4('0x12')][_0x51d4('0x14')]);}else{logger[_0x51d4('0xc')](_0x51d4('0xd'),_0x73c8dc,_0x51d4('0xe'));_0x566505(_0x14d0b4[_0x51d4('0x15')][_0x51d4('0x14')]);}})[_0x51d4('0x16')](function(_0x26821a){logger[_0x51d4('0x12')](_0x51d4('0xd'),_0x73c8dc,_0x26821a);_0x2c6ea1(_0x26821a);});});} \ No newline at end of file +var _0x9438=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9438,0x112));var _0x8943=function(_0x574f89,_0x1d75f4){_0x574f89=_0x574f89-0x0;var _0x35aaf3=_0x9438[_0x574f89];return _0x35aaf3;};'use strict';var _=require(_0x8943('0x0'));var util=require('util');var moment=require(_0x8943('0x1'));var BPromise=require(_0x8943('0x2'));var rs=require(_0x8943('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8943('0x4'))['db'];var utils=require(_0x8943('0x5'));var logger=require(_0x8943('0x6'))(_0x8943('0x7'));var config=require(_0x8943('0x8'));var jayson=require(_0x8943('0x9'));var client=jayson[_0x8943('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x343639,_0x42e5b1,_0x1b12d3){return new BPromise(function(_0x295606,_0x338b5b){return client['request'](_0x343639,_0x1b12d3)[_0x8943('0xb')](function(_0x52837d){logger['info'](_0x8943('0xc'),_0x42e5b1,_0x8943('0xd'));logger[_0x8943('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x42e5b1,_0x8943('0xd'),JSON['stringify'](_0x52837d));if(_0x52837d[_0x8943('0xf')]){if(_0x52837d[_0x8943('0xf')][_0x8943('0x10')]===0x1f4){logger[_0x8943('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x42e5b1,_0x52837d[_0x8943('0xf')][_0x8943('0x11')]);return _0x338b5b(_0x52837d['error'][_0x8943('0x11')]);}logger[_0x8943('0xf')](_0x8943('0xc'),_0x42e5b1,_0x52837d[_0x8943('0xf')]['message']);return _0x295606(_0x52837d['error'][_0x8943('0x11')]);}else{logger[_0x8943('0x12')](_0x8943('0xc'),_0x42e5b1,_0x8943('0xd'));_0x295606(_0x52837d[_0x8943('0x13')][_0x8943('0x11')]);}})[_0x8943('0x14')](function(_0x17d42c){logger[_0x8943('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x42e5b1,_0x17d42c);_0x338b5b(_0x17d42c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 857a76b..be9f761 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 _0xcec9=['/:id/query','query','post','create','put','update','delete','destroy','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run'];(function(_0x18ac58,_0x567d3a){var _0x31406f=function(_0x34564b){while(--_0x34564b){_0x18ac58['push'](_0x18ac58['shift']());}};_0x31406f(++_0x567d3a);}(_0xcec9,0x7b));var _0x9cec=function(_0x2ecaeb,_0x14a35d){_0x2ecaeb=_0x2ecaeb-0x0;var _0x1f3e62=_0xcec9[_0x2ecaeb];return _0x1f3e62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9cec('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cec('0x1')]();var fs_extra=require(_0x9cec('0x2'));var auth=require(_0x9cec('0x3'));var interaction=require(_0x9cec('0x4'));var config=require(_0x9cec('0x5'));var controller=require(_0x9cec('0x6'));router[_0x9cec('0x7')]('/',auth[_0x9cec('0x8')](),controller[_0x9cec('0x9')]);router[_0x9cec('0x7')](_0x9cec('0xa'),auth[_0x9cec('0x8')](),controller[_0x9cec('0xb')]);router[_0x9cec('0x7')](_0x9cec('0xc'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x9cec('0xd'),auth[_0x9cec('0x8')](),controller[_0x9cec('0xe')]);router[_0x9cec('0x7')](_0x9cec('0xf'),auth['isAuthenticated'](),controller[_0x9cec('0x10')]);router[_0x9cec('0x11')]('/',auth[_0x9cec('0x8')](),controller[_0x9cec('0x12')]);router[_0x9cec('0x13')](_0x9cec('0xa'),auth[_0x9cec('0x8')](),controller[_0x9cec('0x14')]);router[_0x9cec('0x15')](_0x9cec('0xa'),auth[_0x9cec('0x8')](),controller[_0x9cec('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports','multer','util','path','Router'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2630,0x79));var _0x0263=function(_0x2e8373,_0x49c02c){_0x2e8373=_0x2e8373-0x0;var _0x3cafdb=_0x2630[_0x2e8373];return _0x3cafdb;};'use strict';var multer=require(_0x0263('0x0'));var util=require(_0x0263('0x1'));var path=require(_0x0263('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0263('0x3')]();var fs_extra=require(_0x0263('0x4'));var auth=require(_0x0263('0x5'));var interaction=require(_0x0263('0x6'));var config=require(_0x0263('0x7'));var controller=require(_0x0263('0x8'));router['get']('/',auth[_0x0263('0x9')](),controller[_0x0263('0xa')]);router['get'](_0x0263('0xb'),auth[_0x0263('0x9')](),controller[_0x0263('0xc')]);router[_0x0263('0xd')](_0x0263('0xe'),auth['isAuthenticated'](),controller[_0x0263('0xf')]);router[_0x0263('0xd')](_0x0263('0x10'),auth[_0x0263('0x9')](),controller[_0x0263('0x11')]);router['get'](_0x0263('0x12'),auth['isAuthenticated'](),controller[_0x0263('0x13')]);router[_0x0263('0x14')]('/',auth[_0x0263('0x9')](),controller['create']);router[_0x0263('0x15')]('/:id',auth[_0x0263('0x9')](),controller['update']);router[_0x0263('0x16')](_0x0263('0xb'),auth[_0x0263('0x9')](),controller[_0x0263('0x17')]);module[_0x0263('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8b8a9ae..7353dff 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 _0x6af3=['scheduled','exports','STRING','ENUM','csv','pdf','DATE','manual'];(function(_0x27a60d,_0x5e5917){var _0x53b6f1=function(_0xb75da0){while(--_0xb75da0){_0x27a60d['push'](_0x27a60d['shift']());}};_0x53b6f1(++_0x5e5917);}(_0x6af3,0x1e9));var _0x36af=function(_0x2014d0,_0x42bb9d){_0x2014d0=_0x2014d0-0x0;var _0xa02e35=_0x6af3[_0x2014d0];return _0xa02e35;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x36af('0x0')]={'name':{'type':Sequelize[_0x36af('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x36af('0x2')](_0x36af('0x3'),_0x36af('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x36af('0x3')},'savename':{'type':Sequelize[_0x36af('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x36af('0x5')]},'endDate':{'type':Sequelize[_0x36af('0x5')]},'status':{'type':Sequelize[_0x36af('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x36af('0x2')](_0x36af('0x6'),_0x36af('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x36af('0x1')]}}; \ No newline at end of file +var _0x6115=['DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','pdf','xlsx','csv'];(function(_0x1cfba6,_0x35adc8){var _0x4697d3=function(_0x34cacb){while(--_0x34cacb){_0x1cfba6['push'](_0x1cfba6['shift']());}};_0x4697d3(++_0x35adc8);}(_0x6115,0xad));var _0x5611=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6115[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5611('0x0'));var moment=require(_0x5611('0x1'));module['exports']={'name':{'type':Sequelize[_0x5611('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x5611('0x3')]('csv',_0x5611('0x4'),_0x5611('0x5')),'allowNull':![],'defaultValue':_0x5611('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x5611('0x7')]},'status':{'type':Sequelize[_0x5611('0x2')],'defaultValue':_0x5611('0x8')},'type':{'type':Sequelize[_0x5611('0x3')](_0x5611('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x5611('0x9')},'reportId':{'type':Sequelize[_0x5611('0xa')](0xb)[_0x5611('0xb')]},'reportType':{'type':Sequelize[_0x5611('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 305a1af..deb245b 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 _0xdff7=['reject','save','update','destroy','then','get','ExtractedReports','sendStatus','error','name','send','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','AnalyticExtractedReport','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xdff7,0x15f));var _0x7dff=function(_0x2affbe,_0x1114b2){_0x2affbe=_0x2affbe-0x0;var _0x111955=_0xdff7[_0x2affbe];return _0x111955;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7dff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dff('0x1'));var rp=require('request-promise');var moment=require(_0x7dff('0x2'));var BPromise=require(_0x7dff('0x3'));var Mustache=require(_0x7dff('0x4'));var util=require(_0x7dff('0x5'));var path=require(_0x7dff('0x6'));var sox=require(_0x7dff('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dff('0x8'));var _=require(_0x7dff('0x9'));var squel=require(_0x7dff('0xa'));var crypto=require(_0x7dff('0xb'));var jsforce=require(_0x7dff('0xc'));var deskjs=require(_0x7dff('0xd'));var toCsv=require(_0x7dff('0xe'));var querystring=require('querystring');var Papa=require(_0x7dff('0xf'));var Redis=require(_0x7dff('0x10'));var authService=require(_0x7dff('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7dff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7dff('0x13'));var utils=require(_0x7dff('0x14'));var config=require(_0x7dff('0x15'));var licenseUtil=require(_0x7dff('0x16'));var db=require(_0x7dff('0x17'))['db'];function respondWithStatusCode(_0x2a21de,_0x269320){_0x269320=_0x269320||0xcc;return function(_0x260e81){if(_0x260e81){return _0x2a21de['sendStatus'](_0x269320);}return _0x2a21de[_0x7dff('0x18')](_0x269320)[_0x7dff('0x19')]();};}function respondWithResult(_0x558042,_0x10ff77){_0x10ff77=_0x10ff77||0xc8;return function(_0x47a0af){if(_0x47a0af){return _0x558042['status'](_0x10ff77)['json'](_0x47a0af);}};}function respondWithFilteredResult(_0xf15d23,_0x23c953){return function(_0x272ff8){if(_0x272ff8){var _0xf54b07=typeof _0x23c953[_0x7dff('0x1a')]===_0x7dff('0x1b')&&typeof _0x23c953[_0x7dff('0x1c')]===_0x7dff('0x1b');var _0x2b403d=_0x272ff8[_0x7dff('0x1d')];var _0x10ec4c=_0xf54b07?0x0:_0x23c953['offset'];var _0x4c719c=_0xf54b07?_0x272ff8[_0x7dff('0x1d')]:_0x23c953[_0x7dff('0x1a')]+_0x23c953[_0x7dff('0x1c')];var _0x44524d;if(_0x4c719c>=_0x2b403d){_0x4c719c=_0x2b403d;_0x44524d=0xc8;}else{_0x44524d=0xce;}_0xf15d23[_0x7dff('0x18')](_0x44524d);return _0xf15d23[_0x7dff('0x1e')](_0x7dff('0x1f'),_0x10ec4c+'-'+_0x4c719c+'/'+_0x2b403d)['json'](_0x272ff8);}return null;};}function patchUpdates(_0x427ed3){return function(_0x525427){try{jsonpatch[_0x7dff('0x20')](_0x525427,_0x427ed3,!![]);}catch(_0x2dddcc){return BPromise[_0x7dff('0x21')](_0x2dddcc);}return _0x525427[_0x7dff('0x22')]();};}function saveUpdates(_0x35b9f1,_0xa5917b){return function(_0xdb9ac5){if(_0xdb9ac5){return _0xdb9ac5[_0x7dff('0x23')](_0x35b9f1)['then'](function(_0x54c9ec){return _0x54c9ec;});}return null;};}function removeEntity(_0x5d600a,_0x3634d2){return function(_0x3e2f84){if(_0x3e2f84){return _0x3e2f84[_0x7dff('0x24')]()[_0x7dff('0x25')](function(){var _0x432dd8=_0x3e2f84[_0x7dff('0x26')]({'plain':!![]});var _0x13954e=_0x7dff('0x27');return db['UserProfileResource'][_0x7dff('0x24')]({'where':{'type':_0x13954e,'resourceId':_0x432dd8['id']}})[_0x7dff('0x25')](function(){return _0x3e2f84;});})['then'](function(){_0x5d600a[_0x7dff('0x18')](0xcc)[_0x7dff('0x19')]();});}};}function handleEntityNotFound(_0x443faf,_0x18ec1e){return function(_0x1c6311){if(!_0x1c6311){_0x443faf[_0x7dff('0x28')](0x194);}return _0x1c6311;};}function handleError(_0x52c88c,_0x302b0a){_0x302b0a=_0x302b0a||0x1f4;return function(_0x57328f){logger[_0x7dff('0x29')](_0x57328f['stack']);if(_0x57328f[_0x7dff('0x2a')]){delete _0x57328f[_0x7dff('0x2a')];}_0x52c88c[_0x7dff('0x18')](_0x302b0a)[_0x7dff('0x2b')](_0x57328f);};}exports['index']=function(_0x522c0d,_0x2f1bfe){var _0x132871={},_0x50f295={},_0x2fd604={'count':0x0,'rows':[]};var _0xd296c6=_[_0x7dff('0x2c')](db['AnalyticExtractedReport'][_0x7dff('0x2d')],function(_0x340997){return{'name':_0x340997['fieldName'],'type':_0x340997['type'][_0x7dff('0x2e')]};});_0x50f295['model']=_['map'](_0xd296c6,_0x7dff('0x2a'));_0x50f295[_0x7dff('0x2f')]=_[_0x7dff('0x30')](_0x522c0d[_0x7dff('0x2f')]);_0x50f295[_0x7dff('0x31')]=_[_0x7dff('0x32')](_0x50f295['model'],_0x50f295[_0x7dff('0x2f')]);_0x132871[_0x7dff('0x33')]=_[_0x7dff('0x32')](_0x50f295[_0x7dff('0x34')],qs[_0x7dff('0x35')](_0x522c0d['query'][_0x7dff('0x35')]));_0x132871['attributes']=_0x132871['attributes'][_0x7dff('0x36')]?_0x132871[_0x7dff('0x33')]:_0x50f295[_0x7dff('0x34')];if(!_0x522c0d[_0x7dff('0x2f')][_0x7dff('0x37')](_0x7dff('0x38'))){_0x132871['limit']=qs['limit'](_0x522c0d[_0x7dff('0x2f')][_0x7dff('0x1c')]);_0x132871[_0x7dff('0x1a')]=qs[_0x7dff('0x1a')](_0x522c0d[_0x7dff('0x2f')][_0x7dff('0x1a')]);}_0x132871[_0x7dff('0x39')]=qs[_0x7dff('0x3a')](_0x522c0d[_0x7dff('0x2f')]['sort']);_0x132871[_0x7dff('0x3b')]=qs[_0x7dff('0x31')](_[_0x7dff('0x3c')](_0x522c0d['query'],_0x50f295[_0x7dff('0x31')]),_0xd296c6);if(_0x522c0d['query'][_0x7dff('0x3d')]){_0x132871[_0x7dff('0x3b')]=_[_0x7dff('0x3e')](_0x132871['where'],{'$or':_[_0x7dff('0x2c')](_0xd296c6,function(_0x14255b){if(_0x14255b['type']!==_0x7dff('0x3f')){var _0x31fbc8={};_0x31fbc8[_0x14255b[_0x7dff('0x2a')]]={'$like':'%'+_0x522c0d[_0x7dff('0x2f')][_0x7dff('0x3d')]+'%'};return _0x31fbc8;}})});}_0x132871=_[_0x7dff('0x3e')]({},_0x132871,_0x522c0d[_0x7dff('0x40')]);var _0x59376d={'where':_0x132871[_0x7dff('0x3b')]};return db['AnalyticExtractedReport'][_0x7dff('0x1d')](_0x59376d)[_0x7dff('0x25')](function(_0x1752a8){_0x2fd604[_0x7dff('0x1d')]=_0x1752a8;if(_0x522c0d[_0x7dff('0x2f')]['includeAll']){_0x132871[_0x7dff('0x41')]=[{'all':!![]}];}return db[_0x7dff('0x42')][_0x7dff('0x43')](_0x132871);})[_0x7dff('0x25')](function(_0x250ac7){_0x2fd604[_0x7dff('0x44')]=_0x250ac7;return _0x2fd604;})[_0x7dff('0x25')](respondWithFilteredResult(_0x2f1bfe,_0x132871))[_0x7dff('0x45')](handleError(_0x2f1bfe,null));};exports[_0x7dff('0x46')]=function(_0x55a415,_0x531da){var _0x147f8f={'raw':!![],'where':{'id':_0x55a415[_0x7dff('0x47')]['id']}},_0x972d0={};_0x972d0['model']=_[_0x7dff('0x30')](db['AnalyticExtractedReport'][_0x7dff('0x2d')]);_0x972d0[_0x7dff('0x2f')]=_['keys'](_0x55a415[_0x7dff('0x2f')]);_0x972d0[_0x7dff('0x31')]=_['intersection'](_0x972d0['model'],_0x972d0[_0x7dff('0x2f')]);_0x147f8f[_0x7dff('0x33')]=_['intersection'](_0x972d0['model'],qs[_0x7dff('0x35')](_0x55a415[_0x7dff('0x2f')][_0x7dff('0x35')]));_0x147f8f[_0x7dff('0x33')]=_0x147f8f[_0x7dff('0x33')][_0x7dff('0x36')]?_0x147f8f['attributes']:_0x972d0[_0x7dff('0x34')];if(_0x55a415['query'][_0x7dff('0x48')]){_0x147f8f[_0x7dff('0x41')]=[{'all':!![]}];}_0x147f8f=_[_0x7dff('0x3e')]({},_0x147f8f,_0x55a415['options']);return db[_0x7dff('0x42')][_0x7dff('0x49')](_0x147f8f)[_0x7dff('0x25')](handleEntityNotFound(_0x531da,null))[_0x7dff('0x25')](respondWithResult(_0x531da,null))[_0x7dff('0x45')](handleError(_0x531da,null));};exports[_0x7dff('0x4a')]=function(_0x366fe2,_0x1d16d2){return db[_0x7dff('0x42')][_0x7dff('0x4a')](_0x366fe2[_0x7dff('0x4b')],{})[_0x7dff('0x25')](function(_0xfd8ac9){var _0x22af80=_0x366fe2[_0x7dff('0x4c')][_0x7dff('0x26')]({'plain':!![]});if(!_0x22af80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22af80[_0x7dff('0x4d')]==='user'){var _0x69a3a4=_0xfd8ac9[_0x7dff('0x26')]({'plain':!![]});var _0x3e1bb7='ExtractedReports';return db['UserProfileSection'][_0x7dff('0x49')]({'where':{'name':_0x3e1bb7,'userProfileId':_0x22af80[_0x7dff('0x4e')]},'raw':!![]})[_0x7dff('0x25')](function(_0x5528bf){if(_0x5528bf&&_0x5528bf[_0x7dff('0x4f')]===0x0){return db[_0x7dff('0x50')]['create']({'name':_0x69a3a4['name'],'resourceId':_0x69a3a4['id'],'type':_0x5528bf['name'],'sectionId':_0x5528bf['id']},{})[_0x7dff('0x25')](function(){return _0xfd8ac9;});}else{return _0xfd8ac9;}})[_0x7dff('0x45')](function(_0x1b0e8f){logger[_0x7dff('0x29')](_0x7dff('0x51'),_0x1b0e8f);throw _0x1b0e8f;});}return _0xfd8ac9;})['then'](respondWithResult(_0x1d16d2,0xc9))['catch'](handleError(_0x1d16d2,null));};exports['update']=function(_0x151f58,_0x2164c0){if(_0x151f58[_0x7dff('0x4b')]['id']){delete _0x151f58[_0x7dff('0x4b')]['id'];}return db[_0x7dff('0x42')][_0x7dff('0x49')]({'where':{'id':_0x151f58[_0x7dff('0x47')]['id']}})[_0x7dff('0x25')](handleEntityNotFound(_0x2164c0,null))[_0x7dff('0x25')](saveUpdates(_0x151f58[_0x7dff('0x4b')],null))[_0x7dff('0x25')](respondWithResult(_0x2164c0,null))['catch'](handleError(_0x2164c0,null));};exports[_0x7dff('0x24')]=function(_0x395643,_0x541e7e){return db['AnalyticExtractedReport'][_0x7dff('0x49')]({'where':{'id':_0x395643['params']['id']}})[_0x7dff('0x25')](handleEntityNotFound(_0x541e7e,null))[_0x7dff('0x25')](removeEntity(_0x541e7e,null))[_0x7dff('0x45')](handleError(_0x541e7e,null));};exports[_0x7dff('0x52')]=function(_0x3fae8b,_0x49bbf5,_0xc129d9){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3fae8b[_0x7dff('0x47')]['id']},'attributes':[_0x7dff('0x2a'),_0x7dff('0x53'),'savename',_0x7dff('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x49bbf5,null))['then'](function(_0x1b133c){if(_0x1b133c){if(!fs[_0x7dff('0x55')](path[_0x7dff('0x56')](config[_0x7dff('0x57')],_0x7dff('0x58'),_0x1b133c[_0x7dff('0x59')]))){throw new db[(_0x7dff('0x5a'))][(_0x7dff('0x5b'))](_0x7dff('0x5c'));}if(_0x3fae8b[_0x7dff('0x2f')]['exists']){return _0x49bbf5[_0x7dff('0x28')](0xc8);}return _0x49bbf5[_0x7dff('0x52')](path[_0x7dff('0x56')](config[_0x7dff('0x57')],_0x7dff('0x58'),_0x1b133c[_0x7dff('0x59')]),util[_0x7dff('0x5d')](_0x7dff('0x5e'),_0x1b133c['basename']||_0x1b133c[_0x7dff('0x2a')],_0x1b133c[_0x7dff('0x54')][_0x7dff('0x5f')]()));}})['catch'](handleError(_0x49bbf5,null));}; \ No newline at end of file +var _0xab61=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','output','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body'];(function(_0x38cd76,_0x4f59c1){var _0x98b362=function(_0x8b6c4){while(--_0x8b6c4){_0x38cd76['push'](_0x38cd76['shift']());}};_0x98b362(++_0x4f59c1);}(_0xab61,0xd4));var _0x1ab6=function(_0x1f9115,_0x33a742){_0x1f9115=_0x1f9115-0x0;var _0x533c79=_0xab61[_0x1f9115];return _0x533c79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ab6('0x0'));var zipdir=require(_0x1ab6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ab6('0x2'));var moment=require(_0x1ab6('0x3'));var BPromise=require(_0x1ab6('0x4'));var Mustache=require(_0x1ab6('0x5'));var util=require(_0x1ab6('0x6'));var path=require('path');var sox=require(_0x1ab6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ab6('0x8'));var squel=require(_0x1ab6('0x9'));var crypto=require(_0x1ab6('0xa'));var jsforce=require(_0x1ab6('0xb'));var deskjs=require(_0x1ab6('0xc'));var toCsv=require(_0x1ab6('0xd'));var querystring=require(_0x1ab6('0xe'));var Papa=require('papaparse');var Redis=require(_0x1ab6('0xf'));var authService=require(_0x1ab6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1ab6('0x11'));var hardwareService=require(_0x1ab6('0x12'));var logger=require(_0x1ab6('0x13'))(_0x1ab6('0x14'));var utils=require(_0x1ab6('0x15'));var config=require(_0x1ab6('0x16'));var licenseUtil=require(_0x1ab6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5d9eb,_0x30640a){_0x30640a=_0x30640a||0xcc;return function(_0x19ec09){if(_0x19ec09){return _0xe5d9eb[_0x1ab6('0x18')](_0x30640a);}return _0xe5d9eb[_0x1ab6('0x19')](_0x30640a)[_0x1ab6('0x1a')]();};}function respondWithResult(_0x28dd94,_0x100598){_0x100598=_0x100598||0xc8;return function(_0x374e59){if(_0x374e59){return _0x28dd94[_0x1ab6('0x19')](_0x100598)[_0x1ab6('0x1b')](_0x374e59);}};}function respondWithFilteredResult(_0x113d2b,_0x5d71e7){return function(_0x50df0a){if(_0x50df0a){var _0x455828=typeof _0x5d71e7[_0x1ab6('0x1c')]===_0x1ab6('0x1d')&&typeof _0x5d71e7[_0x1ab6('0x1e')]===_0x1ab6('0x1d');var _0x41128b=_0x50df0a[_0x1ab6('0x1f')];var _0x4b5919=_0x455828?0x0:_0x5d71e7[_0x1ab6('0x1c')];var _0x4434ad=_0x455828?_0x50df0a['count']:_0x5d71e7[_0x1ab6('0x1c')]+_0x5d71e7[_0x1ab6('0x1e')];var _0x3d0acc;if(_0x4434ad>=_0x41128b){_0x4434ad=_0x41128b;_0x3d0acc=0xc8;}else{_0x3d0acc=0xce;}_0x113d2b[_0x1ab6('0x19')](_0x3d0acc);return _0x113d2b['set'](_0x1ab6('0x20'),_0x4b5919+'-'+_0x4434ad+'/'+_0x41128b)[_0x1ab6('0x1b')](_0x50df0a);}return null;};}function patchUpdates(_0x5882c5){return function(_0x406937){try{jsonpatch[_0x1ab6('0x21')](_0x406937,_0x5882c5,!![]);}catch(_0x574b6d){return BPromise['reject'](_0x574b6d);}return _0x406937['save']();};}function saveUpdates(_0x42a34d,_0x1a4ade){return function(_0x5d31a3){if(_0x5d31a3){return _0x5d31a3[_0x1ab6('0x22')](_0x42a34d)['then'](function(_0x196b0f){return _0x196b0f;});}return null;};}function removeEntity(_0x545fa7,_0x5ce42d){return function(_0x2f4b64){if(_0x2f4b64){return _0x2f4b64[_0x1ab6('0x23')]()[_0x1ab6('0x24')](function(){var _0x40c240=_0x2f4b64[_0x1ab6('0x25')]({'plain':!![]});var _0x57e2e3='ExtractedReports';return db[_0x1ab6('0x26')][_0x1ab6('0x23')]({'where':{'type':_0x57e2e3,'resourceId':_0x40c240['id']}})[_0x1ab6('0x24')](function(){return _0x2f4b64;});})[_0x1ab6('0x24')](function(){_0x545fa7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6c4a,_0x91a475){return function(_0x311b24){if(!_0x311b24){_0x2e6c4a[_0x1ab6('0x18')](0x194);}return _0x311b24;};}function handleError(_0x9b1b2,_0x586119){_0x586119=_0x586119||0x1f4;return function(_0x545e79){logger[_0x1ab6('0x27')](_0x545e79[_0x1ab6('0x28')]);if(_0x545e79[_0x1ab6('0x29')]){delete _0x545e79[_0x1ab6('0x29')];}_0x9b1b2[_0x1ab6('0x19')](_0x586119)[_0x1ab6('0x2a')](_0x545e79);};}exports[_0x1ab6('0x2b')]=function(_0x4f2b1d,_0x150b35){var _0x11608b={},_0x578099={},_0x3819f9={'count':0x0,'rows':[]};var _0xc0d2bb=_[_0x1ab6('0x2c')](db[_0x1ab6('0x2d')][_0x1ab6('0x2e')],function(_0x55eb38){return{'name':_0x55eb38[_0x1ab6('0x2f')],'type':_0x55eb38[_0x1ab6('0x30')][_0x1ab6('0x31')]};});_0x578099[_0x1ab6('0x32')]=_[_0x1ab6('0x2c')](_0xc0d2bb,_0x1ab6('0x29'));_0x578099[_0x1ab6('0x33')]=_['keys'](_0x4f2b1d[_0x1ab6('0x33')]);_0x578099[_0x1ab6('0x34')]=_[_0x1ab6('0x35')](_0x578099[_0x1ab6('0x32')],_0x578099[_0x1ab6('0x33')]);_0x11608b[_0x1ab6('0x36')]=_['intersection'](_0x578099[_0x1ab6('0x32')],qs[_0x1ab6('0x37')](_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x37')]));_0x11608b[_0x1ab6('0x36')]=_0x11608b[_0x1ab6('0x36')][_0x1ab6('0x38')]?_0x11608b['attributes']:_0x578099[_0x1ab6('0x32')];if(!_0x4f2b1d['query']['hasOwnProperty']('nolimit')){_0x11608b[_0x1ab6('0x1e')]=qs[_0x1ab6('0x1e')](_0x4f2b1d[_0x1ab6('0x33')]['limit']);_0x11608b[_0x1ab6('0x1c')]=qs['offset'](_0x4f2b1d['query'][_0x1ab6('0x1c')]);}_0x11608b[_0x1ab6('0x39')]=qs['sort'](_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x3a')]);_0x11608b[_0x1ab6('0x3b')]=qs[_0x1ab6('0x34')](_[_0x1ab6('0x3c')](_0x4f2b1d['query'],_0x578099[_0x1ab6('0x34')]),_0xc0d2bb);if(_0x4f2b1d[_0x1ab6('0x33')]['filter']){_0x11608b[_0x1ab6('0x3b')]=_['merge'](_0x11608b['where'],{'$or':_[_0x1ab6('0x2c')](_0xc0d2bb,function(_0x56ce50){if(_0x56ce50[_0x1ab6('0x30')]!==_0x1ab6('0x3d')){var _0x4f7f9f={};_0x4f7f9f[_0x56ce50[_0x1ab6('0x29')]]={'$like':'%'+_0x4f2b1d[_0x1ab6('0x33')]['filter']+'%'};return _0x4f7f9f;}})});}_0x11608b=_['merge']({},_0x11608b,_0x4f2b1d[_0x1ab6('0x3e')]);var _0x59bfb3={'where':_0x11608b['where']};return db[_0x1ab6('0x2d')]['count'](_0x59bfb3)[_0x1ab6('0x24')](function(_0x32afec){_0x3819f9[_0x1ab6('0x1f')]=_0x32afec;if(_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x3f')]){_0x11608b[_0x1ab6('0x40')]=[{'all':!![]}];}return db[_0x1ab6('0x2d')][_0x1ab6('0x41')](_0x11608b);})[_0x1ab6('0x24')](function(_0x529d8d){_0x3819f9[_0x1ab6('0x42')]=_0x529d8d;return _0x3819f9;})[_0x1ab6('0x24')](respondWithFilteredResult(_0x150b35,_0x11608b))[_0x1ab6('0x43')](handleError(_0x150b35,null));};exports[_0x1ab6('0x44')]=function(_0x58fff1,_0x2c8726){var _0x29181f={'raw':!![],'where':{'id':_0x58fff1['params']['id']}},_0x182043={};_0x182043[_0x1ab6('0x32')]=_[_0x1ab6('0x45')](db[_0x1ab6('0x2d')][_0x1ab6('0x2e')]);_0x182043[_0x1ab6('0x33')]=_[_0x1ab6('0x45')](_0x58fff1[_0x1ab6('0x33')]);_0x182043[_0x1ab6('0x34')]=_['intersection'](_0x182043[_0x1ab6('0x32')],_0x182043[_0x1ab6('0x33')]);_0x29181f['attributes']=_[_0x1ab6('0x35')](_0x182043[_0x1ab6('0x32')],qs[_0x1ab6('0x37')](_0x58fff1[_0x1ab6('0x33')][_0x1ab6('0x37')]));_0x29181f[_0x1ab6('0x36')]=_0x29181f[_0x1ab6('0x36')][_0x1ab6('0x38')]?_0x29181f['attributes']:_0x182043[_0x1ab6('0x32')];if(_0x58fff1['query'][_0x1ab6('0x3f')]){_0x29181f[_0x1ab6('0x40')]=[{'all':!![]}];}_0x29181f=_['merge']({},_0x29181f,_0x58fff1[_0x1ab6('0x3e')]);return db[_0x1ab6('0x2d')][_0x1ab6('0x46')](_0x29181f)[_0x1ab6('0x24')](handleEntityNotFound(_0x2c8726,null))['then'](respondWithResult(_0x2c8726,null))['catch'](handleError(_0x2c8726,null));};exports[_0x1ab6('0x47')]=function(_0x2c759f,_0x1cd0ec){return db[_0x1ab6('0x2d')][_0x1ab6('0x47')](_0x2c759f[_0x1ab6('0x48')],{})['then'](function(_0x310ee0){var _0x289de8=_0x2c759f['user']['get']({'plain':!![]});if(!_0x289de8)throw new Error(_0x1ab6('0x49'));if(_0x289de8[_0x1ab6('0x4a')]===_0x1ab6('0x4b')){var _0x72bab2=_0x310ee0['get']({'plain':!![]});var _0x1c219=_0x1ab6('0x4c');return db[_0x1ab6('0x4d')][_0x1ab6('0x46')]({'where':{'name':_0x1c219,'userProfileId':_0x289de8[_0x1ab6('0x4e')]},'raw':!![]})[_0x1ab6('0x24')](function(_0x1cee03){if(_0x1cee03&&_0x1cee03[_0x1ab6('0x4f')]===0x0){return db[_0x1ab6('0x26')][_0x1ab6('0x47')]({'name':_0x72bab2[_0x1ab6('0x29')],'resourceId':_0x72bab2['id'],'type':_0x1cee03[_0x1ab6('0x29')],'sectionId':_0x1cee03['id']},{})[_0x1ab6('0x24')](function(){return _0x310ee0;});}else{return _0x310ee0;}})[_0x1ab6('0x43')](function(_0x4850ff){logger[_0x1ab6('0x27')](_0x1ab6('0x50'),_0x4850ff);throw _0x4850ff;});}return _0x310ee0;})[_0x1ab6('0x24')](respondWithResult(_0x1cd0ec,0xc9))[_0x1ab6('0x43')](handleError(_0x1cd0ec,null));};exports[_0x1ab6('0x22')]=function(_0x323327,_0x595c3a){if(_0x323327[_0x1ab6('0x48')]['id']){delete _0x323327['body']['id'];}return db[_0x1ab6('0x2d')][_0x1ab6('0x46')]({'where':{'id':_0x323327[_0x1ab6('0x51')]['id']}})[_0x1ab6('0x24')](handleEntityNotFound(_0x595c3a,null))[_0x1ab6('0x24')](saveUpdates(_0x323327[_0x1ab6('0x48')],null))[_0x1ab6('0x24')](respondWithResult(_0x595c3a,null))[_0x1ab6('0x43')](handleError(_0x595c3a,null));};exports[_0x1ab6('0x23')]=function(_0x45a233,_0x73216){return db['AnalyticExtractedReport'][_0x1ab6('0x46')]({'where':{'id':_0x45a233['params']['id']}})['then'](handleEntityNotFound(_0x73216,null))[_0x1ab6('0x24')](removeEntity(_0x73216,null))['catch'](handleError(_0x73216,null));};exports[_0x1ab6('0x52')]=function(_0x6fc596,_0x4e8228,_0x299db3){return db[_0x1ab6('0x2d')][_0x1ab6('0x46')]({'where':{'id':_0x6fc596[_0x1ab6('0x51')]['id']},'attributes':[_0x1ab6('0x29'),_0x1ab6('0x53'),_0x1ab6('0x54'),'output'],'raw':!![]})[_0x1ab6('0x24')](handleEntityNotFound(_0x4e8228,null))[_0x1ab6('0x24')](function(_0x37f9b9){if(_0x37f9b9){if(!fs[_0x1ab6('0x55')](path['join'](config[_0x1ab6('0x56')],_0x1ab6('0x57'),_0x37f9b9[_0x1ab6('0x54')]))){throw new db[(_0x1ab6('0x58'))][(_0x1ab6('0x59'))](_0x1ab6('0x5a'));}if(_0x6fc596[_0x1ab6('0x33')][_0x1ab6('0x5b')]){return _0x4e8228[_0x1ab6('0x18')](0xc8);}return _0x4e8228[_0x1ab6('0x52')](path['join'](config[_0x1ab6('0x56')],'server/files/reports',_0x37f9b9['savename']),util[_0x1ab6('0x5c')]('%s.%s',_0x37f9b9['basename']||_0x37f9b9[_0x1ab6('0x29')],_0x37f9b9[_0x1ab6('0x5d')][_0x1ab6('0x5e')]()));}})['catch'](handleError(_0x4e8228,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index bad3754..e0e7103 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 _0x6877=['../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3dd26d,_0x130365){var _0x1cc76c=function(_0x2f743c){while(--_0x2f743c){_0x3dd26d['push'](_0x3dd26d['shift']());}};_0x1cc76c(++_0x130365);}(_0x6877,0x131));var _0x7687=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x6877[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0x7687('0x0'));var util=require(_0x7687('0x1'));var logger=require(_0x7687('0x2'))('api');var moment=require(_0x7687('0x3'));var BPromise=require(_0x7687('0x4'));var rp=require(_0x7687('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7687('0x6'));var config=require(_0x7687('0x7'));var attributes=require(_0x7687('0x8'));module[_0x7687('0x9')]=function(_0x2c9a28,_0x2da20d){return _0x2c9a28[_0x7687('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0x7687('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd978=['bluebird','request-promise','path','../../config/environment','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4885d6,_0x1f0743){var _0x5a2334=function(_0x4d01e1){while(--_0x4d01e1){_0x4885d6['push'](_0x4885d6['shift']());}};_0x5a2334(++_0x1f0743);}(_0xd978,0x187));var _0x8d97=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xd978[_0x257841];return _0x1b87ed;};'use strict';var _=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));var logger=require(_0x8d97('0x2'))(_0x8d97('0x3'));var moment=require(_0x8d97('0x4'));var BPromise=require(_0x8d97('0x5'));var rp=require(_0x8d97('0x6'));var fs=require('fs');var path=require(_0x8d97('0x7'));var rimraf=require('rimraf');var config=require(_0x8d97('0x8'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x39bf55,_0x4a95b2){return _0x39bf55['define'](_0x8d97('0x9'),attributes,{'tableName':_0x8d97('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 6477024..52eb2cb 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 _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xe5b5[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file +var _0xf9b7=['rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x82db7a,_0x1b9129){var _0x76f85=function(_0x51e389){while(--_0x51e389){_0x82db7a['push'](_0x82db7a['shift']());}};_0x76f85(++_0x1b9129);}(_0xf9b7,0x13d));var _0x7f9b=function(_0x506ac7,_0x5db19b){_0x506ac7=_0x506ac7-0x0;var _0x5d4ce5=_0xf9b7[_0x506ac7];return _0x5d4ce5;};'use strict';var _=require(_0x7f9b('0x0'));var util=require('util');var moment=require(_0x7f9b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f9b('0x2'));var fs=require('fs');var Redis=require(_0x7f9b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f9b('0x4'));var logger=require(_0x7f9b('0x5'))(_0x7f9b('0x6'));var config=require(_0x7f9b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f9b('0x8')][_0x7f9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d08cd,_0x27d722,_0x2a8aa8){return new BPromise(function(_0xbb9f4,_0x58f78b){return client['request'](_0x3d08cd,_0x2a8aa8)[_0x7f9b('0xa')](function(_0x4e751a){logger[_0x7f9b('0xb')](_0x7f9b('0xc'),_0x27d722,_0x7f9b('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x27d722,_0x7f9b('0xd'),JSON[_0x7f9b('0xe')](_0x4e751a));if(_0x4e751a[_0x7f9b('0xf')]){if(_0x4e751a[_0x7f9b('0xf')]['code']===0x1f4){logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x4e751a[_0x7f9b('0xf')]['message']);return _0x58f78b(_0x4e751a['error'][_0x7f9b('0x10')]);}logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x4e751a[_0x7f9b('0xf')][_0x7f9b('0x10')]);return _0xbb9f4(_0x4e751a[_0x7f9b('0xf')]['message']);}else{logger[_0x7f9b('0xb')](_0x7f9b('0xc'),_0x27d722,'request\x20sent');_0xbb9f4(_0x4e751a[_0x7f9b('0x11')][_0x7f9b('0x10')]);}})[_0x7f9b('0x12')](function(_0x420702){logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x420702);_0x58f78b(_0x420702);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6b9540f..a4d244a 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 _0xdddc=['isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','/:id'];(function(_0x4f991d,_0xbc504a){var _0x40efe1=function(_0x36a8eb){while(--_0x36a8eb){_0x4f991d['push'](_0x4f991d['shift']());}};_0x40efe1(++_0xbc504a);}(_0xdddc,0x11f));var _0xcddd=function(_0x377017,_0x16042d){_0x377017=_0x377017-0x0;var _0x1e44fb=_0xdddc[_0x377017];return _0x1e44fb;};'use strict';var multer=require(_0xcddd('0x0'));var util=require(_0xcddd('0x1'));var path=require(_0xcddd('0x2'));var timeout=require(_0xcddd('0x3'));var express=require(_0xcddd('0x4'));var router=express[_0xcddd('0x5')]();var fs_extra=require(_0xcddd('0x6'));var auth=require(_0xcddd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcddd('0x8'));var controller=require(_0xcddd('0x9'));router[_0xcddd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcddd('0xa')](_0xcddd('0xb'),auth[_0xcddd('0xc')](),controller[_0xcddd('0xd')]);router['get'](_0xcddd('0xe'),auth[_0xcddd('0xc')](),controller[_0xcddd('0xf')]);router[_0xcddd('0x10')]('/',auth[_0xcddd('0xc')](),controller[_0xcddd('0x11')]);router[_0xcddd('0x12')]('/:id',auth[_0xcddd('0xc')](),controller[_0xcddd('0x13')]);router[_0xcddd('0x14')](_0xcddd('0xb'),auth[_0xcddd('0xc')](),controller[_0xcddd('0x15')]);module[_0xcddd('0x16')]=router; \ No newline at end of file +var _0xa4b5=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4b5,0x12f));var _0x5a4b=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xa4b5[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0x5a4b('0x0'));var util=require('util');var path=require(_0x5a4b('0x1'));var timeout=require(_0x5a4b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a4b('0x3'));var auth=require(_0x5a4b('0x4'));var interaction=require(_0x5a4b('0x5'));var config=require(_0x5a4b('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x5a4b('0x7')]('/',auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x9')]);router[_0x5a4b('0x7')](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0xb')]);router[_0x5a4b('0x7')](_0x5a4b('0xc'),auth['isAuthenticated'](),controller[_0x5a4b('0xd')]);router[_0x5a4b('0xe')]('/',auth[_0x5a4b('0x8')](),controller[_0x5a4b('0xf')]);router['put'](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x10')]);router[_0x5a4b('0x11')](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x12')]);module[_0x5a4b('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 8db3edf..3c73e86 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 _0xb0ef=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x206261,_0x518fdb){var _0x19908c=function(_0x2ac9af){while(--_0x2ac9af){_0x206261['push'](_0x206261['shift']());}};_0x19908c(++_0x518fdb);}(_0xb0ef,0x8e));var _0xfb0e=function(_0x4ea5aa,_0x12c1a3){_0x4ea5aa=_0x4ea5aa-0x0;var _0x4e319f=_0xb0ef[_0x4ea5aa];return _0x4e319f;};'use strict';var Sequelize=require(_0xfb0e('0x0'));module[_0xfb0e('0x1')]={'field':{'type':Sequelize[_0xfb0e('0x2')]},'alias':{'type':Sequelize[_0xfb0e('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfb0e('0x3')]},'custom':{'type':Sequelize[_0xfb0e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x63f8=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x63f8,0xee));var _0x863f=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x63f8[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x863f('0x0'));module[_0x863f('0x1')]={'field':{'type':Sequelize[_0x863f('0x2')]},'alias':{'type':Sequelize[_0x863f('0x3')]},'function':{'type':Sequelize[_0x863f('0x3')]},'format':{'type':Sequelize[_0x863f('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x863f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 0b36c81..a9a9f62 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 _0x39a1=['AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','params','fields','length','merge','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x3e1600,_0x2571ff){var _0x219628=function(_0x2d1597){while(--_0x2d1597){_0x3e1600['push'](_0x3e1600['shift']());}};_0x219628(++_0x2571ff);}(_0x39a1,0x7b));var _0x139a=function(_0x4cd9b9,_0x23884f){_0x4cd9b9=_0x4cd9b9-0x0;var _0x24a223=_0x39a1[_0x4cd9b9];return _0x24a223;};'use strict';var emlformat=require(_0x139a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x139a('0x1'));var jsonpatch=require(_0x139a('0x2'));var rp=require(_0x139a('0x3'));var moment=require(_0x139a('0x4'));var BPromise=require(_0x139a('0x5'));var Mustache=require(_0x139a('0x6'));var util=require(_0x139a('0x7'));var path=require(_0x139a('0x8'));var sox=require('sox');var csv=require(_0x139a('0x9'));var ejs=require(_0x139a('0xa'));var fs=require('fs');var fs_extra=require(_0x139a('0xb'));var _=require(_0x139a('0xc'));var squel=require(_0x139a('0xd'));var crypto=require(_0x139a('0xe'));var jsforce=require(_0x139a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x139a('0x9'));var querystring=require(_0x139a('0x10'));var Papa=require(_0x139a('0x11'));var Redis=require(_0x139a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x139a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x139a('0x14'));var logger=require(_0x139a('0x15'))(_0x139a('0x16'));var utils=require(_0x139a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x139a('0x18'));var db=require(_0x139a('0x19'))['db'];function respondWithStatusCode(_0x506ee9,_0x5833f4){_0x5833f4=_0x5833f4||0xcc;return function(_0x32fe6d){if(_0x32fe6d){return _0x506ee9[_0x139a('0x1a')](_0x5833f4);}return _0x506ee9['status'](_0x5833f4)[_0x139a('0x1b')]();};}function respondWithResult(_0x58b74f,_0x465660){_0x465660=_0x465660||0xc8;return function(_0x175efb){if(_0x175efb){return _0x58b74f[_0x139a('0x1c')](_0x465660)['json'](_0x175efb);}};}function respondWithFilteredResult(_0x3196de,_0x2859ea){return function(_0x5c1de8){if(_0x5c1de8){var _0x34b525=typeof _0x2859ea[_0x139a('0x1d')]===_0x139a('0x1e')&&typeof _0x2859ea['limit']===_0x139a('0x1e');var _0x3f7740=_0x5c1de8['count'];var _0x1183ca=_0x34b525?0x0:_0x2859ea['offset'];var _0x2da79b=_0x34b525?_0x5c1de8[_0x139a('0x1f')]:_0x2859ea[_0x139a('0x1d')]+_0x2859ea[_0x139a('0x20')];var _0xca372e;if(_0x2da79b>=_0x3f7740){_0x2da79b=_0x3f7740;_0xca372e=0xc8;}else{_0xca372e=0xce;}_0x3196de[_0x139a('0x1c')](_0xca372e);return _0x3196de['set'](_0x139a('0x21'),_0x1183ca+'-'+_0x2da79b+'/'+_0x3f7740)[_0x139a('0x22')](_0x5c1de8);}return null;};}function patchUpdates(_0xcfa755){return function(_0x26b14a){try{jsonpatch[_0x139a('0x23')](_0x26b14a,_0xcfa755,!![]);}catch(_0x4e44f4){return BPromise[_0x139a('0x24')](_0x4e44f4);}return _0x26b14a[_0x139a('0x25')]();};}function saveUpdates(_0x389f39,_0x47dfc6){return function(_0x4c3e7c){if(_0x4c3e7c){return _0x4c3e7c[_0x139a('0x26')](_0x389f39)[_0x139a('0x27')](function(_0x37de99){return _0x37de99;});}return null;};}function removeEntity(_0x23822d,_0x5eff81){return function(_0xc685ec){if(_0xc685ec){return _0xc685ec[_0x139a('0x28')]()[_0x139a('0x27')](function(){_0x23822d['status'](0xcc)[_0x139a('0x1b')]();});}};}function handleEntityNotFound(_0x19cab0,_0x170a96){return function(_0x8f3b54){if(!_0x8f3b54){_0x19cab0[_0x139a('0x1a')](0x194);}return _0x8f3b54;};}function handleError(_0x2a9f35,_0x2e202e){_0x2e202e=_0x2e202e||0x1f4;return function(_0x56f3db){logger[_0x139a('0x29')](_0x56f3db[_0x139a('0x2a')]);if(_0x56f3db[_0x139a('0x2b')]){delete _0x56f3db[_0x139a('0x2b')];}_0x2a9f35[_0x139a('0x1c')](_0x2e202e)[_0x139a('0x2c')](_0x56f3db);};}exports['index']=function(_0x5db270,_0x104c68){var _0x390817={},_0x8c446c={},_0x54ed18={'count':0x0,'rows':[]};var _0x4bbc0d=_['map'](db[_0x139a('0x2d')][_0x139a('0x2e')],function(_0x13c130){return{'name':_0x13c130[_0x139a('0x2f')],'type':_0x13c130[_0x139a('0x30')][_0x139a('0x31')]};});_0x8c446c[_0x139a('0x32')]=_[_0x139a('0x33')](_0x4bbc0d,_0x139a('0x2b'));_0x8c446c['query']=_[_0x139a('0x34')](_0x5db270[_0x139a('0x35')]);_0x8c446c['filters']=_[_0x139a('0x36')](_0x8c446c[_0x139a('0x32')],_0x8c446c['query']);_0x390817['attributes']=_[_0x139a('0x36')](_0x8c446c['model'],qs['fields'](_0x5db270['query']['fields']));_0x390817['attributes']=_0x390817['attributes']['length']?_0x390817[_0x139a('0x37')]:_0x8c446c[_0x139a('0x32')];if(!_0x5db270['query']['hasOwnProperty'](_0x139a('0x38'))){_0x390817[_0x139a('0x20')]=qs['limit'](_0x5db270[_0x139a('0x35')][_0x139a('0x20')]);_0x390817[_0x139a('0x1d')]=qs[_0x139a('0x1d')](_0x5db270[_0x139a('0x35')][_0x139a('0x1d')]);}_0x390817[_0x139a('0x39')]=qs['sort'](_0x5db270[_0x139a('0x35')][_0x139a('0x3a')]);_0x390817[_0x139a('0x3b')]=qs[_0x139a('0x3c')](_['pick'](_0x5db270[_0x139a('0x35')],_0x8c446c['filters']),_0x4bbc0d);if(_0x5db270[_0x139a('0x35')][_0x139a('0x3d')]){_0x390817[_0x139a('0x3b')]=_['merge'](_0x390817['where'],{'$or':_[_0x139a('0x33')](_0x4bbc0d,function(_0x1843db){if(_0x1843db[_0x139a('0x30')]!==_0x139a('0x3e')){var _0x398059={};_0x398059[_0x1843db[_0x139a('0x2b')]]={'$like':'%'+_0x5db270['query']['filter']+'%'};return _0x398059;}})});}_0x390817=_['merge']({},_0x390817,_0x5db270[_0x139a('0x3f')]);var _0x529d04={'where':_0x390817[_0x139a('0x3b')]};return db['AnalyticFieldReport'][_0x139a('0x1f')](_0x529d04)[_0x139a('0x27')](function(_0x1ec47e){_0x54ed18[_0x139a('0x1f')]=_0x1ec47e;if(_0x5db270[_0x139a('0x35')][_0x139a('0x40')]){_0x390817[_0x139a('0x41')]=[{'all':!![]}];}return db[_0x139a('0x2d')]['findAll'](_0x390817);})['then'](function(_0x223259){_0x54ed18[_0x139a('0x42')]=_0x223259;return _0x54ed18;})[_0x139a('0x27')](respondWithFilteredResult(_0x104c68,_0x390817))['catch'](handleError(_0x104c68,null));};exports['show']=function(_0x410d60,_0x434ea4){var _0xa69e77={'raw':![],'where':{'id':_0x410d60[_0x139a('0x43')]['id']}},_0x38cc61={};_0x38cc61[_0x139a('0x32')]=_['keys'](db['AnalyticFieldReport'][_0x139a('0x2e')]);_0x38cc61['query']=_[_0x139a('0x34')](_0x410d60[_0x139a('0x35')]);_0x38cc61[_0x139a('0x3c')]=_['intersection'](_0x38cc61[_0x139a('0x32')],_0x38cc61[_0x139a('0x35')]);_0xa69e77[_0x139a('0x37')]=_[_0x139a('0x36')](_0x38cc61[_0x139a('0x32')],qs[_0x139a('0x44')](_0x410d60[_0x139a('0x35')][_0x139a('0x44')]));_0xa69e77[_0x139a('0x37')]=_0xa69e77[_0x139a('0x37')][_0x139a('0x45')]?_0xa69e77[_0x139a('0x37')]:_0x38cc61[_0x139a('0x32')];if(_0x410d60[_0x139a('0x35')][_0x139a('0x40')]){_0xa69e77[_0x139a('0x41')]=[{'all':!![]}];}_0xa69e77=_[_0x139a('0x46')]({},_0xa69e77,_0x410d60[_0x139a('0x3f')]);return db[_0x139a('0x2d')][_0x139a('0x47')](_0xa69e77)[_0x139a('0x27')](handleEntityNotFound(_0x434ea4,null))[_0x139a('0x27')](respondWithResult(_0x434ea4,null))[_0x139a('0x48')](handleError(_0x434ea4,null));};exports[_0x139a('0x49')]=function(_0x31112f,_0x50956d){return db['AnalyticFieldReport'][_0x139a('0x49')](_0x31112f['body'],{})[_0x139a('0x27')](respondWithResult(_0x50956d,0xc9))['catch'](handleError(_0x50956d,null));};exports[_0x139a('0x4a')]=function(_0x46697b,_0x361efe){return db[_0x139a('0x2d')][_0x139a('0x4a')](_0x46697b['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x361efe,0xc9))[_0x139a('0x48')](handleError(_0x361efe,null));};exports[_0x139a('0x26')]=function(_0x309174,_0x23d34d){if(_0x309174[_0x139a('0x4b')]['id']){delete _0x309174[_0x139a('0x4b')]['id'];}return db[_0x139a('0x2d')][_0x139a('0x47')]({'where':{'id':_0x309174[_0x139a('0x43')]['id']}})[_0x139a('0x27')](handleEntityNotFound(_0x23d34d,null))[_0x139a('0x27')](saveUpdates(_0x309174[_0x139a('0x4b')],null))[_0x139a('0x27')](respondWithResult(_0x23d34d,null))[_0x139a('0x48')](handleError(_0x23d34d,null));};exports[_0x139a('0x28')]=function(_0x4f006c,_0x2a2355){return db['AnalyticFieldReport']['find']({'where':{'id':_0x4f006c[_0x139a('0x43')]['id']}})[_0x139a('0x27')](handleEntityNotFound(_0x2a2355,null))['then'](removeEntity(_0x2a2355,null))[_0x139a('0x48')](handleError(_0x2a2355,null));};exports[_0x139a('0x4c')]=function(_0x141ec0,_0x4cb642){return db[_0x139a('0x2d')][_0x139a('0x28')]({'where':{'id':_0x141ec0[_0x139a('0x35')][_0x139a('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4cb642,0xcc))[_0x139a('0x48')](handleError(_0x4cb642,null));};exports[_0x139a('0x4e')]=function(_0x4b82c1,_0x1e8a78,_0x40e412){return db[_0x139a('0x4f')][_0x139a('0x50')]({'where':{'id':_0x4b82c1['params']['id']}})['then'](handleEntityNotFound(_0x1e8a78,null))[_0x139a('0x27')](function(_0x314e33){if(_0x314e33){return db[_0x139a('0x51')][_0x139a('0x52')](function(_0x1ad5c){return db[_0x139a('0x2d')][_0x139a('0x28')]({'where':{'CustomReportId':_0x4b82c1[_0x139a('0x43')]['id']},'transaction':_0x1ad5c})[_0x139a('0x27')](function(_0x2e1182){var _0x14844e=_[_0x139a('0x33')](_0x4b82c1[_0x139a('0x4b')],function(_0x4ed522){delete _0x4ed522['id'];_0x4ed522['CustomReportId']=_0x4b82c1[_0x139a('0x43')]['id'];return _0x4ed522;});return db['AnalyticFieldReport'][_0x139a('0x4a')](_0x14844e,{'transaction':_0x1ad5c});});})[_0x139a('0x27')](function(){return db[_0x139a('0x2d')][_0x139a('0x53')]({'where':{'CustomReportId':_0x4b82c1['params']['id']}});});}})[_0x139a('0x27')](respondWithResult(_0x1e8a78,null))['catch'](handleError(_0x1e8a78,null));}; \ No newline at end of file +var _0x2b15=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','query','intersection','model','attributes','length','hasOwnProperty','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','keys','fields','include','find','create','body','bulkCreate','params','destroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format'];(function(_0x2dcf38,_0x33765a){var _0x2295dc=function(_0x1aff4f){while(--_0x1aff4f){_0x2dcf38['push'](_0x2dcf38['shift']());}};_0x2295dc(++_0x33765a);}(_0x2b15,0x147));var _0x52b1=function(_0x3195af,_0x536c46){_0x3195af=_0x3195af-0x0;var _0x358a02=_0x2b15[_0x3195af];return _0x358a02;};'use strict';var emlformat=require(_0x52b1('0x0'));var rimraf=require(_0x52b1('0x1'));var zipdir=require(_0x52b1('0x2'));var jsonpatch=require(_0x52b1('0x3'));var rp=require(_0x52b1('0x4'));var moment=require(_0x52b1('0x5'));var BPromise=require(_0x52b1('0x6'));var Mustache=require('mustache');var util=require(_0x52b1('0x7'));var path=require(_0x52b1('0x8'));var sox=require('sox');var csv=require(_0x52b1('0x9'));var ejs=require(_0x52b1('0xa'));var fs=require('fs');var fs_extra=require(_0x52b1('0xb'));var _=require('lodash');var squel=require(_0x52b1('0xc'));var crypto=require(_0x52b1('0xd'));var jsforce=require(_0x52b1('0xe'));var deskjs=require(_0x52b1('0xf'));var toCsv=require(_0x52b1('0x9'));var querystring=require(_0x52b1('0x10'));var Papa=require(_0x52b1('0x11'));var Redis=require(_0x52b1('0x12'));var authService=require(_0x52b1('0x13'));var qs=require(_0x52b1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52b1('0x15'));var logger=require(_0x52b1('0x16'))(_0x52b1('0x17'));var utils=require(_0x52b1('0x18'));var config=require(_0x52b1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x52b1('0x1a'))['db'];function respondWithStatusCode(_0xf737be,_0xc1eb9e){_0xc1eb9e=_0xc1eb9e||0xcc;return function(_0x16f4e9){if(_0x16f4e9){return _0xf737be[_0x52b1('0x1b')](_0xc1eb9e);}return _0xf737be[_0x52b1('0x1c')](_0xc1eb9e)['end']();};}function respondWithResult(_0x345c6f,_0x48b78e){_0x48b78e=_0x48b78e||0xc8;return function(_0x2c7d3f){if(_0x2c7d3f){return _0x345c6f[_0x52b1('0x1c')](_0x48b78e)[_0x52b1('0x1d')](_0x2c7d3f);}};}function respondWithFilteredResult(_0xe96369,_0x1cb5c8){return function(_0x2b8fca){if(_0x2b8fca){var _0x49919a=typeof _0x1cb5c8[_0x52b1('0x1e')]===_0x52b1('0x1f')&&typeof _0x1cb5c8[_0x52b1('0x20')]==='undefined';var _0xb176e5=_0x2b8fca['count'];var _0x5d33e6=_0x49919a?0x0:_0x1cb5c8[_0x52b1('0x1e')];var _0x566528=_0x49919a?_0x2b8fca[_0x52b1('0x21')]:_0x1cb5c8[_0x52b1('0x1e')]+_0x1cb5c8[_0x52b1('0x20')];var _0x2bf5a5;if(_0x566528>=_0xb176e5){_0x566528=_0xb176e5;_0x2bf5a5=0xc8;}else{_0x2bf5a5=0xce;}_0xe96369['status'](_0x2bf5a5);return _0xe96369[_0x52b1('0x22')](_0x52b1('0x23'),_0x5d33e6+'-'+_0x566528+'/'+_0xb176e5)[_0x52b1('0x1d')](_0x2b8fca);}return null;};}function patchUpdates(_0xddfc53){return function(_0x558ae1){try{jsonpatch['apply'](_0x558ae1,_0xddfc53,!![]);}catch(_0x4a316a){return BPromise['reject'](_0x4a316a);}return _0x558ae1[_0x52b1('0x24')]();};}function saveUpdates(_0x1b0357,_0x387523){return function(_0x3f66a5){if(_0x3f66a5){return _0x3f66a5[_0x52b1('0x25')](_0x1b0357)[_0x52b1('0x26')](function(_0x30c04d){return _0x30c04d;});}return null;};}function removeEntity(_0x29bb1d,_0x2dedbb){return function(_0x3ddea8){if(_0x3ddea8){return _0x3ddea8['destroy']()[_0x52b1('0x26')](function(){_0x29bb1d[_0x52b1('0x1c')](0xcc)[_0x52b1('0x27')]();});}};}function handleEntityNotFound(_0x532b75,_0x568b45){return function(_0x160d75){if(!_0x160d75){_0x532b75[_0x52b1('0x1b')](0x194);}return _0x160d75;};}function handleError(_0x121874,_0x4eefb6){_0x4eefb6=_0x4eefb6||0x1f4;return function(_0x133427){logger[_0x52b1('0x28')](_0x133427[_0x52b1('0x29')]);if(_0x133427[_0x52b1('0x2a')]){delete _0x133427['name'];}_0x121874[_0x52b1('0x1c')](_0x4eefb6)[_0x52b1('0x2b')](_0x133427);};}exports[_0x52b1('0x2c')]=function(_0x2d772c,_0x4ebb96){var _0x3b0e63={},_0x3397ff={},_0x5e4a90={'count':0x0,'rows':[]};var _0x40c736=_[_0x52b1('0x2d')](db[_0x52b1('0x2e')][_0x52b1('0x2f')],function(_0x46c3be){return{'name':_0x46c3be[_0x52b1('0x30')],'type':_0x46c3be[_0x52b1('0x31')]['key']};});_0x3397ff['model']=_[_0x52b1('0x2d')](_0x40c736,_0x52b1('0x2a'));_0x3397ff[_0x52b1('0x32')]=_['keys'](_0x2d772c['query']);_0x3397ff['filters']=_[_0x52b1('0x33')](_0x3397ff[_0x52b1('0x34')],_0x3397ff['query']);_0x3b0e63['attributes']=_[_0x52b1('0x33')](_0x3397ff['model'],qs['fields'](_0x2d772c['query']['fields']));_0x3b0e63['attributes']=_0x3b0e63[_0x52b1('0x35')][_0x52b1('0x36')]?_0x3b0e63['attributes']:_0x3397ff[_0x52b1('0x34')];if(!_0x2d772c[_0x52b1('0x32')][_0x52b1('0x37')]('nolimit')){_0x3b0e63[_0x52b1('0x20')]=qs['limit'](_0x2d772c[_0x52b1('0x32')][_0x52b1('0x20')]);_0x3b0e63['offset']=qs['offset'](_0x2d772c[_0x52b1('0x32')][_0x52b1('0x1e')]);}_0x3b0e63['order']=qs['sort'](_0x2d772c[_0x52b1('0x32')]['sort']);_0x3b0e63[_0x52b1('0x38')]=qs[_0x52b1('0x39')](_[_0x52b1('0x3a')](_0x2d772c[_0x52b1('0x32')],_0x3397ff[_0x52b1('0x39')]),_0x40c736);if(_0x2d772c[_0x52b1('0x32')]['filter']){_0x3b0e63[_0x52b1('0x38')]=_[_0x52b1('0x3b')](_0x3b0e63[_0x52b1('0x38')],{'$or':_[_0x52b1('0x2d')](_0x40c736,function(_0x2a6c1b){if(_0x2a6c1b['type']!==_0x52b1('0x3c')){var _0x272c93={};_0x272c93[_0x2a6c1b[_0x52b1('0x2a')]]={'$like':'%'+_0x2d772c[_0x52b1('0x32')][_0x52b1('0x3d')]+'%'};return _0x272c93;}})});}_0x3b0e63=_[_0x52b1('0x3b')]({},_0x3b0e63,_0x2d772c[_0x52b1('0x3e')]);var _0x35162d={'where':_0x3b0e63[_0x52b1('0x38')]};return db[_0x52b1('0x2e')][_0x52b1('0x21')](_0x35162d)[_0x52b1('0x26')](function(_0x20f1d3){_0x5e4a90[_0x52b1('0x21')]=_0x20f1d3;if(_0x2d772c[_0x52b1('0x32')][_0x52b1('0x3f')]){_0x3b0e63['include']=[{'all':!![]}];}return db[_0x52b1('0x2e')]['findAll'](_0x3b0e63);})[_0x52b1('0x26')](function(_0x1ddf03){_0x5e4a90['rows']=_0x1ddf03;return _0x5e4a90;})[_0x52b1('0x26')](respondWithFilteredResult(_0x4ebb96,_0x3b0e63))[_0x52b1('0x40')](handleError(_0x4ebb96,null));};exports[_0x52b1('0x41')]=function(_0xfa4b7a,_0x1aea91){var _0x51af0c={'raw':![],'where':{'id':_0xfa4b7a['params']['id']}},_0xddd384={};_0xddd384[_0x52b1('0x34')]=_[_0x52b1('0x42')](db['AnalyticFieldReport'][_0x52b1('0x2f')]);_0xddd384['query']=_[_0x52b1('0x42')](_0xfa4b7a[_0x52b1('0x32')]);_0xddd384[_0x52b1('0x39')]=_['intersection'](_0xddd384[_0x52b1('0x34')],_0xddd384[_0x52b1('0x32')]);_0x51af0c[_0x52b1('0x35')]=_[_0x52b1('0x33')](_0xddd384[_0x52b1('0x34')],qs[_0x52b1('0x43')](_0xfa4b7a['query']['fields']));_0x51af0c[_0x52b1('0x35')]=_0x51af0c[_0x52b1('0x35')]['length']?_0x51af0c['attributes']:_0xddd384['model'];if(_0xfa4b7a[_0x52b1('0x32')][_0x52b1('0x3f')]){_0x51af0c[_0x52b1('0x44')]=[{'all':!![]}];}_0x51af0c=_[_0x52b1('0x3b')]({},_0x51af0c,_0xfa4b7a['options']);return db[_0x52b1('0x2e')][_0x52b1('0x45')](_0x51af0c)[_0x52b1('0x26')](handleEntityNotFound(_0x1aea91,null))[_0x52b1('0x26')](respondWithResult(_0x1aea91,null))[_0x52b1('0x40')](handleError(_0x1aea91,null));};exports[_0x52b1('0x46')]=function(_0x459b72,_0x238c92){return db[_0x52b1('0x2e')][_0x52b1('0x46')](_0x459b72[_0x52b1('0x47')],{})[_0x52b1('0x26')](respondWithResult(_0x238c92,0xc9))[_0x52b1('0x40')](handleError(_0x238c92,null));};exports[_0x52b1('0x48')]=function(_0xfab58f,_0x13b3c0){return db[_0x52b1('0x2e')][_0x52b1('0x48')](_0xfab58f['body'],{'raw':![],'individualHooks':!![]})[_0x52b1('0x26')](respondWithResult(_0x13b3c0,0xc9))[_0x52b1('0x40')](handleError(_0x13b3c0,null));};exports[_0x52b1('0x25')]=function(_0x5926f1,_0x50a3de){if(_0x5926f1[_0x52b1('0x47')]['id']){delete _0x5926f1[_0x52b1('0x47')]['id'];}return db[_0x52b1('0x2e')][_0x52b1('0x45')]({'where':{'id':_0x5926f1[_0x52b1('0x49')]['id']}})[_0x52b1('0x26')](handleEntityNotFound(_0x50a3de,null))[_0x52b1('0x26')](saveUpdates(_0x5926f1[_0x52b1('0x47')],null))[_0x52b1('0x26')](respondWithResult(_0x50a3de,null))[_0x52b1('0x40')](handleError(_0x50a3de,null));};exports[_0x52b1('0x4a')]=function(_0x5b4ef6,_0x3afba6){return db[_0x52b1('0x2e')][_0x52b1('0x45')]({'where':{'id':_0x5b4ef6[_0x52b1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3afba6,null))['then'](removeEntity(_0x3afba6,null))[_0x52b1('0x40')](handleError(_0x3afba6,null));};exports['bulkDestroy']=function(_0x1e7bc7,_0xd268db){return db['AnalyticFieldReport'][_0x52b1('0x4a')]({'where':{'id':_0x1e7bc7[_0x52b1('0x32')][_0x52b1('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x52b1('0x26')](respondWithResult(_0xd268db,0xcc))[_0x52b1('0x40')](handleError(_0xd268db,null));};exports['addFields']=function(_0x29e194,_0x100ae9,_0x4d16a7){return db[_0x52b1('0x4c')][_0x52b1('0x4d')]({'where':{'id':_0x29e194['params']['id']}})['then'](handleEntityNotFound(_0x100ae9,null))[_0x52b1('0x26')](function(_0x206975){if(_0x206975){return db[_0x52b1('0x4e')][_0x52b1('0x4f')](function(_0x238cf2){return db[_0x52b1('0x2e')][_0x52b1('0x4a')]({'where':{'CustomReportId':_0x29e194[_0x52b1('0x49')]['id']},'transaction':_0x238cf2})['then'](function(_0x8ac284){var _0x279797=_[_0x52b1('0x2d')](_0x29e194[_0x52b1('0x47')],function(_0x25652f){delete _0x25652f['id'];_0x25652f[_0x52b1('0x50')]=_0x29e194[_0x52b1('0x49')]['id'];return _0x25652f;});return db['AnalyticFieldReport'][_0x52b1('0x48')](_0x279797,{'transaction':_0x238cf2});});})[_0x52b1('0x26')](function(){return db[_0x52b1('0x2e')][_0x52b1('0x51')]({'where':{'CustomReportId':_0x29e194['params']['id']}});});}})[_0x52b1('0x26')](respondWithResult(_0x100ae9,null))[_0x52b1('0x40')](handleError(_0x100ae9,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ea484d0..3d22608 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 _0xa083=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x11443c,_0x274b15){var _0x27736a=function(_0x50fee1){while(--_0x50fee1){_0x11443c['push'](_0x11443c['shift']());}};_0x27736a(++_0x274b15);}(_0xa083,0x122));var _0x3a08=function(_0x4ca280,_0x1a1c4b){_0x4ca280=_0x4ca280-0x0;var _0x4bff7a=_0xa083[_0x4ca280];return _0x4bff7a;};'use strict';var _=require(_0x3a08('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a08('0x1'));var moment=require(_0x3a08('0x2'));var BPromise=require(_0x3a08('0x3'));var rp=require(_0x3a08('0x4'));var fs=require('fs');var path=require(_0x3a08('0x5'));var rimraf=require(_0x3a08('0x6'));var config=require(_0x3a08('0x7'));var attributes=require(_0x3a08('0x8'));module[_0x3a08('0x9')]=function(_0x44d99c,_0x2cabdc){return _0x44d99c[_0x3a08('0xa')](_0x3a08('0xb'),attributes,{'tableName':_0x3a08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c0f=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','request-promise'];(function(_0x20d45a,_0x14ae45){var _0x511390=function(_0x420c5b){while(--_0x420c5b){_0x20d45a['push'](_0x20d45a['shift']());}};_0x511390(++_0x14ae45);}(_0x1c0f,0x100));var _0xf1c0=function(_0x146a62,_0x388b09){_0x146a62=_0x146a62-0x0;var _0x83ff3b=_0x1c0f[_0x146a62];return _0x83ff3b;};'use strict';var _=require(_0xf1c0('0x0'));var util=require('util');var logger=require(_0xf1c0('0x1'))('api');var moment=require(_0xf1c0('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1c0('0x4'));var config=require(_0xf1c0('0x5'));var attributes=require(_0xf1c0('0x6'));module[_0xf1c0('0x7')]=function(_0x8ca3e7,_0x354273){return _0x8ca3e7['define'](_0xf1c0('0x8'),attributes,{'tableName':_0xf1c0('0x9'),'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 8b6ca5f..c37a40c 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 _0x8794=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x17789b,_0x4ad07b){var _0x2e64b6=function(_0x55f445){while(--_0x55f445){_0x17789b['push'](_0x17789b['shift']());}};_0x2e64b6(++_0x4ad07b);}(_0x8794,0xc6));var _0x4879=function(_0x1b2971,_0xc76e70){_0x1b2971=_0x1b2971-0x0;var _0x2882d1=_0x8794[_0x1b2971];return _0x2882d1;};'use strict';var _=require(_0x4879('0x0'));var util=require('util');var moment=require(_0x4879('0x1'));var BPromise=require(_0x4879('0x2'));var rs=require(_0x4879('0x3'));var fs=require('fs');var Redis=require(_0x4879('0x4'));var db=require(_0x4879('0x5'))['db'];var utils=require(_0x4879('0x6'));var logger=require(_0x4879('0x7'))(_0x4879('0x8'));var config=require('../../config/environment');var jayson=require(_0x4879('0x9'));var client=jayson[_0x4879('0xa')][_0x4879('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2681f6,_0x129f33,_0x64803b){return new BPromise(function(_0x3a726d,_0x2cd9ca){return client[_0x4879('0xc')](_0x2681f6,_0x64803b)['then'](function(_0x29c5ca){logger['info'](_0x4879('0xd'),_0x129f33,_0x4879('0xe'));logger[_0x4879('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x129f33,'request\x20sent',JSON['stringify'](_0x29c5ca));if(_0x29c5ca[_0x4879('0x10')]){if(_0x29c5ca[_0x4879('0x10')][_0x4879('0x11')]===0x1f4){logger[_0x4879('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x129f33,_0x29c5ca[_0x4879('0x10')][_0x4879('0x12')]);return _0x2cd9ca(_0x29c5ca[_0x4879('0x10')][_0x4879('0x12')]);}logger[_0x4879('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x129f33,_0x29c5ca[_0x4879('0x10')][_0x4879('0x12')]);return _0x3a726d(_0x29c5ca['error'][_0x4879('0x12')]);}else{logger[_0x4879('0x13')](_0x4879('0xd'),_0x129f33,'request\x20sent');_0x3a726d(_0x29c5ca[_0x4879('0x14')][_0x4879('0x12')]);}})[_0x4879('0x15')](function(_0x1aada8){logger[_0x4879('0x10')](_0x4879('0xd'),_0x129f33,_0x1aada8);_0x2cd9ca(_0x1aada8);});});} \ No newline at end of file +var _0x55b6=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a38a3,_0x3f13bc){var _0x4034fa=function(_0x11141f){while(--_0x11141f){_0x2a38a3['push'](_0x2a38a3['shift']());}};_0x4034fa(++_0x3f13bc);}(_0x55b6,0x74));var _0x655b=function(_0x18a79c,_0x1e3536){_0x18a79c=_0x18a79c-0x0;var _0x365cf3=_0x55b6[_0x18a79c];return _0x365cf3;};'use strict';var _=require(_0x655b('0x0'));var util=require(_0x655b('0x1'));var moment=require(_0x655b('0x2'));var BPromise=require(_0x655b('0x3'));var rs=require(_0x655b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x655b('0x5'));var config=require(_0x655b('0x6'));var jayson=require(_0x655b('0x7'));var client=jayson['client'][_0x655b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f46e0,_0x1318ea,_0x19ee25){return new BPromise(function(_0x2f972b,_0x258620){return client[_0x655b('0x9')](_0x2f46e0,_0x19ee25)[_0x655b('0xa')](function(_0x1b104a){logger['info'](_0x655b('0xb'),_0x1318ea,_0x655b('0xc'));logger[_0x655b('0xd')](_0x655b('0xe'),_0x1318ea,_0x655b('0xc'),JSON[_0x655b('0xf')](_0x1b104a));if(_0x1b104a[_0x655b('0x10')]){if(_0x1b104a[_0x655b('0x10')][_0x655b('0x11')]===0x1f4){logger[_0x655b('0x10')](_0x655b('0xb'),_0x1318ea,_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);return _0x258620(_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);}logger[_0x655b('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1318ea,_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);return _0x2f972b(_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);}else{logger[_0x655b('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1318ea,_0x655b('0xc'));_0x2f972b(_0x1b104a[_0x655b('0x14')][_0x655b('0x12')]);}})[_0x655b('0x15')](function(_0xc77331){logger[_0x655b('0x10')](_0x655b('0xb'),_0x1318ea,_0xc77331);_0x258620(_0xc77331);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 5c1110c..fa92706 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(_0xd9e9d3,_0x124002){var _0x1d860d=function(_0x37c8e5){while(--_0x37c8e5){_0xd9e9d3['push'](_0xd9e9d3['shift']());}};_0x1d860d(++_0x124002);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x2715d9,_0x4d2846){var _0x4d0b12=function(_0x26914e){while(--_0x26914e){_0x2715d9['push'](_0x2715d9['shift']());}};_0x4d0b12(++_0x4d2846);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 3963023..3f287a7 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 _0x7fee=['name','TEXT','sequelize','exports','STRING'];(function(_0x2e183b,_0x112c86){var _0x9d4842=function(_0x38b269){while(--_0x38b269){_0x2e183b['push'](_0x2e183b['shift']());}};_0x9d4842(++_0x112c86);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x7fee[_0x541260];return _0x1dd2b5;};'use strict';var Sequelize=require(_0xe7fe('0x0'));module[_0xe7fe('0x1')]={'name':{'type':Sequelize[_0xe7fe('0x2')],'allowNull':![],'unique':_0xe7fe('0x3')},'table':{'type':Sequelize[_0xe7fe('0x2')]},'metric':{'type':Sequelize[_0xe7fe('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb9be=['name','TEXT','sequelize','exports','STRING'];(function(_0x4708fa,_0x4cac01){var _0x2831ea=function(_0x58f98e){while(--_0x58f98e){_0x4708fa['push'](_0x4708fa['shift']());}};_0x2831ea(++_0x4cac01);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xb9be[_0x3df9dd];return _0x4f11e4;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'name':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![],'unique':_0xeb9b('0x3')},'table':{'type':Sequelize[_0xeb9b('0x2')]},'metric':{'type':Sequelize[_0xeb9b('0x4')]},'description':{'type':Sequelize[_0xeb9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2d2643b..baec7f5 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 _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','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','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x21647b,_0x1d4436){var _0x3e9644=function(_0x3823c6){while(--_0x3823c6){_0x21647b['push'](_0x21647b['shift']());}};_0x3e9644(++_0x1d4436);}(_0xabce,0x103));var _0xeabc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xabce[_0x1eda20];return _0x31b953;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','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','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x3dde35,_0x2459ee){var _0x23f33d=function(_0x2cf59e){while(--_0x2cf59e){_0x3dde35['push'](_0x3dde35['shift']());}};_0x23f33d(++_0x2459ee);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x24ca[_0x2df724];return _0x1b2504;};'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'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 188e6f3..59b7354 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 _0xa49e=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0xb538c9,_0x491188){var _0x320ee0=function(_0x1586b8){while(--_0x1586b8){_0xb538c9['push'](_0xb538c9['shift']());}};_0x320ee0(++_0x491188);}(_0xa49e,0x1de));var _0xea49=function(_0xf3ae5e,_0x385757){_0xf3ae5e=_0xf3ae5e-0x0;var _0x353c92=_0xa49e[_0xf3ae5e];return _0x353c92;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var logger=require(_0xea49('0x2'))(_0xea49('0x3'));var moment=require(_0xea49('0x4'));var BPromise=require(_0xea49('0x5'));var rp=require(_0xea49('0x6'));var fs=require('fs');var path=require(_0xea49('0x7'));var rimraf=require('rimraf');var config=require(_0xea49('0x8'));var attributes=require(_0xea49('0x9'));module[_0xea49('0xa')]=function(_0x56a45a,_0x1b831c){return _0x56a45a[_0xea49('0xb')](_0xea49('0xc'),attributes,{'tableName':_0xea49('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','api','moment'];(function(_0x4057a1,_0x228a4a){var _0x292356=function(_0xed9d12){while(--_0xed9d12){_0x4057a1['push'](_0x4057a1['shift']());}};_0x292356(++_0x228a4a);}(_0x6f44,0x1ea));var _0x46f4=function(_0xae9a70,_0x1e6543){_0xae9a70=_0xae9a70-0x0;var _0x545cd6=_0x6f44[_0xae9a70];return _0x545cd6;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2efedd2..c6e7c1c 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 _0x220b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x220b,0x1cb));var _0xb220=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x220b[_0x564821];return _0x2b604d;};'use strict';var _=require(_0xb220('0x0'));var util=require(_0xb220('0x1'));var moment=require(_0xb220('0x2'));var BPromise=require('bluebird');var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require(_0xb220('0x4'));var db=require(_0xb220('0x5'))['db'];var utils=require(_0xb220('0x6'));var logger=require(_0xb220('0x7'))(_0xb220('0x8'));var config=require(_0xb220('0x9'));var jayson=require(_0xb220('0xa'));var client=jayson['client'][_0xb220('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x339870,_0x548465,_0x284e29){return new BPromise(function(_0x4db7d8,_0x39559b){return client[_0xb220('0xc')](_0x339870,_0x284e29)[_0xb220('0xd')](function(_0x51e51c){logger[_0xb220('0xe')](_0xb220('0xf'),_0x548465,_0xb220('0x10'));logger[_0xb220('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x548465,'request\x20sent',JSON['stringify'](_0x51e51c));if(_0x51e51c[_0xb220('0x12')]){if(_0x51e51c[_0xb220('0x12')][_0xb220('0x13')]===0x1f4){logger['error'](_0xb220('0xf'),_0x548465,_0x51e51c[_0xb220('0x12')][_0xb220('0x14')]);return _0x39559b(_0x51e51c['error'][_0xb220('0x14')]);}logger[_0xb220('0x12')](_0xb220('0xf'),_0x548465,_0x51e51c['error'][_0xb220('0x14')]);return _0x4db7d8(_0x51e51c[_0xb220('0x12')]['message']);}else{logger[_0xb220('0xe')](_0xb220('0xf'),_0x548465,_0xb220('0x10'));_0x4db7d8(_0x51e51c[_0xb220('0x15')][_0xb220('0x14')]);}})['catch'](function(_0x33640e){logger['error'](_0xb220('0xf'),_0x548465,_0x33640e);_0x39559b(_0x33640e);});});} \ No newline at end of file +var _0x6933=['jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x37cb20,_0x4eb76f){var _0x593727=function(_0x1bbe0c){while(--_0x1bbe0c){_0x37cb20['push'](_0x37cb20['shift']());}};_0x593727(++_0x4eb76f);}(_0x6933,0x6d));var _0x3693=function(_0x25ddfa,_0xbc4e37){_0x25ddfa=_0x25ddfa-0x0;var _0x10ce7b=_0x6933[_0x25ddfa];return _0x10ce7b;};'use strict';var _=require(_0x3693('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3693('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3693('0x2'));var logger=require(_0x3693('0x3'))('rpc');var config=require(_0x3693('0x4'));var jayson=require(_0x3693('0x5'));var client=jayson[_0x3693('0x6')][_0x3693('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16da33,_0x12ef3f,_0x375392){return new BPromise(function(_0x523a47,_0x2b038e){return client[_0x3693('0x8')](_0x16da33,_0x375392)['then'](function(_0x42b214){logger[_0x3693('0x9')](_0x3693('0xa'),_0x12ef3f,'request\x20sent');logger[_0x3693('0xb')](_0x3693('0xc'),_0x12ef3f,_0x3693('0xd'),JSON[_0x3693('0xe')](_0x42b214));if(_0x42b214[_0x3693('0xf')]){if(_0x42b214[_0x3693('0xf')]['code']===0x1f4){logger[_0x3693('0xf')](_0x3693('0xa'),_0x12ef3f,_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);return _0x2b038e(_0x42b214['error']['message']);}logger[_0x3693('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x12ef3f,_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);return _0x523a47(_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);}else{logger['info'](_0x3693('0xa'),_0x12ef3f,_0x3693('0xd'));_0x523a47(_0x42b214[_0x3693('0x11')][_0x3693('0x10')]);}})[_0x3693('0x12')](function(_0x105caa){logger[_0x3693('0xf')](_0x3693('0xa'),_0x12ef3f,_0x105caa);_0x2b038e(_0x105caa);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index da3b0aa..9cf139c 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 _0x7217=['Router','fs-extra','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x483c41,_0xcd46c9){var _0x38986d=function(_0x1b3f64){while(--_0x1b3f64){_0x483c41['push'](_0x483c41['shift']());}};_0x38986d(++_0xcd46c9);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x80c3=['isAuthenticated','post','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','get','/:id'];(function(_0x5b3f54,_0x228613){var _0x5c6bab=function(_0x2a7b4e){while(--_0x2a7b4e){_0x5b3f54['push'](_0x5b3f54['shift']());}};_0x5c6bab(++_0x228613);}(_0x80c3,0x18f));var _0x380c=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x80c3[_0x46a38b];return _0x346e75;};'use strict';var multer=require(_0x380c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380c('0x1'));var express=require('express');var router=express[_0x380c('0x2')]();var fs_extra=require(_0x380c('0x3'));var auth=require(_0x380c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x380c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x380c('0x5')](_0x380c('0x6'),auth[_0x380c('0x7')](),controller['show']);router[_0x380c('0x8')]('/',auth[_0x380c('0x7')](),controller['create']);router[_0x380c('0x9')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xa')]);router[_0x380c('0xb')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xc')]);module[_0x380c('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d53fdcd..624fcd3 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 _0x2289=['sequelize','exports','TEXT'];(function(_0x533bc2,_0x2ec43a){var _0x56d98a=function(_0x10841b){while(--_0x10841b){_0x533bc2['push'](_0x533bc2['shift']());}};_0x56d98a(++_0x2ec43a);}(_0x2289,0xc6));var _0x9228=function(_0x41661c,_0x1b188b){_0x41661c=_0x41661c-0x0;var _0x42128d=_0x2289[_0x41661c];return _0x42128d;};'use strict';var Sequelize=require(_0x9228('0x0'));module[_0x9228('0x1')]={'tree':{'type':Sequelize[_0x9228('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa100=['sequelize','TEXT'];(function(_0x42daca,_0x275738){var _0x94bcf4=function(_0x17bbb2){while(--_0x17bbb2){_0x42daca['push'](_0x42daca['shift']());}};_0x94bcf4(++_0x275738);}(_0xa100,0xb6));var _0x0a10=function(_0x2e8660,_0x5ca0c2){_0x2e8660=_0x2e8660-0x0;var _0x3dc331=_0xa100[_0x2e8660];return _0x3dc331;};'use strict';var Sequelize=require(_0x0a10('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0a10('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8152e90..959e112 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 _0xfbb8=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','includeAll','findAll','catch','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x1409ea,_0x4544d0){var _0x53c013=function(_0x5c09fc){while(--_0x5c09fc){_0x1409ea['push'](_0x1409ea['shift']());}};_0x53c013(++_0x4544d0);}(_0xfbb8,0x13d));var _0x8fbb=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xfbb8[_0xee37f1];return _0x37fd54;};'use strict';var emlformat=require(_0x8fbb('0x0'));var rimraf=require(_0x8fbb('0x1'));var zipdir=require(_0x8fbb('0x2'));var jsonpatch=require(_0x8fbb('0x3'));var rp=require(_0x8fbb('0x4'));var moment=require('moment');var BPromise=require(_0x8fbb('0x5'));var Mustache=require(_0x8fbb('0x6'));var util=require(_0x8fbb('0x7'));var path=require(_0x8fbb('0x8'));var sox=require('sox');var csv=require(_0x8fbb('0x9'));var ejs=require(_0x8fbb('0xa'));var fs=require('fs');var fs_extra=require(_0x8fbb('0xb'));var _=require(_0x8fbb('0xc'));var squel=require('squel');var crypto=require(_0x8fbb('0xd'));var jsforce=require(_0x8fbb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8fbb('0x9'));var querystring=require(_0x8fbb('0xf'));var Papa=require(_0x8fbb('0x10'));var Redis=require('ioredis');var authService=require(_0x8fbb('0x11'));var qs=require(_0x8fbb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fbb('0x13'));var logger=require(_0x8fbb('0x14'))(_0x8fbb('0x15'));var utils=require(_0x8fbb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8fbb('0x17'));var db=require(_0x8fbb('0x18'))['db'];function respondWithStatusCode(_0x330fff,_0x55b941){_0x55b941=_0x55b941||0xcc;return function(_0x41c021){if(_0x41c021){return _0x330fff[_0x8fbb('0x19')](_0x55b941);}return _0x330fff[_0x8fbb('0x1a')](_0x55b941)['end']();};}function respondWithResult(_0x4fe654,_0xe07a6d){_0xe07a6d=_0xe07a6d||0xc8;return function(_0xf19f60){if(_0xf19f60){return _0x4fe654[_0x8fbb('0x1a')](_0xe07a6d)[_0x8fbb('0x1b')](_0xf19f60);}};}function respondWithFilteredResult(_0x296dbc,_0x3d434e){return function(_0x50d558){if(_0x50d558){var _0x274359=typeof _0x3d434e[_0x8fbb('0x1c')]===_0x8fbb('0x1d')&&typeof _0x3d434e[_0x8fbb('0x1e')]==='undefined';var _0x327c3f=_0x50d558[_0x8fbb('0x1f')];var _0x1ae67=_0x274359?0x0:_0x3d434e[_0x8fbb('0x1c')];var _0x130148=_0x274359?_0x50d558[_0x8fbb('0x1f')]:_0x3d434e[_0x8fbb('0x1c')]+_0x3d434e['limit'];var _0x424b1d;if(_0x130148>=_0x327c3f){_0x130148=_0x327c3f;_0x424b1d=0xc8;}else{_0x424b1d=0xce;}_0x296dbc['status'](_0x424b1d);return _0x296dbc[_0x8fbb('0x20')](_0x8fbb('0x21'),_0x1ae67+'-'+_0x130148+'/'+_0x327c3f)[_0x8fbb('0x1b')](_0x50d558);}return null;};}function patchUpdates(_0x5c7f07){return function(_0x55bdf9){try{jsonpatch[_0x8fbb('0x22')](_0x55bdf9,_0x5c7f07,!![]);}catch(_0x1574b9){return BPromise[_0x8fbb('0x23')](_0x1574b9);}return _0x55bdf9[_0x8fbb('0x24')]();};}function saveUpdates(_0x11c5af,_0x1c69e6){return function(_0x3da977){if(_0x3da977){return _0x3da977[_0x8fbb('0x25')](_0x11c5af)['then'](function(_0x3d57c4){return _0x3d57c4;});}return null;};}function removeEntity(_0x37b3b2,_0x4db88f){return function(_0x4133fa){if(_0x4133fa){return _0x4133fa['destroy']()[_0x8fbb('0x26')](function(){_0x37b3b2[_0x8fbb('0x1a')](0xcc)[_0x8fbb('0x27')]();});}};}function handleEntityNotFound(_0x5c5d58,_0x455b74){return function(_0x5e6e39){if(!_0x5e6e39){_0x5c5d58[_0x8fbb('0x19')](0x194);}return _0x5e6e39;};}function handleError(_0x419ed7,_0x424b3d){_0x424b3d=_0x424b3d||0x1f4;return function(_0x8adb52){logger[_0x8fbb('0x28')](_0x8adb52[_0x8fbb('0x29')]);if(_0x8adb52[_0x8fbb('0x2a')]){delete _0x8adb52['name'];}_0x419ed7['status'](_0x424b3d)['send'](_0x8adb52);};}exports[_0x8fbb('0x2b')]=function(_0x4b926a,_0x3e4c2b){var _0x87cf77={},_0x19fd59={},_0x2624f8={'count':0x0,'rows':[]};var _0x5770ca=_[_0x8fbb('0x2c')](db[_0x8fbb('0x2d')][_0x8fbb('0x2e')],function(_0x19820e){return{'name':_0x19820e[_0x8fbb('0x2f')],'type':_0x19820e[_0x8fbb('0x30')][_0x8fbb('0x31')]};});_0x19fd59[_0x8fbb('0x32')]=_['map'](_0x5770ca,_0x8fbb('0x2a'));_0x19fd59[_0x8fbb('0x33')]=_[_0x8fbb('0x34')](_0x4b926a[_0x8fbb('0x33')]);_0x19fd59[_0x8fbb('0x35')]=_[_0x8fbb('0x36')](_0x19fd59[_0x8fbb('0x32')],_0x19fd59['query']);_0x87cf77[_0x8fbb('0x37')]=_[_0x8fbb('0x36')](_0x19fd59[_0x8fbb('0x32')],qs[_0x8fbb('0x38')](_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x38')]));_0x87cf77['attributes']=_0x87cf77[_0x8fbb('0x37')][_0x8fbb('0x39')]?_0x87cf77['attributes']:_0x19fd59[_0x8fbb('0x32')];if(!_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x3a')]('nolimit')){_0x87cf77['limit']=qs[_0x8fbb('0x1e')](_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x1e')]);_0x87cf77[_0x8fbb('0x1c')]=qs[_0x8fbb('0x1c')](_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x1c')]);}_0x87cf77['order']=qs[_0x8fbb('0x3b')](_0x4b926a['query'][_0x8fbb('0x3b')]);_0x87cf77[_0x8fbb('0x3c')]=qs['filters'](_[_0x8fbb('0x3d')](_0x4b926a[_0x8fbb('0x33')],_0x19fd59[_0x8fbb('0x35')]),_0x5770ca);if(_0x4b926a['query']['filter']){_0x87cf77[_0x8fbb('0x3c')]=_[_0x8fbb('0x3e')](_0x87cf77[_0x8fbb('0x3c')],{'$or':_[_0x8fbb('0x2c')](_0x5770ca,function(_0x1c66cb){if(_0x1c66cb[_0x8fbb('0x30')]!=='VIRTUAL'){var _0x3f60bf={};_0x3f60bf[_0x1c66cb[_0x8fbb('0x2a')]]={'$like':'%'+_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x3f')]+'%'};return _0x3f60bf;}})});}_0x87cf77=_[_0x8fbb('0x3e')]({},_0x87cf77,_0x4b926a['options']);var _0x261968={'where':_0x87cf77[_0x8fbb('0x3c')]};return db[_0x8fbb('0x2d')][_0x8fbb('0x1f')](_0x261968)[_0x8fbb('0x26')](function(_0x28017e){_0x2624f8[_0x8fbb('0x1f')]=_0x28017e;if(_0x4b926a[_0x8fbb('0x33')][_0x8fbb('0x40')]){_0x87cf77['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x8fbb('0x41')](_0x87cf77);})[_0x8fbb('0x26')](function(_0x3a17cd){_0x2624f8['rows']=_0x3a17cd;return _0x2624f8;})[_0x8fbb('0x26')](respondWithFilteredResult(_0x3e4c2b,_0x87cf77))[_0x8fbb('0x42')](handleError(_0x3e4c2b,null));};exports['show']=function(_0x7e1290,_0x5c6e27){var _0x27d6d5={'raw':!![],'where':{'id':_0x7e1290[_0x8fbb('0x43')]['id']}},_0x1dbcfe={};_0x1dbcfe[_0x8fbb('0x32')]=_[_0x8fbb('0x34')](db['AnalyticTreeReport']['rawAttributes']);_0x1dbcfe[_0x8fbb('0x33')]=_['keys'](_0x7e1290['query']);_0x1dbcfe[_0x8fbb('0x35')]=_['intersection'](_0x1dbcfe[_0x8fbb('0x32')],_0x1dbcfe[_0x8fbb('0x33')]);_0x27d6d5[_0x8fbb('0x37')]=_[_0x8fbb('0x36')](_0x1dbcfe[_0x8fbb('0x32')],qs[_0x8fbb('0x38')](_0x7e1290[_0x8fbb('0x33')][_0x8fbb('0x38')]));_0x27d6d5['attributes']=_0x27d6d5['attributes'][_0x8fbb('0x39')]?_0x27d6d5['attributes']:_0x1dbcfe['model'];if(_0x7e1290[_0x8fbb('0x33')][_0x8fbb('0x40')]){_0x27d6d5[_0x8fbb('0x44')]=[{'all':!![]}];}_0x27d6d5=_[_0x8fbb('0x3e')]({},_0x27d6d5,_0x7e1290['options']);return db[_0x8fbb('0x2d')][_0x8fbb('0x45')](_0x27d6d5)['then'](handleEntityNotFound(_0x5c6e27,null))[_0x8fbb('0x26')](respondWithResult(_0x5c6e27,null))['catch'](handleError(_0x5c6e27,null));};exports[_0x8fbb('0x46')]=function(_0xc97e19,_0xc109df){return db[_0x8fbb('0x2d')][_0x8fbb('0x46')](_0xc97e19['body'],{})[_0x8fbb('0x26')](respondWithResult(_0xc109df,0xc9))[_0x8fbb('0x42')](handleError(_0xc109df,null));};exports[_0x8fbb('0x25')]=function(_0x55a92e,_0x262986){if(_0x55a92e[_0x8fbb('0x47')]['id']){delete _0x55a92e[_0x8fbb('0x47')]['id'];}return db[_0x8fbb('0x2d')][_0x8fbb('0x45')]({'where':{'id':_0x55a92e[_0x8fbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x262986,null))[_0x8fbb('0x26')](saveUpdates(_0x55a92e['body'],null))[_0x8fbb('0x26')](respondWithResult(_0x262986,null))[_0x8fbb('0x42')](handleError(_0x262986,null));};exports[_0x8fbb('0x48')]=function(_0x27faf3,_0x4409cf){return db[_0x8fbb('0x2d')][_0x8fbb('0x45')]({'where':{'id':_0x27faf3['params']['id']}})['then'](handleEntityNotFound(_0x4409cf,null))[_0x8fbb('0x26')](removeEntity(_0x4409cf,null))[_0x8fbb('0x42')](handleError(_0x4409cf,null));}; \ No newline at end of file +var _0x1c73=['map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','AnalyticTreeReport','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1c73,0x106));var _0x31c7=function(_0x369ff2,_0x466a61){_0x369ff2=_0x369ff2-0x0;var _0xb53a59=_0x1c73[_0x369ff2];return _0xb53a59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x31c7('0x0'));var jsonpatch=require(_0x31c7('0x1'));var rp=require(_0x31c7('0x2'));var moment=require(_0x31c7('0x3'));var BPromise=require(_0x31c7('0x4'));var Mustache=require(_0x31c7('0x5'));var util=require('util');var path=require(_0x31c7('0x6'));var sox=require('sox');var csv=require(_0x31c7('0x7'));var ejs=require(_0x31c7('0x8'));var fs=require('fs');var fs_extra=require(_0x31c7('0x9'));var _=require(_0x31c7('0xa'));var squel=require(_0x31c7('0xb'));var crypto=require(_0x31c7('0xc'));var jsforce=require(_0x31c7('0xd'));var deskjs=require(_0x31c7('0xe'));var toCsv=require(_0x31c7('0x7'));var querystring=require(_0x31c7('0xf'));var Papa=require(_0x31c7('0x10'));var Redis=require(_0x31c7('0x11'));var authService=require(_0x31c7('0x12'));var qs=require(_0x31c7('0x13'));var as=require(_0x31c7('0x14'));var hardwareService=require(_0x31c7('0x15'));var logger=require(_0x31c7('0x16'))(_0x31c7('0x17'));var utils=require(_0x31c7('0x18'));var config=require(_0x31c7('0x19'));var licenseUtil=require(_0x31c7('0x1a'));var db=require(_0x31c7('0x1b'))['db'];function respondWithStatusCode(_0x24ceea,_0x58e89e){_0x58e89e=_0x58e89e||0xcc;return function(_0x22a0ef){if(_0x22a0ef){return _0x24ceea[_0x31c7('0x1c')](_0x58e89e);}return _0x24ceea[_0x31c7('0x1d')](_0x58e89e)[_0x31c7('0x1e')]();};}function respondWithResult(_0x4c4a23,_0x1383da){_0x1383da=_0x1383da||0xc8;return function(_0x254b71){if(_0x254b71){return _0x4c4a23[_0x31c7('0x1d')](_0x1383da)['json'](_0x254b71);}};}function respondWithFilteredResult(_0x2125dd,_0x1d4750){return function(_0x47a196){if(_0x47a196){var _0x4d09c7=typeof _0x1d4750[_0x31c7('0x1f')]==='undefined'&&typeof _0x1d4750[_0x31c7('0x20')]===_0x31c7('0x21');var _0x310df7=_0x47a196[_0x31c7('0x22')];var _0x3c7faf=_0x4d09c7?0x0:_0x1d4750['offset'];var _0x203f1e=_0x4d09c7?_0x47a196['count']:_0x1d4750[_0x31c7('0x1f')]+_0x1d4750[_0x31c7('0x20')];var _0x45362b;if(_0x203f1e>=_0x310df7){_0x203f1e=_0x310df7;_0x45362b=0xc8;}else{_0x45362b=0xce;}_0x2125dd[_0x31c7('0x1d')](_0x45362b);return _0x2125dd[_0x31c7('0x23')](_0x31c7('0x24'),_0x3c7faf+'-'+_0x203f1e+'/'+_0x310df7)['json'](_0x47a196);}return null;};}function patchUpdates(_0x57b9b2){return function(_0x190830){try{jsonpatch[_0x31c7('0x25')](_0x190830,_0x57b9b2,!![]);}catch(_0x31d128){return BPromise[_0x31c7('0x26')](_0x31d128);}return _0x190830['save']();};}function saveUpdates(_0x4e5186,_0x34e220){return function(_0x2c3a7b){if(_0x2c3a7b){return _0x2c3a7b[_0x31c7('0x27')](_0x4e5186)[_0x31c7('0x28')](function(_0x528b1f){return _0x528b1f;});}return null;};}function removeEntity(_0x50c758,_0x38d60b){return function(_0x4e3576){if(_0x4e3576){return _0x4e3576[_0x31c7('0x29')]()[_0x31c7('0x28')](function(){_0x50c758[_0x31c7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43dd4e,_0x387630){return function(_0x580797){if(!_0x580797){_0x43dd4e['sendStatus'](0x194);}return _0x580797;};}function handleError(_0x52a892,_0x40f1bf){_0x40f1bf=_0x40f1bf||0x1f4;return function(_0x53cd57){logger[_0x31c7('0x2a')](_0x53cd57[_0x31c7('0x2b')]);if(_0x53cd57[_0x31c7('0x2c')]){delete _0x53cd57[_0x31c7('0x2c')];}_0x52a892['status'](_0x40f1bf)['send'](_0x53cd57);};}exports[_0x31c7('0x2d')]=function(_0x44bfe2,_0x2f2bb8){var _0x503512={},_0x5bb7ba={},_0x2a45f3={'count':0x0,'rows':[]};var _0x4f678d=_[_0x31c7('0x2e')](db['AnalyticTreeReport'][_0x31c7('0x2f')],function(_0x44b6f1){return{'name':_0x44b6f1['fieldName'],'type':_0x44b6f1[_0x31c7('0x30')][_0x31c7('0x31')]};});_0x5bb7ba[_0x31c7('0x32')]=_[_0x31c7('0x2e')](_0x4f678d,_0x31c7('0x2c'));_0x5bb7ba[_0x31c7('0x33')]=_[_0x31c7('0x34')](_0x44bfe2[_0x31c7('0x33')]);_0x5bb7ba[_0x31c7('0x35')]=_['intersection'](_0x5bb7ba['model'],_0x5bb7ba[_0x31c7('0x33')]);_0x503512[_0x31c7('0x36')]=_['intersection'](_0x5bb7ba['model'],qs['fields'](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x37')]));_0x503512[_0x31c7('0x36')]=_0x503512[_0x31c7('0x36')][_0x31c7('0x38')]?_0x503512[_0x31c7('0x36')]:_0x5bb7ba['model'];if(!_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x39')](_0x31c7('0x3a'))){_0x503512['limit']=qs[_0x31c7('0x20')](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x20')]);_0x503512[_0x31c7('0x1f')]=qs[_0x31c7('0x1f')](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x1f')]);}_0x503512['order']=qs[_0x31c7('0x3b')](_0x44bfe2['query'][_0x31c7('0x3b')]);_0x503512[_0x31c7('0x3c')]=qs[_0x31c7('0x35')](_[_0x31c7('0x3d')](_0x44bfe2[_0x31c7('0x33')],_0x5bb7ba[_0x31c7('0x35')]),_0x4f678d);if(_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x3e')]){_0x503512['where']=_[_0x31c7('0x3f')](_0x503512[_0x31c7('0x3c')],{'$or':_[_0x31c7('0x2e')](_0x4f678d,function(_0x10ecc7){if(_0x10ecc7[_0x31c7('0x30')]!==_0x31c7('0x40')){var _0x2f13b0={};_0x2f13b0[_0x10ecc7[_0x31c7('0x2c')]]={'$like':'%'+_0x44bfe2['query'][_0x31c7('0x3e')]+'%'};return _0x2f13b0;}})});}_0x503512=_[_0x31c7('0x3f')]({},_0x503512,_0x44bfe2['options']);var _0x16e6b5={'where':_0x503512['where']};return db[_0x31c7('0x41')]['count'](_0x16e6b5)[_0x31c7('0x28')](function(_0x33caa2){_0x2a45f3['count']=_0x33caa2;if(_0x44bfe2['query']['includeAll']){_0x503512[_0x31c7('0x42')]=[{'all':!![]}];}return db[_0x31c7('0x41')][_0x31c7('0x43')](_0x503512);})[_0x31c7('0x28')](function(_0x5e1133){_0x2a45f3[_0x31c7('0x44')]=_0x5e1133;return _0x2a45f3;})['then'](respondWithFilteredResult(_0x2f2bb8,_0x503512))['catch'](handleError(_0x2f2bb8,null));};exports[_0x31c7('0x45')]=function(_0x4d36f0,_0x11e6b2){var _0x503740={'raw':!![],'where':{'id':_0x4d36f0[_0x31c7('0x46')]['id']}},_0x45a159={};_0x45a159[_0x31c7('0x32')]=_[_0x31c7('0x34')](db[_0x31c7('0x41')]['rawAttributes']);_0x45a159[_0x31c7('0x33')]=_['keys'](_0x4d36f0[_0x31c7('0x33')]);_0x45a159[_0x31c7('0x35')]=_[_0x31c7('0x47')](_0x45a159[_0x31c7('0x32')],_0x45a159[_0x31c7('0x33')]);_0x503740['attributes']=_[_0x31c7('0x47')](_0x45a159[_0x31c7('0x32')],qs['fields'](_0x4d36f0[_0x31c7('0x33')]['fields']));_0x503740[_0x31c7('0x36')]=_0x503740[_0x31c7('0x36')][_0x31c7('0x38')]?_0x503740[_0x31c7('0x36')]:_0x45a159[_0x31c7('0x32')];if(_0x4d36f0['query'][_0x31c7('0x48')]){_0x503740[_0x31c7('0x42')]=[{'all':!![]}];}_0x503740=_[_0x31c7('0x3f')]({},_0x503740,_0x4d36f0['options']);return db['AnalyticTreeReport'][_0x31c7('0x49')](_0x503740)[_0x31c7('0x28')](handleEntityNotFound(_0x11e6b2,null))[_0x31c7('0x28')](respondWithResult(_0x11e6b2,null))[_0x31c7('0x4a')](handleError(_0x11e6b2,null));};exports[_0x31c7('0x4b')]=function(_0x33b50c,_0x1da546){return db[_0x31c7('0x41')][_0x31c7('0x4b')](_0x33b50c[_0x31c7('0x4c')],{})['then'](respondWithResult(_0x1da546,0xc9))['catch'](handleError(_0x1da546,null));};exports['update']=function(_0x3e5671,_0x1016c1){if(_0x3e5671['body']['id']){delete _0x3e5671[_0x31c7('0x4c')]['id'];}return db[_0x31c7('0x41')]['find']({'where':{'id':_0x3e5671[_0x31c7('0x46')]['id']}})[_0x31c7('0x28')](handleEntityNotFound(_0x1016c1,null))[_0x31c7('0x28')](saveUpdates(_0x3e5671[_0x31c7('0x4c')],null))[_0x31c7('0x28')](respondWithResult(_0x1016c1,null))[_0x31c7('0x4a')](handleError(_0x1016c1,null));};exports[_0x31c7('0x29')]=function(_0x53e425,_0x17cd17){return db['AnalyticTreeReport']['find']({'where':{'id':_0x53e425[_0x31c7('0x46')]['id']}})['then'](handleEntityNotFound(_0x17cd17,null))[_0x31c7('0x28')](removeEntity(_0x17cd17,null))[_0x31c7('0x4a')](handleError(_0x17cd17,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 60a2b07..d897e62 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 _0x5759=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','../../config/logger','moment'];(function(_0x5c1b69,_0x6868f6){var _0x191c50=function(_0x412a20){while(--_0x412a20){_0x5c1b69['push'](_0x5c1b69['shift']());}};_0x191c50(++_0x6868f6);}(_0x5759,0x1a4));var _0x9575=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x5759[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x9575('0x0'));var util=require('util');var logger=require(_0x9575('0x1'))('api');var moment=require(_0x9575('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9575('0x3'));var rimraf=require(_0x9575('0x4'));var config=require(_0x9575('0x5'));var attributes=require(_0x9575('0x6'));module[_0x9575('0x7')]=function(_0x588043,_0x2f4835){return _0x588043['define']('AnalyticTreeReport',attributes,{'tableName':_0x9575('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','util','../../config/logger','api'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x6cb8,0x141));var _0x86cb=function(_0x9d4f38,_0x1e0c77){_0x9d4f38=_0x9d4f38-0x0;var _0x1f211d=_0x6cb8[_0x9d4f38];return _0x1f211d;};'use strict';var _=require('lodash');var util=require(_0x86cb('0x0'));var logger=require(_0x86cb('0x1'))(_0x86cb('0x2'));var moment=require(_0x86cb('0x3'));var BPromise=require(_0x86cb('0x4'));var rp=require(_0x86cb('0x5'));var fs=require('fs');var path=require(_0x86cb('0x6'));var rimraf=require(_0x86cb('0x7'));var config=require(_0x86cb('0x8'));var attributes=require(_0x86cb('0x9'));module[_0x86cb('0xa')]=function(_0xcd813d,_0x540f2a){return _0xcd813d[_0x86cb('0xb')]('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 ec2aa6d..5d41d94 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 _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(_0x5a29c4,_0x30c0d2){var _0x2ae511=function(_0x241494){while(--_0x241494){_0x5a29c4['push'](_0x5a29c4['shift']());}};_0x2ae511(++_0x30c0d2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4bc042,_0x487f0e){_0x4bc042=_0x4bc042-0x0;var _0x162842=_0x5f2f[_0x4bc042];return _0x162842;};'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 +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x437286,_0x4559e1){var _0x16aade=function(_0x2cd071){while(--_0x2cd071){_0x437286['push'](_0x437286['shift']());}};_0x16aade(++_0x4559e1);}(_0xdb28,0x106));var _0x8db2=function(_0x5c5ffc,_0x27dccd){_0x5c5ffc=_0x5c5ffc-0x0;var _0x4b698c=_0xdb28[_0x5c5ffc];return _0x4b698c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3aeadb9..90f51b3 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 _0xfc44=['isAuthenticated','index','show','post','put','/:id','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0xfc44,0x16c));var _0x4fc4=function(_0x3d62ac,_0x163846){_0x3d62ac=_0x3d62ac-0x0;var _0x4a83ba=_0xfc44[_0x3d62ac];return _0x4a83ba;};'use strict';var multer=require(_0x4fc4('0x0'));var util=require(_0x4fc4('0x1'));var path=require(_0x4fc4('0x2'));var timeout=require(_0x4fc4('0x3'));var express=require('express');var router=express[_0x4fc4('0x4')]();var fs_extra=require(_0x4fc4('0x5'));var auth=require(_0x4fc4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4fc4('0x7'));var controller=require(_0x4fc4('0x8'));router[_0x4fc4('0x9')]('/',auth[_0x4fc4('0xa')](),controller[_0x4fc4('0xb')]);router[_0x4fc4('0x9')]('/:id',auth[_0x4fc4('0xa')](),controller[_0x4fc4('0xc')]);router[_0x4fc4('0xd')]('/',auth[_0x4fc4('0xa')](),controller['create']);router[_0x4fc4('0xe')](_0x4fc4('0xf'),auth[_0x4fc4('0xa')](),controller['update']);router[_0x4fc4('0x10')](_0x4fc4('0xf'),auth[_0x4fc4('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedb5=['show','post','create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x5609ba,_0x1b7c6c){var _0x202f01=function(_0x239a8a){while(--_0x239a8a){_0x5609ba['push'](_0x5609ba['shift']());}};_0x202f01(++_0x1b7c6c);}(_0xedb5,0x1bf));var _0x5edb=function(_0x4ffb07,_0x31b18b){_0x4ffb07=_0x4ffb07-0x0;var _0x37a523=_0xedb5[_0x4ffb07];return _0x37a523;};'use strict';var multer=require(_0x5edb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5edb('0x1'));var express=require(_0x5edb('0x2'));var router=express[_0x5edb('0x3')]();var fs_extra=require(_0x5edb('0x4'));var auth=require(_0x5edb('0x5'));var interaction=require(_0x5edb('0x6'));var config=require(_0x5edb('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x5edb('0x8')]('/',auth['isAuthenticated'](),controller[_0x5edb('0x9')]);router['get'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0xc')]);router[_0x5edb('0xd')]('/',auth['isAuthenticated'](),controller[_0x5edb('0xe')]);router['put'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0xf')]);router['delete'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e202ea8..b62fd8c 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 _0xf120=['STRING','exports'];(function(_0x22c775,_0x340176){var _0x34c6d2=function(_0x3830f1){while(--_0x3830f1){_0x22c775['push'](_0x22c775['shift']());}};_0x34c6d2(++_0x340176);}(_0xf120,0x179));var _0x0f12=function(_0x571440,_0x13b255){_0x571440=_0x571440-0x0;var _0x53bcf5=_0xf120[_0x571440];return _0x53bcf5;};'use strict';var Sequelize=require('sequelize');module[_0x0f12('0x0')]={'name':{'type':Sequelize[_0x0f12('0x1')]},'basename':{'type':Sequelize[_0x0f12('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4853=['STRING','exports'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x3485('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x3485('0x1')]},'type':{'type':Sequelize[_0x3485('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index aae9765..5b4d855 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 _0xb53b=['basename','file','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','clone','includeAll','get','omit','createdAt','updatedAt','body','create','update','originalname'];(function(_0x227c53,_0x549882){var _0x3e6e99=function(_0x5b89fd){while(--_0x5b89fd){_0x227c53['push'](_0x227c53['shift']());}};_0x3e6e99(++_0x549882);}(_0xb53b,0xc0));var _0xbb53=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xb53b[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0xbb53('0x0'));var rimraf=require(_0xbb53('0x1'));var zipdir=require(_0xbb53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb53('0x3'));var moment=require(_0xbb53('0x4'));var BPromise=require(_0xbb53('0x5'));var Mustache=require(_0xbb53('0x6'));var util=require(_0xbb53('0x7'));var path=require(_0xbb53('0x8'));var sox=require('sox');var csv=require(_0xbb53('0x9'));var ejs=require(_0xbb53('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb53('0xb'));var squel=require(_0xbb53('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbb53('0xd'));var toCsv=require(_0xbb53('0x9'));var querystring=require(_0xbb53('0xe'));var Papa=require(_0xbb53('0xf'));var Redis=require(_0xbb53('0x10'));var authService=require(_0xbb53('0x11'));var qs=require(_0xbb53('0x12'));var as=require(_0xbb53('0x13'));var hardwareService=require(_0xbb53('0x14'));var logger=require(_0xbb53('0x15'))(_0xbb53('0x16'));var utils=require(_0xbb53('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb53('0x18'));var db=require(_0xbb53('0x19'))['db'];function respondWithStatusCode(_0x480f81,_0x5a7085){_0x5a7085=_0x5a7085||0xcc;return function(_0x34e769){if(_0x34e769){return _0x480f81['sendStatus'](_0x5a7085);}return _0x480f81[_0xbb53('0x1a')](_0x5a7085)[_0xbb53('0x1b')]();};}function respondWithResult(_0x5d07f0,_0x334b07){_0x334b07=_0x334b07||0xc8;return function(_0x42eab2){if(_0x42eab2){return _0x5d07f0[_0xbb53('0x1a')](_0x334b07)[_0xbb53('0x1c')](_0x42eab2);}};}function respondWithFilteredResult(_0x272243,_0x36124a){return function(_0x3bfb95){if(_0x3bfb95){var _0x2b4cd0=typeof _0x36124a[_0xbb53('0x1d')]==='undefined'&&typeof _0x36124a[_0xbb53('0x1e')]===_0xbb53('0x1f');var _0x1c561=_0x3bfb95[_0xbb53('0x20')];var _0x117368=_0x2b4cd0?0x0:_0x36124a[_0xbb53('0x1d')];var _0x23ce96=_0x2b4cd0?_0x3bfb95['count']:_0x36124a[_0xbb53('0x1d')]+_0x36124a[_0xbb53('0x1e')];var _0x52ca4c;if(_0x23ce96>=_0x1c561){_0x23ce96=_0x1c561;_0x52ca4c=0xc8;}else{_0x52ca4c=0xce;}_0x272243[_0xbb53('0x1a')](_0x52ca4c);return _0x272243[_0xbb53('0x21')](_0xbb53('0x22'),_0x117368+'-'+_0x23ce96+'/'+_0x1c561)[_0xbb53('0x1c')](_0x3bfb95);}return null;};}function patchUpdates(_0x27b48b){return function(_0x372b03){try{jsonpatch[_0xbb53('0x23')](_0x372b03,_0x27b48b,!![]);}catch(_0x4ae033){return BPromise['reject'](_0x4ae033);}return _0x372b03['save']();};}function saveUpdates(_0x503f37,_0x4e8b5a){return function(_0x3d25af){if(_0x3d25af){return _0x3d25af['update'](_0x503f37)[_0xbb53('0x24')](function(_0x10f295){return _0x10f295;});}return null;};}function removeEntity(_0x5b74c3,_0x245c58){return function(_0x3b73ca){if(_0x3b73ca){return _0x3b73ca[_0xbb53('0x25')]()['then'](function(){_0x5b74c3[_0xbb53('0x1a')](0xcc)[_0xbb53('0x1b')]();});}};}function handleEntityNotFound(_0x1f6352,_0x2b7231){return function(_0x247891){if(!_0x247891){_0x1f6352[_0xbb53('0x26')](0x194);}return _0x247891;};}function handleError(_0x24384b,_0x5685ef){_0x5685ef=_0x5685ef||0x1f4;return function(_0x5ea3a5){logger[_0xbb53('0x27')](_0x5ea3a5[_0xbb53('0x28')]);if(_0x5ea3a5[_0xbb53('0x29')]){delete _0x5ea3a5[_0xbb53('0x29')];}_0x24384b[_0xbb53('0x1a')](_0x5685ef)[_0xbb53('0x2a')](_0x5ea3a5);};}exports[_0xbb53('0x2b')]=function(_0x1165d6,_0xb106d6){var _0xe636b3={},_0x2796b4={},_0x7206cc={'count':0x0,'rows':[]};var _0x1f076d=_[_0xbb53('0x2c')](db[_0xbb53('0x2d')][_0xbb53('0x2e')],function(_0x57f99e){return{'name':_0x57f99e['fieldName'],'type':_0x57f99e[_0xbb53('0x2f')][_0xbb53('0x30')]};});_0x2796b4['model']=_[_0xbb53('0x2c')](_0x1f076d,'name');_0x2796b4[_0xbb53('0x31')]=_[_0xbb53('0x32')](_0x1165d6[_0xbb53('0x31')]);_0x2796b4['filters']=_['intersection'](_0x2796b4[_0xbb53('0x33')],_0x2796b4[_0xbb53('0x31')]);_0xe636b3[_0xbb53('0x34')]=_[_0xbb53('0x35')](_0x2796b4[_0xbb53('0x33')],qs[_0xbb53('0x36')](_0x1165d6[_0xbb53('0x31')][_0xbb53('0x36')]));_0xe636b3[_0xbb53('0x34')]=_0xe636b3[_0xbb53('0x34')][_0xbb53('0x37')]?_0xe636b3[_0xbb53('0x34')]:_0x2796b4[_0xbb53('0x33')];if(!_0x1165d6[_0xbb53('0x31')][_0xbb53('0x38')](_0xbb53('0x39'))){_0xe636b3[_0xbb53('0x1e')]=qs[_0xbb53('0x1e')](_0x1165d6[_0xbb53('0x31')]['limit']);_0xe636b3['offset']=qs[_0xbb53('0x1d')](_0x1165d6[_0xbb53('0x31')][_0xbb53('0x1d')]);}_0xe636b3[_0xbb53('0x3a')]=qs[_0xbb53('0x3b')](_0x1165d6[_0xbb53('0x31')][_0xbb53('0x3b')]);_0xe636b3[_0xbb53('0x3c')]=qs['filters'](_[_0xbb53('0x3d')](_0x1165d6['query'],_0x2796b4[_0xbb53('0x3e')]),_0x1f076d);if(_0x1165d6['query'][_0xbb53('0x3f')]){_0xe636b3[_0xbb53('0x3c')]=_[_0xbb53('0x40')](_0xe636b3[_0xbb53('0x3c')],{'$or':_[_0xbb53('0x2c')](_0x1f076d,function(_0x1272c7){if(_0x1272c7[_0xbb53('0x2f')]!==_0xbb53('0x41')){var _0xd84f69={};_0xd84f69[_0x1272c7['name']]={'$like':'%'+_0x1165d6[_0xbb53('0x31')][_0xbb53('0x3f')]+'%'};return _0xd84f69;}})});}_0xe636b3=_[_0xbb53('0x40')]({},_0xe636b3,_0x1165d6[_0xbb53('0x42')]);var _0x39543a={'where':_0xe636b3['where']};return db[_0xbb53('0x2d')][_0xbb53('0x20')](_0x39543a)[_0xbb53('0x24')](function(_0x563962){_0x7206cc['count']=_0x563962;if(_0x1165d6['query']['includeAll']){_0xe636b3['include']=[{'all':!![]}];}return db[_0xbb53('0x2d')][_0xbb53('0x43')](_0xe636b3);})[_0xbb53('0x24')](function(_0x455c47){_0x7206cc[_0xbb53('0x44')]=_0x455c47;return _0x7206cc;})[_0xbb53('0x24')](respondWithFilteredResult(_0xb106d6,_0xe636b3))[_0xbb53('0x45')](handleError(_0xb106d6,null));};exports[_0xbb53('0x46')]=function(_0x205b7c,_0x481a18){var _0x52efb5={'raw':!![],'where':{'id':_0x205b7c[_0xbb53('0x47')]['id']}},_0xe9c68a={};_0xe9c68a[_0xbb53('0x33')]=_[_0xbb53('0x32')](db[_0xbb53('0x2d')][_0xbb53('0x2e')]);_0xe9c68a[_0xbb53('0x31')]=_['keys'](_0x205b7c[_0xbb53('0x31')]);_0xe9c68a[_0xbb53('0x3e')]=_[_0xbb53('0x35')](_0xe9c68a[_0xbb53('0x33')],_0xe9c68a['query']);_0x52efb5[_0xbb53('0x34')]=_[_0xbb53('0x35')](_0xe9c68a[_0xbb53('0x33')],qs[_0xbb53('0x36')](_0x205b7c[_0xbb53('0x31')][_0xbb53('0x36')]));_0x52efb5[_0xbb53('0x34')]=_0x52efb5['attributes'][_0xbb53('0x37')]?_0x52efb5['attributes']:_0xe9c68a[_0xbb53('0x33')];if(_0x205b7c[_0xbb53('0x31')]['includeAll']){_0x52efb5[_0xbb53('0x48')]=[{'all':!![]}];}_0x52efb5=_[_0xbb53('0x40')]({},_0x52efb5,_0x205b7c[_0xbb53('0x42')]);return db[_0xbb53('0x2d')][_0xbb53('0x49')](_0x52efb5)[_0xbb53('0x24')](handleEntityNotFound(_0x481a18,null))['then'](respondWithResult(_0x481a18,null))['catch'](handleError(_0x481a18,null));};exports[_0xbb53('0x4a')]=function(_0x322bb7,_0x1871ad){var _0xb950d0={'where':{'id':_0x322bb7['params']['id']}},_0x26d599={};_0x26d599[_0xbb53('0x33')]=_[_0xbb53('0x32')](db[_0xbb53('0x2d')][_0xbb53('0x2e')]);_0xb950d0[_0xbb53('0x34')]=_[_0xbb53('0x35')](_0x26d599[_0xbb53('0x33')],qs['fields'](_0x322bb7[_0xbb53('0x31')]['fields']));_0xb950d0[_0xbb53('0x34')]=_0xb950d0[_0xbb53('0x34')][_0xbb53('0x37')]?_0xb950d0['attributes']:_0x26d599['model'];if(_0x322bb7[_0xbb53('0x31')][_0xbb53('0x4b')]){_0xb950d0[_0xbb53('0x48')]=[{'all':!![]}];}_0xb950d0=_[_0xbb53('0x40')]({},_0xb950d0,_0x322bb7[_0xbb53('0x42')]);return db[_0xbb53('0x2d')]['find'](_0xb950d0)[_0xbb53('0x24')](handleEntityNotFound(_0x1871ad,null))['then'](function(_0x3db0be){if(_0x3db0be){var _0x4e3f27=_0x3db0be[_0xbb53('0x4c')]({'plain':!![]});_0x4e3f27=qs[_0xbb53('0x4d')](_0x4e3f27,['id',_0xbb53('0x4e'),_0xbb53('0x4f')]);_0x322bb7[_0xbb53('0x50')]=_[_0xbb53('0x4d')](_0x322bb7['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0xbb53('0x51')](_['merge'](_0x4e3f27,_0x322bb7[_0xbb53('0x50')]),{'include':_0x322bb7[_0xbb53('0x31')][_0xbb53('0x4b')]?[{'all':!![]}]:undefined});}})[_0xbb53('0x24')](respondWithResult(_0x1871ad,0xc9))[_0xbb53('0x45')](handleError(_0x1871ad,null));};exports[_0xbb53('0x52')]=function(_0x48b7b3,_0x38cbd0){if(_0x48b7b3[_0xbb53('0x50')]['id']){delete _0x48b7b3[_0xbb53('0x50')]['id'];}return db[_0xbb53('0x2d')]['find']({'where':{'id':_0x48b7b3['params']['id']}})[_0xbb53('0x24')](handleEntityNotFound(_0x38cbd0,null))[_0xbb53('0x24')](saveUpdates(_0x48b7b3['body'],null))[_0xbb53('0x24')](respondWithResult(_0x38cbd0,null))['catch'](handleError(_0x38cbd0,null));};exports[_0xbb53('0x25')]=function(_0x38a661,_0x2405bc){return db['Attachment'][_0xbb53('0x49')]({'where':{'id':_0x38a661['params']['id']}})[_0xbb53('0x24')](handleEntityNotFound(_0x2405bc,null))[_0xbb53('0x24')](removeEntity(_0x2405bc,null))['catch'](handleError(_0x2405bc,null));};exports[_0xbb53('0x51')]=function(_0x588c63,_0x2cd161,_0x5783a7){_0x588c63[_0xbb53('0x50')]['name']=_0x588c63['file'][_0xbb53('0x53')];_0x588c63[_0xbb53('0x50')][_0xbb53('0x54')]=_0x588c63[_0xbb53('0x55')]['filename'];_0x588c63[_0xbb53('0x50')][_0xbb53('0x2f')]=_0x588c63['file'][_0xbb53('0x56')];return db[_0xbb53('0x2d')][_0xbb53('0x51')](_0x588c63[_0xbb53('0x50')])['then'](respondWithResult(_0x2cd161,0xc9))[_0xbb53('0x45')](handleError(_0x2cd161,null));};exports[_0xbb53('0x57')]=function(_0x23288b,_0x1d8c86,_0x3187c2){return db[_0xbb53('0x2d')][_0xbb53('0x58')]({'where':{'id':_0x23288b[_0xbb53('0x47')]['id']},'raw':!![]})[_0xbb53('0x24')](handleEntityNotFound(_0x1d8c86,null))['then'](function(_0x57a1b8){if(_0x57a1b8){var _0xb492f5=_0x57a1b8[_0xbb53('0x59')]!==null;var _0x277300=path[_0xbb53('0x5a')](config['root'],_0xbb53('0x5b'));if(_0xb492f5){_0x277300=path[_0xbb53('0x5a')](_0x277300,'offline-chat/');}var _0x438ba1=path[_0xbb53('0x5a')](_0x277300,_0x57a1b8[_0xbb53('0x54')]);return _0x1d8c86[_0xbb53('0x57')](_0x438ba1);}})[_0xbb53('0x45')](handleError(_0x1d8c86,null));}; \ No newline at end of file +var _0x57e9=['jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','get','createdAt','updatedAt','omit','body','create','params','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x19d54e,_0x54aec7){var _0x3b9d70=function(_0xfb970c){while(--_0xfb970c){_0x19d54e['push'](_0x19d54e['shift']());}};_0x3b9d70(++_0x54aec7);}(_0x57e9,0x1ab));var _0x957e=function(_0x17f2df,_0x29d0fd){_0x17f2df=_0x17f2df-0x0;var _0x59b3c1=_0x57e9[_0x17f2df];return _0x59b3c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x957e('0x0'));var zipdir=require(_0x957e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x957e('0x2'));var moment=require(_0x957e('0x3'));var BPromise=require(_0x957e('0x4'));var Mustache=require(_0x957e('0x5'));var util=require(_0x957e('0x6'));var path=require(_0x957e('0x7'));var sox=require(_0x957e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x957e('0x9'));var _=require(_0x957e('0xa'));var squel=require(_0x957e('0xb'));var crypto=require(_0x957e('0xc'));var jsforce=require(_0x957e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x957e('0xe'));var querystring=require(_0x957e('0xf'));var Papa=require(_0x957e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x957e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x957e('0x12'));var logger=require(_0x957e('0x13'))(_0x957e('0x14'));var utils=require(_0x957e('0x15'));var config=require(_0x957e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x957e('0x17'))['db'];function respondWithStatusCode(_0x3fe3d7,_0x2df447){_0x2df447=_0x2df447||0xcc;return function(_0x271a5a){if(_0x271a5a){return _0x3fe3d7['sendStatus'](_0x2df447);}return _0x3fe3d7[_0x957e('0x18')](_0x2df447)[_0x957e('0x19')]();};}function respondWithResult(_0x5e6235,_0x5bfb36){_0x5bfb36=_0x5bfb36||0xc8;return function(_0x2bf67e){if(_0x2bf67e){return _0x5e6235[_0x957e('0x18')](_0x5bfb36)['json'](_0x2bf67e);}};}function respondWithFilteredResult(_0x3cdd0a,_0x9867ef){return function(_0x57bded){if(_0x57bded){var _0x85b7fe=typeof _0x9867ef[_0x957e('0x1a')]===_0x957e('0x1b')&&typeof _0x9867ef[_0x957e('0x1c')]===_0x957e('0x1b');var _0x39ed19=_0x57bded['count'];var _0x46bf8a=_0x85b7fe?0x0:_0x9867ef[_0x957e('0x1a')];var _0x34a368=_0x85b7fe?_0x57bded[_0x957e('0x1d')]:_0x9867ef[_0x957e('0x1a')]+_0x9867ef[_0x957e('0x1c')];var _0x50d278;if(_0x34a368>=_0x39ed19){_0x34a368=_0x39ed19;_0x50d278=0xc8;}else{_0x50d278=0xce;}_0x3cdd0a[_0x957e('0x18')](_0x50d278);return _0x3cdd0a[_0x957e('0x1e')](_0x957e('0x1f'),_0x46bf8a+'-'+_0x34a368+'/'+_0x39ed19)['json'](_0x57bded);}return null;};}function patchUpdates(_0x2f8fcf){return function(_0x1c7cc8){try{jsonpatch[_0x957e('0x20')](_0x1c7cc8,_0x2f8fcf,!![]);}catch(_0x531390){return BPromise['reject'](_0x531390);}return _0x1c7cc8[_0x957e('0x21')]();};}function saveUpdates(_0x21b78f,_0x49fd52){return function(_0x489b5e){if(_0x489b5e){return _0x489b5e[_0x957e('0x22')](_0x21b78f)[_0x957e('0x23')](function(_0x3c1300){return _0x3c1300;});}return null;};}function removeEntity(_0x5a58c5,_0x5e34ae){return function(_0x15bac3){if(_0x15bac3){return _0x15bac3[_0x957e('0x24')]()['then'](function(){_0x5a58c5[_0x957e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257299,_0x3af39a){return function(_0x2516bd){if(!_0x2516bd){_0x257299[_0x957e('0x25')](0x194);}return _0x2516bd;};}function handleError(_0xa166eb,_0xe4a855){_0xe4a855=_0xe4a855||0x1f4;return function(_0x558c0f){logger['error'](_0x558c0f[_0x957e('0x26')]);if(_0x558c0f[_0x957e('0x27')]){delete _0x558c0f['name'];}_0xa166eb[_0x957e('0x18')](_0xe4a855)[_0x957e('0x28')](_0x558c0f);};}exports[_0x957e('0x29')]=function(_0x115bba,_0x3080cf){var _0x529e8e={},_0x2253a4={},_0x1491cd={'count':0x0,'rows':[]};var _0x2af578=_[_0x957e('0x2a')](db[_0x957e('0x2b')][_0x957e('0x2c')],function(_0x3e1ba4){return{'name':_0x3e1ba4[_0x957e('0x2d')],'type':_0x3e1ba4[_0x957e('0x2e')][_0x957e('0x2f')]};});_0x2253a4['model']=_['map'](_0x2af578,_0x957e('0x27'));_0x2253a4['query']=_[_0x957e('0x30')](_0x115bba[_0x957e('0x31')]);_0x2253a4[_0x957e('0x32')]=_[_0x957e('0x33')](_0x2253a4[_0x957e('0x34')],_0x2253a4[_0x957e('0x31')]);_0x529e8e[_0x957e('0x35')]=_[_0x957e('0x33')](_0x2253a4[_0x957e('0x34')],qs['fields'](_0x115bba['query'][_0x957e('0x36')]));_0x529e8e[_0x957e('0x35')]=_0x529e8e[_0x957e('0x35')][_0x957e('0x37')]?_0x529e8e[_0x957e('0x35')]:_0x2253a4[_0x957e('0x34')];if(!_0x115bba['query'][_0x957e('0x38')](_0x957e('0x39'))){_0x529e8e[_0x957e('0x1c')]=qs['limit'](_0x115bba[_0x957e('0x31')][_0x957e('0x1c')]);_0x529e8e[_0x957e('0x1a')]=qs[_0x957e('0x1a')](_0x115bba[_0x957e('0x31')]['offset']);}_0x529e8e[_0x957e('0x3a')]=qs['sort'](_0x115bba['query']['sort']);_0x529e8e[_0x957e('0x3b')]=qs[_0x957e('0x32')](_[_0x957e('0x3c')](_0x115bba[_0x957e('0x31')],_0x2253a4[_0x957e('0x32')]),_0x2af578);if(_0x115bba[_0x957e('0x31')][_0x957e('0x3d')]){_0x529e8e[_0x957e('0x3b')]=_[_0x957e('0x3e')](_0x529e8e['where'],{'$or':_['map'](_0x2af578,function(_0x228053){if(_0x228053[_0x957e('0x2e')]!==_0x957e('0x3f')){var _0x1d141a={};_0x1d141a[_0x228053['name']]={'$like':'%'+_0x115bba['query'][_0x957e('0x3d')]+'%'};return _0x1d141a;}})});}_0x529e8e=_[_0x957e('0x3e')]({},_0x529e8e,_0x115bba[_0x957e('0x40')]);var _0x19f738={'where':_0x529e8e[_0x957e('0x3b')]};return db[_0x957e('0x2b')]['count'](_0x19f738)[_0x957e('0x23')](function(_0x31732b){_0x1491cd[_0x957e('0x1d')]=_0x31732b;if(_0x115bba[_0x957e('0x31')][_0x957e('0x41')]){_0x529e8e['include']=[{'all':!![]}];}return db[_0x957e('0x2b')]['findAll'](_0x529e8e);})[_0x957e('0x23')](function(_0x35da21){_0x1491cd['rows']=_0x35da21;return _0x1491cd;})[_0x957e('0x23')](respondWithFilteredResult(_0x3080cf,_0x529e8e))['catch'](handleError(_0x3080cf,null));};exports['show']=function(_0x4d4940,_0x37b073){var _0x4d5a4e={'raw':!![],'where':{'id':_0x4d4940['params']['id']}},_0x496125={};_0x496125[_0x957e('0x34')]=_['keys'](db[_0x957e('0x2b')][_0x957e('0x2c')]);_0x496125['query']=_[_0x957e('0x30')](_0x4d4940[_0x957e('0x31')]);_0x496125[_0x957e('0x32')]=_[_0x957e('0x33')](_0x496125[_0x957e('0x34')],_0x496125['query']);_0x4d5a4e[_0x957e('0x35')]=_[_0x957e('0x33')](_0x496125['model'],qs[_0x957e('0x36')](_0x4d4940[_0x957e('0x31')]['fields']));_0x4d5a4e['attributes']=_0x4d5a4e[_0x957e('0x35')][_0x957e('0x37')]?_0x4d5a4e[_0x957e('0x35')]:_0x496125[_0x957e('0x34')];if(_0x4d4940[_0x957e('0x31')][_0x957e('0x41')]){_0x4d5a4e[_0x957e('0x42')]=[{'all':!![]}];}_0x4d5a4e=_[_0x957e('0x3e')]({},_0x4d5a4e,_0x4d4940[_0x957e('0x40')]);return db[_0x957e('0x2b')]['find'](_0x4d5a4e)['then'](handleEntityNotFound(_0x37b073,null))[_0x957e('0x23')](respondWithResult(_0x37b073,null))[_0x957e('0x43')](handleError(_0x37b073,null));};exports['clone']=function(_0x38b8c6,_0x193d8c){var _0x1487c3={'where':{'id':_0x38b8c6['params']['id']}},_0x5080a6={};_0x5080a6[_0x957e('0x34')]=_[_0x957e('0x30')](db['Attachment'][_0x957e('0x2c')]);_0x1487c3[_0x957e('0x35')]=_[_0x957e('0x33')](_0x5080a6[_0x957e('0x34')],qs['fields'](_0x38b8c6[_0x957e('0x31')][_0x957e('0x36')]));_0x1487c3[_0x957e('0x35')]=_0x1487c3[_0x957e('0x35')][_0x957e('0x37')]?_0x1487c3['attributes']:_0x5080a6[_0x957e('0x34')];if(_0x38b8c6[_0x957e('0x31')]['includeAll']){_0x1487c3['include']=[{'all':!![]}];}_0x1487c3=_['merge']({},_0x1487c3,_0x38b8c6[_0x957e('0x40')]);return db['Attachment'][_0x957e('0x44')](_0x1487c3)['then'](handleEntityNotFound(_0x193d8c,null))[_0x957e('0x23')](function(_0x58a3fa){if(_0x58a3fa){var _0x54123b=_0x58a3fa[_0x957e('0x45')]({'plain':!![]});_0x54123b=qs['omit'](_0x54123b,['id',_0x957e('0x46'),_0x957e('0x47')]);_0x38b8c6['body']=_[_0x957e('0x48')](_0x38b8c6[_0x957e('0x49')],['id',_0x957e('0x46'),_0x957e('0x47')]);return db[_0x957e('0x2b')][_0x957e('0x4a')](_[_0x957e('0x3e')](_0x54123b,_0x38b8c6[_0x957e('0x49')]),{'include':_0x38b8c6[_0x957e('0x31')][_0x957e('0x41')]?[{'all':!![]}]:undefined});}})[_0x957e('0x23')](respondWithResult(_0x193d8c,0xc9))[_0x957e('0x43')](handleError(_0x193d8c,null));};exports[_0x957e('0x22')]=function(_0x2bd401,_0x564618){if(_0x2bd401[_0x957e('0x49')]['id']){delete _0x2bd401[_0x957e('0x49')]['id'];}return db[_0x957e('0x2b')][_0x957e('0x44')]({'where':{'id':_0x2bd401[_0x957e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x564618,null))[_0x957e('0x23')](saveUpdates(_0x2bd401['body'],null))[_0x957e('0x23')](respondWithResult(_0x564618,null))[_0x957e('0x43')](handleError(_0x564618,null));};exports[_0x957e('0x24')]=function(_0x5b3e44,_0x522b78){return db[_0x957e('0x2b')][_0x957e('0x44')]({'where':{'id':_0x5b3e44[_0x957e('0x4b')]['id']}})[_0x957e('0x23')](handleEntityNotFound(_0x522b78,null))[_0x957e('0x23')](removeEntity(_0x522b78,null))[_0x957e('0x43')](handleError(_0x522b78,null));};exports['create']=function(_0x52f674,_0x173dc6,_0x1297b0){_0x52f674[_0x957e('0x49')]['name']=_0x52f674[_0x957e('0x4c')][_0x957e('0x4d')];_0x52f674[_0x957e('0x49')]['basename']=_0x52f674[_0x957e('0x4c')][_0x957e('0x4e')];_0x52f674['body'][_0x957e('0x2e')]=_0x52f674[_0x957e('0x4c')][_0x957e('0x4f')];return db['Attachment'][_0x957e('0x4a')](_0x52f674[_0x957e('0x49')])[_0x957e('0x23')](respondWithResult(_0x173dc6,0xc9))[_0x957e('0x43')](handleError(_0x173dc6,null));};exports[_0x957e('0x50')]=function(_0x43b983,_0x17acd9,_0xab00ce){return db[_0x957e('0x2b')][_0x957e('0x51')]({'where':{'id':_0x43b983[_0x957e('0x4b')]['id']},'raw':!![]})[_0x957e('0x23')](handleEntityNotFound(_0x17acd9,null))[_0x957e('0x23')](function(_0x218a9a){if(_0x218a9a){var _0x3ff58f=_0x218a9a[_0x957e('0x52')]!==null;var _0x271cf4=path[_0x957e('0x53')](config[_0x957e('0x54')],_0x957e('0x55'));if(_0x3ff58f){_0x271cf4=path['join'](_0x271cf4,_0x957e('0x56'));}var _0x386740=path[_0x957e('0x53')](_0x271cf4,_0x218a9a[_0x957e('0x57')]);return _0x17acd9[_0x957e('0x50')](_0x386740);}})['catch'](handleError(_0x17acd9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8808159..8970132 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 _0x4d5a=['request-promise','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','api','bluebird'];(function(_0x3a1b35,_0x43f746){var _0x27fd53=function(_0x398150){while(--_0x398150){_0x3a1b35['push'](_0x3a1b35['shift']());}};_0x27fd53(++_0x43f746);}(_0x4d5a,0x8a));var _0xa4d5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4d5a[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xa4d5('0x0'));var util=require(_0xa4d5('0x1'));var logger=require(_0xa4d5('0x2'))(_0xa4d5('0x3'));var moment=require('moment');var BPromise=require(_0xa4d5('0x4'));var rp=require(_0xa4d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4d5('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4d5('0x7'));module[_0xa4d5('0x8')]=function(_0x17d1c4,_0x1e65c6){return _0x17d1c4[_0xa4d5('0x9')](_0xa4d5('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe54d=['bluebird','request-promise','rimraf','./attachment.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4718bc,_0x295b9c){var _0x5c2b6f=function(_0x5c76f4){while(--_0x5c76f4){_0x4718bc['push'](_0x4718bc['shift']());}};_0x5c2b6f(++_0x295b9c);}(_0xe54d,0x12f));var _0xde54=function(_0x13f286,_0x426f1e){_0x13f286=_0x13f286-0x0;var _0x5648e2=_0xe54d[_0x13f286];return _0x5648e2;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var logger=require(_0xde54('0x2'))(_0xde54('0x3'));var moment=require(_0xde54('0x4'));var BPromise=require(_0xde54('0x5'));var rp=require(_0xde54('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde54('0x7'));var config=require('../../config/environment');var attributes=require(_0xde54('0x8'));module[_0xde54('0x9')]=function(_0x38c131,_0x3bcd74){return _0x38c131[_0xde54('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 16411b5..caf9f8b 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 _0xa7b4=['ioredis','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','body','options','debug','util','moment','randomstring'];(function(_0x5c6b0a,_0x17f91c){var _0x50976b=function(_0x398629){while(--_0x398629){_0x5c6b0a['push'](_0x5c6b0a['shift']());}};_0x50976b(++_0x17f91c);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x4d09d3,_0x57b3fb){_0x4d09d3=_0x4d09d3-0x0;var _0x3452f9=_0xa7b4[_0x4d09d3];return _0x3452f9;};'use strict';var _=require('lodash');var util=require(_0x4a7b('0x0'));var moment=require(_0x4a7b('0x1'));var BPromise=require('bluebird');var rs=require(_0x4a7b('0x2'));var fs=require('fs');var Redis=require(_0x4a7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a7b('0x4'));var config=require(_0x4a7b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4a7b('0x6')][_0x4a7b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14e777,_0x683a48,_0x2f9fe5){return new BPromise(function(_0x3fc66a,_0x2d5ffa){return client[_0x4a7b('0x8')](_0x14e777,_0x2f9fe5)[_0x4a7b('0x9')](function(_0x2fdd73){logger[_0x4a7b('0xa')](_0x4a7b('0xb'),_0x683a48,_0x4a7b('0xc'));logger['debug'](_0x4a7b('0xd'),_0x683a48,'request\x20sent',JSON[_0x4a7b('0xe')](_0x2fdd73));if(_0x2fdd73[_0x4a7b('0xf')]){if(_0x2fdd73[_0x4a7b('0xf')][_0x4a7b('0x10')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x683a48,_0x2fdd73[_0x4a7b('0xf')][_0x4a7b('0x11')]);return _0x2d5ffa(_0x2fdd73['error']['message']);}logger[_0x4a7b('0xf')](_0x4a7b('0xb'),_0x683a48,_0x2fdd73[_0x4a7b('0xf')][_0x4a7b('0x11')]);return _0x3fc66a(_0x2fdd73[_0x4a7b('0xf')][_0x4a7b('0x11')]);}else{logger[_0x4a7b('0xa')](_0x4a7b('0xb'),_0x683a48,_0x4a7b('0xc'));_0x3fc66a(_0x2fdd73[_0x4a7b('0x12')]['message']);}})[_0x4a7b('0x13')](function(_0x7458f1){logger[_0x4a7b('0xf')](_0x4a7b('0xb'),_0x683a48,_0x7458f1);_0x2d5ffa(_0x7458f1);});});}exports[_0x4a7b('0x14')]=function(_0x51fdfd){var _0x556151=this;return new Promise(function(_0x211d49,_0x5c35b1){return db['Attachment']['create'](_0x51fdfd[_0x4a7b('0x15')],{'raw':_0x51fdfd[_0x4a7b('0x16')]?_0x51fdfd['options']['raw']===undefined?!![]:![]:!![]})[_0x4a7b('0x9')](function(_0x2eae86){logger['info'](_0x4a7b('0x14'),_0x51fdfd);logger[_0x4a7b('0x17')](_0x4a7b('0x14'),_0x51fdfd,JSON['stringify'](_0x2eae86));_0x211d49(_0x2eae86);})[_0x4a7b('0x13')](function(_0x42c75d){logger['error']('CreateAttachment',_0x42c75d[_0x4a7b('0x11')],_0x51fdfd);_0x5c35b1(_0x556151[_0x4a7b('0xf')](0x1f4,_0x42c75d[_0x4a7b('0x11')]));});});}; \ No newline at end of file +var _0x98e5=['error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','debug','stringify','catch','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x268111,_0x31c1f9){var _0x54e72a=function(_0x16e79c){while(--_0x16e79c){_0x268111['push'](_0x268111['shift']());}};_0x54e72a(++_0x31c1f9);}(_0x98e5,0x8a));var _0x598e=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0x98e5[_0xd1f854];return _0x548294;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x598e('0x0'));var rs=require(_0x598e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x598e('0x2'))['db'];var utils=require(_0x598e('0x3'));var logger=require('../../config/logger')(_0x598e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x598e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4292c3,_0x1fc8b5,_0x10bf8e){return new BPromise(function(_0x3e0212,_0x9dc046){return client[_0x598e('0x6')](_0x4292c3,_0x10bf8e)[_0x598e('0x7')](function(_0x2550b9){logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));logger['debug'](_0x598e('0xb'),_0x1fc8b5,_0x598e('0xa'),JSON['stringify'](_0x2550b9));if(_0x2550b9[_0x598e('0xc')]){if(_0x2550b9['error'][_0x598e('0xd')]===0x1f4){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);return _0x9dc046(_0x2550b9['error'][_0x598e('0xe')]);}logger['error'](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')]['message']);return _0x3e0212(_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);}else{logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));_0x3e0212(_0x2550b9[_0x598e('0xf')][_0x598e('0xe')]);}})['catch'](function(_0x9ba324){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x9ba324);_0x9dc046(_0x9ba324);});});}exports[_0x598e('0x10')]=function(_0x50ffbb){var _0x1efdfc=this;return new Promise(function(_0x2ecb1e,_0x1727dd){return db[_0x598e('0x11')][_0x598e('0x12')](_0x50ffbb[_0x598e('0x13')],{'raw':_0x50ffbb[_0x598e('0x14')]?_0x50ffbb[_0x598e('0x14')][_0x598e('0x15')]===undefined?!![]:![]:!![]})[_0x598e('0x7')](function(_0x17e5f1){logger[_0x598e('0x8')](_0x598e('0x10'),_0x50ffbb);logger[_0x598e('0x16')](_0x598e('0x10'),_0x50ffbb,JSON[_0x598e('0x17')](_0x17e5f1));_0x2ecb1e(_0x17e5f1);})[_0x598e('0x18')](function(_0x5b9c3){logger['error'](_0x598e('0x10'),_0x5b9c3['message'],_0x50ffbb);_0x1727dd(_0x1efdfc[_0x598e('0xc')](0x1f4,_0x5b9c3[_0x598e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4409b4b..3d88a1e 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x5b7fc5,_0x413040){var _0x259d55=function(_0x181eff){while(--_0x181eff){_0x5b7fc5['push'](_0x5b7fc5['shift']());}};_0x259d55(++_0x413040);}(_0xb10b,0x12a));var _0xbb10=function(_0x111c17,_0x275184){_0x111c17=_0x111c17-0x0;var _0x5ff50a=_0xb10b[_0x111c17];return _0x5ff50a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x244201,_0x107d14){_0x244201=_0x244201-0x0;var _0x227f44=_0xdb28[_0x244201];return _0x227f44;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 260ebd0..b329f18 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf07=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','online','admin','user','agent','then','disabled','add','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','passport-local','Strategy','moment','bluebird','util','../../config/environment','undefined','baseDN','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration'];(function(_0x34e943,_0x4eb0f0){var _0x8a251c=function(_0x5cab8c){while(--_0x5cab8c){_0x34e943['push'](_0x34e943['shift']());}};_0x8a251c(++_0x4eb0f0);}(_0xbf07,0x77));var _0x7bf0=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xbf07[_0x5f1cf8];return _0x27d0fa;};'use strict';var passport=require(_0x7bf0('0x0'));var LocalStrategy=require(_0x7bf0('0x1'))[_0x7bf0('0x2')];var moment=require(_0x7bf0('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x7bf0('0x4'));var util=require(_0x7bf0('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x7bf0('0x6'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x4a925d){var _0x44f656=![];if(typeof _0x4a925d['activedirectory']!==_0x7bf0('0x7')){_0x44f656=_0x4a925d['activedirectory'][_0x7bf0('0x8')]&&_0x4a925d[_0x7bf0('0x9')][_0x7bf0('0xa')]&&_0x4a925d[_0x7bf0('0x9')][_0x7bf0('0xb')];}return _0x44f656;}function adAuthenticate(_0x38fb34,_0x59cad0,_0x13d13f){return new BPromise(function(_0x4d0a69,_0x96d3c7){try{var _0x1e2f8f=new ActiveDirectory(_0x38fb34);_0x1e2f8f[_0x7bf0('0xc')](_0x59cad0,_0x13d13f,function(_0x4507e6,_0x13fe51){if(_0x4507e6){logger[_0x7bf0('0xd')](_0x7bf0('0xe'),_0x59cad0,util[_0x7bf0('0xf')](_0x4507e6,{'showHidden':![],'depth':null}));_0x96d3c7(_0x7bf0('0x10'));}else if(!_0x13fe51){logger[_0x7bf0('0xd')](_0x7bf0('0x11'),_0x59cad0);_0x96d3c7(_0x7bf0('0x10'));}else{_0x4d0a69(_0x13fe51);}});}catch(_0xf15732){_0x96d3c7(_0xf15732);}});}function ActiveDirectoryAuthenticate(_0x88142d,_0x13c6e9,_0x16a7a4,_0x4424a5){var _0x383be0,_0x20fc70;if(!isActiveDirectoryConfigured(config)){logger[_0x7bf0('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x13c6e9);return _0x4424a5(null,![],{'message':_0x7bf0('0x10')});}return db[_0x7bf0('0x12')][_0x7bf0('0x13')]({'where':{'id':0x1},'attributes':[_0x7bf0('0x14'),_0x7bf0('0x15')],'raw':!![]})['then'](function(_0x254dc8){_0x383be0=_0x254dc8;if(!_0x383be0[_0x7bf0('0x14')]){logger[_0x7bf0('0xd')](_0x7bf0('0x16'),_0x13c6e9);throw new Error(_0x7bf0('0x10'));}return _0x88142d[_0x7bf0('0x13')]({'attributes':['id',_0x7bf0('0x17'),_0x7bf0('0x18'),_0x7bf0('0x19'),_0x7bf0('0x1a'),'disabled',_0x7bf0('0x1b'),_0x7bf0('0x1c'),_0x7bf0('0x1d')],'where':{'name':_0x13c6e9,'role':{'$or':[_0x7bf0('0x1e'),_0x7bf0('0x1f'),_0x7bf0('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x4924d8){if(!_0x4924d8||_0x4924d8&&_0x4924d8[_0x7bf0('0x17')]!==_0x13c6e9){throw new Error(_0x7bf0('0x10'));}_0x20fc70=_0x4924d8;var _0x4fc2a4=_0x20fc70[_0x7bf0('0x17')]+'@'+config['activedirectory'][_0x7bf0('0xb')];return adAuthenticate(config[_0x7bf0('0x9')],_0x4fc2a4,_0x16a7a4);})[_0x7bf0('0x21')](function(_0x2b8c6f){if(_0x20fc70[_0x7bf0('0x22')]){throw new Error(_0x7bf0('0x10'));}if(_0x383be0[_0x7bf0('0x15')]>0x0){if(_0x20fc70[_0x7bf0('0x1b')]){if(moment(_0x20fc70[_0x7bf0('0x1c')])[_0x7bf0('0x23')](_0x383be0[_0x7bf0('0x15')],'minutes')>moment()){throw new Error(_0x7bf0('0x10'));}return utils[_0x7bf0('0x24')](_0x20fc70,0x0,![],null)[_0x7bf0('0x21')](function(){return utils[_0x7bf0('0x25')](_0x20fc70);})[_0x7bf0('0x21')](function(){return _0x4424a5(null,_0x20fc70);});}else{return utils['getLicense'](_0x20fc70)[_0x7bf0('0x21')](function(){return _0x4424a5(null,_0x20fc70);});}}else{return utils[_0x7bf0('0x25')](_0x20fc70)['then'](function(){return _0x4424a5(null,_0x20fc70);});}})[_0x7bf0('0x26')](function(_0x540e84){return _0x4424a5(null,![],_0x540e84);});}function handleError(_0x1393f7,_0x40395b,_0x196b6a){return _0x1393f7['status'](_0x40395b||0x1f4)[_0x7bf0('0x27')]({'message':_0x196b6a?_0x196b6a[_0x7bf0('0x28')]||_0x196b6a:''});}exports[_0x7bf0('0x29')]=function(_0x5ad9c9,_0x371611,_0x318c1f){passport[_0x7bf0('0xc')](_0x7bf0('0x2a'),function(_0x4d50e1,_0x37942,_0x13130b){var _0x2e88e7=_0x4d50e1||_0x13130b;if(_0x2e88e7){return handleError(_0x371611,0x191,_0x2e88e7);}if(!_0x37942){return handleError(_0x371611,0x194,{'message':_0x7bf0('0x2b')});}else{var _0x2229bb={'payload':{'id':_0x37942['id'],'role':_0x37942['role']},'options':{'expiresIn':0x15180}};return authService[_0x7bf0('0x2c')](_0x2229bb)[_0x7bf0('0x21')](function(_0x5f39dc){_0x371611[_0x7bf0('0x2d')]({'id':_0x37942['id'],'token':_0x5f39dc,'statusCall':'','isAlreadyLogged':_0x37942[_0x7bf0('0x1d')]});});}})(_0x5ad9c9,_0x371611,_0x318c1f);};passport['use'](_0x7bf0('0x2a'),new LocalStrategy({'usernameField':_0x7bf0('0x17'),'passwordField':_0x7bf0('0x18')},function(_0x4292f6,_0x1ee014,_0x206312){return ActiveDirectoryAuthenticate(db[_0x7bf0('0x2e')],_0x4292f6,_0x1ee014,_0x206312);})); \ No newline at end of file +var _0x26aa=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','blocked','blockedAt','user','agent','then','name','disabled','minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x26aa,0xa2));var _0xa26a=function(_0x4fd4f0,_0x4caa4b){_0x4fd4f0=_0x4fd4f0-0x0;var _0x4a1ac2=_0x26aa[_0x4fd4f0];return _0x4a1ac2;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xa26a('0x0'))[_0xa26a('0x1')];var moment=require(_0xa26a('0x2'));var ActiveDirectory=require(_0xa26a('0x3'));var BPromise=require('bluebird');var util=require(_0xa26a('0x4'));var db=require(_0xa26a('0x5'))['db'];var authService=require(_0xa26a('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa26a('0x7'));function isActiveDirectoryConfigured(_0x2ea383){var _0x1eb8bc=![];if(typeof _0x2ea383[_0xa26a('0x8')]!==_0xa26a('0x9')){_0x1eb8bc=_0x2ea383[_0xa26a('0x8')][_0xa26a('0xa')]&&_0x2ea383[_0xa26a('0x8')][_0xa26a('0xb')]&&_0x2ea383[_0xa26a('0x8')][_0xa26a('0xc')];}return _0x1eb8bc;}function adAuthenticate(_0x2d9002,_0x560a0a,_0x373d1c){return new BPromise(function(_0x5f5d52,_0x1f987f){try{var _0x41b14e=new ActiveDirectory(_0x2d9002);_0x41b14e[_0xa26a('0xd')](_0x560a0a,_0x373d1c,function(_0x94c873,_0x3e962b){if(_0x94c873){logger[_0xa26a('0xe')](_0xa26a('0xf'),_0x560a0a,util[_0xa26a('0x10')](_0x94c873,{'showHidden':![],'depth':null}));_0x1f987f(_0xa26a('0x11'));}else if(!_0x3e962b){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x560a0a);_0x1f987f(_0xa26a('0x11'));}else{_0x5f5d52(_0x3e962b);}});}catch(_0x264184){_0x1f987f(_0x264184);}});}function ActiveDirectoryAuthenticate(_0x49b169,_0x3f0aec,_0x4cfdc7,_0xf47df7){var _0x21dd54,_0x2351ea;if(!isActiveDirectoryConfigured(config)){logger[_0xa26a('0xe')](_0xa26a('0x12'),_0x3f0aec);return _0xf47df7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xa26a('0x13'),_0xa26a('0x14')],'raw':!![]})['then'](function(_0x581f8e){_0x21dd54=_0x581f8e;if(!_0x21dd54[_0xa26a('0x13')]){logger[_0xa26a('0xe')](_0xa26a('0x15'),_0x3f0aec);throw new Error(_0xa26a('0x11'));}return _0x49b169['findOne']({'attributes':['id','name',_0xa26a('0x16'),_0xa26a('0x17'),'role','disabled',_0xa26a('0x18'),_0xa26a('0x19'),'online'],'where':{'name':_0x3f0aec,'role':{'$or':['admin',_0xa26a('0x1a'),_0xa26a('0x1b')]},'adSsoEnabled':!![]}});})[_0xa26a('0x1c')](function(_0xb5c60c){if(!_0xb5c60c||_0xb5c60c&&_0xb5c60c[_0xa26a('0x1d')]!==_0x3f0aec){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2351ea=_0xb5c60c;var _0x191aba=_0x2351ea[_0xa26a('0x1d')]+'@'+config['activedirectory'][_0xa26a('0xc')];return adAuthenticate(config['activedirectory'],_0x191aba,_0x4cfdc7);})[_0xa26a('0x1c')](function(_0x58a1bf){if(_0x2351ea[_0xa26a('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x21dd54[_0xa26a('0x14')]>0x0){if(_0x2351ea[_0xa26a('0x18')]){if(moment(_0x2351ea['blockedAt'])['add'](_0x21dd54['blockDuration'],_0xa26a('0x1f'))>moment()){throw new Error(_0xa26a('0x11'));}return utils[_0xa26a('0x20')](_0x2351ea,0x0,![],null)[_0xa26a('0x1c')](function(){return utils['getLicense'](_0x2351ea);})[_0xa26a('0x1c')](function(){return _0xf47df7(null,_0x2351ea);});}else{return utils['getLicense'](_0x2351ea)['then'](function(){return _0xf47df7(null,_0x2351ea);});}}else{return utils[_0xa26a('0x21')](_0x2351ea)[_0xa26a('0x1c')](function(){return _0xf47df7(null,_0x2351ea);});}})[_0xa26a('0x22')](function(_0x309392){return _0xf47df7(null,![],_0x309392);});}function handleError(_0x508d3d,_0x346a14,_0x55edf7){return _0x508d3d[_0xa26a('0x23')](_0x346a14||0x1f4)[_0xa26a('0x24')]({'message':_0x55edf7?_0x55edf7['message']||_0x55edf7:''});}exports[_0xa26a('0x25')]=function(_0x450121,_0x3ffc48,_0x25519b){passport[_0xa26a('0xd')](_0xa26a('0x26'),function(_0x5aa567,_0x2c864d,_0x5e5b7d){var _0x49ff9a=_0x5aa567||_0x5e5b7d;if(_0x49ff9a){return handleError(_0x3ffc48,0x191,_0x49ff9a);}if(!_0x2c864d){return handleError(_0x3ffc48,0x194,{'message':_0xa26a('0x27')});}else{var _0x3961f4={'payload':{'id':_0x2c864d['id'],'role':_0x2c864d[_0xa26a('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0xa26a('0x29')](_0x3961f4)['then'](function(_0xa0168b){_0x3ffc48[_0xa26a('0x2a')]({'id':_0x2c864d['id'],'token':_0xa0168b,'statusCall':'','isAlreadyLogged':_0x2c864d[_0xa26a('0x2b')]});});}})(_0x450121,_0x3ffc48,_0x25519b);};passport['use'](_0xa26a('0x26'),new LocalStrategy({'usernameField':_0xa26a('0x1d'),'passwordField':_0xa26a('0x16')},function(_0x3dc07c,_0x79974a,_0x152410){return ActiveDirectoryAuthenticate(db[_0xa26a('0x2c')],_0x3dc07c,_0x79974a,_0x152410);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 32a056a..4573cbb 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13ef=['Router','post','login','exports','express'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x13ef,0x1d0));var _0xf13e=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x13ef[_0x2e4e19];return _0x9ba20b;};'use strict';var express=require(_0xf13e('0x0'));var router=express[_0xf13e('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xf13e('0x2')]('/',controller[_0xf13e('0x3')]);module[_0xf13e('0x4')]=router; \ No newline at end of file +var _0xee7d=['post','login','exports','express','Router'];(function(_0x41852b,_0x305aad){var _0x506908=function(_0x203e0c){while(--_0x203e0c){_0x41852b['push'](_0x41852b['shift']());}};_0x506908(++_0x305aad);}(_0xee7d,0x120));var _0xdee7=function(_0x185ce6,_0x3495e3){_0x185ce6=_0x185ce6-0x0;var _0x252f03=_0xee7d[_0x185ce6];return _0x252f03;};'use strict';var express=require(_0xdee7('0x0'));var router=express[_0xdee7('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xdee7('0x2')]('/',controller[_0xdee7('0x3')]);module[_0xdee7('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 95bec34..2eb01aa 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x24dbe2,_0xd9a4b0){var _0x42712e=function(_0xd29dfe){while(--_0xd29dfe){_0x24dbe2['push'](_0x24dbe2['shift']());}};_0x42712e(++_0xd9a4b0);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x51a9c8,_0x1e0917){var _0x5d8b7f=function(_0x183af6){while(--_0x183af6){_0x51a9c8['push'](_0x51a9c8['shift']());}};_0x5d8b7f(++_0x1e0917);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 748862c..d279977 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 _0x3bdb=['../../components/auth/service','get','login','callback','isMiddleware','exports','express','passport','./authGoogle.controller'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3bdb,0xf9));var _0xb3bd=function(_0x3734cb,_0x50ac81){_0x3734cb=_0x3734cb-0x0;var _0x459f08=_0x3bdb[_0x3734cb];return _0x459f08;};'use strict';var express=require(_0xb3bd('0x0'));var passport=require(_0xb3bd('0x1'));var router=express['Router']();var controller=require(_0xb3bd('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xb3bd('0x3'));router[_0xb3bd('0x4')]('/',controller[_0xb3bd('0x5')]);router[_0xb3bd('0x4')]('/callback',controller[_0xb3bd('0x6')],authService[_0xb3bd('0x7')],userController['login'],authService['setTokenCookie']);module[_0xb3bd('0x8')]=router; \ No newline at end of file +var _0x76d5=['Router','./authGoogle.controller','login','get','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x953701,_0x5d2bf2){var _0x5a2c8f=function(_0xe8a01){while(--_0xe8a01){_0x953701['push'](_0x953701['shift']());}};_0x5a2c8f(++_0x5d2bf2);}(_0x76d5,0x108));var _0x576d=function(_0x126f39,_0x18289b){_0x126f39=_0x126f39-0x0;var _0x3bd5da=_0x76d5[_0x126f39];return _0x3bd5da;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x576d('0x0')]();var controller=require(_0x576d('0x1'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x576d('0x2')]);router[_0x576d('0x3')](_0x576d('0x4'),controller['callback'],authService[_0x576d('0x5')],userController[_0x576d('0x2')],authService[_0x576d('0x6')]);module[_0x576d('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ff8fd70..eae8dc4 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 _0xa31d=['find','MailServerOut','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','email','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','User','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','blockDuration','findOne','name','salt','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','clearBlockUser','disabled','add','getLicense','catch'];(function(_0x405778,_0xa4dd3b){var _0x341735=function(_0x4fc3b8){while(--_0x4fc3b8){_0x405778['push'](_0x405778['shift']());}};_0x341735(++_0xa4dd3b);}(_0xa31d,0x132));var _0xda31=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0xa31d[_0x574ce3];return _0x3447a0;};'use strict';var util=require(_0xda31('0x0'));var passport=require(_0xda31('0x1'));var LocalStrategy=require(_0xda31('0x2'))['Strategy'];var jayson=require(_0xda31('0x3'));var _=require(_0xda31('0x4'));var rs=require('randomstring');var moment=require(_0xda31('0x5'));var db=require(_0xda31('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xda31('0x7'));var client=jayson[_0xda31('0x8')][_0xda31('0x9')]({'port':0x232b});function localAuthenticate(_0x3fbdeb,_0x5e20a6,_0x3c9812,_0x91b7f4){var _0x38b7c6,_0x472e84;return db[_0xda31('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xda31('0xb')],'raw':!![]})['then'](function(_0x55c3a6){_0x38b7c6=_0x55c3a6;return _0x3fbdeb[_0xda31('0xc')]({'attributes':['id',_0xda31('0xd'),'password',_0xda31('0xe'),'role','disabled',_0xda31('0xf'),_0xda31('0x10'),_0xda31('0x11')],'where':{'name':_0x5e20a6,'role':{'$or':[_0xda31('0x12'),_0xda31('0x13'),_0xda31('0x14')]}}});})[_0xda31('0x15')](function(_0x29f569){if(!_0x29f569||_0x29f569&&_0x29f569[_0xda31('0xd')]!==_0x5e20a6){throw new Error(_0xda31('0x16'));}else{_0x472e84=_0x29f569;return _0x472e84;}})['then'](function(){_0x472e84[_0xda31('0x17')](_0x3c9812,function(_0x3610ca,_0x3ef8ec){var _0x3f9445=_0x472e84[_0xda31('0x11')]+0x1;if(_0x3610ca){return _0x91b7f4(_0x3610ca);}else if(!_0x3ef8ec){if(_0x472e84['disabled']){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});}else if(_0x38b7c6[_0xda31('0x18')]>0x0){if(_0x472e84[_0xda31('0xf')]){if(_0x38b7c6[_0xda31('0xb')]>0x0){if(moment(_0x472e84[_0xda31('0x10')])['add'](_0x38b7c6[_0xda31('0xb')],'minutes')>moment()){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});}else{return utils[_0xda31('0x19')](_0x472e84,_0x3f9445,![],null)[_0xda31('0x15')](function(){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});});}}else{return _0x91b7f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3f9445>=_0x38b7c6[_0xda31('0x18')]){return utils['clearBlockUser'](_0x472e84,0x0,!![],moment())[_0xda31('0x15')](function(){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});});}else{return utils[_0xda31('0x19')](_0x472e84,_0x3f9445,![],null)[_0xda31('0x15')](function(){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});});}}}else{return _0x91b7f4(null,![],{'message':_0xda31('0x16')});}}else{if(_0x472e84[_0xda31('0x1a')]){return _0x91b7f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x38b7c6[_0xda31('0x18')]>0x0){if(_0x472e84[_0xda31('0xf')]){if(_0x38b7c6['blockDuration']>0x0){if(moment(_0x472e84[_0xda31('0x10')])[_0xda31('0x1b')](_0x38b7c6[_0xda31('0xb')],'minutes')>moment()){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});}else{return utils[_0xda31('0x19')](_0x472e84,0x0,![],null)[_0xda31('0x15')](function(){return utils[_0xda31('0x1c')](_0x472e84);})[_0xda31('0x15')](function(){return _0x91b7f4(null,_0x472e84);});}}else{return _0x91b7f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x472e84,0x0,![],null)[_0xda31('0x15')](function(){return utils['getLicense'](_0x472e84);})[_0xda31('0x15')](function(){return _0x91b7f4(null,_0x472e84);})[_0xda31('0x1d')](function(_0x23f12e){return _0x91b7f4(null,![],_0x23f12e);});}}else{if(_0x472e84[_0xda31('0xf')]){return _0x91b7f4(null,![],{'message':_0xda31('0x16')});}else{return utils['getLicense'](_0x472e84)[_0xda31('0x15')](function(){return _0x91b7f4(null,_0x472e84);});}}}});})[_0xda31('0x1d')](function(_0x9c9cea){return _0x91b7f4(null,![],_0x9c9cea);});}function sendServiceMail(_0xd5b4de){return db['MailAccount'][_0xda31('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xda31('0xd'),'email'],'include':[{'model':db[_0xda31('0x1f')],'as':'Smtp','include':[{'model':db[_0xda31('0x20')],'as':_0xda31('0x20')}]}]})[_0xda31('0x15')](function(_0x2df080){if(!_0x2df080){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x433bec=_0x2df080[_0xda31('0x21')]();var _0x152cc6={'account':_0x433bec,'message':_[_0xda31('0x22')]({'from':util[_0xda31('0x23')](_0xda31('0x24'),_0x2df080[_0xda31('0xd')],_0x2df080['email']||_0x2df080['Smtp'][_0xda31('0x13')])},_0xd5b4de)};return client[_0xda31('0x25')](_0xda31('0x26'),_0x152cc6);})['then'](function(_0x2124b1){if(_0x2124b1[_0xda31('0x27')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2124b1[_0xda31('0x27')]['message']||JSON[_0xda31('0x28')](_0x2124b1[_0xda31('0x27')])));}return!![];});}function handleError(_0x28a32f,_0x2391bb,_0x33a2cb){return _0x28a32f['status'](_0x2391bb||0x1f4)[_0xda31('0x29')]({'message':_0x33a2cb?_0x33a2cb['message']||_0x33a2cb:''});}exports[_0xda31('0x2a')]=function(_0x2be2a8,_0x23c467,_0x1df2f0){passport['authenticate'](_0xda31('0x2b'),function(_0x145279,_0x3c3f56,_0x3452cd){var _0x50f6e0=_0x145279||_0x3452cd;if(_0x50f6e0){return handleError(_0x23c467,0x191,_0x50f6e0);}if(!_0x3c3f56){return handleError(_0x23c467,0x194,{'message':_0xda31('0x2c')});}else{var _0x53b174={'payload':{'id':_0x3c3f56['id'],'role':_0x3c3f56[_0xda31('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0xda31('0x2e')](_0x53b174)[_0xda31('0x15')](function(_0xd906a8){_0x23c467[_0xda31('0x2f')]({'id':_0x3c3f56['id'],'token':_0xd906a8,'statusCall':'','isAlreadyLogged':_0x3c3f56[_0xda31('0x30')]});});}})(_0x2be2a8,_0x23c467,_0x1df2f0);};exports[_0xda31('0x31')]=function(_0x34d7e4,_0x29bd53){if(!_0x34d7e4[_0xda31('0x32')]['email']){return handleError(_0x29bd53,0x1f4,{'message':_0xda31('0x33')});}var _0x17f455=rs[_0xda31('0x34')]();_0x34d7e4[_0xda31('0x32')][_0xda31('0x35')]=_0x34d7e4[_0xda31('0x32')]['email'][_0xda31('0x36')]()[_0xda31('0x37')]();var _0x49d09b;return db[_0xda31('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xda31('0x18'),_0xda31('0xb')],'raw':!![]})['then'](function(_0x144fec){_0x49d09b=_0x144fec;return db['User'][_0xda31('0x1e')]({'where':{'email':_0x34d7e4[_0xda31('0x32')][_0xda31('0x35')]}});})['then'](function(_0x32b7e6){if(!_0x32b7e6){throw new Error(_0xda31('0x38'));}if(_0x32b7e6[_0xda31('0x1a')]){throw new Error(_0xda31('0x39'));}if(_0x32b7e6[_0xda31('0xf')]){if(moment(_0x32b7e6[_0xda31('0x10')])[_0xda31('0x1b')](_0x49d09b['blockDuration'],_0xda31('0x3a'))>moment()){throw new Error(_0xda31('0x3b'));}else{_0x32b7e6[_0xda31('0xf')]=![];_0x32b7e6['blockedAt']=null;}}_0x32b7e6[_0xda31('0x3c')]=_0x17f455;_0x32b7e6['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x32b7e6[_0xda31('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x34d7e4[_0xda31('0x32')][_0xda31('0x35')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xda31('0x3e')+_0xda31('0x3f')+'https://'+_0x34d7e4[_0xda31('0x40')][_0xda31('0x41')]+_0xda31('0x42')+_0x17f455+'\x0a\x0a'+_0xda31('0x43')});})[_0xda31('0x15')](function(){_0x29bd53[_0xda31('0x44')](0xc8)[_0xda31('0x29')]({'message':_0xda31('0x45')});})[_0xda31('0x1d')](function(_0x5b358f){return handleError(_0x29bd53,0x1f4,_0x5b358f);});};exports[_0xda31('0x46')]=function(_0x466f2e,_0x4b6df6){return db[_0xda31('0x47')][_0xda31('0x1e')]({'where':{'resetPasswordToken':_0x466f2e['params'][_0xda31('0x48')],'resetPasswordExpires':{'$gt':Date[_0xda31('0x49')]()}}})[_0xda31('0x15')](function(_0x52e7e5){if(!_0x52e7e5){throw new Error(_0xda31('0x4a'));}return db[_0xda31('0xa')][_0xda31('0xc')]({'attributes':['id',_0xda31('0x4b'),_0xda31('0x4c'),_0xda31('0x4d')]})[_0xda31('0x15')](function(_0x5e0188){if(_0x5e0188['securePassword'])authService[_0xda31('0x4e')](_0x466f2e[_0xda31('0x32')][_0xda31('0x4f')]);if(!_0x5e0188[_0xda31('0x4c')]||!_0x52e7e5['previousPasswords'])return _0x52e7e5;authService[_0xda31('0x50')](_0x466f2e[_0xda31('0x32')][_0xda31('0x4f')],_0x52e7e5['previousPasswords'],_0x5e0188[_0xda31('0x4d')]);return _0x52e7e5;})[_0xda31('0x15')](function(){_0x52e7e5[_0xda31('0x4f')]=_0x466f2e['body'][_0xda31('0x4f')];_0x52e7e5[_0xda31('0x3c')]=null;_0x52e7e5[_0xda31('0x51')]=null;return _0x52e7e5['save']();});})[_0xda31('0x15')](function(){_0x4b6df6['status'](0xc8)[_0xda31('0x29')]({'message':_0xda31('0x52')});})[_0xda31('0x1d')](function(_0x4ea011){return handleError(_0x4b6df6,0x1f4,_0x4ea011);});};passport[_0xda31('0x53')](_0xda31('0x2b'),new LocalStrategy({'usernameField':_0xda31('0xd'),'passwordField':_0xda31('0x4f')},function(_0x2f890a,_0x46e0d3,_0xe38e5c){return localAuthenticate(db[_0xda31('0x47')],_0x2f890a,_0x46e0d3,_0xe38e5c);})); \ No newline at end of file +var _0x26ec=['The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','User','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','clearBlockUser','blockedAt','add','minutes','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','This\x20email\x20is\x20not\x20registered.'];(function(_0x2e682e,_0xf91ba0){var _0x33c2da=function(_0x3fb6d4){while(--_0x3fb6d4){_0x2e682e['push'](_0x2e682e['shift']());}};_0x33c2da(++_0xf91ba0);}(_0x26ec,0x163));var _0xc26e=function(_0x18acbc,_0x5d33f5){_0x18acbc=_0x18acbc-0x0;var _0x201223=_0x26ec[_0x18acbc];return _0x201223;};'use strict';var util=require(_0xc26e('0x0'));var passport=require(_0xc26e('0x1'));var LocalStrategy=require(_0xc26e('0x2'))[_0xc26e('0x3')];var jayson=require(_0xc26e('0x4'));var _=require(_0xc26e('0x5'));var rs=require(_0xc26e('0x6'));var moment=require(_0xc26e('0x7'));var db=require(_0xc26e('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc26e('0x9'));var client=jayson[_0xc26e('0xa')][_0xc26e('0xb')]({'port':0x232b});function localAuthenticate(_0x421d50,_0xf769f8,_0xbb0211,_0x21fe6f){var _0x52a975,_0x24b11;return db[_0xc26e('0xc')][_0xc26e('0xd')]({'where':{'id':0x1},'attributes':[_0xc26e('0xe'),_0xc26e('0xf')],'raw':!![]})[_0xc26e('0x10')](function(_0x3ccf9c){_0x52a975=_0x3ccf9c;return _0x421d50['findOne']({'attributes':['id',_0xc26e('0x11'),_0xc26e('0x12'),'salt',_0xc26e('0x13'),'disabled',_0xc26e('0x14'),'blockedAt',_0xc26e('0x15')],'where':{'name':_0xf769f8,'role':{'$or':[_0xc26e('0x16'),_0xc26e('0x17'),_0xc26e('0x18')]}}});})['then'](function(_0x2560bd){if(!_0x2560bd||_0x2560bd&&_0x2560bd[_0xc26e('0x11')]!==_0xf769f8){throw new Error(_0xc26e('0x19'));}else{_0x24b11=_0x2560bd;return _0x24b11;}})[_0xc26e('0x10')](function(){_0x24b11[_0xc26e('0x1a')](_0xbb0211,function(_0xe71ea0,_0x1bc15a){var _0x58c7b9=_0x24b11[_0xc26e('0x15')]+0x1;if(_0xe71ea0){return _0x21fe6f(_0xe71ea0);}else if(!_0x1bc15a){if(_0x24b11[_0xc26e('0x1b')]){return _0x21fe6f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x52a975[_0xc26e('0xe')]>0x0){if(_0x24b11[_0xc26e('0x14')]){if(_0x52a975['blockDuration']>0x0){if(moment(_0x24b11['blockedAt'])['add'](_0x52a975[_0xc26e('0xf')],'minutes')>moment()){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x1c')](_0x24b11,_0x58c7b9,![],null)[_0xc26e('0x10')](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}}else{return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}}else{if(_0x58c7b9>=_0x52a975[_0xc26e('0xe')]){return utils[_0xc26e('0x1c')](_0x24b11,0x0,!![],moment())[_0xc26e('0x10')](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}else{return utils['clearBlockUser'](_0x24b11,_0x58c7b9,![],null)['then'](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}}}else{return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}}else{if(_0x24b11[_0xc26e('0x1b')]){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else if(_0x52a975[_0xc26e('0xe')]>0x0){if(_0x24b11['blocked']){if(_0x52a975['blockDuration']>0x0){if(moment(_0x24b11[_0xc26e('0x1d')])[_0xc26e('0x1e')](_0x52a975[_0xc26e('0xf')],_0xc26e('0x1f'))>moment()){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x1c')](_0x24b11,0x0,![],null)[_0xc26e('0x10')](function(){return utils['getLicense'](_0x24b11);})[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);});}}else{return _0x21fe6f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xc26e('0x1c')](_0x24b11,0x0,![],null)[_0xc26e('0x10')](function(){return utils['getLicense'](_0x24b11);})[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);})[_0xc26e('0x20')](function(_0x15d7bf){return _0x21fe6f(null,![],_0x15d7bf);});}}else{if(_0x24b11[_0xc26e('0x14')]){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x21')](_0x24b11)[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);});}}}});})['catch'](function(_0x4f4e7a){return _0x21fe6f(null,![],_0x4f4e7a);});}function sendServiceMail(_0x2d99e1){return db[_0xc26e('0x22')][_0xc26e('0x23')]({'where':{'service':!![]},'attributes':['id',_0xc26e('0x11'),_0xc26e('0x24')],'include':[{'model':db[_0xc26e('0x25')],'as':_0xc26e('0x26'),'include':[{'model':db['CloudProvider'],'as':_0xc26e('0x27')}]}]})[_0xc26e('0x10')](function(_0x1c07b1){if(!_0x1c07b1){throw new Error(_0xc26e('0x28'));}var _0x49d1d3=_0x1c07b1[_0xc26e('0x29')]();var _0x2458ec={'account':_0x49d1d3,'message':_['merge']({'from':util[_0xc26e('0x2a')](_0xc26e('0x2b'),_0x1c07b1[_0xc26e('0x11')],_0x1c07b1['email']||_0x1c07b1[_0xc26e('0x26')][_0xc26e('0x17')])},_0x2d99e1)};return client[_0xc26e('0x2c')](_0xc26e('0x2d'),_0x2458ec);})[_0xc26e('0x10')](function(_0x245e0c){if(_0x245e0c[_0xc26e('0x2e')]){throw new Error(util[_0xc26e('0x2a')](_0xc26e('0x2f'),_0x245e0c['error']['message']||JSON['stringify'](_0x245e0c[_0xc26e('0x2e')])));}return!![];});}function handleError(_0x52a547,_0x53208d,_0x340e40){return _0x52a547['status'](_0x53208d||0x1f4)['send']({'message':_0x340e40?_0x340e40[_0xc26e('0x30')]||_0x340e40:''});}exports[_0xc26e('0x31')]=function(_0x5309e4,_0x146aab,_0x83f90b){passport['authenticate'](_0xc26e('0x32'),function(_0x3b78ca,_0x3e5502,_0x6faf6c){var _0x5af567=_0x3b78ca||_0x6faf6c;if(_0x5af567){return handleError(_0x146aab,0x191,_0x5af567);}if(!_0x3e5502){return handleError(_0x146aab,0x194,{'message':_0xc26e('0x33')});}else{var _0x2a2401={'payload':{'id':_0x3e5502['id'],'role':_0x3e5502[_0xc26e('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xc26e('0x34')](_0x2a2401)[_0xc26e('0x10')](function(_0x24f6a2){_0x146aab[_0xc26e('0x35')]({'id':_0x3e5502['id'],'token':_0x24f6a2,'statusCall':'','isAlreadyLogged':_0x3e5502['online']});});}})(_0x5309e4,_0x146aab,_0x83f90b);};exports[_0xc26e('0x36')]=function(_0x379219,_0x4a5b45){if(!_0x379219['body'][_0xc26e('0x24')]){return handleError(_0x4a5b45,0x1f4,{'message':_0xc26e('0x37')});}var _0x176396=rs[_0xc26e('0x38')]();_0x379219['body']['email']=_0x379219[_0xc26e('0x39')][_0xc26e('0x24')]['trim']()[_0xc26e('0x3a')]();var _0x580215;return db[_0xc26e('0xc')][_0xc26e('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc26e('0xf')],'raw':!![]})[_0xc26e('0x10')](function(_0x19c4dc){_0x580215=_0x19c4dc;return db['User'][_0xc26e('0x23')]({'where':{'email':_0x379219[_0xc26e('0x39')]['email']}});})[_0xc26e('0x10')](function(_0x1726d4){if(!_0x1726d4){throw new Error(_0xc26e('0x3b'));}if(_0x1726d4[_0xc26e('0x1b')]){throw new Error(_0xc26e('0x3c'));}if(_0x1726d4[_0xc26e('0x14')]){if(moment(_0x1726d4[_0xc26e('0x1d')])[_0xc26e('0x1e')](_0x580215[_0xc26e('0xf')],_0xc26e('0x1f'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1726d4[_0xc26e('0x14')]=![];_0x1726d4[_0xc26e('0x1d')]=null;}}_0x1726d4['resetPasswordToken']=_0x176396;_0x1726d4[_0xc26e('0x3d')]=Date[_0xc26e('0x3e')]()+0x36ee80;return _0x1726d4['save']();})[_0xc26e('0x10')](function(){return sendServiceMail({'to':_0x379219[_0xc26e('0x39')][_0xc26e('0x24')],'subject':_0xc26e('0x3f'),'text':_0xc26e('0x40')+_0xc26e('0x41')+'https://'+_0x379219[_0xc26e('0x42')][_0xc26e('0x43')]+_0xc26e('0x44')+_0x176396+'\x0a\x0a'+_0xc26e('0x45')});})['then'](function(){_0x4a5b45[_0xc26e('0x46')](0xc8)[_0xc26e('0x47')]({'message':_0xc26e('0x48')});})['catch'](function(_0x2af0db){return handleError(_0x4a5b45,0x1f4,_0x2af0db);});};exports['reset']=function(_0x304ddd,_0xda5333){return db[_0xc26e('0x49')][_0xc26e('0x23')]({'where':{'resetPasswordToken':_0x304ddd['params'][_0xc26e('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xc26e('0x3e')]()}}})[_0xc26e('0x10')](function(_0x24a050){if(!_0x24a050){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xc26e('0xc')][_0xc26e('0xd')]({'attributes':['id',_0xc26e('0x4b'),_0xc26e('0x4c'),_0xc26e('0x4d')]})[_0xc26e('0x10')](function(_0xe2af2b){if(_0xe2af2b[_0xc26e('0x4b')])authService['validatePasswordPattern'](_0x304ddd['body'][_0xc26e('0x12')]);if(!_0xe2af2b['enforcePasswordHistory']||!_0x24a050[_0xc26e('0x4e')])return _0x24a050;authService[_0xc26e('0x4f')](_0x304ddd[_0xc26e('0x39')][_0xc26e('0x12')],_0x24a050[_0xc26e('0x4e')],_0xe2af2b[_0xc26e('0x4d')]);return _0x24a050;})['then'](function(){_0x24a050[_0xc26e('0x12')]=_0x304ddd[_0xc26e('0x39')]['password'];_0x24a050['resetPasswordToken']=null;_0x24a050['resetPasswordExpires']=null;return _0x24a050[_0xc26e('0x50')]();});})[_0xc26e('0x10')](function(){_0xda5333[_0xc26e('0x46')](0xc8)[_0xc26e('0x47')]({'message':_0xc26e('0x51')});})[_0xc26e('0x20')](function(_0x595bca){return handleError(_0xda5333,0x1f4,_0x595bca);});};passport[_0xc26e('0x52')](_0xc26e('0x32'),new LocalStrategy({'usernameField':_0xc26e('0x11'),'passwordField':'password'},function(_0x1fe757,_0x14a5a6,_0x301fdf){return localAuthenticate(db[_0xc26e('0x49')],_0x1fe757,_0x14a5a6,_0x301fdf);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c11c012..a4aa0de 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 _0x919f=['login','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x1752e5,_0x11b9b2){var _0x26da3f=function(_0x17c1f2){while(--_0x17c1f2){_0x1752e5['push'](_0x1752e5['shift']());}};_0x26da3f(++_0x11b9b2);}(_0x919f,0x114));var _0xf919=function(_0x2bc557,_0x20bdbb){_0x2bc557=_0x2bc557-0x0;var _0x423830=_0x919f[_0x2bc557];return _0x423830;};'use strict';var express=require(_0xf919('0x0'));var router=express[_0xf919('0x1')]();var controller=require(_0xf919('0x2'));router[_0xf919('0x3')]('/',controller[_0xf919('0x4')]);router['post']('/forgot',controller['forgot']);router['post'](_0xf919('0x5'),controller[_0xf919('0x6')]);module[_0xf919('0x7')]=router; \ No newline at end of file +var _0xcf51=['/reset/:token','Router','./authLocal.controller','/forgot','post'];(function(_0x156dd8,_0x284471){var _0x4edf66=function(_0x50a94f){while(--_0x50a94f){_0x156dd8['push'](_0x156dd8['shift']());}};_0x4edf66(++_0x284471);}(_0xcf51,0x1e1));var _0x1cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf51[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x1cf5('0x0')]();var controller=require(_0x1cf5('0x1'));router['post']('/',controller['login']);router['post'](_0x1cf5('0x2'),controller['forgot']);router[_0x1cf5('0x3')](_0x1cf5('0x4'),controller['reset']);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 e6f5cd9..0c683b0 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 _0x9a5d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x37e6ed,_0x2421bf){var _0x3ec98c=function(_0x50aa59){while(--_0x50aa59){_0x37e6ed['push'](_0x37e6ed['shift']());}};_0x3ec98c(++_0x2421bf);}(_0x9a5d,0x70));var _0xd9a5=function(_0x2562fc,_0x475b75){_0x2562fc=_0x2562fc-0x0;var _0x3708bd=_0x9a5d[_0x2562fc];return _0x3708bd;};'use strict';var Sequelize=require(_0xd9a5('0x0'));module[_0xd9a5('0x1')]={'name':{'type':Sequelize[_0xd9a5('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd9a5('0x2')]},'status':{'type':Sequelize[_0xd9a5('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd9a5('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5784=['sequelize','exports','STRING','BOOLEAN'];(function(_0x187c2d,_0x465bfa){var _0x149f8b=function(_0x473b01){while(--_0x473b01){_0x187c2d['push'](_0x187c2d['shift']());}};_0x149f8b(++_0x465bfa);}(_0x5784,0x1d4));var _0x4578=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5784[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4578('0x0'));module[_0x4578('0x1')]={'name':{'type':Sequelize[_0x4578('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4578('0x2')]},'description':{'type':Sequelize[_0x4578('0x2')]},'status':{'type':Sequelize[_0x4578('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 7234522..51bbfa5 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 _0xfdf8=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','where','Automation','includeAll','rows','show','include','find','create','body','catch','params','addConditions','Condition','ids','omit','findOne','options','getConditions','addActions','Action','getActions','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x20739b,_0x289073){var _0x28687b=function(_0x3ebbc7){while(--_0x3ebbc7){_0x20739b['push'](_0x20739b['shift']());}};_0x28687b(++_0x289073);}(_0xfdf8,0x13f));var _0x8fdf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfdf8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x8fdf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fdf('0x1'));var jsonpatch=require(_0x8fdf('0x2'));var rp=require(_0x8fdf('0x3'));var moment=require(_0x8fdf('0x4'));var BPromise=require(_0x8fdf('0x5'));var Mustache=require(_0x8fdf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8fdf('0x7'));var csv=require(_0x8fdf('0x8'));var ejs=require(_0x8fdf('0x9'));var fs=require('fs');var fs_extra=require(_0x8fdf('0xa'));var _=require(_0x8fdf('0xb'));var squel=require(_0x8fdf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8fdf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8fdf('0xe'));var Papa=require(_0x8fdf('0xf'));var Redis=require(_0x8fdf('0x10'));var authService=require(_0x8fdf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8fdf('0x12'));var hardwareService=require(_0x8fdf('0x13'));var logger=require(_0x8fdf('0x14'))(_0x8fdf('0x15'));var utils=require(_0x8fdf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8fdf('0x17'))['db'];function respondWithStatusCode(_0x408866,_0x53c5fc){_0x53c5fc=_0x53c5fc||0xcc;return function(_0x51cbf2){if(_0x51cbf2){return _0x408866['sendStatus'](_0x53c5fc);}return _0x408866[_0x8fdf('0x18')](_0x53c5fc)[_0x8fdf('0x19')]();};}function respondWithResult(_0x2e2d79,_0xd996f5){_0xd996f5=_0xd996f5||0xc8;return function(_0x11f661){if(_0x11f661){return _0x2e2d79[_0x8fdf('0x18')](_0xd996f5)[_0x8fdf('0x1a')](_0x11f661);}};}function respondWithFilteredResult(_0x3df8a4,_0x4914c7){return function(_0x2fbec6){if(_0x2fbec6){var _0x55e2a0=typeof _0x4914c7[_0x8fdf('0x1b')]==='undefined'&&typeof _0x4914c7[_0x8fdf('0x1c')]===_0x8fdf('0x1d');var _0xaad56c=_0x2fbec6[_0x8fdf('0x1e')];var _0x4ba994=_0x55e2a0?0x0:_0x4914c7[_0x8fdf('0x1b')];var _0x5a5c69=_0x55e2a0?_0x2fbec6[_0x8fdf('0x1e')]:_0x4914c7[_0x8fdf('0x1b')]+_0x4914c7['limit'];var _0x48aaf2;if(_0x5a5c69>=_0xaad56c){_0x5a5c69=_0xaad56c;_0x48aaf2=0xc8;}else{_0x48aaf2=0xce;}_0x3df8a4[_0x8fdf('0x18')](_0x48aaf2);return _0x3df8a4[_0x8fdf('0x1f')](_0x8fdf('0x20'),_0x4ba994+'-'+_0x5a5c69+'/'+_0xaad56c)[_0x8fdf('0x1a')](_0x2fbec6);}return null;};}function patchUpdates(_0x2f0bb2){return function(_0x3f1c79){try{jsonpatch[_0x8fdf('0x21')](_0x3f1c79,_0x2f0bb2,!![]);}catch(_0x255ddd){return BPromise[_0x8fdf('0x22')](_0x255ddd);}return _0x3f1c79['save']();};}function saveUpdates(_0x3b4fc1,_0xf8a0d8){return function(_0x179ad3){if(_0x179ad3){return _0x179ad3['update'](_0x3b4fc1)[_0x8fdf('0x23')](function(_0x19e25a){return _0x19e25a;});}return null;};}function removeEntity(_0xafae78,_0x5e5b43){return function(_0x138587){if(_0x138587){return _0x138587[_0x8fdf('0x24')]()['then'](function(){_0xafae78[_0x8fdf('0x18')](0xcc)[_0x8fdf('0x19')]();});}};}function handleEntityNotFound(_0x24bf53,_0xa93a1f){return function(_0x14900f){if(!_0x14900f){_0x24bf53['sendStatus'](0x194);}return _0x14900f;};}function handleError(_0x1a6248,_0x49d7dc){_0x49d7dc=_0x49d7dc||0x1f4;return function(_0x4dea61){logger[_0x8fdf('0x25')](_0x4dea61[_0x8fdf('0x26')]);if(_0x4dea61[_0x8fdf('0x27')]){delete _0x4dea61[_0x8fdf('0x27')];}_0x1a6248['status'](_0x49d7dc)[_0x8fdf('0x28')](_0x4dea61);};}exports[_0x8fdf('0x29')]=function(_0x1b2dc8,_0x188a05){var _0x3fea73={},_0x132d03={},_0x3b9932={'count':0x0,'rows':[]};var _0x3fad42=_[_0x8fdf('0x2a')](db['Automation'][_0x8fdf('0x2b')],function(_0x1eaa50){return{'name':_0x1eaa50[_0x8fdf('0x2c')],'type':_0x1eaa50['type'][_0x8fdf('0x2d')]};});_0x132d03[_0x8fdf('0x2e')]=_['map'](_0x3fad42,_0x8fdf('0x27'));_0x132d03['query']=_[_0x8fdf('0x2f')](_0x1b2dc8['query']);_0x132d03[_0x8fdf('0x30')]=_[_0x8fdf('0x31')](_0x132d03['model'],_0x132d03['query']);_0x3fea73[_0x8fdf('0x32')]=_['intersection'](_0x132d03[_0x8fdf('0x2e')],qs['fields'](_0x1b2dc8[_0x8fdf('0x33')][_0x8fdf('0x34')]));_0x3fea73[_0x8fdf('0x32')]=_0x3fea73['attributes'][_0x8fdf('0x35')]?_0x3fea73[_0x8fdf('0x32')]:_0x132d03[_0x8fdf('0x2e')];if(!_0x1b2dc8['query'][_0x8fdf('0x36')](_0x8fdf('0x37'))){_0x3fea73['limit']=qs[_0x8fdf('0x1c')](_0x1b2dc8[_0x8fdf('0x33')]['limit']);_0x3fea73['offset']=qs['offset'](_0x1b2dc8[_0x8fdf('0x33')][_0x8fdf('0x1b')]);}_0x3fea73[_0x8fdf('0x38')]=qs['sort'](_0x1b2dc8['query'][_0x8fdf('0x39')]);_0x3fea73['where']=qs[_0x8fdf('0x30')](_['pick'](_0x1b2dc8['query'],_0x132d03[_0x8fdf('0x30')]),_0x3fad42);if(_0x1b2dc8[_0x8fdf('0x33')][_0x8fdf('0x3a')]){_0x3fea73['where']=_[_0x8fdf('0x3b')](_0x3fea73['where'],{'$or':_[_0x8fdf('0x2a')](_0x3fad42,function(_0x50e44c){if(_0x50e44c[_0x8fdf('0x3c')]!=='VIRTUAL'){var _0x3a04fd={};_0x3a04fd[_0x50e44c[_0x8fdf('0x27')]]={'$like':'%'+_0x1b2dc8['query'][_0x8fdf('0x3a')]+'%'};return _0x3a04fd;}})});}_0x3fea73=_[_0x8fdf('0x3b')]({},_0x3fea73,_0x1b2dc8['options']);var _0x96be2d={'where':_0x3fea73[_0x8fdf('0x3d')]};return db[_0x8fdf('0x3e')][_0x8fdf('0x1e')](_0x96be2d)[_0x8fdf('0x23')](function(_0x3dbbee){_0x3b9932[_0x8fdf('0x1e')]=_0x3dbbee;if(_0x1b2dc8['query'][_0x8fdf('0x3f')]){_0x3fea73['include']=[{'all':!![]}];}return db[_0x8fdf('0x3e')]['findAll'](_0x3fea73);})[_0x8fdf('0x23')](function(_0x26da4a){_0x3b9932[_0x8fdf('0x40')]=_0x26da4a;return _0x3b9932;})['then'](respondWithFilteredResult(_0x188a05,_0x3fea73))['catch'](handleError(_0x188a05,null));};exports[_0x8fdf('0x41')]=function(_0x4ac53e,_0x31592f){var _0x48584c={'raw':![],'where':{'id':_0x4ac53e['params']['id']}},_0x50e68d={};_0x50e68d['model']=_[_0x8fdf('0x2f')](db['Automation'][_0x8fdf('0x2b')]);_0x50e68d[_0x8fdf('0x33')]=_[_0x8fdf('0x2f')](_0x4ac53e['query']);_0x50e68d['filters']=_[_0x8fdf('0x31')](_0x50e68d['model'],_0x50e68d[_0x8fdf('0x33')]);_0x48584c[_0x8fdf('0x32')]=_[_0x8fdf('0x31')](_0x50e68d['model'],qs[_0x8fdf('0x34')](_0x4ac53e['query']['fields']));_0x48584c['attributes']=_0x48584c['attributes'][_0x8fdf('0x35')]?_0x48584c[_0x8fdf('0x32')]:_0x50e68d[_0x8fdf('0x2e')];if(_0x4ac53e[_0x8fdf('0x33')][_0x8fdf('0x3f')]){_0x48584c[_0x8fdf('0x42')]=[{'all':!![]}];}_0x48584c=_['merge']({},_0x48584c,_0x4ac53e['options']);return db[_0x8fdf('0x3e')][_0x8fdf('0x43')](_0x48584c)[_0x8fdf('0x23')](handleEntityNotFound(_0x31592f,null))[_0x8fdf('0x23')](respondWithResult(_0x31592f,null))['catch'](handleError(_0x31592f,null));};exports[_0x8fdf('0x44')]=function(_0x48b123,_0x373c6a){return db[_0x8fdf('0x3e')][_0x8fdf('0x44')](_0x48b123[_0x8fdf('0x45')],{})[_0x8fdf('0x23')](respondWithResult(_0x373c6a,0xc9))[_0x8fdf('0x46')](handleError(_0x373c6a,null));};exports['update']=function(_0x3aabc1,_0x526ba3){if(_0x3aabc1[_0x8fdf('0x45')]['id']){delete _0x3aabc1[_0x8fdf('0x45')]['id'];}return db['Automation'][_0x8fdf('0x43')]({'where':{'id':_0x3aabc1[_0x8fdf('0x47')]['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x526ba3,null))[_0x8fdf('0x23')](saveUpdates(_0x3aabc1['body'],null))[_0x8fdf('0x23')](respondWithResult(_0x526ba3,null))[_0x8fdf('0x46')](handleError(_0x526ba3,null));};exports[_0x8fdf('0x24')]=function(_0x28d836,_0x11d186){return db['Automation'][_0x8fdf('0x43')]({'where':{'id':_0x28d836['params']['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x11d186,null))[_0x8fdf('0x23')](removeEntity(_0x11d186,null))['catch'](handleError(_0x11d186,null));};exports[_0x8fdf('0x48')]=function(_0x305585,_0x56ec41,_0x53e32e){return db[_0x8fdf('0x49')]['find']({'where':{'id':_0x305585[_0x8fdf('0x47')]['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x56ec41,null))[_0x8fdf('0x23')](function(_0x5a0d73){if(_0x5a0d73){return _0x5a0d73['addConditions'](_0x305585['body'][_0x8fdf('0x4a')],_[_0x8fdf('0x4b')](_0x305585[_0x8fdf('0x45')],[_0x8fdf('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x56ec41,null))[_0x8fdf('0x46')](handleError(_0x56ec41,null));};exports['getConditions']=function(_0x132e6d,_0x22548c,_0xb1576d){var _0x10f129={};var _0x33bc96={};var _0x205c97;var _0x587c3c;return db[_0x8fdf('0x3e')][_0x8fdf('0x4c')]({'where':{'id':_0x132e6d[_0x8fdf('0x47')]['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x22548c,null))[_0x8fdf('0x23')](function(_0x445de4){if(_0x445de4){_0x205c97=_0x445de4;_0x33bc96[_0x8fdf('0x2e')]=_['keys'](db['Condition'][_0x8fdf('0x2b')]);_0x33bc96[_0x8fdf('0x33')]=_[_0x8fdf('0x2f')](_0x132e6d[_0x8fdf('0x33')]);_0x33bc96[_0x8fdf('0x30')]=_[_0x8fdf('0x31')](_0x33bc96[_0x8fdf('0x2e')],_0x33bc96[_0x8fdf('0x33')]);_0x10f129[_0x8fdf('0x32')]=_[_0x8fdf('0x31')](_0x33bc96['model'],qs[_0x8fdf('0x34')](_0x132e6d[_0x8fdf('0x33')][_0x8fdf('0x34')]));_0x10f129[_0x8fdf('0x32')]=_0x10f129[_0x8fdf('0x32')][_0x8fdf('0x35')]?_0x10f129['attributes']:_0x33bc96[_0x8fdf('0x2e')];_0x10f129[_0x8fdf('0x38')]=qs[_0x8fdf('0x39')](_0x132e6d['query'][_0x8fdf('0x39')]);_0x10f129[_0x8fdf('0x3d')]=qs['filters'](_['pick'](_0x132e6d[_0x8fdf('0x33')],_0x33bc96['filters']));if(_0x132e6d[_0x8fdf('0x33')][_0x8fdf('0x3a')]){_0x10f129[_0x8fdf('0x3d')]=_[_0x8fdf('0x3b')](_0x10f129['where'],{'$or':_['map'](_0x10f129[_0x8fdf('0x32')],function(_0x4cc9bf){var _0x22029d={};_0x22029d[_0x4cc9bf]={'$like':'%'+_0x132e6d[_0x8fdf('0x33')][_0x8fdf('0x3a')]+'%'};return _0x22029d;})});}_0x10f129=_[_0x8fdf('0x3b')]({},_0x10f129,_0x132e6d[_0x8fdf('0x4d')]);return _0x205c97[_0x8fdf('0x4e')](_0x10f129);}})[_0x8fdf('0x23')](function(_0x1871e6){if(_0x1871e6){_0x587c3c=_0x1871e6['length'];if(!_0x132e6d[_0x8fdf('0x33')][_0x8fdf('0x36')](_0x8fdf('0x37'))){_0x10f129['limit']=qs[_0x8fdf('0x1c')](_0x132e6d[_0x8fdf('0x33')]['limit']);_0x10f129['offset']=qs[_0x8fdf('0x1b')](_0x132e6d['query'][_0x8fdf('0x1b')]);}return _0x205c97[_0x8fdf('0x4e')](_0x10f129);}})[_0x8fdf('0x23')](function(_0x23b122){if(_0x23b122){return _0x23b122?{'count':_0x587c3c,'rows':_0x23b122}:null;}})[_0x8fdf('0x23')](respondWithResult(_0x22548c,null))[_0x8fdf('0x46')](handleError(_0x22548c,null));};exports[_0x8fdf('0x4f')]=function(_0x418e1f,_0x281b62,_0x28c6d9){return db[_0x8fdf('0x50')]['find']({'where':{'id':_0x418e1f[_0x8fdf('0x47')]['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x281b62,null))[_0x8fdf('0x23')](function(_0x2b8fc8){if(_0x2b8fc8){return _0x2b8fc8[_0x8fdf('0x4f')](_0x418e1f[_0x8fdf('0x45')]['ids'],_[_0x8fdf('0x4b')](_0x418e1f['body'],[_0x8fdf('0x4a'),'id'])||{});}})[_0x8fdf('0x23')](respondWithResult(_0x281b62,null))[_0x8fdf('0x46')](handleError(_0x281b62,null));};exports[_0x8fdf('0x51')]=function(_0x1051ac,_0x1e0fde,_0x1e2110){var _0x48f6fe={};var _0x15321d={};var _0x2ad8ee;var _0x1c0379;return db[_0x8fdf('0x3e')][_0x8fdf('0x4c')]({'where':{'id':_0x1051ac[_0x8fdf('0x47')]['id']}})[_0x8fdf('0x23')](handleEntityNotFound(_0x1e0fde,null))[_0x8fdf('0x23')](function(_0x21cfb9){if(_0x21cfb9){_0x2ad8ee=_0x21cfb9;_0x15321d['model']=_[_0x8fdf('0x2f')](db[_0x8fdf('0x50')][_0x8fdf('0x2b')]);_0x15321d[_0x8fdf('0x33')]=_[_0x8fdf('0x2f')](_0x1051ac[_0x8fdf('0x33')]);_0x15321d['filters']=_['intersection'](_0x15321d[_0x8fdf('0x2e')],_0x15321d[_0x8fdf('0x33')]);_0x48f6fe[_0x8fdf('0x32')]=_[_0x8fdf('0x31')](_0x15321d[_0x8fdf('0x2e')],qs[_0x8fdf('0x34')](_0x1051ac[_0x8fdf('0x33')][_0x8fdf('0x34')]));_0x48f6fe[_0x8fdf('0x32')]=_0x48f6fe[_0x8fdf('0x32')][_0x8fdf('0x35')]?_0x48f6fe[_0x8fdf('0x32')]:_0x15321d[_0x8fdf('0x2e')];_0x48f6fe[_0x8fdf('0x38')]=qs['sort'](_0x1051ac[_0x8fdf('0x33')][_0x8fdf('0x39')]);_0x48f6fe[_0x8fdf('0x3d')]=qs[_0x8fdf('0x30')](_[_0x8fdf('0x52')](_0x1051ac[_0x8fdf('0x33')],_0x15321d[_0x8fdf('0x30')]));if(_0x1051ac[_0x8fdf('0x33')]['filter']){_0x48f6fe['where']=_[_0x8fdf('0x3b')](_0x48f6fe['where'],{'$or':_[_0x8fdf('0x2a')](_0x48f6fe[_0x8fdf('0x32')],function(_0x10de10){var _0x456b7e={};_0x456b7e[_0x10de10]={'$like':'%'+_0x1051ac['query']['filter']+'%'};return _0x456b7e;})});}_0x48f6fe=_[_0x8fdf('0x3b')]({},_0x48f6fe,_0x1051ac[_0x8fdf('0x4d')]);return _0x2ad8ee[_0x8fdf('0x51')](_0x48f6fe);}})[_0x8fdf('0x23')](function(_0x4cc59d){if(_0x4cc59d){_0x1c0379=_0x4cc59d[_0x8fdf('0x35')];if(!_0x1051ac[_0x8fdf('0x33')][_0x8fdf('0x36')](_0x8fdf('0x37'))){_0x48f6fe[_0x8fdf('0x1c')]=qs[_0x8fdf('0x1c')](_0x1051ac[_0x8fdf('0x33')][_0x8fdf('0x1c')]);_0x48f6fe[_0x8fdf('0x1b')]=qs[_0x8fdf('0x1b')](_0x1051ac[_0x8fdf('0x33')]['offset']);}return _0x2ad8ee[_0x8fdf('0x51')](_0x48f6fe);}})['then'](function(_0x46df0c){if(_0x46df0c){return _0x46df0c?{'count':_0x1c0379,'rows':_0x46df0c}:null;}})[_0x8fdf('0x23')](respondWithResult(_0x1e0fde,null))['catch'](handleError(_0x1e0fde,null));}; \ No newline at end of file +var _0xc8e2=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','addConditions','Condition','ids','omit','getConditions','findOne','sort','addActions','Action','getActions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4549f2,_0x3ae7cb){var _0x4957d7=function(_0x1201b2){while(--_0x1201b2){_0x4549f2['push'](_0x4549f2['shift']());}};_0x4957d7(++_0x3ae7cb);}(_0xc8e2,0x1d4));var _0x2c8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8e2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2c8e('0x0'));var rimraf=require(_0x2c8e('0x1'));var zipdir=require(_0x2c8e('0x2'));var jsonpatch=require(_0x2c8e('0x3'));var rp=require(_0x2c8e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c8e('0x5'));var util=require('util');var path=require(_0x2c8e('0x6'));var sox=require(_0x2c8e('0x7'));var csv=require('to-csv');var ejs=require(_0x2c8e('0x8'));var fs=require('fs');var fs_extra=require(_0x2c8e('0x9'));var _=require(_0x2c8e('0xa'));var squel=require(_0x2c8e('0xb'));var crypto=require(_0x2c8e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2c8e('0xd'));var toCsv=require(_0x2c8e('0xe'));var querystring=require(_0x2c8e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c8e('0x11'));var hardwareService=require(_0x2c8e('0x12'));var logger=require(_0x2c8e('0x13'))('api');var utils=require(_0x2c8e('0x14'));var config=require(_0x2c8e('0x15'));var licenseUtil=require(_0x2c8e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3adeb1,_0x1b0060){_0x1b0060=_0x1b0060||0xcc;return function(_0x5ea2ca){if(_0x5ea2ca){return _0x3adeb1[_0x2c8e('0x17')](_0x1b0060);}return _0x3adeb1[_0x2c8e('0x18')](_0x1b0060)[_0x2c8e('0x19')]();};}function respondWithResult(_0x9e83df,_0x506ff7){_0x506ff7=_0x506ff7||0xc8;return function(_0x365849){if(_0x365849){return _0x9e83df[_0x2c8e('0x18')](_0x506ff7)[_0x2c8e('0x1a')](_0x365849);}};}function respondWithFilteredResult(_0x15ce9c,_0xeb87b9){return function(_0x431a40){if(_0x431a40){var _0x29ac74=typeof _0xeb87b9[_0x2c8e('0x1b')]===_0x2c8e('0x1c')&&typeof _0xeb87b9[_0x2c8e('0x1d')]===_0x2c8e('0x1c');var _0x415fb2=_0x431a40[_0x2c8e('0x1e')];var _0x59f8dc=_0x29ac74?0x0:_0xeb87b9[_0x2c8e('0x1b')];var _0x4a6612=_0x29ac74?_0x431a40['count']:_0xeb87b9['offset']+_0xeb87b9['limit'];var _0x27aca9;if(_0x4a6612>=_0x415fb2){_0x4a6612=_0x415fb2;_0x27aca9=0xc8;}else{_0x27aca9=0xce;}_0x15ce9c[_0x2c8e('0x18')](_0x27aca9);return _0x15ce9c[_0x2c8e('0x1f')](_0x2c8e('0x20'),_0x59f8dc+'-'+_0x4a6612+'/'+_0x415fb2)[_0x2c8e('0x1a')](_0x431a40);}return null;};}function patchUpdates(_0x4624ff){return function(_0x38724){try{jsonpatch['apply'](_0x38724,_0x4624ff,!![]);}catch(_0x508f99){return BPromise[_0x2c8e('0x21')](_0x508f99);}return _0x38724[_0x2c8e('0x22')]();};}function saveUpdates(_0x2f9719,_0x5c8df6){return function(_0x37d942){if(_0x37d942){return _0x37d942[_0x2c8e('0x23')](_0x2f9719)['then'](function(_0x3f9724){return _0x3f9724;});}return null;};}function removeEntity(_0x323f5c,_0x1d0ec4){return function(_0x1fdd1a){if(_0x1fdd1a){return _0x1fdd1a[_0x2c8e('0x24')]()[_0x2c8e('0x25')](function(){_0x323f5c[_0x2c8e('0x18')](0xcc)[_0x2c8e('0x19')]();});}};}function handleEntityNotFound(_0x5dd9dc,_0x11a2b6){return function(_0x37dc11){if(!_0x37dc11){_0x5dd9dc['sendStatus'](0x194);}return _0x37dc11;};}function handleError(_0x1466ed,_0x21a3c5){_0x21a3c5=_0x21a3c5||0x1f4;return function(_0x7020){logger[_0x2c8e('0x26')](_0x7020[_0x2c8e('0x27')]);if(_0x7020[_0x2c8e('0x28')]){delete _0x7020[_0x2c8e('0x28')];}_0x1466ed['status'](_0x21a3c5)[_0x2c8e('0x29')](_0x7020);};}exports[_0x2c8e('0x2a')]=function(_0x5e2747,_0x17e02b){var _0x24fc9f={},_0x5139cd={},_0x31c7ec={'count':0x0,'rows':[]};var _0x6c1c35=_[_0x2c8e('0x2b')](db[_0x2c8e('0x2c')][_0x2c8e('0x2d')],function(_0x46a019){return{'name':_0x46a019['fieldName'],'type':_0x46a019[_0x2c8e('0x2e')]['key']};});_0x5139cd[_0x2c8e('0x2f')]=_['map'](_0x6c1c35,_0x2c8e('0x28'));_0x5139cd[_0x2c8e('0x30')]=_['keys'](_0x5e2747['query']);_0x5139cd['filters']=_[_0x2c8e('0x31')](_0x5139cd[_0x2c8e('0x2f')],_0x5139cd[_0x2c8e('0x30')]);_0x24fc9f['attributes']=_[_0x2c8e('0x31')](_0x5139cd[_0x2c8e('0x2f')],qs[_0x2c8e('0x32')](_0x5e2747[_0x2c8e('0x30')]['fields']));_0x24fc9f[_0x2c8e('0x33')]=_0x24fc9f['attributes'][_0x2c8e('0x34')]?_0x24fc9f[_0x2c8e('0x33')]:_0x5139cd['model'];if(!_0x5e2747['query'][_0x2c8e('0x35')](_0x2c8e('0x36'))){_0x24fc9f[_0x2c8e('0x1d')]=qs['limit'](_0x5e2747['query'][_0x2c8e('0x1d')]);_0x24fc9f[_0x2c8e('0x1b')]=qs[_0x2c8e('0x1b')](_0x5e2747['query'][_0x2c8e('0x1b')]);}_0x24fc9f[_0x2c8e('0x37')]=qs['sort'](_0x5e2747[_0x2c8e('0x30')]['sort']);_0x24fc9f['where']=qs[_0x2c8e('0x38')](_['pick'](_0x5e2747[_0x2c8e('0x30')],_0x5139cd[_0x2c8e('0x38')]),_0x6c1c35);if(_0x5e2747[_0x2c8e('0x30')][_0x2c8e('0x39')]){_0x24fc9f[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x24fc9f['where'],{'$or':_['map'](_0x6c1c35,function(_0x2a8672){if(_0x2a8672['type']!=='VIRTUAL'){var _0x3f89be={};_0x3f89be[_0x2a8672[_0x2c8e('0x28')]]={'$like':'%'+_0x5e2747[_0x2c8e('0x30')][_0x2c8e('0x39')]+'%'};return _0x3f89be;}})});}_0x24fc9f=_[_0x2c8e('0x3b')]({},_0x24fc9f,_0x5e2747[_0x2c8e('0x3c')]);var _0x59b843={'where':_0x24fc9f[_0x2c8e('0x3a')]};return db[_0x2c8e('0x2c')][_0x2c8e('0x1e')](_0x59b843)['then'](function(_0x13f483){_0x31c7ec[_0x2c8e('0x1e')]=_0x13f483;if(_0x5e2747['query'][_0x2c8e('0x3d')]){_0x24fc9f[_0x2c8e('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x2c8e('0x3f')](_0x24fc9f);})['then'](function(_0x582686){_0x31c7ec[_0x2c8e('0x40')]=_0x582686;return _0x31c7ec;})[_0x2c8e('0x25')](respondWithFilteredResult(_0x17e02b,_0x24fc9f))[_0x2c8e('0x41')](handleError(_0x17e02b,null));};exports[_0x2c8e('0x42')]=function(_0x5b2f61,_0x275b40){var _0x93d206={'raw':![],'where':{'id':_0x5b2f61[_0x2c8e('0x43')]['id']}},_0x13b2a9={};_0x13b2a9['model']=_['keys'](db['Automation']['rawAttributes']);_0x13b2a9[_0x2c8e('0x30')]=_[_0x2c8e('0x44')](_0x5b2f61[_0x2c8e('0x30')]);_0x13b2a9[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x13b2a9[_0x2c8e('0x2f')],_0x13b2a9[_0x2c8e('0x30')]);_0x93d206[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x13b2a9[_0x2c8e('0x2f')],qs[_0x2c8e('0x32')](_0x5b2f61['query'][_0x2c8e('0x32')]));_0x93d206[_0x2c8e('0x33')]=_0x93d206[_0x2c8e('0x33')]['length']?_0x93d206[_0x2c8e('0x33')]:_0x13b2a9[_0x2c8e('0x2f')];if(_0x5b2f61[_0x2c8e('0x30')][_0x2c8e('0x3d')]){_0x93d206[_0x2c8e('0x3e')]=[{'all':!![]}];}_0x93d206=_[_0x2c8e('0x3b')]({},_0x93d206,_0x5b2f61[_0x2c8e('0x3c')]);return db[_0x2c8e('0x2c')]['find'](_0x93d206)[_0x2c8e('0x25')](handleEntityNotFound(_0x275b40,null))[_0x2c8e('0x25')](respondWithResult(_0x275b40,null))[_0x2c8e('0x41')](handleError(_0x275b40,null));};exports['create']=function(_0x37e070,_0x120632){return db[_0x2c8e('0x2c')]['create'](_0x37e070[_0x2c8e('0x45')],{})[_0x2c8e('0x25')](respondWithResult(_0x120632,0xc9))[_0x2c8e('0x41')](handleError(_0x120632,null));};exports[_0x2c8e('0x23')]=function(_0x5bbaea,_0x194b3c){if(_0x5bbaea[_0x2c8e('0x45')]['id']){delete _0x5bbaea[_0x2c8e('0x45')]['id'];}return db['Automation'][_0x2c8e('0x46')]({'where':{'id':_0x5bbaea[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x194b3c,null))[_0x2c8e('0x25')](saveUpdates(_0x5bbaea[_0x2c8e('0x45')],null))['then'](respondWithResult(_0x194b3c,null))[_0x2c8e('0x41')](handleError(_0x194b3c,null));};exports[_0x2c8e('0x24')]=function(_0x2de496,_0x4ef6b6){return db['Automation'][_0x2c8e('0x46')]({'where':{'id':_0x2de496[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x4ef6b6,null))[_0x2c8e('0x25')](removeEntity(_0x4ef6b6,null))['catch'](handleError(_0x4ef6b6,null));};exports[_0x2c8e('0x47')]=function(_0x1d3d24,_0xdfc74b,_0x3fd421){return db[_0x2c8e('0x48')][_0x2c8e('0x46')]({'where':{'id':_0x1d3d24[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0xdfc74b,null))[_0x2c8e('0x25')](function(_0xb23c0a){if(_0xb23c0a){return _0xb23c0a[_0x2c8e('0x47')](_0x1d3d24[_0x2c8e('0x45')][_0x2c8e('0x49')],_[_0x2c8e('0x4a')](_0x1d3d24[_0x2c8e('0x45')],[_0x2c8e('0x49'),'id'])||{});}})['then'](respondWithResult(_0xdfc74b,null))[_0x2c8e('0x41')](handleError(_0xdfc74b,null));};exports[_0x2c8e('0x4b')]=function(_0x294943,_0x4f5075,_0x207ca9){var _0x32cb18={};var _0x144729={};var _0x265dc9;var _0x22c6c5;return db[_0x2c8e('0x2c')][_0x2c8e('0x4c')]({'where':{'id':_0x294943[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x4f5075,null))[_0x2c8e('0x25')](function(_0x4cb2af){if(_0x4cb2af){_0x265dc9=_0x4cb2af;_0x144729[_0x2c8e('0x2f')]=_['keys'](db[_0x2c8e('0x48')]['rawAttributes']);_0x144729[_0x2c8e('0x30')]=_['keys'](_0x294943['query']);_0x144729[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x144729['model'],_0x144729[_0x2c8e('0x30')]);_0x32cb18[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x144729['model'],qs['fields'](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x32')]));_0x32cb18[_0x2c8e('0x33')]=_0x32cb18['attributes'][_0x2c8e('0x34')]?_0x32cb18[_0x2c8e('0x33')]:_0x144729['model'];_0x32cb18[_0x2c8e('0x37')]=qs[_0x2c8e('0x4d')](_0x294943['query'][_0x2c8e('0x4d')]);_0x32cb18[_0x2c8e('0x3a')]=qs[_0x2c8e('0x38')](_['pick'](_0x294943[_0x2c8e('0x30')],_0x144729[_0x2c8e('0x38')]));if(_0x294943[_0x2c8e('0x30')][_0x2c8e('0x39')]){_0x32cb18[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x32cb18[_0x2c8e('0x3a')],{'$or':_[_0x2c8e('0x2b')](_0x32cb18[_0x2c8e('0x33')],function(_0x960a36){var _0x3492ad={};_0x3492ad[_0x960a36]={'$like':'%'+_0x294943['query'][_0x2c8e('0x39')]+'%'};return _0x3492ad;})});}_0x32cb18=_['merge']({},_0x32cb18,_0x294943[_0x2c8e('0x3c')]);return _0x265dc9[_0x2c8e('0x4b')](_0x32cb18);}})['then'](function(_0x51a202){if(_0x51a202){_0x22c6c5=_0x51a202['length'];if(!_0x294943['query'][_0x2c8e('0x35')](_0x2c8e('0x36'))){_0x32cb18[_0x2c8e('0x1d')]=qs['limit'](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x1d')]);_0x32cb18[_0x2c8e('0x1b')]=qs[_0x2c8e('0x1b')](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x1b')]);}return _0x265dc9['getConditions'](_0x32cb18);}})[_0x2c8e('0x25')](function(_0x506d81){if(_0x506d81){return _0x506d81?{'count':_0x22c6c5,'rows':_0x506d81}:null;}})[_0x2c8e('0x25')](respondWithResult(_0x4f5075,null))[_0x2c8e('0x41')](handleError(_0x4f5075,null));};exports[_0x2c8e('0x4e')]=function(_0x41f433,_0x59b1f1,_0x185077){return db[_0x2c8e('0x4f')]['find']({'where':{'id':_0x41f433[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x59b1f1,null))['then'](function(_0xe8a344){if(_0xe8a344){return _0xe8a344[_0x2c8e('0x4e')](_0x41f433[_0x2c8e('0x45')][_0x2c8e('0x49')],_[_0x2c8e('0x4a')](_0x41f433['body'],['ids','id'])||{});}})[_0x2c8e('0x25')](respondWithResult(_0x59b1f1,null))[_0x2c8e('0x41')](handleError(_0x59b1f1,null));};exports[_0x2c8e('0x50')]=function(_0x5d2e6e,_0x1e1c34,_0x23e5d0){var _0x55b84c={};var _0x376ad1={};var _0x2e0275;var _0x58fe6f;return db[_0x2c8e('0x2c')][_0x2c8e('0x4c')]({'where':{'id':_0x5d2e6e[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x1e1c34,null))[_0x2c8e('0x25')](function(_0x5971a3){if(_0x5971a3){_0x2e0275=_0x5971a3;_0x376ad1[_0x2c8e('0x2f')]=_[_0x2c8e('0x44')](db[_0x2c8e('0x4f')][_0x2c8e('0x2d')]);_0x376ad1[_0x2c8e('0x30')]=_[_0x2c8e('0x44')](_0x5d2e6e['query']);_0x376ad1[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x376ad1['model'],_0x376ad1[_0x2c8e('0x30')]);_0x55b84c[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x376ad1[_0x2c8e('0x2f')],qs['fields'](_0x5d2e6e[_0x2c8e('0x30')][_0x2c8e('0x32')]));_0x55b84c['attributes']=_0x55b84c[_0x2c8e('0x33')]['length']?_0x55b84c['attributes']:_0x376ad1[_0x2c8e('0x2f')];_0x55b84c[_0x2c8e('0x37')]=qs[_0x2c8e('0x4d')](_0x5d2e6e[_0x2c8e('0x30')]['sort']);_0x55b84c[_0x2c8e('0x3a')]=qs['filters'](_[_0x2c8e('0x51')](_0x5d2e6e[_0x2c8e('0x30')],_0x376ad1[_0x2c8e('0x38')]));if(_0x5d2e6e['query']['filter']){_0x55b84c[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x55b84c['where'],{'$or':_[_0x2c8e('0x2b')](_0x55b84c[_0x2c8e('0x33')],function(_0x2c95b4){var _0x1530dd={};_0x1530dd[_0x2c95b4]={'$like':'%'+_0x5d2e6e[_0x2c8e('0x30')]['filter']+'%'};return _0x1530dd;})});}_0x55b84c=_[_0x2c8e('0x3b')]({},_0x55b84c,_0x5d2e6e['options']);return _0x2e0275[_0x2c8e('0x50')](_0x55b84c);}})[_0x2c8e('0x25')](function(_0x31bcf0){if(_0x31bcf0){_0x58fe6f=_0x31bcf0[_0x2c8e('0x34')];if(!_0x5d2e6e['query'][_0x2c8e('0x35')]('nolimit')){_0x55b84c[_0x2c8e('0x1d')]=qs[_0x2c8e('0x1d')](_0x5d2e6e[_0x2c8e('0x30')][_0x2c8e('0x1d')]);_0x55b84c['offset']=qs[_0x2c8e('0x1b')](_0x5d2e6e['query'][_0x2c8e('0x1b')]);}return _0x2e0275[_0x2c8e('0x50')](_0x55b84c);}})[_0x2c8e('0x25')](function(_0x5862f5){if(_0x5862f5){return _0x5862f5?{'count':_0x58fe6f,'rows':_0x5862f5}:null;}})[_0x2c8e('0x25')](respondWithResult(_0x1e1c34,null))['catch'](handleError(_0x1e1c34,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 52172da..422f01c 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 _0xe704=['util','../../config/logger','api','moment','bluebird','request-promise','path','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x2e71ba,_0x4e04f4){var _0x4715d4=function(_0x33c8be){while(--_0x33c8be){_0x2e71ba['push'](_0x2e71ba['shift']());}};_0x4715d4(++_0x4e04f4);}(_0xe704,0xd8));var _0x4e70=function(_0x53b07f,_0xe70c95){_0x53b07f=_0x53b07f-0x0;var _0x28730e=_0xe704[_0x53b07f];return _0x28730e;};'use strict';var _=require('lodash');var util=require(_0x4e70('0x0'));var logger=require(_0x4e70('0x1'))(_0x4e70('0x2'));var moment=require(_0x4e70('0x3'));var BPromise=require(_0x4e70('0x4'));var rp=require(_0x4e70('0x5'));var fs=require('fs');var path=require(_0x4e70('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e70('0x7'));module[_0x4e70('0x8')]=function(_0x1ef113,_0x37842f){return _0x1ef113[_0x4e70('0x9')](_0x4e70('0xa'),attributes,{'tableName':_0x4e70('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f3d=['request-promise','path','rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird'];(function(_0x648818,_0x2169db){var _0x353087=function(_0x142b08){while(--_0x142b08){_0x648818['push'](_0x648818['shift']());}};_0x353087(++_0x2169db);}(_0x8f3d,0x157));var _0xd8f3=function(_0x396b6d,_0x382476){_0x396b6d=_0x396b6d-0x0;var _0x5ee4a3=_0x8f3d[_0x396b6d];return _0x5ee4a3;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var logger=require(_0xd8f3('0x2'))(_0xd8f3('0x3'));var moment=require('moment');var BPromise=require(_0xd8f3('0x4'));var rp=require(_0xd8f3('0x5'));var fs=require('fs');var path=require(_0xd8f3('0x6'));var rimraf=require(_0xd8f3('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8f3('0x8'));module[_0xd8f3('0x9')]=function(_0x4914ee,_0x1bd360){return _0x4914ee['define'](_0xd8f3('0xa'),attributes,{'tableName':_0xd8f3('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 dd93bf1..5ebf642 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 _0x2c16=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x5a4a76,_0x142d2f){var _0xd2bfba=function(_0xbeb5c4){while(--_0xbeb5c4){_0x5a4a76['push'](_0x5a4a76['shift']());}};_0xd2bfba(++_0x142d2f);}(_0x2c16,0xf0));var _0x62c1=function(_0x26b5e6,_0x3e7cff){_0x26b5e6=_0x26b5e6-0x0;var _0x2b4c4f=_0x2c16[_0x26b5e6];return _0x2b4c4f;};'use strict';var _=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var moment=require(_0x62c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x62c1('0x3'));var fs=require('fs');var Redis=require(_0x62c1('0x4'));var db=require(_0x62c1('0x5'))['db'];var utils=require(_0x62c1('0x6'));var logger=require(_0x62c1('0x7'))(_0x62c1('0x8'));var config=require(_0x62c1('0x9'));var jayson=require(_0x62c1('0xa'));var client=jayson[_0x62c1('0xb')][_0x62c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x527671,_0x113a32,_0x4bcc7b){return new BPromise(function(_0x236518,_0x4af828){return client[_0x62c1('0xd')](_0x527671,_0x4bcc7b)['then'](function(_0x153420){logger[_0x62c1('0xe')]('Automation,\x20%s,\x20%s',_0x113a32,_0x62c1('0xf'));logger['debug'](_0x62c1('0x10'),_0x113a32,_0x62c1('0xf'),JSON[_0x62c1('0x11')](_0x153420));if(_0x153420[_0x62c1('0x12')]){if(_0x153420[_0x62c1('0x12')]['code']===0x1f4){logger['error'](_0x62c1('0x13'),_0x113a32,_0x153420[_0x62c1('0x12')]['message']);return _0x4af828(_0x153420['error'][_0x62c1('0x14')]);}logger[_0x62c1('0x12')]('Automation,\x20%s,\x20%s',_0x113a32,_0x153420[_0x62c1('0x12')][_0x62c1('0x14')]);return _0x236518(_0x153420[_0x62c1('0x12')][_0x62c1('0x14')]);}else{logger[_0x62c1('0xe')]('Automation,\x20%s,\x20%s',_0x113a32,_0x62c1('0xf'));_0x236518(_0x153420['result'][_0x62c1('0x14')]);}})[_0x62c1('0x15')](function(_0x969e09){logger[_0x62c1('0x12')](_0x62c1('0x13'),_0x113a32,_0x969e09);_0x4af828(_0x969e09);});});} \ No newline at end of file +var _0x3da6=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x3da6,0xc1));var _0x63da=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0x3da6[_0x617084];return _0x384ac0;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require(_0x63da('0x2'));var BPromise=require(_0x63da('0x3'));var rs=require(_0x63da('0x4'));var fs=require('fs');var Redis=require(_0x63da('0x5'));var db=require(_0x63da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x63da('0x7'))(_0x63da('0x8'));var config=require('../../config/environment');var jayson=require(_0x63da('0x9'));var client=jayson['client'][_0x63da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x519714,_0x1e6160,_0x7a48ee){return new BPromise(function(_0xbf0f63,_0x39a442){return client['request'](_0x519714,_0x7a48ee)[_0x63da('0xb')](function(_0xdc10c4){logger['info'](_0x63da('0xc'),_0x1e6160,'request\x20sent');logger[_0x63da('0xd')](_0x63da('0xe'),_0x1e6160,_0x63da('0xf'),JSON[_0x63da('0x10')](_0xdc10c4));if(_0xdc10c4[_0x63da('0x11')]){if(_0xdc10c4['error'][_0x63da('0x12')]===0x1f4){logger['error'](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0x39a442(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0xbf0f63(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}else{logger[_0x63da('0x14')](_0x63da('0xc'),_0x1e6160,'request\x20sent');_0xbf0f63(_0xdc10c4['result'][_0x63da('0x13')]);}})['catch'](function(_0x1f2f88){logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0x1f2f88);_0x39a442(_0x1f2f88);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 00948ac..306debf 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 _0x946e=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','isAuthenticated','create','addConditions','/:id/actions','addActions','put','update'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x946e,0x1d0));var _0xe946=function(_0x3af10e,_0x273881){_0x3af10e=_0x3af10e-0x0;var _0x40070e=_0x946e[_0x3af10e];return _0x40070e;};'use strict';var multer=require(_0xe946('0x0'));var util=require('util');var path=require(_0xe946('0x1'));var timeout=require('connect-timeout');var express=require(_0xe946('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe946('0x3'));var interaction=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var controller=require(_0xe946('0x6'));router[_0xe946('0x7')]('/',auth['isAuthenticated'](),controller[_0xe946('0x8')]);router[_0xe946('0x7')](_0xe946('0x9'),auth['isAuthenticated'](),controller[_0xe946('0xa')]);router['get'](_0xe946('0xb'),auth[_0xe946('0xc')](),controller['getConditions']);router['get']('/:id/actions',auth[_0xe946('0xc')](),controller['getActions']);router['post']('/',auth[_0xe946('0xc')](),controller[_0xe946('0xd')]);router['post']('/:id/conditions',auth[_0xe946('0xc')](),controller[_0xe946('0xe')]);router['post'](_0xe946('0xf'),auth[_0xe946('0xc')](),controller[_0xe946('0x10')]);router[_0xe946('0x11')](_0xe946('0x9'),auth[_0xe946('0xc')](),controller[_0xe946('0x12')]);router['delete']('/:id',auth[_0xe946('0xc')](),controller[_0xe946('0x13')]);module[_0xe946('0x14')]=router; \ No newline at end of file +var _0xafe6=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete'];(function(_0x45fa83,_0x1bf036){var _0x3ddf5d=function(_0x24b9a8){while(--_0x24b9a8){_0x45fa83['push'](_0x45fa83['shift']());}};_0x3ddf5d(++_0x1bf036);}(_0xafe6,0x66));var _0x6afe=function(_0x25ec2d,_0x3220f2){_0x25ec2d=_0x25ec2d-0x0;var _0x4b625b=_0xafe6[_0x25ec2d];return _0x4b625b;};'use strict';var multer=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var path=require(_0x6afe('0x2'));var timeout=require(_0x6afe('0x3'));var express=require(_0x6afe('0x4'));var router=express['Router']();var fs_extra=require(_0x6afe('0x5'));var auth=require(_0x6afe('0x6'));var interaction=require(_0x6afe('0x7'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x6afe('0x8')]('/',auth['isAuthenticated'](),controller[_0x6afe('0x9')]);router[_0x6afe('0x8')](_0x6afe('0xa'),auth[_0x6afe('0xb')](),controller[_0x6afe('0xc')]);router['get'](_0x6afe('0xd'),auth['isAuthenticated'](),controller[_0x6afe('0xe')]);router['get'](_0x6afe('0xf'),auth[_0x6afe('0xb')](),controller[_0x6afe('0x10')]);router[_0x6afe('0x11')]('/',auth[_0x6afe('0xb')](),controller[_0x6afe('0x12')]);router[_0x6afe('0x11')](_0x6afe('0xd'),auth[_0x6afe('0xb')](),controller['addConditions']);router[_0x6afe('0x11')]('/:id/actions',auth[_0x6afe('0xb')](),controller[_0x6afe('0x13')]);router[_0x6afe('0x14')](_0x6afe('0xa'),auth[_0x6afe('0xb')](),controller[_0x6afe('0x15')]);router[_0x6afe('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6afe('0x17')]);module[_0x6afe('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4b0f741..957d9c2 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 _0x62a8=['Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x62a8,0x16b));var _0x862a=function(_0x103f47,_0x3a4c98){_0x103f47=_0x103f47-0x0;var _0x4ad438=_0x62a8[_0x103f47];return _0x4ad438;};'use strict';var Sequelize=require(_0x862a('0x0'));module[_0x862a('0x1')]={'name':{'type':Sequelize[_0x862a('0x2')],'unique':_0x862a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x862a('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x862a('0x5')},'description':{'type':Sequelize[_0x862a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x862a('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x862a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x862a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x862a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x862a('0xf')},'dialTimezone':{'type':Sequelize[_0x862a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x862a('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x862a('0x4')](_0x862a('0x10'),'never',_0x862a('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x862a('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x862a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x862a('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x862a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x862a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x862a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x862a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x862a('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x862a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x862a('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x862a('0x8')](0x9)[_0x862a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x862a('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x862a('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x862a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x862a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x862a('0x8')](0x3)[_0x862a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x862a('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x862a('0x8')](0x5)[_0x862a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x862a('0x21')}}; \ No newline at end of file +var _0x65ac=['Random\x20Last\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)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC'];(function(_0x4f1026,_0x5aad6e){var _0x18fd21=function(_0x491f97){while(--_0x491f97){_0x4f1026['push'](_0x4f1026['shift']());}};_0x18fd21(++_0x5aad6e);}(_0x65ac,0xf8));var _0xc65a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x65ac[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc65a('0x0'));module[_0xc65a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc65a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x4')),'allowNull':![],'defaultValue':_0xc65a('0x4')},'description':{'type':Sequelize[_0xc65a('0x5')]},'active':{'type':Sequelize[_0xc65a('0x6')],'defaultValue':0x0,'comment':_0xc65a('0x7')},'limitCalls':{'type':Sequelize[_0xc65a('0x8')](0x4)[_0xc65a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc65a('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc65a('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc65a('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'comment':_0xc65a('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc65a('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc65a('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x13'),_0xc65a('0x14'),_0xc65a('0x15')),'defaultValue':_0xc65a('0x13')},'dialAMDActive':{'type':Sequelize[_0xc65a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc65a('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xc65a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc65a('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc65a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc65a('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc65a('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc65a('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc65a('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc65a('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc65a('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x1e'),_0xc65a('0x1f')),'defaultValue':_0xc65a('0x1e')},'dialPrefix':{'type':Sequelize[_0xc65a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc65a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc65a('0x20')},'dialCutDigit':{'type':Sequelize[_0xc65a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7ba2261..616e769 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 _0xe330=['addBlackLists','omit','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','then','get','IvrCampaigns','UserProfileResource','destroy','name','send','index','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','include','Campaign','findAll','catch','show','params','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','error','clone','rawAttributes','updatedAt','body','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','order','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','field','CmListId','toString','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','cm_contacts','deletedAt\x20IS\x20NULL','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists'];(function(_0x480cee,_0x3d4b07){var _0x25f2c5=function(_0x4fc976){while(--_0x4fc976){_0x480cee['push'](_0x480cee['shift']());}};_0x25f2c5(++_0x3d4b07);}(_0xe330,0x96));var _0x0e33=function(_0x332431,_0x56e16e){_0x332431=_0x332431-0x0;var _0x88af2c=_0xe330[_0x332431];return _0x88af2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e33('0x0'));var zipdir=require(_0x0e33('0x1'));var jsonpatch=require(_0x0e33('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e33('0x3'));var Mustache=require(_0x0e33('0x4'));var util=require('util');var path=require(_0x0e33('0x5'));var sox=require(_0x0e33('0x6'));var csv=require('to-csv');var ejs=require(_0x0e33('0x7'));var fs=require('fs');var fs_extra=require(_0x0e33('0x8'));var _=require(_0x0e33('0x9'));var squel=require(_0x0e33('0xa'));var crypto=require(_0x0e33('0xb'));var jsforce=require(_0x0e33('0xc'));var deskjs=require(_0x0e33('0xd'));var toCsv=require(_0x0e33('0xe'));var querystring=require(_0x0e33('0xf'));var Papa=require(_0x0e33('0x10'));var Redis=require(_0x0e33('0x11'));var authService=require(_0x0e33('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e33('0x13'));var hardwareService=require(_0x0e33('0x14'));var logger=require(_0x0e33('0x15'))(_0x0e33('0x16'));var utils=require('../../config/utils');var config=require(_0x0e33('0x17'));var licenseUtil=require(_0x0e33('0x18'));var db=require(_0x0e33('0x19'))['db'];function respondWithStatusCode(_0x2c048c,_0x512994){_0x512994=_0x512994||0xcc;return function(_0x4f379c){if(_0x4f379c){return _0x2c048c[_0x0e33('0x1a')](_0x512994);}return _0x2c048c['status'](_0x512994)[_0x0e33('0x1b')]();};}function respondWithResult(_0x4725d8,_0x4267a3){_0x4267a3=_0x4267a3||0xc8;return function(_0x28751c){if(_0x28751c){return _0x4725d8[_0x0e33('0x1c')](_0x4267a3)[_0x0e33('0x1d')](_0x28751c);}};}function respondWithFilteredResult(_0x16d45c,_0x4148d4){return function(_0x25fbaf){if(_0x25fbaf){var _0x3c5399=typeof _0x4148d4['offset']==='undefined'&&typeof _0x4148d4[_0x0e33('0x1e')]===_0x0e33('0x1f');var _0xa73fa5=_0x25fbaf[_0x0e33('0x20')];var _0x515efc=_0x3c5399?0x0:_0x4148d4[_0x0e33('0x21')];var _0x35ab15=_0x3c5399?_0x25fbaf[_0x0e33('0x20')]:_0x4148d4[_0x0e33('0x21')]+_0x4148d4[_0x0e33('0x1e')];var _0x296c50;if(_0x35ab15>=_0xa73fa5){_0x35ab15=_0xa73fa5;_0x296c50=0xc8;}else{_0x296c50=0xce;}_0x16d45c[_0x0e33('0x1c')](_0x296c50);return _0x16d45c[_0x0e33('0x22')](_0x0e33('0x23'),_0x515efc+'-'+_0x35ab15+'/'+_0xa73fa5)[_0x0e33('0x1d')](_0x25fbaf);}return null;};}function patchUpdates(_0x651a94){return function(_0x58c4f9){try{jsonpatch['apply'](_0x58c4f9,_0x651a94,!![]);}catch(_0x29cd1b){return BPromise[_0x0e33('0x24')](_0x29cd1b);}return _0x58c4f9['save']();};}function saveUpdates(_0x510039,_0x17c388){return function(_0x4a1db6){if(_0x4a1db6){return _0x4a1db6['update'](_0x510039)['then'](function(_0x113707){return _0x113707;});}return null;};}function removeEntity(_0x3d0853,_0x5497bb){return function(_0x48232e){if(_0x48232e){return _0x48232e['destroy']()[_0x0e33('0x25')](function(){var _0x1eaceb=_0x48232e[_0x0e33('0x26')]({'plain':!![]});var _0x1ca468=_0x0e33('0x27');return db[_0x0e33('0x28')][_0x0e33('0x29')]({'where':{'type':_0x1ca468,'resourceId':_0x1eaceb['id']}})[_0x0e33('0x25')](function(){return _0x48232e;});})['then'](function(){_0x3d0853[_0x0e33('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f8e1,_0x38a78a){return function(_0x2d86d8){if(!_0x2d86d8){_0x33f8e1[_0x0e33('0x1a')](0x194);}return _0x2d86d8;};}function handleError(_0x1f3bfa,_0x103ddb){_0x103ddb=_0x103ddb||0x1f4;return function(_0x603e2e){logger['error'](_0x603e2e['stack']);if(_0x603e2e[_0x0e33('0x2a')]){delete _0x603e2e[_0x0e33('0x2a')];}_0x1f3bfa['status'](_0x103ddb)[_0x0e33('0x2b')](_0x603e2e);};}exports[_0x0e33('0x2c')]=function(_0x585269,_0x4458ad){var _0x379fa7={},_0x220107={},_0x11f181={'count':0x0,'rows':[]};var _0x143241=_['map'](db['Campaign']['rawAttributes'],function(_0x39fdf2){return{'name':_0x39fdf2[_0x0e33('0x2d')],'type':_0x39fdf2[_0x0e33('0x2e')]['key']};});_0x220107[_0x0e33('0x2f')]=_[_0x0e33('0x30')](_0x143241,_0x0e33('0x2a'));_0x220107['query']=_[_0x0e33('0x31')](_0x585269[_0x0e33('0x32')]);_0x220107[_0x0e33('0x33')]=_[_0x0e33('0x34')](_0x220107[_0x0e33('0x2f')],_0x220107[_0x0e33('0x32')]);_0x379fa7[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0x220107[_0x0e33('0x2f')],qs[_0x0e33('0x36')](_0x585269['query']['fields']));_0x379fa7['attributes']=_0x379fa7[_0x0e33('0x35')][_0x0e33('0x37')]?_0x379fa7[_0x0e33('0x35')]:_0x220107[_0x0e33('0x2f')];if(!_0x585269['query'][_0x0e33('0x38')](_0x0e33('0x39'))){_0x379fa7['limit']=qs[_0x0e33('0x1e')](_0x585269[_0x0e33('0x32')][_0x0e33('0x1e')]);_0x379fa7[_0x0e33('0x21')]=qs[_0x0e33('0x21')](_0x585269['query'][_0x0e33('0x21')]);}_0x379fa7['order']=qs[_0x0e33('0x3a')](_0x585269[_0x0e33('0x32')][_0x0e33('0x3a')]);_0x379fa7['where']=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x585269[_0x0e33('0x32')],_0x220107['filters']),_0x143241);if(_0x585269[_0x0e33('0x32')][_0x0e33('0x3c')]){_0x379fa7[_0x0e33('0x3d')]=_[_0x0e33('0x3e')](_0x379fa7[_0x0e33('0x3d')],{'$or':_[_0x0e33('0x30')](_0x143241,function(_0x52d6ab){if(_0x52d6ab[_0x0e33('0x2e')]!=='VIRTUAL'){var _0x502a46={};_0x502a46[_0x52d6ab[_0x0e33('0x2a')]]={'$like':'%'+_0x585269['query']['filter']+'%'};return _0x502a46;}})});}_0x379fa7=_[_0x0e33('0x3e')]({},_0x379fa7,_0x585269['options']);var _0x5054d8={'where':_0x379fa7[_0x0e33('0x3d')]};return db['Campaign'][_0x0e33('0x20')](_0x5054d8)['then'](function(_0x4f513a){_0x11f181[_0x0e33('0x20')]=_0x4f513a;if(_0x585269['query'][_0x0e33('0x3f')]){_0x379fa7[_0x0e33('0x40')]=[{'all':!![]}];}return db[_0x0e33('0x41')][_0x0e33('0x42')](_0x379fa7);})['then'](function(_0x1b1d2f){_0x11f181['rows']=_0x1b1d2f;return _0x11f181;})[_0x0e33('0x25')](respondWithFilteredResult(_0x4458ad,_0x379fa7))[_0x0e33('0x43')](handleError(_0x4458ad,null));};exports[_0x0e33('0x44')]=function(_0x37b82b,_0x1b3c6b){var _0xc74e96={'raw':![],'where':{'id':_0x37b82b[_0x0e33('0x45')]['id']}},_0x19a484={};_0x19a484[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db[_0x0e33('0x41')]['rawAttributes']);_0x19a484[_0x0e33('0x32')]=_['keys'](_0x37b82b[_0x0e33('0x32')]);_0x19a484[_0x0e33('0x33')]=_[_0x0e33('0x34')](_0x19a484[_0x0e33('0x2f')],_0x19a484['query']);_0xc74e96[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0x19a484[_0x0e33('0x2f')],qs[_0x0e33('0x36')](_0x37b82b[_0x0e33('0x32')][_0x0e33('0x36')]));_0xc74e96[_0x0e33('0x35')]=_0xc74e96['attributes'][_0x0e33('0x37')]?_0xc74e96[_0x0e33('0x35')]:_0x19a484[_0x0e33('0x2f')];if(_0x37b82b['query']['includeAll']){_0xc74e96[_0x0e33('0x40')]=[{'all':!![]}];}_0xc74e96=_[_0x0e33('0x3e')]({},_0xc74e96,_0x37b82b[_0x0e33('0x46')]);return db['Campaign'][_0x0e33('0x47')](_0xc74e96)[_0x0e33('0x25')](handleEntityNotFound(_0x1b3c6b,null))[_0x0e33('0x25')](respondWithResult(_0x1b3c6b,null))[_0x0e33('0x43')](handleError(_0x1b3c6b,null));};exports['create']=function(_0x3956b7,_0x48cf4a){return db[_0x0e33('0x41')]['create'](_0x3956b7['body'],{})['then'](function(_0x4fd5bc){var _0x3c26b9=_0x3956b7[_0x0e33('0x48')][_0x0e33('0x26')]({'plain':!![]});if(!_0x3c26b9)throw new Error(_0x0e33('0x49'));if(_0x3c26b9[_0x0e33('0x4a')]===_0x0e33('0x48')){var _0x27869e=_0x4fd5bc[_0x0e33('0x26')]({'plain':!![]});var _0x59dc5a=_0x0e33('0x27');return db[_0x0e33('0x4b')]['find']({'where':{'name':_0x59dc5a,'userProfileId':_0x3c26b9['userProfileId']},'raw':!![]})['then'](function(_0x276be2){if(_0x276be2&&_0x276be2[_0x0e33('0x4c')]===0x0){return db[_0x0e33('0x28')][_0x0e33('0x4d')]({'name':_0x27869e['name'],'resourceId':_0x27869e['id'],'type':_0x276be2[_0x0e33('0x2a')],'sectionId':_0x276be2['id']},{})[_0x0e33('0x25')](function(){return _0x4fd5bc;});}else{return _0x4fd5bc;}})[_0x0e33('0x43')](function(_0x47281e){logger[_0x0e33('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47281e);throw _0x47281e;});}return _0x4fd5bc;})['then'](respondWithResult(_0x48cf4a,0xc9))[_0x0e33('0x43')](handleError(_0x48cf4a,null));};exports[_0x0e33('0x4f')]=function(_0x10a567,_0x344b23){var _0x4be2fe={'where':{'id':_0x10a567[_0x0e33('0x45')]['id']}},_0x213d22={};_0x213d22['model']=_[_0x0e33('0x31')](db[_0x0e33('0x41')][_0x0e33('0x50')]);_0x4be2fe[_0x0e33('0x35')]=_['intersection'](_0x213d22['model'],qs[_0x0e33('0x36')](_0x10a567[_0x0e33('0x32')][_0x0e33('0x36')]));_0x4be2fe[_0x0e33('0x35')]=_0x4be2fe[_0x0e33('0x35')][_0x0e33('0x37')]?_0x4be2fe[_0x0e33('0x35')]:_0x213d22[_0x0e33('0x2f')];if(_0x10a567[_0x0e33('0x32')][_0x0e33('0x3f')]){_0x4be2fe[_0x0e33('0x40')]=[{'all':!![]}];}_0x4be2fe=_[_0x0e33('0x3e')]({},_0x4be2fe,_0x10a567[_0x0e33('0x46')]);return db[_0x0e33('0x41')][_0x0e33('0x47')](_0x4be2fe)[_0x0e33('0x25')](handleEntityNotFound(_0x344b23,null))[_0x0e33('0x25')](function(_0x234ed4){if(_0x234ed4){var _0x4613fa=_0x234ed4['get']({'plain':!![]});_0x4613fa=qs['omit'](_0x4613fa,['id','createdAt',_0x0e33('0x51')]);_0x10a567[_0x0e33('0x52')]=_['omit'](_0x10a567[_0x0e33('0x52')],['id',_0x0e33('0x53'),_0x0e33('0x51')]);return db['Campaign'][_0x0e33('0x4d')](_[_0x0e33('0x3e')](_0x4613fa,_0x10a567[_0x0e33('0x52')]),{'include':_0x10a567[_0x0e33('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x0e33('0x25')](function(_0x1c343f){var _0x4d638b=_0x10a567[_0x0e33('0x48')]['get']({'plain':!![]});if(!_0x4d638b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d638b[_0x0e33('0x4a')]===_0x0e33('0x48')){var _0x392c7=_0x1c343f[_0x0e33('0x26')]({'plain':!![]});var _0x57c77c=_0x0e33('0x27');return db[_0x0e33('0x4b')][_0x0e33('0x47')]({'where':{'name':_0x57c77c,'userProfileId':_0x4d638b[_0x0e33('0x54')]},'raw':!![]})[_0x0e33('0x25')](function(_0x15dd07){if(_0x15dd07&&_0x15dd07[_0x0e33('0x4c')]===0x0){return db[_0x0e33('0x28')]['create']({'name':_0x392c7[_0x0e33('0x2a')],'resourceId':_0x392c7['id'],'type':_0x15dd07[_0x0e33('0x2a')],'sectionId':_0x15dd07['id']},{})['then'](function(){return _0x1c343f;});}else{return _0x1c343f;}})[_0x0e33('0x43')](function(_0x16b8f5){logger[_0x0e33('0x4e')](_0x0e33('0x55'),_0x16b8f5);throw _0x16b8f5;});}return _0x1c343f;});}})['then'](respondWithResult(_0x344b23,0xc9))[_0x0e33('0x43')](handleError(_0x344b23,null));};exports['update']=function(_0x5379c8,_0x33ed90){if(_0x5379c8[_0x0e33('0x52')]['id']){delete _0x5379c8[_0x0e33('0x52')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5379c8[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x33ed90,null))[_0x0e33('0x25')](saveUpdates(_0x5379c8['body'],null))[_0x0e33('0x25')](respondWithResult(_0x33ed90,null))['catch'](handleError(_0x33ed90,null));};exports[_0x0e33('0x29')]=function(_0x523a4a,_0x2dca33){return db[_0x0e33('0x41')][_0x0e33('0x47')]({'where':{'id':_0x523a4a[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x2dca33,null))[_0x0e33('0x25')](removeEntity(_0x2dca33,null))[_0x0e33('0x43')](handleError(_0x2dca33,null));};exports[_0x0e33('0x56')]=function(_0x2d12be,_0x4eb796,_0x3ede45){var _0x32020e={'raw':!![],'where':{}};var _0x4a908b={};var _0x3d9086={'count':0x0,'rows':[]};return db[_0x0e33('0x41')][_0x0e33('0x57')]({'where':{'id':_0x2d12be[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x4eb796,null))['then'](function(_0x19d329){if(_0x19d329){_0x4a908b[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db[_0x0e33('0x58')][_0x0e33('0x50')]);_0x4a908b['query']=_[_0x0e33('0x31')](_0x2d12be[_0x0e33('0x32')]);_0x4a908b['filters']=_[_0x0e33('0x34')](_0x4a908b[_0x0e33('0x2f')],_0x4a908b[_0x0e33('0x32')]);_0x32020e[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0x4a908b['model'],qs[_0x0e33('0x36')](_0x2d12be[_0x0e33('0x32')][_0x0e33('0x36')]));_0x32020e[_0x0e33('0x35')]=_0x32020e[_0x0e33('0x35')][_0x0e33('0x37')]?_0x32020e[_0x0e33('0x35')]:_0x4a908b[_0x0e33('0x2f')];if(!_0x2d12be[_0x0e33('0x32')][_0x0e33('0x38')](_0x0e33('0x39'))){_0x32020e[_0x0e33('0x1e')]=qs[_0x0e33('0x1e')](_0x2d12be[_0x0e33('0x32')]['limit']);_0x32020e['offset']=qs[_0x0e33('0x21')](_0x2d12be[_0x0e33('0x32')][_0x0e33('0x21')]);}_0x32020e[_0x0e33('0x59')]=qs[_0x0e33('0x3a')](_0x2d12be[_0x0e33('0x32')]['sort']);_0x32020e['where']=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x2d12be[_0x0e33('0x32')],_0x4a908b['filters']));_0x32020e['where'][_0x0e33('0x5a')]=_0x19d329['id'];if(_0x2d12be[_0x0e33('0x32')][_0x0e33('0x3c')]){_0x32020e[_0x0e33('0x3d')]=_[_0x0e33('0x3e')](_0x32020e['where'],{'$or':_[_0x0e33('0x30')](_0x32020e[_0x0e33('0x35')],function(_0x4d6196){var _0x45d8fa={};_0x45d8fa[_0x4d6196]={'$like':'%'+_0x2d12be[_0x0e33('0x32')][_0x0e33('0x3c')]+'%'};return _0x45d8fa;})});}_0x32020e=_['merge']({},_0x32020e,_0x2d12be[_0x0e33('0x46')]);return db[_0x0e33('0x58')]['count']({'where':_0x32020e[_0x0e33('0x3d')]})[_0x0e33('0x25')](function(_0x2f0fcd){_0x3d9086[_0x0e33('0x20')]=_0x2f0fcd;if(_0x2d12be[_0x0e33('0x32')]['includeAll']){_0x32020e['include']=[{'all':!![]}];}return db[_0x0e33('0x58')]['findAll'](_0x32020e);})['then'](function(_0x23c297){_0x3d9086[_0x0e33('0x5b')]=_0x23c297;return _0x3d9086;});}})[_0x0e33('0x25')](respondWithFilteredResult(_0x4eb796,_0x32020e))[_0x0e33('0x43')](handleError(_0x4eb796,null));};exports[_0x0e33('0x5c')]=function(_0x45893e,_0x49e53b,_0x3f045e){var _0x5ca4c8={'raw':!![],'where':{}};var _0x368a3e={};var _0x157f00={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x45893e[_0x0e33('0x45')]['id']}})['then'](handleEntityNotFound(_0x49e53b,null))[_0x0e33('0x25')](function(_0x5048fb){if(_0x5048fb){_0x368a3e[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db[_0x0e33('0x5d')][_0x0e33('0x50')]);_0x368a3e[_0x0e33('0x32')]=_[_0x0e33('0x31')](_0x45893e[_0x0e33('0x32')]);_0x368a3e[_0x0e33('0x33')]=_['intersection'](_0x368a3e[_0x0e33('0x2f')],_0x368a3e[_0x0e33('0x32')]);_0x5ca4c8[_0x0e33('0x35')]=_['intersection'](_0x368a3e[_0x0e33('0x2f')],qs[_0x0e33('0x36')](_0x45893e[_0x0e33('0x32')][_0x0e33('0x36')]));_0x5ca4c8[_0x0e33('0x35')]=_0x5ca4c8['attributes'][_0x0e33('0x37')]?_0x5ca4c8[_0x0e33('0x35')]:_0x368a3e[_0x0e33('0x2f')];if(!_0x45893e[_0x0e33('0x32')][_0x0e33('0x38')]('nolimit')){_0x5ca4c8[_0x0e33('0x1e')]=qs[_0x0e33('0x1e')](_0x45893e[_0x0e33('0x32')][_0x0e33('0x1e')]);_0x5ca4c8[_0x0e33('0x21')]=qs['offset'](_0x45893e['query']['offset']);}_0x5ca4c8[_0x0e33('0x59')]=qs[_0x0e33('0x3a')](_0x45893e['query'][_0x0e33('0x3a')]);_0x5ca4c8[_0x0e33('0x3d')]=qs[_0x0e33('0x33')](_['pick'](_0x45893e[_0x0e33('0x32')],_0x368a3e['filters']));_0x5ca4c8[_0x0e33('0x3d')][_0x0e33('0x5a')]=_0x5048fb['id'];if(_0x45893e[_0x0e33('0x32')]['filter']){_0x5ca4c8[_0x0e33('0x3d')]=_[_0x0e33('0x3e')](_0x5ca4c8['where'],{'$or':_['map'](_0x5ca4c8[_0x0e33('0x35')],function(_0x108508){var _0x2c6c6f={};_0x2c6c6f[_0x108508]={'$like':'%'+_0x45893e[_0x0e33('0x32')][_0x0e33('0x3c')]+'%'};return _0x2c6c6f;})});}_0x5ca4c8=_['merge']({},_0x5ca4c8,_0x45893e[_0x0e33('0x46')]);return db['CmHopperHistory'][_0x0e33('0x20')]({'where':_0x5ca4c8[_0x0e33('0x3d')]})['then'](function(_0x456a14){_0x157f00[_0x0e33('0x20')]=_0x456a14;if(_0x45893e[_0x0e33('0x32')][_0x0e33('0x3f')]){_0x5ca4c8[_0x0e33('0x40')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5ca4c8);})[_0x0e33('0x25')](function(_0x4c4e3f){_0x157f00[_0x0e33('0x5b')]=_0x4c4e3f;return _0x157f00;});}})[_0x0e33('0x25')](respondWithFilteredResult(_0x49e53b,_0x5ca4c8))[_0x0e33('0x43')](handleError(_0x49e53b,null));};exports[_0x0e33('0x5e')]=function(_0x1ffc79,_0x4c86d8,_0x10e259){var _0x3a3e29={'raw':!![],'where':{}};var _0x4cd154={};var _0xb9cd01={'count':0x0,'rows':[]};return db[_0x0e33('0x41')][_0x0e33('0x57')]({'where':{'id':_0x1ffc79[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x4c86d8,null))[_0x0e33('0x25')](function(_0x3afc94){if(_0x3afc94){_0x4cd154[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db['CmHopperFinal'][_0x0e33('0x50')]);_0x4cd154['query']=_[_0x0e33('0x31')](_0x1ffc79[_0x0e33('0x32')]);_0x4cd154[_0x0e33('0x33')]=_[_0x0e33('0x34')](_0x4cd154[_0x0e33('0x2f')],_0x4cd154[_0x0e33('0x32')]);_0x3a3e29[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0x4cd154[_0x0e33('0x2f')],qs['fields'](_0x1ffc79[_0x0e33('0x32')][_0x0e33('0x36')]));_0x3a3e29['attributes']=_0x3a3e29[_0x0e33('0x35')]['length']?_0x3a3e29[_0x0e33('0x35')]:_0x4cd154[_0x0e33('0x2f')];if(!_0x1ffc79[_0x0e33('0x32')][_0x0e33('0x38')](_0x0e33('0x39'))){_0x3a3e29[_0x0e33('0x1e')]=qs[_0x0e33('0x1e')](_0x1ffc79[_0x0e33('0x32')]['limit']);_0x3a3e29[_0x0e33('0x21')]=qs[_0x0e33('0x21')](_0x1ffc79[_0x0e33('0x32')]['offset']);}_0x3a3e29[_0x0e33('0x59')]=qs[_0x0e33('0x3a')](_0x1ffc79[_0x0e33('0x32')][_0x0e33('0x3a')]);_0x3a3e29[_0x0e33('0x3d')]=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x1ffc79[_0x0e33('0x32')],_0x4cd154[_0x0e33('0x33')]));_0x3a3e29[_0x0e33('0x3d')]['CampaignId']=_0x3afc94['id'];if(_0x1ffc79[_0x0e33('0x32')][_0x0e33('0x3c')]){_0x3a3e29[_0x0e33('0x3d')]=_[_0x0e33('0x3e')](_0x3a3e29['where'],{'$or':_[_0x0e33('0x30')](_0x3a3e29[_0x0e33('0x35')],function(_0x1aa77f){var _0x3c5050={};_0x3c5050[_0x1aa77f]={'$like':'%'+_0x1ffc79[_0x0e33('0x32')][_0x0e33('0x3c')]+'%'};return _0x3c5050;})});}_0x3a3e29=_['merge']({},_0x3a3e29,_0x1ffc79[_0x0e33('0x46')]);return db[_0x0e33('0x5f')][_0x0e33('0x20')]({'where':_0x3a3e29[_0x0e33('0x3d')]})[_0x0e33('0x25')](function(_0x30834a){_0xb9cd01[_0x0e33('0x20')]=_0x30834a;if(_0x1ffc79[_0x0e33('0x32')]['includeAll']){_0x3a3e29[_0x0e33('0x40')]=[{'all':!![]}];}return db[_0x0e33('0x5f')][_0x0e33('0x42')](_0x3a3e29);})['then'](function(_0x47dbda){_0xb9cd01['rows']=_0x47dbda;return _0xb9cd01;});}})[_0x0e33('0x25')](respondWithFilteredResult(_0x4c86d8,_0x3a3e29))[_0x0e33('0x43')](handleError(_0x4c86d8,null));};exports[_0x0e33('0x60')]=function(_0x51801d,_0x442624,_0x1e562f){var _0x168837={'raw':!![],'where':{}};var _0x30b925={};var _0x191eb7={'count':0x0,'rows':[]};return db[_0x0e33('0x41')]['findOne']({'where':{'id':_0x51801d[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x442624,null))[_0x0e33('0x25')](function(_0x3d1d4f){if(_0x3d1d4f){_0x30b925['model']=_[_0x0e33('0x31')](db[_0x0e33('0x61')][_0x0e33('0x50')]);_0x30b925[_0x0e33('0x32')]=_['keys'](_0x51801d['query']);_0x30b925[_0x0e33('0x33')]=_['intersection'](_0x30b925['model'],_0x30b925[_0x0e33('0x32')]);_0x168837[_0x0e33('0x35')]=_['intersection'](_0x30b925[_0x0e33('0x2f')],qs['fields'](_0x51801d[_0x0e33('0x32')][_0x0e33('0x36')]));_0x168837[_0x0e33('0x35')]=_0x168837['attributes']['length']?_0x168837['attributes']:_0x30b925[_0x0e33('0x2f')];if(!_0x51801d[_0x0e33('0x32')]['hasOwnProperty']('nolimit')){_0x168837[_0x0e33('0x1e')]=qs[_0x0e33('0x1e')](_0x51801d[_0x0e33('0x32')]['limit']);_0x168837[_0x0e33('0x21')]=qs[_0x0e33('0x21')](_0x51801d[_0x0e33('0x32')]['offset']);}_0x168837[_0x0e33('0x59')]=qs[_0x0e33('0x3a')](_0x51801d[_0x0e33('0x32')][_0x0e33('0x3a')]);_0x168837[_0x0e33('0x3d')]=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x51801d['query'],_0x30b925[_0x0e33('0x33')]));_0x168837[_0x0e33('0x3d')][_0x0e33('0x5a')]=_0x3d1d4f['id'];if(_0x51801d[_0x0e33('0x32')]['filter']){_0x168837[_0x0e33('0x3d')]=_['merge'](_0x168837[_0x0e33('0x3d')],{'$or':_[_0x0e33('0x30')](_0x168837[_0x0e33('0x35')],function(_0x4efcc1){var _0x58ac0c={};_0x58ac0c[_0x4efcc1]={'$like':'%'+_0x51801d[_0x0e33('0x32')][_0x0e33('0x3c')]+'%'};return _0x58ac0c;})});}_0x168837=_[_0x0e33('0x3e')]({},_0x168837,_0x51801d['options']);return db['CmHopperBlack'][_0x0e33('0x20')]({'where':_0x168837['where']})[_0x0e33('0x25')](function(_0x67ae84){_0x191eb7[_0x0e33('0x20')]=_0x67ae84;if(_0x51801d['query'][_0x0e33('0x3f')]){_0x168837[_0x0e33('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x168837);})[_0x0e33('0x25')](function(_0x542e83){_0x191eb7[_0x0e33('0x5b')]=_0x542e83;return _0x191eb7;});}})[_0x0e33('0x25')](respondWithFilteredResult(_0x442624,_0x168837))[_0x0e33('0x43')](handleError(_0x442624,null));};exports[_0x0e33('0x62')]=function(_0x14a3be,_0x537ea0,_0x2ffe47){var _0x41f7f0={};var _0x334602={};var _0x35e3cf;var _0x311b83;return db[_0x0e33('0x41')][_0x0e33('0x57')]({'where':{'id':_0x14a3be[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x537ea0,null))['then'](function(_0x1700dd){if(_0x1700dd){_0x35e3cf=_0x1700dd;_0x334602[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db[_0x0e33('0x63')][_0x0e33('0x50')]);_0x334602[_0x0e33('0x32')]=_[_0x0e33('0x31')](_0x14a3be['query']);_0x334602[_0x0e33('0x33')]=_[_0x0e33('0x34')](_0x334602['model'],_0x334602[_0x0e33('0x32')]);_0x41f7f0[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0x334602[_0x0e33('0x2f')],qs['fields'](_0x14a3be[_0x0e33('0x32')][_0x0e33('0x36')]));_0x41f7f0[_0x0e33('0x35')]=_0x41f7f0['attributes'][_0x0e33('0x37')]?_0x41f7f0[_0x0e33('0x35')]:_0x334602['model'];_0x41f7f0['order']=qs[_0x0e33('0x3a')](_0x14a3be['query'][_0x0e33('0x3a')]);_0x41f7f0[_0x0e33('0x3d')]=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x14a3be[_0x0e33('0x32')],_0x334602[_0x0e33('0x33')]));if(_0x14a3be[_0x0e33('0x32')][_0x0e33('0x3c')]){_0x41f7f0[_0x0e33('0x3d')]=_['merge'](_0x41f7f0[_0x0e33('0x3d')],{'$or':_['map'](_0x41f7f0['attributes'],function(_0x1c2ede){var _0x576be4={};_0x576be4[_0x1c2ede]={'$like':'%'+_0x14a3be['query'][_0x0e33('0x3c')]+'%'};return _0x576be4;})});}_0x41f7f0=_[_0x0e33('0x3e')]({},_0x41f7f0,_0x14a3be[_0x0e33('0x46')]);return _0x35e3cf[_0x0e33('0x62')](_0x41f7f0);}})[_0x0e33('0x25')](function(_0x43b8e5){if(_0x43b8e5){_0x311b83=_0x43b8e5['length'];if(!_0x14a3be[_0x0e33('0x32')][_0x0e33('0x38')](_0x0e33('0x39'))){_0x41f7f0[_0x0e33('0x1e')]=qs['limit'](_0x14a3be['query'][_0x0e33('0x1e')]);_0x41f7f0[_0x0e33('0x21')]=qs['offset'](_0x14a3be[_0x0e33('0x32')][_0x0e33('0x21')]);}return _0x35e3cf[_0x0e33('0x62')](_0x41f7f0);}})[_0x0e33('0x25')](function(_0x5b1834){if(_0x5b1834){return _0x5b1834?{'count':_0x311b83,'rows':_0x5b1834}:null;}})[_0x0e33('0x25')](respondWithResult(_0x537ea0,null))[_0x0e33('0x43')](handleError(_0x537ea0,null));};exports[_0x0e33('0x64')]=function(_0x2f6b61,_0x337014,_0x8ea76c){var _0x25a1f9,_0x3e52bc;var _0x58762d=[];var _0x226fcc=moment()[_0x0e33('0x65')](_0x0e33('0x66'));return db[_0x0e33('0x41')][_0x0e33('0x47')]({'where':{'id':_0x2f6b61[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x337014,null))[_0x0e33('0x25')](function(_0x317aad){if(_0x317aad){_0x3e52bc=_0x317aad;return _0x317aad[_0x0e33('0x64')](_0x2f6b61[_0x0e33('0x52')]['ids'],_['omit'](_0x2f6b61[_0x0e33('0x52')],[_0x0e33('0x67'),'id'])||{});}return null;})[_0x0e33('0x68')](function(_0x48f026){var _0x4c374b;var _0x41dc23;_0x25a1f9=_0x48f026||[];var _0x40ebe5=[];if(_0x48f026){for(var _0x136d19=0x0;_0x136d19<_0x48f026[_0x0e33('0x37')];_0x136d19+=0x1){var _0x19bb43=_0x48f026[_0x136d19][_0x0e33('0x26')]({'plain':!![]});_0x3e52bc[_0x0e33('0x69')]=_0x2f6b61[_0x0e33('0x52')][_0x0e33('0x69')]?_0x2f6b61['body'][_0x0e33('0x69')]:_0x3e52bc[_0x0e33('0x69')];switch(_0x3e52bc[_0x0e33('0x69')]){case _0x0e33('0x6a'):_0x4c374b=squel[_0x0e33('0x6b')]()[_0x0e33('0x6c')]('cm_hopper')[_0x0e33('0x6d')]([_0x0e33('0x6e'),_0x0e33('0x6f'),_0x0e33('0x70'),_0x0e33('0x71'),'CampaignId','createdAt',_0x0e33('0x51')],squel[_0x0e33('0x72')]()['field']('phone',_0x0e33('0x6e'))['field'](_0x0e33('0x73'),'scheduledAt')[_0x0e33('0x74')]('id','ContactId')['field'](_0x19bb43[_0x0e33('0x75')]['toString'](),_0x0e33('0x71'))['field'](_0x2f6b61['params']['id'][_0x0e33('0x76')](),_0x0e33('0x5a'))[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27',_0x0e33('0x53'))['field']('\x27'+_0x226fcc+'\x27',_0x0e33('0x51'))[_0x0e33('0x77')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x0e33('0x78'),_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')]())[_0x0e33('0x3d')](_0x0e33('0x79'))[_0x0e33('0x3d')](_0x0e33('0x7a'),squel[_0x0e33('0x72')]()[_0x0e33('0x74')](_0x0e33('0x7b'))['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f6b61['params']['id'][_0x0e33('0x76')]()))[_0x0e33('0x3d')](_0x0e33('0x7a'),squel[_0x0e33('0x72')]()['field'](_0x0e33('0x7c'))['from']('cm_hopper')['where'](_0x0e33('0x7d'),_0x2f6b61['params']['id']['toString']())))[_0x0e33('0x76')]();break;case _0x0e33('0x7e'):_0x4c374b=squel[_0x0e33('0x6b')]()[_0x0e33('0x6c')](_0x0e33('0x7f'))[_0x0e33('0x6d')]([_0x0e33('0x6e'),_0x0e33('0x6f'),_0x0e33('0x70'),'ListId',_0x0e33('0x5a'),_0x0e33('0x53'),_0x0e33('0x51')],squel['select']()[_0x0e33('0x74')]('phone',_0x0e33('0x6e'))[_0x0e33('0x74')](_0x0e33('0x73'),_0x0e33('0x6f'))['field']('id',_0x0e33('0x70'))['field'](_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')](),_0x0e33('0x71'))['field'](_0x2f6b61[_0x0e33('0x45')]['id'][_0x0e33('0x76')](),_0x0e33('0x5a'))[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27','createdAt')[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27',_0x0e33('0x51'))[_0x0e33('0x77')](_0x0e33('0x80'))['where'](_0x0e33('0x81'))[_0x0e33('0x3d')](_0x0e33('0x78'),_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')]())[_0x0e33('0x3d')](_0x0e33('0x79'))[_0x0e33('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0e33('0x72')]()[_0x0e33('0x74')](_0x0e33('0x7c'))['from'](_0x0e33('0x7f'))[_0x0e33('0x3d')](_0x0e33('0x7d'),_0x2f6b61[_0x0e33('0x45')]['id']['toString']())))[_0x0e33('0x76')]();break;default:_0x4c374b=squel[_0x0e33('0x6b')]()[_0x0e33('0x6c')](_0x0e33('0x7f'))[_0x0e33('0x6d')](['phone',_0x0e33('0x6f'),_0x0e33('0x70'),_0x0e33('0x71'),_0x0e33('0x5a'),_0x0e33('0x53'),_0x0e33('0x51')],squel[_0x0e33('0x72')]()[_0x0e33('0x74')](_0x0e33('0x6e'),_0x0e33('0x6e'))['field'](_0x0e33('0x73'),_0x0e33('0x6f'))[_0x0e33('0x74')]('id',_0x0e33('0x70'))[_0x0e33('0x74')](_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')](),_0x0e33('0x71'))[_0x0e33('0x74')](_0x2f6b61[_0x0e33('0x45')]['id'][_0x0e33('0x76')](),_0x0e33('0x5a'))['field']('\x27'+_0x226fcc+'\x27',_0x0e33('0x53'))[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27',_0x0e33('0x51'))['from']('cm_contacts')[_0x0e33('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x0e33('0x78'),_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')]())[_0x0e33('0x3d')](_0x0e33('0x79')))[_0x0e33('0x76')]();}_0x41dc23=squel['insert']()[_0x0e33('0x6c')]('cm_hopper_additional_phones')[_0x0e33('0x6d')](['cmHopperId',_0x0e33('0x6f'),'phone',_0x0e33('0x82'),_0x0e33('0x53'),'updatedAt'],squel['select']()[_0x0e33('0x74')](_0x0e33('0x83'),'id')[_0x0e33('0x74')](_0x0e33('0x73'),'scheduledAt')[_0x0e33('0x74')](_0x0e33('0x84'),_0x0e33('0x6e'))[_0x0e33('0x74')](_0x0e33('0x85'),_0x0e33('0x82'))[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27',_0x0e33('0x53'))[_0x0e33('0x74')]('\x27'+_0x226fcc+'\x27',_0x0e33('0x51'))[_0x0e33('0x77')](_0x0e33('0x86'),'ci')[_0x0e33('0x87')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x0e33('0x3d')]('h.ListId\x20=\x20?',_0x19bb43[_0x0e33('0x75')][_0x0e33('0x76')]())[_0x0e33('0x3d')](_0x0e33('0x88'),_0x2f6b61[_0x0e33('0x45')]['id']['toString']())['where'](_0x0e33('0x89'),_0x226fcc))[_0x0e33('0x76')]();_0x40ebe5[_0x0e33('0x8a')](db[_0x0e33('0x8b')]['query'](_0x4c374b));_0x58762d[_0x0e33('0x8a')](db[_0x0e33('0x8b')][_0x0e33('0x32')](_0x41dc23));}return BPromise['all'](_0x40ebe5);}})['then'](function(){return BPromise['all'](_0x58762d);})[_0x0e33('0x25')](function(){return _0x25a1f9;})['then'](respondWithResult(_0x337014,null))[_0x0e33('0x43')](handleError(_0x337014,null));};exports[_0x0e33('0x8c')]=function(_0xc59439,_0x10bc1d,_0x219e53){return db[_0x0e33('0x41')][_0x0e33('0x47')]({'where':{'id':_0xc59439[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x10bc1d,null))[_0x0e33('0x25')](function(_0x12f4f6){if(_0x12f4f6){return _0x12f4f6['removeLists'](_0xc59439[_0x0e33('0x32')][_0x0e33('0x67')]);}})[_0x0e33('0x25')](function(_0x2b4941){if(_0x2b4941){return db[_0x0e33('0x58')][_0x0e33('0x29')]({'where':{'ListId':_0xc59439['query'][_0x0e33('0x67')],'CampaignId':_0xc59439[_0x0e33('0x45')]['id']}})['then'](function(){return _0x2b4941;});}})[_0x0e33('0x25')](respondWithStatusCode(_0x10bc1d,null))[_0x0e33('0x43')](handleError(_0x10bc1d,null));};exports[_0x0e33('0x8d')]=function(_0x22a453,_0x513fe8,_0x35a5a){var _0x462ef2={};var _0xaf1336={};var _0x11155a;var _0xbc4cb0;return db['Campaign'][_0x0e33('0x57')]({'where':{'id':_0x22a453['params']['id']}})['then'](handleEntityNotFound(_0x513fe8,null))[_0x0e33('0x25')](function(_0x19fef3){if(_0x19fef3){_0x11155a=_0x19fef3;_0xaf1336[_0x0e33('0x2f')]=_[_0x0e33('0x31')](db[_0x0e33('0x63')]['rawAttributes']);_0xaf1336[_0x0e33('0x32')]=_[_0x0e33('0x31')](_0x22a453[_0x0e33('0x32')]);_0xaf1336['filters']=_[_0x0e33('0x34')](_0xaf1336[_0x0e33('0x2f')],_0xaf1336[_0x0e33('0x32')]);_0x462ef2[_0x0e33('0x35')]=_[_0x0e33('0x34')](_0xaf1336[_0x0e33('0x2f')],qs[_0x0e33('0x36')](_0x22a453[_0x0e33('0x32')][_0x0e33('0x36')]));_0x462ef2['attributes']=_0x462ef2[_0x0e33('0x35')][_0x0e33('0x37')]?_0x462ef2[_0x0e33('0x35')]:_0xaf1336[_0x0e33('0x2f')];_0x462ef2[_0x0e33('0x59')]=qs[_0x0e33('0x3a')](_0x22a453[_0x0e33('0x32')][_0x0e33('0x3a')]);_0x462ef2['where']=qs[_0x0e33('0x33')](_[_0x0e33('0x3b')](_0x22a453[_0x0e33('0x32')],_0xaf1336['filters']));if(_0x22a453[_0x0e33('0x32')][_0x0e33('0x3c')]){_0x462ef2[_0x0e33('0x3d')]=_[_0x0e33('0x3e')](_0x462ef2[_0x0e33('0x3d')],{'$or':_[_0x0e33('0x30')](_0x462ef2[_0x0e33('0x35')],function(_0x1eba76){var _0x8281d5={};_0x8281d5[_0x1eba76]={'$like':'%'+_0x22a453[_0x0e33('0x32')][_0x0e33('0x3c')]+'%'};return _0x8281d5;})});}_0x462ef2=_['merge']({},_0x462ef2,_0x22a453['options']);return _0x11155a['getBlackLists'](_0x462ef2);}})[_0x0e33('0x25')](function(_0x4b72ae){if(_0x4b72ae){_0xbc4cb0=_0x4b72ae['length'];if(!_0x22a453['query'][_0x0e33('0x38')](_0x0e33('0x39'))){_0x462ef2['limit']=qs[_0x0e33('0x1e')](_0x22a453[_0x0e33('0x32')][_0x0e33('0x1e')]);_0x462ef2['offset']=qs['offset'](_0x22a453[_0x0e33('0x32')]['offset']);}return _0x11155a[_0x0e33('0x8d')](_0x462ef2);}})['then'](function(_0x3d5048){if(_0x3d5048){return _0x3d5048?{'count':_0xbc4cb0,'rows':_0x3d5048}:null;}})[_0x0e33('0x25')](respondWithResult(_0x513fe8,null))[_0x0e33('0x43')](handleError(_0x513fe8,null));};exports['addBlackLists']=function(_0x41d36d,_0x166245,_0x12b871){var _0x4b8dcf,_0x250d16;var _0x3c32bb=[];var _0x1345e7=moment()[_0x0e33('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x0e33('0x41')][_0x0e33('0x47')]({'where':{'id':_0x41d36d['params']['id']}})['then'](handleEntityNotFound(_0x166245,null))[_0x0e33('0x25')](function(_0x1c698a){if(_0x1c698a){_0x250d16=_0x1c698a;return _0x1c698a[_0x0e33('0x8e')](_0x41d36d[_0x0e33('0x52')][_0x0e33('0x67')],_[_0x0e33('0x8f')](_0x41d36d[_0x0e33('0x52')],[_0x0e33('0x67'),'id'])||{});}return null;})['spread'](function(_0x4cee1e){var _0x5c9003;var _0xb94fe5;_0x4b8dcf=_0x4cee1e||[];var _0x547933=[];if(_0x4cee1e){for(var _0x1bad02=0x0;_0x1bad02<_0x4cee1e['length'];_0x1bad02+=0x1){var _0x1f992e=_0x4cee1e[_0x1bad02]['get']({'plain':!![]});_0x5c9003=squel[_0x0e33('0x6b')]()[_0x0e33('0x6c')](_0x0e33('0x90'))['fromQuery']([_0x0e33('0x6e'),'ContactId',_0x0e33('0x71'),'CampaignId',_0x0e33('0x53'),_0x0e33('0x51')],squel[_0x0e33('0x72')]()[_0x0e33('0x74')](_0x0e33('0x6e'),'phone')['field']('id',_0x0e33('0x70'))[_0x0e33('0x74')](_0x1f992e['CmListId']['toString'](),'ListId')[_0x0e33('0x74')](_0x41d36d['params']['id']['toString'](),_0x0e33('0x5a'))[_0x0e33('0x74')](_0x0e33('0x73'),_0x0e33('0x53'))[_0x0e33('0x74')](_0x0e33('0x73'),_0x0e33('0x51'))['from'](_0x0e33('0x80'))[_0x0e33('0x3d')](_0x0e33('0x81'))[_0x0e33('0x3d')](_0x0e33('0x78'),_0x1f992e['CmListId'][_0x0e33('0x76')]())[_0x0e33('0x3d')](_0x0e33('0x79')))[_0x0e33('0x76')]();_0x547933[_0x0e33('0x8a')](db['sequelize'][_0x0e33('0x32')](_0x5c9003));}return BPromise['all'](_0x547933);}})[_0x0e33('0x25')](function(){return _0x4b8dcf;})[_0x0e33('0x25')](respondWithResult(_0x166245,null))[_0x0e33('0x43')](handleError(_0x166245,null));};exports[_0x0e33('0x91')]=function(_0x1c4901,_0x4a9056,_0x552758){return db[_0x0e33('0x41')][_0x0e33('0x47')]({'where':{'id':_0x1c4901[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](handleEntityNotFound(_0x4a9056,null))['then'](function(_0x2a6433){if(_0x2a6433){return _0x2a6433[_0x0e33('0x91')](_0x1c4901[_0x0e33('0x32')][_0x0e33('0x67')]);}})[_0x0e33('0x25')](function(_0x1187f8){if(_0x1187f8){return db[_0x0e33('0x61')][_0x0e33('0x29')]({'where':{'ListId':_0x1c4901[_0x0e33('0x32')][_0x0e33('0x67')],'CampaignId':_0x1c4901[_0x0e33('0x45')]['id']}})[_0x0e33('0x25')](function(){return _0x1187f8;});}})['then'](respondWithStatusCode(_0x4a9056,null))['catch'](handleError(_0x4a9056,null));}; \ No newline at end of file +var _0xaa1b=['ejs','lodash','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','userProfileId','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','createdAt','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv'];(function(_0x3cd5b5,_0x2191f1){var _0x2010fb=function(_0x202fae){while(--_0x202fae){_0x3cd5b5['push'](_0x3cd5b5['shift']());}};_0x2010fb(++_0x2191f1);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xbaa1('0x0'));var rimraf=require(_0xbaa1('0x1'));var zipdir=require(_0xbaa1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbaa1('0x3'));var moment=require('moment');var BPromise=require(_0xbaa1('0x4'));var Mustache=require(_0xbaa1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbaa1('0x6'));var ejs=require(_0xbaa1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaa1('0x8'));var squel=require('squel');var crypto=require(_0xbaa1('0x9'));var jsforce=require(_0xbaa1('0xa'));var deskjs=require(_0xbaa1('0xb'));var toCsv=require(_0xbaa1('0x6'));var querystring=require(_0xbaa1('0xc'));var Papa=require(_0xbaa1('0xd'));var Redis=require('ioredis');var authService=require(_0xbaa1('0xe'));var qs=require(_0xbaa1('0xf'));var as=require(_0xbaa1('0x10'));var hardwareService=require(_0xbaa1('0x11'));var logger=require(_0xbaa1('0x12'))(_0xbaa1('0x13'));var utils=require(_0xbaa1('0x14'));var config=require(_0xbaa1('0x15'));var licenseUtil=require(_0xbaa1('0x16'));var db=require(_0xbaa1('0x17'))['db'];function respondWithStatusCode(_0x8ce72d,_0x1376c6){_0x1376c6=_0x1376c6||0xcc;return function(_0x5064a4){if(_0x5064a4){return _0x8ce72d['sendStatus'](_0x1376c6);}return _0x8ce72d['status'](_0x1376c6)['end']();};}function respondWithResult(_0x2184ab,_0x388cfd){_0x388cfd=_0x388cfd||0xc8;return function(_0x3bfbcc){if(_0x3bfbcc){return _0x2184ab[_0xbaa1('0x18')](_0x388cfd)[_0xbaa1('0x19')](_0x3bfbcc);}};}function respondWithFilteredResult(_0x2e7db5,_0x30f191){return function(_0xdbaa8b){if(_0xdbaa8b){var _0x35a3fd=typeof _0x30f191[_0xbaa1('0x1a')]===_0xbaa1('0x1b')&&typeof _0x30f191[_0xbaa1('0x1c')]===_0xbaa1('0x1b');var _0x16725c=_0xdbaa8b[_0xbaa1('0x1d')];var _0x155a16=_0x35a3fd?0x0:_0x30f191[_0xbaa1('0x1a')];var _0x200f01=_0x35a3fd?_0xdbaa8b[_0xbaa1('0x1d')]:_0x30f191['offset']+_0x30f191[_0xbaa1('0x1c')];var _0x3e3f4a;if(_0x200f01>=_0x16725c){_0x200f01=_0x16725c;_0x3e3f4a=0xc8;}else{_0x3e3f4a=0xce;}_0x2e7db5[_0xbaa1('0x18')](_0x3e3f4a);return _0x2e7db5[_0xbaa1('0x1e')](_0xbaa1('0x1f'),_0x155a16+'-'+_0x200f01+'/'+_0x16725c)[_0xbaa1('0x19')](_0xdbaa8b);}return null;};}function patchUpdates(_0x5c2115){return function(_0x1c587c){try{jsonpatch[_0xbaa1('0x20')](_0x1c587c,_0x5c2115,!![]);}catch(_0x1c38f3){return BPromise[_0xbaa1('0x21')](_0x1c38f3);}return _0x1c587c[_0xbaa1('0x22')]();};}function saveUpdates(_0x5a7d21,_0x4e4a0c){return function(_0x2b01ec){if(_0x2b01ec){return _0x2b01ec[_0xbaa1('0x23')](_0x5a7d21)[_0xbaa1('0x24')](function(_0x34946c){return _0x34946c;});}return null;};}function removeEntity(_0x117079,_0x113bbd){return function(_0x4806e7){if(_0x4806e7){return _0x4806e7[_0xbaa1('0x25')]()[_0xbaa1('0x24')](function(){var _0x28e508=_0x4806e7[_0xbaa1('0x26')]({'plain':!![]});var _0x1204f4=_0xbaa1('0x27');return db[_0xbaa1('0x28')][_0xbaa1('0x25')]({'where':{'type':_0x1204f4,'resourceId':_0x28e508['id']}})[_0xbaa1('0x24')](function(){return _0x4806e7;});})['then'](function(){_0x117079[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x29')]();});}};}function handleEntityNotFound(_0xd2cae3,_0x2913ae){return function(_0x109187){if(!_0x109187){_0xd2cae3[_0xbaa1('0x2a')](0x194);}return _0x109187;};}function handleError(_0x594578,_0x49803c){_0x49803c=_0x49803c||0x1f4;return function(_0x18b6d6){logger[_0xbaa1('0x2b')](_0x18b6d6[_0xbaa1('0x2c')]);if(_0x18b6d6['name']){delete _0x18b6d6[_0xbaa1('0x2d')];}_0x594578[_0xbaa1('0x18')](_0x49803c)['send'](_0x18b6d6);};}exports[_0xbaa1('0x2e')]=function(_0x57a4b4,_0x158437){var _0x3670bd={},_0x344ace={},_0x53fead={'count':0x0,'rows':[]};var _0x594250=_[_0xbaa1('0x2f')](db[_0xbaa1('0x30')][_0xbaa1('0x31')],function(_0x1a98f9){return{'name':_0x1a98f9[_0xbaa1('0x32')],'type':_0x1a98f9[_0xbaa1('0x33')]['key']};});_0x344ace[_0xbaa1('0x34')]=_[_0xbaa1('0x2f')](_0x594250,_0xbaa1('0x2d'));_0x344ace[_0xbaa1('0x35')]=_['keys'](_0x57a4b4[_0xbaa1('0x35')]);_0x344ace['filters']=_[_0xbaa1('0x36')](_0x344ace[_0xbaa1('0x34')],_0x344ace[_0xbaa1('0x35')]);_0x3670bd[_0xbaa1('0x37')]=_['intersection'](_0x344ace[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x57a4b4[_0xbaa1('0x35')]['fields']));_0x3670bd[_0xbaa1('0x37')]=_0x3670bd[_0xbaa1('0x37')]['length']?_0x3670bd[_0xbaa1('0x37')]:_0x344ace[_0xbaa1('0x34')];if(!_0x57a4b4[_0xbaa1('0x35')]['hasOwnProperty'](_0xbaa1('0x39'))){_0x3670bd['limit']=qs['limit'](_0x57a4b4[_0xbaa1('0x35')]['limit']);_0x3670bd[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x57a4b4[_0xbaa1('0x35')]['offset']);}_0x3670bd[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x57a4b4['query'][_0xbaa1('0x3b')]);_0x3670bd[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0x57a4b4[_0xbaa1('0x35')],_0x344ace[_0xbaa1('0x3d')]),_0x594250);if(_0x57a4b4[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x3670bd['where']=_[_0xbaa1('0x40')](_0x3670bd['where'],{'$or':_[_0xbaa1('0x2f')](_0x594250,function(_0x3ba6bf){if(_0x3ba6bf[_0xbaa1('0x33')]!=='VIRTUAL'){var _0x1b2333={};_0x1b2333[_0x3ba6bf['name']]={'$like':'%'+_0x57a4b4['query'][_0xbaa1('0x3f')]+'%'};return _0x1b2333;}})});}_0x3670bd=_[_0xbaa1('0x40')]({},_0x3670bd,_0x57a4b4[_0xbaa1('0x41')]);var _0x5efda0={'where':_0x3670bd['where']};return db[_0xbaa1('0x30')][_0xbaa1('0x1d')](_0x5efda0)[_0xbaa1('0x24')](function(_0x2443e3){_0x53fead[_0xbaa1('0x1d')]=_0x2443e3;if(_0x57a4b4[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x3670bd[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x30')][_0xbaa1('0x44')](_0x3670bd);})[_0xbaa1('0x24')](function(_0xc59188){_0x53fead[_0xbaa1('0x45')]=_0xc59188;return _0x53fead;})[_0xbaa1('0x24')](respondWithFilteredResult(_0x158437,_0x3670bd))['catch'](handleError(_0x158437,null));};exports['show']=function(_0x18c4e1,_0x6cc5ad){var _0x153cab={'raw':![],'where':{'id':_0x18c4e1[_0xbaa1('0x46')]['id']}},_0xfe2c06={};_0xfe2c06[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x30')]['rawAttributes']);_0xfe2c06[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x18c4e1[_0xbaa1('0x35')]);_0xfe2c06[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0xfe2c06[_0xbaa1('0x34')],_0xfe2c06['query']);_0x153cab['attributes']=_[_0xbaa1('0x36')](_0xfe2c06['model'],qs[_0xbaa1('0x38')](_0x18c4e1[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x153cab['attributes']=_0x153cab[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x153cab[_0xbaa1('0x37')]:_0xfe2c06[_0xbaa1('0x34')];if(_0x18c4e1[_0xbaa1('0x35')]['includeAll']){_0x153cab['include']=[{'all':!![]}];}_0x153cab=_[_0xbaa1('0x40')]({},_0x153cab,_0x18c4e1[_0xbaa1('0x41')]);return db[_0xbaa1('0x30')][_0xbaa1('0x49')](_0x153cab)[_0xbaa1('0x24')](handleEntityNotFound(_0x6cc5ad,null))[_0xbaa1('0x24')](respondWithResult(_0x6cc5ad,null))[_0xbaa1('0x4a')](handleError(_0x6cc5ad,null));};exports[_0xbaa1('0x4b')]=function(_0xa4dd12,_0x19c7f5){return db[_0xbaa1('0x30')]['create'](_0xa4dd12[_0xbaa1('0x4c')],{})[_0xbaa1('0x24')](function(_0x2e2f16){var _0x216336=_0xa4dd12[_0xbaa1('0x4d')][_0xbaa1('0x26')]({'plain':!![]});if(!_0x216336)throw new Error(_0xbaa1('0x4e'));if(_0x216336['role']===_0xbaa1('0x4d')){var _0x378bfa=_0x2e2f16['get']({'plain':!![]});var _0x18e207=_0xbaa1('0x27');return db[_0xbaa1('0x4f')][_0xbaa1('0x49')]({'where':{'name':_0x18e207,'userProfileId':_0x216336['userProfileId']},'raw':!![]})[_0xbaa1('0x24')](function(_0x4d70f1){if(_0x4d70f1&&_0x4d70f1[_0xbaa1('0x50')]===0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x4b')]({'name':_0x378bfa[_0xbaa1('0x2d')],'resourceId':_0x378bfa['id'],'type':_0x4d70f1['name'],'sectionId':_0x4d70f1['id']},{})[_0xbaa1('0x24')](function(){return _0x2e2f16;});}else{return _0x2e2f16;}})[_0xbaa1('0x4a')](function(_0x176ce2){logger[_0xbaa1('0x2b')](_0xbaa1('0x51'),_0x176ce2);throw _0x176ce2;});}return _0x2e2f16;})[_0xbaa1('0x24')](respondWithResult(_0x19c7f5,0xc9))[_0xbaa1('0x4a')](handleError(_0x19c7f5,null));};exports[_0xbaa1('0x52')]=function(_0x5018e2,_0x39fb53){var _0x39e35c={'where':{'id':_0x5018e2[_0xbaa1('0x46')]['id']}},_0x348eb6={};_0x348eb6[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x30')]['rawAttributes']);_0x39e35c['attributes']=_[_0xbaa1('0x36')](_0x348eb6[_0xbaa1('0x34')],qs['fields'](_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x39e35c[_0xbaa1('0x37')]=_0x39e35c['attributes'][_0xbaa1('0x48')]?_0x39e35c[_0xbaa1('0x37')]:_0x348eb6[_0xbaa1('0x34')];if(_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x39e35c[_0xbaa1('0x43')]=[{'all':!![]}];}_0x39e35c=_['merge']({},_0x39e35c,_0x5018e2[_0xbaa1('0x41')]);return db[_0xbaa1('0x30')]['find'](_0x39e35c)['then'](handleEntityNotFound(_0x39fb53,null))[_0xbaa1('0x24')](function(_0x4973d4){if(_0x4973d4){var _0x2bb374=_0x4973d4[_0xbaa1('0x26')]({'plain':!![]});_0x2bb374=qs[_0xbaa1('0x53')](_0x2bb374,['id','createdAt',_0xbaa1('0x54')]);_0x5018e2[_0xbaa1('0x4c')]=_[_0xbaa1('0x53')](_0x5018e2[_0xbaa1('0x4c')],['id','createdAt',_0xbaa1('0x54')]);return db[_0xbaa1('0x30')][_0xbaa1('0x4b')](_[_0xbaa1('0x40')](_0x2bb374,_0x5018e2[_0xbaa1('0x4c')]),{'include':_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x42')]?[{'all':!![]}]:undefined})[_0xbaa1('0x24')](function(_0x2200e0){var _0xf33b78=_0x5018e2[_0xbaa1('0x4d')][_0xbaa1('0x26')]({'plain':!![]});if(!_0xf33b78)throw new Error(_0xbaa1('0x4e'));if(_0xf33b78['role']===_0xbaa1('0x4d')){var _0x1aa65a=_0x2200e0[_0xbaa1('0x26')]({'plain':!![]});var _0x5a1cb4=_0xbaa1('0x27');return db[_0xbaa1('0x4f')][_0xbaa1('0x49')]({'where':{'name':_0x5a1cb4,'userProfileId':_0xf33b78[_0xbaa1('0x55')]},'raw':!![]})[_0xbaa1('0x24')](function(_0x3fb861){if(_0x3fb861&&_0x3fb861[_0xbaa1('0x50')]===0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x4b')]({'name':_0x1aa65a[_0xbaa1('0x2d')],'resourceId':_0x1aa65a['id'],'type':_0x3fb861[_0xbaa1('0x2d')],'sectionId':_0x3fb861['id']},{})[_0xbaa1('0x24')](function(){return _0x2200e0;});}else{return _0x2200e0;}})[_0xbaa1('0x4a')](function(_0x5c369a){logger['error'](_0xbaa1('0x51'),_0x5c369a);throw _0x5c369a;});}return _0x2200e0;});}})[_0xbaa1('0x24')](respondWithResult(_0x39fb53,0xc9))[_0xbaa1('0x4a')](handleError(_0x39fb53,null));};exports[_0xbaa1('0x23')]=function(_0x296d32,_0x15fd0c){if(_0x296d32['body']['id']){delete _0x296d32[_0xbaa1('0x4c')]['id'];}return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x296d32['params']['id']}})['then'](handleEntityNotFound(_0x15fd0c,null))[_0xbaa1('0x24')](saveUpdates(_0x296d32['body'],null))[_0xbaa1('0x24')](respondWithResult(_0x15fd0c,null))['catch'](handleError(_0x15fd0c,null));};exports[_0xbaa1('0x25')]=function(_0x15c1df,_0x2ac192){return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x15c1df[_0xbaa1('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ac192,null))[_0xbaa1('0x24')](removeEntity(_0x2ac192,null))[_0xbaa1('0x4a')](handleError(_0x2ac192,null));};exports[_0xbaa1('0x56')]=function(_0x3ec6a5,_0xd6b380,_0x134906){var _0x4a7f3a={'raw':!![],'where':{}};var _0x43eb9c={};var _0x5c1e78={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x3ec6a5['params']['id']}})['then'](handleEntityNotFound(_0xd6b380,null))[_0xbaa1('0x24')](function(_0x21ac88){if(_0x21ac88){_0x43eb9c['model']=_[_0xbaa1('0x47')](db['CmHopper']['rawAttributes']);_0x43eb9c[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x3ec6a5[_0xbaa1('0x35')]);_0x43eb9c[_0xbaa1('0x3d')]=_['intersection'](_0x43eb9c['model'],_0x43eb9c[_0xbaa1('0x35')]);_0x4a7f3a['attributes']=_[_0xbaa1('0x36')](_0x43eb9c[_0xbaa1('0x34')],qs['fields'](_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x4a7f3a[_0xbaa1('0x37')]=_0x4a7f3a[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x4a7f3a['attributes']:_0x43eb9c[_0xbaa1('0x34')];if(!_0x3ec6a5['query'][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x4a7f3a[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0x3ec6a5['query'][_0xbaa1('0x1c')]);_0x4a7f3a[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x3ec6a5['query'][_0xbaa1('0x1a')]);}_0x4a7f3a[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x4a7f3a['where']=qs['filters'](_[_0xbaa1('0x3e')](_0x3ec6a5[_0xbaa1('0x35')],_0x43eb9c['filters']));_0x4a7f3a[_0xbaa1('0x3c')][_0xbaa1('0x59')]=_0x21ac88['id'];if(_0x3ec6a5['query']['filter']){_0x4a7f3a[_0xbaa1('0x3c')]=_[_0xbaa1('0x40')](_0x4a7f3a['where'],{'$or':_[_0xbaa1('0x2f')](_0x4a7f3a[_0xbaa1('0x37')],function(_0x49cceb){var _0x485a07={};_0x485a07[_0x49cceb]={'$like':'%'+_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x485a07;})});}_0x4a7f3a=_[_0xbaa1('0x40')]({},_0x4a7f3a,_0x3ec6a5[_0xbaa1('0x41')]);return db[_0xbaa1('0x5a')][_0xbaa1('0x1d')]({'where':_0x4a7f3a['where']})['then'](function(_0x5f3161){_0x5c1e78[_0xbaa1('0x1d')]=_0x5f3161;if(_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x4a7f3a[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5a')]['findAll'](_0x4a7f3a);})[_0xbaa1('0x24')](function(_0x292087){_0x5c1e78[_0xbaa1('0x45')]=_0x292087;return _0x5c1e78;});}})[_0xbaa1('0x24')](respondWithFilteredResult(_0xd6b380,_0x4a7f3a))[_0xbaa1('0x4a')](handleError(_0xd6b380,null));};exports[_0xbaa1('0x5b')]=function(_0x18ffe9,_0x11606e,_0x55e7a4){var _0x2305ee={'raw':!![],'where':{}};var _0x20cca4={};var _0x4ec9bd={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x18ffe9[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x11606e,null))[_0xbaa1('0x24')](function(_0x17f088){if(_0x17f088){_0x20cca4[_0xbaa1('0x34')]=_['keys'](db[_0xbaa1('0x5c')][_0xbaa1('0x31')]);_0x20cca4[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x18ffe9[_0xbaa1('0x35')]);_0x20cca4['filters']=_[_0xbaa1('0x36')](_0x20cca4[_0xbaa1('0x34')],_0x20cca4[_0xbaa1('0x35')]);_0x2305ee['attributes']=_['intersection'](_0x20cca4['model'],qs['fields'](_0x18ffe9[_0xbaa1('0x35')]['fields']));_0x2305ee[_0xbaa1('0x37')]=_0x2305ee[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x2305ee[_0xbaa1('0x37')]:_0x20cca4[_0xbaa1('0x34')];if(!_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x2305ee[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0x18ffe9[_0xbaa1('0x35')]['limit']);_0x2305ee[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x18ffe9[_0xbaa1('0x35')]['offset']);}_0x2305ee[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x18ffe9['query'][_0xbaa1('0x3b')]);_0x2305ee[_0xbaa1('0x3c')]=qs['filters'](_[_0xbaa1('0x3e')](_0x18ffe9[_0xbaa1('0x35')],_0x20cca4[_0xbaa1('0x3d')]));_0x2305ee[_0xbaa1('0x3c')]['CampaignId']=_0x17f088['id'];if(_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x2305ee['where']=_['merge'](_0x2305ee[_0xbaa1('0x3c')],{'$or':_[_0xbaa1('0x2f')](_0x2305ee['attributes'],function(_0x49b4a2){var _0x4b07cc={};_0x4b07cc[_0x49b4a2]={'$like':'%'+_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x4b07cc;})});}_0x2305ee=_[_0xbaa1('0x40')]({},_0x2305ee,_0x18ffe9['options']);return db['CmHopperHistory']['count']({'where':_0x2305ee[_0xbaa1('0x3c')]})[_0xbaa1('0x24')](function(_0x4a6ee2){_0x4ec9bd['count']=_0x4a6ee2;if(_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x2305ee[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5c')][_0xbaa1('0x44')](_0x2305ee);})['then'](function(_0x2619cd){_0x4ec9bd[_0xbaa1('0x45')]=_0x2619cd;return _0x4ec9bd;});}})['then'](respondWithFilteredResult(_0x11606e,_0x2305ee))[_0xbaa1('0x4a')](handleError(_0x11606e,null));};exports[_0xbaa1('0x5d')]=function(_0xa014c9,_0xaf96f3,_0x41f58a){var _0x50b7a8={'raw':!![],'where':{}};var _0x156a8c={};var _0x3cc3a9={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0xa014c9['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0xaf96f3,null))[_0xbaa1('0x24')](function(_0x357bdf){if(_0x357bdf){_0x156a8c[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x5e')][_0xbaa1('0x31')]);_0x156a8c[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0xa014c9[_0xbaa1('0x35')]);_0x156a8c[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x156a8c['model'],_0x156a8c[_0xbaa1('0x35')]);_0x50b7a8[_0xbaa1('0x37')]=_[_0xbaa1('0x36')](_0x156a8c[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0xa014c9['query'][_0xbaa1('0x38')]));_0x50b7a8[_0xbaa1('0x37')]=_0x50b7a8[_0xbaa1('0x37')]['length']?_0x50b7a8[_0xbaa1('0x37')]:_0x156a8c[_0xbaa1('0x34')];if(!_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x50b7a8['limit']=qs[_0xbaa1('0x1c')](_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x1c')]);_0x50b7a8['offset']=qs['offset'](_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x1a')]);}_0x50b7a8[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0xa014c9['query']['sort']);_0x50b7a8[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0xa014c9['query'],_0x156a8c[_0xbaa1('0x3d')]));_0x50b7a8['where'][_0xbaa1('0x59')]=_0x357bdf['id'];if(_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x50b7a8['where']=_[_0xbaa1('0x40')](_0x50b7a8[_0xbaa1('0x3c')],{'$or':_[_0xbaa1('0x2f')](_0x50b7a8['attributes'],function(_0x3abcd0){var _0x48aaae={};_0x48aaae[_0x3abcd0]={'$like':'%'+_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x48aaae;})});}_0x50b7a8=_[_0xbaa1('0x40')]({},_0x50b7a8,_0xa014c9['options']);return db[_0xbaa1('0x5e')]['count']({'where':_0x50b7a8[_0xbaa1('0x3c')]})[_0xbaa1('0x24')](function(_0x57e18b){_0x3cc3a9[_0xbaa1('0x1d')]=_0x57e18b;if(_0xa014c9['query'][_0xbaa1('0x42')]){_0x50b7a8[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5e')][_0xbaa1('0x44')](_0x50b7a8);})[_0xbaa1('0x24')](function(_0x18e56f){_0x3cc3a9[_0xbaa1('0x45')]=_0x18e56f;return _0x3cc3a9;});}})['then'](respondWithFilteredResult(_0xaf96f3,_0x50b7a8))[_0xbaa1('0x4a')](handleError(_0xaf96f3,null));};exports['getHopperBlacks']=function(_0xe6445a,_0x5c65bb,_0x339ff5){var _0x203ab6={'raw':!![],'where':{}};var _0x3666c5={};var _0x24ccf5={'count':0x0,'rows':[]};return db['Campaign'][_0xbaa1('0x57')]({'where':{'id':_0xe6445a['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x5c65bb,null))[_0xbaa1('0x24')](function(_0x4860d8){if(_0x4860d8){_0x3666c5[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x5f')]['rawAttributes']);_0x3666c5[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0xe6445a[_0xbaa1('0x35')]);_0x3666c5[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x3666c5[_0xbaa1('0x34')],_0x3666c5[_0xbaa1('0x35')]);_0x203ab6[_0xbaa1('0x37')]=_['intersection'](_0x3666c5[_0xbaa1('0x34')],qs['fields'](_0xe6445a[_0xbaa1('0x35')]['fields']));_0x203ab6[_0xbaa1('0x37')]=_0x203ab6[_0xbaa1('0x37')]['length']?_0x203ab6['attributes']:_0x3666c5[_0xbaa1('0x34')];if(!_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x58')]('nolimit')){_0x203ab6[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x1c')]);_0x203ab6['offset']=qs[_0xbaa1('0x1a')](_0xe6445a['query'][_0xbaa1('0x1a')]);}_0x203ab6[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x203ab6['where']=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0xe6445a[_0xbaa1('0x35')],_0x3666c5[_0xbaa1('0x3d')]));_0x203ab6[_0xbaa1('0x3c')][_0xbaa1('0x59')]=_0x4860d8['id'];if(_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x203ab6[_0xbaa1('0x3c')]=_['merge'](_0x203ab6['where'],{'$or':_['map'](_0x203ab6['attributes'],function(_0x56936c){var _0x33f339={};_0x33f339[_0x56936c]={'$like':'%'+_0xe6445a['query'][_0xbaa1('0x3f')]+'%'};return _0x33f339;})});}_0x203ab6=_['merge']({},_0x203ab6,_0xe6445a['options']);return db[_0xbaa1('0x5f')][_0xbaa1('0x1d')]({'where':_0x203ab6['where']})[_0xbaa1('0x24')](function(_0x1ba530){_0x24ccf5['count']=_0x1ba530;if(_0xe6445a['query'][_0xbaa1('0x42')]){_0x203ab6[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5f')][_0xbaa1('0x44')](_0x203ab6);})['then'](function(_0x206778){_0x24ccf5['rows']=_0x206778;return _0x24ccf5;});}})[_0xbaa1('0x24')](respondWithFilteredResult(_0x5c65bb,_0x203ab6))[_0xbaa1('0x4a')](handleError(_0x5c65bb,null));};exports[_0xbaa1('0x60')]=function(_0x428e16,_0x16f671,_0x5022ce){var _0x35b84a={};var _0x5a9926={};var _0x4bd005;var _0x4e6ae2;return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x428e16[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x16f671,null))['then'](function(_0x36b752){if(_0x36b752){_0x4bd005=_0x36b752;_0x5a9926[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x61')][_0xbaa1('0x31')]);_0x5a9926[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x428e16[_0xbaa1('0x35')]);_0x5a9926[_0xbaa1('0x3d')]=_['intersection'](_0x5a9926[_0xbaa1('0x34')],_0x5a9926['query']);_0x35b84a['attributes']=_['intersection'](_0x5a9926[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x428e16[_0xbaa1('0x35')]['fields']));_0x35b84a[_0xbaa1('0x37')]=_0x35b84a[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x35b84a[_0xbaa1('0x37')]:_0x5a9926['model'];_0x35b84a[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x35b84a['where']=qs['filters'](_[_0xbaa1('0x3e')](_0x428e16['query'],_0x5a9926[_0xbaa1('0x3d')]));if(_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x35b84a[_0xbaa1('0x3c')]=_[_0xbaa1('0x40')](_0x35b84a[_0xbaa1('0x3c')],{'$or':_['map'](_0x35b84a[_0xbaa1('0x37')],function(_0x66e731){var _0x59cfb5={};_0x59cfb5[_0x66e731]={'$like':'%'+_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x59cfb5;})});}_0x35b84a=_[_0xbaa1('0x40')]({},_0x35b84a,_0x428e16[_0xbaa1('0x41')]);return _0x4bd005[_0xbaa1('0x60')](_0x35b84a);}})[_0xbaa1('0x24')](function(_0x24bf78){if(_0x24bf78){_0x4e6ae2=_0x24bf78[_0xbaa1('0x48')];if(!_0x428e16[_0xbaa1('0x35')]['hasOwnProperty']('nolimit')){_0x35b84a['limit']=qs[_0xbaa1('0x1c')](_0x428e16[_0xbaa1('0x35')]['limit']);_0x35b84a[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x428e16[_0xbaa1('0x35')]['offset']);}return _0x4bd005['getLists'](_0x35b84a);}})[_0xbaa1('0x24')](function(_0x35841d){if(_0x35841d){return _0x35841d?{'count':_0x4e6ae2,'rows':_0x35841d}:null;}})[_0xbaa1('0x24')](respondWithResult(_0x16f671,null))['catch'](handleError(_0x16f671,null));};exports[_0xbaa1('0x62')]=function(_0x5de9e0,_0x14a1c5,_0x3a8c41){var _0x3d0925,_0xd5599d;var _0x4b97a6=[];var _0xed03fd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xbaa1('0x49')]({'where':{'id':_0x5de9e0[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x14a1c5,null))[_0xbaa1('0x24')](function(_0x371c8d){if(_0x371c8d){_0xd5599d=_0x371c8d;return _0x371c8d[_0xbaa1('0x62')](_0x5de9e0[_0xbaa1('0x4c')]['ids'],_[_0xbaa1('0x53')](_0x5de9e0[_0xbaa1('0x4c')],['ids','id'])||{});}return null;})[_0xbaa1('0x63')](function(_0x130bc9){var _0x5ef444;var _0x3dc1a1;_0x3d0925=_0x130bc9||[];var _0x1d09fc=[];if(_0x130bc9){for(var _0x11d510=0x0;_0x11d510<_0x130bc9[_0xbaa1('0x48')];_0x11d510+=0x1){var _0x4ab5ed=_0x130bc9[_0x11d510][_0xbaa1('0x26')]({'plain':!![]});_0xd5599d[_0xbaa1('0x64')]=_0x5de9e0[_0xbaa1('0x4c')]['dialCheckDuplicateType']?_0x5de9e0[_0xbaa1('0x4c')]['dialCheckDuplicateType']:_0xd5599d[_0xbaa1('0x64')];switch(_0xd5599d[_0xbaa1('0x64')]){case _0xbaa1('0x65'):_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')]('cm_hopper')[_0xbaa1('0x68')]([_0xbaa1('0x69'),_0xbaa1('0x6a'),_0xbaa1('0x6b'),_0xbaa1('0x6c'),_0xbaa1('0x59'),'createdAt',_0xbaa1('0x54')],squel['select']()[_0xbaa1('0x6d')](_0xbaa1('0x69'),'phone')[_0xbaa1('0x6d')]('NOW()',_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))[_0xbaa1('0x6d')](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','createdAt')['field']('\x27'+_0xed03fd+'\x27',_0xbaa1('0x54'))[_0xbaa1('0x70')](_0xbaa1('0x71'))[_0xbaa1('0x3c')](_0xbaa1('0x72'))['where'](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())['where'](_0xbaa1('0x74'))[_0xbaa1('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xbaa1('0x6d')](_0xbaa1('0x75'))['from']('cm_hopper_final')[_0xbaa1('0x3c')](_0xbaa1('0x76'),_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]()))[_0xbaa1('0x3c')](_0xbaa1('0x77'),squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x79'))[_0xbaa1('0x70')](_0xbaa1('0x7a'))[_0xbaa1('0x3c')]('CampaignId\x20=\x20?',_0x5de9e0['params']['id'][_0xbaa1('0x6f')]())))[_0xbaa1('0x6f')]();break;case _0xbaa1('0x7b'):_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7a'))['fromQuery']([_0xbaa1('0x69'),_0xbaa1('0x6a'),_0xbaa1('0x6b'),'ListId',_0xbaa1('0x59'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()['field']('phone',_0xbaa1('0x69'))[_0xbaa1('0x6d')](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))[_0xbaa1('0x6d')](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),_0xbaa1('0x59'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','updatedAt')['from'](_0xbaa1('0x71'))[_0xbaa1('0x3c')](_0xbaa1('0x72'))['where'](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())['where'](_0xbaa1('0x74'))[_0xbaa1('0x3c')](_0xbaa1('0x77'),squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x79'))[_0xbaa1('0x70')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]())))['toString']();break;default:_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7a'))['fromQuery']([_0xbaa1('0x69'),_0xbaa1('0x6a'),'ContactId',_0xbaa1('0x6c'),_0xbaa1('0x59'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()['field'](_0xbaa1('0x69'),_0xbaa1('0x69'))['field'](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))['field'](_0x4ab5ed['CmListId']['toString'](),_0xbaa1('0x6c'))['field'](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','updatedAt')[_0xbaa1('0x70')](_0xbaa1('0x71'))['where'](_0xbaa1('0x72'))[_0xbaa1('0x3c')](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x74')))['toString']();}_0x3dc1a1=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7e'))[_0xbaa1('0x68')]([_0xbaa1('0x7f'),_0xbaa1('0x6a'),_0xbaa1('0x69'),_0xbaa1('0x80'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x81'),'id')['field'](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')](_0xbaa1('0x82'),_0xbaa1('0x69'))[_0xbaa1('0x6d')](_0xbaa1('0x83'),_0xbaa1('0x80'))['field']('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x54'))[_0xbaa1('0x70')](_0xbaa1('0x84'),'ci')[_0xbaa1('0x85')]('cm_hopper','h',_0xbaa1('0x86'))[_0xbaa1('0x3c')](_0xbaa1('0x87'),_0x4ab5ed[_0xbaa1('0x6e')]['toString']())['where'](_0xbaa1('0x88'),_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x89'),_0xed03fd))[_0xbaa1('0x6f')]();_0x1d09fc[_0xbaa1('0x8a')](db[_0xbaa1('0x8b')][_0xbaa1('0x35')](_0x5ef444));_0x4b97a6['push'](db['sequelize'][_0xbaa1('0x35')](_0x3dc1a1));}return BPromise[_0xbaa1('0x8c')](_0x1d09fc);}})[_0xbaa1('0x24')](function(){return BPromise[_0xbaa1('0x8c')](_0x4b97a6);})[_0xbaa1('0x24')](function(){return _0x3d0925;})[_0xbaa1('0x24')](respondWithResult(_0x14a1c5,null))[_0xbaa1('0x4a')](handleError(_0x14a1c5,null));};exports[_0xbaa1('0x8d')]=function(_0x2f2f07,_0x809f12,_0x883f59){return db[_0xbaa1('0x30')][_0xbaa1('0x49')]({'where':{'id':_0x2f2f07[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x809f12,null))[_0xbaa1('0x24')](function(_0x54b13d){if(_0x54b13d){return _0x54b13d[_0xbaa1('0x8d')](_0x2f2f07[_0xbaa1('0x35')][_0xbaa1('0x8e')]);}})[_0xbaa1('0x24')](function(_0x418250){if(_0x418250){return db[_0xbaa1('0x5a')][_0xbaa1('0x25')]({'where':{'ListId':_0x2f2f07[_0xbaa1('0x35')][_0xbaa1('0x8e')],'CampaignId':_0x2f2f07[_0xbaa1('0x46')]['id']}})['then'](function(){return _0x418250;});}})['then'](respondWithStatusCode(_0x809f12,null))[_0xbaa1('0x4a')](handleError(_0x809f12,null));};exports[_0xbaa1('0x8f')]=function(_0x3a0738,_0x1538e6,_0x264c17){var _0x585993={};var _0x5ac12d={};var _0x177431;var _0x45b208;return db[_0xbaa1('0x30')]['findOne']({'where':{'id':_0x3a0738[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x1538e6,null))[_0xbaa1('0x24')](function(_0x46f9e5){if(_0x46f9e5){_0x177431=_0x46f9e5;_0x5ac12d['model']=_[_0xbaa1('0x47')](db[_0xbaa1('0x61')][_0xbaa1('0x31')]);_0x5ac12d['query']=_[_0xbaa1('0x47')](_0x3a0738[_0xbaa1('0x35')]);_0x5ac12d[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x5ac12d[_0xbaa1('0x34')],_0x5ac12d['query']);_0x585993[_0xbaa1('0x37')]=_['intersection'](_0x5ac12d[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x3a0738[_0xbaa1('0x35')]['fields']));_0x585993[_0xbaa1('0x37')]=_0x585993[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x585993[_0xbaa1('0x37')]:_0x5ac12d[_0xbaa1('0x34')];_0x585993[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x3a0738['query'][_0xbaa1('0x3b')]);_0x585993[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0x3a0738[_0xbaa1('0x35')],_0x5ac12d[_0xbaa1('0x3d')]));if(_0x3a0738['query'][_0xbaa1('0x3f')]){_0x585993['where']=_[_0xbaa1('0x40')](_0x585993['where'],{'$or':_[_0xbaa1('0x2f')](_0x585993['attributes'],function(_0x3cd2e5){var _0x54eecc={};_0x54eecc[_0x3cd2e5]={'$like':'%'+_0x3a0738[_0xbaa1('0x35')]['filter']+'%'};return _0x54eecc;})});}_0x585993=_[_0xbaa1('0x40')]({},_0x585993,_0x3a0738[_0xbaa1('0x41')]);return _0x177431[_0xbaa1('0x8f')](_0x585993);}})['then'](function(_0x3b114e){if(_0x3b114e){_0x45b208=_0x3b114e[_0xbaa1('0x48')];if(!_0x3a0738[_0xbaa1('0x35')]['hasOwnProperty'](_0xbaa1('0x39'))){_0x585993[_0xbaa1('0x1c')]=qs['limit'](_0x3a0738['query'][_0xbaa1('0x1c')]);_0x585993[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x3a0738[_0xbaa1('0x35')]['offset']);}return _0x177431[_0xbaa1('0x8f')](_0x585993);}})[_0xbaa1('0x24')](function(_0x289258){if(_0x289258){return _0x289258?{'count':_0x45b208,'rows':_0x289258}:null;}})[_0xbaa1('0x24')](respondWithResult(_0x1538e6,null))[_0xbaa1('0x4a')](handleError(_0x1538e6,null));};exports[_0xbaa1('0x90')]=function(_0x289421,_0x558f36,_0x5a68c1){var _0x292887,_0x22b8f3;var _0x5d4da6=[];var _0x3d6ce9=moment()[_0xbaa1('0x91')](_0xbaa1('0x92'));return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x289421['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x558f36,null))['then'](function(_0x43d9c2){if(_0x43d9c2){_0x22b8f3=_0x43d9c2;return _0x43d9c2['addBlackLists'](_0x289421[_0xbaa1('0x4c')]['ids'],_['omit'](_0x289421[_0xbaa1('0x4c')],[_0xbaa1('0x8e'),'id'])||{});}return null;})[_0xbaa1('0x63')](function(_0x1dbe68){var _0x58e18a;var _0xbf751d;_0x292887=_0x1dbe68||[];var _0x3c2749=[];if(_0x1dbe68){for(var _0x1b966f=0x0;_0x1b966f<_0x1dbe68[_0xbaa1('0x48')];_0x1b966f+=0x1){var _0x4d00c4=_0x1dbe68[_0x1b966f]['get']({'plain':!![]});_0x58e18a=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x93'))[_0xbaa1('0x68')](['phone',_0xbaa1('0x6b'),'ListId','CampaignId','createdAt',_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')]('phone',_0xbaa1('0x69'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4d00c4['CmListId'][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))['field'](_0x289421[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')](_0xbaa1('0x7d'),_0xbaa1('0x7c'))['field']('NOW()',_0xbaa1('0x54'))[_0xbaa1('0x70')]('cm_contacts')['where'](_0xbaa1('0x72'))[_0xbaa1('0x3c')]('ListId\x20=\x20?',_0x4d00c4[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x74')))[_0xbaa1('0x6f')]();_0x3c2749[_0xbaa1('0x8a')](db[_0xbaa1('0x8b')][_0xbaa1('0x35')](_0x58e18a));}return BPromise['all'](_0x3c2749);}})[_0xbaa1('0x24')](function(){return _0x292887;})['then'](respondWithResult(_0x558f36,null))[_0xbaa1('0x4a')](handleError(_0x558f36,null));};exports[_0xbaa1('0x94')]=function(_0x2aa343,_0x33c182,_0x2166e9){return db[_0xbaa1('0x30')][_0xbaa1('0x49')]({'where':{'id':_0x2aa343[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x33c182,null))[_0xbaa1('0x24')](function(_0xbf957f){if(_0xbf957f){return _0xbf957f[_0xbaa1('0x94')](_0x2aa343['query'][_0xbaa1('0x8e')]);}})[_0xbaa1('0x24')](function(_0x278628){if(_0x278628){return db[_0xbaa1('0x5f')][_0xbaa1('0x25')]({'where':{'ListId':_0x2aa343[_0xbaa1('0x35')][_0xbaa1('0x8e')],'CampaignId':_0x2aa343[_0xbaa1('0x46')]['id']}})['then'](function(){return _0x278628;});}})[_0xbaa1('0x24')](respondWithStatusCode(_0x33c182,null))[_0xbaa1('0x4a')](handleError(_0x33c182,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2ec7b8e..42dcfe7 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4be3f3,_0x20efd7){var _0x5278b3=function(_0x147367){while(--_0x147367){_0x4be3f3['push'](_0x4be3f3['shift']());}};_0x5278b3(++_0x20efd7);}(_0x7a54,0x106));var _0x47a5=function(_0x417127,_0xc3ae){_0x417127=_0x417127-0x0;var _0x3086eb=_0x7a54[_0x417127];return _0x3086eb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 8dea0ce..287c35a 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 _0x5640=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5640,0x111));var _0x0564=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5640[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0564('0x0'));var util=require('util');var moment=require(_0x0564('0x1'));var BPromise=require(_0x0564('0x2'));var rs=require(_0x0564('0x3'));var fs=require('fs');var Redis=require(_0x0564('0x4'));var db=require(_0x0564('0x5'))['db'];var utils=require(_0x0564('0x6'));var logger=require(_0x0564('0x7'))(_0x0564('0x8'));var config=require(_0x0564('0x9'));var jayson=require(_0x0564('0xa'));var client=jayson[_0x0564('0xb')][_0x0564('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3deac1,_0x545a39,_0x52b032){return new BPromise(function(_0x9e3a60,_0x37a190){return client[_0x0564('0xd')](_0x3deac1,_0x52b032)[_0x0564('0xe')](function(_0x4f5a64){logger[_0x0564('0xf')](_0x0564('0x10'),_0x545a39,'request\x20sent');logger[_0x0564('0x11')](_0x0564('0x12'),_0x545a39,'request\x20sent',JSON[_0x0564('0x13')](_0x4f5a64));if(_0x4f5a64[_0x0564('0x14')]){if(_0x4f5a64[_0x0564('0x14')]['code']===0x1f4){logger['error'](_0x0564('0x10'),_0x545a39,_0x4f5a64['error'][_0x0564('0x15')]);return _0x37a190(_0x4f5a64[_0x0564('0x14')][_0x0564('0x15')]);}logger[_0x0564('0x14')](_0x0564('0x10'),_0x545a39,_0x4f5a64[_0x0564('0x14')][_0x0564('0x15')]);return _0x9e3a60(_0x4f5a64[_0x0564('0x14')][_0x0564('0x15')]);}else{logger['info'](_0x0564('0x10'),_0x545a39,_0x0564('0x16'));_0x9e3a60(_0x4f5a64[_0x0564('0x17')][_0x0564('0x15')]);}})[_0x0564('0x18')](function(_0x49173f){logger['error'](_0x0564('0x10'),_0x545a39,_0x49173f);_0x37a190(_0x49173f);});});}exports[_0x0564('0x19')]=function(_0x28c807){var _0x35ebe3=this;return new Promise(function(_0x31b612,_0x471645){return db[_0x0564('0x1a')]['findAll']({'raw':_0x28c807[_0x0564('0x1b')]?_0x28c807[_0x0564('0x1b')][_0x0564('0x1c')]===undefined?!![]:![]:!![],'where':_0x28c807[_0x0564('0x1b')]?_0x28c807[_0x0564('0x1b')][_0x0564('0x1d')]||null:null,'attributes':_0x28c807[_0x0564('0x1b')]?_0x28c807[_0x0564('0x1b')][_0x0564('0x1e')]||null:null,'limit':_0x28c807['options']?_0x28c807[_0x0564('0x1b')][_0x0564('0x1f')]||null:null,'include':_0x28c807['options']?_0x28c807[_0x0564('0x1b')][_0x0564('0x20')]?_[_0x0564('0x21')](_0x28c807[_0x0564('0x1b')]['include'],function(_0x542b1d){return{'model':db[_0x542b1d[_0x0564('0x22')]],'as':_0x542b1d['as'],'attributes':_0x542b1d[_0x0564('0x1e')],'include':_0x542b1d['include']?_[_0x0564('0x21')](_0x542b1d['include'],function(_0x4ed225){return{'model':db[_0x4ed225[_0x0564('0x22')]],'as':_0x4ed225['as'],'attributes':_0x4ed225['attributes'],'include':_0x4ed225['include']?_[_0x0564('0x21')](_0x4ed225[_0x0564('0x20')],function(_0x23d59d){return{'model':db[_0x23d59d[_0x0564('0x22')]],'as':_0x23d59d['as'],'attributes':_0x23d59d[_0x0564('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0564('0xe')](function(_0x2da082){logger[_0x0564('0xf')](_0x0564('0x19'),_0x28c807);logger[_0x0564('0x11')](_0x0564('0x19'),_0x28c807,JSON['stringify'](_0x2da082));_0x31b612(_0x2da082);})[_0x0564('0x18')](function(_0x2bd9c7){logger['error']('GetCampaign',_0x2bd9c7[_0x0564('0x15')],_0x28c807);_0x471645(_0x35ebe3['error'](0x1f4,_0x2bd9c7[_0x0564('0x15')]));});});}; \ No newline at end of file +var _0xf194=['GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x5dda34,_0x4547c3){var _0x40ba81=function(_0x56820a){while(--_0x56820a){_0x5dda34['push'](_0x5dda34['shift']());}};_0x40ba81(++_0x4547c3);}(_0xf194,0x91));var _0x4f19=function(_0x4bb90c,_0x243ad5){_0x4bb90c=_0x4bb90c-0x0;var _0x14f765=_0xf194[_0x4bb90c];return _0x14f765;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f19('0x5'));var config=require(_0x4f19('0x6'));var jayson=require(_0x4f19('0x7'));var client=jayson['client'][_0x4f19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c88a,_0x514d93,_0x4b023f){return new BPromise(function(_0x265d15,_0x116780){return client[_0x4f19('0x9')](_0x45c88a,_0x4b023f)[_0x4f19('0xa')](function(_0x4aaf89){logger[_0x4f19('0xb')](_0x4f19('0xc'),_0x514d93,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x514d93,_0x4f19('0xd'),JSON['stringify'](_0x4aaf89));if(_0x4aaf89['error']){if(_0x4aaf89['error'][_0x4f19('0x10')]===0x1f4){logger[_0x4f19('0x11')]('Campaign,\x20%s,\x20%s',_0x514d93,_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);return _0x116780(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}logger['error'](_0x4f19('0xc'),_0x514d93,_0x4aaf89[_0x4f19('0x11')]['message']);return _0x265d15(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}else{logger['info'](_0x4f19('0xc'),_0x514d93,'request\x20sent');_0x265d15(_0x4aaf89[_0x4f19('0x13')][_0x4f19('0x12')]);}})['catch'](function(_0x4d8021){logger[_0x4f19('0x11')](_0x4f19('0xc'),_0x514d93,_0x4d8021);_0x116780(_0x4d8021);});});}exports[_0x4f19('0x14')]=function(_0x576eef){var _0x1d9bf3=this;return new Promise(function(_0x205fee,_0x1b4d79){return db[_0x4f19('0x15')][_0x4f19('0x16')]({'raw':_0x576eef['options']?_0x576eef[_0x4f19('0x17')][_0x4f19('0x18')]===undefined?!![]:![]:!![],'where':_0x576eef['options']?_0x576eef[_0x4f19('0x17')][_0x4f19('0x19')]||null:null,'attributes':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')]['attributes']||null:null,'limit':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')][_0x4f19('0x1a')]||null:null,'include':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')][_0x4f19('0x1b')]?_[_0x4f19('0x1c')](_0x576eef[_0x4f19('0x17')][_0x4f19('0x1b')],function(_0x10e164){return{'model':db[_0x10e164[_0x4f19('0x1d')]],'as':_0x10e164['as'],'attributes':_0x10e164[_0x4f19('0x1e')],'include':_0x10e164[_0x4f19('0x1b')]?_[_0x4f19('0x1c')](_0x10e164[_0x4f19('0x1b')],function(_0x39cb12){return{'model':db[_0x39cb12[_0x4f19('0x1d')]],'as':_0x39cb12['as'],'attributes':_0x39cb12[_0x4f19('0x1e')],'include':_0x39cb12[_0x4f19('0x1b')]?_['map'](_0x39cb12[_0x4f19('0x1b')],function(_0x5218c6){return{'model':db[_0x5218c6[_0x4f19('0x1d')]],'as':_0x5218c6['as'],'attributes':_0x5218c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f19('0xa')](function(_0x5321a8){logger[_0x4f19('0xb')](_0x4f19('0x14'),_0x576eef);logger[_0x4f19('0xe')]('GetCampaign',_0x576eef,JSON[_0x4f19('0x1f')](_0x5321a8));_0x205fee(_0x5321a8);})[_0x4f19('0x20')](function(_0x2175ff){logger[_0x4f19('0x11')](_0x4f19('0x14'),_0x2175ff['message'],_0x576eef);_0x1b4d79(_0x1d9bf3[_0x4f19('0x11')](0x1f4,_0x2175ff[_0x4f19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 140085d..f801863 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 _0xd69c=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','update','delete','removeLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x5b37f9,_0x311ec1){var _0x5945e2=function(_0x5af157){while(--_0x5af157){_0x5b37f9['push'](_0x5b37f9['shift']());}};_0x5945e2(++_0x311ec1);}(_0xd69c,0x15c));var _0xcd69=function(_0x36731d,_0x2b675c){_0x36731d=_0x36731d-0x0;var _0x53d18c=_0xd69c[_0x36731d];return _0x53d18c;};'use strict';var multer=require(_0xcd69('0x0'));var util=require(_0xcd69('0x1'));var path=require(_0xcd69('0x2'));var timeout=require(_0xcd69('0x3'));var express=require(_0xcd69('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcd69('0x5'));var interaction=require(_0xcd69('0x6'));var config=require('../../config/environment');var controller=require(_0xcd69('0x7'));router[_0xcd69('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd69('0x8')](_0xcd69('0x9'),auth[_0xcd69('0xa')](),controller[_0xcd69('0xb')]);router[_0xcd69('0x8')](_0xcd69('0xc'),auth[_0xcd69('0xa')](),controller[_0xcd69('0xd')]);router['get'](_0xcd69('0xe'),auth[_0xcd69('0xa')](),controller[_0xcd69('0xf')]);router[_0xcd69('0x8')](_0xcd69('0x10'),auth[_0xcd69('0xa')](),controller[_0xcd69('0x11')]);router[_0xcd69('0x8')](_0xcd69('0x12'),auth[_0xcd69('0xa')](),controller[_0xcd69('0x13')]);router['get'](_0xcd69('0x14'),auth[_0xcd69('0xa')](),controller[_0xcd69('0x15')]);router['get'](_0xcd69('0x16'),auth['isAuthenticated'](),controller[_0xcd69('0x17')]);router[_0xcd69('0x18')]('/',auth[_0xcd69('0xa')](),controller[_0xcd69('0x19')]);router[_0xcd69('0x18')]('/:id/clone',auth['isAuthenticated'](),controller[_0xcd69('0x1a')]);router[_0xcd69('0x18')](_0xcd69('0x14'),auth['isAuthenticated'](),controller[_0xcd69('0x1b')]);router[_0xcd69('0x18')](_0xcd69('0x16'),auth[_0xcd69('0xa')](),controller[_0xcd69('0x1c')]);router['put'](_0xcd69('0x9'),auth[_0xcd69('0xa')](),controller[_0xcd69('0x1d')]);router[_0xcd69('0x1e')](_0xcd69('0x9'),auth[_0xcd69('0xa')](),controller['destroy']);router[_0xcd69('0x1e')](_0xcd69('0x14'),auth['isAuthenticated'](),controller[_0xcd69('0x1f')]);router[_0xcd69('0x1e')](_0xcd69('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xcd69('0x20')]=router; \ No newline at end of file +var _0x2054=['post','/:id/clone','clone','addBlackLists','put','update','delete','/:id/lists','removeLists','removeBlackLists','multer','express','Router','fs-extra','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists'];(function(_0x5d8048,_0x445203){var _0x3affba=function(_0x5e65c4){while(--_0x5e65c4){_0x5d8048['push'](_0x5d8048['shift']());}};_0x3affba(++_0x445203);}(_0x2054,0x176));var _0x4205=function(_0x5054da,_0x217daf){_0x5054da=_0x5054da-0x0;var _0x76c47b=_0x2054[_0x5054da];return _0x76c47b;};'use strict';var multer=require(_0x4205('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4205('0x1'));var router=express[_0x4205('0x2')]();var fs_extra=require(_0x4205('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4205('0x4'));router[_0x4205('0x5')]('/',auth[_0x4205('0x6')](),controller[_0x4205('0x7')]);router['get'](_0x4205('0x8'),auth['isAuthenticated'](),controller[_0x4205('0x9')]);router[_0x4205('0x5')](_0x4205('0xa'),auth[_0x4205('0x6')](),controller[_0x4205('0xb')]);router[_0x4205('0x5')](_0x4205('0xc'),auth[_0x4205('0x6')](),controller[_0x4205('0xd')]);router[_0x4205('0x5')](_0x4205('0xe'),auth[_0x4205('0x6')](),controller['getHopperFinals']);router['get'](_0x4205('0xf'),auth[_0x4205('0x6')](),controller['getHopperBlacks']);router[_0x4205('0x5')]('/:id/lists',auth[_0x4205('0x6')](),controller[_0x4205('0x10')]);router['get'](_0x4205('0x11'),auth[_0x4205('0x6')](),controller['getBlackLists']);router['post']('/',auth[_0x4205('0x6')](),controller['create']);router[_0x4205('0x12')](_0x4205('0x13'),auth[_0x4205('0x6')](),controller[_0x4205('0x14')]);router[_0x4205('0x12')]('/:id/lists',auth[_0x4205('0x6')](),controller['addLists']);router[_0x4205('0x12')](_0x4205('0x11'),auth['isAuthenticated'](),controller[_0x4205('0x15')]);router[_0x4205('0x16')]('/:id',auth[_0x4205('0x6')](),controller[_0x4205('0x17')]);router[_0x4205('0x18')](_0x4205('0x8'),auth[_0x4205('0x6')](),controller['destroy']);router[_0x4205('0x18')](_0x4205('0x19'),auth[_0x4205('0x6')](),controller[_0x4205('0x1a')]);router[_0x4205('0x18')](_0x4205('0x11'),auth['isAuthenticated'](),controller[_0x4205('0x1b')]);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 940f71d..535297b 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 _0xd699=['VIRTUAL','getDataValue','STRING','TEXT'];(function(_0x4f9368,_0x545aad){var _0x1ae968=function(_0x1cca05){while(--_0x1cca05){_0x4f9368['push'](_0x4f9368['shift']());}};_0x1ae968(++_0x545aad);}(_0xd699,0x1d2));var _0x9d69=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd699[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x9d69('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x9d69('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9d69('0x0')]},'name':{'type':Sequelize[_0x9d69('0x2')],'get':function(){return this[_0x9d69('0x3')]('key');}}}; \ No newline at end of file +var _0x3a5b=['exports','STRING','TEXT','getDataValue','sequelize'];(function(_0x38674e,_0x170f1e){var _0x282a8a=function(_0x308ade){while(--_0x308ade){_0x38674e['push'](_0x38674e['shift']());}};_0x282a8a(++_0x170f1e);}(_0x3a5b,0xb3));var _0xb3a5=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x3a5b[_0x25d2fb];return _0x1ded53;};'use strict';var Sequelize=require(_0xb3a5('0x0'));module[_0xb3a5('0x1')]={'key':{'type':Sequelize[_0xb3a5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb3a5('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb3a5('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb3a5('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 944406e..61079f2 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 _0x7f3f=['rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','CannedAnswer'];(function(_0x8c0c1a,_0xc7b715){var _0x1e08a5=function(_0x18e918){while(--_0x18e918){_0x8c0c1a['push'](_0x8c0c1a['shift']());}};_0x1e08a5(++_0xc7b715);}(_0x7f3f,0x18d));var _0xf7f3=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x7f3f[_0x38622b];return _0x2c1a7a;};'use strict';var emlformat=require(_0xf7f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf7f3('0x1'));var rp=require(_0xf7f3('0x2'));var moment=require(_0xf7f3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7f3('0x4'));var util=require(_0xf7f3('0x5'));var path=require('path');var sox=require(_0xf7f3('0x6'));var csv=require(_0xf7f3('0x7'));var ejs=require(_0xf7f3('0x8'));var fs=require('fs');var fs_extra=require(_0xf7f3('0x9'));var _=require('lodash');var squel=require(_0xf7f3('0xa'));var crypto=require(_0xf7f3('0xb'));var jsforce=require(_0xf7f3('0xc'));var deskjs=require(_0xf7f3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf7f3('0xe'));var Redis=require(_0xf7f3('0xf'));var authService=require(_0xf7f3('0x10'));var qs=require(_0xf7f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7f3('0x12'));var logger=require(_0xf7f3('0x13'))(_0xf7f3('0x14'));var utils=require(_0xf7f3('0x15'));var config=require(_0xf7f3('0x16'));var licenseUtil=require(_0xf7f3('0x17'));var db=require(_0xf7f3('0x18'))['db'];function respondWithStatusCode(_0x26afcb,_0x502302){_0x502302=_0x502302||0xcc;return function(_0x11717c){if(_0x11717c){return _0x26afcb[_0xf7f3('0x19')](_0x502302);}return _0x26afcb[_0xf7f3('0x1a')](_0x502302)[_0xf7f3('0x1b')]();};}function respondWithResult(_0x321ed4,_0x6e4c52){_0x6e4c52=_0x6e4c52||0xc8;return function(_0x2e7547){if(_0x2e7547){return _0x321ed4[_0xf7f3('0x1a')](_0x6e4c52)[_0xf7f3('0x1c')](_0x2e7547);}};}function respondWithFilteredResult(_0x108ec2,_0x116a8c){return function(_0x23a70c){if(_0x23a70c){var _0x4faba8=typeof _0x116a8c[_0xf7f3('0x1d')]===_0xf7f3('0x1e')&&typeof _0x116a8c[_0xf7f3('0x1f')]===_0xf7f3('0x1e');var _0x1673bc=_0x23a70c[_0xf7f3('0x20')];var _0x38fc0c=_0x4faba8?0x0:_0x116a8c['offset'];var _0x37ae54=_0x4faba8?_0x23a70c[_0xf7f3('0x20')]:_0x116a8c[_0xf7f3('0x1d')]+_0x116a8c['limit'];var _0x15d961;if(_0x37ae54>=_0x1673bc){_0x37ae54=_0x1673bc;_0x15d961=0xc8;}else{_0x15d961=0xce;}_0x108ec2['status'](_0x15d961);return _0x108ec2['set'](_0xf7f3('0x21'),_0x38fc0c+'-'+_0x37ae54+'/'+_0x1673bc)[_0xf7f3('0x1c')](_0x23a70c);}return null;};}function patchUpdates(_0x3a4541){return function(_0x240aa4){try{jsonpatch[_0xf7f3('0x22')](_0x240aa4,_0x3a4541,!![]);}catch(_0x196233){return BPromise[_0xf7f3('0x23')](_0x196233);}return _0x240aa4[_0xf7f3('0x24')]();};}function saveUpdates(_0x811c3,_0x36ecad){return function(_0x2a36c2){if(_0x2a36c2){return _0x2a36c2[_0xf7f3('0x25')](_0x811c3)[_0xf7f3('0x26')](function(_0x4c06f6){return _0x4c06f6;});}return null;};}function removeEntity(_0x5492dd,_0x25902d){return function(_0x1f18f7){if(_0x1f18f7){return _0x1f18f7[_0xf7f3('0x27')]()[_0xf7f3('0x26')](function(){var _0x1e74ce=_0x1f18f7[_0xf7f3('0x28')]({'plain':!![]});var _0x5e0ce0='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x5e0ce0,'resourceId':_0x1e74ce['id']}})[_0xf7f3('0x26')](function(){return _0x1f18f7;});})[_0xf7f3('0x26')](function(){_0x5492dd[_0xf7f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35dc6d,_0x4bffdd){return function(_0x26e1a4){if(!_0x26e1a4){_0x35dc6d[_0xf7f3('0x19')](0x194);}return _0x26e1a4;};}function handleError(_0x96a3ba,_0x290519){_0x290519=_0x290519||0x1f4;return function(_0x3f889c){logger[_0xf7f3('0x29')](_0x3f889c[_0xf7f3('0x2a')]);if(_0x3f889c[_0xf7f3('0x2b')]){delete _0x3f889c['name'];}_0x96a3ba[_0xf7f3('0x1a')](_0x290519)[_0xf7f3('0x2c')](_0x3f889c);};}exports[_0xf7f3('0x2d')]=function(_0x29879d,_0x497fad){var _0x1f7502={},_0x2e78b5={},_0x516251={'count':0x0,'rows':[]};var _0x3707fc=_[_0xf7f3('0x2e')](db[_0xf7f3('0x2f')][_0xf7f3('0x30')],function(_0x1fea3a){return{'name':_0x1fea3a[_0xf7f3('0x31')],'type':_0x1fea3a['type'][_0xf7f3('0x32')]};});_0x2e78b5[_0xf7f3('0x33')]=_[_0xf7f3('0x2e')](_0x3707fc,_0xf7f3('0x2b'));_0x2e78b5[_0xf7f3('0x34')]=_[_0xf7f3('0x35')](_0x29879d[_0xf7f3('0x34')]);_0x2e78b5['filters']=_[_0xf7f3('0x36')](_0x2e78b5[_0xf7f3('0x33')],_0x2e78b5[_0xf7f3('0x34')]);_0x1f7502[_0xf7f3('0x37')]=_[_0xf7f3('0x36')](_0x2e78b5[_0xf7f3('0x33')],qs[_0xf7f3('0x38')](_0x29879d[_0xf7f3('0x34')][_0xf7f3('0x38')]));_0x1f7502[_0xf7f3('0x37')]=_0x1f7502['attributes']['length']?_0x1f7502['attributes']:_0x2e78b5[_0xf7f3('0x33')];if(!_0x29879d['query'][_0xf7f3('0x39')]('nolimit')){_0x1f7502['limit']=qs['limit'](_0x29879d[_0xf7f3('0x34')]['limit']);_0x1f7502['offset']=qs['offset'](_0x29879d[_0xf7f3('0x34')]['offset']);}_0x1f7502[_0xf7f3('0x3a')]=qs[_0xf7f3('0x3b')](_0x29879d['query'][_0xf7f3('0x3b')]);_0x1f7502['where']=qs['filters'](_['pick'](_0x29879d[_0xf7f3('0x34')],_0x2e78b5['filters']),_0x3707fc);if(_0x29879d[_0xf7f3('0x34')][_0xf7f3('0x3c')]){_0x1f7502['where']=_['merge'](_0x1f7502[_0xf7f3('0x3d')],{'$or':[{'key':{'$like':'%'+_0x29879d[_0xf7f3('0x34')][_0xf7f3('0x3c')]+'%'}},{'value':{'$like':'%'+_0x29879d[_0xf7f3('0x34')][_0xf7f3('0x3c')]+'%'}}]});}_0x1f7502=_[_0xf7f3('0x3e')]({},_0x1f7502,_0x29879d[_0xf7f3('0x3f')]);var _0x3719cd={'where':_0x1f7502[_0xf7f3('0x3d')]};return db[_0xf7f3('0x2f')][_0xf7f3('0x20')](_0x3719cd)['then'](function(_0x343850){_0x516251['count']=_0x343850;if(_0x29879d[_0xf7f3('0x34')][_0xf7f3('0x40')]){_0x1f7502[_0xf7f3('0x41')]=[{'all':!![]}];}return db[_0xf7f3('0x2f')][_0xf7f3('0x42')](_0x1f7502);})['then'](function(_0x43f1cf){_0x516251[_0xf7f3('0x43')]=_0x43f1cf;return _0x516251;})['then'](respondWithFilteredResult(_0x497fad,_0x1f7502))[_0xf7f3('0x44')](handleError(_0x497fad,null));};exports[_0xf7f3('0x45')]=function(_0x5aec30,_0x17b6ea){var _0x539296={'raw':!![],'where':{'id':_0x5aec30[_0xf7f3('0x46')]['id']}},_0xe71b71={};_0xe71b71[_0xf7f3('0x33')]=_['keys'](db['CannedAnswer'][_0xf7f3('0x30')]);_0xe71b71['query']=_[_0xf7f3('0x35')](_0x5aec30['query']);_0xe71b71[_0xf7f3('0x47')]=_[_0xf7f3('0x36')](_0xe71b71['model'],_0xe71b71['query']);_0x539296[_0xf7f3('0x37')]=_['intersection'](_0xe71b71[_0xf7f3('0x33')],qs[_0xf7f3('0x38')](_0x5aec30[_0xf7f3('0x34')][_0xf7f3('0x38')]));_0x539296[_0xf7f3('0x37')]=_0x539296[_0xf7f3('0x37')][_0xf7f3('0x48')]?_0x539296[_0xf7f3('0x37')]:_0xe71b71[_0xf7f3('0x33')];if(_0x5aec30[_0xf7f3('0x34')][_0xf7f3('0x40')]){_0x539296[_0xf7f3('0x41')]=[{'all':!![]}];}_0x539296=_['merge']({},_0x539296,_0x5aec30['options']);return db[_0xf7f3('0x2f')][_0xf7f3('0x49')](_0x539296)[_0xf7f3('0x26')](handleEntityNotFound(_0x17b6ea,null))[_0xf7f3('0x26')](respondWithResult(_0x17b6ea,null))[_0xf7f3('0x44')](handleError(_0x17b6ea,null));};exports['update']=function(_0x259c05,_0x236894){if(_0x259c05[_0xf7f3('0x4a')]['id']){delete _0x259c05[_0xf7f3('0x4a')]['id'];}return db[_0xf7f3('0x2f')][_0xf7f3('0x49')]({'where':{'id':_0x259c05[_0xf7f3('0x46')]['id']}})[_0xf7f3('0x26')](handleEntityNotFound(_0x236894,null))['then'](saveUpdates(_0x259c05['body'],null))['then'](respondWithResult(_0x236894,null))['catch'](handleError(_0x236894,null));};exports['destroy']=function(_0x4ada95,_0x349369){return db['CannedAnswer']['find']({'where':{'id':_0x4ada95[_0xf7f3('0x46')]['id']}})[_0xf7f3('0x26')](handleEntityNotFound(_0x349369,null))['then'](removeEntity(_0x349369,null))[_0xf7f3('0x44')](handleError(_0x349369,null));};exports[_0xf7f3('0x4b')]=function(_0x558c3e,_0x372644){var _0x1a1cc4={'key':_0x558c3e[_0xf7f3('0x4a')]['key']};if(_0x558c3e[_0xf7f3('0x4a')][_0xf7f3('0x4c')]){_0x1a1cc4[_0xf7f3('0x4c')]=_0x558c3e[_0xf7f3('0x4a')][_0xf7f3('0x4c')];}else if(_0x558c3e['body'][_0xf7f3('0x4d')]){_0x1a1cc4[_0xf7f3('0x4d')]=_0x558c3e[_0xf7f3('0x4a')]['SmsAccountId'];}else if(_0x558c3e[_0xf7f3('0x4a')][_0xf7f3('0x4e')]){_0x1a1cc4[_0xf7f3('0x4e')]=_0x558c3e[_0xf7f3('0x4a')]['OpenchannelAccountId'];}else if(_0x558c3e[_0xf7f3('0x4a')]['ChatWebsiteId']){_0x1a1cc4[_0xf7f3('0x4f')]=_0x558c3e[_0xf7f3('0x4a')][_0xf7f3('0x4f')];}return db[_0xf7f3('0x2f')][_0xf7f3('0x49')]({'where':_0x1a1cc4})[_0xf7f3('0x26')](function(_0x26b68d){if(_0x26b68d){throw new db[(_0xf7f3('0x50'))][(_0xf7f3('0x51'))](_0xf7f3('0x52'));}return db[_0xf7f3('0x2f')][_0xf7f3('0x4b')](_0x558c3e[_0xf7f3('0x4a')]);})['then'](function(_0x2387d1){var _0x425a21=_0x558c3e['user']['get']({'plain':!![]});if(!_0x425a21)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x425a21[_0xf7f3('0x53')]===_0xf7f3('0x54')){var _0x2b5a96=_0x2387d1['get']({'plain':!![]});return db[_0xf7f3('0x55')][_0xf7f3('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x425a21[_0xf7f3('0x56')]},'raw':!![]})[_0xf7f3('0x26')](function(_0xe0fa68){if(_0xe0fa68&&_0xe0fa68['autoAssociation']===0x0){return db[_0xf7f3('0x57')]['create']({'name':_0x2b5a96[_0xf7f3('0x2b')],'resourceId':_0x2b5a96['id'],'type':_0xe0fa68[_0xf7f3('0x2b')],'sectionId':_0xe0fa68['id']},{})[_0xf7f3('0x26')](function(){return _0x2387d1;});}else{return _0x2387d1;}})[_0xf7f3('0x44')](function(_0x393085){logger[_0xf7f3('0x29')](_0xf7f3('0x58'),_0x393085);throw _0x393085;});}return _0x2387d1;})[_0xf7f3('0x26')](respondWithResult(_0x372644,0xc9))['catch'](handleError(_0x372644,null));}; \ No newline at end of file +var _0x4984=['includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','index','CannedAnswer','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options'];(function(_0x43fa17,_0x498bc8){var _0x24aafe=function(_0x3cf9e8){while(--_0x3cf9e8){_0x43fa17['push'](_0x43fa17['shift']());}};_0x24aafe(++_0x498bc8);}(_0x4984,0x174));var _0x4498=function(_0x3f8162,_0x5b8808){_0x3f8162=_0x3f8162-0x0;var _0xe80afb=_0x4984[_0x3f8162];return _0xe80afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4498('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4498('0x1'));var rp=require('request-promise');var moment=require(_0x4498('0x2'));var BPromise=require(_0x4498('0x3'));var Mustache=require('mustache');var util=require(_0x4498('0x4'));var path=require('path');var sox=require(_0x4498('0x5'));var csv=require(_0x4498('0x6'));var ejs=require(_0x4498('0x7'));var fs=require('fs');var fs_extra=require(_0x4498('0x8'));var _=require(_0x4498('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4498('0xa'));var deskjs=require(_0x4498('0xb'));var toCsv=require(_0x4498('0x6'));var querystring=require(_0x4498('0xc'));var Papa=require(_0x4498('0xd'));var Redis=require(_0x4498('0xe'));var authService=require(_0x4498('0xf'));var qs=require(_0x4498('0x10'));var as=require(_0x4498('0x11'));var hardwareService=require(_0x4498('0x12'));var logger=require(_0x4498('0x13'))('api');var utils=require(_0x4498('0x14'));var config=require(_0x4498('0x15'));var licenseUtil=require(_0x4498('0x16'));var db=require(_0x4498('0x17'))['db'];function respondWithStatusCode(_0x407c52,_0x538ee9){_0x538ee9=_0x538ee9||0xcc;return function(_0x225fbd){if(_0x225fbd){return _0x407c52[_0x4498('0x18')](_0x538ee9);}return _0x407c52[_0x4498('0x19')](_0x538ee9)[_0x4498('0x1a')]();};}function respondWithResult(_0x5d4dcf,_0xa46acc){_0xa46acc=_0xa46acc||0xc8;return function(_0x37e341){if(_0x37e341){return _0x5d4dcf['status'](_0xa46acc)[_0x4498('0x1b')](_0x37e341);}};}function respondWithFilteredResult(_0x6cafb2,_0x3cb446){return function(_0x48e98f){if(_0x48e98f){var _0x34a6ef=typeof _0x3cb446[_0x4498('0x1c')]===_0x4498('0x1d')&&typeof _0x3cb446[_0x4498('0x1e')]===_0x4498('0x1d');var _0x29a5be=_0x48e98f['count'];var _0x240cfe=_0x34a6ef?0x0:_0x3cb446[_0x4498('0x1c')];var _0xff2aed=_0x34a6ef?_0x48e98f[_0x4498('0x1f')]:_0x3cb446[_0x4498('0x1c')]+_0x3cb446[_0x4498('0x1e')];var _0x492552;if(_0xff2aed>=_0x29a5be){_0xff2aed=_0x29a5be;_0x492552=0xc8;}else{_0x492552=0xce;}_0x6cafb2[_0x4498('0x19')](_0x492552);return _0x6cafb2['set'](_0x4498('0x20'),_0x240cfe+'-'+_0xff2aed+'/'+_0x29a5be)[_0x4498('0x1b')](_0x48e98f);}return null;};}function patchUpdates(_0x2d29cd){return function(_0x209ecb){try{jsonpatch[_0x4498('0x21')](_0x209ecb,_0x2d29cd,!![]);}catch(_0x354c5c){return BPromise['reject'](_0x354c5c);}return _0x209ecb[_0x4498('0x22')]();};}function saveUpdates(_0x501ac7,_0x383997){return function(_0x13c9be){if(_0x13c9be){return _0x13c9be[_0x4498('0x23')](_0x501ac7)[_0x4498('0x24')](function(_0x4d36a9){return _0x4d36a9;});}return null;};}function removeEntity(_0x485e1a,_0x2aa359){return function(_0x357953){if(_0x357953){return _0x357953[_0x4498('0x25')]()[_0x4498('0x24')](function(){var _0x106f8c=_0x357953[_0x4498('0x26')]({'plain':!![]});var _0x4807a9=_0x4498('0x27');return db[_0x4498('0x28')][_0x4498('0x25')]({'where':{'type':_0x4807a9,'resourceId':_0x106f8c['id']}})[_0x4498('0x24')](function(){return _0x357953;});})[_0x4498('0x24')](function(){_0x485e1a[_0x4498('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62d6d1,_0x43ed90){return function(_0x5e7e86){if(!_0x5e7e86){_0x62d6d1[_0x4498('0x18')](0x194);}return _0x5e7e86;};}function handleError(_0x13b0d5,_0x255ea5){_0x255ea5=_0x255ea5||0x1f4;return function(_0x1982be){logger['error'](_0x1982be[_0x4498('0x29')]);if(_0x1982be[_0x4498('0x2a')]){delete _0x1982be[_0x4498('0x2a')];}_0x13b0d5[_0x4498('0x19')](_0x255ea5)[_0x4498('0x2b')](_0x1982be);};}exports[_0x4498('0x2c')]=function(_0x37c588,_0x98823e){var _0x8e18a5={},_0x15e9ab={},_0x5047cd={'count':0x0,'rows':[]};var _0x2b9f19=_['map'](db[_0x4498('0x2d')]['rawAttributes'],function(_0x21ed2f){return{'name':_0x21ed2f[_0x4498('0x2e')],'type':_0x21ed2f[_0x4498('0x2f')][_0x4498('0x30')]};});_0x15e9ab['model']=_['map'](_0x2b9f19,_0x4498('0x2a'));_0x15e9ab[_0x4498('0x31')]=_['keys'](_0x37c588['query']);_0x15e9ab['filters']=_[_0x4498('0x32')](_0x15e9ab['model'],_0x15e9ab[_0x4498('0x31')]);_0x8e18a5[_0x4498('0x33')]=_[_0x4498('0x32')](_0x15e9ab[_0x4498('0x34')],qs[_0x4498('0x35')](_0x37c588[_0x4498('0x31')][_0x4498('0x35')]));_0x8e18a5['attributes']=_0x8e18a5[_0x4498('0x33')][_0x4498('0x36')]?_0x8e18a5[_0x4498('0x33')]:_0x15e9ab['model'];if(!_0x37c588[_0x4498('0x31')][_0x4498('0x37')]('nolimit')){_0x8e18a5[_0x4498('0x1e')]=qs[_0x4498('0x1e')](_0x37c588['query'][_0x4498('0x1e')]);_0x8e18a5[_0x4498('0x1c')]=qs[_0x4498('0x1c')](_0x37c588[_0x4498('0x31')][_0x4498('0x1c')]);}_0x8e18a5['order']=qs['sort'](_0x37c588[_0x4498('0x31')][_0x4498('0x38')]);_0x8e18a5[_0x4498('0x39')]=qs[_0x4498('0x3a')](_[_0x4498('0x3b')](_0x37c588[_0x4498('0x31')],_0x15e9ab[_0x4498('0x3a')]),_0x2b9f19);if(_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]){_0x8e18a5['where']=_[_0x4498('0x3d')](_0x8e18a5[_0x4498('0x39')],{'$or':[{'key':{'$like':'%'+_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]+'%'}},{'value':{'$like':'%'+_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]+'%'}}]});}_0x8e18a5=_['merge']({},_0x8e18a5,_0x37c588[_0x4498('0x3e')]);var _0x4bdbb3={'where':_0x8e18a5[_0x4498('0x39')]};return db['CannedAnswer']['count'](_0x4bdbb3)[_0x4498('0x24')](function(_0x1825aa){_0x5047cd[_0x4498('0x1f')]=_0x1825aa;if(_0x37c588[_0x4498('0x31')][_0x4498('0x3f')]){_0x8e18a5[_0x4498('0x40')]=[{'all':!![]}];}return db[_0x4498('0x2d')][_0x4498('0x41')](_0x8e18a5);})[_0x4498('0x24')](function(_0x31d07c){_0x5047cd[_0x4498('0x42')]=_0x31d07c;return _0x5047cd;})[_0x4498('0x24')](respondWithFilteredResult(_0x98823e,_0x8e18a5))[_0x4498('0x43')](handleError(_0x98823e,null));};exports[_0x4498('0x44')]=function(_0x486aaa,_0x5ef1df){var _0x5a095d={'raw':!![],'where':{'id':_0x486aaa[_0x4498('0x45')]['id']}},_0x339ab5={};_0x339ab5[_0x4498('0x34')]=_[_0x4498('0x46')](db[_0x4498('0x2d')]['rawAttributes']);_0x339ab5[_0x4498('0x31')]=_[_0x4498('0x46')](_0x486aaa[_0x4498('0x31')]);_0x339ab5['filters']=_['intersection'](_0x339ab5[_0x4498('0x34')],_0x339ab5[_0x4498('0x31')]);_0x5a095d['attributes']=_[_0x4498('0x32')](_0x339ab5[_0x4498('0x34')],qs['fields'](_0x486aaa[_0x4498('0x31')][_0x4498('0x35')]));_0x5a095d[_0x4498('0x33')]=_0x5a095d[_0x4498('0x33')][_0x4498('0x36')]?_0x5a095d[_0x4498('0x33')]:_0x339ab5[_0x4498('0x34')];if(_0x486aaa['query'][_0x4498('0x3f')]){_0x5a095d[_0x4498('0x40')]=[{'all':!![]}];}_0x5a095d=_['merge']({},_0x5a095d,_0x486aaa[_0x4498('0x3e')]);return db[_0x4498('0x2d')][_0x4498('0x47')](_0x5a095d)[_0x4498('0x24')](handleEntityNotFound(_0x5ef1df,null))[_0x4498('0x24')](respondWithResult(_0x5ef1df,null))['catch'](handleError(_0x5ef1df,null));};exports['update']=function(_0x44227e,_0x121b8b){if(_0x44227e[_0x4498('0x48')]['id']){delete _0x44227e[_0x4498('0x48')]['id'];}return db[_0x4498('0x2d')]['find']({'where':{'id':_0x44227e['params']['id']}})[_0x4498('0x24')](handleEntityNotFound(_0x121b8b,null))[_0x4498('0x24')](saveUpdates(_0x44227e[_0x4498('0x48')],null))['then'](respondWithResult(_0x121b8b,null))['catch'](handleError(_0x121b8b,null));};exports[_0x4498('0x25')]=function(_0x309b25,_0x3383ec){return db[_0x4498('0x2d')][_0x4498('0x47')]({'where':{'id':_0x309b25[_0x4498('0x45')]['id']}})[_0x4498('0x24')](handleEntityNotFound(_0x3383ec,null))['then'](removeEntity(_0x3383ec,null))[_0x4498('0x43')](handleError(_0x3383ec,null));};exports[_0x4498('0x49')]=function(_0x460100,_0x279d7e){var _0x5eb882={'key':_0x460100['body']['key']};if(_0x460100[_0x4498('0x48')][_0x4498('0x4a')]){_0x5eb882[_0x4498('0x4a')]=_0x460100[_0x4498('0x48')]['MailAccountId'];}else if(_0x460100['body'][_0x4498('0x4b')]){_0x5eb882[_0x4498('0x4b')]=_0x460100['body'][_0x4498('0x4b')];}else if(_0x460100[_0x4498('0x48')][_0x4498('0x4c')]){_0x5eb882['OpenchannelAccountId']=_0x460100[_0x4498('0x48')]['OpenchannelAccountId'];}else if(_0x460100[_0x4498('0x48')][_0x4498('0x4d')]){_0x5eb882[_0x4498('0x4d')]=_0x460100[_0x4498('0x48')]['ChatWebsiteId'];}return db[_0x4498('0x2d')]['find']({'where':_0x5eb882})[_0x4498('0x24')](function(_0x196fb0){if(_0x196fb0){throw new db[(_0x4498('0x4e'))][(_0x4498('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x4498('0x2d')][_0x4498('0x49')](_0x460100['body']);})['then'](function(_0x11e176){var _0x58a6fb=_0x460100[_0x4498('0x50')][_0x4498('0x26')]({'plain':!![]});if(!_0x58a6fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58a6fb[_0x4498('0x51')]===_0x4498('0x50')){var _0x4271b7=_0x11e176[_0x4498('0x26')]({'plain':!![]});return db[_0x4498('0x52')][_0x4498('0x47')]({'where':{'name':_0x4498('0x27'),'userProfileId':_0x58a6fb[_0x4498('0x53')]},'raw':!![]})[_0x4498('0x24')](function(_0x52f8f9){if(_0x52f8f9&&_0x52f8f9[_0x4498('0x54')]===0x0){return db[_0x4498('0x28')]['create']({'name':_0x4271b7[_0x4498('0x2a')],'resourceId':_0x4271b7['id'],'type':_0x52f8f9['name'],'sectionId':_0x52f8f9['id']},{})['then'](function(){return _0x11e176;});}else{return _0x11e176;}})[_0x4498('0x43')](function(_0x5e01d9){logger[_0x4498('0x55')](_0x4498('0x56'),_0x5e01d9);throw _0x5e01d9;});}return _0x11e176;})['then'](respondWithResult(_0x279d7e,0xc9))[_0x4498('0x43')](handleError(_0x279d7e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 31e278e..430d24b 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 _0xabf1=['bluebird','request-promise','../../config/environment','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x38a5df,_0x88728f){var _0x3c4ce2=function(_0x12a47d){while(--_0x12a47d){_0x38a5df['push'](_0x38a5df['shift']());}};_0x3c4ce2(++_0x88728f);}(_0xabf1,0xed));var _0x1abf=function(_0xceda64,_0x57969b){_0xceda64=_0xceda64-0x0;var _0x345f2f=_0xabf1[_0xceda64];return _0x345f2f;};'use strict';var _=require('lodash');var util=require(_0x1abf('0x0'));var logger=require('../../config/logger')(_0x1abf('0x1'));var moment=require(_0x1abf('0x2'));var BPromise=require(_0x1abf('0x3'));var rp=require(_0x1abf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1abf('0x5'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0xdea3dc,_0x522042){return _0xdea3dc[_0x1abf('0x6')]('CannedAnswer',attributes,{'tableName':_0x1abf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1abf('0x8'),'collate':_0x1abf('0x9')});}; \ No newline at end of file +var _0x95c0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5dff12,_0x13c07f){var _0x292e58=function(_0x513642){while(--_0x513642){_0x5dff12['push'](_0x5dff12['shift']());}};_0x292e58(++_0x13c07f);}(_0x95c0,0x74));var _0x095c=function(_0x10d73c,_0x556760){_0x10d73c=_0x10d73c-0x0;var _0x3dc92b=_0x95c0[_0x10d73c];return _0x3dc92b;};'use strict';var _=require(_0x095c('0x0'));var util=require('util');var logger=require(_0x095c('0x1'))(_0x095c('0x2'));var moment=require('moment');var BPromise=require(_0x095c('0x3'));var rp=require(_0x095c('0x4'));var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require('../../config/environment');var attributes=require(_0x095c('0x7'));module[_0x095c('0x8')]=function(_0x2b7b3e,_0x92c19b){return _0x2b7b3e[_0x095c('0x9')](_0x095c('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x095c('0xb'),'collate':_0x095c('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1ab10ef..9407d23 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(_0x476c67,_0x5904d2){var _0x5d1860=function(_0x1d3f2e){while(--_0x1d3f2e){_0x476c67['push'](_0x476c67['shift']());}};_0x5d1860(++_0x5904d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x425871,_0x46c821){var _0x3de4ed=function(_0x4dbda1){while(--_0x4dbda1){_0x425871['push'](_0x425871['shift']());}};_0x3de4ed(++_0x46c821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 1ab66d3..4b172af 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 _0xa986=['express','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','util'];(function(_0x1c7f5c,_0xf442a2){var _0x36d7e7=function(_0x479c0b){while(--_0x479c0b){_0x1c7f5c['push'](_0x1c7f5c['shift']());}};_0x36d7e7(++_0xf442a2);}(_0xa986,0xe0));var _0x6a98=function(_0x30feb4,_0x4d3a77){_0x30feb4=_0x30feb4-0x0;var _0x1adf4c=_0xa986[_0x30feb4];return _0x1adf4c;};'use strict';var multer=require('multer');var util=require(_0x6a98('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a98('0x1'));var router=express[_0x6a98('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6a98('0x3'));var interaction=require(_0x6a98('0x4'));var config=require('../../config/environment');var controller=require(_0x6a98('0x5'));router[_0x6a98('0x6')]('/',auth[_0x6a98('0x7')](),controller[_0x6a98('0x8')]);router[_0x6a98('0x6')](_0x6a98('0x9'),auth[_0x6a98('0x7')](),controller[_0x6a98('0xa')]);router[_0x6a98('0xb')]('/',auth[_0x6a98('0x7')](),controller['create']);router[_0x6a98('0xc')](_0x6a98('0x9'),auth['isAuthenticated'](),controller[_0x6a98('0xd')]);router['delete']('/:id',auth[_0x6a98('0x7')](),controller[_0x6a98('0xe')]);module['exports']=router; \ No newline at end of file +var _0x74e0=['util','path','express','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','index','isAuthenticated','post','create','put','delete','/:id','destroy','exports','multer'];(function(_0x5c4ed9,_0x2475ea){var _0x3aded2=function(_0x465ba7){while(--_0x465ba7){_0x5c4ed9['push'](_0x5c4ed9['shift']());}};_0x3aded2(++_0x2475ea);}(_0x74e0,0xfb));var _0x074e=function(_0x4ade33,_0x103537){_0x4ade33=_0x4ade33-0x0;var _0x162cc1=_0x74e0[_0x4ade33];return _0x162cc1;};'use strict';var multer=require(_0x074e('0x0'));var util=require(_0x074e('0x1'));var path=require(_0x074e('0x2'));var timeout=require('connect-timeout');var express=require(_0x074e('0x3'));var router=express[_0x074e('0x4')]();var fs_extra=require(_0x074e('0x5'));var auth=require(_0x074e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x074e('0x7'));router[_0x074e('0x8')]('/',auth['isAuthenticated'](),controller[_0x074e('0x9')]);router[_0x074e('0x8')]('/:id',auth[_0x074e('0xa')](),controller['show']);router[_0x074e('0xb')]('/',auth[_0x074e('0xa')](),controller[_0x074e('0xc')]);router[_0x074e('0xd')]('/:id',auth[_0x074e('0xa')](),controller['update']);router[_0x074e('0xe')](_0x074e('0xf'),auth[_0x074e('0xa')](),controller[_0x074e('0x10')]);module[_0x074e('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index aae405b..a14401a 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 _0xca2b=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1d9992,_0x48ddc3){var _0x497c91=function(_0x1fbc80){while(--_0x1fbc80){_0x1d9992['push'](_0x1d9992['shift']());}};_0x497c91(++_0x48ddc3);}(_0xca2b,0x156));var _0xbca2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xca2b[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xbca2('0x0'));module[_0xbca2('0x1')]={'calldate':{'type':Sequelize[_0xbca2('0x2')],'allowNull':![],'defaultValue':_0xbca2('0x3')},'clid':{'type':Sequelize[_0xbca2('0x4')]},'src':{'type':Sequelize[_0xbca2('0x4')]},'dst':{'type':Sequelize[_0xbca2('0x4')]},'dcontext':{'type':Sequelize[_0xbca2('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xbca2('0x4')]},'lastapp':{'type':Sequelize[_0xbca2('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xbca2('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbca2('0x4')]},'amaflags':{'type':Sequelize[_0xbca2('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbca2('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xbca2('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbca2('0x4')]},'tag':{'type':Sequelize[_0xbca2('0x4')]}}; \ No newline at end of file +var _0x1e88=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x17d389,_0x2f85bf){var _0x28a0c4=function(_0x16d20d){while(--_0x16d20d){_0x17d389['push'](_0x17d389['shift']());}};_0x28a0c4(++_0x2f85bf);}(_0x1e88,0x1d3));var _0x81e8=function(_0x5edd12,_0x487384){_0x5edd12=_0x5edd12-0x0;var _0xda9649=_0x1e88[_0x5edd12];return _0xda9649;};'use strict';var Sequelize=require(_0x81e8('0x0'));module[_0x81e8('0x1')]={'calldate':{'type':Sequelize[_0x81e8('0x2')],'allowNull':![],'defaultValue':_0x81e8('0x3')},'clid':{'type':Sequelize[_0x81e8('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x81e8('0x4')]},'channel':{'type':Sequelize[_0x81e8('0x4')]},'dstchannel':{'type':Sequelize[_0x81e8('0x4')]},'lastapp':{'type':Sequelize[_0x81e8('0x4')]},'lastdata':{'type':Sequelize[_0x81e8('0x4')]},'duration':{'type':Sequelize[_0x81e8('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x81e8('0x4')]},'amaflags':{'type':Sequelize[_0x81e8('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x81e8('0x4')]},'userfield':{'type':Sequelize[_0x81e8('0x4')]},'uniqueid':{'type':Sequelize[_0x81e8('0x4')]},'linkedid':{'type':Sequelize[_0x81e8('0x4')]},'sequence':{'type':Sequelize[_0x81e8('0x4')]},'peeraccount':{'type':Sequelize[_0x81e8('0x4')]},'type':{'type':Sequelize[_0x81e8('0x4')]},'tag':{'type':Sequelize[_0x81e8('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index adbbd68..d81d363 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 _0xa7e6=['json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Cdr','include','rows','catch','show','params','includeAll','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','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x585e5f,_0x3fc02b){var _0x5264b3=function(_0x8ac830){while(--_0x8ac830){_0x585e5f['push'](_0x585e5f['shift']());}};_0x5264b3(++_0x3fc02b);}(_0xa7e6,0x74));var _0x6a7e=function(_0x3080e1,_0x1be003){_0x3080e1=_0x3080e1-0x0;var _0x386973=_0xa7e6[_0x3080e1];return _0x386973;};'use strict';var emlformat=require(_0x6a7e('0x0'));var rimraf=require(_0x6a7e('0x1'));var zipdir=require(_0x6a7e('0x2'));var jsonpatch=require(_0x6a7e('0x3'));var rp=require(_0x6a7e('0x4'));var moment=require(_0x6a7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6a7e('0x6'));var util=require(_0x6a7e('0x7'));var path=require(_0x6a7e('0x8'));var sox=require(_0x6a7e('0x9'));var csv=require(_0x6a7e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a7e('0xb'));var _=require(_0x6a7e('0xc'));var squel=require(_0x6a7e('0xd'));var crypto=require(_0x6a7e('0xe'));var jsforce=require(_0x6a7e('0xf'));var deskjs=require(_0x6a7e('0x10'));var toCsv=require(_0x6a7e('0xa'));var querystring=require(_0x6a7e('0x11'));var Papa=require(_0x6a7e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a7e('0x13'));var logger=require(_0x6a7e('0x14'))(_0x6a7e('0x15'));var utils=require(_0x6a7e('0x16'));var config=require(_0x6a7e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a7e('0x18'))['db'];function respondWithStatusCode(_0x4754ef,_0x5c0c74){_0x5c0c74=_0x5c0c74||0xcc;return function(_0x50dcc1){if(_0x50dcc1){return _0x4754ef[_0x6a7e('0x19')](_0x5c0c74);}return _0x4754ef[_0x6a7e('0x1a')](_0x5c0c74)[_0x6a7e('0x1b')]();};}function respondWithResult(_0x374763,_0x4faca9){_0x4faca9=_0x4faca9||0xc8;return function(_0x3137bc){if(_0x3137bc){return _0x374763[_0x6a7e('0x1a')](_0x4faca9)[_0x6a7e('0x1c')](_0x3137bc);}};}function respondWithFilteredResult(_0x4576fe,_0x465566){return function(_0x4b0893){if(_0x4b0893){var _0x16c9a5=typeof _0x465566['offset']==='undefined'&&typeof _0x465566[_0x6a7e('0x1d')]==='undefined';var _0x1d2abb=_0x4b0893[_0x6a7e('0x1e')];var _0x470197=_0x16c9a5?0x0:_0x465566[_0x6a7e('0x1f')];var _0x20e90a=_0x16c9a5?_0x4b0893['count']:_0x465566['offset']+_0x465566['limit'];var _0x102e83;if(_0x20e90a>=_0x1d2abb){_0x20e90a=_0x1d2abb;_0x102e83=0xc8;}else{_0x102e83=0xce;}_0x4576fe[_0x6a7e('0x1a')](_0x102e83);return _0x4576fe[_0x6a7e('0x20')](_0x6a7e('0x21'),_0x470197+'-'+_0x20e90a+'/'+_0x1d2abb)[_0x6a7e('0x1c')](_0x4b0893);}return null;};}function patchUpdates(_0x35b0ff){return function(_0x42eccc){try{jsonpatch[_0x6a7e('0x22')](_0x42eccc,_0x35b0ff,!![]);}catch(_0x5d5cbf){return BPromise[_0x6a7e('0x23')](_0x5d5cbf);}return _0x42eccc[_0x6a7e('0x24')]();};}function saveUpdates(_0x4f53c5,_0x3e1e64){return function(_0x3d0971){if(_0x3d0971){return _0x3d0971[_0x6a7e('0x25')](_0x4f53c5)['then'](function(_0x40c7f6){return _0x40c7f6;});}return null;};}function removeEntity(_0xd045ca,_0x4ee914){return function(_0x18f5e2){if(_0x18f5e2){return _0x18f5e2['destroy']()[_0x6a7e('0x26')](function(){_0xd045ca[_0x6a7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29db13,_0x956eb6){return function(_0x46a15f){if(!_0x46a15f){_0x29db13[_0x6a7e('0x19')](0x194);}return _0x46a15f;};}function handleError(_0x3498c5,_0x380f2f){_0x380f2f=_0x380f2f||0x1f4;return function(_0x573bdc){logger[_0x6a7e('0x27')](_0x573bdc[_0x6a7e('0x28')]);if(_0x573bdc[_0x6a7e('0x29')]){delete _0x573bdc[_0x6a7e('0x29')];}_0x3498c5[_0x6a7e('0x1a')](_0x380f2f)['send'](_0x573bdc);};}exports['index']=function(_0x8b0439,_0x2e86f8){var _0x2723d0={},_0x525376={},_0xa324d0={'count':0x0,'rows':[]};var _0x57e642=_[_0x6a7e('0x2a')](db['Cdr']['rawAttributes'],function(_0x15c2b8){return{'name':_0x15c2b8['fieldName'],'type':_0x15c2b8[_0x6a7e('0x2b')]['key']};});_0x525376['model']=_[_0x6a7e('0x2a')](_0x57e642,_0x6a7e('0x29'));_0x525376[_0x6a7e('0x2c')]=_[_0x6a7e('0x2d')](_0x8b0439[_0x6a7e('0x2c')]);_0x525376[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],_0x525376[_0x6a7e('0x2c')]);_0x2723d0[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],qs['fields'](_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x32')]));_0x2723d0[_0x6a7e('0x31')]=_0x2723d0['attributes'][_0x6a7e('0x33')]?_0x2723d0[_0x6a7e('0x31')]:_0x525376[_0x6a7e('0x30')];if(!_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x34')](_0x6a7e('0x35'))){_0x2723d0['limit']=qs['limit'](_0x8b0439[_0x6a7e('0x2c')]['limit']);_0x2723d0[_0x6a7e('0x1f')]=qs[_0x6a7e('0x1f')](_0x8b0439['query']['offset']);}_0x2723d0['order']=qs[_0x6a7e('0x36')](_0x8b0439['query']['sort']);_0x2723d0['where']=qs['filters'](_[_0x6a7e('0x37')](_0x8b0439['query'],_0x525376[_0x6a7e('0x2e')]),_0x57e642);if(_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]){_0x2723d0[_0x6a7e('0x39')]=_[_0x6a7e('0x3a')](_0x2723d0['where'],{'$or':_[_0x6a7e('0x2a')](_0x57e642,function(_0x1db4e3){if(_0x1db4e3['type']!==_0x6a7e('0x3b')){var _0x2f58ac={};_0x2f58ac[_0x1db4e3['name']]={'$like':'%'+_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]+'%'};return _0x2f58ac;}})});}_0x2723d0=_[_0x6a7e('0x3a')]({},_0x2723d0,_0x8b0439[_0x6a7e('0x3c')]);var _0x2827f7={'where':_0x2723d0[_0x6a7e('0x39')]};return db[_0x6a7e('0x3d')][_0x6a7e('0x1e')](_0x2827f7)[_0x6a7e('0x26')](function(_0x27434a){_0xa324d0[_0x6a7e('0x1e')]=_0x27434a;if(_0x8b0439['query']['includeAll']){_0x2723d0[_0x6a7e('0x3e')]=[{'all':!![]}];}return db[_0x6a7e('0x3d')]['findAll'](_0x2723d0);})[_0x6a7e('0x26')](function(_0x46799d){_0xa324d0[_0x6a7e('0x3f')]=_0x46799d;return _0xa324d0;})[_0x6a7e('0x26')](respondWithFilteredResult(_0x2e86f8,_0x2723d0))[_0x6a7e('0x40')](handleError(_0x2e86f8,null));};exports[_0x6a7e('0x41')]=function(_0x3d7266,_0x14cae5){var _0x2a3d31={'raw':!![],'where':{'id':_0x3d7266[_0x6a7e('0x42')]['id']}},_0x247efb={};_0x247efb[_0x6a7e('0x30')]=_[_0x6a7e('0x2d')](db[_0x6a7e('0x3d')]['rawAttributes']);_0x247efb['query']=_[_0x6a7e('0x2d')](_0x3d7266[_0x6a7e('0x2c')]);_0x247efb[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x247efb[_0x6a7e('0x30')],_0x247efb[_0x6a7e('0x2c')]);_0x2a3d31[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x247efb['model'],qs[_0x6a7e('0x32')](_0x3d7266['query'][_0x6a7e('0x32')]));_0x2a3d31[_0x6a7e('0x31')]=_0x2a3d31[_0x6a7e('0x31')][_0x6a7e('0x33')]?_0x2a3d31['attributes']:_0x247efb[_0x6a7e('0x30')];if(_0x3d7266[_0x6a7e('0x2c')][_0x6a7e('0x43')]){_0x2a3d31['include']=[{'all':!![]}];}_0x2a3d31=_[_0x6a7e('0x3a')]({},_0x2a3d31,_0x3d7266['options']);return db[_0x6a7e('0x3d')][_0x6a7e('0x44')](_0x2a3d31)[_0x6a7e('0x26')](handleEntityNotFound(_0x14cae5,null))[_0x6a7e('0x26')](respondWithResult(_0x14cae5,null))['catch'](handleError(_0x14cae5,null));};exports[_0x6a7e('0x45')]=function(_0x47369f,_0x188ab5){return db[_0x6a7e('0x3d')]['create'](_0x47369f[_0x6a7e('0x46')],{})['then'](respondWithResult(_0x188ab5,0xc9))[_0x6a7e('0x40')](handleError(_0x188ab5,null));};exports[_0x6a7e('0x25')]=function(_0x25c2bb,_0x4a7465){if(_0x25c2bb[_0x6a7e('0x46')]['id']){delete _0x25c2bb['body']['id'];}return db[_0x6a7e('0x3d')]['find']({'where':{'id':_0x25c2bb[_0x6a7e('0x42')]['id']}})[_0x6a7e('0x26')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0x26')](saveUpdates(_0x25c2bb[_0x6a7e('0x46')],null))[_0x6a7e('0x26')](respondWithResult(_0x4a7465,null))[_0x6a7e('0x40')](handleError(_0x4a7465,null));};exports['destroy']=function(_0x3d4395,_0x54f72b){return db[_0x6a7e('0x3d')][_0x6a7e('0x44')]({'where':{'id':_0x3d4395['params']['id']}})['then'](handleEntityNotFound(_0x54f72b,null))[_0x6a7e('0x26')](removeEntity(_0x54f72b,null))[_0x6a7e('0x40')](handleError(_0x54f72b,null));};exports[_0x6a7e('0x47')]=function(_0x251076,_0x43f5ac){return db['Cdr'][_0x6a7e('0x47')]()[_0x6a7e('0x26')](respondWithResult(_0x43f5ac,null))[_0x6a7e('0x40')](handleError(_0x43f5ac,null));}; \ No newline at end of file +var _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4f0a48,_0x1e47d3){_0x4f0a48=_0x4f0a48-0x0;var _0x52384c=_0x6b8f[_0x4f0a48];return _0x52384c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e67e822..736fdac 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(_0x24b716,_0x62a194){var _0x3ce4ac=function(_0x522a84){while(--_0x522a84){_0x24b716['push'](_0x24b716['shift']());}};_0x3ce4ac(++_0x62a194);}(_0x7a54,0x106));var _0x47a5=function(_0xfe5c43,_0x1708b4){_0xfe5c43=_0xfe5c43-0x0;var _0x57cfeb=_0x7a54[_0xfe5c43];return _0x57cfeb;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x412985,_0x1e3b48){var _0x1d10f2=function(_0x2215f3){while(--_0x2215f3){_0x412985['push'](_0x412985['shift']());}};_0x1d10f2(++_0x1e3b48);}(_0x7a54,0x106));var _0x47a5=function(_0xd26d28,_0x1d2e2){_0xd26d28=_0xd26d28-0x0;var _0x412edf=_0x7a54[_0xd26d28];return _0x412edf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 27f3579..66412bd 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 _0xe754=['debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Cdr,\x20%s,\x20%s','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe754,0x13a));var _0x4e75=function(_0x53a200,_0x2bde43){_0x53a200=_0x53a200-0x0;var _0x4d1124=_0xe754[_0x53a200];return _0x4d1124;};'use strict';var _=require(_0x4e75('0x0'));var util=require(_0x4e75('0x1'));var moment=require('moment');var BPromise=require(_0x4e75('0x2'));var rs=require(_0x4e75('0x3'));var fs=require('fs');var Redis=require(_0x4e75('0x4'));var db=require(_0x4e75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4e75('0x6'));var client=jayson[_0x4e75('0x7')][_0x4e75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bc51d,_0x29f3ab,_0x5736d9){return new BPromise(function(_0x4dea18,_0x5166b3){return client[_0x4e75('0x9')](_0x4bc51d,_0x5736d9)['then'](function(_0x2677b3){logger['info']('Cdr,\x20%s,\x20%s',_0x29f3ab,'request\x20sent');logger[_0x4e75('0xa')](_0x4e75('0xb'),_0x29f3ab,_0x4e75('0xc'),JSON[_0x4e75('0xd')](_0x2677b3));if(_0x2677b3[_0x4e75('0xe')]){if(_0x2677b3[_0x4e75('0xe')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x29f3ab,_0x2677b3[_0x4e75('0xe')]['message']);return _0x5166b3(_0x2677b3[_0x4e75('0xe')][_0x4e75('0xf')]);}logger['error'](_0x4e75('0x10'),_0x29f3ab,_0x2677b3[_0x4e75('0xe')][_0x4e75('0xf')]);return _0x4dea18(_0x2677b3['error']['message']);}else{logger[_0x4e75('0x11')](_0x4e75('0x10'),_0x29f3ab,_0x4e75('0xc'));_0x4dea18(_0x2677b3['result'][_0x4e75('0xf')]);}})['catch'](function(_0x32c41a){logger[_0x4e75('0xe')](_0x4e75('0x10'),_0x29f3ab,_0x32c41a);_0x5166b3(_0x32c41a);});});} \ No newline at end of file +var _0x8c98=['../../config/utils','rpc','../../config/environment','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x12d773,_0x253abd){var _0x152e37=function(_0x51b1f2){while(--_0x51b1f2){_0x12d773['push'](_0x12d773['shift']());}};_0x152e37(++_0x253abd);}(_0x8c98,0x12e));var _0x88c9=function(_0x3b7ecb,_0x289d8c){_0x3b7ecb=_0x3b7ecb-0x0;var _0x45c8bc=_0x8c98[_0x3b7ecb];return _0x45c8bc;};'use strict';var _=require(_0x88c9('0x0'));var util=require(_0x88c9('0x1'));var moment=require(_0x88c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x88c9('0x3'));var fs=require('fs');var Redis=require(_0x88c9('0x4'));var db=require(_0x88c9('0x5'))['db'];var utils=require(_0x88c9('0x6'));var logger=require('../../config/logger')(_0x88c9('0x7'));var config=require(_0x88c9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x88c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22f026,_0x57f9ba,_0x1614fb){return new BPromise(function(_0x646216,_0x3b9959){return client[_0x88c9('0xa')](_0x22f026,_0x1614fb)[_0x88c9('0xb')](function(_0x3c26a5){logger[_0x88c9('0xc')](_0x88c9('0xd'),_0x57f9ba,_0x88c9('0xe'));logger[_0x88c9('0xf')](_0x88c9('0x10'),_0x57f9ba,_0x88c9('0xe'),JSON['stringify'](_0x3c26a5));if(_0x3c26a5[_0x88c9('0x11')]){if(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x12')]===0x1f4){logger[_0x88c9('0x11')]('Cdr,\x20%s,\x20%s',_0x57f9ba,_0x3c26a5['error']['message']);return _0x3b9959(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);}logger['error'](_0x88c9('0xd'),_0x57f9ba,_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);return _0x646216(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);}else{logger[_0x88c9('0xc')](_0x88c9('0xd'),_0x57f9ba,_0x88c9('0xe'));_0x646216(_0x3c26a5[_0x88c9('0x14')]['message']);}})[_0x88c9('0x15')](function(_0x5ef0fe){logger['error']('Cdr,\x20%s,\x20%s',_0x57f9ba,_0x5ef0fe);_0x3b9959(_0x5ef0fe);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ddf6888..0682690 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('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 48a55f1..c8dd502 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 _0xd9f1=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x5108ba,_0x54bf77){var _0x3cfa10=function(_0xe68083){while(--_0xe68083){_0x5108ba['push'](_0x5108ba['shift']());}};_0x3cfa10(++_0x54bf77);}(_0xd9f1,0x178));var _0x1d9f=function(_0x27fce9,_0x55a249){_0x27fce9=_0x27fce9-0x0;var _0x28ce11=_0xd9f1[_0x27fce9];return _0x28ce11;};'use strict';var Sequelize=require(_0x1d9f('0x0'));module[_0x1d9f('0x1')]={'priority':{'type':Sequelize[_0x1d9f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d9f('0x3')},'appdata':{'type':Sequelize[_0x1d9f('0x4')]()},'description':{'type':Sequelize[_0x1d9f('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1d9f('0x6')}}; \ No newline at end of file +var _0x6ecb=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x6ecb,0x12e));var _0xb6ec=function(_0x484a09,_0x31b700){_0x484a09=_0x484a09-0x0;var _0x16ea35=_0x6ecb[_0x484a09];return _0x16ea35;};'use strict';var Sequelize=require(_0xb6ec('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb6ec('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb6ec('0x2')],'allowNull':![],'defaultValue':_0xb6ec('0x3')},'appdata':{'type':Sequelize[_0xb6ec('0x4')]()},'description':{'type':Sequelize[_0xb6ec('0x2')]},'interval':{'type':Sequelize[_0xb6ec('0x2')],'defaultValue':_0xb6ec('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index afb0b7c..6e9d8b0 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 _0x4e5c=['merge','options','then','catch','body','eml-format','zip-dir','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','save','update','destroy','error','stack','name','send','params','keys','ChatApplication','query','intersection','model','fields','attributes','length','includeAll','include'];(function(_0x43cc50,_0x1b7bd1){var _0x2fb4b5=function(_0x1f11a0){while(--_0x1f11a0){_0x43cc50['push'](_0x43cc50['shift']());}};_0x2fb4b5(++_0x1b7bd1);}(_0x4e5c,0x149));var _0xc4e5=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x4e5c[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require(_0xc4e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4e5('0x2'));var moment=require(_0xc4e5('0x3'));var BPromise=require(_0xc4e5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc4e5('0x5'));var csv=require(_0xc4e5('0x6'));var ejs=require(_0xc4e5('0x7'));var fs=require('fs');var fs_extra=require(_0xc4e5('0x8'));var _=require(_0xc4e5('0x9'));var squel=require(_0xc4e5('0xa'));var crypto=require(_0xc4e5('0xb'));var jsforce=require(_0xc4e5('0xc'));var deskjs=require(_0xc4e5('0xd'));var toCsv=require(_0xc4e5('0x6'));var querystring=require(_0xc4e5('0xe'));var Papa=require(_0xc4e5('0xf'));var Redis=require('ioredis');var authService=require(_0xc4e5('0x10'));var qs=require(_0xc4e5('0x11'));var as=require(_0xc4e5('0x12'));var hardwareService=require(_0xc4e5('0x13'));var logger=require('../../config/logger')(_0xc4e5('0x14'));var utils=require(_0xc4e5('0x15'));var config=require(_0xc4e5('0x16'));var licenseUtil=require(_0xc4e5('0x17'));var db=require(_0xc4e5('0x18'))['db'];function respondWithStatusCode(_0x418b8b,_0x3fa318){_0x3fa318=_0x3fa318||0xcc;return function(_0x54c5a7){if(_0x54c5a7){return _0x418b8b['sendStatus'](_0x3fa318);}return _0x418b8b[_0xc4e5('0x19')](_0x3fa318)['end']();};}function respondWithResult(_0x3f8150,_0x7cd002){_0x7cd002=_0x7cd002||0xc8;return function(_0x303037){if(_0x303037){return _0x3f8150[_0xc4e5('0x19')](_0x7cd002)['json'](_0x303037);}};}function respondWithFilteredResult(_0x1b7d62,_0x528de4){return function(_0x338c37){if(_0x338c37){var _0x3beb59=typeof _0x528de4[_0xc4e5('0x1a')]===_0xc4e5('0x1b')&&typeof _0x528de4[_0xc4e5('0x1c')]===_0xc4e5('0x1b');var _0x228232=_0x338c37[_0xc4e5('0x1d')];var _0x170c0c=_0x3beb59?0x0:_0x528de4['offset'];var _0x252b5a=_0x3beb59?_0x338c37[_0xc4e5('0x1d')]:_0x528de4['offset']+_0x528de4[_0xc4e5('0x1c')];var _0x33eef8;if(_0x252b5a>=_0x228232){_0x252b5a=_0x228232;_0x33eef8=0xc8;}else{_0x33eef8=0xce;}_0x1b7d62['status'](_0x33eef8);return _0x1b7d62[_0xc4e5('0x1e')]('Content-Range',_0x170c0c+'-'+_0x252b5a+'/'+_0x228232)['json'](_0x338c37);}return null;};}function patchUpdates(_0x2f2970){return function(_0x7dbe6d){try{jsonpatch['apply'](_0x7dbe6d,_0x2f2970,!![]);}catch(_0x34f4e8){return BPromise['reject'](_0x34f4e8);}return _0x7dbe6d[_0xc4e5('0x1f')]();};}function saveUpdates(_0x37e869,_0x505078){return function(_0x546949){if(_0x546949){return _0x546949[_0xc4e5('0x20')](_0x37e869)['then'](function(_0x69cb24){return _0x69cb24;});}return null;};}function removeEntity(_0x41467f,_0x4bb973){return function(_0x4ed1ff){if(_0x4ed1ff){return _0x4ed1ff[_0xc4e5('0x21')]()['then'](function(){_0x41467f[_0xc4e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460fd8,_0x234b31){return function(_0x53f7cd){if(!_0x53f7cd){_0x460fd8['sendStatus'](0x194);}return _0x53f7cd;};}function handleError(_0x4b379b,_0x23889c){_0x23889c=_0x23889c||0x1f4;return function(_0x183ec7){logger[_0xc4e5('0x22')](_0x183ec7[_0xc4e5('0x23')]);if(_0x183ec7[_0xc4e5('0x24')]){delete _0x183ec7[_0xc4e5('0x24')];}_0x4b379b[_0xc4e5('0x19')](_0x23889c)[_0xc4e5('0x25')](_0x183ec7);};}exports['show']=function(_0x1cd4d9,_0x2ad4be){var _0x261b88={'raw':!![],'where':{'id':_0x1cd4d9[_0xc4e5('0x26')]['id']}},_0x23383b={};_0x23383b['model']=_[_0xc4e5('0x27')](db[_0xc4e5('0x28')]['rawAttributes']);_0x23383b[_0xc4e5('0x29')]=_['keys'](_0x1cd4d9[_0xc4e5('0x29')]);_0x23383b['filters']=_[_0xc4e5('0x2a')](_0x23383b['model'],_0x23383b[_0xc4e5('0x29')]);_0x261b88['attributes']=_['intersection'](_0x23383b[_0xc4e5('0x2b')],qs[_0xc4e5('0x2c')](_0x1cd4d9[_0xc4e5('0x29')][_0xc4e5('0x2c')]));_0x261b88['attributes']=_0x261b88[_0xc4e5('0x2d')][_0xc4e5('0x2e')]?_0x261b88[_0xc4e5('0x2d')]:_0x23383b[_0xc4e5('0x2b')];if(_0x1cd4d9['query'][_0xc4e5('0x2f')]){_0x261b88[_0xc4e5('0x30')]=[{'all':!![]}];}_0x261b88=_[_0xc4e5('0x31')]({},_0x261b88,_0x1cd4d9[_0xc4e5('0x32')]);return db[_0xc4e5('0x28')]['find'](_0x261b88)[_0xc4e5('0x33')](handleEntityNotFound(_0x2ad4be,null))[_0xc4e5('0x33')](respondWithResult(_0x2ad4be,null))[_0xc4e5('0x34')](handleError(_0x2ad4be,null));};exports['update']=function(_0x44551b,_0x1c78ec){if(_0x44551b[_0xc4e5('0x35')]['id']){delete _0x44551b[_0xc4e5('0x35')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x44551b[_0xc4e5('0x26')]['id']}})[_0xc4e5('0x33')](handleEntityNotFound(_0x1c78ec,null))[_0xc4e5('0x33')](saveUpdates(_0x44551b[_0xc4e5('0x35')],null))[_0xc4e5('0x33')](respondWithResult(_0x1c78ec,null))[_0xc4e5('0x34')](handleError(_0x1c78ec,null));};exports[_0xc4e5('0x21')]=function(_0x2439ee,_0x20bbce){return db['ChatApplication']['find']({'where':{'id':_0x2439ee[_0xc4e5('0x26')]['id']}})[_0xc4e5('0x33')](handleEntityNotFound(_0x20bbce,null))[_0xc4e5('0x33')](removeEntity(_0x20bbce,null))[_0xc4e5('0x34')](handleError(_0x20bbce,null));}; \ No newline at end of file +var _0x8ce8=['send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8ce8,0xd3));var _0x88ce=function(_0x516ab4,_0x3a8d82){_0x516ab4=_0x516ab4-0x0;var _0x23fff3=_0x8ce8[_0x516ab4];return _0x23fff3;};'use strict';var emlformat=require(_0x88ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ce('0x1'));var jsonpatch=require(_0x88ce('0x2'));var rp=require(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var Mustache=require(_0x88ce('0x6'));var util=require(_0x88ce('0x7'));var path=require(_0x88ce('0x8'));var sox=require(_0x88ce('0x9'));var csv=require(_0x88ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x88ce('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e336a,_0x3b67c8){_0x3b67c8=_0x3b67c8||0xcc;return function(_0x50b088){if(_0x50b088){return _0x3e336a['sendStatus'](_0x3b67c8);}return _0x3e336a[_0x88ce('0x1a')](_0x3b67c8)[_0x88ce('0x1b')]();};}function respondWithResult(_0x12e8af,_0xad722b){_0xad722b=_0xad722b||0xc8;return function(_0x417896){if(_0x417896){return _0x12e8af[_0x88ce('0x1a')](_0xad722b)[_0x88ce('0x1c')](_0x417896);}};}function respondWithFilteredResult(_0x48ebd3,_0x3460e5){return function(_0x5bcd5a){if(_0x5bcd5a){var _0x3da93e=typeof _0x3460e5['offset']===_0x88ce('0x1d')&&typeof _0x3460e5[_0x88ce('0x1e')]===_0x88ce('0x1d');var _0x34b0e4=_0x5bcd5a['count'];var _0x50c9df=_0x3da93e?0x0:_0x3460e5[_0x88ce('0x1f')];var _0x65fa81=_0x3da93e?_0x5bcd5a[_0x88ce('0x20')]:_0x3460e5[_0x88ce('0x1f')]+_0x3460e5[_0x88ce('0x1e')];var _0x37f31;if(_0x65fa81>=_0x34b0e4){_0x65fa81=_0x34b0e4;_0x37f31=0xc8;}else{_0x37f31=0xce;}_0x48ebd3[_0x88ce('0x1a')](_0x37f31);return _0x48ebd3[_0x88ce('0x21')](_0x88ce('0x22'),_0x50c9df+'-'+_0x65fa81+'/'+_0x34b0e4)[_0x88ce('0x1c')](_0x5bcd5a);}return null;};}function patchUpdates(_0x106e59){return function(_0x7de0ac){try{jsonpatch[_0x88ce('0x23')](_0x7de0ac,_0x106e59,!![]);}catch(_0x397ee5){return BPromise[_0x88ce('0x24')](_0x397ee5);}return _0x7de0ac[_0x88ce('0x25')]();};}function saveUpdates(_0x4daac4,_0x356d7d){return function(_0x34fbcc){if(_0x34fbcc){return _0x34fbcc[_0x88ce('0x26')](_0x4daac4)[_0x88ce('0x27')](function(_0x33711e){return _0x33711e;});}return null;};}function removeEntity(_0x4e45eb,_0x4c9133){return function(_0x4dcdc4){if(_0x4dcdc4){return _0x4dcdc4[_0x88ce('0x28')]()[_0x88ce('0x27')](function(){_0x4e45eb[_0x88ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e35db,_0x1f0adc){return function(_0x3383fa){if(!_0x3383fa){_0x4e35db[_0x88ce('0x29')](0x194);}return _0x3383fa;};}function handleError(_0x357247,_0x4b30db){_0x4b30db=_0x4b30db||0x1f4;return function(_0x1efcea){logger[_0x88ce('0x2a')](_0x1efcea[_0x88ce('0x2b')]);if(_0x1efcea[_0x88ce('0x2c')]){delete _0x1efcea[_0x88ce('0x2c')];}_0x357247[_0x88ce('0x1a')](_0x4b30db)[_0x88ce('0x2d')](_0x1efcea);};}exports[_0x88ce('0x2e')]=function(_0x29698a,_0x12b9a1){var _0x1814d1={'raw':!![],'where':{'id':_0x29698a[_0x88ce('0x2f')]['id']}},_0x47bbff={};_0x47bbff['model']=_[_0x88ce('0x30')](db[_0x88ce('0x31')][_0x88ce('0x32')]);_0x47bbff[_0x88ce('0x33')]=_['keys'](_0x29698a[_0x88ce('0x33')]);_0x47bbff[_0x88ce('0x34')]=_[_0x88ce('0x35')](_0x47bbff[_0x88ce('0x36')],_0x47bbff[_0x88ce('0x33')]);_0x1814d1[_0x88ce('0x37')]=_[_0x88ce('0x35')](_0x47bbff['model'],qs[_0x88ce('0x38')](_0x29698a[_0x88ce('0x33')]['fields']));_0x1814d1[_0x88ce('0x37')]=_0x1814d1[_0x88ce('0x37')][_0x88ce('0x39')]?_0x1814d1[_0x88ce('0x37')]:_0x47bbff[_0x88ce('0x36')];if(_0x29698a[_0x88ce('0x33')][_0x88ce('0x3a')]){_0x1814d1[_0x88ce('0x3b')]=[{'all':!![]}];}_0x1814d1=_[_0x88ce('0x3c')]({},_0x1814d1,_0x29698a['options']);return db[_0x88ce('0x31')][_0x88ce('0x3d')](_0x1814d1)[_0x88ce('0x27')](handleEntityNotFound(_0x12b9a1,null))['then'](respondWithResult(_0x12b9a1,null))[_0x88ce('0x3e')](handleError(_0x12b9a1,null));};exports[_0x88ce('0x26')]=function(_0x545a50,_0x4910f0){if(_0x545a50[_0x88ce('0x3f')]['id']){delete _0x545a50[_0x88ce('0x3f')]['id'];}return db[_0x88ce('0x31')][_0x88ce('0x3d')]({'where':{'id':_0x545a50[_0x88ce('0x2f')]['id']}})[_0x88ce('0x27')](handleEntityNotFound(_0x4910f0,null))['then'](saveUpdates(_0x545a50[_0x88ce('0x3f')],null))[_0x88ce('0x27')](respondWithResult(_0x4910f0,null))['catch'](handleError(_0x4910f0,null));};exports[_0x88ce('0x28')]=function(_0xe0ddfa,_0x55e1c4){return db[_0x88ce('0x31')]['find']({'where':{'id':_0xe0ddfa[_0x88ce('0x2f')]['id']}})[_0x88ce('0x27')](handleEntityNotFound(_0x55e1c4,null))[_0x88ce('0x27')](removeEntity(_0x55e1c4,null))[_0x88ce('0x3e')](handleError(_0x55e1c4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7cc4b66..7f64f9c 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 _0x0587=['api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x306f3e,_0x5e3f27){var _0x37f45a=function(_0x961c58){while(--_0x961c58){_0x306f3e['push'](_0x306f3e['shift']());}};_0x37f45a(++_0x5e3f27);}(_0x0587,0x11d));var _0x7058=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x0587[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x7058('0x0'));var util=require(_0x7058('0x1'));var logger=require(_0x7058('0x2'))(_0x7058('0x3'));var moment=require(_0x7058('0x4'));var BPromise=require(_0x7058('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7058('0x6'));var rimraf=require(_0x7058('0x7'));var config=require(_0x7058('0x8'));var attributes=require(_0x7058('0x9'));module[_0x7058('0xa')]=function(_0x1acc16,_0x2c0060){return _0x1acc16[_0x7058('0xb')](_0x7058('0xc'),attributes,{'tableName':_0x7058('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7058('0xe'),'collate':_0x7058('0xf')});}; \ No newline at end of file +var _0x5bfe=['exports','chat_applications','utf8mb4','util','../../config/logger','bluebird','path','rimraf','./chatApplication.attributes'];(function(_0x32703c,_0x17c57c){var _0x50489d=function(_0x4a8b2a){while(--_0x4a8b2a){_0x32703c['push'](_0x32703c['shift']());}};_0x50489d(++_0x17c57c);}(_0x5bfe,0x9c));var _0xe5bf=function(_0x18a5ba,_0x532863){_0x18a5ba=_0x18a5ba-0x0;var _0x287a75=_0x5bfe[_0x18a5ba];return _0x287a75;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var logger=require(_0xe5bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe5bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5bf('0x3'));var rimraf=require(_0xe5bf('0x4'));var config=require('../../config/environment');var attributes=require(_0xe5bf('0x5'));module[_0xe5bf('0x6')]=function(_0x2b48c4,_0x3d4aa9){return _0x2b48c4['define']('ChatApplication',attributes,{'tableName':_0xe5bf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5bf('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1fac610..7618cc1 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 _0x19bd=['error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a5a1a,_0x1063d0){var _0x1a76f4=function(_0x49dfdc){while(--_0x49dfdc){_0x2a5a1a['push'](_0x2a5a1a['shift']());}};_0x1a76f4(++_0x1063d0);}(_0x19bd,0xd5));var _0xd19b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x19bd[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xd19b('0x0'));var util=require(_0xd19b('0x1'));var moment=require(_0xd19b('0x2'));var BPromise=require(_0xd19b('0x3'));var rs=require(_0xd19b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd19b('0x5'))['db'];var utils=require(_0xd19b('0x6'));var logger=require('../../config/logger')(_0xd19b('0x7'));var config=require(_0xd19b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd19b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6604d4,_0x597c7d,_0x330399){return new BPromise(function(_0x1541e0,_0x296286){return client[_0xd19b('0xa')](_0x6604d4,_0x330399)[_0xd19b('0xb')](function(_0x294e3b){logger[_0xd19b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x597c7d,_0xd19b('0xd'));logger[_0xd19b('0xe')](_0xd19b('0xf'),_0x597c7d,'request\x20sent',JSON[_0xd19b('0x10')](_0x294e3b));if(_0x294e3b[_0xd19b('0x11')]){if(_0x294e3b[_0xd19b('0x11')][_0xd19b('0x12')]===0x1f4){logger[_0xd19b('0x11')](_0xd19b('0x13'),_0x597c7d,_0x294e3b['error']['message']);return _0x296286(_0x294e3b['error'][_0xd19b('0x14')]);}logger[_0xd19b('0x11')](_0xd19b('0x13'),_0x597c7d,_0x294e3b['error'][_0xd19b('0x14')]);return _0x1541e0(_0x294e3b[_0xd19b('0x11')][_0xd19b('0x14')]);}else{logger[_0xd19b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x597c7d,_0xd19b('0xd'));_0x1541e0(_0x294e3b[_0xd19b('0x15')]['message']);}})[_0xd19b('0x16')](function(_0xc33bf9){logger[_0xd19b('0x11')](_0xd19b('0x13'),_0x597c7d,_0xc33bf9);_0x296286(_0xc33bf9);});});} \ No newline at end of file +var _0xb56d=['message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x299d09,_0x1fdf9d){var _0x3754cb=function(_0x2b211b){while(--_0x2b211b){_0x299d09['push'](_0x299d09['shift']());}};_0x3754cb(++_0x1fdf9d);}(_0xb56d,0x1e7));var _0xdb56=function(_0x26dea1,_0x1d68ba){_0x26dea1=_0x26dea1-0x0;var _0x3da162=_0xb56d[_0x26dea1];return _0x3da162;};'use strict';var _=require('lodash');var util=require(_0xdb56('0x0'));var moment=require(_0xdb56('0x1'));var BPromise=require(_0xdb56('0x2'));var rs=require(_0xdb56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb56('0x5'))('rpc');var config=require(_0xdb56('0x6'));var jayson=require(_0xdb56('0x7'));var client=jayson['client'][_0xdb56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9e88,_0xe913de,_0x2c9987){return new BPromise(function(_0x1b2bec,_0x12f1a6){return client['request'](_0x5d9e88,_0x2c9987)[_0xdb56('0x9')](function(_0x3e6c19){logger[_0xdb56('0xa')](_0xdb56('0xb'),_0xe913de,'request\x20sent');logger[_0xdb56('0xc')](_0xdb56('0xd'),_0xe913de,'request\x20sent',JSON[_0xdb56('0xe')](_0x3e6c19));if(_0x3e6c19[_0xdb56('0xf')]){if(_0x3e6c19['error'][_0xdb56('0x10')]===0x1f4){logger['error'](_0xdb56('0xb'),_0xe913de,_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);return _0x12f1a6(_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0xe913de,_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);return _0x1b2bec(_0x3e6c19['error'][_0xdb56('0x11')]);}else{logger[_0xdb56('0xa')](_0xdb56('0xb'),_0xe913de,_0xdb56('0x12'));_0x1b2bec(_0x3e6c19[_0xdb56('0x13')]['message']);}})[_0xdb56('0x14')](function(_0x10e2b3){logger[_0xdb56('0xf')](_0xdb56('0xb'),_0xe913de,_0x10e2b3);_0x12f1a6(_0x10e2b3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ae07cfe..d93b4fd 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 _0x710a=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports'];(function(_0x159890,_0x5ac7b0){var _0x214c47=function(_0xa3e181){while(--_0xa3e181){_0x159890['push'](_0x159890['shift']());}};_0x214c47(++_0x5ac7b0);}(_0x710a,0xd2));var _0xa710=function(_0x50b09c,_0xe560e6){_0x50b09c=_0x50b09c-0x0;var _0xb3b724=_0x710a[_0x50b09c];return _0xb3b724;};'use strict';var multer=require('multer');var util=require(_0xa710('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa710('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa710('0x2'));var interaction=require(_0xa710('0x3'));var config=require(_0xa710('0x4'));var controller=require(_0xa710('0x5'));router[_0xa710('0x6')]('/:id',auth[_0xa710('0x7')](),controller[_0xa710('0x8')]);router[_0xa710('0x9')](_0xa710('0xa'),auth[_0xa710('0x7')](),controller[_0xa710('0xb')]);router[_0xa710('0xc')](_0xa710('0xa'),auth['isAuthenticated'](),controller[_0xa710('0xd')]);module[_0xa710('0xe')]=router; \ No newline at end of file +var _0x8b6b=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','util'];(function(_0x5bf06e,_0x24abf1){var _0x374a73=function(_0x256e8f){while(--_0x256e8f){_0x5bf06e['push'](_0x5bf06e['shift']());}};_0x374a73(++_0x24abf1);}(_0x8b6b,0x149));var _0xb8b6=function(_0x42323a,_0x432571){_0x42323a=_0x42323a-0x0;var _0x1d253c=_0x8b6b[_0x42323a];return _0x1d253c;};'use strict';var multer=require('multer');var util=require(_0xb8b6('0x0'));var path=require(_0xb8b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb8b6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb8b6('0x3'));var interaction=require(_0xb8b6('0x4'));var config=require(_0xb8b6('0x5'));var controller=require(_0xb8b6('0x6'));router[_0xb8b6('0x7')](_0xb8b6('0x8'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xa')]);router[_0xb8b6('0xb')](_0xb8b6('0x8'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xc')]);router[_0xb8b6('0xd')](_0xb8b6('0x8'),auth['isAuthenticated'](),controller[_0xb8b6('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7126a1c..7538c05 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 _0xe2fe=['sequelize','STRING'];(function(_0x143a91,_0x235332){var _0x1906f5=function(_0xd27eeb){while(--_0xd27eeb){_0x143a91['push'](_0x143a91['shift']());}};_0x1906f5(++_0x235332);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xee2f('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0xd15876,_0x4690d9){var _0x267815=function(_0x3ee56a){while(--_0x3ee56a){_0xd15876['push'](_0xd15876['shift']());}};_0x267815(++_0x4690d9);}(_0xe706,0x1ab));var _0x6e70=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0xe706[_0x3eb450];return _0x2c4cfd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a92d7db..8c589d1 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 _0xdad8=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','sendStatus','error','name','map','ChatGroup','type','key','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','describe','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatInternalMessage','$gte','format','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x565a23,_0x1f7b1c){var _0x3e5d70=function(_0x1b3f97){while(--_0x1b3f97){_0x565a23['push'](_0x565a23['shift']());}};_0x3e5d70(++_0x1f7b1c);}(_0xdad8,0xfb));var _0x8dad=function(_0x849edd,_0x19b879){_0x849edd=_0x849edd-0x0;var _0x4f68b7=_0xdad8[_0x849edd];return _0x4f68b7;};'use strict';var emlformat=require(_0x8dad('0x0'));var rimraf=require(_0x8dad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dad('0x2'));var rp=require(_0x8dad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8dad('0x4'));var util=require(_0x8dad('0x5'));var path=require(_0x8dad('0x6'));var sox=require(_0x8dad('0x7'));var csv=require('to-csv');var ejs=require(_0x8dad('0x8'));var fs=require('fs');var fs_extra=require(_0x8dad('0x9'));var _=require(_0x8dad('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8dad('0xb'));var toCsv=require(_0x8dad('0xc'));var querystring=require('querystring');var Papa=require(_0x8dad('0xd'));var Redis=require(_0x8dad('0xe'));var authService=require(_0x8dad('0xf'));var qs=require(_0x8dad('0x10'));var as=require(_0x8dad('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8dad('0x12'));var utils=require(_0x8dad('0x13'));var config=require(_0x8dad('0x14'));var licenseUtil=require(_0x8dad('0x15'));var db=require('../../mysqldb')['db'];config[_0x8dad('0x16')]=_['defaults'](config[_0x8dad('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dad('0x17'))(new Redis(config[_0x8dad('0x16')]));require(_0x8dad('0x18'))[_0x8dad('0x19')](socket);function respondWithStatusCode(_0x2d0024,_0x2366c1){_0x2366c1=_0x2366c1||0xcc;return function(_0xa570e9){if(_0xa570e9){return _0x2d0024['sendStatus'](_0x2366c1);}return _0x2d0024[_0x8dad('0x1a')](_0x2366c1)[_0x8dad('0x1b')]();};}function respondWithResult(_0x463843,_0x5c579a){_0x5c579a=_0x5c579a||0xc8;return function(_0x317904){if(_0x317904){return _0x463843[_0x8dad('0x1a')](_0x5c579a)['json'](_0x317904);}};}function respondWithFilteredResult(_0x176295,_0x2d8513){return function(_0x347361){if(_0x347361){var _0x7e487c=typeof _0x2d8513[_0x8dad('0x1c')]===_0x8dad('0x1d')&&typeof _0x2d8513[_0x8dad('0x1e')]===_0x8dad('0x1d');var _0x258cc1=_0x347361[_0x8dad('0x1f')];var _0xecf2ea=_0x7e487c?0x0:_0x2d8513['offset'];var _0x454b76=_0x7e487c?_0x347361['count']:_0x2d8513[_0x8dad('0x1c')]+_0x2d8513[_0x8dad('0x1e')];var _0x4bce8c;if(_0x454b76>=_0x258cc1){_0x454b76=_0x258cc1;_0x4bce8c=0xc8;}else{_0x4bce8c=0xce;}_0x176295[_0x8dad('0x1a')](_0x4bce8c);return _0x176295[_0x8dad('0x20')](_0x8dad('0x21'),_0xecf2ea+'-'+_0x454b76+'/'+_0x258cc1)['json'](_0x347361);}return null;};}function patchUpdates(_0x4ad232){return function(_0x1e8fbf){try{jsonpatch['apply'](_0x1e8fbf,_0x4ad232,!![]);}catch(_0x3171be){return BPromise[_0x8dad('0x22')](_0x3171be);}return _0x1e8fbf[_0x8dad('0x23')]();};}function saveUpdates(_0x141aef,_0x363ee9){return function(_0x15d3e8){if(_0x15d3e8){return _0x15d3e8[_0x8dad('0x24')](_0x141aef)['then'](function(_0x5baf3d){return _0x5baf3d;});}return null;};}function removeEntity(_0x5104c2,_0x4c6709){return function(_0xb3c015){if(_0xb3c015){return _0xb3c015[_0x8dad('0x25')]()['then'](function(){_0x5104c2['status'](0xcc)[_0x8dad('0x1b')]();});}};}function handleEntityNotFound(_0x163eaa,_0x3bfef2){return function(_0x5f03e1){if(!_0x5f03e1){_0x163eaa[_0x8dad('0x26')](0x194);}return _0x5f03e1;};}function handleError(_0x54b0b9,_0x23982e){_0x23982e=_0x23982e||0x1f4;return function(_0x5759d8){logger[_0x8dad('0x27')](_0x5759d8['stack']);if(_0x5759d8[_0x8dad('0x28')]){delete _0x5759d8['name'];}_0x54b0b9[_0x8dad('0x1a')](_0x23982e)['send'](_0x5759d8);};}exports['index']=function(_0x497842,_0x42bc45){var _0x321dee={},_0x211ed1={},_0x54f8e1={'count':0x0,'rows':[]};var _0x2b2a65=_[_0x8dad('0x29')](db[_0x8dad('0x2a')]['rawAttributes'],function(_0x1f98ca){return{'name':_0x1f98ca['fieldName'],'type':_0x1f98ca[_0x8dad('0x2b')][_0x8dad('0x2c')]};});_0x211ed1['model']=_['map'](_0x2b2a65,_0x8dad('0x28'));_0x211ed1[_0x8dad('0x2d')]=_['keys'](_0x497842[_0x8dad('0x2d')]);_0x211ed1['filters']=_[_0x8dad('0x2e')](_0x211ed1['model'],_0x211ed1[_0x8dad('0x2d')]);_0x321dee['attributes']=_['intersection'](_0x211ed1['model'],qs[_0x8dad('0x2f')](_0x497842['query'][_0x8dad('0x2f')]));_0x321dee['attributes']=_0x321dee[_0x8dad('0x30')][_0x8dad('0x31')]?_0x321dee['attributes']:_0x211ed1[_0x8dad('0x32')];if(!_0x497842[_0x8dad('0x2d')][_0x8dad('0x33')](_0x8dad('0x34'))){_0x321dee[_0x8dad('0x1e')]=qs[_0x8dad('0x1e')](_0x497842['query'][_0x8dad('0x1e')]);_0x321dee[_0x8dad('0x1c')]=qs['offset'](_0x497842[_0x8dad('0x2d')]['offset']);}_0x321dee[_0x8dad('0x35')]=qs[_0x8dad('0x36')](_0x497842[_0x8dad('0x2d')][_0x8dad('0x36')]);_0x321dee[_0x8dad('0x37')]=qs[_0x8dad('0x38')](_['pick'](_0x497842[_0x8dad('0x2d')],_0x211ed1[_0x8dad('0x38')]),_0x2b2a65);if(_0x497842['query'][_0x8dad('0x39')]){_0x321dee[_0x8dad('0x37')]=_[_0x8dad('0x3a')](_0x321dee[_0x8dad('0x37')],{'$or':_[_0x8dad('0x29')](_0x2b2a65,function(_0x376fcc){if(_0x376fcc[_0x8dad('0x2b')]!==_0x8dad('0x3b')){var _0x48734c={};_0x48734c[_0x376fcc[_0x8dad('0x28')]]={'$like':'%'+_0x497842[_0x8dad('0x2d')][_0x8dad('0x39')]+'%'};return _0x48734c;}})});}_0x321dee=_[_0x8dad('0x3a')]({},_0x321dee,_0x497842[_0x8dad('0x3c')]);var _0x4671e1={'where':_0x321dee[_0x8dad('0x37')]};return db[_0x8dad('0x2a')][_0x8dad('0x1f')](_0x4671e1)[_0x8dad('0x3d')](function(_0xc9311e){_0x54f8e1[_0x8dad('0x1f')]=_0xc9311e;if(_0x497842[_0x8dad('0x2d')][_0x8dad('0x3e')]){_0x321dee['include']=[{'all':!![]}];}return db[_0x8dad('0x2a')][_0x8dad('0x3f')](_0x321dee);})[_0x8dad('0x3d')](function(_0x171ff6){_0x54f8e1[_0x8dad('0x40')]=_0x171ff6;return _0x54f8e1;})['then'](respondWithFilteredResult(_0x42bc45,_0x321dee))[_0x8dad('0x41')](handleError(_0x42bc45,null));};exports[_0x8dad('0x42')]=function(_0x8ce3a3,_0x147b06){var _0x1e6b18={'raw':!![],'where':{'id':_0x8ce3a3[_0x8dad('0x43')]['id']}},_0x9e763={};_0x9e763[_0x8dad('0x32')]=_['keys'](db[_0x8dad('0x2a')][_0x8dad('0x44')]);_0x9e763[_0x8dad('0x2d')]=_[_0x8dad('0x45')](_0x8ce3a3[_0x8dad('0x2d')]);_0x9e763['filters']=_[_0x8dad('0x2e')](_0x9e763['model'],_0x9e763[_0x8dad('0x2d')]);_0x1e6b18[_0x8dad('0x30')]=_[_0x8dad('0x2e')](_0x9e763[_0x8dad('0x32')],qs[_0x8dad('0x2f')](_0x8ce3a3[_0x8dad('0x2d')][_0x8dad('0x2f')]));_0x1e6b18[_0x8dad('0x30')]=_0x1e6b18[_0x8dad('0x30')][_0x8dad('0x31')]?_0x1e6b18['attributes']:_0x9e763['model'];if(_0x8ce3a3[_0x8dad('0x2d')][_0x8dad('0x3e')]){_0x1e6b18[_0x8dad('0x46')]=[{'all':!![]}];}_0x1e6b18=_['merge']({},_0x1e6b18,_0x8ce3a3[_0x8dad('0x3c')]);return db[_0x8dad('0x2a')][_0x8dad('0x47')](_0x1e6b18)[_0x8dad('0x3d')](handleEntityNotFound(_0x147b06,null))['then'](respondWithResult(_0x147b06,null))[_0x8dad('0x41')](handleError(_0x147b06,null));};exports[_0x8dad('0x48')]=function(_0x2d8859,_0x441bc8){return db[_0x8dad('0x2a')][_0x8dad('0x48')](_0x2d8859[_0x8dad('0x49')],{})[_0x8dad('0x3d')](respondWithResult(_0x441bc8,0xc9))['catch'](handleError(_0x441bc8,null));};exports[_0x8dad('0x24')]=function(_0x3e99a2,_0x44346a){if(_0x3e99a2[_0x8dad('0x49')]['id']){delete _0x3e99a2[_0x8dad('0x49')]['id'];}return db[_0x8dad('0x2a')]['find']({'where':{'id':_0x3e99a2[_0x8dad('0x43')]['id']}})[_0x8dad('0x3d')](handleEntityNotFound(_0x44346a,null))['then'](saveUpdates(_0x3e99a2['body'],null))['then'](respondWithResult(_0x44346a,null))[_0x8dad('0x41')](handleError(_0x44346a,null));};exports[_0x8dad('0x25')]=function(_0x49a594,_0x40c32e){return db[_0x8dad('0x2a')]['find']({'where':{'id':_0x49a594[_0x8dad('0x43')]['id']}})['then'](handleEntityNotFound(_0x40c32e,null))[_0x8dad('0x3d')](removeEntity(_0x40c32e,null))[_0x8dad('0x41')](handleError(_0x40c32e,null));};exports[_0x8dad('0x4a')]=function(_0x1fe81e,_0x10d765){return db[_0x8dad('0x2a')][_0x8dad('0x4a')]()['then'](respondWithResult(_0x10d765,null))[_0x8dad('0x41')](handleError(_0x10d765,null));};exports['getUnread']=function(_0xd77bef,_0x58839a,_0x8ac6bf){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0xd77bef['params']['id'],'ToId':_0xd77bef[_0x8dad('0x4b')]['id'],'read':![]}})['then'](function(_0xe38d10){return{'id':_[_0x8dad('0x4c')](_0xd77bef['params']['id']),'count':_0xe38d10};})['then'](respondWithResult(_0x58839a,null))['catch'](handleError(_0x58839a,null));};exports['addMembers']=function(_0x2ec9b6,_0x912789,_0x39f520){return db['ChatGroup'][_0x8dad('0x47')]({'where':{'id':_0x2ec9b6[_0x8dad('0x43')]['id']}})[_0x8dad('0x3d')](handleEntityNotFound(_0x912789,null))[_0x8dad('0x3d')](function(_0x23e901){if(_0x23e901){return _0x23e901[_0x8dad('0x4d')](_0x2ec9b6['body'][_0x8dad('0x4e')],_[_0x8dad('0x4f')](_0x2ec9b6['body'],['ids','id'])||{});}})[_0x8dad('0x3d')](respondWithResult(_0x912789,null))[_0x8dad('0x41')](handleError(_0x912789,null));};exports[_0x8dad('0x50')]=function(_0x29cfd2,_0x3e2b78,_0x1c0288){var _0xb197e={};var _0x100a40={};var _0x94f6f9;var _0x3c6821;return db['ChatGroup'][_0x8dad('0x51')]({'where':{'id':_0x29cfd2[_0x8dad('0x43')]['id']}})[_0x8dad('0x3d')](handleEntityNotFound(_0x3e2b78,null))[_0x8dad('0x3d')](function(_0x2b7753){if(_0x2b7753){_0x94f6f9=_0x2b7753;_0x100a40[_0x8dad('0x32')]=_['keys'](db[_0x8dad('0x52')][_0x8dad('0x44')]);_0x100a40[_0x8dad('0x2d')]=_['keys'](_0x29cfd2[_0x8dad('0x2d')]);_0x100a40[_0x8dad('0x38')]=_[_0x8dad('0x2e')](_0x100a40[_0x8dad('0x32')],_0x100a40[_0x8dad('0x2d')]);_0xb197e[_0x8dad('0x30')]=_['intersection'](_0x100a40[_0x8dad('0x32')],qs[_0x8dad('0x2f')](_0x29cfd2[_0x8dad('0x2d')][_0x8dad('0x2f')]));_0xb197e[_0x8dad('0x30')]=_0xb197e[_0x8dad('0x30')][_0x8dad('0x31')]?_0xb197e['attributes']:_0x100a40[_0x8dad('0x32')];_0xb197e[_0x8dad('0x35')]=qs[_0x8dad('0x36')](_0x29cfd2[_0x8dad('0x2d')][_0x8dad('0x36')]);_0xb197e[_0x8dad('0x37')]=qs[_0x8dad('0x38')](_[_0x8dad('0x53')](_0x29cfd2['query'],_0x100a40[_0x8dad('0x38')]));if(_0x29cfd2[_0x8dad('0x2d')][_0x8dad('0x39')]){_0xb197e[_0x8dad('0x37')]=_[_0x8dad('0x3a')](_0xb197e['where'],{'$or':_[_0x8dad('0x29')](_0xb197e['attributes'],function(_0x1d97a9){var _0x309771={};_0x309771[_0x1d97a9]={'$like':'%'+_0x29cfd2[_0x8dad('0x2d')][_0x8dad('0x39')]+'%'};return _0x309771;})});}_0xb197e=_['merge']({},_0xb197e,_0x29cfd2[_0x8dad('0x3c')]);return _0x94f6f9[_0x8dad('0x50')](_0xb197e);}})[_0x8dad('0x3d')](function(_0x181e5e){if(_0x181e5e){_0x3c6821=_0x181e5e[_0x8dad('0x31')];if(!_0x29cfd2[_0x8dad('0x2d')]['hasOwnProperty'](_0x8dad('0x34'))){_0xb197e[_0x8dad('0x1e')]=qs[_0x8dad('0x1e')](_0x29cfd2['query'][_0x8dad('0x1e')]);_0xb197e[_0x8dad('0x1c')]=qs[_0x8dad('0x1c')](_0x29cfd2[_0x8dad('0x2d')]['offset']);}return _0x94f6f9[_0x8dad('0x50')](_0xb197e);}})['then'](function(_0x2ce1cd){if(_0x2ce1cd){return _0x2ce1cd?{'count':_0x3c6821,'rows':_0x2ce1cd}:null;}})['then'](respondWithResult(_0x3e2b78,null))[_0x8dad('0x41')](handleError(_0x3e2b78,null));};exports[_0x8dad('0x54')]=function(_0x369f92,_0x127531,_0x2e6662){return db['ChatGroup'][_0x8dad('0x47')]({'where':{'id':_0x369f92[_0x8dad('0x43')]['id']}})['then'](handleEntityNotFound(_0x127531,null))['then'](function(_0x550eea){if(_0x550eea){return _0x550eea['removeMembers'](_0x369f92['query']['ids']);}})[_0x8dad('0x3d')](respondWithStatusCode(_0x127531,null))[_0x8dad('0x41')](handleError(_0x127531,null));};exports[_0x8dad('0x55')]=function(_0x556982,_0x59278c,_0x215f38){if(_0x556982['body']['id']){delete _0x556982[_0x8dad('0x49')]['id'];}return db['ChatGroup'][_0x8dad('0x47')]({'where':{'id':_0x556982[_0x8dad('0x43')]['id']}})[_0x8dad('0x3d')](handleEntityNotFound(_0x59278c,null))[_0x8dad('0x3d')](function(_0x742877){if(_0x742877){_0x556982[_0x8dad('0x49')]['ChatGroupId']=_0x742877['id'];return db[_0x8dad('0x56')][_0x8dad('0x48')](_0x556982['body']);}})[_0x8dad('0x3d')](respondWithResult(_0x59278c,null))[_0x8dad('0x41')](handleError(_0x59278c,null));};exports['getMessages']=function(_0x10e9ba,_0x43685c,_0x1fdf3e){var _0x108b9f={};var _0x5932ec={};var _0x4f8520;var _0x2da4f3;return db[_0x8dad('0x2a')][_0x8dad('0x51')]({'where':{'id':_0x10e9ba['params']['id']}})[_0x8dad('0x3d')](handleEntityNotFound(_0x43685c,null))['then'](function(_0x3f4e02){if(_0x3f4e02){_0x4f8520=_0x3f4e02;_0x5932ec[_0x8dad('0x32')]=_[_0x8dad('0x45')](db[_0x8dad('0x56')]['rawAttributes']);_0x5932ec[_0x8dad('0x2d')]=_['keys'](_0x10e9ba[_0x8dad('0x2d')]);_0x5932ec['filters']=_[_0x8dad('0x2e')](_0x5932ec['model'],_0x5932ec[_0x8dad('0x2d')]);_0x108b9f[_0x8dad('0x30')]=_['intersection'](_0x5932ec[_0x8dad('0x32')],qs[_0x8dad('0x2f')](_0x10e9ba['query'][_0x8dad('0x2f')]));_0x108b9f[_0x8dad('0x30')]=_0x108b9f['attributes'][_0x8dad('0x31')]?_0x108b9f[_0x8dad('0x30')]:_0x5932ec[_0x8dad('0x32')];_0x108b9f[_0x8dad('0x35')]=qs['sort'](_0x10e9ba[_0x8dad('0x2d')]['sort']);_0x108b9f[_0x8dad('0x37')]=qs[_0x8dad('0x38')](_[_0x8dad('0x53')](_0x10e9ba[_0x8dad('0x2d')],_0x5932ec[_0x8dad('0x38')]));if(_0x10e9ba[_0x8dad('0x2d')]['filter']){_0x108b9f[_0x8dad('0x37')]=_['merge'](_0x108b9f['where'],{'$or':_[_0x8dad('0x29')](_0x108b9f['attributes'],function(_0x1ff6fe){var _0x580a37={};_0x580a37[_0x1ff6fe]={'$like':'%'+_0x10e9ba['query']['filter']+'%'};return _0x580a37;})});}if(_0x10e9ba[_0x8dad('0x2d')]['$gte']){var _0x265e72=_0x10e9ba[_0x8dad('0x2d')][_0x8dad('0x57')]['split'](',');var _0x3a3430={};_0x3a3430[_0x265e72[0x0]]={'$gte':moment(_0x265e72[0x1])[_0x8dad('0x58')]('YYYY-MM-DD\x20HH:mm:ss')};_0x108b9f[_0x8dad('0x37')]=_[_0x8dad('0x3a')](_0x108b9f['where'],_0x3a3430);}_0x108b9f=_[_0x8dad('0x3a')]({},_0x108b9f,_0x10e9ba[_0x8dad('0x3c')]);return _0x4f8520['getMessages'](_0x108b9f);}})[_0x8dad('0x3d')](function(_0x4ec303){if(_0x4ec303){_0x2da4f3=_0x4ec303[_0x8dad('0x31')];if(!_0x10e9ba[_0x8dad('0x2d')][_0x8dad('0x33')](_0x8dad('0x34'))){_0x108b9f[_0x8dad('0x1e')]=qs['limit'](_0x10e9ba['query']['limit']);_0x108b9f[_0x8dad('0x1c')]=qs[_0x8dad('0x1c')](_0x10e9ba[_0x8dad('0x2d')][_0x8dad('0x1c')]);}return _0x4f8520['getMessages'](_0x108b9f);}})['then'](function(_0x462768){if(_0x462768){return _0x462768?{'count':_0x2da4f3,'rows':_0x462768}:null;}})[_0x8dad('0x3d')](respondWithResult(_0x43685c,null))[_0x8dad('0x41')](handleError(_0x43685c,null));}; \ No newline at end of file +var _0x055d=['register','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','options','include','rows','catch','show','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','params','omit','ids','getMembers','findOne','User','filter','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket'];(function(_0x52456c,_0x2bea26){var _0x3040d9=function(_0x1f31ab){while(--_0x1f31ab){_0x52456c['push'](_0x52456c['shift']());}};_0x3040d9(++_0x2bea26);}(_0x055d,0x103));var _0xd055=function(_0x2d99ca,_0x36a2e0){_0x2d99ca=_0x2d99ca-0x0;var _0x5574e3=_0x055d[_0x2d99ca];return _0x5574e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd055('0x0'));var zipdir=require(_0xd055('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd055('0x2'));var moment=require(_0xd055('0x3'));var BPromise=require(_0xd055('0x4'));var Mustache=require(_0xd055('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd055('0x6'));var csv=require(_0xd055('0x7'));var ejs=require(_0xd055('0x8'));var fs=require('fs');var fs_extra=require(_0xd055('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd055('0xa'));var jsforce=require(_0xd055('0xb'));var deskjs=require(_0xd055('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd055('0xd'));var Papa=require(_0xd055('0xe'));var Redis=require(_0xd055('0xf'));var authService=require(_0xd055('0x10'));var qs=require(_0xd055('0x11'));var as=require(_0xd055('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd055('0x13'))(_0xd055('0x14'));var utils=require(_0xd055('0x15'));var config=require(_0xd055('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd055('0x17'))['db'];config['redis']=_[_0xd055('0x18')](config['redis'],{'host':_0xd055('0x19'),'port':0x18eb});var socket=require(_0xd055('0x1a'))(new Redis(config[_0xd055('0x1b')]));require(_0xd055('0x1c'))[_0xd055('0x1d')](socket);function respondWithStatusCode(_0x18b95a,_0x5e522b){_0x5e522b=_0x5e522b||0xcc;return function(_0x1bb3ca){if(_0x1bb3ca){return _0x18b95a[_0xd055('0x1e')](_0x5e522b);}return _0x18b95a[_0xd055('0x1f')](_0x5e522b)[_0xd055('0x20')]();};}function respondWithResult(_0x4a485f,_0x302071){_0x302071=_0x302071||0xc8;return function(_0x1a1dd9){if(_0x1a1dd9){return _0x4a485f[_0xd055('0x1f')](_0x302071)['json'](_0x1a1dd9);}};}function respondWithFilteredResult(_0x17121f,_0x24c9ea){return function(_0x4a24a9){if(_0x4a24a9){var _0x312f56=typeof _0x24c9ea[_0xd055('0x21')]===_0xd055('0x22')&&typeof _0x24c9ea[_0xd055('0x23')]==='undefined';var _0x5df396=_0x4a24a9[_0xd055('0x24')];var _0x19cf72=_0x312f56?0x0:_0x24c9ea[_0xd055('0x21')];var _0x275436=_0x312f56?_0x4a24a9[_0xd055('0x24')]:_0x24c9ea['offset']+_0x24c9ea[_0xd055('0x23')];var _0x458fef;if(_0x275436>=_0x5df396){_0x275436=_0x5df396;_0x458fef=0xc8;}else{_0x458fef=0xce;}_0x17121f['status'](_0x458fef);return _0x17121f[_0xd055('0x25')]('Content-Range',_0x19cf72+'-'+_0x275436+'/'+_0x5df396)[_0xd055('0x26')](_0x4a24a9);}return null;};}function patchUpdates(_0x4c12f2){return function(_0x38d9da){try{jsonpatch['apply'](_0x38d9da,_0x4c12f2,!![]);}catch(_0x457c61){return BPromise[_0xd055('0x27')](_0x457c61);}return _0x38d9da['save']();};}function saveUpdates(_0x29b66d,_0x461582){return function(_0x447c18){if(_0x447c18){return _0x447c18[_0xd055('0x28')](_0x29b66d)[_0xd055('0x29')](function(_0x14e63d){return _0x14e63d;});}return null;};}function removeEntity(_0x1732e3,_0x29a81a){return function(_0x5bb1c2){if(_0x5bb1c2){return _0x5bb1c2[_0xd055('0x2a')]()[_0xd055('0x29')](function(){_0x1732e3[_0xd055('0x1f')](0xcc)[_0xd055('0x20')]();});}};}function handleEntityNotFound(_0x36fc30,_0x4e85fb){return function(_0x5a5dd9){if(!_0x5a5dd9){_0x36fc30[_0xd055('0x1e')](0x194);}return _0x5a5dd9;};}function handleError(_0x1d9f6a,_0x41b2c6){_0x41b2c6=_0x41b2c6||0x1f4;return function(_0x5aa97f){logger[_0xd055('0x2b')](_0x5aa97f[_0xd055('0x2c')]);if(_0x5aa97f['name']){delete _0x5aa97f[_0xd055('0x2d')];}_0x1d9f6a[_0xd055('0x1f')](_0x41b2c6)[_0xd055('0x2e')](_0x5aa97f);};}exports[_0xd055('0x2f')]=function(_0x2dbf63,_0x2bd7f6){var _0x5a4d77={},_0x54c500={},_0xbe157c={'count':0x0,'rows':[]};var _0xbb0c2=_[_0xd055('0x30')](db[_0xd055('0x31')][_0xd055('0x32')],function(_0xb3f02a){return{'name':_0xb3f02a[_0xd055('0x33')],'type':_0xb3f02a[_0xd055('0x34')][_0xd055('0x35')]};});_0x54c500[_0xd055('0x36')]=_[_0xd055('0x30')](_0xbb0c2,_0xd055('0x2d'));_0x54c500[_0xd055('0x37')]=_[_0xd055('0x38')](_0x2dbf63[_0xd055('0x37')]);_0x54c500[_0xd055('0x39')]=_[_0xd055('0x3a')](_0x54c500[_0xd055('0x36')],_0x54c500[_0xd055('0x37')]);_0x5a4d77['attributes']=_[_0xd055('0x3a')](_0x54c500['model'],qs[_0xd055('0x3b')](_0x2dbf63['query'][_0xd055('0x3b')]));_0x5a4d77['attributes']=_0x5a4d77[_0xd055('0x3c')][_0xd055('0x3d')]?_0x5a4d77[_0xd055('0x3c')]:_0x54c500[_0xd055('0x36')];if(!_0x2dbf63[_0xd055('0x37')]['hasOwnProperty'](_0xd055('0x3e'))){_0x5a4d77[_0xd055('0x23')]=qs['limit'](_0x2dbf63[_0xd055('0x37')][_0xd055('0x23')]);_0x5a4d77[_0xd055('0x21')]=qs['offset'](_0x2dbf63[_0xd055('0x37')]['offset']);}_0x5a4d77[_0xd055('0x3f')]=qs[_0xd055('0x40')](_0x2dbf63[_0xd055('0x37')][_0xd055('0x40')]);_0x5a4d77[_0xd055('0x41')]=qs[_0xd055('0x39')](_[_0xd055('0x42')](_0x2dbf63[_0xd055('0x37')],_0x54c500[_0xd055('0x39')]),_0xbb0c2);if(_0x2dbf63[_0xd055('0x37')]['filter']){_0x5a4d77[_0xd055('0x41')]=_[_0xd055('0x43')](_0x5a4d77[_0xd055('0x41')],{'$or':_['map'](_0xbb0c2,function(_0x56adcf){if(_0x56adcf['type']!=='VIRTUAL'){var _0x158635={};_0x158635[_0x56adcf['name']]={'$like':'%'+_0x2dbf63[_0xd055('0x37')]['filter']+'%'};return _0x158635;}})});}_0x5a4d77=_[_0xd055('0x43')]({},_0x5a4d77,_0x2dbf63[_0xd055('0x44')]);var _0x58221d={'where':_0x5a4d77[_0xd055('0x41')]};return db['ChatGroup'][_0xd055('0x24')](_0x58221d)[_0xd055('0x29')](function(_0x175f63){_0xbe157c[_0xd055('0x24')]=_0x175f63;if(_0x2dbf63[_0xd055('0x37')]['includeAll']){_0x5a4d77[_0xd055('0x45')]=[{'all':!![]}];}return db[_0xd055('0x31')]['findAll'](_0x5a4d77);})[_0xd055('0x29')](function(_0x43c6c5){_0xbe157c[_0xd055('0x46')]=_0x43c6c5;return _0xbe157c;})['then'](respondWithFilteredResult(_0x2bd7f6,_0x5a4d77))[_0xd055('0x47')](handleError(_0x2bd7f6,null));};exports[_0xd055('0x48')]=function(_0x2804e6,_0x1ba175){var _0x9d4b63={'raw':!![],'where':{'id':_0x2804e6['params']['id']}},_0xefed18={};_0xefed18[_0xd055('0x36')]=_[_0xd055('0x38')](db[_0xd055('0x31')][_0xd055('0x32')]);_0xefed18[_0xd055('0x37')]=_[_0xd055('0x38')](_0x2804e6['query']);_0xefed18['filters']=_[_0xd055('0x3a')](_0xefed18['model'],_0xefed18[_0xd055('0x37')]);_0x9d4b63[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0xefed18[_0xd055('0x36')],qs['fields'](_0x2804e6[_0xd055('0x37')]['fields']));_0x9d4b63[_0xd055('0x3c')]=_0x9d4b63['attributes'][_0xd055('0x3d')]?_0x9d4b63['attributes']:_0xefed18['model'];if(_0x2804e6[_0xd055('0x37')]['includeAll']){_0x9d4b63['include']=[{'all':!![]}];}_0x9d4b63=_[_0xd055('0x43')]({},_0x9d4b63,_0x2804e6[_0xd055('0x44')]);return db[_0xd055('0x31')][_0xd055('0x49')](_0x9d4b63)[_0xd055('0x29')](handleEntityNotFound(_0x1ba175,null))['then'](respondWithResult(_0x1ba175,null))[_0xd055('0x47')](handleError(_0x1ba175,null));};exports[_0xd055('0x4a')]=function(_0xe89ec5,_0x5605d8){return db[_0xd055('0x31')][_0xd055('0x4a')](_0xe89ec5[_0xd055('0x4b')],{})[_0xd055('0x29')](respondWithResult(_0x5605d8,0xc9))['catch'](handleError(_0x5605d8,null));};exports['update']=function(_0x4e0f53,_0x406234){if(_0x4e0f53[_0xd055('0x4b')]['id']){delete _0x4e0f53[_0xd055('0x4b')]['id'];}return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x4e0f53['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x406234,null))[_0xd055('0x29')](saveUpdates(_0x4e0f53[_0xd055('0x4b')],null))[_0xd055('0x29')](respondWithResult(_0x406234,null))['catch'](handleError(_0x406234,null));};exports['destroy']=function(_0x13e747,_0x22ef69){return db[_0xd055('0x31')]['find']({'where':{'id':_0x13e747['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x22ef69,null))[_0xd055('0x29')](removeEntity(_0x22ef69,null))[_0xd055('0x47')](handleError(_0x22ef69,null));};exports['describe']=function(_0x1e8b50,_0x5ea1bd){return db['ChatGroup'][_0xd055('0x4c')]()[_0xd055('0x29')](respondWithResult(_0x5ea1bd,null))[_0xd055('0x47')](handleError(_0x5ea1bd,null));};exports[_0xd055('0x4d')]=function(_0x30cf1d,_0x2990e4,_0x5e15a7){return db[_0xd055('0x4e')][_0xd055('0x24')]({'where':{'ChatGroupId':_0x30cf1d['params']['id'],'ToId':_0x30cf1d[_0xd055('0x4f')]['id'],'read':![]}})[_0xd055('0x29')](function(_0x1205ed){return{'id':_['toInteger'](_0x30cf1d['params']['id']),'count':_0x1205ed};})[_0xd055('0x29')](respondWithResult(_0x2990e4,null))['catch'](handleError(_0x2990e4,null));};exports[_0xd055('0x50')]=function(_0xa1f45f,_0x4fcfc0,_0x27d52a){return db[_0xd055('0x31')]['find']({'where':{'id':_0xa1f45f[_0xd055('0x51')]['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x4fcfc0,null))[_0xd055('0x29')](function(_0xdca925){if(_0xdca925){return _0xdca925['addMembers'](_0xa1f45f['body']['ids'],_[_0xd055('0x52')](_0xa1f45f[_0xd055('0x4b')],[_0xd055('0x53'),'id'])||{});}})[_0xd055('0x29')](respondWithResult(_0x4fcfc0,null))[_0xd055('0x47')](handleError(_0x4fcfc0,null));};exports[_0xd055('0x54')]=function(_0x1c750b,_0x655a5,_0x3e29b1){var _0xf0b0c1={};var _0x6da66b={};var _0x4b96af;var _0x5d87fc;return db[_0xd055('0x31')][_0xd055('0x55')]({'where':{'id':_0x1c750b[_0xd055('0x51')]['id']}})['then'](handleEntityNotFound(_0x655a5,null))[_0xd055('0x29')](function(_0x249edc){if(_0x249edc){_0x4b96af=_0x249edc;_0x6da66b[_0xd055('0x36')]=_[_0xd055('0x38')](db[_0xd055('0x56')][_0xd055('0x32')]);_0x6da66b[_0xd055('0x37')]=_[_0xd055('0x38')](_0x1c750b[_0xd055('0x37')]);_0x6da66b[_0xd055('0x39')]=_[_0xd055('0x3a')](_0x6da66b[_0xd055('0x36')],_0x6da66b[_0xd055('0x37')]);_0xf0b0c1[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0x6da66b[_0xd055('0x36')],qs['fields'](_0x1c750b[_0xd055('0x37')][_0xd055('0x3b')]));_0xf0b0c1[_0xd055('0x3c')]=_0xf0b0c1[_0xd055('0x3c')][_0xd055('0x3d')]?_0xf0b0c1['attributes']:_0x6da66b['model'];_0xf0b0c1[_0xd055('0x3f')]=qs['sort'](_0x1c750b[_0xd055('0x37')]['sort']);_0xf0b0c1[_0xd055('0x41')]=qs[_0xd055('0x39')](_[_0xd055('0x42')](_0x1c750b[_0xd055('0x37')],_0x6da66b[_0xd055('0x39')]));if(_0x1c750b[_0xd055('0x37')][_0xd055('0x57')]){_0xf0b0c1[_0xd055('0x41')]=_[_0xd055('0x43')](_0xf0b0c1[_0xd055('0x41')],{'$or':_[_0xd055('0x30')](_0xf0b0c1['attributes'],function(_0x55dcd0){var _0xe3dae={};_0xe3dae[_0x55dcd0]={'$like':'%'+_0x1c750b[_0xd055('0x37')][_0xd055('0x57')]+'%'};return _0xe3dae;})});}_0xf0b0c1=_[_0xd055('0x43')]({},_0xf0b0c1,_0x1c750b['options']);return _0x4b96af[_0xd055('0x54')](_0xf0b0c1);}})[_0xd055('0x29')](function(_0x4e8d36){if(_0x4e8d36){_0x5d87fc=_0x4e8d36[_0xd055('0x3d')];if(!_0x1c750b[_0xd055('0x37')][_0xd055('0x58')]('nolimit')){_0xf0b0c1[_0xd055('0x23')]=qs['limit'](_0x1c750b[_0xd055('0x37')][_0xd055('0x23')]);_0xf0b0c1[_0xd055('0x21')]=qs[_0xd055('0x21')](_0x1c750b[_0xd055('0x37')][_0xd055('0x21')]);}return _0x4b96af[_0xd055('0x54')](_0xf0b0c1);}})[_0xd055('0x29')](function(_0x51a7ce){if(_0x51a7ce){return _0x51a7ce?{'count':_0x5d87fc,'rows':_0x51a7ce}:null;}})[_0xd055('0x29')](respondWithResult(_0x655a5,null))[_0xd055('0x47')](handleError(_0x655a5,null));};exports[_0xd055('0x59')]=function(_0x47550e,_0x2cc944,_0x1cfe6d){return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x47550e[_0xd055('0x51')]['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x2cc944,null))[_0xd055('0x29')](function(_0x32d877){if(_0x32d877){return _0x32d877[_0xd055('0x59')](_0x47550e[_0xd055('0x37')][_0xd055('0x53')]);}})[_0xd055('0x29')](respondWithStatusCode(_0x2cc944,null))[_0xd055('0x47')](handleError(_0x2cc944,null));};exports[_0xd055('0x5a')]=function(_0x739a8c,_0x47369d,_0x3eda5d){if(_0x739a8c[_0xd055('0x4b')]['id']){delete _0x739a8c[_0xd055('0x4b')]['id'];}return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x739a8c[_0xd055('0x51')]['id']}})['then'](handleEntityNotFound(_0x47369d,null))['then'](function(_0x33d1b2){if(_0x33d1b2){_0x739a8c[_0xd055('0x4b')][_0xd055('0x5b')]=_0x33d1b2['id'];return db[_0xd055('0x4e')]['create'](_0x739a8c[_0xd055('0x4b')]);}})[_0xd055('0x29')](respondWithResult(_0x47369d,null))[_0xd055('0x47')](handleError(_0x47369d,null));};exports[_0xd055('0x5c')]=function(_0x97636a,_0x674a6d,_0x4a747d){var _0x23db21={};var _0x1e4fe6={};var _0xa818b0;var _0x4346ef;return db[_0xd055('0x31')][_0xd055('0x55')]({'where':{'id':_0x97636a['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x674a6d,null))[_0xd055('0x29')](function(_0xb0dcf3){if(_0xb0dcf3){_0xa818b0=_0xb0dcf3;_0x1e4fe6[_0xd055('0x36')]=_['keys'](db[_0xd055('0x4e')][_0xd055('0x32')]);_0x1e4fe6[_0xd055('0x37')]=_[_0xd055('0x38')](_0x97636a[_0xd055('0x37')]);_0x1e4fe6['filters']=_[_0xd055('0x3a')](_0x1e4fe6[_0xd055('0x36')],_0x1e4fe6[_0xd055('0x37')]);_0x23db21[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0x1e4fe6[_0xd055('0x36')],qs[_0xd055('0x3b')](_0x97636a[_0xd055('0x37')]['fields']));_0x23db21[_0xd055('0x3c')]=_0x23db21[_0xd055('0x3c')][_0xd055('0x3d')]?_0x23db21['attributes']:_0x1e4fe6[_0xd055('0x36')];_0x23db21[_0xd055('0x3f')]=qs[_0xd055('0x40')](_0x97636a[_0xd055('0x37')][_0xd055('0x40')]);_0x23db21[_0xd055('0x41')]=qs[_0xd055('0x39')](_['pick'](_0x97636a[_0xd055('0x37')],_0x1e4fe6[_0xd055('0x39')]));if(_0x97636a[_0xd055('0x37')][_0xd055('0x57')]){_0x23db21[_0xd055('0x41')]=_[_0xd055('0x43')](_0x23db21[_0xd055('0x41')],{'$or':_[_0xd055('0x30')](_0x23db21[_0xd055('0x3c')],function(_0x2ff0e8){var _0x53bfeb={};_0x53bfeb[_0x2ff0e8]={'$like':'%'+_0x97636a[_0xd055('0x37')][_0xd055('0x57')]+'%'};return _0x53bfeb;})});}if(_0x97636a[_0xd055('0x37')][_0xd055('0x5d')]){var _0x1300c3=_0x97636a[_0xd055('0x37')]['$gte'][_0xd055('0x5e')](',');var _0x4da58a={};_0x4da58a[_0x1300c3[0x0]]={'$gte':moment(_0x1300c3[0x1])['format'](_0xd055('0x5f'))};_0x23db21[_0xd055('0x41')]=_[_0xd055('0x43')](_0x23db21['where'],_0x4da58a);}_0x23db21=_[_0xd055('0x43')]({},_0x23db21,_0x97636a[_0xd055('0x44')]);return _0xa818b0['getMessages'](_0x23db21);}})[_0xd055('0x29')](function(_0x5c6db6){if(_0x5c6db6){_0x4346ef=_0x5c6db6['length'];if(!_0x97636a[_0xd055('0x37')][_0xd055('0x58')](_0xd055('0x3e'))){_0x23db21[_0xd055('0x23')]=qs[_0xd055('0x23')](_0x97636a['query']['limit']);_0x23db21[_0xd055('0x21')]=qs[_0xd055('0x21')](_0x97636a['query'][_0xd055('0x21')]);}return _0xa818b0[_0xd055('0x5c')](_0x23db21);}})[_0xd055('0x29')](function(_0x1db659){if(_0x1db659){return _0x1db659?{'count':_0x4346ef,'rows':_0x1db659}:null;}})['then'](respondWithResult(_0x674a6d,null))['catch'](handleError(_0x674a6d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b601402..5a62664 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 _0x1f26=['emit','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1f26,0x197));var _0x61f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f26[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x61f2('0x0'));var ChatGroup=require(_0x61f2('0x1'))['db'][_0x61f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x61f2('0x3')](0x0);var events={'afterCreate':_0x61f2('0x4'),'afterUpdate':_0x61f2('0x5'),'afterDestroy':_0x61f2('0x6')};function emitEvent(_0x5c0541){return function(_0xa8899a,_0x4357bb,_0xeb6ad6){ChatGroupEvents['emit'](_0x5c0541+':'+_0xa8899a['id'],_0xa8899a);ChatGroupEvents[_0x61f2('0x7')](_0x5c0541,_0xa8899a);_0xeb6ad6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x61f2('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xe9ef=['events','ChatGroup','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2020b6,_0x2ff986){var _0x2e0f62=function(_0x3dbe24){while(--_0x3dbe24){_0x2020b6['push'](_0x2020b6['shift']());}};_0x2e0f62(++_0x2ff986);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xe9ef[_0x2431d6];return _0x4d0f9b;};'use strict';var EventEmitter=require(_0xfe9e('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfe9e('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfe9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23904d){return function(_0x45bf15,_0x199f65,_0x20d75f){ChatGroupEvents['emit'](_0x23904d+':'+_0x45bf15['id'],_0x45bf15);ChatGroupEvents[_0xfe9e('0x4')](_0x23904d,_0x45bf15);_0x20d75f(null);};}for(var e in events){if(events[_0xfe9e('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3e71534..4c4fd1c 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 _0xd7cb=['api','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','lodash','../../config/logger'];(function(_0xf307eb,_0x19ac0c){var _0x1606b8=function(_0x18bb44){while(--_0x18bb44){_0xf307eb['push'](_0xf307eb['shift']());}};_0x1606b8(++_0x19ac0c);}(_0xd7cb,0x1de));var _0xbd7c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd7cb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbd7c('0x0'));var util=require('util');var logger=require(_0xbd7c('0x1'))(_0xbd7c('0x2'));var moment=require('moment');var BPromise=require(_0xbd7c('0x3'));var rp=require(_0xbd7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd7c('0x5'));var config=require(_0xbd7c('0x6'));var attributes=require(_0xbd7c('0x7'));module[_0xbd7c('0x8')]=function(_0x1d3eb9,_0x52a3b7){return _0x1d3eb9['define'](_0xbd7c('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1271=['../../config/environment','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5beeb7,_0xeeac1b){var _0x5126bf=function(_0x2d115d){while(--_0x2d115d){_0x5beeb7['push'](_0x5beeb7['shift']());}};_0x5126bf(++_0xeeac1b);}(_0x1271,0x1e8));var _0x1127=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0x1271[_0xe9f4a2];return _0x25e066;};'use strict';var _=require(_0x1127('0x0'));var util=require('util');var logger=require(_0x1127('0x1'))(_0x1127('0x2'));var moment=require(_0x1127('0x3'));var BPromise=require(_0x1127('0x4'));var rp=require(_0x1127('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1127('0x6'));var config=require(_0x1127('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x37a09e,_0x35bd89){return _0x37a09e['define']('ChatGroup',attributes,{'tableName':_0x1127('0x8'),'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 b59eb7d..5ff7fed 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 _0x55a5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x17c1a4,_0x195273){var _0x2ecdee=function(_0x3d6b93){while(--_0x3d6b93){_0x17c1a4['push'](_0x17c1a4['shift']());}};_0x2ecdee(++_0x195273);}(_0x55a5,0xf7));var _0x555a=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x55a5[_0x2ce6d5];return _0x32d272;};'use strict';var _=require(_0x555a('0x0'));var util=require('util');var moment=require(_0x555a('0x1'));var BPromise=require(_0x555a('0x2'));var rs=require(_0x555a('0x3'));var fs=require('fs');var Redis=require(_0x555a('0x4'));var db=require(_0x555a('0x5'))['db'];var utils=require(_0x555a('0x6'));var logger=require(_0x555a('0x7'))(_0x555a('0x8'));var config=require(_0x555a('0x9'));var jayson=require(_0x555a('0xa'));var client=jayson[_0x555a('0xb')][_0x555a('0xc')]({'port':0x232a});config[_0x555a('0xd')]=_[_0x555a('0xe')](config[_0x555a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x555a('0xf'))(new Redis(config[_0x555a('0xd')]));require(_0x555a('0x10'))[_0x555a('0x11')](socket);function respondWithRpcPromise(_0xb56cd2,_0xd6ec1b,_0x273c20){return new BPromise(function(_0x3e4af3,_0x5b83f8){return client[_0x555a('0x12')](_0xb56cd2,_0x273c20)[_0x555a('0x13')](function(_0x411ff1){logger[_0x555a('0x14')](_0x555a('0x15'),_0xd6ec1b,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd6ec1b,'request\x20sent',JSON[_0x555a('0x16')](_0x411ff1));if(_0x411ff1[_0x555a('0x17')]){if(_0x411ff1[_0x555a('0x17')][_0x555a('0x18')]===0x1f4){logger[_0x555a('0x17')](_0x555a('0x15'),_0xd6ec1b,_0x411ff1[_0x555a('0x17')][_0x555a('0x19')]);return _0x5b83f8(_0x411ff1['error']['message']);}logger['error'](_0x555a('0x15'),_0xd6ec1b,_0x411ff1[_0x555a('0x17')][_0x555a('0x19')]);return _0x3e4af3(_0x411ff1['error'][_0x555a('0x19')]);}else{logger[_0x555a('0x14')](_0x555a('0x15'),_0xd6ec1b,'request\x20sent');_0x3e4af3(_0x411ff1[_0x555a('0x1a')]['message']);}})[_0x555a('0x1b')](function(_0x330e85){logger[_0x555a('0x17')](_0x555a('0x15'),_0xd6ec1b,_0x330e85);_0x5b83f8(_0x330e85);});});} \ No newline at end of file +var _0xfd7b=['error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xfd7b[_0x3b96cf];return _0x2e315a;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});config['redis']=_[_0xbfd7('0xd')](config['redis'],{'host':_0xbfd7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfd7('0xf')]));require(_0xbfd7('0x10'))[_0xbfd7('0x11')](socket);function respondWithRpcPromise(_0x3b7670,_0x47e7c2,_0x19e7bc){return new BPromise(function(_0x14c84b,_0x5d5b48){return client['request'](_0x3b7670,_0x19e7bc)[_0xbfd7('0x12')](function(_0x45606b){logger[_0xbfd7('0x13')](_0xbfd7('0x14'),_0x47e7c2,_0xbfd7('0x15'));logger['debug'](_0xbfd7('0x16'),_0x47e7c2,'request\x20sent',JSON[_0xbfd7('0x17')](_0x45606b));if(_0x45606b['error']){if(_0x45606b['error'][_0xbfd7('0x18')]===0x1f4){logger[_0xbfd7('0x19')](_0xbfd7('0x14'),_0x47e7c2,_0x45606b[_0xbfd7('0x19')]['message']);return _0x5d5b48(_0x45606b['error']['message']);}logger[_0xbfd7('0x19')](_0xbfd7('0x14'),_0x47e7c2,_0x45606b[_0xbfd7('0x19')][_0xbfd7('0x1a')]);return _0x14c84b(_0x45606b[_0xbfd7('0x19')][_0xbfd7('0x1a')]);}else{logger[_0xbfd7('0x13')](_0xbfd7('0x14'),_0x47e7c2,_0xbfd7('0x15'));_0x14c84b(_0x45606b['result']['message']);}})[_0xbfd7('0x1b')](function(_0x1ca43c){logger['error']('ChatGroup,\x20%s,\x20%s',_0x47e7c2,_0x1ca43c);_0x5d5b48(_0x1ca43c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index dea5248..9f139d4 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 _0x2cea=['emit','removeListener','length','save','remove','update'];(function(_0x1df210,_0x3abe68){var _0x4a5027=function(_0x40efc3){while(--_0x40efc3){_0x1df210['push'](_0x1df210['shift']());}};_0x4a5027(++_0x3abe68);}(_0x2cea,0x153));var _0xa2ce=function(_0x382d8e,_0x2a5761){_0x382d8e=_0x382d8e-0x0;var _0x23993d=_0x2cea[_0x382d8e];return _0x23993d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xa2ce('0x0'),_0xa2ce('0x1'),_0xa2ce('0x2')];function createListener(_0x20fce4,_0x5d6127){return function(_0x4729cf){_0x5d6127[_0xa2ce('0x3')](_0x20fce4,_0x4729cf);};}function removeListener(_0x3faea7,_0x13858a){return function(){ChatGroupEvents[_0xa2ce('0x4')](_0x3faea7,_0x13858a);};}exports['register']=function(_0x2331d9){for(var _0x2750ac=0x0,_0x4630bc=events[_0xa2ce('0x5')];_0x2750ac<_0x4630bc;_0x2750ac++){var _0x7ac717=events[_0x2750ac];var _0x322bb2=createListener('chatGroup:'+_0x7ac717,_0x2331d9);ChatGroupEvents['on'](_0x7ac717,_0x322bb2);}}; \ No newline at end of file +var _0xa932=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x6f362f,_0x1853be){var _0x33d274=function(_0x5e3ae2){while(--_0x5e3ae2){_0x6f362f['push'](_0x6f362f['shift']());}};_0x33d274(++_0x1853be);}(_0xa932,0x1bd));var _0x2a93=function(_0x47bf8b,_0x5c377e){_0x47bf8b=_0x47bf8b-0x0;var _0x2d71ff=_0xa932[_0x47bf8b];return _0x2d71ff;};'use strict';var ChatGroupEvents=require(_0x2a93('0x0'));var events=[_0x2a93('0x1'),_0x2a93('0x2'),_0x2a93('0x3')];function createListener(_0x7513fe,_0x336154){return function(_0x4fe938){_0x336154['emit'](_0x7513fe,_0x4fe938);};}function removeListener(_0x2fc962,_0x490f2e){return function(){ChatGroupEvents[_0x2a93('0x4')](_0x2fc962,_0x490f2e);};}exports[_0x2a93('0x5')]=function(_0x130112){for(var _0x198b17=0x0,_0x5d4ede=events[_0x2a93('0x6')];_0x198b17<_0x5d4ede;_0x198b17++){var _0x44729e=events[_0x198b17];var _0x203fc1=createListener(_0x2a93('0x7')+_0x44729e,_0x130112);ChatGroupEvents['on'](_0x44729e,_0x203fc1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e519277..c0e77eb 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 _0xf8fc=['addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xf8fc,0x180));var _0xcf8f=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xf8fc[_0x3511d3];return _0x5d6321;};'use strict';var multer=require(_0xcf8f('0x0'));var util=require(_0xcf8f('0x1'));var path=require('path');var timeout=require(_0xcf8f('0x2'));var express=require(_0xcf8f('0x3'));var router=express['Router']();var fs_extra=require(_0xcf8f('0x4'));var auth=require(_0xcf8f('0x5'));var interaction=require(_0xcf8f('0x6'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xcf8f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcf8f('0x8')]);router['get'](_0xcf8f('0x9'),auth[_0xcf8f('0xa')](),controller[_0xcf8f('0xb')]);router[_0xcf8f('0x7')](_0xcf8f('0xc'),auth['isAuthenticated'](),controller[_0xcf8f('0xd')]);router['get'](_0xcf8f('0xe'),auth[_0xcf8f('0xa')](),controller[_0xcf8f('0xf')]);router['get'](_0xcf8f('0x10'),auth[_0xcf8f('0xa')](),controller[_0xcf8f('0x11')]);router[_0xcf8f('0x12')]('/',auth[_0xcf8f('0xa')](),controller[_0xcf8f('0x13')]);router[_0xcf8f('0x12')](_0xcf8f('0xe'),auth[_0xcf8f('0xa')](),controller[_0xcf8f('0x14')]);router['post']('/:id/messages',auth[_0xcf8f('0xa')](),controller[_0xcf8f('0x15')]);router[_0xcf8f('0x16')](_0xcf8f('0x9'),auth['isAuthenticated'](),controller[_0xcf8f('0x17')]);router[_0xcf8f('0x18')](_0xcf8f('0x9'),auth['isAuthenticated'](),controller[_0xcf8f('0x19')]);router[_0xcf8f('0x18')](_0xcf8f('0xe'),auth[_0xcf8f('0xa')](),controller['removeMembers']);module[_0xcf8f('0x1a')]=router; \ No newline at end of file +var _0xcb3b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getMessages','create','post','addMembers','put','update','delete','destroy','removeMembers','exports','multer','path'];(function(_0x47825a,_0x2afee6){var _0x36a42f=function(_0x2aa672){while(--_0x2aa672){_0x47825a['push'](_0x47825a['shift']());}};_0x36a42f(++_0x2afee6);}(_0xcb3b,0x16a));var _0xbcb3=function(_0x603d70,_0x55420f){_0x603d70=_0x603d70-0x0;var _0xac2a32=_0xcb3b[_0x603d70];return _0xac2a32;};'use strict';var multer=require(_0xbcb3('0x0'));var util=require('util');var path=require(_0xbcb3('0x1'));var timeout=require(_0xbcb3('0x2'));var express=require(_0xbcb3('0x3'));var router=express[_0xbcb3('0x4')]();var fs_extra=require(_0xbcb3('0x5'));var auth=require(_0xbcb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcb3('0x7'));var controller=require(_0xbcb3('0x8'));router[_0xbcb3('0x9')]('/',auth[_0xbcb3('0xa')](),controller[_0xbcb3('0xb')]);router[_0xbcb3('0x9')](_0xbcb3('0xc'),auth[_0xbcb3('0xa')](),controller['describe']);router[_0xbcb3('0x9')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller['show']);router[_0xbcb3('0x9')]('/:id/unread',auth[_0xbcb3('0xa')](),controller['getUnread']);router['get'](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0xf')]);router['get']('/:id/messages',auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbcb3('0x11')]);router[_0xbcb3('0x12')](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x13')]);router[_0xbcb3('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xbcb3('0x14')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x15')]);router[_0xbcb3('0x16')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x17')]);router[_0xbcb3('0x16')](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x18')]);module[_0xbcb3('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 f035e71..a53c4d4 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 _0xe6e4=['star','thumb','TEXT','STRING','long','DATE','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x1e7ee5,_0x3c3cce){var _0x19fc89=function(_0x1346f7){while(--_0x1346f7){_0x1e7ee5['push'](_0x1e7ee5['shift']());}};_0x19fc89(++_0x3c3cce);}(_0xe6e4,0xc1));var _0x4e6e=function(_0xbc2d9e,_0x40ef4f){_0xbc2d9e=_0xbc2d9e-0x0;var _0x2e315c=_0xe6e4[_0xbc2d9e];return _0x2e315c;};'use strict';var Sequelize=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]={'closed':{'type':Sequelize[_0x4e6e('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4e6e('0x3')]},'ratingType':{'type':Sequelize[_0x4e6e('0x4')](_0x4e6e('0x5'),_0x4e6e('0x6')),'defaultValue':_0x4e6e('0x5')},'ratingMessage':{'type':Sequelize[_0x4e6e('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x4e6e('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4e6e('0x8')]},'thirdDisposition':{'type':Sequelize[_0x4e6e('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x4e6e('0x8')]},'browserVersion':{'type':Sequelize[_0x4e6e('0x8')]},'osName':{'type':Sequelize[_0x4e6e('0x8')]},'osVersion':{'type':Sequelize[_0x4e6e('0x8')]},'deviceModel':{'type':Sequelize[_0x4e6e('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x4e6e('0x8')]},'referer':{'type':Sequelize[_0x4e6e('0x7')]},'customerIp':{'type':Sequelize[_0x4e6e('0x8')]},'formData':{'type':Sequelize[_0x4e6e('0x7')](_0x4e6e('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x4e6e('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x4e6e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4e6e('0x8')]},'customerPort':{'type':Sequelize[_0x4e6e('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x4e6e('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x4e6e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x705f=['BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x287473,_0x20c8dc){var _0xe6693e=function(_0x2c7747){while(--_0x2c7747){_0x287473['push'](_0x287473['shift']());}};_0xe6693e(++_0x20c8dc);}(_0x705f,0x75));var _0xf705=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0x705f[_0x3a902a];return _0x24f2d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xf705('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf705('0x1')](_0xf705('0x2'),_0xf705('0x3')),'defaultValue':_0xf705('0x2')},'ratingMessage':{'type':Sequelize[_0xf705('0x4')]},'pathTranscript':{'type':Sequelize[_0xf705('0x4')]},'mailTranscript':{'type':Sequelize[_0xf705('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf705('0x6')]},'disposition':{'type':Sequelize[_0xf705('0x5')]},'secondDisposition':{'type':Sequelize[_0xf705('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf705('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xf705('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xf705('0x5')]},'deviceModel':{'type':Sequelize[_0xf705('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xf705('0x4')]},'customerIp':{'type':Sequelize[_0xf705('0x5')]},'formData':{'type':Sequelize[_0xf705('0x4')](_0xf705('0x7'))},'read1stAt':{'type':Sequelize[_0xf705('0x6')]},'lastMsgAt':{'type':Sequelize[_0xf705('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xf705('0x1')]('in',_0xf705('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xf705('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xf705('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf705('0x0')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f315cc7..e257921 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 _0x4522=['c.email','Contact.email','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','length','ChatInteractionId','push','all','rows','catch','show','params','includeAll','include','options','create','destroy','describe','ChatWebsite','findOne','vidaooApiKey','vidaooMetadata','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','filename','Unauthorized','Attachment','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','secret','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','read','Account','Chat','Owner','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','out','firstName','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','stack','name','send','render','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','waiting','answered','unmanaged','abandoned','total','closed','talking','UserId','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','hasOwnProperty','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','value','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','null','\x20IS\x20NULL','tag','isArray','filter','replace','i.id\x20LIKE\x20?','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','toString','keyBy','merge','ChatInteraction','fields','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','contactName','c.firstName','Contact.firstName','Contact.lastName'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4522,0x1a0));var _0x2452=function(_0x164f64,_0x3e577b){_0x164f64=_0x164f64-0x0;var _0x240869=_0x4522[_0x164f64];return _0x240869;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x2452('0x0'));var moment=require(_0x2452('0x1'));var BPromise=require(_0x2452('0x2'));var Mustache=require('mustache');var util=require(_0x2452('0x3'));var path=require(_0x2452('0x4'));var ejs=require(_0x2452('0x5'));var fs=require('fs');var _=require(_0x2452('0x6'));var squel=require(_0x2452('0x7'));var Redis=require(_0x2452('0x8'));var qs=require(_0x2452('0x9'));var as=require(_0x2452('0xa'));var pdf=require(_0x2452('0xb'));var logger=require(_0x2452('0xc'))(_0x2452('0xd'));var config=require(_0x2452('0xe'));var db=require(_0x2452('0xf'))['db'];config[_0x2452('0x10')]=_[_0x2452('0x11')](config[_0x2452('0x10')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2452('0x10')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x2452('0x12'));var client=jayson[_0x2452('0x13')][_0x2452('0x14')]({'port':0x232b});var client9004=jayson[_0x2452('0x13')][_0x2452('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x14f338,_0x2c1e0f,_0x2377b9,_0x4968e8){return new BPromise(function(_0x529fb2,_0x5315ed){var _0x463960=_0x4968e8||client;return _0x463960['request'](_0x14f338,_0x2377b9)[_0x2452('0x15')](function(_0x506cd4){logger[_0x2452('0x16')](_0x2452('0x17'),_0x2c1e0f,'request\x20sent');logger[_0x2452('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2c1e0f,_0x2452('0x19'),JSON[_0x2452('0x1a')](_0x506cd4));if(_0x506cd4[_0x2452('0x1b')]){if(_0x506cd4[_0x2452('0x1b')]['code']===0x1f4){logger[_0x2452('0x1b')](_0x2452('0x17'),_0x2c1e0f,_0x506cd4['error']['message']);return _0x5315ed(_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);}logger[_0x2452('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x2c1e0f,_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);return _0x529fb2(_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);}else{logger[_0x2452('0x16')](_0x2452('0x17'),_0x2c1e0f,_0x2452('0x19'));_0x529fb2(_0x506cd4[_0x2452('0x1d')]['message']);}})['catch'](function(_0x1f060d){logger[_0x2452('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x2c1e0f,_0x1f060d);_0x5315ed(_0x1f060d);});});}function respondWithStatusCode(_0x17d0a0,_0x395cf1){_0x395cf1=_0x395cf1||0xcc;return function(_0x1d5720){if(_0x1d5720){return _0x17d0a0[_0x2452('0x1e')](_0x395cf1);}return _0x17d0a0[_0x2452('0x1f')](_0x395cf1)[_0x2452('0x20')]();};}function respondWithResult(_0x155caa,_0x543b06){_0x543b06=_0x543b06||0xc8;return function(_0x119bf6){if(_0x119bf6){return _0x155caa[_0x2452('0x1f')](_0x543b06)[_0x2452('0x21')](_0x119bf6);}};}function respondWithFilteredResult(_0x231410,_0x3a4326){return function(_0x516fcf){if(_0x516fcf){var _0x48783a=typeof _0x3a4326[_0x2452('0x22')]===_0x2452('0x23')&&typeof _0x3a4326[_0x2452('0x24')]===_0x2452('0x23');var _0x1aac19=_0x516fcf['count'];var _0x3fba00=_0x48783a?0x0:_0x3a4326[_0x2452('0x22')];var _0x5e9184=_0x48783a?_0x516fcf['count']:_0x3a4326[_0x2452('0x22')]+_0x3a4326[_0x2452('0x24')];var _0x36cb6c;if(_0x5e9184>=_0x1aac19){_0x5e9184=_0x1aac19;_0x36cb6c=0xc8;}else{_0x36cb6c=0xce;}_0x231410[_0x2452('0x1f')](_0x36cb6c);return _0x231410[_0x2452('0x25')](_0x2452('0x26'),_0x3fba00+'-'+_0x5e9184+'/'+_0x1aac19)['json'](_0x516fcf);}return null;};}function saveUpdates(_0x5da9aa){return function(_0x46b611){if(_0x46b611){return _0x46b611[_0x2452('0x27')](_0x5da9aa)[_0x2452('0x15')](function(_0x5c36aa){return _0x5c36aa;});}return null;};}function removeEntity(_0x2fb2ae){return function(_0x586a20){if(_0x586a20){return _0x586a20['destroy']()[_0x2452('0x15')](function(){_0x2fb2ae[_0x2452('0x1f')](0xcc)[_0x2452('0x20')]();});}};}function handleEntityNotFound(_0xe97b1c){return function(_0x334aba){if(!_0x334aba){_0xe97b1c[_0x2452('0x1e')](0x194);}return _0x334aba;};}function handleError(_0x312f1b,_0x115e09){_0x115e09=_0x115e09||0x1f4;return function(_0x3b96aa){logger[_0x2452('0x1b')](_0x3b96aa[_0x2452('0x28')]);if(_0x3b96aa[_0x2452('0x29')]){delete _0x3b96aa[_0x2452('0x29')];}_0x312f1b['status'](_0x115e09)[_0x2452('0x2a')](_0x3b96aa);};}function getMustacheRender(_0x1689cd,_0x4cd7e2){return Mustache[_0x2452('0x2b')](_0x1689cd,_['merge'](_0x4cd7e2[_0x2452('0x2c')],{'contact':_0x4cd7e2[_0x2452('0x2d')],'message':_0x4cd7e2['message'],'agent':_0x4cd7e2[_0x2452('0x2e')],'interaction':_0x4cd7e2[_0x2452('0x2f')],'account':_0x4cd7e2[_0x2452('0x30')]}))||'';}function getInteractionUsers(_0x5ce5fb,_0x20a4b4){return new BPromise(function(_0x4565c7,_0x4ba2ae){try{if(_0x20a4b4[_0x5ce5fb['id']]){_0x5ce5fb[_0x2452('0x31')]=_[_0x2452('0x32')](_0x20a4b4[_0x5ce5fb['id']],function(_0x11dba4){return{'id':_0x11dba4['id'],'fullname':_0x11dba4[_0x2452('0x33')]};});}}catch(_0x261bd8){_0x4ba2ae(_0x261bd8);}_0x4565c7(_0x5ce5fb);});}function getInteractionTags(_0x54c36a,_0x58b6c2){return new BPromise(function(_0x510b79,_0x1df280){try{if(_0x54c36a[_0x2452('0x34')]){_0x54c36a[_0x2452('0x35')]=[];_0x54c36a[_0x2452('0x34')][_0x2452('0x36')](',')['forEach'](function(_0x22120a){_0x54c36a['Tags']['push'](_0x58b6c2[_0x22120a]);});}delete _0x54c36a[_0x2452('0x34')];}catch(_0x515e7b){_0x1df280(_0x515e7b);}_0x510b79(_0x54c36a);});}function updateChatInteraction(_0x44ef50,_0xac3b74,_0x514037){return new BPromise(function(_0x30b49f,_0x2cc8a4){return getInteractionUsers(_0x44ef50,_0x514037)[_0x2452('0x15')](function(_0x34d7f9){return getInteractionTags(_0x34d7f9,_0xac3b74);})[_0x2452('0x15')](function(_0x112849){return getStateInteraction(_0x112849);})[_0x2452('0x15')](function(_0x46a561){_0x30b49f(_0x46a561);})['catch'](function(_0x262467){_0x2cc8a4(_0x262467);});});}function getStateInteraction(_0x52c6b6){return new BPromise(function(_0xaea800){_0x52c6b6[_0x2452('0x37')]=0x0;_0x52c6b6['talking']=0x0;_0x52c6b6[_0x2452('0x38')]=0x0;_0x52c6b6[_0x2452('0x39')]=0x0;_0x52c6b6[_0x2452('0x3a')]=0x0;_0x52c6b6[_0x2452('0x3b')]=0x0;if(!_0x52c6b6[_0x2452('0x3c')]&&!_0x52c6b6['UserId']){_0x52c6b6[_0x2452('0x37')]+=0x1;}if(!_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['UserId']){_0x52c6b6[_0x2452('0x3d')]+=0x1;if(_0x52c6b6[_0x2452('0x37')]){_0x52c6b6[_0x2452('0x37')]-=0x1;}}if(_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['disposition']===_0x2452('0x3a')){_0x52c6b6[_0x2452('0x3a')]+=0x1;if(_0x52c6b6[_0x2452('0x37')]){_0x52c6b6[_0x2452('0x37')]-=0x1;}}else if(_0x52c6b6[_0x2452('0x3c')]&&!_0x52c6b6[_0x2452('0x3e')]&&_0x52c6b6['disposition']){_0x52c6b6[_0x2452('0x39')]+=0x1;if(_0x52c6b6['waiting']){_0x52c6b6[_0x2452('0x37')]-=0x1;}}else if(_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['UserId']){_0x52c6b6['answered']+=0x1;if(_0x52c6b6['talking']){_0x52c6b6['talking']-=0x1;}}_0x52c6b6[_0x2452('0x3b')]+=0x1;_0xaea800(_0x52c6b6);});}exports['index']=function(_0x15f0e7,_0x5e400a){var _0x1ef02b={},_0x16d938={},_0x55de3d={'count':0x0,'rows':[]};var _0x4c6b8a=_[_0x2452('0x32')](db['ChatInteraction'][_0x2452('0x3f')],function(_0x1cb30a){return{'name':_0x1cb30a[_0x2452('0x40')],'type':_0x1cb30a[_0x2452('0x41')]['key']};});_0x16d938['model']=_[_0x2452('0x32')](_0x4c6b8a,_0x2452('0x29'));_0x16d938[_0x2452('0x42')]=_[_0x2452('0x43')](_0x15f0e7[_0x2452('0x42')]);_0x16d938['filters']=_[_0x2452('0x44')](_0x16d938['model'],_0x16d938[_0x2452('0x42')]);_0x1ef02b['attributes']=_[_0x2452('0x44')](_0x16d938[_0x2452('0x45')],qs['fields'](_0x15f0e7[_0x2452('0x42')]['fields']));_0x1ef02b[_0x2452('0x46')]=_0x1ef02b['attributes']['length']?_0x1ef02b['attributes']:_0x16d938[_0x2452('0x45')];if(!_0x15f0e7[_0x2452('0x42')][_0x2452('0x47')]('nolimit')){_0x1ef02b[_0x2452('0x24')]=qs[_0x2452('0x24')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x24')]);_0x1ef02b[_0x2452('0x22')]=qs['offset'](_0x15f0e7[_0x2452('0x42')]['offset']);}_0x1ef02b[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x49')]);_0x1ef02b[_0x2452('0x4a')]=qs[_0x2452('0x4b')](_[_0x2452('0x4c')](_0x15f0e7[_0x2452('0x42')],_0x16d938[_0x2452('0x4b')]),_0x4c6b8a);var _0x4ec01a=[];var _0x443cf9=squel['select']()[_0x2452('0x4d')]('id')['field'](_0x2452('0x29'))[_0x2452('0x4d')]('color')[_0x2452('0x4e')](_0x2452('0x4f'));var _0x18ec2d=squel[_0x2452('0x50')]()[_0x2452('0x4d')](_0x2452('0x51'))[_0x2452('0x4d')](_0x2452('0x52'))[_0x2452('0x4d')](_0x2452('0x53'))[_0x2452('0x4e')]('user_has_chat_interactions','ui')[_0x2452('0x54')]('users','u',_0x2452('0x55'));var _0x4959a7=squel[_0x2452('0x50')]()[_0x2452('0x4e')](_0x2452('0x56'),'i')[_0x2452('0x54')](_0x2452('0x57'),'c',_0x2452('0x58'))[_0x2452('0x54')](_0x2452('0x59'),'o',_0x2452('0x5a'))[_0x2452('0x54')](_0x2452('0x5b'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x2452('0x54')](_0x2452('0x5c'),'me',_0x2452('0x5d'))[_0x2452('0x54')](_0x2452('0x5e'),'it',_0x2452('0x5f'))['left_join'](_0x2452('0x4f'),'t',_0x2452('0x60'));var _0x4bce9e=squel[_0x2452('0x61')]();var _0x3a64fc=[];var _0x1b8e8b=squel[_0x2452('0x61')]();var _0x2f1b16;if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x62')]){_0x2f1b16=as[_0x2452('0x63')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x62')]);var _0x243b85=_0x2f1b16['sqlOperator'];for(var _0x5cf96b=0x0;_0x5cf96b<_0x2f1b16[_0x2452('0x64')]['length'];_0x5cf96b++){var _0x20875f=_0x2f1b16[_0x2452('0x64')][_0x5cf96b];var _0x192788='i';var _0x17b1ec=_[_0x2452('0x65')](_0x4c6b8a,[_0x2452('0x29'),_0x20875f['field']]);if(!_0x17b1ec){switch(_0x20875f['field']){case _0x2452('0x66'):if(_0x20875f['value']==0x1){_0x4959a7[_0x2452('0x67')]('`'+_0x20875f['field']+_0x2452('0x68'));}else{_0x4959a7[_0x2452('0x67')]('`'+_0x20875f[_0x2452('0x4d')]+_0x2452('0x69'));}break;case'Contact':if(_0x20875f['operator']==='$substring'){if(_0x20875f[_0x2452('0x6a')][_0x2452('0x36')]('\x20')['length']>0x1){_0x4bce9e[_0x243b85]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x20875f['value']),null);}else{var _0x4b563d='%'+_0x20875f[_0x2452('0x6a')]+'%';_0x4bce9e[_0x243b85]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4b563d,_0x4b563d,_0x4b563d);}}else{_0x17b1ec=_['find'](_0x4c6b8a,[_0x2452('0x29'),_0x2452('0x6b')]);_0x20875f[_0x2452('0x4d')]=_0x2452('0x6b');_0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631['text'],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')]['end']);}break;case'Tag':var _0xa692d5=_0x20875f[_0x2452('0x6a')][_0x2452('0x36')](',')[_0x2452('0x32')](function(_0x401628){return Number(_0x401628);});_0xa692d5[_0x2452('0x6e')](function(_0x4dd13d){_0x1b8e8b['or'](_0x2452('0x6f'),'%,'+_0x4dd13d+',%');});_0x3a64fc=_['union'](_0x3a64fc,_0xa692d5);break;case _0x2452('0x70'):if(_0x20875f[_0x2452('0x71')]===_0x2452('0x72')){_0x4bce9e[_0x243b85](_0x2452('0x73'),'%'+_0x20875f['value']+'%',null);}else{_0x17b1ec=_[_0x2452('0x65')](_0x4c6b8a,[_0x2452('0x29'),'UserId']);_0x20875f[_0x2452('0x4d')]=_0x2452('0x3e');_0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631[_0x2452('0x74')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')]['end']);}break;case'body':_0x1ce631=as[_0x2452('0x6c')]('me',null,_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631[_0x2452('0x74')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631['value'][_0x2452('0x20')]);break;}}else{var _0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631['text'],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x20')]);}}}else{var _0x552633=_(_0x15f0e7['query'])[_0x2452('0x43')]()[_0x2452('0x32')](function(_0x4c5192){return _[_0x2452('0x75')](_0x4c6b8a,[_0x2452('0x29'),_0x4c5192])?_0x4c5192:undefined;})[_0x2452('0x76')]()[_0x2452('0x6a')]();if(!_[_0x2452('0x77')](_0x552633)){_0x552633[_0x2452('0x6e')](function(_0x1e9f1a){if(_0x1e9f1a===_0x2452('0x78')){_0x4959a7[_0x2452('0x4a')](_0x2452('0x79'),[][_0x2452('0x7a')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a]));}else if(_0x1e9f1a===_0x2452('0x7b')){var _0x326570=JSON[_0x2452('0x7c')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a])['$gte'];var _0x16ca73=JSON[_0x2452('0x7c')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a])['$lte'];_0x4959a7['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x326570,_0x16ca73);}else{if(_0x15f0e7[_0x2452('0x42')][_0x1e9f1a]===_0x2452('0x7d')){_0x4959a7[_0x2452('0x4a')]('i.'+_0x1e9f1a+_0x2452('0x7e'));}else{_0x4959a7['where']('i.'+_0x1e9f1a+'\x20=\x20?',_0x15f0e7['query'][_0x1e9f1a]);}}});}if(_0x15f0e7[_0x2452('0x42')]['read']){if(_0x15f0e7[_0x2452('0x42')]['read']==0x1){_0x4959a7[_0x2452('0x67')]('`unreadMessages`\x20=\x200');}else{_0x4959a7[_0x2452('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')]){_0x3a64fc=_[_0x2452('0x80')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')])?_0x15f0e7['query'][_0x2452('0x7f')]:new Array(_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')]);_0x3a64fc[_0x2452('0x6e')](function(_0x285407){_0x1b8e8b['or'](_0x2452('0x6f'),'%,'+_0x285407+',%');});}if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x81')]){var _0x18f94f=_0x15f0e7[_0x2452('0x42')][_0x2452('0x81')]['replace']('\x5c','\x5c\x5c')[_0x2452('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x18f94f)){_0x4bce9e['or'](_0x2452('0x83'),_0x18f94f+'%');}else{_0x4bce9e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18f94f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x18f94f+'%');}}}_0x4959a7['where'](_0x4bce9e);_0x4959a7['group']('i.id');var _0x3e372d={'type':db[_0x2452('0x84')][_0x2452('0x85')]['SELECT'],'raw':!![]};var _0x4ef9ed=_0x4959a7['clone']();_0x4ef9ed[_0x2452('0x4d')](_0x2452('0x86'));_0x4ef9ed[_0x2452('0x4d')](_0x2452('0x87'),_0x2452('0x66'));if(_0x1ef02b[_0x2452('0x48')]){_0x1ef02b[_0x2452('0x48')]['forEach'](function(_0x4046d9){var _0x218103=_0x4046d9[0x0]==='contactName'?_0x4046d9[0x0]:'i.'+_0x4046d9[0x0];_0x4959a7[_0x2452('0x48')](_0x218103,_0x4046d9[0x1]===_0x2452('0x88')?![]:!![]);});}if(!_[_0x2452('0x77')](_0x3a64fc)){_0x4959a7[_0x2452('0x67')](_0x1b8e8b);_0x4ef9ed['where'](_0x2452('0x89'),_0x3a64fc);}BPromise['resolve']()[_0x2452('0x15')](function(){if(!_0x2f1b16){if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x78')])return;_0x4ef9ed[_0x2452('0x4a')](_0x2452('0x8a'));_0x4959a7['where'](_0x2452('0x8a'));return;}if(_0x15f0e7[_0x2452('0x8b')][_0x2452('0x8c')]!==_0x2452('0x2e'))return;return _0x15f0e7['user'][_0x2452('0x8d')]({'attributes':['id'],'raw':!![]})[_0x2452('0x15')](function(_0xdeeeff){if(_[_0x2452('0x77')](_0xdeeeff)){_0x4ef9ed[_0x2452('0x4a')](_0x2452('0x8e'));_0x4959a7[_0x2452('0x4a')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4ef9ed[_0x2452('0x4a')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0xdeeeff,'id'));_0x4959a7['where'](_0x2452('0x79'),_[_0x2452('0x32')](_0xdeeeff,'id'));}});})[_0x2452('0x15')](function(){if(_0x15f0e7[_0x2452('0x8b')][_0x2452('0x8c')]===_0x2452('0x2e')&&!_0x2f1b16&&!_0x15f0e7[_0x2452('0x42')][_0x2452('0x78')])return[];return db[_0x2452('0x8f')]['query'](_0x4ef9ed['toString'](),_0x3e372d);})['then'](function(_0x28c8a8){_0x55de3d['count']=_0x28c8a8['length'];if(_0x55de3d[_0x2452('0x90')]===0x0)return[];return db[_0x2452('0x8f')][_0x2452('0x42')](_0x443cf9[_0x2452('0x91')](),_0x3e372d)[_0x2452('0x15')](function(_0x4f51bb){_0x4ec01a=_[_0x2452('0x92')](_0x4f51bb,'id');_0x3e372d=_[_0x2452('0x93')](_0x3e372d,{'model':db[_0x2452('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x95')]){_0x1ef02b['attributes'][_0x2452('0x6e')](function(_0x5bc8e4){_0x4959a7[_0x2452('0x4d')]('i.'+_0x5bc8e4);});}else{_0x4959a7[_0x2452('0x4d')](_0x2452('0x87'),_0x2452('0x66'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x96'),'Account.key');_0x4959a7['field'](_0x2452('0x97'),_0x2452('0x98'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x99'),_0x2452('0x9a'));_0x4959a7[_0x2452('0x4d')]('i.*');_0x4959a7[_0x2452('0x4d')](_0x2452('0x9b'),_0x2452('0x9c'));_0x4959a7[_0x2452('0x4d')]('c.lastName',_0x2452('0x9d'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x9e'),_0x2452('0x9f'));_0x4959a7['field']('c.phone',_0x2452('0xa0'));_0x4959a7[_0x2452('0x4d')](_0x2452('0xa1'),'Contact.mobile');_0x4959a7[_0x2452('0x4d')](_0x2452('0xa2'),'Contact.fax');_0x4959a7['field']('o.fullname',_0x2452('0xa3'));_0x4959a7[_0x2452('0x4d')](_0x2452('0xa4'),'Owner.internal');_0x4959a7[_0x2452('0x4d')](_0x2452('0xa5'),_0x2452('0x34'));}if(_0x1ef02b['limit'])_0x4959a7['limit'](_0x1ef02b[_0x2452('0x24')]);if(_0x1ef02b['offset'])_0x4959a7[_0x2452('0x22')](_0x1ef02b[_0x2452('0x22')]);return db['sequelize'][_0x2452('0x42')](_0x4959a7[_0x2452('0x91')](),_0x3e372d);})[_0x2452('0x15')](function(_0x485f2a){if(_0x485f2a[_0x2452('0xa6')]>0x0)_0x18ec2d[_0x2452('0x4a')]('ui.ChatInteractionId\x20IN\x20?',_[_0x2452('0x32')](_0x485f2a,'id'));return db[_0x2452('0x8f')][_0x2452('0x42')](_0x18ec2d[_0x2452('0x91')](),_0x3e372d)[_0x2452('0x15')](function(_0x229c79){var _0x3454e4=_['groupBy'](_0x229c79,_0x2452('0xa7'));var _0x114ffd=[];_0x485f2a[_0x2452('0x6e')](function(_0x1e3399){_0x114ffd[_0x2452('0xa8')](updateChatInteraction(_0x1e3399,_0x4ec01a,_0x3454e4));});return BPromise[_0x2452('0xa9')](_0x114ffd);});});})[_0x2452('0x15')](function(_0x28bf18){_0x55de3d[_0x2452('0xaa')]=_0x28bf18;return _0x55de3d;})['then'](respondWithFilteredResult(_0x5e400a,_0x1ef02b))[_0x2452('0xab')](handleError(_0x5e400a,null));};exports[_0x2452('0xac')]=function(_0x37957b,_0x37cf09){var _0x360076={'raw':![],'where':{'id':_0x37957b[_0x2452('0xad')]['id']}},_0x28f93c={};_0x28f93c[_0x2452('0x45')]=_[_0x2452('0x43')](db[_0x2452('0x94')][_0x2452('0x3f')]);_0x28f93c['query']=_[_0x2452('0x43')](_0x37957b[_0x2452('0x42')]);_0x28f93c[_0x2452('0x4b')]=_['intersection'](_0x28f93c['model'],_0x28f93c[_0x2452('0x42')]);_0x360076['attributes']=_[_0x2452('0x44')](_0x28f93c[_0x2452('0x45')],qs[_0x2452('0x95')](_0x37957b[_0x2452('0x42')]['fields']));_0x360076[_0x2452('0x46')]=_0x360076[_0x2452('0x46')][_0x2452('0xa6')]?_0x360076[_0x2452('0x46')]:_0x28f93c[_0x2452('0x45')];if(_0x37957b[_0x2452('0x42')][_0x2452('0xae')]){_0x360076[_0x2452('0xaf')]=[{'all':!![]}];}_0x360076=_[_0x2452('0x93')]({},_0x360076,_0x37957b[_0x2452('0xb0')]);return db[_0x2452('0x94')]['find'](_0x360076)['then'](handleEntityNotFound(_0x37cf09,null))['then'](respondWithResult(_0x37cf09,null))[_0x2452('0xab')](handleError(_0x37cf09,null));};exports[_0x2452('0xb1')]=function(_0x430133,_0x2d12f1){return db[_0x2452('0x94')][_0x2452('0xb1')](_0x430133['body'],{})['then'](respondWithResult(_0x2d12f1,0xc9))[_0x2452('0xab')](handleError(_0x2d12f1,null));};exports[_0x2452('0x27')]=function(_0x3ccc5c,_0x39236b){if(_0x3ccc5c[_0x2452('0x2c')]['id']){delete _0x3ccc5c[_0x2452('0x2c')]['id'];}return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x3ccc5c[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x39236b,null))['then'](saveUpdates(_0x3ccc5c[_0x2452('0x2c')],null))[_0x2452('0x15')](respondWithResult(_0x39236b,null))[_0x2452('0xab')](handleError(_0x39236b,null));};exports[_0x2452('0xb2')]=function(_0x1ae483,_0x444447){return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x1ae483[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x444447,null))[_0x2452('0x15')](removeEntity(_0x444447,null))[_0x2452('0xab')](handleError(_0x444447,null));};exports[_0x2452('0xb3')]=function(_0x132ae5,_0x1b9e68){return db[_0x2452('0x94')][_0x2452('0xb3')]()[_0x2452('0x15')](respondWithResult(_0x1b9e68,null))[_0x2452('0xab')](handleError(_0x1b9e68,null));};exports['createVidaooSession']=function(_0x39728d,_0x35365c){var _0x27cc0c=_0x39728d[_0x2452('0xad')]['id'];var _0x2e6ca3;var _0x44677c;var _0x3eeda5;return db[_0x2452('0x94')]['findOne']({'where':{'id':_0x27cc0c}})[_0x2452('0x15')](function(_0x327495){_0x2e6ca3=_0x327495;return db[_0x2452('0xb4')][_0x2452('0xb5')]({'where':{'id':_0x327495[_0x2452('0x78')]},'attributes':['id',_0x2452('0xb6'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x2452('0xb7')],'raw':!![]});})[_0x2452('0x15')](function(_0xe486f7){if(_0xe486f7&&_0xe486f7[_0x2452('0xb6')]&&_0xe486f7[_0x2452('0xb8')]){_0x44677c=_0xe486f7;var _0x593025={'interaction':{'id':_0x27cc0c},'agent':{'id':_0x39728d[_0x2452('0x8b')]['id'],'name':_0x39728d['user'][_0x2452('0x29')],'fullname':_0x39728d[_0x2452('0x8b')][_0x2452('0x33')],'email':_0x39728d['user']['email']},'contact':_0x39728d[_0x2452('0x2c')]['contact'],'account':_0x39728d[_0x2452('0x2c')][_0x2452('0x30')]};var _0xb4400a={'rejectUnauthorized':![],'method':_0x2452('0xb9'),'url':_0x2452('0xba'),'headers':{'X-APIKEY':_0xe486f7[_0x2452('0xb6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x39728d['user']['email']],'buttons':null,'topic':_0x44677c['vidaooTopic'],'note':_['isNull'](_0x44677c[_0x2452('0xbb')])?null:getMustacheRender(_0x44677c[_0x2452('0xbb')],_0x593025),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x44677c[_0x2452('0xb7')])){var _0x3afe7f=getMustacheRender(_0x44677c['vidaooMetadata'],_0x593025);var _0x3a8e0b=JSON[_0x2452('0x7c')](_0x3afe7f);_0xb4400a[_0x2452('0x2c')][_0x2452('0xbc')]=_0x3a8e0b;}}catch(_0x3a8057){throw new db[(_0x2452('0x84'))]['ValidationError'](_0x2452('0xbd'));}return rp(_0xb4400a);}else{throw new db[(_0x2452('0x84'))][(_0x2452('0xbe'))](_0x2452('0xbf'));}})[_0x2452('0x15')](function(_0x572caa){_0x3eeda5=_0x572caa;if(_0x3eeda5['id']){var _0x257dfd={'body':_0x3eeda5[_0x2452('0xc0')],'ChatWebsiteId':_0x44677c['id'],'ChatInteractionId':_0x2e6ca3['id'],'direction':'out','UserId':_0x39728d['user']['id']};return db[_0x2452('0xc1')][_0x2452('0xb1')](_0x257dfd,{});}else{throw new db[(_0x2452('0x84'))][(_0x2452('0xbe'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x2452('0x15')](function(){return _0x2e6ca3[_0x2452('0xc2')]({'vidaooSessionId':_0x3eeda5['id']});})[_0x2452('0x15')](respondWithResult(_0x35365c,null))[_0x2452('0xab')](handleError(_0x35365c,null));};exports[_0x2452('0xc3')]=function(_0x27ac75,_0x73af1a){if(_0x27ac75[_0x2452('0x2c')]['id']){delete _0x27ac75[_0x2452('0x2c')]['id'];}return db['ChatInteraction'][_0x2452('0x65')]({'where':{'id':_0x27ac75['params']['id']},'include':[{'model':db['CmContact'],'as':_0x2452('0xc4')}]})[_0x2452('0x15')](handleEntityNotFound(_0x73af1a,null))[_0x2452('0x15')](saveUpdates(_0x27ac75[_0x2452('0x2c')],null))[_0x2452('0x15')](respondWithResult(_0x73af1a,null))['catch'](handleError(_0x73af1a,null));};exports[_0x2452('0xc5')]=function(_0x5c1308,_0x4b02e6){if(_0x5c1308['body']['id']){delete _0x5c1308[_0x2452('0x2c')]['id'];}return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x5c1308[_0x2452('0xad')]['id']}})[_0x2452('0x15')](function(_0x1e45ff){if(!_0x1e45ff){logger[_0x2452('0x1b')](_0x2452('0xc6'),_0x2452('0xc5'),0x194,_0x2452('0xc7'));_0x4b02e6['sendStatus'](0x194);}else{if(_0x1e45ff[_0x2452('0x3e')]){throw new db['Sequelize']['ValidationError'](_0x2452('0xc8'));}}return _0x1e45ff;})['then'](function(_0x703ee5){if(_0x703ee5){return _0x703ee5[_0x2452('0x27')]({'closed':_0x5c1308[_0x2452('0x2c')][_0x2452('0x3c')],'disposition':_0x5c1308['body'][_0x2452('0xc9')]})[_0x2452('0x15')](function(_0x419529){return _0x419529;});}})[_0x2452('0x15')](function(){return respondWithRpcPromise(_0x2452('0xca'),_0x2452('0xc5'),_0x5c1308[_0x2452('0x2c')],client9004);})[_0x2452('0x15')](respondWithResult(_0x4b02e6,null))[_0x2452('0xab')](handleError(_0x4b02e6,null));};exports['attachmentUpload']=function(_0x26dbe2,_0x3be01e){_0x26dbe2[_0x2452('0x2c')]['name']=_0x26dbe2[_0x2452('0xcb')]['originalname'];_0x26dbe2[_0x2452('0x2c')][_0x2452('0xcc')]=_0x26dbe2[_0x2452('0xcb')][_0x2452('0xcd')];_0x26dbe2[_0x2452('0x2c')]['type']=_0x26dbe2[_0x2452('0xcb')]['mimetype'];return db['Attachment']['create'](_0x26dbe2[_0x2452('0x2c')])['then'](respondWithResult(_0x3be01e,0xc9))[_0x2452('0xab')](handleError(_0x3be01e,null));};exports['attachmentDownload']=function(_0x12b4c6,_0x59fb94){return db[_0x2452('0x94')][_0x2452('0xb5')]({'where':{'id':_0x12b4c6[_0x2452('0xad')]['id']},'raw':!![]})[_0x2452('0x15')](handleEntityNotFound(_0x59fb94,null))[_0x2452('0x15')](function(_0x17f759){if(_0x17f759){if(_0x17f759['closed']){return _0x59fb94[_0x2452('0x1f')](0x193)['json']({'status':0x193,'message':_0x2452('0xce')});}return db[_0x2452('0xcf')][_0x2452('0xb5')]({'where':{'id':_0x12b4c6[_0x2452('0x42')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x59fb94,null));}})[_0x2452('0x15')](function(_0xc91e25){if(_0xc91e25){var _0xf07c57=_0xc91e25[_0x2452('0xd0')]!==null;var _0x5edb11=path[_0x2452('0xd1')](config[_0x2452('0xd2')],'server/files/attachments/');if(_0xf07c57){_0x5edb11=path[_0x2452('0xd1')](_0x5edb11,_0x2452('0xd3'));}var _0x19722b=path[_0x2452('0xd1')](_0x5edb11,_0xc91e25['basename']);return _0x59fb94[_0x2452('0xd4')](_0x19722b);}})[_0x2452('0xab')](handleError(_0x59fb94,null));};exports['close']=function(_0x4e342c,_0x4e8fd9){var _0x173d77=null;var _0x3c454d=null;var _0x47ba11=null;if(_0x4e342c['body']['id']){delete _0x4e342c[_0x2452('0x2c')]['id'];}if(_0x4e342c[_0x2452('0x2c')][_0x2452('0xd5')]){_0x47ba11=path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0xd6'),util[_0x2452('0xd7')](_0x2452('0xd8'),Date[_0x2452('0xd9')]()));_0x4e342c[_0x2452('0x2c')][_0x2452('0xda')]=_0x47ba11;}return db['ChatInteraction'][_0x2452('0x65')]({'where':{'id':_0x4e342c['params']['id']},'include':[{'model':db[_0x2452('0xc1')],'as':_0x2452('0xdb'),'include':[{'model':db[_0x2452('0x70')],'as':_0x2452('0x70')}]}]})['then'](handleEntityNotFound(_0x4e8fd9,null))[_0x2452('0x15')](saveUpdates(_0x4e342c[_0x2452('0x2c')],null))[_0x2452('0x15')](function(_0x3682ee){if(_0x3682ee){_0x173d77=_0x3682ee;return db[_0x2452('0xb4')][_0x2452('0x65')]({'where':{'id':_0x173d77[_0x2452('0x78')]}});}})[_0x2452('0x15')](function(_0x283cb3){if(_0x283cb3){_0x3c454d=_0x283cb3;return db[_0x2452('0xdc')]['find']({'where':{'id':_0x173d77['ContactId']}});}})[_0x2452('0x15')](function(_0x48ce24){if(_0x48ce24){if(_0x47ba11){var _0x38c7a0=null;for(var _0x48eff7=0x1;_0x48eff7<_0x173d77[_0x2452('0xdb')][_0x2452('0xa6')];++_0x48eff7){_0x38c7a0=_0x173d77[_0x2452('0xdb')][_0x48eff7];var _0x1f0117=_0x38c7a0[_0x2452('0x3e')]?util[_0x2452('0xd7')](_0x2452('0xdd'),_0x3c454d[_0x2452('0xde')],_0x38c7a0[_0x2452('0x3e')]):_0x2452('0xdf');var _0x53ac7a=_0x4e342c['body'][_0x2452('0xe0')]||util[_0x2452('0xd7')](_0x2452('0xdd'),_0x2452('0xe1'),_0x38c7a0[_0x2452('0x6b')]);switch(_0x3c454d[_0x2452('0xe2')]){case _0x2452('0xe3'):_0x1f0117=_0x38c7a0['UserId']?util[_0x2452('0xd7')]('%s%d',_0x3c454d['agentAlias'],_0x38c7a0[_0x2452('0x3e')]):'System';break;case _0x2452('0xe4'):_0x1f0117=_0x38c7a0['UserId']?_0x38c7a0[_0x2452('0x70')][_0x2452('0xe5')]||_0x38c7a0[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf');break;case _0x2452('0xe6'):_0x1f0117=_0x38c7a0[_0x2452('0x3e')]?_0x38c7a0[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf');break;default:_0x1f0117=_0x38c7a0['UserId']?util[_0x2452('0xd7')](_0x2452('0xdd'),_0x3c454d[_0x2452('0xde')],_0x38c7a0[_0x2452('0x3e')]):_0x2452('0xdf');}var _0x3d223d=util['format'](_0x2452('0xe7'),moment(_0x38c7a0[_0x2452('0x7b')])[_0x2452('0xd7')](_0x2452('0xe8')),_0x38c7a0[_0x2452('0xe9')]==='in'?_0x53ac7a:_0x1f0117,_0x38c7a0[_0x2452('0x2c')]);if(!_0x38c7a0['secret']){fs[_0x2452('0xea')](_0x47ba11,_0x3d223d);}}return db[_0x2452('0xeb')][_0x2452('0xb5')]({'where':{'service':!![]},'include':[{'model':db[_0x2452('0xec')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2452('0xed')],'as':_0x2452('0xed'),'raw':!![]}]}]});}}})['then'](function(_0x8392be){if(!_0x8392be||!_0x8392be[_0x2452('0xee')]||!_0x4e342c[_0x2452('0x2c')])return _0x173d77;var _0x1c5ccc=_0x8392be[_0x2452('0xef')]();return respondWithRpcPromise(_0x2452('0xf0'),'sendMail',{'account':_0x1c5ccc,'message':{'from':util[_0x2452('0xd7')]('\x22%s\x22\x20<%s>',_0x8392be['name'],_0x8392be[_0x2452('0xf1')]||_0x8392be[_0x2452('0xee')][_0x2452('0x8b')]),'to':_0x4e342c['body']['mailTranscript'],'subject':_0x2452('0xf2'),'text':util[_0x2452('0xd7')](_0x2452('0xf3'),_0x4e342c[_0x2452('0x2c')][_0x2452('0xd5')]),'attachments':[{'path':_0x47ba11}]}})[_0x2452('0x15')](function(){return _0x173d77;})[_0x2452('0xab')](function(_0x2cd73c){logger[_0x2452('0x1b')](_0x2cd73c);});})['then'](respondWithStatusCode(_0x4e8fd9,0xc8))['catch'](handleError(_0x4e8fd9,null));};exports[_0x2452('0xf4')]=function(_0x3a79d9,_0xd86a41){return db[_0x2452('0xc1')][_0x2452('0x65')]({'where':{'id':_0x3a79d9['params']['id']}})[_0x2452('0x15')](handleEntityNotFound(_0xd86a41,null))[_0x2452('0x15')](function(_0x56d8b6){if(_0x56d8b6){return _0x56d8b6[_0x2452('0xf4')](_0x3a79d9['body']['ids'],_[_0x2452('0xf5')](_0x3a79d9[_0x2452('0x2c')],[_0x2452('0xf6'),'id'])||{});}})[_0x2452('0x15')](respondWithResult(_0xd86a41,null))[_0x2452('0xab')](handleError(_0xd86a41,null));};exports['getMessages']=function(_0x2ec7b4,_0x2395e0){var _0x5d2e57={'raw':![],'where':{}};var _0x39936f={};var _0x5481d5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2452('0xb5')]({'where':{'id':_0x2ec7b4[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x2395e0,null))[_0x2452('0x15')](function(_0x56a09d){if(_0x56a09d){_0x39936f[_0x2452('0x45')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x39936f[_0x2452('0x42')]=_['keys'](_0x2ec7b4[_0x2452('0x42')]);_0x39936f[_0x2452('0x4b')]=_[_0x2452('0x44')](_0x39936f[_0x2452('0x45')],_0x39936f[_0x2452('0x42')]);_0x5d2e57[_0x2452('0x46')]=_[_0x2452('0x44')](_0x39936f[_0x2452('0x45')],qs[_0x2452('0x95')](_0x2ec7b4['query'][_0x2452('0x95')]));_0x5d2e57[_0x2452('0x46')]=_0x5d2e57[_0x2452('0x46')][_0x2452('0xa6')]?_0x5d2e57[_0x2452('0x46')]:_0x39936f[_0x2452('0x45')];if(!_0x2ec7b4['query'][_0x2452('0x47')](_0x2452('0xf7'))){_0x5d2e57[_0x2452('0x24')]=qs['limit'](_0x2ec7b4['query'][_0x2452('0x24')]);_0x5d2e57['offset']=qs[_0x2452('0x22')](_0x2ec7b4[_0x2452('0x42')][_0x2452('0x22')]);}_0x5d2e57[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x2ec7b4[_0x2452('0x42')][_0x2452('0x49')]);_0x5d2e57['where']=qs['filters'](_[_0x2452('0x4c')](_0x2ec7b4[_0x2452('0x42')],_0x39936f['filters']));_0x5d2e57[_0x2452('0x4a')][_0x2452('0xa7')]=_0x56a09d['id'];if(_0x2ec7b4['query'][_0x2452('0x81')]){_0x5d2e57[_0x2452('0x4a')]=_[_0x2452('0x93')](_0x5d2e57[_0x2452('0x4a')],{'$or':_['map'](_0x5d2e57[_0x2452('0x46')],function(_0x1e6e2c){var _0x45d809={};_0x45d809[_0x1e6e2c]={'$like':'%'+_0x2ec7b4[_0x2452('0x42')][_0x2452('0x81')]+'%'};return _0x45d809;})});}if(_0x2ec7b4['query'][_0x2452('0xf8')]){var _0x4806e4=_0x2ec7b4[_0x2452('0x42')]['$gte']['split'](',');var _0x519968={};_0x519968[_0x4806e4[0x0]]={'$gte':moment(_0x4806e4[0x1])[_0x2452('0xd7')](_0x2452('0xf9'))};_0x5d2e57[_0x2452('0x4a')]=_[_0x2452('0x93')](_0x5d2e57[_0x2452('0x4a')],_0x519968);}_0x5d2e57=_[_0x2452('0x93')]({},_0x5d2e57,_0x2ec7b4[_0x2452('0xb0')]);return db['ChatMessage']['count']({'where':_0x5d2e57['where']})['then'](function(_0x582812){_0x5481d5['count']=_0x582812;if(_0x2ec7b4[_0x2452('0x42')]['includeAll']){_0x5d2e57[_0x2452('0xaf')]=[{'all':!![]}];}return db['ChatMessage'][_0x2452('0xfa')](_0x5d2e57);})[_0x2452('0x15')](function(_0x42d5af){_0x5481d5['rows']=_0x42d5af;return _0x5481d5;});}})[_0x2452('0x15')](respondWithFilteredResult(_0x2395e0,_0x5d2e57))[_0x2452('0xab')](handleError(_0x2395e0,null));};exports[_0x2452('0xfb')]=function(_0x23c05e,_0x447013){var _0xaa3e42={'where':{}},_0x10a04f={},_0x4eaad6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2452('0xb5')]({'where':{'id':_0x23c05e[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x447013,null))[_0x2452('0x15')](function(_0x59c8d3){if(_0x59c8d3){_0x10a04f[_0x2452('0x45')]=_[_0x2452('0x43')](db[_0x2452('0xc1')]['rawAttributes']);_0x10a04f[_0x2452('0x42')]=_[_0x2452('0x43')](_0x23c05e[_0x2452('0x42')]);_0x10a04f['filters']=_[_0x2452('0x44')](_0x10a04f[_0x2452('0x45')],_0x10a04f['query']);_0xaa3e42['attributes']=_['intersection'](_0x10a04f[_0x2452('0x45')],qs[_0x2452('0x95')](_0x23c05e[_0x2452('0x42')]['fields']));_0xaa3e42[_0x2452('0x46')]=_0xaa3e42['attributes']['length']?_0xaa3e42[_0x2452('0x46')]:_0x10a04f[_0x2452('0x45')];if(!_0x23c05e[_0x2452('0x42')]['hasOwnProperty'](_0x2452('0xf7'))){_0xaa3e42[_0x2452('0x24')]=qs[_0x2452('0x24')](_0x23c05e[_0x2452('0x42')][_0x2452('0x24')]);_0xaa3e42[_0x2452('0x22')]=qs[_0x2452('0x22')](_0x23c05e[_0x2452('0x42')][_0x2452('0x22')]);}_0xaa3e42[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x23c05e[_0x2452('0x42')]['sort']);_0xaa3e42[_0x2452('0x4a')]=qs[_0x2452('0x4b')](_[_0x2452('0x4c')](_0x23c05e['query'],_0x10a04f[_0x2452('0x4b')]));_0xaa3e42['where']['ChatInteractionId']=_0x59c8d3['id'];if(_0x23c05e[_0x2452('0x42')][_0x2452('0x81')]){_0xaa3e42['where']=_[_0x2452('0x93')](_0xaa3e42['where'],{'$or':_['map'](_0xaa3e42[_0x2452('0x46')],function(_0x59a23a){var _0x1d4f38={};_0x1d4f38[_0x59a23a]={'$like':'%'+_0x23c05e[_0x2452('0x42')][_0x2452('0x81')]+'%'};return _0x1d4f38;})});}_0xaa3e42[_0x2452('0x4a')][_0x2452('0xfc')]=![];if(_0x23c05e[_0x2452('0x42')]['id']){_0xaa3e42[_0x2452('0x4a')]['id']={'$gt':_0x23c05e[_0x2452('0x42')]['id']};}_0xaa3e42=_[_0x2452('0x93')]({},_0xaa3e42,_0x23c05e[_0x2452('0xb0')]);return db[_0x2452('0xc1')][_0x2452('0x90')]({'where':_0xaa3e42[_0x2452('0x4a')]})[_0x2452('0x15')](function(_0x1a04a9){_0x4eaad6['count']=_0x1a04a9;_0xaa3e42[_0x2452('0xaf')]=[];if(_0x23c05e[_0x2452('0x42')]['includeAgent']){_0xaa3e42[_0x2452('0xaf')][_0x2452('0xa8')]({'model':db[_0x2452('0x70')],'as':_0x2452('0x70'),'attributes':['id',_0x2452('0x33'),_0x2452('0xe5')]});}if(_0x23c05e['query'][_0x2452('0xae')]){_0xaa3e42[_0x2452('0xaf')]=[{'all':!![]}];}return db[_0x2452('0xc1')][_0x2452('0xfa')](_0xaa3e42);})[_0x2452('0x15')](function(_0x198a21){_0x4eaad6[_0x2452('0xaa')]=_0x198a21;return _0x4eaad6;});}})[_0x2452('0x15')](respondWithFilteredResult(_0x447013,_0xaa3e42))[_0x2452('0xab')](handleError(_0x447013,null));};exports['addTags']=function(_0x35a94a,_0x40d4ed){return db['ChatInteraction']['find']({'where':{'id':_0x35a94a[_0x2452('0xad')]['id']}})['then'](handleEntityNotFound(_0x40d4ed,null))[_0x2452('0x15')](function(_0x5edce1){if(_0x5edce1){return _0x5edce1['setTags'](_0x35a94a[_0x2452('0x2c')][_0x2452('0xf6')],_[_0x2452('0xf5')](_0x35a94a[_0x2452('0x2c')],['ids','id'])||{})[_0x2452('0xfd')](function(){return db[_0x2452('0xfe')][_0x2452('0xfa')]({'attributes':['id','name','color'],'where':{'id':_0x35a94a[_0x2452('0x2c')][_0x2452('0xf6')]}});})[_0x2452('0x15')](function(_0x578cb2){socket['emit'](_0x2452('0xff'),{'id':Number(_0x35a94a[_0x2452('0xad')]['id']),'tags':_0x578cb2||[]});return{'id':Number(_0x35a94a['params']['id']),'tags':_0x578cb2||[]};});}})[_0x2452('0x15')](respondWithResult(_0x40d4ed,null))[_0x2452('0xab')](handleError(_0x40d4ed,null));};exports['removeTags']=function(_0x29aa63,_0x12cf38){return db[_0x2452('0x94')]['find']({'where':{'id':_0x29aa63[_0x2452('0xad')]['id']}})['then'](handleEntityNotFound(_0x12cf38,null))[_0x2452('0x15')](function(_0x3ce9bf){if(_0x3ce9bf){return _0x3ce9bf[_0x2452('0x100')](_0x29aa63[_0x2452('0x42')][_0x2452('0xf6')]);}})[_0x2452('0x15')](respondWithStatusCode(_0x12cf38,null))[_0x2452('0xab')](handleError(_0x12cf38,null));};exports[_0x2452('0xd4')]=function(_0xa57faf,_0x238d8e){var _0x25968d=moment()[_0x2452('0x101')]()['toString']();var _0x16d2fc=path[_0x2452('0xd1')](config['root'],_0x2452('0x102'),_0x2452('0x103'),_0x2452('0x104'));var _0xfdca38=path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0x102'),_0x2452('0x103'),_0x2452('0x105'));var _0x56575a=path[_0x2452('0xd1')](_0x16d2fc,_0x25968d);var _0x4724d2=util['format'](_0x2452('0x106'),_0xa57faf[_0x2452('0xad')]['id'],_0x25968d);var _0x98ad63=path['join'](_0x16d2fc,_0x4724d2);var _0x4d2a07=[];_0x4d2a07[_0x2452('0xa8')]({'model':db[_0x2452('0x70')],'as':_0x2452('0x70'),'attributes':['id',_0x2452('0x33')],'raw':!![]});_0x4d2a07['push']({'model':db[_0x2452('0xdc')],'as':'Contact','attributes':['id','firstName',_0x2452('0x107')],'raw':!![]});if(_0xa57faf[_0x2452('0x42')][_0x2452('0x105')]){_0x4d2a07[_0x2452('0xa8')]({'model':db[_0x2452('0xcf')],'as':'Attachment','raw':!![]});}var _0x4faf49=[{'model':db[_0x2452('0xc1')],'as':_0x2452('0xdb'),'attributes':['id',_0x2452('0x2c'),'createdAt',_0x2452('0xe9'),_0x2452('0xfc'),_0x2452('0x108')],'include':_0x4d2a07}];_0x4faf49[_0x2452('0xa8')]({'model':db[_0x2452('0xb4')],'as':_0x2452('0x109'),'attributes':['id',_0x2452('0x29')]});_0x4faf49[_0x2452('0xa8')]({'model':db['User'],'as':'Owner','attributes':['id',_0x2452('0x33')]});return db[_0x2452('0x94')]['find']({'where':{'id':_0xa57faf[_0x2452('0xad')]['id']},'include':_0x4faf49})[_0x2452('0x15')](handleEntityNotFound(_0x238d8e,null))[_0x2452('0x15')](function(_0x160781){if(_0x160781){var _0x16aa9b=_0x160781['get']({'plain':!![]});fs['mkdirSync'](_0x56575a);var _0x19660b={'channel':_0x2452('0x10a'),'account':_0x16aa9b['Account'][_0x2452('0x29')],'agent':_0x16aa9b['Owner']?_0x16aa9b[_0x2452('0x10b')][_0x2452('0x33')]:'N.A.','createdAt':moment(_0x16aa9b['createdAt'])[_0x2452('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2452('0x91')](),'closedAt':_0x16aa9b[_0x2452('0x3c')]?moment(_0x16aa9b[_0x2452('0x10c')])[_0x2452('0xd7')](_0x2452('0xf9'))['toString']():'','disposition':_0x16aa9b[_0x2452('0xc9')],'chatInfo':{'browser':_0x16aa9b[_0x2452('0x10d')],'os':_0x16aa9b[_0x2452('0x10e')],'referer':_0x16aa9b[_0x2452('0x10f')],'customerIp':_0x16aa9b[_0x2452('0x110')],'customerPort':_0x16aa9b[_0x2452('0x111')]?_0x16aa9b['customerPort']:'N.A.'},'messages':_(_0x16aa9b[_0x2452('0xdb')])[_0x2452('0x112')]()[_0x2452('0x81')]({'secret':![]})[_0x2452('0x32')](function(_0x362b56){if(_0x362b56[_0x2452('0xcf')]){var _0x27b007=path[_0x2452('0xd1')](_0xfdca38,_0x362b56[_0x2452('0xcf')]['basename']);if(fs[_0x2452('0x113')](_0x27b007)){fs[_0x2452('0x114')](_0x27b007)[_0x2452('0x115')](fs['createWriteStream'](path[_0x2452('0xd1')](_0x56575a,_0x362b56['Attachment'][_0x2452('0xcc')])));}}return{'date':moment(_0x362b56['createdAt'])[_0x2452('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x362b56[_0x2452('0xe9')]===_0x2452('0x116')?_0x362b56['User']?_0x362b56[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf'):_0x362b56[_0x2452('0xc4')][_0x2452('0x117')]+(_0x362b56[_0x2452('0xc4')][_0x2452('0x107')]?'\x20'+_0x362b56[_0x2452('0xc4')][_0x2452('0x107')]:''),'body':_0x362b56['Attachment']?_0x362b56[_0x2452('0xcf')][_0x2452('0xcc')]:_0x362b56[_0x2452('0x2c')],'direction':_0x362b56[_0x2452('0xe9')]===_0x2452('0x116')?'A':'C','secret':_0x362b56[_0x2452('0xfc')],'read':_0x362b56[_0x2452('0x108')],'attachment':_0x362b56[_0x2452('0xcf')]};})[_0x2452('0x6a')]()};return ejs[_0x2452('0x118')](path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0x102'),_0x2452('0x119'),_0x2452('0x11a')),{'interaction':_0x19660b})['then'](function(_0x388ee5){var _0xe6661a=path[_0x2452('0xd1')](_0x56575a,'transcript-'+_0x16aa9b['id']+'-'+_0x25968d+_0x2452('0x11b'));var _0x4d298d={'path':_0xe6661a,'channel':'Chat','interactionId':_0x16aa9b['id']};return pdf[_0x2452('0x11c')](_0x388ee5,_0x4d298d);})[_0x2452('0x15')](function(){return new Promise(function(_0x4685a1,_0x569219){zipdir(_0x56575a,{'saveTo':_0x98ad63},function(_0x4aa0c4,_0x18d287){if(_0x4aa0c4)return _0x569219(_0x4aa0c4);return _0x4685a1(_0x18d287);});})[_0x2452('0x15')](function(){return new BPromise(function(_0x4f58bc,_0x910348){rimraf(_0x56575a,function(_0x20d1c5){if(_0x20d1c5)_0x910348(_0x20d1c5);return _0x4f58bc();});});})['then'](function(){return _0x238d8e[_0x2452('0xd4')](_0x98ad63,_0x4724d2,function(_0x1b3952){if(_0x1b3952){logger[_0x2452('0x1b')](_0x2452('0x11d'),_0x1b3952);}else{fs[_0x2452('0x11e')](_0x98ad63);}});});});}else{return _0x238d8e[_0x2452('0x1e')](0xc8);}})['catch'](handleError(_0x238d8e,null));}; \ No newline at end of file +var _0x6f0d=['CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','createdAt','direction','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','send','render','body','agent','interaction','account','Users','TagIds','Tags','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','map','rawAttributes','key','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','select','field','from','u.fullname','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','having','`\x20=\x200','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','rows','include','merge','options','find','create','params','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages'];(function(_0x34bf42,_0x4fbc9c){var _0x46de16=function(_0x5f4d1c){while(--_0x5f4d1c){_0x34bf42['push'](_0x34bf42['shift']());}};_0x46de16(++_0x4fbc9c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x557439,_0x522fac){_0x557439=_0x557439-0x0;var _0x5bbcc7=_0x6f0d[_0x557439];return _0x5bbcc7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd6f0('0x0'));var rp=require(_0xd6f0('0x1'));var moment=require(_0xd6f0('0x2'));var BPromise=require(_0xd6f0('0x3'));var Mustache=require('mustache');var util=require(_0xd6f0('0x4'));var path=require(_0xd6f0('0x5'));var ejs=require(_0xd6f0('0x6'));var fs=require('fs');var _=require(_0xd6f0('0x7'));var squel=require(_0xd6f0('0x8'));var Redis=require('ioredis');var qs=require(_0xd6f0('0x9'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd6f0('0xa'));var logger=require(_0xd6f0('0xb'))(_0xd6f0('0xc'));var config=require(_0xd6f0('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd6f0('0xe')](config[_0xd6f0('0xf')],{'host':_0xd6f0('0x10'),'port':0x18eb});var socket=require(_0xd6f0('0x11'))(new Redis(config[_0xd6f0('0xf')]));require('./chatInteraction.socket')[_0xd6f0('0x12')](socket);var jayson=require(_0xd6f0('0x13'));var client=jayson[_0xd6f0('0x14')][_0xd6f0('0x15')]({'port':0x232b});var client9004=jayson['client'][_0xd6f0('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x2f0459,_0x306aad,_0x45973d,_0x109655){return new BPromise(function(_0x409549,_0x2bf5b8){var _0x250999=_0x109655||client;return _0x250999[_0xd6f0('0x16')](_0x2f0459,_0x45973d)['then'](function(_0x2b3f32){logger[_0xd6f0('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0xd6f0('0x18'));logger['debug'](_0xd6f0('0x19'),_0x306aad,_0xd6f0('0x18'),JSON[_0xd6f0('0x1a')](_0x2b3f32));if(_0x2b3f32[_0xd6f0('0x1b')]){if(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1c')]===0x1f4){logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x2bf5b8(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);}logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x409549(_0x2b3f32['error']['message']);}else{logger[_0xd6f0('0x17')](_0xd6f0('0x1d'),_0x306aad,_0xd6f0('0x18'));_0x409549(_0x2b3f32['result'][_0xd6f0('0x1e')]);}})[_0xd6f0('0x1f')](function(_0x557c9b){logger[_0xd6f0('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0x557c9b);_0x2bf5b8(_0x557c9b);});});}function respondWithStatusCode(_0x1ee584,_0x1c9d90){_0x1c9d90=_0x1c9d90||0xcc;return function(_0x5dbe1c){if(_0x5dbe1c){return _0x1ee584[_0xd6f0('0x20')](_0x1c9d90);}return _0x1ee584[_0xd6f0('0x21')](_0x1c9d90)['end']();};}function respondWithResult(_0x3dbdc3,_0x402070){_0x402070=_0x402070||0xc8;return function(_0x283a07){if(_0x283a07){return _0x3dbdc3['status'](_0x402070)[_0xd6f0('0x22')](_0x283a07);}};}function respondWithFilteredResult(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(_0xcea0ae){var _0x551be8=typeof _0x5ecb16[_0xd6f0('0x23')]===_0xd6f0('0x24')&&typeof _0x5ecb16[_0xd6f0('0x25')]===_0xd6f0('0x24');var _0x4101bd=_0xcea0ae[_0xd6f0('0x26')];var _0x12d6ec=_0x551be8?0x0:_0x5ecb16[_0xd6f0('0x23')];var _0x48975d=_0x551be8?_0xcea0ae[_0xd6f0('0x26')]:_0x5ecb16[_0xd6f0('0x23')]+_0x5ecb16['limit'];var _0x38a3e9;if(_0x48975d>=_0x4101bd){_0x48975d=_0x4101bd;_0x38a3e9=0xc8;}else{_0x38a3e9=0xce;}_0x3dc166[_0xd6f0('0x21')](_0x38a3e9);return _0x3dc166[_0xd6f0('0x27')](_0xd6f0('0x28'),_0x12d6ec+'-'+_0x48975d+'/'+_0x4101bd)[_0xd6f0('0x22')](_0xcea0ae);}return null;};}function saveUpdates(_0x39e96a){return function(_0x351fda){if(_0x351fda){return _0x351fda[_0xd6f0('0x29')](_0x39e96a)[_0xd6f0('0x2a')](function(_0x43f72f){return _0x43f72f;});}return null;};}function removeEntity(_0x1dff9b){return function(_0x3e913a){if(_0x3e913a){return _0x3e913a[_0xd6f0('0x2b')]()[_0xd6f0('0x2a')](function(){_0x1dff9b[_0xd6f0('0x21')](0xcc)[_0xd6f0('0x2c')]();});}};}function handleEntityNotFound(_0x31c493){return function(_0x376890){if(!_0x376890){_0x31c493[_0xd6f0('0x20')](0x194);}return _0x376890;};}function handleError(_0x180e5f,_0x3906ca){_0x3906ca=_0x3906ca||0x1f4;return function(_0x26ab29){logger['error'](_0x26ab29[_0xd6f0('0x2d')]);if(_0x26ab29['name']){delete _0x26ab29['name'];}_0x180e5f[_0xd6f0('0x21')](_0x3906ca)[_0xd6f0('0x2e')](_0x26ab29);};}function getMustacheRender(_0x12a6fa,_0x27ad7e){return Mustache[_0xd6f0('0x2f')](_0x12a6fa,_['merge'](_0x27ad7e[_0xd6f0('0x30')],{'contact':_0x27ad7e['contact'],'message':_0x27ad7e[_0xd6f0('0x1e')],'agent':_0x27ad7e[_0xd6f0('0x31')],'interaction':_0x27ad7e[_0xd6f0('0x32')],'account':_0x27ad7e[_0xd6f0('0x33')]}))||'';}function getInteractionUsers(_0x518751,_0x5c3132){return new BPromise(function(_0x47b33d,_0x3b6463){try{if(_0x5c3132[_0x518751['id']]){_0x518751[_0xd6f0('0x34')]=_['map'](_0x5c3132[_0x518751['id']],function(_0x1d200a){return{'id':_0x1d200a['id'],'fullname':_0x1d200a['fullname']};});}}catch(_0x507f66){_0x3b6463(_0x507f66);}_0x47b33d(_0x518751);});}function getInteractionTags(_0x2fd7b8,_0x28659e){return new BPromise(function(_0x1852dd,_0x451834){try{if(_0x2fd7b8[_0xd6f0('0x35')]){_0x2fd7b8[_0xd6f0('0x36')]=[];_0x2fd7b8['TagIds']['split'](',')[_0xd6f0('0x37')](function(_0xf879a6){_0x2fd7b8[_0xd6f0('0x36')]['push'](_0x28659e[_0xf879a6]);});}delete _0x2fd7b8['TagIds'];}catch(_0x13b41d){_0x451834(_0x13b41d);}_0x1852dd(_0x2fd7b8);});}function updateChatInteraction(_0x2def01,_0x39fd07,_0x38d06f){return new BPromise(function(_0x2e3225,_0x2b5df5){return getInteractionUsers(_0x2def01,_0x38d06f)[_0xd6f0('0x2a')](function(_0x64359c){return getInteractionTags(_0x64359c,_0x39fd07);})['then'](function(_0x1af620){return getStateInteraction(_0x1af620);})[_0xd6f0('0x2a')](function(_0x1e3c8a){_0x2e3225(_0x1e3c8a);})[_0xd6f0('0x1f')](function(_0x57b83e){_0x2b5df5(_0x57b83e);});});}function getStateInteraction(_0x1981bd){return new BPromise(function(_0x94ec6d){_0x1981bd[_0xd6f0('0x38')]=0x0;_0x1981bd[_0xd6f0('0x39')]=0x0;_0x1981bd[_0xd6f0('0x3a')]=0x0;_0x1981bd['unmanaged']=0x0;_0x1981bd[_0xd6f0('0x3b')]=0x0;_0x1981bd[_0xd6f0('0x3c')]=0x0;if(!_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd['UserId']){_0x1981bd[_0xd6f0('0x38')]+=0x1;}if(!_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['UserId']){_0x1981bd['talking']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['disposition']===_0xd6f0('0x3b')){_0x1981bd[_0xd6f0('0x3b')]+=0x1;if(_0x1981bd['waiting']){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd[_0xd6f0('0x3e')]&&_0x1981bd[_0xd6f0('0x3f')]){_0x1981bd['unmanaged']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd[_0xd6f0('0x3e')]){_0x1981bd[_0xd6f0('0x3a')]+=0x1;if(_0x1981bd[_0xd6f0('0x39')]){_0x1981bd[_0xd6f0('0x39')]-=0x1;}}_0x1981bd[_0xd6f0('0x3c')]+=0x1;_0x94ec6d(_0x1981bd);});}exports['index']=function(_0x909f20,_0x3d42ca){var _0x55e93b={},_0x268772={},_0x39ca69={'count':0x0,'rows':[]};var _0x1bcb36=_[_0xd6f0('0x40')](db['ChatInteraction'][_0xd6f0('0x41')],function(_0xe5fd11){return{'name':_0xe5fd11['fieldName'],'type':_0xe5fd11['type'][_0xd6f0('0x42')]};});_0x268772['model']=_[_0xd6f0('0x40')](_0x1bcb36,_0xd6f0('0x43'));_0x268772[_0xd6f0('0x44')]=_['keys'](_0x909f20[_0xd6f0('0x44')]);_0x268772[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x268772[_0xd6f0('0x47')],_0x268772[_0xd6f0('0x44')]);_0x55e93b['attributes']=_[_0xd6f0('0x46')](_0x268772['model'],qs[_0xd6f0('0x48')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x55e93b[_0xd6f0('0x49')]=_0x55e93b['attributes']['length']?_0x55e93b[_0xd6f0('0x49')]:_0x268772[_0xd6f0('0x47')];if(!_0x909f20['query'][_0xd6f0('0x4a')]('nolimit')){_0x55e93b[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x25')]);_0x55e93b[_0xd6f0('0x23')]=qs['offset'](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x55e93b[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x55e93b[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x909f20[_0xd6f0('0x44')],_0x268772[_0xd6f0('0x45')]),_0x1bcb36);var _0x469e92=[];var _0x29509e=squel[_0xd6f0('0x4e')]()[_0xd6f0('0x4f')]('id')[_0xd6f0('0x4f')](_0xd6f0('0x43'))[_0xd6f0('0x4f')]('color')[_0xd6f0('0x50')]('tools_tags');var _0x5505fd=squel[_0xd6f0('0x4e')]()['field']('u.id')[_0xd6f0('0x4f')](_0xd6f0('0x51'))[_0xd6f0('0x4f')]('ui.ChatInteractionId')[_0xd6f0('0x50')](_0xd6f0('0x52'),'ui')[_0xd6f0('0x53')]('users','u',_0xd6f0('0x54'));var _0x357193=squel['select']()[_0xd6f0('0x50')](_0xd6f0('0x55'),'i')['left_join'](_0xd6f0('0x56'),'c',_0xd6f0('0x57'))[_0xd6f0('0x53')](_0xd6f0('0x58'),'o',_0xd6f0('0x59'))['left_join'](_0xd6f0('0x5a'),'a',_0xd6f0('0x5b'))['left_join'](_0xd6f0('0x5c'),'me',_0xd6f0('0x5d'))[_0xd6f0('0x53')]('chat_interaction_has_tags','it',_0xd6f0('0x5e'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5c5aa4=squel[_0xd6f0('0x5f')]();var _0x2876a6=[];var _0x1a8984=squel[_0xd6f0('0x5f')]();var _0x530bcc;if(_0x909f20[_0xd6f0('0x44')]['search']){_0x530bcc=as[_0xd6f0('0x60')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x61')]);var _0x50d93a=_0x530bcc[_0xd6f0('0x62')];for(var _0x31b055=0x0;_0x31b055<_0x530bcc[_0xd6f0('0x63')][_0xd6f0('0x64')];_0x31b055++){var _0x5ce01c=_0x530bcc[_0xd6f0('0x63')][_0x31b055];var _0xf673bb='i';var _0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0x5ce01c[_0xd6f0('0x4f')]]);if(!_0x30ae43){switch(_0x5ce01c[_0xd6f0('0x4f')]){case _0xd6f0('0x65'):if(_0x5ce01c['value']==0x1){_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c[_0xd6f0('0x4f')]+_0xd6f0('0x67'));}else{_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c['field']+'`\x20>\x200');}break;case'Contact':if(_0x5ce01c['operator']===_0xd6f0('0x68')){if(_0x5ce01c[_0xd6f0('0x69')][_0xd6f0('0x6a')]('\x20')[_0xd6f0('0x64')]>0x1){_0x5c5aa4[_0x50d93a](_0xd6f0('0x6b'),qs[_0xd6f0('0x6c')](_0x5ce01c[_0xd6f0('0x69')]),null);}else{var _0x1b298a='%'+_0x5ce01c[_0xd6f0('0x69')]+'%';_0x5c5aa4[_0x50d93a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b298a,_0x1b298a,_0x1b298a);}}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),'ContactId']);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x6d');_0x1dc77c=as[_0xd6f0('0x6e')](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c['value'][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x72'):var _0x40cdae=_0x5ce01c['value'][_0xd6f0('0x6a')](',')[_0xd6f0('0x40')](function(_0x4f3dd9){return Number(_0x4f3dd9);});_0x40cdae[_0xd6f0('0x37')](function(_0x80f21c){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x80f21c+',%');});_0x2876a6=_[_0xd6f0('0x74')](_0x2876a6,_0x40cdae);break;case _0xd6f0('0x75'):if(_0x5ce01c[_0xd6f0('0x76')]===_0xd6f0('0x68')){_0x5c5aa4[_0x50d93a](_0xd6f0('0x77'),'%'+_0x5ce01c[_0xd6f0('0x69')]+'%',null);}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0xd6f0('0x3e')]);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x3e');_0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x30'):_0x1dc77c=as[_0xd6f0('0x6e')]('me',null,_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')]['start'],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);break;}}else{var _0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}}}else{var _0x1c7f08=_(_0x909f20[_0xd6f0('0x44')])[_0xd6f0('0x78')]()[_0xd6f0('0x40')](function(_0x27ad68){return _['some'](_0x1bcb36,['name',_0x27ad68])?_0x27ad68:undefined;})[_0xd6f0('0x79')]()[_0xd6f0('0x69')]();if(!_[_0xd6f0('0x7a')](_0x1c7f08)){_0x1c7f08[_0xd6f0('0x37')](function(_0x1da442){if(_0x1da442==='ChatWebsiteId'){_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),[]['concat'](_0x909f20[_0xd6f0('0x44')][_0x1da442]));}else if(_0x1da442==='createdAt'){var _0x458f66=JSON[_0xd6f0('0x7c')](_0x909f20[_0xd6f0('0x44')][_0x1da442])[_0xd6f0('0x7d')];var _0x391c2a=JSON['parse'](_0x909f20['query'][_0x1da442])[_0xd6f0('0x7e')];_0x357193[_0xd6f0('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x458f66,_0x391c2a);}else{if(_0x909f20[_0xd6f0('0x44')][_0x1da442]==='null'){_0x357193['where']('i.'+_0x1da442+_0xd6f0('0x7f'));}else{_0x357193['where']('i.'+_0x1da442+'\x20=\x20?',_0x909f20['query'][_0x1da442]);}}});}if(_0x909f20['query'][_0xd6f0('0x80')]){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x80')]==0x1){_0x357193[_0xd6f0('0x66')](_0xd6f0('0x81'));}else{_0x357193[_0xd6f0('0x66')](_0xd6f0('0x82'));}}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]){_0x2876a6=_['isArray'](_0x909f20[_0xd6f0('0x44')]['tag'])?_0x909f20['query'][_0xd6f0('0x83')]:new Array(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]);_0x2876a6['forEach'](function(_0x12e166){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x12e166+',%');});}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')]){var _0x41e738=_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')][_0xd6f0('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd6f0('0x86')](_0x41e738)){_0x5c5aa4['or'](_0xd6f0('0x87'),_0x41e738+'%');}else{_0x5c5aa4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6f0('0x6c')](_0x41e738))['or'](_0xd6f0('0x88'),_0x41e738+'%');}}}_0x357193[_0xd6f0('0x4d')](_0x5c5aa4);_0x357193[_0xd6f0('0x89')](_0xd6f0('0x8a'));var _0x96fc03={'type':db[_0xd6f0('0x8b')]['QueryTypes'][_0xd6f0('0x8c')],'raw':!![]};var _0x24c31d=_0x357193[_0xd6f0('0x8d')]();_0x24c31d['field']('i.id');_0x24c31d['field'](_0xd6f0('0x8e'),_0xd6f0('0x65'));if(_0x55e93b[_0xd6f0('0x4b')]){_0x55e93b[_0xd6f0('0x4b')][_0xd6f0('0x37')](function(_0x48d87d){var _0x4b5139=_0x48d87d[0x0]===_0xd6f0('0x8f')?_0x48d87d[0x0]:'i.'+_0x48d87d[0x0];_0x357193[_0xd6f0('0x4b')](_0x4b5139,_0x48d87d[0x1]===_0xd6f0('0x90')?![]:!![]);});}if(!_[_0xd6f0('0x7a')](_0x2876a6)){_0x357193['having'](_0x1a8984);_0x24c31d[_0xd6f0('0x4d')]('t.id\x20IN\x20?',_0x2876a6);}BPromise[_0xd6f0('0x91')]()['then'](function(){if(!_0x530bcc){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return;_0x24c31d['where'](_0xd6f0('0x93'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x93'));return;}if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]!==_0xd6f0('0x31'))return;return _0x909f20[_0xd6f0('0x94')][_0xd6f0('0x96')]({'attributes':['id'],'raw':!![]})[_0xd6f0('0x2a')](function(_0x2c277f){if(_[_0xd6f0('0x7a')](_0x2c277f)){_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x97'));_0x357193[_0xd6f0('0x4d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));}});})[_0xd6f0('0x2a')](function(){if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]===_0xd6f0('0x31')&&!_0x530bcc&&!_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return[];return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x24c31d['toString'](),_0x96fc03);})['then'](function(_0x2638c3){_0x39ca69[_0xd6f0('0x26')]=_0x2638c3[_0xd6f0('0x64')];if(_0x39ca69[_0xd6f0('0x26')]===0x0)return[];return db[_0xd6f0('0x98')]['query'](_0x29509e[_0xd6f0('0x99')](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x2d0d8a){_0x469e92=_[_0xd6f0('0x9a')](_0x2d0d8a,'id');_0x96fc03=_['merge'](_0x96fc03,{'model':db[_0xd6f0('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]){_0x55e93b[_0xd6f0('0x49')][_0xd6f0('0x37')](function(_0x229631){_0x357193['field']('i.'+_0x229631);});}else{_0x357193['field'](_0xd6f0('0x8e'),'unreadMessages');_0x357193[_0xd6f0('0x4f')]('a.key',_0xd6f0('0x9c'));_0x357193[_0xd6f0('0x4f')]('a.mandatoryDisposition',_0xd6f0('0x9d'));_0x357193['field'](_0xd6f0('0x9e'),_0xd6f0('0x8f'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0x9f'));_0x357193['field'](_0xd6f0('0xa0'),_0xd6f0('0xa1'));_0x357193[_0xd6f0('0x4f')]('c.lastName',_0xd6f0('0xa2'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa3'),'Contact.email');_0x357193['field'](_0xd6f0('0xa4'),_0xd6f0('0xa5'));_0x357193[_0xd6f0('0x4f')]('c.mobile',_0xd6f0('0xa6'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa7'),_0xd6f0('0xa8'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa9'),_0xd6f0('0xaa'));_0x357193['field'](_0xd6f0('0xab'),'Owner.internal');_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xac'),_0xd6f0('0x35'));}if(_0x55e93b['limit'])_0x357193[_0xd6f0('0x25')](_0x55e93b['limit']);if(_0x55e93b['offset'])_0x357193[_0xd6f0('0x23')](_0x55e93b[_0xd6f0('0x23')]);return db[_0xd6f0('0x98')]['query'](_0x357193[_0xd6f0('0x99')](),_0x96fc03);})['then'](function(_0x51e28a){if(_0x51e28a[_0xd6f0('0x64')]>0x0)_0x5505fd[_0xd6f0('0x4d')](_0xd6f0('0xad'),_[_0xd6f0('0x40')](_0x51e28a,'id'));return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x5505fd['toString'](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x5b8770){var _0x1c07b8=_['groupBy'](_0x5b8770,_0xd6f0('0xae'));var _0x1dce9c=[];_0x51e28a['forEach'](function(_0x212920){_0x1dce9c[_0xd6f0('0xaf')](updateChatInteraction(_0x212920,_0x469e92,_0x1c07b8));});return BPromise[_0xd6f0('0xb0')](_0x1dce9c);});});})[_0xd6f0('0x2a')](function(_0x1fff48){_0x39ca69[_0xd6f0('0xb1')]=_0x1fff48;return _0x39ca69;})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x3d42ca,_0x55e93b))[_0xd6f0('0x1f')](handleError(_0x3d42ca,null));};exports['show']=function(_0x25c9a8,_0x1a2390){var _0x529c3d={'raw':![],'where':{'id':_0x25c9a8['params']['id']}},_0x282736={};_0x282736[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0x9b')][_0xd6f0('0x41')]);_0x282736['query']=_['keys'](_0x25c9a8[_0xd6f0('0x44')]);_0x282736[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x282736[_0xd6f0('0x47')],_0x282736[_0xd6f0('0x44')]);_0x529c3d[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x282736['model'],qs[_0xd6f0('0x48')](_0x25c9a8[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x529c3d[_0xd6f0('0x49')]=_0x529c3d['attributes'][_0xd6f0('0x64')]?_0x529c3d['attributes']:_0x282736['model'];if(_0x25c9a8[_0xd6f0('0x44')]['includeAll']){_0x529c3d[_0xd6f0('0xb2')]=[{'all':!![]}];}_0x529c3d=_[_0xd6f0('0xb3')]({},_0x529c3d,_0x25c9a8[_0xd6f0('0xb4')]);return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')](_0x529c3d)[_0xd6f0('0x2a')](handleEntityNotFound(_0x1a2390,null))[_0xd6f0('0x2a')](respondWithResult(_0x1a2390,null))['catch'](handleError(_0x1a2390,null));};exports[_0xd6f0('0xb6')]=function(_0x11437d,_0x410185){return db['ChatInteraction'][_0xd6f0('0xb6')](_0x11437d[_0xd6f0('0x30')],{})[_0xd6f0('0x2a')](respondWithResult(_0x410185,0xc9))[_0xd6f0('0x1f')](handleError(_0x410185,null));};exports['update']=function(_0x308306,_0x4e5bb8){if(_0x308306[_0xd6f0('0x30')]['id']){delete _0x308306['body']['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x308306[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x4e5bb8,null))[_0xd6f0('0x2a')](saveUpdates(_0x308306[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x4e5bb8,null))['catch'](handleError(_0x4e5bb8,null));};exports['destroy']=function(_0x12d982,_0x574ca9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x12d982[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x574ca9,null))[_0xd6f0('0x2a')](removeEntity(_0x574ca9,null))[_0xd6f0('0x1f')](handleError(_0x574ca9,null));};exports[_0xd6f0('0xb8')]=function(_0x83b80a,_0xb726d0){return db[_0xd6f0('0x9b')][_0xd6f0('0xb8')]()['then'](respondWithResult(_0xb726d0,null))[_0xd6f0('0x1f')](handleError(_0xb726d0,null));};exports['createVidaooSession']=function(_0x28d7e9,_0x210946){var _0x4ed3f0=_0x28d7e9[_0xd6f0('0xb7')]['id'];var _0x5b85c3;var _0x3704e6;var _0xcc9d50;return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x4ed3f0}})[_0xd6f0('0x2a')](function(_0x3b4c53){_0x5b85c3=_0x3b4c53;return db[_0xd6f0('0xba')]['findOne']({'where':{'id':_0x3b4c53[_0xd6f0('0x92')]},'attributes':['id',_0xd6f0('0xbb'),'vidaooEscalation',_0xd6f0('0xbc'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x461f29){if(_0x461f29&&_0x461f29[_0xd6f0('0xbb')]&&_0x461f29['vidaooEscalation']){_0x3704e6=_0x461f29;var _0x18e364={'interaction':{'id':_0x4ed3f0},'agent':{'id':_0x28d7e9[_0xd6f0('0x94')]['id'],'name':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0x43')],'fullname':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbd')],'email':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]},'contact':_0x28d7e9['body'][_0xd6f0('0xbf')],'account':_0x28d7e9[_0xd6f0('0x30')]['account']};var _0x360ec0={'rejectUnauthorized':![],'method':'POST','url':_0xd6f0('0xc0'),'headers':{'X-APIKEY':_0x461f29[_0xd6f0('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]],'buttons':null,'topic':_0x3704e6['vidaooTopic'],'note':_[_0xd6f0('0xc1')](_0x3704e6['vidaooNote'])?null:getMustacheRender(_0x3704e6['vidaooNote'],_0x18e364),'metadata':null},'redirect':_0xd6f0('0xc2'),'json':!![]};try{if(!_[_0xd6f0('0xc1')](_0x3704e6[_0xd6f0('0xc3')])){var _0x5ede6b=getMustacheRender(_0x3704e6[_0xd6f0('0xc3')],_0x18e364);var _0x45283d=JSON[_0xd6f0('0x7c')](_0x5ede6b);_0x360ec0[_0xd6f0('0x30')][_0xd6f0('0xc4')]=_0x45283d;}}catch(_0x5cbab7){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x360ec0);}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc6'));}})[_0xd6f0('0x2a')](function(_0x46f385){_0xcc9d50=_0x46f385;if(_0xcc9d50['id']){var _0x30f693={'body':_0xcc9d50[_0xd6f0('0xc7')],'ChatWebsiteId':_0x3704e6['id'],'ChatInteractionId':_0x5b85c3['id'],'direction':_0xd6f0('0xc8'),'UserId':_0x28d7e9[_0xd6f0('0x94')]['id']};return db['ChatMessage']['create'](_0x30f693,{});}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc9'));}})[_0xd6f0('0x2a')](function(){return _0x5b85c3[_0xd6f0('0xca')]({'vidaooSessionId':_0xcc9d50['id']});})['then'](respondWithResult(_0x210946,null))[_0xd6f0('0x1f')](handleError(_0x210946,null));};exports['customUpdate']=function(_0x39f781,_0x2e2fc5){if(_0x39f781['body']['id']){delete _0x39f781[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x39f781['params']['id']},'include':[{'model':db['CmContact'],'as':_0xd6f0('0xcb')}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e2fc5,null))[_0xd6f0('0x2a')](saveUpdates(_0x39f781[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x2e2fc5,null))['catch'](handleError(_0x2e2fc5,null));};exports[_0xd6f0('0xcc')]=function(_0xf4ecc,_0x1e908d){if(_0xf4ecc[_0xd6f0('0x30')]['id']){delete _0xf4ecc[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0xf4ecc[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](function(_0x62d0ef){if(!_0x62d0ef){logger[_0xd6f0('0x1b')](_0xd6f0('0xcd'),_0xd6f0('0xcc'),0x194,_0xd6f0('0xce'));_0x1e908d['sendStatus'](0x194);}else{if(_0x62d0ef['UserId']){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Interaction\x20already\x20assigned');}}return _0x62d0ef;})[_0xd6f0('0x2a')](function(_0x2f7e8f){if(_0x2f7e8f){return _0x2f7e8f[_0xd6f0('0x29')]({'closed':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3d')],'disposition':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3f')]})['then'](function(_0x2879b5){return _0x2879b5;});}})[_0xd6f0('0x2a')](function(){return respondWithRpcPromise(_0xd6f0('0xcf'),_0xd6f0('0xcc'),_0xf4ecc['body'],client9004);})[_0xd6f0('0x2a')](respondWithResult(_0x1e908d,null))[_0xd6f0('0x1f')](handleError(_0x1e908d,null));};exports[_0xd6f0('0xd0')]=function(_0x516f59,_0x178d6b){_0x516f59['body'][_0xd6f0('0x43')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd2')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0xd3')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd4')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0x6f')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd5')];return db[_0xd6f0('0xd6')][_0xd6f0('0xb6')](_0x516f59[_0xd6f0('0x30')])[_0xd6f0('0x2a')](respondWithResult(_0x178d6b,0xc9))[_0xd6f0('0x1f')](handleError(_0x178d6b,null));};exports['attachmentDownload']=function(_0x198eec,_0x3d1d95){return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x198eec['params']['id']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null))['then'](function(_0x5a8d88){if(_0x5a8d88){if(_0x5a8d88[_0xd6f0('0x3d')]){return _0x3d1d95['status'](0x193)[_0xd6f0('0x22')]({'status':0x193,'message':_0xd6f0('0xd7')});}return db[_0xd6f0('0xd6')]['findOne']({'where':{'id':_0x198eec[_0xd6f0('0x44')]['attachId']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null));}})[_0xd6f0('0x2a')](function(_0xe4e7f9){if(_0xe4e7f9){var _0x51bf52=_0xe4e7f9[_0xd6f0('0xd8')]!==null;var _0x33f54e=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0xdb'));if(_0x51bf52){_0x33f54e=path[_0xd6f0('0xd9')](_0x33f54e,'offline-chat/');}var _0x17c5b6=path[_0xd6f0('0xd9')](_0x33f54e,_0xe4e7f9[_0xd6f0('0xd3')]);return _0x3d1d95[_0xd6f0('0xdc')](_0x17c5b6);}})['catch'](handleError(_0x3d1d95,null));};exports[_0xd6f0('0xdd')]=function(_0x55fb13,_0x2e5f31){var _0x59d38a=null;var _0x5db326=null;var _0x2df291=null;if(_0x55fb13[_0xd6f0('0x30')]['id']){delete _0x55fb13[_0xd6f0('0x30')]['id'];}if(_0x55fb13['body'][_0xd6f0('0xde')]){_0x2df291=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0xdf'),util[_0xd6f0('0xe0')](_0xd6f0('0xe1'),Date[_0xd6f0('0xe2')]()));_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xe3')]=_0x2df291;}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x55fb13[_0xd6f0('0xb7')]['id']},'include':[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e5f31,null))[_0xd6f0('0x2a')](saveUpdates(_0x55fb13[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](function(_0x5ae946){if(_0x5ae946){_0x59d38a=_0x5ae946;return db[_0xd6f0('0xba')]['find']({'where':{'id':_0x59d38a[_0xd6f0('0x92')]}});}})[_0xd6f0('0x2a')](function(_0x3f32e6){if(_0x3f32e6){_0x5db326=_0x3f32e6;return db[_0xd6f0('0xe6')][_0xd6f0('0xb5')]({'where':{'id':_0x59d38a['ContactId']}});}})[_0xd6f0('0x2a')](function(_0x174f35){if(_0x174f35){if(_0x2df291){var _0x4c3b1d=null;for(var _0x88b850=0x1;_0x88b850<_0x59d38a[_0xd6f0('0xe5')][_0xd6f0('0x64')];++_0x88b850){_0x4c3b1d=_0x59d38a[_0xd6f0('0xe5')][_0x88b850];var _0x55bb74=_0x4c3b1d['UserId']?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');var _0x3eb403=_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xea')]||util['format'](_0xd6f0('0xe7'),_0xd6f0('0xeb'),_0x4c3b1d[_0xd6f0('0x6d')]);switch(_0x5db326[_0xd6f0('0xec')]){case _0xd6f0('0xed'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');break;case'agent_alias':_0x55bb74=_0x4c3b1d['UserId']?_0x4c3b1d[_0xd6f0('0x75')]['alias']||_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9');break;case _0xd6f0('0xee'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:'System';break;default:_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326['agentAlias'],_0x4c3b1d['UserId']):_0xd6f0('0xe9');}var _0x156d8c=util[_0xd6f0('0xe0')](_0xd6f0('0xef'),moment(_0x4c3b1d['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0xf0')),_0x4c3b1d['direction']==='in'?_0x3eb403:_0x55bb74,_0x4c3b1d[_0xd6f0('0x30')]);if(!_0x4c3b1d[_0xd6f0('0xf1')]){fs[_0xd6f0('0xf2')](_0x2df291,_0x156d8c);}}return db[_0xd6f0('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd6f0('0xf4')],'as':_0xd6f0('0xf5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xd6f0('0x2a')](function(_0x24800d){if(!_0x24800d||!_0x24800d[_0xd6f0('0xf5')]||!_0x55fb13[_0xd6f0('0x30')])return _0x59d38a;var _0x1acefc=_0x24800d[_0xd6f0('0xf6')]();return respondWithRpcPromise(_0xd6f0('0xf7'),_0xd6f0('0xf8'),{'account':_0x1acefc,'message':{'from':util[_0xd6f0('0xe0')](_0xd6f0('0xf9'),_0x24800d['name'],_0x24800d[_0xd6f0('0xbe')]||_0x24800d[_0xd6f0('0xf5')][_0xd6f0('0x94')]),'to':_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')],'subject':_0xd6f0('0xfa'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')]),'attachments':[{'path':_0x2df291}]}})[_0xd6f0('0x2a')](function(){return _0x59d38a;})[_0xd6f0('0x1f')](function(_0x53d6fd){logger[_0xd6f0('0x1b')](_0x53d6fd);});})[_0xd6f0('0x2a')](respondWithStatusCode(_0x2e5f31,0xc8))[_0xd6f0('0x1f')](handleError(_0x2e5f31,null));};exports[_0xd6f0('0xfb')]=function(_0x3ce855,_0x56fbcb){return db[_0xd6f0('0xe4')][_0xd6f0('0xb5')]({'where':{'id':_0x3ce855['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x56fbcb,null))[_0xd6f0('0x2a')](function(_0x4ae09a){if(_0x4ae09a){return _0x4ae09a[_0xd6f0('0xfb')](_0x3ce855[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x3ce855[_0xd6f0('0x30')],[_0xd6f0('0xfc'),'id'])||{});}})[_0xd6f0('0x2a')](respondWithResult(_0x56fbcb,null))[_0xd6f0('0x1f')](handleError(_0x56fbcb,null));};exports[_0xd6f0('0xfe')]=function(_0x430b18,_0x22ec51){var _0x578789={'raw':![],'where':{}};var _0xdd080f={};var _0x4a1165={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x430b18[_0xd6f0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x22ec51,null))[_0xd6f0('0x2a')](function(_0x2e64be){if(_0x2e64be){_0xdd080f[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0xe4')]['rawAttributes']);_0xdd080f['query']=_[_0xd6f0('0x78')](_0x430b18[_0xd6f0('0x44')]);_0xdd080f[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0xdd080f[_0xd6f0('0x47')],_0xdd080f[_0xd6f0('0x44')]);_0x578789[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0xdd080f['model'],qs['fields'](_0x430b18['query'][_0xd6f0('0x48')]));_0x578789['attributes']=_0x578789[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x578789[_0xd6f0('0x49')]:_0xdd080f[_0xd6f0('0x47')];if(!_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4a')](_0xd6f0('0xff'))){_0x578789[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x430b18[_0xd6f0('0x44')]['limit']);_0x578789[_0xd6f0('0x23')]=qs['offset'](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x578789['order']=qs[_0xd6f0('0x4c')](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x578789[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x430b18['query'],_0xdd080f['filters']));_0x578789['where'][_0xd6f0('0xae')]=_0x2e64be['id'];if(_0x430b18['query'][_0xd6f0('0x84')]){_0x578789[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x578789[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x578789[_0xd6f0('0x49')],function(_0x55f274){var _0x1d461f={};_0x1d461f[_0x55f274]={'$like':'%'+_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x1d461f;})});}if(_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x7d')]){var _0x32af02=_0x430b18['query']['$gte'][_0xd6f0('0x6a')](',');var _0x69694c={};_0x69694c[_0x32af02[0x0]]={'$gte':moment(_0x32af02[0x1])['format'](_0xd6f0('0x100'))};_0x578789[_0xd6f0('0x4d')]=_['merge'](_0x578789[_0xd6f0('0x4d')],_0x69694c);}_0x578789=_[_0xd6f0('0xb3')]({},_0x578789,_0x430b18[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x578789[_0xd6f0('0x4d')]})[_0xd6f0('0x2a')](function(_0x2d6902){_0x4a1165[_0xd6f0('0x26')]=_0x2d6902;if(_0x430b18['query'][_0xd6f0('0x101')]){_0x578789[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x578789);})[_0xd6f0('0x2a')](function(_0x2ace80){_0x4a1165[_0xd6f0('0xb1')]=_0x2ace80;return _0x4a1165;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x22ec51,_0x578789))[_0xd6f0('0x1f')](handleError(_0x22ec51,null));};exports[_0xd6f0('0x103')]=function(_0x46dedb,_0x5887ab){var _0x240207={'where':{}},_0x3a32b3={},_0x55c3da={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')]['findOne']({'where':{'id':_0x46dedb[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x5887ab,null))['then'](function(_0x2c9e1a){if(_0x2c9e1a){_0x3a32b3['model']=_[_0xd6f0('0x78')](db['ChatMessage'][_0xd6f0('0x41')]);_0x3a32b3[_0xd6f0('0x44')]=_['keys'](_0x46dedb['query']);_0x3a32b3[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],_0x3a32b3['query']);_0x240207[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],qs[_0xd6f0('0x48')](_0x46dedb[_0xd6f0('0x44')]['fields']));_0x240207[_0xd6f0('0x49')]=_0x240207[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x240207[_0xd6f0('0x49')]:_0x3a32b3[_0xd6f0('0x47')];if(!_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4a')]('nolimit')){_0x240207[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x46dedb['query'][_0xd6f0('0x25')]);_0x240207[_0xd6f0('0x23')]=qs['offset'](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x240207[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x240207[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x46dedb[_0xd6f0('0x44')],_0x3a32b3[_0xd6f0('0x45')]));_0x240207['where'][_0xd6f0('0xae')]=_0x2c9e1a['id'];if(_0x46dedb['query'][_0xd6f0('0x84')]){_0x240207[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x240207[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x240207[_0xd6f0('0x49')],function(_0x44cead){var _0x5e1062={};_0x5e1062[_0x44cead]={'$like':'%'+_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x5e1062;})});}_0x240207[_0xd6f0('0x4d')][_0xd6f0('0xf1')]=![];if(_0x46dedb[_0xd6f0('0x44')]['id']){_0x240207['where']['id']={'$gt':_0x46dedb[_0xd6f0('0x44')]['id']};}_0x240207=_['merge']({},_0x240207,_0x46dedb[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x240207[_0xd6f0('0x4d')]})['then'](function(_0x27887e){_0x55c3da['count']=_0x27887e;_0x240207['include']=[];if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x104')]){_0x240207[_0xd6f0('0xb2')][_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':_0xd6f0('0x75'),'attributes':['id',_0xd6f0('0xbd'),_0xd6f0('0x105')]});}if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x101')]){_0x240207[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x240207);})[_0xd6f0('0x2a')](function(_0x2ea0c4){_0x55c3da['rows']=_0x2ea0c4;return _0x55c3da;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x5887ab,_0x240207))[_0xd6f0('0x1f')](handleError(_0x5887ab,null));};exports['addTags']=function(_0x2e9eca,_0x1814a9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x2e9eca[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x1814a9,null))[_0xd6f0('0x2a')](function(_0x54f0f0){if(_0x54f0f0){return _0x54f0f0[_0xd6f0('0x106')](_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x2e9eca[_0xd6f0('0x30')],['ids','id'])||{})[_0xd6f0('0x107')](function(){return db[_0xd6f0('0x72')][_0xd6f0('0x102')]({'attributes':['id','name',_0xd6f0('0x108')],'where':{'id':_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')]}});})[_0xd6f0('0x2a')](function(_0x486a3e){socket[_0xd6f0('0x109')](_0xd6f0('0x10a'),{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]});return{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]};});}})[_0xd6f0('0x2a')](respondWithResult(_0x1814a9,null))[_0xd6f0('0x1f')](handleError(_0x1814a9,null));};exports[_0xd6f0('0x10b')]=function(_0x1033e1,_0x3d1c1e){return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x1033e1['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1c1e,null))[_0xd6f0('0x2a')](function(_0x547615){if(_0x547615){return _0x547615[_0xd6f0('0x10b')](_0x1033e1[_0xd6f0('0x44')][_0xd6f0('0xfc')]);}})[_0xd6f0('0x2a')](respondWithStatusCode(_0x3d1c1e,null))[_0xd6f0('0x1f')](handleError(_0x3d1c1e,null));};exports[_0xd6f0('0xdc')]=function(_0x920605,_0x280343){var _0xdeebce=moment()[_0xd6f0('0x10c')]()[_0xd6f0('0x99')]();var _0x2ac49c=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10e'));var _0x5327b3=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10f'));var _0x245c62=path[_0xd6f0('0xd9')](_0x2ac49c,_0xdeebce);var _0x1a4ad0=util['format'](_0xd6f0('0x110'),_0x920605[_0xd6f0('0xb7')]['id'],_0xdeebce);var _0x4e7e89=path[_0xd6f0('0xd9')](_0x2ac49c,_0x1a4ad0);var _0x1151d0=[];_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':'User','attributes':['id',_0xd6f0('0xbd')],'raw':!![]});_0x1151d0[_0xd6f0('0xaf')]({'model':db['CmContact'],'as':_0xd6f0('0xcb'),'attributes':['id',_0xd6f0('0x111'),'lastName'],'raw':!![]});if(_0x920605[_0xd6f0('0x44')][_0xd6f0('0x10f')]){_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0xd6')],'as':_0xd6f0('0xd6'),'raw':!![]});}var _0x46ee50=[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'attributes':['id',_0xd6f0('0x30'),_0xd6f0('0x112'),_0xd6f0('0x113'),'secret',_0xd6f0('0x80')],'include':_0x1151d0}];_0x46ee50['push']({'model':db[_0xd6f0('0xba')],'as':_0xd6f0('0x114'),'attributes':['id',_0xd6f0('0x43')]});_0x46ee50[_0xd6f0('0xaf')]({'model':db['User'],'as':'Owner','attributes':['id',_0xd6f0('0xbd')]});return db['ChatInteraction'][_0xd6f0('0xb5')]({'where':{'id':_0x920605[_0xd6f0('0xb7')]['id']},'include':_0x46ee50})[_0xd6f0('0x2a')](handleEntityNotFound(_0x280343,null))['then'](function(_0x519500){if(_0x519500){var _0x1fce58=_0x519500['get']({'plain':!![]});fs[_0xd6f0('0x115')](_0x245c62);var _0x3e89c2={'channel':_0xd6f0('0x116'),'account':_0x1fce58[_0xd6f0('0x114')][_0xd6f0('0x43')],'agent':_0x1fce58[_0xd6f0('0x117')]?_0x1fce58['Owner'][_0xd6f0('0xbd')]:_0xd6f0('0x118'),'createdAt':moment(_0x1fce58['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'closedAt':_0x1fce58[_0xd6f0('0x3d')]?moment(_0x1fce58[_0xd6f0('0x119')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd6f0('0x99')]():'','disposition':_0x1fce58['disposition'],'chatInfo':{'browser':_0x1fce58[_0xd6f0('0x11a')],'os':_0x1fce58[_0xd6f0('0x11b')],'referer':_0x1fce58[_0xd6f0('0x11c')],'customerIp':_0x1fce58['customerIp'],'customerPort':_0x1fce58['customerPort']?_0x1fce58[_0xd6f0('0x11d')]:_0xd6f0('0x118')},'messages':_(_0x1fce58[_0xd6f0('0xe5')])[_0xd6f0('0x11e')]()['filter']({'secret':![]})[_0xd6f0('0x40')](function(_0x37107f){if(_0x37107f['Attachment']){var _0x318972=path[_0xd6f0('0xd9')](_0x5327b3,_0x37107f[_0xd6f0('0xd6')][_0xd6f0('0xd3')]);if(fs[_0xd6f0('0x11f')](_0x318972)){fs['createReadStream'](_0x318972)['pipe'](fs[_0xd6f0('0x120')](path[_0xd6f0('0xd9')](_0x245c62,_0x37107f['Attachment'][_0xd6f0('0xd3')])));}}return{'date':moment(_0x37107f[_0xd6f0('0x112')])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'sender':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?_0x37107f[_0xd6f0('0x75')]?_0x37107f[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9'):_0x37107f['Contact']['firstName']+(_0x37107f[_0xd6f0('0xcb')]['lastName']?'\x20'+_0x37107f[_0xd6f0('0xcb')][_0xd6f0('0x121')]:''),'body':_0x37107f[_0xd6f0('0xd6')]?_0x37107f['Attachment']['basename']:_0x37107f['body'],'direction':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?'A':'C','secret':_0x37107f['secret'],'read':_0x37107f['read'],'attachment':_0x37107f[_0xd6f0('0xd6')]};})[_0xd6f0('0x69')]()};return ejs[_0xd6f0('0x122')](path['join'](config['root'],_0xd6f0('0x10d'),_0xd6f0('0x123'),_0xd6f0('0x124')),{'interaction':_0x3e89c2})['then'](function(_0xa4ae76){var _0x1478ce=path['join'](_0x245c62,_0xd6f0('0x125')+_0x1fce58['id']+'-'+_0xdeebce+_0xd6f0('0x126'));var _0x264d69={'path':_0x1478ce,'channel':_0xd6f0('0x116'),'interactionId':_0x1fce58['id']};return pdf[_0xd6f0('0x127')](_0xa4ae76,_0x264d69);})[_0xd6f0('0x2a')](function(){return new Promise(function(_0x300b64,_0x16ef7b){zipdir(_0x245c62,{'saveTo':_0x4e7e89},function(_0x526978,_0x552cd5){if(_0x526978)return _0x16ef7b(_0x526978);return _0x300b64(_0x552cd5);});})[_0xd6f0('0x2a')](function(){return new BPromise(function(_0x5e505d,_0x5d0e6e){rimraf(_0x245c62,function(_0x44e0ca){if(_0x44e0ca)_0x5d0e6e(_0x44e0ca);return _0x5e505d();});});})[_0xd6f0('0x2a')](function(){return _0x280343[_0xd6f0('0xdc')](_0x4e7e89,_0x1a4ad0,function(_0x4fc550){if(_0x4fc550){logger['error']('err',_0x4fc550);}else{fs[_0xd6f0('0x128')](_0x4e7e89);}});});});}else{return _0x280343[_0xd6f0('0x20')](0xc8);}})[_0xd6f0('0x1f')](handleError(_0x280343,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 014b475..fcd9a27 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 _0x391d=['update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0xecbbdf,_0x3c220f){var _0x3dc33b=function(_0x2e86a5){while(--_0x2e86a5){_0xecbbdf['push'](_0xecbbdf['shift']());}};_0x3dc33b(++_0x3c220f);}(_0x391d,0xbb));var _0xd391=function(_0x6b8e6,_0x5b5b8d){_0x6b8e6=_0x6b8e6-0x0;var _0x11e8d9=_0x391d[_0x6b8e6];return _0x11e8d9;};'use strict';var EventEmitter=require(_0xd391('0x0'));var ChatInteraction=require(_0xd391('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0xd391('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd391('0x3')](0x0);var events={'afterCreate':_0xd391('0x4'),'afterUpdate':_0xd391('0x5'),'afterDestroy':_0xd391('0x6')};function emitEvent(_0x23269c){return function(_0x187d06,_0xa73638,_0x5641c8){_0x187d06[_0xd391('0x7')]({'attributes':['id'],'raw':!![]})[_0xd391('0x8')](function(_0xfbf275){_0x187d06[_0xd391('0x9')]('Users',_0xfbf275['map'](function(_0x4276c3){return{'id':_0x4276c3['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x187d06['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd391('0x8')](function(_0x1104a2){_0x187d06[_0xd391('0x9')](_0xd391('0xa'),_0x1104a2[_0xd391('0xb')]);ChatInteractionEvents[_0xd391('0xc')](_0x23269c+':'+_0x187d06['id'],_0x187d06);ChatInteractionEvents[_0xd391('0xc')](_0x23269c,_0x187d06);_0x5641c8(null);})[_0xd391('0xd')](_0x5641c8(null));};}for(var e in events){if(events[_0xd391('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xd391('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x354b=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','setDataValue'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x354b,0x148));var _0xb354=function(_0x21ea1f,_0x3548a9){_0x21ea1f=_0x21ea1f-0x0;var _0x1801e2=_0x354b[_0x21ea1f];return _0x1801e2;};'use strict';var EventEmitter=require(_0xb354('0x0'));var ChatInteraction=require(_0xb354('0x1'))['db'][_0xb354('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xb354('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb354('0x4')](0x0);var events={'afterCreate':_0xb354('0x5'),'afterUpdate':'update','afterDestroy':_0xb354('0x6')};function emitEvent(_0x34e743){return function(_0x132ae8,_0x31e9b9,_0x597c96){_0x132ae8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5f3e7f){_0x132ae8[_0xb354('0x7')](_0xb354('0x8'),_0x5f3e7f['map'](function(_0x5c6cc9){return{'id':_0x5c6cc9['id']};}));return ChatMessage[_0xb354('0x9')]({'where':{'ChatInteractionId':_0x132ae8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41c5df){_0x132ae8['setDataValue'](_0xb354('0xa'),_0x41c5df['length']);ChatInteractionEvents['emit'](_0x34e743+':'+_0x132ae8['id'],_0x132ae8);ChatInteractionEvents[_0xb354('0xb')](_0x34e743,_0x132ae8);_0x597c96(null);})[_0xb354('0xc')](_0x597c96(null));};}for(var e in events){if(events[_0xb354('0xd')](e)){var event=events[e];ChatInteraction[_0xb354('0xe')](e,emitEvent(event));}}module[_0xb354('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 921d74b..af376f2 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 _0x269c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x572ab2,_0x296d2e){var _0x94cf99=function(_0x41e76b){while(--_0x41e76b){_0x572ab2['push'](_0x572ab2['shift']());}};_0x94cf99(++_0x296d2e);}(_0x269c,0x1ec));var _0xc269=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x269c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc269('0x0'));var util=require(_0xc269('0x1'));var logger=require(_0xc269('0x2'))(_0xc269('0x3'));var moment=require(_0xc269('0x4'));var BPromise=require(_0xc269('0x5'));var rp=require(_0xc269('0x6'));var fs=require('fs');var path=require(_0xc269('0x7'));var rimraf=require(_0xc269('0x8'));var config=require('../../config/environment');var attributes=require(_0xc269('0x9'));module[_0xc269('0xa')]=function(_0x12c1cd,_0x3a7537){return _0x12c1cd[_0xc269('0xb')]('ChatInteraction',attributes,{'tableName':_0xc269('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x450da6,_0x44f4eb,_0x2d97eb){if(_0x450da6[_0xc269('0xd')]('closed')){_0x450da6[_0xc269('0xe')]=moment()[_0xc269('0xf')](_0xc269('0x10'));}_0x2d97eb(null,_0x450da6);}},'charset':_0xc269('0x11'),'collate':_0xc269('0x12')});}; \ No newline at end of file +var _0x9084=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x9084,0x1ed));var _0x4908=function(_0x5ae619,_0x365b3d){_0x5ae619=_0x5ae619-0x0;var _0x40c0c9=_0x9084[_0x5ae619];return _0x40c0c9;};'use strict';var _=require(_0x4908('0x0'));var util=require(_0x4908('0x1'));var logger=require(_0x4908('0x2'))(_0x4908('0x3'));var moment=require(_0x4908('0x4'));var BPromise=require(_0x4908('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4908('0x6'));var rimraf=require(_0x4908('0x7'));var config=require(_0x4908('0x8'));var attributes=require(_0x4908('0x9'));module[_0x4908('0xa')]=function(_0x1789aa,_0x4807ee){return _0x1789aa[_0x4908('0xb')](_0x4908('0xc'),attributes,{'tableName':_0x4908('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bb508,_0x59819f,_0x2809db){if(_0x3bb508[_0x4908('0xe')](_0x4908('0xf'))){_0x3bb508[_0x4908('0x10')]=moment()[_0x4908('0x11')](_0x4908('0x12'));}_0x2809db(null,_0x3bb508);}},'charset':'utf8mb4','collate':_0x4908('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d30147b..17796dc 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 _0x029f=['error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','find','then','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0xa329ca,_0x3613a6){var _0x24eb20=function(_0x22cf86){while(--_0x22cf86){_0xa329ca['push'](_0xa329ca['shift']());}};_0x24eb20(++_0x3613a6);}(_0x029f,0x7e));var _0xf029=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x029f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf029('0x0'));var util=require('util');var moment=require(_0xf029('0x1'));var BPromise=require(_0xf029('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf029('0x3'));var db=require(_0xf029('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf029('0x5'));var config=require(_0xf029('0x6'));var jayson=require(_0xf029('0x7'));var client=jayson[_0xf029('0x8')][_0xf029('0x9')]({'port':0x232a});config[_0xf029('0xa')]=_[_0xf029('0xb')](config[_0xf029('0xa')],{'host':_0xf029('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf029('0xd'))[_0xf029('0xe')](socket);function respondWithRpcPromise(_0x1d722e,_0x5ad2cb,_0x2fb120){return new BPromise(function(_0x125677,_0x1a28f4){return client[_0xf029('0xf')](_0x1d722e,_0x2fb120)['then'](function(_0x1bfd19){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ad2cb,_0xf029('0x10'));logger['debug'](_0xf029('0x11'),_0x5ad2cb,'request\x20sent',JSON['stringify'](_0x1bfd19));if(_0x1bfd19[_0xf029('0x12')]){if(_0x1bfd19[_0xf029('0x12')][_0xf029('0x13')]===0x1f4){logger[_0xf029('0x12')](_0xf029('0x14'),_0x5ad2cb,_0x1bfd19[_0xf029('0x12')][_0xf029('0x15')]);return _0x1a28f4(_0x1bfd19['error'][_0xf029('0x15')]);}logger[_0xf029('0x12')](_0xf029('0x14'),_0x5ad2cb,_0x1bfd19[_0xf029('0x12')][_0xf029('0x15')]);return _0x125677(_0x1bfd19[_0xf029('0x12')]['message']);}else{logger[_0xf029('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x5ad2cb,_0xf029('0x10'));_0x125677(_0x1bfd19['result']['message']);}})[_0xf029('0x17')](function(_0x4a5d23){logger[_0xf029('0x12')](_0xf029('0x14'),_0x5ad2cb,_0x4a5d23);_0x1a28f4(_0x4a5d23);});});}exports[_0xf029('0x18')]=function(_0x5c109a){var _0x345943=this;return new Promise(function(_0x347707,_0x1e64f5){return db[_0xf029('0x19')]['update'](_0x5c109a[_0xf029('0x1a')],{'raw':_0x5c109a[_0xf029('0x1b')]?_0x5c109a[_0xf029('0x1b')][_0xf029('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c109a[_0xf029('0x1b')]?_0x5c109a[_0xf029('0x1b')][_0xf029('0x1d')]||null:null,'attributes':_0x5c109a[_0xf029('0x1b')]?_0x5c109a['options'][_0xf029('0x1e')]||null:null,'limit':_0x5c109a[_0xf029('0x1b')]?_0x5c109a[_0xf029('0x1b')]['limit']||null:null})['then'](function(_0x372872){logger[_0xf029('0x16')]('UpdateChatInteraction',_0x5c109a);logger['debug'](_0xf029('0x18'),_0x5c109a,JSON['stringify'](_0x372872));_0x347707(_0x372872);})[_0xf029('0x17')](function(_0x10e9c8){logger[_0xf029('0x12')](_0xf029('0x18'),_0x10e9c8['message'],_0x5c109a);_0x1e64f5(_0x345943[_0xf029('0x12')](0x1f4,_0x10e9c8[_0xf029('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x42538b){return new Promise(function(_0x3f0c45,_0x506fa4){return db[_0xf029('0x19')][_0xf029('0x1f')]({'where':_0x42538b[_0xf029('0x1b')]?_0x42538b[_0xf029('0x1b')][_0xf029('0x1d')]||null:null})[_0xf029('0x20')](function(_0x28dfc1){if(_0x28dfc1){return _0x28dfc1['addTags'](_0x42538b[_0xf029('0x1a')][_0xf029('0x21')],_[_0xf029('0x22')](_0x42538b['body'],[_0xf029('0x21'),'id'])||{});}})['spread'](function(_0x3b614a){logger[_0xf029('0x16')]('AddTags',_0x42538b);logger['debug'](_0xf029('0x23'),_0x42538b,JSON['stringify'](_0x3b614a));_0x3f0c45(_0x3b614a);})['catch'](function(_0x10d257){logger[_0xf029('0x12')](_0xf029('0x23'),_0x10d257[_0xf029('0x15')],_0x42538b);_0x506fa4(_this[_0xf029('0x12')](0x1f4,_0x10d257[_0xf029('0x15')]));});});}; \ No newline at end of file +var _0x111e=['then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ChatInteraction','update','body','options','raw','where','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x111e,0x1d1));var _0xe111=function(_0x31fdd7,_0x10f202){_0x31fdd7=_0x31fdd7-0x0;var _0x268731=_0x111e[_0x31fdd7];return _0x268731;};'use strict';var _=require(_0xe111('0x0'));var util=require('util');var moment=require(_0xe111('0x1'));var BPromise=require(_0xe111('0x2'));var rs=require(_0xe111('0x3'));var fs=require('fs');var Redis=require(_0xe111('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe111('0x5'));var logger=require(_0xe111('0x6'))(_0xe111('0x7'));var config=require(_0xe111('0x8'));var jayson=require(_0xe111('0x9'));var client=jayson[_0xe111('0xa')][_0xe111('0xb')]({'port':0x232a});config[_0xe111('0xc')]=_[_0xe111('0xd')](config[_0xe111('0xc')],{'host':_0xe111('0xe'),'port':0x18eb});var socket=require(_0xe111('0xf'))(new Redis(config[_0xe111('0xc')]));require(_0xe111('0x10'))[_0xe111('0x11')](socket);function respondWithRpcPromise(_0x11089b,_0x56fdd2,_0x5a9821){return new BPromise(function(_0x327d84,_0x120b18){return client[_0xe111('0x12')](_0x11089b,_0x5a9821)[_0xe111('0x13')](function(_0x530ee2){logger['info'](_0xe111('0x14'),_0x56fdd2,_0xe111('0x15'));logger[_0xe111('0x16')](_0xe111('0x17'),_0x56fdd2,_0xe111('0x15'),JSON['stringify'](_0x530ee2));if(_0x530ee2[_0xe111('0x18')]){if(_0x530ee2[_0xe111('0x18')]['code']===0x1f4){logger[_0xe111('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x56fdd2,_0x530ee2[_0xe111('0x18')][_0xe111('0x19')]);return _0x120b18(_0x530ee2[_0xe111('0x18')]['message']);}logger[_0xe111('0x18')](_0xe111('0x14'),_0x56fdd2,_0x530ee2['error']['message']);return _0x327d84(_0x530ee2[_0xe111('0x18')]['message']);}else{logger[_0xe111('0x1a')](_0xe111('0x14'),_0x56fdd2,_0xe111('0x15'));_0x327d84(_0x530ee2[_0xe111('0x1b')][_0xe111('0x19')]);}})[_0xe111('0x1c')](function(_0x2fd7b9){logger[_0xe111('0x18')](_0xe111('0x14'),_0x56fdd2,_0x2fd7b9);_0x120b18(_0x2fd7b9);});});}exports['UpdateChatInteraction']=function(_0x353363){var _0x29fbe5=this;return new Promise(function(_0xbb882f,_0x582365){return db[_0xe111('0x1d')][_0xe111('0x1e')](_0x353363[_0xe111('0x1f')],{'raw':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')][_0xe111('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')][_0xe111('0x22')]||null:null,'attributes':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')]['attributes']||null:null,'limit':_0x353363['options']?_0x353363[_0xe111('0x20')]['limit']||null:null})[_0xe111('0x13')](function(_0x2e6b16){logger[_0xe111('0x1a')](_0xe111('0x23'),_0x353363);logger[_0xe111('0x16')]('UpdateChatInteraction',_0x353363,JSON[_0xe111('0x24')](_0x2e6b16));_0xbb882f(_0x2e6b16);})[_0xe111('0x1c')](function(_0x1a4b72){logger[_0xe111('0x18')](_0xe111('0x23'),_0x1a4b72['message'],_0x353363);_0x582365(_0x29fbe5[_0xe111('0x18')](0x1f4,_0x1a4b72[_0xe111('0x19')]));});});};exports[_0xe111('0x25')]=function(_0x54002f){return new Promise(function(_0x2b4de5,_0x40c6dc){return db[_0xe111('0x1d')][_0xe111('0x26')]({'where':_0x54002f['options']?_0x54002f[_0xe111('0x20')][_0xe111('0x22')]||null:null})[_0xe111('0x13')](function(_0x524320){if(_0x524320){return _0x524320[_0xe111('0x27')](_0x54002f[_0xe111('0x1f')][_0xe111('0x28')],_[_0xe111('0x29')](_0x54002f['body'],['ids','id'])||{});}})[_0xe111('0x2a')](function(_0x40f34d){logger[_0xe111('0x1a')](_0xe111('0x2b'),_0x54002f);logger[_0xe111('0x16')](_0xe111('0x2b'),_0x54002f,JSON['stringify'](_0x40f34d));_0x2b4de5(_0x40f34d);})[_0xe111('0x1c')](function(_0x684a67){logger[_0xe111('0x18')]('AddTags',_0x684a67[_0xe111('0x19')],_0x54002f);_0x40c6dc(_this[_0xe111('0x18')](0x1f4,_0x684a67[_0xe111('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a164ec9..c8cb0fd 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 _0x5a86=['update','emit','removeListener','register','chatInteraction:'];(function(_0x410cad,_0x3b12c5){var _0x3a0afd=function(_0x137c68){while(--_0x137c68){_0x410cad['push'](_0x410cad['shift']());}};_0x3a0afd(++_0x3b12c5);}(_0x5a86,0x1a4));var _0x65a8=function(_0xad3b93,_0x4c929b){_0xad3b93=_0xad3b93-0x0;var _0x5a2416=_0x5a86[_0xad3b93];return _0x5a2416;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x65a8('0x0')];function createListener(_0x41847e,_0x2eebbc){return function(_0x1b2b3f){_0x2eebbc[_0x65a8('0x1')](_0x41847e,_0x1b2b3f);};}function removeListener(_0x300d7d,_0x366db0){return function(){ChatInteractionEvents[_0x65a8('0x2')](_0x300d7d,_0x366db0);};}exports[_0x65a8('0x3')]=function(_0x4731d2){for(var _0x4da991=0x0,_0x32ee2d=events['length'];_0x4da991<_0x32ee2d;_0x4da991++){var _0x3c25c2=events[_0x4da991];var _0xd6209b=createListener(_0x65a8('0x4')+_0x3c25c2,_0x4731d2);ChatInteractionEvents['on'](_0x3c25c2,_0xd6209b);}}; \ No newline at end of file +var _0xd734=['./chatInteraction.events','save','remove','update','removeListener','chatInteraction:'];(function(_0x3d8b15,_0x3f4a7e){var _0x2f9090=function(_0x51809c){while(--_0x51809c){_0x3d8b15['push'](_0x3d8b15['shift']());}};_0x2f9090(++_0x3f4a7e);}(_0xd734,0x18c));var _0x4d73=function(_0xc237ff,_0x4673ff){_0xc237ff=_0xc237ff-0x0;var _0x4b7b9b=_0xd734[_0xc237ff];return _0x4b7b9b;};'use strict';var ChatInteractionEvents=require(_0x4d73('0x0'));var events=[_0x4d73('0x1'),_0x4d73('0x2'),_0x4d73('0x3')];function createListener(_0x36961b,_0x4fddaa){return function(_0x3866f3){_0x4fddaa['emit'](_0x36961b,_0x3866f3);};}function removeListener(_0x34296c,_0x560518){return function(){ChatInteractionEvents[_0x4d73('0x4')](_0x34296c,_0x560518);};}exports['register']=function(_0x361d70){for(var _0x209d65=0x0,_0x2f05c7=events['length'];_0x209d65<_0x2f05c7;_0x209d65++){var _0x27a0c4=events[_0x209d65];var _0x596663=createListener(_0x4d73('0x5')+_0x27a0c4,_0x361d70);ChatInteractionEvents['on'](_0x27a0c4,_0x596663);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 19e6f86..0df1b94 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 _0x908a=['describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','download','create','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','/:id','chatinteraction:destroy','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index'];(function(_0x305bca,_0xa66795){var _0x2e06f0=function(_0x37b672){while(--_0x37b672){_0x305bca['push'](_0x305bca['shift']());}};_0x2e06f0(++_0xa66795);}(_0x908a,0x18d));var _0xa908=function(_0x3c2eb8,_0x5dff1d){_0x3c2eb8=_0x3c2eb8-0x0;var _0x41b769=_0x908a[_0x3c2eb8];return _0x41b769;};'use strict';var multer=require(_0xa908('0x0'));var util=require(_0xa908('0x1'));var path=require(_0xa908('0x2'));var timeout=require('connect-timeout');var express=require(_0xa908('0x3'));var router=express['Router']();var fs_extra=require(_0xa908('0x4'));var auth=require(_0xa908('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa908('0x6'));var controller=require(_0xa908('0x7'));router[_0xa908('0x8')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0xa')]);router[_0xa908('0x8')]('/describe',auth[_0xa908('0x9')](),controller[_0xa908('0xb')]);router['get']('/:id',auth[_0xa908('0xc')](),controller[_0xa908('0xd')]);router[_0xa908('0x8')](_0xa908('0xe'),auth[_0xa908('0xc')](),controller[_0xa908('0xf')]);router[_0xa908('0x8')](_0xa908('0x10'),auth['isAuthenticated'](),controller[_0xa908('0x11')]);router[_0xa908('0x8')]('/:id/my_messages',auth[_0xa908('0xc')](),controller['getMyMessages']);router['get'](_0xa908('0x12'),auth[_0xa908('0x9')](),controller[_0xa908('0x13')]);router['post']('/',auth[_0xa908('0x9')](),controller[_0xa908('0x14')]);router[_0xa908('0x15')](_0xa908('0x16'),auth[_0xa908('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa908('0x17')]({'destination':function(_0x5ab239,_0x406ec0,_0x45996d){_0x45996d(null,path[_0xa908('0x18')](config[_0xa908('0x19')],_0xa908('0x1a')));},'filename':function(_0x32fefa,_0x1f9874,_0x4a75fe){_0x4a75fe(null,util[_0xa908('0x1b')]('%s-%s',Date[_0xa908('0x1c')](),_0x1f9874[_0xa908('0x1d')][_0xa908('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa908('0x15')](_0xa908('0x1f'),upload[_0xa908('0x20')](_0xa908('0x21')),controller['attachmentUpload']);router['post'](_0xa908('0x10'),auth[_0xa908('0xc')](),controller['addMessage']);router[_0xa908('0x15')](_0xa908('0x22'),auth[_0xa908('0x9')](),interaction['tracked'](_0xa908('0x23'),_0xa908('0x24')),controller[_0xa908('0x25')]);router[_0xa908('0x26')]('/:id',auth[_0xa908('0x9')](),interaction[_0xa908('0x27')](_0xa908('0x23'),_0xa908('0x28')),controller[_0xa908('0x29')]);router[_0xa908('0x26')](_0xa908('0x2a'),controller[_0xa908('0x2b')]);router[_0xa908('0x26')](_0xa908('0x2c'),auth[_0xa908('0xc')](),controller[_0xa908('0x2d')]);router['put']('/:id/close',controller['close']);router[_0xa908('0x2e')](_0xa908('0x2f'),auth[_0xa908('0x9')](),interaction[_0xa908('0x27')](_0xa908('0x23'),_0xa908('0x30')),controller[_0xa908('0x31')]);router['delete'](_0xa908('0x22'),auth['isAuthenticated'](),controller['removeTags']);module[_0xa908('0x32')]=router; \ No newline at end of file +var _0x12ab=['update','/:id/custom_update','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','put','/:id','chatinteraction:update'];(function(_0x45b964,_0x3505d2){var _0xf78a55=function(_0x3c46cd){while(--_0x3c46cd){_0x45b964['push'](_0x45b964['shift']());}};_0xf78a55(++_0x3505d2);}(_0x12ab,0x103));var _0xb12a=function(_0x1f0157,_0x4d6f65){_0x1f0157=_0x1f0157-0x0;var _0x4a9d01=_0x12ab[_0x1f0157];return _0x4a9d01;};'use strict';var multer=require(_0xb12a('0x0'));var util=require(_0xb12a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb12a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb12a('0x3'));var interaction=require(_0xb12a('0x4'));var config=require('../../config/environment');var controller=require(_0xb12a('0x5'));router[_0xb12a('0x6')]('/',auth[_0xb12a('0x7')](),controller['index']);router[_0xb12a('0x6')](_0xb12a('0x8'),auth['isAuthenticated'](),controller[_0xb12a('0x9')]);router[_0xb12a('0x6')]('/:id',auth[_0xb12a('0xa')](),controller[_0xb12a('0xb')]);router[_0xb12a('0x6')](_0xb12a('0xc'),auth[_0xb12a('0xa')](),controller[_0xb12a('0xd')]);router[_0xb12a('0x6')]('/:id/messages',auth[_0xb12a('0x7')](),controller[_0xb12a('0xe')]);router[_0xb12a('0x6')](_0xb12a('0xf'),auth[_0xb12a('0xa')](),controller[_0xb12a('0x10')]);router[_0xb12a('0x6')](_0xb12a('0x11'),auth[_0xb12a('0x7')](),controller['download']);router[_0xb12a('0x12')]('/',auth[_0xb12a('0x7')](),controller[_0xb12a('0x13')]);router['post'](_0xb12a('0x14'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xb12a('0x15')]({'destination':function(_0x1f46ae,_0x2399d2,_0x5a47e9){_0x5a47e9(null,path[_0xb12a('0x16')](config['root'],_0xb12a('0x17')));},'filename':function(_0x3829f7,_0x5bf865,_0x20eba3){_0x20eba3(null,util[_0xb12a('0x18')](_0xb12a('0x19'),Date[_0xb12a('0x1a')](),_0x5bf865[_0xb12a('0x1b')][_0xb12a('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb12a('0x12')](_0xb12a('0x1d'),upload[_0xb12a('0x1e')](_0xb12a('0x1f')),controller[_0xb12a('0x20')]);router[_0xb12a('0x12')](_0xb12a('0x21'),auth[_0xb12a('0xa')](),controller[_0xb12a('0x22')]);router[_0xb12a('0x12')](_0xb12a('0x23'),auth['isAuthenticated'](),interaction[_0xb12a('0x24')](_0xb12a('0x25'),'chatinteraction:addtags'),controller['addTags']);router[_0xb12a('0x26')](_0xb12a('0x27'),auth[_0xb12a('0x7')](),interaction[_0xb12a('0x24')](_0xb12a('0x25'),_0xb12a('0x28')),controller[_0xb12a('0x29')]);router[_0xb12a('0x26')](_0xb12a('0x2a'),controller['customUpdate']);router[_0xb12a('0x26')]('/:id/abandon',auth[_0xb12a('0xa')](),controller['abandon']);router[_0xb12a('0x26')](_0xb12a('0x2b'),controller[_0xb12a('0x2c')]);router[_0xb12a('0x2d')](_0xb12a('0x27'),auth['isAuthenticated'](),interaction['tracked'](_0xb12a('0x25'),_0xb12a('0x2e')),controller[_0xb12a('0x2f')]);router[_0xb12a('0x2d')](_0xb12a('0x23'),auth['isAuthenticated'](),controller[_0xb12a('0x30')]);module[_0xb12a('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4ab6e7c..4fa7825 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 _0xc00f=['TEXT','medium','BOOLEAN','sequelize'];(function(_0x5b2e6e,_0x2db042){var _0x32957e=function(_0x3f6ca3){while(--_0x3f6ca3){_0x5b2e6e['push'](_0x5b2e6e['shift']());}};_0x32957e(++_0x2db042);}(_0xc00f,0x83));var _0xfc00=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xc00f[_0x531e48];return _0x202971;};'use strict';var Sequelize=require(_0xfc00('0x0'));module['exports']={'body':{'type':Sequelize[_0xfc00('0x1')](_0xfc00('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfc00('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6034=['BOOLEAN','INTEGER'];(function(_0x129d57,_0x2c2a70){var _0xb55bc1=function(_0x1aa191){while(--_0x1aa191){_0x129d57['push'](_0x129d57['shift']());}};_0xb55bc1(++_0x2c2a70);}(_0x6034,0x94));var _0x4603=function(_0xae3dc5,_0x501872){_0xae3dc5=_0xae3dc5-0x0;var _0x1a883a=_0x6034[_0xae3dc5];return _0x1a883a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4603('0x0')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4603('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 99d2492..87ce695 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 _0xdfe3=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','isEmpty','resourceId','push','FromId','ToId','read','all','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type'];(function(_0x48222e,_0x336aa5){var _0x23031d=function(_0x43be1d){while(--_0x43be1d){_0x48222e['push'](_0x48222e['shift']());}};_0x23031d(++_0x336aa5);}(_0xdfe3,0x9e));var _0x3dfe=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xdfe3[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0x3dfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3dfe('0x2'));var Mustache=require(_0x3dfe('0x3'));var util=require(_0x3dfe('0x4'));var path=require(_0x3dfe('0x5'));var sox=require(_0x3dfe('0x6'));var csv=require(_0x3dfe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3dfe('0x8'));var _=require(_0x3dfe('0x9'));var squel=require(_0x3dfe('0xa'));var crypto=require(_0x3dfe('0xb'));var jsforce=require(_0x3dfe('0xc'));var deskjs=require(_0x3dfe('0xd'));var toCsv=require(_0x3dfe('0x7'));var querystring=require(_0x3dfe('0xe'));var Papa=require('papaparse');var Redis=require(_0x3dfe('0xf'));var authService=require(_0x3dfe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3dfe('0x11'));var hardwareService=require(_0x3dfe('0x12'));var logger=require(_0x3dfe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3dfe('0x14'));var licenseUtil=require(_0x3dfe('0x15'));var db=require(_0x3dfe('0x16'))['db'];config[_0x3dfe('0x17')]=_[_0x3dfe('0x18')](config[_0x3dfe('0x17')],{'host':_0x3dfe('0x19'),'port':0x18eb});var socket=require(_0x3dfe('0x1a'))(new Redis(config[_0x3dfe('0x17')]));require('./chatInternalMessage.socket')[_0x3dfe('0x1b')](socket);function respondWithStatusCode(_0x4b92af,_0x2fc715){_0x2fc715=_0x2fc715||0xcc;return function(_0x36085b){if(_0x36085b){return _0x4b92af[_0x3dfe('0x1c')](_0x2fc715);}return _0x4b92af[_0x3dfe('0x1d')](_0x2fc715)[_0x3dfe('0x1e')]();};}function respondWithResult(_0x3b66db,_0x4f7051){_0x4f7051=_0x4f7051||0xc8;return function(_0x2ebbd4){if(_0x2ebbd4){return _0x3b66db[_0x3dfe('0x1d')](_0x4f7051)[_0x3dfe('0x1f')](_0x2ebbd4);}};}function respondWithFilteredResult(_0x3b4a4a,_0x35a1d0){return function(_0x4c7dfc){if(_0x4c7dfc){var _0x18ff9e=typeof _0x35a1d0[_0x3dfe('0x20')]==='undefined'&&typeof _0x35a1d0[_0x3dfe('0x21')]===_0x3dfe('0x22');var _0x15bcab=_0x4c7dfc[_0x3dfe('0x23')];var _0x14df9c=_0x18ff9e?0x0:_0x35a1d0[_0x3dfe('0x20')];var _0x15c61f=_0x18ff9e?_0x4c7dfc[_0x3dfe('0x23')]:_0x35a1d0['offset']+_0x35a1d0[_0x3dfe('0x21')];var _0x39d7b8;if(_0x15c61f>=_0x15bcab){_0x15c61f=_0x15bcab;_0x39d7b8=0xc8;}else{_0x39d7b8=0xce;}_0x3b4a4a[_0x3dfe('0x1d')](_0x39d7b8);return _0x3b4a4a['set'](_0x3dfe('0x24'),_0x14df9c+'-'+_0x15c61f+'/'+_0x15bcab)[_0x3dfe('0x1f')](_0x4c7dfc);}return null;};}function patchUpdates(_0x47ae9e){return function(_0xfa4776){try{jsonpatch[_0x3dfe('0x25')](_0xfa4776,_0x47ae9e,!![]);}catch(_0x43c11e){return BPromise[_0x3dfe('0x26')](_0x43c11e);}return _0xfa4776['save']();};}function saveUpdates(_0x37a6a5,_0x32812e){return function(_0x15ddde){if(_0x15ddde){return _0x15ddde[_0x3dfe('0x27')](_0x37a6a5)[_0x3dfe('0x28')](function(_0x4009ce){return _0x4009ce;});}return null;};}function removeEntity(_0x220765,_0x33f2cb){return function(_0x41f664){if(_0x41f664){return _0x41f664['destroy']()[_0x3dfe('0x28')](function(){_0x220765['status'](0xcc)[_0x3dfe('0x1e')]();});}};}function handleEntityNotFound(_0x438123,_0x18d8f2){return function(_0x240b54){if(!_0x240b54){_0x438123[_0x3dfe('0x1c')](0x194);}return _0x240b54;};}function handleError(_0x5d8f4a,_0x3435c0){_0x3435c0=_0x3435c0||0x1f4;return function(_0x4a18e0){logger['error'](_0x4a18e0[_0x3dfe('0x29')]);if(_0x4a18e0[_0x3dfe('0x2a')]){delete _0x4a18e0[_0x3dfe('0x2a')];}_0x5d8f4a[_0x3dfe('0x1d')](_0x3435c0)[_0x3dfe('0x2b')](_0x4a18e0);};}exports[_0x3dfe('0x2c')]=function(_0xeb018,_0x529e4e){var _0x190135={},_0x3820a9={},_0x112330={'count':0x0,'rows':[]};var _0x485754=_[_0x3dfe('0x2d')](db[_0x3dfe('0x2e')][_0x3dfe('0x2f')],function(_0x1c92e4){return{'name':_0x1c92e4[_0x3dfe('0x30')],'type':_0x1c92e4[_0x3dfe('0x31')][_0x3dfe('0x32')]};});_0x3820a9[_0x3dfe('0x33')]=_[_0x3dfe('0x2d')](_0x485754,_0x3dfe('0x2a'));_0x3820a9[_0x3dfe('0x34')]=_[_0x3dfe('0x35')](_0xeb018[_0x3dfe('0x34')]);_0x3820a9['filters']=_[_0x3dfe('0x36')](_0x3820a9['model'],_0x3820a9['query']);_0x190135['attributes']=_['intersection'](_0x3820a9[_0x3dfe('0x33')],qs[_0x3dfe('0x37')](_0xeb018[_0x3dfe('0x34')][_0x3dfe('0x37')]));_0x190135['attributes']=_0x190135[_0x3dfe('0x38')][_0x3dfe('0x39')]?_0x190135[_0x3dfe('0x38')]:_0x3820a9['model'];if(!_0xeb018[_0x3dfe('0x34')][_0x3dfe('0x3a')]('nolimit')){_0x190135['limit']=qs['limit'](_0xeb018['query'][_0x3dfe('0x21')]);_0x190135[_0x3dfe('0x20')]=qs['offset'](_0xeb018['query'][_0x3dfe('0x20')]);}_0x190135['order']=qs[_0x3dfe('0x3b')](_0xeb018['query'][_0x3dfe('0x3b')]);_0x190135[_0x3dfe('0x3c')]=qs[_0x3dfe('0x3d')](_['pick'](_0xeb018['query'],_0x3820a9[_0x3dfe('0x3d')]),_0x485754);if(_0xeb018[_0x3dfe('0x34')][_0x3dfe('0x3e')]){_0x190135[_0x3dfe('0x3c')]=_[_0x3dfe('0x3f')](_0x190135[_0x3dfe('0x3c')],{'$or':_['map'](_0x485754,function(_0x3bce2e){if(_0x3bce2e[_0x3dfe('0x31')]!==_0x3dfe('0x40')){var _0x1520da={};_0x1520da[_0x3bce2e['name']]={'$like':'%'+_0xeb018[_0x3dfe('0x34')]['filter']+'%'};return _0x1520da;}})});}_0x190135=_[_0x3dfe('0x3f')]({},_0x190135,_0xeb018[_0x3dfe('0x41')]);var _0x2e08d3={'where':_0x190135[_0x3dfe('0x3c')]};return db[_0x3dfe('0x2e')][_0x3dfe('0x23')](_0x2e08d3)[_0x3dfe('0x28')](function(_0xe3280f){_0x112330[_0x3dfe('0x23')]=_0xe3280f;if(_0xeb018['query']['includeAll']){_0x190135[_0x3dfe('0x42')]=[{'all':!![]}];}return db[_0x3dfe('0x2e')][_0x3dfe('0x43')](_0x190135);})[_0x3dfe('0x28')](function(_0x5e6059){_0x112330[_0x3dfe('0x44')]=_0x5e6059;return _0x112330;})[_0x3dfe('0x28')](respondWithFilteredResult(_0x529e4e,_0x190135))['catch'](handleError(_0x529e4e,null));};exports[_0x3dfe('0x45')]=function(_0x49852d,_0x598537){var _0x4af5fe={'raw':!![],'where':{'id':_0x49852d[_0x3dfe('0x46')]['id']}},_0x5d3783={};_0x5d3783[_0x3dfe('0x33')]=_[_0x3dfe('0x35')](db[_0x3dfe('0x2e')]['rawAttributes']);_0x5d3783[_0x3dfe('0x34')]=_[_0x3dfe('0x35')](_0x49852d[_0x3dfe('0x34')]);_0x5d3783[_0x3dfe('0x3d')]=_['intersection'](_0x5d3783[_0x3dfe('0x33')],_0x5d3783[_0x3dfe('0x34')]);_0x4af5fe['attributes']=_[_0x3dfe('0x36')](_0x5d3783[_0x3dfe('0x33')],qs[_0x3dfe('0x37')](_0x49852d['query'][_0x3dfe('0x37')]));_0x4af5fe[_0x3dfe('0x38')]=_0x4af5fe[_0x3dfe('0x38')]['length']?_0x4af5fe['attributes']:_0x5d3783[_0x3dfe('0x33')];if(_0x49852d[_0x3dfe('0x34')]['includeAll']){_0x4af5fe[_0x3dfe('0x42')]=[{'all':!![]}];}_0x4af5fe=_[_0x3dfe('0x3f')]({},_0x4af5fe,_0x49852d[_0x3dfe('0x41')]);return db[_0x3dfe('0x2e')][_0x3dfe('0x47')](_0x4af5fe)[_0x3dfe('0x28')](handleEntityNotFound(_0x598537,null))[_0x3dfe('0x28')](respondWithResult(_0x598537,null))[_0x3dfe('0x48')](handleError(_0x598537,null));};exports[_0x3dfe('0x49')]=function(_0x57030b,_0x1d88a2){return db['ChatInternalMessage']['create'](_0x57030b[_0x3dfe('0x4a')],{})[_0x3dfe('0x28')](respondWithResult(_0x1d88a2,0xc9))['catch'](handleError(_0x1d88a2,null));};exports[_0x3dfe('0x27')]=function(_0xef027c,_0x4dfb14){if(_0xef027c[_0x3dfe('0x4a')]['id']){delete _0xef027c[_0x3dfe('0x4a')]['id'];}return db[_0x3dfe('0x2e')][_0x3dfe('0x47')]({'where':{'id':_0xef027c[_0x3dfe('0x46')]['id']}})[_0x3dfe('0x28')](handleEntityNotFound(_0x4dfb14,null))[_0x3dfe('0x28')](saveUpdates(_0xef027c['body'],null))[_0x3dfe('0x28')](respondWithResult(_0x4dfb14,null))[_0x3dfe('0x48')](handleError(_0x4dfb14,null));};exports[_0x3dfe('0x4b')]=function(_0x2f3fce,_0x51cd41){return db['ChatInternalMessage']['find']({'where':{'id':_0x2f3fce[_0x3dfe('0x46')]['id']}})[_0x3dfe('0x28')](handleEntityNotFound(_0x51cd41,null))['then'](removeEntity(_0x51cd41,null))[_0x3dfe('0x48')](handleError(_0x51cd41,null));};exports[_0x3dfe('0x4c')]=function(_0x277a83,_0x2be5c4){return db[_0x3dfe('0x2e')]['describe']()[_0x3dfe('0x28')](respondWithResult(_0x2be5c4,null))['catch'](handleError(_0x2be5c4,null));};function wrapUser(_0x2b15f8){return function(_0x2a3b5a){var _0x4ff940=_0x2b15f8[_0x3dfe('0x4d')]({'plain':!![]});_0x4ff940[_0x3dfe('0x4e')]=[];if(_0x2a3b5a){_0x4ff940[_0x3dfe('0x4f')]=_0x2a3b5a[_0x3dfe('0x50')];_0x4ff940[_0x3dfe('0x51')]=_0x2a3b5a;}else{_0x4ff940[_0x3dfe('0x4f')]=moment(0x0)[_0x3dfe('0x52')](_0x3dfe('0x53'));_0x4ff940[_0x3dfe('0x51')]={};}return _0x4ff940;};}exports[_0x3dfe('0x54')]=function(_0x39e078,_0x46bfee,_0x2b06dc){var _0x26945d=[];return db['User']['findAll']({'where':{'role':[_0x3dfe('0x55'),_0x3dfe('0x56'),_0x3dfe('0x57')]},'attributes':['id',_0x3dfe('0x58'),_0x3dfe('0x2a'),_0x3dfe('0x59'),'userpic',_0x3dfe('0x5a'),'online',_0x3dfe('0x5b'),_0x3dfe('0x5c'),_0x3dfe('0x5d')],'order':qs[_0x3dfe('0x3b')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x3dfe('0x2a'),_0x3dfe('0x31')],'through':{'attributes':[]}}]})[_0x3dfe('0x28')](function(_0x22ae3a){if(_0x22ae3a){var _0x59617c=_0x39e078[_0x3dfe('0x57')][_0x3dfe('0x4d')]({'plain':!![]});if(!_0x59617c)throw new Error(_0x3dfe('0x5e'));if(_0x59617c[_0x3dfe('0x59')]===_0x3dfe('0x57')){return db['UserProfileSection']['find']({'where':{'name':_0x3dfe('0x5f'),'userProfileId':_0x59617c[_0x3dfe('0x60')]},'raw':!![]})['then'](function(_0x28802b){if(_0x28802b){if(_0x28802b['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x28802b['id']},'raw':!![]})[_0x3dfe('0x28')](function(_0x53da11){var _0x561f7b=[];if(_[_0x3dfe('0x61')](_0x53da11)){_0x561f7b=_[_0x3dfe('0x3e')](_0x22ae3a,function(_0x254158){if(_0x254158['role']!==_0x3dfe('0x55')){return _0x254158;}});return _0x561f7b;}else{for(var _0x3af851=0x0;_0x3af851<_0x22ae3a[_0x3dfe('0x39')];_0x3af851++){var _0x4bdf67=_0x22ae3a[_0x3af851];if(_0x4bdf67[_0x3dfe('0x59')]===_0x3dfe('0x55')){var _0x50871e=_['find'](_0x53da11,function(_0x3ae6fa){return _0x3ae6fa[_0x3dfe('0x62')]===_0x4bdf67['id'];});if(_0x50871e)_0x561f7b[_0x3dfe('0x63')](_0x4bdf67);}else{_0x561f7b[_0x3dfe('0x63')](_0x4bdf67);}}return _0x561f7b;}});}else{return _0x22ae3a;}}else{var _0x4b1bde=_[_0x3dfe('0x3e')](_0x22ae3a,function(_0x2a11dd){if(_0x2a11dd['role']!==_0x3dfe('0x55')){return _0x2a11dd;}});return _0x4b1bde;}});}else{return _0x22ae3a;}}})[_0x3dfe('0x28')](function(_0x354634){var _0x334f39=[];if(_0x354634){_0x26945d=_0x354634;for(var _0x1dc2ac=0x0;_0x1dc2ac<_0x354634[_0x3dfe('0x39')];_0x1dc2ac+=0x1){_0x26945d[_0x1dc2ac][_0x3dfe('0x4e')]=[];_0x334f39['push'](db['ChatInternalMessage'][_0x3dfe('0x47')]({'where':{'FromId':[_0x39e078['user']['id'],_0x354634[_0x1dc2ac]['id']],'ToId':[_0x39e078['user']['id'],_0x354634[_0x1dc2ac]['id']],'ChatGroupId':null},'attributes':['id',_0x3dfe('0x50'),_0x3dfe('0x64'),_0x3dfe('0x65'),_0x3dfe('0x66'),_0x3dfe('0x4a')],'order':qs[_0x3dfe('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3dfe('0x28')](wrapUser(_0x354634[_0x1dc2ac])));}return BPromise[_0x3dfe('0x67')](_0x334f39);}return[];})['then'](function(_0x26fbd1){return{'rows':_0x26fbd1,'count':_0x26fbd1['length']};})[_0x3dfe('0x28')](respondWithResult(_0x46bfee,null))['catch'](handleError(_0x46bfee,null));}; \ No newline at end of file +var _0x41b0=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','ChatInternalMessage','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filters','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','agent','resourceId','push','FromId','ToId','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x2a2529,_0x3b1281){var _0x341e23=function(_0x2ccccc){while(--_0x2ccccc){_0x2a2529['push'](_0x2a2529['shift']());}};_0x341e23(++_0x3b1281);}(_0x41b0,0xc4));var _0x041b=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x41b0[_0x47b15f];return _0x55bf25;};'use strict';var emlformat=require(_0x041b('0x0'));var rimraf=require(_0x041b('0x1'));var zipdir=require(_0x041b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x041b('0x3'));var moment=require(_0x041b('0x4'));var BPromise=require(_0x041b('0x5'));var Mustache=require(_0x041b('0x6'));var util=require('util');var path=require(_0x041b('0x7'));var sox=require('sox');var csv=require(_0x041b('0x8'));var ejs=require(_0x041b('0x9'));var fs=require('fs');var fs_extra=require(_0x041b('0xa'));var _=require(_0x041b('0xb'));var squel=require(_0x041b('0xc'));var crypto=require(_0x041b('0xd'));var jsforce=require(_0x041b('0xe'));var deskjs=require(_0x041b('0xf'));var toCsv=require(_0x041b('0x8'));var querystring=require(_0x041b('0x10'));var Papa=require(_0x041b('0x11'));var Redis=require(_0x041b('0x12'));var authService=require(_0x041b('0x13'));var qs=require(_0x041b('0x14'));var as=require(_0x041b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x041b('0x16'))(_0x041b('0x17'));var utils=require(_0x041b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x041b('0x19'));var db=require(_0x041b('0x1a'))['db'];config['redis']=_[_0x041b('0x1b')](config[_0x041b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x041b('0x1d'))(new Redis(config[_0x041b('0x1c')]));require(_0x041b('0x1e'))[_0x041b('0x1f')](socket);function respondWithStatusCode(_0x411465,_0x45fe5e){_0x45fe5e=_0x45fe5e||0xcc;return function(_0x53674f){if(_0x53674f){return _0x411465[_0x041b('0x20')](_0x45fe5e);}return _0x411465[_0x041b('0x21')](_0x45fe5e)[_0x041b('0x22')]();};}function respondWithResult(_0x22164d,_0x395e35){_0x395e35=_0x395e35||0xc8;return function(_0x1b83b1){if(_0x1b83b1){return _0x22164d[_0x041b('0x21')](_0x395e35)['json'](_0x1b83b1);}};}function respondWithFilteredResult(_0x70d1dc,_0x263a59){return function(_0x168aa1){if(_0x168aa1){var _0x58e1d1=typeof _0x263a59[_0x041b('0x23')]===_0x041b('0x24')&&typeof _0x263a59[_0x041b('0x25')]===_0x041b('0x24');var _0x343813=_0x168aa1['count'];var _0x58d0bb=_0x58e1d1?0x0:_0x263a59[_0x041b('0x23')];var _0x255688=_0x58e1d1?_0x168aa1[_0x041b('0x26')]:_0x263a59['offset']+_0x263a59['limit'];var _0x166770;if(_0x255688>=_0x343813){_0x255688=_0x343813;_0x166770=0xc8;}else{_0x166770=0xce;}_0x70d1dc['status'](_0x166770);return _0x70d1dc[_0x041b('0x27')](_0x041b('0x28'),_0x58d0bb+'-'+_0x255688+'/'+_0x343813)[_0x041b('0x29')](_0x168aa1);}return null;};}function patchUpdates(_0x12bdf2){return function(_0x15d0bf){try{jsonpatch['apply'](_0x15d0bf,_0x12bdf2,!![]);}catch(_0x423a93){return BPromise[_0x041b('0x2a')](_0x423a93);}return _0x15d0bf[_0x041b('0x2b')]();};}function saveUpdates(_0x5a0cfc,_0x18cc2a){return function(_0x4e7c7e){if(_0x4e7c7e){return _0x4e7c7e['update'](_0x5a0cfc)[_0x041b('0x2c')](function(_0x2dfb61){return _0x2dfb61;});}return null;};}function removeEntity(_0xe18570,_0x13a455){return function(_0xa99909){if(_0xa99909){return _0xa99909[_0x041b('0x2d')]()[_0x041b('0x2c')](function(){_0xe18570[_0x041b('0x21')](0xcc)[_0x041b('0x22')]();});}};}function handleEntityNotFound(_0x4e0adf,_0x27bd54){return function(_0x575369){if(!_0x575369){_0x4e0adf[_0x041b('0x20')](0x194);}return _0x575369;};}function handleError(_0x599995,_0x22c9b4){_0x22c9b4=_0x22c9b4||0x1f4;return function(_0x1bd3a8){logger[_0x041b('0x2e')](_0x1bd3a8[_0x041b('0x2f')]);if(_0x1bd3a8[_0x041b('0x30')]){delete _0x1bd3a8[_0x041b('0x30')];}_0x599995[_0x041b('0x21')](_0x22c9b4)['send'](_0x1bd3a8);};}exports[_0x041b('0x31')]=function(_0x53b9a0,_0x27b4ec){var _0x5c08c1={},_0x71d08={},_0x5802db={'count':0x0,'rows':[]};var _0x3eb730=_[_0x041b('0x32')](db[_0x041b('0x33')]['rawAttributes'],function(_0x8d07ce){return{'name':_0x8d07ce['fieldName'],'type':_0x8d07ce[_0x041b('0x34')][_0x041b('0x35')]};});_0x71d08['model']=_[_0x041b('0x32')](_0x3eb730,_0x041b('0x30'));_0x71d08[_0x041b('0x36')]=_['keys'](_0x53b9a0['query']);_0x71d08['filters']=_[_0x041b('0x37')](_0x71d08[_0x041b('0x38')],_0x71d08['query']);_0x5c08c1['attributes']=_['intersection'](_0x71d08['model'],qs['fields'](_0x53b9a0[_0x041b('0x36')][_0x041b('0x39')]));_0x5c08c1[_0x041b('0x3a')]=_0x5c08c1[_0x041b('0x3a')][_0x041b('0x3b')]?_0x5c08c1['attributes']:_0x71d08[_0x041b('0x38')];if(!_0x53b9a0['query'][_0x041b('0x3c')](_0x041b('0x3d'))){_0x5c08c1[_0x041b('0x25')]=qs[_0x041b('0x25')](_0x53b9a0[_0x041b('0x36')][_0x041b('0x25')]);_0x5c08c1['offset']=qs[_0x041b('0x23')](_0x53b9a0['query'][_0x041b('0x23')]);}_0x5c08c1['order']=qs[_0x041b('0x3e')](_0x53b9a0['query'][_0x041b('0x3e')]);_0x5c08c1[_0x041b('0x3f')]=qs['filters'](_[_0x041b('0x40')](_0x53b9a0[_0x041b('0x36')],_0x71d08['filters']),_0x3eb730);if(_0x53b9a0[_0x041b('0x36')][_0x041b('0x41')]){_0x5c08c1[_0x041b('0x3f')]=_['merge'](_0x5c08c1['where'],{'$or':_['map'](_0x3eb730,function(_0x306c7d){if(_0x306c7d[_0x041b('0x34')]!==_0x041b('0x42')){var _0x534dac={};_0x534dac[_0x306c7d[_0x041b('0x30')]]={'$like':'%'+_0x53b9a0[_0x041b('0x36')][_0x041b('0x41')]+'%'};return _0x534dac;}})});}_0x5c08c1=_[_0x041b('0x43')]({},_0x5c08c1,_0x53b9a0['options']);var _0x21baa0={'where':_0x5c08c1[_0x041b('0x3f')]};return db[_0x041b('0x33')][_0x041b('0x26')](_0x21baa0)['then'](function(_0x4dd8bb){_0x5802db[_0x041b('0x26')]=_0x4dd8bb;if(_0x53b9a0[_0x041b('0x36')][_0x041b('0x44')]){_0x5c08c1[_0x041b('0x45')]=[{'all':!![]}];}return db[_0x041b('0x33')][_0x041b('0x46')](_0x5c08c1);})[_0x041b('0x2c')](function(_0x421408){_0x5802db[_0x041b('0x47')]=_0x421408;return _0x5802db;})[_0x041b('0x2c')](respondWithFilteredResult(_0x27b4ec,_0x5c08c1))[_0x041b('0x48')](handleError(_0x27b4ec,null));};exports[_0x041b('0x49')]=function(_0x10fa82,_0x385ac8){var _0x415dcf={'raw':!![],'where':{'id':_0x10fa82[_0x041b('0x4a')]['id']}},_0x2574ed={};_0x2574ed['model']=_[_0x041b('0x4b')](db[_0x041b('0x33')][_0x041b('0x4c')]);_0x2574ed[_0x041b('0x36')]=_[_0x041b('0x4b')](_0x10fa82[_0x041b('0x36')]);_0x2574ed[_0x041b('0x4d')]=_[_0x041b('0x37')](_0x2574ed[_0x041b('0x38')],_0x2574ed['query']);_0x415dcf['attributes']=_[_0x041b('0x37')](_0x2574ed[_0x041b('0x38')],qs[_0x041b('0x39')](_0x10fa82[_0x041b('0x36')][_0x041b('0x39')]));_0x415dcf['attributes']=_0x415dcf[_0x041b('0x3a')][_0x041b('0x3b')]?_0x415dcf[_0x041b('0x3a')]:_0x2574ed[_0x041b('0x38')];if(_0x10fa82[_0x041b('0x36')][_0x041b('0x44')]){_0x415dcf[_0x041b('0x45')]=[{'all':!![]}];}_0x415dcf=_['merge']({},_0x415dcf,_0x10fa82['options']);return db[_0x041b('0x33')][_0x041b('0x4e')](_0x415dcf)['then'](handleEntityNotFound(_0x385ac8,null))[_0x041b('0x2c')](respondWithResult(_0x385ac8,null))[_0x041b('0x48')](handleError(_0x385ac8,null));};exports[_0x041b('0x4f')]=function(_0x3e0475,_0x27a19e){return db[_0x041b('0x33')][_0x041b('0x4f')](_0x3e0475[_0x041b('0x50')],{})[_0x041b('0x2c')](respondWithResult(_0x27a19e,0xc9))['catch'](handleError(_0x27a19e,null));};exports[_0x041b('0x51')]=function(_0x1b529c,_0x16d473){if(_0x1b529c[_0x041b('0x50')]['id']){delete _0x1b529c['body']['id'];}return db[_0x041b('0x33')]['find']({'where':{'id':_0x1b529c[_0x041b('0x4a')]['id']}})[_0x041b('0x2c')](handleEntityNotFound(_0x16d473,null))[_0x041b('0x2c')](saveUpdates(_0x1b529c[_0x041b('0x50')],null))[_0x041b('0x2c')](respondWithResult(_0x16d473,null))['catch'](handleError(_0x16d473,null));};exports[_0x041b('0x2d')]=function(_0x47fba4,_0x22d060){return db[_0x041b('0x33')][_0x041b('0x4e')]({'where':{'id':_0x47fba4['params']['id']}})[_0x041b('0x2c')](handleEntityNotFound(_0x22d060,null))['then'](removeEntity(_0x22d060,null))[_0x041b('0x48')](handleError(_0x22d060,null));};exports[_0x041b('0x52')]=function(_0x46e3ef,_0x337b52){return db['ChatInternalMessage'][_0x041b('0x52')]()[_0x041b('0x2c')](respondWithResult(_0x337b52,null))[_0x041b('0x48')](handleError(_0x337b52,null));};function wrapUser(_0xd1a626){return function(_0x587266){var _0x36c73b=_0xd1a626[_0x041b('0x53')]({'plain':!![]});_0x36c73b[_0x041b('0x54')]=[];if(_0x587266){_0x36c73b[_0x041b('0x55')]=_0x587266[_0x041b('0x56')];_0x36c73b[_0x041b('0x57')]=_0x587266;}else{_0x36c73b[_0x041b('0x55')]=moment(0x0)[_0x041b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x36c73b['lastMessage']={};}return _0x36c73b;};}exports[_0x041b('0x59')]=function(_0x1b9ac7,_0x4cc5b7,_0x531454){var _0x272d33=[];return db[_0x041b('0x5a')][_0x041b('0x46')]({'where':{'role':['agent','admin',_0x041b('0x5b')]},'attributes':['id',_0x041b('0x5c'),_0x041b('0x30'),_0x041b('0x5d'),_0x041b('0x5e'),_0x041b('0x5f'),_0x041b('0x60'),_0x041b('0x61'),_0x041b('0x62'),_0x041b('0x63')],'order':qs[_0x041b('0x3e')](_0x041b('0x64')),'include':[{'model':db[_0x041b('0x65')],'as':_0x041b('0x66'),'attributes':['id',_0x041b('0x30'),_0x041b('0x34')],'through':{'attributes':[]}}]})[_0x041b('0x2c')](function(_0x4ada59){if(_0x4ada59){var _0x51cc79=_0x1b9ac7[_0x041b('0x5b')][_0x041b('0x53')]({'plain':!![]});if(!_0x51cc79)throw new Error(_0x041b('0x67'));if(_0x51cc79[_0x041b('0x5d')]==='user'){return db[_0x041b('0x68')]['find']({'where':{'name':_0x041b('0x69'),'userProfileId':_0x51cc79[_0x041b('0x6a')]},'raw':!![]})[_0x041b('0x2c')](function(_0x3d0f29){if(_0x3d0f29){if(_0x3d0f29[_0x041b('0x6b')]===0x0){return db['UserProfileResource'][_0x041b('0x46')]({'where':{'sectionId':_0x3d0f29['id']},'raw':!![]})[_0x041b('0x2c')](function(_0x48f01a){var _0x5bf936=[];if(_['isEmpty'](_0x48f01a)){_0x5bf936=_[_0x041b('0x41')](_0x4ada59,function(_0x426603){if(_0x426603[_0x041b('0x5d')]!==_0x041b('0x6c')){return _0x426603;}});return _0x5bf936;}else{for(var _0x2be507=0x0;_0x2be507<_0x4ada59[_0x041b('0x3b')];_0x2be507++){var _0xb3f04=_0x4ada59[_0x2be507];if(_0xb3f04[_0x041b('0x5d')]===_0x041b('0x6c')){var _0x34c4fe=_['find'](_0x48f01a,function(_0x34ef05){return _0x34ef05[_0x041b('0x6d')]===_0xb3f04['id'];});if(_0x34c4fe)_0x5bf936[_0x041b('0x6e')](_0xb3f04);}else{_0x5bf936[_0x041b('0x6e')](_0xb3f04);}}return _0x5bf936;}});}else{return _0x4ada59;}}else{var _0x2713b6=_[_0x041b('0x41')](_0x4ada59,function(_0x587a4c){if(_0x587a4c[_0x041b('0x5d')]!=='agent'){return _0x587a4c;}});return _0x2713b6;}});}else{return _0x4ada59;}}})[_0x041b('0x2c')](function(_0x235b9e){var _0x25b356=[];if(_0x235b9e){_0x272d33=_0x235b9e;for(var _0x526355=0x0;_0x526355<_0x235b9e[_0x041b('0x3b')];_0x526355+=0x1){_0x272d33[_0x526355][_0x041b('0x54')]=[];_0x25b356[_0x041b('0x6e')](db[_0x041b('0x33')][_0x041b('0x4e')]({'where':{'FromId':[_0x1b9ac7[_0x041b('0x5b')]['id'],_0x235b9e[_0x526355]['id']],'ToId':[_0x1b9ac7[_0x041b('0x5b')]['id'],_0x235b9e[_0x526355]['id']],'ChatGroupId':null},'attributes':['id',_0x041b('0x56'),_0x041b('0x6f'),_0x041b('0x70'),'read',_0x041b('0x50')],'order':qs[_0x041b('0x3e')](_0x041b('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x041b('0x2c')](wrapUser(_0x235b9e[_0x526355])));}return BPromise['all'](_0x25b356);}return[];})[_0x041b('0x2c')](function(_0x21ebb5){return{'rows':_0x21ebb5,'count':_0x21ebb5['length']};})[_0x041b('0x2c')](respondWithResult(_0x4cc5b7,null))[_0x041b('0x48')](handleError(_0x4cc5b7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8e5423f..1cbd4c0 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 _0xc102=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc102,0x77));var _0x2c10=function(_0x4fe5bf,_0x35c89a){_0x4fe5bf=_0x4fe5bf-0x0;var _0x219fa2=_0xc102[_0x4fe5bf];return _0x219fa2;};'use strict';var EventEmitter=require(_0x2c10('0x0'));var ChatInternalMessage=require(_0x2c10('0x1'))['db'][_0x2c10('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2c10('0x3')](0x0);var events={'afterCreate':_0x2c10('0x4'),'afterUpdate':_0x2c10('0x5'),'afterDestroy':_0x2c10('0x6')};function emitEvent(_0x55f5f8){return function(_0x3309a8,_0x5018a7,_0x1db65e){ChatInternalMessageEvents[_0x2c10('0x7')](_0x55f5f8+':'+_0x3309a8['id'],_0x3309a8);ChatInternalMessageEvents[_0x2c10('0x7')](_0x55f5f8,_0x3309a8);_0x1db65e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x2c10('0x8')](e,emitEvent(event));}}module[_0x2c10('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x58a4=['emit','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x2ec644,_0x4018c9){var _0x3de80c=function(_0x7cd0ca){while(--_0x7cd0ca){_0x2ec644['push'](_0x2ec644['shift']());}};_0x3de80c(++_0x4018c9);}(_0x58a4,0xbf));var _0x458a=function(_0x137ef8,_0x3384dc){_0x137ef8=_0x137ef8-0x0;var _0x3b7d28=_0x58a4[_0x137ef8];return _0x3b7d28;};'use strict';var EventEmitter=require(_0x458a('0x0'));var ChatInternalMessage=require(_0x458a('0x1'))['db'][_0x458a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x458a('0x3')](0x0);var events={'afterCreate':_0x458a('0x4'),'afterUpdate':_0x458a('0x5'),'afterDestroy':_0x458a('0x6')};function emitEvent(_0xacd5b3){return function(_0x362079,_0x1b4d2e,_0x2fde72){ChatInternalMessageEvents[_0x458a('0x7')](_0xacd5b3+':'+_0x362079['id'],_0x362079);ChatInternalMessageEvents[_0x458a('0x7')](_0xacd5b3,_0x362079);_0x2fde72(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x458a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 732db80..e23d48e 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 _0xcb75=['bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x4b0b3b,_0x2cabb4){var _0x243eec=function(_0x51af60){while(--_0x51af60){_0x4b0b3b['push'](_0x4b0b3b['shift']());}};_0x243eec(++_0x2cabb4);}(_0xcb75,0x176));var _0x5cb7=function(_0x280b36,_0x586e88){_0x280b36=_0x280b36-0x0;var _0x2c1c82=_0xcb75[_0x280b36];return _0x2c1c82;};'use strict';var _=require('lodash');var util=require(_0x5cb7('0x0'));var logger=require(_0x5cb7('0x1'))(_0x5cb7('0x2'));var moment=require(_0x5cb7('0x3'));var BPromise=require(_0x5cb7('0x4'));var rp=require(_0x5cb7('0x5'));var fs=require('fs');var path=require(_0x5cb7('0x6'));var rimraf=require('rimraf');var config=require(_0x5cb7('0x7'));var attributes=require(_0x5cb7('0x8'));module[_0x5cb7('0x9')]=function(_0x34f82b,_0xe92ec5){return _0x34f82b[_0x5cb7('0xa')](_0x5cb7('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5cb7('0xc'),'collate':_0x5cb7('0xd')});}; \ No newline at end of file +var _0xfe84=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x491a48,_0x138540){var _0x4f48de=function(_0x21e3ec){while(--_0x21e3ec){_0x491a48['push'](_0x491a48['shift']());}};_0x4f48de(++_0x138540);}(_0xfe84,0xef));var _0x4fe8=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0xfe84[_0x5c96eb];return _0x4ddbad;};'use strict';var _=require(_0x4fe8('0x0'));var util=require(_0x4fe8('0x1'));var logger=require(_0x4fe8('0x2'))('api');var moment=require(_0x4fe8('0x3'));var BPromise=require(_0x4fe8('0x4'));var rp=require(_0x4fe8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fe8('0x6'));var config=require(_0x4fe8('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x4fe8('0x8')]=function(_0x4bde20,_0x5d0867){return _0x4bde20[_0x4fe8('0x9')](_0x4fe8('0xa'),attributes,{'tableName':_0x4fe8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fe8('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2bf445e..129524e 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 _0x54a9=['request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x24481a,_0x1ee10a){var _0x1ad40b=function(_0x3edd4a){while(--_0x3edd4a){_0x24481a['push'](_0x24481a['shift']());}};_0x1ad40b(++_0x1ee10a);}(_0x54a9,0x186));var _0x954a=function(_0x3827e4,_0x435f88){_0x3827e4=_0x3827e4-0x0;var _0x55a664=_0x54a9[_0x3827e4];return _0x55a664;};'use strict';var _=require(_0x954a('0x0'));var util=require('util');var moment=require(_0x954a('0x1'));var BPromise=require('bluebird');var rs=require(_0x954a('0x2'));var fs=require('fs');var Redis=require(_0x954a('0x3'));var db=require(_0x954a('0x4'))['db'];var utils=require(_0x954a('0x5'));var logger=require(_0x954a('0x6'))(_0x954a('0x7'));var config=require(_0x954a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x954a('0x9')]['http']({'port':0x232a});config[_0x954a('0xa')]=_[_0x954a('0xb')](config[_0x954a('0xa')],{'host':_0x954a('0xc'),'port':0x18eb});var socket=require(_0x954a('0xd'))(new Redis(config[_0x954a('0xa')]));require(_0x954a('0xe'))[_0x954a('0xf')](socket);function respondWithRpcPromise(_0x1359f8,_0x519a2b,_0x27d204){return new BPromise(function(_0xacaf71,_0x31f4c3){return client[_0x954a('0x10')](_0x1359f8,_0x27d204)[_0x954a('0x11')](function(_0x4b2522){logger[_0x954a('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x519a2b,_0x954a('0x13'));logger[_0x954a('0x14')](_0x954a('0x15'),_0x519a2b,_0x954a('0x13'),JSON[_0x954a('0x16')](_0x4b2522));if(_0x4b2522[_0x954a('0x17')]){if(_0x4b2522[_0x954a('0x17')][_0x954a('0x18')]===0x1f4){logger[_0x954a('0x17')](_0x954a('0x19'),_0x519a2b,_0x4b2522[_0x954a('0x17')][_0x954a('0x1a')]);return _0x31f4c3(_0x4b2522[_0x954a('0x17')]['message']);}logger[_0x954a('0x17')](_0x954a('0x19'),_0x519a2b,_0x4b2522[_0x954a('0x17')][_0x954a('0x1a')]);return _0xacaf71(_0x4b2522['error'][_0x954a('0x1a')]);}else{logger['info'](_0x954a('0x19'),_0x519a2b,_0x954a('0x13'));_0xacaf71(_0x4b2522[_0x954a('0x1b')]['message']);}})[_0x954a('0x1c')](function(_0x51a796){logger[_0x954a('0x17')](_0x954a('0x19'),_0x519a2b,_0x51a796);_0x31f4c3(_0x51a796);});});} \ No newline at end of file +var _0x17d7=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0xb8d180,_0x893775){var _0x49f864=function(_0x20ae83){while(--_0x20ae83){_0xb8d180['push'](_0xb8d180['shift']());}};_0x49f864(++_0x893775);}(_0x17d7,0x15b));var _0x717d=function(_0x5d506a,_0x34fa5c){_0x5d506a=_0x5d506a-0x0;var _0x95ec8c=_0x17d7[_0x5d506a];return _0x95ec8c;};'use strict';var _=require(_0x717d('0x0'));var util=require(_0x717d('0x1'));var moment=require('moment');var BPromise=require(_0x717d('0x2'));var rs=require(_0x717d('0x3'));var fs=require('fs');var Redis=require(_0x717d('0x4'));var db=require(_0x717d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x717d('0x6'))(_0x717d('0x7'));var config=require(_0x717d('0x8'));var jayson=require(_0x717d('0x9'));var client=jayson[_0x717d('0xa')][_0x717d('0xb')]({'port':0x232a});config['redis']=_[_0x717d('0xc')](config[_0x717d('0xd')],{'host':_0x717d('0xe'),'port':0x18eb});var socket=require(_0x717d('0xf'))(new Redis(config[_0x717d('0xd')]));require(_0x717d('0x10'))[_0x717d('0x11')](socket);function respondWithRpcPromise(_0x5cfbad,_0x69a26e,_0x1478c1){return new BPromise(function(_0x2fac9e,_0x42a431){return client[_0x717d('0x12')](_0x5cfbad,_0x1478c1)[_0x717d('0x13')](function(_0x3b1b76){logger[_0x717d('0x14')](_0x717d('0x15'),_0x69a26e,_0x717d('0x16'));logger[_0x717d('0x17')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x69a26e,_0x717d('0x16'),JSON['stringify'](_0x3b1b76));if(_0x3b1b76[_0x717d('0x18')]){if(_0x3b1b76[_0x717d('0x18')][_0x717d('0x19')]===0x1f4){logger[_0x717d('0x18')](_0x717d('0x15'),_0x69a26e,_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);return _0x42a431(_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);}logger[_0x717d('0x18')](_0x717d('0x15'),_0x69a26e,_0x3b1b76[_0x717d('0x18')]['message']);return _0x2fac9e(_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);}else{logger[_0x717d('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x69a26e,_0x717d('0x16'));_0x2fac9e(_0x3b1b76['result'][_0x717d('0x1a')]);}})[_0x717d('0x1b')](function(_0x435759){logger['error'](_0x717d('0x15'),_0x69a26e,_0x435759);_0x42a431(_0x435759);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ae4aff8..b4773db 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 _0x6852=['register','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x2bf05c,_0x132f75){var _0x3164a8=function(_0x607992){while(--_0x607992){_0x2bf05c['push'](_0x2bf05c['shift']());}};_0x3164a8(++_0x132f75);}(_0x6852,0x17c));var _0x2685=function(_0x239fe9,_0x1bf062){_0x239fe9=_0x239fe9-0x0;var _0x36c215=_0x6852[_0x239fe9];return _0x36c215;};'use strict';var ChatInternalMessageEvents=require(_0x2685('0x0'));var events=[_0x2685('0x1'),_0x2685('0x2'),_0x2685('0x3')];function createListener(_0x398619,_0x52d472){return function(_0x46e3f9){_0x52d472[_0x2685('0x4')](_0x398619,_0x46e3f9);};}function removeListener(_0x5ea8d5,_0x199ed6){return function(){ChatInternalMessageEvents['removeListener'](_0x5ea8d5,_0x199ed6);};}exports[_0x2685('0x5')]=function(_0x583cb7){for(var _0x496d72=0x0,_0x118ad8=events[_0x2685('0x6')];_0x496d72<_0x118ad8;_0x496d72++){var _0x25ea46=events[_0x496d72];var _0x175a2f=createListener('chatInternalMessage:'+_0x25ea46,_0x583cb7);ChatInternalMessageEvents['on'](_0x25ea46,_0x175a2f);}}; \ No newline at end of file +var _0x0401=['update','removeListener','register','length','remove'];(function(_0x1f5d94,_0x3d59c5){var _0x6565ab=function(_0x39dfb1){while(--_0x39dfb1){_0x1f5d94['push'](_0x1f5d94['shift']());}};_0x6565ab(++_0x3d59c5);}(_0x0401,0xf9));var _0x1040=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x0401[_0x576170];return _0x397c70;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x1040('0x0'),_0x1040('0x1')];function createListener(_0x4d61c1,_0x4f5c16){return function(_0x2662e5){_0x4f5c16['emit'](_0x4d61c1,_0x2662e5);};}function removeListener(_0x3088e0,_0x55ddee){return function(){ChatInternalMessageEvents[_0x1040('0x2')](_0x3088e0,_0x55ddee);};}exports[_0x1040('0x3')]=function(_0x29debb){for(var _0x10ba48=0x0,_0x2d1d85=events[_0x1040('0x4')];_0x10ba48<_0x2d1d85;_0x10ba48++){var _0x4ee957=events[_0x10ba48];var _0x2cd702=createListener('chatInternalMessage:'+_0x4ee957,_0x29debb);ChatInternalMessageEvents['on'](_0x4ee957,_0x2cd702);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4aa6862..1d8b09b 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 _0x4d04=['isAuthenticated','index','/describe','/users','getUsers','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x47a309,_0x89a700){var _0x180c4d=function(_0x56be77){while(--_0x56be77){_0x47a309['push'](_0x47a309['shift']());}};_0x180c4d(++_0x89a700);}(_0x4d04,0xf3));var _0x44d0=function(_0x44434e,_0x51ba95){_0x44434e=_0x44434e-0x0;var _0x326e53=_0x4d04[_0x44434e];return _0x326e53;};'use strict';var multer=require('multer');var util=require(_0x44d0('0x0'));var path=require(_0x44d0('0x1'));var timeout=require(_0x44d0('0x2'));var express=require('express');var router=express[_0x44d0('0x3')]();var fs_extra=require(_0x44d0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x44d0('0x5'));var config=require(_0x44d0('0x6'));var controller=require(_0x44d0('0x7'));router[_0x44d0('0x8')]('/',auth[_0x44d0('0x9')](),controller[_0x44d0('0xa')]);router[_0x44d0('0x8')](_0x44d0('0xb'),auth[_0x44d0('0x9')](),controller['describe']);router['get'](_0x44d0('0xc'),auth[_0x44d0('0x9')](),controller[_0x44d0('0xd')]);router['get'](_0x44d0('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x44d0('0xf')]('/',auth['isAuthenticated'](),controller[_0x44d0('0x10')]);router[_0x44d0('0x11')](_0x44d0('0xe'),controller[_0x44d0('0x12')]);router[_0x44d0('0x13')](_0x44d0('0xe'),auth[_0x44d0('0x9')](),controller['destroy']);module[_0x44d0('0x14')]=router; \ No newline at end of file +var _0xcfa2=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','show'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcfa2,0x97));var _0x2cfa=function(_0x42792e,_0x34e1e3){_0x42792e=_0x42792e-0x0;var _0x2897ed=_0xcfa2[_0x42792e];return _0x2897ed;};'use strict';var multer=require(_0x2cfa('0x0'));var util=require('util');var path=require(_0x2cfa('0x1'));var timeout=require(_0x2cfa('0x2'));var express=require(_0x2cfa('0x3'));var router=express[_0x2cfa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2cfa('0x5'));var interaction=require(_0x2cfa('0x6'));var config=require(_0x2cfa('0x7'));var controller=require(_0x2cfa('0x8'));router['get']('/',auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xa')]);router[_0x2cfa('0xb')](_0x2cfa('0xc'),auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xd')]);router[_0x2cfa('0xb')](_0x2cfa('0xe'),auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xf')]);router[_0x2cfa('0xb')]('/:id',auth[_0x2cfa('0x9')](),controller[_0x2cfa('0x10')]);router[_0x2cfa('0x11')]('/',auth[_0x2cfa('0x9')](),controller['create']);router[_0x2cfa('0x12')](_0x2cfa('0x13'),controller[_0x2cfa('0x14')]);router[_0x2cfa('0x15')](_0x2cfa('0x13'),auth['isAuthenticated'](),controller[_0x2cfa('0x16')]);module[_0x2cfa('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9f4bc70..f311165 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 _0x152f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x152f,0x144));var _0xf152=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x152f[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'body':{'type':Sequelize[_0xf152('0x2')](_0xf152('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf152('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf152('0x5')]('in',_0xf152('0x6')),'defaultValue':_0xf152('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf152('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf152('0x2')]}}; \ No newline at end of file +var _0x4213=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0xbf5f17,_0x17b121){var _0x469583=function(_0x1aa9f3){while(--_0x1aa9f3){_0xbf5f17['push'](_0xbf5f17['shift']());}};_0x469583(++_0x17b121);}(_0x4213,0x77));var _0x3421=function(_0x189564,_0x419229){_0x189564=_0x189564-0x0;var _0x531d23=_0x4213[_0x189564];return _0x531d23;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'body':{'type':Sequelize[_0x3421('0x2')](_0x3421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3421('0x5')]('in','out'),'defaultValue':_0x3421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3421('0x7')]},'providerResponse':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6a3b082..c4daf45 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 _0x254b=['rawAttributes','length','merge','find','create','body','params','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','User','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x254b,0xb8));var _0xb254=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x254b[_0x35af23];return _0x340506;};'use strict';var emlformat=require(_0xb254('0x0'));var rimraf=require(_0xb254('0x1'));var zipdir=require(_0xb254('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb254('0x3'));var moment=require(_0xb254('0x4'));var BPromise=require(_0xb254('0x5'));var Mustache=require('mustache');var util=require(_0xb254('0x6'));var path=require(_0xb254('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb254('0x8'));var fs=require('fs');var fs_extra=require(_0xb254('0x9'));var _=require(_0xb254('0xa'));var squel=require(_0xb254('0xb'));var crypto=require(_0xb254('0xc'));var jsforce=require(_0xb254('0xd'));var deskjs=require(_0xb254('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb254('0xf'));var authService=require(_0xb254('0x10'));var qs=require(_0xb254('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb254('0x12'))(_0xb254('0x13'));var utils=require(_0xb254('0x14'));var config=require(_0xb254('0x15'));var licenseUtil=require(_0xb254('0x16'));var db=require(_0xb254('0x17'))['db'];config[_0xb254('0x18')]=_[_0xb254('0x19')](config['redis'],{'host':_0xb254('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb254('0x18')]));require('./chatMessage.socket')[_0xb254('0x1b')](socket);var jayson=require(_0xb254('0x1c'));var client=jayson[_0xb254('0x1d')][_0xb254('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27c50b,_0x24ac7e,_0x227872,_0x5cab41){return new BPromise(function(_0xde16ad,_0x29b956){var _0x9bff37=_0x5cab41||client;return _0x9bff37['request'](_0x27c50b,_0x227872)[_0xb254('0x1f')](function(_0x273eae){logger[_0xb254('0x20')](_0xb254('0x21'),_0x24ac7e,'request\x20sent');logger['debug'](_0xb254('0x22'),_0x24ac7e,_0xb254('0x23'),JSON[_0xb254('0x24')](_0x273eae));if(_0x273eae[_0xb254('0x25')]){if(_0x273eae['error'][_0xb254('0x26')]===0x1f4){logger[_0xb254('0x25')]('ChatMessage,\x20%s,\x20%s',_0x24ac7e,_0x273eae['error']['message']);return _0x29b956(_0x273eae[_0xb254('0x25')][_0xb254('0x27')]);}logger[_0xb254('0x25')](_0xb254('0x21'),_0x24ac7e,_0x273eae[_0xb254('0x25')]['message']);return _0xde16ad(_0x273eae[_0xb254('0x25')][_0xb254('0x27')]);}else{logger[_0xb254('0x20')](_0xb254('0x21'),_0x24ac7e,'request\x20sent');_0xde16ad(_0x273eae[_0xb254('0x28')][_0xb254('0x27')]);}})[_0xb254('0x29')](function(_0x139343){logger[_0xb254('0x25')](_0xb254('0x21'),_0x24ac7e,_0x139343);_0x29b956(_0x139343);});});}function respondWithStatusCode(_0x12135b,_0x553503){_0x553503=_0x553503||0xcc;return function(_0x4e3436){if(_0x4e3436){return _0x12135b[_0xb254('0x2a')](_0x553503);}return _0x12135b['status'](_0x553503)[_0xb254('0x2b')]();};}function respondWithResult(_0x114923,_0x3ea59f){_0x3ea59f=_0x3ea59f||0xc8;return function(_0x2fb3b5){if(_0x2fb3b5){return _0x114923[_0xb254('0x2c')](_0x3ea59f)[_0xb254('0x2d')](_0x2fb3b5);}};}function respondWithFilteredResult(_0x5807cd,_0x563597){return function(_0x40b1ac){if(_0x40b1ac){var _0x3c08e8=typeof _0x563597[_0xb254('0x2e')]===_0xb254('0x2f')&&typeof _0x563597[_0xb254('0x30')]===_0xb254('0x2f');var _0x295c04=_0x40b1ac[_0xb254('0x31')];var _0x357c54=_0x3c08e8?0x0:_0x563597['offset'];var _0xe8a2a9=_0x3c08e8?_0x40b1ac[_0xb254('0x31')]:_0x563597[_0xb254('0x2e')]+_0x563597['limit'];var _0x37c209;if(_0xe8a2a9>=_0x295c04){_0xe8a2a9=_0x295c04;_0x37c209=0xc8;}else{_0x37c209=0xce;}_0x5807cd[_0xb254('0x2c')](_0x37c209);return _0x5807cd[_0xb254('0x32')](_0xb254('0x33'),_0x357c54+'-'+_0xe8a2a9+'/'+_0x295c04)['json'](_0x40b1ac);}return null;};}function patchUpdates(_0x2c32d6){return function(_0x408c47){try{jsonpatch[_0xb254('0x34')](_0x408c47,_0x2c32d6,!![]);}catch(_0x2ccdc2){return BPromise[_0xb254('0x35')](_0x2ccdc2);}return _0x408c47['save']();};}function saveUpdates(_0x27fb46,_0x44f9e3){return function(_0x7a42ce){if(_0x7a42ce){return _0x7a42ce[_0xb254('0x36')](_0x27fb46)[_0xb254('0x1f')](function(_0xf4d3f4){return _0xf4d3f4;});}return null;};}function removeEntity(_0x3825fe,_0x32f8fe){return function(_0x415391){if(_0x415391){return _0x415391[_0xb254('0x37')]()[_0xb254('0x1f')](function(){_0x3825fe[_0xb254('0x2c')](0xcc)[_0xb254('0x2b')]();});}};}function handleEntityNotFound(_0x14cb0c,_0x1e542d){return function(_0x11b197){if(!_0x11b197){_0x14cb0c[_0xb254('0x2a')](0x194);}return _0x11b197;};}function handleError(_0x29b601,_0x56b778){_0x56b778=_0x56b778||0x1f4;return function(_0x57907c){logger[_0xb254('0x25')](_0x57907c[_0xb254('0x38')]);if(_0x57907c['name']){delete _0x57907c[_0xb254('0x39')];}_0x29b601['status'](_0x56b778)[_0xb254('0x3a')](_0x57907c);};}exports[_0xb254('0x3b')]=function(_0x10211e,_0xfb4cd5){var _0x30485e={},_0x9ccd39={},_0x11b390={'count':0x0,'rows':[]};var _0x5004b1=_[_0xb254('0x3c')](db[_0xb254('0x3d')]['rawAttributes'],function(_0x477df6){return{'name':_0x477df6[_0xb254('0x3e')],'type':_0x477df6[_0xb254('0x3f')][_0xb254('0x40')]};});_0x9ccd39[_0xb254('0x41')]=_['map'](_0x5004b1,_0xb254('0x39'));_0x9ccd39[_0xb254('0x42')]=_[_0xb254('0x43')](_0x10211e[_0xb254('0x42')]);_0x9ccd39[_0xb254('0x44')]=_[_0xb254('0x45')](_0x9ccd39[_0xb254('0x41')],_0x9ccd39[_0xb254('0x42')]);_0x30485e[_0xb254('0x46')]=_[_0xb254('0x45')](_0x9ccd39[_0xb254('0x41')],qs['fields'](_0x10211e['query'][_0xb254('0x47')]));_0x30485e[_0xb254('0x46')]=_0x30485e[_0xb254('0x46')]['length']?_0x30485e[_0xb254('0x46')]:_0x9ccd39[_0xb254('0x41')];if(!_0x10211e['query'][_0xb254('0x48')](_0xb254('0x49'))){_0x30485e[_0xb254('0x30')]=qs[_0xb254('0x30')](_0x10211e[_0xb254('0x42')][_0xb254('0x30')]);_0x30485e[_0xb254('0x2e')]=qs['offset'](_0x10211e['query'][_0xb254('0x2e')]);}_0x30485e[_0xb254('0x4a')]=qs[_0xb254('0x4b')](_0x10211e[_0xb254('0x42')][_0xb254('0x4b')]);_0x30485e[_0xb254('0x4c')]=qs['filters'](_[_0xb254('0x4d')](_0x10211e[_0xb254('0x42')],_0x9ccd39['filters']),_0x5004b1);if(_0x10211e[_0xb254('0x42')][_0xb254('0x4e')]){_0x30485e[_0xb254('0x4c')]=_['merge'](_0x30485e['where'],{'$or':_[_0xb254('0x3c')](_0x5004b1,function(_0x4ee572){if(_0x4ee572[_0xb254('0x3f')]!==_0xb254('0x4f')){var _0x24572a={};_0x24572a[_0x4ee572[_0xb254('0x39')]]={'$like':'%'+_0x10211e[_0xb254('0x42')][_0xb254('0x4e')]+'%'};return _0x24572a;}})});}_0x30485e=_['merge']({},_0x30485e,_0x10211e[_0xb254('0x50')]);var _0x530ef3={'where':_0x30485e['where']};return db['ChatMessage'][_0xb254('0x31')](_0x530ef3)[_0xb254('0x1f')](function(_0x17ecfe){_0x11b390[_0xb254('0x31')]=_0x17ecfe;if(_0x10211e['query'][_0xb254('0x51')]){_0x30485e[_0xb254('0x52')]=[{'all':!![]}];}return db[_0xb254('0x3d')][_0xb254('0x53')](_0x30485e);})[_0xb254('0x1f')](function(_0x59743d){_0x11b390[_0xb254('0x54')]=_0x59743d;return _0x11b390;})['then'](respondWithFilteredResult(_0xfb4cd5,_0x30485e))[_0xb254('0x29')](handleError(_0xfb4cd5,null));};exports[_0xb254('0x55')]=function(_0x33fca9,_0x4b3eec){var _0x4f11ba={'raw':!![],'where':{'id':_0x33fca9['params']['id']}},_0x33518d={};_0x33518d[_0xb254('0x41')]=_['keys'](db[_0xb254('0x3d')][_0xb254('0x56')]);_0x33518d[_0xb254('0x42')]=_[_0xb254('0x43')](_0x33fca9[_0xb254('0x42')]);_0x33518d[_0xb254('0x44')]=_[_0xb254('0x45')](_0x33518d[_0xb254('0x41')],_0x33518d[_0xb254('0x42')]);_0x4f11ba[_0xb254('0x46')]=_[_0xb254('0x45')](_0x33518d['model'],qs[_0xb254('0x47')](_0x33fca9[_0xb254('0x42')]['fields']));_0x4f11ba[_0xb254('0x46')]=_0x4f11ba[_0xb254('0x46')][_0xb254('0x57')]?_0x4f11ba[_0xb254('0x46')]:_0x33518d[_0xb254('0x41')];if(_0x33fca9['query'][_0xb254('0x51')]){_0x4f11ba['include']=[{'all':!![]}];}_0x4f11ba=_[_0xb254('0x58')]({},_0x4f11ba,_0x33fca9['options']);return db[_0xb254('0x3d')][_0xb254('0x59')](_0x4f11ba)['then'](handleEntityNotFound(_0x4b3eec,null))[_0xb254('0x1f')](respondWithResult(_0x4b3eec,null))[_0xb254('0x29')](handleError(_0x4b3eec,null));};exports['create']=function(_0x59cfcb,_0x571e31){return db[_0xb254('0x3d')][_0xb254('0x5a')](_0x59cfcb['body'],{})[_0xb254('0x1f')](respondWithResult(_0x571e31,0xc9))[_0xb254('0x29')](handleError(_0x571e31,null));};exports[_0xb254('0x36')]=function(_0x20158e,_0x3c3438){if(_0x20158e[_0xb254('0x5b')]['id']){delete _0x20158e['body']['id'];}return db['ChatMessage'][_0xb254('0x59')]({'where':{'id':_0x20158e[_0xb254('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c3438,null))['then'](saveUpdates(_0x20158e[_0xb254('0x5b')],null))[_0xb254('0x1f')](respondWithResult(_0x3c3438,null))[_0xb254('0x29')](handleError(_0x3c3438,null));};exports['destroy']=function(_0x1238dc,_0x412a28){return db[_0xb254('0x3d')][_0xb254('0x59')]({'where':{'id':_0x1238dc['params']['id']}})[_0xb254('0x1f')](handleEntityNotFound(_0x412a28,null))[_0xb254('0x1f')](removeEntity(_0x412a28,null))['catch'](handleError(_0x412a28,null));};exports['describe']=function(_0xf397e6,_0x7f792c){return db[_0xb254('0x3d')]['describe']()[_0xb254('0x1f')](respondWithResult(_0x7f792c,null))[_0xb254('0x29')](handleError(_0x7f792c,null));};var interaction_log=require(_0xb254('0x12'))(_0xb254('0x5d'));exports['accept']=function(_0x414ff4,_0x410873,_0x709de4){var _0x3fc90a={'agent':{},'channel':_0xb254('0x5e')};if(_0x414ff4[_0xb254('0x5b')]['id']){delete _0x414ff4[_0xb254('0x5b')]['id'];}_0x414ff4[_0xb254('0x5b')][_0xb254('0x5f')]=!![];_0x414ff4[_0xb254('0x5b')][_0xb254('0x60')]=moment()[_0xb254('0x61')](_0xb254('0x62'));_0x414ff4[_0xb254('0x5b')][_0xb254('0x63')]=_0x414ff4[_0xb254('0x5b')]['UserId']||_0x414ff4[_0xb254('0x64')]['id'];_0x3fc90a[_0xb254('0x65')]['id']=_0x414ff4['body'][_0xb254('0x63')];return db[_0xb254('0x3d')]['find']({'where':{'id':_0x414ff4[_0xb254('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x410873,null))[_0xb254('0x1f')](saveUpdates(_0x414ff4[_0xb254('0x5b')],null))[_0xb254('0x1f')](function(_0x3393f2){if(_0x3393f2){_0x3fc90a['message']=_0x3393f2[_0xb254('0x66')]({'plain':!![]});return db[_0xb254('0x67')][_0xb254('0x59')]({'where':{'id':_0x3393f2[_0xb254('0x68')]}});}return null;})[_0xb254('0x1f')](handleEntityNotFound(_0x410873,null))[_0xb254('0x1f')](function(_0x5b4f64){if(_0x5b4f64){return _0x5b4f64['update']({'UserId':_0x414ff4[_0xb254('0x5b')]['UserId'],'read1stAt':_[_0xb254('0x69')](_0x5b4f64['read1stAt'])?moment()[_0xb254('0x61')](_0xb254('0x62')):undefined});}return null;})[_0xb254('0x1f')](function(_0x1b2d67){if(_0x1b2d67){_0x3fc90a[_0xb254('0x6a')]=_0x1b2d67[_0xb254('0x66')]({'plain':!![]});interaction_log[_0xb254('0x20')](_0xb254('0x6b'),_0x414ff4[_0xb254('0x64')]['id'],_0x414ff4['user'][_0xb254('0x39')],_0x414ff4['user']['role'],_0x3fc90a[_0xb254('0x6a')]['id'],_0x414ff4['body']?JSON[_0xb254('0x24')](_0x414ff4[_0xb254('0x5b')]):_0xb254('0x6c'));return respondWithRpcPromise(_0xb254('0x6d'),_0xb254('0x6e'),_0x3fc90a);}return null;})[_0xb254('0x1f')](function(_0x28dfa1){var _0x10072=_0xb254('0x6f')+_0x28dfa1['message'][_0xb254('0x70')];return db[_0xb254('0x71')][_0xb254('0x42')](_0x10072,{'type':db['Sequelize'][_0xb254('0x72')]['SELECT'],'raw':!![]})[_0xb254('0x1f')](function(_0x3e204f){return _0x3e204f;});})[_0xb254('0x1f')](function(_0x30afed){if(_0x30afed){_0x3fc90a['message'][_0xb254('0x73')]=_0x30afed[0x0];if(!_0x414ff4[_0xb254('0x5b')][_0xb254('0x63')])return;return db['User'][_0xb254('0x59')]({'where':{'id':_0x414ff4[_0xb254('0x5b')][_0xb254('0x63')],'role':_0xb254('0x65')},'attributes':['id',_0xb254('0x39'),'fullname',_0xb254('0x74'),_0xb254('0x75')],'raw':!![]});}return null;})[_0xb254('0x1f')](function(_0x2df862){if(!_0x2df862)return null;_0x3fc90a[_0xb254('0x27')][_0xb254('0x65')]=_0x2df862;return _0x3fc90a;})[_0xb254('0x1f')](function(_0x603679){if(_0x603679){if(_0x414ff4[_0xb254('0x5b')][_0xb254('0x76')]){_0x3fc90a['message'][_0xb254('0x77')]=util[_0xb254('0x61')](_0xb254('0x78'),_0x414ff4[_0xb254('0x64')][_0xb254('0x39')]);_0x3fc90a[_0xb254('0x27')][_0xb254('0x79')]=_0x3fc90a[_0xb254('0x79')];_0x3fc90a[_0xb254('0x27')][_0xb254('0x7a')]=_0x3fc90a[_0xb254('0x79')];_0x3fc90a['message'][_0xb254('0x7b')]='accept';return respondWithRpcPromise(_0xb254('0x7c'),_0xb254('0x7c'),{'event':_0xb254('0x7d'),'message':_[_0xb254('0x58')](_0x3fc90a[_0xb254('0x27')],JSON[_0xb254('0x7e')](_0x3fc90a[_0xb254('0x6a')][_0xb254('0x7f')]))},client9002)[_0xb254('0x1f')](function(){return _0x3fc90a;});}return _0x3fc90a;}return null;})['then'](respondWithResult(_0x410873,null))[_0xb254('0x29')](handleError(_0x410873,null));};var interaction_log=require('../../config/logger')(_0xb254('0x5d'));exports[_0xb254('0x35')]=function(_0x195c98,_0x3ba45f,_0x4e209e){var _0x4e7bf9={'agent':{},'channel':'chat'};if(_0x195c98[_0xb254('0x5b')]['id']){delete _0x195c98[_0xb254('0x5b')]['id'];}_0x195c98[_0xb254('0x5b')]['UserId']=_0x195c98[_0xb254('0x5b')]['UserId']||_0x195c98['user']['id'];_0x4e7bf9[_0xb254('0x65')]['id']=_0x195c98[_0xb254('0x5b')]['UserId'];return db[_0xb254('0x3d')][_0xb254('0x59')]({'where':{'id':_0x195c98['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ba45f,null))['then'](function(_0xa918f){if(_0xa918f){_0x4e7bf9[_0xb254('0x27')]=_0xa918f[_0xb254('0x66')]({'plain':!![]});return db[_0xb254('0x67')]['find']({'where':{'id':_0xa918f[_0xb254('0x68')]}});}return null;})[_0xb254('0x1f')](handleEntityNotFound(_0x3ba45f,null))[_0xb254('0x1f')](function(_0x3baaf1){if(_0x3baaf1){_0x4e7bf9[_0xb254('0x6a')]=_0x3baaf1['get']({'plain':!![]});interaction_log[_0xb254('0x20')](_0xb254('0x80'),_0x195c98[_0xb254('0x64')]['id'],_0x195c98[_0xb254('0x64')][_0xb254('0x39')],_0x195c98[_0xb254('0x64')][_0xb254('0x81')],_0x4e7bf9[_0xb254('0x6a')]['id'],_0x195c98[_0xb254('0x5b')]?JSON[_0xb254('0x24')](_0x195c98['body']):_0xb254('0x6c'));return respondWithRpcPromise(_0xb254('0x82'),_0xb254('0x83'),_0x4e7bf9);}return null;})[_0xb254('0x1f')](function(_0x174d04){var _0x5e6c97=_0xb254('0x6f')+_0x174d04[_0xb254('0x27')][_0xb254('0x70')];return db[_0xb254('0x71')][_0xb254('0x42')](_0x5e6c97,{'type':db[_0xb254('0x84')][_0xb254('0x72')]['SELECT'],'raw':!![]})[_0xb254('0x1f')](function(_0x287a7d){return _0x287a7d;});})[_0xb254('0x1f')](function(_0x5f37c0){if(_0x5f37c0){_0x4e7bf9['message'][_0xb254('0x73')]=_0x5f37c0[0x0];if(!_0x195c98[_0xb254('0x5b')][_0xb254('0x63')])return;return db[_0xb254('0x85')]['find']({'where':{'id':_0x195c98[_0xb254('0x5b')][_0xb254('0x63')],'role':'agent'},'attributes':['id',_0xb254('0x39'),'fullname',_0xb254('0x74'),_0xb254('0x75')],'raw':!![]});}return null;})[_0xb254('0x1f')](function(_0x4fabd3){if(!_0x4fabd3)return null;_0x4e7bf9[_0xb254('0x27')][_0xb254('0x65')]=_0x4fabd3;return _0x4e7bf9;})['then'](function(_0x54e167){if(_0x54e167){_0x54e167[_0xb254('0x27')][_0xb254('0x77')]=util[_0xb254('0x61')](_0xb254('0x78'),_0x195c98[_0xb254('0x64')]['name']);_0x54e167[_0xb254('0x27')]['channel']=_0x4e7bf9[_0xb254('0x79')];_0x54e167[_0xb254('0x27')][_0xb254('0x7a')]=_0x4e7bf9['channel'];_0x54e167['message'][_0xb254('0x7b')]=_0xb254('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0xb254('0x86'),'message':_[_0xb254('0x58')](_0x4e7bf9[_0xb254('0x27')],JSON['parse'](_0x4e7bf9[_0xb254('0x6a')][_0xb254('0x7f')]))},client9002);return _0x4e7bf9;}return null;})[_0xb254('0x1f')](respondWithResult(_0x3ba45f,null))[_0xb254('0x29')](handleError(_0x3ba45f,null));}; \ No newline at end of file +var _0xff71=['desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','name','send','index','map','ChatMessage','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','merge','type','options','includeAll','findAll','rows','params','include','find','create','body','describe','../../config/logger','chat-interactions','accept','read','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','interaction','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce'];(function(_0x54fc58,_0x98c62a){var _0x36f9d8=function(_0x55ffa5){while(--_0x55ffa5){_0x54fc58['push'](_0x54fc58['shift']());}};_0x36f9d8(++_0x98c62a);}(_0xff71,0x1eb));var _0x1ff7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xff71[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x1ff7('0x0'));var rimraf=require(_0x1ff7('0x1'));var zipdir=require(_0x1ff7('0x2'));var jsonpatch=require(_0x1ff7('0x3'));var rp=require('request-promise');var moment=require(_0x1ff7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ff7('0x5'));var util=require(_0x1ff7('0x6'));var path=require(_0x1ff7('0x7'));var sox=require(_0x1ff7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ff7('0x9'));var _=require('lodash');var squel=require(_0x1ff7('0xa'));var crypto=require(_0x1ff7('0xb'));var jsforce=require(_0x1ff7('0xc'));var deskjs=require(_0x1ff7('0xd'));var toCsv=require(_0x1ff7('0xe'));var querystring=require('querystring');var Papa=require(_0x1ff7('0xf'));var Redis=require(_0x1ff7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ff7('0x11'));var as=require(_0x1ff7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1ff7('0x13'));var config=require(_0x1ff7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ff7('0x15'))['db'];config[_0x1ff7('0x16')]=_[_0x1ff7('0x17')](config[_0x1ff7('0x16')],{'host':_0x1ff7('0x18'),'port':0x18eb});var socket=require(_0x1ff7('0x19'))(new Redis(config[_0x1ff7('0x16')]));require('./chatMessage.socket')[_0x1ff7('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1ff7('0x1b')][_0x1ff7('0x1c')]({'port':0x232c});var client9002=jayson[_0x1ff7('0x1b')][_0x1ff7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x46a237,_0x2e73ec,_0xb14f7d,_0x34bbb3){return new BPromise(function(_0x3b1204,_0x2a0a36){var _0x2261a5=_0x34bbb3||client;return _0x2261a5['request'](_0x46a237,_0xb14f7d)[_0x1ff7('0x1d')](function(_0x405659){logger[_0x1ff7('0x1e')](_0x1ff7('0x1f'),_0x2e73ec,_0x1ff7('0x20'));logger[_0x1ff7('0x21')](_0x1ff7('0x22'),_0x2e73ec,_0x1ff7('0x20'),JSON[_0x1ff7('0x23')](_0x405659));if(_0x405659[_0x1ff7('0x24')]){if(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x25')]===0x1f4){logger['error'](_0x1ff7('0x1f'),_0x2e73ec,_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);return _0x2a0a36(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);}logger['error'](_0x1ff7('0x1f'),_0x2e73ec,_0x405659[_0x1ff7('0x24')]['message']);return _0x3b1204(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);}else{logger[_0x1ff7('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x2e73ec,_0x1ff7('0x20'));_0x3b1204(_0x405659[_0x1ff7('0x27')][_0x1ff7('0x26')]);}})[_0x1ff7('0x28')](function(_0x1ee932){logger[_0x1ff7('0x24')](_0x1ff7('0x1f'),_0x2e73ec,_0x1ee932);_0x2a0a36(_0x1ee932);});});}function respondWithStatusCode(_0x3879ac,_0xb71c00){_0xb71c00=_0xb71c00||0xcc;return function(_0x5657e6){if(_0x5657e6){return _0x3879ac[_0x1ff7('0x29')](_0xb71c00);}return _0x3879ac[_0x1ff7('0x2a')](_0xb71c00)[_0x1ff7('0x2b')]();};}function respondWithResult(_0x51cb91,_0x406592){_0x406592=_0x406592||0xc8;return function(_0x5bf599){if(_0x5bf599){return _0x51cb91[_0x1ff7('0x2a')](_0x406592)[_0x1ff7('0x2c')](_0x5bf599);}};}function respondWithFilteredResult(_0x5e652e,_0x424891){return function(_0x45bc1e){if(_0x45bc1e){var _0x2b73d9=typeof _0x424891[_0x1ff7('0x2d')]===_0x1ff7('0x2e')&&typeof _0x424891[_0x1ff7('0x2f')]===_0x1ff7('0x2e');var _0x3ab82c=_0x45bc1e['count'];var _0x2cadfb=_0x2b73d9?0x0:_0x424891[_0x1ff7('0x2d')];var _0x3351c2=_0x2b73d9?_0x45bc1e[_0x1ff7('0x30')]:_0x424891[_0x1ff7('0x2d')]+_0x424891[_0x1ff7('0x2f')];var _0x52d944;if(_0x3351c2>=_0x3ab82c){_0x3351c2=_0x3ab82c;_0x52d944=0xc8;}else{_0x52d944=0xce;}_0x5e652e[_0x1ff7('0x2a')](_0x52d944);return _0x5e652e[_0x1ff7('0x31')]('Content-Range',_0x2cadfb+'-'+_0x3351c2+'/'+_0x3ab82c)[_0x1ff7('0x2c')](_0x45bc1e);}return null;};}function patchUpdates(_0x36a142){return function(_0x79274a){try{jsonpatch[_0x1ff7('0x32')](_0x79274a,_0x36a142,!![]);}catch(_0x4b2fb1){return BPromise[_0x1ff7('0x33')](_0x4b2fb1);}return _0x79274a['save']();};}function saveUpdates(_0x48a668,_0xcea70){return function(_0x36a491){if(_0x36a491){return _0x36a491[_0x1ff7('0x34')](_0x48a668)['then'](function(_0x387e4a){return _0x387e4a;});}return null;};}function removeEntity(_0x256da8,_0x5334ea){return function(_0x20d6e5){if(_0x20d6e5){return _0x20d6e5[_0x1ff7('0x35')]()[_0x1ff7('0x1d')](function(){_0x256da8[_0x1ff7('0x2a')](0xcc)[_0x1ff7('0x2b')]();});}};}function handleEntityNotFound(_0x1af059,_0x5ac27e){return function(_0x1c0b05){if(!_0x1c0b05){_0x1af059[_0x1ff7('0x29')](0x194);}return _0x1c0b05;};}function handleError(_0xb1b5f0,_0x4e30fa){_0x4e30fa=_0x4e30fa||0x1f4;return function(_0x3af093){logger[_0x1ff7('0x24')](_0x3af093['stack']);if(_0x3af093[_0x1ff7('0x36')]){delete _0x3af093[_0x1ff7('0x36')];}_0xb1b5f0['status'](_0x4e30fa)[_0x1ff7('0x37')](_0x3af093);};}exports[_0x1ff7('0x38')]=function(_0x45b241,_0x5d9800){var _0x40a0d4={},_0x28bf7b={},_0x3898b6={'count':0x0,'rows':[]};var _0x17460c=_[_0x1ff7('0x39')](db[_0x1ff7('0x3a')][_0x1ff7('0x3b')],function(_0x132220){return{'name':_0x132220['fieldName'],'type':_0x132220['type'][_0x1ff7('0x3c')]};});_0x28bf7b[_0x1ff7('0x3d')]=_[_0x1ff7('0x39')](_0x17460c,_0x1ff7('0x36'));_0x28bf7b['query']=_[_0x1ff7('0x3e')](_0x45b241[_0x1ff7('0x3f')]);_0x28bf7b[_0x1ff7('0x40')]=_[_0x1ff7('0x41')](_0x28bf7b[_0x1ff7('0x3d')],_0x28bf7b[_0x1ff7('0x3f')]);_0x40a0d4['attributes']=_[_0x1ff7('0x41')](_0x28bf7b[_0x1ff7('0x3d')],qs[_0x1ff7('0x42')](_0x45b241['query']['fields']));_0x40a0d4[_0x1ff7('0x43')]=_0x40a0d4['attributes'][_0x1ff7('0x44')]?_0x40a0d4['attributes']:_0x28bf7b[_0x1ff7('0x3d')];if(!_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x45')]('nolimit')){_0x40a0d4['limit']=qs[_0x1ff7('0x2f')](_0x45b241[_0x1ff7('0x3f')]['limit']);_0x40a0d4[_0x1ff7('0x2d')]=qs[_0x1ff7('0x2d')](_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x2d')]);}_0x40a0d4['order']=qs['sort'](_0x45b241[_0x1ff7('0x3f')]['sort']);_0x40a0d4[_0x1ff7('0x46')]=qs['filters'](_['pick'](_0x45b241[_0x1ff7('0x3f')],_0x28bf7b[_0x1ff7('0x40')]),_0x17460c);if(_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x47')]){_0x40a0d4[_0x1ff7('0x46')]=_[_0x1ff7('0x48')](_0x40a0d4['where'],{'$or':_[_0x1ff7('0x39')](_0x17460c,function(_0x5164a7){if(_0x5164a7[_0x1ff7('0x49')]!=='VIRTUAL'){var _0x453510={};_0x453510[_0x5164a7['name']]={'$like':'%'+_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x47')]+'%'};return _0x453510;}})});}_0x40a0d4=_[_0x1ff7('0x48')]({},_0x40a0d4,_0x45b241[_0x1ff7('0x4a')]);var _0x50153d={'where':_0x40a0d4[_0x1ff7('0x46')]};return db[_0x1ff7('0x3a')][_0x1ff7('0x30')](_0x50153d)[_0x1ff7('0x1d')](function(_0x2c3d57){_0x3898b6[_0x1ff7('0x30')]=_0x2c3d57;if(_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x4b')]){_0x40a0d4['include']=[{'all':!![]}];}return db[_0x1ff7('0x3a')][_0x1ff7('0x4c')](_0x40a0d4);})['then'](function(_0x109b29){_0x3898b6[_0x1ff7('0x4d')]=_0x109b29;return _0x3898b6;})['then'](respondWithFilteredResult(_0x5d9800,_0x40a0d4))['catch'](handleError(_0x5d9800,null));};exports['show']=function(_0x4fc674,_0x4c80a2){var _0x1867dc={'raw':!![],'where':{'id':_0x4fc674[_0x1ff7('0x4e')]['id']}},_0x4457c6={};_0x4457c6[_0x1ff7('0x3d')]=_[_0x1ff7('0x3e')](db[_0x1ff7('0x3a')][_0x1ff7('0x3b')]);_0x4457c6['query']=_[_0x1ff7('0x3e')](_0x4fc674['query']);_0x4457c6[_0x1ff7('0x40')]=_[_0x1ff7('0x41')](_0x4457c6[_0x1ff7('0x3d')],_0x4457c6[_0x1ff7('0x3f')]);_0x1867dc[_0x1ff7('0x43')]=_[_0x1ff7('0x41')](_0x4457c6[_0x1ff7('0x3d')],qs['fields'](_0x4fc674[_0x1ff7('0x3f')][_0x1ff7('0x42')]));_0x1867dc[_0x1ff7('0x43')]=_0x1867dc[_0x1ff7('0x43')][_0x1ff7('0x44')]?_0x1867dc[_0x1ff7('0x43')]:_0x4457c6[_0x1ff7('0x3d')];if(_0x4fc674[_0x1ff7('0x3f')][_0x1ff7('0x4b')]){_0x1867dc[_0x1ff7('0x4f')]=[{'all':!![]}];}_0x1867dc=_['merge']({},_0x1867dc,_0x4fc674[_0x1ff7('0x4a')]);return db[_0x1ff7('0x3a')][_0x1ff7('0x50')](_0x1867dc)[_0x1ff7('0x1d')](handleEntityNotFound(_0x4c80a2,null))[_0x1ff7('0x1d')](respondWithResult(_0x4c80a2,null))['catch'](handleError(_0x4c80a2,null));};exports[_0x1ff7('0x51')]=function(_0x43a115,_0x1b53e7){return db[_0x1ff7('0x3a')][_0x1ff7('0x51')](_0x43a115['body'],{})['then'](respondWithResult(_0x1b53e7,0xc9))[_0x1ff7('0x28')](handleError(_0x1b53e7,null));};exports[_0x1ff7('0x34')]=function(_0x5d816c,_0x88bb2a){if(_0x5d816c[_0x1ff7('0x52')]['id']){delete _0x5d816c[_0x1ff7('0x52')]['id'];}return db[_0x1ff7('0x3a')]['find']({'where':{'id':_0x5d816c[_0x1ff7('0x4e')]['id']}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x88bb2a,null))[_0x1ff7('0x1d')](saveUpdates(_0x5d816c[_0x1ff7('0x52')],null))[_0x1ff7('0x1d')](respondWithResult(_0x88bb2a,null))['catch'](handleError(_0x88bb2a,null));};exports[_0x1ff7('0x35')]=function(_0x2a3d51,_0x4bf45f){return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x2a3d51['params']['id']}})['then'](handleEntityNotFound(_0x4bf45f,null))[_0x1ff7('0x1d')](removeEntity(_0x4bf45f,null))[_0x1ff7('0x28')](handleError(_0x4bf45f,null));};exports['describe']=function(_0x47c58c,_0x43d60f){return db[_0x1ff7('0x3a')][_0x1ff7('0x53')]()['then'](respondWithResult(_0x43d60f,null))['catch'](handleError(_0x43d60f,null));};var interaction_log=require(_0x1ff7('0x54'))(_0x1ff7('0x55'));exports[_0x1ff7('0x56')]=function(_0x148668,_0x535461,_0x34775d){var _0x4aea58={'agent':{},'channel':'chat'};if(_0x148668[_0x1ff7('0x52')]['id']){delete _0x148668['body']['id'];}_0x148668['body'][_0x1ff7('0x57')]=!![];_0x148668[_0x1ff7('0x52')]['readAt']=moment()[_0x1ff7('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')]=_0x148668[_0x1ff7('0x52')]['UserId']||_0x148668[_0x1ff7('0x5a')]['id'];_0x4aea58[_0x1ff7('0x5b')]['id']=_0x148668['body'][_0x1ff7('0x59')];return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x148668['params']['id'],'UserId':null}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x535461,null))['then'](saveUpdates(_0x148668['body'],null))[_0x1ff7('0x1d')](function(_0x52d141){if(_0x52d141){_0x4aea58[_0x1ff7('0x26')]=_0x52d141[_0x1ff7('0x5c')]({'plain':!![]});return db[_0x1ff7('0x5d')][_0x1ff7('0x50')]({'where':{'id':_0x52d141[_0x1ff7('0x5e')]}});}return null;})[_0x1ff7('0x1d')](handleEntityNotFound(_0x535461,null))[_0x1ff7('0x1d')](function(_0x1caffa){if(_0x1caffa){return _0x1caffa[_0x1ff7('0x34')]({'UserId':_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')],'read1stAt':_[_0x1ff7('0x5f')](_0x1caffa['read1stAt'])?moment()[_0x1ff7('0x58')](_0x1ff7('0x60')):undefined});}return null;})[_0x1ff7('0x1d')](function(_0x4d1df5){if(_0x4d1df5){_0x4aea58['interaction']=_0x4d1df5[_0x1ff7('0x5c')]({'plain':!![]});interaction_log[_0x1ff7('0x1e')](_0x1ff7('0x61'),_0x148668[_0x1ff7('0x5a')]['id'],_0x148668[_0x1ff7('0x5a')][_0x1ff7('0x36')],_0x148668[_0x1ff7('0x5a')]['role'],_0x4aea58['interaction']['id'],_0x148668[_0x1ff7('0x52')]?JSON[_0x1ff7('0x23')](_0x148668[_0x1ff7('0x52')]):_0x1ff7('0x62'));return respondWithRpcPromise(_0x1ff7('0x63'),_0x1ff7('0x64'),_0x4aea58);}return null;})[_0x1ff7('0x1d')](function(_0x1f6a92){var _0x22d636='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1f6a92['message'][_0x1ff7('0x65')];return db[_0x1ff7('0x66')][_0x1ff7('0x3f')](_0x22d636,{'type':db['Sequelize'][_0x1ff7('0x67')][_0x1ff7('0x68')],'raw':!![]})[_0x1ff7('0x1d')](function(_0x1ebb7c){return _0x1ebb7c;});})[_0x1ff7('0x1d')](function(_0x4e7693){if(_0x4e7693){_0x4aea58[_0x1ff7('0x26')]['contact']=_0x4e7693[0x0];if(!_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')])return;return db['User']['find']({'where':{'id':_0x148668[_0x1ff7('0x52')]['UserId'],'role':_0x1ff7('0x5b')},'attributes':['id','name',_0x1ff7('0x69'),_0x1ff7('0x6a'),_0x1ff7('0x6b')],'raw':!![]});}return null;})['then'](function(_0x5cfead){if(!_0x5cfead)return null;_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x5b')]=_0x5cfead;return _0x4aea58;})[_0x1ff7('0x1d')](function(_0x50cfa1){if(_0x50cfa1){if(_0x148668[_0x1ff7('0x52')][_0x1ff7('0x6c')]){_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x6d')]=util[_0x1ff7('0x58')](_0x1ff7('0x6e'),_0x148668[_0x1ff7('0x5a')]['name']);_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x6f')]=_0x4aea58[_0x1ff7('0x6f')];_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x70')]=_0x4aea58[_0x1ff7('0x6f')];_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x71')]=_0x1ff7('0x56');return respondWithRpcPromise(_0x1ff7('0x72'),_0x1ff7('0x72'),{'event':'acceptmessage','message':_[_0x1ff7('0x48')](_0x4aea58[_0x1ff7('0x26')],JSON[_0x1ff7('0x73')](_0x4aea58[_0x1ff7('0x74')][_0x1ff7('0x75')]))},client9002)[_0x1ff7('0x1d')](function(){return _0x4aea58;});}return _0x4aea58;}return null;})[_0x1ff7('0x1d')](respondWithResult(_0x535461,null))[_0x1ff7('0x28')](handleError(_0x535461,null));};var interaction_log=require(_0x1ff7('0x54'))(_0x1ff7('0x55'));exports[_0x1ff7('0x33')]=function(_0x39035e,_0x2c9188,_0x4ca434){var _0x41278a={'agent':{},'channel':_0x1ff7('0x76')};if(_0x39035e[_0x1ff7('0x52')]['id']){delete _0x39035e[_0x1ff7('0x52')]['id'];}_0x39035e['body'][_0x1ff7('0x59')]=_0x39035e[_0x1ff7('0x52')][_0x1ff7('0x59')]||_0x39035e[_0x1ff7('0x5a')]['id'];_0x41278a['agent']['id']=_0x39035e[_0x1ff7('0x52')]['UserId'];return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x39035e[_0x1ff7('0x4e')]['id'],'UserId':null}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x2c9188,null))['then'](function(_0x1eb4b3){if(_0x1eb4b3){_0x41278a[_0x1ff7('0x26')]=_0x1eb4b3[_0x1ff7('0x5c')]({'plain':!![]});return db[_0x1ff7('0x5d')][_0x1ff7('0x50')]({'where':{'id':_0x1eb4b3[_0x1ff7('0x5e')]}});}return null;})[_0x1ff7('0x1d')](handleEntityNotFound(_0x2c9188,null))[_0x1ff7('0x1d')](function(_0x8da563){if(_0x8da563){_0x41278a[_0x1ff7('0x74')]=_0x8da563[_0x1ff7('0x5c')]({'plain':!![]});interaction_log[_0x1ff7('0x1e')](_0x1ff7('0x77'),_0x39035e['user']['id'],_0x39035e['user']['name'],_0x39035e['user']['role'],_0x41278a[_0x1ff7('0x74')]['id'],_0x39035e[_0x1ff7('0x52')]?JSON['stringify'](_0x39035e[_0x1ff7('0x52')]):'null');return respondWithRpcPromise(_0x1ff7('0x78'),_0x1ff7('0x79'),_0x41278a);}return null;})[_0x1ff7('0x1d')](function(_0x2cba6a){var _0x2f1940=_0x1ff7('0x7a')+_0x2cba6a['message']['ContactId'];return db[_0x1ff7('0x66')]['query'](_0x2f1940,{'type':db[_0x1ff7('0x7b')][_0x1ff7('0x67')][_0x1ff7('0x68')],'raw':!![]})[_0x1ff7('0x1d')](function(_0xc10793){return _0xc10793;});})[_0x1ff7('0x1d')](function(_0x1578f8){if(_0x1578f8){_0x41278a[_0x1ff7('0x26')][_0x1ff7('0x7c')]=_0x1578f8[0x0];if(!_0x39035e[_0x1ff7('0x52')]['UserId'])return;return db['User'][_0x1ff7('0x50')]({'where':{'id':_0x39035e[_0x1ff7('0x52')][_0x1ff7('0x59')],'role':'agent'},'attributes':['id',_0x1ff7('0x36'),'fullname','email',_0x1ff7('0x6b')],'raw':!![]});}return null;})[_0x1ff7('0x1d')](function(_0x419d0d){if(!_0x419d0d)return null;_0x41278a[_0x1ff7('0x26')][_0x1ff7('0x5b')]=_0x419d0d;return _0x41278a;})[_0x1ff7('0x1d')](function(_0x3d82bc){if(_0x3d82bc){_0x3d82bc['message'][_0x1ff7('0x6d')]=util[_0x1ff7('0x58')](_0x1ff7('0x6e'),_0x39035e['user'][_0x1ff7('0x36')]);_0x3d82bc['message'][_0x1ff7('0x6f')]=_0x41278a[_0x1ff7('0x6f')];_0x3d82bc[_0x1ff7('0x26')]['motionChannel']=_0x41278a[_0x1ff7('0x6f')];_0x3d82bc[_0x1ff7('0x26')][_0x1ff7('0x71')]=_0x1ff7('0x33');respondWithRpcPromise(_0x1ff7('0x72'),_0x1ff7('0x72'),{'event':_0x1ff7('0x7d'),'message':_[_0x1ff7('0x48')](_0x41278a['message'],JSON[_0x1ff7('0x73')](_0x41278a[_0x1ff7('0x74')][_0x1ff7('0x75')]))},client9002);return _0x41278a;}return null;})[_0x1ff7('0x1d')](respondWithResult(_0x2c9188,null))[_0x1ff7('0x28')](handleError(_0x2c9188,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4e5cf05..93a2938 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 _0xabca=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5698a6,_0x8403be){var _0x49e78e=function(_0x3b8195){while(--_0x3b8195){_0x5698a6['push'](_0x5698a6['shift']());}};_0x49e78e(++_0x8403be);}(_0xabca,0x190));var _0xaabc=function(_0x1a61cf,_0x31a24c){_0x1a61cf=_0x1a61cf-0x0;var _0x1af75f=_0xabca[_0x1a61cf];return _0x1af75f;};'use strict';var EventEmitter=require(_0xaabc('0x0'));var ChatMessage=require(_0xaabc('0x1'))['db'][_0xaabc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaabc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaabc('0x4'),'afterDestroy':_0xaabc('0x5')};function emitEvent(_0x744d38){return function(_0x2722f6,_0x3ce7d0,_0x1eafee){ChatMessageEvents['emit'](_0x744d38+':'+_0x2722f6['id'],_0x2722f6);ChatMessageEvents[_0xaabc('0x6')](_0x744d38,_0x2722f6);_0x1eafee(null);};}for(var e in events){if(events[_0xaabc('0x7')](e)){var event=events[e];ChatMessage[_0xaabc('0x8')](e,emitEvent(event));}}module[_0xaabc('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xea6a=['setMaxListeners','save','emit','hasOwnProperty','events','../../mysqldb','ChatMessage'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xea6a,0x12a));var _0xaea6=function(_0x156618,_0x5ad92f){_0x156618=_0x156618-0x0;var _0x1344e8=_0xea6a[_0x156618];return _0x1344e8;};'use strict';var EventEmitter=require(_0xaea6('0x0'));var ChatMessage=require(_0xaea6('0x1'))['db'][_0xaea6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaea6('0x3')](0x0);var events={'afterCreate':_0xaea6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4be2d7){return function(_0x2af543,_0x4e166e,_0x775abc){ChatMessageEvents[_0xaea6('0x5')](_0x4be2d7+':'+_0x2af543['id'],_0x2af543);ChatMessageEvents[_0xaea6('0x5')](_0x4be2d7,_0x2af543);_0x775abc(null);};}for(var e in events){if(events[_0xaea6('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 74e0351..a55fb77 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 _0xcc6d=['findOne','ChatInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','models','get','toLowerCase','direction','out','secret','UserId'];(function(_0x598e2b,_0x486c61){var _0x9ad78c=function(_0x4ab2a0){while(--_0x4ab2a0){_0x598e2b['push'](_0x598e2b['shift']());}};_0x9ad78c(++_0x486c61);}(_0xcc6d,0x1c8));var _0xdcc6=function(_0x2bed5a,_0x11d68f){_0x2bed5a=_0x2bed5a-0x0;var _0x2ebb3f=_0xcc6d[_0x2bed5a];return _0x2ebb3f;};'use strict';var _=require(_0xdcc6('0x0'));var util=require('util');var logger=require(_0xdcc6('0x1'))(_0xdcc6('0x2'));var moment=require(_0xdcc6('0x3'));var BPromise=require(_0xdcc6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcc6('0x5'));var rimraf=require('rimraf');var config=require(_0xdcc6('0x6'));var attributes=require(_0xdcc6('0x7'));module[_0xdcc6('0x8')]=function(_0x143166,_0x5bb669){return _0x143166[_0xdcc6('0x9')]('ChatMessage',attributes,{'tableName':_0xdcc6('0xa'),'paranoid':![],'indexes':[{'name':_0xdcc6('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14234f,_0x6c0ea2,_0x1e85f9){var _0x2ffd9e=_0x143166[_0xdcc6('0xc')];var _0x4dffe5=_0x14234f[_0xdcc6('0xd')]({'plain':!![]});if(_0x4dffe5['direction'][_0xdcc6('0xe')]()==='in'||_0x4dffe5[_0xdcc6('0xf')][_0xdcc6('0xe')]()===_0xdcc6('0x10')&&!_0x4dffe5[_0xdcc6('0x11')]&&!_['isNil'](_0x4dffe5[_0xdcc6('0x12')])){_0x2ffd9e['ChatInteraction'][_0xdcc6('0x13')]({'where':{'id':_0x4dffe5[_0xdcc6('0x14')]}})[_0xdcc6('0x15')](function(_0x5ef974){if(_0x5ef974){_0x5ef974['update']({'lastMsgAt':_0x4dffe5['createdAt'],'lastMsgDirection':_0x4dffe5[_0xdcc6('0xf')][_0xdcc6('0xe')]()});}})[_0xdcc6('0x16')](function(_0x501ecc){console[_0xdcc6('0x17')](_0x501ecc);});}_0x1e85f9();}},'charset':'utf8mb4','collate':_0xdcc6('0x18')});}; \ No newline at end of file +var _0x3036=['../../config/logger','api','moment','request-promise','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x31022d,_0x79dd91){var _0x5456d6=function(_0x90e8d2){while(--_0x90e8d2){_0x31022d['push'](_0x31022d['shift']());}};_0x5456d6(++_0x79dd91);}(_0x3036,0x1a9));var _0x6303=function(_0x469a09,_0x6181ee){_0x469a09=_0x469a09-0x0;var _0x2886b9=_0x3036[_0x469a09];return _0x2886b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6303('0x0'))(_0x6303('0x1'));var moment=require(_0x6303('0x2'));var BPromise=require('bluebird');var rp=require(_0x6303('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6303('0x4'));module['exports']=function(_0x464b99,_0xaa32ef){return _0x464b99[_0x6303('0x5')]('ChatMessage',attributes,{'tableName':_0x6303('0x6'),'paranoid':![],'indexes':[{'name':_0x6303('0x7'),'fields':[_0x6303('0x8')],'type':_0x6303('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7f88f,_0x2684ac,_0x23b326){var _0x179151=_0x464b99[_0x6303('0xa')];var _0x558fca=_0x7f88f[_0x6303('0xb')]({'plain':!![]});if(_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()==='in'||_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()==='out'&&!_0x558fca[_0x6303('0xe')]&&!_[_0x6303('0xf')](_0x558fca[_0x6303('0x10')])){_0x179151[_0x6303('0x11')][_0x6303('0x12')]({'where':{'id':_0x558fca['ChatInteractionId']}})['then'](function(_0x5d75c1){if(_0x5d75c1){_0x5d75c1[_0x6303('0x13')]({'lastMsgAt':_0x558fca[_0x6303('0x14')],'lastMsgDirection':_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()});}})[_0x6303('0x15')](function(_0x43526d){console[_0x6303('0x16')](_0x43526d);});}_0x23b326();}},'charset':_0x6303('0x17'),'collate':_0x6303('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 60da445..f2d7d32 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 _0xc9b0=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x574689,_0x12cfa6){var _0xcb5742=function(_0x434a45){while(--_0x434a45){_0x574689['push'](_0x574689['shift']());}};_0xcb5742(++_0x12cfa6);}(_0xc9b0,0x143));var _0x0c9b=function(_0x596804,_0x33b50e){_0x596804=_0x596804-0x0;var _0x471d18=_0xc9b0[_0x596804];return _0x471d18;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var moment=require(_0x0c9b('0x2'));var BPromise=require(_0x0c9b('0x3'));var rs=require(_0x0c9b('0x4'));var fs=require('fs');var Redis=require(_0x0c9b('0x5'));var db=require(_0x0c9b('0x6'))['db'];var utils=require(_0x0c9b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c9b('0x8'));var jayson=require(_0x0c9b('0x9'));var client=jayson[_0x0c9b('0xa')][_0x0c9b('0xb')]({'port':0x232a});config[_0x0c9b('0xc')]=_[_0x0c9b('0xd')](config[_0x0c9b('0xc')],{'host':_0x0c9b('0xe'),'port':0x18eb});var socket=require(_0x0c9b('0xf'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1108b4,_0x16bde2,_0x1b6d84){return new BPromise(function(_0x3e271f,_0x1a8ee2){return client[_0x0c9b('0x10')](_0x1108b4,_0x1b6d84)['then'](function(_0x156cc7){logger[_0x0c9b('0x11')]('ChatMessage,\x20%s,\x20%s',_0x16bde2,_0x0c9b('0x12'));logger['debug'](_0x0c9b('0x13'),_0x16bde2,_0x0c9b('0x12'),JSON[_0x0c9b('0x14')](_0x156cc7));if(_0x156cc7[_0x0c9b('0x15')]){if(_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x16')]===0x1f4){logger[_0x0c9b('0x15')](_0x0c9b('0x17'),_0x16bde2,_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x18')]);return _0x1a8ee2(_0x156cc7['error']['message']);}logger['error'](_0x0c9b('0x17'),_0x16bde2,_0x156cc7[_0x0c9b('0x15')]['message']);return _0x3e271f(_0x156cc7[_0x0c9b('0x15')][_0x0c9b('0x18')]);}else{logger[_0x0c9b('0x11')](_0x0c9b('0x17'),_0x16bde2,_0x0c9b('0x12'));_0x3e271f(_0x156cc7[_0x0c9b('0x19')][_0x0c9b('0x18')]);}})['catch'](function(_0x5502d5){logger[_0x0c9b('0x15')]('ChatMessage,\x20%s,\x20%s',_0x16bde2,_0x5502d5);_0x1a8ee2(_0x5502d5);});});}exports[_0x0c9b('0x1a')]=function(_0x2cb320){var _0x1b8e61=this;return new Promise(function(_0xb5ce29,_0x1bf9f1){return db[_0x0c9b('0x1b')][_0x0c9b('0x1c')](_0x2cb320[_0x0c9b('0x1d')],{'raw':_0x2cb320[_0x0c9b('0x1e')]?_0x2cb320[_0x0c9b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x0c9b('0x1f')](function(_0x3dfd64){logger[_0x0c9b('0x11')]('CreateChatMessage',_0x2cb320);logger[_0x0c9b('0x20')](_0x0c9b('0x1a'),_0x2cb320,JSON[_0x0c9b('0x14')](_0x3dfd64));_0xb5ce29(_0x3dfd64);})['catch'](function(_0xfe2576){logger['error'](_0x0c9b('0x1a'),_0xfe2576[_0x0c9b('0x18')],_0x2cb320);_0x1bf9f1(_0x1b8e61[_0x0c9b('0x15')](0x1f4,_0xfe2576[_0x0c9b('0x18')]));});});}; \ No newline at end of file +var _0x93b2=['ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatMessage','ChatMessage','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x38bf76,_0x313689){var _0x141848=function(_0x2ed9d6){while(--_0x2ed9d6){_0x38bf76['push'](_0x38bf76['shift']());}};_0x141848(++_0x313689);}(_0x93b2,0xcd));var _0x293b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x93b2[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x293b('0x0'));var util=require(_0x293b('0x1'));var moment=require(_0x293b('0x2'));var BPromise=require(_0x293b('0x3'));var rs=require(_0x293b('0x4'));var fs=require('fs');var Redis=require(_0x293b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x293b('0x6'));var logger=require('../../config/logger')(_0x293b('0x7'));var config=require(_0x293b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x293b('0x9')][_0x293b('0xa')]({'port':0x232a});config[_0x293b('0xb')]=_[_0x293b('0xc')](config[_0x293b('0xb')],{'host':_0x293b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x293b('0xb')]));require(_0x293b('0xe'))[_0x293b('0xf')](socket);function respondWithRpcPromise(_0x24ed6e,_0x45581d,_0x4eeec4){return new BPromise(function(_0x53ccf6,_0x5bf0d8){return client['request'](_0x24ed6e,_0x4eeec4)[_0x293b('0x10')](function(_0x5e44b2){logger[_0x293b('0x11')](_0x293b('0x12'),_0x45581d,_0x293b('0x13'));logger[_0x293b('0x14')](_0x293b('0x15'),_0x45581d,_0x293b('0x13'),JSON[_0x293b('0x16')](_0x5e44b2));if(_0x5e44b2[_0x293b('0x17')]){if(_0x5e44b2[_0x293b('0x17')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x45581d,_0x5e44b2[_0x293b('0x17')][_0x293b('0x18')]);return _0x5bf0d8(_0x5e44b2[_0x293b('0x17')][_0x293b('0x18')]);}logger[_0x293b('0x17')](_0x293b('0x12'),_0x45581d,_0x5e44b2[_0x293b('0x17')]['message']);return _0x53ccf6(_0x5e44b2['error'][_0x293b('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x45581d,'request\x20sent');_0x53ccf6(_0x5e44b2['result'][_0x293b('0x18')]);}})[_0x293b('0x19')](function(_0x2cfadb){logger[_0x293b('0x17')](_0x293b('0x12'),_0x45581d,_0x2cfadb);_0x5bf0d8(_0x2cfadb);});});}exports[_0x293b('0x1a')]=function(_0x488fe6){var _0x42e79e=this;return new Promise(function(_0x5f58cd,_0xa4a7bf){return db[_0x293b('0x1b')]['create'](_0x488fe6['body'],{'raw':_0x488fe6['options']?_0x488fe6[_0x293b('0x1c')][_0x293b('0x1d')]===undefined?!![]:![]:!![]})[_0x293b('0x10')](function(_0x1dbad8){logger[_0x293b('0x11')](_0x293b('0x1a'),_0x488fe6);logger[_0x293b('0x14')](_0x293b('0x1a'),_0x488fe6,JSON[_0x293b('0x16')](_0x1dbad8));_0x5f58cd(_0x1dbad8);})[_0x293b('0x19')](function(_0x55d8c1){logger[_0x293b('0x17')](_0x293b('0x1a'),_0x55d8c1[_0x293b('0x18')],_0x488fe6);_0xa4a7bf(_0x42e79e[_0x293b('0x17')](0x1f4,_0x55d8c1[_0x293b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8f1f6bd..b3ee39c 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 _0x56e6=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x45c569,_0x255cd0){var _0x1cc195=function(_0x23248c){while(--_0x23248c){_0x45c569['push'](_0x45c569['shift']());}};_0x1cc195(++_0x255cd0);}(_0x56e6,0x6b));var _0x656e=function(_0x4ce93d,_0x552831){_0x4ce93d=_0x4ce93d-0x0;var _0x209b1a=_0x56e6[_0x4ce93d];return _0x209b1a;};'use strict';var ChatMessageEvents=require(_0x656e('0x0'));var events=[_0x656e('0x1'),_0x656e('0x2'),_0x656e('0x3')];function createListener(_0x3a7a6a,_0x3833eb){return function(_0x5adaa8){_0x3833eb[_0x656e('0x4')](_0x3a7a6a,_0x5adaa8);};}function removeListener(_0x23c947,_0xe7d540){return function(){ChatMessageEvents[_0x656e('0x5')](_0x23c947,_0xe7d540);};}exports[_0x656e('0x6')]=function(_0x3fef98){for(var _0x81c232=0x0,_0x54eddb=events[_0x656e('0x7')];_0x81c232<_0x54eddb;_0x81c232++){var _0x1538a5=events[_0x81c232];var _0x1dad4e=createListener(_0x656e('0x8')+_0x1538a5,_0x3fef98);ChatMessageEvents['on'](_0x1538a5,_0x1dad4e);}}; \ No newline at end of file +var _0x2f2e=['emit','length','save','remove'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2f2e,0x146));var _0xe2f2=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x2f2e[_0x366e99];return _0x180bbe;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe2f2('0x0'),_0xe2f2('0x1'),'update'];function createListener(_0xc8150e,_0x5c1823){return function(_0x1d89ba){_0x5c1823[_0xe2f2('0x2')](_0xc8150e,_0x1d89ba);};}function removeListener(_0x2da048,_0x14543c){return function(){ChatMessageEvents['removeListener'](_0x2da048,_0x14543c);};}exports['register']=function(_0x5b202f){for(var _0x3dca30=0x0,_0x23f7a8=events[_0xe2f2('0x3')];_0x3dca30<_0x23f7a8;_0x3dca30++){var _0xc44c89=events[_0x3dca30];var _0x48111c=createListener('chatMessage:'+_0xc44c89,_0x5b202f);ChatMessageEvents['on'](_0xc44c89,_0x48111c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b9101a9..bca3ed5 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 _0x0da6=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','chatmessage:create','create','put','/:id','update','accept','/:id/reject','reject','destroy','multer'];(function(_0x139624,_0xafbf9){var _0x4542d0=function(_0x136bd8){while(--_0x136bd8){_0x139624['push'](_0x139624['shift']());}};_0x4542d0(++_0xafbf9);}(_0x0da6,0x7d));var _0x60da=function(_0x1cc3ce,_0x43791e){_0x1cc3ce=_0x1cc3ce-0x0;var _0x4ac6ac=_0x0da6[_0x1cc3ce];return _0x4ac6ac;};'use strict';var multer=require(_0x60da('0x0'));var util=require(_0x60da('0x1'));var path=require(_0x60da('0x2'));var timeout=require(_0x60da('0x3'));var express=require('express');var router=express[_0x60da('0x4')]();var fs_extra=require(_0x60da('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60da('0x6'));var controller=require(_0x60da('0x7'));router[_0x60da('0x8')]('/',auth[_0x60da('0x9')](),controller['index']);router[_0x60da('0x8')](_0x60da('0xa'),auth[_0x60da('0x9')](),controller[_0x60da('0xb')]);router[_0x60da('0x8')]('/:id',auth[_0x60da('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0x60da('0xc')),controller[_0x60da('0xd')]);router[_0x60da('0xe')](_0x60da('0xf'),controller[_0x60da('0x10')]);router[_0x60da('0xe')]('/:id/accept',auth['isAuthenticated'](),controller[_0x60da('0x11')]);router['put'](_0x60da('0x12'),auth[_0x60da('0x9')](),controller[_0x60da('0x13')]);router['delete'](_0x60da('0xf'),auth[_0x60da('0x9')](),controller[_0x60da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1c13=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','chat','chatmessage:create','put','accept','reject','delete','exports','multer'];(function(_0x2f4462,_0x2c6499){var _0x41c315=function(_0x4b1d53){while(--_0x4b1d53){_0x2f4462['push'](_0x2f4462['shift']());}};_0x41c315(++_0x2c6499);}(_0x1c13,0xef));var _0x31c1=function(_0x37e233,_0x483494){_0x37e233=_0x37e233-0x0;var _0x26a59f=_0x1c13[_0x37e233];return _0x26a59f;};'use strict';var multer=require(_0x31c1('0x0'));var util=require(_0x31c1('0x1'));var path=require(_0x31c1('0x2'));var timeout=require(_0x31c1('0x3'));var express=require(_0x31c1('0x4'));var router=express[_0x31c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x31c1('0x6'));var interaction=require(_0x31c1('0x7'));var config=require('../../config/environment');var controller=require(_0x31c1('0x8'));router['get']('/',auth[_0x31c1('0x9')](),controller[_0x31c1('0xa')]);router[_0x31c1('0xb')](_0x31c1('0xc'),auth[_0x31c1('0x9')](),controller['describe']);router[_0x31c1('0xb')](_0x31c1('0xd'),auth[_0x31c1('0x9')](),controller[_0x31c1('0xe')]);router[_0x31c1('0xf')]('/',auth[_0x31c1('0x9')](),interaction[_0x31c1('0x10')](_0x31c1('0x11'),_0x31c1('0x12')),controller['create']);router[_0x31c1('0x13')]('/:id',controller['update']);router[_0x31c1('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x31c1('0x14')]);router[_0x31c1('0x13')]('/:id/reject',auth[_0x31c1('0x9')](),controller[_0x31c1('0x15')]);router[_0x31c1('0x16')](_0x31c1('0xd'),auth[_0x31c1('0x9')](),controller['destroy']);module[_0x31c1('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 55c2ad3..ac87ddc 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x315855,_0x3c86b6){var _0x2bfb60=function(_0x17f486){while(--_0x17f486){_0x315855['push'](_0x315855['shift']());}};_0x2bfb60(++_0x3c86b6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x0b0e[_0x478414];return _0x5eb6b9;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8dce84c..35847a0 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x198142,_0x3db6a9){var _0x41c75c=function(_0x39e459){while(--_0x39e459){_0x198142['push'](_0x198142['shift']());}};_0x41c75c(++_0x3db6a9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x26368d,_0x51d04d){var _0x336739=function(_0x1eed79){while(--_0x1eed79){_0x26368d['push'](_0x26368d['shift']());}};_0x336739(++_0x51d04d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 4891813..b0d7254 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x954a=['save','update','emit','hook','events','ChatOfflineMessage','setMaxListeners'];(function(_0x5bd112,_0xb078a4){var _0x480d09=function(_0xb912d8){while(--_0xb912d8){_0x5bd112['push'](_0x5bd112['shift']());}};_0x480d09(++_0xb078a4);}(_0x954a,0x66));var _0xa954=function(_0x45abd4,_0x888b10){_0x45abd4=_0x45abd4-0x0;var _0x243c9c=_0x954a[_0x45abd4];return _0x243c9c;};'use strict';var EventEmitter=require(_0xa954('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xa954('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa954('0x2')](0x0);var events={'afterCreate':_0xa954('0x3'),'afterUpdate':_0xa954('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43abfc){return function(_0x4ed3d9,_0x14bd69,_0x17aa7b){ChatOfflineMessageEvents[_0xa954('0x5')](_0x43abfc+':'+_0x4ed3d9['id'],_0x4ed3d9);ChatOfflineMessageEvents[_0xa954('0x5')](_0x43abfc,_0x4ed3d9);_0x17aa7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xa954('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc039=['emit','hasOwnProperty','exports','../../mysqldb','remove'];(function(_0x54e5b0,_0x2a0cde){var _0x32761f=function(_0x24011f){while(--_0x24011f){_0x54e5b0['push'](_0x54e5b0['shift']());}};_0x32761f(++_0x2a0cde);}(_0xc039,0x19d));var _0x9c03=function(_0xcef73f,_0x595c46){_0xcef73f=_0xcef73f-0x0;var _0x36f839=_0xc039[_0xcef73f];return _0x36f839;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9c03('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c03('0x1')};function emitEvent(_0x2e6d2f){return function(_0x104bbd,_0xfd5178,_0x30d60d){ChatOfflineMessageEvents['emit'](_0x2e6d2f+':'+_0x104bbd['id'],_0x104bbd);ChatOfflineMessageEvents[_0x9c03('0x2')](_0x2e6d2f,_0x104bbd);_0x30d60d(null);};}for(var e in events){if(events[_0x9c03('0x3')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x9c03('0x4')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index d8049d6..9ac1ae9 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 _0x4b62=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage','utf8mb4'];(function(_0x2123b0,_0x23a59d){var _0x32f000=function(_0x390a4d){while(--_0x390a4d){_0x2123b0['push'](_0x2123b0['shift']());}};_0x32f000(++_0x23a59d);}(_0x4b62,0xd9));var _0x24b6=function(_0x159f56,_0x96204c){_0x159f56=_0x159f56-0x0;var _0x1042eb=_0x4b62[_0x159f56];return _0x1042eb;};'use strict';var attributes=require(_0x24b6('0x0'));module['exports']=function(_0x16a8d9){return _0x16a8d9['define'](_0x24b6('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24b6('0x2'),'collate':_0x24b6('0x3')});}; \ No newline at end of file +var _0x81ea=['exports','define','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x81ea,0x1b2));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var attributes=require(_0xa81e('0x0'));module[_0xa81e('0x1')]=function(_0x28a799){return _0x28a799[_0xa81e('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xa81e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa81e('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ca046b4..7350f02 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 _0x68c6=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2c21fc,_0x4afc78){var _0x2adcef=function(_0x55a58b){while(--_0x55a58b){_0x2c21fc['push'](_0x2c21fc['shift']());}};_0x2adcef(++_0x4afc78);}(_0x68c6,0x137));var _0x668c=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x68c6[_0x54a9e3];return _0x247cce;};'use strict';var _=require('lodash');var util=require(_0x668c('0x0'));var moment=require(_0x668c('0x1'));var BPromise=require(_0x668c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x668c('0x3'));var logger=require(_0x668c('0x4'))(_0x668c('0x5'));var config=require(_0x668c('0x6'));var jayson=require(_0x668c('0x7'));var client=jayson['client'][_0x668c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3420d5,_0x3c4f87,_0x44b279){return new BPromise(function(_0x483ef6,_0x29758b){return client['request'](_0x3420d5,_0x44b279)[_0x668c('0x9')](function(_0x5ba1b8){logger[_0x668c('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3c4f87,_0x668c('0xb'));logger[_0x668c('0xc')](_0x668c('0xd'),_0x3c4f87,_0x668c('0xb'),JSON[_0x668c('0xe')](_0x5ba1b8));if(_0x5ba1b8[_0x668c('0xf')]){if(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x10')]===0x1f4){logger['error'](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);return _0x29758b(_0x5ba1b8['error'][_0x668c('0x12')]);}logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8['error']['message']);return _0x483ef6(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);}else{logger[_0x668c('0xa')](_0x668c('0x11'),_0x3c4f87,_0x668c('0xb'));_0x483ef6(_0x5ba1b8['result'][_0x668c('0x12')]);}})[_0x668c('0x13')](function(_0x1cdb1d){logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x1cdb1d);_0x29758b(_0x1cdb1d);});});} \ No newline at end of file +var _0x66dd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x45c572,_0x34ac34){var _0x53888f=function(_0x2988b2){while(--_0x2988b2){_0x45c572['push'](_0x45c572['shift']());}};_0x53888f(++_0x34ac34);}(_0x66dd,0xb8));var _0xd66d=function(_0x1c3fbd,_0x2a5a2d){_0x1c3fbd=_0x1c3fbd-0x0;var _0x2082ec=_0x66dd[_0x1c3fbd];return _0x2082ec;};'use strict';var _=require('lodash');var util=require(_0xd66d('0x0'));var moment=require(_0xd66d('0x1'));var BPromise=require(_0xd66d('0x2'));var rs=require(_0xd66d('0x3'));var fs=require('fs');var Redis=require(_0xd66d('0x4'));var db=require(_0xd66d('0x5'))['db'];var utils=require(_0xd66d('0x6'));var logger=require('../../config/logger')(_0xd66d('0x7'));var config=require(_0xd66d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd66d('0x9')][_0xd66d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40432c,_0x1bfd1c,_0x5c631c){return new BPromise(function(_0x4d2723,_0x174b22){return client[_0xd66d('0xb')](_0x40432c,_0x5c631c)[_0xd66d('0xc')](function(_0x5b5651){logger[_0xd66d('0xd')](_0xd66d('0xe'),_0x1bfd1c,'request\x20sent');logger[_0xd66d('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1bfd1c,_0xd66d('0x10'),JSON[_0xd66d('0x11')](_0x5b5651));if(_0x5b5651[_0xd66d('0x12')]){if(_0x5b5651[_0xd66d('0x12')][_0xd66d('0x13')]===0x1f4){logger[_0xd66d('0x12')](_0xd66d('0xe'),_0x1bfd1c,_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);return _0x174b22(_0x5b5651['error'][_0xd66d('0x14')]);}logger['error'](_0xd66d('0xe'),_0x1bfd1c,_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);return _0x4d2723(_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);}else{logger[_0xd66d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1bfd1c,_0xd66d('0x10'));_0x4d2723(_0x5b5651[_0xd66d('0x15')][_0xd66d('0x14')]);}})[_0xd66d('0x16')](function(_0x3ea3f7){logger['error'](_0xd66d('0xe'),_0x1bfd1c,_0x3ea3f7);_0x174b22(_0x3ea3f7);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e1218dc..3fa3310 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 _0xfc0d=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x58aad3,_0x2a1647){var _0x2618d9=function(_0x3b760a){while(--_0x3b760a){_0x58aad3['push'](_0x58aad3['shift']());}};_0x2618d9(++_0x2a1647);}(_0xfc0d,0xe9));var _0xdfc0=function(_0x5cb29e,_0x237e9d){_0x5cb29e=_0x5cb29e-0x0;var _0x462274=_0xfc0d[_0x5cb29e];return _0x462274;};'use strict';var multer=require(_0xdfc0('0x0'));var util=require(_0xdfc0('0x1'));var path=require(_0xdfc0('0x2'));var timeout=require('connect-timeout');var express=require(_0xdfc0('0x3'));var router=express[_0xdfc0('0x4')]();var fs_extra=require(_0xdfc0('0x5'));var auth=require(_0xdfc0('0x6'));var interaction=require(_0xdfc0('0x7'));var config=require(_0xdfc0('0x8'));var controller=require(_0xdfc0('0x9'));router[_0xdfc0('0xa')]('/',auth[_0xdfc0('0xb')](),controller[_0xdfc0('0xc')]);router['get']('/describe',auth[_0xdfc0('0xb')](),controller['describe']);router[_0xdfc0('0xa')](_0xdfc0('0xd'),auth[_0xdfc0('0xb')](),controller[_0xdfc0('0xe')]);router[_0xdfc0('0xf')]('/',auth[_0xdfc0('0xb')](),controller['create']);router[_0xdfc0('0x10')]('/:id',auth[_0xdfc0('0xb')](),controller[_0xdfc0('0x11')]);router[_0xdfc0('0x12')]('/:id',auth[_0xdfc0('0xb')](),controller[_0xdfc0('0x13')]);module[_0xdfc0('0x14')]=router; \ No newline at end of file +var _0x71e3=['describe','/:id','show','create','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x71e3,0x150));var _0x371e=function(_0x4ebb6f,_0x49b0ee){_0x4ebb6f=_0x4ebb6f-0x0;var _0x552ccd=_0x71e3[_0x4ebb6f];return _0x552ccd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x371e('0x0'));var timeout=require(_0x371e('0x1'));var express=require(_0x371e('0x2'));var router=express[_0x371e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x371e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x371e('0x5'));router[_0x371e('0x6')]('/',auth[_0x371e('0x7')](),controller['index']);router[_0x371e('0x6')](_0x371e('0x8'),auth[_0x371e('0x7')](),controller[_0x371e('0x9')]);router['get'](_0x371e('0xa'),auth[_0x371e('0x7')](),controller[_0x371e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x371e('0xc')]);router['put']('/:id',auth[_0x371e('0x7')](),controller['update']);router[_0x371e('0xd')]('/:id',auth[_0x371e('0x7')](),controller['destroy']);module[_0x371e('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2482e32..0a7c17c 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 _0x2595=['exports','ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x2595,0xf4));var _0x5259=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x2595[_0x3f8759];return _0x2d33ca;};'use strict';var Sequelize=require(_0x5259('0x0'));module[_0x5259('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5259('0x2')](_0x5259('0x3'),_0x5259('0x4')),'defaultValue':_0x5259('0x3')},'selector':{'type':Sequelize[_0x5259('0x5')]},'timeout':{'type':Sequelize[_0x5259('0x6')]}}; \ No newline at end of file +var _0xa569=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x589bad,_0x391d31){var _0x2fea56=function(_0x9aafbe){while(--_0x9aafbe){_0x589bad['push'](_0x589bad['shift']());}};_0x2fea56(++_0x391d31);}(_0xa569,0x137));var _0x9a56=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xa569[_0x4314d7];return _0x5c599b;};'use strict';var Sequelize=require(_0x9a56('0x0'));module[_0x9a56('0x1')]={'name':{'type':Sequelize[_0x9a56('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a56('0x3')](_0x9a56('0x4'),_0x9a56('0x5')),'defaultValue':_0x9a56('0x4')},'selector':{'type':Sequelize[_0x9a56('0x2')]},'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 8f791d8..1bb2474 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 _0xb6f1=['eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','destroy','then','stack','send','show','params','model','keys','rawAttributes','filters','intersection','query','attributes','fields','length','include','merge','options','ChatProactiveAction','catch','create','body','find'];(function(_0x41f537,_0x356716){var _0x140b28=function(_0x199957){while(--_0x199957){_0x41f537['push'](_0x41f537['shift']());}};_0x140b28(++_0x356716);}(_0xb6f1,0x118));var _0x1b6f=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xb6f1[_0xdeefbd];return _0x4ff63f;};'use strict';var emlformat=require(_0x1b6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b6f('0x2'));var moment=require(_0x1b6f('0x3'));var BPromise=require(_0x1b6f('0x4'));var Mustache=require('mustache');var util=require(_0x1b6f('0x5'));var path=require('path');var sox=require(_0x1b6f('0x6'));var csv=require(_0x1b6f('0x7'));var ejs=require(_0x1b6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1b6f('0x9'));var crypto=require(_0x1b6f('0xa'));var jsforce=require(_0x1b6f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b6f('0x7'));var querystring=require(_0x1b6f('0xc'));var Papa=require('papaparse');var Redis=require(_0x1b6f('0xd'));var authService=require(_0x1b6f('0xe'));var qs=require(_0x1b6f('0xf'));var as=require(_0x1b6f('0x10'));var hardwareService=require(_0x1b6f('0x11'));var logger=require(_0x1b6f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1b6f('0x13'));var licenseUtil=require(_0x1b6f('0x14'));var db=require(_0x1b6f('0x15'))['db'];function respondWithStatusCode(_0x2ec009,_0x213a23){_0x213a23=_0x213a23||0xcc;return function(_0x19c1a9){if(_0x19c1a9){return _0x2ec009[_0x1b6f('0x16')](_0x213a23);}return _0x2ec009[_0x1b6f('0x17')](_0x213a23)[_0x1b6f('0x18')]();};}function respondWithResult(_0x433889,_0x3a8364){_0x3a8364=_0x3a8364||0xc8;return function(_0x195740){if(_0x195740){return _0x433889[_0x1b6f('0x17')](_0x3a8364)[_0x1b6f('0x19')](_0x195740);}};}function respondWithFilteredResult(_0x39c048,_0x283bd4){return function(_0x2c4d44){if(_0x2c4d44){var _0x3a3b48=typeof _0x283bd4[_0x1b6f('0x1a')]===_0x1b6f('0x1b')&&typeof _0x283bd4['limit']==='undefined';var _0x214184=_0x2c4d44[_0x1b6f('0x1c')];var _0x1cdf6e=_0x3a3b48?0x0:_0x283bd4[_0x1b6f('0x1a')];var _0x437798=_0x3a3b48?_0x2c4d44[_0x1b6f('0x1c')]:_0x283bd4[_0x1b6f('0x1a')]+_0x283bd4['limit'];var _0x1b7fb5;if(_0x437798>=_0x214184){_0x437798=_0x214184;_0x1b7fb5=0xc8;}else{_0x1b7fb5=0xce;}_0x39c048[_0x1b6f('0x17')](_0x1b7fb5);return _0x39c048[_0x1b6f('0x1d')]('Content-Range',_0x1cdf6e+'-'+_0x437798+'/'+_0x214184)[_0x1b6f('0x19')](_0x2c4d44);}return null;};}function patchUpdates(_0x1ea885){return function(_0x43121d){try{jsonpatch['apply'](_0x43121d,_0x1ea885,!![]);}catch(_0x32dc20){return BPromise[_0x1b6f('0x1e')](_0x32dc20);}return _0x43121d[_0x1b6f('0x1f')]();};}function saveUpdates(_0x419d93,_0x8e95df){return function(_0x1a8996){if(_0x1a8996){return _0x1a8996[_0x1b6f('0x20')](_0x419d93)['then'](function(_0x24d551){return _0x24d551;});}return null;};}function removeEntity(_0x4c236c,_0x2345db){return function(_0x375f4f){if(_0x375f4f){return _0x375f4f[_0x1b6f('0x21')]()[_0x1b6f('0x22')](function(){_0x4c236c[_0x1b6f('0x17')](0xcc)[_0x1b6f('0x18')]();});}};}function handleEntityNotFound(_0x39eb93,_0x163933){return function(_0x13486f){if(!_0x13486f){_0x39eb93['sendStatus'](0x194);}return _0x13486f;};}function handleError(_0x428187,_0x5a490b){_0x5a490b=_0x5a490b||0x1f4;return function(_0x15b953){logger['error'](_0x15b953[_0x1b6f('0x23')]);if(_0x15b953['name']){delete _0x15b953['name'];}_0x428187[_0x1b6f('0x17')](_0x5a490b)[_0x1b6f('0x24')](_0x15b953);};}exports[_0x1b6f('0x25')]=function(_0xe8b510,_0x42d2b3){var _0x3a566={'raw':!![],'where':{'id':_0xe8b510[_0x1b6f('0x26')]['id']}},_0x9483ef={};_0x9483ef[_0x1b6f('0x27')]=_[_0x1b6f('0x28')](db['ChatProactiveAction'][_0x1b6f('0x29')]);_0x9483ef['query']=_['keys'](_0xe8b510['query']);_0x9483ef[_0x1b6f('0x2a')]=_[_0x1b6f('0x2b')](_0x9483ef[_0x1b6f('0x27')],_0x9483ef[_0x1b6f('0x2c')]);_0x3a566[_0x1b6f('0x2d')]=_['intersection'](_0x9483ef['model'],qs[_0x1b6f('0x2e')](_0xe8b510[_0x1b6f('0x2c')][_0x1b6f('0x2e')]));_0x3a566[_0x1b6f('0x2d')]=_0x3a566[_0x1b6f('0x2d')][_0x1b6f('0x2f')]?_0x3a566['attributes']:_0x9483ef[_0x1b6f('0x27')];if(_0xe8b510[_0x1b6f('0x2c')]['includeAll']){_0x3a566[_0x1b6f('0x30')]=[{'all':!![]}];}_0x3a566=_[_0x1b6f('0x31')]({},_0x3a566,_0xe8b510[_0x1b6f('0x32')]);return db[_0x1b6f('0x33')]['find'](_0x3a566)[_0x1b6f('0x22')](handleEntityNotFound(_0x42d2b3,null))[_0x1b6f('0x22')](respondWithResult(_0x42d2b3,null))[_0x1b6f('0x34')](handleError(_0x42d2b3,null));};exports[_0x1b6f('0x35')]=function(_0x2ed7a2,_0x4c135f){return db[_0x1b6f('0x33')][_0x1b6f('0x35')](_0x2ed7a2[_0x1b6f('0x36')],{})[_0x1b6f('0x22')](respondWithResult(_0x4c135f,0xc9))['catch'](handleError(_0x4c135f,null));};exports[_0x1b6f('0x20')]=function(_0x49c141,_0x4f1459){if(_0x49c141[_0x1b6f('0x36')]['id']){delete _0x49c141[_0x1b6f('0x36')]['id'];}return db[_0x1b6f('0x33')][_0x1b6f('0x37')]({'where':{'id':_0x49c141['params']['id']}})['then'](handleEntityNotFound(_0x4f1459,null))['then'](saveUpdates(_0x49c141[_0x1b6f('0x36')],null))['then'](respondWithResult(_0x4f1459,null))[_0x1b6f('0x34')](handleError(_0x4f1459,null));};exports[_0x1b6f('0x21')]=function(_0x58cc42,_0x5728d8){return db['ChatProactiveAction']['find']({'where':{'id':_0x58cc42[_0x1b6f('0x26')]['id']}})['then'](handleEntityNotFound(_0x5728d8,null))[_0x1b6f('0x22')](removeEntity(_0x5728d8,null))[_0x1b6f('0x34')](handleError(_0x5728d8,null));}; \ No newline at end of file +var _0x1af5=['destroy','sendStatus','error','stack','name','send','params','model','ChatProactiveAction','keys','query','filters','intersection','attributes','includeAll','options','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x1af5,0x17d));var _0x51af=function(_0x18c5a5,_0x526d6f){_0x18c5a5=_0x18c5a5-0x0;var _0x8be903=_0x1af5[_0x18c5a5];return _0x8be903;};'use strict';var emlformat=require(_0x51af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51af('0x1'));var jsonpatch=require(_0x51af('0x2'));var rp=require(_0x51af('0x3'));var moment=require(_0x51af('0x4'));var BPromise=require(_0x51af('0x5'));var Mustache=require(_0x51af('0x6'));var util=require(_0x51af('0x7'));var path=require(_0x51af('0x8'));var sox=require(_0x51af('0x9'));var csv=require(_0x51af('0xa'));var ejs=require(_0x51af('0xb'));var fs=require('fs');var fs_extra=require(_0x51af('0xc'));var _=require(_0x51af('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x51af('0xa'));var querystring=require(_0x51af('0xf'));var Papa=require(_0x51af('0x10'));var Redis=require(_0x51af('0x11'));var authService=require(_0x51af('0x12'));var qs=require(_0x51af('0x13'));var as=require(_0x51af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51af('0x15'))(_0x51af('0x16'));var utils=require(_0x51af('0x17'));var config=require(_0x51af('0x18'));var licenseUtil=require(_0x51af('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb29b4,_0x50b48d){_0x50b48d=_0x50b48d||0xcc;return function(_0x24eca2){if(_0x24eca2){return _0xeb29b4['sendStatus'](_0x50b48d);}return _0xeb29b4[_0x51af('0x1a')](_0x50b48d)[_0x51af('0x1b')]();};}function respondWithResult(_0x85a6ba,_0x5d5d40){_0x5d5d40=_0x5d5d40||0xc8;return function(_0x432a5d){if(_0x432a5d){return _0x85a6ba[_0x51af('0x1a')](_0x5d5d40)[_0x51af('0x1c')](_0x432a5d);}};}function respondWithFilteredResult(_0x3a5414,_0x51f544){return function(_0x32ea74){if(_0x32ea74){var _0x255e7e=typeof _0x51f544[_0x51af('0x1d')]==='undefined'&&typeof _0x51f544['limit']===_0x51af('0x1e');var _0x1f1592=_0x32ea74[_0x51af('0x1f')];var _0x5ecc27=_0x255e7e?0x0:_0x51f544[_0x51af('0x1d')];var _0x1b86f0=_0x255e7e?_0x32ea74[_0x51af('0x1f')]:_0x51f544[_0x51af('0x1d')]+_0x51f544[_0x51af('0x20')];var _0x23d8df;if(_0x1b86f0>=_0x1f1592){_0x1b86f0=_0x1f1592;_0x23d8df=0xc8;}else{_0x23d8df=0xce;}_0x3a5414[_0x51af('0x1a')](_0x23d8df);return _0x3a5414[_0x51af('0x21')](_0x51af('0x22'),_0x5ecc27+'-'+_0x1b86f0+'/'+_0x1f1592)['json'](_0x32ea74);}return null;};}function patchUpdates(_0x530861){return function(_0x733b3b){try{jsonpatch[_0x51af('0x23')](_0x733b3b,_0x530861,!![]);}catch(_0x233e9e){return BPromise[_0x51af('0x24')](_0x233e9e);}return _0x733b3b[_0x51af('0x25')]();};}function saveUpdates(_0x4962a9,_0x31f4c0){return function(_0x5a7360){if(_0x5a7360){return _0x5a7360['update'](_0x4962a9)[_0x51af('0x26')](function(_0x58f227){return _0x58f227;});}return null;};}function removeEntity(_0x81d1b1,_0x5efc62){return function(_0x5e47d3){if(_0x5e47d3){return _0x5e47d3[_0x51af('0x27')]()['then'](function(){_0x81d1b1['status'](0xcc)[_0x51af('0x1b')]();});}};}function handleEntityNotFound(_0x4e771f,_0x3f725a){return function(_0x152ebd){if(!_0x152ebd){_0x4e771f[_0x51af('0x28')](0x194);}return _0x152ebd;};}function handleError(_0x2de497,_0x4d81f9){_0x4d81f9=_0x4d81f9||0x1f4;return function(_0x1320a8){logger[_0x51af('0x29')](_0x1320a8[_0x51af('0x2a')]);if(_0x1320a8[_0x51af('0x2b')]){delete _0x1320a8[_0x51af('0x2b')];}_0x2de497[_0x51af('0x1a')](_0x4d81f9)[_0x51af('0x2c')](_0x1320a8);};}exports['show']=function(_0x203d49,_0x1ba74d){var _0x3eb45c={'raw':!![],'where':{'id':_0x203d49[_0x51af('0x2d')]['id']}},_0x31891e={};_0x31891e[_0x51af('0x2e')]=_['keys'](db[_0x51af('0x2f')]['rawAttributes']);_0x31891e['query']=_[_0x51af('0x30')](_0x203d49[_0x51af('0x31')]);_0x31891e[_0x51af('0x32')]=_[_0x51af('0x33')](_0x31891e[_0x51af('0x2e')],_0x31891e[_0x51af('0x31')]);_0x3eb45c['attributes']=_[_0x51af('0x33')](_0x31891e['model'],qs['fields'](_0x203d49[_0x51af('0x31')]['fields']));_0x3eb45c['attributes']=_0x3eb45c['attributes']['length']?_0x3eb45c[_0x51af('0x34')]:_0x31891e[_0x51af('0x2e')];if(_0x203d49[_0x51af('0x31')][_0x51af('0x35')]){_0x3eb45c['include']=[{'all':!![]}];}_0x3eb45c=_['merge']({},_0x3eb45c,_0x203d49[_0x51af('0x36')]);return db[_0x51af('0x2f')][_0x51af('0x37')](_0x3eb45c)[_0x51af('0x26')](handleEntityNotFound(_0x1ba74d,null))[_0x51af('0x26')](respondWithResult(_0x1ba74d,null))[_0x51af('0x38')](handleError(_0x1ba74d,null));};exports[_0x51af('0x39')]=function(_0x57cfb7,_0xf7b110){return db[_0x51af('0x2f')][_0x51af('0x39')](_0x57cfb7[_0x51af('0x3a')],{})['then'](respondWithResult(_0xf7b110,0xc9))[_0x51af('0x38')](handleError(_0xf7b110,null));};exports[_0x51af('0x3b')]=function(_0x4c3596,_0x1c0432){if(_0x4c3596[_0x51af('0x3a')]['id']){delete _0x4c3596[_0x51af('0x3a')]['id'];}return db[_0x51af('0x2f')][_0x51af('0x37')]({'where':{'id':_0x4c3596[_0x51af('0x2d')]['id']}})[_0x51af('0x26')](handleEntityNotFound(_0x1c0432,null))[_0x51af('0x26')](saveUpdates(_0x4c3596[_0x51af('0x3a')],null))[_0x51af('0x26')](respondWithResult(_0x1c0432,null))[_0x51af('0x38')](handleError(_0x1c0432,null));};exports[_0x51af('0x27')]=function(_0x4f160c,_0x43db83){return db[_0x51af('0x2f')][_0x51af('0x37')]({'where':{'id':_0x4f160c[_0x51af('0x2d')]['id']}})[_0x51af('0x26')](handleEntityNotFound(_0x43db83,null))[_0x51af('0x26')](removeEntity(_0x43db83,null))['catch'](handleError(_0x43db83,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 82f22f6..c3e3017 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 _0x7643=['define','ChatProactiveAction','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x94fb76,_0x1f88a0){var _0x246631=function(_0x59c5e0){while(--_0x59c5e0){_0x94fb76['push'](_0x94fb76['shift']());}};_0x246631(++_0x1f88a0);}(_0x7643,0x98));var _0x3764=function(_0x7ecc0,_0x3c5cc5){_0x7ecc0=_0x7ecc0-0x0;var _0x5d016b=_0x7643[_0x7ecc0];return _0x5d016b;};'use strict';var _=require(_0x3764('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3764('0x1'));var moment=require(_0x3764('0x2'));var BPromise=require(_0x3764('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3764('0x4'));var rimraf=require(_0x3764('0x5'));var config=require(_0x3764('0x6'));var attributes=require(_0x3764('0x7'));module['exports']=function(_0x349cc2,_0xf1c899){return _0x349cc2[_0x3764('0x8')](_0x3764('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd004=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20918a,_0x5878e5){var _0x14843f=function(_0x28be32){while(--_0x28be32){_0x20918a['push'](_0x20918a['shift']());}};_0x14843f(++_0x5878e5);}(_0xd004,0xe4));var _0x4d00=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0xd004[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x4d00('0x0'));var util=require('util');var logger=require(_0x4d00('0x1'))(_0x4d00('0x2'));var moment=require(_0x4d00('0x3'));var BPromise=require(_0x4d00('0x4'));var rp=require(_0x4d00('0x5'));var fs=require('fs');var path=require(_0x4d00('0x6'));var rimraf=require(_0x4d00('0x7'));var config=require(_0x4d00('0x8'));var attributes=require(_0x4d00('0x9'));module[_0x4d00('0xa')]=function(_0x721021,_0x2e7a45){return _0x721021[_0x4d00('0xb')](_0x4d00('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index cd4f805..1f51213 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 _0x77d6=['request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x123fa4,_0x187e84){var _0x509fae=function(_0x2e4e4e){while(--_0x2e4e4e){_0x123fa4['push'](_0x123fa4['shift']());}};_0x509fae(++_0x187e84);}(_0x77d6,0x71));var _0x677d=function(_0x18226e,_0x4c502e){_0x18226e=_0x18226e-0x0;var _0x59d69c=_0x77d6[_0x18226e];return _0x59d69c;};'use strict';var _=require(_0x677d('0x0'));var util=require(_0x677d('0x1'));var moment=require(_0x677d('0x2'));var BPromise=require(_0x677d('0x3'));var rs=require(_0x677d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x677d('0x5'));var logger=require(_0x677d('0x6'))(_0x677d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x677d('0x8')][_0x677d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bbcb3,_0x12cad4,_0x15e22c){return new BPromise(function(_0x3ccd2b,_0x21dd66){return client[_0x677d('0xa')](_0x1bbcb3,_0x15e22c)[_0x677d('0xb')](function(_0x3a2672){logger[_0x677d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x12cad4,_0x677d('0xd'));logger['debug'](_0x677d('0xe'),_0x12cad4,'request\x20sent',JSON[_0x677d('0xf')](_0x3a2672));if(_0x3a2672[_0x677d('0x10')]){if(_0x3a2672[_0x677d('0x10')]['code']===0x1f4){logger[_0x677d('0x10')](_0x677d('0x11'),_0x12cad4,_0x3a2672[_0x677d('0x10')]['message']);return _0x21dd66(_0x3a2672[_0x677d('0x10')][_0x677d('0x12')]);}logger[_0x677d('0x10')](_0x677d('0x11'),_0x12cad4,_0x3a2672[_0x677d('0x10')][_0x677d('0x12')]);return _0x3ccd2b(_0x3a2672['error']['message']);}else{logger[_0x677d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x12cad4,_0x677d('0xd'));_0x3ccd2b(_0x3a2672[_0x677d('0x13')][_0x677d('0x12')]);}})[_0x677d('0x14')](function(_0x51276a){logger[_0x677d('0x10')](_0x677d('0x11'),_0x12cad4,_0x51276a);_0x21dd66(_0x51276a);});});} \ No newline at end of file +var _0xdb9b=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request'];(function(_0x2ee1a0,_0x1dabe7){var _0x1ce546=function(_0x68e6dc){while(--_0x68e6dc){_0x2ee1a0['push'](_0x2ee1a0['shift']());}};_0x1ce546(++_0x1dabe7);}(_0xdb9b,0x15e));var _0xbdb9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdb9b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xbdb9('0x0'));var util=require(_0xbdb9('0x1'));var moment=require(_0xbdb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdb9('0x3'));var fs=require('fs');var Redis=require(_0xbdb9('0x4'));var db=require(_0xbdb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb9('0x6'))(_0xbdb9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbdb9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9696,_0x630af3,_0x596580){return new BPromise(function(_0x2d9a43,_0x22ffba){return client[_0xbdb9('0x9')](_0x1f9696,_0x596580)[_0xbdb9('0xa')](function(_0x161d45){logger[_0xbdb9('0xb')](_0xbdb9('0xc'),_0x630af3,_0xbdb9('0xd'));logger[_0xbdb9('0xe')](_0xbdb9('0xf'),_0x630af3,_0xbdb9('0xd'),JSON['stringify'](_0x161d45));if(_0x161d45[_0xbdb9('0x10')]){if(_0x161d45[_0xbdb9('0x10')][_0xbdb9('0x11')]===0x1f4){logger[_0xbdb9('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x630af3,_0x161d45[_0xbdb9('0x10')][_0xbdb9('0x12')]);return _0x22ffba(_0x161d45['error']['message']);}logger[_0xbdb9('0x10')](_0xbdb9('0xc'),_0x630af3,_0x161d45[_0xbdb9('0x10')]['message']);return _0x2d9a43(_0x161d45[_0xbdb9('0x10')]['message']);}else{logger[_0xbdb9('0xb')](_0xbdb9('0xc'),_0x630af3,_0xbdb9('0xd'));_0x2d9a43(_0x161d45[_0xbdb9('0x13')][_0xbdb9('0x12')]);}})['catch'](function(_0x51c595){logger['error'](_0xbdb9('0xc'),_0x630af3,_0x51c595);_0x22ffba(_0x51c595);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e2f867a..cec7af0 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 _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x3e5cd5,_0x58272b){var _0x1b8d19=function(_0x3e216b){while(--_0x3e216b){_0x3e5cd5['push'](_0x3e5cd5['shift']());}};_0x1b8d19(++_0x58272b);}(_0x31f0,0xb7));var _0x031f=function(_0x3c9441,_0x1c844a){_0x3c9441=_0x3c9441-0x0;var _0x33a8b5=_0x31f0[_0x3c9441];return _0x33a8b5;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xcee193,_0x319b69){var _0x51c4be=function(_0x5f4874){while(--_0x5f4874){_0xcee193['push'](_0xcee193['shift']());}};_0x51c4be(++_0x319b69);}(_0xed1f,0x6a));var _0xfed1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xed1f[_0x616290];return _0x453879;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 51b6ce4..72d9d80 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 _0x04f2=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x04f2,0xff));var _0x204f=function(_0x58a5c3,_0x652f13){_0x58a5c3=_0x58a5c3-0x0;var _0x43b037=_0x04f2[_0x58a5c3];return _0x43b037;};'use strict';var Sequelize=require(_0x204f('0x0'));module[_0x204f('0x1')]={'name':{'type':Sequelize[_0x204f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x204f('0x2')]},'timeout':{'type':Sequelize[_0x204f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x204f('0x4')](_0x204f('0x5'),_0x204f('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x05cb=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4500b6,_0x29d34f){var _0x4b957e=function(_0x58a82e){while(--_0x58a82e){_0x4500b6['push'](_0x4500b6['shift']());}};_0x4b957e(++_0x29d34f);}(_0x05cb,0x1b8));var _0xb05c=function(_0x4bc23e,_0x56939a){_0x4bc23e=_0x4bc23e-0x0;var _0x57dc64=_0x05cb[_0x4bc23e];return _0x57dc64;};'use strict';var Sequelize=require(_0xb05c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb05c('0x1')],'unique':_0xb05c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb05c('0x1')]},'timeout':{'type':Sequelize[_0xb05c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb05c('0x4')](_0xb05c('0x5'),_0xb05c('0x6'),_0xb05c('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a66e7c6..bc3d445 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 _0xb2b5=['then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAndCountAll','UserId','chatPause','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./chatQueue.socket','register','client','http','request'];(function(_0x5e4e18,_0x2cc220){var _0x5265b8=function(_0xa530c){while(--_0xa530c){_0x5e4e18['push'](_0x5e4e18['shift']());}};_0x5265b8(++_0x2cc220);}(_0xb2b5,0x106));var _0x5b2b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb2b5[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x5b2b('0x0'));var rimraf=require(_0x5b2b('0x1'));var zipdir=require(_0x5b2b('0x2'));var jsonpatch=require(_0x5b2b('0x3'));var rp=require(_0x5b2b('0x4'));var moment=require(_0x5b2b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5b2b('0x6'));var util=require(_0x5b2b('0x7'));var path=require(_0x5b2b('0x8'));var sox=require('sox');var csv=require(_0x5b2b('0x9'));var ejs=require(_0x5b2b('0xa'));var fs=require('fs');var fs_extra=require(_0x5b2b('0xb'));var _=require(_0x5b2b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b2b('0xd'));var deskjs=require(_0x5b2b('0xe'));var toCsv=require(_0x5b2b('0x9'));var querystring=require(_0x5b2b('0xf'));var Papa=require(_0x5b2b('0x10'));var Redis=require(_0x5b2b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b2b('0x12'));var as=require(_0x5b2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5b2b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5b2b('0x15'));var db=require(_0x5b2b('0x16'))['db'];config['redis']=_[_0x5b2b('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b2b('0x18'))(new Redis(config['redis']));require(_0x5b2b('0x19'))[_0x5b2b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b2b('0x1b')][_0x5b2b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x27a312,_0x4b52fb,_0x1870e6,_0xc57099){return new BPromise(function(_0x4a5f51,_0x47f71b){var _0x5838a3=_0xc57099||client;return _0x5838a3[_0x5b2b('0x1d')](_0x27a312,_0x1870e6)[_0x5b2b('0x1e')](function(_0x3fac11){logger[_0x5b2b('0x1f')](_0x5b2b('0x20'),_0x4b52fb,_0x5b2b('0x21'));logger['debug'](_0x5b2b('0x22'),_0x4b52fb,_0x5b2b('0x21'),JSON[_0x5b2b('0x23')](_0x3fac11));if(_0x3fac11[_0x5b2b('0x24')]){if(_0x3fac11[_0x5b2b('0x24')][_0x5b2b('0x25')]===0x1f4){logger[_0x5b2b('0x24')](_0x5b2b('0x20'),_0x4b52fb,_0x3fac11[_0x5b2b('0x24')][_0x5b2b('0x26')]);return _0x47f71b(_0x3fac11[_0x5b2b('0x24')][_0x5b2b('0x26')]);}logger[_0x5b2b('0x24')](_0x5b2b('0x20'),_0x4b52fb,_0x3fac11[_0x5b2b('0x24')]['message']);return _0x4a5f51(_0x3fac11['error'][_0x5b2b('0x26')]);}else{logger['info'](_0x5b2b('0x20'),_0x4b52fb,_0x5b2b('0x21'));_0x4a5f51(_0x3fac11[_0x5b2b('0x27')][_0x5b2b('0x26')]);}})[_0x5b2b('0x28')](function(_0x4710a7){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4b52fb,_0x4710a7);_0x47f71b(_0x4710a7);});});}function respondWithStatusCode(_0xde606a,_0x2cf7b9){_0x2cf7b9=_0x2cf7b9||0xcc;return function(_0xe8ace4){if(_0xe8ace4){return _0xde606a[_0x5b2b('0x29')](_0x2cf7b9);}return _0xde606a['status'](_0x2cf7b9)[_0x5b2b('0x2a')]();};}function respondWithResult(_0x4022a9,_0x39ba36){_0x39ba36=_0x39ba36||0xc8;return function(_0x5e80b3){if(_0x5e80b3){return _0x4022a9[_0x5b2b('0x2b')](_0x39ba36)[_0x5b2b('0x2c')](_0x5e80b3);}};}function respondWithFilteredResult(_0x2d59d7,_0x5058ce){return function(_0x14746b){if(_0x14746b){var _0x304b26=typeof _0x5058ce[_0x5b2b('0x2d')]===_0x5b2b('0x2e')&&typeof _0x5058ce[_0x5b2b('0x2f')]===_0x5b2b('0x2e');var _0xa78ded=_0x14746b[_0x5b2b('0x30')];var _0x1370a5=_0x304b26?0x0:_0x5058ce[_0x5b2b('0x2d')];var _0x94fc30=_0x304b26?_0x14746b[_0x5b2b('0x30')]:_0x5058ce[_0x5b2b('0x2d')]+_0x5058ce[_0x5b2b('0x2f')];var _0x5164d5;if(_0x94fc30>=_0xa78ded){_0x94fc30=_0xa78ded;_0x5164d5=0xc8;}else{_0x5164d5=0xce;}_0x2d59d7[_0x5b2b('0x2b')](_0x5164d5);return _0x2d59d7[_0x5b2b('0x31')]('Content-Range',_0x1370a5+'-'+_0x94fc30+'/'+_0xa78ded)[_0x5b2b('0x2c')](_0x14746b);}return null;};}function patchUpdates(_0x32a6db){return function(_0x5d4c69){try{jsonpatch[_0x5b2b('0x32')](_0x5d4c69,_0x32a6db,!![]);}catch(_0x50d6b0){return BPromise[_0x5b2b('0x33')](_0x50d6b0);}return _0x5d4c69['save']();};}function saveUpdates(_0x3e6a8d,_0x4b9c2f){return function(_0x12c92c){if(_0x12c92c){return _0x12c92c[_0x5b2b('0x34')](_0x3e6a8d)[_0x5b2b('0x1e')](function(_0x1a5906){return _0x1a5906;});}return null;};}function removeEntity(_0x1fadbf,_0x335539){return function(_0x39cf24){if(_0x39cf24){return _0x39cf24[_0x5b2b('0x35')]()[_0x5b2b('0x1e')](function(){var _0xd8ff97=_0x39cf24['get']({'plain':!![]});var _0x57aaa1=_0x5b2b('0x36');return db[_0x5b2b('0x37')][_0x5b2b('0x35')]({'where':{'type':_0x57aaa1,'resourceId':_0xd8ff97['id']}})[_0x5b2b('0x1e')](function(){return _0x39cf24;});})[_0x5b2b('0x1e')](function(){_0x1fadbf[_0x5b2b('0x2b')](0xcc)[_0x5b2b('0x2a')]();});}};}function handleEntityNotFound(_0xd05180,_0x927224){return function(_0x1e3334){if(!_0x1e3334){_0xd05180[_0x5b2b('0x29')](0x194);}return _0x1e3334;};}function handleError(_0xeb24dc,_0x19f5aa){_0x19f5aa=_0x19f5aa||0x1f4;return function(_0x400543){logger[_0x5b2b('0x24')](_0x400543[_0x5b2b('0x38')]);if(_0x400543[_0x5b2b('0x39')]){delete _0x400543[_0x5b2b('0x39')];}_0xeb24dc['status'](_0x19f5aa)[_0x5b2b('0x3a')](_0x400543);};}exports[_0x5b2b('0x3b')]=function(_0x800a55,_0x3b69f0){var _0x1d28a6={},_0x5d8f3e={},_0xba8768={'count':0x0,'rows':[]};var _0x58d572=_['map'](db[_0x5b2b('0x3c')][_0x5b2b('0x3d')],function(_0xad2737){return{'name':_0xad2737['fieldName'],'type':_0xad2737['type'][_0x5b2b('0x3e')]};});_0x5d8f3e[_0x5b2b('0x3f')]=_[_0x5b2b('0x40')](_0x58d572,_0x5b2b('0x39'));_0x5d8f3e[_0x5b2b('0x41')]=_['keys'](_0x800a55[_0x5b2b('0x41')]);_0x5d8f3e[_0x5b2b('0x42')]=_[_0x5b2b('0x43')](_0x5d8f3e[_0x5b2b('0x3f')],_0x5d8f3e[_0x5b2b('0x41')]);_0x1d28a6[_0x5b2b('0x44')]=_[_0x5b2b('0x43')](_0x5d8f3e['model'],qs[_0x5b2b('0x45')](_0x800a55[_0x5b2b('0x41')][_0x5b2b('0x45')]));_0x1d28a6[_0x5b2b('0x44')]=_0x1d28a6[_0x5b2b('0x44')][_0x5b2b('0x46')]?_0x1d28a6[_0x5b2b('0x44')]:_0x5d8f3e[_0x5b2b('0x3f')];if(!_0x800a55['query'][_0x5b2b('0x47')](_0x5b2b('0x48'))){_0x1d28a6['limit']=qs[_0x5b2b('0x2f')](_0x800a55[_0x5b2b('0x41')][_0x5b2b('0x2f')]);_0x1d28a6[_0x5b2b('0x2d')]=qs[_0x5b2b('0x2d')](_0x800a55[_0x5b2b('0x41')]['offset']);}_0x1d28a6['order']=qs['sort'](_0x800a55['query'][_0x5b2b('0x49')]);_0x1d28a6[_0x5b2b('0x4a')]=qs[_0x5b2b('0x42')](_[_0x5b2b('0x4b')](_0x800a55[_0x5b2b('0x41')],_0x5d8f3e[_0x5b2b('0x42')]),_0x58d572);if(_0x800a55[_0x5b2b('0x41')][_0x5b2b('0x4c')]){_0x1d28a6[_0x5b2b('0x4a')]=_['merge'](_0x1d28a6['where'],{'$or':_[_0x5b2b('0x40')](_0x58d572,function(_0x194580){if(_0x194580[_0x5b2b('0x4d')]!=='VIRTUAL'){var _0x441f41={};_0x441f41[_0x194580['name']]={'$like':'%'+_0x800a55['query'][_0x5b2b('0x4c')]+'%'};return _0x441f41;}})});}_0x1d28a6=_[_0x5b2b('0x4e')]({},_0x1d28a6,_0x800a55[_0x5b2b('0x4f')]);var _0x4977b0={'where':_0x1d28a6['where']};return db[_0x5b2b('0x3c')][_0x5b2b('0x30')](_0x4977b0)['then'](function(_0x50e540){_0xba8768['count']=_0x50e540;if(_0x800a55[_0x5b2b('0x41')][_0x5b2b('0x50')]){_0x1d28a6[_0x5b2b('0x51')]=[{'all':!![]}];}return db[_0x5b2b('0x3c')][_0x5b2b('0x52')](_0x1d28a6);})[_0x5b2b('0x1e')](function(_0x394505){_0xba8768[_0x5b2b('0x53')]=_0x394505;return _0xba8768;})['then'](respondWithFilteredResult(_0x3b69f0,_0x1d28a6))[_0x5b2b('0x28')](handleError(_0x3b69f0,null));};exports['show']=function(_0x1baa27,_0xb6d31e){var _0x25f896={'raw':!![],'where':{'id':_0x1baa27[_0x5b2b('0x54')]['id']}},_0x38397a={};_0x38397a[_0x5b2b('0x3f')]=_['keys'](db[_0x5b2b('0x3c')]['rawAttributes']);_0x38397a[_0x5b2b('0x41')]=_[_0x5b2b('0x55')](_0x1baa27[_0x5b2b('0x41')]);_0x38397a['filters']=_[_0x5b2b('0x43')](_0x38397a[_0x5b2b('0x3f')],_0x38397a[_0x5b2b('0x41')]);_0x25f896[_0x5b2b('0x44')]=_[_0x5b2b('0x43')](_0x38397a['model'],qs[_0x5b2b('0x45')](_0x1baa27[_0x5b2b('0x41')]['fields']));_0x25f896['attributes']=_0x25f896[_0x5b2b('0x44')][_0x5b2b('0x46')]?_0x25f896[_0x5b2b('0x44')]:_0x38397a[_0x5b2b('0x3f')];if(_0x1baa27[_0x5b2b('0x41')][_0x5b2b('0x50')]){_0x25f896['include']=[{'all':!![]}];}_0x25f896=_[_0x5b2b('0x4e')]({},_0x25f896,_0x1baa27['options']);return db[_0x5b2b('0x3c')][_0x5b2b('0x56')](_0x25f896)[_0x5b2b('0x1e')](handleEntityNotFound(_0xb6d31e,null))[_0x5b2b('0x1e')](respondWithResult(_0xb6d31e,null))[_0x5b2b('0x28')](handleError(_0xb6d31e,null));};exports[_0x5b2b('0x57')]=function(_0x317caa,_0x50ded1){return db[_0x5b2b('0x3c')][_0x5b2b('0x57')](_0x317caa[_0x5b2b('0x58')],{})[_0x5b2b('0x1e')](function(_0x16e0e0){var _0x274b0b=_0x317caa[_0x5b2b('0x59')][_0x5b2b('0x5a')]({'plain':!![]});if(!_0x274b0b)throw new Error(_0x5b2b('0x5b'));if(_0x274b0b[_0x5b2b('0x5c')]==='user'){var _0x4725fc=_0x16e0e0['get']({'plain':!![]});var _0x103200=_0x5b2b('0x36');return db[_0x5b2b('0x5d')][_0x5b2b('0x56')]({'where':{'name':_0x103200,'userProfileId':_0x274b0b[_0x5b2b('0x5e')]},'raw':!![]})[_0x5b2b('0x1e')](function(_0x50d219){if(_0x50d219&&_0x50d219['autoAssociation']===0x0){return db[_0x5b2b('0x37')]['create']({'name':_0x4725fc['name'],'resourceId':_0x4725fc['id'],'type':_0x50d219['name'],'sectionId':_0x50d219['id']},{})['then'](function(){return _0x16e0e0;});}else{return _0x16e0e0;}})[_0x5b2b('0x28')](function(_0x3168e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3168e5);throw _0x3168e5;});}return _0x16e0e0;})[_0x5b2b('0x1e')](respondWithResult(_0x50ded1,0xc9))[_0x5b2b('0x28')](handleError(_0x50ded1,null));};exports[_0x5b2b('0x34')]=function(_0x4ed97d,_0x46b953){if(_0x4ed97d['body']['id']){delete _0x4ed97d[_0x5b2b('0x58')]['id'];}return db[_0x5b2b('0x3c')][_0x5b2b('0x56')]({'where':{'id':_0x4ed97d['params']['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x46b953,null))['then'](saveUpdates(_0x4ed97d[_0x5b2b('0x58')],null))['then'](respondWithResult(_0x46b953,null))['catch'](handleError(_0x46b953,null));};exports[_0x5b2b('0x35')]=function(_0x4bf4c4,_0x4f50ce){return db[_0x5b2b('0x3c')][_0x5b2b('0x56')]({'where':{'id':_0x4bf4c4[_0x5b2b('0x54')]['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x4f50ce,null))[_0x5b2b('0x1e')](removeEntity(_0x4f50ce,null))['catch'](handleError(_0x4f50ce,null));};exports[_0x5b2b('0x5f')]=function(_0x58565f,_0x2dd770){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x2dd770,null))[_0x5b2b('0x28')](handleError(_0x2dd770,null));};exports[_0x5b2b('0x60')]=function(_0x39ca85,_0x4b138b,_0x4bac1b){var _0xd78ac3={'raw':!![],'where':{}},_0x1da458={},_0x51100f;return db[_0x5b2b('0x3c')][_0x5b2b('0x61')]({'where':{'id':_0x39ca85[_0x5b2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b138b,null))[_0x5b2b('0x1e')](function(_0x4bd90c){if(_0x4bd90c){_0x51100f=_0x4bd90c['get']({'plain':!![]});_0x1da458[_0x5b2b('0x3f')]=_[_0x5b2b('0x55')](db[_0x5b2b('0x62')]['rawAttributes']);_0x1da458['query']=_[_0x5b2b('0x55')](_0x39ca85[_0x5b2b('0x41')]);_0x1da458[_0x5b2b('0x42')]=_[_0x5b2b('0x43')](_0x1da458[_0x5b2b('0x3f')],_0x1da458['query']);_0xd78ac3[_0x5b2b('0x44')]=_[_0x5b2b('0x43')](_0x1da458[_0x5b2b('0x3f')],qs[_0x5b2b('0x45')](_0x39ca85['query']['fields']));_0xd78ac3[_0x5b2b('0x44')]=_0xd78ac3[_0x5b2b('0x44')][_0x5b2b('0x46')]?_0xd78ac3[_0x5b2b('0x44')]:_0x1da458[_0x5b2b('0x3f')];if(!_0x39ca85[_0x5b2b('0x41')][_0x5b2b('0x47')](_0x5b2b('0x48'))){_0xd78ac3['limit']=qs[_0x5b2b('0x2f')](_0x39ca85[_0x5b2b('0x41')]['limit']);_0xd78ac3[_0x5b2b('0x2d')]=qs['offset'](_0x39ca85[_0x5b2b('0x41')][_0x5b2b('0x2d')]);}_0xd78ac3[_0x5b2b('0x63')]=qs[_0x5b2b('0x49')](_0x39ca85['query'][_0x5b2b('0x49')]);_0xd78ac3[_0x5b2b('0x4a')]=qs['filters'](_[_0x5b2b('0x4b')](_0x39ca85[_0x5b2b('0x41')],_0x1da458[_0x5b2b('0x42')]));_0xd78ac3['where'][_0x5b2b('0x64')]=_0x4bd90c['id'];if(_0x39ca85[_0x5b2b('0x41')][_0x5b2b('0x4c')]){_0xd78ac3[_0x5b2b('0x4a')]=_[_0x5b2b('0x4e')](_0xd78ac3[_0x5b2b('0x4a')],{'$or':_[_0x5b2b('0x40')](_0xd78ac3[_0x5b2b('0x44')],function(_0x2eba9b){var _0x5561d5={};_0x5561d5[_0x2eba9b]={'$like':'%'+_0x39ca85[_0x5b2b('0x41')][_0x5b2b('0x4c')]+'%'};return _0x5561d5;})});}_0xd78ac3=_[_0x5b2b('0x4e')]({},_0xd78ac3,_0x39ca85['options']);return db[_0x5b2b('0x62')][_0x5b2b('0x52')](_0xd78ac3);}})[_0x5b2b('0x1e')](function(_0x4719bc){if(_0x4719bc){return db['User'][_0x5b2b('0x65')]({'where':{'id':_['map'](_0x4719bc,_0x5b2b('0x66')),'role':'agent'},'attributes':['id',_0x5b2b('0x39'),_0x5b2b('0x67'),_0x5b2b('0x68'),'createdAt']});}})[_0x5b2b('0x1e')](function(_0x251f2a){if(_0x251f2a){return{'count':_0x251f2a['count'],'rows':_[_0x5b2b('0x40')](_0x251f2a[_0x5b2b('0x53')],function(_0x4ac726){return{'membername':_0x4ac726[_0x5b2b('0x39')],'UserId':_0x4ac726['id'],'queue_name':_0x51100f[_0x5b2b('0x39')],'ChatQueueId':_0x51100f['id'],'interface':util[_0x5b2b('0x69')](_0x5b2b('0x6a'),_0x5b2b('0x6b'),_0x4ac726[_0x5b2b('0x39')]),'penalty':0x0,'paused':_0x4ac726[_0x5b2b('0x67')],'createdAt':_0x4ac726['createdAt'],'updatedAt':_0x4ac726[_0x5b2b('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b2b('0x1e')](respondWithFilteredResult(_0x4b138b,_0xd78ac3))['catch'](handleError(_0x4b138b,null));};exports[_0x5b2b('0x6c')]=function(_0x1ffceb,_0x5bdfe1,_0x4f5270){var _0x35fe40={};var _0x4876da={};var _0x2e72fe;var _0x2a3dd6;return db[_0x5b2b('0x3c')][_0x5b2b('0x61')]({'where':{'id':_0x1ffceb[_0x5b2b('0x54')]['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x5bdfe1,null))['then'](function(_0x4c7426){if(_0x4c7426){_0x2e72fe=_0x4c7426;_0x4876da[_0x5b2b('0x3f')]=_[_0x5b2b('0x55')](db[_0x5b2b('0x6d')]['rawAttributes']);_0x4876da[_0x5b2b('0x41')]=_[_0x5b2b('0x55')](_0x1ffceb[_0x5b2b('0x41')]);_0x4876da['filters']=_[_0x5b2b('0x43')](_0x4876da[_0x5b2b('0x3f')],_0x4876da[_0x5b2b('0x41')]);_0x35fe40[_0x5b2b('0x44')]=_[_0x5b2b('0x43')](_0x4876da[_0x5b2b('0x3f')],qs['fields'](_0x1ffceb[_0x5b2b('0x41')][_0x5b2b('0x45')]));_0x35fe40[_0x5b2b('0x44')]=_0x35fe40['attributes'][_0x5b2b('0x46')]?_0x35fe40['attributes']:_0x4876da[_0x5b2b('0x3f')];_0x35fe40[_0x5b2b('0x63')]=qs[_0x5b2b('0x49')](_0x1ffceb[_0x5b2b('0x41')]['sort']);_0x35fe40[_0x5b2b('0x4a')]=qs[_0x5b2b('0x42')](_[_0x5b2b('0x4b')](_0x1ffceb[_0x5b2b('0x41')],_0x4876da[_0x5b2b('0x42')]));if(_0x1ffceb['query'][_0x5b2b('0x4c')]){_0x35fe40['where']=_[_0x5b2b('0x4e')](_0x35fe40[_0x5b2b('0x4a')],{'$or':_[_0x5b2b('0x40')](_0x35fe40[_0x5b2b('0x44')],function(_0x399152){var _0x4892c3={};_0x4892c3[_0x399152]={'$like':'%'+_0x1ffceb[_0x5b2b('0x41')][_0x5b2b('0x4c')]+'%'};return _0x4892c3;})});}_0x35fe40=_['merge']({},_0x35fe40,_0x1ffceb[_0x5b2b('0x4f')]);return _0x2e72fe[_0x5b2b('0x6c')](_0x35fe40);}})[_0x5b2b('0x1e')](function(_0x257111){if(_0x257111){_0x2a3dd6=_0x257111['length'];if(!_0x1ffceb[_0x5b2b('0x41')]['hasOwnProperty'](_0x5b2b('0x48'))){_0x35fe40[_0x5b2b('0x2f')]=qs[_0x5b2b('0x2f')](_0x1ffceb[_0x5b2b('0x41')][_0x5b2b('0x2f')]);_0x35fe40[_0x5b2b('0x2d')]=qs[_0x5b2b('0x2d')](_0x1ffceb[_0x5b2b('0x41')][_0x5b2b('0x2d')]);}return _0x2e72fe[_0x5b2b('0x6c')](_0x35fe40);}})[_0x5b2b('0x1e')](function(_0x227825){if(_0x227825){return _0x227825?{'count':_0x2a3dd6,'rows':_0x227825}:null;}})[_0x5b2b('0x1e')](respondWithResult(_0x5bdfe1,null))[_0x5b2b('0x28')](handleError(_0x5bdfe1,null));};exports[_0x5b2b('0x6e')]=function(_0x374f64,_0x56ceee,_0x86397d){var _0x4ecd92=_0x374f64['body'][_0x5b2b('0x6f')];return db[_0x5b2b('0x6d')][_0x5b2b('0x52')]({'where':{'id':_0x4ecd92},'attributes':['id'],'include':[{'model':db[_0x5b2b('0x70')],'as':_0x5b2b('0x71'),'attributes':['id',_0x5b2b('0x39'),_0x5b2b('0x72'),_0x5b2b('0x73'),'interface'],'raw':!![]}]})[_0x5b2b('0x1e')](function(_0xa3725d){if(_0xa3725d){var _0x2b746b=_[_0x5b2b('0x74')](_0xa3725d,function(_0x2be4a0){var _0x560627=_0x2be4a0[_0x5b2b('0x5a')]({'plain':!![]});return _0x560627[_0x5b2b('0x71')];});return db[_0x5b2b('0x3c')][_0x5b2b('0x56')]({'where':{'id':_0x374f64[_0x5b2b('0x54')]['id']}})[_0x5b2b('0x1e')](function(_0x369973){return db[_0x5b2b('0x75')][_0x5b2b('0x76')](function(_0x5aba34){return _0x369973[_0x5b2b('0x6e')](_0x4ecd92,{'transaction':_0x5aba34})['then'](function(){return BPromise[_0x5b2b('0x77')](_0x2b746b,function(_0x31acd2){return db[_0x5b2b('0x62')]['findOrCreate']({'where':{'UserId':_0x31acd2['id'],'ChatQueueId':_0x374f64['params']['id']},'transaction':_0x5aba34});});})[_0x5b2b('0x1e')](function(){_0x2b746b[_0x5b2b('0x78')](function(_0x39a5eb){socket[_0x5b2b('0x79')](_0x5b2b('0x7a'),{'UserId':_0x39a5eb['id'],'ChatQueueId':_0x369973['id']});});});});});}})[_0x5b2b('0x1e')](respondWithStatusCode(_0x56ceee,null))['catch'](handleError(_0x56ceee,null));};exports[_0x5b2b('0x7b')]=function(_0x19f01c,_0x5d1086,_0x5b45ee){return db[_0x5b2b('0x6d')][_0x5b2b('0x52')]({'where':{'id':_0x19f01c['query'][_0x5b2b('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x5b2b('0x70')],'as':_0x5b2b('0x71'),'attributes':['id'],'raw':!![]}]})[_0x5b2b('0x1e')](handleEntityNotFound(_0x5d1086,null))[_0x5b2b('0x1e')](function(_0x5e1f28){var _0x3612e3=_['map'](_0x5e1f28,'id');var _0x4d578d=[];var _0x5b5234=[];var _0x3b354c=squel[_0x5b2b('0x7c')]();_0x3b354c[_0x5b2b('0x7d')](_0x5b2b('0x7e'))[_0x5b2b('0x7f')](_0x5b2b('0x80'),'tq')[_0x5b2b('0x81')]('user_has_teams','ut',_0x5b2b('0x82'))[_0x5b2b('0x4a')](_0x5b2b('0x83'),_0x19f01c[_0x5b2b('0x54')]['id']);for(var _0xc2131=0x0;_0xc2131<_0x5e1f28['length'];_0xc2131+=0x1){let _0x1c16ae=_0x5e1f28[_0xc2131];for(var _0x32b138=0x0;_0x32b138<_0x1c16ae['Agents'][_0x5b2b('0x46')];_0x32b138+=0x1){let _0xbfd517=_0x1c16ae['Agents'][_0x32b138];var _0x42e7bc=_0x3b354c['clone']();_0x42e7bc[_0x5b2b('0x4a')]('ut.UserId\x20=\x20?',_0xbfd517['id']);_0x5b5234['push'](db[_0x5b2b('0x75')][_0x5b2b('0x41')](_0x42e7bc[_0x5b2b('0x84')](),{'type':db['sequelize'][_0x5b2b('0x85')][_0x5b2b('0x86')]})[_0x5b2b('0x1e')](function(_0x32304b){if(_0x32304b[_0x5b2b('0x46')]===0x1){return _0xbfd517['id'];}else{var _0x21216a=_['every'](_[_0x5b2b('0x40')](_0x32304b,'TeamId'),function(_0x5e0ea8){return _[_0x5b2b('0x87')](_0x3612e3,_0x5e0ea8);});if(_0x21216a){return _0xbfd517['id'];}}}));}}return BPromise[_0x5b2b('0x88')](_0x5b5234)[_0x5b2b('0x1e')](function(_0x53146d){_0x4d578d=_(_0x4d578d)['union'](_0x53146d)[_0x5b2b('0x89')]()[_0x5b2b('0x8a')]();return db[_0x5b2b('0x3c')][_0x5b2b('0x56')]({'where':{'id':_0x19f01c['params']['id']}})[_0x5b2b('0x1e')](function(_0x183d14){return db[_0x5b2b('0x75')][_0x5b2b('0x76')](function(_0x2f67ab){return _0x183d14[_0x5b2b('0x7b')](_0x19f01c['query'][_0x5b2b('0x6f')],{'transaction':_0x2f67ab})['then'](function(){if(!_['isEmpty'](_0x4d578d)){return _0x183d14['removeAgents'](_0x4d578d,{'transaction':_0x2f67ab});}})[_0x5b2b('0x1e')](function(){_0x4d578d[_0x5b2b('0x78')](function(_0x5e0be2){socket[_0x5b2b('0x79')](_0x5b2b('0x8b'),{'UserId':_0x5e0be2,'ChatQueueId':_0x183d14['id']});});});});});});})['then'](respondWithStatusCode(_0x5d1086,null))['catch'](handleError(_0x5d1086,null));};exports[_0x5b2b('0x8c')]=function(_0x557144,_0x3a4dbf,_0xbb1024){return db[_0x5b2b('0x3c')]['find']({'where':{'id':_0x557144['params']['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x3a4dbf,null))[_0x5b2b('0x1e')](function(_0x1f5818){if(_0x1f5818){return _0x1f5818['addAgents'](_0x557144['body'][_0x5b2b('0x6f')],_[_0x5b2b('0x8d')](_0x557144['body'],[_0x5b2b('0x6f'),'id'])||{})[_0x5b2b('0x8e')](function(_0x1e6312){for(var _0x504a59=0x0;_0x504a59<_0x557144[_0x5b2b('0x58')]['ids'][_0x5b2b('0x46')];_0x504a59+=0x1){socket[_0x5b2b('0x79')](_0x5b2b('0x7a'),{'UserId':Number(_0x557144[_0x5b2b('0x58')][_0x5b2b('0x6f')][_0x504a59]),'ChatQueueId':Number(_0x557144[_0x5b2b('0x54')]['id'])});}return _0x1e6312;});}})[_0x5b2b('0x1e')](respondWithResult(_0x3a4dbf,null))['catch'](handleError(_0x3a4dbf,null));};exports[_0x5b2b('0x8f')]=function(_0x171166,_0x338b29,_0x56df25){return db['ChatQueue'][_0x5b2b('0x56')]({'where':{'id':_0x171166[_0x5b2b('0x54')]['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x338b29,null))[_0x5b2b('0x1e')](function(_0x1e93a4){if(_0x1e93a4){return _0x1e93a4['removeAgents'](_0x171166['query'][_0x5b2b('0x6f')])['then'](function(){if(_[_0x5b2b('0x90')](_0x171166[_0x5b2b('0x41')][_0x5b2b('0x6f')])){for(var _0x4edb8b=0x0;_0x4edb8b<_0x171166[_0x5b2b('0x41')][_0x5b2b('0x6f')]['length'];_0x4edb8b+=0x1){socket['emit'](_0x5b2b('0x8b'),{'UserId':Number(_0x171166[_0x5b2b('0x41')]['ids'][_0x4edb8b]),'ChatQueueId':Number(_0x171166['params']['id'])});}}else{socket[_0x5b2b('0x79')]('userChatQueue:remove',{'UserId':Number(_0x171166['query'][_0x5b2b('0x6f')]),'ChatQueueId':Number(_0x171166[_0x5b2b('0x54')]['id'])});}});}})[_0x5b2b('0x1e')](respondWithStatusCode(_0x338b29,null))[_0x5b2b('0x28')](handleError(_0x338b29,null));};exports[_0x5b2b('0x91')]=function(_0x2af5fa,_0x583062,_0xdb77d9){var _0x593ed5={};var _0x2f97f5={};var _0x7a5ee3;var _0x2bd1b7;return db[_0x5b2b('0x3c')][_0x5b2b('0x61')]({'where':{'id':_0x2af5fa[_0x5b2b('0x54')]['id']}})[_0x5b2b('0x1e')](handleEntityNotFound(_0x583062,null))[_0x5b2b('0x1e')](function(_0x45b26c){if(_0x45b26c){_0x7a5ee3=_0x45b26c;_0x2f97f5[_0x5b2b('0x3f')]=_[_0x5b2b('0x55')](db['User']['rawAttributes']);_0x2f97f5[_0x5b2b('0x41')]=_[_0x5b2b('0x55')](_0x2af5fa['query']);_0x2f97f5[_0x5b2b('0x42')]=_[_0x5b2b('0x43')](_0x2f97f5[_0x5b2b('0x3f')],_0x2f97f5['query']);_0x593ed5[_0x5b2b('0x44')]=_[_0x5b2b('0x43')](_0x2f97f5[_0x5b2b('0x3f')],qs['fields'](_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x45')]));_0x593ed5[_0x5b2b('0x44')]=_0x593ed5[_0x5b2b('0x44')][_0x5b2b('0x46')]?_0x593ed5['attributes']:_0x2f97f5[_0x5b2b('0x3f')];_0x593ed5[_0x5b2b('0x63')]=qs[_0x5b2b('0x49')](_0x2af5fa['query'][_0x5b2b('0x49')]);_0x593ed5[_0x5b2b('0x4a')]=qs[_0x5b2b('0x42')](_[_0x5b2b('0x4b')](_0x2af5fa[_0x5b2b('0x41')],_0x2f97f5[_0x5b2b('0x42')]));if(_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x4c')]){_0x593ed5[_0x5b2b('0x4a')]=_[_0x5b2b('0x4e')](_0x593ed5[_0x5b2b('0x4a')],{'$or':_[_0x5b2b('0x40')](_0x593ed5[_0x5b2b('0x44')],function(_0x155f14){var _0x520b8d={};_0x520b8d[_0x155f14]={'$like':'%'+_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x4c')]+'%'};return _0x520b8d;})});}_0x593ed5=_['merge']({},_0x593ed5,_0x2af5fa[_0x5b2b('0x4f')]);return _0x7a5ee3[_0x5b2b('0x91')](_0x593ed5);}})[_0x5b2b('0x1e')](function(_0x1102fc){if(_0x1102fc){_0x2bd1b7=_0x1102fc[_0x5b2b('0x46')];if(!_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x47')](_0x5b2b('0x48'))){_0x593ed5[_0x5b2b('0x2f')]=qs[_0x5b2b('0x2f')](_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x2f')]);_0x593ed5[_0x5b2b('0x2d')]=qs[_0x5b2b('0x2d')](_0x2af5fa[_0x5b2b('0x41')][_0x5b2b('0x2d')]);}return _0x7a5ee3['getAgents'](_0x593ed5);}})[_0x5b2b('0x1e')](function(_0x4964cb){if(_0x4964cb){return _0x4964cb?{'count':_0x2bd1b7,'rows':_0x4964cb}:null;}})[_0x5b2b('0x1e')](respondWithResult(_0x583062,null))[_0x5b2b('0x28')](handleError(_0x583062,null));}; \ No newline at end of file +var _0xef58=['ChatQueue,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','update','destroy','then','UserProfileResource','stack','name','send','index','ChatQueue','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','filters','find','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','getMembers','findOne','UserChatQueue','hasOwnProperty','order','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f9723,_0x5318d4){var _0x366986=function(_0x5b798e){while(--_0x5b798e){_0x1f9723['push'](_0x1f9723['shift']());}};_0x366986(++_0x5318d4);}(_0xef58,0x1ae));var _0x8ef5=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xef58[_0x10d670];return _0x20d6f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef5('0x0'));var zipdir=require(_0x8ef5('0x1'));var jsonpatch=require(_0x8ef5('0x2'));var rp=require('request-promise');var moment=require(_0x8ef5('0x3'));var BPromise=require(_0x8ef5('0x4'));var Mustache=require(_0x8ef5('0x5'));var util=require(_0x8ef5('0x6'));var path=require('path');var sox=require(_0x8ef5('0x7'));var csv=require(_0x8ef5('0x8'));var ejs=require(_0x8ef5('0x9'));var fs=require('fs');var fs_extra=require(_0x8ef5('0xa'));var _=require(_0x8ef5('0xb'));var squel=require(_0x8ef5('0xc'));var crypto=require('crypto');var jsforce=require(_0x8ef5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ef5('0xe'));var Redis=require(_0x8ef5('0xf'));var authService=require(_0x8ef5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8ef5('0x11'));var hardwareService=require(_0x8ef5('0x12'));var logger=require('../../config/logger')(_0x8ef5('0x13'));var utils=require(_0x8ef5('0x14'));var config=require(_0x8ef5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ef5('0x16'))['db'];config[_0x8ef5('0x17')]=_[_0x8ef5('0x18')](config[_0x8ef5('0x17')],{'host':_0x8ef5('0x19'),'port':0x18eb});var socket=require(_0x8ef5('0x1a'))(new Redis(config[_0x8ef5('0x17')]));require(_0x8ef5('0x1b'))[_0x8ef5('0x1c')](socket);var jayson=require(_0x8ef5('0x1d'));var client=jayson['client'][_0x8ef5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x45ded9,_0xbf4727,_0x308eb7,_0x1a59ab){return new BPromise(function(_0x315392,_0x894c40){var _0x2550ea=_0x1a59ab||client;return _0x2550ea[_0x8ef5('0x1f')](_0x45ded9,_0x308eb7)['then'](function(_0x8a4000){logger['info']('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x8ef5('0x20'));logger['debug'](_0x8ef5('0x21'),_0xbf4727,_0x8ef5('0x20'),JSON[_0x8ef5('0x22')](_0x8a4000));if(_0x8a4000[_0x8ef5('0x23')]){if(_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x24')]===0x1f4){logger[_0x8ef5('0x23')]('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x8a4000['error'][_0x8ef5('0x25')]);return _0x894c40(_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x25')]);}logger[_0x8ef5('0x23')](_0x8ef5('0x26'),_0xbf4727,_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x25')]);return _0x315392(_0x8a4000[_0x8ef5('0x23')]['message']);}else{logger[_0x8ef5('0x27')](_0x8ef5('0x26'),_0xbf4727,'request\x20sent');_0x315392(_0x8a4000[_0x8ef5('0x28')][_0x8ef5('0x25')]);}})[_0x8ef5('0x29')](function(_0x2256e6){logger[_0x8ef5('0x23')]('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x2256e6);_0x894c40(_0x2256e6);});});}function respondWithStatusCode(_0x17a22e,_0x2ca7be){_0x2ca7be=_0x2ca7be||0xcc;return function(_0x2db10a){if(_0x2db10a){return _0x17a22e[_0x8ef5('0x2a')](_0x2ca7be);}return _0x17a22e[_0x8ef5('0x2b')](_0x2ca7be)[_0x8ef5('0x2c')]();};}function respondWithResult(_0x1619cc,_0x11c4e3){_0x11c4e3=_0x11c4e3||0xc8;return function(_0x280878){if(_0x280878){return _0x1619cc[_0x8ef5('0x2b')](_0x11c4e3)[_0x8ef5('0x2d')](_0x280878);}};}function respondWithFilteredResult(_0x17f1cc,_0x3083a7){return function(_0x49747a){if(_0x49747a){var _0x7d771c=typeof _0x3083a7['offset']==='undefined'&&typeof _0x3083a7[_0x8ef5('0x2e')]===_0x8ef5('0x2f');var _0x412fde=_0x49747a[_0x8ef5('0x30')];var _0x33e5b9=_0x7d771c?0x0:_0x3083a7[_0x8ef5('0x31')];var _0x1e6c6f=_0x7d771c?_0x49747a[_0x8ef5('0x30')]:_0x3083a7['offset']+_0x3083a7[_0x8ef5('0x2e')];var _0x4f58ce;if(_0x1e6c6f>=_0x412fde){_0x1e6c6f=_0x412fde;_0x4f58ce=0xc8;}else{_0x4f58ce=0xce;}_0x17f1cc[_0x8ef5('0x2b')](_0x4f58ce);return _0x17f1cc['set'](_0x8ef5('0x32'),_0x33e5b9+'-'+_0x1e6c6f+'/'+_0x412fde)[_0x8ef5('0x2d')](_0x49747a);}return null;};}function patchUpdates(_0x2096fa){return function(_0x1f9cf9){try{jsonpatch[_0x8ef5('0x33')](_0x1f9cf9,_0x2096fa,!![]);}catch(_0x25e29a){return BPromise['reject'](_0x25e29a);}return _0x1f9cf9['save']();};}function saveUpdates(_0xa8a8ab,_0x23b791){return function(_0x37d33f){if(_0x37d33f){return _0x37d33f[_0x8ef5('0x34')](_0xa8a8ab)['then'](function(_0x44457e){return _0x44457e;});}return null;};}function removeEntity(_0x32eff6,_0x4c87ef){return function(_0x18ad36){if(_0x18ad36){return _0x18ad36[_0x8ef5('0x35')]()[_0x8ef5('0x36')](function(){var _0x59b611=_0x18ad36['get']({'plain':!![]});var _0x10efc9='ChatQueues';return db[_0x8ef5('0x37')][_0x8ef5('0x35')]({'where':{'type':_0x10efc9,'resourceId':_0x59b611['id']}})[_0x8ef5('0x36')](function(){return _0x18ad36;});})[_0x8ef5('0x36')](function(){_0x32eff6[_0x8ef5('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da694,_0x5b8c2b){return function(_0x1177f3){if(!_0x1177f3){_0x5da694[_0x8ef5('0x2a')](0x194);}return _0x1177f3;};}function handleError(_0x400bf4,_0x343d8e){_0x343d8e=_0x343d8e||0x1f4;return function(_0x2186b4){logger[_0x8ef5('0x23')](_0x2186b4[_0x8ef5('0x38')]);if(_0x2186b4[_0x8ef5('0x39')]){delete _0x2186b4[_0x8ef5('0x39')];}_0x400bf4[_0x8ef5('0x2b')](_0x343d8e)[_0x8ef5('0x3a')](_0x2186b4);};}exports[_0x8ef5('0x3b')]=function(_0x52d93b,_0x4bbeae){var _0xdb93e2={},_0x34c821={},_0xbd29f={'count':0x0,'rows':[]};var _0x3497f7=_['map'](db[_0x8ef5('0x3c')]['rawAttributes'],function(_0xa8172c){return{'name':_0xa8172c[_0x8ef5('0x3d')],'type':_0xa8172c[_0x8ef5('0x3e')][_0x8ef5('0x3f')]};});_0x34c821[_0x8ef5('0x40')]=_['map'](_0x3497f7,_0x8ef5('0x39'));_0x34c821['query']=_[_0x8ef5('0x41')](_0x52d93b[_0x8ef5('0x42')]);_0x34c821['filters']=_[_0x8ef5('0x43')](_0x34c821[_0x8ef5('0x40')],_0x34c821[_0x8ef5('0x42')]);_0xdb93e2[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x34c821[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0xdb93e2[_0x8ef5('0x44')]=_0xdb93e2[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0xdb93e2[_0x8ef5('0x44')]:_0x34c821[_0x8ef5('0x40')];if(!_0x52d93b['query']['hasOwnProperty'](_0x8ef5('0x47'))){_0xdb93e2[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0xdb93e2['offset']=qs[_0x8ef5('0x31')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x31')]);}_0xdb93e2['order']=qs[_0x8ef5('0x48')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0xdb93e2['where']=qs['filters'](_['pick'](_0x52d93b[_0x8ef5('0x42')],_0x34c821['filters']),_0x3497f7);if(_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0xdb93e2[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0xdb93e2[_0x8ef5('0x4a')],{'$or':_[_0x8ef5('0x4c')](_0x3497f7,function(_0x3ae6bf){if(_0x3ae6bf[_0x8ef5('0x3e')]!==_0x8ef5('0x4d')){var _0x5303e4={};_0x5303e4[_0x3ae6bf[_0x8ef5('0x39')]]={'$like':'%'+_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x49')]+'%'};return _0x5303e4;}})});}_0xdb93e2=_[_0x8ef5('0x4b')]({},_0xdb93e2,_0x52d93b[_0x8ef5('0x4e')]);var _0x232b8c={'where':_0xdb93e2[_0x8ef5('0x4a')]};return db[_0x8ef5('0x3c')]['count'](_0x232b8c)[_0x8ef5('0x36')](function(_0x353ee0){_0xbd29f[_0x8ef5('0x30')]=_0x353ee0;if(_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x4f')]){_0xdb93e2[_0x8ef5('0x50')]=[{'all':!![]}];}return db[_0x8ef5('0x3c')][_0x8ef5('0x51')](_0xdb93e2);})[_0x8ef5('0x36')](function(_0x49bf57){_0xbd29f[_0x8ef5('0x52')]=_0x49bf57;return _0xbd29f;})['then'](respondWithFilteredResult(_0x4bbeae,_0xdb93e2))[_0x8ef5('0x29')](handleError(_0x4bbeae,null));};exports[_0x8ef5('0x53')]=function(_0x138b2e,_0x5beefb){var _0x5c7406={'raw':!![],'where':{'id':_0x138b2e['params']['id']}},_0x37c2fd={};_0x37c2fd[_0x8ef5('0x40')]=_['keys'](db['ChatQueue'][_0x8ef5('0x54')]);_0x37c2fd[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x138b2e['query']);_0x37c2fd[_0x8ef5('0x55')]=_['intersection'](_0x37c2fd[_0x8ef5('0x40')],_0x37c2fd['query']);_0x5c7406[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x37c2fd[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x138b2e[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x5c7406[_0x8ef5('0x44')]=_0x5c7406['attributes'][_0x8ef5('0x46')]?_0x5c7406[_0x8ef5('0x44')]:_0x37c2fd[_0x8ef5('0x40')];if(_0x138b2e[_0x8ef5('0x42')][_0x8ef5('0x4f')]){_0x5c7406[_0x8ef5('0x50')]=[{'all':!![]}];}_0x5c7406=_[_0x8ef5('0x4b')]({},_0x5c7406,_0x138b2e[_0x8ef5('0x4e')]);return db['ChatQueue'][_0x8ef5('0x56')](_0x5c7406)[_0x8ef5('0x36')](handleEntityNotFound(_0x5beefb,null))['then'](respondWithResult(_0x5beefb,null))[_0x8ef5('0x29')](handleError(_0x5beefb,null));};exports['create']=function(_0x9da3bb,_0x1e9c0e){return db[_0x8ef5('0x3c')]['create'](_0x9da3bb[_0x8ef5('0x57')],{})[_0x8ef5('0x36')](function(_0x575791){var _0x31075d=_0x9da3bb['user'][_0x8ef5('0x58')]({'plain':!![]});if(!_0x31075d)throw new Error(_0x8ef5('0x59'));if(_0x31075d[_0x8ef5('0x5a')]===_0x8ef5('0x5b')){var _0x537da8=_0x575791[_0x8ef5('0x58')]({'plain':!![]});var _0x498c9a='ChatQueues';return db[_0x8ef5('0x5c')]['find']({'where':{'name':_0x498c9a,'userProfileId':_0x31075d[_0x8ef5('0x5d')]},'raw':!![]})['then'](function(_0x485f61){if(_0x485f61&&_0x485f61[_0x8ef5('0x5e')]===0x0){return db[_0x8ef5('0x37')]['create']({'name':_0x537da8['name'],'resourceId':_0x537da8['id'],'type':_0x485f61[_0x8ef5('0x39')],'sectionId':_0x485f61['id']},{})['then'](function(){return _0x575791;});}else{return _0x575791;}})[_0x8ef5('0x29')](function(_0x4fc3aa){logger[_0x8ef5('0x23')](_0x8ef5('0x5f'),_0x4fc3aa);throw _0x4fc3aa;});}return _0x575791;})[_0x8ef5('0x36')](respondWithResult(_0x1e9c0e,0xc9))[_0x8ef5('0x29')](handleError(_0x1e9c0e,null));};exports[_0x8ef5('0x34')]=function(_0x121066,_0x24cf03){if(_0x121066[_0x8ef5('0x57')]['id']){delete _0x121066[_0x8ef5('0x57')]['id'];}return db[_0x8ef5('0x3c')][_0x8ef5('0x56')]({'where':{'id':_0x121066[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x24cf03,null))[_0x8ef5('0x36')](saveUpdates(_0x121066['body'],null))[_0x8ef5('0x36')](respondWithResult(_0x24cf03,null))[_0x8ef5('0x29')](handleError(_0x24cf03,null));};exports['destroy']=function(_0x523d0d,_0x5e08a5){return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x523d0d[_0x8ef5('0x60')]['id']}})['then'](handleEntityNotFound(_0x5e08a5,null))[_0x8ef5('0x36')](removeEntity(_0x5e08a5,null))[_0x8ef5('0x29')](handleError(_0x5e08a5,null));};exports[_0x8ef5('0x61')]=function(_0x3faf83,_0x1c81ad){return db['ChatQueue'][_0x8ef5('0x61')]()[_0x8ef5('0x36')](respondWithResult(_0x1c81ad,null))[_0x8ef5('0x29')](handleError(_0x1c81ad,null));};exports[_0x8ef5('0x62')]=function(_0x5e70c7,_0x445691,_0x47c25f){var _0x2c9cac={'raw':!![],'where':{}},_0x2de3f7={},_0x2b75e5;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x5e70c7[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x445691,null))[_0x8ef5('0x36')](function(_0x186e03){if(_0x186e03){_0x2b75e5=_0x186e03[_0x8ef5('0x58')]({'plain':!![]});_0x2de3f7[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db[_0x8ef5('0x64')][_0x8ef5('0x54')]);_0x2de3f7['query']=_['keys'](_0x5e70c7[_0x8ef5('0x42')]);_0x2de3f7[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x2de3f7[_0x8ef5('0x40')],_0x2de3f7[_0x8ef5('0x42')]);_0x2c9cac[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x2de3f7[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x2c9cac[_0x8ef5('0x44')]=_0x2c9cac[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x2c9cac[_0x8ef5('0x44')]:_0x2de3f7[_0x8ef5('0x40')];if(!_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x65')]('nolimit')){_0x2c9cac[_0x8ef5('0x2e')]=qs['limit'](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0x2c9cac['offset']=qs[_0x8ef5('0x31')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x31')]);}_0x2c9cac[_0x8ef5('0x66')]=qs[_0x8ef5('0x48')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0x2c9cac[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_[_0x8ef5('0x67')](_0x5e70c7[_0x8ef5('0x42')],_0x2de3f7[_0x8ef5('0x55')]));_0x2c9cac[_0x8ef5('0x4a')][_0x8ef5('0x68')]=_0x186e03['id'];if(_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0x2c9cac[_0x8ef5('0x4a')]=_['merge'](_0x2c9cac['where'],{'$or':_[_0x8ef5('0x4c')](_0x2c9cac[_0x8ef5('0x44')],function(_0x4257de){var _0x408c72={};_0x408c72[_0x4257de]={'$like':'%'+_0x5e70c7['query'][_0x8ef5('0x49')]+'%'};return _0x408c72;})});}_0x2c9cac=_['merge']({},_0x2c9cac,_0x5e70c7[_0x8ef5('0x4e')]);return db[_0x8ef5('0x64')][_0x8ef5('0x51')](_0x2c9cac);}})[_0x8ef5('0x36')](function(_0x16eb82){if(_0x16eb82){return db[_0x8ef5('0x69')][_0x8ef5('0x6a')]({'where':{'id':_['map'](_0x16eb82,_0x8ef5('0x6b')),'role':_0x8ef5('0x6c')},'attributes':['id','name',_0x8ef5('0x6d'),_0x8ef5('0x6e'),_0x8ef5('0x6f')]});}})['then'](function(_0x16dc2d){if(_0x16dc2d){return{'count':_0x16dc2d[_0x8ef5('0x30')],'rows':_[_0x8ef5('0x4c')](_0x16dc2d[_0x8ef5('0x52')],function(_0x225f10){return{'membername':_0x225f10[_0x8ef5('0x39')],'UserId':_0x225f10['id'],'queue_name':_0x2b75e5['name'],'ChatQueueId':_0x2b75e5['id'],'interface':util[_0x8ef5('0x70')](_0x8ef5('0x71'),_0x8ef5('0x72'),_0x225f10[_0x8ef5('0x39')]),'penalty':0x0,'paused':_0x225f10[_0x8ef5('0x6d')],'createdAt':_0x225f10[_0x8ef5('0x6f')],'updatedAt':_0x225f10[_0x8ef5('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ef5('0x36')](respondWithFilteredResult(_0x445691,_0x2c9cac))['catch'](handleError(_0x445691,null));};exports[_0x8ef5('0x73')]=function(_0x6ebacf,_0x36c24e,_0x24717f){var _0x3c1f9f={};var _0x2b3fda={};var _0x1d3967;var _0x49441f;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x6ebacf[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x36c24e,null))[_0x8ef5('0x36')](function(_0x2a9e08){if(_0x2a9e08){_0x1d3967=_0x2a9e08;_0x2b3fda[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db[_0x8ef5('0x74')][_0x8ef5('0x54')]);_0x2b3fda[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x6ebacf[_0x8ef5('0x42')]);_0x2b3fda[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x2b3fda['model'],_0x2b3fda[_0x8ef5('0x42')]);_0x3c1f9f[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x2b3fda['model'],qs['fields'](_0x6ebacf[_0x8ef5('0x42')]['fields']));_0x3c1f9f[_0x8ef5('0x44')]=_0x3c1f9f[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x3c1f9f[_0x8ef5('0x44')]:_0x2b3fda[_0x8ef5('0x40')];_0x3c1f9f[_0x8ef5('0x66')]=qs['sort'](_0x6ebacf['query'][_0x8ef5('0x48')]);_0x3c1f9f[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_['pick'](_0x6ebacf[_0x8ef5('0x42')],_0x2b3fda['filters']));if(_0x6ebacf['query']['filter']){_0x3c1f9f[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0x3c1f9f[_0x8ef5('0x4a')],{'$or':_['map'](_0x3c1f9f[_0x8ef5('0x44')],function(_0x3c8e41){var _0x2b85f6={};_0x2b85f6[_0x3c8e41]={'$like':'%'+_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x49')]+'%'};return _0x2b85f6;})});}_0x3c1f9f=_[_0x8ef5('0x4b')]({},_0x3c1f9f,_0x6ebacf[_0x8ef5('0x4e')]);return _0x1d3967[_0x8ef5('0x73')](_0x3c1f9f);}})[_0x8ef5('0x36')](function(_0x531f65){if(_0x531f65){_0x49441f=_0x531f65[_0x8ef5('0x46')];if(!_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x65')](_0x8ef5('0x47'))){_0x3c1f9f[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x6ebacf[_0x8ef5('0x42')]['limit']);_0x3c1f9f['offset']=qs[_0x8ef5('0x31')](_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x31')]);}return _0x1d3967[_0x8ef5('0x73')](_0x3c1f9f);}})[_0x8ef5('0x36')](function(_0xca4c37){if(_0xca4c37){return _0xca4c37?{'count':_0x49441f,'rows':_0xca4c37}:null;}})[_0x8ef5('0x36')](respondWithResult(_0x36c24e,null))[_0x8ef5('0x29')](handleError(_0x36c24e,null));};exports[_0x8ef5('0x75')]=function(_0x685f56,_0x5edd93,_0x2e8118){var _0x423884=_0x685f56[_0x8ef5('0x57')][_0x8ef5('0x76')];return db[_0x8ef5('0x74')]['findAll']({'where':{'id':_0x423884},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8ef5('0x77'),'attributes':['id',_0x8ef5('0x39'),'online',_0x8ef5('0x78'),_0x8ef5('0x79')],'raw':!![]}]})[_0x8ef5('0x36')](function(_0xa0c3aa){if(_0xa0c3aa){var _0x43b9f2=_[_0x8ef5('0x7a')](_0xa0c3aa,function(_0xf6aeea){var _0x45cbea=_0xf6aeea[_0x8ef5('0x58')]({'plain':!![]});return _0x45cbea[_0x8ef5('0x77')];});return db['ChatQueue'][_0x8ef5('0x56')]({'where':{'id':_0x685f56[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](function(_0x189e51){return db[_0x8ef5('0x7b')][_0x8ef5('0x7c')](function(_0x795542){return _0x189e51[_0x8ef5('0x75')](_0x423884,{'transaction':_0x795542})['then'](function(){return BPromise[_0x8ef5('0x7d')](_0x43b9f2,function(_0x4cd3cf){return db['UserChatQueue'][_0x8ef5('0x7e')]({'where':{'UserId':_0x4cd3cf['id'],'ChatQueueId':_0x685f56[_0x8ef5('0x60')]['id']},'transaction':_0x795542});});})[_0x8ef5('0x36')](function(){_0x43b9f2[_0x8ef5('0x7f')](function(_0x2d51cf){socket[_0x8ef5('0x80')](_0x8ef5('0x81'),{'UserId':_0x2d51cf['id'],'ChatQueueId':_0x189e51['id']});});});});});}})['then'](respondWithStatusCode(_0x5edd93,null))[_0x8ef5('0x29')](handleError(_0x5edd93,null));};exports[_0x8ef5('0x82')]=function(_0x1d67ba,_0x24548f,_0x4a56c5){return db[_0x8ef5('0x74')][_0x8ef5('0x51')]({'where':{'id':_0x1d67ba[_0x8ef5('0x42')][_0x8ef5('0x76')]},'attributes':['id'],'include':[{'model':db[_0x8ef5('0x69')],'as':_0x8ef5('0x77'),'attributes':['id'],'raw':!![]}]})[_0x8ef5('0x36')](handleEntityNotFound(_0x24548f,null))['then'](function(_0x595efc){var _0x145f17=_['map'](_0x595efc,'id');var _0x2a7643=[];var _0x548cde=[];var _0x344906=squel[_0x8ef5('0x83')]();_0x344906[_0x8ef5('0x84')](_0x8ef5('0x85'))[_0x8ef5('0x86')](_0x8ef5('0x87'),'tq')[_0x8ef5('0x88')](_0x8ef5('0x89'),'ut',_0x8ef5('0x8a'))[_0x8ef5('0x4a')](_0x8ef5('0x8b'),_0x1d67ba[_0x8ef5('0x60')]['id']);for(var _0x51c146=0x0;_0x51c146<_0x595efc[_0x8ef5('0x46')];_0x51c146+=0x1){let _0x190f44=_0x595efc[_0x51c146];for(var _0x1ccf2f=0x0;_0x1ccf2f<_0x190f44[_0x8ef5('0x77')][_0x8ef5('0x46')];_0x1ccf2f+=0x1){let _0xc3a8a7=_0x190f44[_0x8ef5('0x77')][_0x1ccf2f];var _0x30aec4=_0x344906[_0x8ef5('0x8c')]();_0x30aec4['where'](_0x8ef5('0x8d'),_0xc3a8a7['id']);_0x548cde[_0x8ef5('0x8e')](db[_0x8ef5('0x7b')][_0x8ef5('0x42')](_0x30aec4[_0x8ef5('0x8f')](),{'type':db[_0x8ef5('0x7b')][_0x8ef5('0x90')][_0x8ef5('0x91')]})[_0x8ef5('0x36')](function(_0x4cd2d1){if(_0x4cd2d1[_0x8ef5('0x46')]===0x1){return _0xc3a8a7['id'];}else{var _0xbc200c=_['every'](_[_0x8ef5('0x4c')](_0x4cd2d1,_0x8ef5('0x92')),function(_0x441660){return _[_0x8ef5('0x93')](_0x145f17,_0x441660);});if(_0xbc200c){return _0xc3a8a7['id'];}}}));}}return BPromise['all'](_0x548cde)[_0x8ef5('0x36')](function(_0x5916c2){_0x2a7643=_(_0x2a7643)['union'](_0x5916c2)[_0x8ef5('0x94')]()['value']();return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x1d67ba['params']['id']}})[_0x8ef5('0x36')](function(_0x5425c9){return db[_0x8ef5('0x7b')][_0x8ef5('0x7c')](function(_0x2866c5){return _0x5425c9[_0x8ef5('0x82')](_0x1d67ba[_0x8ef5('0x42')][_0x8ef5('0x76')],{'transaction':_0x2866c5})[_0x8ef5('0x36')](function(){if(!_['isEmpty'](_0x2a7643)){return _0x5425c9['removeAgents'](_0x2a7643,{'transaction':_0x2866c5});}})['then'](function(){_0x2a7643[_0x8ef5('0x7f')](function(_0x1507c9){socket['emit']('userChatQueue:remove',{'UserId':_0x1507c9,'ChatQueueId':_0x5425c9['id']});});});});});});})['then'](respondWithStatusCode(_0x24548f,null))[_0x8ef5('0x29')](handleError(_0x24548f,null));};exports[_0x8ef5('0x95')]=function(_0x513c9d,_0x6c27ec,_0x3ce571){return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x513c9d[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x6c27ec,null))[_0x8ef5('0x36')](function(_0x39451e){if(_0x39451e){return _0x39451e[_0x8ef5('0x95')](_0x513c9d[_0x8ef5('0x57')][_0x8ef5('0x76')],_[_0x8ef5('0x96')](_0x513c9d[_0x8ef5('0x57')],[_0x8ef5('0x76'),'id'])||{})[_0x8ef5('0x97')](function(_0x1c784b){for(var _0x556838=0x0;_0x556838<_0x513c9d[_0x8ef5('0x57')]['ids'][_0x8ef5('0x46')];_0x556838+=0x1){socket['emit'](_0x8ef5('0x81'),{'UserId':Number(_0x513c9d['body'][_0x8ef5('0x76')][_0x556838]),'ChatQueueId':Number(_0x513c9d[_0x8ef5('0x60')]['id'])});}return _0x1c784b;});}})[_0x8ef5('0x36')](respondWithResult(_0x6c27ec,null))[_0x8ef5('0x29')](handleError(_0x6c27ec,null));};exports[_0x8ef5('0x98')]=function(_0x51f7ce,_0x5052d6,_0x4416dc){return db[_0x8ef5('0x3c')][_0x8ef5('0x56')]({'where':{'id':_0x51f7ce['params']['id']}})['then'](handleEntityNotFound(_0x5052d6,null))[_0x8ef5('0x36')](function(_0x5474aa){if(_0x5474aa){return _0x5474aa['removeAgents'](_0x51f7ce['query'][_0x8ef5('0x76')])[_0x8ef5('0x36')](function(){if(_[_0x8ef5('0x99')](_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')])){for(var _0x3175e4=0x0;_0x3175e4<_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')]['length'];_0x3175e4+=0x1){socket[_0x8ef5('0x80')]('userChatQueue:remove',{'UserId':Number(_0x51f7ce['query'][_0x8ef5('0x76')][_0x3175e4]),'ChatQueueId':Number(_0x51f7ce[_0x8ef5('0x60')]['id'])});}}else{socket[_0x8ef5('0x80')](_0x8ef5('0x9a'),{'UserId':Number(_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')]),'ChatQueueId':Number(_0x51f7ce[_0x8ef5('0x60')]['id'])});}});}})[_0x8ef5('0x36')](respondWithStatusCode(_0x5052d6,null))[_0x8ef5('0x29')](handleError(_0x5052d6,null));};exports[_0x8ef5('0x9b')]=function(_0x2c2276,_0x43cf7f,_0x5547ff){var _0x5ca7d0={};var _0x29b84e={};var _0x271134;var _0x4652ba;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x2c2276[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x43cf7f,null))[_0x8ef5('0x36')](function(_0x27117f){if(_0x27117f){_0x271134=_0x27117f;_0x29b84e[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db['User'][_0x8ef5('0x54')]);_0x29b84e[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x2c2276[_0x8ef5('0x42')]);_0x29b84e[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x29b84e[_0x8ef5('0x40')],_0x29b84e[_0x8ef5('0x42')]);_0x5ca7d0[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x29b84e['model'],qs['fields'](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x5ca7d0[_0x8ef5('0x44')]=_0x5ca7d0[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x5ca7d0['attributes']:_0x29b84e['model'];_0x5ca7d0[_0x8ef5('0x66')]=qs[_0x8ef5('0x48')](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0x5ca7d0[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_[_0x8ef5('0x67')](_0x2c2276[_0x8ef5('0x42')],_0x29b84e[_0x8ef5('0x55')]));if(_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0x5ca7d0[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0x5ca7d0[_0x8ef5('0x4a')],{'$or':_[_0x8ef5('0x4c')](_0x5ca7d0[_0x8ef5('0x44')],function(_0xf605d){var _0x9e0d1d={};_0x9e0d1d[_0xf605d]={'$like':'%'+_0x2c2276[_0x8ef5('0x42')]['filter']+'%'};return _0x9e0d1d;})});}_0x5ca7d0=_['merge']({},_0x5ca7d0,_0x2c2276[_0x8ef5('0x4e')]);return _0x271134['getAgents'](_0x5ca7d0);}})['then'](function(_0x193c75){if(_0x193c75){_0x4652ba=_0x193c75[_0x8ef5('0x46')];if(!_0x2c2276['query'][_0x8ef5('0x65')](_0x8ef5('0x47'))){_0x5ca7d0[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0x5ca7d0[_0x8ef5('0x31')]=qs[_0x8ef5('0x31')](_0x2c2276['query'][_0x8ef5('0x31')]);}return _0x271134[_0x8ef5('0x9b')](_0x5ca7d0);}})[_0x8ef5('0x36')](function(_0x52fd9f){if(_0x52fd9f){return _0x52fd9f?{'count':_0x4652ba,'rows':_0x52fd9f}:null;}})['then'](respondWithResult(_0x43cf7f,null))[_0x8ef5('0x29')](handleError(_0x43cf7f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 772fa62..1356e52 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 _0x2d90=['events','../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x2d90,0x1c2));var _0x02d9=function(_0x214a74,_0x1ac282){_0x214a74=_0x214a74-0x0;var _0x3c4532=_0x2d90[_0x214a74];return _0x3c4532;};'use strict';var EventEmitter=require(_0x02d9('0x0'));var ChatQueue=require(_0x02d9('0x1'))['db'][_0x02d9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x02d9('0x3')](0x0);var events={'afterCreate':_0x02d9('0x4'),'afterUpdate':'update','afterDestroy':_0x02d9('0x5')};function emitEvent(_0x590524){return function(_0x2daf5d,_0xd95cb3,_0x2971d3){ChatQueueEvents[_0x02d9('0x6')](_0x590524+':'+_0x2daf5d['id'],_0x2daf5d);ChatQueueEvents[_0x02d9('0x6')](_0x590524,_0x2daf5d);_0x2971d3(null);};}for(var e in events){if(events[_0x02d9('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x02d9('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x385b=['emit','exports','events','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x385b,0x17a));var _0xb385=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x385b[_0x242a4f];return _0x122117;};'use strict';var EventEmitter=require(_0xb385('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xb385('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb385('0x2')](0x0);var events={'afterCreate':_0xb385('0x3'),'afterUpdate':_0xb385('0x4'),'afterDestroy':_0xb385('0x5')};function emitEvent(_0x3df07f){return function(_0x4a5f1e,_0x599a2d,_0xff424d){ChatQueueEvents[_0xb385('0x6')](_0x3df07f+':'+_0x4a5f1e['id'],_0x4a5f1e);ChatQueueEvents[_0xb385('0x6')](_0x3df07f,_0x4a5f1e);_0xff424d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xb385('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index de89f67..0c2d668 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 _0x0c09=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','util','moment'];(function(_0x203d73,_0x6bfa0f){var _0x2abb5d=function(_0x4b61c9){while(--_0x4b61c9){_0x203d73['push'](_0x203d73['shift']());}};_0x2abb5d(++_0x6bfa0f);}(_0x0c09,0x1b7));var _0x90c0=function(_0x53a5e0,_0x192863){_0x53a5e0=_0x53a5e0-0x0;var _0x4fc739=_0x0c09[_0x53a5e0];return _0x4fc739;};'use strict';var _=require('lodash');var util=require(_0x90c0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x90c0('0x1'));var BPromise=require(_0x90c0('0x2'));var rp=require(_0x90c0('0x3'));var fs=require('fs');var path=require(_0x90c0('0x4'));var rimraf=require(_0x90c0('0x5'));var config=require(_0x90c0('0x6'));var attributes=require(_0x90c0('0x7'));module[_0x90c0('0x8')]=function(_0x30652b,_0x2aa588){return _0x30652b['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e53=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x225a75,_0x43c1de){var _0xee995d=function(_0x31a816){while(--_0x31a816){_0x225a75['push'](_0x225a75['shift']());}};_0xee995d(++_0x43c1de);}(_0x9e53,0xc3));var _0x39e5=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x9e53[_0x2b9d5c];return _0x37bb93;};'use strict';var _=require(_0x39e5('0x0'));var util=require(_0x39e5('0x1'));var logger=require(_0x39e5('0x2'))(_0x39e5('0x3'));var moment=require(_0x39e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x39e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39e5('0x6'));var config=require(_0x39e5('0x7'));var attributes=require(_0x39e5('0x8'));module[_0x39e5('0x9')]=function(_0x35a6ad,_0x559cf9){return _0x35a6ad[_0x39e5('0xa')](_0x39e5('0xb'),attributes,{'tableName':_0x39e5('0xc'),'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 d34482d..54ccdd6 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 _0xb396=['include','model','attributes','then','debug','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetChatQueue','findAll','options','raw','where','limit','map'];(function(_0x1187d2,_0x528ad5){var _0x5d41ec=function(_0x519ada){while(--_0x519ada){_0x1187d2['push'](_0x1187d2['shift']());}};_0x5d41ec(++_0x528ad5);}(_0xb396,0x1e8));var _0x6b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb396[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6b39('0x0'));var util=require(_0x6b39('0x1'));var moment=require(_0x6b39('0x2'));var BPromise=require(_0x6b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b39('0x4'));var db=require(_0x6b39('0x5'))['db'];var utils=require(_0x6b39('0x6'));var logger=require(_0x6b39('0x7'))(_0x6b39('0x8'));var config=require(_0x6b39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6b39('0xa')]['http']({'port':0x232a});config[_0x6b39('0xb')]=_['defaults'](config['redis'],{'host':_0x6b39('0xc'),'port':0x18eb});var socket=require(_0x6b39('0xd'))(new Redis(config[_0x6b39('0xb')]));require(_0x6b39('0xe'))[_0x6b39('0xf')](socket);function respondWithRpcPromise(_0x36606d,_0x32c7b2,_0x5adff6){return new BPromise(function(_0x4a1b39,_0x5c098a){return client[_0x6b39('0x10')](_0x36606d,_0x5adff6)['then'](function(_0x5ba3af){logger['info'](_0x6b39('0x11'),_0x32c7b2,_0x6b39('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x32c7b2,_0x6b39('0x12'),JSON[_0x6b39('0x13')](_0x5ba3af));if(_0x5ba3af[_0x6b39('0x14')]){if(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x15')]===0x1f4){logger['error'](_0x6b39('0x11'),_0x32c7b2,_0x5ba3af['error'][_0x6b39('0x16')]);return _0x5c098a(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x16')]);}logger['error'](_0x6b39('0x11'),_0x32c7b2,_0x5ba3af['error'][_0x6b39('0x16')]);return _0x4a1b39(_0x5ba3af[_0x6b39('0x14')][_0x6b39('0x16')]);}else{logger[_0x6b39('0x17')](_0x6b39('0x11'),_0x32c7b2,_0x6b39('0x12'));_0x4a1b39(_0x5ba3af[_0x6b39('0x18')][_0x6b39('0x16')]);}})['catch'](function(_0x51a7dc){logger[_0x6b39('0x14')](_0x6b39('0x11'),_0x32c7b2,_0x51a7dc);_0x5c098a(_0x51a7dc);});});}exports[_0x6b39('0x19')]=function(_0x3a8b5b){var _0x1893ad=this;return new Promise(function(_0x299538,_0x458e7d){return db['ChatQueue'][_0x6b39('0x1a')]({'raw':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b['options'][_0x6b39('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b[_0x6b39('0x1b')][_0x6b39('0x1d')]||null:null,'attributes':_0x3a8b5b['options']?_0x3a8b5b[_0x6b39('0x1b')]['attributes']||null:null,'limit':_0x3a8b5b['options']?_0x3a8b5b[_0x6b39('0x1b')][_0x6b39('0x1e')]||null:null,'include':_0x3a8b5b[_0x6b39('0x1b')]?_0x3a8b5b['options']['include']?_[_0x6b39('0x1f')](_0x3a8b5b['options'][_0x6b39('0x20')],function(_0x2423bb){return{'model':db[_0x2423bb[_0x6b39('0x21')]],'as':_0x2423bb['as'],'attributes':_0x2423bb['attributes'],'include':_0x2423bb[_0x6b39('0x20')]?_['map'](_0x2423bb[_0x6b39('0x20')],function(_0x4f0c90){return{'model':db[_0x4f0c90[_0x6b39('0x21')]],'as':_0x4f0c90['as'],'attributes':_0x4f0c90[_0x6b39('0x22')],'include':_0x4f0c90[_0x6b39('0x20')]?_['map'](_0x4f0c90[_0x6b39('0x20')],function(_0x26ef5b){return{'model':db[_0x26ef5b[_0x6b39('0x21')]],'as':_0x26ef5b['as'],'attributes':_0x26ef5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b39('0x23')](function(_0x2fa81a){logger[_0x6b39('0x17')]('GetChatQueue',_0x3a8b5b);logger[_0x6b39('0x24')](_0x6b39('0x19'),_0x3a8b5b,JSON[_0x6b39('0x13')](_0x2fa81a));_0x299538(_0x2fa81a);})['catch'](function(_0x267443){logger[_0x6b39('0x14')](_0x6b39('0x19'),_0x267443[_0x6b39('0x16')],_0x3a8b5b);_0x458e7d(_0x1893ad[_0x6b39('0x14')](0x1f4,_0x267443[_0x6b39('0x16')]));});});};exports[_0x6b39('0x25')]=function(_0x5be8ab){var _0x2f9e5d=this;return new Promise(function(_0x2a0702,_0x5d9859){return db[_0x6b39('0x26')][_0x6b39('0x27')]({'raw':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x1c')]===undefined?!![]:![]:!![],'where':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab['options'][_0x6b39('0x1d')]||null:null,'attributes':_0x5be8ab[_0x6b39('0x1b')]?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x22')]||null:null,'include':_0x5be8ab['options']?_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x20')]?_[_0x6b39('0x1f')](_0x5be8ab[_0x6b39('0x1b')][_0x6b39('0x20')],function(_0x449afc){return{'model':db[_0x449afc[_0x6b39('0x21')]],'as':_0x449afc['as'],'attributes':_0x449afc[_0x6b39('0x22')],'include':_0x449afc[_0x6b39('0x20')]?_['map'](_0x449afc['include'],function(_0xc40fe7){return{'model':db[_0xc40fe7[_0x6b39('0x21')]],'as':_0xc40fe7['as'],'attributes':_0xc40fe7[_0x6b39('0x22')],'include':_0xc40fe7['include']?_['map'](_0xc40fe7[_0x6b39('0x20')],function(_0x215032){return{'model':db[_0x215032[_0x6b39('0x21')]],'as':_0x215032['as'],'attributes':_0x215032[_0x6b39('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6b39('0x23')](function(_0x2c981c){logger['info'](_0x6b39('0x25'),_0x5be8ab);logger[_0x6b39('0x24')](_0x6b39('0x25'),_0x5be8ab,JSON[_0x6b39('0x13')](_0x2c981c));_0x2a0702(_0x2c981c);})['catch'](function(_0x72e6b6){logger[_0x6b39('0x14')](_0x6b39('0x25'),_0x72e6b6[_0x6b39('0x16')],_0x5be8ab);_0x5d9859(_0x2f9e5d[_0x6b39('0x14')](0x1f4,_0x72e6b6[_0x6b39('0x16')]));});});}; \ No newline at end of file +var _0x2d28=['localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetChatQueue','findAll','options','raw','where','include','map','model','attributes','catch','ChatQueue','find','ShowChatQueue','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults'];(function(_0x4857c9,_0x4ccb50){var _0x1da42e=function(_0x5cdedf){while(--_0x5cdedf){_0x4857c9['push'](_0x4857c9['shift']());}};_0x1da42e(++_0x4ccb50);}(_0x2d28,0x1be));var _0x82d2=function(_0x7261e6,_0x3e3bf7){_0x7261e6=_0x7261e6-0x0;var _0x20d5ed=_0x2d28[_0x7261e6];return _0x20d5ed;};'use strict';var _=require(_0x82d2('0x0'));var util=require(_0x82d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82d2('0x2'))['db'];var utils=require(_0x82d2('0x3'));var logger=require('../../config/logger')(_0x82d2('0x4'));var config=require(_0x82d2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x82d2('0x6')]['http']({'port':0x232a});config[_0x82d2('0x7')]=_[_0x82d2('0x8')](config[_0x82d2('0x7')],{'host':_0x82d2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x82d2('0xa'))[_0x82d2('0xb')](socket);function respondWithRpcPromise(_0x17c1c8,_0x132cf9,_0x3c55a5){return new BPromise(function(_0x2affca,_0x508e51){return client['request'](_0x17c1c8,_0x3c55a5)[_0x82d2('0xc')](function(_0x483b6e){logger[_0x82d2('0xd')](_0x82d2('0xe'),_0x132cf9,_0x82d2('0xf'));logger[_0x82d2('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x132cf9,_0x82d2('0xf'),JSON[_0x82d2('0x11')](_0x483b6e));if(_0x483b6e['error']){if(_0x483b6e['error'][_0x82d2('0x12')]===0x1f4){logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);return _0x508e51(_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);}logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);return _0x2affca(_0x483b6e[_0x82d2('0x13')]['message']);}else{logger[_0x82d2('0xd')]('ChatQueue,\x20%s,\x20%s',_0x132cf9,_0x82d2('0xf'));_0x2affca(_0x483b6e[_0x82d2('0x15')][_0x82d2('0x14')]);}})['catch'](function(_0x2539ad){logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x2539ad);_0x508e51(_0x2539ad);});});}exports[_0x82d2('0x16')]=function(_0x1d5422){var _0x492348=this;return new Promise(function(_0xb023a3,_0x2374c6){return db['ChatQueue'][_0x82d2('0x17')]({'raw':_0x1d5422[_0x82d2('0x18')]?_0x1d5422[_0x82d2('0x18')][_0x82d2('0x19')]===undefined?!![]:![]:!![],'where':_0x1d5422[_0x82d2('0x18')]?_0x1d5422[_0x82d2('0x18')][_0x82d2('0x1a')]||null:null,'attributes':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options']['attributes']||null:null,'limit':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options']['limit']||null:null,'include':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options'][_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x1d5422[_0x82d2('0x18')][_0x82d2('0x1b')],function(_0x23d153){return{'model':db[_0x23d153[_0x82d2('0x1d')]],'as':_0x23d153['as'],'attributes':_0x23d153[_0x82d2('0x1e')],'include':_0x23d153[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x23d153[_0x82d2('0x1b')],function(_0x39b82d){return{'model':db[_0x39b82d[_0x82d2('0x1d')]],'as':_0x39b82d['as'],'attributes':_0x39b82d['attributes'],'include':_0x39b82d[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x39b82d[_0x82d2('0x1b')],function(_0x488f48){return{'model':db[_0x488f48[_0x82d2('0x1d')]],'as':_0x488f48['as'],'attributes':_0x488f48[_0x82d2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x82d2('0xc')](function(_0x2a6564){logger[_0x82d2('0xd')](_0x82d2('0x16'),_0x1d5422);logger[_0x82d2('0x10')]('GetChatQueue',_0x1d5422,JSON[_0x82d2('0x11')](_0x2a6564));_0xb023a3(_0x2a6564);})[_0x82d2('0x1f')](function(_0x489b1a){logger[_0x82d2('0x13')](_0x82d2('0x16'),_0x489b1a[_0x82d2('0x14')],_0x1d5422);_0x2374c6(_0x492348['error'](0x1f4,_0x489b1a[_0x82d2('0x14')]));});});};exports['ShowChatQueue']=function(_0xcd7014){var _0x552851=this;return new Promise(function(_0x2e1044,_0x4c98fb){return db[_0x82d2('0x20')][_0x82d2('0x21')]({'raw':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x19')]===undefined?!![]:![]:!![],'where':_0xcd7014[_0x82d2('0x18')]?_0xcd7014['options'][_0x82d2('0x1a')]||null:null,'attributes':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1e')]||null:null,'include':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1b')],function(_0x27745a){return{'model':db[_0x27745a[_0x82d2('0x1d')]],'as':_0x27745a['as'],'attributes':_0x27745a[_0x82d2('0x1e')],'include':_0x27745a['include']?_[_0x82d2('0x1c')](_0x27745a['include'],function(_0x4e7ff2){return{'model':db[_0x4e7ff2[_0x82d2('0x1d')]],'as':_0x4e7ff2['as'],'attributes':_0x4e7ff2['attributes'],'include':_0x4e7ff2[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x4e7ff2[_0x82d2('0x1b')],function(_0x37de6c){return{'model':db[_0x37de6c[_0x82d2('0x1d')]],'as':_0x37de6c['as'],'attributes':_0x37de6c[_0x82d2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x82d2('0xc')](function(_0x214a9c){logger[_0x82d2('0xd')](_0x82d2('0x22'),_0xcd7014);logger[_0x82d2('0x10')](_0x82d2('0x22'),_0xcd7014,JSON[_0x82d2('0x11')](_0x214a9c));_0x2e1044(_0x214a9c);})[_0x82d2('0x1f')](function(_0x1c2bd6){logger[_0x82d2('0x13')](_0x82d2('0x22'),_0x1c2bd6['message'],_0xcd7014);_0x4c98fb(_0x552851[_0x82d2('0x13')](0x1f4,_0x1c2bd6[_0x82d2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2721d29..f7a57fc 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 _0x579c=['chatQueue:','./chatQueue.events','save','remove','update','removeListener','register'];(function(_0x2aca0b,_0x5de98f){var _0x27a68c=function(_0x42ebcf){while(--_0x42ebcf){_0x2aca0b['push'](_0x2aca0b['shift']());}};_0x27a68c(++_0x5de98f);}(_0x579c,0xda));var _0xc579=function(_0x5c5d03,_0x338a78){_0x5c5d03=_0x5c5d03-0x0;var _0x4d326f=_0x579c[_0x5c5d03];return _0x4d326f;};'use strict';var ChatQueueEvents=require(_0xc579('0x0'));var events=[_0xc579('0x1'),_0xc579('0x2'),_0xc579('0x3')];function createListener(_0x397136,_0x586948){return function(_0x1e2808){_0x586948['emit'](_0x397136,_0x1e2808);};}function removeListener(_0x21a0a2,_0x3b913c){return function(){ChatQueueEvents[_0xc579('0x4')](_0x21a0a2,_0x3b913c);};}exports[_0xc579('0x5')]=function(_0x124ee5){for(var _0x1bd276=0x0,_0x2e451b=events['length'];_0x1bd276<_0x2e451b;_0x1bd276++){var _0x1c6d9c=events[_0x1bd276];var _0x293c4a=createListener(_0xc579('0x6')+_0x1c6d9c,_0x124ee5);ChatQueueEvents['on'](_0x1c6d9c,_0x293c4a);}}; \ No newline at end of file +var _0xadb8=['emit','removeListener','length','chatQueue:','remove'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xadb8[_0x4f4c53];return _0x568ff1;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x8adb('0x0'),'update'];function createListener(_0x2b8a76,_0x2a0b30){return function(_0x24f912){_0x2a0b30[_0x8adb('0x1')](_0x2b8a76,_0x24f912);};}function removeListener(_0x44fdf7,_0x2baedb){return function(){ChatQueueEvents[_0x8adb('0x2')](_0x44fdf7,_0x2baedb);};}exports['register']=function(_0x15bc63){for(var _0x1a5f36=0x0,_0x9f435=events[_0x8adb('0x3')];_0x1a5f36<_0x9f435;_0x1a5f36++){var _0x271bed=events[_0x1a5f36];var _0x16b932=createListener(_0x8adb('0x4')+_0x271bed,_0x15bc63);ChatQueueEvents['on'](_0x271bed,_0x16b932);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e73b7c2..5a0d6b2 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x5fc3[_0x3d9176];return _0x12adc5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _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(_0x393bdf,_0xf2ccb4){var _0xd57701=function(_0x4c9c1a){while(--_0x4c9c1a){_0x393bdf['push'](_0x393bdf['shift']());}};_0xd57701(++_0xf2ccb4);}(_0x814b,0x1a2));var _0xb814=function(_0x16e73a,_0x146629){_0x16e73a=_0x16e73a-0x0;var _0x187aa1=_0x814b[_0x16e73a];return _0x187aa1;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3ffa7c3..33bb525 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 _0x8488=['sequelize','exports','STRING','DATE','moment'];(function(_0x2d94dc,_0x56bed1){var _0x42f80d=function(_0x23916b){while(--_0x23916b){_0x2d94dc['push'](_0x2d94dc['shift']());}};_0x42f80d(++_0x56bed1);}(_0x8488,0x1b7));var _0x8848=function(_0x2eb135,_0x424cf9){_0x2eb135=_0x2eb135-0x0;var _0x3d55a2=_0x8488[_0x2eb135];return _0x3d55a2;};'use strict';var moment=require(_0x8848('0x0'));var Sequelize=require(_0x8848('0x1'));module[_0x8848('0x2')]={'uniqueid':{'type':Sequelize[_0x8848('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8848('0x3')]},'joinAt':{'type':Sequelize[_0x8848('0x4')]},'leaveAt':{'type':Sequelize[_0x8848('0x4')]},'acceptAt':{'type':Sequelize[_0x8848('0x4')]},'exitAt':{'type':Sequelize[_0x8848('0x4')]},'reason':{'type':Sequelize[_0x8848('0x3')]}}; \ No newline at end of file +var _0x7bee=['DATE','sequelize','exports','STRING'];(function(_0x259cdb,_0x3696ff){var _0x102792=function(_0x59aa1e){while(--_0x59aa1e){_0x259cdb['push'](_0x259cdb['shift']());}};_0x102792(++_0x3696ff);}(_0x7bee,0x13d));var _0xe7be=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7bee[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0xe7be('0x0'));module[_0xe7be('0x1')]={'uniqueid':{'type':Sequelize[_0xe7be('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe7be('0x2')]},'joinAt':{'type':Sequelize[_0xe7be('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe7be('0x3')]},'exitAt':{'type':Sequelize[_0xe7be('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index daa5039..c37d4dc 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 _0x5785=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5785,0x119));var _0x5578=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5785[_0x24259d];return _0x5a701;};'use strict';var emlformat=require(_0x5578('0x0'));var rimraf=require(_0x5578('0x1'));var zipdir=require(_0x5578('0x2'));var jsonpatch=require(_0x5578('0x3'));var rp=require(_0x5578('0x4'));var moment=require('moment');var BPromise=require(_0x5578('0x5'));var Mustache=require(_0x5578('0x6'));var util=require(_0x5578('0x7'));var path=require(_0x5578('0x8'));var sox=require(_0x5578('0x9'));var csv=require(_0x5578('0xa'));var ejs=require(_0x5578('0xb'));var fs=require('fs');var fs_extra=require(_0x5578('0xc'));var _=require(_0x5578('0xd'));var squel=require(_0x5578('0xe'));var crypto=require('crypto');var jsforce=require(_0x5578('0xf'));var deskjs=require(_0x5578('0x10'));var toCsv=require(_0x5578('0xa'));var querystring=require('querystring');var Papa=require(_0x5578('0x11'));var Redis=require('ioredis');var authService=require(_0x5578('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5578('0x13'));var hardwareService=require(_0x5578('0x14'));var logger=require(_0x5578('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5578('0x16'));var licenseUtil=require(_0x5578('0x17'));var db=require(_0x5578('0x18'))['db'];function respondWithStatusCode(_0x1506ac,_0x4592df){_0x4592df=_0x4592df||0xcc;return function(_0xa355d3){if(_0xa355d3){return _0x1506ac[_0x5578('0x19')](_0x4592df);}return _0x1506ac[_0x5578('0x1a')](_0x4592df)[_0x5578('0x1b')]();};}function respondWithResult(_0x34bacc,_0x4f6d2a){_0x4f6d2a=_0x4f6d2a||0xc8;return function(_0xe7ea50){if(_0xe7ea50){return _0x34bacc[_0x5578('0x1a')](_0x4f6d2a)[_0x5578('0x1c')](_0xe7ea50);}};}function respondWithFilteredResult(_0x21df98,_0x44ef23){return function(_0xb8e9c8){if(_0xb8e9c8){var _0x3fa05b=typeof _0x44ef23[_0x5578('0x1d')]===_0x5578('0x1e')&&typeof _0x44ef23[_0x5578('0x1f')]==='undefined';var _0x24b5b1=_0xb8e9c8[_0x5578('0x20')];var _0x5db57a=_0x3fa05b?0x0:_0x44ef23['offset'];var _0x3826b9=_0x3fa05b?_0xb8e9c8[_0x5578('0x20')]:_0x44ef23['offset']+_0x44ef23[_0x5578('0x1f')];var _0x2021b6;if(_0x3826b9>=_0x24b5b1){_0x3826b9=_0x24b5b1;_0x2021b6=0xc8;}else{_0x2021b6=0xce;}_0x21df98[_0x5578('0x1a')](_0x2021b6);return _0x21df98[_0x5578('0x21')](_0x5578('0x22'),_0x5db57a+'-'+_0x3826b9+'/'+_0x24b5b1)[_0x5578('0x1c')](_0xb8e9c8);}return null;};}function patchUpdates(_0x3dfadd){return function(_0x3a6b68){try{jsonpatch[_0x5578('0x23')](_0x3a6b68,_0x3dfadd,!![]);}catch(_0x38d06f){return BPromise[_0x5578('0x24')](_0x38d06f);}return _0x3a6b68[_0x5578('0x25')]();};}function saveUpdates(_0x2542eb,_0x10dd37){return function(_0x5d0a54){if(_0x5d0a54){return _0x5d0a54[_0x5578('0x26')](_0x2542eb)['then'](function(_0x208952){return _0x208952;});}return null;};}function removeEntity(_0x2d57b5,_0x394421){return function(_0x199853){if(_0x199853){return _0x199853[_0x5578('0x27')]()[_0x5578('0x28')](function(){_0x2d57b5['status'](0xcc)[_0x5578('0x1b')]();});}};}function handleEntityNotFound(_0x5d2c0c,_0x4c4d89){return function(_0x16cea){if(!_0x16cea){_0x5d2c0c['sendStatus'](0x194);}return _0x16cea;};}function handleError(_0x1d1861,_0x43adbd){_0x43adbd=_0x43adbd||0x1f4;return function(_0x2a752e){logger['error'](_0x2a752e[_0x5578('0x29')]);if(_0x2a752e[_0x5578('0x2a')]){delete _0x2a752e['name'];}_0x1d1861['status'](_0x43adbd)[_0x5578('0x2b')](_0x2a752e);};}exports[_0x5578('0x2c')]=function(_0x807da6,_0x25fb3b){var _0x44f200={},_0x593423={},_0x2d28d5={'count':0x0,'rows':[]};var _0xbe03a3=_[_0x5578('0x2d')](db[_0x5578('0x2e')][_0x5578('0x2f')],function(_0xe44d1b){return{'name':_0xe44d1b[_0x5578('0x30')],'type':_0xe44d1b[_0x5578('0x31')]['key']};});_0x593423['model']=_['map'](_0xbe03a3,_0x5578('0x2a'));_0x593423['query']=_['keys'](_0x807da6[_0x5578('0x32')]);_0x593423['filters']=_[_0x5578('0x33')](_0x593423[_0x5578('0x34')],_0x593423[_0x5578('0x32')]);_0x44f200[_0x5578('0x35')]=_['intersection'](_0x593423[_0x5578('0x34')],qs[_0x5578('0x36')](_0x807da6[_0x5578('0x32')][_0x5578('0x36')]));_0x44f200['attributes']=_0x44f200[_0x5578('0x35')][_0x5578('0x37')]?_0x44f200[_0x5578('0x35')]:_0x593423['model'];if(!_0x807da6[_0x5578('0x32')][_0x5578('0x38')]('nolimit')){_0x44f200[_0x5578('0x1f')]=qs['limit'](_0x807da6[_0x5578('0x32')][_0x5578('0x1f')]);_0x44f200['offset']=qs[_0x5578('0x1d')](_0x807da6[_0x5578('0x32')][_0x5578('0x1d')]);}_0x44f200[_0x5578('0x39')]=qs['sort'](_0x807da6[_0x5578('0x32')][_0x5578('0x3a')]);_0x44f200[_0x5578('0x3b')]=qs[_0x5578('0x3c')](_['pick'](_0x807da6[_0x5578('0x32')],_0x593423[_0x5578('0x3c')]),_0xbe03a3);if(_0x807da6[_0x5578('0x32')]['filter']){_0x44f200[_0x5578('0x3b')]=_['merge'](_0x44f200['where'],{'$or':_[_0x5578('0x2d')](_0xbe03a3,function(_0x2ee835){if(_0x2ee835[_0x5578('0x31')]!=='VIRTUAL'){var _0x55e2be={};_0x55e2be[_0x2ee835[_0x5578('0x2a')]]={'$like':'%'+_0x807da6[_0x5578('0x32')][_0x5578('0x3d')]+'%'};return _0x55e2be;}})});}_0x44f200=_[_0x5578('0x3e')]({},_0x44f200,_0x807da6[_0x5578('0x3f')]);var _0x5a3c64={'where':_0x44f200['where']};return db[_0x5578('0x2e')]['count'](_0x5a3c64)['then'](function(_0x2084a8){_0x2d28d5[_0x5578('0x20')]=_0x2084a8;if(_0x807da6[_0x5578('0x32')][_0x5578('0x40')]){_0x44f200['include']=[{'all':!![]}];}return db[_0x5578('0x2e')][_0x5578('0x41')](_0x44f200);})[_0x5578('0x28')](function(_0xade035){_0x2d28d5[_0x5578('0x42')]=_0xade035;return _0x2d28d5;})['then'](respondWithFilteredResult(_0x25fb3b,_0x44f200))[_0x5578('0x43')](handleError(_0x25fb3b,null));};exports[_0x5578('0x44')]=function(_0x535fdd,_0x410909){var _0x677d99={'raw':!![],'where':{'id':_0x535fdd['params']['id']}},_0x23ee49={};_0x23ee49[_0x5578('0x34')]=_[_0x5578('0x45')](db[_0x5578('0x2e')][_0x5578('0x2f')]);_0x23ee49['query']=_[_0x5578('0x45')](_0x535fdd[_0x5578('0x32')]);_0x23ee49[_0x5578('0x3c')]=_['intersection'](_0x23ee49['model'],_0x23ee49[_0x5578('0x32')]);_0x677d99[_0x5578('0x35')]=_['intersection'](_0x23ee49[_0x5578('0x34')],qs[_0x5578('0x36')](_0x535fdd[_0x5578('0x32')][_0x5578('0x36')]));_0x677d99[_0x5578('0x35')]=_0x677d99[_0x5578('0x35')][_0x5578('0x37')]?_0x677d99['attributes']:_0x23ee49['model'];if(_0x535fdd[_0x5578('0x32')][_0x5578('0x40')]){_0x677d99['include']=[{'all':!![]}];}_0x677d99=_['merge']({},_0x677d99,_0x535fdd[_0x5578('0x3f')]);return db[_0x5578('0x2e')][_0x5578('0x46')](_0x677d99)[_0x5578('0x28')](handleEntityNotFound(_0x410909,null))[_0x5578('0x28')](respondWithResult(_0x410909,null))[_0x5578('0x43')](handleError(_0x410909,null));};exports['create']=function(_0x5bb12c,_0x2ed4f9){return db[_0x5578('0x2e')][_0x5578('0x47')](_0x5bb12c[_0x5578('0x48')],{})[_0x5578('0x28')](respondWithResult(_0x2ed4f9,0xc9))[_0x5578('0x43')](handleError(_0x2ed4f9,null));};exports['update']=function(_0x1da278,_0x4da7bd){if(_0x1da278[_0x5578('0x48')]['id']){delete _0x1da278['body']['id'];}return db['ChatQueueReport'][_0x5578('0x46')]({'where':{'id':_0x1da278[_0x5578('0x49')]['id']}})[_0x5578('0x28')](handleEntityNotFound(_0x4da7bd,null))['then'](saveUpdates(_0x1da278[_0x5578('0x48')],null))[_0x5578('0x28')](respondWithResult(_0x4da7bd,null))[_0x5578('0x43')](handleError(_0x4da7bd,null));};exports[_0x5578('0x27')]=function(_0x4cc550,_0x34c9fd){return db[_0x5578('0x2e')]['find']({'where':{'id':_0x4cc550[_0x5578('0x49')]['id']}})[_0x5578('0x28')](handleEntityNotFound(_0x34c9fd,null))['then'](removeEntity(_0x34c9fd,null))[_0x5578('0x43')](handleError(_0x34c9fd,null));};exports['describe']=function(_0x8fdb59,_0x205275){return db[_0x5578('0x2e')][_0x5578('0x4a')]()[_0x5578('0x28')](respondWithResult(_0x205275,null))[_0x5578('0x43')](handleError(_0x205275,null));}; \ No newline at end of file +var _0xe08b=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0xe08b,0x10e));var _0xbe08=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xe08b[_0x26da89];return _0xc95b7b;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe08('0x1'));var jsonpatch=require(_0xbe08('0x2'));var rp=require('request-promise');var moment=require(_0xbe08('0x3'));var BPromise=require(_0xbe08('0x4'));var Mustache=require(_0xbe08('0x5'));var util=require(_0xbe08('0x6'));var path=require(_0xbe08('0x7'));var sox=require(_0xbe08('0x8'));var csv=require(_0xbe08('0x9'));var ejs=require(_0xbe08('0xa'));var fs=require('fs');var fs_extra=require(_0xbe08('0xb'));var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0x9'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ab71,_0x49410b){_0x49410b=_0x49410b||0xcc;return function(_0x18ee13){if(_0x18ee13){return _0x42ab71[_0xbe08('0x19')](_0x49410b);}return _0x42ab71[_0xbe08('0x1a')](_0x49410b)[_0xbe08('0x1b')]();};}function respondWithResult(_0xe1dafa,_0x3050f1){_0x3050f1=_0x3050f1||0xc8;return function(_0x434646){if(_0x434646){return _0xe1dafa[_0xbe08('0x1a')](_0x3050f1)[_0xbe08('0x1c')](_0x434646);}};}function respondWithFilteredResult(_0x191f51,_0x457129){return function(_0x2b0901){if(_0x2b0901){var _0x122f44=typeof _0x457129[_0xbe08('0x1d')]===_0xbe08('0x1e')&&typeof _0x457129[_0xbe08('0x1f')]===_0xbe08('0x1e');var _0x344019=_0x2b0901['count'];var _0x2fa9b3=_0x122f44?0x0:_0x457129[_0xbe08('0x1d')];var _0x154559=_0x122f44?_0x2b0901[_0xbe08('0x20')]:_0x457129[_0xbe08('0x1d')]+_0x457129[_0xbe08('0x1f')];var _0x1f9808;if(_0x154559>=_0x344019){_0x154559=_0x344019;_0x1f9808=0xc8;}else{_0x1f9808=0xce;}_0x191f51['status'](_0x1f9808);return _0x191f51[_0xbe08('0x21')](_0xbe08('0x22'),_0x2fa9b3+'-'+_0x154559+'/'+_0x344019)['json'](_0x2b0901);}return null;};}function patchUpdates(_0x5ab5f5){return function(_0x439a78){try{jsonpatch[_0xbe08('0x23')](_0x439a78,_0x5ab5f5,!![]);}catch(_0x3785e4){return BPromise['reject'](_0x3785e4);}return _0x439a78[_0xbe08('0x24')]();};}function saveUpdates(_0x25ce24,_0x42143c){return function(_0x45697b){if(_0x45697b){return _0x45697b[_0xbe08('0x25')](_0x25ce24)[_0xbe08('0x26')](function(_0xf1c94a){return _0xf1c94a;});}return null;};}function removeEntity(_0x451732,_0x2d6493){return function(_0x493d13){if(_0x493d13){return _0x493d13[_0xbe08('0x27')]()[_0xbe08('0x26')](function(){_0x451732[_0xbe08('0x1a')](0xcc)[_0xbe08('0x1b')]();});}};}function handleEntityNotFound(_0x3310be,_0x28d47b){return function(_0x368122){if(!_0x368122){_0x3310be[_0xbe08('0x19')](0x194);}return _0x368122;};}function handleError(_0x628624,_0x361b06){_0x361b06=_0x361b06||0x1f4;return function(_0x5e470c){logger[_0xbe08('0x28')](_0x5e470c[_0xbe08('0x29')]);if(_0x5e470c[_0xbe08('0x2a')]){delete _0x5e470c[_0xbe08('0x2a')];}_0x628624[_0xbe08('0x1a')](_0x361b06)[_0xbe08('0x2b')](_0x5e470c);};}exports['index']=function(_0x415da3,_0x2aaa12){var _0x3b77bb={},_0x465b7b={},_0x1135c3={'count':0x0,'rows':[]};var _0x523be0=_[_0xbe08('0x2c')](db[_0xbe08('0x2d')][_0xbe08('0x2e')],function(_0x54c913){return{'name':_0x54c913[_0xbe08('0x2f')],'type':_0x54c913[_0xbe08('0x30')]['key']};});_0x465b7b[_0xbe08('0x31')]=_[_0xbe08('0x2c')](_0x523be0,'name');_0x465b7b[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x415da3[_0xbe08('0x32')]);_0x465b7b[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],_0x465b7b[_0xbe08('0x32')]);_0x3b77bb[_0xbe08('0x36')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x37')]));_0x3b77bb[_0xbe08('0x36')]=_0x3b77bb[_0xbe08('0x36')]['length']?_0x3b77bb['attributes']:_0x465b7b[_0xbe08('0x31')];if(!_0x415da3[_0xbe08('0x32')]['hasOwnProperty'](_0xbe08('0x38'))){_0x3b77bb[_0xbe08('0x1f')]=qs[_0xbe08('0x1f')](_0x415da3[_0xbe08('0x32')]['limit']);_0x3b77bb[_0xbe08('0x1d')]=qs[_0xbe08('0x1d')](_0x415da3['query']['offset']);}_0x3b77bb[_0xbe08('0x39')]=qs[_0xbe08('0x3a')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x3a')]);_0x3b77bb['where']=qs[_0xbe08('0x34')](_['pick'](_0x415da3[_0xbe08('0x32')],_0x465b7b[_0xbe08('0x34')]),_0x523be0);if(_0x415da3['query'][_0xbe08('0x3b')]){_0x3b77bb[_0xbe08('0x3c')]=_[_0xbe08('0x3d')](_0x3b77bb[_0xbe08('0x3c')],{'$or':_[_0xbe08('0x2c')](_0x523be0,function(_0x56db9c){if(_0x56db9c[_0xbe08('0x30')]!==_0xbe08('0x3e')){var _0x2c80d7={};_0x2c80d7[_0x56db9c[_0xbe08('0x2a')]]={'$like':'%'+_0x415da3[_0xbe08('0x32')][_0xbe08('0x3b')]+'%'};return _0x2c80d7;}})});}_0x3b77bb=_[_0xbe08('0x3d')]({},_0x3b77bb,_0x415da3[_0xbe08('0x3f')]);var _0x357158={'where':_0x3b77bb['where']};return db[_0xbe08('0x2d')][_0xbe08('0x20')](_0x357158)['then'](function(_0x4f0bbe){_0x1135c3[_0xbe08('0x20')]=_0x4f0bbe;if(_0x415da3['query'][_0xbe08('0x40')]){_0x3b77bb['include']=[{'all':!![]}];}return db[_0xbe08('0x2d')][_0xbe08('0x41')](_0x3b77bb);})[_0xbe08('0x26')](function(_0x337c2b){_0x1135c3[_0xbe08('0x42')]=_0x337c2b;return _0x1135c3;})[_0xbe08('0x26')](respondWithFilteredResult(_0x2aaa12,_0x3b77bb))[_0xbe08('0x43')](handleError(_0x2aaa12,null));};exports['show']=function(_0x274139,_0x16d412){var _0x4b4d7a={'raw':!![],'where':{'id':_0x274139['params']['id']}},_0x59179f={};_0x59179f[_0xbe08('0x31')]=_[_0xbe08('0x33')](db['ChatQueueReport']['rawAttributes']);_0x59179f[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x274139[_0xbe08('0x32')]);_0x59179f[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x59179f[_0xbe08('0x31')],_0x59179f[_0xbe08('0x32')]);_0x4b4d7a[_0xbe08('0x36')]=_['intersection'](_0x59179f[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x274139[_0xbe08('0x32')][_0xbe08('0x37')]));_0x4b4d7a[_0xbe08('0x36')]=_0x4b4d7a[_0xbe08('0x36')][_0xbe08('0x44')]?_0x4b4d7a['attributes']:_0x59179f['model'];if(_0x274139[_0xbe08('0x32')][_0xbe08('0x40')]){_0x4b4d7a[_0xbe08('0x45')]=[{'all':!![]}];}_0x4b4d7a=_[_0xbe08('0x3d')]({},_0x4b4d7a,_0x274139[_0xbe08('0x3f')]);return db['ChatQueueReport']['find'](_0x4b4d7a)['then'](handleEntityNotFound(_0x16d412,null))[_0xbe08('0x26')](respondWithResult(_0x16d412,null))['catch'](handleError(_0x16d412,null));};exports['create']=function(_0x1e6e6e,_0x9a9e38){return db[_0xbe08('0x2d')][_0xbe08('0x46')](_0x1e6e6e[_0xbe08('0x47')],{})[_0xbe08('0x26')](respondWithResult(_0x9a9e38,0xc9))[_0xbe08('0x43')](handleError(_0x9a9e38,null));};exports[_0xbe08('0x25')]=function(_0x592a7e,_0x2bd33a){if(_0x592a7e[_0xbe08('0x47')]['id']){delete _0x592a7e[_0xbe08('0x47')]['id'];}return db['ChatQueueReport'][_0xbe08('0x48')]({'where':{'id':_0x592a7e[_0xbe08('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bd33a,null))[_0xbe08('0x26')](saveUpdates(_0x592a7e[_0xbe08('0x47')],null))['then'](respondWithResult(_0x2bd33a,null))[_0xbe08('0x43')](handleError(_0x2bd33a,null));};exports[_0xbe08('0x27')]=function(_0x50c0ec,_0x52c6f1){return db['ChatQueueReport']['find']({'where':{'id':_0x50c0ec['params']['id']}})[_0xbe08('0x26')](handleEntityNotFound(_0x52c6f1,null))[_0xbe08('0x26')](removeEntity(_0x52c6f1,null))['catch'](handleError(_0x52c6f1,null));};exports['describe']=function(_0x2ecf8d,_0x3b0488){return db[_0xbe08('0x2d')][_0xbe08('0x4a')]()[_0xbe08('0x26')](respondWithResult(_0x3b0488,null))[_0xbe08('0x43')](handleError(_0x3b0488,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9834cc0..888085f 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x47e9da,_0x46a2d6){var _0x2d0e15=function(_0x855457){while(--_0x855457){_0x47e9da['push'](_0x47e9da['shift']());}};_0x2d0e15(++_0x46a2d6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36f16e,_0x4b7a16){var _0x5967c4=function(_0x570e32){while(--_0x570e32){_0x36f16e['push'](_0x36f16e['shift']());}};_0x5967c4(++_0x4b7a16);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 74a7265..1308534 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 _0x0246=['stringify','error','code','message','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','ChatQueueReport','where','limit','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x556654,_0x3fd5ba){var _0x48c4d2=function(_0x3aba78){while(--_0x3aba78){_0x556654['push'](_0x556654['shift']());}};_0x48c4d2(++_0x3fd5ba);}(_0x0246,0x1c1));var _0x6024=function(_0x45de6d,_0xccce5b){_0x45de6d=_0x45de6d-0x0;var _0x596bda=_0x0246[_0x45de6d];return _0x596bda;};'use strict';var _=require(_0x6024('0x0'));var util=require(_0x6024('0x1'));var moment=require(_0x6024('0x2'));var BPromise=require(_0x6024('0x3'));var rs=require(_0x6024('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6024('0x5'));var logger=require('../../config/logger')(_0x6024('0x6'));var config=require('../../config/environment');var jayson=require(_0x6024('0x7'));var client=jayson[_0x6024('0x8')][_0x6024('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50255f,_0x5ec5a2,_0x355165){return new BPromise(function(_0x9ec4b5,_0x24b563){return client[_0x6024('0xa')](_0x50255f,_0x355165)[_0x6024('0xb')](function(_0x7f4c9d){logger[_0x6024('0xc')](_0x6024('0xd'),_0x5ec5a2,_0x6024('0xe'));logger['debug'](_0x6024('0xf'),_0x5ec5a2,'request\x20sent',JSON[_0x6024('0x10')](_0x7f4c9d));if(_0x7f4c9d[_0x6024('0x11')]){if(_0x7f4c9d['error'][_0x6024('0x12')]===0x1f4){logger[_0x6024('0x11')](_0x6024('0xd'),_0x5ec5a2,_0x7f4c9d['error'][_0x6024('0x13')]);return _0x24b563(_0x7f4c9d[_0x6024('0x11')][_0x6024('0x13')]);}logger[_0x6024('0x11')](_0x6024('0xd'),_0x5ec5a2,_0x7f4c9d[_0x6024('0x11')]['message']);return _0x9ec4b5(_0x7f4c9d['error'][_0x6024('0x13')]);}else{logger[_0x6024('0xc')](_0x6024('0xd'),_0x5ec5a2,_0x6024('0xe'));_0x9ec4b5(_0x7f4c9d['result'][_0x6024('0x13')]);}})[_0x6024('0x14')](function(_0x28bf6c){logger['error'](_0x6024('0xd'),_0x5ec5a2,_0x28bf6c);_0x24b563(_0x28bf6c);});});}exports[_0x6024('0x15')]=function(_0x1dc902){var _0x394cb9=this;return new Promise(function(_0x22ec9d,_0x294af6){return db['ChatQueueReport'][_0x6024('0x16')](_0x1dc902[_0x6024('0x17')],{'raw':_0x1dc902['options']?_0x1dc902[_0x6024('0x18')][_0x6024('0x19')]===undefined?!![]:![]:!![]})[_0x6024('0xb')](function(_0x523585){logger[_0x6024('0xc')](_0x6024('0x15'),_0x1dc902);logger['debug'](_0x6024('0x15'),_0x1dc902,JSON['stringify'](_0x523585));_0x22ec9d(_0x523585);})[_0x6024('0x14')](function(_0x104515){logger['error'](_0x6024('0x15'),_0x104515[_0x6024('0x13')],_0x1dc902);_0x294af6(_0x394cb9[_0x6024('0x11')](0x1f4,_0x104515[_0x6024('0x13')]));});});};exports[_0x6024('0x1a')]=function(_0x535fcf){var _0x1b5aff=this;return new Promise(function(_0x396392,_0x212373){return db[_0x6024('0x1b')]['update'](_0x535fcf[_0x6024('0x17')],{'raw':_0x535fcf[_0x6024('0x18')]?_0x535fcf[_0x6024('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535fcf['options']?_0x535fcf['options'][_0x6024('0x1c')]||null:null,'attributes':_0x535fcf['options']?_0x535fcf[_0x6024('0x18')]['attributes']||null:null,'limit':_0x535fcf[_0x6024('0x18')]?_0x535fcf[_0x6024('0x18')][_0x6024('0x1d')]||null:null})[_0x6024('0xb')](function(_0x4fd30a){logger['info'](_0x6024('0x1a'),_0x535fcf);logger[_0x6024('0x1e')](_0x6024('0x1a'),_0x535fcf,JSON['stringify'](_0x4fd30a));_0x396392(_0x4fd30a);})[_0x6024('0x14')](function(_0x5c0fb8){logger[_0x6024('0x11')](_0x6024('0x1a'),_0x5c0fb8[_0x6024('0x13')],_0x535fcf);_0x212373(_0x1b5aff[_0x6024('0x11')](0x1f4,_0x5c0fb8['message']));});});}; \ No newline at end of file +var _0x9c9c=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','raw','UpdateChatQueueReport','update','body','options','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x334fa2,_0x147cc6){var _0x3a1066=function(_0xeb20b){while(--_0xeb20b){_0x334fa2['push'](_0x334fa2['shift']());}};_0x3a1066(++_0x147cc6);}(_0x9c9c,0x1a4));var _0xc9c9=function(_0x22fc1d,_0x5b8ee1){_0x22fc1d=_0x22fc1d-0x0;var _0x29e032=_0x9c9c[_0x22fc1d];return _0x29e032;};'use strict';var _=require(_0xc9c9('0x0'));var util=require(_0xc9c9('0x1'));var moment=require(_0xc9c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9c9('0x3'));var fs=require('fs');var Redis=require(_0xc9c9('0x4'));var db=require(_0xc9c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9c9('0x6')][_0xc9c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ae062,_0x54a7d2,_0x2b3df){return new BPromise(function(_0x1e3d50,_0x4feac9){return client[_0xc9c9('0x8')](_0x1ae062,_0x2b3df)[_0xc9c9('0x9')](function(_0x462948){logger[_0xc9c9('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x54a7d2,_0xc9c9('0xb'));logger[_0xc9c9('0xc')](_0xc9c9('0xd'),_0x54a7d2,_0xc9c9('0xb'),JSON[_0xc9c9('0xe')](_0x462948));if(_0x462948[_0xc9c9('0xf')]){if(_0x462948[_0xc9c9('0xf')][_0xc9c9('0x10')]===0x1f4){logger[_0xc9c9('0xf')](_0xc9c9('0x11'),_0x54a7d2,_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);return _0x4feac9(_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);}logger['error'](_0xc9c9('0x11'),_0x54a7d2,_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);return _0x1e3d50(_0x462948['error'][_0xc9c9('0x12')]);}else{logger[_0xc9c9('0xa')](_0xc9c9('0x11'),_0x54a7d2,_0xc9c9('0xb'));_0x1e3d50(_0x462948[_0xc9c9('0x13')][_0xc9c9('0x12')]);}})[_0xc9c9('0x14')](function(_0x59c94d){logger[_0xc9c9('0xf')](_0xc9c9('0x11'),_0x54a7d2,_0x59c94d);_0x4feac9(_0x59c94d);});});}exports[_0xc9c9('0x15')]=function(_0x1d2e29){var _0x2ac465=this;return new Promise(function(_0x418b43,_0xef507f){return db[_0xc9c9('0x16')]['create'](_0x1d2e29['body'],{'raw':_0x1d2e29['options']?_0x1d2e29['options'][_0xc9c9('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x244638){logger[_0xc9c9('0xa')](_0xc9c9('0x15'),_0x1d2e29);logger[_0xc9c9('0xc')](_0xc9c9('0x15'),_0x1d2e29,JSON['stringify'](_0x244638));_0x418b43(_0x244638);})[_0xc9c9('0x14')](function(_0x4642a8){logger[_0xc9c9('0xf')](_0xc9c9('0x15'),_0x4642a8['message'],_0x1d2e29);_0xef507f(_0x2ac465['error'](0x1f4,_0x4642a8[_0xc9c9('0x12')]));});});};exports[_0xc9c9('0x18')]=function(_0x322f8c){var _0x181ede=this;return new Promise(function(_0x42c3ba,_0x3a1770){return db[_0xc9c9('0x16')][_0xc9c9('0x19')](_0x322f8c[_0xc9c9('0x1a')],{'raw':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1c')]||null:null,'attributes':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1d')]||null:null,'limit':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1e')]||null:null})[_0xc9c9('0x9')](function(_0x4e2b8e){logger[_0xc9c9('0xa')](_0xc9c9('0x18'),_0x322f8c);logger[_0xc9c9('0xc')](_0xc9c9('0x18'),_0x322f8c,JSON[_0xc9c9('0xe')](_0x4e2b8e));_0x42c3ba(_0x4e2b8e);})[_0xc9c9('0x14')](function(_0x2f738c){logger[_0xc9c9('0xf')](_0xc9c9('0x18'),_0x2f738c['message'],_0x322f8c);_0x3a1770(_0x181ede[_0xc9c9('0xf')](0x1f4,_0x2f738c[_0xc9c9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index aa503ae..8913f1b 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 _0x5c20=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x2cb0c1,_0x426f52){var _0xe59b55=function(_0xdab165){while(--_0xdab165){_0x2cb0c1['push'](_0x2cb0c1['shift']());}};_0xe59b55(++_0x426f52);}(_0x5c20,0x1e4));var _0x05c2=function(_0x170310,_0x31acf9){_0x170310=_0x170310-0x0;var _0x1b6006=_0x5c20[_0x170310];return _0x1b6006;};'use strict';var multer=require(_0x05c2('0x0'));var util=require(_0x05c2('0x1'));var path=require(_0x05c2('0x2'));var timeout=require(_0x05c2('0x3'));var express=require('express');var router=express[_0x05c2('0x4')]();var fs_extra=require(_0x05c2('0x5'));var auth=require(_0x05c2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05c2('0x7'));var controller=require(_0x05c2('0x8'));router['get']('/',auth[_0x05c2('0x9')](),controller[_0x05c2('0xa')]);router[_0x05c2('0xb')](_0x05c2('0xc'),auth['isAuthenticated'](),controller[_0x05c2('0xd')]);router[_0x05c2('0xb')](_0x05c2('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x05c2('0xf')]('/',auth[_0x05c2('0x9')](),controller['create']);router[_0x05c2('0x10')](_0x05c2('0xe'),auth[_0x05c2('0x9')](),controller[_0x05c2('0x11')]);router[_0x05c2('0x12')](_0x05c2('0xe'),auth[_0x05c2('0x9')](),controller['destroy']);module[_0x05c2('0x13')]=router; \ No newline at end of file +var _0x0ee5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','update','destroy','path','connect-timeout','express'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x0ee5,0xcd));var _0x50ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0ee5[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x50ee('0x0'));var timeout=require(_0x50ee('0x1'));var express=require(_0x50ee('0x2'));var router=express[_0x50ee('0x3')]();var fs_extra=require(_0x50ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x50ee('0x5'));var config=require(_0x50ee('0x6'));var controller=require(_0x50ee('0x7'));router[_0x50ee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x50ee('0x9')](),controller[_0x50ee('0xa')]);router[_0x50ee('0x8')](_0x50ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x50ee('0xc')]('/',auth[_0x50ee('0x9')](),controller[_0x50ee('0xd')]);router['put'](_0x50ee('0xb'),auth[_0x50ee('0x9')](),controller[_0x50ee('0xe')]);router['delete']('/:id',auth[_0x50ee('0x9')](),controller[_0x50ee('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 55e20e2..a55a685 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x10f604,_0x120edd){var _0x17119d=function(_0x5e7336){while(--_0x5e7336){_0x10f604['push'](_0x10f604['shift']());}};_0x17119d(++_0x120edd);}(_0xaa88,0x137));var _0x8aa8=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xaa88[_0x1ed116];return _0x574066;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x52cd64,_0x3d18a0){var _0x90fb85=function(_0x24c71f){while(--_0x24c71f){_0x52cd64['push'](_0x52cd64['shift']());}};_0x90fb85(++_0x3d18a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x35dc22,_0x1a4b64){_0x35dc22=_0x35dc22-0x0;var _0x56d8e6=_0xedd9[_0x35dc22];return _0x56d8e6;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a034a6c..ded5cca 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 _0x9d2b=['stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x54ce76,_0x541ef9){var _0x5908d0=function(_0x369d48){while(--_0x369d48){_0x54ce76['push'](_0x54ce76['shift']());}};_0x5908d0(++_0x541ef9);}(_0x9d2b,0x15d));var _0xb9d2=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x9d2b[_0x2e04ef];return _0x5722b0;};'use strict';var emlformat=require(_0xb9d2('0x0'));var rimraf=require(_0xb9d2('0x1'));var zipdir=require(_0xb9d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d2('0x3'));var moment=require('moment');var BPromise=require(_0xb9d2('0x4'));var Mustache=require(_0xb9d2('0x5'));var util=require('util');var path=require(_0xb9d2('0x6'));var sox=require(_0xb9d2('0x7'));var csv=require(_0xb9d2('0x8'));var ejs=require(_0xb9d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9d2('0xa'));var squel=require(_0xb9d2('0xb'));var crypto=require(_0xb9d2('0xc'));var jsforce=require(_0xb9d2('0xd'));var deskjs=require(_0xb9d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb9d2('0xf'));var qs=require(_0xb9d2('0x10'));var as=require(_0xb9d2('0x11'));var hardwareService=require(_0xb9d2('0x12'));var logger=require(_0xb9d2('0x13'))(_0xb9d2('0x14'));var utils=require(_0xb9d2('0x15'));var config=require(_0xb9d2('0x16'));var licenseUtil=require(_0xb9d2('0x17'));var db=require(_0xb9d2('0x18'))['db'];function respondWithStatusCode(_0x1b4535,_0x381216){_0x381216=_0x381216||0xcc;return function(_0xfd625d){if(_0xfd625d){return _0x1b4535[_0xb9d2('0x19')](_0x381216);}return _0x1b4535[_0xb9d2('0x1a')](_0x381216)[_0xb9d2('0x1b')]();};}function respondWithResult(_0xbfe12,_0x215fe1){_0x215fe1=_0x215fe1||0xc8;return function(_0x3b0d4f){if(_0x3b0d4f){return _0xbfe12[_0xb9d2('0x1a')](_0x215fe1)[_0xb9d2('0x1c')](_0x3b0d4f);}};}function respondWithFilteredResult(_0xd2d92d,_0x4b7836){return function(_0x3e4ce5){if(_0x3e4ce5){var _0x21016a=typeof _0x4b7836[_0xb9d2('0x1d')]===_0xb9d2('0x1e')&&typeof _0x4b7836['limit']==='undefined';var _0x590c2b=_0x3e4ce5[_0xb9d2('0x1f')];var _0x6a8d68=_0x21016a?0x0:_0x4b7836[_0xb9d2('0x1d')];var _0x5cf558=_0x21016a?_0x3e4ce5[_0xb9d2('0x1f')]:_0x4b7836[_0xb9d2('0x1d')]+_0x4b7836[_0xb9d2('0x20')];var _0x360b31;if(_0x5cf558>=_0x590c2b){_0x5cf558=_0x590c2b;_0x360b31=0xc8;}else{_0x360b31=0xce;}_0xd2d92d['status'](_0x360b31);return _0xd2d92d[_0xb9d2('0x21')](_0xb9d2('0x22'),_0x6a8d68+'-'+_0x5cf558+'/'+_0x590c2b)['json'](_0x3e4ce5);}return null;};}function patchUpdates(_0x5e7e0a){return function(_0x490aab){try{jsonpatch[_0xb9d2('0x23')](_0x490aab,_0x5e7e0a,!![]);}catch(_0x120bf4){return BPromise[_0xb9d2('0x24')](_0x120bf4);}return _0x490aab[_0xb9d2('0x25')]();};}function saveUpdates(_0x59379d,_0x118c55){return function(_0x5e423a){if(_0x5e423a){return _0x5e423a[_0xb9d2('0x26')](_0x59379d)[_0xb9d2('0x27')](function(_0x5a46f6){return _0x5a46f6;});}return null;};}function removeEntity(_0x3c11b2,_0x225f84){return function(_0x1cfb3b){if(_0x1cfb3b){return _0x1cfb3b[_0xb9d2('0x28')]()[_0xb9d2('0x27')](function(){_0x3c11b2[_0xb9d2('0x1a')](0xcc)[_0xb9d2('0x1b')]();});}};}function handleEntityNotFound(_0xc7d770,_0x4fdb74){return function(_0x1ad5c7){if(!_0x1ad5c7){_0xc7d770[_0xb9d2('0x19')](0x194);}return _0x1ad5c7;};}function handleError(_0x44b52b,_0x6e9f9b){_0x6e9f9b=_0x6e9f9b||0x1f4;return function(_0x3695ae){logger['error'](_0x3695ae[_0xb9d2('0x29')]);if(_0x3695ae[_0xb9d2('0x2a')]){delete _0x3695ae['name'];}_0x44b52b[_0xb9d2('0x1a')](_0x6e9f9b)[_0xb9d2('0x2b')](_0x3695ae);};}exports[_0xb9d2('0x2c')]=function(_0x4bd696,_0x5d37e1){var _0x231ef2={},_0x3fed60={},_0x1a667e={'count':0x0,'rows':[]};var _0x509a5f=_[_0xb9d2('0x2d')](db[_0xb9d2('0x2e')][_0xb9d2('0x2f')],function(_0x2e8dfd){return{'name':_0x2e8dfd[_0xb9d2('0x30')],'type':_0x2e8dfd['type'][_0xb9d2('0x31')]};});_0x3fed60['model']=_['map'](_0x509a5f,'name');_0x3fed60[_0xb9d2('0x32')]=_['keys'](_0x4bd696['query']);_0x3fed60[_0xb9d2('0x33')]=_[_0xb9d2('0x34')](_0x3fed60[_0xb9d2('0x35')],_0x3fed60[_0xb9d2('0x32')]);_0x231ef2['attributes']=_['intersection'](_0x3fed60[_0xb9d2('0x35')],qs[_0xb9d2('0x36')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x36')]));_0x231ef2['attributes']=_0x231ef2['attributes'][_0xb9d2('0x37')]?_0x231ef2[_0xb9d2('0x38')]:_0x3fed60['model'];if(!_0x4bd696['query'][_0xb9d2('0x39')](_0xb9d2('0x3a'))){_0x231ef2[_0xb9d2('0x20')]=qs[_0xb9d2('0x20')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x20')]);_0x231ef2[_0xb9d2('0x1d')]=qs[_0xb9d2('0x1d')](_0x4bd696[_0xb9d2('0x32')]['offset']);}_0x231ef2['order']=qs[_0xb9d2('0x3b')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3b')]);_0x231ef2[_0xb9d2('0x3c')]=qs[_0xb9d2('0x33')](_[_0xb9d2('0x3d')](_0x4bd696[_0xb9d2('0x32')],_0x3fed60[_0xb9d2('0x33')]),_0x509a5f);if(_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3e')]){_0x231ef2[_0xb9d2('0x3c')]=_[_0xb9d2('0x3f')](_0x231ef2[_0xb9d2('0x3c')],{'$or':_[_0xb9d2('0x2d')](_0x509a5f,function(_0x532a09){if(_0x532a09['type']!==_0xb9d2('0x40')){var _0x458269={};_0x458269[_0x532a09['name']]={'$like':'%'+_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3e')]+'%'};return _0x458269;}})});}_0x231ef2=_[_0xb9d2('0x3f')]({},_0x231ef2,_0x4bd696[_0xb9d2('0x41')]);var _0x399c36={'where':_0x231ef2[_0xb9d2('0x3c')]};return db[_0xb9d2('0x2e')][_0xb9d2('0x1f')](_0x399c36)[_0xb9d2('0x27')](function(_0x436ee1){_0x1a667e['count']=_0x436ee1;if(_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x42')]){_0x231ef2[_0xb9d2('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xb9d2('0x44')](_0x231ef2);})['then'](function(_0x5ce7b8){_0x1a667e[_0xb9d2('0x45')]=_0x5ce7b8;return _0x1a667e;})[_0xb9d2('0x27')](respondWithFilteredResult(_0x5d37e1,_0x231ef2))['catch'](handleError(_0x5d37e1,null));};exports[_0xb9d2('0x46')]=function(_0x2bf800,_0x1a83f9){var _0x28929e={'raw':!![],'where':{'id':_0x2bf800[_0xb9d2('0x47')]['id']}},_0x267d7c={};_0x267d7c[_0xb9d2('0x35')]=_['keys'](db[_0xb9d2('0x2e')]['rawAttributes']);_0x267d7c[_0xb9d2('0x32')]=_[_0xb9d2('0x48')](_0x2bf800[_0xb9d2('0x32')]);_0x267d7c[_0xb9d2('0x33')]=_['intersection'](_0x267d7c[_0xb9d2('0x35')],_0x267d7c[_0xb9d2('0x32')]);_0x28929e[_0xb9d2('0x38')]=_[_0xb9d2('0x34')](_0x267d7c[_0xb9d2('0x35')],qs[_0xb9d2('0x36')](_0x2bf800[_0xb9d2('0x32')][_0xb9d2('0x36')]));_0x28929e[_0xb9d2('0x38')]=_0x28929e[_0xb9d2('0x38')][_0xb9d2('0x37')]?_0x28929e[_0xb9d2('0x38')]:_0x267d7c['model'];if(_0x2bf800[_0xb9d2('0x32')][_0xb9d2('0x42')]){_0x28929e[_0xb9d2('0x43')]=[{'all':!![]}];}_0x28929e=_[_0xb9d2('0x3f')]({},_0x28929e,_0x2bf800[_0xb9d2('0x41')]);return db[_0xb9d2('0x2e')][_0xb9d2('0x49')](_0x28929e)[_0xb9d2('0x27')](handleEntityNotFound(_0x1a83f9,null))[_0xb9d2('0x27')](respondWithResult(_0x1a83f9,null))['catch'](handleError(_0x1a83f9,null));};exports[_0xb9d2('0x4a')]=function(_0x21e1b6,_0x704924){return db[_0xb9d2('0x2e')][_0xb9d2('0x4a')](_0x21e1b6[_0xb9d2('0x4b')],{})[_0xb9d2('0x27')](respondWithResult(_0x704924,0xc9))[_0xb9d2('0x4c')](handleError(_0x704924,null));};exports[_0xb9d2('0x26')]=function(_0x3bf264,_0xd13b87){if(_0x3bf264[_0xb9d2('0x4b')]['id']){delete _0x3bf264[_0xb9d2('0x4b')]['id'];}return db[_0xb9d2('0x2e')]['find']({'where':{'id':_0x3bf264[_0xb9d2('0x47')]['id']}})[_0xb9d2('0x27')](handleEntityNotFound(_0xd13b87,null))[_0xb9d2('0x27')](saveUpdates(_0x3bf264['body'],null))[_0xb9d2('0x27')](respondWithResult(_0xd13b87,null))['catch'](handleError(_0xd13b87,null));};exports['destroy']=function(_0x32cc54,_0x2fb812){return db[_0xb9d2('0x2e')][_0xb9d2('0x49')]({'where':{'id':_0x32cc54[_0xb9d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fb812,null))['then'](removeEntity(_0x2fb812,null))[_0xb9d2('0x4c')](handleError(_0x2fb812,null));};exports[_0xb9d2('0x4d')]=function(_0x98baf5,_0x1f7023){return db[_0xb9d2('0x2e')][_0xb9d2('0x4d')]()['then'](respondWithResult(_0x1f7023,null))[_0xb9d2('0x4c')](handleError(_0x1f7023,null));}; \ No newline at end of file +var _0xdb24=['index','map','ChatTransferReport','rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','then','destroy','error','stack','name','send'];(function(_0x507d89,_0x4f46a4){var _0x2cc381=function(_0x132c2d){while(--_0x132c2d){_0x507d89['push'](_0x507d89['shift']());}};_0x2cc381(++_0x4f46a4);}(_0xdb24,0x18e));var _0x4db2=function(_0x4e2bf9,_0x43a8ea){_0x4e2bf9=_0x4e2bf9-0x0;var _0x51c21e=_0xdb24[_0x4e2bf9];return _0x51c21e;};'use strict';var emlformat=require(_0x4db2('0x0'));var rimraf=require(_0x4db2('0x1'));var zipdir=require(_0x4db2('0x2'));var jsonpatch=require(_0x4db2('0x3'));var rp=require('request-promise');var moment=require(_0x4db2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4db2('0x5'));var util=require(_0x4db2('0x6'));var path=require('path');var sox=require(_0x4db2('0x7'));var csv=require(_0x4db2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db2('0x9'));var _=require(_0x4db2('0xa'));var squel=require(_0x4db2('0xb'));var crypto=require(_0x4db2('0xc'));var jsforce=require(_0x4db2('0xd'));var deskjs=require(_0x4db2('0xe'));var toCsv=require(_0x4db2('0x8'));var querystring=require('querystring');var Papa=require(_0x4db2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4db2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4db2('0x11'));var logger=require(_0x4db2('0x12'))(_0x4db2('0x13'));var utils=require(_0x4db2('0x14'));var config=require(_0x4db2('0x15'));var licenseUtil=require(_0x4db2('0x16'));var db=require(_0x4db2('0x17'))['db'];function respondWithStatusCode(_0x3741db,_0x3fed12){_0x3fed12=_0x3fed12||0xcc;return function(_0x535d40){if(_0x535d40){return _0x3741db[_0x4db2('0x18')](_0x3fed12);}return _0x3741db[_0x4db2('0x19')](_0x3fed12)[_0x4db2('0x1a')]();};}function respondWithResult(_0x532628,_0x2af98e){_0x2af98e=_0x2af98e||0xc8;return function(_0x559970){if(_0x559970){return _0x532628['status'](_0x2af98e)[_0x4db2('0x1b')](_0x559970);}};}function respondWithFilteredResult(_0x2788c4,_0x590b2b){return function(_0x2b81f7){if(_0x2b81f7){var _0x2c29e8=typeof _0x590b2b[_0x4db2('0x1c')]===_0x4db2('0x1d')&&typeof _0x590b2b['limit']===_0x4db2('0x1d');var _0x9ba8c0=_0x2b81f7['count'];var _0x1931d5=_0x2c29e8?0x0:_0x590b2b[_0x4db2('0x1c')];var _0x2aaec9=_0x2c29e8?_0x2b81f7['count']:_0x590b2b['offset']+_0x590b2b[_0x4db2('0x1e')];var _0x104bed;if(_0x2aaec9>=_0x9ba8c0){_0x2aaec9=_0x9ba8c0;_0x104bed=0xc8;}else{_0x104bed=0xce;}_0x2788c4[_0x4db2('0x19')](_0x104bed);return _0x2788c4[_0x4db2('0x1f')](_0x4db2('0x20'),_0x1931d5+'-'+_0x2aaec9+'/'+_0x9ba8c0)[_0x4db2('0x1b')](_0x2b81f7);}return null;};}function patchUpdates(_0x343755){return function(_0x457586){try{jsonpatch['apply'](_0x457586,_0x343755,!![]);}catch(_0x269f58){return BPromise['reject'](_0x269f58);}return _0x457586[_0x4db2('0x21')]();};}function saveUpdates(_0x103b39,_0x5592eb){return function(_0xeaf744){if(_0xeaf744){return _0xeaf744['update'](_0x103b39)[_0x4db2('0x22')](function(_0x660f85){return _0x660f85;});}return null;};}function removeEntity(_0x143e07,_0x104098){return function(_0x4375b2){if(_0x4375b2){return _0x4375b2[_0x4db2('0x23')]()['then'](function(){_0x143e07[_0x4db2('0x19')](0xcc)[_0x4db2('0x1a')]();});}};}function handleEntityNotFound(_0x229934,_0x157bb8){return function(_0x5e3831){if(!_0x5e3831){_0x229934[_0x4db2('0x18')](0x194);}return _0x5e3831;};}function handleError(_0x245dbb,_0x386a70){_0x386a70=_0x386a70||0x1f4;return function(_0x1857aa){logger[_0x4db2('0x24')](_0x1857aa[_0x4db2('0x25')]);if(_0x1857aa[_0x4db2('0x26')]){delete _0x1857aa['name'];}_0x245dbb[_0x4db2('0x19')](_0x386a70)[_0x4db2('0x27')](_0x1857aa);};}exports[_0x4db2('0x28')]=function(_0x13fef7,_0x316a75){var _0x5756cb={},_0x2924c6={},_0x306931={'count':0x0,'rows':[]};var _0x5ab071=_[_0x4db2('0x29')](db[_0x4db2('0x2a')][_0x4db2('0x2b')],function(_0x54fc54){return{'name':_0x54fc54['fieldName'],'type':_0x54fc54[_0x4db2('0x2c')]['key']};});_0x2924c6[_0x4db2('0x2d')]=_[_0x4db2('0x29')](_0x5ab071,_0x4db2('0x26'));_0x2924c6['query']=_[_0x4db2('0x2e')](_0x13fef7['query']);_0x2924c6['filters']=_[_0x4db2('0x2f')](_0x2924c6[_0x4db2('0x2d')],_0x2924c6[_0x4db2('0x30')]);_0x5756cb[_0x4db2('0x31')]=_[_0x4db2('0x2f')](_0x2924c6['model'],qs['fields'](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x32')]));_0x5756cb[_0x4db2('0x31')]=_0x5756cb['attributes'][_0x4db2('0x33')]?_0x5756cb[_0x4db2('0x31')]:_0x2924c6['model'];if(!_0x13fef7['query'][_0x4db2('0x34')](_0x4db2('0x35'))){_0x5756cb['limit']=qs[_0x4db2('0x1e')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x1e')]);_0x5756cb[_0x4db2('0x1c')]=qs[_0x4db2('0x1c')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x1c')]);}_0x5756cb[_0x4db2('0x36')]=qs[_0x4db2('0x37')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x37')]);_0x5756cb[_0x4db2('0x38')]=qs[_0x4db2('0x39')](_[_0x4db2('0x3a')](_0x13fef7['query'],_0x2924c6['filters']),_0x5ab071);if(_0x13fef7[_0x4db2('0x30')][_0x4db2('0x3b')]){_0x5756cb[_0x4db2('0x38')]=_[_0x4db2('0x3c')](_0x5756cb[_0x4db2('0x38')],{'$or':_['map'](_0x5ab071,function(_0x225df8){if(_0x225df8['type']!=='VIRTUAL'){var _0xc75225={};_0xc75225[_0x225df8[_0x4db2('0x26')]]={'$like':'%'+_0x13fef7[_0x4db2('0x30')]['filter']+'%'};return _0xc75225;}})});}_0x5756cb=_[_0x4db2('0x3c')]({},_0x5756cb,_0x13fef7[_0x4db2('0x3d')]);var _0x4b393e={'where':_0x5756cb['where']};return db[_0x4db2('0x2a')][_0x4db2('0x3e')](_0x4b393e)[_0x4db2('0x22')](function(_0x44d3da){_0x306931[_0x4db2('0x3e')]=_0x44d3da;if(_0x13fef7[_0x4db2('0x30')][_0x4db2('0x3f')]){_0x5756cb[_0x4db2('0x40')]=[{'all':!![]}];}return db[_0x4db2('0x2a')][_0x4db2('0x41')](_0x5756cb);})['then'](function(_0x5ca982){_0x306931['rows']=_0x5ca982;return _0x306931;})[_0x4db2('0x22')](respondWithFilteredResult(_0x316a75,_0x5756cb))[_0x4db2('0x42')](handleError(_0x316a75,null));};exports['show']=function(_0x115ddf,_0x255be8){var _0x205eee={'raw':!![],'where':{'id':_0x115ddf[_0x4db2('0x43')]['id']}},_0x50f48f={};_0x50f48f[_0x4db2('0x2d')]=_[_0x4db2('0x2e')](db[_0x4db2('0x2a')][_0x4db2('0x2b')]);_0x50f48f[_0x4db2('0x30')]=_[_0x4db2('0x2e')](_0x115ddf[_0x4db2('0x30')]);_0x50f48f['filters']=_[_0x4db2('0x2f')](_0x50f48f['model'],_0x50f48f[_0x4db2('0x30')]);_0x205eee['attributes']=_['intersection'](_0x50f48f[_0x4db2('0x2d')],qs[_0x4db2('0x32')](_0x115ddf[_0x4db2('0x30')]['fields']));_0x205eee[_0x4db2('0x31')]=_0x205eee['attributes'][_0x4db2('0x33')]?_0x205eee[_0x4db2('0x31')]:_0x50f48f[_0x4db2('0x2d')];if(_0x115ddf[_0x4db2('0x30')][_0x4db2('0x3f')]){_0x205eee[_0x4db2('0x40')]=[{'all':!![]}];}_0x205eee=_[_0x4db2('0x3c')]({},_0x205eee,_0x115ddf['options']);return db[_0x4db2('0x2a')][_0x4db2('0x44')](_0x205eee)[_0x4db2('0x22')](handleEntityNotFound(_0x255be8,null))[_0x4db2('0x22')](respondWithResult(_0x255be8,null))[_0x4db2('0x42')](handleError(_0x255be8,null));};exports[_0x4db2('0x45')]=function(_0x4499f0,_0x36d7db){return db[_0x4db2('0x2a')][_0x4db2('0x45')](_0x4499f0[_0x4db2('0x46')],{})[_0x4db2('0x22')](respondWithResult(_0x36d7db,0xc9))[_0x4db2('0x42')](handleError(_0x36d7db,null));};exports[_0x4db2('0x47')]=function(_0x1d0cd2,_0x56d149){if(_0x1d0cd2[_0x4db2('0x46')]['id']){delete _0x1d0cd2[_0x4db2('0x46')]['id'];}return db['ChatTransferReport'][_0x4db2('0x44')]({'where':{'id':_0x1d0cd2['params']['id']}})[_0x4db2('0x22')](handleEntityNotFound(_0x56d149,null))[_0x4db2('0x22')](saveUpdates(_0x1d0cd2[_0x4db2('0x46')],null))[_0x4db2('0x22')](respondWithResult(_0x56d149,null))['catch'](handleError(_0x56d149,null));};exports[_0x4db2('0x23')]=function(_0x37beae,_0x168b01){return db[_0x4db2('0x2a')][_0x4db2('0x44')]({'where':{'id':_0x37beae[_0x4db2('0x43')]['id']}})[_0x4db2('0x22')](handleEntityNotFound(_0x168b01,null))[_0x4db2('0x22')](removeEntity(_0x168b01,null))[_0x4db2('0x42')](handleError(_0x168b01,null));};exports['describe']=function(_0x30f663,_0x55c99b){return db[_0x4db2('0x2a')][_0x4db2('0x48')]()[_0x4db2('0x22')](respondWithResult(_0x55c99b,null))[_0x4db2('0x42')](handleError(_0x55c99b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4192131..684bbb7 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 _0x20cb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','lodash','../../config/logger'];(function(_0x20b70a,_0x210a27){var _0x4dddfe=function(_0x120218){while(--_0x120218){_0x20b70a['push'](_0x20b70a['shift']());}};_0x4dddfe(++_0x210a27);}(_0x20cb,0xb4));var _0xb20c=function(_0x1ac086,_0x479fe4){_0x1ac086=_0x1ac086-0x0;var _0x4a7140=_0x20cb[_0x1ac086];return _0x4a7140;};'use strict';var _=require(_0xb20c('0x0'));var util=require('util');var logger=require(_0xb20c('0x1'))(_0xb20c('0x2'));var moment=require(_0xb20c('0x3'));var BPromise=require(_0xb20c('0x4'));var rp=require(_0xb20c('0x5'));var fs=require('fs');var path=require(_0xb20c('0x6'));var rimraf=require(_0xb20c('0x7'));var config=require(_0xb20c('0x8'));var attributes=require(_0xb20c('0x9'));module[_0xb20c('0xa')]=function(_0x383304,_0x39ca1b){return _0x383304['define'](_0xb20c('0xb'),attributes,{'tableName':_0xb20c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x210b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5b8476,_0x30945c){var _0x46cf96=function(_0x234a89){while(--_0x234a89){_0x5b8476['push'](_0x5b8476['shift']());}};_0x46cf96(++_0x30945c);}(_0x210b,0x74));var _0xb210=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x210b[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xb210('0x0'));var util=require(_0xb210('0x1'));var logger=require(_0xb210('0x2'))(_0xb210('0x3'));var moment=require(_0xb210('0x4'));var BPromise=require(_0xb210('0x5'));var rp=require(_0xb210('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb210('0x7'));var config=require('../../config/environment');var attributes=require(_0xb210('0x8'));module[_0xb210('0x9')]=function(_0x39ef17,_0x3e7149){return _0x39ef17['define'](_0xb210('0xa'),attributes,{'tableName':_0xb210('0xb'),'paranoid':![],'indexes':[{'name':_0xb210('0xc'),'fields':[_0xb210('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 44e9b84..28d0222 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 _0xbe5f=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x12cf1f,_0x3bc1b5){var _0x6a1d52=function(_0x5a5ef9){while(--_0x5a5ef9){_0x12cf1f['push'](_0x12cf1f['shift']());}};_0x6a1d52(++_0x3bc1b5);}(_0xbe5f,0x160));var _0xfbe5=function(_0x204da5,_0x418eeb){_0x204da5=_0x204da5-0x0;var _0x2c7d00=_0xbe5f[_0x204da5];return _0x2c7d00;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbe5('0x0'));var BPromise=require(_0xfbe5('0x1'));var rs=require(_0xfbe5('0x2'));var fs=require('fs');var Redis=require(_0xfbe5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbe5('0x4'));var logger=require(_0xfbe5('0x5'))(_0xfbe5('0x6'));var config=require(_0xfbe5('0x7'));var jayson=require(_0xfbe5('0x8'));var client=jayson[_0xfbe5('0x9')][_0xfbe5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e37ba,_0x5f3d1a,_0x30b9bf){return new BPromise(function(_0x54719a,_0x3b18dc){return client['request'](_0x2e37ba,_0x30b9bf)[_0xfbe5('0xb')](function(_0x2d11cc){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x5f3d1a,'request\x20sent');logger[_0xfbe5('0xc')](_0xfbe5('0xd'),_0x5f3d1a,_0xfbe5('0xe'),JSON['stringify'](_0x2d11cc));if(_0x2d11cc[_0xfbe5('0xf')]){if(_0x2d11cc[_0xfbe5('0xf')][_0xfbe5('0x10')]===0x1f4){logger[_0xfbe5('0xf')](_0xfbe5('0x11'),_0x5f3d1a,_0x2d11cc[_0xfbe5('0xf')]['message']);return _0x3b18dc(_0x2d11cc[_0xfbe5('0xf')]['message']);}logger[_0xfbe5('0xf')](_0xfbe5('0x11'),_0x5f3d1a,_0x2d11cc[_0xfbe5('0xf')][_0xfbe5('0x12')]);return _0x54719a(_0x2d11cc[_0xfbe5('0xf')][_0xfbe5('0x12')]);}else{logger[_0xfbe5('0x13')](_0xfbe5('0x11'),_0x5f3d1a,_0xfbe5('0xe'));_0x54719a(_0x2d11cc[_0xfbe5('0x14')]['message']);}})[_0xfbe5('0x15')](function(_0xdf4e4c){logger['error'](_0xfbe5('0x11'),_0x5f3d1a,_0xdf4e4c);_0x3b18dc(_0xdf4e4c);});});} \ No newline at end of file +var _0xb8f5=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c0194,_0x4f8c24){var _0x5372c6=function(_0x3c6bf2){while(--_0x3c6bf2){_0x5c0194['push'](_0x5c0194['shift']());}};_0x5372c6(++_0x4f8c24);}(_0xb8f5,0xc7));var _0x5b8f=function(_0x3fd10c,_0x444b43){_0x3fd10c=_0x3fd10c-0x0;var _0x3fc148=_0xb8f5[_0x3fd10c];return _0x3fc148;};'use strict';var _=require(_0x5b8f('0x0'));var util=require(_0x5b8f('0x1'));var moment=require(_0x5b8f('0x2'));var BPromise=require(_0x5b8f('0x3'));var rs=require(_0x5b8f('0x4'));var fs=require('fs');var Redis=require(_0x5b8f('0x5'));var db=require(_0x5b8f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b8f('0x7'));var config=require(_0x5b8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b8f('0x9')][_0x5b8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb351,_0x4d748d,_0x131f66){return new BPromise(function(_0x53900e,_0x662fe2){return client[_0x5b8f('0xb')](_0x2bb351,_0x131f66)[_0x5b8f('0xc')](function(_0x5ae0d5){logger[_0x5b8f('0xd')](_0x5b8f('0xe'),_0x4d748d,_0x5b8f('0xf'));logger[_0x5b8f('0x10')](_0x5b8f('0x11'),_0x4d748d,'request\x20sent',JSON[_0x5b8f('0x12')](_0x5ae0d5));if(_0x5ae0d5[_0x5b8f('0x13')]){if(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x14')]===0x1f4){logger[_0x5b8f('0x13')](_0x5b8f('0xe'),_0x4d748d,_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);return _0x662fe2(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);}logger[_0x5b8f('0x13')](_0x5b8f('0xe'),_0x4d748d,_0x5ae0d5[_0x5b8f('0x13')]['message']);return _0x53900e(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);}else{logger[_0x5b8f('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4d748d,_0x5b8f('0xf'));_0x53900e(_0x5ae0d5[_0x5b8f('0x16')][_0x5b8f('0x15')]);}})[_0x5b8f('0x17')](function(_0x21cc49){logger['error'](_0x5b8f('0xe'),_0x4d748d,_0x21cc49);_0x662fe2(_0x21cc49);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ebd9011..0d5634c 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 _0xd0ab=['get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd0ab,0x11c));var _0xbd0a=function(_0x21d38f,_0x4bedde){_0x21d38f=_0x21d38f-0x0;var _0x4ca6c9=_0xd0ab[_0x21d38f];return _0x4ca6c9;};'use strict';var multer=require(_0xbd0a('0x0'));var util=require(_0xbd0a('0x1'));var path=require(_0xbd0a('0x2'));var timeout=require(_0xbd0a('0x3'));var express=require(_0xbd0a('0x4'));var router=express[_0xbd0a('0x5')]();var fs_extra=require(_0xbd0a('0x6'));var auth=require(_0xbd0a('0x7'));var interaction=require(_0xbd0a('0x8'));var config=require('../../config/environment');var controller=require(_0xbd0a('0x9'));router[_0xbd0a('0xa')]('/',auth[_0xbd0a('0xb')](),controller['index']);router['get'](_0xbd0a('0xc'),auth['isAuthenticated'](),controller[_0xbd0a('0xd')]);router['get'](_0xbd0a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xbd0a('0xf')]('/',auth[_0xbd0a('0xb')](),controller[_0xbd0a('0x10')]);router[_0xbd0a('0x11')](_0xbd0a('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xbd0a('0x12')](_0xbd0a('0xe'),auth[_0xbd0a('0xb')](),controller[_0xbd0a('0x13')]);module[_0xbd0a('0x14')]=router; \ No newline at end of file +var _0xe9d6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe9d6,0x67));var _0x6e9d=function(_0x459af2,_0x8dc490){_0x459af2=_0x459af2-0x0;var _0xfada3c=_0xe9d6[_0x459af2];return _0xfada3c;};'use strict';var multer=require(_0x6e9d('0x0'));var util=require(_0x6e9d('0x1'));var path=require(_0x6e9d('0x2'));var timeout=require(_0x6e9d('0x3'));var express=require(_0x6e9d('0x4'));var router=express[_0x6e9d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e9d('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x6e9d('0x7')]('/',auth[_0x6e9d('0x8')](),controller[_0x6e9d('0x9')]);router[_0x6e9d('0x7')](_0x6e9d('0xa'),auth[_0x6e9d('0x8')](),controller[_0x6e9d('0xb')]);router[_0x6e9d('0x7')](_0x6e9d('0xc'),auth['isAuthenticated'](),controller[_0x6e9d('0xd')]);router[_0x6e9d('0xe')]('/',auth['isAuthenticated'](),controller[_0x6e9d('0xf')]);router[_0x6e9d('0x10')](_0x6e9d('0xc'),auth[_0x6e9d('0x8')](),controller['update']);router[_0x6e9d('0x11')]('/:id',auth[_0x6e9d('0x8')](),controller[_0x6e9d('0x12')]);module[_0x6e9d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 163860f..207b1e2 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 _0x1be1=['textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1be1,0x192));var _0x11be=function(_0x1a81c8,_0x4ada14){_0x1a81c8=_0x1a81c8-0x0;var _0xe7ed7f=_0x1be1[_0x1a81c8];return _0xe7ed7f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x11be('0x0')]={'name':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11be('0x2')},'description':{'type':Sequelize[_0x11be('0x1')]},'mapKey':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x3')},'key':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x9'),_0x11be('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xb')},'start_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x10')},'noteTitle':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x12')},'closingMessageButton':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x13')},'ratingType':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x14'),_0x11be('0x15')),'defaultValue':_0x11be('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON[_0x11be('0x17')]({'items':[{'type':_0x11be('0x18'),'variable':null,'config':{'placeholder':_0x11be('0x19'),'type':'text','required':!![]},'props':{'title':_0x11be('0x19'),'helpText':''}},{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x11be('0x1a')](_0x11be('0x1b'))?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x1b'))):{};},'set':function(_0x518e2b){return this[_0x11be('0x1d')]('onlineForm',JSON[_0x11be('0x17')](_0x518e2b));}},'offlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x11be('0x3'),'type':_0x11be('0x3')},'variable':null},{'type':_0x11be('0x1e'),'config':{'placeholder':_0x11be('0x1f')},'props':{'title':_0x11be('0x1f'),'helpText':_0x11be('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x11be('0x1a')]('offlineForm')?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x21'))):{};},'set':function(_0x147b62){return this['setDataValue']('offlineForm',JSON[_0x11be('0x17')](_0x147b62));}},'token':{'type':Sequelize[_0x11be('0x1')],'defaultValue':function(){return rs[_0x11be('0x22')]();}},'autoclose':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x11be('0x1')]},'forwardOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x11be('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x23')},'waitingMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x25')},'offlineMessageBody':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x26')},'skipUnmanaged':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x11be('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x28')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x29')},'defaultTitle':{'type':Sequelize[_0x11be('0x1')]},'customerAvatar':{'type':Sequelize[_0x11be('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x2b')},'systemAvatar':{'type':Sequelize[_0x11be('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11be('0x6')],'comment':_0x11be('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2618f5){if(!_0x2618f5)this[_0x11be('0x1d')]('mandatoryDispositionPauseId',null);this[_0x11be('0x1d')](_0x11be('0x2d'),_0x2618f5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x11be('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x11be('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x11be('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x11be('0x16')]}}; \ No newline at end of file +var _0x2750=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Send','Feedback','thumb','star','stringify','name','input','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2750,0x13b));var _0x0275=function(_0x2ae76b,_0x741258){_0x2ae76b=_0x2ae76b-0x0;var _0xc2448e=_0x2750[_0x2ae76b];return _0xc2448e;};'use strict';var Sequelize=require(_0x0275('0x0'));var rs=require('randomstring');module[_0x0275('0x1')]={'name':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'unique':_0x0275('0x3')},'description':{'type':Sequelize[_0x0275('0x2')]},'mapKey':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'mapKeyOffline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'key':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x5')},'customerAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0275('0xa')](_0x0275('0xb'),_0x0275('0xc')),'defaultValue':_0x0275('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0xd')},'start_chat_button':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xf')},'download_transcript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0275('0x11')]},'closingQuestion':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x13')},'noteTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x14')},'skipMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x15')},'ratingType':{'type':Sequelize['ENUM']('star',_0x0275('0x16')),'defaultValue':_0x0275('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0275('0x19'),'type':'text','required':!![]},'props':{'title':_0x0275('0x19'),'helpText':''}},{'type':_0x0275('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':_0x0275('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0275('0x1b')]('onlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x1d'))):{};},'set':function(_0x15813f){return this[_0x0275('0x1e')](_0x0275('0x1d'),JSON['stringify'](_0x15813f));}},'offlineForm':{'type':Sequelize[_0x0275('0x11')],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':_0x0275('0x1a'),'props':{'title':_0x0275('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':'email'},'variable':null},{'type':_0x0275('0x1f'),'config':{'placeholder':_0x0275('0x20')},'props':{'title':_0x0275('0x20'),'helpText':_0x0275('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x0275('0x1b')]('offlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x22'))):{};},'set':function(_0x489d7f){return this['setDataValue'](_0x0275('0x22'),JSON[_0x0275('0x18')](_0x489d7f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0275('0x23')]();}},'autoclose':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0275('0x2')]},'waitingTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x29')},'sendUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0275('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0275('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0275('0x2a');}},'notificationSound':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2c')},'verticalAlignment':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2d')},'defaultTitle':{'type':Sequelize[_0x0275('0x2')]},'customerAvatar':{'type':Sequelize[_0x0275('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0275('0x8')],'comment':_0x0275('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0275('0x31'),'set':function(_0x76b8fa){if(!_0x76b8fa)this[_0x0275('0x1e')](_0x0275('0x32'),null);this[_0x0275('0x1e')](_0x0275('0x33'),_0x76b8fa);}},'vidaooEscalation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x34')},'vidaooNote':{'type':Sequelize[_0x0275('0x2')],'defaultValue':function(){return _0x0275('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0275('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4bcca23..b47721d 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 _0xc04f=['findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','NotifyMailAccount','remove','addInteraction','omit','getInteractions','fullname','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','x-real-ip','connection','virtual','replace','verticalAlignment','labelText','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','getFields','false','items','fromKey','getOfflineMessages','Contact','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','http','client','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','result','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','show','params','mandatoryDispositionPause','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne'];(function(_0x181a3e,_0x515ca1){var _0x4c135d=function(_0x296928){while(--_0x296928){_0x181a3e['push'](_0x181a3e['shift']());}};_0x4c135d(++_0x515ca1);}(_0xc04f,0xcc));var _0xfc04=function(_0x59be39,_0x38558d){_0x59be39=_0x59be39-0x0;var _0x136795=_0xc04f[_0x59be39];return _0x136795;};'use strict';var BPromise=require(_0xfc04('0x0'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc04('0x1'));var _=require(_0xfc04('0x2'));var querystring=require(_0xfc04('0x3'));var Redis=require(_0xfc04('0x4'));var qs=require(_0xfc04('0x5'));var logger=require('../../config/logger')(_0xfc04('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xfc04('0x7')]=_[_0xfc04('0x8')](config[_0xfc04('0x7')],{'host':_0xfc04('0x9'),'port':0x18eb});var socket=require(_0xfc04('0xa'))(new Redis(config[_0xfc04('0x7')]));require(_0xfc04('0xb'))[_0xfc04('0xc')](socket);var htmlToText=require(_0xfc04('0xd'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfc04('0xe')]({'port':0x232c});var client9002=jayson[_0xfc04('0xf')][_0xfc04('0xe')]({'port':0x232a});var client9003=jayson[_0xfc04('0xf')][_0xfc04('0xe')]({'port':0x232b});var client9001=jayson[_0xfc04('0xf')][_0xfc04('0xe')]({'port':0x2329});function respondWithRpcPromise(_0x1bcf6f,_0x32cd54,_0x171a63,_0x27b55a){return new BPromise(function(_0x2550fb,_0x5b793f){var _0x5b3b1b=_0x27b55a||client;return _0x5b3b1b[_0xfc04('0x10')](_0x1bcf6f,_0x171a63)[_0xfc04('0x11')](function(_0x4a6123){logger[_0xfc04('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x32cd54,_0xfc04('0x13'));logger[_0xfc04('0x14')](_0xfc04('0x15'),_0x32cd54,_0xfc04('0x13'),JSON[_0xfc04('0x16')](_0x4a6123));if(_0x4a6123['error']){if(_0x4a6123[_0xfc04('0x17')]['code']===0x1f4){logger[_0xfc04('0x17')](_0xfc04('0x18'),_0x32cd54,_0x4a6123[_0xfc04('0x17')]['message']);return _0x5b793f(_0x4a6123['error']['message']);}logger[_0xfc04('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x32cd54,_0x4a6123[_0xfc04('0x17')]['message']);return _0x2550fb(_0x4a6123[_0xfc04('0x17')]['message']);}else{logger['info'](_0xfc04('0x18'),_0x32cd54,_0xfc04('0x13'));_0x2550fb(_0x4a6123[_0xfc04('0x19')][_0xfc04('0x1a')]);}})[_0xfc04('0x1b')](function(_0x7b37d5){logger[_0xfc04('0x17')](_0xfc04('0x18'),_0x32cd54,_0x7b37d5);_0x5b793f(_0x7b37d5);});});}function respondWithStatusCode(_0x1dbc62,_0x3cc5eb){_0x3cc5eb=_0x3cc5eb||0xcc;return function(_0x46698b){if(_0x46698b){return _0x1dbc62[_0xfc04('0x1c')](_0x3cc5eb);}return _0x1dbc62[_0xfc04('0x1d')](_0x3cc5eb)[_0xfc04('0x1e')]();};}function respondWithResult(_0x311fef,_0x153b71){_0x153b71=_0x153b71||0xc8;return function(_0x5ca82b){if(_0x5ca82b){return _0x311fef[_0xfc04('0x1d')](_0x153b71)[_0xfc04('0x1f')](_0x5ca82b);}};}function respondWithFilteredResult(_0x32c4a9,_0x2c7859){return function(_0x5783bf){if(_0x5783bf){var _0x477a9c=typeof _0x2c7859[_0xfc04('0x20')]==='undefined'&&typeof _0x2c7859[_0xfc04('0x21')]===_0xfc04('0x22');var _0x3fd21a=_0x5783bf[_0xfc04('0x23')];var _0x30dafd=_0x477a9c?0x0:_0x2c7859[_0xfc04('0x20')];var _0x519fec=_0x477a9c?_0x5783bf[_0xfc04('0x23')]:_0x2c7859[_0xfc04('0x20')]+_0x2c7859[_0xfc04('0x21')];var _0x2b7308;if(_0x519fec>=_0x3fd21a){_0x519fec=_0x3fd21a;_0x2b7308=0xc8;}else{_0x2b7308=0xce;}_0x32c4a9[_0xfc04('0x1d')](_0x2b7308);return _0x32c4a9[_0xfc04('0x24')](_0xfc04('0x25'),_0x30dafd+'-'+_0x519fec+'/'+_0x3fd21a)['json'](_0x5783bf);}return null;};}function saveUpdates(_0x4f56f7){return function(_0x19bdfd){if(_0x19bdfd){return _0x19bdfd[_0xfc04('0x26')](_0x4f56f7)['then'](function(_0x1f77c3){return _0x1f77c3;});}return null;};}function removeEntity(_0x35870b){return function(_0x28bcfe){if(_0x28bcfe){return _0x28bcfe[_0xfc04('0x27')]()[_0xfc04('0x11')](function(){var _0x1fd33e=_0x28bcfe[_0xfc04('0x28')]({'plain':!![]});var _0x48cb05=_0xfc04('0x29');return db[_0xfc04('0x2a')][_0xfc04('0x27')]({'where':{'type':_0x48cb05,'resourceId':_0x1fd33e['id']}})['then'](function(){return _0x28bcfe;});})[_0xfc04('0x11')](function(){_0x35870b['status'](0xcc)[_0xfc04('0x1e')]();});}};}function handleEntityNotFound(_0x3f7f03){return function(_0x1385b3){if(!_0x1385b3){_0x3f7f03[_0xfc04('0x1c')](0x194);}return _0x1385b3;};}function handleError(_0x67a6c3,_0x5f1008){_0x5f1008=_0x5f1008||0x1f4;return function(_0x5137b5){logger[_0xfc04('0x17')](_0x5137b5['stack']);if(_0x5137b5[_0xfc04('0x2b')]){delete _0x5137b5[_0xfc04('0x2b')];}_0x67a6c3[_0xfc04('0x1d')](_0x5f1008)[_0xfc04('0x2c')](_0x5137b5);};}exports[_0xfc04('0x2d')]=function(_0x1c7209,_0x474cf4){var _0x536f12={'include':[{'model':db[_0xfc04('0x2e')],'as':'mandatoryDispositionPause'}]},_0x37f386={},_0x2f626e={'count':0x0,'rows':[]};var _0x3ae43d=_[_0xfc04('0x2f')](db[_0xfc04('0x30')][_0xfc04('0x31')],function(_0x2ed721){return{'name':_0x2ed721[_0xfc04('0x32')],'type':_0x2ed721[_0xfc04('0x33')][_0xfc04('0x34')]};});_0x37f386[_0xfc04('0x35')]=_[_0xfc04('0x2f')](_0x3ae43d,_0xfc04('0x2b'));_0x37f386['query']=_[_0xfc04('0x36')](_0x1c7209['query']);_0x37f386[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0x37f386[_0xfc04('0x35')],_0x37f386[_0xfc04('0x39')]);_0x536f12['attributes']=_['intersection'](_0x37f386[_0xfc04('0x35')],qs['fields'](_0x1c7209[_0xfc04('0x39')][_0xfc04('0x3a')]));_0x536f12[_0xfc04('0x3b')]=_0x536f12[_0xfc04('0x3b')][_0xfc04('0x3c')]?_0x536f12[_0xfc04('0x3b')]:_0x37f386[_0xfc04('0x35')];if(!_0x1c7209[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x536f12[_0xfc04('0x21')]=qs[_0xfc04('0x21')](_0x1c7209[_0xfc04('0x39')][_0xfc04('0x21')]);_0x536f12[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x1c7209[_0xfc04('0x39')][_0xfc04('0x20')]);}_0x536f12[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x1c7209[_0xfc04('0x39')][_0xfc04('0x40')]);_0x536f12['where']=qs['filters'](_[_0xfc04('0x41')](_0x1c7209[_0xfc04('0x39')],_0x37f386[_0xfc04('0x37')]),_0x3ae43d);if(_0x1c7209[_0xfc04('0x39')][_0xfc04('0x42')]){_0x536f12[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x536f12['where'],{'$or':_['map'](_0x3ae43d,function(_0x38d4c7){if(_0x38d4c7['type']!=='VIRTUAL'){var _0x3a2488={};_0x3a2488[_0x38d4c7[_0xfc04('0x2b')]]={'$like':'%'+_0x1c7209['query']['filter']+'%'};return _0x3a2488;}})});}_0x536f12=_[_0xfc04('0x44')]({},_0x536f12,_0x1c7209[_0xfc04('0x45')]);var _0x5ec0a8={'where':_0x536f12[_0xfc04('0x43')]};return db[_0xfc04('0x30')][_0xfc04('0x23')](_0x5ec0a8)['then'](function(_0x2ad3b2){_0x2f626e[_0xfc04('0x23')]=_0x2ad3b2;if(_0x1c7209['query'][_0xfc04('0x46')]){_0x536f12['include']=[{'all':!![]}];}return db[_0xfc04('0x30')]['findAll'](_0x536f12);})[_0xfc04('0x11')](function(_0x370aac){_0x2f626e[_0xfc04('0x47')]=_0x370aac;return _0x2f626e;})[_0xfc04('0x11')](respondWithFilteredResult(_0x474cf4,_0x536f12))[_0xfc04('0x1b')](handleError(_0x474cf4,null));};exports[_0xfc04('0x48')]=function(_0x464bd8,_0x2b3100){var _0x4503fa={'raw':![],'where':{'id':_0x464bd8[_0xfc04('0x49')]['id']},'include':[{'model':db[_0xfc04('0x2e')],'as':_0xfc04('0x4a')}]},_0x39c59d={};_0x39c59d['model']=_[_0xfc04('0x36')](db['ChatWebsite']['rawAttributes']);_0x39c59d[_0xfc04('0x39')]=_[_0xfc04('0x36')](_0x464bd8[_0xfc04('0x39')]);_0x39c59d['filters']=_[_0xfc04('0x38')](_0x39c59d[_0xfc04('0x35')],_0x39c59d[_0xfc04('0x39')]);_0x4503fa[_0xfc04('0x3b')]=_[_0xfc04('0x38')](_0x39c59d[_0xfc04('0x35')],qs['fields'](_0x464bd8[_0xfc04('0x39')]['fields']));_0x4503fa[_0xfc04('0x3b')]=_0x4503fa['attributes'][_0xfc04('0x3c')]?_0x4503fa[_0xfc04('0x3b')]:_0x39c59d[_0xfc04('0x35')];if(_0x464bd8[_0xfc04('0x39')][_0xfc04('0x46')]){_0x4503fa[_0xfc04('0x4b')]=[{'all':!![]}];}_0x4503fa=_[_0xfc04('0x44')]({},_0x4503fa,_0x464bd8[_0xfc04('0x45')]);return db[_0xfc04('0x30')][_0xfc04('0x4c')](_0x4503fa)[_0xfc04('0x11')](handleEntityNotFound(_0x2b3100,null))[_0xfc04('0x11')](respondWithResult(_0x2b3100,null))[_0xfc04('0x1b')](handleError(_0x2b3100,null));};exports['create']=function(_0x440ea0,_0x5648a6){return db[_0xfc04('0x30')][_0xfc04('0x4d')](_0x440ea0['body'],{})[_0xfc04('0x11')](function(_0x5034c4){var _0x1e7fc0=_0x440ea0[_0xfc04('0x4e')][_0xfc04('0x28')]({'plain':!![]});if(!_0x1e7fc0)throw new Error(_0xfc04('0x4f'));if(_0x1e7fc0['role']===_0xfc04('0x4e')){var _0x353481=_0x5034c4[_0xfc04('0x28')]({'plain':!![]});var _0x221873='ChatWebsites';return db['UserProfileSection'][_0xfc04('0x4c')]({'where':{'name':_0x221873,'userProfileId':_0x1e7fc0[_0xfc04('0x50')]},'raw':!![]})[_0xfc04('0x11')](function(_0x580b08){if(_0x580b08&&_0x580b08['autoAssociation']===0x0){return db[_0xfc04('0x2a')][_0xfc04('0x4d')]({'name':_0x353481[_0xfc04('0x2b')],'resourceId':_0x353481['id'],'type':_0x580b08['name'],'sectionId':_0x580b08['id']},{})[_0xfc04('0x11')](function(){return _0x5034c4;});}else{return _0x5034c4;}})[_0xfc04('0x1b')](function(_0x4b3520){logger[_0xfc04('0x17')](_0xfc04('0x51'),_0x4b3520);throw _0x4b3520;});}return _0x5034c4;})[_0xfc04('0x11')](respondWithResult(_0x5648a6,0xc9))[_0xfc04('0x1b')](handleError(_0x5648a6,null));};exports[_0xfc04('0x26')]=function(_0x41384c,_0x25337e){if(_0x41384c[_0xfc04('0x52')]['id']){delete _0x41384c['body']['id'];}return db[_0xfc04('0x30')]['find']({'where':{'id':_0x41384c[_0xfc04('0x49')]['id']},'include':[{'model':db[_0xfc04('0x2e')],'as':'mandatoryDispositionPause'}]})[_0xfc04('0x11')](handleEntityNotFound(_0x25337e,null))[_0xfc04('0x11')](saveUpdates(_0x41384c[_0xfc04('0x52')],null))[_0xfc04('0x11')](respondWithResult(_0x25337e,null))['catch'](handleError(_0x25337e,null));};exports[_0xfc04('0x27')]=function(_0x4b5c5d,_0x549129){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x4b5c5d[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x549129,null))[_0xfc04('0x11')](removeEntity(_0x549129,null))[_0xfc04('0x1b')](handleError(_0x549129,null));};exports['describe']=function(_0x339fbf,_0x56eabc){return db[_0xfc04('0x30')][_0xfc04('0x53')]()[_0xfc04('0x11')](respondWithResult(_0x56eabc,null))[_0xfc04('0x1b')](handleError(_0x56eabc,null));};exports[_0xfc04('0x54')]=function(_0x58c022,_0x5b3a91){if(_0x58c022[_0xfc04('0x52')]['id']){delete _0x58c022[_0xfc04('0x52')]['id'];}return db[_0xfc04('0x30')]['find']({'where':{'id':_0x58c022[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b3a91,null))[_0xfc04('0x11')](function(_0x2a4dd4){if(_0x2a4dd4){_0x58c022[_0xfc04('0x52')][_0xfc04('0x55')]=_0x2a4dd4['id'];return db[_0xfc04('0x56')]['create'](_0x58c022['body']);}})[_0xfc04('0x11')](respondWithResult(_0x5b3a91,null))[_0xfc04('0x1b')](handleError(_0x5b3a91,null));};exports[_0xfc04('0x57')]=function(_0x1e41a7,_0x176211){var _0x14579c={'raw':![],'where':{}};var _0x445c4d={};var _0x52a756={'count':0x0,'rows':[]};return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x1e41a7[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x176211,null))[_0xfc04('0x11')](function(_0x431c71){if(_0x431c71){_0x445c4d['model']=_['keys'](db[_0xfc04('0x56')][_0xfc04('0x31')]);_0x445c4d[_0xfc04('0x39')]=_['keys'](_0x1e41a7[_0xfc04('0x39')]);_0x445c4d[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0x445c4d[_0xfc04('0x35')],_0x445c4d[_0xfc04('0x39')]);_0x14579c[_0xfc04('0x3b')]=_[_0xfc04('0x38')](_0x445c4d['model'],qs[_0xfc04('0x3a')](_0x1e41a7['query'][_0xfc04('0x3a')]));_0x14579c[_0xfc04('0x3b')]=_0x14579c['attributes'][_0xfc04('0x3c')]?_0x14579c[_0xfc04('0x3b')]:_0x445c4d['model'];if(!_0x1e41a7[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x14579c['limit']=qs[_0xfc04('0x21')](_0x1e41a7['query'][_0xfc04('0x21')]);_0x14579c[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x1e41a7[_0xfc04('0x39')][_0xfc04('0x20')]);}_0x14579c[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x1e41a7[_0xfc04('0x39')][_0xfc04('0x40')]);_0x14579c[_0xfc04('0x43')]=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x1e41a7[_0xfc04('0x39')],_0x445c4d[_0xfc04('0x37')]));_0x14579c[_0xfc04('0x43')][_0xfc04('0x55')]=_0x431c71['id'];if(_0x1e41a7[_0xfc04('0x39')]['filter']){_0x14579c[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x14579c['where'],{'$or':_['map'](_0x14579c['attributes'],function(_0x4f10db){var _0x1a27e1={};_0x1a27e1[_0x4f10db]={'$like':'%'+_0x1e41a7[_0xfc04('0x39')][_0xfc04('0x42')]+'%'};return _0x1a27e1;})});}_0x14579c=_['merge']({},_0x14579c,_0x1e41a7[_0xfc04('0x45')]);return db['Disposition']['count']({'where':_0x14579c[_0xfc04('0x43')]})[_0xfc04('0x11')](function(_0x43d7e0){_0x52a756[_0xfc04('0x23')]=_0x43d7e0;if(_0x1e41a7[_0xfc04('0x39')][_0xfc04('0x46')]){_0x14579c[_0xfc04('0x4b')]=[{'all':!![]}];}return db[_0xfc04('0x56')][_0xfc04('0x59')](_0x14579c);})[_0xfc04('0x11')](function(_0x322733){_0x52a756[_0xfc04('0x47')]=_0x322733;return _0x52a756;});}})['then'](respondWithFilteredResult(_0x176211,_0x14579c))[_0xfc04('0x1b')](handleError(_0x176211,null));};exports[_0xfc04('0x5a')]=function(_0x4c58b6,_0x1b350c){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x4c58b6[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x1b350c,null))['then'](function(_0x348c50){if(_0x348c50){return _0x348c50[_0xfc04('0x5a')](_0x4c58b6[_0xfc04('0x39')][_0xfc04('0x5b')]);}})['then'](respondWithStatusCode(_0x1b350c,null))[_0xfc04('0x1b')](handleError(_0x1b350c,null));};exports['addAnswer']=function(_0x49d5b3,_0x5e1db5){if(_0x49d5b3[_0xfc04('0x52')]['id']){delete _0x49d5b3['body']['id'];}return db['ChatWebsite'][_0xfc04('0x4c')]({'where':{'id':_0x49d5b3['params']['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x5e1db5,null))[_0xfc04('0x11')](function(_0xe08281){if(_0xe08281){_0x49d5b3['body']['ChatWebsiteId']=_0xe08281['id'];return db[_0xfc04('0x5c')][_0xfc04('0x4d')](_0x49d5b3[_0xfc04('0x52')]);}})['then'](respondWithResult(_0x5e1db5,null))['catch'](handleError(_0x5e1db5,null));};exports[_0xfc04('0x5d')]=function(_0x5dfadf,_0x1fa2dd){var _0x37c4f8={'raw':![],'where':{}};var _0x38c791={};var _0x15f7c8={'count':0x0,'rows':[]};return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x5dfadf['params']['id']}})['then'](handleEntityNotFound(_0x1fa2dd,null))[_0xfc04('0x11')](function(_0x69ca8b){if(_0x69ca8b){_0x38c791['model']=_[_0xfc04('0x36')](db[_0xfc04('0x5c')][_0xfc04('0x31')]);_0x38c791[_0xfc04('0x39')]=_[_0xfc04('0x36')](_0x5dfadf[_0xfc04('0x39')]);_0x38c791[_0xfc04('0x37')]=_['intersection'](_0x38c791[_0xfc04('0x35')],_0x38c791[_0xfc04('0x39')]);_0x37c4f8['attributes']=_['intersection'](_0x38c791[_0xfc04('0x35')],qs[_0xfc04('0x3a')](_0x5dfadf[_0xfc04('0x39')]['fields']));_0x37c4f8[_0xfc04('0x3b')]=_0x37c4f8[_0xfc04('0x3b')]['length']?_0x37c4f8[_0xfc04('0x3b')]:_0x38c791[_0xfc04('0x35')];if(!_0x5dfadf[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x37c4f8['limit']=qs[_0xfc04('0x21')](_0x5dfadf[_0xfc04('0x39')][_0xfc04('0x21')]);_0x37c4f8[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x5dfadf['query'][_0xfc04('0x20')]);}_0x37c4f8[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x5dfadf[_0xfc04('0x39')][_0xfc04('0x40')]);_0x37c4f8['where']=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x5dfadf[_0xfc04('0x39')],_0x38c791[_0xfc04('0x37')]));_0x37c4f8['where'][_0xfc04('0x55')]=_0x69ca8b['id'];if(_0x5dfadf[_0xfc04('0x39')]['filter']){_0x37c4f8['where']=_[_0xfc04('0x44')](_0x37c4f8[_0xfc04('0x43')],{'$or':_[_0xfc04('0x2f')](_0x37c4f8[_0xfc04('0x3b')],function(_0x3bd997){var _0x1df1f2={};_0x1df1f2[_0x3bd997]={'$like':'%'+_0x5dfadf['query']['filter']+'%'};return _0x1df1f2;})});}_0x37c4f8=_[_0xfc04('0x44')]({},_0x37c4f8,_0x5dfadf[_0xfc04('0x45')]);return db['CannedAnswer']['count']({'where':_0x37c4f8[_0xfc04('0x43')]})[_0xfc04('0x11')](function(_0x19e3f0){_0x15f7c8[_0xfc04('0x23')]=_0x19e3f0;if(_0x5dfadf[_0xfc04('0x39')][_0xfc04('0x46')]){_0x37c4f8['include']=[{'all':!![]}];}return db[_0xfc04('0x5c')][_0xfc04('0x59')](_0x37c4f8);})[_0xfc04('0x11')](function(_0x28b665){_0x15f7c8[_0xfc04('0x47')]=_0x28b665;return _0x15f7c8;});}})[_0xfc04('0x11')](respondWithFilteredResult(_0x1fa2dd,_0x37c4f8))['catch'](handleError(_0x1fa2dd,null));};exports[_0xfc04('0x5e')]=function(_0x10bde6,_0x3560d3){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x10bde6[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x3560d3,null))[_0xfc04('0x11')](function(_0x1ec5a8){if(_0x1ec5a8){return _0x1ec5a8[_0xfc04('0x5e')](_0x10bde6[_0xfc04('0x39')][_0xfc04('0x5b')]);}})[_0xfc04('0x11')](respondWithStatusCode(_0x3560d3,null))[_0xfc04('0x1b')](handleError(_0x3560d3,null));};exports[_0xfc04('0x5f')]=function(_0x1faf01,_0xc5e095){_0x1faf01[_0xfc04('0x52')]['sitepic']=_0x1faf01[_0xfc04('0x60')][_0xfc04('0x61')];return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x1faf01[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0xc5e095,null))[_0xfc04('0x11')](saveUpdates(_0x1faf01[_0xfc04('0x52')],null))['then'](respondWithResult(_0xc5e095,null))[_0xfc04('0x1b')](handleError(_0xc5e095,null));};exports['addAvatar']=function(_0x149da1,_0x38926d){_0x149da1[_0xfc04('0x52')][_0xfc04('0x62')]=_0x149da1[_0xfc04('0x60')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x149da1[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x38926d,null))[_0xfc04('0x11')](saveUpdates(_0x149da1['body'],null))[_0xfc04('0x11')](respondWithResult(_0x38926d,null))['catch'](handleError(_0x38926d,null));};exports[_0xfc04('0x63')]=function(_0x422d05,_0x10a9e0){_0x422d05[_0xfc04('0x52')][_0xfc04('0x64')]=_0x422d05[_0xfc04('0x60')][_0xfc04('0x61')];return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x422d05[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x10a9e0,null))[_0xfc04('0x11')](saveUpdates(_0x422d05['body'],null))[_0xfc04('0x11')](respondWithResult(_0x10a9e0,null))['catch'](handleError(_0x10a9e0,null));};exports[_0xfc04('0x65')]=function(_0x3ded5b,_0x2ae7ca){_0x3ded5b['body'][_0xfc04('0x66')]=_0x3ded5b['file'][_0xfc04('0x61')];return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x3ded5b[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x2ae7ca,null))[_0xfc04('0x11')](saveUpdates(_0x3ded5b[_0xfc04('0x52')],null))['then'](respondWithResult(_0x2ae7ca,null))[_0xfc04('0x1b')](handleError(_0x2ae7ca,null));};exports[_0xfc04('0x67')]=function(_0x517926,_0x29304b){var _0x588aa3=path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0x6a'));var _0x249bdd={'where':{'id':_0x517926[_0xfc04('0x49')]['id']},'attributes':['id',_0xfc04('0x6b')],'raw':!![]};var _0x118a57=![];return require('../../config/license/util')[_0xfc04('0x6c')]()['then'](function(_0x420b3f){if(_0x420b3f){_0x118a57=_0x420b3f[_0xfc04('0x6d')];}})[_0xfc04('0x11')](function(){return db[_0xfc04('0x30')][_0xfc04('0x4c')](_0x249bdd);})[_0xfc04('0x11')](handleEntityNotFound(_0x29304b,null))[_0xfc04('0x11')](function(_0xf8f6ea){if(_0xf8f6ea){if(!_[_0xfc04('0x6e')](_0xf8f6ea[_0xfc04('0x6b')])){if(fs[_0xfc04('0x6f')](path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0x70'),_0xf8f6ea[_0xfc04('0x6b')]))&&_0x118a57){_0x588aa3=path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0x70'),_0xf8f6ea[_0xfc04('0x6b')]);}}return _0x29304b['download'](_0x588aa3);}})[_0xfc04('0x1b')](handleError(_0x29304b,null));};exports[_0xfc04('0x71')]=function(_0xd882d3,_0x51860b){var _0x3c24d1=path['join'](config[_0xfc04('0x69')],_0xfc04('0x72'));var _0x2977ab={'where':{'id':_0xd882d3[_0xfc04('0x49')]['id']},'attributes':['id',_0xfc04('0x62')],'raw':!![]};return db[_0xfc04('0x30')][_0xfc04('0x4c')](_0x2977ab)[_0xfc04('0x11')](handleEntityNotFound(_0x51860b,null))[_0xfc04('0x11')](function(_0x594a57){if(_0x594a57){if(!_[_0xfc04('0x6e')](_0x594a57[_0xfc04('0x62')])){if(fs[_0xfc04('0x6f')](path[_0xfc04('0x68')](config[_0xfc04('0x69')],'server/files/images/avatars/',_0x594a57[_0xfc04('0x62')]))){_0x3c24d1=path['join'](config[_0xfc04('0x69')],'server/files/images/avatars/',_0x594a57[_0xfc04('0x62')]);}}return _0x51860b[_0xfc04('0x73')](_0x3c24d1);}})[_0xfc04('0x1b')](handleError(_0x51860b,null));};exports[_0xfc04('0x74')]=function(_0x1ee20a,_0x4fd80e){var _0x55dece=path['join'](config['root'],_0xfc04('0x75'));var _0x5c922b={'where':{'id':_0x1ee20a[_0xfc04('0x49')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xfc04('0x30')][_0xfc04('0x4c')](_0x5c922b)['then'](handleEntityNotFound(_0x4fd80e,null))[_0xfc04('0x11')](function(_0x58e3cc){if(_0x58e3cc){if(!_[_0xfc04('0x6e')](_0x58e3cc[_0xfc04('0x64')])){if(fs[_0xfc04('0x6f')](path[_0xfc04('0x68')](config[_0xfc04('0x69')],'server/files/images/avatars/',_0x58e3cc['customerAvatar']))&&_0x58e3cc[_0xfc04('0x76')]){_0x55dece=path['join'](config[_0xfc04('0x69')],_0xfc04('0x77'),_0x58e3cc[_0xfc04('0x64')]);}}return _0x4fd80e['download'](_0x55dece);}})[_0xfc04('0x1b')](handleError(_0x4fd80e,null));};exports[_0xfc04('0x78')]=function(_0x433e86,_0x384204){var _0x581c31=path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0x79'));var _0x20f4e9={'where':{'id':_0x433e86[_0xfc04('0x49')]['id']},'attributes':['id',_0xfc04('0x66')],'raw':!![]};return db[_0xfc04('0x30')]['find'](_0x20f4e9)[_0xfc04('0x11')](handleEntityNotFound(_0x384204,null))[_0xfc04('0x11')](function(_0x3950d5){if(_0x3950d5){if(!_[_0xfc04('0x6e')](_0x3950d5[_0xfc04('0x66')])){if(fs['existsSync'](path[_0xfc04('0x68')](config['root'],_0xfc04('0x77'),_0x3950d5[_0xfc04('0x66')]))){_0x581c31=path['join'](config[_0xfc04('0x69')],'server/files/images/avatars/',_0x3950d5[_0xfc04('0x66')]);}}return _0x384204[_0xfc04('0x73')](_0x581c31);}})[_0xfc04('0x1b')](handleError(_0x384204,null));};exports[_0xfc04('0x7a')]=function(_0x29851f,_0x1a5bb8){var _0x57b308=require('user-agent-parser');var _0x29d771=new _0x57b308();var _0xa127d9=_0x29d771['setUA'](_0x29851f[_0xfc04('0x7b')][_0xfc04('0x7c')])[_0xfc04('0x7d')]();var _0x969f76={'body':_0x29851f['body'],'channel':_0xfc04('0x7e')};var _0x3dcc6c=[];var _0x3b2950=[];var _0x275fdb={};var _0x3456f1=![];return db[_0xfc04('0x7f')][_0xfc04('0x53')]()['then'](function(_0x72c6c6){if(!_0x72c6c6){throw new db[(_0xfc04('0x80'))][(_0xfc04('0x81'))](_0xfc04('0x82'));}_0x3dcc6c=_[_0xfc04('0x83')](_[_0xfc04('0x36')](_0x72c6c6),[_0xfc04('0x84'),'updatedAt']);_0x3b2950=_['difference'](_[_0xfc04('0x36')](_0x72c6c6),[_0xfc04('0x84'),_0xfc04('0x85'),'CompanyId',_0xfc04('0x86')]);if(_0x29851f[_0xfc04('0x52')]['id']){delete _0x29851f[_0xfc04('0x52')]['id'];}if(_[_0xfc04('0x6e')](_0x29851f[_0xfc04('0x52')]['from'])){throw new db['Sequelize'][(_0xfc04('0x81'))](_0xfc04('0x87'));}if(_['isNil'](_0x29851f[_0xfc04('0x52')]['body'])||_0x29851f['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfc04('0x6e')](_0x29851f[_0xfc04('0x52')][_0xfc04('0x88')])){throw new db['Sequelize'][(_0xfc04('0x81'))](_0xfc04('0x89')+_0x3b2950);}if(!_[_0xfc04('0x8a')](_0x3b2950,_0x29851f['body'][_0xfc04('0x88')])){throw new db[(_0xfc04('0x80'))][(_0xfc04('0x81'))](_0xfc04('0x8b')+_0x3b2950);}_0x275fdb[_0x29851f['body'][_0xfc04('0x88')]]=_0x29851f[_0xfc04('0x52')][_0xfc04('0x8c')];})[_0xfc04('0x11')](function(){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x29851f['params']['id']},'include':[{'model':db[_0xfc04('0x8d')],'as':_0xfc04('0x8e'),'include':[{'model':db[_0xfc04('0x7f')],'as':_0xfc04('0x8f'),'where':_0x275fdb,'limit':0x1,'order':[['updatedAt',_0xfc04('0x90')]]}]},{'model':db[_0xfc04('0x91')],'as':_0xfc04('0x92')}]});})[_0xfc04('0x11')](handleEntityNotFound(_0x1a5bb8,null))[_0xfc04('0x11')](function(_0x4706c3){if(_0x4706c3&&_0x4706c3[_0xfc04('0x8e')]){_0x969f76['account']=_0x4706c3;_0x969f76['applications']=_0x4706c3[_0xfc04('0x92')];_0x969f76[_0xfc04('0x93')]=_0x4706c3[_0xfc04('0x8e')];_0x969f76[_0xfc04('0x94')]=_[_0xfc04('0x95')](_0x969f76['applications'],[_0xfc04('0x96')],[_0xfc04('0x97')]);if(_0x969f76[_0xfc04('0x98')][_0xfc04('0x92')]){delete _0x969f76[_0xfc04('0x98')][_0xfc04('0x92')];}if(_0x969f76[_0xfc04('0x98')][_0xfc04('0x8e')]&&_0x969f76[_0xfc04('0x98')][_0xfc04('0x8e')]['Contacts'][_0xfc04('0x3c')]){return _0x969f76[_0xfc04('0x98')][_0xfc04('0x8e')][_0xfc04('0x8f')][0x0];}var _0x4ab49a=_[_0xfc04('0x8')](_0x29851f[_0xfc04('0x52')],{'firstName':_0x29851f[_0xfc04('0x52')][_0xfc04('0x8c')],'ListId':_0x4706c3[_0xfc04('0x86')]});_0x4ab49a[_0x29851f[_0xfc04('0x52')][_0xfc04('0x88')]]=_0x29851f[_0xfc04('0x52')]['from'];return db[_0xfc04('0x7f')][_0xfc04('0x4d')](_0x4ab49a,{'fields':_0x3dcc6c,'raw':!![]});}})[_0xfc04('0x11')](handleEntityNotFound(_0x1a5bb8,null))['then'](function(_0x2f7a4a){_0x969f76[_0xfc04('0x99')]=_0x2f7a4a;var _0x4167ea=_0x29851f[_0xfc04('0x52')][_0xfc04('0x9a')];if(_0x29851f[_0xfc04('0x7b')][_0xfc04('0x9b')]){_0x4167ea=_0x29851f[_0xfc04('0x7b')][_0xfc04('0x9b')];}else if(_0x29851f['headers'][_0xfc04('0x9c')]){_0x4167ea=_['first'](_0x29851f[_0xfc04('0x7b')][_0xfc04('0x9c')][_0xfc04('0x9d')](','));}if(_0x2f7a4a){var _0x114d27={'ContactId':_0x2f7a4a['id'],'ChatWebsiteId':_0x29851f[_0xfc04('0x49')]['id'],'from':(_0x2f7a4a[_0xfc04('0x9e')]||'')+'\x20'+(_0x2f7a4a['lastName']||''),'customerIp':_0x4167ea,'customerPort':_0x29851f[_0xfc04('0x7b')]['x-real-port']?_0x29851f[_0xfc04('0x7b')]['x-real-port']:null,'referer':_0x29851f[_0xfc04('0x52')][_0xfc04('0x9f')],'browserName':_0xa127d9[_0xfc04('0xa0')][_0xfc04('0x2b')]&&_0xa127d9['browser'][_0xfc04('0xa1')]?util[_0xfc04('0xa2')]('%s\x20%s',_0xa127d9[_0xfc04('0xa0')][_0xfc04('0x2b')],_0xa127d9[_0xfc04('0xa0')][_0xfc04('0xa1')]):'unknown','browserVersion':_0xa127d9[_0xfc04('0xa0')][_0xfc04('0xa1')]||_0xfc04('0xa3'),'osName':util[_0xfc04('0xa2')](_0xfc04('0xa4'),_0xa127d9['os'][_0xfc04('0x2b')],_0xa127d9['os'][_0xfc04('0xa1')]),'osVersion':_0xa127d9['os'][_0xfc04('0xa1')],'deviceModel':_0xa127d9[_0xfc04('0xa5')][_0xfc04('0x35')]&&_0xa127d9[_0xfc04('0xa5')][_0xfc04('0xa6')]?util['format']('%s\x20%s\x20%s',_0xa127d9[_0xfc04('0xa5')][_0xfc04('0x35')],_0xa127d9[_0xfc04('0xa5')]['vendor'],_0xa127d9[_0xfc04('0xa5')]['type']):null,'deviceVendor':_0xa127d9[_0xfc04('0xa5')][_0xfc04('0xa6')],'deviceType':_0xa127d9[_0xfc04('0xa5')]['type'],'formData':JSON[_0xfc04('0x16')](_0x29851f[_0xfc04('0x52')])};var _0x1fad34={'ChatWebsiteId':_0x29851f[_0xfc04('0x49')]['id'],'closed':![]};if(_0x29851f['body'][_0xfc04('0xa7')]){_0x1fad34[_0xfc04('0xa7')]=_0x29851f['body'][_0xfc04('0xa7')];return db[_0xfc04('0xa8')][_0xfc04('0x4c')]({'where':_0x1fad34})['then'](function(_0x27fdae){if(_0x27fdae){return[_0x27fdae,![]];}_0x114d27[_0xfc04('0xa7')]=_0x29851f[_0xfc04('0x52')]['threadId'];_0x114d27[_0xfc04('0xa9')]=_0x29851f[_0xfc04('0x52')][_0xfc04('0xa9')];return db[_0xfc04('0xa8')][_0xfc04('0x4d')](_0x114d27)['then'](function(_0x6cafad){return[_0x6cafad,!![]];});});}_0x1fad34[_0xfc04('0xaa')]=_0x2f7a4a['id'];if(_0x29851f[_0xfc04('0x52')][_0xfc04('0xab')]&&_0x29851f['body'][_0xfc04('0xab')]['id']){_0x1fad34['id']=_0x29851f[_0xfc04('0x52')][_0xfc04('0xab')]['id'];return db['ChatInteraction']['find']({'where':_0x1fad34})[_0xfc04('0x11')](function(_0x5882c6){if(_0x5882c6){return[_0x5882c6,![]];}return db['ChatInteraction'][_0xfc04('0x4d')](_0x114d27)[_0xfc04('0x11')](function(_0x308f2d){return[_0x308f2d,!![]];});});}return db[_0xfc04('0xa8')][_0xfc04('0x4d')](_0x114d27)[_0xfc04('0x11')](function(_0x20bad5){return[_0x20bad5,!![]];});}})[_0xfc04('0xac')](function(_0x4a3f8e,_0x258745){if(_0x4a3f8e){_0x3456f1=_0x258745;if(!_0x258745){var _0x122890={'from':(_0x969f76[_0xfc04('0x99')][_0xfc04('0x9e')]||'')+'\x20'+(_0x969f76[_0xfc04('0x99')][_0xfc04('0xad')]||'')};if(_0x29851f[_0xfc04('0x52')][_0xfc04('0xa7')]&&_0x29851f[_0xfc04('0x52')]['messageId']&&_0x29851f['body']['threadId']!=_0x29851f['body'][_0xfc04('0xae')]){_0x122890['threadId']=_0x29851f[_0xfc04('0x52')][_0xfc04('0xae')];}return _0x4a3f8e['update'](_0x122890);}else{return _0x4a3f8e;}}})[_0xfc04('0x11')](function(_0x12b636){_0x969f76[_0xfc04('0xab')]=_0x12b636[_0xfc04('0x28')]({'plain':!![]});_0x969f76[_0xfc04('0xab')][_0xfc04('0xaf')]=_0x3456f1;if(_0x969f76[_0xfc04('0xab')][_0xfc04('0xaf')]){if(_0x969f76['account']['autoclose']){_0x969f76[_0xfc04('0x94')][_0xfc04('0xb0')]({'id':0x0,'priority':_0x969f76[_0xfc04('0x94')]['length']+0x1,'app':_0xfc04('0xb1'),'appdata':_0xfc04('0xb2'),'interval':_0xfc04('0xb3')});}}return db[_0xfc04('0xb4')][_0xfc04('0x4d')]({'body':_0x29851f['body'][_0xfc04('0x52')],'ChatWebsiteId':_0x29851f[_0xfc04('0x49')]['id'],'ChatInteractionId':_0x12b636['id'],'direction':'in','ContactId':_0x969f76[_0xfc04('0x99')]['id'],'AttachmentId':_0x29851f[_0xfc04('0x52')][_0xfc04('0xb5')]});})[_0xfc04('0x11')](function(_0x337214){_0x969f76[_0xfc04('0x1a')]=_0x337214;if(_0x969f76['interaction'][_0xfc04('0xb6')]){return db[_0xfc04('0xb7')][_0xfc04('0x4c')]({'attributes':['id','name'],'where':{'id':_0x969f76[_0xfc04('0xab')]['UserId']}})['then'](function(_0x4f3b8f){if(_0x4f3b8f){_0x969f76[_0xfc04('0x94')][_0xfc04('0xb8')]({'id':0x0,'priority':0x0,'app':_0xfc04('0xb9'),'appdata':_0x4f3b8f[_0xfc04('0x2b')]+','+(_0x969f76['account'][_0xfc04('0xba')]||0xa),'interval':_0xfc04('0xb3')});_0x969f76[_0xfc04('0xbb')]=!![];}return respondWithRpcPromise(_0xfc04('0xbc'),'startRouting',_0x969f76);});}return respondWithRpcPromise(_0xfc04('0xbc'),_0xfc04('0xbd'),_0x969f76);})['then'](function(_0x21140b){respondWithRpcPromise('EventManager',_0xfc04('0xbe'),{'event':_0xfc04('0x7a'),'message':_0x21140b},client9002);return _0x21140b;})[_0xfc04('0x11')](respondWithResult(_0x1a5bb8,null))[_0xfc04('0x1b')](handleError(_0x1a5bb8,null));};exports[_0xfc04('0xbf')]=function(_0x2e7dcf,_0x472a3e){var _0x160210,_0xf53d0b,_0xa92160;var _0x36931b=[];var _0x2df4c3={};var _0x58f2ce=_0x2e7dcf[_0xfc04('0xc0')]||[];var _0x5e2274=[];var _0x26a779;return db[_0xfc04('0x7f')][_0xfc04('0x53')]()[_0xfc04('0x11')](function(_0x375f9b){if(!_0x375f9b){throw new db['Sequelize'][(_0xfc04('0x81'))](_0xfc04('0x82'));}_0x36931b=_['difference'](_[_0xfc04('0x36')](_0x375f9b),[_0xfc04('0x84'),'updatedAt',_0xfc04('0xc1'),'ListId']);if(_0x2e7dcf[_0xfc04('0x52')]['id']){delete _0x2e7dcf[_0xfc04('0x52')]['id'];}if(_[_0xfc04('0x6e')](_0x2e7dcf[_0xfc04('0x52')][_0xfc04('0x8c')])){throw _0x472a3e[_0xfc04('0x1d')](0x1f4)[_0xfc04('0x2c')](new db[(_0xfc04('0x80'))]['ValidationError'](_0xfc04('0x87')));}if(_[_0xfc04('0x6e')](_0x2e7dcf[_0xfc04('0x52')][_0xfc04('0x52')])||_0x2e7dcf[_0xfc04('0x52')]['body']===''){throw _0x472a3e[_0xfc04('0x1d')](0x1f4)[_0xfc04('0x2c')](new db[(_0xfc04('0x80'))]['ValidationError'](_0xfc04('0xc2')));}if(_['isNil'](_0x2e7dcf['body']['mapKeyOffline'])){throw _0x472a3e[_0xfc04('0x1d')](0x1f4)[_0xfc04('0x2c')](new db[(_0xfc04('0x80'))][(_0xfc04('0x81'))](_0xfc04('0xc3')+_0x36931b));}if(!_[_0xfc04('0x8a')](_0x36931b,_0x2e7dcf['body']['mapKeyOffline'])){throw _0x472a3e[_0xfc04('0x1d')](0x1f4)[_0xfc04('0x2c')](new db[(_0xfc04('0x80'))]['ValidationError'](_0xfc04('0xc4')+_0x36931b));}_0x2df4c3[_0x2e7dcf[_0xfc04('0x52')][_0xfc04('0xc5')]]=_0x2e7dcf['body'][_0xfc04('0x8c')];})[_0xfc04('0x11')](function(){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x2e7dcf[_0xfc04('0x49')]['id']},'include':[{'model':db[_0xfc04('0x8d')],'as':'List'},{'model':db[_0xfc04('0xc6')],'as':'MailAccount'}]});})[_0xfc04('0x11')](handleEntityNotFound(_0x472a3e,null))['then'](function(_0x8208bd){if(_0x8208bd&&_0x8208bd['List']){_0xf53d0b=_0x8208bd;var _0x19a489=_[_0xfc04('0x8')](_0x2e7dcf['body'],{'firstName':_0x2e7dcf[_0xfc04('0x52')]['from'],'phone':_0x2e7dcf[_0xfc04('0x52')][_0xfc04('0x8c')],'ListId':_0x8208bd[_0xfc04('0x86')]});_0x19a489[_0x2e7dcf[_0xfc04('0x52')][_0xfc04('0xc5')]]=_0x2e7dcf[_0xfc04('0x52')]['from'];return db['CmContact'][_0xfc04('0xc7')]({'where':_0x2df4c3,'defaults':_0x19a489});}})[_0xfc04('0xac')](function(_0x313811){if(_0x313811){_0xa92160=_0x313811;var _0x5f251d=fs[_0xfc04('0xc8')](path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0xc9')),_0xfc04('0xca'));var _0x17a477=ejs[_0xfc04('0xcb')](_0x5f251d,{'body':_[_0xfc04('0xcc')](_0x2e7dcf[_0xfc04('0x52')]['body']),'bodyTitle':_0xf53d0b[_0xfc04('0xcd')]});return db[_0xfc04('0xce')][_0xfc04('0x4d')]({'body':_0x17a477,'plainBody':htmlToText[_0xfc04('0xcf')](_0x17a477),'ContactId':_0x313811['id'],'ChatWebsiteId':_0xf53d0b['id']});}})[_0xfc04('0x11')](function(_0x5b6ed5){_0x26a779=_0x5b6ed5;if(_0x58f2ce['length']){var _0x5e2db5=_0x58f2ce[_0xfc04('0x2f')](function(_0xd4625a){return{'name':_0xd4625a[_0xfc04('0xd0')],'basename':_0xd4625a[_0xfc04('0x61')],'type':_0xd4625a[_0xfc04('0xd1')],'ChatOfflineMessageId':_0x5b6ed5['id']};});_0x5e2274=_0x5e2db5[_0xfc04('0x2f')](_0x3c4ce8=>{var _0x519e5a={'filename':_0x3c4ce8[_0xfc04('0x2b')],'path':path['join'](config[_0xfc04('0x69')],_0xfc04('0xd2'),_0xfc04('0xc0'),_0xfc04('0xd3'),_0xfc04('0xd4'),_0x3c4ce8['basename'])};return _0x519e5a;});if(!_0xf53d0b[_0xfc04('0xd5')]){return db[_0xfc04('0xd6')][_0xfc04('0xd7')](function(_0x4e78cd){return db[_0xfc04('0xd8')]['bulkCreate'](_0x5e2db5,{'transaction':_0x4e78cd});});}}})['then'](function(){if(_0x26a779){_0x160210=_0x26a779;return db['MailAccount'][_0xfc04('0x58')]({'where':{'service':!![]},'include':[{'model':db[_0xfc04('0xd9')],'as':_0xfc04('0xda'),'raw':!![],'include':[{'model':db[_0xfc04('0xdb')],'as':_0xfc04('0xdb'),'raw':!![]}]}]});}})[_0xfc04('0x11')](function(_0x3cf906){if(_0x3cf906&&_0x3cf906[_0xfc04('0xda')]&&_0xf53d0b[_0xfc04('0xdc')]&&_0xf53d0b['forwardOfflineAddress']){var _0x4afbf5=_0x3cf906[_0xfc04('0xdd')]();return respondWithRpcPromise(_0xfc04('0xde'),_0xfc04('0xdf'),{'account':_0x4afbf5,'message':{'from':util['format'](_0xfc04('0xe0'),_0x3cf906[_0xfc04('0x2b')],_0x3cf906['email']||_0x3cf906[_0xfc04('0xda')][_0xfc04('0x4e')]),'to':_0xf53d0b['forwardOfflineAddress'],'subject':_0xf53d0b[_0xfc04('0xe1')],'html':_0x160210[_0xfc04('0x52')],'attachments':_0x5e2274}},client9003)[_0xfc04('0x11')](function(){return _0x160210;})[_0xfc04('0x1b')](function(_0x8f4dc0){logger[_0xfc04('0x17')](_0x8f4dc0);});}})['then'](function(){if(_0xf53d0b&&_0xf53d0b['openNewInteraction']&&_0xf53d0b[_0xfc04('0xe2')]){var _0x3b0ef7=[];if(_0x58f2ce['length']){_0x3b0ef7=_0x58f2ce[_0xfc04('0x2f')](function(_0x352cc7){return{'name':_0x352cc7['originalname'],'basename':_0x352cc7[_0xfc04('0x61')],'type':_0x352cc7[_0xfc04('0xd1')],'ChatOfflineMessageId':_0x26a779['id']};});}var _0x22c22d;if(!_[_0xfc04('0x6e')](_0xf53d0b[_0xfc04('0xe3')])){var _0xbc4768=_[_0xfc04('0x2f')](_0x2e7dcf[_0xfc04('0x52')],function(_0x1bb9fd){return _0x1bb9fd;});var _0x522c56=_[_0xfc04('0xe4')](_0xbc4768)[0x0];var _0x483443=_[_0xfc04('0xe5')](_0x522c56,function(_0x4a0b13){return _0x4a0b13;});_0x22c22d=_0x483443[0x1][_0xf53d0b[_0xfc04('0xe3')]];}var _0x1e3866={'from':_0xa92160[_0xfc04('0xe6')],'firstName':_0xa92160[_0xfc04('0x9e')],'lastName':_0xa92160['lastName'],'mapKey':_0xfc04('0xe6'),'message':{'from':_0xa92160[_0xfc04('0xe6')],'to':_0xf53d0b[_0xfc04('0xc6')][_0xfc04('0xe6')],'cc':'','subject':_['isNil'](_0x22c22d)?_0xf53d0b['offlineMessageSubject']:_0x22c22d,'messageId':'','sentAt':new Date(),'attach':_0x3b0ef7[_0xfc04('0x3c')],'attachments':_0x3b0ef7,'originChannel':'Chat','ChatWebsiteId':_0xf53d0b['id'],'ChatOfflineMessageId':_0x160210['id'],'originTo':_0xf53d0b[_0xfc04('0xc6')]['email']},'body':_0x160210[_0xfc04('0x52')]};var _0x25a833={'account':{'id':_0xf53d0b[_0xfc04('0xe2')]},'body':_0x1e3866,'log':_0xfc04('0xe7')};return respondWithRpcPromise(_0xfc04('0xe7'),'notifyMail',_0x25a833,client9001)['then'](function(){return _0x160210;})[_0xfc04('0x1b')](function(_0x232c72){logger['error'](_0x232c72);});}return;})[_0xfc04('0x11')](function(){if(_0x160210){return _0x160210;}})['then'](respondWithResult(_0x472a3e,null))[_0xfc04('0x1b')](function(_0x7731d1){logger[_0xfc04('0x17')](_0xfc04('0x1b'),_0x7731d1);for(var _0x1978e4 of _0x58f2ce){var _0x213888=path[_0xfc04('0x68')](config[_0xfc04('0x69')],'server',_0xfc04('0xc0'),_0xfc04('0xd3'),_0xfc04('0xd4'),_0x1978e4[_0xfc04('0x61')]);fs_extra[_0xfc04('0xe8')](_0x213888)[_0xfc04('0x1b')](function(_0x26bd2f){logger[_0xfc04('0x17')]('Could\x20not\x20remove\x20attachment\x20file',_0x213888,_0x26bd2f);});}});};exports[_0xfc04('0xe9')]=function(_0x1db0c6,_0xf3e4a8){return db['ChatInteraction']['find']({'where':{'id':_0x1db0c6[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0xf3e4a8,null))[_0xfc04('0x11')](function(_0x3c292e){if(_0x3c292e){return _0x3c292e[_0xfc04('0xe9')](_0x1db0c6[_0xfc04('0x52')]['ids'],_[_0xfc04('0xea')](_0x1db0c6['body'],[_0xfc04('0x5b'),'id'])||{});}})['then'](respondWithResult(_0xf3e4a8,null))[_0xfc04('0x1b')](handleError(_0xf3e4a8,null));};exports[_0xfc04('0xeb')]=function(_0x25dd64,_0x98f514){var _0x4b70c9={'raw':![],'where':{}};var _0x40bf26={};var _0x2fd8ec={'count':0x0,'rows':[]};return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x25dd64[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x98f514,null))['then'](function(_0xef17aa){if(_0xef17aa){_0x40bf26[_0xfc04('0x35')]=_['keys'](db[_0xfc04('0xa8')]['rawAttributes']);_0x40bf26['query']=_[_0xfc04('0x36')](_0x25dd64[_0xfc04('0x39')]);_0x40bf26[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0x40bf26[_0xfc04('0x35')],_0x40bf26['query']);_0x4b70c9[_0xfc04('0x3b')]=_[_0xfc04('0x38')](_0x40bf26[_0xfc04('0x35')],qs[_0xfc04('0x3a')](_0x25dd64[_0xfc04('0x39')][_0xfc04('0x3a')]));_0x4b70c9[_0xfc04('0x3b')]=_0x4b70c9[_0xfc04('0x3b')][_0xfc04('0x3c')]?_0x4b70c9[_0xfc04('0x3b')]:_0x40bf26[_0xfc04('0x35')];if(!_0x25dd64['query']['hasOwnProperty']('nolimit')){_0x4b70c9[_0xfc04('0x21')]=qs['limit'](_0x25dd64[_0xfc04('0x39')][_0xfc04('0x21')]);_0x4b70c9[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x25dd64['query'][_0xfc04('0x20')]);}_0x4b70c9[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x25dd64[_0xfc04('0x39')][_0xfc04('0x40')]);_0x4b70c9['where']=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x25dd64[_0xfc04('0x39')],_0x40bf26['filters']));_0x4b70c9['where']['ChatWebsiteId']=_0xef17aa['id'];if(_0x25dd64[_0xfc04('0x39')][_0xfc04('0x42')]){_0x4b70c9[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x4b70c9['where'],{'$or':_['map'](_0x4b70c9['attributes'],function(_0x480428){var _0x13bfe9={};_0x13bfe9[_0x480428]={'$like':'%'+_0x25dd64[_0xfc04('0x39')][_0xfc04('0x42')]+'%'};return _0x13bfe9;})});}_0x4b70c9=_[_0xfc04('0x44')]({},_0x4b70c9,_0x25dd64['options']);return db[_0xfc04('0xa8')][_0xfc04('0x23')]({'where':_0x4b70c9['where']})[_0xfc04('0x11')](function(_0x29318f){_0x2fd8ec[_0xfc04('0x23')]=_0x29318f;if(_0x25dd64['query'][_0xfc04('0x46')]){_0x4b70c9['include']=[{'model':db[_0xfc04('0x7f')],'as':'Contact','required':![]},{'model':db[_0xfc04('0xb7')],'as':'Owner','attributes':[_0xfc04('0x2b'),_0xfc04('0xec'),_0xfc04('0xed')],'required':![]},{'model':db[_0xfc04('0xee')],'as':_0xfc04('0xef'),'attributes':['id',_0xfc04('0x2b'),_0xfc04('0xf0')],'where':_0x25dd64['query']['tag']?{'id':_0x25dd64[_0xfc04('0x39')]['tag']}:undefined,'required':_0x25dd64['query'][_0xfc04('0xf1')]?!![]:![]}];}return db[_0xfc04('0xa8')]['findAll'](_0x4b70c9);})[_0xfc04('0x11')](function(_0x2d89ee){_0x2fd8ec[_0xfc04('0x47')]=_0x2d89ee;return _0x2fd8ec;});}})[_0xfc04('0x11')](respondWithFilteredResult(_0x98f514,_0x4b70c9))[_0xfc04('0x1b')](handleError(_0x98f514,null));};function iftimePromise(_0x3311a1,_0x440b61){return respondWithRpcPromise(_0xfc04('0xf2'),'getSnippet',{'command':_0x440b61['timezone']?util[_0xfc04('0xa2')](_0xfc04('0xf3'),_0x3311a1['interval'],_0x440b61[_0xfc04('0xf4')]):util[_0xfc04('0xa2')](_0xfc04('0xf5'),_0x3311a1[_0xfc04('0xf6')])},client9002)[_0xfc04('0x11')](function(_0x1b6ec6){var _0x5bbd34=_0x1b6ec6&&_0x1b6ec6[_0xfc04('0xf7')](_0xfc04('0xf8'))>=0x0?!![]:![];logger['info'](_0xfc04('0xf9'),_0x440b61['id'],_0x3311a1['id'],_0x3311a1[_0xfc04('0xf6')],_0x5bbd34?'ONLINE':_0xfc04('0xfa'),_0x440b61[_0xfc04('0xf4')]?_0x440b61[_0xfc04('0xf4')]:'No\x20timezone');return _0x5bbd34;})[_0xfc04('0x1b')](function(_0x311529){logger[_0xfc04('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x440b61['id'],_0x3311a1['id'],_0x3311a1[_0xfc04('0xf6')],util[_0xfc04('0xfb')](_0x311529,{'showHidden':![],'depth':null}),_0x440b61[_0xfc04('0xf4')]?_0x440b61[_0xfc04('0xf4')]:_0xfc04('0xfc'));return![];});}exports[_0xfc04('0xfd')]=function(_0x3d5a80,_0x3ee0b3){var _0x37fd8d=0x0;var _0x32d324=0x0;var _0x20f17e=![];var _0x2334b6;var _0x38ba71;return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x3d5a80['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xfc04('0xfe')],'as':_0xfc04('0xff'),'attributes':['id',_0xfc04('0xf6')],'raw':!![]}]}]})[_0xfc04('0x11')](handleEntityNotFound(_0x3ee0b3,null))['then'](function(_0x33946b){if(_0x33946b){_0x2334b6=_0x33946b;return _0x33946b[_0xfc04('0x100')]({'raw':!![]});}})['then'](function(_0x458fc7){if(_0x2334b6){if(_0x458fc7){_0x38ba71=_0x458fc7;}}return require(_0xfc04('0x101'))['getLicense']();})[_0xfc04('0x11')](function(_0x2a0a68){if(_0x2a0a68){_0x32d324=_0x2a0a68['virtual'];_0x20f17e=_0x2a0a68[_0xfc04('0x6d')];}})[_0xfc04('0x11')](function(){return db[_0xfc04('0xa8')][_0xfc04('0x23')]({'where':{'closed':![]}});})[_0xfc04('0x11')](function(_0x13a7c7){_0x37fd8d=_0x13a7c7;if(_0x32d324&&_0x13a7c7>_0x32d324){return db['License'][_0xfc04('0x58')]({'where':{'id':0x1}})[_0xfc04('0x11')](function(_0x1c2e8e){if(_0x1c2e8e){_0x1c2e8e[_0xfc04('0x102')](_0xfc04('0x103'));}});}})[_0xfc04('0x11')](function(){if(_0x2334b6['Interval']&&_0x2334b6[_0xfc04('0xfe')][_0xfc04('0xff')]){var _0x4096b1=[];for(var _0x35a015=0x0;_0x35a015<_0x2334b6[_0xfc04('0xfe')]['Intervals'][_0xfc04('0x3c')];_0x35a015++){var _0x1252a9=_0x2334b6[_0xfc04('0xfe')]['Intervals'][_0x35a015][_0xfc04('0x28')]({'plain':!![]});_0x4096b1[_0xfc04('0xb0')](iftimePromise(_0x1252a9,_0x2334b6));}return BPromise[_0xfc04('0x104')](_0x4096b1)[_0xfc04('0x11')](function(_0x840b40){return _[_0xfc04('0x105')](_0x840b40);});}else{return!![];}})['then'](function(_0x5b06fe){var _0x56d7ed=fs[_0xfc04('0xc8')](path[_0xfc04('0x68')](config[_0xfc04('0x69')],_0xfc04('0x106')),_0xfc04('0xca'));var _0x4000af={'remote':_0x2334b6['remote'],'query':querystring['stringify'](_[_0xfc04('0x44')](_0x2334b6[_0xfc04('0x28')]({'plain':!![]}),{'customerIp':_0x3d5a80[_0xfc04('0x7b')][_0xfc04('0x9c')]||_0x3d5a80[_0xfc04('0x7b')][_0xfc04('0x107')]||_0x3d5a80[_0xfc04('0x108')]['remoteAddress']||_0x3d5a80['ip'],'referer':_0x3d5a80[_0xfc04('0x7b')]['referer'],'openedInteractions':_0x37fd8d,'maxInteractions':_0x32d324,'virtual':_0x20f17e[_0xfc04('0x109')],'online':_0x5b06fe,'custom':_0x20f17e}))[_0xfc04('0x10a')](/'/g,'\x5c\x27')};_0x3ee0b3[_0xfc04('0x2c')](ejs[_0xfc04('0xcb')](Mustache['render'](_0x56d7ed,_0x4000af),{'proactiveActions':_0x38ba71,'alignment':_0x2334b6['alignment'],'verticalAlignment':_0x2334b6[_0xfc04('0x10b')],'div_color':_0x2334b6['color'],'labelText':_0x2334b6[_0xfc04('0x10c')],'text_color':_0x2334b6['textColor'],'text_button_color':_0x2334b6[_0xfc04('0x10d')],'button_color':_0x2334b6[_0xfc04('0x10e')],'background_color':_0x2334b6['backgroundColor'],'hideWhenOffline':_0x2334b6[_0xfc04('0x10f')],'interval':_0x2334b6[_0xfc04('0x110')]}));})['catch'](handleError(_0x3ee0b3,null));};exports[_0xfc04('0x111')]=function(_0x589fce,_0x2b2967){var _0x4d39b5=_0x589fce[_0xfc04('0x49')]['id'];var _0x3bfd3c=_0x589fce[_0xfc04('0x52')];var _0x34d613=0xc8;var _0x4c2687=null;return db[_0xfc04('0xd6')][_0xfc04('0xd7')]({'isolationLevel':db[_0xfc04('0xd6')][_0xfc04('0x112')][_0xfc04('0x113')][_0xfc04('0x114')]},function(_0x329e78){return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x4d39b5},'transaction':_0x329e78})[_0xfc04('0x11')](function(_0x946970){if(_0x946970){return db[_0xfc04('0x91')]['destroy']({'where':{'ChatWebsiteId':_0x4d39b5},'transaction':_0x329e78})[_0xfc04('0x11')](function(){var _0x1bd12a=_[_0xfc04('0x2f')](_0x3bfd3c,function(_0x342032){_0x342032['ChatWebsiteId']=_0x4d39b5;return _0x342032;});return db['ChatApplication']['bulkCreate'](_0x1bd12a,{'transaction':_0x329e78});});}else{_0x34d613=0x194;_0x4c2687=[];}});})[_0xfc04('0x11')](function(){if(_0x34d613!==0x194){return db[_0xfc04('0x91')][_0xfc04('0x115')]({'where':{'ChatWebsiteId':_0x4d39b5},'order':_0xfc04('0x96')})[_0xfc04('0x11')](function(_0x1a79e1){_0x4c2687=_0x1a79e1;});}})[_0xfc04('0x1b')](function(_0x412afa){_0x34d613=0x1f4;logger[_0xfc04('0x17')](_0x412afa['stack']);if(_0x412afa[_0xfc04('0x2b')]){delete _0x412afa[_0xfc04('0x2b')];}_0x4c2687=_0x412afa;})[_0xfc04('0x116')](function(){if(_0x4c2687===null){_0x2b2967[_0xfc04('0x1c')](_0x34d613);}else{if(_0x34d613===0x1f4){_0x2b2967[_0xfc04('0x1d')](_0x34d613)[_0xfc04('0x2c')](_0x4c2687);}else{_0x2b2967[_0xfc04('0x1d')](_0x34d613)[_0xfc04('0x1f')](_0x4c2687);}}});};exports[_0xfc04('0x117')]=function(_0x23801e,_0x170d49){var _0x224b2a={};var _0x366617={};var _0x4becd0;var _0x58fdac;return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x23801e[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x170d49,null))[_0xfc04('0x11')](function(_0xdf8f9d){if(_0xdf8f9d){_0x4becd0=_0xdf8f9d;_0x366617[_0xfc04('0x35')]=_[_0xfc04('0x36')](db[_0xfc04('0x91')][_0xfc04('0x31')]);_0x366617[_0xfc04('0x39')]=_['keys'](_0x23801e['query']);_0x366617[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0x366617['model'],_0x366617['query']);_0x224b2a['attributes']=_[_0xfc04('0x38')](_0x366617[_0xfc04('0x35')],qs[_0xfc04('0x3a')](_0x23801e['query'][_0xfc04('0x3a')]));_0x224b2a[_0xfc04('0x3b')]=_0x224b2a['attributes'][_0xfc04('0x3c')]?_0x224b2a[_0xfc04('0x3b')]:_0x366617[_0xfc04('0x35')];_0x224b2a[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x23801e['query'][_0xfc04('0x40')]);_0x224b2a[_0xfc04('0x43')]=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x23801e[_0xfc04('0x39')],_0x366617[_0xfc04('0x37')]));if(_0x23801e['query'][_0xfc04('0x42')]){_0x224b2a[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x224b2a['where'],{'$or':_[_0xfc04('0x2f')](_0x224b2a[_0xfc04('0x3b')],function(_0x3588c7){var _0x22d792={};_0x22d792[_0x3588c7]={'$like':'%'+_0x23801e[_0xfc04('0x39')]['filter']+'%'};return _0x22d792;})});}_0x224b2a=_['merge']({},_0x224b2a,_0x23801e[_0xfc04('0x45')]);return _0x4becd0['getApplications'](_0x224b2a);}})[_0xfc04('0x11')](function(_0x2977fa){if(_0x2977fa){_0x58fdac=_0x2977fa['length'];if(!_0x23801e[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x224b2a[_0xfc04('0x21')]=qs[_0xfc04('0x21')](_0x23801e[_0xfc04('0x39')][_0xfc04('0x21')]);_0x224b2a[_0xfc04('0x20')]=qs['offset'](_0x23801e[_0xfc04('0x39')]['offset']);}return _0x4becd0['getApplications'](_0x224b2a);}})['then'](function(_0xeea78b){if(_0xeea78b){return _0xeea78b?{'count':_0x58fdac,'rows':_0xeea78b}:null;}})[_0xfc04('0x11')](respondWithResult(_0x170d49,null))[_0xfc04('0x1b')](handleError(_0x170d49,null));};exports['addProactiveActions']=function(_0x138776,_0x20ce43){return db[_0xfc04('0x118')][_0xfc04('0x4c')]({'where':{'id':_0x138776[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ce43,null))[_0xfc04('0x11')](function(_0x53abe3){if(_0x53abe3){return _0x53abe3['addProactiveActions'](_0x138776[_0xfc04('0x52')][_0xfc04('0x5b')],_[_0xfc04('0xea')](_0x138776[_0xfc04('0x52')],[_0xfc04('0x5b'),'id'])||{});}})[_0xfc04('0x11')](respondWithResult(_0x20ce43,null))['catch'](handleError(_0x20ce43,null));};exports[_0xfc04('0x100')]=function(_0x5a44b8,_0x6167f6){var _0x5f37fb={};var _0x306f5b={};var _0x4d28f5;var _0xbfba2a;return db[_0xfc04('0x30')]['findOne']({'where':{'id':_0x5a44b8[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x6167f6,null))[_0xfc04('0x11')](function(_0x3b5b91){if(_0x3b5b91){_0x4d28f5=_0x3b5b91;_0x306f5b[_0xfc04('0x35')]=_[_0xfc04('0x36')](db['ChatProactiveAction'][_0xfc04('0x31')]);_0x306f5b[_0xfc04('0x39')]=_[_0xfc04('0x36')](_0x5a44b8[_0xfc04('0x39')]);_0x306f5b['filters']=_[_0xfc04('0x38')](_0x306f5b[_0xfc04('0x35')],_0x306f5b[_0xfc04('0x39')]);_0x5f37fb['attributes']=_[_0xfc04('0x38')](_0x306f5b[_0xfc04('0x35')],qs['fields'](_0x5a44b8[_0xfc04('0x39')][_0xfc04('0x3a')]));_0x5f37fb['attributes']=_0x5f37fb['attributes'][_0xfc04('0x3c')]?_0x5f37fb['attributes']:_0x306f5b[_0xfc04('0x35')];_0x5f37fb[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x5a44b8[_0xfc04('0x39')][_0xfc04('0x40')]);_0x5f37fb['where']=qs[_0xfc04('0x37')](_['pick'](_0x5a44b8[_0xfc04('0x39')],_0x306f5b[_0xfc04('0x37')]));if(_0x5a44b8['query'][_0xfc04('0x42')]){_0x5f37fb['where']=_[_0xfc04('0x44')](_0x5f37fb[_0xfc04('0x43')],{'$or':_[_0xfc04('0x2f')](_0x5f37fb[_0xfc04('0x3b')],function(_0x4f5f02){var _0x1cb55c={};_0x1cb55c[_0x4f5f02]={'$like':'%'+_0x5a44b8[_0xfc04('0x39')][_0xfc04('0x42')]+'%'};return _0x1cb55c;})});}_0x5f37fb=_[_0xfc04('0x44')]({},_0x5f37fb,_0x5a44b8['options']);return _0x4d28f5['getProactiveActions'](_0x5f37fb);}})['then'](function(_0xe4fff6){if(_0xe4fff6){_0xbfba2a=_0xe4fff6[_0xfc04('0x3c')];if(!_0x5a44b8[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x5f37fb['limit']=qs[_0xfc04('0x21')](_0x5a44b8['query']['limit']);_0x5f37fb[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x5a44b8[_0xfc04('0x39')][_0xfc04('0x20')]);}return _0x4d28f5[_0xfc04('0x100')](_0x5f37fb);}})[_0xfc04('0x11')](function(_0x5d1696){if(_0x5d1696){return _0x5d1696?{'count':_0xbfba2a,'rows':_0x5d1696}:null;}})[_0xfc04('0x11')](respondWithResult(_0x6167f6,null))[_0xfc04('0x1b')](handleError(_0x6167f6,null));};exports[_0xfc04('0x119')]=function(_0x4d438f,_0x248a1a){var _0xbc5ee8=_0x4d438f[_0xfc04('0x39')]['online']===_0xfc04('0x11a')?'offlineForm':'onlineForm';return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'attributes':['id',_0xbc5ee8],'where':{'id':_0x4d438f[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x248a1a,null))['then'](function(_0x2ac2b1){if(_0x2ac2b1){var _0x30e52e=_0x2ac2b1[_0xbc5ee8];var _0x56f486=_0x30e52e&&_0x30e52e[_0xfc04('0x11b')]?_0x30e52e['items']:[];_0x248a1a['send']({'fromKey':_[_0xfc04('0x6e')](_0x30e52e[_0xfc04('0x11c')])?undefined:_0x30e52e['fromKey'],'count':_0x56f486[_0xfc04('0x3c')],'rows':_0x56f486});}})[_0xfc04('0x1b')](handleError(_0x248a1a,null));};exports[_0xfc04('0x11d')]=function(_0x396512,_0x111b63){var _0x5bc121={'raw':![],'where':{}};var _0xb5acbd={};var _0x36aa9f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfc04('0x58')]({'where':{'id':_0x396512[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x111b63,null))[_0xfc04('0x11')](function(_0x326af3){if(_0x326af3){_0xb5acbd[_0xfc04('0x35')]=_[_0xfc04('0x36')](db[_0xfc04('0xce')]['rawAttributes']);_0xb5acbd[_0xfc04('0x39')]=_[_0xfc04('0x36')](_0x396512[_0xfc04('0x39')]);_0xb5acbd[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0xb5acbd[_0xfc04('0x35')],_0xb5acbd[_0xfc04('0x39')]);_0x5bc121['attributes']=_[_0xfc04('0x38')](_0xb5acbd[_0xfc04('0x35')],qs[_0xfc04('0x3a')](_0x396512[_0xfc04('0x39')][_0xfc04('0x3a')]));_0x5bc121['attributes']=_0x5bc121[_0xfc04('0x3b')][_0xfc04('0x3c')]?_0x5bc121['attributes']:_0xb5acbd[_0xfc04('0x35')];if(!_0x396512['query'][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x5bc121[_0xfc04('0x21')]=qs[_0xfc04('0x21')](_0x396512[_0xfc04('0x39')]['limit']);_0x5bc121[_0xfc04('0x20')]=qs[_0xfc04('0x20')](_0x396512[_0xfc04('0x39')][_0xfc04('0x20')]);}_0x5bc121['order']=qs['sort'](_0x396512[_0xfc04('0x39')][_0xfc04('0x40')]);_0x5bc121[_0xfc04('0x43')]=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x396512[_0xfc04('0x39')],_0xb5acbd[_0xfc04('0x37')]));_0x5bc121['where'][_0xfc04('0x55')]=_0x326af3['id'];if(_0x396512[_0xfc04('0x39')]['filter']){_0x5bc121[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x5bc121[_0xfc04('0x43')],{'$or':_[_0xfc04('0x2f')](_0x5bc121[_0xfc04('0x3b')],function(_0x3f35a4){var _0x2e4cdd={};_0x2e4cdd[_0x3f35a4]={'$like':'%'+_0x396512[_0xfc04('0x39')][_0xfc04('0x42')]+'%'};return _0x2e4cdd;})});}_0x5bc121=_['merge']({},_0x5bc121,_0x396512[_0xfc04('0x45')]);return db[_0xfc04('0xce')][_0xfc04('0x23')]({'where':_0x5bc121[_0xfc04('0x43')]})[_0xfc04('0x11')](function(_0x431d9b){_0x36aa9f['count']=_0x431d9b;if(_0x396512[_0xfc04('0x39')]['includeAll']){_0x5bc121[_0xfc04('0x4b')]=[{'all':!![]}];}else{_0x5bc121['include']=[{'model':db[_0xfc04('0x7f')],'as':_0xfc04('0x11e'),'required':![]},{'model':db[_0xfc04('0xd8')],'as':'Attachments','required':![]}];}return db[_0xfc04('0xce')][_0xfc04('0x59')](_0x5bc121);})[_0xfc04('0x11')](function(_0x5ca41c){_0x36aa9f[_0xfc04('0x47')]=_0x5ca41c;return _0x36aa9f;});}})[_0xfc04('0x11')](respondWithFilteredResult(_0x111b63,_0x5bc121))['catch'](handleError(_0x111b63,null));};exports[_0xfc04('0x11f')]=function(_0x4f59a0,_0x22f02b){return db[_0xfc04('0x30')]['find']({'where':{'id':_0x4f59a0[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x22f02b,null))[_0xfc04('0x11')](function(_0x552b40){if(_0x552b40){return _0x552b40[_0xfc04('0x11f')](_0x4f59a0[_0xfc04('0x52')][_0xfc04('0x5b')],_[_0xfc04('0xea')](_0x4f59a0[_0xfc04('0x52')],[_0xfc04('0x5b'),'id'])||{})['spread'](function(_0x303d6c){for(var _0x4e555b=0x0;_0x4e555b<_0x4f59a0['body'][_0xfc04('0x5b')][_0xfc04('0x3c')];_0x4e555b+=0x1){socket[_0xfc04('0x120')]('userChatWebsite:save',{'UserId':Number(_0x4f59a0[_0xfc04('0x52')]['ids'][_0x4e555b]),'ChatWebsiteId':Number(_0x4f59a0[_0xfc04('0x49')]['id'])});}return _0x303d6c;});}})[_0xfc04('0x11')](respondWithResult(_0x22f02b,null))[_0xfc04('0x1b')](handleError(_0x22f02b,null));};exports[_0xfc04('0x121')]=function(_0x2afe96,_0x2c0c0f){return db[_0xfc04('0x30')][_0xfc04('0x4c')]({'where':{'id':_0x2afe96[_0xfc04('0x49')]['id']}})[_0xfc04('0x11')](handleEntityNotFound(_0x2c0c0f,null))[_0xfc04('0x11')](function(_0x3efa04){if(_0x3efa04){return _0x3efa04[_0xfc04('0x121')](_0x2afe96[_0xfc04('0x39')][_0xfc04('0x5b')])[_0xfc04('0x11')](function(){if(_[_0xfc04('0x122')](_0x2afe96['query']['ids'])){for(var _0x4ef942=0x0;_0x4ef942<_0x2afe96[_0xfc04('0x39')]['ids']['length'];_0x4ef942+=0x1){socket[_0xfc04('0x120')](_0xfc04('0x123'),{'UserId':Number(_0x2afe96[_0xfc04('0x39')][_0xfc04('0x5b')][_0x4ef942]),'ChatWebsiteId':Number(_0x2afe96[_0xfc04('0x49')]['id'])});}}else{socket[_0xfc04('0x120')](_0xfc04('0x123'),{'UserId':Number(_0x2afe96[_0xfc04('0x39')][_0xfc04('0x5b')]),'ChatWebsiteId':Number(_0x2afe96[_0xfc04('0x49')]['id'])});}});}})[_0xfc04('0x11')](respondWithStatusCode(_0x2c0c0f,null))['catch'](handleError(_0x2c0c0f,null));};exports[_0xfc04('0x124')]=function(_0x2fc05c,_0x3e76fc){var _0x3de96c={};var _0x3b6fbf={};var _0x1cba9d;var _0x24a865;return db[_0xfc04('0x30')][_0xfc04('0x58')]({'where':{'id':_0x2fc05c[_0xfc04('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e76fc,null))[_0xfc04('0x11')](function(_0x476441){if(_0x476441){_0x1cba9d=_0x476441;_0x3b6fbf[_0xfc04('0x35')]=_[_0xfc04('0x36')](db[_0xfc04('0xb7')][_0xfc04('0x31')]);_0x3b6fbf[_0xfc04('0x39')]=_[_0xfc04('0x36')](_0x2fc05c['query']);_0x3b6fbf[_0xfc04('0x37')]=_[_0xfc04('0x38')](_0x3b6fbf[_0xfc04('0x35')],_0x3b6fbf['query']);_0x3de96c[_0xfc04('0x3b')]=_[_0xfc04('0x38')](_0x3b6fbf['model'],qs[_0xfc04('0x3a')](_0x2fc05c[_0xfc04('0x39')]['fields']));_0x3de96c[_0xfc04('0x3b')]=_0x3de96c[_0xfc04('0x3b')]['length']?_0x3de96c[_0xfc04('0x3b')]:_0x3b6fbf['model'];_0x3de96c[_0xfc04('0x3f')]=qs[_0xfc04('0x40')](_0x2fc05c[_0xfc04('0x39')][_0xfc04('0x40')]);_0x3de96c[_0xfc04('0x43')]=qs[_0xfc04('0x37')](_[_0xfc04('0x41')](_0x2fc05c[_0xfc04('0x39')],_0x3b6fbf[_0xfc04('0x37')]));if(_0x2fc05c['query'][_0xfc04('0x42')]){_0x3de96c[_0xfc04('0x43')]=_[_0xfc04('0x44')](_0x3de96c[_0xfc04('0x43')],{'$or':_['map'](_0x3de96c[_0xfc04('0x3b')],function(_0x18e3a9){var _0x2eeff7={};_0x2eeff7[_0x18e3a9]={'$like':'%'+_0x2fc05c[_0xfc04('0x39')][_0xfc04('0x42')]+'%'};return _0x2eeff7;})});}_0x3de96c=_[_0xfc04('0x44')]({},_0x3de96c,_0x2fc05c['options']);return _0x1cba9d[_0xfc04('0x124')](_0x3de96c);}})[_0xfc04('0x11')](function(_0xf9099b){if(_0xf9099b){_0x24a865=_0xf9099b['length'];if(!_0x2fc05c[_0xfc04('0x39')][_0xfc04('0x3d')](_0xfc04('0x3e'))){_0x3de96c[_0xfc04('0x21')]=qs['limit'](_0x2fc05c[_0xfc04('0x39')][_0xfc04('0x21')]);_0x3de96c['offset']=qs['offset'](_0x2fc05c[_0xfc04('0x39')][_0xfc04('0x20')]);}return _0x1cba9d[_0xfc04('0x124')](_0x3de96c);}})[_0xfc04('0x11')](function(_0x3bc324){if(_0x3bc324){return _0x3bc324?{'count':_0x24a865,'rows':_0x3bc324}:null;}})[_0xfc04('0x11')](respondWithResult(_0x3e76fc,null))[_0xfc04('0x1b')](handleError(_0x3e76fc,null));}; \ No newline at end of file +var _0xa539=['getAnswers','removeAnswers','addLogo','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','ChatApplication','List','account','applications','Applications','orderBy','priority','ListId','from','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','basename','sequelize','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','email','user','openNewInteraction','MailAccountId','subjectOffline','mapValues','MailAccount','offlineMessageSubject','notifyMail','offline-chat','remove','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','License','increment','Intervals','all','some','remote','stringify','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','getAgents','mustache','util','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0x587fb1,_0x1fa311){var _0x5aa5d5=function(_0x5d96c7){while(--_0x5d96c7){_0x587fb1['push'](_0x587fb1['shift']());}};_0x5aa5d5(++_0x1fa311);}(_0xa539,0x1e9));var _0x9a53=function(_0x9a460d,_0x17c929){_0x9a460d=_0x9a460d-0x0;var _0x4b915a=_0xa539[_0x9a460d];return _0x4b915a;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x9a53('0x0'));var util=require(_0x9a53('0x1'));var path=require(_0x9a53('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a53('0x3'));var _=require(_0x9a53('0x4'));var querystring=require(_0x9a53('0x5'));var Redis=require(_0x9a53('0x6'));var qs=require(_0x9a53('0x7'));var logger=require('../../config/logger')(_0x9a53('0x8'));var config=require(_0x9a53('0x9'));var db=require(_0x9a53('0xa'))['db'];config[_0x9a53('0xb')]=_[_0x9a53('0xc')](config[_0x9a53('0xb')],{'host':_0x9a53('0xd'),'port':0x18eb});var socket=require(_0x9a53('0xe'))(new Redis(config[_0x9a53('0xb')]));require(_0x9a53('0xf'))[_0x9a53('0x10')](socket);var htmlToText=require(_0x9a53('0x11'));var jayson=require(_0x9a53('0x12'));var client=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232c});var client9002=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232a});var client9003=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232b});var client9001=jayson[_0x9a53('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3ab0d3,_0x5c0650,_0x245ba1,_0x46bc5e){return new BPromise(function(_0x538255,_0x3b08c3){var _0x3322a8=_0x46bc5e||client;return _0x3322a8[_0x9a53('0x15')](_0x3ab0d3,_0x245ba1)[_0x9a53('0x16')](function(_0x2eeff2){logger['info'](_0x9a53('0x17'),_0x5c0650,_0x9a53('0x18'));logger[_0x9a53('0x19')](_0x9a53('0x1a'),_0x5c0650,'request\x20sent',JSON['stringify'](_0x2eeff2));if(_0x2eeff2[_0x9a53('0x1b')]){if(_0x2eeff2['error']['code']===0x1f4){logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2eeff2[_0x9a53('0x1b')][_0x9a53('0x1c')]);return _0x3b08c3(_0x2eeff2[_0x9a53('0x1b')]['message']);}logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2eeff2[_0x9a53('0x1b')][_0x9a53('0x1c')]);return _0x538255(_0x2eeff2['error'][_0x9a53('0x1c')]);}else{logger['info'](_0x9a53('0x17'),_0x5c0650,'request\x20sent');_0x538255(_0x2eeff2[_0x9a53('0x1d')][_0x9a53('0x1c')]);}})[_0x9a53('0x1e')](function(_0x2255ac){logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2255ac);_0x3b08c3(_0x2255ac);});});}function respondWithStatusCode(_0x136657,_0x21abb9){_0x21abb9=_0x21abb9||0xcc;return function(_0x4cc45e){if(_0x4cc45e){return _0x136657['sendStatus'](_0x21abb9);}return _0x136657[_0x9a53('0x1f')](_0x21abb9)[_0x9a53('0x20')]();};}function respondWithResult(_0x461f00,_0x592af1){_0x592af1=_0x592af1||0xc8;return function(_0x2d602d){if(_0x2d602d){return _0x461f00[_0x9a53('0x1f')](_0x592af1)[_0x9a53('0x21')](_0x2d602d);}};}function respondWithFilteredResult(_0x288300,_0x2671b1){return function(_0x551c1d){if(_0x551c1d){var _0x3456b3=typeof _0x2671b1['offset']==='undefined'&&typeof _0x2671b1[_0x9a53('0x22')]==='undefined';var _0x24aad7=_0x551c1d[_0x9a53('0x23')];var _0x2a92b1=_0x3456b3?0x0:_0x2671b1[_0x9a53('0x24')];var _0x507ceb=_0x3456b3?_0x551c1d['count']:_0x2671b1[_0x9a53('0x24')]+_0x2671b1['limit'];var _0x18f9d5;if(_0x507ceb>=_0x24aad7){_0x507ceb=_0x24aad7;_0x18f9d5=0xc8;}else{_0x18f9d5=0xce;}_0x288300[_0x9a53('0x1f')](_0x18f9d5);return _0x288300[_0x9a53('0x25')](_0x9a53('0x26'),_0x2a92b1+'-'+_0x507ceb+'/'+_0x24aad7)[_0x9a53('0x21')](_0x551c1d);}return null;};}function saveUpdates(_0xa5150b){return function(_0x20e6aa){if(_0x20e6aa){return _0x20e6aa[_0x9a53('0x27')](_0xa5150b)[_0x9a53('0x16')](function(_0x2be02a){return _0x2be02a;});}return null;};}function removeEntity(_0x400947){return function(_0x227f22){if(_0x227f22){return _0x227f22[_0x9a53('0x28')]()[_0x9a53('0x16')](function(){var _0x4b3fdb=_0x227f22[_0x9a53('0x29')]({'plain':!![]});var _0x3f48b1=_0x9a53('0x2a');return db['UserProfileResource'][_0x9a53('0x28')]({'where':{'type':_0x3f48b1,'resourceId':_0x4b3fdb['id']}})[_0x9a53('0x16')](function(){return _0x227f22;});})['then'](function(){_0x400947[_0x9a53('0x1f')](0xcc)[_0x9a53('0x20')]();});}};}function handleEntityNotFound(_0x4e8aeb){return function(_0x16e9a1){if(!_0x16e9a1){_0x4e8aeb[_0x9a53('0x2b')](0x194);}return _0x16e9a1;};}function handleError(_0x4f9218,_0x5d429d){_0x5d429d=_0x5d429d||0x1f4;return function(_0x2d1d9a){logger[_0x9a53('0x1b')](_0x2d1d9a['stack']);if(_0x2d1d9a[_0x9a53('0x2c')]){delete _0x2d1d9a[_0x9a53('0x2c')];}_0x4f9218[_0x9a53('0x1f')](_0x5d429d)[_0x9a53('0x2d')](_0x2d1d9a);};}exports[_0x9a53('0x2e')]=function(_0x396720,_0x1fc9b8){var _0x4ed0c5={'include':[{'model':db[_0x9a53('0x2f')],'as':_0x9a53('0x30')}]},_0x11c839={},_0x5efec8={'count':0x0,'rows':[]};var _0x205b66=_[_0x9a53('0x31')](db[_0x9a53('0x32')][_0x9a53('0x33')],function(_0x16014e){return{'name':_0x16014e[_0x9a53('0x34')],'type':_0x16014e[_0x9a53('0x35')][_0x9a53('0x36')]};});_0x11c839['model']=_['map'](_0x205b66,'name');_0x11c839[_0x9a53('0x37')]=_['keys'](_0x396720['query']);_0x11c839[_0x9a53('0x38')]=_['intersection'](_0x11c839[_0x9a53('0x39')],_0x11c839[_0x9a53('0x37')]);_0x4ed0c5[_0x9a53('0x3a')]=_['intersection'](_0x11c839[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x396720[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x4ed0c5[_0x9a53('0x3a')]=_0x4ed0c5[_0x9a53('0x3a')]['length']?_0x4ed0c5[_0x9a53('0x3a')]:_0x11c839[_0x9a53('0x39')];if(!_0x396720[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x4ed0c5['limit']=qs[_0x9a53('0x22')](_0x396720[_0x9a53('0x37')][_0x9a53('0x22')]);_0x4ed0c5[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x396720[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x4ed0c5['order']=qs[_0x9a53('0x3e')](_0x396720[_0x9a53('0x37')]['sort']);_0x4ed0c5['where']=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x396720[_0x9a53('0x37')],_0x11c839['filters']),_0x205b66);if(_0x396720[_0x9a53('0x37')][_0x9a53('0x40')]){_0x4ed0c5[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x4ed0c5[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x205b66,function(_0x2fe36e){if(_0x2fe36e[_0x9a53('0x35')]!==_0x9a53('0x43')){var _0x38cd58={};_0x38cd58[_0x2fe36e[_0x9a53('0x2c')]]={'$like':'%'+_0x396720[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x38cd58;}})});}_0x4ed0c5=_[_0x9a53('0x42')]({},_0x4ed0c5,_0x396720[_0x9a53('0x44')]);var _0x86e2ab={'where':_0x4ed0c5[_0x9a53('0x41')]};return db[_0x9a53('0x32')]['count'](_0x86e2ab)[_0x9a53('0x16')](function(_0x408253){_0x5efec8[_0x9a53('0x23')]=_0x408253;if(_0x396720[_0x9a53('0x37')][_0x9a53('0x45')]){_0x4ed0c5[_0x9a53('0x46')]=[{'all':!![]}];}return db[_0x9a53('0x32')][_0x9a53('0x47')](_0x4ed0c5);})[_0x9a53('0x16')](function(_0x5f16df){_0x5efec8[_0x9a53('0x48')]=_0x5f16df;return _0x5efec8;})[_0x9a53('0x16')](respondWithFilteredResult(_0x1fc9b8,_0x4ed0c5))[_0x9a53('0x1e')](handleError(_0x1fc9b8,null));};exports[_0x9a53('0x49')]=function(_0x253f14,_0x455d0c){var _0x595000={'raw':![],'where':{'id':_0x253f14[_0x9a53('0x4a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x20157c={};_0x20157c[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db[_0x9a53('0x32')][_0x9a53('0x33')]);_0x20157c[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x253f14[_0x9a53('0x37')]);_0x20157c[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x20157c[_0x9a53('0x39')],_0x20157c[_0x9a53('0x37')]);_0x595000[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x20157c[_0x9a53('0x39')],qs['fields'](_0x253f14['query'][_0x9a53('0x3b')]));_0x595000[_0x9a53('0x3a')]=_0x595000['attributes'][_0x9a53('0x4d')]?_0x595000[_0x9a53('0x3a')]:_0x20157c['model'];if(_0x253f14[_0x9a53('0x37')]['includeAll']){_0x595000[_0x9a53('0x46')]=[{'all':!![]}];}_0x595000=_[_0x9a53('0x42')]({},_0x595000,_0x253f14['options']);return db['ChatWebsite'][_0x9a53('0x4e')](_0x595000)[_0x9a53('0x16')](handleEntityNotFound(_0x455d0c,null))['then'](respondWithResult(_0x455d0c,null))['catch'](handleError(_0x455d0c,null));};exports['create']=function(_0x26faa7,_0x2a547a){return db[_0x9a53('0x32')][_0x9a53('0x4f')](_0x26faa7[_0x9a53('0x50')],{})[_0x9a53('0x16')](function(_0x38d68a){var _0x41784f=_0x26faa7['user']['get']({'plain':!![]});if(!_0x41784f)throw new Error(_0x9a53('0x51'));if(_0x41784f[_0x9a53('0x52')]==='user'){var _0x7b40f0=_0x38d68a['get']({'plain':!![]});var _0x50b6c8=_0x9a53('0x2a');return db[_0x9a53('0x53')]['find']({'where':{'name':_0x50b6c8,'userProfileId':_0x41784f[_0x9a53('0x54')]},'raw':!![]})[_0x9a53('0x16')](function(_0x21831b){if(_0x21831b&&_0x21831b[_0x9a53('0x55')]===0x0){return db[_0x9a53('0x56')][_0x9a53('0x4f')]({'name':_0x7b40f0[_0x9a53('0x2c')],'resourceId':_0x7b40f0['id'],'type':_0x21831b[_0x9a53('0x2c')],'sectionId':_0x21831b['id']},{})[_0x9a53('0x16')](function(){return _0x38d68a;});}else{return _0x38d68a;}})[_0x9a53('0x1e')](function(_0x52c235){logger[_0x9a53('0x1b')](_0x9a53('0x57'),_0x52c235);throw _0x52c235;});}return _0x38d68a;})[_0x9a53('0x16')](respondWithResult(_0x2a547a,0xc9))['catch'](handleError(_0x2a547a,null));};exports[_0x9a53('0x27')]=function(_0x1b5a5a,_0x45e76c){if(_0x1b5a5a['body']['id']){delete _0x1b5a5a[_0x9a53('0x50')]['id'];}return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1b5a5a[_0x9a53('0x4a')]['id']},'include':[{'model':db[_0x9a53('0x2f')],'as':_0x9a53('0x30')}]})[_0x9a53('0x16')](handleEntityNotFound(_0x45e76c,null))[_0x9a53('0x16')](saveUpdates(_0x1b5a5a[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x45e76c,null))[_0x9a53('0x1e')](handleError(_0x45e76c,null));};exports['destroy']=function(_0x192d55,_0xb812fd){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x192d55['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0xb812fd,null))[_0x9a53('0x16')](removeEntity(_0xb812fd,null))[_0x9a53('0x1e')](handleError(_0xb812fd,null));};exports[_0x9a53('0x58')]=function(_0x4602be,_0x3ff117){return db[_0x9a53('0x32')][_0x9a53('0x58')]()[_0x9a53('0x16')](respondWithResult(_0x3ff117,null))['catch'](handleError(_0x3ff117,null));};exports[_0x9a53('0x59')]=function(_0x1513d8,_0x2b9575){if(_0x1513d8[_0x9a53('0x50')]['id']){delete _0x1513d8[_0x9a53('0x50')]['id'];}return db['ChatWebsite'][_0x9a53('0x4e')]({'where':{'id':_0x1513d8[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x2b9575,null))['then'](function(_0x17e26e){if(_0x17e26e){_0x1513d8[_0x9a53('0x50')][_0x9a53('0x5a')]=_0x17e26e['id'];return db['Disposition'][_0x9a53('0x4f')](_0x1513d8[_0x9a53('0x50')]);}})[_0x9a53('0x16')](respondWithResult(_0x2b9575,null))[_0x9a53('0x1e')](handleError(_0x2b9575,null));};exports[_0x9a53('0x5b')]=function(_0x3a55bf,_0x430277){var _0x51967b={'raw':![],'where':{}};var _0x6fcca={};var _0x420564={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9a53('0x5c')]({'where':{'id':_0x3a55bf[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x430277,null))[_0x9a53('0x16')](function(_0x1d87a8){if(_0x1d87a8){_0x6fcca[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['Disposition']['rawAttributes']);_0x6fcca[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x3a55bf['query']);_0x6fcca[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x6fcca[_0x9a53('0x39')],_0x6fcca['query']);_0x51967b[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x6fcca['model'],qs[_0x9a53('0x3b')](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x51967b[_0x9a53('0x3a')]=_0x51967b[_0x9a53('0x3a')]['length']?_0x51967b[_0x9a53('0x3a')]:_0x6fcca[_0x9a53('0x39')];if(!_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x51967b[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x3a55bf['query'][_0x9a53('0x22')]);_0x51967b[_0x9a53('0x24')]=qs['offset'](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x51967b[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x51967b[_0x9a53('0x41')]=qs['filters'](_[_0x9a53('0x3f')](_0x3a55bf['query'],_0x6fcca[_0x9a53('0x38')]));_0x51967b[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x1d87a8['id'];if(_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x40')]){_0x51967b[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x51967b[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x51967b[_0x9a53('0x3a')],function(_0xc15f6){var _0x2f34fc={};_0x2f34fc[_0xc15f6]={'$like':'%'+_0x3a55bf['query'][_0x9a53('0x40')]+'%'};return _0x2f34fc;})});}_0x51967b=_['merge']({},_0x51967b,_0x3a55bf[_0x9a53('0x44')]);return db[_0x9a53('0x5e')]['count']({'where':_0x51967b[_0x9a53('0x41')]})[_0x9a53('0x16')](function(_0x1f0c1a){_0x420564[_0x9a53('0x23')]=_0x1f0c1a;if(_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x45')]){_0x51967b[_0x9a53('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x51967b);})['then'](function(_0x367260){_0x420564[_0x9a53('0x48')]=_0x367260;return _0x420564;});}})['then'](respondWithFilteredResult(_0x430277,_0x51967b))[_0x9a53('0x1e')](handleError(_0x430277,null));};exports[_0x9a53('0x5f')]=function(_0x2d99a8,_0x482e3f){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x2d99a8[_0x9a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482e3f,null))['then'](function(_0xfe4319){if(_0xfe4319){return _0xfe4319[_0x9a53('0x5f')](_0x2d99a8[_0x9a53('0x37')][_0x9a53('0x60')]);}})['then'](respondWithStatusCode(_0x482e3f,null))[_0x9a53('0x1e')](handleError(_0x482e3f,null));};exports[_0x9a53('0x61')]=function(_0xd65fe3,_0x15f396){if(_0xd65fe3['body']['id']){delete _0xd65fe3[_0x9a53('0x50')]['id'];}return db[_0x9a53('0x32')]['find']({'where':{'id':_0xd65fe3['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x15f396,null))['then'](function(_0x41bcad){if(_0x41bcad){_0xd65fe3[_0x9a53('0x50')][_0x9a53('0x5a')]=_0x41bcad['id'];return db[_0x9a53('0x62')][_0x9a53('0x4f')](_0xd65fe3[_0x9a53('0x50')]);}})[_0x9a53('0x16')](respondWithResult(_0x15f396,null))[_0x9a53('0x1e')](handleError(_0x15f396,null));};exports[_0x9a53('0x63')]=function(_0x5ebba2,_0x568b7b){var _0xba0dd0={'raw':![],'where':{}};var _0x3fe61d={};var _0x1fd699={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0x5ebba2['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x568b7b,null))['then'](function(_0x22ddb5){if(_0x22ddb5){_0x3fe61d[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['CannedAnswer']['rawAttributes']);_0x3fe61d[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x5ebba2[_0x9a53('0x37')]);_0x3fe61d['filters']=_[_0x9a53('0x4c')](_0x3fe61d['model'],_0x3fe61d[_0x9a53('0x37')]);_0xba0dd0[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x3fe61d['model'],qs[_0x9a53('0x3b')](_0x5ebba2['query']['fields']));_0xba0dd0[_0x9a53('0x3a')]=_0xba0dd0[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0xba0dd0[_0x9a53('0x3a')]:_0x3fe61d[_0x9a53('0x39')];if(!_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0xba0dd0[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x5ebba2['query'][_0x9a53('0x22')]);_0xba0dd0[_0x9a53('0x24')]=qs['offset'](_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x24')]);}_0xba0dd0['order']=qs[_0x9a53('0x3e')](_0x5ebba2[_0x9a53('0x37')]['sort']);_0xba0dd0[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_['pick'](_0x5ebba2[_0x9a53('0x37')],_0x3fe61d[_0x9a53('0x38')]));_0xba0dd0[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x22ddb5['id'];if(_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x40')]){_0xba0dd0[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0xba0dd0[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0xba0dd0[_0x9a53('0x3a')],function(_0x4564da){var _0x3d98e0={};_0x3d98e0[_0x4564da]={'$like':'%'+_0x5ebba2['query'][_0x9a53('0x40')]+'%'};return _0x3d98e0;})});}_0xba0dd0=_[_0x9a53('0x42')]({},_0xba0dd0,_0x5ebba2[_0x9a53('0x44')]);return db[_0x9a53('0x62')][_0x9a53('0x23')]({'where':_0xba0dd0['where']})[_0x9a53('0x16')](function(_0x17530e){_0x1fd699[_0x9a53('0x23')]=_0x17530e;if(_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x45')]){_0xba0dd0[_0x9a53('0x46')]=[{'all':!![]}];}return db[_0x9a53('0x62')][_0x9a53('0x47')](_0xba0dd0);})[_0x9a53('0x16')](function(_0x19b52b){_0x1fd699[_0x9a53('0x48')]=_0x19b52b;return _0x1fd699;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x568b7b,_0xba0dd0))[_0x9a53('0x1e')](handleError(_0x568b7b,null));};exports[_0x9a53('0x64')]=function(_0x230c64,_0x36fffa){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x230c64[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x36fffa,null))[_0x9a53('0x16')](function(_0x11ce42){if(_0x11ce42){return _0x11ce42['removeAnswers'](_0x230c64['query'][_0x9a53('0x60')]);}})[_0x9a53('0x16')](respondWithStatusCode(_0x36fffa,null))[_0x9a53('0x1e')](handleError(_0x36fffa,null));};exports[_0x9a53('0x65')]=function(_0x57389f,_0x584502){_0x57389f[_0x9a53('0x50')]['sitepic']=_0x57389f['file']['filename'];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x57389f[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x584502,null))[_0x9a53('0x16')](saveUpdates(_0x57389f[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x584502,null))['catch'](handleError(_0x584502,null));};exports[_0x9a53('0x66')]=function(_0x1158aa,_0x144242){_0x1158aa[_0x9a53('0x50')][_0x9a53('0x67')]=_0x1158aa[_0x9a53('0x68')][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1158aa[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x144242,null))['then'](saveUpdates(_0x1158aa['body'],null))[_0x9a53('0x16')](respondWithResult(_0x144242,null))[_0x9a53('0x1e')](handleError(_0x144242,null));};exports[_0x9a53('0x6a')]=function(_0x547f10,_0x4f4d70){_0x547f10[_0x9a53('0x50')][_0x9a53('0x6b')]=_0x547f10[_0x9a53('0x68')][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x547f10[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x4f4d70,null))[_0x9a53('0x16')](saveUpdates(_0x547f10[_0x9a53('0x50')],null))['then'](respondWithResult(_0x4f4d70,null))[_0x9a53('0x1e')](handleError(_0x4f4d70,null));};exports[_0x9a53('0x6c')]=function(_0x296c15,_0x33c79e){_0x296c15[_0x9a53('0x50')][_0x9a53('0x6d')]=_0x296c15['file'][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x296c15[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x33c79e,null))[_0x9a53('0x16')](saveUpdates(_0x296c15[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x33c79e,null))[_0x9a53('0x1e')](handleError(_0x33c79e,null));};exports[_0x9a53('0x6e')]=function(_0x1ed85c,_0x488642){var _0x2a3d84=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x71'));var _0x11b52b={'where':{'id':_0x1ed85c[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x72')],'raw':!![]};var _0x19a5e4=![];return require(_0x9a53('0x73'))[_0x9a53('0x74')]()[_0x9a53('0x16')](function(_0x8c39ad){if(_0x8c39ad){_0x19a5e4=_0x8c39ad[_0x9a53('0x75')];}})[_0x9a53('0x16')](function(){return db[_0x9a53('0x32')][_0x9a53('0x4e')](_0x11b52b);})[_0x9a53('0x16')](handleEntityNotFound(_0x488642,null))[_0x9a53('0x16')](function(_0x3ec5ef){if(_0x3ec5ef){if(!_[_0x9a53('0x76')](_0x3ec5ef[_0x9a53('0x72')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x78'),_0x3ec5ef[_0x9a53('0x72')]))&&_0x19a5e4){_0x2a3d84=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/logos/',_0x3ec5ef[_0x9a53('0x72')]);}}return _0x488642[_0x9a53('0x79')](_0x2a3d84);}})[_0x9a53('0x1e')](handleError(_0x488642,null));};exports[_0x9a53('0x7a')]=function(_0x89f352,_0x27f58a){var _0x2d77d9=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/avatars/default_avatar.png');var _0x41c4f2={'where':{'id':_0x89f352[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x67')],'raw':!![]};return db[_0x9a53('0x32')]['find'](_0x41c4f2)[_0x9a53('0x16')](handleEntityNotFound(_0x27f58a,null))[_0x9a53('0x16')](function(_0x4823ab){if(_0x4823ab){if(!_[_0x9a53('0x76')](_0x4823ab[_0x9a53('0x67')])){if(fs['existsSync'](path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x4823ab[_0x9a53('0x67')]))){_0x2d77d9=path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x4823ab[_0x9a53('0x67')]);}}return _0x27f58a['download'](_0x2d77d9);}})[_0x9a53('0x1e')](handleError(_0x27f58a,null));};exports[_0x9a53('0x7c')]=function(_0x58787b,_0x24af34){var _0x5885c3=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7d'));var _0x1cb6a8={'where':{'id':_0x58787b[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x6b'),_0x9a53('0x7e')],'raw':!![]};return db['ChatWebsite']['find'](_0x1cb6a8)['then'](handleEntityNotFound(_0x24af34,null))[_0x9a53('0x16')](function(_0x27c9a7){if(_0x27c9a7){if(!_[_0x9a53('0x76')](_0x27c9a7[_0x9a53('0x6b')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x27c9a7[_0x9a53('0x6b')]))&&_0x27c9a7[_0x9a53('0x7e')]){_0x5885c3=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/avatars/',_0x27c9a7['customerAvatar']);}}return _0x24af34[_0x9a53('0x79')](_0x5885c3);}})['catch'](handleError(_0x24af34,null));};exports[_0x9a53('0x7f')]=function(_0x531ad4,_0x53462a){var _0xb485e5=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x80'));var _0x5c8a46={'where':{'id':_0x531ad4[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x6d')],'raw':!![]};return db['ChatWebsite'][_0x9a53('0x4e')](_0x5c8a46)[_0x9a53('0x16')](handleEntityNotFound(_0x53462a,null))[_0x9a53('0x16')](function(_0x3b58e4){if(_0x3b58e4){if(!_[_0x9a53('0x76')](_0x3b58e4[_0x9a53('0x6d')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7b'),_0x3b58e4[_0x9a53('0x6d')]))){_0xb485e5=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7b'),_0x3b58e4[_0x9a53('0x6d')]);}}return _0x53462a[_0x9a53('0x79')](_0xb485e5);}})['catch'](handleError(_0x53462a,null));};exports[_0x9a53('0x81')]=function(_0x1bec48,_0x58f832){var _0x35f46f=require(_0x9a53('0x82'));var _0x57ae27=new _0x35f46f();var _0x1b764c=_0x57ae27[_0x9a53('0x83')](_0x1bec48['headers'][_0x9a53('0x84')])['getResult']();var _0x1a7302={'body':_0x1bec48[_0x9a53('0x50')],'channel':'chat'};var _0x2df2c7=[];var _0x6b1a36=[];var _0x4a1c16={};var _0x17738e=![];return db[_0x9a53('0x85')]['describe']()['then'](function(_0x146ac3){if(!_0x146ac3){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x88'));}_0x2df2c7=_[_0x9a53('0x89')](_[_0x9a53('0x4b')](_0x146ac3),[_0x9a53('0x8a'),_0x9a53('0x8b')]);_0x6b1a36=_[_0x9a53('0x89')](_['keys'](_0x146ac3),[_0x9a53('0x8a'),'updatedAt',_0x9a53('0x8c'),'ListId']);if(_0x1bec48[_0x9a53('0x50')]['id']){delete _0x1bec48[_0x9a53('0x50')]['id'];}if(_[_0x9a53('0x76')](_0x1bec48[_0x9a53('0x50')]['from'])){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x8d'));}if(_['isNil'](_0x1bec48[_0x9a53('0x50')][_0x9a53('0x50')])||_0x1bec48[_0x9a53('0x50')]['body']===''){throw new db[(_0x9a53('0x86'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9a53('0x76')](_0x1bec48[_0x9a53('0x50')][_0x9a53('0x8e')])){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6b1a36);}if(!_[_0x9a53('0x8f')](_0x6b1a36,_0x1bec48[_0x9a53('0x50')][_0x9a53('0x8e')])){throw new db[(_0x9a53('0x86'))]['ValidationError'](_0x9a53('0x90')+_0x6b1a36);}_0x4a1c16[_0x1bec48['body'][_0x9a53('0x8e')]]=_0x1bec48[_0x9a53('0x50')]['from'];})[_0x9a53('0x16')](function(){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1bec48['params']['id']},'include':[{'model':db[_0x9a53('0x91')],'as':'List','include':[{'model':db[_0x9a53('0x85')],'as':_0x9a53('0x92'),'where':_0x4a1c16,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x9a53('0x93')],'as':'Applications'}]});})[_0x9a53('0x16')](handleEntityNotFound(_0x58f832,null))[_0x9a53('0x16')](function(_0x478c2f){if(_0x478c2f&&_0x478c2f[_0x9a53('0x94')]){_0x1a7302[_0x9a53('0x95')]=_0x478c2f;_0x1a7302[_0x9a53('0x96')]=_0x478c2f[_0x9a53('0x97')];_0x1a7302['list']=_0x478c2f[_0x9a53('0x94')];_0x1a7302[_0x9a53('0x96')]=_[_0x9a53('0x98')](_0x1a7302[_0x9a53('0x96')],[_0x9a53('0x99')],['asc']);if(_0x1a7302['account'][_0x9a53('0x97')]){delete _0x1a7302[_0x9a53('0x95')][_0x9a53('0x97')];}if(_0x1a7302[_0x9a53('0x95')][_0x9a53('0x94')]&&_0x1a7302['account'][_0x9a53('0x94')]['Contacts'][_0x9a53('0x4d')]){return _0x1a7302[_0x9a53('0x95')]['List'][_0x9a53('0x92')][0x0];}var _0x532a45=_[_0x9a53('0xc')](_0x1bec48[_0x9a53('0x50')],{'firstName':_0x1bec48[_0x9a53('0x50')]['from'],'ListId':_0x478c2f[_0x9a53('0x9a')]});_0x532a45[_0x1bec48[_0x9a53('0x50')]['mapKey']]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0x9b')];return db[_0x9a53('0x85')][_0x9a53('0x4f')](_0x532a45,{'fields':_0x2df2c7,'raw':!![]});}})['then'](handleEntityNotFound(_0x58f832,null))[_0x9a53('0x16')](function(_0x3fd26a){_0x1a7302[_0x9a53('0x9c')]=_0x3fd26a;var _0x69fea3=_0x1bec48[_0x9a53('0x50')][_0x9a53('0x9d')];if(_0x1bec48[_0x9a53('0x9e')][_0x9a53('0x9f')]){_0x69fea3=_0x1bec48['headers']['cf-connecting-ip'];}else if(_0x1bec48[_0x9a53('0x9e')]['x-forwarded-for']){_0x69fea3=_['first'](_0x1bec48[_0x9a53('0x9e')][_0x9a53('0xa0')][_0x9a53('0xa1')](','));}if(_0x3fd26a){var _0x44709f={'ContactId':_0x3fd26a['id'],'ChatWebsiteId':_0x1bec48[_0x9a53('0x4a')]['id'],'from':(_0x3fd26a[_0x9a53('0xa2')]||'')+'\x20'+(_0x3fd26a['lastName']||''),'customerIp':_0x69fea3,'customerPort':_0x1bec48[_0x9a53('0x9e')]['x-real-port']?_0x1bec48['headers'][_0x9a53('0xa3')]:null,'referer':_0x1bec48['body'][_0x9a53('0xa4')],'browserName':_0x1b764c[_0x9a53('0xa5')][_0x9a53('0x2c')]&&_0x1b764c['browser'][_0x9a53('0xa6')]?util[_0x9a53('0xa7')](_0x9a53('0xa8'),_0x1b764c[_0x9a53('0xa5')][_0x9a53('0x2c')],_0x1b764c[_0x9a53('0xa5')][_0x9a53('0xa6')]):_0x9a53('0xa9'),'browserVersion':_0x1b764c['browser'][_0x9a53('0xa6')]||_0x9a53('0xa9'),'osName':util[_0x9a53('0xa7')](_0x9a53('0xa8'),_0x1b764c['os'][_0x9a53('0x2c')],_0x1b764c['os'][_0x9a53('0xa6')]),'osVersion':_0x1b764c['os']['version'],'deviceModel':_0x1b764c['device'][_0x9a53('0x39')]&&_0x1b764c['device'][_0x9a53('0xaa')]?util['format'](_0x9a53('0xab'),_0x1b764c[_0x9a53('0xac')][_0x9a53('0x39')],_0x1b764c[_0x9a53('0xac')][_0x9a53('0xaa')],_0x1b764c[_0x9a53('0xac')][_0x9a53('0x35')]):null,'deviceVendor':_0x1b764c[_0x9a53('0xac')][_0x9a53('0xaa')],'deviceType':_0x1b764c['device'][_0x9a53('0x35')],'formData':JSON['stringify'](_0x1bec48[_0x9a53('0x50')])};var _0x214762={'ChatWebsiteId':_0x1bec48['params']['id'],'closed':![]};if(_0x1bec48['body'][_0x9a53('0xad')]){_0x214762['threadId']=_0x1bec48[_0x9a53('0x50')]['threadId'];return db[_0x9a53('0xae')][_0x9a53('0x4e')]({'where':_0x214762})[_0x9a53('0x16')](function(_0x4e7266){if(_0x4e7266){return[_0x4e7266,![]];}_0x44709f[_0x9a53('0xad')]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')];_0x44709f[_0x9a53('0xaf')]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0xaf')];return db[_0x9a53('0xae')][_0x9a53('0x4f')](_0x44709f)[_0x9a53('0x16')](function(_0x1ab198){return[_0x1ab198,!![]];});});}_0x214762[_0x9a53('0xb0')]=_0x3fd26a['id'];if(_0x1bec48[_0x9a53('0x50')][_0x9a53('0xb1')]&&_0x1bec48[_0x9a53('0x50')][_0x9a53('0xb1')]['id']){_0x214762['id']=_0x1bec48[_0x9a53('0x50')]['interaction']['id'];return db[_0x9a53('0xae')]['find']({'where':_0x214762})[_0x9a53('0x16')](function(_0xc13c9a){if(_0xc13c9a){return[_0xc13c9a,![]];}return db[_0x9a53('0xae')][_0x9a53('0x4f')](_0x44709f)[_0x9a53('0x16')](function(_0x59aa11){return[_0x59aa11,!![]];});});}return db[_0x9a53('0xae')]['create'](_0x44709f)[_0x9a53('0x16')](function(_0x16be41){return[_0x16be41,!![]];});}})[_0x9a53('0xb2')](function(_0x5f1148,_0x28fcc0){if(_0x5f1148){_0x17738e=_0x28fcc0;if(!_0x28fcc0){var _0x1a6173={'from':(_0x1a7302[_0x9a53('0x9c')][_0x9a53('0xa2')]||'')+'\x20'+(_0x1a7302['contact'][_0x9a53('0xb3')]||'')};if(_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')]&&_0x1bec48[_0x9a53('0x50')]['messageId']&&_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')]!=_0x1bec48[_0x9a53('0x50')]['messageId']){_0x1a6173['threadId']=_0x1bec48['body'][_0x9a53('0xb4')];}return _0x5f1148['update'](_0x1a6173);}else{return _0x5f1148;}}})[_0x9a53('0x16')](function(_0x277172){_0x1a7302[_0x9a53('0xb1')]=_0x277172[_0x9a53('0x29')]({'plain':!![]});_0x1a7302['interaction'][_0x9a53('0xb5')]=_0x17738e;if(_0x1a7302['interaction'][_0x9a53('0xb5')]){if(_0x1a7302[_0x9a53('0x95')][_0x9a53('0xb6')]){_0x1a7302[_0x9a53('0x96')][_0x9a53('0xb7')]({'id':0x0,'priority':_0x1a7302[_0x9a53('0x96')][_0x9a53('0x4d')]+0x1,'app':'close','appdata':_0x9a53('0xb8'),'interval':_0x9a53('0xb9')});}}return db[_0x9a53('0xba')][_0x9a53('0x4f')]({'body':_0x1bec48[_0x9a53('0x50')][_0x9a53('0x50')],'ChatWebsiteId':_0x1bec48[_0x9a53('0x4a')]['id'],'ChatInteractionId':_0x277172['id'],'direction':'in','ContactId':_0x1a7302[_0x9a53('0x9c')]['id'],'AttachmentId':_0x1bec48[_0x9a53('0x50')]['AttachmentId']});})[_0x9a53('0x16')](function(_0x4904b7){_0x1a7302[_0x9a53('0x1c')]=_0x4904b7;if(_0x1a7302['interaction'][_0x9a53('0xbb')]){return db[_0x9a53('0xbc')][_0x9a53('0x4e')]({'attributes':['id',_0x9a53('0x2c')],'where':{'id':_0x1a7302[_0x9a53('0xb1')][_0x9a53('0xbb')]}})['then'](function(_0x30c5da){if(_0x30c5da){_0x1a7302[_0x9a53('0x96')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9a53('0xbd'),'appdata':_0x30c5da[_0x9a53('0x2c')]+','+(_0x1a7302[_0x9a53('0x95')][_0x9a53('0xbe')]||0xa),'interval':_0x9a53('0xb9')});_0x1a7302[_0x9a53('0xbf')]=!![];}return respondWithRpcPromise(_0x9a53('0xc0'),_0x9a53('0xc1'),_0x1a7302);});}return respondWithRpcPromise(_0x9a53('0xc0'),_0x9a53('0xc1'),_0x1a7302);})['then'](function(_0x1fe2f9){respondWithRpcPromise(_0x9a53('0xc2'),_0x9a53('0xc2'),{'event':_0x9a53('0x81'),'message':_0x1fe2f9},client9002);return _0x1fe2f9;})[_0x9a53('0x16')](respondWithResult(_0x58f832,null))[_0x9a53('0x1e')](handleError(_0x58f832,null));};exports[_0x9a53('0xc3')]=function(_0x15bdc8,_0x7d7498){var _0x4357d7,_0x1fb33,_0x39dade;var _0x5284e1=[];var _0x10ce66={};var _0x9e6485=_0x15bdc8[_0x9a53('0xc4')]||[];var _0x2a3039=[];var _0xf6e343;return db['CmContact'][_0x9a53('0x58')]()['then'](function(_0x60b0b0){if(!_0x60b0b0){throw new db[(_0x9a53('0x86'))]['ValidationError']('no\x20available\x20attributes');}_0x5284e1=_[_0x9a53('0x89')](_[_0x9a53('0x4b')](_0x60b0b0),['createdAt',_0x9a53('0x8b'),'CompanyId',_0x9a53('0x9a')]);if(_0x15bdc8[_0x9a53('0x50')]['id']){delete _0x15bdc8[_0x9a53('0x50')]['id'];}if(_[_0x9a53('0x76')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')])){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)[_0x9a53('0x2d')](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x8d')));}if(_[_0x9a53('0x76')](_0x15bdc8['body'][_0x9a53('0x50')])||_0x15bdc8['body'][_0x9a53('0x50')]===''){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)['send'](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9a53('0x76')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0xc5')])){throw _0x7d7498['status'](0x1f4)[_0x9a53('0x2d')](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0xc6')+_0x5284e1));}if(!_[_0x9a53('0x8f')](_0x5284e1,_0x15bdc8[_0x9a53('0x50')]['mapKeyOffline'])){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)['send'](new db[(_0x9a53('0x86'))]['ValidationError'](_0x9a53('0xc7')+_0x5284e1));}_0x10ce66[_0x15bdc8[_0x9a53('0x50')]['mapKeyOffline']]=_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')];})['then'](function(){return db['ChatWebsite'][_0x9a53('0x4e')]({'where':{'id':_0x15bdc8[_0x9a53('0x4a')]['id']},'include':[{'model':db[_0x9a53('0x91')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x9a53('0x16')](handleEntityNotFound(_0x7d7498,null))[_0x9a53('0x16')](function(_0x5739e9){if(_0x5739e9&&_0x5739e9[_0x9a53('0x94')]){_0x1fb33=_0x5739e9;var _0x35e471=_['defaults'](_0x15bdc8[_0x9a53('0x50')],{'firstName':_0x15bdc8[_0x9a53('0x50')]['from'],'phone':_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')],'ListId':_0x5739e9[_0x9a53('0x9a')]});_0x35e471[_0x15bdc8['body']['mapKeyOffline']]=_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')];return db[_0x9a53('0x85')][_0x9a53('0xc8')]({'where':_0x10ce66,'defaults':_0x35e471});}})[_0x9a53('0xb2')](function(_0x951004){if(_0x951004){_0x39dade=_0x951004;var _0x2eec47=fs[_0x9a53('0xc9')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/templates/chatOfflineMessage.ejs'),_0x9a53('0xca'));var _0x5be535=ejs[_0x9a53('0xcb')](_0x2eec47,{'body':_[_0x9a53('0xcc')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x50')]),'bodyTitle':_0x1fb33[_0x9a53('0xcd')]});return db[_0x9a53('0xce')][_0x9a53('0x4f')]({'body':_0x5be535,'plainBody':htmlToText[_0x9a53('0xcf')](_0x5be535),'ContactId':_0x951004['id'],'ChatWebsiteId':_0x1fb33['id']});}})[_0x9a53('0x16')](function(_0x692650){_0xf6e343=_0x692650;if(_0x9e6485[_0x9a53('0x4d')]){var _0x584c57=_0x9e6485[_0x9a53('0x31')](function(_0x3aff0b){return{'name':_0x3aff0b[_0x9a53('0xd0')],'basename':_0x3aff0b['filename'],'type':_0x3aff0b['mimetype'],'ChatOfflineMessageId':_0x692650['id']};});_0x2a3039=_0x584c57[_0x9a53('0x31')](_0x5c08e1=>{var _0x4c12aa={'filename':_0x5c08e1[_0x9a53('0x2c')],'path':path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0xd1'),'files','attachments','offline-chat',_0x5c08e1[_0x9a53('0xd2')])};return _0x4c12aa;});if(!_0x1fb33['openNewInteraction']){return db[_0x9a53('0xd3')][_0x9a53('0xd4')](function(_0x22bdad){return db['Attachment'][_0x9a53('0xd5')](_0x584c57,{'transaction':_0x22bdad});});}}})[_0x9a53('0x16')](function(){if(_0xf6e343){_0x4357d7=_0xf6e343;return db['MailAccount'][_0x9a53('0x5c')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x9a53('0xd6'),'raw':!![],'include':[{'model':db[_0x9a53('0xd7')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x9a53('0x16')](function(_0x2c9746){if(_0x2c9746&&_0x2c9746[_0x9a53('0xd6')]&&_0x1fb33[_0x9a53('0xd8')]&&_0x1fb33[_0x9a53('0xd9')]){var _0x4d922f=_0x2c9746[_0x9a53('0xda')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4d922f,'message':{'from':util[_0x9a53('0xa7')]('\x22%s\x22\x20<%s>',_0x2c9746[_0x9a53('0x2c')],_0x2c9746[_0x9a53('0xdb')]||_0x2c9746['Smtp'][_0x9a53('0xdc')]),'to':_0x1fb33[_0x9a53('0xd9')],'subject':_0x1fb33['offlineMessageSubject'],'html':_0x4357d7[_0x9a53('0x50')],'attachments':_0x2a3039}},client9003)[_0x9a53('0x16')](function(){return _0x4357d7;})[_0x9a53('0x1e')](function(_0x257370){logger[_0x9a53('0x1b')](_0x257370);});}})[_0x9a53('0x16')](function(){if(_0x1fb33&&_0x1fb33[_0x9a53('0xdd')]&&_0x1fb33[_0x9a53('0xde')]){var _0x1f9a41=[];if(_0x9e6485[_0x9a53('0x4d')]){_0x1f9a41=_0x9e6485[_0x9a53('0x31')](function(_0x3b9469){return{'name':_0x3b9469[_0x9a53('0xd0')],'basename':_0x3b9469[_0x9a53('0x69')],'type':_0x3b9469['mimetype'],'ChatOfflineMessageId':_0xf6e343['id']};});}var _0x3ce8cb;if(!_[_0x9a53('0x76')](_0x1fb33[_0x9a53('0xdf')])){var _0x36bb17=_[_0x9a53('0x31')](_0x15bdc8[_0x9a53('0x50')],function(_0x25f19f){return _0x25f19f;});var _0x385e2=_['toPairsIn'](_0x36bb17)[0x0];var _0x70e47d=_[_0x9a53('0xe0')](_0x385e2,function(_0x302db7){return _0x302db7;});_0x3ce8cb=_0x70e47d[0x1][_0x1fb33['subjectOffline']];}var _0x8602cd={'from':_0x39dade[_0x9a53('0xdb')],'firstName':_0x39dade['firstName'],'lastName':_0x39dade['lastName'],'mapKey':'email','message':{'from':_0x39dade[_0x9a53('0xdb')],'to':_0x1fb33[_0x9a53('0xe1')][_0x9a53('0xdb')],'cc':'','subject':_[_0x9a53('0x76')](_0x3ce8cb)?_0x1fb33[_0x9a53('0xe2')]:_0x3ce8cb,'messageId':'','sentAt':new Date(),'attach':_0x1f9a41[_0x9a53('0x4d')],'attachments':_0x1f9a41,'originChannel':'Chat','ChatWebsiteId':_0x1fb33['id'],'ChatOfflineMessageId':_0x4357d7['id'],'originTo':_0x1fb33[_0x9a53('0xe1')]['email']},'body':_0x4357d7[_0x9a53('0x50')]};var _0x49af96={'account':{'id':_0x1fb33[_0x9a53('0xde')]},'body':_0x8602cd,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x9a53('0xe3'),_0x49af96,client9001)[_0x9a53('0x16')](function(){return _0x4357d7;})['catch'](function(_0x1913b2){logger['error'](_0x1913b2);});}return;})['then'](function(){if(_0x4357d7){return _0x4357d7;}})[_0x9a53('0x16')](respondWithResult(_0x7d7498,null))['catch'](function(_0x5a46f6){logger[_0x9a53('0x1b')](_0x9a53('0x1e'),_0x5a46f6);for(var _0x330cd1 of _0x9e6485){var _0x263ae1=path['join'](config[_0x9a53('0x70')],_0x9a53('0xd1'),_0x9a53('0xc4'),'attachments',_0x9a53('0xe4'),_0x330cd1[_0x9a53('0x69')]);fs_extra[_0x9a53('0xe5')](_0x263ae1)[_0x9a53('0x1e')](function(_0x580141){logger[_0x9a53('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x263ae1,_0x580141);});}});};exports[_0x9a53('0xe6')]=function(_0x106b35,_0x2da7bf){return db['ChatInteraction']['find']({'where':{'id':_0x106b35[_0x9a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2da7bf,null))['then'](function(_0x1b1d9d){if(_0x1b1d9d){return _0x1b1d9d[_0x9a53('0xe6')](_0x106b35[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x106b35[_0x9a53('0x50')],[_0x9a53('0x60'),'id'])||{});}})[_0x9a53('0x16')](respondWithResult(_0x2da7bf,null))[_0x9a53('0x1e')](handleError(_0x2da7bf,null));};exports['getInteractions']=function(_0xa48909,_0x1eec4e){var _0x1f2b52={'raw':![],'where':{}};var _0x59cffb={};var _0x122c7d={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0xa48909[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x1eec4e,null))['then'](function(_0xc6b7b9){if(_0xc6b7b9){_0x59cffb[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['ChatInteraction']['rawAttributes']);_0x59cffb[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0xa48909[_0x9a53('0x37')]);_0x59cffb[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x59cffb[_0x9a53('0x39')],_0x59cffb['query']);_0x1f2b52[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x59cffb[_0x9a53('0x39')],qs['fields'](_0xa48909[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x1f2b52[_0x9a53('0x3a')]=_0x1f2b52[_0x9a53('0x3a')]['length']?_0x1f2b52[_0x9a53('0x3a')]:_0x59cffb[_0x9a53('0x39')];if(!_0xa48909[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x1f2b52[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0xa48909[_0x9a53('0x37')][_0x9a53('0x22')]);_0x1f2b52[_0x9a53('0x24')]=qs['offset'](_0xa48909[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x1f2b52[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0xa48909[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x1f2b52[_0x9a53('0x41')]=qs['filters'](_['pick'](_0xa48909[_0x9a53('0x37')],_0x59cffb[_0x9a53('0x38')]));_0x1f2b52[_0x9a53('0x41')][_0x9a53('0x5a')]=_0xc6b7b9['id'];if(_0xa48909['query'][_0x9a53('0x40')]){_0x1f2b52[_0x9a53('0x41')]=_['merge'](_0x1f2b52[_0x9a53('0x41')],{'$or':_['map'](_0x1f2b52[_0x9a53('0x3a')],function(_0x3f8b42){var _0x547f93={};_0x547f93[_0x3f8b42]={'$like':'%'+_0xa48909['query'][_0x9a53('0x40')]+'%'};return _0x547f93;})});}_0x1f2b52=_['merge']({},_0x1f2b52,_0xa48909[_0x9a53('0x44')]);return db['ChatInteraction'][_0x9a53('0x23')]({'where':_0x1f2b52[_0x9a53('0x41')]})[_0x9a53('0x16')](function(_0x28b60e){_0x122c7d[_0x9a53('0x23')]=_0x28b60e;if(_0xa48909[_0x9a53('0x37')][_0x9a53('0x45')]){_0x1f2b52[_0x9a53('0x46')]=[{'model':db[_0x9a53('0x85')],'as':_0x9a53('0xe8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x9a53('0xe9'),_0x9a53('0xea')],'required':![]},{'model':db[_0x9a53('0xeb')],'as':_0x9a53('0xec'),'attributes':['id',_0x9a53('0x2c'),_0x9a53('0xed')],'where':_0xa48909[_0x9a53('0x37')][_0x9a53('0xee')]?{'id':_0xa48909['query'][_0x9a53('0xee')]}:undefined,'required':_0xa48909[_0x9a53('0x37')][_0x9a53('0xee')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1f2b52);})['then'](function(_0x2af14b){_0x122c7d[_0x9a53('0x48')]=_0x2af14b;return _0x122c7d;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x1eec4e,_0x1f2b52))[_0x9a53('0x1e')](handleError(_0x1eec4e,null));};function iftimePromise(_0x36cd4f,_0x17336d){return respondWithRpcPromise(_0x9a53('0xef'),_0x9a53('0xf0'),{'command':_0x17336d[_0x9a53('0xf1')]?util[_0x9a53('0xa7')](_0x9a53('0xf2'),_0x36cd4f[_0x9a53('0xf3')],_0x17336d[_0x9a53('0xf1')]):util[_0x9a53('0xa7')](_0x9a53('0xf4'),_0x36cd4f['interval'])},client9002)['then'](function(_0x45cc70){var _0x2ac284=_0x45cc70&&_0x45cc70[_0x9a53('0xf5')]('true')>=0x0?!![]:![];logger[_0x9a53('0xf6')](_0x9a53('0xf7'),_0x17336d['id'],_0x36cd4f['id'],_0x36cd4f['interval'],_0x2ac284?_0x9a53('0xf8'):'OFFLINE',_0x17336d[_0x9a53('0xf1')]?_0x17336d[_0x9a53('0xf1')]:_0x9a53('0xf9'));return _0x2ac284;})[_0x9a53('0x1e')](function(_0xb3ca85){logger[_0x9a53('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x17336d['id'],_0x36cd4f['id'],_0x36cd4f['interval'],util[_0x9a53('0xfa')](_0xb3ca85,{'showHidden':![],'depth':null}),_0x17336d[_0x9a53('0xf1')]?_0x17336d[_0x9a53('0xf1')]:_0x9a53('0xf9'));return![];});}exports['getSnippet']=function(_0x2f26b9,_0x2e362c){var _0x5a3ff6=0x0;var _0x4f18cb=0x0;var _0xbdc602=![];var _0xdb7ce6;var _0x4f7f20;return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x2f26b9[_0x9a53('0x4a')]['id']},'include':[{'model':db['Interval'],'as':_0x9a53('0xfb'),'include':[{'model':db[_0x9a53('0xfb')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x9a53('0x16')](handleEntityNotFound(_0x2e362c,null))['then'](function(_0x3d52ad){if(_0x3d52ad){_0xdb7ce6=_0x3d52ad;return _0x3d52ad[_0x9a53('0xfc')]({'raw':!![]});}})[_0x9a53('0x16')](function(_0x43dfe2){if(_0xdb7ce6){if(_0x43dfe2){_0x4f7f20=_0x43dfe2;}}return require(_0x9a53('0x73'))[_0x9a53('0x74')]();})[_0x9a53('0x16')](function(_0x6c9c6a){if(_0x6c9c6a){_0x4f18cb=_0x6c9c6a['virtual'];_0xbdc602=_0x6c9c6a['custom'];}})[_0x9a53('0x16')](function(){return db[_0x9a53('0xae')][_0x9a53('0x23')]({'where':{'closed':![]}});})['then'](function(_0x3c2eaa){_0x5a3ff6=_0x3c2eaa;if(_0x4f18cb&&_0x3c2eaa>_0x4f18cb){return db[_0x9a53('0xfd')][_0x9a53('0x5c')]({'where':{'id':0x1}})[_0x9a53('0x16')](function(_0x495216){if(_0x495216){_0x495216[_0x9a53('0xfe')]('chatLicenseExceeded');}});}})[_0x9a53('0x16')](function(){if(_0xdb7ce6[_0x9a53('0xfb')]&&_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')]){var _0x6c866=[];for(var _0x3d3913=0x0;_0x3d3913<_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')][_0x9a53('0x4d')];_0x3d3913++){var _0x37f926=_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')][_0x3d3913]['get']({'plain':!![]});_0x6c866[_0x9a53('0xb7')](iftimePromise(_0x37f926,_0xdb7ce6));}return BPromise[_0x9a53('0x100')](_0x6c866)[_0x9a53('0x16')](function(_0x31f3d9){return _[_0x9a53('0x101')](_0x31f3d9);});}else{return!![];}})[_0x9a53('0x16')](function(_0x2bfe38){var _0x2c4747=fs[_0x9a53('0xc9')](path[_0x9a53('0x6f')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x2c3e4f={'remote':_0xdb7ce6[_0x9a53('0x102')],'query':querystring[_0x9a53('0x103')](_['merge'](_0xdb7ce6['get']({'plain':!![]}),{'customerIp':_0x2f26b9[_0x9a53('0x9e')]['x-forwarded-for']||_0x2f26b9[_0x9a53('0x9e')]['x-real-ip']||_0x2f26b9[_0x9a53('0x104')][_0x9a53('0x105')]||_0x2f26b9['ip'],'referer':_0x2f26b9[_0x9a53('0x9e')][_0x9a53('0xa4')],'openedInteractions':_0x5a3ff6,'maxInteractions':_0x4f18cb,'virtual':_0xbdc602['virtual'],'online':_0x2bfe38,'custom':_0xbdc602}))['replace'](/'/g,'\x5c\x27')};_0x2e362c['send'](ejs[_0x9a53('0xcb')](Mustache[_0x9a53('0xcb')](_0x2c4747,_0x2c3e4f),{'proactiveActions':_0x4f7f20,'alignment':_0xdb7ce6[_0x9a53('0x106')],'verticalAlignment':_0xdb7ce6[_0x9a53('0x107')],'div_color':_0xdb7ce6[_0x9a53('0xed')],'labelText':_0xdb7ce6[_0x9a53('0x108')],'text_color':_0xdb7ce6[_0x9a53('0x109')],'text_button_color':_0xdb7ce6['textButtonColor'],'button_color':_0xdb7ce6['color_button'],'background_color':_0xdb7ce6[_0x9a53('0x10a')],'hideWhenOffline':_0xdb7ce6[_0x9a53('0x10b')],'interval':_0xdb7ce6[_0x9a53('0x10c')]}));})[_0x9a53('0x1e')](handleError(_0x2e362c,null));};exports[_0x9a53('0x10d')]=function(_0x27bd73,_0x339e83){var _0x2fa37e=_0x27bd73[_0x9a53('0x4a')]['id'];var _0x3c2458=_0x27bd73[_0x9a53('0x50')];var _0x2093c1=0xc8;var _0x509c87=null;return db[_0x9a53('0xd3')][_0x9a53('0xd4')]({'isolationLevel':db[_0x9a53('0xd3')]['Transaction'][_0x9a53('0x10e')][_0x9a53('0x10f')]},function(_0x488def){return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x2fa37e},'transaction':_0x488def})[_0x9a53('0x16')](function(_0x4d2690){if(_0x4d2690){return db[_0x9a53('0x93')][_0x9a53('0x28')]({'where':{'ChatWebsiteId':_0x2fa37e},'transaction':_0x488def})[_0x9a53('0x16')](function(){var _0x11237d=_[_0x9a53('0x31')](_0x3c2458,function(_0x238b9d){_0x238b9d['ChatWebsiteId']=_0x2fa37e;return _0x238b9d;});return db[_0x9a53('0x93')][_0x9a53('0xd5')](_0x11237d,{'transaction':_0x488def});});}else{_0x2093c1=0x194;_0x509c87=[];}});})['then'](function(){if(_0x2093c1!==0x194){return db[_0x9a53('0x93')][_0x9a53('0x110')]({'where':{'ChatWebsiteId':_0x2fa37e},'order':_0x9a53('0x99')})['then'](function(_0xf045d6){_0x509c87=_0xf045d6;});}})[_0x9a53('0x1e')](function(_0x4af3d6){_0x2093c1=0x1f4;logger[_0x9a53('0x1b')](_0x4af3d6[_0x9a53('0x111')]);if(_0x4af3d6[_0x9a53('0x2c')]){delete _0x4af3d6[_0x9a53('0x2c')];}_0x509c87=_0x4af3d6;})[_0x9a53('0x112')](function(){if(_0x509c87===null){_0x339e83[_0x9a53('0x2b')](_0x2093c1);}else{if(_0x2093c1===0x1f4){_0x339e83[_0x9a53('0x1f')](_0x2093c1)[_0x9a53('0x2d')](_0x509c87);}else{_0x339e83[_0x9a53('0x1f')](_0x2093c1)[_0x9a53('0x21')](_0x509c87);}}});};exports[_0x9a53('0x113')]=function(_0x49903f,_0x1e610a){var _0x598c8c={};var _0x2f5de0={};var _0x3f6c6d;var _0x233d31;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x49903f[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x1e610a,null))['then'](function(_0x95f618){if(_0x95f618){_0x3f6c6d=_0x95f618;_0x2f5de0[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db[_0x9a53('0x93')][_0x9a53('0x33')]);_0x2f5de0[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x49903f[_0x9a53('0x37')]);_0x2f5de0[_0x9a53('0x38')]=_['intersection'](_0x2f5de0[_0x9a53('0x39')],_0x2f5de0[_0x9a53('0x37')]);_0x598c8c['attributes']=_['intersection'](_0x2f5de0[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x49903f[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x598c8c['attributes']=_0x598c8c['attributes'][_0x9a53('0x4d')]?_0x598c8c[_0x9a53('0x3a')]:_0x2f5de0[_0x9a53('0x39')];_0x598c8c['order']=qs[_0x9a53('0x3e')](_0x49903f[_0x9a53('0x37')]['sort']);_0x598c8c[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x49903f['query'],_0x2f5de0[_0x9a53('0x38')]));if(_0x49903f[_0x9a53('0x37')]['filter']){_0x598c8c[_0x9a53('0x41')]=_['merge'](_0x598c8c['where'],{'$or':_[_0x9a53('0x31')](_0x598c8c[_0x9a53('0x3a')],function(_0x321a88){var _0x193f5e={};_0x193f5e[_0x321a88]={'$like':'%'+_0x49903f[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x193f5e;})});}_0x598c8c=_[_0x9a53('0x42')]({},_0x598c8c,_0x49903f[_0x9a53('0x44')]);return _0x3f6c6d[_0x9a53('0x113')](_0x598c8c);}})[_0x9a53('0x16')](function(_0x40af54){if(_0x40af54){_0x233d31=_0x40af54['length'];if(!_0x49903f['query']['hasOwnProperty'](_0x9a53('0x3d'))){_0x598c8c[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x49903f[_0x9a53('0x37')][_0x9a53('0x22')]);_0x598c8c[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x49903f[_0x9a53('0x37')]['offset']);}return _0x3f6c6d[_0x9a53('0x113')](_0x598c8c);}})[_0x9a53('0x16')](function(_0x5b4900){if(_0x5b4900){return _0x5b4900?{'count':_0x233d31,'rows':_0x5b4900}:null;}})[_0x9a53('0x16')](respondWithResult(_0x1e610a,null))[_0x9a53('0x1e')](handleError(_0x1e610a,null));};exports[_0x9a53('0x114')]=function(_0x43615a,_0x4b2505){return db[_0x9a53('0x115')][_0x9a53('0x4e')]({'where':{'id':_0x43615a[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x4b2505,null))[_0x9a53('0x16')](function(_0x3a3dc6){if(_0x3a3dc6){return _0x3a3dc6[_0x9a53('0x114')](_0x43615a[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x43615a[_0x9a53('0x50')],[_0x9a53('0x60'),'id'])||{});}})['then'](respondWithResult(_0x4b2505,null))[_0x9a53('0x1e')](handleError(_0x4b2505,null));};exports['getProactiveActions']=function(_0x352af1,_0x43f010){var _0x4a93a3={};var _0x584eb5={};var _0x3e494c;var _0xf25850;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x352af1[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x43f010,null))['then'](function(_0x134c53){if(_0x134c53){_0x3e494c=_0x134c53;_0x584eb5[_0x9a53('0x39')]=_['keys'](db[_0x9a53('0x116')][_0x9a53('0x33')]);_0x584eb5['query']=_[_0x9a53('0x4b')](_0x352af1[_0x9a53('0x37')]);_0x584eb5['filters']=_[_0x9a53('0x4c')](_0x584eb5['model'],_0x584eb5['query']);_0x4a93a3[_0x9a53('0x3a')]=_['intersection'](_0x584eb5['model'],qs[_0x9a53('0x3b')](_0x352af1['query'][_0x9a53('0x3b')]));_0x4a93a3[_0x9a53('0x3a')]=_0x4a93a3[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x4a93a3['attributes']:_0x584eb5[_0x9a53('0x39')];_0x4a93a3[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x352af1[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x4a93a3[_0x9a53('0x41')]=qs['filters'](_[_0x9a53('0x3f')](_0x352af1[_0x9a53('0x37')],_0x584eb5[_0x9a53('0x38')]));if(_0x352af1['query']['filter']){_0x4a93a3[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x4a93a3[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x4a93a3['attributes'],function(_0x4e98aa){var _0x5220a5={};_0x5220a5[_0x4e98aa]={'$like':'%'+_0x352af1[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x5220a5;})});}_0x4a93a3=_[_0x9a53('0x42')]({},_0x4a93a3,_0x352af1['options']);return _0x3e494c[_0x9a53('0xfc')](_0x4a93a3);}})[_0x9a53('0x16')](function(_0x194514){if(_0x194514){_0xf25850=_0x194514[_0x9a53('0x4d')];if(!_0x352af1[_0x9a53('0x37')]['hasOwnProperty'](_0x9a53('0x3d'))){_0x4a93a3['limit']=qs[_0x9a53('0x22')](_0x352af1['query']['limit']);_0x4a93a3[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x352af1[_0x9a53('0x37')][_0x9a53('0x24')]);}return _0x3e494c[_0x9a53('0xfc')](_0x4a93a3);}})['then'](function(_0x1975fe){if(_0x1975fe){return _0x1975fe?{'count':_0xf25850,'rows':_0x1975fe}:null;}})[_0x9a53('0x16')](respondWithResult(_0x43f010,null))['catch'](handleError(_0x43f010,null));};exports[_0x9a53('0x117')]=function(_0x50c521,_0x280000){var _0x1c7dbe=_0x50c521['query'][_0x9a53('0x118')]===_0x9a53('0x119')?_0x9a53('0x11a'):_0x9a53('0x11b');return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'attributes':['id',_0x1c7dbe],'where':{'id':_0x50c521[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x280000,null))['then'](function(_0x306166){if(_0x306166){var _0x3f1a43=_0x306166[_0x1c7dbe];var _0x27df75=_0x3f1a43&&_0x3f1a43[_0x9a53('0x11c')]?_0x3f1a43[_0x9a53('0x11c')]:[];_0x280000[_0x9a53('0x2d')]({'fromKey':_[_0x9a53('0x76')](_0x3f1a43[_0x9a53('0x11d')])?undefined:_0x3f1a43[_0x9a53('0x11d')],'count':_0x27df75[_0x9a53('0x4d')],'rows':_0x27df75});}})['catch'](handleError(_0x280000,null));};exports[_0x9a53('0x11e')]=function(_0x24e469,_0x5c438b){var _0x55a9e3={'raw':![],'where':{}};var _0x456aba={};var _0x5e738a={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0x24e469['params']['id']}})['then'](handleEntityNotFound(_0x5c438b,null))[_0x9a53('0x16')](function(_0x32195a){if(_0x32195a){_0x456aba['model']=_[_0x9a53('0x4b')](db[_0x9a53('0xce')][_0x9a53('0x33')]);_0x456aba[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x24e469[_0x9a53('0x37')]);_0x456aba[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x456aba[_0x9a53('0x39')],_0x456aba['query']);_0x55a9e3[_0x9a53('0x3a')]=_['intersection'](_0x456aba[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x55a9e3[_0x9a53('0x3a')]=_0x55a9e3[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x55a9e3[_0x9a53('0x3a')]:_0x456aba[_0x9a53('0x39')];if(!_0x24e469['query'][_0x9a53('0x3c')]('nolimit')){_0x55a9e3[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x22')]);_0x55a9e3[_0x9a53('0x24')]=qs['offset'](_0x24e469[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x55a9e3[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x55a9e3[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_['pick'](_0x24e469[_0x9a53('0x37')],_0x456aba[_0x9a53('0x38')]));_0x55a9e3[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x32195a['id'];if(_0x24e469[_0x9a53('0x37')]['filter']){_0x55a9e3[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x55a9e3[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x55a9e3[_0x9a53('0x3a')],function(_0x280d00){var _0x579946={};_0x579946[_0x280d00]={'$like':'%'+_0x24e469[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x579946;})});}_0x55a9e3=_[_0x9a53('0x42')]({},_0x55a9e3,_0x24e469[_0x9a53('0x44')]);return db['ChatOfflineMessage'][_0x9a53('0x23')]({'where':_0x55a9e3['where']})[_0x9a53('0x16')](function(_0x4ac857){_0x5e738a['count']=_0x4ac857;if(_0x24e469['query']['includeAll']){_0x55a9e3['include']=[{'all':!![]}];}else{_0x55a9e3[_0x9a53('0x46')]=[{'model':db[_0x9a53('0x85')],'as':'Contact','required':![]},{'model':db[_0x9a53('0x11f')],'as':_0x9a53('0x120'),'required':![]}];}return db[_0x9a53('0xce')][_0x9a53('0x47')](_0x55a9e3);})[_0x9a53('0x16')](function(_0x58a106){_0x5e738a['rows']=_0x58a106;return _0x5e738a;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x5c438b,_0x55a9e3))[_0x9a53('0x1e')](handleError(_0x5c438b,null));};exports['addAgents']=function(_0x3bc2d1,_0xdccdb3){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x3bc2d1[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0xdccdb3,null))[_0x9a53('0x16')](function(_0x214f6c){if(_0x214f6c){return _0x214f6c[_0x9a53('0x121')](_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x3bc2d1['body'],[_0x9a53('0x60'),'id'])||{})['spread'](function(_0x9519e5){for(var _0x53293a=0x0;_0x53293a<_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')]['length'];_0x53293a+=0x1){socket[_0x9a53('0x122')](_0x9a53('0x123'),{'UserId':Number(_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')][_0x53293a]),'ChatWebsiteId':Number(_0x3bc2d1[_0x9a53('0x4a')]['id'])});}return _0x9519e5;});}})[_0x9a53('0x16')](respondWithResult(_0xdccdb3,null))[_0x9a53('0x1e')](handleError(_0xdccdb3,null));};exports[_0x9a53('0x124')]=function(_0x1dfc7c,_0x3a6b28){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1dfc7c[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x3a6b28,null))[_0x9a53('0x16')](function(_0x121275){if(_0x121275){return _0x121275[_0x9a53('0x124')](_0x1dfc7c[_0x9a53('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')])){for(var _0x11eaf5=0x0;_0x11eaf5<_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')][_0x9a53('0x4d')];_0x11eaf5+=0x1){socket[_0x9a53('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')][_0x11eaf5]),'ChatWebsiteId':Number(_0x1dfc7c[_0x9a53('0x4a')]['id'])});}}else{socket[_0x9a53('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')]),'ChatWebsiteId':Number(_0x1dfc7c[_0x9a53('0x4a')]['id'])});}});}})[_0x9a53('0x16')](respondWithStatusCode(_0x3a6b28,null))[_0x9a53('0x1e')](handleError(_0x3a6b28,null));};exports[_0x9a53('0x125')]=function(_0x579b00,_0x45da9e){var _0x32034e={};var _0x3e241a={};var _0xeaa98e;var _0x5b97ab;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x579b00['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x45da9e,null))[_0x9a53('0x16')](function(_0x462ed9){if(_0x462ed9){_0xeaa98e=_0x462ed9;_0x3e241a['model']=_[_0x9a53('0x4b')](db[_0x9a53('0xbc')][_0x9a53('0x33')]);_0x3e241a[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x579b00[_0x9a53('0x37')]);_0x3e241a[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x3e241a[_0x9a53('0x39')],_0x3e241a[_0x9a53('0x37')]);_0x32034e[_0x9a53('0x3a')]=_['intersection'](_0x3e241a[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x579b00['query'][_0x9a53('0x3b')]));_0x32034e[_0x9a53('0x3a')]=_0x32034e[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x32034e[_0x9a53('0x3a')]:_0x3e241a[_0x9a53('0x39')];_0x32034e[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x579b00[_0x9a53('0x37')]['sort']);_0x32034e[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x579b00[_0x9a53('0x37')],_0x3e241a['filters']));if(_0x579b00[_0x9a53('0x37')][_0x9a53('0x40')]){_0x32034e[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x32034e[_0x9a53('0x41')],{'$or':_['map'](_0x32034e[_0x9a53('0x3a')],function(_0x1bada0){var _0x522325={};_0x522325[_0x1bada0]={'$like':'%'+_0x579b00[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x522325;})});}_0x32034e=_[_0x9a53('0x42')]({},_0x32034e,_0x579b00['options']);return _0xeaa98e[_0x9a53('0x125')](_0x32034e);}})[_0x9a53('0x16')](function(_0x3cd147){if(_0x3cd147){_0x5b97ab=_0x3cd147[_0x9a53('0x4d')];if(!_0x579b00[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x32034e['limit']=qs[_0x9a53('0x22')](_0x579b00[_0x9a53('0x37')]['limit']);_0x32034e['offset']=qs['offset'](_0x579b00[_0x9a53('0x37')]['offset']);}return _0xeaa98e[_0x9a53('0x125')](_0x32034e);}})[_0x9a53('0x16')](function(_0x4acba4){if(_0x4acba4){return _0x4acba4?{'count':_0x5b97ab,'rows':_0x4acba4}:null;}})[_0x9a53('0x16')](respondWithResult(_0x45da9e,null))['catch'](handleError(_0x45da9e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8cf5151..0ba2aea 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x979e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x7c75bf,_0x42bdfb){var _0x1d7299=function(_0x20e75d){while(--_0x20e75d){_0x7c75bf['push'](_0x7c75bf['shift']());}};_0x1d7299(++_0x42bdfb);}(_0x979e,0x195));var _0xe979=function(_0x5123cd,_0x38c053){_0x5123cd=_0x5123cd-0x0;var _0x3b690c=_0x979e[_0x5123cd];return _0x3b690c;};'use strict';var EventEmitter=require(_0xe979('0x0'));var ChatWebsite=require(_0xe979('0x1'))['db'][_0xe979('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe979('0x4'),'afterDestroy':_0xe979('0x5')};function emitEvent(_0x386036){return function(_0x3b4b06,_0x2d62dd,_0x5afb7f){ChatWebsiteEvents[_0xe979('0x6')](_0x386036+':'+_0x3b4b06['id'],_0x3b4b06);ChatWebsiteEvents['emit'](_0x386036,_0x3b4b06);_0x5afb7f(null);};}for(var e in events){if(events[_0xe979('0x7')](e)){var event=events[e];ChatWebsite[_0xe979('0x8')](e,emitEvent(event));}}module[_0xe979('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xac21=['ChatWebsite','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x22c169,_0x3298a6){var _0x30cc6f=function(_0x2cd339){while(--_0x2cd339){_0x22c169['push'](_0x22c169['shift']());}};_0x30cc6f(++_0x3298a6);}(_0xac21,0x1af));var _0x1ac2=function(_0x341462,_0x330bb1){_0x341462=_0x341462-0x0;var _0x3332ab=_0xac21[_0x341462];return _0x3332ab;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1ac2('0x0'))['db'][_0x1ac2('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ac2('0x2'),'afterUpdate':'update','afterDestroy':_0x1ac2('0x3')};function emitEvent(_0x15bc3f){return function(_0x5b81be,_0x454461,_0x4efe94){ChatWebsiteEvents[_0x1ac2('0x4')](_0x15bc3f+':'+_0x5b81be['id'],_0x5b81be);ChatWebsiteEvents[_0x1ac2('0x4')](_0x15bc3f,_0x5b81be);_0x4efe94(null);};}for(var e in events){if(events[_0x1ac2('0x5')](e)){var event=events[e];ChatWebsite[_0x1ac2('0x6')](e,emitEvent(event));}}module[_0x1ac2('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ed3f1ef..9760d8d 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 _0x5719=['exports','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5719,0x178));var _0x9571=function(_0x3f1699,_0x40690c){_0x3f1699=_0x3f1699-0x0;var _0x5d8fb7=_0x5719[_0x3f1699];return _0x5d8fb7;};'use strict';var _=require(_0x9571('0x0'));var util=require(_0x9571('0x1'));var logger=require(_0x9571('0x2'))('api');var moment=require(_0x9571('0x3'));var BPromise=require(_0x9571('0x4'));var rp=require(_0x9571('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9571('0x6'));var config=require(_0x9571('0x7'));var attributes=require(_0x9571('0x8'));module[_0x9571('0x9')]=function(_0x109aa7,_0x5a5545){return _0x109aa7['define']('ChatWebsite',attributes,{'tableName':_0x9571('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61ac=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2e3df6,_0x19b323){var _0x12526d=function(_0x2d27df){while(--_0x2d27df){_0x2e3df6['push'](_0x2e3df6['shift']());}};_0x12526d(++_0x19b323);}(_0x61ac,0x131));var _0xc61a=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x61ac[_0x389832];return _0x59429e;};'use strict';var _=require(_0xc61a('0x0'));var util=require(_0xc61a('0x1'));var logger=require(_0xc61a('0x2'))('api');var moment=require(_0xc61a('0x3'));var BPromise=require(_0xc61a('0x4'));var rp=require(_0xc61a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc61a('0x6'));var config=require(_0xc61a('0x7'));var attributes=require(_0xc61a('0x8'));module[_0xc61a('0x9')]=function(_0x1847ba,_0x54b600){return _0x1847ba[_0xc61a('0xa')](_0xc61a('0xb'),attributes,{'tableName':_0xc61a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 9aaddbf..f3f2367 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 _0xe07b=['http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x38209b,_0x77370){var _0x4da974=function(_0x258161){while(--_0x258161){_0x38209b['push'](_0x38209b['shift']());}};_0x4da974(++_0x77370);}(_0xe07b,0x146));var _0xbe07=function(_0x5aabac,_0x20d569){_0x5aabac=_0x5aabac-0x0;var _0x3f0401=_0xe07b[_0x5aabac];return _0x3f0401;};'use strict';var _=require(_0xbe07('0x0'));var util=require(_0xbe07('0x1'));var moment=require(_0xbe07('0x2'));var BPromise=require(_0xbe07('0x3'));var rs=require(_0xbe07('0x4'));var fs=require('fs');var Redis=require(_0xbe07('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe07('0x6'));var logger=require(_0xbe07('0x7'))('rpc');var config=require(_0xbe07('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe07('0x9')][_0xbe07('0xa')]({'port':0x232a});config['redis']=_[_0xbe07('0xb')](config[_0xbe07('0xc')],{'host':_0xbe07('0xd'),'port':0x18eb});var socket=require(_0xbe07('0xe'))(new Redis(config[_0xbe07('0xc')]));require(_0xbe07('0xf'))[_0xbe07('0x10')](socket);function respondWithRpcPromise(_0x335a00,_0x5acdb0,_0x449b6f){return new BPromise(function(_0x3661b7,_0x3d85b3){return client[_0xbe07('0x11')](_0x335a00,_0x449b6f)[_0xbe07('0x12')](function(_0x5e28a3){logger[_0xbe07('0x13')](_0xbe07('0x14'),_0x5acdb0,_0xbe07('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5acdb0,_0xbe07('0x15'),JSON[_0xbe07('0x16')](_0x5e28a3));if(_0x5e28a3['error']){if(_0x5e28a3[_0xbe07('0x17')][_0xbe07('0x18')]===0x1f4){logger[_0xbe07('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5acdb0,_0x5e28a3[_0xbe07('0x17')][_0xbe07('0x19')]);return _0x3d85b3(_0x5e28a3[_0xbe07('0x17')][_0xbe07('0x19')]);}logger[_0xbe07('0x17')](_0xbe07('0x14'),_0x5acdb0,_0x5e28a3[_0xbe07('0x17')][_0xbe07('0x19')]);return _0x3661b7(_0x5e28a3['error']['message']);}else{logger[_0xbe07('0x13')](_0xbe07('0x14'),_0x5acdb0,_0xbe07('0x15'));_0x3661b7(_0x5e28a3[_0xbe07('0x1a')][_0xbe07('0x19')]);}})[_0xbe07('0x1b')](function(_0x45f3b2){logger[_0xbe07('0x17')](_0xbe07('0x14'),_0x5acdb0,_0x45f3b2);_0x3d85b3(_0x45f3b2);});});} \ No newline at end of file +var _0xfaee=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','then','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaee,0x17e));var _0xefae=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0xfaee[_0x88ffd4];return _0x528f9c;};'use strict';var _=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var moment=require(_0xefae('0x2'));var BPromise=require(_0xefae('0x3'));var rs=require(_0xefae('0x4'));var fs=require('fs');var Redis=require(_0xefae('0x5'));var db=require(_0xefae('0x6'))['db'];var utils=require(_0xefae('0x7'));var logger=require(_0xefae('0x8'))(_0xefae('0x9'));var config=require('../../config/environment');var jayson=require(_0xefae('0xa'));var client=jayson[_0xefae('0xb')][_0xefae('0xc')]({'port':0x232a});config['redis']=_[_0xefae('0xd')](config['redis'],{'host':_0xefae('0xe'),'port':0x18eb});var socket=require(_0xefae('0xf'))(new Redis(config[_0xefae('0x10')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x5f34bf,_0x1165c9,_0x27dd2b){return new BPromise(function(_0x32fb25,_0x21a718){return client['request'](_0x5f34bf,_0x27dd2b)[_0xefae('0x11')](function(_0x3ade28){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1165c9,_0xefae('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1165c9,_0xefae('0x12'),JSON[_0xefae('0x13')](_0x3ade28));if(_0x3ade28[_0xefae('0x14')]){if(_0x3ade28[_0xefae('0x14')][_0xefae('0x15')]===0x1f4){logger[_0xefae('0x14')](_0xefae('0x16'),_0x1165c9,_0x3ade28['error'][_0xefae('0x17')]);return _0x21a718(_0x3ade28[_0xefae('0x14')]['message']);}logger[_0xefae('0x14')](_0xefae('0x16'),_0x1165c9,_0x3ade28[_0xefae('0x14')][_0xefae('0x17')]);return _0x32fb25(_0x3ade28[_0xefae('0x14')][_0xefae('0x17')]);}else{logger[_0xefae('0x18')](_0xefae('0x16'),_0x1165c9,'request\x20sent');_0x32fb25(_0x3ade28[_0xefae('0x19')][_0xefae('0x17')]);}})[_0xefae('0x1a')](function(_0x5062de){logger['error'](_0xefae('0x16'),_0x1165c9,_0x5062de);_0x21a718(_0x5062de);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 01ba3ac..e4ee1f7 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 _0x8487=['register','length','chatWebsite:','save','remove','update','emit','removeListener'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x8487,0xe3));var _0x7848=function(_0x16c4d6,_0x32836b){_0x16c4d6=_0x16c4d6-0x0;var _0x5d377a=_0x8487[_0x16c4d6];return _0x5d377a;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x7848('0x0'),_0x7848('0x1'),_0x7848('0x2')];function createListener(_0x140a78,_0x134563){return function(_0x15eb82){_0x134563[_0x7848('0x3')](_0x140a78,_0x15eb82);};}function removeListener(_0x22fb77,_0x5cd4d6){return function(){ChatWebsiteEvents[_0x7848('0x4')](_0x22fb77,_0x5cd4d6);};}exports[_0x7848('0x5')]=function(_0x4d5bd4){for(var _0x277613=0x0,_0x5d48e5=events[_0x7848('0x6')];_0x277613<_0x5d48e5;_0x277613++){var _0xf03616=events[_0x277613];var _0x45007c=createListener(_0x7848('0x7')+_0xf03616,_0x4d5bd4);ChatWebsiteEvents['on'](_0xf03616,_0x45007c);}}; \ No newline at end of file +var _0x883c=['register','length','chatWebsite:','remove','update','removeListener'];(function(_0x257268,_0x1d0221){var _0x4812bf=function(_0x4d7ea6){while(--_0x4d7ea6){_0x257268['push'](_0x257268['shift']());}};_0x4812bf(++_0x1d0221);}(_0x883c,0xe7));var _0xc883=function(_0x48c784,_0x52b6fc){_0x48c784=_0x48c784-0x0;var _0x4634d9=_0x883c[_0x48c784];return _0x4634d9;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xc883('0x0'),_0xc883('0x1')];function createListener(_0x263f2b,_0x5a072c){return function(_0x1c1a7f){_0x5a072c['emit'](_0x263f2b,_0x1c1a7f);};}function removeListener(_0x291457,_0x101a6f){return function(){ChatWebsiteEvents[_0xc883('0x2')](_0x291457,_0x101a6f);};}exports[_0xc883('0x3')]=function(_0x400300){for(var _0x57d3b3=0x0,_0x5778b4=events[_0xc883('0x4')];_0x57d3b3<_0x5778b4;_0x57d3b3++){var _0x2b2d4c=events[_0x57d3b3];var _0x232d78=createListener(_0xc883('0x5')+_0x2b2d4c,_0x400300);ChatWebsiteEvents['on'](_0x2b2d4c,_0x232d78);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c660ab3..410d763 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 _0xb658=['removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','addLogo','server/files/images/avatars/','%s-%s','file','addCustomerAvatar','addSystemAvatar','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','addApplications','/:id/proactive_actions','addAgents','update','/:id/dispositions'];(function(_0x5b1cdd,_0x4faa96){var _0x240dbc=function(_0x5ee779){while(--_0x5ee779){_0x5b1cdd['push'](_0x5b1cdd['shift']());}};_0x240dbc(++_0x4faa96);}(_0xb658,0x115));var _0x8b65=function(_0x441d5c,_0x2eb221){_0x441d5c=_0x441d5c-0x0;var _0x52413c=_0xb658[_0x441d5c];return _0x52413c;};'use strict';var multer=require(_0x8b65('0x0'));var util=require(_0x8b65('0x1'));var path=require('path');var timeout=require(_0x8b65('0x2'));var express=require('express');var router=express[_0x8b65('0x3')]();var fs_extra=require(_0x8b65('0x4'));var auth=require(_0x8b65('0x5'));var interaction=require(_0x8b65('0x6'));var config=require(_0x8b65('0x7'));var controller=require(_0x8b65('0x8'));router['get']('/',auth[_0x8b65('0x9')](),controller[_0x8b65('0xa')]);router[_0x8b65('0xb')](_0x8b65('0xc'),auth[_0x8b65('0x9')](),controller['describe']);router['get'](_0x8b65('0xd'),auth[_0x8b65('0x9')](),controller[_0x8b65('0xe')]);router['get']('/:id/dispositions',auth[_0x8b65('0x9')](),controller[_0x8b65('0xf')]);router[_0x8b65('0xb')](_0x8b65('0x10'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x11')]);router[_0x8b65('0xb')](_0x8b65('0x12'),controller[_0x8b65('0x13')]);router[_0x8b65('0xb')](_0x8b65('0x14'),controller['getAvatar']);router[_0x8b65('0xb')](_0x8b65('0x15'),controller['getCustomerAvatar']);router[_0x8b65('0xb')](_0x8b65('0x16'),controller[_0x8b65('0x17')]);router[_0x8b65('0xb')](_0x8b65('0x18'),auth[_0x8b65('0x9')](),controller['getInteractions']);router[_0x8b65('0xb')]('/:id/snippet',controller[_0x8b65('0x19')]);router[_0x8b65('0xb')]('/:id/applications',auth[_0x8b65('0x9')](),controller['getApplications']);router[_0x8b65('0xb')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x8b65('0x1a')]);router[_0x8b65('0xb')](_0x8b65('0x1b'),controller[_0x8b65('0x1c')]);router[_0x8b65('0xb')]('/:id/offline_messages',auth[_0x8b65('0x9')](),controller[_0x8b65('0x1d')]);router[_0x8b65('0xb')](_0x8b65('0x1e'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x1f')]);router[_0x8b65('0x20')]('/',auth['isAuthenticated'](),controller[_0x8b65('0x21')]);router[_0x8b65('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x8b65('0x20')](_0x8b65('0x10'),auth[_0x8b65('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8b65('0x22')]({'destination':function(_0x2173ba,_0x53d67e,_0x31afca){_0x31afca(null,path[_0x8b65('0x23')](config[_0x8b65('0x24')],_0x8b65('0x25')));},'filename':function(_0x499b83,_0x1578e8,_0x575b98){_0x575b98(null,util[_0x8b65('0x26')]('%s-%s',Date[_0x8b65('0x27')](),_0x1578e8[_0x8b65('0x28')]));}})});router[_0x8b65('0x20')](_0x8b65('0x12'),upload[_0x8b65('0x29')]('file'),controller[_0x8b65('0x2a')]);var upload=multer({'storage':multer[_0x8b65('0x22')]({'destination':function(_0x3ae0f5,_0xdf4fa5,_0x235aa8){_0x235aa8(null,path[_0x8b65('0x23')](config[_0x8b65('0x24')],_0x8b65('0x2b')));},'filename':function(_0x306444,_0x2915af,_0x1f6756){_0x1f6756(null,util['format'](_0x8b65('0x2c'),Date['now'](),_0x2915af[_0x8b65('0x28')]));}})});router[_0x8b65('0x20')](_0x8b65('0x14'),upload[_0x8b65('0x29')](_0x8b65('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x8b65('0x22')]({'destination':function(_0x5036b5,_0x54aa86,_0x417d9c){_0x417d9c(null,path['join'](config['root'],_0x8b65('0x2b')));},'filename':function(_0x2c8250,_0x454926,_0x2e88c8){_0x2e88c8(null,util[_0x8b65('0x26')](_0x8b65('0x2c'),Date[_0x8b65('0x27')](),_0x454926['originalname']));}})});router[_0x8b65('0x20')](_0x8b65('0x15'),upload[_0x8b65('0x29')](_0x8b65('0x2d')),controller[_0x8b65('0x2e')]);var upload=multer({'storage':multer[_0x8b65('0x22')]({'destination':function(_0x48506e,_0x4e4e55,_0x3c5ee6){_0x3c5ee6(null,path[_0x8b65('0x23')](config[_0x8b65('0x24')],_0x8b65('0x2b')));},'filename':function(_0x5b1f19,_0x1c7631,_0x2cc919){_0x2cc919(null,util[_0x8b65('0x26')]('%s-%s',Date[_0x8b65('0x27')](),_0x1c7631[_0x8b65('0x28')]));}})});router['post'](_0x8b65('0x16'),upload['single'](_0x8b65('0x2d')),controller[_0x8b65('0x2f')]);router[_0x8b65('0x20')]('/:id/notify',controller[_0x8b65('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2c40fa,_0x520fc0,_0x34535f){const _0x301fca=path[_0x8b65('0x23')](config[_0x8b65('0x24')],_0x8b65('0x31'),'attachments',_0x8b65('0x32'));fs_extra[_0x8b65('0x33')](_0x301fca,function(){_0x34535f(null,_0x301fca);});},'filename':function(_0x57492d,_0x2e7c58,_0x3570a6){const _0x40ad0f=_0x2e7c58['originalname'][_0x8b65('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x246177=path[_0x8b65('0x35')](_0x40ad0f);const _0x4b245a=Date[_0x8b65('0x27')]()+'-'+_0x40ad0f[_0x8b65('0x34')](_0x246177,'')+_0x246177;_0x3570a6(null,_0x4b245a);}})});router[_0x8b65('0x20')](_0x8b65('0x36'),offlineUploadMulter[_0x8b65('0x37')](),controller[_0x8b65('0x38')]);router[_0x8b65('0x20')]('/:id/interactions',auth[_0x8b65('0x9')](),controller['addInteraction']);router['post'](_0x8b65('0x39'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x3a')]);router[_0x8b65('0x20')](_0x8b65('0x3b'),auth[_0x8b65('0x9')](),controller['addProactiveActions']);router[_0x8b65('0x20')](_0x8b65('0x1e'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x3c')]);router['put'](_0x8b65('0xd'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x3d')]);router['delete']('/:id',auth[_0x8b65('0x9')](),controller['destroy']);router['delete'](_0x8b65('0x3e'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x3f')]);router[_0x8b65('0x40')](_0x8b65('0x10'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x41')]);router[_0x8b65('0x40')](_0x8b65('0x1e'),auth[_0x8b65('0x9')](),controller[_0x8b65('0x42')]);module[_0x8b65('0x43')]=router; \ No newline at end of file +var _0x8f77=['getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x54fafa,_0x31c33f){var _0x24363f=function(_0x1c2204){while(--_0x1c2204){_0x54fafa['push'](_0x54fafa['shift']());}};_0x24363f(++_0x31c33f);}(_0x8f77,0xf1));var _0x78f7=function(_0xc9afae,_0x5303e4){_0xc9afae=_0xc9afae-0x0;var _0x14b3fb=_0x8f77[_0xc9afae];return _0x14b3fb;};'use strict';var multer=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var path=require(_0x78f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x78f7('0x3'));var router=express['Router']();var fs_extra=require(_0x78f7('0x4'));var auth=require(_0x78f7('0x5'));var interaction=require(_0x78f7('0x6'));var config=require('../../config/environment');var controller=require(_0x78f7('0x7'));router[_0x78f7('0x8')]('/',auth[_0x78f7('0x9')](),controller['index']);router[_0x78f7('0x8')]('/describe',auth[_0x78f7('0x9')](),controller[_0x78f7('0xa')]);router['get'](_0x78f7('0xb'),auth[_0x78f7('0x9')](),controller['show']);router[_0x78f7('0x8')](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller[_0x78f7('0xd')]);router[_0x78f7('0x8')](_0x78f7('0xe'),auth[_0x78f7('0x9')](),controller[_0x78f7('0xf')]);router[_0x78f7('0x8')](_0x78f7('0x10'),controller[_0x78f7('0x11')]);router[_0x78f7('0x8')](_0x78f7('0x12'),controller[_0x78f7('0x13')]);router[_0x78f7('0x8')](_0x78f7('0x14'),controller[_0x78f7('0x15')]);router[_0x78f7('0x8')](_0x78f7('0x16'),controller[_0x78f7('0x17')]);router[_0x78f7('0x8')](_0x78f7('0x18'),auth['isAuthenticated'](),controller[_0x78f7('0x19')]);router[_0x78f7('0x8')](_0x78f7('0x1a'),controller[_0x78f7('0x1b')]);router[_0x78f7('0x8')]('/:id/applications',auth[_0x78f7('0x9')](),controller[_0x78f7('0x1c')]);router[_0x78f7('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x78f7('0x1d')]);router[_0x78f7('0x8')](_0x78f7('0x1e'),controller[_0x78f7('0x1f')]);router[_0x78f7('0x8')](_0x78f7('0x20'),auth[_0x78f7('0x9')](),controller['getOfflineMessages']);router[_0x78f7('0x8')](_0x78f7('0x21'),auth['isAuthenticated'](),controller[_0x78f7('0x22')]);router[_0x78f7('0x23')]('/',auth[_0x78f7('0x9')](),controller[_0x78f7('0x24')]);router[_0x78f7('0x23')](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x25')]);router[_0x78f7('0x23')]('/:id/canned_answers',auth[_0x78f7('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x54f2c3,_0x582cf0,_0x2c941f){_0x2c941f(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],'server/files/images/logos/'));},'filename':function(_0x956b02,_0x38a4cb,_0xd79d07){_0xd79d07(null,util['format'](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x38a4cb[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x10'),upload[_0x78f7('0x2c')](_0x78f7('0x2d')),controller[_0x78f7('0x2e')]);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x414181,_0x47c3a7,_0x4d106){_0x4d106(null,path[_0x78f7('0x27')](config['root'],_0x78f7('0x2f')));},'filename':function(_0x44faff,_0x3dfc13,_0x46e9aa){_0x46e9aa(null,util['format'](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x3dfc13[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x12'),upload['single'](_0x78f7('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x4e9360,_0x96b77a,_0x1593bb){_0x1593bb(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],_0x78f7('0x2f')));},'filename':function(_0xd7663b,_0x2416c7,_0x878ef0){_0x878ef0(null,util[_0x78f7('0x30')](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x2416c7[_0x78f7('0x2b')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0x78f7('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x47e0b1,_0x151eca,_0x4e08a7){_0x4e08a7(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],_0x78f7('0x2f')));},'filename':function(_0x151221,_0x113fc7,_0x2caa20){_0x2caa20(null,util[_0x78f7('0x30')]('%s-%s',Date[_0x78f7('0x2a')](),_0x113fc7[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x16'),upload['single'](_0x78f7('0x2d')),controller['addSystemAvatar']);router[_0x78f7('0x23')](_0x78f7('0x31'),controller[_0x78f7('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0xb4ace8,_0x4738b6,_0x342a2a){const _0x31e11b=path[_0x78f7('0x27')](config['root'],'server/files',_0x78f7('0x33'),_0x78f7('0x34'));fs_extra[_0x78f7('0x35')](_0x31e11b,function(){_0x342a2a(null,_0x31e11b);});},'filename':function(_0x51cdd8,_0x757ac7,_0x353a56){const _0x1f0c3b=_0x757ac7[_0x78f7('0x2b')][_0x78f7('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x533b2c=path[_0x78f7('0x37')](_0x1f0c3b);const _0x2dd0b4=Date[_0x78f7('0x2a')]()+'-'+_0x1f0c3b[_0x78f7('0x36')](_0x533b2c,'')+_0x533b2c;_0x353a56(null,_0x2dd0b4);}})});router['post'](_0x78f7('0x38'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0x78f7('0x18'),auth[_0x78f7('0x9')](),controller['addInteraction']);router['post'](_0x78f7('0x39'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3a')]);router[_0x78f7('0x23')](_0x78f7('0x3b'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3c')]);router['post'](_0x78f7('0x21'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3d')]);router[_0x78f7('0x3e')]('/:id',auth[_0x78f7('0x9')](),controller[_0x78f7('0x3f')]);router[_0x78f7('0x40')]('/:id',auth[_0x78f7('0x9')](),controller[_0x78f7('0x41')]);router['delete'](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller['removeDispositions']);router[_0x78f7('0x40')](_0x78f7('0xe'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x42')]);router['delete'](_0x78f7('0x21'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 101edab..31b9be3 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb54=['expressEndpoint','/client-logs','exports','beaver-logger/server','../components/auth/service','../config/environment','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0xb0d13d,_0x5e65ea){var _0x311a39=function(_0x5e3da6){while(--_0x5e3da6){_0xb0d13d['push'](_0xb0d13d['shift']());}};_0x311a39(++_0x5e65ea);}(_0xcb54,0x175));var _0x4cb5=function(_0x19a241,_0x2b5948){_0x19a241=_0x19a241-0x0;var _0x1297e9=_0xcb54[_0x19a241];return _0x1297e9;};var beaverLogger=require(_0x4cb5('0x0'));var express=require('express');var auth=require(_0x4cb5('0x1'));var config=require(_0x4cb5('0x2'));var router=express['Router']();var isProduction=config['env']===_0x4cb5('0x3')||![];function clientSideLogs(_0x1b2a3f,_0x4a9cc4,_0x444e77){var _0x51f493=_0x1b2a3f[_0x4cb5('0x4')]['get'](_0x4cb5('0x5'));if(!_0x51f493){throw new Error(_0x4cb5('0x6'));}return beaverLogger[_0x4cb5('0x7')]({'uri':_0x4cb5('0x8'),'logger':_0x51f493,'enableCors':!isProduction})(_0x1b2a3f,_0x4a9cc4,_0x444e77);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x4cb5('0x9')]=router; \ No newline at end of file +var _0xf8a2=['../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','exports','beaver-logger/server','express'];(function(_0x10e504,_0x42e73e){var _0x5c7678=function(_0x32efb9){while(--_0x32efb9){_0x10e504['push'](_0x10e504['shift']());}};_0x5c7678(++_0x42e73e);}(_0xf8a2,0xe8));var _0x2f8a=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xf8a2[_0x575a38];return _0x5a7bdd;};var beaverLogger=require(_0x2f8a('0x0'));var express=require(_0x2f8a('0x1'));var auth=require('../components/auth/service');var config=require(_0x2f8a('0x2'));var router=express[_0x2f8a('0x3')]();var isProduction=config[_0x2f8a('0x4')]===_0x2f8a('0x5')||![];function clientSideLogs(_0x42c2fa,_0x1567ac,_0x7366ff){var _0x320235=_0x42c2fa[_0x2f8a('0x6')][_0x2f8a('0x7')](_0x2f8a('0x8'));if(!_0x320235){throw new Error(_0x2f8a('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x2f8a('0xa'),'logger':_0x320235,'enableCors':!isProduction})(_0x42c2fa,_0x1567ac,_0x7366ff);}router[_0x2f8a('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x2f8a('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f1653d3..a46c5d7 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 _0x2e7d=['exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize'];(function(_0x4b0c78,_0x3c3f28){var _0x47900c=function(_0x36989a){while(--_0x36989a){_0x4b0c78['push'](_0x4b0c78['shift']());}};_0x47900c(++_0x3c3f28);}(_0x2e7d,0x187));var _0xd2e7=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x2e7d[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0xd2e7('0x0'));module[_0xd2e7('0x1')]={'name':{'type':Sequelize[_0xd2e7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd2e7('0x3')]('AmazonAWS',_0xd2e7('0x4'),_0xd2e7('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd2e7('0x3')](_0xd2e7('0x6'),_0xd2e7('0x7'))},'data1':{'type':Sequelize[_0xd2e7('0x2')],'comment':_0xd2e7('0x8')},'data2':{'type':Sequelize[_0xd2e7('0x2')],'comment':_0xd2e7('0x9')},'data3':{'type':Sequelize[_0xd2e7('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xd2e7('0x2')],'comment':_0xd2e7('0xa')},'data5':{'type':Sequelize[_0xd2e7('0xb')],'comment':_0xd2e7('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xd2e7('0xd')},'data7':{'type':Sequelize[_0xd2e7('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x6c2e=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0x6c2e,0x67));var _0xe6c2=function(_0x17fadf,_0x394d52){_0x17fadf=_0x17fadf-0x0;var _0x19dba6=_0x6c2e[_0x17fadf];return _0x19dba6;};'use strict';var Sequelize=require('sequelize');module[_0xe6c2('0x0')]={'name':{'type':Sequelize[_0xe6c2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe6c2('0x2')](_0xe6c2('0x3'),_0xe6c2('0x4'),_0xe6c2('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe6c2('0x2')](_0xe6c2('0x6'),_0xe6c2('0x7'))},'data1':{'type':Sequelize[_0xe6c2('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0x8')},'data3':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0x9')},'data4':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xe6c2('0xb')},'data6':{'type':Sequelize[_0xe6c2('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0xe6c2('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5cf9b06..7bdf4dc 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 _0xc57b=['../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','find','decryptString','body','service','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','from','state','base64','toString','ascii','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor'];(function(_0x277bec,_0x593224){var _0x2efd60=function(_0x3cef68){while(--_0x3cef68){_0x277bec['push'](_0x277bec['shift']());}};_0x2efd60(++_0x593224);}(_0xc57b,0x122));var _0xbc57=function(_0x2792b2,_0x12efa9){_0x2792b2=_0x2792b2-0x0;var _0x12aafa=_0xc57b[_0x2792b2];return _0x12aafa;};'use strict';var _=require(_0xbc57('0x0'));var Redis=require(_0xbc57('0x1'));var qs=require(_0xbc57('0x2'));var encryptor=require(_0xbc57('0x3'));var config=require(_0xbc57('0x4'));var logger=require('../../config/logger')(_0xbc57('0x5'));var db=require(_0xbc57('0x6'))['db'];var oauth=require(_0xbc57('0x7'));config['redis']=_[_0xbc57('0x8')](config[_0xbc57('0x9')],{'host':_0xbc57('0xa'),'port':0x18eb});var socket=require(_0xbc57('0xb'))(new Redis(config[_0xbc57('0x9')]));var redis=new Redis(config[_0xbc57('0x9')]);function respondWithStatusCode(_0x35191b,_0x18c761){_0x18c761=_0x18c761||0xcc;return function(_0x394135){if(_0x394135){return _0x35191b['sendStatus'](_0x18c761);}return _0x35191b['status'](_0x18c761)[_0xbc57('0xc')]();};}function respondWithResult(_0x4df49a,_0x2efab3){_0x2efab3=_0x2efab3||0xc8;return function(_0x37825b){if(_0x37825b){return _0x4df49a[_0xbc57('0xd')](_0x2efab3)[_0xbc57('0xe')](_0x37825b);}};}function respondWithFilteredResult(_0xbb331b,_0x147504){return function(_0x221ac8){if(_0x221ac8){var _0x1e220a=typeof _0x147504[_0xbc57('0xf')]===_0xbc57('0x10')&&typeof _0x147504[_0xbc57('0x11')]===_0xbc57('0x10');var _0x55d179=_0x221ac8[_0xbc57('0x12')];var _0x3196ac=_0x1e220a?0x0:_0x147504[_0xbc57('0xf')];var _0x4aa8=_0x1e220a?_0x221ac8[_0xbc57('0x12')]:_0x147504[_0xbc57('0xf')]+_0x147504[_0xbc57('0x11')];var _0x57ddda;if(_0x4aa8>=_0x55d179){_0x4aa8=_0x55d179;_0x57ddda=0xc8;}else{_0x57ddda=0xce;}_0xbb331b[_0xbc57('0xd')](_0x57ddda);return _0xbb331b[_0xbc57('0x13')](_0xbc57('0x14'),_0x3196ac+'-'+_0x4aa8+'/'+_0x55d179)[_0xbc57('0xe')](_0x221ac8);}return null;};}function saveUpdates(_0x5fc5d7){return function(_0x23d730){if(_0x23d730){return _0x23d730[_0xbc57('0x15')](_0x5fc5d7)['then'](function(_0xefc12c){return _0xefc12c;});}return null;};}function removeEntity(_0x3bbec3){return function(_0x4462d5){if(_0x4462d5){return _0x4462d5[_0xbc57('0x16')]()[_0xbc57('0x17')](function(){_0x3bbec3['status'](0xcc)[_0xbc57('0xc')]();});}};}function handleEntityNotFound(_0x1246be){return function(_0x3e11c2){if(!_0x3e11c2){_0x1246be[_0xbc57('0x18')](0x194);}return _0x3e11c2;};}function handleError(_0x3c95f3,_0x555daf){_0x555daf=_0x555daf||0x1f4;return function(_0x21a648){logger[_0xbc57('0x19')](_0x21a648[_0xbc57('0x1a')]);if(_0x21a648[_0xbc57('0x1b')]){delete _0x21a648['name'];}_0x3c95f3[_0xbc57('0xd')](_0x555daf)[_0xbc57('0x1c')](_0x21a648);};}function maskClientSecret(_0x756f2f){return _['padEnd'](_0x756f2f[_0xbc57('0x1d')](0x0,0x3),0x14,'*');}exports[_0xbc57('0x1e')]=function(_0x3b6191,_0x5b3fcb){var _0x24e332={},_0x56bab9={},_0x24c62b={'count':0x0,'rows':[]};var _0x5881a3=_[_0xbc57('0x1f')](db[_0xbc57('0x20')][_0xbc57('0x21')],function(_0x1a8ecc){return{'name':_0x1a8ecc['fieldName'],'type':_0x1a8ecc[_0xbc57('0x22')][_0xbc57('0x23')]};});_0x56bab9[_0xbc57('0x24')]=_['map'](_0x5881a3,'name');_0x56bab9[_0xbc57('0x25')]=_[_0xbc57('0x26')](_0x3b6191[_0xbc57('0x25')]);_0x56bab9[_0xbc57('0x27')]=_[_0xbc57('0x28')](_0x56bab9[_0xbc57('0x24')],_0x56bab9[_0xbc57('0x25')]);_0x24e332[_0xbc57('0x29')]=_[_0xbc57('0x28')](_0x56bab9[_0xbc57('0x24')],qs[_0xbc57('0x2a')](_0x3b6191[_0xbc57('0x25')][_0xbc57('0x2a')]));_0x24e332['attributes']=_0x24e332[_0xbc57('0x29')][_0xbc57('0x2b')]?_0x24e332[_0xbc57('0x29')]:_0x56bab9[_0xbc57('0x24')];if(!_0x3b6191[_0xbc57('0x25')][_0xbc57('0x2c')]('nolimit')){_0x24e332['limit']=qs[_0xbc57('0x11')](_0x3b6191[_0xbc57('0x25')]['limit']);_0x24e332[_0xbc57('0xf')]=qs[_0xbc57('0xf')](_0x3b6191[_0xbc57('0x25')][_0xbc57('0xf')]);}_0x24e332[_0xbc57('0x2d')]=qs[_0xbc57('0x2e')](_0x3b6191[_0xbc57('0x25')][_0xbc57('0x2e')]);_0x24e332[_0xbc57('0x2f')]=qs[_0xbc57('0x27')](_[_0xbc57('0x30')](_0x3b6191['query'],_0x56bab9['filters']),_0x5881a3);if(_0x3b6191[_0xbc57('0x25')][_0xbc57('0x31')]){_0x24e332[_0xbc57('0x2f')]=_[_0xbc57('0x32')](_0x24e332[_0xbc57('0x2f')],{'$or':_[_0xbc57('0x1f')](_0x5881a3,function(_0x32c16d){if(_0x32c16d['type']!==_0xbc57('0x33')){var _0x19bcd9={};_0x19bcd9[_0x32c16d[_0xbc57('0x1b')]]={'$like':'%'+_0x3b6191[_0xbc57('0x25')][_0xbc57('0x31')]+'%'};return _0x19bcd9;}})});}_0x24e332=_[_0xbc57('0x32')]({},_0x24e332,_0x3b6191[_0xbc57('0x34')]);var _0x3b314d={'where':_0x24e332[_0xbc57('0x2f')]};return db[_0xbc57('0x20')][_0xbc57('0x12')](_0x3b314d)[_0xbc57('0x17')](function(_0x3d72a5){_0x24c62b[_0xbc57('0x12')]=_0x3d72a5;if(_0x3b6191[_0xbc57('0x25')][_0xbc57('0x35')]){_0x24e332[_0xbc57('0x36')]=[{'all':!![]}];}return db['CloudProvider'][_0xbc57('0x37')](_0x24e332);})['then'](function(_0x37c7b8){_0x24c62b[_0xbc57('0x38')]=_['map'](_0x37c7b8,function(_0x5014c3){if(_0x5014c3['service']===_0xbc57('0x39')){var _0x4fa215=encryptor['decryptString'](_0x5014c3[_0xbc57('0x3a')]);_0x5014c3[_0xbc57('0x3a')]=maskClientSecret(_0x4fa215);}return _0x5014c3;});return _0x24c62b;})[_0xbc57('0x17')](respondWithFilteredResult(_0x5b3fcb,_0x24e332))[_0xbc57('0x3b')](handleError(_0x5b3fcb,null));};exports[_0xbc57('0x3c')]=function(_0x1c8084,_0x3f55ea){var _0x45c88b={'raw':!![],'where':{'id':_0x1c8084[_0xbc57('0x3d')]['id']}},_0x4b7f27={};_0x4b7f27[_0xbc57('0x24')]=_['keys'](db[_0xbc57('0x20')][_0xbc57('0x21')]);_0x4b7f27['query']=_[_0xbc57('0x26')](_0x1c8084[_0xbc57('0x25')]);_0x4b7f27[_0xbc57('0x27')]=_[_0xbc57('0x28')](_0x4b7f27[_0xbc57('0x24')],_0x4b7f27['query']);_0x45c88b['attributes']=_[_0xbc57('0x28')](_0x4b7f27[_0xbc57('0x24')],qs[_0xbc57('0x2a')](_0x1c8084[_0xbc57('0x25')][_0xbc57('0x2a')]));_0x45c88b[_0xbc57('0x29')]=_0x45c88b[_0xbc57('0x29')]['length']?_0x45c88b[_0xbc57('0x29')]:_0x4b7f27[_0xbc57('0x24')];if(_0x1c8084[_0xbc57('0x25')][_0xbc57('0x35')]){_0x45c88b[_0xbc57('0x36')]=[{'all':!![]}];}_0x45c88b=_[_0xbc57('0x32')]({},_0x45c88b,_0x1c8084['options']);return db[_0xbc57('0x20')][_0xbc57('0x3e')](_0x45c88b)[_0xbc57('0x17')](handleEntityNotFound(_0x3f55ea,null))[_0xbc57('0x17')](function(_0x2f9110){if(_0x2f9110['service']===_0xbc57('0x39')){var _0x1b7111=encryptor[_0xbc57('0x3f')](_0x2f9110[_0xbc57('0x3a')]);_0x2f9110[_0xbc57('0x3a')]=maskClientSecret(_0x1b7111);}return _0x2f9110;})[_0xbc57('0x17')](respondWithResult(_0x3f55ea,null))['catch'](handleError(_0x3f55ea,null));};exports['create']=function(_0x23eb99,_0x2c5480){if(!_0x23eb99[_0xbc57('0x40')][_0xbc57('0x1b')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x23eb99[_0xbc57('0x40')][_0xbc57('0x41')])throw new Error(_0xbc57('0x42'));var _0x352619=db[_0xbc57('0x20')][_0xbc57('0x21')][_0xbc57('0x41')]['values'];if(!_0x352619[_0xbc57('0x43')](_0x23eb99['body'][_0xbc57('0x41')]))throw new Error(_0xbc57('0x44')+_0x352619['join'](',\x20'));if(_0x23eb99[_0xbc57('0x40')][_0xbc57('0x41')]==='MicrosoftAzure'&&_0x23eb99[_0xbc57('0x40')][_0xbc57('0x3a')]){_0x23eb99[_0xbc57('0x40')]['data3']=encryptor[_0xbc57('0x45')](_0x23eb99[_0xbc57('0x40')][_0xbc57('0x3a')]);}return db[_0xbc57('0x20')][_0xbc57('0x46')](_0x23eb99['body'],{})[_0xbc57('0x17')](respondWithResult(_0x2c5480,0xc9))[_0xbc57('0x3b')](handleError(_0x2c5480,null));};exports[_0xbc57('0x15')]=function(_0x49d73e,_0x480c44){if(_0x49d73e['body']['id']){delete _0x49d73e[_0xbc57('0x40')]['id'];}return db[_0xbc57('0x20')]['find']({'where':{'id':_0x49d73e[_0xbc57('0x3d')]['id']}})['then'](handleEntityNotFound(_0x480c44,null))[_0xbc57('0x17')](function(_0x5b5c01){if(_0x5b5c01[_0xbc57('0x41')]===_0xbc57('0x39')&&_0x49d73e[_0xbc57('0x40')][_0xbc57('0x3a')]){_0x49d73e['body']['data3']=encryptor[_0xbc57('0x45')](_0x49d73e[_0xbc57('0x40')]['data3']);}return _0x5b5c01;})[_0xbc57('0x17')](saveUpdates(_0x49d73e['body'],null))[_0xbc57('0x17')](respondWithResult(_0x480c44,null))[_0xbc57('0x3b')](handleError(_0x480c44,null));};exports[_0xbc57('0x16')]=function(_0x2b32cc,_0x4d9e31){return db[_0xbc57('0x20')]['find']({'where':{'id':_0x2b32cc[_0xbc57('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4d9e31,null))['then'](removeEntity(_0x4d9e31,null))[_0xbc57('0x3b')](handleError(_0x4d9e31,null));};exports[_0xbc57('0x47')]=function(_0x41b0d2,_0x22d13d){return db[_0xbc57('0x20')][_0xbc57('0x48')]({'where':{'id':_0x41b0d2[_0xbc57('0x3d')]['id']},'raw':!![]})[_0xbc57('0x17')](function(_0x53eed4){if(!_0x53eed4)return _0x22d13d['sendStatus'](0x194);return{'url':oauth[_0xbc57('0x49')](_0x53eed4,_0x41b0d2[_0xbc57('0x4a')]['id'])};})['then'](respondWithResult(_0x22d13d,null))[_0xbc57('0x3b')](handleError(_0x22d13d,null));};exports[_0xbc57('0x4b')]=function(_0xce8c52,_0x2efa46){var _0x403d2a=_0xce8c52[_0xbc57('0x40')];var _0x688799;var _0x187ffb;if(_0x403d2a[_0xbc57('0x19')])throw _0x403d2a;redis['get'](_0x403d2a['state'])[_0xbc57('0x17')](function(_0x592b40){if(!_0x592b40)throw new Error(_0xbc57('0x4c'));_0x688799=JSON['parse'](_0x592b40);var _0x2d4338=Buffer[_0xbc57('0x4d')](_0x403d2a[_0xbc57('0x4e')],_0xbc57('0x4f'))[_0xbc57('0x50')](_0xbc57('0x51'));_0x187ffb=JSON[_0xbc57('0x52')](_0x2d4338);if(!oauth['isValidIdToken'](_0x403d2a[_0xbc57('0x53')],_0x688799[_0xbc57('0x54')]))throw new Error(_0xbc57('0x55'));redis[_0xbc57('0x56')](_0x403d2a[_0xbc57('0x4e')]);return oauth[_0xbc57('0x57')](_0x403d2a[_0xbc57('0x58')],_0x688799);})[_0xbc57('0x17')](function(_0x521d2f){_0x688799[_0xbc57('0x59')]=_0x521d2f['access_token'];_0x688799[_0xbc57('0x5a')]=_0x521d2f[_0xbc57('0x5b')];return db[_0xbc57('0x20')]['update']({'data5':_0x688799[_0xbc57('0x59')],'data6':_0x688799[_0xbc57('0x5a')]},{'where':{'id':_0x688799['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x688799);socket[_0xbc57('0x5c')](_0xbc57('0x5d'),{'id':_0x187ffb['id']});return;})['then'](respondWithStatusCode(_0x2efa46,null))[_0xbc57('0x3b')](function(_0x3549cb){if(_0x187ffb){socket[_0xbc57('0x5c')](_0xbc57('0x5e'),{'id':_0x187ffb['id']});}if(!_0x688799){logger[_0xbc57('0x19')](_0xbc57('0x5f'),_0x3549cb);return _0x2efa46[_0xbc57('0xd')](0x1f4)[_0xbc57('0x1c')](_0x3549cb['message']);}logger[_0xbc57('0x19')](_0xbc57('0x60'),_0x688799['id'],JSON[_0xbc57('0x61')](_0x3549cb));});}; \ No newline at end of file +var _0x92e6=['oauth2MicrosoftCallback','parse','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','redis','socket.io-emitter','sendStatus','status','end','json','offset','count','limit','set','Content-Range','then','destroy','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','include','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','update','encryptString','oauth2MicrosoftAuthorize','user'];(function(_0x209d2a,_0x59a302){var _0x2d2a4a=function(_0x4d5084){while(--_0x4d5084){_0x209d2a['push'](_0x209d2a['shift']());}};_0x2d2a4a(++_0x59a302);}(_0x92e6,0x16b));var _0x692e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x92e6[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x692e('0x0'));var encryptor=require(_0x692e('0x1'));var config=require('../../config/environment');var logger=require(_0x692e('0x2'))(_0x692e('0x3'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x692e('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x692e('0x5'))(new Redis(config['redis']));var redis=new Redis(config[_0x692e('0x4')]);function respondWithStatusCode(_0x5099eb,_0x515ed7){_0x515ed7=_0x515ed7||0xcc;return function(_0x4d4145){if(_0x4d4145){return _0x5099eb[_0x692e('0x6')](_0x515ed7);}return _0x5099eb[_0x692e('0x7')](_0x515ed7)[_0x692e('0x8')]();};}function respondWithResult(_0x34b385,_0x4e2ca2){_0x4e2ca2=_0x4e2ca2||0xc8;return function(_0x5e2c92){if(_0x5e2c92){return _0x34b385['status'](_0x4e2ca2)[_0x692e('0x9')](_0x5e2c92);}};}function respondWithFilteredResult(_0x397c97,_0x4679d3){return function(_0x3dc6b1){if(_0x3dc6b1){var _0x396c62=typeof _0x4679d3[_0x692e('0xa')]==='undefined'&&typeof _0x4679d3['limit']==='undefined';var _0x129613=_0x3dc6b1[_0x692e('0xb')];var _0x50b4c0=_0x396c62?0x0:_0x4679d3['offset'];var _0x11ee32=_0x396c62?_0x3dc6b1['count']:_0x4679d3[_0x692e('0xa')]+_0x4679d3[_0x692e('0xc')];var _0x17398c;if(_0x11ee32>=_0x129613){_0x11ee32=_0x129613;_0x17398c=0xc8;}else{_0x17398c=0xce;}_0x397c97[_0x692e('0x7')](_0x17398c);return _0x397c97[_0x692e('0xd')](_0x692e('0xe'),_0x50b4c0+'-'+_0x11ee32+'/'+_0x129613)[_0x692e('0x9')](_0x3dc6b1);}return null;};}function saveUpdates(_0x3be789){return function(_0x1cc7f6){if(_0x1cc7f6){return _0x1cc7f6['update'](_0x3be789)[_0x692e('0xf')](function(_0x32f19a){return _0x32f19a;});}return null;};}function removeEntity(_0x5e2d26){return function(_0x219dda){if(_0x219dda){return _0x219dda[_0x692e('0x10')]()[_0x692e('0xf')](function(){_0x5e2d26['status'](0xcc)[_0x692e('0x8')]();});}};}function handleEntityNotFound(_0x149d53){return function(_0x103e9f){if(!_0x103e9f){_0x149d53[_0x692e('0x6')](0x194);}return _0x103e9f;};}function handleError(_0x41bead,_0x2ec76a){_0x2ec76a=_0x2ec76a||0x1f4;return function(_0x496265){logger[_0x692e('0x11')](_0x496265['stack']);if(_0x496265[_0x692e('0x12')]){delete _0x496265[_0x692e('0x12')];}_0x41bead[_0x692e('0x7')](_0x2ec76a)[_0x692e('0x13')](_0x496265);};}function maskClientSecret(_0x4bdb74){return _[_0x692e('0x14')](_0x4bdb74[_0x692e('0x15')](0x0,0x3),0x14,'*');}exports[_0x692e('0x16')]=function(_0x34d641,_0x4cc31b){var _0x228519={},_0x1c503d={},_0x30d72a={'count':0x0,'rows':[]};var _0x19f5fe=_[_0x692e('0x17')](db[_0x692e('0x18')][_0x692e('0x19')],function(_0x4d91d9){return{'name':_0x4d91d9['fieldName'],'type':_0x4d91d9['type'][_0x692e('0x1a')]};});_0x1c503d[_0x692e('0x1b')]=_[_0x692e('0x17')](_0x19f5fe,'name');_0x1c503d[_0x692e('0x1c')]=_['keys'](_0x34d641[_0x692e('0x1c')]);_0x1c503d[_0x692e('0x1d')]=_['intersection'](_0x1c503d[_0x692e('0x1b')],_0x1c503d[_0x692e('0x1c')]);_0x228519['attributes']=_[_0x692e('0x1e')](_0x1c503d[_0x692e('0x1b')],qs[_0x692e('0x1f')](_0x34d641[_0x692e('0x1c')][_0x692e('0x1f')]));_0x228519[_0x692e('0x20')]=_0x228519['attributes'][_0x692e('0x21')]?_0x228519[_0x692e('0x20')]:_0x1c503d[_0x692e('0x1b')];if(!_0x34d641[_0x692e('0x1c')][_0x692e('0x22')](_0x692e('0x23'))){_0x228519['limit']=qs[_0x692e('0xc')](_0x34d641['query'][_0x692e('0xc')]);_0x228519[_0x692e('0xa')]=qs[_0x692e('0xa')](_0x34d641[_0x692e('0x1c')][_0x692e('0xa')]);}_0x228519[_0x692e('0x24')]=qs[_0x692e('0x25')](_0x34d641[_0x692e('0x1c')]['sort']);_0x228519[_0x692e('0x26')]=qs[_0x692e('0x1d')](_[_0x692e('0x27')](_0x34d641[_0x692e('0x1c')],_0x1c503d[_0x692e('0x1d')]),_0x19f5fe);if(_0x34d641['query'][_0x692e('0x28')]){_0x228519[_0x692e('0x26')]=_[_0x692e('0x29')](_0x228519[_0x692e('0x26')],{'$or':_[_0x692e('0x17')](_0x19f5fe,function(_0x1a5520){if(_0x1a5520['type']!==_0x692e('0x2a')){var _0x2fe4c3={};_0x2fe4c3[_0x1a5520[_0x692e('0x12')]]={'$like':'%'+_0x34d641[_0x692e('0x1c')][_0x692e('0x28')]+'%'};return _0x2fe4c3;}})});}_0x228519=_['merge']({},_0x228519,_0x34d641[_0x692e('0x2b')]);var _0x42179a={'where':_0x228519[_0x692e('0x26')]};return db[_0x692e('0x18')][_0x692e('0xb')](_0x42179a)[_0x692e('0xf')](function(_0x55c532){_0x30d72a[_0x692e('0xb')]=_0x55c532;if(_0x34d641['query'][_0x692e('0x2c')]){_0x228519['include']=[{'all':!![]}];}return db[_0x692e('0x18')][_0x692e('0x2d')](_0x228519);})[_0x692e('0xf')](function(_0x5991c3){_0x30d72a['rows']=_[_0x692e('0x17')](_0x5991c3,function(_0x31d4e9){if(_0x31d4e9[_0x692e('0x2e')]===_0x692e('0x2f')){var _0x141837=encryptor[_0x692e('0x30')](_0x31d4e9[_0x692e('0x31')]);_0x31d4e9[_0x692e('0x31')]=maskClientSecret(_0x141837);}return _0x31d4e9;});return _0x30d72a;})[_0x692e('0xf')](respondWithFilteredResult(_0x4cc31b,_0x228519))[_0x692e('0x32')](handleError(_0x4cc31b,null));};exports[_0x692e('0x33')]=function(_0x2d210a,_0xaf23ad){var _0x7b06ef={'raw':!![],'where':{'id':_0x2d210a[_0x692e('0x34')]['id']}},_0x122310={};_0x122310[_0x692e('0x1b')]=_[_0x692e('0x35')](db[_0x692e('0x18')]['rawAttributes']);_0x122310[_0x692e('0x1c')]=_[_0x692e('0x35')](_0x2d210a[_0x692e('0x1c')]);_0x122310[_0x692e('0x1d')]=_[_0x692e('0x1e')](_0x122310[_0x692e('0x1b')],_0x122310[_0x692e('0x1c')]);_0x7b06ef[_0x692e('0x20')]=_[_0x692e('0x1e')](_0x122310[_0x692e('0x1b')],qs[_0x692e('0x1f')](_0x2d210a[_0x692e('0x1c')][_0x692e('0x1f')]));_0x7b06ef[_0x692e('0x20')]=_0x7b06ef[_0x692e('0x20')][_0x692e('0x21')]?_0x7b06ef[_0x692e('0x20')]:_0x122310[_0x692e('0x1b')];if(_0x2d210a[_0x692e('0x1c')]['includeAll']){_0x7b06ef[_0x692e('0x36')]=[{'all':!![]}];}_0x7b06ef=_[_0x692e('0x29')]({},_0x7b06ef,_0x2d210a[_0x692e('0x2b')]);return db[_0x692e('0x18')][_0x692e('0x37')](_0x7b06ef)[_0x692e('0xf')](handleEntityNotFound(_0xaf23ad,null))[_0x692e('0xf')](function(_0x534464){if(_0x534464[_0x692e('0x2e')]===_0x692e('0x2f')){var _0xf6f6bd=encryptor[_0x692e('0x30')](_0x534464[_0x692e('0x31')]);_0x534464[_0x692e('0x31')]=maskClientSecret(_0xf6f6bd);}return _0x534464;})['then'](respondWithResult(_0xaf23ad,null))['catch'](handleError(_0xaf23ad,null));};exports[_0x692e('0x38')]=function(_0x31d823,_0x467b35){if(!_0x31d823[_0x692e('0x39')][_0x692e('0x12')])throw new Error(_0x692e('0x3a'));if(!_0x31d823['body'][_0x692e('0x2e')])throw new Error(_0x692e('0x3b'));var _0xb6b009=db[_0x692e('0x18')][_0x692e('0x19')][_0x692e('0x2e')][_0x692e('0x3c')];if(!_0xb6b009[_0x692e('0x3d')](_0x31d823[_0x692e('0x39')][_0x692e('0x2e')]))throw new Error(_0x692e('0x3e')+_0xb6b009['join'](',\x20'));if(_0x31d823['body']['service']===_0x692e('0x2f')&&_0x31d823[_0x692e('0x39')][_0x692e('0x31')]){_0x31d823[_0x692e('0x39')][_0x692e('0x31')]=encryptor['encryptString'](_0x31d823['body'][_0x692e('0x31')]);}return db[_0x692e('0x18')][_0x692e('0x38')](_0x31d823[_0x692e('0x39')],{})[_0x692e('0xf')](respondWithResult(_0x467b35,0xc9))['catch'](handleError(_0x467b35,null));};exports[_0x692e('0x3f')]=function(_0x169717,_0x49ec2e){if(_0x169717['body']['id']){delete _0x169717[_0x692e('0x39')]['id'];}return db[_0x692e('0x18')][_0x692e('0x37')]({'where':{'id':_0x169717[_0x692e('0x34')]['id']}})[_0x692e('0xf')](handleEntityNotFound(_0x49ec2e,null))['then'](function(_0x214390){if(_0x214390[_0x692e('0x2e')]==='MicrosoftAzure'&&_0x169717[_0x692e('0x39')][_0x692e('0x31')]){_0x169717[_0x692e('0x39')]['data3']=encryptor[_0x692e('0x40')](_0x169717[_0x692e('0x39')]['data3']);}return _0x214390;})[_0x692e('0xf')](saveUpdates(_0x169717[_0x692e('0x39')],null))['then'](respondWithResult(_0x49ec2e,null))['catch'](handleError(_0x49ec2e,null));};exports[_0x692e('0x10')]=function(_0x12f19e,_0x17df67){return db[_0x692e('0x18')][_0x692e('0x37')]({'where':{'id':_0x12f19e[_0x692e('0x34')]['id']}})[_0x692e('0xf')](handleEntityNotFound(_0x17df67,null))['then'](removeEntity(_0x17df67,null))['catch'](handleError(_0x17df67,null));};exports[_0x692e('0x41')]=function(_0x103e92,_0x340b41){return db[_0x692e('0x18')]['findOne']({'where':{'id':_0x103e92[_0x692e('0x34')]['id']},'raw':!![]})[_0x692e('0xf')](function(_0x5408e8){if(!_0x5408e8)return _0x340b41['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x5408e8,_0x103e92[_0x692e('0x42')]['id'])};})['then'](respondWithResult(_0x340b41,null))[_0x692e('0x32')](handleError(_0x340b41,null));};exports[_0x692e('0x43')]=function(_0x309f78,_0x5cd72b){var _0xb5f283=_0x309f78[_0x692e('0x39')];var _0x45ee5a;var _0x42199f;if(_0xb5f283[_0x692e('0x11')])throw _0xb5f283;redis['get'](_0xb5f283['state'])[_0x692e('0xf')](function(_0x302f1d){if(!_0x302f1d)throw new Error('Invalid\x20state\x20parameter');_0x45ee5a=JSON[_0x692e('0x44')](_0x302f1d);var _0x64b6f9=Buffer['from'](_0xb5f283[_0x692e('0x45')],_0x692e('0x46'))[_0x692e('0x47')](_0x692e('0x48'));_0x42199f=JSON[_0x692e('0x44')](_0x64b6f9);if(!oauth[_0x692e('0x49')](_0xb5f283[_0x692e('0x4a')],_0x45ee5a[_0x692e('0x4b')]))throw new Error(_0x692e('0x4c'));redis['del'](_0xb5f283[_0x692e('0x45')]);return oauth[_0x692e('0x4d')](_0xb5f283['code'],_0x45ee5a);})['then'](function(_0x1420ea){_0x45ee5a['data5']=_0x1420ea[_0x692e('0x4e')];_0x45ee5a[_0x692e('0x4f')]=_0x1420ea['refresh_token'];return db['CloudProvider']['update']({'data5':_0x45ee5a[_0x692e('0x50')],'data6':_0x45ee5a[_0x692e('0x4f')]},{'where':{'id':_0x45ee5a['id']}});})['then'](function(){oauth[_0x692e('0x51')](_0x45ee5a);socket[_0x692e('0x52')](_0x692e('0x53'),{'id':_0x42199f['id']});return;})['then'](respondWithStatusCode(_0x5cd72b,null))[_0x692e('0x32')](function(_0x1cf7a4){if(_0x42199f){socket[_0x692e('0x52')](_0x692e('0x54'),{'id':_0x42199f['id']});}if(!_0x45ee5a){logger['error'](_0x692e('0x55'),_0x1cf7a4);return _0x5cd72b[_0x692e('0x7')](0x1f4)[_0x692e('0x13')](_0x1cf7a4['message']);}logger[_0x692e('0x11')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x45ee5a['id'],JSON['stringify'](_0x1cf7a4));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5e5376a..b164911 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 _0x9eed=['cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x5c9ad0,_0x6b130c){var _0x3996f4=function(_0x4edb4b){while(--_0x4edb4b){_0x5c9ad0['push'](_0x5c9ad0['shift']());}};_0x3996f4(++_0x6b130c);}(_0x9eed,0x6d));var _0xd9ee=function(_0x459939,_0x3e3b6a){_0x459939=_0x459939-0x0;var _0x378bdf=_0x9eed[_0x459939];return _0x378bdf;};'use strict';var _=require(_0xd9ee('0x0'));var util=require(_0xd9ee('0x1'));var logger=require('../../config/logger')(_0xd9ee('0x2'));var moment=require(_0xd9ee('0x3'));var BPromise=require(_0xd9ee('0x4'));var rp=require(_0xd9ee('0x5'));var fs=require('fs');var path=require(_0xd9ee('0x6'));var rimraf=require(_0xd9ee('0x7'));var config=require(_0xd9ee('0x8'));var attributes=require(_0xd9ee('0x9'));module['exports']=function(_0x5222f6,_0x3ea896){return _0x5222f6[_0xd9ee('0xa')]('CloudProvider',attributes,{'tableName':_0xd9ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c25=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x23a9fd,_0x51c59a){var _0x541e7c=function(_0x4297d8){while(--_0x4297d8){_0x23a9fd['push'](_0x23a9fd['shift']());}};_0x541e7c(++_0x51c59a);}(_0x5c25,0x9e));var _0x55c2=function(_0x1378d8,_0x70eabd){_0x1378d8=_0x1378d8-0x0;var _0x445476=_0x5c25[_0x1378d8];return _0x445476;};'use strict';var _=require(_0x55c2('0x0'));var util=require(_0x55c2('0x1'));var logger=require(_0x55c2('0x2'))(_0x55c2('0x3'));var moment=require(_0x55c2('0x4'));var BPromise=require('bluebird');var rp=require(_0x55c2('0x5'));var fs=require('fs');var path=require(_0x55c2('0x6'));var rimraf=require(_0x55c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x55c2('0x8'));module[_0x55c2('0x9')]=function(_0x4bfd59,_0x19739e){return _0x4bfd59[_0x55c2('0xa')](_0x55c2('0xb'),attributes,{'tableName':_0x55c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 7ff9d72..9788aff 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x087a=['access_token','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/logger','api','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','push','data7','join','/.default','replace','{TENANT_ID}','data2','id_token','stringify','randomBytes','toString','hex','data1','response_type','redirect_uri','response_mode','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','POST','data5'];(function(_0x23493a,_0x295688){var _0x3a4322=function(_0x1fc11f){while(--_0x1fc11f){_0x23493a['push'](_0x23493a['shift']());}};_0x3a4322(++_0x295688);}(_0x087a,0x147));var _0xa087=function(_0x472c3e,_0x4f119e){_0x472c3e=_0x472c3e-0x0;var _0x3f8481=_0x087a[_0x472c3e];return _0x3f8481;};'use strict';var _=require(_0xa087('0x0'));var crypto=require(_0xa087('0x1'));var jwt=require(_0xa087('0x2'));var moment=require(_0xa087('0x3'));var Redis=require('ioredis');var rp=require(_0xa087('0x4'));var util=require(_0xa087('0x5'));var encryptor=require(_0xa087('0x6'));var config=require('../../config/environment');var logger=require(_0xa087('0x7'))(_0xa087('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xa087('0x9'))['db'];config['redis']=_[_0xa087('0xa')](config[_0xa087('0xb')],{'host':_0xa087('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa087('0xb')]);var MICROSOFT_AUTH_URL=_0xa087('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa087('0xe'),_0xa087('0xf'),'email','offline_access',_0xa087('0x10'),_0xa087('0x11'),_0xa087('0x12')],'Dynamics365':[_0xa087('0xe'),_0xa087('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0xa087('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xa087('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xcf3086){var _0x4bd4fe=_['map'](AZURE_AUTH_SCOPES[_0xcf3086[_0xa087('0x16')]]);if(_0xcf3086[_0xa087('0x16')]===_0xa087('0x17'))_0x4bd4fe[_0xa087('0x18')](_0xcf3086[_0xa087('0x19')]+'/.default');return _0x4bd4fe[_0xa087('0x1a')]('\x20');}function getAccessTokenScope(_0x356923){if(_0x356923[_0xa087('0x16')]==='Outlook365')return _0xa087('0x10');if(_0x356923[_0xa087('0x16')]===_0xa087('0x17'))return _0x356923[_0xa087('0x19')]+_0xa087('0x1b');}function generateMicrosoftAuthorizationUrl(_0x62909e,_0x59459e){var _0x29f406=MICROSOFT_AUTH_URL[_0xa087('0x1c')](_0xa087('0x1d'),_0x62909e[_0xa087('0x1e')]);var _0x1904b0=['code',_0xa087('0x1f')];var _0x3c3e36=Buffer['from'](JSON[_0xa087('0x20')]({'id':_0x59459e}))['toString']('base64');var _0x8277ed=crypto[_0xa087('0x21')](0x10)[_0xa087('0x22')](_0xa087('0x23'));var _0xdbb85f=getAuthorizationScopes(_0x62909e);var _0x4a7345=[{'key':'client_id','value':_0x62909e[_0xa087('0x24')]},{'key':_0xa087('0x25'),'value':encodeURIComponent(_0x1904b0[_0xa087('0x1a')]('\x20'))},{'key':_0xa087('0x26'),'value':_0x62909e['data4']},{'key':_0xa087('0x27'),'value':'form_post'},{'key':_0xa087('0x28'),'value':encodeURIComponent(_0xdbb85f)},{'key':_0xa087('0x29'),'value':_0x3c3e36},{'key':_0xa087('0x2a'),'value':_0x8277ed},{'key':_0xa087('0x2b'),'value':_0xa087('0x2c')}];var _0x21af1f=_0x29f406+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4a7345,function(_0x3475ed){return _0x3475ed[_0xa087('0x2d')]+'='+_0x3475ed[_0xa087('0x2e')];})[_0xa087('0x1a')]('&');_0x62909e[_0xa087('0x2f')]={'issuer':_0x29f406[_0xa087('0x1c')](_0xa087('0x30'),''),'audience':_0x62909e[_0xa087('0x24')],'state':_0x3c3e36,'nonce':_0x8277ed};redis[_0xa087('0x31')](_0x3c3e36,JSON[_0xa087('0x20')](_0x62909e));return _0x21af1f;}function isValidIdToken(_0x10e5cf,_0x373be3){try{var _0x36de6d=jwt[_0xa087('0x32')](_0x10e5cf,{'complete':!![]});var _0x349ae1=_0x36de6d[_0xa087('0x33')];if(_0x349ae1[_0xa087('0x34')]!==_0x373be3[_0xa087('0x35')])return![];if(_0x349ae1[_0xa087('0x36')]!==_0x373be3[_0xa087('0x37')])return![];if(_0x349ae1[_0xa087('0x2a')]!==_0x373be3['nonce'])return![];if(moment()['isAfter'](moment[_0xa087('0x38')](_0x349ae1['exp'])))return![];return!![];}catch(_0x352dd1){throw _0x352dd1;}}function refreshOauth2MicrosoftAccessToken(_0x301b14){return Promise[_0xa087('0x39')]()[_0xa087('0x3a')](function(){if(_0x301b14[_0xa087('0x3b')])return _0x301b14;return db[_0xa087('0x3c')][_0xa087('0x3d')]({'where':{'id':_0x301b14['id']},'raw':!![]});})['then'](function(_0x4a9e94){var _0x4bd620={'grant_type':_0xa087('0x3e'),'refresh_token':_0x4a9e94[_0xa087('0x3f')],'scope':getAccessTokenScope(_0x4a9e94),'redirect_uri':_0x4a9e94[_0xa087('0x40')],'client_id':_0x4a9e94[_0xa087('0x24')],'client_secret':encryptor[_0xa087('0x41')](_0x4a9e94[_0xa087('0x3b')])};var _0x13a9b9={'method':_0xa087('0x42'),'uri':MICROSOFT_AUTH_URL[_0xa087('0x1c')](_0xa087('0x1d'),_0x4a9e94[_0xa087('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4bd620,'json':!![]};return rp(_0x13a9b9);})[_0xa087('0x3a')](function(_0x10c89c){_0x301b14[_0xa087('0x43')]=_0x10c89c[_0xa087('0x44')];_0x301b14['data6']=_0x10c89c[_0xa087('0x3e')];return db[_0xa087('0x3c')]['update']({'data5':_0x301b14[_0xa087('0x43')],'data6':_0x301b14[_0xa087('0x3f')]},{'where':{'id':_0x301b14['id']}});})[_0xa087('0x3a')](function(){return _0x301b14;})['catch'](function(_0xd3b4d9){logger['error'](_0xa087('0x45'),_0x301b14['id'],_0xd3b4d9);});}function getOauth2MicrosoftAccessToken(_0x4cc957,_0x3f0eb3){var _0x6568b={'grant_type':_0xa087('0x46'),'code':_0x4cc957,'scope':getAccessTokenScope(_0x3f0eb3),'redirect_uri':_0x3f0eb3[_0xa087('0x40')],'client_id':_0x3f0eb3[_0xa087('0x24')],'client_secret':encryptor[_0xa087('0x41')](_0x3f0eb3['data3'])};var _0x2a7703={'method':_0xa087('0x42'),'uri':MICROSOFT_AUTH_URL[_0xa087('0x1c')](_0xa087('0x1d'),_0x3f0eb3[_0xa087('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6568b,'json':!![]};return rp(_0x2a7703);}function startRefreshInterval(_0x295bc8){var _0x3d0df7=schedule[_0xa087('0x47')];if(_0x3d0df7[_0x295bc8['id']])clearInterval(_0x3d0df7[_0x295bc8['id']]);_0x3d0df7[_0x295bc8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa087('0x48')](this,{'id':_0x295bc8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa087('0x47')]=_0x3d0df7;}function startAllRefreshIntervals(){return db[_0xa087('0x3c')][_0xa087('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x1f698e){var _0x1e78fb=_0x1f698e['map'](function(_0x24bb6d){return refreshOauth2MicrosoftAccessToken(_0x24bb6d)[_0xa087('0x3a')](function(_0x18ebad){startRefreshInterval(_0x18ebad);});});return Promise[_0xa087('0x4a')](_0x1e78fb);})[_0xa087('0x4b')](function(_0x37ecc7){var _0x81fa2e=_0x37ecc7?util[_0xa087('0x4c')](_0x37ecc7,{'showHidden':![],'depth':null}):'';logger['error'](_0xa087('0x4d'),_0x81fa2e);});}module[_0xa087('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9cc3=['inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','join','Dynamics365','replace','{TENANT_ID}','data2','id_token','stringify','toString','hex','client_id','response_type','response_mode','scope','state','nonce','prompt','key','value','oauth2Claims','oauth2/','data1','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data4','decryptString','POST','data5','access_token','data6','catch','error','authorization_code','intervals','findAll','map','all'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cc3,0xf6));var _0x39cc=function(_0x486b2e,_0x5b752a){_0x486b2e=_0x486b2e-0x0;var _0xe43bdd=_0x9cc3[_0x486b2e];return _0xe43bdd;};'use strict';var _=require('lodash');var crypto=require(_0x39cc('0x0'));var jwt=require(_0x39cc('0x1'));var moment=require(_0x39cc('0x2'));var Redis=require(_0x39cc('0x3'));var rp=require(_0x39cc('0x4'));var util=require(_0x39cc('0x5'));var encryptor=require(_0x39cc('0x6'));var config=require(_0x39cc('0x7'));var logger=require(_0x39cc('0x8'))(_0x39cc('0x9'));var schedule=require(_0x39cc('0xa'));var db=require(_0x39cc('0xb'))['db'];config['redis']=_[_0x39cc('0xc')](config[_0x39cc('0xd')],{'host':_0x39cc('0xe'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x39cc('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x39cc('0x10'),_0x39cc('0x11'),_0x39cc('0x12'),_0x39cc('0x13'),_0x39cc('0x14'),_0x39cc('0x15'),_0x39cc('0x16')],'Dynamics365':[_0x39cc('0x10'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x39cc('0x17');var MICROSOFT_TOKEN_ENDPOINT=_0x39cc('0x18');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3863b7){var _0x2c5e2f=_['map'](AZURE_AUTH_SCOPES[_0x3863b7['type']]);if(_0x3863b7[_0x39cc('0x19')]==='Dynamics365')_0x2c5e2f[_0x39cc('0x1a')](_0x3863b7[_0x39cc('0x1b')]+_0x39cc('0x1c'));return _0x2c5e2f[_0x39cc('0x1d')]('\x20');}function getAccessTokenScope(_0x10e9d0){if(_0x10e9d0[_0x39cc('0x19')]==='Outlook365')return _0x39cc('0x14');if(_0x10e9d0[_0x39cc('0x19')]===_0x39cc('0x1e'))return _0x10e9d0[_0x39cc('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5b618b,_0x5b1aa0){var _0x166b65=MICROSOFT_AUTH_URL[_0x39cc('0x1f')](_0x39cc('0x20'),_0x5b618b[_0x39cc('0x21')]);var _0x805058=['code',_0x39cc('0x22')];var _0x3331e8=Buffer['from'](JSON[_0x39cc('0x23')]({'id':_0x5b1aa0}))[_0x39cc('0x24')]('base64');var _0x4da815=crypto['randomBytes'](0x10)['toString'](_0x39cc('0x25'));var _0x5dd158=getAuthorizationScopes(_0x5b618b);var _0x16c0f1=[{'key':_0x39cc('0x26'),'value':_0x5b618b['data1']},{'key':_0x39cc('0x27'),'value':encodeURIComponent(_0x805058[_0x39cc('0x1d')]('\x20'))},{'key':'redirect_uri','value':_0x5b618b['data4']},{'key':_0x39cc('0x28'),'value':'form_post'},{'key':_0x39cc('0x29'),'value':encodeURIComponent(_0x5dd158)},{'key':_0x39cc('0x2a'),'value':_0x3331e8},{'key':_0x39cc('0x2b'),'value':_0x4da815},{'key':_0x39cc('0x2c'),'value':'login'}];var _0x2559b8=_0x166b65+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x16c0f1,function(_0x4bd133){return _0x4bd133[_0x39cc('0x2d')]+'='+_0x4bd133[_0x39cc('0x2e')];})[_0x39cc('0x1d')]('&');_0x5b618b[_0x39cc('0x2f')]={'issuer':_0x166b65['replace'](_0x39cc('0x30'),''),'audience':_0x5b618b[_0x39cc('0x31')],'state':_0x3331e8,'nonce':_0x4da815};redis['set'](_0x3331e8,JSON[_0x39cc('0x23')](_0x5b618b));return _0x2559b8;}function isValidIdToken(_0x31736a,_0x19370e){try{var _0x1bcee3=jwt[_0x39cc('0x32')](_0x31736a,{'complete':!![]});var _0x57c98c=_0x1bcee3[_0x39cc('0x33')];if(_0x57c98c[_0x39cc('0x34')]!==_0x19370e[_0x39cc('0x35')])return![];if(_0x57c98c[_0x39cc('0x36')]!==_0x19370e[_0x39cc('0x37')])return![];if(_0x57c98c[_0x39cc('0x2b')]!==_0x19370e['nonce'])return![];if(moment()[_0x39cc('0x38')](moment[_0x39cc('0x39')](_0x57c98c[_0x39cc('0x3a')])))return![];return!![];}catch(_0x5c4c02){throw _0x5c4c02;}}function refreshOauth2MicrosoftAccessToken(_0x5b1d8e){return Promise[_0x39cc('0x3b')]()[_0x39cc('0x3c')](function(){if(_0x5b1d8e[_0x39cc('0x3d')])return _0x5b1d8e;return db[_0x39cc('0x3e')][_0x39cc('0x3f')]({'where':{'id':_0x5b1d8e['id']},'raw':!![]});})[_0x39cc('0x3c')](function(_0x42eaf8){var _0x187c3e={'grant_type':_0x39cc('0x40'),'refresh_token':_0x42eaf8['data6'],'scope':getAccessTokenScope(_0x42eaf8),'redirect_uri':_0x42eaf8[_0x39cc('0x41')],'client_id':_0x42eaf8[_0x39cc('0x31')],'client_secret':encryptor[_0x39cc('0x42')](_0x42eaf8[_0x39cc('0x3d')])};var _0x132ae0={'method':_0x39cc('0x43'),'uri':MICROSOFT_AUTH_URL[_0x39cc('0x1f')]('{TENANT_ID}',_0x42eaf8[_0x39cc('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x187c3e,'json':!![]};return rp(_0x132ae0);})[_0x39cc('0x3c')](function(_0x36f37d){_0x5b1d8e[_0x39cc('0x44')]=_0x36f37d[_0x39cc('0x45')];_0x5b1d8e[_0x39cc('0x46')]=_0x36f37d['refresh_token'];return db[_0x39cc('0x3e')]['update']({'data5':_0x5b1d8e[_0x39cc('0x44')],'data6':_0x5b1d8e[_0x39cc('0x46')]},{'where':{'id':_0x5b1d8e['id']}});})[_0x39cc('0x3c')](function(){return _0x5b1d8e;})[_0x39cc('0x47')](function(_0x5d85d7){logger[_0x39cc('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5b1d8e['id'],_0x5d85d7);});}function getOauth2MicrosoftAccessToken(_0x1a3e97,_0x10c59f){var _0x368336={'grant_type':_0x39cc('0x49'),'code':_0x1a3e97,'scope':getAccessTokenScope(_0x10c59f),'redirect_uri':_0x10c59f[_0x39cc('0x41')],'client_id':_0x10c59f[_0x39cc('0x31')],'client_secret':encryptor[_0x39cc('0x42')](_0x10c59f[_0x39cc('0x3d')])};var _0x42290d={'method':_0x39cc('0x43'),'uri':MICROSOFT_AUTH_URL[_0x39cc('0x1f')]('{TENANT_ID}',_0x10c59f[_0x39cc('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x368336,'json':!![]};return rp(_0x42290d);}function startRefreshInterval(_0x26b582){var _0x56e6c2=schedule['intervals'];if(_0x56e6c2[_0x26b582['id']])clearInterval(_0x56e6c2[_0x26b582['id']]);_0x56e6c2[_0x26b582['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x26b582['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x39cc('0x4a')]=_0x56e6c2;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x39cc('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x558779){var _0x36a084=_0x558779[_0x39cc('0x4c')](function(_0x5279f4){return refreshOauth2MicrosoftAccessToken(_0x5279f4)['then'](function(_0x120f47){startRefreshInterval(_0x120f47);});});return Promise[_0x39cc('0x4d')](_0x36a084);})['catch'](function(_0x33d5b6){var _0x3cd737=_0x33d5b6?util[_0x39cc('0x4e')](_0x33d5b6,{'showHidden':![],'depth':null}):'';logger['error'](_0x39cc('0x4f'),_0x3cd737);});}module[_0x39cc('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 681359a..1162d3a 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 _0xfb11=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xfb11[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file +var _0x87bc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x87bc,0x189));var _0xc87b=function(_0x585c82,_0x3d5c40){_0x585c82=_0x585c82-0x0;var _0x26ddfa=_0x87bc[_0x585c82];return _0x26ddfa;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7eb16c3..11d8f75 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x171f29,_0x34d81a){var _0x557905=function(_0xc08fb4){while(--_0xc08fb4){_0x171f29['push'](_0x171f29['shift']());}};_0x557905(++_0x34d81a);}(_0x2ef3,0xba));var _0x32ef=function(_0x85f875,_0x36c2a0){_0x85f875=_0x85f875-0x0;var _0x1c37be=_0x2ef3[_0x85f875];return _0x1c37be;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c0fbb,_0x420492){_0x4c0fbb=_0x4c0fbb-0x0;var _0x462c3d=_0x5f2f[_0x4c0fbb];return _0x462c3d;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cff9d8d..d9d39c5 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 _0xc794=['name','exports','STRING'];(function(_0x438ec4,_0x5c5de3){var _0xc7bb37=function(_0xafe219){while(--_0xafe219){_0x438ec4['push'](_0x438ec4['shift']());}};_0xc7bb37(++_0x5c5de3);}(_0xc794,0x17b));var _0x4c79=function(_0x530e37,_0x11e459){_0x530e37=_0x530e37-0x0;var _0x4f1777=_0xc794[_0x530e37];return _0x4f1777;};'use strict';var Sequelize=require('sequelize');module[_0x4c79('0x0')]={'name':{'type':Sequelize[_0x4c79('0x1')],'unique':_0x4c79('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x4c79('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4c79('0x1')]},'fax':{'type':Sequelize[_0x4c79('0x1')]},'type':{'type':Sequelize[_0x4c79('0x1')]},'street':{'type':Sequelize[_0x4c79('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4c79('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4c79('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4c79('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c79('0x1')]}}; \ No newline at end of file +var _0xfdba=['sequelize','exports','STRING','name'];(function(_0x30bff4,_0x5d2581){var _0x14518d=function(_0x1e2998){while(--_0x1e2998){_0x30bff4['push'](_0x30bff4['shift']());}};_0x14518d(++_0x5d2581);}(_0xfdba,0xf4));var _0xafdb=function(_0x3cbff8,_0x33ab36){_0x3cbff8=_0x3cbff8-0x0;var _0x10e0e1=_0xfdba[_0x3cbff8];return _0x10e0e1;};'use strict';var Sequelize=require(_0xafdb('0x0'));module[_0xafdb('0x1')]={'name':{'type':Sequelize[_0xafdb('0x2')],'unique':_0xafdb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xafdb('0x2')]},'companyId':{'type':Sequelize[_0xafdb('0x2')]},'website':{'type':Sequelize[_0xafdb('0x2')]},'phone':{'type':Sequelize[_0xafdb('0x2')]},'fax':{'type':Sequelize[_0xafdb('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xafdb('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xafdb('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xafdb('0x2')]},'sStreet':{'type':Sequelize[_0xafdb('0x2')]},'sPostalCode':{'type':Sequelize[_0xafdb('0x2')]},'sCity':{'type':Sequelize[_0xafdb('0x2')]},'sCountry':{'type':Sequelize[_0xafdb('0x2')]},'description':{'type':Sequelize[_0xafdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 95aa263..29ac5ef 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 _0xb935=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','destroy','end','error','name','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','role','user','userProfileId','autoAssociation','UserProfileResource','describe','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xb935,0x1a9));var _0x5b93=function(_0x98148,_0x1eb9a3){_0x98148=_0x98148-0x0;var _0x51750d=_0xb935[_0x98148];return _0x51750d;};'use strict';var emlformat=require(_0x5b93('0x0'));var rimraf=require(_0x5b93('0x1'));var zipdir=require(_0x5b93('0x2'));var jsonpatch=require(_0x5b93('0x3'));var rp=require(_0x5b93('0x4'));var moment=require(_0x5b93('0x5'));var BPromise=require(_0x5b93('0x6'));var Mustache=require(_0x5b93('0x7'));var util=require(_0x5b93('0x8'));var path=require(_0x5b93('0x9'));var sox=require(_0x5b93('0xa'));var csv=require(_0x5b93('0xb'));var ejs=require(_0x5b93('0xc'));var fs=require('fs');var fs_extra=require(_0x5b93('0xd'));var _=require(_0x5b93('0xe'));var squel=require(_0x5b93('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b93('0x10'));var toCsv=require(_0x5b93('0xb'));var querystring=require(_0x5b93('0x11'));var Papa=require(_0x5b93('0x12'));var Redis=require(_0x5b93('0x13'));var authService=require(_0x5b93('0x14'));var qs=require(_0x5b93('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b93('0x16'));var logger=require(_0x5b93('0x17'))(_0x5b93('0x18'));var utils=require(_0x5b93('0x19'));var config=require(_0x5b93('0x1a'));var licenseUtil=require(_0x5b93('0x1b'));var db=require(_0x5b93('0x1c'))['db'];function respondWithStatusCode(_0x103452,_0xdf46fb){_0xdf46fb=_0xdf46fb||0xcc;return function(_0x1fa759){if(_0x1fa759){return _0x103452[_0x5b93('0x1d')](_0xdf46fb);}return _0x103452[_0x5b93('0x1e')](_0xdf46fb)['end']();};}function respondWithResult(_0x5f4ed7,_0x4ac9c5){_0x4ac9c5=_0x4ac9c5||0xc8;return function(_0x29dd71){if(_0x29dd71){return _0x5f4ed7['status'](_0x4ac9c5)['json'](_0x29dd71);}};}function respondWithFilteredResult(_0x4120ca,_0x8806f0){return function(_0x38d4bb){if(_0x38d4bb){var _0x7bfbc6=typeof _0x8806f0[_0x5b93('0x1f')]===_0x5b93('0x20')&&typeof _0x8806f0[_0x5b93('0x21')]===_0x5b93('0x20');var _0x15e336=_0x38d4bb[_0x5b93('0x22')];var _0x41f42c=_0x7bfbc6?0x0:_0x8806f0['offset'];var _0x25ef23=_0x7bfbc6?_0x38d4bb[_0x5b93('0x22')]:_0x8806f0[_0x5b93('0x1f')]+_0x8806f0[_0x5b93('0x21')];var _0x4facc1;if(_0x25ef23>=_0x15e336){_0x25ef23=_0x15e336;_0x4facc1=0xc8;}else{_0x4facc1=0xce;}_0x4120ca[_0x5b93('0x1e')](_0x4facc1);return _0x4120ca[_0x5b93('0x23')](_0x5b93('0x24'),_0x41f42c+'-'+_0x25ef23+'/'+_0x15e336)['json'](_0x38d4bb);}return null;};}function patchUpdates(_0x598d1e){return function(_0x29e9b3){try{jsonpatch[_0x5b93('0x25')](_0x29e9b3,_0x598d1e,!![]);}catch(_0x386ee6){return BPromise[_0x5b93('0x26')](_0x386ee6);}return _0x29e9b3[_0x5b93('0x27')]();};}function saveUpdates(_0x5a3f4c,_0x25f6c6){return function(_0x2bca47){if(_0x2bca47){return _0x2bca47[_0x5b93('0x28')](_0x5a3f4c)['then'](function(_0x51792){return _0x51792;});}return null;};}function removeEntity(_0x3ba9c7,_0x3bc956){return function(_0x232658){if(_0x232658){return _0x232658['destroy']()[_0x5b93('0x29')](function(){var _0x48d6ca=_0x232658[_0x5b93('0x2a')]({'plain':!![]});var _0x19001b=_0x5b93('0x2b');return db['UserProfileResource'][_0x5b93('0x2c')]({'where':{'type':_0x19001b,'resourceId':_0x48d6ca['id']}})['then'](function(){return _0x232658;});})[_0x5b93('0x29')](function(){_0x3ba9c7[_0x5b93('0x1e')](0xcc)[_0x5b93('0x2d')]();});}};}function handleEntityNotFound(_0x152007,_0x45593e){return function(_0x2cdf48){if(!_0x2cdf48){_0x152007[_0x5b93('0x1d')](0x194);}return _0x2cdf48;};}function handleError(_0x753117,_0x3e3017){_0x3e3017=_0x3e3017||0x1f4;return function(_0x2f01c7){logger[_0x5b93('0x2e')](_0x2f01c7['stack']);if(_0x2f01c7['name']){delete _0x2f01c7[_0x5b93('0x2f')];}_0x753117[_0x5b93('0x1e')](_0x3e3017)['send'](_0x2f01c7);};}exports[_0x5b93('0x30')]=function(_0x241bf6,_0x1d3ef7){var _0x43de1e={},_0x50d2ba={},_0xbfaf2e={'count':0x0,'rows':[]};return db[_0x5b93('0x31')]['describe']()[_0x5b93('0x29')](function(_0x457965){_0x50d2ba['model']=_[_0x5b93('0x32')](_0x457965);_0x50d2ba['query']=_[_0x5b93('0x32')](_0x241bf6[_0x5b93('0x33')]);_0x50d2ba[_0x5b93('0x34')]=_[_0x5b93('0x35')](_0x50d2ba[_0x5b93('0x36')],_0x50d2ba[_0x5b93('0x33')]);_0x43de1e[_0x5b93('0x37')]=_['intersection'](_0x50d2ba['model'],qs[_0x5b93('0x38')](_0x241bf6[_0x5b93('0x33')][_0x5b93('0x38')]));_0x43de1e[_0x5b93('0x37')]=_0x43de1e[_0x5b93('0x37')][_0x5b93('0x39')]?_0x43de1e['attributes']:_0x50d2ba[_0x5b93('0x36')];if(!_0x241bf6[_0x5b93('0x33')]['hasOwnProperty']('nolimit')){_0x43de1e[_0x5b93('0x21')]=qs['limit'](_0x241bf6[_0x5b93('0x33')][_0x5b93('0x21')]);_0x43de1e[_0x5b93('0x1f')]=qs[_0x5b93('0x1f')](_0x241bf6[_0x5b93('0x33')][_0x5b93('0x1f')]);}_0x43de1e[_0x5b93('0x3a')]=qs['sort'](_0x241bf6[_0x5b93('0x33')][_0x5b93('0x3b')]);_0x43de1e[_0x5b93('0x3c')]=qs['filters'](_[_0x5b93('0x3d')](_0x241bf6[_0x5b93('0x33')],_0x50d2ba['filters']),_0x457965);if(_0x241bf6[_0x5b93('0x33')][_0x5b93('0x3e')]){_0x43de1e[_0x5b93('0x3c')]=_[_0x5b93('0x3f')](_0x43de1e[_0x5b93('0x3c')],{'$or':_[_0x5b93('0x40')](_0x43de1e[_0x5b93('0x37')],function(_0x327148){var _0x49ce01={};_0x49ce01[_0x327148]={'$like':'%'+_0x241bf6[_0x5b93('0x33')]['filter']+'%'};return _0x49ce01;})});}_0x43de1e=_[_0x5b93('0x3f')]({},_0x43de1e,_0x241bf6[_0x5b93('0x41')]);var _0x1226a8={'where':_0x43de1e['where']};return db['CmCompany'][_0x5b93('0x22')](_0x1226a8)[_0x5b93('0x29')](function(_0x58c8ad){_0xbfaf2e[_0x5b93('0x22')]=_0x58c8ad;if(_0x241bf6[_0x5b93('0x33')][_0x5b93('0x42')]){_0x43de1e[_0x5b93('0x43')]=[{'all':!![]}];}return db[_0x5b93('0x31')][_0x5b93('0x44')](_0x43de1e);})['then'](function(_0x34d5f0){_0xbfaf2e['rows']=_0x34d5f0;return _0xbfaf2e;})[_0x5b93('0x29')](respondWithFilteredResult(_0x1d3ef7,_0x43de1e))[_0x5b93('0x45')](handleError(_0x1d3ef7,null));})[_0x5b93('0x45')](handleError(_0x1d3ef7,null));};exports[_0x5b93('0x46')]=function(_0x3da711,_0x2e1f1a){var _0x171195={'raw':![],'where':{'id':_0x3da711[_0x5b93('0x47')]['id']}},_0x216cd5={};_0x216cd5['model']=_[_0x5b93('0x32')](db[_0x5b93('0x31')][_0x5b93('0x48')]);_0x216cd5[_0x5b93('0x33')]=_[_0x5b93('0x32')](_0x3da711[_0x5b93('0x33')]);_0x216cd5[_0x5b93('0x34')]=_[_0x5b93('0x35')](_0x216cd5[_0x5b93('0x36')],_0x216cd5['query']);_0x171195[_0x5b93('0x37')]=_['intersection'](_0x216cd5[_0x5b93('0x36')],qs[_0x5b93('0x38')](_0x3da711[_0x5b93('0x33')][_0x5b93('0x38')]));_0x171195[_0x5b93('0x37')]=_0x171195[_0x5b93('0x37')]['length']?_0x171195['attributes']:_0x216cd5['model'];if(_0x3da711['query'][_0x5b93('0x42')]){_0x171195[_0x5b93('0x43')]=[{'all':!![]}];}_0x171195=_[_0x5b93('0x3f')]({},_0x171195,_0x3da711['options']);return db['CmCompany'][_0x5b93('0x49')](_0x171195)['then'](handleEntityNotFound(_0x2e1f1a,null))['then'](respondWithResult(_0x2e1f1a,null))[_0x5b93('0x45')](handleError(_0x2e1f1a,null));};exports['create']=function(_0x412c3f,_0x4341e9){return db[_0x5b93('0x31')][_0x5b93('0x4a')](_0x412c3f[_0x5b93('0x4b')],{})[_0x5b93('0x29')](function(_0x449f42){var _0xe34298=_0x412c3f['user'][_0x5b93('0x2a')]({'plain':!![]});if(!_0xe34298)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe34298[_0x5b93('0x4c')]===_0x5b93('0x4d')){var _0x3331cd=_0x449f42['get']({'plain':!![]});var _0x15c773=_0x5b93('0x2b');return db['UserProfileSection'][_0x5b93('0x49')]({'where':{'name':_0x15c773,'userProfileId':_0xe34298[_0x5b93('0x4e')]},'raw':!![]})['then'](function(_0x1dec18){if(_0x1dec18&&_0x1dec18[_0x5b93('0x4f')]===0x0){return db[_0x5b93('0x50')]['create']({'name':_0x3331cd['name'],'resourceId':_0x3331cd['id'],'type':_0x1dec18[_0x5b93('0x2f')],'sectionId':_0x1dec18['id']},{})['then'](function(){return _0x449f42;});}else{return _0x449f42;}})[_0x5b93('0x45')](function(_0x4fd5bd){logger[_0x5b93('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fd5bd);throw _0x4fd5bd;});}return _0x449f42;})[_0x5b93('0x29')](respondWithResult(_0x4341e9,0xc9))[_0x5b93('0x45')](handleError(_0x4341e9,null));};exports[_0x5b93('0x28')]=function(_0x13c887,_0x24c426){if(_0x13c887['body']['id']){delete _0x13c887['body']['id'];}return db['CmCompany'][_0x5b93('0x49')]({'where':{'id':_0x13c887[_0x5b93('0x47')]['id']}})[_0x5b93('0x29')](handleEntityNotFound(_0x24c426,null))[_0x5b93('0x29')](saveUpdates(_0x13c887['body'],null))[_0x5b93('0x29')](respondWithResult(_0x24c426,null))[_0x5b93('0x45')](handleError(_0x24c426,null));};exports[_0x5b93('0x2c')]=function(_0x48bbcf,_0xb4e655){return db[_0x5b93('0x31')][_0x5b93('0x49')]({'where':{'id':_0x48bbcf[_0x5b93('0x47')]['id']}})['then'](handleEntityNotFound(_0xb4e655,null))[_0x5b93('0x29')](removeEntity(_0xb4e655,null))[_0x5b93('0x45')](handleError(_0xb4e655,null));};exports[_0x5b93('0x51')]=function(_0x15694a,_0x21e860){return db[_0x5b93('0x31')][_0x5b93('0x51')]()[_0x5b93('0x29')](respondWithResult(_0x21e860,null))[_0x5b93('0x45')](handleError(_0x21e860,null));};exports[_0x5b93('0x52')]=function(_0x4c39c8,_0x36c740,_0x3a5ad6){return db[_0x5b93('0x53')][_0x5b93('0x49')]({'where':{'id':_0x4c39c8['params']['id']}})[_0x5b93('0x29')](handleEntityNotFound(_0x36c740,null))[_0x5b93('0x29')](function(_0x5ef024){if(_0x5ef024){return _0x5ef024[_0x5b93('0x52')](_0x4c39c8['body'][_0x5b93('0x54')],_[_0x5b93('0x55')](_0x4c39c8[_0x5b93('0x4b')],[_0x5b93('0x54'),'id'])||{});}})[_0x5b93('0x29')](respondWithResult(_0x36c740,null))[_0x5b93('0x45')](handleError(_0x36c740,null));};exports[_0x5b93('0x56')]=function(_0x3f9847,_0x23ea85,_0x28c3cd){var _0x594deb={};var _0x4ab2c9={};var _0x144621;var _0x1db251;return db[_0x5b93('0x31')][_0x5b93('0x57')]({'where':{'id':_0x3f9847[_0x5b93('0x47')]['id']}})[_0x5b93('0x29')](handleEntityNotFound(_0x23ea85,null))[_0x5b93('0x29')](function(_0x21ee7d){if(_0x21ee7d){_0x144621=_0x21ee7d;_0x4ab2c9[_0x5b93('0x36')]=_['keys'](db[_0x5b93('0x53')]['rawAttributes']);_0x4ab2c9[_0x5b93('0x33')]=_[_0x5b93('0x32')](_0x3f9847[_0x5b93('0x33')]);_0x4ab2c9['filters']=_[_0x5b93('0x35')](_0x4ab2c9[_0x5b93('0x36')],_0x4ab2c9['query']);_0x594deb[_0x5b93('0x37')]=_[_0x5b93('0x35')](_0x4ab2c9[_0x5b93('0x36')],qs[_0x5b93('0x38')](_0x3f9847[_0x5b93('0x33')]['fields']));_0x594deb['attributes']=_0x594deb['attributes'][_0x5b93('0x39')]?_0x594deb[_0x5b93('0x37')]:_0x4ab2c9[_0x5b93('0x36')];_0x594deb[_0x5b93('0x3a')]=qs[_0x5b93('0x3b')](_0x3f9847['query'][_0x5b93('0x3b')]);_0x594deb['where']=qs['filters'](_[_0x5b93('0x3d')](_0x3f9847['query'],_0x4ab2c9[_0x5b93('0x34')]));if(_0x3f9847[_0x5b93('0x33')][_0x5b93('0x3e')]){_0x594deb[_0x5b93('0x3c')]=_[_0x5b93('0x3f')](_0x594deb[_0x5b93('0x3c')],{'$or':_[_0x5b93('0x40')](_0x594deb[_0x5b93('0x37')],function(_0x554900){var _0x32a797={};_0x32a797[_0x554900]={'$like':'%'+_0x3f9847['query'][_0x5b93('0x3e')]+'%'};return _0x32a797;})});}_0x594deb=_[_0x5b93('0x3f')]({},_0x594deb,_0x3f9847[_0x5b93('0x41')]);return _0x144621[_0x5b93('0x56')](_0x594deb);}})[_0x5b93('0x29')](function(_0x510422){if(_0x510422){_0x1db251=_0x510422['length'];if(!_0x3f9847[_0x5b93('0x33')][_0x5b93('0x58')](_0x5b93('0x59'))){_0x594deb[_0x5b93('0x21')]=qs['limit'](_0x3f9847[_0x5b93('0x33')][_0x5b93('0x21')]);_0x594deb['offset']=qs[_0x5b93('0x1f')](_0x3f9847[_0x5b93('0x33')][_0x5b93('0x1f')]);}return _0x144621[_0x5b93('0x56')](_0x594deb);}})[_0x5b93('0x29')](function(_0x16c6f9){if(_0x16c6f9){return _0x16c6f9?{'count':_0x1db251,'rows':_0x16c6f9}:null;}})[_0x5b93('0x29')](respondWithResult(_0x23ea85,null))[_0x5b93('0x45')](handleError(_0x23ea85,null));}; \ No newline at end of file +var _0x7fd2=['sort','where','pick','merge','map','filter','options','includeAll','include','rows','catch','show','rawAttributes','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','params','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','Companies','UserProfileResource','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1c9818,_0x29688a){var _0x2a9b82=function(_0x4bd8ac){while(--_0x4bd8ac){_0x1c9818['push'](_0x1c9818['shift']());}};_0x2a9b82(++_0x29688a);}(_0x7fd2,0xcb));var _0x27fd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7fd2[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x27fd('0x0'));var rimraf=require(_0x27fd('0x1'));var zipdir=require(_0x27fd('0x2'));var jsonpatch=require(_0x27fd('0x3'));var rp=require(_0x27fd('0x4'));var moment=require(_0x27fd('0x5'));var BPromise=require(_0x27fd('0x6'));var Mustache=require('mustache');var util=require(_0x27fd('0x7'));var path=require(_0x27fd('0x8'));var sox=require('sox');var csv=require(_0x27fd('0x9'));var ejs=require(_0x27fd('0xa'));var fs=require('fs');var fs_extra=require(_0x27fd('0xb'));var _=require(_0x27fd('0xc'));var squel=require(_0x27fd('0xd'));var crypto=require(_0x27fd('0xe'));var jsforce=require(_0x27fd('0xf'));var deskjs=require(_0x27fd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x27fd('0x11'));var Papa=require(_0x27fd('0x12'));var Redis=require(_0x27fd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x27fd('0x14'));var hardwareService=require(_0x27fd('0x15'));var logger=require(_0x27fd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x27fd('0x17'));var licenseUtil=require(_0x27fd('0x18'));var db=require(_0x27fd('0x19'))['db'];function respondWithStatusCode(_0x3f2e5a,_0x16e225){_0x16e225=_0x16e225||0xcc;return function(_0x2b1b32){if(_0x2b1b32){return _0x3f2e5a[_0x27fd('0x1a')](_0x16e225);}return _0x3f2e5a[_0x27fd('0x1b')](_0x16e225)[_0x27fd('0x1c')]();};}function respondWithResult(_0x5c1bcf,_0x368405){_0x368405=_0x368405||0xc8;return function(_0x546727){if(_0x546727){return _0x5c1bcf['status'](_0x368405)[_0x27fd('0x1d')](_0x546727);}};}function respondWithFilteredResult(_0x52e215,_0x1c7501){return function(_0x1e4a67){if(_0x1e4a67){var _0x56b7da=typeof _0x1c7501[_0x27fd('0x1e')]===_0x27fd('0x1f')&&typeof _0x1c7501['limit']===_0x27fd('0x1f');var _0x1ceb72=_0x1e4a67['count'];var _0x525e07=_0x56b7da?0x0:_0x1c7501[_0x27fd('0x1e')];var _0x39629c=_0x56b7da?_0x1e4a67[_0x27fd('0x20')]:_0x1c7501['offset']+_0x1c7501[_0x27fd('0x21')];var _0x3f888e;if(_0x39629c>=_0x1ceb72){_0x39629c=_0x1ceb72;_0x3f888e=0xc8;}else{_0x3f888e=0xce;}_0x52e215[_0x27fd('0x1b')](_0x3f888e);return _0x52e215[_0x27fd('0x22')](_0x27fd('0x23'),_0x525e07+'-'+_0x39629c+'/'+_0x1ceb72)[_0x27fd('0x1d')](_0x1e4a67);}return null;};}function patchUpdates(_0x3d270c){return function(_0x4e3f3a){try{jsonpatch['apply'](_0x4e3f3a,_0x3d270c,!![]);}catch(_0x23ba8b){return BPromise['reject'](_0x23ba8b);}return _0x4e3f3a['save']();};}function saveUpdates(_0x381907,_0x264782){return function(_0x297742){if(_0x297742){return _0x297742[_0x27fd('0x24')](_0x381907)['then'](function(_0x1a63ab){return _0x1a63ab;});}return null;};}function removeEntity(_0x573a1e,_0x2b9e06){return function(_0x34c6b9){if(_0x34c6b9){return _0x34c6b9[_0x27fd('0x25')]()[_0x27fd('0x26')](function(){var _0x5ccba3=_0x34c6b9['get']({'plain':!![]});var _0x421146=_0x27fd('0x27');return db[_0x27fd('0x28')][_0x27fd('0x25')]({'where':{'type':_0x421146,'resourceId':_0x5ccba3['id']}})[_0x27fd('0x26')](function(){return _0x34c6b9;});})[_0x27fd('0x26')](function(){_0x573a1e[_0x27fd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbad5b3,_0x413637){return function(_0x3acea4){if(!_0x3acea4){_0xbad5b3[_0x27fd('0x1a')](0x194);}return _0x3acea4;};}function handleError(_0x46106e,_0x52b576){_0x52b576=_0x52b576||0x1f4;return function(_0x562252){logger['error'](_0x562252[_0x27fd('0x29')]);if(_0x562252[_0x27fd('0x2a')]){delete _0x562252[_0x27fd('0x2a')];}_0x46106e[_0x27fd('0x1b')](_0x52b576)['send'](_0x562252);};}exports[_0x27fd('0x2b')]=function(_0x1b026c,_0x2289f5){var _0x4b2e0a={},_0x5034e2={},_0x37b91b={'count':0x0,'rows':[]};return db[_0x27fd('0x2c')][_0x27fd('0x2d')]()[_0x27fd('0x26')](function(_0x338e47){_0x5034e2[_0x27fd('0x2e')]=_[_0x27fd('0x2f')](_0x338e47);_0x5034e2[_0x27fd('0x30')]=_[_0x27fd('0x2f')](_0x1b026c[_0x27fd('0x30')]);_0x5034e2[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x5034e2[_0x27fd('0x2e')],_0x5034e2['query']);_0x4b2e0a[_0x27fd('0x33')]=_['intersection'](_0x5034e2['model'],qs['fields'](_0x1b026c[_0x27fd('0x30')][_0x27fd('0x34')]));_0x4b2e0a[_0x27fd('0x33')]=_0x4b2e0a[_0x27fd('0x33')][_0x27fd('0x35')]?_0x4b2e0a['attributes']:_0x5034e2['model'];if(!_0x1b026c['query']['hasOwnProperty'](_0x27fd('0x36'))){_0x4b2e0a['limit']=qs[_0x27fd('0x21')](_0x1b026c['query'][_0x27fd('0x21')]);_0x4b2e0a['offset']=qs[_0x27fd('0x1e')](_0x1b026c[_0x27fd('0x30')][_0x27fd('0x1e')]);}_0x4b2e0a['order']=qs['sort'](_0x1b026c['query'][_0x27fd('0x37')]);_0x4b2e0a[_0x27fd('0x38')]=qs['filters'](_[_0x27fd('0x39')](_0x1b026c[_0x27fd('0x30')],_0x5034e2[_0x27fd('0x31')]),_0x338e47);if(_0x1b026c['query']['filter']){_0x4b2e0a[_0x27fd('0x38')]=_[_0x27fd('0x3a')](_0x4b2e0a[_0x27fd('0x38')],{'$or':_[_0x27fd('0x3b')](_0x4b2e0a[_0x27fd('0x33')],function(_0x2a9db9){var _0x50bf32={};_0x50bf32[_0x2a9db9]={'$like':'%'+_0x1b026c['query'][_0x27fd('0x3c')]+'%'};return _0x50bf32;})});}_0x4b2e0a=_[_0x27fd('0x3a')]({},_0x4b2e0a,_0x1b026c[_0x27fd('0x3d')]);var _0x45af30={'where':_0x4b2e0a[_0x27fd('0x38')]};return db[_0x27fd('0x2c')][_0x27fd('0x20')](_0x45af30)['then'](function(_0x3a3997){_0x37b91b[_0x27fd('0x20')]=_0x3a3997;if(_0x1b026c['query'][_0x27fd('0x3e')]){_0x4b2e0a[_0x27fd('0x3f')]=[{'all':!![]}];}return db[_0x27fd('0x2c')]['findAll'](_0x4b2e0a);})[_0x27fd('0x26')](function(_0x565c7e){_0x37b91b[_0x27fd('0x40')]=_0x565c7e;return _0x37b91b;})['then'](respondWithFilteredResult(_0x2289f5,_0x4b2e0a))[_0x27fd('0x41')](handleError(_0x2289f5,null));})[_0x27fd('0x41')](handleError(_0x2289f5,null));};exports[_0x27fd('0x42')]=function(_0x44c2cc,_0x20c12d){var _0x37cf71={'raw':![],'where':{'id':_0x44c2cc['params']['id']}},_0x23dc66={};_0x23dc66['model']=_[_0x27fd('0x2f')](db['CmCompany'][_0x27fd('0x43')]);_0x23dc66['query']=_[_0x27fd('0x2f')](_0x44c2cc[_0x27fd('0x30')]);_0x23dc66[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x23dc66[_0x27fd('0x2e')],_0x23dc66['query']);_0x37cf71[_0x27fd('0x33')]=_[_0x27fd('0x32')](_0x23dc66[_0x27fd('0x2e')],qs[_0x27fd('0x34')](_0x44c2cc[_0x27fd('0x30')][_0x27fd('0x34')]));_0x37cf71[_0x27fd('0x33')]=_0x37cf71[_0x27fd('0x33')][_0x27fd('0x35')]?_0x37cf71[_0x27fd('0x33')]:_0x23dc66[_0x27fd('0x2e')];if(_0x44c2cc[_0x27fd('0x30')][_0x27fd('0x3e')]){_0x37cf71[_0x27fd('0x3f')]=[{'all':!![]}];}_0x37cf71=_['merge']({},_0x37cf71,_0x44c2cc['options']);return db[_0x27fd('0x2c')]['find'](_0x37cf71)[_0x27fd('0x26')](handleEntityNotFound(_0x20c12d,null))['then'](respondWithResult(_0x20c12d,null))[_0x27fd('0x41')](handleError(_0x20c12d,null));};exports[_0x27fd('0x44')]=function(_0x539d54,_0x345ea8){return db[_0x27fd('0x2c')][_0x27fd('0x44')](_0x539d54[_0x27fd('0x45')],{})[_0x27fd('0x26')](function(_0x5b6532){var _0x38f2a3=_0x539d54[_0x27fd('0x46')][_0x27fd('0x47')]({'plain':!![]});if(!_0x38f2a3)throw new Error(_0x27fd('0x48'));if(_0x38f2a3[_0x27fd('0x49')]===_0x27fd('0x46')){var _0x29c69c=_0x5b6532[_0x27fd('0x47')]({'plain':!![]});var _0x362a94=_0x27fd('0x27');return db['UserProfileSection'][_0x27fd('0x4a')]({'where':{'name':_0x362a94,'userProfileId':_0x38f2a3[_0x27fd('0x4b')]},'raw':!![]})['then'](function(_0x2e5906){if(_0x2e5906&&_0x2e5906[_0x27fd('0x4c')]===0x0){return db[_0x27fd('0x28')][_0x27fd('0x44')]({'name':_0x29c69c[_0x27fd('0x2a')],'resourceId':_0x29c69c['id'],'type':_0x2e5906[_0x27fd('0x2a')],'sectionId':_0x2e5906['id']},{})['then'](function(){return _0x5b6532;});}else{return _0x5b6532;}})[_0x27fd('0x41')](function(_0x2fbe37){logger['error'](_0x27fd('0x4d'),_0x2fbe37);throw _0x2fbe37;});}return _0x5b6532;})[_0x27fd('0x26')](respondWithResult(_0x345ea8,0xc9))[_0x27fd('0x41')](handleError(_0x345ea8,null));};exports[_0x27fd('0x24')]=function(_0x119af6,_0x309f07){if(_0x119af6['body']['id']){delete _0x119af6[_0x27fd('0x45')]['id'];}return db[_0x27fd('0x2c')][_0x27fd('0x4a')]({'where':{'id':_0x119af6[_0x27fd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x309f07,null))[_0x27fd('0x26')](saveUpdates(_0x119af6['body'],null))[_0x27fd('0x26')](respondWithResult(_0x309f07,null))[_0x27fd('0x41')](handleError(_0x309f07,null));};exports[_0x27fd('0x25')]=function(_0x424e7c,_0x18e9a6){return db[_0x27fd('0x2c')]['find']({'where':{'id':_0x424e7c['params']['id']}})[_0x27fd('0x26')](handleEntityNotFound(_0x18e9a6,null))['then'](removeEntity(_0x18e9a6,null))[_0x27fd('0x41')](handleError(_0x18e9a6,null));};exports[_0x27fd('0x2d')]=function(_0x5a96e1,_0x24a9f6){return db[_0x27fd('0x2c')][_0x27fd('0x2d')]()[_0x27fd('0x26')](respondWithResult(_0x24a9f6,null))[_0x27fd('0x41')](handleError(_0x24a9f6,null));};exports[_0x27fd('0x4f')]=function(_0x1cbce1,_0x1dfa48,_0x144594){return db[_0x27fd('0x50')][_0x27fd('0x4a')]({'where':{'id':_0x1cbce1[_0x27fd('0x4e')]['id']}})[_0x27fd('0x26')](handleEntityNotFound(_0x1dfa48,null))[_0x27fd('0x26')](function(_0x2644f1){if(_0x2644f1){return _0x2644f1[_0x27fd('0x4f')](_0x1cbce1[_0x27fd('0x45')][_0x27fd('0x51')],_[_0x27fd('0x52')](_0x1cbce1['body'],['ids','id'])||{});}})[_0x27fd('0x26')](respondWithResult(_0x1dfa48,null))[_0x27fd('0x41')](handleError(_0x1dfa48,null));};exports[_0x27fd('0x53')]=function(_0xa26b1c,_0x222e8d,_0x43d344){var _0x560005={};var _0x126ac0={};var _0x7d0f1;var _0x5e0dc5;return db['CmCompany'][_0x27fd('0x54')]({'where':{'id':_0xa26b1c[_0x27fd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x222e8d,null))[_0x27fd('0x26')](function(_0x2fcf8e){if(_0x2fcf8e){_0x7d0f1=_0x2fcf8e;_0x126ac0[_0x27fd('0x2e')]=_['keys'](db[_0x27fd('0x50')]['rawAttributes']);_0x126ac0[_0x27fd('0x30')]=_[_0x27fd('0x2f')](_0xa26b1c[_0x27fd('0x30')]);_0x126ac0[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x126ac0[_0x27fd('0x2e')],_0x126ac0[_0x27fd('0x30')]);_0x560005[_0x27fd('0x33')]=_[_0x27fd('0x32')](_0x126ac0['model'],qs[_0x27fd('0x34')](_0xa26b1c[_0x27fd('0x30')]['fields']));_0x560005[_0x27fd('0x33')]=_0x560005['attributes'][_0x27fd('0x35')]?_0x560005['attributes']:_0x126ac0[_0x27fd('0x2e')];_0x560005['order']=qs[_0x27fd('0x37')](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x37')]);_0x560005[_0x27fd('0x38')]=qs[_0x27fd('0x31')](_[_0x27fd('0x39')](_0xa26b1c[_0x27fd('0x30')],_0x126ac0[_0x27fd('0x31')]));if(_0xa26b1c[_0x27fd('0x30')]['filter']){_0x560005[_0x27fd('0x38')]=_[_0x27fd('0x3a')](_0x560005['where'],{'$or':_[_0x27fd('0x3b')](_0x560005[_0x27fd('0x33')],function(_0x425aed){var _0x44bbfa={};_0x44bbfa[_0x425aed]={'$like':'%'+_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x3c')]+'%'};return _0x44bbfa;})});}_0x560005=_[_0x27fd('0x3a')]({},_0x560005,_0xa26b1c[_0x27fd('0x3d')]);return _0x7d0f1[_0x27fd('0x53')](_0x560005);}})[_0x27fd('0x26')](function(_0x30ebe2){if(_0x30ebe2){_0x5e0dc5=_0x30ebe2['length'];if(!_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x55')](_0x27fd('0x36'))){_0x560005[_0x27fd('0x21')]=qs[_0x27fd('0x21')](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x21')]);_0x560005[_0x27fd('0x1e')]=qs['offset'](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x1e')]);}return _0x7d0f1[_0x27fd('0x53')](_0x560005);}})['then'](function(_0x396b4c){if(_0x396b4c){return _0x396b4c?{'count':_0x5e0dc5,'rows':_0x396b4c}:null;}})[_0x27fd('0x26')](respondWithResult(_0x222e8d,null))[_0x27fd('0x41')](handleError(_0x222e8d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index eb9b51b..f730a08 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 _0x4e68=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_companies','lodash','util','../../config/logger','api'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4e68,0xd4));var _0x84e6=function(_0x2937d4,_0x3b5932){_0x2937d4=_0x2937d4-0x0;var _0x8917b9=_0x4e68[_0x2937d4];return _0x8917b9;};'use strict';var _=require(_0x84e6('0x0'));var util=require(_0x84e6('0x1'));var logger=require(_0x84e6('0x2'))(_0x84e6('0x3'));var moment=require(_0x84e6('0x4'));var BPromise=require(_0x84e6('0x5'));var rp=require(_0x84e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84e6('0x7'));var config=require(_0x84e6('0x8'));var attributes=require('./cmCompany.attributes');module[_0x84e6('0x9')]=function(_0x4534ac,_0x1be97d){return _0x4534ac[_0x84e6('0xa')]('CmCompany',attributes,{'tableName':_0x84e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb202=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x56801d,_0x4a7cef){var _0x4d7a9a=function(_0x34f06b){while(--_0x34f06b){_0x56801d['push'](_0x56801d['shift']());}};_0x4d7a9a(++_0x4a7cef);}(_0xb202,0x77));var _0x2b20=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb202[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require(_0x2b20('0x0'));var logger=require(_0x2b20('0x1'))(_0x2b20('0x2'));var moment=require(_0x2b20('0x3'));var BPromise=require(_0x2b20('0x4'));var rp=require(_0x2b20('0x5'));var fs=require('fs');var path=require(_0x2b20('0x6'));var rimraf=require(_0x2b20('0x7'));var config=require(_0x2b20('0x8'));var attributes=require('./cmCompany.attributes');module[_0x2b20('0x9')]=function(_0x401ce8,_0x47f5a8){return _0x401ce8[_0x2b20('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 6da21cc..f9103b8 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 _0xf9a3=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0xf9a3,0x16d));var _0x3f9a=function(_0x19a64d,_0x2159bd){_0x19a64d=_0x19a64d-0x0;var _0x10e885=_0xf9a3[_0x19a64d];return _0x10e885;};'use strict';var _=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var moment=require(_0x3f9a('0x2'));var BPromise=require(_0x3f9a('0x3'));var rs=require(_0x3f9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f9a('0x5'));var logger=require(_0x3f9a('0x6'))(_0x3f9a('0x7'));var config=require(_0x3f9a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526865,_0x2e974b,_0x1b5fd4){return new BPromise(function(_0x220698,_0x43e9c7){return client[_0x3f9a('0xa')](_0x526865,_0x1b5fd4)[_0x3f9a('0xb')](function(_0x5e0b53){logger[_0x3f9a('0xc')](_0x3f9a('0xd'),_0x2e974b,_0x3f9a('0xe'));logger[_0x3f9a('0xf')](_0x3f9a('0x10'),_0x2e974b,_0x3f9a('0xe'),JSON[_0x3f9a('0x11')](_0x5e0b53));if(_0x5e0b53['error']){if(_0x5e0b53[_0x3f9a('0x12')][_0x3f9a('0x13')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x2e974b,_0x5e0b53[_0x3f9a('0x12')]['message']);return _0x43e9c7(_0x5e0b53[_0x3f9a('0x12')]['message']);}logger[_0x3f9a('0x12')](_0x3f9a('0xd'),_0x2e974b,_0x5e0b53['error'][_0x3f9a('0x14')]);return _0x220698(_0x5e0b53[_0x3f9a('0x12')]['message']);}else{logger[_0x3f9a('0xc')](_0x3f9a('0xd'),_0x2e974b,_0x3f9a('0xe'));_0x220698(_0x5e0b53['result']['message']);}})[_0x3f9a('0x15')](function(_0x4652a2){logger[_0x3f9a('0x12')](_0x3f9a('0xd'),_0x2e974b,_0x4652a2);_0x43e9c7(_0x4652a2);});});} \ No newline at end of file +var _0x00c6=['error','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x00c6,0x1a8));var _0x600c=function(_0x23d923,_0x2850db){_0x23d923=_0x23d923-0x0;var _0x469b7e=_0x00c6[_0x23d923];return _0x469b7e;};'use strict';var _=require(_0x600c('0x0'));var util=require('util');var moment=require(_0x600c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x600c('0x2'));var db=require(_0x600c('0x3'))['db'];var utils=require(_0x600c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x600c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x600c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593221,_0x2c048c,_0x539001){return new BPromise(function(_0x268221,_0x2a7df7){return client[_0x600c('0x7')](_0x593221,_0x539001)['then'](function(_0x20514a){logger['info'](_0x600c('0x8'),_0x2c048c,_0x600c('0x9'));logger[_0x600c('0xa')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2c048c,_0x600c('0x9'),JSON['stringify'](_0x20514a));if(_0x20514a[_0x600c('0xb')]){if(_0x20514a[_0x600c('0xb')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x2c048c,_0x20514a[_0x600c('0xb')]['message']);return _0x2a7df7(_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);}logger[_0x600c('0xb')](_0x600c('0x8'),_0x2c048c,_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);return _0x268221(_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);}else{logger[_0x600c('0xd')](_0x600c('0x8'),_0x2c048c,_0x600c('0x9'));_0x268221(_0x20514a['result'][_0x600c('0xc')]);}})[_0x600c('0xe')](function(_0xa4e625){logger[_0x600c('0xb')]('CmCompany,\x20%s,\x20%s',_0x2c048c,_0xa4e625);_0x2a7df7(_0xa4e625);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 93b76a9..8735013 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 _0x3366=['post','addContacts','put','update','delete','exports','multer','connect-timeout','express','Router','../../config/environment','./cmCompany.controller','isAuthenticated','/describe','get','/:id','show','/:id/contacts','getContacts'];(function(_0x74296,_0x113859){var _0x54497a=function(_0x2fe685){while(--_0x2fe685){_0x74296['push'](_0x74296['shift']());}};_0x54497a(++_0x113859);}(_0x3366,0x15c));var _0x6336=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x3366[_0x9be28f];return _0xa9f52d;};'use strict';var multer=require(_0x6336('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6336('0x1'));var express=require(_0x6336('0x2'));var router=express[_0x6336('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6336('0x4'));var controller=require(_0x6336('0x5'));router['get']('/',auth[_0x6336('0x6')](),controller['index']);router['get'](_0x6336('0x7'),auth[_0x6336('0x6')](),controller['describe']);router[_0x6336('0x8')](_0x6336('0x9'),auth[_0x6336('0x6')](),controller[_0x6336('0xa')]);router[_0x6336('0x8')](_0x6336('0xb'),auth[_0x6336('0x6')](),controller[_0x6336('0xc')]);router[_0x6336('0xd')]('/',auth[_0x6336('0x6')](),controller['create']);router[_0x6336('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x6336('0xe')]);router[_0x6336('0xf')](_0x6336('0x9'),auth['isAuthenticated'](),controller[_0x6336('0x10')]);router[_0x6336('0x11')]('/:id',auth[_0x6336('0x6')](),controller['destroy']);module[_0x6336('0x12')]=router; \ No newline at end of file +var _0x4d63=['/:id/contacts','post','create','addContacts','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4b7730,_0x160b00){var _0x4f0285=function(_0xd1b8e1){while(--_0xd1b8e1){_0x4b7730['push'](_0x4b7730['shift']());}};_0x4f0285(++_0x160b00);}(_0x4d63,0xee));var _0x34d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d63[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x34d6('0x0'));var util=require('util');var path=require(_0x34d6('0x1'));var timeout=require('connect-timeout');var express=require(_0x34d6('0x2'));var router=express[_0x34d6('0x3')]();var fs_extra=require(_0x34d6('0x4'));var auth=require(_0x34d6('0x5'));var interaction=require(_0x34d6('0x6'));var config=require(_0x34d6('0x7'));var controller=require(_0x34d6('0x8'));router[_0x34d6('0x9')]('/',auth[_0x34d6('0xa')](),controller[_0x34d6('0xb')]);router[_0x34d6('0x9')](_0x34d6('0xc'),auth[_0x34d6('0xa')](),controller['describe']);router[_0x34d6('0x9')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0xe')]);router[_0x34d6('0x9')](_0x34d6('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0x34d6('0x10')]('/',auth[_0x34d6('0xa')](),controller[_0x34d6('0x11')]);router[_0x34d6('0x10')](_0x34d6('0xf'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x12')]);router[_0x34d6('0x13')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x14')]);router[_0x34d6('0x15')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3a0062a..dcfb0de 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 _0xb1a9=['STRING','INTEGER','DATE','NOW','sequelize','exports'];(function(_0x577a6d,_0x2dde1){var _0x777ba3=function(_0xac806f){while(--_0xac806f){_0x577a6d['push'](_0x577a6d['shift']());}};_0x777ba3(++_0x2dde1);}(_0xb1a9,0x178));var _0x9b1a=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xb1a9[_0xbc1a4b];return _0x108b87;};'use strict';var _=require('lodash');var Sequelize=require(_0x9b1a('0x0'));module[_0x9b1a('0x1')]={'firstName':{'type':Sequelize[_0x9b1a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9b1a('0x2')]},'street':{'type':Sequelize[_0x9b1a('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9b1a('0x2')]},'country':{'type':Sequelize[_0x9b1a('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9b1a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x9b1a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9b1a('0x2')]},'email':{'type':Sequelize[_0x9b1a('0x2')]},'url':{'type':Sequelize[_0x9b1a('0x2')]},'facebook':{'type':Sequelize[_0x9b1a('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9b1a('0x2')]},'skype':{'type':Sequelize[_0x9b1a('0x2')]},'teams':{'type':Sequelize[_0x9b1a('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x9b1a('0x2')]},'wechat':{'type':Sequelize[_0x9b1a('0x2')]},'telegram':{'type':Sequelize[_0x9b1a('0x2')]},'UserId':{'type':Sequelize[_0x9b1a('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x9b1a('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9b1a('0x4')],'defaultValue':Sequelize[_0x9b1a('0x5')]},'dialTimezone':{'type':Sequelize[_0x9b1a('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd0a9=['INTEGER','UNSIGNED','DATE','lodash','sequelize','STRING','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd0a9,0x15a));var _0x9d0a=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xd0a9[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x9d0a('0x0'));var Sequelize=require(_0x9d0a('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x9d0a('0x2')]},'street':{'type':Sequelize[_0x9d0a('0x2')]},'postalCode':{'type':Sequelize[_0x9d0a('0x2')]},'city':{'type':Sequelize[_0x9d0a('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d0a('0x3')]},'phone':{'type':Sequelize[_0x9d0a('0x2')]},'mobile':{'type':Sequelize[_0x9d0a('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9d0a('0x2')]},'url':{'type':Sequelize[_0x9d0a('0x2')]},'facebook':{'type':Sequelize[_0x9d0a('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9d0a('0x2')]},'skype':{'type':Sequelize[_0x9d0a('0x2')]},'teams':{'type':Sequelize[_0x9d0a('0x2')]},'viber':{'type':Sequelize[_0x9d0a('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x9d0a('0x2')]},'telegram':{'type':Sequelize[_0x9d0a('0x2')]},'UserId':{'type':Sequelize[_0x9d0a('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9d0a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9d0a('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x9d0a('0x2')]},'utcOffset':{'type':Sequelize[_0x9d0a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index cd8790f..66bffc8 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 _0xb2cb=['from','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','$or','spread','contact','Tag','color','ContactItemType','literal','Phones.OrderBy','$and','format','cf_%d','omit','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','pick','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','CmHopper','item','PHONE','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','options','rows','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','pid','upload','createReadStream','parse','meta','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','fax','whatsapp','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','starttime','endtime','duration','note','userThirdDisposition','UserId','fullname','createdAt','VoiceCallReport','findAndCountAll','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','deviceModel','osName','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','sortBy','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','CmCustomField','findOne','trimStart','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','select','field','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','text','start','end','map','hasOwnProperty','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','forEach','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','c.ListId\x20IS\x20NULL','toString','sequelize','merge','c.firstName','c.lastName','c.phone','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','Tags','TagIds','catch','params','tags','columnName','displayName','alias','custom','values','findAll','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0xb2cb,0xa2));var _0xbb2c=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xb2cb[_0x172948];return _0x4aeaa9;};'use strict';var moment=require(_0xbb2c('0x0'));var BPromise=require(_0xbb2c('0x1'));var util=require(_0xbb2c('0x2'));var path=require(_0xbb2c('0x3'));var fs=require('fs');var _=require(_0xbb2c('0x4'));var squel=require(_0xbb2c('0x5'));var Papa=require(_0xbb2c('0x6'));var Redis=require(_0xbb2c('0x7'));var qs=require(_0xbb2c('0x8'));var as=require(_0xbb2c('0x9'));var logger=require('../../config/logger')(_0xbb2c('0xa'));var config=require(_0xbb2c('0xb'));var shared=require(_0xbb2c('0xc'));var db=require(_0xbb2c('0xd'))['db'];config[_0xbb2c('0xe')]=_[_0xbb2c('0xf')](config['redis'],{'host':_0xbb2c('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb2c('0xe')]));require('./cmContact.socket')[_0xbb2c('0x11')](socket);function respondWithResult(_0x2749d3,_0x4cce4b){_0x4cce4b=_0x4cce4b||0xc8;return function(_0x5ed0d6){if(_0x5ed0d6){return _0x2749d3[_0xbb2c('0x12')](_0x4cce4b)[_0xbb2c('0x13')](_0x5ed0d6);}};}function respondWithFilteredResult(_0x576659,_0x52195f){return function(_0x5a034f){if(_0x5a034f){var _0x285231=typeof _0x52195f[_0xbb2c('0x14')]===_0xbb2c('0x15')&&typeof _0x52195f[_0xbb2c('0x16')]===_0xbb2c('0x15');var _0x297857=_0x5a034f[_0xbb2c('0x17')];var _0x370d13=_0x285231?0x0:_0x52195f['offset'];var _0x2adbe2=_0x285231?_0x5a034f[_0xbb2c('0x17')]:_0x52195f[_0xbb2c('0x14')]+_0x52195f['limit'];var _0x291b7d;if(_0x2adbe2>=_0x297857){_0x2adbe2=_0x297857;_0x291b7d=0xc8;}else{_0x291b7d=0xce;}_0x576659['status'](_0x291b7d);return _0x576659[_0xbb2c('0x18')](_0xbb2c('0x19'),_0x370d13+'-'+_0x2adbe2+'/'+_0x297857)[_0xbb2c('0x13')](_0x5a034f);}return null;};}function saveUpdates(_0x51b088){return function(_0x9d1bf1){if(_0x9d1bf1){return _0x9d1bf1[_0xbb2c('0x1a')](_0x51b088)[_0xbb2c('0x1b')](function(_0x2667ff){return _0x2667ff;});}return null;};}function removeEntity(_0x10c77d){return function(_0x1eaba3){if(_0x1eaba3){return _0x1eaba3[_0xbb2c('0x1c')]()[_0xbb2c('0x1b')](function(){_0x10c77d[_0xbb2c('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a13b7){return function(_0x386ff5){if(!_0x386ff5){_0x1a13b7[_0xbb2c('0x1d')](0x194);}return _0x386ff5;};}function handleError(_0x5d331d,_0x27baed){_0x27baed=_0x27baed||0x1f4;return function(_0x396bc7){logger[_0xbb2c('0x1e')](_0x396bc7[_0xbb2c('0x1f')]);if(_0x396bc7[_0xbb2c('0x20')]){delete _0x396bc7[_0xbb2c('0x20')];}_0x5d331d['status'](_0x27baed)[_0xbb2c('0x21')](_0x396bc7);};}exports[_0xbb2c('0x22')]=function(_0x6877c0,_0x3bc232){var _0x3fca6b={},_0x2f441b={},_0x11764b={'count':0x0,'rows':[]};return db[_0xbb2c('0x23')][_0xbb2c('0x24')]()[_0xbb2c('0x1b')](function(_0x904047){var _0x90b144=[];for(var _0x2fd615=0x0;_0x2fd6150x1){_0x5b8d1f['or'](_0xbb2c('0x64'),qs['getFullTextValue'](_0x54580d),null);}else{if(qs[_0xbb2c('0x65')](_0x54580d)){_0x5b8d1f['or'](_0xbb2c('0x66'),_0x54580d+'%');_0x5b8d1f['or'](_0xbb2c('0x67'),_0x54580d+'%');_0x5b8d1f['or']('c.mobile\x20LIKE\x20?',_0x54580d+'%');_0x5b8d1f['or'](_0xbb2c('0x68'),_0x54580d+'%');}else if(qs[_0xbb2c('0x69')](_0x54580d)){_0x5b8d1f['or'](_0xbb2c('0x6a'),_0x54580d+'%');}else{_0x5b8d1f['or']('c.firstName\x20LIKE\x20?','%'+_0x54580d+'%');_0x5b8d1f['or']('c.lastName\x20LIKE\x20?','%'+_0x54580d+'%');_0x5b8d1f['or'](_0xbb2c('0x6a'),'%'+_0x54580d+'%');}}}}_0x445409['where'](_0x5b8d1f);_0x445409[_0xbb2c('0x6b')](_0xbb2c('0x6c'));var _0x583043={'type':db[_0xbb2c('0x6d')][_0xbb2c('0x6e')][_0xbb2c('0x6f')],'raw':!![]};var _0x143cdb=_0x445409[_0xbb2c('0x70')]()[_0xbb2c('0x39')](_0xbb2c('0x6c'));if(_0x3fca6b[_0xbb2c('0x71')]){_0x3fca6b['order'][_0xbb2c('0x61')](function(_0x17fc0a){_0x445409['order']('c.'+_0x17fc0a[0x0],_0x17fc0a[0x1]===_0xbb2c('0x72')?![]:!![]);});}if(!_['isEmpty'](_0x29bd6c)){_0x445409[_0xbb2c('0x73')](_0x17c14d);_0x143cdb[_0xbb2c('0x37')](_0xbb2c('0x74'),_0x29bd6c);}BPromise[_0xbb2c('0x75')]()[_0xbb2c('0x1b')](function(){if(!_0x449d4e)return;if(_0x6877c0[_0xbb2c('0x76')][_0xbb2c('0x77')]!==_0xbb2c('0x78'))return;if(!_[_0xbb2c('0x79')](_0x449d4e[_0xbb2c('0x46')],[_0xbb2c('0x39'),_0xbb2c('0x4c')])){return _0x6877c0[_0xbb2c('0x76')]['getLists']({'attributes':['id'],'raw':!![]})[_0xbb2c('0x1b')](function(_0x54f410){if(_[_0xbb2c('0x5a')](_0x54f410)){_0x143cdb[_0xbb2c('0x37')](_0xbb2c('0x7a'));_0x445409['where'](_0xbb2c('0x7a'));}else{_0x143cdb[_0xbb2c('0x37')](_0xbb2c('0x5c'),_[_0xbb2c('0x56')](_0x54f410,'id'));_0x445409[_0xbb2c('0x37')](_0xbb2c('0x5c'),_[_0xbb2c('0x56')](_0x54f410,'id'));}});}})[_0xbb2c('0x1b')](function(){if(_0x6877c0[_0xbb2c('0x76')]['role']===_0xbb2c('0x78')&&!_0x449d4e&&!_0x6877c0['query']['ListId'])return[];return db['sequelize'][_0xbb2c('0x30')](_0x143cdb[_0xbb2c('0x7b')](),_0x583043);})[_0xbb2c('0x1b')](function(_0x5c1f99){_0x11764b[_0xbb2c('0x17')]=_0x5c1f99[_0xbb2c('0x2c')];if(_0x11764b['count']===0x0)return[];return db[_0xbb2c('0x7c')][_0xbb2c('0x30')](_0x43cf37[_0xbb2c('0x7b')](),_0x583043)[_0xbb2c('0x1b')](function(_0x456e14){_0x2e4afd=_['keyBy'](_0x456e14,'id');_0x583043=_[_0xbb2c('0x7d')](_0x583043,{'model':db[_0xbb2c('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6877c0[_0xbb2c('0x30')][_0xbb2c('0x34')]){_0x3fca6b[_0xbb2c('0x33')][_0xbb2c('0x61')](function(_0x4f366b){_0x445409['field']('c.'+_0x4f366b);});}else{_0x445409[_0xbb2c('0x39')]('c.id');_0x445409['field'](_0xbb2c('0x7e'));_0x445409[_0xbb2c('0x39')](_0xbb2c('0x7f'));_0x445409[_0xbb2c('0x39')](_0xbb2c('0x80'));_0x445409[_0xbb2c('0x39')]('c.mobile');_0x445409[_0xbb2c('0x39')]('c.fax');_0x445409[_0xbb2c('0x39')](_0xbb2c('0x81'));_0x445409[_0xbb2c('0x39')](_0xbb2c('0x82'));_0x445409[_0xbb2c('0x39')]('c.createdAt');_0x445409['field'](_0xbb2c('0x83'));_0x445409[_0xbb2c('0x39')](_0xbb2c('0x84'));_0x445409[_0xbb2c('0x39')](_0xbb2c('0x85'),'TagIds');}if(_0x3fca6b[_0xbb2c('0x16')])_0x445409[_0xbb2c('0x16')](_0x3fca6b['limit']);if(_0x3fca6b[_0xbb2c('0x14')])_0x445409['offset'](_0x3fca6b[_0xbb2c('0x14')]);return db[_0xbb2c('0x7c')]['query'](_0x445409['toString'](),_0x583043);});})[_0xbb2c('0x1b')](function(_0x493b69){_0x493b69[_0xbb2c('0x61')](function(_0x3ac41c){if(_0x3ac41c['TagIds']){_0x3ac41c[_0xbb2c('0x86')]=[];_0x3ac41c[_0xbb2c('0x87')][_0xbb2c('0x49')](',')['forEach'](function(_0x30e47a){_0x3ac41c[_0xbb2c('0x86')][_0xbb2c('0x59')](_0x2e4afd[_0x30e47a]);});}delete _0x3ac41c[_0xbb2c('0x87')];});_0x11764b['rows']=_0x493b69;return _0x11764b;})[_0xbb2c('0x1b')](respondWithFilteredResult(_0x3bc232,_0x3fca6b));})[_0xbb2c('0x88')](handleError(_0x3bc232,null));};exports[_0xbb2c('0x1c')]=function(_0x28b892,_0x585d09){return db[_0xbb2c('0x23')][_0xbb2c('0x47')]({'where':{'id':_0x28b892[_0xbb2c('0x89')]['id']}})['then'](handleEntityNotFound(_0x585d09,null))['then'](removeEntity(_0x585d09,null))[_0xbb2c('0x88')](handleError(_0x585d09,null));};exports[_0xbb2c('0x24')]=function(_0x4acedb,_0x3603aa){return db['CmContact'][_0xbb2c('0x24')]()['then'](function(_0x1f5b76){delete _0x1f5b76[_0xbb2c('0x8a')];for(var _0x3edf31=0x0;_0x3edf310x0){return new Promise(function(_0x1501f3,_0x3f06bf){var _0x1b15d9=[];for(var _0x5d40f9=0x0;_0x5d40f9<_0x9b8bc8[_0xbb2c('0x2c')];_0x5d40f9++){_0x1b15d9[_0xbb2c('0x59')](insertAdditionalPhones(_0x9b8bc8[_0x5d40f9][_0xbb2c('0xbc')],_0x9b8bc8[_0x5d40f9][_0xbb2c('0xb6')]));}Promise[_0xbb2c('0x2b')](_0x1b15d9)[_0xbb2c('0x1b')](function(){_0x1501f3(0x1);});})[_0xbb2c('0x1b')](function(){return{'success':_0x4a71e8,'failure':_0x17b999,'duplicates':_0x173c4a};});}else{return{'success':_0x4a71e8,'failure':_0x17b999,'duplicates':_0x173c4a};}}})[_0xbb2c('0x1b')](respondWithResult(_0x5171fa,0xc9))['catch'](handleError(_0x5171fa,null));};exports['show']=function(_0x42f966,_0x4dc0be){var _0x5454b8;return db[_0xbb2c('0x23')][_0xbb2c('0x24')]()[_0xbb2c('0x1b')](function(_0x440b17){return db[_0xbb2c('0x23')][_0xbb2c('0x47')]({'where':{'id':_0x42f966[_0xbb2c('0x89')]['id']},'include':[{'model':db[_0xbb2c('0xbd')],'as':_0xbb2c('0x86'),'attributes':['id',_0xbb2c('0x20'),_0xbb2c('0xbe')],'required':_0x42f966['query'][_0xbb2c('0x60')]?!![]:![]},{'model':db[_0xbb2c('0xa7')],'as':'Phones','where':{'CmContactId':_0x42f966['params']['id']},'required':![],'include':[{'model':db[_0xbb2c('0xbf')],'as':'ItemType'}]}],'order':[db[_0xbb2c('0x7c')][_0xbb2c('0xc0')](_0xbb2c('0xc1'))],'attributes':_['keys'](_0x440b17)});})[_0xbb2c('0x1b')](function(_0x34a84c){if(!_['isNil'](_0x34a84c)){_0x5454b8=_0x34a84c[_0xbb2c('0x92')]({'plain':!![]});var _0x46564f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x34a84c&&_0x34a84c[_0xbb2c('0x5b')]){if(_0x34a84c[_0xbb2c('0x5b')]){_0x46564f[_0xbb2c('0x37')][_0xbb2c('0xc2')]['push']({'ListId':{'$ne':_0x34a84c['ListId']}});}}return db[_0xbb2c('0x28')][_0xbb2c('0x90')](_0x46564f);}})[_0xbb2c('0x1b')](function(_0x5e1693){if(!_[_0xbb2c('0xb2')](_0x5e1693)){return _['omit'](_0x5454b8,_[_0xbb2c('0x56')](_0x5e1693,function(_0x4ca190){return util[_0xbb2c('0xc3')](_0xbb2c('0xc4'),_0x4ca190['id']);}));}})['then'](handleEntityNotFound(_0x4dc0be,null))['then'](respondWithResult(_0x4dc0be,null))[_0xbb2c('0x88')](handleError(_0x4dc0be,null));};exports['update']=function(_0x3a84bd,_0x4d9b0d){var _0x4268ec;if(_0x3a84bd[_0xbb2c('0x91')]['id']){delete _0x3a84bd[_0xbb2c('0x91')]['id'];}if(!_[_0xbb2c('0xb2')](_0x3a84bd[_0xbb2c('0x91')]['dialTimezone'])){var _0x3df833=_0x3a84bd[_0xbb2c('0x91')][_0xbb2c('0xb3')];if(!_[_0xbb2c('0xb2')](shared[_0xbb2c('0xb5')][_0x3df833]))_0x3a84bd[_0xbb2c('0x91')][_0xbb2c('0xb4')]=shared[_0xbb2c('0xb5')][_0x3df833][_0xbb2c('0xb4')];}return db[_0xbb2c('0x23')]['find']({'where':{'id':_0x3a84bd[_0xbb2c('0x89')]['id']}})['then'](handleEntityNotFound(_0x4d9b0d,null))[_0xbb2c('0x1b')](saveUpdates(_0x3a84bd[_0xbb2c('0x91')],null))[_0xbb2c('0x1b')](function(_0x1fed75){_0x4268ec=_0x1fed75;var _0x362db4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1fed75&&_0x1fed75[_0xbb2c('0x5b')]){if(_0x1fed75[_0xbb2c('0x5b')]){_0x362db4[_0xbb2c('0x37')][_0xbb2c('0xc2')][_0xbb2c('0x59')]({'ListId':{'$ne':_0x1fed75[_0xbb2c('0x5b')]}});}}return db['CmCustomField'][_0xbb2c('0x90')](_0x362db4);})[_0xbb2c('0x1b')](function(_0x29faca){if(_0x29faca){return _[_0xbb2c('0xc5')](_['pickBy'](_0x3a84bd[_0xbb2c('0x91')],function(_0x232a9e,_0x52d927){return _[_0xbb2c('0x26')](_0x52d927,_0xbb2c('0x27'));}),_[_0xbb2c('0x56')](_0x29faca,function(_0x2fcf62){return util['format'](_0xbb2c('0xc4'),_0x2fcf62['id']);}));}})[_0xbb2c('0x1b')](function(_0x59fb62){if(_0x59fb62&&!_['isEmpty'](_0x59fb62)){var _0x34fe6d=squel['update']()[_0xbb2c('0xc6')]('cm_contacts')[_0xbb2c('0xc7')](_0x59fb62)[_0xbb2c('0x37')](_0xbb2c('0xc8'),_0x3a84bd[_0xbb2c('0x89')]['id'])[_0xbb2c('0xc9')]();return db['sequelize'][_0xbb2c('0x30')](_0x34fe6d[_0xbb2c('0x53')],{'replacements':_0x34fe6d[_0xbb2c('0x8f')]});}})[_0xbb2c('0x1b')](function(){if(_0x3a84bd[_0xbb2c('0x91')][_0xbb2c('0xca')]&&_0x4268ec){return db['CmHopper'][_0xbb2c('0x1a')]({'phone':_0x3a84bd[_0xbb2c('0x91')][_0xbb2c('0xca')],'OrderBy':0x0},{'where':{'ContactId':_0x4268ec['id']}});}})[_0xbb2c('0x1b')](function(){return _0x4268ec;})[_0xbb2c('0x1b')](respondWithResult(_0x4d9b0d,null))[_0xbb2c('0x88')](handleError(_0x4d9b0d,null));};exports[_0xbb2c('0xcb')]=function(_0x2a28f1,_0x460dc5){var _0x5ad7e6={};var _0x3e58c1={};var _0x40a0db;var _0xe2bcf7;return db[_0xbb2c('0x23')][_0xbb2c('0x29')]({'where':{'id':_0x2a28f1['params']['id']}})[_0xbb2c('0x1b')](handleEntityNotFound(_0x460dc5,null))[_0xbb2c('0x1b')](function(_0x3f780f){if(_0x3f780f){_0x40a0db=_0x3f780f;_0x3e58c1[_0xbb2c('0x2f')]=_[_0xbb2c('0x25')](db[_0xbb2c('0xbd')][_0xbb2c('0xcc')]);_0x3e58c1[_0xbb2c('0x30')]=_['keys'](_0x2a28f1[_0xbb2c('0x30')]);_0x3e58c1[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](_0x3e58c1[_0xbb2c('0x2f')],_0x3e58c1[_0xbb2c('0x30')]);_0x5ad7e6[_0xbb2c('0x33')]=_[_0xbb2c('0x32')](_0x3e58c1['model'],qs['fields'](_0x2a28f1['query'][_0xbb2c('0x34')]));_0x5ad7e6[_0xbb2c('0x33')]=_0x5ad7e6[_0xbb2c('0x33')][_0xbb2c('0x2c')]?_0x5ad7e6[_0xbb2c('0x33')]:_0x3e58c1[_0xbb2c('0x2f')];_0x5ad7e6[_0xbb2c('0x71')]=qs[_0xbb2c('0x36')](_0x2a28f1['query'][_0xbb2c('0x36')]);_0x5ad7e6[_0xbb2c('0x37')]=qs[_0xbb2c('0x31')](_[_0xbb2c('0xcd')](_0x2a28f1[_0xbb2c('0x30')],_0x3e58c1['filters']));if(_0x2a28f1['query'][_0xbb2c('0x62')]){_0x5ad7e6['where']=_['merge'](_0x5ad7e6[_0xbb2c('0x37')],{'$or':_['map'](_0x5ad7e6[_0xbb2c('0x33')],function(_0x36bf8b){var _0x472c6f={};_0x472c6f[_0x36bf8b]={'$like':'%'+_0x2a28f1[_0xbb2c('0x30')][_0xbb2c('0x62')]+'%'};return _0x472c6f;})});}_0x5ad7e6=_[_0xbb2c('0x7d')]({},_0x5ad7e6,_0x2a28f1['options']);return _0x40a0db[_0xbb2c('0xcb')](_0x5ad7e6);}})[_0xbb2c('0x1b')](function(_0x44ddb4){if(_0x44ddb4){_0xe2bcf7=_0x44ddb4[_0xbb2c('0x2c')];if(!_0x2a28f1[_0xbb2c('0x30')]['hasOwnProperty']('nolimit')){_0x5ad7e6[_0xbb2c('0x16')]=qs[_0xbb2c('0x16')](_0x2a28f1[_0xbb2c('0x30')][_0xbb2c('0x16')]);_0x5ad7e6['offset']=qs['offset'](_0x2a28f1[_0xbb2c('0x30')][_0xbb2c('0x14')]);}return _0x40a0db[_0xbb2c('0xcb')](_0x5ad7e6);}})[_0xbb2c('0x1b')](function(_0x46d43a){if(_0x46d43a){return _0x46d43a?{'count':_0xe2bcf7,'rows':_0x46d43a}:null;}})[_0xbb2c('0x1b')](respondWithResult(_0x460dc5,null))[_0xbb2c('0x88')](handleError(_0x460dc5,null));};exports[_0xbb2c('0xce')]=function(_0x134fab,_0x1896f9){if(_0x134fab[_0xbb2c('0x91')]['id']){delete _0x134fab[_0xbb2c('0x91')]['id'];}return db[_0xbb2c('0x23')][_0xbb2c('0x29')]({'where':{'id':_0x134fab[_0xbb2c('0x89')]['id']}})[_0xbb2c('0x1b')](handleEntityNotFound(_0x1896f9,null))[_0xbb2c('0x1b')](function(_0x4481a0){if(_0x4481a0){return _0x4481a0[_0xbb2c('0xce')](_0x134fab[_0xbb2c('0x91')][_0xbb2c('0xcf')]||[]);}return null;})['then'](respondWithResult(_0x1896f9,null))[_0xbb2c('0x88')](handleError(_0x1896f9,null));};exports[_0xbb2c('0xd0')]=function(_0x2f4bcb,_0x255813){var _0x3d2c2a=[];_0x3d2c2a[_0xbb2c('0x59')](addAdditionalPhones(_0x2f4bcb['body']));Promise['all'](_0x3d2c2a)[_0xbb2c('0x1b')](function(){_0x3d2c2a=[];_0x3d2c2a[_0xbb2c('0x59')](deleteCmHopperPhones(_0x2f4bcb[_0xbb2c('0x91')]['id']));_0x3d2c2a[_0xbb2c('0x59')](addCmHopperPhones(_0x2f4bcb[_0xbb2c('0x91')]['id']));Promise[_0xbb2c('0x2b')](_0x3d2c2a)['then'](function(){return[0x1];})['then'](respondWithResult(_0x255813,null));});};function addAdditionalPhones(_0x28856c){var _0x2d1f43;return new Promise(function(_0x171f9b,_0x2f0347){return db[_0xbb2c('0xa7')]['destroy']({'where':{'CmContactId':_0x28856c['id']}})[_0xbb2c('0x1b')](function(){db[_0xbb2c('0xbf')]['findAll']({'raw':!![],'attributes':['id',_0xbb2c('0xd1')]})['then'](function(_0x386cb3){var _0x3c5c2e=[];for(var _0x3f76fb=0x0;_0x3f76fb<_0x28856c[_0xbb2c('0xd2')][_0xbb2c('0x2c')];_0x3f76fb++){var _0xe172c4=_0x28856c[_0xbb2c('0xd3')]?_[_0xbb2c('0xb2')](_0x28856c[_0xbb2c('0xd3')][_0x3f76fb])?'':_0x28856c[_0xbb2c('0xd3')][_0x3f76fb]:_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd4')]?_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd4')]:'';var _0x15c3f7=_[_0xbb2c('0xb2')](_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd5')])?'':_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd5')];var _0x582d67=_0xe172c4+':'+_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xca')]+'§'+_0x15c3f7;if(_[_0xbb2c('0xb2')](_0x2d1f43))_0x2d1f43=_0x582d67;else _0x2d1f43+=';'+_0x582d67;var _0x192c17=null;if(_0x28856c['item_types']){if(!_[_0xbb2c('0xb2')](_0x28856c['item_types'][_0x3f76fb])){var _0x4c735f=_['find'](_0x386cb3,function(_0x443fce){return _0x443fce['id']===_0x28856c[_0xbb2c('0xd3')][_0x3f76fb];});if(!_[_0xbb2c('0xb2')](_0x4c735f)){_0x192c17=_0x4c735f['OrderBy'];}}}else{if(!_[_0xbb2c('0xb2')](_0x28856c[_0xbb2c('0xd2')][_0x3f76fb])){var _0x4c735f=_[_0xbb2c('0x47')](_0x386cb3,function(_0x170a0d){return _0x170a0d['id']===_0x28856c['items'][_0x3f76fb]['ItemTypeId'];});if(!_['isNil'](_0x4c735f)){_0x192c17=_0x3f76fb;}}}if(_[_0xbb2c('0xb2')](_0x192c17)){_0x192c17=0x64;}_0x3c5c2e[_0xbb2c('0x59')](addAdditionalPhone(_0x28856c['id'],_0x28856c['items'][_0x3f76fb][_0xbb2c('0xca')],_0x28856c['item_types']?_['isNil'](_0x28856c[_0xbb2c('0xd3')][_0x3f76fb])?null:_0x28856c[_0xbb2c('0xd3')][_0x3f76fb]:_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd4')]?_0x28856c[_0xbb2c('0xd2')][_0x3f76fb][_0xbb2c('0xd4')]:null,_0x192c17,_0x15c3f7));}Promise[_0xbb2c('0x2b')](_0x3c5c2e)[_0xbb2c('0x1b')](function(){db['CmContact'][_0xbb2c('0x1a')]({'AdditionalPhones':_0x2d1f43},{'where':{'id':_0x28856c['id']}})[_0xbb2c('0x1b')](function(){_0x171f9b(0x1);});});});});});}function addAdditionalPhone(_0x296373,_0x5a8602,_0x723bd,_0x56728b,_0xd68843){return db[_0xbb2c('0xa7')][_0xbb2c('0x47')]({'where':{'CmContactId':_0x296373,'item':_0x5a8602}})[_0xbb2c('0x1b')](function(_0x494be9){if(_0x494be9)logger[_0xbb2c('0x96')](_0xbb2c('0xd6'),_0x494be9);else{db[_0xbb2c('0xa7')][_0xbb2c('0x9b')]({'CmContactId':_0x296373,'item':_0x5a8602,'ItemTypeId':_0x723bd,'OrderBy':_0x56728b,'ItemClass':'PHONE','description':_0xd68843});}});}function deletePhones(_0x57e66b){return db['CmContactHasItem'][_0xbb2c('0x1c')]({'where':{'CmContactId':_0x57e66b}});}function deleteCmHopperPhones(_0x2b741b){return new Promise(function(_0x27363c,_0x2b5511){return db['CmHopper'][_0xbb2c('0x90')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2b741b}})[_0xbb2c('0x1b')](function(_0x3bf7a2){db[_0xbb2c('0xd7')][_0xbb2c('0x1c')]({'where':{'CmHopperId':{'$in':_['map'](_0x3bf7a2,'id')}}});})['then'](function(){_0x27363c(0x1);});});}function addCmHopperPhones(_0x424756){return new Promise(function(_0x2a6d53,_0x4d7516){return db[_0xbb2c('0xd8')][_0xbb2c('0x90')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x424756}})[_0xbb2c('0x1b')](function(_0x1681a2){var _0x493c8e=[];_[_0xbb2c('0x56')](_0x1681a2,function(_0x2f2203){_0x493c8e[_0xbb2c('0x59')](createCmHopperPhone(_0x424756,_0x2f2203['id']));});Promise[_0xbb2c('0x2b')](_0x493c8e)[_0xbb2c('0x1b')](function(){_0x2a6d53(0x1);});});});}function createCmHopperPhone(_0x217664,_0x3e4d55){return new Promise(function(_0x1aa4ff,_0x334245){db[_0xbb2c('0xa7')][_0xbb2c('0x90')]({'raw':!![],'attributes':[_0xbb2c('0xd9'),_0xbb2c('0xd1')],'where':{'CmContactId':_0x217664,'ItemClass':_0xbb2c('0xda')},'include':[{'model':db[_0xbb2c('0xbf')],'attributes':[_0xbb2c('0xd1')],'as':_0xbb2c('0xdb')}],'order':[_0xbb2c('0xd1'),db[_0xbb2c('0x7c')]['literal'](_0xbb2c('0xdc'))]})['then'](function(_0x579218){var _0x55f8c1=0x1;var _0x227ad8=_[_0xbb2c('0x56')](_0x579218,function(_0x1c163b){_0x1c163b[_0xbb2c('0xdd')]=_0x3e4d55;_0x1c163b[_0xbb2c('0xca')]=_0x1c163b[_0xbb2c('0xd9')];_0x1c163b[_0xbb2c('0xd1')]=_0x55f8c1;delete _0x1c163b[_0xbb2c('0xde')];_0x55f8c1=_0x55f8c1+0x1;return _0x1c163b;});return db[_0xbb2c('0xd7')][_0xbb2c('0xb7')](_0x227ad8,{});})[_0xbb2c('0x1b')](function(){_0x1aa4ff(0x1);});});}function insertAdditionalPhones(_0x333df5,_0xf3f057){return new Promise(function(_0x26d17f,_0x423f72){var _0x286031=[];for(var _0xa99acd=0x0;_0xa99acd<_0xf3f057[_0xbb2c('0x2c')];_0xa99acd++){var _0x3d2be3=_0xf3f057[_0xa99acd];_0x286031[_0xbb2c('0x59')](parseContactItemType(_0x3d2be3));}Promise[_0xbb2c('0x2b')](_0x286031)[_0xbb2c('0x1b')](function(){var _0x2d7463={'id':_0x333df5['id'],'items':_0xf3f057};return addAdditionalPhones(_0x2d7463)[_0xbb2c('0x1b')](function(_0x5c3d9e){return addCmHopperPhones(_0x333df5['id']);});})['then'](function(){_0x26d17f(_0x333df5);});});}function parseContactItemType(_0x156739){return new Promise(function(_0x370d6d,_0x1b6835){if(_0x156739[_0xbb2c('0x57')](_0xbb2c('0xd4'))){_0x370d6d(_0x156739);}else{return db[_0xbb2c('0xbf')]['find']({'where':{'name':_0x156739[_0xbb2c('0xdb')]}})[_0xbb2c('0x1b')](function(_0xcff195){if(_['isNil'](_0xcff195))_0x156739[_0xbb2c('0xd4')]=null;else _0x156739[_0xbb2c('0xd4')]=_0xcff195['id'];_0x370d6d(_0x156739);});}});}exports['getAdditionalPhones']=function(_0x2bc1b5,_0x138e0d){return db[_0xbb2c('0xa7')][_0xbb2c('0x90')]({'raw':!![],'where':{'CmContactId':_0x2bc1b5[_0xbb2c('0x89')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0xbb2c('0xd1')],[db[_0xbb2c('0x7c')]['literal'](_0xbb2c('0xdc'))]]})[_0xbb2c('0x1b')](function(_0x126412){return _0x126412;})[_0xbb2c('0x1b')](respondWithResult(_0x138e0d,null))[_0xbb2c('0x88')](handleError(_0x138e0d,null));};exports['duplicateAdditionalPhones']=function(_0x3daa4c,_0x155f2c){return db['CmContactHasItem'][_0xbb2c('0x90')]({'raw':!![],'where':{'CmContactId':_0x3daa4c['body'][_0xbb2c('0xdf')]}})[_0xbb2c('0x1b')](function(_0x1ec386){var _0x7fbc9c=_[_0xbb2c('0x56')](_0x1ec386,function(_0x4cdaeb){_0x4cdaeb[_0xbb2c('0xe0')]=_0x3daa4c[_0xbb2c('0x91')][_0xbb2c('0xe1')];return _0x4cdaeb;});return db['CmContactHasItem'][_0xbb2c('0xb7')](_0x7fbc9c,{});})[_0xbb2c('0x1b')](function(_0x4f8b7c){return addCmHopperPhones(_0x3daa4c[_0xbb2c('0x91')][_0xbb2c('0xe1')]);})[_0xbb2c('0x1b')](function(_0x365289){return['ok'];})[_0xbb2c('0x1b')](respondWithResult(_0x155f2c,null))[_0xbb2c('0x88')](handleError(_0x155f2c,null));};exports[_0xbb2c('0xe2')]=function(_0x3a9dec,_0x5db456){var _0x47a0ae=[];_0x47a0ae[_0xbb2c('0x59')](createCmHopperPhone(_0x3a9dec[_0xbb2c('0x91')]['id'],_0x3a9dec[_0xbb2c('0x91')][_0xbb2c('0xe3')]));Promise[_0xbb2c('0x2b')](_0x47a0ae)[_0xbb2c('0x1b')](function(){return[0x1];})[_0xbb2c('0x1b')](respondWithResult(_0x5db456,null));};exports[_0xbb2c('0xe4')]=function(_0x3094c1,_0x3f1083){var _0x4d96d9={'raw':![],'where':{}};var _0x1a3ee1={};var _0xdf6574={'count':0x0,'rows':[]};return db['CmContact'][_0xbb2c('0x29')]({'where':{'id':_0x3094c1[_0xbb2c('0x89')]['id']}})[_0xbb2c('0x1b')](handleEntityNotFound(_0x3f1083,null))[_0xbb2c('0x1b')](function(_0x1c1e39){if(_0x1c1e39){_0x1a3ee1['model']=_[_0xbb2c('0x25')](db[_0xbb2c('0xd8')]['rawAttributes']);_0x1a3ee1['query']=_[_0xbb2c('0x25')](_0x3094c1[_0xbb2c('0x30')]);_0x1a3ee1[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](_0x1a3ee1[_0xbb2c('0x2f')],_0x1a3ee1[_0xbb2c('0x30')]);_0x4d96d9[_0xbb2c('0x33')]=_['intersection'](_0x1a3ee1[_0xbb2c('0x2f')],qs[_0xbb2c('0x34')](_0x3094c1[_0xbb2c('0x30')]['fields']));_0x4d96d9['attributes']=_0x4d96d9['attributes'][_0xbb2c('0x2c')]?_0x4d96d9[_0xbb2c('0x33')]:_0x1a3ee1[_0xbb2c('0x2f')];if(!_0x3094c1[_0xbb2c('0x30')][_0xbb2c('0x57')](_0xbb2c('0x35'))){_0x4d96d9[_0xbb2c('0x16')]=qs[_0xbb2c('0x16')](_0x3094c1[_0xbb2c('0x30')][_0xbb2c('0x16')]);_0x4d96d9[_0xbb2c('0x14')]=qs['offset'](_0x3094c1[_0xbb2c('0x30')][_0xbb2c('0x14')]);}_0x4d96d9[_0xbb2c('0x71')]=qs['sort'](_0x3094c1[_0xbb2c('0x30')][_0xbb2c('0x36')]);_0x4d96d9[_0xbb2c('0x37')]=qs[_0xbb2c('0x31')](_[_0xbb2c('0xcd')](_0x3094c1[_0xbb2c('0x30')],_0x1a3ee1['filters']));_0x4d96d9[_0xbb2c('0x37')][_0xbb2c('0xe5')]=_0x1c1e39['id'];if(_0x3094c1['query']['filter']){_0x4d96d9[_0xbb2c('0x37')]=_[_0xbb2c('0x7d')](_0x4d96d9[_0xbb2c('0x37')],{'$or':_[_0xbb2c('0x56')](_0x4d96d9[_0xbb2c('0x33')],function(_0x2ef9f0){var _0x490ad8={};_0x490ad8[_0x2ef9f0]={'$like':'%'+_0x3094c1['query'][_0xbb2c('0x62')]+'%'};return _0x490ad8;})});}_0x4d96d9=_[_0xbb2c('0x7d')]({},_0x4d96d9,_0x3094c1['options']);return db[_0xbb2c('0xd8')]['count']({'where':_0x4d96d9['where']})[_0xbb2c('0x1b')](function(_0x35dfb7){_0xdf6574[_0xbb2c('0x17')]=_0x35dfb7;if(_0x3094c1[_0xbb2c('0x30')][_0xbb2c('0xe6')]){_0x4d96d9[_0xbb2c('0xe7')]=[{'all':!![]}];}return db['CmHopper'][_0xbb2c('0x90')](_0x4d96d9);})[_0xbb2c('0x1b')](function(_0x2d4242){_0xdf6574['rows']=_0x2d4242;return _0xdf6574;});}})[_0xbb2c('0x1b')](respondWithFilteredResult(_0x3f1083,_0x4d96d9))[_0xbb2c('0x88')](handleError(_0x3f1083,null));};exports['getHopperHistories']=function(_0x58f083,_0x5de38b){var _0x5d457c={'raw':!![],'where':{}};var _0x2cde1c={};var _0x44430d={'count':0x0,'rows':[]};return db[_0xbb2c('0x23')]['findOne']({'where':{'id':_0x58f083[_0xbb2c('0x89')]['id']}})[_0xbb2c('0x1b')](handleEntityNotFound(_0x5de38b,null))[_0xbb2c('0x1b')](function(_0x5b17c4){if(_0x5b17c4){_0x2cde1c['model']=_['keys'](db[_0xbb2c('0xa8')][_0xbb2c('0xcc')]);_0x2cde1c['query']=_[_0xbb2c('0x25')](_0x58f083[_0xbb2c('0x30')]);_0x2cde1c[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](_0x2cde1c[_0xbb2c('0x2f')],_0x2cde1c[_0xbb2c('0x30')]);_0x5d457c['attributes']=_[_0xbb2c('0x32')](_0x2cde1c[_0xbb2c('0x2f')],qs[_0xbb2c('0x34')](_0x58f083[_0xbb2c('0x30')][_0xbb2c('0x34')]));_0x5d457c['attributes']=_0x5d457c['attributes'][_0xbb2c('0x2c')]?_0x5d457c[_0xbb2c('0x33')]:_0x2cde1c[_0xbb2c('0x2f')];if(!_0x58f083[_0xbb2c('0x30')][_0xbb2c('0x57')](_0xbb2c('0x35'))){_0x5d457c[_0xbb2c('0x16')]=qs[_0xbb2c('0x16')](_0x58f083['query'][_0xbb2c('0x16')]);_0x5d457c['offset']=qs[_0xbb2c('0x14')](_0x58f083['query'][_0xbb2c('0x14')]);}_0x5d457c[_0xbb2c('0x71')]=qs['sort'](_0x58f083['query']['sort']);_0x5d457c[_0xbb2c('0x37')]=qs['filters'](_['pick'](_0x58f083[_0xbb2c('0x30')],_0x2cde1c[_0xbb2c('0x31')]));_0x5d457c[_0xbb2c('0x37')][_0xbb2c('0xe5')]=_0x5b17c4['id'];if(_0x58f083['query'][_0xbb2c('0x62')]){_0x5d457c[_0xbb2c('0x37')]=_[_0xbb2c('0x7d')](_0x5d457c[_0xbb2c('0x37')],{'$or':_[_0xbb2c('0x56')](_0x5d457c[_0xbb2c('0x33')],function(_0x4fb6d4){var _0x1701de={};_0x1701de[_0x4fb6d4]={'$like':'%'+_0x58f083[_0xbb2c('0x30')][_0xbb2c('0x62')]+'%'};return _0x1701de;})});}_0x5d457c=_[_0xbb2c('0x7d')]({},_0x5d457c,_0x58f083[_0xbb2c('0xe8')]);return db[_0xbb2c('0xa8')]['count']({'where':_0x5d457c['where']})[_0xbb2c('0x1b')](function(_0x2589bc){_0x44430d[_0xbb2c('0x17')]=_0x2589bc;if(_0x58f083[_0xbb2c('0x30')][_0xbb2c('0xe6')]){_0x5d457c['include']=[{'all':!![]}];}return db[_0xbb2c('0xa8')][_0xbb2c('0x90')](_0x5d457c);})['then'](function(_0x112144){_0x44430d[_0xbb2c('0xe9')]=_0x112144;return _0x44430d;});}})[_0xbb2c('0x1b')](respondWithFilteredResult(_0x5de38b,_0x5d457c))['catch'](handleError(_0x5de38b,null));};exports[_0xbb2c('0xea')]=function(_0x1044fc,_0x55733e){var _0x4c4134={'raw':!![],'where':{}};var _0xc4119b={};var _0x1e737a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1044fc['params']['id']}})[_0xbb2c('0x1b')](handleEntityNotFound(_0x55733e,null))[_0xbb2c('0x1b')](function(_0x373f65){if(_0x373f65){_0xc4119b[_0xbb2c('0x2f')]=_['keys'](db[_0xbb2c('0xeb')][_0xbb2c('0xcc')]);_0xc4119b[_0xbb2c('0x30')]=_[_0xbb2c('0x25')](_0x1044fc[_0xbb2c('0x30')]);_0xc4119b[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](_0xc4119b[_0xbb2c('0x2f')],_0xc4119b[_0xbb2c('0x30')]);_0x4c4134['attributes']=_[_0xbb2c('0x32')](_0xc4119b[_0xbb2c('0x2f')],qs[_0xbb2c('0x34')](_0x1044fc[_0xbb2c('0x30')][_0xbb2c('0x34')]));_0x4c4134[_0xbb2c('0x33')]=_0x4c4134['attributes']['length']?_0x4c4134[_0xbb2c('0x33')]:_0xc4119b[_0xbb2c('0x2f')];if(!_0x1044fc[_0xbb2c('0x30')][_0xbb2c('0x57')]('nolimit')){_0x4c4134[_0xbb2c('0x16')]=qs[_0xbb2c('0x16')](_0x1044fc[_0xbb2c('0x30')]['limit']);_0x4c4134[_0xbb2c('0x14')]=qs[_0xbb2c('0x14')](_0x1044fc[_0xbb2c('0x30')]['offset']);}_0x4c4134[_0xbb2c('0x71')]=qs[_0xbb2c('0x36')](_0x1044fc[_0xbb2c('0x30')][_0xbb2c('0x36')]);_0x4c4134[_0xbb2c('0x37')]=qs[_0xbb2c('0x31')](_[_0xbb2c('0xcd')](_0x1044fc['query'],_0xc4119b[_0xbb2c('0x31')]));_0x4c4134[_0xbb2c('0x37')][_0xbb2c('0xe5')]=_0x373f65['id'];if(_0x1044fc['query'][_0xbb2c('0x62')]){_0x4c4134[_0xbb2c('0x37')]=_[_0xbb2c('0x7d')](_0x4c4134['where'],{'$or':_[_0xbb2c('0x56')](_0x4c4134[_0xbb2c('0x33')],function(_0x55a32a){var _0x2185cf={};_0x2185cf[_0x55a32a]={'$like':'%'+_0x1044fc[_0xbb2c('0x30')][_0xbb2c('0x62')]+'%'};return _0x2185cf;})});}_0x4c4134=_[_0xbb2c('0x7d')]({},_0x4c4134,_0x1044fc[_0xbb2c('0xe8')]);return db[_0xbb2c('0xeb')][_0xbb2c('0x17')]({'where':_0x4c4134[_0xbb2c('0x37')]})[_0xbb2c('0x1b')](function(_0x10d8aa){_0x1e737a['count']=_0x10d8aa;if(_0x1044fc[_0xbb2c('0x30')][_0xbb2c('0xe6')]){_0x4c4134[_0xbb2c('0xe7')]=[{'all':!![]}];}return db[_0xbb2c('0xeb')]['findAll'](_0x4c4134);})[_0xbb2c('0x1b')](function(_0x2cae15){_0x1e737a[_0xbb2c('0xe9')]=_0x2cae15;return _0x1e737a;});}})['then'](respondWithFilteredResult(_0x55733e,_0x4c4134))[_0xbb2c('0x88')](handleError(_0x55733e,null));};exports['getJscriptySessions']=function(_0x57dd6c,_0x51e286){var _0x559146={'raw':!![],'where':{}};var _0x4ca45d={};var _0x56286a={'count':0x0,'rows':[]};return db[_0xbb2c('0x23')]['findOne']({'where':{'id':_0x57dd6c[_0xbb2c('0x89')]['id']}})['then'](handleEntityNotFound(_0x51e286,null))[_0xbb2c('0x1b')](function(_0x1478dd){if(_0x1478dd){_0x4ca45d[_0xbb2c('0x2f')]=_[_0xbb2c('0x25')](db['JscriptySessionReport'][_0xbb2c('0xcc')]);_0x4ca45d[_0xbb2c('0x30')]=_['keys'](_0x57dd6c[_0xbb2c('0x30')]);_0x4ca45d[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](_0x4ca45d[_0xbb2c('0x2f')],_0x4ca45d['query']);_0x559146[_0xbb2c('0x33')]=_[_0xbb2c('0x32')](_0x4ca45d['model'],qs[_0xbb2c('0x34')](_0x57dd6c[_0xbb2c('0x30')][_0xbb2c('0x34')]));_0x559146['attributes']=_0x559146[_0xbb2c('0x33')][_0xbb2c('0x2c')]?_0x559146[_0xbb2c('0x33')]:_0x4ca45d[_0xbb2c('0x2f')];if(!_0x57dd6c[_0xbb2c('0x30')][_0xbb2c('0x57')](_0xbb2c('0x35'))){_0x559146['limit']=qs[_0xbb2c('0x16')](_0x57dd6c['query'][_0xbb2c('0x16')]);_0x559146[_0xbb2c('0x14')]=qs[_0xbb2c('0x14')](_0x57dd6c[_0xbb2c('0x30')][_0xbb2c('0x14')]);}_0x559146[_0xbb2c('0x71')]=qs[_0xbb2c('0x36')](_0x57dd6c['query'][_0xbb2c('0x36')]);_0x559146[_0xbb2c('0x37')]=qs[_0xbb2c('0x31')](_[_0xbb2c('0xcd')](_0x57dd6c[_0xbb2c('0x30')],_0x4ca45d[_0xbb2c('0x31')]));_0x559146[_0xbb2c('0x37')][_0xbb2c('0xe5')]=_0x1478dd['id'];if(_0x57dd6c[_0xbb2c('0x30')]['filter']){_0x559146[_0xbb2c('0x37')]=_[_0xbb2c('0x7d')](_0x559146[_0xbb2c('0x37')],{'$or':_[_0xbb2c('0x56')](_0x559146[_0xbb2c('0x33')],function(_0x99a1a9){var _0x8345a7={};_0x8345a7[_0x99a1a9]={'$like':'%'+_0x57dd6c[_0xbb2c('0x30')][_0xbb2c('0x62')]+'%'};return _0x8345a7;})});}_0x559146=_[_0xbb2c('0x7d')]({},_0x559146,_0x57dd6c[_0xbb2c('0xe8')]);return db[_0xbb2c('0xae')]['count']({'where':_0x559146[_0xbb2c('0x37')]})['then'](function(_0x61b2df){_0x56286a[_0xbb2c('0x17')]=_0x61b2df;if(_0x57dd6c[_0xbb2c('0x30')][_0xbb2c('0xe6')]){_0x559146[_0xbb2c('0xe7')]=[{'all':!![]}];}return db[_0xbb2c('0xae')][_0xbb2c('0x90')](_0x559146);})[_0xbb2c('0x1b')](function(_0x15208a){_0x56286a[_0xbb2c('0xe9')]=_0x15208a;return _0x56286a;});}})[_0xbb2c('0x1b')](respondWithFilteredResult(_0x51e286,_0x559146))[_0xbb2c('0x88')](handleError(_0x51e286,null));};exports[_0xbb2c('0xec')]=function(_0x149c6b,_0x453d9c){try{if(!_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0x5b')]){throw new Error(_0xbb2c('0xed'));}if(!_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xee')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x149c6b['body'][_0xbb2c('0xef')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x149c6b['body'][_0xbb2c('0xf0')]){throw new Error(_0xbb2c('0xf1'));}var _0x3a298b=_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xee')][_0xbb2c('0x49')](',');var _0x18c5db=_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xef')][_0xbb2c('0x49')](',');if(!_0x3a298b[_0xbb2c('0x2c')]||!_0x18c5db[_0xbb2c('0x2c')]||_0x3a298b[_0xbb2c('0x2c')]!==_0x18c5db[_0xbb2c('0x2c')]){throw new Error(_0xbb2c('0xf2'));}_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0x34')]=_['zipObject'](_0x3a298b,_0x18c5db);if(!_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0x34')]['phone']){throw new Error(_0xbb2c('0xf3'));}if(!_0x149c6b['body'][_0xbb2c('0x34')][_0xbb2c('0xf4')]){throw new Error(_0xbb2c('0xf5'));}var _0x1bda07=path[_0xbb2c('0x95')](config[_0xbb2c('0xf6')],'server/files/tmp',_0x149c6b[_0xbb2c('0xf7')][_0xbb2c('0xf8')]);fs[_0xbb2c('0xf9')](_0x1bda07,parseInt(_0xbb2c('0xfa'),0x8));var _0x384376=require(_0xbb2c('0xfb'))[_0xbb2c('0xfc')](path[_0xbb2c('0x95')](__dirname,'../../components/import/cm/csv'),[_0x1bda07,_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xee')],_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xef')],_0x149c6b[_0xbb2c('0x91')]['ListId'],_0x149c6b[_0xbb2c('0x91')]['CompanyId'],_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xb9')],_0x149c6b[_0xbb2c('0x91')][_0xbb2c('0xf0')]]);return _0x453d9c['status'](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x384376[_0xbb2c('0xfd')]});}catch(_0x27e2a5){return _0x453d9c[_0xbb2c('0x12')](0x1f4)[_0xbb2c('0x21')](_0x27e2a5);}};exports[_0xbb2c('0xfe')]=function(_0x8aa743,_0x2db49d){var _0x5c102b=fs[_0xbb2c('0xff')](_0x8aa743[_0xbb2c('0xf7')][_0xbb2c('0x3')]);Papa[_0xbb2c('0x100')](_0x5c102b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xf6b12d){return _0x2db49d[_0xbb2c('0x12')](0xc8)['json']({'file':_0x8aa743['file'],'fields':_0xf6b12d[_0xbb2c('0x101')]['fields']});}});};exports['import']=function(_0x4a13f6,_0x481e1c){return db[_0xbb2c('0x4c')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xbb2c('0x78')}})['then'](function(_0x4b44c9){var _0xda2612=![];if(!_0x4a13f6[_0xbb2c('0x91')][_0xbb2c('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4a13f6['body'][_0xbb2c('0x102')][_0xbb2c('0xca')]){throw new Error(_0xbb2c('0xf3'));}if(!_0x4a13f6[_0xbb2c('0x91')][_0xbb2c('0x102')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x4a13f6[_0xbb2c('0x91')][_0xbb2c('0xf0')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x126b1d=require(_0xbb2c('0xfb'))[_0xbb2c('0xfc')](path[_0xbb2c('0x95')](__dirname,_0xbb2c('0x103')),[_0x4a13f6[_0xbb2c('0x89')]['id'],JSON[_0xbb2c('0x104')](_0x4a13f6[_0xbb2c('0x91')]),JSON[_0xbb2c('0x104')](_0x4b44c9)]);_0x126b1d['on'](_0xbb2c('0x105'),function(){_0xda2612=!![];return _0x481e1c[_0xbb2c('0x12')](0xc8)['json']({'message':_0xbb2c('0x106'),'pid':_0x126b1d[_0xbb2c('0xfd')]});});_0x126b1d['on'](_0xbb2c('0x107'),function(_0x582b22){if(_0x582b22&&!_0xda2612){return _0x481e1c['status'](0x1f4)['json']({'message':_0xbb2c('0x108'),'pid':_0x126b1d[_0xbb2c('0xfd')]});}});})['catch'](handleError(_0x481e1c,null));};exports[_0xbb2c('0x109')]=function(_0x30799a,_0x1dfdf0,_0x51b8b1){return db[_0xbb2c('0x4c')][_0xbb2c('0x90')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbb2c('0x78')}})[_0xbb2c('0x1b')](function(_0x99e126){var _0x5dfc66=![];if(!_0x30799a['body'][_0xbb2c('0x5b')]){throw new Error(_0xbb2c('0xed'));}if(!_0x30799a[_0xbb2c('0x91')][_0xbb2c('0x102')][_0xbb2c('0xca')]){throw new Error(_0xbb2c('0xf3'));}if(!_0x30799a[_0xbb2c('0x91')]['binding'][_0xbb2c('0xf4')]){throw new Error(_0xbb2c('0xf5'));}if(!_0x30799a['body'][_0xbb2c('0xf0')]){throw new Error(_0xbb2c('0xf1'));}var _0x51bc1b=require('child_process')[_0xbb2c('0xfc')](path['join'](__dirname,_0xbb2c('0x10a')),[_0x30799a[_0xbb2c('0x89')]['id'],JSON[_0xbb2c('0x104')](_0x30799a[_0xbb2c('0x91')]),JSON[_0xbb2c('0x104')](_0x99e126)]);_0x51bc1b['on'](_0xbb2c('0x105'),function(_0x54e3a1){_0x5dfc66=!![];return _0x1dfdf0['status'](0xc8)[_0xbb2c('0x13')]({'message':_0xbb2c('0x106'),'pid':_0x51bc1b['pid']});});_0x51bc1b['on'](_0xbb2c('0x107'),function(_0x576732){if(_0x576732&&!_0x5dfc66){return _0x1dfdf0[_0xbb2c('0x12')](0x1f4)[_0xbb2c('0x13')]({'message':'error\x20child\x20process','pid':_0x51bc1b[_0xbb2c('0xfd')]});}});})[_0xbb2c('0x88')](handleError(_0x1dfdf0,null));};exports[_0xbb2c('0x10b')]=function(_0x1ff5de,_0x17d4a4){var _0x23628d=[_0xbb2c('0x10c'),_0xbb2c('0x10d'),_0xbb2c('0x10e'),'openchannel',_0xbb2c('0x10f'),_0xbb2c('0x110'),'voice'];var _0x1c3387={'offset':0x0,'order':qs['sort']('-createdAt')},_0x526e0c={'count':0x0,'rows':[]};Promise[_0xbb2c('0x75')]()[_0xbb2c('0x1b')](function(){if(_0x1ff5de[_0xbb2c('0x30')][_0xbb2c('0x111')]){if(!_['includes'](_0x23628d,_0x1ff5de[_0xbb2c('0x30')]['channel'][_0xbb2c('0x112')]())){throw new Error(_0xbb2c('0x113'));}_0x23628d=[_0x1ff5de[_0xbb2c('0x30')]['channel'][_0xbb2c('0x112')]()];}if(_0x1ff5de[_0xbb2c('0x30')][_0xbb2c('0x114')]){try{var _0x53aa0c=JSON['parse'](_0x1ff5de[_0xbb2c('0x30')][_0xbb2c('0x114')]);if(!moment(_0x53aa0c[_0xbb2c('0x98')])['isValid']()){throw new Error(_0xbb2c('0x115'));}if(!moment(_0x53aa0c['to'])[_0xbb2c('0x116')]()){throw new Error(_0xbb2c('0x117'));}}catch(_0xd00669){throw new Error(_0xbb2c('0x118'));}}if(!_0x1ff5de['query']['hasOwnProperty'](_0xbb2c('0x35'))){_0x1c3387['limit']=qs[_0xbb2c('0x16')](_0x1ff5de['query'][_0xbb2c('0x16')]||0xa);_0x1c3387[_0xbb2c('0x14')]=qs[_0xbb2c('0x14')](_0x1ff5de['query']['offset']);}var _0x59062d=_0x23628d[_0xbb2c('0x56')](function(_0x58f182){if(_0x58f182===_0xbb2c('0x119')){var _0x4ceafa={'attributes':['id',_0xbb2c('0x11a'),_0xbb2c('0x2e'),_0xbb2c('0x11b'),'destination','callerid',_0xbb2c('0x11c'),_0xbb2c('0x11d'),_0xbb2c('0x11e'),_0xbb2c('0x11f'),'createdAt','userDisposition','userSecondDisposition',_0xbb2c('0x120'),_0xbb2c('0x121')],'where':{'ContactId':_0x1ff5de[_0xbb2c('0x89')]['id']},'include':[{'model':db[_0xbb2c('0x4c')],'as':_0xbb2c('0x4c'),'attributes':['id',_0xbb2c('0x20'),_0xbb2c('0x122'),_0xbb2c('0x8d')]}],'order':[[_0xbb2c('0x123'),_0xbb2c('0x72')]]};if(_0x1ff5de[_0xbb2c('0x30')]['range']){_0x4ceafa[_0xbb2c('0x37')][_0xbb2c('0x123')]={'$gte':_0x53aa0c['from'],'$lte':_0x53aa0c['to']};}return db[_0xbb2c('0x124')][_0xbb2c('0x125')](_0x4ceafa)[_0xbb2c('0x1b')](function(_0x75b74c){_0x526e0c[_0xbb2c('0x17')]+=_0x75b74c[_0xbb2c('0x17')];return _[_0xbb2c('0x56')](_0x75b74c[_0xbb2c('0xe9')],function(_0x2212f2){var _0x15a3f2=_0x2212f2[_0xbb2c('0x92')]({'plain':!![]});_0x15a3f2['channel']=_0x58f182;if(_0x15a3f2['User']){_0x15a3f2[_0xbb2c('0x4c')]={'id':_0x15a3f2[_0xbb2c('0x4c')]['id'],'name':_0x15a3f2[_0xbb2c('0x4c')][_0xbb2c('0x20')],'fullname':_0x15a3f2[_0xbb2c('0x4c')]['fullname'],'alias':_0x15a3f2[_0xbb2c('0x4c')][_0xbb2c('0x8d')]};}return _0x15a3f2;});});}else{var _0x29a770=_[_0xbb2c('0x126')](_0x58f182)+(_0x58f182===_0xbb2c('0x10d')?'Website':_0xbb2c('0x127'));var _0x45248e={'attributes':['id',_0xbb2c('0x128'),_0xbb2c('0x129'),'createdAt',_0xbb2c('0x11f'),_0xbb2c('0x12a'),_0xbb2c('0x12b'),_0xbb2c('0x12c'),_0xbb2c('0x121'),_0x29a770+'Id'],'where':{'ContactId':_0x1ff5de[_0xbb2c('0x89')]['id']},'include':[{'model':db[_0x29a770],'as':'Account','attributes':['id',_0xbb2c('0x20'),_0xbb2c('0x12d')]},{'model':db[_0xbb2c('0x4c')],'as':_0xbb2c('0x12e'),'attributes':['id',_0xbb2c('0x20'),_0xbb2c('0x122')]},{'model':db[_0xbb2c('0xbd')],'as':_0xbb2c('0x86'),'attributes':['id',_0xbb2c('0x20'),'color'],'through':{'attributes':[]}}],'order':[[_0xbb2c('0x123'),_0xbb2c('0x72')]]};if(_0x1ff5de[_0xbb2c('0x30')]['range']){_0x45248e['where']['createdAt']={'$gte':_0x53aa0c['from'],'$lte':_0x53aa0c['to']};}switch(_0x58f182){case _0xbb2c('0x10d'):_0x45248e[_0xbb2c('0x33')][_0xbb2c('0x59')](_0xbb2c('0x12f'),'customerIp','customerPort',_0xbb2c('0x130'),_0xbb2c('0x131'),'ratingMessage',_0xbb2c('0x132'),_0xbb2c('0x133'),_0xbb2c('0x134'));break;case _0xbb2c('0x10c'):_0x45248e[_0xbb2c('0x33')][_0xbb2c('0x59')](_0xbb2c('0x135'),'substatus');break;case _0xbb2c('0x136'):_0x45248e[_0xbb2c('0x33')][_0xbb2c('0x59')](_0xbb2c('0x137'),_0xbb2c('0x138'));break;}return db[_['startCase'](_0x58f182)+'Interaction'][_0xbb2c('0x125')](_0x45248e)['then'](function(_0x13edf5){_0x526e0c[_0xbb2c('0x17')]+=_0x13edf5[_0xbb2c('0x17')];return _[_0xbb2c('0x56')](_0x13edf5[_0xbb2c('0xe9')],function(_0xb243ce){var _0x5ac44f=_0xb243ce[_0xbb2c('0x92')]({'plain':!![]});_0x5ac44f[_0xbb2c('0x111')]=_0x58f182;if(_0x5ac44f['Owner']){_0x5ac44f['Owner']={'id':_0x5ac44f[_0xbb2c('0x12e')]['id'],'name':_0x5ac44f[_0xbb2c('0x12e')]['name'],'fullname':_0x5ac44f[_0xbb2c('0x12e')][_0xbb2c('0x122')]};}return _0x5ac44f;});});}});return Promise['all'](_0x59062d);})[_0xbb2c('0x1b')](function(_0x473ce1){return _(_0x473ce1)['flatten']()[_0xbb2c('0x139')](_0xbb2c('0x123'))['reverse']()[_0xbb2c('0x48')]();})['then'](function(_0xcd8ea5){_0x526e0c[_0xbb2c('0xe9')]=_0x1c3387[_0xbb2c('0x16')]?_0xcd8ea5['slice'](_0x1c3387[_0xbb2c('0x14')],_0x1c3387[_0xbb2c('0x14')]+_0x1c3387[_0xbb2c('0x16')]):_0xcd8ea5;return _0x526e0c;})[_0xbb2c('0x1b')](respondWithFilteredResult(_0x17d4a4,_0x1c3387))['catch'](handleError(_0x17d4a4,null));}; \ No newline at end of file +var _0x2eab=['CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','isNil','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','$or','spread','contact','all','show','params','Tag','CmContactHasItem','ContactItemType','ItemType','literal','Phones.OrderBy','$and','CmCustomField','omit','format','cf_%d','pickBy','table','setFields','toParam','phone','rawAttributes','pick','options','getTags','nolimit','setTags','items','item_types','ItemTypeId','description','item','OrderBy','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','meta','binding','No\x20phone\x20column\x20specified','firstName','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','message','getJourney','openchannel','fax','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','VoiceCallReport','findAndCountAll','Website','Account','closed','disposition','secondDisposition','key','Owner','chat','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','subject','substatus','threadId','startCase','flatten','sortBy','slice','moment','bluebird','util','path','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','redis','localhost','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','findOne','trimStart','fieldType','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','parseSearch','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','datetime','castTo','DATE','buildExpression','text','filter','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','where','resolve','role','agent','getLists','c.ListId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','tags','columnName','displayName','analytics','findAll','custom','type','values','body','get','mergeWith','isArray','join','info'];(function(_0x35c514,_0x22bb8a){var _0x448f20=function(_0x54f93a){while(--_0x54f93a){_0x35c514['push'](_0x35c514['shift']());}};_0x448f20(++_0x22bb8a);}(_0x2eab,0x1db));var _0xb2ea=function(_0x33c94c,_0x57a857){_0x33c94c=_0x33c94c-0x0;var _0x22d438=_0x2eab[_0x33c94c];return _0x22d438;};'use strict';var moment=require(_0xb2ea('0x0'));var BPromise=require(_0xb2ea('0x1'));var util=require(_0xb2ea('0x2'));var path=require(_0xb2ea('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xb2ea('0x4'));var Redis=require(_0xb2ea('0x5'));var qs=require(_0xb2ea('0x6'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xb2ea('0x7'))(_0xb2ea('0x8'));var config=require(_0xb2ea('0x9'));var shared=require(_0xb2ea('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb2ea('0xb')](config[_0xb2ea('0xc')],{'host':_0xb2ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0xb2ea('0xe')](socket);function respondWithResult(_0x395274,_0x96ffe8){_0x96ffe8=_0x96ffe8||0xc8;return function(_0x585d1d){if(_0x585d1d){return _0x395274[_0xb2ea('0xf')](_0x96ffe8)[_0xb2ea('0x10')](_0x585d1d);}};}function respondWithFilteredResult(_0x30ae30,_0x4dea96){return function(_0xbbeccc){if(_0xbbeccc){var _0x3e031c=typeof _0x4dea96[_0xb2ea('0x11')]===_0xb2ea('0x12')&&typeof _0x4dea96[_0xb2ea('0x13')]===_0xb2ea('0x12');var _0x600632=_0xbbeccc[_0xb2ea('0x14')];var _0x3f72c5=_0x3e031c?0x0:_0x4dea96[_0xb2ea('0x11')];var _0x5e8e74=_0x3e031c?_0xbbeccc[_0xb2ea('0x14')]:_0x4dea96[_0xb2ea('0x11')]+_0x4dea96[_0xb2ea('0x13')];var _0x3f836f;if(_0x5e8e74>=_0x600632){_0x5e8e74=_0x600632;_0x3f836f=0xc8;}else{_0x3f836f=0xce;}_0x30ae30[_0xb2ea('0xf')](_0x3f836f);return _0x30ae30[_0xb2ea('0x15')](_0xb2ea('0x16'),_0x3f72c5+'-'+_0x5e8e74+'/'+_0x600632)[_0xb2ea('0x10')](_0xbbeccc);}return null;};}function saveUpdates(_0x9ada34){return function(_0x296de4){if(_0x296de4){return _0x296de4[_0xb2ea('0x17')](_0x9ada34)[_0xb2ea('0x18')](function(_0x36476a){return _0x36476a;});}return null;};}function removeEntity(_0x4ac43f){return function(_0x2607ed){if(_0x2607ed){return _0x2607ed[_0xb2ea('0x19')]()[_0xb2ea('0x18')](function(){_0x4ac43f['status'](0xcc)[_0xb2ea('0x1a')]();});}};}function handleEntityNotFound(_0x4cba9e){return function(_0x1ab6c2){if(!_0x1ab6c2){_0x4cba9e['sendStatus'](0x194);}return _0x1ab6c2;};}function handleError(_0x21911e,_0x3e6ffc){_0x3e6ffc=_0x3e6ffc||0x1f4;return function(_0x2b2193){logger[_0xb2ea('0x1b')](_0x2b2193[_0xb2ea('0x1c')]);if(_0x2b2193[_0xb2ea('0x1d')]){delete _0x2b2193['name'];}_0x21911e[_0xb2ea('0xf')](_0x3e6ffc)[_0xb2ea('0x1e')](_0x2b2193);};}exports[_0xb2ea('0x1f')]=function(_0x4c13ce,_0x24d742){var _0x54f3c7={},_0x285873={},_0xf7f768={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()[_0xb2ea('0x18')](function(_0x5a1e05){var _0x189ee9=[];for(var _0x57bbd7=0x0;_0x57bbd70x1){_0x59dfa6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb2ea('0x5b')](_0x3de1f5),null);}else{if(qs[_0xb2ea('0x5c')](_0x3de1f5)){_0x59dfa6['or'](_0xb2ea('0x5d'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x5e'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x5f'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x60'),_0x3de1f5+'%');}else if(qs[_0xb2ea('0x61')](_0x3de1f5)){_0x59dfa6['or'](_0xb2ea('0x62'),_0x3de1f5+'%');}else{_0x59dfa6['or']('c.firstName\x20LIKE\x20?','%'+_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x63'),'%'+_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x62'),'%'+_0x3de1f5+'%');}}}}_0x20f045['where'](_0x59dfa6);_0x20f045[_0xb2ea('0x64')]('c.id');var _0x3f572f={'type':db[_0xb2ea('0x65')][_0xb2ea('0x66')]['SELECT'],'raw':!![]};var _0x452bcb=_0x20f045[_0xb2ea('0x67')]()[_0xb2ea('0x33')]('c.id');if(_0x54f3c7['order']){_0x54f3c7['order'][_0xb2ea('0x46')](function(_0x376261){_0x20f045[_0xb2ea('0x30')]('c.'+_0x376261[0x0],_0x376261[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x41aa42)){_0x20f045['having'](_0x1addef);_0x452bcb[_0xb2ea('0x68')]('t.id\x20IN\x20?',_0x41aa42);}BPromise[_0xb2ea('0x69')]()[_0xb2ea('0x18')](function(){if(!_0x52dd86)return;if(_0x4c13ce['user'][_0xb2ea('0x6a')]!==_0xb2ea('0x6b'))return;if(!_['some'](_0x52dd86[_0xb2ea('0x41')],[_0xb2ea('0x33'),'User'])){return _0x4c13ce['user'][_0xb2ea('0x6c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5deeb1){if(_[_0xb2ea('0x53')](_0x5deeb1)){_0x452bcb['where']('c.ListId\x20IS\x20NULL');_0x20f045[_0xb2ea('0x68')](_0xb2ea('0x6d'));}else{_0x452bcb[_0xb2ea('0x68')]('c.ListId\x20IN\x20?',_[_0xb2ea('0x45')](_0x5deeb1,'id'));_0x20f045[_0xb2ea('0x68')](_0xb2ea('0x55'),_[_0xb2ea('0x45')](_0x5deeb1,'id'));}});}})['then'](function(){if(_0x4c13ce[_0xb2ea('0x6e')][_0xb2ea('0x6a')]===_0xb2ea('0x6b')&&!_0x52dd86&&!_0x4c13ce[_0xb2ea('0x2a')]['ListId'])return[];return db[_0xb2ea('0x6f')][_0xb2ea('0x2a')](_0x452bcb[_0xb2ea('0x70')](),_0x3f572f);})[_0xb2ea('0x18')](function(_0x24a37a){_0xf7f768[_0xb2ea('0x14')]=_0x24a37a[_0xb2ea('0x23')];if(_0xf7f768[_0xb2ea('0x14')]===0x0)return[];return db['sequelize']['query'](_0xb3247[_0xb2ea('0x70')](),_0x3f572f)[_0xb2ea('0x18')](function(_0x2e7be4){_0x5978b6=_[_0xb2ea('0x71')](_0x2e7be4,'id');_0x3f572f=_[_0xb2ea('0x72')](_0x3f572f,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c13ce['query'][_0xb2ea('0x2e')]){_0x54f3c7['attributes'][_0xb2ea('0x46')](function(_0x3ea8e2){_0x20f045[_0xb2ea('0x33')]('c.'+_0x3ea8e2);});}else{_0x20f045[_0xb2ea('0x33')]('c.id');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x73'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x74'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x75'));_0x20f045[_0xb2ea('0x33')]('c.mobile');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x76'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x77'));_0x20f045[_0xb2ea('0x33')]('c.ListId');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x78'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x79'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x7a'));_0x20f045[_0xb2ea('0x33')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x54f3c7[_0xb2ea('0x13')])_0x20f045[_0xb2ea('0x13')](_0x54f3c7[_0xb2ea('0x13')]);if(_0x54f3c7[_0xb2ea('0x11')])_0x20f045['offset'](_0x54f3c7[_0xb2ea('0x11')]);return db[_0xb2ea('0x6f')][_0xb2ea('0x2a')](_0x20f045[_0xb2ea('0x70')](),_0x3f572f);});})[_0xb2ea('0x18')](function(_0x437f42){_0x437f42['forEach'](function(_0x1e8b21){if(_0x1e8b21[_0xb2ea('0x7b')]){_0x1e8b21[_0xb2ea('0x7c')]=[];_0x1e8b21[_0xb2ea('0x7b')][_0xb2ea('0x44')](',')[_0xb2ea('0x46')](function(_0xa3ce57){_0x1e8b21['Tags'][_0xb2ea('0x52')](_0x5978b6[_0xa3ce57]);});}delete _0x1e8b21[_0xb2ea('0x7b')];});_0xf7f768[_0xb2ea('0x7d')]=_0x437f42;return _0xf7f768;})['then'](respondWithFilteredResult(_0x24d742,_0x54f3c7));})[_0xb2ea('0x7e')](handleError(_0x24d742,null));};exports[_0xb2ea('0x19')]=function(_0x322d61,_0x34fbe1){return db['CmContact'][_0xb2ea('0x42')]({'where':{'id':_0x322d61['params']['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x34fbe1,null))[_0xb2ea('0x18')](removeEntity(_0x34fbe1,null))[_0xb2ea('0x7e')](handleError(_0x34fbe1,null));};exports[_0xb2ea('0x21')]=function(_0x803d3a,_0x264e78){return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()[_0xb2ea('0x18')](function(_0x2c6e71){delete _0x2c6e71[_0xb2ea('0x7f')];for(var _0x46c7a0=0x0;_0x46c7a00x0){return new Promise(function(_0x567baf,_0x3c1b1b){var _0x1b70b0=[];for(var _0x458f46=0x0;_0x458f46<_0x2075ff['length'];_0x458f46++){_0x1b70b0['push'](insertAdditionalPhones(_0x2075ff[_0x458f46][_0xb2ea('0xac')],_0x2075ff[_0x458f46][_0xb2ea('0xa6')]));}Promise[_0xb2ea('0xad')](_0x1b70b0)[_0xb2ea('0x18')](function(){_0x567baf(0x1);});})[_0xb2ea('0x18')](function(){return{'success':_0x363288,'failure':_0x4afde7,'duplicates':_0x58600a};});}else{return{'success':_0x363288,'failure':_0x4afde7,'duplicates':_0x58600a};}}})[_0xb2ea('0x18')](respondWithResult(_0x4f329c,0xc9))[_0xb2ea('0x7e')](handleError(_0x4f329c,null));};exports[_0xb2ea('0xae')]=function(_0x2630fc,_0x3b3265){var _0x2aae49;return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()['then'](function(_0x13a9df){return db[_0xb2ea('0x20')][_0xb2ea('0x42')]({'where':{'id':_0x2630fc[_0xb2ea('0xaf')]['id']},'include':[{'model':db[_0xb2ea('0xb0')],'as':'Tags','attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x34')],'required':_0x2630fc[_0xb2ea('0x2a')][_0xb2ea('0x59')]?!![]:![]},{'model':db[_0xb2ea('0xb1')],'as':'Phones','where':{'CmContactId':_0x2630fc[_0xb2ea('0xaf')]['id']},'required':![],'include':[{'model':db[_0xb2ea('0xb2')],'as':_0xb2ea('0xb3')}]}],'order':[db['sequelize'][_0xb2ea('0xb4')](_0xb2ea('0xb5'))],'attributes':_[_0xb2ea('0x22')](_0x13a9df)});})[_0xb2ea('0x18')](function(_0x78c5c3){if(!_[_0xb2ea('0xa3')](_0x78c5c3)){_0x2aae49=_0x78c5c3[_0xb2ea('0x88')]({'plain':!![]});var _0x11c3ce={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x78c5c3&&_0x78c5c3[_0xb2ea('0x54')]){if(_0x78c5c3[_0xb2ea('0x54')]){_0x11c3ce[_0xb2ea('0x68')][_0xb2ea('0xb6')][_0xb2ea('0x52')]({'ListId':{'$ne':_0x78c5c3['ListId']}});}}return db[_0xb2ea('0xb7')][_0xb2ea('0x83')](_0x11c3ce);}})[_0xb2ea('0x18')](function(_0x86c520){if(!_[_0xb2ea('0xa3')](_0x86c520)){return _[_0xb2ea('0xb8')](_0x2aae49,_[_0xb2ea('0x45')](_0x86c520,function(_0x35bb15){return util[_0xb2ea('0xb9')](_0xb2ea('0xba'),_0x35bb15['id']);}));}})[_0xb2ea('0x18')](handleEntityNotFound(_0x3b3265,null))[_0xb2ea('0x18')](respondWithResult(_0x3b3265,null))['catch'](handleError(_0x3b3265,null));};exports[_0xb2ea('0x17')]=function(_0x21b9ea,_0x52e98c){var _0x21a7bd;if(_0x21b9ea[_0xb2ea('0x87')]['id']){delete _0x21b9ea[_0xb2ea('0x87')]['id'];}if(!_[_0xb2ea('0xa3')](_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa2')])){var _0x180b30=_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa2')];if(!_[_0xb2ea('0xa3')](shared['timezones'][_0x180b30]))_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa4')]=shared[_0xb2ea('0xa5')][_0x180b30][_0xb2ea('0xa4')];}return db['CmContact']['find']({'where':{'id':_0x21b9ea[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x52e98c,null))[_0xb2ea('0x18')](saveUpdates(_0x21b9ea[_0xb2ea('0x87')],null))[_0xb2ea('0x18')](function(_0xa3f21b){_0x21a7bd=_0xa3f21b;var _0x701ebb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xa3f21b&&_0xa3f21b[_0xb2ea('0x54')]){if(_0xa3f21b['ListId']){_0x701ebb['where']['$and'][_0xb2ea('0x52')]({'ListId':{'$ne':_0xa3f21b[_0xb2ea('0x54')]}});}}return db[_0xb2ea('0xb7')][_0xb2ea('0x83')](_0x701ebb);})[_0xb2ea('0x18')](function(_0x184085){if(_0x184085){return _['omit'](_[_0xb2ea('0xbb')](_0x21b9ea[_0xb2ea('0x87')],function(_0x4a2818,_0x326dbf){return _[_0xb2ea('0x24')](_0x326dbf,_0xb2ea('0x25'));}),_[_0xb2ea('0x45')](_0x184085,function(_0x452613){return util[_0xb2ea('0xb9')]('cf_%d',_0x452613['id']);}));}})[_0xb2ea('0x18')](function(_0x1bb03c){if(_0x1bb03c&&!_[_0xb2ea('0x53')](_0x1bb03c)){var _0x21d6a9=squel[_0xb2ea('0x17')]()[_0xb2ea('0xbc')](_0xb2ea('0x37'))[_0xb2ea('0xbd')](_0x1bb03c)[_0xb2ea('0x68')]('id\x20=\x20?',_0x21b9ea[_0xb2ea('0xaf')]['id'])[_0xb2ea('0xbe')]();return db['sequelize'][_0xb2ea('0x2a')](_0x21d6a9[_0xb2ea('0x50')],{'replacements':_0x21d6a9[_0xb2ea('0x86')]});}})[_0xb2ea('0x18')](function(){if(_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xbf')]&&_0x21a7bd){return db['CmHopper'][_0xb2ea('0x17')]({'phone':_0x21b9ea['body'][_0xb2ea('0xbf')],'OrderBy':0x0},{'where':{'ContactId':_0x21a7bd['id']}});}})[_0xb2ea('0x18')](function(){return _0x21a7bd;})[_0xb2ea('0x18')](respondWithResult(_0x52e98c,null))[_0xb2ea('0x7e')](handleError(_0x52e98c,null));};exports['getTags']=function(_0x5267a1,_0x4b4b2b){var _0x236747={};var _0x5b0812={};var _0x2f67cb;var _0x451b59;return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x5267a1[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x4b4b2b,null))['then'](function(_0x3e5de8){if(_0x3e5de8){_0x2f67cb=_0x3e5de8;_0x5b0812['model']=_[_0xb2ea('0x22')](db[_0xb2ea('0xb0')][_0xb2ea('0xc0')]);_0x5b0812[_0xb2ea('0x2a')]=_['keys'](_0x5267a1[_0xb2ea('0x2a')]);_0x5b0812[_0xb2ea('0x2b')]=_['intersection'](_0x5b0812[_0xb2ea('0x29')],_0x5b0812[_0xb2ea('0x2a')]);_0x236747[_0xb2ea('0x2d')]=_['intersection'](_0x5b0812[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x5267a1['query'][_0xb2ea('0x2e')]));_0x236747[_0xb2ea('0x2d')]=_0x236747[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x236747[_0xb2ea('0x2d')]:_0x5b0812[_0xb2ea('0x29')];_0x236747[_0xb2ea('0x30')]=qs[_0xb2ea('0x31')](_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x236747[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x5267a1[_0xb2ea('0x2a')],_0x5b0812[_0xb2ea('0x2b')]));if(_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x236747[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x236747[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x236747[_0xb2ea('0x2d')],function(_0x19a987){var _0x12675e={};_0x12675e[_0x19a987]={'$like':'%'+_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x12675e;})});}_0x236747=_[_0xb2ea('0x72')]({},_0x236747,_0x5267a1[_0xb2ea('0xc2')]);return _0x2f67cb[_0xb2ea('0xc3')](_0x236747);}})[_0xb2ea('0x18')](function(_0x577466){if(_0x577466){_0x451b59=_0x577466[_0xb2ea('0x23')];if(!_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x2f')](_0xb2ea('0xc4'))){_0x236747[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x236747['offset']=qs[_0xb2ea('0x11')](_0x5267a1['query'][_0xb2ea('0x11')]);}return _0x2f67cb[_0xb2ea('0xc3')](_0x236747);}})[_0xb2ea('0x18')](function(_0x332757){if(_0x332757){return _0x332757?{'count':_0x451b59,'rows':_0x332757}:null;}})[_0xb2ea('0x18')](respondWithResult(_0x4b4b2b,null))[_0xb2ea('0x7e')](handleError(_0x4b4b2b,null));};exports[_0xb2ea('0xc5')]=function(_0x4296b2,_0x592d24){if(_0x4296b2[_0xb2ea('0x87')]['id']){delete _0x4296b2['body']['id'];}return db[_0xb2ea('0x20')][_0xb2ea('0x26')]({'where':{'id':_0x4296b2['params']['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x592d24,null))[_0xb2ea('0x18')](function(_0x1409fe){if(_0x1409fe){return _0x1409fe[_0xb2ea('0xc5')](_0x4296b2[_0xb2ea('0x87')]['ids']||[]);}return null;})[_0xb2ea('0x18')](respondWithResult(_0x592d24,null))[_0xb2ea('0x7e')](handleError(_0x592d24,null));};exports['setAdditionalPhones']=function(_0x52b57f,_0x561864){var _0x5d5075=[];_0x5d5075[_0xb2ea('0x52')](addAdditionalPhones(_0x52b57f['body']));Promise[_0xb2ea('0xad')](_0x5d5075)['then'](function(){_0x5d5075=[];_0x5d5075[_0xb2ea('0x52')](deleteCmHopperPhones(_0x52b57f['body']['id']));_0x5d5075[_0xb2ea('0x52')](addCmHopperPhones(_0x52b57f[_0xb2ea('0x87')]['id']));Promise[_0xb2ea('0xad')](_0x5d5075)[_0xb2ea('0x18')](function(){return[0x1];})[_0xb2ea('0x18')](respondWithResult(_0x561864,null));});};function addAdditionalPhones(_0x15922d){var _0x353d03;return new Promise(function(_0xeab48f,_0x1e9a4d){return db[_0xb2ea('0xb1')]['destroy']({'where':{'CmContactId':_0x15922d['id']}})[_0xb2ea('0x18')](function(){db[_0xb2ea('0xb2')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id','OrderBy']})[_0xb2ea('0x18')](function(_0x190bc4){var _0x49b3ad=[];for(var _0xb0cf74=0x0;_0xb0cf74<_0x15922d[_0xb2ea('0xc6')][_0xb2ea('0x23')];_0xb0cf74++){var _0x235c9b=_0x15922d[_0xb2ea('0xc7')]?_[_0xb2ea('0xa3')](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])?'':_0x15922d[_0xb2ea('0xc7')][_0xb0cf74]:_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc8')]?_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]:'';var _0x3c95bf=_[_0xb2ea('0xa3')](_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc9')])?'':_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc9')];var _0x1a289f=_0x235c9b+':'+_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xbf')]+'§'+_0x3c95bf;if(_[_0xb2ea('0xa3')](_0x353d03))_0x353d03=_0x1a289f;else _0x353d03+=';'+_0x1a289f;var _0x4a129a=null;if(_0x15922d[_0xb2ea('0xc7')]){if(!_[_0xb2ea('0xa3')](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])){var _0x3aabb6=_[_0xb2ea('0x42')](_0x190bc4,function(_0x536584){return _0x536584['id']===_0x15922d[_0xb2ea('0xc7')][_0xb0cf74];});if(!_['isNil'](_0x3aabb6)){_0x4a129a=_0x3aabb6['OrderBy'];}}}else{if(!_[_0xb2ea('0xa3')](_0x15922d['items'][_0xb0cf74])){var _0x3aabb6=_[_0xb2ea('0x42')](_0x190bc4,function(_0x4a01bb){return _0x4a01bb['id']===_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc8')];});if(!_[_0xb2ea('0xa3')](_0x3aabb6)){_0x4a129a=_0xb0cf74;}}}if(_[_0xb2ea('0xa3')](_0x4a129a)){_0x4a129a=0x64;}_0x49b3ad[_0xb2ea('0x52')](addAdditionalPhone(_0x15922d['id'],_0x15922d['items'][_0xb0cf74][_0xb2ea('0xbf')],_0x15922d[_0xb2ea('0xc7')]?_['isNil'](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])?null:_0x15922d[_0xb2ea('0xc7')][_0xb0cf74]:_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]?_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]:null,_0x4a129a,_0x3c95bf));}Promise[_0xb2ea('0xad')](_0x49b3ad)['then'](function(){db[_0xb2ea('0x20')][_0xb2ea('0x17')]({'AdditionalPhones':_0x353d03},{'where':{'id':_0x15922d['id']}})[_0xb2ea('0x18')](function(){_0xeab48f(0x1);});});});});});}function addAdditionalPhone(_0x2954a8,_0x5b76f4,_0x4d94bf,_0x1cc10d,_0x58047d){return db[_0xb2ea('0xb1')][_0xb2ea('0x42')]({'where':{'CmContactId':_0x2954a8,'item':_0x5b76f4}})[_0xb2ea('0x18')](function(_0x360916){if(_0x360916)logger[_0xb2ea('0x8c')]('contact\x20phone\x20exists',_0x360916);else{db[_0xb2ea('0xb1')][_0xb2ea('0x8f')]({'CmContactId':_0x2954a8,'item':_0x5b76f4,'ItemTypeId':_0x4d94bf,'OrderBy':_0x1cc10d,'ItemClass':'PHONE','description':_0x58047d});}});}function deletePhones(_0x4282ae){return db[_0xb2ea('0xb1')][_0xb2ea('0x19')]({'where':{'CmContactId':_0x4282ae}});}function deleteCmHopperPhones(_0x2d6502){return new Promise(function(_0x42ebb7,_0x28cc2c){return db[_0xb2ea('0x8d')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2d6502}})[_0xb2ea('0x18')](function(_0x2ab493){db['CmHopperAdditionalPhone'][_0xb2ea('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x2ab493,'id')}}});})[_0xb2ea('0x18')](function(){_0x42ebb7(0x1);});});}function addCmHopperPhones(_0x1cff38){return new Promise(function(_0x565b55,_0x17dffa){return db[_0xb2ea('0x8d')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1cff38}})[_0xb2ea('0x18')](function(_0x512f66){var _0x4e2f65=[];_['map'](_0x512f66,function(_0x2105ef){_0x4e2f65['push'](createCmHopperPhone(_0x1cff38,_0x2105ef['id']));});Promise[_0xb2ea('0xad')](_0x4e2f65)['then'](function(){_0x565b55(0x1);});});});}function createCmHopperPhone(_0x4a8d57,_0x5277da){return new Promise(function(_0xf913d0,_0xb17704){db[_0xb2ea('0xb1')]['findAll']({'raw':!![],'attributes':[_0xb2ea('0xca'),_0xb2ea('0xcb')],'where':{'CmContactId':_0x4a8d57,'ItemClass':_0xb2ea('0xcc')},'include':[{'model':db[_0xb2ea('0xb2')],'attributes':[_0xb2ea('0xcb')],'as':'ItemType'}],'order':['OrderBy',db[_0xb2ea('0x6f')][_0xb2ea('0xb4')]('`ItemType`.OrderBy')]})['then'](function(_0x4353f9){var _0x1fa33d=0x1;var _0x28a940=_['map'](_0x4353f9,function(_0x17bf6e){_0x17bf6e[_0xb2ea('0xcd')]=_0x5277da;_0x17bf6e[_0xb2ea('0xbf')]=_0x17bf6e[_0xb2ea('0xca')];_0x17bf6e[_0xb2ea('0xcb')]=_0x1fa33d;delete _0x17bf6e[_0xb2ea('0xce')];_0x1fa33d=_0x1fa33d+0x1;return _0x17bf6e;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x28a940,{});})[_0xb2ea('0x18')](function(){_0xf913d0(0x1);});});}function insertAdditionalPhones(_0x59b817,_0x483448){return new Promise(function(_0x2b4c66,_0x5da860){var _0x4a7738=[];for(var _0x32684f=0x0;_0x32684f<_0x483448['length'];_0x32684f++){var _0x493a06=_0x483448[_0x32684f];_0x4a7738[_0xb2ea('0x52')](parseContactItemType(_0x493a06));}Promise[_0xb2ea('0xad')](_0x4a7738)[_0xb2ea('0x18')](function(){var _0x1a4ff5={'id':_0x59b817['id'],'items':_0x483448};return addAdditionalPhones(_0x1a4ff5)[_0xb2ea('0x18')](function(_0x17f215){return addCmHopperPhones(_0x59b817['id']);});})['then'](function(){_0x2b4c66(_0x59b817);});});}function parseContactItemType(_0x397b61){return new Promise(function(_0x186812,_0x3816c9){if(_0x397b61['hasOwnProperty'](_0xb2ea('0xc8'))){_0x186812(_0x397b61);}else{return db[_0xb2ea('0xb2')][_0xb2ea('0x42')]({'where':{'name':_0x397b61[_0xb2ea('0xb3')]}})[_0xb2ea('0x18')](function(_0x1b8888){if(_[_0xb2ea('0xa3')](_0x1b8888))_0x397b61[_0xb2ea('0xc8')]=null;else _0x397b61[_0xb2ea('0xc8')]=_0x1b8888['id'];_0x186812(_0x397b61);});}});}exports[_0xb2ea('0xcf')]=function(_0x5f3900,_0x3e7d86){return db[_0xb2ea('0xb1')][_0xb2ea('0x83')]({'raw':!![],'where':{'CmContactId':_0x5f3900[_0xb2ea('0xaf')]['id'],'ItemClass':_0xb2ea('0xcc')},'include':[{'model':db[_0xb2ea('0xb2')],'as':_0xb2ea('0xb3')}],'order':[[_0xb2ea('0xcb')],[db[_0xb2ea('0x6f')][_0xb2ea('0xb4')](_0xb2ea('0xd0'))]]})[_0xb2ea('0x18')](function(_0x593624){return _0x593624;})[_0xb2ea('0x18')](respondWithResult(_0x3e7d86,null))[_0xb2ea('0x7e')](handleError(_0x3e7d86,null));};exports[_0xb2ea('0xd1')]=function(_0x3dc690,_0x4122d3){return db['CmContactHasItem'][_0xb2ea('0x83')]({'raw':!![],'where':{'CmContactId':_0x3dc690[_0xb2ea('0x87')]['fromContactId']}})[_0xb2ea('0x18')](function(_0xbf66a4){var _0xe5bf6d=_[_0xb2ea('0x45')](_0xbf66a4,function(_0x3adf9a){_0x3adf9a[_0xb2ea('0xd2')]=_0x3dc690[_0xb2ea('0x87')][_0xb2ea('0xd3')];return _0x3adf9a;});return db[_0xb2ea('0xb1')]['bulkCreate'](_0xe5bf6d,{});})['then'](function(_0x248cad){return addCmHopperPhones(_0x3dc690[_0xb2ea('0x87')][_0xb2ea('0xd3')]);})[_0xb2ea('0x18')](function(_0x1f76d2){return['ok'];})[_0xb2ea('0x18')](respondWithResult(_0x4122d3,null))[_0xb2ea('0x7e')](handleError(_0x4122d3,null));};exports[_0xb2ea('0xd4')]=function(_0x9f6813,_0x908df0){var _0x46b440=[];_0x46b440['push'](createCmHopperPhone(_0x9f6813[_0xb2ea('0x87')]['id'],_0x9f6813[_0xb2ea('0x87')]['hopperId']));Promise[_0xb2ea('0xad')](_0x46b440)[_0xb2ea('0x18')](function(){return[0x1];})[_0xb2ea('0x18')](respondWithResult(_0x908df0,null));};exports[_0xb2ea('0xd5')]=function(_0x3c5480,_0x1c7b5a){var _0x433346={'raw':![],'where':{}};var _0x1c253c={};var _0x1c6d8e={'count':0x0,'rows':[]};return db['CmContact'][_0xb2ea('0x26')]({'where':{'id':_0x3c5480[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x1c7b5a,null))[_0xb2ea('0x18')](function(_0x49b9da){if(_0x49b9da){_0x1c253c['model']=_[_0xb2ea('0x22')](db[_0xb2ea('0x8d')][_0xb2ea('0xc0')]);_0x1c253c['query']=_[_0xb2ea('0x22')](_0x3c5480[_0xb2ea('0x2a')]);_0x1c253c['filters']=_[_0xb2ea('0x2c')](_0x1c253c[_0xb2ea('0x29')],_0x1c253c[_0xb2ea('0x2a')]);_0x433346['attributes']=_[_0xb2ea('0x2c')](_0x1c253c['model'],qs[_0xb2ea('0x2e')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x433346['attributes']=_0x433346[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x433346['attributes']:_0x1c253c[_0xb2ea('0x29')];if(!_0x3c5480[_0xb2ea('0x2a')]['hasOwnProperty']('nolimit')){_0x433346[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x433346[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x11')]);}_0x433346[_0xb2ea('0x30')]=qs['sort'](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x433346[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x3c5480[_0xb2ea('0x2a')],_0x1c253c[_0xb2ea('0x2b')]));_0x433346[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x49b9da['id'];if(_0x3c5480[_0xb2ea('0x2a')]['filter']){_0x433346[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x433346['where'],{'$or':_[_0xb2ea('0x45')](_0x433346[_0xb2ea('0x2d')],function(_0x59c150){var _0x48efb5={};_0x48efb5[_0x59c150]={'$like':'%'+_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x48efb5;})});}_0x433346=_[_0xb2ea('0x72')]({},_0x433346,_0x3c5480['options']);return db['CmHopper'][_0xb2ea('0x14')]({'where':_0x433346[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x2b6b99){_0x1c6d8e[_0xb2ea('0x14')]=_0x2b6b99;if(_0x3c5480['query'][_0xb2ea('0xd7')]){_0x433346[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0x8d')][_0xb2ea('0x83')](_0x433346);})[_0xb2ea('0x18')](function(_0x3623cf){_0x1c6d8e[_0xb2ea('0x7d')]=_0x3623cf;return _0x1c6d8e;});}})[_0xb2ea('0x18')](respondWithFilteredResult(_0x1c7b5a,_0x433346))[_0xb2ea('0x7e')](handleError(_0x1c7b5a,null));};exports[_0xb2ea('0xd9')]=function(_0x3bbfcc,_0x205150){var _0x143edf={'raw':!![],'where':{}};var _0x2d9502={};var _0x301a30={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x3bbfcc[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x205150,null))[_0xb2ea('0x18')](function(_0x3eb17e){if(_0x3eb17e){_0x2d9502[_0xb2ea('0x29')]=_[_0xb2ea('0x22')](db[_0xb2ea('0xda')][_0xb2ea('0xc0')]);_0x2d9502['query']=_[_0xb2ea('0x22')](_0x3bbfcc[_0xb2ea('0x2a')]);_0x2d9502['filters']=_['intersection'](_0x2d9502[_0xb2ea('0x29')],_0x2d9502['query']);_0x143edf['attributes']=_[_0xb2ea('0x2c')](_0x2d9502[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x3bbfcc[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x143edf[_0xb2ea('0x2d')]=_0x143edf[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x143edf[_0xb2ea('0x2d')]:_0x2d9502[_0xb2ea('0x29')];if(!_0x3bbfcc[_0xb2ea('0x2a')]['hasOwnProperty']('nolimit')){_0x143edf[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x3bbfcc['query'][_0xb2ea('0x13')]);_0x143edf[_0xb2ea('0x11')]=qs['offset'](_0x3bbfcc[_0xb2ea('0x2a')]['offset']);}_0x143edf[_0xb2ea('0x30')]=qs['sort'](_0x3bbfcc['query'][_0xb2ea('0x31')]);_0x143edf[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x3bbfcc[_0xb2ea('0x2a')],_0x2d9502[_0xb2ea('0x2b')]));_0x143edf[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x3eb17e['id'];if(_0x3bbfcc[_0xb2ea('0x2a')]['filter']){_0x143edf[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x143edf[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x143edf[_0xb2ea('0x2d')],function(_0x268c79){var _0x221b55={};_0x221b55[_0x268c79]={'$like':'%'+_0x3bbfcc[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x221b55;})});}_0x143edf=_[_0xb2ea('0x72')]({},_0x143edf,_0x3bbfcc[_0xb2ea('0xc2')]);return db[_0xb2ea('0xda')][_0xb2ea('0x14')]({'where':_0x143edf[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x4d0a66){_0x301a30[_0xb2ea('0x14')]=_0x4d0a66;if(_0x3bbfcc['query']['includeAll']){_0x143edf[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0xda')][_0xb2ea('0x83')](_0x143edf);})[_0xb2ea('0x18')](function(_0x2f19d8){_0x301a30[_0xb2ea('0x7d')]=_0x2f19d8;return _0x301a30;});}})[_0xb2ea('0x18')](respondWithFilteredResult(_0x205150,_0x143edf))[_0xb2ea('0x7e')](handleError(_0x205150,null));};exports[_0xb2ea('0xdb')]=function(_0x17b34d,_0x500f2c){var _0x55e99d={'raw':!![],'where':{}};var _0x4e4b34={};var _0x356390={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x17b34d[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x500f2c,null))[_0xb2ea('0x18')](function(_0x274a01){if(_0x274a01){_0x4e4b34[_0xb2ea('0x29')]=_['keys'](db[_0xb2ea('0x9a')][_0xb2ea('0xc0')]);_0x4e4b34[_0xb2ea('0x2a')]=_[_0xb2ea('0x22')](_0x17b34d['query']);_0x4e4b34['filters']=_['intersection'](_0x4e4b34['model'],_0x4e4b34[_0xb2ea('0x2a')]);_0x55e99d[_0xb2ea('0x2d')]=_[_0xb2ea('0x2c')](_0x4e4b34[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x55e99d[_0xb2ea('0x2d')]=_0x55e99d[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x55e99d['attributes']:_0x4e4b34[_0xb2ea('0x29')];if(!_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x2f')]('nolimit')){_0x55e99d[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x55e99d[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x17b34d[_0xb2ea('0x2a')]['offset']);}_0x55e99d['order']=qs[_0xb2ea('0x31')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x55e99d[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x17b34d[_0xb2ea('0x2a')],_0x4e4b34['filters']));_0x55e99d[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x274a01['id'];if(_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x55e99d[_0xb2ea('0x68')]=_['merge'](_0x55e99d[_0xb2ea('0x68')],{'$or':_['map'](_0x55e99d['attributes'],function(_0x10bd66){var _0x30be13={};_0x30be13[_0x10bd66]={'$like':'%'+_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x30be13;})});}_0x55e99d=_['merge']({},_0x55e99d,_0x17b34d['options']);return db[_0xb2ea('0x9a')][_0xb2ea('0x14')]({'where':_0x55e99d[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x28b15b){_0x356390[_0xb2ea('0x14')]=_0x28b15b;if(_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0xd7')]){_0x55e99d['include']=[{'all':!![]}];}return db[_0xb2ea('0x9a')][_0xb2ea('0x83')](_0x55e99d);})[_0xb2ea('0x18')](function(_0x59f029){_0x356390['rows']=_0x59f029;return _0x356390;});}})['then'](respondWithFilteredResult(_0x500f2c,_0x55e99d))[_0xb2ea('0x7e')](handleError(_0x500f2c,null));};exports[_0xb2ea('0xdc')]=function(_0x18ed9f,_0x52dac0){var _0x2a59d2={'raw':!![],'where':{}};var _0x8a1f97={};var _0x224759={'count':0x0,'rows':[]};return db['CmContact'][_0xb2ea('0x26')]({'where':{'id':_0x18ed9f[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x52dac0,null))['then'](function(_0x594bee){if(_0x594bee){_0x8a1f97[_0xb2ea('0x29')]=_[_0xb2ea('0x22')](db[_0xb2ea('0x9f')]['rawAttributes']);_0x8a1f97[_0xb2ea('0x2a')]=_['keys'](_0x18ed9f[_0xb2ea('0x2a')]);_0x8a1f97[_0xb2ea('0x2b')]=_[_0xb2ea('0x2c')](_0x8a1f97['model'],_0x8a1f97[_0xb2ea('0x2a')]);_0x2a59d2['attributes']=_['intersection'](_0x8a1f97[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x18ed9f['query'][_0xb2ea('0x2e')]));_0x2a59d2['attributes']=_0x2a59d2[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x2a59d2[_0xb2ea('0x2d')]:_0x8a1f97[_0xb2ea('0x29')];if(!_0x18ed9f[_0xb2ea('0x2a')]['hasOwnProperty'](_0xb2ea('0xc4'))){_0x2a59d2[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x2a59d2[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x11')]);}_0x2a59d2[_0xb2ea('0x30')]=qs[_0xb2ea('0x31')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x2a59d2[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x18ed9f[_0xb2ea('0x2a')],_0x8a1f97[_0xb2ea('0x2b')]));_0x2a59d2[_0xb2ea('0x68')]['ContactId']=_0x594bee['id'];if(_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x2a59d2[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x2a59d2[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x2a59d2[_0xb2ea('0x2d')],function(_0x1090ae){var _0x94bd5={};_0x94bd5[_0x1090ae]={'$like':'%'+_0x18ed9f[_0xb2ea('0x2a')]['filter']+'%'};return _0x94bd5;})});}_0x2a59d2=_['merge']({},_0x2a59d2,_0x18ed9f[_0xb2ea('0xc2')]);return db[_0xb2ea('0x9f')][_0xb2ea('0x14')]({'where':_0x2a59d2['where']})[_0xb2ea('0x18')](function(_0x4e8b30){_0x224759[_0xb2ea('0x14')]=_0x4e8b30;if(_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0xd7')]){_0x2a59d2[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0x9f')][_0xb2ea('0x83')](_0x2a59d2);})[_0xb2ea('0x18')](function(_0x2f69a7){_0x224759[_0xb2ea('0x7d')]=_0x2f69a7;return _0x224759;});}})['then'](respondWithFilteredResult(_0x52dac0,_0x2a59d2))[_0xb2ea('0x7e')](handleError(_0x52dac0,null));};exports['uploadCsv']=function(_0x276798,_0x48db2e){try{if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x54')]){throw new Error(_0xb2ea('0xdd'));}if(!_0x276798[_0xb2ea('0x87')]['binding_keys']){throw new Error(_0xb2ea('0xde'));}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0xdf')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x3b0013=_0x276798['body'][_0xb2ea('0xe2')][_0xb2ea('0x44')](',');var _0x13163e=_0x276798[_0xb2ea('0x87')][_0xb2ea('0xdf')]['split'](',');if(!_0x3b0013[_0xb2ea('0x23')]||!_0x13163e['length']||_0x3b0013[_0xb2ea('0x23')]!==_0x13163e[_0xb2ea('0x23')]){throw new Error(_0xb2ea('0xe3'));}_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')]=_['zipObject'](_0x3b0013,_0x13163e);if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')][_0xb2ea('0xbf')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')]['firstName']){throw new Error(_0xb2ea('0xe4'));}var _0x574e0a=path[_0xb2ea('0x8b')](config[_0xb2ea('0xe5')],_0xb2ea('0xe6'),_0x276798[_0xb2ea('0xe7')][_0xb2ea('0xe8')]);fs[_0xb2ea('0xe9')](_0x574e0a,parseInt('0777',0x8));var _0x297b67=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xec')),[_0x574e0a,_0x276798['body'][_0xb2ea('0xe2')],_0x276798['body']['binding_values'],_0x276798[_0xb2ea('0x87')]['ListId'],_0x276798[_0xb2ea('0x87')][_0xb2ea('0xed')],_0x276798[_0xb2ea('0x87')][_0xb2ea('0xa9')],_0x276798['body']['socket_timestamp']]);return _0x48db2e[_0xb2ea('0xf')](0xc8)[_0xb2ea('0x10')]({'message':_0xb2ea('0xee'),'pid':_0x297b67['pid']});}catch(_0x2ea371){return _0x48db2e['status'](0x1f4)[_0xb2ea('0x1e')](_0x2ea371);}};exports[_0xb2ea('0xef')]=function(_0x1eca13,_0x1a35e9){var _0x14fd2d=fs[_0xb2ea('0xf0')](_0x1eca13[_0xb2ea('0xe7')][_0xb2ea('0x3')]);Papa['parse'](_0x14fd2d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x13fb42){return _0x1a35e9['status'](0xc8)['json']({'file':_0x1eca13[_0xb2ea('0xe7')],'fields':_0x13fb42[_0xb2ea('0xf1')][_0xb2ea('0x2e')]});}});};exports['import']=function(_0x424975,_0x1d22e4){return db['User'][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2ea('0x6b')}})['then'](function(_0x5ba2a){var _0x913f2=![];if(!_0x424975[_0xb2ea('0x87')]['ListId']){throw new Error(_0xb2ea('0xdd'));}if(!_0x424975[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xbf')]){throw new Error(_0xb2ea('0xf3'));}if(!_0x424975[_0xb2ea('0x87')]['binding'][_0xb2ea('0xf4')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x424975[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x57c297=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xf5')),[_0x424975[_0xb2ea('0xaf')]['id'],JSON[_0xb2ea('0xf6')](_0x424975[_0xb2ea('0x87')]),JSON[_0xb2ea('0xf6')](_0x5ba2a)]);_0x57c297['on']('message',function(){_0x913f2=!![];return _0x1d22e4[_0xb2ea('0xf')](0xc8)['json']({'message':_0xb2ea('0xf7'),'pid':_0x57c297[_0xb2ea('0xf8')]});});_0x57c297['on'](_0xb2ea('0xf9'),function(_0x793008){if(_0x793008&&!_0x913f2){return _0x1d22e4[_0xb2ea('0xf')](0x1f4)['json']({'message':_0xb2ea('0xfa'),'pid':_0x57c297[_0xb2ea('0xf8')]});}});})['catch'](handleError(_0x1d22e4,null));};exports[_0xb2ea('0xfb')]=function(_0x52ae5b,_0x698ed8,_0x2fe458){return db[_0xb2ea('0x49')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2ea('0x6b')}})[_0xb2ea('0x18')](function(_0x55651f){var _0x59b19d=![];if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0x54')]){throw new Error(_0xb2ea('0xdd'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xbf')]){throw new Error(_0xb2ea('0xf3'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xf4')]){throw new Error(_0xb2ea('0xe4'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x585a12=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xfc')),[_0x52ae5b[_0xb2ea('0xaf')]['id'],JSON[_0xb2ea('0xf6')](_0x52ae5b['body']),JSON[_0xb2ea('0xf6')](_0x55651f)]);_0x585a12['on'](_0xb2ea('0xfd'),function(_0x18cd0e){_0x59b19d=!![];return _0x698ed8[_0xb2ea('0xf')](0xc8)[_0xb2ea('0x10')]({'message':_0xb2ea('0xf7'),'pid':_0x585a12[_0xb2ea('0xf8')]});});_0x585a12['on'](_0xb2ea('0xf9'),function(_0x46edd8){if(_0x46edd8&&!_0x59b19d){return _0x698ed8[_0xb2ea('0xf')](0x1f4)[_0xb2ea('0x10')]({'message':_0xb2ea('0xfa'),'pid':_0x585a12[_0xb2ea('0xf8')]});}});})[_0xb2ea('0x7e')](handleError(_0x698ed8,null));};exports[_0xb2ea('0xfe')]=function(_0x7497ae,_0x42129e){var _0x3f031c=['mail','chat','sms',_0xb2ea('0xff'),_0xb2ea('0x100'),_0xb2ea('0x101'),'voice'];var _0x191f79={'offset':0x0,'order':qs[_0xb2ea('0x31')](_0xb2ea('0x102'))},_0x2a3bbf={'count':0x0,'rows':[]};Promise['resolve']()[_0xb2ea('0x18')](function(){if(_0x7497ae['query'][_0xb2ea('0x103')]){if(!_['includes'](_0x3f031c,_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x103')][_0xb2ea('0x104')]())){throw new Error(_0xb2ea('0x105'));}_0x3f031c=[_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x103')][_0xb2ea('0x104')]()];}if(_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x106')]){try{var _0x62ed5a=JSON[_0xb2ea('0x107')](_0x7497ae['query'][_0xb2ea('0x106')]);if(!moment(_0x62ed5a[_0xb2ea('0x35')])[_0xb2ea('0x108')]()){throw new Error(_0xb2ea('0x109'));}if(!moment(_0x62ed5a['to'])[_0xb2ea('0x108')]()){throw new Error(_0xb2ea('0x10a'));}}catch(_0x175298){throw new Error(_0xb2ea('0x10b'));}}if(!_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x2f')]('nolimit')){_0x191f79['limit']=qs[_0xb2ea('0x13')](_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x13')]||0xa);_0x191f79['offset']=qs[_0xb2ea('0x11')](_0x7497ae[_0xb2ea('0x2a')]['offset']);}var _0xda6b5=_0x3f031c[_0xb2ea('0x45')](function(_0x5e5c0b){if(_0x5e5c0b===_0xb2ea('0x10c')){var _0xdee49={'attributes':['id',_0xb2ea('0x10d'),_0xb2ea('0x85'),_0xb2ea('0x10e'),_0xb2ea('0x10f'),'callerid',_0xb2ea('0x110'),_0xb2ea('0x111'),'duration',_0xb2ea('0x112'),_0xb2ea('0x113'),'userDisposition',_0xb2ea('0x114'),_0xb2ea('0x115'),_0xb2ea('0x116')],'where':{'ContactId':_0x7497ae[_0xb2ea('0xaf')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x117'),_0xb2ea('0x118')]}],'order':[[_0xb2ea('0x113'),_0xb2ea('0x119')]]};if(_0x7497ae['query'][_0xb2ea('0x106')]){_0xdee49[_0xb2ea('0x68')]['createdAt']={'$gte':_0x62ed5a[_0xb2ea('0x35')],'$lte':_0x62ed5a['to']};}return db[_0xb2ea('0x11a')][_0xb2ea('0x11b')](_0xdee49)[_0xb2ea('0x18')](function(_0x28c917){_0x2a3bbf['count']+=_0x28c917['count'];return _[_0xb2ea('0x45')](_0x28c917[_0xb2ea('0x7d')],function(_0x6c3bf8){var _0x69f6ce=_0x6c3bf8[_0xb2ea('0x88')]({'plain':!![]});_0x69f6ce['channel']=_0x5e5c0b;if(_0x69f6ce[_0xb2ea('0x49')]){_0x69f6ce['User']={'id':_0x69f6ce['User']['id'],'name':_0x69f6ce[_0xb2ea('0x49')]['name'],'fullname':_0x69f6ce[_0xb2ea('0x49')]['fullname'],'alias':_0x69f6ce['User'][_0xb2ea('0x118')]};}return _0x69f6ce;});});}else{var _0x23f537=_['startCase'](_0x5e5c0b)+(_0x5e5c0b==='chat'?_0xb2ea('0x11c'):_0xb2ea('0x11d'));var _0x21f9a2={'attributes':['id',_0xb2ea('0x11e'),'closedAt',_0xb2ea('0x113'),_0xb2ea('0x112'),_0xb2ea('0x11f'),_0xb2ea('0x120'),'thirdDisposition','UserId',_0x23f537+'Id'],'where':{'ContactId':_0x7497ae[_0xb2ea('0xaf')]['id']},'include':[{'model':db[_0x23f537],'as':_0xb2ea('0x11d'),'attributes':['id','name',_0xb2ea('0x121')]},{'model':db[_0xb2ea('0x49')],'as':_0xb2ea('0x122'),'attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x117')]},{'model':db[_0xb2ea('0xb0')],'as':_0xb2ea('0x7c'),'attributes':['id',_0xb2ea('0x1d'),'color'],'through':{'attributes':[]}}],'order':[['createdAt',_0xb2ea('0x119')]]};if(_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x106')]){_0x21f9a2['where'][_0xb2ea('0x113')]={'$gte':_0x62ed5a[_0xb2ea('0x35')],'$lte':_0x62ed5a['to']};}switch(_0x5e5c0b){case _0xb2ea('0x123'):_0x21f9a2[_0xb2ea('0x2d')][_0xb2ea('0x52')](_0xb2ea('0x124'),_0xb2ea('0x125'),_0xb2ea('0x126'),_0xb2ea('0x127'),_0xb2ea('0x128'),_0xb2ea('0x129'),'ratingType',_0xb2ea('0x12a'),_0xb2ea('0x12b'));break;case _0xb2ea('0x12c'):_0x21f9a2[_0xb2ea('0x2d')][_0xb2ea('0x52')](_0xb2ea('0x12d'),_0xb2ea('0x12e'));break;case _0xb2ea('0xff'):_0x21f9a2[_0xb2ea('0x2d')]['push']('externalUrl',_0xb2ea('0x12f'));break;}return db[_[_0xb2ea('0x130')](_0x5e5c0b)+'Interaction'][_0xb2ea('0x11b')](_0x21f9a2)['then'](function(_0x2e9fe5){_0x2a3bbf[_0xb2ea('0x14')]+=_0x2e9fe5[_0xb2ea('0x14')];return _[_0xb2ea('0x45')](_0x2e9fe5[_0xb2ea('0x7d')],function(_0x244d65){var _0x32ca48=_0x244d65['get']({'plain':!![]});_0x32ca48[_0xb2ea('0x103')]=_0x5e5c0b;if(_0x32ca48[_0xb2ea('0x122')]){_0x32ca48[_0xb2ea('0x122')]={'id':_0x32ca48[_0xb2ea('0x122')]['id'],'name':_0x32ca48[_0xb2ea('0x122')]['name'],'fullname':_0x32ca48['Owner'][_0xb2ea('0x117')]};}return _0x32ca48;});});}});return Promise[_0xb2ea('0xad')](_0xda6b5);})[_0xb2ea('0x18')](function(_0x51f872){return _(_0x51f872)[_0xb2ea('0x131')]()[_0xb2ea('0x132')](_0xb2ea('0x113'))['reverse']()[_0xb2ea('0x43')]();})[_0xb2ea('0x18')](function(_0x2d71d1){_0x2a3bbf[_0xb2ea('0x7d')]=_0x191f79[_0xb2ea('0x13')]?_0x2d71d1[_0xb2ea('0x133')](_0x191f79[_0xb2ea('0x11')],_0x191f79[_0xb2ea('0x11')]+_0x191f79[_0xb2ea('0x13')]):_0x2d71d1;return _0x2a3bbf;})['then'](respondWithFilteredResult(_0x42129e,_0x191f79))[_0xb2ea('0x7e')](handleError(_0x42129e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e10e539..5ce8eba 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2732=['hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x4c25aa,_0x1586e5){var _0x18fcfc=function(_0x349c5c){while(--_0x349c5c){_0x4c25aa['push'](_0x4c25aa['shift']());}};_0x18fcfc(++_0x1586e5);}(_0x2732,0x13a));var _0x2273=function(_0x8e0e63,_0x25d839){_0x8e0e63=_0x8e0e63-0x0;var _0x4f0c40=_0x2732[_0x8e0e63];return _0x4f0c40;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x2273('0x0'))['db'][_0x2273('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2273('0x2')](0x0);var events={'afterCreate':_0x2273('0x3'),'afterUpdate':_0x2273('0x4'),'afterDestroy':_0x2273('0x5')};function emitEvent(_0x4d8c4e){return function(_0x2d62ec,_0x386c7d,_0x23b8db){CmContactEvents['emit'](_0x4d8c4e+':'+_0x2d62ec['id'],_0x2d62ec);CmContactEvents['emit'](_0x4d8c4e,_0x2d62ec);_0x23b8db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x2273('0x6')](e,emitEvent(event));}}module[_0x2273('0x7')]=CmContactEvents; \ No newline at end of file +var _0xa0fb=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa0fb,0x1e3));var _0xba0f=function(_0x2c97ed,_0x4c7e87){_0x2c97ed=_0x2c97ed-0x0;var _0xb10b58=_0xa0fb[_0x2c97ed];return _0xb10b58;};'use strict';var EventEmitter=require(_0xba0f('0x0'));var CmContact=require(_0xba0f('0x1'))['db'][_0xba0f('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xba0f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba0f('0x4')};function emitEvent(_0x443bfc){return function(_0x1127f5,_0x437178,_0x4d8b9e){CmContactEvents[_0xba0f('0x5')](_0x443bfc+':'+_0x1127f5['id'],_0x1127f5);CmContactEvents[_0xba0f('0x5')](_0x443bfc,_0x1127f5);_0x4d8b9e(null);};}for(var e in events){if(events[_0xba0f('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xba0f('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0717a13..d942ec6 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x436b=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','error','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','length','dialCheckDuplicateType','always','onlyIfOpen','findAll','CmList','CmHopperBlack','message','Lists','BlackLists','cmContact,\x20%s,\x20%s','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmContact.attributes','exports','define','CmContact','phone','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','inspect','scheduledat','format','VoiceQueue','findOne','then','isNil','dialTimezone','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','create','priority','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch'];(function(_0x1de6f7,_0x251a67){var _0x420deb=function(_0x15cdc1){while(--_0x15cdc1){_0x1de6f7['push'](_0x1de6f7['shift']());}};_0x420deb(++_0x251a67);}(_0x436b,0xf5));var _0xb436=function(_0x2584bc,_0x35d9f5){_0x2584bc=_0x2584bc-0x0;var _0x405f2c=_0x436b[_0x2584bc];return _0x405f2c;};'use strict';var _=require(_0xb436('0x0'));var util=require(_0xb436('0x1'));var logger=require(_0xb436('0x2'))(_0xb436('0x3'));var moment=require(_0xb436('0x4'));var BPromise=require(_0xb436('0x5'));var rp=require(_0xb436('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb436('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0xb436('0x8'));module[_0xb436('0x9')]=function(_0x4ff3e6,_0x4590d8){return _0x4ff3e6[_0xb436('0xa')](_0xb436('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xb436('0xc')]},{'name':'fti_cm_contacts','fields':[_0xb436('0xd'),_0xb436('0xe'),'phone','mobile',_0xb436('0xf'),_0xb436('0x10')],'type':_0xb436('0x11')}],'timestamps':!![],'charset':_0xb436('0x12'),'collate':_0xb436('0x13'),'hooks':{'afterCreate':function(_0x15f53d,_0x58d99c,_0xa98505){var _0x1bb420=_0x4ff3e6[_0xb436('0x14')];var _0x23ef60=_0x15f53d[_0xb436('0x15')]({'plain':!![]});function _0x10fa45(){return function(_0x19a70b){logger['error'](_0xb436('0x16'),_0xb436('0x17'),util[_0xb436('0x18')](_0x19a70b,{'showHidden':![],'depth':null}));};}function _0x49d5f3(_0x32c3bf,_0x26a155){var _0x3dfe93=_0x26a155[_0xb436('0x19')]?_0x26a155[_0xb436('0x19')]:moment()[_0xb436('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x96370a,_0x1c72da){if(_['isNil'](_0x26a155['dialTimezone'])){_0x96370a({'ret':_0x3dfe93});}else{_0x1bb420[_0xb436('0x1b')][_0xb436('0x1c')]({'where':{'id':_0x32c3bf['id']}})[_0xb436('0x1d')](function(_0x286b10){if(!_[_0xb436('0x1e')](_0x286b10)){var _0x5323ec=_0x286b10[_0xb436('0x1f')];if(!_[_0xb436('0x1e')](_0x5323ec)){var _0x4da680=shared['timezones'];var _0x29a3ca=_0x4da680[_0x5323ec];var _0x5a8748=_0x4da680[_0x26a155[_0xb436('0x1f')]];if(!_['isNil'](_0x29a3ca)&&!_[_0xb436('0x1e')](_0x5a8748)){var _0xb3c62c=_0x29a3ca['utcOffset']-_0x5a8748[_0xb436('0x20')];_0x3dfe93=_0x26a155[_0xb436('0x19')]?_0x26a155[_0xb436('0x19')]:moment();var _0x1ad105=moment(_0x3dfe93)[_0xb436('0x21')](_0xb3c62c,_0xb436('0x22'));_0x96370a({'ret':_0x1ad105[_0xb436('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x96370a({'ret':_0x3dfe93});}else _0x96370a({'ret':_0x3dfe93});}else{_0x96370a({'ret':_0x3dfe93});}});}});return 0xa;}var _0xe9c02a=function(_0x1c856a){return new BPromise(function(_0x59b9f3,_0x242aca){_0x49d5f3(_0x1c856a,_0x23ef60)['then'](function(_0x18c36f){_0x23ef60[_0xb436('0x19')]=_0x18c36f[_0xb436('0x23')];_0x1bb420[_0xb436('0x24')][_0xb436('0x1c')]({'where':{'phone':_0x23ef60[_0xb436('0xc')],'VoiceQueueId':_0x1c856a['id']}})[_0xb436('0x1d')](function(_0x392171){if(!_['isNil'](_0x392171)){throw new Error(_0xb436('0x25')+_0x23ef60[_0xb436('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1c856a['id']);}return _0x1bb420[_0xb436('0x24')][_0xb436('0x26')]({'phone':_0x23ef60[_0xb436('0xc')],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60['ListId'],'priority':_0x23ef60['priority']?_0x23ef60[_0xb436('0x27')]:0x2,'scheduledat':_0x23ef60[_0xb436('0x19')]?_0x23ef60[_0xb436('0x19')]:moment()[_0xb436('0x1a')](_0xb436('0x28')),'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60['callbackUniqueid']:undefined,'callbackat':_0x23ef60[_0xb436('0x29')]?moment()[_0xb436('0x1a')](_0xb436('0x28')):undefined,'VoiceQueueId':_0x1c856a['id']});})[_0xb436('0x2a')](function(_0x2728b6){_0x242aca(_0x2728b6);});});});};var _0x4d0c21=function(_0x131eef){return new BPromise(function(_0xfdea17,_0x5064fc){_0x49d5f3(_0x131eef,_0x23ef60)[_0xb436('0x1d')](function(_0x163322){_0x23ef60[_0xb436('0x19')]=_0x163322[_0xb436('0x23')];_0x1bb420[_0xb436('0x24')]['findOne']({'where':{'phone':_0x23ef60[_0xb436('0xc')],'VoiceQueueId':_0x131eef['id']}})[_0xb436('0x1d')](function(_0x2c3e14){if(!_[_0xb436('0x1e')](_0x2c3e14)){throw new Error(_0xb436('0x25')+_0x23ef60[_0xb436('0xc')]+_0xb436('0x2b')+_0x131eef['id']);}return _0x1bb420[_0xb436('0x2c')][_0xb436('0x1c')]({'where':{'calleridnum':_0x23ef60['phone'],'VoiceQueueId':_0x131eef['id']}});})['then'](function(_0x264a51){if(!_[_0xb436('0x1e')](_0x264a51)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x23ef60[_0xb436('0xc')]+_0xb436('0x2d')+_0x131eef['id']);}return _0x1bb420['CmHopper']['create']({'phone':_0x23ef60[_0xb436('0xc')],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'priority':_0x23ef60[_0xb436('0x27')]?_0x23ef60[_0xb436('0x27')]:0x2,'scheduledat':_0x23ef60[_0xb436('0x19')]?_0x23ef60[_0xb436('0x19')]:moment()['format'](_0xb436('0x28')),'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60[_0xb436('0x29')]:undefined,'callbackat':_0x23ef60[_0xb436('0x29')]?moment()[_0xb436('0x1a')](_0xb436('0x28')):undefined,'VoiceQueueId':_0x131eef['id']});})['catch'](function(_0x377a1c){_0x5064fc(_0x377a1c);});});});};function _0x21f7ea(){return function(_0x161560){logger[_0xb436('0x2f')](_0xb436('0x16'),_0xb436('0x17'),util[_0xb436('0x18')](_0x161560,{'showHidden':![],'depth':null}));};}function _0x436252(_0x2e72b3,_0x59c146){var _0x3fe0f5=_0x59c146[_0xb436('0x19')]?_0x59c146['scheduledat']:moment()[_0xb436('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2cc6df,_0x53e71e){if(_['isNil'](_0x59c146[_0xb436('0x1f')])){_0x2cc6df({'ret':_0x3fe0f5});}else{_0x1bb420[_0xb436('0x30')][_0xb436('0x1c')]({'where':{'id':_0x2e72b3['id']}})[_0xb436('0x1d')](function(_0x2a8f4f){if(!_[_0xb436('0x1e')](_0x2a8f4f)){var _0x319fb3=_0x2a8f4f[_0xb436('0x1f')];if(!_['isNil'](_0x319fb3)){var _0x57bd3a=shared[_0xb436('0x31')];var _0x471c63=_0x57bd3a[_0x319fb3];var _0x8ed5a2=_0x57bd3a[_0x59c146['dialTimezone']];if(!_['isNil'](_0x471c63)&&!_[_0xb436('0x1e')](_0x8ed5a2)){var _0x5b626c=_0x471c63[_0xb436('0x20')]-_0x8ed5a2[_0xb436('0x20')];_0x3fe0f5=_0x59c146[_0xb436('0x19')]?_0x59c146['scheduledat']:moment();var _0x2a726a=moment(_0x3fe0f5)[_0xb436('0x21')](_0x5b626c,_0xb436('0x22'));_0x2cc6df({'ret':_0x2a726a[_0xb436('0x1a')](_0xb436('0x28'))});}else _0x2cc6df({'ret':_0x3fe0f5});}else _0x2cc6df({'ret':_0x3fe0f5});}else{_0x2cc6df({'ret':_0x3fe0f5});}});}});return 0xa;}var _0x553b1a=function(_0x43dbd9){return new BPromise(function(_0x3b540e,_0x481919){_0x436252(_0x43dbd9,_0x23ef60)[_0xb436('0x1d')](function(_0x44be10){_0x23ef60[_0xb436('0x19')]=_0x44be10['ret'];_0x1bb420['CmHopper'][_0xb436('0x1c')]({'where':{'phone':_0x23ef60[_0xb436('0xc')],'CampaignId':_0x43dbd9['id']}})[_0xb436('0x1d')](function(_0xcf04f4){if(!_['isNil'](_0xcf04f4)){throw new Error(_0xb436('0x25')+_0x23ef60['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x43dbd9['id']);}return _0x1bb420['CmHopper'][_0xb436('0x26')]({'phone':_0x23ef60['phone'],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'priority':_0x23ef60['priority']?_0x23ef60[_0xb436('0x27')]:0x2,'scheduledat':_0x23ef60['scheduledat']?_0x23ef60[_0xb436('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60['callbackUniqueid']:undefined,'callbackat':_0x23ef60[_0xb436('0x29')]?moment()[_0xb436('0x1a')](_0xb436('0x28')):undefined,'CampaignId':_0x43dbd9['id']});})[_0xb436('0x2a')](function(_0x45752b){_0x481919(_0x45752b);});});});};var _0x2a9440=function(_0x58ad84){return new BPromise(function(_0xec6cef,_0x57d9c0){_0x436252(_0x58ad84,_0x23ef60)[_0xb436('0x1d')](function(_0x39c645){_0x23ef60['scheduledat']=_0x39c645[_0xb436('0x23')];_0x1bb420[_0xb436('0x24')][_0xb436('0x1c')]({'where':{'phone':_0x23ef60[_0xb436('0xc')],'CampaignId':_0x58ad84['id']}})[_0xb436('0x1d')](function(_0x10349e){if(!_[_0xb436('0x1e')](_0x10349e)){throw new Error(_0xb436('0x25')+_0x23ef60[_0xb436('0xc')]+_0xb436('0x32')+_0x58ad84['id']);}return _0x1bb420['CmHopperFinal'][_0xb436('0x1c')]({'where':{'calleridnum':_0x23ef60[_0xb436('0xc')],'CampaignId':_0x58ad84['id']}});})[_0xb436('0x1d')](function(_0x15ae62){if(!_['isNil'](_0x15ae62)){throw new Error(_0xb436('0x33')+_0x23ef60['phone']+_0xb436('0x34')+_0x58ad84['id']);}return _0x1bb420[_0xb436('0x24')][_0xb436('0x26')]({'phone':_0x23ef60[_0xb436('0xc')],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'priority':_0x23ef60['priority']?_0x23ef60[_0xb436('0x27')]:0x2,'scheduledat':_0x23ef60[_0xb436('0x19')]?_0x23ef60[_0xb436('0x19')]:moment()[_0xb436('0x1a')](_0xb436('0x28')),'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60[_0xb436('0x29')]:undefined,'callbackat':_0x23ef60[_0xb436('0x29')]?moment()[_0xb436('0x1a')](_0xb436('0x28')):undefined,'CampaignId':_0x58ad84['id']});})[_0xb436('0x2a')](function(_0x2acf5b){_0x57d9c0(_0x2acf5b);});});});};if(_0x23ef60['ListId']){_0x1bb420[_0xb436('0x1b')]['findAll']({'where':{'type':_0xb436('0x35')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1bb420['CmList'],'as':'Lists','where':{'id':_0x23ef60[_0xb436('0x2e')]}}]})[_0xb436('0x1d')](function(_0x395b69){if(_0x395b69){var _0x227989=[];for(var _0xf0a7de=0x0,_0x55da7f;_0xf0a7de<_0x395b69[_0xb436('0x36')];_0xf0a7de+=0x1){_0x55da7f=_0x395b69[_0xf0a7de][_0xb436('0x15')]({'plain':!![]});switch(_0x55da7f[_0xb436('0x37')]){case _0xb436('0x38'):_0x4d0c21(_0x55da7f)['catch'](_0x10fa45());break;case _0xb436('0x39'):_0xe9c02a(_0x55da7f)[_0xb436('0x2a')](_0x10fa45());break;default:_0x436252(_0x55da7f,_0x23ef60)['then'](function(_0x1d1a82){_0x23ef60[_0xb436('0x19')]=_0x1d1a82[_0xb436('0x23')];_0x1bb420[_0xb436('0x24')][_0xb436('0x26')]({'phone':_0x23ef60['phone'],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'scheduledat':_0x23ef60['scheduledat']?_0x23ef60[_0xb436('0x19')]:moment()['format'](_0xb436('0x28')),'priority':_0x23ef60[_0xb436('0x27')]?_0x23ef60[_0xb436('0x27')]:0x2,'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60[_0xb436('0x29')]:undefined,'callbackat':_0x23ef60[_0xb436('0x29')]?moment()[_0xb436('0x1a')](_0xb436('0x28')):undefined,'VoiceQueueId':_0x55da7f['id']})[_0xb436('0x2a')](_0x10fa45());});}}}})['then'](function(){return _0x1bb420[_0xb436('0x1b')][_0xb436('0x3a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1bb420[_0xb436('0x3b')],'as':'BlackLists','where':{'id':_0x23ef60['ListId']}}]})[_0xb436('0x1d')](function(_0x3736cc){if(_0x3736cc){var _0x27dc0a=[];for(var _0x56b68d=0x0,_0x16787a;_0x56b68d<_0x3736cc[_0xb436('0x36')];_0x56b68d+=0x1){_0x16787a=_0x3736cc[_0x56b68d][_0xb436('0x15')]({'plain':!![]});_0x1bb420[_0xb436('0x3c')][_0xb436('0x26')]({'phone':_0x23ef60[_0xb436('0xc')],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'VoiceQueueId':_0x16787a['id']})[_0xb436('0x2a')](function(_0x580aa5){logger[_0xb436('0x2f')]('cmContact,\x20%s,\x20%s','afterCreate',_0x580aa5[_0xb436('0x3d')]);});}}});})['then'](function(){return _0x1bb420[_0xb436('0x30')][_0xb436('0x3a')]({'attributes':['id',_0xb436('0x37'),_0xb436('0x1f')],'include':[{'model':_0x1bb420['CmList'],'as':_0xb436('0x3e'),'where':{'id':_0x23ef60[_0xb436('0x2e')]}}]})[_0xb436('0x1d')](function(_0x5df936){if(_0x5df936){var _0x45f5d9=[];for(var _0x3f0843=0x0,_0xcedda3;_0x3f0843<_0x5df936[_0xb436('0x36')];_0x3f0843+=0x1){_0xcedda3=_0x5df936[_0x3f0843]['get']({'plain':!![]});switch(_0xcedda3[_0xb436('0x37')]){case'always':_0x2a9440(_0xcedda3)[_0xb436('0x2a')](_0x21f7ea());break;case _0xb436('0x39'):_0x553b1a(_0xcedda3)['catch'](_0x21f7ea());break;default:_0x1bb420[_0xb436('0x24')]['create']({'phone':_0x23ef60['phone'],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'scheduledat':_0x23ef60[_0xb436('0x19')]?_0x23ef60['scheduledat']:moment()[_0xb436('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x23ef60[_0xb436('0x27')]?_0x23ef60['priority']:0x2,'callback':_0x23ef60[_0xb436('0x29')]?!![]:![],'callbackuniqueid':_0x23ef60[_0xb436('0x29')]?_0x23ef60[_0xb436('0x29')]:undefined,'callbackat':_0x23ef60['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xcedda3['id']})[_0xb436('0x2a')](_0x21f7ea());}}}});})['then'](function(){return _0x1bb420['Campaign'][_0xb436('0x3a')]({'attributes':['id'],'include':[{'model':_0x1bb420[_0xb436('0x3b')],'as':_0xb436('0x3f'),'where':{'id':_0x23ef60[_0xb436('0x2e')]}}]})[_0xb436('0x1d')](function(_0x272189){if(_0x272189){var _0x414e09=[];for(var _0x234f34=0x0,_0x177cac;_0x234f34<_0x272189[_0xb436('0x36')];_0x234f34+=0x1){_0x177cac=_0x272189[_0x234f34][_0xb436('0x15')]({'plain':!![]});_0x1bb420['CmHopperBlack'][_0xb436('0x26')]({'phone':_0x23ef60[_0xb436('0xc')],'ContactId':_0x23ef60['id'],'ListId':_0x23ef60[_0xb436('0x2e')],'CampaignId':_0x177cac['id']})['catch'](function(_0x1c49ab){logger['error'](_0xb436('0x40'),_0xb436('0x17'),_0x1c49ab[_0xb436('0x3d')]);});}}});})[_0xb436('0x1d')](function(){_0xa98505();})[_0xb436('0x2a')](function(_0x253cc7){logger[_0xb436('0x2f')]('cmContact,\x20%s,\x20%s',_0xb436('0x17'),_0x253cc7[_0xb436('0x3d')]);_0xa98505(_0x253cc7);});}else{_0xa98505(new Error(_0xb436('0x41')));}},'afterDestroy':function(_0x56e9e6,_0x35a150,_0x3dbcbd){var _0x2d4a70=_0x4ff3e6[_0xb436('0x14')];var _0x172714=_0x56e9e6[_0xb436('0x15')]({'plain':!![]});return _0x2d4a70['CmHopper'][_0xb436('0x3a')]({'raw':!![],'where':{'ListId':_0x172714[_0xb436('0x2e')],'ContactId':_0x172714['id']}})[_0xb436('0x1d')](function(_0x38ff1c){if(!_['isEmpty'](_0x38ff1c)){var _0xe7626=[];for(var _0x1e545f=0x0;_0x1e545f<_0x38ff1c[_0xb436('0x36')];_0x1e545f+=0x1){var _0x319ca9=_0x2d4a70[_0xb436('0x24')][_0xb436('0x42')]({'where':{'ListId':_0x38ff1c[_0x1e545f][_0xb436('0x2e')],'ContactId':_0x38ff1c[_0x1e545f][_0xb436('0x43')],'VoiceQueueId':_0x38ff1c[_0x1e545f][_0xb436('0x44')],'CampaignId':_0x38ff1c[_0x1e545f][_0xb436('0x45')]}});_0xe7626['push'](_0x319ca9);}return BPromise['all'](_0xe7626);}})[_0xb436('0x1d')](function(_0x5a62eb){logger['info'](_0xb436('0x46'),util[_0xb436('0x18')](_0x5a62eb,{'showHidden':![],'depth':null}));_0x3dbcbd();})[_0xb436('0x2a')](function(_0x188265){logger['error'](_0xb436('0x47'),util[_0xb436('0x18')](_0x188265,{'showHidden':![],'depth':null}));_0x3dbcbd(_0x188265);});}}});}; \ No newline at end of file +var _0xc260=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','email','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','isNil','then','dialTimezone','timezones','utcOffset','scheduledat','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','callbackUniqueid','ret','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','VoiceQueue','findAll','BlackLists','create','cmContact,\x20%s,\x20%s','message','Campaign','CmHopperBlack','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId'];(function(_0x56ab0a,_0x315bf0){var _0x5d3eb4=function(_0x25aa47){while(--_0x25aa47){_0x56ab0a['push'](_0x56ab0a['shift']());}};_0x5d3eb4(++_0x315bf0);}(_0xc260,0x1bf));var _0x0c26=function(_0x49ad4d,_0x4569f3){_0x49ad4d=_0x49ad4d-0x0;var _0xdb69d9=_0xc260[_0x49ad4d];return _0xdb69d9;};'use strict';var _=require(_0x0c26('0x0'));var util=require('util');var logger=require(_0x0c26('0x1'))(_0x0c26('0x2'));var moment=require(_0x0c26('0x3'));var BPromise=require(_0x0c26('0x4'));var rp=require(_0x0c26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c26('0x6'));var config=require(_0x0c26('0x7'));var shared=require(_0x0c26('0x8'));var attributes=require(_0x0c26('0x9'));module['exports']=function(_0x26e8fb,_0x18b4f8){return _0x26e8fb[_0x0c26('0xa')](_0x0c26('0xb'),attributes,{'tableName':_0x0c26('0xc'),'paranoid':!![],'indexes':[{'name':_0x0c26('0xd'),'fields':[_0x0c26('0xd')]},{'name':'fti_cm_contacts','fields':[_0x0c26('0xe'),_0x0c26('0xf'),_0x0c26('0xd'),_0x0c26('0x10'),'fax',_0x0c26('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c26('0x12'),'hooks':{'afterCreate':function(_0x109e93,_0x228cf9,_0x4a3a64){var _0x2ee585=_0x26e8fb['models'];var _0x399208=_0x109e93[_0x0c26('0x13')]({'plain':!![]});function _0x3e54a5(){return function(_0x56bace){logger[_0x0c26('0x14')](_0x0c26('0x15'),_0x0c26('0x16'),util[_0x0c26('0x17')](_0x56bace,{'showHidden':![],'depth':null}));};}function _0x321f0a(_0x3ee20b,_0x200c44){var _0x4e8c9c=_0x200c44['scheduledat']?_0x200c44['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19'));return new BPromise(function(_0x5f1b69,_0xd4cf4b){if(_[_0x0c26('0x1a')](_0x200c44['dialTimezone'])){_0x5f1b69({'ret':_0x4e8c9c});}else{_0x2ee585['VoiceQueue']['findOne']({'where':{'id':_0x3ee20b['id']}})[_0x0c26('0x1b')](function(_0x2baead){if(!_[_0x0c26('0x1a')](_0x2baead)){var _0x2c5d7d=_0x2baead[_0x0c26('0x1c')];if(!_['isNil'](_0x2c5d7d)){var _0x1b89e8=shared[_0x0c26('0x1d')];var _0x154022=_0x1b89e8[_0x2c5d7d];var _0x5be41d=_0x1b89e8[_0x200c44['dialTimezone']];if(!_[_0x0c26('0x1a')](_0x154022)&&!_['isNil'](_0x5be41d)){var _0x44e30f=_0x154022[_0x0c26('0x1e')]-_0x5be41d[_0x0c26('0x1e')];_0x4e8c9c=_0x200c44[_0x0c26('0x1f')]?_0x200c44[_0x0c26('0x1f')]:moment();var _0x5740a9=moment(_0x4e8c9c)[_0x0c26('0x20')](_0x44e30f,_0x0c26('0x21'));_0x5f1b69({'ret':_0x5740a9[_0x0c26('0x18')](_0x0c26('0x19'))});}else _0x5f1b69({'ret':_0x4e8c9c});}else _0x5f1b69({'ret':_0x4e8c9c});}else{_0x5f1b69({'ret':_0x4e8c9c});}});}});return 0xa;}var _0x35c507=function(_0x321252){return new BPromise(function(_0x4d39e8,_0x40f3af){_0x321f0a(_0x321252,_0x399208)[_0x0c26('0x1b')](function(_0x5f5e2a){_0x399208[_0x0c26('0x1f')]=_0x5f5e2a['ret'];_0x2ee585[_0x0c26('0x22')]['findOne']({'where':{'phone':_0x399208[_0x0c26('0xd')],'VoiceQueueId':_0x321252['id']}})[_0x0c26('0x1b')](function(_0x4c425b){if(!_[_0x0c26('0x1a')](_0x4c425b)){throw new Error(_0x0c26('0x23')+_0x399208['phone']+_0x0c26('0x24')+_0x321252['id']);}return _0x2ee585['CmHopper']['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'priority':_0x399208['priority']?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208['callbackUniqueid']?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208['callbackUniqueid']?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0x321252['id']});})['catch'](function(_0x1e62c2){_0x40f3af(_0x1e62c2);});});});};var _0x2e8b2f=function(_0xc05f99){return new BPromise(function(_0x546df4,_0x5c10df){_0x321f0a(_0xc05f99,_0x399208)[_0x0c26('0x1b')](function(_0x1b8f30){_0x399208[_0x0c26('0x1f')]=_0x1b8f30[_0x0c26('0x27')];_0x2ee585[_0x0c26('0x22')][_0x0c26('0x28')]({'where':{'phone':_0x399208[_0x0c26('0xd')],'VoiceQueueId':_0xc05f99['id']}})[_0x0c26('0x1b')](function(_0x4d2e73){if(!_[_0x0c26('0x1a')](_0x4d2e73)){throw new Error('cmContact,\x20afterCreate\x20'+_0x399208[_0x0c26('0xd')]+_0x0c26('0x29')+_0xc05f99['id']);}return _0x2ee585[_0x0c26('0x2a')]['findOne']({'where':{'calleridnum':_0x399208['phone'],'VoiceQueueId':_0xc05f99['id']}});})['then'](function(_0x3b50e0){if(!_[_0x0c26('0x1a')](_0x3b50e0)){throw new Error(_0x0c26('0x2b')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x2c')+_0xc05f99['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()['format'](_0x0c26('0x19')),'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0xc05f99['id']});})[_0x0c26('0x2e')](function(_0x484092){_0x5c10df(_0x484092);});});});};function _0x330edd(){return function(_0xd83478){logger[_0x0c26('0x14')](_0x0c26('0x15'),'afterCreate',util[_0x0c26('0x17')](_0xd83478,{'showHidden':![],'depth':null}));};}function _0x1ee6d4(_0x54e3a9,_0x1dc745){var _0x1bf819=_0x1dc745[_0x0c26('0x1f')]?_0x1dc745[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')](_0x0c26('0x19'));return new BPromise(function(_0xb19b48,_0x1a2c82){if(_[_0x0c26('0x1a')](_0x1dc745[_0x0c26('0x1c')])){_0xb19b48({'ret':_0x1bf819});}else{_0x2ee585['Campaign'][_0x0c26('0x28')]({'where':{'id':_0x54e3a9['id']}})[_0x0c26('0x1b')](function(_0x4f9658){if(!_[_0x0c26('0x1a')](_0x4f9658)){var _0x4314b3=_0x4f9658[_0x0c26('0x1c')];if(!_['isNil'](_0x4314b3)){var _0x1e2393=shared[_0x0c26('0x1d')];var _0x279682=_0x1e2393[_0x4314b3];var _0x3da8df=_0x1e2393[_0x1dc745['dialTimezone']];if(!_[_0x0c26('0x1a')](_0x279682)&&!_['isNil'](_0x3da8df)){var _0x2c573a=_0x279682['utcOffset']-_0x3da8df[_0x0c26('0x1e')];_0x1bf819=_0x1dc745[_0x0c26('0x1f')]?_0x1dc745[_0x0c26('0x1f')]:moment();var _0x27afe5=moment(_0x1bf819)[_0x0c26('0x20')](_0x2c573a,'minutes');_0xb19b48({'ret':_0x27afe5[_0x0c26('0x18')](_0x0c26('0x19'))});}else _0xb19b48({'ret':_0x1bf819});}else _0xb19b48({'ret':_0x1bf819});}else{_0xb19b48({'ret':_0x1bf819});}});}});return 0xa;}var _0x277508=function(_0x67da2b){return new BPromise(function(_0x11ef2e,_0x442566){_0x1ee6d4(_0x67da2b,_0x399208)[_0x0c26('0x1b')](function(_0x270bf9){_0x399208[_0x0c26('0x1f')]=_0x270bf9[_0x0c26('0x27')];_0x2ee585[_0x0c26('0x22')]['findOne']({'where':{'phone':_0x399208[_0x0c26('0xd')],'CampaignId':_0x67da2b['id']}})['then'](function(_0xa6bb73){if(!_[_0x0c26('0x1a')](_0xa6bb73)){throw new Error(_0x0c26('0x23')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x2f')+_0x67da2b['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'priority':_0x399208['priority']?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208['callbackUniqueid']?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'CampaignId':_0x67da2b['id']});})[_0x0c26('0x2e')](function(_0xd879e9){_0x442566(_0xd879e9);});});});};var _0x1e8b4b=function(_0x533948){return new BPromise(function(_0x2eaa6d,_0x34dbfe){_0x1ee6d4(_0x533948,_0x399208)[_0x0c26('0x1b')](function(_0x3bb8fc){_0x399208[_0x0c26('0x1f')]=_0x3bb8fc[_0x0c26('0x27')];_0x2ee585['CmHopper'][_0x0c26('0x28')]({'where':{'phone':_0x399208[_0x0c26('0xd')],'CampaignId':_0x533948['id']}})[_0x0c26('0x1b')](function(_0x20016b){if(!_['isNil'](_0x20016b)){throw new Error(_0x0c26('0x23')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x30')+_0x533948['id']);}return _0x2ee585['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x399208['phone'],'CampaignId':_0x533948['id']}});})[_0x0c26('0x1b')](function(_0x202f95){if(!_[_0x0c26('0x1a')](_0x202f95)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x399208[_0x0c26('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x533948['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()['format'](_0x0c26('0x19')):undefined,'CampaignId':_0x533948['id']});})[_0x0c26('0x2e')](function(_0x4195c2){_0x34dbfe(_0x4195c2);});});});};if(_0x399208[_0x0c26('0x2d')]){_0x2ee585['VoiceQueue']['findAll']({'where':{'type':_0x0c26('0x31')},'attributes':['id','dialCheckDuplicateType',_0x0c26('0x1c')],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x33'),'where':{'id':_0x399208['ListId']}}]})[_0x0c26('0x1b')](function(_0x3d8ea9){if(_0x3d8ea9){var _0x590bfe=[];for(var _0x2a6d4f=0x0,_0x11ae46;_0x2a6d4f<_0x3d8ea9[_0x0c26('0x34')];_0x2a6d4f+=0x1){_0x11ae46=_0x3d8ea9[_0x2a6d4f][_0x0c26('0x13')]({'plain':!![]});switch(_0x11ae46[_0x0c26('0x35')]){case _0x0c26('0x36'):_0x2e8b2f(_0x11ae46)[_0x0c26('0x2e')](_0x3e54a5());break;case _0x0c26('0x37'):_0x35c507(_0x11ae46)['catch'](_0x3e54a5());break;default:_0x1ee6d4(_0x11ae46,_0x399208)['then'](function(_0x3dd535){_0x399208[_0x0c26('0x1f')]=_0x3dd535['ret'];_0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208['phone'],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208[_0x0c26('0x1f')]:moment()['format'](_0x0c26('0x19')),'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0x11ae46['id']})[_0x0c26('0x2e')](_0x3e54a5());});}}}})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x38')][_0x0c26('0x39')]({'where':{'type':_0x0c26('0x31')},'attributes':['id'],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x3a'),'where':{'id':_0x399208[_0x0c26('0x2d')]}}]})[_0x0c26('0x1b')](function(_0x381b34){if(_0x381b34){var _0x263bf5=[];for(var _0x42b341=0x0,_0x2c6658;_0x42b341<_0x381b34[_0x0c26('0x34')];_0x42b341+=0x1){_0x2c6658=_0x381b34[_0x42b341][_0x0c26('0x13')]({'plain':!![]});_0x2ee585['CmHopperBlack'][_0x0c26('0x3b')]({'phone':_0x399208['phone'],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'VoiceQueueId':_0x2c6658['id']})['catch'](function(_0xb26a91){logger[_0x0c26('0x14')](_0x0c26('0x3c'),_0x0c26('0x16'),_0xb26a91[_0x0c26('0x3d')]);});}}});})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x3e')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0x0c26('0x1c')],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x33'),'where':{'id':_0x399208['ListId']}}]})[_0x0c26('0x1b')](function(_0x198019){if(_0x198019){var _0x223449=[];for(var _0x4f93cf=0x0,_0x3294b2;_0x4f93cf<_0x198019[_0x0c26('0x34')];_0x4f93cf+=0x1){_0x3294b2=_0x198019[_0x4f93cf]['get']({'plain':!![]});switch(_0x3294b2[_0x0c26('0x35')]){case _0x0c26('0x36'):_0x1e8b4b(_0x3294b2)[_0x0c26('0x2e')](_0x330edd());break;case _0x0c26('0x37'):_0x277508(_0x3294b2)[_0x0c26('0x2e')](_0x330edd());break;default:_0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'scheduledat':_0x399208['scheduledat']?_0x399208[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'CampaignId':_0x3294b2['id']})[_0x0c26('0x2e')](_0x330edd());}}}});})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x3e')]['findAll']({'attributes':['id'],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x3a'),'where':{'id':_0x399208[_0x0c26('0x2d')]}}]})[_0x0c26('0x1b')](function(_0x1bc91f){if(_0x1bc91f){var _0x4d0d52=[];for(var _0x399e4f=0x0,_0x3e1376;_0x399e4f<_0x1bc91f[_0x0c26('0x34')];_0x399e4f+=0x1){_0x3e1376=_0x1bc91f[_0x399e4f][_0x0c26('0x13')]({'plain':!![]});_0x2ee585[_0x0c26('0x3f')][_0x0c26('0x3b')]({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'CampaignId':_0x3e1376['id']})[_0x0c26('0x2e')](function(_0x244ecd){logger['error'](_0x0c26('0x3c'),'afterCreate',_0x244ecd[_0x0c26('0x3d')]);});}}});})[_0x0c26('0x1b')](function(){_0x4a3a64();})[_0x0c26('0x2e')](function(_0x1f60a6){logger[_0x0c26('0x14')](_0x0c26('0x3c'),_0x0c26('0x16'),_0x1f60a6['message']);_0x4a3a64(_0x1f60a6);});}else{_0x4a3a64(new Error(_0x0c26('0x40')));}},'afterDestroy':function(_0x534aae,_0xa41ac2,_0x438d36){var _0x48d329=_0x26e8fb[_0x0c26('0x41')];var _0x10fb0c=_0x534aae[_0x0c26('0x13')]({'plain':!![]});return _0x48d329['CmHopper'][_0x0c26('0x39')]({'raw':!![],'where':{'ListId':_0x10fb0c['ListId'],'ContactId':_0x10fb0c['id']}})['then'](function(_0xda5b4){if(!_[_0x0c26('0x42')](_0xda5b4)){var _0x57ac1e=[];for(var _0x25401f=0x0;_0x25401f<_0xda5b4[_0x0c26('0x34')];_0x25401f+=0x1){var _0xcba86f=_0x48d329[_0x0c26('0x22')][_0x0c26('0x43')]({'where':{'ListId':_0xda5b4[_0x25401f][_0x0c26('0x2d')],'ContactId':_0xda5b4[_0x25401f][_0x0c26('0x44')],'VoiceQueueId':_0xda5b4[_0x25401f][_0x0c26('0x45')],'CampaignId':_0xda5b4[_0x25401f][_0x0c26('0x46')]}});_0x57ac1e['push'](_0xcba86f);}return BPromise['all'](_0x57ac1e);}})['then'](function(_0x3d62aa){logger[_0x0c26('0x47')](_0x0c26('0x48'),util[_0x0c26('0x17')](_0x3d62aa,{'showHidden':![],'depth':null}));_0x438d36();})[_0x0c26('0x2e')](function(_0x20c678){logger[_0x0c26('0x14')](_0x0c26('0x49'),util[_0x0c26('0x17')](_0x20c678,{'showHidden':![],'depth':null}));_0x438d36(_0x20c678);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c4df1c3..81a521f 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x501ca5,_0x44293d){var _0x11d8ab=function(_0x49ac92){while(--_0x49ac92){_0x501ca5['push'](_0x501ca5['shift']());}};_0x11d8ab(++_0x44293d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x59384b,_0x13ae30){var _0x193e51=function(_0x213f0f){while(--_0x213f0f){_0x59384b['push'](_0x59384b['shift']());}};_0x193e51(++_0x13ae30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 72ba91b..b740f2e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['sequelize','exports','INTEGER','STRING'];(function(_0x4050a2,_0x185d9d){var _0x2fea5c=function(_0x1e778d){while(--_0x1e778d){_0x4050a2['push'](_0x4050a2['shift']());}};_0x2fea5c(++_0x185d9d);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'CmContactId':{'type':Sequelize[_0x34ea('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x34ea('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x34ea('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xb43b=['STRING','INTEGER','sequelize','exports'];(function(_0x2f72f8,_0x3b1def){var _0x1b66c2=function(_0x33dc49){while(--_0x33dc49){_0x2f72f8['push'](_0x2f72f8['shift']());}};_0x1b66c2(++_0x3b1def);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2ca4d7,_0x1bdb7b){_0x2ca4d7=_0x2ca4d7-0x0;var _0x61a725=_0xb43b[_0x2ca4d7];return _0x61a725;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 4dc0875..f6fbb6f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6875=['limit','count','offset','set','apply','reject','update','destroy','then','CmContactHasItems','UserProfileResource','error','name','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','CmContactHasItem','includeAll','findAll','catch','show','include','create','body','get','role','user','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0x6875,0x121));var _0x5687=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6875[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x5687('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5687('0x1'));var jsonpatch=require(_0x5687('0x2'));var rp=require('request-promise');var moment=require(_0x5687('0x3'));var BPromise=require(_0x5687('0x4'));var Mustache=require(_0x5687('0x5'));var util=require(_0x5687('0x6'));var path=require(_0x5687('0x7'));var sox=require('sox');var csv=require(_0x5687('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5687('0x9'));var _=require('lodash');var squel=require(_0x5687('0xa'));var crypto=require('crypto');var jsforce=require(_0x5687('0xb'));var deskjs=require(_0x5687('0xc'));var toCsv=require(_0x5687('0x8'));var querystring=require(_0x5687('0xd'));var Papa=require(_0x5687('0xe'));var Redis=require(_0x5687('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5687('0x10'));var hardwareService=require(_0x5687('0x11'));var logger=require(_0x5687('0x12'))(_0x5687('0x13'));var utils=require(_0x5687('0x14'));var config=require(_0x5687('0x15'));var licenseUtil=require(_0x5687('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ddcf,_0x14293e){_0x14293e=_0x14293e||0xcc;return function(_0x1a8497){if(_0x1a8497){return _0x32ddcf[_0x5687('0x17')](_0x14293e);}return _0x32ddcf[_0x5687('0x18')](_0x14293e)['end']();};}function respondWithResult(_0x5035f8,_0x302bf4){_0x302bf4=_0x302bf4||0xc8;return function(_0x26fe5d){if(_0x26fe5d){return _0x5035f8[_0x5687('0x18')](_0x302bf4)[_0x5687('0x19')](_0x26fe5d);}};}function respondWithFilteredResult(_0x48b21b,_0x3b1900){return function(_0x4406f5){if(_0x4406f5){var _0x4f9e04=typeof _0x3b1900['offset']===_0x5687('0x1a')&&typeof _0x3b1900[_0x5687('0x1b')]===_0x5687('0x1a');var _0x9c7aa3=_0x4406f5[_0x5687('0x1c')];var _0x442c47=_0x4f9e04?0x0:_0x3b1900[_0x5687('0x1d')];var _0x49794f=_0x4f9e04?_0x4406f5[_0x5687('0x1c')]:_0x3b1900['offset']+_0x3b1900[_0x5687('0x1b')];var _0x3434f9;if(_0x49794f>=_0x9c7aa3){_0x49794f=_0x9c7aa3;_0x3434f9=0xc8;}else{_0x3434f9=0xce;}_0x48b21b['status'](_0x3434f9);return _0x48b21b[_0x5687('0x1e')]('Content-Range',_0x442c47+'-'+_0x49794f+'/'+_0x9c7aa3)[_0x5687('0x19')](_0x4406f5);}return null;};}function patchUpdates(_0x3c47ec){return function(_0x44fdb0){try{jsonpatch[_0x5687('0x1f')](_0x44fdb0,_0x3c47ec,!![]);}catch(_0x51a87a){return BPromise[_0x5687('0x20')](_0x51a87a);}return _0x44fdb0['save']();};}function saveUpdates(_0xf4098,_0x2f784f){return function(_0x23b54a){if(_0x23b54a){return _0x23b54a[_0x5687('0x21')](_0xf4098)['then'](function(_0x34aea8){return _0x34aea8;});}return null;};}function removeEntity(_0x745d2e,_0x37f2b8){return function(_0x2ac08b){if(_0x2ac08b){return _0x2ac08b[_0x5687('0x22')]()[_0x5687('0x23')](function(){var _0x12d10b=_0x2ac08b['get']({'plain':!![]});var _0xf41737=_0x5687('0x24');return db[_0x5687('0x25')][_0x5687('0x22')]({'where':{'type':_0xf41737,'resourceId':_0x12d10b['id']}})[_0x5687('0x23')](function(){return _0x2ac08b;});})['then'](function(){_0x745d2e[_0x5687('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f459c,_0x2c24ea){return function(_0x360266){if(!_0x360266){_0x3f459c['sendStatus'](0x194);}return _0x360266;};}function handleError(_0xd38e3e,_0x40ddca){_0x40ddca=_0x40ddca||0x1f4;return function(_0x4ac21a){logger[_0x5687('0x26')](_0x4ac21a['stack']);if(_0x4ac21a[_0x5687('0x27')]){delete _0x4ac21a[_0x5687('0x27')];}_0xd38e3e['status'](_0x40ddca)['send'](_0x4ac21a);};}exports[_0x5687('0x28')]=function(_0x98f033,_0x481cd4){var _0x2bdd3d={},_0x264ac8={},_0x3fca41={'count':0x0,'rows':[]};var _0x1c6fe6=_['map'](db['CmContactHasItem'][_0x5687('0x29')],function(_0xe6872a){return{'name':_0xe6872a[_0x5687('0x2a')],'type':_0xe6872a['type'][_0x5687('0x2b')]};});_0x264ac8[_0x5687('0x2c')]=_[_0x5687('0x2d')](_0x1c6fe6,'name');_0x264ac8[_0x5687('0x2e')]=_[_0x5687('0x2f')](_0x98f033[_0x5687('0x2e')]);_0x264ac8['filters']=_[_0x5687('0x30')](_0x264ac8[_0x5687('0x2c')],_0x264ac8[_0x5687('0x2e')]);_0x2bdd3d[_0x5687('0x31')]=_['intersection'](_0x264ac8['model'],qs[_0x5687('0x32')](_0x98f033[_0x5687('0x2e')][_0x5687('0x32')]));_0x2bdd3d[_0x5687('0x31')]=_0x2bdd3d[_0x5687('0x31')][_0x5687('0x33')]?_0x2bdd3d[_0x5687('0x31')]:_0x264ac8[_0x5687('0x2c')];if(!_0x98f033[_0x5687('0x2e')][_0x5687('0x34')](_0x5687('0x35'))){_0x2bdd3d[_0x5687('0x1b')]=qs['limit'](_0x98f033[_0x5687('0x2e')][_0x5687('0x1b')]);_0x2bdd3d[_0x5687('0x1d')]=qs[_0x5687('0x1d')](_0x98f033[_0x5687('0x2e')][_0x5687('0x1d')]);}_0x2bdd3d[_0x5687('0x36')]=qs[_0x5687('0x37')](_0x98f033[_0x5687('0x2e')][_0x5687('0x37')]);_0x2bdd3d[_0x5687('0x38')]=qs[_0x5687('0x39')](_[_0x5687('0x3a')](_0x98f033[_0x5687('0x2e')],_0x264ac8['filters']),_0x1c6fe6);if(_0x98f033[_0x5687('0x2e')][_0x5687('0x3b')]){_0x2bdd3d[_0x5687('0x38')]=_[_0x5687('0x3c')](_0x2bdd3d[_0x5687('0x38')],{'$or':_['map'](_0x1c6fe6,function(_0x5dd7a7){if(_0x5dd7a7[_0x5687('0x3d')]!=='VIRTUAL'){var _0x2a62ab={};_0x2a62ab[_0x5dd7a7[_0x5687('0x27')]]={'$like':'%'+_0x98f033['query']['filter']+'%'};return _0x2a62ab;}})});}_0x2bdd3d=_['merge']({},_0x2bdd3d,_0x98f033[_0x5687('0x3e')]);var _0x1b5e63={'where':_0x2bdd3d[_0x5687('0x38')]};return db[_0x5687('0x3f')][_0x5687('0x1c')](_0x1b5e63)['then'](function(_0x5b3fce){_0x3fca41[_0x5687('0x1c')]=_0x5b3fce;if(_0x98f033[_0x5687('0x2e')][_0x5687('0x40')]){_0x2bdd3d['include']=[{'all':!![]}];}return db[_0x5687('0x3f')][_0x5687('0x41')](_0x2bdd3d);})[_0x5687('0x23')](function(_0x497179){_0x3fca41['rows']=_0x497179;return _0x3fca41;})['then'](respondWithFilteredResult(_0x481cd4,_0x2bdd3d))[_0x5687('0x42')](handleError(_0x481cd4,null));};exports[_0x5687('0x43')]=function(_0x1cf8d4,_0x652e7e){var _0x4746a9={'raw':!![],'where':{'id':_0x1cf8d4['params']['id']}},_0x3651ba={};_0x3651ba[_0x5687('0x2c')]=_[_0x5687('0x2f')](db[_0x5687('0x3f')]['rawAttributes']);_0x3651ba[_0x5687('0x2e')]=_[_0x5687('0x2f')](_0x1cf8d4[_0x5687('0x2e')]);_0x3651ba[_0x5687('0x39')]=_[_0x5687('0x30')](_0x3651ba[_0x5687('0x2c')],_0x3651ba[_0x5687('0x2e')]);_0x4746a9[_0x5687('0x31')]=_[_0x5687('0x30')](_0x3651ba[_0x5687('0x2c')],qs[_0x5687('0x32')](_0x1cf8d4['query'][_0x5687('0x32')]));_0x4746a9[_0x5687('0x31')]=_0x4746a9[_0x5687('0x31')][_0x5687('0x33')]?_0x4746a9['attributes']:_0x3651ba[_0x5687('0x2c')];if(_0x1cf8d4[_0x5687('0x2e')][_0x5687('0x40')]){_0x4746a9[_0x5687('0x44')]=[{'all':!![]}];}_0x4746a9=_['merge']({},_0x4746a9,_0x1cf8d4[_0x5687('0x3e')]);return db[_0x5687('0x3f')]['find'](_0x4746a9)[_0x5687('0x23')](handleEntityNotFound(_0x652e7e,null))[_0x5687('0x23')](respondWithResult(_0x652e7e,null))[_0x5687('0x42')](handleError(_0x652e7e,null));};exports['create']=function(_0x1a3b3f,_0x846395){return db['CmContactHasItem'][_0x5687('0x45')](_0x1a3b3f[_0x5687('0x46')],{})['then'](function(_0x2b7851){var _0x1a804d=_0x1a3b3f['user'][_0x5687('0x47')]({'plain':!![]});if(!_0x1a804d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a804d[_0x5687('0x48')]===_0x5687('0x49')){var _0x2e16be=_0x2b7851['get']({'plain':!![]});var _0x3c8023='CmContactHasItems';return db[_0x5687('0x4a')][_0x5687('0x4b')]({'where':{'name':_0x3c8023,'userProfileId':_0x1a804d[_0x5687('0x4c')]},'raw':!![]})[_0x5687('0x23')](function(_0x3fe118){if(_0x3fe118&&_0x3fe118[_0x5687('0x4d')]===0x0){return db[_0x5687('0x25')][_0x5687('0x45')]({'name':_0x2e16be[_0x5687('0x27')],'resourceId':_0x2e16be['id'],'type':_0x3fe118[_0x5687('0x27')],'sectionId':_0x3fe118['id']},{})[_0x5687('0x23')](function(){return _0x2b7851;});}else{return _0x2b7851;}})[_0x5687('0x42')](function(_0x579aa0){logger[_0x5687('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x579aa0);throw _0x579aa0;});}return _0x2b7851;})[_0x5687('0x23')](respondWithResult(_0x846395,0xc9))[_0x5687('0x42')](handleError(_0x846395,null));};exports[_0x5687('0x21')]=function(_0x2724d7,_0x3ab138){if(_0x2724d7[_0x5687('0x46')]['id']){delete _0x2724d7['body']['id'];}return db[_0x5687('0x3f')][_0x5687('0x4b')]({'where':{'id':_0x2724d7[_0x5687('0x4e')]['id']}})[_0x5687('0x23')](handleEntityNotFound(_0x3ab138,null))[_0x5687('0x23')](saveUpdates(_0x2724d7[_0x5687('0x46')],null))[_0x5687('0x23')](respondWithResult(_0x3ab138,null))[_0x5687('0x42')](handleError(_0x3ab138,null));};exports['destroy']=function(_0xc43854,_0x10f34a){return db['CmContactHasItem']['find']({'where':{'id':_0xc43854[_0x5687('0x4e')]['id']}})[_0x5687('0x23')](handleEntityNotFound(_0x10f34a,null))[_0x5687('0x23')](removeEntity(_0x10f34a,null))['catch'](handleError(_0x10f34a,null));}; \ No newline at end of file +var _0xc7af=['query','keys','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','map','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xc7af,0x10f));var _0xfc7a=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xc7af[_0x36feb2];return _0x292b43;};'use strict';var emlformat=require(_0xfc7a('0x0'));var rimraf=require(_0xfc7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc7a('0x2'));var rp=require(_0xfc7a('0x3'));var moment=require('moment');var BPromise=require(_0xfc7a('0x4'));var Mustache=require(_0xfc7a('0x5'));var util=require('util');var path=require(_0xfc7a('0x6'));var sox=require('sox');var csv=require(_0xfc7a('0x7'));var ejs=require(_0xfc7a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc7a('0x9'));var squel=require(_0xfc7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xfc7a('0xb'));var deskjs=require(_0xfc7a('0xc'));var toCsv=require(_0xfc7a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc7a('0xd'));var authService=require(_0xfc7a('0xe'));var qs=require(_0xfc7a('0xf'));var as=require(_0xfc7a('0x10'));var hardwareService=require(_0xfc7a('0x11'));var logger=require('../../config/logger')(_0xfc7a('0x12'));var utils=require(_0xfc7a('0x13'));var config=require(_0xfc7a('0x14'));var licenseUtil=require(_0xfc7a('0x15'));var db=require(_0xfc7a('0x16'))['db'];function respondWithStatusCode(_0x18f28c,_0x121372){_0x121372=_0x121372||0xcc;return function(_0x3e99dd){if(_0x3e99dd){return _0x18f28c[_0xfc7a('0x17')](_0x121372);}return _0x18f28c['status'](_0x121372)[_0xfc7a('0x18')]();};}function respondWithResult(_0x1450c5,_0x10bddf){_0x10bddf=_0x10bddf||0xc8;return function(_0x27c2b7){if(_0x27c2b7){return _0x1450c5[_0xfc7a('0x19')](_0x10bddf)[_0xfc7a('0x1a')](_0x27c2b7);}};}function respondWithFilteredResult(_0x5e8a2b,_0x2e2d5f){return function(_0x3c2f50){if(_0x3c2f50){var _0x443fef=typeof _0x2e2d5f[_0xfc7a('0x1b')]===_0xfc7a('0x1c')&&typeof _0x2e2d5f[_0xfc7a('0x1d')]===_0xfc7a('0x1c');var _0x1fbb9d=_0x3c2f50['count'];var _0xb3ac41=_0x443fef?0x0:_0x2e2d5f[_0xfc7a('0x1b')];var _0x1b3f4f=_0x443fef?_0x3c2f50[_0xfc7a('0x1e')]:_0x2e2d5f[_0xfc7a('0x1b')]+_0x2e2d5f[_0xfc7a('0x1d')];var _0x4b102f;if(_0x1b3f4f>=_0x1fbb9d){_0x1b3f4f=_0x1fbb9d;_0x4b102f=0xc8;}else{_0x4b102f=0xce;}_0x5e8a2b[_0xfc7a('0x19')](_0x4b102f);return _0x5e8a2b[_0xfc7a('0x1f')]('Content-Range',_0xb3ac41+'-'+_0x1b3f4f+'/'+_0x1fbb9d)[_0xfc7a('0x1a')](_0x3c2f50);}return null;};}function patchUpdates(_0x1a072c){return function(_0x1c06a3){try{jsonpatch[_0xfc7a('0x20')](_0x1c06a3,_0x1a072c,!![]);}catch(_0x926868){return BPromise[_0xfc7a('0x21')](_0x926868);}return _0x1c06a3['save']();};}function saveUpdates(_0x1a0499,_0x2c9833){return function(_0x12d5a6){if(_0x12d5a6){return _0x12d5a6[_0xfc7a('0x22')](_0x1a0499)[_0xfc7a('0x23')](function(_0x4d0f5c){return _0x4d0f5c;});}return null;};}function removeEntity(_0x19842a,_0x4fe362){return function(_0x3ae488){if(_0x3ae488){return _0x3ae488[_0xfc7a('0x24')]()[_0xfc7a('0x23')](function(){var _0xf552cc=_0x3ae488[_0xfc7a('0x25')]({'plain':!![]});var _0x1e46db=_0xfc7a('0x26');return db[_0xfc7a('0x27')][_0xfc7a('0x24')]({'where':{'type':_0x1e46db,'resourceId':_0xf552cc['id']}})['then'](function(){return _0x3ae488;});})[_0xfc7a('0x23')](function(){_0x19842a[_0xfc7a('0x19')](0xcc)[_0xfc7a('0x18')]();});}};}function handleEntityNotFound(_0x581de1,_0xd5c485){return function(_0x263f9d){if(!_0x263f9d){_0x581de1[_0xfc7a('0x17')](0x194);}return _0x263f9d;};}function handleError(_0x44ea99,_0x37e2ba){_0x37e2ba=_0x37e2ba||0x1f4;return function(_0x5bccf7){logger[_0xfc7a('0x28')](_0x5bccf7[_0xfc7a('0x29')]);if(_0x5bccf7[_0xfc7a('0x2a')]){delete _0x5bccf7['name'];}_0x44ea99[_0xfc7a('0x19')](_0x37e2ba)[_0xfc7a('0x2b')](_0x5bccf7);};}exports[_0xfc7a('0x2c')]=function(_0x22b07d,_0x5f16a5){var _0x36c868={},_0x1f7454={},_0x4f4de1={'count':0x0,'rows':[]};var _0x4e9204=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x5c8e34){return{'name':_0x5c8e34[_0xfc7a('0x2d')],'type':_0x5c8e34[_0xfc7a('0x2e')][_0xfc7a('0x2f')]};});_0x1f7454[_0xfc7a('0x30')]=_['map'](_0x4e9204,_0xfc7a('0x2a'));_0x1f7454[_0xfc7a('0x31')]=_[_0xfc7a('0x32')](_0x22b07d[_0xfc7a('0x31')]);_0x1f7454[_0xfc7a('0x33')]=_[_0xfc7a('0x34')](_0x1f7454['model'],_0x1f7454['query']);_0x36c868['attributes']=_[_0xfc7a('0x34')](_0x1f7454[_0xfc7a('0x30')],qs['fields'](_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x35')]));_0x36c868[_0xfc7a('0x36')]=_0x36c868[_0xfc7a('0x36')][_0xfc7a('0x37')]?_0x36c868['attributes']:_0x1f7454[_0xfc7a('0x30')];if(!_0x22b07d[_0xfc7a('0x31')]['hasOwnProperty']('nolimit')){_0x36c868[_0xfc7a('0x1d')]=qs[_0xfc7a('0x1d')](_0x22b07d['query'][_0xfc7a('0x1d')]);_0x36c868['offset']=qs[_0xfc7a('0x1b')](_0x22b07d['query'][_0xfc7a('0x1b')]);}_0x36c868[_0xfc7a('0x38')]=qs['sort'](_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x39')]);_0x36c868['where']=qs[_0xfc7a('0x33')](_[_0xfc7a('0x3a')](_0x22b07d[_0xfc7a('0x31')],_0x1f7454[_0xfc7a('0x33')]),_0x4e9204);if(_0x22b07d['query']['filter']){_0x36c868[_0xfc7a('0x3b')]=_[_0xfc7a('0x3c')](_0x36c868[_0xfc7a('0x3b')],{'$or':_[_0xfc7a('0x3d')](_0x4e9204,function(_0x1cc652){if(_0x1cc652['type']!==_0xfc7a('0x3e')){var _0x270e45={};_0x270e45[_0x1cc652[_0xfc7a('0x2a')]]={'$like':'%'+_0x22b07d[_0xfc7a('0x31')]['filter']+'%'};return _0x270e45;}})});}_0x36c868=_[_0xfc7a('0x3c')]({},_0x36c868,_0x22b07d[_0xfc7a('0x3f')]);var _0x18c61d={'where':_0x36c868[_0xfc7a('0x3b')]};return db[_0xfc7a('0x40')][_0xfc7a('0x1e')](_0x18c61d)['then'](function(_0x1735a6){_0x4f4de1[_0xfc7a('0x1e')]=_0x1735a6;if(_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x41')]){_0x36c868[_0xfc7a('0x42')]=[{'all':!![]}];}return db[_0xfc7a('0x40')][_0xfc7a('0x43')](_0x36c868);})[_0xfc7a('0x23')](function(_0x5da01b){_0x4f4de1[_0xfc7a('0x44')]=_0x5da01b;return _0x4f4de1;})['then'](respondWithFilteredResult(_0x5f16a5,_0x36c868))[_0xfc7a('0x45')](handleError(_0x5f16a5,null));};exports[_0xfc7a('0x46')]=function(_0x11d5d9,_0x2465b6){var _0x13e549={'raw':!![],'where':{'id':_0x11d5d9[_0xfc7a('0x47')]['id']}},_0x4b6660={};_0x4b6660[_0xfc7a('0x30')]=_[_0xfc7a('0x32')](db[_0xfc7a('0x40')]['rawAttributes']);_0x4b6660[_0xfc7a('0x31')]=_['keys'](_0x11d5d9[_0xfc7a('0x31')]);_0x4b6660[_0xfc7a('0x33')]=_[_0xfc7a('0x34')](_0x4b6660[_0xfc7a('0x30')],_0x4b6660[_0xfc7a('0x31')]);_0x13e549[_0xfc7a('0x36')]=_[_0xfc7a('0x34')](_0x4b6660[_0xfc7a('0x30')],qs[_0xfc7a('0x35')](_0x11d5d9[_0xfc7a('0x31')][_0xfc7a('0x35')]));_0x13e549[_0xfc7a('0x36')]=_0x13e549['attributes'][_0xfc7a('0x37')]?_0x13e549['attributes']:_0x4b6660['model'];if(_0x11d5d9[_0xfc7a('0x31')][_0xfc7a('0x41')]){_0x13e549[_0xfc7a('0x42')]=[{'all':!![]}];}_0x13e549=_[_0xfc7a('0x3c')]({},_0x13e549,_0x11d5d9[_0xfc7a('0x3f')]);return db[_0xfc7a('0x40')][_0xfc7a('0x48')](_0x13e549)[_0xfc7a('0x23')](handleEntityNotFound(_0x2465b6,null))[_0xfc7a('0x23')](respondWithResult(_0x2465b6,null))[_0xfc7a('0x45')](handleError(_0x2465b6,null));};exports[_0xfc7a('0x49')]=function(_0x33b68b,_0x1464ed){return db['CmContactHasItem'][_0xfc7a('0x49')](_0x33b68b['body'],{})[_0xfc7a('0x23')](function(_0x484a6e){var _0x4ea3c4=_0x33b68b[_0xfc7a('0x4a')]['get']({'plain':!![]});if(!_0x4ea3c4)throw new Error(_0xfc7a('0x4b'));if(_0x4ea3c4[_0xfc7a('0x4c')]==='user'){var _0x409c89=_0x484a6e[_0xfc7a('0x25')]({'plain':!![]});var _0x6db183='CmContactHasItems';return db[_0xfc7a('0x4d')][_0xfc7a('0x48')]({'where':{'name':_0x6db183,'userProfileId':_0x4ea3c4[_0xfc7a('0x4e')]},'raw':!![]})['then'](function(_0x18ecdf){if(_0x18ecdf&&_0x18ecdf['autoAssociation']===0x0){return db[_0xfc7a('0x27')]['create']({'name':_0x409c89[_0xfc7a('0x2a')],'resourceId':_0x409c89['id'],'type':_0x18ecdf[_0xfc7a('0x2a')],'sectionId':_0x18ecdf['id']},{})[_0xfc7a('0x23')](function(){return _0x484a6e;});}else{return _0x484a6e;}})[_0xfc7a('0x45')](function(_0x4c5c8a){logger[_0xfc7a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c5c8a);throw _0x4c5c8a;});}return _0x484a6e;})[_0xfc7a('0x23')](respondWithResult(_0x1464ed,0xc9))[_0xfc7a('0x45')](handleError(_0x1464ed,null));};exports[_0xfc7a('0x22')]=function(_0x27d2e4,_0x5e354e){if(_0x27d2e4[_0xfc7a('0x4f')]['id']){delete _0x27d2e4['body']['id'];}return db[_0xfc7a('0x40')][_0xfc7a('0x48')]({'where':{'id':_0x27d2e4['params']['id']}})[_0xfc7a('0x23')](handleEntityNotFound(_0x5e354e,null))[_0xfc7a('0x23')](saveUpdates(_0x27d2e4[_0xfc7a('0x4f')],null))[_0xfc7a('0x23')](respondWithResult(_0x5e354e,null))[_0xfc7a('0x45')](handleError(_0x5e354e,null));};exports[_0xfc7a('0x24')]=function(_0x122d97,_0xa146fe){return db['CmContactHasItem'][_0xfc7a('0x48')]({'where':{'id':_0x122d97[_0xfc7a('0x47')]['id']}})[_0xfc7a('0x23')](handleEntityNotFound(_0xa146fe,null))[_0xfc7a('0x23')](removeEntity(_0xa146fe,null))['catch'](handleError(_0xa146fe,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 356d9d5..2f5c718 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe857=['exports','CmContactHasItem','cm_contact_has_items','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe857,0x1cb));var _0x7e85=function(_0x51dff6,_0x4ffb15){_0x51dff6=_0x51dff6-0x0;var _0x34e7e8=_0xe857[_0x51dff6];return _0x34e7e8;};'use strict';var _=require(_0x7e85('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7e85('0x1'));var moment=require(_0x7e85('0x2'));var BPromise=require(_0x7e85('0x3'));var rp=require(_0x7e85('0x4'));var fs=require('fs');var path=require(_0x7e85('0x5'));var rimraf=require(_0x7e85('0x6'));var config=require(_0x7e85('0x7'));var attributes=require(_0x7e85('0x8'));module[_0x7e85('0x9')]=function(_0x3f701d,_0x43b6e4){return _0x3f701d['define'](_0x7e85('0xa'),attributes,{'tableName':_0x7e85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8beb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','lodash','util','../../config/logger'];(function(_0x246d84,_0x419a53){var _0x1673af=function(_0x4c6fb8){while(--_0x4c6fb8){_0x246d84['push'](_0x246d84['shift']());}};_0x1673af(++_0x419a53);}(_0x8beb,0xed));var _0xb8be=function(_0x33f958,_0x4fc4dc){_0x33f958=_0x33f958-0x0;var _0x502608=_0x8beb[_0x33f958];return _0x502608;};'use strict';var _=require(_0xb8be('0x0'));var util=require(_0xb8be('0x1'));var logger=require(_0xb8be('0x2'))('api');var moment=require(_0xb8be('0x3'));var BPromise=require(_0xb8be('0x4'));var rp=require(_0xb8be('0x5'));var fs=require('fs');var path=require(_0xb8be('0x6'));var rimraf=require(_0xb8be('0x7'));var config=require(_0xb8be('0x8'));var attributes=require(_0xb8be('0x9'));module[_0xb8be('0xa')]=function(_0x5d9315,_0x232e7d){return _0x5d9315['define'](_0xb8be('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a4bb2b1..f5ec338 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9158=['debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x2ddfe1,_0x3a1c50){var _0x1a5bba=function(_0xfb6ae5){while(--_0xfb6ae5){_0x2ddfe1['push'](_0x2ddfe1['shift']());}};_0x1a5bba(++_0x3a1c50);}(_0x9158,0x1ea));var _0x8915=function(_0x1c1714,_0x598d0d){_0x1c1714=_0x1c1714-0x0;var _0x124de8=_0x9158[_0x1c1714];return _0x124de8;};'use strict';var _=require(_0x8915('0x0'));var util=require('util');var moment=require(_0x8915('0x1'));var BPromise=require(_0x8915('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8915('0x3'))['db'];var utils=require(_0x8915('0x4'));var logger=require(_0x8915('0x5'))('rpc');var config=require(_0x8915('0x6'));var jayson=require(_0x8915('0x7'));var client=jayson['client'][_0x8915('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33c2d2,_0x3f6fe2,_0x5206ae){return new BPromise(function(_0x404f31,_0x32440c){return client[_0x8915('0x9')](_0x33c2d2,_0x5206ae)[_0x8915('0xa')](function(_0x582510){logger[_0x8915('0xb')](_0x8915('0xc'),_0x3f6fe2,_0x8915('0xd'));logger[_0x8915('0xe')](_0x8915('0xf'),_0x3f6fe2,_0x8915('0xd'),JSON[_0x8915('0x10')](_0x582510));if(_0x582510[_0x8915('0x11')]){if(_0x582510[_0x8915('0x11')][_0x8915('0x12')]===0x1f4){logger[_0x8915('0x11')](_0x8915('0xc'),_0x3f6fe2,_0x582510[_0x8915('0x11')][_0x8915('0x13')]);return _0x32440c(_0x582510[_0x8915('0x11')][_0x8915('0x13')]);}logger[_0x8915('0x11')](_0x8915('0xc'),_0x3f6fe2,_0x582510[_0x8915('0x11')][_0x8915('0x13')]);return _0x404f31(_0x582510[_0x8915('0x11')][_0x8915('0x13')]);}else{logger[_0x8915('0xb')](_0x8915('0xc'),_0x3f6fe2,_0x8915('0xd'));_0x404f31(_0x582510['result'][_0x8915('0x13')]);}})[_0x8915('0x14')](function(_0x343bfe){logger['error'](_0x8915('0xc'),_0x3f6fe2,_0x343bfe);_0x32440c(_0x343bfe);});});} \ No newline at end of file +var _0x8b0f=['jayson/promise','http','request','then','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x51b6f4,_0x5e6420){var _0x536763=function(_0x440d36){while(--_0x440d36){_0x51b6f4['push'](_0x51b6f4['shift']());}};_0x536763(++_0x5e6420);}(_0x8b0f,0x1d4));var _0xf8b0=function(_0x4131dd,_0x1b7297){_0x4131dd=_0x4131dd-0x0;var _0x1d6fcd=_0x8b0f[_0x4131dd];return _0x1d6fcd;};'use strict';var _=require('lodash');var util=require(_0xf8b0('0x0'));var moment=require(_0xf8b0('0x1'));var BPromise=require(_0xf8b0('0x2'));var rs=require(_0xf8b0('0x3'));var fs=require('fs');var Redis=require(_0xf8b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8b0('0x5'));var config=require(_0xf8b0('0x6'));var jayson=require(_0xf8b0('0x7'));var client=jayson['client'][_0xf8b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55fe3c,_0x4cd543,_0x331fba){return new BPromise(function(_0x270978,_0x4cebcc){return client[_0xf8b0('0x9')](_0x55fe3c,_0x331fba)[_0xf8b0('0xa')](function(_0x38b5b0){logger[_0xf8b0('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4cd543,_0xf8b0('0xc'));logger['debug'](_0xf8b0('0xd'),_0x4cd543,_0xf8b0('0xc'),JSON[_0xf8b0('0xe')](_0x38b5b0));if(_0x38b5b0['error']){if(_0x38b5b0[_0xf8b0('0xf')]['code']===0x1f4){logger[_0xf8b0('0xf')](_0xf8b0('0x10'),_0x4cd543,_0x38b5b0[_0xf8b0('0xf')]['message']);return _0x4cebcc(_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4cd543,_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);return _0x270978(_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);}else{logger[_0xf8b0('0xb')](_0xf8b0('0x10'),_0x4cd543,'request\x20sent');_0x270978(_0x38b5b0[_0xf8b0('0x12')][_0xf8b0('0x11')]);}})['catch'](function(_0x433a18){logger['error'](_0xf8b0('0x10'),_0x4cd543,_0x433a18);_0x4cebcc(_0x433a18);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b9db563..788f09a 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eed=['show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2656a4,_0x28dd1b){var _0x48ce85=function(_0x41d957){while(--_0x41d957){_0x2656a4['push'](_0x2656a4['shift']());}};_0x48ce85(++_0x28dd1b);}(_0x5eed,0x10a));var _0xd5ee=function(_0x73e4cb,_0x7b3763){_0x73e4cb=_0x73e4cb-0x0;var _0x580b7e=_0x5eed[_0x73e4cb];return _0x580b7e;};'use strict';var multer=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var path=require(_0xd5ee('0x2'));var timeout=require(_0xd5ee('0x3'));var express=require(_0xd5ee('0x4'));var router=express[_0xd5ee('0x5')]();var fs_extra=require(_0xd5ee('0x6'));var auth=require(_0xd5ee('0x7'));var interaction=require(_0xd5ee('0x8'));var config=require(_0xd5ee('0x9'));var controller=require('./cmContactHasItem.controller');router[_0xd5ee('0xa')]('/',auth[_0xd5ee('0xb')](),controller[_0xd5ee('0xc')]);router[_0xd5ee('0xa')](_0xd5ee('0xd'),auth[_0xd5ee('0xb')](),controller[_0xd5ee('0xe')]);router[_0xd5ee('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd5ee('0xd'),auth[_0xd5ee('0xb')](),controller[_0xd5ee('0x10')]);router[_0xd5ee('0x11')](_0xd5ee('0xd'),auth[_0xd5ee('0xb')](),controller[_0xd5ee('0x12')]);module[_0xd5ee('0x13')]=router; \ No newline at end of file +var _0x4c86=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4c86,0x8e));var _0x64c8=function(_0xa1552e,_0x423288){_0xa1552e=_0xa1552e-0x0;var _0x4a3ee7=_0x4c86[_0xa1552e];return _0x4a3ee7;};'use strict';var multer=require(_0x64c8('0x0'));var util=require(_0x64c8('0x1'));var path=require('path');var timeout=require(_0x64c8('0x2'));var express=require(_0x64c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x64c8('0x4'));var interaction=require(_0x64c8('0x5'));var config=require(_0x64c8('0x6'));var controller=require(_0x64c8('0x7'));router[_0x64c8('0x8')]('/',auth[_0x64c8('0x9')](),controller[_0x64c8('0xa')]);router[_0x64c8('0x8')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0xc')]);router['post']('/',auth[_0x64c8('0x9')](),controller[_0x64c8('0xd')]);router[_0x64c8('0xe')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0xf')]);router[_0x64c8('0x10')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0x11')]);module[_0x64c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index ad67ae9..fa47bbe 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 _0x2990=['sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','long','type','select','values','stringify','BOOLEAN','ENUM','voice'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2990,0x198));var _0x0299=function(_0x11cd17,_0x489e02){_0x11cd17=_0x11cd17-0x0;var _0x3343ad=_0x2990[_0x11cd17];return _0x3343ad;};'use strict';var Sequelize=require(_0x0299('0x0'));var _=require(_0x0299('0x1'));module[_0x0299('0x2')]={'name':{'type':Sequelize[_0x0299('0x3')],'get':function(_0x49f85e){return this[_0x0299('0x4')]('alias');}},'alias':{'type':Sequelize[_0x0299('0x5')],'allowNull':![],'set':function(_0x616c02){this[_0x0299('0x6')](_0x0299('0x7'),_0x616c02?_0x616c02:this['getDataValue'](_0x0299('0x8')));}},'type':{'type':Sequelize[_0x0299('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x0299('0x9')),'get':function(){if(this[_0x0299('0x4')](_0x0299('0xa'))===_0x0299('0xb')){return JSON['parse'](this[_0x0299('0x4')](_0x0299('0xc')));}else{return this['getDataValue'](_0x0299('0xc'));}},'set':function(_0x1ed27a){if(Array['isArray'](_0x1ed27a)){this[_0x0299('0x6')](_0x0299('0xc'),JSON[_0x0299('0xd')](_0x1ed27a));}else{this[_0x0299('0x6')](_0x0299('0xc'),_0x1ed27a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0299('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0299('0xf')](_0x0299('0x10'))}}; \ No newline at end of file +var _0x182d=['getDataValue','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','alias','STRING','setDataValue','name','long'];(function(_0x18ed54,_0x18a64f){var _0xcd7d86=function(_0x1e7d09){while(--_0x1e7d09){_0x18ed54['push'](_0x18ed54['shift']());}};_0xcd7d86(++_0x18a64f);}(_0x182d,0x1c3));var _0xd182=function(_0x51fb13,_0x4e2640){_0x51fb13=_0x51fb13-0x0;var _0x475b53=_0x182d[_0x51fb13];return _0x475b53;};'use strict';var Sequelize=require(_0xd182('0x0'));var _=require(_0xd182('0x1'));module['exports']={'name':{'type':Sequelize[_0xd182('0x2')],'get':function(_0x2bf599){return this['getDataValue'](_0xd182('0x3'));}},'alias':{'type':Sequelize[_0xd182('0x4')],'allowNull':![],'set':function(_0x2d932f){this[_0xd182('0x5')](_0xd182('0x3'),_0x2d932f?_0x2d932f:this['getDataValue'](_0xd182('0x6')));}},'type':{'type':Sequelize[_0xd182('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xd182('0x7')),'get':function(){if(this[_0xd182('0x8')](_0xd182('0x9'))==='select'){return JSON[_0xd182('0xa')](this[_0xd182('0x8')](_0xd182('0xb')));}else{return this[_0xd182('0x8')](_0xd182('0xb'));}},'set':function(_0x2b5eed){if(Array[_0xd182('0xc')](_0x2b5eed)){this[_0xd182('0x5')](_0xd182('0xb'),JSON[_0xd182('0xd')](_0x2b5eed));}else{this[_0xd182('0x5')](_0xd182('0xb'),_0x2b5eed);}}},'required':{'type':Sequelize[_0xd182('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd182('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd182('0xf')](_0xd182('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 031ba5e..8c467da 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 _0xec38=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','catch','body','find','create','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','fast-json-patch','moment','mustache','util','path'];(function(_0x26295b,_0x28cd58){var _0xe8a064=function(_0x2c7555){while(--_0x2c7555){_0x26295b['push'](_0x26295b['shift']());}};_0xe8a064(++_0x28cd58);}(_0xec38,0x14b));var _0x8ec3=function(_0x31e961,_0x4b5ec9){_0x31e961=_0x31e961-0x0;var _0x24801e=_0xec38[_0x31e961];return _0x24801e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ec3('0x0'));var rp=require('request-promise');var moment=require(_0x8ec3('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8ec3('0x2'));var util=require(_0x8ec3('0x3'));var path=require(_0x8ec3('0x4'));var sox=require(_0x8ec3('0x5'));var csv=require(_0x8ec3('0x6'));var ejs=require(_0x8ec3('0x7'));var fs=require('fs');var fs_extra=require(_0x8ec3('0x8'));var _=require(_0x8ec3('0x9'));var squel=require(_0x8ec3('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ec3('0xb'));var deskjs=require(_0x8ec3('0xc'));var toCsv=require(_0x8ec3('0x6'));var querystring=require(_0x8ec3('0xd'));var Papa=require('papaparse');var Redis=require(_0x8ec3('0xe'));var authService=require(_0x8ec3('0xf'));var qs=require(_0x8ec3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ec3('0x11'));var logger=require(_0x8ec3('0x12'))(_0x8ec3('0x13'));var utils=require('../../config/utils');var config=require(_0x8ec3('0x14'));var licenseUtil=require(_0x8ec3('0x15'));var db=require(_0x8ec3('0x16'))['db'];function respondWithStatusCode(_0x262e32,_0x4464bb){_0x4464bb=_0x4464bb||0xcc;return function(_0x48636e){if(_0x48636e){return _0x262e32[_0x8ec3('0x17')](_0x4464bb);}return _0x262e32[_0x8ec3('0x18')](_0x4464bb)[_0x8ec3('0x19')]();};}function respondWithResult(_0x161593,_0x11d7b4){_0x11d7b4=_0x11d7b4||0xc8;return function(_0x113fd9){if(_0x113fd9){return _0x161593[_0x8ec3('0x18')](_0x11d7b4)[_0x8ec3('0x1a')](_0x113fd9);}};}function respondWithFilteredResult(_0xc600d4,_0x436006){return function(_0x577b8b){if(_0x577b8b){var _0x489f98=typeof _0x436006[_0x8ec3('0x1b')]==='undefined'&&typeof _0x436006[_0x8ec3('0x1c')]===_0x8ec3('0x1d');var _0x46fff3=_0x577b8b[_0x8ec3('0x1e')];var _0x47e539=_0x489f98?0x0:_0x436006[_0x8ec3('0x1b')];var _0x55278b=_0x489f98?_0x577b8b[_0x8ec3('0x1e')]:_0x436006[_0x8ec3('0x1b')]+_0x436006[_0x8ec3('0x1c')];var _0x32d7a8;if(_0x55278b>=_0x46fff3){_0x55278b=_0x46fff3;_0x32d7a8=0xc8;}else{_0x32d7a8=0xce;}_0xc600d4[_0x8ec3('0x18')](_0x32d7a8);return _0xc600d4['set'](_0x8ec3('0x1f'),_0x47e539+'-'+_0x55278b+'/'+_0x46fff3)['json'](_0x577b8b);}return null;};}function patchUpdates(_0x1b1918){return function(_0xc6e4c9){try{jsonpatch[_0x8ec3('0x20')](_0xc6e4c9,_0x1b1918,!![]);}catch(_0x39e514){return BPromise[_0x8ec3('0x21')](_0x39e514);}return _0xc6e4c9[_0x8ec3('0x22')]();};}function saveUpdates(_0x1f0fd9,_0x4b9274){return function(_0x446c58){if(_0x446c58){return _0x446c58[_0x8ec3('0x23')](_0x1f0fd9)[_0x8ec3('0x24')](function(_0x3d68ee){return _0x3d68ee;});}return null;};}function removeEntity(_0x12d087,_0x1b9e75){return function(_0x586509){if(_0x586509){return _0x586509[_0x8ec3('0x25')]()[_0x8ec3('0x24')](function(){_0x12d087[_0x8ec3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6845,_0x3f3bb4){return function(_0x5d2592){if(!_0x5d2592){_0x4c6845['sendStatus'](0x194);}return _0x5d2592;};}function handleError(_0xeb6a3f,_0xa4b06b){_0xa4b06b=_0xa4b06b||0x1f4;return function(_0x375430){logger[_0x8ec3('0x26')](_0x375430['stack']);if(_0x375430['name']){delete _0x375430[_0x8ec3('0x27')];}_0xeb6a3f[_0x8ec3('0x18')](_0xa4b06b)[_0x8ec3('0x28')](_0x375430);};}exports[_0x8ec3('0x29')]=function(_0x348ff4,_0x305780){var _0x1678da={},_0x5b8d23={},_0x21aac7={'count':0x0,'rows':[]};var _0x110487=_[_0x8ec3('0x2a')](db[_0x8ec3('0x2b')]['rawAttributes'],function(_0x326ba7){return{'name':_0x326ba7[_0x8ec3('0x2c')],'type':_0x326ba7[_0x8ec3('0x2d')][_0x8ec3('0x2e')]};});_0x5b8d23[_0x8ec3('0x2f')]=_[_0x8ec3('0x30')](_['map'](_0x110487,'name'),[_0x8ec3('0x27')]);_0x5b8d23['query']=_[_0x8ec3('0x31')](_0x348ff4['query']);_0x5b8d23[_0x8ec3('0x32')]=_[_0x8ec3('0x33')](_0x5b8d23['model'],_0x5b8d23[_0x8ec3('0x34')]);_0x1678da[_0x8ec3('0x35')]=_['intersection'](_0x5b8d23['model'],qs[_0x8ec3('0x36')](_0x348ff4[_0x8ec3('0x34')][_0x8ec3('0x36')]));_0x1678da[_0x8ec3('0x35')]=_0x1678da[_0x8ec3('0x35')][_0x8ec3('0x37')]?_0x1678da[_0x8ec3('0x35')]:_0x5b8d23[_0x8ec3('0x2f')];if(!_0x348ff4['query']['hasOwnProperty']('nolimit')){_0x1678da[_0x8ec3('0x1c')]=qs[_0x8ec3('0x1c')](_0x348ff4[_0x8ec3('0x34')][_0x8ec3('0x1c')]);_0x1678da[_0x8ec3('0x1b')]=qs['offset'](_0x348ff4[_0x8ec3('0x34')][_0x8ec3('0x1b')]);}_0x1678da['order']=qs[_0x8ec3('0x38')](_0x348ff4[_0x8ec3('0x34')]['sort']);_0x1678da[_0x8ec3('0x39')]=qs[_0x8ec3('0x32')](_['pick'](_0x348ff4[_0x8ec3('0x34')],_0x5b8d23[_0x8ec3('0x32')]),_0x110487);if(_0x348ff4[_0x8ec3('0x34')][_0x8ec3('0x3a')]){_0x1678da[_0x8ec3('0x39')]=_[_0x8ec3('0x3b')](_0x1678da[_0x8ec3('0x39')],{'$or':_['map'](_0x110487,function(_0x5a23c3){if(_0x5a23c3['type']!==_0x8ec3('0x3c')){var _0x5c9962={};_0x5c9962[_0x5a23c3[_0x8ec3('0x27')]]={'$like':'%'+_0x348ff4['query'][_0x8ec3('0x3a')]+'%'};return _0x5c9962;}})});}_0x1678da=_[_0x8ec3('0x3b')]({},_0x1678da,_0x348ff4['options']);var _0xac53aa={'where':_0x1678da[_0x8ec3('0x39')]};return db[_0x8ec3('0x2b')]['count'](_0xac53aa)[_0x8ec3('0x24')](function(_0x3318e3){_0x21aac7[_0x8ec3('0x1e')]=_0x3318e3;if(_0x348ff4['query'][_0x8ec3('0x3d')]){_0x1678da['include']=[{'all':!![]}];}return db[_0x8ec3('0x2b')][_0x8ec3('0x3e')](_0x1678da);})[_0x8ec3('0x24')](function(_0x3e695b){_0x21aac7[_0x8ec3('0x3f')]=_0x3e695b;return _0x21aac7;})['then'](respondWithFilteredResult(_0x305780,_0x1678da))['catch'](handleError(_0x305780,null));};exports['show']=function(_0x550a12,_0x2dfe95){var _0x496936={'raw':!![],'where':{'id':_0x550a12[_0x8ec3('0x40')]['id']}},_0x1503b4={};_0x1503b4[_0x8ec3('0x2f')]=_['keys'](db[_0x8ec3('0x2b')]['rawAttributes']);_0x1503b4['query']=_['keys'](_0x550a12[_0x8ec3('0x34')]);_0x1503b4['filters']=_[_0x8ec3('0x33')](_0x1503b4[_0x8ec3('0x2f')],_0x1503b4[_0x8ec3('0x34')]);_0x496936[_0x8ec3('0x35')]=_[_0x8ec3('0x33')](_0x1503b4[_0x8ec3('0x2f')],qs[_0x8ec3('0x36')](_0x550a12[_0x8ec3('0x34')][_0x8ec3('0x36')]));_0x496936['attributes']=_0x496936[_0x8ec3('0x35')][_0x8ec3('0x37')]?_0x496936[_0x8ec3('0x35')]:_0x1503b4['model'];if(_0x550a12['query']['includeAll']){_0x496936[_0x8ec3('0x41')]=[{'all':!![]}];}_0x496936=_[_0x8ec3('0x3b')]({},_0x496936,_0x550a12[_0x8ec3('0x42')]);return db[_0x8ec3('0x2b')]['find'](_0x496936)[_0x8ec3('0x24')](handleEntityNotFound(_0x2dfe95,null))[_0x8ec3('0x24')](respondWithResult(_0x2dfe95,null))[_0x8ec3('0x43')](handleError(_0x2dfe95,null));};exports[_0x8ec3('0x23')]=function(_0x1242c0,_0x4d05c2){if(_0x1242c0[_0x8ec3('0x44')]['id']){delete _0x1242c0[_0x8ec3('0x44')]['id'];}return db[_0x8ec3('0x2b')][_0x8ec3('0x45')]({'where':{'id':_0x1242c0[_0x8ec3('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d05c2,null))[_0x8ec3('0x24')](saveUpdates(_0x1242c0[_0x8ec3('0x44')],null))[_0x8ec3('0x24')](respondWithResult(_0x4d05c2,null))['catch'](handleError(_0x4d05c2,null));};exports['destroy']=function(_0xcfddca,_0x504a76){return db[_0x8ec3('0x2b')][_0x8ec3('0x45')]({'where':{'id':_0xcfddca['params']['id']}})['then'](handleEntityNotFound(_0x504a76,null))[_0x8ec3('0x24')](removeEntity(_0x504a76,null))['catch'](handleError(_0x504a76,null));};exports[_0x8ec3('0x46')]=function(_0x313ff1,_0x17b1c4){var _0x508050;return db[_0x8ec3('0x47')]['transaction'](function(_0x463ea1){return db[_0x8ec3('0x2b')][_0x8ec3('0x46')](_0x313ff1[_0x8ec3('0x44')],{'transaction':_0x463ea1})[_0x8ec3('0x24')](function(_0x408fe4){_0x508050=_0x408fe4;var _0x4e97f7={'type':db[_0x8ec3('0x48')]['TEXT'],'transaction':_0x463ea1};switch(_0x313ff1[_0x8ec3('0x44')]['type']){case _0x8ec3('0x49'):_0x4e97f7[_0x8ec3('0x2d')]=db[_0x8ec3('0x48')][_0x8ec3('0x4a')];break;case _0x8ec3('0x4b'):_0x4e97f7[_0x8ec3('0x2d')]=db[_0x8ec3('0x48')][_0x8ec3('0x4c')];break;case _0x8ec3('0x4d'):_0x4e97f7[_0x8ec3('0x2d')]=db['Sequelize'][_0x8ec3('0x4e')];_0x4e97f7[_0x8ec3('0x4f')]=![];break;default:}return db[_0x8ec3('0x47')]['queryInterface'][_0x8ec3('0x50')](_0x8ec3('0x51'),util[_0x8ec3('0x52')](_0x8ec3('0x53'),_0x508050['id']),_0x4e97f7);})[_0x8ec3('0x24')](function(){return _0x508050;});})['then'](respondWithResult(_0x17b1c4,0xc9))['catch'](handleError(_0x17b1c4,null));}; \ No newline at end of file +var _0x3daf=['../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','CmCustomField','rawAttributes','type','key','model','differenceBy','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','params','options','body','find','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x3daf,0x1e4));var _0xf3da=function(_0x3cd645,_0xb705b5){_0x3cd645=_0x3cd645-0x0;var _0x2a04b0=_0x3daf[_0x3cd645];return _0x2a04b0;};'use strict';var emlformat=require(_0xf3da('0x0'));var rimraf=require(_0xf3da('0x1'));var zipdir=require(_0xf3da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3da('0x3'));var moment=require('moment');var BPromise=require(_0xf3da('0x4'));var Mustache=require(_0xf3da('0x5'));var util=require('util');var path=require(_0xf3da('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf3da('0x7'));var fs=require('fs');var fs_extra=require(_0xf3da('0x8'));var _=require('lodash');var squel=require(_0xf3da('0x9'));var crypto=require(_0xf3da('0xa'));var jsforce=require(_0xf3da('0xb'));var deskjs=require(_0xf3da('0xc'));var toCsv=require(_0xf3da('0xd'));var querystring=require(_0xf3da('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3da('0xf'));var qs=require(_0xf3da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3da('0x11'))(_0xf3da('0x12'));var utils=require(_0xf3da('0x13'));var config=require(_0xf3da('0x14'));var licenseUtil=require(_0xf3da('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2988eb,_0x3e9b53){_0x3e9b53=_0x3e9b53||0xcc;return function(_0x365d1a){if(_0x365d1a){return _0x2988eb['sendStatus'](_0x3e9b53);}return _0x2988eb[_0xf3da('0x16')](_0x3e9b53)['end']();};}function respondWithResult(_0x20a78c,_0x315e24){_0x315e24=_0x315e24||0xc8;return function(_0x4ae5a8){if(_0x4ae5a8){return _0x20a78c[_0xf3da('0x16')](_0x315e24)[_0xf3da('0x17')](_0x4ae5a8);}};}function respondWithFilteredResult(_0x3daa82,_0x5451b9){return function(_0x357ff4){if(_0x357ff4){var _0x2cd682=typeof _0x5451b9[_0xf3da('0x18')]===_0xf3da('0x19')&&typeof _0x5451b9[_0xf3da('0x1a')]===_0xf3da('0x19');var _0x367d3c=_0x357ff4[_0xf3da('0x1b')];var _0x40b7f3=_0x2cd682?0x0:_0x5451b9['offset'];var _0x51579f=_0x2cd682?_0x357ff4[_0xf3da('0x1b')]:_0x5451b9['offset']+_0x5451b9[_0xf3da('0x1a')];var _0x32d2ad;if(_0x51579f>=_0x367d3c){_0x51579f=_0x367d3c;_0x32d2ad=0xc8;}else{_0x32d2ad=0xce;}_0x3daa82['status'](_0x32d2ad);return _0x3daa82[_0xf3da('0x1c')]('Content-Range',_0x40b7f3+'-'+_0x51579f+'/'+_0x367d3c)[_0xf3da('0x17')](_0x357ff4);}return null;};}function patchUpdates(_0x3d779e){return function(_0x3e3e02){try{jsonpatch[_0xf3da('0x1d')](_0x3e3e02,_0x3d779e,!![]);}catch(_0x3c8328){return BPromise[_0xf3da('0x1e')](_0x3c8328);}return _0x3e3e02[_0xf3da('0x1f')]();};}function saveUpdates(_0xe43c44,_0x444d34){return function(_0x36fd26){if(_0x36fd26){return _0x36fd26[_0xf3da('0x20')](_0xe43c44)[_0xf3da('0x21')](function(_0x49c976){return _0x49c976;});}return null;};}function removeEntity(_0x3ba945,_0xf533ac){return function(_0x1ad17e){if(_0x1ad17e){return _0x1ad17e[_0xf3da('0x22')]()[_0xf3da('0x21')](function(){_0x3ba945['status'](0xcc)[_0xf3da('0x23')]();});}};}function handleEntityNotFound(_0x2f7ae4,_0x24b72b){return function(_0x423518){if(!_0x423518){_0x2f7ae4['sendStatus'](0x194);}return _0x423518;};}function handleError(_0x48cd6c,_0x4a515e){_0x4a515e=_0x4a515e||0x1f4;return function(_0x19c02b){logger[_0xf3da('0x24')](_0x19c02b[_0xf3da('0x25')]);if(_0x19c02b['name']){delete _0x19c02b[_0xf3da('0x26')];}_0x48cd6c[_0xf3da('0x16')](_0x4a515e)[_0xf3da('0x27')](_0x19c02b);};}exports['index']=function(_0x1c88e6,_0x2ffedf){var _0x34550a={},_0x4239a6={},_0x15e0f2={'count':0x0,'rows':[]};var _0x5c9beb=_['map'](db[_0xf3da('0x28')][_0xf3da('0x29')],function(_0x27cbed){return{'name':_0x27cbed['fieldName'],'type':_0x27cbed[_0xf3da('0x2a')][_0xf3da('0x2b')]};});_0x4239a6[_0xf3da('0x2c')]=_[_0xf3da('0x2d')](_[_0xf3da('0x2e')](_0x5c9beb,_0xf3da('0x26')),[_0xf3da('0x26')]);_0x4239a6['query']=_[_0xf3da('0x2f')](_0x1c88e6[_0xf3da('0x30')]);_0x4239a6[_0xf3da('0x31')]=_['intersection'](_0x4239a6[_0xf3da('0x2c')],_0x4239a6['query']);_0x34550a[_0xf3da('0x32')]=_[_0xf3da('0x33')](_0x4239a6[_0xf3da('0x2c')],qs['fields'](_0x1c88e6['query'][_0xf3da('0x34')]));_0x34550a[_0xf3da('0x32')]=_0x34550a[_0xf3da('0x32')][_0xf3da('0x35')]?_0x34550a[_0xf3da('0x32')]:_0x4239a6[_0xf3da('0x2c')];if(!_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x36')](_0xf3da('0x37'))){_0x34550a[_0xf3da('0x1a')]=qs['limit'](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x1a')]);_0x34550a['offset']=qs[_0xf3da('0x18')](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x18')]);}_0x34550a[_0xf3da('0x38')]=qs[_0xf3da('0x39')](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x39')]);_0x34550a[_0xf3da('0x3a')]=qs[_0xf3da('0x31')](_[_0xf3da('0x3b')](_0x1c88e6[_0xf3da('0x30')],_0x4239a6[_0xf3da('0x31')]),_0x5c9beb);if(_0x1c88e6[_0xf3da('0x30')]['filter']){_0x34550a['where']=_['merge'](_0x34550a['where'],{'$or':_[_0xf3da('0x2e')](_0x5c9beb,function(_0x26282f){if(_0x26282f['type']!==_0xf3da('0x3c')){var _0xda5b60={};_0xda5b60[_0x26282f[_0xf3da('0x26')]]={'$like':'%'+_0x1c88e6['query'][_0xf3da('0x3d')]+'%'};return _0xda5b60;}})});}_0x34550a=_[_0xf3da('0x3e')]({},_0x34550a,_0x1c88e6['options']);var _0x1220c0={'where':_0x34550a[_0xf3da('0x3a')]};return db[_0xf3da('0x28')]['count'](_0x1220c0)['then'](function(_0x558011){_0x15e0f2[_0xf3da('0x1b')]=_0x558011;if(_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x3f')]){_0x34550a[_0xf3da('0x40')]=[{'all':!![]}];}return db[_0xf3da('0x28')][_0xf3da('0x41')](_0x34550a);})[_0xf3da('0x21')](function(_0x822a55){_0x15e0f2[_0xf3da('0x42')]=_0x822a55;return _0x15e0f2;})[_0xf3da('0x21')](respondWithFilteredResult(_0x2ffedf,_0x34550a))[_0xf3da('0x43')](handleError(_0x2ffedf,null));};exports['show']=function(_0x2c6320,_0x8c8559){var _0x2ee0fb={'raw':!![],'where':{'id':_0x2c6320[_0xf3da('0x44')]['id']}},_0x114073={};_0x114073['model']=_[_0xf3da('0x2f')](db[_0xf3da('0x28')]['rawAttributes']);_0x114073['query']=_[_0xf3da('0x2f')](_0x2c6320[_0xf3da('0x30')]);_0x114073['filters']=_[_0xf3da('0x33')](_0x114073[_0xf3da('0x2c')],_0x114073[_0xf3da('0x30')]);_0x2ee0fb['attributes']=_[_0xf3da('0x33')](_0x114073[_0xf3da('0x2c')],qs[_0xf3da('0x34')](_0x2c6320[_0xf3da('0x30')][_0xf3da('0x34')]));_0x2ee0fb[_0xf3da('0x32')]=_0x2ee0fb[_0xf3da('0x32')][_0xf3da('0x35')]?_0x2ee0fb[_0xf3da('0x32')]:_0x114073['model'];if(_0x2c6320[_0xf3da('0x30')]['includeAll']){_0x2ee0fb[_0xf3da('0x40')]=[{'all':!![]}];}_0x2ee0fb=_[_0xf3da('0x3e')]({},_0x2ee0fb,_0x2c6320[_0xf3da('0x45')]);return db[_0xf3da('0x28')]['find'](_0x2ee0fb)[_0xf3da('0x21')](handleEntityNotFound(_0x8c8559,null))['then'](respondWithResult(_0x8c8559,null))[_0xf3da('0x43')](handleError(_0x8c8559,null));};exports[_0xf3da('0x20')]=function(_0x5f4165,_0x5d83cd){if(_0x5f4165[_0xf3da('0x46')]['id']){delete _0x5f4165[_0xf3da('0x46')]['id'];}return db[_0xf3da('0x28')][_0xf3da('0x47')]({'where':{'id':_0x5f4165[_0xf3da('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d83cd,null))[_0xf3da('0x21')](saveUpdates(_0x5f4165['body'],null))['then'](respondWithResult(_0x5d83cd,null))[_0xf3da('0x43')](handleError(_0x5d83cd,null));};exports[_0xf3da('0x22')]=function(_0x130950,_0x115697){return db[_0xf3da('0x28')][_0xf3da('0x47')]({'where':{'id':_0x130950['params']['id']}})[_0xf3da('0x21')](handleEntityNotFound(_0x115697,null))[_0xf3da('0x21')](removeEntity(_0x115697,null))[_0xf3da('0x43')](handleError(_0x115697,null));};exports[_0xf3da('0x48')]=function(_0xb159a7,_0x29e530){var _0x12ee2d;return db['sequelize']['transaction'](function(_0x3dcd9a){return db[_0xf3da('0x28')][_0xf3da('0x48')](_0xb159a7['body'],{'transaction':_0x3dcd9a})[_0xf3da('0x21')](function(_0x1291d6){_0x12ee2d=_0x1291d6;var _0xa43790={'type':db[_0xf3da('0x49')][_0xf3da('0x4a')],'transaction':_0x3dcd9a};switch(_0xb159a7[_0xf3da('0x46')]['type']){case _0xf3da('0x4b'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4a')];break;case _0xf3da('0x4c'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4d')];break;case _0xf3da('0x4e'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4f')];_0xa43790['defaultValue']=![];break;default:}return db[_0xf3da('0x50')][_0xf3da('0x51')][_0xf3da('0x52')]('cm_contacts',util[_0xf3da('0x53')]('cf_%d',_0x12ee2d['id']),_0xa43790);})[_0xf3da('0x21')](function(){return _0x12ee2d;});})[_0xf3da('0x21')](respondWithResult(_0x29e530,0xc9))[_0xf3da('0x43')](handleError(_0x29e530,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f1aacb4..9d0fce4 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 _0xa7f5=['cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmCustomField'];(function(_0x3c64c8,_0x39bc36){var _0x2373a6=function(_0x1a47f3){while(--_0x1a47f3){_0x3c64c8['push'](_0x3c64c8['shift']());}};_0x2373a6(++_0x39bc36);}(_0xa7f5,0x12d));var _0x5a7f=function(_0x5c2236,_0xb22f1e){_0x5c2236=_0x5c2236-0x0;var _0x597cfd=_0xa7f5[_0x5c2236];return _0x597cfd;};'use strict';var _=require(_0x5a7f('0x0'));var util=require('util');var logger=require(_0x5a7f('0x1'))(_0x5a7f('0x2'));var moment=require(_0x5a7f('0x3'));var BPromise=require(_0x5a7f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a7f('0x5'));var rimraf=require(_0x5a7f('0x6'));var config=require(_0x5a7f('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x5a7f('0x8')]=function(_0x3fed4b,_0xa7d370){return _0x3fed4b[_0x5a7f('0x9')](_0x5a7f('0xa'),attributes,{'tableName':_0x5a7f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e64=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e4800,_0x144aaa){var _0x260452=function(_0x531de3){while(--_0x531de3){_0x1e4800['push'](_0x1e4800['shift']());}};_0x260452(++_0x144aaa);}(_0x8e64,0x19e));var _0x48e6=function(_0xd9ae3,_0x17eec4){_0xd9ae3=_0xd9ae3-0x0;var _0x3daa8b=_0x8e64[_0xd9ae3];return _0x3daa8b;};'use strict';var _=require('lodash');var util=require(_0x48e6('0x0'));var logger=require(_0x48e6('0x1'))(_0x48e6('0x2'));var moment=require(_0x48e6('0x3'));var BPromise=require(_0x48e6('0x4'));var rp=require(_0x48e6('0x5'));var fs=require('fs');var path=require(_0x48e6('0x6'));var rimraf=require(_0x48e6('0x7'));var config=require(_0x48e6('0x8'));var attributes=require(_0x48e6('0x9'));module[_0x48e6('0xa')]=function(_0x25be8b,_0x58db1f){return _0x25be8b[_0x48e6('0xb')](_0x48e6('0xc'),attributes,{'tableName':_0x48e6('0xd'),'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 1837556..948a253 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 _0x4074=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','stringify','code','error','CmCustomField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird'];(function(_0x519f3a,_0x18c5f4){var _0x2421ff=function(_0x3c57ae){while(--_0x3c57ae){_0x519f3a['push'](_0x519f3a['shift']());}};_0x2421ff(++_0x18c5f4);}(_0x4074,0x1b4));var _0x4407=function(_0x48599a,_0x2934a9){_0x48599a=_0x48599a-0x0;var _0xee7fe2=_0x4074[_0x48599a];return _0xee7fe2;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var moment=require(_0x4407('0x2'));var BPromise=require(_0x4407('0x3'));var rs=require(_0x4407('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4407('0x5'));var logger=require(_0x4407('0x6'))(_0x4407('0x7'));var config=require(_0x4407('0x8'));var jayson=require(_0x4407('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12e165,_0x189564,_0x2a562e){return new BPromise(function(_0x18146e,_0x1c5f2a){return client[_0x4407('0xa')](_0x12e165,_0x2a562e)[_0x4407('0xb')](function(_0x36edfa){logger['info']('CmCustomField,\x20%s,\x20%s',_0x189564,_0x4407('0xc'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x189564,_0x4407('0xc'),JSON[_0x4407('0xd')](_0x36edfa));if(_0x36edfa['error']){if(_0x36edfa['error'][_0x4407('0xe')]===0x1f4){logger[_0x4407('0xf')](_0x4407('0x10'),_0x189564,_0x36edfa[_0x4407('0xf')][_0x4407('0x11')]);return _0x1c5f2a(_0x36edfa[_0x4407('0xf')][_0x4407('0x11')]);}logger[_0x4407('0xf')]('CmCustomField,\x20%s,\x20%s',_0x189564,_0x36edfa[_0x4407('0xf')][_0x4407('0x11')]);return _0x18146e(_0x36edfa[_0x4407('0xf')][_0x4407('0x11')]);}else{logger[_0x4407('0x12')]('CmCustomField,\x20%s,\x20%s',_0x189564,_0x4407('0xc'));_0x18146e(_0x36edfa['result'][_0x4407('0x11')]);}})[_0x4407('0x13')](function(_0x593b2c){logger[_0x4407('0xf')](_0x4407('0x10'),_0x189564,_0x593b2c);_0x1c5f2a(_0x593b2c);});});} \ No newline at end of file +var _0x1194=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xdc0e74,_0x4ab035){var _0x222685=function(_0x526e56){while(--_0x526e56){_0xdc0e74['push'](_0xdc0e74['shift']());}};_0x222685(++_0x4ab035);}(_0x1194,0x1d4));var _0x4119=function(_0x44b0af,_0xdb6975){_0x44b0af=_0x44b0af-0x0;var _0xafaa74=_0x1194[_0x44b0af];return _0xafaa74;};'use strict';var _=require(_0x4119('0x0'));var util=require('util');var moment=require(_0x4119('0x1'));var BPromise=require(_0x4119('0x2'));var rs=require(_0x4119('0x3'));var fs=require('fs');var Redis=require(_0x4119('0x4'));var db=require(_0x4119('0x5'))['db'];var utils=require(_0x4119('0x6'));var logger=require('../../config/logger')(_0x4119('0x7'));var config=require(_0x4119('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4119('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2765da,_0x78cc91,_0x33c87e){return new BPromise(function(_0x8f72a9,_0x12374a){return client[_0x4119('0xa')](_0x2765da,_0x33c87e)[_0x4119('0xb')](function(_0x3b6f10){logger[_0x4119('0xc')](_0x4119('0xd'),_0x78cc91,_0x4119('0xe'));logger[_0x4119('0xf')](_0x4119('0x10'),_0x78cc91,_0x4119('0xe'),JSON[_0x4119('0x11')](_0x3b6f10));if(_0x3b6f10[_0x4119('0x12')]){if(_0x3b6f10['error']['code']===0x1f4){logger[_0x4119('0x12')]('CmCustomField,\x20%s,\x20%s',_0x78cc91,_0x3b6f10[_0x4119('0x12')][_0x4119('0x13')]);return _0x12374a(_0x3b6f10['error'][_0x4119('0x13')]);}logger[_0x4119('0x12')](_0x4119('0xd'),_0x78cc91,_0x3b6f10['error'][_0x4119('0x13')]);return _0x8f72a9(_0x3b6f10['error'][_0x4119('0x13')]);}else{logger[_0x4119('0xc')](_0x4119('0xd'),_0x78cc91,_0x4119('0xe'));_0x8f72a9(_0x3b6f10[_0x4119('0x14')][_0x4119('0x13')]);}})[_0x4119('0x15')](function(_0x5baf50){logger[_0x4119('0x12')](_0x4119('0xd'),_0x78cc91,_0x5baf50);_0x12374a(_0x5baf50);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 17b262f..d8c455d 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 _0xe02e=['put','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x1455b1,_0x4f6ed8){var _0x106f50=function(_0x612a84){while(--_0x612a84){_0x1455b1['push'](_0x1455b1['shift']());}};_0x106f50(++_0x4f6ed8);}(_0xe02e,0x1f0));var _0xee02=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe02e[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require('multer');var util=require(_0xee02('0x0'));var path=require(_0xee02('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee02('0x2')]();var fs_extra=require(_0xee02('0x3'));var auth=require(_0xee02('0x4'));var interaction=require(_0xee02('0x5'));var config=require(_0xee02('0x6'));var controller=require(_0xee02('0x7'));router[_0xee02('0x8')]('/',auth[_0xee02('0x9')](),controller['index']);router[_0xee02('0x8')](_0xee02('0xa'),auth[_0xee02('0x9')](),controller[_0xee02('0xb')]);router[_0xee02('0xc')]('/',auth['isAuthenticated'](),controller[_0xee02('0xd')]);router[_0xee02('0xe')]('/:id',auth[_0xee02('0x9')](),controller['update']);router[_0xee02('0xf')](_0xee02('0xa'),auth[_0xee02('0x9')](),controller[_0xee02('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4bc6=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','/:id','update','exports'];(function(_0x42095d,_0x4e2d02){var _0x5e7efe=function(_0x2e1170){while(--_0x2e1170){_0x42095d['push'](_0x42095d['shift']());}};_0x5e7efe(++_0x4e2d02);}(_0x4bc6,0xd0));var _0x64bc=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x4bc6[_0x2112d4];return _0x434972;};'use strict';var multer=require('multer');var util=require(_0x64bc('0x0'));var path=require(_0x64bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x64bc('0x2'));var router=express['Router']();var fs_extra=require(_0x64bc('0x3'));var auth=require(_0x64bc('0x4'));var interaction=require(_0x64bc('0x5'));var config=require(_0x64bc('0x6'));var controller=require(_0x64bc('0x7'));router[_0x64bc('0x8')]('/',auth[_0x64bc('0x9')](),controller[_0x64bc('0xa')]);router[_0x64bc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x64bc('0xb')]('/',auth[_0x64bc('0x9')](),controller[_0x64bc('0xc')]);router['put'](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller[_0x64bc('0xe')]);router['delete'](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller['destroy']);module[_0x64bc('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6326992..7b63995 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 _0x8aaa=['moment','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x8aaa,0x122));var _0xa8aa=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0x8aaa[_0x3f670b];return _0x1c0978;};'use strict';var moment=require(_0xa8aa('0x0'));var Sequelize=require(_0xa8aa('0x1'));module[_0xa8aa('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa8aa('0x3')],'defaultValue':moment()[_0xa8aa('0x4')](_0xa8aa('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa8aa('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa8aa('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa8aa('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa8aa('0x3')]},'priority':{'type':Sequelize[_0xa8aa('0x6')](0x2)[_0xa8aa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa8aa('0x6')],'unique':_0xa8aa('0x9')},'ListId':{'type':Sequelize[_0xa8aa('0x6')],'unique':_0xa8aa('0x9')},'UserId':{'type':Sequelize[_0xa8aa('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa8aa('0x9')},'CampaignId':{'type':Sequelize[_0xa8aa('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xa8aa('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa8aa('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa8aa('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa8aa('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa8aa('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa8aa('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xf7e5=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x4f66c2,_0x47d4ed){var _0x447633=function(_0x3205d4){while(--_0x3205d4){_0x4f66c2['push'](_0x4f66c2['shift']());}};_0x447633(++_0x47d4ed);}(_0xf7e5,0x1d8));var _0x5f7e=function(_0x395aee,_0x43b759){_0x395aee=_0x395aee-0x0;var _0x1837a5=_0xf7e5[_0x395aee];return _0x1837a5;};'use strict';var moment=require(_0x5f7e('0x0'));var Sequelize=require(_0x5f7e('0x1'));module[_0x5f7e('0x2')]={'phone':{'type':Sequelize[_0x5f7e('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5f7e('0x4')],'defaultValue':moment()[_0x5f7e('0x5')](_0x5f7e('0x6'))},'countbusyretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5f7e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5f7e('0x4')]},'priority':{'type':Sequelize[_0x5f7e('0x7')](0x2)[_0x5f7e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5f7e('0x7')],'unique':_0x5f7e('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5f7e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x5f7e('0x7')],'unique':_0x5f7e('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 213c078..fe59821 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 _0x3eea=['create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','updatedAt','state','deleted','campaign','user','deletedat','calleridnum','phone','queue','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','format','YYYY-MM-DD\x20HH:mm:ss','value','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','sequelize','literal','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','CmContact','transaction','UPDATE','getOpenContacts','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','update','name','send','map','CmHopper','rawAttributes','fieldName','type','model','query','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','params','keys','find'];(function(_0x3ef236,_0x5ac42c){var _0x1ba184=function(_0x4fceac){while(--_0x4fceac){_0x3ef236['push'](_0x3ef236['shift']());}};_0x1ba184(++_0x5ac42c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1c9c21,_0x132826){_0x1c9c21=_0x1c9c21-0x0;var _0x460ed6=_0x3eea[_0x1c9c21];return _0x460ed6;};'use strict';var moment=require(_0xa3ee('0x0'));var _=require('lodash');var qs=require(_0xa3ee('0x1'));var logger=require(_0xa3ee('0x2'))(_0xa3ee('0x3'));var shared=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];function respondWithResult(_0x269141,_0x104913){_0x104913=_0x104913||0xc8;return function(_0x35ed7d){if(_0x35ed7d){return _0x269141[_0xa3ee('0x6')](_0x104913)[_0xa3ee('0x7')](_0x35ed7d);}};}function respondWithFilteredResult(_0xb93cdb,_0x5776bb){return function(_0x538bf9){if(_0x538bf9){var _0x4183ee=typeof _0x5776bb['offset']===_0xa3ee('0x8')&&typeof _0x5776bb['limit']===_0xa3ee('0x8');var _0x5c4df0=_0x538bf9[_0xa3ee('0x9')];var _0x5ef236=_0x4183ee?0x0:_0x5776bb[_0xa3ee('0xa')];var _0x1a3ab0=_0x4183ee?_0x538bf9[_0xa3ee('0x9')]:_0x5776bb['offset']+_0x5776bb[_0xa3ee('0xb')];var _0x327e98;if(_0x1a3ab0>=_0x5c4df0){_0x1a3ab0=_0x5c4df0;_0x327e98=0xc8;}else{_0x327e98=0xce;}_0xb93cdb['status'](_0x327e98);return _0xb93cdb['set'](_0xa3ee('0xc'),_0x5ef236+'-'+_0x1a3ab0+'/'+_0x5c4df0)[_0xa3ee('0x7')](_0x538bf9);}return null;};}function saveUpdates(_0x403518,_0x4363d1){return function(_0x594c88){if(_0x594c88){return _0x594c88[_0xa3ee('0xd')](_0x403518)['then'](function(_0x43b3bc){return _0x43b3bc;});}return null;};}function handleEntityNotFound(_0x20535f,_0x2c34cf){return function(_0x150e20){if(!_0x150e20){_0x20535f['sendStatus'](0x194);}return _0x150e20;};}function handleError(_0x2a82e5,_0x23df7d){_0x23df7d=_0x23df7d||0x1f4;return function(_0x5da681){logger['error'](_0x5da681['stack']);if(_0x5da681[_0xa3ee('0xe')]){delete _0x5da681[_0xa3ee('0xe')];}_0x2a82e5[_0xa3ee('0x6')](_0x23df7d)[_0xa3ee('0xf')](_0x5da681);};}exports['index']=function(_0x4735b7,_0x40ffdb){var _0x339758={},_0x299b1e={},_0xfab13e={'count':0x0,'rows':[]};var _0x4aac0e=_[_0xa3ee('0x10')](db[_0xa3ee('0x11')][_0xa3ee('0x12')],function(_0xad8187){return{'name':_0xad8187[_0xa3ee('0x13')],'type':_0xad8187[_0xa3ee('0x14')]['key']};});_0x299b1e[_0xa3ee('0x15')]=_[_0xa3ee('0x10')](_0x4aac0e,'name');_0x299b1e[_0xa3ee('0x16')]=_['keys'](_0x4735b7[_0xa3ee('0x16')]);_0x299b1e[_0xa3ee('0x17')]=_[_0xa3ee('0x18')](_0x299b1e[_0xa3ee('0x15')],_0x299b1e[_0xa3ee('0x16')]);_0x299b1e[_0xa3ee('0x17')]=_[_0xa3ee('0x19')](_0x299b1e[_0xa3ee('0x17')],[_0xa3ee('0x1a'),_0xa3ee('0x1b'),'$gt',_0xa3ee('0x1c'),_0xa3ee('0x1d'),_0xa3ee('0x1e'),_0xa3ee('0x1f'),_0xa3ee('0x20'),'$not',_0xa3ee('0x21'),_0xa3ee('0x22'),_0xa3ee('0x23'),_0xa3ee('0x24'),_0xa3ee('0x25'),_0xa3ee('0x26'),_0xa3ee('0x27'),_0xa3ee('0x28'),_0xa3ee('0x25'),_0xa3ee('0x29'),'$contains','$contained','$any']);_0x339758[_0xa3ee('0x2a')]=_['intersection'](_0x299b1e[_0xa3ee('0x15')],qs[_0xa3ee('0x2b')](_0x4735b7[_0xa3ee('0x16')][_0xa3ee('0x2b')]));_0x339758[_0xa3ee('0x2a')]=_0x339758[_0xa3ee('0x2a')][_0xa3ee('0x2c')]?_0x339758[_0xa3ee('0x2a')]:_0x299b1e[_0xa3ee('0x15')];if(!_0x4735b7[_0xa3ee('0x16')]['hasOwnProperty'](_0xa3ee('0x2d'))){_0x339758['limit']=qs[_0xa3ee('0xb')](_0x4735b7[_0xa3ee('0x16')]['limit']);_0x339758[_0xa3ee('0xa')]=qs['offset'](_0x4735b7[_0xa3ee('0x16')]['offset']);}_0x339758[_0xa3ee('0x2e')]=qs[_0xa3ee('0x2f')](_0x4735b7[_0xa3ee('0x16')][_0xa3ee('0x2f')]);_0x339758[_0xa3ee('0x30')]=qs['filters'](_[_0xa3ee('0x31')](_0x4735b7[_0xa3ee('0x16')],_0x299b1e[_0xa3ee('0x17')]),_0x4aac0e);if(_0x4735b7['query'][_0xa3ee('0x32')]){_0x339758['where']=_[_0xa3ee('0x33')](_0x339758['where'],{'$or':_[_0xa3ee('0x10')](_0x4aac0e,function(_0x478945){if(_0x478945[_0xa3ee('0x14')]!==_0xa3ee('0x34')){var _0x3f67af={};_0x3f67af[_0x478945[_0xa3ee('0xe')]]={'$like':'%'+_0x4735b7[_0xa3ee('0x16')][_0xa3ee('0x32')]+'%'};return _0x3f67af;}})});}_0x339758=_[_0xa3ee('0x33')]({},_0x339758,_0x4735b7[_0xa3ee('0x35')]);var _0x256c63={'where':_0x339758[_0xa3ee('0x30')]};return db[_0xa3ee('0x11')][_0xa3ee('0x9')](_0x256c63)[_0xa3ee('0x36')](function(_0x595b55){_0xfab13e[_0xa3ee('0x9')]=_0x595b55;if(_0x4735b7[_0xa3ee('0x16')][_0xa3ee('0x37')]){_0x339758[_0xa3ee('0x38')]=[{'all':!![]}];}return db['CmHopper'][_0xa3ee('0x39')](_0x339758);})[_0xa3ee('0x36')](function(_0x1a9b63){_0xfab13e['rows']=_0x1a9b63;return _0xfab13e;})[_0xa3ee('0x36')](respondWithFilteredResult(_0x40ffdb,_0x339758))[_0xa3ee('0x3a')](handleError(_0x40ffdb,null));};exports['show']=function(_0x319c26,_0x3ecbe6){var _0x4ef99a={'raw':!![],'where':{'id':_0x319c26[_0xa3ee('0x3b')]['id']}},_0x2a8e02={};_0x2a8e02[_0xa3ee('0x15')]=_[_0xa3ee('0x3c')](db[_0xa3ee('0x11')][_0xa3ee('0x12')]);_0x2a8e02[_0xa3ee('0x16')]=_[_0xa3ee('0x3c')](_0x319c26[_0xa3ee('0x16')]);_0x2a8e02[_0xa3ee('0x17')]=_[_0xa3ee('0x18')](_0x2a8e02['model'],_0x2a8e02['query']);_0x4ef99a['attributes']=_[_0xa3ee('0x18')](_0x2a8e02[_0xa3ee('0x15')],qs['fields'](_0x319c26[_0xa3ee('0x16')][_0xa3ee('0x2b')]));_0x4ef99a[_0xa3ee('0x2a')]=_0x4ef99a['attributes'][_0xa3ee('0x2c')]?_0x4ef99a['attributes']:_0x2a8e02[_0xa3ee('0x15')];if(_0x319c26[_0xa3ee('0x16')][_0xa3ee('0x37')]){_0x4ef99a[_0xa3ee('0x38')]=[{'all':!![]}];}_0x4ef99a=_[_0xa3ee('0x33')]({},_0x4ef99a,_0x319c26[_0xa3ee('0x35')]);return db[_0xa3ee('0x11')][_0xa3ee('0x3d')](_0x4ef99a)[_0xa3ee('0x36')](handleEntityNotFound(_0x3ecbe6,null))[_0xa3ee('0x36')](respondWithResult(_0x3ecbe6,null))[_0xa3ee('0x3a')](handleError(_0x3ecbe6,null));};exports[_0xa3ee('0x3e')]=function(_0x11b78f,_0x37359b){return db[_0xa3ee('0x11')][_0xa3ee('0x3e')](_0x11b78f[_0xa3ee('0x3f')],{})[_0xa3ee('0x36')](respondWithResult(_0x37359b,0xc9))['catch'](handleError(_0x37359b,null));};exports[_0xa3ee('0xd')]=function(_0xdca412,_0x112e80){if(_0xdca412[_0xa3ee('0x3f')]['id']){delete _0xdca412['body']['id'];}return db[_0xa3ee('0x11')]['find']({'where':{'id':_0xdca412[_0xa3ee('0x3b')]['id']}})[_0xa3ee('0x36')](handleEntityNotFound(_0x112e80,null))[_0xa3ee('0x36')](saveUpdates(_0xdca412[_0xa3ee('0x3f')],null))[_0xa3ee('0x36')](respondWithResult(_0x112e80,null))[_0xa3ee('0x3a')](handleError(_0x112e80,null));};exports[_0xa3ee('0x40')]=function(_0xbb0148,_0x3c3677){return db[_0xa3ee('0x11')]['describe']()[_0xa3ee('0x36')](respondWithResult(_0x3c3677,null))['catch'](handleError(_0x3c3677,null));};exports['destroy']=function(_0xaad29c,_0x2f7171){var _0x45029f;var _0x1ec479=_0xaad29c[_0xa3ee('0x3b')]['id'];return db[_0xa3ee('0x11')][_0xa3ee('0x3d')]({'where':{'id':_0xaad29c['params']['id']}})[_0xa3ee('0x36')](handleEntityNotFound(_0x2f7171,null))[_0xa3ee('0x36')](function(_0x4bd73b){if(_0x4bd73b){return _0x4bd73b[_0xa3ee('0x41')]()[_0xa3ee('0x36')](function(_0x2f1db4){return _0x2f1db4;});}})['then'](function(_0x587a1a){_0x45029f=_0x587a1a;if(_0x587a1a){if(_0x587a1a[_0xa3ee('0x42')]||_0x587a1a[_0xa3ee('0x43')]){return db[_0x587a1a[_0xa3ee('0x42')]?_0xa3ee('0x44'):_0xa3ee('0x45')]['find']({'where':{'id':_0x587a1a['VoiceQueueId']?_0x587a1a[_0xa3ee('0x42')]:_0x587a1a[_0xa3ee('0x43')]},'attributes':['id','name'],'raw':!![]});}}})[_0xa3ee('0x36')](function(_0x8ed2cd){var _0x13cd8b={};if(_0x8ed2cd){_['merge'](_0x13cd8b,_['omit'](_0x45029f[_0xa3ee('0x46')],['createdAt',_0xa3ee('0x47'),'id']));_0x13cd8b[_0xa3ee('0x48')]=0x15;_0x13cd8b['statedesc']=_0xa3ee('0x49');_0x13cd8b[_0xa3ee('0x4a')]=_0x8ed2cd[_0xa3ee('0xe')];_0x13cd8b['membername']=_0xaad29c[_0xa3ee('0x4b')][_0xa3ee('0xe')];_0x13cd8b['UserId']=_0xaad29c[_0xa3ee('0x4b')]['id'];_0x13cd8b[_0xa3ee('0x49')]=!![];_0x13cd8b[_0xa3ee('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x13cd8b[_0xa3ee('0x4d')]=_0x45029f[_0xa3ee('0x4e')];_0x13cd8b['campaigntype']=_0x45029f[_0xa3ee('0x42')]?_0xa3ee('0x4f'):'ivr';return db['CmContact'][_0xa3ee('0x3d')]({'where':{'id':_0x13cd8b[_0xa3ee('0x50')]},'attributes':[_0xa3ee('0x51'),'lastName']})[_0xa3ee('0x36')](function(_0x1f401d){if(!_[_0xa3ee('0x52')](_0x2f7171)&&!_[_0xa3ee('0x52')](_0x1f401d[_0xa3ee('0x51')])){_0x13cd8b[_0xa3ee('0x53')]=_0x1f401d['firstName'];if(!_[_0xa3ee('0x52')](_0x1f401d[_0xa3ee('0x54')])){_0x13cd8b['calleridname']+='\x20'+_0x1f401d[_0xa3ee('0x54')];}}})[_0xa3ee('0x55')](function(){return db[_0xa3ee('0x56')][_0xa3ee('0x3e')](_0x13cd8b);});}})[_0xa3ee('0x36')](function(_0x330778){return db['CmHopperAdditionalPhone'][_0xa3ee('0x41')]({'where':{'CmHopperId':_0x1ec479}});})[_0xa3ee('0x36')](function(){return _0x2f7171[_0xa3ee('0x6')](0xcc)['end']();})[_0xa3ee('0x3a')](handleError(_0x2f7171,null));};exports[_0xa3ee('0x57')]=function(_0x519f10,_0x517f4b){var _0x4df186=[];return db['CmContact'][_0xa3ee('0x40')]()[_0xa3ee('0x36')](function(_0x3adafb){_0x4df186=_[_0xa3ee('0x3c')](_0x3adafb);return _0x519f10[_0xa3ee('0x4b')][_0xa3ee('0x58')]({'where':{'type':_0xa3ee('0x59'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa3ee('0x5a'),_0xa3ee('0x5b')],'raw':!![]});})[_0xa3ee('0x36')](function(_0xaff641){if(_0xaff641&&_0xaff641[_0xa3ee('0x2c')]){return db['sequelize']['transaction'](function(_0x7b1e97){var _0x303b71={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa3ee('0x5c')](_0xa3ee('0x5d'))},'VoiceQueueId':{'$in':_[_0xa3ee('0x10')](_0xaff641,'id')},'$or':[{'UserId':null},{'UserId':_0x519f10[_0xa3ee('0x4b')]['id']}]};var _0x41a0ea={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xaff641)[_0xa3ee('0x32')]([_0xa3ee('0x5b'),0x0])[_0xa3ee('0x10')]('id')[_0xa3ee('0x5e')]()},'$or':[{'UserId':null},{'UserId':_0x519f10[_0xa3ee('0x4b')]['id']}]};var _0x64f353={'$or':[_0x303b71,_0x41a0ea]};var _0x224790=[];if(_0x519f10[_0xa3ee('0x3f')]['direction']&&_0x519f10[_0xa3ee('0x3f')]['direction']==='prev'){if(!_[_0xa3ee('0x5f')](_0x519f10['body'][_0xa3ee('0x60')])){_0x64f353['id']={'$in':_0x519f10[_0xa3ee('0x3f')][_0xa3ee('0x60')]};}_0x224790=[[_0xa3ee('0x61'),'ASC'],[_0xa3ee('0x62'),_0xaff641[0x0][_0xa3ee('0x5a')]===_0xa3ee('0x63')?_0xa3ee('0x64'):'ASC'],db[_0xa3ee('0x65')][_0xa3ee('0x66')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa3ee('0x64')]];}else{if(!_['isEmpty'](_0x519f10['body'][_0xa3ee('0x60')])){_0x64f353['id']={'$notIn':_0x519f10['body']['hopperIds']};}_0x224790=[[_0xa3ee('0x61'),'DESC'],['scheduledAt',_0xaff641[0x0][_0xa3ee('0x5a')]],db[_0xa3ee('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xa3ee('0x11')][_0xa3ee('0x67')]({'attributes':['id',_0xa3ee('0x68'),_0xa3ee('0x4e'),_0xa3ee('0x69')],'where':_0x64f353,'order':_0x224790,'transaction':_0x7b1e97,'lock':_0x7b1e97[_0xa3ee('0x6a')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa3ee('0x6b'),'attributes':_0x4df186,'include':[{'model':db[_0xa3ee('0x6c')],'as':_0xa3ee('0x6d'),'attributes':['id','name']}]},{'model':db[_0xa3ee('0x6e')],'as':_0xa3ee('0x6f'),'attributes':['id','name']},{'model':db[_0xa3ee('0x44')],'as':_0xa3ee('0x70'),'attributes':['id',_0xa3ee('0xe'),_0xa3ee('0x71')]}]})[_0xa3ee('0x36')](function(_0x58a7db){if(_0x58a7db){return _0x58a7db[_0xa3ee('0xd')]({'UserId':_0x519f10[_0xa3ee('0x4b')]['id']},{'transaction':_0x7b1e97});}});});}})[_0xa3ee('0x36')](handleEntityNotFound(_0x517f4b,null))[_0xa3ee('0x36')](respondWithResult(_0x517f4b,null))[_0xa3ee('0x3a')](handleError(_0x517f4b,null));};exports[_0xa3ee('0x72')]=function(_0xaf12ae,_0x119d4c,_0x448f14){var _0x5e51fa=[];var _0x4e3ef9=_0xaf12ae[_0xa3ee('0x3b')]['id'];var _0x57afba=_0xaf12ae[_0xa3ee('0x4b')]['id'];return db[_0xa3ee('0x73')][_0xa3ee('0x40')]()[_0xa3ee('0x36')](function(_0x574b07){_0x5e51fa=_[_0xa3ee('0x3c')](_0x574b07);return db[_0xa3ee('0x65')][_0xa3ee('0x74')](function(_0xf289e2){const _0x6e36f3={'id':_0x4e3ef9};return db['CmHopper'][_0xa3ee('0x67')]({'attributes':['id',_0xa3ee('0x68'),_0xa3ee('0x69')],'where':_0x6e36f3,'transaction':_0xf289e2,'lock':_0xf289e2['LOCK'][_0xa3ee('0x75')],'include':[{'model':db['CmContact'],'as':_0xa3ee('0x6b'),'attributes':_0x5e51fa,'include':[{'model':db['CmCompany'],'as':_0xa3ee('0x6d'),'attributes':['id',_0xa3ee('0xe')]}]},{'model':db[_0xa3ee('0x6e')],'as':_0xa3ee('0x6f'),'attributes':['id','name']},{'model':db[_0xa3ee('0x44')],'as':_0xa3ee('0x70'),'attributes':['id','name',_0xa3ee('0x71')]}]})[_0xa3ee('0x36')](function(_0x44b084){if(_0x44b084){return _0x44b084[_0xa3ee('0xd')]({'UserId':_0x57afba},{'transaction':_0xf289e2});}});});})[_0xa3ee('0x36')](handleEntityNotFound(_0x119d4c,null))['then'](respondWithResult(_0x119d4c,null))[_0xa3ee('0x3a')](handleError(_0x119d4c,null));};exports[_0xa3ee('0x76')]=function(_0x55a6b7,_0x2535ef){return _0x55a6b7[_0xa3ee('0x4b')][_0xa3ee('0x58')]({'where':{'type':_0xa3ee('0x59'),'dialActive':!![],'dialMethod':_0xa3ee('0x77')},'attributes':['id'],'raw':!![]})[_0xa3ee('0x36')](function(_0x31d3ca){if(_0x31d3ca&&_0x31d3ca[_0xa3ee('0x2c')]){return db[_0xa3ee('0x11')][_0xa3ee('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa3ee('0x5d'))},'VoiceQueueId':{'$in':_[_0xa3ee('0x10')](_0x31d3ca,'id')},'$or':[{'UserId':null},{'UserId':_0x55a6b7[_0xa3ee('0x4b')]['id']}]}});}return 0x0;})['then'](function(_0x44254f){if(!_['isNil'](_0x44254f)&&_[_0xa3ee('0x78')](_0x44254f)){return _0x2535ef[_0xa3ee('0x6')](0xc8)['json']({'contacts':_0x44254f});}else{logger[_0xa3ee('0x79')](_0xa3ee('0x7a'),'getOpenContacts',0x194,_0xa3ee('0x7b'));_0x2535ef[_0xa3ee('0x7c')](0x194);}})[_0xa3ee('0x3a')](handleError(_0x2535ef,null));};exports[_0xa3ee('0x7d')]=function(_0xc43c3,_0x3395b8){var _0x4c6a41=shared['timezones'];var _0x4b5983=[];_[_0xa3ee('0x10')](_0x4c6a41,function(_0x4a5e85){_0x4b5983[_0xa3ee('0x7e')]({'id':_0x4a5e85[_0xa3ee('0xe')],'name':_0x4a5e85[_0xa3ee('0xe')],'utcOffset':_0x4a5e85[_0xa3ee('0x7f')]});});return _0x3395b8[_0xa3ee('0x6')](0xc8)[_0xa3ee('0x7')]({'tz':_0x4b5983});};exports[_0xa3ee('0x80')]=function(_0xea3d66,_0x473bfc){var _0x34429e=shared[_0xa3ee('0x81')];var _0x98482f={};if(!_[_0xa3ee('0x52')](_0x34429e[_0xea3d66[_0xa3ee('0x3f')]['id']]))_0x98482f=_0x34429e[_0xea3d66[_0xa3ee('0x3f')]['id']];return _0x473bfc[_0xa3ee('0x6')](0xc8)[_0xa3ee('0x7')](_0x98482f);}; \ No newline at end of file +var _0xbfe8=['CmHopperAdditionalPhone','end','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','filter','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','CmList','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','then','error','stack','name','send','map','CmHopper','type','key','model','query','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','catch','show','keys','rawAttributes','intersection','length','options','find','create','update','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x244a8a,_0x53d435){_0x244a8a=_0x244a8a-0x0;var _0x335fa7=_0xbfe8[_0x244a8a];return _0x335fa7;};'use strict';var moment=require('moment');var _=require(_0x8bfe('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8bfe('0x1'))(_0x8bfe('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x101fc1,_0x31df14){_0x31df14=_0x31df14||0xc8;return function(_0x57eb53){if(_0x57eb53){return _0x101fc1[_0x8bfe('0x3')](_0x31df14)[_0x8bfe('0x4')](_0x57eb53);}};}function respondWithFilteredResult(_0x314a9a,_0x4933c9){return function(_0x29bb94){if(_0x29bb94){var _0x1b7dbd=typeof _0x4933c9[_0x8bfe('0x5')]===_0x8bfe('0x6')&&typeof _0x4933c9[_0x8bfe('0x7')]===_0x8bfe('0x6');var _0x19a47e=_0x29bb94[_0x8bfe('0x8')];var _0x243a11=_0x1b7dbd?0x0:_0x4933c9[_0x8bfe('0x5')];var _0x1f19ee=_0x1b7dbd?_0x29bb94[_0x8bfe('0x8')]:_0x4933c9[_0x8bfe('0x5')]+_0x4933c9[_0x8bfe('0x7')];var _0x30f76d;if(_0x1f19ee>=_0x19a47e){_0x1f19ee=_0x19a47e;_0x30f76d=0xc8;}else{_0x30f76d=0xce;}_0x314a9a['status'](_0x30f76d);return _0x314a9a[_0x8bfe('0x9')]('Content-Range',_0x243a11+'-'+_0x1f19ee+'/'+_0x19a47e)[_0x8bfe('0x4')](_0x29bb94);}return null;};}function saveUpdates(_0x2f479d,_0x22a131){return function(_0x5ba48c){if(_0x5ba48c){return _0x5ba48c['update'](_0x2f479d)[_0x8bfe('0xa')](function(_0x425eb8){return _0x425eb8;});}return null;};}function handleEntityNotFound(_0x22737f,_0x36fd25){return function(_0x46c8e3){if(!_0x46c8e3){_0x22737f['sendStatus'](0x194);}return _0x46c8e3;};}function handleError(_0x41cc42,_0x5520d7){_0x5520d7=_0x5520d7||0x1f4;return function(_0x55914b){logger[_0x8bfe('0xb')](_0x55914b[_0x8bfe('0xc')]);if(_0x55914b[_0x8bfe('0xd')]){delete _0x55914b['name'];}_0x41cc42['status'](_0x5520d7)[_0x8bfe('0xe')](_0x55914b);};}exports['index']=function(_0x4d6993,_0x2e7c29){var _0x17d688={},_0x5d8bf1={},_0x13ffc3={'count':0x0,'rows':[]};var _0xfd4a2a=_[_0x8bfe('0xf')](db[_0x8bfe('0x10')]['rawAttributes'],function(_0xbc7fa2){return{'name':_0xbc7fa2['fieldName'],'type':_0xbc7fa2[_0x8bfe('0x11')][_0x8bfe('0x12')]};});_0x5d8bf1[_0x8bfe('0x13')]=_['map'](_0xfd4a2a,'name');_0x5d8bf1[_0x8bfe('0x14')]=_['keys'](_0x4d6993['query']);_0x5d8bf1[_0x8bfe('0x15')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],_0x5d8bf1['query']);_0x5d8bf1[_0x8bfe('0x15')]=_[_0x8bfe('0x16')](_0x5d8bf1[_0x8bfe('0x15')],[_0x8bfe('0x17'),'$or',_0x8bfe('0x18'),_0x8bfe('0x19'),'$lt',_0x8bfe('0x1a'),_0x8bfe('0x1b'),_0x8bfe('0x1c'),_0x8bfe('0x1d'),_0x8bfe('0x1e'),_0x8bfe('0x1f'),'$in',_0x8bfe('0x20'),_0x8bfe('0x21'),_0x8bfe('0x22'),_0x8bfe('0x23'),_0x8bfe('0x24'),_0x8bfe('0x21'),_0x8bfe('0x25'),_0x8bfe('0x26'),_0x8bfe('0x27'),_0x8bfe('0x28')]);_0x17d688[_0x8bfe('0x29')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x4d6993['query'][_0x8bfe('0x2a')]));_0x17d688[_0x8bfe('0x29')]=_0x17d688[_0x8bfe('0x29')]['length']?_0x17d688[_0x8bfe('0x29')]:_0x5d8bf1[_0x8bfe('0x13')];if(!_0x4d6993['query']['hasOwnProperty'](_0x8bfe('0x2b'))){_0x17d688[_0x8bfe('0x7')]=qs[_0x8bfe('0x7')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x7')]);_0x17d688[_0x8bfe('0x5')]=qs[_0x8bfe('0x5')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x5')]);}_0x17d688[_0x8bfe('0x2c')]=qs['sort'](_0x4d6993['query'][_0x8bfe('0x2d')]);_0x17d688[_0x8bfe('0x2e')]=qs[_0x8bfe('0x15')](_[_0x8bfe('0x2f')](_0x4d6993[_0x8bfe('0x14')],_0x5d8bf1[_0x8bfe('0x15')]),_0xfd4a2a);if(_0x4d6993[_0x8bfe('0x14')]['filter']){_0x17d688[_0x8bfe('0x2e')]=_[_0x8bfe('0x30')](_0x17d688['where'],{'$or':_[_0x8bfe('0xf')](_0xfd4a2a,function(_0x96cdc9){if(_0x96cdc9[_0x8bfe('0x11')]!==_0x8bfe('0x31')){var _0x407763={};_0x407763[_0x96cdc9['name']]={'$like':'%'+_0x4d6993[_0x8bfe('0x14')]['filter']+'%'};return _0x407763;}})});}_0x17d688=_['merge']({},_0x17d688,_0x4d6993['options']);var _0x56e04b={'where':_0x17d688[_0x8bfe('0x2e')]};return db[_0x8bfe('0x10')][_0x8bfe('0x8')](_0x56e04b)[_0x8bfe('0xa')](function(_0x23ac8b){_0x13ffc3[_0x8bfe('0x8')]=_0x23ac8b;if(_0x4d6993[_0x8bfe('0x14')]['includeAll']){_0x17d688[_0x8bfe('0x32')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x17d688);})['then'](function(_0x18e0e7){_0x13ffc3[_0x8bfe('0x33')]=_0x18e0e7;return _0x13ffc3;})[_0x8bfe('0xa')](respondWithFilteredResult(_0x2e7c29,_0x17d688))[_0x8bfe('0x34')](handleError(_0x2e7c29,null));};exports[_0x8bfe('0x35')]=function(_0x6b96d6,_0x3a65a6){var _0x20b085={'raw':!![],'where':{'id':_0x6b96d6['params']['id']}},_0x52c9da={};_0x52c9da[_0x8bfe('0x13')]=_[_0x8bfe('0x36')](db[_0x8bfe('0x10')][_0x8bfe('0x37')]);_0x52c9da[_0x8bfe('0x14')]=_[_0x8bfe('0x36')](_0x6b96d6[_0x8bfe('0x14')]);_0x52c9da[_0x8bfe('0x15')]=_[_0x8bfe('0x38')](_0x52c9da['model'],_0x52c9da[_0x8bfe('0x14')]);_0x20b085[_0x8bfe('0x29')]=_[_0x8bfe('0x38')](_0x52c9da[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x6b96d6[_0x8bfe('0x14')][_0x8bfe('0x2a')]));_0x20b085['attributes']=_0x20b085[_0x8bfe('0x29')][_0x8bfe('0x39')]?_0x20b085['attributes']:_0x52c9da[_0x8bfe('0x13')];if(_0x6b96d6['query']['includeAll']){_0x20b085[_0x8bfe('0x32')]=[{'all':!![]}];}_0x20b085=_[_0x8bfe('0x30')]({},_0x20b085,_0x6b96d6[_0x8bfe('0x3a')]);return db['CmHopper'][_0x8bfe('0x3b')](_0x20b085)['then'](handleEntityNotFound(_0x3a65a6,null))[_0x8bfe('0xa')](respondWithResult(_0x3a65a6,null))[_0x8bfe('0x34')](handleError(_0x3a65a6,null));};exports['create']=function(_0x1b99ec,_0x3433a1){return db[_0x8bfe('0x10')][_0x8bfe('0x3c')](_0x1b99ec['body'],{})[_0x8bfe('0xa')](respondWithResult(_0x3433a1,0xc9))[_0x8bfe('0x34')](handleError(_0x3433a1,null));};exports[_0x8bfe('0x3d')]=function(_0x4af00f,_0x58342b){if(_0x4af00f[_0x8bfe('0x3e')]['id']){delete _0x4af00f[_0x8bfe('0x3e')]['id'];}return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x4af00f[_0x8bfe('0x3f')]['id']}})[_0x8bfe('0xa')](handleEntityNotFound(_0x58342b,null))[_0x8bfe('0xa')](saveUpdates(_0x4af00f[_0x8bfe('0x3e')],null))['then'](respondWithResult(_0x58342b,null))[_0x8bfe('0x34')](handleError(_0x58342b,null));};exports[_0x8bfe('0x40')]=function(_0x4e6949,_0x4eb069){return db[_0x8bfe('0x10')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](respondWithResult(_0x4eb069,null))['catch'](handleError(_0x4eb069,null));};exports[_0x8bfe('0x41')]=function(_0x3c4086,_0x55ad6e){var _0x1f2788;var _0x2ad3c1=_0x3c4086[_0x8bfe('0x3f')]['id'];return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x3c4086[_0x8bfe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55ad6e,null))['then'](function(_0x5a653d){if(_0x5a653d){return _0x5a653d['destroy']()[_0x8bfe('0xa')](function(_0x2b84a3){return _0x2b84a3;});}})[_0x8bfe('0xa')](function(_0x28947e){_0x1f2788=_0x28947e;if(_0x28947e){if(_0x28947e[_0x8bfe('0x42')]||_0x28947e['CampaignId']){return db[_0x28947e[_0x8bfe('0x42')]?_0x8bfe('0x43'):_0x8bfe('0x44')][_0x8bfe('0x3b')]({'where':{'id':_0x28947e[_0x8bfe('0x42')]?_0x28947e[_0x8bfe('0x42')]:_0x28947e['CampaignId']},'attributes':['id',_0x8bfe('0xd')],'raw':!![]});}}})[_0x8bfe('0xa')](function(_0x4ddb08){var _0x16d99e={};if(_0x4ddb08){_['merge'](_0x16d99e,_['omit'](_0x1f2788['dataValues'],[_0x8bfe('0x45'),_0x8bfe('0x46'),'id']));_0x16d99e[_0x8bfe('0x47')]=0x15;_0x16d99e['statedesc']=_0x8bfe('0x48');_0x16d99e[_0x8bfe('0x49')]=_0x4ddb08[_0x8bfe('0xd')];_0x16d99e['membername']=_0x3c4086[_0x8bfe('0x4a')][_0x8bfe('0xd')];_0x16d99e[_0x8bfe('0x4b')]=_0x3c4086[_0x8bfe('0x4a')]['id'];_0x16d99e['deleted']=!![];_0x16d99e[_0x8bfe('0x4c')]=moment()[_0x8bfe('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x16d99e[_0x8bfe('0x4e')]=_0x1f2788[_0x8bfe('0x4f')];_0x16d99e[_0x8bfe('0x50')]=_0x1f2788['VoiceQueueId']?_0x8bfe('0x51'):_0x8bfe('0x52');return db[_0x8bfe('0x53')][_0x8bfe('0x3b')]({'where':{'id':_0x16d99e[_0x8bfe('0x54')]},'attributes':['firstName',_0x8bfe('0x55')]})[_0x8bfe('0xa')](function(_0x3ff83d){if(!_[_0x8bfe('0x56')](_0x55ad6e)&&!_[_0x8bfe('0x56')](_0x3ff83d[_0x8bfe('0x57')])){_0x16d99e['calleridname']=_0x3ff83d[_0x8bfe('0x57')];if(!_['isNil'](_0x3ff83d[_0x8bfe('0x55')])){_0x16d99e[_0x8bfe('0x58')]+='\x20'+_0x3ff83d[_0x8bfe('0x55')];}}})[_0x8bfe('0x59')](function(){return db[_0x8bfe('0x5a')][_0x8bfe('0x3c')](_0x16d99e);});}})['then'](function(_0x159d37){return db[_0x8bfe('0x5b')][_0x8bfe('0x41')]({'where':{'CmHopperId':_0x2ad3c1}});})['then'](function(){return _0x55ad6e[_0x8bfe('0x3')](0xcc)[_0x8bfe('0x5c')]();})['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x5d')]=function(_0x29f56c,_0x121bea){var _0x56959e=[];return db[_0x8bfe('0x53')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x126398){_0x56959e=_[_0x8bfe('0x36')](_0x126398);return _0x29f56c[_0x8bfe('0x4a')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id',_0x8bfe('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8bfe('0xa')](function(_0x500467){if(_0x500467&&_0x500467[_0x8bfe('0x39')]){return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x5062d5){var _0x4b87cb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x500467,'id')},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0xfa5db0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x500467)[_0x8bfe('0x62')]([_0x8bfe('0x63'),0x0])['map']('id')[_0x8bfe('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0x1f153d={'$or':[_0x4b87cb,_0xfa5db0]};var _0x199e90=[];if(_0x29f56c[_0x8bfe('0x3e')]['direction']&&_0x29f56c[_0x8bfe('0x3e')]['direction']===_0x8bfe('0x65')){if(!_[_0x8bfe('0x66')](_0x29f56c['body']['hopperIds'])){_0x1f153d['id']={'$in':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),_0x8bfe('0x69')],['scheduledAt',_0x500467[0x0][_0x8bfe('0x5f')]==='ASC'?_0x8bfe('0x6a'):_0x8bfe('0x69')],db[_0x8bfe('0x60')][_0x8bfe('0x6b')](_0x8bfe('0x6c')),['id',_0x8bfe('0x6a')]];}else{if(!_[_0x8bfe('0x66')](_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')])){_0x1f153d['id']={'$notIn':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),'DESC'],['scheduledAt',_0x500467[0x0]['dialOrderByScheduledAt']],db[_0x8bfe('0x60')]['literal'](_0x8bfe('0x6d')),['id','ASC']];}return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x4f'),_0x8bfe('0x70')],'where':_0x1f153d,'order':_0x199e90,'transaction':_0x5062d5,'lock':_0x5062d5[_0x8bfe('0x71')][_0x8bfe('0x72')],'include':[{'model':db['CmContact'],'as':_0x8bfe('0x73'),'attributes':_0x56959e,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':_0x8bfe('0x77'),'attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x454616){if(_0x454616){return _0x454616['update']({'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']},{'transaction':_0x5062d5});}});});}})[_0x8bfe('0xa')](handleEntityNotFound(_0x121bea,null))[_0x8bfe('0xa')](respondWithResult(_0x121bea,null))['catch'](handleError(_0x121bea,null));};exports[_0x8bfe('0x79')]=function(_0x31bd4b,_0x2d2236,_0x127701){var _0x5e8e2d=[];var _0x23ea23=_0x31bd4b[_0x8bfe('0x3f')]['id'];var _0x1207a4=_0x31bd4b['user']['id'];return db['CmContact'][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x28012b){_0x5e8e2d=_[_0x8bfe('0x36')](_0x28012b);return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x781d89){const _0x4619f0={'id':_0x23ea23};return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x70')],'where':_0x4619f0,'transaction':_0x781d89,'lock':_0x781d89['LOCK'][_0x8bfe('0x72')],'include':[{'model':db[_0x8bfe('0x53')],'as':_0x8bfe('0x73'),'attributes':_0x5e8e2d,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id',_0x8bfe('0xd')]}]},{'model':db[_0x8bfe('0x7a')],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':'Queue','attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x29bf2f){if(_0x29bf2f){return _0x29bf2f[_0x8bfe('0x3d')]({'UserId':_0x1207a4},{'transaction':_0x781d89});}});});})[_0x8bfe('0xa')](handleEntityNotFound(_0x2d2236,null))['then'](respondWithResult(_0x2d2236,null))[_0x8bfe('0x34')](handleError(_0x2d2236,null));};exports[_0x8bfe('0x7b')]=function(_0x2ea522,_0x42abcc){return _0x2ea522[_0x8bfe('0x4a')][_0x8bfe('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id'],'raw':!![]})[_0x8bfe('0xa')](function(_0x2b6a29){if(_0x2b6a29&&_0x2b6a29[_0x8bfe('0x39')]){return db[_0x8bfe('0x10')][_0x8bfe('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2b6a29,'id')},'$or':[{'UserId':null},{'UserId':_0x2ea522[_0x8bfe('0x4a')]['id']}]}});}return 0x0;})['then'](function(_0x39ffe1){if(!_[_0x8bfe('0x56')](_0x39ffe1)&&_[_0x8bfe('0x7d')](_0x39ffe1)){return _0x42abcc[_0x8bfe('0x3')](0xc8)['json']({'contacts':_0x39ffe1});}else{logger[_0x8bfe('0xb')](_0x8bfe('0x7e'),_0x8bfe('0x7b'),0x194,_0x8bfe('0x7f'));_0x42abcc[_0x8bfe('0x80')](0x194);}})[_0x8bfe('0x34')](handleError(_0x42abcc,null));};exports[_0x8bfe('0x81')]=function(_0x94b726,_0x1a8a31){var _0x4ace16=shared[_0x8bfe('0x82')];var _0x3ef0ea=[];_[_0x8bfe('0xf')](_0x4ace16,function(_0x580ab5){_0x3ef0ea[_0x8bfe('0x83')]({'id':_0x580ab5[_0x8bfe('0xd')],'name':_0x580ab5[_0x8bfe('0xd')],'utcOffset':_0x580ab5['utcOffset']});});return _0x1a8a31[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')]({'tz':_0x3ef0ea});};exports[_0x8bfe('0x84')]=function(_0x5879b1,_0x5daf7d){var _0xa19a58=shared[_0x8bfe('0x82')];var _0x21d9ec={};if(!_['isNil'](_0xa19a58[_0x5879b1['body']['id']]))_0x21d9ec=_0xa19a58[_0x5879b1[_0x8bfe('0x3e')]['id']];return _0x5daf7d[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')](_0x21d9ec);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0de7668..ae55b0c 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 _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xd117,0x182));var _0x7d11=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0xd117[_0x1a12c8];return _0x305109;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'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(_0xdea1ee,_0x2d2841){var _0x96c530=function(_0x4e743b){while(--_0x4e743b){_0xdea1ee['push'](_0xdea1ee['shift']());}};_0x96c530(++_0x2d2841);}(_0x4975,0x86));var _0x5497=function(_0x1620bb,_0x1a0ed0){_0x1620bb=_0x1620bb-0x0;var _0x4bb717=_0x4975[_0x1620bb];return _0x4bb717;};'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 fe777a7..eb0cb54 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 _0xd193=['ResetActiveCalls','voiceQueueIds','availableAgentsIds','\x20MINUTE','NOW()','Agent','name','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','debug','ShowCmHopper','CmHopper','find','where','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE','Contact','User','length','push','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UserId','LOCK','all','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone'];(function(_0x40bbc7,_0x31ae88){var _0x18486c=function(_0x52a4c7){while(--_0x52a4c7){_0x40bbc7['push'](_0x40bbc7['shift']());}};_0x18486c(++_0x31ae88);}(_0xd193,0x119));var _0x3d19=function(_0x555bef,_0x3dda60){_0x555bef=_0x555bef-0x0;var _0x317ace=_0xd193[_0x555bef];return _0x317ace;};'use strict';var _=require(_0x3d19('0x0'));var util=require(_0x3d19('0x1'));var moment=require(_0x3d19('0x2'));var BPromise=require(_0x3d19('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x3d19('0x4'));var jayson=require(_0x3d19('0x5'));var client=jayson[_0x3d19('0x6')][_0x3d19('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x553b2d,_0x3f2851,_0x3338f2){return new BPromise(function(_0x15ae76,_0x3ebfaa){return client[_0x3d19('0x8')](_0x553b2d,_0x3338f2)[_0x3d19('0x9')](function(_0x29d989){logger[_0x3d19('0xa')](_0x3d19('0xb'),_0x3f2851,_0x3d19('0xc'));logger['debug'](_0x3d19('0xd'),_0x3f2851,'request\x20sent',JSON[_0x3d19('0xe')](_0x29d989));if(_0x29d989[_0x3d19('0xf')]){if(_0x29d989[_0x3d19('0xf')][_0x3d19('0x10')]===0x1f4){logger[_0x3d19('0xf')]('CmHopper,\x20%s,\x20%s',_0x3f2851,_0x29d989[_0x3d19('0xf')][_0x3d19('0x11')]);return _0x3ebfaa(_0x29d989['error'][_0x3d19('0x11')]);}logger[_0x3d19('0xf')](_0x3d19('0xb'),_0x3f2851,_0x29d989[_0x3d19('0xf')][_0x3d19('0x11')]);return _0x15ae76(_0x29d989[_0x3d19('0xf')][_0x3d19('0x11')]);}else{logger[_0x3d19('0xa')](_0x3d19('0xb'),_0x3f2851,_0x3d19('0xc'));_0x15ae76(_0x29d989['result'][_0x3d19('0x11')]);}})[_0x3d19('0x12')](function(_0x2d1789){logger[_0x3d19('0xf')](_0x3d19('0xb'),_0x3f2851,_0x2d1789);_0x3ebfaa(_0x2d1789);});});}exports[_0x3d19('0x13')]=function(_0x344cee){var _0x5cc622=this;return new Promise(function(_0x2d6f51,_0x3c617a){return db['CmHopper'][_0x3d19('0x14')]({'raw':_0x344cee[_0x3d19('0x15')]?_0x344cee[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![],'where':_0x344cee['options']?_0x344cee[_0x3d19('0x15')]['where']||null:null,'attributes':_0x344cee[_0x3d19('0x15')]?_0x344cee[_0x3d19('0x15')][_0x3d19('0x17')]||null:null,'limit':_0x344cee[_0x3d19('0x15')]?_0x344cee[_0x3d19('0x15')][_0x3d19('0x18')]||null:null,'include':_0x344cee[_0x3d19('0x15')]?_0x344cee['options'][_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x344cee[_0x3d19('0x15')]['include'],function(_0x34b9e3){return{'model':db[_0x34b9e3[_0x3d19('0x1b')]],'as':_0x34b9e3['as'],'attributes':_0x34b9e3[_0x3d19('0x17')],'include':_0x34b9e3[_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x34b9e3[_0x3d19('0x19')],function(_0x4decdf){return{'model':db[_0x4decdf[_0x3d19('0x1b')]],'as':_0x4decdf['as'],'attributes':_0x4decdf[_0x3d19('0x17')],'include':_0x4decdf['include']?_[_0x3d19('0x1a')](_0x4decdf[_0x3d19('0x19')],function(_0xb2b9d7){return{'model':db[_0xb2b9d7[_0x3d19('0x1b')]],'as':_0xb2b9d7['as'],'attributes':_0xb2b9d7[_0x3d19('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3d19('0x9')](function(_0x376fbd){logger[_0x3d19('0xa')](_0x3d19('0x13'),_0x344cee);logger[_0x3d19('0x1c')]('GetCmHopper',_0x344cee,JSON[_0x3d19('0xe')](_0x376fbd));_0x2d6f51(_0x376fbd);})[_0x3d19('0x12')](function(_0x4cb209){logger[_0x3d19('0xf')](_0x3d19('0x13'),_0x4cb209[_0x3d19('0x11')],_0x344cee);_0x3c617a(_0x5cc622[_0x3d19('0xf')](0x1f4,_0x4cb209[_0x3d19('0x11')]));});});};exports[_0x3d19('0x1d')]=function(_0x6ad115){var _0x3bf9f8=this;return new Promise(function(_0x9c5eac,_0x401c6b){return db[_0x3d19('0x1e')][_0x3d19('0x1f')]({'raw':_0x6ad115[_0x3d19('0x15')]?_0x6ad115[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![],'where':_0x6ad115[_0x3d19('0x15')]?_0x6ad115[_0x3d19('0x15')][_0x3d19('0x20')]||null:null,'attributes':_0x6ad115['options']?_0x6ad115[_0x3d19('0x15')][_0x3d19('0x17')]||null:null,'include':_0x6ad115['options']?_0x6ad115[_0x3d19('0x15')]['include']?_[_0x3d19('0x1a')](_0x6ad115['options'][_0x3d19('0x19')],function(_0x3a98f8){return{'model':db[_0x3a98f8[_0x3d19('0x1b')]],'as':_0x3a98f8['as'],'attributes':_0x3a98f8[_0x3d19('0x17')],'include':_0x3a98f8['include']?_[_0x3d19('0x1a')](_0x3a98f8[_0x3d19('0x19')],function(_0x1d6d35){return{'model':db[_0x1d6d35[_0x3d19('0x1b')]],'as':_0x1d6d35['as'],'attributes':_0x1d6d35[_0x3d19('0x17')],'include':_0x1d6d35[_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x1d6d35[_0x3d19('0x19')],function(_0x9465ab){return{'model':db[_0x9465ab[_0x3d19('0x1b')]],'as':_0x9465ab['as'],'attributes':_0x9465ab[_0x3d19('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3d19('0x9')](function(_0x251068){logger[_0x3d19('0xa')]('ShowCmHopper',_0x6ad115);logger['debug'](_0x3d19('0x1d'),_0x6ad115,JSON['stringify'](_0x251068));_0x9c5eac(_0x251068);})[_0x3d19('0x12')](function(_0x47aa21){logger[_0x3d19('0xf')](_0x3d19('0x1d'),_0x47aa21[_0x3d19('0x11')],_0x6ad115);_0x401c6b(_0x3bf9f8['error'](0x1f4,_0x47aa21[_0x3d19('0x11')]));});});};exports[_0x3d19('0x21')]=function(_0x3f71de){var _0x204021=this;return new Promise(function(_0x587063,_0x5f28c0){return db[_0x3d19('0x1e')][_0x3d19('0x22')](_0x3f71de[_0x3d19('0x23')],{'raw':_0x3f71de[_0x3d19('0x15')]?_0x3f71de[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4eb4a1){logger[_0x3d19('0xa')]('CreateCmHopper',_0x3f71de);logger[_0x3d19('0x1c')]('CreateCmHopper',_0x3f71de,JSON['stringify'](_0x4eb4a1));_0x587063(_0x4eb4a1);})[_0x3d19('0x12')](function(_0x328040){logger[_0x3d19('0xf')](_0x3d19('0x21'),_0x328040[_0x3d19('0x11')],_0x3f71de);_0x5f28c0(_0x204021['error'](0x1f4,_0x328040[_0x3d19('0x11')]));});});};exports[_0x3d19('0x24')]=function(_0x1b4c04){var _0x59aa9b=this;return new Promise(function(_0x150e0a,_0x1bed87){return db[_0x3d19('0x1e')][_0x3d19('0x25')](_0x1b4c04[_0x3d19('0x23')],{'raw':_0x1b4c04[_0x3d19('0x15')]?_0x1b4c04[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4c04[_0x3d19('0x15')]?_0x1b4c04[_0x3d19('0x15')]['where']||null:null,'attributes':_0x1b4c04[_0x3d19('0x15')]?_0x1b4c04[_0x3d19('0x15')]['attributes']||null:null,'limit':_0x1b4c04[_0x3d19('0x15')]?_0x1b4c04[_0x3d19('0x15')]['limit']||null:null})[_0x3d19('0x9')](function(_0x25128f){logger['info'](_0x3d19('0x24'),_0x1b4c04);logger[_0x3d19('0xa')](_0x3d19('0x26'),JSON[_0x3d19('0xe')](_0x1b4c04['options'][_0x3d19('0x20')]),_0x1b4c04[_0x3d19('0x23')][_0x3d19('0x27')]);logger[_0x3d19('0x1c')](_0x3d19('0x24'),_0x1b4c04,JSON['stringify'](_0x25128f));_0x150e0a(_0x25128f);})[_0x3d19('0x12')](function(_0x419503){logger['error'](_0x3d19('0x24'),_0x419503[_0x3d19('0x11')],_0x1b4c04);_0x1bed87(_0x59aa9b[_0x3d19('0xf')](0x1f4,_0x419503[_0x3d19('0x11')]));});});};exports['DestroyCmHopper']=function(_0x52eb2a){var _0x56eb38=this;return new Promise(function(_0x2dddd5,_0x416976){return db['CmHopper'][_0x3d19('0x28')]({'where':_0x52eb2a['options']?_0x52eb2a[_0x3d19('0x15')][_0x3d19('0x20')]||null:null})['then'](function(_0x220b24){logger[_0x3d19('0xa')](_0x3d19('0x29'),_0x52eb2a);logger[_0x3d19('0x1c')](_0x3d19('0x29'),_0x52eb2a,JSON[_0x3d19('0xe')](_0x220b24));_0x2dddd5(_0x220b24);})[_0x3d19('0x12')](function(_0x37707a){logger[_0x3d19('0xf')](_0x3d19('0x29'),_0x37707a['message'],_0x52eb2a);_0x416976(_0x56eb38['error'](0x1f4,_0x37707a['message']));});});};exports[_0x3d19('0x2a')]=function(_0x940cfb){var _0x1b1076=this;return new Promise(function(_0xf1ab74,_0x1b951e){return db[_0x3d19('0x2b')]['describe']()[_0x3d19('0x9')](function(_0x2d3d3d){return db[_0x3d19('0x2c')][_0x3d19('0x2d')](function(_0x1ee3a3){return db[_0x3d19('0x1e')]['findAll']({'where':_0x940cfb[_0x3d19('0x15')]?_0x940cfb[_0x3d19('0x15')][_0x3d19('0x20')]||null:null,'attributes':_0x940cfb[_0x3d19('0x15')]?_0x940cfb[_0x3d19('0x15')][_0x3d19('0x17')]||null:null,'limit':_0x940cfb[_0x3d19('0x15')]?_0x940cfb[_0x3d19('0x15')]['limit']||null:null,'order':_0x940cfb[_0x3d19('0x15')]?_0x940cfb[_0x3d19('0x15')][_0x3d19('0x2e')]||null:null,'transaction':_0x1ee3a3,'lock':_0x1ee3a3['LOCK'][_0x3d19('0x2f')],'include':[{'model':db[_0x3d19('0x2b')],'as':_0x3d19('0x30'),'attributes':_['keys'](_0x2d3d3d)},{'model':db[_0x3d19('0x31')],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x3d19('0x9')](function(_0x49fb5a){var _0x355123=[];var _0x33c5e5=[];for(var _0x12c1ea=0x0;_0x12c1ea<_0x49fb5a[_0x3d19('0x32')];_0x12c1ea+=0x1){var _0x1a186b=_0x49fb5a[_0x12c1ea]['UserId'];if(_0x1a186b===null){_0x355123[_0x3d19('0x33')](_0x49fb5a[_0x12c1ea][_0x3d19('0x25')](_0x940cfb[_0x3d19('0x23')],{'transaction':_0x1ee3a3}));}else if(!_0x33c5e5['includes'](_0x1a186b)){_0x33c5e5[_0x3d19('0x33')](_0x1a186b);_0x355123[_0x3d19('0x33')](_0x49fb5a[_0x12c1ea][_0x3d19('0x25')](_0x940cfb[_0x3d19('0x23')],{'transaction':_0x1ee3a3}));}}return BPromise['all'](_0x355123);});})[_0x3d19('0x9')](function(_0x3d1ebb){logger[_0x3d19('0xa')]('GetContactDialer',_0x940cfb);if(_0x3d1ebb[_0x3d19('0x32')]>0x0){logger[_0x3d19('0xa')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3d1ebb[0x0]['dataValues']['id'],_0x3d1ebb[0x0][_0x3d19('0x34')][_0x3d19('0x35')],_0x3d1ebb[0x0][_0x3d19('0x34')]['active']);}logger[_0x3d19('0x1c')]('GetContactDialer',_0x940cfb,JSON['stringify'](_0x3d1ebb));_0xf1ab74(_0x3d1ebb);})[_0x3d19('0x12')](function(_0x33c8b2){logger[_0x3d19('0xf')](_0x3d19('0x2a'),_0x33c8b2[_0x3d19('0x11')],_0x940cfb);_0x1b951e(_0x1b1076[_0x3d19('0xf')](0x1f4,_0x33c8b2[_0x3d19('0x11')]));});});});};exports[_0x3d19('0x36')]=function(_0x2d808c){var _0x13bf3e=this;return new Promise(function(_0x22080b,_0x5f3316){return db[_0x3d19('0x2c')][_0x3d19('0x2d')](function(_0xa7dfbb){return db[_0x3d19('0x37')][_0x3d19('0x22')](_0x2d808c[_0x3d19('0x23')],{'raw':_0x2d808c[_0x3d19('0x15')]?_0x2d808c['options'][_0x3d19('0x16')]===undefined?!![]:![]:!![],'transaction':_0xa7dfbb})[_0x3d19('0x9')](function(){logger[_0x3d19('0xa')](_0x3d19('0x38'),JSON[_0x3d19('0xe')](_0x2d808c[_0x3d19('0x15')][_0x3d19('0x20')]),_0x2d808c['options'][_0x3d19('0x20')][_0x3d19('0x27')]);return db['CmHopper'][_0x3d19('0x28')]({'where':_0x2d808c[_0x3d19('0x15')]?_0x2d808c[_0x3d19('0x15')][_0x3d19('0x20')]||null:null,'transaction':_0xa7dfbb});});})[_0x3d19('0x9')](function(_0x3fc2ec){logger['info'](_0x3d19('0x36'),_0x2d808c);logger[_0x3d19('0x1c')](_0x3d19('0x36'),_0x2d808c,JSON[_0x3d19('0xe')](_0x3fc2ec));_0x22080b(_0x3fc2ec);})[_0x3d19('0x12')](function(_0x4371ed){logger[_0x3d19('0xf')](_0x3d19('0x36'),_0x4371ed['message'],_0x2d808c);_0x5f3316(_0x13bf3e['error'](0x1f4,_0x4371ed['message']));});});};exports[_0x3d19('0x39')]=function(_0x566820){var _0x33cb97=this;return new Promise(function(_0x216d46,_0x3f6416){return db[_0x3d19('0x1e')]['findAll']({'raw':_0x566820['options']?_0x566820[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![],'where':_0x566820[_0x3d19('0x15')]?_0x566820[_0x3d19('0x15')][_0x3d19('0x20')]||null:null,'attributes':[[db[_0x3d19('0x2c')]['fn'](_0x3d19('0x3a'),db[_0x3d19('0x2c')]['fn']('IF',db[_0x3d19('0x2c')][_0x3d19('0x3b')](_0x3d19('0x3c')+util['format'](_0x3d19('0x3d'),moment()[_0x3d19('0x3e')](_0x3d19('0x3f')))+_0x3d19('0x40')))),_0x3d19('0x41')]]})[_0x3d19('0x9')](function(_0x294131){logger[_0x3d19('0xa')](_0x3d19('0x39'),_0x566820);logger['debug'](_0x3d19('0x39'),_0x566820,JSON['stringify'](_0x294131));_0x216d46(_0x294131);})[_0x3d19('0x12')](function(_0x46803e){logger[_0x3d19('0xf')](_0x3d19('0x39'),_0x46803e[_0x3d19('0x11')],_0x566820);_0x3f6416(_0x33cb97[_0x3d19('0xf')](0x1f4,_0x46803e[_0x3d19('0x11')]));});});};exports[_0x3d19('0x42')]=function(_0x30be50){var _0x51666c=this;return new Promise(function(_0x1e7baa,_0x1080db){return db[_0x3d19('0x2b')][_0x3d19('0x43')]()['then'](function(_0x391958){return db['sequelize']['transaction'](function(_0x333b3d){return db[_0x3d19('0x1e')][_0x3d19('0x14')]({'where':_0x30be50[_0x3d19('0x15')]?_0x30be50[_0x3d19('0x15')]['where']||null:null,'attributes':_0x30be50[_0x3d19('0x15')]?_0x30be50['options'][_0x3d19('0x17')]||null:null,'limit':0x1,'order':_0x30be50['options']?_0x30be50[_0x3d19('0x15')]['order']||null:null,'group':db['CmHopper'][_0x3d19('0x44')],'transaction':_0x333b3d,'lock':_0x333b3d[_0x3d19('0x45')][_0x3d19('0x2f')],'include':_0x30be50['options']?_0x30be50[_0x3d19('0x15')][_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x30be50['options'][_0x3d19('0x19')],function(_0x2fc5c3){return{'model':db[_0x2fc5c3[_0x3d19('0x1b')]],'as':_0x2fc5c3['as'],'attributes':_0x2fc5c3[_0x3d19('0x17')],'include':_0x2fc5c3[_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x2fc5c3[_0x3d19('0x19')],function(_0x4ba365){return{'model':db[_0x4ba365[_0x3d19('0x1b')]],'as':_0x4ba365['as'],'attributes':_0x4ba365['attributes'],'include':_0x4ba365[_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x4ba365['include'],function(_0x153d97){return{'model':db[_0x153d97[_0x3d19('0x1b')]],'as':_0x153d97['as'],'attributes':_0x153d97[_0x3d19('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3d19('0x9')](function(_0x130d20){var _0x3ed26b=[];for(var _0x2d3533=0x0;_0x2d3533<_0x130d20[_0x3d19('0x32')];_0x2d3533+=0x1){_0x3ed26b[_0x3d19('0x33')](_0x130d20[_0x2d3533]['update'](_0x30be50['body'],{'transaction':_0x333b3d}));}return BPromise[_0x3d19('0x46')](_0x3ed26b);});})[_0x3d19('0x9')](function(_0x3458c9){logger[_0x3d19('0xa')](_0x3d19('0x42'),_0x30be50);logger[_0x3d19('0x1c')](_0x3d19('0x42'),_0x30be50,JSON[_0x3d19('0xe')](_0x3458c9));_0x1e7baa(_0x3458c9);})[_0x3d19('0x12')](function(_0xaaeea6){logger[_0x3d19('0xf')](_0x3d19('0x42'),_0xaaeea6[_0x3d19('0x11')],_0x30be50);_0x1080db(_0x51666c[_0x3d19('0xf')](0x1f4,_0xaaeea6[_0x3d19('0x11')]));});});});};exports[_0x3d19('0x47')]=function(_0x38809f){var _0x4b9a39=this;return new Promise(function(_0x3ae4cb,_0x5ad185){db[_0x3d19('0x2b')]['describe']()[_0x3d19('0x9')](function(_0x5441be){return db['CmHopper'][_0x3d19('0x14')]({'raw':_0x38809f['options']?_0x38809f[_0x3d19('0x15')][_0x3d19('0x16')]===undefined?!![]:![]:!![],'where':_0x38809f['options']?_0x38809f[_0x3d19('0x15')][_0x3d19('0x20')]||null:null,'attributes':_0x38809f['options']?_0x38809f[_0x3d19('0x15')][_0x3d19('0x17')]||null:null,'limit':_0x38809f['options']?_0x38809f[_0x3d19('0x15')]['limit']||null:null,'include':_0x38809f[_0x3d19('0x15')]?_0x38809f[_0x3d19('0x15')][_0x3d19('0x19')]?_['map'](_0x38809f[_0x3d19('0x15')][_0x3d19('0x19')],function(_0x41d935){return{'model':db[_0x41d935['model']],'as':_0x41d935['as'],'attributes':_0x41d935['as']===_0x3d19('0x30')?_[_0x3d19('0x48')](_0x5441be):_0x41d935[_0x3d19('0x17')],'include':_0x41d935[_0x3d19('0x19')]?_[_0x3d19('0x1a')](_0x41d935[_0x3d19('0x19')],function(_0x2f512c){return{'model':db[_0x2f512c[_0x3d19('0x1b')]],'as':_0x2f512c['as'],'attributes':_0x2f512c[_0x3d19('0x17')],'include':_0x2f512c[_0x3d19('0x19')]?_['map'](_0x2f512c['include'],function(_0x141319){return{'model':db[_0x141319[_0x3d19('0x1b')]],'as':_0x141319['as'],'attributes':_0x141319[_0x3d19('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3d19('0x9')](function(_0x57deb3){logger[_0x3d19('0xa')]('GetCmHopper',_0x38809f);logger['debug']('GetCmHopper',_0x38809f,JSON[_0x3d19('0xe')](_0x57deb3));_0x3ae4cb(_0x57deb3);})[_0x3d19('0x12')](function(_0x31b514){logger[_0x3d19('0xf')](_0x3d19('0x13'),_0x31b514[_0x3d19('0x11')],_0x38809f);_0x5ad185(_0x4b9a39[_0x3d19('0xf')](0x1f4,_0x31b514[_0x3d19('0x11')]));});});});};exports[_0x3d19('0x49')]=function(_0x4af9cd){var _0x158eb0=this;return new Promise(function(_0x11a44d,_0xade7fb){return db[_0x3d19('0x2b')][_0x3d19('0x4a')]({'raw':!![],'where':{'phone':_0x4af9cd[_0x3d19('0x15')][_0x3d19('0x20')][_0x3d19('0x4b')]},'attributes':['id',_0x3d19('0x4c')],'order':[['id',_0x3d19('0x4d')]]})[_0x3d19('0x9')](function(_0x304505){logger[_0x3d19('0xa')](_0x3d19('0x4e'),_0x4af9cd);logger[_0x3d19('0x1c')]('getContactByPhone',_0x4af9cd,JSON[_0x3d19('0xe')](_0x304505));_0x11a44d(_0x304505);})[_0x3d19('0x12')](function(_0x56345c){logger[_0x3d19('0xf')](_0x3d19('0x4e'),_0x56345c[_0x3d19('0x11')],_0x4af9cd);_0xade7fb(_0x158eb0[_0x3d19('0xf')](0x1f4,_0x56345c['message']));});});};exports[_0x3d19('0x4f')]=function(_0x4f5295){var _0x25a11b=this;return new Promise(function(_0x51ff1a,_0x3f3418){return db[_0x3d19('0x2c')][_0x3d19('0x2d')](function(_0x4ea6d4){return db[_0x3d19('0x1e')][_0x3d19('0x25')]({'active':![]},{'where':{},'transaction':_0x4ea6d4})[_0x3d19('0x9')](function(_0x27c03c){logger[_0x3d19('0xa')](_0x3d19('0x4f'),_0x4f5295);logger['debug'](_0x3d19('0x4f'),_0x4f5295,JSON[_0x3d19('0xe')](_0x27c03c));_0x51ff1a(_0x27c03c);})[_0x3d19('0x12')](function(_0x23eb43){logger[_0x3d19('0xf')](_0x3d19('0x4f'),_0x23eb43[_0x3d19('0x11')],_0x4f5295);_0x3f3418(_0x25a11b[_0x3d19('0xf')](0x1f4,_0x23eb43['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x39b434){var _0x4a07f8=this;var _0x27ab98=_0x39b434[_0x3d19('0x23')][_0x3d19('0x20')][_0x3d19('0x50')];var _0x2aba91=_0x39b434['body']['where']['interval'];var _0x13a77e=_0x39b434['body']['where'][_0x3d19('0x51')];return new Promise(function(_0x1566c0,_0x33c987){return db[_0x3d19('0x1e')][_0x3d19('0x14')]({'where':{'voiceQueueId':{'$in':_0x27ab98},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x3d19('0x3b')]('NOW()\x20+\x20INTERVAL\x20'+_0x2aba91+_0x3d19('0x52')),'$gt':db['sequelize'][_0x3d19('0x3b')](_0x3d19('0x53'))}},'UserId':{'$in':_0x13a77e}},'include':[{'model':db[_0x3d19('0x2b')],'as':_0x3d19('0x30')},{'model':db[_0x3d19('0x31')],'as':_0x3d19('0x54'),'attributes':['id',_0x3d19('0x55'),_0x3d19('0x56')]},{'model':db[_0x3d19('0x57')],'as':_0x3d19('0x58')}]})['then'](function(_0x4b3e08){if(_0x4b3e08['length']>0x0){return db[_0x3d19('0x2c')][_0x3d19('0x2d')](function(_0x51f132){return db[_0x3d19('0x1e')]['update']({'recallmeNotifiedDate':db[_0x3d19('0x2c')]['literal'](_0x3d19('0x53'))},{'where':{'id':{'$in':_['map'](_0x4b3e08,'id')}},'transaction':_0x51f132})[_0x3d19('0x9')](function(){_0x1566c0(_0x4b3e08);})[_0x3d19('0x12')](function(_0xebab6f){logger[_0x3d19('0xf')](_0x3d19('0x59'),_0xebab6f[_0x3d19('0x11')],_0x39b434);_0x33c987(_0x4a07f8[_0x3d19('0xf')](0x1f4,_0xebab6f['message']));});})[_0x3d19('0x12')](function(_0x436b44){logger[_0x3d19('0xf')](_0x3d19('0x59'),_0x436b44[_0x3d19('0x11')],_0x39b434);_0x33c987(_0x4a07f8[_0x3d19('0xf')](0x1f4,_0x436b44[_0x3d19('0x11')]));});}else{_0x1566c0(_0x4b3e08);}});});}; \ No newline at end of file +var _0xc664=['raw','CreateCmHopper','create','body','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','UPDATE','CmContact','Contact','keys','User','Agent','name','length','UserId','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','CmList','List','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','where','include','map','model','attributes','ShowCmHopper','find'];(function(_0x454bf8,_0x5d6499){var _0xa03dc9=function(_0x3d25e4){while(--_0x3d25e4){_0x454bf8['push'](_0x454bf8['shift']());}};_0xa03dc9(++_0x5d6499);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var moment=require('moment');var BPromise=require(_0x4c66('0x2'));var db=require(_0x4c66('0x3'))['db'];var logger=require(_0x4c66('0x4'))(_0x4c66('0x5'));var jayson=require(_0x4c66('0x6'));var client=jayson['client'][_0x4c66('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25031f,_0x1285c7,_0x28a065){return new BPromise(function(_0x4ecac0,_0x14ceba){return client[_0x4c66('0x8')](_0x25031f,_0x28a065)[_0x4c66('0x9')](function(_0x47fb8e){logger['info'](_0x4c66('0xa'),_0x1285c7,_0x4c66('0xb'));logger[_0x4c66('0xc')](_0x4c66('0xd'),_0x1285c7,'request\x20sent',JSON[_0x4c66('0xe')](_0x47fb8e));if(_0x47fb8e[_0x4c66('0xf')]){if(_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x10')]===0x1f4){logger[_0x4c66('0xf')](_0x4c66('0xa'),_0x1285c7,_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x11')]);return _0x14ceba(_0x47fb8e[_0x4c66('0xf')]['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x1285c7,_0x47fb8e['error'][_0x4c66('0x11')]);return _0x4ecac0(_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x11')]);}else{logger[_0x4c66('0x12')](_0x4c66('0xa'),_0x1285c7,_0x4c66('0xb'));_0x4ecac0(_0x47fb8e[_0x4c66('0x13')][_0x4c66('0x11')]);}})[_0x4c66('0x14')](function(_0x23d1b6){logger[_0x4c66('0xf')](_0x4c66('0xa'),_0x1285c7,_0x23d1b6);_0x14ceba(_0x23d1b6);});});}exports[_0x4c66('0x15')]=function(_0x144982){var _0x2ae76f=this;return new Promise(function(_0x541c11,_0x31625d){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'raw':_0x144982['options']?_0x144982['options']['raw']===undefined?!![]:![]:!![],'where':_0x144982['options']?_0x144982[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x144982['options']?_0x144982[_0x4c66('0x18')]['attributes']||null:null,'limit':_0x144982[_0x4c66('0x18')]?_0x144982['options']['limit']||null:null,'include':_0x144982['options']?_0x144982[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x144982[_0x4c66('0x18')][_0x4c66('0x1a')],function(_0x4684b3){return{'model':db[_0x4684b3[_0x4c66('0x1c')]],'as':_0x4684b3['as'],'attributes':_0x4684b3[_0x4c66('0x1d')],'include':_0x4684b3[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x4684b3[_0x4c66('0x1a')],function(_0x2589b6){return{'model':db[_0x2589b6['model']],'as':_0x2589b6['as'],'attributes':_0x2589b6[_0x4c66('0x1d')],'include':_0x2589b6[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x2589b6['include'],function(_0x49885b){return{'model':db[_0x49885b['model']],'as':_0x49885b['as'],'attributes':_0x49885b[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x5258c){logger['info'](_0x4c66('0x15'),_0x144982);logger[_0x4c66('0xc')]('GetCmHopper',_0x144982,JSON[_0x4c66('0xe')](_0x5258c));_0x541c11(_0x5258c);})[_0x4c66('0x14')](function(_0x14c1d3){logger[_0x4c66('0xf')](_0x4c66('0x15'),_0x14c1d3[_0x4c66('0x11')],_0x144982);_0x31625d(_0x2ae76f[_0x4c66('0xf')](0x1f4,_0x14c1d3[_0x4c66('0x11')]));});});};exports[_0x4c66('0x1e')]=function(_0x526c5c){var _0xbb11ab=this;return new Promise(function(_0x75656c,_0x404c10){return db['CmHopper'][_0x4c66('0x1f')]({'raw':_0x526c5c[_0x4c66('0x18')]?_0x526c5c[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'where':_0x526c5c[_0x4c66('0x18')]?_0x526c5c['options']['where']||null:null,'attributes':_0x526c5c[_0x4c66('0x18')]?_0x526c5c[_0x4c66('0x18')][_0x4c66('0x1d')]||null:null,'include':_0x526c5c['options']?_0x526c5c[_0x4c66('0x18')]['include']?_[_0x4c66('0x1b')](_0x526c5c['options'][_0x4c66('0x1a')],function(_0x246024){return{'model':db[_0x246024[_0x4c66('0x1c')]],'as':_0x246024['as'],'attributes':_0x246024[_0x4c66('0x1d')],'include':_0x246024[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x246024[_0x4c66('0x1a')],function(_0x4c86cd){return{'model':db[_0x4c86cd[_0x4c66('0x1c')]],'as':_0x4c86cd['as'],'attributes':_0x4c86cd[_0x4c66('0x1d')],'include':_0x4c86cd[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x4c86cd['include'],function(_0x5499bd){return{'model':db[_0x5499bd[_0x4c66('0x1c')]],'as':_0x5499bd['as'],'attributes':_0x5499bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x73edae){logger[_0x4c66('0x12')](_0x4c66('0x1e'),_0x526c5c);logger['debug'](_0x4c66('0x1e'),_0x526c5c,JSON[_0x4c66('0xe')](_0x73edae));_0x75656c(_0x73edae);})[_0x4c66('0x14')](function(_0x3b900f){logger[_0x4c66('0xf')](_0x4c66('0x1e'),_0x3b900f['message'],_0x526c5c);_0x404c10(_0xbb11ab['error'](0x1f4,_0x3b900f['message']));});});};exports[_0x4c66('0x21')]=function(_0x5d3aba){var _0x33d566=this;return new Promise(function(_0x5d2f5d,_0xe4a1e7){return db['CmHopper'][_0x4c66('0x22')](_0x5d3aba[_0x4c66('0x23')],{'raw':_0x5d3aba[_0x4c66('0x18')]?_0x5d3aba['options'][_0x4c66('0x20')]===undefined?!![]:![]:!![]})[_0x4c66('0x9')](function(_0x4842ef){logger[_0x4c66('0x12')](_0x4c66('0x21'),_0x5d3aba);logger[_0x4c66('0xc')]('CreateCmHopper',_0x5d3aba,JSON[_0x4c66('0xe')](_0x4842ef));_0x5d2f5d(_0x4842ef);})[_0x4c66('0x14')](function(_0x4da7b3){logger[_0x4c66('0xf')]('CreateCmHopper',_0x4da7b3[_0x4c66('0x11')],_0x5d3aba);_0xe4a1e7(_0x33d566[_0x4c66('0xf')](0x1f4,_0x4da7b3[_0x4c66('0x11')]));});});};exports['UpdateCmHopper']=function(_0xc7a687){var _0x426ed0=this;return new Promise(function(_0x5233e2,_0x5bf5a3){return db[_0x4c66('0x16')][_0x4c66('0x24')](_0xc7a687[_0x4c66('0x23')],{'raw':_0xc7a687[_0x4c66('0x18')]?_0xc7a687['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7a687[_0x4c66('0x18')]?_0xc7a687['options']['where']||null:null,'attributes':_0xc7a687['options']?_0xc7a687[_0x4c66('0x18')][_0x4c66('0x1d')]||null:null,'limit':_0xc7a687[_0x4c66('0x18')]?_0xc7a687[_0x4c66('0x18')][_0x4c66('0x25')]||null:null})[_0x4c66('0x9')](function(_0x37836c){logger[_0x4c66('0x12')](_0x4c66('0x26'),_0xc7a687);logger[_0x4c66('0x12')](_0x4c66('0x27'),JSON['stringify'](_0xc7a687[_0x4c66('0x18')][_0x4c66('0x19')]),_0xc7a687[_0x4c66('0x23')]['active']);logger['debug'](_0x4c66('0x26'),_0xc7a687,JSON[_0x4c66('0xe')](_0x37836c));_0x5233e2(_0x37836c);})['catch'](function(_0x569f12){logger[_0x4c66('0xf')](_0x4c66('0x26'),_0x569f12['message'],_0xc7a687);_0x5bf5a3(_0x426ed0[_0x4c66('0xf')](0x1f4,_0x569f12['message']));});});};exports[_0x4c66('0x28')]=function(_0x1c223b){var _0x3d5bee=this;return new Promise(function(_0x1f072a,_0x461f20){return db[_0x4c66('0x16')][_0x4c66('0x29')]({'where':_0x1c223b[_0x4c66('0x18')]?_0x1c223b[_0x4c66('0x18')][_0x4c66('0x19')]||null:null})[_0x4c66('0x9')](function(_0x388499){logger[_0x4c66('0x12')]('DestroyCmHopper',_0x1c223b);logger[_0x4c66('0xc')]('DestroyCmHopper',_0x1c223b,JSON[_0x4c66('0xe')](_0x388499));_0x1f072a(_0x388499);})[_0x4c66('0x14')](function(_0x2444f){logger[_0x4c66('0xf')](_0x4c66('0x28'),_0x2444f['message'],_0x1c223b);_0x461f20(_0x3d5bee['error'](0x1f4,_0x2444f[_0x4c66('0x11')]));});});};exports[_0x4c66('0x2a')]=function(_0x3c0356){var _0x1c45e3=this;return new Promise(function(_0x34b6a2,_0x2089f8){return db['CmContact'][_0x4c66('0x2b')]()[_0x4c66('0x9')](function(_0x4e4dbf){return db[_0x4c66('0x2c')][_0x4c66('0x2d')](function(_0x1a888f){return db[_0x4c66('0x16')]['findAll']({'where':_0x3c0356[_0x4c66('0x18')]?_0x3c0356[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x3c0356[_0x4c66('0x18')]?_0x3c0356['options'][_0x4c66('0x1d')]||null:null,'limit':_0x3c0356[_0x4c66('0x18')]?_0x3c0356[_0x4c66('0x18')][_0x4c66('0x25')]||null:null,'order':_0x3c0356[_0x4c66('0x18')]?_0x3c0356['options']['order']||null:null,'transaction':_0x1a888f,'lock':_0x1a888f['LOCK'][_0x4c66('0x2e')],'include':[{'model':db[_0x4c66('0x2f')],'as':_0x4c66('0x30'),'attributes':_[_0x4c66('0x31')](_0x4e4dbf)},{'model':db[_0x4c66('0x32')],'as':_0x4c66('0x33'),'attributes':['id',_0x4c66('0x34'),'voicePause']}]})['then'](function(_0x4f269b){var _0x255102=[];var _0x26f38a=[];for(var _0x334d49=0x0;_0x334d49<_0x4f269b[_0x4c66('0x35')];_0x334d49+=0x1){var _0x4ae735=_0x4f269b[_0x334d49][_0x4c66('0x36')];if(_0x4ae735===null){_0x255102[_0x4c66('0x37')](_0x4f269b[_0x334d49]['update'](_0x3c0356[_0x4c66('0x23')],{'transaction':_0x1a888f}));}else if(!_0x26f38a[_0x4c66('0x38')](_0x4ae735)){_0x26f38a[_0x4c66('0x37')](_0x4ae735);_0x255102['push'](_0x4f269b[_0x334d49]['update'](_0x3c0356[_0x4c66('0x23')],{'transaction':_0x1a888f}));}}return BPromise[_0x4c66('0x39')](_0x255102);});})[_0x4c66('0x9')](function(_0x42d65e){logger[_0x4c66('0x12')](_0x4c66('0x2a'),_0x3c0356);if(_0x42d65e[_0x4c66('0x35')]>0x0){logger[_0x4c66('0x12')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x42d65e[0x0][_0x4c66('0x3a')]['id'],_0x42d65e[0x0]['dataValues'][_0x4c66('0x3b')],_0x42d65e[0x0]['dataValues'][_0x4c66('0x3c')]);}logger[_0x4c66('0xc')](_0x4c66('0x2a'),_0x3c0356,JSON[_0x4c66('0xe')](_0x42d65e));_0x34b6a2(_0x42d65e);})[_0x4c66('0x14')](function(_0x116ad5){logger[_0x4c66('0xf')](_0x4c66('0x2a'),_0x116ad5[_0x4c66('0x11')],_0x3c0356);_0x2089f8(_0x1c45e3['error'](0x1f4,_0x116ad5['message']));});});});};exports[_0x4c66('0x3d')]=function(_0x1b21a1){var _0x222e1f=this;return new Promise(function(_0xc3bf3c,_0xb7e4be){return db[_0x4c66('0x2c')]['transaction'](function(_0x2e9279){return db[_0x4c66('0x3e')][_0x4c66('0x22')](_0x1b21a1[_0x4c66('0x23')],{'raw':_0x1b21a1[_0x4c66('0x18')]?_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'transaction':_0x2e9279})[_0x4c66('0x9')](function(){logger[_0x4c66('0x12')](_0x4c66('0x3f'),JSON[_0x4c66('0xe')](_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')]),_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')][_0x4c66('0x3c')]);return db[_0x4c66('0x16')][_0x4c66('0x29')]({'where':_0x1b21a1[_0x4c66('0x18')]?_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'transaction':_0x2e9279});});})[_0x4c66('0x9')](function(_0x254067){logger[_0x4c66('0x12')]('MoveContactManagedDialer',_0x1b21a1);logger[_0x4c66('0xc')](_0x4c66('0x3d'),_0x1b21a1,JSON[_0x4c66('0xe')](_0x254067));_0xc3bf3c(_0x254067);})[_0x4c66('0x14')](function(_0xd49317){logger[_0x4c66('0xf')](_0x4c66('0x3d'),_0xd49317[_0x4c66('0x11')],_0x1b21a1);_0xb7e4be(_0x222e1f[_0x4c66('0xf')](0x1f4,_0xd49317[_0x4c66('0x11')]));});});};exports['CountReScheduled']=function(_0x40bc07){var _0x5371d8=this;return new Promise(function(_0x3fa41e,_0x73b27b){return db['CmHopper'][_0x4c66('0x17')]({'raw':_0x40bc07['options']?_0x40bc07[_0x4c66('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40bc07[_0x4c66('0x18')]?_0x40bc07[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':[[db[_0x4c66('0x2c')]['fn'](_0x4c66('0x40'),db[_0x4c66('0x2c')]['fn']('IF',db[_0x4c66('0x2c')][_0x4c66('0x41')]('`scheduledat`\x20>=\x20'+util[_0x4c66('0x42')](_0x4c66('0x43'),moment()[_0x4c66('0x42')](_0x4c66('0x44')))+_0x4c66('0x45')))),'contactsRescheduled']]})[_0x4c66('0x9')](function(_0x3930a5){logger['info'](_0x4c66('0x46'),_0x40bc07);logger[_0x4c66('0xc')]('CountReScheduled',_0x40bc07,JSON[_0x4c66('0xe')](_0x3930a5));_0x3fa41e(_0x3930a5);})[_0x4c66('0x14')](function(_0x5b0847){logger['error'](_0x4c66('0x46'),_0x5b0847[_0x4c66('0x11')],_0x40bc07);_0x73b27b(_0x5371d8[_0x4c66('0xf')](0x1f4,_0x5b0847[_0x4c66('0x11')]));});});};exports[_0x4c66('0x47')]=function(_0x259bdb){var _0x1f39a9=this;return new Promise(function(_0x7504a1,_0x44e1fa){return db[_0x4c66('0x2f')][_0x4c66('0x2b')]()['then'](function(_0x5931ad){return db['sequelize'][_0x4c66('0x2d')](function(_0x151f29){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'where':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')]['where']||null:null,'attributes':_0x259bdb['options']?_0x259bdb[_0x4c66('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')][_0x4c66('0x48')]||null:null,'group':db[_0x4c66('0x16')][_0x4c66('0x36')],'transaction':_0x151f29,'lock':_0x151f29[_0x4c66('0x49')][_0x4c66('0x2e')],'include':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x259bdb[_0x4c66('0x18')][_0x4c66('0x1a')],function(_0x3492b9){return{'model':db[_0x3492b9['model']],'as':_0x3492b9['as'],'attributes':_0x3492b9[_0x4c66('0x1d')],'include':_0x3492b9[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x3492b9[_0x4c66('0x1a')],function(_0x1d1899){return{'model':db[_0x1d1899[_0x4c66('0x1c')]],'as':_0x1d1899['as'],'attributes':_0x1d1899[_0x4c66('0x1d')],'include':_0x1d1899['include']?_[_0x4c66('0x1b')](_0x1d1899[_0x4c66('0x1a')],function(_0x4a77dc){return{'model':db[_0x4a77dc[_0x4c66('0x1c')]],'as':_0x4a77dc['as'],'attributes':_0x4a77dc[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x2a7d8c){var _0x29337d=[];for(var _0x18da89=0x0;_0x18da89<_0x2a7d8c[_0x4c66('0x35')];_0x18da89+=0x1){_0x29337d['push'](_0x2a7d8c[_0x18da89][_0x4c66('0x24')](_0x259bdb[_0x4c66('0x23')],{'transaction':_0x151f29}));}return BPromise[_0x4c66('0x39')](_0x29337d);});})[_0x4c66('0x9')](function(_0x1bd22f){logger[_0x4c66('0x12')](_0x4c66('0x47'),_0x259bdb);logger[_0x4c66('0xc')](_0x4c66('0x47'),_0x259bdb,JSON[_0x4c66('0xe')](_0x1bd22f));_0x7504a1(_0x1bd22f);})[_0x4c66('0x14')](function(_0x1ab8a2){logger[_0x4c66('0xf')](_0x4c66('0x47'),_0x1ab8a2[_0x4c66('0x11')],_0x259bdb);_0x44e1fa(_0x1f39a9[_0x4c66('0xf')](0x1f4,_0x1ab8a2[_0x4c66('0x11')]));});});});};exports[_0x4c66('0x4a')]=function(_0x257b21){var _0x30e9fd=this;return new Promise(function(_0x1ce3aa,_0x5754f9){db[_0x4c66('0x2f')]['describe']()[_0x4c66('0x9')](function(_0xd9844e){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'raw':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'where':_0x257b21[_0x4c66('0x18')]?_0x257b21[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x257b21['options']?_0x257b21[_0x4c66('0x18')]['attributes']||null:null,'limit':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x25')]||null:null,'include':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x257b21[_0x4c66('0x18')]['include'],function(_0x159e39){return{'model':db[_0x159e39[_0x4c66('0x1c')]],'as':_0x159e39['as'],'attributes':_0x159e39['as']==='Contact'?_[_0x4c66('0x31')](_0xd9844e):_0x159e39[_0x4c66('0x1d')],'include':_0x159e39[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x159e39['include'],function(_0x287848){return{'model':db[_0x287848['model']],'as':_0x287848['as'],'attributes':_0x287848[_0x4c66('0x1d')],'include':_0x287848['include']?_[_0x4c66('0x1b')](_0x287848[_0x4c66('0x1a')],function(_0x4a6262){return{'model':db[_0x4a6262['model']],'as':_0x4a6262['as'],'attributes':_0x4a6262[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x5bdd09){logger[_0x4c66('0x12')](_0x4c66('0x15'),_0x257b21);logger[_0x4c66('0xc')](_0x4c66('0x15'),_0x257b21,JSON[_0x4c66('0xe')](_0x5bdd09));_0x1ce3aa(_0x5bdd09);})[_0x4c66('0x14')](function(_0x359543){logger[_0x4c66('0xf')](_0x4c66('0x15'),_0x359543[_0x4c66('0x11')],_0x257b21);_0x5754f9(_0x30e9fd['error'](0x1f4,_0x359543[_0x4c66('0x11')]));});});});};exports['GetContactByPhone']=function(_0x2e9b69){var _0x17058c=this;return new Promise(function(_0x4dc474,_0x402cd1){return db[_0x4c66('0x2f')][_0x4c66('0x4b')]({'raw':!![],'where':{'phone':_0x2e9b69[_0x4c66('0x18')][_0x4c66('0x19')][_0x4c66('0x4c')]},'attributes':['id',_0x4c66('0x4d')],'order':[['id',_0x4c66('0x4e')]]})['then'](function(_0x59eb6e){logger['info'](_0x4c66('0x4f'),_0x2e9b69);logger[_0x4c66('0xc')](_0x4c66('0x4f'),_0x2e9b69,JSON[_0x4c66('0xe')](_0x59eb6e));_0x4dc474(_0x59eb6e);})['catch'](function(_0x486f83){logger['error'](_0x4c66('0x4f'),_0x486f83[_0x4c66('0x11')],_0x2e9b69);_0x402cd1(_0x17058c['error'](0x1f4,_0x486f83[_0x4c66('0x11')]));});});};exports[_0x4c66('0x50')]=function(_0x3d5a18){var _0x2fdb45=this;return new Promise(function(_0x572527,_0x24ea2f){return db['sequelize'][_0x4c66('0x2d')](function(_0x341026){return db['CmHopper'][_0x4c66('0x24')]({'active':![]},{'where':{},'transaction':_0x341026})[_0x4c66('0x9')](function(_0x16a462){logger[_0x4c66('0x12')](_0x4c66('0x50'),_0x3d5a18);logger[_0x4c66('0xc')](_0x4c66('0x50'),_0x3d5a18,JSON[_0x4c66('0xe')](_0x16a462));_0x572527(_0x16a462);})['catch'](function(_0x1001eb){logger['error'](_0x4c66('0x50'),_0x1001eb[_0x4c66('0x11')],_0x3d5a18);_0x24ea2f(_0x2fdb45[_0x4c66('0xf')](0x1f4,_0x1001eb[_0x4c66('0x11')]));});});});};exports[_0x4c66('0x51')]=function(_0x14e653){var _0x21df57=this;var _0x3f5016=_0x14e653[_0x4c66('0x23')][_0x4c66('0x19')]['voiceQueueIds'];var _0x30d34a=_0x14e653[_0x4c66('0x23')]['where']['interval'];var _0x5dd259=_0x14e653[_0x4c66('0x23')][_0x4c66('0x19')]['availableAgentsIds'];return new Promise(function(_0x2aed3a,_0x48bed3){return db['CmHopper'][_0x4c66('0x17')]({'where':{'voiceQueueId':{'$in':_0x3f5016},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4c66('0x2c')][_0x4c66('0x41')](_0x4c66('0x52')+_0x30d34a+_0x4c66('0x53')),'$gt':db[_0x4c66('0x2c')]['literal'](_0x4c66('0x54'))}},'UserId':{'$in':_0x5dd259}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x4c66('0x32')],'as':_0x4c66('0x33'),'attributes':['id','name',_0x4c66('0x55')]},{'model':db[_0x4c66('0x56')],'as':_0x4c66('0x57')}]})[_0x4c66('0x9')](function(_0x4ab469){if(_0x4ab469[_0x4c66('0x35')]>0x0){return db[_0x4c66('0x2c')][_0x4c66('0x2d')](function(_0x131f57){return db[_0x4c66('0x16')][_0x4c66('0x24')]({'recallmeNotifiedDate':db[_0x4c66('0x2c')][_0x4c66('0x41')](_0x4c66('0x54'))},{'where':{'id':{'$in':_[_0x4c66('0x1b')](_0x4ab469,'id')}},'transaction':_0x131f57})[_0x4c66('0x9')](function(){_0x2aed3a(_0x4ab469);})[_0x4c66('0x14')](function(_0x13b446){logger[_0x4c66('0xf')](_0x4c66('0x51'),_0x13b446['message'],_0x14e653);_0x48bed3(_0x21df57[_0x4c66('0xf')](0x1f4,_0x13b446['message']));});})[_0x4c66('0x14')](function(_0x70001e){logger[_0x4c66('0xf')](_0x4c66('0x51'),_0x70001e[_0x4c66('0x11')],_0x14e653);_0x48bed3(_0x21df57[_0x4c66('0xf')](0x1f4,_0x70001e[_0x4c66('0x11')]));});}else{_0x2aed3a(_0x4ab469);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3cae41a..6df1a36 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 _0xb282=['update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','describe','/opencontacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','/preview','getPreview','getTimezone'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0xb282,0x138));var _0x2b28=function(_0x581b6f,_0xb342ec){_0x581b6f=_0x581b6f-0x0;var _0x20aea0=_0xb282[_0x581b6f];return _0x20aea0;};'use strict';var express=require(_0x2b28('0x0'));var router=express[_0x2b28('0x1')]();var auth=require(_0x2b28('0x2'));var controller=require('./cmHopper.controller');router[_0x2b28('0x3')]('/',auth[_0x2b28('0x4')](),controller[_0x2b28('0x5')]);router['get']('/describe',auth[_0x2b28('0x4')](),controller[_0x2b28('0x6')]);router['get'](_0x2b28('0x7'),auth[_0x2b28('0x4')](),controller['getOpenContacts']);router['get'](_0x2b28('0x8'),auth[_0x2b28('0x4')](),controller[_0x2b28('0x9')]);router[_0x2b28('0x3')](_0x2b28('0xa'),auth['isAuthenticated'](),controller[_0x2b28('0xb')]);router[_0x2b28('0x3')]('/:id/previewrecall',auth[_0x2b28('0x4')](),controller[_0x2b28('0xc')]);router[_0x2b28('0xd')]('/',auth[_0x2b28('0x4')](),controller[_0x2b28('0xe')]);router[_0x2b28('0xd')](_0x2b28('0xf'),auth[_0x2b28('0x4')](),controller[_0x2b28('0x10')]);router[_0x2b28('0xd')]('/timezone',auth[_0x2b28('0x4')](),controller[_0x2b28('0x11')]);router['put'](_0x2b28('0xa'),auth['isAuthenticated'](),controller[_0x2b28('0x12')]);router[_0x2b28('0x13')](_0x2b28('0xa'),auth[_0x2b28('0x4')](),controller[_0x2b28('0x14')]);module[_0x2b28('0x15')]=router; \ No newline at end of file +var _0x9476=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getTimezone','put','update','exports','express','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x4fd540,_0x4de6c7){var _0x735bb2=function(_0x12e12d){while(--_0x12e12d){_0x4fd540['push'](_0x4fd540['shift']());}};_0x735bb2(++_0x4de6c7);}(_0x9476,0xfc));var _0x6947=function(_0x43f61a,_0x272658){_0x43f61a=_0x43f61a-0x0;var _0x4af42d=_0x9476[_0x43f61a];return _0x4af42d;};'use strict';var express=require(_0x6947('0x0'));var router=express['Router']();var auth=require(_0x6947('0x1'));var controller=require(_0x6947('0x2'));router[_0x6947('0x3')]('/',auth[_0x6947('0x4')](),controller[_0x6947('0x5')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6947('0x6')]);router[_0x6947('0x3')](_0x6947('0x7'),auth[_0x6947('0x4')](),controller[_0x6947('0x8')]);router[_0x6947('0x3')](_0x6947('0x9'),auth[_0x6947('0x4')](),controller[_0x6947('0xa')]);router['get'](_0x6947('0xb'),auth['isAuthenticated'](),controller[_0x6947('0xc')]);router[_0x6947('0x3')](_0x6947('0xd'),auth[_0x6947('0x4')](),controller[_0x6947('0xe')]);router[_0x6947('0xf')]('/',auth['isAuthenticated'](),controller[_0x6947('0x10')]);router[_0x6947('0xf')](_0x6947('0x11'),auth[_0x6947('0x4')](),controller['getPreview']);router[_0x6947('0xf')]('/timezone',auth[_0x6947('0x4')](),controller[_0x6947('0x12')]);router[_0x6947('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6947('0x14')]);router['delete']('/:id',auth[_0x6947('0x4')](),controller['destroy']);module[_0x6947('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 80c7e9b..5fe5e01 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb37=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','format'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xfb37,0xbd));var _0x7fb3=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0xfb37[_0x14915a];return _0x2f683c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x7fb3('0x0')]},'phone':{'type':Sequelize[_0x7fb3('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7fb3('0x2')](_0x7fb3('0x3'))},'countbusyretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7fb3('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa54d=['INTEGER','moment','sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xa54d,0x1bd));var _0xda54=function(_0x2feb43,_0x5be84b){_0x2feb43=_0x2feb43-0x0;var _0x27df57=_0xa54d[_0x2feb43];return _0x27df57;};'use strict';var moment=require(_0xda54('0x0'));var Sequelize=require(_0xda54('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xda54('0x2')],'defaultValue':moment()[_0xda54('0x3')](_0xda54('0x4'))},'countbusyretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 52d9f09..2b132ee 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2646=['sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','intersection','length','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','query','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x2646,0xce));var _0x6264=function(_0x4440f3,_0x3d1418){_0x4440f3=_0x4440f3-0x0;var _0x426de2=_0x2646[_0x4440f3];return _0x426de2;};'use strict';var emlformat=require(_0x6264('0x0'));var rimraf=require(_0x6264('0x1'));var zipdir=require(_0x6264('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6264('0x3'));var moment=require(_0x6264('0x4'));var BPromise=require(_0x6264('0x5'));var Mustache=require(_0x6264('0x6'));var util=require(_0x6264('0x7'));var path=require('path');var sox=require(_0x6264('0x8'));var csv=require('to-csv');var ejs=require(_0x6264('0x9'));var fs=require('fs');var fs_extra=require(_0x6264('0xa'));var _=require(_0x6264('0xb'));var squel=require(_0x6264('0xc'));var crypto=require(_0x6264('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6264('0xe'));var toCsv=require(_0x6264('0xf'));var querystring=require(_0x6264('0x10'));var Papa=require(_0x6264('0x11'));var Redis=require(_0x6264('0x12'));var authService=require(_0x6264('0x13'));var qs=require(_0x6264('0x14'));var as=require(_0x6264('0x15'));var hardwareService=require(_0x6264('0x16'));var logger=require(_0x6264('0x17'))('api');var utils=require(_0x6264('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6264('0x19'));var db=require(_0x6264('0x1a'))['db'];function respondWithStatusCode(_0x2f5478,_0xa1db44){_0xa1db44=_0xa1db44||0xcc;return function(_0x2240b8){if(_0x2240b8){return _0x2f5478[_0x6264('0x1b')](_0xa1db44);}return _0x2f5478['status'](_0xa1db44)[_0x6264('0x1c')]();};}function respondWithResult(_0x405e5b,_0x16a646){_0x16a646=_0x16a646||0xc8;return function(_0x121748){if(_0x121748){return _0x405e5b['status'](_0x16a646)['json'](_0x121748);}};}function respondWithFilteredResult(_0x12ff0c,_0x30835b){return function(_0x4b61e6){if(_0x4b61e6){var _0x1bea30=typeof _0x30835b[_0x6264('0x1d')]===_0x6264('0x1e')&&typeof _0x30835b['limit']===_0x6264('0x1e');var _0x2e3b01=_0x4b61e6[_0x6264('0x1f')];var _0x188aff=_0x1bea30?0x0:_0x30835b['offset'];var _0x145f9d=_0x1bea30?_0x4b61e6[_0x6264('0x1f')]:_0x30835b[_0x6264('0x1d')]+_0x30835b[_0x6264('0x20')];var _0x3f434e;if(_0x145f9d>=_0x2e3b01){_0x145f9d=_0x2e3b01;_0x3f434e=0xc8;}else{_0x3f434e=0xce;}_0x12ff0c[_0x6264('0x21')](_0x3f434e);return _0x12ff0c[_0x6264('0x22')](_0x6264('0x23'),_0x188aff+'-'+_0x145f9d+'/'+_0x2e3b01)[_0x6264('0x24')](_0x4b61e6);}return null;};}function patchUpdates(_0x46ef3){return function(_0x3bdbab){try{jsonpatch[_0x6264('0x25')](_0x3bdbab,_0x46ef3,!![]);}catch(_0x385e09){return BPromise[_0x6264('0x26')](_0x385e09);}return _0x3bdbab[_0x6264('0x27')]();};}function saveUpdates(_0x4ec62c,_0x50b9a1){return function(_0x1d6279){if(_0x1d6279){return _0x1d6279[_0x6264('0x28')](_0x4ec62c)[_0x6264('0x29')](function(_0x3ff4dd){return _0x3ff4dd;});}return null;};}function removeEntity(_0x499568,_0x1cd9d2){return function(_0x270860){if(_0x270860){return _0x270860[_0x6264('0x2a')]()['then'](function(){var _0x3d8fa0=_0x270860[_0x6264('0x2b')]({'plain':!![]});var _0x295b4a=_0x6264('0x2c');return db[_0x6264('0x2d')]['destroy']({'where':{'type':_0x295b4a,'resourceId':_0x3d8fa0['id']}})[_0x6264('0x29')](function(){return _0x270860;});})['then'](function(){_0x499568['status'](0xcc)[_0x6264('0x1c')]();});}};}function handleEntityNotFound(_0x5d77ac,_0x36e156){return function(_0x4b4276){if(!_0x4b4276){_0x5d77ac[_0x6264('0x1b')](0x194);}return _0x4b4276;};}function handleError(_0x41e639,_0xe1da9e){_0xe1da9e=_0xe1da9e||0x1f4;return function(_0x17b3db){logger[_0x6264('0x2e')](_0x17b3db['stack']);if(_0x17b3db[_0x6264('0x2f')]){delete _0x17b3db['name'];}_0x41e639[_0x6264('0x21')](_0xe1da9e)['send'](_0x17b3db);};}exports[_0x6264('0x30')]=function(_0x1ec678,_0x20b58e){var _0x4f11e2={},_0x497ade={},_0x3252b9={'count':0x0,'rows':[]};var _0x5a8fd1=_[_0x6264('0x31')](db[_0x6264('0x32')][_0x6264('0x33')],function(_0x4d3691){return{'name':_0x4d3691[_0x6264('0x34')],'type':_0x4d3691['type'][_0x6264('0x35')]};});_0x497ade[_0x6264('0x36')]=_['map'](_0x5a8fd1,_0x6264('0x2f'));_0x497ade[_0x6264('0x37')]=_['keys'](_0x1ec678[_0x6264('0x37')]);_0x497ade['filters']=_['intersection'](_0x497ade['model'],_0x497ade[_0x6264('0x37')]);_0x4f11e2['attributes']=_['intersection'](_0x497ade['model'],qs[_0x6264('0x38')](_0x1ec678['query'][_0x6264('0x38')]));_0x4f11e2[_0x6264('0x39')]=_0x4f11e2[_0x6264('0x39')]['length']?_0x4f11e2[_0x6264('0x39')]:_0x497ade[_0x6264('0x36')];if(!_0x1ec678[_0x6264('0x37')][_0x6264('0x3a')](_0x6264('0x3b'))){_0x4f11e2[_0x6264('0x20')]=qs['limit'](_0x1ec678[_0x6264('0x37')]['limit']);_0x4f11e2['offset']=qs[_0x6264('0x1d')](_0x1ec678[_0x6264('0x37')][_0x6264('0x1d')]);}_0x4f11e2[_0x6264('0x3c')]=qs[_0x6264('0x3d')](_0x1ec678['query'][_0x6264('0x3d')]);_0x4f11e2['where']=qs[_0x6264('0x3e')](_[_0x6264('0x3f')](_0x1ec678[_0x6264('0x37')],_0x497ade[_0x6264('0x3e')]),_0x5a8fd1);if(_0x1ec678['query'][_0x6264('0x40')]){_0x4f11e2[_0x6264('0x41')]=_['merge'](_0x4f11e2[_0x6264('0x41')],{'$or':_[_0x6264('0x31')](_0x5a8fd1,function(_0x4f4a57){if(_0x4f4a57[_0x6264('0x42')]!==_0x6264('0x43')){var _0x17e546={};_0x17e546[_0x4f4a57[_0x6264('0x2f')]]={'$like':'%'+_0x1ec678[_0x6264('0x37')][_0x6264('0x40')]+'%'};return _0x17e546;}})});}_0x4f11e2=_[_0x6264('0x44')]({},_0x4f11e2,_0x1ec678[_0x6264('0x45')]);var _0x52d1b5={'where':_0x4f11e2['where']};return db['CmHopperAdditionalPhone'][_0x6264('0x1f')](_0x52d1b5)[_0x6264('0x29')](function(_0x4b082f){_0x3252b9[_0x6264('0x1f')]=_0x4b082f;if(_0x1ec678[_0x6264('0x37')][_0x6264('0x46')]){_0x4f11e2['include']=[{'all':!![]}];}return db[_0x6264('0x32')][_0x6264('0x47')](_0x4f11e2);})[_0x6264('0x29')](function(_0x5cdca2){_0x3252b9[_0x6264('0x48')]=_0x5cdca2;return _0x3252b9;})[_0x6264('0x29')](respondWithFilteredResult(_0x20b58e,_0x4f11e2))['catch'](handleError(_0x20b58e,null));};exports[_0x6264('0x49')]=function(_0x2e0937,_0x1bf4b9){var _0x594eeb={'raw':!![],'where':{'id':_0x2e0937[_0x6264('0x4a')]['id']}},_0x52b56d={};_0x52b56d[_0x6264('0x36')]=_[_0x6264('0x4b')](db[_0x6264('0x32')][_0x6264('0x33')]);_0x52b56d['query']=_[_0x6264('0x4b')](_0x2e0937[_0x6264('0x37')]);_0x52b56d[_0x6264('0x3e')]=_[_0x6264('0x4c')](_0x52b56d[_0x6264('0x36')],_0x52b56d[_0x6264('0x37')]);_0x594eeb['attributes']=_[_0x6264('0x4c')](_0x52b56d[_0x6264('0x36')],qs[_0x6264('0x38')](_0x2e0937[_0x6264('0x37')][_0x6264('0x38')]));_0x594eeb[_0x6264('0x39')]=_0x594eeb['attributes'][_0x6264('0x4d')]?_0x594eeb['attributes']:_0x52b56d[_0x6264('0x36')];if(_0x2e0937[_0x6264('0x37')][_0x6264('0x46')]){_0x594eeb[_0x6264('0x4e')]=[{'all':!![]}];}_0x594eeb=_[_0x6264('0x44')]({},_0x594eeb,_0x2e0937[_0x6264('0x45')]);return db[_0x6264('0x32')][_0x6264('0x4f')](_0x594eeb)[_0x6264('0x29')](handleEntityNotFound(_0x1bf4b9,null))[_0x6264('0x29')](respondWithResult(_0x1bf4b9,null))[_0x6264('0x50')](handleError(_0x1bf4b9,null));};exports[_0x6264('0x51')]=function(_0x32f08a,_0x3c5ba7){return db['CmHopperAdditionalPhone'][_0x6264('0x51')](_0x32f08a['body'],{})[_0x6264('0x29')](function(_0x37142a){var _0x484571=_0x32f08a[_0x6264('0x52')][_0x6264('0x2b')]({'plain':!![]});if(!_0x484571)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x484571[_0x6264('0x53')]==='user'){var _0x1b9932=_0x37142a[_0x6264('0x2b')]({'plain':!![]});var _0x3156d6=_0x6264('0x2c');return db[_0x6264('0x54')][_0x6264('0x4f')]({'where':{'name':_0x3156d6,'userProfileId':_0x484571[_0x6264('0x55')]},'raw':!![]})[_0x6264('0x29')](function(_0x18d7bd){if(_0x18d7bd&&_0x18d7bd[_0x6264('0x56')]===0x0){return db[_0x6264('0x2d')][_0x6264('0x51')]({'name':_0x1b9932[_0x6264('0x2f')],'resourceId':_0x1b9932['id'],'type':_0x18d7bd['name'],'sectionId':_0x18d7bd['id']},{})['then'](function(){return _0x37142a;});}else{return _0x37142a;}})[_0x6264('0x50')](function(_0x242f2d){logger[_0x6264('0x2e')](_0x6264('0x57'),_0x242f2d);throw _0x242f2d;});}return _0x37142a;})[_0x6264('0x29')](respondWithResult(_0x3c5ba7,0xc9))[_0x6264('0x50')](handleError(_0x3c5ba7,null));};exports[_0x6264('0x28')]=function(_0x5c3478,_0xb38f38){if(_0x5c3478['body']['id']){delete _0x5c3478['body']['id'];}return db[_0x6264('0x32')][_0x6264('0x4f')]({'where':{'id':_0x5c3478[_0x6264('0x4a')]['id']}})[_0x6264('0x29')](handleEntityNotFound(_0xb38f38,null))[_0x6264('0x29')](saveUpdates(_0x5c3478[_0x6264('0x58')],null))[_0x6264('0x29')](respondWithResult(_0xb38f38,null))[_0x6264('0x50')](handleError(_0xb38f38,null));};exports[_0x6264('0x2a')]=function(_0x4c3416,_0x4d4ada){return db['CmHopperAdditionalPhone'][_0x6264('0x4f')]({'where':{'id':_0x4c3416[_0x6264('0x4a')]['id']}})[_0x6264('0x29')](handleEntityNotFound(_0x4d4ada,null))[_0x6264('0x29')](removeEntity(_0x4d4ada,null))[_0x6264('0x50')](handleError(_0x4d4ada,null));}; \ No newline at end of file +var _0x9254=['sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','rows','catch','show','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x230dab,_0x1de849){var _0xb9f2fc=function(_0x369490){while(--_0x369490){_0x230dab['push'](_0x230dab['shift']());}};_0xb9f2fc(++_0x1de849);}(_0x9254,0x8e));var _0x4925=function(_0x577ce5,_0x515b3f){_0x577ce5=_0x577ce5-0x0;var _0x1ef1ba=_0x9254[_0x577ce5];return _0x1ef1ba;};'use strict';var emlformat=require(_0x4925('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4925('0x1'));var jsonpatch=require(_0x4925('0x2'));var rp=require(_0x4925('0x3'));var moment=require(_0x4925('0x4'));var BPromise=require(_0x4925('0x5'));var Mustache=require(_0x4925('0x6'));var util=require(_0x4925('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4925('0x8'));var ejs=require(_0x4925('0x9'));var fs=require('fs');var fs_extra=require(_0x4925('0xa'));var _=require(_0x4925('0xb'));var squel=require(_0x4925('0xc'));var crypto=require('crypto');var jsforce=require(_0x4925('0xd'));var deskjs=require(_0x4925('0xe'));var toCsv=require(_0x4925('0x8'));var querystring=require(_0x4925('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4925('0x10'));var qs=require(_0x4925('0x11'));var as=require(_0x4925('0x12'));var hardwareService=require(_0x4925('0x13'));var logger=require('../../config/logger')(_0x4925('0x14'));var utils=require(_0x4925('0x15'));var config=require(_0x4925('0x16'));var licenseUtil=require(_0x4925('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5370ff,_0x4e0f29){_0x4e0f29=_0x4e0f29||0xcc;return function(_0x43006c){if(_0x43006c){return _0x5370ff[_0x4925('0x18')](_0x4e0f29);}return _0x5370ff[_0x4925('0x19')](_0x4e0f29)[_0x4925('0x1a')]();};}function respondWithResult(_0x26dfd6,_0x5e5d39){_0x5e5d39=_0x5e5d39||0xc8;return function(_0x62f2c5){if(_0x62f2c5){return _0x26dfd6['status'](_0x5e5d39)['json'](_0x62f2c5);}};}function respondWithFilteredResult(_0x17c7b2,_0x57f826){return function(_0x5ca764){if(_0x5ca764){var _0x24c24d=typeof _0x57f826[_0x4925('0x1b')]===_0x4925('0x1c')&&typeof _0x57f826['limit']===_0x4925('0x1c');var _0x43d9d9=_0x5ca764[_0x4925('0x1d')];var _0x2cbf63=_0x24c24d?0x0:_0x57f826[_0x4925('0x1b')];var _0x5cdceb=_0x24c24d?_0x5ca764[_0x4925('0x1d')]:_0x57f826[_0x4925('0x1b')]+_0x57f826['limit'];var _0x3063b1;if(_0x5cdceb>=_0x43d9d9){_0x5cdceb=_0x43d9d9;_0x3063b1=0xc8;}else{_0x3063b1=0xce;}_0x17c7b2[_0x4925('0x19')](_0x3063b1);return _0x17c7b2['set'](_0x4925('0x1e'),_0x2cbf63+'-'+_0x5cdceb+'/'+_0x43d9d9)[_0x4925('0x1f')](_0x5ca764);}return null;};}function patchUpdates(_0x2f71b4){return function(_0x20f3c1){try{jsonpatch[_0x4925('0x20')](_0x20f3c1,_0x2f71b4,!![]);}catch(_0x251ce7){return BPromise[_0x4925('0x21')](_0x251ce7);}return _0x20f3c1[_0x4925('0x22')]();};}function saveUpdates(_0xa97036,_0x504522){return function(_0x45d932){if(_0x45d932){return _0x45d932[_0x4925('0x23')](_0xa97036)[_0x4925('0x24')](function(_0x71680){return _0x71680;});}return null;};}function removeEntity(_0x44413b,_0x2f8eac){return function(_0x219358){if(_0x219358){return _0x219358[_0x4925('0x25')]()[_0x4925('0x24')](function(){var _0x478566=_0x219358[_0x4925('0x26')]({'plain':!![]});var _0x15db51=_0x4925('0x27');return db[_0x4925('0x28')][_0x4925('0x25')]({'where':{'type':_0x15db51,'resourceId':_0x478566['id']}})[_0x4925('0x24')](function(){return _0x219358;});})[_0x4925('0x24')](function(){_0x44413b[_0x4925('0x19')](0xcc)[_0x4925('0x1a')]();});}};}function handleEntityNotFound(_0x3a4b7b,_0x3e5008){return function(_0x22c398){if(!_0x22c398){_0x3a4b7b[_0x4925('0x18')](0x194);}return _0x22c398;};}function handleError(_0x234029,_0x2cc725){_0x2cc725=_0x2cc725||0x1f4;return function(_0x1b5cfb){logger[_0x4925('0x29')](_0x1b5cfb[_0x4925('0x2a')]);if(_0x1b5cfb[_0x4925('0x2b')]){delete _0x1b5cfb['name'];}_0x234029[_0x4925('0x19')](_0x2cc725)[_0x4925('0x2c')](_0x1b5cfb);};}exports['index']=function(_0x2c0916,_0x27d87f){var _0x105d61={},_0x4e5c5={},_0x2e9fc1={'count':0x0,'rows':[]};var _0x1478ee=_['map'](db['CmHopperAdditionalPhone'][_0x4925('0x2d')],function(_0x881135){return{'name':_0x881135[_0x4925('0x2e')],'type':_0x881135['type'][_0x4925('0x2f')]};});_0x4e5c5[_0x4925('0x30')]=_[_0x4925('0x31')](_0x1478ee,_0x4925('0x2b'));_0x4e5c5[_0x4925('0x32')]=_['keys'](_0x2c0916[_0x4925('0x32')]);_0x4e5c5[_0x4925('0x33')]=_[_0x4925('0x34')](_0x4e5c5[_0x4925('0x30')],_0x4e5c5['query']);_0x105d61[_0x4925('0x35')]=_[_0x4925('0x34')](_0x4e5c5['model'],qs[_0x4925('0x36')](_0x2c0916[_0x4925('0x32')][_0x4925('0x36')]));_0x105d61[_0x4925('0x35')]=_0x105d61[_0x4925('0x35')][_0x4925('0x37')]?_0x105d61[_0x4925('0x35')]:_0x4e5c5[_0x4925('0x30')];if(!_0x2c0916[_0x4925('0x32')][_0x4925('0x38')](_0x4925('0x39'))){_0x105d61[_0x4925('0x3a')]=qs[_0x4925('0x3a')](_0x2c0916[_0x4925('0x32')]['limit']);_0x105d61[_0x4925('0x1b')]=qs[_0x4925('0x1b')](_0x2c0916[_0x4925('0x32')][_0x4925('0x1b')]);}_0x105d61['order']=qs[_0x4925('0x3b')](_0x2c0916['query'][_0x4925('0x3b')]);_0x105d61[_0x4925('0x3c')]=qs[_0x4925('0x33')](_[_0x4925('0x3d')](_0x2c0916[_0x4925('0x32')],_0x4e5c5[_0x4925('0x33')]),_0x1478ee);if(_0x2c0916['query'][_0x4925('0x3e')]){_0x105d61[_0x4925('0x3c')]=_[_0x4925('0x3f')](_0x105d61['where'],{'$or':_[_0x4925('0x31')](_0x1478ee,function(_0x1f5fd3){if(_0x1f5fd3[_0x4925('0x40')]!==_0x4925('0x41')){var _0x10e2a9={};_0x10e2a9[_0x1f5fd3[_0x4925('0x2b')]]={'$like':'%'+_0x2c0916['query'][_0x4925('0x3e')]+'%'};return _0x10e2a9;}})});}_0x105d61=_[_0x4925('0x3f')]({},_0x105d61,_0x2c0916[_0x4925('0x42')]);var _0x52653a={'where':_0x105d61['where']};return db[_0x4925('0x43')][_0x4925('0x1d')](_0x52653a)[_0x4925('0x24')](function(_0xcc9a2e){_0x2e9fc1[_0x4925('0x1d')]=_0xcc9a2e;if(_0x2c0916['query'][_0x4925('0x44')]){_0x105d61[_0x4925('0x45')]=[{'all':!![]}];}return db[_0x4925('0x43')]['findAll'](_0x105d61);})['then'](function(_0x4177cc){_0x2e9fc1[_0x4925('0x46')]=_0x4177cc;return _0x2e9fc1;})[_0x4925('0x24')](respondWithFilteredResult(_0x27d87f,_0x105d61))[_0x4925('0x47')](handleError(_0x27d87f,null));};exports[_0x4925('0x48')]=function(_0x5119d5,_0x3ba83b){var _0x2ee337={'raw':!![],'where':{'id':_0x5119d5[_0x4925('0x49')]['id']}},_0x50351e={};_0x50351e[_0x4925('0x30')]=_[_0x4925('0x4a')](db[_0x4925('0x43')][_0x4925('0x2d')]);_0x50351e['query']=_['keys'](_0x5119d5[_0x4925('0x32')]);_0x50351e[_0x4925('0x33')]=_[_0x4925('0x34')](_0x50351e['model'],_0x50351e[_0x4925('0x32')]);_0x2ee337['attributes']=_[_0x4925('0x34')](_0x50351e[_0x4925('0x30')],qs[_0x4925('0x36')](_0x5119d5[_0x4925('0x32')][_0x4925('0x36')]));_0x2ee337['attributes']=_0x2ee337[_0x4925('0x35')][_0x4925('0x37')]?_0x2ee337[_0x4925('0x35')]:_0x50351e['model'];if(_0x5119d5[_0x4925('0x32')][_0x4925('0x44')]){_0x2ee337['include']=[{'all':!![]}];}_0x2ee337=_[_0x4925('0x3f')]({},_0x2ee337,_0x5119d5[_0x4925('0x42')]);return db[_0x4925('0x43')]['find'](_0x2ee337)['then'](handleEntityNotFound(_0x3ba83b,null))[_0x4925('0x24')](respondWithResult(_0x3ba83b,null))[_0x4925('0x47')](handleError(_0x3ba83b,null));};exports[_0x4925('0x4b')]=function(_0x3706d5,_0x3d8125){return db[_0x4925('0x43')][_0x4925('0x4b')](_0x3706d5[_0x4925('0x4c')],{})['then'](function(_0x1036c2){var _0x2a3f59=_0x3706d5['user'][_0x4925('0x26')]({'plain':!![]});if(!_0x2a3f59)throw new Error(_0x4925('0x4d'));if(_0x2a3f59['role']===_0x4925('0x4e')){var _0xaa927d=_0x1036c2['get']({'plain':!![]});var _0x9a90b0='CmHopperAdditionalPhones';return db[_0x4925('0x4f')][_0x4925('0x50')]({'where':{'name':_0x9a90b0,'userProfileId':_0x2a3f59[_0x4925('0x51')]},'raw':!![]})[_0x4925('0x24')](function(_0x13960b){if(_0x13960b&&_0x13960b[_0x4925('0x52')]===0x0){return db[_0x4925('0x28')]['create']({'name':_0xaa927d['name'],'resourceId':_0xaa927d['id'],'type':_0x13960b[_0x4925('0x2b')],'sectionId':_0x13960b['id']},{})[_0x4925('0x24')](function(){return _0x1036c2;});}else{return _0x1036c2;}})['catch'](function(_0x145776){logger[_0x4925('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x145776);throw _0x145776;});}return _0x1036c2;})[_0x4925('0x24')](respondWithResult(_0x3d8125,0xc9))[_0x4925('0x47')](handleError(_0x3d8125,null));};exports[_0x4925('0x23')]=function(_0x47f292,_0x257805){if(_0x47f292[_0x4925('0x4c')]['id']){delete _0x47f292[_0x4925('0x4c')]['id'];}return db[_0x4925('0x43')][_0x4925('0x50')]({'where':{'id':_0x47f292[_0x4925('0x49')]['id']}})[_0x4925('0x24')](handleEntityNotFound(_0x257805,null))['then'](saveUpdates(_0x47f292[_0x4925('0x4c')],null))[_0x4925('0x24')](respondWithResult(_0x257805,null))[_0x4925('0x47')](handleError(_0x257805,null));};exports[_0x4925('0x25')]=function(_0x123238,_0xcd81){return db[_0x4925('0x43')][_0x4925('0x50')]({'where':{'id':_0x123238[_0x4925('0x49')]['id']}})[_0x4925('0x24')](handleEntityNotFound(_0xcd81,null))['then'](removeEntity(_0xcd81,null))[_0x4925('0x47')](handleError(_0xcd81,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 9c3d995..28401aa 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f1=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','lodash'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xd9f1,0x1df));var _0x1d9f=function(_0x26bf94,_0x33a298){_0x26bf94=_0x26bf94-0x0;var _0x107b26=_0xd9f1[_0x26bf94];return _0x107b26;};'use strict';var _=require(_0x1d9f('0x0'));var util=require(_0x1d9f('0x1'));var logger=require('../../config/logger')(_0x1d9f('0x2'));var moment=require(_0x1d9f('0x3'));var BPromise=require(_0x1d9f('0x4'));var rp=require(_0x1d9f('0x5'));var fs=require('fs');var path=require(_0x1d9f('0x6'));var rimraf=require(_0x1d9f('0x7'));var config=require(_0x1d9f('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x1d9f('0x9')]=function(_0x3e88d4,_0x5f0bb7){return _0x3e88d4[_0x1d9f('0xa')](_0x1d9f('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd65c=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x4abcf0,_0x3485c0){var _0x3d44df=function(_0x51221a){while(--_0x51221a){_0x4abcf0['push'](_0x4abcf0['shift']());}};_0x3d44df(++_0x3485c0);}(_0xd65c,0x6b));var _0xcd65=function(_0x50edb7,_0x44caf8){_0x50edb7=_0x50edb7-0x0;var _0x15548a=_0xd65c[_0x50edb7];return _0x15548a;};'use strict';var _=require(_0xcd65('0x0'));var util=require(_0xcd65('0x1'));var logger=require(_0xcd65('0x2'))('api');var moment=require(_0xcd65('0x3'));var BPromise=require(_0xcd65('0x4'));var rp=require(_0xcd65('0x5'));var fs=require('fs');var path=require(_0xcd65('0x6'));var rimraf=require('rimraf');var config=require(_0xcd65('0x7'));var attributes=require(_0xcd65('0x8'));module['exports']=function(_0x3e2ac2,_0x5494e3){return _0x3e2ac2[_0xcd65('0x9')](_0xcd65('0xa'),attributes,{'tableName':_0xcd65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 836521d..2f8723e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84b8=['VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','entity','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','countabandonedretry','createdAt','updatedAt','phone','countbusyretry','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CmHopper','findOne','body','ListId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84b8,0x19a));var _0x884b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x84b8[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x884b('0x0'));var BPromise=require(_0x884b('0x1'));var rs=require(_0x884b('0x2'));var fs=require('fs');var Redis=require(_0x884b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x884b('0x4'));var config=require('../../config/environment');var jayson=require(_0x884b('0x5'));var client=jayson['client'][_0x884b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x172eed,_0x5cdc5b,_0x203f0f){return new BPromise(function(_0x4c1de3,_0x53fd8c){return client[_0x884b('0x7')](_0x172eed,_0x203f0f)[_0x884b('0x8')](function(_0x297bd9){logger['info'](_0x884b('0x9'),_0x5cdc5b,_0x884b('0xa'));logger[_0x884b('0xb')](_0x884b('0xc'),_0x5cdc5b,'request\x20sent',JSON['stringify'](_0x297bd9));if(_0x297bd9[_0x884b('0xd')]){if(_0x297bd9[_0x884b('0xd')]['code']===0x1f4){logger[_0x884b('0xd')](_0x884b('0x9'),_0x5cdc5b,_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);return _0x53fd8c(_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);}logger['error'](_0x884b('0x9'),_0x5cdc5b,_0x297bd9[_0x884b('0xd')]['message']);return _0x4c1de3(_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);}else{logger[_0x884b('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5cdc5b,_0x884b('0xa'));_0x4c1de3(_0x297bd9[_0x884b('0x10')][_0x884b('0xe')]);}})[_0x884b('0x11')](function(_0x3856ef){logger[_0x884b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5cdc5b,_0x3856ef);_0x53fd8c(_0x3856ef);});});}exports['VerifyAdditionalPhones']=function(_0x1cb05b){var _0x2748d5=this;return new Promise(function(_0x4fa0e9,_0x1ca753){return db[_0x884b('0x12')][_0x884b('0x13')]({'raw':!![],'where':{'ContactId':_0x1cb05b['body']['ContactId'],'ListId':_0x1cb05b[_0x884b('0x14')][_0x884b('0x15')],'VoiceQueueId':_0x1cb05b[_0x884b('0x14')]['VoiceQueueId']===undefined?null:_0x1cb05b[_0x884b('0x14')][_0x884b('0x16')],'CampaignId':_0x1cb05b['body'][_0x884b('0x17')]===undefined?null:_0x1cb05b['body']['CampaignId']}})['then'](function(_0x3f114c){if(_0x3f114c!=null){return db[_0x884b('0x18')][_0x884b('0x13')]({'raw':!![],'where':{'CmHopperId':_0x3f114c['id'],'OrderBy':{'$gt':_0x3f114c[_0x884b('0x19')]}},'order':[['OrderBy',_0x884b('0x1a')]]})[_0x884b('0x8')](function(_0x208c96){var _0x4b257f=0x0;if(_0x208c96){if(_0x208c96['countbusyretry']+_0x208c96[_0x884b('0x1b')]+_0x208c96[_0x884b('0x1c')]+_0x208c96['countnosuchnumberretry']+_0x208c96[_0x884b('0x1d')]+_0x208c96['countabandonedretry']+_0x208c96[_0x884b('0x1e')]+_0x208c96['countagentrejectretry']<_0x1cb05b[_0x884b('0x1f')]['dialGlobalMaxRetry'])_0x4b257f=0x1;_0x4fa0e9({'additional':_0x4b257f});}else{return db[_0x884b('0x18')][_0x884b('0x13')]({'raw':!![],'where':{'CmHopperId':_0x3f114c['id']},'order':[[_0x884b('0x19'),_0x884b('0x1a')]]})[_0x884b('0x8')](function(_0xebb00e){var _0xc800a9=0x0;if(_0xebb00e){if(_0xebb00e['countbusyretry']+_0xebb00e['countcongestionretry']+_0xebb00e[_0x884b('0x1c')]+_0xebb00e[_0x884b('0x20')]+_0xebb00e[_0x884b('0x1d')]+_0xebb00e['countabandonedretry']+_0xebb00e[_0x884b('0x1e')]+_0xebb00e[_0x884b('0x21')]<_0x1cb05b[_0x884b('0x1f')][_0x884b('0x22')])_0xc800a9=0x1;_0x4fa0e9({'additional':_0xc800a9});}else{_0x4fa0e9({'additional':0x0});}})[_0x884b('0x11')](function(_0x15b961){logger[_0x884b('0xd')](_0x884b('0x23'),_0x15b961['message']);_0x1ca753(_0x2748d5['error'](0x1f4,_0x15b961[_0x884b('0xe')]));});}})[_0x884b('0x11')](function(_0x29f8cc){logger[_0x884b('0xd')](_0x884b('0x23'),_0x29f8cc[_0x884b('0xe')]);_0x1ca753(_0x2748d5[_0x884b('0xd')](0x1f4,_0x29f8cc[_0x884b('0xe')]));});}else _0x4fa0e9({'additional':0x0});});});};exports[_0x884b('0x24')]=function(_0x25dde5){var _0x3c58c0=this;return new Promise(function(_0x4fb4d8,_0x3e002a){return db['CmHopper'][_0x884b('0x13')]({'raw':!![],'where':{'ContactId':_0x25dde5[_0x884b('0x14')]['ContactId'],'ListId':_0x25dde5[_0x884b('0x14')]['ListId'],'VoiceQueueId':_0x25dde5[_0x884b('0x14')][_0x884b('0x16')]===undefined?null:_0x25dde5[_0x884b('0x14')][_0x884b('0x16')],'CampaignId':_0x25dde5[_0x884b('0x14')]['CampaignId']===undefined?null:_0x25dde5[_0x884b('0x14')][_0x884b('0x17')]}})[_0x884b('0x8')](function(_0x269205){if(_0x269205!=null){return db[_0x884b('0x18')][_0x884b('0x13')]({'raw':!![],'where':{'CmHopperId':_0x269205['id'],'OrderBy':{'$gte':_0x269205[_0x884b('0x19')]}},'order':[[_0x884b('0x19'),_0x884b('0x1a')]]})[_0x884b('0x8')](function(_0x3a4fee){if(_0x3a4fee)return activateAdditionalPhone(_0x269205,_0x25dde5[_0x884b('0x14')],_0x3a4fee,_0x25dde5[_0x884b('0x25')],_0x25dde5[_0x884b('0x26')])[_0x884b('0x8')](function(_0x434dcd){_0x4fb4d8(_0x434dcd);});else{return db[_0x884b('0x18')][_0x884b('0x13')]({'raw':!![],'where':{'CmHopperId':_0x269205['id']},'order':[[_0x884b('0x19'),_0x884b('0x1a')]]})['then'](function(_0x21cf42){if(_0x21cf42)return activateAdditionalPhone(_0x269205,_0x25dde5[_0x884b('0x14')],_0x21cf42,_0x25dde5['duration'],_0x25dde5[_0x884b('0x26')])[_0x884b('0x8')](function(_0x178386){_0x4fb4d8(_0x178386);});else{_0x4fb4d8({'id':_0x269205['id'],'phone':''});}})[_0x884b('0x11')](function(_0x381c69){logger[_0x884b('0xd')](_0x884b('0x23'),_0x381c69['message']);_0x3e002a(_0x3c58c0[_0x884b('0xd')](0x1f4,_0x381c69[_0x884b('0xe')]));});}})[_0x884b('0x11')](function(_0x50189b){logger[_0x884b('0xd')](_0x884b('0x23'),_0x50189b['message']);_0x3e002a(_0x3c58c0[_0x884b('0xd')](0x1f4,_0x50189b[_0x884b('0xe')]));});}else _0x4fb4d8(0x1);});});};function activateAdditionalPhone(_0x3d84d5,_0x2d379b,_0x36939b,_0x3ead4c,_0x5b78a4){return new Promise(function(_0x3f1ec7,_0x53020a){var _0x4416f1;if(_[_0x884b('0x27')](_0x36939b[_0x884b('0x28')])){_0x36939b[_0x884b('0x28')]=moment();}if(moment()>moment(_0x36939b[_0x884b('0x28')])){_0x4416f1=moment()[_0x884b('0x29')](_0x5b78a4||0x3,_0x884b('0x2a'));}else{if(_0x36939b['OrderBy']==0x0){_0x4416f1=moment(_0x36939b[_0x884b('0x28')]);}else{_0x4416f1=moment()['add'](_0x5b78a4||0x3,'minutes');}}if(_[_0x884b('0x27')](_0x4416f1)){_0x4416f1=moment()['add'](_0x5b78a4||0x3,'minutes');}var _0x46740c={'phone':_0x3d84d5['phone'],'active':0x0,'OrderBy':_[_0x884b('0x27')](_0x3d84d5[_0x884b('0x19')])?0x0:_0x3d84d5['OrderBy'],'scheduledat':moment()[_0x884b('0x29')](_0x3ead4c||0x1,_0x884b('0x2a')),'countbusyretry':_0x2d379b['countbusyretry'],'countcongestionretry':_0x2d379b[_0x884b('0x1b')],'countnoanswerretry':_0x2d379b[_0x884b('0x1c')],'countnosuchnumberretry':_0x2d379b[_0x884b('0x20')],'countdropretry':_0x2d379b[_0x884b('0x1d')],'countabandonedretry':_0x2d379b[_0x884b('0x2b')],'countmachineretry':_0x2d379b[_0x884b('0x1e')],'countagentrejectretry':_0x2d379b[_0x884b('0x21')],'createdAt':_0x2d379b[_0x884b('0x2c')],'updatedAt':_0x2d379b[_0x884b('0x2d')]};var _0x497063={'CmHopperId':_0x3d84d5['id'],'phone':_0x36939b[_0x884b('0x2e')],'active':0x0,'OrderBy':_[_0x884b('0x27')](_0x36939b[_0x884b('0x19')])?0x0:_0x36939b['OrderBy'],'scheduledat':_0x4416f1,'countbusyretry':_0x36939b[_0x884b('0x2f')],'countcongestionretry':_0x36939b[_0x884b('0x1b')],'countnoanswerretry':_0x36939b['countnoanswerretry'],'countnosuchnumberretry':_0x36939b[_0x884b('0x20')],'countdropretry':_0x36939b[_0x884b('0x1d')],'countabandonedretry':_0x36939b[_0x884b('0x2b')],'countmachineretry':_0x36939b['countmachineretry'],'countagentrejectretry':_0x36939b[_0x884b('0x21')],'createdAt':_0x36939b[_0x884b('0x2c')],'updatedAt':_0x36939b[_0x884b('0x2d')]};return db[_0x884b('0x30')][_0x884b('0x31')](function(_0x79954e){return db['CmHopperAdditionalPhone']['update'](_0x46740c,{'where':{'id':_0x36939b['id']}},{'transaction':_0x79954e})[_0x884b('0x8')](function(){return db[_0x884b('0x12')][_0x884b('0x32')](_0x497063,{'where':{'id':_0x3d84d5['id']}},{'transaction':_0x79954e});});})['then'](function(_0x2d5e1d){_0x3f1ec7({'id':_0x3d84d5['id'],'phone':_0x36939b['phone']});})[_0x884b('0x11')](function(_0x4011c6){logger[_0x884b('0xd')](_0x884b('0x33'),_0x4011c6[_0x884b('0xe')]);_0x53020a({'error':_0x4011c6[_0x884b('0xe')]});});});}exports[_0x884b('0x34')]=function(_0x25319e){var _0x2ebda4=this;return new Promise(function(_0x369377,_0x1f7910){return db[_0x884b('0x12')][_0x884b('0x32')](_0x25319e[_0x884b('0x14')][_0x884b('0x35')],{'where':{'id':_0x25319e['body']['id']}})[_0x884b('0x8')](function(_0x89a363){_0x369377(_0x89a363);})[_0x884b('0x11')](function(_0x149b6f){logger[_0x884b('0xd')]('IncrementPreviewCounters',_0x149b6f['message']);_0x1f7910(_0x2ebda4['error'](0x1f4,_0x149b6f[_0x884b('0xe')]));});});}; \ No newline at end of file +var _0xbc43=['ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countbusyretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findOne','ContactId','body'];(function(_0x55a511,_0x2ec93d){var _0x52dc79=function(_0x1425bb){while(--_0x1425bb){_0x55a511['push'](_0x55a511['shift']());}};_0x52dc79(++_0x2ec93d);}(_0xbc43,0x1a9));var _0x3bc4=function(_0x29addf,_0x714311){_0x29addf=_0x29addf-0x0;var _0x4bb60d=_0xbc43[_0x29addf];return _0x4bb60d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bc4('0x0'));var BPromise=require(_0x3bc4('0x1'));var rs=require(_0x3bc4('0x2'));var fs=require('fs');var Redis=require(_0x3bc4('0x3'));var db=require(_0x3bc4('0x4'))['db'];var utils=require(_0x3bc4('0x5'));var logger=require(_0x3bc4('0x6'))(_0x3bc4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bc4('0x8')][_0x3bc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40dd20,_0x4a434f,_0x4f659a){return new BPromise(function(_0xe4b579,_0xacd045){return client[_0x3bc4('0xa')](_0x40dd20,_0x4f659a)['then'](function(_0x268b1a){logger['info'](_0x3bc4('0xb'),_0x4a434f,_0x3bc4('0xc'));logger['debug'](_0x3bc4('0xd'),_0x4a434f,_0x3bc4('0xc'),JSON['stringify'](_0x268b1a));if(_0x268b1a[_0x3bc4('0xe')]){if(_0x268b1a['error'][_0x3bc4('0xf')]===0x1f4){logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x268b1a[_0x3bc4('0xe')]['message']);return _0xacd045(_0x268b1a[_0x3bc4('0xe')][_0x3bc4('0x10')]);}logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x268b1a[_0x3bc4('0xe')]['message']);return _0xe4b579(_0x268b1a[_0x3bc4('0xe')][_0x3bc4('0x10')]);}else{logger['info'](_0x3bc4('0xb'),_0x4a434f,_0x3bc4('0xc'));_0xe4b579(_0x268b1a[_0x3bc4('0x11')]['message']);}})[_0x3bc4('0x12')](function(_0x51a336){logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x51a336);_0xacd045(_0x51a336);});});}exports['VerifyAdditionalPhones']=function(_0x29ab8d){var _0xf281ad=this;return new Promise(function(_0x2f9853,_0x5351f0){return db[_0x3bc4('0x13')][_0x3bc4('0x14')]({'raw':!![],'where':{'ContactId':_0x29ab8d['body'][_0x3bc4('0x15')],'ListId':_0x29ab8d[_0x3bc4('0x16')][_0x3bc4('0x17')],'VoiceQueueId':_0x29ab8d[_0x3bc4('0x16')][_0x3bc4('0x18')]===undefined?null:_0x29ab8d[_0x3bc4('0x16')]['VoiceQueueId'],'CampaignId':_0x29ab8d[_0x3bc4('0x16')]['CampaignId']===undefined?null:_0x29ab8d['body'][_0x3bc4('0x19')]}})[_0x3bc4('0x1a')](function(_0x4b98f4){if(_0x4b98f4!=null){return db['CmHopperAdditionalPhone'][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b98f4['id'],'OrderBy':{'$gt':_0x4b98f4['OrderBy']}},'order':[[_0x3bc4('0x1b'),_0x3bc4('0x1c')]]})[_0x3bc4('0x1a')](function(_0xf06ce5){var _0x2cc4a1=0x0;if(_0xf06ce5){if(_0xf06ce5['countbusyretry']+_0xf06ce5[_0x3bc4('0x1d')]+_0xf06ce5['countnoanswerretry']+_0xf06ce5[_0x3bc4('0x1e')]+_0xf06ce5[_0x3bc4('0x1f')]+_0xf06ce5[_0x3bc4('0x20')]+_0xf06ce5['countmachineretry']+_0xf06ce5[_0x3bc4('0x21')]<_0x29ab8d['entity']['dialGlobalMaxRetry'])_0x2cc4a1=0x1;_0x2f9853({'additional':_0x2cc4a1});}else{return db['CmHopperAdditionalPhone'][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b98f4['id']},'order':[[_0x3bc4('0x1b'),'ASC']]})[_0x3bc4('0x1a')](function(_0x5499ca){var _0x5c1d00=0x0;if(_0x5499ca){if(_0x5499ca[_0x3bc4('0x22')]+_0x5499ca[_0x3bc4('0x1d')]+_0x5499ca[_0x3bc4('0x23')]+_0x5499ca['countnosuchnumberretry']+_0x5499ca['countdropretry']+_0x5499ca[_0x3bc4('0x20')]+_0x5499ca[_0x3bc4('0x24')]+_0x5499ca[_0x3bc4('0x21')]<_0x29ab8d['entity'][_0x3bc4('0x25')])_0x5c1d00=0x1;_0x2f9853({'additional':_0x5c1d00});}else{_0x2f9853({'additional':0x0});}})[_0x3bc4('0x12')](function(_0x31b736){logger[_0x3bc4('0xe')](_0x3bc4('0x26'),_0x31b736[_0x3bc4('0x10')]);_0x5351f0(_0xf281ad[_0x3bc4('0xe')](0x1f4,_0x31b736[_0x3bc4('0x10')]));});}})['catch'](function(_0x39d4e7){logger[_0x3bc4('0xe')](_0x3bc4('0x26'),_0x39d4e7[_0x3bc4('0x10')]);_0x5351f0(_0xf281ad['error'](0x1f4,_0x39d4e7[_0x3bc4('0x10')]));});}else _0x2f9853({'additional':0x0});});});};exports[_0x3bc4('0x27')]=function(_0x54a6a3){var _0x1a308a=this;return new Promise(function(_0xbd79d8,_0x5b46a5){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x15')],'ListId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x17')],'VoiceQueueId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x18')]===undefined?null:_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x18')],'CampaignId':_0x54a6a3['body']['CampaignId']===undefined?null:_0x54a6a3[_0x3bc4('0x16')]['CampaignId']}})[_0x3bc4('0x1a')](function(_0x4423a5){if(_0x4423a5!=null){return db[_0x3bc4('0x28')][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4423a5['id'],'OrderBy':{'$gte':_0x4423a5[_0x3bc4('0x1b')]}},'order':[[_0x3bc4('0x1b'),'ASC']]})['then'](function(_0x186158){if(_0x186158)return activateAdditionalPhone(_0x4423a5,_0x54a6a3[_0x3bc4('0x16')],_0x186158,_0x54a6a3[_0x3bc4('0x29')],_0x54a6a3[_0x3bc4('0x2a')])[_0x3bc4('0x1a')](function(_0x7c4f14){_0xbd79d8(_0x7c4f14);});else{return db[_0x3bc4('0x28')][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4423a5['id']},'order':[[_0x3bc4('0x1b'),'ASC']]})[_0x3bc4('0x1a')](function(_0x3409ad){if(_0x3409ad)return activateAdditionalPhone(_0x4423a5,_0x54a6a3[_0x3bc4('0x16')],_0x3409ad,_0x54a6a3['duration'],_0x54a6a3[_0x3bc4('0x2a')])[_0x3bc4('0x1a')](function(_0x3fa03e){_0xbd79d8(_0x3fa03e);});else{_0xbd79d8({'id':_0x4423a5['id'],'phone':''});}})[_0x3bc4('0x12')](function(_0x3bc640){logger['error'](_0x3bc4('0x26'),_0x3bc640[_0x3bc4('0x10')]);_0x5b46a5(_0x1a308a[_0x3bc4('0xe')](0x1f4,_0x3bc640['message']));});}})[_0x3bc4('0x12')](function(_0x4ad5cc){logger['error'](_0x3bc4('0x26'),_0x4ad5cc[_0x3bc4('0x10')]);_0x5b46a5(_0x1a308a['error'](0x1f4,_0x4ad5cc['message']));});}else _0xbd79d8(0x1);});});};function activateAdditionalPhone(_0x5cd153,_0x15c697,_0x5d5160,_0x32d33e,_0x5a49a3){return new Promise(function(_0x5020ab,_0x3df27a){var _0x42146e;if(_[_0x3bc4('0x2b')](_0x5d5160['scheduledat'])){_0x5d5160[_0x3bc4('0x2c')]=moment();}if(moment()>moment(_0x5d5160[_0x3bc4('0x2c')])){_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}else{if(_0x5d5160[_0x3bc4('0x1b')]==0x0){_0x42146e=moment(_0x5d5160[_0x3bc4('0x2c')]);}else{_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}}if(_['isNil'](_0x42146e)){_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}var _0x4f2551={'phone':_0x5cd153[_0x3bc4('0x2f')],'active':0x0,'OrderBy':_[_0x3bc4('0x2b')](_0x5cd153[_0x3bc4('0x1b')])?0x0:_0x5cd153['OrderBy'],'scheduledat':moment()[_0x3bc4('0x2d')](_0x32d33e||0x1,_0x3bc4('0x2e')),'countbusyretry':_0x15c697[_0x3bc4('0x22')],'countcongestionretry':_0x15c697[_0x3bc4('0x1d')],'countnoanswerretry':_0x15c697[_0x3bc4('0x23')],'countnosuchnumberretry':_0x15c697[_0x3bc4('0x1e')],'countdropretry':_0x15c697['countdropretry'],'countabandonedretry':_0x15c697['countabandonedretry'],'countmachineretry':_0x15c697[_0x3bc4('0x24')],'countagentrejectretry':_0x15c697['countagentrejectretry'],'createdAt':_0x15c697[_0x3bc4('0x30')],'updatedAt':_0x15c697['updatedAt']};var _0x1ba9a6={'CmHopperId':_0x5cd153['id'],'phone':_0x5d5160[_0x3bc4('0x2f')],'active':0x0,'OrderBy':_[_0x3bc4('0x2b')](_0x5d5160[_0x3bc4('0x1b')])?0x0:_0x5d5160[_0x3bc4('0x1b')],'scheduledat':_0x42146e,'countbusyretry':_0x5d5160[_0x3bc4('0x22')],'countcongestionretry':_0x5d5160[_0x3bc4('0x1d')],'countnoanswerretry':_0x5d5160[_0x3bc4('0x23')],'countnosuchnumberretry':_0x5d5160[_0x3bc4('0x1e')],'countdropretry':_0x5d5160['countdropretry'],'countabandonedretry':_0x5d5160[_0x3bc4('0x20')],'countmachineretry':_0x5d5160['countmachineretry'],'countagentrejectretry':_0x5d5160[_0x3bc4('0x21')],'createdAt':_0x5d5160[_0x3bc4('0x30')],'updatedAt':_0x5d5160[_0x3bc4('0x31')]};return db[_0x3bc4('0x32')][_0x3bc4('0x33')](function(_0x38d038){return db[_0x3bc4('0x28')][_0x3bc4('0x34')](_0x4f2551,{'where':{'id':_0x5d5160['id']}},{'transaction':_0x38d038})['then'](function(){return db[_0x3bc4('0x13')][_0x3bc4('0x34')](_0x1ba9a6,{'where':{'id':_0x5cd153['id']}},{'transaction':_0x38d038});});})[_0x3bc4('0x1a')](function(_0xb82764){_0x5020ab({'id':_0x5cd153['id'],'phone':_0x5d5160[_0x3bc4('0x2f')]});})[_0x3bc4('0x12')](function(_0x4a9c51){logger[_0x3bc4('0xe')](_0x3bc4('0x35'),_0x4a9c51[_0x3bc4('0x10')]);_0x3df27a({'error':_0x4a9c51[_0x3bc4('0x10')]});});});}exports[_0x3bc4('0x36')]=function(_0x1f6c82){var _0x2f68e1=this;return new Promise(function(_0x3b51a6,_0x42b0e1){return db['CmHopper']['update'](_0x1f6c82[_0x3bc4('0x16')][_0x3bc4('0x37')],{'where':{'id':_0x1f6c82[_0x3bc4('0x16')]['id']}})[_0x3bc4('0x1a')](function(_0x101dbf){_0x3b51a6(_0x101dbf);})[_0x3bc4('0x12')](function(_0x28bde7){logger[_0x3bc4('0xe')](_0x3bc4('0x36'),_0x28bde7[_0x3bc4('0x10')]);_0x42b0e1(_0x2f68e1[_0x3bc4('0xe')](0x1f4,_0x28bde7[_0x3bc4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 77fc7f8..e6be0b0 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64f7=['update','delete','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','create','put','/:id'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x64f7,0x11b));var _0x764f=function(_0x2b96a9,_0x1d3db1){_0x2b96a9=_0x2b96a9-0x0;var _0x588383=_0x64f7[_0x2b96a9];return _0x588383;};'use strict';var multer=require(_0x764f('0x0'));var util=require(_0x764f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x764f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x764f('0x3'));var interaction=require(_0x764f('0x4'));var config=require('../../config/environment');var controller=require(_0x764f('0x5'));router['get']('/',auth[_0x764f('0x6')](),controller[_0x764f('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x764f('0x6')](),controller[_0x764f('0x8')]);router[_0x764f('0x9')](_0x764f('0xa'),auth['isAuthenticated'](),controller[_0x764f('0xb')]);router[_0x764f('0xc')]('/:id',auth[_0x764f('0x6')](),controller[_0x764f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x5346=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x5346,0x112));var _0x6534=function(_0x517e55,_0x2f9447){_0x517e55=_0x517e55-0x0;var _0x3e2f8b=_0x5346[_0x517e55];return _0x3e2f8b;};'use strict';var multer=require(_0x6534('0x0'));var util=require(_0x6534('0x1'));var path=require(_0x6534('0x2'));var timeout=require(_0x6534('0x3'));var express=require(_0x6534('0x4'));var router=express[_0x6534('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6534('0x6'));var controller=require(_0x6534('0x7'));router[_0x6534('0x8')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0xa')]);router[_0x6534('0x8')]('/:id',auth[_0x6534('0x9')](),controller['show']);router[_0x6534('0xb')]('/',auth['isAuthenticated'](),controller[_0x6534('0xc')]);router[_0x6534('0xd')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0xf')]);router[_0x6534('0x10')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0x11')]);module[_0x6534('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2318e7d..00501cd 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 _0xdcfa=['contactListQueue','moment','exports','INTEGER'];(function(_0x366af4,_0x26eec1){var _0x2f31a6=function(_0x2ecd0a){while(--_0x2ecd0a){_0x366af4['push'](_0x366af4['shift']());}};_0x2f31a6(++_0x26eec1);}(_0xdcfa,0xad));var _0xadcf=function(_0x17790d,_0x2532a6){_0x17790d=_0x17790d-0x0;var _0x59c20c=_0xdcfa[_0x17790d];return _0x59c20c;};'use strict';var moment=require(_0xadcf('0x0'));var Sequelize=require('sequelize');module[_0xadcf('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xadcf('0x2')],'unique':_0xadcf('0x3')},'ListId':{'type':Sequelize[_0xadcf('0x2')],'unique':_0xadcf('0x3')},'VoiceQueueId':{'type':Sequelize[_0xadcf('0x2')],'unique':_0xadcf('0x3')}}; \ No newline at end of file +var _0xcfef=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x42708d,_0x251f79){_0x42708d=_0x42708d-0x0;var _0xcff127=_0xcfef[_0x42708d];return _0xcff127;};'use strict';var moment=require('moment');var Sequelize=require(_0xfcfe('0x0'));module[_0xfcfe('0x1')]={'phone':{'type':Sequelize[_0xfcfe('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xfcfe('0x3')],'unique':_0xfcfe('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 48bdbea..2a248cf 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 _0xa997=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x219143,_0x451ca3){var _0x501e6b=function(_0x5888fc){while(--_0x5888fc){_0x219143['push'](_0x219143['shift']());}};_0x501e6b(++_0x451ca3);}(_0xa997,0x166));var _0x7a99=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0xa997[_0x33cf66];return _0x3a400b;};'use strict';var emlformat=require(_0x7a99('0x0'));var rimraf=require(_0x7a99('0x1'));var zipdir=require(_0x7a99('0x2'));var jsonpatch=require(_0x7a99('0x3'));var rp=require('request-promise');var moment=require(_0x7a99('0x4'));var BPromise=require(_0x7a99('0x5'));var Mustache=require('mustache');var util=require(_0x7a99('0x6'));var path=require(_0x7a99('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a99('0x8'));var fs=require('fs');var fs_extra=require(_0x7a99('0x9'));var _=require(_0x7a99('0xa'));var squel=require(_0x7a99('0xb'));var crypto=require(_0x7a99('0xc'));var jsforce=require(_0x7a99('0xd'));var deskjs=require(_0x7a99('0xe'));var toCsv=require(_0x7a99('0xf'));var querystring=require(_0x7a99('0x10'));var Papa=require('papaparse');var Redis=require(_0x7a99('0x11'));var authService=require(_0x7a99('0x12'));var qs=require(_0x7a99('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a99('0x14'))(_0x7a99('0x15'));var utils=require(_0x7a99('0x16'));var config=require(_0x7a99('0x17'));var licenseUtil=require(_0x7a99('0x18'));var db=require(_0x7a99('0x19'))['db'];function respondWithStatusCode(_0xaf132d,_0x138bb7){_0x138bb7=_0x138bb7||0xcc;return function(_0x42d656){if(_0x42d656){return _0xaf132d[_0x7a99('0x1a')](_0x138bb7);}return _0xaf132d['status'](_0x138bb7)[_0x7a99('0x1b')]();};}function respondWithResult(_0x5b4511,_0xaa5c4){_0xaa5c4=_0xaa5c4||0xc8;return function(_0x311e6c){if(_0x311e6c){return _0x5b4511[_0x7a99('0x1c')](_0xaa5c4)[_0x7a99('0x1d')](_0x311e6c);}};}function respondWithFilteredResult(_0x32e794,_0x207ac){return function(_0x139b86){if(_0x139b86){var _0x4d50c8=typeof _0x207ac['offset']===_0x7a99('0x1e')&&typeof _0x207ac[_0x7a99('0x1f')]===_0x7a99('0x1e');var _0xa56571=_0x139b86[_0x7a99('0x20')];var _0x18dad6=_0x4d50c8?0x0:_0x207ac['offset'];var _0x11241c=_0x4d50c8?_0x139b86[_0x7a99('0x20')]:_0x207ac[_0x7a99('0x21')]+_0x207ac[_0x7a99('0x1f')];var _0x1c0a41;if(_0x11241c>=_0xa56571){_0x11241c=_0xa56571;_0x1c0a41=0xc8;}else{_0x1c0a41=0xce;}_0x32e794[_0x7a99('0x1c')](_0x1c0a41);return _0x32e794[_0x7a99('0x22')](_0x7a99('0x23'),_0x18dad6+'-'+_0x11241c+'/'+_0xa56571)[_0x7a99('0x1d')](_0x139b86);}return null;};}function patchUpdates(_0x460149){return function(_0x622ea4){try{jsonpatch[_0x7a99('0x24')](_0x622ea4,_0x460149,!![]);}catch(_0x4f8b73){return BPromise['reject'](_0x4f8b73);}return _0x622ea4[_0x7a99('0x25')]();};}function saveUpdates(_0x194772,_0x557adf){return function(_0x6dc122){if(_0x6dc122){return _0x6dc122[_0x7a99('0x26')](_0x194772)['then'](function(_0x2afaef){return _0x2afaef;});}return null;};}function removeEntity(_0x10e3aa,_0x3d403f){return function(_0x4a516d){if(_0x4a516d){return _0x4a516d['destroy']()[_0x7a99('0x27')](function(){_0x10e3aa[_0x7a99('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6b3c,_0x76154e){return function(_0x1b6cc7){if(!_0x1b6cc7){_0x3c6b3c[_0x7a99('0x1a')](0x194);}return _0x1b6cc7;};}function handleError(_0x29aa19,_0x4ddf41){_0x4ddf41=_0x4ddf41||0x1f4;return function(_0x2cb393){logger[_0x7a99('0x28')](_0x2cb393[_0x7a99('0x29')]);if(_0x2cb393['name']){delete _0x2cb393['name'];}_0x29aa19[_0x7a99('0x1c')](_0x4ddf41)['send'](_0x2cb393);};}exports[_0x7a99('0x2a')]=function(_0x558dd6,_0x3fd4ce){var _0x561e89={},_0x5e1a48={},_0x1378e4={'count':0x0,'rows':[]};var _0x2e93fa=_[_0x7a99('0x2b')](db[_0x7a99('0x2c')][_0x7a99('0x2d')],function(_0x57140f){return{'name':_0x57140f[_0x7a99('0x2e')],'type':_0x57140f[_0x7a99('0x2f')][_0x7a99('0x30')]};});_0x5e1a48['model']=_[_0x7a99('0x2b')](_0x2e93fa,_0x7a99('0x31'));_0x5e1a48['query']=_[_0x7a99('0x32')](_0x558dd6[_0x7a99('0x33')]);_0x5e1a48[_0x7a99('0x34')]=_[_0x7a99('0x35')](_0x5e1a48[_0x7a99('0x36')],_0x5e1a48[_0x7a99('0x33')]);_0x561e89['attributes']=_[_0x7a99('0x35')](_0x5e1a48[_0x7a99('0x36')],qs[_0x7a99('0x37')](_0x558dd6['query'][_0x7a99('0x37')]));_0x561e89[_0x7a99('0x38')]=_0x561e89['attributes']['length']?_0x561e89[_0x7a99('0x38')]:_0x5e1a48[_0x7a99('0x36')];if(!_0x558dd6['query'][_0x7a99('0x39')]('nolimit')){_0x561e89[_0x7a99('0x1f')]=qs[_0x7a99('0x1f')](_0x558dd6[_0x7a99('0x33')][_0x7a99('0x1f')]);_0x561e89[_0x7a99('0x21')]=qs[_0x7a99('0x21')](_0x558dd6[_0x7a99('0x33')][_0x7a99('0x21')]);}_0x561e89[_0x7a99('0x3a')]=qs[_0x7a99('0x3b')](_0x558dd6['query'][_0x7a99('0x3b')]);_0x561e89[_0x7a99('0x3c')]=qs[_0x7a99('0x34')](_['pick'](_0x558dd6['query'],_0x5e1a48['filters']),_0x2e93fa);if(_0x558dd6[_0x7a99('0x33')][_0x7a99('0x3d')]){_0x561e89['where']=_[_0x7a99('0x3e')](_0x561e89[_0x7a99('0x3c')],{'$or':_[_0x7a99('0x2b')](_0x2e93fa,function(_0x1d7b93){if(_0x1d7b93[_0x7a99('0x2f')]!==_0x7a99('0x3f')){var _0x25b9fd={};_0x25b9fd[_0x1d7b93[_0x7a99('0x31')]]={'$like':'%'+_0x558dd6[_0x7a99('0x33')]['filter']+'%'};return _0x25b9fd;}})});}_0x561e89=_[_0x7a99('0x3e')]({},_0x561e89,_0x558dd6[_0x7a99('0x40')]);var _0x274a86={'where':_0x561e89['where']};return db['CmHopperBlack'][_0x7a99('0x20')](_0x274a86)[_0x7a99('0x27')](function(_0x59922e){_0x1378e4['count']=_0x59922e;if(_0x558dd6[_0x7a99('0x33')][_0x7a99('0x41')]){_0x561e89[_0x7a99('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x561e89);})[_0x7a99('0x27')](function(_0x25926e){_0x1378e4[_0x7a99('0x43')]=_0x25926e;return _0x1378e4;})['then'](respondWithFilteredResult(_0x3fd4ce,_0x561e89))[_0x7a99('0x44')](handleError(_0x3fd4ce,null));};exports[_0x7a99('0x45')]=function(_0x37611a,_0x7a3e97){var _0x195756={'raw':!![],'where':{'id':_0x37611a['params']['id']}},_0x2e5677={};_0x2e5677[_0x7a99('0x36')]=_[_0x7a99('0x32')](db[_0x7a99('0x2c')][_0x7a99('0x2d')]);_0x2e5677['query']=_[_0x7a99('0x32')](_0x37611a[_0x7a99('0x33')]);_0x2e5677[_0x7a99('0x34')]=_[_0x7a99('0x35')](_0x2e5677[_0x7a99('0x36')],_0x2e5677['query']);_0x195756['attributes']=_[_0x7a99('0x35')](_0x2e5677[_0x7a99('0x36')],qs[_0x7a99('0x37')](_0x37611a[_0x7a99('0x33')]['fields']));_0x195756[_0x7a99('0x38')]=_0x195756['attributes']['length']?_0x195756[_0x7a99('0x38')]:_0x2e5677['model'];if(_0x37611a[_0x7a99('0x33')][_0x7a99('0x41')]){_0x195756[_0x7a99('0x42')]=[{'all':!![]}];}_0x195756=_[_0x7a99('0x3e')]({},_0x195756,_0x37611a[_0x7a99('0x40')]);return db[_0x7a99('0x2c')][_0x7a99('0x46')](_0x195756)[_0x7a99('0x27')](handleEntityNotFound(_0x7a3e97,null))[_0x7a99('0x27')](respondWithResult(_0x7a3e97,null))['catch'](handleError(_0x7a3e97,null));};exports[_0x7a99('0x26')]=function(_0x42c130,_0xcef9a6){if(_0x42c130[_0x7a99('0x47')]['id']){delete _0x42c130[_0x7a99('0x47')]['id'];}return db[_0x7a99('0x2c')][_0x7a99('0x46')]({'where':{'id':_0x42c130[_0x7a99('0x48')]['id']}})[_0x7a99('0x27')](handleEntityNotFound(_0xcef9a6,null))['then'](saveUpdates(_0x42c130[_0x7a99('0x47')],null))[_0x7a99('0x27')](respondWithResult(_0xcef9a6,null))[_0x7a99('0x44')](handleError(_0xcef9a6,null));};exports[_0x7a99('0x49')]=function(_0x2751e1,_0x19b74c){return db[_0x7a99('0x2c')][_0x7a99('0x46')]({'where':{'id':_0x2751e1[_0x7a99('0x48')]['id']}})[_0x7a99('0x27')](handleEntityNotFound(_0x19b74c,null))[_0x7a99('0x27')](removeEntity(_0x19b74c,null))[_0x7a99('0x44')](handleError(_0x19b74c,null));};exports[_0x7a99('0x4a')]=function(_0x2ae9d1,_0x538ccb){return db[_0x7a99('0x2c')][_0x7a99('0x4a')]()[_0x7a99('0x27')](respondWithResult(_0x538ccb,null))[_0x7a99('0x44')](handleError(_0x538ccb,null));}; \ No newline at end of file +var _0x2f30=['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','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','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','CmHopperBlack','includeAll','include','findAll','rows','options','find','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util'];(function(_0x1225c3,_0x3f6e5b){var _0x2ff54c=function(_0x4591b8){while(--_0x4591b8){_0x1225c3['push'](_0x1225c3['shift']());}};_0x2ff54c(++_0x3f6e5b);}(_0x2f30,0xe6));var _0x02f3=function(_0x3ef247,_0x2bd5e0){_0x3ef247=_0x3ef247-0x0;var _0x46240f=_0x2f30[_0x3ef247];return _0x46240f;};'use strict';var emlformat=require(_0x02f3('0x0'));var rimraf=require(_0x02f3('0x1'));var zipdir=require(_0x02f3('0x2'));var jsonpatch=require(_0x02f3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02f3('0x4'));var Mustache=require(_0x02f3('0x5'));var util=require(_0x02f3('0x6'));var path=require(_0x02f3('0x7'));var sox=require(_0x02f3('0x8'));var csv=require(_0x02f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02f3('0xa'));var _=require(_0x02f3('0xb'));var squel=require(_0x02f3('0xc'));var crypto=require(_0x02f3('0xd'));var jsforce=require(_0x02f3('0xe'));var deskjs=require(_0x02f3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x02f3('0x10'));var Papa=require('papaparse');var Redis=require(_0x02f3('0x11'));var authService=require(_0x02f3('0x12'));var qs=require(_0x02f3('0x13'));var as=require(_0x02f3('0x14'));var hardwareService=require(_0x02f3('0x15'));var logger=require('../../config/logger')(_0x02f3('0x16'));var utils=require(_0x02f3('0x17'));var config=require(_0x02f3('0x18'));var licenseUtil=require(_0x02f3('0x19'));var db=require(_0x02f3('0x1a'))['db'];function respondWithStatusCode(_0x14ab6c,_0x5970fd){_0x5970fd=_0x5970fd||0xcc;return function(_0x5294ff){if(_0x5294ff){return _0x14ab6c[_0x02f3('0x1b')](_0x5970fd);}return _0x14ab6c['status'](_0x5970fd)['end']();};}function respondWithResult(_0x274ad4,_0x6a001f){_0x6a001f=_0x6a001f||0xc8;return function(_0x3fa347){if(_0x3fa347){return _0x274ad4[_0x02f3('0x1c')](_0x6a001f)[_0x02f3('0x1d')](_0x3fa347);}};}function respondWithFilteredResult(_0x1d3d1c,_0x59b100){return function(_0xb2f2e2){if(_0xb2f2e2){var _0x230718=typeof _0x59b100[_0x02f3('0x1e')]===_0x02f3('0x1f')&&typeof _0x59b100[_0x02f3('0x20')]===_0x02f3('0x1f');var _0x34eb12=_0xb2f2e2[_0x02f3('0x21')];var _0x5c7f47=_0x230718?0x0:_0x59b100[_0x02f3('0x1e')];var _0x6948ef=_0x230718?_0xb2f2e2[_0x02f3('0x21')]:_0x59b100[_0x02f3('0x1e')]+_0x59b100['limit'];var _0x5425e2;if(_0x6948ef>=_0x34eb12){_0x6948ef=_0x34eb12;_0x5425e2=0xc8;}else{_0x5425e2=0xce;}_0x1d3d1c[_0x02f3('0x1c')](_0x5425e2);return _0x1d3d1c[_0x02f3('0x22')](_0x02f3('0x23'),_0x5c7f47+'-'+_0x6948ef+'/'+_0x34eb12)['json'](_0xb2f2e2);}return null;};}function patchUpdates(_0x33db10){return function(_0x216a64){try{jsonpatch[_0x02f3('0x24')](_0x216a64,_0x33db10,!![]);}catch(_0x58ab03){return BPromise[_0x02f3('0x25')](_0x58ab03);}return _0x216a64['save']();};}function saveUpdates(_0x1fa444,_0x12b7c8){return function(_0x29fc05){if(_0x29fc05){return _0x29fc05[_0x02f3('0x26')](_0x1fa444)[_0x02f3('0x27')](function(_0x4b55dd){return _0x4b55dd;});}return null;};}function removeEntity(_0x6cd288,_0x3ff6d5){return function(_0x2638fb){if(_0x2638fb){return _0x2638fb[_0x02f3('0x28')]()[_0x02f3('0x27')](function(){_0x6cd288[_0x02f3('0x1c')](0xcc)[_0x02f3('0x29')]();});}};}function handleEntityNotFound(_0xb7e6bd,_0x2bf84d){return function(_0x16bcba){if(!_0x16bcba){_0xb7e6bd[_0x02f3('0x1b')](0x194);}return _0x16bcba;};}function handleError(_0x52f4a8,_0x190dd2){_0x190dd2=_0x190dd2||0x1f4;return function(_0x33d5f5){logger[_0x02f3('0x2a')](_0x33d5f5[_0x02f3('0x2b')]);if(_0x33d5f5[_0x02f3('0x2c')]){delete _0x33d5f5[_0x02f3('0x2c')];}_0x52f4a8[_0x02f3('0x1c')](_0x190dd2)[_0x02f3('0x2d')](_0x33d5f5);};}exports[_0x02f3('0x2e')]=function(_0x3127d8,_0x1c8c73){var _0x3d8564={},_0x3b951c={},_0x1e4b95={'count':0x0,'rows':[]};var _0x702696=_[_0x02f3('0x2f')](db['CmHopperBlack'][_0x02f3('0x30')],function(_0x449a6b){return{'name':_0x449a6b[_0x02f3('0x31')],'type':_0x449a6b['type'][_0x02f3('0x32')]};});_0x3b951c[_0x02f3('0x33')]=_['map'](_0x702696,_0x02f3('0x2c'));_0x3b951c[_0x02f3('0x34')]=_[_0x02f3('0x35')](_0x3127d8[_0x02f3('0x34')]);_0x3b951c['filters']=_[_0x02f3('0x36')](_0x3b951c['model'],_0x3b951c[_0x02f3('0x34')]);_0x3d8564['attributes']=_[_0x02f3('0x36')](_0x3b951c[_0x02f3('0x33')],qs[_0x02f3('0x37')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x37')]));_0x3d8564[_0x02f3('0x38')]=_0x3d8564[_0x02f3('0x38')][_0x02f3('0x39')]?_0x3d8564[_0x02f3('0x38')]:_0x3b951c['model'];if(!_0x3127d8['query'][_0x02f3('0x3a')](_0x02f3('0x3b'))){_0x3d8564[_0x02f3('0x20')]=qs[_0x02f3('0x20')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x20')]);_0x3d8564[_0x02f3('0x1e')]=qs[_0x02f3('0x1e')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x1e')]);}_0x3d8564[_0x02f3('0x3c')]=qs[_0x02f3('0x3d')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x3d')]);_0x3d8564[_0x02f3('0x3e')]=qs['filters'](_['pick'](_0x3127d8[_0x02f3('0x34')],_0x3b951c[_0x02f3('0x3f')]),_0x702696);if(_0x3127d8[_0x02f3('0x34')][_0x02f3('0x40')]){_0x3d8564[_0x02f3('0x3e')]=_['merge'](_0x3d8564['where'],{'$or':_[_0x02f3('0x2f')](_0x702696,function(_0x36e4cf){if(_0x36e4cf[_0x02f3('0x41')]!==_0x02f3('0x42')){var _0x8077ae={};_0x8077ae[_0x36e4cf['name']]={'$like':'%'+_0x3127d8[_0x02f3('0x34')][_0x02f3('0x40')]+'%'};return _0x8077ae;}})});}_0x3d8564=_[_0x02f3('0x43')]({},_0x3d8564,_0x3127d8['options']);var _0x22621b={'where':_0x3d8564[_0x02f3('0x3e')]};return db[_0x02f3('0x44')]['count'](_0x22621b)[_0x02f3('0x27')](function(_0x4673fa){_0x1e4b95[_0x02f3('0x21')]=_0x4673fa;if(_0x3127d8['query'][_0x02f3('0x45')]){_0x3d8564[_0x02f3('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x02f3('0x47')](_0x3d8564);})[_0x02f3('0x27')](function(_0x44e3d0){_0x1e4b95[_0x02f3('0x48')]=_0x44e3d0;return _0x1e4b95;})[_0x02f3('0x27')](respondWithFilteredResult(_0x1c8c73,_0x3d8564))['catch'](handleError(_0x1c8c73,null));};exports['show']=function(_0x7c9207,_0x297f2a){var _0xd53b68={'raw':!![],'where':{'id':_0x7c9207['params']['id']}},_0x438984={};_0x438984[_0x02f3('0x33')]=_[_0x02f3('0x35')](db['CmHopperBlack'][_0x02f3('0x30')]);_0x438984[_0x02f3('0x34')]=_[_0x02f3('0x35')](_0x7c9207[_0x02f3('0x34')]);_0x438984[_0x02f3('0x3f')]=_[_0x02f3('0x36')](_0x438984[_0x02f3('0x33')],_0x438984[_0x02f3('0x34')]);_0xd53b68['attributes']=_[_0x02f3('0x36')](_0x438984[_0x02f3('0x33')],qs[_0x02f3('0x37')](_0x7c9207[_0x02f3('0x34')][_0x02f3('0x37')]));_0xd53b68[_0x02f3('0x38')]=_0xd53b68[_0x02f3('0x38')]['length']?_0xd53b68['attributes']:_0x438984['model'];if(_0x7c9207[_0x02f3('0x34')][_0x02f3('0x45')]){_0xd53b68[_0x02f3('0x46')]=[{'all':!![]}];}_0xd53b68=_['merge']({},_0xd53b68,_0x7c9207[_0x02f3('0x49')]);return db[_0x02f3('0x44')][_0x02f3('0x4a')](_0xd53b68)[_0x02f3('0x27')](handleEntityNotFound(_0x297f2a,null))[_0x02f3('0x27')](respondWithResult(_0x297f2a,null))['catch'](handleError(_0x297f2a,null));};exports[_0x02f3('0x26')]=function(_0x277e66,_0x20ad72){if(_0x277e66[_0x02f3('0x4b')]['id']){delete _0x277e66[_0x02f3('0x4b')]['id'];}return db[_0x02f3('0x44')]['find']({'where':{'id':_0x277e66[_0x02f3('0x4c')]['id']}})[_0x02f3('0x27')](handleEntityNotFound(_0x20ad72,null))[_0x02f3('0x27')](saveUpdates(_0x277e66[_0x02f3('0x4b')],null))[_0x02f3('0x27')](respondWithResult(_0x20ad72,null))[_0x02f3('0x4d')](handleError(_0x20ad72,null));};exports[_0x02f3('0x28')]=function(_0x3e1ec2,_0x362df1){return db[_0x02f3('0x44')][_0x02f3('0x4a')]({'where':{'id':_0x3e1ec2[_0x02f3('0x4c')]['id']}})[_0x02f3('0x27')](handleEntityNotFound(_0x362df1,null))[_0x02f3('0x27')](removeEntity(_0x362df1,null))[_0x02f3('0x4d')](handleError(_0x362df1,null));};exports[_0x02f3('0x4e')]=function(_0x44d3f1,_0x507a16){return db[_0x02f3('0x44')]['describe']()['then'](respondWithResult(_0x507a16,null))[_0x02f3('0x4d')](handleError(_0x507a16,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f748b45..3ebacb8 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 _0xfc55=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','util','../../config/logger'];(function(_0x5081f6,_0x2eb3e4){var _0xb684=function(_0xa85316){while(--_0xa85316){_0x5081f6['push'](_0x5081f6['shift']());}};_0xb684(++_0x2eb3e4);}(_0xfc55,0xae));var _0x5fc5=function(_0x2cd1a5,_0xb4626e){_0x2cd1a5=_0x2cd1a5-0x0;var _0x28dff6=_0xfc55[_0x2cd1a5];return _0x28dff6;};'use strict';var _=require('lodash');var util=require(_0x5fc5('0x0'));var logger=require(_0x5fc5('0x1'))(_0x5fc5('0x2'));var moment=require(_0x5fc5('0x3'));var BPromise=require(_0x5fc5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fc5('0x5'));var rimraf=require(_0x5fc5('0x6'));var config=require(_0x5fc5('0x7'));var attributes=require(_0x5fc5('0x8'));module['exports']=function(_0xc216cd,_0x4fd2f4){return _0xc216cd[_0x5fc5('0x9')](_0x5fc5('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce67=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x52617,_0x12f9a){var _0x416cb9=function(_0x18638d){while(--_0x18638d){_0x52617['push'](_0x52617['shift']());}};_0x416cb9(++_0x12f9a);}(_0xce67,0xae));var _0x7ce6=function(_0x473388,_0x2d6d57){_0x473388=_0x473388-0x0;var _0x2f7f62=_0xce67[_0x473388];return _0x2f7f62;};'use strict';var _=require(_0x7ce6('0x0'));var util=require('util');var logger=require(_0x7ce6('0x1'))(_0x7ce6('0x2'));var moment=require(_0x7ce6('0x3'));var BPromise=require(_0x7ce6('0x4'));var rp=require(_0x7ce6('0x5'));var fs=require('fs');var path=require(_0x7ce6('0x6'));var rimraf=require(_0x7ce6('0x7'));var config=require(_0x7ce6('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x7ce6('0x9')]=function(_0x5c7c7a,_0x484a4d){return _0x5c7c7a[_0x7ce6('0xa')](_0x7ce6('0xb'),attributes,{'tableName':_0x7ce6('0xc'),'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 f539a5f..9389e7a 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 _0x5175=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','UpdateCmHopperBlack','body','where','destroy','DestroyCmHopperBlack','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x5175,0xdf));var _0x5517=function(_0x2cae6e,_0x15eda1){_0x2cae6e=_0x2cae6e-0x0;var _0x18559d=_0x5175[_0x2cae6e];return _0x18559d;};'use strict';var _=require(_0x5517('0x0'));var util=require(_0x5517('0x1'));var moment=require(_0x5517('0x2'));var BPromise=require(_0x5517('0x3'));var rs=require(_0x5517('0x4'));var fs=require('fs');var Redis=require(_0x5517('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5517('0x6'));var logger=require(_0x5517('0x7'))(_0x5517('0x8'));var config=require('../../config/environment');var jayson=require(_0x5517('0x9'));var client=jayson[_0x5517('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425a60,_0x181a4c,_0x5ae0b1){return new BPromise(function(_0xac329f,_0x5a2903){return client[_0x5517('0xb')](_0x425a60,_0x5ae0b1)[_0x5517('0xc')](function(_0x431b12){logger[_0x5517('0xd')](_0x5517('0xe'),_0x181a4c,'request\x20sent');logger['debug'](_0x5517('0xf'),_0x181a4c,'request\x20sent',JSON['stringify'](_0x431b12));if(_0x431b12[_0x5517('0x10')]){if(_0x431b12[_0x5517('0x10')]['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x181a4c,_0x431b12[_0x5517('0x10')][_0x5517('0x11')]);return _0x5a2903(_0x431b12[_0x5517('0x10')][_0x5517('0x11')]);}logger[_0x5517('0x10')](_0x5517('0xe'),_0x181a4c,_0x431b12[_0x5517('0x10')]['message']);return _0xac329f(_0x431b12['error'][_0x5517('0x11')]);}else{logger[_0x5517('0xd')](_0x5517('0xe'),_0x181a4c,_0x5517('0x12'));_0xac329f(_0x431b12[_0x5517('0x13')][_0x5517('0x11')]);}})['catch'](function(_0x53e191){logger[_0x5517('0x10')](_0x5517('0xe'),_0x181a4c,_0x53e191);_0x5a2903(_0x53e191);});});}exports[_0x5517('0x14')]=function(_0x38f87c){var _0x516884=this;return new Promise(function(_0x347422,_0x34c969){return db[_0x5517('0x15')][_0x5517('0x16')]({'raw':_0x38f87c[_0x5517('0x17')]?_0x38f87c['options'][_0x5517('0x18')]===undefined?!![]:![]:!![],'where':_0x38f87c['options']?_0x38f87c['options']['where']||null:null,'attributes':_0x38f87c[_0x5517('0x17')]?_0x38f87c['options'][_0x5517('0x19')]||null:null,'limit':_0x38f87c[_0x5517('0x17')]?_0x38f87c[_0x5517('0x17')][_0x5517('0x1a')]||null:null,'include':_0x38f87c[_0x5517('0x17')]?_0x38f87c[_0x5517('0x17')]['include']?_['map'](_0x38f87c[_0x5517('0x17')][_0x5517('0x1b')],function(_0x3275dc){return{'model':db[_0x3275dc[_0x5517('0x1c')]],'as':_0x3275dc['as'],'attributes':_0x3275dc['attributes'],'include':_0x3275dc['include']?_['map'](_0x3275dc[_0x5517('0x1b')],function(_0x4d820d){return{'model':db[_0x4d820d['model']],'as':_0x4d820d['as'],'attributes':_0x4d820d['attributes'],'include':_0x4d820d[_0x5517('0x1b')]?_[_0x5517('0x1d')](_0x4d820d[_0x5517('0x1b')],function(_0x496d49){return{'model':db[_0x496d49[_0x5517('0x1c')]],'as':_0x496d49['as'],'attributes':_0x496d49[_0x5517('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252aa0){logger[_0x5517('0xd')](_0x5517('0x14'),_0x38f87c);logger[_0x5517('0x1e')](_0x5517('0x14'),_0x38f87c,JSON[_0x5517('0x1f')](_0x252aa0));_0x347422(_0x252aa0);})['catch'](function(_0x4df52a){logger['error'](_0x5517('0x14'),_0x4df52a[_0x5517('0x11')],_0x38f87c);_0x34c969(_0x516884[_0x5517('0x10')](0x1f4,_0x4df52a[_0x5517('0x11')]));});});};exports[_0x5517('0x20')]=function(_0x118c89){var _0x2de361=this;return new Promise(function(_0xcaa65a,_0x15afd7){return db[_0x5517('0x15')]['update'](_0x118c89[_0x5517('0x21')],{'raw':_0x118c89[_0x5517('0x17')]?_0x118c89['options'][_0x5517('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118c89[_0x5517('0x17')]?_0x118c89['options'][_0x5517('0x22')]||null:null,'attributes':_0x118c89['options']?_0x118c89[_0x5517('0x17')][_0x5517('0x19')]||null:null,'limit':_0x118c89[_0x5517('0x17')]?_0x118c89[_0x5517('0x17')][_0x5517('0x1a')]||null:null})[_0x5517('0xc')](function(_0x1b667d){logger[_0x5517('0xd')](_0x5517('0x20'),_0x118c89);logger['debug'](_0x5517('0x20'),_0x118c89,JSON[_0x5517('0x1f')](_0x1b667d));_0xcaa65a(_0x1b667d);})['catch'](function(_0x349ac0){logger[_0x5517('0x10')]('UpdateCmHopperBlack',_0x349ac0[_0x5517('0x11')],_0x118c89);_0x15afd7(_0x2de361[_0x5517('0x10')](0x1f4,_0x349ac0['message']));});});};exports['DestroyCmHopperBlack']=function(_0x59b9b6){var _0x17b4ff=this;return new Promise(function(_0x4afe5a,_0x43e691){return db[_0x5517('0x15')][_0x5517('0x23')]({'where':_0x59b9b6[_0x5517('0x17')]?_0x59b9b6['options'][_0x5517('0x22')]||null:null})[_0x5517('0xc')](function(_0xcd397c){logger[_0x5517('0xd')](_0x5517('0x24'),_0x59b9b6);logger[_0x5517('0x1e')](_0x5517('0x24'),_0x59b9b6,JSON['stringify'](_0xcd397c));_0x4afe5a(_0xcd397c);})[_0x5517('0x25')](function(_0x32fec2){logger['error'](_0x5517('0x24'),_0x32fec2['message'],_0x59b9b6);_0x43e691(_0x17b4ff[_0x5517('0x10')](0x1f4,_0x32fec2[_0x5517('0x11')]));});});}; \ No newline at end of file +var _0x8a81=['UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','catch','update','body'];(function(_0xdfa934,_0x44cf3b){var _0xd3964b=function(_0x1a04a5){while(--_0x1a04a5){_0xdfa934['push'](_0xdfa934['shift']());}};_0xd3964b(++_0x44cf3b);}(_0x8a81,0x175));var _0x18a8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8a81[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x18a8('0x0'));var util=require(_0x18a8('0x1'));var moment=require('moment');var BPromise=require(_0x18a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18a8('0x3'));var db=require(_0x18a8('0x4'))['db'];var utils=require(_0x18a8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x18a8('0x6'));var jayson=require(_0x18a8('0x7'));var client=jayson[_0x18a8('0x8')][_0x18a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45db18,_0x3f94ca,_0x259a45){return new BPromise(function(_0x5a41db,_0x4bec1b){return client[_0x18a8('0xa')](_0x45db18,_0x259a45)[_0x18a8('0xb')](function(_0x4c997f){logger[_0x18a8('0xc')](_0x18a8('0xd'),_0x3f94ca,_0x18a8('0xe'));logger[_0x18a8('0xf')](_0x18a8('0x10'),_0x3f94ca,_0x18a8('0xe'),JSON[_0x18a8('0x11')](_0x4c997f));if(_0x4c997f['error']){if(_0x4c997f['error']['code']===0x1f4){logger[_0x18a8('0x12')](_0x18a8('0xd'),_0x3f94ca,_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);return _0x4bec1b(_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);}logger[_0x18a8('0x12')](_0x18a8('0xd'),_0x3f94ca,_0x4c997f['error'][_0x18a8('0x13')]);return _0x5a41db(_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3f94ca,'request\x20sent');_0x5a41db(_0x4c997f[_0x18a8('0x14')][_0x18a8('0x13')]);}})['catch'](function(_0x530113){logger[_0x18a8('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3f94ca,_0x530113);_0x4bec1b(_0x530113);});});}exports[_0x18a8('0x15')]=function(_0x7bc251){var _0x3a3048=this;return new Promise(function(_0x1ac5db,_0x13e146){return db[_0x18a8('0x16')]['findAll']({'raw':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x18')]===undefined?!![]:![]:!![],'where':_0x7bc251[_0x18a8('0x17')]?_0x7bc251['options'][_0x18a8('0x19')]||null:null,'attributes':_0x7bc251[_0x18a8('0x17')]?_0x7bc251['options'][_0x18a8('0x1a')]||null:null,'limit':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1b')]||null:null,'include':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1c')]?_[_0x18a8('0x1d')](_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1c')],function(_0x3a0648){return{'model':db[_0x3a0648['model']],'as':_0x3a0648['as'],'attributes':_0x3a0648['attributes'],'include':_0x3a0648[_0x18a8('0x1c')]?_[_0x18a8('0x1d')](_0x3a0648[_0x18a8('0x1c')],function(_0x389dd6){return{'model':db[_0x389dd6[_0x18a8('0x1e')]],'as':_0x389dd6['as'],'attributes':_0x389dd6[_0x18a8('0x1a')],'include':_0x389dd6['include']?_['map'](_0x389dd6[_0x18a8('0x1c')],function(_0x2e6c1d){return{'model':db[_0x2e6c1d[_0x18a8('0x1e')]],'as':_0x2e6c1d['as'],'attributes':_0x2e6c1d[_0x18a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x18a8('0xb')](function(_0x4edc73){logger[_0x18a8('0xc')](_0x18a8('0x15'),_0x7bc251);logger[_0x18a8('0xf')]('GetCmHopperBlack',_0x7bc251,JSON[_0x18a8('0x11')](_0x4edc73));_0x1ac5db(_0x4edc73);})[_0x18a8('0x1f')](function(_0x5534b7){logger[_0x18a8('0x12')](_0x18a8('0x15'),_0x5534b7[_0x18a8('0x13')],_0x7bc251);_0x13e146(_0x3a3048[_0x18a8('0x12')](0x1f4,_0x5534b7[_0x18a8('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x345471){var _0x3739ba=this;return new Promise(function(_0x45404b,_0x441b9c){return db[_0x18a8('0x16')][_0x18a8('0x20')](_0x345471[_0x18a8('0x21')],{'raw':_0x345471[_0x18a8('0x17')]?_0x345471['options'][_0x18a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345471['options']?_0x345471[_0x18a8('0x17')][_0x18a8('0x19')]||null:null,'attributes':_0x345471[_0x18a8('0x17')]?_0x345471[_0x18a8('0x17')][_0x18a8('0x1a')]||null:null,'limit':_0x345471[_0x18a8('0x17')]?_0x345471[_0x18a8('0x17')][_0x18a8('0x1b')]||null:null})['then'](function(_0x2b2cb6){logger[_0x18a8('0xc')](_0x18a8('0x22'),_0x345471);logger[_0x18a8('0xf')](_0x18a8('0x22'),_0x345471,JSON['stringify'](_0x2b2cb6));_0x45404b(_0x2b2cb6);})[_0x18a8('0x1f')](function(_0x73cce8){logger['error'](_0x18a8('0x22'),_0x73cce8[_0x18a8('0x13')],_0x345471);_0x441b9c(_0x3739ba['error'](0x1f4,_0x73cce8[_0x18a8('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3d14b2){var _0xa4b151=this;return new Promise(function(_0x5c74ab,_0x36d331){return db[_0x18a8('0x16')][_0x18a8('0x23')]({'where':_0x3d14b2[_0x18a8('0x17')]?_0x3d14b2[_0x18a8('0x17')][_0x18a8('0x19')]||null:null})['then'](function(_0x159601){logger[_0x18a8('0xc')](_0x18a8('0x24'),_0x3d14b2);logger['debug']('DestroyCmHopperBlack',_0x3d14b2,JSON[_0x18a8('0x11')](_0x159601));_0x5c74ab(_0x159601);})[_0x18a8('0x1f')](function(_0x22e333){logger[_0x18a8('0x12')](_0x18a8('0x24'),_0x22e333[_0x18a8('0x13')],_0x3d14b2);_0x36d331(_0xa4b151[_0x18a8('0x12')](0x1f4,_0x22e333['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 322a221..f3258f4 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7860f6,_0x3c20a4){var _0x4bef84=function(_0x52749f){while(--_0x52749f){_0x7860f6['push'](_0x7860f6['shift']());}};_0x4bef84(++_0x3c20a4);}(_0x90b1,0x1bb));var _0x190b=function(_0x1bce53,_0x252ee8){_0x1bce53=_0x1bce53-0x0;var _0x3b13b1=_0x90b1[_0x1bce53];return _0x3b13b1;};'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('./cmHopperBlack.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')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c7535f1..c14a0d4 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 _0xad59=['STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad59,0x147));var _0x9ad5=function(_0x1f2c3f,_0x123539){_0x1f2c3f=_0x1f2c3f-0x0;var _0x4c4bea=_0xad59[_0x1f2c3f];return _0x4c4bea;};'use strict';var Sequelize=require(_0x9ad5('0x0'));var moment=require(_0x9ad5('0x1'));module['exports']={'state':{'type':Sequelize[_0x9ad5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9ad5('0x3')]},'scheduledat':{'type':Sequelize[_0x9ad5('0x4')]},'countbusyretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9ad5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9ad5('0x3')]},'calleridnum':{'type':Sequelize[_0x9ad5('0x3')]},'calleridname':{'type':Sequelize[_0x9ad5('0x3')]},'starttime':{'type':Sequelize[_0x9ad5('0x4')]},'responsetime':{'type':Sequelize[_0x9ad5('0x4')]},'answertime':{'type':Sequelize[_0x9ad5('0x4')]},'droptime':{'type':Sequelize[_0x9ad5('0x4')]},'endtime':{'type':Sequelize[_0x9ad5('0x4')]},'ringtime':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9ad5('0x3')]},'campaign':{'type':Sequelize[_0x9ad5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9ad5('0x3')]},'reason':{'type':Sequelize[_0x9ad5('0x3')]},'disposition':{'type':Sequelize[_0x9ad5('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9ad5('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x572f4d){var _0x475265=this[_0x9ad5('0x5')]('endtime');if(_0x475265&&_0x572f4d){this[_0x9ad5('0x6')](_0x9ad5('0x7'),moment(_0x572f4d)[_0x9ad5('0x8')](moment(_0x475265),_0x9ad5('0x9')));}}},'amd':{'type':Sequelize[_0x9ad5('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9ad5('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9ad5('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x9ad5('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9ad5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9ad5('0x4')]},'deleted':{'type':Sequelize[_0x9ad5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9ad5('0x4')]},'recallme':{'type':Sequelize[_0x9ad5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9ad5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9ad5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc9ff=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xc9ff,0x197));var _0xfc9f=function(_0x434562,_0x56b240){_0x434562=_0x434562-0x0;var _0x234e13=_0xc9ff[_0x434562];return _0x234e13;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfc9f('0x0'));module[_0xfc9f('0x1')]={'state':{'type':Sequelize[_0xfc9f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfc9f('0x3')]},'scheduledat':{'type':Sequelize[_0xfc9f('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc9f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xfc9f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc9f('0x3')]},'calleridname':{'type':Sequelize[_0xfc9f('0x3')]},'starttime':{'type':Sequelize[_0xfc9f('0x4')]},'responsetime':{'type':Sequelize[_0xfc9f('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xfc9f('0x4')]},'endtime':{'type':Sequelize[_0xfc9f('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc9f('0x3')]},'campaign':{'type':Sequelize[_0xfc9f('0x3')]},'campaigntype':{'type':Sequelize[_0xfc9f('0x3')]},'membername':{'type':Sequelize[_0xfc9f('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xfc9f('0x3')]},'secondDisposition':{'type':Sequelize[_0xfc9f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfc9f('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x191026){var _0x145630=this[_0xfc9f('0x5')](_0xfc9f('0x6'));if(_0x145630&&_0x191026){this[_0xfc9f('0x7')](_0xfc9f('0x8'),moment(_0x191026)[_0xfc9f('0x9')](moment(_0x145630),'seconds'));}}},'amd':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfc9f('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc9f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfc9f('0x4')]},'recallme':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfc9f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 7072935..581b761 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 _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xfdbd[_0x251d9c];return _0x16ae64;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file +var _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','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','../../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','CmHopperFinal','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','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x2b0267,_0x59cab1){var _0x289a4a=function(_0x3ec45c){while(--_0x3ec45c){_0x2b0267['push'](_0x2b0267['shift']());}};_0x289a4a(++_0x59cab1);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'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')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6b45dec..449da26 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 _0x8d62=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','uniqueid'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x8d62,0x1b0));var _0x28d6=function(_0x43da1a,_0x484791){_0x43da1a=_0x43da1a-0x0;var _0x4472b5=_0x8d62[_0x43da1a];return _0x4472b5;};'use strict';var _=require(_0x28d6('0x0'));var util=require('util');var logger=require(_0x28d6('0x1'))('api');var moment=require(_0x28d6('0x2'));var BPromise=require(_0x28d6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28d6('0x4'));var config=require(_0x28d6('0x5'));var attributes=require(_0x28d6('0x6'));module[_0x28d6('0x7')]=function(_0x70e370,_0x4289e2){return _0x70e370[_0x28d6('0x8')](_0x28d6('0x9'),attributes,{'tableName':_0x28d6('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x28d6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x962e=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x43c001,_0x5a4fed){var _0x2741e7=function(_0xd61a0f){while(--_0xd61a0f){_0x43c001['push'](_0x43c001['shift']());}};_0x2741e7(++_0x5a4fed);}(_0x962e,0x1bd));var _0xe962=function(_0x2958f8,_0x1b8fda){_0x2958f8=_0x2958f8-0x0;var _0x1a02c0=_0x962e[_0x2958f8];return _0x1a02c0;};'use strict';var _=require(_0xe962('0x0'));var util=require(_0xe962('0x1'));var logger=require(_0xe962('0x2'))(_0xe962('0x3'));var moment=require('moment');var BPromise=require(_0xe962('0x4'));var rp=require(_0xe962('0x5'));var fs=require('fs');var path=require(_0xe962('0x6'));var rimraf=require(_0xe962('0x7'));var config=require(_0xe962('0x8'));var attributes=require(_0xe962('0x9'));module[_0xe962('0xa')]=function(_0x5d81d3,_0x843055){return _0x5d81d3[_0xe962('0xb')](_0xe962('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe962('0xd'),'fields':[_0xe962('0xd')]},{'name':_0xe962('0xe'),'fields':[_0xe962('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 544b988..8c2574d 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(_0x263a1c,_0x30bb36){var _0x208a8c=function(_0x45b58e){while(--_0x45b58e){_0x263a1c['push'](_0x263a1c['shift']());}};_0x208a8c(++_0x30bb36);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e890e,_0x1a22b7){_0x2e890e=_0x2e890e-0x0;var _0x5d2b7f=_0xb10b[_0x2e890e];return _0x5d2b7f;};'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(_0x559294,_0x37aa97){var _0x52d0d2=function(_0x1b4ef1){while(--_0x1b4ef1){_0x559294['push'](_0x559294['shift']());}};_0x52d0d2(++_0x37aa97);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xb10b[_0x4c1ec2];return _0x3f6f1c;};'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 029b005..2904153 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 _0x1c9a=['checkContactHopper','put','/:id','update','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x5af4a8,_0x13d4f9){var _0x701503=function(_0x49b42a){while(--_0x49b42a){_0x5af4a8['push'](_0x5af4a8['shift']());}};_0x701503(++_0x13d4f9);}(_0x1c9a,0x124));var _0xa1c9=function(_0x495751,_0x557c6a){_0x495751=_0x495751-0x0;var _0xd8a818=_0x1c9a[_0x495751];return _0xd8a818;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var fs_extra=require(_0xa1c9('0x4'));var auth=require(_0xa1c9('0x5'));var interaction=require(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var controller=require(_0xa1c9('0x8'));router[_0xa1c9('0x9')]('/',auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xb')]);router['get'](_0xa1c9('0xc'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xd')]);router[_0xa1c9('0x9')]('/:id',auth[_0xa1c9('0xa')](),controller['show']);router[_0xa1c9('0x9')](_0xa1c9('0xe'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xf')]);router[_0xa1c9('0x9')](_0xa1c9('0x10'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')](_0xa1c9('0x13'),auth[_0xa1c9('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa1c9('0x12')]('/checkContactHopper',auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x14')]);router[_0xa1c9('0x15')](_0xa1c9('0x16'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0e56=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','put','update','multer','util','connect-timeout','express','fs-extra'];(function(_0x35fc69,_0x5782b3){var _0x512adf=function(_0x450820){while(--_0x450820){_0x35fc69['push'](_0x35fc69['shift']());}};_0x512adf(++_0x5782b3);}(_0x0e56,0xf5));var _0x60e5=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0x0e56[_0x19c5f2];return _0xb94caf;};'use strict';var multer=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var path=require('path');var timeout=require(_0x60e5('0x2'));var express=require(_0x60e5('0x3'));var router=express['Router']();var fs_extra=require(_0x60e5('0x4'));var auth=require(_0x60e5('0x5'));var interaction=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var controller=require(_0x60e5('0x8'));router[_0x60e5('0x9')]('/',auth[_0x60e5('0xa')](),controller['index']);router[_0x60e5('0x9')](_0x60e5('0xb'),auth[_0x60e5('0xa')](),controller[_0x60e5('0xc')]);router['get'](_0x60e5('0xd'),auth[_0x60e5('0xa')](),controller[_0x60e5('0xe')]);router[_0x60e5('0x9')](_0x60e5('0xf'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x10')]);router[_0x60e5('0x9')](_0x60e5('0x11'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x12')]);router[_0x60e5('0x13')](_0x60e5('0x14'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x15')]);router[_0x60e5('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x60e5('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x60e5('0x16'),auth[_0x60e5('0xa')](),controller['checkContactHopper']);router[_0x60e5('0x17')](_0x60e5('0xd'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2b89f87..7efcaf9 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 _0x018f=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x409bbc,_0x28b837){var _0x37deac=function(_0x31c2e3){while(--_0x31c2e3){_0x409bbc['push'](_0x409bbc['shift']());}};_0x37deac(++_0x28b837);}(_0x018f,0x93));var _0xf018=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x018f[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require(_0xf018('0x0'));module[_0xf018('0x1')]={'state':{'type':Sequelize[_0xf018('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf018('0x3')]},'scheduledat':{'type':Sequelize[_0xf018('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf018('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf018('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf018('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf018('0x3')]},'starttime':{'type':Sequelize[_0xf018('0x4')]},'responsetime':{'type':Sequelize[_0xf018('0x4')]},'answertime':{'type':Sequelize[_0xf018('0x4')]},'droptime':{'type':Sequelize[_0xf018('0x4')]},'endtime':{'type':Sequelize[_0xf018('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf018('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf018('0x3')]},'membername':{'type':Sequelize[_0xf018('0x3')]},'reason':{'type':Sequelize[_0xf018('0x3')]},'amd':{'type':Sequelize[_0xf018('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf018('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf018('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf018('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf018('0x4')]},'edited':{'type':Sequelize[_0xf018('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf018('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x336c=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x2f2007,_0x2cb278){var _0xab1349=function(_0x5742e3){while(--_0x5742e3){_0x2f2007['push'](_0x2f2007['shift']());}};_0xab1349(++_0x2cb278);}(_0x336c,0xa8));var _0xc336=function(_0x167c64,_0x5ba840){_0x167c64=_0x167c64-0x0;var _0x5b63ba=_0x336c[_0x167c64];return _0x5b63ba;};'use strict';var Sequelize=require('sequelize');module[_0xc336('0x0')]={'state':{'type':Sequelize[_0xc336('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc336('0x2')]},'scheduledat':{'type':Sequelize[_0xc336('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc336('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc336('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc336('0x2')]},'calleridnum':{'type':Sequelize[_0xc336('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc336('0x3')]},'responsetime':{'type':Sequelize[_0xc336('0x3')]},'answertime':{'type':Sequelize[_0xc336('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc336('0x3')]},'ringtime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc336('0x2')]},'campaign':{'type':Sequelize[_0xc336('0x2')]},'campaigntype':{'type':Sequelize[_0xc336('0x2')]},'membername':{'type':Sequelize[_0xc336('0x2')]},'reason':{'type':Sequelize[_0xc336('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc336('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc336('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc336('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 30dd029..1383306 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 _0x676f=['reject','save','update','then','destroy','sendStatus','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','catch','params','keys','length','options','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','set','Content-Range','json'];(function(_0x1c0998,_0x21d2dd){var _0x4de355=function(_0x29f17d){while(--_0x29f17d){_0x1c0998['push'](_0x1c0998['shift']());}};_0x4de355(++_0x21d2dd);}(_0x676f,0x1ac));var _0xf676=function(_0x5d7d20,_0x26bccd){_0x5d7d20=_0x5d7d20-0x0;var _0x4b08d9=_0x676f[_0x5d7d20];return _0x4b08d9;};'use strict';var emlformat=require(_0xf676('0x0'));var rimraf=require(_0xf676('0x1'));var zipdir=require(_0xf676('0x2'));var jsonpatch=require(_0xf676('0x3'));var rp=require(_0xf676('0x4'));var moment=require('moment');var BPromise=require(_0xf676('0x5'));var Mustache=require(_0xf676('0x6'));var util=require('util');var path=require(_0xf676('0x7'));var sox=require('sox');var csv=require(_0xf676('0x8'));var ejs=require(_0xf676('0x9'));var fs=require('fs');var fs_extra=require(_0xf676('0xa'));var _=require('lodash');var squel=require(_0xf676('0xb'));var crypto=require(_0xf676('0xc'));var jsforce=require(_0xf676('0xd'));var deskjs=require(_0xf676('0xe'));var toCsv=require(_0xf676('0x8'));var querystring=require(_0xf676('0xf'));var Papa=require(_0xf676('0x10'));var Redis=require(_0xf676('0x11'));var authService=require(_0xf676('0x12'));var qs=require(_0xf676('0x13'));var as=require(_0xf676('0x14'));var hardwareService=require(_0xf676('0x15'));var logger=require('../../config/logger')(_0xf676('0x16'));var utils=require(_0xf676('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf676('0x18'));var db=require(_0xf676('0x19'))['db'];function respondWithStatusCode(_0x2963c1,_0x3ec69a){_0x3ec69a=_0x3ec69a||0xcc;return function(_0xde27f8){if(_0xde27f8){return _0x2963c1['sendStatus'](_0x3ec69a);}return _0x2963c1['status'](_0x3ec69a)[_0xf676('0x1a')]();};}function respondWithResult(_0x64d16d,_0x579fec){_0x579fec=_0x579fec||0xc8;return function(_0x399f5a){if(_0x399f5a){return _0x64d16d[_0xf676('0x1b')](_0x579fec)['json'](_0x399f5a);}};}function respondWithFilteredResult(_0xf44829,_0x4f336f){return function(_0x174d45){if(_0x174d45){var _0x35ec72=typeof _0x4f336f[_0xf676('0x1c')]===_0xf676('0x1d')&&typeof _0x4f336f[_0xf676('0x1e')]===_0xf676('0x1d');var _0xd56d01=_0x174d45['count'];var _0x2e726a=_0x35ec72?0x0:_0x4f336f['offset'];var _0x5dc544=_0x35ec72?_0x174d45['count']:_0x4f336f[_0xf676('0x1c')]+_0x4f336f[_0xf676('0x1e')];var _0x551f5c;if(_0x5dc544>=_0xd56d01){_0x5dc544=_0xd56d01;_0x551f5c=0xc8;}else{_0x551f5c=0xce;}_0xf44829[_0xf676('0x1b')](_0x551f5c);return _0xf44829[_0xf676('0x1f')](_0xf676('0x20'),_0x2e726a+'-'+_0x5dc544+'/'+_0xd56d01)[_0xf676('0x21')](_0x174d45);}return null;};}function patchUpdates(_0x141501){return function(_0x53d760){try{jsonpatch['apply'](_0x53d760,_0x141501,!![]);}catch(_0x18ff7f){return BPromise[_0xf676('0x22')](_0x18ff7f);}return _0x53d760[_0xf676('0x23')]();};}function saveUpdates(_0xc12488,_0x51ec84){return function(_0x39dcb2){if(_0x39dcb2){return _0x39dcb2[_0xf676('0x24')](_0xc12488)[_0xf676('0x25')](function(_0xc01dc2){return _0xc01dc2;});}return null;};}function removeEntity(_0x10f555,_0x52d1d0){return function(_0x50f666){if(_0x50f666){return _0x50f666[_0xf676('0x26')]()[_0xf676('0x25')](function(){_0x10f555[_0xf676('0x1b')](0xcc)[_0xf676('0x1a')]();});}};}function handleEntityNotFound(_0x115368,_0x2ace46){return function(_0x621ef2){if(!_0x621ef2){_0x115368[_0xf676('0x27')](0x194);}return _0x621ef2;};}function handleError(_0x5eb521,_0x207a0f){_0x207a0f=_0x207a0f||0x1f4;return function(_0x19ac33){logger['error'](_0x19ac33[_0xf676('0x28')]);if(_0x19ac33[_0xf676('0x29')]){delete _0x19ac33['name'];}_0x5eb521[_0xf676('0x1b')](_0x207a0f)['send'](_0x19ac33);};}exports[_0xf676('0x2a')]=function(_0x116883,_0x5b6663){var _0x1762ad={},_0xcee79b={},_0x55c0b9={'count':0x0,'rows':[]};var _0x1c3607=_[_0xf676('0x2b')](db[_0xf676('0x2c')][_0xf676('0x2d')],function(_0x4e0c37){return{'name':_0x4e0c37[_0xf676('0x2e')],'type':_0x4e0c37[_0xf676('0x2f')][_0xf676('0x30')]};});_0xcee79b[_0xf676('0x31')]=_['map'](_0x1c3607,'name');_0xcee79b['query']=_['keys'](_0x116883[_0xf676('0x32')]);_0xcee79b[_0xf676('0x33')]=_[_0xf676('0x34')](_0xcee79b[_0xf676('0x31')],_0xcee79b[_0xf676('0x32')]);_0x1762ad[_0xf676('0x35')]=_[_0xf676('0x34')](_0xcee79b[_0xf676('0x31')],qs[_0xf676('0x36')](_0x116883[_0xf676('0x32')][_0xf676('0x36')]));_0x1762ad[_0xf676('0x35')]=_0x1762ad[_0xf676('0x35')]['length']?_0x1762ad[_0xf676('0x35')]:_0xcee79b[_0xf676('0x31')];if(!_0x116883[_0xf676('0x32')][_0xf676('0x37')](_0xf676('0x38'))){_0x1762ad[_0xf676('0x1e')]=qs[_0xf676('0x1e')](_0x116883['query'][_0xf676('0x1e')]);_0x1762ad[_0xf676('0x1c')]=qs[_0xf676('0x1c')](_0x116883[_0xf676('0x32')][_0xf676('0x1c')]);}_0x1762ad[_0xf676('0x39')]=qs[_0xf676('0x3a')](_0x116883['query']['sort']);_0x1762ad[_0xf676('0x3b')]=qs['filters'](_[_0xf676('0x3c')](_0x116883[_0xf676('0x32')],_0xcee79b[_0xf676('0x33')]),_0x1c3607);if(_0x116883[_0xf676('0x32')][_0xf676('0x3d')]){_0x1762ad['where']=_['merge'](_0x1762ad['where'],{'$or':_[_0xf676('0x2b')](_0x1c3607,function(_0x189ba7){if(_0x189ba7[_0xf676('0x2f')]!==_0xf676('0x3e')){var _0x409d62={};_0x409d62[_0x189ba7['name']]={'$like':'%'+_0x116883[_0xf676('0x32')][_0xf676('0x3d')]+'%'};return _0x409d62;}})});}_0x1762ad=_[_0xf676('0x3f')]({},_0x1762ad,_0x116883['options']);var _0x12b7db={'where':_0x1762ad[_0xf676('0x3b')]};return db[_0xf676('0x2c')][_0xf676('0x40')](_0x12b7db)['then'](function(_0x25eedb){_0x55c0b9['count']=_0x25eedb;if(_0x116883[_0xf676('0x32')][_0xf676('0x41')]){_0x1762ad[_0xf676('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1762ad);})[_0xf676('0x25')](function(_0x413627){_0x55c0b9['rows']=_0x413627;return _0x55c0b9;})[_0xf676('0x25')](respondWithFilteredResult(_0x5b6663,_0x1762ad))[_0xf676('0x43')](handleError(_0x5b6663,null));};exports['show']=function(_0x143b4e,_0x28f6db){var _0x1c5b30={'raw':!![],'where':{'id':_0x143b4e[_0xf676('0x44')]['id']}},_0x51f695={};_0x51f695[_0xf676('0x31')]=_[_0xf676('0x45')](db[_0xf676('0x2c')][_0xf676('0x2d')]);_0x51f695[_0xf676('0x32')]=_['keys'](_0x143b4e[_0xf676('0x32')]);_0x51f695[_0xf676('0x33')]=_[_0xf676('0x34')](_0x51f695['model'],_0x51f695[_0xf676('0x32')]);_0x1c5b30[_0xf676('0x35')]=_['intersection'](_0x51f695['model'],qs[_0xf676('0x36')](_0x143b4e[_0xf676('0x32')][_0xf676('0x36')]));_0x1c5b30[_0xf676('0x35')]=_0x1c5b30['attributes'][_0xf676('0x46')]?_0x1c5b30[_0xf676('0x35')]:_0x51f695[_0xf676('0x31')];if(_0x143b4e['query'][_0xf676('0x41')]){_0x1c5b30['include']=[{'all':!![]}];}_0x1c5b30=_[_0xf676('0x3f')]({},_0x1c5b30,_0x143b4e[_0xf676('0x47')]);return db[_0xf676('0x2c')]['find'](_0x1c5b30)['then'](handleEntityNotFound(_0x28f6db,null))[_0xf676('0x25')](respondWithResult(_0x28f6db,null))[_0xf676('0x43')](handleError(_0x28f6db,null));};exports[_0xf676('0x48')]=function(_0x2710d3,_0x1f53e7){return db[_0xf676('0x2c')][_0xf676('0x48')](_0x2710d3[_0xf676('0x49')],{})[_0xf676('0x25')](respondWithResult(_0x1f53e7,0xc9))[_0xf676('0x43')](handleError(_0x1f53e7,null));};exports[_0xf676('0x4a')]=function(_0xdc52ed,_0x515ff9){return db[_0xf676('0x2c')][_0xf676('0x4a')]()[_0xf676('0x25')](respondWithResult(_0x515ff9,null))[_0xf676('0x43')](handleError(_0x515ff9,null));};exports[_0xf676('0x24')]=function(_0x143ae2,_0x59bc75){if(_0x143ae2[_0xf676('0x49')][_0xf676('0x4b')]){delete _0x143ae2[_0xf676('0x49')][_0xf676('0x4b')];}return db[_0xf676('0x2c')][_0xf676('0x4c')]({'where':{'uniqueid':_0x143ae2[_0xf676('0x44')]['id']}})['then'](handleEntityNotFound(_0x59bc75,null))[_0xf676('0x25')](saveUpdates(_0x143ae2[_0xf676('0x49')],null))[_0xf676('0x25')](respondWithResult(_0x59bc75,null))[_0xf676('0x43')](handleError(_0x59bc75,null));}; \ No newline at end of file +var _0x2e77=['apply','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','options','CmHopperHistory','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','uniqueid','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','set','Content-Range'];(function(_0x403fdc,_0x5be07c){var _0xa635c4=function(_0x2e5d0d){while(--_0x2e5d0d){_0x403fdc['push'](_0x403fdc['shift']());}};_0xa635c4(++_0x5be07c);}(_0x2e77,0x19e));var _0x72e7=function(_0x570523,_0x2a850c){_0x570523=_0x570523-0x0;var _0x5f5ce4=_0x2e77[_0x570523];return _0x5f5ce4;};'use strict';var emlformat=require(_0x72e7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72e7('0x1'));var BPromise=require(_0x72e7('0x2'));var Mustache=require(_0x72e7('0x3'));var util=require(_0x72e7('0x4'));var path=require(_0x72e7('0x5'));var sox=require(_0x72e7('0x6'));var csv=require(_0x72e7('0x7'));var ejs=require(_0x72e7('0x8'));var fs=require('fs');var fs_extra=require(_0x72e7('0x9'));var _=require(_0x72e7('0xa'));var squel=require(_0x72e7('0xb'));var crypto=require(_0x72e7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x72e7('0xd'));var toCsv=require(_0x72e7('0x7'));var querystring=require('querystring');var Papa=require(_0x72e7('0xe'));var Redis=require(_0x72e7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72e7('0x10'));var logger=require(_0x72e7('0x11'))(_0x72e7('0x12'));var utils=require('../../config/utils');var config=require(_0x72e7('0x13'));var licenseUtil=require(_0x72e7('0x14'));var db=require(_0x72e7('0x15'))['db'];function respondWithStatusCode(_0x3250e2,_0x4ba272){_0x4ba272=_0x4ba272||0xcc;return function(_0x1b1444){if(_0x1b1444){return _0x3250e2[_0x72e7('0x16')](_0x4ba272);}return _0x3250e2[_0x72e7('0x17')](_0x4ba272)['end']();};}function respondWithResult(_0x2a7685,_0x1e2dac){_0x1e2dac=_0x1e2dac||0xc8;return function(_0x5a31c1){if(_0x5a31c1){return _0x2a7685[_0x72e7('0x17')](_0x1e2dac)[_0x72e7('0x18')](_0x5a31c1);}};}function respondWithFilteredResult(_0x185daa,_0x198a0e){return function(_0x13205b){if(_0x13205b){var _0x4a6328=typeof _0x198a0e['offset']==='undefined'&&typeof _0x198a0e[_0x72e7('0x19')]===_0x72e7('0x1a');var _0x372db8=_0x13205b[_0x72e7('0x1b')];var _0x358b95=_0x4a6328?0x0:_0x198a0e['offset'];var _0x2fba37=_0x4a6328?_0x13205b['count']:_0x198a0e['offset']+_0x198a0e[_0x72e7('0x19')];var _0x5059bf;if(_0x2fba37>=_0x372db8){_0x2fba37=_0x372db8;_0x5059bf=0xc8;}else{_0x5059bf=0xce;}_0x185daa[_0x72e7('0x17')](_0x5059bf);return _0x185daa[_0x72e7('0x1c')](_0x72e7('0x1d'),_0x358b95+'-'+_0x2fba37+'/'+_0x372db8)[_0x72e7('0x18')](_0x13205b);}return null;};}function patchUpdates(_0x5e82b8){return function(_0x570943){try{jsonpatch[_0x72e7('0x1e')](_0x570943,_0x5e82b8,!![]);}catch(_0x3e37a7){return BPromise[_0x72e7('0x1f')](_0x3e37a7);}return _0x570943[_0x72e7('0x20')]();};}function saveUpdates(_0x3fce7c,_0x580738){return function(_0x518984){if(_0x518984){return _0x518984[_0x72e7('0x21')](_0x3fce7c)[_0x72e7('0x22')](function(_0x1d2cd7){return _0x1d2cd7;});}return null;};}function removeEntity(_0x30c39b,_0x14dd5c){return function(_0x2219c0){if(_0x2219c0){return _0x2219c0['destroy']()[_0x72e7('0x22')](function(){_0x30c39b[_0x72e7('0x17')](0xcc)[_0x72e7('0x23')]();});}};}function handleEntityNotFound(_0x29b632,_0x2fd81e){return function(_0x450720){if(!_0x450720){_0x29b632[_0x72e7('0x16')](0x194);}return _0x450720;};}function handleError(_0x13c140,_0x531b40){_0x531b40=_0x531b40||0x1f4;return function(_0x362d1f){logger[_0x72e7('0x24')](_0x362d1f[_0x72e7('0x25')]);if(_0x362d1f[_0x72e7('0x26')]){delete _0x362d1f['name'];}_0x13c140[_0x72e7('0x17')](_0x531b40)[_0x72e7('0x27')](_0x362d1f);};}exports['index']=function(_0x10de12,_0x28065a){var _0x3af457={},_0x2a27df={},_0x4e77e8={'count':0x0,'rows':[]};var _0x52bd9d=_[_0x72e7('0x28')](db['CmHopperHistory'][_0x72e7('0x29')],function(_0x52b41c){return{'name':_0x52b41c[_0x72e7('0x2a')],'type':_0x52b41c[_0x72e7('0x2b')]['key']};});_0x2a27df[_0x72e7('0x2c')]=_[_0x72e7('0x28')](_0x52bd9d,_0x72e7('0x26'));_0x2a27df[_0x72e7('0x2d')]=_[_0x72e7('0x2e')](_0x10de12['query']);_0x2a27df[_0x72e7('0x2f')]=_[_0x72e7('0x30')](_0x2a27df[_0x72e7('0x2c')],_0x2a27df[_0x72e7('0x2d')]);_0x3af457[_0x72e7('0x31')]=_[_0x72e7('0x30')](_0x2a27df[_0x72e7('0x2c')],qs[_0x72e7('0x32')](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x32')]));_0x3af457[_0x72e7('0x31')]=_0x3af457[_0x72e7('0x31')][_0x72e7('0x33')]?_0x3af457[_0x72e7('0x31')]:_0x2a27df['model'];if(!_0x10de12['query'][_0x72e7('0x34')](_0x72e7('0x35'))){_0x3af457[_0x72e7('0x19')]=qs['limit'](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x19')]);_0x3af457[_0x72e7('0x36')]=qs[_0x72e7('0x36')](_0x10de12[_0x72e7('0x2d')]['offset']);}_0x3af457[_0x72e7('0x37')]=qs['sort'](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x38')]);_0x3af457['where']=qs[_0x72e7('0x2f')](_[_0x72e7('0x39')](_0x10de12[_0x72e7('0x2d')],_0x2a27df[_0x72e7('0x2f')]),_0x52bd9d);if(_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3a')]){_0x3af457[_0x72e7('0x3b')]=_['merge'](_0x3af457[_0x72e7('0x3b')],{'$or':_['map'](_0x52bd9d,function(_0xa76227){if(_0xa76227[_0x72e7('0x2b')]!=='VIRTUAL'){var _0x24baeb={};_0x24baeb[_0xa76227[_0x72e7('0x26')]]={'$like':'%'+_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3a')]+'%'};return _0x24baeb;}})});}_0x3af457=_['merge']({},_0x3af457,_0x10de12[_0x72e7('0x3c')]);var _0x1d49bf={'where':_0x3af457[_0x72e7('0x3b')]};return db[_0x72e7('0x3d')][_0x72e7('0x1b')](_0x1d49bf)[_0x72e7('0x22')](function(_0x258a4c){_0x4e77e8[_0x72e7('0x1b')]=_0x258a4c;if(_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3e')]){_0x3af457[_0x72e7('0x3f')]=[{'all':!![]}];}return db[_0x72e7('0x3d')][_0x72e7('0x40')](_0x3af457);})[_0x72e7('0x22')](function(_0x12df8c){_0x4e77e8[_0x72e7('0x41')]=_0x12df8c;return _0x4e77e8;})['then'](respondWithFilteredResult(_0x28065a,_0x3af457))['catch'](handleError(_0x28065a,null));};exports[_0x72e7('0x42')]=function(_0x3fdc91,_0x41dae7){var _0x410167={'raw':!![],'where':{'id':_0x3fdc91[_0x72e7('0x43')]['id']}},_0x222b16={};_0x222b16[_0x72e7('0x2c')]=_[_0x72e7('0x2e')](db[_0x72e7('0x3d')]['rawAttributes']);_0x222b16[_0x72e7('0x2d')]=_[_0x72e7('0x2e')](_0x3fdc91['query']);_0x222b16[_0x72e7('0x2f')]=_['intersection'](_0x222b16[_0x72e7('0x2c')],_0x222b16[_0x72e7('0x2d')]);_0x410167['attributes']=_['intersection'](_0x222b16['model'],qs[_0x72e7('0x32')](_0x3fdc91[_0x72e7('0x2d')][_0x72e7('0x32')]));_0x410167[_0x72e7('0x31')]=_0x410167[_0x72e7('0x31')]['length']?_0x410167[_0x72e7('0x31')]:_0x222b16[_0x72e7('0x2c')];if(_0x3fdc91['query'][_0x72e7('0x3e')]){_0x410167[_0x72e7('0x3f')]=[{'all':!![]}];}_0x410167=_[_0x72e7('0x44')]({},_0x410167,_0x3fdc91[_0x72e7('0x3c')]);return db[_0x72e7('0x3d')][_0x72e7('0x45')](_0x410167)[_0x72e7('0x22')](handleEntityNotFound(_0x41dae7,null))[_0x72e7('0x22')](respondWithResult(_0x41dae7,null))[_0x72e7('0x46')](handleError(_0x41dae7,null));};exports[_0x72e7('0x47')]=function(_0x1ea43d,_0x42d6ed){return db[_0x72e7('0x3d')]['create'](_0x1ea43d[_0x72e7('0x48')],{})[_0x72e7('0x22')](respondWithResult(_0x42d6ed,0xc9))[_0x72e7('0x46')](handleError(_0x42d6ed,null));};exports['describe']=function(_0x225cc2,_0x34d44c){return db[_0x72e7('0x3d')]['describe']()[_0x72e7('0x22')](respondWithResult(_0x34d44c,null))[_0x72e7('0x46')](handleError(_0x34d44c,null));};exports[_0x72e7('0x21')]=function(_0x232b97,_0x2802a5){if(_0x232b97['body'][_0x72e7('0x49')]){delete _0x232b97[_0x72e7('0x48')][_0x72e7('0x49')];}return db[_0x72e7('0x3d')]['find']({'where':{'uniqueid':_0x232b97[_0x72e7('0x43')]['id']}})[_0x72e7('0x22')](handleEntityNotFound(_0x2802a5,null))[_0x72e7('0x22')](saveUpdates(_0x232b97[_0x72e7('0x48')],null))[_0x72e7('0x22')](respondWithResult(_0x2802a5,null))[_0x72e7('0x46')](handleError(_0x2802a5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f700d6d..22cb54e 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 _0x77d4=['exports','define','endtime','uniqueid','util','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0x77d4,0x108));var _0x477d=function(_0x5a1613,_0x370b1b){_0x5a1613=_0x5a1613-0x0;var _0x2197d8=_0x77d4[_0x5a1613];return _0x2197d8;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));module[_0x477d('0x6')]=function(_0x471fca,_0x2545e5){return _0x471fca[_0x477d('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x477d('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x477d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf417=['../../config/logger','api','bluebird','rimraf','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util'];(function(_0x52f8e3,_0x48df79){var _0x10d6cb=function(_0x5f0814){while(--_0x5f0814){_0x52f8e3['push'](_0x52f8e3['shift']());}};_0x10d6cb(++_0x48df79);}(_0xf417,0x8f));var _0x7f41=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0xf417[_0x4ca288];return _0x2362c1;};'use strict';var _=require('lodash');var util=require(_0x7f41('0x0'));var logger=require(_0x7f41('0x1'))(_0x7f41('0x2'));var moment=require('moment');var BPromise=require(_0x7f41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f41('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5ecdb2,_0x1775d8){return _0x5ecdb2['define'](_0x7f41('0x5'),attributes,{'tableName':_0x7f41('0x6'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7f41('0x7')]},{'name':'uniqueid','fields':[_0x7f41('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cd2581d..952fbac 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 _0x76c0=['rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','message','CmHopperHistory,\x20%s,\x20%s','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76c0,0x84));var _0x076c=function(_0x22d37d,_0x21ea9b){_0x22d37d=_0x22d37d-0x0;var _0x565483=_0x76c0[_0x22d37d];return _0x565483;};'use strict';var _=require('lodash');var util=require(_0x076c('0x0'));var moment=require(_0x076c('0x1'));var BPromise=require(_0x076c('0x2'));var rs=require(_0x076c('0x3'));var fs=require('fs');var Redis=require(_0x076c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x076c('0x5'))(_0x076c('0x6'));var config=require(_0x076c('0x7'));var jayson=require(_0x076c('0x8'));var client=jayson[_0x076c('0x9')][_0x076c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb4d5cc,_0x574687,_0x51a464){return new BPromise(function(_0x4c2691,_0x2306dc){return client['request'](_0xb4d5cc,_0x51a464)[_0x076c('0xb')](function(_0x53db47){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x574687,_0x076c('0xc'));logger[_0x076c('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x574687,_0x076c('0xc'),JSON[_0x076c('0xe')](_0x53db47));if(_0x53db47[_0x076c('0xf')]){if(_0x53db47['error']['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x574687,_0x53db47[_0x076c('0xf')][_0x076c('0x10')]);return _0x2306dc(_0x53db47[_0x076c('0xf')][_0x076c('0x10')]);}logger[_0x076c('0xf')](_0x076c('0x11'),_0x574687,_0x53db47['error'][_0x076c('0x10')]);return _0x4c2691(_0x53db47[_0x076c('0xf')]['message']);}else{logger[_0x076c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x574687,_0x076c('0xc'));_0x4c2691(_0x53db47[_0x076c('0x13')][_0x076c('0x10')]);}})[_0x076c('0x14')](function(_0x2c0573){logger['error'](_0x076c('0x11'),_0x574687,_0x2c0573);_0x2306dc(_0x2c0573);});});}exports[_0x076c('0x15')]=function(_0x5e381f){var _0x51ad81=this;return new Promise(function(_0x16abb6,_0x5027fd){return db[_0x076c('0x16')][_0x076c('0x17')](_0x5e381f[_0x076c('0x18')],{'raw':_0x5e381f[_0x076c('0x19')]?_0x5e381f[_0x076c('0x19')][_0x076c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x42c4fe){logger[_0x076c('0x12')](_0x076c('0x15'),_0x5e381f);logger[_0x076c('0xd')](_0x076c('0x15'),_0x5e381f,JSON[_0x076c('0xe')](_0x42c4fe));_0x16abb6(_0x42c4fe);})[_0x076c('0x14')](function(_0x145a46){logger[_0x076c('0xf')](_0x076c('0x15'),_0x145a46[_0x076c('0x10')],_0x5e381f);_0x5027fd(_0x51ad81[_0x076c('0xf')](0x1f4,_0x145a46[_0x076c('0x10')]));});});};exports[_0x076c('0x1b')]=function(_0x3a827d){var _0x3e031c=this;return new Promise(function(_0x2969f9,_0x310b9f){return db[_0x076c('0x16')]['findAll']({'raw':_0x3a827d[_0x076c('0x19')]?_0x3a827d[_0x076c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a827d['options']?_0x3a827d['options'][_0x076c('0x1c')]||null:null,'attributes':[[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')][_0x076c('0x1e')]('id')),_0x076c('0x1f')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x22')))),_0x076c('0x23')],[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db['sequelize'][_0x076c('0x21')](_0x076c('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x25')))),_0x076c('0x26')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x27'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x076c('0x28')],[db[_0x076c('0x1d')]['fn']('AVG',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')]['literal'](_0x076c('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x076c('0xb')](function(_0x447ccf){logger[_0x076c('0x12')](_0x076c('0x1b'),_0x3a827d);logger[_0x076c('0xd')](_0x076c('0x1b'),_0x3a827d,JSON['stringify'](_0x447ccf));_0x2969f9(_0x447ccf);})[_0x076c('0x14')](function(_0x360a5c){logger[_0x076c('0xf')](_0x076c('0x1b'),_0x360a5c[_0x076c('0x10')],_0x3a827d);_0x310b9f(_0x3e031c[_0x076c('0xf')](0x1f4,_0x360a5c[_0x076c('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2032d9){var _0x142870=this;return new Promise(function(_0x5f5884,_0x51cd9a){return db[_0x076c('0x16')][_0x076c('0x2a')]({'raw':_0x2032d9[_0x076c('0x19')]?_0x2032d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x2032d9['options']?_0x2032d9[_0x076c('0x19')]['where']||null:null,'attributes':[[_0x076c('0x2b'),_0x076c('0x2c')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x076c('0x2d')))),_0x076c('0x2e')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db['sequelize'][_0x076c('0x21')](_0x076c('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x22')))),'outboundAnswerCallsDay'],[db[_0x076c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x30')))),'outboundBusyCallsDay'],[db[_0x076c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x076c('0x21')](_0x076c('0x31')))),_0x076c('0x32')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db['sequelize']['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x33')))),_0x076c('0x34')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x35')))),_0x076c('0x36')],[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')]['literal'](_0x076c('0x37')))),_0x076c('0x38')],[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x39')))),_0x076c('0x3a')],[db[_0x076c('0x1d')]['fn']('COUNT',db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')]['literal'](_0x076c('0x3b')))),_0x076c('0x3c')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x3d')))),_0x076c('0x3e')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x076c('0x3f')))),_0x076c('0x3c')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x076c('0x40')]],'group':[_0x076c('0x2b')]})[_0x076c('0xb')](function(_0x3ff49c){logger['info']('GetVoiceQueueHopperHistory',_0x2032d9);logger[_0x076c('0xd')](_0x076c('0x41'),_0x2032d9,JSON[_0x076c('0xe')](_0x3ff49c));_0x5f5884(_0x3ff49c);})[_0x076c('0x14')](function(_0x1c143e){logger[_0x076c('0xf')](_0x076c('0x41'),_0x1c143e[_0x076c('0x10')],_0x2032d9);_0x51cd9a(_0x142870[_0x076c('0xf')](0x1f4,_0x1c143e[_0x076c('0x10')]));});});};exports[_0x076c('0x42')]=function(_0x24cd8e){var _0x148253=this;return new Promise(function(_0x5c5664,_0x475166){return db[_0x076c('0x16')][_0x076c('0x2a')]({'raw':_0x24cd8e['options']?_0x24cd8e[_0x076c('0x19')][_0x076c('0x1a')]===undefined?!![]:![]:!![],'where':_0x24cd8e[_0x076c('0x19')]?_0x24cd8e[_0x076c('0x19')][_0x076c('0x1c')]||null:null,'attributes':[[_0x076c('0x2b'),_0x076c('0x2c')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')][_0x076c('0x1e')]('id')),_0x076c('0x43')],[db[_0x076c('0x1d')]['fn'](_0x076c('0x20'),db[_0x076c('0x1d')]['fn']('IF',db[_0x076c('0x1d')][_0x076c('0x21')](_0x076c('0x22')))),_0x076c('0x44')]],'group':[_0x076c('0x2b')]})[_0x076c('0xb')](function(_0x38dec5){logger[_0x076c('0x12')]('GetCampaignHopperHistory',_0x24cd8e);logger[_0x076c('0xd')](_0x076c('0x42'),_0x24cd8e,JSON['stringify'](_0x38dec5));_0x5c5664(_0x38dec5);})['catch'](function(_0x44d335){logger[_0x076c('0xf')](_0x076c('0x42'),_0x44d335[_0x076c('0x10')],_0x24cd8e);_0x475166(_0x148253[_0x076c('0xf')](0x1f4,_0x44d335['message']));});});}; \ No newline at end of file +var _0xe0dc=['CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrAnswerCallsDay','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0dc,0x77));var _0xce0d=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0xe0dc[_0x38f3e9];return _0xe8ee0a;};'use strict';var _=require('lodash');var util=require(_0xce0d('0x0'));var moment=require(_0xce0d('0x1'));var BPromise=require(_0xce0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce0d('0x3'));var db=require(_0xce0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xce0d('0x5'))(_0xce0d('0x6'));var config=require(_0xce0d('0x7'));var jayson=require(_0xce0d('0x8'));var client=jayson[_0xce0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af3f4,_0x3c9bd5,_0x2d8919){return new BPromise(function(_0x267b83,_0x374cd8){return client['request'](_0x2af3f4,_0x2d8919)[_0xce0d('0xa')](function(_0x13da9c){logger[_0xce0d('0xb')](_0xce0d('0xc'),_0x3c9bd5,_0xce0d('0xd'));logger[_0xce0d('0xe')](_0xce0d('0xf'),_0x3c9bd5,'request\x20sent',JSON['stringify'](_0x13da9c));if(_0x13da9c[_0xce0d('0x10')]){if(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x11')]===0x1f4){logger['error'](_0xce0d('0xc'),_0x3c9bd5,_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);return _0x374cd8(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);}logger[_0xce0d('0x10')](_0xce0d('0xc'),_0x3c9bd5,_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);return _0x267b83(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);}else{logger[_0xce0d('0xb')](_0xce0d('0xc'),_0x3c9bd5,_0xce0d('0xd'));_0x267b83(_0x13da9c['result'][_0xce0d('0x12')]);}})[_0xce0d('0x13')](function(_0x1ac9aa){logger[_0xce0d('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3c9bd5,_0x1ac9aa);_0x374cd8(_0x1ac9aa);});});}exports[_0xce0d('0x14')]=function(_0x19295b){var _0x3500a3=this;return new Promise(function(_0x598284,_0x1d0c4c){return db[_0xce0d('0x15')]['create'](_0x19295b['body'],{'raw':_0x19295b[_0xce0d('0x16')]?_0x19295b['options'][_0xce0d('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x36ace7){logger[_0xce0d('0xb')](_0xce0d('0x14'),_0x19295b);logger[_0xce0d('0xe')](_0xce0d('0x14'),_0x19295b,JSON['stringify'](_0x36ace7));_0x598284(_0x36ace7);})[_0xce0d('0x13')](function(_0x4e4768){logger['error'](_0xce0d('0x14'),_0x4e4768[_0xce0d('0x12')],_0x19295b);_0x1d0c4c(_0x3500a3[_0xce0d('0x10')](0x1f4,_0x4e4768[_0xce0d('0x12')]));});});};exports['AvgHandleTime']=function(_0x59b7f4){var _0x146bb2=this;return new Promise(function(_0x167ebf,_0x3a40e5){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x59b7f4[_0xce0d('0x16')]?_0x59b7f4[_0xce0d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x59b7f4[_0xce0d('0x16')]?_0x59b7f4[_0xce0d('0x16')][_0xce0d('0x19')]||null:null,'attributes':[[db[_0xce0d('0x1a')]['fn']('COUNT',db['sequelize'][_0xce0d('0x1b')]('id')),_0xce0d('0x1c')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x1f')))),_0xce0d('0x20')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x21')))),_0xce0d('0x22')],[db['sequelize']['fn'](_0xce0d('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xce0d('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),_0xce0d('0x23')],[db['sequelize']['fn'](_0xce0d('0x24'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xce0d('0x25')],[db['sequelize']['fn'](_0xce0d('0x24'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x26')))),_0xce0d('0x27')]]})[_0xce0d('0xa')](function(_0x429220){logger[_0xce0d('0xb')]('AvgHandleTime',_0x59b7f4);logger[_0xce0d('0xe')](_0xce0d('0x28'),_0x59b7f4,JSON[_0xce0d('0x29')](_0x429220));_0x167ebf(_0x429220);})[_0xce0d('0x13')](function(_0x46da95){logger[_0xce0d('0x10')]('AvgHandleTime',_0x46da95['message'],_0x59b7f4);_0x3a40e5(_0x146bb2['error'](0x1f4,_0x46da95[_0xce0d('0x12')]));});});};exports[_0xce0d('0x2a')]=function(_0x3691cd){var _0x226cc0=this;return new Promise(function(_0x43bc5e,_0x216908){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x3691cd[_0xce0d('0x16')]?_0x3691cd[_0xce0d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3691cd[_0xce0d('0x16')]?_0x3691cd[_0xce0d('0x16')][_0xce0d('0x19')]||null:null,'attributes':[[_0xce0d('0x2b'),'name'],[db[_0xce0d('0x1a')]['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x2c')))),_0xce0d('0x2d')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x2e')))),_0xce0d('0x2f')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x1f')))),'outboundAnswerCallsDay'],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')](_0xce0d('0x30')))),_0xce0d('0x31')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x32')))),_0xce0d('0x33')],[db[_0xce0d('0x1a')]['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x34')))),_0xce0d('0x35')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x36')))),_0xce0d('0x37')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db['sequelize']['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x38')))),_0xce0d('0x39')],[db[_0xce0d('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x3a')))),_0xce0d('0x3b')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')](_0xce0d('0x3c')))),_0xce0d('0x3d')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize']['literal'](_0xce0d('0x3e')))),_0xce0d('0x3b')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize']['literal'](_0xce0d('0x3f')))),'outboundReCallsDay']],'group':[_0xce0d('0x2b')]})[_0xce0d('0xa')](function(_0x394035){logger['info'](_0xce0d('0x2a'),_0x3691cd);logger[_0xce0d('0xe')](_0xce0d('0x2a'),_0x3691cd,JSON[_0xce0d('0x29')](_0x394035));_0x43bc5e(_0x394035);})[_0xce0d('0x13')](function(_0x3eebfc){logger[_0xce0d('0x10')](_0xce0d('0x2a'),_0x3eebfc[_0xce0d('0x12')],_0x3691cd);_0x216908(_0x226cc0['error'](0x1f4,_0x3eebfc['message']));});});};exports[_0xce0d('0x40')]=function(_0x589be6){var _0x29b2b3=this;return new Promise(function(_0x41c013,_0x185056){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x589be6[_0xce0d('0x16')]?_0x589be6[_0xce0d('0x16')][_0xce0d('0x17')]===undefined?!![]:![]:!![],'where':_0x589be6[_0xce0d('0x16')]?_0x589be6[_0xce0d('0x16')]['where']||null:null,'attributes':[[_0xce0d('0x2b'),_0xce0d('0x41')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xce0d('0x42')]],'group':[_0xce0d('0x2b')]})[_0xce0d('0xa')](function(_0x2c2e1f){logger[_0xce0d('0xb')](_0xce0d('0x40'),_0x589be6);logger[_0xce0d('0xe')](_0xce0d('0x40'),_0x589be6,JSON[_0xce0d('0x29')](_0x2c2e1f));_0x41c013(_0x2c2e1f);})[_0xce0d('0x13')](function(_0xf3992f){logger[_0xce0d('0x10')](_0xce0d('0x40'),_0xf3992f['message'],_0x589be6);_0x185056(_0x29b2b3[_0xce0d('0x10')](0x1f4,_0xf3992f[_0xce0d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 21c7eec..d5b8a80 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 _0x27cd=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e7a12,_0x503842){var _0x484edc=function(_0x4d6cba){while(--_0x4d6cba){_0x5e7a12['push'](_0x5e7a12['shift']());}};_0x484edc(++_0x503842);}(_0x27cd,0x85));var _0xd27c=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x27cd[_0x40220a];return _0x3903cc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd27c('0x0'));var express=require(_0xd27c('0x1'));var router=express[_0xd27c('0x2')]();var fs_extra=require(_0xd27c('0x3'));var auth=require(_0xd27c('0x4'));var interaction=require(_0xd27c('0x5'));var config=require(_0xd27c('0x6'));var controller=require(_0xd27c('0x7'));router[_0xd27c('0x8')]('/',auth[_0xd27c('0x9')](),controller[_0xd27c('0xa')]);router[_0xd27c('0x8')](_0xd27c('0xb'),auth[_0xd27c('0x9')](),controller[_0xd27c('0xc')]);router[_0xd27c('0x8')](_0xd27c('0xd'),auth[_0xd27c('0x9')](),controller[_0xd27c('0xe')]);router[_0xd27c('0xf')]('/',auth['isAuthenticated'](),controller[_0xd27c('0x10')]);router[_0xd27c('0x11')](_0xd27c('0xd'),auth[_0xd27c('0x9')](),controller[_0xd27c('0x12')]);module[_0xd27c('0x13')]=router; \ No newline at end of file +var _0x59a2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','express'];(function(_0x108a7c,_0x8a846f){var _0x1346ae=function(_0x3f1cd0){while(--_0x3f1cd0){_0x108a7c['push'](_0x108a7c['shift']());}};_0x1346ae(++_0x8a846f);}(_0x59a2,0x12f));var _0x259a=function(_0x2bd409,_0x2af867){_0x2bd409=_0x2bd409-0x0;var _0x4f8ba5=_0x59a2[_0x2bd409];return _0x4f8ba5;};'use strict';var multer=require(_0x259a('0x0'));var util=require(_0x259a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x259a('0x2'));var router=express['Router']();var fs_extra=require(_0x259a('0x3'));var auth=require(_0x259a('0x4'));var interaction=require(_0x259a('0x5'));var config=require(_0x259a('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x259a('0x7')]('/',auth[_0x259a('0x8')](),controller[_0x259a('0x9')]);router[_0x259a('0x7')](_0x259a('0xa'),auth[_0x259a('0x8')](),controller[_0x259a('0xb')]);router[_0x259a('0x7')](_0x259a('0xc'),auth['isAuthenticated'](),controller[_0x259a('0xd')]);router[_0x259a('0xe')]('/',auth[_0x259a('0x8')](),controller[_0x259a('0xf')]);router[_0x259a('0x10')]('/:id',auth[_0x259a('0x8')](),controller['update']);module[_0x259a('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3587a4f..8f33434 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 _0x1d7e=['STRING','name','exports'];(function(_0x41a426,_0xdad9b2){var _0x54193e=function(_0x4c132e){while(--_0x4c132e){_0x41a426['push'](_0x41a426['shift']());}};_0x54193e(++_0xdad9b2);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x1d7e[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require('sequelize');module[_0xe1d7('0x0')]={'name':{'type':Sequelize[_0xe1d7('0x1')],'unique':_0xe1d7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xe1d7('0x1')]}}; \ No newline at end of file +var _0xf842=['STRING','name','sequelize','exports'];(function(_0x2bcb5f,_0x4396b0){var _0x22f8f3=function(_0x2a578d){while(--_0x2a578d){_0x2bcb5f['push'](_0x2bcb5f['shift']());}};_0x22f8f3(++_0x4396b0);}(_0xf842,0x172));var _0x2f84=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xf842[_0x5e4563];return _0x8d1bf5;};'use strict';var Sequelize=require(_0x2f84('0x0'));module[_0x2f84('0x1')]={'name':{'type':Sequelize[_0x2f84('0x2')],'unique':_0x2f84('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2f84('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 96ccc96..2cc3f53 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 _0x12d8=['../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','order','removeDispositions','addContacts','tags','join','isArray','omit','ids','push','errors','message','getContacts','CmCustomField','CustomFields','CmContact','concat','raw','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','ItemTypeId\x20=\x20?','additionalPhone_','description','cm_contact_has_items','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','each','isEmpty','now','Content-disposition','format','list_%d_%s.csv','setHeader','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','TEXT','text','number','Sequelize','queryInterface','addColumn','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','removeAgents','emit','userCmList:remove','User','info','spread','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1cf277,_0x20b0e7){var _0x425722=function(_0x5bee8e){while(--_0x5bee8e){_0x1cf277['push'](_0x1cf277['shift']());}};_0x425722(++_0x20b0e7);}(_0x12d8,0x1be));var _0x812d=function(_0x7440e7,_0x436c39){_0x7440e7=_0x7440e7-0x0;var _0x4710a0=_0x12d8[_0x7440e7];return _0x4710a0;};'use strict';var emlformat=require(_0x812d('0x0'));var rimraf=require(_0x812d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x812d('0x2'));var rp=require(_0x812d('0x3'));var moment=require(_0x812d('0x4'));var BPromise=require(_0x812d('0x5'));var Mustache=require(_0x812d('0x6'));var util=require(_0x812d('0x7'));var path=require(_0x812d('0x8'));var sox=require(_0x812d('0x9'));var csv=require(_0x812d('0xa'));var ejs=require(_0x812d('0xb'));var fs=require('fs');var fs_extra=require(_0x812d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x812d('0xd'));var jsforce=require(_0x812d('0xe'));var deskjs=require(_0x812d('0xf'));var toCsv=require(_0x812d('0xa'));var querystring=require(_0x812d('0x10'));var Papa=require(_0x812d('0x11'));var Redis=require(_0x812d('0x12'));var authService=require(_0x812d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x812d('0x14'));var hardwareService=require(_0x812d('0x15'));var logger=require(_0x812d('0x16'))(_0x812d('0x17'));var utils=require(_0x812d('0x18'));var config=require(_0x812d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x812d('0x1a')]=_['defaults'](config[_0x812d('0x1a')],{'host':_0x812d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x812d('0x1c')](socket);function respondWithStatusCode(_0x5f5242,_0x2f5422){_0x2f5422=_0x2f5422||0xcc;return function(_0x1e1e1f){if(_0x1e1e1f){return _0x5f5242[_0x812d('0x1d')](_0x2f5422);}return _0x5f5242[_0x812d('0x1e')](_0x2f5422)['end']();};}function respondWithResult(_0x5b4683,_0xa694cb){_0xa694cb=_0xa694cb||0xc8;return function(_0x48d585){if(_0x48d585){return _0x5b4683[_0x812d('0x1e')](_0xa694cb)[_0x812d('0x1f')](_0x48d585);}};}function respondWithFilteredResult(_0x1d43e8,_0x5462e7){return function(_0x33f658){if(_0x33f658){var _0x18c402=typeof _0x5462e7['offset']===_0x812d('0x20')&&typeof _0x5462e7['limit']===_0x812d('0x20');var _0x22217d=_0x33f658[_0x812d('0x21')];var _0x56ce94=_0x18c402?0x0:_0x5462e7[_0x812d('0x22')];var _0x2c0973=_0x18c402?_0x33f658[_0x812d('0x21')]:_0x5462e7[_0x812d('0x22')]+_0x5462e7[_0x812d('0x23')];var _0x18e19b;if(_0x2c0973>=_0x22217d){_0x2c0973=_0x22217d;_0x18e19b=0xc8;}else{_0x18e19b=0xce;}_0x1d43e8['status'](_0x18e19b);return _0x1d43e8['set'](_0x812d('0x24'),_0x56ce94+'-'+_0x2c0973+'/'+_0x22217d)[_0x812d('0x1f')](_0x33f658);}return null;};}function patchUpdates(_0x256952){return function(_0x5d4d8c){try{jsonpatch[_0x812d('0x25')](_0x5d4d8c,_0x256952,!![]);}catch(_0x4c898a){return BPromise[_0x812d('0x26')](_0x4c898a);}return _0x5d4d8c[_0x812d('0x27')]();};}function saveUpdates(_0x51f37b,_0x357cca){return function(_0x3d0f00){if(_0x3d0f00){return _0x3d0f00[_0x812d('0x28')](_0x51f37b)[_0x812d('0x29')](function(_0x44a16d){return _0x44a16d;});}return null;};}function removeEntity(_0xee0c25,_0x59ff5d){return function(_0x13429d){if(_0x13429d){return _0x13429d['destroy']()[_0x812d('0x29')](function(){var _0x9a7963=_0x13429d['get']({'plain':!![]});var _0x2d9968=_0x812d('0x2a');return db[_0x812d('0x2b')]['destroy']({'where':{'type':_0x2d9968,'resourceId':_0x9a7963['id']}})['then'](function(){return _0x13429d;});})[_0x812d('0x29')](function(){_0xee0c25[_0x812d('0x1e')](0xcc)[_0x812d('0x2c')]();});}};}function handleEntityNotFound(_0x546cbd,_0x498f18){return function(_0x2523f3){if(!_0x2523f3){_0x546cbd[_0x812d('0x1d')](0x194);}return _0x2523f3;};}function handleError(_0x15cc9c,_0x2102a2){_0x2102a2=_0x2102a2||0x1f4;return function(_0x4a0958){logger[_0x812d('0x2d')](_0x4a0958[_0x812d('0x2e')]);if(_0x4a0958[_0x812d('0x2f')]){delete _0x4a0958[_0x812d('0x2f')];}_0x15cc9c[_0x812d('0x1e')](_0x2102a2)[_0x812d('0x30')](_0x4a0958);};}exports[_0x812d('0x31')]=function(_0x412900,_0x7cbb42){var _0x53ea2e={},_0x3c428d={},_0x27d1cd={'count':0x0,'rows':[]};var _0x4d5f71=_[_0x812d('0x32')](db[_0x812d('0x33')][_0x812d('0x34')],function(_0x2d910c){return{'name':_0x2d910c['fieldName'],'type':_0x2d910c[_0x812d('0x35')][_0x812d('0x36')]};});_0x3c428d[_0x812d('0x37')]=_[_0x812d('0x32')](_0x4d5f71,'name');_0x3c428d[_0x812d('0x38')]=_[_0x812d('0x39')](_0x412900['query']);_0x3c428d[_0x812d('0x3a')]=_['intersection'](_0x3c428d[_0x812d('0x37')],_0x3c428d['query']);_0x53ea2e['attributes']=_[_0x812d('0x3b')](_0x3c428d[_0x812d('0x37')],qs[_0x812d('0x3c')](_0x412900[_0x812d('0x38')][_0x812d('0x3c')]));_0x53ea2e[_0x812d('0x3d')]=_0x53ea2e[_0x812d('0x3d')][_0x812d('0x3e')]?_0x53ea2e[_0x812d('0x3d')]:_0x3c428d[_0x812d('0x37')];if(!_0x412900[_0x812d('0x38')][_0x812d('0x3f')](_0x812d('0x40'))){_0x53ea2e[_0x812d('0x23')]=qs[_0x812d('0x23')](_0x412900[_0x812d('0x38')]['limit']);_0x53ea2e['offset']=qs['offset'](_0x412900[_0x812d('0x38')]['offset']);}_0x53ea2e['order']=qs[_0x812d('0x41')](_0x412900[_0x812d('0x38')][_0x812d('0x41')]);_0x53ea2e[_0x812d('0x42')]=qs[_0x812d('0x3a')](_[_0x812d('0x43')](_0x412900[_0x812d('0x38')],_0x3c428d[_0x812d('0x3a')]),_0x4d5f71);if(_0x412900[_0x812d('0x38')][_0x812d('0x44')]){_0x53ea2e[_0x812d('0x42')]=_[_0x812d('0x45')](_0x53ea2e[_0x812d('0x42')],{'$or':_['map'](_0x4d5f71,function(_0x4d5be9){if(_0x4d5be9[_0x812d('0x35')]!==_0x812d('0x46')){var _0x1afa30={};_0x1afa30[_0x4d5be9[_0x812d('0x2f')]]={'$like':'%'+_0x412900[_0x812d('0x38')][_0x812d('0x44')]+'%'};return _0x1afa30;}})});}_0x53ea2e=_[_0x812d('0x45')]({},_0x53ea2e,_0x412900[_0x812d('0x47')]);var _0x126fea={'where':_0x53ea2e[_0x812d('0x42')]};return db[_0x812d('0x33')]['count'](_0x126fea)[_0x812d('0x29')](function(_0x4d07ce){_0x27d1cd[_0x812d('0x21')]=_0x4d07ce;if(_0x412900[_0x812d('0x38')]['includeAll']){_0x53ea2e['include']=[{'all':!![]}];}return db['CmList'][_0x812d('0x48')](_0x53ea2e);})[_0x812d('0x29')](function(_0x906066){_0x27d1cd[_0x812d('0x49')]=_0x906066;return _0x27d1cd;})[_0x812d('0x29')](respondWithFilteredResult(_0x7cbb42,_0x53ea2e))[_0x812d('0x4a')](handleError(_0x7cbb42,null));};exports[_0x812d('0x4b')]=function(_0xcf3c34,_0x15054c){var _0xf77cb3={'raw':![],'where':{'id':_0xcf3c34['params']['id']}},_0x28f002={};_0x28f002['model']=_[_0x812d('0x39')](db[_0x812d('0x33')]['rawAttributes']);_0x28f002[_0x812d('0x38')]=_[_0x812d('0x39')](_0xcf3c34[_0x812d('0x38')]);_0x28f002['filters']=_[_0x812d('0x3b')](_0x28f002[_0x812d('0x37')],_0x28f002[_0x812d('0x38')]);_0xf77cb3[_0x812d('0x3d')]=_[_0x812d('0x3b')](_0x28f002[_0x812d('0x37')],qs['fields'](_0xcf3c34[_0x812d('0x38')][_0x812d('0x3c')]));_0xf77cb3[_0x812d('0x3d')]=_0xf77cb3['attributes'][_0x812d('0x3e')]?_0xf77cb3[_0x812d('0x3d')]:_0x28f002['model'];if(_0xcf3c34[_0x812d('0x38')][_0x812d('0x4c')]){_0xf77cb3[_0x812d('0x4d')]=[{'all':!![]}];}_0xf77cb3=_[_0x812d('0x45')]({},_0xf77cb3,_0xcf3c34['options']);return db[_0x812d('0x33')][_0x812d('0x4e')](_0xf77cb3)[_0x812d('0x29')](handleEntityNotFound(_0x15054c,null))['then'](respondWithResult(_0x15054c,null))[_0x812d('0x4a')](handleError(_0x15054c,null));};exports[_0x812d('0x4f')]=function(_0x570a24,_0x3eca6e){return db['CmList'][_0x812d('0x4f')](_0x570a24[_0x812d('0x50')],{})[_0x812d('0x29')](function(_0x3ca563){var _0x3ab109=_0x570a24[_0x812d('0x51')]['get']({'plain':!![]});if(!_0x3ab109)throw new Error(_0x812d('0x52'));if(_0x3ab109[_0x812d('0x53')]==='user'){var _0x178817=_0x3ca563[_0x812d('0x54')]({'plain':!![]});var _0x3ca962=_0x812d('0x2a');return db[_0x812d('0x55')][_0x812d('0x4e')]({'where':{'name':_0x3ca962,'userProfileId':_0x3ab109[_0x812d('0x56')]},'raw':!![]})[_0x812d('0x29')](function(_0x44cd6c){if(_0x44cd6c&&_0x44cd6c[_0x812d('0x57')]===0x0){return db[_0x812d('0x2b')][_0x812d('0x4f')]({'name':_0x178817['name'],'resourceId':_0x178817['id'],'type':_0x44cd6c['name'],'sectionId':_0x44cd6c['id']},{})[_0x812d('0x29')](function(){return _0x3ca563;});}else{return _0x3ca563;}})['catch'](function(_0x50efbf){logger[_0x812d('0x2d')](_0x812d('0x58'),_0x50efbf);throw _0x50efbf;});}return _0x3ca563;})[_0x812d('0x29')](respondWithResult(_0x3eca6e,0xc9))[_0x812d('0x4a')](handleError(_0x3eca6e,null));};exports['update']=function(_0xb77f73,_0x1fdcdc){if(_0xb77f73[_0x812d('0x50')]['id']){delete _0xb77f73[_0x812d('0x50')]['id'];}return db[_0x812d('0x33')][_0x812d('0x4e')]({'where':{'id':_0xb77f73[_0x812d('0x59')]['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x1fdcdc,null))['then'](saveUpdates(_0xb77f73['body'],null))[_0x812d('0x29')](respondWithResult(_0x1fdcdc,null))['catch'](handleError(_0x1fdcdc,null));};exports['destroy']=function(_0x25d9ab,_0x4b0168){return db[_0x812d('0x33')][_0x812d('0x4e')]({'where':{'id':_0x25d9ab['params']['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x4b0168,null))[_0x812d('0x29')](removeEntity(_0x4b0168,null))[_0x812d('0x4a')](handleError(_0x4b0168,null));};exports[_0x812d('0x5a')]=function(_0x2e1223,_0x3f5a12){return db[_0x812d('0x33')][_0x812d('0x5a')]()[_0x812d('0x29')](respondWithResult(_0x3f5a12,null))[_0x812d('0x4a')](handleError(_0x3f5a12,null));};exports[_0x812d('0x5b')]=function(_0x7d98e3,_0x54c86d,_0x4ed293){if(_0x7d98e3[_0x812d('0x50')]['id']){delete _0x7d98e3['body']['id'];}return db[_0x812d('0x33')][_0x812d('0x4e')]({'where':{'id':_0x7d98e3[_0x812d('0x59')]['id']}})['then'](handleEntityNotFound(_0x54c86d,null))[_0x812d('0x29')](function(_0x21b5ad){if(_0x21b5ad){_0x7d98e3['body'][_0x812d('0x5c')]=_0x21b5ad['id'];return db['Disposition'][_0x812d('0x4f')](_0x7d98e3['body']);}})[_0x812d('0x29')](respondWithResult(_0x54c86d,null))[_0x812d('0x4a')](handleError(_0x54c86d,null));};exports['getDispositions']=function(_0x349577,_0xaa8ce6,_0x2a7103){var _0x16e7c3={'raw':![],'where':{}};var _0x1e373b={};var _0x36598b={'count':0x0,'rows':[]};return db[_0x812d('0x33')][_0x812d('0x5d')]({'where':{'id':_0x349577['params']['id']}})[_0x812d('0x29')](handleEntityNotFound(_0xaa8ce6,null))['then'](function(_0x4c31e2){if(_0x4c31e2){_0x1e373b['model']=_[_0x812d('0x39')](db[_0x812d('0x5e')][_0x812d('0x34')]);_0x1e373b[_0x812d('0x38')]=_[_0x812d('0x39')](_0x349577['query']);_0x1e373b[_0x812d('0x3a')]=_[_0x812d('0x3b')](_0x1e373b[_0x812d('0x37')],_0x1e373b[_0x812d('0x38')]);_0x16e7c3[_0x812d('0x3d')]=_[_0x812d('0x3b')](_0x1e373b['model'],qs[_0x812d('0x3c')](_0x349577[_0x812d('0x38')]['fields']));_0x16e7c3[_0x812d('0x3d')]=_0x16e7c3['attributes']['length']?_0x16e7c3[_0x812d('0x3d')]:_0x1e373b[_0x812d('0x37')];if(!_0x349577[_0x812d('0x38')][_0x812d('0x3f')](_0x812d('0x40'))){_0x16e7c3[_0x812d('0x23')]=qs[_0x812d('0x23')](_0x349577['query'][_0x812d('0x23')]);_0x16e7c3[_0x812d('0x22')]=qs[_0x812d('0x22')](_0x349577[_0x812d('0x38')]['offset']);}_0x16e7c3[_0x812d('0x5f')]=qs[_0x812d('0x41')](_0x349577[_0x812d('0x38')][_0x812d('0x41')]);_0x16e7c3[_0x812d('0x42')]=qs[_0x812d('0x3a')](_[_0x812d('0x43')](_0x349577[_0x812d('0x38')],_0x1e373b[_0x812d('0x3a')]));_0x16e7c3[_0x812d('0x42')][_0x812d('0x5c')]=_0x4c31e2['id'];if(_0x349577['query']['filter']){_0x16e7c3[_0x812d('0x42')]=_['merge'](_0x16e7c3[_0x812d('0x42')],{'$or':_[_0x812d('0x32')](_0x16e7c3[_0x812d('0x3d')],function(_0x45299b){var _0x55cded={};_0x55cded[_0x45299b]={'$like':'%'+_0x349577['query'][_0x812d('0x44')]+'%'};return _0x55cded;})});}_0x16e7c3=_[_0x812d('0x45')]({},_0x16e7c3,_0x349577['options']);return db[_0x812d('0x5e')][_0x812d('0x21')]({'where':_0x16e7c3['where']})[_0x812d('0x29')](function(_0x23f0e9){_0x36598b['count']=_0x23f0e9;if(_0x349577[_0x812d('0x38')]['includeAll']){_0x16e7c3[_0x812d('0x4d')]=[{'all':!![]}];}return db[_0x812d('0x5e')]['findAll'](_0x16e7c3);})[_0x812d('0x29')](function(_0x325fc2){_0x36598b['rows']=_0x325fc2;return _0x36598b;});}})['then'](respondWithFilteredResult(_0xaa8ce6,_0x16e7c3))[_0x812d('0x4a')](handleError(_0xaa8ce6,null));};exports[_0x812d('0x60')]=function(_0x9c6b72,_0x324771,_0x3662f6){return db[_0x812d('0x33')][_0x812d('0x4e')]({'where':{'id':_0x9c6b72['params']['id']}})['then'](handleEntityNotFound(_0x324771,null))[_0x812d('0x29')](function(_0x511bca){if(_0x511bca){return _0x511bca['removeDispositions'](_0x9c6b72['query']['ids']);}})['then'](respondWithStatusCode(_0x324771,null))[_0x812d('0x4a')](handleError(_0x324771,null));};exports[_0x812d('0x61')]=function(_0x338424,_0x136e9d,_0x218868){return db[_0x812d('0x33')]['find']({'where':{'id':_0x338424[_0x812d('0x59')]['id']}})['then'](handleEntityNotFound(_0x136e9d,null))[_0x812d('0x29')](function(_0x3f1fe8){if(_0x3f1fe8){var _0x3e1fe7=[];var _0x19d002={'success':[],'errors':[]};return db['CmContact'][_0x812d('0x5a')]()[_0x812d('0x29')](function(_0x4530c5){if(_0x338424[_0x812d('0x50')][_0x812d('0x62')]&&_['isArray'](_0x338424[_0x812d('0x50')][_0x812d('0x62')])){if(_0x338424[_0x812d('0x50')][_0x812d('0x62')][_0x812d('0x3e')]){_0x338424[_0x812d('0x50')][_0x812d('0x62')]=_0x338424[_0x812d('0x50')]['tags'][_0x812d('0x63')](';')+';';}else{_0x338424[_0x812d('0x50')]['tags']=null;}}else{_0x338424['body'][_0x812d('0x62')]=null;}if(_0x338424[_0x812d('0x50')]&&_[_0x812d('0x64')](_0x338424[_0x812d('0x50')])){for(var _0xc43a78=0x0;_0xc43a78<_0x338424[_0x812d('0x50')][_0x812d('0x3e')];_0xc43a78+=0x1){_0x338424[_0x812d('0x50')][_0xc43a78]['ListId']=_0x338424['params']['id'];_0x3e1fe7['push'](_0x338424[_0x812d('0x50')][_0xc43a78]);}return BPromise['each'](_0x3e1fe7,function(_0x131e33){return db['CmContact'][_0x812d('0x4f')](_[_0x812d('0x65')](_0x131e33,[_0x812d('0x66'),'id'])||{},{'fields':_[_0x812d('0x39')](_0x4530c5),'raw':!![]})[_0x812d('0x29')](function(_0x5be7fe){_0x19d002['success'][_0x812d('0x67')](_0x5be7fe['dataValues']);})[_0x812d('0x4a')](function(_0x52134a){_0x19d002[_0x812d('0x68')]['push']({'data':_0x131e33,'error':_0x52134a[_0x812d('0x69')]});});})[_0x812d('0x29')](function(_0x2f86f3){return _0x19d002;})[_0x812d('0x4a')](function(_0x2a3925){return _0x2a3925;});}else{_0x136e9d[_0x812d('0x1e')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x812d('0x29')](respondWithResult(_0x136e9d,null))[_0x812d('0x4a')](handleError(_0x136e9d,null));};exports[_0x812d('0x6a')]=function(_0x327cb0,_0x375e04,_0x280871){var _0x44e10d;return db['CmList']['find']({'where':{'id':_0x327cb0['params']['id']},'include':[{'model':db[_0x812d('0x6b')],'as':_0x812d('0x6c')}]})[_0x812d('0x29')](handleEntityNotFound(_0x375e04,null))['then'](function(_0xea1cd2){if(_0xea1cd2){_0x44e10d=_0xea1cd2;return db[_0x812d('0x6d')][_0x812d('0x34')];}})[_0x812d('0x29')](function(_0x573347){if(_0x573347){var _0x1dce54={};var _0x289b2a={};_0x289b2a[_0x812d('0x37')]=_[_0x812d('0x6e')](_[_0x812d('0x39')](_0x573347),_['map'](_0x44e10d[_0x812d('0x6c')],function(_0x6bd220){return util['format']('cf_%d',_0x6bd220['id']);}));_0x289b2a['query']=_['keys'](_0x327cb0[_0x812d('0x38')]);_0x289b2a['filters']=_[_0x812d('0x3b')](_0x289b2a[_0x812d('0x37')],_0x289b2a['query']);_0x1dce54['attributes']=_[_0x812d('0x3b')](_0x289b2a[_0x812d('0x37')],qs[_0x812d('0x3c')](_0x327cb0[_0x812d('0x38')][_0x812d('0x3c')]));_0x1dce54[_0x812d('0x3d')]=_0x1dce54[_0x812d('0x3d')][_0x812d('0x3e')]?_0x1dce54['attributes']:_0x289b2a['model'];if(!_0x327cb0[_0x812d('0x38')][_0x812d('0x3f')](_0x812d('0x40'))){_0x1dce54[_0x812d('0x23')]=qs[_0x812d('0x23')](_0x327cb0[_0x812d('0x38')][_0x812d('0x23')]);_0x1dce54[_0x812d('0x22')]=qs[_0x812d('0x22')](_0x327cb0[_0x812d('0x38')]['offset']);}_0x1dce54['order']=qs['sort'](_0x327cb0[_0x812d('0x38')][_0x812d('0x41')]);_0x1dce54['where']=qs['filters'](_[_0x812d('0x43')](_0x327cb0['query'],_0x289b2a[_0x812d('0x3a')]));_0x1dce54[_0x812d('0x6f')]=!![];if(_0x327cb0['query'][_0x812d('0x44')]){_0x1dce54[_0x812d('0x42')]=_['merge'](_0x1dce54['where'],{'$or':_[_0x812d('0x32')](_0x1dce54[_0x812d('0x3d')],function(_0x1d23bb){var _0x4bf9c0={};_0x4bf9c0[_0x1d23bb]={'$like':'%'+_0x327cb0[_0x812d('0x38')][_0x812d('0x44')]+'%'};return _0x4bf9c0;})});}_0x1dce54=_[_0x812d('0x45')]({},_0x1dce54,_0x327cb0[_0x812d('0x47')]);return _0x44e10d[_0x812d('0x6a')](_0x1dce54);}})[_0x812d('0x29')](respondWithResult(_0x375e04,null))[_0x812d('0x4a')](handleError(_0x375e04,null));};exports['getContactsCsv']=function(_0x874cb9,_0x25849e,_0x168f9b){var _0xc6711f;var _0x357ff5;var _0x50470a;var _0xbf8f51=_0x874cb9[_0x812d('0x59')]['id'];csv_results=[];return db['ContactItemType'][_0x812d('0x48')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0x812d('0x29')](function(_0x28dcb1){_0xc6711f=_0x28dcb1;var _0x5968a8=_[_0x812d('0x39')](db[_0x812d('0x6d')][_0x812d('0x34')]);return db[_0x812d('0x6b')][_0x812d('0x48')]({'raw':!![],'attributes':['id','alias']})[_0x812d('0x29')](function(_0x2dbcf6){_0x357ff5=_0x2dbcf6;var _0x484cc4=squel[_0x812d('0x70')]()[_0x812d('0x3c')](_0x5968a8)[_0x812d('0x71')](_0x812d('0x72'),'c')[_0x812d('0x42')](_0x812d('0x73'),_0xbf8f51)[_0x812d('0x42')](_0x812d('0x74'))['distinct']();for(var _0x4ab21f=0x0;_0x4ab21f<_0x357ff5[_0x812d('0x3e')];_0x4ab21f++){_0x484cc4[_0x812d('0x75')](_0x812d('0x76')+_0x357ff5[_0x4ab21f]['id'],_0x812d('0x77')+_0x357ff5[_0x4ab21f]['alias']);}for(var _0x4ab21f=0x0;_0x4ab21f<_0xc6711f[_0x812d('0x3e')];_0x4ab21f++){_0x484cc4[_0x812d('0x75')](squel[_0x812d('0x70')]()[_0x812d('0x75')]('item')[_0x812d('0x71')]('cm_contact_has_items')[_0x812d('0x42')](_0x812d('0x78'),_0xc6711f[_0x4ab21f]['id'])['where']('CmContactId\x20=\x20c.id'),_0x812d('0x79')+_0xc6711f[_0x4ab21f][_0x812d('0x2f')]);_0x484cc4[_0x812d('0x75')](squel[_0x812d('0x70')]()[_0x812d('0x75')](_0x812d('0x7a'))[_0x812d('0x71')](_0x812d('0x7b'))[_0x812d('0x42')](_0x812d('0x78'),_0xc6711f[_0x4ab21f]['id'])['where'](_0x812d('0x7c')),_0x812d('0x7d')+_0xc6711f[_0x4ab21f][_0x812d('0x2f')]);}var _0x48ab29=[];_0x48ab29[_0x812d('0x67')](_0x484cc4[_0x812d('0x7e')]());BPromise[_0x812d('0x7f')](_0x48ab29,handleQuery)['then'](function(_0x2fde78){handleQuery(_0x484cc4[_0x812d('0x7e')]());var _0x3a1bc7=csv_results[0x0];if(!_[_0x812d('0x80')](_0x3a1bc7)){var _0x5eb784=toCsv(_0x3a1bc7);var _0x1d2058=Date[_0x812d('0x81')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0xbf8f51,_0x1d2058),_0x5eb784);_0x25849e['setHeader'](_0x812d('0x82'),'attachment;\x20filename='+util[_0x812d('0x83')](_0x812d('0x84'),_0xbf8f51,_0x1d2058));_0x25849e[_0x812d('0x85')](_0x812d('0x86'),'text/csv');return _0x25849e[_0x812d('0x87')](util[_0x812d('0x83')](_0x812d('0x88'),_0xbf8f51,_0x1d2058));}else{return _0x25849e['sendStatus'](0xcc);}});});});};exports[_0x812d('0x89')]=function(_0x22a8db,_0x51368b,_0x425186){var _0x53a799;delete _0x22a8db[_0x812d('0x50')]['id'];return db[_0x812d('0x33')]['findOne']({'where':{'id':_0x22a8db[_0x812d('0x59')]['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x51368b,null))['then'](function(_0x1d8633){if(_0x1d8633){return db[_0x812d('0x8a')][_0x812d('0x8b')](function(_0x47268e){return db['CmCustomField'][_0x812d('0x4f')](_0x22a8db['body'],{'transaction':_0x47268e})[_0x812d('0x29')](function(_0x1144d1){_0x53a799=_0x1144d1;return _0x1d8633['addCustomFields'](_0x1144d1,{'transaction':_0x47268e});})[_0x812d('0x29')](function(){var _0x31056f={'type':db['Sequelize'][_0x812d('0x8c')],'transaction':_0x47268e};switch(_0x22a8db[_0x812d('0x50')][_0x812d('0x35')]){case _0x812d('0x8d'):_0x31056f[_0x812d('0x35')]=db['Sequelize'][_0x812d('0x8c')];break;case _0x812d('0x8e'):_0x31056f[_0x812d('0x35')]=db[_0x812d('0x8f')]['INTEGER'];break;case'switch':_0x31056f[_0x812d('0x35')]=db['Sequelize']['BOOLEAN'];_0x31056f['defaultValue']=![];break;default:}return db[_0x812d('0x8a')][_0x812d('0x90')][_0x812d('0x91')](_0x812d('0x72'),util[_0x812d('0x83')]('cf_%s',_0x53a799['id']),_0x31056f);})['then'](function(){return _0x53a799;});});}})[_0x812d('0x29')](respondWithResult(_0x51368b,null))[_0x812d('0x4a')](handleError(_0x51368b,null));};exports[_0x812d('0x92')]=function(_0x22567f,_0x274ee6,_0x1b875b){var _0x320126={};var _0x456d53={};var _0x114039;var _0x43f99f;return db['CmList'][_0x812d('0x5d')]({'where':{'id':_0x22567f[_0x812d('0x59')]['id']}})['then'](handleEntityNotFound(_0x274ee6,null))[_0x812d('0x29')](function(_0x3af21f){if(_0x3af21f){_0x114039=_0x3af21f;_0x456d53['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x456d53['query']=_[_0x812d('0x39')](_0x22567f[_0x812d('0x38')]);_0x456d53[_0x812d('0x3a')]=_[_0x812d('0x3b')](_0x456d53[_0x812d('0x37')],_0x456d53['query']);_0x320126[_0x812d('0x3d')]=_['intersection'](_0x456d53[_0x812d('0x37')],qs[_0x812d('0x3c')](_0x22567f[_0x812d('0x38')][_0x812d('0x3c')]));_0x320126[_0x812d('0x3d')]=_0x320126[_0x812d('0x3d')][_0x812d('0x3e')]?_0x320126[_0x812d('0x3d')]:_0x456d53[_0x812d('0x37')];_0x320126[_0x812d('0x5f')]=qs[_0x812d('0x41')](_0x22567f['query'][_0x812d('0x41')]);_0x320126[_0x812d('0x42')]=qs['filters'](_[_0x812d('0x43')](_0x22567f['query'],_0x456d53[_0x812d('0x3a')]));_0x320126['where']=_['merge'](_0x320126['where'],{'$or':[{'ListId':_0x3af21f['id']},{'ListId':null}]});if(_0x22567f[_0x812d('0x38')]['filter']){_0x320126[_0x812d('0x42')]=_[_0x812d('0x45')](_0x320126['where'],{'$or':_[_0x812d('0x32')](_0x320126[_0x812d('0x3d')],function(_0x30e1d6){var _0x373c46={};_0x373c46[_0x30e1d6]={'$like':'%'+_0x22567f[_0x812d('0x38')][_0x812d('0x44')]+'%'};return _0x373c46;})});}_0x320126=_[_0x812d('0x45')]({},_0x320126,_0x22567f['options']);return db[_0x812d('0x6b')]['findAndCountAll'](_0x320126);}})['then'](respondWithResult(_0x274ee6,null))['catch'](handleError(_0x274ee6,null));};exports[_0x812d('0x93')]=function(_0x567c98,_0x44c617){return db[_0x812d('0x6b')][_0x812d('0x94')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x44c617,null))[_0x812d('0x29')](function(_0x54afb8){return _0x54afb8;})[_0x812d('0x29')](respondWithResult(_0x44c617,null))[_0x812d('0x4a')](handleError(_0x44c617,null));};exports[_0x812d('0x95')]=function(_0xaf5ee6,_0x541b10,_0x25d3f8){return db['CmList'][_0x812d('0x4e')]({'where':{'id':_0xaf5ee6[_0x812d('0x59')]['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x541b10,null))[_0x812d('0x29')](function(_0x1c98a2){if(_0x1c98a2){return _0x1c98a2[_0x812d('0x95')](_0xaf5ee6[_0x812d('0x50')][_0x812d('0x66')],_['omit'](_0xaf5ee6['body'],[_0x812d('0x66'),'id'])||{})['spread'](function(_0x56c84a){for(var _0x215c78=0x0;_0x215c78<_0xaf5ee6[_0x812d('0x50')][_0x812d('0x66')][_0x812d('0x3e')];_0x215c78+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0xaf5ee6[_0x812d('0x50')]['ids'][_0x215c78]),'CmListId':Number(_0xaf5ee6[_0x812d('0x59')]['id'])});}return _0x56c84a;});}})[_0x812d('0x29')](respondWithResult(_0x541b10,null))[_0x812d('0x4a')](handleError(_0x541b10,null));};exports[_0x812d('0x96')]=function(_0x671a8c,_0x1c0f60,_0xfc3654){return db[_0x812d('0x33')][_0x812d('0x4e')]({'where':{'id':_0x671a8c['params']['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x1c0f60,null))[_0x812d('0x29')](function(_0x3920bc){if(_0x3920bc){return _0x3920bc[_0x812d('0x96')](_0x671a8c[_0x812d('0x38')]['ids'])[_0x812d('0x29')](function(){if(_['isArray'](_0x671a8c['query'][_0x812d('0x66')])){for(var _0x42fc8d=0x0;_0x42fc8d<_0x671a8c[_0x812d('0x38')][_0x812d('0x66')][_0x812d('0x3e')];_0x42fc8d+=0x1){socket[_0x812d('0x97')]('userCmList:remove',{'UserId':Number(_0x671a8c[_0x812d('0x38')][_0x812d('0x66')][_0x42fc8d]),'CmListId':Number(_0x671a8c[_0x812d('0x59')]['id'])});}}else{socket[_0x812d('0x97')](_0x812d('0x98'),{'UserId':Number(_0x671a8c[_0x812d('0x38')][_0x812d('0x66')]),'CmListId':Number(_0x671a8c[_0x812d('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1c0f60,null))['catch'](handleError(_0x1c0f60,null));};exports['getAgents']=function(_0x45158c,_0x19c84f,_0x3b6dfa){var _0x2985c6={};var _0xab5d17={};var _0x37d14b;var _0x5c7afa;return db['CmList'][_0x812d('0x5d')]({'where':{'id':_0x45158c[_0x812d('0x59')]['id']}})[_0x812d('0x29')](handleEntityNotFound(_0x19c84f,null))[_0x812d('0x29')](function(_0x32d1c9){if(_0x32d1c9){_0x37d14b=_0x32d1c9;_0xab5d17['model']=_[_0x812d('0x39')](db[_0x812d('0x99')]['rawAttributes']);_0xab5d17[_0x812d('0x38')]=_[_0x812d('0x39')](_0x45158c[_0x812d('0x38')]);_0xab5d17['filters']=_['intersection'](_0xab5d17[_0x812d('0x37')],_0xab5d17[_0x812d('0x38')]);_0x2985c6['attributes']=_[_0x812d('0x3b')](_0xab5d17[_0x812d('0x37')],qs[_0x812d('0x3c')](_0x45158c[_0x812d('0x38')]['fields']));_0x2985c6[_0x812d('0x3d')]=_0x2985c6[_0x812d('0x3d')][_0x812d('0x3e')]?_0x2985c6[_0x812d('0x3d')]:_0xab5d17[_0x812d('0x37')];_0x2985c6[_0x812d('0x5f')]=qs[_0x812d('0x41')](_0x45158c[_0x812d('0x38')][_0x812d('0x41')]);_0x2985c6[_0x812d('0x42')]=qs[_0x812d('0x3a')](_[_0x812d('0x43')](_0x45158c[_0x812d('0x38')],_0xab5d17['filters']));if(_0x45158c[_0x812d('0x38')][_0x812d('0x44')]){_0x2985c6['where']=_[_0x812d('0x45')](_0x2985c6[_0x812d('0x42')],{'$or':_[_0x812d('0x32')](_0x2985c6['attributes'],function(_0x30fab0){var _0x21c6fe={};_0x21c6fe[_0x30fab0]={'$like':'%'+_0x45158c['query'][_0x812d('0x44')]+'%'};return _0x21c6fe;})});}_0x2985c6=_[_0x812d('0x45')]({},_0x2985c6,_0x45158c[_0x812d('0x47')]);return _0x37d14b['getAgents'](_0x2985c6);}})[_0x812d('0x29')](function(_0x28a759){if(_0x28a759){_0x5c7afa=_0x28a759['length'];if(!_0x45158c[_0x812d('0x38')][_0x812d('0x3f')](_0x812d('0x40'))){_0x2985c6['limit']=qs[_0x812d('0x23')](_0x45158c[_0x812d('0x38')][_0x812d('0x23')]);_0x2985c6[_0x812d('0x22')]=qs[_0x812d('0x22')](_0x45158c['query'][_0x812d('0x22')]);}return _0x37d14b['getAgents'](_0x2985c6);}})[_0x812d('0x29')](function(_0x3be6a1){if(_0x3be6a1){return _0x3be6a1?{'count':_0x5c7afa,'rows':_0x3be6a1}:null;}})[_0x812d('0x29')](respondWithResult(_0x19c84f,null))['catch'](handleError(_0x19c84f,null));};function handleQuery(_0x10e26e){logger[_0x812d('0x9a')](_0x10e26e);return db[_0x812d('0x8a')][_0x812d('0x38')](_0x10e26e)[_0x812d('0x9b')](function(_0x1a0774){csv_results[_0x812d('0x67')](_0x1a0774);})[_0x812d('0x4a')](function(_0x4cf29a){logger[_0x812d('0x2d')](_0x4cf29a[_0x812d('0x69')]);});} \ No newline at end of file +var _0xa741=['errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','toString','isEmpty','now','setHeader','Content-disposition','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','undefined','count','limit','set','reject','update','destroy','then','get','Lists','UserProfileResource','end','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','rows','catch','show','params','keys','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','Disposition','getDispositions','findOne','length','order','ListId','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0xa741,0xd9));var _0x1a74=function(_0x2dbbf2,_0x34c336){_0x2dbbf2=_0x2dbbf2-0x0;var _0x2b40ce=_0xa741[_0x2dbbf2];return _0x2b40ce;};'use strict';var emlformat=require(_0x1a74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a74('0x1'));var jsonpatch=require(_0x1a74('0x2'));var rp=require(_0x1a74('0x3'));var moment=require('moment');var BPromise=require(_0x1a74('0x4'));var Mustache=require(_0x1a74('0x5'));var util=require(_0x1a74('0x6'));var path=require(_0x1a74('0x7'));var sox=require(_0x1a74('0x8'));var csv=require(_0x1a74('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a74('0xa'));var _=require(_0x1a74('0xb'));var squel=require(_0x1a74('0xc'));var crypto=require(_0x1a74('0xd'));var jsforce=require(_0x1a74('0xe'));var deskjs=require(_0x1a74('0xf'));var toCsv=require(_0x1a74('0x9'));var querystring=require(_0x1a74('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a74('0x11'));var authService=require(_0x1a74('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1a74('0x13'));var hardwareService=require(_0x1a74('0x14'));var logger=require(_0x1a74('0x15'))('api');var utils=require(_0x1a74('0x16'));var config=require(_0x1a74('0x17'));var licenseUtil=require(_0x1a74('0x18'));var db=require(_0x1a74('0x19'))['db'];var csv_results;config[_0x1a74('0x1a')]=_['defaults'](config[_0x1a74('0x1a')],{'host':_0x1a74('0x1b'),'port':0x18eb});var socket=require(_0x1a74('0x1c'))(new Redis(config[_0x1a74('0x1a')]));require(_0x1a74('0x1d'))[_0x1a74('0x1e')](socket);function respondWithStatusCode(_0x5b179f,_0x547286){_0x547286=_0x547286||0xcc;return function(_0xd7e558){if(_0xd7e558){return _0x5b179f['sendStatus'](_0x547286);}return _0x5b179f[_0x1a74('0x1f')](_0x547286)['end']();};}function respondWithResult(_0x32df61,_0x1bfc43){_0x1bfc43=_0x1bfc43||0xc8;return function(_0x5c1e7a){if(_0x5c1e7a){return _0x32df61['status'](_0x1bfc43)[_0x1a74('0x20')](_0x5c1e7a);}};}function respondWithFilteredResult(_0x3e799e,_0x48a096){return function(_0x5272f3){if(_0x5272f3){var _0x5bbd78=typeof _0x48a096[_0x1a74('0x21')]==='undefined'&&typeof _0x48a096['limit']===_0x1a74('0x22');var _0x20ed7f=_0x5272f3[_0x1a74('0x23')];var _0x513af9=_0x5bbd78?0x0:_0x48a096[_0x1a74('0x21')];var _0x51c47e=_0x5bbd78?_0x5272f3['count']:_0x48a096[_0x1a74('0x21')]+_0x48a096[_0x1a74('0x24')];var _0x295a39;if(_0x51c47e>=_0x20ed7f){_0x51c47e=_0x20ed7f;_0x295a39=0xc8;}else{_0x295a39=0xce;}_0x3e799e[_0x1a74('0x1f')](_0x295a39);return _0x3e799e[_0x1a74('0x25')]('Content-Range',_0x513af9+'-'+_0x51c47e+'/'+_0x20ed7f)[_0x1a74('0x20')](_0x5272f3);}return null;};}function patchUpdates(_0x364128){return function(_0x368c7d){try{jsonpatch['apply'](_0x368c7d,_0x364128,!![]);}catch(_0x103106){return BPromise[_0x1a74('0x26')](_0x103106);}return _0x368c7d['save']();};}function saveUpdates(_0x4bb5ad,_0x32938d){return function(_0x159b96){if(_0x159b96){return _0x159b96[_0x1a74('0x27')](_0x4bb5ad)['then'](function(_0x10ef3a){return _0x10ef3a;});}return null;};}function removeEntity(_0x3c3127,_0x44843a){return function(_0x5612b8){if(_0x5612b8){return _0x5612b8[_0x1a74('0x28')]()[_0x1a74('0x29')](function(){var _0xe461da=_0x5612b8[_0x1a74('0x2a')]({'plain':!![]});var _0x552466=_0x1a74('0x2b');return db[_0x1a74('0x2c')][_0x1a74('0x28')]({'where':{'type':_0x552466,'resourceId':_0xe461da['id']}})[_0x1a74('0x29')](function(){return _0x5612b8;});})['then'](function(){_0x3c3127[_0x1a74('0x1f')](0xcc)[_0x1a74('0x2d')]();});}};}function handleEntityNotFound(_0x5b4cb9,_0x5ea36f){return function(_0x25845f){if(!_0x25845f){_0x5b4cb9['sendStatus'](0x194);}return _0x25845f;};}function handleError(_0x3b27c4,_0x1252bf){_0x1252bf=_0x1252bf||0x1f4;return function(_0x3a6021){logger['error'](_0x3a6021['stack']);if(_0x3a6021[_0x1a74('0x2e')]){delete _0x3a6021[_0x1a74('0x2e')];}_0x3b27c4[_0x1a74('0x1f')](_0x1252bf)['send'](_0x3a6021);};}exports[_0x1a74('0x2f')]=function(_0x5d3d23,_0x1a32bc){var _0x1f6b77={},_0x1f44cf={},_0x2f2357={'count':0x0,'rows':[]};var _0x2bb845=_[_0x1a74('0x30')](db['CmList'][_0x1a74('0x31')],function(_0x2c243b){return{'name':_0x2c243b[_0x1a74('0x32')],'type':_0x2c243b[_0x1a74('0x33')]['key']};});_0x1f44cf[_0x1a74('0x34')]=_[_0x1a74('0x30')](_0x2bb845,_0x1a74('0x2e'));_0x1f44cf[_0x1a74('0x35')]=_['keys'](_0x5d3d23['query']);_0x1f44cf[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x1f44cf[_0x1a74('0x34')],_0x1f44cf['query']);_0x1f6b77[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x1f44cf['model'],qs[_0x1a74('0x39')](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x39')]));_0x1f6b77[_0x1a74('0x38')]=_0x1f6b77['attributes']['length']?_0x1f6b77[_0x1a74('0x38')]:_0x1f44cf['model'];if(!_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x1f6b77['limit']=qs['limit'](_0x5d3d23[_0x1a74('0x35')]['limit']);_0x1f6b77[_0x1a74('0x21')]=qs['offset'](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x21')]);}_0x1f6b77['order']=qs[_0x1a74('0x3c')](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x1f6b77[_0x1a74('0x3d')]=qs['filters'](_[_0x1a74('0x3e')](_0x5d3d23['query'],_0x1f44cf[_0x1a74('0x36')]),_0x2bb845);if(_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3f')]){_0x1f6b77[_0x1a74('0x3d')]=_[_0x1a74('0x40')](_0x1f6b77[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x2bb845,function(_0x3f9422){if(_0x3f9422[_0x1a74('0x33')]!==_0x1a74('0x41')){var _0x4c8147={};_0x4c8147[_0x3f9422[_0x1a74('0x2e')]]={'$like':'%'+_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x4c8147;}})});}_0x1f6b77=_['merge']({},_0x1f6b77,_0x5d3d23[_0x1a74('0x42')]);var _0x409c24={'where':_0x1f6b77[_0x1a74('0x3d')]};return db[_0x1a74('0x43')][_0x1a74('0x23')](_0x409c24)[_0x1a74('0x29')](function(_0x3c0dfd){_0x2f2357[_0x1a74('0x23')]=_0x3c0dfd;if(_0x5d3d23['query'][_0x1a74('0x44')]){_0x1f6b77['include']=[{'all':!![]}];}return db[_0x1a74('0x43')]['findAll'](_0x1f6b77);})[_0x1a74('0x29')](function(_0x289d8b){_0x2f2357[_0x1a74('0x45')]=_0x289d8b;return _0x2f2357;})[_0x1a74('0x29')](respondWithFilteredResult(_0x1a32bc,_0x1f6b77))[_0x1a74('0x46')](handleError(_0x1a32bc,null));};exports[_0x1a74('0x47')]=function(_0x152839,_0x6de81c){var _0x5a4e70={'raw':![],'where':{'id':_0x152839[_0x1a74('0x48')]['id']}},_0x59d04a={};_0x59d04a[_0x1a74('0x34')]=_['keys'](db[_0x1a74('0x43')][_0x1a74('0x31')]);_0x59d04a[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x152839['query']);_0x59d04a[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x59d04a[_0x1a74('0x34')],_0x59d04a['query']);_0x5a4e70[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x59d04a[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x152839[_0x1a74('0x35')][_0x1a74('0x39')]));_0x5a4e70[_0x1a74('0x38')]=_0x5a4e70[_0x1a74('0x38')]['length']?_0x5a4e70[_0x1a74('0x38')]:_0x59d04a[_0x1a74('0x34')];if(_0x152839[_0x1a74('0x35')][_0x1a74('0x44')]){_0x5a4e70[_0x1a74('0x4a')]=[{'all':!![]}];}_0x5a4e70=_[_0x1a74('0x40')]({},_0x5a4e70,_0x152839[_0x1a74('0x42')]);return db[_0x1a74('0x43')]['find'](_0x5a4e70)[_0x1a74('0x29')](handleEntityNotFound(_0x6de81c,null))[_0x1a74('0x29')](respondWithResult(_0x6de81c,null))[_0x1a74('0x46')](handleError(_0x6de81c,null));};exports[_0x1a74('0x4b')]=function(_0x3eafc7,_0x5a66b3){return db['CmList'][_0x1a74('0x4b')](_0x3eafc7['body'],{})['then'](function(_0x3692d6){var _0x1aed33=_0x3eafc7['user'][_0x1a74('0x2a')]({'plain':!![]});if(!_0x1aed33)throw new Error(_0x1a74('0x4c'));if(_0x1aed33[_0x1a74('0x4d')]==='user'){var _0x173b43=_0x3692d6[_0x1a74('0x2a')]({'plain':!![]});var _0xe5db6=_0x1a74('0x2b');return db[_0x1a74('0x4e')]['find']({'where':{'name':_0xe5db6,'userProfileId':_0x1aed33[_0x1a74('0x4f')]},'raw':!![]})['then'](function(_0x31950f){if(_0x31950f&&_0x31950f[_0x1a74('0x50')]===0x0){return db['UserProfileResource'][_0x1a74('0x4b')]({'name':_0x173b43[_0x1a74('0x2e')],'resourceId':_0x173b43['id'],'type':_0x31950f['name'],'sectionId':_0x31950f['id']},{})[_0x1a74('0x29')](function(){return _0x3692d6;});}else{return _0x3692d6;}})[_0x1a74('0x46')](function(_0xe47913){logger[_0x1a74('0x51')](_0x1a74('0x52'),_0xe47913);throw _0xe47913;});}return _0x3692d6;})[_0x1a74('0x29')](respondWithResult(_0x5a66b3,0xc9))[_0x1a74('0x46')](handleError(_0x5a66b3,null));};exports['update']=function(_0x4d5640,_0x23f3e7){if(_0x4d5640[_0x1a74('0x53')]['id']){delete _0x4d5640[_0x1a74('0x53')]['id'];}return db['CmList'][_0x1a74('0x54')]({'where':{'id':_0x4d5640['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x23f3e7,null))[_0x1a74('0x29')](saveUpdates(_0x4d5640[_0x1a74('0x53')],null))[_0x1a74('0x29')](respondWithResult(_0x23f3e7,null))[_0x1a74('0x46')](handleError(_0x23f3e7,null));};exports['destroy']=function(_0x52089c,_0x1ba85f){return db['CmList']['find']({'where':{'id':_0x52089c[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ba85f,null))[_0x1a74('0x29')](removeEntity(_0x1ba85f,null))[_0x1a74('0x46')](handleError(_0x1ba85f,null));};exports[_0x1a74('0x55')]=function(_0x678bff,_0x28f9be){return db[_0x1a74('0x43')][_0x1a74('0x55')]()['then'](respondWithResult(_0x28f9be,null))[_0x1a74('0x46')](handleError(_0x28f9be,null));};exports['addDisposition']=function(_0x29c39e,_0x1bd7a5,_0x3bb428){if(_0x29c39e[_0x1a74('0x53')]['id']){delete _0x29c39e['body']['id'];}return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x29c39e[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x1bd7a5,null))['then'](function(_0x25082e){if(_0x25082e){_0x29c39e['body']['ListId']=_0x25082e['id'];return db[_0x1a74('0x56')][_0x1a74('0x4b')](_0x29c39e[_0x1a74('0x53')]);}})[_0x1a74('0x29')](respondWithResult(_0x1bd7a5,null))[_0x1a74('0x46')](handleError(_0x1bd7a5,null));};exports[_0x1a74('0x57')]=function(_0x3a5370,_0x43d74e,_0x1e55da){var _0x4e3f88={'raw':![],'where':{}};var _0x35948f={};var _0x1789fb={'count':0x0,'rows':[]};return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x3a5370[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x43d74e,null))[_0x1a74('0x29')](function(_0x2f5836){if(_0x2f5836){_0x35948f[_0x1a74('0x34')]=_[_0x1a74('0x49')](db[_0x1a74('0x56')]['rawAttributes']);_0x35948f[_0x1a74('0x35')]=_['keys'](_0x3a5370[_0x1a74('0x35')]);_0x35948f[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x35948f[_0x1a74('0x34')],_0x35948f[_0x1a74('0x35')]);_0x4e3f88[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x35948f[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x3a5370[_0x1a74('0x35')][_0x1a74('0x39')]));_0x4e3f88[_0x1a74('0x38')]=_0x4e3f88['attributes'][_0x1a74('0x59')]?_0x4e3f88[_0x1a74('0x38')]:_0x35948f['model'];if(!_0x3a5370[_0x1a74('0x35')]['hasOwnProperty'](_0x1a74('0x3b'))){_0x4e3f88['limit']=qs[_0x1a74('0x24')](_0x3a5370[_0x1a74('0x35')][_0x1a74('0x24')]);_0x4e3f88[_0x1a74('0x21')]=qs['offset'](_0x3a5370['query'][_0x1a74('0x21')]);}_0x4e3f88[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x3a5370['query'][_0x1a74('0x3c')]);_0x4e3f88[_0x1a74('0x3d')]=qs[_0x1a74('0x36')](_[_0x1a74('0x3e')](_0x3a5370[_0x1a74('0x35')],_0x35948f[_0x1a74('0x36')]));_0x4e3f88[_0x1a74('0x3d')][_0x1a74('0x5b')]=_0x2f5836['id'];if(_0x3a5370[_0x1a74('0x35')][_0x1a74('0x3f')]){_0x4e3f88[_0x1a74('0x3d')]=_[_0x1a74('0x40')](_0x4e3f88[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x4e3f88[_0x1a74('0x38')],function(_0x41eb1a){var _0x3af208={};_0x3af208[_0x41eb1a]={'$like':'%'+_0x3a5370[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x3af208;})});}_0x4e3f88=_[_0x1a74('0x40')]({},_0x4e3f88,_0x3a5370[_0x1a74('0x42')]);return db[_0x1a74('0x56')][_0x1a74('0x23')]({'where':_0x4e3f88['where']})[_0x1a74('0x29')](function(_0x42a138){_0x1789fb[_0x1a74('0x23')]=_0x42a138;if(_0x3a5370[_0x1a74('0x35')][_0x1a74('0x44')]){_0x4e3f88['include']=[{'all':!![]}];}return db[_0x1a74('0x56')][_0x1a74('0x5c')](_0x4e3f88);})[_0x1a74('0x29')](function(_0x4ded41){_0x1789fb[_0x1a74('0x45')]=_0x4ded41;return _0x1789fb;});}})[_0x1a74('0x29')](respondWithFilteredResult(_0x43d74e,_0x4e3f88))[_0x1a74('0x46')](handleError(_0x43d74e,null));};exports[_0x1a74('0x5d')]=function(_0x179cd3,_0x10ef5f,_0x402012){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x179cd3[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x10ef5f,null))[_0x1a74('0x29')](function(_0x2db532){if(_0x2db532){return _0x2db532[_0x1a74('0x5d')](_0x179cd3['query']['ids']);}})[_0x1a74('0x29')](respondWithStatusCode(_0x10ef5f,null))[_0x1a74('0x46')](handleError(_0x10ef5f,null));};exports[_0x1a74('0x5e')]=function(_0x54ace3,_0x560c23,_0x9fe661){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x54ace3[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x560c23,null))['then'](function(_0x186332){if(_0x186332){var _0x2d7895=[];var _0x3e4594={'success':[],'errors':[]};return db[_0x1a74('0x5f')][_0x1a74('0x55')]()[_0x1a74('0x29')](function(_0x18d932){if(_0x54ace3[_0x1a74('0x53')][_0x1a74('0x60')]&&_[_0x1a74('0x61')](_0x54ace3[_0x1a74('0x53')][_0x1a74('0x60')])){if(_0x54ace3[_0x1a74('0x53')]['tags'][_0x1a74('0x59')]){_0x54ace3['body'][_0x1a74('0x60')]=_0x54ace3[_0x1a74('0x53')]['tags'][_0x1a74('0x62')](';')+';';}else{_0x54ace3[_0x1a74('0x53')]['tags']=null;}}else{_0x54ace3['body'][_0x1a74('0x60')]=null;}if(_0x54ace3['body']&&_[_0x1a74('0x61')](_0x54ace3[_0x1a74('0x53')])){for(var _0x47c42c=0x0;_0x47c42c<_0x54ace3['body'][_0x1a74('0x59')];_0x47c42c+=0x1){_0x54ace3['body'][_0x47c42c]['ListId']=_0x54ace3['params']['id'];_0x2d7895[_0x1a74('0x63')](_0x54ace3[_0x1a74('0x53')][_0x47c42c]);}return BPromise[_0x1a74('0x64')](_0x2d7895,function(_0x48d380){return db[_0x1a74('0x5f')][_0x1a74('0x4b')](_[_0x1a74('0x65')](_0x48d380,[_0x1a74('0x66'),'id'])||{},{'fields':_[_0x1a74('0x49')](_0x18d932),'raw':!![]})['then'](function(_0x5f1ebc){_0x3e4594['success']['push'](_0x5f1ebc['dataValues']);})[_0x1a74('0x46')](function(_0x4597ac){_0x3e4594[_0x1a74('0x67')][_0x1a74('0x63')]({'data':_0x48d380,'error':_0x4597ac[_0x1a74('0x68')]});});})[_0x1a74('0x29')](function(_0x15d2ff){return _0x3e4594;})[_0x1a74('0x46')](function(_0x49c49b){return _0x49c49b;});}else{_0x560c23[_0x1a74('0x1f')](0x190)['json']({'message':_0x1a74('0x69')});}});}})[_0x1a74('0x29')](respondWithResult(_0x560c23,null))[_0x1a74('0x46')](handleError(_0x560c23,null));};exports[_0x1a74('0x6a')]=function(_0x1cf0b4,_0x3f7d52,_0x213d0b){var _0x3da01d;return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x1cf0b4['params']['id']},'include':[{'model':db[_0x1a74('0x6b')],'as':_0x1a74('0x6c')}]})[_0x1a74('0x29')](handleEntityNotFound(_0x3f7d52,null))[_0x1a74('0x29')](function(_0xb724f9){if(_0xb724f9){_0x3da01d=_0xb724f9;return db['CmContact'][_0x1a74('0x31')];}})[_0x1a74('0x29')](function(_0x4f7a1f){if(_0x4f7a1f){var _0x464652={};var _0x3303ee={};_0x3303ee[_0x1a74('0x34')]=_['concat'](_['keys'](_0x4f7a1f),_[_0x1a74('0x30')](_0x3da01d[_0x1a74('0x6c')],function(_0x151472){return util[_0x1a74('0x6d')](_0x1a74('0x6e'),_0x151472['id']);}));_0x3303ee[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x1cf0b4['query']);_0x3303ee['filters']=_[_0x1a74('0x37')](_0x3303ee[_0x1a74('0x34')],_0x3303ee[_0x1a74('0x35')]);_0x464652['attributes']=_[_0x1a74('0x37')](_0x3303ee['model'],qs[_0x1a74('0x39')](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x39')]));_0x464652[_0x1a74('0x38')]=_0x464652['attributes'][_0x1a74('0x59')]?_0x464652[_0x1a74('0x38')]:_0x3303ee[_0x1a74('0x34')];if(!_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x464652[_0x1a74('0x24')]=qs[_0x1a74('0x24')](_0x1cf0b4[_0x1a74('0x35')]['limit']);_0x464652[_0x1a74('0x21')]=qs['offset'](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x21')]);}_0x464652[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x464652['where']=qs[_0x1a74('0x36')](_['pick'](_0x1cf0b4[_0x1a74('0x35')],_0x3303ee[_0x1a74('0x36')]));_0x464652['raw']=!![];if(_0x1cf0b4[_0x1a74('0x35')]['filter']){_0x464652['where']=_[_0x1a74('0x40')](_0x464652[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x464652['attributes'],function(_0x4a0234){var _0x23813d={};_0x23813d[_0x4a0234]={'$like':'%'+_0x1cf0b4[_0x1a74('0x35')]['filter']+'%'};return _0x23813d;})});}_0x464652=_[_0x1a74('0x40')]({},_0x464652,_0x1cf0b4[_0x1a74('0x42')]);return _0x3da01d[_0x1a74('0x6a')](_0x464652);}})[_0x1a74('0x29')](respondWithResult(_0x3f7d52,null))[_0x1a74('0x46')](handleError(_0x3f7d52,null));};exports[_0x1a74('0x6f')]=function(_0x3c0b60,_0x5827d3,_0x233ee9){var _0x496e45;var _0x5308c0;var _0x4f276b;var _0x145d7e=_0x3c0b60[_0x1a74('0x48')]['id'];csv_results=[];return db[_0x1a74('0x70')]['findAll']({'attributes':['id',_0x1a74('0x2e')],'raw':!![],'order':['OrderBy']})[_0x1a74('0x29')](function(_0x4011b5){_0x496e45=_0x4011b5;var _0x1d9e64=_[_0x1a74('0x49')](db['CmContact'][_0x1a74('0x31')]);return db[_0x1a74('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x1a74('0x71')]})[_0x1a74('0x29')](function(_0x5b15ad){_0x5308c0=_0x5b15ad;var _0x3e2b21=squel[_0x1a74('0x72')]()[_0x1a74('0x39')](_0x1d9e64)[_0x1a74('0x73')](_0x1a74('0x74'),'c')[_0x1a74('0x3d')](_0x1a74('0x75'),_0x145d7e)[_0x1a74('0x3d')](_0x1a74('0x76'))[_0x1a74('0x77')]();for(var _0x1b5b0f=0x0;_0x1b5b0f<_0x5308c0[_0x1a74('0x59')];_0x1b5b0f++){_0x3e2b21[_0x1a74('0x78')](_0x1a74('0x79')+_0x5308c0[_0x1b5b0f]['id'],_0x1a74('0x7a')+_0x5308c0[_0x1b5b0f][_0x1a74('0x71')]);}for(var _0x1b5b0f=0x0;_0x1b5b0f<_0x496e45[_0x1a74('0x59')];_0x1b5b0f++){_0x3e2b21['field'](squel['select']()[_0x1a74('0x78')](_0x1a74('0x7b'))[_0x1a74('0x73')](_0x1a74('0x7c'))[_0x1a74('0x3d')](_0x1a74('0x7d'),_0x496e45[_0x1b5b0f]['id'])['where'](_0x1a74('0x7e')),_0x1a74('0x7f')+_0x496e45[_0x1b5b0f][_0x1a74('0x2e')]);_0x3e2b21[_0x1a74('0x78')](squel[_0x1a74('0x72')]()[_0x1a74('0x78')]('description')['from'](_0x1a74('0x7c'))[_0x1a74('0x3d')](_0x1a74('0x7d'),_0x496e45[_0x1b5b0f]['id'])[_0x1a74('0x3d')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x496e45[_0x1b5b0f][_0x1a74('0x2e')]);}var _0x5cc43e=[];_0x5cc43e[_0x1a74('0x63')](_0x3e2b21[_0x1a74('0x80')]());BPromise[_0x1a74('0x64')](_0x5cc43e,handleQuery)['then'](function(_0x414ae3){handleQuery(_0x3e2b21[_0x1a74('0x80')]());var _0x502851=csv_results[0x0];if(!_[_0x1a74('0x81')](_0x502851)){var _0x4e64bc=toCsv(_0x502851);var _0x14a59c=Date[_0x1a74('0x82')]();fs['writeFileSync'](util[_0x1a74('0x6d')]('/tmp/list_%d_%s.csv',_0x145d7e,_0x14a59c),_0x4e64bc);_0x5827d3[_0x1a74('0x83')](_0x1a74('0x84'),'attachment;\x20filename='+util[_0x1a74('0x6d')]('list_%d_%s.csv',_0x145d7e,_0x14a59c));_0x5827d3['setHeader']('Content-type',_0x1a74('0x85'));return _0x5827d3[_0x1a74('0x86')](util[_0x1a74('0x6d')](_0x1a74('0x87'),_0x145d7e,_0x14a59c));}else{return _0x5827d3[_0x1a74('0x88')](0xcc);}});});});};exports['addCustomField']=function(_0x16e8a3,_0x1a187e,_0x2f52cf){var _0x288d05;delete _0x16e8a3[_0x1a74('0x53')]['id'];return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x16e8a3['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x1a187e,null))[_0x1a74('0x29')](function(_0x52e888){if(_0x52e888){return db[_0x1a74('0x89')][_0x1a74('0x8a')](function(_0x28c3a8){return db[_0x1a74('0x6b')]['create'](_0x16e8a3[_0x1a74('0x53')],{'transaction':_0x28c3a8})['then'](function(_0x2b6f36){_0x288d05=_0x2b6f36;return _0x52e888[_0x1a74('0x8b')](_0x2b6f36,{'transaction':_0x28c3a8});})['then'](function(){var _0x4c0147={'type':db[_0x1a74('0x8c')]['TEXT'],'transaction':_0x28c3a8};switch(_0x16e8a3[_0x1a74('0x53')][_0x1a74('0x33')]){case _0x1a74('0x8d'):_0x4c0147[_0x1a74('0x33')]=db[_0x1a74('0x8c')][_0x1a74('0x8e')];break;case'number':_0x4c0147[_0x1a74('0x33')]=db[_0x1a74('0x8c')][_0x1a74('0x8f')];break;case _0x1a74('0x90'):_0x4c0147[_0x1a74('0x33')]=db['Sequelize'][_0x1a74('0x91')];_0x4c0147[_0x1a74('0x92')]=![];break;default:}return db[_0x1a74('0x89')]['queryInterface'][_0x1a74('0x93')](_0x1a74('0x74'),util[_0x1a74('0x6d')](_0x1a74('0x94'),_0x288d05['id']),_0x4c0147);})['then'](function(){return _0x288d05;});});}})[_0x1a74('0x29')](respondWithResult(_0x1a187e,null))[_0x1a74('0x46')](handleError(_0x1a187e,null));};exports[_0x1a74('0x95')]=function(_0x5c972c,_0x47595c,_0x74915d){var _0x11ba92={};var _0x52aa00={};var _0x754078;var _0x3b6e63;return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x5c972c[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x47595c,null))['then'](function(_0x43435e){if(_0x43435e){_0x754078=_0x43435e;_0x52aa00['model']=_[_0x1a74('0x49')](db[_0x1a74('0x6b')]['rawAttributes']);_0x52aa00[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x5c972c[_0x1a74('0x35')]);_0x52aa00[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x52aa00[_0x1a74('0x34')],_0x52aa00[_0x1a74('0x35')]);_0x11ba92[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x52aa00['model'],qs[_0x1a74('0x39')](_0x5c972c[_0x1a74('0x35')]['fields']));_0x11ba92['attributes']=_0x11ba92['attributes'][_0x1a74('0x59')]?_0x11ba92[_0x1a74('0x38')]:_0x52aa00['model'];_0x11ba92[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x5c972c['query']['sort']);_0x11ba92[_0x1a74('0x3d')]=qs[_0x1a74('0x36')](_[_0x1a74('0x3e')](_0x5c972c['query'],_0x52aa00[_0x1a74('0x36')]));_0x11ba92['where']=_[_0x1a74('0x40')](_0x11ba92[_0x1a74('0x3d')],{'$or':[{'ListId':_0x43435e['id']},{'ListId':null}]});if(_0x5c972c[_0x1a74('0x35')]['filter']){_0x11ba92['where']=_[_0x1a74('0x40')](_0x11ba92[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x11ba92['attributes'],function(_0x3154cc){var _0x2ff09a={};_0x2ff09a[_0x3154cc]={'$like':'%'+_0x5c972c[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x2ff09a;})});}_0x11ba92=_[_0x1a74('0x40')]({},_0x11ba92,_0x5c972c['options']);return db[_0x1a74('0x6b')]['findAndCountAll'](_0x11ba92);}})['then'](respondWithResult(_0x47595c,null))['catch'](handleError(_0x47595c,null));};exports[_0x1a74('0x96')]=function(_0x792c23,_0x3a1d8f){return db['CmCustomField'][_0x1a74('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3a1d8f,null))[_0x1a74('0x29')](function(_0x52dff8){return _0x52dff8;})[_0x1a74('0x29')](respondWithResult(_0x3a1d8f,null))[_0x1a74('0x46')](handleError(_0x3a1d8f,null));};exports['addAgents']=function(_0x9d5217,_0x2cb7a6,_0x5ccc21){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x9d5217[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cb7a6,null))[_0x1a74('0x29')](function(_0x4bd86e){if(_0x4bd86e){return _0x4bd86e[_0x1a74('0x98')](_0x9d5217['body'][_0x1a74('0x66')],_[_0x1a74('0x65')](_0x9d5217[_0x1a74('0x53')],['ids','id'])||{})[_0x1a74('0x99')](function(_0x490858){for(var _0x528cba=0x0;_0x528cba<_0x9d5217['body'][_0x1a74('0x66')][_0x1a74('0x59')];_0x528cba+=0x1){socket['emit'](_0x1a74('0x9a'),{'UserId':Number(_0x9d5217[_0x1a74('0x53')]['ids'][_0x528cba]),'CmListId':Number(_0x9d5217[_0x1a74('0x48')]['id'])});}return _0x490858;});}})[_0x1a74('0x29')](respondWithResult(_0x2cb7a6,null))['catch'](handleError(_0x2cb7a6,null));};exports[_0x1a74('0x9b')]=function(_0x3b4396,_0xfa0fdd,_0x5a6402){return db['CmList'][_0x1a74('0x54')]({'where':{'id':_0x3b4396[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0xfa0fdd,null))['then'](function(_0x3ac377){if(_0x3ac377){return _0x3ac377[_0x1a74('0x9b')](_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')])[_0x1a74('0x29')](function(){if(_[_0x1a74('0x61')](_0x3b4396['query']['ids'])){for(var _0x5c176c=0x0;_0x5c176c<_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')][_0x1a74('0x59')];_0x5c176c+=0x1){socket[_0x1a74('0x9c')](_0x1a74('0x9d'),{'UserId':Number(_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')][_0x5c176c]),'CmListId':Number(_0x3b4396[_0x1a74('0x48')]['id'])});}}else{socket[_0x1a74('0x9c')](_0x1a74('0x9d'),{'UserId':Number(_0x3b4396['query']['ids']),'CmListId':Number(_0x3b4396[_0x1a74('0x48')]['id'])});}});}})[_0x1a74('0x29')](respondWithStatusCode(_0xfa0fdd,null))[_0x1a74('0x46')](handleError(_0xfa0fdd,null));};exports[_0x1a74('0x9e')]=function(_0x359fd5,_0x4bcc9d,_0xfb451b){var _0x3075bb={};var _0x19266a={};var _0x1c143c;var _0x476236;return db[_0x1a74('0x43')]['findOne']({'where':{'id':_0x359fd5['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x4bcc9d,null))[_0x1a74('0x29')](function(_0x4257f3){if(_0x4257f3){_0x1c143c=_0x4257f3;_0x19266a[_0x1a74('0x34')]=_[_0x1a74('0x49')](db[_0x1a74('0x9f')][_0x1a74('0x31')]);_0x19266a[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x359fd5['query']);_0x19266a[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x19266a[_0x1a74('0x34')],_0x19266a[_0x1a74('0x35')]);_0x3075bb[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x19266a[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x359fd5['query'][_0x1a74('0x39')]));_0x3075bb[_0x1a74('0x38')]=_0x3075bb[_0x1a74('0x38')]['length']?_0x3075bb[_0x1a74('0x38')]:_0x19266a[_0x1a74('0x34')];_0x3075bb[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x359fd5[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x3075bb['where']=qs[_0x1a74('0x36')](_['pick'](_0x359fd5[_0x1a74('0x35')],_0x19266a[_0x1a74('0x36')]));if(_0x359fd5['query'][_0x1a74('0x3f')]){_0x3075bb[_0x1a74('0x3d')]=_['merge'](_0x3075bb['where'],{'$or':_['map'](_0x3075bb[_0x1a74('0x38')],function(_0x99365e){var _0x872660={};_0x872660[_0x99365e]={'$like':'%'+_0x359fd5['query'][_0x1a74('0x3f')]+'%'};return _0x872660;})});}_0x3075bb=_[_0x1a74('0x40')]({},_0x3075bb,_0x359fd5[_0x1a74('0x42')]);return _0x1c143c[_0x1a74('0x9e')](_0x3075bb);}})['then'](function(_0x15fd06){if(_0x15fd06){_0x476236=_0x15fd06[_0x1a74('0x59')];if(!_0x359fd5[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x3075bb[_0x1a74('0x24')]=qs[_0x1a74('0x24')](_0x359fd5[_0x1a74('0x35')]['limit']);_0x3075bb['offset']=qs[_0x1a74('0x21')](_0x359fd5[_0x1a74('0x35')][_0x1a74('0x21')]);}return _0x1c143c[_0x1a74('0x9e')](_0x3075bb);}})[_0x1a74('0x29')](function(_0x4fb300){if(_0x4fb300){return _0x4fb300?{'count':_0x476236,'rows':_0x4fb300}:null;}})[_0x1a74('0x29')](respondWithResult(_0x4bcc9d,null))[_0x1a74('0x46')](handleError(_0x4bcc9d,null));};function handleQuery(_0x5be23b){logger['info'](_0x5be23b);return db[_0x1a74('0x89')][_0x1a74('0x35')](_0x5be23b)['spread'](function(_0x7d2276){csv_results['push'](_0x7d2276);})[_0x1a74('0x46')](function(_0x1f4f6f){logger['error'](_0x1f4f6f[_0x1a74('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e13b365..57e9f6e 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x29913b,_0x1bb01e){_0x29913b=_0x29913b-0x0;var _0x1a5250=_0x3e74[_0x29913b];return _0x1a5250;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5b53cb,_0x35a751){_0x5b53cb=_0x5b53cb-0x0;var _0x5a160d=_0x3e74[_0x5b53cb];return _0x5a160d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f6ce284..cf8be00 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 _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x15b529,_0x5722f8){var _0x47f49d=function(_0x204878){while(--_0x204878){_0x15b529['push'](_0x15b529['shift']());}};_0x47f49d(++_0x5722f8);}(_0xf109,0xce));var _0x9f10=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xf109[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14e36e,_0x4f7b4d){_0x14e36e=_0x14e36e-0x0;var _0x885cab=_0x6f0d[_0x14e36e];return _0x885cab;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c7ec061..5f5e484 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 _0x102a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x102a,0x1da));var _0xa102=function(_0xde195,_0x51a20b){_0xde195=_0xde195-0x0;var _0x2bde6e=_0x102a[_0xde195];return _0x2bde6e;};'use strict';var _=require('lodash');var util=require(_0xa102('0x0'));var moment=require('moment');var BPromise=require(_0xa102('0x1'));var rs=require(_0xa102('0x2'));var fs=require('fs');var Redis=require(_0xa102('0x3'));var db=require(_0xa102('0x4'))['db'];var utils=require(_0xa102('0x5'));var logger=require(_0xa102('0x6'))(_0xa102('0x7'));var config=require(_0xa102('0x8'));var jayson=require(_0xa102('0x9'));var client=jayson[_0xa102('0xa')][_0xa102('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa102('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa102('0xd'))(new Redis(config[_0xa102('0xc')]));require(_0xa102('0xe'))[_0xa102('0xf')](socket);function respondWithRpcPromise(_0x3a5616,_0x9cb14f,_0x225924){return new BPromise(function(_0x4717ea,_0x5cf73c){return client[_0xa102('0x10')](_0x3a5616,_0x225924)[_0xa102('0x11')](function(_0x479d50){logger[_0xa102('0x12')](_0xa102('0x13'),_0x9cb14f,'request\x20sent');logger['debug'](_0xa102('0x14'),_0x9cb14f,_0xa102('0x15'),JSON[_0xa102('0x16')](_0x479d50));if(_0x479d50[_0xa102('0x17')]){if(_0x479d50['error'][_0xa102('0x18')]===0x1f4){logger[_0xa102('0x17')](_0xa102('0x13'),_0x9cb14f,_0x479d50['error'][_0xa102('0x19')]);return _0x5cf73c(_0x479d50[_0xa102('0x17')][_0xa102('0x19')]);}logger[_0xa102('0x17')](_0xa102('0x13'),_0x9cb14f,_0x479d50['error'][_0xa102('0x19')]);return _0x4717ea(_0x479d50['error'][_0xa102('0x19')]);}else{logger[_0xa102('0x12')]('CmList,\x20%s,\x20%s',_0x9cb14f,_0xa102('0x15'));_0x4717ea(_0x479d50[_0xa102('0x1a')][_0xa102('0x19')]);}})[_0xa102('0x1b')](function(_0xf90afd){logger['error'](_0xa102('0x13'),_0x9cb14f,_0xf90afd);_0x5cf73c(_0xf90afd);});});} \ No newline at end of file +var _0x1080=['../../mysqldb','../../config/logger','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39a7d8,_0x4cba9b){var _0x121e07=function(_0x30efcb){while(--_0x30efcb){_0x39a7d8['push'](_0x39a7d8['shift']());}};_0x121e07(++_0x4cba9b);}(_0x1080,0x1d5));var _0x0108=function(_0x48163f,_0x504381){_0x48163f=_0x48163f-0x0;var _0x1f966a=_0x1080[_0x48163f];return _0x1f966a;};'use strict';var _=require(_0x0108('0x0'));var util=require(_0x0108('0x1'));var moment=require(_0x0108('0x2'));var BPromise=require(_0x0108('0x3'));var rs=require(_0x0108('0x4'));var fs=require('fs');var Redis=require(_0x0108('0x5'));var db=require(_0x0108('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0108('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0108('0x8')]({'port':0x232a});config[_0x0108('0x9')]=_[_0x0108('0xa')](config['redis'],{'host':_0x0108('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0108('0x9')]));require(_0x0108('0xc'))[_0x0108('0xd')](socket);function respondWithRpcPromise(_0x3b7741,_0x45efdc,_0x2078d2){return new BPromise(function(_0x5994c6,_0x152d20){return client[_0x0108('0xe')](_0x3b7741,_0x2078d2)[_0x0108('0xf')](function(_0xd077c9){logger[_0x0108('0x10')]('CmList,\x20%s,\x20%s',_0x45efdc,'request\x20sent');logger[_0x0108('0x11')](_0x0108('0x12'),_0x45efdc,'request\x20sent',JSON[_0x0108('0x13')](_0xd077c9));if(_0xd077c9[_0x0108('0x14')]){if(_0xd077c9['error'][_0x0108('0x15')]===0x1f4){logger['error'](_0x0108('0x16'),_0x45efdc,_0xd077c9[_0x0108('0x14')][_0x0108('0x17')]);return _0x152d20(_0xd077c9['error']['message']);}logger[_0x0108('0x14')](_0x0108('0x16'),_0x45efdc,_0xd077c9[_0x0108('0x14')][_0x0108('0x17')]);return _0x5994c6(_0xd077c9['error']['message']);}else{logger[_0x0108('0x10')](_0x0108('0x16'),_0x45efdc,_0x0108('0x18'));_0x5994c6(_0xd077c9['result'][_0x0108('0x17')]);}})['catch'](function(_0x289881){logger[_0x0108('0x14')](_0x0108('0x16'),_0x45efdc,_0x289881);_0x152d20(_0x289881);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6e8d2ed..85cc94a 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 _0xfbfc=['removeListener','register','length','save','remove','update'];(function(_0xd5b40b,_0x5e6803){var _0x52e2b1=function(_0x366c87){while(--_0x366c87){_0xd5b40b['push'](_0xd5b40b['shift']());}};_0x52e2b1(++_0x5e6803);}(_0xfbfc,0x1d7));var _0xcfbf=function(_0x144e4a,_0x1147d2){_0x144e4a=_0x144e4a-0x0;var _0x532bb0=_0xfbfc[_0x144e4a];return _0x532bb0;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcfbf('0x0'),_0xcfbf('0x1'),_0xcfbf('0x2')];function createListener(_0xe8f88e,_0x3d3993){return function(_0x5e8465){_0x3d3993['emit'](_0xe8f88e,_0x5e8465);};}function removeListener(_0x1154b5,_0x4a3596){return function(){CmListEvents[_0xcfbf('0x3')](_0x1154b5,_0x4a3596);};}exports[_0xcfbf('0x4')]=function(_0x337f23){for(var _0x43042b=0x0,_0xf4ea9d=events[_0xcfbf('0x5')];_0x43042b<_0xf4ea9d;_0x43042b++){var _0x1fc0dc=events[_0x43042b];var _0x16f6cc=createListener('cmList:'+_0x1fc0dc,_0x337f23);CmListEvents['on'](_0x1fc0dc,_0x16f6cc);}}; \ No newline at end of file +var _0x7c5e=['length','cmList:','save','remove','update','emit'];(function(_0x2f3e6a,_0x51af26){var _0x32a113=function(_0x525dd6){while(--_0x525dd6){_0x2f3e6a['push'](_0x2f3e6a['shift']());}};_0x32a113(++_0x51af26);}(_0x7c5e,0xaa));var _0xe7c5=function(_0x360266,_0x5b97de){_0x360266=_0x360266-0x0;var _0x286702=_0x7c5e[_0x360266];return _0x286702;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xe7c5('0x0'),_0xe7c5('0x1'),_0xe7c5('0x2')];function createListener(_0x138287,_0x99dcfc){return function(_0x1fd9ab){_0x99dcfc[_0xe7c5('0x3')](_0x138287,_0x1fd9ab);};}function removeListener(_0x1999b4,_0x885280){return function(){CmListEvents['removeListener'](_0x1999b4,_0x885280);};}exports['register']=function(_0xed1b2c){for(var _0x175771=0x0,_0x5d6f68=events[_0xe7c5('0x4')];_0x175771<_0x5d6f68;_0x175771++){var _0x1cb5ff=events[_0x175771];var _0x1c5baa=createListener(_0xe7c5('0x5')+_0x1cb5ff,_0xed1b2c);CmListEvents['on'](_0x1cb5ff,_0x1c5baa);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 496c29f..fb77b97 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 _0x3de3=['create','post','/:id/dispositions','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents'];(function(_0x11c37c,_0x38e361){var _0x5a6f40=function(_0x157788){while(--_0x157788){_0x11c37c['push'](_0x11c37c['shift']());}};_0x5a6f40(++_0x38e361);}(_0x3de3,0x135));var _0x33de=function(_0x3d3598,_0x108dd6){_0x3d3598=_0x3d3598-0x0;var _0x4f99be=_0x3de3[_0x3d3598];return _0x4f99be;};'use strict';var multer=require('multer');var util=require(_0x33de('0x0'));var path=require('path');var timeout=require(_0x33de('0x1'));var express=require(_0x33de('0x2'));var router=express[_0x33de('0x3')]();var fs_extra=require(_0x33de('0x4'));var auth=require(_0x33de('0x5'));var interaction=require(_0x33de('0x6'));var config=require(_0x33de('0x7'));var controller=require(_0x33de('0x8'));router[_0x33de('0x9')]('/',auth['isAuthenticated'](),controller[_0x33de('0xa')]);router[_0x33de('0x9')]('/describe',auth[_0x33de('0xb')](),controller[_0x33de('0xc')]);router[_0x33de('0x9')](_0x33de('0xd'),auth[_0x33de('0xb')](),controller[_0x33de('0xe')]);router[_0x33de('0x9')](_0x33de('0xf'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x33de('0xb')](),controller[_0x33de('0x10')]);router[_0x33de('0x9')](_0x33de('0x11'),auth['isAuthenticated'](),controller[_0x33de('0x12')]);router[_0x33de('0x9')](_0x33de('0x13'),auth['isAuthenticated'](),controller[_0x33de('0x14')]);router[_0x33de('0x9')]('/:id/fields',auth[_0x33de('0xb')](),controller[_0x33de('0x15')]);router[_0x33de('0x9')](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x17')]);router['post']('/',auth[_0x33de('0xb')](),controller[_0x33de('0x18')]);router[_0x33de('0x19')](_0x33de('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x33de('0x11'),auth['isAuthenticated'](),controller[_0x33de('0x1b')]);router[_0x33de('0x19')](_0x33de('0x1c'),auth[_0x33de('0xb')](),controller[_0x33de('0x1d')]);router['post'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x1e')]);router[_0x33de('0x1f')](_0x33de('0xf'),auth[_0x33de('0xb')](),controller['update']);router[_0x33de('0x20')](_0x33de('0xf'),auth[_0x33de('0xb')](),controller[_0x33de('0x21')]);router[_0x33de('0x20')](_0x33de('0x1a'),auth[_0x33de('0xb')](),controller[_0x33de('0x22')]);router[_0x33de('0x20')]('/:id/users',auth[_0x33de('0xb')](),controller[_0x33de('0x23')]);module[_0x33de('0x24')]=router; \ No newline at end of file +var _0xc0e6=['addCustomField','addAgents','put','/:id','update','delete','removeDispositions','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','getDispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','post'];(function(_0x394dfc,_0x160ee7){var _0x40373b=function(_0x356bc6){while(--_0x356bc6){_0x394dfc['push'](_0x394dfc['shift']());}};_0x40373b(++_0x160ee7);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xc0e6[_0x1a7846];return _0x48049;};'use strict';var multer=require('multer');var util=require(_0x6c0e('0x0'));var path=require('path');var timeout=require(_0x6c0e('0x1'));var express=require(_0x6c0e('0x2'));var router=express[_0x6c0e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c0e('0x4'));var config=require(_0x6c0e('0x5'));var controller=require(_0x6c0e('0x6'));router[_0x6c0e('0x7')]('/',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x9')]);router[_0x6c0e('0x7')](_0x6c0e('0xa'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xb')]);router[_0x6c0e('0x7')](_0x6c0e('0xc'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xd')]);router[_0x6c0e('0x7')]('/:id',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xe')]);router[_0x6c0e('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6c0e('0xf')]);router[_0x6c0e('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x6c0e('0x10')]);router['get']('/:id/contacts/csv',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x11')]);router[_0x6c0e('0x7')](_0x6c0e('0x12'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x13')]);router['get'](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c0e('0x16')]);router['post'](_0x6c0e('0x17'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x18')]);router['post'](_0x6c0e('0x19'),auth['isAuthenticated'](),controller[_0x6c0e('0x1a')]);router[_0x6c0e('0x1b')](_0x6c0e('0x12'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x1c')]);router[_0x6c0e('0x1b')](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x1d')]);router[_0x6c0e('0x1e')](_0x6c0e('0x1f'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x20')]);router['delete'](_0x6c0e('0x1f'),auth[_0x6c0e('0x8')](),controller['destroy']);router[_0x6c0e('0x21')](_0x6c0e('0x17'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x22')]);router[_0x6c0e('0x21')](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller['removeAgents']);module[_0x6c0e('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d3b7028..4406049 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 _0x5169=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x222077,_0x180f7c){var _0x59bf61=function(_0x1f4703){while(--_0x1f4703){_0x222077['push'](_0x222077['shift']());}};_0x59bf61(++_0x180f7c);}(_0x5169,0x1e8));var _0x9516=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5169[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x9516('0x0'));module[_0x9516('0x1')]={'name':{'type':Sequelize[_0x9516('0x2')],'get':function(_0x243ed1){return this['getDataValue'](_0x9516('0x3'));}},'field':{'type':Sequelize[_0x9516('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x9516('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x9516('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x86f3=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4a4bf7,_0x53851a){var _0x5e3463=function(_0x7f16ea){while(--_0x7f16ea){_0x4a4bf7['push'](_0x4a4bf7['shift']());}};_0x5e3463(++_0x53851a);}(_0x86f3,0x19f));var _0x386f=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x86f3[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require('sequelize');module[_0x386f('0x0')]={'name':{'type':Sequelize[_0x386f('0x1')],'get':function(_0x4e88e6){return this[_0x386f('0x2')](_0x386f('0x3'));}},'field':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0ca9f79..0e2512f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4792a1,_0x2d44cc){var _0x3eec6f=function(_0x139d65){while(--_0x139d65){_0x4792a1['push'](_0x4792a1['shift']());}};_0x3eec6f(++_0x2d44cc);}(_0x7a54,0x106));var _0x47a5=function(_0x1e29b1,_0x315d48){_0x1e29b1=_0x1e29b1-0x0;var _0x29bf12=_0x7a54[_0x1e29b1];return _0x29bf12;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x5c288b,_0x58c41d){var _0x53b062=function(_0x348a74){while(--_0x348a74){_0x5c288b['push'](_0x5c288b['shift']());}};_0x53b062(++_0x58c41d);}(_0x7a54,0x106));var _0x47a5=function(_0x2ea490,_0x7d9611){_0x2ea490=_0x2ea490-0x0;var _0x2b01b8=_0x7a54[_0x2ea490];return _0x2b01b8;};'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 b1b24c0..9b674ad 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 _0x813e=['api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger'];(function(_0x3e93f1,_0x284184){var _0x3525ac=function(_0x1887bc){while(--_0x1887bc){_0x3e93f1['push'](_0x3e93f1['shift']());}};_0x3525ac(++_0x284184);}(_0x813e,0x1df));var _0xe813=function(_0x3705f7,_0x2553c4){_0x3705f7=_0x3705f7-0x0;var _0x2a1cf2=_0x813e[_0x3705f7];return _0x2a1cf2;};'use strict';var _=require(_0xe813('0x0'));var util=require('util');var logger=require(_0xe813('0x1'))(_0xe813('0x2'));var moment=require(_0xe813('0x3'));var BPromise=require(_0xe813('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe813('0x5'));var rimraf=require(_0xe813('0x6'));var config=require(_0xe813('0x7'));var attributes=require(_0xe813('0x8'));module[_0xe813('0x9')]=function(_0x1c75bf,_0x2fe8e1){return _0x1c75bf[_0xe813('0xa')](_0xe813('0xb'),attributes,{'tableName':_0xe813('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7228=['tools_conditions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','Condition'];(function(_0x300291,_0x447d63){var _0x5df13e=function(_0x27092c){while(--_0x27092c){_0x300291['push'](_0x300291['shift']());}};_0x5df13e(++_0x447d63);}(_0x7228,0x10f));var _0x8722=function(_0x2b6cbc,_0x477292){_0x2b6cbc=_0x2b6cbc-0x0;var _0x49d8c9=_0x7228[_0x2b6cbc];return _0x49d8c9;};'use strict';var _=require(_0x8722('0x0'));var util=require('util');var logger=require(_0x8722('0x1'))('api');var moment=require(_0x8722('0x2'));var BPromise=require(_0x8722('0x3'));var rp=require(_0x8722('0x4'));var fs=require('fs');var path=require(_0x8722('0x5'));var rimraf=require(_0x8722('0x6'));var config=require(_0x8722('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0xe5f871,_0xabacc6){return _0xe5f871['define'](_0x8722('0x8'),attributes,{'tableName':_0x8722('0x9'),'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 d35558b..dbabbc0 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 _0xc628=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5b7894,_0x11407d){var _0x586c97=function(_0x71bbd2){while(--_0x71bbd2){_0x5b7894['push'](_0x5b7894['shift']());}};_0x586c97(++_0x11407d);}(_0xc628,0x1c7));var _0x8c62=function(_0x2e2b5f,_0x21e1e3){_0x2e2b5f=_0x2e2b5f-0x0;var _0x43b961=_0xc628[_0x2e2b5f];return _0x43b961;};'use strict';var _=require(_0x8c62('0x0'));var util=require(_0x8c62('0x1'));var moment=require(_0x8c62('0x2'));var BPromise=require(_0x8c62('0x3'));var rs=require(_0x8c62('0x4'));var fs=require('fs');var Redis=require(_0x8c62('0x5'));var db=require(_0x8c62('0x6'))['db'];var utils=require(_0x8c62('0x7'));var logger=require(_0x8c62('0x8'))(_0x8c62('0x9'));var config=require(_0x8c62('0xa'));var jayson=require(_0x8c62('0xb'));var client=jayson[_0x8c62('0xc')][_0x8c62('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x12ad35,_0x2c1450,_0x530b0f){return new BPromise(function(_0x1f2cfc,_0x37646f){return client['request'](_0x12ad35,_0x530b0f)['then'](function(_0x47a6d5){logger['info'](_0x8c62('0xe'),_0x2c1450,_0x8c62('0xf'));logger[_0x8c62('0x10')](_0x8c62('0x11'),_0x2c1450,_0x8c62('0xf'),JSON[_0x8c62('0x12')](_0x47a6d5));if(_0x47a6d5[_0x8c62('0x13')]){if(_0x47a6d5['error'][_0x8c62('0x14')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x2c1450,_0x47a6d5[_0x8c62('0x13')]['message']);return _0x37646f(_0x47a6d5[_0x8c62('0x13')][_0x8c62('0x15')]);}logger[_0x8c62('0x13')]('Condition,\x20%s,\x20%s',_0x2c1450,_0x47a6d5[_0x8c62('0x13')]['message']);return _0x1f2cfc(_0x47a6d5[_0x8c62('0x13')][_0x8c62('0x15')]);}else{logger['info'](_0x8c62('0xe'),_0x2c1450,'request\x20sent');_0x1f2cfc(_0x47a6d5[_0x8c62('0x16')][_0x8c62('0x15')]);}})[_0x8c62('0x17')](function(_0x38d195){logger['error'](_0x8c62('0xe'),_0x2c1450,_0x38d195);_0x37646f(_0x38d195);});});} \ No newline at end of file +var _0x0473=['debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x0473,0x158));var _0x3047=function(_0x1cedfe,_0x4d841){_0x1cedfe=_0x1cedfe-0x0;var _0xa0510f=_0x0473[_0x1cedfe];return _0xa0510f;};'use strict';var _=require(_0x3047('0x0'));var util=require('util');var moment=require(_0x3047('0x1'));var BPromise=require('bluebird');var rs=require(_0x3047('0x2'));var fs=require('fs');var Redis=require(_0x3047('0x3'));var db=require(_0x3047('0x4'))['db'];var utils=require(_0x3047('0x5'));var logger=require('../../config/logger')(_0x3047('0x6'));var config=require(_0x3047('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3047('0x8')][_0x3047('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c0cd,_0xbcec1d,_0x30a737){return new BPromise(function(_0xddc5ae,_0xb4d19b){return client[_0x3047('0xa')](_0x19c0cd,_0x30a737)['then'](function(_0xcbed5e){logger[_0x3047('0xb')](_0x3047('0xc'),_0xbcec1d,'request\x20sent');logger[_0x3047('0xd')](_0x3047('0xe'),_0xbcec1d,_0x3047('0xf'),JSON[_0x3047('0x10')](_0xcbed5e));if(_0xcbed5e['error']){if(_0xcbed5e[_0x3047('0x11')]['code']===0x1f4){logger[_0x3047('0x11')](_0x3047('0xc'),_0xbcec1d,_0xcbed5e[_0x3047('0x11')]['message']);return _0xb4d19b(_0xcbed5e[_0x3047('0x11')][_0x3047('0x12')]);}logger[_0x3047('0x11')](_0x3047('0xc'),_0xbcec1d,_0xcbed5e[_0x3047('0x11')][_0x3047('0x12')]);return _0xddc5ae(_0xcbed5e['error'][_0x3047('0x12')]);}else{logger['info'](_0x3047('0xc'),_0xbcec1d,'request\x20sent');_0xddc5ae(_0xcbed5e[_0x3047('0x13')][_0x3047('0x12')]);}})[_0x3047('0x14')](function(_0x5d8425){logger['error'](_0x3047('0xc'),_0xbcec1d,_0x5d8425);_0xb4d19b(_0x5d8425);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1e03cc1..4b4cee5 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 _0xc554=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','multer'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xc554,0x8b));var _0x4c55=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0xc554[_0xaf25ae];return _0x49732d;};'use strict';var multer=require(_0x4c55('0x0'));var util=require('util');var path=require(_0x4c55('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c55('0x2'));var router=express[_0x4c55('0x3')]();var fs_extra=require(_0x4c55('0x4'));var auth=require(_0x4c55('0x5'));var interaction=require(_0x4c55('0x6'));var config=require(_0x4c55('0x7'));var controller=require('./condition.controller');router[_0x4c55('0x8')](_0x4c55('0x9'),auth[_0x4c55('0xa')](),controller[_0x4c55('0xb')]);router[_0x4c55('0xc')](_0x4c55('0x9'),auth[_0x4c55('0xa')](),controller['destroy']);module[_0x4c55('0xd')]=router; \ No newline at end of file +var _0x4736=['../../config/environment','./condition.controller','put','isAuthenticated','update','/:id','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x4736,0x13c));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6473('0x0'));var path=require(_0x6473('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6473('0x2')]();var fs_extra=require(_0x6473('0x3'));var auth=require(_0x6473('0x4'));var interaction=require(_0x6473('0x5'));var config=require(_0x6473('0x6'));var controller=require(_0x6473('0x7'));router[_0x6473('0x8')]('/:id',auth[_0x6473('0x9')](),controller[_0x6473('0xa')]);router['delete'](_0x6473('0xb'),auth[_0x6473('0x9')](),controller[_0x6473('0xc')]);module[_0x6473('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 046649f..567a37e 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x887c=['sequelize','exports','STRING'];(function(_0x1b670b,_0x3a5514){var _0xd829c6=function(_0x586bc0){while(--_0x586bc0){_0x1b670b['push'](_0x1b670b['shift']());}};_0xd829c6(++_0x3a5514);}(_0x887c,0x150));var _0xc887=function(_0x2b51c2,_0x401991){_0x2b51c2=_0x2b51c2-0x0;var _0x234ecd=_0x887c[_0x2b51c2];return _0x234ecd;};'use strict';var Sequelize=require(_0xc887('0x0'));module[_0xc887('0x1')]={'name':{'type':Sequelize[_0xc887('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc887('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x57a1=['sequelize','STRING','INTEGER'];(function(_0x484512,_0x592069){var _0x28c188=function(_0x56d32c){while(--_0x56d32c){_0x484512['push'](_0x484512['shift']());}};_0x28c188(++_0x592069);}(_0x57a1,0x93));var _0x157a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x57a1[_0x2ca616];return _0x53155f;};'use strict';var Sequelize=require(_0x157a('0x0'));module['exports']={'name':{'type':Sequelize[_0x157a('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x157a('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x157a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index a97e7b6..0eb6903 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['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','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','update','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x30ee08,_0x41076c){var _0x408e77=function(_0x43146f){while(--_0x43146f){_0x30ee08['push'](_0x30ee08['shift']());}};_0x408e77(++_0x41076c);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd91aea,_0x90202d){_0xd91aea=_0xd91aea-0x0;var _0xed7cb0=_0x0b0e[_0xd91aea];return _0xed7cb0;};'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(){var _0x28586d=_0x503883['get']({'plain':!![]});var _0x3e5c88='ContactItemTypes';return db[_0xe0b0('0x25')]['destroy']({'where':{'type':_0x3e5c88,'resourceId':_0x28586d['id']}})[_0xe0b0('0x23')](function(){return _0x503883;});})['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)[_0xe0b0('0x19')]();});}};}function handleEntityNotFound(_0x1f1ebd,_0x1d91ad){return function(_0x3ec2){if(!_0x3ec2){_0x1f1ebd[_0xe0b0('0x18')](0x194);}return _0x3ec2;};}function handleError(_0x5200a6,_0x1444b9){_0x1444b9=_0x1444b9||0x1f4;return function(_0x1b8aa8){logger['error'](_0x1b8aa8[_0xe0b0('0x26')]);if(_0x1b8aa8[_0xe0b0('0x27')]){delete _0x1b8aa8[_0xe0b0('0x27')];}_0x5200a6[_0xe0b0('0x1a')](_0x1444b9)[_0xe0b0('0x28')](_0x1b8aa8);};}exports[_0xe0b0('0x29')]=function(_0x136bd4,_0x4fb3b7){var _0x1854b8={},_0x3c0109={},_0x48a9b5={'count':0x0,'rows':[]};var _0x4fe400=_[_0xe0b0('0x2a')](db[_0xe0b0('0x2b')][_0xe0b0('0x2c')],function(_0x3f81d5){return{'name':_0x3f81d5[_0xe0b0('0x2d')],'type':_0x3f81d5['type'][_0xe0b0('0x2e')]};});_0x3c0109[_0xe0b0('0x2f')]=_[_0xe0b0('0x2a')](_0x4fe400,_0xe0b0('0x27'));_0x3c0109[_0xe0b0('0x30')]=_['keys'](_0x136bd4[_0xe0b0('0x30')]);_0x3c0109[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],_0x3c0109[_0xe0b0('0x30')]);_0x1854b8[_0xe0b0('0x33')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x1854b8[_0xe0b0('0x33')]=_0x1854b8[_0xe0b0('0x33')][_0xe0b0('0x35')]?_0x1854b8[_0xe0b0('0x33')]:_0x3c0109['model'];if(!_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x36')](_0xe0b0('0x37'))){_0x1854b8[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x1d')]);_0x1854b8['offset']=qs['offset'](_0x136bd4['query']['offset']);}_0x1854b8[_0xe0b0('0x38')]=qs[_0xe0b0('0x39')](_0x136bd4[_0xe0b0('0x30')]['sort']);_0x1854b8[_0xe0b0('0x3a')]=qs[_0xe0b0('0x31')](_[_0xe0b0('0x3b')](_0x136bd4[_0xe0b0('0x30')],_0x3c0109['filters']),_0x4fe400);if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x3c')]){_0x1854b8[_0xe0b0('0x3a')]=_[_0xe0b0('0x3d')](_0x1854b8[_0xe0b0('0x3a')],{'$or':_[_0xe0b0('0x2a')](_0x4fe400,function(_0x8b745){if(_0x8b745[_0xe0b0('0x3e')]!==_0xe0b0('0x3f')){var _0x54f251={};_0x54f251[_0x8b745[_0xe0b0('0x27')]]={'$like':'%'+_0x136bd4['query'][_0xe0b0('0x3c')]+'%'};return _0x54f251;}})});}_0x1854b8=_[_0xe0b0('0x3d')]({},_0x1854b8,_0x136bd4[_0xe0b0('0x40')]);var _0x74f3fa={'where':_0x1854b8['where']};return db[_0xe0b0('0x2b')][_0xe0b0('0x41')](_0x74f3fa)[_0xe0b0('0x23')](function(_0x402a0e){_0x48a9b5[_0xe0b0('0x41')]=_0x402a0e;if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x42')]){_0x1854b8[_0xe0b0('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe0b0('0x44')](_0x1854b8);})[_0xe0b0('0x23')](function(_0x528818){_0x48a9b5['rows']=_0x528818;return _0x48a9b5;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x4fb3b7,_0x1854b8))[_0xe0b0('0x45')](handleError(_0x4fb3b7,null));};exports['show']=function(_0x18a59d,_0x285d61){var _0x6bca5c={'raw':!![],'where':{'id':_0x18a59d[_0xe0b0('0x46')]['id']}},_0x1c869d={};_0x1c869d['model']=_['keys'](db['ContactItemType'][_0xe0b0('0x2c')]);_0x1c869d[_0xe0b0('0x30')]=_['keys'](_0x18a59d[_0xe0b0('0x30')]);_0x1c869d[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x1c869d[_0xe0b0('0x2f')],_0x1c869d[_0xe0b0('0x30')]);_0x6bca5c['attributes']=_['intersection'](_0x1c869d[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x18a59d[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x6bca5c[_0xe0b0('0x33')]=_0x6bca5c['attributes'][_0xe0b0('0x35')]?_0x6bca5c[_0xe0b0('0x33')]:_0x1c869d['model'];if(_0x18a59d['query']['includeAll']){_0x6bca5c[_0xe0b0('0x43')]=[{'all':!![]}];}_0x6bca5c=_[_0xe0b0('0x3d')]({},_0x6bca5c,_0x18a59d[_0xe0b0('0x40')]);return db[_0xe0b0('0x2b')]['find'](_0x6bca5c)[_0xe0b0('0x23')](handleEntityNotFound(_0x285d61,null))[_0xe0b0('0x23')](respondWithResult(_0x285d61,null))['catch'](handleError(_0x285d61,null));};exports['create']=function(_0x2365be,_0x1bc6e0){return db['ContactItemType'][_0xe0b0('0x47')](_0x2365be[_0xe0b0('0x48')],{})['then'](function(_0x5cb2b6){var _0x123ad2=_0x2365be['user'][_0xe0b0('0x49')]({'plain':!![]});if(!_0x123ad2)throw new Error(_0xe0b0('0x4a'));if(_0x123ad2[_0xe0b0('0x4b')]===_0xe0b0('0x4c')){var _0x19ee71=_0x5cb2b6[_0xe0b0('0x49')]({'plain':!![]});var _0x5f5486='ContactItemTypes';return db[_0xe0b0('0x4d')]['find']({'where':{'name':_0x5f5486,'userProfileId':_0x123ad2['userProfileId']},'raw':!![]})[_0xe0b0('0x23')](function(_0x222174){if(_0x222174&&_0x222174['autoAssociation']===0x0){return db['UserProfileResource'][_0xe0b0('0x47')]({'name':_0x19ee71[_0xe0b0('0x27')],'resourceId':_0x19ee71['id'],'type':_0x222174[_0xe0b0('0x27')],'sectionId':_0x222174['id']},{})[_0xe0b0('0x23')](function(){return _0x5cb2b6;});}else{return _0x5cb2b6;}})[_0xe0b0('0x45')](function(_0x24115f){logger[_0xe0b0('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24115f);throw _0x24115f;});}return _0x5cb2b6;})[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,0xc9))['catch'](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x4f')]=function(_0x54106c,_0x5b2055){if(_0x54106c[_0xe0b0('0x48')]['id']){delete _0x54106c[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x54106c[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5b2055,null))[_0xe0b0('0x23')](saveUpdates(_0x54106c[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x5b2055,null))['catch'](handleError(_0x5b2055,null));};exports[_0xe0b0('0x24')]=function(_0x57ccc9,_0x2b5553){return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x57ccc9[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x2b5553,null))[_0xe0b0('0x23')](db['CmContactHasItem'][_0xe0b0('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x57ccc9[_0xe0b0('0x46')]['id']}}))[_0xe0b0('0x23')](removeEntity(_0x2b5553,null))[_0xe0b0('0x45')](handleError(_0x2b5553,null));}; \ No newline at end of file +var _0x28f2=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','ContactItemType','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','CmContactHasItem','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'];(function(_0x244c67,_0x5604a2){var _0x5459e4=function(_0x9b785d){while(--_0x9b785d){_0x244c67['push'](_0x244c67['shift']());}};_0x5459e4(++_0x5604a2);}(_0x28f2,0x193));var _0x228f=function(_0x44d079,_0x2a9dea){_0x44d079=_0x44d079-0x0;var _0x3966f1=_0x28f2[_0x44d079];return _0x3966f1;};'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'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['ContactItemType'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':!![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x25')]=function(_0x561144,_0x3e9f76){if(_0x561144[_0x228f('0x4e')]['id']){delete _0x561144[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')]['find']({'where':{'id':_0x561144[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](saveUpdates(_0x561144[_0x228f('0x4e')],null))['then'](respondWithResult(_0x3e9f76,null))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports[_0x228f('0x27')]=function(_0x4b516e,_0x32787c){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x4b516e[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x32787c,null))[_0x228f('0x26')](db[_0x228f('0x54')][_0x228f('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4b516e[_0x228f('0x53')]['id']}}))[_0x228f('0x26')](removeEntity(_0x32787c,null))['catch'](handleError(_0x32787c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 819cd6b..f4a7c2c 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce34=['path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0xce34,0x158));var _0x4ce3=function(_0x1d4337,_0xf618a4){_0x1d4337=_0x1d4337-0x0;var _0x395467=_0xce34[_0x1d4337];return _0x395467;};'use strict';var _=require(_0x4ce3('0x0'));var util=require(_0x4ce3('0x1'));var logger=require(_0x4ce3('0x2'))(_0x4ce3('0x3'));var moment=require(_0x4ce3('0x4'));var BPromise=require(_0x4ce3('0x5'));var rp=require(_0x4ce3('0x6'));var fs=require('fs');var path=require(_0x4ce3('0x7'));var rimraf=require('rimraf');var config=require(_0x4ce3('0x8'));var attributes=require(_0x4ce3('0x9'));module[_0x4ce3('0xa')]=function(_0x4c2b04,_0x3ea2b2){return _0x4c2b04[_0x4ce3('0xb')](_0x4ce3('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe10a=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xe10a,0xc8));var _0xae10=function(_0x5d3f7c,_0x496c75){_0x5d3f7c=_0x5d3f7c-0x0;var _0x370fee=_0xe10a[_0x5d3f7c];return _0x370fee;};'use strict';var _=require(_0xae10('0x0'));var util=require(_0xae10('0x1'));var logger=require(_0xae10('0x2'))(_0xae10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae10('0x4'));var rimraf=require(_0xae10('0x5'));var config=require(_0xae10('0x6'));var attributes=require(_0xae10('0x7'));module[_0xae10('0x8')]=function(_0x5e2b0d,_0x52e974){return _0x5e2b0d[_0xae10('0x9')](_0xae10('0xa'),attributes,{'tableName':_0xae10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index c63b324..48d6fc1 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c5e=['info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x1687f6,_0x2f0e18){_0x1687f6=_0x1687f6-0x0;var _0x20afe6=_0x7c5e[_0x1687f6];return _0x20afe6;};'use strict';var _=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var moment=require(_0xe7c5('0x2'));var BPromise=require(_0xe7c5('0x3'));var rs=require(_0xe7c5('0x4'));var fs=require('fs');var Redis=require(_0xe7c5('0x5'));var db=require(_0xe7c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7c5('0x7'))(_0xe7c5('0x8'));var config=require(_0xe7c5('0x9'));var jayson=require(_0xe7c5('0xa'));var client=jayson[_0xe7c5('0xb')][_0xe7c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xeb72ff,_0xd93c52,_0x186f35){return new BPromise(function(_0x22906f,_0x1f9652){return client[_0xe7c5('0xd')](_0xeb72ff,_0x186f35)[_0xe7c5('0xe')](function(_0x3d976e){logger[_0xe7c5('0xf')]('ContactItemType,\x20%s,\x20%s',_0xd93c52,_0xe7c5('0x10'));logger['debug'](_0xe7c5('0x11'),_0xd93c52,_0xe7c5('0x10'),JSON[_0xe7c5('0x12')](_0x3d976e));if(_0x3d976e[_0xe7c5('0x13')]){if(_0x3d976e['error'][_0xe7c5('0x14')]===0x1f4){logger[_0xe7c5('0x13')](_0xe7c5('0x15'),_0xd93c52,_0x3d976e['error']['message']);return _0x1f9652(_0x3d976e[_0xe7c5('0x13')]['message']);}logger[_0xe7c5('0x13')](_0xe7c5('0x15'),_0xd93c52,_0x3d976e[_0xe7c5('0x13')][_0xe7c5('0x16')]);return _0x22906f(_0x3d976e['error']['message']);}else{logger[_0xe7c5('0xf')](_0xe7c5('0x15'),_0xd93c52,'request\x20sent');_0x22906f(_0x3d976e[_0xe7c5('0x17')]['message']);}})[_0xe7c5('0x18')](function(_0xc5cf02){logger[_0xe7c5('0x13')](_0xe7c5('0x15'),_0xd93c52,_0xc5cf02);_0x1f9652(_0xc5cf02);});});} \ No newline at end of file +var _0x1bfd=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3450db,_0x5b15c8){var _0x40df87=function(_0x13a4c5){while(--_0x13a4c5){_0x3450db['push'](_0x3450db['shift']());}};_0x40df87(++_0x5b15c8);}(_0x1bfd,0xbc));var _0xd1bf=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x1bfd[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xd1bf('0x0'));var util=require(_0xd1bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd1bf('0x2'));var fs=require('fs');var Redis=require(_0xd1bf('0x3'));var db=require(_0xd1bf('0x4'))['db'];var utils=require(_0xd1bf('0x5'));var logger=require(_0xd1bf('0x6'))(_0xd1bf('0x7'));var config=require(_0xd1bf('0x8'));var jayson=require(_0xd1bf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x283346,_0x33903b,_0x589301){return new BPromise(function(_0x529369,_0x23512d){return client[_0xd1bf('0xa')](_0x283346,_0x589301)[_0xd1bf('0xb')](function(_0x4e3628){logger[_0xd1bf('0xc')](_0xd1bf('0xd'),_0x33903b,_0xd1bf('0xe'));logger[_0xd1bf('0xf')](_0xd1bf('0x10'),_0x33903b,'request\x20sent',JSON[_0xd1bf('0x11')](_0x4e3628));if(_0x4e3628[_0xd1bf('0x12')]){if(_0x4e3628['error'][_0xd1bf('0x13')]===0x1f4){logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x4e3628['error'][_0xd1bf('0x14')]);return _0x23512d(_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);}logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);return _0x529369(_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);}else{logger['info'](_0xd1bf('0xd'),_0x33903b,_0xd1bf('0xe'));_0x529369(_0x4e3628[_0xd1bf('0x15')][_0xd1bf('0x14')]);}})[_0xd1bf('0x16')](function(_0x947f8b){logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x947f8b);_0x23512d(_0x947f8b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index adf49af..dfd8223 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf127=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0xf127,0x1ef));var _0x7f12=function(_0x474b9a,_0x4ce553){_0x474b9a=_0x474b9a-0x0;var _0x4e6a3f=_0xf127[_0x474b9a];return _0x4e6a3f;};'use strict';var multer=require(_0x7f12('0x0'));var util=require(_0x7f12('0x1'));var path=require(_0x7f12('0x2'));var timeout=require(_0x7f12('0x3'));var express=require(_0x7f12('0x4'));var router=express[_0x7f12('0x5')]();var fs_extra=require(_0x7f12('0x6'));var auth=require(_0x7f12('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7f12('0x8'));var controller=require('./contactItemType.controller');router[_0x7f12('0x9')]('/',auth[_0x7f12('0xa')](),controller[_0x7f12('0xb')]);router[_0x7f12('0x9')](_0x7f12('0xc'),auth[_0x7f12('0xa')](),controller[_0x7f12('0xd')]);router[_0x7f12('0xe')]('/',auth[_0x7f12('0xa')](),controller[_0x7f12('0xf')]);router[_0x7f12('0x10')](_0x7f12('0xc'),auth[_0x7f12('0xa')](),controller[_0x7f12('0x11')]);router[_0x7f12('0x12')](_0x7f12('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadf2=['update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','show','post','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadf2,0x1f1));var _0x2adf=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xadf2[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x2adf('0x0'));var util=require('util');var path=require(_0x2adf('0x1'));var timeout=require(_0x2adf('0x2'));var express=require(_0x2adf('0x3'));var router=express[_0x2adf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2adf('0x5'));var config=require('../../config/environment');var controller=require(_0x2adf('0x6'));router[_0x2adf('0x7')]('/',auth[_0x2adf('0x8')](),controller['index']);router[_0x2adf('0x7')]('/:id',auth[_0x2adf('0x8')](),controller[_0x2adf('0x9')]);router[_0x2adf('0xa')]('/',auth[_0x2adf('0x8')](),controller[_0x2adf('0xb')]);router[_0x2adf('0xc')]('/:id',auth[_0x2adf('0x8')](),controller[_0x2adf('0xd')]);router[_0x2adf('0xe')](_0x2adf('0xf'),auth[_0x2adf('0x8')](),controller['destroy']);module[_0x2adf('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 38462d4..1b6bcaa 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x2d996f,_0xb83a8b){var _0x1fd971=function(_0x6ab50b){while(--_0x6ab50b){_0x2d996f['push'](_0x2d996f['shift']());}};_0x1fd971(++_0xb83a8b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 413d510..3a1f17c 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 _0xc1e8=['key','query','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','findAll','show','params','keys','intersection','options','find','catch','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','includeAll','omit','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','getItems','findOne','DashboardItem','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','limit','offset','count','set','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','index','map','Dashboard','rawAttributes','fieldName','type'];(function(_0x3a0cb9,_0xf1c42){var _0x54df0e=function(_0x1477e5){while(--_0x1477e5){_0x3a0cb9['push'](_0x3a0cb9['shift']());}};_0x54df0e(++_0xf1c42);}(_0xc1e8,0x142));var _0x8c1e=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xc1e8[_0x3de873];return _0x380b8c;};'use strict';var emlformat=require(_0x8c1e('0x0'));var rimraf=require(_0x8c1e('0x1'));var zipdir=require(_0x8c1e('0x2'));var jsonpatch=require(_0x8c1e('0x3'));var rp=require(_0x8c1e('0x4'));var moment=require(_0x8c1e('0x5'));var BPromise=require(_0x8c1e('0x6'));var Mustache=require(_0x8c1e('0x7'));var util=require(_0x8c1e('0x8'));var path=require(_0x8c1e('0x9'));var sox=require('sox');var csv=require(_0x8c1e('0xa'));var ejs=require(_0x8c1e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c1e('0xc'));var squel=require(_0x8c1e('0xd'));var crypto=require(_0x8c1e('0xe'));var jsforce=require(_0x8c1e('0xf'));var deskjs=require(_0x8c1e('0x10'));var toCsv=require(_0x8c1e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c1e('0x11'));var authService=require(_0x8c1e('0x12'));var qs=require(_0x8c1e('0x13'));var as=require(_0x8c1e('0x14'));var hardwareService=require(_0x8c1e('0x15'));var logger=require('../../config/logger')(_0x8c1e('0x16'));var utils=require('../../config/utils');var config=require(_0x8c1e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c1e('0x18'))['db'];config[_0x8c1e('0x19')]=_[_0x8c1e('0x1a')](config['redis'],{'host':_0x8c1e('0x1b'),'port':0x18eb});var socket=require(_0x8c1e('0x1c'))(new Redis(config[_0x8c1e('0x19')]));require(_0x8c1e('0x1d'))[_0x8c1e('0x1e')](socket);function respondWithStatusCode(_0x1709d4,_0x365098){_0x365098=_0x365098||0xcc;return function(_0x15af7c){if(_0x15af7c){return _0x1709d4['sendStatus'](_0x365098);}return _0x1709d4[_0x8c1e('0x1f')](_0x365098)[_0x8c1e('0x20')]();};}function respondWithResult(_0x3a84ea,_0x4bcec6){_0x4bcec6=_0x4bcec6||0xc8;return function(_0x4f400e){if(_0x4f400e){return _0x3a84ea['status'](_0x4bcec6)['json'](_0x4f400e);}};}function respondWithFilteredResult(_0x16eb6d,_0x25d35f){return function(_0x52b099){if(_0x52b099){var _0x13742f=typeof _0x25d35f['offset']==='undefined'&&typeof _0x25d35f[_0x8c1e('0x21')]==='undefined';var _0x4cc058=_0x52b099['count'];var _0x455ede=_0x13742f?0x0:_0x25d35f[_0x8c1e('0x22')];var _0x5f11bb=_0x13742f?_0x52b099[_0x8c1e('0x23')]:_0x25d35f['offset']+_0x25d35f[_0x8c1e('0x21')];var _0x5502e7;if(_0x5f11bb>=_0x4cc058){_0x5f11bb=_0x4cc058;_0x5502e7=0xc8;}else{_0x5502e7=0xce;}_0x16eb6d[_0x8c1e('0x1f')](_0x5502e7);return _0x16eb6d[_0x8c1e('0x24')]('Content-Range',_0x455ede+'-'+_0x5f11bb+'/'+_0x4cc058)['json'](_0x52b099);}return null;};}function patchUpdates(_0xb4bb07){return function(_0x26710){try{jsonpatch[_0x8c1e('0x25')](_0x26710,_0xb4bb07,!![]);}catch(_0x4806cd){return BPromise[_0x8c1e('0x26')](_0x4806cd);}return _0x26710[_0x8c1e('0x27')]();};}function saveUpdates(_0x32e407,_0x111dc9){return function(_0x61dc67){if(_0x61dc67){return _0x61dc67[_0x8c1e('0x28')](_0x32e407)[_0x8c1e('0x29')](function(_0x504ac6){return _0x504ac6;});}return null;};}function removeEntity(_0x4b9604,_0x4e7a9c){return function(_0x52a4dc){if(_0x52a4dc){return _0x52a4dc[_0x8c1e('0x2a')]()[_0x8c1e('0x29')](function(){var _0x1d92de=_0x52a4dc['get']({'plain':!![]});var _0x2d2b3d='CustomDashboards';return db[_0x8c1e('0x2b')]['destroy']({'where':{'type':_0x2d2b3d,'resourceId':_0x1d92de['id']}})[_0x8c1e('0x29')](function(){return _0x52a4dc;});})[_0x8c1e('0x29')](function(){_0x4b9604[_0x8c1e('0x1f')](0xcc)[_0x8c1e('0x20')]();});}};}function handleEntityNotFound(_0x5f2a3f,_0x426a2e){return function(_0x3bc32e){if(!_0x3bc32e){_0x5f2a3f[_0x8c1e('0x2c')](0x194);}return _0x3bc32e;};}function handleError(_0x17cdab,_0x33b9f1){_0x33b9f1=_0x33b9f1||0x1f4;return function(_0x9dd416){logger['error'](_0x9dd416[_0x8c1e('0x2d')]);if(_0x9dd416[_0x8c1e('0x2e')]){delete _0x9dd416[_0x8c1e('0x2e')];}_0x17cdab['status'](_0x33b9f1)['send'](_0x9dd416);};}exports[_0x8c1e('0x2f')]=function(_0x50752c,_0x2c647d){var _0x15fcdd={},_0x5ea92e={},_0x3f2518={'count':0x0,'rows':[]};var _0x2d57df=_[_0x8c1e('0x30')](db[_0x8c1e('0x31')][_0x8c1e('0x32')],function(_0x25ec44){return{'name':_0x25ec44[_0x8c1e('0x33')],'type':_0x25ec44[_0x8c1e('0x34')][_0x8c1e('0x35')]};});_0x5ea92e['model']=_[_0x8c1e('0x30')](_0x2d57df,'name');_0x5ea92e[_0x8c1e('0x36')]=_['keys'](_0x50752c[_0x8c1e('0x36')]);_0x5ea92e['filters']=_['intersection'](_0x5ea92e[_0x8c1e('0x37')],_0x5ea92e['query']);_0x15fcdd[_0x8c1e('0x38')]=_['intersection'](_0x5ea92e['model'],qs['fields'](_0x50752c[_0x8c1e('0x36')][_0x8c1e('0x39')]));_0x15fcdd[_0x8c1e('0x38')]=_0x15fcdd[_0x8c1e('0x38')][_0x8c1e('0x3a')]?_0x15fcdd[_0x8c1e('0x38')]:_0x5ea92e[_0x8c1e('0x37')];if(!_0x50752c[_0x8c1e('0x36')]['hasOwnProperty'](_0x8c1e('0x3b'))){_0x15fcdd[_0x8c1e('0x21')]=qs[_0x8c1e('0x21')](_0x50752c[_0x8c1e('0x36')]['limit']);_0x15fcdd['offset']=qs[_0x8c1e('0x22')](_0x50752c[_0x8c1e('0x36')][_0x8c1e('0x22')]);}_0x15fcdd['order']=qs[_0x8c1e('0x3c')](_0x50752c['query'][_0x8c1e('0x3c')]);_0x15fcdd[_0x8c1e('0x3d')]=qs[_0x8c1e('0x3e')](_[_0x8c1e('0x3f')](_0x50752c[_0x8c1e('0x36')],_0x5ea92e[_0x8c1e('0x3e')]),_0x2d57df);if(_0x50752c['query'][_0x8c1e('0x40')]){_0x15fcdd['where']=_[_0x8c1e('0x41')](_0x15fcdd[_0x8c1e('0x3d')],{'$or':_[_0x8c1e('0x30')](_0x2d57df,function(_0x2637ee){if(_0x2637ee['type']!=='VIRTUAL'){var _0x3c3d04={};_0x3c3d04[_0x2637ee[_0x8c1e('0x2e')]]={'$like':'%'+_0x50752c['query'][_0x8c1e('0x40')]+'%'};return _0x3c3d04;}})});}_0x15fcdd=_['merge']({},_0x15fcdd,_0x50752c['options']);var _0xdfd6f9={'where':_0x15fcdd[_0x8c1e('0x3d')]};return db[_0x8c1e('0x31')][_0x8c1e('0x23')](_0xdfd6f9)['then'](function(_0x1c2474){_0x3f2518[_0x8c1e('0x23')]=_0x1c2474;if(_0x50752c[_0x8c1e('0x36')]['includeAll']){_0x15fcdd['include']=[{'all':!![]}];}return db[_0x8c1e('0x31')][_0x8c1e('0x42')](_0x15fcdd);})[_0x8c1e('0x29')](function(_0x30b960){_0x3f2518['rows']=_0x30b960;return _0x3f2518;})[_0x8c1e('0x29')](respondWithFilteredResult(_0x2c647d,_0x15fcdd))['catch'](handleError(_0x2c647d,null));};exports[_0x8c1e('0x43')]=function(_0x3f309c,_0x1b5368){var _0x576699={'raw':![],'where':{'id':_0x3f309c[_0x8c1e('0x44')]['id']}},_0x177b43={};_0x177b43[_0x8c1e('0x37')]=_[_0x8c1e('0x45')](db[_0x8c1e('0x31')][_0x8c1e('0x32')]);_0x177b43[_0x8c1e('0x36')]=_[_0x8c1e('0x45')](_0x3f309c[_0x8c1e('0x36')]);_0x177b43['filters']=_[_0x8c1e('0x46')](_0x177b43[_0x8c1e('0x37')],_0x177b43[_0x8c1e('0x36')]);_0x576699['attributes']=_[_0x8c1e('0x46')](_0x177b43[_0x8c1e('0x37')],qs[_0x8c1e('0x39')](_0x3f309c[_0x8c1e('0x36')]['fields']));_0x576699[_0x8c1e('0x38')]=_0x576699[_0x8c1e('0x38')][_0x8c1e('0x3a')]?_0x576699['attributes']:_0x177b43['model'];if(_0x3f309c[_0x8c1e('0x36')]['includeAll']){_0x576699['include']=[{'all':!![]}];}_0x576699=_[_0x8c1e('0x41')]({},_0x576699,_0x3f309c[_0x8c1e('0x47')]);return db[_0x8c1e('0x31')][_0x8c1e('0x48')](_0x576699)[_0x8c1e('0x29')](handleEntityNotFound(_0x1b5368,null))[_0x8c1e('0x29')](respondWithResult(_0x1b5368,null))[_0x8c1e('0x49')](handleError(_0x1b5368,null));};exports[_0x8c1e('0x4a')]=function(_0x3a388e,_0x43617a){return db['Dashboard'][_0x8c1e('0x4a')](_0x3a388e[_0x8c1e('0x4b')],{})['then'](function(_0x349a51){var _0xd4613b=_0x3a388e[_0x8c1e('0x4c')][_0x8c1e('0x4d')]({'plain':!![]});if(!_0xd4613b)throw new Error(_0x8c1e('0x4e'));if(_0xd4613b[_0x8c1e('0x4f')]===_0x8c1e('0x4c')){var _0x27058f=_0x349a51[_0x8c1e('0x4d')]({'plain':!![]});var _0x5c81d5='CustomDashboards';return db[_0x8c1e('0x50')][_0x8c1e('0x48')]({'where':{'name':_0x5c81d5,'userProfileId':_0xd4613b[_0x8c1e('0x51')]},'raw':!![]})[_0x8c1e('0x29')](function(_0x4ff0b2){if(_0x4ff0b2&&_0x4ff0b2[_0x8c1e('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x27058f[_0x8c1e('0x2e')],'resourceId':_0x27058f['id'],'type':_0x4ff0b2['name'],'sectionId':_0x4ff0b2['id']},{})[_0x8c1e('0x29')](function(){return _0x349a51;});}else{return _0x349a51;}})[_0x8c1e('0x49')](function(_0x439542){logger[_0x8c1e('0x53')](_0x8c1e('0x54'),_0x439542);throw _0x439542;});}return _0x349a51;})['then'](respondWithResult(_0x43617a,0xc9))[_0x8c1e('0x49')](handleError(_0x43617a,null));};exports['clone']=function(_0x2ede4e,_0x842d55){var _0x5a3793={'where':{'id':_0x2ede4e[_0x8c1e('0x44')]['id']}},_0xe24106={};_0xe24106[_0x8c1e('0x37')]=_['keys'](db['Dashboard'][_0x8c1e('0x32')]);_0x5a3793[_0x8c1e('0x38')]=_[_0x8c1e('0x46')](_0xe24106[_0x8c1e('0x37')],qs[_0x8c1e('0x39')](_0x2ede4e['query'][_0x8c1e('0x39')]));_0x5a3793[_0x8c1e('0x38')]=_0x5a3793[_0x8c1e('0x38')][_0x8c1e('0x3a')]?_0x5a3793['attributes']:_0xe24106[_0x8c1e('0x37')];if(_0x2ede4e[_0x8c1e('0x36')][_0x8c1e('0x55')]){_0x5a3793['include']=[{'all':!![]}];}_0x5a3793=_['merge']({},_0x5a3793,_0x2ede4e['options']);return db['Dashboard'][_0x8c1e('0x48')](_0x5a3793)[_0x8c1e('0x29')](handleEntityNotFound(_0x842d55,null))['then'](function(_0x1ef509){if(_0x1ef509){var _0x5b8824=_0x1ef509[_0x8c1e('0x4d')]({'plain':!![]});_0x5b8824=qs[_0x8c1e('0x56')](_0x5b8824,['id','createdAt','updatedAt']);_0x2ede4e[_0x8c1e('0x4b')]=_[_0x8c1e('0x56')](_0x2ede4e[_0x8c1e('0x4b')],['id',_0x8c1e('0x57'),'updatedAt']);return db[_0x8c1e('0x31')]['create'](_[_0x8c1e('0x41')](_0x5b8824,_0x2ede4e[_0x8c1e('0x4b')]),{'include':_0x2ede4e[_0x8c1e('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x30c9db){var _0x337dd5=_0x2ede4e[_0x8c1e('0x4c')]['get']({'plain':!![]});if(!_0x337dd5)throw new Error(_0x8c1e('0x4e'));if(_0x337dd5[_0x8c1e('0x4f')]===_0x8c1e('0x4c')){var _0xbf5e6d=_0x30c9db[_0x8c1e('0x4d')]({'plain':!![]});var _0x2b7c57='CustomDashboards';return db[_0x8c1e('0x50')]['find']({'where':{'name':_0x2b7c57,'userProfileId':_0x337dd5[_0x8c1e('0x51')]},'raw':!![]})[_0x8c1e('0x29')](function(_0x35038a){if(_0x35038a&&_0x35038a[_0x8c1e('0x52')]===0x0){return db[_0x8c1e('0x2b')][_0x8c1e('0x4a')]({'name':_0xbf5e6d[_0x8c1e('0x2e')],'resourceId':_0xbf5e6d['id'],'type':_0x35038a[_0x8c1e('0x2e')],'sectionId':_0x35038a['id']},{})[_0x8c1e('0x29')](function(){return _0x30c9db;});}else{return _0x30c9db;}})[_0x8c1e('0x49')](function(_0xa8113d){logger[_0x8c1e('0x53')](_0x8c1e('0x54'),_0xa8113d);throw _0xa8113d;});}return _0x30c9db;});}})['then'](respondWithResult(_0x842d55,0xc9))['catch'](handleError(_0x842d55,null));};exports['update']=function(_0x248885,_0x1e3306){if(_0x248885[_0x8c1e('0x4b')]['id']){delete _0x248885[_0x8c1e('0x4b')]['id'];}return db[_0x8c1e('0x31')][_0x8c1e('0x48')]({'where':{'id':_0x248885[_0x8c1e('0x44')]['id']}})[_0x8c1e('0x29')](handleEntityNotFound(_0x1e3306,null))[_0x8c1e('0x29')](saveUpdates(_0x248885['body'],null))[_0x8c1e('0x29')](respondWithResult(_0x1e3306,null))[_0x8c1e('0x49')](handleError(_0x1e3306,null));};exports[_0x8c1e('0x2a')]=function(_0x5997b4,_0x527fe7){return db['Dashboard']['find']({'where':{'id':_0x5997b4[_0x8c1e('0x44')]['id']}})[_0x8c1e('0x29')](handleEntityNotFound(_0x527fe7,null))[_0x8c1e('0x29')](removeEntity(_0x527fe7,null))[_0x8c1e('0x49')](handleError(_0x527fe7,null));};function widgetAttributes(_0x3368fa){try{switch(_0x3368fa[_0x8c1e('0x34')]){case _0x8c1e('0x58'):return[{'name':_0x8c1e('0x59'),'value':_0x3368fa['attrUrl']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0][_0x8c1e('0x5b')]:undefined)||_0x8c1e('0x5c')}];case _0x8c1e('0x5d'):return[{'name':_0x8c1e('0x5e'),'value':_0x3368fa[_0x8c1e('0x5e')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa['attrs'][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0][_0x8c1e('0x5b')]:undefined)||''}];case'clock':return[{'name':_0x8c1e('0x5f'),'value':_0x3368fa[_0x8c1e('0x5f')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0]['value']:undefined)||_0x8c1e('0x60')},{'name':_0x8c1e('0x61'),'value':_0x3368fa['attrTimezone']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x1]?_0x3368fa[_0x8c1e('0x5a')][0x1]['value']:undefined)||_0x8c1e('0x62')},{'name':_0x8c1e('0x63'),'value':_0x3368fa[_0x8c1e('0x63')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x2]?_0x3368fa[_0x8c1e('0x5a')][0x2][_0x8c1e('0x5b')]:undefined)||0xc}];case _0x8c1e('0x64'):return[{'name':'attrMetric','value':_0x3368fa[_0x8c1e('0x65')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0][_0x8c1e('0x5b')]:undefined)||_0x8c1e('0x66')},{'name':_0x8c1e('0x67'),'value':_0x3368fa['attrVoiceQueues']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x1]?_0x3368fa[_0x8c1e('0x5a')][0x1][_0x8c1e('0x5b')]:undefined)||[]},{'name':_0x8c1e('0x63'),'value':_0x3368fa[_0x8c1e('0x63')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x2]?_0x3368fa[_0x8c1e('0x5a')][0x2][_0x8c1e('0x5b')]:undefined)||0x14},{'name':_0x8c1e('0x68'),'value':_0x3368fa[_0x8c1e('0x68')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x3]?_0x3368fa[_0x8c1e('0x5a')][0x3]['value']:undefined)||_0x8c1e('0x69')},{'name':_0x8c1e('0x6a'),'value':_0x3368fa[_0x8c1e('0x6a')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x4]?_0x3368fa[_0x8c1e('0x5a')][0x4][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6b'),'value':_0x3368fa[_0x8c1e('0x6b')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x5]?_0x3368fa['attrs'][0x5][_0x8c1e('0x5b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3368fa[_0x8c1e('0x6c')]||(_0x3368fa['attrs']&&_0x3368fa[_0x8c1e('0x5a')][0x6]?_0x3368fa[_0x8c1e('0x5a')][0x6][_0x8c1e('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3368fa[_0x8c1e('0x6d')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x7]?_0x3368fa['attrs'][0x7][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6e'),'value':_0x3368fa[_0x8c1e('0x6e')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x8]?_0x3368fa[_0x8c1e('0x5a')][0x8][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6f'),'value':_0x3368fa[_0x8c1e('0x6f')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x9]?_0x3368fa[_0x8c1e('0x5a')][0x9][_0x8c1e('0x5b')]:undefined)||''}];case'multibar-chart':case _0x8c1e('0x70'):return[{'name':_0x8c1e('0x71'),'value':_0x3368fa[_0x8c1e('0x71')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa['attrs'][0x0][_0x8c1e('0x5b')]:undefined)||_0x8c1e('0x66')},{'name':_0x8c1e('0x72'),'value':_0x3368fa[_0x8c1e('0x72')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x1]?_0x3368fa[_0x8c1e('0x5a')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3368fa[_0x8c1e('0x73')]||(_0x3368fa['attrs']&&_0x3368fa[_0x8c1e('0x5a')][0x2]?_0x3368fa[_0x8c1e('0x5a')][0x2][_0x8c1e('0x5b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3368fa[_0x8c1e('0x67')]||(_0x3368fa['attrs']&&_0x3368fa[_0x8c1e('0x5a')][0x3]?_0x3368fa[_0x8c1e('0x5a')][0x3][_0x8c1e('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x3368fa['attrChannel']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x4]?_0x3368fa[_0x8c1e('0x5a')][0x4]['value']:undefined)||_0x8c1e('0x69')},{'name':_0x8c1e('0x6a'),'value':_0x3368fa['attrEmailAccounts']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x5]?_0x3368fa[_0x8c1e('0x5a')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3368fa[_0x8c1e('0x6b')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa['attrs'][0x6]?_0x3368fa['attrs'][0x6][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6c'),'value':_0x3368fa[_0x8c1e('0x6c')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x7]?_0x3368fa[_0x8c1e('0x5a')][0x7][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6d'),'value':_0x3368fa[_0x8c1e('0x6d')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x8]?_0x3368fa[_0x8c1e('0x5a')][0x8][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6e'),'value':_0x3368fa['attrWhatsappAccounts']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x9]?_0x3368fa[_0x8c1e('0x5a')][0x9][_0x8c1e('0x5b')]:undefined)||''},{'name':_0x8c1e('0x6f'),'value':_0x3368fa['attrChatWebsites']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0xa]?_0x3368fa[_0x8c1e('0x5a')][0xa][_0x8c1e('0x5b')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3368fa[_0x8c1e('0x74')]||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0]['type']:undefined)||null,'value':_0x3368fa['attrReport']||(_0x3368fa[_0x8c1e('0x5a')]&&_0x3368fa[_0x8c1e('0x5a')][0x0]?_0x3368fa[_0x8c1e('0x5a')][0x0]['value']:undefined)||null},{'name':_0x8c1e('0x75'),'value':_0x3368fa[_0x8c1e('0x75')]||(_0x3368fa['attrs']&&_0x3368fa[_0x8c1e('0x5a')][0x1]?_0x3368fa['attrs'][0x1][_0x8c1e('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x29bafd){logger['error'](_0x8c1e('0x76'),JSON['stringify'](_0x29bafd));return[];}}exports[_0x8c1e('0x77')]=function(_0x244d02,_0x319b02,_0x5562c7){if(_0x244d02[_0x8c1e('0x4b')]['id']){delete _0x244d02[_0x8c1e('0x4b')]['id'];}return db[_0x8c1e('0x31')][_0x8c1e('0x48')]({'where':{'id':_0x244d02[_0x8c1e('0x44')]['id']}})[_0x8c1e('0x29')](handleEntityNotFound(_0x319b02,null))[_0x8c1e('0x29')](function(_0x1cc811){if(_0x1cc811){_0x244d02[_0x8c1e('0x4b')]['DashboardId']=_0x1cc811['id'];_0x244d02[_0x8c1e('0x4b')][_0x8c1e('0x5a')]=widgetAttributes(_0x244d02['body']);return db['DashboardItem'][_0x8c1e('0x4a')](_0x244d02[_0x8c1e('0x4b')]);}})[_0x8c1e('0x29')](respondWithResult(_0x319b02,null))[_0x8c1e('0x49')](handleError(_0x319b02,null));};exports[_0x8c1e('0x78')]=function(_0x39c5ae,_0x57c531,_0x2bc90b){var _0x3cf49f={};var _0x24dcf8={};var _0xeaf3e6;var _0x1efc0a;return db[_0x8c1e('0x31')][_0x8c1e('0x79')]({'where':{'id':_0x39c5ae['params']['id']}})['then'](handleEntityNotFound(_0x57c531,null))[_0x8c1e('0x29')](function(_0x5684a9){if(_0x5684a9){_0xeaf3e6=_0x5684a9;_0x24dcf8['model']=_['keys'](db[_0x8c1e('0x7a')]['rawAttributes']);_0x24dcf8[_0x8c1e('0x36')]=_['keys'](_0x39c5ae[_0x8c1e('0x36')]);_0x24dcf8[_0x8c1e('0x3e')]=_[_0x8c1e('0x46')](_0x24dcf8[_0x8c1e('0x37')],_0x24dcf8[_0x8c1e('0x36')]);_0x3cf49f['attributes']=_[_0x8c1e('0x46')](_0x24dcf8[_0x8c1e('0x37')],qs[_0x8c1e('0x39')](_0x39c5ae[_0x8c1e('0x36')]['fields']));_0x3cf49f['attributes']=_0x3cf49f[_0x8c1e('0x38')]['length']?_0x3cf49f[_0x8c1e('0x38')]:_0x24dcf8[_0x8c1e('0x37')];_0x3cf49f[_0x8c1e('0x7b')]=qs[_0x8c1e('0x3c')](_0x39c5ae['query']['sort']);_0x3cf49f['where']=qs[_0x8c1e('0x3e')](_['pick'](_0x39c5ae[_0x8c1e('0x36')],_0x24dcf8[_0x8c1e('0x3e')]));if(_0x39c5ae[_0x8c1e('0x36')]['filter']){_0x3cf49f[_0x8c1e('0x3d')]=_['merge'](_0x3cf49f[_0x8c1e('0x3d')],{'$or':_[_0x8c1e('0x30')](_0x3cf49f['attributes'],function(_0x348658){var _0x15d5b9={};_0x15d5b9[_0x348658]={'$like':'%'+_0x39c5ae[_0x8c1e('0x36')][_0x8c1e('0x40')]+'%'};return _0x15d5b9;})});}_0x3cf49f=_['merge']({},_0x3cf49f,_0x39c5ae['options']);return _0xeaf3e6['getItems'](_0x3cf49f);}})[_0x8c1e('0x29')](function(_0xa457b3){if(_0xa457b3){_0x1efc0a=_0xa457b3[_0x8c1e('0x3a')];if(!_0x39c5ae[_0x8c1e('0x36')][_0x8c1e('0x7c')](_0x8c1e('0x3b'))){_0x3cf49f[_0x8c1e('0x21')]=qs[_0x8c1e('0x21')](_0x39c5ae[_0x8c1e('0x36')][_0x8c1e('0x21')]);_0x3cf49f[_0x8c1e('0x22')]=qs[_0x8c1e('0x22')](_0x39c5ae[_0x8c1e('0x36')][_0x8c1e('0x22')]);}return _0xeaf3e6[_0x8c1e('0x78')](_0x3cf49f);}})[_0x8c1e('0x29')](function(_0xabf9c6){if(_0xabf9c6){return _0xabf9c6?{'count':_0x1efc0a,'rows':_0xabf9c6}:null;}})['then'](respondWithResult(_0x57c531,null))['catch'](handleError(_0x57c531,null));}; \ No newline at end of file +var _0x43a4=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','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','destroy','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','order','filter','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboard.socket','register','sendStatus','status'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x43a4,0xee));var _0x443a=function(_0x5d12b3,_0x27bb94){_0x5d12b3=_0x5d12b3-0x0;var _0x59c5b0=_0x43a4[_0x5d12b3];return _0x59c5b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x443a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x443a('0x1'));var moment=require('moment');var BPromise=require(_0x443a('0x2'));var Mustache=require(_0x443a('0x3'));var util=require(_0x443a('0x4'));var path=require(_0x443a('0x5'));var sox=require(_0x443a('0x6'));var csv=require(_0x443a('0x7'));var ejs=require(_0x443a('0x8'));var fs=require('fs');var fs_extra=require(_0x443a('0x9'));var _=require(_0x443a('0xa'));var squel=require('squel');var crypto=require(_0x443a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x443a('0xc'));var toCsv=require(_0x443a('0x7'));var querystring=require(_0x443a('0xd'));var Papa=require(_0x443a('0xe'));var Redis=require(_0x443a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x443a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x443a('0x11'));var logger=require(_0x443a('0x12'))(_0x443a('0x13'));var utils=require(_0x443a('0x14'));var config=require(_0x443a('0x15'));var licenseUtil=require(_0x443a('0x16'));var db=require(_0x443a('0x17'))['db'];config['redis']=_[_0x443a('0x18')](config[_0x443a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x443a('0x19')]));require(_0x443a('0x1a'))[_0x443a('0x1b')](socket);function respondWithStatusCode(_0x4bc903,_0x4d0cc5){_0x4d0cc5=_0x4d0cc5||0xcc;return function(_0x2cbde7){if(_0x2cbde7){return _0x4bc903[_0x443a('0x1c')](_0x4d0cc5);}return _0x4bc903[_0x443a('0x1d')](_0x4d0cc5)[_0x443a('0x1e')]();};}function respondWithResult(_0x5cb3ba,_0x514d9b){_0x514d9b=_0x514d9b||0xc8;return function(_0x34eabc){if(_0x34eabc){return _0x5cb3ba[_0x443a('0x1d')](_0x514d9b)[_0x443a('0x1f')](_0x34eabc);}};}function respondWithFilteredResult(_0x5cd970,_0x41e6b5){return function(_0x201e9e){if(_0x201e9e){var _0xbdcff6=typeof _0x41e6b5[_0x443a('0x20')]==='undefined'&&typeof _0x41e6b5[_0x443a('0x21')]===_0x443a('0x22');var _0x42098b=_0x201e9e[_0x443a('0x23')];var _0x329e83=_0xbdcff6?0x0:_0x41e6b5[_0x443a('0x20')];var _0x1bc11f=_0xbdcff6?_0x201e9e[_0x443a('0x23')]:_0x41e6b5['offset']+_0x41e6b5[_0x443a('0x21')];var _0x1e1a4d;if(_0x1bc11f>=_0x42098b){_0x1bc11f=_0x42098b;_0x1e1a4d=0xc8;}else{_0x1e1a4d=0xce;}_0x5cd970[_0x443a('0x1d')](_0x1e1a4d);return _0x5cd970[_0x443a('0x24')](_0x443a('0x25'),_0x329e83+'-'+_0x1bc11f+'/'+_0x42098b)[_0x443a('0x1f')](_0x201e9e);}return null;};}function patchUpdates(_0x113ee3){return function(_0x137401){try{jsonpatch[_0x443a('0x26')](_0x137401,_0x113ee3,!![]);}catch(_0x93ea6){return BPromise[_0x443a('0x27')](_0x93ea6);}return _0x137401[_0x443a('0x28')]();};}function saveUpdates(_0x31be63,_0x34e88a){return function(_0x12ab21){if(_0x12ab21){return _0x12ab21[_0x443a('0x29')](_0x31be63)[_0x443a('0x2a')](function(_0x373707){return _0x373707;});}return null;};}function removeEntity(_0x4534a6,_0x10c655){return function(_0x2a961f){if(_0x2a961f){return _0x2a961f['destroy']()[_0x443a('0x2a')](function(){var _0x2ed5b5=_0x2a961f['get']({'plain':!![]});var _0x1865bf=_0x443a('0x2b');return db[_0x443a('0x2c')]['destroy']({'where':{'type':_0x1865bf,'resourceId':_0x2ed5b5['id']}})[_0x443a('0x2a')](function(){return _0x2a961f;});})[_0x443a('0x2a')](function(){_0x4534a6[_0x443a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393b2a,_0x5682af){return function(_0x489c8a){if(!_0x489c8a){_0x393b2a[_0x443a('0x1c')](0x194);}return _0x489c8a;};}function handleError(_0x2c3e57,_0x1ad6c5){_0x1ad6c5=_0x1ad6c5||0x1f4;return function(_0x254a25){logger[_0x443a('0x2d')](_0x254a25[_0x443a('0x2e')]);if(_0x254a25['name']){delete _0x254a25[_0x443a('0x2f')];}_0x2c3e57['status'](_0x1ad6c5)['send'](_0x254a25);};}exports[_0x443a('0x30')]=function(_0x7128dd,_0x4fed6c){var _0x25c402={},_0x3209c1={},_0x3e4bb1={'count':0x0,'rows':[]};var _0x1615e6=_[_0x443a('0x31')](db[_0x443a('0x32')][_0x443a('0x33')],function(_0x571b37){return{'name':_0x571b37[_0x443a('0x34')],'type':_0x571b37[_0x443a('0x35')]['key']};});_0x3209c1[_0x443a('0x36')]=_['map'](_0x1615e6,'name');_0x3209c1[_0x443a('0x37')]=_[_0x443a('0x38')](_0x7128dd[_0x443a('0x37')]);_0x3209c1['filters']=_[_0x443a('0x39')](_0x3209c1[_0x443a('0x36')],_0x3209c1['query']);_0x25c402[_0x443a('0x3a')]=_['intersection'](_0x3209c1[_0x443a('0x36')],qs[_0x443a('0x3b')](_0x7128dd[_0x443a('0x37')][_0x443a('0x3b')]));_0x25c402[_0x443a('0x3a')]=_0x25c402[_0x443a('0x3a')][_0x443a('0x3c')]?_0x25c402['attributes']:_0x3209c1['model'];if(!_0x7128dd[_0x443a('0x37')][_0x443a('0x3d')](_0x443a('0x3e'))){_0x25c402[_0x443a('0x21')]=qs[_0x443a('0x21')](_0x7128dd[_0x443a('0x37')][_0x443a('0x21')]);_0x25c402[_0x443a('0x20')]=qs[_0x443a('0x20')](_0x7128dd['query']['offset']);}_0x25c402['order']=qs[_0x443a('0x3f')](_0x7128dd[_0x443a('0x37')][_0x443a('0x3f')]);_0x25c402[_0x443a('0x40')]=qs[_0x443a('0x41')](_[_0x443a('0x42')](_0x7128dd[_0x443a('0x37')],_0x3209c1['filters']),_0x1615e6);if(_0x7128dd[_0x443a('0x37')]['filter']){_0x25c402['where']=_[_0x443a('0x43')](_0x25c402[_0x443a('0x40')],{'$or':_[_0x443a('0x31')](_0x1615e6,function(_0x729d86){if(_0x729d86['type']!==_0x443a('0x44')){var _0x2259c8={};_0x2259c8[_0x729d86[_0x443a('0x2f')]]={'$like':'%'+_0x7128dd[_0x443a('0x37')]['filter']+'%'};return _0x2259c8;}})});}_0x25c402=_[_0x443a('0x43')]({},_0x25c402,_0x7128dd[_0x443a('0x45')]);var _0x150884={'where':_0x25c402[_0x443a('0x40')]};return db[_0x443a('0x32')]['count'](_0x150884)[_0x443a('0x2a')](function(_0x553c2c){_0x3e4bb1['count']=_0x553c2c;if(_0x7128dd[_0x443a('0x37')][_0x443a('0x46')]){_0x25c402['include']=[{'all':!![]}];}return db['Dashboard'][_0x443a('0x47')](_0x25c402);})['then'](function(_0x2079a5){_0x3e4bb1[_0x443a('0x48')]=_0x2079a5;return _0x3e4bb1;})[_0x443a('0x2a')](respondWithFilteredResult(_0x4fed6c,_0x25c402))[_0x443a('0x49')](handleError(_0x4fed6c,null));};exports[_0x443a('0x4a')]=function(_0xbac7a4,_0x26c2b0){var _0x46e840={'raw':![],'where':{'id':_0xbac7a4[_0x443a('0x4b')]['id']}},_0x1f6779={};_0x1f6779['model']=_[_0x443a('0x38')](db[_0x443a('0x32')][_0x443a('0x33')]);_0x1f6779[_0x443a('0x37')]=_[_0x443a('0x38')](_0xbac7a4[_0x443a('0x37')]);_0x1f6779[_0x443a('0x41')]=_[_0x443a('0x39')](_0x1f6779[_0x443a('0x36')],_0x1f6779[_0x443a('0x37')]);_0x46e840[_0x443a('0x3a')]=_[_0x443a('0x39')](_0x1f6779['model'],qs[_0x443a('0x3b')](_0xbac7a4[_0x443a('0x37')][_0x443a('0x3b')]));_0x46e840[_0x443a('0x3a')]=_0x46e840[_0x443a('0x3a')][_0x443a('0x3c')]?_0x46e840['attributes']:_0x1f6779[_0x443a('0x36')];if(_0xbac7a4['query']['includeAll']){_0x46e840[_0x443a('0x4c')]=[{'all':!![]}];}_0x46e840=_[_0x443a('0x43')]({},_0x46e840,_0xbac7a4[_0x443a('0x45')]);return db[_0x443a('0x32')][_0x443a('0x4d')](_0x46e840)['then'](handleEntityNotFound(_0x26c2b0,null))[_0x443a('0x2a')](respondWithResult(_0x26c2b0,null))[_0x443a('0x49')](handleError(_0x26c2b0,null));};exports[_0x443a('0x4e')]=function(_0x4ce07b,_0x5cedcd){return db[_0x443a('0x32')][_0x443a('0x4e')](_0x4ce07b[_0x443a('0x4f')],{})['then'](function(_0x337652){var _0x3c9e9e=_0x4ce07b[_0x443a('0x50')][_0x443a('0x51')]({'plain':!![]});if(!_0x3c9e9e)throw new Error(_0x443a('0x52'));if(_0x3c9e9e[_0x443a('0x53')]==='user'){var _0x4c699a=_0x337652[_0x443a('0x51')]({'plain':!![]});var _0x32a63e=_0x443a('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x32a63e,'userProfileId':_0x3c9e9e[_0x443a('0x54')]},'raw':!![]})[_0x443a('0x2a')](function(_0x2d1f28){if(_0x2d1f28&&_0x2d1f28['autoAssociation']===0x0){return db[_0x443a('0x2c')]['create']({'name':_0x4c699a[_0x443a('0x2f')],'resourceId':_0x4c699a['id'],'type':_0x2d1f28[_0x443a('0x2f')],'sectionId':_0x2d1f28['id']},{})['then'](function(){return _0x337652;});}else{return _0x337652;}})[_0x443a('0x49')](function(_0x15d790){logger['error'](_0x443a('0x55'),_0x15d790);throw _0x15d790;});}return _0x337652;})['then'](respondWithResult(_0x5cedcd,0xc9))[_0x443a('0x49')](handleError(_0x5cedcd,null));};exports[_0x443a('0x56')]=function(_0x1a6c09,_0x2b6d11){var _0x18f29d={'where':{'id':_0x1a6c09[_0x443a('0x4b')]['id']}},_0xb07a67={};_0xb07a67['model']=_[_0x443a('0x38')](db[_0x443a('0x32')][_0x443a('0x33')]);_0x18f29d[_0x443a('0x3a')]=_[_0x443a('0x39')](_0xb07a67[_0x443a('0x36')],qs[_0x443a('0x3b')](_0x1a6c09[_0x443a('0x37')][_0x443a('0x3b')]));_0x18f29d[_0x443a('0x3a')]=_0x18f29d[_0x443a('0x3a')]['length']?_0x18f29d['attributes']:_0xb07a67['model'];if(_0x1a6c09[_0x443a('0x37')][_0x443a('0x46')]){_0x18f29d[_0x443a('0x4c')]=[{'all':!![]}];}_0x18f29d=_[_0x443a('0x43')]({},_0x18f29d,_0x1a6c09[_0x443a('0x45')]);return db[_0x443a('0x32')]['find'](_0x18f29d)['then'](handleEntityNotFound(_0x2b6d11,null))['then'](function(_0x2dc2a3){if(_0x2dc2a3){var _0x2b932a=_0x2dc2a3[_0x443a('0x51')]({'plain':!![]});_0x2b932a=qs[_0x443a('0x57')](_0x2b932a,['id',_0x443a('0x58'),_0x443a('0x59')]);_0x1a6c09[_0x443a('0x4f')]=_[_0x443a('0x57')](_0x1a6c09[_0x443a('0x4f')],['id',_0x443a('0x58'),'updatedAt']);return db[_0x443a('0x32')]['create'](_['merge'](_0x2b932a,_0x1a6c09[_0x443a('0x4f')]),{'include':_0x1a6c09[_0x443a('0x37')][_0x443a('0x46')]?[{'all':!![]}]:undefined})[_0x443a('0x2a')](function(_0x4ecf7e){var _0x5a512c=_0x1a6c09[_0x443a('0x50')][_0x443a('0x51')]({'plain':!![]});if(!_0x5a512c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a512c[_0x443a('0x53')]===_0x443a('0x50')){var _0x2ca789=_0x4ecf7e[_0x443a('0x51')]({'plain':!![]});var _0x160a43=_0x443a('0x2b');return db[_0x443a('0x5a')][_0x443a('0x4d')]({'where':{'name':_0x160a43,'userProfileId':_0x5a512c[_0x443a('0x54')]},'raw':!![]})[_0x443a('0x2a')](function(_0x46a7b9){if(_0x46a7b9&&_0x46a7b9[_0x443a('0x5b')]===0x0){return db[_0x443a('0x2c')]['create']({'name':_0x2ca789[_0x443a('0x2f')],'resourceId':_0x2ca789['id'],'type':_0x46a7b9[_0x443a('0x2f')],'sectionId':_0x46a7b9['id']},{})[_0x443a('0x2a')](function(){return _0x4ecf7e;});}else{return _0x4ecf7e;}})[_0x443a('0x49')](function(_0x578bc6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x578bc6);throw _0x578bc6;});}return _0x4ecf7e;});}})[_0x443a('0x2a')](respondWithResult(_0x2b6d11,0xc9))[_0x443a('0x49')](handleError(_0x2b6d11,null));};exports['update']=function(_0x2b5f22,_0x4a0eed){if(_0x2b5f22['body']['id']){delete _0x2b5f22[_0x443a('0x4f')]['id'];}return db['Dashboard'][_0x443a('0x4d')]({'where':{'id':_0x2b5f22[_0x443a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a0eed,null))[_0x443a('0x2a')](saveUpdates(_0x2b5f22[_0x443a('0x4f')],null))[_0x443a('0x2a')](respondWithResult(_0x4a0eed,null))[_0x443a('0x49')](handleError(_0x4a0eed,null));};exports[_0x443a('0x5c')]=function(_0x4d55d8,_0x37471f){return db[_0x443a('0x32')][_0x443a('0x4d')]({'where':{'id':_0x4d55d8['params']['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x37471f,null))[_0x443a('0x2a')](removeEntity(_0x37471f,null))['catch'](handleError(_0x37471f,null));};function widgetAttributes(_0xa0abd5){try{switch(_0xa0abd5[_0x443a('0x35')]){case _0x443a('0x5d'):return[{'name':_0x443a('0x5e'),'value':_0xa0abd5[_0x443a('0x5e')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5['attrs'][0x0]['value']:undefined)||_0x443a('0x60')}];case _0x443a('0x61'):return[{'name':_0x443a('0x62'),'value':_0xa0abd5[_0x443a('0x62')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5['attrs'][0x0][_0x443a('0x63')]:undefined)||''}];case _0x443a('0x64'):return[{'name':_0x443a('0x65'),'value':_0xa0abd5['attrHourFormat']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x66')},{'name':_0x443a('0x67'),'value':_0xa0abd5[_0x443a('0x67')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x1]?_0xa0abd5['attrs'][0x1][_0x443a('0x63')]:undefined)||_0x443a('0x68')},{'name':_0x443a('0x69'),'value':_0xa0abd5['attrFontSize']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x2]?_0xa0abd5['attrs'][0x2][_0x443a('0x63')]:undefined)||0xc}];case _0x443a('0x6a'):return[{'name':'attrMetric','value':_0xa0abd5[_0x443a('0x6b')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x6c')},{'name':'attrVoiceQueues','value':_0xa0abd5[_0x443a('0x6d')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||[]},{'name':_0x443a('0x69'),'value':_0xa0abd5[_0x443a('0x69')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x2]?_0xa0abd5[_0x443a('0x5f')][0x2][_0x443a('0x63')]:undefined)||0x14},{'name':_0x443a('0x6e'),'value':_0xa0abd5[_0x443a('0x6e')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x3]?_0xa0abd5['attrs'][0x3][_0x443a('0x63')]:undefined)||'voice'},{'name':_0x443a('0x6f'),'value':_0xa0abd5['attrEmailAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x4]?_0xa0abd5[_0x443a('0x5f')][0x4][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x70'),'value':_0xa0abd5['attrFaxAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x5]?_0xa0abd5[_0x443a('0x5f')][0x5][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x71'),'value':_0xa0abd5[_0x443a('0x71')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x6]?_0xa0abd5[_0x443a('0x5f')][0x6][_0x443a('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xa0abd5[_0x443a('0x72')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x7]?_0xa0abd5[_0x443a('0x5f')][0x7][_0x443a('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xa0abd5[_0x443a('0x73')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x8]?_0xa0abd5['attrs'][0x8]['value']:undefined)||''},{'name':_0x443a('0x74'),'value':_0xa0abd5[_0x443a('0x74')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x9]?_0xa0abd5['attrs'][0x9][_0x443a('0x63')]:undefined)||''}];case'multibar-chart':case _0x443a('0x75'):return[{'name':'attrSerie1','value':_0xa0abd5[_0x443a('0x76')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x6c')},{'name':_0x443a('0x77'),'value':_0xa0abd5[_0x443a('0x77')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x78'),'value':_0xa0abd5[_0x443a('0x78')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x2]?_0xa0abd5[_0x443a('0x5f')][0x2][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x6d'),'value':_0xa0abd5[_0x443a('0x6d')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x3]?_0xa0abd5[_0x443a('0x5f')][0x3][_0x443a('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0xa0abd5['attrChannel']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x4]?_0xa0abd5['attrs'][0x4][_0x443a('0x63')]:undefined)||_0x443a('0x79')},{'name':'attrEmailAccounts','value':_0xa0abd5['attrEmailAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x5]?_0xa0abd5[_0x443a('0x5f')][0x5][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x70'),'value':_0xa0abd5['attrFaxAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x6]?_0xa0abd5['attrs'][0x6][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x71'),'value':_0xa0abd5[_0x443a('0x71')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x7]?_0xa0abd5[_0x443a('0x5f')][0x7]['value']:undefined)||''},{'name':_0x443a('0x72'),'value':_0xa0abd5[_0x443a('0x72')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x8]?_0xa0abd5[_0x443a('0x5f')][0x8][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x73'),'value':_0xa0abd5[_0x443a('0x73')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x9]?_0xa0abd5[_0x443a('0x5f')][0x9][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x74'),'value':_0xa0abd5[_0x443a('0x74')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0xa]?_0xa0abd5[_0x443a('0x5f')][0xa]['value']:undefined)||''}];case _0x443a('0x7a'):return[{'name':'attrReport','type':_0xa0abd5[_0x443a('0x7b')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x35')]:undefined)||null,'value':_0xa0abd5[_0x443a('0x7c')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x7d'),'value':_0xa0abd5['attrRefresh']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x2ab25c){logger[_0x443a('0x2d')](_0x443a('0x7e'),JSON[_0x443a('0x7f')](_0x2ab25c));return[];}}exports['addItem']=function(_0x1c0d86,_0x3c81ec,_0x171dc){if(_0x1c0d86[_0x443a('0x4f')]['id']){delete _0x1c0d86[_0x443a('0x4f')]['id'];}return db[_0x443a('0x32')][_0x443a('0x4d')]({'where':{'id':_0x1c0d86['params']['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x3c81ec,null))[_0x443a('0x2a')](function(_0x184b5d){if(_0x184b5d){_0x1c0d86[_0x443a('0x4f')][_0x443a('0x80')]=_0x184b5d['id'];_0x1c0d86['body'][_0x443a('0x5f')]=widgetAttributes(_0x1c0d86['body']);return db[_0x443a('0x81')][_0x443a('0x4e')](_0x1c0d86[_0x443a('0x4f')]);}})[_0x443a('0x2a')](respondWithResult(_0x3c81ec,null))[_0x443a('0x49')](handleError(_0x3c81ec,null));};exports[_0x443a('0x82')]=function(_0xc7a95a,_0x98776d,_0x4003bd){var _0x138459={};var _0x514be6={};var _0x5d41d6;var _0x3b8b99;return db[_0x443a('0x32')][_0x443a('0x83')]({'where':{'id':_0xc7a95a[_0x443a('0x4b')]['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x98776d,null))[_0x443a('0x2a')](function(_0xe4d89b){if(_0xe4d89b){_0x5d41d6=_0xe4d89b;_0x514be6['model']=_[_0x443a('0x38')](db[_0x443a('0x81')]['rawAttributes']);_0x514be6['query']=_[_0x443a('0x38')](_0xc7a95a[_0x443a('0x37')]);_0x514be6[_0x443a('0x41')]=_[_0x443a('0x39')](_0x514be6[_0x443a('0x36')],_0x514be6[_0x443a('0x37')]);_0x138459[_0x443a('0x3a')]=_['intersection'](_0x514be6[_0x443a('0x36')],qs[_0x443a('0x3b')](_0xc7a95a[_0x443a('0x37')][_0x443a('0x3b')]));_0x138459['attributes']=_0x138459[_0x443a('0x3a')][_0x443a('0x3c')]?_0x138459[_0x443a('0x3a')]:_0x514be6[_0x443a('0x36')];_0x138459[_0x443a('0x84')]=qs['sort'](_0xc7a95a['query'][_0x443a('0x3f')]);_0x138459[_0x443a('0x40')]=qs[_0x443a('0x41')](_[_0x443a('0x42')](_0xc7a95a[_0x443a('0x37')],_0x514be6['filters']));if(_0xc7a95a['query']['filter']){_0x138459[_0x443a('0x40')]=_[_0x443a('0x43')](_0x138459[_0x443a('0x40')],{'$or':_['map'](_0x138459['attributes'],function(_0x41969e){var _0x5e76ad={};_0x5e76ad[_0x41969e]={'$like':'%'+_0xc7a95a[_0x443a('0x37')][_0x443a('0x85')]+'%'};return _0x5e76ad;})});}_0x138459=_[_0x443a('0x43')]({},_0x138459,_0xc7a95a[_0x443a('0x45')]);return _0x5d41d6[_0x443a('0x82')](_0x138459);}})[_0x443a('0x2a')](function(_0x2b450f){if(_0x2b450f){_0x3b8b99=_0x2b450f[_0x443a('0x3c')];if(!_0xc7a95a[_0x443a('0x37')][_0x443a('0x3d')](_0x443a('0x3e'))){_0x138459['limit']=qs[_0x443a('0x21')](_0xc7a95a['query']['limit']);_0x138459[_0x443a('0x20')]=qs[_0x443a('0x20')](_0xc7a95a[_0x443a('0x37')][_0x443a('0x20')]);}return _0x5d41d6[_0x443a('0x82')](_0x138459);}})[_0x443a('0x2a')](function(_0x571772){if(_0x571772){return _0x571772?{'count':_0x3b8b99,'rows':_0x571772}:null;}})[_0x443a('0x2a')](respondWithResult(_0x98776d,null))[_0x443a('0x49')](handleError(_0x98776d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7cc0f17..bb3c591 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 _0x25b2=['remove','emit','hasOwnProperty','events','Dashboard','save','update'];(function(_0x1cc6c9,_0x1be68d){var _0x22c4e2=function(_0x55f99b){while(--_0x55f99b){_0x1cc6c9['push'](_0x1cc6c9['shift']());}};_0x22c4e2(++_0x1be68d);}(_0x25b2,0x1bc));var _0x225b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x25b2[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require(_0x225b('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x225b('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x225b('0x2'),'afterUpdate':_0x225b('0x3'),'afterDestroy':_0x225b('0x4')};function emitEvent(_0x5879af){return function(_0x59794d,_0x547433,_0x101756){DashboardEvents[_0x225b('0x5')](_0x5879af+':'+_0x59794d['id'],_0x59794d);DashboardEvents['emit'](_0x5879af,_0x59794d);_0x101756(null);};}for(var e in events){if(events[_0x225b('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x7715=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4fcb1a,_0x8277db){var _0x39d94d=function(_0x45a744){while(--_0x45a744){_0x4fcb1a['push'](_0x4fcb1a['shift']());}};_0x39d94d(++_0x8277db);}(_0x7715,0xbf));var _0x5771=function(_0x6bbc50,_0x26b8e9){_0x6bbc50=_0x6bbc50-0x0;var _0x5e8e93=_0x7715[_0x6bbc50];return _0x5e8e93;};'use strict';var EventEmitter=require(_0x5771('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x5771('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5771('0x2')](0x0);var events={'afterCreate':_0x5771('0x3'),'afterUpdate':_0x5771('0x4'),'afterDestroy':_0x5771('0x5')};function emitEvent(_0x5dd49a){return function(_0x8242be,_0x39ea41,_0x1e4aff){DashboardEvents[_0x5771('0x6')](_0x5dd49a+':'+_0x8242be['id'],_0x8242be);DashboardEvents[_0x5771('0x6')](_0x5dd49a,_0x8242be);_0x1e4aff(null);};}for(var e in events){if(events[_0x5771('0x7')](e)){var event=events[e];Dashboard[_0x5771('0x8')](e,emitEvent(event));}}module[_0x5771('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 5b83252..7268e38 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 _0x1c24=['api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1c24,0xc0));var _0x41c2=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1c24[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x41c2('0x0'));var util=require(_0x41c2('0x1'));var logger=require(_0x41c2('0x2'))(_0x41c2('0x3'));var moment=require(_0x41c2('0x4'));var BPromise=require(_0x41c2('0x5'));var rp=require(_0x41c2('0x6'));var fs=require('fs');var path=require(_0x41c2('0x7'));var rimraf=require(_0x41c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x41c2('0x9'));module[_0x41c2('0xa')]=function(_0x447e3e,_0xe68f40){return _0x447e3e[_0x41c2('0xb')](_0x41c2('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e2=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x70e2,0x7f));var _0x270e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x70e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var logger=require(_0x270e('0x2'))(_0x270e('0x3'));var moment=require(_0x270e('0x4'));var BPromise=require(_0x270e('0x5'));var rp=require(_0x270e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var attributes=require(_0x270e('0x9'));module[_0x270e('0xa')]=function(_0x58fd5d,_0x2cfe8e){return _0x58fd5d[_0x270e('0xb')](_0x270e('0xc'),attributes,{'tableName':_0x270e('0xd'),'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 6eba082..8ced157 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 _0x63e1=['code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x403fe9,_0x4853f0){var _0x9b5e77=function(_0x5fc61b){while(--_0x5fc61b){_0x403fe9['push'](_0x403fe9['shift']());}};_0x9b5e77(++_0x4853f0);}(_0x63e1,0xba));var _0x163e=function(_0x5a4870,_0x31bfe4){_0x5a4870=_0x5a4870-0x0;var _0xd1bb76=_0x63e1[_0x5a4870];return _0xd1bb76;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var moment=require(_0x163e('0x2'));var BPromise=require('bluebird');var rs=require(_0x163e('0x3'));var fs=require('fs');var Redis=require(_0x163e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x163e('0x5'));var logger=require(_0x163e('0x6'))(_0x163e('0x7'));var config=require(_0x163e('0x8'));var jayson=require(_0x163e('0x9'));var client=jayson[_0x163e('0xa')]['http']({'port':0x232a});config[_0x163e('0xb')]=_[_0x163e('0xc')](config[_0x163e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x163e('0xb')]));require(_0x163e('0xd'))[_0x163e('0xe')](socket);function respondWithRpcPromise(_0x460f13,_0x5ab3ea,_0x896ba7){return new BPromise(function(_0x349624,_0x48167b){return client[_0x163e('0xf')](_0x460f13,_0x896ba7)['then'](function(_0xae5d42){logger['info'](_0x163e('0x10'),_0x5ab3ea,_0x163e('0x11'));logger[_0x163e('0x12')](_0x163e('0x13'),_0x5ab3ea,_0x163e('0x11'),JSON[_0x163e('0x14')](_0xae5d42));if(_0xae5d42['error']){if(_0xae5d42[_0x163e('0x15')][_0x163e('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x5ab3ea,_0xae5d42[_0x163e('0x15')][_0x163e('0x17')]);return _0x48167b(_0xae5d42[_0x163e('0x15')][_0x163e('0x17')]);}logger['error'](_0x163e('0x10'),_0x5ab3ea,_0xae5d42[_0x163e('0x15')][_0x163e('0x17')]);return _0x349624(_0xae5d42['error'][_0x163e('0x17')]);}else{logger[_0x163e('0x18')](_0x163e('0x10'),_0x5ab3ea,'request\x20sent');_0x349624(_0xae5d42['result'][_0x163e('0x17')]);}})[_0x163e('0x19')](function(_0x24fe92){logger[_0x163e('0x15')](_0x163e('0x10'),_0x5ab3ea,_0x24fe92);_0x48167b(_0x24fe92);});});} \ No newline at end of file +var _0x2302=['moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2302,0x11d));var _0x2230=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x2302[_0xbeb808];return _0x5d6909;};'use strict';var _=require('lodash');var util=require(_0x2230('0x0'));var moment=require(_0x2230('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2230('0x2'));var logger=require(_0x2230('0x3'))('rpc');var config=require(_0x2230('0x4'));var jayson=require(_0x2230('0x5'));var client=jayson['client'][_0x2230('0x6')]({'port':0x232a});config[_0x2230('0x7')]=_['defaults'](config[_0x2230('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2230('0x8'))(new Redis(config[_0x2230('0x7')]));require(_0x2230('0x9'))['register'](socket);function respondWithRpcPromise(_0x13d5fc,_0x1e2e28,_0xbc6e91){return new BPromise(function(_0x289420,_0xb14c4b){return client[_0x2230('0xa')](_0x13d5fc,_0xbc6e91)[_0x2230('0xb')](function(_0x431b8e){logger[_0x2230('0xc')](_0x2230('0xd'),_0x1e2e28,'request\x20sent');logger[_0x2230('0xe')](_0x2230('0xf'),_0x1e2e28,'request\x20sent',JSON[_0x2230('0x10')](_0x431b8e));if(_0x431b8e[_0x2230('0x11')]){if(_0x431b8e[_0x2230('0x11')][_0x2230('0x12')]===0x1f4){logger[_0x2230('0x11')](_0x2230('0xd'),_0x1e2e28,_0x431b8e['error'][_0x2230('0x13')]);return _0xb14c4b(_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);}logger[_0x2230('0x11')]('Dashboard,\x20%s,\x20%s',_0x1e2e28,_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);return _0x289420(_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);}else{logger['info'](_0x2230('0xd'),_0x1e2e28,'request\x20sent');_0x289420(_0x431b8e[_0x2230('0x14')][_0x2230('0x13')]);}})[_0x2230('0x15')](function(_0x41a08e){logger[_0x2230('0x11')](_0x2230('0xd'),_0x1e2e28,_0x41a08e);_0xb14c4b(_0x41a08e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e6a0214..e535cb6 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 _0xc164=['dashboard:','./dashboard.events','save','remove','update','emit','register','length'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0xc164,0x161));var _0x4c16=function(_0x4346f0,_0x4706e6){_0x4346f0=_0x4346f0-0x0;var _0x229bff=_0xc164[_0x4346f0];return _0x229bff;};'use strict';var DashboardEvents=require(_0x4c16('0x0'));var events=[_0x4c16('0x1'),_0x4c16('0x2'),_0x4c16('0x3')];function createListener(_0x2c6322,_0xd701a3){return function(_0x4048f6){_0xd701a3[_0x4c16('0x4')](_0x2c6322,_0x4048f6);};}function removeListener(_0x468da1,_0x208e52){return function(){DashboardEvents['removeListener'](_0x468da1,_0x208e52);};}exports[_0x4c16('0x5')]=function(_0x4aad95){for(var _0x2a7f8d=0x0,_0x282a56=events[_0x4c16('0x6')];_0x2a7f8d<_0x282a56;_0x2a7f8d++){var _0x189526=events[_0x2a7f8d];var _0xac4229=createListener(_0x4c16('0x7')+_0x189526,_0x4aad95);DashboardEvents['on'](_0x189526,_0xac4229);}}; \ No newline at end of file +var _0xb636=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb636,0xe6));var _0x6b63=function(_0x424c12,_0x365dab){_0x424c12=_0x424c12-0x0;var _0x493f4e=_0xb636[_0x424c12];return _0x493f4e;};'use strict';var DashboardEvents=require(_0x6b63('0x0'));var events=[_0x6b63('0x1'),_0x6b63('0x2'),_0x6b63('0x3')];function createListener(_0x2a1863,_0x29dbc7){return function(_0x414020){_0x29dbc7[_0x6b63('0x4')](_0x2a1863,_0x414020);};}function removeListener(_0x259046,_0x5339d3){return function(){DashboardEvents['removeListener'](_0x259046,_0x5339d3);};}exports[_0x6b63('0x5')]=function(_0x377bf7){for(var _0x158bbd=0x0,_0x1aa1fa=events[_0x6b63('0x6')];_0x158bbd<_0x1aa1fa;_0x158bbd++){var _0x29bdd7=events[_0x158bbd];var _0x1abb3d=createListener(_0x6b63('0x7')+_0x29bdd7,_0x377bf7);DashboardEvents['on'](_0x29bdd7,_0x1abb3d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c6aa774..d1972a4 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 _0x1199=['isAuthenticated','index','get','/:id','show','/:id/items','getItems','create','/:id/clone','clone','post','addItem','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x5254e3,_0x5d9d92){var _0x4f8432=function(_0x1c8e09){while(--_0x1c8e09){_0x5254e3['push'](_0x5254e3['shift']());}};_0x4f8432(++_0x5d9d92);}(_0x1199,0x70));var _0x9119=function(_0x3ba753,_0x2f3216){_0x3ba753=_0x3ba753-0x0;var _0x2f469a=_0x1199[_0x3ba753];return _0x2f469a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9119('0x0'));var timeout=require('connect-timeout');var express=require(_0x9119('0x1'));var router=express[_0x9119('0x2')]();var fs_extra=require(_0x9119('0x3'));var auth=require(_0x9119('0x4'));var interaction=require(_0x9119('0x5'));var config=require(_0x9119('0x6'));var controller=require(_0x9119('0x7'));router['get']('/',auth[_0x9119('0x8')](),controller[_0x9119('0x9')]);router[_0x9119('0xa')](_0x9119('0xb'),auth[_0x9119('0x8')](),controller[_0x9119('0xc')]);router['get'](_0x9119('0xd'),auth[_0x9119('0x8')](),controller[_0x9119('0xe')]);router['post']('/',auth[_0x9119('0x8')](),controller[_0x9119('0xf')]);router['post'](_0x9119('0x10'),auth['isAuthenticated'](),controller[_0x9119('0x11')]);router[_0x9119('0x12')](_0x9119('0xd'),auth[_0x9119('0x8')](),controller[_0x9119('0x13')]);router['put'](_0x9119('0xb'),auth['isAuthenticated'](),controller[_0x9119('0x14')]);router[_0x9119('0x15')]('/:id',auth[_0x9119('0x8')](),controller[_0x9119('0x16')]);module[_0x9119('0x17')]=router; \ No newline at end of file +var _0x5a3a=['connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','create','post','clone','addItem','put','update','delete','destroy','multer','util','path'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5a3a,0x131));var _0xa5a3=function(_0x22ce8e,_0x196b6a){_0x22ce8e=_0x22ce8e-0x0;var _0x53d736=_0x5a3a[_0x22ce8e];return _0x53d736;};'use strict';var multer=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var path=require(_0xa5a3('0x2'));var timeout=require(_0xa5a3('0x3'));var express=require(_0xa5a3('0x4'));var router=express[_0xa5a3('0x5')]();var fs_extra=require(_0xa5a3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa5a3('0x7'));var controller=require(_0xa5a3('0x8'));router[_0xa5a3('0x9')]('/',auth[_0xa5a3('0xa')](),controller['index']);router[_0xa5a3('0x9')](_0xa5a3('0xb'),auth[_0xa5a3('0xa')](),controller[_0xa5a3('0xc')]);router[_0xa5a3('0x9')](_0xa5a3('0xd'),auth[_0xa5a3('0xa')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0xa5a3('0xe')]);router[_0xa5a3('0xf')]('/:id/clone',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x10')]);router['post'](_0xa5a3('0xd'),auth['isAuthenticated'](),controller[_0xa5a3('0x11')]);router[_0xa5a3('0x12')]('/:id',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x13')]);router[_0xa5a3('0x14')]('/:id',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x15')]);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 3d59a05..2aeaaf4 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 _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xacf4,0xe7));var _0x4acf=function(_0x4188a9,_0x2a7e0a){_0x4188a9=_0x4188a9-0x0;var _0x40a6a8=_0xacf4[_0x4188a9];return _0x40a6a8;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x01d9=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));var squel=require(_0x901d('0x1'));var _=require(_0x901d('0x2'));module[_0x901d('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6')),'get':function(){try{return JSON[_0x901d('0x7')](this[_0x901d('0x8')](_0x901d('0x9')));}catch(_0xb96b86){return[];}},'set':function(_0x4e7842){try{this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')](_0x4e7842));}catch(_0x12c39f){this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x901d('0xc')]},'col':{'type':Sequelize[_0x901d('0xc')]},'background':{'type':Sequelize[_0x901d('0x4')],'allowNull':![],'defaultValue':_0x901d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x901d('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x901d('0xc')],'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 fa539fa..be097d9 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 _0x8d0a=['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','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','show','params','model','DashboardItem','query','fields','attributes','includeAll','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x439a53,_0x51e060){var _0x2736e8=function(_0x54dac4){while(--_0x54dac4){_0x439a53['push'](_0x439a53['shift']());}};_0x2736e8(++_0x51e060);}(_0x8d0a,0x172));var _0xa8d0=function(_0x59af03,_0x817c2c){_0x59af03=_0x59af03-0x0;var _0x3a9c53=_0x8d0a[_0x59af03];return _0x3a9c53;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa8d0('0x1b')]=_[_0xa8d0('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa8d0('0x1d'))(new Redis(config[_0xa8d0('0x1b')]));require(_0xa8d0('0x1e'))[_0xa8d0('0x1f')](socket);function respondWithStatusCode(_0x2ebddf,_0x18f935){_0x18f935=_0x18f935||0xcc;return function(_0x192b0a){if(_0x192b0a){return _0x2ebddf[_0xa8d0('0x20')](_0x18f935);}return _0x2ebddf[_0xa8d0('0x21')](_0x18f935)[_0xa8d0('0x22')]();};}function respondWithResult(_0xfa19ee,_0x575f69){_0x575f69=_0x575f69||0xc8;return function(_0x728809){if(_0x728809){return _0xfa19ee[_0xa8d0('0x21')](_0x575f69)['json'](_0x728809);}};}function respondWithFilteredResult(_0x3e1dc6,_0x15620f){return function(_0x2899fb){if(_0x2899fb){var _0x434ad5=typeof _0x15620f[_0xa8d0('0x23')]==='undefined'&&typeof _0x15620f[_0xa8d0('0x24')]===_0xa8d0('0x25');var _0x213de2=_0x2899fb[_0xa8d0('0x26')];var _0x1b5dfb=_0x434ad5?0x0:_0x15620f[_0xa8d0('0x23')];var _0x21a6ca=_0x434ad5?_0x2899fb['count']:_0x15620f[_0xa8d0('0x23')]+_0x15620f[_0xa8d0('0x24')];var _0x3c8843;if(_0x21a6ca>=_0x213de2){_0x21a6ca=_0x213de2;_0x3c8843=0xc8;}else{_0x3c8843=0xce;}_0x3e1dc6[_0xa8d0('0x21')](_0x3c8843);return _0x3e1dc6['set'](_0xa8d0('0x27'),_0x1b5dfb+'-'+_0x21a6ca+'/'+_0x213de2)[_0xa8d0('0x28')](_0x2899fb);}return null;};}function patchUpdates(_0x3212a3){return function(_0x252682){try{jsonpatch['apply'](_0x252682,_0x3212a3,!![]);}catch(_0x150080){return BPromise[_0xa8d0('0x29')](_0x150080);}return _0x252682[_0xa8d0('0x2a')]();};}function saveUpdates(_0x1e9c3e,_0x55e6e0){return function(_0x35b4a6){if(_0x35b4a6){return _0x35b4a6[_0xa8d0('0x2b')](_0x1e9c3e)[_0xa8d0('0x2c')](function(_0x507d18){return _0x507d18;});}return null;};}function removeEntity(_0x34c0bf,_0x5f5dfb){return function(_0x3efa4e){if(_0x3efa4e){return _0x3efa4e[_0xa8d0('0x2d')]()['then'](function(){_0x34c0bf['status'](0xcc)[_0xa8d0('0x22')]();});}};}function handleEntityNotFound(_0x5d9a04,_0x312a29){return function(_0x327673){if(!_0x327673){_0x5d9a04[_0xa8d0('0x20')](0x194);}return _0x327673;};}function handleError(_0x460fae,_0x3ceaa9){_0x3ceaa9=_0x3ceaa9||0x1f4;return function(_0x5a5079){logger[_0xa8d0('0x2e')](_0x5a5079[_0xa8d0('0x2f')]);if(_0x5a5079[_0xa8d0('0x30')]){delete _0x5a5079['name'];}_0x460fae['status'](_0x3ceaa9)['send'](_0x5a5079);};}exports[_0xa8d0('0x31')]=function(_0xe5c8db,_0x2a8e98){var _0x1ae23f={'raw':![],'where':{'id':_0xe5c8db[_0xa8d0('0x32')]['id']}},_0x2c9ff2={};_0x2c9ff2[_0xa8d0('0x33')]=_['keys'](db[_0xa8d0('0x34')]['rawAttributes']);_0x2c9ff2[_0xa8d0('0x35')]=_['keys'](_0xe5c8db['query']);_0x2c9ff2['filters']=_['intersection'](_0x2c9ff2[_0xa8d0('0x33')],_0x2c9ff2[_0xa8d0('0x35')]);_0x1ae23f['attributes']=_['intersection'](_0x2c9ff2[_0xa8d0('0x33')],qs[_0xa8d0('0x36')](_0xe5c8db[_0xa8d0('0x35')][_0xa8d0('0x36')]));_0x1ae23f[_0xa8d0('0x37')]=_0x1ae23f['attributes']['length']?_0x1ae23f[_0xa8d0('0x37')]:_0x2c9ff2[_0xa8d0('0x33')];if(_0xe5c8db[_0xa8d0('0x35')][_0xa8d0('0x38')]){_0x1ae23f[_0xa8d0('0x39')]=[{'all':!![]}];}_0x1ae23f=_[_0xa8d0('0x3a')]({},_0x1ae23f,_0xe5c8db['options']);return db[_0xa8d0('0x34')][_0xa8d0('0x3b')](_0x1ae23f)[_0xa8d0('0x2c')](handleEntityNotFound(_0x2a8e98,null))['then'](respondWithResult(_0x2a8e98,null))[_0xa8d0('0x3c')](handleError(_0x2a8e98,null));};exports[_0xa8d0('0x2d')]=function(_0x285f08,_0x424a1d){return db[_0xa8d0('0x34')][_0xa8d0('0x3b')]({'where':{'id':_0x285f08[_0xa8d0('0x32')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x424a1d,null))[_0xa8d0('0x2c')](removeEntity(_0x424a1d,null))[_0xa8d0('0x3c')](handleError(_0x424a1d,null));};function widgetAttributes(_0x3563a9){try{switch(_0x3563a9['type']){case _0xa8d0('0x3d'):return[{'name':'attrUrl','value':_0x3563a9[_0xa8d0('0x3e')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x0]?_0x3563a9['attrs'][0x0][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x41')}];case _0xa8d0('0x42'):return[{'name':'attrPath','value':_0x3563a9[_0xa8d0('0x43')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x0]?_0x3563a9[_0xa8d0('0x3f')][0x0][_0xa8d0('0x40')]:undefined)||''}];case _0xa8d0('0x44'):return[{'name':_0xa8d0('0x45'),'value':_0x3563a9[_0xa8d0('0x45')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9['attrs'][0x0]?_0x3563a9[_0xa8d0('0x3f')][0x0][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x46')},{'name':_0xa8d0('0x47'),'value':_0x3563a9[_0xa8d0('0x47')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x1]?_0x3563a9[_0xa8d0('0x3f')][0x1][_0xa8d0('0x40')]:undefined)||'0.00'},{'name':_0xa8d0('0x48'),'value':_0x3563a9['attrFontSize']||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x2]?_0x3563a9['attrs'][0x2][_0xa8d0('0x40')]:undefined)||0xc}];case'counter':return[{'name':_0xa8d0('0x49'),'value':_0x3563a9[_0xa8d0('0x49')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9['attrs'][0x0]?_0x3563a9['attrs'][0x0][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x4a')},{'name':_0xa8d0('0x4b'),'value':_0x3563a9[_0xa8d0('0x4b')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x1]?_0x3563a9[_0xa8d0('0x3f')][0x1][_0xa8d0('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x3563a9[_0xa8d0('0x48')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x2]?_0x3563a9['attrs'][0x2][_0xa8d0('0x40')]:undefined)||0x14},{'name':_0xa8d0('0x4c'),'value':_0x3563a9[_0xa8d0('0x4c')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x3]?_0x3563a9[_0xa8d0('0x3f')][0x3][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x4d')},{'name':_0xa8d0('0x4e'),'value':_0x3563a9[_0xa8d0('0x4e')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x4]?_0x3563a9[_0xa8d0('0x3f')][0x4][_0xa8d0('0x40')]:undefined)||''},{'name':_0xa8d0('0x4f'),'value':_0x3563a9[_0xa8d0('0x4f')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x5]?_0x3563a9[_0xa8d0('0x3f')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3563a9[_0xa8d0('0x50')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x6]?_0x3563a9[_0xa8d0('0x3f')][0x6][_0xa8d0('0x40')]:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x3563a9[_0xa8d0('0x51')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x7]?_0x3563a9[_0xa8d0('0x3f')][0x7][_0xa8d0('0x40')]:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x3563a9[_0xa8d0('0x52')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x8]?_0x3563a9[_0xa8d0('0x3f')][0x8][_0xa8d0('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3563a9[_0xa8d0('0x53')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x9]?_0x3563a9[_0xa8d0('0x3f')][0x9][_0xa8d0('0x40')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xa8d0('0x54'),'value':_0x3563a9[_0xa8d0('0x54')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x0]?_0x3563a9[_0xa8d0('0x3f')][0x0][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x4a')},{'name':_0xa8d0('0x55'),'value':_0x3563a9[_0xa8d0('0x55')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x1]?_0x3563a9[_0xa8d0('0x3f')][0x1][_0xa8d0('0x40')]:undefined)||null},{'name':_0xa8d0('0x56'),'value':_0x3563a9[_0xa8d0('0x56')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x2]?_0x3563a9['attrs'][0x2][_0xa8d0('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3563a9[_0xa8d0('0x4b')]||(_0x3563a9['attrs']&&_0x3563a9['attrs'][0x3]?_0x3563a9[_0xa8d0('0x3f')][0x3][_0xa8d0('0x40')]:undefined)||[]},{'name':_0xa8d0('0x4c'),'value':_0x3563a9['attrChannel']||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9['attrs'][0x4]?_0x3563a9['attrs'][0x4][_0xa8d0('0x40')]:undefined)||_0xa8d0('0x4d')},{'name':_0xa8d0('0x4e'),'value':_0x3563a9['attrEmailAccounts']||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x5]?_0x3563a9[_0xa8d0('0x3f')][0x5][_0xa8d0('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3563a9[_0xa8d0('0x4f')]||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x6]?_0x3563a9[_0xa8d0('0x3f')][0x6][_0xa8d0('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3563a9[_0xa8d0('0x50')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x7]?_0x3563a9['attrs'][0x7]['value']:undefined)||''},{'name':_0xa8d0('0x51'),'value':_0x3563a9[_0xa8d0('0x51')]||(_0x3563a9['attrs']&&_0x3563a9['attrs'][0x8]?_0x3563a9[_0xa8d0('0x3f')][0x8][_0xa8d0('0x40')]:undefined)||''},{'name':_0xa8d0('0x52'),'value':_0x3563a9['attrWhatsappAccounts']||(_0x3563a9['attrs']&&_0x3563a9[_0xa8d0('0x3f')][0x9]?_0x3563a9['attrs'][0x9][_0xa8d0('0x40')]:undefined)||''},{'name':_0xa8d0('0x53'),'value':_0x3563a9['attrChatWebsites']||(_0x3563a9['attrs']&&_0x3563a9['attrs'][0xa]?_0x3563a9[_0xa8d0('0x3f')][0xa]['value']:undefined)||''}];case _0xa8d0('0x57'):return[{'name':_0xa8d0('0x58'),'type':_0x3563a9[_0xa8d0('0x59')]||(_0x3563a9['attrs']&&_0x3563a9['attrs'][0x0]?_0x3563a9['attrs'][0x0][_0xa8d0('0x5a')]:undefined)||null,'value':_0x3563a9[_0xa8d0('0x58')]||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9[_0xa8d0('0x3f')][0x0]?_0x3563a9[_0xa8d0('0x3f')][0x0]['value']:undefined)||null},{'name':_0xa8d0('0x5b'),'value':_0x3563a9['attrRefresh']||(_0x3563a9[_0xa8d0('0x3f')]&&_0x3563a9['attrs'][0x1]?_0x3563a9[_0xa8d0('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x16b690){logger[_0xa8d0('0x2e')](_0xa8d0('0x5c'),JSON[_0xa8d0('0x5d')](_0x16b690));return[];}}exports['create']=function(_0x409614,_0x1bbb16){if(_0x409614['body']){_0x409614[_0xa8d0('0x5e')][_0xa8d0('0x3f')]=widgetAttributes(_0x409614['body']);}return db[_0xa8d0('0x34')][_0xa8d0('0x5f')](_0x409614[_0xa8d0('0x5e')],{})[_0xa8d0('0x2c')](respondWithResult(_0x1bbb16,0xc9))['catch'](handleError(_0x1bbb16,null));};exports['update']=function(_0x2664fe,_0x62b34e){if(_0x2664fe[_0xa8d0('0x5e')]['id']){delete _0x2664fe[_0xa8d0('0x5e')]['id'];}_0x2664fe[_0xa8d0('0x5e')]['attrs']=widgetAttributes(_0x2664fe[_0xa8d0('0x5e')]);return db[_0xa8d0('0x34')][_0xa8d0('0x3b')]({'where':{'id':_0x2664fe[_0xa8d0('0x32')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x62b34e,null))[_0xa8d0('0x2c')](saveUpdates(_0x2664fe['body'],null))[_0xa8d0('0x2c')](respondWithResult(_0x62b34e,null))[_0xa8d0('0x3c')](handleError(_0x62b34e,null));}; \ No newline at end of file +var _0xf1c6=['send','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','then','catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x5ce53f,_0x8bf1ed){var _0x43bd0d=function(_0x2a5805){while(--_0x2a5805){_0x5ce53f['push'](_0x5ce53f['shift']());}};_0x43bd0d(++_0x8bf1ed);}(_0xf1c6,0x145));var _0x6f1c=function(_0xea926b,_0x17abeb){_0xea926b=_0xea926b-0x0;var _0x58d701=_0xf1c6[_0xea926b];return _0x58d701;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){_0x2b29af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500e36,_0x16fe5a){return function(_0x1ac9f5){if(!_0x1ac9f5){_0x500e36[_0x6f1c('0x15')](0x194);}return _0x1ac9f5;};}function handleError(_0x30267d,_0x29b952){_0x29b952=_0x29b952||0x1f4;return function(_0x66cb25){logger[_0x6f1c('0x24')](_0x66cb25[_0x6f1c('0x25')]);if(_0x66cb25[_0x6f1c('0x26')]){delete _0x66cb25[_0x6f1c('0x26')];}_0x30267d[_0x6f1c('0x17')](_0x29b952)[_0x6f1c('0x27')](_0x66cb25);};}exports['show']=function(_0x528e40,_0x1f783a){var _0x4084af={'raw':![],'where':{'id':_0x528e40[_0x6f1c('0x28')]['id']}},_0x383802={};_0x383802[_0x6f1c('0x29')]=_['keys'](db[_0x6f1c('0x2a')]['rawAttributes']);_0x383802[_0x6f1c('0x2b')]=_['keys'](_0x528e40[_0x6f1c('0x2b')]);_0x383802[_0x6f1c('0x2c')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],_0x383802[_0x6f1c('0x2b')]);_0x4084af[_0x6f1c('0x2e')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],qs[_0x6f1c('0x2f')](_0x528e40[_0x6f1c('0x2b')]['fields']));_0x4084af[_0x6f1c('0x2e')]=_0x4084af[_0x6f1c('0x2e')][_0x6f1c('0x30')]?_0x4084af[_0x6f1c('0x2e')]:_0x383802[_0x6f1c('0x29')];if(_0x528e40[_0x6f1c('0x2b')][_0x6f1c('0x31')]){_0x4084af[_0x6f1c('0x32')]=[{'all':!![]}];}_0x4084af=_[_0x6f1c('0x33')]({},_0x4084af,_0x528e40['options']);return db['DashboardItem'][_0x6f1c('0x34')](_0x4084af)[_0x6f1c('0x35')](handleEntityNotFound(_0x1f783a,null))[_0x6f1c('0x35')](respondWithResult(_0x1f783a,null))[_0x6f1c('0x36')](handleError(_0x1f783a,null));};exports[_0x6f1c('0x23')]=function(_0x84fa1c,_0x19d62b){return db[_0x6f1c('0x2a')][_0x6f1c('0x34')]({'where':{'id':_0x84fa1c[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x19d62b,null))[_0x6f1c('0x35')](removeEntity(_0x19d62b,null))[_0x6f1c('0x36')](handleError(_0x19d62b,null));};function widgetAttributes(_0x38d241){try{switch(_0x38d241[_0x6f1c('0x37')]){case _0x6f1c('0x38'):return[{'name':'attrUrl','value':_0x38d241['attrUrl']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x3b')}];case _0x6f1c('0x3c'):return[{'name':_0x6f1c('0x3d'),'value':_0x38d241[_0x6f1c('0x3d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x3e'):return[{'name':_0x6f1c('0x3f'),'value':_0x38d241['attrHourFormat']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x40')},{'name':_0x6f1c('0x41'),'value':_0x38d241[_0x6f1c('0x41')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x42')},{'name':_0x6f1c('0x43'),'value':_0x38d241[_0x6f1c('0x43')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||0xc}];case _0x6f1c('0x44'):return[{'name':_0x6f1c('0x45'),'value':_0x38d241[_0x6f1c('0x45')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x43'),'value':_0x38d241['attrFontSize']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241['attrs'][0x2][_0x6f1c('0x3a')]:undefined)||0x14},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241['attrs'][0x4][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4a'),'value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241[_0x6f1c('0x39')][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241[_0x6f1c('0x4b')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x8]?_0x38d241['attrs'][0x8]['value']:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x9]?_0x38d241[_0x6f1c('0x39')][0x9]['value']:undefined)||''}];case _0x6f1c('0x4f'):case _0x6f1c('0x50'):return[{'name':_0x6f1c('0x51'),'value':_0x38d241['attrSerie1']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241['attrs'][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x52'),'value':_0x38d241[_0x6f1c('0x52')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x38d241['attrSerie3']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||null},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241[_0x6f1c('0x39')][0x4][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241['attrs'][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241['attrSmsAccounts']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x8]?_0x38d241[_0x6f1c('0x39')][0x8][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x9]?_0x38d241['attrs'][0x9][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0xa]?_0x38d241[_0x6f1c('0x39')][0xa][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x53'):return[{'name':_0x6f1c('0x54'),'type':_0x38d241[_0x6f1c('0x55')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['type']:undefined)||null,'value':_0x38d241[_0x6f1c('0x54')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['value']:undefined)||null},{'name':_0x6f1c('0x56'),'value':_0x38d241[_0x6f1c('0x56')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x5a69ec){logger[_0x6f1c('0x24')](_0x6f1c('0x57'),JSON[_0x6f1c('0x58')](_0x5a69ec));return[];}}exports[_0x6f1c('0x59')]=function(_0x51ae01,_0xad0e0f){if(_0x51ae01[_0x6f1c('0x5a')]){_0x51ae01[_0x6f1c('0x5a')]['attrs']=widgetAttributes(_0x51ae01[_0x6f1c('0x5a')]);}return db[_0x6f1c('0x2a')]['create'](_0x51ae01[_0x6f1c('0x5a')],{})[_0x6f1c('0x35')](respondWithResult(_0xad0e0f,0xc9))[_0x6f1c('0x36')](handleError(_0xad0e0f,null));};exports[_0x6f1c('0x22')]=function(_0xc3e7c0,_0x4bd3e3){if(_0xc3e7c0['body']['id']){delete _0xc3e7c0[_0x6f1c('0x5a')]['id'];}_0xc3e7c0['body']['attrs']=widgetAttributes(_0xc3e7c0[_0x6f1c('0x5a')]);return db['DashboardItem'][_0x6f1c('0x34')]({'where':{'id':_0xc3e7c0[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x4bd3e3,null))[_0x6f1c('0x35')](saveUpdates(_0xc3e7c0[_0x6f1c('0x5a')],null))[_0x6f1c('0x35')](respondWithResult(_0x4bd3e3,null))[_0x6f1c('0x36')](handleError(_0x4bd3e3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d7891ad..bcf0161 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 _0x6f6a=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x317d31,_0x4184aa){var _0x3a7bf0=function(_0x5b7bd7){while(--_0x5b7bd7){_0x317d31['push'](_0x317d31['shift']());}};_0x3a7bf0(++_0x4184aa);}(_0x6f6a,0x14f));var _0xa6f6=function(_0x28a8d2,_0x649512){_0x28a8d2=_0x28a8d2-0x0;var _0x1ded4a=_0x6f6a[_0x28a8d2];return _0x1ded4a;};'use strict';var EventEmitter=require(_0xa6f6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa6f6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa6f6('0x2')](0x0);var events={'afterCreate':_0xa6f6('0x3'),'afterUpdate':_0xa6f6('0x4'),'afterDestroy':_0xa6f6('0x5')};function emitEvent(_0x5b796d){return function(_0x2fb2ee,_0x3c8ae2,_0x4c84ad){DashboardItemEvents[_0xa6f6('0x6')](_0x5b796d+':'+_0x2fb2ee['id'],_0x2fb2ee);DashboardItemEvents[_0xa6f6('0x6')](_0x5b796d,_0x2fb2ee);_0x4c84ad(null);};}for(var e in events){if(events[_0xa6f6('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xe24a=['hook','events','../../mysqldb','DashboardItem','setMaxListeners','emit'];(function(_0x155c1d,_0x20e1e3){var _0x199869=function(_0x5be264){while(--_0x5be264){_0x155c1d['push'](_0x155c1d['shift']());}};_0x199869(++_0x20e1e3);}(_0xe24a,0x151));var _0xae24=function(_0x559aca,_0x41a249){_0x559aca=_0x559aca-0x0;var _0x5627fe=_0xe24a[_0x559aca];return _0x5627fe;};'use strict';var EventEmitter=require(_0xae24('0x0'));var DashboardItem=require(_0xae24('0x1'))['db'][_0xae24('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xae24('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b31c5){return function(_0x34724c,_0x136d5a,_0x3c8429){DashboardItemEvents[_0xae24('0x4')](_0x1b31c5+':'+_0x34724c['id'],_0x34724c);DashboardItemEvents[_0xae24('0x4')](_0x1b31c5,_0x34724c);_0x3c8429(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xae24('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1f6711b..14537f4 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 _0xd498=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xd498,0xa6));var _0x8d49=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xd498[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x8d49('0x0'));var util=require(_0x8d49('0x1'));var logger=require(_0x8d49('0x2'))(_0x8d49('0x3'));var moment=require(_0x8d49('0x4'));var BPromise=require(_0x8d49('0x5'));var rp=require(_0x8d49('0x6'));var fs=require('fs');var path=require(_0x8d49('0x7'));var rimraf=require(_0x8d49('0x8'));var config=require(_0x8d49('0x9'));var attributes=require(_0x8d49('0xa'));module['exports']=function(_0x540913,_0x260170){return _0x540913[_0x8d49('0xb')](_0x8d49('0xc'),attributes,{'tableName':_0x8d49('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a2=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0a2,0x128));var _0x2d0a=function(_0x45735b,_0x15bf2f){_0x45735b=_0x45735b-0x0;var _0x1c7553=_0xd0a2[_0x45735b];return _0x1c7553;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d0a('0x0'))(_0x2d0a('0x1'));var moment=require(_0x2d0a('0x2'));var BPromise=require(_0x2d0a('0x3'));var rp=require(_0x2d0a('0x4'));var fs=require('fs');var path=require(_0x2d0a('0x5'));var rimraf=require(_0x2d0a('0x6'));var config=require(_0x2d0a('0x7'));var attributes=require(_0x2d0a('0x8'));module[_0x2d0a('0x9')]=function(_0x2c76e2,_0x129a7e){return _0x2c76e2[_0x2d0a('0xa')](_0x2d0a('0xb'),attributes,{'tableName':_0x2d0a('0xc'),'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 87a555a..6a2aea0 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 _0x9191=['DashboardItem,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9191,0x1e9));var _0x1919=function(_0x4bffb6,_0x15fb8e){_0x4bffb6=_0x4bffb6-0x0;var _0x1a44f3=_0x9191[_0x4bffb6];return _0x1a44f3;};'use strict';var _=require(_0x1919('0x0'));var util=require('util');var moment=require(_0x1919('0x1'));var BPromise=require(_0x1919('0x2'));var rs=require(_0x1919('0x3'));var fs=require('fs');var Redis=require(_0x1919('0x4'));var db=require(_0x1919('0x5'))['db'];var utils=require(_0x1919('0x6'));var logger=require(_0x1919('0x7'))(_0x1919('0x8'));var config=require(_0x1919('0x9'));var jayson=require(_0x1919('0xa'));var client=jayson[_0x1919('0xb')]['http']({'port':0x232a});config[_0x1919('0xc')]=_[_0x1919('0xd')](config[_0x1919('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1919('0xc')]));require('./dashboardItem.socket')[_0x1919('0xe')](socket);function respondWithRpcPromise(_0x5e2961,_0x267546,_0x42b11b){return new BPromise(function(_0x37f91e,_0x30d9f5){return client[_0x1919('0xf')](_0x5e2961,_0x42b11b)[_0x1919('0x10')](function(_0x4e7435){logger[_0x1919('0x11')]('DashboardItem,\x20%s,\x20%s',_0x267546,'request\x20sent');logger[_0x1919('0x12')](_0x1919('0x13'),_0x267546,_0x1919('0x14'),JSON[_0x1919('0x15')](_0x4e7435));if(_0x4e7435[_0x1919('0x16')]){if(_0x4e7435['error'][_0x1919('0x17')]===0x1f4){logger['error'](_0x1919('0x18'),_0x267546,_0x4e7435[_0x1919('0x16')][_0x1919('0x19')]);return _0x30d9f5(_0x4e7435[_0x1919('0x16')][_0x1919('0x19')]);}logger[_0x1919('0x16')](_0x1919('0x18'),_0x267546,_0x4e7435[_0x1919('0x16')][_0x1919('0x19')]);return _0x37f91e(_0x4e7435[_0x1919('0x16')][_0x1919('0x19')]);}else{logger[_0x1919('0x11')](_0x1919('0x18'),_0x267546,_0x1919('0x14'));_0x37f91e(_0x4e7435['result']['message']);}})[_0x1919('0x1a')](function(_0x45cc5f){logger[_0x1919('0x16')]('DashboardItem,\x20%s,\x20%s',_0x267546,_0x45cc5f);_0x30d9f5(_0x45cc5f);});});} \ No newline at end of file +var _0xc381=['defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x3b8572,_0x5d4436){var _0xf67c47=function(_0x2cd8c2){while(--_0x2cd8c2){_0x3b8572['push'](_0x3b8572['shift']());}};_0xf67c47(++_0x5d4436);}(_0xc381,0x67));var _0x1c38=function(_0x51dad1,_0x442770){_0x51dad1=_0x51dad1-0x0;var _0x3c041d=_0xc381[_0x51dad1];return _0x3c041d;};'use strict';var _=require(_0x1c38('0x0'));var util=require('util');var moment=require(_0x1c38('0x1'));var BPromise=require(_0x1c38('0x2'));var rs=require(_0x1c38('0x3'));var fs=require('fs');var Redis=require(_0x1c38('0x4'));var db=require(_0x1c38('0x5'))['db'];var utils=require(_0x1c38('0x6'));var logger=require(_0x1c38('0x7'))(_0x1c38('0x8'));var config=require(_0x1c38('0x9'));var jayson=require(_0x1c38('0xa'));var client=jayson['client'][_0x1c38('0xb')]({'port':0x232a});config[_0x1c38('0xc')]=_[_0x1c38('0xd')](config[_0x1c38('0xc')],{'host':_0x1c38('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c38('0xf'))[_0x1c38('0x10')](socket);function respondWithRpcPromise(_0xdcf64c,_0x1f010e,_0x168360){return new BPromise(function(_0x47ddba,_0x57cd5d){return client[_0x1c38('0x11')](_0xdcf64c,_0x168360)[_0x1c38('0x12')](function(_0x11ba6d){logger[_0x1c38('0x13')](_0x1c38('0x14'),_0x1f010e,'request\x20sent');logger[_0x1c38('0x15')](_0x1c38('0x16'),_0x1f010e,'request\x20sent',JSON[_0x1c38('0x17')](_0x11ba6d));if(_0x11ba6d[_0x1c38('0x18')]){if(_0x11ba6d['error']['code']===0x1f4){logger['error'](_0x1c38('0x14'),_0x1f010e,_0x11ba6d['error'][_0x1c38('0x19')]);return _0x57cd5d(_0x11ba6d[_0x1c38('0x18')][_0x1c38('0x19')]);}logger[_0x1c38('0x18')](_0x1c38('0x14'),_0x1f010e,_0x11ba6d[_0x1c38('0x18')]['message']);return _0x47ddba(_0x11ba6d[_0x1c38('0x18')][_0x1c38('0x19')]);}else{logger[_0x1c38('0x13')](_0x1c38('0x14'),_0x1f010e,_0x1c38('0x1a'));_0x47ddba(_0x11ba6d[_0x1c38('0x1b')][_0x1c38('0x19')]);}})[_0x1c38('0x1c')](function(_0x2a9df5){logger[_0x1c38('0x18')](_0x1c38('0x14'),_0x1f010e,_0x2a9df5);_0x57cd5d(_0x2a9df5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 935a4ca..c937d3e 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 _0x8f67=['./dashboardItem.events','save','remove','update','register','length','dashboardItem:'];(function(_0x1a508b,_0x47f7ac){var _0x35bca4=function(_0x47c854){while(--_0x47c854){_0x1a508b['push'](_0x1a508b['shift']());}};_0x35bca4(++_0x47f7ac);}(_0x8f67,0x118));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0x78f6('0x0'));var events=[_0x78f6('0x1'),_0x78f6('0x2'),_0x78f6('0x3')];function createListener(_0x161c50,_0xe7e76a){return function(_0x401a4c){_0xe7e76a['emit'](_0x161c50,_0x401a4c);};}function removeListener(_0x331b2f,_0x5d7ecf){return function(){DashboardItemEvents['removeListener'](_0x331b2f,_0x5d7ecf);};}exports[_0x78f6('0x4')]=function(_0x272a53){for(var _0x473b52=0x0,_0x468c2a=events[_0x78f6('0x5')];_0x473b52<_0x468c2a;_0x473b52++){var _0x220505=events[_0x473b52];var _0x3922f5=createListener(_0x78f6('0x6')+_0x220505,_0x272a53);DashboardItemEvents['on'](_0x220505,_0x3922f5);}}; \ No newline at end of file +var _0x8fea=['dashboardItem:','./dashboardItem.events','remove','emit','removeListener','register','length'];(function(_0x238c7b,_0x555793){var _0xdfbf6a=function(_0x2b00ed){while(--_0x2b00ed){_0x238c7b['push'](_0x238c7b['shift']());}};_0xdfbf6a(++_0x555793);}(_0x8fea,0x174));var _0xa8fe=function(_0x3187b0,_0x4cee2a){_0x3187b0=_0x3187b0-0x0;var _0x12c691=_0x8fea[_0x3187b0];return _0x12c691;};'use strict';var DashboardItemEvents=require(_0xa8fe('0x0'));var events=['save',_0xa8fe('0x1'),'update'];function createListener(_0x128f18,_0x23ebdb){return function(_0x4682f7){_0x23ebdb[_0xa8fe('0x2')](_0x128f18,_0x4682f7);};}function removeListener(_0x2f0a9e,_0x194666){return function(){DashboardItemEvents[_0xa8fe('0x3')](_0x2f0a9e,_0x194666);};}exports[_0xa8fe('0x4')]=function(_0x1d09db){for(var _0x347ad1=0x0,_0x531d7f=events[_0xa8fe('0x5')];_0x347ad1<_0x531d7f;_0x347ad1++){var _0x593a47=events[_0x347ad1];var _0x14b50a=createListener(_0xa8fe('0x6')+_0x593a47,_0x1d09db);DashboardItemEvents['on'](_0x593a47,_0x14b50a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1f7e1e9..e454f01 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 _0xbe05=['./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e965d,_0xa6c48a){var _0x5a6701=function(_0x5c41f3){while(--_0x5c41f3){_0x3e965d['push'](_0x3e965d['shift']());}};_0x5a6701(++_0xa6c48a);}(_0xbe05,0x9b));var _0x5be0=function(_0x22a71c,_0x29f082){_0x22a71c=_0x22a71c-0x0;var _0x2f7a35=_0xbe05[_0x22a71c];return _0x2f7a35;};'use strict';var multer=require(_0x5be0('0x0'));var util=require(_0x5be0('0x1'));var path=require(_0x5be0('0x2'));var timeout=require(_0x5be0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5be0('0x4'));var auth=require(_0x5be0('0x5'));var interaction=require(_0x5be0('0x6'));var config=require('../../config/environment');var controller=require(_0x5be0('0x7'));router[_0x5be0('0x8')](_0x5be0('0x9'),auth[_0x5be0('0xa')](),controller['show']);router[_0x5be0('0xb')]('/',auth[_0x5be0('0xa')](),controller[_0x5be0('0xc')]);router[_0x5be0('0xd')](_0x5be0('0x9'),auth['isAuthenticated'](),controller[_0x5be0('0xe')]);router[_0x5be0('0xf')](_0x5be0('0x9'),auth['isAuthenticated'](),controller[_0x5be0('0x10')]);module[_0x5be0('0x11')]=router; \ No newline at end of file +var _0x8bbc=['../../components/auth/service','../../components/interaction/service','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x44b276,_0x2d1c08){var _0x411926=function(_0xbfa23e){while(--_0xbfa23e){_0x44b276['push'](_0x44b276['shift']());}};_0x411926(++_0x2d1c08);}(_0x8bbc,0x19b));var _0xc8bb=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x8bbc[_0x401676];return _0x4f13fe;};'use strict';var multer=require(_0xc8bb('0x0'));var util=require(_0xc8bb('0x1'));var path=require(_0xc8bb('0x2'));var timeout=require(_0xc8bb('0x3'));var express=require(_0xc8bb('0x4'));var router=express[_0xc8bb('0x5')]();var fs_extra=require(_0xc8bb('0x6'));var auth=require(_0xc8bb('0x7'));var interaction=require(_0xc8bb('0x8'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xc8bb('0x9')](_0xc8bb('0xa'),auth['isAuthenticated'](),controller[_0xc8bb('0xb')]);router[_0xc8bb('0xc')]('/',auth[_0xc8bb('0xd')](),controller[_0xc8bb('0xe')]);router[_0xc8bb('0xf')](_0xc8bb('0xa'),auth['isAuthenticated'](),controller[_0xc8bb('0x10')]);router[_0xc8bb('0x11')](_0xc8bb('0xa'),auth[_0xc8bb('0xd')](),controller[_0xc8bb('0x12')]);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 1cef6f0..044c6ff 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 _0x135b=['ENUM','first','second','sequelize','STRING'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x135b,0xf3));var _0xb135=function(_0x487683,_0x58b9b8){_0x487683=_0x487683-0x0;var _0x178a4d=_0x135b[_0x487683];return _0x178a4d;};'use strict';var Sequelize=require(_0xb135('0x0'));module['exports']={'name':{'type':Sequelize[_0xb135('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xb135('0x2')](_0xb135('0x3'),_0xb135('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c8a=['ENUM','first','third','sequelize','exports','STRING'];(function(_0x2a6b52,_0x19c4a7){var _0x52e5cc=function(_0x5beb81){while(--_0x5beb81){_0x2a6b52['push'](_0x2a6b52['shift']());}};_0x52e5cc(++_0x19c4a7);}(_0x1c8a,0x18f));var _0xa1c8=function(_0x59170f,_0x248ca7){_0x59170f=_0x59170f-0x0;var _0x18534f=_0x1c8a[_0x59170f];return _0x18534f;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module[_0xa1c8('0x1')]={'name':{'type':Sequelize[_0xa1c8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa1c8('0x3')](_0xa1c8('0x4'),'second',_0xa1c8('0x5')),'allowNull':![],'defaultValue':_0xa1c8('0x4')},'description':{'type':Sequelize[_0xa1c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d09a9ee..73bf442 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 _0xde7f=['order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','find','params','fast-json-patch','request-promise','bluebird','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','then','destroy','sendStatus','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0xde7f,0x1f0));var _0xfde7=function(_0xf00250,_0x4d92e5){_0xf00250=_0xf00250-0x0;var _0x4f00ac=_0xde7f[_0xf00250];return _0x4f00ac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfde7('0x0'));var rp=require(_0xfde7('0x1'));var moment=require('moment');var BPromise=require(_0xfde7('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfde7('0x3'));var fs=require('fs');var fs_extra=require(_0xfde7('0x4'));var _=require(_0xfde7('0x5'));var squel=require('squel');var crypto=require(_0xfde7('0x6'));var jsforce=require(_0xfde7('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xfde7('0x8'));var querystring=require(_0xfde7('0x9'));var Papa=require(_0xfde7('0xa'));var Redis=require('ioredis');var authService=require(_0xfde7('0xb'));var qs=require(_0xfde7('0xc'));var as=require(_0xfde7('0xd'));var hardwareService=require(_0xfde7('0xe'));var logger=require('../../config/logger')(_0xfde7('0xf'));var utils=require(_0xfde7('0x10'));var config=require(_0xfde7('0x11'));var licenseUtil=require(_0xfde7('0x12'));var db=require(_0xfde7('0x13'))['db'];function respondWithStatusCode(_0xcbf0ff,_0x45c2fe){_0x45c2fe=_0x45c2fe||0xcc;return function(_0x579e03){if(_0x579e03){return _0xcbf0ff['sendStatus'](_0x45c2fe);}return _0xcbf0ff[_0xfde7('0x14')](_0x45c2fe)[_0xfde7('0x15')]();};}function respondWithResult(_0x33a664,_0x352ded){_0x352ded=_0x352ded||0xc8;return function(_0xe7097c){if(_0xe7097c){return _0x33a664[_0xfde7('0x14')](_0x352ded)['json'](_0xe7097c);}};}function respondWithFilteredResult(_0xb19ec2,_0x3edbfc){return function(_0x168cd3){if(_0x168cd3){var _0x5652a2=typeof _0x3edbfc[_0xfde7('0x16')]===_0xfde7('0x17')&&typeof _0x3edbfc[_0xfde7('0x18')]===_0xfde7('0x17');var _0x4e0ab5=_0x168cd3[_0xfde7('0x19')];var _0x10d007=_0x5652a2?0x0:_0x3edbfc['offset'];var _0x444807=_0x5652a2?_0x168cd3['count']:_0x3edbfc[_0xfde7('0x16')]+_0x3edbfc[_0xfde7('0x18')];var _0x39a735;if(_0x444807>=_0x4e0ab5){_0x444807=_0x4e0ab5;_0x39a735=0xc8;}else{_0x39a735=0xce;}_0xb19ec2[_0xfde7('0x14')](_0x39a735);return _0xb19ec2[_0xfde7('0x1a')]('Content-Range',_0x10d007+'-'+_0x444807+'/'+_0x4e0ab5)[_0xfde7('0x1b')](_0x168cd3);}return null;};}function patchUpdates(_0xae80ea){return function(_0xabc5c3){try{jsonpatch[_0xfde7('0x1c')](_0xabc5c3,_0xae80ea,!![]);}catch(_0x531c1a){return BPromise['reject'](_0x531c1a);}return _0xabc5c3[_0xfde7('0x1d')]();};}function saveUpdates(_0x52e63b,_0x727546){return function(_0x32db2b){if(_0x32db2b){return _0x32db2b['update'](_0x52e63b)[_0xfde7('0x1e')](function(_0x4699cb){return _0x4699cb;});}return null;};}function removeEntity(_0x16961f,_0x5e7881){return function(_0x4cebfc){if(_0x4cebfc){return _0x4cebfc[_0xfde7('0x1f')]()[_0xfde7('0x1e')](function(){var _0xc35d83=_0x4cebfc['get']({'plain':!![]});var _0x1cf2d4='Dispositions';return db['UserProfileResource'][_0xfde7('0x1f')]({'where':{'type':_0x1cf2d4,'resourceId':_0xc35d83['id']}})[_0xfde7('0x1e')](function(){return _0x4cebfc;});})['then'](function(){_0x16961f[_0xfde7('0x14')](0xcc)[_0xfde7('0x15')]();});}};}function handleEntityNotFound(_0xf512f4,_0x472a15){return function(_0x1d2f91){if(!_0x1d2f91){_0xf512f4[_0xfde7('0x20')](0x194);}return _0x1d2f91;};}function handleError(_0x57feb1,_0x36dc28){_0x36dc28=_0x36dc28||0x1f4;return function(_0x152ec3){logger['error'](_0x152ec3['stack']);if(_0x152ec3[_0xfde7('0x21')]){delete _0x152ec3[_0xfde7('0x21')];}_0x57feb1[_0xfde7('0x14')](_0x36dc28)[_0xfde7('0x22')](_0x152ec3);};}exports[_0xfde7('0x23')]=function(_0x1d7249,_0x5d0c35){var _0x494ab5={},_0x1190e4={},_0x2a9ea8={'count':0x0,'rows':[]};var _0x295abe=_[_0xfde7('0x24')](db[_0xfde7('0x25')][_0xfde7('0x26')],function(_0x219008){return{'name':_0x219008[_0xfde7('0x27')],'type':_0x219008[_0xfde7('0x28')][_0xfde7('0x29')]};});_0x1190e4[_0xfde7('0x2a')]=_['map'](_0x295abe,_0xfde7('0x21'));_0x1190e4[_0xfde7('0x2b')]=_['keys'](_0x1d7249['query']);_0x1190e4[_0xfde7('0x2c')]=_['intersection'](_0x1190e4['model'],_0x1190e4['query']);_0x494ab5['attributes']=_[_0xfde7('0x2d')](_0x1190e4[_0xfde7('0x2a')],qs['fields'](_0x1d7249[_0xfde7('0x2b')][_0xfde7('0x2e')]));_0x494ab5[_0xfde7('0x2f')]=_0x494ab5[_0xfde7('0x2f')]['length']?_0x494ab5[_0xfde7('0x2f')]:_0x1190e4['model'];if(!_0x1d7249['query'][_0xfde7('0x30')](_0xfde7('0x31'))){_0x494ab5[_0xfde7('0x18')]=qs['limit'](_0x1d7249[_0xfde7('0x2b')][_0xfde7('0x18')]);_0x494ab5['offset']=qs[_0xfde7('0x16')](_0x1d7249[_0xfde7('0x2b')]['offset']);}_0x494ab5[_0xfde7('0x32')]=qs[_0xfde7('0x33')](_0x1d7249[_0xfde7('0x2b')][_0xfde7('0x33')]);_0x494ab5[_0xfde7('0x34')]=qs[_0xfde7('0x2c')](_['pick'](_0x1d7249[_0xfde7('0x2b')],_0x1190e4[_0xfde7('0x2c')]),_0x295abe);if(_0x1d7249[_0xfde7('0x2b')][_0xfde7('0x35')]){_0x494ab5[_0xfde7('0x34')]=_[_0xfde7('0x36')](_0x494ab5['where'],{'$or':_[_0xfde7('0x24')](_0x295abe,function(_0x39da14){if(_0x39da14[_0xfde7('0x28')]!==_0xfde7('0x37')){var _0x1514e3={};_0x1514e3[_0x39da14[_0xfde7('0x21')]]={'$like':'%'+_0x1d7249[_0xfde7('0x2b')][_0xfde7('0x35')]+'%'};return _0x1514e3;}})});}_0x494ab5=_[_0xfde7('0x36')]({},_0x494ab5,_0x1d7249[_0xfde7('0x38')]);var _0x308670={'where':_0x494ab5[_0xfde7('0x34')]};return db[_0xfde7('0x25')][_0xfde7('0x19')](_0x308670)['then'](function(_0x1865c5){_0x2a9ea8[_0xfde7('0x19')]=_0x1865c5;if(_0x1d7249[_0xfde7('0x2b')]['includeAll']){_0x494ab5[_0xfde7('0x39')]=[{'all':!![]}];}return db[_0xfde7('0x25')][_0xfde7('0x3a')](_0x494ab5);})[_0xfde7('0x1e')](function(_0x25fee3){_0x2a9ea8[_0xfde7('0x3b')]=_0x25fee3;return _0x2a9ea8;})[_0xfde7('0x1e')](respondWithFilteredResult(_0x5d0c35,_0x494ab5))[_0xfde7('0x3c')](handleError(_0x5d0c35,null));};exports[_0xfde7('0x3d')]=function(_0x1e169f,_0xc4f9fc){var _0x222739={'raw':!![],'where':{'id':_0x1e169f['params']['id']}},_0x5b1e39={};_0x5b1e39[_0xfde7('0x2a')]=_[_0xfde7('0x3e')](db[_0xfde7('0x25')]['rawAttributes']);_0x5b1e39[_0xfde7('0x2b')]=_['keys'](_0x1e169f[_0xfde7('0x2b')]);_0x5b1e39[_0xfde7('0x2c')]=_['intersection'](_0x5b1e39['model'],_0x5b1e39['query']);_0x222739[_0xfde7('0x2f')]=_[_0xfde7('0x2d')](_0x5b1e39[_0xfde7('0x2a')],qs[_0xfde7('0x2e')](_0x1e169f[_0xfde7('0x2b')][_0xfde7('0x2e')]));_0x222739[_0xfde7('0x2f')]=_0x222739[_0xfde7('0x2f')]['length']?_0x222739[_0xfde7('0x2f')]:_0x5b1e39[_0xfde7('0x2a')];if(_0x1e169f[_0xfde7('0x2b')][_0xfde7('0x3f')]){_0x222739[_0xfde7('0x39')]=[{'all':!![]}];}_0x222739=_[_0xfde7('0x36')]({},_0x222739,_0x1e169f[_0xfde7('0x38')]);return db[_0xfde7('0x25')]['find'](_0x222739)[_0xfde7('0x1e')](handleEntityNotFound(_0xc4f9fc,null))[_0xfde7('0x1e')](respondWithResult(_0xc4f9fc,null))[_0xfde7('0x3c')](handleError(_0xc4f9fc,null));};exports[_0xfde7('0x40')]=function(_0x56d9b9,_0x4d13b8){return db[_0xfde7('0x25')][_0xfde7('0x40')](_0x56d9b9[_0xfde7('0x41')],{})[_0xfde7('0x1e')](function(_0x51a893){var _0x4370c6=_0x56d9b9[_0xfde7('0x42')][_0xfde7('0x43')]({'plain':!![]});if(!_0x4370c6)throw new Error(_0xfde7('0x44'));if(_0x4370c6[_0xfde7('0x45')]===_0xfde7('0x42')){var _0x8bdfe6=_0x51a893[_0xfde7('0x43')]({'plain':!![]});var _0x1233f1='Dispositions';return db[_0xfde7('0x46')]['find']({'where':{'name':_0x1233f1,'userProfileId':_0x4370c6[_0xfde7('0x47')]},'raw':!![]})[_0xfde7('0x1e')](function(_0x5e3a76){if(_0x5e3a76&&_0x5e3a76[_0xfde7('0x48')]===0x0){return db[_0xfde7('0x49')][_0xfde7('0x40')]({'name':_0x8bdfe6[_0xfde7('0x21')],'resourceId':_0x8bdfe6['id'],'type':_0x5e3a76['name'],'sectionId':_0x5e3a76['id']},{})[_0xfde7('0x1e')](function(){return _0x51a893;});}else{return _0x51a893;}})[_0xfde7('0x3c')](function(_0x50ea68){logger[_0xfde7('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ea68);throw _0x50ea68;});}return _0x51a893;})[_0xfde7('0x1e')](respondWithResult(_0x4d13b8,0xc9))[_0xfde7('0x3c')](handleError(_0x4d13b8,null));};exports[_0xfde7('0x4b')]=function(_0x4e0bcc,_0x4761c4){if(_0x4e0bcc[_0xfde7('0x41')]['id']){delete _0x4e0bcc[_0xfde7('0x41')]['id'];}return db[_0xfde7('0x25')][_0xfde7('0x4c')]({'where':{'id':_0x4e0bcc[_0xfde7('0x4d')]['id']}})[_0xfde7('0x1e')](handleEntityNotFound(_0x4761c4,null))[_0xfde7('0x1e')](saveUpdates(_0x4e0bcc[_0xfde7('0x41')],null))[_0xfde7('0x1e')](respondWithResult(_0x4761c4,null))['catch'](handleError(_0x4761c4,null));};exports[_0xfde7('0x1f')]=function(_0x80e8c5,_0x230702){return db[_0xfde7('0x25')][_0xfde7('0x4c')]({'where':{'id':_0x80e8c5[_0xfde7('0x4d')]['id']}})[_0xfde7('0x1e')](handleEntityNotFound(_0x230702,null))['then'](removeEntity(_0x230702,null))[_0xfde7('0x3c')](handleError(_0x230702,null));}; \ No newline at end of file +var _0x77ed=['role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Disposition','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x77ed,0x152));var _0xd77e=function(_0x2fbb0a,_0x2af047){_0x2fbb0a=_0x2fbb0a-0x0;var _0x3b5550=_0x77ed[_0x2fbb0a];return _0x3b5550;};'use strict';var emlformat=require(_0xd77e('0x0'));var rimraf=require(_0xd77e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd77e('0x2'));var rp=require('request-promise');var moment=require(_0xd77e('0x3'));var BPromise=require(_0xd77e('0x4'));var Mustache=require('mustache');var util=require(_0xd77e('0x5'));var path=require(_0xd77e('0x6'));var sox=require(_0xd77e('0x7'));var csv=require(_0xd77e('0x8'));var ejs=require(_0xd77e('0x9'));var fs=require('fs');var fs_extra=require(_0xd77e('0xa'));var _=require('lodash');var squel=require(_0xd77e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd77e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd77e('0x8'));var querystring=require(_0xd77e('0xd'));var Papa=require(_0xd77e('0xe'));var Redis=require(_0xd77e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd77e('0x10'));var as=require(_0xd77e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd77e('0x12'))(_0xd77e('0x13'));var utils=require('../../config/utils');var config=require(_0xd77e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd77e('0x15'))['db'];function respondWithStatusCode(_0x4ed0db,_0x3dc914){_0x3dc914=_0x3dc914||0xcc;return function(_0x3e3aac){if(_0x3e3aac){return _0x4ed0db[_0xd77e('0x16')](_0x3dc914);}return _0x4ed0db['status'](_0x3dc914)[_0xd77e('0x17')]();};}function respondWithResult(_0x399a6a,_0x53a2ae){_0x53a2ae=_0x53a2ae||0xc8;return function(_0x91738a){if(_0x91738a){return _0x399a6a[_0xd77e('0x18')](_0x53a2ae)[_0xd77e('0x19')](_0x91738a);}};}function respondWithFilteredResult(_0x181a3e,_0x5ac206){return function(_0x1fbfb2){if(_0x1fbfb2){var _0x53453a=typeof _0x5ac206[_0xd77e('0x1a')]===_0xd77e('0x1b')&&typeof _0x5ac206[_0xd77e('0x1c')]===_0xd77e('0x1b');var _0x1313ec=_0x1fbfb2[_0xd77e('0x1d')];var _0x4818be=_0x53453a?0x0:_0x5ac206['offset'];var _0x4eb60e=_0x53453a?_0x1fbfb2['count']:_0x5ac206[_0xd77e('0x1a')]+_0x5ac206[_0xd77e('0x1c')];var _0x46768d;if(_0x4eb60e>=_0x1313ec){_0x4eb60e=_0x1313ec;_0x46768d=0xc8;}else{_0x46768d=0xce;}_0x181a3e[_0xd77e('0x18')](_0x46768d);return _0x181a3e[_0xd77e('0x1e')]('Content-Range',_0x4818be+'-'+_0x4eb60e+'/'+_0x1313ec)[_0xd77e('0x19')](_0x1fbfb2);}return null;};}function patchUpdates(_0x5b3bb8){return function(_0x38f977){try{jsonpatch[_0xd77e('0x1f')](_0x38f977,_0x5b3bb8,!![]);}catch(_0x3036b7){return BPromise[_0xd77e('0x20')](_0x3036b7);}return _0x38f977[_0xd77e('0x21')]();};}function saveUpdates(_0x1db5f1,_0x581131){return function(_0x14f187){if(_0x14f187){return _0x14f187['update'](_0x1db5f1)['then'](function(_0x488863){return _0x488863;});}return null;};}function removeEntity(_0x10e406,_0x9f33ca){return function(_0x2b2dd6){if(_0x2b2dd6){return _0x2b2dd6[_0xd77e('0x22')]()[_0xd77e('0x23')](function(){var _0x1c2b7c=_0x2b2dd6[_0xd77e('0x24')]({'plain':!![]});var _0x4e1457=_0xd77e('0x25');return db[_0xd77e('0x26')][_0xd77e('0x22')]({'where':{'type':_0x4e1457,'resourceId':_0x1c2b7c['id']}})[_0xd77e('0x23')](function(){return _0x2b2dd6;});})[_0xd77e('0x23')](function(){_0x10e406[_0xd77e('0x18')](0xcc)[_0xd77e('0x17')]();});}};}function handleEntityNotFound(_0x2301a9,_0x333646){return function(_0x414e23){if(!_0x414e23){_0x2301a9[_0xd77e('0x16')](0x194);}return _0x414e23;};}function handleError(_0x5929c4,_0x566cef){_0x566cef=_0x566cef||0x1f4;return function(_0x168988){logger[_0xd77e('0x27')](_0x168988[_0xd77e('0x28')]);if(_0x168988[_0xd77e('0x29')]){delete _0x168988[_0xd77e('0x29')];}_0x5929c4[_0xd77e('0x18')](_0x566cef)[_0xd77e('0x2a')](_0x168988);};}exports[_0xd77e('0x2b')]=function(_0x141a49,_0x3e74b5){var _0x26a861={},_0x5e6004={},_0x533c7a={'count':0x0,'rows':[]};var _0x1ff32e=_[_0xd77e('0x2c')](db['Disposition']['rawAttributes'],function(_0x321e54){return{'name':_0x321e54[_0xd77e('0x2d')],'type':_0x321e54[_0xd77e('0x2e')][_0xd77e('0x2f')]};});_0x5e6004[_0xd77e('0x30')]=_['map'](_0x1ff32e,_0xd77e('0x29'));_0x5e6004[_0xd77e('0x31')]=_[_0xd77e('0x32')](_0x141a49[_0xd77e('0x31')]);_0x5e6004[_0xd77e('0x33')]=_[_0xd77e('0x34')](_0x5e6004['model'],_0x5e6004[_0xd77e('0x31')]);_0x26a861[_0xd77e('0x35')]=_['intersection'](_0x5e6004[_0xd77e('0x30')],qs[_0xd77e('0x36')](_0x141a49['query']['fields']));_0x26a861['attributes']=_0x26a861[_0xd77e('0x35')]['length']?_0x26a861[_0xd77e('0x35')]:_0x5e6004[_0xd77e('0x30')];if(!_0x141a49[_0xd77e('0x31')][_0xd77e('0x37')](_0xd77e('0x38'))){_0x26a861[_0xd77e('0x1c')]=qs['limit'](_0x141a49['query'][_0xd77e('0x1c')]);_0x26a861[_0xd77e('0x1a')]=qs[_0xd77e('0x1a')](_0x141a49[_0xd77e('0x31')][_0xd77e('0x1a')]);}_0x26a861[_0xd77e('0x39')]=qs['sort'](_0x141a49[_0xd77e('0x31')]['sort']);_0x26a861[_0xd77e('0x3a')]=qs['filters'](_[_0xd77e('0x3b')](_0x141a49[_0xd77e('0x31')],_0x5e6004[_0xd77e('0x33')]),_0x1ff32e);if(_0x141a49[_0xd77e('0x31')][_0xd77e('0x3c')]){_0x26a861[_0xd77e('0x3a')]=_[_0xd77e('0x3d')](_0x26a861[_0xd77e('0x3a')],{'$or':_[_0xd77e('0x2c')](_0x1ff32e,function(_0x3e0076){if(_0x3e0076[_0xd77e('0x2e')]!==_0xd77e('0x3e')){var _0x549eff={};_0x549eff[_0x3e0076['name']]={'$like':'%'+_0x141a49[_0xd77e('0x31')][_0xd77e('0x3c')]+'%'};return _0x549eff;}})});}_0x26a861=_['merge']({},_0x26a861,_0x141a49[_0xd77e('0x3f')]);var _0x124ef7={'where':_0x26a861[_0xd77e('0x3a')]};return db[_0xd77e('0x40')][_0xd77e('0x1d')](_0x124ef7)[_0xd77e('0x23')](function(_0x1b2c9c){_0x533c7a[_0xd77e('0x1d')]=_0x1b2c9c;if(_0x141a49['query']['includeAll']){_0x26a861[_0xd77e('0x41')]=[{'all':!![]}];}return db[_0xd77e('0x40')][_0xd77e('0x42')](_0x26a861);})['then'](function(_0x1a5ade){_0x533c7a[_0xd77e('0x43')]=_0x1a5ade;return _0x533c7a;})['then'](respondWithFilteredResult(_0x3e74b5,_0x26a861))[_0xd77e('0x44')](handleError(_0x3e74b5,null));};exports[_0xd77e('0x45')]=function(_0x9d2ad9,_0x3031dd){var _0x3c27e2={'raw':!![],'where':{'id':_0x9d2ad9['params']['id']}},_0xaee7f3={};_0xaee7f3['model']=_[_0xd77e('0x32')](db['Disposition'][_0xd77e('0x46')]);_0xaee7f3[_0xd77e('0x31')]=_[_0xd77e('0x32')](_0x9d2ad9['query']);_0xaee7f3['filters']=_['intersection'](_0xaee7f3[_0xd77e('0x30')],_0xaee7f3[_0xd77e('0x31')]);_0x3c27e2[_0xd77e('0x35')]=_[_0xd77e('0x34')](_0xaee7f3[_0xd77e('0x30')],qs[_0xd77e('0x36')](_0x9d2ad9[_0xd77e('0x31')][_0xd77e('0x36')]));_0x3c27e2[_0xd77e('0x35')]=_0x3c27e2[_0xd77e('0x35')][_0xd77e('0x47')]?_0x3c27e2[_0xd77e('0x35')]:_0xaee7f3[_0xd77e('0x30')];if(_0x9d2ad9[_0xd77e('0x31')][_0xd77e('0x48')]){_0x3c27e2[_0xd77e('0x41')]=[{'all':!![]}];}_0x3c27e2=_[_0xd77e('0x3d')]({},_0x3c27e2,_0x9d2ad9[_0xd77e('0x3f')]);return db[_0xd77e('0x40')][_0xd77e('0x49')](_0x3c27e2)[_0xd77e('0x23')](handleEntityNotFound(_0x3031dd,null))['then'](respondWithResult(_0x3031dd,null))[_0xd77e('0x44')](handleError(_0x3031dd,null));};exports[_0xd77e('0x4a')]=function(_0x3e3d4c,_0x18b9dc){return db['Disposition']['create'](_0x3e3d4c['body'],{})[_0xd77e('0x23')](function(_0x31815e){var _0x3d666c=_0x3e3d4c[_0xd77e('0x4b')][_0xd77e('0x24')]({'plain':!![]});if(!_0x3d666c)throw new Error(_0xd77e('0x4c'));if(_0x3d666c[_0xd77e('0x4d')]===_0xd77e('0x4b')){var _0x37900d=_0x31815e[_0xd77e('0x24')]({'plain':!![]});var _0x173101=_0xd77e('0x25');return db[_0xd77e('0x4e')][_0xd77e('0x49')]({'where':{'name':_0x173101,'userProfileId':_0x3d666c['userProfileId']},'raw':!![]})[_0xd77e('0x23')](function(_0x3941bf){if(_0x3941bf&&_0x3941bf[_0xd77e('0x4f')]===0x0){return db[_0xd77e('0x26')][_0xd77e('0x4a')]({'name':_0x37900d[_0xd77e('0x29')],'resourceId':_0x37900d['id'],'type':_0x3941bf[_0xd77e('0x29')],'sectionId':_0x3941bf['id']},{})[_0xd77e('0x23')](function(){return _0x31815e;});}else{return _0x31815e;}})['catch'](function(_0x4473dd){logger[_0xd77e('0x27')](_0xd77e('0x50'),_0x4473dd);throw _0x4473dd;});}return _0x31815e;})['then'](respondWithResult(_0x18b9dc,0xc9))[_0xd77e('0x44')](handleError(_0x18b9dc,null));};exports[_0xd77e('0x51')]=function(_0x3aff22,_0x5a4664){if(_0x3aff22[_0xd77e('0x52')]['id']){delete _0x3aff22[_0xd77e('0x52')]['id'];}return db[_0xd77e('0x40')][_0xd77e('0x49')]({'where':{'id':_0x3aff22['params']['id']}})[_0xd77e('0x23')](handleEntityNotFound(_0x5a4664,null))[_0xd77e('0x23')](saveUpdates(_0x3aff22[_0xd77e('0x52')],null))['then'](respondWithResult(_0x5a4664,null))[_0xd77e('0x44')](handleError(_0x5a4664,null));};exports[_0xd77e('0x22')]=function(_0x47c6ed,_0x4c2e44){return db[_0xd77e('0x40')][_0xd77e('0x49')]({'where':{'id':_0x47c6ed['params']['id']}})['then'](handleEntityNotFound(_0x4c2e44,null))['then'](removeEntity(_0x4c2e44,null))[_0xd77e('0x44')](handleError(_0x4c2e44,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index efca073..41ff268 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 _0xe7b9=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId'];(function(_0x46c25c,_0x43f24b){var _0x477fca=function(_0x1df2b7){while(--_0x1df2b7){_0x46c25c['push'](_0x46c25c['shift']());}};_0x477fca(++_0x43f24b);}(_0xe7b9,0x142));var _0x9e7b=function(_0x49772e,_0x762d28){_0x49772e=_0x49772e-0x0;var _0xe77a20=_0xe7b9[_0x49772e];return _0xe77a20;};'use strict';var _=require(_0x9e7b('0x0'));var util=require(_0x9e7b('0x1'));var logger=require(_0x9e7b('0x2'))(_0x9e7b('0x3'));var moment=require(_0x9e7b('0x4'));var BPromise=require(_0x9e7b('0x5'));var rp=require(_0x9e7b('0x6'));var fs=require('fs');var path=require(_0x9e7b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e7b('0x8'));module[_0x9e7b('0x9')]=function(_0x38dce0,_0x129d43){return _0x38dce0[_0x9e7b('0xa')]('Disposition',attributes,{'tableName':_0x9e7b('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9e7b('0xc'),'fields':[_0x9e7b('0xd'),'ListId']},{'unique':!![],'name':_0x9e7b('0xe'),'fields':[_0x9e7b('0xd'),_0x9e7b('0xf')]},{'unique':!![],'name':_0x9e7b('0x10'),'fields':[_0x9e7b('0xd'),_0x9e7b('0x11')]},{'unique':!![],'name':_0x9e7b('0x12'),'fields':[_0x9e7b('0xd'),_0x9e7b('0x13')]},{'unique':!![],'name':_0x9e7b('0x14'),'fields':[_0x9e7b('0xd'),_0x9e7b('0x15')]},{'unique':!![],'name':_0x9e7b('0x16'),'fields':['name',_0x9e7b('0x17')]},{'unique':!![],'name':_0x9e7b('0x18'),'fields':[_0x9e7b('0xd'),_0x9e7b('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a5c=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a5c,0x82));var _0xc8a5=function(_0x360ff0,_0x5f09de){_0x360ff0=_0x360ff0-0x0;var _0x4eb70d=_0x8a5c[_0x360ff0];return _0x4eb70d;};'use strict';var _=require('lodash');var util=require(_0xc8a5('0x0'));var logger=require(_0xc8a5('0x1'))(_0xc8a5('0x2'));var moment=require('moment');var BPromise=require(_0xc8a5('0x3'));var rp=require(_0xc8a5('0x4'));var fs=require('fs');var path=require(_0xc8a5('0x5'));var rimraf=require(_0xc8a5('0x6'));var config=require(_0xc8a5('0x7'));var attributes=require(_0xc8a5('0x8'));module[_0xc8a5('0x9')]=function(_0x2f8ded,_0x4d5935){return _0x2f8ded[_0xc8a5('0xa')](_0xc8a5('0xb'),attributes,{'tableName':_0xc8a5('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc8a5('0xd'),'fields':[_0xc8a5('0xe'),_0xc8a5('0xf')]},{'unique':!![],'name':_0xc8a5('0x10'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x11')]},{'unique':!![],'name':_0xc8a5('0x12'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x13')]},{'unique':!![],'name':_0xc8a5('0x14'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xc8a5('0x15'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x16')]},{'unique':!![],'name':_0xc8a5('0x17'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x18')]},{'unique':!![],'name':_0xc8a5('0x19'),'fields':['name',_0xc8a5('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1b47c76..e776644 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(_0x1db139,_0x16564a){var _0x2ea8f9=function(_0x2812e9){while(--_0x2812e9){_0x1db139['push'](_0x1db139['shift']());}};_0x2ea8f9(++_0x16564a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x54e9f8,_0x25fde0){var _0x4a63a5=function(_0x15e64d){while(--_0x15e64d){_0x54e9f8['push'](_0x54e9f8['shift']());}};_0x4a63a5(++_0x25fde0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 d96660d..f81c08d 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 _0x783e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x20ce20,_0x1647e9){var _0x46edcb=function(_0x79ba60){while(--_0x79ba60){_0x20ce20['push'](_0x20ce20['shift']());}};_0x46edcb(++_0x1647e9);}(_0x783e,0x1de));var _0xe783=function(_0x58ee3b,_0x58f76f){_0x58ee3b=_0x58ee3b-0x0;var _0x234226=_0x783e[_0x58ee3b];return _0x234226;};'use strict';var multer=require(_0xe783('0x0'));var util=require(_0xe783('0x1'));var path=require(_0xe783('0x2'));var timeout=require(_0xe783('0x3'));var express=require('express');var router=express[_0xe783('0x4')]();var fs_extra=require(_0xe783('0x5'));var auth=require(_0xe783('0x6'));var interaction=require(_0xe783('0x7'));var config=require(_0xe783('0x8'));var controller=require(_0xe783('0x9'));router[_0xe783('0xa')]('/',auth[_0xe783('0xb')](),controller['index']);router['get'](_0xe783('0xc'),auth[_0xe783('0xb')](),controller[_0xe783('0xd')]);router[_0xe783('0xe')]('/',auth['isAuthenticated'](),controller[_0xe783('0xf')]);router[_0xe783('0x10')](_0xe783('0xc'),auth[_0xe783('0xb')](),controller[_0xe783('0x11')]);router[_0xe783('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe783('0x13')]);module[_0xe783('0x14')]=router; \ No newline at end of file +var _0x84c5=['express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','util','path'];(function(_0x984ae5,_0xd2220c){var _0x32d055=function(_0x4e62f7){while(--_0x4e62f7){_0x984ae5['push'](_0x984ae5['shift']());}};_0x32d055(++_0xd2220c);}(_0x84c5,0x1cc));var _0x584c=function(_0x857b30,_0x2092e8){_0x857b30=_0x857b30-0x0;var _0x3f8924=_0x84c5[_0x857b30];return _0x3f8924;};'use strict';var multer=require('multer');var util=require(_0x584c('0x0'));var path=require(_0x584c('0x1'));var timeout=require('connect-timeout');var express=require(_0x584c('0x2'));var router=express['Router']();var fs_extra=require(_0x584c('0x3'));var auth=require(_0x584c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x584c('0x5')]('/',auth['isAuthenticated'](),controller[_0x584c('0x6')]);router['get'](_0x584c('0x7'),auth[_0x584c('0x8')](),controller['show']);router['post']('/',auth[_0x584c('0x8')](),controller[_0x584c('0x9')]);router[_0x584c('0xa')](_0x584c('0x7'),auth['isAuthenticated'](),controller[_0x584c('0xb')]);router[_0x584c('0xc')]('/:id',auth[_0x584c('0x8')](),controller[_0x584c('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cc000ec..e8284f4 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 _0x013e=['ENUM','yes','xCALLY\x20Motion\x20Fax','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x013e,0x1b7));var _0xe013=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x013e[_0x1b8f5a];return _0x594189;};'use strict';var Sequelize=require('sequelize');module[_0xe013('0x0')]={'name':{'type':Sequelize[_0xe013('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe013('0x1')]},'ecm':{'type':Sequelize[_0xe013('0x2')](_0xe013('0x3'),'no'),'defaultValue':_0xe013('0x3')},'headerinfo':{'type':Sequelize[_0xe013('0x1')],'defaultValue':_0xe013('0x4')},'localstationid':{'type':Sequelize[_0xe013('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xe013('0x2')]('2400',_0xe013('0x5'),_0xe013('0x6'),_0xe013('0x7'),_0xe013('0x8'),_0xe013('0x9')),'defaultValue':_0xe013('0x5')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xe013('0x5'),'7200',_0xe013('0x7'),_0xe013('0x8'),_0xe013('0x9')),'defaultValue':_0xe013('0x9')},'modem':{'type':Sequelize[_0xe013('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xe013('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe013('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe013('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe013('0x2')](_0xe013('0xb'),_0xe013('0xc'),_0xe013('0xd'),_0xe013('0xe')),'defaultValue':_0xe013('0xb')},'key':{'type':Sequelize[_0xe013('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe013('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe013('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe013('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe013('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe013('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe013('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0xe013('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xe013('0xf')],'defaultValue':![],'comment':_0xe013('0x11'),'set':function(_0x1469c5){if(!_0x1469c5)this['setDataValue'](_0xe013('0x12'),null);this[_0xe013('0x13')](_0xe013('0x14'),_0x1469c5);}}}; \ No newline at end of file +var _0x9c72=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x1bd5f7,_0x3a3e1d){var _0x309d5b=function(_0x3a14a5){while(--_0x3a14a5){_0x1bd5f7['push'](_0x1bd5f7['shift']());}};_0x309d5b(++_0x3a3e1d);}(_0x9c72,0x193));var _0x29c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c72[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x29c7('0x0'));module[_0x29c7('0x1')]={'name':{'type':Sequelize[_0x29c7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x29c7('0x3')](_0x29c7('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x29c7('0x2')],'defaultValue':_0x29c7('0x5')},'localstationid':{'type':Sequelize[_0x29c7('0x2')],'unique':_0x29c7('0x6')},'minrate':{'type':Sequelize[_0x29c7('0x3')](_0x29c7('0x7'),_0x29c7('0x8'),_0x29c7('0x9'),_0x29c7('0xa'),_0x29c7('0xb'),_0x29c7('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x29c7('0x3')]('2400',_0x29c7('0x8'),'7200',_0x29c7('0xa'),_0x29c7('0xb'),_0x29c7('0xc')),'defaultValue':_0x29c7('0xc')},'modem':{'type':Sequelize[_0x29c7('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x29c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x29c7('0xe'),_0x29c7('0xf'),_0x29c7('0x10'),'KHOMP'),'defaultValue':_0x29c7('0xe')},'key':{'type':Sequelize[_0x29c7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x29c7('0x11')],'defaultValue':function(){return _0x29c7('0x12');}},'notificationSound':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![],'comment':_0x29c7('0x14'),'set':function(_0x2ce1aa){if(!_0x2ce1aa)this[_0x29c7('0x15')](_0x29c7('0x16'),null);this[_0x29c7('0x15')](_0x29c7('0x17'),_0x2ce1aa);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7f7e370..9c7e2be 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 _0xf118=['Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','maxrate','t38timeout','FAXOPT(','Wait','ReceiveFax','updateAccountApplications','VoiceExtension','omit','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','FaxAccount','includeAll','include','findAll','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','fields','nolimit','FaxAccountId','Disposition','rows','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','CmContact','Contact','User','fullname','internal','Tag','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','app','system','priority','appdata','push'];(function(_0x45e28f,_0x4947fa){var _0x40a7c4=function(_0x116d53){while(--_0x116d53){_0x45e28f['push'](_0x45e28f['shift']());}};_0x40a7c4(++_0x4947fa);}(_0xf118,0x1a9));var _0x8f11=function(_0x47dcb1,_0x2e7067){_0x47dcb1=_0x47dcb1-0x0;var _0x532b9f=_0xf118[_0x47dcb1];return _0x532b9f;};'use strict';var emlformat=require(_0x8f11('0x0'));var rimraf=require(_0x8f11('0x1'));var zipdir=require(_0x8f11('0x2'));var jsonpatch=require(_0x8f11('0x3'));var rp=require(_0x8f11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f11('0x5'));var util=require('util');var path=require(_0x8f11('0x6'));var sox=require(_0x8f11('0x7'));var csv=require(_0x8f11('0x8'));var ejs=require(_0x8f11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f11('0xa'));var squel=require(_0x8f11('0xb'));var crypto=require(_0x8f11('0xc'));var jsforce=require(_0x8f11('0xd'));var deskjs=require(_0x8f11('0xe'));var toCsv=require(_0x8f11('0x8'));var querystring=require(_0x8f11('0xf'));var Papa=require(_0x8f11('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8f11('0x11'));var as=require(_0x8f11('0x12'));var hardwareService=require(_0x8f11('0x13'));var logger=require(_0x8f11('0x14'))(_0x8f11('0x15'));var utils=require(_0x8f11('0x16'));var config=require(_0x8f11('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8f11('0x18')]=_[_0x8f11('0x19')](config['redis'],{'host':_0x8f11('0x1a'),'port':0x18eb});var socket=require(_0x8f11('0x1b'))(new Redis(config[_0x8f11('0x18')]));require(_0x8f11('0x1c'))['register'](socket);var jayson=require(_0x8f11('0x1d'));var client=jayson['client'][_0x8f11('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x8f11('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x221b46,_0x39b594,_0x133032,_0x15b704){return new BPromise(function(_0xcc7674,_0x28347e){var _0x179d25=_0x15b704||client;return _0x179d25[_0x8f11('0x1f')](_0x221b46,_0x133032)[_0x8f11('0x20')](function(_0x2a3d03){logger[_0x8f11('0x21')]('FaxAccount,\x20%s,\x20%s',_0x39b594,_0x8f11('0x22'));logger[_0x8f11('0x23')](_0x8f11('0x24'),_0x39b594,_0x8f11('0x22'),JSON['stringify'](_0x2a3d03));if(_0x2a3d03[_0x8f11('0x25')]){if(_0x2a3d03[_0x8f11('0x25')][_0x8f11('0x26')]===0x1f4){logger[_0x8f11('0x25')](_0x8f11('0x27'),_0x39b594,_0x2a3d03[_0x8f11('0x25')][_0x8f11('0x28')]);return _0x28347e(_0x2a3d03['error'][_0x8f11('0x28')]);}logger[_0x8f11('0x25')]('FaxAccount,\x20%s,\x20%s',_0x39b594,_0x2a3d03['error'][_0x8f11('0x28')]);return _0xcc7674(_0x2a3d03[_0x8f11('0x25')]['message']);}else{logger['info'](_0x8f11('0x27'),_0x39b594,_0x8f11('0x22'));_0xcc7674(_0x2a3d03[_0x8f11('0x29')]['message']);}})[_0x8f11('0x2a')](function(_0x41e7f0){logger[_0x8f11('0x25')](_0x8f11('0x27'),_0x39b594,_0x41e7f0);_0x28347e(_0x41e7f0);});});}function respondWithStatusCode(_0x1cfdc2,_0x264c7d){_0x264c7d=_0x264c7d||0xcc;return function(_0x394f64){if(_0x394f64){return _0x1cfdc2[_0x8f11('0x2b')](_0x264c7d);}return _0x1cfdc2[_0x8f11('0x2c')](_0x264c7d)[_0x8f11('0x2d')]();};}function respondWithResult(_0x34b9ab,_0x1df8f1){_0x1df8f1=_0x1df8f1||0xc8;return function(_0x5f5cc6){if(_0x5f5cc6){return _0x34b9ab['status'](_0x1df8f1)[_0x8f11('0x2e')](_0x5f5cc6);}};}function respondWithFilteredResult(_0x1b7b5c,_0x1eeaa3){return function(_0x285cfd){if(_0x285cfd){var _0x4f68bb=typeof _0x1eeaa3[_0x8f11('0x2f')]===_0x8f11('0x30')&&typeof _0x1eeaa3[_0x8f11('0x31')]===_0x8f11('0x30');var _0x1b88b7=_0x285cfd['count'];var _0x2f1138=_0x4f68bb?0x0:_0x1eeaa3[_0x8f11('0x2f')];var _0x55b402=_0x4f68bb?_0x285cfd[_0x8f11('0x32')]:_0x1eeaa3[_0x8f11('0x2f')]+_0x1eeaa3[_0x8f11('0x31')];var _0x4662f8;if(_0x55b402>=_0x1b88b7){_0x55b402=_0x1b88b7;_0x4662f8=0xc8;}else{_0x4662f8=0xce;}_0x1b7b5c[_0x8f11('0x2c')](_0x4662f8);return _0x1b7b5c['set'](_0x8f11('0x33'),_0x2f1138+'-'+_0x55b402+'/'+_0x1b88b7)[_0x8f11('0x2e')](_0x285cfd);}return null;};}function patchUpdates(_0x197862){return function(_0x3a1287){try{jsonpatch['apply'](_0x3a1287,_0x197862,!![]);}catch(_0x40be7f){return BPromise[_0x8f11('0x34')](_0x40be7f);}return _0x3a1287['save']();};}function saveUpdates(_0x43fcd8,_0x23ebaf){return function(_0x80a1e8){if(_0x80a1e8){return _0x80a1e8[_0x8f11('0x35')](_0x43fcd8)[_0x8f11('0x20')](function(_0x5dd7e5){return _0x5dd7e5;});}return null;};}function removeEntity(_0x1112fc,_0x17d70e){return function(_0x2cdf3f){if(_0x2cdf3f){return _0x2cdf3f[_0x8f11('0x36')]()['then'](function(){var _0x5c43a8=_0x2cdf3f[_0x8f11('0x37')]({'plain':!![]});var _0x593fbd=_0x8f11('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x593fbd,'resourceId':_0x5c43a8['id']}})[_0x8f11('0x20')](function(){return _0x2cdf3f;});})[_0x8f11('0x20')](function(){_0x1112fc['status'](0xcc)[_0x8f11('0x2d')]();});}};}function handleEntityNotFound(_0xe9bcbd,_0x4db7c5){return function(_0x1b0fc1){if(!_0x1b0fc1){_0xe9bcbd['sendStatus'](0x194);}return _0x1b0fc1;};}function handleError(_0x59163f,_0x18c86a){_0x18c86a=_0x18c86a||0x1f4;return function(_0x20f39a){logger[_0x8f11('0x25')](_0x20f39a[_0x8f11('0x39')]);if(_0x20f39a['name']){delete _0x20f39a[_0x8f11('0x3a')];}_0x59163f[_0x8f11('0x2c')](_0x18c86a)[_0x8f11('0x3b')](_0x20f39a);};}exports[_0x8f11('0x3c')]=function(_0x2a2161,_0x9c1144){var _0x269260={'include':[{'model':db[_0x8f11('0x3d')],'as':_0x8f11('0x3e')}]},_0x383e8d={},_0x3ee95b={'count':0x0,'rows':[]};var _0x949175=_[_0x8f11('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x16be4f){return{'name':_0x16be4f['fieldName'],'type':_0x16be4f[_0x8f11('0x40')][_0x8f11('0x41')]};});_0x383e8d[_0x8f11('0x42')]=_['map'](_0x949175,_0x8f11('0x3a'));_0x383e8d[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x2a2161['query']);_0x383e8d[_0x8f11('0x45')]=_[_0x8f11('0x46')](_0x383e8d[_0x8f11('0x42')],_0x383e8d[_0x8f11('0x43')]);_0x269260[_0x8f11('0x47')]=_[_0x8f11('0x46')](_0x383e8d['model'],qs['fields'](_0x2a2161[_0x8f11('0x43')]['fields']));_0x269260[_0x8f11('0x47')]=_0x269260['attributes']['length']?_0x269260[_0x8f11('0x47')]:_0x383e8d[_0x8f11('0x42')];if(!_0x2a2161[_0x8f11('0x43')][_0x8f11('0x48')]('nolimit')){_0x269260[_0x8f11('0x31')]=qs[_0x8f11('0x31')](_0x2a2161[_0x8f11('0x43')][_0x8f11('0x31')]);_0x269260['offset']=qs[_0x8f11('0x2f')](_0x2a2161[_0x8f11('0x43')][_0x8f11('0x2f')]);}_0x269260[_0x8f11('0x49')]=qs[_0x8f11('0x4a')](_0x2a2161[_0x8f11('0x43')][_0x8f11('0x4a')]);_0x269260[_0x8f11('0x4b')]=qs[_0x8f11('0x45')](_[_0x8f11('0x4c')](_0x2a2161[_0x8f11('0x43')],_0x383e8d[_0x8f11('0x45')]),_0x949175);if(_0x2a2161[_0x8f11('0x43')]['filter']){_0x269260[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0x269260[_0x8f11('0x4b')],{'$or':_[_0x8f11('0x3f')](_0x949175,function(_0x5d8aa6){if(_0x5d8aa6[_0x8f11('0x40')]!==_0x8f11('0x4e')){var _0x197880={};_0x197880[_0x5d8aa6[_0x8f11('0x3a')]]={'$like':'%'+_0x2a2161[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x197880;}})});}_0x269260=_[_0x8f11('0x4d')]({},_0x269260,_0x2a2161[_0x8f11('0x50')]);var _0x411275={'where':_0x269260[_0x8f11('0x4b')]};return db[_0x8f11('0x51')][_0x8f11('0x32')](_0x411275)['then'](function(_0x183ca6){_0x3ee95b[_0x8f11('0x32')]=_0x183ca6;if(_0x2a2161['query'][_0x8f11('0x52')]){_0x269260[_0x8f11('0x53')]=[{'all':!![]}];}return db[_0x8f11('0x51')][_0x8f11('0x54')](_0x269260);})[_0x8f11('0x20')](function(_0x3d0abd){_0x3ee95b['rows']=_0x3d0abd;return _0x3ee95b;})[_0x8f11('0x20')](respondWithFilteredResult(_0x9c1144,_0x269260))[_0x8f11('0x2a')](handleError(_0x9c1144,null));};exports[_0x8f11('0x55')]=function(_0x23a4f6,_0x492c7c){var _0x760c15={'raw':![],'where':{'id':_0x23a4f6['params']['id']},'include':[{'model':db['Pause'],'as':_0x8f11('0x3e')}]},_0x56c6bd={};_0x56c6bd['model']=_[_0x8f11('0x44')](db[_0x8f11('0x51')][_0x8f11('0x56')]);_0x56c6bd[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x23a4f6[_0x8f11('0x43')]);_0x56c6bd[_0x8f11('0x45')]=_[_0x8f11('0x46')](_0x56c6bd[_0x8f11('0x42')],_0x56c6bd[_0x8f11('0x43')]);_0x760c15[_0x8f11('0x47')]=_['intersection'](_0x56c6bd[_0x8f11('0x42')],qs['fields'](_0x23a4f6[_0x8f11('0x43')]['fields']));_0x760c15[_0x8f11('0x47')]=_0x760c15[_0x8f11('0x47')][_0x8f11('0x57')]?_0x760c15[_0x8f11('0x47')]:_0x56c6bd[_0x8f11('0x42')];if(_0x23a4f6['query'][_0x8f11('0x52')]){_0x760c15['include']=[{'all':!![]}];}_0x760c15=_[_0x8f11('0x4d')]({},_0x760c15,_0x23a4f6[_0x8f11('0x50')]);return db[_0x8f11('0x51')][_0x8f11('0x58')](_0x760c15)[_0x8f11('0x20')](handleEntityNotFound(_0x492c7c,null))['then'](respondWithResult(_0x492c7c,null))['catch'](handleError(_0x492c7c,null));};exports[_0x8f11('0x59')]=function(_0x5e4618,_0x573020){return db[_0x8f11('0x51')][_0x8f11('0x59')](_0x5e4618[_0x8f11('0x5a')],{})[_0x8f11('0x20')](function(_0x1b16f2){var _0x48efbd=_0x5e4618[_0x8f11('0x5b')][_0x8f11('0x37')]({'plain':!![]});if(!_0x48efbd)throw new Error(_0x8f11('0x5c'));if(_0x48efbd[_0x8f11('0x5d')]==='user'){var _0x2526f9=_0x1b16f2[_0x8f11('0x37')]({'plain':!![]});var _0x255100='FaxAccounts';return db['UserProfileSection'][_0x8f11('0x58')]({'where':{'name':_0x255100,'userProfileId':_0x48efbd[_0x8f11('0x5e')]},'raw':!![]})[_0x8f11('0x20')](function(_0x469d3a){if(_0x469d3a&&_0x469d3a[_0x8f11('0x5f')]===0x0){return db['UserProfileResource'][_0x8f11('0x59')]({'name':_0x2526f9['name'],'resourceId':_0x2526f9['id'],'type':_0x469d3a[_0x8f11('0x3a')],'sectionId':_0x469d3a['id']},{})[_0x8f11('0x20')](function(){return _0x1b16f2;});}else{return _0x1b16f2;}})[_0x8f11('0x2a')](function(_0x3b238e){logger['error'](_0x8f11('0x60'),_0x3b238e);throw _0x3b238e;});}return _0x1b16f2;})[_0x8f11('0x20')](respondWithResult(_0x573020,0xc9))[_0x8f11('0x2a')](handleError(_0x573020,null));};exports['update']=function(_0x3fdf5b,_0x497d52){if(_0x3fdf5b[_0x8f11('0x5a')]['id']){delete _0x3fdf5b[_0x8f11('0x5a')]['id'];}return db[_0x8f11('0x51')][_0x8f11('0x58')]({'where':{'id':_0x3fdf5b[_0x8f11('0x61')]['id']},'include':[{'model':db[_0x8f11('0x3d')],'as':_0x8f11('0x3e')}]})['then'](handleEntityNotFound(_0x497d52,null))[_0x8f11('0x20')](saveUpdates(_0x3fdf5b[_0x8f11('0x5a')],null))['then'](respondWithResult(_0x497d52,null))[_0x8f11('0x2a')](handleError(_0x497d52,null));};exports[_0x8f11('0x36')]=function(_0x2c2180,_0x5041bf){return db['FaxAccount']['find']({'where':{'id':_0x2c2180[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x5041bf,null))[_0x8f11('0x20')](removeEntity(_0x5041bf,null))['catch'](handleError(_0x5041bf,null));};exports[_0x8f11('0x62')]=function(_0x2d07f3,_0x589cc9){return db['FaxAccount']['describe']()[_0x8f11('0x20')](respondWithResult(_0x589cc9,null))[_0x8f11('0x2a')](handleError(_0x589cc9,null));};exports[_0x8f11('0x63')]=function(_0x3f69f9,_0x2e083f,_0x4c8481){if(_0x3f69f9[_0x8f11('0x5a')]['id']){delete _0x3f69f9[_0x8f11('0x5a')]['id'];}return db[_0x8f11('0x51')][_0x8f11('0x58')]({'where':{'id':_0x3f69f9[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x2e083f,null))[_0x8f11('0x20')](function(_0x68c821){if(_0x68c821){_0x3f69f9[_0x8f11('0x5a')]['FaxAccountId']=_0x68c821['id'];return db['Disposition']['create'](_0x3f69f9['body']);}})['then'](respondWithResult(_0x2e083f,null))[_0x8f11('0x2a')](handleError(_0x2e083f,null));};exports[_0x8f11('0x64')]=function(_0x4fd2fb,_0x3811c8,_0xd7cf28){var _0x1e1171={'raw':![],'where':{}};var _0x17f41b={};var _0x51fa18={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4fd2fb[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x3811c8,null))[_0x8f11('0x20')](function(_0x732b3b){if(_0x732b3b){_0x17f41b['model']=_[_0x8f11('0x44')](db['Disposition'][_0x8f11('0x56')]);_0x17f41b[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x4fd2fb[_0x8f11('0x43')]);_0x17f41b[_0x8f11('0x45')]=_['intersection'](_0x17f41b[_0x8f11('0x42')],_0x17f41b[_0x8f11('0x43')]);_0x1e1171[_0x8f11('0x47')]=_[_0x8f11('0x46')](_0x17f41b[_0x8f11('0x42')],qs[_0x8f11('0x65')](_0x4fd2fb[_0x8f11('0x43')][_0x8f11('0x65')]));_0x1e1171[_0x8f11('0x47')]=_0x1e1171['attributes']['length']?_0x1e1171['attributes']:_0x17f41b[_0x8f11('0x42')];if(!_0x4fd2fb[_0x8f11('0x43')][_0x8f11('0x48')](_0x8f11('0x66'))){_0x1e1171[_0x8f11('0x31')]=qs[_0x8f11('0x31')](_0x4fd2fb[_0x8f11('0x43')][_0x8f11('0x31')]);_0x1e1171[_0x8f11('0x2f')]=qs['offset'](_0x4fd2fb['query'][_0x8f11('0x2f')]);}_0x1e1171[_0x8f11('0x49')]=qs[_0x8f11('0x4a')](_0x4fd2fb[_0x8f11('0x43')][_0x8f11('0x4a')]);_0x1e1171[_0x8f11('0x4b')]=qs[_0x8f11('0x45')](_[_0x8f11('0x4c')](_0x4fd2fb[_0x8f11('0x43')],_0x17f41b[_0x8f11('0x45')]));_0x1e1171['where'][_0x8f11('0x67')]=_0x732b3b['id'];if(_0x4fd2fb[_0x8f11('0x43')]['filter']){_0x1e1171[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0x1e1171[_0x8f11('0x4b')],{'$or':_['map'](_0x1e1171[_0x8f11('0x47')],function(_0x474201){var _0x49d50c={};_0x49d50c[_0x474201]={'$like':'%'+_0x4fd2fb[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x49d50c;})});}_0x1e1171=_[_0x8f11('0x4d')]({},_0x1e1171,_0x4fd2fb[_0x8f11('0x50')]);return db[_0x8f11('0x68')][_0x8f11('0x32')]({'where':_0x1e1171['where']})[_0x8f11('0x20')](function(_0x32068a){_0x51fa18['count']=_0x32068a;if(_0x4fd2fb['query']['includeAll']){_0x1e1171[_0x8f11('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x8f11('0x54')](_0x1e1171);})[_0x8f11('0x20')](function(_0x58d45c){_0x51fa18[_0x8f11('0x69')]=_0x58d45c;return _0x51fa18;});}})[_0x8f11('0x20')](respondWithFilteredResult(_0x3811c8,_0x1e1171))[_0x8f11('0x2a')](handleError(_0x3811c8,null));};exports[_0x8f11('0x6a')]=function(_0x5215e0,_0x5b6ec9,_0x33bc1f){return db['FaxAccount'][_0x8f11('0x58')]({'where':{'id':_0x5215e0[_0x8f11('0x61')]['id']}})['then'](handleEntityNotFound(_0x5b6ec9,null))[_0x8f11('0x20')](function(_0x4b545d){if(_0x4b545d){return _0x4b545d[_0x8f11('0x6a')](_0x5215e0[_0x8f11('0x43')][_0x8f11('0x6b')]);}})[_0x8f11('0x20')](respondWithStatusCode(_0x5b6ec9,null))[_0x8f11('0x2a')](handleError(_0x5b6ec9,null));};exports['addAnswer']=function(_0x19c0b8,_0x47f666,_0x5ca462){if(_0x19c0b8['body']['id']){delete _0x19c0b8[_0x8f11('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x19c0b8['params']['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x47f666,null))[_0x8f11('0x20')](function(_0xa90679){if(_0xa90679){_0x19c0b8[_0x8f11('0x5a')][_0x8f11('0x67')]=_0xa90679['id'];return db['CannedAnswer'][_0x8f11('0x59')](_0x19c0b8[_0x8f11('0x5a')]);}})[_0x8f11('0x20')](respondWithResult(_0x47f666,null))[_0x8f11('0x2a')](handleError(_0x47f666,null));};exports[_0x8f11('0x6c')]=function(_0x494837,_0x345004,_0x364bdd){var _0x504c23={'raw':![],'where':{}};var _0x40f0d0={};var _0x106dce={'count':0x0,'rows':[]};return db[_0x8f11('0x51')][_0x8f11('0x6d')]({'where':{'id':_0x494837['params']['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x345004,null))[_0x8f11('0x20')](function(_0x520378){if(_0x520378){_0x40f0d0[_0x8f11('0x42')]=_['keys'](db[_0x8f11('0x6e')][_0x8f11('0x56')]);_0x40f0d0[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x494837[_0x8f11('0x43')]);_0x40f0d0['filters']=_['intersection'](_0x40f0d0[_0x8f11('0x42')],_0x40f0d0['query']);_0x504c23[_0x8f11('0x47')]=_['intersection'](_0x40f0d0[_0x8f11('0x42')],qs[_0x8f11('0x65')](_0x494837['query'][_0x8f11('0x65')]));_0x504c23[_0x8f11('0x47')]=_0x504c23[_0x8f11('0x47')][_0x8f11('0x57')]?_0x504c23[_0x8f11('0x47')]:_0x40f0d0[_0x8f11('0x42')];if(!_0x494837[_0x8f11('0x43')][_0x8f11('0x48')]('nolimit')){_0x504c23['limit']=qs[_0x8f11('0x31')](_0x494837[_0x8f11('0x43')][_0x8f11('0x31')]);_0x504c23[_0x8f11('0x2f')]=qs[_0x8f11('0x2f')](_0x494837[_0x8f11('0x43')][_0x8f11('0x2f')]);}_0x504c23[_0x8f11('0x49')]=qs['sort'](_0x494837[_0x8f11('0x43')][_0x8f11('0x4a')]);_0x504c23[_0x8f11('0x4b')]=qs[_0x8f11('0x45')](_[_0x8f11('0x4c')](_0x494837[_0x8f11('0x43')],_0x40f0d0[_0x8f11('0x45')]));_0x504c23['where'][_0x8f11('0x67')]=_0x520378['id'];if(_0x494837['query']['filter']){_0x504c23[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0x504c23[_0x8f11('0x4b')],{'$or':_[_0x8f11('0x3f')](_0x504c23[_0x8f11('0x47')],function(_0x1456ed){var _0x2e10ba={};_0x2e10ba[_0x1456ed]={'$like':'%'+_0x494837[_0x8f11('0x43')]['filter']+'%'};return _0x2e10ba;})});}_0x504c23=_[_0x8f11('0x4d')]({},_0x504c23,_0x494837[_0x8f11('0x50')]);return db[_0x8f11('0x6e')]['count']({'where':_0x504c23[_0x8f11('0x4b')]})[_0x8f11('0x20')](function(_0x25fb9f){_0x106dce['count']=_0x25fb9f;if(_0x494837[_0x8f11('0x43')][_0x8f11('0x52')]){_0x504c23[_0x8f11('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8f11('0x54')](_0x504c23);})[_0x8f11('0x20')](function(_0x3f708a){_0x106dce[_0x8f11('0x69')]=_0x3f708a;return _0x106dce;});}})[_0x8f11('0x20')](respondWithFilteredResult(_0x345004,_0x504c23))[_0x8f11('0x2a')](handleError(_0x345004,null));};exports['removeAnswers']=function(_0x23a9d2,_0xc9eb60,_0x3e7970){return db[_0x8f11('0x51')][_0x8f11('0x58')]({'where':{'id':_0x23a9d2[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0xc9eb60,null))[_0x8f11('0x20')](function(_0x212cae){if(_0x212cae){return _0x212cae[_0x8f11('0x6f')](_0x23a9d2[_0x8f11('0x43')][_0x8f11('0x6b')]);}})[_0x8f11('0x20')](respondWithStatusCode(_0xc9eb60,null))[_0x8f11('0x2a')](handleError(_0xc9eb60,null));};exports['addInteraction']=function(_0x40b63e,_0x114477,_0x42812e){return db[_0x8f11('0x70')]['find']({'where':{'id':_0x40b63e[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x114477,null))[_0x8f11('0x20')](function(_0x1d1a4e){if(_0x1d1a4e){return _0x1d1a4e[_0x8f11('0x71')](_0x40b63e[_0x8f11('0x5a')][_0x8f11('0x6b')],_['omit'](_0x40b63e['body'],[_0x8f11('0x6b'),'id'])||{});}})[_0x8f11('0x20')](respondWithResult(_0x114477,null))[_0x8f11('0x2a')](handleError(_0x114477,null));};exports['getInteractions']=function(_0x272870,_0x57e0ff,_0x1262d0){var _0x12d12a={'raw':![],'where':{}};var _0x127540={};var _0x18ee5c={'count':0x0,'rows':[]};return db[_0x8f11('0x51')][_0x8f11('0x6d')]({'where':{'id':_0x272870[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x57e0ff,null))[_0x8f11('0x20')](function(_0x59a96c){if(_0x59a96c){_0x127540['model']=_[_0x8f11('0x44')](db[_0x8f11('0x70')][_0x8f11('0x56')]);_0x127540[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x272870['query']);_0x127540[_0x8f11('0x45')]=_[_0x8f11('0x46')](_0x127540[_0x8f11('0x42')],_0x127540['query']);_0x12d12a[_0x8f11('0x47')]=_[_0x8f11('0x46')](_0x127540['model'],qs[_0x8f11('0x65')](_0x272870[_0x8f11('0x43')][_0x8f11('0x65')]));_0x12d12a[_0x8f11('0x47')]=_0x12d12a['attributes'][_0x8f11('0x57')]?_0x12d12a['attributes']:_0x127540['model'];if(!_0x272870[_0x8f11('0x43')]['hasOwnProperty'](_0x8f11('0x66'))){_0x12d12a[_0x8f11('0x31')]=qs[_0x8f11('0x31')](_0x272870[_0x8f11('0x43')][_0x8f11('0x31')]);_0x12d12a['offset']=qs['offset'](_0x272870[_0x8f11('0x43')]['offset']);}_0x12d12a[_0x8f11('0x49')]=qs[_0x8f11('0x4a')](_0x272870[_0x8f11('0x43')][_0x8f11('0x4a')]);_0x12d12a['where']=qs[_0x8f11('0x45')](_[_0x8f11('0x4c')](_0x272870[_0x8f11('0x43')],_0x127540[_0x8f11('0x45')]));_0x12d12a['where']['FaxAccountId']=_0x59a96c['id'];if(_0x272870[_0x8f11('0x43')][_0x8f11('0x4f')]){_0x12d12a[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0x12d12a[_0x8f11('0x4b')],{'$or':_[_0x8f11('0x3f')](_0x12d12a[_0x8f11('0x47')],function(_0x419680){var _0x55e579={};_0x55e579[_0x419680]={'$like':'%'+_0x272870[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x55e579;})});}_0x12d12a=_['merge']({},_0x12d12a,_0x272870[_0x8f11('0x50')]);return db[_0x8f11('0x70')]['count']({'where':_0x12d12a[_0x8f11('0x4b')]})[_0x8f11('0x20')](function(_0x3afca0){_0x18ee5c['count']=_0x3afca0;if(_0x272870['query'][_0x8f11('0x52')]){_0x12d12a[_0x8f11('0x53')]=[{'model':db[_0x8f11('0x72')],'as':_0x8f11('0x73'),'required':![]},{'model':db[_0x8f11('0x74')],'as':'Owner','attributes':[_0x8f11('0x3a'),_0x8f11('0x75'),_0x8f11('0x76')],'required':![]},{'model':db[_0x8f11('0x77')],'as':'Tags','attributes':['id',_0x8f11('0x3a'),'color'],'where':_0x272870['query']['tag']?{'id':_0x272870[_0x8f11('0x43')][_0x8f11('0x78')]}:undefined,'required':_0x272870['query'][_0x8f11('0x78')]?!![]:![]}];}return db[_0x8f11('0x70')][_0x8f11('0x54')](_0x12d12a);})[_0x8f11('0x20')](function(_0x15252e){_0x18ee5c[_0x8f11('0x69')]=_0x15252e;return _0x18ee5c;});}})[_0x8f11('0x20')](respondWithFilteredResult(_0x57e0ff,_0x12d12a))[_0x8f11('0x2a')](handleError(_0x57e0ff,null));};exports[_0x8f11('0x79')]=function(_0x1acca1,_0x5fb18){var _0x12cf63=_0x1acca1[_0x8f11('0x61')]['id'];var _0x4f51e0=_0x1acca1[_0x8f11('0x5a')];var _0x85e734=0xc8;var _0x268ac6=null;return db[_0x8f11('0x7a')][_0x8f11('0x7b')]({'isolationLevel':db[_0x8f11('0x7a')][_0x8f11('0x7c')][_0x8f11('0x7d')][_0x8f11('0x7e')]},function(_0x4f19c0){return db[_0x8f11('0x51')][_0x8f11('0x6d')]({'where':{'id':_0x12cf63},'transaction':_0x4f19c0})[_0x8f11('0x20')](function(_0x3cb24d){if(_0x3cb24d){return db[_0x8f11('0x7f')][_0x8f11('0x36')]({'where':{'FaxAccountId':_0x12cf63},'transaction':_0x4f19c0})[_0x8f11('0x20')](function(){var _0x2669a0=_['map'](_0x4f51e0,function(_0x56c78b){_0x56c78b[_0x8f11('0x67')]=_0x12cf63;return _0x56c78b;});return db[_0x8f11('0x7f')][_0x8f11('0x80')](_0x2669a0,{'transaction':_0x4f19c0});});}else{_0x85e734=0x194;_0x268ac6=[];}});})[_0x8f11('0x20')](function(){if(_0x85e734!==0x194){return db[_0x8f11('0x7f')][_0x8f11('0x81')]({'where':{'FaxAccountId':_0x12cf63},'order':'priority'})[_0x8f11('0x20')](function(_0x2b5468){_0x268ac6=_0x2b5468;});}})['catch'](function(_0xe3f872){_0x85e734=0x1f4;logger[_0x8f11('0x25')](_0xe3f872[_0x8f11('0x39')]);if(_0xe3f872[_0x8f11('0x3a')]){delete _0xe3f872[_0x8f11('0x3a')];}_0x268ac6=_0xe3f872;})['finally'](function(){if(_0x268ac6===null){_0x5fb18['sendStatus'](_0x85e734);}else{if(_0x85e734===0x1f4){_0x5fb18[_0x8f11('0x2c')](_0x85e734)[_0x8f11('0x3b')](_0x268ac6);}else{_0x5fb18[_0x8f11('0x2c')](_0x85e734)[_0x8f11('0x2e')](_0x268ac6);}}});};exports[_0x8f11('0x82')]=function(_0x4604b4,_0x5e35c3,_0x508a54){var _0xddabaf={};var _0x3ac381={};var _0x52f188;var _0x55e977;return db['FaxAccount']['findOne']({'where':{'id':_0x4604b4['params']['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x5e35c3,null))['then'](function(_0x205976){if(_0x205976){_0x52f188=_0x205976;_0x3ac381[_0x8f11('0x42')]=_[_0x8f11('0x44')](db[_0x8f11('0x7f')]['rawAttributes']);_0x3ac381[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x4604b4['query']);_0x3ac381['filters']=_[_0x8f11('0x46')](_0x3ac381[_0x8f11('0x42')],_0x3ac381[_0x8f11('0x43')]);_0xddabaf['attributes']=_[_0x8f11('0x46')](_0x3ac381[_0x8f11('0x42')],qs[_0x8f11('0x65')](_0x4604b4[_0x8f11('0x43')]['fields']));_0xddabaf[_0x8f11('0x47')]=_0xddabaf[_0x8f11('0x47')][_0x8f11('0x57')]?_0xddabaf['attributes']:_0x3ac381[_0x8f11('0x42')];_0xddabaf['order']=qs[_0x8f11('0x4a')](_0x4604b4[_0x8f11('0x43')][_0x8f11('0x4a')]);_0xddabaf['where']=qs['filters'](_['pick'](_0x4604b4[_0x8f11('0x43')],_0x3ac381[_0x8f11('0x45')]));if(_0x4604b4['query'][_0x8f11('0x4f')]){_0xddabaf[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0xddabaf['where'],{'$or':_[_0x8f11('0x3f')](_0xddabaf['attributes'],function(_0x1b8a20){var _0x55f14d={};_0x55f14d[_0x1b8a20]={'$like':'%'+_0x4604b4[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x55f14d;})});}_0xddabaf=_[_0x8f11('0x4d')]({},_0xddabaf,_0x4604b4[_0x8f11('0x50')]);return _0x52f188[_0x8f11('0x82')](_0xddabaf);}})[_0x8f11('0x20')](function(_0x195fda){if(_0x195fda){_0x55e977=_0x195fda['length'];if(!_0x4604b4['query'][_0x8f11('0x48')](_0x8f11('0x66'))){_0xddabaf[_0x8f11('0x31')]=qs[_0x8f11('0x31')](_0x4604b4['query'][_0x8f11('0x31')]);_0xddabaf['offset']=qs['offset'](_0x4604b4[_0x8f11('0x43')][_0x8f11('0x2f')]);}return _0x52f188[_0x8f11('0x82')](_0xddabaf);}})[_0x8f11('0x20')](function(_0x57f8a3){if(_0x57f8a3){return _0x57f8a3?{'count':_0x55e977,'rows':_0x57f8a3}:null;}})['then'](respondWithResult(_0x5e35c3,null))[_0x8f11('0x2a')](handleError(_0x5e35c3,null));};function Extension(_0x585206,_0x36b13d,_0x14128e,_0x2789cb){this[_0x8f11('0x83')]=_0x8f11('0x84');this[_0x8f11('0x85')]=_0x585206['localstationid'];this[_0x8f11('0x86')]=_0x2789cb;this[_0x8f11('0x40')]=_0x8f11('0x87');this['description']='Fax\x20Extension';this[_0x8f11('0x67')]=_0x585206['id'];this[_0x8f11('0x88')]=_0x36b13d;this[_0x8f11('0x89')]=_0x14128e;}function createExtensionsReciveFax(_0x30a000){var _0xc9ad82=0x1;var _0x3a9e68=[];_0x3a9e68[_0x8f11('0x8a')](new Extension(_0x30a000,_0xc9ad82,'',_0x8f11('0x8b')));_0xc9ad82+=0x1;_0x3a9e68[_0x8f11('0x8a')](new Extension(_0x30a000,_0xc9ad82,_0x8f11('0x8c'),_0x8f11('0x8d')));_0xc9ad82+=0x1;for(var _0x43c854 in _0x30a000){if(_0x30a000[_0x8f11('0x48')](_0x43c854)&&(_0x43c854===_0x8f11('0x8e')||_0x43c854===_0x8f11('0x8f')||_0x43c854==='gateway'||_0x43c854==='faxdetect'||_0x43c854==='headerinfo'||_0x43c854===_0x8f11('0x90')||_0x43c854==='minrate'||_0x43c854==='modem'||_0x43c854===_0x8f11('0x91'))){_0x3a9e68[_0x8f11('0x8a')](new Extension(_0x30a000,_0xc9ad82,_0x8f11('0x92')+_0x43c854+')='+_0x30a000[_0x43c854],'Set'));_0xc9ad82+=0x1;}}_0x3a9e68[_0x8f11('0x8a')](new Extension(_0x30a000,_0xc9ad82,'6',_0x8f11('0x93')));_0xc9ad82+=0x1;_0x3a9e68[_0x8f11('0x8a')](new Extension(_0x30a000,_0xc9ad82,'/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',_0x8f11('0x94')));_0xc9ad82=0x0;return _0x3a9e68;}exports['addAccountApplications']=function(_0x382e00,_0x5db5ad,_0x1ba5ff){var _0xcf0fcd;return db['sequelize']['transaction'](function(_0x435654){return db[_0x8f11('0x51')][_0x8f11('0x59')](_0x382e00[_0x8f11('0x5a')],{'transaction':_0x435654})['then'](function(_0x22f943){_0xcf0fcd=_0x22f943['get']({'plain':!![]});return db['VoiceExtension'][_0x8f11('0x80')](createExtensionsReciveFax(_0xcf0fcd),{'transaction':_0x435654});});})[_0x8f11('0x20')](function(){return _0xcf0fcd;})[_0x8f11('0x20')](respondWithResult(_0x5db5ad,null))[_0x8f11('0x2a')](handleError(_0x5db5ad,null));};exports[_0x8f11('0x95')]=function(_0x1f734b,_0x270c50,_0x476692){var _0x23278e;return db['sequelize']['transaction'](function(_0x1b0496){return db[_0x8f11('0x51')]['update'](_0x1f734b[_0x8f11('0x5a')],{'where':{'id':_0x1f734b[_0x8f11('0x5a')]['id']},'transaction':_0x1b0496})[_0x8f11('0x20')](function(_0x164247){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x1f734b[_0x8f11('0x5a')]['id']},'transaction':_0x1b0496})[_0x8f11('0x20')](function(_0xf26299){return db[_0x8f11('0x96')][_0x8f11('0x80')](createExtensionsReciveFax(_[_0x8f11('0x97')](_0x1f734b[_0x8f11('0x5a')],['tech',_0x8f11('0x41'),'createdAt',_0x8f11('0x98'),_0x8f11('0x99'),_0x8f11('0x9a')])),{'transaction':_0x1b0496});});});})[_0x8f11('0x20')](function(){return db['FaxAccount'][_0x8f11('0x9b')](_0x1f734b[_0x8f11('0x5a')]['id']);})[_0x8f11('0x20')](respondWithResult(_0x270c50,null))[_0x8f11('0x2a')](handleError(_0x270c50,null));};exports[_0x8f11('0x9c')]=function(_0x30a1bd,_0x1ce564,_0x1b2606){var _0x27bcc5={'raw':!![],'where':{}};var _0x30bdd5={};var _0x252851={'count':0x0,'rows':[]};return db[_0x8f11('0x51')][_0x8f11('0x6d')]({'where':{'id':_0x30a1bd[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x1ce564,null))[_0x8f11('0x20')](function(_0x18dd6f){if(_0x18dd6f){_0x30bdd5[_0x8f11('0x42')]=_[_0x8f11('0x44')](db['FaxMessage']['rawAttributes']);_0x30bdd5[_0x8f11('0x43')]=_[_0x8f11('0x44')](_0x30a1bd['query']);_0x30bdd5[_0x8f11('0x45')]=_[_0x8f11('0x46')](_0x30bdd5[_0x8f11('0x42')],_0x30bdd5[_0x8f11('0x43')]);_0x27bcc5['attributes']=_['intersection'](_0x30bdd5[_0x8f11('0x42')],qs[_0x8f11('0x65')](_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x65')]));_0x27bcc5[_0x8f11('0x47')]=_0x27bcc5[_0x8f11('0x47')][_0x8f11('0x57')]?_0x27bcc5['attributes']:_0x30bdd5[_0x8f11('0x42')];if(!_0x30a1bd['query'][_0x8f11('0x48')](_0x8f11('0x66'))){_0x27bcc5[_0x8f11('0x31')]=qs[_0x8f11('0x31')](_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x31')]);_0x27bcc5[_0x8f11('0x2f')]=qs[_0x8f11('0x2f')](_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x2f')]);}_0x27bcc5[_0x8f11('0x49')]=qs[_0x8f11('0x4a')](_0x30a1bd[_0x8f11('0x43')]['sort']);_0x27bcc5['where']=qs[_0x8f11('0x45')](_[_0x8f11('0x4c')](_0x30a1bd[_0x8f11('0x43')],_0x30bdd5['filters']));_0x27bcc5[_0x8f11('0x4b')][_0x8f11('0x67')]=_0x18dd6f['id'];if(_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x4f')]){_0x27bcc5[_0x8f11('0x4b')]=_['merge'](_0x27bcc5[_0x8f11('0x4b')],{'$or':_[_0x8f11('0x3f')](_0x27bcc5[_0x8f11('0x47')],function(_0x288f4f){var _0x31f62a={};_0x31f62a[_0x288f4f]={'$like':'%'+_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x31f62a;})});}if(_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x9d')]){var _0x529445=_0x30a1bd[_0x8f11('0x43')]['$gte'][_0x8f11('0x9e')](',');var _0x30a208={};_0x30a208[_0x529445[0x0]]={'$gte':moment(_0x529445[0x1])[_0x8f11('0x9f')](_0x8f11('0xa0'))};_0x27bcc5[_0x8f11('0x4b')]=_[_0x8f11('0x4d')](_0x27bcc5[_0x8f11('0x4b')],_0x30a208);}_0x27bcc5=_[_0x8f11('0x4d')]({},_0x27bcc5,_0x30a1bd[_0x8f11('0x50')]);return db[_0x8f11('0xa1')]['count']({'where':_0x27bcc5[_0x8f11('0x4b')]})[_0x8f11('0x20')](function(_0x4a0f83){_0x252851[_0x8f11('0x32')]=_0x4a0f83;if(_0x30a1bd[_0x8f11('0x43')][_0x8f11('0x52')]){_0x27bcc5[_0x8f11('0x53')]=[{'all':!![]}];}return db[_0x8f11('0xa1')][_0x8f11('0x54')](_0x27bcc5);})[_0x8f11('0x20')](function(_0x23a8b0){_0x252851[_0x8f11('0x69')]=_0x23a8b0;return _0x252851;});}})[_0x8f11('0x20')](respondWithFilteredResult(_0x1ce564,_0x27bcc5))[_0x8f11('0x2a')](handleError(_0x1ce564,null));};exports[_0x8f11('0x3b')]=function(_0x1a0268,_0x2e5866,_0x1ba23a){var _0x41f20d,_0x323e63={},_0x250f72;if(_0x1a0268['body']['to']){_0x250f72=_0x1a0268[_0x8f11('0x5a')]['to'][0x0];}return db[_0x8f11('0x51')][_0x8f11('0x58')]({'where':{'id':_0x1a0268[_0x8f11('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x8f11('0xa2'),'include':[{'model':db[_0x8f11('0x72')],'as':_0x8f11('0xa3'),'where':{'fax':_0x250f72},'limit':0x1,'order':[[_0x8f11('0x98'),_0x8f11('0xa4')]]}]}]})[_0x8f11('0x20')](handleEntityNotFound(_0x2e5866,null))[_0x8f11('0x20')](function(_0x37d26e){_0x41f20d=_0x37d26e;if(_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')]&&_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')]['length']){for(var _0x4eb16d=0x0;_0x4eb16d<_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][_0x8f11('0x57')];_0x4eb16d+=0x1){_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][_0x4eb16d]={'filename':_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][_0x4eb16d][_0x8f11('0x3a')],'id':_0x1a0268['body']['attachments'][_0x4eb16d]['id'],'path':path[_0x8f11('0xa6')](config['root'],_0x8f11('0xa7'),_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][_0x4eb16d][_0x8f11('0xa8')])};}}return respondWithRpcPromise('CheckAfterSend',_0x8f11('0xa9'),{'FaxAccountId':_[_0x8f11('0xaa')](_0x1a0268[_0x8f11('0x61')]['id'])?undefined:_0x1a0268[_0x8f11('0x61')]['id'],'path':_[_0x8f11('0xaa')](_0x1a0268['body'][_0x8f11('0xa5')][0x0]['path'])?undefined:_0x1a0268['body']['attachments'][0x0][_0x8f11('0x6')],'fax':_['isNil'](_0x1a0268[_0x8f11('0x5a')]['to'][0x0])?undefined:_0x1a0268[_0x8f11('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x41f20d){if(_['isNil'](_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xab')])){_0x1a0268[_0x8f11('0x5a')]['from']=util[_0x8f11('0x9f')]('\x22%s\x22\x20<%s>',_0x41f20d[_0x8f11('0x3a')],_0x41f20d[_0x8f11('0xac')]);}if(_0x41f20d[_0x8f11('0xa2')]){if(_0x41f20d[_0x8f11('0xa2')][_0x8f11('0xa3')]['length']){return _0x41f20d[_0x8f11('0xa2')][_0x8f11('0xa3')][0x0];}else{return db[_0x8f11('0x72')][_0x8f11('0x59')](_[_0x8f11('0x19')](_0x1a0268['body'],{'firstName':_0x1a0268['body']['to'][0x0],'phone':_0x1a0268[_0x8f11('0x5a')]['to'][0x0],'fax':_0x1a0268[_0x8f11('0x5a')]['to'][0x0],'ListId':_0x41f20d[_0x8f11('0x9a')]}));}}else{throw new Error(_0x8f11('0xad'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x363738){if(_0x363738){return db[_0x8f11('0x70')][_0x8f11('0x58')]({'where':{'ContactId':_0x363738['id'],'closed':![],'FaxAccountId':_0x41f20d['id']}})['then'](function(_0x4a6910){if(_0x4a6910){return[_0x4a6910,![]];}return db[_0x8f11('0x70')][_0x8f11('0x59')]({'UserId':_0x1a0268[_0x8f11('0x5b')]['id'],'ContactId':_0x363738['id'],'FaxAccountId':_0x41f20d['id'],'fax':_0x1a0268[_0x8f11('0x5a')]['to'][0x0],'firstMsgDirection':_0x8f11('0xae'),'Messages':[_[_0x8f11('0x4d')](_0x1a0268[_0x8f11('0x5a')],{'read':![],'body':_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][0x0]['filename'],'FaxAccountId':_0x41f20d['id'],'UserId':_0x1a0268['user']['id'],'ContactId':_0x363738['id'],'AttachmentId':_0x1a0268['body'][_0x8f11('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x8f11('0xa1')],'as':_0x8f11('0xaf')}]})[_0x8f11('0x20')](function(_0x185065){return[_0x185065,!![]];});});}else{throw new Error(_0x8f11('0xb0'));}})[_0x8f11('0xb1')](function(_0xfcf8c,_0x2d16e8){if(_0x2d16e8){return _0xfcf8c;}return db['FaxMessage'][_0x8f11('0x59')]({'direction':_0x8f11('0xae'),'read':![],'body':_0x1a0268['body'][_0x8f11('0xa5')][0x0][_0x8f11('0xb2')],'FaxAccountId':_0x41f20d['id'],'FaxInteractionId':_0xfcf8c['id'],'UserId':_0x1a0268[_0x8f11('0x5b')]['id'],'ContactId':_0xfcf8c[_0x8f11('0xb3')],'AttachmentId':_0x1a0268[_0x8f11('0x5a')][_0x8f11('0xa5')][0x0]['id']})[_0x8f11('0x20')](function(_0x16cdb4){_0xfcf8c[_0x8f11('0xb4')]['Messages']=[];_0xfcf8c[_0x8f11('0xb4')][_0x8f11('0xaf')]['push'](_0x16cdb4['dataValues']);return _0xfcf8c;});})[_0x8f11('0x20')](function(_0x3f7f49){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x8f11('0xaa')](_0x1a0268[_0x8f11('0x61')]['id'])?undefined:_0x1a0268[_0x8f11('0x61')]['id'],'path':_[_0x8f11('0xaa')](_0x1a0268['body'][_0x8f11('0xa5')][0x0][_0x8f11('0x6')])?undefined:_0x1a0268['body'][_0x8f11('0xa5')][0x0][_0x8f11('0x6')],'fax':_[_0x8f11('0xaa')](_0x1a0268[_0x8f11('0x5a')]['to'][0x0])?undefined:_0x1a0268[_0x8f11('0x5a')]['to'][0x0],'AttachmentId':_0x1a0268['body'][_0x8f11('0xa5')][0x0]['id']},client9002)['then'](function(_0x841f37){logger[_0x8f11('0x21')](_0x8f11('0xb5'),_0x841f37);})[_0x8f11('0x2a')](function(_0x4f5580){logger[_0x8f11('0x21')](_0x8f11('0xb5'),_0x4f5580);});return _0x3f7f49;})[_0x8f11('0x20')](respondWithResult(_0x2e5866,null))[_0x8f11('0x2a')](handleError(_0x2e5866,null));};exports[_0x8f11('0xb6')]=function(_0x9e2d8f,_0x18faaa,_0x39f5ce){return db[_0x8f11('0x51')][_0x8f11('0x58')]({'where':{'id':_0x9e2d8f[_0x8f11('0x61')]['id']}})['then'](handleEntityNotFound(_0x18faaa,null))[_0x8f11('0x20')](function(_0xf6025a){if(_0xf6025a){return _0xf6025a[_0x8f11('0xb6')](_0x9e2d8f[_0x8f11('0x5a')]['ids'],_['omit'](_0x9e2d8f[_0x8f11('0x5a')],[_0x8f11('0x6b'),'id'])||{})[_0x8f11('0xb1')](function(_0x4c14e5){for(var _0x135549=0x0;_0x135549<_0x9e2d8f[_0x8f11('0x5a')][_0x8f11('0x6b')][_0x8f11('0x57')];_0x135549+=0x1){socket['emit'](_0x8f11('0xb7'),{'UserId':Number(_0x9e2d8f[_0x8f11('0x5a')]['ids'][_0x135549]),'FaxAccountId':Number(_0x9e2d8f['params']['id'])});}return _0x4c14e5;});}})[_0x8f11('0x20')](respondWithResult(_0x18faaa,null))[_0x8f11('0x2a')](handleError(_0x18faaa,null));};exports[_0x8f11('0xb8')]=function(_0x32412e,_0x425582,_0x276748){return db['FaxAccount'][_0x8f11('0x58')]({'where':{'id':_0x32412e[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x425582,null))[_0x8f11('0x20')](function(_0x50ae2e){if(_0x50ae2e){return _0x50ae2e['removeAgents'](_0x32412e[_0x8f11('0x43')][_0x8f11('0x6b')])[_0x8f11('0x20')](function(){if(_['isArray'](_0x32412e[_0x8f11('0x43')]['ids'])){for(var _0x1b2db3=0x0;_0x1b2db3<_0x32412e[_0x8f11('0x43')][_0x8f11('0x6b')][_0x8f11('0x57')];_0x1b2db3+=0x1){socket['emit'](_0x8f11('0xb9'),{'UserId':Number(_0x32412e[_0x8f11('0x43')][_0x8f11('0x6b')][_0x1b2db3]),'FaxAccountId':Number(_0x32412e[_0x8f11('0x61')]['id'])});}}else{socket[_0x8f11('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x32412e['query']['ids']),'FaxAccountId':Number(_0x32412e[_0x8f11('0x61')]['id'])});}});}})[_0x8f11('0x20')](respondWithStatusCode(_0x425582,null))['catch'](handleError(_0x425582,null));};exports['getAgents']=function(_0x1a5174,_0x5b08d4,_0x185203){var _0x3bf410={};var _0x4c933d={};var _0x46986b;var _0x149935;return db[_0x8f11('0x51')]['findOne']({'where':{'id':_0x1a5174[_0x8f11('0x61')]['id']}})[_0x8f11('0x20')](handleEntityNotFound(_0x5b08d4,null))[_0x8f11('0x20')](function(_0x245084){if(_0x245084){_0x46986b=_0x245084;_0x4c933d['model']=_[_0x8f11('0x44')](db[_0x8f11('0x74')][_0x8f11('0x56')]);_0x4c933d['query']=_['keys'](_0x1a5174[_0x8f11('0x43')]);_0x4c933d[_0x8f11('0x45')]=_['intersection'](_0x4c933d[_0x8f11('0x42')],_0x4c933d['query']);_0x3bf410[_0x8f11('0x47')]=_['intersection'](_0x4c933d[_0x8f11('0x42')],qs['fields'](_0x1a5174['query']['fields']));_0x3bf410[_0x8f11('0x47')]=_0x3bf410[_0x8f11('0x47')][_0x8f11('0x57')]?_0x3bf410[_0x8f11('0x47')]:_0x4c933d[_0x8f11('0x42')];_0x3bf410[_0x8f11('0x49')]=qs[_0x8f11('0x4a')](_0x1a5174[_0x8f11('0x43')][_0x8f11('0x4a')]);_0x3bf410[_0x8f11('0x4b')]=qs[_0x8f11('0x45')](_['pick'](_0x1a5174[_0x8f11('0x43')],_0x4c933d['filters']));if(_0x1a5174[_0x8f11('0x43')][_0x8f11('0x4f')]){_0x3bf410[_0x8f11('0x4b')]=_['merge'](_0x3bf410[_0x8f11('0x4b')],{'$or':_[_0x8f11('0x3f')](_0x3bf410['attributes'],function(_0x2db13d){var _0x22f91b={};_0x22f91b[_0x2db13d]={'$like':'%'+_0x1a5174[_0x8f11('0x43')][_0x8f11('0x4f')]+'%'};return _0x22f91b;})});}_0x3bf410=_[_0x8f11('0x4d')]({},_0x3bf410,_0x1a5174[_0x8f11('0x50')]);return _0x46986b['getAgents'](_0x3bf410);}})[_0x8f11('0x20')](function(_0x4c34d7){if(_0x4c34d7){_0x149935=_0x4c34d7[_0x8f11('0x57')];if(!_0x1a5174[_0x8f11('0x43')][_0x8f11('0x48')]('nolimit')){_0x3bf410[_0x8f11('0x31')]=qs['limit'](_0x1a5174[_0x8f11('0x43')]['limit']);_0x3bf410['offset']=qs[_0x8f11('0x2f')](_0x1a5174['query']['offset']);}return _0x46986b[_0x8f11('0xbb')](_0x3bf410);}})['then'](function(_0x58f731){if(_0x58f731){return _0x58f731?{'count':_0x149935,'rows':_0x58f731}:null;}})[_0x8f11('0x20')](respondWithResult(_0x5b08d4,null))[_0x8f11('0x2a')](handleError(_0x5b08d4,null));}; \ No newline at end of file +var _0xc300=['\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','FaxAccounts','destroy','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','Pause','intersection','length','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from'];(function(_0xc135dd,_0x1712fd){var _0x5a0604=function(_0x5b0d4b){while(--_0x5b0d4b){_0xc135dd['push'](_0xc135dd['shift']());}};_0x5a0604(++_0x1712fd);}(_0xc300,0x198));var _0x0c30=function(_0x1f0417,_0x21e933){_0x1f0417=_0x1f0417-0x0;var _0x132a3d=_0xc300[_0x1f0417];return _0x132a3d;};'use strict';var emlformat=require(_0x0c30('0x0'));var rimraf=require(_0x0c30('0x1'));var zipdir=require(_0x0c30('0x2'));var jsonpatch=require(_0x0c30('0x3'));var rp=require(_0x0c30('0x4'));var moment=require(_0x0c30('0x5'));var BPromise=require(_0x0c30('0x6'));var Mustache=require(_0x0c30('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0c30('0x8'));var ejs=require(_0x0c30('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c30('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c30('0xb'));var toCsv=require(_0x0c30('0x8'));var querystring=require(_0x0c30('0xc'));var Papa=require(_0x0c30('0xd'));var Redis=require(_0x0c30('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0c30('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c30('0x10'));var logger=require('../../config/logger')(_0x0c30('0x11'));var utils=require(_0x0c30('0x12'));var config=require(_0x0c30('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c30('0x14'))['db'];config[_0x0c30('0x15')]=_[_0x0c30('0x16')](config[_0x0c30('0x15')],{'host':_0x0c30('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x0c30('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0c30('0x19')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c59e3,_0x5025ee,_0x485304,_0x3915cb){return new BPromise(function(_0x17d0aa,_0x109c7a){var _0x2cfab0=_0x3915cb||client;return _0x2cfab0[_0x0c30('0x1a')](_0x4c59e3,_0x485304)['then'](function(_0x3cc340){logger[_0x0c30('0x1b')](_0x0c30('0x1c'),_0x5025ee,'request\x20sent');logger[_0x0c30('0x1d')](_0x0c30('0x1e'),_0x5025ee,_0x0c30('0x1f'),JSON[_0x0c30('0x20')](_0x3cc340));if(_0x3cc340[_0x0c30('0x21')]){if(_0x3cc340[_0x0c30('0x21')][_0x0c30('0x22')]===0x1f4){logger[_0x0c30('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5025ee,_0x3cc340[_0x0c30('0x21')][_0x0c30('0x23')]);return _0x109c7a(_0x3cc340[_0x0c30('0x21')]['message']);}logger[_0x0c30('0x21')](_0x0c30('0x1c'),_0x5025ee,_0x3cc340['error'][_0x0c30('0x23')]);return _0x17d0aa(_0x3cc340['error'][_0x0c30('0x23')]);}else{logger[_0x0c30('0x1b')](_0x0c30('0x1c'),_0x5025ee,_0x0c30('0x1f'));_0x17d0aa(_0x3cc340[_0x0c30('0x24')]['message']);}})[_0x0c30('0x25')](function(_0xd568cf){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5025ee,_0xd568cf);_0x109c7a(_0xd568cf);});});}function respondWithStatusCode(_0x9d8dee,_0x39232f){_0x39232f=_0x39232f||0xcc;return function(_0x4a3e18){if(_0x4a3e18){return _0x9d8dee[_0x0c30('0x26')](_0x39232f);}return _0x9d8dee[_0x0c30('0x27')](_0x39232f)[_0x0c30('0x28')]();};}function respondWithResult(_0x2d3e05,_0x31c350){_0x31c350=_0x31c350||0xc8;return function(_0x27e1d5){if(_0x27e1d5){return _0x2d3e05[_0x0c30('0x27')](_0x31c350)[_0x0c30('0x29')](_0x27e1d5);}};}function respondWithFilteredResult(_0x471fdc,_0x3cda20){return function(_0x3aaf32){if(_0x3aaf32){var _0xfa687f=typeof _0x3cda20[_0x0c30('0x2a')]==='undefined'&&typeof _0x3cda20['limit']===_0x0c30('0x2b');var _0x9696b6=_0x3aaf32[_0x0c30('0x2c')];var _0x23698b=_0xfa687f?0x0:_0x3cda20[_0x0c30('0x2a')];var _0x55a824=_0xfa687f?_0x3aaf32['count']:_0x3cda20['offset']+_0x3cda20[_0x0c30('0x2d')];var _0x1b9367;if(_0x55a824>=_0x9696b6){_0x55a824=_0x9696b6;_0x1b9367=0xc8;}else{_0x1b9367=0xce;}_0x471fdc[_0x0c30('0x27')](_0x1b9367);return _0x471fdc[_0x0c30('0x2e')](_0x0c30('0x2f'),_0x23698b+'-'+_0x55a824+'/'+_0x9696b6)[_0x0c30('0x29')](_0x3aaf32);}return null;};}function patchUpdates(_0x3534eb){return function(_0x42ef6b){try{jsonpatch['apply'](_0x42ef6b,_0x3534eb,!![]);}catch(_0x2f3f6e){return BPromise[_0x0c30('0x30')](_0x2f3f6e);}return _0x42ef6b[_0x0c30('0x31')]();};}function saveUpdates(_0x4967f7,_0x5cad74){return function(_0x2b9863){if(_0x2b9863){return _0x2b9863[_0x0c30('0x32')](_0x4967f7)['then'](function(_0x11f945){return _0x11f945;});}return null;};}function removeEntity(_0x2ea7dc,_0x3abf49){return function(_0x6786c5){if(_0x6786c5){return _0x6786c5['destroy']()[_0x0c30('0x33')](function(){var _0x2622c2=_0x6786c5[_0x0c30('0x34')]({'plain':!![]});var _0x4680f4=_0x0c30('0x35');return db['UserProfileResource'][_0x0c30('0x36')]({'where':{'type':_0x4680f4,'resourceId':_0x2622c2['id']}})[_0x0c30('0x33')](function(){return _0x6786c5;});})['then'](function(){_0x2ea7dc[_0x0c30('0x27')](0xcc)[_0x0c30('0x28')]();});}};}function handleEntityNotFound(_0x5bc94f,_0xec0e63){return function(_0x4d5a6c){if(!_0x4d5a6c){_0x5bc94f[_0x0c30('0x26')](0x194);}return _0x4d5a6c;};}function handleError(_0x3f0c99,_0x4a580c){_0x4a580c=_0x4a580c||0x1f4;return function(_0x27e06b){logger[_0x0c30('0x21')](_0x27e06b['stack']);if(_0x27e06b[_0x0c30('0x37')]){delete _0x27e06b[_0x0c30('0x37')];}_0x3f0c99[_0x0c30('0x27')](_0x4a580c)[_0x0c30('0x38')](_0x27e06b);};}exports[_0x0c30('0x39')]=function(_0x5a9d4d,_0x2cd700){var _0x26793f={'include':[{'model':db['Pause'],'as':_0x0c30('0x3a')}]},_0x348acf={},_0x91bf6a={'count':0x0,'rows':[]};var _0x29c61e=_[_0x0c30('0x3b')](db[_0x0c30('0x3c')][_0x0c30('0x3d')],function(_0xa01891){return{'name':_0xa01891[_0x0c30('0x3e')],'type':_0xa01891[_0x0c30('0x3f')]['key']};});_0x348acf[_0x0c30('0x40')]=_[_0x0c30('0x3b')](_0x29c61e,'name');_0x348acf[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5a9d4d[_0x0c30('0x41')]);_0x348acf['filters']=_['intersection'](_0x348acf['model'],_0x348acf[_0x0c30('0x41')]);_0x26793f[_0x0c30('0x43')]=_['intersection'](_0x348acf['model'],qs[_0x0c30('0x44')](_0x5a9d4d['query']['fields']));_0x26793f['attributes']=_0x26793f['attributes']['length']?_0x26793f[_0x0c30('0x43')]:_0x348acf[_0x0c30('0x40')];if(!_0x5a9d4d[_0x0c30('0x41')][_0x0c30('0x45')]('nolimit')){_0x26793f['limit']=qs[_0x0c30('0x2d')](_0x5a9d4d['query']['limit']);_0x26793f[_0x0c30('0x2a')]=qs['offset'](_0x5a9d4d['query']['offset']);}_0x26793f[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5a9d4d['query'][_0x0c30('0x47')]);_0x26793f[_0x0c30('0x48')]=qs['filters'](_['pick'](_0x5a9d4d['query'],_0x348acf[_0x0c30('0x49')]),_0x29c61e);if(_0x5a9d4d['query'][_0x0c30('0x4a')]){_0x26793f[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x26793f[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x29c61e,function(_0xd6ff6a){if(_0xd6ff6a[_0x0c30('0x3f')]!=='VIRTUAL'){var _0xbe285b={};_0xbe285b[_0xd6ff6a[_0x0c30('0x37')]]={'$like':'%'+_0x5a9d4d[_0x0c30('0x41')]['filter']+'%'};return _0xbe285b;}})});}_0x26793f=_[_0x0c30('0x4b')]({},_0x26793f,_0x5a9d4d['options']);var _0x528fcc={'where':_0x26793f[_0x0c30('0x48')]};return db[_0x0c30('0x3c')][_0x0c30('0x2c')](_0x528fcc)['then'](function(_0x138c4d){_0x91bf6a[_0x0c30('0x2c')]=_0x138c4d;if(_0x5a9d4d[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x26793f[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0x3c')][_0x0c30('0x4e')](_0x26793f);})[_0x0c30('0x33')](function(_0x1080e7){_0x91bf6a[_0x0c30('0x4f')]=_0x1080e7;return _0x91bf6a;})[_0x0c30('0x33')](respondWithFilteredResult(_0x2cd700,_0x26793f))['catch'](handleError(_0x2cd700,null));};exports[_0x0c30('0x50')]=function(_0x29aa20,_0x57495c){var _0x159ec={'raw':![],'where':{'id':_0x29aa20[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0x52')],'as':_0x0c30('0x3a')}]},_0x57098a={};_0x57098a[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x3c')]['rawAttributes']);_0x57098a[_0x0c30('0x41')]=_['keys'](_0x29aa20[_0x0c30('0x41')]);_0x57098a[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0x57098a[_0x0c30('0x40')],_0x57098a[_0x0c30('0x41')]);_0x159ec[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x57098a[_0x0c30('0x40')],qs['fields'](_0x29aa20['query'][_0x0c30('0x44')]));_0x159ec[_0x0c30('0x43')]=_0x159ec['attributes'][_0x0c30('0x54')]?_0x159ec[_0x0c30('0x43')]:_0x57098a[_0x0c30('0x40')];if(_0x29aa20['query']['includeAll']){_0x159ec[_0x0c30('0x4d')]=[{'all':!![]}];}_0x159ec=_[_0x0c30('0x4b')]({},_0x159ec,_0x29aa20[_0x0c30('0x55')]);return db[_0x0c30('0x3c')][_0x0c30('0x56')](_0x159ec)[_0x0c30('0x33')](handleEntityNotFound(_0x57495c,null))['then'](respondWithResult(_0x57495c,null))[_0x0c30('0x25')](handleError(_0x57495c,null));};exports['create']=function(_0x31ede4,_0x3c1686){return db[_0x0c30('0x3c')][_0x0c30('0x57')](_0x31ede4[_0x0c30('0x58')],{})[_0x0c30('0x33')](function(_0x4f46d6){var _0x11d9cb=_0x31ede4['user'][_0x0c30('0x34')]({'plain':!![]});if(!_0x11d9cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11d9cb[_0x0c30('0x59')]===_0x0c30('0x5a')){var _0x5b955b=_0x4f46d6['get']({'plain':!![]});var _0x2c347f='FaxAccounts';return db[_0x0c30('0x5b')][_0x0c30('0x56')]({'where':{'name':_0x2c347f,'userProfileId':_0x11d9cb[_0x0c30('0x5c')]},'raw':!![]})[_0x0c30('0x33')](function(_0x5655b2){if(_0x5655b2&&_0x5655b2[_0x0c30('0x5d')]===0x0){return db[_0x0c30('0x5e')][_0x0c30('0x57')]({'name':_0x5b955b[_0x0c30('0x37')],'resourceId':_0x5b955b['id'],'type':_0x5655b2[_0x0c30('0x37')],'sectionId':_0x5655b2['id']},{})['then'](function(){return _0x4f46d6;});}else{return _0x4f46d6;}})['catch'](function(_0x4ae5db){logger[_0x0c30('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ae5db);throw _0x4ae5db;});}return _0x4f46d6;})[_0x0c30('0x33')](respondWithResult(_0x3c1686,0xc9))[_0x0c30('0x25')](handleError(_0x3c1686,null));};exports[_0x0c30('0x32')]=function(_0x1e478b,_0x11180){if(_0x1e478b[_0x0c30('0x58')]['id']){delete _0x1e478b[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x1e478b[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0x52')],'as':'mandatoryDispositionPause'}]})[_0x0c30('0x33')](handleEntityNotFound(_0x11180,null))[_0x0c30('0x33')](saveUpdates(_0x1e478b['body'],null))[_0x0c30('0x33')](respondWithResult(_0x11180,null))[_0x0c30('0x25')](handleError(_0x11180,null));};exports[_0x0c30('0x36')]=function(_0x4b252a,_0x56c74f){return db['FaxAccount'][_0x0c30('0x56')]({'where':{'id':_0x4b252a['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x56c74f,null))[_0x0c30('0x33')](removeEntity(_0x56c74f,null))[_0x0c30('0x25')](handleError(_0x56c74f,null));};exports[_0x0c30('0x5f')]=function(_0xc1b42e,_0x3e0137){return db['FaxAccount'][_0x0c30('0x5f')]()['then'](respondWithResult(_0x3e0137,null))['catch'](handleError(_0x3e0137,null));};exports[_0x0c30('0x60')]=function(_0x33b27b,_0x388d38,_0x2c4595){if(_0x33b27b['body']['id']){delete _0x33b27b[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')]['find']({'where':{'id':_0x33b27b[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x388d38,null))[_0x0c30('0x33')](function(_0x1d6326){if(_0x1d6326){_0x33b27b[_0x0c30('0x58')][_0x0c30('0x61')]=_0x1d6326['id'];return db[_0x0c30('0x62')][_0x0c30('0x57')](_0x33b27b[_0x0c30('0x58')]);}})[_0x0c30('0x33')](respondWithResult(_0x388d38,null))['catch'](handleError(_0x388d38,null));};exports[_0x0c30('0x63')]=function(_0x26fbbc,_0x5dab2b,_0x213f46){var _0x186185={'raw':![],'where':{}};var _0x10aaf0={};var _0x53e773={'count':0x0,'rows':[]};return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x26fbbc[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x5dab2b,null))[_0x0c30('0x33')](function(_0x3adb91){if(_0x3adb91){_0x10aaf0['model']=_['keys'](db['Disposition'][_0x0c30('0x3d')]);_0x10aaf0['query']=_[_0x0c30('0x42')](_0x26fbbc[_0x0c30('0x41')]);_0x10aaf0[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0x10aaf0['model'],_0x10aaf0[_0x0c30('0x41')]);_0x186185['attributes']=_[_0x0c30('0x53')](_0x10aaf0[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x44')]));_0x186185[_0x0c30('0x43')]=_0x186185[_0x0c30('0x43')]['length']?_0x186185[_0x0c30('0x43')]:_0x10aaf0[_0x0c30('0x40')];if(!_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x186185[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x26fbbc['query'][_0x0c30('0x2d')]);_0x186185[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x186185['order']=qs[_0x0c30('0x47')](_0x26fbbc[_0x0c30('0x41')]['sort']);_0x186185['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x26fbbc[_0x0c30('0x41')],_0x10aaf0['filters']));_0x186185[_0x0c30('0x48')]['FaxAccountId']=_0x3adb91['id'];if(_0x26fbbc[_0x0c30('0x41')]['filter']){_0x186185[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x186185[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x186185[_0x0c30('0x43')],function(_0x43a591){var _0x3cd7da={};_0x3cd7da[_0x43a591]={'$like':'%'+_0x26fbbc['query'][_0x0c30('0x4a')]+'%'};return _0x3cd7da;})});}_0x186185=_[_0x0c30('0x4b')]({},_0x186185,_0x26fbbc[_0x0c30('0x55')]);return db[_0x0c30('0x62')]['count']({'where':_0x186185[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x15ef06){_0x53e773['count']=_0x15ef06;if(_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x186185[_0x0c30('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x186185);})[_0x0c30('0x33')](function(_0x568e26){_0x53e773[_0x0c30('0x4f')]=_0x568e26;return _0x53e773;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x5dab2b,_0x186185))['catch'](handleError(_0x5dab2b,null));};exports['removeDispositions']=function(_0xec23be,_0xc694fe,_0x139a04){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0xec23be[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0xc694fe,null))['then'](function(_0x4eed3b){if(_0x4eed3b){return _0x4eed3b[_0x0c30('0x67')](_0xec23be[_0x0c30('0x41')][_0x0c30('0x68')]);}})[_0x0c30('0x33')](respondWithStatusCode(_0xc694fe,null))[_0x0c30('0x25')](handleError(_0xc694fe,null));};exports[_0x0c30('0x69')]=function(_0x39494e,_0x3fbeda,_0x212b1e){if(_0x39494e['body']['id']){delete _0x39494e[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x39494e['params']['id']}})['then'](handleEntityNotFound(_0x3fbeda,null))[_0x0c30('0x33')](function(_0x188135){if(_0x188135){_0x39494e['body']['FaxAccountId']=_0x188135['id'];return db[_0x0c30('0x6a')]['create'](_0x39494e[_0x0c30('0x58')]);}})[_0x0c30('0x33')](respondWithResult(_0x3fbeda,null))[_0x0c30('0x25')](handleError(_0x3fbeda,null));};exports[_0x0c30('0x6b')]=function(_0x1e9a2b,_0x3d3736,_0x5df8ee){var _0x4220d1={'raw':![],'where':{}};var _0xa0b192={};var _0x5c1685={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0c30('0x64')]({'where':{'id':_0x1e9a2b[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x3d3736,null))[_0x0c30('0x33')](function(_0x54d50e){if(_0x54d50e){_0xa0b192[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x6a')][_0x0c30('0x3d')]);_0xa0b192[_0x0c30('0x41')]=_['keys'](_0x1e9a2b[_0x0c30('0x41')]);_0xa0b192[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0xa0b192[_0x0c30('0x40')],_0xa0b192[_0x0c30('0x41')]);_0x4220d1[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0xa0b192[_0x0c30('0x40')],qs['fields'](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x44')]));_0x4220d1[_0x0c30('0x43')]=_0x4220d1[_0x0c30('0x43')][_0x0c30('0x54')]?_0x4220d1[_0x0c30('0x43')]:_0xa0b192[_0x0c30('0x40')];if(!_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x4220d1[_0x0c30('0x2d')]=qs['limit'](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x2d')]);_0x4220d1[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x4220d1[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x1e9a2b['query'][_0x0c30('0x47')]);_0x4220d1[_0x0c30('0x48')]=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x1e9a2b[_0x0c30('0x41')],_0xa0b192['filters']));_0x4220d1['where'][_0x0c30('0x61')]=_0x54d50e['id'];if(_0x1e9a2b['query'][_0x0c30('0x4a')]){_0x4220d1[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x4220d1[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x4220d1['attributes'],function(_0x1cc982){var _0x4d366f={};_0x4d366f[_0x1cc982]={'$like':'%'+_0x1e9a2b[_0x0c30('0x41')]['filter']+'%'};return _0x4d366f;})});}_0x4220d1=_[_0x0c30('0x4b')]({},_0x4220d1,_0x1e9a2b[_0x0c30('0x55')]);return db[_0x0c30('0x6a')][_0x0c30('0x2c')]({'where':_0x4220d1[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x35aabc){_0x5c1685[_0x0c30('0x2c')]=_0x35aabc;if(_0x1e9a2b['query'][_0x0c30('0x4c')]){_0x4220d1[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0x6a')][_0x0c30('0x4e')](_0x4220d1);})['then'](function(_0x9b4122){_0x5c1685[_0x0c30('0x4f')]=_0x9b4122;return _0x5c1685;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x3d3736,_0x4220d1))[_0x0c30('0x25')](handleError(_0x3d3736,null));};exports[_0x0c30('0x6c')]=function(_0x2008de,_0x4827f6,_0x55f96a){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x2008de['params']['id']}})['then'](handleEntityNotFound(_0x4827f6,null))[_0x0c30('0x33')](function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c6e6d['removeAnswers'](_0x2008de[_0x0c30('0x41')]['ids']);}})[_0x0c30('0x33')](respondWithStatusCode(_0x4827f6,null))[_0x0c30('0x25')](handleError(_0x4827f6,null));};exports[_0x0c30('0x6d')]=function(_0xc50f39,_0x1bcb31,_0x37f568){return db[_0x0c30('0x6e')][_0x0c30('0x56')]({'where':{'id':_0xc50f39['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x1bcb31,null))[_0x0c30('0x33')](function(_0x29311d){if(_0x29311d){return _0x29311d[_0x0c30('0x6d')](_0xc50f39['body'][_0x0c30('0x68')],_['omit'](_0xc50f39['body'],[_0x0c30('0x68'),'id'])||{});}})[_0x0c30('0x33')](respondWithResult(_0x1bcb31,null))[_0x0c30('0x25')](handleError(_0x1bcb31,null));};exports[_0x0c30('0x6f')]=function(_0x2744fa,_0x551214,_0x1d32d7){var _0x3186cd={'raw':![],'where':{}};var _0xf05893={};var _0x1ec0ba={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0c30('0x64')]({'where':{'id':_0x2744fa[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x551214,null))[_0x0c30('0x33')](function(_0x25ee45){if(_0x25ee45){_0xf05893[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x6e')]['rawAttributes']);_0xf05893['query']=_[_0x0c30('0x42')](_0x2744fa[_0x0c30('0x41')]);_0xf05893['filters']=_['intersection'](_0xf05893[_0x0c30('0x40')],_0xf05893['query']);_0x3186cd[_0x0c30('0x43')]=_['intersection'](_0xf05893[_0x0c30('0x40')],qs['fields'](_0x2744fa['query'][_0x0c30('0x44')]));_0x3186cd[_0x0c30('0x43')]=_0x3186cd[_0x0c30('0x43')][_0x0c30('0x54')]?_0x3186cd[_0x0c30('0x43')]:_0xf05893[_0x0c30('0x40')];if(!_0x2744fa[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x3186cd[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x2744fa[_0x0c30('0x41')][_0x0c30('0x2d')]);_0x3186cd[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x2744fa[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x3186cd[_0x0c30('0x46')]=qs['sort'](_0x2744fa['query'][_0x0c30('0x47')]);_0x3186cd['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x2744fa['query'],_0xf05893[_0x0c30('0x49')]));_0x3186cd[_0x0c30('0x48')][_0x0c30('0x61')]=_0x25ee45['id'];if(_0x2744fa[_0x0c30('0x41')][_0x0c30('0x4a')]){_0x3186cd[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x3186cd[_0x0c30('0x48')],{'$or':_['map'](_0x3186cd['attributes'],function(_0x59b2b8){var _0x263fd8={};_0x263fd8[_0x59b2b8]={'$like':'%'+_0x2744fa['query']['filter']+'%'};return _0x263fd8;})});}_0x3186cd=_[_0x0c30('0x4b')]({},_0x3186cd,_0x2744fa['options']);return db[_0x0c30('0x6e')][_0x0c30('0x2c')]({'where':_0x3186cd[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x5e4261){_0x1ec0ba[_0x0c30('0x2c')]=_0x5e4261;if(_0x2744fa[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x3186cd[_0x0c30('0x4d')]=[{'model':db[_0x0c30('0x70')],'as':_0x0c30('0x71'),'required':![]},{'model':db[_0x0c30('0x72')],'as':'Owner','attributes':[_0x0c30('0x37'),_0x0c30('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0c30('0x74'),'attributes':['id',_0x0c30('0x37'),_0x0c30('0x75')],'where':_0x2744fa[_0x0c30('0x41')][_0x0c30('0x76')]?{'id':_0x2744fa[_0x0c30('0x41')]['tag']}:undefined,'required':_0x2744fa['query'][_0x0c30('0x76')]?!![]:![]}];}return db[_0x0c30('0x6e')][_0x0c30('0x4e')](_0x3186cd);})[_0x0c30('0x33')](function(_0x2f8a65){_0x1ec0ba[_0x0c30('0x4f')]=_0x2f8a65;return _0x1ec0ba;});}})['then'](respondWithFilteredResult(_0x551214,_0x3186cd))[_0x0c30('0x25')](handleError(_0x551214,null));};exports[_0x0c30('0x77')]=function(_0x2d1673,_0x5bdb58){var _0x2f9e3a=_0x2d1673['params']['id'];var _0xbcdabe=_0x2d1673[_0x0c30('0x58')];var _0x4b76ca=0xc8;var _0x55aeca=null;return db[_0x0c30('0x78')]['transaction']({'isolationLevel':db['sequelize'][_0x0c30('0x79')][_0x0c30('0x7a')][_0x0c30('0x7b')]},function(_0x44da11){return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x2f9e3a},'transaction':_0x44da11})[_0x0c30('0x33')](function(_0x308ba5){if(_0x308ba5){return db[_0x0c30('0x7c')][_0x0c30('0x36')]({'where':{'FaxAccountId':_0x2f9e3a},'transaction':_0x44da11})[_0x0c30('0x33')](function(){var _0x2e2e9e=_[_0x0c30('0x3b')](_0xbcdabe,function(_0x30a92c){_0x30a92c[_0x0c30('0x61')]=_0x2f9e3a;return _0x30a92c;});return db[_0x0c30('0x7c')][_0x0c30('0x7d')](_0x2e2e9e,{'transaction':_0x44da11});});}else{_0x4b76ca=0x194;_0x55aeca=[];}});})['then'](function(){if(_0x4b76ca!==0x194){return db[_0x0c30('0x7c')][_0x0c30('0x7e')]({'where':{'FaxAccountId':_0x2f9e3a},'order':_0x0c30('0x7f')})['then'](function(_0x58e1d0){_0x55aeca=_0x58e1d0;});}})[_0x0c30('0x25')](function(_0x12699d){_0x4b76ca=0x1f4;logger[_0x0c30('0x21')](_0x12699d[_0x0c30('0x80')]);if(_0x12699d[_0x0c30('0x37')]){delete _0x12699d['name'];}_0x55aeca=_0x12699d;})[_0x0c30('0x81')](function(){if(_0x55aeca===null){_0x5bdb58[_0x0c30('0x26')](_0x4b76ca);}else{if(_0x4b76ca===0x1f4){_0x5bdb58[_0x0c30('0x27')](_0x4b76ca)[_0x0c30('0x38')](_0x55aeca);}else{_0x5bdb58['status'](_0x4b76ca)[_0x0c30('0x29')](_0x55aeca);}}});};exports[_0x0c30('0x82')]=function(_0x5d6dca,_0x4313dd,_0x201295){var _0x53a8df={};var _0x1f0aed={};var _0x249bbb;var _0x1b1848;return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x5d6dca[_0x0c30('0x51')]['id']}})['then'](handleEntityNotFound(_0x4313dd,null))[_0x0c30('0x33')](function(_0xa4c754){if(_0xa4c754){_0x249bbb=_0xa4c754;_0x1f0aed[_0x0c30('0x40')]=_[_0x0c30('0x42')](db['FaxApplication'][_0x0c30('0x3d')]);_0x1f0aed[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5d6dca[_0x0c30('0x41')]);_0x1f0aed[_0x0c30('0x49')]=_['intersection'](_0x1f0aed[_0x0c30('0x40')],_0x1f0aed[_0x0c30('0x41')]);_0x53a8df[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x1f0aed[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x44')]));_0x53a8df[_0x0c30('0x43')]=_0x53a8df[_0x0c30('0x43')][_0x0c30('0x54')]?_0x53a8df['attributes']:_0x1f0aed[_0x0c30('0x40')];_0x53a8df[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x47')]);_0x53a8df['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x5d6dca[_0x0c30('0x41')],_0x1f0aed[_0x0c30('0x49')]));if(_0x5d6dca[_0x0c30('0x41')]['filter']){_0x53a8df[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x53a8df[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x53a8df[_0x0c30('0x43')],function(_0x78f276){var _0x48a5b9={};_0x48a5b9[_0x78f276]={'$like':'%'+_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x4a')]+'%'};return _0x48a5b9;})});}_0x53a8df=_[_0x0c30('0x4b')]({},_0x53a8df,_0x5d6dca[_0x0c30('0x55')]);return _0x249bbb[_0x0c30('0x82')](_0x53a8df);}})[_0x0c30('0x33')](function(_0x121bc1){if(_0x121bc1){_0x1b1848=_0x121bc1[_0x0c30('0x54')];if(!_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x53a8df['limit']=qs[_0x0c30('0x2d')](_0x5d6dca['query']['limit']);_0x53a8df[_0x0c30('0x2a')]=qs['offset'](_0x5d6dca[_0x0c30('0x41')]['offset']);}return _0x249bbb[_0x0c30('0x82')](_0x53a8df);}})[_0x0c30('0x33')](function(_0x53a038){if(_0x53a038){return _0x53a038?{'count':_0x1b1848,'rows':_0x53a038}:null;}})[_0x0c30('0x33')](respondWithResult(_0x4313dd,null))[_0x0c30('0x25')](handleError(_0x4313dd,null));};function Extension(_0x3b14ad,_0x23de43,_0x55d726,_0x218e8c){this[_0x0c30('0x83')]=_0x0c30('0x84');this[_0x0c30('0x85')]=_0x3b14ad[_0x0c30('0x86')];this['app']=_0x218e8c;this['type']=_0x0c30('0x87');this[_0x0c30('0x88')]=_0x0c30('0x89');this[_0x0c30('0x61')]=_0x3b14ad['id'];this['priority']=_0x23de43;this[_0x0c30('0x8a')]=_0x55d726;}function createExtensionsReciveFax(_0x7b0410){var _0x5acb0d=0x1;var _0x570098=[];_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'',_0x0c30('0x8c')));_0x5acb0d+=0x1;_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,_0x0c30('0x8d'),_0x0c30('0x8e')));_0x5acb0d+=0x1;for(var _0x36936a in _0x7b0410){if(_0x7b0410[_0x0c30('0x45')](_0x36936a)&&(_0x36936a==='ecm'||_0x36936a===_0x0c30('0x86')||_0x36936a===_0x0c30('0x8f')||_0x36936a===_0x0c30('0x90')||_0x36936a===_0x0c30('0x91')||_0x36936a==='maxrate'||_0x36936a==='minrate'||_0x36936a===_0x0c30('0x92')||_0x36936a==='t38timeout')){_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,_0x0c30('0x93')+_0x36936a+')='+_0x7b0410[_0x36936a],_0x0c30('0x8e')));_0x5acb0d+=0x1;}}_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'6',_0x0c30('0x94')));_0x5acb0d+=0x1;_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'/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',_0x0c30('0x95')));_0x5acb0d=0x0;return _0x570098;}exports[_0x0c30('0x96')]=function(_0xb597ad,_0x51ba66,_0x147999){var _0x213bf8;return db[_0x0c30('0x78')][_0x0c30('0x97')](function(_0x4746f9){return db[_0x0c30('0x3c')]['create'](_0xb597ad['body'],{'transaction':_0x4746f9})['then'](function(_0x35d332){_0x213bf8=_0x35d332[_0x0c30('0x34')]({'plain':!![]});return db[_0x0c30('0x98')][_0x0c30('0x7d')](createExtensionsReciveFax(_0x213bf8),{'transaction':_0x4746f9});});})[_0x0c30('0x33')](function(){return _0x213bf8;})['then'](respondWithResult(_0x51ba66,null))[_0x0c30('0x25')](handleError(_0x51ba66,null));};exports['updateAccountApplications']=function(_0x287526,_0x5486f3,_0x43f4e0){var _0x3a18e0;return db[_0x0c30('0x78')]['transaction'](function(_0x5b2f23){return db[_0x0c30('0x3c')][_0x0c30('0x32')](_0x287526[_0x0c30('0x58')],{'where':{'id':_0x287526[_0x0c30('0x58')]['id']},'transaction':_0x5b2f23})[_0x0c30('0x33')](function(_0x262d10){return db[_0x0c30('0x98')][_0x0c30('0x36')]({'where':{'FaxAccountId':_0x287526['body']['id']},'transaction':_0x5b2f23})[_0x0c30('0x33')](function(_0x148483){return db[_0x0c30('0x98')][_0x0c30('0x7d')](createExtensionsReciveFax(_[_0x0c30('0x99')](_0x287526[_0x0c30('0x58')],[_0x0c30('0x9a'),'key',_0x0c30('0x9b'),_0x0c30('0x9c'),_0x0c30('0x9d'),_0x0c30('0x9e')])),{'transaction':_0x5b2f23});});});})[_0x0c30('0x33')](function(){return db['FaxAccount'][_0x0c30('0x9f')](_0x287526[_0x0c30('0x58')]['id']);})['then'](respondWithResult(_0x5486f3,null))[_0x0c30('0x25')](handleError(_0x5486f3,null));};exports[_0x0c30('0xa0')]=function(_0x5e3531,_0x4ec451,_0x3e0b3c){var _0x2dd15b={'raw':!![],'where':{}};var _0x2af0c4={};var _0x5bf596={'count':0x0,'rows':[]};return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x5e3531[_0x0c30('0x51')]['id']}})['then'](handleEntityNotFound(_0x4ec451,null))[_0x0c30('0x33')](function(_0x29e181){if(_0x29e181){_0x2af0c4[_0x0c30('0x40')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x2af0c4[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5e3531[_0x0c30('0x41')]);_0x2af0c4['filters']=_[_0x0c30('0x53')](_0x2af0c4['model'],_0x2af0c4[_0x0c30('0x41')]);_0x2dd15b[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x2af0c4[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x5e3531[_0x0c30('0x41')][_0x0c30('0x44')]));_0x2dd15b[_0x0c30('0x43')]=_0x2dd15b[_0x0c30('0x43')][_0x0c30('0x54')]?_0x2dd15b[_0x0c30('0x43')]:_0x2af0c4['model'];if(!_0x5e3531['query'][_0x0c30('0x45')](_0x0c30('0x65'))){_0x2dd15b['limit']=qs['limit'](_0x5e3531[_0x0c30('0x41')]['limit']);_0x2dd15b[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x5e3531['query']['offset']);}_0x2dd15b[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5e3531[_0x0c30('0x41')][_0x0c30('0x47')]);_0x2dd15b['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x5e3531[_0x0c30('0x41')],_0x2af0c4['filters']));_0x2dd15b[_0x0c30('0x48')][_0x0c30('0x61')]=_0x29e181['id'];if(_0x5e3531['query'][_0x0c30('0x4a')]){_0x2dd15b[_0x0c30('0x48')]=_['merge'](_0x2dd15b[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x2dd15b[_0x0c30('0x43')],function(_0x4af1e4){var _0x53bf01={};_0x53bf01[_0x4af1e4]={'$like':'%'+_0x5e3531['query'][_0x0c30('0x4a')]+'%'};return _0x53bf01;})});}if(_0x5e3531['query'][_0x0c30('0xa1')]){var _0x37f5d1=_0x5e3531[_0x0c30('0x41')][_0x0c30('0xa1')]['split'](',');var _0x3ce9b3={};_0x3ce9b3[_0x37f5d1[0x0]]={'$gte':moment(_0x37f5d1[0x1])[_0x0c30('0xa2')](_0x0c30('0xa3'))};_0x2dd15b[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x2dd15b[_0x0c30('0x48')],_0x3ce9b3);}_0x2dd15b=_[_0x0c30('0x4b')]({},_0x2dd15b,_0x5e3531[_0x0c30('0x55')]);return db[_0x0c30('0xa4')][_0x0c30('0x2c')]({'where':_0x2dd15b[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x265642){_0x5bf596[_0x0c30('0x2c')]=_0x265642;if(_0x5e3531[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x2dd15b[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0xa4')]['findAll'](_0x2dd15b);})[_0x0c30('0x33')](function(_0x35f7e2){_0x5bf596[_0x0c30('0x4f')]=_0x35f7e2;return _0x5bf596;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x4ec451,_0x2dd15b))[_0x0c30('0x25')](handleError(_0x4ec451,null));};exports[_0x0c30('0x38')]=function(_0x284776,_0x19872d,_0x606565){var _0x47b433,_0x17f8f3={},_0x2e3479;if(_0x284776['body']['to']){_0x2e3479=_0x284776['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x284776[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0xa5')],'as':_0x0c30('0xa6'),'include':[{'model':db[_0x0c30('0x70')],'as':_0x0c30('0xa7'),'where':{'fax':_0x2e3479},'limit':0x1,'order':[['updatedAt',_0x0c30('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x19872d,null))[_0x0c30('0x33')](function(_0x467902){_0x47b433=_0x467902;if(_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')]&&_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x0c30('0x54')]){for(var _0x279b86=0x0;_0x279b86<_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x0c30('0x54')];_0x279b86+=0x1){_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]={'filename':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86][_0x0c30('0x37')],'id':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]['id'],'path':path[_0x0c30('0xaa')](config[_0x0c30('0xab')],_0x0c30('0xac'),_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]['basename'])};}}return respondWithRpcPromise(_0x0c30('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0x0c30('0xae')](_0x284776['params']['id'])?undefined:_0x284776[_0x0c30('0x51')]['id'],'path':_[_0x0c30('0xae')](_0x284776['body'][_0x0c30('0xa9')][0x0]['path'])?undefined:_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xaf')],'fax':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x58')]['to'][0x0])?undefined:_0x284776[_0x0c30('0x58')]['to'][0x0]},client9002);})[_0x0c30('0x33')](function(){if(_0x47b433){if(_['isNil'](_0x284776[_0x0c30('0x58')]['from'])){_0x284776[_0x0c30('0x58')][_0x0c30('0xb0')]=util[_0x0c30('0xa2')](_0x0c30('0xb1'),_0x47b433[_0x0c30('0x37')],_0x47b433[_0x0c30('0xb2')]);}if(_0x47b433[_0x0c30('0xa6')]){if(_0x47b433[_0x0c30('0xa6')]['Contacts'][_0x0c30('0x54')]){return _0x47b433['List'][_0x0c30('0xa7')][0x0];}else{return db['CmContact'][_0x0c30('0x57')](_[_0x0c30('0x16')](_0x284776['body'],{'firstName':_0x284776[_0x0c30('0x58')]['to'][0x0],'phone':_0x284776[_0x0c30('0x58')]['to'][0x0],'fax':_0x284776['body']['to'][0x0],'ListId':_0x47b433[_0x0c30('0x9e')]}));}}else{throw new Error(_0x0c30('0xb3'));}}else{throw new Error(_0x0c30('0xb4'));}})[_0x0c30('0x33')](function(_0x44b12b){if(_0x44b12b){return db[_0x0c30('0x6e')]['find']({'where':{'ContactId':_0x44b12b['id'],'closed':![],'FaxAccountId':_0x47b433['id']}})[_0x0c30('0x33')](function(_0x392018){if(_0x392018){return[_0x392018,![]];}return db[_0x0c30('0x6e')]['create']({'UserId':_0x284776[_0x0c30('0x5a')]['id'],'ContactId':_0x44b12b['id'],'FaxAccountId':_0x47b433['id'],'fax':_0x284776[_0x0c30('0x58')]['to'][0x0],'firstMsgDirection':_0x0c30('0xb5'),'Messages':[_['merge'](_0x284776['body'],{'read':![],'body':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0][_0x0c30('0xb6')],'FaxAccountId':_0x47b433['id'],'UserId':_0x284776[_0x0c30('0x5a')]['id'],'ContactId':_0x44b12b['id'],'AttachmentId':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x0c30('0xa4')],'as':'Messages'}]})[_0x0c30('0x33')](function(_0x567158){return[_0x567158,!![]];});});}else{throw new Error(_0x0c30('0xb7'));}})[_0x0c30('0xb8')](function(_0x44605b,_0x1bdb6f){if(_0x1bdb6f){return _0x44605b;}return db[_0x0c30('0xa4')][_0x0c30('0x57')]({'direction':'out','read':![],'body':_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xb6')],'FaxAccountId':_0x47b433['id'],'FaxInteractionId':_0x44605b['id'],'UserId':_0x284776['user']['id'],'ContactId':_0x44605b[_0x0c30('0xb9')],'AttachmentId':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0]['id']})['then'](function(_0x4e94a4){_0x44605b[_0x0c30('0xba')]['Messages']=[];_0x44605b[_0x0c30('0xba')][_0x0c30('0xbb')][_0x0c30('0x8b')](_0x4e94a4[_0x0c30('0xba')]);return _0x44605b;});})[_0x0c30('0x33')](function(_0x2906a3){respondWithRpcPromise('SendFax',_0x0c30('0xbc'),{'FaxAccountId':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x51')]['id'])?undefined:_0x284776[_0x0c30('0x51')]['id'],'path':_[_0x0c30('0xae')](_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xaf')])?undefined:_0x284776['body']['attachments'][0x0][_0x0c30('0xaf')],'fax':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x58')]['to'][0x0])?undefined:_0x284776[_0x0c30('0x58')]['to'][0x0],'AttachmentId':_0x284776[_0x0c30('0x58')]['attachments'][0x0]['id']},client9002)[_0x0c30('0x33')](function(_0x1ebed3){logger[_0x0c30('0x1b')]('SendFaxRpc,\x20%s',_0x1ebed3);})[_0x0c30('0x25')](function(_0x102ee5){logger['info']('SendFaxRpc,\x20%s',_0x102ee5);});return _0x2906a3;})['then'](respondWithResult(_0x19872d,null))[_0x0c30('0x25')](handleError(_0x19872d,null));};exports['addAgents']=function(_0x40cb26,_0x76152,_0xba7dc6){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x40cb26['params']['id']}})['then'](handleEntityNotFound(_0x76152,null))[_0x0c30('0x33')](function(_0x344ed7){if(_0x344ed7){return _0x344ed7[_0x0c30('0xbd')](_0x40cb26['body'][_0x0c30('0x68')],_['omit'](_0x40cb26['body'],[_0x0c30('0x68'),'id'])||{})[_0x0c30('0xb8')](function(_0x530a64){for(var _0x5642bb=0x0;_0x5642bb<_0x40cb26[_0x0c30('0x58')][_0x0c30('0x68')][_0x0c30('0x54')];_0x5642bb+=0x1){socket[_0x0c30('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x40cb26[_0x0c30('0x58')][_0x0c30('0x68')][_0x5642bb]),'FaxAccountId':Number(_0x40cb26[_0x0c30('0x51')]['id'])});}return _0x530a64;});}})[_0x0c30('0x33')](respondWithResult(_0x76152,null))['catch'](handleError(_0x76152,null));};exports[_0x0c30('0xbf')]=function(_0x1a3631,_0x2f7a7a,_0x5f1967){return db['FaxAccount'][_0x0c30('0x56')]({'where':{'id':_0x1a3631['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x2f7a7a,null))['then'](function(_0x31c40f){if(_0x31c40f){return _0x31c40f[_0x0c30('0xbf')](_0x1a3631[_0x0c30('0x41')]['ids'])['then'](function(){if(_[_0x0c30('0xc0')](_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')])){for(var _0x5225a2=0x0;_0x5225a2<_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')][_0x0c30('0x54')];_0x5225a2+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')][_0x5225a2]),'FaxAccountId':Number(_0x1a3631[_0x0c30('0x51')]['id'])});}}else{socket[_0x0c30('0xbe')](_0x0c30('0xc1'),{'UserId':Number(_0x1a3631['query'][_0x0c30('0x68')]),'FaxAccountId':Number(_0x1a3631[_0x0c30('0x51')]['id'])});}});}})[_0x0c30('0x33')](respondWithStatusCode(_0x2f7a7a,null))[_0x0c30('0x25')](handleError(_0x2f7a7a,null));};exports[_0x0c30('0xc2')]=function(_0x2d539f,_0x1bd89c,_0x2c7dc5){var _0x52e282={};var _0x2c047a={};var _0x334d01;var _0x2cc7e9;return db[_0x0c30('0x3c')]['findOne']({'where':{'id':_0x2d539f[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x1bd89c,null))[_0x0c30('0x33')](function(_0x409c8a){if(_0x409c8a){_0x334d01=_0x409c8a;_0x2c047a[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x72')][_0x0c30('0x3d')]);_0x2c047a['query']=_['keys'](_0x2d539f[_0x0c30('0x41')]);_0x2c047a['filters']=_[_0x0c30('0x53')](_0x2c047a['model'],_0x2c047a[_0x0c30('0x41')]);_0x52e282[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x2c047a[_0x0c30('0x40')],qs['fields'](_0x2d539f[_0x0c30('0x41')]['fields']));_0x52e282[_0x0c30('0x43')]=_0x52e282['attributes'][_0x0c30('0x54')]?_0x52e282[_0x0c30('0x43')]:_0x2c047a[_0x0c30('0x40')];_0x52e282[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x2d539f[_0x0c30('0x41')][_0x0c30('0x47')]);_0x52e282['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x2d539f[_0x0c30('0x41')],_0x2c047a[_0x0c30('0x49')]));if(_0x2d539f[_0x0c30('0x41')][_0x0c30('0x4a')]){_0x52e282[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x52e282[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x52e282['attributes'],function(_0x770345){var _0x782cfd={};_0x782cfd[_0x770345]={'$like':'%'+_0x2d539f[_0x0c30('0x41')][_0x0c30('0x4a')]+'%'};return _0x782cfd;})});}_0x52e282=_[_0x0c30('0x4b')]({},_0x52e282,_0x2d539f[_0x0c30('0x55')]);return _0x334d01[_0x0c30('0xc2')](_0x52e282);}})['then'](function(_0x5bafc8){if(_0x5bafc8){_0x2cc7e9=_0x5bafc8[_0x0c30('0x54')];if(!_0x2d539f[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x52e282[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x2d539f[_0x0c30('0x41')]['limit']);_0x52e282['offset']=qs[_0x0c30('0x2a')](_0x2d539f[_0x0c30('0x41')][_0x0c30('0x2a')]);}return _0x334d01[_0x0c30('0xc2')](_0x52e282);}})[_0x0c30('0x33')](function(_0x344e55){if(_0x344e55){return _0x344e55?{'count':_0x2cc7e9,'rows':_0x344e55}:null;}})['then'](respondWithResult(_0x1bd89c,null))['catch'](handleError(_0x1bd89c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8f381ba..d4c9f51 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 _0x40e5=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x567d9a,_0x5cadbe){var _0xec85eb=function(_0x455b46){while(--_0x455b46){_0x567d9a['push'](_0x567d9a['shift']());}};_0xec85eb(++_0x5cadbe);}(_0x40e5,0x1d5));var _0x540e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x40e5[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x540e('0x0'));var FaxAccount=require(_0x540e('0x1'))['db'][_0x540e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x540e('0x3')](0x0);var events={'afterCreate':_0x540e('0x4'),'afterUpdate':_0x540e('0x5'),'afterDestroy':_0x540e('0x6')};function emitEvent(_0x5c5f3a){return function(_0x264ce3,_0x300f68,_0x4231f9){FaxAccountEvents[_0x540e('0x7')](_0x5c5f3a+':'+_0x264ce3['id'],_0x264ce3);FaxAccountEvents[_0x540e('0x7')](_0x5c5f3a,_0x264ce3);_0x4231f9(null);};}for(var e in events){if(events[_0x540e('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x540e('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x6b9d=['events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46f332,_0x3b3f89){var _0x1bda08=function(_0x3d5ef4){while(--_0x3d5ef4){_0x46f332['push'](_0x46f332['shift']());}};_0x1bda08(++_0x3b3f89);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x6b9d[_0x3b6652];return _0x14d39f;};'use strict';var EventEmitter=require(_0xd6b9('0x0'));var FaxAccount=require(_0xd6b9('0x1'))['db'][_0xd6b9('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd6b9('0x3')](0x0);var events={'afterCreate':_0xd6b9('0x4'),'afterUpdate':_0xd6b9('0x5'),'afterDestroy':_0xd6b9('0x6')};function emitEvent(_0x2bcb33){return function(_0x3370ad,_0x2a32e1,_0x55dfd6){FaxAccountEvents[_0xd6b9('0x7')](_0x2bcb33+':'+_0x3370ad['id'],_0x3370ad);FaxAccountEvents[_0xd6b9('0x7')](_0x2bcb33,_0x3370ad);_0x55dfd6(null);};}for(var e in events){if(events[_0xd6b9('0x8')](e)){var event=events[e];FaxAccount[_0xd6b9('0x9')](e,emitEvent(event));}}module[_0xd6b9('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2dcf1fd..7c36913 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 _0x9cb6=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','lodash','util','../../config/logger','api','moment'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x9cb6,0x74));var _0x69cb=function(_0x2cb121,_0x3077af){_0x2cb121=_0x2cb121-0x0;var _0x2baa2c=_0x9cb6[_0x2cb121];return _0x2baa2c;};'use strict';var _=require(_0x69cb('0x0'));var util=require(_0x69cb('0x1'));var logger=require(_0x69cb('0x2'))(_0x69cb('0x3'));var moment=require(_0x69cb('0x4'));var BPromise=require('bluebird');var rp=require(_0x69cb('0x5'));var fs=require('fs');var path=require(_0x69cb('0x6'));var rimraf=require(_0x69cb('0x7'));var config=require(_0x69cb('0x8'));var attributes=require(_0x69cb('0x9'));module[_0x69cb('0xa')]=function(_0x4bf044,_0x154220){return _0x4bf044['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6827=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','moment','bluebird'];(function(_0x22f1fd,_0x11d9c3){var _0xfab9b0=function(_0x5af290){while(--_0x5af290){_0x22f1fd['push'](_0x22f1fd['shift']());}};_0xfab9b0(++_0x11d9c3);}(_0x6827,0x11b));var _0x7682=function(_0x4fab6b,_0x505180){_0x4fab6b=_0x4fab6b-0x0;var _0x2564f0=_0x6827[_0x4fab6b];return _0x2564f0;};'use strict';var _=require(_0x7682('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7682('0x1'));var BPromise=require(_0x7682('0x2'));var rp=require(_0x7682('0x3'));var fs=require('fs');var path=require(_0x7682('0x4'));var rimraf=require(_0x7682('0x5'));var config=require(_0x7682('0x6'));var attributes=require(_0x7682('0x7'));module[_0x7682('0x8')]=function(_0x50738a,_0x4b4081){return _0x50738a[_0x7682('0x9')]('FaxAccount',attributes,{'tableName':_0x7682('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 898efd4..5427349 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 _0x543d=['User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','debug','NotifyFaxAccount','body','fax','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','CmContact','Contacts','DESC','Applications','List','applications','list','priority','asc','length','create','contact','FaxInteraction','get','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','interaction'];(function(_0x2dc21c,_0x4b168d){var _0xe534e8=function(_0x3cd70c){while(--_0x3cd70c){_0x2dc21c['push'](_0x2dc21c['shift']());}};_0xe534e8(++_0x4b168d);}(_0x543d,0x1bf));var _0xd543=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0x543d[_0x90e575];return _0x1aae60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd543('0x0'));var BPromise=require(_0xd543('0x1'));var rs=require(_0xd543('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd543('0x3'))['db'];var utils=require(_0xd543('0x4'));var logger=require(_0xd543('0x5'))(_0xd543('0x6'));var config=require(_0xd543('0x7'));var jayson=require(_0xd543('0x8'));var client=jayson[_0xd543('0x9')][_0xd543('0xa')]({'port':0x232c});config[_0xd543('0xb')]=_[_0xd543('0xc')](config['redis'],{'host':_0xd543('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd543('0xb')]));require('./faxAccount.socket')[_0xd543('0xe')](socket);function respondWithRpcPromise(_0x54a508,_0x34762d,_0x499b74){return new BPromise(function(_0x506cde,_0x62a71){return client['request'](_0x54a508,_0x499b74)[_0xd543('0xf')](function(_0x3162b4){logger['info'](_0xd543('0x10'),_0x34762d,'request\x20sent');logger['debug'](_0xd543('0x11'),_0x34762d,_0xd543('0x12'),JSON[_0xd543('0x13')](_0x3162b4));if(_0x3162b4[_0xd543('0x14')]){if(_0x3162b4['error'][_0xd543('0x15')]===0x1f4){logger[_0xd543('0x14')](_0xd543('0x10'),_0x34762d,_0x3162b4['error'][_0xd543('0x16')]);return _0x62a71(_0x3162b4[_0xd543('0x14')][_0xd543('0x16')]);}logger[_0xd543('0x14')](_0xd543('0x10'),_0x34762d,_0x3162b4[_0xd543('0x14')][_0xd543('0x16')]);return _0x506cde(_0x3162b4[_0xd543('0x14')]['message']);}else{logger[_0xd543('0x17')](_0xd543('0x10'),_0x34762d,_0xd543('0x12'));_0x506cde(_0x3162b4[_0xd543('0x18')][_0xd543('0x16')]);}})[_0xd543('0x19')](function(_0x1e7b7b){logger[_0xd543('0x14')]('FaxAccount,\x20%s,\x20%s',_0x34762d,_0x1e7b7b);_0x62a71(_0x1e7b7b);});});}exports[_0xd543('0x1a')]=function(_0x40db09){var _0x5970d0=this;return new Promise(function(_0x625a1f,_0x1eae10){return db[_0xd543('0x1b')]['findAll']({'raw':_0x40db09[_0xd543('0x1c')]?_0x40db09[_0xd543('0x1c')][_0xd543('0x1d')]===undefined?!![]:![]:!![],'where':_0x40db09[_0xd543('0x1c')]?_0x40db09[_0xd543('0x1c')][_0xd543('0x1e')]||null:null,'attributes':_0x40db09[_0xd543('0x1c')]?_0x40db09[_0xd543('0x1c')]['attributes']||null:null,'limit':_0x40db09[_0xd543('0x1c')]?_0x40db09['options'][_0xd543('0x1f')]||null:null,'include':_0x40db09[_0xd543('0x1c')]?_0x40db09['options'][_0xd543('0x20')]?_[_0xd543('0x21')](_0x40db09[_0xd543('0x1c')]['include'],function(_0xc30b75){return{'model':db[_0xc30b75[_0xd543('0x22')]],'as':_0xc30b75['as'],'attributes':_0xc30b75[_0xd543('0x23')],'include':_0xc30b75[_0xd543('0x20')]?_[_0xd543('0x21')](_0xc30b75[_0xd543('0x20')],function(_0x4f37eb){return{'model':db[_0x4f37eb['model']],'as':_0x4f37eb['as'],'attributes':_0x4f37eb[_0xd543('0x23')],'include':_0x4f37eb[_0xd543('0x20')]?_[_0xd543('0x21')](_0x4f37eb[_0xd543('0x20')],function(_0x4cb984){return{'model':db[_0x4cb984[_0xd543('0x22')]],'as':_0x4cb984['as'],'attributes':_0x4cb984[_0xd543('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd543('0xf')](function(_0x3a4b0e){logger[_0xd543('0x17')](_0xd543('0x1a'),_0x40db09);logger[_0xd543('0x24')](_0xd543('0x1a'),_0x40db09,JSON[_0xd543('0x13')](_0x3a4b0e));_0x625a1f(_0x3a4b0e);})['catch'](function(_0x3761f2){logger[_0xd543('0x14')]('GetFaxAccount',_0x3761f2[_0xd543('0x16')],_0x40db09);_0x1eae10(_0x5970d0[_0xd543('0x14')](0x1f4,_0x3761f2['message']));});});};exports[_0xd543('0x25')]=function(_0x392327,_0x46200d,_0x1d0f5a){var _0x34b6ee=this;return new Promise(function(_0x455423,_0x1e27f7){var _0x25361f={'body':_0x392327[_0xd543('0x26')],'channel':_0xd543('0x27')};var _0x2e1df1=[];var _0x2d7681=[];var _0x526603={};return db['CmContact'][_0xd543('0x28')]()[_0xd543('0xf')](function(_0xa362ca){if(!_0xa362ca){throw new db['Sequelize'][(_0xd543('0x29'))](_0xd543('0x2a'));}_0x2e1df1=_[_0xd543('0x2b')](_['keys'](_0xa362ca),[_0xd543('0x2c'),_0xd543('0x2d')]);_0x2d7681=_['difference'](_['keys'](_0xa362ca),[_0xd543('0x2c'),_0xd543('0x2d'),_0xd543('0x2e'),_0xd543('0x2f')]);if(_0x392327[_0xd543('0x26')]['id']){delete _0x392327[_0xd543('0x26')]['id'];}if(_[_0xd543('0x30')](_0x392327[_0xd543('0x26')]['from'])){throw new db[(_0xd543('0x31'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x392327[_0xd543('0x26')][_0xd543('0x26')])||_0x392327['body'][_0xd543('0x26')]===''){throw new db[(_0xd543('0x31'))][(_0xd543('0x29'))](_0xd543('0x32'));}if(_[_0xd543('0x30')](_0x392327[_0xd543('0x26')][_0xd543('0x33')])){throw new db[(_0xd543('0x31'))][(_0xd543('0x29'))](_0xd543('0x34')+_0x2d7681);}if(!_[_0xd543('0x35')](_0x2d7681,_0x392327['body'][_0xd543('0x33')])){throw new db[(_0xd543('0x31'))][(_0xd543('0x29'))](_0xd543('0x36')+_0x2d7681);}_0x526603[_0x392327[_0xd543('0x26')][_0xd543('0x33')]]=_0x392327[_0xd543('0x26')][_0xd543('0x37')];})['then'](function(){return db[_0xd543('0x1b')][_0xd543('0x38')]({'where':{'id':_0x392327[_0xd543('0x39')]['id']},'include':[{'model':db[_0xd543('0x3a')],'as':'List','include':[{'model':db[_0xd543('0x3b')],'as':_0xd543('0x3c'),'where':_0x526603,'limit':0x1,'order':[['updatedAt',_0xd543('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0xd543('0x3e')}]});})[_0xd543('0xf')](function(_0x2c598c){if(_0x2c598c&&_0x2c598c[_0xd543('0x3f')]){var _0x188174=_0x2c598c['get']({'plain':!![]});_0x25361f['account']=_0x188174;_0x25361f[_0xd543('0x40')]=_0x188174[_0xd543('0x3e')];_0x25361f[_0xd543('0x41')]=_0x188174[_0xd543('0x3f')];_0x25361f[_0xd543('0x40')]=_['orderBy'](_0x25361f[_0xd543('0x40')],[_0xd543('0x42')],[_0xd543('0x43')]);if(_0x25361f[_0xd543('0x39')][_0xd543('0x3e')]){delete _0x25361f[_0xd543('0x39')][_0xd543('0x3e')];}if(_0x25361f[_0xd543('0x39')][_0xd543('0x3f')]&&_0x25361f[_0xd543('0x39')]['List'][_0xd543('0x3c')][_0xd543('0x44')]){return _0x25361f[_0xd543('0x39')]['List']['Contacts'][0x0];}var _0x2fc757=_['defaults'](_0x392327[_0xd543('0x26')],{'firstName':_0x392327[_0xd543('0x26')][_0xd543('0x37')],'ListId':_0x188174[_0xd543('0x2f')]});_0x2fc757[_0x392327[_0xd543('0x26')][_0xd543('0x33')]]=_0x392327[_0xd543('0x26')]['from'];return db[_0xd543('0x3b')][_0xd543('0x45')](_0x2fc757,{'fields':_0x2e1df1,'raw':!![]});}})[_0xd543('0xf')](function(_0x24e4a5){_0x25361f[_0xd543('0x46')]=_0x24e4a5;if(_0x24e4a5){var _0x2a11b5={'ContactId':_0x24e4a5['id'],'FaxAccountId':_0x392327[_0xd543('0x39')]['id'],'fax':_0x24e4a5[_0xd543('0x27')]};return db['FaxInteraction'][_0xd543('0x38')]({'where':{'ContactId':_0x24e4a5['id'],'closed':![],'FaxAccountId':_0x392327[_0xd543('0x39')]['id']}})[_0xd543('0xf')](function(_0x4e3c80){if(_0x4e3c80){return[_0x4e3c80,![]];}return db[_0xd543('0x47')][_0xd543('0x45')](_0x2a11b5)[_0xd543('0xf')](function(_0x6854b1){return[_0x6854b1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x48e897,_0x4a4f6e){var _0x304f49=_0x48e897[_0xd543('0x48')]({'plain':!![]});if(_0x4a4f6e){if(_0x25361f[_0xd543('0x39')][_0xd543('0x49')]){_0x25361f[_0xd543('0x40')][_0xd543('0x4a')]({'id':0x0,'priority':_0x25361f['applications'][_0xd543('0x44')]+0x1,'app':_0xd543('0x4b'),'appdata':_0xd543('0x4c'),'interval':_0xd543('0x4d')});}_0x304f49[_0xd543('0x4e')]=!![];}else{_0x304f49[_0xd543('0x4e')]=![];}_0x25361f['interaction']=_0x304f49;return db[_0xd543('0x4f')][_0xd543('0x45')]({'body':_0x392327[_0xd543('0x26')][_0xd543('0x26')],'FaxAccountId':_0x392327['account']['id'],'FaxInteractionId':_0x48e897['id'],'direction':'in','ContactId':_0x48e897['ContactId'],'AttachmentId':_0x392327['body']['AttachmentId']});})['then'](function(_0x4c0f9a){_0x25361f['message']=_0x4c0f9a;if(_0x25361f[_0xd543('0x50')]['UserId']){return db[_0xd543('0x51')][_0xd543('0x38')]({'attributes':['id','name'],'where':{'id':_0x25361f['interaction']['UserId']}})[_0xd543('0xf')](function(_0x56c078){if(_0x56c078){_0x25361f['applications'][_0xd543('0x52')]({'id':0x0,'priority':0x0,'app':_0xd543('0x53'),'appdata':_0x56c078[_0xd543('0x54')]+','+(_0x25361f['account'][_0xd543('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd543('0x56'),'startRouting',_0x25361f);});}return respondWithRpcPromise('Start',_0xd543('0x57'),_0x25361f);})[_0xd543('0xf')](function(_0xf7fe79){_0x455423(_0xf7fe79);})[_0xd543('0x19')](function(_0x31f539){_0x1e27f7(_0x34b6ee[_0xd543('0x14')](0x1f4,_0x31f539[_0xd543('0x16')]));});});}; \ No newline at end of file +var _0x2b3e=['isNil','from','Sequelize','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','push','unmanaged','created','FaxMessage','ContactId','AttachmentId','User','interaction','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','difference','createdAt','updatedAt','keys','CompanyId','ListId'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x2b3e,0x7d));var _0xe2b3=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2b3e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe2b3('0x0'));var util=require(_0xe2b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe2b3('0x2'));var fs=require('fs');var Redis=require(_0xe2b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2b3('0x4'));var logger=require(_0xe2b3('0x5'))(_0xe2b3('0x6'));var config=require(_0xe2b3('0x7'));var jayson=require(_0xe2b3('0x8'));var client=jayson['client'][_0xe2b3('0x9')]({'port':0x232c});config['redis']=_[_0xe2b3('0xa')](config[_0xe2b3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2b3('0xc'))(new Redis(config['redis']));require(_0xe2b3('0xd'))[_0xe2b3('0xe')](socket);function respondWithRpcPromise(_0x194824,_0xfaddc7,_0x1cfed3){return new BPromise(function(_0x265510,_0xd2155c){return client[_0xe2b3('0xf')](_0x194824,_0x1cfed3)[_0xe2b3('0x10')](function(_0x3bd5b4){logger[_0xe2b3('0x11')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,'request\x20sent');logger[_0xe2b3('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xfaddc7,_0xe2b3('0x13'),JSON[_0xe2b3('0x14')](_0x3bd5b4));if(_0x3bd5b4[_0xe2b3('0x15')]){if(_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x16')]===0x1f4){logger[_0xe2b3('0x15')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,_0x3bd5b4['error'][_0xe2b3('0x17')]);return _0xd2155c(_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x17')]);}logger['error'](_0xe2b3('0x18'),_0xfaddc7,_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x17')]);return _0x265510(_0x3bd5b4[_0xe2b3('0x15')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0xfaddc7,'request\x20sent');_0x265510(_0x3bd5b4[_0xe2b3('0x19')]['message']);}})[_0xe2b3('0x1a')](function(_0x13aa32){logger[_0xe2b3('0x15')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,_0x13aa32);_0xd2155c(_0x13aa32);});});}exports[_0xe2b3('0x1b')]=function(_0x2809bb){var _0x2d7f4d=this;return new Promise(function(_0x50c339,_0x4660a4){return db['FaxAccount'][_0xe2b3('0x1c')]({'raw':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x1e')]===undefined?!![]:![]:!![],'where':_0x2809bb['options']?_0x2809bb[_0xe2b3('0x1d')]['where']||null:null,'attributes':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x1f')]||null:null,'limit':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x20')]||null:null,'include':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb['options']['include']?_['map'](_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x21')],function(_0x795b8b){return{'model':db[_0x795b8b[_0xe2b3('0x22')]],'as':_0x795b8b['as'],'attributes':_0x795b8b[_0xe2b3('0x1f')],'include':_0x795b8b[_0xe2b3('0x21')]?_['map'](_0x795b8b[_0xe2b3('0x21')],function(_0x5e4906){return{'model':db[_0x5e4906['model']],'as':_0x5e4906['as'],'attributes':_0x5e4906[_0xe2b3('0x1f')],'include':_0x5e4906['include']?_[_0xe2b3('0x23')](_0x5e4906[_0xe2b3('0x21')],function(_0x2d6b64){return{'model':db[_0x2d6b64[_0xe2b3('0x22')]],'as':_0x2d6b64['as'],'attributes':_0x2d6b64[_0xe2b3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe2b3('0x10')](function(_0x390db4){logger['info']('GetFaxAccount',_0x2809bb);logger[_0xe2b3('0x12')](_0xe2b3('0x1b'),_0x2809bb,JSON['stringify'](_0x390db4));_0x50c339(_0x390db4);})['catch'](function(_0x1eb89b){logger[_0xe2b3('0x15')](_0xe2b3('0x1b'),_0x1eb89b[_0xe2b3('0x17')],_0x2809bb);_0x4660a4(_0x2d7f4d['error'](0x1f4,_0x1eb89b[_0xe2b3('0x17')]));});});};exports[_0xe2b3('0x24')]=function(_0x271f59,_0x2a06e4,_0x11edb9){var _0x388e16=this;return new Promise(function(_0x4f63a4,_0x168a19){var _0x235938={'body':_0x271f59[_0xe2b3('0x25')],'channel':_0xe2b3('0x26')};var _0x581405=[];var _0x491968=[];var _0x3bcb72={};return db[_0xe2b3('0x27')][_0xe2b3('0x28')]()['then'](function(_0x2e3004){if(!_0x2e3004){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x581405=_[_0xe2b3('0x29')](_['keys'](_0x2e3004),[_0xe2b3('0x2a'),_0xe2b3('0x2b')]);_0x491968=_['difference'](_[_0xe2b3('0x2c')](_0x2e3004),[_0xe2b3('0x2a'),_0xe2b3('0x2b'),_0xe2b3('0x2d'),_0xe2b3('0x2e')]);if(_0x271f59[_0xe2b3('0x25')]['id']){delete _0x271f59[_0xe2b3('0x25')]['id'];}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')])){throw new db[(_0xe2b3('0x31'))][(_0xe2b3('0x32'))]('from\x20is\x20mandatory');}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x25')])||_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x25')]===''){throw new db[(_0xe2b3('0x31'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')]['mapKey'])){throw new db[(_0xe2b3('0x31'))][(_0xe2b3('0x32'))](_0xe2b3('0x33')+_0x491968);}if(!_[_0xe2b3('0x34')](_0x491968,_0x271f59[_0xe2b3('0x25')]['mapKey'])){throw new db['Sequelize'][(_0xe2b3('0x32'))](_0xe2b3('0x35')+_0x491968);}_0x3bcb72[_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x36')]]=_0x271f59['body'][_0xe2b3('0x30')];})[_0xe2b3('0x10')](function(){return db['FaxAccount'][_0xe2b3('0x37')]({'where':{'id':_0x271f59[_0xe2b3('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0xe2b3('0x39'),'include':[{'model':db['CmContact'],'as':_0xe2b3('0x3a'),'where':_0x3bcb72,'limit':0x1,'order':[[_0xe2b3('0x2b'),_0xe2b3('0x3b')]]}]},{'model':db[_0xe2b3('0x3c')],'as':_0xe2b3('0x3d')}]});})[_0xe2b3('0x10')](function(_0x2e212b){if(_0x2e212b&&_0x2e212b['List']){var _0x712c74=_0x2e212b[_0xe2b3('0x3e')]({'plain':!![]});_0x235938['account']=_0x712c74;_0x235938[_0xe2b3('0x3f')]=_0x712c74[_0xe2b3('0x3d')];_0x235938[_0xe2b3('0x40')]=_0x712c74[_0xe2b3('0x39')];_0x235938[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](_0x235938[_0xe2b3('0x3f')],['priority'],[_0xe2b3('0x42')]);if(_0x235938['account'][_0xe2b3('0x3d')]){delete _0x235938[_0xe2b3('0x38')][_0xe2b3('0x3d')];}if(_0x235938[_0xe2b3('0x38')][_0xe2b3('0x39')]&&_0x235938[_0xe2b3('0x38')][_0xe2b3('0x39')][_0xe2b3('0x3a')][_0xe2b3('0x43')]){return _0x235938[_0xe2b3('0x38')]['List'][_0xe2b3('0x3a')][0x0];}var _0x2a2ceb=_['defaults'](_0x271f59[_0xe2b3('0x25')],{'firstName':_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')],'ListId':_0x712c74['ListId']});_0x2a2ceb[_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x36')]]=_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')];return db[_0xe2b3('0x27')][_0xe2b3('0x44')](_0x2a2ceb,{'fields':_0x581405,'raw':!![]});}})[_0xe2b3('0x10')](function(_0xb5e75c){_0x235938[_0xe2b3('0x45')]=_0xb5e75c;if(_0xb5e75c){var _0x2f17f6={'ContactId':_0xb5e75c['id'],'FaxAccountId':_0x271f59['account']['id'],'fax':_0xb5e75c[_0xe2b3('0x26')]};return db[_0xe2b3('0x46')]['find']({'where':{'ContactId':_0xb5e75c['id'],'closed':![],'FaxAccountId':_0x271f59[_0xe2b3('0x38')]['id']}})['then'](function(_0x5255f6){if(_0x5255f6){return[_0x5255f6,![]];}return db[_0xe2b3('0x46')][_0xe2b3('0x44')](_0x2f17f6)['then'](function(_0xa8c03f){return[_0xa8c03f,!![]];});});}else{throw new Error(_0xe2b3('0x47'));}})['spread'](function(_0x3d22bf,_0x41479a){var _0x15a99c=_0x3d22bf['get']({'plain':!![]});if(_0x41479a){if(_0x235938[_0xe2b3('0x38')]['autoclose']){_0x235938['applications'][_0xe2b3('0x48')]({'id':0x0,'priority':_0x235938[_0xe2b3('0x3f')]['length']+0x1,'app':'close','appdata':_0xe2b3('0x49'),'interval':'*,*,*,*'});}_0x15a99c[_0xe2b3('0x4a')]=!![];}else{_0x15a99c[_0xe2b3('0x4a')]=![];}_0x235938['interaction']=_0x15a99c;return db[_0xe2b3('0x4b')][_0xe2b3('0x44')]({'body':_0x271f59[_0xe2b3('0x25')]['body'],'FaxAccountId':_0x271f59[_0xe2b3('0x38')]['id'],'FaxInteractionId':_0x3d22bf['id'],'direction':'in','ContactId':_0x3d22bf[_0xe2b3('0x4c')],'AttachmentId':_0x271f59['body'][_0xe2b3('0x4d')]});})[_0xe2b3('0x10')](function(_0x19415a){_0x235938[_0xe2b3('0x17')]=_0x19415a;if(_0x235938['interaction']['UserId']){return db[_0xe2b3('0x4e')][_0xe2b3('0x37')]({'attributes':['id','name'],'where':{'id':_0x235938[_0xe2b3('0x4f')][_0xe2b3('0x50')]}})[_0xe2b3('0x10')](function(_0x3bd469){if(_0x3bd469){_0x235938['applications'][_0xe2b3('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3bd469[_0xe2b3('0x52')]+','+(_0x235938[_0xe2b3('0x38')][_0xe2b3('0x53')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe2b3('0x54'),'startRouting',_0x235938);});}return respondWithRpcPromise(_0xe2b3('0x54'),_0xe2b3('0x55'),_0x235938);})[_0xe2b3('0x10')](function(_0x3287d8){_0x4f63a4(_0x3287d8);})[_0xe2b3('0x1a')](function(_0x4f8bf5){_0x168a19(_0x388e16['error'](0x1f4,_0x4f8bf5[_0xe2b3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 410d1a0..1379e9b 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 _0x2146=['register','faxAccount:','./faxAccount.events','remove','update','emit','removeListener'];(function(_0x43a564,_0xba1329){var _0x4880cb=function(_0x8915ee){while(--_0x8915ee){_0x43a564['push'](_0x43a564['shift']());}};_0x4880cb(++_0xba1329);}(_0x2146,0x1d0));var _0x6214=function(_0x27352e,_0x1f472e){_0x27352e=_0x27352e-0x0;var _0x2958c4=_0x2146[_0x27352e];return _0x2958c4;};'use strict';var FaxAccountEvents=require(_0x6214('0x0'));var events=['save',_0x6214('0x1'),_0x6214('0x2')];function createListener(_0x366787,_0x1101c5){return function(_0x1868e3){_0x1101c5[_0x6214('0x3')](_0x366787,_0x1868e3);};}function removeListener(_0x5c75a3,_0x4a24ff){return function(){FaxAccountEvents[_0x6214('0x4')](_0x5c75a3,_0x4a24ff);};}exports[_0x6214('0x5')]=function(_0x1a3115){for(var _0x44e867=0x0,_0x4f8d2a=events['length'];_0x44e867<_0x4f8d2a;_0x44e867++){var _0x46a0e2=events[_0x44e867];var _0x8e5eef=createListener(_0x6214('0x6')+_0x46a0e2,_0x1a3115);FaxAccountEvents['on'](_0x46a0e2,_0x8e5eef);}}; \ No newline at end of file +var _0x0019=['removeListener','register','length','faxAccount:','./faxAccount.events','save','emit'];(function(_0x17efa9,_0x47b593){var _0x39b5df=function(_0x2af3ab){while(--_0x2af3ab){_0x17efa9['push'](_0x17efa9['shift']());}};_0x39b5df(++_0x47b593);}(_0x0019,0xeb));var _0x9001=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x0019[_0x3a2a3c];return _0x50ac9a;};'use strict';var FaxAccountEvents=require(_0x9001('0x0'));var events=[_0x9001('0x1'),'remove','update'];function createListener(_0x479698,_0xd03fd3){return function(_0x4d6594){_0xd03fd3[_0x9001('0x2')](_0x479698,_0x4d6594);};}function removeListener(_0xd9ca16,_0x2fe071){return function(){FaxAccountEvents[_0x9001('0x3')](_0xd9ca16,_0x2fe071);};}exports[_0x9001('0x4')]=function(_0x5979fc){for(var _0x33335e=0x0,_0x344acf=events[_0x9001('0x5')];_0x33335e<_0x344acf;_0x33335e++){var _0x175629=events[_0x33335e];var _0x4a1c28=createListener(_0x9001('0x6')+_0x175629,_0x5979fc);FaxAccountEvents['on'](_0x175629,_0x4a1c28);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0fe0951..46fe549 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(_0x4d0422,_0x2bfbab){var _0xd93cb7=function(_0x26c94b){while(--_0x26c94b){_0x4d0422['push'](_0x4d0422['shift']());}};_0xd93cb7(++_0x2bfbab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x4b4b33,_0x58c677){var _0x274e29=function(_0x144d15){while(--_0x144d15){_0x4b4b33['push'](_0x4b4b33['shift']());}};_0x274e29(++_0x58c677);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 2dc43ab..ca1a90a 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 _0xbdf4=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5a6cb1,_0x62c061){var _0x2a1fa9=function(_0x3d7550){while(--_0x3d7550){_0x5a6cb1['push'](_0x5a6cb1['shift']());}};_0x2a1fa9(++_0x62c061);}(_0xbdf4,0xa4));var _0x4bdf=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xbdf4[_0x31ced5];return _0x10d9e5;};'use strict';var Sequelize=require(_0x4bdf('0x0'));module[_0x4bdf('0x1')]={'priority':{'type':Sequelize[_0x4bdf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4bdf('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4bdf('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4bdf('0x5')}}; \ No newline at end of file +var _0x5054=['TEXT','STRING','exports','INTEGER'];(function(_0x14cd66,_0x584878){var _0x312de1=function(_0xdb72b7){while(--_0xdb72b7){_0x14cd66['push'](_0x14cd66['shift']());}};_0x312de1(++_0x584878);}(_0x5054,0xa6));var _0x4505=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5054[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x4505('0x0')]={'priority':{'type':Sequelize[_0x4505('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4505('0x2')]()},'description':{'type':Sequelize[_0x4505('0x3')]},'interval':{'type':Sequelize[_0x4505('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d6e94dc..a094e28 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 _0x071c=['merge','VIRTUAL','options','includeAll','rows','show','rawAttributes','include','find','create','body','catch','update','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','FaxApplication','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x071c,0xe3));var _0xc071=function(_0x333e9b,_0x24b81e){_0x333e9b=_0x333e9b-0x0;var _0x4b37f9=_0x071c[_0x333e9b];return _0x4b37f9;};'use strict';var emlformat=require(_0xc071('0x0'));var rimraf=require(_0xc071('0x1'));var zipdir=require(_0xc071('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc071('0x3'));var moment=require(_0xc071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc071('0x5'));var util=require(_0xc071('0x6'));var path=require(_0xc071('0x7'));var sox=require('sox');var csv=require(_0xc071('0x8'));var ejs=require(_0xc071('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc071('0xa'));var squel=require(_0xc071('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc071('0xc'));var toCsv=require(_0xc071('0x8'));var querystring=require('querystring');var Papa=require(_0xc071('0xd'));var Redis=require(_0xc071('0xe'));var authService=require(_0xc071('0xf'));var qs=require(_0xc071('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc071('0x11'));var logger=require(_0xc071('0x12'))(_0xc071('0x13'));var utils=require('../../config/utils');var config=require(_0xc071('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc071('0x15'))['db'];function respondWithStatusCode(_0x39f83e,_0x1664fb){_0x1664fb=_0x1664fb||0xcc;return function(_0x27e020){if(_0x27e020){return _0x39f83e['sendStatus'](_0x1664fb);}return _0x39f83e[_0xc071('0x16')](_0x1664fb)[_0xc071('0x17')]();};}function respondWithResult(_0x6a530b,_0x196588){_0x196588=_0x196588||0xc8;return function(_0x108ba0){if(_0x108ba0){return _0x6a530b['status'](_0x196588)[_0xc071('0x18')](_0x108ba0);}};}function respondWithFilteredResult(_0x3ee27a,_0xc00188){return function(_0x12b7c1){if(_0x12b7c1){var _0x21db64=typeof _0xc00188[_0xc071('0x19')]===_0xc071('0x1a')&&typeof _0xc00188[_0xc071('0x1b')]===_0xc071('0x1a');var _0x567f25=_0x12b7c1[_0xc071('0x1c')];var _0x1937bd=_0x21db64?0x0:_0xc00188[_0xc071('0x19')];var _0x219a60=_0x21db64?_0x12b7c1[_0xc071('0x1c')]:_0xc00188[_0xc071('0x19')]+_0xc00188['limit'];var _0x4e618d;if(_0x219a60>=_0x567f25){_0x219a60=_0x567f25;_0x4e618d=0xc8;}else{_0x4e618d=0xce;}_0x3ee27a[_0xc071('0x16')](_0x4e618d);return _0x3ee27a[_0xc071('0x1d')](_0xc071('0x1e'),_0x1937bd+'-'+_0x219a60+'/'+_0x567f25)[_0xc071('0x18')](_0x12b7c1);}return null;};}function patchUpdates(_0x231ebd){return function(_0x4abf17){try{jsonpatch[_0xc071('0x1f')](_0x4abf17,_0x231ebd,!![]);}catch(_0x55239d){return BPromise[_0xc071('0x20')](_0x55239d);}return _0x4abf17[_0xc071('0x21')]();};}function saveUpdates(_0x3f0e36,_0x235d80){return function(_0x188e51){if(_0x188e51){return _0x188e51['update'](_0x3f0e36)[_0xc071('0x22')](function(_0x3b8c11){return _0x3b8c11;});}return null;};}function removeEntity(_0x2cbae3,_0x5092d2){return function(_0xdca1db){if(_0xdca1db){return _0xdca1db[_0xc071('0x23')]()['then'](function(){_0x2cbae3[_0xc071('0x16')](0xcc)[_0xc071('0x17')]();});}};}function handleEntityNotFound(_0x42cd61,_0x1e73b5){return function(_0x11409e){if(!_0x11409e){_0x42cd61[_0xc071('0x24')](0x194);}return _0x11409e;};}function handleError(_0x4cae7b,_0x101f6d){_0x101f6d=_0x101f6d||0x1f4;return function(_0x83d61d){logger[_0xc071('0x25')](_0x83d61d['stack']);if(_0x83d61d[_0xc071('0x26')]){delete _0x83d61d[_0xc071('0x26')];}_0x4cae7b[_0xc071('0x16')](_0x101f6d)['send'](_0x83d61d);};}exports[_0xc071('0x27')]=function(_0x112e0e,_0x564bf2){var _0x54d25c={},_0x1f779f={},_0x35aa54={'count':0x0,'rows':[]};var _0x1d887e=_[_0xc071('0x28')](db[_0xc071('0x29')]['rawAttributes'],function(_0x8d6754){return{'name':_0x8d6754['fieldName'],'type':_0x8d6754[_0xc071('0x2a')][_0xc071('0x2b')]};});_0x1f779f[_0xc071('0x2c')]=_[_0xc071('0x28')](_0x1d887e,_0xc071('0x26'));_0x1f779f[_0xc071('0x2d')]=_[_0xc071('0x2e')](_0x112e0e[_0xc071('0x2d')]);_0x1f779f['filters']=_['intersection'](_0x1f779f['model'],_0x1f779f[_0xc071('0x2d')]);_0x54d25c['attributes']=_[_0xc071('0x2f')](_0x1f779f[_0xc071('0x2c')],qs['fields'](_0x112e0e[_0xc071('0x2d')][_0xc071('0x30')]));_0x54d25c[_0xc071('0x31')]=_0x54d25c[_0xc071('0x31')][_0xc071('0x32')]?_0x54d25c[_0xc071('0x31')]:_0x1f779f['model'];if(!_0x112e0e['query'][_0xc071('0x33')](_0xc071('0x34'))){_0x54d25c[_0xc071('0x1b')]=qs[_0xc071('0x1b')](_0x112e0e[_0xc071('0x2d')][_0xc071('0x1b')]);_0x54d25c[_0xc071('0x19')]=qs[_0xc071('0x19')](_0x112e0e[_0xc071('0x2d')][_0xc071('0x19')]);}_0x54d25c[_0xc071('0x35')]=qs['sort'](_0x112e0e['query'][_0xc071('0x36')]);_0x54d25c[_0xc071('0x37')]=qs[_0xc071('0x38')](_['pick'](_0x112e0e[_0xc071('0x2d')],_0x1f779f[_0xc071('0x38')]),_0x1d887e);if(_0x112e0e[_0xc071('0x2d')]['filter']){_0x54d25c[_0xc071('0x37')]=_[_0xc071('0x39')](_0x54d25c[_0xc071('0x37')],{'$or':_['map'](_0x1d887e,function(_0x1e2bba){if(_0x1e2bba[_0xc071('0x2a')]!==_0xc071('0x3a')){var _0x1d86ba={};_0x1d86ba[_0x1e2bba[_0xc071('0x26')]]={'$like':'%'+_0x112e0e['query']['filter']+'%'};return _0x1d86ba;}})});}_0x54d25c=_[_0xc071('0x39')]({},_0x54d25c,_0x112e0e[_0xc071('0x3b')]);var _0x26bde3={'where':_0x54d25c[_0xc071('0x37')]};return db[_0xc071('0x29')][_0xc071('0x1c')](_0x26bde3)['then'](function(_0x15175f){_0x35aa54[_0xc071('0x1c')]=_0x15175f;if(_0x112e0e[_0xc071('0x2d')][_0xc071('0x3c')]){_0x54d25c['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x54d25c);})[_0xc071('0x22')](function(_0x13ec50){_0x35aa54[_0xc071('0x3d')]=_0x13ec50;return _0x35aa54;})[_0xc071('0x22')](respondWithFilteredResult(_0x564bf2,_0x54d25c))['catch'](handleError(_0x564bf2,null));};exports[_0xc071('0x3e')]=function(_0x2e7751,_0x506fb4){var _0x1790b4={'raw':!![],'where':{'id':_0x2e7751['params']['id']}},_0x157150={};_0x157150[_0xc071('0x2c')]=_['keys'](db[_0xc071('0x29')][_0xc071('0x3f')]);_0x157150[_0xc071('0x2d')]=_[_0xc071('0x2e')](_0x2e7751[_0xc071('0x2d')]);_0x157150[_0xc071('0x38')]=_[_0xc071('0x2f')](_0x157150[_0xc071('0x2c')],_0x157150[_0xc071('0x2d')]);_0x1790b4[_0xc071('0x31')]=_['intersection'](_0x157150[_0xc071('0x2c')],qs[_0xc071('0x30')](_0x2e7751[_0xc071('0x2d')]['fields']));_0x1790b4[_0xc071('0x31')]=_0x1790b4[_0xc071('0x31')][_0xc071('0x32')]?_0x1790b4[_0xc071('0x31')]:_0x157150['model'];if(_0x2e7751[_0xc071('0x2d')][_0xc071('0x3c')]){_0x1790b4[_0xc071('0x40')]=[{'all':!![]}];}_0x1790b4=_[_0xc071('0x39')]({},_0x1790b4,_0x2e7751['options']);return db[_0xc071('0x29')][_0xc071('0x41')](_0x1790b4)[_0xc071('0x22')](handleEntityNotFound(_0x506fb4,null))[_0xc071('0x22')](respondWithResult(_0x506fb4,null))['catch'](handleError(_0x506fb4,null));};exports['create']=function(_0x2b86ea,_0x419318){return db[_0xc071('0x29')][_0xc071('0x42')](_0x2b86ea[_0xc071('0x43')],{})[_0xc071('0x22')](respondWithResult(_0x419318,0xc9))[_0xc071('0x44')](handleError(_0x419318,null));};exports[_0xc071('0x45')]=function(_0x42042d,_0x5b6dbe){if(_0x42042d[_0xc071('0x43')]['id']){delete _0x42042d['body']['id'];}return db['FaxApplication'][_0xc071('0x41')]({'where':{'id':_0x42042d[_0xc071('0x46')]['id']}})[_0xc071('0x22')](handleEntityNotFound(_0x5b6dbe,null))[_0xc071('0x22')](saveUpdates(_0x42042d[_0xc071('0x43')],null))[_0xc071('0x22')](respondWithResult(_0x5b6dbe,null))[_0xc071('0x44')](handleError(_0x5b6dbe,null));};exports[_0xc071('0x23')]=function(_0x17f66f,_0x59981b){return db['FaxApplication'][_0xc071('0x41')]({'where':{'id':_0x17f66f[_0xc071('0x46')]['id']}})[_0xc071('0x22')](handleEntityNotFound(_0x59981b,null))[_0xc071('0x22')](removeEntity(_0x59981b,null))[_0xc071('0x44')](handleError(_0x59981b,null));}; \ No newline at end of file +var _0x4fbb=['fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','then','include','catch','show','params','keys','includeAll','find','body','eml-format','zip-dir'];(function(_0x41c62a,_0x292d69){var _0x2af078=function(_0x445bab){while(--_0x445bab){_0x41c62a['push'](_0x41c62a['shift']());}};_0x2af078(++_0x292d69);}(_0x4fbb,0x8c));var _0xb4fb=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x4fbb[_0x2d2498];return _0x447a5b;};'use strict';var emlformat=require(_0xb4fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4fb('0x1'));var jsonpatch=require(_0xb4fb('0x2'));var rp=require(_0xb4fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb4fb('0x4'));var path=require(_0xb4fb('0x5'));var sox=require(_0xb4fb('0x6'));var csv=require(_0xb4fb('0x7'));var ejs=require(_0xb4fb('0x8'));var fs=require('fs');var fs_extra=require(_0xb4fb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb4fb('0xa'));var jsforce=require(_0xb4fb('0xb'));var deskjs=require(_0xb4fb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb4fb('0xd'));var Papa=require(_0xb4fb('0xe'));var Redis=require(_0xb4fb('0xf'));var authService=require(_0xb4fb('0x10'));var qs=require(_0xb4fb('0x11'));var as=require(_0xb4fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4fb('0x13'))(_0xb4fb('0x14'));var utils=require(_0xb4fb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a9811,_0x54db0e){_0x54db0e=_0x54db0e||0xcc;return function(_0xb2e757){if(_0xb2e757){return _0x5a9811[_0xb4fb('0x16')](_0x54db0e);}return _0x5a9811[_0xb4fb('0x17')](_0x54db0e)[_0xb4fb('0x18')]();};}function respondWithResult(_0x5321be,_0x5c6613){_0x5c6613=_0x5c6613||0xc8;return function(_0x8c6f02){if(_0x8c6f02){return _0x5321be[_0xb4fb('0x17')](_0x5c6613)[_0xb4fb('0x19')](_0x8c6f02);}};}function respondWithFilteredResult(_0x3bf8f4,_0x3ce32d){return function(_0x2f9b49){if(_0x2f9b49){var _0x1247ae=typeof _0x3ce32d[_0xb4fb('0x1a')]===_0xb4fb('0x1b')&&typeof _0x3ce32d[_0xb4fb('0x1c')]==='undefined';var _0x33b221=_0x2f9b49['count'];var _0x488ad3=_0x1247ae?0x0:_0x3ce32d[_0xb4fb('0x1a')];var _0x206351=_0x1247ae?_0x2f9b49[_0xb4fb('0x1d')]:_0x3ce32d[_0xb4fb('0x1a')]+_0x3ce32d[_0xb4fb('0x1c')];var _0x5e322d;if(_0x206351>=_0x33b221){_0x206351=_0x33b221;_0x5e322d=0xc8;}else{_0x5e322d=0xce;}_0x3bf8f4[_0xb4fb('0x17')](_0x5e322d);return _0x3bf8f4[_0xb4fb('0x1e')](_0xb4fb('0x1f'),_0x488ad3+'-'+_0x206351+'/'+_0x33b221)[_0xb4fb('0x19')](_0x2f9b49);}return null;};}function patchUpdates(_0x5a15a2){return function(_0x1e1c51){try{jsonpatch[_0xb4fb('0x20')](_0x1e1c51,_0x5a15a2,!![]);}catch(_0x180a20){return BPromise['reject'](_0x180a20);}return _0x1e1c51[_0xb4fb('0x21')]();};}function saveUpdates(_0x1c7d57,_0x8080f){return function(_0x26270f){if(_0x26270f){return _0x26270f[_0xb4fb('0x22')](_0x1c7d57)['then'](function(_0x2a8d65){return _0x2a8d65;});}return null;};}function removeEntity(_0x4c023c,_0x32bfb9){return function(_0x2f5466){if(_0x2f5466){return _0x2f5466[_0xb4fb('0x23')]()['then'](function(){_0x4c023c[_0xb4fb('0x17')](0xcc)[_0xb4fb('0x18')]();});}};}function handleEntityNotFound(_0x363762,_0x322b67){return function(_0x321950){if(!_0x321950){_0x363762[_0xb4fb('0x16')](0x194);}return _0x321950;};}function handleError(_0x48fb55,_0xa71b7c){_0xa71b7c=_0xa71b7c||0x1f4;return function(_0x333f3d){logger[_0xb4fb('0x24')](_0x333f3d[_0xb4fb('0x25')]);if(_0x333f3d[_0xb4fb('0x26')]){delete _0x333f3d[_0xb4fb('0x26')];}_0x48fb55['status'](_0xa71b7c)[_0xb4fb('0x27')](_0x333f3d);};}exports[_0xb4fb('0x28')]=function(_0x535bc6,_0x204c6f){var _0x5e58c0={},_0x3ca4ba={},_0x5d37a0={'count':0x0,'rows':[]};var _0x140691=_[_0xb4fb('0x29')](db[_0xb4fb('0x2a')][_0xb4fb('0x2b')],function(_0x397695){return{'name':_0x397695[_0xb4fb('0x2c')],'type':_0x397695[_0xb4fb('0x2d')]['key']};});_0x3ca4ba[_0xb4fb('0x2e')]=_['map'](_0x140691,'name');_0x3ca4ba['query']=_['keys'](_0x535bc6[_0xb4fb('0x2f')]);_0x3ca4ba[_0xb4fb('0x30')]=_[_0xb4fb('0x31')](_0x3ca4ba[_0xb4fb('0x2e')],_0x3ca4ba[_0xb4fb('0x2f')]);_0x5e58c0[_0xb4fb('0x32')]=_['intersection'](_0x3ca4ba['model'],qs[_0xb4fb('0x33')](_0x535bc6[_0xb4fb('0x2f')][_0xb4fb('0x33')]));_0x5e58c0[_0xb4fb('0x32')]=_0x5e58c0[_0xb4fb('0x32')][_0xb4fb('0x34')]?_0x5e58c0['attributes']:_0x3ca4ba['model'];if(!_0x535bc6[_0xb4fb('0x2f')][_0xb4fb('0x35')](_0xb4fb('0x36'))){_0x5e58c0['limit']=qs[_0xb4fb('0x1c')](_0x535bc6['query'][_0xb4fb('0x1c')]);_0x5e58c0[_0xb4fb('0x1a')]=qs['offset'](_0x535bc6[_0xb4fb('0x2f')]['offset']);}_0x5e58c0['order']=qs['sort'](_0x535bc6['query'][_0xb4fb('0x37')]);_0x5e58c0[_0xb4fb('0x38')]=qs['filters'](_[_0xb4fb('0x39')](_0x535bc6[_0xb4fb('0x2f')],_0x3ca4ba[_0xb4fb('0x30')]),_0x140691);if(_0x535bc6['query']['filter']){_0x5e58c0['where']=_['merge'](_0x5e58c0['where'],{'$or':_[_0xb4fb('0x29')](_0x140691,function(_0x138c4f){if(_0x138c4f['type']!==_0xb4fb('0x3a')){var _0x2786c3={};_0x2786c3[_0x138c4f[_0xb4fb('0x26')]]={'$like':'%'+_0x535bc6['query'][_0xb4fb('0x3b')]+'%'};return _0x2786c3;}})});}_0x5e58c0=_[_0xb4fb('0x3c')]({},_0x5e58c0,_0x535bc6[_0xb4fb('0x3d')]);var _0x222bc6={'where':_0x5e58c0[_0xb4fb('0x38')]};return db[_0xb4fb('0x2a')][_0xb4fb('0x1d')](_0x222bc6)[_0xb4fb('0x3e')](function(_0x265c72){_0x5d37a0['count']=_0x265c72;if(_0x535bc6[_0xb4fb('0x2f')]['includeAll']){_0x5e58c0[_0xb4fb('0x3f')]=[{'all':!![]}];}return db[_0xb4fb('0x2a')]['findAll'](_0x5e58c0);})[_0xb4fb('0x3e')](function(_0x1aa41c){_0x5d37a0['rows']=_0x1aa41c;return _0x5d37a0;})[_0xb4fb('0x3e')](respondWithFilteredResult(_0x204c6f,_0x5e58c0))[_0xb4fb('0x40')](handleError(_0x204c6f,null));};exports[_0xb4fb('0x41')]=function(_0x3f4fc3,_0x445dfb){var _0x5f0295={'raw':!![],'where':{'id':_0x3f4fc3[_0xb4fb('0x42')]['id']}},_0x31da3e={};_0x31da3e['model']=_['keys'](db[_0xb4fb('0x2a')][_0xb4fb('0x2b')]);_0x31da3e[_0xb4fb('0x2f')]=_[_0xb4fb('0x43')](_0x3f4fc3[_0xb4fb('0x2f')]);_0x31da3e['filters']=_[_0xb4fb('0x31')](_0x31da3e[_0xb4fb('0x2e')],_0x31da3e[_0xb4fb('0x2f')]);_0x5f0295['attributes']=_[_0xb4fb('0x31')](_0x31da3e[_0xb4fb('0x2e')],qs[_0xb4fb('0x33')](_0x3f4fc3['query'][_0xb4fb('0x33')]));_0x5f0295['attributes']=_0x5f0295[_0xb4fb('0x32')][_0xb4fb('0x34')]?_0x5f0295[_0xb4fb('0x32')]:_0x31da3e[_0xb4fb('0x2e')];if(_0x3f4fc3[_0xb4fb('0x2f')][_0xb4fb('0x44')]){_0x5f0295[_0xb4fb('0x3f')]=[{'all':!![]}];}_0x5f0295=_[_0xb4fb('0x3c')]({},_0x5f0295,_0x3f4fc3['options']);return db[_0xb4fb('0x2a')][_0xb4fb('0x45')](_0x5f0295)[_0xb4fb('0x3e')](handleEntityNotFound(_0x445dfb,null))[_0xb4fb('0x3e')](respondWithResult(_0x445dfb,null))[_0xb4fb('0x40')](handleError(_0x445dfb,null));};exports['create']=function(_0x5cc232,_0x5a5b4c){return db['FaxApplication']['create'](_0x5cc232[_0xb4fb('0x46')],{})[_0xb4fb('0x3e')](respondWithResult(_0x5a5b4c,0xc9))[_0xb4fb('0x40')](handleError(_0x5a5b4c,null));};exports[_0xb4fb('0x22')]=function(_0x5a465d,_0x35ae52){if(_0x5a465d[_0xb4fb('0x46')]['id']){delete _0x5a465d['body']['id'];}return db['FaxApplication'][_0xb4fb('0x45')]({'where':{'id':_0x5a465d[_0xb4fb('0x42')]['id']}})[_0xb4fb('0x3e')](handleEntityNotFound(_0x35ae52,null))[_0xb4fb('0x3e')](saveUpdates(_0x5a465d[_0xb4fb('0x46')],null))[_0xb4fb('0x3e')](respondWithResult(_0x35ae52,null))[_0xb4fb('0x40')](handleError(_0x35ae52,null));};exports[_0xb4fb('0x23')]=function(_0x136e19,_0x43e2d5){return db['FaxApplication']['find']({'where':{'id':_0x136e19['params']['id']}})[_0xb4fb('0x3e')](handleEntityNotFound(_0x43e2d5,null))['then'](removeEntity(_0x43e2d5,null))[_0xb4fb('0x40')](handleError(_0x43e2d5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 572d56b..bf4b9ab 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 _0xb08a=['exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2c889c,_0x5b76e3){var _0x4bc884=function(_0xf21acd){while(--_0xf21acd){_0x2c889c['push'](_0x2c889c['shift']());}};_0x4bc884(++_0x5b76e3);}(_0xb08a,0x64));var _0xab08=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xb08a[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0xab08('0x0'));var util=require('util');var logger=require(_0xab08('0x1'))(_0xab08('0x2'));var moment=require(_0xab08('0x3'));var BPromise=require('bluebird');var rp=require(_0xab08('0x4'));var fs=require('fs');var path=require(_0xab08('0x5'));var rimraf=require(_0xab08('0x6'));var config=require(_0xab08('0x7'));var attributes=require('./faxApplication.attributes');module[_0xab08('0x8')]=function(_0x2c5bfb,_0x4e7ff8){return _0x2c5bfb['define'](_0xab08('0x9'),attributes,{'tableName':_0xab08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xab08('0xb')});}; \ No newline at end of file +var _0x55c3=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','request-promise','path'];(function(_0x2e189c,_0x1cf07b){var _0x5bfc41=function(_0x302f76){while(--_0x302f76){_0x2e189c['push'](_0x2e189c['shift']());}};_0x5bfc41(++_0x1cf07b);}(_0x55c3,0x168));var _0x355c=function(_0x1d4bcc,_0x3d0692){_0x1d4bcc=_0x1d4bcc-0x0;var _0x3f00c6=_0x55c3[_0x1d4bcc];return _0x3f00c6;};'use strict';var _=require(_0x355c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x355c('0x1'));var fs=require('fs');var path=require(_0x355c('0x2'));var rimraf=require(_0x355c('0x3'));var config=require(_0x355c('0x4'));var attributes=require(_0x355c('0x5'));module[_0x355c('0x6')]=function(_0x16b1da,_0x2428c3){return _0x16b1da[_0x355c('0x7')](_0x355c('0x8'),attributes,{'tableName':_0x355c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x355c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 55f95f0..96e3161 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 _0xf784=['body','options','raw','where','attributes','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x2ea1d4,_0x34f914){var _0x53ddb7=function(_0x496e68){while(--_0x496e68){_0x2ea1d4['push'](_0x2ea1d4['shift']());}};_0x53ddb7(++_0x34f914);}(_0xf784,0x1b9));var _0x4f78=function(_0xd67da,_0x1e449c){_0xd67da=_0xd67da-0x0;var _0x4dfbbb=_0xf784[_0xd67da];return _0x4dfbbb;};'use strict';var _=require(_0x4f78('0x0'));var util=require('util');var moment=require(_0x4f78('0x1'));var BPromise=require(_0x4f78('0x2'));var rs=require(_0x4f78('0x3'));var fs=require('fs');var Redis=require(_0x4f78('0x4'));var db=require(_0x4f78('0x5'))['db'];var utils=require(_0x4f78('0x6'));var logger=require(_0x4f78('0x7'))('rpc');var config=require(_0x4f78('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f78('0x9')][_0x4f78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3120c4,_0x5ab6e6,_0xb64473){return new BPromise(function(_0x5f0ac1,_0x3e6624){return client[_0x4f78('0xb')](_0x3120c4,_0xb64473)[_0x4f78('0xc')](function(_0x2f1456){logger['info']('FaxApplication,\x20%s,\x20%s',_0x5ab6e6,_0x4f78('0xd'));logger['debug'](_0x4f78('0xe'),_0x5ab6e6,'request\x20sent',JSON['stringify'](_0x2f1456));if(_0x2f1456[_0x4f78('0xf')]){if(_0x2f1456[_0x4f78('0xf')]['code']===0x1f4){logger[_0x4f78('0xf')](_0x4f78('0x10'),_0x5ab6e6,_0x2f1456[_0x4f78('0xf')]['message']);return _0x3e6624(_0x2f1456[_0x4f78('0xf')]['message']);}logger[_0x4f78('0xf')](_0x4f78('0x10'),_0x5ab6e6,_0x2f1456[_0x4f78('0xf')][_0x4f78('0x11')]);return _0x5f0ac1(_0x2f1456[_0x4f78('0xf')][_0x4f78('0x11')]);}else{logger[_0x4f78('0x12')](_0x4f78('0x10'),_0x5ab6e6,'request\x20sent');_0x5f0ac1(_0x2f1456[_0x4f78('0x13')][_0x4f78('0x11')]);}})[_0x4f78('0x14')](function(_0x45cad3){logger['error'](_0x4f78('0x10'),_0x5ab6e6,_0x45cad3);_0x3e6624(_0x45cad3);});});}exports[_0x4f78('0x15')]=function(_0x67d3fb){var _0x3485de=this;return new Promise(function(_0x3690b7,_0x10b6bf){return db[_0x4f78('0x16')][_0x4f78('0x17')](_0x67d3fb[_0x4f78('0x18')],{'raw':_0x67d3fb[_0x4f78('0x19')]?_0x67d3fb[_0x4f78('0x19')][_0x4f78('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x67d3fb[_0x4f78('0x19')]?_0x67d3fb[_0x4f78('0x19')][_0x4f78('0x1b')]||null:null,'attributes':_0x67d3fb['options']?_0x67d3fb['options'][_0x4f78('0x1c')]||null:null,'limit':_0x67d3fb[_0x4f78('0x19')]?_0x67d3fb['options']['limit']||null:null})[_0x4f78('0xc')](function(_0x2937a0){logger['info'](_0x4f78('0x15'),_0x67d3fb);logger[_0x4f78('0x1d')]('UpdateFaxApplication',_0x67d3fb,JSON[_0x4f78('0x1e')](_0x2937a0));_0x3690b7(_0x2937a0);})[_0x4f78('0x14')](function(_0x1cc05a){logger['error'](_0x4f78('0x15'),_0x1cc05a[_0x4f78('0x11')],_0x67d3fb);_0x10b6bf(_0x3485de[_0x4f78('0xf')](0x1f4,_0x1cc05a['message']));});});}; \ No newline at end of file +var _0xf203=['lodash','util','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','catch','FaxApplication','options','raw','where','then','UpdateFaxApplication'];(function(_0x470d17,_0x32e508){var _0xd6558d=function(_0x23f372){while(--_0x23f372){_0x470d17['push'](_0x470d17['shift']());}};_0xd6558d(++_0x32e508);}(_0xf203,0x190));var _0x3f20=function(_0x1576ff,_0x1c8eab){_0x1576ff=_0x1576ff-0x0;var _0x4c2d70=_0xf203[_0x1576ff];return _0x4c2d70;};'use strict';var _=require(_0x3f20('0x0'));var util=require(_0x3f20('0x1'));var moment=require('moment');var BPromise=require(_0x3f20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f20('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3f20('0x5'));var client=jayson[_0x3f20('0x6')][_0x3f20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5128fa,_0x4b6890,_0xc63803){return new BPromise(function(_0x3df6e,_0x3e0cd0){return client[_0x3f20('0x8')](_0x5128fa,_0xc63803)['then'](function(_0x528c12){logger['info'](_0x3f20('0x9'),_0x4b6890,'request\x20sent');logger[_0x3f20('0xa')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4b6890,_0x3f20('0xb'),JSON[_0x3f20('0xc')](_0x528c12));if(_0x528c12['error']){if(_0x528c12['error'][_0x3f20('0xd')]===0x1f4){logger[_0x3f20('0xe')](_0x3f20('0x9'),_0x4b6890,_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);return _0x3e0cd0(_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b6890,_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);return _0x3df6e(_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);}else{logger[_0x3f20('0x10')]('FaxApplication,\x20%s,\x20%s',_0x4b6890,_0x3f20('0xb'));_0x3df6e(_0x528c12[_0x3f20('0x11')][_0x3f20('0xf')]);}})[_0x3f20('0x12')](function(_0x534220){logger['error'](_0x3f20('0x9'),_0x4b6890,_0x534220);_0x3e0cd0(_0x534220);});});}exports['UpdateFaxApplication']=function(_0x1041ef){var _0xe8821a=this;return new Promise(function(_0x5820a4,_0x31de2e){return db[_0x3f20('0x13')]['update'](_0x1041ef['body'],{'raw':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')][_0x3f20('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')][_0x3f20('0x16')]||null:null,'attributes':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')]['attributes']||null:null,'limit':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')]['limit']||null:null})[_0x3f20('0x17')](function(_0x431a1c){logger[_0x3f20('0x10')](_0x3f20('0x18'),_0x1041ef);logger[_0x3f20('0xa')](_0x3f20('0x18'),_0x1041ef,JSON['stringify'](_0x431a1c));_0x5820a4(_0x431a1c);})[_0x3f20('0x12')](function(_0x56d45b){logger['error'](_0x3f20('0x18'),_0x56d45b[_0x3f20('0xf')],_0x1041ef);_0x31de2e(_0xe8821a[_0x3f20('0xe')](0x1f4,_0x56d45b[_0x3f20('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index df43b8e..f9ca6ed 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 _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea28,0x13a));var _0x8ea2=function(_0x18c582,_0x1e202c){_0x18c582=_0x18c582-0x0;var _0x3a3057=_0xea28[_0x18c582];return _0x3a3057;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file +var _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x80ed,0x11c));var _0xd80e=function(_0x54c2fe,_0x2b2633){_0x54c2fe=_0x54c2fe-0x0;var _0xc6176e=_0x80ed[_0x54c2fe];return _0xc6176e;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('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 78cd482..b568f8f 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 _0x85d8=['sequelize','exports','DATE','STRING','out'];(function(_0x297c2e,_0x23167b){var _0x4580af=function(_0x4c1b37){while(--_0x4c1b37){_0x297c2e['push'](_0x297c2e['shift']());}};_0x4580af(++_0x23167b);}(_0x85d8,0x78));var _0x885d=function(_0x368cca,_0x402f38){_0x368cca=_0x368cca-0x0;var _0x17df41=_0x85d8[_0x368cca];return _0x17df41;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x885d('0x2')]},'disposition':{'type':Sequelize[_0x885d('0x3')]},'secondDisposition':{'type':Sequelize[_0x885d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x885d('0x3')]},'note':{'type':Sequelize[_0x885d('0x3')]},'read1stAt':{'type':Sequelize[_0x885d('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x885d('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x885d('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xefe5=['STRING','out','DATE','sequelize','exports','BOOLEAN'];(function(_0x2f36d2,_0x24285c){var _0x147f7f=function(_0x41db50){while(--_0x41db50){_0x2f36d2['push'](_0x2f36d2['shift']());}};_0x147f7f(++_0x24285c);}(_0xefe5,0xc9));var _0x5efe=function(_0x463a63,_0x58b4e0){_0x463a63=_0x463a63-0x0;var _0x4fa922=_0xefe5[_0x463a63];return _0x4fa922;};'use strict';var Sequelize=require(_0x5efe('0x0'));module[_0x5efe('0x1')]={'closed':{'type':Sequelize[_0x5efe('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5efe('0x3')]},'note':{'type':Sequelize[_0x5efe('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5efe('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5efe('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5efe('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 a4c01ec..8ad1845 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 _0x13f9=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','rows','params','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','existsSync','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','map','fullname','TagIds','Tags','forEach','catch','waiting','talking','answered','unmanaged','UserId','closed','total','index','FaxInteraction','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','u.id','u.fullname','ui.FaxInteractionId','from','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','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','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x13f9,0x128));var _0x913f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x13f9[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x913f('0x0'));var rimraf=require(_0x913f('0x1'));var zipdir=require(_0x913f('0x2'));var jsonpatch=require(_0x913f('0x3'));var rp=require(_0x913f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x913f('0x5'));var util=require(_0x913f('0x6'));var path=require(_0x913f('0x7'));var sox=require(_0x913f('0x8'));var csv=require(_0x913f('0x9'));var ejs=require(_0x913f('0xa'));var fs=require('fs');var fs_extra=require(_0x913f('0xb'));var _=require(_0x913f('0xc'));var squel=require(_0x913f('0xd'));var crypto=require(_0x913f('0xe'));var jsforce=require(_0x913f('0xf'));var deskjs=require(_0x913f('0x10'));var toCsv=require(_0x913f('0x9'));var querystring=require(_0x913f('0x11'));var Papa=require(_0x913f('0x12'));var Redis=require(_0x913f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x913f('0x14'));var as=require(_0x913f('0x15'));var hardwareService=require(_0x913f('0x16'));var logger=require(_0x913f('0x17'))('api');var utils=require(_0x913f('0x18'));var config=require(_0x913f('0x19'));var licenseUtil=require(_0x913f('0x1a'));var db=require(_0x913f('0x1b'))['db'];config['redis']=_[_0x913f('0x1c')](config[_0x913f('0x1d')],{'host':_0x913f('0x1e'),'port':0x18eb});var socket=require(_0x913f('0x1f'))(new Redis(config[_0x913f('0x1d')]));require(_0x913f('0x20'))[_0x913f('0x21')](socket);function respondWithStatusCode(_0xf39bd6,_0x47aabc){_0x47aabc=_0x47aabc||0xcc;return function(_0x4b65e6){if(_0x4b65e6){return _0xf39bd6[_0x913f('0x22')](_0x47aabc);}return _0xf39bd6[_0x913f('0x23')](_0x47aabc)[_0x913f('0x24')]();};}function respondWithResult(_0x290508,_0x439750){_0x439750=_0x439750||0xc8;return function(_0x5d5ea6){if(_0x5d5ea6){return _0x290508[_0x913f('0x23')](_0x439750)[_0x913f('0x25')](_0x5d5ea6);}};}function respondWithFilteredResult(_0x398713,_0x59d9e1){return function(_0x2b8bd8){if(_0x2b8bd8){var _0x3e3344=typeof _0x59d9e1[_0x913f('0x26')]===_0x913f('0x27')&&typeof _0x59d9e1[_0x913f('0x28')]===_0x913f('0x27');var _0x13710a=_0x2b8bd8[_0x913f('0x29')];var _0x4439f7=_0x3e3344?0x0:_0x59d9e1[_0x913f('0x26')];var _0x1354ea=_0x3e3344?_0x2b8bd8[_0x913f('0x29')]:_0x59d9e1[_0x913f('0x26')]+_0x59d9e1['limit'];var _0x513446;if(_0x1354ea>=_0x13710a){_0x1354ea=_0x13710a;_0x513446=0xc8;}else{_0x513446=0xce;}_0x398713[_0x913f('0x23')](_0x513446);return _0x398713[_0x913f('0x2a')](_0x913f('0x2b'),_0x4439f7+'-'+_0x1354ea+'/'+_0x13710a)[_0x913f('0x25')](_0x2b8bd8);}return null;};}function patchUpdates(_0x3cf5c5){return function(_0x14c87d){try{jsonpatch[_0x913f('0x2c')](_0x14c87d,_0x3cf5c5,!![]);}catch(_0x411705){return BPromise[_0x913f('0x2d')](_0x411705);}return _0x14c87d['save']();};}function saveUpdates(_0x16e7ce,_0x41c830){return function(_0x3e8b2d){if(_0x3e8b2d){return _0x3e8b2d[_0x913f('0x2e')](_0x16e7ce)[_0x913f('0x2f')](function(_0x199225){return _0x199225;});}return null;};}function removeEntity(_0x2f2940,_0x3eb5c){return function(_0x5d0c8c){if(_0x5d0c8c){return _0x5d0c8c['destroy']()['then'](function(){_0x2f2940['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0c7d,_0x29079f){return function(_0x5d12ee){if(!_0x5d12ee){_0x1d0c7d[_0x913f('0x22')](0x194);}return _0x5d12ee;};}function handleError(_0x4dbf47,_0x43278b){_0x43278b=_0x43278b||0x1f4;return function(_0x52c651){logger[_0x913f('0x30')](_0x52c651['stack']);if(_0x52c651[_0x913f('0x31')]){delete _0x52c651[_0x913f('0x31')];}_0x4dbf47['status'](_0x43278b)['send'](_0x52c651);};}function getInteractionUsers(_0x548372,_0x156b6f){return new BPromise(function(_0x43395c,_0x39435b){try{if(_0x156b6f[_0x548372['id']]){_0x548372['Users']=_[_0x913f('0x32')](_0x156b6f[_0x548372['id']],function(_0x553a59){return{'id':_0x553a59['id'],'fullname':_0x553a59[_0x913f('0x33')]};});}}catch(_0x5cd1d0){_0x39435b(_0x5cd1d0);}_0x43395c(_0x548372);});}function getInteractionTags(_0xa77fd9,_0x5cb486){return new BPromise(function(_0x4576d7,_0x1cf2ed){try{if(_0xa77fd9[_0x913f('0x34')]){_0xa77fd9[_0x913f('0x35')]=[];_0xa77fd9[_0x913f('0x34')]['split'](',')[_0x913f('0x36')](function(_0x232e5b){_0xa77fd9[_0x913f('0x35')]['push'](_0x5cb486[_0x232e5b]);});}delete _0xa77fd9[_0x913f('0x34')];}catch(_0x4fa7a4){_0x1cf2ed(_0x4fa7a4);}_0x4576d7(_0xa77fd9);});}function updateFaxInteraction(_0x5ca0e2,_0x5a3ac8,_0x5c7176){return new BPromise(function(_0x44eb17,_0x5191eb){return getInteractionUsers(_0x5ca0e2,_0x5c7176)[_0x913f('0x2f')](function(_0x11bda4){return getInteractionTags(_0x11bda4,_0x5a3ac8);})[_0x913f('0x2f')](function(_0x47214c){return getStateInteraction(_0x47214c);})[_0x913f('0x2f')](function(_0x23c5f1){_0x44eb17(_0x23c5f1);})[_0x913f('0x37')](function(_0xcd2305){_0x5191eb(_0xcd2305);});});}function getStateInteraction(_0x3aad73){return new BPromise(function(_0x17b685){_0x3aad73[_0x913f('0x38')]=0x0;_0x3aad73[_0x913f('0x39')]=0x0;_0x3aad73[_0x913f('0x3a')]=0x0;_0x3aad73[_0x913f('0x3b')]=0x0;_0x3aad73['total']=0x0;if(!_0x3aad73['closed']&&!_0x3aad73[_0x913f('0x3c')]){_0x3aad73[_0x913f('0x38')]+=0x1;}if(!_0x3aad73['closed']&&_0x3aad73[_0x913f('0x3c')]){_0x3aad73[_0x913f('0x39')]+=0x1;if(_0x3aad73[_0x913f('0x38')]){_0x3aad73['waiting']-=0x1;}}if(_0x3aad73[_0x913f('0x3d')]&&_0x3aad73[_0x913f('0x3c')]){_0x3aad73[_0x913f('0x3a')]+=0x1;if(_0x3aad73[_0x913f('0x39')]){_0x3aad73[_0x913f('0x39')]-=0x1;}}if(_0x3aad73[_0x913f('0x3d')]&&!_0x3aad73[_0x913f('0x3c')]){_0x3aad73[_0x913f('0x3b')]+=0x1;if(_0x3aad73['waiting']){_0x3aad73['waiting']-=0x1;}}_0x3aad73[_0x913f('0x3e')]+=0x1;_0x17b685(_0x3aad73);});}exports[_0x913f('0x3f')]=function(_0x3ef4aa,_0x59d1e0){var _0x3950bd={},_0x48368f={},_0x5a50b5={'count':0x0,'rows':[]};var _0x59161c=_['map'](db[_0x913f('0x40')][_0x913f('0x41')],function(_0x18834a){return{'name':_0x18834a['fieldName'],'type':_0x18834a[_0x913f('0x42')][_0x913f('0x43')]};});_0x48368f[_0x913f('0x44')]=_[_0x913f('0x32')](_0x59161c,'name');_0x48368f[_0x913f('0x45')]=_[_0x913f('0x46')](_0x3ef4aa[_0x913f('0x45')]);_0x48368f['filters']=_['intersection'](_0x48368f[_0x913f('0x44')],_0x48368f[_0x913f('0x45')]);_0x3950bd[_0x913f('0x47')]=_[_0x913f('0x48')](_0x48368f['model'],qs[_0x913f('0x49')](_0x3ef4aa[_0x913f('0x45')][_0x913f('0x49')]));_0x3950bd[_0x913f('0x47')]=_0x3950bd[_0x913f('0x47')]['length']?_0x3950bd[_0x913f('0x47')]:_0x48368f[_0x913f('0x44')];if(!_0x3ef4aa[_0x913f('0x45')][_0x913f('0x4a')](_0x913f('0x4b'))){_0x3950bd['limit']=qs['limit'](_0x3ef4aa[_0x913f('0x45')][_0x913f('0x28')]);_0x3950bd[_0x913f('0x26')]=qs['offset'](_0x3ef4aa[_0x913f('0x45')][_0x913f('0x26')]);}_0x3950bd[_0x913f('0x4c')]=qs[_0x913f('0x4d')](_0x3ef4aa[_0x913f('0x45')][_0x913f('0x4d')]);_0x3950bd[_0x913f('0x4e')]=qs[_0x913f('0x4f')](_[_0x913f('0x50')](_0x3ef4aa[_0x913f('0x45')],_0x48368f[_0x913f('0x4f')]),_0x59161c);var _0xc04099=[];var _0x3e5cd5=squel[_0x913f('0x51')]()[_0x913f('0x52')]('id')[_0x913f('0x52')](_0x913f('0x31'))[_0x913f('0x52')](_0x913f('0x53'))['from']('tools_tags');var _0x362ac1=squel[_0x913f('0x51')]()[_0x913f('0x52')](_0x913f('0x54'))[_0x913f('0x52')](_0x913f('0x55'))[_0x913f('0x52')](_0x913f('0x56'))[_0x913f('0x57')]('user_has_fax_interactions','ui')['left_join'](_0x913f('0x58'),'u',_0x913f('0x59'));var _0x29660b=squel['select']()['from']('fax_interactions','i')['left_join'](_0x913f('0x5a'),'c',_0x913f('0x5b'))[_0x913f('0x5c')](_0x913f('0x58'),'o',_0x913f('0x5d'))['left_join']('fax_accounts','a',_0x913f('0x5e'))[_0x913f('0x5c')](_0x913f('0x5f'),'me',_0x913f('0x60'))[_0x913f('0x5c')](_0x913f('0x61'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x913f('0x62'),'t',_0x913f('0x63'));var _0x33ae25=squel[_0x913f('0x64')]();var _0x4f697f=[];var _0xb3892c=squel[_0x913f('0x64')]();var _0x72bf97;if(_0x3ef4aa['query']['search']){_0x72bf97=as[_0x913f('0x65')](_0x3ef4aa['query']['search']);var _0x3ffe2e=_0x72bf97[_0x913f('0x66')];for(var _0x572761=0x0;_0x572761<_0x72bf97[_0x913f('0x67')][_0x913f('0x68')];_0x572761++){var _0x2c71bc=_0x72bf97[_0x913f('0x67')][_0x572761];var _0x103a1a='i';var _0x3bf353=_[_0x913f('0x69')](_0x59161c,[_0x913f('0x31'),_0x2c71bc[_0x913f('0x52')]]);if(!_0x3bf353){switch(_0x2c71bc[_0x913f('0x52')]){case _0x913f('0x6a'):if(_0x2c71bc['value']==0x1){_0x29660b[_0x913f('0x6b')]('`'+_0x2c71bc[_0x913f('0x52')]+_0x913f('0x6c'));}else{_0x29660b[_0x913f('0x6b')]('`'+_0x2c71bc[_0x913f('0x52')]+_0x913f('0x6d'));}break;case _0x913f('0x6e'):if(_0x2c71bc[_0x913f('0x6f')]===_0x913f('0x70')){if(_0x2c71bc[_0x913f('0x71')][_0x913f('0x72')]('\x20')['length']>0x1){_0x33ae25[_0x3ffe2e](_0x913f('0x73'),qs[_0x913f('0x74')](_0x2c71bc['value']),null);}else{var _0x188e71='%'+_0x2c71bc[_0x913f('0x71')]+'%';_0x33ae25[_0x3ffe2e](_0x913f('0x75'),_0x188e71,_0x188e71,_0x188e71);}}else{_0x3bf353=_[_0x913f('0x69')](_0x59161c,[_0x913f('0x31'),_0x913f('0x76')]);_0x2c71bc[_0x913f('0x52')]=_0x913f('0x76');_0x2535aa=as[_0x913f('0x77')](_0x103a1a,_0x3bf353[_0x913f('0x42')],_0x2c71bc);_0x33ae25[_0x3ffe2e](_0x2535aa[_0x913f('0x78')],_0x2535aa[_0x913f('0x71')][_0x913f('0x79')],_0x2535aa[_0x913f('0x71')]['end']);}break;case _0x913f('0x7a'):var _0x6b7252=_0x2c71bc[_0x913f('0x71')][_0x913f('0x72')](',')[_0x913f('0x32')](function(_0x5c3438){return Number(_0x5c3438);});_0x6b7252[_0x913f('0x36')](function(_0x3821c4){_0xb3892c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3821c4+',%');});_0x4f697f=_[_0x913f('0x7b')](_0x4f697f,_0x6b7252);break;case _0x913f('0x7c'):if(_0x2c71bc[_0x913f('0x6f')]===_0x913f('0x70')){_0x33ae25[_0x3ffe2e](_0x913f('0x7d'),'%'+_0x2c71bc['value']+'%',null);}else{_0x3bf353=_[_0x913f('0x69')](_0x59161c,[_0x913f('0x31'),_0x913f('0x3c')]);_0x2c71bc['field']=_0x913f('0x3c');_0x2535aa=as[_0x913f('0x77')](_0x103a1a,_0x3bf353[_0x913f('0x42')],_0x2c71bc);_0x33ae25[_0x3ffe2e](_0x2535aa[_0x913f('0x78')],_0x2535aa[_0x913f('0x71')][_0x913f('0x79')],_0x2535aa['value'][_0x913f('0x24')]);}break;case'body':_0x2535aa=as[_0x913f('0x77')]('me',null,_0x2c71bc);_0x33ae25[_0x3ffe2e](_0x2535aa['text'],_0x2535aa[_0x913f('0x71')]['start'],_0x2535aa[_0x913f('0x71')][_0x913f('0x24')]);break;}}else{var _0x2535aa=as[_0x913f('0x77')](_0x103a1a,_0x3bf353[_0x913f('0x42')],_0x2c71bc);_0x33ae25[_0x3ffe2e](_0x2535aa[_0x913f('0x78')],_0x2535aa[_0x913f('0x71')][_0x913f('0x79')],_0x2535aa[_0x913f('0x71')][_0x913f('0x24')]);}}}else{var _0xfeb876=_(_0x3ef4aa[_0x913f('0x45')])[_0x913f('0x46')]()[_0x913f('0x32')](function(_0x25f8fd){return _['some'](_0x59161c,[_0x913f('0x31'),_0x25f8fd])?_0x25f8fd:undefined;})['compact']()[_0x913f('0x71')]();if(!_[_0x913f('0x7e')](_0xfeb876)){_0xfeb876[_0x913f('0x36')](function(_0x4526c8){if(_0x4526c8===_0x913f('0x7f')){_0x29660b[_0x913f('0x4e')](_0x913f('0x80'),[][_0x913f('0x81')](_0x3ef4aa[_0x913f('0x45')][_0x4526c8]));}else if(_0x4526c8===_0x913f('0x82')){var _0x590952=JSON[_0x913f('0x83')](_0x3ef4aa[_0x913f('0x45')][_0x4526c8])['$gte'];var _0x3a5c3f=JSON[_0x913f('0x83')](_0x3ef4aa[_0x913f('0x45')][_0x4526c8])[_0x913f('0x84')];_0x29660b[_0x913f('0x4e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x590952,_0x3a5c3f);}else{if(_0x3ef4aa['query'][_0x4526c8]===_0x913f('0x85')){_0x29660b[_0x913f('0x4e')]('i.'+_0x4526c8+'\x20IS\x20NULL');}else{_0x29660b[_0x913f('0x4e')]('i.'+_0x4526c8+_0x913f('0x86'),_0x3ef4aa[_0x913f('0x45')][_0x4526c8]);}}});}if(_0x3ef4aa[_0x913f('0x45')][_0x913f('0x87')]){if(_0x3ef4aa[_0x913f('0x45')][_0x913f('0x87')]==0x1){_0x29660b[_0x913f('0x6b')](_0x913f('0x88'));}else{_0x29660b[_0x913f('0x6b')](_0x913f('0x89'));}}if(_0x3ef4aa[_0x913f('0x45')][_0x913f('0x8a')]){_0x4f697f=_[_0x913f('0x8b')](_0x3ef4aa[_0x913f('0x45')][_0x913f('0x8a')])?_0x3ef4aa['query'][_0x913f('0x8a')]:new Array(_0x3ef4aa['query'][_0x913f('0x8a')]);_0x4f697f[_0x913f('0x36')](function(_0x22e341){_0xb3892c['or'](_0x913f('0x8c'),'%,'+_0x22e341+',%');});}if(_0x3ef4aa['query'][_0x913f('0x8d')]){var _0x445bff=_0x3ef4aa[_0x913f('0x45')][_0x913f('0x8d')]['replace']('\x5c','\x5c\x5c')[_0x913f('0x8e')](/'/g,'\x27\x27');if(qs[_0x913f('0x8f')](_0x445bff)){_0x33ae25['or'](_0x913f('0x90'),_0x445bff+'%')['or']('i.fax\x20LIKE\x20?',_0x445bff+'%');}_0x33ae25['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x445bff+'%');}}_0x29660b['where'](_0x33ae25);_0x29660b[_0x913f('0x91')]('i.id');var _0x562ac2={'type':db[_0x913f('0x92')][_0x913f('0x93')][_0x913f('0x94')],'raw':!![]};var _0x366288=_0x29660b['clone']();_0x366288[_0x913f('0x52')](_0x913f('0x95'));_0x366288[_0x913f('0x52')](_0x913f('0x96'),_0x913f('0x6a'));if(_0x3950bd[_0x913f('0x4c')]){_0x3950bd[_0x913f('0x4c')][_0x913f('0x36')](function(_0x32405f){var _0x74e5c=_0x32405f[0x0]==='contactName'?_0x32405f[0x0]:'i.'+_0x32405f[0x0];_0x29660b[_0x913f('0x4c')](_0x74e5c,_0x32405f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x913f('0x7e')](_0x4f697f)){_0x29660b[_0x913f('0x6b')](_0xb3892c);_0x366288['where'](_0x913f('0x97'),_0x4f697f);}BPromise[_0x913f('0x98')]()[_0x913f('0x2f')](function(){if(!_0x72bf97){if(_0x3ef4aa[_0x913f('0x45')][_0x913f('0x7f')])return;_0x366288[_0x913f('0x4e')](_0x913f('0x99'));_0x29660b[_0x913f('0x4e')](_0x913f('0x99'));return;}if(_0x3ef4aa[_0x913f('0x9a')][_0x913f('0x9b')]!==_0x913f('0x9c'))return;return _0x3ef4aa[_0x913f('0x9a')][_0x913f('0x9d')]({'attributes':['id'],'raw':!![]})[_0x913f('0x2f')](function(_0x510f16){if(_['isEmpty'](_0x510f16)){_0x366288['where'](_0x913f('0x9e'));_0x29660b[_0x913f('0x4e')](_0x913f('0x9e'));}else{_0x366288[_0x913f('0x4e')]('i.FaxAccountId\x20IN\x20?',_[_0x913f('0x32')](_0x510f16,'id'));_0x29660b[_0x913f('0x4e')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x510f16,'id'));}});})[_0x913f('0x2f')](function(){if(_0x3ef4aa[_0x913f('0x9a')][_0x913f('0x9b')]===_0x913f('0x9c')&&!_0x72bf97&&!_0x3ef4aa[_0x913f('0x45')]['FaxAccountId'])return[];return db[_0x913f('0x9f')][_0x913f('0x45')](_0x366288[_0x913f('0xa0')](),_0x562ac2);})[_0x913f('0x2f')](function(_0xe55e69){_0x5a50b5[_0x913f('0x29')]=_0xe55e69[_0x913f('0x68')];if(_0x5a50b5[_0x913f('0x29')]===0x0)return[];return db['sequelize'][_0x913f('0x45')](_0x3e5cd5['toString'](),_0x562ac2)[_0x913f('0x2f')](function(_0x3368bb){_0xc04099=_['keyBy'](_0x3368bb,'id');_0x562ac2=_[_0x913f('0xa1')](_0x562ac2,{'model':db[_0x913f('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ef4aa['query'][_0x913f('0x49')]){_0x3950bd[_0x913f('0x47')][_0x913f('0x36')](function(_0x37f257){_0x29660b[_0x913f('0x52')]('i.'+_0x37f257);});}else{_0x29660b[_0x913f('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x913f('0x6a'));_0x29660b[_0x913f('0x52')]('a.key',_0x913f('0xa2'));_0x29660b[_0x913f('0x52')](_0x913f('0xa3'),_0x913f('0xa4'));_0x29660b[_0x913f('0x52')]('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',_0x913f('0xa5'));_0x29660b[_0x913f('0x52')]('i.*');_0x29660b[_0x913f('0x52')](_0x913f('0xa6'),_0x913f('0xa7'));_0x29660b[_0x913f('0x52')](_0x913f('0xa8'),_0x913f('0xa9'));_0x29660b['field']('c.email',_0x913f('0xaa'));_0x29660b[_0x913f('0x52')](_0x913f('0xab'),_0x913f('0xac'));_0x29660b[_0x913f('0x52')]('c.mobile','Contact.mobile');_0x29660b['field'](_0x913f('0xad'),'Contact.fax');_0x29660b[_0x913f('0x52')]('o.fullname',_0x913f('0xae'));_0x29660b[_0x913f('0x52')](_0x913f('0xaf'),_0x913f('0xb0'));_0x29660b[_0x913f('0x52')](_0x913f('0xb1'),_0x913f('0x34'));}if(_0x3950bd[_0x913f('0x28')])_0x29660b['limit'](_0x3950bd[_0x913f('0x28')]);if(_0x3950bd[_0x913f('0x26')])_0x29660b['offset'](_0x3950bd['offset']);return db[_0x913f('0x9f')][_0x913f('0x45')](_0x29660b[_0x913f('0xa0')](),_0x562ac2);})[_0x913f('0x2f')](function(_0x4aad25){if(_0x4aad25[_0x913f('0x68')]>0x0)_0x362ac1[_0x913f('0x4e')](_0x913f('0xb2'),_[_0x913f('0x32')](_0x4aad25,'id'));return db['sequelize']['query'](_0x362ac1[_0x913f('0xa0')](),_0x562ac2)[_0x913f('0x2f')](function(_0x1e881f){var _0x59669a=_[_0x913f('0xb3')](_0x1e881f,'FaxInteractionId');var _0x484359=[];_0x4aad25[_0x913f('0x36')](function(_0x16743f){_0x484359[_0x913f('0xb4')](updateFaxInteraction(_0x16743f,_0xc04099,_0x59669a));});return BPromise['all'](_0x484359);});});})[_0x913f('0x2f')](function(_0x1a7642){_0x5a50b5[_0x913f('0xb5')]=_0x1a7642;return _0x5a50b5;})[_0x913f('0x2f')](respondWithFilteredResult(_0x59d1e0,_0x3950bd))[_0x913f('0x37')](handleError(_0x59d1e0,null));};exports['show']=function(_0x2928f7,_0x331780){var _0x11951d={'raw':![],'where':{'id':_0x2928f7[_0x913f('0xb6')]['id']}},_0x152980={};_0x152980[_0x913f('0x44')]=_[_0x913f('0x46')](db[_0x913f('0x40')]['rawAttributes']);_0x152980['query']=_[_0x913f('0x46')](_0x2928f7[_0x913f('0x45')]);_0x152980[_0x913f('0x4f')]=_[_0x913f('0x48')](_0x152980[_0x913f('0x44')],_0x152980[_0x913f('0x45')]);_0x11951d['attributes']=_[_0x913f('0x48')](_0x152980[_0x913f('0x44')],qs['fields'](_0x2928f7['query']['fields']));_0x11951d[_0x913f('0x47')]=_0x11951d[_0x913f('0x47')]['length']?_0x11951d[_0x913f('0x47')]:_0x152980[_0x913f('0x44')];if(_0x2928f7[_0x913f('0x45')]['includeAll']){_0x11951d['include']=[{'all':!![]}];}_0x11951d=_[_0x913f('0xa1')]({},_0x11951d,_0x2928f7['options']);return db[_0x913f('0x40')][_0x913f('0x69')](_0x11951d)['then'](handleEntityNotFound(_0x331780,null))[_0x913f('0x2f')](respondWithResult(_0x331780,null))[_0x913f('0x37')](handleError(_0x331780,null));};exports[_0x913f('0xb7')]=function(_0x3ba57c,_0x26c980){return db['FaxInteraction'][_0x913f('0xb7')](_0x3ba57c['body'],{})[_0x913f('0x2f')](respondWithResult(_0x26c980,0xc9))[_0x913f('0x37')](handleError(_0x26c980,null));};exports['update']=function(_0x22c71e,_0x306d39){if(_0x22c71e[_0x913f('0xb8')]['id']){delete _0x22c71e[_0x913f('0xb8')]['id'];}return db['FaxInteraction'][_0x913f('0x69')]({'where':{'id':_0x22c71e[_0x913f('0xb6')]['id']}})[_0x913f('0x2f')](handleEntityNotFound(_0x306d39,null))[_0x913f('0x2f')](saveUpdates(_0x22c71e[_0x913f('0xb8')],null))[_0x913f('0x2f')](respondWithResult(_0x306d39,null))[_0x913f('0x37')](handleError(_0x306d39,null));};exports[_0x913f('0xb9')]=function(_0x522080,_0x4af5ce){return db[_0x913f('0x40')][_0x913f('0x69')]({'where':{'id':_0x522080[_0x913f('0xb6')]['id']}})[_0x913f('0x2f')](handleEntityNotFound(_0x4af5ce,null))[_0x913f('0x2f')](removeEntity(_0x4af5ce,null))[_0x913f('0x37')](handleError(_0x4af5ce,null));};exports['describe']=function(_0x43dfc4,_0x409219){return db[_0x913f('0x40')][_0x913f('0xba')]()[_0x913f('0x2f')](respondWithResult(_0x409219,null))[_0x913f('0x37')](handleError(_0x409219,null));};exports[_0x913f('0xbb')]=function(_0x488e09,_0x2ce947,_0x5c9adb){return db['FaxMessage']['find']({'where':{'id':_0x488e09[_0x913f('0xb6')]['id']}})[_0x913f('0x2f')](handleEntityNotFound(_0x2ce947,null))['then'](function(_0x5f4f6d){if(_0x5f4f6d){return _0x5f4f6d[_0x913f('0xbb')](_0x488e09[_0x913f('0xb8')][_0x913f('0xbc')],_[_0x913f('0xbd')](_0x488e09['body'],[_0x913f('0xbc'),'id'])||{});}})[_0x913f('0x2f')](respondWithResult(_0x2ce947,null))[_0x913f('0x37')](handleError(_0x2ce947,null));};exports[_0x913f('0xbe')]=function(_0x30e786,_0x44c4c3,_0x54e080){var _0x1be1ab={'raw':![],'where':{}};var _0x940ebe={};var _0xb86a24={'count':0x0,'rows':[]};return db[_0x913f('0x40')][_0x913f('0xbf')]({'where':{'id':_0x30e786[_0x913f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x44c4c3,null))[_0x913f('0x2f')](function(_0x9adaa2){if(_0x9adaa2){_0x940ebe[_0x913f('0x44')]=_[_0x913f('0x46')](db[_0x913f('0xc0')][_0x913f('0x41')]);_0x940ebe['query']=_[_0x913f('0x46')](_0x30e786[_0x913f('0x45')]);_0x940ebe[_0x913f('0x4f')]=_[_0x913f('0x48')](_0x940ebe[_0x913f('0x44')],_0x940ebe[_0x913f('0x45')]);_0x1be1ab['attributes']=_[_0x913f('0x48')](_0x940ebe[_0x913f('0x44')],qs[_0x913f('0x49')](_0x30e786[_0x913f('0x45')][_0x913f('0x49')]));_0x1be1ab[_0x913f('0x47')]=_0x1be1ab['attributes'][_0x913f('0x68')]?_0x1be1ab[_0x913f('0x47')]:_0x940ebe['model'];if(!_0x30e786['query'][_0x913f('0x4a')](_0x913f('0x4b'))){_0x1be1ab['limit']=qs['limit'](_0x30e786[_0x913f('0x45')][_0x913f('0x28')]);_0x1be1ab[_0x913f('0x26')]=qs[_0x913f('0x26')](_0x30e786[_0x913f('0x45')]['offset']);}_0x1be1ab[_0x913f('0x4c')]=qs[_0x913f('0x4d')](_0x30e786['query'][_0x913f('0x4d')]);_0x1be1ab[_0x913f('0x4e')]=qs[_0x913f('0x4f')](_[_0x913f('0x50')](_0x30e786[_0x913f('0x45')],_0x940ebe[_0x913f('0x4f')]));_0x1be1ab[_0x913f('0x4e')][_0x913f('0xc1')]=_0x9adaa2['id'];if(_0x30e786[_0x913f('0x45')][_0x913f('0x8d')]){_0x1be1ab[_0x913f('0x4e')]=_['merge'](_0x1be1ab[_0x913f('0x4e')],{'$or':_[_0x913f('0x32')](_0x1be1ab['attributes'],function(_0x4e793c){var _0x308ade={};_0x308ade[_0x4e793c]={'$like':'%'+_0x30e786['query'][_0x913f('0x8d')]+'%'};return _0x308ade;})});}if(_0x30e786[_0x913f('0x45')]['$gte']){var _0x163978=_0x30e786[_0x913f('0x45')][_0x913f('0xc2')]['split'](',');var _0x331eea={};_0x331eea[_0x163978[0x0]]={'$gte':moment(_0x163978[0x1])[_0x913f('0xc3')](_0x913f('0xc4'))};_0x1be1ab[_0x913f('0x4e')]=_[_0x913f('0xa1')](_0x1be1ab['where'],_0x331eea);}_0x1be1ab=_[_0x913f('0xa1')]({},_0x1be1ab,_0x30e786[_0x913f('0xc5')]);return db[_0x913f('0xc0')]['count']({'where':_0x1be1ab['where']})['then'](function(_0xc22882){_0xb86a24[_0x913f('0x29')]=_0xc22882;if(_0x30e786['query'][_0x913f('0xc6')]){_0x1be1ab['include']=[{'all':!![]}];}return db[_0x913f('0xc0')]['findAll'](_0x1be1ab);})[_0x913f('0x2f')](function(_0x77e930){_0xb86a24[_0x913f('0xb5')]=_0x77e930;return _0xb86a24;});}})[_0x913f('0x2f')](respondWithFilteredResult(_0x44c4c3,_0x1be1ab))[_0x913f('0x37')](handleError(_0x44c4c3,null));};exports['addTags']=function(_0x330539,_0x54374c,_0x99b785){return db[_0x913f('0x40')][_0x913f('0x69')]({'where':{'id':_0x330539[_0x913f('0xb6')]['id']}})[_0x913f('0x2f')](handleEntityNotFound(_0x54374c,null))[_0x913f('0x2f')](function(_0x2775b4){if(_0x2775b4){return _0x2775b4[_0x913f('0xc7')](_0x330539[_0x913f('0xb8')][_0x913f('0xbc')],_[_0x913f('0xbd')](_0x330539[_0x913f('0xb8')],[_0x913f('0xbc'),'id'])||{})[_0x913f('0xc8')](function(){return db[_0x913f('0x7a')][_0x913f('0xc9')]({'attributes':['id','name',_0x913f('0x53')],'where':{'id':_0x330539[_0x913f('0xb8')][_0x913f('0xbc')]}});})['then'](function(_0x4b3091){socket[_0x913f('0xca')](_0x913f('0xcb'),{'id':Number(_0x330539[_0x913f('0xb6')]['id']),'tags':_0x4b3091||[]});return{'id':Number(_0x330539['params']['id']),'tags':_0x4b3091||[]};});}})['then'](respondWithResult(_0x54374c,null))[_0x913f('0x37')](handleError(_0x54374c,null));};exports['removeTags']=function(_0x39d3ad,_0x367519,_0x40f32f){return db[_0x913f('0x40')]['find']({'where':{'id':_0x39d3ad[_0x913f('0xb6')]['id']}})[_0x913f('0x2f')](handleEntityNotFound(_0x367519,null))[_0x913f('0x2f')](function(_0x50a809){if(_0x50a809){return _0x50a809[_0x913f('0xcc')](_0x39d3ad[_0x913f('0x45')]['ids']);}})[_0x913f('0x2f')](respondWithStatusCode(_0x367519,null))[_0x913f('0x37')](handleError(_0x367519,null));};exports[_0x913f('0xcd')]=function(_0x261f8b,_0x200c9b){var _0x1d067f=moment()[_0x913f('0xce')]()[_0x913f('0xa0')]();var _0x50d3a6=path[_0x913f('0xcf')](config[_0x913f('0xd0')],'server',_0x913f('0xd1'),_0x913f('0xd2'));var _0x92f0c1=path[_0x913f('0xcf')](config['root'],_0x913f('0xd3'),_0x913f('0xd1'),_0x913f('0xd4'));var _0x392f51=path[_0x913f('0xcf')](_0x50d3a6,_0x1d067f);var _0x5f392d=util[_0x913f('0xc3')](_0x913f('0xd5'),_0x261f8b[_0x913f('0xb6')]['id'],_0x1d067f);var _0x38a34a=path[_0x913f('0xcf')](_0x50d3a6,_0x5f392d);var _0x5e15b2=[];_0x5e15b2[_0x913f('0xb4')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x1a40cb=[{'model':db[_0x913f('0xc0')],'as':_0x913f('0xd6'),'attributes':['id',_0x913f('0xb8'),'createdAt'],'include':_0x5e15b2}];return db[_0x913f('0x40')][_0x913f('0x69')]({'where':{'id':_0x261f8b[_0x913f('0xb6')]['id']},'include':_0x1a40cb})['then'](handleEntityNotFound(_0x200c9b,null))[_0x913f('0x2f')](function(_0x1e462f){if(_0x1e462f&&_0x1e462f[_0x913f('0xd6')]){var _0x52065d=_0x1e462f[_0x913f('0xd7')]({'plain':!![]});fs[_0x913f('0xd8')](_0x392f51);for(var _0x3a279e=0x0;_0x3a279e<_0x52065d[_0x913f('0xd6')][_0x913f('0x68')];_0x3a279e++){var _0x2a284c=_0x52065d[_0x913f('0xd6')][_0x3a279e][_0x913f('0xd9')];if(_0x2a284c){var _0x1bf94a=path['join'](_0x92f0c1,_0x2a284c['basename']);if(fs[_0x913f('0xda')](_0x1bf94a)){fs['createReadStream'](_0x1bf94a)[_0x913f('0xdb')](fs[_0x913f('0xdc')](path[_0x913f('0xcf')](_0x392f51,_0x2a284c['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x2294e6,_0x8c5015){zipdir(_0x392f51,{'saveTo':_0x38a34a},function(_0x3401ac,_0x10fddf){if(_0x3401ac)return _0x8c5015(_0x3401ac);return _0x2294e6(_0x10fddf);});})[_0x913f('0x2f')](function(){return new BPromise(function(_0xfc901,_0x21b7d5){rimraf(_0x392f51,function(_0x32ccc3){if(_0x32ccc3)_0x21b7d5(_0x32ccc3);return _0xfc901();});});})[_0x913f('0x2f')](function(){return _0x200c9b[_0x913f('0xcd')](_0x38a34a,_0x5f392d,function(_0x5f1c9a){if(_0x5f1c9a){console[_0x913f('0xdd')](_0x913f('0xde'),_0x5f1c9a);}else{fs['unlinkSync'](_0x38a34a);}});});});}else{return _0x200c9b['sendStatus'](0xc8);}})[_0x913f('0x37')](handleError(_0x200c9b,null));}; \ No newline at end of file +var _0x3bd2=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','total','UserId','closed','answered','unmanaged','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\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','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','FaxInteraction','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','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','includeAll','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','merge','options','include','findAll','setTags','omit','Tag','emit','faxInteractionTags:save','removeTags','download','root','files','tmp','join','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','createWriteStream','resolve','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x56db82,_0x29cfaf){var _0x2e8232=function(_0x2b5bbb){while(--_0x2b5bbb){_0x56db82['push'](_0x56db82['shift']());}};_0x2e8232(++_0x29cfaf);}(_0x3bd2,0x1b9));var _0x23bd=function(_0x54002a,_0x1b4d38){_0x54002a=_0x54002a-0x0;var _0x129d66=_0x3bd2[_0x54002a];return _0x129d66;};'use strict';var emlformat=require(_0x23bd('0x0'));var rimraf=require(_0x23bd('0x1'));var zipdir=require(_0x23bd('0x2'));var jsonpatch=require(_0x23bd('0x3'));var rp=require(_0x23bd('0x4'));var moment=require(_0x23bd('0x5'));var BPromise=require(_0x23bd('0x6'));var Mustache=require('mustache');var util=require(_0x23bd('0x7'));var path=require(_0x23bd('0x8'));var sox=require(_0x23bd('0x9'));var csv=require(_0x23bd('0xa'));var ejs=require(_0x23bd('0xb'));var fs=require('fs');var fs_extra=require(_0x23bd('0xc'));var _=require(_0x23bd('0xd'));var squel=require(_0x23bd('0xe'));var crypto=require(_0x23bd('0xf'));var jsforce=require(_0x23bd('0x10'));var deskjs=require(_0x23bd('0x11'));var toCsv=require(_0x23bd('0xa'));var querystring=require('querystring');var Papa=require(_0x23bd('0x12'));var Redis=require(_0x23bd('0x13'));var authService=require(_0x23bd('0x14'));var qs=require(_0x23bd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23bd('0x16'));var logger=require(_0x23bd('0x17'))(_0x23bd('0x18'));var utils=require(_0x23bd('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x23bd('0x1a'));var db=require(_0x23bd('0x1b'))['db'];config[_0x23bd('0x1c')]=_[_0x23bd('0x1d')](config[_0x23bd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x23bd('0x1e'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x23bd('0x1f')](socket);function respondWithStatusCode(_0x42a72b,_0xe63e45){_0xe63e45=_0xe63e45||0xcc;return function(_0x34875d){if(_0x34875d){return _0x42a72b[_0x23bd('0x20')](_0xe63e45);}return _0x42a72b[_0x23bd('0x21')](_0xe63e45)[_0x23bd('0x22')]();};}function respondWithResult(_0x3dfd0a,_0x10673c){_0x10673c=_0x10673c||0xc8;return function(_0x42ff3f){if(_0x42ff3f){return _0x3dfd0a[_0x23bd('0x21')](_0x10673c)['json'](_0x42ff3f);}};}function respondWithFilteredResult(_0x3f9c18,_0x46b6a1){return function(_0x4ab295){if(_0x4ab295){var _0x1cedd2=typeof _0x46b6a1[_0x23bd('0x23')]===_0x23bd('0x24')&&typeof _0x46b6a1[_0x23bd('0x25')]===_0x23bd('0x24');var _0x33d944=_0x4ab295[_0x23bd('0x26')];var _0x4a182a=_0x1cedd2?0x0:_0x46b6a1[_0x23bd('0x23')];var _0x3c211c=_0x1cedd2?_0x4ab295['count']:_0x46b6a1[_0x23bd('0x23')]+_0x46b6a1[_0x23bd('0x25')];var _0x16ab83;if(_0x3c211c>=_0x33d944){_0x3c211c=_0x33d944;_0x16ab83=0xc8;}else{_0x16ab83=0xce;}_0x3f9c18[_0x23bd('0x21')](_0x16ab83);return _0x3f9c18['set']('Content-Range',_0x4a182a+'-'+_0x3c211c+'/'+_0x33d944)[_0x23bd('0x27')](_0x4ab295);}return null;};}function patchUpdates(_0x1ab986){return function(_0x36ff97){try{jsonpatch['apply'](_0x36ff97,_0x1ab986,!![]);}catch(_0x138507){return BPromise[_0x23bd('0x28')](_0x138507);}return _0x36ff97[_0x23bd('0x29')]();};}function saveUpdates(_0x56a6ee,_0x4cf5f8){return function(_0x2e42ff){if(_0x2e42ff){return _0x2e42ff[_0x23bd('0x2a')](_0x56a6ee)[_0x23bd('0x2b')](function(_0x123306){return _0x123306;});}return null;};}function removeEntity(_0x51bbcf,_0x4aa86b){return function(_0x33d56b){if(_0x33d56b){return _0x33d56b['destroy']()['then'](function(){_0x51bbcf[_0x23bd('0x21')](0xcc)[_0x23bd('0x22')]();});}};}function handleEntityNotFound(_0x95bb74,_0x4d23c6){return function(_0x371f52){if(!_0x371f52){_0x95bb74[_0x23bd('0x20')](0x194);}return _0x371f52;};}function handleError(_0x1b2d07,_0x3b0f87){_0x3b0f87=_0x3b0f87||0x1f4;return function(_0x462d0b){logger[_0x23bd('0x2c')](_0x462d0b[_0x23bd('0x2d')]);if(_0x462d0b[_0x23bd('0x2e')]){delete _0x462d0b[_0x23bd('0x2e')];}_0x1b2d07[_0x23bd('0x21')](_0x3b0f87)[_0x23bd('0x2f')](_0x462d0b);};}function getInteractionUsers(_0x1f018e,_0x2602ac){return new BPromise(function(_0x446239,_0xf1674a){try{if(_0x2602ac[_0x1f018e['id']]){_0x1f018e[_0x23bd('0x30')]=_[_0x23bd('0x31')](_0x2602ac[_0x1f018e['id']],function(_0x1eafa8){return{'id':_0x1eafa8['id'],'fullname':_0x1eafa8[_0x23bd('0x32')]};});}}catch(_0x2b1cb8){_0xf1674a(_0x2b1cb8);}_0x446239(_0x1f018e);});}function getInteractionTags(_0x16164a,_0x30011a){return new BPromise(function(_0x21370d,_0x444da0){try{if(_0x16164a[_0x23bd('0x33')]){_0x16164a[_0x23bd('0x34')]=[];_0x16164a[_0x23bd('0x33')][_0x23bd('0x35')](',')[_0x23bd('0x36')](function(_0x3a80ef){_0x16164a['Tags'][_0x23bd('0x37')](_0x30011a[_0x3a80ef]);});}delete _0x16164a[_0x23bd('0x33')];}catch(_0x5c937d){_0x444da0(_0x5c937d);}_0x21370d(_0x16164a);});}function updateFaxInteraction(_0x20e25c,_0x2a13d8,_0x1ec1bb){return new BPromise(function(_0x2cd0fc,_0x537d0f){return getInteractionUsers(_0x20e25c,_0x1ec1bb)[_0x23bd('0x2b')](function(_0x120264){return getInteractionTags(_0x120264,_0x2a13d8);})[_0x23bd('0x2b')](function(_0x1ccc64){return getStateInteraction(_0x1ccc64);})[_0x23bd('0x2b')](function(_0x4a6298){_0x2cd0fc(_0x4a6298);})[_0x23bd('0x38')](function(_0x1f7c80){_0x537d0f(_0x1f7c80);});});}function getStateInteraction(_0x3e59cb){return new BPromise(function(_0x5b5754){_0x3e59cb[_0x23bd('0x39')]=0x0;_0x3e59cb[_0x23bd('0x3a')]=0x0;_0x3e59cb['answered']=0x0;_0x3e59cb['unmanaged']=0x0;_0x3e59cb[_0x23bd('0x3b')]=0x0;if(!_0x3e59cb['closed']&&!_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x39')]+=0x1;}if(!_0x3e59cb[_0x23bd('0x3d')]&&_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3a')]+=0x1;if(_0x3e59cb[_0x23bd('0x39')]){_0x3e59cb[_0x23bd('0x39')]-=0x1;}}if(_0x3e59cb[_0x23bd('0x3d')]&&_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3e')]+=0x1;if(_0x3e59cb[_0x23bd('0x3a')]){_0x3e59cb[_0x23bd('0x3a')]-=0x1;}}if(_0x3e59cb[_0x23bd('0x3d')]&&!_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3f')]+=0x1;if(_0x3e59cb[_0x23bd('0x39')]){_0x3e59cb['waiting']-=0x1;}}_0x3e59cb[_0x23bd('0x3b')]+=0x1;_0x5b5754(_0x3e59cb);});}exports[_0x23bd('0x40')]=function(_0x4da852,_0x445fe0){var _0x54acb5={},_0x26b830={},_0x4900ce={'count':0x0,'rows':[]};var _0x1489b9=_['map'](db['FaxInteraction'][_0x23bd('0x41')],function(_0x1f2d7d){return{'name':_0x1f2d7d[_0x23bd('0x42')],'type':_0x1f2d7d[_0x23bd('0x43')][_0x23bd('0x44')]};});_0x26b830[_0x23bd('0x45')]=_[_0x23bd('0x31')](_0x1489b9,'name');_0x26b830[_0x23bd('0x46')]=_[_0x23bd('0x47')](_0x4da852[_0x23bd('0x46')]);_0x26b830[_0x23bd('0x48')]=_[_0x23bd('0x49')](_0x26b830[_0x23bd('0x45')],_0x26b830[_0x23bd('0x46')]);_0x54acb5['attributes']=_[_0x23bd('0x49')](_0x26b830[_0x23bd('0x45')],qs['fields'](_0x4da852[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x54acb5[_0x23bd('0x4b')]=_0x54acb5[_0x23bd('0x4b')]['length']?_0x54acb5[_0x23bd('0x4b')]:_0x26b830[_0x23bd('0x45')];if(!_0x4da852[_0x23bd('0x46')][_0x23bd('0x4c')](_0x23bd('0x4d'))){_0x54acb5[_0x23bd('0x25')]=qs[_0x23bd('0x25')](_0x4da852['query'][_0x23bd('0x25')]);_0x54acb5[_0x23bd('0x23')]=qs[_0x23bd('0x23')](_0x4da852[_0x23bd('0x46')][_0x23bd('0x23')]);}_0x54acb5[_0x23bd('0x4e')]=qs[_0x23bd('0x4f')](_0x4da852[_0x23bd('0x46')]['sort']);_0x54acb5['where']=qs[_0x23bd('0x48')](_[_0x23bd('0x50')](_0x4da852[_0x23bd('0x46')],_0x26b830['filters']),_0x1489b9);var _0x27dcb3=[];var _0x2f19b0=squel[_0x23bd('0x51')]()['field']('id')[_0x23bd('0x52')]('name')[_0x23bd('0x52')](_0x23bd('0x53'))[_0x23bd('0x54')]('tools_tags');var _0x2d914c=squel['select']()[_0x23bd('0x52')]('u.id')[_0x23bd('0x52')]('u.fullname')['field'](_0x23bd('0x55'))[_0x23bd('0x54')](_0x23bd('0x56'),'ui')[_0x23bd('0x57')]('users','u','u.id\x20=\x20ui.UserId');var _0x4094bb=squel[_0x23bd('0x51')]()[_0x23bd('0x54')](_0x23bd('0x58'),'i')[_0x23bd('0x57')](_0x23bd('0x59'),'c',_0x23bd('0x5a'))[_0x23bd('0x57')](_0x23bd('0x5b'),'o',_0x23bd('0x5c'))[_0x23bd('0x57')](_0x23bd('0x5d'),'a',_0x23bd('0x5e'))[_0x23bd('0x57')](_0x23bd('0x5f'),'me',_0x23bd('0x60'))[_0x23bd('0x57')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x23bd('0x57')](_0x23bd('0x61'),'t',_0x23bd('0x62'));var _0x482a93=squel['expr']();var _0x12037b=[];var _0x1b11a9=squel[_0x23bd('0x63')]();var _0x534ca7;if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x64')]){_0x534ca7=as[_0x23bd('0x65')](_0x4da852['query'][_0x23bd('0x64')]);var _0x562eee=_0x534ca7['sqlOperator'];for(var _0x440ca6=0x0;_0x440ca6<_0x534ca7[_0x23bd('0x66')][_0x23bd('0x67')];_0x440ca6++){var _0x3601f3=_0x534ca7[_0x23bd('0x66')][_0x440ca6];var _0x3bab6e='i';var _0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),_0x3601f3[_0x23bd('0x52')]]);if(!_0x3ee911){switch(_0x3601f3[_0x23bd('0x52')]){case _0x23bd('0x69'):if(_0x3601f3[_0x23bd('0x6a')]==0x1){_0x4094bb[_0x23bd('0x6b')]('`'+_0x3601f3[_0x23bd('0x52')]+_0x23bd('0x6c'));}else{_0x4094bb[_0x23bd('0x6b')]('`'+_0x3601f3[_0x23bd('0x52')]+_0x23bd('0x6d'));}break;case _0x23bd('0x6e'):if(_0x3601f3['operator']===_0x23bd('0x6f')){if(_0x3601f3['value'][_0x23bd('0x35')]('\x20')['length']>0x1){_0x482a93[_0x562eee](_0x23bd('0x70'),qs[_0x23bd('0x71')](_0x3601f3[_0x23bd('0x6a')]),null);}else{var _0x23d461='%'+_0x3601f3[_0x23bd('0x6a')]+'%';_0x482a93[_0x562eee](_0x23bd('0x72'),_0x23d461,_0x23d461,_0x23d461);}}else{_0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),'ContactId']);_0x3601f3[_0x23bd('0x52')]=_0x23bd('0x73');_0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911[_0x23bd('0x43')],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3[_0x23bd('0x6a')]['start'],_0x2e8ea3['value'][_0x23bd('0x22')]);}break;case'Tag':var _0x59a63e=_0x3601f3[_0x23bd('0x6a')]['split'](',')[_0x23bd('0x31')](function(_0x260160){return Number(_0x260160);});_0x59a63e['forEach'](function(_0x12eebb){_0x1b11a9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x12eebb+',%');});_0x12037b=_[_0x23bd('0x76')](_0x12037b,_0x59a63e);break;case'User':if(_0x3601f3[_0x23bd('0x77')]===_0x23bd('0x6f')){_0x482a93[_0x562eee](_0x23bd('0x78'),'%'+_0x3601f3[_0x23bd('0x6a')]+'%',null);}else{_0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),_0x23bd('0x3c')]);_0x3601f3[_0x23bd('0x52')]=_0x23bd('0x3c');_0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911['type'],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x22')]);}break;case _0x23bd('0x7a'):_0x2e8ea3=as[_0x23bd('0x74')]('me',null,_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3['value'][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')]['end']);break;}}else{var _0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911['type'],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3['text'],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')]['end']);}}}else{var _0x338be3=_(_0x4da852[_0x23bd('0x46')])[_0x23bd('0x47')]()[_0x23bd('0x31')](function(_0x86205e){return _[_0x23bd('0x7b')](_0x1489b9,[_0x23bd('0x2e'),_0x86205e])?_0x86205e:undefined;})['compact']()[_0x23bd('0x6a')]();if(!_[_0x23bd('0x7c')](_0x338be3)){_0x338be3['forEach'](function(_0x380888){if(_0x380888===_0x23bd('0x7d')){_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x7f'),[][_0x23bd('0x80')](_0x4da852['query'][_0x380888]));}else if(_0x380888==='createdAt'){var _0x4aa532=JSON[_0x23bd('0x81')](_0x4da852[_0x23bd('0x46')][_0x380888])[_0x23bd('0x82')];var _0x297454=JSON[_0x23bd('0x81')](_0x4da852[_0x23bd('0x46')][_0x380888])[_0x23bd('0x83')];_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x84'),_0x4aa532,_0x297454);}else{if(_0x4da852[_0x23bd('0x46')][_0x380888]===_0x23bd('0x85')){_0x4094bb[_0x23bd('0x7e')]('i.'+_0x380888+_0x23bd('0x86'));}else{_0x4094bb[_0x23bd('0x7e')]('i.'+_0x380888+_0x23bd('0x87'),_0x4da852['query'][_0x380888]);}}});}if(_0x4da852[_0x23bd('0x46')]['read']){if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x88')]==0x1){_0x4094bb['having'](_0x23bd('0x89'));}else{_0x4094bb[_0x23bd('0x6b')](_0x23bd('0x8a'));}}if(_0x4da852['query'][_0x23bd('0x8b')]){_0x12037b=_[_0x23bd('0x8c')](_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')])?_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')]:new Array(_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')]);_0x12037b[_0x23bd('0x36')](function(_0x5cb4de){_0x1b11a9['or'](_0x23bd('0x8d'),'%,'+_0x5cb4de+',%');});}if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x8e')]){var _0x1e20c1=_0x4da852[_0x23bd('0x46')]['filter'][_0x23bd('0x8f')]('\x5c','\x5c\x5c')[_0x23bd('0x8f')](/'/g,'\x27\x27');if(qs[_0x23bd('0x90')](_0x1e20c1)){_0x482a93['or']('i.id\x20LIKE\x20?',_0x1e20c1+'%')['or'](_0x23bd('0x91'),_0x1e20c1+'%');}_0x482a93['or'](_0x23bd('0x92'),_0x1e20c1+'%');}}_0x4094bb['where'](_0x482a93);_0x4094bb[_0x23bd('0x93')](_0x23bd('0x94'));var _0x2de029={'type':db[_0x23bd('0x95')]['QueryTypes'][_0x23bd('0x96')],'raw':!![]};var _0x4f8dc5=_0x4094bb[_0x23bd('0x97')]();_0x4f8dc5[_0x23bd('0x52')](_0x23bd('0x94'));_0x4f8dc5[_0x23bd('0x52')](_0x23bd('0x98'),_0x23bd('0x69'));if(_0x54acb5[_0x23bd('0x4e')]){_0x54acb5[_0x23bd('0x4e')]['forEach'](function(_0x2e0191){var _0x3dad20=_0x2e0191[0x0]==='contactName'?_0x2e0191[0x0]:'i.'+_0x2e0191[0x0];_0x4094bb[_0x23bd('0x4e')](_0x3dad20,_0x2e0191[0x1]===_0x23bd('0x99')?![]:!![]);});}if(!_[_0x23bd('0x7c')](_0x12037b)){_0x4094bb[_0x23bd('0x6b')](_0x1b11a9);_0x4f8dc5[_0x23bd('0x7e')]('t.id\x20IN\x20?',_0x12037b);}BPromise['resolve']()[_0x23bd('0x2b')](function(){if(!_0x534ca7){if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x7d')])return;_0x4f8dc5[_0x23bd('0x7e')](_0x23bd('0x9a'));_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x9a'));return;}if(_0x4da852[_0x23bd('0x9b')][_0x23bd('0x9c')]!==_0x23bd('0x9d'))return;return _0x4da852['user'][_0x23bd('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a8bdf){if(_['isEmpty'](_0x3a8bdf)){_0x4f8dc5['where']('i.FaxAccountId\x20IS\x20NULL');_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x9f'));}else{_0x4f8dc5[_0x23bd('0x7e')](_0x23bd('0x7f'),_['map'](_0x3a8bdf,'id'));_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x7f'),_[_0x23bd('0x31')](_0x3a8bdf,'id'));}});})[_0x23bd('0x2b')](function(){if(_0x4da852[_0x23bd('0x9b')]['role']===_0x23bd('0x9d')&&!_0x534ca7&&!_0x4da852[_0x23bd('0x46')]['FaxAccountId'])return[];return db[_0x23bd('0xa0')]['query'](_0x4f8dc5[_0x23bd('0xa1')](),_0x2de029);})[_0x23bd('0x2b')](function(_0x5cfc5f){_0x4900ce[_0x23bd('0x26')]=_0x5cfc5f[_0x23bd('0x67')];if(_0x4900ce[_0x23bd('0x26')]===0x0)return[];return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x2f19b0[_0x23bd('0xa1')](),_0x2de029)[_0x23bd('0x2b')](function(_0x3b1bcb){_0x27dcb3=_[_0x23bd('0xa2')](_0x3b1bcb,'id');_0x2de029=_['merge'](_0x2de029,{'model':db[_0x23bd('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4da852['query'][_0x23bd('0x4a')]){_0x54acb5[_0x23bd('0x4b')]['forEach'](function(_0x3829d2){_0x4094bb[_0x23bd('0x52')]('i.'+_0x3829d2);});}else{_0x4094bb[_0x23bd('0x52')](_0x23bd('0x98'),_0x23bd('0x69'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa4'),_0x23bd('0xa5'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa6'),_0x23bd('0xa7'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa8'),_0x23bd('0xa9'));_0x4094bb[_0x23bd('0x52')]('i.*');_0x4094bb[_0x23bd('0x52')](_0x23bd('0xaa'),'Contact.firstName');_0x4094bb['field'](_0x23bd('0xab'),_0x23bd('0xac'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xad'),_0x23bd('0xae'));_0x4094bb[_0x23bd('0x52')]('c.phone','Contact.phone');_0x4094bb['field'](_0x23bd('0xaf'),_0x23bd('0xb0'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xb1'),_0x23bd('0xb2'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xb3'),_0x23bd('0xb4'));_0x4094bb['field'](_0x23bd('0xb5'),_0x23bd('0xb6'));_0x4094bb['field'](_0x23bd('0xb7'),_0x23bd('0x33'));}if(_0x54acb5[_0x23bd('0x25')])_0x4094bb[_0x23bd('0x25')](_0x54acb5['limit']);if(_0x54acb5[_0x23bd('0x23')])_0x4094bb[_0x23bd('0x23')](_0x54acb5['offset']);return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x4094bb[_0x23bd('0xa1')](),_0x2de029);})[_0x23bd('0x2b')](function(_0x25078b){if(_0x25078b[_0x23bd('0x67')]>0x0)_0x2d914c[_0x23bd('0x7e')](_0x23bd('0xb8'),_['map'](_0x25078b,'id'));return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x2d914c['toString'](),_0x2de029)[_0x23bd('0x2b')](function(_0x5d644f){var _0x159d16=_[_0x23bd('0xb9')](_0x5d644f,_0x23bd('0xba'));var _0xb3563c=[];_0x25078b[_0x23bd('0x36')](function(_0x438d6b){_0xb3563c[_0x23bd('0x37')](updateFaxInteraction(_0x438d6b,_0x27dcb3,_0x159d16));});return BPromise[_0x23bd('0xbb')](_0xb3563c);});});})[_0x23bd('0x2b')](function(_0xc8e478){_0x4900ce[_0x23bd('0xbc')]=_0xc8e478;return _0x4900ce;})[_0x23bd('0x2b')](respondWithFilteredResult(_0x445fe0,_0x54acb5))[_0x23bd('0x38')](handleError(_0x445fe0,null));};exports['show']=function(_0xb98762,_0x5e3ec1){var _0x50d9f9={'raw':![],'where':{'id':_0xb98762[_0x23bd('0xbd')]['id']}},_0x4d9cf4={};_0x4d9cf4[_0x23bd('0x45')]=_['keys'](db[_0x23bd('0xa3')][_0x23bd('0x41')]);_0x4d9cf4[_0x23bd('0x46')]=_[_0x23bd('0x47')](_0xb98762['query']);_0x4d9cf4['filters']=_[_0x23bd('0x49')](_0x4d9cf4[_0x23bd('0x45')],_0x4d9cf4[_0x23bd('0x46')]);_0x50d9f9['attributes']=_[_0x23bd('0x49')](_0x4d9cf4[_0x23bd('0x45')],qs['fields'](_0xb98762[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x50d9f9['attributes']=_0x50d9f9['attributes'][_0x23bd('0x67')]?_0x50d9f9[_0x23bd('0x4b')]:_0x4d9cf4['model'];if(_0xb98762[_0x23bd('0x46')][_0x23bd('0xbe')]){_0x50d9f9['include']=[{'all':!![]}];}_0x50d9f9=_['merge']({},_0x50d9f9,_0xb98762['options']);return db[_0x23bd('0xa3')][_0x23bd('0x68')](_0x50d9f9)[_0x23bd('0x2b')](handleEntityNotFound(_0x5e3ec1,null))[_0x23bd('0x2b')](respondWithResult(_0x5e3ec1,null))['catch'](handleError(_0x5e3ec1,null));};exports[_0x23bd('0xbf')]=function(_0x5094e4,_0x4eda69){return db['FaxInteraction'][_0x23bd('0xbf')](_0x5094e4[_0x23bd('0x7a')],{})[_0x23bd('0x2b')](respondWithResult(_0x4eda69,0xc9))['catch'](handleError(_0x4eda69,null));};exports[_0x23bd('0x2a')]=function(_0x1c5991,_0x46f45e){if(_0x1c5991['body']['id']){delete _0x1c5991['body']['id'];}return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x1c5991['params']['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x46f45e,null))['then'](saveUpdates(_0x1c5991[_0x23bd('0x7a')],null))['then'](respondWithResult(_0x46f45e,null))[_0x23bd('0x38')](handleError(_0x46f45e,null));};exports['destroy']=function(_0x148bb3,_0x1f05e0){return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x148bb3[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x1f05e0,null))['then'](removeEntity(_0x1f05e0,null))['catch'](handleError(_0x1f05e0,null));};exports[_0x23bd('0xc0')]=function(_0x2a329d,_0x42653c){return db['FaxInteraction'][_0x23bd('0xc0')]()[_0x23bd('0x2b')](respondWithResult(_0x42653c,null))[_0x23bd('0x38')](handleError(_0x42653c,null));};exports[_0x23bd('0xc1')]=function(_0x1cd38d,_0x2cab74,_0x2f1d70){return db[_0x23bd('0xc2')]['find']({'where':{'id':_0x1cd38d[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x2cab74,null))[_0x23bd('0x2b')](function(_0x3e6438){if(_0x3e6438){return _0x3e6438[_0x23bd('0xc1')](_0x1cd38d[_0x23bd('0x7a')][_0x23bd('0xc3')],_['omit'](_0x1cd38d['body'],[_0x23bd('0xc3'),'id'])||{});}})[_0x23bd('0x2b')](respondWithResult(_0x2cab74,null))['catch'](handleError(_0x2cab74,null));};exports[_0x23bd('0xc4')]=function(_0x29a900,_0x52b506,_0x264a70){var _0x23eb64={'raw':![],'where':{}};var _0x6a936d={};var _0x401935={'count':0x0,'rows':[]};return db[_0x23bd('0xa3')][_0x23bd('0xc5')]({'where':{'id':_0x29a900[_0x23bd('0xbd')]['id']}})['then'](handleEntityNotFound(_0x52b506,null))['then'](function(_0x262764){if(_0x262764){_0x6a936d[_0x23bd('0x45')]=_[_0x23bd('0x47')](db[_0x23bd('0xc2')][_0x23bd('0x41')]);_0x6a936d['query']=_['keys'](_0x29a900['query']);_0x6a936d[_0x23bd('0x48')]=_[_0x23bd('0x49')](_0x6a936d[_0x23bd('0x45')],_0x6a936d[_0x23bd('0x46')]);_0x23eb64['attributes']=_[_0x23bd('0x49')](_0x6a936d[_0x23bd('0x45')],qs[_0x23bd('0x4a')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x23eb64[_0x23bd('0x4b')]=_0x23eb64[_0x23bd('0x4b')][_0x23bd('0x67')]?_0x23eb64[_0x23bd('0x4b')]:_0x6a936d[_0x23bd('0x45')];if(!_0x29a900[_0x23bd('0x46')][_0x23bd('0x4c')](_0x23bd('0x4d'))){_0x23eb64[_0x23bd('0x25')]=qs[_0x23bd('0x25')](_0x29a900['query'][_0x23bd('0x25')]);_0x23eb64[_0x23bd('0x23')]=qs[_0x23bd('0x23')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x23')]);}_0x23eb64[_0x23bd('0x4e')]=qs[_0x23bd('0x4f')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x4f')]);_0x23eb64[_0x23bd('0x7e')]=qs[_0x23bd('0x48')](_[_0x23bd('0x50')](_0x29a900[_0x23bd('0x46')],_0x6a936d[_0x23bd('0x48')]));_0x23eb64[_0x23bd('0x7e')]['FaxInteractionId']=_0x262764['id'];if(_0x29a900['query'][_0x23bd('0x8e')]){_0x23eb64[_0x23bd('0x7e')]=_['merge'](_0x23eb64[_0x23bd('0x7e')],{'$or':_[_0x23bd('0x31')](_0x23eb64[_0x23bd('0x4b')],function(_0x5c2029){var _0x852ea6={};_0x852ea6[_0x5c2029]={'$like':'%'+_0x29a900[_0x23bd('0x46')][_0x23bd('0x8e')]+'%'};return _0x852ea6;})});}if(_0x29a900[_0x23bd('0x46')][_0x23bd('0x82')]){var _0xbea4c0=_0x29a900[_0x23bd('0x46')][_0x23bd('0x82')]['split'](',');var _0x180109={};_0x180109[_0xbea4c0[0x0]]={'$gte':moment(_0xbea4c0[0x1])['format'](_0x23bd('0xc6'))};_0x23eb64[_0x23bd('0x7e')]=_[_0x23bd('0xc7')](_0x23eb64[_0x23bd('0x7e')],_0x180109);}_0x23eb64=_[_0x23bd('0xc7')]({},_0x23eb64,_0x29a900[_0x23bd('0xc8')]);return db[_0x23bd('0xc2')][_0x23bd('0x26')]({'where':_0x23eb64[_0x23bd('0x7e')]})[_0x23bd('0x2b')](function(_0x12712b){_0x401935[_0x23bd('0x26')]=_0x12712b;if(_0x29a900[_0x23bd('0x46')][_0x23bd('0xbe')]){_0x23eb64[_0x23bd('0xc9')]=[{'all':!![]}];}return db[_0x23bd('0xc2')][_0x23bd('0xca')](_0x23eb64);})[_0x23bd('0x2b')](function(_0x54c234){_0x401935['rows']=_0x54c234;return _0x401935;});}})[_0x23bd('0x2b')](respondWithFilteredResult(_0x52b506,_0x23eb64))['catch'](handleError(_0x52b506,null));};exports['addTags']=function(_0x3de7f8,_0x3a8767,_0x48d0ca){return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x3de7f8[_0x23bd('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a8767,null))[_0x23bd('0x2b')](function(_0x5d3c20){if(_0x5d3c20){return _0x5d3c20[_0x23bd('0xcb')](_0x3de7f8[_0x23bd('0x7a')]['ids'],_[_0x23bd('0xcc')](_0x3de7f8[_0x23bd('0x7a')],[_0x23bd('0xc3'),'id'])||{})['spread'](function(){return db[_0x23bd('0xcd')][_0x23bd('0xca')]({'attributes':['id',_0x23bd('0x2e'),'color'],'where':{'id':_0x3de7f8[_0x23bd('0x7a')]['ids']}});})[_0x23bd('0x2b')](function(_0x35bd3b){socket[_0x23bd('0xce')](_0x23bd('0xcf'),{'id':Number(_0x3de7f8[_0x23bd('0xbd')]['id']),'tags':_0x35bd3b||[]});return{'id':Number(_0x3de7f8[_0x23bd('0xbd')]['id']),'tags':_0x35bd3b||[]};});}})[_0x23bd('0x2b')](respondWithResult(_0x3a8767,null))[_0x23bd('0x38')](handleError(_0x3a8767,null));};exports[_0x23bd('0xd0')]=function(_0x40fcfa,_0x54a3cf,_0x123ba7){return db[_0x23bd('0xa3')][_0x23bd('0x68')]({'where':{'id':_0x40fcfa[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x54a3cf,null))['then'](function(_0x3ec75d){if(_0x3ec75d){return _0x3ec75d[_0x23bd('0xd0')](_0x40fcfa[_0x23bd('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x54a3cf,null))[_0x23bd('0x38')](handleError(_0x54a3cf,null));};exports[_0x23bd('0xd1')]=function(_0x5e9a5e,_0x3b0b1b){var _0x1301f3=moment()['unix']()[_0x23bd('0xa1')]();var _0x5c7d8d=path['join'](config[_0x23bd('0xd2')],'server',_0x23bd('0xd3'),_0x23bd('0xd4'));var _0x4f8ccc=path[_0x23bd('0xd5')](config[_0x23bd('0xd2')],_0x23bd('0xd6'),_0x23bd('0xd3'),_0x23bd('0xd7'));var _0x25a2cd=path[_0x23bd('0xd5')](_0x5c7d8d,_0x1301f3);var _0x4bdbfd=util[_0x23bd('0xd8')](_0x23bd('0xd9'),_0x5e9a5e[_0x23bd('0xbd')]['id'],_0x1301f3);var _0x2451d3=path['join'](_0x5c7d8d,_0x4bdbfd);var _0x5d2482=[];_0x5d2482[_0x23bd('0x37')]({'model':db[_0x23bd('0xda')],'as':_0x23bd('0xda'),'raw':!![]});var _0x47d4fb=[{'model':db[_0x23bd('0xc2')],'as':_0x23bd('0xdb'),'attributes':['id',_0x23bd('0x7a'),'createdAt'],'include':_0x5d2482}];return db[_0x23bd('0xa3')][_0x23bd('0x68')]({'where':{'id':_0x5e9a5e['params']['id']},'include':_0x47d4fb})[_0x23bd('0x2b')](handleEntityNotFound(_0x3b0b1b,null))[_0x23bd('0x2b')](function(_0x2580c2){if(_0x2580c2&&_0x2580c2[_0x23bd('0xdb')]){var _0xbba42e=_0x2580c2[_0x23bd('0xdc')]({'plain':!![]});fs[_0x23bd('0xdd')](_0x25a2cd);for(var _0x1cb6cc=0x0;_0x1cb6cc<_0xbba42e['Messages'][_0x23bd('0x67')];_0x1cb6cc++){var _0x2c5937=_0xbba42e[_0x23bd('0xdb')][_0x1cb6cc][_0x23bd('0xda')];if(_0x2c5937){var _0x3fc51b=path[_0x23bd('0xd5')](_0x4f8ccc,_0x2c5937['basename']);if(fs[_0x23bd('0xde')](_0x3fc51b)){fs[_0x23bd('0xdf')](_0x3fc51b)['pipe'](fs[_0x23bd('0xe0')](path['join'](_0x25a2cd,_0x2c5937['basename'])));}}}return BPromise[_0x23bd('0xe1')]()[_0x23bd('0x2b')](function(){return new BPromise(function(_0xd17731,_0x30db66){zipdir(_0x25a2cd,{'saveTo':_0x2451d3},function(_0x2c5c17,_0x26dc7a){if(_0x2c5c17)return _0x30db66(_0x2c5c17);return _0xd17731(_0x26dc7a);});})[_0x23bd('0x2b')](function(){return new BPromise(function(_0x3659b4,_0x2ed971){rimraf(_0x25a2cd,function(_0x26ba4c){if(_0x26ba4c)_0x2ed971(_0x26ba4c);return _0x3659b4();});});})[_0x23bd('0x2b')](function(){return _0x3b0b1b['download'](_0x2451d3,_0x4bdbfd,function(_0x3b96ab){if(_0x3b96ab){console[_0x23bd('0xe2')](_0x23bd('0xe3'),_0x3b96ab);}else{fs['unlinkSync'](_0x2451d3);}});});});}else{return _0x3b0b1b['sendStatus'](0xc8);}})[_0x23bd('0x38')](handleError(_0x3b0b1b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 5bef9b2..4cbf201 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 _0xd834=['remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update'];(function(_0x1a73dd,_0x1dfbdf){var _0x43ca77=function(_0x7abda8){while(--_0x7abda8){_0x1a73dd['push'](_0x1a73dd['shift']());}};_0x43ca77(++_0x1dfbdf);}(_0xd834,0xc0));var _0x4d83=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd834[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x4d83('0x0'));var FaxInteraction=require(_0x4d83('0x1'))['db'][_0x4d83('0x2')];var FaxMessage=require(_0x4d83('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4d83('0x3')](0x0);var events={'afterCreate':_0x4d83('0x4'),'afterUpdate':_0x4d83('0x5'),'afterDestroy':_0x4d83('0x6')};function emitEvent(_0x49be03){return function(_0x2cecd0,_0x3a3417,_0x181251){_0x2cecd0[_0x4d83('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d83('0x8')](function(_0x4f5af1){_0x2cecd0['setDataValue'](_0x4d83('0x9'),_0x4f5af1[_0x4d83('0xa')](function(_0x172e1f){return{'id':_0x172e1f['id']};}));return FaxMessage[_0x4d83('0xb')]({'where':{'FaxInteractionId':_0x2cecd0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d83('0x8')](function(_0x42acf9){_0x2cecd0[_0x4d83('0xc')]('unreadMessages',_0x42acf9[_0x4d83('0xd')]);FaxInteractionEvents[_0x4d83('0xe')](_0x49be03+':'+_0x2cecd0['id'],_0x2cecd0);FaxInteractionEvents['emit'](_0x49be03,_0x2cecd0);_0x181251(null);})[_0x4d83('0xf')](_0x181251(null));};}for(var e in events){if(events[_0x4d83('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4d83('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x7f66=['emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f66,0x74));var _0x67f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f66[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x67f6('0x0'))['db'][_0x67f6('0x1')];var FaxMessage=require(_0x67f6('0x0'))['db'][_0x67f6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x67f6('0x3')](0x0);var events={'afterCreate':_0x67f6('0x4'),'afterUpdate':'update','afterDestroy':_0x67f6('0x5')};function emitEvent(_0x109496){return function(_0x11ac8a,_0x414028,_0xb5f69e){_0x11ac8a[_0x67f6('0x6')]({'attributes':['id'],'raw':!![]})[_0x67f6('0x7')](function(_0x50988e){_0x11ac8a[_0x67f6('0x8')](_0x67f6('0x9'),_0x50988e[_0x67f6('0xa')](function(_0x59486f){return{'id':_0x59486f['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x11ac8a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xf1a643){_0x11ac8a[_0x67f6('0x8')]('unreadMessages',_0xf1a643[_0x67f6('0xb')]);FaxInteractionEvents['emit'](_0x109496+':'+_0x11ac8a['id'],_0x11ac8a);FaxInteractionEvents[_0x67f6('0xc')](_0x109496,_0x11ac8a);_0xb5f69e(null);})[_0x67f6('0xd')](_0xb5f69e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x67f6('0xe')](e,emitEvent(event));}}module[_0x67f6('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6e571c8..59942f5 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 _0xa081=['moment','bluebird','request-promise','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api'];(function(_0x45b324,_0x19e339){var _0x5319a3=function(_0x345c81){while(--_0x345c81){_0x45b324['push'](_0x45b324['shift']());}};_0x5319a3(++_0x19e339);}(_0xa081,0xb4));var _0x1a08=function(_0x3dd43a,_0x44fb1d){_0x3dd43a=_0x3dd43a-0x0;var _0x54a682=_0xa081[_0x3dd43a];return _0x54a682;};'use strict';var _=require(_0x1a08('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1a08('0x1'));var moment=require(_0x1a08('0x2'));var BPromise=require(_0x1a08('0x3'));var rp=require(_0x1a08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a08('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x1a08('0x6')]=function(_0x55b259,_0x35a0fa){return _0x55b259[_0x1a08('0x7')](_0x1a08('0x8'),attributes,{'tableName':_0x1a08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ee57f,_0x53d44d,_0x4c89af){if(_0x4ee57f[_0x1a08('0xa')](_0x1a08('0xb'))){_0x4ee57f[_0x1a08('0xc')]=moment()['format'](_0x1a08('0xd'));}_0x4c89af(null,_0x4ee57f);}}});}; \ No newline at end of file +var _0xc599=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0xe7d42b,_0x1e5a1c){var _0x356072=function(_0x174e93){while(--_0x174e93){_0xe7d42b['push'](_0xe7d42b['shift']());}};_0x356072(++_0x1e5a1c);}(_0xc599,0x123));var _0x9c59=function(_0x167211,_0x52c558){_0x167211=_0x167211-0x0;var _0x395f67=_0xc599[_0x167211];return _0x395f67;};'use strict';var _=require(_0x9c59('0x0'));var util=require(_0x9c59('0x1'));var logger=require(_0x9c59('0x2'))(_0x9c59('0x3'));var moment=require(_0x9c59('0x4'));var BPromise=require(_0x9c59('0x5'));var rp=require(_0x9c59('0x6'));var fs=require('fs');var path=require(_0x9c59('0x7'));var rimraf=require(_0x9c59('0x8'));var config=require('../../config/environment');var attributes=require(_0x9c59('0x9'));module[_0x9c59('0xa')]=function(_0x452511,_0x2bcf35){return _0x452511[_0x9c59('0xb')](_0x9c59('0xc'),attributes,{'tableName':_0x9c59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb963b,_0x8deecd,_0x368c1d){if(_0xb963b[_0x9c59('0xe')]('closed')){_0xb963b[_0x9c59('0xf')]=moment()[_0x9c59('0x10')](_0x9c59('0x11'));}_0x368c1d(null,_0xb963b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 33231fd..9fd2dd3 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 _0x737a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','ioredis'];(function(_0x41031d,_0x17a3ee){var _0x2606c8=function(_0x24b03a){while(--_0x24b03a){_0x41031d['push'](_0x41031d['shift']());}};_0x2606c8(++_0x17a3ee);}(_0x737a,0xa8));var _0xa737=function(_0x358b4e,_0x518360){_0x358b4e=_0x358b4e-0x0;var _0x53634c=_0x737a[_0x358b4e];return _0x53634c;};'use strict';var _=require(_0xa737('0x0'));var util=require(_0xa737('0x1'));var moment=require(_0xa737('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa737('0x3'));var db=require(_0xa737('0x4'))['db'];var utils=require(_0xa737('0x5'));var logger=require(_0xa737('0x6'))(_0xa737('0x7'));var config=require(_0xa737('0x8'));var jayson=require(_0xa737('0x9'));var client=jayson[_0xa737('0xa')][_0xa737('0xb')]({'port':0x232a});config[_0xa737('0xc')]=_['defaults'](config[_0xa737('0xc')],{'host':_0xa737('0xd'),'port':0x18eb});var socket=require(_0xa737('0xe'))(new Redis(config[_0xa737('0xc')]));require('./faxInteraction.socket')[_0xa737('0xf')](socket);function respondWithRpcPromise(_0x1132ce,_0x244425,_0xcc8927){return new BPromise(function(_0x1f87c8,_0x414acb){return client[_0xa737('0x10')](_0x1132ce,_0xcc8927)[_0xa737('0x11')](function(_0x200101){logger['info'](_0xa737('0x12'),_0x244425,_0xa737('0x13'));logger['debug'](_0xa737('0x14'),_0x244425,'request\x20sent',JSON[_0xa737('0x15')](_0x200101));if(_0x200101[_0xa737('0x16')]){if(_0x200101[_0xa737('0x16')]['code']===0x1f4){logger[_0xa737('0x16')](_0xa737('0x12'),_0x244425,_0x200101['error'][_0xa737('0x17')]);return _0x414acb(_0x200101['error'][_0xa737('0x17')]);}logger['error'](_0xa737('0x12'),_0x244425,_0x200101['error'][_0xa737('0x17')]);return _0x1f87c8(_0x200101[_0xa737('0x16')][_0xa737('0x17')]);}else{logger[_0xa737('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x244425,_0xa737('0x13'));_0x1f87c8(_0x200101['result'][_0xa737('0x17')]);}})['catch'](function(_0x2cf624){logger[_0xa737('0x16')](_0xa737('0x12'),_0x244425,_0x2cf624);_0x414acb(_0x2cf624);});});}exports['UpdateFaxInteraction']=function(_0x372a1d){var _0x5f118f=this;return new Promise(function(_0x14c17d,_0xdbfa03){return db[_0xa737('0x19')][_0xa737('0x1a')](_0x372a1d[_0xa737('0x1b')],{'raw':_0x372a1d[_0xa737('0x1c')]?_0x372a1d[_0xa737('0x1c')][_0xa737('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x372a1d[_0xa737('0x1c')]?_0x372a1d[_0xa737('0x1c')][_0xa737('0x1e')]||null:null,'attributes':_0x372a1d[_0xa737('0x1c')]?_0x372a1d['options'][_0xa737('0x1f')]||null:null,'limit':_0x372a1d[_0xa737('0x1c')]?_0x372a1d[_0xa737('0x1c')][_0xa737('0x20')]||null:null})[_0xa737('0x11')](function(_0x5c842e){logger[_0xa737('0x18')](_0xa737('0x21'),_0x372a1d);logger['debug']('UpdateFaxInteraction',_0x372a1d,JSON[_0xa737('0x15')](_0x5c842e));_0x14c17d(_0x5c842e);})[_0xa737('0x22')](function(_0x2b80dd){logger[_0xa737('0x16')](_0xa737('0x21'),_0x2b80dd[_0xa737('0x17')],_0x372a1d);_0xdbfa03(_0x5f118f[_0xa737('0x16')](0x1f4,_0x2b80dd['message']));});});};exports[_0xa737('0x23')]=function(_0x5ecbb3){return new Promise(function(_0x18c75d,_0xda9622){return db[_0xa737('0x19')][_0xa737('0x24')]({'where':_0x5ecbb3['options']?_0x5ecbb3[_0xa737('0x1c')][_0xa737('0x1e')]||null:null})[_0xa737('0x11')](function(_0x5aa030){if(_0x5aa030){return _0x5aa030[_0xa737('0x25')](_0x5ecbb3[_0xa737('0x1b')][_0xa737('0x26')],_[_0xa737('0x27')](_0x5ecbb3[_0xa737('0x1b')],[_0xa737('0x26'),'id'])||{});}})[_0xa737('0x28')](function(_0x2a39b8){logger['info'](_0xa737('0x29'),_0x5ecbb3);logger[_0xa737('0x2a')](_0xa737('0x29'),_0x5ecbb3,JSON[_0xa737('0x15')](_0x2a39b8));_0x18c75d(_0x2a39b8);})[_0xa737('0x22')](function(_0x1b17d6){logger[_0xa737('0x16')](_0xa737('0x29'),_0x1b17d6[_0xa737('0x17')],_0x5ecbb3);_0xda9622(_this['error'](0x1f4,_0x1b17d6[_0xa737('0x17')]));});});}; \ No newline at end of file +var _0xeb36=['./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter'];(function(_0x349077,_0x2eafb1){var _0x277000=function(_0x26de51){while(--_0x26de51){_0x349077['push'](_0x349077['shift']());}};_0x277000(++_0x2eafb1);}(_0xeb36,0x66));var _0x6eb3=function(_0x357ac5,_0x5d030){_0x357ac5=_0x357ac5-0x0;var _0x1534bd=_0xeb36[_0x357ac5];return _0x1534bd;};'use strict';var _=require('lodash');var util=require(_0x6eb3('0x0'));var moment=require(_0x6eb3('0x1'));var BPromise=require(_0x6eb3('0x2'));var rs=require(_0x6eb3('0x3'));var fs=require('fs');var Redis=require(_0x6eb3('0x4'));var db=require(_0x6eb3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6eb3('0x6'))('rpc');var config=require(_0x6eb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6eb3('0x8')]['http']({'port':0x232a});config[_0x6eb3('0x9')]=_['defaults'](config[_0x6eb3('0x9')],{'host':_0x6eb3('0xa'),'port':0x18eb});var socket=require(_0x6eb3('0xb'))(new Redis(config[_0x6eb3('0x9')]));require(_0x6eb3('0xc'))[_0x6eb3('0xd')](socket);function respondWithRpcPromise(_0x48f1d8,_0x291d0d,_0x628e38){return new BPromise(function(_0x18a41a,_0x2a207c){return client[_0x6eb3('0xe')](_0x48f1d8,_0x628e38)[_0x6eb3('0xf')](function(_0x2917bb){logger[_0x6eb3('0x10')](_0x6eb3('0x11'),_0x291d0d,'request\x20sent');logger[_0x6eb3('0x12')](_0x6eb3('0x13'),_0x291d0d,_0x6eb3('0x14'),JSON[_0x6eb3('0x15')](_0x2917bb));if(_0x2917bb['error']){if(_0x2917bb[_0x6eb3('0x16')][_0x6eb3('0x17')]===0x1f4){logger[_0x6eb3('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x291d0d,_0x2917bb[_0x6eb3('0x16')]['message']);return _0x2a207c(_0x2917bb[_0x6eb3('0x16')]['message']);}logger['error'](_0x6eb3('0x11'),_0x291d0d,_0x2917bb['error'][_0x6eb3('0x18')]);return _0x18a41a(_0x2917bb['error']['message']);}else{logger[_0x6eb3('0x10')](_0x6eb3('0x11'),_0x291d0d,_0x6eb3('0x14'));_0x18a41a(_0x2917bb['result'][_0x6eb3('0x18')]);}})[_0x6eb3('0x19')](function(_0x7c29cd){logger[_0x6eb3('0x16')](_0x6eb3('0x11'),_0x291d0d,_0x7c29cd);_0x2a207c(_0x7c29cd);});});}exports[_0x6eb3('0x1a')]=function(_0x36f150){var _0x59fff1=this;return new Promise(function(_0x1efc0e,_0x27d79c){return db[_0x6eb3('0x1b')]['update'](_0x36f150[_0x6eb3('0x1c')],{'raw':_0x36f150[_0x6eb3('0x1d')]?_0x36f150[_0x6eb3('0x1d')][_0x6eb3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f150['options']?_0x36f150['options'][_0x6eb3('0x1f')]||null:null,'attributes':_0x36f150['options']?_0x36f150[_0x6eb3('0x1d')][_0x6eb3('0x20')]||null:null,'limit':_0x36f150[_0x6eb3('0x1d')]?_0x36f150[_0x6eb3('0x1d')]['limit']||null:null})[_0x6eb3('0xf')](function(_0x3d8dce){logger[_0x6eb3('0x10')]('UpdateFaxInteraction',_0x36f150);logger['debug']('UpdateFaxInteraction',_0x36f150,JSON[_0x6eb3('0x15')](_0x3d8dce));_0x1efc0e(_0x3d8dce);})['catch'](function(_0x30b30f){logger[_0x6eb3('0x16')](_0x6eb3('0x1a'),_0x30b30f['message'],_0x36f150);_0x27d79c(_0x59fff1[_0x6eb3('0x16')](0x1f4,_0x30b30f['message']));});});};exports[_0x6eb3('0x21')]=function(_0x555fe9){return new Promise(function(_0x9a8a17,_0x31d9d2){return db['FaxInteraction']['find']({'where':_0x555fe9[_0x6eb3('0x1d')]?_0x555fe9[_0x6eb3('0x1d')][_0x6eb3('0x1f')]||null:null})['then'](function(_0x3ce89c){if(_0x3ce89c){return _0x3ce89c[_0x6eb3('0x22')](_0x555fe9[_0x6eb3('0x1c')][_0x6eb3('0x23')],_[_0x6eb3('0x24')](_0x555fe9[_0x6eb3('0x1c')],[_0x6eb3('0x23'),'id'])||{});}})['spread'](function(_0x4f821c){logger[_0x6eb3('0x10')](_0x6eb3('0x25'),_0x555fe9);logger['debug'](_0x6eb3('0x25'),_0x555fe9,JSON[_0x6eb3('0x15')](_0x4f821c));_0x9a8a17(_0x4f821c);})['catch'](function(_0x11d5ef){logger[_0x6eb3('0x16')](_0x6eb3('0x25'),_0x11d5ef['message'],_0x555fe9);_0x31d9d2(_this['error'](0x1f4,_0x11d5ef[_0x6eb3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e5d29f2..5653b56 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 _0xb321=['emit','removeListener','length','save','remove','update'];(function(_0x9fd1b3,_0xed8920){var _0x10f4c1=function(_0x3f12d0){while(--_0x3f12d0){_0x9fd1b3['push'](_0x9fd1b3['shift']());}};_0x10f4c1(++_0xed8920);}(_0xb321,0x17d));var _0x1b32=function(_0x1ab47d,_0x1d5f69){_0x1ab47d=_0x1ab47d-0x0;var _0x4a182b=_0xb321[_0x1ab47d];return _0x4a182b;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x1b32('0x0'),_0x1b32('0x1'),_0x1b32('0x2')];function createListener(_0x151010,_0x154e27){return function(_0x16de9c){_0x154e27[_0x1b32('0x3')](_0x151010,_0x16de9c);};}function removeListener(_0x42004c,_0xa3ba55){return function(){FaxInteractionEvents[_0x1b32('0x4')](_0x42004c,_0xa3ba55);};}exports['register']=function(_0x2ed776){for(var _0x4b0bad=0x0,_0x5945b0=events[_0x1b32('0x5')];_0x4b0bad<_0x5945b0;_0x4b0bad++){var _0x5de3a4=events[_0x4b0bad];var _0x5ce4ca=createListener('faxInteraction:'+_0x5de3a4,_0x2ed776);FaxInteractionEvents['on'](_0x5de3a4,_0x5ce4ca);}}; \ No newline at end of file +var _0x8190=['faxInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x204967,_0x2a506a){var _0x134dff=function(_0x3acfb2){while(--_0x3acfb2){_0x204967['push'](_0x204967['shift']());}};_0x134dff(++_0x2a506a);}(_0x8190,0x12e));var _0x0819=function(_0x268ce0,_0x596a6e){_0x268ce0=_0x268ce0-0x0;var _0x207df1=_0x8190[_0x268ce0];return _0x207df1;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0819('0x0'),_0x0819('0x1'),_0x0819('0x2')];function createListener(_0xf4e19e,_0x4d7d6b){return function(_0x448f53){_0x4d7d6b[_0x0819('0x3')](_0xf4e19e,_0x448f53);};}function removeListener(_0x52ffc6,_0x4b54de){return function(){FaxInteractionEvents[_0x0819('0x4')](_0x52ffc6,_0x4b54de);};}exports[_0x0819('0x5')]=function(_0x328558){for(var _0x50e91b=0x0,_0x1428fc=events['length'];_0x50e91b<_0x1428fc;_0x50e91b++){var _0x4c9fb9=events[_0x50e91b];var _0x22a2c1=createListener(_0x0819('0x6')+_0x4c9fb9,_0x328558);FaxInteractionEvents['on'](_0x4c9fb9,_0x22a2c1);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 16b8bc8..174bcd8 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 _0xace9=['delete','destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','create','post','/:id/messages','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update'];(function(_0x514e38,_0x18958d){var _0x57305d=function(_0x2fab9a){while(--_0x2fab9a){_0x514e38['push'](_0x514e38['shift']());}};_0x57305d(++_0x18958d);}(_0xace9,0x14e));var _0x9ace=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0xace9[_0x13f9c3];return _0x22185a;};'use strict';var multer=require(_0x9ace('0x0'));var util=require(_0x9ace('0x1'));var path=require(_0x9ace('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ace('0x3')]();var fs_extra=require(_0x9ace('0x4'));var auth=require(_0x9ace('0x5'));var interaction=require(_0x9ace('0x6'));var config=require(_0x9ace('0x7'));var controller=require(_0x9ace('0x8'));router['get']('/',auth[_0x9ace('0x9')](),controller[_0x9ace('0xa')]);router[_0x9ace('0xb')](_0x9ace('0xc'),auth[_0x9ace('0x9')](),controller[_0x9ace('0xd')]);router[_0x9ace('0xb')](_0x9ace('0xe'),auth[_0x9ace('0x9')](),controller[_0x9ace('0xf')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x9ace('0x10'),auth[_0x9ace('0x9')](),controller[_0x9ace('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9ace('0x12')]);router[_0x9ace('0x13')](_0x9ace('0x14'),auth[_0x9ace('0x9')](),controller['addMessage']);router[_0x9ace('0x13')](_0x9ace('0x15'),auth['isAuthenticated'](),interaction[_0x9ace('0x16')](_0x9ace('0x17'),_0x9ace('0x18')),controller[_0x9ace('0x19')]);router[_0x9ace('0x1a')]('/:id',auth[_0x9ace('0x9')](),interaction['tracked'](_0x9ace('0x17'),_0x9ace('0x1b')),controller[_0x9ace('0x1c')]);router[_0x9ace('0x1d')](_0x9ace('0xe'),auth['isAuthenticated'](),interaction[_0x9ace('0x16')](_0x9ace('0x17'),'faxinteraction:destroy'),controller[_0x9ace('0x1e')]);router[_0x9ace('0x1d')]('/:id/tags',auth[_0x9ace('0x9')](),controller[_0x9ace('0x1f')]);module[_0x9ace('0x20')]=router; \ No newline at end of file +var _0xe300=['addTags','put','tracked','fax','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','/:id/messages','addMessage','faxinteraction:addtags'];(function(_0x37f1ec,_0x4e5888){var _0x487919=function(_0xfa5bb1){while(--_0xfa5bb1){_0x37f1ec['push'](_0x37f1ec['shift']());}};_0x487919(++_0x4e5888);}(_0xe300,0xa4));var _0x0e30=function(_0x130ba1,_0x598cbc){_0x130ba1=_0x130ba1-0x0;var _0x192471=_0xe300[_0x130ba1];return _0x192471;};'use strict';var multer=require(_0x0e30('0x0'));var util=require(_0x0e30('0x1'));var path=require('path');var timeout=require(_0x0e30('0x2'));var express=require(_0x0e30('0x3'));var router=express[_0x0e30('0x4')]();var fs_extra=require(_0x0e30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e30('0x6'));var config=require(_0x0e30('0x7'));var controller=require(_0x0e30('0x8'));router[_0x0e30('0x9')]('/',auth[_0x0e30('0xa')](),controller[_0x0e30('0xb')]);router['get'](_0x0e30('0xc'),auth[_0x0e30('0xa')](),controller[_0x0e30('0xd')]);router[_0x0e30('0x9')](_0x0e30('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0e30('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0e30('0xf')]);router[_0x0e30('0x9')](_0x0e30('0x10'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x11')]);router['post']('/',auth[_0x0e30('0xa')](),controller['create']);router[_0x0e30('0x12')](_0x0e30('0x13'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x14')]);router[_0x0e30('0x12')]('/:id/tags',auth[_0x0e30('0xa')](),interaction['tracked']('fax',_0x0e30('0x15')),controller[_0x0e30('0x16')]);router[_0x0e30('0x17')]('/:id',auth[_0x0e30('0xa')](),interaction[_0x0e30('0x18')](_0x0e30('0x19'),'faxinteraction:update'),controller['update']);router[_0x0e30('0x1a')](_0x0e30('0xe'),auth[_0x0e30('0xa')](),interaction[_0x0e30('0x18')](_0x0e30('0x19'),_0x0e30('0x1b')),controller['destroy']);router[_0x0e30('0x1a')](_0x0e30('0x1c'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x1d')]);module[_0x0e30('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0a2fb30..b1ba57e 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 _0x9c44=['out','TEXT','medium','BOOLEAN','ENUM'];(function(_0x10eed4,_0x3926b2){var _0x46952b=function(_0x586cd3){while(--_0x586cd3){_0x10eed4['push'](_0x10eed4['shift']());}};_0x46952b(++_0x3926b2);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x49c4('0x3')]('in',_0x49c4('0x4')),'defaultValue':_0x49c4('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x22fb=['ENUM','out','TEXT','BOOLEAN'];(function(_0x17d58d,_0x4f2093){var _0x3316bb=function(_0x6270ad){while(--_0x6270ad){_0x17d58d['push'](_0x17d58d['shift']());}};_0x3316bb(++_0x4f2093);}(_0x22fb,0x192));var _0xb22f=function(_0x1d113d,_0x4d8726){_0x1d113d=_0x1d113d-0x0;var _0x2f49fa=_0x22fb[_0x1d113d];return _0x2f49fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb22f('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb22f('0x2')]('in',_0xb22f('0x3')),'defaultValue':_0xb22f('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xb22f('0x0')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 495858d..32cc406 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 _0x1eb6=['internal','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','sendStatus','name','send','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','VIRTUAL','filter','merge','options','where','includeAll','findAll','rows','params','include','find','update','body','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','FaxInteraction','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eb6,0x9b));var _0x61eb=function(_0x317794,_0xe3c196){_0x317794=_0x317794-0x0;var _0x41bcd7=_0x1eb6[_0x317794];return _0x41bcd7;};'use strict';var emlformat=require(_0x61eb('0x0'));var rimraf=require(_0x61eb('0x1'));var zipdir=require(_0x61eb('0x2'));var jsonpatch=require(_0x61eb('0x3'));var rp=require(_0x61eb('0x4'));var moment=require(_0x61eb('0x5'));var BPromise=require(_0x61eb('0x6'));var Mustache=require(_0x61eb('0x7'));var util=require(_0x61eb('0x8'));var path=require(_0x61eb('0x9'));var sox=require('sox');var csv=require(_0x61eb('0xa'));var ejs=require(_0x61eb('0xb'));var fs=require('fs');var fs_extra=require(_0x61eb('0xc'));var _=require(_0x61eb('0xd'));var squel=require(_0x61eb('0xe'));var crypto=require(_0x61eb('0xf'));var jsforce=require(_0x61eb('0x10'));var deskjs=require(_0x61eb('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61eb('0x12'));var Redis=require('ioredis');var authService=require(_0x61eb('0x13'));var qs=require(_0x61eb('0x14'));var as=require(_0x61eb('0x15'));var hardwareService=require(_0x61eb('0x16'));var logger=require(_0x61eb('0x17'))(_0x61eb('0x18'));var utils=require(_0x61eb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x61eb('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x61eb('0x1b')](config['redis'],{'host':_0x61eb('0x1c'),'port':0x18eb});var socket=require(_0x61eb('0x1d'))(new Redis(config[_0x61eb('0x1e')]));require(_0x61eb('0x1f'))[_0x61eb('0x20')](socket);var jayson=require(_0x61eb('0x21'));var client=jayson['client'][_0x61eb('0x22')]({'port':0x232c});var client9002=jayson[_0x61eb('0x23')][_0x61eb('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x217505,_0x10c55e,_0x3904f2,_0x47c032){return new BPromise(function(_0x1ef18b,_0x5a4aba){var _0x1860be=_0x47c032||client;return _0x1860be[_0x61eb('0x24')](_0x217505,_0x3904f2)[_0x61eb('0x25')](function(_0x462b9b){logger[_0x61eb('0x26')](_0x61eb('0x27'),_0x10c55e,_0x61eb('0x28'));logger[_0x61eb('0x29')](_0x61eb('0x2a'),_0x10c55e,_0x61eb('0x28'),JSON[_0x61eb('0x2b')](_0x462b9b));if(_0x462b9b[_0x61eb('0x2c')]){if(_0x462b9b[_0x61eb('0x2c')]['code']===0x1f4){logger['error'](_0x61eb('0x27'),_0x10c55e,_0x462b9b[_0x61eb('0x2c')][_0x61eb('0x2d')]);return _0x5a4aba(_0x462b9b[_0x61eb('0x2c')][_0x61eb('0x2d')]);}logger[_0x61eb('0x2c')](_0x61eb('0x27'),_0x10c55e,_0x462b9b[_0x61eb('0x2c')][_0x61eb('0x2d')]);return _0x1ef18b(_0x462b9b[_0x61eb('0x2c')][_0x61eb('0x2d')]);}else{logger[_0x61eb('0x26')](_0x61eb('0x27'),_0x10c55e,_0x61eb('0x28'));_0x1ef18b(_0x462b9b[_0x61eb('0x2e')][_0x61eb('0x2d')]);}})[_0x61eb('0x2f')](function(_0x15b3d9){logger['error'](_0x61eb('0x27'),_0x10c55e,_0x15b3d9);_0x5a4aba(_0x15b3d9);});});}function respondWithStatusCode(_0x2b603f,_0x3ac5d5){_0x3ac5d5=_0x3ac5d5||0xcc;return function(_0x29f605){if(_0x29f605){return _0x2b603f['sendStatus'](_0x3ac5d5);}return _0x2b603f[_0x61eb('0x30')](_0x3ac5d5)[_0x61eb('0x31')]();};}function respondWithResult(_0x53370c,_0x5e3ced){_0x5e3ced=_0x5e3ced||0xc8;return function(_0x2a4d4f){if(_0x2a4d4f){return _0x53370c['status'](_0x5e3ced)[_0x61eb('0x32')](_0x2a4d4f);}};}function respondWithFilteredResult(_0x533c6e,_0x110dde){return function(_0x2a4cda){if(_0x2a4cda){var _0x1a08f2=typeof _0x110dde[_0x61eb('0x33')]===_0x61eb('0x34')&&typeof _0x110dde[_0x61eb('0x35')]===_0x61eb('0x34');var _0x4b6024=_0x2a4cda[_0x61eb('0x36')];var _0x4d9b16=_0x1a08f2?0x0:_0x110dde[_0x61eb('0x33')];var _0x21df57=_0x1a08f2?_0x2a4cda[_0x61eb('0x36')]:_0x110dde[_0x61eb('0x33')]+_0x110dde['limit'];var _0x2444d4;if(_0x21df57>=_0x4b6024){_0x21df57=_0x4b6024;_0x2444d4=0xc8;}else{_0x2444d4=0xce;}_0x533c6e[_0x61eb('0x30')](_0x2444d4);return _0x533c6e[_0x61eb('0x37')](_0x61eb('0x38'),_0x4d9b16+'-'+_0x21df57+'/'+_0x4b6024)[_0x61eb('0x32')](_0x2a4cda);}return null;};}function patchUpdates(_0x52c93f){return function(_0x128eca){try{jsonpatch['apply'](_0x128eca,_0x52c93f,!![]);}catch(_0x53b48c){return BPromise[_0x61eb('0x39')](_0x53b48c);}return _0x128eca['save']();};}function saveUpdates(_0x1047a8,_0x326d4f){return function(_0x107141){if(_0x107141){return _0x107141['update'](_0x1047a8)['then'](function(_0x5adba7){return _0x5adba7;});}return null;};}function removeEntity(_0x4d247c,_0x548925){return function(_0x2dde26){if(_0x2dde26){return _0x2dde26[_0x61eb('0x3a')]()[_0x61eb('0x25')](function(){_0x4d247c['status'](0xcc)[_0x61eb('0x31')]();});}};}function handleEntityNotFound(_0x5272ed,_0xf3417e){return function(_0x32d286){if(!_0x32d286){_0x5272ed[_0x61eb('0x3b')](0x194);}return _0x32d286;};}function handleError(_0x1bdfd4,_0x1c312b){_0x1c312b=_0x1c312b||0x1f4;return function(_0x2a6356){logger[_0x61eb('0x2c')](_0x2a6356['stack']);if(_0x2a6356[_0x61eb('0x3c')]){delete _0x2a6356['name'];}_0x1bdfd4['status'](_0x1c312b)[_0x61eb('0x3d')](_0x2a6356);};}exports['index']=function(_0x3d6386,_0x9c1c84){var _0x56a327={},_0x536c98={},_0x2c6a97={'count':0x0,'rows':[]};var _0xdbd1e1=_[_0x61eb('0x3e')](db[_0x61eb('0x3f')][_0x61eb('0x40')],function(_0x3aaf75){return{'name':_0x3aaf75[_0x61eb('0x41')],'type':_0x3aaf75[_0x61eb('0x42')]['key']};});_0x536c98[_0x61eb('0x43')]=_[_0x61eb('0x3e')](_0xdbd1e1,'name');_0x536c98[_0x61eb('0x44')]=_[_0x61eb('0x45')](_0x3d6386[_0x61eb('0x44')]);_0x536c98['filters']=_[_0x61eb('0x46')](_0x536c98[_0x61eb('0x43')],_0x536c98[_0x61eb('0x44')]);_0x56a327[_0x61eb('0x47')]=_['intersection'](_0x536c98[_0x61eb('0x43')],qs[_0x61eb('0x48')](_0x3d6386[_0x61eb('0x44')][_0x61eb('0x48')]));_0x56a327[_0x61eb('0x47')]=_0x56a327[_0x61eb('0x47')][_0x61eb('0x49')]?_0x56a327['attributes']:_0x536c98[_0x61eb('0x43')];if(!_0x3d6386[_0x61eb('0x44')][_0x61eb('0x4a')]('nolimit')){_0x56a327[_0x61eb('0x35')]=qs[_0x61eb('0x35')](_0x3d6386['query'][_0x61eb('0x35')]);_0x56a327[_0x61eb('0x33')]=qs[_0x61eb('0x33')](_0x3d6386['query'][_0x61eb('0x33')]);}_0x56a327[_0x61eb('0x4b')]=qs[_0x61eb('0x4c')](_0x3d6386[_0x61eb('0x44')]['sort']);_0x56a327['where']=qs[_0x61eb('0x4d')](_[_0x61eb('0x4e')](_0x3d6386['query'],_0x536c98[_0x61eb('0x4d')]),_0xdbd1e1);if(_0x3d6386[_0x61eb('0x44')]['filter']){_0x56a327['where']=_['merge'](_0x56a327['where'],{'$or':_[_0x61eb('0x3e')](_0xdbd1e1,function(_0x1f1aab){if(_0x1f1aab[_0x61eb('0x42')]!==_0x61eb('0x4f')){var _0x4f052b={};_0x4f052b[_0x1f1aab[_0x61eb('0x3c')]]={'$like':'%'+_0x3d6386['query'][_0x61eb('0x50')]+'%'};return _0x4f052b;}})});}_0x56a327=_[_0x61eb('0x51')]({},_0x56a327,_0x3d6386[_0x61eb('0x52')]);var _0x2b1619={'where':_0x56a327[_0x61eb('0x53')]};return db[_0x61eb('0x3f')][_0x61eb('0x36')](_0x2b1619)[_0x61eb('0x25')](function(_0x2105b4){_0x2c6a97['count']=_0x2105b4;if(_0x3d6386[_0x61eb('0x44')][_0x61eb('0x54')]){_0x56a327['include']=[{'all':!![]}];}return db[_0x61eb('0x3f')][_0x61eb('0x55')](_0x56a327);})[_0x61eb('0x25')](function(_0x16c358){_0x2c6a97[_0x61eb('0x56')]=_0x16c358;return _0x2c6a97;})[_0x61eb('0x25')](respondWithFilteredResult(_0x9c1c84,_0x56a327))[_0x61eb('0x2f')](handleError(_0x9c1c84,null));};exports['show']=function(_0x3ec435,_0x389578){var _0xe3913f={'raw':!![],'where':{'id':_0x3ec435[_0x61eb('0x57')]['id']}},_0x181e0a={};_0x181e0a[_0x61eb('0x43')]=_[_0x61eb('0x45')](db['FaxMessage'][_0x61eb('0x40')]);_0x181e0a[_0x61eb('0x44')]=_[_0x61eb('0x45')](_0x3ec435['query']);_0x181e0a[_0x61eb('0x4d')]=_[_0x61eb('0x46')](_0x181e0a[_0x61eb('0x43')],_0x181e0a[_0x61eb('0x44')]);_0xe3913f[_0x61eb('0x47')]=_[_0x61eb('0x46')](_0x181e0a[_0x61eb('0x43')],qs['fields'](_0x3ec435[_0x61eb('0x44')][_0x61eb('0x48')]));_0xe3913f[_0x61eb('0x47')]=_0xe3913f[_0x61eb('0x47')][_0x61eb('0x49')]?_0xe3913f[_0x61eb('0x47')]:_0x181e0a[_0x61eb('0x43')];if(_0x3ec435[_0x61eb('0x44')][_0x61eb('0x54')]){_0xe3913f[_0x61eb('0x58')]=[{'all':!![]}];}_0xe3913f=_[_0x61eb('0x51')]({},_0xe3913f,_0x3ec435[_0x61eb('0x52')]);return db[_0x61eb('0x3f')][_0x61eb('0x59')](_0xe3913f)[_0x61eb('0x25')](handleEntityNotFound(_0x389578,null))[_0x61eb('0x25')](respondWithResult(_0x389578,null))[_0x61eb('0x2f')](handleError(_0x389578,null));};exports[_0x61eb('0x5a')]=function(_0x21c2d7,_0x2f9290){if(_0x21c2d7[_0x61eb('0x5b')]['id']){delete _0x21c2d7[_0x61eb('0x5b')]['id'];}return db['FaxMessage'][_0x61eb('0x59')]({'where':{'id':_0x21c2d7[_0x61eb('0x57')]['id']}})[_0x61eb('0x25')](handleEntityNotFound(_0x2f9290,null))[_0x61eb('0x25')](saveUpdates(_0x21c2d7[_0x61eb('0x5b')],null))[_0x61eb('0x25')](respondWithResult(_0x2f9290,null))[_0x61eb('0x2f')](handleError(_0x2f9290,null));};exports[_0x61eb('0x3a')]=function(_0x1a0ec8,_0x410fb0){return db[_0x61eb('0x3f')][_0x61eb('0x59')]({'where':{'id':_0x1a0ec8[_0x61eb('0x57')]['id']}})[_0x61eb('0x25')](handleEntityNotFound(_0x410fb0,null))[_0x61eb('0x25')](removeEntity(_0x410fb0,null))['catch'](handleError(_0x410fb0,null));};exports[_0x61eb('0x5c')]=function(_0x455d29,_0x33d05e){return db[_0x61eb('0x3f')][_0x61eb('0x5c')]()['then'](respondWithResult(_0x33d05e,null))[_0x61eb('0x2f')](handleError(_0x33d05e,null));};var interaction_log=require('../../config/logger')(_0x61eb('0x5d'));exports[_0x61eb('0x5e')]=function(_0x3357b9,_0x4959b0,_0x30eada){var _0x4049ea={'agent':{},'channel':_0x61eb('0x5f')};if(_0x3357b9[_0x61eb('0x5b')]['id']){delete _0x3357b9['body']['id'];}_0x3357b9[_0x61eb('0x5b')]['read']=!![];_0x3357b9[_0x61eb('0x5b')][_0x61eb('0x60')]=moment()[_0x61eb('0x61')](_0x61eb('0x62'));_0x3357b9['body'][_0x61eb('0x63')]=_0x3357b9[_0x61eb('0x5b')]['UserId']||_0x3357b9[_0x61eb('0x64')]['id'];_0x4049ea['agent']['id']=_0x3357b9[_0x61eb('0x5b')][_0x61eb('0x63')];return db[_0x61eb('0x3f')][_0x61eb('0x59')]({'where':{'id':_0x3357b9[_0x61eb('0x57')]['id'],'UserId':null}})[_0x61eb('0x25')](handleEntityNotFound(_0x4959b0,null))['then'](saveUpdates(_0x3357b9[_0x61eb('0x5b')],null))[_0x61eb('0x25')](function(_0x1063ca){if(_0x1063ca){_0x4049ea[_0x61eb('0x2d')]=_0x1063ca[_0x61eb('0x65')]({'plain':!![]});return db['FaxInteraction'][_0x61eb('0x59')]({'where':{'id':_0x1063ca[_0x61eb('0x66')]}});}return null;})[_0x61eb('0x25')](handleEntityNotFound(_0x4959b0,null))[_0x61eb('0x25')](function(_0x1e4494){if(_0x1e4494){return _0x1e4494[_0x61eb('0x5a')]({'UserId':_0x3357b9['body']['UserId'],'read1stAt':_[_0x61eb('0x67')](_0x1e4494[_0x61eb('0x68')])?moment()[_0x61eb('0x61')](_0x61eb('0x62')):undefined});}return null;})[_0x61eb('0x25')](function(_0x3ba3e6){if(_0x3ba3e6){_0x4049ea['interaction']=_0x3ba3e6['get']({'plain':!![]});interaction_log[_0x61eb('0x26')](_0x61eb('0x69'),_0x3357b9[_0x61eb('0x64')]['id'],_0x3357b9[_0x61eb('0x64')][_0x61eb('0x3c')],_0x3357b9[_0x61eb('0x64')][_0x61eb('0x6a')],_0x4049ea['interaction']['id'],_0x3357b9[_0x61eb('0x5b')]?JSON['stringify'](_0x3357b9[_0x61eb('0x5b')]):_0x61eb('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x61eb('0x6c'),_0x4049ea);}return null;})[_0x61eb('0x25')](function(_0x468291){var _0x47077d=_0x61eb('0x6d')+_0x468291[_0x61eb('0x2d')]['ContactId'];return db[_0x61eb('0x6e')][_0x61eb('0x44')](_0x47077d,{'type':db[_0x61eb('0x6f')][_0x61eb('0x70')][_0x61eb('0x71')],'raw':!![]})[_0x61eb('0x25')](function(_0x2e52a1){return _0x2e52a1;});})[_0x61eb('0x25')](function(_0x3519e0){if(_0x3519e0){_0x4049ea[_0x61eb('0x2d')][_0x61eb('0x72')]=_0x3519e0[0x0];if(!_0x3357b9['body'][_0x61eb('0x63')])return;return db[_0x61eb('0x73')][_0x61eb('0x59')]({'where':{'id':_0x3357b9[_0x61eb('0x5b')][_0x61eb('0x63')],'role':_0x61eb('0x74')},'attributes':['id',_0x61eb('0x3c'),_0x61eb('0x75'),_0x61eb('0x76'),'internal'],'raw':!![]});}return null;})[_0x61eb('0x25')](function(_0x35196d){if(!_0x35196d)return null;_0x4049ea['message']['agent']=_0x35196d;return _0x4049ea;})[_0x61eb('0x25')](function(_0x2a2a57){if(_0x2a2a57){if(_0x3357b9[_0x61eb('0x5b')][_0x61eb('0x77')]){_0x4049ea[_0x61eb('0x2d')][_0x61eb('0x78')]=util[_0x61eb('0x61')](_0x61eb('0x79'),_0x3357b9[_0x61eb('0x64')]['name']);_0x4049ea['message'][_0x61eb('0x7a')]=_0x4049ea['channel'];_0x4049ea['message']['motionChannel']=_0x4049ea[_0x61eb('0x7a')];_0x4049ea[_0x61eb('0x2d')][_0x61eb('0x7b')]='accept';return respondWithRpcPromise(_0x61eb('0x7c'),_0x61eb('0x7c'),{'event':'acceptmessage','message':_0x4049ea[_0x61eb('0x2d')]},client9002)[_0x61eb('0x25')](function(){return _0x4049ea;});}return _0x4049ea;}return null;})[_0x61eb('0x25')](respondWithResult(_0x4959b0,null))[_0x61eb('0x2f')](handleError(_0x4959b0,null));};var interaction_log=require(_0x61eb('0x17'))(_0x61eb('0x5d'));exports['reject']=function(_0x513ae0,_0x294e74,_0x340d85){var _0x4fc17f={'agent':{},'channel':'fax'};if(_0x513ae0['body']['id']){delete _0x513ae0[_0x61eb('0x5b')]['id'];}_0x513ae0['body']['UserId']=_0x513ae0[_0x61eb('0x5b')]['UserId']||_0x513ae0['user']['id'];_0x4fc17f[_0x61eb('0x74')]['id']=_0x513ae0[_0x61eb('0x5b')][_0x61eb('0x63')];return db['FaxMessage'][_0x61eb('0x59')]({'where':{'id':_0x513ae0[_0x61eb('0x57')]['id'],'UserId':null}})[_0x61eb('0x25')](handleEntityNotFound(_0x294e74,null))[_0x61eb('0x25')](function(_0x3e6fb5){if(_0x3e6fb5){_0x4fc17f[_0x61eb('0x2d')]=_0x3e6fb5[_0x61eb('0x65')]({'plain':!![]});return db[_0x61eb('0x7d')][_0x61eb('0x59')]({'where':{'id':_0x3e6fb5[_0x61eb('0x66')]}});}return null;})[_0x61eb('0x25')](handleEntityNotFound(_0x294e74,null))[_0x61eb('0x25')](function(_0x1b5406){if(_0x1b5406){_0x4fc17f[_0x61eb('0x7e')]=_0x1b5406[_0x61eb('0x65')]({'plain':!![]});interaction_log[_0x61eb('0x26')](_0x61eb('0x7f'),_0x513ae0[_0x61eb('0x64')]['id'],_0x513ae0[_0x61eb('0x64')][_0x61eb('0x3c')],_0x513ae0['user'][_0x61eb('0x6a')],_0x4fc17f[_0x61eb('0x7e')]['id'],_0x513ae0[_0x61eb('0x5b')]?JSON[_0x61eb('0x2b')](_0x513ae0[_0x61eb('0x5b')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4fc17f);}return null;})[_0x61eb('0x25')](function(_0x32ac5d){var _0x5e8838=_0x61eb('0x6d')+_0x32ac5d[_0x61eb('0x2d')][_0x61eb('0x80')];return db[_0x61eb('0x6e')][_0x61eb('0x44')](_0x5e8838,{'type':db[_0x61eb('0x6f')][_0x61eb('0x70')][_0x61eb('0x71')],'raw':!![]})[_0x61eb('0x25')](function(_0x25ec47){return _0x25ec47;});})['then'](function(_0x2a3588){if(_0x2a3588){_0x4fc17f[_0x61eb('0x2d')][_0x61eb('0x72')]=_0x2a3588[0x0];if(!_0x513ae0[_0x61eb('0x5b')][_0x61eb('0x63')])return;return db[_0x61eb('0x73')][_0x61eb('0x59')]({'where':{'id':_0x513ae0['body'][_0x61eb('0x63')],'role':'agent'},'attributes':['id',_0x61eb('0x3c'),_0x61eb('0x75'),_0x61eb('0x76'),_0x61eb('0x81')],'raw':!![]});}return null;})[_0x61eb('0x25')](function(_0x3ec6b2){if(!_0x3ec6b2)return null;_0x4fc17f[_0x61eb('0x2d')][_0x61eb('0x74')]=_0x3ec6b2;return _0x4fc17f;})[_0x61eb('0x25')](function(_0x4a02f6){if(_0x4a02f6){_0x4a02f6[_0x61eb('0x2d')][_0x61eb('0x78')]=util[_0x61eb('0x61')](_0x61eb('0x79'),_0x513ae0[_0x61eb('0x64')]['name']);_0x4a02f6[_0x61eb('0x2d')][_0x61eb('0x7a')]=_0x4fc17f['channel'];_0x4a02f6[_0x61eb('0x2d')]['motionChannel']=_0x4fc17f[_0x61eb('0x7a')];_0x4a02f6[_0x61eb('0x2d')][_0x61eb('0x7b')]='reject';respondWithRpcPromise(_0x61eb('0x7c'),_0x61eb('0x7c'),{'event':_0x61eb('0x82'),'message':_0x4a02f6[_0x61eb('0x2d')]},client9002);return _0x4fc17f;}return null;})[_0x61eb('0x25')](respondWithResult(_0x294e74,null))[_0x61eb('0x2f')](handleError(_0x294e74,null));};exports[_0x61eb('0x83')]=function(_0x7ff523,_0x2819b4){var _0x14b72f;return db[_0x61eb('0x3f')]['create'](_0x7ff523['body'],{})['then'](function(_0x4c2e9b){_0x14b72f=_0x4c2e9b;return db[_0x61eb('0x84')][_0x61eb('0x85')]({'where':{'id':_0x14b72f[_0x61eb('0x80')]}});})['then'](function(_0x1d3e64){if(_[_0x61eb('0x67')](_0x1d3e64)){return;}else{_0x14b72f[_0x61eb('0x5f')]=_0x1d3e64[_0x61eb('0x5f')];return db[_0x61eb('0x86')]['findOne']({'where':{'id':_0x14b72f[_0x61eb('0x87')]}});}})[_0x61eb('0x25')](function(_0x8edbec){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x61eb('0x67')](_0x7ff523[_0x61eb('0x5b')])?undefined:_0x7ff523['body']['FaxAccountId'],'path':_[_0x61eb('0x67')](_0x8edbec)?undefined:util[_0x61eb('0x61')](_0x61eb('0x88'),_0x8edbec[_0x61eb('0x89')]),'fax':_[_0x61eb('0x67')](_0x14b72f[_0x61eb('0x5f')])?undefined:_0x14b72f[_0x61eb('0x5f')],'AttachmentId':_0x14b72f[_0x61eb('0x87')]},client9002);})[_0x61eb('0x25')](respondWithResult(_0x2819b4,0xc9))[_0x61eb('0x2f')](handleError(_0x2819b4,null));};exports[_0x61eb('0x8a')]=function(_0x1c3050,_0x16b248){var _0x5961a8=path[_0x61eb('0x8b')](config[_0x61eb('0x8c')],_0x61eb('0x8d'),'files','attachments');return db['FaxMessage'][_0x61eb('0x59')]({'where':{'id':_0x1c3050[_0x61eb('0x57')]['id']},'include':[{'model':db[_0x61eb('0x86')],'as':_0x61eb('0x86')}]})['then'](handleEntityNotFound(_0x16b248,null))[_0x61eb('0x25')](function(_0xf25de8){if(_0xf25de8){return _0x16b248[_0x61eb('0x8a')](path[_0x61eb('0x8b')](_0x5961a8,_0xf25de8['Attachment'][_0x61eb('0x89')]));}})[_0x61eb('0x2f')](handleError(_0x16b248,null));}; \ No newline at end of file +var _0x9f7a=['order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','rawAttributes','keys','includeAll','merge','body','find','destroy','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','motionChannel','accept','EventManager','acceptmessage','reject','RejectMessage','sequelize','contact','SIP/%s','event','rejectmessage','create','CmContact','isNil','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','stack','name','send','FaxMessage','type','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty'];(function(_0x314134,_0x28129f){var _0x49b69b=function(_0x3a53d3){while(--_0x3a53d3){_0x314134['push'](_0x314134['shift']());}};_0x49b69b(++_0x28129f);}(_0x9f7a,0x170));var _0xa9f7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9f7a[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0xa9f7('0x0'));var rimraf=require(_0xa9f7('0x1'));var zipdir=require(_0xa9f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9f7('0x3'));var moment=require(_0xa9f7('0x4'));var BPromise=require(_0xa9f7('0x5'));var Mustache=require(_0xa9f7('0x6'));var util=require(_0xa9f7('0x7'));var path=require(_0xa9f7('0x8'));var sox=require(_0xa9f7('0x9'));var csv=require('to-csv');var ejs=require(_0xa9f7('0xa'));var fs=require('fs');var fs_extra=require(_0xa9f7('0xb'));var _=require('lodash');var squel=require(_0xa9f7('0xc'));var crypto=require(_0xa9f7('0xd'));var jsforce=require(_0xa9f7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9f7('0x10'));var authService=require(_0xa9f7('0x11'));var qs=require(_0xa9f7('0x12'));var as=require(_0xa9f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9f7('0x14'))('api');var utils=require(_0xa9f7('0x15'));var config=require(_0xa9f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9f7('0x17'))['db'];config[_0xa9f7('0x18')]=_[_0xa9f7('0x19')](config[_0xa9f7('0x18')],{'host':_0xa9f7('0x1a'),'port':0x18eb});var socket=require(_0xa9f7('0x1b'))(new Redis(config[_0xa9f7('0x18')]));require(_0xa9f7('0x1c'))[_0xa9f7('0x1d')](socket);var jayson=require(_0xa9f7('0x1e'));var client=jayson[_0xa9f7('0x1f')][_0xa9f7('0x20')]({'port':0x232c});var client9002=jayson[_0xa9f7('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a68cb,_0x1d1e14,_0x353344,_0x529840){return new BPromise(function(_0x2adcee,_0x536175){var _0x80c3b3=_0x529840||client;return _0x80c3b3[_0xa9f7('0x21')](_0x2a68cb,_0x353344)[_0xa9f7('0x22')](function(_0x5bfb8c){logger[_0xa9f7('0x23')](_0xa9f7('0x24'),_0x1d1e14,_0xa9f7('0x25'));logger[_0xa9f7('0x26')](_0xa9f7('0x27'),_0x1d1e14,'request\x20sent',JSON[_0xa9f7('0x28')](_0x5bfb8c));if(_0x5bfb8c[_0xa9f7('0x29')]){if(_0x5bfb8c['error'][_0xa9f7('0x2a')]===0x1f4){logger[_0xa9f7('0x29')](_0xa9f7('0x24'),_0x1d1e14,_0x5bfb8c[_0xa9f7('0x29')]['message']);return _0x536175(_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);}logger[_0xa9f7('0x29')](_0xa9f7('0x24'),_0x1d1e14,_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);return _0x2adcee(_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);}else{logger[_0xa9f7('0x23')](_0xa9f7('0x24'),_0x1d1e14,'request\x20sent');_0x2adcee(_0x5bfb8c[_0xa9f7('0x2c')][_0xa9f7('0x2b')]);}})[_0xa9f7('0x2d')](function(_0x222cce){logger['error'](_0xa9f7('0x24'),_0x1d1e14,_0x222cce);_0x536175(_0x222cce);});});}function respondWithStatusCode(_0x5a8b4a,_0x5c0799){_0x5c0799=_0x5c0799||0xcc;return function(_0x142286){if(_0x142286){return _0x5a8b4a[_0xa9f7('0x2e')](_0x5c0799);}return _0x5a8b4a[_0xa9f7('0x2f')](_0x5c0799)[_0xa9f7('0x30')]();};}function respondWithResult(_0x462070,_0x458a28){_0x458a28=_0x458a28||0xc8;return function(_0x192372){if(_0x192372){return _0x462070[_0xa9f7('0x2f')](_0x458a28)[_0xa9f7('0x31')](_0x192372);}};}function respondWithFilteredResult(_0x414772,_0x1d7e0b){return function(_0x29dee3){if(_0x29dee3){var _0x31827b=typeof _0x1d7e0b[_0xa9f7('0x32')]===_0xa9f7('0x33')&&typeof _0x1d7e0b[_0xa9f7('0x34')]===_0xa9f7('0x33');var _0x5330d7=_0x29dee3['count'];var _0x210ced=_0x31827b?0x0:_0x1d7e0b[_0xa9f7('0x32')];var _0x53aee0=_0x31827b?_0x29dee3[_0xa9f7('0x35')]:_0x1d7e0b[_0xa9f7('0x32')]+_0x1d7e0b[_0xa9f7('0x34')];var _0x4c59fa;if(_0x53aee0>=_0x5330d7){_0x53aee0=_0x5330d7;_0x4c59fa=0xc8;}else{_0x4c59fa=0xce;}_0x414772[_0xa9f7('0x2f')](_0x4c59fa);return _0x414772[_0xa9f7('0x36')](_0xa9f7('0x37'),_0x210ced+'-'+_0x53aee0+'/'+_0x5330d7)['json'](_0x29dee3);}return null;};}function patchUpdates(_0x407ec1){return function(_0x2f4943){try{jsonpatch[_0xa9f7('0x38')](_0x2f4943,_0x407ec1,!![]);}catch(_0x7b9c8e){return BPromise['reject'](_0x7b9c8e);}return _0x2f4943[_0xa9f7('0x39')]();};}function saveUpdates(_0x558370,_0x1be2d5){return function(_0x296207){if(_0x296207){return _0x296207['update'](_0x558370)[_0xa9f7('0x22')](function(_0x4f8242){return _0x4f8242;});}return null;};}function removeEntity(_0x5339af,_0x283632){return function(_0x1850b5){if(_0x1850b5){return _0x1850b5['destroy']()[_0xa9f7('0x22')](function(){_0x5339af[_0xa9f7('0x2f')](0xcc)[_0xa9f7('0x30')]();});}};}function handleEntityNotFound(_0x5e8347,_0x5abc79){return function(_0x58819a){if(!_0x58819a){_0x5e8347[_0xa9f7('0x2e')](0x194);}return _0x58819a;};}function handleError(_0x172855,_0x429c1a){_0x429c1a=_0x429c1a||0x1f4;return function(_0x4f7feb){logger[_0xa9f7('0x29')](_0x4f7feb[_0xa9f7('0x3a')]);if(_0x4f7feb[_0xa9f7('0x3b')]){delete _0x4f7feb[_0xa9f7('0x3b')];}_0x172855[_0xa9f7('0x2f')](_0x429c1a)[_0xa9f7('0x3c')](_0x4f7feb);};}exports['index']=function(_0x1558e0,_0x27dbf8){var _0x30a887={},_0xc63edb={},_0x507f54={'count':0x0,'rows':[]};var _0x50a878=_['map'](db[_0xa9f7('0x3d')]['rawAttributes'],function(_0x26c856){return{'name':_0x26c856['fieldName'],'type':_0x26c856[_0xa9f7('0x3e')][_0xa9f7('0x3f')]};});_0xc63edb[_0xa9f7('0x40')]=_[_0xa9f7('0x41')](_0x50a878,_0xa9f7('0x3b'));_0xc63edb['query']=_['keys'](_0x1558e0['query']);_0xc63edb[_0xa9f7('0x42')]=_[_0xa9f7('0x43')](_0xc63edb[_0xa9f7('0x40')],_0xc63edb[_0xa9f7('0x44')]);_0x30a887['attributes']=_[_0xa9f7('0x43')](_0xc63edb[_0xa9f7('0x40')],qs[_0xa9f7('0x45')](_0x1558e0[_0xa9f7('0x44')]['fields']));_0x30a887[_0xa9f7('0x46')]=_0x30a887[_0xa9f7('0x46')][_0xa9f7('0x47')]?_0x30a887[_0xa9f7('0x46')]:_0xc63edb['model'];if(!_0x1558e0['query'][_0xa9f7('0x48')]('nolimit')){_0x30a887['limit']=qs[_0xa9f7('0x34')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x34')]);_0x30a887['offset']=qs[_0xa9f7('0x32')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x32')]);}_0x30a887[_0xa9f7('0x49')]=qs[_0xa9f7('0x4a')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x4a')]);_0x30a887[_0xa9f7('0x4b')]=qs[_0xa9f7('0x42')](_[_0xa9f7('0x4c')](_0x1558e0[_0xa9f7('0x44')],_0xc63edb[_0xa9f7('0x42')]),_0x50a878);if(_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x4d')]){_0x30a887['where']=_['merge'](_0x30a887[_0xa9f7('0x4b')],{'$or':_[_0xa9f7('0x41')](_0x50a878,function(_0xb7b2b6){if(_0xb7b2b6[_0xa9f7('0x3e')]!==_0xa9f7('0x4e')){var _0x4ddebd={};_0x4ddebd[_0xb7b2b6['name']]={'$like':'%'+_0x1558e0['query'][_0xa9f7('0x4d')]+'%'};return _0x4ddebd;}})});}_0x30a887=_['merge']({},_0x30a887,_0x1558e0[_0xa9f7('0x4f')]);var _0x55f8fb={'where':_0x30a887[_0xa9f7('0x4b')]};return db[_0xa9f7('0x3d')][_0xa9f7('0x35')](_0x55f8fb)[_0xa9f7('0x22')](function(_0x3edbb0){_0x507f54[_0xa9f7('0x35')]=_0x3edbb0;if(_0x1558e0[_0xa9f7('0x44')]['includeAll']){_0x30a887[_0xa9f7('0x50')]=[{'all':!![]}];}return db[_0xa9f7('0x3d')][_0xa9f7('0x51')](_0x30a887);})[_0xa9f7('0x22')](function(_0x4ae72b){_0x507f54['rows']=_0x4ae72b;return _0x507f54;})['then'](respondWithFilteredResult(_0x27dbf8,_0x30a887))['catch'](handleError(_0x27dbf8,null));};exports[_0xa9f7('0x52')]=function(_0x3a0768,_0x45876c){var _0x15610e={'raw':!![],'where':{'id':_0x3a0768[_0xa9f7('0x53')]['id']}},_0x8b8857={};_0x8b8857[_0xa9f7('0x40')]=_['keys'](db[_0xa9f7('0x3d')][_0xa9f7('0x54')]);_0x8b8857['query']=_[_0xa9f7('0x55')](_0x3a0768['query']);_0x8b8857[_0xa9f7('0x42')]=_[_0xa9f7('0x43')](_0x8b8857[_0xa9f7('0x40')],_0x8b8857[_0xa9f7('0x44')]);_0x15610e[_0xa9f7('0x46')]=_[_0xa9f7('0x43')](_0x8b8857[_0xa9f7('0x40')],qs[_0xa9f7('0x45')](_0x3a0768['query'][_0xa9f7('0x45')]));_0x15610e[_0xa9f7('0x46')]=_0x15610e[_0xa9f7('0x46')][_0xa9f7('0x47')]?_0x15610e[_0xa9f7('0x46')]:_0x8b8857[_0xa9f7('0x40')];if(_0x3a0768[_0xa9f7('0x44')][_0xa9f7('0x56')]){_0x15610e[_0xa9f7('0x50')]=[{'all':!![]}];}_0x15610e=_[_0xa9f7('0x57')]({},_0x15610e,_0x3a0768[_0xa9f7('0x4f')]);return db[_0xa9f7('0x3d')]['find'](_0x15610e)['then'](handleEntityNotFound(_0x45876c,null))['then'](respondWithResult(_0x45876c,null))[_0xa9f7('0x2d')](handleError(_0x45876c,null));};exports['update']=function(_0x1e8d51,_0xaeb264){if(_0x1e8d51[_0xa9f7('0x58')]['id']){delete _0x1e8d51['body']['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x1e8d51[_0xa9f7('0x53')]['id']}})[_0xa9f7('0x22')](handleEntityNotFound(_0xaeb264,null))['then'](saveUpdates(_0x1e8d51[_0xa9f7('0x58')],null))[_0xa9f7('0x22')](respondWithResult(_0xaeb264,null))[_0xa9f7('0x2d')](handleError(_0xaeb264,null));};exports[_0xa9f7('0x5a')]=function(_0x4d4592,_0x45c42b){return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x4d4592[_0xa9f7('0x53')]['id']}})[_0xa9f7('0x22')](handleEntityNotFound(_0x45c42b,null))[_0xa9f7('0x22')](removeEntity(_0x45c42b,null))['catch'](handleError(_0x45c42b,null));};exports[_0xa9f7('0x5b')]=function(_0x2a51aa,_0x3836a3){return db[_0xa9f7('0x3d')][_0xa9f7('0x5b')]()[_0xa9f7('0x22')](respondWithResult(_0x3836a3,null))[_0xa9f7('0x2d')](handleError(_0x3836a3,null));};var interaction_log=require('../../config/logger')(_0xa9f7('0x5c'));exports['accept']=function(_0xfd2cbc,_0x358510,_0xae67ad){var _0x5b7e8d={'agent':{},'channel':_0xa9f7('0x5d')};if(_0xfd2cbc[_0xa9f7('0x58')]['id']){delete _0xfd2cbc[_0xa9f7('0x58')]['id'];}_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x5e')]=!![];_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x5f')]=moment()[_0xa9f7('0x60')](_0xa9f7('0x61'));_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')]=_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')]||_0xfd2cbc[_0xa9f7('0x63')]['id'];_0x5b7e8d[_0xa9f7('0x64')]['id']=_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')];return db['FaxMessage'][_0xa9f7('0x59')]({'where':{'id':_0xfd2cbc[_0xa9f7('0x53')]['id'],'UserId':null}})[_0xa9f7('0x22')](handleEntityNotFound(_0x358510,null))[_0xa9f7('0x22')](saveUpdates(_0xfd2cbc[_0xa9f7('0x58')],null))[_0xa9f7('0x22')](function(_0x590bd4){if(_0x590bd4){_0x5b7e8d[_0xa9f7('0x2b')]=_0x590bd4[_0xa9f7('0x65')]({'plain':!![]});return db[_0xa9f7('0x66')][_0xa9f7('0x59')]({'where':{'id':_0x590bd4[_0xa9f7('0x67')]}});}return null;})[_0xa9f7('0x22')](handleEntityNotFound(_0x358510,null))['then'](function(_0x210bad){if(_0x210bad){return _0x210bad[_0xa9f7('0x68')]({'UserId':_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')],'read1stAt':_['isNil'](_0x210bad[_0xa9f7('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa9f7('0x22')](function(_0x4a4d3a){if(_0x4a4d3a){_0x5b7e8d[_0xa9f7('0x6a')]=_0x4a4d3a[_0xa9f7('0x65')]({'plain':!![]});interaction_log[_0xa9f7('0x23')](_0xa9f7('0x6b'),_0xfd2cbc[_0xa9f7('0x63')]['id'],_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x3b')],_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x6c')],_0x5b7e8d[_0xa9f7('0x6a')]['id'],_0xfd2cbc[_0xa9f7('0x58')]?JSON['stringify'](_0xfd2cbc['body']):_0xa9f7('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xa9f7('0x6e'),_0x5b7e8d);}return null;})['then'](function(_0x5152b9){var _0x35566e=_0xa9f7('0x6f')+_0x5152b9[_0xa9f7('0x2b')][_0xa9f7('0x70')];return db['sequelize'][_0xa9f7('0x44')](_0x35566e,{'type':db[_0xa9f7('0x71')][_0xa9f7('0x72')][_0xa9f7('0x73')],'raw':!![]})['then'](function(_0x3eefc9){return _0x3eefc9;});})['then'](function(_0x1f4cca){if(_0x1f4cca){_0x5b7e8d[_0xa9f7('0x2b')]['contact']=_0x1f4cca[0x0];if(!_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')])return;return db[_0xa9f7('0x74')][_0xa9f7('0x59')]({'where':{'id':_0xfd2cbc[_0xa9f7('0x58')]['UserId'],'role':_0xa9f7('0x64')},'attributes':['id',_0xa9f7('0x3b'),_0xa9f7('0x75'),_0xa9f7('0x76'),_0xa9f7('0x77')],'raw':!![]});}return null;})[_0xa9f7('0x22')](function(_0x54cef4){if(!_0x54cef4)return null;_0x5b7e8d[_0xa9f7('0x2b')]['agent']=_0x54cef4;return _0x5b7e8d;})[_0xa9f7('0x22')](function(_0xa91b0b){if(_0xa91b0b){if(_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x78')]){_0x5b7e8d['message']['interface']=util[_0xa9f7('0x60')]('SIP/%s',_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x3b')]);_0x5b7e8d[_0xa9f7('0x2b')][_0xa9f7('0x79')]=_0x5b7e8d[_0xa9f7('0x79')];_0x5b7e8d[_0xa9f7('0x2b')][_0xa9f7('0x7a')]=_0x5b7e8d[_0xa9f7('0x79')];_0x5b7e8d[_0xa9f7('0x2b')]['event']=_0xa9f7('0x7b');return respondWithRpcPromise('EventManager',_0xa9f7('0x7c'),{'event':_0xa9f7('0x7d'),'message':_0x5b7e8d[_0xa9f7('0x2b')]},client9002)[_0xa9f7('0x22')](function(){return _0x5b7e8d;});}return _0x5b7e8d;}return null;})[_0xa9f7('0x22')](respondWithResult(_0x358510,null))[_0xa9f7('0x2d')](handleError(_0x358510,null));};var interaction_log=require('../../config/logger')(_0xa9f7('0x5c'));exports[_0xa9f7('0x7e')]=function(_0x3ed963,_0x568770,_0x424fb3){var _0x23d000={'agent':{},'channel':_0xa9f7('0x5d')};if(_0x3ed963[_0xa9f7('0x58')]['id']){delete _0x3ed963[_0xa9f7('0x58')]['id'];}_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')]=_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')]||_0x3ed963[_0xa9f7('0x63')]['id'];_0x23d000[_0xa9f7('0x64')]['id']=_0x3ed963[_0xa9f7('0x58')]['UserId'];return db['FaxMessage'][_0xa9f7('0x59')]({'where':{'id':_0x3ed963[_0xa9f7('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x568770,null))[_0xa9f7('0x22')](function(_0x482318){if(_0x482318){_0x23d000[_0xa9f7('0x2b')]=_0x482318[_0xa9f7('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xa9f7('0x59')]({'where':{'id':_0x482318[_0xa9f7('0x67')]}});}return null;})[_0xa9f7('0x22')](handleEntityNotFound(_0x568770,null))[_0xa9f7('0x22')](function(_0x31fd6e){if(_0x31fd6e){_0x23d000[_0xa9f7('0x6a')]=_0x31fd6e['get']({'plain':!![]});interaction_log[_0xa9f7('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ed963[_0xa9f7('0x63')]['id'],_0x3ed963[_0xa9f7('0x63')]['name'],_0x3ed963[_0xa9f7('0x63')][_0xa9f7('0x6c')],_0x23d000[_0xa9f7('0x6a')]['id'],_0x3ed963[_0xa9f7('0x58')]?JSON[_0xa9f7('0x28')](_0x3ed963[_0xa9f7('0x58')]):_0xa9f7('0x6d'));return respondWithRpcPromise(_0xa9f7('0x7f'),'rejectMessage',_0x23d000);}return null;})[_0xa9f7('0x22')](function(_0x337ef6){var _0xfda3b8=_0xa9f7('0x6f')+_0x337ef6[_0xa9f7('0x2b')][_0xa9f7('0x70')];return db[_0xa9f7('0x80')][_0xa9f7('0x44')](_0xfda3b8,{'type':db[_0xa9f7('0x71')][_0xa9f7('0x72')][_0xa9f7('0x73')],'raw':!![]})[_0xa9f7('0x22')](function(_0x4959df){return _0x4959df;});})[_0xa9f7('0x22')](function(_0xc527cf){if(_0xc527cf){_0x23d000[_0xa9f7('0x2b')][_0xa9f7('0x81')]=_0xc527cf[0x0];if(!_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')])return;return db[_0xa9f7('0x74')]['find']({'where':{'id':_0x3ed963[_0xa9f7('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xa9f7('0x3b'),'fullname',_0xa9f7('0x76'),_0xa9f7('0x77')],'raw':!![]});}return null;})[_0xa9f7('0x22')](function(_0x5e01e6){if(!_0x5e01e6)return null;_0x23d000[_0xa9f7('0x2b')][_0xa9f7('0x64')]=_0x5e01e6;return _0x23d000;})[_0xa9f7('0x22')](function(_0x325915){if(_0x325915){_0x325915[_0xa9f7('0x2b')]['interface']=util[_0xa9f7('0x60')](_0xa9f7('0x82'),_0x3ed963['user'][_0xa9f7('0x3b')]);_0x325915[_0xa9f7('0x2b')][_0xa9f7('0x79')]=_0x23d000[_0xa9f7('0x79')];_0x325915['message'][_0xa9f7('0x7a')]=_0x23d000['channel'];_0x325915[_0xa9f7('0x2b')][_0xa9f7('0x83')]=_0xa9f7('0x7e');respondWithRpcPromise(_0xa9f7('0x7c'),_0xa9f7('0x7c'),{'event':_0xa9f7('0x84'),'message':_0x325915[_0xa9f7('0x2b')]},client9002);return _0x23d000;}return null;})[_0xa9f7('0x22')](respondWithResult(_0x568770,null))[_0xa9f7('0x2d')](handleError(_0x568770,null));};exports[_0xa9f7('0x85')]=function(_0x2a6aa9,_0x2f6ee7){var _0x340286;return db[_0xa9f7('0x3d')][_0xa9f7('0x85')](_0x2a6aa9['body'],{})[_0xa9f7('0x22')](function(_0xfbce4a){_0x340286=_0xfbce4a;return db[_0xa9f7('0x86')]['findOne']({'where':{'id':_0x340286[_0xa9f7('0x70')]}});})['then'](function(_0x42f365){if(_[_0xa9f7('0x87')](_0x42f365)){return;}else{_0x340286[_0xa9f7('0x5d')]=_0x42f365[_0xa9f7('0x5d')];return db[_0xa9f7('0x88')]['findOne']({'where':{'id':_0x340286['AttachmentId']}});}})[_0xa9f7('0x22')](function(_0x43c464){return respondWithRpcPromise(_0xa9f7('0x89'),'SendFax',{'FaxAccountId':_[_0xa9f7('0x87')](_0x2a6aa9[_0xa9f7('0x58')])?undefined:_0x2a6aa9[_0xa9f7('0x58')][_0xa9f7('0x8a')],'path':_[_0xa9f7('0x87')](_0x43c464)?undefined:util[_0xa9f7('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x43c464[_0xa9f7('0x8b')]),'fax':_['isNil'](_0x340286['fax'])?undefined:_0x340286[_0xa9f7('0x5d')],'AttachmentId':_0x340286[_0xa9f7('0x8c')]},client9002);})[_0xa9f7('0x22')](respondWithResult(_0x2f6ee7,0xc9))[_0xa9f7('0x2d')](handleError(_0x2f6ee7,null));};exports[_0xa9f7('0x8d')]=function(_0x4ad4c2,_0x5b2c1d){var _0x559ae1=path[_0xa9f7('0x8e')](config[_0xa9f7('0x8f')],_0xa9f7('0x90'),_0xa9f7('0x91'),_0xa9f7('0x92'));return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x4ad4c2[_0xa9f7('0x53')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xa9f7('0x22')](handleEntityNotFound(_0x5b2c1d,null))['then'](function(_0x523b52){if(_0x523b52){return _0x5b2c1d[_0xa9f7('0x8d')](path[_0xa9f7('0x8e')](_0x559ae1,_0x523b52[_0xa9f7('0x88')][_0xa9f7('0x8b')]));}})[_0xa9f7('0x2d')](handleError(_0x5b2c1d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 529d256..ba26ddf 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 _0xf3fe=['save','update','emit','hook','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x566df8,_0x24f56f){var _0x4facae=function(_0x5f5780){while(--_0x5f5780){_0x566df8['push'](_0x566df8['shift']());}};_0x4facae(++_0x24f56f);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x2265ef,_0x23a2e8){_0x2265ef=_0x2265ef-0x0;var _0x1415b2=_0xf3fe[_0x2265ef];return _0x1415b2;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xef3f('0x0'))['db'][_0xef3f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xef3f('0x2')](0x0);var events={'afterCreate':_0xef3f('0x3'),'afterUpdate':_0xef3f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29b501){return function(_0x18a97c,_0x171ff9,_0x431bc5){FaxMessageEvents[_0xef3f('0x5')](_0x29b501+':'+_0x18a97c['id'],_0x18a97c);FaxMessageEvents['emit'](_0x29b501,_0x18a97c);_0x431bc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xef3f('0x6')](e,emitEvent(event));}}module[_0xef3f('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x8d0a=['exports','events','../../mysqldb','FaxMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x1277ea,_0x94beab){var _0x585923=function(_0x46aa8c){while(--_0x46aa8c){_0x1277ea['push'](_0x1277ea['shift']());}};_0x585923(++_0x94beab);}(_0x8d0a,0x172));var _0xa8d0=function(_0x4d99d8,_0x3a1a59){_0x4d99d8=_0x4d99d8-0x0;var _0x3726ab=_0x8d0a[_0x4d99d8];return _0x3726ab;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var FaxMessage=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8d0('0x3'),'afterUpdate':_0xa8d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8cc4){return function(_0x3812b4,_0x33c4b1,_0x55bc97){FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4+':'+_0x3812b4['id'],_0x3812b4);FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4,_0x3812b4);_0x55bc97(null);};}for(var e in events){if(events[_0xa8d0('0x6')](e)){var event=events[e];FaxMessage[_0xa8d0('0x7')](e,emitEvent(event));}}module[_0xa8d0('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 b086fa2..08e93e1 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 _0x6a8e=['UserId','FaxInteraction','FaxInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','path','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x89ace6,_0x39064b){var _0x302694=function(_0x7dd49){while(--_0x7dd49){_0x89ace6['push'](_0x89ace6['shift']());}};_0x302694(++_0x39064b);}(_0x6a8e,0xcf));var _0xe6a8=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0x6a8e[_0x5cc61d];return _0x2e25d0;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require(_0xe6a8('0x1'))(_0xe6a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6a8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6a8('0x4'));module[_0xe6a8('0x5')]=function(_0xea325c,_0xf1dcde){return _0xea325c[_0xe6a8('0x6')]('FaxMessage',attributes,{'tableName':_0xe6a8('0x7'),'paranoid':![],'indexes':[{'name':_0xe6a8('0x8'),'fields':[_0xe6a8('0x9')],'type':_0xe6a8('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fc6ae,_0x3d17d3,_0x17259a){var _0x3b7c12=_0xea325c[_0xe6a8('0xb')];var _0x2bc628=_0x1fc6ae[_0xe6a8('0xc')]({'plain':!![]});if(_0x2bc628[_0xe6a8('0xd')]['toLowerCase']()==='in'||_0x2bc628['direction'][_0xe6a8('0xe')]()===_0xe6a8('0xf')&&!_0x2bc628[_0xe6a8('0x10')]&&!_[_0xe6a8('0x11')](_0x2bc628[_0xe6a8('0x12')])){_0x3b7c12[_0xe6a8('0x13')]['findOne']({'where':{'id':_0x2bc628[_0xe6a8('0x14')]}})[_0xe6a8('0x15')](function(_0x2e2a29){if(_0x2e2a29){_0x2e2a29['update']({'lastMsgAt':_0x2bc628['createdAt'],'lastMsgDirection':_0x2bc628[_0xe6a8('0xd')][_0xe6a8('0xe')]()});}})[_0xe6a8('0x16')](function(_0x345edb){console['error'](_0x345edb);});}_0x17259a();}},'charset':_0xe6a8('0x17'),'collate':_0xe6a8('0x18')});}; \ No newline at end of file +var _0xfe19=['then','update','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','FaxInteractionId'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xfe19,0x13a));var _0x9fe1=function(_0x6e3090,_0x53aa85){_0x6e3090=_0x6e3090-0x0;var _0x30a5cb=_0xfe19[_0x6e3090];return _0x30a5cb;};'use strict';var _=require(_0x9fe1('0x0'));var util=require(_0x9fe1('0x1'));var logger=require(_0x9fe1('0x2'))(_0x9fe1('0x3'));var moment=require(_0x9fe1('0x4'));var BPromise=require(_0x9fe1('0x5'));var rp=require(_0x9fe1('0x6'));var fs=require('fs');var path=require(_0x9fe1('0x7'));var rimraf=require(_0x9fe1('0x8'));var config=require('../../config/environment');var attributes=require(_0x9fe1('0x9'));module[_0x9fe1('0xa')]=function(_0x3b0074,_0x52a9ae){return _0x3b0074[_0x9fe1('0xb')](_0x9fe1('0xc'),attributes,{'tableName':_0x9fe1('0xd'),'paranoid':![],'indexes':[{'name':_0x9fe1('0xe'),'fields':[_0x9fe1('0xf')],'type':_0x9fe1('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24cb08,_0x44e850,_0xe693dc){var _0x48ed4c=_0x3b0074[_0x9fe1('0x11')];var _0x1d8532=_0x24cb08[_0x9fe1('0x12')]({'plain':!![]});if(_0x1d8532['direction'][_0x9fe1('0x13')]()==='in'||_0x1d8532[_0x9fe1('0x14')][_0x9fe1('0x13')]()===_0x9fe1('0x15')&&!_0x1d8532[_0x9fe1('0x16')]&&!_[_0x9fe1('0x17')](_0x1d8532[_0x9fe1('0x18')])){_0x48ed4c['FaxInteraction'][_0x9fe1('0x19')]({'where':{'id':_0x1d8532[_0x9fe1('0x1a')]}})[_0x9fe1('0x1b')](function(_0x6ae465){if(_0x6ae465){_0x6ae465[_0x9fe1('0x1c')]({'lastMsgAt':_0x1d8532['createdAt'],'lastMsgDirection':_0x1d8532[_0x9fe1('0x14')][_0x9fe1('0x13')]()});}})[_0x9fe1('0x1d')](function(_0x109bfa){console[_0x9fe1('0x1e')](_0x109bfa);});}_0xe693dc();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4a32bb6..8530eea 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x425d,0x1e0));var _0xd425=function(_0x4f6272,_0x53b79c){_0x4f6272=_0x4f6272-0x0;var _0x1b5ae5=_0x425d[_0x4f6272];return _0x1b5ae5;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file +var _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x33afba,_0x5830dc){var _0x182f57=function(_0x42e942){while(--_0x42e942){_0x33afba['push'](_0x33afba['shift']());}};_0x182f57(++_0x5830dc);}(_0x207c,0x1e8));var _0xc207=function(_0x3f32ca,_0x2212f2){_0x3f32ca=_0x3f32ca-0x0;var _0xf444d=_0x207c[_0x3f32ca];return _0xf444d;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2d19026..fe3b5b7 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 _0x4d90=['update','emit','removeListener','faxMessage:','./faxMessage.events','save','remove'];(function(_0x3c2880,_0xd364d3){var _0x26dbb8=function(_0x9b3a4){while(--_0x9b3a4){_0x3c2880['push'](_0x3c2880['shift']());}};_0x26dbb8(++_0xd364d3);}(_0x4d90,0x15b));var _0x04d9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4d90[_0xf50820];return _0x2a9b10;};'use strict';var FaxMessageEvents=require(_0x04d9('0x0'));var events=[_0x04d9('0x1'),_0x04d9('0x2'),_0x04d9('0x3')];function createListener(_0x1c0613,_0x8e1e1d){return function(_0x151a50){_0x8e1e1d[_0x04d9('0x4')](_0x1c0613,_0x151a50);};}function removeListener(_0x1f52db,_0x382dff){return function(){FaxMessageEvents[_0x04d9('0x5')](_0x1f52db,_0x382dff);};}exports['register']=function(_0x51a8b0){for(var _0x560e37=0x0,_0x212ba9=events['length'];_0x560e37<_0x212ba9;_0x560e37++){var _0x4ea52a=events[_0x560e37];var _0x5d9aab=createListener(_0x04d9('0x6')+_0x4ea52a,_0x51a8b0);FaxMessageEvents['on'](_0x4ea52a,_0x5d9aab);}}; \ No newline at end of file +var _0xb978=['register','faxMessage:','save','update','emit','removeListener'];(function(_0x5f1669,_0x171790){var _0x1fccbe=function(_0x15d175){while(--_0x15d175){_0x5f1669['push'](_0x5f1669['shift']());}};_0x1fccbe(++_0x171790);}(_0xb978,0x1a6));var _0x8b97=function(_0x45a0a3,_0x2b4752){_0x45a0a3=_0x45a0a3-0x0;var _0x154618=_0xb978[_0x45a0a3];return _0x154618;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8b97('0x0'),'remove',_0x8b97('0x1')];function createListener(_0x53e203,_0x75ca6a){return function(_0x2c8008){_0x75ca6a[_0x8b97('0x2')](_0x53e203,_0x2c8008);};}function removeListener(_0x55d21e,_0x4f9f48){return function(){FaxMessageEvents[_0x8b97('0x3')](_0x55d21e,_0x4f9f48);};}exports[_0x8b97('0x4')]=function(_0xb378e0){for(var _0x9b1bd3=0x0,_0x2c596d=events['length'];_0x9b1bd3<_0x2c596d;_0x9b1bd3++){var _0x4d3b6e=events[_0x9b1bd3];var _0xc274bf=createListener(_0x8b97('0x5')+_0x4d3b6e,_0xb378e0);FaxMessageEvents['on'](_0x4d3b6e,_0xc274bf);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f2f7b29..42a8cc5 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 _0xae60=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept'];(function(_0x7da33c,_0xabbc19){var _0x205045=function(_0x182896){while(--_0x182896){_0x7da33c['push'](_0x7da33c['shift']());}};_0x205045(++_0xabbc19);}(_0xae60,0x1c7));var _0x0ae6=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xae60[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./faxMessage.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),interaction[_0x0ae6('0x11')](_0x0ae6('0x12'),_0x0ae6('0x13')),controller[_0x0ae6('0x14')]);router[_0x0ae6('0x15')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x17')]);router[_0x0ae6('0x15')](_0x0ae6('0x18'),auth[_0x0ae6('0x9')](),controller['accept']);router[_0x0ae6('0x15')](_0x0ae6('0x19'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1a')]);router[_0x0ae6('0x1b')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1c')]);module[_0x0ae6('0x1d')]=router; \ No newline at end of file +var _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x222f,0x1a4));var _0xf222=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x222f[_0x1c8cc6];return _0x522936;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d99caf7..8d2cc07 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 _0x5aac=['roundrobin','INTEGER','sequelize','exports','name','ENUM','beepall'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x5aac,0x72));var _0xc5aa=function(_0x5e6bd6,_0x4cd951){_0x5e6bd6=_0x5e6bd6-0x0;var _0x1a4f20=_0x5aac[_0x5e6bd6];return _0x1a4f20;};'use strict';var Sequelize=require(_0xc5aa('0x0'));module[_0xc5aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc5aa('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc5aa('0x3')]('rrmemory',_0xc5aa('0x4'),_0xc5aa('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc5aa('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd48=['sequelize','exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x3c2a57,_0x2e9229){var _0x44e1d6=function(_0x32a143){while(--_0x32a143){_0x3c2a57['push'](_0x3c2a57['shift']());}};_0x44e1d6(++_0x2e9229);}(_0xfd48,0xe7));var _0x8fd4=function(_0x3c5fc7,_0x2b35c3){_0x3c5fc7=_0x3c5fc7-0x0;var _0x557c44=_0xfd48[_0x3c5fc7];return _0x557c44;};'use strict';var Sequelize=require(_0x8fd4('0x0'));module[_0x8fd4('0x1')]={'name':{'type':Sequelize[_0x8fd4('0x2')],'unique':_0x8fd4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8fd4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8fd4('0x4')](_0x8fd4('0x5'),'beepall',_0x8fd4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c244f0c..236c15d 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 _0x0437=['SIP','faxPause','getTeams','Team','filter','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','status','json','limit','undefined','offset','count','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','params','keys','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s'];(function(_0x4f5a95,_0x23c870){var _0xdb3484=function(_0x4e6963){while(--_0x4e6963){_0x4f5a95['push'](_0x4f5a95['shift']());}};_0xdb3484(++_0x23c870);}(_0x0437,0x13f));var _0x7043=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0437[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0x7043('0x0'));var rimraf=require(_0x7043('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7043('0x2'));var BPromise=require(_0x7043('0x3'));var Mustache=require(_0x7043('0x4'));var util=require('util');var path=require(_0x7043('0x5'));var sox=require(_0x7043('0x6'));var csv=require(_0x7043('0x7'));var ejs=require(_0x7043('0x8'));var fs=require('fs');var fs_extra=require(_0x7043('0x9'));var _=require('lodash');var squel=require(_0x7043('0xa'));var crypto=require(_0x7043('0xb'));var jsforce=require(_0x7043('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7043('0x7'));var querystring=require(_0x7043('0xd'));var Papa=require('papaparse');var Redis=require(_0x7043('0xe'));var authService=require(_0x7043('0xf'));var qs=require(_0x7043('0x10'));var as=require(_0x7043('0x11'));var hardwareService=require(_0x7043('0x12'));var logger=require(_0x7043('0x13'))(_0x7043('0x14'));var utils=require(_0x7043('0x15'));var config=require(_0x7043('0x16'));var licenseUtil=require(_0x7043('0x17'));var db=require(_0x7043('0x18'))['db'];config['redis']=_[_0x7043('0x19')](config[_0x7043('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7043('0x1b'))(new Redis(config[_0x7043('0x1a')]));require(_0x7043('0x1c'))['register'](socket);function respondWithStatusCode(_0x5f5f3,_0x175025){_0x175025=_0x175025||0xcc;return function(_0x48925d){if(_0x48925d){return _0x5f5f3['sendStatus'](_0x175025);}return _0x5f5f3[_0x7043('0x1d')](_0x175025)['end']();};}function respondWithResult(_0x452812,_0x164d18){_0x164d18=_0x164d18||0xc8;return function(_0x56e9d6){if(_0x56e9d6){return _0x452812[_0x7043('0x1d')](_0x164d18)[_0x7043('0x1e')](_0x56e9d6);}};}function respondWithFilteredResult(_0x309e66,_0x2673f7){return function(_0x44f5af){if(_0x44f5af){var _0x1357a3=typeof _0x2673f7['offset']==='undefined'&&typeof _0x2673f7[_0x7043('0x1f')]===_0x7043('0x20');var _0x4ba786=_0x44f5af['count'];var _0xb1d02=_0x1357a3?0x0:_0x2673f7[_0x7043('0x21')];var _0x344f28=_0x1357a3?_0x44f5af[_0x7043('0x22')]:_0x2673f7[_0x7043('0x21')]+_0x2673f7[_0x7043('0x1f')];var _0x52b454;if(_0x344f28>=_0x4ba786){_0x344f28=_0x4ba786;_0x52b454=0xc8;}else{_0x52b454=0xce;}_0x309e66[_0x7043('0x1d')](_0x52b454);return _0x309e66['set']('Content-Range',_0xb1d02+'-'+_0x344f28+'/'+_0x4ba786)['json'](_0x44f5af);}return null;};}function patchUpdates(_0x121572){return function(_0x4dc391){try{jsonpatch[_0x7043('0x23')](_0x4dc391,_0x121572,!![]);}catch(_0x239f2){return BPromise[_0x7043('0x24')](_0x239f2);}return _0x4dc391[_0x7043('0x25')]();};}function saveUpdates(_0x5c4108,_0x33ed4b){return function(_0x575d41){if(_0x575d41){return _0x575d41['update'](_0x5c4108)[_0x7043('0x26')](function(_0x594703){return _0x594703;});}return null;};}function removeEntity(_0x2a309e,_0x29ca0a){return function(_0x5398db){if(_0x5398db){return _0x5398db[_0x7043('0x27')]()[_0x7043('0x26')](function(){var _0xf73a0c=_0x5398db[_0x7043('0x28')]({'plain':!![]});var _0x72b98a=_0x7043('0x29');return db[_0x7043('0x2a')][_0x7043('0x27')]({'where':{'type':_0x72b98a,'resourceId':_0xf73a0c['id']}})['then'](function(){return _0x5398db;});})[_0x7043('0x26')](function(){_0x2a309e[_0x7043('0x1d')](0xcc)[_0x7043('0x2b')]();});}};}function handleEntityNotFound(_0x16cf13,_0x4fa485){return function(_0x5cdef0){if(!_0x5cdef0){_0x16cf13['sendStatus'](0x194);}return _0x5cdef0;};}function handleError(_0x3b85db,_0x5304ff){_0x5304ff=_0x5304ff||0x1f4;return function(_0x15984d){logger[_0x7043('0x2c')](_0x15984d[_0x7043('0x2d')]);if(_0x15984d[_0x7043('0x2e')]){delete _0x15984d[_0x7043('0x2e')];}_0x3b85db[_0x7043('0x1d')](_0x5304ff)[_0x7043('0x2f')](_0x15984d);};}exports[_0x7043('0x30')]=function(_0x4ceced,_0x5de1bf){var _0x4df2c7={},_0x1fe0a4={},_0x222566={'count':0x0,'rows':[]};var _0x204895=_[_0x7043('0x31')](db['FaxQueue'][_0x7043('0x32')],function(_0x1452fb){return{'name':_0x1452fb[_0x7043('0x33')],'type':_0x1452fb[_0x7043('0x34')]['key']};});_0x1fe0a4['model']=_[_0x7043('0x31')](_0x204895,_0x7043('0x2e'));_0x1fe0a4[_0x7043('0x35')]=_['keys'](_0x4ceced['query']);_0x1fe0a4[_0x7043('0x36')]=_['intersection'](_0x1fe0a4[_0x7043('0x37')],_0x1fe0a4[_0x7043('0x35')]);_0x4df2c7['attributes']=_[_0x7043('0x38')](_0x1fe0a4[_0x7043('0x37')],qs['fields'](_0x4ceced[_0x7043('0x35')]['fields']));_0x4df2c7['attributes']=_0x4df2c7[_0x7043('0x39')][_0x7043('0x3a')]?_0x4df2c7[_0x7043('0x39')]:_0x1fe0a4[_0x7043('0x37')];if(!_0x4ceced[_0x7043('0x35')][_0x7043('0x3b')](_0x7043('0x3c'))){_0x4df2c7['limit']=qs[_0x7043('0x1f')](_0x4ceced[_0x7043('0x35')][_0x7043('0x1f')]);_0x4df2c7[_0x7043('0x21')]=qs[_0x7043('0x21')](_0x4ceced[_0x7043('0x35')][_0x7043('0x21')]);}_0x4df2c7[_0x7043('0x3d')]=qs[_0x7043('0x3e')](_0x4ceced['query'][_0x7043('0x3e')]);_0x4df2c7[_0x7043('0x3f')]=qs['filters'](_['pick'](_0x4ceced[_0x7043('0x35')],_0x1fe0a4[_0x7043('0x36')]),_0x204895);if(_0x4ceced[_0x7043('0x35')]['filter']){_0x4df2c7[_0x7043('0x3f')]=_[_0x7043('0x40')](_0x4df2c7[_0x7043('0x3f')],{'$or':_[_0x7043('0x31')](_0x204895,function(_0x380441){if(_0x380441['type']!==_0x7043('0x41')){var _0x3932b4={};_0x3932b4[_0x380441[_0x7043('0x2e')]]={'$like':'%'+_0x4ceced[_0x7043('0x35')]['filter']+'%'};return _0x3932b4;}})});}_0x4df2c7=_[_0x7043('0x40')]({},_0x4df2c7,_0x4ceced[_0x7043('0x42')]);var _0x32f1b1={'where':_0x4df2c7[_0x7043('0x3f')]};return db[_0x7043('0x43')][_0x7043('0x22')](_0x32f1b1)[_0x7043('0x26')](function(_0x54147f){_0x222566['count']=_0x54147f;if(_0x4ceced[_0x7043('0x35')][_0x7043('0x44')]){_0x4df2c7[_0x7043('0x45')]=[{'all':!![]}];}return db[_0x7043('0x43')][_0x7043('0x46')](_0x4df2c7);})['then'](function(_0x3f53c6){_0x222566['rows']=_0x3f53c6;return _0x222566;})[_0x7043('0x26')](respondWithFilteredResult(_0x5de1bf,_0x4df2c7))['catch'](handleError(_0x5de1bf,null));};exports['show']=function(_0x2cf47a,_0x594dfc){var _0x490a4b={'raw':!![],'where':{'id':_0x2cf47a[_0x7043('0x47')]['id']}},_0x4f8b27={};_0x4f8b27[_0x7043('0x37')]=_[_0x7043('0x48')](db[_0x7043('0x43')][_0x7043('0x32')]);_0x4f8b27['query']=_[_0x7043('0x48')](_0x2cf47a['query']);_0x4f8b27[_0x7043('0x36')]=_['intersection'](_0x4f8b27[_0x7043('0x37')],_0x4f8b27[_0x7043('0x35')]);_0x490a4b['attributes']=_[_0x7043('0x38')](_0x4f8b27[_0x7043('0x37')],qs[_0x7043('0x49')](_0x2cf47a[_0x7043('0x35')]['fields']));_0x490a4b['attributes']=_0x490a4b[_0x7043('0x39')][_0x7043('0x3a')]?_0x490a4b[_0x7043('0x39')]:_0x4f8b27['model'];if(_0x2cf47a[_0x7043('0x35')]['includeAll']){_0x490a4b['include']=[{'all':!![]}];}_0x490a4b=_[_0x7043('0x40')]({},_0x490a4b,_0x2cf47a[_0x7043('0x42')]);return db[_0x7043('0x43')][_0x7043('0x4a')](_0x490a4b)[_0x7043('0x26')](handleEntityNotFound(_0x594dfc,null))[_0x7043('0x26')](respondWithResult(_0x594dfc,null))[_0x7043('0x4b')](handleError(_0x594dfc,null));};exports[_0x7043('0x4c')]=function(_0x1db9ae,_0x1f02db){return db[_0x7043('0x43')][_0x7043('0x4c')](_0x1db9ae[_0x7043('0x4d')],{})[_0x7043('0x26')](function(_0x5ca5de){var _0x44ad07=_0x1db9ae[_0x7043('0x4e')][_0x7043('0x28')]({'plain':!![]});if(!_0x44ad07)throw new Error(_0x7043('0x4f'));if(_0x44ad07[_0x7043('0x50')]===_0x7043('0x4e')){var _0x37f452=_0x5ca5de[_0x7043('0x28')]({'plain':!![]});var _0x4176f4=_0x7043('0x29');return db[_0x7043('0x51')]['find']({'where':{'name':_0x4176f4,'userProfileId':_0x44ad07['userProfileId']},'raw':!![]})[_0x7043('0x26')](function(_0x3d96b7){if(_0x3d96b7&&_0x3d96b7[_0x7043('0x52')]===0x0){return db['UserProfileResource'][_0x7043('0x4c')]({'name':_0x37f452[_0x7043('0x2e')],'resourceId':_0x37f452['id'],'type':_0x3d96b7[_0x7043('0x2e')],'sectionId':_0x3d96b7['id']},{})[_0x7043('0x26')](function(){return _0x5ca5de;});}else{return _0x5ca5de;}})['catch'](function(_0x112c08){logger[_0x7043('0x2c')](_0x7043('0x53'),_0x112c08);throw _0x112c08;});}return _0x5ca5de;})['then'](respondWithResult(_0x1f02db,0xc9))['catch'](handleError(_0x1f02db,null));};exports[_0x7043('0x54')]=function(_0x16b6c0,_0x2fcebf){if(_0x16b6c0['body']['id']){delete _0x16b6c0['body']['id'];}return db[_0x7043('0x43')]['find']({'where':{'id':_0x16b6c0[_0x7043('0x47')]['id']}})[_0x7043('0x26')](handleEntityNotFound(_0x2fcebf,null))['then'](saveUpdates(_0x16b6c0[_0x7043('0x4d')],null))[_0x7043('0x26')](respondWithResult(_0x2fcebf,null))[_0x7043('0x4b')](handleError(_0x2fcebf,null));};exports[_0x7043('0x27')]=function(_0xd2366b,_0x1b5227){return db[_0x7043('0x43')][_0x7043('0x4a')]({'where':{'id':_0xd2366b[_0x7043('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b5227,null))['then'](removeEntity(_0x1b5227,null))[_0x7043('0x4b')](handleError(_0x1b5227,null));};exports[_0x7043('0x55')]=function(_0x1171bc,_0x1bd857){return db[_0x7043('0x43')][_0x7043('0x55')]()['then'](respondWithResult(_0x1bd857,null))[_0x7043('0x4b')](handleError(_0x1bd857,null));};exports[_0x7043('0x56')]=function(_0xbbd242,_0x1083bd,_0x4d6055){var _0x486ec0={'raw':!![],'where':{}},_0x4d5af9={},_0x486670;return db[_0x7043('0x43')][_0x7043('0x57')]({'where':{'id':_0xbbd242[_0x7043('0x47')]['id']}})[_0x7043('0x26')](handleEntityNotFound(_0x1083bd,null))[_0x7043('0x26')](function(_0x4f5e6a){if(_0x4f5e6a){_0x486670=_0x4f5e6a[_0x7043('0x28')]({'plain':!![]});_0x4d5af9[_0x7043('0x37')]=_[_0x7043('0x48')](db[_0x7043('0x58')][_0x7043('0x32')]);_0x4d5af9['query']=_[_0x7043('0x48')](_0xbbd242[_0x7043('0x35')]);_0x4d5af9[_0x7043('0x36')]=_[_0x7043('0x38')](_0x4d5af9[_0x7043('0x37')],_0x4d5af9['query']);_0x486ec0[_0x7043('0x39')]=_[_0x7043('0x38')](_0x4d5af9[_0x7043('0x37')],qs[_0x7043('0x49')](_0xbbd242['query'][_0x7043('0x49')]));_0x486ec0[_0x7043('0x39')]=_0x486ec0[_0x7043('0x39')][_0x7043('0x3a')]?_0x486ec0[_0x7043('0x39')]:_0x4d5af9[_0x7043('0x37')];if(!_0xbbd242[_0x7043('0x35')]['hasOwnProperty']('nolimit')){_0x486ec0[_0x7043('0x1f')]=qs[_0x7043('0x1f')](_0xbbd242['query'][_0x7043('0x1f')]);_0x486ec0[_0x7043('0x21')]=qs[_0x7043('0x21')](_0xbbd242['query'][_0x7043('0x21')]);}_0x486ec0[_0x7043('0x3d')]=qs['sort'](_0xbbd242['query'][_0x7043('0x3e')]);_0x486ec0['where']=qs['filters'](_[_0x7043('0x59')](_0xbbd242[_0x7043('0x35')],_0x4d5af9[_0x7043('0x36')]));_0x486ec0[_0x7043('0x3f')]['FaxQueueId']=_0x4f5e6a['id'];if(_0xbbd242[_0x7043('0x35')]['filter']){_0x486ec0[_0x7043('0x3f')]=_['merge'](_0x486ec0[_0x7043('0x3f')],{'$or':_['map'](_0x486ec0[_0x7043('0x39')],function(_0x45993d){var _0x8cc0ea={};_0x8cc0ea[_0x45993d]={'$like':'%'+_0xbbd242[_0x7043('0x35')]['filter']+'%'};return _0x8cc0ea;})});}_0x486ec0=_['merge']({},_0x486ec0,_0xbbd242['options']);return db[_0x7043('0x58')][_0x7043('0x46')](_0x486ec0);}})['then'](function(_0x5e9e4f){if(_0x5e9e4f){return db[_0x7043('0x5a')][_0x7043('0x5b')]({'where':{'id':_[_0x7043('0x31')](_0x5e9e4f,_0x7043('0x5c')),'role':_0x7043('0x5d')},'attributes':['id',_0x7043('0x2e'),'faxPause',_0x7043('0x5e'),_0x7043('0x5f')]});}})[_0x7043('0x26')](function(_0x10e2b3){if(_0x10e2b3){return{'count':_0x10e2b3[_0x7043('0x22')],'rows':_[_0x7043('0x31')](_0x10e2b3['rows'],function(_0x40aa32){return{'membername':_0x40aa32[_0x7043('0x2e')],'UserId':_0x40aa32['id'],'queue_name':_0x486670[_0x7043('0x2e')],'FaxQueueId':_0x486670['id'],'interface':util[_0x7043('0x60')](_0x7043('0x61'),_0x7043('0x62'),_0x40aa32[_0x7043('0x2e')]),'penalty':0x0,'paused':_0x40aa32[_0x7043('0x63')],'createdAt':_0x40aa32[_0x7043('0x5f')],'updatedAt':_0x40aa32[_0x7043('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7043('0x26')](respondWithFilteredResult(_0x1083bd,_0x486ec0))['catch'](handleError(_0x1083bd,null));};exports[_0x7043('0x64')]=function(_0x4e3050,_0x57b1cb,_0x587327){var _0x2958e={};var _0x359019={};var _0x312f0f;var _0x5df6cb;return db[_0x7043('0x43')]['findOne']({'where':{'id':_0x4e3050[_0x7043('0x47')]['id']}})[_0x7043('0x26')](handleEntityNotFound(_0x57b1cb,null))[_0x7043('0x26')](function(_0x4d0ea1){if(_0x4d0ea1){_0x312f0f=_0x4d0ea1;_0x359019[_0x7043('0x37')]=_[_0x7043('0x48')](db[_0x7043('0x65')][_0x7043('0x32')]);_0x359019[_0x7043('0x35')]=_['keys'](_0x4e3050[_0x7043('0x35')]);_0x359019[_0x7043('0x36')]=_['intersection'](_0x359019[_0x7043('0x37')],_0x359019[_0x7043('0x35')]);_0x2958e[_0x7043('0x39')]=_[_0x7043('0x38')](_0x359019['model'],qs[_0x7043('0x49')](_0x4e3050['query'][_0x7043('0x49')]));_0x2958e['attributes']=_0x2958e[_0x7043('0x39')][_0x7043('0x3a')]?_0x2958e[_0x7043('0x39')]:_0x359019[_0x7043('0x37')];_0x2958e[_0x7043('0x3d')]=qs['sort'](_0x4e3050['query']['sort']);_0x2958e[_0x7043('0x3f')]=qs[_0x7043('0x36')](_[_0x7043('0x59')](_0x4e3050[_0x7043('0x35')],_0x359019[_0x7043('0x36')]));if(_0x4e3050[_0x7043('0x35')][_0x7043('0x66')]){_0x2958e[_0x7043('0x3f')]=_['merge'](_0x2958e['where'],{'$or':_[_0x7043('0x31')](_0x2958e[_0x7043('0x39')],function(_0xe24e35){var _0xa32c2a={};_0xa32c2a[_0xe24e35]={'$like':'%'+_0x4e3050[_0x7043('0x35')][_0x7043('0x66')]+'%'};return _0xa32c2a;})});}_0x2958e=_[_0x7043('0x40')]({},_0x2958e,_0x4e3050['options']);return _0x312f0f[_0x7043('0x64')](_0x2958e);}})['then'](function(_0x56a8b7){if(_0x56a8b7){_0x5df6cb=_0x56a8b7['length'];if(!_0x4e3050[_0x7043('0x35')][_0x7043('0x3b')](_0x7043('0x3c'))){_0x2958e[_0x7043('0x1f')]=qs[_0x7043('0x1f')](_0x4e3050[_0x7043('0x35')][_0x7043('0x1f')]);_0x2958e[_0x7043('0x21')]=qs['offset'](_0x4e3050[_0x7043('0x35')]['offset']);}return _0x312f0f['getTeams'](_0x2958e);}})[_0x7043('0x26')](function(_0xe3128d){if(_0xe3128d){return _0xe3128d?{'count':_0x5df6cb,'rows':_0xe3128d}:null;}})['then'](respondWithResult(_0x57b1cb,null))[_0x7043('0x4b')](handleError(_0x57b1cb,null));};exports[_0x7043('0x67')]=function(_0x32a173,_0x3a112b,_0x1cb426){var _0x58b431=_0x32a173[_0x7043('0x4d')][_0x7043('0x68')];return db[_0x7043('0x65')]['findAll']({'where':{'id':_0x58b431},'attributes':['id'],'include':[{'model':db[_0x7043('0x5a')],'as':_0x7043('0x69'),'attributes':['id',_0x7043('0x2e'),'online',_0x7043('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0x5a4a45){if(_0x5a4a45){var _0x143593=_[_0x7043('0x6b')](_0x5a4a45,function(_0x3ebf7f){var _0x4791b6=_0x3ebf7f['get']({'plain':!![]});return _0x4791b6[_0x7043('0x69')];});return db['FaxQueue'][_0x7043('0x4a')]({'where':{'id':_0x32a173['params']['id']}})['then'](function(_0x4e8fb6){return db[_0x7043('0x6c')][_0x7043('0x6d')](function(_0x469e96){return _0x4e8fb6[_0x7043('0x67')](_0x58b431,{'transaction':_0x469e96})[_0x7043('0x26')](function(){return BPromise['each'](_0x143593,function(_0x6aa7bc){return db[_0x7043('0x58')][_0x7043('0x6e')]({'where':{'UserId':_0x6aa7bc['id'],'FaxQueueId':_0x32a173[_0x7043('0x47')]['id']},'transaction':_0x469e96});});})['then'](function(){_0x143593[_0x7043('0x6f')](function(_0x3e4aa4){socket['emit'](_0x7043('0x70'),{'UserId':_0x3e4aa4['id'],'FaxQueueId':_0x4e8fb6['id']});});});});});}})[_0x7043('0x26')](respondWithStatusCode(_0x3a112b,null))[_0x7043('0x4b')](handleError(_0x3a112b,null));};exports[_0x7043('0x71')]=function(_0x4d00e2,_0x4ba199,_0x25c176){return db['Team']['findAll']({'where':{'id':_0x4d00e2[_0x7043('0x35')][_0x7043('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7043('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4ba199,null))[_0x7043('0x26')](function(_0x3a6311){var _0x1b6922=_['map'](_0x3a6311,'id');var _0xf89efc=[];var _0x35dd54=[];var _0x31e323=squel[_0x7043('0x72')]();_0x31e323[_0x7043('0x73')](_0x7043('0x74'))[_0x7043('0x75')](_0x7043('0x76'),'tq')[_0x7043('0x77')](_0x7043('0x78'),'ut',_0x7043('0x79'))[_0x7043('0x3f')](_0x7043('0x7a'),_0x4d00e2[_0x7043('0x47')]['id']);for(var _0x101870=0x0;_0x101870<_0x3a6311['length'];_0x101870+=0x1){let _0x1f32df=_0x3a6311[_0x101870];for(var _0x2dd137=0x0;_0x2dd137<_0x1f32df['Agents'][_0x7043('0x3a')];_0x2dd137+=0x1){let _0x1ef04c=_0x1f32df[_0x7043('0x69')][_0x2dd137];var _0x521d14=_0x31e323['clone']();_0x521d14[_0x7043('0x3f')](_0x7043('0x7b'),_0x1ef04c['id']);_0x35dd54[_0x7043('0x7c')](db[_0x7043('0x6c')][_0x7043('0x35')](_0x521d14['toString'](),{'type':db[_0x7043('0x6c')][_0x7043('0x7d')][_0x7043('0x7e')]})[_0x7043('0x26')](function(_0x5654d6){if(_0x5654d6[_0x7043('0x3a')]===0x1){return _0x1ef04c['id'];}else{var _0x5c610e=_[_0x7043('0x7f')](_['map'](_0x5654d6,_0x7043('0x80')),function(_0x2a6aba){return _[_0x7043('0x81')](_0x1b6922,_0x2a6aba);});if(_0x5c610e){return _0x1ef04c['id'];}}}));}}return BPromise['all'](_0x35dd54)[_0x7043('0x26')](function(_0x5b4dc1){_0xf89efc=_(_0xf89efc)[_0x7043('0x82')](_0x5b4dc1)[_0x7043('0x83')]()['value']();return db[_0x7043('0x43')][_0x7043('0x4a')]({'where':{'id':_0x4d00e2['params']['id']}})['then'](function(_0x15533c){return db['sequelize'][_0x7043('0x6d')](function(_0x131ea){return _0x15533c[_0x7043('0x71')](_0x4d00e2[_0x7043('0x35')][_0x7043('0x68')],{'transaction':_0x131ea})['then'](function(){if(!_['isEmpty'](_0xf89efc)){return _0x15533c[_0x7043('0x84')](_0xf89efc,{'transaction':_0x131ea});}})[_0x7043('0x26')](function(){_0xf89efc['forEach'](function(_0x53eeb3){socket[_0x7043('0x85')](_0x7043('0x86'),{'UserId':_0x53eeb3,'FaxQueueId':_0x15533c['id']});});});});});});})['then'](respondWithStatusCode(_0x4ba199,null))[_0x7043('0x4b')](handleError(_0x4ba199,null));};exports[_0x7043('0x87')]=function(_0x3721eb,_0x2a4bdd,_0x31fb11){return db['FaxQueue'][_0x7043('0x4a')]({'where':{'id':_0x3721eb['params']['id']}})['then'](handleEntityNotFound(_0x2a4bdd,null))[_0x7043('0x26')](function(_0x357578){if(_0x357578){return _0x357578[_0x7043('0x87')](_0x3721eb[_0x7043('0x4d')]['ids'],_[_0x7043('0x88')](_0x3721eb[_0x7043('0x4d')],[_0x7043('0x68'),'id'])||{})[_0x7043('0x89')](function(_0x3cfe35){for(var _0x4e6d30=0x0;_0x4e6d30<_0x3721eb[_0x7043('0x4d')]['ids'][_0x7043('0x3a')];_0x4e6d30+=0x1){socket[_0x7043('0x85')](_0x7043('0x70'),{'UserId':Number(_0x3721eb[_0x7043('0x4d')][_0x7043('0x68')][_0x4e6d30]),'FaxQueueId':Number(_0x3721eb[_0x7043('0x47')]['id'])});}return _0x3cfe35;});}})[_0x7043('0x26')](respondWithResult(_0x2a4bdd,null))[_0x7043('0x4b')](handleError(_0x2a4bdd,null));};exports[_0x7043('0x84')]=function(_0x4647fd,_0x388e3c,_0x2faaac){return db[_0x7043('0x43')]['find']({'where':{'id':_0x4647fd[_0x7043('0x47')]['id']}})[_0x7043('0x26')](handleEntityNotFound(_0x388e3c,null))['then'](function(_0x4527eb){if(_0x4527eb){return _0x4527eb[_0x7043('0x84')](_0x4647fd['query']['ids'])['then'](function(){if(_['isArray'](_0x4647fd[_0x7043('0x35')][_0x7043('0x68')])){for(var _0x2beb53=0x0;_0x2beb53<_0x4647fd[_0x7043('0x35')][_0x7043('0x68')]['length'];_0x2beb53+=0x1){socket[_0x7043('0x85')]('userFaxQueue:remove',{'UserId':Number(_0x4647fd[_0x7043('0x35')]['ids'][_0x2beb53]),'FaxQueueId':Number(_0x4647fd[_0x7043('0x47')]['id'])});}}else{socket[_0x7043('0x85')]('userFaxQueue:remove',{'UserId':Number(_0x4647fd[_0x7043('0x35')][_0x7043('0x68')]),'FaxQueueId':Number(_0x4647fd[_0x7043('0x47')]['id'])});}});}})[_0x7043('0x26')](respondWithStatusCode(_0x388e3c,null))[_0x7043('0x4b')](handleError(_0x388e3c,null));};exports[_0x7043('0x8a')]=function(_0x4cb7fe,_0x14996b,_0x510de3){var _0x86c2e4={};var _0xd487f0={};var _0x10553f;var _0x220244;return db[_0x7043('0x43')][_0x7043('0x57')]({'where':{'id':_0x4cb7fe[_0x7043('0x47')]['id']}})[_0x7043('0x26')](handleEntityNotFound(_0x14996b,null))[_0x7043('0x26')](function(_0x2b84c6){if(_0x2b84c6){_0x10553f=_0x2b84c6;_0xd487f0[_0x7043('0x37')]=_[_0x7043('0x48')](db[_0x7043('0x5a')][_0x7043('0x32')]);_0xd487f0[_0x7043('0x35')]=_[_0x7043('0x48')](_0x4cb7fe[_0x7043('0x35')]);_0xd487f0['filters']=_[_0x7043('0x38')](_0xd487f0['model'],_0xd487f0['query']);_0x86c2e4[_0x7043('0x39')]=_['intersection'](_0xd487f0[_0x7043('0x37')],qs['fields'](_0x4cb7fe[_0x7043('0x35')][_0x7043('0x49')]));_0x86c2e4['attributes']=_0x86c2e4[_0x7043('0x39')][_0x7043('0x3a')]?_0x86c2e4['attributes']:_0xd487f0[_0x7043('0x37')];_0x86c2e4[_0x7043('0x3d')]=qs['sort'](_0x4cb7fe[_0x7043('0x35')]['sort']);_0x86c2e4[_0x7043('0x3f')]=qs['filters'](_[_0x7043('0x59')](_0x4cb7fe[_0x7043('0x35')],_0xd487f0['filters']));if(_0x4cb7fe['query'][_0x7043('0x66')]){_0x86c2e4[_0x7043('0x3f')]=_[_0x7043('0x40')](_0x86c2e4[_0x7043('0x3f')],{'$or':_['map'](_0x86c2e4[_0x7043('0x39')],function(_0x419146){var _0x155337={};_0x155337[_0x419146]={'$like':'%'+_0x4cb7fe[_0x7043('0x35')][_0x7043('0x66')]+'%'};return _0x155337;})});}_0x86c2e4=_[_0x7043('0x40')]({},_0x86c2e4,_0x4cb7fe['options']);return _0x10553f[_0x7043('0x8a')](_0x86c2e4);}})[_0x7043('0x26')](function(_0x49dad1){if(_0x49dad1){_0x220244=_0x49dad1[_0x7043('0x3a')];if(!_0x4cb7fe[_0x7043('0x35')][_0x7043('0x3b')](_0x7043('0x3c'))){_0x86c2e4['limit']=qs[_0x7043('0x1f')](_0x4cb7fe[_0x7043('0x35')][_0x7043('0x1f')]);_0x86c2e4['offset']=qs[_0x7043('0x21')](_0x4cb7fe['query'][_0x7043('0x21')]);}return _0x10553f[_0x7043('0x8a')](_0x86c2e4);}})[_0x7043('0x26')](function(_0x5ea9ef){if(_0x5ea9ef){return _0x5ea9ef?{'count':_0x220244,'rows':_0x5ea9ef}:null;}})[_0x7043('0x26')](respondWithResult(_0x14996b,null))[_0x7043('0x4b')](handleError(_0x14996b,null));}; \ No newline at end of file +var _0x6a9e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','localhost','redis','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','createdAt','rows','format','SIP','faxPause','updatedAt','getTeams','Team','ids','User','Agents','online','flatMap','sequelize','addTeams','each','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','userFaxQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1dbde9,_0x503ab3){var _0x4492a3=function(_0x1b2890){while(--_0x1b2890){_0x1dbde9['push'](_0x1dbde9['shift']());}};_0x4492a3(++_0x503ab3);}(_0x6a9e,0x18f));var _0xe6a9=function(_0x4430d2,_0x23bc33){_0x4430d2=_0x4430d2-0x0;var _0x60d400=_0x6a9e[_0x4430d2];return _0x60d400;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6a9('0x0'));var zipdir=require(_0xe6a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6a9('0x2'));var moment=require(_0xe6a9('0x3'));var BPromise=require(_0xe6a9('0x4'));var Mustache=require('mustache');var util=require(_0xe6a9('0x5'));var path=require(_0xe6a9('0x6'));var sox=require(_0xe6a9('0x7'));var csv=require(_0xe6a9('0x8'));var ejs=require(_0xe6a9('0x9'));var fs=require('fs');var fs_extra=require(_0xe6a9('0xa'));var _=require(_0xe6a9('0xb'));var squel=require(_0xe6a9('0xc'));var crypto=require(_0xe6a9('0xd'));var jsforce=require(_0xe6a9('0xe'));var deskjs=require(_0xe6a9('0xf'));var toCsv=require(_0xe6a9('0x8'));var querystring=require(_0xe6a9('0x10'));var Papa=require(_0xe6a9('0x11'));var Redis=require('ioredis');var authService=require(_0xe6a9('0x12'));var qs=require(_0xe6a9('0x13'));var as=require(_0xe6a9('0x14'));var hardwareService=require(_0xe6a9('0x15'));var logger=require('../../config/logger')(_0xe6a9('0x16'));var utils=require(_0xe6a9('0x17'));var config=require(_0xe6a9('0x18'));var licenseUtil=require(_0xe6a9('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe6a9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6a9('0x1b')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x568dc8,_0x25a401){_0x25a401=_0x25a401||0xcc;return function(_0x49293f){if(_0x49293f){return _0x568dc8[_0xe6a9('0x1c')](_0x25a401);}return _0x568dc8[_0xe6a9('0x1d')](_0x25a401)[_0xe6a9('0x1e')]();};}function respondWithResult(_0x5c2c27,_0x38b8b8){_0x38b8b8=_0x38b8b8||0xc8;return function(_0x124998){if(_0x124998){return _0x5c2c27[_0xe6a9('0x1d')](_0x38b8b8)['json'](_0x124998);}};}function respondWithFilteredResult(_0x1c1e9a,_0x58c589){return function(_0x2d7ca5){if(_0x2d7ca5){var _0x70edb2=typeof _0x58c589[_0xe6a9('0x1f')]==='undefined'&&typeof _0x58c589[_0xe6a9('0x20')]==='undefined';var _0x29ad32=_0x2d7ca5[_0xe6a9('0x21')];var _0x46e595=_0x70edb2?0x0:_0x58c589[_0xe6a9('0x1f')];var _0x51f4ee=_0x70edb2?_0x2d7ca5[_0xe6a9('0x21')]:_0x58c589[_0xe6a9('0x1f')]+_0x58c589['limit'];var _0x3bf0dc;if(_0x51f4ee>=_0x29ad32){_0x51f4ee=_0x29ad32;_0x3bf0dc=0xc8;}else{_0x3bf0dc=0xce;}_0x1c1e9a[_0xe6a9('0x1d')](_0x3bf0dc);return _0x1c1e9a[_0xe6a9('0x22')](_0xe6a9('0x23'),_0x46e595+'-'+_0x51f4ee+'/'+_0x29ad32)['json'](_0x2d7ca5);}return null;};}function patchUpdates(_0x2fcf49){return function(_0x15d503){try{jsonpatch[_0xe6a9('0x24')](_0x15d503,_0x2fcf49,!![]);}catch(_0x2f9443){return BPromise[_0xe6a9('0x25')](_0x2f9443);}return _0x15d503[_0xe6a9('0x26')]();};}function saveUpdates(_0x5a9b65,_0x589521){return function(_0x66a56b){if(_0x66a56b){return _0x66a56b['update'](_0x5a9b65)[_0xe6a9('0x27')](function(_0x465057){return _0x465057;});}return null;};}function removeEntity(_0x531384,_0xf3a39e){return function(_0x1399c5){if(_0x1399c5){return _0x1399c5['destroy']()[_0xe6a9('0x27')](function(){var _0x1b5864=_0x1399c5['get']({'plain':!![]});var _0x9d04ca=_0xe6a9('0x28');return db[_0xe6a9('0x29')][_0xe6a9('0x2a')]({'where':{'type':_0x9d04ca,'resourceId':_0x1b5864['id']}})[_0xe6a9('0x27')](function(){return _0x1399c5;});})[_0xe6a9('0x27')](function(){_0x531384['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23121d,_0x48bfa9){return function(_0x48f0eb){if(!_0x48f0eb){_0x23121d['sendStatus'](0x194);}return _0x48f0eb;};}function handleError(_0x53efdf,_0x2d2e46){_0x2d2e46=_0x2d2e46||0x1f4;return function(_0x137906){logger[_0xe6a9('0x2b')](_0x137906[_0xe6a9('0x2c')]);if(_0x137906[_0xe6a9('0x2d')]){delete _0x137906['name'];}_0x53efdf[_0xe6a9('0x1d')](_0x2d2e46)[_0xe6a9('0x2e')](_0x137906);};}exports[_0xe6a9('0x2f')]=function(_0x306ba4,_0x2ffab8){var _0x2ced8b={},_0x265575={},_0x47d9da={'count':0x0,'rows':[]};var _0x154136=_[_0xe6a9('0x30')](db[_0xe6a9('0x31')][_0xe6a9('0x32')],function(_0x20e2f4){return{'name':_0x20e2f4[_0xe6a9('0x33')],'type':_0x20e2f4[_0xe6a9('0x34')]['key']};});_0x265575[_0xe6a9('0x35')]=_[_0xe6a9('0x30')](_0x154136,_0xe6a9('0x2d'));_0x265575[_0xe6a9('0x36')]=_[_0xe6a9('0x37')](_0x306ba4['query']);_0x265575[_0xe6a9('0x38')]=_[_0xe6a9('0x39')](_0x265575[_0xe6a9('0x35')],_0x265575['query']);_0x2ced8b[_0xe6a9('0x3a')]=_['intersection'](_0x265575['model'],qs[_0xe6a9('0x3b')](_0x306ba4['query'][_0xe6a9('0x3b')]));_0x2ced8b[_0xe6a9('0x3a')]=_0x2ced8b['attributes'][_0xe6a9('0x3c')]?_0x2ced8b[_0xe6a9('0x3a')]:_0x265575[_0xe6a9('0x35')];if(!_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x3d')](_0xe6a9('0x3e'))){_0x2ced8b[_0xe6a9('0x20')]=qs['limit'](_0x306ba4[_0xe6a9('0x36')]['limit']);_0x2ced8b['offset']=qs[_0xe6a9('0x1f')](_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}_0x2ced8b[_0xe6a9('0x3f')]=qs['sort'](_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x40')]);_0x2ced8b[_0xe6a9('0x41')]=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0x306ba4[_0xe6a9('0x36')],_0x265575[_0xe6a9('0x38')]),_0x154136);if(_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x43')]){_0x2ced8b[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0x2ced8b['where'],{'$or':_['map'](_0x154136,function(_0x29102d){if(_0x29102d['type']!=='VIRTUAL'){var _0x1e627c={};_0x1e627c[_0x29102d[_0xe6a9('0x2d')]]={'$like':'%'+_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x1e627c;}})});}_0x2ced8b=_[_0xe6a9('0x44')]({},_0x2ced8b,_0x306ba4[_0xe6a9('0x45')]);var _0x5d7fad={'where':_0x2ced8b['where']};return db[_0xe6a9('0x31')][_0xe6a9('0x21')](_0x5d7fad)[_0xe6a9('0x27')](function(_0x1fc793){_0x47d9da['count']=_0x1fc793;if(_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x46')]){_0x2ced8b[_0xe6a9('0x47')]=[{'all':!![]}];}return db[_0xe6a9('0x31')][_0xe6a9('0x48')](_0x2ced8b);})[_0xe6a9('0x27')](function(_0x580ef4){_0x47d9da['rows']=_0x580ef4;return _0x47d9da;})[_0xe6a9('0x27')](respondWithFilteredResult(_0x2ffab8,_0x2ced8b))['catch'](handleError(_0x2ffab8,null));};exports[_0xe6a9('0x49')]=function(_0x5c197a,_0xd7d02a){var _0x2106b8={'raw':!![],'where':{'id':_0x5c197a[_0xe6a9('0x4a')]['id']}},_0x2af141={};_0x2af141['model']=_[_0xe6a9('0x37')](db['FaxQueue'][_0xe6a9('0x32')]);_0x2af141['query']=_[_0xe6a9('0x37')](_0x5c197a['query']);_0x2af141[_0xe6a9('0x38')]=_[_0xe6a9('0x39')](_0x2af141[_0xe6a9('0x35')],_0x2af141[_0xe6a9('0x36')]);_0x2106b8[_0xe6a9('0x3a')]=_[_0xe6a9('0x39')](_0x2af141['model'],qs['fields'](_0x5c197a[_0xe6a9('0x36')][_0xe6a9('0x3b')]));_0x2106b8[_0xe6a9('0x3a')]=_0x2106b8[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0x2106b8[_0xe6a9('0x3a')]:_0x2af141[_0xe6a9('0x35')];if(_0x5c197a['query'][_0xe6a9('0x46')]){_0x2106b8[_0xe6a9('0x47')]=[{'all':!![]}];}_0x2106b8=_[_0xe6a9('0x44')]({},_0x2106b8,_0x5c197a[_0xe6a9('0x45')]);return db[_0xe6a9('0x31')]['find'](_0x2106b8)['then'](handleEntityNotFound(_0xd7d02a,null))[_0xe6a9('0x27')](respondWithResult(_0xd7d02a,null))[_0xe6a9('0x4b')](handleError(_0xd7d02a,null));};exports['create']=function(_0x40972b,_0x4a8fd2){return db[_0xe6a9('0x31')][_0xe6a9('0x4c')](_0x40972b[_0xe6a9('0x4d')],{})[_0xe6a9('0x27')](function(_0x185250){var _0xdd5bf6=_0x40972b[_0xe6a9('0x4e')][_0xe6a9('0x4f')]({'plain':!![]});if(!_0xdd5bf6)throw new Error(_0xe6a9('0x50'));if(_0xdd5bf6[_0xe6a9('0x51')]==='user'){var _0x442e0d=_0x185250[_0xe6a9('0x4f')]({'plain':!![]});var _0x266c77='FaxQueues';return db[_0xe6a9('0x52')][_0xe6a9('0x53')]({'where':{'name':_0x266c77,'userProfileId':_0xdd5bf6[_0xe6a9('0x54')]},'raw':!![]})[_0xe6a9('0x27')](function(_0xa5e74){if(_0xa5e74&&_0xa5e74[_0xe6a9('0x55')]===0x0){return db['UserProfileResource'][_0xe6a9('0x4c')]({'name':_0x442e0d[_0xe6a9('0x2d')],'resourceId':_0x442e0d['id'],'type':_0xa5e74[_0xe6a9('0x2d')],'sectionId':_0xa5e74['id']},{})[_0xe6a9('0x27')](function(){return _0x185250;});}else{return _0x185250;}})[_0xe6a9('0x4b')](function(_0x5d2cd0){logger[_0xe6a9('0x2b')](_0xe6a9('0x56'),_0x5d2cd0);throw _0x5d2cd0;});}return _0x185250;})[_0xe6a9('0x27')](respondWithResult(_0x4a8fd2,0xc9))[_0xe6a9('0x4b')](handleError(_0x4a8fd2,null));};exports['update']=function(_0x149311,_0x45d46e){if(_0x149311[_0xe6a9('0x4d')]['id']){delete _0x149311[_0xe6a9('0x4d')]['id'];}return db['FaxQueue'][_0xe6a9('0x53')]({'where':{'id':_0x149311[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0x45d46e,null))[_0xe6a9('0x27')](saveUpdates(_0x149311[_0xe6a9('0x4d')],null))[_0xe6a9('0x27')](respondWithResult(_0x45d46e,null))['catch'](handleError(_0x45d46e,null));};exports[_0xe6a9('0x2a')]=function(_0x5dd5a1,_0x4a38bd){return db['FaxQueue'][_0xe6a9('0x53')]({'where':{'id':_0x5dd5a1[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a38bd,null))[_0xe6a9('0x27')](removeEntity(_0x4a38bd,null))['catch'](handleError(_0x4a38bd,null));};exports[_0xe6a9('0x57')]=function(_0x2d20a3,_0x29c0b1){return db[_0xe6a9('0x31')][_0xe6a9('0x57')]()[_0xe6a9('0x27')](respondWithResult(_0x29c0b1,null))['catch'](handleError(_0x29c0b1,null));};exports[_0xe6a9('0x58')]=function(_0xc5a511,_0xf395ed,_0x2d6363){var _0x3673c={'raw':!![],'where':{}},_0x45df38={},_0x19fc0b;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0xc5a511[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0xf395ed,null))[_0xe6a9('0x27')](function(_0x433457){if(_0x433457){_0x19fc0b=_0x433457['get']({'plain':!![]});_0x45df38['model']=_[_0xe6a9('0x37')](db[_0xe6a9('0x5a')][_0xe6a9('0x32')]);_0x45df38['query']=_[_0xe6a9('0x37')](_0xc5a511[_0xe6a9('0x36')]);_0x45df38[_0xe6a9('0x38')]=_['intersection'](_0x45df38[_0xe6a9('0x35')],_0x45df38[_0xe6a9('0x36')]);_0x3673c['attributes']=_[_0xe6a9('0x39')](_0x45df38['model'],qs[_0xe6a9('0x3b')](_0xc5a511['query'][_0xe6a9('0x3b')]));_0x3673c[_0xe6a9('0x3a')]=_0x3673c[_0xe6a9('0x3a')]['length']?_0x3673c[_0xe6a9('0x3a')]:_0x45df38[_0xe6a9('0x35')];if(!_0xc5a511['query'][_0xe6a9('0x3d')](_0xe6a9('0x3e'))){_0x3673c[_0xe6a9('0x20')]=qs[_0xe6a9('0x20')](_0xc5a511[_0xe6a9('0x36')]['limit']);_0x3673c[_0xe6a9('0x1f')]=qs['offset'](_0xc5a511['query'][_0xe6a9('0x1f')]);}_0x3673c[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0xc5a511[_0xe6a9('0x36')][_0xe6a9('0x40')]);_0x3673c[_0xe6a9('0x41')]=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0xc5a511[_0xe6a9('0x36')],_0x45df38[_0xe6a9('0x38')]));_0x3673c['where'][_0xe6a9('0x5b')]=_0x433457['id'];if(_0xc5a511['query'][_0xe6a9('0x43')]){_0x3673c['where']=_['merge'](_0x3673c['where'],{'$or':_[_0xe6a9('0x30')](_0x3673c['attributes'],function(_0x38f5af){var _0x226b77={};_0x226b77[_0x38f5af]={'$like':'%'+_0xc5a511[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x226b77;})});}_0x3673c=_['merge']({},_0x3673c,_0xc5a511[_0xe6a9('0x45')]);return db[_0xe6a9('0x5a')][_0xe6a9('0x48')](_0x3673c);}})[_0xe6a9('0x27')](function(_0x447da9){if(_0x447da9){return db['User'][_0xe6a9('0x5c')]({'where':{'id':_[_0xe6a9('0x30')](_0x447da9,_0xe6a9('0x5d')),'role':'agent'},'attributes':['id',_0xe6a9('0x2d'),'faxPause','updatedAt',_0xe6a9('0x5e')]});}})[_0xe6a9('0x27')](function(_0x3d28a9){if(_0x3d28a9){return{'count':_0x3d28a9[_0xe6a9('0x21')],'rows':_['map'](_0x3d28a9[_0xe6a9('0x5f')],function(_0x5223a8){return{'membername':_0x5223a8['name'],'UserId':_0x5223a8['id'],'queue_name':_0x19fc0b['name'],'FaxQueueId':_0x19fc0b['id'],'interface':util[_0xe6a9('0x60')]('%s/%s',_0xe6a9('0x61'),_0x5223a8['name']),'penalty':0x0,'paused':_0x5223a8[_0xe6a9('0x62')],'createdAt':_0x5223a8[_0xe6a9('0x5e')],'updatedAt':_0x5223a8[_0xe6a9('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe6a9('0x27')](respondWithFilteredResult(_0xf395ed,_0x3673c))[_0xe6a9('0x4b')](handleError(_0xf395ed,null));};exports[_0xe6a9('0x64')]=function(_0xa46919,_0x341657,_0x30a5f4){var _0x3ee646={};var _0x1e40b4={};var _0x158b11;var _0x397c7b;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0xa46919[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x341657,null))[_0xe6a9('0x27')](function(_0x45f22e){if(_0x45f22e){_0x158b11=_0x45f22e;_0x1e40b4[_0xe6a9('0x35')]=_['keys'](db[_0xe6a9('0x65')]['rawAttributes']);_0x1e40b4[_0xe6a9('0x36')]=_['keys'](_0xa46919[_0xe6a9('0x36')]);_0x1e40b4['filters']=_[_0xe6a9('0x39')](_0x1e40b4[_0xe6a9('0x35')],_0x1e40b4[_0xe6a9('0x36')]);_0x3ee646[_0xe6a9('0x3a')]=_[_0xe6a9('0x39')](_0x1e40b4[_0xe6a9('0x35')],qs[_0xe6a9('0x3b')](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x3b')]));_0x3ee646[_0xe6a9('0x3a')]=_0x3ee646[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0x3ee646[_0xe6a9('0x3a')]:_0x1e40b4['model'];_0x3ee646[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0xa46919['query'][_0xe6a9('0x40')]);_0x3ee646['where']=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0xa46919[_0xe6a9('0x36')],_0x1e40b4['filters']));if(_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x43')]){_0x3ee646[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0x3ee646[_0xe6a9('0x41')],{'$or':_[_0xe6a9('0x30')](_0x3ee646[_0xe6a9('0x3a')],function(_0x4a9436){var _0x3534b8={};_0x3534b8[_0x4a9436]={'$like':'%'+_0xa46919['query']['filter']+'%'};return _0x3534b8;})});}_0x3ee646=_['merge']({},_0x3ee646,_0xa46919[_0xe6a9('0x45')]);return _0x158b11[_0xe6a9('0x64')](_0x3ee646);}})['then'](function(_0x3d919c){if(_0x3d919c){_0x397c7b=_0x3d919c[_0xe6a9('0x3c')];if(!_0xa46919['query']['hasOwnProperty'](_0xe6a9('0x3e'))){_0x3ee646['limit']=qs['limit'](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x20')]);_0x3ee646[_0xe6a9('0x1f')]=qs[_0xe6a9('0x1f')](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}return _0x158b11[_0xe6a9('0x64')](_0x3ee646);}})['then'](function(_0x4b9e8d){if(_0x4b9e8d){return _0x4b9e8d?{'count':_0x397c7b,'rows':_0x4b9e8d}:null;}})[_0xe6a9('0x27')](respondWithResult(_0x341657,null))[_0xe6a9('0x4b')](handleError(_0x341657,null));};exports['addTeams']=function(_0x2a39da,_0x49af05,_0x33a8a1){var _0x5cf48f=_0x2a39da[_0xe6a9('0x4d')][_0xe6a9('0x66')];return db[_0xe6a9('0x65')][_0xe6a9('0x48')]({'where':{'id':_0x5cf48f},'attributes':['id'],'include':[{'model':db[_0xe6a9('0x67')],'as':_0xe6a9('0x68'),'attributes':['id','name',_0xe6a9('0x69'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x305d2f){if(_0x305d2f){var _0x314023=_[_0xe6a9('0x6a')](_0x305d2f,function(_0x4cb107){var _0x1857ff=_0x4cb107[_0xe6a9('0x4f')]({'plain':!![]});return _0x1857ff[_0xe6a9('0x68')];});return db[_0xe6a9('0x31')]['find']({'where':{'id':_0x2a39da[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](function(_0x3d2023){return db[_0xe6a9('0x6b')]['transaction'](function(_0x43019b){return _0x3d2023[_0xe6a9('0x6c')](_0x5cf48f,{'transaction':_0x43019b})[_0xe6a9('0x27')](function(){return BPromise[_0xe6a9('0x6d')](_0x314023,function(_0x41c4c5){return db[_0xe6a9('0x5a')]['findOrCreate']({'where':{'UserId':_0x41c4c5['id'],'FaxQueueId':_0x2a39da['params']['id']},'transaction':_0x43019b});});})[_0xe6a9('0x27')](function(){_0x314023['forEach'](function(_0x380d22){socket[_0xe6a9('0x6e')](_0xe6a9('0x6f'),{'UserId':_0x380d22['id'],'FaxQueueId':_0x3d2023['id']});});});});});}})['then'](respondWithStatusCode(_0x49af05,null))[_0xe6a9('0x4b')](handleError(_0x49af05,null));};exports[_0xe6a9('0x70')]=function(_0x1f7661,_0x1b939f,_0x42b219){return db[_0xe6a9('0x65')][_0xe6a9('0x48')]({'where':{'id':_0x1f7661[_0xe6a9('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe6a9('0x67')],'as':_0xe6a9('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe6a9('0x27')](handleEntityNotFound(_0x1b939f,null))[_0xe6a9('0x27')](function(_0x27ded8){var _0x35fe87=_['map'](_0x27ded8,'id');var _0x2a7a1a=[];var _0xbd3de=[];var _0x4467e3=squel[_0xe6a9('0x71')]();_0x4467e3[_0xe6a9('0x72')](_0xe6a9('0x73'))[_0xe6a9('0x74')](_0xe6a9('0x75'),'tq')[_0xe6a9('0x76')](_0xe6a9('0x77'),'ut',_0xe6a9('0x78'))[_0xe6a9('0x41')]('FaxQueueId\x20=\x20?',_0x1f7661[_0xe6a9('0x4a')]['id']);for(var _0x5951f8=0x0;_0x5951f8<_0x27ded8['length'];_0x5951f8+=0x1){let _0x3ac812=_0x27ded8[_0x5951f8];for(var _0x3b79cc=0x0;_0x3b79cc<_0x3ac812[_0xe6a9('0x68')][_0xe6a9('0x3c')];_0x3b79cc+=0x1){let _0x596d98=_0x3ac812[_0xe6a9('0x68')][_0x3b79cc];var _0x683e32=_0x4467e3['clone']();_0x683e32['where'](_0xe6a9('0x79'),_0x596d98['id']);_0xbd3de[_0xe6a9('0x7a')](db[_0xe6a9('0x6b')][_0xe6a9('0x36')](_0x683e32['toString'](),{'type':db[_0xe6a9('0x6b')][_0xe6a9('0x7b')]['SELECT']})[_0xe6a9('0x27')](function(_0x52ca28){if(_0x52ca28[_0xe6a9('0x3c')]===0x1){return _0x596d98['id'];}else{var _0x496de9=_[_0xe6a9('0x7c')](_[_0xe6a9('0x30')](_0x52ca28,'TeamId'),function(_0x5cf19f){return _[_0xe6a9('0x7d')](_0x35fe87,_0x5cf19f);});if(_0x496de9){return _0x596d98['id'];}}}));}}return BPromise[_0xe6a9('0x7e')](_0xbd3de)[_0xe6a9('0x27')](function(_0x5db40){_0x2a7a1a=_(_0x2a7a1a)[_0xe6a9('0x7f')](_0x5db40)[_0xe6a9('0x80')]()[_0xe6a9('0x81')]();return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x1f7661['params']['id']}})[_0xe6a9('0x27')](function(_0x1bff92){return db[_0xe6a9('0x6b')][_0xe6a9('0x82')](function(_0x3a7aba){return _0x1bff92['removeTeams'](_0x1f7661[_0xe6a9('0x36')]['ids'],{'transaction':_0x3a7aba})[_0xe6a9('0x27')](function(){if(!_[_0xe6a9('0x83')](_0x2a7a1a)){return _0x1bff92[_0xe6a9('0x84')](_0x2a7a1a,{'transaction':_0x3a7aba});}})[_0xe6a9('0x27')](function(){_0x2a7a1a[_0xe6a9('0x85')](function(_0x18a9cc){socket[_0xe6a9('0x6e')]('userFaxQueue:remove',{'UserId':_0x18a9cc,'FaxQueueId':_0x1bff92['id']});});});});});});})[_0xe6a9('0x27')](respondWithStatusCode(_0x1b939f,null))[_0xe6a9('0x4b')](handleError(_0x1b939f,null));};exports[_0xe6a9('0x86')]=function(_0x2fddd5,_0x30c09b,_0x5503d0){return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x2fddd5[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30c09b,null))[_0xe6a9('0x27')](function(_0x2c13fd){if(_0x2c13fd){return _0x2c13fd['addAgents'](_0x2fddd5[_0xe6a9('0x4d')][_0xe6a9('0x66')],_[_0xe6a9('0x87')](_0x2fddd5['body'],[_0xe6a9('0x66'),'id'])||{})[_0xe6a9('0x88')](function(_0x322a79){for(var _0x4b7fb1=0x0;_0x4b7fb1<_0x2fddd5[_0xe6a9('0x4d')]['ids']['length'];_0x4b7fb1+=0x1){socket[_0xe6a9('0x6e')](_0xe6a9('0x6f'),{'UserId':Number(_0x2fddd5['body'][_0xe6a9('0x66')][_0x4b7fb1]),'FaxQueueId':Number(_0x2fddd5['params']['id'])});}return _0x322a79;});}})[_0xe6a9('0x27')](respondWithResult(_0x30c09b,null))[_0xe6a9('0x4b')](handleError(_0x30c09b,null));};exports['removeAgents']=function(_0x5b89be,_0x78c5f6,_0x1273f9){return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x5b89be[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0x78c5f6,null))[_0xe6a9('0x27')](function(_0x4e819d){if(_0x4e819d){return _0x4e819d[_0xe6a9('0x84')](_0x5b89be['query'][_0xe6a9('0x66')])['then'](function(){if(_['isArray'](_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')])){for(var _0x4c99a4=0x0;_0x4c99a4<_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')][_0xe6a9('0x3c')];_0x4c99a4+=0x1){socket[_0xe6a9('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x5b89be['query'][_0xe6a9('0x66')][_0x4c99a4]),'FaxQueueId':Number(_0x5b89be[_0xe6a9('0x4a')]['id'])});}}else{socket[_0xe6a9('0x6e')](_0xe6a9('0x89'),{'UserId':Number(_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')]),'FaxQueueId':Number(_0x5b89be[_0xe6a9('0x4a')]['id'])});}});}})[_0xe6a9('0x27')](respondWithStatusCode(_0x78c5f6,null))[_0xe6a9('0x4b')](handleError(_0x78c5f6,null));};exports[_0xe6a9('0x8a')]=function(_0x16f1f8,_0x4c2b90,_0x945c76){var _0xe371c9={};var _0x2987fa={};var _0x2fb42a;var _0x1a4a82;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0x16f1f8[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c2b90,null))[_0xe6a9('0x27')](function(_0x214333){if(_0x214333){_0x2fb42a=_0x214333;_0x2987fa[_0xe6a9('0x35')]=_[_0xe6a9('0x37')](db[_0xe6a9('0x67')][_0xe6a9('0x32')]);_0x2987fa[_0xe6a9('0x36')]=_[_0xe6a9('0x37')](_0x16f1f8[_0xe6a9('0x36')]);_0x2987fa[_0xe6a9('0x38')]=_['intersection'](_0x2987fa[_0xe6a9('0x35')],_0x2987fa[_0xe6a9('0x36')]);_0xe371c9[_0xe6a9('0x3a')]=_['intersection'](_0x2987fa['model'],qs[_0xe6a9('0x3b')](_0x16f1f8[_0xe6a9('0x36')]['fields']));_0xe371c9[_0xe6a9('0x3a')]=_0xe371c9[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0xe371c9[_0xe6a9('0x3a')]:_0x2987fa[_0xe6a9('0x35')];_0xe371c9[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0x16f1f8['query']['sort']);_0xe371c9[_0xe6a9('0x41')]=qs['filters'](_[_0xe6a9('0x42')](_0x16f1f8[_0xe6a9('0x36')],_0x2987fa[_0xe6a9('0x38')]));if(_0x16f1f8[_0xe6a9('0x36')]['filter']){_0xe371c9[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0xe371c9[_0xe6a9('0x41')],{'$or':_[_0xe6a9('0x30')](_0xe371c9[_0xe6a9('0x3a')],function(_0x10587a){var _0x229dbe={};_0x229dbe[_0x10587a]={'$like':'%'+_0x16f1f8[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x229dbe;})});}_0xe371c9=_[_0xe6a9('0x44')]({},_0xe371c9,_0x16f1f8[_0xe6a9('0x45')]);return _0x2fb42a[_0xe6a9('0x8a')](_0xe371c9);}})['then'](function(_0x5ac3b1){if(_0x5ac3b1){_0x1a4a82=_0x5ac3b1[_0xe6a9('0x3c')];if(!_0x16f1f8['query'][_0xe6a9('0x3d')]('nolimit')){_0xe371c9[_0xe6a9('0x20')]=qs[_0xe6a9('0x20')](_0x16f1f8['query'][_0xe6a9('0x20')]);_0xe371c9['offset']=qs[_0xe6a9('0x1f')](_0x16f1f8[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}return _0x2fb42a[_0xe6a9('0x8a')](_0xe371c9);}})[_0xe6a9('0x27')](function(_0x3a8bae){if(_0x3a8bae){return _0x3a8bae?{'count':_0x1a4a82,'rows':_0x3a8bae}:null;}})[_0xe6a9('0x27')](respondWithResult(_0x4c2b90,null))['catch'](handleError(_0x4c2b90,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8d07588..d4d08e6 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 _0x0115=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove'];(function(_0x5576e1,_0x20070b){var _0xdfcb8d=function(_0x2ba0ea){while(--_0x2ba0ea){_0x5576e1['push'](_0x5576e1['shift']());}};_0xdfcb8d(++_0x20070b);}(_0x0115,0x176));var _0x5011=function(_0x4e3555,_0x3909bf){_0x4e3555=_0x4e3555-0x0;var _0x4458ff=_0x0115[_0x4e3555];return _0x4458ff;};'use strict';var EventEmitter=require(_0x5011('0x0'));var FaxQueue=require(_0x5011('0x1'))['db'][_0x5011('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5011('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5011('0x4'),'afterDestroy':_0x5011('0x5')};function emitEvent(_0x48df61){return function(_0x54b228,_0x24de18,_0x4c9a7c){FaxQueueEvents[_0x5011('0x6')](_0x48df61+':'+_0x54b228['id'],_0x54b228);FaxQueueEvents[_0x5011('0x6')](_0x48df61,_0x54b228);_0x4c9a7c(null);};}for(var e in events){if(events[_0x5011('0x7')](e)){var event=events[e];FaxQueue[_0x5011('0x8')](e,emitEvent(event));}}module[_0x5011('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xe9a1=['FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x4146ea,_0x5b3b71){var _0x17bf92=function(_0x374dea){while(--_0x374dea){_0x4146ea['push'](_0x4146ea['shift']());}};_0x17bf92(++_0x5b3b71);}(_0xe9a1,0x8f));var _0x1e9a=function(_0x554895,_0x1d8ad4){_0x554895=_0x554895-0x0;var _0x86a927=_0xe9a1[_0x554895];return _0x86a927;};'use strict';var EventEmitter=require(_0x1e9a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1e9a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1e9a('0x2')](0x0);var events={'afterCreate':_0x1e9a('0x3'),'afterUpdate':_0x1e9a('0x4'),'afterDestroy':_0x1e9a('0x5')};function emitEvent(_0x13caaa){return function(_0x38cd53,_0x4647d0,_0x3e7131){FaxQueueEvents[_0x1e9a('0x6')](_0x13caaa+':'+_0x38cd53['id'],_0x38cd53);FaxQueueEvents[_0x1e9a('0x6')](_0x13caaa,_0x38cd53);_0x3e7131(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1e9a('0x7')](e,emitEvent(event));}}module[_0x1e9a('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d96ca1c..3117c27 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 _0xd9b9=['FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xd9b9,0x1bc));var _0x9d9b=function(_0x3012c5,_0x394ef8){_0x3012c5=_0x3012c5-0x0;var _0x52389e=_0xd9b9[_0x3012c5];return _0x52389e;};'use strict';var _=require(_0x9d9b('0x0'));var util=require(_0x9d9b('0x1'));var logger=require(_0x9d9b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9d9b('0x3'));var rp=require(_0x9d9b('0x4'));var fs=require('fs');var path=require(_0x9d9b('0x5'));var rimraf=require(_0x9d9b('0x6'));var config=require(_0x9d9b('0x7'));var attributes=require(_0x9d9b('0x8'));module[_0x9d9b('0x9')]=function(_0x2adb52,_0x586062){return _0x2adb52[_0x9d9b('0xa')](_0x9d9b('0xb'),attributes,{'tableName':_0x9d9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab29=['fax_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x1d32e2,_0x2c9a43){var _0x2b5319=function(_0x5a831d){while(--_0x5a831d){_0x1d32e2['push'](_0x1d32e2['shift']());}};_0x2b5319(++_0x2c9a43);}(_0xab29,0xa6));var _0x9ab2=function(_0x36ab6e,_0x4e1b52){_0x36ab6e=_0x36ab6e-0x0;var _0x73a78f=_0xab29[_0x36ab6e];return _0x73a78f;};'use strict';var _=require(_0x9ab2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9ab2('0x1'));var rp=require(_0x9ab2('0x2'));var fs=require('fs');var path=require(_0x9ab2('0x3'));var rimraf=require(_0x9ab2('0x4'));var config=require(_0x9ab2('0x5'));var attributes=require(_0x9ab2('0x6'));module[_0x9ab2('0x7')]=function(_0x3f26a3,_0x346b3b){return _0x3f26a3[_0x9ab2('0x8')](_0x9ab2('0x9'),attributes,{'tableName':_0x9ab2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 80d6ca7..729c2cf 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 _0x2ff6=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','map','include','model','ShowFaxQueue','find','then','lodash'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x2ff6,0x77));var _0x62ff=function(_0x3e7d83,_0x518e86){_0x3e7d83=_0x3e7d83-0x0;var _0x2cbca5=_0x2ff6[_0x3e7d83];return _0x2cbca5;};'use strict';var _=require(_0x62ff('0x0'));var util=require(_0x62ff('0x1'));var moment=require(_0x62ff('0x2'));var BPromise=require(_0x62ff('0x3'));var rs=require(_0x62ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62ff('0x5'))['db'];var utils=require(_0x62ff('0x6'));var logger=require('../../config/logger')(_0x62ff('0x7'));var config=require(_0x62ff('0x8'));var jayson=require(_0x62ff('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x62ff('0xa')](config[_0x62ff('0xb')],{'host':_0x62ff('0xc'),'port':0x18eb});var socket=require(_0x62ff('0xd'))(new Redis(config[_0x62ff('0xb')]));require(_0x62ff('0xe'))[_0x62ff('0xf')](socket);function respondWithRpcPromise(_0x26997a,_0xe0814b,_0x10c72a){return new BPromise(function(_0x4e56bc,_0x5b5c87){return client[_0x62ff('0x10')](_0x26997a,_0x10c72a)['then'](function(_0x4ca030){logger[_0x62ff('0x11')]('FaxQueue,\x20%s,\x20%s',_0xe0814b,_0x62ff('0x12'));logger[_0x62ff('0x13')](_0x62ff('0x14'),_0xe0814b,_0x62ff('0x12'),JSON[_0x62ff('0x15')](_0x4ca030));if(_0x4ca030[_0x62ff('0x16')]){if(_0x4ca030[_0x62ff('0x16')][_0x62ff('0x17')]===0x1f4){logger[_0x62ff('0x16')](_0x62ff('0x18'),_0xe0814b,_0x4ca030['error'][_0x62ff('0x19')]);return _0x5b5c87(_0x4ca030[_0x62ff('0x16')][_0x62ff('0x19')]);}logger[_0x62ff('0x16')](_0x62ff('0x18'),_0xe0814b,_0x4ca030[_0x62ff('0x16')][_0x62ff('0x19')]);return _0x4e56bc(_0x4ca030[_0x62ff('0x16')][_0x62ff('0x19')]);}else{logger[_0x62ff('0x11')](_0x62ff('0x18'),_0xe0814b,_0x62ff('0x12'));_0x4e56bc(_0x4ca030['result'][_0x62ff('0x19')]);}})[_0x62ff('0x1a')](function(_0x1bbdb2){logger['error'](_0x62ff('0x18'),_0xe0814b,_0x1bbdb2);_0x5b5c87(_0x1bbdb2);});});}exports[_0x62ff('0x1b')]=function(_0x552d8c){var _0x5598eb=this;return new Promise(function(_0x51bbec,_0x3a1e37){return db[_0x62ff('0x1c')][_0x62ff('0x1d')]({'raw':_0x552d8c['options']?_0x552d8c[_0x62ff('0x1e')][_0x62ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x552d8c[_0x62ff('0x1e')]?_0x552d8c[_0x62ff('0x1e')][_0x62ff('0x20')]||null:null,'attributes':_0x552d8c[_0x62ff('0x1e')]?_0x552d8c[_0x62ff('0x1e')][_0x62ff('0x21')]||null:null,'limit':_0x552d8c['options']?_0x552d8c[_0x62ff('0x1e')]['limit']||null:null,'include':_0x552d8c[_0x62ff('0x1e')]?_0x552d8c[_0x62ff('0x1e')]['include']?_[_0x62ff('0x22')](_0x552d8c[_0x62ff('0x1e')][_0x62ff('0x23')],function(_0x3174b4){return{'model':db[_0x3174b4[_0x62ff('0x24')]],'as':_0x3174b4['as'],'attributes':_0x3174b4[_0x62ff('0x21')],'include':_0x3174b4[_0x62ff('0x23')]?_['map'](_0x3174b4[_0x62ff('0x23')],function(_0x1f6dee){return{'model':db[_0x1f6dee['model']],'as':_0x1f6dee['as'],'attributes':_0x1f6dee['attributes'],'include':_0x1f6dee['include']?_[_0x62ff('0x22')](_0x1f6dee[_0x62ff('0x23')],function(_0x411870){return{'model':db[_0x411870[_0x62ff('0x24')]],'as':_0x411870['as'],'attributes':_0x411870[_0x62ff('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e5412){logger[_0x62ff('0x11')](_0x62ff('0x1b'),_0x552d8c);logger['debug'](_0x62ff('0x1b'),_0x552d8c,JSON[_0x62ff('0x15')](_0x1e5412));_0x51bbec(_0x1e5412);})[_0x62ff('0x1a')](function(_0x54be78){logger['error'](_0x62ff('0x1b'),_0x54be78[_0x62ff('0x19')],_0x552d8c);_0x3a1e37(_0x5598eb[_0x62ff('0x16')](0x1f4,_0x54be78['message']));});});};exports[_0x62ff('0x25')]=function(_0x27da39){var _0x2b5a17=this;return new Promise(function(_0x2ec20c,_0x531efd){return db[_0x62ff('0x1c')][_0x62ff('0x26')]({'raw':_0x27da39[_0x62ff('0x1e')]?_0x27da39[_0x62ff('0x1e')][_0x62ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x27da39[_0x62ff('0x1e')]?_0x27da39[_0x62ff('0x1e')][_0x62ff('0x20')]||null:null,'attributes':_0x27da39[_0x62ff('0x1e')]?_0x27da39[_0x62ff('0x1e')][_0x62ff('0x21')]||null:null,'include':_0x27da39[_0x62ff('0x1e')]?_0x27da39[_0x62ff('0x1e')][_0x62ff('0x23')]?_['map'](_0x27da39['options'][_0x62ff('0x23')],function(_0x40aa4a){return{'model':db[_0x40aa4a[_0x62ff('0x24')]],'as':_0x40aa4a['as'],'attributes':_0x40aa4a['attributes'],'include':_0x40aa4a[_0x62ff('0x23')]?_[_0x62ff('0x22')](_0x40aa4a[_0x62ff('0x23')],function(_0x3261f9){return{'model':db[_0x3261f9['model']],'as':_0x3261f9['as'],'attributes':_0x3261f9['attributes'],'include':_0x3261f9[_0x62ff('0x23')]?_[_0x62ff('0x22')](_0x3261f9[_0x62ff('0x23')],function(_0x3a729e){return{'model':db[_0x3a729e[_0x62ff('0x24')]],'as':_0x3a729e['as'],'attributes':_0x3a729e['attributes']};}):[]};}):[]};}):[]:[]})[_0x62ff('0x27')](function(_0x4726cd){logger[_0x62ff('0x11')](_0x62ff('0x25'),_0x27da39);logger[_0x62ff('0x13')](_0x62ff('0x25'),_0x27da39,JSON[_0x62ff('0x15')](_0x4726cd));_0x2ec20c(_0x4726cd);})[_0x62ff('0x1a')](function(_0x5a27f3){logger['error'](_0x62ff('0x25'),_0x5a27f3['message'],_0x27da39);_0x531efd(_0x2b5a17[_0x62ff('0x16')](0x1f4,_0x5a27f3['message']));});});}; \ No newline at end of file +var _0x90a4=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','stringify','ShowFaxQueue','find','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x90a4,0x113));var _0x490a=function(_0x3c38ee,_0x48f99e){_0x3c38ee=_0x3c38ee-0x0;var _0x1874ea=_0x90a4[_0x3c38ee];return _0x1874ea;};'use strict';var _=require(_0x490a('0x0'));var util=require(_0x490a('0x1'));var moment=require('moment');var BPromise=require(_0x490a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x490a('0x3'));var db=require(_0x490a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x490a('0x5'))(_0x490a('0x6'));var config=require('../../config/environment');var jayson=require(_0x490a('0x7'));var client=jayson[_0x490a('0x8')][_0x490a('0x9')]({'port':0x232a});config[_0x490a('0xa')]=_[_0x490a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x490a('0xc'))(new Redis(config[_0x490a('0xa')]));require(_0x490a('0xd'))[_0x490a('0xe')](socket);function respondWithRpcPromise(_0x19ba55,_0xef5810,_0x5ae41c){return new BPromise(function(_0x3779ca,_0x554dea){return client['request'](_0x19ba55,_0x5ae41c)['then'](function(_0x33093c){logger['info'](_0x490a('0xf'),_0xef5810,'request\x20sent');logger['debug'](_0x490a('0x10'),_0xef5810,_0x490a('0x11'),JSON['stringify'](_0x33093c));if(_0x33093c[_0x490a('0x12')]){if(_0x33093c['error'][_0x490a('0x13')]===0x1f4){logger[_0x490a('0x12')](_0x490a('0xf'),_0xef5810,_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);return _0x554dea(_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);}logger['error'](_0x490a('0xf'),_0xef5810,_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);return _0x3779ca(_0x33093c[_0x490a('0x12')]['message']);}else{logger[_0x490a('0x15')](_0x490a('0xf'),_0xef5810,'request\x20sent');_0x3779ca(_0x33093c[_0x490a('0x16')][_0x490a('0x14')]);}})[_0x490a('0x17')](function(_0x1bcc2e){logger[_0x490a('0x12')](_0x490a('0xf'),_0xef5810,_0x1bcc2e);_0x554dea(_0x1bcc2e);});});}exports[_0x490a('0x18')]=function(_0x325064){var _0x48edea=this;return new Promise(function(_0x36cb5d,_0x4bbacb){return db[_0x490a('0x19')][_0x490a('0x1a')]({'raw':_0x325064[_0x490a('0x1b')]?_0x325064[_0x490a('0x1b')][_0x490a('0x1c')]===undefined?!![]:![]:!![],'where':_0x325064[_0x490a('0x1b')]?_0x325064['options'][_0x490a('0x1d')]||null:null,'attributes':_0x325064['options']?_0x325064[_0x490a('0x1b')][_0x490a('0x1e')]||null:null,'limit':_0x325064[_0x490a('0x1b')]?_0x325064[_0x490a('0x1b')][_0x490a('0x1f')]||null:null,'include':_0x325064[_0x490a('0x1b')]?_0x325064['options'][_0x490a('0x20')]?_['map'](_0x325064['options'][_0x490a('0x20')],function(_0x546e88){return{'model':db[_0x546e88[_0x490a('0x21')]],'as':_0x546e88['as'],'attributes':_0x546e88[_0x490a('0x1e')],'include':_0x546e88[_0x490a('0x20')]?_['map'](_0x546e88[_0x490a('0x20')],function(_0x5aa16c){return{'model':db[_0x5aa16c[_0x490a('0x21')]],'as':_0x5aa16c['as'],'attributes':_0x5aa16c[_0x490a('0x1e')],'include':_0x5aa16c[_0x490a('0x20')]?_[_0x490a('0x22')](_0x5aa16c[_0x490a('0x20')],function(_0x591291){return{'model':db[_0x591291['model']],'as':_0x591291['as'],'attributes':_0x591291['attributes']};}):[]};}):[]};}):[]:[]})[_0x490a('0x23')](function(_0x23a5bc){logger['info']('GetFaxQueue',_0x325064);logger[_0x490a('0x24')](_0x490a('0x18'),_0x325064,JSON[_0x490a('0x25')](_0x23a5bc));_0x36cb5d(_0x23a5bc);})[_0x490a('0x17')](function(_0x415b38){logger[_0x490a('0x12')](_0x490a('0x18'),_0x415b38['message'],_0x325064);_0x4bbacb(_0x48edea[_0x490a('0x12')](0x1f4,_0x415b38[_0x490a('0x14')]));});});};exports[_0x490a('0x26')]=function(_0x4dfa7f){var _0x3432fe=this;return new Promise(function(_0x437ea9,_0xd9df5c){return db[_0x490a('0x19')][_0x490a('0x27')]({'raw':_0x4dfa7f[_0x490a('0x1b')]?_0x4dfa7f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4dfa7f['options']?_0x4dfa7f[_0x490a('0x1b')][_0x490a('0x1d')]||null:null,'attributes':_0x4dfa7f[_0x490a('0x1b')]?_0x4dfa7f['options']['attributes']||null:null,'include':_0x4dfa7f['options']?_0x4dfa7f[_0x490a('0x1b')][_0x490a('0x20')]?_[_0x490a('0x22')](_0x4dfa7f['options'][_0x490a('0x20')],function(_0x1deeda){return{'model':db[_0x1deeda[_0x490a('0x21')]],'as':_0x1deeda['as'],'attributes':_0x1deeda[_0x490a('0x1e')],'include':_0x1deeda[_0x490a('0x20')]?_['map'](_0x1deeda[_0x490a('0x20')],function(_0xa53717){return{'model':db[_0xa53717[_0x490a('0x21')]],'as':_0xa53717['as'],'attributes':_0xa53717[_0x490a('0x1e')],'include':_0xa53717[_0x490a('0x20')]?_[_0x490a('0x22')](_0xa53717[_0x490a('0x20')],function(_0x2f8031){return{'model':db[_0x2f8031['model']],'as':_0x2f8031['as'],'attributes':_0x2f8031['attributes']};}):[]};}):[]};}):[]:[]})[_0x490a('0x23')](function(_0x30dc0){logger[_0x490a('0x15')](_0x490a('0x26'),_0x4dfa7f);logger['debug']('ShowFaxQueue',_0x4dfa7f,JSON['stringify'](_0x30dc0));_0x437ea9(_0x30dc0);})[_0x490a('0x17')](function(_0x35acb7){logger['error'](_0x490a('0x26'),_0x35acb7['message'],_0x4dfa7f);_0xd9df5c(_0x3432fe[_0x490a('0x12')](0x1f4,_0x35acb7[_0x490a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7097504..7e929ac 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 _0x3061=['register','faxQueue:','save','remove','update','emit'];(function(_0x1c1c30,_0x147384){var _0x57954d=function(_0x111910){while(--_0x111910){_0x1c1c30['push'](_0x1c1c30['shift']());}};_0x57954d(++_0x147384);}(_0x3061,0x176));var _0x1306=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x3061[_0x154940];return _0x401409;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x1306('0x0'),_0x1306('0x1'),_0x1306('0x2')];function createListener(_0x24fc62,_0x55d450){return function(_0x1d1fba){_0x55d450[_0x1306('0x3')](_0x24fc62,_0x1d1fba);};}function removeListener(_0x336a5d,_0x5c37b1){return function(){FaxQueueEvents['removeListener'](_0x336a5d,_0x5c37b1);};}exports[_0x1306('0x4')]=function(_0x339b94){for(var _0x42e39f=0x0,_0x55539f=events['length'];_0x42e39f<_0x55539f;_0x42e39f++){var _0x2d9c2f=events[_0x42e39f];var _0x2042ed=createListener(_0x1306('0x5')+_0x2d9c2f,_0x339b94);FaxQueueEvents['on'](_0x2d9c2f,_0x2042ed);}}; \ No newline at end of file +var _0x8255=['removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x21aefc,_0x1177eb){var _0x53ffe7=function(_0x1e6462){while(--_0x1e6462){_0x21aefc['push'](_0x21aefc['shift']());}};_0x53ffe7(++_0x1177eb);}(_0x8255,0x176));var _0x5825=function(_0x49151a,_0xa5d082){_0x49151a=_0x49151a-0x0;var _0xd7a927=_0x8255[_0x49151a];return _0xd7a927;};'use strict';var FaxQueueEvents=require(_0x5825('0x0'));var events=[_0x5825('0x1'),_0x5825('0x2'),_0x5825('0x3')];function createListener(_0x201689,_0x65c6e){return function(_0x2f0ce0){_0x65c6e['emit'](_0x201689,_0x2f0ce0);};}function removeListener(_0x4d1534,_0x5f2bc3){return function(){FaxQueueEvents[_0x5825('0x4')](_0x4d1534,_0x5f2bc3);};}exports[_0x5825('0x5')]=function(_0x122c90){for(var _0xa8e4d1=0x0,_0x383a49=events[_0x5825('0x6')];_0xa8e4d1<_0x383a49;_0xa8e4d1++){var _0x27d87e=events[_0xa8e4d1];var _0x577974=createListener('faxQueue:'+_0x27d87e,_0x122c90);FaxQueueEvents['on'](_0x27d87e,_0x577974);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index adac055..18e1f59 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 _0xfc65=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','update','destroy','delete','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index'];(function(_0x2a929d,_0x574b58){var _0x3ddba8=function(_0x5749a6){while(--_0x5749a6){_0x2a929d['push'](_0x2a929d['shift']());}};_0x3ddba8(++_0x574b58);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x480aee,_0x2bde4b){_0x480aee=_0x480aee-0x0;var _0x390a46=_0xfc65[_0x480aee];return _0x390a46;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5fc6('0x1'));var express=require(_0x5fc6('0x2'));var router=express[_0x5fc6('0x3')]();var fs_extra=require(_0x5fc6('0x4'));var auth=require(_0x5fc6('0x5'));var interaction=require(_0x5fc6('0x6'));var config=require(_0x5fc6('0x7'));var controller=require(_0x5fc6('0x8'));router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller[_0x5fc6('0xd')]);router[_0x5fc6('0x9')](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xf')]);router[_0x5fc6('0x9')](_0x5fc6('0x10'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x11')]);router[_0x5fc6('0x9')]('/:id/teams',auth[_0x5fc6('0xa')](),controller['getTeams']);router[_0x5fc6('0x9')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x13')]);router['post']('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x14')]);router[_0x5fc6('0x15')](_0x5fc6('0x16'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x17')]);router[_0x5fc6('0x15')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x18')]);router['put']('/:id',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x19')]);router['delete'](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x1a')]);router[_0x5fc6('0x1b')](_0x5fc6('0x16'),auth[_0x5fc6('0xa')](),controller['removeTeams']);router[_0x5fc6('0x1b')](_0x5fc6('0x12'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x9b0d=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams'];(function(_0x1eae1d,_0x122bc2){var _0x4df950=function(_0x42503c){while(--_0x42503c){_0x1eae1d['push'](_0x1eae1d['shift']());}};_0x4df950(++_0x122bc2);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x1b1428,_0x3215f0){_0x1b1428=_0x1b1428-0x0;var _0x4d3692=_0x9b0d[_0x1b1428];return _0x4d3692;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var fs_extra=require(_0xd9b0('0x4'));var auth=require(_0xd9b0('0x5'));var interaction=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var controller=require('./faxQueue.controller');router[_0xd9b0('0x8')]('/',auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xa')]);router[_0xd9b0('0x8')](_0xd9b0('0xb'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xc')]);router['get'](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['show']);router[_0xd9b0('0x8')]('/:id/members',auth[_0xd9b0('0x9')](),controller['getMembers']);router[_0xd9b0('0x8')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xf')]);router[_0xd9b0('0x8')](_0xd9b0('0x10'),auth['isAuthenticated'](),controller[_0xd9b0('0x11')]);router[_0xd9b0('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9b0('0x13')]);router[_0xd9b0('0x12')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x14')]);router[_0xd9b0('0x12')]('/:id/users',auth[_0xd9b0('0x9')](),controller['addAgents']);router[_0xd9b0('0x15')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x16')]);router[_0xd9b0('0x17')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['destroy']);router[_0xd9b0('0x17')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x18')]);router[_0xd9b0('0x17')](_0xd9b0('0x10'),auth[_0xd9b0('0x9')](),controller['removeAgents']);module[_0xd9b0('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index cd8427a..675f630 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 _0xd9d6=['moment','exports','STRING','DATE'];(function(_0x21631f,_0x53bb1c){var _0x29ef18=function(_0x53c165){while(--_0x53c165){_0x21631f['push'](_0x21631f['shift']());}};_0x29ef18(++_0x53bb1c);}(_0xd9d6,0x184));var _0x6d9d=function(_0x34bbe3,_0x28d122){_0x34bbe3=_0x34bbe3-0x0;var _0x4301aa=_0xd9d6[_0x34bbe3];return _0x4301aa;};'use strict';var moment=require(_0x6d9d('0x0'));var Sequelize=require('sequelize');module[_0x6d9d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d9d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6d9d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6d9d('0x3')]},'exitAt':{'type':Sequelize[_0x6d9d('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2a3=['STRING','DATE','moment'];(function(_0xb1f870,_0x2d0065){var _0x245c0a=function(_0x51ce55){while(--_0x51ce55){_0xb1f870['push'](_0xb1f870['shift']());}};_0x245c0a(++_0x2d0065);}(_0xc2a3,0x131));var _0x3c2a=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xc2a3[_0x43b08];return _0x5e05f4;};'use strict';var moment=require(_0x3c2a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3c2a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3c2a('0x1')]},'joinAt':{'type':Sequelize[_0x3c2a('0x2')]},'leaveAt':{'type':Sequelize[_0x3c2a('0x2')]},'acceptAt':{'type':Sequelize[_0x3c2a('0x2')]},'exitAt':{'type':Sequelize[_0x3c2a('0x2')]},'reason':{'type':Sequelize[_0x3c2a('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 95de6d8..34fe13a 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 _0x04d0=['to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','keys','include','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x415435,_0x20ef00){var _0x1fab82=function(_0x55ed40){while(--_0x55ed40){_0x415435['push'](_0x415435['shift']());}};_0x1fab82(++_0x20ef00);}(_0x04d0,0x10a));var _0x004d=function(_0x5937e7,_0xc6e13a){_0x5937e7=_0x5937e7-0x0;var _0x5db68d=_0x04d0[_0x5937e7];return _0x5db68d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x004d('0x0'));var jsonpatch=require(_0x004d('0x1'));var rp=require(_0x004d('0x2'));var moment=require(_0x004d('0x3'));var BPromise=require(_0x004d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x004d('0x5'));var sox=require('sox');var csv=require(_0x004d('0x6'));var ejs=require(_0x004d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x6'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x004d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d2651,_0x46c972){_0x46c972=_0x46c972||0xcc;return function(_0x3ec7fb){if(_0x3ec7fb){return _0x1d2651[_0x004d('0x13')](_0x46c972);}return _0x1d2651[_0x004d('0x14')](_0x46c972)[_0x004d('0x15')]();};}function respondWithResult(_0x1af576,_0x32e867){_0x32e867=_0x32e867||0xc8;return function(_0x4f4785){if(_0x4f4785){return _0x1af576[_0x004d('0x14')](_0x32e867)[_0x004d('0x16')](_0x4f4785);}};}function respondWithFilteredResult(_0x22d22d,_0x1822f5){return function(_0x43f5fb){if(_0x43f5fb){var _0x402969=typeof _0x1822f5[_0x004d('0x17')]===_0x004d('0x18')&&typeof _0x1822f5['limit']===_0x004d('0x18');var _0x1f3482=_0x43f5fb[_0x004d('0x19')];var _0x4b3912=_0x402969?0x0:_0x1822f5[_0x004d('0x17')];var _0x583196=_0x402969?_0x43f5fb[_0x004d('0x19')]:_0x1822f5[_0x004d('0x17')]+_0x1822f5[_0x004d('0x1a')];var _0x66dd7f;if(_0x583196>=_0x1f3482){_0x583196=_0x1f3482;_0x66dd7f=0xc8;}else{_0x66dd7f=0xce;}_0x22d22d['status'](_0x66dd7f);return _0x22d22d[_0x004d('0x1b')](_0x004d('0x1c'),_0x4b3912+'-'+_0x583196+'/'+_0x1f3482)['json'](_0x43f5fb);}return null;};}function patchUpdates(_0x31ac5c){return function(_0x158339){try{jsonpatch[_0x004d('0x1d')](_0x158339,_0x31ac5c,!![]);}catch(_0x3abed3){return BPromise['reject'](_0x3abed3);}return _0x158339[_0x004d('0x1e')]();};}function saveUpdates(_0x39a02e,_0x2da052){return function(_0xb9eda8){if(_0xb9eda8){return _0xb9eda8[_0x004d('0x1f')](_0x39a02e)[_0x004d('0x20')](function(_0x21bbda){return _0x21bbda;});}return null;};}function removeEntity(_0x2150b9,_0x31a6fb){return function(_0x1cfdaa){if(_0x1cfdaa){return _0x1cfdaa[_0x004d('0x21')]()[_0x004d('0x20')](function(){_0x2150b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1263d8,_0xb07ff9){return function(_0x4a4fe1){if(!_0x4a4fe1){_0x1263d8[_0x004d('0x13')](0x194);}return _0x4a4fe1;};}function handleError(_0x1152e6,_0x61e5bc){_0x61e5bc=_0x61e5bc||0x1f4;return function(_0xd13fff){logger[_0x004d('0x22')](_0xd13fff[_0x004d('0x23')]);if(_0xd13fff[_0x004d('0x24')]){delete _0xd13fff['name'];}_0x1152e6[_0x004d('0x14')](_0x61e5bc)['send'](_0xd13fff);};}exports['index']=function(_0x2e7763,_0x38518d){var _0xe17b2d={},_0x1e13b1={},_0x58015b={'count':0x0,'rows':[]};var _0xe53b05=_[_0x004d('0x25')](db[_0x004d('0x26')][_0x004d('0x27')],function(_0xe5b960){return{'name':_0xe5b960[_0x004d('0x28')],'type':_0xe5b960['type'][_0x004d('0x29')]};});_0x1e13b1[_0x004d('0x2a')]=_[_0x004d('0x25')](_0xe53b05,_0x004d('0x24'));_0x1e13b1['query']=_['keys'](_0x2e7763[_0x004d('0x2b')]);_0x1e13b1['filters']=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],_0x1e13b1[_0x004d('0x2b')]);_0xe17b2d[_0x004d('0x2d')]=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x2e')]));_0xe17b2d[_0x004d('0x2d')]=_0xe17b2d['attributes'][_0x004d('0x2f')]?_0xe17b2d[_0x004d('0x2d')]:_0x1e13b1[_0x004d('0x2a')];if(!_0x2e7763[_0x004d('0x2b')]['hasOwnProperty'](_0x004d('0x30'))){_0xe17b2d[_0x004d('0x1a')]=qs['limit'](_0x2e7763[_0x004d('0x2b')][_0x004d('0x1a')]);_0xe17b2d[_0x004d('0x17')]=qs[_0x004d('0x17')](_0x2e7763[_0x004d('0x2b')]['offset']);}_0xe17b2d[_0x004d('0x31')]=qs[_0x004d('0x32')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x32')]);_0xe17b2d[_0x004d('0x33')]=qs[_0x004d('0x34')](_[_0x004d('0x35')](_0x2e7763[_0x004d('0x2b')],_0x1e13b1['filters']),_0xe53b05);if(_0x2e7763[_0x004d('0x2b')]['filter']){_0xe17b2d[_0x004d('0x33')]=_[_0x004d('0x36')](_0xe17b2d[_0x004d('0x33')],{'$or':_['map'](_0xe53b05,function(_0x5ab98c){if(_0x5ab98c[_0x004d('0x37')]!==_0x004d('0x38')){var _0x48be35={};_0x48be35[_0x5ab98c[_0x004d('0x24')]]={'$like':'%'+_0x2e7763['query'][_0x004d('0x39')]+'%'};return _0x48be35;}})});}_0xe17b2d=_[_0x004d('0x36')]({},_0xe17b2d,_0x2e7763[_0x004d('0x3a')]);var _0x4d2e6a={'where':_0xe17b2d[_0x004d('0x33')]};return db['FaxQueueReport']['count'](_0x4d2e6a)['then'](function(_0x3d9291){_0x58015b['count']=_0x3d9291;if(_0x2e7763['query'][_0x004d('0x3b')]){_0xe17b2d['include']=[{'all':!![]}];}return db[_0x004d('0x26')]['findAll'](_0xe17b2d);})['then'](function(_0x283a58){_0x58015b[_0x004d('0x3c')]=_0x283a58;return _0x58015b;})[_0x004d('0x20')](respondWithFilteredResult(_0x38518d,_0xe17b2d))['catch'](handleError(_0x38518d,null));};exports['show']=function(_0x2d08cd,_0x197377){var _0x162f23={'raw':!![],'where':{'id':_0x2d08cd[_0x004d('0x3d')]['id']}},_0xaa1d11={};_0xaa1d11[_0x004d('0x2a')]=_[_0x004d('0x3e')](db[_0x004d('0x26')][_0x004d('0x27')]);_0xaa1d11[_0x004d('0x2b')]=_['keys'](_0x2d08cd[_0x004d('0x2b')]);_0xaa1d11[_0x004d('0x34')]=_[_0x004d('0x2c')](_0xaa1d11[_0x004d('0x2a')],_0xaa1d11[_0x004d('0x2b')]);_0x162f23[_0x004d('0x2d')]=_['intersection'](_0xaa1d11[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2d08cd[_0x004d('0x2b')][_0x004d('0x2e')]));_0x162f23[_0x004d('0x2d')]=_0x162f23['attributes'][_0x004d('0x2f')]?_0x162f23[_0x004d('0x2d')]:_0xaa1d11[_0x004d('0x2a')];if(_0x2d08cd['query'][_0x004d('0x3b')]){_0x162f23[_0x004d('0x3f')]=[{'all':!![]}];}_0x162f23=_[_0x004d('0x36')]({},_0x162f23,_0x2d08cd[_0x004d('0x3a')]);return db['FaxQueueReport']['find'](_0x162f23)[_0x004d('0x20')](handleEntityNotFound(_0x197377,null))[_0x004d('0x20')](respondWithResult(_0x197377,null))[_0x004d('0x40')](handleError(_0x197377,null));};exports[_0x004d('0x41')]=function(_0x5d5c39,_0x28a957){return db[_0x004d('0x26')][_0x004d('0x41')](_0x5d5c39[_0x004d('0x42')],{})['then'](respondWithResult(_0x28a957,0xc9))['catch'](handleError(_0x28a957,null));};exports[_0x004d('0x1f')]=function(_0x21fc27,_0x4cb5fa){if(_0x21fc27['body']['id']){delete _0x21fc27[_0x004d('0x42')]['id'];}return db[_0x004d('0x26')]['find']({'where':{'id':_0x21fc27['params']['id']}})['then'](handleEntityNotFound(_0x4cb5fa,null))[_0x004d('0x20')](saveUpdates(_0x21fc27['body'],null))[_0x004d('0x20')](respondWithResult(_0x4cb5fa,null))[_0x004d('0x40')](handleError(_0x4cb5fa,null));};exports['destroy']=function(_0x12bbcd,_0x5f3c6f){return db[_0x004d('0x26')]['find']({'where':{'id':_0x12bbcd[_0x004d('0x3d')]['id']}})[_0x004d('0x20')](handleEntityNotFound(_0x5f3c6f,null))[_0x004d('0x20')](removeEntity(_0x5f3c6f,null))['catch'](handleError(_0x5f3c6f,null));};exports['describe']=function(_0x11ebbe,_0x3458a1){return db['FaxQueueReport'][_0x004d('0x43')]()['then'](respondWithResult(_0x3458a1,null))[_0x004d('0x40')](handleError(_0x3458a1,null));}; \ No newline at end of file +var _0xbee3=['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','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xbee3,0xd5));var _0x3bee=function(_0x5dabde,_0x8ac431){_0x5dabde=_0x5dabde-0x0;var _0x2139cf=_0xbee3[_0x5dabde];return _0x2139cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['index']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={},_0x496abd={},_0x1115ed={'count':0x0,'rows':[]};var _0x24d523=_[_0x3bee('0x2b')](db[_0x3bee('0x2c')][_0x3bee('0x2d')],function(_0x559c2b){return{'name':_0x559c2b['fieldName'],'type':_0x559c2b[_0x3bee('0x2e')][_0x3bee('0x2f')]};});_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2b')](_0x24d523,'name');_0x496abd['query']=_[_0x3bee('0x31')](_0x239fa4[_0x3bee('0x32')]);_0x496abd['filters']=_['intersection'](_0x496abd[_0x3bee('0x30')],_0x496abd[_0x3bee('0x32')]);_0x3a3d92[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x496abd[_0x3bee('0x30')],qs[_0x3bee('0x35')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x35')]));_0x3a3d92[_0x3bee('0x33')]=_0x3a3d92[_0x3bee('0x33')]['length']?_0x3a3d92['attributes']:_0x496abd[_0x3bee('0x30')];if(!_0x239fa4['query']['hasOwnProperty'](_0x3bee('0x36'))){_0x3a3d92[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x1d')]);_0x3a3d92[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x239fa4[_0x3bee('0x32')]['offset']);}_0x3a3d92[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x239fa4['query'][_0x3bee('0x38')]);_0x3a3d92[_0x3bee('0x39')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x3b')](_0x239fa4[_0x3bee('0x32')],_0x496abd['filters']),_0x24d523);if(_0x239fa4['query'][_0x3bee('0x3c')]){_0x3a3d92[_0x3bee('0x39')]=_[_0x3bee('0x3d')](_0x3a3d92[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2b')](_0x24d523,function(_0x3d9656){if(_0x3d9656[_0x3bee('0x2e')]!==_0x3bee('0x3e')){var _0x2fb349={};_0x2fb349[_0x3d9656[_0x3bee('0x29')]]={'$like':'%'+_0x239fa4[_0x3bee('0x32')][_0x3bee('0x3c')]+'%'};return _0x2fb349;}})});}_0x3a3d92=_['merge']({},_0x3a3d92,_0x239fa4[_0x3bee('0x3f')]);var _0x1b5eca={'where':_0x3a3d92[_0x3bee('0x39')]};return db[_0x3bee('0x2c')][_0x3bee('0x1c')](_0x1b5eca)[_0x3bee('0x24')](function(_0x1622b9){_0x1115ed[_0x3bee('0x1c')]=_0x1622b9;if(_0x239fa4[_0x3bee('0x32')][_0x3bee('0x40')]){_0x3a3d92[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x2c')][_0x3bee('0x42')](_0x3a3d92);})['then'](function(_0x2b773d){_0x1115ed[_0x3bee('0x43')]=_0x2b773d;return _0x1115ed;})[_0x3bee('0x24')](respondWithFilteredResult(_0xf08fb3,_0x3a3d92))[_0x3bee('0x44')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x45')]=function(_0x44489f,_0x13dd72){var _0xd1140d={'raw':!![],'where':{'id':_0x44489f[_0x3bee('0x46')]['id']}},_0x5d9e1b={};_0x5d9e1b[_0x3bee('0x30')]=_[_0x3bee('0x31')](db['FaxQueueReport'][_0x3bee('0x2d')]);_0x5d9e1b['query']=_[_0x3bee('0x31')](_0x44489f['query']);_0x5d9e1b['filters']=_[_0x3bee('0x34')](_0x5d9e1b[_0x3bee('0x30')],_0x5d9e1b[_0x3bee('0x32')]);_0xd1140d[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x5d9e1b['model'],qs['fields'](_0x44489f[_0x3bee('0x32')]['fields']));_0xd1140d[_0x3bee('0x33')]=_0xd1140d['attributes'][_0x3bee('0x47')]?_0xd1140d['attributes']:_0x5d9e1b[_0x3bee('0x30')];if(_0x44489f[_0x3bee('0x32')][_0x3bee('0x40')]){_0xd1140d[_0x3bee('0x41')]=[{'all':!![]}];}_0xd1140d=_['merge']({},_0xd1140d,_0x44489f['options']);return db[_0x3bee('0x2c')]['find'](_0xd1140d)['then'](handleEntityNotFound(_0x13dd72,null))['then'](respondWithResult(_0x13dd72,null))[_0x3bee('0x44')](handleError(_0x13dd72,null));};exports['create']=function(_0x125fa5,_0x33d615){return db[_0x3bee('0x2c')]['create'](_0x125fa5[_0x3bee('0x48')],{})['then'](respondWithResult(_0x33d615,0xc9))[_0x3bee('0x44')](handleError(_0x33d615,null));};exports['update']=function(_0x26ccd7,_0x16b096){if(_0x26ccd7[_0x3bee('0x48')]['id']){delete _0x26ccd7['body']['id'];}return db[_0x3bee('0x2c')][_0x3bee('0x49')]({'where':{'id':_0x26ccd7[_0x3bee('0x46')]['id']}})['then'](handleEntityNotFound(_0x16b096,null))['then'](saveUpdates(_0x26ccd7[_0x3bee('0x48')],null))[_0x3bee('0x24')](respondWithResult(_0x16b096,null))[_0x3bee('0x44')](handleError(_0x16b096,null));};exports[_0x3bee('0x25')]=function(_0x3b5d7a,_0x21ab40){return db[_0x3bee('0x2c')]['find']({'where':{'id':_0x3b5d7a[_0x3bee('0x46')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x21ab40,null))['then'](removeEntity(_0x21ab40,null))['catch'](handleError(_0x21ab40,null));};exports[_0x3bee('0x4a')]=function(_0x5d4755,_0x1cb54e){return db[_0x3bee('0x2c')][_0x3bee('0x4a')]()['then'](respondWithResult(_0x1cb54e,null))[_0x3bee('0x44')](handleError(_0x1cb54e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2fbb9f7..46fd907 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x1a069b,_0xd1348c){var _0x5985dc=function(_0x4c0b1e){while(--_0x4c0b1e){_0x1a069b['push'](_0x1a069b['shift']());}};_0x5985dc(++_0xd1348c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x5fc3[_0x2eac4f];return _0x58f73b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x52bcff,_0x55d76a){_0x52bcff=_0x52bcff-0x0;var _0x2081cb=_0x1cb9[_0x52bcff];return _0x2081cb;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e674ad2..1602d5a 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 _0x3d69=['result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','stringify','UpdateFaxQueueReport','update','raw','where','attributes','limit','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3d69,0x11c));var _0x93d6=function(_0x3e4c6d,_0x49dabd){_0x3e4c6d=_0x3e4c6d-0x0;var _0x3bc6f7=_0x3d69[_0x3e4c6d];return _0x3bc6f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93d6('0x0'));var BPromise=require('bluebird');var rs=require(_0x93d6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x93d6('0x2'))('rpc');var config=require(_0x93d6('0x3'));var jayson=require(_0x93d6('0x4'));var client=jayson[_0x93d6('0x5')][_0x93d6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x433433,_0x420a29,_0x5d54c2){return new BPromise(function(_0x2708b5,_0x2ad802){return client['request'](_0x433433,_0x5d54c2)[_0x93d6('0x7')](function(_0x5467da){logger[_0x93d6('0x8')](_0x93d6('0x9'),_0x420a29,_0x93d6('0xa'));logger[_0x93d6('0xb')](_0x93d6('0xc'),_0x420a29,'request\x20sent',JSON['stringify'](_0x5467da));if(_0x5467da[_0x93d6('0xd')]){if(_0x5467da[_0x93d6('0xd')][_0x93d6('0xe')]===0x1f4){logger[_0x93d6('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x420a29,_0x5467da['error'][_0x93d6('0xf')]);return _0x2ad802(_0x5467da[_0x93d6('0xd')]['message']);}logger['error'](_0x93d6('0x9'),_0x420a29,_0x5467da[_0x93d6('0xd')][_0x93d6('0xf')]);return _0x2708b5(_0x5467da[_0x93d6('0xd')]['message']);}else{logger['info'](_0x93d6('0x9'),_0x420a29,_0x93d6('0xa'));_0x2708b5(_0x5467da[_0x93d6('0x10')][_0x93d6('0xf')]);}})[_0x93d6('0x11')](function(_0xce9b3b){logger['error'](_0x93d6('0x9'),_0x420a29,_0xce9b3b);_0x2ad802(_0xce9b3b);});});}exports[_0x93d6('0x12')]=function(_0x34455f){var _0x26a2b5=this;return new Promise(function(_0x402e4e,_0x1c13d4){return db[_0x93d6('0x13')][_0x93d6('0x14')](_0x34455f[_0x93d6('0x15')],{'raw':_0x34455f[_0x93d6('0x16')]?_0x34455f[_0x93d6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x93d6('0x7')](function(_0x4339d8){logger[_0x93d6('0x8')]('CreateFaxQueueReport',_0x34455f);logger[_0x93d6('0xb')](_0x93d6('0x12'),_0x34455f,JSON[_0x93d6('0x17')](_0x4339d8));_0x402e4e(_0x4339d8);})[_0x93d6('0x11')](function(_0x4988f8){logger[_0x93d6('0xd')](_0x93d6('0x12'),_0x4988f8[_0x93d6('0xf')],_0x34455f);_0x1c13d4(_0x26a2b5['error'](0x1f4,_0x4988f8[_0x93d6('0xf')]));});});};exports[_0x93d6('0x18')]=function(_0x3c828b){var _0x34e952=this;return new Promise(function(_0xa0bb33,_0x4be6ce){return db['FaxQueueReport'][_0x93d6('0x19')](_0x3c828b['body'],{'raw':_0x3c828b[_0x93d6('0x16')]?_0x3c828b['options'][_0x93d6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c828b['options']?_0x3c828b[_0x93d6('0x16')][_0x93d6('0x1b')]||null:null,'attributes':_0x3c828b[_0x93d6('0x16')]?_0x3c828b[_0x93d6('0x16')][_0x93d6('0x1c')]||null:null,'limit':_0x3c828b[_0x93d6('0x16')]?_0x3c828b[_0x93d6('0x16')][_0x93d6('0x1d')]||null:null})[_0x93d6('0x7')](function(_0x3a1459){logger[_0x93d6('0x8')](_0x93d6('0x18'),_0x3c828b);logger[_0x93d6('0xb')](_0x93d6('0x18'),_0x3c828b,JSON[_0x93d6('0x17')](_0x3a1459));_0xa0bb33(_0x3a1459);})['catch'](function(_0x50193a){logger[_0x93d6('0xd')](_0x93d6('0x18'),_0x50193a[_0x93d6('0xf')],_0x3c828b);_0x4be6ce(_0x34e952['error'](0x1f4,_0x50193a[_0x93d6('0xf')]));});});}; \ No newline at end of file +var _0xacfb=['catch','CreateFaxQueueReport','FaxQueueReport','create','raw','UpdateFaxQueueReport','body','options','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4a8a5d,_0x389853){var _0x2876b0=function(_0xd32d0d){while(--_0xd32d0d){_0x4a8a5d['push'](_0x4a8a5d['shift']());}};_0x2876b0(++_0x389853);}(_0xacfb,0x112));var _0xbacf=function(_0x59c1ad,_0x4f845e){_0x59c1ad=_0x59c1ad-0x0;var _0x30d22a=_0xacfb[_0x59c1ad];return _0x30d22a;};'use strict';var _=require(_0xbacf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbacf('0x1'));var rs=require(_0xbacf('0x2'));var fs=require('fs');var Redis=require(_0xbacf('0x3'));var db=require(_0xbacf('0x4'))['db'];var utils=require(_0xbacf('0x5'));var logger=require(_0xbacf('0x6'))(_0xbacf('0x7'));var config=require(_0xbacf('0x8'));var jayson=require(_0xbacf('0x9'));var client=jayson[_0xbacf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4151f0,_0x5f33d8,_0x62af29){return new BPromise(function(_0x43a7c7,_0x390786){return client[_0xbacf('0xb')](_0x4151f0,_0x62af29)[_0xbacf('0xc')](function(_0x3aa5a1){logger[_0xbacf('0xd')](_0xbacf('0xe'),_0x5f33d8,_0xbacf('0xf'));logger[_0xbacf('0x10')](_0xbacf('0x11'),_0x5f33d8,_0xbacf('0xf'),JSON[_0xbacf('0x12')](_0x3aa5a1));if(_0x3aa5a1[_0xbacf('0x13')]){if(_0x3aa5a1['error'][_0xbacf('0x14')]===0x1f4){logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);return _0x390786(_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);}logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);return _0x43a7c7(_0x3aa5a1['error'][_0xbacf('0x15')]);}else{logger['info'](_0xbacf('0xe'),_0x5f33d8,_0xbacf('0xf'));_0x43a7c7(_0x3aa5a1[_0xbacf('0x16')]['message']);}})[_0xbacf('0x17')](function(_0x1844c9){logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x1844c9);_0x390786(_0x1844c9);});});}exports[_0xbacf('0x18')]=function(_0x833310){var _0x18786b=this;return new Promise(function(_0xdfa65f,_0x4d10bf){return db[_0xbacf('0x19')][_0xbacf('0x1a')](_0x833310['body'],{'raw':_0x833310['options']?_0x833310['options'][_0xbacf('0x1b')]===undefined?!![]:![]:!![]})[_0xbacf('0xc')](function(_0x1abce2){logger[_0xbacf('0xd')]('CreateFaxQueueReport',_0x833310);logger[_0xbacf('0x10')](_0xbacf('0x18'),_0x833310,JSON[_0xbacf('0x12')](_0x1abce2));_0xdfa65f(_0x1abce2);})[_0xbacf('0x17')](function(_0x161b84){logger[_0xbacf('0x13')](_0xbacf('0x18'),_0x161b84[_0xbacf('0x15')],_0x833310);_0x4d10bf(_0x18786b[_0xbacf('0x13')](0x1f4,_0x161b84['message']));});});};exports[_0xbacf('0x1c')]=function(_0xb4d6c5){var _0x1f8ac0=this;return new Promise(function(_0x32100f,_0x320b19){return db[_0xbacf('0x19')]['update'](_0xb4d6c5[_0xbacf('0x1d')],{'raw':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')]['where']||null:null,'attributes':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')][_0xbacf('0x1f')]||null:null,'limit':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')][_0xbacf('0x20')]||null:null})[_0xbacf('0xc')](function(_0x36b767){logger['info'](_0xbacf('0x1c'),_0xb4d6c5);logger[_0xbacf('0x10')](_0xbacf('0x1c'),_0xb4d6c5,JSON[_0xbacf('0x12')](_0x36b767));_0x32100f(_0x36b767);})[_0xbacf('0x17')](function(_0x286983){logger[_0xbacf('0x13')](_0xbacf('0x1c'),_0x286983[_0xbacf('0x15')],_0xb4d6c5);_0x320b19(_0x1f8ac0[_0xbacf('0x13')](0x1f4,_0x286983['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6237f12..f48a0a3 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 _0x7a4f=['isAuthenticated','describe','/:id','show','create','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0xfaa2b1,_0x59920d){var _0x138fb2=function(_0x53840e){while(--_0x53840e){_0xfaa2b1['push'](_0xfaa2b1['shift']());}};_0x138fb2(++_0x59920d);}(_0x7a4f,0x129));var _0xf7a4=function(_0x2d1cf4,_0x2ea9ee){_0x2d1cf4=_0x2d1cf4-0x0;var _0x554a7c=_0x7a4f[_0x2d1cf4];return _0x554a7c;};'use strict';var multer=require('multer');var util=require(_0xf7a4('0x0'));var path=require(_0xf7a4('0x1'));var timeout=require(_0xf7a4('0x2'));var express=require(_0xf7a4('0x3'));var router=express[_0xf7a4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7a4('0x5'));var interaction=require(_0xf7a4('0x6'));var config=require('../../config/environment');var controller=require(_0xf7a4('0x7'));router[_0xf7a4('0x8')]('/',auth[_0xf7a4('0x9')](),controller['index']);router[_0xf7a4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf7a4('0xa')]);router[_0xf7a4('0x8')](_0xf7a4('0xb'),auth['isAuthenticated'](),controller[_0xf7a4('0xc')]);router['post']('/',auth[_0xf7a4('0x9')](),controller[_0xf7a4('0xd')]);router['put'](_0xf7a4('0xb'),auth[_0xf7a4('0x9')](),controller[_0xf7a4('0xe')]);router[_0xf7a4('0xf')](_0xf7a4('0xb'),auth[_0xf7a4('0x9')](),controller[_0xf7a4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8208=['isAuthenticated','index','/describe','/:id','show','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x8208,0x125));var _0x8820=function(_0x73bc57,_0x17d046){_0x73bc57=_0x73bc57-0x0;var _0x244fae=_0x8208[_0x73bc57];return _0x244fae;};'use strict';var multer=require(_0x8820('0x0'));var util=require(_0x8820('0x1'));var path=require(_0x8820('0x2'));var timeout=require('connect-timeout');var express=require(_0x8820('0x3'));var router=express[_0x8820('0x4')]();var fs_extra=require(_0x8820('0x5'));var auth=require(_0x8820('0x6'));var interaction=require(_0x8820('0x7'));var config=require(_0x8820('0x8'));var controller=require(_0x8820('0x9'));router[_0x8820('0xa')]('/',auth[_0x8820('0xb')](),controller[_0x8820('0xc')]);router[_0x8820('0xa')](_0x8820('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x8820('0xa')](_0x8820('0xe'),auth['isAuthenticated'](),controller[_0x8820('0xf')]);router['post']('/',auth[_0x8820('0xb')](),controller['create']);router[_0x8820('0x10')](_0x8820('0xe'),auth['isAuthenticated'](),controller[_0x8820('0x11')]);router['delete'](_0x8820('0xe'),auth[_0x8820('0xb')](),controller[_0x8820('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index eae4bb6..9db04f8 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1af231,_0x223e24){var _0xcced17=function(_0x2dedc3){while(--_0x2dedc3){_0x1af231['push'](_0x1af231['shift']());}};_0xcced17(++_0x223e24);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x523c39,_0x349b7b){var _0x4d2065=function(_0x3f3671){while(--_0x3f3671){_0x523c39['push'](_0x523c39['shift']());}};_0x4d2065(++_0x349b7b);}(_0xedd9,0xfc));var _0x9edd=function(_0x47699a,_0x5d0fbc){_0x47699a=_0x47699a-0x0;var _0x4def9e=_0xedd9[_0x47699a];return _0x4def9e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f0c1169..2009fc4 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 _0xe77d=['path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','FaxTransferReport','fieldName','type','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x638d27,_0x309470){var _0x3bd04b=function(_0x4be1b2){while(--_0x4be1b2){_0x638d27['push'](_0x638d27['shift']());}};_0x3bd04b(++_0x309470);}(_0xe77d,0x8c));var _0xde77=function(_0x515ec4,_0x29073d){_0x515ec4=_0x515ec4-0x0;var _0x3442d7=_0xe77d[_0x515ec4];return _0x3442d7;};'use strict';var emlformat=require(_0xde77('0x0'));var rimraf=require(_0xde77('0x1'));var zipdir=require(_0xde77('0x2'));var jsonpatch=require(_0xde77('0x3'));var rp=require(_0xde77('0x4'));var moment=require(_0xde77('0x5'));var BPromise=require(_0xde77('0x6'));var Mustache=require(_0xde77('0x7'));var util=require('util');var path=require(_0xde77('0x8'));var sox=require(_0xde77('0x9'));var csv=require('to-csv');var ejs=require(_0xde77('0xa'));var fs=require('fs');var fs_extra=require(_0xde77('0xb'));var _=require(_0xde77('0xc'));var squel=require('squel');var crypto=require(_0xde77('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xde77('0xe'));var toCsv=require(_0xde77('0xf'));var querystring=require(_0xde77('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde77('0x11'));var as=require(_0xde77('0x12'));var hardwareService=require(_0xde77('0x13'));var logger=require('../../config/logger')(_0xde77('0x14'));var utils=require(_0xde77('0x15'));var config=require(_0xde77('0x16'));var licenseUtil=require(_0xde77('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4152ff,_0x4dc408){_0x4dc408=_0x4dc408||0xcc;return function(_0x2a87d8){if(_0x2a87d8){return _0x4152ff[_0xde77('0x18')](_0x4dc408);}return _0x4152ff['status'](_0x4dc408)[_0xde77('0x19')]();};}function respondWithResult(_0x35481c,_0x17860e){_0x17860e=_0x17860e||0xc8;return function(_0x3dce48){if(_0x3dce48){return _0x35481c['status'](_0x17860e)[_0xde77('0x1a')](_0x3dce48);}};}function respondWithFilteredResult(_0xd55daa,_0x31dc99){return function(_0x4a224c){if(_0x4a224c){var _0x2aa564=typeof _0x31dc99[_0xde77('0x1b')]===_0xde77('0x1c')&&typeof _0x31dc99[_0xde77('0x1d')]==='undefined';var _0x581fdf=_0x4a224c[_0xde77('0x1e')];var _0x4e30b2=_0x2aa564?0x0:_0x31dc99[_0xde77('0x1b')];var _0x34ff19=_0x2aa564?_0x4a224c[_0xde77('0x1e')]:_0x31dc99[_0xde77('0x1b')]+_0x31dc99[_0xde77('0x1d')];var _0x234609;if(_0x34ff19>=_0x581fdf){_0x34ff19=_0x581fdf;_0x234609=0xc8;}else{_0x234609=0xce;}_0xd55daa[_0xde77('0x1f')](_0x234609);return _0xd55daa[_0xde77('0x20')]('Content-Range',_0x4e30b2+'-'+_0x34ff19+'/'+_0x581fdf)[_0xde77('0x1a')](_0x4a224c);}return null;};}function patchUpdates(_0x1c6e2b){return function(_0x491e30){try{jsonpatch[_0xde77('0x21')](_0x491e30,_0x1c6e2b,!![]);}catch(_0x9354f5){return BPromise[_0xde77('0x22')](_0x9354f5);}return _0x491e30[_0xde77('0x23')]();};}function saveUpdates(_0x176a6b,_0x3ab006){return function(_0x525f55){if(_0x525f55){return _0x525f55[_0xde77('0x24')](_0x176a6b)[_0xde77('0x25')](function(_0x5e5645){return _0x5e5645;});}return null;};}function removeEntity(_0x175b8b,_0x5ba81d){return function(_0xdd7ad2){if(_0xdd7ad2){return _0xdd7ad2[_0xde77('0x26')]()[_0xde77('0x25')](function(){_0x175b8b['status'](0xcc)[_0xde77('0x19')]();});}};}function handleEntityNotFound(_0x5d8ca4,_0x542a20){return function(_0x1d435d){if(!_0x1d435d){_0x5d8ca4[_0xde77('0x18')](0x194);}return _0x1d435d;};}function handleError(_0x5b20d1,_0x541a41){_0x541a41=_0x541a41||0x1f4;return function(_0x4f62ef){logger['error'](_0x4f62ef[_0xde77('0x27')]);if(_0x4f62ef['name']){delete _0x4f62ef[_0xde77('0x28')];}_0x5b20d1[_0xde77('0x1f')](_0x541a41)[_0xde77('0x29')](_0x4f62ef);};}exports[_0xde77('0x2a')]=function(_0x3acb6d,_0x306eab){var _0x270a96={},_0x3bd82c={},_0x249a97={'count':0x0,'rows':[]};var _0x48bf8a=_['map'](db[_0xde77('0x2b')]['rawAttributes'],function(_0x3d247e){return{'name':_0x3d247e[_0xde77('0x2c')],'type':_0x3d247e[_0xde77('0x2d')]['key']};});_0x3bd82c['model']=_['map'](_0x48bf8a,_0xde77('0x28'));_0x3bd82c[_0xde77('0x2e')]=_['keys'](_0x3acb6d[_0xde77('0x2e')]);_0x3bd82c['filters']=_[_0xde77('0x2f')](_0x3bd82c[_0xde77('0x30')],_0x3bd82c[_0xde77('0x2e')]);_0x270a96['attributes']=_[_0xde77('0x2f')](_0x3bd82c[_0xde77('0x30')],qs[_0xde77('0x31')](_0x3acb6d[_0xde77('0x2e')][_0xde77('0x31')]));_0x270a96[_0xde77('0x32')]=_0x270a96[_0xde77('0x32')][_0xde77('0x33')]?_0x270a96[_0xde77('0x32')]:_0x3bd82c[_0xde77('0x30')];if(!_0x3acb6d[_0xde77('0x2e')][_0xde77('0x34')]('nolimit')){_0x270a96[_0xde77('0x1d')]=qs['limit'](_0x3acb6d[_0xde77('0x2e')]['limit']);_0x270a96[_0xde77('0x1b')]=qs[_0xde77('0x1b')](_0x3acb6d[_0xde77('0x2e')][_0xde77('0x1b')]);}_0x270a96[_0xde77('0x35')]=qs[_0xde77('0x36')](_0x3acb6d[_0xde77('0x2e')][_0xde77('0x36')]);_0x270a96[_0xde77('0x37')]=qs['filters'](_['pick'](_0x3acb6d[_0xde77('0x2e')],_0x3bd82c[_0xde77('0x38')]),_0x48bf8a);if(_0x3acb6d[_0xde77('0x2e')][_0xde77('0x39')]){_0x270a96['where']=_[_0xde77('0x3a')](_0x270a96[_0xde77('0x37')],{'$or':_[_0xde77('0x3b')](_0x48bf8a,function(_0x2953dd){if(_0x2953dd[_0xde77('0x2d')]!==_0xde77('0x3c')){var _0x340dab={};_0x340dab[_0x2953dd['name']]={'$like':'%'+_0x3acb6d['query'][_0xde77('0x39')]+'%'};return _0x340dab;}})});}_0x270a96=_['merge']({},_0x270a96,_0x3acb6d[_0xde77('0x3d')]);var _0x3ee022={'where':_0x270a96[_0xde77('0x37')]};return db[_0xde77('0x2b')][_0xde77('0x1e')](_0x3ee022)['then'](function(_0x403b8f){_0x249a97[_0xde77('0x1e')]=_0x403b8f;if(_0x3acb6d[_0xde77('0x2e')][_0xde77('0x3e')]){_0x270a96['include']=[{'all':!![]}];}return db[_0xde77('0x2b')][_0xde77('0x3f')](_0x270a96);})[_0xde77('0x25')](function(_0xa4960){_0x249a97[_0xde77('0x40')]=_0xa4960;return _0x249a97;})[_0xde77('0x25')](respondWithFilteredResult(_0x306eab,_0x270a96))[_0xde77('0x41')](handleError(_0x306eab,null));};exports[_0xde77('0x42')]=function(_0x22d40e,_0x17c710){var _0x436852={'raw':!![],'where':{'id':_0x22d40e[_0xde77('0x43')]['id']}},_0x2063b7={};_0x2063b7[_0xde77('0x30')]=_[_0xde77('0x44')](db[_0xde77('0x2b')][_0xde77('0x45')]);_0x2063b7[_0xde77('0x2e')]=_[_0xde77('0x44')](_0x22d40e['query']);_0x2063b7[_0xde77('0x38')]=_[_0xde77('0x2f')](_0x2063b7[_0xde77('0x30')],_0x2063b7[_0xde77('0x2e')]);_0x436852[_0xde77('0x32')]=_[_0xde77('0x2f')](_0x2063b7[_0xde77('0x30')],qs[_0xde77('0x31')](_0x22d40e[_0xde77('0x2e')][_0xde77('0x31')]));_0x436852['attributes']=_0x436852[_0xde77('0x32')][_0xde77('0x33')]?_0x436852[_0xde77('0x32')]:_0x2063b7[_0xde77('0x30')];if(_0x22d40e[_0xde77('0x2e')][_0xde77('0x3e')]){_0x436852['include']=[{'all':!![]}];}_0x436852=_['merge']({},_0x436852,_0x22d40e[_0xde77('0x3d')]);return db[_0xde77('0x2b')][_0xde77('0x46')](_0x436852)['then'](handleEntityNotFound(_0x17c710,null))[_0xde77('0x25')](respondWithResult(_0x17c710,null))['catch'](handleError(_0x17c710,null));};exports[_0xde77('0x47')]=function(_0x330b5d,_0x2cf49d){return db['FaxTransferReport'][_0xde77('0x47')](_0x330b5d[_0xde77('0x48')],{})[_0xde77('0x25')](respondWithResult(_0x2cf49d,0xc9))[_0xde77('0x41')](handleError(_0x2cf49d,null));};exports[_0xde77('0x24')]=function(_0x18354e,_0x1bc6b3){if(_0x18354e['body']['id']){delete _0x18354e[_0xde77('0x48')]['id'];}return db[_0xde77('0x2b')][_0xde77('0x46')]({'where':{'id':_0x18354e[_0xde77('0x43')]['id']}})[_0xde77('0x25')](handleEntityNotFound(_0x1bc6b3,null))[_0xde77('0x25')](saveUpdates(_0x18354e[_0xde77('0x48')],null))[_0xde77('0x25')](respondWithResult(_0x1bc6b3,null))[_0xde77('0x41')](handleError(_0x1bc6b3,null));};exports[_0xde77('0x26')]=function(_0x1c1a89,_0x2464cd){return db[_0xde77('0x2b')][_0xde77('0x46')]({'where':{'id':_0x1c1a89[_0xde77('0x43')]['id']}})['then'](handleEntityNotFound(_0x2464cd,null))[_0xde77('0x25')](removeEntity(_0x2464cd,null))[_0xde77('0x41')](handleError(_0x2464cd,null));};exports[_0xde77('0x49')]=function(_0x394c4e,_0x2c6564){return db[_0xde77('0x2b')][_0xde77('0x49')]()[_0xde77('0x25')](respondWithResult(_0x2c6564,null))[_0xde77('0x41')](handleError(_0x2c6564,null));}; \ No newline at end of file +var _0xb727=['../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','map','merge','options','includeAll','include','rows','catch','params','body','find','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x667521,_0x43845b){var _0x44323a=function(_0x324618){while(--_0x324618){_0x667521['push'](_0x667521['shift']());}};_0x44323a(++_0x43845b);}(_0xb727,0x78));var _0x7b72=function(_0x235345,_0x12910f){_0x235345=_0x235345-0x0;var _0xfc05b4=_0xb727[_0x235345];return _0xfc05b4;};'use strict';var emlformat=require(_0x7b72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b72('0x1'));var rp=require(_0x7b72('0x2'));var moment=require('moment');var BPromise=require(_0x7b72('0x3'));var Mustache=require(_0x7b72('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7b72('0x5'));var csv=require(_0x7b72('0x6'));var ejs=require(_0x7b72('0x7'));var fs=require('fs');var fs_extra=require(_0x7b72('0x8'));var _=require(_0x7b72('0x9'));var squel=require(_0x7b72('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b72('0xb'));var Redis=require('ioredis');var authService=require(_0x7b72('0xc'));var qs=require(_0x7b72('0xd'));var as=require(_0x7b72('0xe'));var hardwareService=require(_0x7b72('0xf'));var logger=require('../../config/logger')(_0x7b72('0x10'));var utils=require(_0x7b72('0x11'));var config=require(_0x7b72('0x12'));var licenseUtil=require(_0x7b72('0x13'));var db=require(_0x7b72('0x14'))['db'];function respondWithStatusCode(_0x4e0ad7,_0x291e9c){_0x291e9c=_0x291e9c||0xcc;return function(_0x4515e4){if(_0x4515e4){return _0x4e0ad7[_0x7b72('0x15')](_0x291e9c);}return _0x4e0ad7['status'](_0x291e9c)['end']();};}function respondWithResult(_0x4fc8f4,_0x1d0730){_0x1d0730=_0x1d0730||0xc8;return function(_0x457f81){if(_0x457f81){return _0x4fc8f4['status'](_0x1d0730)[_0x7b72('0x16')](_0x457f81);}};}function respondWithFilteredResult(_0x339755,_0x364fdd){return function(_0x1640b9){if(_0x1640b9){var _0x5f420c=typeof _0x364fdd[_0x7b72('0x17')]===_0x7b72('0x18')&&typeof _0x364fdd[_0x7b72('0x19')]===_0x7b72('0x18');var _0x26c73d=_0x1640b9[_0x7b72('0x1a')];var _0x1c173e=_0x5f420c?0x0:_0x364fdd[_0x7b72('0x17')];var _0x472396=_0x5f420c?_0x1640b9['count']:_0x364fdd[_0x7b72('0x17')]+_0x364fdd['limit'];var _0x351944;if(_0x472396>=_0x26c73d){_0x472396=_0x26c73d;_0x351944=0xc8;}else{_0x351944=0xce;}_0x339755[_0x7b72('0x1b')](_0x351944);return _0x339755[_0x7b72('0x1c')](_0x7b72('0x1d'),_0x1c173e+'-'+_0x472396+'/'+_0x26c73d)['json'](_0x1640b9);}return null;};}function patchUpdates(_0x3e011b){return function(_0x70fd02){try{jsonpatch[_0x7b72('0x1e')](_0x70fd02,_0x3e011b,!![]);}catch(_0x3928ce){return BPromise[_0x7b72('0x1f')](_0x3928ce);}return _0x70fd02[_0x7b72('0x20')]();};}function saveUpdates(_0x233f53,_0x21da54){return function(_0x9f09a7){if(_0x9f09a7){return _0x9f09a7[_0x7b72('0x21')](_0x233f53)[_0x7b72('0x22')](function(_0x444099){return _0x444099;});}return null;};}function removeEntity(_0x34996c,_0x52ee3f){return function(_0x3af133){if(_0x3af133){return _0x3af133[_0x7b72('0x23')]()[_0x7b72('0x22')](function(){_0x34996c['status'](0xcc)[_0x7b72('0x24')]();});}};}function handleEntityNotFound(_0xa565c6,_0x2d6817){return function(_0x31280c){if(!_0x31280c){_0xa565c6[_0x7b72('0x15')](0x194);}return _0x31280c;};}function handleError(_0x5e309a,_0x281ad6){_0x281ad6=_0x281ad6||0x1f4;return function(_0x1dd566){logger['error'](_0x1dd566[_0x7b72('0x25')]);if(_0x1dd566[_0x7b72('0x26')]){delete _0x1dd566[_0x7b72('0x26')];}_0x5e309a[_0x7b72('0x1b')](_0x281ad6)[_0x7b72('0x27')](_0x1dd566);};}exports[_0x7b72('0x28')]=function(_0x3b7170,_0x3df7f4){var _0x1e3b7e={},_0x4faaf8={},_0xc64864={'count':0x0,'rows':[]};var _0x4d38b3=_['map'](db[_0x7b72('0x29')][_0x7b72('0x2a')],function(_0x257880){return{'name':_0x257880[_0x7b72('0x2b')],'type':_0x257880[_0x7b72('0x2c')][_0x7b72('0x2d')]};});_0x4faaf8[_0x7b72('0x2e')]=_['map'](_0x4d38b3,_0x7b72('0x26'));_0x4faaf8[_0x7b72('0x2f')]=_[_0x7b72('0x30')](_0x3b7170['query']);_0x4faaf8[_0x7b72('0x31')]=_['intersection'](_0x4faaf8[_0x7b72('0x2e')],_0x4faaf8[_0x7b72('0x2f')]);_0x1e3b7e[_0x7b72('0x32')]=_[_0x7b72('0x33')](_0x4faaf8[_0x7b72('0x2e')],qs[_0x7b72('0x34')](_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x34')]));_0x1e3b7e['attributes']=_0x1e3b7e['attributes']['length']?_0x1e3b7e[_0x7b72('0x32')]:_0x4faaf8['model'];if(!_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x35')](_0x7b72('0x36'))){_0x1e3b7e[_0x7b72('0x19')]=qs[_0x7b72('0x19')](_0x3b7170[_0x7b72('0x2f')]['limit']);_0x1e3b7e[_0x7b72('0x17')]=qs['offset'](_0x3b7170['query'][_0x7b72('0x17')]);}_0x1e3b7e[_0x7b72('0x37')]=qs['sort'](_0x3b7170[_0x7b72('0x2f')]['sort']);_0x1e3b7e[_0x7b72('0x38')]=qs['filters'](_[_0x7b72('0x39')](_0x3b7170['query'],_0x4faaf8[_0x7b72('0x31')]),_0x4d38b3);if(_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x3a')]){_0x1e3b7e[_0x7b72('0x38')]=_['merge'](_0x1e3b7e[_0x7b72('0x38')],{'$or':_[_0x7b72('0x3b')](_0x4d38b3,function(_0x70a5ea){if(_0x70a5ea[_0x7b72('0x2c')]!=='VIRTUAL'){var _0x54123f={};_0x54123f[_0x70a5ea[_0x7b72('0x26')]]={'$like':'%'+_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x3a')]+'%'};return _0x54123f;}})});}_0x1e3b7e=_[_0x7b72('0x3c')]({},_0x1e3b7e,_0x3b7170[_0x7b72('0x3d')]);var _0x2e4df6={'where':_0x1e3b7e[_0x7b72('0x38')]};return db['FaxTransferReport'][_0x7b72('0x1a')](_0x2e4df6)[_0x7b72('0x22')](function(_0x15a9ba){_0xc64864['count']=_0x15a9ba;if(_0x3b7170['query'][_0x7b72('0x3e')]){_0x1e3b7e[_0x7b72('0x3f')]=[{'all':!![]}];}return db[_0x7b72('0x29')]['findAll'](_0x1e3b7e);})[_0x7b72('0x22')](function(_0x294a24){_0xc64864[_0x7b72('0x40')]=_0x294a24;return _0xc64864;})[_0x7b72('0x22')](respondWithFilteredResult(_0x3df7f4,_0x1e3b7e))[_0x7b72('0x41')](handleError(_0x3df7f4,null));};exports['show']=function(_0x27e307,_0xe60c38){var _0x4c175a={'raw':!![],'where':{'id':_0x27e307[_0x7b72('0x42')]['id']}},_0x17131b={};_0x17131b['model']=_[_0x7b72('0x30')](db[_0x7b72('0x29')]['rawAttributes']);_0x17131b[_0x7b72('0x2f')]=_[_0x7b72('0x30')](_0x27e307[_0x7b72('0x2f')]);_0x17131b[_0x7b72('0x31')]=_[_0x7b72('0x33')](_0x17131b[_0x7b72('0x2e')],_0x17131b[_0x7b72('0x2f')]);_0x4c175a[_0x7b72('0x32')]=_[_0x7b72('0x33')](_0x17131b[_0x7b72('0x2e')],qs[_0x7b72('0x34')](_0x27e307[_0x7b72('0x2f')]['fields']));_0x4c175a[_0x7b72('0x32')]=_0x4c175a[_0x7b72('0x32')]['length']?_0x4c175a[_0x7b72('0x32')]:_0x17131b[_0x7b72('0x2e')];if(_0x27e307[_0x7b72('0x2f')][_0x7b72('0x3e')]){_0x4c175a[_0x7b72('0x3f')]=[{'all':!![]}];}_0x4c175a=_['merge']({},_0x4c175a,_0x27e307[_0x7b72('0x3d')]);return db['FaxTransferReport']['find'](_0x4c175a)[_0x7b72('0x22')](handleEntityNotFound(_0xe60c38,null))[_0x7b72('0x22')](respondWithResult(_0xe60c38,null))[_0x7b72('0x41')](handleError(_0xe60c38,null));};exports['create']=function(_0x317b8a,_0x5307bf){return db[_0x7b72('0x29')]['create'](_0x317b8a[_0x7b72('0x43')],{})[_0x7b72('0x22')](respondWithResult(_0x5307bf,0xc9))['catch'](handleError(_0x5307bf,null));};exports[_0x7b72('0x21')]=function(_0x5b6eec,_0x42867f){if(_0x5b6eec['body']['id']){delete _0x5b6eec[_0x7b72('0x43')]['id'];}return db[_0x7b72('0x29')]['find']({'where':{'id':_0x5b6eec[_0x7b72('0x42')]['id']}})[_0x7b72('0x22')](handleEntityNotFound(_0x42867f,null))[_0x7b72('0x22')](saveUpdates(_0x5b6eec['body'],null))[_0x7b72('0x22')](respondWithResult(_0x42867f,null))[_0x7b72('0x41')](handleError(_0x42867f,null));};exports['destroy']=function(_0x29e2aa,_0x3db243){return db[_0x7b72('0x29')][_0x7b72('0x44')]({'where':{'id':_0x29e2aa[_0x7b72('0x42')]['id']}})[_0x7b72('0x22')](handleEntityNotFound(_0x3db243,null))[_0x7b72('0x22')](removeEntity(_0x3db243,null))[_0x7b72('0x41')](handleError(_0x3db243,null));};exports[_0x7b72('0x45')]=function(_0x1de6d3,_0x35b53c){return db[_0x7b72('0x29')]['describe']()[_0x7b72('0x22')](respondWithResult(_0x35b53c,null))[_0x7b72('0x41')](handleError(_0x35b53c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1b35b8f..23a4c5e 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 _0x204f=['request-promise','path','../../config/environment','exports','define','FaxTransferReport','uniqueid','api'];(function(_0x180b7d,_0x5e26e2){var _0x2b4187=function(_0x22d56b){while(--_0x22d56b){_0x180b7d['push'](_0x180b7d['shift']());}};_0x2b4187(++_0x5e26e2);}(_0x204f,0x13f));var _0xf204=function(_0x2ebbfe,_0x52ddcf){_0x2ebbfe=_0x2ebbfe-0x0;var _0x894d72=_0x204f[_0x2ebbfe];return _0x894d72;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf204('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf204('0x1'));var fs=require('fs');var path=require(_0xf204('0x2'));var rimraf=require('rimraf');var config=require(_0xf204('0x3'));var attributes=require('./faxTransferReport.attributes');module[_0xf204('0x4')]=function(_0xa4e663,_0x4d34ba){return _0xa4e663[_0xf204('0x5')](_0xf204('0x6'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf204('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x052c=['moment','bluebird','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x052c,0xe6));var _0xc052=function(_0x36a36d,_0x556689){_0x36a36d=_0x36a36d-0x0;var _0x3ab194=_0x052c[_0x36a36d];return _0x3ab194;};'use strict';var _=require(_0xc052('0x0'));var util=require(_0xc052('0x1'));var logger=require(_0xc052('0x2'))(_0xc052('0x3'));var moment=require(_0xc052('0x4'));var BPromise=require(_0xc052('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc052('0x6'));var config=require(_0xc052('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xc052('0x8')]=function(_0x22a664,_0x1a96e7){return _0x22a664[_0xc052('0x9')](_0xc052('0xa'),attributes,{'tableName':_0xc052('0xb'),'paranoid':![],'indexes':[{'name':_0xc052('0xc'),'fields':[_0xc052('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 025d494..0094fb0 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 _0x53fc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53fc,0xf7));var _0xc53f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53fc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc53f('0x0'));var util=require('util');var moment=require(_0xc53f('0x1'));var BPromise=require(_0xc53f('0x2'));var rs=require(_0xc53f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc53f('0x4'))['db'];var utils=require(_0xc53f('0x5'));var logger=require(_0xc53f('0x6'))(_0xc53f('0x7'));var config=require(_0xc53f('0x8'));var jayson=require(_0xc53f('0x9'));var client=jayson[_0xc53f('0xa')][_0xc53f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x261b77,_0x246483,_0x3c680f){return new BPromise(function(_0x256628,_0x3f4bfd){return client['request'](_0x261b77,_0x3c680f)[_0xc53f('0xc')](function(_0x269c71){logger[_0xc53f('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x246483,_0xc53f('0xe'));logger[_0xc53f('0xf')](_0xc53f('0x10'),_0x246483,_0xc53f('0xe'),JSON['stringify'](_0x269c71));if(_0x269c71[_0xc53f('0x11')]){if(_0x269c71[_0xc53f('0x11')][_0xc53f('0x12')]===0x1f4){logger[_0xc53f('0x11')](_0xc53f('0x13'),_0x246483,_0x269c71['error'][_0xc53f('0x14')]);return _0x3f4bfd(_0x269c71[_0xc53f('0x11')][_0xc53f('0x14')]);}logger[_0xc53f('0x11')](_0xc53f('0x13'),_0x246483,_0x269c71[_0xc53f('0x11')][_0xc53f('0x14')]);return _0x256628(_0x269c71[_0xc53f('0x11')][_0xc53f('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x246483,'request\x20sent');_0x256628(_0x269c71[_0xc53f('0x15')][_0xc53f('0x14')]);}})[_0xc53f('0x16')](function(_0x16d02c){logger[_0xc53f('0x11')](_0xc53f('0x13'),_0x246483,_0x16d02c);_0x3f4bfd(_0x16d02c);});});} \ No newline at end of file +var _0x6b61=['rpc','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6b61,0x1e8));var _0x16b6=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x6b61[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x16b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16b6('0x1'));var rs=require(_0x16b6('0x2'));var fs=require('fs');var Redis=require(_0x16b6('0x3'));var db=require(_0x16b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16b6('0x5'))(_0x16b6('0x6'));var config=require('../../config/environment');var jayson=require(_0x16b6('0x7'));var client=jayson[_0x16b6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xec7d6e,_0x3409dc,_0x659039){return new BPromise(function(_0x3a21f4,_0x1e8227){return client[_0x16b6('0x9')](_0xec7d6e,_0x659039)[_0x16b6('0xa')](function(_0x3dcaa5){logger['info'](_0x16b6('0xb'),_0x3409dc,'request\x20sent');logger['debug'](_0x16b6('0xc'),_0x3409dc,_0x16b6('0xd'),JSON[_0x16b6('0xe')](_0x3dcaa5));if(_0x3dcaa5[_0x16b6('0xf')]){if(_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x10')]===0x1f4){logger[_0x16b6('0xf')](_0x16b6('0xb'),_0x3409dc,_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);return _0x1e8227(_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);}logger[_0x16b6('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3409dc,_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);return _0x3a21f4(_0x3dcaa5['error'][_0x16b6('0x11')]);}else{logger['info'](_0x16b6('0xb'),_0x3409dc,'request\x20sent');_0x3a21f4(_0x3dcaa5[_0x16b6('0x12')][_0x16b6('0x11')]);}})['catch'](function(_0x2ee428){logger['error'](_0x16b6('0xb'),_0x3409dc,_0x2ee428);_0x1e8227(_0x2ee428);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index df414bd..bef00cc 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 _0x0587=['index','/describe','isAuthenticated','describe','show','post','put','/:id','update','destroy','multer','util','connect-timeout','fs-extra','../../config/environment','get'];(function(_0x34ced0,_0x21907f){var _0x3db58d=function(_0x51fb31){while(--_0x51fb31){_0x34ced0['push'](_0x34ced0['shift']());}};_0x3db58d(++_0x21907f);}(_0x0587,0x1ba));var _0x7058=function(_0x17174c,_0x266797){_0x17174c=_0x17174c-0x0;var _0x38125a=_0x0587[_0x17174c];return _0x38125a;};'use strict';var multer=require(_0x7058('0x0'));var util=require(_0x7058('0x1'));var path=require('path');var timeout=require(_0x7058('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7058('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7058('0x4'));var controller=require('./faxTransferReport.controller');router[_0x7058('0x5')]('/',auth['isAuthenticated'](),controller[_0x7058('0x6')]);router[_0x7058('0x5')](_0x7058('0x7'),auth[_0x7058('0x8')](),controller[_0x7058('0x9')]);router[_0x7058('0x5')]('/:id',auth[_0x7058('0x8')](),controller[_0x7058('0xa')]);router[_0x7058('0xb')]('/',auth[_0x7058('0x8')](),controller['create']);router[_0x7058('0xc')](_0x7058('0xd'),auth[_0x7058('0x8')](),controller[_0x7058('0xe')]);router['delete'](_0x7058('0xd'),auth['isAuthenticated'](),controller[_0x7058('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3814=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy'];(function(_0x372f70,_0x58e47d){var _0x282eab=function(_0x59f311){while(--_0x59f311){_0x372f70['push'](_0x372f70['shift']());}};_0x282eab(++_0x58e47d);}(_0x3814,0x74));var _0x4381=function(_0x26d957,_0x40d8c7){_0x26d957=_0x26d957-0x0;var _0x2e64dc=_0x3814[_0x26d957];return _0x2e64dc;};'use strict';var multer=require(_0x4381('0x0'));var util=require(_0x4381('0x1'));var path=require(_0x4381('0x2'));var timeout=require(_0x4381('0x3'));var express=require(_0x4381('0x4'));var router=express[_0x4381('0x5')]();var fs_extra=require(_0x4381('0x6'));var auth=require(_0x4381('0x7'));var interaction=require(_0x4381('0x8'));var config=require(_0x4381('0x9'));var controller=require('./faxTransferReport.controller');router[_0x4381('0xa')]('/',auth['isAuthenticated'](),controller[_0x4381('0xb')]);router[_0x4381('0xa')](_0x4381('0xc'),auth[_0x4381('0xd')](),controller[_0x4381('0xe')]);router['get'](_0x4381('0xf'),auth[_0x4381('0xd')](),controller[_0x4381('0x10')]);router[_0x4381('0x11')]('/',auth[_0x4381('0xd')](),controller[_0x4381('0x12')]);router[_0x4381('0x13')](_0x4381('0xf'),auth[_0x4381('0xd')](),controller[_0x4381('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4381('0x15')]);module[_0x4381('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e284fc7..c13b711 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 _0x02dd=['addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x02dd,0x73));var _0xd02d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x02dd[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require(_0xd02d('0x0'));var path=require(_0xd02d('0x1'));var timeout=require(_0xd02d('0x2'));var express=require(_0xd02d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd02d('0x4'));var interaction=require(_0xd02d('0x5'));var config=require(_0xd02d('0x6'));var controller=require('./intDeskAccount.controller');router[_0xd02d('0x7')]('/',auth[_0xd02d('0x8')](),controller['index']);router['get'](_0xd02d('0x9'),auth['isAuthenticated'](),controller[_0xd02d('0xa')]);router[_0xd02d('0x7')](_0xd02d('0xb'),auth[_0xd02d('0x8')](),controller[_0xd02d('0xc')]);router[_0xd02d('0x7')](_0xd02d('0xd'),auth['isAuthenticated'](),controller[_0xd02d('0xe')]);router[_0xd02d('0xf')]('/',auth[_0xd02d('0x8')](),controller[_0xd02d('0x10')]);router[_0xd02d('0xf')]('/:id/configurations',auth[_0xd02d('0x8')](),controller[_0xd02d('0x11')]);router[_0xd02d('0x12')](_0xd02d('0x9'),auth[_0xd02d('0x8')](),controller['update']);router[_0xd02d('0x13')](_0xd02d('0x9'),auth[_0xd02d('0x8')](),controller[_0xd02d('0x14')]);module[_0xd02d('0x15')]=router; \ No newline at end of file +var _0xe0db=['create','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x191bba,_0xc6b52a){var _0x53b444=function(_0x571dda){while(--_0x571dda){_0x191bba['push'](_0x191bba['shift']());}};_0x53b444(++_0xc6b52a);}(_0xe0db,0x18e));var _0xbe0d=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe0db[_0x21aec3];return _0x288bbc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbe0d('0x0'));var express=require(_0xbe0d('0x1'));var router=express[_0xbe0d('0x2')]();var fs_extra=require(_0xbe0d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbe0d('0x4'));var config=require(_0xbe0d('0x5'));var controller=require(_0xbe0d('0x6'));router[_0xbe0d('0x7')]('/',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x9')]);router[_0xbe0d('0x7')](_0xbe0d('0xa'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xb')]);router[_0xbe0d('0x7')](_0xbe0d('0xc'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xd')]);router[_0xbe0d('0x7')]('/:id/fields',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xe')]);router[_0xbe0d('0xf')]('/',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x10')]);router[_0xbe0d('0xf')](_0xbe0d('0xc'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x11')]);router[_0xbe0d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbe0d('0x13')]);router[_0xbe0d('0x14')](_0xbe0d('0xa'),auth['isAuthenticated'](),controller[_0xbe0d('0x15')]);module[_0xbe0d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8cc54db..7c8a447 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 _0xe957=['STRING','ENUM','basic','newTab','integrationTab','exports'];(function(_0x4bf615,_0x2b3317){var _0x5d293e=function(_0x18f418){while(--_0x18f418){_0x4bf615['push'](_0x4bf615['shift']());}};_0x5d293e(++_0x2b3317);}(_0xe957,0x12b));var _0x7e95=function(_0x555159,_0x3218ba){_0x555159=_0x555159-0x0;var _0x4f57f8=_0xe957[_0x555159];return _0x4f57f8;};'use strict';var Sequelize=require('sequelize');module[_0x7e95('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7e95('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7e95('0x1')]},'authType':{'type':Sequelize[_0x7e95('0x2')]('basic'),'defaultValue':_0x7e95('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x7e95('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7e95('0x1')]},'serverUrl':{'type':Sequelize[_0x7e95('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x7e95('0x4')),'defaultValue':_0x7e95('0x5')}}; \ No newline at end of file +var _0x74ce=['STRING','basic','ENUM','newTab','sequelize','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x74ce,0xa6));var _0xe74c=function(_0x547a19,_0x3d6284){_0x547a19=_0x547a19-0x0;var _0x445415=_0x74ce[_0x547a19];return _0x445415;};'use strict';var Sequelize=require(_0xe74c('0x0'));module[_0xe74c('0x1')]={'name':{'type':Sequelize[_0xe74c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe74c('0x2')]},'remoteUri':{'type':Sequelize[_0xe74c('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xe74c('0x3')),'defaultValue':_0xe74c('0x3')},'password':{'type':Sequelize[_0xe74c('0x2')]},'consumerKey':{'type':Sequelize[_0xe74c('0x2')]},'consumerSecret':{'type':Sequelize[_0xe74c('0x2')]},'token':{'type':Sequelize[_0xe74c('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe74c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe74c('0x4')]('integrationTab',_0xe74c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c6b967f..c75691c 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 _0x18c5=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','Authorization','format','Basic\x20%s','%s:%s','base64','_embedded','entries','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','fieldName'];(function(_0x3eb3e5,_0x57380f){var _0x52028f=function(_0x5a9260){while(--_0x5a9260){_0x3eb3e5['push'](_0x3eb3e5['shift']());}};_0x52028f(++_0x57380f);}(_0x18c5,0x117));var _0x518c=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x18c5[_0x14490c];return _0x2f6825;};'use strict';var emlformat=require(_0x518c('0x0'));var rimraf=require(_0x518c('0x1'));var zipdir=require(_0x518c('0x2'));var jsonpatch=require(_0x518c('0x3'));var rp=require(_0x518c('0x4'));var moment=require('moment');var BPromise=require(_0x518c('0x5'));var Mustache=require(_0x518c('0x6'));var util=require(_0x518c('0x7'));var path=require(_0x518c('0x8'));var sox=require('sox');var csv=require(_0x518c('0x9'));var ejs=require(_0x518c('0xa'));var fs=require('fs');var fs_extra=require(_0x518c('0xb'));var _=require(_0x518c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x518c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x518c('0x9'));var querystring=require(_0x518c('0xe'));var Papa=require(_0x518c('0xf'));var Redis=require(_0x518c('0x10'));var authService=require(_0x518c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x518c('0x12'));var hardwareService=require(_0x518c('0x13'));var logger=require(_0x518c('0x14'))(_0x518c('0x15'));var utils=require(_0x518c('0x16'));var config=require(_0x518c('0x17'));var licenseUtil=require(_0x518c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x518c('0x19'));function respondWithStatusCode(_0x23dc32,_0x1a2fc3){_0x1a2fc3=_0x1a2fc3||0xcc;return function(_0x4612a6){if(_0x4612a6){return _0x23dc32['sendStatus'](_0x1a2fc3);}return _0x23dc32[_0x518c('0x1a')](_0x1a2fc3)[_0x518c('0x1b')]();};}function respondWithResult(_0x453f96,_0x437ebe){_0x437ebe=_0x437ebe||0xc8;return function(_0x21b529){if(_0x21b529){return _0x453f96['status'](_0x437ebe)[_0x518c('0x1c')](_0x21b529);}};}function respondWithFilteredResult(_0x5338eb,_0x31b283){return function(_0x463392){if(_0x463392){var _0x416d07=typeof _0x31b283[_0x518c('0x1d')]===_0x518c('0x1e')&&typeof _0x31b283['limit']===_0x518c('0x1e');var _0x3bba07=_0x463392[_0x518c('0x1f')];var _0x5d699f=_0x416d07?0x0:_0x31b283[_0x518c('0x1d')];var _0x1c87a2=_0x416d07?_0x463392[_0x518c('0x1f')]:_0x31b283[_0x518c('0x1d')]+_0x31b283[_0x518c('0x20')];var _0x306f32;if(_0x1c87a2>=_0x3bba07){_0x1c87a2=_0x3bba07;_0x306f32=0xc8;}else{_0x306f32=0xce;}_0x5338eb[_0x518c('0x1a')](_0x306f32);return _0x5338eb[_0x518c('0x21')]('Content-Range',_0x5d699f+'-'+_0x1c87a2+'/'+_0x3bba07)[_0x518c('0x1c')](_0x463392);}return null;};}function patchUpdates(_0x2a75b8){return function(_0x4c287a){try{jsonpatch[_0x518c('0x22')](_0x4c287a,_0x2a75b8,!![]);}catch(_0x3b51e1){return BPromise[_0x518c('0x23')](_0x3b51e1);}return _0x4c287a['save']();};}function saveUpdates(_0x580974,_0x2ac4a5){return function(_0x25af21){if(_0x25af21){return _0x25af21[_0x518c('0x24')](_0x580974)[_0x518c('0x25')](function(_0x307a82){return _0x307a82;});}return null;};}function removeEntity(_0x15a275,_0x37cc50){return function(_0xcff2b6){if(_0xcff2b6){return _0xcff2b6[_0x518c('0x26')]()[_0x518c('0x25')](function(){_0x15a275[_0x518c('0x1a')](0xcc)[_0x518c('0x1b')]();});}};}function handleEntityNotFound(_0x5076d9,_0x212806){return function(_0x3bbd83){if(!_0x3bbd83){_0x5076d9[_0x518c('0x27')](0x194);}return _0x3bbd83;};}function handleError(_0x156f4b,_0x1f988d){_0x1f988d=_0x1f988d||0x1f4;return function(_0x4911fe){logger[_0x518c('0x28')](_0x4911fe[_0x518c('0x29')]);if(_0x4911fe[_0x518c('0x2a')]){delete _0x4911fe[_0x518c('0x2a')];}_0x156f4b[_0x518c('0x1a')](_0x1f988d)[_0x518c('0x2b')](_0x4911fe);};}exports[_0x518c('0x2c')]=function(_0x1960f3,_0x2af9d5){var _0x4ff70f={},_0x106e92={},_0x432fe8={'count':0x0,'rows':[]};var _0x203207=_[_0x518c('0x2d')](db[_0x518c('0x2e')]['rawAttributes'],function(_0x4c578e){return{'name':_0x4c578e[_0x518c('0x2f')],'type':_0x4c578e[_0x518c('0x30')]['key']};});_0x106e92[_0x518c('0x31')]=_['map'](_0x203207,_0x518c('0x2a'));_0x106e92[_0x518c('0x32')]=_[_0x518c('0x33')](_0x1960f3[_0x518c('0x32')]);_0x106e92[_0x518c('0x34')]=_[_0x518c('0x35')](_0x106e92[_0x518c('0x31')],_0x106e92[_0x518c('0x32')]);_0x4ff70f[_0x518c('0x36')]=_[_0x518c('0x35')](_0x106e92[_0x518c('0x31')],qs[_0x518c('0x37')](_0x1960f3[_0x518c('0x32')][_0x518c('0x37')]));_0x4ff70f['attributes']=_0x4ff70f['attributes'][_0x518c('0x38')]?_0x4ff70f[_0x518c('0x36')]:_0x106e92[_0x518c('0x31')];if(!_0x1960f3[_0x518c('0x32')][_0x518c('0x39')]('nolimit')){_0x4ff70f[_0x518c('0x20')]=qs['limit'](_0x1960f3[_0x518c('0x32')][_0x518c('0x20')]);_0x4ff70f['offset']=qs['offset'](_0x1960f3['query'][_0x518c('0x1d')]);}_0x4ff70f[_0x518c('0x3a')]=qs[_0x518c('0x3b')](_0x1960f3[_0x518c('0x32')][_0x518c('0x3b')]);_0x4ff70f[_0x518c('0x3c')]=qs[_0x518c('0x34')](_[_0x518c('0x3d')](_0x1960f3[_0x518c('0x32')],_0x106e92[_0x518c('0x34')]),_0x203207);if(_0x1960f3['query'][_0x518c('0x3e')]){_0x4ff70f[_0x518c('0x3c')]=_[_0x518c('0x3f')](_0x4ff70f[_0x518c('0x3c')],{'$or':_['map'](_0x203207,function(_0x5e25d2){if(_0x5e25d2['type']!==_0x518c('0x40')){var _0x5c9298={};_0x5c9298[_0x5e25d2[_0x518c('0x2a')]]={'$like':'%'+_0x1960f3['query'][_0x518c('0x3e')]+'%'};return _0x5c9298;}})});}_0x4ff70f=_[_0x518c('0x3f')]({},_0x4ff70f,_0x1960f3[_0x518c('0x41')]);var _0x252f07={'where':_0x4ff70f['where']};return db['DeskAccount'][_0x518c('0x1f')](_0x252f07)['then'](function(_0x227a3b){_0x432fe8[_0x518c('0x1f')]=_0x227a3b;if(_0x1960f3['query'][_0x518c('0x42')]){_0x4ff70f[_0x518c('0x43')]=[{'all':!![]}];}return db[_0x518c('0x2e')]['findAll'](_0x4ff70f);})[_0x518c('0x25')](function(_0x37a2cb){_0x432fe8[_0x518c('0x44')]=_0x37a2cb;return _0x432fe8;})['then'](respondWithFilteredResult(_0x2af9d5,_0x4ff70f))[_0x518c('0x45')](handleError(_0x2af9d5,null));};exports[_0x518c('0x46')]=function(_0xc392a4,_0x673bf1){var _0x27d51f={'raw':![],'where':{'id':_0xc392a4[_0x518c('0x47')]['id']}},_0x1f9583={};_0x1f9583['model']=_['keys'](db['DeskAccount'][_0x518c('0x48')]);_0x1f9583[_0x518c('0x32')]=_['keys'](_0xc392a4[_0x518c('0x32')]);_0x1f9583[_0x518c('0x34')]=_[_0x518c('0x35')](_0x1f9583[_0x518c('0x31')],_0x1f9583[_0x518c('0x32')]);_0x27d51f[_0x518c('0x36')]=_[_0x518c('0x35')](_0x1f9583[_0x518c('0x31')],qs['fields'](_0xc392a4['query'][_0x518c('0x37')]));_0x27d51f[_0x518c('0x36')]=_0x27d51f[_0x518c('0x36')][_0x518c('0x38')]?_0x27d51f[_0x518c('0x36')]:_0x1f9583[_0x518c('0x31')];if(_0xc392a4[_0x518c('0x32')]['includeAll']){_0x27d51f[_0x518c('0x43')]=[{'all':!![]}];}_0x27d51f=_[_0x518c('0x3f')]({},_0x27d51f,_0xc392a4[_0x518c('0x41')]);return db[_0x518c('0x2e')][_0x518c('0x49')](_0x27d51f)[_0x518c('0x25')](handleEntityNotFound(_0x673bf1,null))[_0x518c('0x25')](respondWithResult(_0x673bf1,null))[_0x518c('0x45')](handleError(_0x673bf1,null));};exports[_0x518c('0x4a')]=function(_0x6e048e,_0x5ebc60){return db['DeskAccount']['create'](_0x6e048e['body'],{})[_0x518c('0x25')](respondWithResult(_0x5ebc60,0xc9))[_0x518c('0x45')](handleError(_0x5ebc60,null));};exports[_0x518c('0x24')]=function(_0x36d1a9,_0x5f3fb5){if(_0x36d1a9[_0x518c('0x4b')]['id']){delete _0x36d1a9[_0x518c('0x4b')]['id'];}return db[_0x518c('0x2e')][_0x518c('0x49')]({'where':{'id':_0x36d1a9[_0x518c('0x47')]['id']}})[_0x518c('0x25')](handleEntityNotFound(_0x5f3fb5,null))[_0x518c('0x25')](saveUpdates(_0x36d1a9[_0x518c('0x4b')],null))[_0x518c('0x25')](respondWithResult(_0x5f3fb5,null))['catch'](handleError(_0x5f3fb5,null));};exports[_0x518c('0x26')]=function(_0x2cd21f,_0x30f873){return db['DeskAccount'][_0x518c('0x49')]({'where':{'id':_0x2cd21f[_0x518c('0x47')]['id']}})[_0x518c('0x25')](handleEntityNotFound(_0x30f873,null))['then'](removeEntity(_0x30f873,null))[_0x518c('0x45')](handleError(_0x30f873,null));};exports[_0x518c('0x4c')]=function(_0x5ac7f7,_0x43d19b,_0x14267f){var _0x380144={};var _0x568e43={};var _0x41cfa5;var _0x4ab507;return db['DeskAccount']['findOne']({'where':{'id':_0x5ac7f7['params']['id']}})[_0x518c('0x25')](handleEntityNotFound(_0x43d19b,null))[_0x518c('0x25')](function(_0x55f383){if(_0x55f383){_0x41cfa5=_0x55f383;_0x568e43[_0x518c('0x31')]=_['keys'](db['DeskConfiguration'][_0x518c('0x48')]);_0x568e43[_0x518c('0x32')]=_[_0x518c('0x33')](_0x5ac7f7[_0x518c('0x32')]);_0x568e43[_0x518c('0x34')]=_[_0x518c('0x35')](_0x568e43[_0x518c('0x31')],_0x568e43[_0x518c('0x32')]);_0x380144[_0x518c('0x36')]=_['intersection'](_0x568e43[_0x518c('0x31')],qs[_0x518c('0x37')](_0x5ac7f7[_0x518c('0x32')][_0x518c('0x37')]));_0x380144[_0x518c('0x36')]=_0x380144['attributes'][_0x518c('0x38')]?_0x380144[_0x518c('0x36')]:_0x568e43[_0x518c('0x31')];_0x380144[_0x518c('0x3a')]=qs['sort'](_0x5ac7f7[_0x518c('0x32')]['sort']);_0x380144['where']=qs['filters'](_['pick'](_0x5ac7f7[_0x518c('0x32')],_0x568e43[_0x518c('0x34')]));if(_0x5ac7f7[_0x518c('0x32')]['filter']){_0x380144[_0x518c('0x3c')]=_[_0x518c('0x3f')](_0x380144[_0x518c('0x3c')],{'$or':_[_0x518c('0x2d')](_0x380144[_0x518c('0x36')],function(_0xd23ab1){var _0x4fd268={};_0x4fd268[_0xd23ab1]={'$like':'%'+_0x5ac7f7[_0x518c('0x32')]['filter']+'%'};return _0x4fd268;})});}_0x380144=_[_0x518c('0x3f')]({},_0x380144,_0x5ac7f7[_0x518c('0x41')]);return _0x41cfa5[_0x518c('0x4c')](_0x380144);}})[_0x518c('0x25')](function(_0x50ef1b){if(_0x50ef1b){_0x4ab507=_0x50ef1b[_0x518c('0x38')];if(!_0x5ac7f7[_0x518c('0x32')]['hasOwnProperty'](_0x518c('0x4d'))){_0x380144[_0x518c('0x20')]=qs['limit'](_0x5ac7f7['query'][_0x518c('0x20')]);_0x380144[_0x518c('0x1d')]=qs[_0x518c('0x1d')](_0x5ac7f7['query']['offset']);}return _0x41cfa5[_0x518c('0x4c')](_0x380144);}})[_0x518c('0x25')](function(_0x219f07){if(_0x219f07){return _0x219f07?{'count':_0x4ab507,'rows':_0x219f07}:null;}})[_0x518c('0x25')](respondWithResult(_0x43d19b,null))[_0x518c('0x45')](handleError(_0x43d19b,null));};exports[_0x518c('0x4e')]=function(_0xcdf8dc,_0xaa4ab5,_0x574fe5){if(_0xcdf8dc['body']['id']){delete _0xcdf8dc[_0x518c('0x4b')]['id'];}return db[_0x518c('0x2e')][_0x518c('0x4f')]({'where':{'id':_0xcdf8dc['params']['id']}})[_0x518c('0x25')](handleEntityNotFound(_0xaa4ab5,null))[_0x518c('0x25')](function(_0x39ec0a){if(_0x39ec0a){_0xcdf8dc[_0x518c('0x4b')][_0x518c('0x50')]=_0x39ec0a['id'];_0xcdf8dc['body']['Subjects']=integrations['getSubjects'](_0xcdf8dc[_0x518c('0x4b')]['channel'],_0xcdf8dc[_0x518c('0x4b')][_0x518c('0x30')]);_0xcdf8dc[_0x518c('0x4b')][_0x518c('0x51')]=integrations[_0x518c('0x52')](_0xcdf8dc[_0x518c('0x4b')]['channel'],_0xcdf8dc[_0x518c('0x4b')][_0x518c('0x30')]);return db['DeskConfiguration'][_0x518c('0x4a')](_0xcdf8dc['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x518c('0x53')],'as':'Descriptions'}]});}return null;})[_0x518c('0x25')](respondWithResult(_0xaa4ab5,null))[_0x518c('0x45')](handleError(_0xaa4ab5,null));};exports[_0x518c('0x54')]=function(_0x33b033,_0x2af6db,_0x45cc66){var _0x27aa6d=[{'name':_0x518c('0x55'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x279c3c='';return db[_0x518c('0x2e')][_0x518c('0x4f')]({'where':{'id':_0x33b033[_0x518c('0x47')]['id']},'attributes':['id',_0x518c('0x56'),_0x518c('0x57'),_0x518c('0x58'),'password',_0x518c('0x59'),'consumerSecret',_0x518c('0x5a'),_0x518c('0x5b')]})['then'](handleEntityNotFound(_0x2af6db,null))[_0x518c('0x25')](function(_0x5b8e1c){if(_0x5b8e1c){_0x279c3c=_0x5b8e1c[_0x518c('0x56')];var _0x428324=_0x279c3c[_0x518c('0x5c')](-0x1);if(_0x428324==='/'){_0x279c3c=_0x279c3c[_0x518c('0x5d')](0x0,_0x279c3c[_0x518c('0x5e')](_0x428324));}var _0x448bdd={'method':_0x518c('0x5f'),'uri':util['format'](_0x518c('0x60'),_0x279c3c),'headers':{'Content-Type':'application/json','Accept':_0x518c('0x61')},'json':!![]};if(_0x5b8e1c[_0x518c('0x57')]==='basic'){_0x448bdd['headers'][_0x518c('0x62')]=util[_0x518c('0x63')](_0x518c('0x64'),new Buffer(util['format'](_0x518c('0x65'),_0x5b8e1c[_0x518c('0x58')],_0x5b8e1c['password']))['toString'](_0x518c('0x66')));}return rp(_0x448bdd)[_0x518c('0x25')](function(_0x21cc31){return _0x27aa6d['concat'](_[_0x518c('0x2d')](_0x21cc31[_0x518c('0x67')][_0x518c('0x68')],function(_0x31e899){return{'id':_0x31e899['name'],'name':_0x31e899['name'],'type':_0x31e899[_0x518c('0x30')],'active':_0x31e899['active'],'label':_0x31e899['label'],'custom':!![]};}));});}})['then'](function(_0x1167ba){return{'count':_0x1167ba[_0x518c('0x38')],'rows':_0x1167ba};})[_0x518c('0x25')](respondWithResult(_0x2af6db,null))['catch'](function(_0x4907aa){var _0x1476e0=_0x33b033['query'][_0x518c('0x69')]?0x1f4:_0x4907aa['statusCode']||0x1f4;logger['error'](_0x518c('0x6a'),_0x518c('0x54'),_0x1476e0,JSON[_0x518c('0x6b')](_0x4907aa));delete _0x4907aa[_0x518c('0x2a')];if(_0x1476e0===0x191){_0x1476e0=0x190;}_0x2af6db[_0x518c('0x1a')](_0x1476e0)[_0x518c('0x2b')](_0x33b033[_0x518c('0x32')]['test']?{'message':_0x518c('0x6c'),'statusCode':_0x4907aa['statusCode']}:_0x4907aa);});}; \ No newline at end of file +var _0x2b98=['entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','getConfigurations','findOne','addConfiguration','channel','Descriptions','getDescriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','toString','concat','_embedded'];(function(_0x4793ed,_0xf5816c){var _0x4dfd3e=function(_0x2d6e5f){while(--_0x2d6e5f){_0x4793ed['push'](_0x4793ed['shift']());}};_0x4dfd3e(++_0xf5816c);}(_0x2b98,0x161));var _0x82b9=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x2b98[_0x298ed3];return _0x5aad28;};'use strict';var emlformat=require(_0x82b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82b9('0x1'));var jsonpatch=require(_0x82b9('0x2'));var rp=require(_0x82b9('0x3'));var moment=require('moment');var BPromise=require(_0x82b9('0x4'));var Mustache=require(_0x82b9('0x5'));var util=require('util');var path=require(_0x82b9('0x6'));var sox=require(_0x82b9('0x7'));var csv=require(_0x82b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82b9('0x9'));var squel=require(_0x82b9('0xa'));var crypto=require(_0x82b9('0xb'));var jsforce=require(_0x82b9('0xc'));var deskjs=require(_0x82b9('0xd'));var toCsv=require(_0x82b9('0x8'));var querystring=require(_0x82b9('0xe'));var Papa=require(_0x82b9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82b9('0x10'));var as=require(_0x82b9('0x11'));var hardwareService=require(_0x82b9('0x12'));var logger=require(_0x82b9('0x13'))(_0x82b9('0x14'));var utils=require(_0x82b9('0x15'));var config=require(_0x82b9('0x16'));var licenseUtil=require(_0x82b9('0x17'));var db=require(_0x82b9('0x18'))['db'];var integrations=require(_0x82b9('0x19'));function respondWithStatusCode(_0x254ff4,_0x31a98b){_0x31a98b=_0x31a98b||0xcc;return function(_0x3bb1b9){if(_0x3bb1b9){return _0x254ff4[_0x82b9('0x1a')](_0x31a98b);}return _0x254ff4[_0x82b9('0x1b')](_0x31a98b)['end']();};}function respondWithResult(_0x26449b,_0x5cd03b){_0x5cd03b=_0x5cd03b||0xc8;return function(_0x1fb20e){if(_0x1fb20e){return _0x26449b[_0x82b9('0x1b')](_0x5cd03b)[_0x82b9('0x1c')](_0x1fb20e);}};}function respondWithFilteredResult(_0x5bed0d,_0x499200){return function(_0x8ee399){if(_0x8ee399){var _0x427a27=typeof _0x499200[_0x82b9('0x1d')]==='undefined'&&typeof _0x499200[_0x82b9('0x1e')]===_0x82b9('0x1f');var _0x17acde=_0x8ee399[_0x82b9('0x20')];var _0x175467=_0x427a27?0x0:_0x499200[_0x82b9('0x1d')];var _0x3b8842=_0x427a27?_0x8ee399[_0x82b9('0x20')]:_0x499200[_0x82b9('0x1d')]+_0x499200[_0x82b9('0x1e')];var _0x3a4af0;if(_0x3b8842>=_0x17acde){_0x3b8842=_0x17acde;_0x3a4af0=0xc8;}else{_0x3a4af0=0xce;}_0x5bed0d[_0x82b9('0x1b')](_0x3a4af0);return _0x5bed0d[_0x82b9('0x21')](_0x82b9('0x22'),_0x175467+'-'+_0x3b8842+'/'+_0x17acde)[_0x82b9('0x1c')](_0x8ee399);}return null;};}function patchUpdates(_0x49bffa){return function(_0x5381af){try{jsonpatch['apply'](_0x5381af,_0x49bffa,!![]);}catch(_0x2205c8){return BPromise[_0x82b9('0x23')](_0x2205c8);}return _0x5381af[_0x82b9('0x24')]();};}function saveUpdates(_0x17eb10,_0x2ed408){return function(_0x335aba){if(_0x335aba){return _0x335aba[_0x82b9('0x25')](_0x17eb10)[_0x82b9('0x26')](function(_0xe61d3a){return _0xe61d3a;});}return null;};}function removeEntity(_0x2873cb,_0x4fa1d4){return function(_0x18c4e7){if(_0x18c4e7){return _0x18c4e7[_0x82b9('0x27')]()[_0x82b9('0x26')](function(){_0x2873cb[_0x82b9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20026b,_0x1e5c9e){return function(_0x557f9e){if(!_0x557f9e){_0x20026b[_0x82b9('0x1a')](0x194);}return _0x557f9e;};}function handleError(_0x21663c,_0x3932f0){_0x3932f0=_0x3932f0||0x1f4;return function(_0x44fc61){logger['error'](_0x44fc61['stack']);if(_0x44fc61[_0x82b9('0x28')]){delete _0x44fc61[_0x82b9('0x28')];}_0x21663c['status'](_0x3932f0)[_0x82b9('0x29')](_0x44fc61);};}exports['index']=function(_0x4b6dab,_0x20f303){var _0x1fe5da={},_0x52397b={},_0x5cbefe={'count':0x0,'rows':[]};var _0x354645=_[_0x82b9('0x2a')](db[_0x82b9('0x2b')][_0x82b9('0x2c')],function(_0x29bc2a){return{'name':_0x29bc2a[_0x82b9('0x2d')],'type':_0x29bc2a[_0x82b9('0x2e')][_0x82b9('0x2f')]};});_0x52397b['model']=_['map'](_0x354645,'name');_0x52397b[_0x82b9('0x30')]=_[_0x82b9('0x31')](_0x4b6dab[_0x82b9('0x30')]);_0x52397b[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x52397b[_0x82b9('0x34')],_0x52397b['query']);_0x1fe5da[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x52397b[_0x82b9('0x34')],qs[_0x82b9('0x36')](_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x36')]));_0x1fe5da[_0x82b9('0x35')]=_0x1fe5da[_0x82b9('0x35')][_0x82b9('0x37')]?_0x1fe5da[_0x82b9('0x35')]:_0x52397b['model'];if(!_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x38')](_0x82b9('0x39'))){_0x1fe5da['limit']=qs[_0x82b9('0x1e')](_0x4b6dab['query'][_0x82b9('0x1e')]);_0x1fe5da[_0x82b9('0x1d')]=qs[_0x82b9('0x1d')](_0x4b6dab['query'][_0x82b9('0x1d')]);}_0x1fe5da[_0x82b9('0x3a')]=qs[_0x82b9('0x3b')](_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x3b')]);_0x1fe5da['where']=qs[_0x82b9('0x32')](_[_0x82b9('0x3c')](_0x4b6dab[_0x82b9('0x30')],_0x52397b[_0x82b9('0x32')]),_0x354645);if(_0x4b6dab['query']['filter']){_0x1fe5da[_0x82b9('0x3d')]=_[_0x82b9('0x3e')](_0x1fe5da[_0x82b9('0x3d')],{'$or':_[_0x82b9('0x2a')](_0x354645,function(_0x19c420){if(_0x19c420[_0x82b9('0x2e')]!==_0x82b9('0x3f')){var _0x35df9d={};_0x35df9d[_0x19c420[_0x82b9('0x28')]]={'$like':'%'+_0x4b6dab['query'][_0x82b9('0x40')]+'%'};return _0x35df9d;}})});}_0x1fe5da=_['merge']({},_0x1fe5da,_0x4b6dab[_0x82b9('0x41')]);var _0x251afa={'where':_0x1fe5da[_0x82b9('0x3d')]};return db[_0x82b9('0x2b')][_0x82b9('0x20')](_0x251afa)['then'](function(_0x229d1a){_0x5cbefe[_0x82b9('0x20')]=_0x229d1a;if(_0x4b6dab[_0x82b9('0x30')]['includeAll']){_0x1fe5da[_0x82b9('0x42')]=[{'all':!![]}];}return db[_0x82b9('0x2b')][_0x82b9('0x43')](_0x1fe5da);})['then'](function(_0x239b5f){_0x5cbefe[_0x82b9('0x44')]=_0x239b5f;return _0x5cbefe;})[_0x82b9('0x26')](respondWithFilteredResult(_0x20f303,_0x1fe5da))['catch'](handleError(_0x20f303,null));};exports[_0x82b9('0x45')]=function(_0x1b1d4c,_0xf7dab3){var _0x722ebd={'raw':![],'where':{'id':_0x1b1d4c[_0x82b9('0x46')]['id']}},_0x465ce2={};_0x465ce2[_0x82b9('0x34')]=_[_0x82b9('0x31')](db[_0x82b9('0x2b')]['rawAttributes']);_0x465ce2['query']=_[_0x82b9('0x31')](_0x1b1d4c[_0x82b9('0x30')]);_0x465ce2[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x465ce2[_0x82b9('0x34')],_0x465ce2[_0x82b9('0x30')]);_0x722ebd[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x465ce2['model'],qs['fields'](_0x1b1d4c['query'][_0x82b9('0x36')]));_0x722ebd[_0x82b9('0x35')]=_0x722ebd[_0x82b9('0x35')][_0x82b9('0x37')]?_0x722ebd[_0x82b9('0x35')]:_0x465ce2[_0x82b9('0x34')];if(_0x1b1d4c['query'][_0x82b9('0x47')]){_0x722ebd[_0x82b9('0x42')]=[{'all':!![]}];}_0x722ebd=_[_0x82b9('0x3e')]({},_0x722ebd,_0x1b1d4c['options']);return db['DeskAccount']['find'](_0x722ebd)[_0x82b9('0x26')](handleEntityNotFound(_0xf7dab3,null))[_0x82b9('0x26')](respondWithResult(_0xf7dab3,null))[_0x82b9('0x48')](handleError(_0xf7dab3,null));};exports[_0x82b9('0x49')]=function(_0x1ba33b,_0x377f38){return db['DeskAccount'][_0x82b9('0x49')](_0x1ba33b[_0x82b9('0x4a')],{})[_0x82b9('0x26')](respondWithResult(_0x377f38,0xc9))[_0x82b9('0x48')](handleError(_0x377f38,null));};exports[_0x82b9('0x25')]=function(_0x33c3c8,_0x4a7927){if(_0x33c3c8[_0x82b9('0x4a')]['id']){delete _0x33c3c8[_0x82b9('0x4a')]['id'];}return db['DeskAccount'][_0x82b9('0x4b')]({'where':{'id':_0x33c3c8['params']['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x4a7927,null))[_0x82b9('0x26')](saveUpdates(_0x33c3c8['body'],null))[_0x82b9('0x26')](respondWithResult(_0x4a7927,null))[_0x82b9('0x48')](handleError(_0x4a7927,null));};exports[_0x82b9('0x27')]=function(_0xc3afb0,_0x52b6db){return db[_0x82b9('0x2b')][_0x82b9('0x4b')]({'where':{'id':_0xc3afb0[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x52b6db,null))[_0x82b9('0x26')](removeEntity(_0x52b6db,null))['catch'](handleError(_0x52b6db,null));};exports[_0x82b9('0x4c')]=function(_0x451fe2,_0x414cd1,_0x15c611){var _0x31035a={};var _0x39dbe8={};var _0x3549bc;var _0x15e94a;return db[_0x82b9('0x2b')][_0x82b9('0x4d')]({'where':{'id':_0x451fe2[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x414cd1,null))[_0x82b9('0x26')](function(_0x2378dd){if(_0x2378dd){_0x3549bc=_0x2378dd;_0x39dbe8['model']=_[_0x82b9('0x31')](db['DeskConfiguration'][_0x82b9('0x2c')]);_0x39dbe8[_0x82b9('0x30')]=_['keys'](_0x451fe2[_0x82b9('0x30')]);_0x39dbe8[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x39dbe8[_0x82b9('0x34')],_0x39dbe8[_0x82b9('0x30')]);_0x31035a[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x39dbe8[_0x82b9('0x34')],qs['fields'](_0x451fe2[_0x82b9('0x30')][_0x82b9('0x36')]));_0x31035a[_0x82b9('0x35')]=_0x31035a[_0x82b9('0x35')][_0x82b9('0x37')]?_0x31035a[_0x82b9('0x35')]:_0x39dbe8[_0x82b9('0x34')];_0x31035a['order']=qs['sort'](_0x451fe2['query']['sort']);_0x31035a[_0x82b9('0x3d')]=qs[_0x82b9('0x32')](_[_0x82b9('0x3c')](_0x451fe2[_0x82b9('0x30')],_0x39dbe8['filters']));if(_0x451fe2[_0x82b9('0x30')][_0x82b9('0x40')]){_0x31035a[_0x82b9('0x3d')]=_[_0x82b9('0x3e')](_0x31035a[_0x82b9('0x3d')],{'$or':_[_0x82b9('0x2a')](_0x31035a[_0x82b9('0x35')],function(_0x556d8b){var _0x44d68c={};_0x44d68c[_0x556d8b]={'$like':'%'+_0x451fe2['query']['filter']+'%'};return _0x44d68c;})});}_0x31035a=_[_0x82b9('0x3e')]({},_0x31035a,_0x451fe2[_0x82b9('0x41')]);return _0x3549bc['getConfigurations'](_0x31035a);}})[_0x82b9('0x26')](function(_0x34afcc){if(_0x34afcc){_0x15e94a=_0x34afcc[_0x82b9('0x37')];if(!_0x451fe2[_0x82b9('0x30')]['hasOwnProperty']('nolimit')){_0x31035a[_0x82b9('0x1e')]=qs[_0x82b9('0x1e')](_0x451fe2['query']['limit']);_0x31035a[_0x82b9('0x1d')]=qs[_0x82b9('0x1d')](_0x451fe2['query'][_0x82b9('0x1d')]);}return _0x3549bc[_0x82b9('0x4c')](_0x31035a);}})['then'](function(_0x34b5ee){if(_0x34b5ee){return _0x34b5ee?{'count':_0x15e94a,'rows':_0x34b5ee}:null;}})['then'](respondWithResult(_0x414cd1,null))[_0x82b9('0x48')](handleError(_0x414cd1,null));};exports[_0x82b9('0x4e')]=function(_0x3824fe,_0xf4ff9,_0x92eafd){if(_0x3824fe[_0x82b9('0x4a')]['id']){delete _0x3824fe['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x3824fe[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0xf4ff9,null))['then'](function(_0x4a6418){if(_0x4a6418){_0x3824fe['body']['AccountId']=_0x4a6418['id'];_0x3824fe['body']['Subjects']=integrations['getSubjects'](_0x3824fe['body'][_0x82b9('0x4f')],_0x3824fe[_0x82b9('0x4a')]['type']);_0x3824fe['body'][_0x82b9('0x50')]=integrations[_0x82b9('0x51')](_0x3824fe[_0x82b9('0x4a')]['channel'],_0x3824fe['body'][_0x82b9('0x2e')]);return db[_0x82b9('0x52')]['create'](_0x3824fe[_0x82b9('0x4a')],{'include':[{'model':db['DeskField'],'as':_0x82b9('0x53')},{'model':db[_0x82b9('0x54')],'as':'Descriptions'}]});}return null;})[_0x82b9('0x26')](respondWithResult(_0xf4ff9,null))['catch'](handleError(_0xf4ff9,null));};exports[_0x82b9('0x55')]=function(_0xef88d1,_0x30d7e6,_0x1f4706){var _0x504ad6=[{'name':_0x82b9('0x56'),'label':_0x82b9('0x56'),'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 _0x23b273='';return db['DeskAccount'][_0x82b9('0x4d')]({'where':{'id':_0xef88d1[_0x82b9('0x46')]['id']},'attributes':['id',_0x82b9('0x57'),_0x82b9('0x58'),_0x82b9('0x59'),_0x82b9('0x5a'),_0x82b9('0x5b'),_0x82b9('0x5c'),_0x82b9('0x5d'),_0x82b9('0x5e')]})[_0x82b9('0x26')](handleEntityNotFound(_0x30d7e6,null))[_0x82b9('0x26')](function(_0x3a4afa){if(_0x3a4afa){_0x23b273=_0x3a4afa[_0x82b9('0x57')];var _0x43b0e5=_0x23b273['slice'](-0x1);if(_0x43b0e5==='/'){_0x23b273=_0x23b273[_0x82b9('0x5f')](0x0,_0x23b273[_0x82b9('0x60')](_0x43b0e5));}var _0x472cbe={'method':_0x82b9('0x61'),'uri':util['format'](_0x82b9('0x62'),_0x23b273),'headers':{'Content-Type':_0x82b9('0x63'),'Accept':'application/json'},'json':!![]};if(_0x3a4afa[_0x82b9('0x58')]===_0x82b9('0x64')){_0x472cbe['headers'][_0x82b9('0x65')]=util[_0x82b9('0x66')](_0x82b9('0x67'),new Buffer(util['format']('%s:%s',_0x3a4afa['username'],_0x3a4afa[_0x82b9('0x5a')]))[_0x82b9('0x68')]('base64'));}return rp(_0x472cbe)[_0x82b9('0x26')](function(_0xcf7b34){return _0x504ad6[_0x82b9('0x69')](_[_0x82b9('0x2a')](_0xcf7b34[_0x82b9('0x6a')][_0x82b9('0x6b')],function(_0x35178d){return{'id':_0x35178d[_0x82b9('0x28')],'name':_0x35178d[_0x82b9('0x28')],'type':_0x35178d[_0x82b9('0x2e')],'active':_0x35178d[_0x82b9('0x6c')],'label':_0x35178d[_0x82b9('0x6d')],'custom':!![]};}));});}})[_0x82b9('0x26')](function(_0x57e395){return{'count':_0x57e395[_0x82b9('0x37')],'rows':_0x57e395};})['then'](respondWithResult(_0x30d7e6,null))[_0x82b9('0x48')](function(_0x4d6a6e){var _0x5d8f41=_0xef88d1[_0x82b9('0x30')]['test']?0x1f4:_0x4d6a6e[_0x82b9('0x6e')]||0x1f4;logger[_0x82b9('0x6f')](_0x82b9('0x70'),_0x82b9('0x55'),_0x5d8f41,JSON[_0x82b9('0x71')](_0x4d6a6e));delete _0x4d6a6e[_0x82b9('0x28')];if(_0x5d8f41===0x191){_0x5d8f41=0x190;}_0x30d7e6[_0x82b9('0x1b')](_0x5d8f41)['send'](_0xef88d1['query'][_0x82b9('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x4d6a6e[_0x82b9('0x6e')]}:_0x4d6a6e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c6d5ce1..2dfdfca 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 _0x0e9c=['define','int_desk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports'];(function(_0x44f630,_0xcdd7f8){var _0x3633ef=function(_0x19d9d4){while(--_0x19d9d4){_0x44f630['push'](_0x44f630['shift']());}};_0x3633ef(++_0xcdd7f8);}(_0x0e9c,0x15e));var _0xc0e9=function(_0x10dfad,_0x1a7fca){_0x10dfad=_0x10dfad-0x0;var _0x5b2e1b=_0x0e9c[_0x10dfad];return _0x5b2e1b;};'use strict';var _=require('lodash');var util=require(_0xc0e9('0x0'));var logger=require(_0xc0e9('0x1'))(_0xc0e9('0x2'));var moment=require(_0xc0e9('0x3'));var BPromise=require(_0xc0e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0e9('0x5'));var rimraf=require(_0xc0e9('0x6'));var config=require(_0xc0e9('0x7'));var attributes=require(_0xc0e9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc0e9('0x9')]=function(_0x53a4f2,_0x5ad742){return _0x53a4f2[_0xc0e9('0xa')]('DeskAccount',attributes,{'tableName':_0xc0e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0abe=['../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x375fa3,_0x3d9e45){var _0x240dc7=function(_0x5e12cb){while(--_0x5e12cb){_0x375fa3['push'](_0x375fa3['shift']());}};_0x240dc7(++_0x3d9e45);}(_0x0abe,0x183));var _0xe0ab=function(_0x3e5da3,_0x100cbe){_0x3e5da3=_0x3e5da3-0x0;var _0x202bb6=_0x0abe[_0x3e5da3];return _0x202bb6;};'use strict';var _=require(_0xe0ab('0x0'));var util=require(_0xe0ab('0x1'));var logger=require(_0xe0ab('0x2'))(_0xe0ab('0x3'));var moment=require('moment');var BPromise=require(_0xe0ab('0x4'));var rp=require(_0xe0ab('0x5'));var fs=require('fs');var path=require(_0xe0ab('0x6'));var rimraf=require(_0xe0ab('0x7'));var config=require(_0xe0ab('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xe0ab('0x9'));module['exports']=function(_0x258c34,_0x2bb123){return _0x258c34[_0xe0ab('0xa')]('DeskAccount',attributes,{'tableName':_0xe0ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 59b1b07..6da41e3 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 _0x61b9=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','DeskAccount','findAll','options','limit','map','model','attributes','include','then','find','raw','where','ShowDeskAccount','catch','lodash','util','moment'];(function(_0x415169,_0x51bfdf){var _0x251beb=function(_0x296b27){while(--_0x296b27){_0x415169['push'](_0x415169['shift']());}};_0x251beb(++_0x51bfdf);}(_0x61b9,0x11d));var _0x961b=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x61b9[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0x961b('0x0'));var util=require(_0x961b('0x1'));var moment=require(_0x961b('0x2'));var BPromise=require('bluebird');var rs=require(_0x961b('0x3'));var fs=require('fs');var Redis=require(_0x961b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x961b('0x5'));var logger=require(_0x961b('0x6'))(_0x961b('0x7'));var config=require(_0x961b('0x8'));var jayson=require(_0x961b('0x9'));var client=jayson[_0x961b('0xa')][_0x961b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ec96,_0x5e2e68,_0x3c62d5){return new BPromise(function(_0xab0c3f,_0x128025){return client[_0x961b('0xc')](_0x11ec96,_0x3c62d5)['then'](function(_0xad664f){logger[_0x961b('0xd')](_0x961b('0xe'),_0x5e2e68,_0x961b('0xf'));logger['debug'](_0x961b('0x10'),_0x5e2e68,_0x961b('0xf'),JSON[_0x961b('0x11')](_0xad664f));if(_0xad664f[_0x961b('0x12')]){if(_0xad664f[_0x961b('0x12')]['code']===0x1f4){logger[_0x961b('0x12')]('DeskAccount,\x20%s,\x20%s',_0x5e2e68,_0xad664f['error'][_0x961b('0x13')]);return _0x128025(_0xad664f[_0x961b('0x12')][_0x961b('0x13')]);}logger[_0x961b('0x12')](_0x961b('0xe'),_0x5e2e68,_0xad664f[_0x961b('0x12')][_0x961b('0x13')]);return _0xab0c3f(_0xad664f[_0x961b('0x12')][_0x961b('0x13')]);}else{logger[_0x961b('0xd')](_0x961b('0xe'),_0x5e2e68,'request\x20sent');_0xab0c3f(_0xad664f[_0x961b('0x14')][_0x961b('0x13')]);}})['catch'](function(_0x2ddce4){logger[_0x961b('0x12')](_0x961b('0xe'),_0x5e2e68,_0x2ddce4);_0x128025(_0x2ddce4);});});}exports[_0x961b('0x15')]=function(_0x53dce7){var _0x4f5273=this;return new Promise(function(_0xfaa6e6,_0x12ac84){return db[_0x961b('0x16')][_0x961b('0x17')]({'raw':_0x53dce7[_0x961b('0x18')]?_0x53dce7[_0x961b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x53dce7['options']?_0x53dce7[_0x961b('0x18')]['where']||null:null,'attributes':_0x53dce7['options']?_0x53dce7[_0x961b('0x18')]['attributes']||null:null,'limit':_0x53dce7['options']?_0x53dce7[_0x961b('0x18')][_0x961b('0x19')]||null:null,'include':_0x53dce7[_0x961b('0x18')]?_0x53dce7['options']['include']?_[_0x961b('0x1a')](_0x53dce7[_0x961b('0x18')]['include'],function(_0x52eb64){return{'model':db[_0x52eb64[_0x961b('0x1b')]],'as':_0x52eb64['as'],'attributes':_0x52eb64[_0x961b('0x1c')],'include':_0x52eb64['include']?_[_0x961b('0x1a')](_0x52eb64['include'],function(_0x51685c){return{'model':db[_0x51685c[_0x961b('0x1b')]],'as':_0x51685c['as'],'attributes':_0x51685c[_0x961b('0x1c')],'include':_0x51685c[_0x961b('0x1d')]?_[_0x961b('0x1a')](_0x51685c[_0x961b('0x1d')],function(_0x23ddeb){return{'model':db[_0x23ddeb[_0x961b('0x1b')]],'as':_0x23ddeb['as'],'attributes':_0x23ddeb[_0x961b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x961b('0x1e')](function(_0x2224cc){logger['info'](_0x961b('0x15'),_0x53dce7);logger['debug'](_0x961b('0x15'),_0x53dce7,JSON[_0x961b('0x11')](_0x2224cc));_0xfaa6e6(_0x2224cc);})['catch'](function(_0x52bde4){logger[_0x961b('0x12')](_0x961b('0x15'),_0x52bde4[_0x961b('0x13')],_0x53dce7);_0x12ac84(_0x4f5273[_0x961b('0x12')](0x1f4,_0x52bde4['message']));});});};exports['ShowDeskAccount']=function(_0x427547){var _0x48d90c=this;return new Promise(function(_0x2a44fc,_0x170c16){return db[_0x961b('0x16')][_0x961b('0x1f')]({'raw':_0x427547[_0x961b('0x18')]?_0x427547[_0x961b('0x18')][_0x961b('0x20')]===undefined?!![]:![]:!![],'where':_0x427547[_0x961b('0x18')]?_0x427547['options'][_0x961b('0x21')]||null:null,'attributes':_0x427547[_0x961b('0x18')]?_0x427547['options'][_0x961b('0x1c')]||null:null,'include':_0x427547['options']?_0x427547['options']['include']?_[_0x961b('0x1a')](_0x427547[_0x961b('0x18')]['include'],function(_0x2a657c){return{'model':db[_0x2a657c[_0x961b('0x1b')]],'as':_0x2a657c['as'],'attributes':_0x2a657c[_0x961b('0x1c')],'include':_0x2a657c['include']?_[_0x961b('0x1a')](_0x2a657c[_0x961b('0x1d')],function(_0x43f002){return{'model':db[_0x43f002['model']],'as':_0x43f002['as'],'attributes':_0x43f002[_0x961b('0x1c')],'include':_0x43f002['include']?_[_0x961b('0x1a')](_0x43f002[_0x961b('0x1d')],function(_0x5b04de){return{'model':db[_0x5b04de['model']],'as':_0x5b04de['as'],'attributes':_0x5b04de[_0x961b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x961b('0x1e')](function(_0x430cbd){logger[_0x961b('0xd')]('ShowDeskAccount',_0x427547);logger['debug'](_0x961b('0x22'),_0x427547,JSON[_0x961b('0x11')](_0x430cbd));_0x2a44fc(_0x430cbd);})[_0x961b('0x23')](function(_0x2e8c74){logger[_0x961b('0x12')]('ShowDeskAccount',_0x2e8c74[_0x961b('0x13')],_0x427547);_0x170c16(_0x48d90c[_0x961b('0x12')](0x1f4,_0x2e8c74[_0x961b('0x13')]));});});}; \ No newline at end of file +var _0x76a0=['http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','model','raw','ShowDeskAccount','stringify','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0x76a0,0x1b8));var _0x076a=function(_0x15b298,_0x5bd763){_0x15b298=_0x15b298-0x0;var _0x301ee4=_0x76a0[_0x15b298];return _0x301ee4;};'use strict';var _=require(_0x076a('0x0'));var util=require('util');var moment=require(_0x076a('0x1'));var BPromise=require('bluebird');var rs=require(_0x076a('0x2'));var fs=require('fs');var Redis=require(_0x076a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x076a('0x4'));var logger=require('../../config/logger')(_0x076a('0x5'));var config=require(_0x076a('0x6'));var jayson=require(_0x076a('0x7'));var client=jayson['client'][_0x076a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1912a4,_0x458c75,_0xf598e4){return new BPromise(function(_0x4bd8dc,_0x76765){return client[_0x076a('0x9')](_0x1912a4,_0xf598e4)[_0x076a('0xa')](function(_0xc57bf0){logger['info'](_0x076a('0xb'),_0x458c75,_0x076a('0xc'));logger[_0x076a('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x458c75,_0x076a('0xc'),JSON['stringify'](_0xc57bf0));if(_0xc57bf0['error']){if(_0xc57bf0['error'][_0x076a('0xe')]===0x1f4){logger[_0x076a('0xf')](_0x076a('0xb'),_0x458c75,_0xc57bf0[_0x076a('0xf')]['message']);return _0x76765(_0xc57bf0[_0x076a('0xf')]['message']);}logger['error'](_0x076a('0xb'),_0x458c75,_0xc57bf0[_0x076a('0xf')][_0x076a('0x10')]);return _0x4bd8dc(_0xc57bf0[_0x076a('0xf')][_0x076a('0x10')]);}else{logger[_0x076a('0x11')](_0x076a('0xb'),_0x458c75,_0x076a('0xc'));_0x4bd8dc(_0xc57bf0[_0x076a('0x12')][_0x076a('0x10')]);}})[_0x076a('0x13')](function(_0x4ee4a8){logger['error'](_0x076a('0xb'),_0x458c75,_0x4ee4a8);_0x76765(_0x4ee4a8);});});}exports[_0x076a('0x14')]=function(_0x1f6719){var _0x1382ab=this;return new Promise(function(_0x11f76c,_0x438bc8){return db[_0x076a('0x15')][_0x076a('0x16')]({'raw':_0x1f6719['options']?_0x1f6719['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x18')]||null:null,'attributes':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x19')]||null:null,'limit':_0x1f6719[_0x076a('0x17')]?_0x1f6719['options']['limit']||null:null,'include':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x1f6719['options']['include'],function(_0xf4d5b7){return{'model':db[_0xf4d5b7[_0x076a('0x1c')]],'as':_0xf4d5b7['as'],'attributes':_0xf4d5b7[_0x076a('0x19')],'include':_0xf4d5b7['include']?_[_0x076a('0x1b')](_0xf4d5b7[_0x076a('0x1a')],function(_0x488142){return{'model':db[_0x488142[_0x076a('0x1c')]],'as':_0x488142['as'],'attributes':_0x488142[_0x076a('0x19')],'include':_0x488142[_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x488142[_0x076a('0x1a')],function(_0x530ccf){return{'model':db[_0x530ccf[_0x076a('0x1c')]],'as':_0x530ccf['as'],'attributes':_0x530ccf[_0x076a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x076a('0xa')](function(_0x2dde70){logger[_0x076a('0x11')](_0x076a('0x14'),_0x1f6719);logger[_0x076a('0xd')](_0x076a('0x14'),_0x1f6719,JSON['stringify'](_0x2dde70));_0x11f76c(_0x2dde70);})['catch'](function(_0x3e9999){logger[_0x076a('0xf')](_0x076a('0x14'),_0x3e9999[_0x076a('0x10')],_0x1f6719);_0x438bc8(_0x1382ab['error'](0x1f4,_0x3e9999[_0x076a('0x10')]));});});};exports['ShowDeskAccount']=function(_0x382cb3){var _0x3b82a7=this;return new Promise(function(_0x2ca386,_0x179ec8){return db[_0x076a('0x15')]['find']({'raw':_0x382cb3[_0x076a('0x17')]?_0x382cb3[_0x076a('0x17')][_0x076a('0x1d')]===undefined?!![]:![]:!![],'where':_0x382cb3['options']?_0x382cb3[_0x076a('0x17')][_0x076a('0x18')]||null:null,'attributes':_0x382cb3[_0x076a('0x17')]?_0x382cb3['options'][_0x076a('0x19')]||null:null,'include':_0x382cb3[_0x076a('0x17')]?_0x382cb3[_0x076a('0x17')][_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x382cb3[_0x076a('0x17')]['include'],function(_0x36170a){return{'model':db[_0x36170a[_0x076a('0x1c')]],'as':_0x36170a['as'],'attributes':_0x36170a[_0x076a('0x19')],'include':_0x36170a[_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x36170a['include'],function(_0x3d7ef9){return{'model':db[_0x3d7ef9[_0x076a('0x1c')]],'as':_0x3d7ef9['as'],'attributes':_0x3d7ef9[_0x076a('0x19')],'include':_0x3d7ef9[_0x076a('0x1a')]?_['map'](_0x3d7ef9[_0x076a('0x1a')],function(_0x550ded){return{'model':db[_0x550ded['model']],'as':_0x550ded['as'],'attributes':_0x550ded[_0x076a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x076a('0xa')](function(_0xcb579d){logger[_0x076a('0x11')](_0x076a('0x1e'),_0x382cb3);logger[_0x076a('0xd')](_0x076a('0x1e'),_0x382cb3,JSON[_0x076a('0x1f')](_0xcb579d));_0x2ca386(_0xcb579d);})[_0x076a('0x13')](function(_0x3da5c0){logger[_0x076a('0xf')](_0x076a('0x1e'),_0x3da5c0[_0x076a('0x10')],_0x382cb3);_0x179ec8(_0x3b82a7[_0x076a('0xf')](0x1f4,_0x3da5c0[_0x076a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7ed6fc2..8b657d7 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x4d1196,_0x519581){var _0x29e980=function(_0x16c498){while(--_0x16c498){_0x4d1196['push'](_0x4d1196['shift']());}};_0x29e980(++_0x519581);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f75a2,_0x27c50c){_0x4f75a2=_0x4f75a2-0x0;var _0x14d1d1=_0xedd9[_0x4f75a2];return _0x14d1d1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ca8c9,_0x43013e){var _0x340c7a=function(_0x161419){while(--_0x161419){_0x3ca8c9['push'](_0x3ca8c9['shift']());}};_0x340c7a(++_0x43013e);}(_0x34e8,0x12c));var _0x834e=function(_0x30b440,_0x41eeab){_0x30b440=_0x30b440-0x0;var _0x2c1d22=_0x34e8[_0x30b440];return _0x2c1d22;};'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('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4bda121..d358c4e 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 _0x79a3=['sequelize','exports','STRING'];(function(_0x4ad9a2,_0x583242){var _0xdd8c04=function(_0x54ef46){while(--_0x54ef46){_0x4ad9a2['push'](_0x4ad9a2['shift']());}};_0xdd8c04(++_0x583242);}(_0x79a3,0x1bf));var _0x379a=function(_0x10192c,_0x53b4b9){_0x10192c=_0x10192c-0x0;var _0x1f996a=_0x79a3[_0x10192c];return _0x1f996a;};'use strict';var Sequelize=require(_0x379a('0x0'));module[_0x379a('0x1')]={'name':{'type':Sequelize[_0x379a('0x2')]},'description':{'type':Sequelize[_0x379a('0x2')]}}; \ No newline at end of file +var _0xe630=['STRING','sequelize'];(function(_0x2af3e6,_0x22aee5){var _0x37ca36=function(_0x2a01a1){while(--_0x2a01a1){_0x2af3e6['push'](_0x2af3e6['shift']());}};_0x37ca36(++_0x22aee5);}(_0xe630,0x1a5));var _0x0e63=function(_0x5c7d4b,_0x305110){_0x5c7d4b=_0x5c7d4b-0x0;var _0x422e90=_0xe630[_0x5c7d4b];return _0x422e90;};'use strict';var Sequelize=require(_0x0e63('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e63('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3119a31..4d92a27 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 _0xaa82=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','sendStatus','error','name','send','index','map','DeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','DeskField','options','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xaa82,0x1cb));var _0x2aa8=function(_0x4839e9,_0x2b12d5){_0x4839e9=_0x4839e9-0x0;var _0x361d81=_0xaa82[_0x4839e9];return _0x361d81;};'use strict';var emlformat=require(_0x2aa8('0x0'));var rimraf=require(_0x2aa8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2aa8('0x2'));var rp=require(_0x2aa8('0x3'));var moment=require(_0x2aa8('0x4'));var BPromise=require(_0x2aa8('0x5'));var Mustache=require(_0x2aa8('0x6'));var util=require(_0x2aa8('0x7'));var path=require('path');var sox=require(_0x2aa8('0x8'));var csv=require(_0x2aa8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2aa8('0xa'));var _=require(_0x2aa8('0xb'));var squel=require(_0x2aa8('0xc'));var crypto=require('crypto');var jsforce=require(_0x2aa8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2aa8('0x9'));var querystring=require(_0x2aa8('0xe'));var Papa=require('papaparse');var Redis=require(_0x2aa8('0xf'));var authService=require(_0x2aa8('0x10'));var qs=require(_0x2aa8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2aa8('0x12'));var logger=require(_0x2aa8('0x13'))(_0x2aa8('0x14'));var utils=require(_0x2aa8('0x15'));var config=require(_0x2aa8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x232c4d,_0x5047f1){_0x5047f1=_0x5047f1||0xcc;return function(_0x17e026){if(_0x17e026){return _0x232c4d['sendStatus'](_0x5047f1);}return _0x232c4d['status'](_0x5047f1)[_0x2aa8('0x17')]();};}function respondWithResult(_0x3ba354,_0x20ba6d){_0x20ba6d=_0x20ba6d||0xc8;return function(_0x29b0ec){if(_0x29b0ec){return _0x3ba354[_0x2aa8('0x18')](_0x20ba6d)[_0x2aa8('0x19')](_0x29b0ec);}};}function respondWithFilteredResult(_0x221631,_0x62ac3e){return function(_0x3e67f4){if(_0x3e67f4){var _0x4b2c9e=typeof _0x62ac3e[_0x2aa8('0x1a')]===_0x2aa8('0x1b')&&typeof _0x62ac3e[_0x2aa8('0x1c')]===_0x2aa8('0x1b');var _0x3114c7=_0x3e67f4[_0x2aa8('0x1d')];var _0x528108=_0x4b2c9e?0x0:_0x62ac3e['offset'];var _0x415e7a=_0x4b2c9e?_0x3e67f4[_0x2aa8('0x1d')]:_0x62ac3e[_0x2aa8('0x1a')]+_0x62ac3e[_0x2aa8('0x1c')];var _0x166b7;if(_0x415e7a>=_0x3114c7){_0x415e7a=_0x3114c7;_0x166b7=0xc8;}else{_0x166b7=0xce;}_0x221631[_0x2aa8('0x18')](_0x166b7);return _0x221631['set'](_0x2aa8('0x1e'),_0x528108+'-'+_0x415e7a+'/'+_0x3114c7)[_0x2aa8('0x19')](_0x3e67f4);}return null;};}function patchUpdates(_0x499ac4){return function(_0x414516){try{jsonpatch[_0x2aa8('0x1f')](_0x414516,_0x499ac4,!![]);}catch(_0x3cdd1b){return BPromise['reject'](_0x3cdd1b);}return _0x414516[_0x2aa8('0x20')]();};}function saveUpdates(_0x3ecb71,_0xcb3796){return function(_0x19a61b){if(_0x19a61b){return _0x19a61b[_0x2aa8('0x21')](_0x3ecb71)[_0x2aa8('0x22')](function(_0x126949){return _0x126949;});}return null;};}function removeEntity(_0x5bc656,_0xb91a4f){return function(_0x5167fc){if(_0x5167fc){return _0x5167fc['destroy']()[_0x2aa8('0x22')](function(){_0x5bc656[_0x2aa8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d86f2,_0x4a0caf){return function(_0x42b51b){if(!_0x42b51b){_0x3d86f2[_0x2aa8('0x23')](0x194);}return _0x42b51b;};}function handleError(_0x39c5e6,_0x2a9714){_0x2a9714=_0x2a9714||0x1f4;return function(_0x34fdd8){logger[_0x2aa8('0x24')](_0x34fdd8['stack']);if(_0x34fdd8['name']){delete _0x34fdd8[_0x2aa8('0x25')];}_0x39c5e6[_0x2aa8('0x18')](_0x2a9714)[_0x2aa8('0x26')](_0x34fdd8);};}exports[_0x2aa8('0x27')]=function(_0x3b30a0,_0x550f54){var _0x538da7={},_0x5d4316={},_0x34ba4b={'count':0x0,'rows':[]};var _0x4b9df3=_[_0x2aa8('0x28')](db[_0x2aa8('0x29')][_0x2aa8('0x2a')],function(_0x383742){return{'name':_0x383742['fieldName'],'type':_0x383742[_0x2aa8('0x2b')][_0x2aa8('0x2c')]};});_0x5d4316['model']=_['map'](_0x4b9df3,_0x2aa8('0x25'));_0x5d4316[_0x2aa8('0x2d')]=_[_0x2aa8('0x2e')](_0x3b30a0[_0x2aa8('0x2d')]);_0x5d4316[_0x2aa8('0x2f')]=_[_0x2aa8('0x30')](_0x5d4316['model'],_0x5d4316['query']);_0x538da7[_0x2aa8('0x31')]=_[_0x2aa8('0x30')](_0x5d4316[_0x2aa8('0x32')],qs[_0x2aa8('0x33')](_0x3b30a0[_0x2aa8('0x2d')]['fields']));_0x538da7['attributes']=_0x538da7[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x538da7[_0x2aa8('0x31')]:_0x5d4316[_0x2aa8('0x32')];if(!_0x3b30a0[_0x2aa8('0x2d')][_0x2aa8('0x35')](_0x2aa8('0x36'))){_0x538da7['limit']=qs[_0x2aa8('0x1c')](_0x3b30a0[_0x2aa8('0x2d')][_0x2aa8('0x1c')]);_0x538da7['offset']=qs[_0x2aa8('0x1a')](_0x3b30a0['query'][_0x2aa8('0x1a')]);}_0x538da7[_0x2aa8('0x37')]=qs[_0x2aa8('0x38')](_0x3b30a0[_0x2aa8('0x2d')][_0x2aa8('0x38')]);_0x538da7['where']=qs['filters'](_[_0x2aa8('0x39')](_0x3b30a0[_0x2aa8('0x2d')],_0x5d4316['filters']),_0x4b9df3);if(_0x3b30a0['query'][_0x2aa8('0x3a')]){_0x538da7['where']=_[_0x2aa8('0x3b')](_0x538da7[_0x2aa8('0x3c')],{'$or':_[_0x2aa8('0x28')](_0x4b9df3,function(_0x1a1fa9){if(_0x1a1fa9[_0x2aa8('0x2b')]!==_0x2aa8('0x3d')){var _0x3298ce={};_0x3298ce[_0x1a1fa9['name']]={'$like':'%'+_0x3b30a0[_0x2aa8('0x2d')]['filter']+'%'};return _0x3298ce;}})});}_0x538da7=_[_0x2aa8('0x3b')]({},_0x538da7,_0x3b30a0['options']);var _0x157b36={'where':_0x538da7[_0x2aa8('0x3c')]};return db[_0x2aa8('0x29')][_0x2aa8('0x1d')](_0x157b36)['then'](function(_0x419387){_0x34ba4b[_0x2aa8('0x1d')]=_0x419387;if(_0x3b30a0['query'][_0x2aa8('0x3e')]){_0x538da7[_0x2aa8('0x3f')]=[{'all':!![]}];}return db[_0x2aa8('0x29')][_0x2aa8('0x40')](_0x538da7);})['then'](function(_0x145366){_0x34ba4b['rows']=_0x145366;return _0x34ba4b;})[_0x2aa8('0x22')](respondWithFilteredResult(_0x550f54,_0x538da7))[_0x2aa8('0x41')](handleError(_0x550f54,null));};exports['show']=function(_0x4e9fd9,_0x375feb){var _0x564587={'raw':![],'where':{'id':_0x4e9fd9[_0x2aa8('0x42')]['id']}},_0x52baee={};_0x52baee[_0x2aa8('0x32')]=_[_0x2aa8('0x2e')](db[_0x2aa8('0x29')][_0x2aa8('0x2a')]);_0x52baee[_0x2aa8('0x2d')]=_[_0x2aa8('0x2e')](_0x4e9fd9[_0x2aa8('0x2d')]);_0x52baee['filters']=_[_0x2aa8('0x30')](_0x52baee[_0x2aa8('0x32')],_0x52baee[_0x2aa8('0x2d')]);_0x564587[_0x2aa8('0x31')]=_[_0x2aa8('0x30')](_0x52baee[_0x2aa8('0x32')],qs[_0x2aa8('0x33')](_0x4e9fd9[_0x2aa8('0x2d')][_0x2aa8('0x33')]));_0x564587[_0x2aa8('0x31')]=_0x564587[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x564587[_0x2aa8('0x31')]:_0x52baee['model'];if(_0x4e9fd9[_0x2aa8('0x2d')][_0x2aa8('0x3e')]){_0x564587[_0x2aa8('0x3f')]=[{'all':!![]}];}_0x564587=_[_0x2aa8('0x3b')]({},_0x564587,_0x4e9fd9['options']);return db[_0x2aa8('0x29')][_0x2aa8('0x43')](_0x564587)['then'](handleEntityNotFound(_0x375feb,null))[_0x2aa8('0x22')](respondWithResult(_0x375feb,null))[_0x2aa8('0x41')](handleError(_0x375feb,null));};exports[_0x2aa8('0x44')]=function(_0x571154,_0x127cb6){return db[_0x2aa8('0x29')][_0x2aa8('0x44')](_0x571154[_0x2aa8('0x45')],{})[_0x2aa8('0x22')](respondWithResult(_0x127cb6,0xc9))[_0x2aa8('0x41')](handleError(_0x127cb6,null));};exports[_0x2aa8('0x21')]=function(_0x1e6b77,_0x2259a6){if(_0x1e6b77[_0x2aa8('0x45')]['id']){delete _0x1e6b77[_0x2aa8('0x45')]['id'];}return db[_0x2aa8('0x29')]['find']({'where':{'id':_0x1e6b77[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x2259a6,null))[_0x2aa8('0x22')](saveUpdates(_0x1e6b77[_0x2aa8('0x45')],null))['then'](respondWithResult(_0x2259a6,null))['catch'](handleError(_0x2259a6,null));};exports['destroy']=function(_0x2325f6,_0x49338d){return db[_0x2aa8('0x29')][_0x2aa8('0x43')]({'where':{'id':_0x2325f6['params']['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x49338d,null))[_0x2aa8('0x22')](removeEntity(_0x49338d,null))[_0x2aa8('0x41')](handleError(_0x49338d,null));};exports[_0x2aa8('0x46')]=function(_0x430f1f,_0x7a4cbc,_0x1c31f1){var _0x2598f8={};var _0x51dc12={};var _0x53e9dc;var _0x1bf166;return db[_0x2aa8('0x29')][_0x2aa8('0x47')]({'where':{'id':_0x430f1f[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x7a4cbc,null))[_0x2aa8('0x22')](function(_0x36662a){if(_0x36662a){_0x53e9dc=_0x36662a;_0x51dc12[_0x2aa8('0x32')]=_['keys'](db[_0x2aa8('0x48')][_0x2aa8('0x2a')]);_0x51dc12['query']=_['keys'](_0x430f1f[_0x2aa8('0x2d')]);_0x51dc12[_0x2aa8('0x2f')]=_[_0x2aa8('0x30')](_0x51dc12[_0x2aa8('0x32')],_0x51dc12[_0x2aa8('0x2d')]);_0x2598f8['attributes']=_[_0x2aa8('0x30')](_0x51dc12['model'],qs[_0x2aa8('0x33')](_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x33')]));_0x2598f8[_0x2aa8('0x31')]=_0x2598f8[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x2598f8[_0x2aa8('0x31')]:_0x51dc12['model'];_0x2598f8[_0x2aa8('0x37')]=qs[_0x2aa8('0x38')](_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x38')]);_0x2598f8['where']=qs[_0x2aa8('0x2f')](_[_0x2aa8('0x39')](_0x430f1f['query'],_0x51dc12[_0x2aa8('0x2f')]));if(_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x3a')]){_0x2598f8[_0x2aa8('0x3c')]=_[_0x2aa8('0x3b')](_0x2598f8[_0x2aa8('0x3c')],{'$or':_[_0x2aa8('0x28')](_0x2598f8['attributes'],function(_0x20fbde){var _0x4e5b7d={};_0x4e5b7d[_0x20fbde]={'$like':'%'+_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x3a')]+'%'};return _0x4e5b7d;})});}_0x2598f8=_[_0x2aa8('0x3b')]({},_0x2598f8,_0x430f1f[_0x2aa8('0x49')]);return _0x53e9dc[_0x2aa8('0x46')](_0x2598f8);}})[_0x2aa8('0x22')](function(_0x4f4c02){if(_0x4f4c02){_0x1bf166=_0x4f4c02[_0x2aa8('0x34')];if(!_0x430f1f['query'][_0x2aa8('0x35')](_0x2aa8('0x36'))){_0x2598f8[_0x2aa8('0x1c')]=qs[_0x2aa8('0x1c')](_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x1c')]);_0x2598f8[_0x2aa8('0x1a')]=qs[_0x2aa8('0x1a')](_0x430f1f[_0x2aa8('0x2d')][_0x2aa8('0x1a')]);}return _0x53e9dc[_0x2aa8('0x46')](_0x2598f8);}})['then'](function(_0x120771){if(_0x120771){return _0x120771?{'count':_0x1bf166,'rows':_0x120771}:null;}})[_0x2aa8('0x22')](respondWithResult(_0x7a4cbc,null))['catch'](handleError(_0x7a4cbc,null));};exports[_0x2aa8('0x4a')]=function(_0x2f2804,_0x5cb981,_0x1ca9dc){var _0x4d0259={};var _0xc9b033={};var _0x294c92;var _0x5754ed;return db[_0x2aa8('0x29')][_0x2aa8('0x47')]({'where':{'id':_0x2f2804[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x5cb981,null))['then'](function(_0x3a1ab6){if(_0x3a1ab6){_0x294c92=_0x3a1ab6;_0xc9b033[_0x2aa8('0x32')]=_[_0x2aa8('0x2e')](db[_0x2aa8('0x48')]['rawAttributes']);_0xc9b033[_0x2aa8('0x2d')]=_[_0x2aa8('0x2e')](_0x2f2804[_0x2aa8('0x2d')]);_0xc9b033[_0x2aa8('0x2f')]=_[_0x2aa8('0x30')](_0xc9b033[_0x2aa8('0x32')],_0xc9b033[_0x2aa8('0x2d')]);_0x4d0259['attributes']=_[_0x2aa8('0x30')](_0xc9b033[_0x2aa8('0x32')],qs['fields'](_0x2f2804[_0x2aa8('0x2d')]['fields']));_0x4d0259['attributes']=_0x4d0259[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x4d0259[_0x2aa8('0x31')]:_0xc9b033[_0x2aa8('0x32')];_0x4d0259[_0x2aa8('0x37')]=qs[_0x2aa8('0x38')](_0x2f2804[_0x2aa8('0x2d')][_0x2aa8('0x38')]);_0x4d0259[_0x2aa8('0x3c')]=qs['filters'](_[_0x2aa8('0x39')](_0x2f2804['query'],_0xc9b033[_0x2aa8('0x2f')]));if(_0x2f2804['query'][_0x2aa8('0x3a')]){_0x4d0259[_0x2aa8('0x3c')]=_[_0x2aa8('0x3b')](_0x4d0259[_0x2aa8('0x3c')],{'$or':_[_0x2aa8('0x28')](_0x4d0259[_0x2aa8('0x31')],function(_0x38a7b0){var _0x30fa15={};_0x30fa15[_0x38a7b0]={'$like':'%'+_0x2f2804[_0x2aa8('0x2d')][_0x2aa8('0x3a')]+'%'};return _0x30fa15;})});}_0x4d0259=_[_0x2aa8('0x3b')]({},_0x4d0259,_0x2f2804[_0x2aa8('0x49')]);return _0x294c92[_0x2aa8('0x4a')](_0x4d0259);}})['then'](function(_0x13d566){if(_0x13d566){_0x5754ed=_0x13d566[_0x2aa8('0x34')];if(!_0x2f2804['query']['hasOwnProperty'](_0x2aa8('0x36'))){_0x4d0259[_0x2aa8('0x1c')]=qs['limit'](_0x2f2804['query'][_0x2aa8('0x1c')]);_0x4d0259['offset']=qs[_0x2aa8('0x1a')](_0x2f2804[_0x2aa8('0x2d')]['offset']);}return _0x294c92['getSubjects'](_0x4d0259);}})['then'](function(_0x59b57d){if(_0x59b57d){return _0x59b57d?{'count':_0x5754ed,'rows':_0x59b57d}:null;}})[_0x2aa8('0x22')](respondWithResult(_0x5cb981,null))[_0x2aa8('0x41')](handleError(_0x5cb981,null));};exports[_0x2aa8('0x4b')]=function(_0x44223d,_0x4f7fef,_0x2b65e2){var _0x513d2a={};var _0x4fdd1e={};var _0x4f8801;var _0x131114;return db[_0x2aa8('0x29')][_0x2aa8('0x47')]({'where':{'id':_0x44223d[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x4f7fef,null))['then'](function(_0x4ea23b){if(_0x4ea23b){_0x4f8801=_0x4ea23b;_0x4fdd1e[_0x2aa8('0x32')]=_[_0x2aa8('0x2e')](db[_0x2aa8('0x48')]['rawAttributes']);_0x4fdd1e['query']=_[_0x2aa8('0x2e')](_0x44223d['query']);_0x4fdd1e['filters']=_['intersection'](_0x4fdd1e[_0x2aa8('0x32')],_0x4fdd1e[_0x2aa8('0x2d')]);_0x513d2a['attributes']=_[_0x2aa8('0x30')](_0x4fdd1e[_0x2aa8('0x32')],qs['fields'](_0x44223d[_0x2aa8('0x2d')][_0x2aa8('0x33')]));_0x513d2a['attributes']=_0x513d2a[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x513d2a[_0x2aa8('0x31')]:_0x4fdd1e[_0x2aa8('0x32')];_0x513d2a[_0x2aa8('0x37')]=qs['sort'](_0x44223d['query'][_0x2aa8('0x38')]);_0x513d2a['where']=qs[_0x2aa8('0x2f')](_[_0x2aa8('0x39')](_0x44223d[_0x2aa8('0x2d')],_0x4fdd1e[_0x2aa8('0x2f')]));if(_0x44223d[_0x2aa8('0x2d')][_0x2aa8('0x3a')]){_0x513d2a['where']=_[_0x2aa8('0x3b')](_0x513d2a[_0x2aa8('0x3c')],{'$or':_[_0x2aa8('0x28')](_0x513d2a['attributes'],function(_0x40dac0){var _0x2aae7e={};_0x2aae7e[_0x40dac0]={'$like':'%'+_0x44223d[_0x2aa8('0x2d')][_0x2aa8('0x3a')]+'%'};return _0x2aae7e;})});}_0x513d2a=_[_0x2aa8('0x3b')]({},_0x513d2a,_0x44223d[_0x2aa8('0x49')]);return _0x4f8801['getDescriptions'](_0x513d2a);}})[_0x2aa8('0x22')](function(_0x4f510a){if(_0x4f510a){_0x131114=_0x4f510a[_0x2aa8('0x34')];if(!_0x44223d['query'][_0x2aa8('0x35')](_0x2aa8('0x36'))){_0x513d2a[_0x2aa8('0x1c')]=qs[_0x2aa8('0x1c')](_0x44223d[_0x2aa8('0x2d')][_0x2aa8('0x1c')]);_0x513d2a[_0x2aa8('0x1a')]=qs[_0x2aa8('0x1a')](_0x44223d[_0x2aa8('0x2d')]['offset']);}return _0x4f8801[_0x2aa8('0x4b')](_0x513d2a);}})[_0x2aa8('0x22')](function(_0x4f68b4){if(_0x4f68b4){return _0x4f68b4?{'count':_0x131114,'rows':_0x4f68b4}:null;}})['then'](respondWithResult(_0x4f7fef,null))[_0x2aa8('0x41')](handleError(_0x4f7fef,null));};exports[_0x2aa8('0x4c')]=function(_0x12a1bb,_0x451997,_0x455656){var _0x400bb5={};var _0x126847={};var _0x1887e7;var _0x3e1f08;return db[_0x2aa8('0x29')][_0x2aa8('0x47')]({'where':{'id':_0x12a1bb[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x451997,null))[_0x2aa8('0x22')](function(_0x4b9e50){if(_0x4b9e50){_0x1887e7=_0x4b9e50;_0x126847[_0x2aa8('0x32')]=_['keys'](db['Tag'][_0x2aa8('0x2a')]);_0x126847[_0x2aa8('0x2d')]=_[_0x2aa8('0x2e')](_0x12a1bb['query']);_0x126847[_0x2aa8('0x2f')]=_[_0x2aa8('0x30')](_0x126847[_0x2aa8('0x32')],_0x126847[_0x2aa8('0x2d')]);_0x400bb5[_0x2aa8('0x31')]=_['intersection'](_0x126847['model'],qs[_0x2aa8('0x33')](_0x12a1bb[_0x2aa8('0x2d')][_0x2aa8('0x33')]));_0x400bb5[_0x2aa8('0x31')]=_0x400bb5[_0x2aa8('0x31')][_0x2aa8('0x34')]?_0x400bb5[_0x2aa8('0x31')]:_0x126847[_0x2aa8('0x32')];_0x400bb5['order']=qs[_0x2aa8('0x38')](_0x12a1bb[_0x2aa8('0x2d')][_0x2aa8('0x38')]);_0x400bb5[_0x2aa8('0x3c')]=qs[_0x2aa8('0x2f')](_[_0x2aa8('0x39')](_0x12a1bb[_0x2aa8('0x2d')],_0x126847[_0x2aa8('0x2f')]));if(_0x12a1bb[_0x2aa8('0x2d')]['filter']){_0x400bb5['where']=_['merge'](_0x400bb5[_0x2aa8('0x3c')],{'$or':_[_0x2aa8('0x28')](_0x400bb5[_0x2aa8('0x31')],function(_0x26a775){var _0x45fb9f={};_0x45fb9f[_0x26a775]={'$like':'%'+_0x12a1bb['query'][_0x2aa8('0x3a')]+'%'};return _0x45fb9f;})});}_0x400bb5=_[_0x2aa8('0x3b')]({},_0x400bb5,_0x12a1bb[_0x2aa8('0x49')]);return _0x1887e7[_0x2aa8('0x4c')](_0x400bb5);}})[_0x2aa8('0x22')](function(_0xe69526){if(_0xe69526){_0x3e1f08=_0xe69526[_0x2aa8('0x34')];if(!_0x12a1bb['query']['hasOwnProperty']('nolimit')){_0x400bb5[_0x2aa8('0x1c')]=qs[_0x2aa8('0x1c')](_0x12a1bb[_0x2aa8('0x2d')][_0x2aa8('0x1c')]);_0x400bb5['offset']=qs[_0x2aa8('0x1a')](_0x12a1bb['query'][_0x2aa8('0x1a')]);}return _0x1887e7[_0x2aa8('0x4c')](_0x400bb5);}})['then'](function(_0x2f1009){if(_0x2f1009){return _0x2f1009?{'count':_0x3e1f08,'rows':_0x2f1009}:null;}})[_0x2aa8('0x22')](respondWithResult(_0x451997,null))['catch'](handleError(_0x451997,null));};exports[_0x2aa8('0x4d')]=function(_0x5013b0,_0x3e8774,_0x5ab917){if(_0x5013b0[_0x2aa8('0x45')]['id']){delete _0x5013b0[_0x2aa8('0x45')]['id'];}return db[_0x2aa8('0x29')][_0x2aa8('0x47')]({'where':{'id':_0x5013b0[_0x2aa8('0x42')]['id']}})[_0x2aa8('0x22')](handleEntityNotFound(_0x3e8774,null))[_0x2aa8('0x22')](function(_0x348fa5){if(_0x348fa5){return _0x348fa5[_0x2aa8('0x4d')](_0x5013b0['body'][_0x2aa8('0x4e')]||[]);}return null;})[_0x2aa8('0x22')](respondWithResult(_0x3e8774,null))['catch'](handleError(_0x3e8774,null));}; \ No newline at end of file +var _0x714c=['DeskConfiguration','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0x714c,0x123));var _0xc714=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0x714c[_0xefb4e];return _0x36c78c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc714('0x0'));var jsonpatch=require(_0xc714('0x1'));var rp=require(_0xc714('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc714('0x3'));var util=require(_0xc714('0x4'));var path=require(_0xc714('0x5'));var sox=require(_0xc714('0x6'));var csv=require(_0xc714('0x7'));var ejs=require(_0xc714('0x8'));var fs=require('fs');var fs_extra=require(_0xc714('0x9'));var _=require(_0xc714('0xa'));var squel=require('squel');var crypto=require(_0xc714('0xb'));var jsforce=require(_0xc714('0xc'));var deskjs=require(_0xc714('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc714('0xe'));var Papa=require(_0xc714('0xf'));var Redis=require(_0xc714('0x10'));var authService=require(_0xc714('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc714('0x12'));var hardwareService=require(_0xc714('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc714('0x14'));var config=require(_0xc714('0x15'));var licenseUtil=require(_0xc714('0x16'));var db=require(_0xc714('0x17'))['db'];function respondWithStatusCode(_0x410ef5,_0x3089f5){_0x3089f5=_0x3089f5||0xcc;return function(_0x53b1d2){if(_0x53b1d2){return _0x410ef5['sendStatus'](_0x3089f5);}return _0x410ef5['status'](_0x3089f5)[_0xc714('0x18')]();};}function respondWithResult(_0x567591,_0xd170f5){_0xd170f5=_0xd170f5||0xc8;return function(_0x4f6a6f){if(_0x4f6a6f){return _0x567591['status'](_0xd170f5)[_0xc714('0x19')](_0x4f6a6f);}};}function respondWithFilteredResult(_0x2f31da,_0x41e8ca){return function(_0x407948){if(_0x407948){var _0xdaf234=typeof _0x41e8ca['offset']===_0xc714('0x1a')&&typeof _0x41e8ca[_0xc714('0x1b')]===_0xc714('0x1a');var _0xb40869=_0x407948[_0xc714('0x1c')];var _0x5a3f57=_0xdaf234?0x0:_0x41e8ca[_0xc714('0x1d')];var _0x4d4697=_0xdaf234?_0x407948[_0xc714('0x1c')]:_0x41e8ca[_0xc714('0x1d')]+_0x41e8ca[_0xc714('0x1b')];var _0x35dfb0;if(_0x4d4697>=_0xb40869){_0x4d4697=_0xb40869;_0x35dfb0=0xc8;}else{_0x35dfb0=0xce;}_0x2f31da[_0xc714('0x1e')](_0x35dfb0);return _0x2f31da[_0xc714('0x1f')](_0xc714('0x20'),_0x5a3f57+'-'+_0x4d4697+'/'+_0xb40869)['json'](_0x407948);}return null;};}function patchUpdates(_0x309a0d){return function(_0x3768e0){try{jsonpatch[_0xc714('0x21')](_0x3768e0,_0x309a0d,!![]);}catch(_0x36c99d){return BPromise[_0xc714('0x22')](_0x36c99d);}return _0x3768e0[_0xc714('0x23')]();};}function saveUpdates(_0x564bf5,_0x5e61e7){return function(_0x4ea8bb){if(_0x4ea8bb){return _0x4ea8bb['update'](_0x564bf5)[_0xc714('0x24')](function(_0x176548){return _0x176548;});}return null;};}function removeEntity(_0xed9f6,_0x204497){return function(_0x5eb991){if(_0x5eb991){return _0x5eb991[_0xc714('0x25')]()[_0xc714('0x24')](function(){_0xed9f6[_0xc714('0x1e')](0xcc)[_0xc714('0x18')]();});}};}function handleEntityNotFound(_0x2c769c,_0x65744f){return function(_0x28f045){if(!_0x28f045){_0x2c769c[_0xc714('0x26')](0x194);}return _0x28f045;};}function handleError(_0x376803,_0x323738){_0x323738=_0x323738||0x1f4;return function(_0x436c89){logger['error'](_0x436c89['stack']);if(_0x436c89['name']){delete _0x436c89[_0xc714('0x27')];}_0x376803[_0xc714('0x1e')](_0x323738)['send'](_0x436c89);};}exports[_0xc714('0x28')]=function(_0x47adf0,_0x4ab5ac){var _0x381d8f={},_0x4e8445={},_0x339976={'count':0x0,'rows':[]};var _0x38b665=_['map'](db[_0xc714('0x29')][_0xc714('0x2a')],function(_0x3a0638){return{'name':_0x3a0638[_0xc714('0x2b')],'type':_0x3a0638['type']['key']};});_0x4e8445[_0xc714('0x2c')]=_[_0xc714('0x2d')](_0x38b665,_0xc714('0x27'));_0x4e8445[_0xc714('0x2e')]=_['keys'](_0x47adf0[_0xc714('0x2e')]);_0x4e8445[_0xc714('0x2f')]=_['intersection'](_0x4e8445['model'],_0x4e8445['query']);_0x381d8f[_0xc714('0x30')]=_[_0xc714('0x31')](_0x4e8445['model'],qs[_0xc714('0x32')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x32')]));_0x381d8f[_0xc714('0x30')]=_0x381d8f[_0xc714('0x30')][_0xc714('0x33')]?_0x381d8f[_0xc714('0x30')]:_0x4e8445[_0xc714('0x2c')];if(!_0x47adf0[_0xc714('0x2e')][_0xc714('0x34')]('nolimit')){_0x381d8f[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x47adf0[_0xc714('0x2e')]['limit']);_0x381d8f[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x1d')]);}_0x381d8f[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x36')]);_0x381d8f['where']=qs[_0xc714('0x2f')](_['pick'](_0x47adf0['query'],_0x4e8445['filters']),_0x38b665);if(_0x47adf0[_0xc714('0x2e')][_0xc714('0x37')]){_0x381d8f[_0xc714('0x38')]=_[_0xc714('0x39')](_0x381d8f[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x38b665,function(_0x21f4ab){if(_0x21f4ab[_0xc714('0x3a')]!==_0xc714('0x3b')){var _0x5de3a8={};_0x5de3a8[_0x21f4ab[_0xc714('0x27')]]={'$like':'%'+_0x47adf0[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0x5de3a8;}})});}_0x381d8f=_['merge']({},_0x381d8f,_0x47adf0[_0xc714('0x3c')]);var _0x35ada2={'where':_0x381d8f[_0xc714('0x38')]};return db[_0xc714('0x29')][_0xc714('0x1c')](_0x35ada2)[_0xc714('0x24')](function(_0xee0155){_0x339976[_0xc714('0x1c')]=_0xee0155;if(_0x47adf0[_0xc714('0x2e')]['includeAll']){_0x381d8f[_0xc714('0x3d')]=[{'all':!![]}];}return db[_0xc714('0x29')][_0xc714('0x3e')](_0x381d8f);})[_0xc714('0x24')](function(_0x2eb88a){_0x339976[_0xc714('0x3f')]=_0x2eb88a;return _0x339976;})['then'](respondWithFilteredResult(_0x4ab5ac,_0x381d8f))[_0xc714('0x40')](handleError(_0x4ab5ac,null));};exports[_0xc714('0x41')]=function(_0x1445dd,_0x43ccb3){var _0x48c8ea={'raw':![],'where':{'id':_0x1445dd[_0xc714('0x42')]['id']}},_0x2425ed={};_0x2425ed[_0xc714('0x2c')]=_[_0xc714('0x43')](db[_0xc714('0x29')][_0xc714('0x2a')]);_0x2425ed[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x1445dd[_0xc714('0x2e')]);_0x2425ed[_0xc714('0x2f')]=_[_0xc714('0x31')](_0x2425ed[_0xc714('0x2c')],_0x2425ed[_0xc714('0x2e')]);_0x48c8ea[_0xc714('0x30')]=_['intersection'](_0x2425ed[_0xc714('0x2c')],qs[_0xc714('0x32')](_0x1445dd[_0xc714('0x2e')][_0xc714('0x32')]));_0x48c8ea[_0xc714('0x30')]=_0x48c8ea[_0xc714('0x30')][_0xc714('0x33')]?_0x48c8ea[_0xc714('0x30')]:_0x2425ed[_0xc714('0x2c')];if(_0x1445dd[_0xc714('0x2e')][_0xc714('0x44')]){_0x48c8ea[_0xc714('0x3d')]=[{'all':!![]}];}_0x48c8ea=_[_0xc714('0x39')]({},_0x48c8ea,_0x1445dd[_0xc714('0x3c')]);return db[_0xc714('0x29')]['find'](_0x48c8ea)[_0xc714('0x24')](handleEntityNotFound(_0x43ccb3,null))[_0xc714('0x24')](respondWithResult(_0x43ccb3,null))['catch'](handleError(_0x43ccb3,null));};exports[_0xc714('0x45')]=function(_0x4e08f2,_0x541c95){return db[_0xc714('0x29')][_0xc714('0x45')](_0x4e08f2[_0xc714('0x46')],{})[_0xc714('0x24')](respondWithResult(_0x541c95,0xc9))['catch'](handleError(_0x541c95,null));};exports[_0xc714('0x47')]=function(_0x54c3b0,_0x244571){if(_0x54c3b0['body']['id']){delete _0x54c3b0[_0xc714('0x46')]['id'];}return db[_0xc714('0x29')][_0xc714('0x48')]({'where':{'id':_0x54c3b0['params']['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x244571,null))[_0xc714('0x24')](saveUpdates(_0x54c3b0['body'],null))[_0xc714('0x24')](respondWithResult(_0x244571,null))[_0xc714('0x40')](handleError(_0x244571,null));};exports[_0xc714('0x25')]=function(_0x3bd26e,_0x47c90b){return db[_0xc714('0x29')][_0xc714('0x48')]({'where':{'id':_0x3bd26e['params']['id']}})['then'](handleEntityNotFound(_0x47c90b,null))['then'](removeEntity(_0x47c90b,null))[_0xc714('0x40')](handleError(_0x47c90b,null));};exports[_0xc714('0x49')]=function(_0x23035c,_0xab56ec,_0x434854){var _0xf39c61={};var _0x431cb4={};var _0x53f277;var _0x3d9031;return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x23035c[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0xab56ec,null))['then'](function(_0x50cda8){if(_0x50cda8){_0x53f277=_0x50cda8;_0x431cb4['model']=_[_0xc714('0x43')](db[_0xc714('0x4b')][_0xc714('0x2a')]);_0x431cb4[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x23035c[_0xc714('0x2e')]);_0x431cb4[_0xc714('0x2f')]=_[_0xc714('0x31')](_0x431cb4[_0xc714('0x2c')],_0x431cb4[_0xc714('0x2e')]);_0xf39c61[_0xc714('0x30')]=_['intersection'](_0x431cb4['model'],qs['fields'](_0x23035c[_0xc714('0x2e')][_0xc714('0x32')]));_0xf39c61[_0xc714('0x30')]=_0xf39c61['attributes']['length']?_0xf39c61[_0xc714('0x30')]:_0x431cb4[_0xc714('0x2c')];_0xf39c61[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x23035c[_0xc714('0x2e')][_0xc714('0x36')]);_0xf39c61[_0xc714('0x38')]=qs[_0xc714('0x2f')](_[_0xc714('0x4c')](_0x23035c[_0xc714('0x2e')],_0x431cb4[_0xc714('0x2f')]));if(_0x23035c[_0xc714('0x2e')][_0xc714('0x37')]){_0xf39c61['where']=_[_0xc714('0x39')](_0xf39c61[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0xf39c61[_0xc714('0x30')],function(_0x354eed){var _0xf6bc8b={};_0xf6bc8b[_0x354eed]={'$like':'%'+_0x23035c[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0xf6bc8b;})});}_0xf39c61=_[_0xc714('0x39')]({},_0xf39c61,_0x23035c[_0xc714('0x3c')]);return _0x53f277[_0xc714('0x49')](_0xf39c61);}})[_0xc714('0x24')](function(_0xadf84f){if(_0xadf84f){_0x3d9031=_0xadf84f[_0xc714('0x33')];if(!_0x23035c[_0xc714('0x2e')][_0xc714('0x34')](_0xc714('0x4d'))){_0xf39c61[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x23035c[_0xc714('0x2e')][_0xc714('0x1b')]);_0xf39c61[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x23035c[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x53f277[_0xc714('0x49')](_0xf39c61);}})[_0xc714('0x24')](function(_0x43bb96){if(_0x43bb96){return _0x43bb96?{'count':_0x3d9031,'rows':_0x43bb96}:null;}})[_0xc714('0x24')](respondWithResult(_0xab56ec,null))[_0xc714('0x40')](handleError(_0xab56ec,null));};exports[_0xc714('0x4e')]=function(_0x279c35,_0x4e4907,_0x4ef87c){var _0x2749b3={};var _0x4619f={};var _0x5dbf46;var _0x4fe2f5;return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x279c35[_0xc714('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e4907,null))[_0xc714('0x24')](function(_0x34920a){if(_0x34920a){_0x5dbf46=_0x34920a;_0x4619f[_0xc714('0x2c')]=_['keys'](db[_0xc714('0x4b')][_0xc714('0x2a')]);_0x4619f['query']=_[_0xc714('0x43')](_0x279c35['query']);_0x4619f[_0xc714('0x2f')]=_['intersection'](_0x4619f['model'],_0x4619f[_0xc714('0x2e')]);_0x2749b3[_0xc714('0x30')]=_['intersection'](_0x4619f[_0xc714('0x2c')],qs[_0xc714('0x32')](_0x279c35[_0xc714('0x2e')][_0xc714('0x32')]));_0x2749b3[_0xc714('0x30')]=_0x2749b3[_0xc714('0x30')][_0xc714('0x33')]?_0x2749b3[_0xc714('0x30')]:_0x4619f[_0xc714('0x2c')];_0x2749b3[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x279c35[_0xc714('0x2e')]['sort']);_0x2749b3[_0xc714('0x38')]=qs[_0xc714('0x2f')](_[_0xc714('0x4c')](_0x279c35[_0xc714('0x2e')],_0x4619f['filters']));if(_0x279c35['query']['filter']){_0x2749b3[_0xc714('0x38')]=_[_0xc714('0x39')](_0x2749b3[_0xc714('0x38')],{'$or':_['map'](_0x2749b3['attributes'],function(_0x39f115){var _0xc7ce3d={};_0xc7ce3d[_0x39f115]={'$like':'%'+_0x279c35[_0xc714('0x2e')]['filter']+'%'};return _0xc7ce3d;})});}_0x2749b3=_['merge']({},_0x2749b3,_0x279c35[_0xc714('0x3c')]);return _0x5dbf46[_0xc714('0x4e')](_0x2749b3);}})[_0xc714('0x24')](function(_0x1de1eb){if(_0x1de1eb){_0x4fe2f5=_0x1de1eb[_0xc714('0x33')];if(!_0x279c35['query'][_0xc714('0x34')](_0xc714('0x4d'))){_0x2749b3[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x279c35[_0xc714('0x2e')][_0xc714('0x1b')]);_0x2749b3['offset']=qs['offset'](_0x279c35[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x5dbf46['getSubjects'](_0x2749b3);}})[_0xc714('0x24')](function(_0x511087){if(_0x511087){return _0x511087?{'count':_0x4fe2f5,'rows':_0x511087}:null;}})[_0xc714('0x24')](respondWithResult(_0x4e4907,null))[_0xc714('0x40')](handleError(_0x4e4907,null));};exports['getDescriptions']=function(_0x29cea9,_0x1e45b3,_0x4202d5){var _0x43dfb3={};var _0x47ebb6={};var _0x9cb282;var _0x1c2e7c;return db[_0xc714('0x29')][_0xc714('0x4a')]({'where':{'id':_0x29cea9[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x1e45b3,null))[_0xc714('0x24')](function(_0x53924c){if(_0x53924c){_0x9cb282=_0x53924c;_0x47ebb6[_0xc714('0x2c')]=_[_0xc714('0x43')](db[_0xc714('0x4b')]['rawAttributes']);_0x47ebb6[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x29cea9['query']);_0x47ebb6['filters']=_[_0xc714('0x31')](_0x47ebb6[_0xc714('0x2c')],_0x47ebb6[_0xc714('0x2e')]);_0x43dfb3[_0xc714('0x30')]=_['intersection'](_0x47ebb6['model'],qs['fields'](_0x29cea9[_0xc714('0x2e')]['fields']));_0x43dfb3[_0xc714('0x30')]=_0x43dfb3[_0xc714('0x30')][_0xc714('0x33')]?_0x43dfb3[_0xc714('0x30')]:_0x47ebb6[_0xc714('0x2c')];_0x43dfb3[_0xc714('0x35')]=qs['sort'](_0x29cea9[_0xc714('0x2e')][_0xc714('0x36')]);_0x43dfb3['where']=qs[_0xc714('0x2f')](_['pick'](_0x29cea9[_0xc714('0x2e')],_0x47ebb6[_0xc714('0x2f')]));if(_0x29cea9['query'][_0xc714('0x37')]){_0x43dfb3['where']=_['merge'](_0x43dfb3[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x43dfb3[_0xc714('0x30')],function(_0x24088c){var _0x4a31f7={};_0x4a31f7[_0x24088c]={'$like':'%'+_0x29cea9[_0xc714('0x2e')]['filter']+'%'};return _0x4a31f7;})});}_0x43dfb3=_[_0xc714('0x39')]({},_0x43dfb3,_0x29cea9[_0xc714('0x3c')]);return _0x9cb282['getDescriptions'](_0x43dfb3);}})[_0xc714('0x24')](function(_0x292dda){if(_0x292dda){_0x1c2e7c=_0x292dda[_0xc714('0x33')];if(!_0x29cea9['query'][_0xc714('0x34')](_0xc714('0x4d'))){_0x43dfb3[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x29cea9[_0xc714('0x2e')][_0xc714('0x1b')]);_0x43dfb3[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x29cea9['query']['offset']);}return _0x9cb282[_0xc714('0x4f')](_0x43dfb3);}})[_0xc714('0x24')](function(_0x21a705){if(_0x21a705){return _0x21a705?{'count':_0x1c2e7c,'rows':_0x21a705}:null;}})['then'](respondWithResult(_0x1e45b3,null))[_0xc714('0x40')](handleError(_0x1e45b3,null));};exports['getTags']=function(_0xe1be16,_0x3a394d,_0x4738b7){var _0x565a26={};var _0x17c042={};var _0x454aab;var _0x4c34a0;return db[_0xc714('0x29')][_0xc714('0x4a')]({'where':{'id':_0xe1be16['params']['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x3a394d,null))[_0xc714('0x24')](function(_0xeaec2f){if(_0xeaec2f){_0x454aab=_0xeaec2f;_0x17c042[_0xc714('0x2c')]=_['keys'](db['Tag'][_0xc714('0x2a')]);_0x17c042[_0xc714('0x2e')]=_[_0xc714('0x43')](_0xe1be16[_0xc714('0x2e')]);_0x17c042[_0xc714('0x2f')]=_['intersection'](_0x17c042[_0xc714('0x2c')],_0x17c042[_0xc714('0x2e')]);_0x565a26[_0xc714('0x30')]=_[_0xc714('0x31')](_0x17c042[_0xc714('0x2c')],qs[_0xc714('0x32')](_0xe1be16[_0xc714('0x2e')][_0xc714('0x32')]));_0x565a26[_0xc714('0x30')]=_0x565a26[_0xc714('0x30')][_0xc714('0x33')]?_0x565a26['attributes']:_0x17c042['model'];_0x565a26[_0xc714('0x35')]=qs['sort'](_0xe1be16[_0xc714('0x2e')][_0xc714('0x36')]);_0x565a26['where']=qs[_0xc714('0x2f')](_['pick'](_0xe1be16[_0xc714('0x2e')],_0x17c042[_0xc714('0x2f')]));if(_0xe1be16[_0xc714('0x2e')][_0xc714('0x37')]){_0x565a26[_0xc714('0x38')]=_[_0xc714('0x39')](_0x565a26[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x565a26[_0xc714('0x30')],function(_0x3e5c11){var _0x301cb1={};_0x301cb1[_0x3e5c11]={'$like':'%'+_0xe1be16[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0x301cb1;})});}_0x565a26=_[_0xc714('0x39')]({},_0x565a26,_0xe1be16[_0xc714('0x3c')]);return _0x454aab[_0xc714('0x50')](_0x565a26);}})['then'](function(_0x3766f8){if(_0x3766f8){_0x4c34a0=_0x3766f8['length'];if(!_0xe1be16[_0xc714('0x2e')][_0xc714('0x34')](_0xc714('0x4d'))){_0x565a26['limit']=qs[_0xc714('0x1b')](_0xe1be16[_0xc714('0x2e')][_0xc714('0x1b')]);_0x565a26[_0xc714('0x1d')]=qs['offset'](_0xe1be16[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x454aab[_0xc714('0x50')](_0x565a26);}})[_0xc714('0x24')](function(_0x23957a){if(_0x23957a){return _0x23957a?{'count':_0x4c34a0,'rows':_0x23957a}:null;}})['then'](respondWithResult(_0x3a394d,null))[_0xc714('0x40')](handleError(_0x3a394d,null));};exports[_0xc714('0x51')]=function(_0x3eca5f,_0xce200e,_0x4def8e){if(_0x3eca5f[_0xc714('0x46')]['id']){delete _0x3eca5f[_0xc714('0x46')]['id'];}return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x3eca5f[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0xce200e,null))[_0xc714('0x24')](function(_0x1ade86){if(_0x1ade86){return _0x1ade86[_0xc714('0x51')](_0x3eca5f[_0xc714('0x46')][_0xc714('0x52')]||[]);}return null;})['then'](respondWithResult(_0xce200e,null))[_0xc714('0x40')](handleError(_0xce200e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 77e3ecb..98211a6 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 _0x0105=['request-promise','path','rimraf','../../config/environment','exports','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3f807d,_0x32a3b1){var _0x45ad62=function(_0x32b5d9){while(--_0x32b5d9){_0x3f807d['push'](_0x3f807d['shift']());}};_0x45ad62(++_0x32a3b1);}(_0x0105,0x180));var _0x5010=function(_0xf46d4e,_0x3babc9){_0xf46d4e=_0xf46d4e-0x0;var _0x1039bf=_0x0105[_0xf46d4e];return _0x1039bf;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var logger=require(_0x5010('0x2'))(_0x5010('0x3'));var moment=require(_0x5010('0x4'));var BPromise=require(_0x5010('0x5'));var rp=require(_0x5010('0x6'));var fs=require('fs');var path=require(_0x5010('0x7'));var rimraf=require(_0x5010('0x8'));var config=require(_0x5010('0x9'));var attributes=require('./intDeskConfiguration.attributes');module[_0x5010('0xa')]=function(_0x3bbdcd,_0x547d3a){return _0x3bbdcd[_0x5010('0xb')]('DeskConfiguration',attributes,{'tableName':_0x5010('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fb7=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','api','moment'];(function(_0x52b655,_0x5132ac){var _0x4185fc=function(_0x19b9e2){while(--_0x19b9e2){_0x52b655['push'](_0x52b655['shift']());}};_0x4185fc(++_0x5132ac);}(_0x3fb7,0x189));var _0x73fb=function(_0x419d00,_0x4ebfb7){_0x419d00=_0x419d00-0x0;var _0x465068=_0x3fb7[_0x419d00];return _0x465068;};'use strict';var _=require('lodash');var util=require(_0x73fb('0x0'));var logger=require('../../config/logger')(_0x73fb('0x1'));var moment=require(_0x73fb('0x2'));var BPromise=require('bluebird');var rp=require(_0x73fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73fb('0x4'));var config=require(_0x73fb('0x5'));var attributes=require(_0x73fb('0x6'));module[_0x73fb('0x7')]=function(_0x3330e3,_0x423496){return _0x3330e3[_0x73fb('0x8')](_0x73fb('0x9'),attributes,{'tableName':_0x73fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index d0dd401..d37aa2e 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 _0xea63=['request\x20sent','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x332de0,_0x289db4){var _0x22f8d8=function(_0x19bf5c){while(--_0x19bf5c){_0x332de0['push'](_0x332de0['shift']());}};_0x22f8d8(++_0x289db4);}(_0xea63,0x138));var _0x3ea6=function(_0x2559a2,_0x492632){_0x2559a2=_0x2559a2-0x0;var _0x3cad43=_0xea63[_0x2559a2];return _0x3cad43;};'use strict';var _=require(_0x3ea6('0x0'));var util=require(_0x3ea6('0x1'));var moment=require('moment');var BPromise=require(_0x3ea6('0x2'));var rs=require(_0x3ea6('0x3'));var fs=require('fs');var Redis=require(_0x3ea6('0x4'));var db=require(_0x3ea6('0x5'))['db'];var utils=require(_0x3ea6('0x6'));var logger=require(_0x3ea6('0x7'))('rpc');var config=require(_0x3ea6('0x8'));var jayson=require(_0x3ea6('0x9'));var client=jayson[_0x3ea6('0xa')][_0x3ea6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2deef6,_0xa68db0,_0x4af997){return new BPromise(function(_0x4b1f99,_0x38b984){return client[_0x3ea6('0xc')](_0x2deef6,_0x4af997)[_0x3ea6('0xd')](function(_0x1a74ac){logger[_0x3ea6('0xe')](_0x3ea6('0xf'),_0xa68db0,'request\x20sent');logger[_0x3ea6('0x10')](_0x3ea6('0x11'),_0xa68db0,_0x3ea6('0x12'),JSON[_0x3ea6('0x13')](_0x1a74ac));if(_0x1a74ac[_0x3ea6('0x14')]){if(_0x1a74ac[_0x3ea6('0x14')]['code']===0x1f4){logger['error'](_0x3ea6('0xf'),_0xa68db0,_0x1a74ac[_0x3ea6('0x14')][_0x3ea6('0x15')]);return _0x38b984(_0x1a74ac['error'][_0x3ea6('0x15')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xa68db0,_0x1a74ac['error'][_0x3ea6('0x15')]);return _0x4b1f99(_0x1a74ac['error'][_0x3ea6('0x15')]);}else{logger[_0x3ea6('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xa68db0,_0x3ea6('0x12'));_0x4b1f99(_0x1a74ac['result'][_0x3ea6('0x15')]);}})['catch'](function(_0x462d48){logger[_0x3ea6('0x14')](_0x3ea6('0xf'),_0xa68db0,_0x462d48);_0x38b984(_0x462d48);});});} \ No newline at end of file +var _0x7c71=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4919c7,_0x45153f){var _0x250542=function(_0x183280){while(--_0x183280){_0x4919c7['push'](_0x4919c7['shift']());}};_0x250542(++_0x45153f);}(_0x7c71,0x177));var _0x17c7=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x7c71[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c061b,_0xf284a2,_0x1ff4ec){return new BPromise(function(_0x50feb0,_0x13fdad){return client[_0x17c7('0xb')](_0x3c061b,_0x1ff4ec)[_0x17c7('0xc')](function(_0xdb3575){logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));logger[_0x17c7('0x10')](_0x17c7('0x11'),_0xf284a2,_0x17c7('0xf'),JSON['stringify'](_0xdb3575));if(_0xdb3575['error']){if(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x13')]===0x1f4){logger['error'](_0x17c7('0xe'),_0xf284a2,_0xdb3575[_0x17c7('0x12')]['message']);return _0x13fdad(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xf284a2,_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);return _0x50feb0(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}else{logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));_0x50feb0(_0xdb3575[_0x17c7('0x15')][_0x17c7('0x14')]);}})[_0x17c7('0x16')](function(_0x296f9c){logger[_0x17c7('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf284a2,_0x296f9c);_0x13fdad(_0x296f9c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4d847fc..409d00e 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 _0x9108=['index','isAuthenticated','post','/:id','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9108,0x12d));var _0x8910=function(_0xcf68f0,_0x5c52e8){_0xcf68f0=_0xcf68f0-0x0;var _0x5e14c1=_0x9108[_0xcf68f0];return _0x5e14c1;};'use strict';var multer=require('multer');var util=require(_0x8910('0x0'));var path=require(_0x8910('0x1'));var timeout=require(_0x8910('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8910('0x3'));var auth=require(_0x8910('0x4'));var interaction=require(_0x8910('0x5'));var config=require(_0x8910('0x6'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8910('0x7')]);router['get']('/:id',auth[_0x8910('0x8')](),controller['show']);router[_0x8910('0x9')]('/',auth[_0x8910('0x8')](),controller['create']);router['put'](_0x8910('0xa'),auth[_0x8910('0x8')](),controller[_0x8910('0xb')]);router['delete'](_0x8910('0xa'),auth[_0x8910('0x8')](),controller[_0x8910('0xc')]);module[_0x8910('0xd')]=router; \ No newline at end of file +var _0xcc87=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','/:id','delete'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0xcc87,0x158));var _0x7cc8=function(_0x4734c3,_0x32b465){_0x4734c3=_0x4734c3-0x0;var _0x298191=_0xcc87[_0x4734c3];return _0x298191;};'use strict';var multer=require(_0x7cc8('0x0'));var util=require('util');var path=require(_0x7cc8('0x1'));var timeout=require(_0x7cc8('0x2'));var express=require(_0x7cc8('0x3'));var router=express[_0x7cc8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7cc8('0x5'));var interaction=require(_0x7cc8('0x6'));var config=require(_0x7cc8('0x7'));var controller=require(_0x7cc8('0x8'));router[_0x7cc8('0x9')]('/',auth[_0x7cc8('0xa')](),controller[_0x7cc8('0xb')]);router[_0x7cc8('0x9')]('/:id',auth[_0x7cc8('0xa')](),controller[_0x7cc8('0xc')]);router[_0x7cc8('0xd')]('/',auth[_0x7cc8('0xa')](),controller['create']);router['put'](_0x7cc8('0xe'),auth[_0x7cc8('0xa')](),controller['update']);router[_0x7cc8('0xf')](_0x7cc8('0xe'),auth[_0x7cc8('0xa')](),controller[_0x7cc8('0x10')]);module[_0x7cc8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 24567ea..63b3241 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 _0xa6d6=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x575562,_0x588f15){var _0x54ce87=function(_0x45509b){while(--_0x45509b){_0x575562['push'](_0x575562['shift']());}};_0x54ce87(++_0x588f15);}(_0xa6d6,0x1b3));var _0x6a6d=function(_0x31c4a9,_0x18955f){_0x31c4a9=_0x31c4a9-0x0;var _0x1daa96=_0xa6d6[_0x31c4a9];return _0x1daa96;};'use strict';var Sequelize=require('sequelize');module[_0x6a6d('0x0')]={'type':{'type':Sequelize[_0x6a6d('0x1')](_0x6a6d('0x2'),_0x6a6d('0x3'),_0x6a6d('0x4'),_0x6a6d('0x5'),_0x6a6d('0x6')),'defaultValue':_0x6a6d('0x2')},'content':{'type':Sequelize[_0x6a6d('0x7')]},'key':{'type':Sequelize[_0x6a6d('0x7')]},'keyType':{'type':Sequelize[_0x6a6d('0x1')](_0x6a6d('0x2'),_0x6a6d('0x3'),_0x6a6d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6a6d('0x7')]},'nameField':{'type':Sequelize[_0x6a6d('0x7')]},'customField':{'type':Sequelize[_0x6a6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a6d('0x7')]}}; \ No newline at end of file +var _0xb998=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x5448b4,_0x4154f){var _0x10cfca=function(_0x3f8ef7){while(--_0x3f8ef7){_0x5448b4['push'](_0x5448b4['shift']());}};_0x10cfca(++_0x4154f);}(_0xb998,0x1ce));var _0x8b99=function(_0x461605,_0x1dbdf8){_0x461605=_0x461605-0x0;var _0x27fe3e=_0xb998[_0x461605];return _0x27fe3e;};'use strict';var Sequelize=require(_0x8b99('0x0'));module[_0x8b99('0x1')]={'type':{'type':Sequelize[_0x8b99('0x2')]('string',_0x8b99('0x3'),_0x8b99('0x4'),_0x8b99('0x5'),_0x8b99('0x6')),'defaultValue':_0x8b99('0x7')},'content':{'type':Sequelize[_0x8b99('0x8')]},'key':{'type':Sequelize[_0x8b99('0x8')]},'keyType':{'type':Sequelize[_0x8b99('0x2')]('string','variable',_0x8b99('0x4'))},'keyContent':{'type':Sequelize[_0x8b99('0x8')]},'idField':{'type':Sequelize[_0x8b99('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8b99('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b99('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0110963..3923f37 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 _0x5ff9=['includeAll','include','findAll','show','find','catch','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','DeskField'];(function(_0x355aee,_0x3de5cc){var _0x541500=function(_0x197221){while(--_0x197221){_0x355aee['push'](_0x355aee['shift']());}};_0x541500(++_0x3de5cc);}(_0x5ff9,0xa0));var _0x95ff=function(_0x181959,_0x111e0a){_0x181959=_0x181959-0x0;var _0x5e3ca1=_0x5ff9[_0x181959];return _0x5e3ca1;};'use strict';var emlformat=require(_0x95ff('0x0'));var rimraf=require(_0x95ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ff('0x2'));var rp=require(_0x95ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95ff('0x4'));var util=require('util');var path=require('path');var sox=require(_0x95ff('0x5'));var csv=require(_0x95ff('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95ff('0x7'));var _=require('lodash');var squel=require(_0x95ff('0x8'));var crypto=require(_0x95ff('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x95ff('0xa'));var toCsv=require('to-csv');var querystring=require(_0x95ff('0xb'));var Papa=require(_0x95ff('0xc'));var Redis=require('ioredis');var authService=require(_0x95ff('0xd'));var qs=require(_0x95ff('0xe'));var as=require(_0x95ff('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ff('0x10'))(_0x95ff('0x11'));var utils=require(_0x95ff('0x12'));var config=require(_0x95ff('0x13'));var licenseUtil=require(_0x95ff('0x14'));var db=require(_0x95ff('0x15'))['db'];function respondWithStatusCode(_0x52a97e,_0x5293e9){_0x5293e9=_0x5293e9||0xcc;return function(_0x39ce1b){if(_0x39ce1b){return _0x52a97e[_0x95ff('0x16')](_0x5293e9);}return _0x52a97e[_0x95ff('0x17')](_0x5293e9)[_0x95ff('0x18')]();};}function respondWithResult(_0x59bcac,_0x3a29fc){_0x3a29fc=_0x3a29fc||0xc8;return function(_0x40c53b){if(_0x40c53b){return _0x59bcac['status'](_0x3a29fc)[_0x95ff('0x19')](_0x40c53b);}};}function respondWithFilteredResult(_0x1b6c9a,_0x4cc1f2){return function(_0x59c504){if(_0x59c504){var _0xf8fee=typeof _0x4cc1f2[_0x95ff('0x1a')]===_0x95ff('0x1b')&&typeof _0x4cc1f2['limit']===_0x95ff('0x1b');var _0x4fd920=_0x59c504['count'];var _0x1929c4=_0xf8fee?0x0:_0x4cc1f2[_0x95ff('0x1a')];var _0x1c67e4=_0xf8fee?_0x59c504[_0x95ff('0x1c')]:_0x4cc1f2['offset']+_0x4cc1f2[_0x95ff('0x1d')];var _0x1467df;if(_0x1c67e4>=_0x4fd920){_0x1c67e4=_0x4fd920;_0x1467df=0xc8;}else{_0x1467df=0xce;}_0x1b6c9a[_0x95ff('0x17')](_0x1467df);return _0x1b6c9a[_0x95ff('0x1e')](_0x95ff('0x1f'),_0x1929c4+'-'+_0x1c67e4+'/'+_0x4fd920)['json'](_0x59c504);}return null;};}function patchUpdates(_0x363691){return function(_0x409963){try{jsonpatch[_0x95ff('0x20')](_0x409963,_0x363691,!![]);}catch(_0x169dcb){return BPromise[_0x95ff('0x21')](_0x169dcb);}return _0x409963['save']();};}function saveUpdates(_0x552067,_0x1151d8){return function(_0x2d02f2){if(_0x2d02f2){return _0x2d02f2[_0x95ff('0x22')](_0x552067)[_0x95ff('0x23')](function(_0x4be963){return _0x4be963;});}return null;};}function removeEntity(_0x3cf2eb,_0x1f79b1){return function(_0x4fa568){if(_0x4fa568){return _0x4fa568['destroy']()[_0x95ff('0x23')](function(){_0x3cf2eb['status'](0xcc)[_0x95ff('0x18')]();});}};}function handleEntityNotFound(_0x206d30,_0xbc5e96){return function(_0x1830f5){if(!_0x1830f5){_0x206d30[_0x95ff('0x16')](0x194);}return _0x1830f5;};}function handleError(_0x2b4926,_0x4e5178){_0x4e5178=_0x4e5178||0x1f4;return function(_0x43e339){logger[_0x95ff('0x24')](_0x43e339[_0x95ff('0x25')]);if(_0x43e339[_0x95ff('0x26')]){delete _0x43e339[_0x95ff('0x26')];}_0x2b4926[_0x95ff('0x17')](_0x4e5178)[_0x95ff('0x27')](_0x43e339);};}exports[_0x95ff('0x28')]=function(_0x258339,_0x3b4919){var _0x37b9bc={},_0x2fcc8b={},_0x2bc475={'count':0x0,'rows':[]};var _0x89c03d=_[_0x95ff('0x29')](db['DeskField'][_0x95ff('0x2a')],function(_0x73f4c){return{'name':_0x73f4c[_0x95ff('0x2b')],'type':_0x73f4c[_0x95ff('0x2c')][_0x95ff('0x2d')]};});_0x2fcc8b[_0x95ff('0x2e')]=_[_0x95ff('0x29')](_0x89c03d,'name');_0x2fcc8b[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x258339[_0x95ff('0x2f')]);_0x2fcc8b[_0x95ff('0x31')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],_0x2fcc8b['query']);_0x37b9bc[_0x95ff('0x33')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x37b9bc[_0x95ff('0x33')]=_0x37b9bc['attributes'][_0x95ff('0x35')]?_0x37b9bc[_0x95ff('0x33')]:_0x2fcc8b['model'];if(!_0x258339[_0x95ff('0x2f')][_0x95ff('0x36')](_0x95ff('0x37'))){_0x37b9bc[_0x95ff('0x1d')]=qs[_0x95ff('0x1d')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x1d')]);_0x37b9bc[_0x95ff('0x1a')]=qs[_0x95ff('0x1a')](_0x258339['query'][_0x95ff('0x1a')]);}_0x37b9bc[_0x95ff('0x38')]=qs[_0x95ff('0x39')](_0x258339[_0x95ff('0x2f')]['sort']);_0x37b9bc['where']=qs[_0x95ff('0x31')](_[_0x95ff('0x3a')](_0x258339[_0x95ff('0x2f')],_0x2fcc8b[_0x95ff('0x31')]),_0x89c03d);if(_0x258339['query']['filter']){_0x37b9bc[_0x95ff('0x3b')]=_['merge'](_0x37b9bc[_0x95ff('0x3b')],{'$or':_[_0x95ff('0x29')](_0x89c03d,function(_0x3d1670){if(_0x3d1670[_0x95ff('0x2c')]!==_0x95ff('0x3c')){var _0x1c0d9d={};_0x1c0d9d[_0x3d1670[_0x95ff('0x26')]]={'$like':'%'+_0x258339[_0x95ff('0x2f')][_0x95ff('0x3d')]+'%'};return _0x1c0d9d;}})});}_0x37b9bc=_[_0x95ff('0x3e')]({},_0x37b9bc,_0x258339[_0x95ff('0x3f')]);var _0x595807={'where':_0x37b9bc['where']};return db[_0x95ff('0x40')][_0x95ff('0x1c')](_0x595807)[_0x95ff('0x23')](function(_0x4ff017){_0x2bc475[_0x95ff('0x1c')]=_0x4ff017;if(_0x258339['query'][_0x95ff('0x41')]){_0x37b9bc[_0x95ff('0x42')]=[{'all':!![]}];}return db[_0x95ff('0x40')][_0x95ff('0x43')](_0x37b9bc);})[_0x95ff('0x23')](function(_0x56de6f){_0x2bc475['rows']=_0x56de6f;return _0x2bc475;})[_0x95ff('0x23')](respondWithFilteredResult(_0x3b4919,_0x37b9bc))['catch'](handleError(_0x3b4919,null));};exports[_0x95ff('0x44')]=function(_0x5eb53c,_0x501b48){var _0x152710={'raw':!![],'where':{'id':_0x5eb53c['params']['id']}},_0x199883={};_0x199883[_0x95ff('0x2e')]=_[_0x95ff('0x30')](db[_0x95ff('0x40')][_0x95ff('0x2a')]);_0x199883[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x5eb53c[_0x95ff('0x2f')]);_0x199883[_0x95ff('0x31')]=_['intersection'](_0x199883[_0x95ff('0x2e')],_0x199883[_0x95ff('0x2f')]);_0x152710[_0x95ff('0x33')]=_['intersection'](_0x199883[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x152710['attributes']=_0x152710[_0x95ff('0x33')][_0x95ff('0x35')]?_0x152710[_0x95ff('0x33')]:_0x199883[_0x95ff('0x2e')];if(_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x41')]){_0x152710['include']=[{'all':!![]}];}_0x152710=_[_0x95ff('0x3e')]({},_0x152710,_0x5eb53c['options']);return db[_0x95ff('0x40')][_0x95ff('0x45')](_0x152710)[_0x95ff('0x23')](handleEntityNotFound(_0x501b48,null))['then'](respondWithResult(_0x501b48,null))[_0x95ff('0x46')](handleError(_0x501b48,null));};exports[_0x95ff('0x47')]=function(_0x5c1cb4,_0x3e5051){return db['DeskField'][_0x95ff('0x47')](_0x5c1cb4[_0x95ff('0x48')],{})[_0x95ff('0x23')](respondWithResult(_0x3e5051,0xc9))[_0x95ff('0x46')](handleError(_0x3e5051,null));};exports[_0x95ff('0x22')]=function(_0x582a03,_0x58c9f2){if(_0x582a03[_0x95ff('0x48')]['id']){delete _0x582a03['body']['id'];}return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x582a03['params']['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x58c9f2,null))['then'](saveUpdates(_0x582a03[_0x95ff('0x48')],null))[_0x95ff('0x23')](respondWithResult(_0x58c9f2,null))[_0x95ff('0x46')](handleError(_0x58c9f2,null));};exports[_0x95ff('0x49')]=function(_0x36e05f,_0x117ac1){return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x36e05f[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x117ac1,null))[_0x95ff('0x23')](removeEntity(_0x117ac1,null))['catch'](handleError(_0x117ac1,null));}; \ No newline at end of file +var _0x83de=['options','includeAll','include','findAll','catch','show','find','create','body','params','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x83de,0x116));var _0xe83d=function(_0x4cbc55,_0x34872d){_0x4cbc55=_0x4cbc55-0x0;var _0x1ebb48=_0x83de[_0x4cbc55];return _0x1ebb48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe83d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe83d('0x1'));var rp=require(_0xe83d('0x2'));var moment=require('moment');var BPromise=require(_0xe83d('0x3'));var Mustache=require(_0xe83d('0x4'));var util=require(_0xe83d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe83d('0x6'));var ejs=require(_0xe83d('0x7'));var fs=require('fs');var fs_extra=require(_0xe83d('0x8'));var _=require(_0xe83d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe83d('0xa'));var deskjs=require(_0xe83d('0xb'));var toCsv=require(_0xe83d('0x6'));var querystring=require('querystring');var Papa=require(_0xe83d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe83d('0xd'));var hardwareService=require(_0xe83d('0xe'));var logger=require(_0xe83d('0xf'))('api');var utils=require(_0xe83d('0x10'));var config=require(_0xe83d('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe83d('0x12'))['db'];function respondWithStatusCode(_0x5dd8b3,_0xe0b944){_0xe0b944=_0xe0b944||0xcc;return function(_0x91619a){if(_0x91619a){return _0x5dd8b3[_0xe83d('0x13')](_0xe0b944);}return _0x5dd8b3[_0xe83d('0x14')](_0xe0b944)[_0xe83d('0x15')]();};}function respondWithResult(_0xa19d1,_0xcf4622){_0xcf4622=_0xcf4622||0xc8;return function(_0x825139){if(_0x825139){return _0xa19d1[_0xe83d('0x14')](_0xcf4622)['json'](_0x825139);}};}function respondWithFilteredResult(_0xaf38d7,_0x4c707d){return function(_0x36487e){if(_0x36487e){var _0x472514=typeof _0x4c707d[_0xe83d('0x16')]===_0xe83d('0x17')&&typeof _0x4c707d[_0xe83d('0x18')]==='undefined';var _0x1309ce=_0x36487e[_0xe83d('0x19')];var _0x1d3cc3=_0x472514?0x0:_0x4c707d[_0xe83d('0x16')];var _0x20aac0=_0x472514?_0x36487e[_0xe83d('0x19')]:_0x4c707d[_0xe83d('0x16')]+_0x4c707d['limit'];var _0xb2f3c3;if(_0x20aac0>=_0x1309ce){_0x20aac0=_0x1309ce;_0xb2f3c3=0xc8;}else{_0xb2f3c3=0xce;}_0xaf38d7[_0xe83d('0x14')](_0xb2f3c3);return _0xaf38d7['set'](_0xe83d('0x1a'),_0x1d3cc3+'-'+_0x20aac0+'/'+_0x1309ce)[_0xe83d('0x1b')](_0x36487e);}return null;};}function patchUpdates(_0x15fd5c){return function(_0x487b22){try{jsonpatch['apply'](_0x487b22,_0x15fd5c,!![]);}catch(_0xb4b46e){return BPromise[_0xe83d('0x1c')](_0xb4b46e);}return _0x487b22[_0xe83d('0x1d')]();};}function saveUpdates(_0x57bb5f,_0x1662e8){return function(_0x50129b){if(_0x50129b){return _0x50129b[_0xe83d('0x1e')](_0x57bb5f)[_0xe83d('0x1f')](function(_0x254551){return _0x254551;});}return null;};}function removeEntity(_0x4ea9eb,_0x1dff3f){return function(_0x569cb2){if(_0x569cb2){return _0x569cb2[_0xe83d('0x20')]()[_0xe83d('0x1f')](function(){_0x4ea9eb[_0xe83d('0x14')](0xcc)[_0xe83d('0x15')]();});}};}function handleEntityNotFound(_0xcd1f9a,_0x510e6a){return function(_0x47d945){if(!_0x47d945){_0xcd1f9a['sendStatus'](0x194);}return _0x47d945;};}function handleError(_0xcbad13,_0x4127ba){_0x4127ba=_0x4127ba||0x1f4;return function(_0x5e14fb){logger[_0xe83d('0x21')](_0x5e14fb[_0xe83d('0x22')]);if(_0x5e14fb['name']){delete _0x5e14fb[_0xe83d('0x23')];}_0xcbad13[_0xe83d('0x14')](_0x4127ba)[_0xe83d('0x24')](_0x5e14fb);};}exports[_0xe83d('0x25')]=function(_0x314cec,_0x58fd1b){var _0x4890ab={},_0x2afbab={},_0x379be8={'count':0x0,'rows':[]};var _0x2f63c4=_[_0xe83d('0x26')](db[_0xe83d('0x27')][_0xe83d('0x28')],function(_0x417159){return{'name':_0x417159[_0xe83d('0x29')],'type':_0x417159['type'][_0xe83d('0x2a')]};});_0x2afbab[_0xe83d('0x2b')]=_['map'](_0x2f63c4,'name');_0x2afbab[_0xe83d('0x2c')]=_[_0xe83d('0x2d')](_0x314cec[_0xe83d('0x2c')]);_0x2afbab['filters']=_[_0xe83d('0x2e')](_0x2afbab[_0xe83d('0x2b')],_0x2afbab[_0xe83d('0x2c')]);_0x4890ab['attributes']=_[_0xe83d('0x2e')](_0x2afbab[_0xe83d('0x2b')],qs[_0xe83d('0x2f')](_0x314cec['query']['fields']));_0x4890ab[_0xe83d('0x30')]=_0x4890ab[_0xe83d('0x30')][_0xe83d('0x31')]?_0x4890ab[_0xe83d('0x30')]:_0x2afbab[_0xe83d('0x2b')];if(!_0x314cec[_0xe83d('0x2c')][_0xe83d('0x32')](_0xe83d('0x33'))){_0x4890ab['limit']=qs[_0xe83d('0x18')](_0x314cec[_0xe83d('0x2c')][_0xe83d('0x18')]);_0x4890ab[_0xe83d('0x16')]=qs[_0xe83d('0x16')](_0x314cec['query'][_0xe83d('0x16')]);}_0x4890ab['order']=qs[_0xe83d('0x34')](_0x314cec[_0xe83d('0x2c')][_0xe83d('0x34')]);_0x4890ab['where']=qs[_0xe83d('0x35')](_['pick'](_0x314cec[_0xe83d('0x2c')],_0x2afbab['filters']),_0x2f63c4);if(_0x314cec[_0xe83d('0x2c')][_0xe83d('0x36')]){_0x4890ab[_0xe83d('0x37')]=_[_0xe83d('0x38')](_0x4890ab[_0xe83d('0x37')],{'$or':_[_0xe83d('0x26')](_0x2f63c4,function(_0x5b7ad0){if(_0x5b7ad0['type']!=='VIRTUAL'){var _0x3b2ab4={};_0x3b2ab4[_0x5b7ad0[_0xe83d('0x23')]]={'$like':'%'+_0x314cec[_0xe83d('0x2c')][_0xe83d('0x36')]+'%'};return _0x3b2ab4;}})});}_0x4890ab=_['merge']({},_0x4890ab,_0x314cec[_0xe83d('0x39')]);var _0xea7d23={'where':_0x4890ab[_0xe83d('0x37')]};return db[_0xe83d('0x27')][_0xe83d('0x19')](_0xea7d23)[_0xe83d('0x1f')](function(_0x4e93f4){_0x379be8[_0xe83d('0x19')]=_0x4e93f4;if(_0x314cec['query'][_0xe83d('0x3a')]){_0x4890ab[_0xe83d('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0xe83d('0x3c')](_0x4890ab);})[_0xe83d('0x1f')](function(_0x533776){_0x379be8['rows']=_0x533776;return _0x379be8;})[_0xe83d('0x1f')](respondWithFilteredResult(_0x58fd1b,_0x4890ab))[_0xe83d('0x3d')](handleError(_0x58fd1b,null));};exports[_0xe83d('0x3e')]=function(_0x2e3149,_0x1ab219){var _0x44a9ba={'raw':!![],'where':{'id':_0x2e3149['params']['id']}},_0x263c8e={};_0x263c8e[_0xe83d('0x2b')]=_['keys'](db[_0xe83d('0x27')]['rawAttributes']);_0x263c8e[_0xe83d('0x2c')]=_[_0xe83d('0x2d')](_0x2e3149['query']);_0x263c8e[_0xe83d('0x35')]=_['intersection'](_0x263c8e[_0xe83d('0x2b')],_0x263c8e[_0xe83d('0x2c')]);_0x44a9ba[_0xe83d('0x30')]=_['intersection'](_0x263c8e['model'],qs[_0xe83d('0x2f')](_0x2e3149[_0xe83d('0x2c')][_0xe83d('0x2f')]));_0x44a9ba[_0xe83d('0x30')]=_0x44a9ba['attributes'][_0xe83d('0x31')]?_0x44a9ba[_0xe83d('0x30')]:_0x263c8e['model'];if(_0x2e3149['query'][_0xe83d('0x3a')]){_0x44a9ba[_0xe83d('0x3b')]=[{'all':!![]}];}_0x44a9ba=_[_0xe83d('0x38')]({},_0x44a9ba,_0x2e3149[_0xe83d('0x39')]);return db[_0xe83d('0x27')][_0xe83d('0x3f')](_0x44a9ba)[_0xe83d('0x1f')](handleEntityNotFound(_0x1ab219,null))['then'](respondWithResult(_0x1ab219,null))[_0xe83d('0x3d')](handleError(_0x1ab219,null));};exports[_0xe83d('0x40')]=function(_0x261502,_0x2b45d1){return db[_0xe83d('0x27')]['create'](_0x261502['body'],{})[_0xe83d('0x1f')](respondWithResult(_0x2b45d1,0xc9))['catch'](handleError(_0x2b45d1,null));};exports[_0xe83d('0x1e')]=function(_0xe8bda8,_0xdcad13){if(_0xe8bda8['body']['id']){delete _0xe8bda8[_0xe83d('0x41')]['id'];}return db[_0xe83d('0x27')][_0xe83d('0x3f')]({'where':{'id':_0xe8bda8[_0xe83d('0x42')]['id']}})[_0xe83d('0x1f')](handleEntityNotFound(_0xdcad13,null))[_0xe83d('0x1f')](saveUpdates(_0xe8bda8['body'],null))['then'](respondWithResult(_0xdcad13,null))[_0xe83d('0x3d')](handleError(_0xdcad13,null));};exports['destroy']=function(_0x48c58a,_0x39748e){return db[_0xe83d('0x27')][_0xe83d('0x3f')]({'where':{'id':_0x48c58a[_0xe83d('0x42')]['id']}})[_0xe83d('0x1f')](handleEntityNotFound(_0x39748e,null))[_0xe83d('0x1f')](removeEntity(_0x39748e,null))[_0xe83d('0x3d')](handleError(_0x39748e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cfeb1e1..6896cbe 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 _0xe1b3=['moment','request-promise','path','../../config/environment','./intDeskField.attributes','define','desk_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe1b3,0x188));var _0x3e1b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe1b3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e1b('0x0'));var util=require(_0x3e1b('0x1'));var logger=require(_0x3e1b('0x2'))(_0x3e1b('0x3'));var moment=require(_0x3e1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e1b('0x5'));var fs=require('fs');var path=require(_0x3e1b('0x6'));var rimraf=require('rimraf');var config=require(_0x3e1b('0x7'));var attributes=require(_0x3e1b('0x8'));module['exports']=function(_0x2eaafc,_0x4519a7){return _0x2eaafc[_0x3e1b('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3e1b('0xa'),'fields':['idField',_0x3e1b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6a9=['../../config/environment','./intDeskField.attributes','int_desk_fields','idField','lodash','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd6a9,0x1cf));var _0x9d6a=function(_0x111c00,_0x5df487){_0x111c00=_0x111c00-0x0;var _0xb1af07=_0xd6a9[_0x111c00];return _0xb1af07;};'use strict';var _=require(_0x9d6a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d6a('0x1'));var moment=require('moment');var BPromise=require(_0x9d6a('0x2'));var rp=require(_0x9d6a('0x3'));var fs=require('fs');var path=require(_0x9d6a('0x4'));var rimraf=require('rimraf');var config=require(_0x9d6a('0x5'));var attributes=require(_0x9d6a('0x6'));module['exports']=function(_0x1597de,_0x39c44f){return _0x1597de['define']('DeskField',attributes,{'tableName':_0x9d6a('0x7'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x9d6a('0x8'),'FieldId'],'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 814fd29..d890ef7 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 _0x1582=['../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f1101,_0x22d22b){var _0x3628bf=function(_0x2b7a1e){while(--_0x2b7a1e){_0x3f1101['push'](_0x3f1101['shift']());}};_0x3628bf(++_0x22d22b);}(_0x1582,0xf6));var _0x2158=function(_0x1bf8b1,_0x1b11cd){_0x1bf8b1=_0x1bf8b1-0x0;var _0x37fb94=_0x1582[_0x1bf8b1];return _0x37fb94;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2158('0x0'));var fs=require('fs');var Redis=require(_0x2158('0x1'));var db=require(_0x2158('0x2'))['db'];var utils=require(_0x2158('0x3'));var logger=require(_0x2158('0x4'))(_0x2158('0x5'));var config=require(_0x2158('0x6'));var jayson=require(_0x2158('0x7'));var client=jayson[_0x2158('0x8')][_0x2158('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1666f6,_0x5c8658,_0x21b7f7){return new BPromise(function(_0x48b698,_0x3457c1){return client[_0x2158('0xa')](_0x1666f6,_0x21b7f7)[_0x2158('0xb')](function(_0x2b97a5){logger['info'](_0x2158('0xc'),_0x5c8658,_0x2158('0xd'));logger[_0x2158('0xe')](_0x2158('0xf'),_0x5c8658,_0x2158('0xd'),JSON['stringify'](_0x2b97a5));if(_0x2b97a5['error']){if(_0x2b97a5[_0x2158('0x10')][_0x2158('0x11')]===0x1f4){logger[_0x2158('0x10')](_0x2158('0xc'),_0x5c8658,_0x2b97a5[_0x2158('0x10')][_0x2158('0x12')]);return _0x3457c1(_0x2b97a5[_0x2158('0x10')]['message']);}logger['error'](_0x2158('0xc'),_0x5c8658,_0x2b97a5['error'][_0x2158('0x12')]);return _0x48b698(_0x2b97a5['error'][_0x2158('0x12')]);}else{logger[_0x2158('0x13')]('DeskField,\x20%s,\x20%s',_0x5c8658,_0x2158('0xd'));_0x48b698(_0x2b97a5[_0x2158('0x14')][_0x2158('0x12')]);}})['catch'](function(_0x4adc22){logger[_0x2158('0x10')](_0x2158('0xc'),_0x5c8658,_0x4adc22);_0x3457c1(_0x4adc22);});});} \ No newline at end of file +var _0x6f0d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1be98d,_0x4c0cab){var _0x291536=function(_0x2b7a4c){while(--_0x2b7a4c){_0x1be98d['push'](_0x1be98d['shift']());}};_0x291536(++_0x4c0cab);}(_0x6f0d,0xa9));var _0xd6f0=function(_0x2c6d3b,_0x4d33da){_0x2c6d3b=_0x2c6d3b-0x0;var _0x3c410c=_0x6f0d[_0x2c6d3b];return _0x3c410c;};'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(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var utils=require(_0xd6f0('0x6'));var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var config=require(_0xd6f0('0x9'));var jayson=require(_0xd6f0('0xa'));var client=jayson[_0xd6f0('0xb')][_0xd6f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x332309,_0x49655b,_0x20a1e3){return new BPromise(function(_0x5ede4c,_0x571b00){return client[_0xd6f0('0xd')](_0x332309,_0x20a1e3)['then'](function(_0x25e0da){logger[_0xd6f0('0xe')](_0xd6f0('0xf'),_0x49655b,_0xd6f0('0x10'));logger[_0xd6f0('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x49655b,'request\x20sent',JSON[_0xd6f0('0x12')](_0x25e0da));if(_0x25e0da['error']){if(_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x14')]===0x1f4){logger[_0xd6f0('0x13')]('DeskField,\x20%s,\x20%s',_0x49655b,_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x571b00(_0x25e0da[_0xd6f0('0x13')]['message']);}logger[_0xd6f0('0x13')](_0xd6f0('0xf'),_0x49655b,_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x5ede4c(_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);}else{logger['info'](_0xd6f0('0xf'),_0x49655b,_0xd6f0('0x10'));_0x5ede4c(_0x25e0da[_0xd6f0('0x16')]['message']);}})[_0xd6f0('0x17')](function(_0x18d198){logger[_0xd6f0('0x13')]('DeskField,\x20%s,\x20%s',_0x49655b,_0x18d198);_0x571b00(_0x18d198);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d2d6bed..2a48a73 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 _0x887e=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x4f6afe,_0x44a4ff){var _0x5256f8=function(_0x4c194f){while(--_0x4c194f){_0x4f6afe['push'](_0x4f6afe['shift']());}};_0x5256f8(++_0x44a4ff);}(_0x887e,0x13d));var _0xe887=function(_0x11db67,_0x2e8f03){_0x11db67=_0x11db67-0x0;var _0x19f0dc=_0x887e[_0x11db67];return _0x19f0dc;};'use strict';var multer=require(_0xe887('0x0'));var util=require(_0xe887('0x1'));var path=require(_0xe887('0x2'));var timeout=require(_0xe887('0x3'));var express=require(_0xe887('0x4'));var router=express[_0xe887('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe887('0x6'));var interaction=require(_0xe887('0x7'));var config=require(_0xe887('0x8'));var controller=require(_0xe887('0x9'));router[_0xe887('0xa')]('/',auth[_0xe887('0xb')](),controller['index']);router[_0xe887('0xa')](_0xe887('0xc'),auth[_0xe887('0xb')](),controller[_0xe887('0xd')]);router[_0xe887('0xa')](_0xe887('0xe'),auth[_0xe887('0xb')](),controller[_0xe887('0xf')]);router[_0xe887('0xa')](_0xe887('0x10'),auth[_0xe887('0xb')](),controller[_0xe887('0x11')]);router['post']('/',auth[_0xe887('0xb')](),controller[_0xe887('0x12')]);router[_0xe887('0x13')](_0xe887('0xe'),auth[_0xe887('0xb')](),controller[_0xe887('0x14')]);router[_0xe887('0x15')](_0xe887('0xc'),auth[_0xe887('0xb')](),controller[_0xe887('0x16')]);router[_0xe887('0x17')](_0xe887('0xc'),auth[_0xe887('0xb')](),controller[_0xe887('0x18')]);module[_0xe887('0x19')]=router; \ No newline at end of file +var _0x91b7=['index','getConfigurations','get','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x37d2d3,_0x3d042c){var _0x792538=function(_0x3e1798){while(--_0x3e1798){_0x37d2d3['push'](_0x37d2d3['shift']());}};_0x792538(++_0x3d042c);}(_0x91b7,0xfe));var _0x791b=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x91b7[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x791b('0x0'));var path=require(_0x791b('0x1'));var timeout=require(_0x791b('0x2'));var express=require(_0x791b('0x3'));var router=express[_0x791b('0x4')]();var fs_extra=require(_0x791b('0x5'));var auth=require(_0x791b('0x6'));var interaction=require(_0x791b('0x7'));var config=require(_0x791b('0x8'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x791b('0x9')](),controller[_0x791b('0xa')]);router['get']('/:id',auth[_0x791b('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0x791b('0x9')](),controller[_0x791b('0xb')]);router[_0x791b('0xc')]('/:id/fields',auth[_0x791b('0x9')](),controller[_0x791b('0xd')]);router[_0x791b('0xe')]('/',auth['isAuthenticated'](),controller[_0x791b('0xf')]);router['post'](_0x791b('0x10'),auth[_0x791b('0x9')](),controller[_0x791b('0x11')]);router[_0x791b('0x12')]('/:id',auth[_0x791b('0x9')](),controller[_0x791b('0x13')]);router[_0x791b('0x14')](_0x791b('0x15'),auth[_0x791b('0x9')](),controller[_0x791b('0x16')]);module[_0x791b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f4fe3d7..8c75c4a 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 _0xee3c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x7ff5cb,_0x1fc52f){var _0x45195c=function(_0x4afc98){while(--_0x4afc98){_0x7ff5cb['push'](_0x7ff5cb['shift']());}};_0x45195c(++_0x1fc52f);}(_0xee3c,0x14a));var _0xcee3=function(_0x5dca7b,_0x42330b){_0x5dca7b=_0x5dca7b-0x0;var _0x99e3af=_0xee3c[_0x5dca7b];return _0x99e3af;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'name':{'type':Sequelize[_0xcee3('0x2')]},'username':{'type':Sequelize[_0xcee3('0x2')]},'password':{'type':Sequelize[_0xcee3('0x2')]},'remoteUri':{'type':Sequelize[_0xcee3('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xcee3('0x2')]},'serverUrl':{'type':Sequelize[_0xcee3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcee3('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcee3('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x89b8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5d4e2a,_0x3d868c){var _0x4d9086=function(_0x185237){while(--_0x185237){_0x5d4e2a['push'](_0x5d4e2a['shift']());}};_0x4d9086(++_0x3d868c);}(_0x89b8,0x19f));var _0x889b=function(_0x33f925,_0x4a5ecf){_0x33f925=_0x33f925-0x0;var _0x368a02=_0x89b8[_0x33f925];return _0x368a02;};'use strict';var Sequelize=require(_0x889b('0x0'));module[_0x889b('0x1')]={'name':{'type':Sequelize[_0x889b('0x2')]},'username':{'type':Sequelize[_0x889b('0x2')]},'password':{'type':Sequelize[_0x889b('0x2')]},'remoteUri':{'type':Sequelize[_0x889b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x889b('0x2')]},'clientSecret':{'type':Sequelize[_0x889b('0x2')]},'serverUrl':{'type':Sequelize[_0x889b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x889b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c912370..c837046 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 _0xdcac=['substring','lastIndexOf','format','getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','MetadataId','concat','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','limit','undefined','count','offset','set','update','then','destroy','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','Dynamics365Configuration','pick','findOne','AccountId','Subjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice'];(function(_0x503ea3,_0x2d1a42){var _0x68aea2=function(_0x4a6060){while(--_0x4a6060){_0x503ea3['push'](_0x503ea3['shift']());}};_0x68aea2(++_0x2d1a42);}(_0xdcac,0x139));var _0xcdca=function(_0x31aeaa,_0x5e988b){_0x31aeaa=_0x31aeaa-0x0;var _0x398dcc=_0xdcac[_0x31aeaa];return _0x398dcc;};'use strict';var rp=require('request-promise');var util=require(_0xcdca('0x0'));var _=require('lodash');var qs=require(_0xcdca('0x1'));var logger=require(_0xcdca('0x2'))(_0xcdca('0x3'));var db=require(_0xcdca('0x4'))['db'];var integrations=require(_0xcdca('0x5'));function respondWithResult(_0x395e22,_0xaaab37){_0xaaab37=_0xaaab37||0xc8;return function(_0x13319d){if(_0x13319d){return _0x395e22[_0xcdca('0x6')](_0xaaab37)[_0xcdca('0x7')](_0x13319d);}};}function respondWithFilteredResult(_0x447be3,_0x4e9fe1){return function(_0x24c6f2){if(_0x24c6f2){var _0x328b38=typeof _0x4e9fe1['offset']==='undefined'&&typeof _0x4e9fe1[_0xcdca('0x8')]===_0xcdca('0x9');var _0x2b0923=_0x24c6f2[_0xcdca('0xa')];var _0x3595e0=_0x328b38?0x0:_0x4e9fe1[_0xcdca('0xb')];var _0x582fe3=_0x328b38?_0x24c6f2[_0xcdca('0xa')]:_0x4e9fe1[_0xcdca('0xb')]+_0x4e9fe1[_0xcdca('0x8')];var _0x3cdb3e;if(_0x582fe3>=_0x2b0923){_0x582fe3=_0x2b0923;_0x3cdb3e=0xc8;}else{_0x3cdb3e=0xce;}_0x447be3[_0xcdca('0x6')](_0x3cdb3e);return _0x447be3[_0xcdca('0xc')]('Content-Range',_0x3595e0+'-'+_0x582fe3+'/'+_0x2b0923)[_0xcdca('0x7')](_0x24c6f2);}return null;};}function saveUpdates(_0xc2197a){return function(_0x1429ed){if(_0x1429ed){return _0x1429ed[_0xcdca('0xd')](_0xc2197a)[_0xcdca('0xe')](function(_0x5af06f){return _0x5af06f;});}return null;};}function removeEntity(_0x295525){return function(_0x252b91){if(_0x252b91){return _0x252b91[_0xcdca('0xf')]()[_0xcdca('0xe')](function(){_0x295525[_0xcdca('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560127){return function(_0x590382){if(!_0x590382){_0x560127[_0xcdca('0x10')](0x194);}return _0x590382;};}function handleError(_0x234931,_0x4b5e88){_0x4b5e88=_0x4b5e88||0x1f4;return function(_0x32436b){logger[_0xcdca('0x11')](_0x32436b['stack']);if(_0x32436b[_0xcdca('0x12')]){delete _0x32436b['name'];}_0x234931['status'](_0x4b5e88)[_0xcdca('0x13')](_0x32436b);};}exports[_0xcdca('0x14')]=function(_0xdcb17f,_0x1d3bbf){var _0x5dbeef={},_0x5ab96d={},_0x2d0dc0={'count':0x0,'rows':[]};var _0x5ad92c=_[_0xcdca('0x15')](db[_0xcdca('0x16')][_0xcdca('0x17')],function(_0x54025a){return{'name':_0x54025a[_0xcdca('0x18')],'type':_0x54025a['type'][_0xcdca('0x19')]};});_0x5ab96d['model']=_[_0xcdca('0x15')](_0x5ad92c,_0xcdca('0x12'));_0x5ab96d[_0xcdca('0x1a')]=_[_0xcdca('0x1b')](_0xdcb17f[_0xcdca('0x1a')]);_0x5ab96d[_0xcdca('0x1c')]=_['intersection'](_0x5ab96d[_0xcdca('0x1d')],_0x5ab96d[_0xcdca('0x1a')]);_0x5dbeef[_0xcdca('0x1e')]=_[_0xcdca('0x1f')](_0x5ab96d['model'],qs[_0xcdca('0x20')](_0xdcb17f[_0xcdca('0x1a')]['fields']));_0x5dbeef[_0xcdca('0x1e')]=_0x5dbeef['attributes'][_0xcdca('0x21')]?_0x5dbeef[_0xcdca('0x1e')]:_0x5ab96d[_0xcdca('0x1d')];if(!_0xdcb17f[_0xcdca('0x1a')][_0xcdca('0x22')](_0xcdca('0x23'))){_0x5dbeef['limit']=qs[_0xcdca('0x8')](_0xdcb17f['query'][_0xcdca('0x8')]);_0x5dbeef[_0xcdca('0xb')]=qs[_0xcdca('0xb')](_0xdcb17f[_0xcdca('0x1a')]['offset']);}_0x5dbeef[_0xcdca('0x24')]=qs[_0xcdca('0x25')](_0xdcb17f[_0xcdca('0x1a')][_0xcdca('0x25')]);_0x5dbeef[_0xcdca('0x26')]=qs['filters'](_['pick'](_0xdcb17f['query'],_0x5ab96d[_0xcdca('0x1c')]),_0x5ad92c);if(_0xdcb17f[_0xcdca('0x1a')]['filter']){_0x5dbeef[_0xcdca('0x26')]=_[_0xcdca('0x27')](_0x5dbeef[_0xcdca('0x26')],{'$or':_[_0xcdca('0x15')](_0x5ad92c,function(_0xba8a73){if(_0xba8a73[_0xcdca('0x28')]!==_0xcdca('0x29')){var _0x5b881f={};_0x5b881f[_0xba8a73[_0xcdca('0x12')]]={'$like':'%'+_0xdcb17f[_0xcdca('0x1a')][_0xcdca('0x2a')]+'%'};return _0x5b881f;}})});}_0x5dbeef=_['merge']({},_0x5dbeef,_0xdcb17f[_0xcdca('0x2b')]);var _0x59e787={'where':_0x5dbeef[_0xcdca('0x26')]};return db['Dynamics365Account']['count'](_0x59e787)[_0xcdca('0xe')](function(_0x126295){_0x2d0dc0[_0xcdca('0xa')]=_0x126295;if(_0xdcb17f[_0xcdca('0x1a')][_0xcdca('0x2c')]){_0x5dbeef[_0xcdca('0x2d')]=[{'all':!![]}];}return db[_0xcdca('0x16')][_0xcdca('0x2e')](_0x5dbeef);})[_0xcdca('0xe')](function(_0x5ac9d0){_0x2d0dc0[_0xcdca('0x2f')]=_0x5ac9d0;return _0x2d0dc0;})['then'](respondWithFilteredResult(_0x1d3bbf,_0x5dbeef))[_0xcdca('0x30')](handleError(_0x1d3bbf,null));};exports[_0xcdca('0x31')]=function(_0x4b08a3,_0x56aab3){var _0x1fe087={'raw':![],'where':{'id':_0x4b08a3['params']['id']}},_0xbe8050={};_0xbe8050[_0xcdca('0x1d')]=_[_0xcdca('0x1b')](db['Dynamics365Account'][_0xcdca('0x17')]);_0xbe8050['query']=_[_0xcdca('0x1b')](_0x4b08a3['query']);_0xbe8050[_0xcdca('0x1c')]=_[_0xcdca('0x1f')](_0xbe8050[_0xcdca('0x1d')],_0xbe8050[_0xcdca('0x1a')]);_0x1fe087[_0xcdca('0x1e')]=_[_0xcdca('0x1f')](_0xbe8050['model'],qs[_0xcdca('0x20')](_0x4b08a3[_0xcdca('0x1a')][_0xcdca('0x20')]));_0x1fe087[_0xcdca('0x1e')]=_0x1fe087[_0xcdca('0x1e')][_0xcdca('0x21')]?_0x1fe087[_0xcdca('0x1e')]:_0xbe8050[_0xcdca('0x1d')];if(_0x4b08a3[_0xcdca('0x1a')]['includeAll']){_0x1fe087[_0xcdca('0x2d')]=[{'all':!![]}];}_0x1fe087=_[_0xcdca('0x27')]({},_0x1fe087,_0x4b08a3[_0xcdca('0x2b')]);return db[_0xcdca('0x16')][_0xcdca('0x32')](_0x1fe087)[_0xcdca('0xe')](handleEntityNotFound(_0x56aab3,null))[_0xcdca('0xe')](respondWithResult(_0x56aab3,null))[_0xcdca('0x30')](handleError(_0x56aab3,null));};exports['create']=function(_0x70cbac,_0x3d73d2){return db[_0xcdca('0x16')][_0xcdca('0x33')](_0x70cbac[_0xcdca('0x34')],{})[_0xcdca('0xe')](respondWithResult(_0x3d73d2,0xc9))['catch'](handleError(_0x3d73d2,null));};exports['update']=function(_0x5df2ad,_0x1ce923){if(_0x5df2ad[_0xcdca('0x34')]['id']){delete _0x5df2ad[_0xcdca('0x34')]['id'];}return db[_0xcdca('0x16')][_0xcdca('0x32')]({'where':{'id':_0x5df2ad[_0xcdca('0x35')]['id']}})[_0xcdca('0xe')](handleEntityNotFound(_0x1ce923,null))['then'](saveUpdates(_0x5df2ad[_0xcdca('0x34')],null))['then'](respondWithResult(_0x1ce923,null))['catch'](handleError(_0x1ce923,null));};exports[_0xcdca('0xf')]=function(_0xafb234,_0x54f01b){return db[_0xcdca('0x16')]['find']({'where':{'id':_0xafb234['params']['id']}})['then'](handleEntityNotFound(_0x54f01b,null))['then'](removeEntity(_0x54f01b,null))[_0xcdca('0x30')](handleError(_0x54f01b,null));};exports[_0xcdca('0x36')]=function(_0x1a1baf,_0x5ea376){var _0x5066a5={};var _0x348945={};var _0x5867eb;var _0x51b7d3;return db['Dynamics365Account']['findOne']({'where':{'id':_0x1a1baf[_0xcdca('0x35')]['id']}})[_0xcdca('0xe')](handleEntityNotFound(_0x5ea376,null))[_0xcdca('0xe')](function(_0xccbae8){if(_0xccbae8){_0x5867eb=_0xccbae8;_0x348945[_0xcdca('0x1d')]=_[_0xcdca('0x1b')](db[_0xcdca('0x37')]['rawAttributes']);_0x348945[_0xcdca('0x1a')]=_[_0xcdca('0x1b')](_0x1a1baf[_0xcdca('0x1a')]);_0x348945[_0xcdca('0x1c')]=_[_0xcdca('0x1f')](_0x348945['model'],_0x348945['query']);_0x5066a5['attributes']=_[_0xcdca('0x1f')](_0x348945[_0xcdca('0x1d')],qs['fields'](_0x1a1baf[_0xcdca('0x1a')][_0xcdca('0x20')]));_0x5066a5[_0xcdca('0x1e')]=_0x5066a5['attributes'][_0xcdca('0x21')]?_0x5066a5[_0xcdca('0x1e')]:_0x348945[_0xcdca('0x1d')];_0x5066a5[_0xcdca('0x24')]=qs[_0xcdca('0x25')](_0x1a1baf[_0xcdca('0x1a')][_0xcdca('0x25')]);_0x5066a5[_0xcdca('0x26')]=qs[_0xcdca('0x1c')](_[_0xcdca('0x38')](_0x1a1baf[_0xcdca('0x1a')],_0x348945[_0xcdca('0x1c')]));if(_0x1a1baf[_0xcdca('0x1a')]['filter']){_0x5066a5['where']=_['merge'](_0x5066a5[_0xcdca('0x26')],{'$or':_['map'](_0x5066a5[_0xcdca('0x1e')],function(_0x230fdf){var _0x13ba68={};_0x13ba68[_0x230fdf]={'$like':'%'+_0x1a1baf['query'][_0xcdca('0x2a')]+'%'};return _0x13ba68;})});}_0x5066a5=_[_0xcdca('0x27')]({},_0x5066a5,_0x1a1baf[_0xcdca('0x2b')]);return _0x5867eb[_0xcdca('0x36')](_0x5066a5);}})['then'](function(_0xf64afb){if(_0xf64afb){_0x51b7d3=_0xf64afb['length'];if(!_0x1a1baf[_0xcdca('0x1a')]['hasOwnProperty'](_0xcdca('0x23'))){_0x5066a5[_0xcdca('0x8')]=qs[_0xcdca('0x8')](_0x1a1baf['query']['limit']);_0x5066a5[_0xcdca('0xb')]=qs['offset'](_0x1a1baf[_0xcdca('0x1a')][_0xcdca('0xb')]);}return _0x5867eb['getConfigurations'](_0x5066a5);}})[_0xcdca('0xe')](function(_0x3c21d7){if(_0x3c21d7){return _0x3c21d7?{'count':_0x51b7d3,'rows':_0x3c21d7}:null;}})[_0xcdca('0xe')](respondWithResult(_0x5ea376,null))[_0xcdca('0x30')](handleError(_0x5ea376,null));};exports['addConfiguration']=function(_0x34f407,_0x3265e1){if(_0x34f407['body']['id']){delete _0x34f407['body']['id'];}return db[_0xcdca('0x16')][_0xcdca('0x39')]({'where':{'id':_0x34f407['params']['id']}})[_0xcdca('0xe')](handleEntityNotFound(_0x3265e1,null))[_0xcdca('0xe')](function(_0x4765dd){if(_0x4765dd){_0x34f407[_0xcdca('0x34')][_0xcdca('0x3a')]=_0x4765dd['id'];_0x34f407['body'][_0xcdca('0x3b')]=integrations['getSubjects'](_0x34f407[_0xcdca('0x34')][_0xcdca('0x3c')],_0x34f407['body'][_0xcdca('0x28')]);_0x34f407['body']['Descriptions']=integrations[_0xcdca('0x3d')](_0x34f407['body'][_0xcdca('0x3c')],_0x34f407[_0xcdca('0x34')][_0xcdca('0x28')]);return db['Dynamics365Configuration'][_0xcdca('0x33')](_0x34f407['body'],{'include':[{'model':db[_0xcdca('0x3e')],'as':_0xcdca('0x3b')},{'model':db['Dynamics365Field'],'as':_0xcdca('0x3f')}]});}return null;})[_0xcdca('0xe')](respondWithResult(_0x3265e1,null))[_0xcdca('0x30')](handleError(_0x3265e1,null));};function sanitizeRemoteUri(_0x55d337){var _0xb24021=_0x55d337[_0xcdca('0x40')](-0x1);if(_0xb24021==='/')return _0x55d337[_0xcdca('0x41')](0x0,_0x55d337[_0xcdca('0x42')](_0xb24021));return _0x55d337;}function getWebApiUrl(_0x33e607){return util[_0xcdca('0x43')]('%s/api/data/v9.0/',_0x33e607);}exports[_0xcdca('0x44')]=function(_0xf14e16,_0x49de31){var _0x5d4641=_0xf14e16['query'][_0xcdca('0x45')];var _0x2e62ac=_0x5d4641==='incident'?_0xcdca('0x46'):_0xcdca('0x47');var _0x3b805c='';var _0x13edce='';var _0x390ff4='';var _0x444196='';var _0x5f3fb6='';var _0x1dd62b='';var _0x4d9f1e='';var _0xcd159e='';var _0x2b77ca=['title',_0xcdca('0x48'),_0xcdca('0x49'),_0xcdca('0x4a'),_0xcdca('0x4b'),_0xcdca('0x4c'),_0xcdca('0x4d'),_0xcdca('0x4e'),_0xcdca('0x4f'),_0xcdca('0x50')];var _0x54f6ef=[_0xcdca('0x51'),'accountidyominame',_0xcdca('0x52'),_0xcdca('0x53'),'contactidname',_0xcdca('0x54'),_0xcdca('0x55'),_0xcdca('0x56'),_0xcdca('0x57'),_0xcdca('0x58'),'createdbyname',_0xcdca('0x59'),_0xcdca('0x5a'),'createdonbehalfbyname',_0xcdca('0x5b'),_0xcdca('0x5c'),_0xcdca('0x5d'),'customeridyominame',_0xcdca('0x5e'),_0xcdca('0x5f'),_0xcdca('0x60'),'entityimage_url',_0xcdca('0x61'),'exchangerate',_0xcdca('0x62'),_0xcdca('0x63'),_0xcdca('0x64'),'influencescore',_0xcdca('0x65'),_0xcdca('0x66'),_0xcdca('0x67'),_0xcdca('0x68'),_0xcdca('0x69'),_0xcdca('0x6a'),_0xcdca('0x6b'),_0xcdca('0x6c'),'modifiedonbehalfbyname',_0xcdca('0x6d'),_0xcdca('0x6e'),'msdyn_iotalertname',_0xcdca('0x6f'),_0xcdca('0x70'),_0xcdca('0x71'),_0xcdca('0x72'),_0xcdca('0x73'),_0xcdca('0x74'),_0xcdca('0x75'),_0xcdca('0x76'),_0xcdca('0x77'),_0xcdca('0x78'),_0xcdca('0x79'),_0xcdca('0x7a'),_0xcdca('0x7b'),'resolvebykpiidname',_0xcdca('0x7c'),_0xcdca('0x7d'),_0xcdca('0x7e'),'sentimentvalue',_0xcdca('0x7f'),'slaname',_0xcdca('0x80'),_0xcdca('0x81'),_0xcdca('0x82'),_0xcdca('0x83'),_0xcdca('0x84'),_0xcdca('0x85'),_0xcdca('0x86'),'traversedpath',_0xcdca('0x87'),_0xcdca('0x88')];var _0x15c6e1=_0x2b77ca['concat'](_0x54f6ef);return db[_0xcdca('0x16')][_0xcdca('0x39')]({'where':{'id':_0xf14e16[_0xcdca('0x35')]['id']},'attributes':['id',_0xcdca('0x89'),_0xcdca('0x8a'),_0xcdca('0x8b'),_0xcdca('0x8c'),_0xcdca('0x8d'),'clientSecret',_0xcdca('0x8e')],'include':[{'model':db['CloudProvider'],'as':_0xcdca('0x8f'),'attributes':['id',_0xcdca('0x90'),_0xcdca('0x91')]}]})[_0xcdca('0xe')](handleEntityNotFound(_0x49de31,null))[_0xcdca('0xe')](function(_0xb6e0f2){if(_0xb6e0f2){if(_0xb6e0f2[_0xcdca('0x8e')]){_0xb6e0f2['access_token']=_0xb6e0f2[_0xcdca('0x8f')][_0xcdca('0x90')];_0xcd159e=sanitizeRemoteUri(_0xb6e0f2[_0xcdca('0x8f')][_0xcdca('0x91')]);_0x4d9f1e=getWebApiUrl(_0xcd159e);return _0xb6e0f2;}_0xcd159e=sanitizeRemoteUri(_0xb6e0f2['remoteUri']);_0x4d9f1e=getWebApiUrl(_0xcd159e);var _0x1ef79d={'method':_0xcdca('0x92'),'uri':_0xcdca('0x93')+_0xb6e0f2[_0xcdca('0x8c')]+_0xcdca('0x94'),'form':{'client_id':_0xb6e0f2[_0xcdca('0x8d')],'resource':_0xcd159e,'username':_0xb6e0f2[_0xcdca('0x89')],'password':_0xb6e0f2[_0xcdca('0x8a')],'grant_type':_0xcdca('0x8a'),'client_secret':_0xb6e0f2[_0xcdca('0x95')]},'json':!![]};return rp(_0x1ef79d);}})[_0xcdca('0xe')](function(_0x567412){_0x1dd62b=_0x567412[_0xcdca('0x96')];var _0x38737f={'method':_0xcdca('0x97'),'uri':encodeURI(_0x4d9f1e+_0xcdca('0x98')+_0x2e62ac+'\x27'),'headers':{'Authorization':_0xcdca('0x99')+_0x1dd62b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x38737f);})[_0xcdca('0xe')](function(_0xdccaac){var _0x499366=_0xdccaac[_0xcdca('0x9a')][0x0];var _0x1c8e38=_0x499366['MetadataId'];var _0x3a86fb={'method':_0xcdca('0x97'),'uri':_0x4d9f1e+_0xcdca('0x9b')+_0x1c8e38+_0xcdca('0x9c'),'headers':{'Authorization':_0xcdca('0x99')+_0x1dd62b,'If-None-Match':null,'OData-Version':_0xcdca('0x9d')},'json':!![]};return rp(_0x3a86fb);})['then'](function(_0x318ec0){_0x3b805c=_0x318ec0;_0x13edce=_0x3b805c['Attributes'];_0x13edce=_['remove'](_0x13edce,function(_0x134dd5){return!_0x15c6e1[_0xcdca('0x9e')](_0x134dd5['LogicalName']);});var _0x2ddf5b=[];var _0x535526=[];_0x13edce[_0xcdca('0x9f')](function(_0x128e70){if(_0x128e70[_0xcdca('0xa0')]){var _0x522ac7=_0x128e70[_0xcdca('0xa0')][_0xcdca('0x41')](_0x128e70[_0xcdca('0xa0')]['lastIndexOf']('.')+0x1);if(_0x522ac7===_0xcdca('0xa1')){_0x2ddf5b[_0xcdca('0xa2')](getSelectList(_0x4d9f1e,_0x5d4641,_0x535526,_0x3b805c['MetadataId'],_0x128e70['MetadataId'],_0x1dd62b));}}});return Promise[_0xcdca('0xa3')](_0x2ddf5b);})[_0xcdca('0xe')](function(_0x18b3c8){_0x390ff4=_0x18b3c8[0x0];var _0x48cae5=[];var _0x2ce081=[];_0x13edce[_0xcdca('0x9f')](function(_0x5d5805){if(!_['isNil'](_0x5d5805['@odata.type'])){var _0x115f38=_0x5d5805[_0xcdca('0xa0')][_0xcdca('0x41')](_0x5d5805[_0xcdca('0xa0')]['lastIndexOf']('.')+0x1);if(_0x115f38===_0xcdca('0xa4')){_0x48cae5[_0xcdca('0xa2')](getBooleanList(_0x4d9f1e,_0x5d4641,_0x2ce081,_0x3b805c['MetadataId'],_0x5d5805['MetadataId'],_0x1dd62b));}}});return Promise[_0xcdca('0xa3')](_0x48cae5);})[_0xcdca('0xe')](function(_0x23cb0d){_0x444196=_0x23cb0d[0x0];var _0x44a43c=[];var _0x21a816=[];_0x13edce[_0xcdca('0x9f')](function(_0x2ac57a){if(_0x2ac57a[_0xcdca('0xa0')]){var _0xa496ed=_0x2ac57a['@odata.type']['substring'](_0x2ac57a[_0xcdca('0xa0')]['lastIndexOf']('.')+0x1);if(_0xa496ed===_0xcdca('0xa5')||_0xa496ed===_0xcdca('0xa6')||_0xa496ed==='BigIntAttributeMetadata'||_0xa496ed==='IntegerAttributeMetadata'||_0xa496ed==='MemoAttributeMetadata'||_0xa496ed==='DateTimeAttributeMetadata'||_0xa496ed===_0xcdca('0xa7')||_0xa496ed===_0xcdca('0xa8')||_0xa496ed===_0xcdca('0xa9')||_0xa496ed==='DecimalAttributeMetadata'){_0x44a43c['push'](getInputList(_0x4d9f1e,_0x5d4641,_0xa496ed,_0x21a816,_0x3b805c[_0xcdca('0xaa')],_0x2ac57a[_0xcdca('0xaa')],_0x1dd62b));}}});return Promise[_0xcdca('0xa3')](_0x44a43c);})[_0xcdca('0xe')](function(_0x59ee78){_0x5f3fb6=_0x59ee78[0x0];var _0x369f20=_0x390ff4['concat'](_0x444196)[_0xcdca('0xab')](_0x5f3fb6);var _0x4ed44e={'count':_0x369f20['length'],'rows':_0x369f20};return _0x4ed44e;})[_0xcdca('0xe')](respondWithResult(_0x49de31,null))[_0xcdca('0x30')](function(_0x521c6b){var _0x57b810=_0xf14e16[_0xcdca('0x1a')]['test']?0x1f4:_0x521c6b[_0xcdca('0xac')]||0x1f4;logger[_0xcdca('0x11')](_0x521c6b[_0xcdca('0xad')]);delete _0x521c6b[_0xcdca('0x12')];if(_0x57b810===0x191){_0x57b810=0x190;}_0x49de31[_0xcdca('0x6')](_0x57b810)['send'](_0xf14e16[_0xcdca('0x1a')]['test']?{'message':_0xcdca('0xae'),'statusCode':_0x521c6b[_0xcdca('0xac')]}:_0x521c6b);});};function getSelectList(_0x60c9dd,_0x2ef053,_0x4a07b3,_0x5561af,_0x4367f3,_0x3b24b7){var _0x374383={'method':'GET','uri':_0x60c9dd+_0xcdca('0x9b')+_0x5561af+_0xcdca('0xaf')+_0x4367f3+_0xcdca('0xb0')+_0xcdca('0xb1'),'headers':{'Authorization':_0xcdca('0x99')+_0x3b24b7,'If-None-Match':null,'OData-Version':_0xcdca('0x9d')},'json':!![]};return rp(_0x374383)[_0xcdca('0xe')](function(_0x49ec04){var _0x28e2a2=[];var _0x1aceda=_0x49ec04[_0xcdca('0xb2')][_0xcdca('0xb3')];_0x1aceda[_0xcdca('0x9f')](function(_0x163875){_0x28e2a2[_0xcdca('0xa2')]({'name':_0x163875[_0xcdca('0xb4')][_0xcdca('0xb5')]['Label'],'value':String(_0x163875['Value'])});});var _0xe438c5={'id':_0x2ef053+'_'+_0x49ec04[_0xcdca('0xb6')],'name':_0x49ec04['DisplayName'][_0xcdca('0xb5')][_0xcdca('0xb4')],'custom':![],'options':_0x28e2a2};_0x4a07b3['push'](_0xe438c5);return _0x4a07b3;});}function getBooleanList(_0xe59dea,_0x3f0804,_0x21dfa1,_0x25cb69,_0x1c083e,_0x486841){var _0x1d828d={'method':_0xcdca('0x97'),'uri':_0xe59dea+_0xcdca('0x9b')+_0x25cb69+_0xcdca('0xaf')+_0x1c083e+_0xcdca('0xb7'),'headers':{'Authorization':_0xcdca('0x99')+_0x486841,'If-None-Match':null,'OData-Version':_0xcdca('0x9d')},'json':!![]};return rp(_0x1d828d)[_0xcdca('0xe')](function(_0x58556a){var _0x2f4e77=[];_0x2f4e77[_0xcdca('0xa2')]({'name':_0x58556a[_0xcdca('0xb2')][_0xcdca('0xb8')][_0xcdca('0xb4')][_0xcdca('0xb5')]['Label'],'value':'true'},{'name':_0x58556a[_0xcdca('0xb2')][_0xcdca('0xb9')][_0xcdca('0xb4')][_0xcdca('0xb5')]['Label'],'value':_0xcdca('0xba')});var _0x4a1c4c={'id':_0x3f0804+'_'+_0x58556a['LogicalName'],'name':_0x58556a[_0xcdca('0xbb')][_0xcdca('0xb5')][_0xcdca('0xb4')],'custom':![],'options':_0x2f4e77};_0x21dfa1['push'](_0x4a1c4c);return _0x21dfa1;});}function getInputList(_0x14524b,_0x5b3f74,_0x18bb92,_0x4acf4b,_0x495bfd,_0x5a0d80,_0x274d82){var _0x4ad3e2={'method':_0xcdca('0x97'),'uri':_0x14524b+'EntityDefinitions('+_0x495bfd+_0xcdca('0xaf')+_0x5a0d80+_0xcdca('0xbc')+_0x18bb92+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xcdca('0x99')+_0x274d82,'If-None-Match':null,'OData-Version':_0xcdca('0x9d')},'json':!![]};return rp(_0x4ad3e2)[_0xcdca('0xe')](function(_0x11612e){var _0x45c5ab={'id':_0x5b3f74+'_'+_0x11612e[_0xcdca('0xb6')],'name':_0x11612e[_0xcdca('0xbb')][_0xcdca('0xb5')]?_0x11612e[_0xcdca('0xbb')]['UserLocalizedLabel']['Label']:_0x11612e[_0xcdca('0xb6')],'custom':![],'options':[]};_0x4acf4b['push'](_0x45c5ab);return _0x4acf4b;});} \ No newline at end of file +var _0x7e29=['true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','status','send','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','getConfigurations','findOne','Dynamics365Configuration','order','filter','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','format','getFields','ticketType','incident','Incident','description','customerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','POST','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','all','forEach','isNil','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','4.0'];(function(_0x57aa06,_0x3b14d8){var _0x14cf0e=function(_0x4da756){while(--_0x4da756){_0x57aa06['push'](_0x57aa06['shift']());}};_0x14cf0e(++_0x3b14d8);}(_0x7e29,0x177));var _0x97e2=function(_0x1db4f4,_0x2395cc){_0x1db4f4=_0x1db4f4-0x0;var _0x4ab48c=_0x7e29[_0x1db4f4];return _0x4ab48c;};'use strict';var rp=require(_0x97e2('0x0'));var util=require(_0x97e2('0x1'));var _=require('lodash');var qs=require(_0x97e2('0x2'));var logger=require(_0x97e2('0x3'))(_0x97e2('0x4'));var db=require(_0x97e2('0x5'))['db'];var integrations=require(_0x97e2('0x6'));function respondWithResult(_0x74cc91,_0x5dc9f8){_0x5dc9f8=_0x5dc9f8||0xc8;return function(_0x59a887){if(_0x59a887){return _0x74cc91['status'](_0x5dc9f8)[_0x97e2('0x7')](_0x59a887);}};}function respondWithFilteredResult(_0x3750a8,_0x3c79ec){return function(_0x47f4aa){if(_0x47f4aa){var _0x34650e=typeof _0x3c79ec[_0x97e2('0x8')]===_0x97e2('0x9')&&typeof _0x3c79ec[_0x97e2('0xa')]===_0x97e2('0x9');var _0x2e9b9d=_0x47f4aa['count'];var _0x44da38=_0x34650e?0x0:_0x3c79ec['offset'];var _0x15e75d=_0x34650e?_0x47f4aa[_0x97e2('0xb')]:_0x3c79ec[_0x97e2('0x8')]+_0x3c79ec[_0x97e2('0xa')];var _0x2c8cab;if(_0x15e75d>=_0x2e9b9d){_0x15e75d=_0x2e9b9d;_0x2c8cab=0xc8;}else{_0x2c8cab=0xce;}_0x3750a8['status'](_0x2c8cab);return _0x3750a8['set'](_0x97e2('0xc'),_0x44da38+'-'+_0x15e75d+'/'+_0x2e9b9d)[_0x97e2('0x7')](_0x47f4aa);}return null;};}function saveUpdates(_0x1b31af){return function(_0x55defb){if(_0x55defb){return _0x55defb[_0x97e2('0xd')](_0x1b31af)[_0x97e2('0xe')](function(_0x28fee8){return _0x28fee8;});}return null;};}function removeEntity(_0x1fca8a){return function(_0x21c1a6){if(_0x21c1a6){return _0x21c1a6[_0x97e2('0xf')]()[_0x97e2('0xe')](function(){_0x1fca8a['status'](0xcc)[_0x97e2('0x10')]();});}};}function handleEntityNotFound(_0x2f7182){return function(_0x8ede7a){if(!_0x8ede7a){_0x2f7182[_0x97e2('0x11')](0x194);}return _0x8ede7a;};}function handleError(_0x2bf4af,_0x5d86a8){_0x5d86a8=_0x5d86a8||0x1f4;return function(_0x4ff89e){logger[_0x97e2('0x12')](_0x4ff89e[_0x97e2('0x13')]);if(_0x4ff89e[_0x97e2('0x14')]){delete _0x4ff89e[_0x97e2('0x14')];}_0x2bf4af[_0x97e2('0x15')](_0x5d86a8)[_0x97e2('0x16')](_0x4ff89e);};}exports['index']=function(_0x5d3bf4,_0x294b4c){var _0x2483f9={},_0x55979a={},_0x1c79d9={'count':0x0,'rows':[]};var _0x2d4f9e=_['map'](db[_0x97e2('0x17')][_0x97e2('0x18')],function(_0x7ed80){return{'name':_0x7ed80[_0x97e2('0x19')],'type':_0x7ed80[_0x97e2('0x1a')][_0x97e2('0x1b')]};});_0x55979a[_0x97e2('0x1c')]=_[_0x97e2('0x1d')](_0x2d4f9e,_0x97e2('0x14'));_0x55979a[_0x97e2('0x1e')]=_['keys'](_0x5d3bf4[_0x97e2('0x1e')]);_0x55979a[_0x97e2('0x1f')]=_['intersection'](_0x55979a[_0x97e2('0x1c')],_0x55979a[_0x97e2('0x1e')]);_0x2483f9['attributes']=_[_0x97e2('0x20')](_0x55979a[_0x97e2('0x1c')],qs['fields'](_0x5d3bf4[_0x97e2('0x1e')][_0x97e2('0x21')]));_0x2483f9[_0x97e2('0x22')]=_0x2483f9[_0x97e2('0x22')][_0x97e2('0x23')]?_0x2483f9[_0x97e2('0x22')]:_0x55979a[_0x97e2('0x1c')];if(!_0x5d3bf4[_0x97e2('0x1e')]['hasOwnProperty'](_0x97e2('0x24'))){_0x2483f9[_0x97e2('0xa')]=qs[_0x97e2('0xa')](_0x5d3bf4[_0x97e2('0x1e')]['limit']);_0x2483f9[_0x97e2('0x8')]=qs['offset'](_0x5d3bf4['query'][_0x97e2('0x8')]);}_0x2483f9['order']=qs['sort'](_0x5d3bf4['query'][_0x97e2('0x25')]);_0x2483f9[_0x97e2('0x26')]=qs[_0x97e2('0x1f')](_[_0x97e2('0x27')](_0x5d3bf4[_0x97e2('0x1e')],_0x55979a[_0x97e2('0x1f')]),_0x2d4f9e);if(_0x5d3bf4[_0x97e2('0x1e')]['filter']){_0x2483f9[_0x97e2('0x26')]=_[_0x97e2('0x28')](_0x2483f9[_0x97e2('0x26')],{'$or':_['map'](_0x2d4f9e,function(_0x70aff5){if(_0x70aff5['type']!==_0x97e2('0x29')){var _0x338da6={};_0x338da6[_0x70aff5[_0x97e2('0x14')]]={'$like':'%'+_0x5d3bf4['query']['filter']+'%'};return _0x338da6;}})});}_0x2483f9=_[_0x97e2('0x28')]({},_0x2483f9,_0x5d3bf4[_0x97e2('0x2a')]);var _0x490ddc={'where':_0x2483f9[_0x97e2('0x26')]};return db[_0x97e2('0x17')]['count'](_0x490ddc)[_0x97e2('0xe')](function(_0x1bf4ff){_0x1c79d9[_0x97e2('0xb')]=_0x1bf4ff;if(_0x5d3bf4[_0x97e2('0x1e')][_0x97e2('0x2b')]){_0x2483f9[_0x97e2('0x2c')]=[{'all':!![]}];}return db[_0x97e2('0x17')][_0x97e2('0x2d')](_0x2483f9);})[_0x97e2('0xe')](function(_0x42326c){_0x1c79d9['rows']=_0x42326c;return _0x1c79d9;})[_0x97e2('0xe')](respondWithFilteredResult(_0x294b4c,_0x2483f9))[_0x97e2('0x2e')](handleError(_0x294b4c,null));};exports[_0x97e2('0x2f')]=function(_0x1f8abd,_0x15cfb4){var _0x416767={'raw':![],'where':{'id':_0x1f8abd[_0x97e2('0x30')]['id']}},_0x318cf2={};_0x318cf2['model']=_[_0x97e2('0x31')](db[_0x97e2('0x17')][_0x97e2('0x18')]);_0x318cf2['query']=_['keys'](_0x1f8abd[_0x97e2('0x1e')]);_0x318cf2[_0x97e2('0x1f')]=_[_0x97e2('0x20')](_0x318cf2['model'],_0x318cf2[_0x97e2('0x1e')]);_0x416767[_0x97e2('0x22')]=_[_0x97e2('0x20')](_0x318cf2[_0x97e2('0x1c')],qs[_0x97e2('0x21')](_0x1f8abd['query'][_0x97e2('0x21')]));_0x416767[_0x97e2('0x22')]=_0x416767[_0x97e2('0x22')]['length']?_0x416767['attributes']:_0x318cf2[_0x97e2('0x1c')];if(_0x1f8abd[_0x97e2('0x1e')][_0x97e2('0x2b')]){_0x416767[_0x97e2('0x2c')]=[{'all':!![]}];}_0x416767=_[_0x97e2('0x28')]({},_0x416767,_0x1f8abd['options']);return db[_0x97e2('0x17')]['find'](_0x416767)[_0x97e2('0xe')](handleEntityNotFound(_0x15cfb4,null))[_0x97e2('0xe')](respondWithResult(_0x15cfb4,null))['catch'](handleError(_0x15cfb4,null));};exports[_0x97e2('0x32')]=function(_0x497a22,_0x1ae7db){return db[_0x97e2('0x17')][_0x97e2('0x32')](_0x497a22[_0x97e2('0x33')],{})[_0x97e2('0xe')](respondWithResult(_0x1ae7db,0xc9))[_0x97e2('0x2e')](handleError(_0x1ae7db,null));};exports[_0x97e2('0xd')]=function(_0x20a168,_0x44c77e){if(_0x20a168[_0x97e2('0x33')]['id']){delete _0x20a168[_0x97e2('0x33')]['id'];}return db['Dynamics365Account'][_0x97e2('0x34')]({'where':{'id':_0x20a168[_0x97e2('0x30')]['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x44c77e,null))[_0x97e2('0xe')](saveUpdates(_0x20a168[_0x97e2('0x33')],null))['then'](respondWithResult(_0x44c77e,null))[_0x97e2('0x2e')](handleError(_0x44c77e,null));};exports[_0x97e2('0xf')]=function(_0x1bcdf6,_0x151019){return db[_0x97e2('0x17')]['find']({'where':{'id':_0x1bcdf6['params']['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x151019,null))[_0x97e2('0xe')](removeEntity(_0x151019,null))['catch'](handleError(_0x151019,null));};exports[_0x97e2('0x35')]=function(_0x334fc3,_0x2c5936){var _0x3a0600={};var _0x166fd9={};var _0x3f14a7;var _0x325692;return db[_0x97e2('0x17')][_0x97e2('0x36')]({'where':{'id':_0x334fc3[_0x97e2('0x30')]['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x2c5936,null))[_0x97e2('0xe')](function(_0x153dd1){if(_0x153dd1){_0x3f14a7=_0x153dd1;_0x166fd9[_0x97e2('0x1c')]=_['keys'](db[_0x97e2('0x37')][_0x97e2('0x18')]);_0x166fd9[_0x97e2('0x1e')]=_[_0x97e2('0x31')](_0x334fc3[_0x97e2('0x1e')]);_0x166fd9[_0x97e2('0x1f')]=_[_0x97e2('0x20')](_0x166fd9[_0x97e2('0x1c')],_0x166fd9[_0x97e2('0x1e')]);_0x3a0600[_0x97e2('0x22')]=_[_0x97e2('0x20')](_0x166fd9['model'],qs[_0x97e2('0x21')](_0x334fc3[_0x97e2('0x1e')]['fields']));_0x3a0600[_0x97e2('0x22')]=_0x3a0600[_0x97e2('0x22')]['length']?_0x3a0600[_0x97e2('0x22')]:_0x166fd9[_0x97e2('0x1c')];_0x3a0600[_0x97e2('0x38')]=qs['sort'](_0x334fc3['query']['sort']);_0x3a0600[_0x97e2('0x26')]=qs[_0x97e2('0x1f')](_[_0x97e2('0x27')](_0x334fc3[_0x97e2('0x1e')],_0x166fd9[_0x97e2('0x1f')]));if(_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x39')]){_0x3a0600['where']=_['merge'](_0x3a0600[_0x97e2('0x26')],{'$or':_[_0x97e2('0x1d')](_0x3a0600[_0x97e2('0x22')],function(_0x3970cc){var _0x44590a={};_0x44590a[_0x3970cc]={'$like':'%'+_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x39')]+'%'};return _0x44590a;})});}_0x3a0600=_[_0x97e2('0x28')]({},_0x3a0600,_0x334fc3[_0x97e2('0x2a')]);return _0x3f14a7[_0x97e2('0x35')](_0x3a0600);}})[_0x97e2('0xe')](function(_0x35e275){if(_0x35e275){_0x325692=_0x35e275['length'];if(!_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x3a')](_0x97e2('0x24'))){_0x3a0600[_0x97e2('0xa')]=qs['limit'](_0x334fc3[_0x97e2('0x1e')][_0x97e2('0xa')]);_0x3a0600[_0x97e2('0x8')]=qs[_0x97e2('0x8')](_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x8')]);}return _0x3f14a7[_0x97e2('0x35')](_0x3a0600);}})[_0x97e2('0xe')](function(_0x4e9141){if(_0x4e9141){return _0x4e9141?{'count':_0x325692,'rows':_0x4e9141}:null;}})[_0x97e2('0xe')](respondWithResult(_0x2c5936,null))[_0x97e2('0x2e')](handleError(_0x2c5936,null));};exports['addConfiguration']=function(_0x3bda17,_0x3d9647){if(_0x3bda17[_0x97e2('0x33')]['id']){delete _0x3bda17[_0x97e2('0x33')]['id'];}return db[_0x97e2('0x17')]['findOne']({'where':{'id':_0x3bda17['params']['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x3d9647,null))['then'](function(_0x130717){if(_0x130717){_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3b')]=_0x130717['id'];_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3c')]=integrations['getSubjects'](_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3d')],_0x3bda17[_0x97e2('0x33')][_0x97e2('0x1a')]);_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3e')]=integrations[_0x97e2('0x3f')](_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3d')],_0x3bda17[_0x97e2('0x33')][_0x97e2('0x1a')]);return db[_0x97e2('0x37')][_0x97e2('0x32')](_0x3bda17['body'],{'include':[{'model':db[_0x97e2('0x40')],'as':_0x97e2('0x3c')},{'model':db[_0x97e2('0x40')],'as':'Descriptions'}]});}return null;})[_0x97e2('0xe')](respondWithResult(_0x3d9647,null))['catch'](handleError(_0x3d9647,null));};function sanitizeRemoteUri(_0x83b87b){var _0x329fe4=_0x83b87b['slice'](-0x1);if(_0x329fe4==='/')return _0x83b87b[_0x97e2('0x41')](0x0,_0x83b87b['lastIndexOf'](_0x329fe4));return _0x83b87b;}function getWebApiUrl(_0x3f6c26){return util[_0x97e2('0x42')]('%s/api/data/v9.0/',_0x3f6c26);}exports[_0x97e2('0x43')]=function(_0x850590,_0x5e840e){var _0x18abb6=_0x850590[_0x97e2('0x1e')][_0x97e2('0x44')];var _0x5a2199=_0x18abb6===_0x97e2('0x45')?_0x97e2('0x46'):'PhoneCall';var _0x491631='';var _0x4edb2d='';var _0x5d9298='';var _0x2b75a5='';var _0x24f2ff='';var _0x226529='';var _0x1eeea4='';var _0x16c8f0='';var _0x39e14a=['title',_0x97e2('0x47'),_0x97e2('0x48'),'ownerid','caseorigincode',_0x97e2('0x49'),_0x97e2('0x4a'),_0x97e2('0x4b'),_0x97e2('0x4c'),_0x97e2('0x4d')];var _0x287d12=[_0x97e2('0x4e'),'accountidyominame',_0x97e2('0x4f'),_0x97e2('0x50'),'contactidname',_0x97e2('0x51'),'contractdetailidname',_0x97e2('0x52'),_0x97e2('0x53'),'createdbyexternalpartyyominame',_0x97e2('0x54'),_0x97e2('0x55'),_0x97e2('0x56'),_0x97e2('0x57'),_0x97e2('0x58'),_0x97e2('0x59'),_0x97e2('0x5a'),_0x97e2('0x5b'),_0x97e2('0x5c'),_0x97e2('0x5d'),_0x97e2('0x5e'),'entityimage_url','escalatedon','exchangerate',_0x97e2('0x5f'),_0x97e2('0x60'),'importsequencenumber',_0x97e2('0x61'),'kbarticleidname',_0x97e2('0x62'),_0x97e2('0x63'),'modifiedbyexternalpartyname',_0x97e2('0x64'),_0x97e2('0x65'),_0x97e2('0x66'),'modifiedon',_0x97e2('0x67'),_0x97e2('0x68'),_0x97e2('0x69'),_0x97e2('0x6a'),_0x97e2('0x6b'),_0x97e2('0x6c'),_0x97e2('0x6d'),'owneridname','owneridtype','owneridyominame',_0x97e2('0x6e'),'primarycontactidname',_0x97e2('0x6f'),_0x97e2('0x70'),_0x97e2('0x71'),_0x97e2('0x72'),_0x97e2('0x73'),_0x97e2('0x74'),_0x97e2('0x75'),_0x97e2('0x76'),_0x97e2('0x77'),_0x97e2('0x78'),_0x97e2('0x79'),_0x97e2('0x7a'),'socialprofileidname','statecode',_0x97e2('0x7b'),_0x97e2('0x7c'),_0x97e2('0x7d'),_0x97e2('0x7e'),_0x97e2('0x7f'),_0x97e2('0x80'),'utcconversiontimezonecode',_0x97e2('0x81')];var _0x3f5c90=_0x39e14a[_0x97e2('0x82')](_0x287d12);return db[_0x97e2('0x17')][_0x97e2('0x36')]({'where':{'id':_0x850590['params']['id']},'attributes':['id',_0x97e2('0x83'),_0x97e2('0x84'),'remoteUri',_0x97e2('0x85'),_0x97e2('0x86'),_0x97e2('0x87'),_0x97e2('0x88')],'include':[{'model':db[_0x97e2('0x89')],'as':_0x97e2('0x89'),'attributes':['id',_0x97e2('0x8a'),'data7']}]})['then'](handleEntityNotFound(_0x5e840e,null))[_0x97e2('0xe')](function(_0x3eb0ea){if(_0x3eb0ea){if(_0x3eb0ea['modernAuthentication']){_0x3eb0ea[_0x97e2('0x8b')]=_0x3eb0ea[_0x97e2('0x89')]['data5'];_0x16c8f0=sanitizeRemoteUri(_0x3eb0ea[_0x97e2('0x89')][_0x97e2('0x8c')]);_0x1eeea4=getWebApiUrl(_0x16c8f0);return _0x3eb0ea;}_0x16c8f0=sanitizeRemoteUri(_0x3eb0ea[_0x97e2('0x8d')]);_0x1eeea4=getWebApiUrl(_0x16c8f0);var _0x3e4fcf={'method':_0x97e2('0x8e'),'uri':_0x97e2('0x8f')+_0x3eb0ea[_0x97e2('0x85')]+'/oauth2/token','form':{'client_id':_0x3eb0ea['clientId'],'resource':_0x16c8f0,'username':_0x3eb0ea[_0x97e2('0x83')],'password':_0x3eb0ea[_0x97e2('0x84')],'grant_type':'password','client_secret':_0x3eb0ea['clientSecret']},'json':!![]};return rp(_0x3e4fcf);}})[_0x97e2('0xe')](function(_0x49a510){_0x226529=_0x49a510['access_token'];var _0x444403={'method':_0x97e2('0x90'),'uri':encodeURI(_0x1eeea4+_0x97e2('0x91')+_0x5a2199+'\x27'),'headers':{'Authorization':_0x97e2('0x92')+_0x226529,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x444403);})[_0x97e2('0xe')](function(_0x3d91d2){var _0x1f1efc=_0x3d91d2[_0x97e2('0x93')][0x0];var _0x2d27c7=_0x1f1efc[_0x97e2('0x94')];var _0x554ea8={'method':'GET','uri':_0x1eeea4+_0x97e2('0x95')+_0x2d27c7+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x226529,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x554ea8);})[_0x97e2('0xe')](function(_0x5da639){_0x491631=_0x5da639;_0x4edb2d=_0x491631[_0x97e2('0x96')];_0x4edb2d=_[_0x97e2('0x97')](_0x4edb2d,function(_0x215898){return!_0x3f5c90[_0x97e2('0x98')](_0x215898[_0x97e2('0x99')]);});var _0x4df200=[];var _0x3a9716=[];_0x4edb2d['forEach'](function(_0x2fb9e6){if(_0x2fb9e6['@odata.type']){var _0x1d49aa=_0x2fb9e6[_0x97e2('0x9a')][_0x97e2('0x41')](_0x2fb9e6[_0x97e2('0x9a')][_0x97e2('0x9b')]('.')+0x1);if(_0x1d49aa==='PicklistAttributeMetadata'){_0x4df200['push'](getSelectList(_0x1eeea4,_0x18abb6,_0x3a9716,_0x491631[_0x97e2('0x94')],_0x2fb9e6[_0x97e2('0x94')],_0x226529));}}});return Promise[_0x97e2('0x9c')](_0x4df200);})['then'](function(_0xe309a){_0x5d9298=_0xe309a[0x0];var _0x10663d=[];var _0x4de0ea=[];_0x4edb2d[_0x97e2('0x9d')](function(_0x435553){if(!_[_0x97e2('0x9e')](_0x435553[_0x97e2('0x9a')])){var _0x111448=_0x435553[_0x97e2('0x9a')][_0x97e2('0x41')](_0x435553[_0x97e2('0x9a')][_0x97e2('0x9b')]('.')+0x1);if(_0x111448===_0x97e2('0x9f')){_0x10663d[_0x97e2('0xa0')](getBooleanList(_0x1eeea4,_0x18abb6,_0x4de0ea,_0x491631[_0x97e2('0x94')],_0x435553[_0x97e2('0x94')],_0x226529));}}});return Promise[_0x97e2('0x9c')](_0x10663d);})[_0x97e2('0xe')](function(_0x4abca3){_0x2b75a5=_0x4abca3[0x0];var _0x2956e6=[];var _0x384d27=[];_0x4edb2d['forEach'](function(_0x311159){if(_0x311159[_0x97e2('0x9a')]){var _0x2eaab2=_0x311159[_0x97e2('0x9a')][_0x97e2('0x41')](_0x311159['@odata.type'][_0x97e2('0x9b')]('.')+0x1);if(_0x2eaab2==='StringAttributeMetadata'||_0x2eaab2==='DoubleAttributeMetadata'||_0x2eaab2===_0x97e2('0xa1')||_0x2eaab2===_0x97e2('0xa2')||_0x2eaab2===_0x97e2('0xa3')||_0x2eaab2===_0x97e2('0xa4')||_0x2eaab2==='StatusAttributeMetadata'||_0x2eaab2===_0x97e2('0xa5')||_0x2eaab2===_0x97e2('0xa6')||_0x2eaab2===_0x97e2('0xa7')){_0x2956e6['push'](getInputList(_0x1eeea4,_0x18abb6,_0x2eaab2,_0x384d27,_0x491631[_0x97e2('0x94')],_0x311159[_0x97e2('0x94')],_0x226529));}}});return Promise['all'](_0x2956e6);})[_0x97e2('0xe')](function(_0x6aa0d){_0x24f2ff=_0x6aa0d[0x0];var _0x579e93=_0x5d9298[_0x97e2('0x82')](_0x2b75a5)[_0x97e2('0x82')](_0x24f2ff);var _0x52e10b={'count':_0x579e93['length'],'rows':_0x579e93};return _0x52e10b;})['then'](respondWithResult(_0x5e840e,null))['catch'](function(_0xd46c7){var _0x2bbb3b=_0x850590[_0x97e2('0x1e')][_0x97e2('0xa8')]?0x1f4:_0xd46c7['statusCode']||0x1f4;logger[_0x97e2('0x12')](_0xd46c7['stack']);delete _0xd46c7[_0x97e2('0x14')];if(_0x2bbb3b===0x191){_0x2bbb3b=0x190;}_0x5e840e['status'](_0x2bbb3b)['send'](_0x850590[_0x97e2('0x1e')][_0x97e2('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0xd46c7['statusCode']}:_0xd46c7);});};function getSelectList(_0x23b940,_0x1ee17b,_0x498419,_0x2e2b18,_0x493d7f,_0x28e49e){var _0x200dbd={'method':_0x97e2('0x90'),'uri':_0x23b940+_0x97e2('0x95')+_0x2e2b18+_0x97e2('0xa9')+_0x493d7f+_0x97e2('0xaa')+_0x97e2('0xab'),'headers':{'Authorization':_0x97e2('0x92')+_0x28e49e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x200dbd)[_0x97e2('0xe')](function(_0x4d25d8){var _0x244649=[];var _0xb66753=_0x4d25d8[_0x97e2('0xac')][_0x97e2('0xad')];_0xb66753[_0x97e2('0x9d')](function(_0x2779be){_0x244649[_0x97e2('0xa0')]({'name':_0x2779be[_0x97e2('0xae')]['UserLocalizedLabel']['Label'],'value':String(_0x2779be[_0x97e2('0xaf')])});});var _0x533ee1={'id':_0x1ee17b+'_'+_0x4d25d8['LogicalName'],'name':_0x4d25d8[_0x97e2('0xb0')][_0x97e2('0xb1')]['Label'],'custom':![],'options':_0x244649};_0x498419['push'](_0x533ee1);return _0x498419;});}function getBooleanList(_0x2a9de4,_0x27b5ff,_0x381532,_0x2b1604,_0x33f86c,_0x59bcf1){var _0x151653={'method':'GET','uri':_0x2a9de4+_0x97e2('0x95')+_0x2b1604+')/Attributes('+_0x33f86c+_0x97e2('0xb2'),'headers':{'Authorization':'Bearer\x20'+_0x59bcf1,'If-None-Match':null,'OData-Version':_0x97e2('0xb3')},'json':!![]};return rp(_0x151653)[_0x97e2('0xe')](function(_0x44b1c1){var _0x1700dc=[];_0x1700dc[_0x97e2('0xa0')]({'name':_0x44b1c1['OptionSet']['TrueOption'][_0x97e2('0xae')]['UserLocalizedLabel'][_0x97e2('0xae')],'value':_0x97e2('0xb4')},{'name':_0x44b1c1[_0x97e2('0xac')][_0x97e2('0xb5')]['Label'][_0x97e2('0xb1')]['Label'],'value':_0x97e2('0xb6')});var _0x126db7={'id':_0x27b5ff+'_'+_0x44b1c1[_0x97e2('0x99')],'name':_0x44b1c1[_0x97e2('0xb0')][_0x97e2('0xb1')]['Label'],'custom':![],'options':_0x1700dc};_0x381532[_0x97e2('0xa0')](_0x126db7);return _0x381532;});}function getInputList(_0x34d8b6,_0x18f20a,_0x2435ab,_0x2fc8a4,_0x2d66af,_0x334b26,_0xa16510){var _0x357400={'method':'GET','uri':_0x34d8b6+_0x97e2('0x95')+_0x2d66af+')/Attributes('+_0x334b26+_0x97e2('0xb7')+_0x2435ab+_0x97e2('0xb8'),'headers':{'Authorization':_0x97e2('0x92')+_0xa16510,'If-None-Match':null,'OData-Version':_0x97e2('0xb3')},'json':!![]};return rp(_0x357400)['then'](function(_0x244107){var _0x1d12cd={'id':_0x18f20a+'_'+_0x244107[_0x97e2('0x99')],'name':_0x244107[_0x97e2('0xb0')]['UserLocalizedLabel']?_0x244107['DisplayName'][_0x97e2('0xb1')][_0x97e2('0xae')]:_0x244107[_0x97e2('0x99')],'custom':![],'options':[]};_0x2fc8a4[_0x97e2('0xa0')](_0x1d12cd);return _0x2fc8a4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c12923e..5a1e38a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x13f1eb,_0x141549){var _0x27fded=function(_0xb12a78){while(--_0xb12a78){_0x13f1eb['push'](_0x13f1eb['shift']());}};_0x27fded(++_0x141549);}(_0xe706,0xa3));var _0x6e70=function(_0xe98508,_0x17f727){_0xe98508=_0xe98508-0x0;var _0x21f63e=_0xe706[_0xe98508];return _0x21f63e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x23a5e4,_0x300100){var _0x3b7568=function(_0x5d43ee){while(--_0x5d43ee){_0x23a5e4['push'](_0x23a5e4['shift']());}};_0x3b7568(++_0x300100);}(_0x757a,0xde));var _0xa757=function(_0x3ad27e,_0x1ff5e0){_0x3ad27e=_0x3ad27e-0x0;var _0x533985=_0x757a[_0x3ad27e];return _0x533985;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index a0f0899..db3bcde 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 _0x2ebe=['error','code','message','info','GetDynamics365Account','findAll','options','raw','attributes','include','map','model','catch','Dynamics365Account','where','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfdc816,_0x4e0916){var _0x40c5f2=function(_0x28a83e){while(--_0x28a83e){_0xfdc816['push'](_0xfdc816['shift']());}};_0x40c5f2(++_0x4e0916);}(_0x2ebe,0x17b));var _0xe2eb=function(_0x53f577,_0x147f68){_0x53f577=_0x53f577-0x0;var _0x5667ff=_0x2ebe[_0x53f577];return _0x5667ff;};'use strict';var _=require('lodash');var util=require(_0xe2eb('0x0'));var moment=require(_0xe2eb('0x1'));var BPromise=require(_0xe2eb('0x2'));var rs=require(_0xe2eb('0x3'));var fs=require('fs');var Redis=require(_0xe2eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2eb('0x5'));var logger=require('../../config/logger')(_0xe2eb('0x6'));var config=require('../../config/environment');var jayson=require(_0xe2eb('0x7'));var client=jayson[_0xe2eb('0x8')][_0xe2eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9f76f,_0x364f93,_0x388e09){return new BPromise(function(_0x5cc431,_0x59e9f0){return client[_0xe2eb('0xa')](_0xc9f76f,_0x388e09)[_0xe2eb('0xb')](function(_0x1d0051){logger['info'](_0xe2eb('0xc'),_0x364f93,_0xe2eb('0xd'));logger[_0xe2eb('0xe')](_0xe2eb('0xf'),_0x364f93,'request\x20sent',JSON[_0xe2eb('0x10')](_0x1d0051));if(_0x1d0051[_0xe2eb('0x11')]){if(_0x1d0051['error'][_0xe2eb('0x12')]===0x1f4){logger[_0xe2eb('0x11')](_0xe2eb('0xc'),_0x364f93,_0x1d0051[_0xe2eb('0x11')][_0xe2eb('0x13')]);return _0x59e9f0(_0x1d0051[_0xe2eb('0x11')]['message']);}logger[_0xe2eb('0x11')](_0xe2eb('0xc'),_0x364f93,_0x1d0051['error']['message']);return _0x5cc431(_0x1d0051[_0xe2eb('0x11')]['message']);}else{logger[_0xe2eb('0x14')](_0xe2eb('0xc'),_0x364f93,_0xe2eb('0xd'));_0x5cc431(_0x1d0051['result'][_0xe2eb('0x13')]);}})['catch'](function(_0xed9201){logger[_0xe2eb('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x364f93,_0xed9201);_0x59e9f0(_0xed9201);});});}exports[_0xe2eb('0x15')]=function(_0x2a484a){var _0x3dd140=this;return new Promise(function(_0x25eafc,_0x3afde4){return db['Dynamics365Account'][_0xe2eb('0x16')]({'raw':_0x2a484a[_0xe2eb('0x17')]?_0x2a484a[_0xe2eb('0x17')][_0xe2eb('0x18')]===undefined?!![]:![]:!![],'where':_0x2a484a[_0xe2eb('0x17')]?_0x2a484a[_0xe2eb('0x17')]['where']||null:null,'attributes':_0x2a484a[_0xe2eb('0x17')]?_0x2a484a[_0xe2eb('0x17')][_0xe2eb('0x19')]||null:null,'limit':_0x2a484a['options']?_0x2a484a[_0xe2eb('0x17')]['limit']||null:null,'include':_0x2a484a['options']?_0x2a484a[_0xe2eb('0x17')][_0xe2eb('0x1a')]?_[_0xe2eb('0x1b')](_0x2a484a['options'][_0xe2eb('0x1a')],function(_0x41c144){return{'model':db[_0x41c144[_0xe2eb('0x1c')]],'as':_0x41c144['as'],'attributes':_0x41c144[_0xe2eb('0x19')],'include':_0x41c144[_0xe2eb('0x1a')]?_['map'](_0x41c144[_0xe2eb('0x1a')],function(_0x18d115){return{'model':db[_0x18d115[_0xe2eb('0x1c')]],'as':_0x18d115['as'],'attributes':_0x18d115[_0xe2eb('0x19')],'include':_0x18d115[_0xe2eb('0x1a')]?_[_0xe2eb('0x1b')](_0x18d115['include'],function(_0x50b567){return{'model':db[_0x50b567[_0xe2eb('0x1c')]],'as':_0x50b567['as'],'attributes':_0x50b567[_0xe2eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2eb('0xb')](function(_0x37d47a){logger[_0xe2eb('0x14')](_0xe2eb('0x15'),_0x2a484a);logger['debug']('GetDynamics365Account',_0x2a484a,JSON['stringify'](_0x37d47a));_0x25eafc(_0x37d47a);})[_0xe2eb('0x1d')](function(_0x292728){logger['error']('GetDynamics365Account',_0x292728[_0xe2eb('0x13')],_0x2a484a);_0x3afde4(_0x3dd140[_0xe2eb('0x11')](0x1f4,_0x292728[_0xe2eb('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x5bf2f9){var _0x434652=this;return new Promise(function(_0x43efc1,_0x2ad1e8){return db[_0xe2eb('0x1e')]['find']({'raw':_0x5bf2f9['options']?_0x5bf2f9[_0xe2eb('0x17')][_0xe2eb('0x18')]===undefined?!![]:![]:!![],'where':_0x5bf2f9[_0xe2eb('0x17')]?_0x5bf2f9['options'][_0xe2eb('0x1f')]||null:null,'attributes':_0x5bf2f9[_0xe2eb('0x17')]?_0x5bf2f9[_0xe2eb('0x17')][_0xe2eb('0x19')]||null:null,'include':_0x5bf2f9[_0xe2eb('0x17')]?_0x5bf2f9[_0xe2eb('0x17')][_0xe2eb('0x1a')]?_[_0xe2eb('0x1b')](_0x5bf2f9['options'][_0xe2eb('0x1a')],function(_0x1d68dd){return{'model':db[_0x1d68dd['model']],'as':_0x1d68dd['as'],'attributes':_0x1d68dd[_0xe2eb('0x19')],'include':_0x1d68dd[_0xe2eb('0x1a')]?_['map'](_0x1d68dd[_0xe2eb('0x1a')],function(_0x323ef4){return{'model':db[_0x323ef4[_0xe2eb('0x1c')]],'as':_0x323ef4['as'],'attributes':_0x323ef4[_0xe2eb('0x19')],'include':_0x323ef4['include']?_[_0xe2eb('0x1b')](_0x323ef4[_0xe2eb('0x1a')],function(_0xee60d9){return{'model':db[_0xee60d9[_0xe2eb('0x1c')]],'as':_0xee60d9['as'],'attributes':_0xee60d9[_0xe2eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2eb('0xb')](function(_0x2d9a9b){logger['info']('ShowDynamics365Account',_0x5bf2f9);logger[_0xe2eb('0xe')](_0xe2eb('0x20'),_0x5bf2f9,JSON[_0xe2eb('0x10')](_0x2d9a9b));_0x43efc1(_0x2d9a9b);})[_0xe2eb('0x1d')](function(_0xd87b44){logger['error'](_0xe2eb('0x20'),_0xd87b44[_0xe2eb('0x13')],_0x5bf2f9);_0x2ad1e8(_0x434652[_0xe2eb('0x11')](0x1f4,_0xd87b44[_0xe2eb('0x13')]));});});}; \ No newline at end of file +var _0x2726=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2726,0xcd));var _0x6272=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x2726[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x6272('0x0'));var util=require(_0x6272('0x1'));var moment=require(_0x6272('0x2'));var BPromise=require(_0x6272('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6272('0x4'))['db'];var utils=require(_0x6272('0x5'));var logger=require(_0x6272('0x6'))(_0x6272('0x7'));var config=require(_0x6272('0x8'));var jayson=require(_0x6272('0x9'));var client=jayson[_0x6272('0xa')][_0x6272('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x847e6,_0x13d694,_0x5a54ec){return new BPromise(function(_0x1ba5be,_0xf01e70){return client[_0x6272('0xc')](_0x847e6,_0x5a54ec)[_0x6272('0xd')](function(_0x162a17){logger['info'](_0x6272('0xe'),_0x13d694,_0x6272('0xf'));logger[_0x6272('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x13d694,_0x6272('0xf'),JSON['stringify'](_0x162a17));if(_0x162a17[_0x6272('0x11')]){if(_0x162a17[_0x6272('0x11')][_0x6272('0x12')]===0x1f4){logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x162a17['error'][_0x6272('0x13')]);return _0xf01e70(_0x162a17[_0x6272('0x11')][_0x6272('0x13')]);}logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x162a17[_0x6272('0x11')][_0x6272('0x13')]);return _0x1ba5be(_0x162a17[_0x6272('0x11')]['message']);}else{logger[_0x6272('0x14')](_0x6272('0xe'),_0x13d694,'request\x20sent');_0x1ba5be(_0x162a17['result'][_0x6272('0x13')]);}})[_0x6272('0x15')](function(_0x344ce8){logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x344ce8);_0xf01e70(_0x344ce8);});});}exports['GetDynamics365Account']=function(_0x196a8c){var _0x427dc6=this;return new Promise(function(_0x185060,_0x16b2a1){return db[_0x6272('0x16')][_0x6272('0x17')]({'raw':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options'][_0x6272('0x19')]===undefined?!![]:![]:!![],'where':_0x196a8c['options']?_0x196a8c['options'][_0x6272('0x1a')]||null:null,'attributes':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options'][_0x6272('0x1b')]||null:null,'limit':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options']['limit']||null:null,'include':_0x196a8c[_0x6272('0x18')]?_0x196a8c[_0x6272('0x18')][_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x196a8c['options'][_0x6272('0x1c')],function(_0x4e1170){return{'model':db[_0x4e1170['model']],'as':_0x4e1170['as'],'attributes':_0x4e1170['attributes'],'include':_0x4e1170['include']?_[_0x6272('0x1d')](_0x4e1170[_0x6272('0x1c')],function(_0x211ce3){return{'model':db[_0x211ce3[_0x6272('0x1e')]],'as':_0x211ce3['as'],'attributes':_0x211ce3[_0x6272('0x1b')],'include':_0x211ce3[_0x6272('0x1c')]?_['map'](_0x211ce3[_0x6272('0x1c')],function(_0x51101d){return{'model':db[_0x51101d[_0x6272('0x1e')]],'as':_0x51101d['as'],'attributes':_0x51101d[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x4ec61b){logger['info'](_0x6272('0x1f'),_0x196a8c);logger[_0x6272('0x10')]('GetDynamics365Account',_0x196a8c,JSON[_0x6272('0x20')](_0x4ec61b));_0x185060(_0x4ec61b);})['catch'](function(_0x285654){logger[_0x6272('0x11')](_0x6272('0x1f'),_0x285654[_0x6272('0x13')],_0x196a8c);_0x16b2a1(_0x427dc6[_0x6272('0x11')](0x1f4,_0x285654[_0x6272('0x13')]));});});};exports[_0x6272('0x21')]=function(_0x12b432){var _0x5a2e9f=this;return new Promise(function(_0x54f2cb,_0x499c39){return db[_0x6272('0x16')][_0x6272('0x22')]({'raw':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')][_0x6272('0x19')]===undefined?!![]:![]:!![],'where':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')][_0x6272('0x1a')]||null:null,'attributes':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')]['attributes']||null:null,'include':_0x12b432[_0x6272('0x18')]?_0x12b432['options'][_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x12b432['options'][_0x6272('0x1c')],function(_0x3e7941){return{'model':db[_0x3e7941[_0x6272('0x1e')]],'as':_0x3e7941['as'],'attributes':_0x3e7941[_0x6272('0x1b')],'include':_0x3e7941[_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x3e7941[_0x6272('0x1c')],function(_0x4a3c5f){return{'model':db[_0x4a3c5f[_0x6272('0x1e')]],'as':_0x4a3c5f['as'],'attributes':_0x4a3c5f[_0x6272('0x1b')],'include':_0x4a3c5f[_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x4a3c5f[_0x6272('0x1c')],function(_0x4e1827){return{'model':db[_0x4e1827[_0x6272('0x1e')]],'as':_0x4e1827['as'],'attributes':_0x4e1827[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x587709){logger[_0x6272('0x14')](_0x6272('0x21'),_0x12b432);logger[_0x6272('0x10')](_0x6272('0x21'),_0x12b432,JSON['stringify'](_0x587709));_0x54f2cb(_0x587709);})['catch'](function(_0x15dfa3){logger[_0x6272('0x11')]('ShowDynamics365Account',_0x15dfa3['message'],_0x12b432);_0x499c39(_0x5a2e9f['error'](0x1f4,_0x15dfa3[_0x6272('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e63d93b..552fc33 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 _0x4113=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x4113,0x18a));var _0x3411=function(_0x1f6e0f,_0x39dd30){_0x1f6e0f=_0x1f6e0f-0x0;var _0x4c5615=_0x4113[_0x1f6e0f];return _0x4c5615;};'use strict';var multer=require(_0x3411('0x0'));var util=require(_0x3411('0x1'));var path=require(_0x3411('0x2'));var timeout=require(_0x3411('0x3'));var express=require(_0x3411('0x4'));var router=express[_0x3411('0x5')]();var fs_extra=require(_0x3411('0x6'));var auth=require(_0x3411('0x7'));var interaction=require(_0x3411('0x8'));var config=require('../../config/environment');var controller=require(_0x3411('0x9'));router[_0x3411('0xa')]('/',auth[_0x3411('0xb')](),controller['index']);router[_0x3411('0xa')]('/:id',auth[_0x3411('0xb')](),controller[_0x3411('0xc')]);router[_0x3411('0xa')](_0x3411('0xd'),auth[_0x3411('0xb')](),controller['getFields']);router[_0x3411('0xa')](_0x3411('0xe'),auth[_0x3411('0xb')](),controller[_0x3411('0xf')]);router[_0x3411('0xa')](_0x3411('0x10'),auth[_0x3411('0xb')](),controller[_0x3411('0x11')]);router[_0x3411('0x12')]('/',auth[_0x3411('0xb')](),controller[_0x3411('0x13')]);router[_0x3411('0x14')](_0x3411('0x15'),auth[_0x3411('0xb')](),controller[_0x3411('0x16')]);router[_0x3411('0x17')](_0x3411('0x15'),auth[_0x3411('0xb')](),controller[_0x3411('0x18')]);module[_0x3411('0x19')]=router; \ No newline at end of file +var _0x00d0=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id'];(function(_0x459318,_0x4cb2c9){var _0x26c14e=function(_0x4f17eb){while(--_0x4f17eb){_0x459318['push'](_0x459318['shift']());}};_0x26c14e(++_0x4cb2c9);}(_0x00d0,0x163));var _0x000d=function(_0x353a0a,_0x344e98){_0x353a0a=_0x353a0a-0x0;var _0x730b36=_0x00d0[_0x353a0a];return _0x730b36;};'use strict';var multer=require(_0x000d('0x0'));var util=require(_0x000d('0x1'));var path=require('path');var timeout=require(_0x000d('0x2'));var express=require(_0x000d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x000d('0x4'));var interaction=require(_0x000d('0x5'));var config=require('../../config/environment');var controller=require(_0x000d('0x6'));router[_0x000d('0x7')]('/',auth[_0x000d('0x8')](),controller[_0x000d('0x9')]);router['get']('/:id',auth[_0x000d('0x8')](),controller[_0x000d('0xa')]);router[_0x000d('0x7')](_0x000d('0xb'),auth[_0x000d('0x8')](),controller[_0x000d('0xc')]);router['get'](_0x000d('0xd'),auth[_0x000d('0x8')](),controller['getSubjects']);router[_0x000d('0x7')]('/:id/descriptions',auth[_0x000d('0x8')](),controller[_0x000d('0xe')]);router[_0x000d('0xf')]('/',auth[_0x000d('0x8')](),controller[_0x000d('0x10')]);router[_0x000d('0x11')](_0x000d('0x12'),auth['isAuthenticated'](),controller[_0x000d('0x13')]);router[_0x000d('0x14')](_0x000d('0x12'),auth[_0x000d('0x8')](),controller[_0x000d('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 8bd7a93..d98e771 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 _0xf197=['exports','STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x340ac1,_0x333cea){var _0x332592=function(_0x209bf7){while(--_0x209bf7){_0x340ac1['push'](_0x340ac1['shift']());}};_0x332592(++_0x333cea);}(_0xf197,0xd7));var _0x7f19=function(_0x154d43,_0x5416ba){_0x154d43=_0x154d43-0x0;var _0x389534=_0xf197[_0x154d43];return _0x389534;};'use strict';var Sequelize=require(_0x7f19('0x0'));module[_0x7f19('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f19('0x2')]},'ticketType':{'type':Sequelize[_0x7f19('0x3')](_0x7f19('0x4'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7f19('0x5'),_0x7f19('0x6')),'defaultValue':_0x7f19('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7f19('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7f19('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2f32=['ENUM','incident','phonecall','contact','BOOLEAN','sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2f32,0x139));var _0x22f3=function(_0x59fce5,_0x58cce8){_0x59fce5=_0x59fce5-0x0;var _0x4348b0=_0x2f32[_0x59fce5];return _0x4348b0;};'use strict';var Sequelize=require(_0x22f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x22f3('0x1')]},'description':{'type':Sequelize[_0x22f3('0x1')]},'ticketType':{'type':Sequelize[_0x22f3('0x2')](_0x22f3('0x3'),_0x22f3('0x4')),'defaultValue':_0x22f3('0x3')},'moduleCreate':{'type':Sequelize[_0x22f3('0x2')](_0x22f3('0x5'),'nothing'),'defaultValue':_0x22f3('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x22f3('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x22f3('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4170057..7c7623a 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 _0x532e=['query','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','findOne','getFields','Dynamics365Field','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','filters','intersection','attributes','fields'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x532e,0x10b));var _0xe532=function(_0x1e2fe5,_0x1faf75){_0x1e2fe5=_0x1e2fe5-0x0;var _0x19b8bb=_0x532e[_0x1e2fe5];return _0x19b8bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe532('0x0'));var zipdir=require(_0xe532('0x1'));var jsonpatch=require(_0xe532('0x2'));var rp=require(_0xe532('0x3'));var moment=require(_0xe532('0x4'));var BPromise=require(_0xe532('0x5'));var Mustache=require('mustache');var util=require(_0xe532('0x6'));var path=require(_0xe532('0x7'));var sox=require(_0xe532('0x8'));var csv=require(_0xe532('0x9'));var ejs=require(_0xe532('0xa'));var fs=require('fs');var fs_extra=require(_0xe532('0xb'));var _=require(_0xe532('0xc'));var squel=require('squel');var crypto=require(_0xe532('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe532('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe532('0xf'));var Redis=require('ioredis');var authService=require(_0xe532('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe532('0x11'))(_0xe532('0x12'));var utils=require('../../config/utils');var config=require(_0xe532('0x13'));var licenseUtil=require(_0xe532('0x14'));var db=require(_0xe532('0x15'))['db'];function respondWithStatusCode(_0x43a8e4,_0x53fd6a){_0x53fd6a=_0x53fd6a||0xcc;return function(_0x470317){if(_0x470317){return _0x43a8e4[_0xe532('0x16')](_0x53fd6a);}return _0x43a8e4[_0xe532('0x17')](_0x53fd6a)[_0xe532('0x18')]();};}function respondWithResult(_0x34e9a7,_0x177b6e){_0x177b6e=_0x177b6e||0xc8;return function(_0x54cb82){if(_0x54cb82){return _0x34e9a7[_0xe532('0x17')](_0x177b6e)[_0xe532('0x19')](_0x54cb82);}};}function respondWithFilteredResult(_0x594abf,_0x43c4f9){return function(_0x260a87){if(_0x260a87){var _0x39dc62=typeof _0x43c4f9[_0xe532('0x1a')]===_0xe532('0x1b')&&typeof _0x43c4f9[_0xe532('0x1c')]===_0xe532('0x1b');var _0x47f7e7=_0x260a87[_0xe532('0x1d')];var _0x387cce=_0x39dc62?0x0:_0x43c4f9[_0xe532('0x1a')];var _0x3e73f9=_0x39dc62?_0x260a87[_0xe532('0x1d')]:_0x43c4f9[_0xe532('0x1a')]+_0x43c4f9[_0xe532('0x1c')];var _0x577b60;if(_0x3e73f9>=_0x47f7e7){_0x3e73f9=_0x47f7e7;_0x577b60=0xc8;}else{_0x577b60=0xce;}_0x594abf[_0xe532('0x17')](_0x577b60);return _0x594abf[_0xe532('0x1e')]('Content-Range',_0x387cce+'-'+_0x3e73f9+'/'+_0x47f7e7)[_0xe532('0x19')](_0x260a87);}return null;};}function patchUpdates(_0x37dd80){return function(_0x5ab720){try{jsonpatch['apply'](_0x5ab720,_0x37dd80,!![]);}catch(_0x410d83){return BPromise[_0xe532('0x1f')](_0x410d83);}return _0x5ab720[_0xe532('0x20')]();};}function saveUpdates(_0x2f700d,_0x81d44e){return function(_0x22f334){if(_0x22f334){return _0x22f334['update'](_0x2f700d)[_0xe532('0x21')](function(_0x54aff1){return _0x54aff1;});}return null;};}function removeEntity(_0x2c76c9,_0x207670){return function(_0x5ef388){if(_0x5ef388){return _0x5ef388[_0xe532('0x22')]()[_0xe532('0x21')](function(){_0x2c76c9[_0xe532('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158a8f,_0x454f0d){return function(_0x7dec69){if(!_0x7dec69){_0x158a8f[_0xe532('0x16')](0x194);}return _0x7dec69;};}function handleError(_0x44071b,_0x5e2dc5){_0x5e2dc5=_0x5e2dc5||0x1f4;return function(_0x28011f){logger[_0xe532('0x23')](_0x28011f[_0xe532('0x24')]);if(_0x28011f[_0xe532('0x25')]){delete _0x28011f[_0xe532('0x25')];}_0x44071b[_0xe532('0x17')](_0x5e2dc5)[_0xe532('0x26')](_0x28011f);};}exports[_0xe532('0x27')]=function(_0x3088f9,_0x43f6ef){var _0x616612={},_0x24e346={},_0x10fbed={'count':0x0,'rows':[]};var _0x32d79d=_[_0xe532('0x28')](db['Dynamics365Configuration'][_0xe532('0x29')],function(_0x157d92){return{'name':_0x157d92[_0xe532('0x2a')],'type':_0x157d92['type'][_0xe532('0x2b')]};});_0x24e346[_0xe532('0x2c')]=_[_0xe532('0x28')](_0x32d79d,_0xe532('0x25'));_0x24e346['query']=_['keys'](_0x3088f9['query']);_0x24e346[_0xe532('0x2d')]=_[_0xe532('0x2e')](_0x24e346['model'],_0x24e346['query']);_0x616612[_0xe532('0x2f')]=_[_0xe532('0x2e')](_0x24e346[_0xe532('0x2c')],qs[_0xe532('0x30')](_0x3088f9[_0xe532('0x31')][_0xe532('0x30')]));_0x616612[_0xe532('0x2f')]=_0x616612[_0xe532('0x2f')][_0xe532('0x32')]?_0x616612[_0xe532('0x2f')]:_0x24e346[_0xe532('0x2c')];if(!_0x3088f9[_0xe532('0x31')]['hasOwnProperty'](_0xe532('0x33'))){_0x616612[_0xe532('0x1c')]=qs['limit'](_0x3088f9[_0xe532('0x31')][_0xe532('0x1c')]);_0x616612[_0xe532('0x1a')]=qs[_0xe532('0x1a')](_0x3088f9[_0xe532('0x31')][_0xe532('0x1a')]);}_0x616612[_0xe532('0x34')]=qs[_0xe532('0x35')](_0x3088f9[_0xe532('0x31')][_0xe532('0x35')]);_0x616612[_0xe532('0x36')]=qs[_0xe532('0x2d')](_[_0xe532('0x37')](_0x3088f9['query'],_0x24e346['filters']),_0x32d79d);if(_0x3088f9['query'][_0xe532('0x38')]){_0x616612[_0xe532('0x36')]=_[_0xe532('0x39')](_0x616612[_0xe532('0x36')],{'$or':_['map'](_0x32d79d,function(_0x4a80ae){if(_0x4a80ae[_0xe532('0x3a')]!==_0xe532('0x3b')){var _0x40ebb5={};_0x40ebb5[_0x4a80ae[_0xe532('0x25')]]={'$like':'%'+_0x3088f9['query'][_0xe532('0x38')]+'%'};return _0x40ebb5;}})});}_0x616612=_[_0xe532('0x39')]({},_0x616612,_0x3088f9[_0xe532('0x3c')]);var _0x2899b2={'where':_0x616612[_0xe532('0x36')]};return db[_0xe532('0x3d')][_0xe532('0x1d')](_0x2899b2)[_0xe532('0x21')](function(_0x95031e){_0x10fbed[_0xe532('0x1d')]=_0x95031e;if(_0x3088f9['query'][_0xe532('0x3e')]){_0x616612[_0xe532('0x3f')]=[{'all':!![]}];}return db[_0xe532('0x3d')][_0xe532('0x40')](_0x616612);})[_0xe532('0x21')](function(_0x20c402){_0x10fbed['rows']=_0x20c402;return _0x10fbed;})[_0xe532('0x21')](respondWithFilteredResult(_0x43f6ef,_0x616612))[_0xe532('0x41')](handleError(_0x43f6ef,null));};exports[_0xe532('0x42')]=function(_0xc71031,_0x2741e8){var _0x5a46f7={'raw':![],'where':{'id':_0xc71031[_0xe532('0x43')]['id']}},_0x2a5378={};_0x2a5378[_0xe532('0x2c')]=_[_0xe532('0x44')](db[_0xe532('0x3d')][_0xe532('0x29')]);_0x2a5378[_0xe532('0x31')]=_[_0xe532('0x44')](_0xc71031[_0xe532('0x31')]);_0x2a5378[_0xe532('0x2d')]=_[_0xe532('0x2e')](_0x2a5378[_0xe532('0x2c')],_0x2a5378[_0xe532('0x31')]);_0x5a46f7[_0xe532('0x2f')]=_['intersection'](_0x2a5378[_0xe532('0x2c')],qs[_0xe532('0x30')](_0xc71031[_0xe532('0x31')]['fields']));_0x5a46f7['attributes']=_0x5a46f7[_0xe532('0x2f')]['length']?_0x5a46f7[_0xe532('0x2f')]:_0x2a5378['model'];if(_0xc71031['query'][_0xe532('0x3e')]){_0x5a46f7[_0xe532('0x3f')]=[{'all':!![]}];}_0x5a46f7=_[_0xe532('0x39')]({},_0x5a46f7,_0xc71031[_0xe532('0x3c')]);return db['Dynamics365Configuration'][_0xe532('0x45')](_0x5a46f7)[_0xe532('0x21')](handleEntityNotFound(_0x2741e8,null))['then'](respondWithResult(_0x2741e8,null))[_0xe532('0x41')](handleError(_0x2741e8,null));};exports['create']=function(_0x4073a7,_0x4f4e44){return db[_0xe532('0x3d')][_0xe532('0x46')](_0x4073a7[_0xe532('0x47')],{})[_0xe532('0x21')](respondWithResult(_0x4f4e44,0xc9))[_0xe532('0x41')](handleError(_0x4f4e44,null));};exports[_0xe532('0x48')]=function(_0x3243f0,_0x5b186d){if(_0x3243f0[_0xe532('0x47')]['id']){delete _0x3243f0[_0xe532('0x47')]['id'];}return db[_0xe532('0x3d')]['find']({'where':{'id':_0x3243f0['params']['id']}})['then'](handleEntityNotFound(_0x5b186d,null))[_0xe532('0x21')](saveUpdates(_0x3243f0[_0xe532('0x47')],null))['then'](respondWithResult(_0x5b186d,null))[_0xe532('0x41')](handleError(_0x5b186d,null));};exports[_0xe532('0x22')]=function(_0x559ada,_0x5a2a3a){return db['Dynamics365Configuration'][_0xe532('0x45')]({'where':{'id':_0x559ada[_0xe532('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a2a3a,null))[_0xe532('0x21')](removeEntity(_0x5a2a3a,null))[_0xe532('0x41')](handleError(_0x5a2a3a,null));};exports['getFields']=function(_0x18686c,_0x4c1b3b,_0x12a299){var _0x43264e={};var _0x403413={};var _0x2c1e9c;var _0x534cae;return db['Dynamics365Configuration'][_0xe532('0x49')]({'where':{'id':_0x18686c[_0xe532('0x43')]['id']}})[_0xe532('0x21')](handleEntityNotFound(_0x4c1b3b,null))[_0xe532('0x21')](function(_0x47e44d){if(_0x47e44d){_0x2c1e9c=_0x47e44d;_0x403413[_0xe532('0x2c')]=_[_0xe532('0x44')](db['Dynamics365Field'][_0xe532('0x29')]);_0x403413[_0xe532('0x31')]=_[_0xe532('0x44')](_0x18686c[_0xe532('0x31')]);_0x403413[_0xe532('0x2d')]=_['intersection'](_0x403413[_0xe532('0x2c')],_0x403413[_0xe532('0x31')]);_0x43264e[_0xe532('0x2f')]=_[_0xe532('0x2e')](_0x403413[_0xe532('0x2c')],qs[_0xe532('0x30')](_0x18686c[_0xe532('0x31')][_0xe532('0x30')]));_0x43264e['attributes']=_0x43264e[_0xe532('0x2f')][_0xe532('0x32')]?_0x43264e['attributes']:_0x403413[_0xe532('0x2c')];_0x43264e[_0xe532('0x34')]=qs[_0xe532('0x35')](_0x18686c[_0xe532('0x31')][_0xe532('0x35')]);_0x43264e['where']=qs[_0xe532('0x2d')](_[_0xe532('0x37')](_0x18686c['query'],_0x403413[_0xe532('0x2d')]));if(_0x18686c[_0xe532('0x31')]['filter']){_0x43264e[_0xe532('0x36')]=_[_0xe532('0x39')](_0x43264e[_0xe532('0x36')],{'$or':_[_0xe532('0x28')](_0x43264e[_0xe532('0x2f')],function(_0x550eb3){var _0x599cbb={};_0x599cbb[_0x550eb3]={'$like':'%'+_0x18686c['query']['filter']+'%'};return _0x599cbb;})});}_0x43264e=_[_0xe532('0x39')]({},_0x43264e,_0x18686c[_0xe532('0x3c')]);return _0x2c1e9c[_0xe532('0x4a')](_0x43264e);}})[_0xe532('0x21')](function(_0x2dc8b3){if(_0x2dc8b3){_0x534cae=_0x2dc8b3['length'];if(!_0x18686c[_0xe532('0x31')]['hasOwnProperty'](_0xe532('0x33'))){_0x43264e[_0xe532('0x1c')]=qs['limit'](_0x18686c['query']['limit']);_0x43264e['offset']=qs[_0xe532('0x1a')](_0x18686c['query'][_0xe532('0x1a')]);}return _0x2c1e9c[_0xe532('0x4a')](_0x43264e);}})['then'](function(_0x496e09){if(_0x496e09){return _0x496e09?{'count':_0x534cae,'rows':_0x496e09}:null;}})[_0xe532('0x21')](respondWithResult(_0x4c1b3b,null))[_0xe532('0x41')](handleError(_0x4c1b3b,null));};exports['getSubjects']=function(_0x44f52e,_0x5a3aee,_0x655b3b){var _0x5d76bb={};var _0x9f3c11={};var _0x9c8207;var _0x5b3022;return db[_0xe532('0x3d')][_0xe532('0x49')]({'where':{'id':_0x44f52e[_0xe532('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a3aee,null))[_0xe532('0x21')](function(_0x4ded95){if(_0x4ded95){_0x9c8207=_0x4ded95;_0x9f3c11['model']=_[_0xe532('0x44')](db[_0xe532('0x4b')][_0xe532('0x29')]);_0x9f3c11['query']=_[_0xe532('0x44')](_0x44f52e[_0xe532('0x31')]);_0x9f3c11['filters']=_[_0xe532('0x2e')](_0x9f3c11[_0xe532('0x2c')],_0x9f3c11[_0xe532('0x31')]);_0x5d76bb[_0xe532('0x2f')]=_[_0xe532('0x2e')](_0x9f3c11[_0xe532('0x2c')],qs['fields'](_0x44f52e[_0xe532('0x31')]['fields']));_0x5d76bb[_0xe532('0x2f')]=_0x5d76bb[_0xe532('0x2f')][_0xe532('0x32')]?_0x5d76bb[_0xe532('0x2f')]:_0x9f3c11[_0xe532('0x2c')];_0x5d76bb[_0xe532('0x34')]=qs['sort'](_0x44f52e[_0xe532('0x31')][_0xe532('0x35')]);_0x5d76bb['where']=qs[_0xe532('0x2d')](_[_0xe532('0x37')](_0x44f52e[_0xe532('0x31')],_0x9f3c11[_0xe532('0x2d')]));if(_0x44f52e[_0xe532('0x31')]['filter']){_0x5d76bb[_0xe532('0x36')]=_['merge'](_0x5d76bb[_0xe532('0x36')],{'$or':_[_0xe532('0x28')](_0x5d76bb[_0xe532('0x2f')],function(_0x51eed3){var _0x328016={};_0x328016[_0x51eed3]={'$like':'%'+_0x44f52e[_0xe532('0x31')][_0xe532('0x38')]+'%'};return _0x328016;})});}_0x5d76bb=_[_0xe532('0x39')]({},_0x5d76bb,_0x44f52e[_0xe532('0x3c')]);return _0x9c8207[_0xe532('0x4c')](_0x5d76bb);}})['then'](function(_0x27fa4d){if(_0x27fa4d){_0x5b3022=_0x27fa4d[_0xe532('0x32')];if(!_0x44f52e[_0xe532('0x31')][_0xe532('0x4d')](_0xe532('0x33'))){_0x5d76bb[_0xe532('0x1c')]=qs[_0xe532('0x1c')](_0x44f52e['query']['limit']);_0x5d76bb[_0xe532('0x1a')]=qs[_0xe532('0x1a')](_0x44f52e['query']['offset']);}return _0x9c8207[_0xe532('0x4c')](_0x5d76bb);}})[_0xe532('0x21')](function(_0x45d108){if(_0x45d108){return _0x45d108?{'count':_0x5b3022,'rows':_0x45d108}:null;}})[_0xe532('0x21')](respondWithResult(_0x5a3aee,null))[_0xe532('0x41')](handleError(_0x5a3aee,null));};exports[_0xe532('0x4e')]=function(_0x4ff17a,_0x513788,_0x236c77){var _0x18ec07={};var _0x4f1a68={};var _0x219aba;var _0x2c5ee2;return db[_0xe532('0x3d')][_0xe532('0x49')]({'where':{'id':_0x4ff17a[_0xe532('0x43')]['id']}})[_0xe532('0x21')](handleEntityNotFound(_0x513788,null))['then'](function(_0x47432a){if(_0x47432a){_0x219aba=_0x47432a;_0x4f1a68[_0xe532('0x2c')]=_[_0xe532('0x44')](db[_0xe532('0x4b')][_0xe532('0x29')]);_0x4f1a68[_0xe532('0x31')]=_['keys'](_0x4ff17a[_0xe532('0x31')]);_0x4f1a68['filters']=_[_0xe532('0x2e')](_0x4f1a68[_0xe532('0x2c')],_0x4f1a68[_0xe532('0x31')]);_0x18ec07[_0xe532('0x2f')]=_[_0xe532('0x2e')](_0x4f1a68[_0xe532('0x2c')],qs[_0xe532('0x30')](_0x4ff17a[_0xe532('0x31')]['fields']));_0x18ec07['attributes']=_0x18ec07[_0xe532('0x2f')][_0xe532('0x32')]?_0x18ec07['attributes']:_0x4f1a68[_0xe532('0x2c')];_0x18ec07[_0xe532('0x34')]=qs['sort'](_0x4ff17a['query'][_0xe532('0x35')]);_0x18ec07[_0xe532('0x36')]=qs[_0xe532('0x2d')](_['pick'](_0x4ff17a[_0xe532('0x31')],_0x4f1a68[_0xe532('0x2d')]));if(_0x4ff17a[_0xe532('0x31')][_0xe532('0x38')]){_0x18ec07['where']=_['merge'](_0x18ec07['where'],{'$or':_['map'](_0x18ec07['attributes'],function(_0xbf9ba0){var _0x22724e={};_0x22724e[_0xbf9ba0]={'$like':'%'+_0x4ff17a['query'][_0xe532('0x38')]+'%'};return _0x22724e;})});}_0x18ec07=_['merge']({},_0x18ec07,_0x4ff17a[_0xe532('0x3c')]);return _0x219aba[_0xe532('0x4e')](_0x18ec07);}})[_0xe532('0x21')](function(_0x4f7a7a){if(_0x4f7a7a){_0x2c5ee2=_0x4f7a7a[_0xe532('0x32')];if(!_0x4ff17a[_0xe532('0x31')][_0xe532('0x4d')](_0xe532('0x33'))){_0x18ec07[_0xe532('0x1c')]=qs[_0xe532('0x1c')](_0x4ff17a[_0xe532('0x31')][_0xe532('0x1c')]);_0x18ec07[_0xe532('0x1a')]=qs[_0xe532('0x1a')](_0x4ff17a[_0xe532('0x31')][_0xe532('0x1a')]);}return _0x219aba[_0xe532('0x4e')](_0x18ec07);}})[_0xe532('0x21')](function(_0x68d02){if(_0x68d02){return _0x68d02?{'count':_0x2c5ee2,'rows':_0x68d02}:null;}})[_0xe532('0x21')](respondWithResult(_0x513788,null))[_0xe532('0x41')](handleError(_0x513788,null));}; \ No newline at end of file +var _0x40e0=['type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','Dynamics365Configuration','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','options','find','create','body','destroy','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','fieldName'];(function(_0x58d499,_0x2f1ec1){var _0x13a0d9=function(_0x3b3932){while(--_0x3b3932){_0x58d499['push'](_0x58d499['shift']());}};_0x13a0d9(++_0x2f1ec1);}(_0x40e0,0x170));var _0x040e=function(_0x4a6eb1,_0x454559){_0x4a6eb1=_0x4a6eb1-0x0;var _0x2222ae=_0x40e0[_0x4a6eb1];return _0x2222ae;};'use strict';var emlformat=require(_0x040e('0x0'));var rimraf=require(_0x040e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x040e('0x2'));var rp=require('request-promise');var moment=require(_0x040e('0x3'));var BPromise=require(_0x040e('0x4'));var Mustache=require(_0x040e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x040e('0x6'));var csv=require(_0x040e('0x7'));var ejs=require(_0x040e('0x8'));var fs=require('fs');var fs_extra=require(_0x040e('0x9'));var _=require(_0x040e('0xa'));var squel=require(_0x040e('0xb'));var crypto=require(_0x040e('0xc'));var jsforce=require(_0x040e('0xd'));var deskjs=require(_0x040e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x040e('0xf'));var Papa=require(_0x040e('0x10'));var Redis=require(_0x040e('0x11'));var authService=require(_0x040e('0x12'));var qs=require(_0x040e('0x13'));var as=require(_0x040e('0x14'));var hardwareService=require(_0x040e('0x15'));var logger=require(_0x040e('0x16'))('api');var utils=require(_0x040e('0x17'));var config=require(_0x040e('0x18'));var licenseUtil=require(_0x040e('0x19'));var db=require(_0x040e('0x1a'))['db'];function respondWithStatusCode(_0x182c29,_0x4fd3d5){_0x4fd3d5=_0x4fd3d5||0xcc;return function(_0x1b8466){if(_0x1b8466){return _0x182c29[_0x040e('0x1b')](_0x4fd3d5);}return _0x182c29[_0x040e('0x1c')](_0x4fd3d5)[_0x040e('0x1d')]();};}function respondWithResult(_0x587995,_0x18b39a){_0x18b39a=_0x18b39a||0xc8;return function(_0x18b4d7){if(_0x18b4d7){return _0x587995['status'](_0x18b39a)[_0x040e('0x1e')](_0x18b4d7);}};}function respondWithFilteredResult(_0x397929,_0x1569ab){return function(_0x4f7f86){if(_0x4f7f86){var _0x553a57=typeof _0x1569ab['offset']===_0x040e('0x1f')&&typeof _0x1569ab[_0x040e('0x20')]===_0x040e('0x1f');var _0x1785d6=_0x4f7f86[_0x040e('0x21')];var _0x494940=_0x553a57?0x0:_0x1569ab[_0x040e('0x22')];var _0x18b08b=_0x553a57?_0x4f7f86['count']:_0x1569ab[_0x040e('0x22')]+_0x1569ab['limit'];var _0x486838;if(_0x18b08b>=_0x1785d6){_0x18b08b=_0x1785d6;_0x486838=0xc8;}else{_0x486838=0xce;}_0x397929[_0x040e('0x1c')](_0x486838);return _0x397929[_0x040e('0x23')](_0x040e('0x24'),_0x494940+'-'+_0x18b08b+'/'+_0x1785d6)[_0x040e('0x1e')](_0x4f7f86);}return null;};}function patchUpdates(_0xc4b7d9){return function(_0x39382f){try{jsonpatch[_0x040e('0x25')](_0x39382f,_0xc4b7d9,!![]);}catch(_0x43379c){return BPromise[_0x040e('0x26')](_0x43379c);}return _0x39382f['save']();};}function saveUpdates(_0x47b033,_0x1185a0){return function(_0x1a6ba4){if(_0x1a6ba4){return _0x1a6ba4[_0x040e('0x27')](_0x47b033)[_0x040e('0x28')](function(_0x224550){return _0x224550;});}return null;};}function removeEntity(_0x47aa68,_0x46fe4c){return function(_0x1381af){if(_0x1381af){return _0x1381af['destroy']()[_0x040e('0x28')](function(){_0x47aa68[_0x040e('0x1c')](0xcc)[_0x040e('0x1d')]();});}};}function handleEntityNotFound(_0x2c8b48,_0x39ba37){return function(_0x230117){if(!_0x230117){_0x2c8b48['sendStatus'](0x194);}return _0x230117;};}function handleError(_0x20b122,_0x223339){_0x223339=_0x223339||0x1f4;return function(_0x3ee14f){logger[_0x040e('0x29')](_0x3ee14f[_0x040e('0x2a')]);if(_0x3ee14f[_0x040e('0x2b')]){delete _0x3ee14f[_0x040e('0x2b')];}_0x20b122[_0x040e('0x1c')](_0x223339)[_0x040e('0x2c')](_0x3ee14f);};}exports['index']=function(_0x11b67c,_0x1f65b3){var _0x29bedc={},_0x633525={},_0x417c8b={'count':0x0,'rows':[]};var _0x174cca=_[_0x040e('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0xd949a9){return{'name':_0xd949a9[_0x040e('0x2e')],'type':_0xd949a9[_0x040e('0x2f')][_0x040e('0x30')]};});_0x633525['model']=_['map'](_0x174cca,_0x040e('0x2b'));_0x633525[_0x040e('0x31')]=_[_0x040e('0x32')](_0x11b67c['query']);_0x633525[_0x040e('0x33')]=_[_0x040e('0x34')](_0x633525[_0x040e('0x35')],_0x633525[_0x040e('0x31')]);_0x29bedc[_0x040e('0x36')]=_[_0x040e('0x34')](_0x633525[_0x040e('0x35')],qs['fields'](_0x11b67c['query']['fields']));_0x29bedc[_0x040e('0x36')]=_0x29bedc[_0x040e('0x36')][_0x040e('0x37')]?_0x29bedc[_0x040e('0x36')]:_0x633525[_0x040e('0x35')];if(!_0x11b67c[_0x040e('0x31')][_0x040e('0x38')](_0x040e('0x39'))){_0x29bedc[_0x040e('0x20')]=qs[_0x040e('0x20')](_0x11b67c['query'][_0x040e('0x20')]);_0x29bedc[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x11b67c[_0x040e('0x31')][_0x040e('0x22')]);}_0x29bedc[_0x040e('0x3a')]=qs[_0x040e('0x3b')](_0x11b67c[_0x040e('0x31')][_0x040e('0x3b')]);_0x29bedc[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x11b67c[_0x040e('0x31')],_0x633525[_0x040e('0x33')]),_0x174cca);if(_0x11b67c[_0x040e('0x31')]['filter']){_0x29bedc[_0x040e('0x3c')]=_[_0x040e('0x3d')](_0x29bedc[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x174cca,function(_0x279516){if(_0x279516[_0x040e('0x2f')]!=='VIRTUAL'){var _0x4ded43={};_0x4ded43[_0x279516['name']]={'$like':'%'+_0x11b67c[_0x040e('0x31')][_0x040e('0x3e')]+'%'};return _0x4ded43;}})});}_0x29bedc=_[_0x040e('0x3d')]({},_0x29bedc,_0x11b67c['options']);var _0x2618d0={'where':_0x29bedc[_0x040e('0x3c')]};return db[_0x040e('0x3f')][_0x040e('0x21')](_0x2618d0)[_0x040e('0x28')](function(_0x503700){_0x417c8b[_0x040e('0x21')]=_0x503700;if(_0x11b67c[_0x040e('0x31')][_0x040e('0x40')]){_0x29bedc[_0x040e('0x41')]=[{'all':!![]}];}return db[_0x040e('0x3f')][_0x040e('0x42')](_0x29bedc);})[_0x040e('0x28')](function(_0x314b4e){_0x417c8b[_0x040e('0x43')]=_0x314b4e;return _0x417c8b;})['then'](respondWithFilteredResult(_0x1f65b3,_0x29bedc))[_0x040e('0x44')](handleError(_0x1f65b3,null));};exports['show']=function(_0x326ff0,_0x3f304d){var _0x4c5d2d={'raw':![],'where':{'id':_0x326ff0[_0x040e('0x45')]['id']}},_0x192866={};_0x192866['model']=_[_0x040e('0x32')](db['Dynamics365Configuration'][_0x040e('0x46')]);_0x192866[_0x040e('0x31')]=_[_0x040e('0x32')](_0x326ff0[_0x040e('0x31')]);_0x192866[_0x040e('0x33')]=_[_0x040e('0x34')](_0x192866[_0x040e('0x35')],_0x192866[_0x040e('0x31')]);_0x4c5d2d[_0x040e('0x36')]=_[_0x040e('0x34')](_0x192866[_0x040e('0x35')],qs[_0x040e('0x47')](_0x326ff0['query'][_0x040e('0x47')]));_0x4c5d2d['attributes']=_0x4c5d2d[_0x040e('0x36')]['length']?_0x4c5d2d['attributes']:_0x192866['model'];if(_0x326ff0[_0x040e('0x31')][_0x040e('0x40')]){_0x4c5d2d[_0x040e('0x41')]=[{'all':!![]}];}_0x4c5d2d=_[_0x040e('0x3d')]({},_0x4c5d2d,_0x326ff0[_0x040e('0x48')]);return db['Dynamics365Configuration'][_0x040e('0x49')](_0x4c5d2d)['then'](handleEntityNotFound(_0x3f304d,null))['then'](respondWithResult(_0x3f304d,null))[_0x040e('0x44')](handleError(_0x3f304d,null));};exports['create']=function(_0x45a680,_0xd44c9c){return db[_0x040e('0x3f')][_0x040e('0x4a')](_0x45a680[_0x040e('0x4b')],{})[_0x040e('0x28')](respondWithResult(_0xd44c9c,0xc9))[_0x040e('0x44')](handleError(_0xd44c9c,null));};exports[_0x040e('0x27')]=function(_0x465eb1,_0x32b3c8){if(_0x465eb1[_0x040e('0x4b')]['id']){delete _0x465eb1[_0x040e('0x4b')]['id'];}return db[_0x040e('0x3f')][_0x040e('0x49')]({'where':{'id':_0x465eb1[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x32b3c8,null))[_0x040e('0x28')](saveUpdates(_0x465eb1['body'],null))[_0x040e('0x28')](respondWithResult(_0x32b3c8,null))[_0x040e('0x44')](handleError(_0x32b3c8,null));};exports[_0x040e('0x4c')]=function(_0x2984d6,_0x5c55ec){return db['Dynamics365Configuration']['find']({'where':{'id':_0x2984d6['params']['id']}})['then'](handleEntityNotFound(_0x5c55ec,null))[_0x040e('0x28')](removeEntity(_0x5c55ec,null))[_0x040e('0x44')](handleError(_0x5c55ec,null));};exports[_0x040e('0x4d')]=function(_0x1545dd,_0x431be6,_0x48306d){var _0x4019d3={};var _0x5b284b={};var _0x5081c8;var _0x3ffbc2;return db[_0x040e('0x3f')]['findOne']({'where':{'id':_0x1545dd[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x431be6,null))[_0x040e('0x28')](function(_0x4fcd9c){if(_0x4fcd9c){_0x5081c8=_0x4fcd9c;_0x5b284b[_0x040e('0x35')]=_['keys'](db[_0x040e('0x4e')][_0x040e('0x46')]);_0x5b284b[_0x040e('0x31')]=_[_0x040e('0x32')](_0x1545dd[_0x040e('0x31')]);_0x5b284b['filters']=_['intersection'](_0x5b284b[_0x040e('0x35')],_0x5b284b[_0x040e('0x31')]);_0x4019d3[_0x040e('0x36')]=_[_0x040e('0x34')](_0x5b284b[_0x040e('0x35')],qs[_0x040e('0x47')](_0x1545dd['query'][_0x040e('0x47')]));_0x4019d3['attributes']=_0x4019d3['attributes'][_0x040e('0x37')]?_0x4019d3[_0x040e('0x36')]:_0x5b284b[_0x040e('0x35')];_0x4019d3['order']=qs[_0x040e('0x3b')](_0x1545dd[_0x040e('0x31')]['sort']);_0x4019d3['where']=qs[_0x040e('0x33')](_[_0x040e('0x4f')](_0x1545dd[_0x040e('0x31')],_0x5b284b[_0x040e('0x33')]));if(_0x1545dd['query']['filter']){_0x4019d3['where']=_[_0x040e('0x3d')](_0x4019d3['where'],{'$or':_['map'](_0x4019d3[_0x040e('0x36')],function(_0x247229){var _0x477dae={};_0x477dae[_0x247229]={'$like':'%'+_0x1545dd[_0x040e('0x31')][_0x040e('0x3e')]+'%'};return _0x477dae;})});}_0x4019d3=_[_0x040e('0x3d')]({},_0x4019d3,_0x1545dd[_0x040e('0x48')]);return _0x5081c8[_0x040e('0x4d')](_0x4019d3);}})[_0x040e('0x28')](function(_0x4b98d9){if(_0x4b98d9){_0x3ffbc2=_0x4b98d9[_0x040e('0x37')];if(!_0x1545dd[_0x040e('0x31')]['hasOwnProperty']('nolimit')){_0x4019d3[_0x040e('0x20')]=qs[_0x040e('0x20')](_0x1545dd[_0x040e('0x31')]['limit']);_0x4019d3[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x1545dd[_0x040e('0x31')]['offset']);}return _0x5081c8[_0x040e('0x4d')](_0x4019d3);}})[_0x040e('0x28')](function(_0x49f4ed){if(_0x49f4ed){return _0x49f4ed?{'count':_0x3ffbc2,'rows':_0x49f4ed}:null;}})['then'](respondWithResult(_0x431be6,null))[_0x040e('0x44')](handleError(_0x431be6,null));};exports[_0x040e('0x50')]=function(_0x3dfd85,_0x4f8bc9,_0x59ef00){var _0x4b2790={};var _0x177367={};var _0x497fda;var _0x58051b;return db['Dynamics365Configuration'][_0x040e('0x51')]({'where':{'id':_0x3dfd85[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x4f8bc9,null))[_0x040e('0x28')](function(_0x5778c6){if(_0x5778c6){_0x497fda=_0x5778c6;_0x177367[_0x040e('0x35')]=_[_0x040e('0x32')](db[_0x040e('0x4e')][_0x040e('0x46')]);_0x177367[_0x040e('0x31')]=_[_0x040e('0x32')](_0x3dfd85[_0x040e('0x31')]);_0x177367['filters']=_['intersection'](_0x177367[_0x040e('0x35')],_0x177367[_0x040e('0x31')]);_0x4b2790[_0x040e('0x36')]=_[_0x040e('0x34')](_0x177367[_0x040e('0x35')],qs[_0x040e('0x47')](_0x3dfd85[_0x040e('0x31')][_0x040e('0x47')]));_0x4b2790[_0x040e('0x36')]=_0x4b2790[_0x040e('0x36')][_0x040e('0x37')]?_0x4b2790[_0x040e('0x36')]:_0x177367[_0x040e('0x35')];_0x4b2790['order']=qs[_0x040e('0x3b')](_0x3dfd85['query'][_0x040e('0x3b')]);_0x4b2790[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x3dfd85[_0x040e('0x31')],_0x177367[_0x040e('0x33')]));if(_0x3dfd85['query']['filter']){_0x4b2790['where']=_[_0x040e('0x3d')](_0x4b2790[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x4b2790[_0x040e('0x36')],function(_0x11bcea){var _0x163fea={};_0x163fea[_0x11bcea]={'$like':'%'+_0x3dfd85['query'][_0x040e('0x3e')]+'%'};return _0x163fea;})});}_0x4b2790=_[_0x040e('0x3d')]({},_0x4b2790,_0x3dfd85[_0x040e('0x48')]);return _0x497fda[_0x040e('0x50')](_0x4b2790);}})['then'](function(_0x1da243){if(_0x1da243){_0x58051b=_0x1da243[_0x040e('0x37')];if(!_0x3dfd85['query']['hasOwnProperty'](_0x040e('0x39'))){_0x4b2790[_0x040e('0x20')]=qs['limit'](_0x3dfd85[_0x040e('0x31')]['limit']);_0x4b2790[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x3dfd85['query'][_0x040e('0x22')]);}return _0x497fda[_0x040e('0x50')](_0x4b2790);}})[_0x040e('0x28')](function(_0x549847){if(_0x549847){return _0x549847?{'count':_0x58051b,'rows':_0x549847}:null;}})[_0x040e('0x28')](respondWithResult(_0x4f8bc9,null))['catch'](handleError(_0x4f8bc9,null));};exports[_0x040e('0x52')]=function(_0x2a8f1a,_0x28eff3,_0x575c08){var _0x55dd05={};var _0x32da2f={};var _0x42c8de;var _0x1530e4;return db['Dynamics365Configuration'][_0x040e('0x51')]({'where':{'id':_0x2a8f1a['params']['id']}})['then'](handleEntityNotFound(_0x28eff3,null))[_0x040e('0x28')](function(_0xc1414){if(_0xc1414){_0x42c8de=_0xc1414;_0x32da2f['model']=_[_0x040e('0x32')](db['Dynamics365Field'][_0x040e('0x46')]);_0x32da2f[_0x040e('0x31')]=_[_0x040e('0x32')](_0x2a8f1a[_0x040e('0x31')]);_0x32da2f['filters']=_[_0x040e('0x34')](_0x32da2f[_0x040e('0x35')],_0x32da2f[_0x040e('0x31')]);_0x55dd05['attributes']=_[_0x040e('0x34')](_0x32da2f[_0x040e('0x35')],qs['fields'](_0x2a8f1a[_0x040e('0x31')]['fields']));_0x55dd05[_0x040e('0x36')]=_0x55dd05[_0x040e('0x36')][_0x040e('0x37')]?_0x55dd05[_0x040e('0x36')]:_0x32da2f[_0x040e('0x35')];_0x55dd05[_0x040e('0x3a')]=qs[_0x040e('0x3b')](_0x2a8f1a[_0x040e('0x31')][_0x040e('0x3b')]);_0x55dd05[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x2a8f1a[_0x040e('0x31')],_0x32da2f[_0x040e('0x33')]));if(_0x2a8f1a[_0x040e('0x31')][_0x040e('0x3e')]){_0x55dd05[_0x040e('0x3c')]=_['merge'](_0x55dd05[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x55dd05[_0x040e('0x36')],function(_0x30600f){var _0x2db2fb={};_0x2db2fb[_0x30600f]={'$like':'%'+_0x2a8f1a[_0x040e('0x31')]['filter']+'%'};return _0x2db2fb;})});}_0x55dd05=_[_0x040e('0x3d')]({},_0x55dd05,_0x2a8f1a[_0x040e('0x48')]);return _0x42c8de[_0x040e('0x52')](_0x55dd05);}})['then'](function(_0x5b3a66){if(_0x5b3a66){_0x1530e4=_0x5b3a66['length'];if(!_0x2a8f1a[_0x040e('0x31')][_0x040e('0x38')](_0x040e('0x39'))){_0x55dd05['limit']=qs[_0x040e('0x20')](_0x2a8f1a[_0x040e('0x31')][_0x040e('0x20')]);_0x55dd05[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x2a8f1a[_0x040e('0x31')]['offset']);}return _0x42c8de[_0x040e('0x52')](_0x55dd05);}})['then'](function(_0x2002e0){if(_0x2002e0){return _0x2002e0?{'count':_0x1530e4,'rows':_0x2002e0}:null;}})[_0x040e('0x28')](respondWithResult(_0x28eff3,null))[_0x040e('0x44')](handleError(_0x28eff3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1a0cbb4..331162e 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x2a76fa,_0x1cee7d){var _0x2d2442=function(_0x2f5e81){while(--_0x2f5e81){_0x2a76fa['push'](_0x2a76fa['shift']());}};_0x2d2442(++_0x1cee7d);}(_0x3e74,0x175));var _0x43e7=function(_0x308f25,_0x1c917f){_0x308f25=_0x308f25-0x0;var _0x4a979d=_0x3e74[_0x308f25];return _0x4a979d;};'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 +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0xc0f0d6,_0x4f4015){var _0x40d7ee=function(_0x246eac){while(--_0x246eac){_0xc0f0d6['push'](_0xc0f0d6['shift']());}};_0x40d7ee(++_0x4f4015);}(_0x84ab,0x12f));var _0xb84a=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x84ab[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 8a03d44..fde97f4 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 _0x7873=['request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x7873,0x11c));var _0x3787=function(_0x29b9a7,_0x1c4cec){_0x29b9a7=_0x29b9a7-0x0;var _0x41e71f=_0x7873[_0x29b9a7];return _0x41e71f;};'use strict';var _=require(_0x3787('0x0'));var util=require(_0x3787('0x1'));var moment=require(_0x3787('0x2'));var BPromise=require(_0x3787('0x3'));var rs=require(_0x3787('0x4'));var fs=require('fs');var Redis=require(_0x3787('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3787('0x6'));var logger=require(_0x3787('0x7'))(_0x3787('0x8'));var config=require(_0x3787('0x9'));var jayson=require(_0x3787('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3765c3,_0x1d494c,_0x570d8d){return new BPromise(function(_0x48aad7,_0x3bbe51){return client[_0x3787('0xb')](_0x3765c3,_0x570d8d)[_0x3787('0xc')](function(_0x134ac7){logger[_0x3787('0xd')](_0x3787('0xe'),_0x1d494c,_0x3787('0xf'));logger['debug'](_0x3787('0x10'),_0x1d494c,_0x3787('0xf'),JSON[_0x3787('0x11')](_0x134ac7));if(_0x134ac7[_0x3787('0x12')]){if(_0x134ac7[_0x3787('0x12')][_0x3787('0x13')]===0x1f4){logger[_0x3787('0x12')](_0x3787('0xe'),_0x1d494c,_0x134ac7['error'][_0x3787('0x14')]);return _0x3bbe51(_0x134ac7['error'][_0x3787('0x14')]);}logger[_0x3787('0x12')](_0x3787('0xe'),_0x1d494c,_0x134ac7[_0x3787('0x12')]['message']);return _0x48aad7(_0x134ac7[_0x3787('0x12')][_0x3787('0x14')]);}else{logger[_0x3787('0xd')](_0x3787('0xe'),_0x1d494c,_0x3787('0xf'));_0x48aad7(_0x134ac7[_0x3787('0x15')][_0x3787('0x14')]);}})[_0x3787('0x16')](function(_0x5be2d7){logger[_0x3787('0x12')](_0x3787('0xe'),_0x1d494c,_0x5be2d7);_0x3bbe51(_0x5be2d7);});});} \ No newline at end of file +var _0x5a09=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x3b58d1,_0x979f58){var _0x2ecdcb=function(_0x12b773){while(--_0x12b773){_0x3b58d1['push'](_0x3b58d1['shift']());}};_0x2ecdcb(++_0x979f58);}(_0x5a09,0x141));var _0x95a0=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x5a09[_0x5c6299];return _0x23b564;};'use strict';var _=require(_0x95a0('0x0'));var util=require(_0x95a0('0x1'));var moment=require(_0x95a0('0x2'));var BPromise=require(_0x95a0('0x3'));var rs=require(_0x95a0('0x4'));var fs=require('fs');var Redis=require(_0x95a0('0x5'));var db=require(_0x95a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x95a0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x95a0('0x8')][_0x95a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1f00,_0x381a90,_0x1cf6fb){return new BPromise(function(_0x2148ca,_0x413f73){return client[_0x95a0('0xa')](_0x5e1f00,_0x1cf6fb)['then'](function(_0x30a224){logger[_0x95a0('0xb')](_0x95a0('0xc'),_0x381a90,_0x95a0('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x381a90,_0x95a0('0xd'),JSON[_0x95a0('0xe')](_0x30a224));if(_0x30a224[_0x95a0('0xf')]){if(_0x30a224[_0x95a0('0xf')][_0x95a0('0x10')]===0x1f4){logger['error'](_0x95a0('0xc'),_0x381a90,_0x30a224['error'][_0x95a0('0x11')]);return _0x413f73(_0x30a224['error']['message']);}logger[_0x95a0('0xf')](_0x95a0('0xc'),_0x381a90,_0x30a224[_0x95a0('0xf')][_0x95a0('0x11')]);return _0x2148ca(_0x30a224[_0x95a0('0xf')]['message']);}else{logger['info'](_0x95a0('0xc'),_0x381a90,_0x95a0('0xd'));_0x2148ca(_0x30a224['result']['message']);}})[_0x95a0('0x12')](function(_0x132869){logger['error'](_0x95a0('0xc'),_0x381a90,_0x132869);_0x413f73(_0x132869);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9bf6f30..3cc1b38 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 _0x6925=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e5a65,_0x3338f1){var _0x2a2a1a=function(_0x397c3e){while(--_0x397c3e){_0x2e5a65['push'](_0x2e5a65['shift']());}};_0x2a2a1a(++_0x3338f1);}(_0x6925,0x159));var _0x5692=function(_0x45cb2a,_0x4e0085){_0x45cb2a=_0x45cb2a-0x0;var _0x31444b=_0x6925[_0x45cb2a];return _0x31444b;};'use strict';var multer=require(_0x5692('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5692('0x1'));var express=require(_0x5692('0x2'));var router=express['Router']();var fs_extra=require(_0x5692('0x3'));var auth=require(_0x5692('0x4'));var interaction=require(_0x5692('0x5'));var config=require(_0x5692('0x6'));var controller=require(_0x5692('0x7'));router[_0x5692('0x8')]('/',auth[_0x5692('0x9')](),controller['index']);router[_0x5692('0x8')](_0x5692('0xa'),auth['isAuthenticated'](),controller[_0x5692('0xb')]);router[_0x5692('0xc')]('/',auth[_0x5692('0x9')](),controller[_0x5692('0xd')]);router[_0x5692('0xe')](_0x5692('0xa'),auth[_0x5692('0x9')](),controller['update']);router['delete'](_0x5692('0xa'),auth[_0x5692('0x9')](),controller[_0x5692('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7d64=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x7d64,0x18d));var _0x47d6=function(_0x3b78a2,_0x5e9793){_0x3b78a2=_0x3b78a2-0x0;var _0x4592b4=_0x7d64[_0x3b78a2];return _0x4592b4;};'use strict';var multer=require('multer');var util=require(_0x47d6('0x0'));var path=require(_0x47d6('0x1'));var timeout=require(_0x47d6('0x2'));var express=require(_0x47d6('0x3'));var router=express[_0x47d6('0x4')]();var fs_extra=require(_0x47d6('0x5'));var auth=require(_0x47d6('0x6'));var interaction=require(_0x47d6('0x7'));var config=require(_0x47d6('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x47d6('0x9')]('/',auth[_0x47d6('0xa')](),controller['index']);router[_0x47d6('0x9')](_0x47d6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x47d6('0xc')]('/',auth[_0x47d6('0xa')](),controller[_0x47d6('0xd')]);router[_0x47d6('0xe')](_0x47d6('0xb'),auth[_0x47d6('0xa')](),controller['update']);router[_0x47d6('0xf')](_0x47d6('0xb'),auth['isAuthenticated'](),controller[_0x47d6('0x10')]);module[_0x47d6('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 78ba523..0bec00f 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 _0x9621=['variable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x9621,0x11d));var _0x1962=function(_0x7f54b1,_0x4cd30f){_0x7f54b1=_0x7f54b1-0x0;var _0x1b409c=_0x9621[_0x7f54b1];return _0x1b409c;};'use strict';var Sequelize=require(_0x1962('0x0'));module[_0x1962('0x1')]={'type':{'type':Sequelize[_0x1962('0x2')]('string',_0x1962('0x3'),'customVariable','keyValue',_0x1962('0x4')),'defaultValue':_0x1962('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1962('0x6')]},'keyType':{'type':Sequelize[_0x1962('0x2')]('string',_0x1962('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1962('0x6')]},'idField':{'type':Sequelize[_0x1962('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1962('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1962('0x6')]}}; \ No newline at end of file +var _0x5c20=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5c20,0x14a));var _0x05c2=function(_0x333162,_0xa11eb8){_0x333162=_0x333162-0x0;var _0x1883fa=_0x5c20[_0x333162];return _0x1883fa;};'use strict';var Sequelize=require('sequelize');module[_0x05c2('0x0')]={'type':{'type':Sequelize['ENUM'](_0x05c2('0x1'),_0x05c2('0x2'),_0x05c2('0x3'),_0x05c2('0x4'),'picklist'),'defaultValue':_0x05c2('0x1')},'content':{'type':Sequelize[_0x05c2('0x5')]},'key':{'type':Sequelize[_0x05c2('0x5')]},'keyType':{'type':Sequelize[_0x05c2('0x6')](_0x05c2('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x05c2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8a1b278..c124100 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 _0xfb2f=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','Dynamics365Field','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0xfb2f,0x1f0));var _0xffb2=function(_0x1a5a1b,_0x59772e){_0x1a5a1b=_0x1a5a1b-0x0;var _0x2cbc1c=_0xfb2f[_0x1a5a1b];return _0x2cbc1c;};'use strict';var emlformat=require(_0xffb2('0x0'));var rimraf=require(_0xffb2('0x1'));var zipdir=require(_0xffb2('0x2'));var jsonpatch=require(_0xffb2('0x3'));var rp=require(_0xffb2('0x4'));var moment=require(_0xffb2('0x5'));var BPromise=require(_0xffb2('0x6'));var Mustache=require(_0xffb2('0x7'));var util=require('util');var path=require(_0xffb2('0x8'));var sox=require('sox');var csv=require(_0xffb2('0x9'));var ejs=require(_0xffb2('0xa'));var fs=require('fs');var fs_extra=require(_0xffb2('0xb'));var _=require(_0xffb2('0xc'));var squel=require(_0xffb2('0xd'));var crypto=require(_0xffb2('0xe'));var jsforce=require(_0xffb2('0xf'));var deskjs=require(_0xffb2('0x10'));var toCsv=require(_0xffb2('0x9'));var querystring=require(_0xffb2('0x11'));var Papa=require(_0xffb2('0x12'));var Redis=require(_0xffb2('0x13'));var authService=require(_0xffb2('0x14'));var qs=require(_0xffb2('0x15'));var as=require(_0xffb2('0x16'));var hardwareService=require(_0xffb2('0x17'));var logger=require(_0xffb2('0x18'))(_0xffb2('0x19'));var utils=require(_0xffb2('0x1a'));var config=require(_0xffb2('0x1b'));var licenseUtil=require(_0xffb2('0x1c'));var db=require(_0xffb2('0x1d'))['db'];function respondWithStatusCode(_0x4c3967,_0x5b46c5){_0x5b46c5=_0x5b46c5||0xcc;return function(_0x2e2825){if(_0x2e2825){return _0x4c3967[_0xffb2('0x1e')](_0x5b46c5);}return _0x4c3967['status'](_0x5b46c5)[_0xffb2('0x1f')]();};}function respondWithResult(_0x5a89f6,_0x557dfa){_0x557dfa=_0x557dfa||0xc8;return function(_0x5202f7){if(_0x5202f7){return _0x5a89f6[_0xffb2('0x20')](_0x557dfa)[_0xffb2('0x21')](_0x5202f7);}};}function respondWithFilteredResult(_0x444caa,_0x5801eb){return function(_0x471df2){if(_0x471df2){var _0x4cc02d=typeof _0x5801eb[_0xffb2('0x22')]==='undefined'&&typeof _0x5801eb[_0xffb2('0x23')]==='undefined';var _0x884a4=_0x471df2['count'];var _0x1db353=_0x4cc02d?0x0:_0x5801eb[_0xffb2('0x22')];var _0xe8a68b=_0x4cc02d?_0x471df2[_0xffb2('0x24')]:_0x5801eb[_0xffb2('0x22')]+_0x5801eb['limit'];var _0x327cea;if(_0xe8a68b>=_0x884a4){_0xe8a68b=_0x884a4;_0x327cea=0xc8;}else{_0x327cea=0xce;}_0x444caa[_0xffb2('0x20')](_0x327cea);return _0x444caa['set'](_0xffb2('0x25'),_0x1db353+'-'+_0xe8a68b+'/'+_0x884a4)[_0xffb2('0x21')](_0x471df2);}return null;};}function patchUpdates(_0x1ed6c7){return function(_0x1195d4){try{jsonpatch[_0xffb2('0x26')](_0x1195d4,_0x1ed6c7,!![]);}catch(_0x200df3){return BPromise['reject'](_0x200df3);}return _0x1195d4[_0xffb2('0x27')]();};}function saveUpdates(_0x24598e,_0x111e62){return function(_0x3857a5){if(_0x3857a5){return _0x3857a5[_0xffb2('0x28')](_0x24598e)['then'](function(_0x578895){return _0x578895;});}return null;};}function removeEntity(_0x5474da,_0x3da25f){return function(_0x266547){if(_0x266547){return _0x266547[_0xffb2('0x29')]()[_0xffb2('0x2a')](function(){_0x5474da['status'](0xcc)[_0xffb2('0x1f')]();});}};}function handleEntityNotFound(_0x40881c,_0xd431d0){return function(_0x577510){if(!_0x577510){_0x40881c[_0xffb2('0x1e')](0x194);}return _0x577510;};}function handleError(_0x463276,_0x336b23){_0x336b23=_0x336b23||0x1f4;return function(_0x57f210){logger[_0xffb2('0x2b')](_0x57f210[_0xffb2('0x2c')]);if(_0x57f210[_0xffb2('0x2d')]){delete _0x57f210[_0xffb2('0x2d')];}_0x463276[_0xffb2('0x20')](_0x336b23)['send'](_0x57f210);};}exports[_0xffb2('0x2e')]=function(_0x21cb20,_0x266d9d){var _0x53561b={},_0x1051d4={},_0x25b5e8={'count':0x0,'rows':[]};var _0xcae620=_[_0xffb2('0x2f')](db[_0xffb2('0x30')]['rawAttributes'],function(_0x3bf90a){return{'name':_0x3bf90a[_0xffb2('0x31')],'type':_0x3bf90a[_0xffb2('0x32')][_0xffb2('0x33')]};});_0x1051d4[_0xffb2('0x34')]=_['map'](_0xcae620,_0xffb2('0x2d'));_0x1051d4['query']=_[_0xffb2('0x35')](_0x21cb20[_0xffb2('0x36')]);_0x1051d4[_0xffb2('0x37')]=_[_0xffb2('0x38')](_0x1051d4[_0xffb2('0x34')],_0x1051d4['query']);_0x53561b[_0xffb2('0x39')]=_['intersection'](_0x1051d4[_0xffb2('0x34')],qs['fields'](_0x21cb20[_0xffb2('0x36')][_0xffb2('0x3a')]));_0x53561b['attributes']=_0x53561b['attributes'][_0xffb2('0x3b')]?_0x53561b[_0xffb2('0x39')]:_0x1051d4[_0xffb2('0x34')];if(!_0x21cb20[_0xffb2('0x36')][_0xffb2('0x3c')]('nolimit')){_0x53561b[_0xffb2('0x23')]=qs['limit'](_0x21cb20[_0xffb2('0x36')][_0xffb2('0x23')]);_0x53561b[_0xffb2('0x22')]=qs['offset'](_0x21cb20[_0xffb2('0x36')][_0xffb2('0x22')]);}_0x53561b[_0xffb2('0x3d')]=qs['sort'](_0x21cb20[_0xffb2('0x36')][_0xffb2('0x3e')]);_0x53561b[_0xffb2('0x3f')]=qs['filters'](_[_0xffb2('0x40')](_0x21cb20[_0xffb2('0x36')],_0x1051d4[_0xffb2('0x37')]),_0xcae620);if(_0x21cb20[_0xffb2('0x36')][_0xffb2('0x41')]){_0x53561b['where']=_[_0xffb2('0x42')](_0x53561b[_0xffb2('0x3f')],{'$or':_[_0xffb2('0x2f')](_0xcae620,function(_0x89a00a){if(_0x89a00a[_0xffb2('0x32')]!==_0xffb2('0x43')){var _0x5e3195={};_0x5e3195[_0x89a00a[_0xffb2('0x2d')]]={'$like':'%'+_0x21cb20[_0xffb2('0x36')][_0xffb2('0x41')]+'%'};return _0x5e3195;}})});}_0x53561b=_['merge']({},_0x53561b,_0x21cb20[_0xffb2('0x44')]);var _0xcf987f={'where':_0x53561b[_0xffb2('0x3f')]};return db[_0xffb2('0x30')][_0xffb2('0x24')](_0xcf987f)[_0xffb2('0x2a')](function(_0x3e8d4c){_0x25b5e8['count']=_0x3e8d4c;if(_0x21cb20['query']['includeAll']){_0x53561b[_0xffb2('0x45')]=[{'all':!![]}];}return db[_0xffb2('0x30')][_0xffb2('0x46')](_0x53561b);})['then'](function(_0x16b496){_0x25b5e8[_0xffb2('0x47')]=_0x16b496;return _0x25b5e8;})[_0xffb2('0x2a')](respondWithFilteredResult(_0x266d9d,_0x53561b))[_0xffb2('0x48')](handleError(_0x266d9d,null));};exports[_0xffb2('0x49')]=function(_0x2bb543,_0x104e87){var _0x536333={'raw':!![],'where':{'id':_0x2bb543[_0xffb2('0x4a')]['id']}},_0x4b930e={};_0x4b930e['model']=_[_0xffb2('0x35')](db['Dynamics365Field'][_0xffb2('0x4b')]);_0x4b930e['query']=_[_0xffb2('0x35')](_0x2bb543[_0xffb2('0x36')]);_0x4b930e['filters']=_[_0xffb2('0x38')](_0x4b930e[_0xffb2('0x34')],_0x4b930e[_0xffb2('0x36')]);_0x536333[_0xffb2('0x39')]=_[_0xffb2('0x38')](_0x4b930e[_0xffb2('0x34')],qs[_0xffb2('0x3a')](_0x2bb543['query'][_0xffb2('0x3a')]));_0x536333['attributes']=_0x536333[_0xffb2('0x39')][_0xffb2('0x3b')]?_0x536333[_0xffb2('0x39')]:_0x4b930e['model'];if(_0x2bb543[_0xffb2('0x36')][_0xffb2('0x4c')]){_0x536333[_0xffb2('0x45')]=[{'all':!![]}];}_0x536333=_[_0xffb2('0x42')]({},_0x536333,_0x2bb543[_0xffb2('0x44')]);return db[_0xffb2('0x30')][_0xffb2('0x4d')](_0x536333)[_0xffb2('0x2a')](handleEntityNotFound(_0x104e87,null))[_0xffb2('0x2a')](respondWithResult(_0x104e87,null))[_0xffb2('0x48')](handleError(_0x104e87,null));};exports[_0xffb2('0x4e')]=function(_0x178500,_0x4e0c3a){return db['Dynamics365Field'][_0xffb2('0x4e')](_0x178500['body'],{})[_0xffb2('0x2a')](respondWithResult(_0x4e0c3a,0xc9))[_0xffb2('0x48')](handleError(_0x4e0c3a,null));};exports['update']=function(_0x460734,_0x3fd925){if(_0x460734[_0xffb2('0x4f')]['id']){delete _0x460734['body']['id'];}return db[_0xffb2('0x30')][_0xffb2('0x4d')]({'where':{'id':_0x460734['params']['id']}})[_0xffb2('0x2a')](handleEntityNotFound(_0x3fd925,null))[_0xffb2('0x2a')](saveUpdates(_0x460734[_0xffb2('0x4f')],null))['then'](respondWithResult(_0x3fd925,null))[_0xffb2('0x48')](handleError(_0x3fd925,null));};exports[_0xffb2('0x29')]=function(_0x2bf4ef,_0x122f8b){return db[_0xffb2('0x30')][_0xffb2('0x4d')]({'where':{'id':_0x2bf4ef[_0xffb2('0x4a')]['id']}})[_0xffb2('0x2a')](handleEntityNotFound(_0x122f8b,null))[_0xffb2('0x2a')](removeEntity(_0x122f8b,null))['catch'](handleError(_0x122f8b,null));}; \ No newline at end of file +var _0x9893=['show','params','keys','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','name','send','index','map','Dynamics365Field','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x1ee85d,_0x288347){var _0x26a7a5=function(_0x430a79){while(--_0x430a79){_0x1ee85d['push'](_0x1ee85d['shift']());}};_0x26a7a5(++_0x288347);}(_0x9893,0x9f));var _0x3989=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9893[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3989('0x0'));var rimraf=require(_0x3989('0x1'));var zipdir=require(_0x3989('0x2'));var jsonpatch=require(_0x3989('0x3'));var rp=require(_0x3989('0x4'));var moment=require(_0x3989('0x5'));var BPromise=require(_0x3989('0x6'));var Mustache=require(_0x3989('0x7'));var util=require(_0x3989('0x8'));var path=require(_0x3989('0x9'));var sox=require(_0x3989('0xa'));var csv=require(_0x3989('0xb'));var ejs=require(_0x3989('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3989('0xd'));var crypto=require(_0x3989('0xe'));var jsforce=require(_0x3989('0xf'));var deskjs=require(_0x3989('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3989('0x11'));var Papa=require('papaparse');var Redis=require(_0x3989('0x12'));var authService=require(_0x3989('0x13'));var qs=require(_0x3989('0x14'));var as=require(_0x3989('0x15'));var hardwareService=require(_0x3989('0x16'));var logger=require(_0x3989('0x17'))(_0x3989('0x18'));var utils=require(_0x3989('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3989('0x1a'));var db=require(_0x3989('0x1b'))['db'];function respondWithStatusCode(_0x11c76a,_0x21e73a){_0x21e73a=_0x21e73a||0xcc;return function(_0x1c056f){if(_0x1c056f){return _0x11c76a[_0x3989('0x1c')](_0x21e73a);}return _0x11c76a[_0x3989('0x1d')](_0x21e73a)[_0x3989('0x1e')]();};}function respondWithResult(_0x4db378,_0x586c61){_0x586c61=_0x586c61||0xc8;return function(_0x28183a){if(_0x28183a){return _0x4db378['status'](_0x586c61)[_0x3989('0x1f')](_0x28183a);}};}function respondWithFilteredResult(_0x214dd9,_0x5134b2){return function(_0xcd0a8a){if(_0xcd0a8a){var _0x222953=typeof _0x5134b2[_0x3989('0x20')]===_0x3989('0x21')&&typeof _0x5134b2[_0x3989('0x22')]===_0x3989('0x21');var _0x13de40=_0xcd0a8a[_0x3989('0x23')];var _0x43b304=_0x222953?0x0:_0x5134b2['offset'];var _0x349c20=_0x222953?_0xcd0a8a[_0x3989('0x23')]:_0x5134b2[_0x3989('0x20')]+_0x5134b2[_0x3989('0x22')];var _0x213346;if(_0x349c20>=_0x13de40){_0x349c20=_0x13de40;_0x213346=0xc8;}else{_0x213346=0xce;}_0x214dd9[_0x3989('0x1d')](_0x213346);return _0x214dd9[_0x3989('0x24')]('Content-Range',_0x43b304+'-'+_0x349c20+'/'+_0x13de40)[_0x3989('0x1f')](_0xcd0a8a);}return null;};}function patchUpdates(_0x3c9257){return function(_0x54f62a){try{jsonpatch[_0x3989('0x25')](_0x54f62a,_0x3c9257,!![]);}catch(_0xb50280){return BPromise[_0x3989('0x26')](_0xb50280);}return _0x54f62a['save']();};}function saveUpdates(_0x541b5d,_0x516000){return function(_0x3be449){if(_0x3be449){return _0x3be449[_0x3989('0x27')](_0x541b5d)[_0x3989('0x28')](function(_0x1ef7f6){return _0x1ef7f6;});}return null;};}function removeEntity(_0x5e7c37,_0x34808d){return function(_0x5aac34){if(_0x5aac34){return _0x5aac34[_0x3989('0x29')]()[_0x3989('0x28')](function(){_0x5e7c37[_0x3989('0x1d')](0xcc)[_0x3989('0x1e')]();});}};}function handleEntityNotFound(_0x2ecfa5,_0x4cb770){return function(_0x483dc7){if(!_0x483dc7){_0x2ecfa5[_0x3989('0x1c')](0x194);}return _0x483dc7;};}function handleError(_0x520af1,_0x5de3f4){_0x5de3f4=_0x5de3f4||0x1f4;return function(_0x4ce04c){logger['error'](_0x4ce04c['stack']);if(_0x4ce04c[_0x3989('0x2a')]){delete _0x4ce04c[_0x3989('0x2a')];}_0x520af1[_0x3989('0x1d')](_0x5de3f4)[_0x3989('0x2b')](_0x4ce04c);};}exports[_0x3989('0x2c')]=function(_0x6dfb35,_0x18d707){var _0xed1275={},_0x2f8b84={},_0x14a17d={'count':0x0,'rows':[]};var _0x31e645=_[_0x3989('0x2d')](db[_0x3989('0x2e')][_0x3989('0x2f')],function(_0x29d022){return{'name':_0x29d022['fieldName'],'type':_0x29d022[_0x3989('0x30')][_0x3989('0x31')]};});_0x2f8b84['model']=_[_0x3989('0x2d')](_0x31e645,_0x3989('0x2a'));_0x2f8b84['query']=_['keys'](_0x6dfb35[_0x3989('0x32')]);_0x2f8b84[_0x3989('0x33')]=_['intersection'](_0x2f8b84[_0x3989('0x34')],_0x2f8b84[_0x3989('0x32')]);_0xed1275[_0x3989('0x35')]=_[_0x3989('0x36')](_0x2f8b84[_0x3989('0x34')],qs[_0x3989('0x37')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x37')]));_0xed1275[_0x3989('0x35')]=_0xed1275[_0x3989('0x35')][_0x3989('0x38')]?_0xed1275[_0x3989('0x35')]:_0x2f8b84[_0x3989('0x34')];if(!_0x6dfb35[_0x3989('0x32')]['hasOwnProperty'](_0x3989('0x39'))){_0xed1275[_0x3989('0x22')]=qs[_0x3989('0x22')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x22')]);_0xed1275[_0x3989('0x20')]=qs[_0x3989('0x20')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x20')]);}_0xed1275['order']=qs[_0x3989('0x3a')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x3a')]);_0xed1275[_0x3989('0x3b')]=qs[_0x3989('0x33')](_[_0x3989('0x3c')](_0x6dfb35[_0x3989('0x32')],_0x2f8b84['filters']),_0x31e645);if(_0x6dfb35[_0x3989('0x32')][_0x3989('0x3d')]){_0xed1275[_0x3989('0x3b')]=_[_0x3989('0x3e')](_0xed1275[_0x3989('0x3b')],{'$or':_[_0x3989('0x2d')](_0x31e645,function(_0x2a7dd7){if(_0x2a7dd7[_0x3989('0x30')]!==_0x3989('0x3f')){var _0x1f2c23={};_0x1f2c23[_0x2a7dd7[_0x3989('0x2a')]]={'$like':'%'+_0x6dfb35[_0x3989('0x32')][_0x3989('0x3d')]+'%'};return _0x1f2c23;}})});}_0xed1275=_['merge']({},_0xed1275,_0x6dfb35[_0x3989('0x40')]);var _0x156cce={'where':_0xed1275[_0x3989('0x3b')]};return db[_0x3989('0x2e')][_0x3989('0x23')](_0x156cce)['then'](function(_0x1bad3a){_0x14a17d[_0x3989('0x23')]=_0x1bad3a;if(_0x6dfb35['query'][_0x3989('0x41')]){_0xed1275['include']=[{'all':!![]}];}return db[_0x3989('0x2e')][_0x3989('0x42')](_0xed1275);})[_0x3989('0x28')](function(_0x5db8b0){_0x14a17d[_0x3989('0x43')]=_0x5db8b0;return _0x14a17d;})['then'](respondWithFilteredResult(_0x18d707,_0xed1275))[_0x3989('0x44')](handleError(_0x18d707,null));};exports[_0x3989('0x45')]=function(_0x3e7984,_0x4fb427){var _0x36fbbf={'raw':!![],'where':{'id':_0x3e7984[_0x3989('0x46')]['id']}},_0x24027a={};_0x24027a['model']=_[_0x3989('0x47')](db[_0x3989('0x2e')][_0x3989('0x2f')]);_0x24027a[_0x3989('0x32')]=_[_0x3989('0x47')](_0x3e7984[_0x3989('0x32')]);_0x24027a[_0x3989('0x33')]=_[_0x3989('0x36')](_0x24027a['model'],_0x24027a[_0x3989('0x32')]);_0x36fbbf['attributes']=_[_0x3989('0x36')](_0x24027a['model'],qs[_0x3989('0x37')](_0x3e7984[_0x3989('0x32')][_0x3989('0x37')]));_0x36fbbf[_0x3989('0x35')]=_0x36fbbf[_0x3989('0x35')]['length']?_0x36fbbf['attributes']:_0x24027a['model'];if(_0x3e7984[_0x3989('0x32')]['includeAll']){_0x36fbbf[_0x3989('0x48')]=[{'all':!![]}];}_0x36fbbf=_[_0x3989('0x3e')]({},_0x36fbbf,_0x3e7984['options']);return db[_0x3989('0x2e')]['find'](_0x36fbbf)['then'](handleEntityNotFound(_0x4fb427,null))[_0x3989('0x28')](respondWithResult(_0x4fb427,null))['catch'](handleError(_0x4fb427,null));};exports[_0x3989('0x49')]=function(_0x4b6e3b,_0x5ba0d8){return db['Dynamics365Field'][_0x3989('0x49')](_0x4b6e3b[_0x3989('0x4a')],{})[_0x3989('0x28')](respondWithResult(_0x5ba0d8,0xc9))[_0x3989('0x44')](handleError(_0x5ba0d8,null));};exports[_0x3989('0x27')]=function(_0x28df42,_0x797dd){if(_0x28df42[_0x3989('0x4a')]['id']){delete _0x28df42['body']['id'];}return db[_0x3989('0x2e')][_0x3989('0x4b')]({'where':{'id':_0x28df42['params']['id']}})[_0x3989('0x28')](handleEntityNotFound(_0x797dd,null))[_0x3989('0x28')](saveUpdates(_0x28df42[_0x3989('0x4a')],null))[_0x3989('0x28')](respondWithResult(_0x797dd,null))[_0x3989('0x44')](handleError(_0x797dd,null));};exports[_0x3989('0x29')]=function(_0x39cee7,_0x400da3){return db['Dynamics365Field']['find']({'where':{'id':_0x39cee7[_0x3989('0x46')]['id']}})[_0x3989('0x28')](handleEntityNotFound(_0x400da3,null))[_0x3989('0x28')](removeEntity(_0x400da3,null))[_0x3989('0x44')](handleError(_0x400da3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a86d759..a6519a7 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 _0xca2c=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x24201a,_0x3ed184){var _0x36a6b9=function(_0x300d74){while(--_0x300d74){_0x24201a['push'](_0x24201a['shift']());}};_0x36a6b9(++_0x3ed184);}(_0xca2c,0xf5));var _0xcca2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xca2c[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xcca2('0x0'));var util=require('util');var logger=require(_0xcca2('0x1'))(_0xcca2('0x2'));var moment=require(_0xcca2('0x3'));var BPromise=require(_0xcca2('0x4'));var rp=require(_0xcca2('0x5'));var fs=require('fs');var path=require(_0xcca2('0x6'));var rimraf=require(_0xcca2('0x7'));var config=require('../../config/environment');var attributes=require(_0xcca2('0x8'));module[_0xcca2('0x9')]=function(_0x2dcdd6,_0x412ccd){return _0x2dcdd6[_0xcca2('0xa')](_0xcca2('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xcca2('0xc'),'fields':['idField',_0xcca2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe802=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x305ba6,_0x1945c1){var _0x2846fa=function(_0x565721){while(--_0x565721){_0x305ba6['push'](_0x305ba6['shift']());}};_0x2846fa(++_0x1945c1);}(_0xe802,0x15f));var _0x2e80=function(_0x5884e1,_0x5d4b6e){_0x5884e1=_0x5884e1-0x0;var _0x33e132=_0xe802[_0x5884e1];return _0x33e132;};'use strict';var _=require(_0x2e80('0x0'));var util=require('util');var logger=require(_0x2e80('0x1'))(_0x2e80('0x2'));var moment=require(_0x2e80('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e80('0x4'));var fs=require('fs');var path=require(_0x2e80('0x5'));var rimraf=require(_0x2e80('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x2e80('0x7')]=function(_0x57af29,_0x61fd60){return _0x57af29[_0x2e80('0x8')](_0x2e80('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x2e80('0xa'),'fields':[_0x2e80('0xb'),_0x2e80('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a6a62ad..5d711ef 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 _0x005d=['result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x52646c,_0x53b8e3){var _0x51c47c=function(_0x5a4010){while(--_0x5a4010){_0x52646c['push'](_0x52646c['shift']());}};_0x51c47c(++_0x53b8e3);}(_0x005d,0x10c));var _0xd005=function(_0x4d2d5c,_0x55a84f){_0x4d2d5c=_0x4d2d5c-0x0;var _0x51e76b=_0x005d[_0x4d2d5c];return _0x51e76b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd005('0x0'));var rs=require(_0xd005('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd005('0x2'))['db'];var utils=require(_0xd005('0x3'));var logger=require(_0xd005('0x4'))(_0xd005('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd005('0x6')][_0xd005('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x437909,_0x4d888e,_0x3575dc){return new BPromise(function(_0x52a975,_0x838329){return client[_0xd005('0x8')](_0x437909,_0x3575dc)[_0xd005('0x9')](function(_0x3e6f37){logger[_0xd005('0xa')](_0xd005('0xb'),_0x4d888e,_0xd005('0xc'));logger[_0xd005('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4d888e,_0xd005('0xc'),JSON[_0xd005('0xe')](_0x3e6f37));if(_0x3e6f37[_0xd005('0xf')]){if(_0x3e6f37[_0xd005('0xf')]['code']===0x1f4){logger[_0xd005('0xf')](_0xd005('0xb'),_0x4d888e,_0x3e6f37[_0xd005('0xf')][_0xd005('0x10')]);return _0x838329(_0x3e6f37['error'][_0xd005('0x10')]);}logger['error'](_0xd005('0xb'),_0x4d888e,_0x3e6f37[_0xd005('0xf')]['message']);return _0x52a975(_0x3e6f37['error'][_0xd005('0x10')]);}else{logger['info'](_0xd005('0xb'),_0x4d888e,_0xd005('0xc'));_0x52a975(_0x3e6f37[_0xd005('0x11')][_0xd005('0x10')]);}})[_0xd005('0x12')](function(_0x51c805){logger[_0xd005('0xf')](_0xd005('0xb'),_0x4d888e,_0x51c805);_0x838329(_0x51c805);});});} \ No newline at end of file +var _0x0911=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3e20a7,_0x43b9d1){var _0x3644c5=function(_0x172327){while(--_0x172327){_0x3e20a7['push'](_0x3e20a7['shift']());}};_0x3644c5(++_0x43b9d1);}(_0x0911,0x136));var _0x1091=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x0911[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var moment=require(_0x1091('0x2'));var BPromise=require(_0x1091('0x3'));var rs=require(_0x1091('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1091('0x5'));var logger=require(_0x1091('0x6'))(_0x1091('0x7'));var config=require('../../config/environment');var jayson=require(_0x1091('0x8'));var client=jayson[_0x1091('0x9')][_0x1091('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17fad8,_0x8c5f5d,_0x1719c4){return new BPromise(function(_0x5f68d3,_0x4ef34c){return client['request'](_0x17fad8,_0x1719c4)[_0x1091('0xb')](function(_0x527200){logger['info'](_0x1091('0xc'),_0x8c5f5d,_0x1091('0xd'));logger[_0x1091('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x8c5f5d,_0x1091('0xd'),JSON[_0x1091('0xf')](_0x527200));if(_0x527200['error']){if(_0x527200[_0x1091('0x10')][_0x1091('0x11')]===0x1f4){logger[_0x1091('0x10')](_0x1091('0xc'),_0x8c5f5d,_0x527200[_0x1091('0x10')]['message']);return _0x4ef34c(_0x527200['error'][_0x1091('0x12')]);}logger[_0x1091('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x8c5f5d,_0x527200[_0x1091('0x10')][_0x1091('0x12')]);return _0x5f68d3(_0x527200['error'][_0x1091('0x12')]);}else{logger[_0x1091('0x13')](_0x1091('0xc'),_0x8c5f5d,'request\x20sent');_0x5f68d3(_0x527200[_0x1091('0x14')][_0x1091('0x12')]);}})[_0x1091('0x15')](function(_0x190ef1){logger['error'](_0x1091('0xc'),_0x8c5f5d,_0x190ef1);_0x4ef34c(_0x190ef1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c014a31..7709da5 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 _0x93e7=['../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15b9db,_0xeeb037){var _0x16a30e=function(_0x43df30){while(--_0x43df30){_0x15b9db['push'](_0x15b9db['shift']());}};_0x16a30e(++_0xeeb037);}(_0x93e7,0xda));var _0x793e=function(_0x29f014,_0x508522){_0x29f014=_0x29f014-0x0;var _0x316be5=_0x93e7[_0x29f014];return _0x316be5;};'use strict';var multer=require(_0x793e('0x0'));var util=require(_0x793e('0x1'));var path=require('path');var timeout=require(_0x793e('0x2'));var express=require(_0x793e('0x3'));var router=express[_0x793e('0x4')]();var fs_extra=require(_0x793e('0x5'));var auth=require(_0x793e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x793e('0x7'));var controller=require(_0x793e('0x8'));router[_0x793e('0x9')]('/',auth[_0x793e('0xa')](),controller[_0x793e('0xb')]);router[_0x793e('0x9')](_0x793e('0xc'),auth[_0x793e('0xa')](),controller[_0x793e('0xd')]);router[_0x793e('0x9')](_0x793e('0xe'),auth[_0x793e('0xa')](),controller[_0x793e('0xf')]);router['get'](_0x793e('0x10'),auth['isAuthenticated'](),controller[_0x793e('0x11')]);router[_0x793e('0x12')]('/',auth[_0x793e('0xa')](),controller[_0x793e('0x13')]);router[_0x793e('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x793e('0x14')]);router[_0x793e('0x15')](_0x793e('0xc'),auth[_0x793e('0xa')](),controller['update']);router[_0x793e('0x16')]('/:id',auth[_0x793e('0xa')](),controller[_0x793e('0x17')]);module[_0x793e('0x18')]=router; \ No newline at end of file +var _0xde57=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','multer','util','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x167fbf,_0xcf3949){var _0x1bc57f=function(_0x248377){while(--_0x248377){_0x167fbf['push'](_0x167fbf['shift']());}};_0x1bc57f(++_0xcf3949);}(_0xde57,0x1d8));var _0x7de5=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0xde57[_0x47cfa0];return _0x386b1d;};'use strict';var multer=require(_0x7de5('0x0'));var util=require(_0x7de5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7de5('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7de5('0x3'));var config=require('../../config/environment');var controller=require(_0x7de5('0x4'));router[_0x7de5('0x5')]('/',auth[_0x7de5('0x6')](),controller[_0x7de5('0x7')]);router[_0x7de5('0x5')](_0x7de5('0x8'),auth[_0x7de5('0x6')](),controller[_0x7de5('0x9')]);router[_0x7de5('0x5')](_0x7de5('0xa'),auth['isAuthenticated'](),controller[_0x7de5('0xb')]);router['get'](_0x7de5('0xc'),auth[_0x7de5('0x6')](),controller[_0x7de5('0xd')]);router['post']('/',auth[_0x7de5('0x6')](),controller[_0x7de5('0xe')]);router[_0x7de5('0xf')](_0x7de5('0xa'),auth[_0x7de5('0x6')](),controller[_0x7de5('0x10')]);router[_0x7de5('0x11')](_0x7de5('0x8'),auth[_0x7de5('0x6')](),controller['update']);router[_0x7de5('0x12')](_0x7de5('0x8'),auth['isAuthenticated'](),controller[_0x7de5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1decd39..bd315f5 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 _0x1893=['STRING','username','remoteUri'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x1893,0xa2));var _0x3189=function(_0x149980,_0xeb67c8){_0x149980=_0x149980-0x0;var _0x3aacce=_0x1893[_0x149980];return _0x3aacce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x57ca=['exports','STRING','username','remoteUri'];(function(_0x1e749a,_0x212e81){var _0x2532ec=function(_0x1287b5){while(--_0x1287b5){_0x1e749a['push'](_0x1e749a['shift']());}};_0x2532ec(++_0x212e81);}(_0x57ca,0x108));var _0xa57c=function(_0x444373,_0x2f35a1){_0x444373=_0x444373-0x0;var _0x1b8c3d=_0x57ca[_0x444373];return _0x1b8c3d;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'name':{'type':Sequelize[_0xa57c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x2')},'apiKey':{'type':Sequelize[_0xa57c('0x1')]},'remoteUri':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3c379ed..84d066a 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 _0xe890=['save','update','destroy','then','end','sendStatus','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','getFields','remoteUri','apiKey','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','group','source','ticket_type','company','remove','includes','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x14a02d,_0xb4747){var _0x22cbef=function(_0x42f556){while(--_0x42f556){_0x14a02d['push'](_0x14a02d['shift']());}};_0x22cbef(++_0xb4747);}(_0xe890,0x1a6));var _0x0e89=function(_0x13d99d,_0x88a133){_0x13d99d=_0x13d99d-0x0;var _0x4b31d8=_0xe890[_0x13d99d];return _0x4b31d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e89('0x0'));var jsonpatch=require(_0x0e89('0x1'));var rp=require(_0x0e89('0x2'));var moment=require(_0x0e89('0x3'));var BPromise=require(_0x0e89('0x4'));var Mustache=require(_0x0e89('0x5'));var util=require(_0x0e89('0x6'));var path=require(_0x0e89('0x7'));var sox=require(_0x0e89('0x8'));var csv=require(_0x0e89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e89('0xa'));var squel=require(_0x0e89('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e89('0xc'));var deskjs=require(_0x0e89('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0e89('0xe'));var Papa=require(_0x0e89('0xf'));var Redis=require(_0x0e89('0x10'));var authService=require(_0x0e89('0x11'));var qs=require(_0x0e89('0x12'));var as=require(_0x0e89('0x13'));var hardwareService=require(_0x0e89('0x14'));var logger=require(_0x0e89('0x15'))(_0x0e89('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0e89('0x17'));function respondWithStatusCode(_0x43bf31,_0x3447cb){_0x3447cb=_0x3447cb||0xcc;return function(_0x4330a3){if(_0x4330a3){return _0x43bf31['sendStatus'](_0x3447cb);}return _0x43bf31['status'](_0x3447cb)['end']();};}function respondWithResult(_0x15cd84,_0x28b23c){_0x28b23c=_0x28b23c||0xc8;return function(_0x45cd03){if(_0x45cd03){return _0x15cd84[_0x0e89('0x18')](_0x28b23c)[_0x0e89('0x19')](_0x45cd03);}};}function respondWithFilteredResult(_0x211cad,_0x167c7b){return function(_0x45e31f){if(_0x45e31f){var _0x295be8=typeof _0x167c7b[_0x0e89('0x1a')]===_0x0e89('0x1b')&&typeof _0x167c7b[_0x0e89('0x1c')]===_0x0e89('0x1b');var _0x4493a3=_0x45e31f[_0x0e89('0x1d')];var _0x9cf6c4=_0x295be8?0x0:_0x167c7b[_0x0e89('0x1a')];var _0x40eb1d=_0x295be8?_0x45e31f[_0x0e89('0x1d')]:_0x167c7b[_0x0e89('0x1a')]+_0x167c7b[_0x0e89('0x1c')];var _0x56c12a;if(_0x40eb1d>=_0x4493a3){_0x40eb1d=_0x4493a3;_0x56c12a=0xc8;}else{_0x56c12a=0xce;}_0x211cad[_0x0e89('0x18')](_0x56c12a);return _0x211cad[_0x0e89('0x1e')](_0x0e89('0x1f'),_0x9cf6c4+'-'+_0x40eb1d+'/'+_0x4493a3)[_0x0e89('0x19')](_0x45e31f);}return null;};}function patchUpdates(_0x361291){return function(_0x35ac2a){try{jsonpatch[_0x0e89('0x20')](_0x35ac2a,_0x361291,!![]);}catch(_0x200469){return BPromise[_0x0e89('0x21')](_0x200469);}return _0x35ac2a[_0x0e89('0x22')]();};}function saveUpdates(_0x2c641d,_0x18dd88){return function(_0x4768d6){if(_0x4768d6){return _0x4768d6[_0x0e89('0x23')](_0x2c641d)['then'](function(_0x5e5463){return _0x5e5463;});}return null;};}function removeEntity(_0x59fffe,_0x1ad62c){return function(_0x8d02e2){if(_0x8d02e2){return _0x8d02e2[_0x0e89('0x24')]()[_0x0e89('0x25')](function(){_0x59fffe['status'](0xcc)[_0x0e89('0x26')]();});}};}function handleEntityNotFound(_0x2d6e9b,_0x3cf50c){return function(_0x4b6f00){if(!_0x4b6f00){_0x2d6e9b[_0x0e89('0x27')](0x194);}return _0x4b6f00;};}function handleError(_0x589ed1,_0x2a378a){_0x2a378a=_0x2a378a||0x1f4;return function(_0x30c0f4){logger[_0x0e89('0x28')](_0x30c0f4[_0x0e89('0x29')]);if(_0x30c0f4[_0x0e89('0x2a')]){delete _0x30c0f4[_0x0e89('0x2a')];}_0x589ed1[_0x0e89('0x18')](_0x2a378a)['send'](_0x30c0f4);};}exports[_0x0e89('0x2b')]=function(_0x14b857,_0xf1ebac){var _0x18cfb5={},_0x174ed9={},_0x7584db={'count':0x0,'rows':[]};var _0x502452=_[_0x0e89('0x2c')](db[_0x0e89('0x2d')][_0x0e89('0x2e')],function(_0x521587){return{'name':_0x521587[_0x0e89('0x2f')],'type':_0x521587[_0x0e89('0x30')][_0x0e89('0x31')]};});_0x174ed9[_0x0e89('0x32')]=_['map'](_0x502452,_0x0e89('0x2a'));_0x174ed9[_0x0e89('0x33')]=_[_0x0e89('0x34')](_0x14b857[_0x0e89('0x33')]);_0x174ed9['filters']=_[_0x0e89('0x35')](_0x174ed9[_0x0e89('0x32')],_0x174ed9[_0x0e89('0x33')]);_0x18cfb5[_0x0e89('0x36')]=_[_0x0e89('0x35')](_0x174ed9[_0x0e89('0x32')],qs[_0x0e89('0x37')](_0x14b857['query'][_0x0e89('0x37')]));_0x18cfb5[_0x0e89('0x36')]=_0x18cfb5[_0x0e89('0x36')][_0x0e89('0x38')]?_0x18cfb5[_0x0e89('0x36')]:_0x174ed9['model'];if(!_0x14b857[_0x0e89('0x33')][_0x0e89('0x39')](_0x0e89('0x3a'))){_0x18cfb5[_0x0e89('0x1c')]=qs[_0x0e89('0x1c')](_0x14b857['query'][_0x0e89('0x1c')]);_0x18cfb5[_0x0e89('0x1a')]=qs[_0x0e89('0x1a')](_0x14b857[_0x0e89('0x33')][_0x0e89('0x1a')]);}_0x18cfb5[_0x0e89('0x3b')]=qs[_0x0e89('0x3c')](_0x14b857[_0x0e89('0x33')]['sort']);_0x18cfb5['where']=qs['filters'](_[_0x0e89('0x3d')](_0x14b857[_0x0e89('0x33')],_0x174ed9[_0x0e89('0x3e')]),_0x502452);if(_0x14b857['query'][_0x0e89('0x3f')]){_0x18cfb5[_0x0e89('0x40')]=_[_0x0e89('0x41')](_0x18cfb5[_0x0e89('0x40')],{'$or':_[_0x0e89('0x2c')](_0x502452,function(_0x5984e2){if(_0x5984e2['type']!==_0x0e89('0x42')){var _0x280291={};_0x280291[_0x5984e2[_0x0e89('0x2a')]]={'$like':'%'+_0x14b857[_0x0e89('0x33')][_0x0e89('0x3f')]+'%'};return _0x280291;}})});}_0x18cfb5=_[_0x0e89('0x41')]({},_0x18cfb5,_0x14b857[_0x0e89('0x43')]);var _0x38692f={'where':_0x18cfb5[_0x0e89('0x40')]};return db[_0x0e89('0x2d')][_0x0e89('0x1d')](_0x38692f)[_0x0e89('0x25')](function(_0x1ed0f0){_0x7584db[_0x0e89('0x1d')]=_0x1ed0f0;if(_0x14b857[_0x0e89('0x33')][_0x0e89('0x44')]){_0x18cfb5[_0x0e89('0x45')]=[{'all':!![]}];}return db[_0x0e89('0x2d')][_0x0e89('0x46')](_0x18cfb5);})[_0x0e89('0x25')](function(_0x1f477a){_0x7584db[_0x0e89('0x47')]=_0x1f477a;return _0x7584db;})[_0x0e89('0x25')](respondWithFilteredResult(_0xf1ebac,_0x18cfb5))[_0x0e89('0x48')](handleError(_0xf1ebac,null));};exports[_0x0e89('0x49')]=function(_0x4cbd0a,_0x205898){var _0x399a2e={'raw':![],'where':{'id':_0x4cbd0a[_0x0e89('0x4a')]['id']}},_0x1d38b2={};_0x1d38b2[_0x0e89('0x32')]=_[_0x0e89('0x34')](db[_0x0e89('0x2d')][_0x0e89('0x2e')]);_0x1d38b2[_0x0e89('0x33')]=_[_0x0e89('0x34')](_0x4cbd0a[_0x0e89('0x33')]);_0x1d38b2[_0x0e89('0x3e')]=_[_0x0e89('0x35')](_0x1d38b2[_0x0e89('0x32')],_0x1d38b2[_0x0e89('0x33')]);_0x399a2e[_0x0e89('0x36')]=_[_0x0e89('0x35')](_0x1d38b2[_0x0e89('0x32')],qs[_0x0e89('0x37')](_0x4cbd0a[_0x0e89('0x33')][_0x0e89('0x37')]));_0x399a2e[_0x0e89('0x36')]=_0x399a2e[_0x0e89('0x36')][_0x0e89('0x38')]?_0x399a2e['attributes']:_0x1d38b2[_0x0e89('0x32')];if(_0x4cbd0a[_0x0e89('0x33')][_0x0e89('0x44')]){_0x399a2e[_0x0e89('0x45')]=[{'all':!![]}];}_0x399a2e=_[_0x0e89('0x41')]({},_0x399a2e,_0x4cbd0a[_0x0e89('0x43')]);return db['FreshdeskAccount'][_0x0e89('0x4b')](_0x399a2e)['then'](handleEntityNotFound(_0x205898,null))['then'](respondWithResult(_0x205898,null))['catch'](handleError(_0x205898,null));};exports[_0x0e89('0x4c')]=function(_0x2f2971,_0x313db9){return db['FreshdeskAccount']['create'](_0x2f2971[_0x0e89('0x4d')],{})['then'](respondWithResult(_0x313db9,0xc9))[_0x0e89('0x48')](handleError(_0x313db9,null));};exports['update']=function(_0x249431,_0x5d0b35){if(_0x249431['body']['id']){delete _0x249431[_0x0e89('0x4d')]['id'];}return db[_0x0e89('0x2d')]['find']({'where':{'id':_0x249431[_0x0e89('0x4a')]['id']}})[_0x0e89('0x25')](handleEntityNotFound(_0x5d0b35,null))[_0x0e89('0x25')](saveUpdates(_0x249431[_0x0e89('0x4d')],null))[_0x0e89('0x25')](respondWithResult(_0x5d0b35,null))[_0x0e89('0x48')](handleError(_0x5d0b35,null));};exports[_0x0e89('0x24')]=function(_0x24249a,_0x124241){return db[_0x0e89('0x2d')][_0x0e89('0x4b')]({'where':{'id':_0x24249a[_0x0e89('0x4a')]['id']}})['then'](handleEntityNotFound(_0x124241,null))[_0x0e89('0x25')](removeEntity(_0x124241,null))[_0x0e89('0x48')](handleError(_0x124241,null));};exports[_0x0e89('0x4e')]=function(_0x2c4752,_0x507ce3,_0x4feba5){var _0x54457a={};var _0x24134c={};var _0xf7dbee;var _0x25a9d9;return db[_0x0e89('0x2d')]['findOne']({'where':{'id':_0x2c4752[_0x0e89('0x4a')]['id']}})['then'](handleEntityNotFound(_0x507ce3,null))[_0x0e89('0x25')](function(_0x2d31b2){if(_0x2d31b2){_0xf7dbee=_0x2d31b2;_0x24134c[_0x0e89('0x32')]=_[_0x0e89('0x34')](db['FreshdeskConfiguration'][_0x0e89('0x2e')]);_0x24134c[_0x0e89('0x33')]=_['keys'](_0x2c4752[_0x0e89('0x33')]);_0x24134c[_0x0e89('0x3e')]=_['intersection'](_0x24134c['model'],_0x24134c['query']);_0x54457a[_0x0e89('0x36')]=_[_0x0e89('0x35')](_0x24134c['model'],qs['fields'](_0x2c4752[_0x0e89('0x33')][_0x0e89('0x37')]));_0x54457a[_0x0e89('0x36')]=_0x54457a[_0x0e89('0x36')]['length']?_0x54457a[_0x0e89('0x36')]:_0x24134c[_0x0e89('0x32')];_0x54457a[_0x0e89('0x3b')]=qs[_0x0e89('0x3c')](_0x2c4752['query'][_0x0e89('0x3c')]);_0x54457a[_0x0e89('0x40')]=qs[_0x0e89('0x3e')](_['pick'](_0x2c4752[_0x0e89('0x33')],_0x24134c[_0x0e89('0x3e')]));if(_0x2c4752[_0x0e89('0x33')][_0x0e89('0x3f')]){_0x54457a['where']=_[_0x0e89('0x41')](_0x54457a[_0x0e89('0x40')],{'$or':_[_0x0e89('0x2c')](_0x54457a[_0x0e89('0x36')],function(_0x35c45f){var _0x31a8ff={};_0x31a8ff[_0x35c45f]={'$like':'%'+_0x2c4752[_0x0e89('0x33')]['filter']+'%'};return _0x31a8ff;})});}_0x54457a=_[_0x0e89('0x41')]({},_0x54457a,_0x2c4752[_0x0e89('0x43')]);return _0xf7dbee[_0x0e89('0x4e')](_0x54457a);}})[_0x0e89('0x25')](function(_0x2e1441){if(_0x2e1441){_0x25a9d9=_0x2e1441[_0x0e89('0x38')];if(!_0x2c4752[_0x0e89('0x33')][_0x0e89('0x39')](_0x0e89('0x3a'))){_0x54457a[_0x0e89('0x1c')]=qs[_0x0e89('0x1c')](_0x2c4752[_0x0e89('0x33')][_0x0e89('0x1c')]);_0x54457a['offset']=qs['offset'](_0x2c4752['query'][_0x0e89('0x1a')]);}return _0xf7dbee[_0x0e89('0x4e')](_0x54457a);}})[_0x0e89('0x25')](function(_0xf71b88){if(_0xf71b88){return _0xf71b88?{'count':_0x25a9d9,'rows':_0xf71b88}:null;}})['then'](respondWithResult(_0x507ce3,null))[_0x0e89('0x48')](handleError(_0x507ce3,null));};exports[_0x0e89('0x4f')]=function(_0x28f05b,_0x51c6a1,_0x31fb58){if(_0x28f05b[_0x0e89('0x4d')]['id']){delete _0x28f05b[_0x0e89('0x4d')]['id'];}return db[_0x0e89('0x2d')]['findOne']({'where':{'id':_0x28f05b[_0x0e89('0x4a')]['id']}})[_0x0e89('0x25')](handleEntityNotFound(_0x51c6a1,null))[_0x0e89('0x25')](function(_0x40dd6d){if(_0x40dd6d){_0x28f05b[_0x0e89('0x4d')][_0x0e89('0x50')]=_0x40dd6d['id'];_0x28f05b[_0x0e89('0x4d')][_0x0e89('0x51')]=integrations[_0x0e89('0x52')](_0x28f05b[_0x0e89('0x4d')]['channel'],_0x28f05b[_0x0e89('0x4d')][_0x0e89('0x30')]);_0x28f05b[_0x0e89('0x4d')][_0x0e89('0x53')]=integrations[_0x0e89('0x54')](_0x28f05b['body'][_0x0e89('0x55')],_0x28f05b[_0x0e89('0x4d')]['type']);return db[_0x0e89('0x56')][_0x0e89('0x4c')](_0x28f05b['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x0e89('0x53')}]});}return null;})[_0x0e89('0x25')](respondWithResult(_0x51c6a1,null))['catch'](handleError(_0x51c6a1,null));};exports[_0x0e89('0x57')]=function(_0x411c03,_0x16a12e,_0x58adfa){var _0x21abda='';return db[_0x0e89('0x2d')]['findOne']({'where':{'id':_0x411c03[_0x0e89('0x4a')]['id']},'attributes':['id',_0x0e89('0x58'),_0x0e89('0x59')]})[_0x0e89('0x25')](handleEntityNotFound(_0x16a12e,null))[_0x0e89('0x25')](function(_0x22a78f){if(_0x22a78f){_0x21abda=_0x22a78f[_0x0e89('0x58')];var _0x4dc7d3=_0x21abda['slice'](-0x1);if(_0x4dc7d3==='/'){_0x21abda=_0x21abda['substring'](0x0,_0x21abda['lastIndexOf'](_0x4dc7d3));}return rp({'method':'GET','uri':util[_0x0e89('0x5a')](_0x0e89('0x5b'),_0x21abda,_0x0e89('0x5c')),'headers':{'Authorization':util['format'](_0x0e89('0x5d'),new Buffer(util['format'](_0x0e89('0x5e'),_0x22a78f[_0x0e89('0x59')]))[_0x0e89('0x5f')](_0x0e89('0x60')))},'json':!![]});}})[_0x0e89('0x25')](function(_0x2fa558){if(_0x2fa558){var _0x152f8f=[_0x0e89('0x61'),_0x0e89('0x62'),_0x0e89('0x63'),_0x0e89('0x64'),_0x0e89('0x18'),'priority',_0x0e89('0x65'),_0x0e89('0x66'),_0x0e89('0x67'),_0x0e89('0x65'),_0x0e89('0x68')];_[_0x0e89('0x69')](_0x2fa558,function(_0x1b4ad6){return _0x152f8f[_0x0e89('0x6a')](_0x1b4ad6[_0x0e89('0x2a')])||!_0x1b4ad6[_0x0e89('0x6b')]&&_0x1b4ad6['type']!=='custom_text'&&_0x1b4ad6[_0x0e89('0x30')]!=='custom_dropdown';});return{'count':_0x2fa558[_0x0e89('0x38')],'rows':_[_0x0e89('0x2c')](_0x2fa558,function(_0x3adea7){return{'id':_0x3adea7[_0x0e89('0x2a')],'name':_0x3adea7['label'],'custom':!_0x3adea7[_0x0e89('0x6b')],'options':_0x3adea7[_0x0e89('0x6c')]?_[_0x0e89('0x2c')](_0x3adea7['choices'],function(_0xfaac03){return{'name':_[_0x0e89('0x6d')](_0xfaac03),'value':_0xfaac03};}):[]};})};}})[_0x0e89('0x25')](respondWithResult(_0x16a12e,null))[_0x0e89('0x48')](function(_0x2d42bc){var _0x3da749=_0x411c03[_0x0e89('0x33')][_0x0e89('0x6e')]?0x1f4:_0x2d42bc[_0x0e89('0x6f')]||0x1f4;logger['error'](_0x0e89('0x70'),_0x0e89('0x57'),_0x3da749,JSON[_0x0e89('0x71')](_0x2d42bc));delete _0x2d42bc[_0x0e89('0x2a')];if(_0x3da749===0x191){_0x3da749=0x190;}_0x16a12e[_0x0e89('0x18')](_0x3da749)['send'](_0x411c03[_0x0e89('0x33')][_0x0e89('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x2d42bc['statusCode']}:_0x2d42bc);});}; \ No newline at end of file +var _0xd404=['ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','keys','merge','create','body','catch','find','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','getSubjects','channel','type','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','toString','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1d28cf,_0x266ab6){var _0x59d797=function(_0x4f5f64){while(--_0x4f5f64){_0x1d28cf['push'](_0x1d28cf['shift']());}};_0x59d797(++_0x266ab6);}(_0xd404,0x15b));var _0x4d40=function(_0xc3a516,_0x32c235){_0xc3a516=_0xc3a516-0x0;var _0x1aec8a=_0xd404[_0xc3a516];return _0x1aec8a;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];var integrations=require(_0x4d40('0x1a'));function respondWithStatusCode(_0x28e5bf,_0x42a621){_0x42a621=_0x42a621||0xcc;return function(_0x5162f9){if(_0x5162f9){return _0x28e5bf[_0x4d40('0x1b')](_0x42a621);}return _0x28e5bf[_0x4d40('0x1c')](_0x42a621)[_0x4d40('0x1d')]();};}function respondWithResult(_0x2083bd,_0x477a91){_0x477a91=_0x477a91||0xc8;return function(_0x478cdd){if(_0x478cdd){return _0x2083bd[_0x4d40('0x1c')](_0x477a91)[_0x4d40('0x1e')](_0x478cdd);}};}function respondWithFilteredResult(_0x20bc1b,_0xcee25a){return function(_0x453857){if(_0x453857){var _0x361a41=typeof _0xcee25a[_0x4d40('0x1f')]===_0x4d40('0x20')&&typeof _0xcee25a[_0x4d40('0x21')]==='undefined';var _0x535989=_0x453857[_0x4d40('0x22')];var _0x1c0cd8=_0x361a41?0x0:_0xcee25a['offset'];var _0x23b8fd=_0x361a41?_0x453857[_0x4d40('0x22')]:_0xcee25a['offset']+_0xcee25a[_0x4d40('0x21')];var _0x5a77e0;if(_0x23b8fd>=_0x535989){_0x23b8fd=_0x535989;_0x5a77e0=0xc8;}else{_0x5a77e0=0xce;}_0x20bc1b[_0x4d40('0x1c')](_0x5a77e0);return _0x20bc1b[_0x4d40('0x23')]('Content-Range',_0x1c0cd8+'-'+_0x23b8fd+'/'+_0x535989)['json'](_0x453857);}return null;};}function patchUpdates(_0x375ce0){return function(_0x569190){try{jsonpatch['apply'](_0x569190,_0x375ce0,!![]);}catch(_0xc458da){return BPromise[_0x4d40('0x24')](_0xc458da);}return _0x569190[_0x4d40('0x25')]();};}function saveUpdates(_0x5d4c24,_0x356fd6){return function(_0x2ccafa){if(_0x2ccafa){return _0x2ccafa[_0x4d40('0x26')](_0x5d4c24)['then'](function(_0x4eebc3){return _0x4eebc3;});}return null;};}function removeEntity(_0x2df33a,_0x90b652){return function(_0x1285f6){if(_0x1285f6){return _0x1285f6[_0x4d40('0x27')]()[_0x4d40('0x28')](function(){_0x2df33a['status'](0xcc)[_0x4d40('0x1d')]();});}};}function handleEntityNotFound(_0x1f5e5b,_0x560df8){return function(_0x5540ee){if(!_0x5540ee){_0x1f5e5b[_0x4d40('0x1b')](0x194);}return _0x5540ee;};}function handleError(_0x2a0c82,_0x3fa83e){_0x3fa83e=_0x3fa83e||0x1f4;return function(_0x3ad1d7){logger[_0x4d40('0x29')](_0x3ad1d7[_0x4d40('0x2a')]);if(_0x3ad1d7[_0x4d40('0x2b')]){delete _0x3ad1d7[_0x4d40('0x2b')];}_0x2a0c82[_0x4d40('0x1c')](_0x3fa83e)[_0x4d40('0x2c')](_0x3ad1d7);};}exports[_0x4d40('0x2d')]=function(_0x4ca431,_0x4e4e61){var _0x52f706={},_0x158a86={},_0x350488={'count':0x0,'rows':[]};var _0x1ac240=_[_0x4d40('0x2e')](db['FreshdeskAccount'][_0x4d40('0x2f')],function(_0x1c8a1b){return{'name':_0x1c8a1b[_0x4d40('0x30')],'type':_0x1c8a1b['type'][_0x4d40('0x31')]};});_0x158a86[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x1ac240,_0x4d40('0x2b'));_0x158a86[_0x4d40('0x33')]=_['keys'](_0x4ca431[_0x4d40('0x33')]);_0x158a86['filters']=_[_0x4d40('0x34')](_0x158a86[_0x4d40('0x32')],_0x158a86[_0x4d40('0x33')]);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x158a86['model'],qs[_0x4d40('0x36')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x36')]));_0x52f706[_0x4d40('0x35')]=_0x52f706['attributes'][_0x4d40('0x37')]?_0x52f706['attributes']:_0x158a86[_0x4d40('0x32')];if(!_0x4ca431[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x52f706[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x21')]);_0x52f706[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x4ca431['query'][_0x4d40('0x1f')]);}_0x52f706[_0x4d40('0x3a')]=qs['sort'](_0x4ca431['query']['sort']);_0x52f706[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_['pick'](_0x4ca431[_0x4d40('0x33')],_0x158a86[_0x4d40('0x3c')]),_0x1ac240);if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x52f706[_0x4d40('0x3b')]=_['merge'](_0x52f706[_0x4d40('0x3b')],{'$or':_[_0x4d40('0x2e')](_0x1ac240,function(_0x4a84fa){if(_0x4a84fa['type']!==_0x4d40('0x3e')){var _0x11ed1a={};_0x11ed1a[_0x4a84fa['name']]={'$like':'%'+_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x11ed1a;}})});}_0x52f706=_['merge']({},_0x52f706,_0x4ca431[_0x4d40('0x3f')]);var _0x1a9586={'where':_0x52f706['where']};return db[_0x4d40('0x40')][_0x4d40('0x22')](_0x1a9586)['then'](function(_0x2b5db0){_0x350488['count']=_0x2b5db0;if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x41')]){_0x52f706[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x40')][_0x4d40('0x43')](_0x52f706);})[_0x4d40('0x28')](function(_0x91f44d){_0x350488[_0x4d40('0x44')]=_0x91f44d;return _0x350488;})[_0x4d40('0x28')](respondWithFilteredResult(_0x4e4e61,_0x52f706))['catch'](handleError(_0x4e4e61,null));};exports[_0x4d40('0x45')]=function(_0x3718a8,_0x1c2fa8){var _0xcdde22={'raw':![],'where':{'id':_0x3718a8['params']['id']}},_0x22861a={};_0x22861a[_0x4d40('0x32')]=_['keys'](db[_0x4d40('0x40')][_0x4d40('0x2f')]);_0x22861a[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0x3718a8['query']);_0x22861a[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x22861a['model'],_0x22861a[_0x4d40('0x33')]);_0xcdde22['attributes']=_[_0x4d40('0x34')](_0x22861a[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0x3718a8[_0x4d40('0x33')]['fields']));_0xcdde22[_0x4d40('0x35')]=_0xcdde22['attributes'][_0x4d40('0x37')]?_0xcdde22[_0x4d40('0x35')]:_0x22861a[_0x4d40('0x32')];if(_0x3718a8[_0x4d40('0x33')]['includeAll']){_0xcdde22[_0x4d40('0x42')]=[{'all':!![]}];}_0xcdde22=_[_0x4d40('0x47')]({},_0xcdde22,_0x3718a8[_0x4d40('0x3f')]);return db[_0x4d40('0x40')]['find'](_0xcdde22)[_0x4d40('0x28')](handleEntityNotFound(_0x1c2fa8,null))[_0x4d40('0x28')](respondWithResult(_0x1c2fa8,null))['catch'](handleError(_0x1c2fa8,null));};exports[_0x4d40('0x48')]=function(_0x493d8e,_0x3d4283){return db[_0x4d40('0x40')][_0x4d40('0x48')](_0x493d8e[_0x4d40('0x49')],{})[_0x4d40('0x28')](respondWithResult(_0x3d4283,0xc9))[_0x4d40('0x4a')](handleError(_0x3d4283,null));};exports[_0x4d40('0x26')]=function(_0x37b6bf,_0x1cb8e7){if(_0x37b6bf['body']['id']){delete _0x37b6bf[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x37b6bf[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x1cb8e7,null))['then'](saveUpdates(_0x37b6bf[_0x4d40('0x49')],null))[_0x4d40('0x28')](respondWithResult(_0x1cb8e7,null))['catch'](handleError(_0x1cb8e7,null));};exports[_0x4d40('0x27')]=function(_0x48ffd7,_0x282945){return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x48ffd7['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x282945,null))[_0x4d40('0x28')](removeEntity(_0x282945,null))[_0x4d40('0x4a')](handleError(_0x282945,null));};exports[_0x4d40('0x4d')]=function(_0xd3e7cd,_0x52861d,_0x3191a2){var _0x14c6f8={};var _0x5aef99={};var _0x1000f4;var _0x584552;return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0xd3e7cd[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x52861d,null))['then'](function(_0xf62fef){if(_0xf62fef){_0x1000f4=_0xf62fef;_0x5aef99[_0x4d40('0x32')]=_[_0x4d40('0x46')](db[_0x4d40('0x4e')][_0x4d40('0x2f')]);_0x5aef99[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0xd3e7cd[_0x4d40('0x33')]);_0x5aef99[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],_0x5aef99[_0x4d40('0x33')]);_0x14c6f8[_0x4d40('0x35')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x36')]));_0x14c6f8[_0x4d40('0x35')]=_0x14c6f8['attributes'][_0x4d40('0x37')]?_0x14c6f8[_0x4d40('0x35')]:_0x5aef99['model'];_0x14c6f8['order']=qs[_0x4d40('0x4f')](_0xd3e7cd[_0x4d40('0x33')]['sort']);_0x14c6f8['where']=qs[_0x4d40('0x3c')](_['pick'](_0xd3e7cd[_0x4d40('0x33')],_0x5aef99['filters']));if(_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x14c6f8[_0x4d40('0x3b')]=_[_0x4d40('0x47')](_0x14c6f8[_0x4d40('0x3b')],{'$or':_['map'](_0x14c6f8['attributes'],function(_0x4e5b26){var _0x259f9d={};_0x259f9d[_0x4e5b26]={'$like':'%'+_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x259f9d;})});}_0x14c6f8=_[_0x4d40('0x47')]({},_0x14c6f8,_0xd3e7cd[_0x4d40('0x3f')]);return _0x1000f4['getConfigurations'](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x5b6a54){if(_0x5b6a54){_0x584552=_0x5b6a54[_0x4d40('0x37')];if(!_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x14c6f8[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0xd3e7cd['query']['limit']);_0x14c6f8[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x1f')]);}return _0x1000f4[_0x4d40('0x4d')](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x132543){if(_0x132543){return _0x132543?{'count':_0x584552,'rows':_0x132543}:null;}})[_0x4d40('0x28')](respondWithResult(_0x52861d,null))['catch'](handleError(_0x52861d,null));};exports[_0x4d40('0x50')]=function(_0x50917a,_0x5aa05b,_0x512a11){if(_0x50917a[_0x4d40('0x49')]['id']){delete _0x50917a[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x51')]({'where':{'id':_0x50917a['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x5aa05b,null))[_0x4d40('0x28')](function(_0x1e1a6c){if(_0x1e1a6c){_0x50917a[_0x4d40('0x49')][_0x4d40('0x52')]=_0x1e1a6c['id'];_0x50917a['body']['Subjects']=integrations[_0x4d40('0x53')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')][_0x4d40('0x55')]);_0x50917a['body']['Descriptions']=integrations[_0x4d40('0x56')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')]['type']);return db[_0x4d40('0x4e')][_0x4d40('0x48')](_0x50917a[_0x4d40('0x49')],{'include':[{'model':db[_0x4d40('0x57')],'as':_0x4d40('0x58')},{'model':db[_0x4d40('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5aa05b,null))['catch'](handleError(_0x5aa05b,null));};exports[_0x4d40('0x59')]=function(_0x358218,_0x37fd2b,_0x542d06){var _0xcf9e5b='';return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0x358218['params']['id']},'attributes':['id',_0x4d40('0x5a'),_0x4d40('0x5b')]})['then'](handleEntityNotFound(_0x37fd2b,null))[_0x4d40('0x28')](function(_0x471863){if(_0x471863){_0xcf9e5b=_0x471863[_0x4d40('0x5a')];var _0x25258e=_0xcf9e5b[_0x4d40('0x5c')](-0x1);if(_0x25258e==='/'){_0xcf9e5b=_0xcf9e5b[_0x4d40('0x5d')](0x0,_0xcf9e5b['lastIndexOf'](_0x25258e));}return rp({'method':_0x4d40('0x5e'),'uri':util['format'](_0x4d40('0x5f'),_0xcf9e5b,_0x4d40('0x60')),'headers':{'Authorization':util['format'](_0x4d40('0x61'),new Buffer(util[_0x4d40('0x62')]('%s:X',_0x471863[_0x4d40('0x5b')]))[_0x4d40('0x63')]('base64'))},'json':!![]});}})[_0x4d40('0x28')](function(_0xe7e67c){if(_0xe7e67c){var _0x325128=[_0x4d40('0x64'),_0x4d40('0x65'),'agent',_0x4d40('0x66'),_0x4d40('0x1c'),_0x4d40('0x67'),_0x4d40('0x68'),_0x4d40('0x69'),_0x4d40('0x6a'),'group',_0x4d40('0x6b')];_['remove'](_0xe7e67c,function(_0x2856c4){return _0x325128[_0x4d40('0x6c')](_0x2856c4[_0x4d40('0x2b')])||!_0x2856c4[_0x4d40('0x6d')]&&_0x2856c4[_0x4d40('0x55')]!=='custom_text'&&_0x2856c4[_0x4d40('0x55')]!==_0x4d40('0x6e');});return{'count':_0xe7e67c[_0x4d40('0x37')],'rows':_[_0x4d40('0x2e')](_0xe7e67c,function(_0x54a3e7){return{'id':_0x54a3e7[_0x4d40('0x2b')],'name':_0x54a3e7[_0x4d40('0x6f')],'custom':!_0x54a3e7[_0x4d40('0x6d')],'options':_0x54a3e7[_0x4d40('0x70')]?_['map'](_0x54a3e7[_0x4d40('0x70')],function(_0x4e6d11){return{'name':_[_0x4d40('0x71')](_0x4e6d11),'value':_0x4e6d11};}):[]};})};}})[_0x4d40('0x28')](respondWithResult(_0x37fd2b,null))[_0x4d40('0x4a')](function(_0x1b3f7f){var _0x5cfa9c=_0x358218['query'][_0x4d40('0x72')]?0x1f4:_0x1b3f7f[_0x4d40('0x73')]||0x1f4;logger['error'](_0x4d40('0x74'),_0x4d40('0x59'),_0x5cfa9c,JSON[_0x4d40('0x75')](_0x1b3f7f));delete _0x1b3f7f[_0x4d40('0x2b')];if(_0x5cfa9c===0x191){_0x5cfa9c=0x190;}_0x37fd2b[_0x4d40('0x1c')](_0x5cfa9c)['send'](_0x358218[_0x4d40('0x33')][_0x4d40('0x72')]?{'message':_0x4d40('0x76'),'statusCode':_0x1b3f7f[_0x4d40('0x73')]}:_0x1b3f7f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 815a7a3..eb91697 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 _0xb0e0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','int_freshdesk_accounts'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xb0e0,0x120));var _0x0b0e=function(_0x2daaec,_0xdcc766){_0x2daaec=_0x2daaec-0x0;var _0x4563d6=_0xb0e0[_0x2daaec];return _0x4563d6;};'use strict';var _=require(_0x0b0e('0x0'));var util=require(_0x0b0e('0x1'));var logger=require(_0x0b0e('0x2'))(_0x0b0e('0x3'));var moment=require(_0x0b0e('0x4'));var BPromise=require(_0x0b0e('0x5'));var rp=require(_0x0b0e('0x6'));var fs=require('fs');var path=require(_0x0b0e('0x7'));var rimraf=require(_0x0b0e('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0b0e('0x9')]=function(_0x360126,_0x589c03){return _0x360126[_0x0b0e('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x0b0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbed1=['lodash','util','api','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0xbed1,0x104));var _0x1bed=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xbed1[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x1bed('0x0'));var util=require(_0x1bed('0x1'));var logger=require('../../config/logger')(_0x1bed('0x2'));var moment=require(_0x1bed('0x3'));var BPromise=require('bluebird');var rp=require(_0x1bed('0x4'));var fs=require('fs');var path=require(_0x1bed('0x5'));var rimraf=require('rimraf');var config=require(_0x1bed('0x6'));var attributes=require(_0x1bed('0x7'));var integrations=require(_0x1bed('0x8'));module[_0x1bed('0x9')]=function(_0x2364a4,_0x3f1674){return _0x2364a4[_0x1bed('0xa')](_0x1bed('0xb'),attributes,{'tableName':_0x1bed('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 6a1b8e3..5367277 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 _0xd28c=['map','model','GetFreshdeskAccount','debug','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x59dbbc,_0x2ec28b){var _0x1f286f=function(_0x3da619){while(--_0x3da619){_0x59dbbc['push'](_0x59dbbc['shift']());}};_0x1f286f(++_0x2ec28b);}(_0xd28c,0x72));var _0xcd28=function(_0x2a89d2,_0x2f6256){_0x2a89d2=_0x2a89d2-0x0;var _0x148924=_0xd28c[_0x2a89d2];return _0x148924;};'use strict';var _=require('lodash');var util=require(_0xcd28('0x0'));var moment=require(_0xcd28('0x1'));var BPromise=require(_0xcd28('0x2'));var rs=require(_0xcd28('0x3'));var fs=require('fs');var Redis=require(_0xcd28('0x4'));var db=require(_0xcd28('0x5'))['db'];var utils=require(_0xcd28('0x6'));var logger=require(_0xcd28('0x7'))('rpc');var config=require(_0xcd28('0x8'));var jayson=require(_0xcd28('0x9'));var client=jayson['client'][_0xcd28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29634e,_0x5d5562,_0x3113d9){return new BPromise(function(_0x3c5c81,_0xe4edbd){return client['request'](_0x29634e,_0x3113d9)[_0xcd28('0xb')](function(_0x45251c){logger[_0xcd28('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d5562,_0xcd28('0xd'));logger['debug'](_0xcd28('0xe'),_0x5d5562,'request\x20sent',JSON[_0xcd28('0xf')](_0x45251c));if(_0x45251c[_0xcd28('0x10')]){if(_0x45251c[_0xcd28('0x10')][_0xcd28('0x11')]===0x1f4){logger[_0xcd28('0x10')](_0xcd28('0x12'),_0x5d5562,_0x45251c[_0xcd28('0x10')]['message']);return _0xe4edbd(_0x45251c[_0xcd28('0x10')][_0xcd28('0x13')]);}logger['error'](_0xcd28('0x12'),_0x5d5562,_0x45251c[_0xcd28('0x10')][_0xcd28('0x13')]);return _0x3c5c81(_0x45251c['error'][_0xcd28('0x13')]);}else{logger['info'](_0xcd28('0x12'),_0x5d5562,_0xcd28('0xd'));_0x3c5c81(_0x45251c[_0xcd28('0x14')]['message']);}})[_0xcd28('0x15')](function(_0x39418b){logger['error'](_0xcd28('0x12'),_0x5d5562,_0x39418b);_0xe4edbd(_0x39418b);});});}exports['GetFreshdeskAccount']=function(_0x3da664){var _0x49f4f0=this;return new Promise(function(_0x301b78,_0x2c15fb){return db[_0xcd28('0x16')][_0xcd28('0x17')]({'raw':_0x3da664['options']?_0x3da664['options'][_0xcd28('0x18')]===undefined?!![]:![]:!![],'where':_0x3da664[_0xcd28('0x19')]?_0x3da664['options'][_0xcd28('0x1a')]||null:null,'attributes':_0x3da664[_0xcd28('0x19')]?_0x3da664[_0xcd28('0x19')][_0xcd28('0x1b')]||null:null,'limit':_0x3da664['options']?_0x3da664[_0xcd28('0x19')][_0xcd28('0x1c')]||null:null,'include':_0x3da664[_0xcd28('0x19')]?_0x3da664[_0xcd28('0x19')][_0xcd28('0x1d')]?_['map'](_0x3da664[_0xcd28('0x19')][_0xcd28('0x1d')],function(_0x444b1f){return{'model':db[_0x444b1f['model']],'as':_0x444b1f['as'],'attributes':_0x444b1f[_0xcd28('0x1b')],'include':_0x444b1f[_0xcd28('0x1d')]?_[_0xcd28('0x1e')](_0x444b1f['include'],function(_0x12f742){return{'model':db[_0x12f742[_0xcd28('0x1f')]],'as':_0x12f742['as'],'attributes':_0x12f742[_0xcd28('0x1b')],'include':_0x12f742['include']?_[_0xcd28('0x1e')](_0x12f742[_0xcd28('0x1d')],function(_0x5d697d){return{'model':db[_0x5d697d['model']],'as':_0x5d697d['as'],'attributes':_0x5d697d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd28('0xb')](function(_0x9588f5){logger['info'](_0xcd28('0x20'),_0x3da664);logger[_0xcd28('0x21')](_0xcd28('0x20'),_0x3da664,JSON[_0xcd28('0xf')](_0x9588f5));_0x301b78(_0x9588f5);})['catch'](function(_0x350e37){logger['error']('GetFreshdeskAccount',_0x350e37[_0xcd28('0x13')],_0x3da664);_0x2c15fb(_0x49f4f0['error'](0x1f4,_0x350e37[_0xcd28('0x13')]));});});};exports[_0xcd28('0x22')]=function(_0x20b190){var _0x1625d1=this;return new Promise(function(_0x232083,_0x18317d){return db[_0xcd28('0x16')][_0xcd28('0x23')]({'raw':_0x20b190['options']?_0x20b190['options'][_0xcd28('0x18')]===undefined?!![]:![]:!![],'where':_0x20b190[_0xcd28('0x19')]?_0x20b190[_0xcd28('0x19')][_0xcd28('0x1a')]||null:null,'attributes':_0x20b190['options']?_0x20b190[_0xcd28('0x19')][_0xcd28('0x1b')]||null:null,'include':_0x20b190['options']?_0x20b190[_0xcd28('0x19')][_0xcd28('0x1d')]?_['map'](_0x20b190[_0xcd28('0x19')][_0xcd28('0x1d')],function(_0x27d38a){return{'model':db[_0x27d38a['model']],'as':_0x27d38a['as'],'attributes':_0x27d38a['attributes'],'include':_0x27d38a[_0xcd28('0x1d')]?_['map'](_0x27d38a[_0xcd28('0x1d')],function(_0x4a79b4){return{'model':db[_0x4a79b4[_0xcd28('0x1f')]],'as':_0x4a79b4['as'],'attributes':_0x4a79b4['attributes'],'include':_0x4a79b4[_0xcd28('0x1d')]?_[_0xcd28('0x1e')](_0x4a79b4[_0xcd28('0x1d')],function(_0x1dbdab){return{'model':db[_0x1dbdab[_0xcd28('0x1f')]],'as':_0x1dbdab['as'],'attributes':_0x1dbdab['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd28('0xb')](function(_0x94aa6b){logger['info']('ShowFreshdeskAccount',_0x20b190);logger[_0xcd28('0x21')](_0xcd28('0x22'),_0x20b190,JSON[_0xcd28('0xf')](_0x94aa6b));_0x232083(_0x94aa6b);})[_0xcd28('0x15')](function(_0x361fe9){logger[_0xcd28('0x10')]('ShowFreshdeskAccount',_0x361fe9[_0xcd28('0x13')],_0x20b190);_0x18317d(_0x1625d1[_0xcd28('0x10')](0x1f4,_0x361fe9[_0xcd28('0x13')]));});});}; \ No newline at end of file +var _0x596e=['find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','include','model','map','ShowFreshdeskAccount'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x596e,0xb1));var _0xe596=function(_0x3a773d,_0x2b9205){_0x3a773d=_0x3a773d-0x0;var _0x5024f2=_0x596e[_0x3a773d];return _0x5024f2;};'use strict';var _=require(_0xe596('0x0'));var util=require(_0xe596('0x1'));var moment=require(_0xe596('0x2'));var BPromise=require(_0xe596('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe596('0x4'));var db=require(_0xe596('0x5'))['db'];var utils=require(_0xe596('0x6'));var logger=require(_0xe596('0x7'))('rpc');var config=require(_0xe596('0x8'));var jayson=require(_0xe596('0x9'));var client=jayson['client'][_0xe596('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f3d5c,_0x2ec0cb,_0x4d1b6a){return new BPromise(function(_0x43513c,_0x4806c2){return client[_0xe596('0xb')](_0x3f3d5c,_0x4d1b6a)[_0xe596('0xc')](function(_0x14d674){logger['info'](_0xe596('0xd'),_0x2ec0cb,_0xe596('0xe'));logger[_0xe596('0xf')](_0xe596('0x10'),_0x2ec0cb,_0xe596('0xe'),JSON[_0xe596('0x11')](_0x14d674));if(_0x14d674[_0xe596('0x12')]){if(_0x14d674[_0xe596('0x12')]['code']===0x1f4){logger[_0xe596('0x12')](_0xe596('0xd'),_0x2ec0cb,_0x14d674['error'][_0xe596('0x13')]);return _0x4806c2(_0x14d674[_0xe596('0x12')][_0xe596('0x13')]);}logger[_0xe596('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ec0cb,_0x14d674['error']['message']);return _0x43513c(_0x14d674[_0xe596('0x12')]['message']);}else{logger[_0xe596('0x14')](_0xe596('0xd'),_0x2ec0cb,_0xe596('0xe'));_0x43513c(_0x14d674[_0xe596('0x15')]['message']);}})[_0xe596('0x16')](function(_0x43075c){logger[_0xe596('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ec0cb,_0x43075c);_0x4806c2(_0x43075c);});});}exports[_0xe596('0x17')]=function(_0x11fed0){var _0x1e2aa6=this;return new Promise(function(_0x3efc55,_0x28c4a0){return db[_0xe596('0x18')][_0xe596('0x19')]({'raw':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1b')]===undefined?!![]:![]:!![],'where':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')]['where']||null:null,'attributes':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1c')]||null:null,'limit':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')]['limit']||null:null,'include':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1d')]?_['map'](_0x11fed0['options']['include'],function(_0xa3b10f){return{'model':db[_0xa3b10f[_0xe596('0x1e')]],'as':_0xa3b10f['as'],'attributes':_0xa3b10f['attributes'],'include':_0xa3b10f[_0xe596('0x1d')]?_[_0xe596('0x1f')](_0xa3b10f['include'],function(_0x341b79){return{'model':db[_0x341b79[_0xe596('0x1e')]],'as':_0x341b79['as'],'attributes':_0x341b79[_0xe596('0x1c')],'include':_0x341b79['include']?_[_0xe596('0x1f')](_0x341b79[_0xe596('0x1d')],function(_0x21d9e2){return{'model':db[_0x21d9e2[_0xe596('0x1e')]],'as':_0x21d9e2['as'],'attributes':_0x21d9e2[_0xe596('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe596('0xc')](function(_0x5ad5d7){logger[_0xe596('0x14')]('GetFreshdeskAccount',_0x11fed0);logger[_0xe596('0xf')]('GetFreshdeskAccount',_0x11fed0,JSON['stringify'](_0x5ad5d7));_0x3efc55(_0x5ad5d7);})[_0xe596('0x16')](function(_0x331c14){logger[_0xe596('0x12')](_0xe596('0x17'),_0x331c14[_0xe596('0x13')],_0x11fed0);_0x28c4a0(_0x1e2aa6[_0xe596('0x12')](0x1f4,_0x331c14[_0xe596('0x13')]));});});};exports[_0xe596('0x20')]=function(_0x5768ed){var _0x398c9f=this;return new Promise(function(_0x3b6d20,_0xed29a9){return db[_0xe596('0x18')][_0xe596('0x21')]({'raw':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')][_0xe596('0x1b')]===undefined?!![]:![]:!![],'where':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')][_0xe596('0x22')]||null:null,'attributes':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')]['attributes']||null:null,'include':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')]['include']?_[_0xe596('0x1f')](_0x5768ed['options'][_0xe596('0x1d')],function(_0x24ea88){return{'model':db[_0x24ea88[_0xe596('0x1e')]],'as':_0x24ea88['as'],'attributes':_0x24ea88[_0xe596('0x1c')],'include':_0x24ea88[_0xe596('0x1d')]?_[_0xe596('0x1f')](_0x24ea88[_0xe596('0x1d')],function(_0x263015){return{'model':db[_0x263015[_0xe596('0x1e')]],'as':_0x263015['as'],'attributes':_0x263015[_0xe596('0x1c')],'include':_0x263015['include']?_[_0xe596('0x1f')](_0x263015[_0xe596('0x1d')],function(_0x25b64d){return{'model':db[_0x25b64d[_0xe596('0x1e')]],'as':_0x25b64d['as'],'attributes':_0x25b64d[_0xe596('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe596('0xc')](function(_0x393ce2){logger[_0xe596('0x14')]('ShowFreshdeskAccount',_0x5768ed);logger[_0xe596('0xf')](_0xe596('0x20'),_0x5768ed,JSON[_0xe596('0x11')](_0x393ce2));_0x3b6d20(_0x393ce2);})[_0xe596('0x16')](function(_0x2687fc){logger[_0xe596('0x12')](_0xe596('0x20'),_0x2687fc[_0xe596('0x13')],_0x5768ed);_0xed29a9(_0x398c9f[_0xe596('0x12')](0x1f4,_0x2687fc['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4f35848..182a1b4 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 _0x0b30=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x337c66,_0x1419ab){var _0x5a9370=function(_0xab014c){while(--_0xab014c){_0x337c66['push'](_0x337c66['shift']());}};_0x5a9370(++_0x1419ab);}(_0x0b30,0x1ca));var _0x00b3=function(_0xa12eb0,_0x1597fa){_0xa12eb0=_0xa12eb0-0x0;var _0x1235f7=_0x0b30[_0xa12eb0];return _0x1235f7;};'use strict';var multer=require(_0x00b3('0x0'));var util=require(_0x00b3('0x1'));var path=require(_0x00b3('0x2'));var timeout=require(_0x00b3('0x3'));var express=require(_0x00b3('0x4'));var router=express[_0x00b3('0x5')]();var fs_extra=require(_0x00b3('0x6'));var auth=require(_0x00b3('0x7'));var interaction=require(_0x00b3('0x8'));var config=require(_0x00b3('0x9'));var controller=require(_0x00b3('0xa'));router[_0x00b3('0xb')]('/',auth['isAuthenticated'](),controller[_0x00b3('0xc')]);router['get'](_0x00b3('0xd'),auth['isAuthenticated'](),controller[_0x00b3('0xe')]);router[_0x00b3('0xb')](_0x00b3('0xf'),auth[_0x00b3('0x10')](),controller[_0x00b3('0x11')]);router[_0x00b3('0xb')]('/:id/subjects',auth[_0x00b3('0x10')](),controller[_0x00b3('0x12')]);router[_0x00b3('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x00b3('0x13')]);router[_0x00b3('0xb')](_0x00b3('0x14'),auth['isAuthenticated'](),controller[_0x00b3('0x15')]);router[_0x00b3('0x16')]('/',auth[_0x00b3('0x10')](),controller[_0x00b3('0x17')]);router[_0x00b3('0x16')]('/:id/tags',auth[_0x00b3('0x10')](),controller[_0x00b3('0x18')]);router[_0x00b3('0x19')](_0x00b3('0xd'),auth[_0x00b3('0x10')](),controller['update']);router[_0x00b3('0x1a')](_0x00b3('0xd'),auth[_0x00b3('0x10')](),controller[_0x00b3('0x1b')]);module[_0x00b3('0x1c')]=router; \ No newline at end of file +var _0x43a6=['./intFreshdeskConfiguration.controller','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x508bef,_0x389b48){var _0x4dddef=function(_0x314122){while(--_0x314122){_0x508bef['push'](_0x508bef['shift']());}};_0x4dddef(++_0x389b48);}(_0x43a6,0x1d3));var _0x643a=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x43a6[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x643a('0x0'));var util=require('util');var path=require(_0x643a('0x1'));var timeout=require(_0x643a('0x2'));var express=require(_0x643a('0x3'));var router=express[_0x643a('0x4')]();var fs_extra=require(_0x643a('0x5'));var auth=require(_0x643a('0x6'));var interaction=require(_0x643a('0x7'));var config=require(_0x643a('0x8'));var controller=require(_0x643a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x643a('0xa')]);router['get'](_0x643a('0xb'),auth[_0x643a('0xc')](),controller[_0x643a('0xd')]);router['get'](_0x643a('0xe'),auth['isAuthenticated'](),controller[_0x643a('0xf')]);router['get'](_0x643a('0x10'),auth[_0x643a('0xc')](),controller[_0x643a('0x11')]);router[_0x643a('0x12')]('/:id/descriptions',auth[_0x643a('0xc')](),controller[_0x643a('0x13')]);router[_0x643a('0x12')](_0x643a('0x14'),auth[_0x643a('0xc')](),controller[_0x643a('0x15')]);router[_0x643a('0x16')]('/',auth[_0x643a('0xc')](),controller[_0x643a('0x17')]);router[_0x643a('0x16')]('/:id/tags',auth[_0x643a('0xc')](),controller[_0x643a('0x18')]);router['put'](_0x643a('0xb'),auth[_0x643a('0xc')](),controller[_0x643a('0x19')]);router[_0x643a('0x1a')]('/:id',auth[_0x643a('0xc')](),controller['destroy']);module[_0x643a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 64e5e58..a688135 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 _0xd54b=['STRING','sequelize'];(function(_0x3f16f6,_0x924c06){var _0x370a26=function(_0x28b071){while(--_0x28b071){_0x3f16f6['push'](_0x3f16f6['shift']());}};_0x370a26(++_0x924c06);}(_0xd54b,0x77));var _0xbd54=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd54b[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xbd54('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd54('0x1')]},'description':{'type':Sequelize[_0xbd54('0x1')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 52d0224..88e8c36 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 _0xea38=['../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','params','destroy','getFields','findOne','FreshdeskField','sort','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xec54f2,_0x4a2339){var _0x4a603f=function(_0x400ee3){while(--_0x400ee3){_0xec54f2['push'](_0xec54f2['shift']());}};_0x4a603f(++_0x4a2339);}(_0xea38,0xe9));var _0x8ea3=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0xea38[_0x11fb16];return _0x343de1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ea3('0x0'));var jsonpatch=require(_0x8ea3('0x1'));var rp=require(_0x8ea3('0x2'));var moment=require(_0x8ea3('0x3'));var BPromise=require(_0x8ea3('0x4'));var Mustache=require(_0x8ea3('0x5'));var util=require(_0x8ea3('0x6'));var path=require('path');var sox=require(_0x8ea3('0x7'));var csv=require(_0x8ea3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea3('0x9'));var _=require(_0x8ea3('0xa'));var squel=require(_0x8ea3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ea3('0xc'));var toCsv=require(_0x8ea3('0x8'));var querystring=require(_0x8ea3('0xd'));var Papa=require(_0x8ea3('0xe'));var Redis=require('ioredis');var authService=require(_0x8ea3('0xf'));var qs=require(_0x8ea3('0x10'));var as=require(_0x8ea3('0x11'));var hardwareService=require(_0x8ea3('0x12'));var logger=require(_0x8ea3('0x13'))(_0x8ea3('0x14'));var utils=require(_0x8ea3('0x15'));var config=require(_0x8ea3('0x16'));var licenseUtil=require(_0x8ea3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24d583,_0x4eeb6b){_0x4eeb6b=_0x4eeb6b||0xcc;return function(_0x44838a){if(_0x44838a){return _0x24d583['sendStatus'](_0x4eeb6b);}return _0x24d583[_0x8ea3('0x18')](_0x4eeb6b)[_0x8ea3('0x19')]();};}function respondWithResult(_0x764364,_0xca04d9){_0xca04d9=_0xca04d9||0xc8;return function(_0xa47f2){if(_0xa47f2){return _0x764364[_0x8ea3('0x18')](_0xca04d9)['json'](_0xa47f2);}};}function respondWithFilteredResult(_0x23217,_0x19606b){return function(_0x109d89){if(_0x109d89){var _0x45c758=typeof _0x19606b[_0x8ea3('0x1a')]===_0x8ea3('0x1b')&&typeof _0x19606b[_0x8ea3('0x1c')]===_0x8ea3('0x1b');var _0x5c0817=_0x109d89[_0x8ea3('0x1d')];var _0x5d9017=_0x45c758?0x0:_0x19606b[_0x8ea3('0x1a')];var _0x20568d=_0x45c758?_0x109d89[_0x8ea3('0x1d')]:_0x19606b[_0x8ea3('0x1a')]+_0x19606b[_0x8ea3('0x1c')];var _0xd1f5c7;if(_0x20568d>=_0x5c0817){_0x20568d=_0x5c0817;_0xd1f5c7=0xc8;}else{_0xd1f5c7=0xce;}_0x23217[_0x8ea3('0x18')](_0xd1f5c7);return _0x23217[_0x8ea3('0x1e')](_0x8ea3('0x1f'),_0x5d9017+'-'+_0x20568d+'/'+_0x5c0817)[_0x8ea3('0x20')](_0x109d89);}return null;};}function patchUpdates(_0x51c955){return function(_0x5d9149){try{jsonpatch['apply'](_0x5d9149,_0x51c955,!![]);}catch(_0x21435d){return BPromise[_0x8ea3('0x21')](_0x21435d);}return _0x5d9149[_0x8ea3('0x22')]();};}function saveUpdates(_0x55d54f,_0x5a6dbb){return function(_0x11d968){if(_0x11d968){return _0x11d968[_0x8ea3('0x23')](_0x55d54f)[_0x8ea3('0x24')](function(_0x126542){return _0x126542;});}return null;};}function removeEntity(_0x2adc67,_0x31f9dc){return function(_0x1f339d){if(_0x1f339d){return _0x1f339d['destroy']()[_0x8ea3('0x24')](function(){_0x2adc67[_0x8ea3('0x18')](0xcc)[_0x8ea3('0x19')]();});}};}function handleEntityNotFound(_0x7093f9,_0x234d05){return function(_0x75e82){if(!_0x75e82){_0x7093f9[_0x8ea3('0x25')](0x194);}return _0x75e82;};}function handleError(_0x1d3b93,_0x5b61d2){_0x5b61d2=_0x5b61d2||0x1f4;return function(_0x1b7948){logger[_0x8ea3('0x26')](_0x1b7948[_0x8ea3('0x27')]);if(_0x1b7948['name']){delete _0x1b7948[_0x8ea3('0x28')];}_0x1d3b93['status'](_0x5b61d2)[_0x8ea3('0x29')](_0x1b7948);};}exports[_0x8ea3('0x2a')]=function(_0x410df9,_0x144708){var _0x9ed55c={},_0x4b9d81={},_0x25265={'count':0x0,'rows':[]};var _0x2d4092=_[_0x8ea3('0x2b')](db[_0x8ea3('0x2c')]['rawAttributes'],function(_0x4538ee){return{'name':_0x4538ee[_0x8ea3('0x2d')],'type':_0x4538ee[_0x8ea3('0x2e')][_0x8ea3('0x2f')]};});_0x4b9d81[_0x8ea3('0x30')]=_[_0x8ea3('0x2b')](_0x2d4092,'name');_0x4b9d81[_0x8ea3('0x31')]=_['keys'](_0x410df9['query']);_0x4b9d81['filters']=_[_0x8ea3('0x32')](_0x4b9d81[_0x8ea3('0x30')],_0x4b9d81[_0x8ea3('0x31')]);_0x9ed55c[_0x8ea3('0x33')]=_[_0x8ea3('0x32')](_0x4b9d81[_0x8ea3('0x30')],qs[_0x8ea3('0x34')](_0x410df9['query']['fields']));_0x9ed55c[_0x8ea3('0x33')]=_0x9ed55c[_0x8ea3('0x33')][_0x8ea3('0x35')]?_0x9ed55c[_0x8ea3('0x33')]:_0x4b9d81[_0x8ea3('0x30')];if(!_0x410df9[_0x8ea3('0x31')][_0x8ea3('0x36')]('nolimit')){_0x9ed55c[_0x8ea3('0x1c')]=qs['limit'](_0x410df9[_0x8ea3('0x31')][_0x8ea3('0x1c')]);_0x9ed55c[_0x8ea3('0x1a')]=qs['offset'](_0x410df9[_0x8ea3('0x31')]['offset']);}_0x9ed55c[_0x8ea3('0x37')]=qs['sort'](_0x410df9[_0x8ea3('0x31')]['sort']);_0x9ed55c[_0x8ea3('0x38')]=qs[_0x8ea3('0x39')](_[_0x8ea3('0x3a')](_0x410df9[_0x8ea3('0x31')],_0x4b9d81[_0x8ea3('0x39')]),_0x2d4092);if(_0x410df9[_0x8ea3('0x31')][_0x8ea3('0x3b')]){_0x9ed55c[_0x8ea3('0x38')]=_[_0x8ea3('0x3c')](_0x9ed55c[_0x8ea3('0x38')],{'$or':_[_0x8ea3('0x2b')](_0x2d4092,function(_0x58a6ee){if(_0x58a6ee[_0x8ea3('0x2e')]!==_0x8ea3('0x3d')){var _0x403059={};_0x403059[_0x58a6ee[_0x8ea3('0x28')]]={'$like':'%'+_0x410df9['query'][_0x8ea3('0x3b')]+'%'};return _0x403059;}})});}_0x9ed55c=_[_0x8ea3('0x3c')]({},_0x9ed55c,_0x410df9[_0x8ea3('0x3e')]);var _0x1d67de={'where':_0x9ed55c[_0x8ea3('0x38')]};return db[_0x8ea3('0x2c')][_0x8ea3('0x1d')](_0x1d67de)[_0x8ea3('0x24')](function(_0x44268f){_0x25265[_0x8ea3('0x1d')]=_0x44268f;if(_0x410df9[_0x8ea3('0x31')][_0x8ea3('0x3f')]){_0x9ed55c[_0x8ea3('0x40')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x8ea3('0x41')](_0x9ed55c);})[_0x8ea3('0x24')](function(_0x4961d7){_0x25265[_0x8ea3('0x42')]=_0x4961d7;return _0x25265;})[_0x8ea3('0x24')](respondWithFilteredResult(_0x144708,_0x9ed55c))[_0x8ea3('0x43')](handleError(_0x144708,null));};exports['show']=function(_0x458d1b,_0x13879b){var _0x3943a7={'raw':![],'where':{'id':_0x458d1b['params']['id']}},_0x4ac6ba={};_0x4ac6ba[_0x8ea3('0x30')]=_[_0x8ea3('0x44')](db[_0x8ea3('0x2c')][_0x8ea3('0x45')]);_0x4ac6ba[_0x8ea3('0x31')]=_[_0x8ea3('0x44')](_0x458d1b['query']);_0x4ac6ba[_0x8ea3('0x39')]=_['intersection'](_0x4ac6ba[_0x8ea3('0x30')],_0x4ac6ba['query']);_0x3943a7[_0x8ea3('0x33')]=_[_0x8ea3('0x32')](_0x4ac6ba[_0x8ea3('0x30')],qs['fields'](_0x458d1b['query'][_0x8ea3('0x34')]));_0x3943a7[_0x8ea3('0x33')]=_0x3943a7[_0x8ea3('0x33')][_0x8ea3('0x35')]?_0x3943a7[_0x8ea3('0x33')]:_0x4ac6ba[_0x8ea3('0x30')];if(_0x458d1b[_0x8ea3('0x31')]['includeAll']){_0x3943a7[_0x8ea3('0x40')]=[{'all':!![]}];}_0x3943a7=_['merge']({},_0x3943a7,_0x458d1b[_0x8ea3('0x3e')]);return db['FreshdeskConfiguration'][_0x8ea3('0x46')](_0x3943a7)[_0x8ea3('0x24')](handleEntityNotFound(_0x13879b,null))[_0x8ea3('0x24')](respondWithResult(_0x13879b,null))['catch'](handleError(_0x13879b,null));};exports[_0x8ea3('0x47')]=function(_0xc22789,_0x43da9f){return db['FreshdeskConfiguration']['create'](_0xc22789[_0x8ea3('0x48')],{})[_0x8ea3('0x24')](respondWithResult(_0x43da9f,0xc9))[_0x8ea3('0x43')](handleError(_0x43da9f,null));};exports[_0x8ea3('0x23')]=function(_0x38bc7b,_0x2c1231){if(_0x38bc7b[_0x8ea3('0x48')]['id']){delete _0x38bc7b[_0x8ea3('0x48')]['id'];}return db[_0x8ea3('0x2c')][_0x8ea3('0x46')]({'where':{'id':_0x38bc7b[_0x8ea3('0x49')]['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x2c1231,null))['then'](saveUpdates(_0x38bc7b[_0x8ea3('0x48')],null))[_0x8ea3('0x24')](respondWithResult(_0x2c1231,null))['catch'](handleError(_0x2c1231,null));};exports[_0x8ea3('0x4a')]=function(_0x4a77f2,_0x1ba6ad){return db[_0x8ea3('0x2c')][_0x8ea3('0x46')]({'where':{'id':_0x4a77f2['params']['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x1ba6ad,null))['then'](removeEntity(_0x1ba6ad,null))[_0x8ea3('0x43')](handleError(_0x1ba6ad,null));};exports[_0x8ea3('0x4b')]=function(_0x185703,_0x33d916,_0x2c13fc){var _0x68e70f={};var _0x3c9a62={};var _0x1ff67d;var _0x184de6;return db[_0x8ea3('0x2c')][_0x8ea3('0x4c')]({'where':{'id':_0x185703['params']['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x33d916,null))[_0x8ea3('0x24')](function(_0x59e6b7){if(_0x59e6b7){_0x1ff67d=_0x59e6b7;_0x3c9a62[_0x8ea3('0x30')]=_['keys'](db[_0x8ea3('0x4d')][_0x8ea3('0x45')]);_0x3c9a62[_0x8ea3('0x31')]=_[_0x8ea3('0x44')](_0x185703[_0x8ea3('0x31')]);_0x3c9a62[_0x8ea3('0x39')]=_[_0x8ea3('0x32')](_0x3c9a62[_0x8ea3('0x30')],_0x3c9a62[_0x8ea3('0x31')]);_0x68e70f['attributes']=_[_0x8ea3('0x32')](_0x3c9a62[_0x8ea3('0x30')],qs[_0x8ea3('0x34')](_0x185703[_0x8ea3('0x31')][_0x8ea3('0x34')]));_0x68e70f[_0x8ea3('0x33')]=_0x68e70f['attributes'][_0x8ea3('0x35')]?_0x68e70f[_0x8ea3('0x33')]:_0x3c9a62[_0x8ea3('0x30')];_0x68e70f['order']=qs[_0x8ea3('0x4e')](_0x185703[_0x8ea3('0x31')][_0x8ea3('0x4e')]);_0x68e70f[_0x8ea3('0x38')]=qs['filters'](_['pick'](_0x185703[_0x8ea3('0x31')],_0x3c9a62[_0x8ea3('0x39')]));if(_0x185703['query'][_0x8ea3('0x3b')]){_0x68e70f[_0x8ea3('0x38')]=_['merge'](_0x68e70f[_0x8ea3('0x38')],{'$or':_['map'](_0x68e70f[_0x8ea3('0x33')],function(_0x5b73e4){var _0x33279d={};_0x33279d[_0x5b73e4]={'$like':'%'+_0x185703[_0x8ea3('0x31')]['filter']+'%'};return _0x33279d;})});}_0x68e70f=_[_0x8ea3('0x3c')]({},_0x68e70f,_0x185703[_0x8ea3('0x3e')]);return _0x1ff67d[_0x8ea3('0x4b')](_0x68e70f);}})[_0x8ea3('0x24')](function(_0x5db2df){if(_0x5db2df){_0x184de6=_0x5db2df[_0x8ea3('0x35')];if(!_0x185703[_0x8ea3('0x31')][_0x8ea3('0x36')](_0x8ea3('0x4f'))){_0x68e70f['limit']=qs[_0x8ea3('0x1c')](_0x185703[_0x8ea3('0x31')]['limit']);_0x68e70f[_0x8ea3('0x1a')]=qs['offset'](_0x185703['query']['offset']);}return _0x1ff67d[_0x8ea3('0x4b')](_0x68e70f);}})[_0x8ea3('0x24')](function(_0x389f00){if(_0x389f00){return _0x389f00?{'count':_0x184de6,'rows':_0x389f00}:null;}})[_0x8ea3('0x24')](respondWithResult(_0x33d916,null))[_0x8ea3('0x43')](handleError(_0x33d916,null));};exports[_0x8ea3('0x50')]=function(_0x2cac0d,_0x88e759,_0x11ce46){var _0x369289={};var _0x505809={};var _0x55d2f8;var _0x12a9e8;return db['FreshdeskConfiguration'][_0x8ea3('0x4c')]({'where':{'id':_0x2cac0d['params']['id']}})['then'](handleEntityNotFound(_0x88e759,null))[_0x8ea3('0x24')](function(_0xa8ee15){if(_0xa8ee15){_0x55d2f8=_0xa8ee15;_0x505809[_0x8ea3('0x30')]=_[_0x8ea3('0x44')](db[_0x8ea3('0x4d')][_0x8ea3('0x45')]);_0x505809[_0x8ea3('0x31')]=_['keys'](_0x2cac0d['query']);_0x505809[_0x8ea3('0x39')]=_[_0x8ea3('0x32')](_0x505809[_0x8ea3('0x30')],_0x505809[_0x8ea3('0x31')]);_0x369289[_0x8ea3('0x33')]=_['intersection'](_0x505809['model'],qs['fields'](_0x2cac0d['query']['fields']));_0x369289[_0x8ea3('0x33')]=_0x369289[_0x8ea3('0x33')][_0x8ea3('0x35')]?_0x369289['attributes']:_0x505809[_0x8ea3('0x30')];_0x369289[_0x8ea3('0x37')]=qs['sort'](_0x2cac0d['query'][_0x8ea3('0x4e')]);_0x369289[_0x8ea3('0x38')]=qs[_0x8ea3('0x39')](_[_0x8ea3('0x3a')](_0x2cac0d[_0x8ea3('0x31')],_0x505809[_0x8ea3('0x39')]));if(_0x2cac0d[_0x8ea3('0x31')][_0x8ea3('0x3b')]){_0x369289[_0x8ea3('0x38')]=_[_0x8ea3('0x3c')](_0x369289['where'],{'$or':_['map'](_0x369289[_0x8ea3('0x33')],function(_0xff7600){var _0x491325={};_0x491325[_0xff7600]={'$like':'%'+_0x2cac0d[_0x8ea3('0x31')][_0x8ea3('0x3b')]+'%'};return _0x491325;})});}_0x369289=_['merge']({},_0x369289,_0x2cac0d[_0x8ea3('0x3e')]);return _0x55d2f8[_0x8ea3('0x50')](_0x369289);}})[_0x8ea3('0x24')](function(_0x34d4b1){if(_0x34d4b1){_0x12a9e8=_0x34d4b1[_0x8ea3('0x35')];if(!_0x2cac0d[_0x8ea3('0x31')][_0x8ea3('0x36')](_0x8ea3('0x4f'))){_0x369289[_0x8ea3('0x1c')]=qs['limit'](_0x2cac0d[_0x8ea3('0x31')][_0x8ea3('0x1c')]);_0x369289['offset']=qs[_0x8ea3('0x1a')](_0x2cac0d[_0x8ea3('0x31')][_0x8ea3('0x1a')]);}return _0x55d2f8[_0x8ea3('0x50')](_0x369289);}})[_0x8ea3('0x24')](function(_0x370351){if(_0x370351){return _0x370351?{'count':_0x12a9e8,'rows':_0x370351}:null;}})[_0x8ea3('0x24')](respondWithResult(_0x88e759,null))['catch'](handleError(_0x88e759,null));};exports[_0x8ea3('0x51')]=function(_0x4b36b1,_0x5ac196,_0x40d660){var _0x5db667={};var _0x45d7f0={};var _0x294e6d;var _0x3c7e04;return db[_0x8ea3('0x2c')][_0x8ea3('0x4c')]({'where':{'id':_0x4b36b1['params']['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x5ac196,null))[_0x8ea3('0x24')](function(_0x24b582){if(_0x24b582){_0x294e6d=_0x24b582;_0x45d7f0['model']=_['keys'](db[_0x8ea3('0x4d')]['rawAttributes']);_0x45d7f0[_0x8ea3('0x31')]=_[_0x8ea3('0x44')](_0x4b36b1[_0x8ea3('0x31')]);_0x45d7f0[_0x8ea3('0x39')]=_[_0x8ea3('0x32')](_0x45d7f0[_0x8ea3('0x30')],_0x45d7f0[_0x8ea3('0x31')]);_0x5db667[_0x8ea3('0x33')]=_[_0x8ea3('0x32')](_0x45d7f0['model'],qs['fields'](_0x4b36b1['query'][_0x8ea3('0x34')]));_0x5db667[_0x8ea3('0x33')]=_0x5db667[_0x8ea3('0x33')][_0x8ea3('0x35')]?_0x5db667[_0x8ea3('0x33')]:_0x45d7f0[_0x8ea3('0x30')];_0x5db667[_0x8ea3('0x37')]=qs[_0x8ea3('0x4e')](_0x4b36b1[_0x8ea3('0x31')][_0x8ea3('0x4e')]);_0x5db667[_0x8ea3('0x38')]=qs[_0x8ea3('0x39')](_['pick'](_0x4b36b1[_0x8ea3('0x31')],_0x45d7f0[_0x8ea3('0x39')]));if(_0x4b36b1[_0x8ea3('0x31')][_0x8ea3('0x3b')]){_0x5db667[_0x8ea3('0x38')]=_[_0x8ea3('0x3c')](_0x5db667[_0x8ea3('0x38')],{'$or':_[_0x8ea3('0x2b')](_0x5db667[_0x8ea3('0x33')],function(_0x42d32c){var _0x21fa4e={};_0x21fa4e[_0x42d32c]={'$like':'%'+_0x4b36b1[_0x8ea3('0x31')][_0x8ea3('0x3b')]+'%'};return _0x21fa4e;})});}_0x5db667=_[_0x8ea3('0x3c')]({},_0x5db667,_0x4b36b1[_0x8ea3('0x3e')]);return _0x294e6d['getDescriptions'](_0x5db667);}})[_0x8ea3('0x24')](function(_0x31dc21){if(_0x31dc21){_0x3c7e04=_0x31dc21[_0x8ea3('0x35')];if(!_0x4b36b1[_0x8ea3('0x31')][_0x8ea3('0x36')](_0x8ea3('0x4f'))){_0x5db667['limit']=qs['limit'](_0x4b36b1[_0x8ea3('0x31')]['limit']);_0x5db667[_0x8ea3('0x1a')]=qs['offset'](_0x4b36b1[_0x8ea3('0x31')]['offset']);}return _0x294e6d['getDescriptions'](_0x5db667);}})[_0x8ea3('0x24')](function(_0x198a31){if(_0x198a31){return _0x198a31?{'count':_0x3c7e04,'rows':_0x198a31}:null;}})[_0x8ea3('0x24')](respondWithResult(_0x5ac196,null))[_0x8ea3('0x43')](handleError(_0x5ac196,null));};exports[_0x8ea3('0x52')]=function(_0x1559ab,_0x3a52e1,_0x45d19a){var _0x1ea79e={};var _0x53ac27={};var _0x28413a;var _0x54fe0b;return db[_0x8ea3('0x2c')][_0x8ea3('0x4c')]({'where':{'id':_0x1559ab[_0x8ea3('0x49')]['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x3a52e1,null))['then'](function(_0x49c241){if(_0x49c241){_0x28413a=_0x49c241;_0x53ac27['model']=_[_0x8ea3('0x44')](db[_0x8ea3('0x53')][_0x8ea3('0x45')]);_0x53ac27[_0x8ea3('0x31')]=_[_0x8ea3('0x44')](_0x1559ab[_0x8ea3('0x31')]);_0x53ac27[_0x8ea3('0x39')]=_[_0x8ea3('0x32')](_0x53ac27['model'],_0x53ac27[_0x8ea3('0x31')]);_0x1ea79e[_0x8ea3('0x33')]=_['intersection'](_0x53ac27[_0x8ea3('0x30')],qs[_0x8ea3('0x34')](_0x1559ab['query'][_0x8ea3('0x34')]));_0x1ea79e[_0x8ea3('0x33')]=_0x1ea79e[_0x8ea3('0x33')][_0x8ea3('0x35')]?_0x1ea79e[_0x8ea3('0x33')]:_0x53ac27[_0x8ea3('0x30')];_0x1ea79e[_0x8ea3('0x37')]=qs['sort'](_0x1559ab['query'][_0x8ea3('0x4e')]);_0x1ea79e['where']=qs[_0x8ea3('0x39')](_['pick'](_0x1559ab[_0x8ea3('0x31')],_0x53ac27[_0x8ea3('0x39')]));if(_0x1559ab['query'][_0x8ea3('0x3b')]){_0x1ea79e[_0x8ea3('0x38')]=_[_0x8ea3('0x3c')](_0x1ea79e[_0x8ea3('0x38')],{'$or':_[_0x8ea3('0x2b')](_0x1ea79e[_0x8ea3('0x33')],function(_0x2bb036){var _0x5fe3d8={};_0x5fe3d8[_0x2bb036]={'$like':'%'+_0x1559ab['query'][_0x8ea3('0x3b')]+'%'};return _0x5fe3d8;})});}_0x1ea79e=_['merge']({},_0x1ea79e,_0x1559ab[_0x8ea3('0x3e')]);return _0x28413a[_0x8ea3('0x52')](_0x1ea79e);}})['then'](function(_0x3adbf1){if(_0x3adbf1){_0x54fe0b=_0x3adbf1['length'];if(!_0x1559ab['query'][_0x8ea3('0x36')](_0x8ea3('0x4f'))){_0x1ea79e[_0x8ea3('0x1c')]=qs[_0x8ea3('0x1c')](_0x1559ab[_0x8ea3('0x31')][_0x8ea3('0x1c')]);_0x1ea79e['offset']=qs[_0x8ea3('0x1a')](_0x1559ab[_0x8ea3('0x31')][_0x8ea3('0x1a')]);}return _0x28413a[_0x8ea3('0x52')](_0x1ea79e);}})[_0x8ea3('0x24')](function(_0x5cebfa){if(_0x5cebfa){return _0x5cebfa?{'count':_0x54fe0b,'rows':_0x5cebfa}:null;}})['then'](respondWithResult(_0x3a52e1,null))[_0x8ea3('0x43')](handleError(_0x3a52e1,null));};exports['setTags']=function(_0x5ffbab,_0x44a1c4,_0x1cf735){if(_0x5ffbab[_0x8ea3('0x48')]['id']){delete _0x5ffbab[_0x8ea3('0x48')]['id'];}return db[_0x8ea3('0x2c')][_0x8ea3('0x4c')]({'where':{'id':_0x5ffbab[_0x8ea3('0x49')]['id']}})[_0x8ea3('0x24')](handleEntityNotFound(_0x44a1c4,null))[_0x8ea3('0x24')](function(_0x13e219){if(_0x13e219){return _0x13e219[_0x8ea3('0x54')](_0x5ffbab[_0x8ea3('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x44a1c4,null))[_0x8ea3('0x43')](handleError(_0x44a1c4,null));}; \ No newline at end of file +var _0xba79=['sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshdeskField','merge','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','bluebird','util','path'];(function(_0x4e7bb4,_0x42572c){var _0x456e48=function(_0x1b7248){while(--_0x1b7248){_0x4e7bb4['push'](_0x4e7bb4['shift']());}};_0x456e48(++_0x42572c);}(_0xba79,0xea));var _0x9ba7=function(_0x53b22e,_0x5e248f){_0x53b22e=_0x53b22e-0x0;var _0x14a0a4=_0xba79[_0x53b22e];return _0x14a0a4;};'use strict';var emlformat=require(_0x9ba7('0x0'));var rimraf=require(_0x9ba7('0x1'));var zipdir=require(_0x9ba7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ba7('0x3'));var Mustache=require('mustache');var util=require(_0x9ba7('0x4'));var path=require(_0x9ba7('0x5'));var sox=require(_0x9ba7('0x6'));var csv=require(_0x9ba7('0x7'));var ejs=require(_0x9ba7('0x8'));var fs=require('fs');var fs_extra=require(_0x9ba7('0x9'));var _=require(_0x9ba7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ba7('0xb'));var toCsv=require(_0x9ba7('0x7'));var querystring=require(_0x9ba7('0xc'));var Papa=require(_0x9ba7('0xd'));var Redis=require(_0x9ba7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9ba7('0xf'));var as=require(_0x9ba7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ba7('0x11'))('api');var utils=require(_0x9ba7('0x12'));var config=require(_0x9ba7('0x13'));var licenseUtil=require(_0x9ba7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb35fe,_0x4824bb){_0x4824bb=_0x4824bb||0xcc;return function(_0x2a6cb9){if(_0x2a6cb9){return _0xcb35fe[_0x9ba7('0x15')](_0x4824bb);}return _0xcb35fe[_0x9ba7('0x16')](_0x4824bb)['end']();};}function respondWithResult(_0x17b3ef,_0x57d380){_0x57d380=_0x57d380||0xc8;return function(_0x5a51aa){if(_0x5a51aa){return _0x17b3ef['status'](_0x57d380)[_0x9ba7('0x17')](_0x5a51aa);}};}function respondWithFilteredResult(_0x4888f1,_0x58f842){return function(_0xa03ef6){if(_0xa03ef6){var _0x319074=typeof _0x58f842[_0x9ba7('0x18')]===_0x9ba7('0x19')&&typeof _0x58f842[_0x9ba7('0x1a')]==='undefined';var _0x23876a=_0xa03ef6['count'];var _0x1b635e=_0x319074?0x0:_0x58f842[_0x9ba7('0x18')];var _0x31de33=_0x319074?_0xa03ef6[_0x9ba7('0x1b')]:_0x58f842['offset']+_0x58f842[_0x9ba7('0x1a')];var _0x1baa51;if(_0x31de33>=_0x23876a){_0x31de33=_0x23876a;_0x1baa51=0xc8;}else{_0x1baa51=0xce;}_0x4888f1[_0x9ba7('0x16')](_0x1baa51);return _0x4888f1[_0x9ba7('0x1c')](_0x9ba7('0x1d'),_0x1b635e+'-'+_0x31de33+'/'+_0x23876a)[_0x9ba7('0x17')](_0xa03ef6);}return null;};}function patchUpdates(_0x25acd0){return function(_0x2317dd){try{jsonpatch['apply'](_0x2317dd,_0x25acd0,!![]);}catch(_0x55a662){return BPromise[_0x9ba7('0x1e')](_0x55a662);}return _0x2317dd['save']();};}function saveUpdates(_0x5b860d,_0x1bde0a){return function(_0x32dcac){if(_0x32dcac){return _0x32dcac[_0x9ba7('0x1f')](_0x5b860d)[_0x9ba7('0x20')](function(_0x536cb3){return _0x536cb3;});}return null;};}function removeEntity(_0x3e0e12,_0x4b919e){return function(_0x2b5ed0){if(_0x2b5ed0){return _0x2b5ed0[_0x9ba7('0x21')]()[_0x9ba7('0x20')](function(){_0x3e0e12[_0x9ba7('0x16')](0xcc)[_0x9ba7('0x22')]();});}};}function handleEntityNotFound(_0x47641c,_0x20a9a4){return function(_0x41b1e9){if(!_0x41b1e9){_0x47641c['sendStatus'](0x194);}return _0x41b1e9;};}function handleError(_0x247f19,_0x12851f){_0x12851f=_0x12851f||0x1f4;return function(_0x1824c0){logger[_0x9ba7('0x23')](_0x1824c0[_0x9ba7('0x24')]);if(_0x1824c0[_0x9ba7('0x25')]){delete _0x1824c0['name'];}_0x247f19[_0x9ba7('0x16')](_0x12851f)['send'](_0x1824c0);};}exports['index']=function(_0x2a3c3e,_0xea4cab){var _0xfe67a9={},_0x3ca876={},_0x3ecf08={'count':0x0,'rows':[]};var _0x57384d=_['map'](db[_0x9ba7('0x26')][_0x9ba7('0x27')],function(_0x568dea){return{'name':_0x568dea['fieldName'],'type':_0x568dea[_0x9ba7('0x28')][_0x9ba7('0x29')]};});_0x3ca876[_0x9ba7('0x2a')]=_['map'](_0x57384d,_0x9ba7('0x25'));_0x3ca876[_0x9ba7('0x2b')]=_[_0x9ba7('0x2c')](_0x2a3c3e[_0x9ba7('0x2b')]);_0x3ca876[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x3ca876[_0x9ba7('0x2a')],_0x3ca876[_0x9ba7('0x2b')]);_0xfe67a9[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x3ca876[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0xfe67a9[_0x9ba7('0x2f')]=_0xfe67a9[_0x9ba7('0x2f')]['length']?_0xfe67a9[_0x9ba7('0x2f')]:_0x3ca876['model'];if(!_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0xfe67a9[_0x9ba7('0x1a')]=qs['limit'](_0x2a3c3e[_0x9ba7('0x2b')]['limit']);_0xfe67a9[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x2a3c3e[_0x9ba7('0x2b')]['offset']);}_0xfe67a9[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0xfe67a9[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_[_0x9ba7('0x36')](_0x2a3c3e[_0x9ba7('0x2b')],_0x3ca876['filters']),_0x57384d);if(_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0xfe67a9[_0x9ba7('0x35')]=_['merge'](_0xfe67a9['where'],{'$or':_[_0x9ba7('0x38')](_0x57384d,function(_0x1b6070){if(_0x1b6070[_0x9ba7('0x28')]!==_0x9ba7('0x39')){var _0x58bd48={};_0x58bd48[_0x1b6070[_0x9ba7('0x25')]]={'$like':'%'+_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0x58bd48;}})});}_0xfe67a9=_['merge']({},_0xfe67a9,_0x2a3c3e[_0x9ba7('0x3a')]);var _0x4ea46d={'where':_0xfe67a9[_0x9ba7('0x35')]};return db[_0x9ba7('0x26')][_0x9ba7('0x1b')](_0x4ea46d)[_0x9ba7('0x20')](function(_0x31c7b5){_0x3ecf08['count']=_0x31c7b5;if(_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x3b')]){_0xfe67a9[_0x9ba7('0x3c')]=[{'all':!![]}];}return db[_0x9ba7('0x26')][_0x9ba7('0x3d')](_0xfe67a9);})[_0x9ba7('0x20')](function(_0x54c03b){_0x3ecf08[_0x9ba7('0x3e')]=_0x54c03b;return _0x3ecf08;})[_0x9ba7('0x20')](respondWithFilteredResult(_0xea4cab,_0xfe67a9))[_0x9ba7('0x3f')](handleError(_0xea4cab,null));};exports[_0x9ba7('0x40')]=function(_0x3ac8c4,_0x20abc4){var _0x1e2607={'raw':![],'where':{'id':_0x3ac8c4[_0x9ba7('0x41')]['id']}},_0x5f23bd={};_0x5f23bd[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x26')][_0x9ba7('0x27')]);_0x5f23bd['query']=_[_0x9ba7('0x2c')](_0x3ac8c4[_0x9ba7('0x2b')]);_0x5f23bd[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x5f23bd[_0x9ba7('0x2a')],_0x5f23bd[_0x9ba7('0x2b')]);_0x1e2607[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x5f23bd['model'],qs[_0x9ba7('0x30')](_0x3ac8c4[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0x1e2607[_0x9ba7('0x2f')]=_0x1e2607[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x1e2607[_0x9ba7('0x2f')]:_0x5f23bd['model'];if(_0x3ac8c4[_0x9ba7('0x2b')][_0x9ba7('0x3b')]){_0x1e2607['include']=[{'all':!![]}];}_0x1e2607=_['merge']({},_0x1e2607,_0x3ac8c4[_0x9ba7('0x3a')]);return db[_0x9ba7('0x26')][_0x9ba7('0x43')](_0x1e2607)['then'](handleEntityNotFound(_0x20abc4,null))[_0x9ba7('0x20')](respondWithResult(_0x20abc4,null))['catch'](handleError(_0x20abc4,null));};exports[_0x9ba7('0x44')]=function(_0x28a53c,_0x4dffef){return db['FreshdeskConfiguration'][_0x9ba7('0x44')](_0x28a53c[_0x9ba7('0x45')],{})['then'](respondWithResult(_0x4dffef,0xc9))['catch'](handleError(_0x4dffef,null));};exports[_0x9ba7('0x1f')]=function(_0x4abade,_0x166e25){if(_0x4abade[_0x9ba7('0x45')]['id']){delete _0x4abade[_0x9ba7('0x45')]['id'];}return db[_0x9ba7('0x26')][_0x9ba7('0x43')]({'where':{'id':_0x4abade[_0x9ba7('0x41')]['id']}})['then'](handleEntityNotFound(_0x166e25,null))[_0x9ba7('0x20')](saveUpdates(_0x4abade['body'],null))[_0x9ba7('0x20')](respondWithResult(_0x166e25,null))[_0x9ba7('0x3f')](handleError(_0x166e25,null));};exports['destroy']=function(_0x3dca52,_0x4046c5){return db['FreshdeskConfiguration'][_0x9ba7('0x43')]({'where':{'id':_0x3dca52[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4046c5,null))['then'](removeEntity(_0x4046c5,null))[_0x9ba7('0x3f')](handleError(_0x4046c5,null));};exports['getFields']=function(_0x42d8c9,_0x420150,_0x4e48e9){var _0x1b4ae6={};var _0x231870={};var _0x21cd6b;var _0x5d05f7;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x42d8c9[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x420150,null))[_0x9ba7('0x20')](function(_0x2a6b33){if(_0x2a6b33){_0x21cd6b=_0x2a6b33;_0x231870[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')][_0x9ba7('0x27')]);_0x231870[_0x9ba7('0x2b')]=_['keys'](_0x42d8c9['query']);_0x231870[_0x9ba7('0x2d')]=_['intersection'](_0x231870[_0x9ba7('0x2a')],_0x231870[_0x9ba7('0x2b')]);_0x1b4ae6['attributes']=_['intersection'](_0x231870[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x42d8c9['query']['fields']));_0x1b4ae6[_0x9ba7('0x2f')]=_0x1b4ae6[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x1b4ae6[_0x9ba7('0x2f')]:_0x231870[_0x9ba7('0x2a')];_0x1b4ae6[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x42d8c9[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x1b4ae6['where']=qs['filters'](_[_0x9ba7('0x36')](_0x42d8c9[_0x9ba7('0x2b')],_0x231870[_0x9ba7('0x2d')]));if(_0x42d8c9[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x1b4ae6['where']=_[_0x9ba7('0x48')](_0x1b4ae6[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0x1b4ae6['attributes'],function(_0xc9eeb){var _0x55c6b3={};_0x55c6b3[_0xc9eeb]={'$like':'%'+_0x42d8c9['query'][_0x9ba7('0x37')]+'%'};return _0x55c6b3;})});}_0x1b4ae6=_['merge']({},_0x1b4ae6,_0x42d8c9[_0x9ba7('0x3a')]);return _0x21cd6b[_0x9ba7('0x49')](_0x1b4ae6);}})[_0x9ba7('0x20')](function(_0x471227){if(_0x471227){_0x5d05f7=_0x471227[_0x9ba7('0x42')];if(!_0x42d8c9[_0x9ba7('0x2b')]['hasOwnProperty'](_0x9ba7('0x32'))){_0x1b4ae6[_0x9ba7('0x1a')]=qs['limit'](_0x42d8c9['query'][_0x9ba7('0x1a')]);_0x1b4ae6['offset']=qs[_0x9ba7('0x18')](_0x42d8c9[_0x9ba7('0x2b')]['offset']);}return _0x21cd6b[_0x9ba7('0x49')](_0x1b4ae6);}})[_0x9ba7('0x20')](function(_0x1a17ed){if(_0x1a17ed){return _0x1a17ed?{'count':_0x5d05f7,'rows':_0x1a17ed}:null;}})[_0x9ba7('0x20')](respondWithResult(_0x420150,null))[_0x9ba7('0x3f')](handleError(_0x420150,null));};exports[_0x9ba7('0x4a')]=function(_0x3cc1c2,_0x37093f,_0x305dbe){var _0xb696df={};var _0x39b1a3={};var _0x316272;var _0x302bd4;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x3cc1c2['params']['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x37093f,null))[_0x9ba7('0x20')](function(_0x104b30){if(_0x104b30){_0x316272=_0x104b30;_0x39b1a3[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')]['rawAttributes']);_0x39b1a3['query']=_[_0x9ba7('0x2c')](_0x3cc1c2[_0x9ba7('0x2b')]);_0x39b1a3[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x39b1a3[_0x9ba7('0x2a')],_0x39b1a3[_0x9ba7('0x2b')]);_0xb696df['attributes']=_[_0x9ba7('0x2e')](_0x39b1a3[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0xb696df[_0x9ba7('0x2f')]=_0xb696df[_0x9ba7('0x2f')]['length']?_0xb696df['attributes']:_0x39b1a3['model'];_0xb696df[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0xb696df[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_[_0x9ba7('0x36')](_0x3cc1c2[_0x9ba7('0x2b')],_0x39b1a3['filters']));if(_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0xb696df['where']=_['merge'](_0xb696df[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0xb696df[_0x9ba7('0x2f')],function(_0x4981fe){var _0x1eecb3={};_0x1eecb3[_0x4981fe]={'$like':'%'+_0x3cc1c2[_0x9ba7('0x2b')]['filter']+'%'};return _0x1eecb3;})});}_0xb696df=_['merge']({},_0xb696df,_0x3cc1c2['options']);return _0x316272['getSubjects'](_0xb696df);}})['then'](function(_0x23951a){if(_0x23951a){_0x302bd4=_0x23951a[_0x9ba7('0x42')];if(!_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0xb696df[_0x9ba7('0x1a')]=qs[_0x9ba7('0x1a')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0xb696df[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x3cc1c2['query'][_0x9ba7('0x18')]);}return _0x316272[_0x9ba7('0x4a')](_0xb696df);}})[_0x9ba7('0x20')](function(_0x36e5d3){if(_0x36e5d3){return _0x36e5d3?{'count':_0x302bd4,'rows':_0x36e5d3}:null;}})['then'](respondWithResult(_0x37093f,null))[_0x9ba7('0x3f')](handleError(_0x37093f,null));};exports['getDescriptions']=function(_0x542f9b,_0x572582,_0x74d0b2){var _0x576499={};var _0x2ca222={};var _0x570d91;var _0x4a236b;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x542f9b['params']['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x572582,null))[_0x9ba7('0x20')](function(_0x432653){if(_0x432653){_0x570d91=_0x432653;_0x2ca222[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')][_0x9ba7('0x27')]);_0x2ca222['query']=_[_0x9ba7('0x2c')](_0x542f9b[_0x9ba7('0x2b')]);_0x2ca222[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x2ca222[_0x9ba7('0x2a')],_0x2ca222[_0x9ba7('0x2b')]);_0x576499[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x2ca222['model'],qs[_0x9ba7('0x30')](_0x542f9b[_0x9ba7('0x2b')]['fields']));_0x576499[_0x9ba7('0x2f')]=_0x576499['attributes'][_0x9ba7('0x42')]?_0x576499[_0x9ba7('0x2f')]:_0x2ca222[_0x9ba7('0x2a')];_0x576499[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x576499[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_['pick'](_0x542f9b['query'],_0x2ca222[_0x9ba7('0x2d')]));if(_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x576499['where']=_[_0x9ba7('0x48')](_0x576499[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0x576499[_0x9ba7('0x2f')],function(_0x4849b7){var _0xf27d0f={};_0xf27d0f[_0x4849b7]={'$like':'%'+_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0xf27d0f;})});}_0x576499=_[_0x9ba7('0x48')]({},_0x576499,_0x542f9b[_0x9ba7('0x3a')]);return _0x570d91[_0x9ba7('0x4b')](_0x576499);}})[_0x9ba7('0x20')](function(_0x39042b){if(_0x39042b){_0x4a236b=_0x39042b[_0x9ba7('0x42')];if(!_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0x576499[_0x9ba7('0x1a')]=qs['limit'](_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0x576499['offset']=qs['offset'](_0x542f9b[_0x9ba7('0x2b')]['offset']);}return _0x570d91[_0x9ba7('0x4b')](_0x576499);}})[_0x9ba7('0x20')](function(_0x368e31){if(_0x368e31){return _0x368e31?{'count':_0x4a236b,'rows':_0x368e31}:null;}})['then'](respondWithResult(_0x572582,null))[_0x9ba7('0x3f')](handleError(_0x572582,null));};exports[_0x9ba7('0x4c')]=function(_0x4b2ef9,_0x4deab8,_0x218afb){var _0x232173={};var _0x2852ce={};var _0x2c5869;var _0x14ab01;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x4b2ef9[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4deab8,null))[_0x9ba7('0x20')](function(_0x48598a){if(_0x48598a){_0x2c5869=_0x48598a;_0x2852ce['model']=_[_0x9ba7('0x2c')](db[_0x9ba7('0x4d')][_0x9ba7('0x27')]);_0x2852ce[_0x9ba7('0x2b')]=_[_0x9ba7('0x2c')](_0x4b2ef9[_0x9ba7('0x2b')]);_0x2852ce[_0x9ba7('0x2d')]=_['intersection'](_0x2852ce[_0x9ba7('0x2a')],_0x2852ce[_0x9ba7('0x2b')]);_0x232173[_0x9ba7('0x2f')]=_['intersection'](_0x2852ce[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0x232173[_0x9ba7('0x2f')]=_0x232173[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x232173['attributes']:_0x2852ce[_0x9ba7('0x2a')];_0x232173[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x232173['where']=qs['filters'](_[_0x9ba7('0x36')](_0x4b2ef9[_0x9ba7('0x2b')],_0x2852ce[_0x9ba7('0x2d')]));if(_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x232173[_0x9ba7('0x35')]=_[_0x9ba7('0x48')](_0x232173[_0x9ba7('0x35')],{'$or':_['map'](_0x232173[_0x9ba7('0x2f')],function(_0x1248b6){var _0x550f91={};_0x550f91[_0x1248b6]={'$like':'%'+_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0x550f91;})});}_0x232173=_[_0x9ba7('0x48')]({},_0x232173,_0x4b2ef9['options']);return _0x2c5869[_0x9ba7('0x4c')](_0x232173);}})[_0x9ba7('0x20')](function(_0x1009ff){if(_0x1009ff){_0x14ab01=_0x1009ff[_0x9ba7('0x42')];if(!_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0x232173[_0x9ba7('0x1a')]=qs[_0x9ba7('0x1a')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0x232173[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x18')]);}return _0x2c5869[_0x9ba7('0x4c')](_0x232173);}})['then'](function(_0x39c2ef){if(_0x39c2ef){return _0x39c2ef?{'count':_0x14ab01,'rows':_0x39c2ef}:null;}})['then'](respondWithResult(_0x4deab8,null))[_0x9ba7('0x3f')](handleError(_0x4deab8,null));};exports['setTags']=function(_0x28bf16,_0x4dfcad,_0x10bef1){if(_0x28bf16[_0x9ba7('0x45')]['id']){delete _0x28bf16['body']['id'];}return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x28bf16[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4dfcad,null))[_0x9ba7('0x20')](function(_0x1484e8){if(_0x1484e8){return _0x1484e8[_0x9ba7('0x4e')](_0x28bf16[_0x9ba7('0x45')][_0x9ba7('0x4f')]||[]);}return null;})[_0x9ba7('0x20')](respondWithResult(_0x4dfcad,null))[_0x9ba7('0x3f')](handleError(_0x4dfcad,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cb9f1b2..0124559 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 _0xfdb8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xfdb8,0x1bc));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8fdb('0x0'));var logger=require(_0x8fdb('0x1'))(_0x8fdb('0x2'));var moment=require(_0x8fdb('0x3'));var BPromise=require(_0x8fdb('0x4'));var rp=require(_0x8fdb('0x5'));var fs=require('fs');var path=require(_0x8fdb('0x6'));var rimraf=require(_0x8fdb('0x7'));var config=require('../../config/environment');var attributes=require(_0x8fdb('0x8'));module[_0x8fdb('0x9')]=function(_0x70bf42,_0x97df1e){return _0x70bf42[_0x8fdb('0xa')](_0x8fdb('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d28=['../../config/environment','exports','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9102a0,_0x521732){var _0x124e68=function(_0x473038){while(--_0x473038){_0x9102a0['push'](_0x9102a0['shift']());}};_0x124e68(++_0x521732);}(_0x4d28,0x121));var _0x84d2=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0x4d28[_0x3ae34a];return _0x4c9edc;};'use strict';var _=require(_0x84d2('0x0'));var util=require('util');var logger=require(_0x84d2('0x1'))(_0x84d2('0x2'));var moment=require(_0x84d2('0x3'));var BPromise=require(_0x84d2('0x4'));var rp=require(_0x84d2('0x5'));var fs=require('fs');var path=require(_0x84d2('0x6'));var rimraf=require(_0x84d2('0x7'));var config=require(_0x84d2('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x84d2('0x9')]=function(_0x3cc298,_0x371805){return _0x3cc298['define'](_0x84d2('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 e3b243b..f4d3fca 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 _0x1e14=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e14,0x176));var _0x41e1=function(_0x20a5cc,_0x22f8d5){_0x20a5cc=_0x20a5cc-0x0;var _0x1cae87=_0x1e14[_0x20a5cc];return _0x1cae87;};'use strict';var _=require(_0x41e1('0x0'));var util=require('util');var moment=require(_0x41e1('0x1'));var BPromise=require(_0x41e1('0x2'));var rs=require(_0x41e1('0x3'));var fs=require('fs');var Redis=require(_0x41e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41e1('0x5'));var logger=require(_0x41e1('0x6'))(_0x41e1('0x7'));var config=require(_0x41e1('0x8'));var jayson=require(_0x41e1('0x9'));var client=jayson[_0x41e1('0xa')][_0x41e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5040,_0x50a25b,_0x281e59){return new BPromise(function(_0x53508e,_0xabf9e8){return client['request'](_0x1d5040,_0x281e59)['then'](function(_0x49d07a){logger[_0x41e1('0xc')](_0x41e1('0xd'),_0x50a25b,_0x41e1('0xe'));logger[_0x41e1('0xf')](_0x41e1('0x10'),_0x50a25b,_0x41e1('0xe'),JSON['stringify'](_0x49d07a));if(_0x49d07a[_0x41e1('0x11')]){if(_0x49d07a[_0x41e1('0x11')][_0x41e1('0x12')]===0x1f4){logger[_0x41e1('0x11')](_0x41e1('0xd'),_0x50a25b,_0x49d07a[_0x41e1('0x11')][_0x41e1('0x13')]);return _0xabf9e8(_0x49d07a[_0x41e1('0x11')]['message']);}logger[_0x41e1('0x11')](_0x41e1('0xd'),_0x50a25b,_0x49d07a[_0x41e1('0x11')]['message']);return _0x53508e(_0x49d07a[_0x41e1('0x11')][_0x41e1('0x13')]);}else{logger[_0x41e1('0xc')](_0x41e1('0xd'),_0x50a25b,_0x41e1('0xe'));_0x53508e(_0x49d07a['result'][_0x41e1('0x13')]);}})['catch'](function(_0x58c4ca){logger[_0x41e1('0x11')](_0x41e1('0xd'),_0x50a25b,_0x58c4ca);_0xabf9e8(_0x58c4ca);});});} \ No newline at end of file +var _0x7205=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','bluebird','ioredis'];(function(_0x33f99e,_0x499209){var _0x19b1b4=function(_0x332461){while(--_0x332461){_0x33f99e['push'](_0x33f99e['shift']());}};_0x19b1b4(++_0x499209);}(_0x7205,0xed));var _0x5720=function(_0x348319,_0x8b6c89){_0x348319=_0x348319-0x0;var _0x47b9ed=_0x7205[_0x348319];return _0x47b9ed;};'use strict';var _=require('lodash');var util=require(_0x5720('0x0'));var moment=require('moment');var BPromise=require(_0x5720('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5720('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5720('0x3'));var logger=require('../../config/logger')(_0x5720('0x4'));var config=require(_0x5720('0x5'));var jayson=require(_0x5720('0x6'));var client=jayson[_0x5720('0x7')][_0x5720('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dae9c,_0x3d429d,_0x1a908a){return new BPromise(function(_0x40c717,_0x729579){return client[_0x5720('0x9')](_0x4dae9c,_0x1a908a)[_0x5720('0xa')](function(_0x18ec65){logger[_0x5720('0xb')](_0x5720('0xc'),_0x3d429d,'request\x20sent');logger[_0x5720('0xd')](_0x5720('0xe'),_0x3d429d,_0x5720('0xf'),JSON[_0x5720('0x10')](_0x18ec65));if(_0x18ec65[_0x5720('0x11')]){if(_0x18ec65[_0x5720('0x11')]['code']===0x1f4){logger[_0x5720('0x11')](_0x5720('0xc'),_0x3d429d,_0x18ec65['error'][_0x5720('0x12')]);return _0x729579(_0x18ec65[_0x5720('0x11')]['message']);}logger[_0x5720('0x11')](_0x5720('0xc'),_0x3d429d,_0x18ec65[_0x5720('0x11')]['message']);return _0x40c717(_0x18ec65['error'][_0x5720('0x12')]);}else{logger[_0x5720('0xb')](_0x5720('0xc'),_0x3d429d,_0x5720('0xf'));_0x40c717(_0x18ec65[_0x5720('0x13')]['message']);}})['catch'](function(_0x2d71ed){logger['error'](_0x5720('0xc'),_0x3d429d,_0x2d71ed);_0x729579(_0x2d71ed);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0680b59..b0457d3 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 _0x3047=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3047,0x132));var _0x7304=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3047[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7304('0x0'));var path=require(_0x7304('0x1'));var timeout=require(_0x7304('0x2'));var express=require(_0x7304('0x3'));var router=express['Router']();var fs_extra=require(_0x7304('0x4'));var auth=require(_0x7304('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7304('0x6'));var controller=require(_0x7304('0x7'));router['get']('/',auth[_0x7304('0x8')](),controller[_0x7304('0x9')]);router[_0x7304('0xa')](_0x7304('0xb'),auth['isAuthenticated'](),controller[_0x7304('0xc')]);router['post']('/',auth[_0x7304('0x8')](),controller[_0x7304('0xd')]);router[_0x7304('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7304('0xf')]);router[_0x7304('0x10')]('/:id',auth[_0x7304('0x8')](),controller[_0x7304('0x11')]);module[_0x7304('0x12')]=router; \ No newline at end of file +var _0x726d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x726d,0x11d));var _0xd726=function(_0x2f1f11,_0x2ebb8d){_0x2f1f11=_0x2f1f11-0x0;var _0xb0ccd5=_0x726d[_0x2f1f11];return _0xb0ccd5;};'use strict';var multer=require(_0xd726('0x0'));var util=require(_0xd726('0x1'));var path=require(_0xd726('0x2'));var timeout=require(_0xd726('0x3'));var express=require(_0xd726('0x4'));var router=express[_0xd726('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd726('0x6'));var interaction=require(_0xd726('0x7'));var config=require('../../config/environment');var controller=require(_0xd726('0x8'));router[_0xd726('0x9')]('/',auth[_0xd726('0xa')](),controller['index']);router[_0xd726('0x9')]('/:id',auth[_0xd726('0xa')](),controller[_0xd726('0xb')]);router[_0xd726('0xc')]('/',auth[_0xd726('0xa')](),controller['create']);router[_0xd726('0xd')](_0xd726('0xe'),auth[_0xd726('0xa')](),controller[_0xd726('0xf')]);router[_0xd726('0x10')](_0xd726('0xe'),auth[_0xd726('0xa')](),controller[_0xd726('0x11')]);module[_0xd726('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 773d289..6493f2c 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 _0xcdae=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0x11d97c,_0x148520){var _0x5438b2=function(_0x2d828a){while(--_0x2d828a){_0x11d97c['push'](_0x11d97c['shift']());}};_0x5438b2(++_0x148520);}(_0xcdae,0x117));var _0xecda=function(_0x6cd6ca,_0x216fb1){_0x6cd6ca=_0x6cd6ca-0x0;var _0x2d2aa7=_0xcdae[_0x6cd6ca];return _0x2d2aa7;};'use strict';var Sequelize=require('sequelize');module[_0xecda('0x0')]={'type':{'type':Sequelize[_0xecda('0x1')](_0xecda('0x2'),_0xecda('0x3'),_0xecda('0x4'),_0xecda('0x5'),_0xecda('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xecda('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xecda('0x1')]('string',_0xecda('0x3'),_0xecda('0x4'))},'keyContent':{'type':Sequelize[_0xecda('0x7')]},'idField':{'type':Sequelize[_0xecda('0x7')]},'nameField':{'type':Sequelize[_0xecda('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xecda('0x7')]}}; \ No newline at end of file +var _0x3e1f=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x55fb72,_0x29973d){var _0x24b4d0=function(_0x8179f8){while(--_0x8179f8){_0x55fb72['push'](_0x55fb72['shift']());}};_0x24b4d0(++_0x29973d);}(_0x3e1f,0x163));var _0xf3e1=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x3e1f[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require(_0xf3e1('0x0'));module[_0xf3e1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf3e1('0x2'),_0xf3e1('0x3'),_0xf3e1('0x4'),_0xf3e1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf3e1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf3e1('0x7')]('string','variable',_0xf3e1('0x3'))},'keyContent':{'type':Sequelize[_0xf3e1('0x6')]},'idField':{'type':Sequelize[_0xf3e1('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf3e1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f4f8e94..a595db9 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 _0x19ea=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','include','findAll','catch','show','fields','includeAll','merge','find','create','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19ea,0xfe));var _0xa19e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x19ea[_0x2cfb58];return _0xd99951;};'use strict';var emlformat=require(_0xa19e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa19e('0x1'));var rp=require('request-promise');var moment=require(_0xa19e('0x2'));var BPromise=require(_0xa19e('0x3'));var Mustache=require(_0xa19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa19e('0x5'));var csv=require(_0xa19e('0x6'));var ejs=require(_0xa19e('0x7'));var fs=require('fs');var fs_extra=require(_0xa19e('0x8'));var _=require(_0xa19e('0x9'));var squel=require(_0xa19e('0xa'));var crypto=require(_0xa19e('0xb'));var jsforce=require(_0xa19e('0xc'));var deskjs=require(_0xa19e('0xd'));var toCsv=require(_0xa19e('0x6'));var querystring=require(_0xa19e('0xe'));var Papa=require('papaparse');var Redis=require(_0xa19e('0xf'));var authService=require(_0xa19e('0x10'));var qs=require(_0xa19e('0x11'));var as=require(_0xa19e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19e('0x13'))(_0xa19e('0x14'));var utils=require(_0xa19e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa19e('0x16'));var db=require(_0xa19e('0x17'))['db'];function respondWithStatusCode(_0xc781a2,_0x1bd1f5){_0x1bd1f5=_0x1bd1f5||0xcc;return function(_0x35ca5b){if(_0x35ca5b){return _0xc781a2['sendStatus'](_0x1bd1f5);}return _0xc781a2[_0xa19e('0x18')](_0x1bd1f5)[_0xa19e('0x19')]();};}function respondWithResult(_0xa7e0c4,_0x28dedd){_0x28dedd=_0x28dedd||0xc8;return function(_0x564d2a){if(_0x564d2a){return _0xa7e0c4[_0xa19e('0x18')](_0x28dedd)[_0xa19e('0x1a')](_0x564d2a);}};}function respondWithFilteredResult(_0x245bcb,_0x3be281){return function(_0x1fdea2){if(_0x1fdea2){var _0x2598f5=typeof _0x3be281['offset']===_0xa19e('0x1b')&&typeof _0x3be281[_0xa19e('0x1c')]===_0xa19e('0x1b');var _0x256819=_0x1fdea2[_0xa19e('0x1d')];var _0x38e398=_0x2598f5?0x0:_0x3be281[_0xa19e('0x1e')];var _0x530a75=_0x2598f5?_0x1fdea2[_0xa19e('0x1d')]:_0x3be281['offset']+_0x3be281[_0xa19e('0x1c')];var _0x5d05fd;if(_0x530a75>=_0x256819){_0x530a75=_0x256819;_0x5d05fd=0xc8;}else{_0x5d05fd=0xce;}_0x245bcb['status'](_0x5d05fd);return _0x245bcb[_0xa19e('0x1f')](_0xa19e('0x20'),_0x38e398+'-'+_0x530a75+'/'+_0x256819)['json'](_0x1fdea2);}return null;};}function patchUpdates(_0x1cb9f9){return function(_0x3f2060){try{jsonpatch[_0xa19e('0x21')](_0x3f2060,_0x1cb9f9,!![]);}catch(_0x93eb86){return BPromise['reject'](_0x93eb86);}return _0x3f2060[_0xa19e('0x22')]();};}function saveUpdates(_0x33b588,_0x105874){return function(_0x301f6d){if(_0x301f6d){return _0x301f6d[_0xa19e('0x23')](_0x33b588)[_0xa19e('0x24')](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x20a649,_0xc16a44){return function(_0x536386){if(_0x536386){return _0x536386[_0xa19e('0x25')]()[_0xa19e('0x24')](function(){_0x20a649['status'](0xcc)[_0xa19e('0x19')]();});}};}function handleEntityNotFound(_0x1d3ce6,_0x4e06b8){return function(_0x20b05c){if(!_0x20b05c){_0x1d3ce6[_0xa19e('0x26')](0x194);}return _0x20b05c;};}function handleError(_0x5d5559,_0x40dc1c){_0x40dc1c=_0x40dc1c||0x1f4;return function(_0x10682d){logger[_0xa19e('0x27')](_0x10682d[_0xa19e('0x28')]);if(_0x10682d[_0xa19e('0x29')]){delete _0x10682d[_0xa19e('0x29')];}_0x5d5559[_0xa19e('0x18')](_0x40dc1c)[_0xa19e('0x2a')](_0x10682d);};}exports[_0xa19e('0x2b')]=function(_0x24dd51,_0x30e490){var _0x3d1cae={},_0x1ce643={},_0x475a26={'count':0x0,'rows':[]};var _0xdf0b20=_[_0xa19e('0x2c')](db[_0xa19e('0x2d')][_0xa19e('0x2e')],function(_0x3dcd74){return{'name':_0x3dcd74[_0xa19e('0x2f')],'type':_0x3dcd74['type'][_0xa19e('0x30')]};});_0x1ce643[_0xa19e('0x31')]=_[_0xa19e('0x2c')](_0xdf0b20,_0xa19e('0x29'));_0x1ce643[_0xa19e('0x32')]=_[_0xa19e('0x33')](_0x24dd51['query']);_0x1ce643[_0xa19e('0x34')]=_[_0xa19e('0x35')](_0x1ce643['model'],_0x1ce643[_0xa19e('0x32')]);_0x3d1cae['attributes']=_['intersection'](_0x1ce643[_0xa19e('0x31')],qs['fields'](_0x24dd51['query']['fields']));_0x3d1cae[_0xa19e('0x36')]=_0x3d1cae[_0xa19e('0x36')][_0xa19e('0x37')]?_0x3d1cae['attributes']:_0x1ce643[_0xa19e('0x31')];if(!_0x24dd51[_0xa19e('0x32')][_0xa19e('0x38')](_0xa19e('0x39'))){_0x3d1cae[_0xa19e('0x1c')]=qs[_0xa19e('0x1c')](_0x24dd51['query'][_0xa19e('0x1c')]);_0x3d1cae[_0xa19e('0x1e')]=qs['offset'](_0x24dd51[_0xa19e('0x32')][_0xa19e('0x1e')]);}_0x3d1cae[_0xa19e('0x3a')]=qs['sort'](_0x24dd51['query'][_0xa19e('0x3b')]);_0x3d1cae['where']=qs[_0xa19e('0x34')](_[_0xa19e('0x3c')](_0x24dd51[_0xa19e('0x32')],_0x1ce643[_0xa19e('0x34')]),_0xdf0b20);if(_0x24dd51['query'][_0xa19e('0x3d')]){_0x3d1cae[_0xa19e('0x3e')]=_['merge'](_0x3d1cae[_0xa19e('0x3e')],{'$or':_['map'](_0xdf0b20,function(_0x374201){if(_0x374201[_0xa19e('0x3f')]!==_0xa19e('0x40')){var _0x5ed1ce={};_0x5ed1ce[_0x374201[_0xa19e('0x29')]]={'$like':'%'+_0x24dd51[_0xa19e('0x32')][_0xa19e('0x3d')]+'%'};return _0x5ed1ce;}})});}_0x3d1cae=_['merge']({},_0x3d1cae,_0x24dd51[_0xa19e('0x41')]);var _0x244ee5={'where':_0x3d1cae['where']};return db['FreshdeskField'][_0xa19e('0x1d')](_0x244ee5)[_0xa19e('0x24')](function(_0x5dd159){_0x475a26[_0xa19e('0x1d')]=_0x5dd159;if(_0x24dd51[_0xa19e('0x32')]['includeAll']){_0x3d1cae[_0xa19e('0x42')]=[{'all':!![]}];}return db[_0xa19e('0x2d')][_0xa19e('0x43')](_0x3d1cae);})[_0xa19e('0x24')](function(_0x30fdfb){_0x475a26['rows']=_0x30fdfb;return _0x475a26;})[_0xa19e('0x24')](respondWithFilteredResult(_0x30e490,_0x3d1cae))[_0xa19e('0x44')](handleError(_0x30e490,null));};exports[_0xa19e('0x45')]=function(_0x29d254,_0x124e8c){var _0x51f0f4={'raw':!![],'where':{'id':_0x29d254['params']['id']}},_0x315341={};_0x315341[_0xa19e('0x31')]=_[_0xa19e('0x33')](db['FreshdeskField'][_0xa19e('0x2e')]);_0x315341[_0xa19e('0x32')]=_['keys'](_0x29d254[_0xa19e('0x32')]);_0x315341['filters']=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],_0x315341[_0xa19e('0x32')]);_0x51f0f4[_0xa19e('0x36')]=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],qs[_0xa19e('0x46')](_0x29d254[_0xa19e('0x32')]['fields']));_0x51f0f4[_0xa19e('0x36')]=_0x51f0f4[_0xa19e('0x36')]['length']?_0x51f0f4['attributes']:_0x315341[_0xa19e('0x31')];if(_0x29d254[_0xa19e('0x32')][_0xa19e('0x47')]){_0x51f0f4['include']=[{'all':!![]}];}_0x51f0f4=_[_0xa19e('0x48')]({},_0x51f0f4,_0x29d254[_0xa19e('0x41')]);return db['FreshdeskField'][_0xa19e('0x49')](_0x51f0f4)[_0xa19e('0x24')](handleEntityNotFound(_0x124e8c,null))[_0xa19e('0x24')](respondWithResult(_0x124e8c,null))['catch'](handleError(_0x124e8c,null));};exports[_0xa19e('0x4a')]=function(_0x52cf31,_0x349543){return db[_0xa19e('0x2d')][_0xa19e('0x4a')](_0x52cf31[_0xa19e('0x4b')],{})[_0xa19e('0x24')](respondWithResult(_0x349543,0xc9))['catch'](handleError(_0x349543,null));};exports[_0xa19e('0x23')]=function(_0x4c90fe,_0x4779d8){if(_0x4c90fe['body']['id']){delete _0x4c90fe[_0xa19e('0x4b')]['id'];}return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x4c90fe[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4779d8,null))[_0xa19e('0x24')](saveUpdates(_0x4c90fe[_0xa19e('0x4b')],null))[_0xa19e('0x24')](respondWithResult(_0x4779d8,null))[_0xa19e('0x44')](handleError(_0x4779d8,null));};exports['destroy']=function(_0x454c9f,_0x5ae431){return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x454c9f[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ae431,null))[_0xa19e('0x24')](removeEntity(_0x5ae431,null))[_0xa19e('0x44')](handleError(_0x5ae431,null));}; \ No newline at end of file +var _0xa25c=['map','FreshdeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x1bad8e,_0xa192b3){var _0xb75632=function(_0x254afc){while(--_0x254afc){_0x1bad8e['push'](_0x1bad8e['shift']());}};_0xb75632(++_0xa192b3);}(_0xa25c,0x13f));var _0xca25=function(_0x42749b,_0x16a7ba){_0x42749b=_0x42749b-0x0;var _0x19db46=_0xa25c[_0x42749b];return _0x19db46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={},_0x7b67f4={},_0x190f27={'count':0x0,'rows':[]};var _0x315f76=_[_0xca25('0x29')](db[_0xca25('0x2a')][_0xca25('0x2b')],function(_0x2433bb){return{'name':_0x2433bb[_0xca25('0x2c')],'type':_0x2433bb[_0xca25('0x2d')]['key']};});_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x29')](_0x315f76,_0xca25('0x26'));_0x7b67f4['query']=_[_0xca25('0x2f')](_0xfd888c[_0xca25('0x30')]);_0x7b67f4[_0xca25('0x31')]=_[_0xca25('0x32')](_0x7b67f4[_0xca25('0x2e')],_0x7b67f4[_0xca25('0x30')]);_0x3e72cb['attributes']=_[_0xca25('0x32')](_0x7b67f4['model'],qs[_0xca25('0x33')](_0xfd888c[_0xca25('0x30')][_0xca25('0x33')]));_0x3e72cb['attributes']=_0x3e72cb[_0xca25('0x34')][_0xca25('0x35')]?_0x3e72cb[_0xca25('0x34')]:_0x7b67f4[_0xca25('0x2e')];if(!_0xfd888c[_0xca25('0x30')]['hasOwnProperty'](_0xca25('0x36'))){_0x3e72cb[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0xfd888c[_0xca25('0x30')][_0xca25('0x1a')]);_0x3e72cb[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0xfd888c['query']['offset']);}_0x3e72cb[_0xca25('0x37')]=qs[_0xca25('0x38')](_0xfd888c['query']['sort']);_0x3e72cb[_0xca25('0x39')]=qs[_0xca25('0x31')](_[_0xca25('0x3a')](_0xfd888c['query'],_0x7b67f4[_0xca25('0x31')]),_0x315f76);if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]){_0x3e72cb[_0xca25('0x39')]=_[_0xca25('0x3c')](_0x3e72cb[_0xca25('0x39')],{'$or':_['map'](_0x315f76,function(_0x290537){if(_0x290537['type']!==_0xca25('0x3d')){var _0x25880f={};_0x25880f[_0x290537[_0xca25('0x26')]]={'$like':'%'+_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]+'%'};return _0x25880f;}})});}_0x3e72cb=_[_0xca25('0x3c')]({},_0x3e72cb,_0xfd888c[_0xca25('0x3e')]);var _0x19984f={'where':_0x3e72cb[_0xca25('0x39')]};return db['FreshdeskField'][_0xca25('0x1b')](_0x19984f)['then'](function(_0x2d6f27){_0x190f27['count']=_0x2d6f27;if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3f')]){_0x3e72cb[_0xca25('0x40')]=[{'all':!![]}];}return db[_0xca25('0x2a')]['findAll'](_0x3e72cb);})[_0xca25('0x22')](function(_0x5aafa5){_0x190f27[_0xca25('0x41')]=_0x5aafa5;return _0x190f27;})[_0xca25('0x22')](respondWithFilteredResult(_0x1660a5,_0x3e72cb))['catch'](handleError(_0x1660a5,null));};exports[_0xca25('0x42')]=function(_0x183135,_0x52799a){var _0x2ff9c2={'raw':!![],'where':{'id':_0x183135[_0xca25('0x43')]['id']}},_0x1068c9={};_0x1068c9[_0xca25('0x2e')]=_['keys'](db[_0xca25('0x2a')][_0xca25('0x2b')]);_0x1068c9['query']=_['keys'](_0x183135['query']);_0x1068c9['filters']=_[_0xca25('0x32')](_0x1068c9[_0xca25('0x2e')],_0x1068c9[_0xca25('0x30')]);_0x2ff9c2[_0xca25('0x34')]=_['intersection'](_0x1068c9[_0xca25('0x2e')],qs[_0xca25('0x33')](_0x183135[_0xca25('0x30')][_0xca25('0x33')]));_0x2ff9c2['attributes']=_0x2ff9c2[_0xca25('0x34')]['length']?_0x2ff9c2[_0xca25('0x34')]:_0x1068c9[_0xca25('0x2e')];if(_0x183135[_0xca25('0x30')][_0xca25('0x3f')]){_0x2ff9c2[_0xca25('0x40')]=[{'all':!![]}];}_0x2ff9c2=_[_0xca25('0x3c')]({},_0x2ff9c2,_0x183135['options']);return db[_0xca25('0x2a')][_0xca25('0x44')](_0x2ff9c2)[_0xca25('0x22')](handleEntityNotFound(_0x52799a,null))[_0xca25('0x22')](respondWithResult(_0x52799a,null))[_0xca25('0x45')](handleError(_0x52799a,null));};exports[_0xca25('0x46')]=function(_0x1ad2d0,_0x352a17){return db[_0xca25('0x2a')][_0xca25('0x46')](_0x1ad2d0[_0xca25('0x47')],{})[_0xca25('0x22')](respondWithResult(_0x352a17,0xc9))[_0xca25('0x45')](handleError(_0x352a17,null));};exports[_0xca25('0x21')]=function(_0x3279e0,_0x1fba32){if(_0x3279e0[_0xca25('0x47')]['id']){delete _0x3279e0[_0xca25('0x47')]['id'];}return db['FreshdeskField'][_0xca25('0x44')]({'where':{'id':_0x3279e0[_0xca25('0x43')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1fba32,null))[_0xca25('0x22')](saveUpdates(_0x3279e0['body'],null))[_0xca25('0x22')](respondWithResult(_0x1fba32,null))[_0xca25('0x45')](handleError(_0x1fba32,null));};exports['destroy']=function(_0x2bc528,_0x10692f){return db[_0xca25('0x2a')][_0xca25('0x44')]({'where':{'id':_0x2bc528['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x10692f,null))['then'](removeEntity(_0x10692f,null))[_0xca25('0x45')](handleError(_0x10692f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f26c3c0..cfa6e66 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 _0x6ec0=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x22219e,_0x5c9340){var _0x4f7138=function(_0x407932){while(--_0x407932){_0x22219e['push'](_0x22219e['shift']());}};_0x4f7138(++_0x5c9340);}(_0x6ec0,0x9f));var _0x06ec=function(_0x430f53,_0x47ec74){_0x430f53=_0x430f53-0x0;var _0x179ebd=_0x6ec0[_0x430f53];return _0x179ebd;};'use strict';var _=require(_0x06ec('0x0'));var util=require('util');var logger=require(_0x06ec('0x1'))(_0x06ec('0x2'));var moment=require(_0x06ec('0x3'));var BPromise=require(_0x06ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06ec('0x5'));var rimraf=require(_0x06ec('0x6'));var config=require(_0x06ec('0x7'));var attributes=require(_0x06ec('0x8'));module['exports']=function(_0x464b74,_0x7318ad){return _0x464b74[_0x06ec('0x9')](_0x06ec('0xa'),attributes,{'tableName':_0x06ec('0xb'),'paranoid':![],'indexes':[{'name':_0x06ec('0xc'),'fields':['idField',_0x06ec('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4559=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x594f2e,_0x2023e4){var _0x2ea839=function(_0x3b7473){while(--_0x3b7473){_0x594f2e['push'](_0x594f2e['shift']());}};_0x2ea839(++_0x2023e4);}(_0x4559,0xfe));var _0x9455=function(_0x53b398,_0x39bfd8){_0x53b398=_0x53b398-0x0;var _0x32c9ed=_0x4559[_0x53b398];return _0x32c9ed;};'use strict';var _=require(_0x9455('0x0'));var util=require('util');var logger=require(_0x9455('0x1'))(_0x9455('0x2'));var moment=require(_0x9455('0x3'));var BPromise=require(_0x9455('0x4'));var rp=require(_0x9455('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9455('0x6'));var config=require(_0x9455('0x7'));var attributes=require(_0x9455('0x8'));module[_0x9455('0x9')]=function(_0x3efe24,_0x7f3018){return _0x3efe24[_0x9455('0xa')](_0x9455('0xb'),attributes,{'tableName':_0x9455('0xc'),'paranoid':![],'indexes':[{'name':_0x9455('0xd'),'fields':['idField',_0x9455('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index f644501..c907911 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 _0x3a27=['../../mysqldb','../../config/utils','rpc','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ec515,_0x112725){var _0x110911=function(_0x2b2071){while(--_0x2b2071){_0x3ec515['push'](_0x3ec515['shift']());}};_0x110911(++_0x112725);}(_0x3a27,0x19c));var _0x73a2=function(_0x4d8fe1,_0x12f428){_0x4d8fe1=_0x4d8fe1-0x0;var _0x44d5b2=_0x3a27[_0x4d8fe1];return _0x44d5b2;};'use strict';var _=require(_0x73a2('0x0'));var util=require(_0x73a2('0x1'));var moment=require(_0x73a2('0x2'));var BPromise=require(_0x73a2('0x3'));var rs=require(_0x73a2('0x4'));var fs=require('fs');var Redis=require(_0x73a2('0x5'));var db=require(_0x73a2('0x6'))['db'];var utils=require(_0x73a2('0x7'));var logger=require('../../config/logger')(_0x73a2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x73a2('0x9')][_0x73a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd7a008,_0x4b0be8,_0x589520){return new BPromise(function(_0x44b2ba,_0x1fe111){return client[_0x73a2('0xb')](_0xd7a008,_0x589520)[_0x73a2('0xc')](function(_0x32a9c5){logger[_0x73a2('0xd')](_0x73a2('0xe'),_0x4b0be8,_0x73a2('0xf'));logger[_0x73a2('0x10')](_0x73a2('0x11'),_0x4b0be8,'request\x20sent',JSON[_0x73a2('0x12')](_0x32a9c5));if(_0x32a9c5['error']){if(_0x32a9c5[_0x73a2('0x13')]['code']===0x1f4){logger[_0x73a2('0x13')](_0x73a2('0xe'),_0x4b0be8,_0x32a9c5[_0x73a2('0x13')][_0x73a2('0x14')]);return _0x1fe111(_0x32a9c5[_0x73a2('0x13')][_0x73a2('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4b0be8,_0x32a9c5['error'][_0x73a2('0x14')]);return _0x44b2ba(_0x32a9c5['error']['message']);}else{logger[_0x73a2('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x4b0be8,_0x73a2('0xf'));_0x44b2ba(_0x32a9c5['result']['message']);}})[_0x73a2('0x15')](function(_0x158fd5){logger[_0x73a2('0x13')](_0x73a2('0xe'),_0x4b0be8,_0x158fd5);_0x1fe111(_0x158fd5);});});} \ No newline at end of file +var _0x42fc=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0xbaf0a2,_0x535c10){var _0x3dbe0a=function(_0x16fb09){while(--_0x16fb09){_0xbaf0a2['push'](_0xbaf0a2['shift']());}};_0x3dbe0a(++_0x535c10);}(_0x42fc,0xa9));var _0xc42f=function(_0x405cac,_0x39f2d7){_0x405cac=_0x405cac-0x0;var _0x670644=_0x42fc[_0x405cac];return _0x670644;};'use strict';var _=require(_0xc42f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc42f('0x1'));var rs=require(_0xc42f('0x2'));var fs=require('fs');var Redis=require(_0xc42f('0x3'));var db=require(_0xc42f('0x4'))['db'];var utils=require(_0xc42f('0x5'));var logger=require(_0xc42f('0x6'))('rpc');var config=require(_0xc42f('0x7'));var jayson=require(_0xc42f('0x8'));var client=jayson[_0xc42f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc39c40,_0x2771e2,_0x43b419){return new BPromise(function(_0x5f1bcc,_0xd1819c){return client[_0xc42f('0xa')](_0xc39c40,_0x43b419)[_0xc42f('0xb')](function(_0x4ba56e){logger[_0xc42f('0xc')](_0xc42f('0xd'),_0x2771e2,'request\x20sent');logger['debug'](_0xc42f('0xe'),_0x2771e2,'request\x20sent',JSON[_0xc42f('0xf')](_0x4ba56e));if(_0x4ba56e['error']){if(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x11')]===0x1f4){logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x4ba56e['error'][_0xc42f('0x12')]);return _0xd1819c(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x12')]);}logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x4ba56e['error'][_0xc42f('0x12')]);return _0x5f1bcc(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x12')]);}else{logger[_0xc42f('0xc')](_0xc42f('0xd'),_0x2771e2,_0xc42f('0x13'));_0x5f1bcc(_0x4ba56e[_0xc42f('0x14')]['message']);}})['catch'](function(_0x280686){logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x280686);_0xd1819c(_0x280686);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2c4cc78..d21c66c 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','destroy','path','connect-timeout','express','fs-extra'];(function(_0x2b147f,_0x1b3adc){var _0x44d217=function(_0x479d59){while(--_0x479d59){_0x2b147f['push'](_0x2b147f['shift']());}};_0x44d217(++_0x1b3adc);}(_0x4522,0x1a0));var _0x2452=function(_0x11d104,_0xbfcc3e){_0x11d104=_0x11d104-0x0;var _0x205fc4=_0x4522[_0x11d104];return _0x205fc4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['get']('/:id/fields',auth[_0x2452('0x9')](),controller['getFields']);router['post']('/',auth[_0x2452('0x9')](),controller[_0x2452('0xf')]);router[_0x2452('0x10')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x11')]);router[_0x2452('0x12')](_0x2452('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2452('0xb'),auth['isAuthenticated'](),controller[_0x2452('0x13')]);module['exports']=router; \ No newline at end of file +var _0x76dc=['../../components/interaction/service','get','isAuthenticated','index','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x4303fa,_0x5531b1){var _0x3e2780=function(_0x3c1db6){while(--_0x3c1db6){_0x4303fa['push'](_0x4303fa['shift']());}};_0x3e2780(++_0x5531b1);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2b9dd3,_0x547a88){_0x2b9dd3=_0x2b9dd3-0x0;var _0x1036db=_0x76dc[_0x2b9dd3];return _0x1036db;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var fs_extra=require(_0xc76d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc76d('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xc76d('0x7')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['get']('/:id',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc76d('0xb')]);router[_0xc76d('0x7')]('/:id/fields',auth[_0xc76d('0x8')](),controller['getFields']);router[_0xc76d('0xc')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0xd')]);router[_0xc76d('0xc')](_0xc76d('0xe'),auth[_0xc76d('0x8')](),controller[_0xc76d('0xf')]);router[_0xc76d('0x10')](_0xc76d('0x11'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x12')]);router[_0xc76d('0x13')](_0xc76d('0x11'),auth[_0xc76d('0x8')](),controller['destroy']);module[_0xc76d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 02bd2ff..fd08e39 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 _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf2e3[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x17aa5b,_0x3cd9c3){var _0x28bd36=function(_0x3230d4){while(--_0x3230d4){_0x17aa5b['push'](_0x17aa5b['shift']());}};_0x28bd36(++_0x3cd9c3);}(_0x4213,0x77));var _0x3421=function(_0x30813a,_0x5bb99b){_0x30813a=_0x30813a-0x0;var _0x4e9370=_0x4213[_0x30813a];return _0x4e9370;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5d8e80b..a20b2f3 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 _0xafdf=['bluebird','util','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','length','find','catch','create','body','getConfigurations','findOne','params','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','Descriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','substring','GET','%s%s','/api/selector/owners','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xafdf,0x1a6));var _0xfafd=function(_0x1686a4,_0x354468){_0x1686a4=_0x1686a4-0x0;var _0x28abfa=_0xafdf[_0x1686a4];return _0x28abfa;};'use strict';var emlformat=require(_0xfafd('0x0'));var rimraf=require(_0xfafd('0x1'));var zipdir=require(_0xfafd('0x2'));var jsonpatch=require(_0xfafd('0x3'));var rp=require(_0xfafd('0x4'));var moment=require(_0xfafd('0x5'));var BPromise=require(_0xfafd('0x6'));var Mustache=require('mustache');var util=require(_0xfafd('0x7'));var path=require(_0xfafd('0x8'));var sox=require('sox');var csv=require(_0xfafd('0x9'));var ejs=require(_0xfafd('0xa'));var fs=require('fs');var fs_extra=require(_0xfafd('0xb'));var _=require(_0xfafd('0xc'));var squel=require(_0xfafd('0xd'));var crypto=require(_0xfafd('0xe'));var jsforce=require(_0xfafd('0xf'));var deskjs=require(_0xfafd('0x10'));var toCsv=require(_0xfafd('0x9'));var querystring=require('querystring');var Papa=require(_0xfafd('0x11'));var Redis=require(_0xfafd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfafd('0x13'));var as=require(_0xfafd('0x14'));var hardwareService=require(_0xfafd('0x15'));var logger=require(_0xfafd('0x16'))(_0xfafd('0x17'));var utils=require(_0xfafd('0x18'));var config=require(_0xfafd('0x19'));var licenseUtil=require(_0xfafd('0x1a'));var db=require(_0xfafd('0x1b'))['db'];var integrations=require(_0xfafd('0x1c'));function respondWithStatusCode(_0x49d548,_0x5a933c){_0x5a933c=_0x5a933c||0xcc;return function(_0x11f5f0){if(_0x11f5f0){return _0x49d548[_0xfafd('0x1d')](_0x5a933c);}return _0x49d548[_0xfafd('0x1e')](_0x5a933c)[_0xfafd('0x1f')]();};}function respondWithResult(_0x2a27e1,_0x558fab){_0x558fab=_0x558fab||0xc8;return function(_0x1ff6c8){if(_0x1ff6c8){return _0x2a27e1[_0xfafd('0x1e')](_0x558fab)[_0xfafd('0x20')](_0x1ff6c8);}};}function respondWithFilteredResult(_0x10f40a,_0xcc885e){return function(_0x587cf5){if(_0x587cf5){var _0x5221e2=typeof _0xcc885e[_0xfafd('0x21')]===_0xfafd('0x22')&&typeof _0xcc885e[_0xfafd('0x23')]===_0xfafd('0x22');var _0x4011b4=_0x587cf5[_0xfafd('0x24')];var _0x1f9ad7=_0x5221e2?0x0:_0xcc885e[_0xfafd('0x21')];var _0xd5682e=_0x5221e2?_0x587cf5[_0xfafd('0x24')]:_0xcc885e[_0xfafd('0x21')]+_0xcc885e[_0xfafd('0x23')];var _0x1762b4;if(_0xd5682e>=_0x4011b4){_0xd5682e=_0x4011b4;_0x1762b4=0xc8;}else{_0x1762b4=0xce;}_0x10f40a[_0xfafd('0x1e')](_0x1762b4);return _0x10f40a[_0xfafd('0x25')](_0xfafd('0x26'),_0x1f9ad7+'-'+_0xd5682e+'/'+_0x4011b4)[_0xfafd('0x20')](_0x587cf5);}return null;};}function patchUpdates(_0x346db0){return function(_0x539db9){try{jsonpatch['apply'](_0x539db9,_0x346db0,!![]);}catch(_0x245785){return BPromise[_0xfafd('0x27')](_0x245785);}return _0x539db9[_0xfafd('0x28')]();};}function saveUpdates(_0x16c176,_0x36a569){return function(_0x4058fc){if(_0x4058fc){return _0x4058fc[_0xfafd('0x29')](_0x16c176)['then'](function(_0x149b34){return _0x149b34;});}return null;};}function removeEntity(_0x32f387,_0x289a4f){return function(_0x294e42){if(_0x294e42){return _0x294e42[_0xfafd('0x2a')]()[_0xfafd('0x2b')](function(){_0x32f387[_0xfafd('0x1e')](0xcc)[_0xfafd('0x1f')]();});}};}function handleEntityNotFound(_0x52f56e,_0x12810d){return function(_0x476e7c){if(!_0x476e7c){_0x52f56e['sendStatus'](0x194);}return _0x476e7c;};}function handleError(_0xc0f3d9,_0x4896cf){_0x4896cf=_0x4896cf||0x1f4;return function(_0x3e6f10){logger[_0xfafd('0x2c')](_0x3e6f10[_0xfafd('0x2d')]);if(_0x3e6f10['name']){delete _0x3e6f10[_0xfafd('0x2e')];}_0xc0f3d9[_0xfafd('0x1e')](_0x4896cf)[_0xfafd('0x2f')](_0x3e6f10);};}exports[_0xfafd('0x30')]=function(_0x1825f6,_0x26ee37){var _0x23f78={},_0x26e96c={},_0x93a862={'count':0x0,'rows':[]};var _0x54facb=_[_0xfafd('0x31')](db[_0xfafd('0x32')][_0xfafd('0x33')],function(_0x37e162){return{'name':_0x37e162[_0xfafd('0x34')],'type':_0x37e162[_0xfafd('0x35')][_0xfafd('0x36')]};});_0x26e96c[_0xfafd('0x37')]=_[_0xfafd('0x31')](_0x54facb,_0xfafd('0x2e'));_0x26e96c[_0xfafd('0x38')]=_['keys'](_0x1825f6['query']);_0x26e96c['filters']=_[_0xfafd('0x39')](_0x26e96c[_0xfafd('0x37')],_0x26e96c[_0xfafd('0x38')]);_0x23f78[_0xfafd('0x3a')]=_[_0xfafd('0x39')](_0x26e96c[_0xfafd('0x37')],qs[_0xfafd('0x3b')](_0x1825f6[_0xfafd('0x38')][_0xfafd('0x3b')]));_0x23f78['attributes']=_0x23f78[_0xfafd('0x3a')]['length']?_0x23f78['attributes']:_0x26e96c['model'];if(!_0x1825f6['query'][_0xfafd('0x3c')](_0xfafd('0x3d'))){_0x23f78[_0xfafd('0x23')]=qs[_0xfafd('0x23')](_0x1825f6['query'][_0xfafd('0x23')]);_0x23f78[_0xfafd('0x21')]=qs[_0xfafd('0x21')](_0x1825f6[_0xfafd('0x38')]['offset']);}_0x23f78['order']=qs[_0xfafd('0x3e')](_0x1825f6[_0xfafd('0x38')][_0xfafd('0x3e')]);_0x23f78[_0xfafd('0x3f')]=qs['filters'](_[_0xfafd('0x40')](_0x1825f6['query'],_0x26e96c[_0xfafd('0x41')]),_0x54facb);if(_0x1825f6['query']['filter']){_0x23f78['where']=_[_0xfafd('0x42')](_0x23f78[_0xfafd('0x3f')],{'$or':_[_0xfafd('0x31')](_0x54facb,function(_0x4597ed){if(_0x4597ed['type']!==_0xfafd('0x43')){var _0x29b643={};_0x29b643[_0x4597ed[_0xfafd('0x2e')]]={'$like':'%'+_0x1825f6[_0xfafd('0x38')][_0xfafd('0x44')]+'%'};return _0x29b643;}})});}_0x23f78=_[_0xfafd('0x42')]({},_0x23f78,_0x1825f6[_0xfafd('0x45')]);var _0x29ac44={'where':_0x23f78[_0xfafd('0x3f')]};return db[_0xfafd('0x32')][_0xfafd('0x24')](_0x29ac44)[_0xfafd('0x2b')](function(_0x5cd090){_0x93a862[_0xfafd('0x24')]=_0x5cd090;if(_0x1825f6['query'][_0xfafd('0x46')]){_0x23f78[_0xfafd('0x47')]=[{'all':!![]}];}return db[_0xfafd('0x32')][_0xfafd('0x48')](_0x23f78);})['then'](function(_0x4fbee8){_0x93a862[_0xfafd('0x49')]=_0x4fbee8;return _0x93a862;})[_0xfafd('0x2b')](respondWithFilteredResult(_0x26ee37,_0x23f78))['catch'](handleError(_0x26ee37,null));};exports[_0xfafd('0x4a')]=function(_0x2baeba,_0x34dd7e){var _0x491645={'raw':![],'where':{'id':_0x2baeba['params']['id']}},_0x298b65={};_0x298b65[_0xfafd('0x37')]=_[_0xfafd('0x4b')](db[_0xfafd('0x32')][_0xfafd('0x33')]);_0x298b65[_0xfafd('0x38')]=_[_0xfafd('0x4b')](_0x2baeba[_0xfafd('0x38')]);_0x298b65[_0xfafd('0x41')]=_[_0xfafd('0x39')](_0x298b65[_0xfafd('0x37')],_0x298b65[_0xfafd('0x38')]);_0x491645[_0xfafd('0x3a')]=_[_0xfafd('0x39')](_0x298b65['model'],qs[_0xfafd('0x3b')](_0x2baeba[_0xfafd('0x38')][_0xfafd('0x3b')]));_0x491645['attributes']=_0x491645[_0xfafd('0x3a')][_0xfafd('0x4c')]?_0x491645['attributes']:_0x298b65[_0xfafd('0x37')];if(_0x2baeba[_0xfafd('0x38')][_0xfafd('0x46')]){_0x491645[_0xfafd('0x47')]=[{'all':!![]}];}_0x491645=_[_0xfafd('0x42')]({},_0x491645,_0x2baeba[_0xfafd('0x45')]);return db[_0xfafd('0x32')][_0xfafd('0x4d')](_0x491645)[_0xfafd('0x2b')](handleEntityNotFound(_0x34dd7e,null))['then'](respondWithResult(_0x34dd7e,null))[_0xfafd('0x4e')](handleError(_0x34dd7e,null));};exports['create']=function(_0x3be571,_0x57c2ee){return db[_0xfafd('0x32')][_0xfafd('0x4f')](_0x3be571[_0xfafd('0x50')],{})[_0xfafd('0x2b')](respondWithResult(_0x57c2ee,0xc9))['catch'](handleError(_0x57c2ee,null));};exports[_0xfafd('0x29')]=function(_0x2594bd,_0x1ab378){if(_0x2594bd['body']['id']){delete _0x2594bd[_0xfafd('0x50')]['id'];}return db[_0xfafd('0x32')][_0xfafd('0x4d')]({'where':{'id':_0x2594bd['params']['id']}})[_0xfafd('0x2b')](handleEntityNotFound(_0x1ab378,null))[_0xfafd('0x2b')](saveUpdates(_0x2594bd[_0xfafd('0x50')],null))['then'](respondWithResult(_0x1ab378,null))[_0xfafd('0x4e')](handleError(_0x1ab378,null));};exports[_0xfafd('0x2a')]=function(_0x18ba40,_0x5f0a31){return db[_0xfafd('0x32')][_0xfafd('0x4d')]({'where':{'id':_0x18ba40['params']['id']}})[_0xfafd('0x2b')](handleEntityNotFound(_0x5f0a31,null))[_0xfafd('0x2b')](removeEntity(_0x5f0a31,null))[_0xfafd('0x4e')](handleError(_0x5f0a31,null));};exports[_0xfafd('0x51')]=function(_0x506cee,_0x240d30,_0x4c9767){var _0x5e8b53={};var _0x3a5194={};var _0x247f13;var _0x343cab;return db['FreshsalesAccount'][_0xfafd('0x52')]({'where':{'id':_0x506cee[_0xfafd('0x53')]['id']}})['then'](handleEntityNotFound(_0x240d30,null))[_0xfafd('0x2b')](function(_0x2d0bf9){if(_0x2d0bf9){_0x247f13=_0x2d0bf9;_0x3a5194[_0xfafd('0x37')]=_[_0xfafd('0x4b')](db[_0xfafd('0x54')][_0xfafd('0x33')]);_0x3a5194[_0xfafd('0x38')]=_[_0xfafd('0x4b')](_0x506cee[_0xfafd('0x38')]);_0x3a5194[_0xfafd('0x41')]=_[_0xfafd('0x39')](_0x3a5194[_0xfafd('0x37')],_0x3a5194[_0xfafd('0x38')]);_0x5e8b53[_0xfafd('0x3a')]=_[_0xfafd('0x39')](_0x3a5194[_0xfafd('0x37')],qs[_0xfafd('0x3b')](_0x506cee[_0xfafd('0x38')][_0xfafd('0x3b')]));_0x5e8b53['attributes']=_0x5e8b53[_0xfafd('0x3a')][_0xfafd('0x4c')]?_0x5e8b53[_0xfafd('0x3a')]:_0x3a5194[_0xfafd('0x37')];_0x5e8b53[_0xfafd('0x55')]=qs['sort'](_0x506cee['query'][_0xfafd('0x3e')]);_0x5e8b53['where']=qs[_0xfafd('0x41')](_['pick'](_0x506cee[_0xfafd('0x38')],_0x3a5194[_0xfafd('0x41')]));if(_0x506cee[_0xfafd('0x38')][_0xfafd('0x44')]){_0x5e8b53[_0xfafd('0x3f')]=_[_0xfafd('0x42')](_0x5e8b53[_0xfafd('0x3f')],{'$or':_[_0xfafd('0x31')](_0x5e8b53[_0xfafd('0x3a')],function(_0x23e78c){var _0x28c071={};_0x28c071[_0x23e78c]={'$like':'%'+_0x506cee[_0xfafd('0x38')][_0xfafd('0x44')]+'%'};return _0x28c071;})});}_0x5e8b53=_[_0xfafd('0x42')]({},_0x5e8b53,_0x506cee[_0xfafd('0x45')]);return _0x247f13['getConfigurations'](_0x5e8b53);}})[_0xfafd('0x2b')](function(_0x555ed4){if(_0x555ed4){_0x343cab=_0x555ed4[_0xfafd('0x4c')];if(!_0x506cee[_0xfafd('0x38')][_0xfafd('0x3c')](_0xfafd('0x3d'))){_0x5e8b53[_0xfafd('0x23')]=qs[_0xfafd('0x23')](_0x506cee[_0xfafd('0x38')][_0xfafd('0x23')]);_0x5e8b53[_0xfafd('0x21')]=qs['offset'](_0x506cee[_0xfafd('0x38')]['offset']);}return _0x247f13[_0xfafd('0x51')](_0x5e8b53);}})[_0xfafd('0x2b')](function(_0x20331a){if(_0x20331a){return _0x20331a?{'count':_0x343cab,'rows':_0x20331a}:null;}})['then'](respondWithResult(_0x240d30,null))[_0xfafd('0x4e')](handleError(_0x240d30,null));};exports[_0xfafd('0x56')]=function(_0x6ee264,_0xccb37e,_0x3602ea){if(_0x6ee264['body']['id']){delete _0x6ee264['body']['id'];}return db[_0xfafd('0x32')]['findOne']({'where':{'id':_0x6ee264[_0xfafd('0x53')]['id']}})[_0xfafd('0x2b')](handleEntityNotFound(_0xccb37e,null))['then'](function(_0xf3b72e){if(_0xf3b72e){_0x6ee264[_0xfafd('0x50')][_0xfafd('0x57')]=_0xf3b72e['id'];_0x6ee264[_0xfafd('0x50')][_0xfafd('0x58')]=integrations['getSubjects'](_0x6ee264['body']['channel'],_0x6ee264[_0xfafd('0x50')][_0xfafd('0x35')]);_0x6ee264[_0xfafd('0x50')][_0xfafd('0x59')]=integrations['getDescriptions'](_0x6ee264[_0xfafd('0x50')][_0xfafd('0x5a')],_0x6ee264[_0xfafd('0x50')][_0xfafd('0x35')]);return db[_0xfafd('0x54')][_0xfafd('0x4f')](_0x6ee264[_0xfafd('0x50')],{'include':[{'model':db[_0xfafd('0x5b')],'as':_0xfafd('0x58')},{'model':db[_0xfafd('0x5b')],'as':'Descriptions'}]});}return null;})[_0xfafd('0x2b')](respondWithResult(_0xccb37e,null))[_0xfafd('0x4e')](handleError(_0xccb37e,null));};exports[_0xfafd('0x5c')]=function(_0x2634db,_0xc690f7,_0x1a7937){var _0x4b9702='';var _0x5ed60a='';return db[_0xfafd('0x32')][_0xfafd('0x52')]({'where':{'id':_0x2634db['params']['id']},'attributes':['id',_0xfafd('0x5d'),_0xfafd('0x5e'),_0xfafd('0x5f')]})[_0xfafd('0x2b')](handleEntityNotFound(_0xc690f7,null))[_0xfafd('0x2b')](function(_0x181f9c){if(_0x181f9c){_0x5ed60a=_0x181f9c[_0xfafd('0x5d')];_0x4b9702=_0x181f9c[_0xfafd('0x5e')];var _0x573d3f=_0x181f9c[_0xfafd('0x5e')]['slice'](-0x1);if(_0x573d3f==='/'){_0x4b9702=_0x4b9702[_0xfafd('0x60')](0x0,_0x4b9702['lastIndexOf'](_0x573d3f));}return rp({'method':_0xfafd('0x61'),'uri':util['format'](_0xfafd('0x62'),_0x4b9702,_0xfafd('0x63')),'headers':{'Authorization':'Token\x20token='+_0x181f9c[_0xfafd('0x5f')]},'json':!![]});}})[_0xfafd('0x2b')](function(_0x4ddd4b){if(_0x4ddd4b){var _0x246784=_0x4ddd4b[_0xfafd('0x64')];var _0x57bea9=![];var _0x1a4745=null;for(_0x1a4745=0x0;_0x1a4745<_0x246784[_0xfafd('0x4c')];_0x1a4745++){if(_0x246784[_0x1a4745][_0xfafd('0x65')]===_0x5ed60a){_0x57bea9=!![];}}if(_0x57bea9){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xfafd('0x2b')](respondWithResult(_0xc690f7,null))[_0xfafd('0x4e')](function(_0x3575da){var _0x866c73=_0x2634db['query'][_0xfafd('0x66')]?0x1f4:_0x3575da['statusCode']||0x1f4;logger[_0xfafd('0x2c')](_0xfafd('0x67'),_0xfafd('0x5c'),_0x866c73,JSON[_0xfafd('0x68')](_0x3575da));delete _0x3575da[_0xfafd('0x2e')];if(_0x866c73===0x191){_0x866c73=0x190;}_0xc690f7[_0xfafd('0x1e')](_0x866c73)[_0xfafd('0x2f')](_0x2634db['query'][_0xfafd('0x66')]?{'message':_0xfafd('0x69'),'statusCode':_0x3575da[_0xfafd('0x6a')]}:_0x3575da);});}; \ No newline at end of file +var _0xe588=['find','getConfigurations','findOne','FreshsalesConfiguration','order','Subjects','channel','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','includeAll','body'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe588,0xe1));var _0x8e58=function(_0x2e1ced,_0xcaf2d1){_0x2e1ced=_0x2e1ced-0x0;var _0x56fbf1=_0xe588[_0x2e1ced];return _0x56fbf1;};'use strict';var emlformat=require(_0x8e58('0x0'));var rimraf=require(_0x8e58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e58('0x2'));var moment=require(_0x8e58('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e58('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e58('0x5'));var fs=require('fs');var fs_extra=require(_0x8e58('0x6'));var _=require(_0x8e58('0x7'));var squel=require(_0x8e58('0x8'));var crypto=require(_0x8e58('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8e58('0xa'));var toCsv=require(_0x8e58('0xb'));var querystring=require(_0x8e58('0xc'));var Papa=require('papaparse');var Redis=require(_0x8e58('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8e58('0xe'));var as=require(_0x8e58('0xf'));var hardwareService=require(_0x8e58('0x10'));var logger=require('../../config/logger')(_0x8e58('0x11'));var utils=require(_0x8e58('0x12'));var config=require(_0x8e58('0x13'));var licenseUtil=require(_0x8e58('0x14'));var db=require(_0x8e58('0x15'))['db'];var integrations=require(_0x8e58('0x16'));function respondWithStatusCode(_0x320153,_0x3969d7){_0x3969d7=_0x3969d7||0xcc;return function(_0x3c9838){if(_0x3c9838){return _0x320153[_0x8e58('0x17')](_0x3969d7);}return _0x320153[_0x8e58('0x18')](_0x3969d7)[_0x8e58('0x19')]();};}function respondWithResult(_0x5b5628,_0x38b3f6){_0x38b3f6=_0x38b3f6||0xc8;return function(_0x317849){if(_0x317849){return _0x5b5628[_0x8e58('0x18')](_0x38b3f6)['json'](_0x317849);}};}function respondWithFilteredResult(_0x2b3a8b,_0x1d68a2){return function(_0x4acae4){if(_0x4acae4){var _0x518e12=typeof _0x1d68a2['offset']===_0x8e58('0x1a')&&typeof _0x1d68a2[_0x8e58('0x1b')]===_0x8e58('0x1a');var _0x12863a=_0x4acae4['count'];var _0x36daed=_0x518e12?0x0:_0x1d68a2['offset'];var _0xe5892b=_0x518e12?_0x4acae4[_0x8e58('0x1c')]:_0x1d68a2[_0x8e58('0x1d')]+_0x1d68a2[_0x8e58('0x1b')];var _0x599f5e;if(_0xe5892b>=_0x12863a){_0xe5892b=_0x12863a;_0x599f5e=0xc8;}else{_0x599f5e=0xce;}_0x2b3a8b[_0x8e58('0x18')](_0x599f5e);return _0x2b3a8b[_0x8e58('0x1e')](_0x8e58('0x1f'),_0x36daed+'-'+_0xe5892b+'/'+_0x12863a)[_0x8e58('0x20')](_0x4acae4);}return null;};}function patchUpdates(_0x922726){return function(_0x522294){try{jsonpatch[_0x8e58('0x21')](_0x522294,_0x922726,!![]);}catch(_0x162c31){return BPromise[_0x8e58('0x22')](_0x162c31);}return _0x522294[_0x8e58('0x23')]();};}function saveUpdates(_0xe243c3,_0x5318dc){return function(_0x408655){if(_0x408655){return _0x408655[_0x8e58('0x24')](_0xe243c3)[_0x8e58('0x25')](function(_0x17aa6f){return _0x17aa6f;});}return null;};}function removeEntity(_0x55707d,_0x24caec){return function(_0x31280e){if(_0x31280e){return _0x31280e[_0x8e58('0x26')]()[_0x8e58('0x25')](function(){_0x55707d['status'](0xcc)[_0x8e58('0x19')]();});}};}function handleEntityNotFound(_0x327c2b,_0x5113a6){return function(_0x544142){if(!_0x544142){_0x327c2b[_0x8e58('0x17')](0x194);}return _0x544142;};}function handleError(_0x5567c7,_0x5688f9){_0x5688f9=_0x5688f9||0x1f4;return function(_0x13d3e1){logger[_0x8e58('0x27')](_0x13d3e1['stack']);if(_0x13d3e1[_0x8e58('0x28')]){delete _0x13d3e1['name'];}_0x5567c7[_0x8e58('0x18')](_0x5688f9)[_0x8e58('0x29')](_0x13d3e1);};}exports[_0x8e58('0x2a')]=function(_0x3a9850,_0x1cec58){var _0x3d4259={},_0x4e051e={},_0x2eec31={'count':0x0,'rows':[]};var _0x33c458=_[_0x8e58('0x2b')](db[_0x8e58('0x2c')][_0x8e58('0x2d')],function(_0x4132c2){return{'name':_0x4132c2[_0x8e58('0x2e')],'type':_0x4132c2[_0x8e58('0x2f')][_0x8e58('0x30')]};});_0x4e051e[_0x8e58('0x31')]=_[_0x8e58('0x2b')](_0x33c458,_0x8e58('0x28'));_0x4e051e[_0x8e58('0x32')]=_[_0x8e58('0x33')](_0x3a9850['query']);_0x4e051e[_0x8e58('0x34')]=_[_0x8e58('0x35')](_0x4e051e['model'],_0x4e051e[_0x8e58('0x32')]);_0x3d4259['attributes']=_[_0x8e58('0x35')](_0x4e051e[_0x8e58('0x31')],qs[_0x8e58('0x36')](_0x3a9850[_0x8e58('0x32')]['fields']));_0x3d4259[_0x8e58('0x37')]=_0x3d4259[_0x8e58('0x37')][_0x8e58('0x38')]?_0x3d4259[_0x8e58('0x37')]:_0x4e051e['model'];if(!_0x3a9850[_0x8e58('0x32')][_0x8e58('0x39')](_0x8e58('0x3a'))){_0x3d4259['limit']=qs[_0x8e58('0x1b')](_0x3a9850[_0x8e58('0x32')][_0x8e58('0x1b')]);_0x3d4259['offset']=qs[_0x8e58('0x1d')](_0x3a9850[_0x8e58('0x32')]['offset']);}_0x3d4259['order']=qs[_0x8e58('0x3b')](_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3b')]);_0x3d4259['where']=qs[_0x8e58('0x34')](_['pick'](_0x3a9850[_0x8e58('0x32')],_0x4e051e[_0x8e58('0x34')]),_0x33c458);if(_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3c')]){_0x3d4259['where']=_[_0x8e58('0x3d')](_0x3d4259[_0x8e58('0x3e')],{'$or':_[_0x8e58('0x2b')](_0x33c458,function(_0x4cd652){if(_0x4cd652[_0x8e58('0x2f')]!==_0x8e58('0x3f')){var _0x302c83={};_0x302c83[_0x4cd652[_0x8e58('0x28')]]={'$like':'%'+_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3c')]+'%'};return _0x302c83;}})});}_0x3d4259=_['merge']({},_0x3d4259,_0x3a9850[_0x8e58('0x40')]);var _0x37187f={'where':_0x3d4259[_0x8e58('0x3e')]};return db[_0x8e58('0x2c')][_0x8e58('0x1c')](_0x37187f)[_0x8e58('0x25')](function(_0x4847e9){_0x2eec31[_0x8e58('0x1c')]=_0x4847e9;if(_0x3a9850[_0x8e58('0x32')]['includeAll']){_0x3d4259[_0x8e58('0x41')]=[{'all':!![]}];}return db[_0x8e58('0x2c')]['findAll'](_0x3d4259);})[_0x8e58('0x25')](function(_0x4240da){_0x2eec31[_0x8e58('0x42')]=_0x4240da;return _0x2eec31;})[_0x8e58('0x25')](respondWithFilteredResult(_0x1cec58,_0x3d4259))[_0x8e58('0x43')](handleError(_0x1cec58,null));};exports[_0x8e58('0x44')]=function(_0x166453,_0x5ce2eb){var _0x721dc={'raw':![],'where':{'id':_0x166453[_0x8e58('0x45')]['id']}},_0x552a97={};_0x552a97[_0x8e58('0x31')]=_[_0x8e58('0x33')](db[_0x8e58('0x2c')]['rawAttributes']);_0x552a97['query']=_['keys'](_0x166453[_0x8e58('0x32')]);_0x552a97[_0x8e58('0x34')]=_[_0x8e58('0x35')](_0x552a97[_0x8e58('0x31')],_0x552a97['query']);_0x721dc['attributes']=_[_0x8e58('0x35')](_0x552a97[_0x8e58('0x31')],qs[_0x8e58('0x36')](_0x166453[_0x8e58('0x32')]['fields']));_0x721dc[_0x8e58('0x37')]=_0x721dc[_0x8e58('0x37')][_0x8e58('0x38')]?_0x721dc[_0x8e58('0x37')]:_0x552a97[_0x8e58('0x31')];if(_0x166453[_0x8e58('0x32')][_0x8e58('0x46')]){_0x721dc[_0x8e58('0x41')]=[{'all':!![]}];}_0x721dc=_[_0x8e58('0x3d')]({},_0x721dc,_0x166453[_0x8e58('0x40')]);return db[_0x8e58('0x2c')]['find'](_0x721dc)[_0x8e58('0x25')](handleEntityNotFound(_0x5ce2eb,null))[_0x8e58('0x25')](respondWithResult(_0x5ce2eb,null))[_0x8e58('0x43')](handleError(_0x5ce2eb,null));};exports['create']=function(_0x7b4a9a,_0x597f95){return db['FreshsalesAccount']['create'](_0x7b4a9a[_0x8e58('0x47')],{})[_0x8e58('0x25')](respondWithResult(_0x597f95,0xc9))['catch'](handleError(_0x597f95,null));};exports[_0x8e58('0x24')]=function(_0x1998a4,_0x16efca){if(_0x1998a4[_0x8e58('0x47')]['id']){delete _0x1998a4[_0x8e58('0x47')]['id'];}return db[_0x8e58('0x2c')][_0x8e58('0x48')]({'where':{'id':_0x1998a4['params']['id']}})[_0x8e58('0x25')](handleEntityNotFound(_0x16efca,null))[_0x8e58('0x25')](saveUpdates(_0x1998a4[_0x8e58('0x47')],null))[_0x8e58('0x25')](respondWithResult(_0x16efca,null))[_0x8e58('0x43')](handleError(_0x16efca,null));};exports[_0x8e58('0x26')]=function(_0x3884af,_0x4af1ec){return db[_0x8e58('0x2c')][_0x8e58('0x48')]({'where':{'id':_0x3884af['params']['id']}})[_0x8e58('0x25')](handleEntityNotFound(_0x4af1ec,null))[_0x8e58('0x25')](removeEntity(_0x4af1ec,null))[_0x8e58('0x43')](handleError(_0x4af1ec,null));};exports[_0x8e58('0x49')]=function(_0x431a2a,_0x174ba7,_0x2f7920){var _0x3eefa5={};var _0xee473a={};var _0xc14e81;var _0xa5c55b;return db[_0x8e58('0x2c')][_0x8e58('0x4a')]({'where':{'id':_0x431a2a[_0x8e58('0x45')]['id']}})['then'](handleEntityNotFound(_0x174ba7,null))[_0x8e58('0x25')](function(_0x2d4745){if(_0x2d4745){_0xc14e81=_0x2d4745;_0xee473a[_0x8e58('0x31')]=_[_0x8e58('0x33')](db[_0x8e58('0x4b')][_0x8e58('0x2d')]);_0xee473a['query']=_['keys'](_0x431a2a['query']);_0xee473a['filters']=_[_0x8e58('0x35')](_0xee473a[_0x8e58('0x31')],_0xee473a['query']);_0x3eefa5[_0x8e58('0x37')]=_['intersection'](_0xee473a[_0x8e58('0x31')],qs['fields'](_0x431a2a['query'][_0x8e58('0x36')]));_0x3eefa5[_0x8e58('0x37')]=_0x3eefa5[_0x8e58('0x37')]['length']?_0x3eefa5[_0x8e58('0x37')]:_0xee473a[_0x8e58('0x31')];_0x3eefa5[_0x8e58('0x4c')]=qs[_0x8e58('0x3b')](_0x431a2a[_0x8e58('0x32')][_0x8e58('0x3b')]);_0x3eefa5['where']=qs[_0x8e58('0x34')](_['pick'](_0x431a2a[_0x8e58('0x32')],_0xee473a[_0x8e58('0x34')]));if(_0x431a2a[_0x8e58('0x32')]['filter']){_0x3eefa5[_0x8e58('0x3e')]=_['merge'](_0x3eefa5[_0x8e58('0x3e')],{'$or':_['map'](_0x3eefa5[_0x8e58('0x37')],function(_0x15edd7){var _0xbc0a28={};_0xbc0a28[_0x15edd7]={'$like':'%'+_0x431a2a['query'][_0x8e58('0x3c')]+'%'};return _0xbc0a28;})});}_0x3eefa5=_['merge']({},_0x3eefa5,_0x431a2a['options']);return _0xc14e81[_0x8e58('0x49')](_0x3eefa5);}})['then'](function(_0x500bdc){if(_0x500bdc){_0xa5c55b=_0x500bdc['length'];if(!_0x431a2a['query'][_0x8e58('0x39')](_0x8e58('0x3a'))){_0x3eefa5['limit']=qs[_0x8e58('0x1b')](_0x431a2a['query'][_0x8e58('0x1b')]);_0x3eefa5[_0x8e58('0x1d')]=qs[_0x8e58('0x1d')](_0x431a2a[_0x8e58('0x32')][_0x8e58('0x1d')]);}return _0xc14e81['getConfigurations'](_0x3eefa5);}})[_0x8e58('0x25')](function(_0x145921){if(_0x145921){return _0x145921?{'count':_0xa5c55b,'rows':_0x145921}:null;}})[_0x8e58('0x25')](respondWithResult(_0x174ba7,null))['catch'](handleError(_0x174ba7,null));};exports['addConfiguration']=function(_0x4df736,_0x597a7b,_0x2c1e64){if(_0x4df736[_0x8e58('0x47')]['id']){delete _0x4df736[_0x8e58('0x47')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4df736[_0x8e58('0x45')]['id']}})['then'](handleEntityNotFound(_0x597a7b,null))[_0x8e58('0x25')](function(_0x5d0454){if(_0x5d0454){_0x4df736[_0x8e58('0x47')]['AccountId']=_0x5d0454['id'];_0x4df736[_0x8e58('0x47')][_0x8e58('0x4d')]=integrations['getSubjects'](_0x4df736[_0x8e58('0x47')][_0x8e58('0x4e')],_0x4df736[_0x8e58('0x47')]['type']);_0x4df736['body'][_0x8e58('0x4f')]=integrations[_0x8e58('0x50')](_0x4df736[_0x8e58('0x47')][_0x8e58('0x4e')],_0x4df736[_0x8e58('0x47')][_0x8e58('0x2f')]);return db[_0x8e58('0x4b')][_0x8e58('0x51')](_0x4df736[_0x8e58('0x47')],{'include':[{'model':db[_0x8e58('0x52')],'as':_0x8e58('0x4d')},{'model':db[_0x8e58('0x52')],'as':_0x8e58('0x4f')}]});}return null;})[_0x8e58('0x25')](respondWithResult(_0x597a7b,null))[_0x8e58('0x43')](handleError(_0x597a7b,null));};exports[_0x8e58('0x53')]=function(_0x3bdde2,_0x127fb7,_0x4f3733){var _0xcfbc21='';var _0x6578='';return db[_0x8e58('0x2c')]['findOne']({'where':{'id':_0x3bdde2[_0x8e58('0x45')]['id']},'attributes':['id',_0x8e58('0x54'),_0x8e58('0x55'),_0x8e58('0x56')]})[_0x8e58('0x25')](handleEntityNotFound(_0x127fb7,null))[_0x8e58('0x25')](function(_0x267cb2){if(_0x267cb2){_0x6578=_0x267cb2['username'];_0xcfbc21=_0x267cb2[_0x8e58('0x55')];var _0x14f778=_0x267cb2[_0x8e58('0x55')][_0x8e58('0x57')](-0x1);if(_0x14f778==='/'){_0xcfbc21=_0xcfbc21[_0x8e58('0x58')](0x0,_0xcfbc21[_0x8e58('0x59')](_0x14f778));}return rp({'method':_0x8e58('0x5a'),'uri':util[_0x8e58('0x5b')]('%s%s',_0xcfbc21,_0x8e58('0x5c')),'headers':{'Authorization':_0x8e58('0x5d')+_0x267cb2[_0x8e58('0x56')]},'json':!![]});}})[_0x8e58('0x25')](function(_0x3c70f8){if(_0x3c70f8){var _0x1b97d1=_0x3c70f8['users'];var _0x1d1837=![];var _0x3b0f89=null;for(_0x3b0f89=0x0;_0x3b0f89<_0x1b97d1[_0x8e58('0x38')];_0x3b0f89++){if(_0x1b97d1[_0x3b0f89]['email']===_0x6578){_0x1d1837=!![];}}if(_0x1d1837){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8e58('0x25')](respondWithResult(_0x127fb7,null))['catch'](function(_0x3dd5c8){var _0x214661=_0x3bdde2[_0x8e58('0x32')][_0x8e58('0x5e')]?0x1f4:_0x3dd5c8[_0x8e58('0x5f')]||0x1f4;logger[_0x8e58('0x27')](_0x8e58('0x60'),_0x8e58('0x53'),_0x214661,JSON[_0x8e58('0x61')](_0x3dd5c8));delete _0x3dd5c8[_0x8e58('0x28')];if(_0x214661===0x191){_0x214661=0x190;}_0x127fb7[_0x8e58('0x18')](_0x214661)[_0x8e58('0x29')](_0x3bdde2[_0x8e58('0x32')][_0x8e58('0x5e')]?{'message':_0x8e58('0x62'),'statusCode':_0x3dd5c8[_0x8e58('0x5f')]}:_0x3dd5c8);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f73473a..f86e9d4 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 _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x14caee,_0x4d5966){var _0x38325b=function(_0xd85258){while(--_0xd85258){_0x14caee['push'](_0x14caee['shift']());}};_0x38325b(++_0x4d5966);}(_0x430c,0x1a1));var _0xc430=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0x430c[_0x3f25db];return _0x54f29d;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x1fa81b,_0xf9b59d){var _0xa8fea7=function(_0x154cc9){while(--_0x154cc9){_0x1fa81b['push'](_0x1fa81b['shift']());}};_0xa8fea7(++_0xf9b59d);}(_0x2542,0x169));var _0x2254=function(_0x11c2c0,_0x52c4f2){_0x11c2c0=_0x11c2c0-0x0;var _0x3a1a58=_0x2542[_0x11c2c0];return _0x3a1a58;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));var integrations=require(_0x2254('0x9'));module['exports']=function(_0x19ad3c,_0xe8ca50){return _0x19ad3c[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'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 6d3d668..d4405b7 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 _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4044dc,_0x5683f3){var _0x266b7c=function(_0x43e761){while(--_0x43e761){_0x4044dc['push'](_0x4044dc['shift']());}};_0x266b7c(++_0x5683f3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0xfcf0[_0x28f32c];return _0x355402;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file +var _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xb016,0x159));var _0x6b01=function(_0x3f3c63,_0x11d692){_0x3f3c63=_0x3f3c63-0x0;var _0xb9fb6f=_0xb016[_0x3f3c63];return _0xb9fb6f;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index aefe081..835e25f 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 _0xf449=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f8f2d,_0x4fcada){var _0x54f72d=function(_0xc04b96){while(--_0xc04b96){_0x1f8f2d['push'](_0x1f8f2d['shift']());}};_0x54f72d(++_0x4fcada);}(_0xf449,0x8e));var _0x9f44=function(_0x5d79f1,_0x11e14b){_0x5d79f1=_0x5d79f1-0x0;var _0x387e83=_0xf449[_0x5d79f1];return _0x387e83;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f44('0x0'));var timeout=require('connect-timeout');var express=require(_0x9f44('0x1'));var router=express[_0x9f44('0x2')]();var fs_extra=require(_0x9f44('0x3'));var auth=require(_0x9f44('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f44('0x5'));var controller=require(_0x9f44('0x6'));router[_0x9f44('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x9f44('0x8')](),controller[_0x9f44('0x9')]);router[_0x9f44('0x7')](_0x9f44('0xa'),auth[_0x9f44('0x8')](),controller['getSubjects']);router[_0x9f44('0x7')](_0x9f44('0xb'),auth['isAuthenticated'](),controller[_0x9f44('0xc')]);router[_0x9f44('0x7')](_0x9f44('0xd'),auth[_0x9f44('0x8')](),controller[_0x9f44('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9f44('0xf')]);router[_0x9f44('0x10')]('/:id',auth[_0x9f44('0x8')](),controller[_0x9f44('0x11')]);router[_0x9f44('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9f44('0x13')]);module[_0x9f44('0x14')]=router; \ No newline at end of file +var _0x3f55=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id'];(function(_0xbb19f6,_0xb5111){var _0x3d27eb=function(_0x154644){while(--_0x154644){_0xbb19f6['push'](_0xbb19f6['shift']());}};_0x3d27eb(++_0xb5111);}(_0x3f55,0x113));var _0x53f5=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x3f55[_0x3c22e0];return _0x215811;};'use strict';var multer=require('multer');var util=require(_0x53f5('0x0'));var path=require(_0x53f5('0x1'));var timeout=require(_0x53f5('0x2'));var express=require('express');var router=express[_0x53f5('0x3')]();var fs_extra=require(_0x53f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x53f5('0x5'));var config=require('../../config/environment');var controller=require(_0x53f5('0x6'));router[_0x53f5('0x7')]('/',auth[_0x53f5('0x8')](),controller['index']);router[_0x53f5('0x7')](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller[_0x53f5('0xa')]);router['get'](_0x53f5('0xb'),auth[_0x53f5('0x8')](),controller['getSubjects']);router[_0x53f5('0x7')](_0x53f5('0xc'),auth['isAuthenticated'](),controller[_0x53f5('0xd')]);router[_0x53f5('0x7')](_0x53f5('0xe'),auth[_0x53f5('0x8')](),controller['getFields']);router[_0x53f5('0xf')]('/',auth['isAuthenticated'](),controller[_0x53f5('0x10')]);router[_0x53f5('0x11')](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller[_0x53f5('0x12')]);router['delete'](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 477fc63..ba958b3 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 _0x688c=['sequelize','STRING'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x688c,0xc4));var _0xc688=function(_0xc55304,_0x750b43){_0xc55304=_0xc55304-0x0;var _0x309e2a=_0x688c[_0xc55304];return _0x309e2a;};'use strict';var Sequelize=require(_0xc688('0x0'));module['exports']={'name':{'type':Sequelize[_0xc688('0x1')]},'description':{'type':Sequelize[_0xc688('0x1')]}}; \ No newline at end of file +var _0x533a=['exports','STRING','sequelize'];(function(_0x22a90a,_0x461cdd){var _0x511604=function(_0x273219){while(--_0x273219){_0x22a90a['push'](_0x22a90a['shift']());}};_0x511604(++_0x461cdd);}(_0x533a,0x19d));var _0xa533=function(_0x415346,_0x440efe){_0x415346=_0x415346-0x0;var _0x28661c=_0x533a[_0x415346];return _0x28661c;};'use strict';var Sequelize=require(_0xa533('0x0'));module[_0xa533('0x1')]={'name':{'type':Sequelize[_0xa533('0x2')]},'description':{'type':Sequelize[_0xa533('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f82324e..f7dc8b3 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 _0x98f8=['hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','FreshsalesConfiguration','include','findAll','params','length','find','catch','create','body','getSubjects','findOne','pick','options','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0x3fad55,_0x142888){var _0x1191b7=function(_0x35c480){while(--_0x35c480){_0x3fad55['push'](_0x3fad55['shift']());}};_0x1191b7(++_0x142888);}(_0x98f8,0x111));var _0x898f=function(_0x2840a4,_0x236330){_0x2840a4=_0x2840a4-0x0;var _0x245ac9=_0x98f8[_0x2840a4];return _0x245ac9;};'use strict';var emlformat=require(_0x898f('0x0'));var rimraf=require(_0x898f('0x1'));var zipdir=require(_0x898f('0x2'));var jsonpatch=require(_0x898f('0x3'));var rp=require(_0x898f('0x4'));var moment=require(_0x898f('0x5'));var BPromise=require(_0x898f('0x6'));var Mustache=require(_0x898f('0x7'));var util=require(_0x898f('0x8'));var path=require(_0x898f('0x9'));var sox=require(_0x898f('0xa'));var csv=require(_0x898f('0xb'));var ejs=require(_0x898f('0xc'));var fs=require('fs');var fs_extra=require(_0x898f('0xd'));var _=require(_0x898f('0xe'));var squel=require(_0x898f('0xf'));var crypto=require(_0x898f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x898f('0x11'));var toCsv=require(_0x898f('0xb'));var querystring=require('querystring');var Papa=require(_0x898f('0x12'));var Redis=require(_0x898f('0x13'));var authService=require(_0x898f('0x14'));var qs=require(_0x898f('0x15'));var as=require(_0x898f('0x16'));var hardwareService=require(_0x898f('0x17'));var logger=require(_0x898f('0x18'))('api');var utils=require(_0x898f('0x19'));var config=require(_0x898f('0x1a'));var licenseUtil=require(_0x898f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x439179,_0x313405){_0x313405=_0x313405||0xcc;return function(_0xaad69c){if(_0xaad69c){return _0x439179[_0x898f('0x1c')](_0x313405);}return _0x439179[_0x898f('0x1d')](_0x313405)[_0x898f('0x1e')]();};}function respondWithResult(_0x1269cd,_0x46e09f){_0x46e09f=_0x46e09f||0xc8;return function(_0x47106c){if(_0x47106c){return _0x1269cd[_0x898f('0x1d')](_0x46e09f)[_0x898f('0x1f')](_0x47106c);}};}function respondWithFilteredResult(_0x1f0e88,_0xa3d588){return function(_0x2e8c17){if(_0x2e8c17){var _0x58b435=typeof _0xa3d588['offset']==='undefined'&&typeof _0xa3d588[_0x898f('0x20')]===_0x898f('0x21');var _0x14c320=_0x2e8c17[_0x898f('0x22')];var _0x41c2c4=_0x58b435?0x0:_0xa3d588[_0x898f('0x23')];var _0x323af2=_0x58b435?_0x2e8c17[_0x898f('0x22')]:_0xa3d588['offset']+_0xa3d588[_0x898f('0x20')];var _0x603381;if(_0x323af2>=_0x14c320){_0x323af2=_0x14c320;_0x603381=0xc8;}else{_0x603381=0xce;}_0x1f0e88[_0x898f('0x1d')](_0x603381);return _0x1f0e88[_0x898f('0x24')](_0x898f('0x25'),_0x41c2c4+'-'+_0x323af2+'/'+_0x14c320)[_0x898f('0x1f')](_0x2e8c17);}return null;};}function patchUpdates(_0x532074){return function(_0x41d81){try{jsonpatch[_0x898f('0x26')](_0x41d81,_0x532074,!![]);}catch(_0x40c0fd){return BPromise[_0x898f('0x27')](_0x40c0fd);}return _0x41d81[_0x898f('0x28')]();};}function saveUpdates(_0x4a40a6,_0x12a0ad){return function(_0x403c77){if(_0x403c77){return _0x403c77[_0x898f('0x29')](_0x4a40a6)['then'](function(_0x5382e5){return _0x5382e5;});}return null;};}function removeEntity(_0x1dd00c,_0x480b23){return function(_0x59e828){if(_0x59e828){return _0x59e828[_0x898f('0x2a')]()[_0x898f('0x2b')](function(){_0x1dd00c['status'](0xcc)[_0x898f('0x1e')]();});}};}function handleEntityNotFound(_0x50af48,_0x1d07d8){return function(_0x7c77e7){if(!_0x7c77e7){_0x50af48[_0x898f('0x1c')](0x194);}return _0x7c77e7;};}function handleError(_0x3738ec,_0x50e110){_0x50e110=_0x50e110||0x1f4;return function(_0x281b50){logger[_0x898f('0x2c')](_0x281b50['stack']);if(_0x281b50[_0x898f('0x2d')]){delete _0x281b50['name'];}_0x3738ec[_0x898f('0x1d')](_0x50e110)[_0x898f('0x2e')](_0x281b50);};}exports['index']=function(_0x4df4a0,_0x246b19){var _0x52360a={},_0x5ec934={},_0x15158c={'count':0x0,'rows':[]};var _0x46fff1=_[_0x898f('0x2f')](db['FreshsalesConfiguration'][_0x898f('0x30')],function(_0x31ad86){return{'name':_0x31ad86[_0x898f('0x31')],'type':_0x31ad86[_0x898f('0x32')][_0x898f('0x33')]};});_0x5ec934['model']=_[_0x898f('0x2f')](_0x46fff1,_0x898f('0x2d'));_0x5ec934[_0x898f('0x34')]=_[_0x898f('0x35')](_0x4df4a0['query']);_0x5ec934[_0x898f('0x36')]=_[_0x898f('0x37')](_0x5ec934['model'],_0x5ec934[_0x898f('0x34')]);_0x52360a['attributes']=_[_0x898f('0x37')](_0x5ec934[_0x898f('0x38')],qs[_0x898f('0x39')](_0x4df4a0['query']['fields']));_0x52360a[_0x898f('0x3a')]=_0x52360a[_0x898f('0x3a')]['length']?_0x52360a[_0x898f('0x3a')]:_0x5ec934[_0x898f('0x38')];if(!_0x4df4a0[_0x898f('0x34')][_0x898f('0x3b')](_0x898f('0x3c'))){_0x52360a['limit']=qs[_0x898f('0x20')](_0x4df4a0[_0x898f('0x34')][_0x898f('0x20')]);_0x52360a[_0x898f('0x23')]=qs[_0x898f('0x23')](_0x4df4a0[_0x898f('0x34')][_0x898f('0x23')]);}_0x52360a[_0x898f('0x3d')]=qs['sort'](_0x4df4a0['query'][_0x898f('0x3e')]);_0x52360a['where']=qs[_0x898f('0x36')](_['pick'](_0x4df4a0[_0x898f('0x34')],_0x5ec934['filters']),_0x46fff1);if(_0x4df4a0[_0x898f('0x34')][_0x898f('0x3f')]){_0x52360a['where']=_[_0x898f('0x40')](_0x52360a[_0x898f('0x41')],{'$or':_[_0x898f('0x2f')](_0x46fff1,function(_0x33bf12){if(_0x33bf12[_0x898f('0x32')]!==_0x898f('0x42')){var _0x48e933={};_0x48e933[_0x33bf12[_0x898f('0x2d')]]={'$like':'%'+_0x4df4a0[_0x898f('0x34')][_0x898f('0x3f')]+'%'};return _0x48e933;}})});}_0x52360a=_['merge']({},_0x52360a,_0x4df4a0['options']);var _0x111d97={'where':_0x52360a[_0x898f('0x41')]};return db[_0x898f('0x43')][_0x898f('0x22')](_0x111d97)['then'](function(_0x3f39d8){_0x15158c[_0x898f('0x22')]=_0x3f39d8;if(_0x4df4a0[_0x898f('0x34')]['includeAll']){_0x52360a[_0x898f('0x44')]=[{'all':!![]}];}return db[_0x898f('0x43')][_0x898f('0x45')](_0x52360a);})[_0x898f('0x2b')](function(_0x1685c3){_0x15158c['rows']=_0x1685c3;return _0x15158c;})[_0x898f('0x2b')](respondWithFilteredResult(_0x246b19,_0x52360a))['catch'](handleError(_0x246b19,null));};exports['show']=function(_0x593262,_0x34c449){var _0x3d30cc={'raw':![],'where':{'id':_0x593262[_0x898f('0x46')]['id']}},_0x5b1a1f={};_0x5b1a1f['model']=_[_0x898f('0x35')](db[_0x898f('0x43')][_0x898f('0x30')]);_0x5b1a1f[_0x898f('0x34')]=_['keys'](_0x593262['query']);_0x5b1a1f[_0x898f('0x36')]=_['intersection'](_0x5b1a1f[_0x898f('0x38')],_0x5b1a1f[_0x898f('0x34')]);_0x3d30cc[_0x898f('0x3a')]=_[_0x898f('0x37')](_0x5b1a1f[_0x898f('0x38')],qs['fields'](_0x593262[_0x898f('0x34')]['fields']));_0x3d30cc['attributes']=_0x3d30cc['attributes'][_0x898f('0x47')]?_0x3d30cc[_0x898f('0x3a')]:_0x5b1a1f[_0x898f('0x38')];if(_0x593262[_0x898f('0x34')]['includeAll']){_0x3d30cc[_0x898f('0x44')]=[{'all':!![]}];}_0x3d30cc=_[_0x898f('0x40')]({},_0x3d30cc,_0x593262['options']);return db['FreshsalesConfiguration'][_0x898f('0x48')](_0x3d30cc)[_0x898f('0x2b')](handleEntityNotFound(_0x34c449,null))[_0x898f('0x2b')](respondWithResult(_0x34c449,null))[_0x898f('0x49')](handleError(_0x34c449,null));};exports[_0x898f('0x4a')]=function(_0x19de76,_0x5726d6){return db[_0x898f('0x43')]['create'](_0x19de76['body'],{})['then'](respondWithResult(_0x5726d6,0xc9))[_0x898f('0x49')](handleError(_0x5726d6,null));};exports[_0x898f('0x29')]=function(_0x4343d5,_0xb199bd){if(_0x4343d5['body']['id']){delete _0x4343d5['body']['id'];}return db[_0x898f('0x43')][_0x898f('0x48')]({'where':{'id':_0x4343d5[_0x898f('0x46')]['id']}})[_0x898f('0x2b')](handleEntityNotFound(_0xb199bd,null))[_0x898f('0x2b')](saveUpdates(_0x4343d5[_0x898f('0x4b')],null))[_0x898f('0x2b')](respondWithResult(_0xb199bd,null))[_0x898f('0x49')](handleError(_0xb199bd,null));};exports[_0x898f('0x2a')]=function(_0x154cb2,_0x3956d2){return db['FreshsalesConfiguration'][_0x898f('0x48')]({'where':{'id':_0x154cb2[_0x898f('0x46')]['id']}})[_0x898f('0x2b')](handleEntityNotFound(_0x3956d2,null))[_0x898f('0x2b')](removeEntity(_0x3956d2,null))[_0x898f('0x49')](handleError(_0x3956d2,null));};exports[_0x898f('0x4c')]=function(_0x3aa601,_0x39aec6,_0x34cd7b){var _0x3ba804={};var _0x3e4c8f={};var _0x1498f1;var _0x229280;return db['FreshsalesConfiguration'][_0x898f('0x4d')]({'where':{'id':_0x3aa601[_0x898f('0x46')]['id']}})[_0x898f('0x2b')](handleEntityNotFound(_0x39aec6,null))['then'](function(_0x338728){if(_0x338728){_0x1498f1=_0x338728;_0x3e4c8f[_0x898f('0x38')]=_[_0x898f('0x35')](db['FreshsalesField'][_0x898f('0x30')]);_0x3e4c8f[_0x898f('0x34')]=_[_0x898f('0x35')](_0x3aa601['query']);_0x3e4c8f['filters']=_[_0x898f('0x37')](_0x3e4c8f[_0x898f('0x38')],_0x3e4c8f[_0x898f('0x34')]);_0x3ba804[_0x898f('0x3a')]=_[_0x898f('0x37')](_0x3e4c8f['model'],qs[_0x898f('0x39')](_0x3aa601[_0x898f('0x34')][_0x898f('0x39')]));_0x3ba804[_0x898f('0x3a')]=_0x3ba804[_0x898f('0x3a')][_0x898f('0x47')]?_0x3ba804[_0x898f('0x3a')]:_0x3e4c8f[_0x898f('0x38')];_0x3ba804[_0x898f('0x3d')]=qs[_0x898f('0x3e')](_0x3aa601[_0x898f('0x34')][_0x898f('0x3e')]);_0x3ba804['where']=qs[_0x898f('0x36')](_[_0x898f('0x4e')](_0x3aa601[_0x898f('0x34')],_0x3e4c8f['filters']));if(_0x3aa601['query']['filter']){_0x3ba804['where']=_[_0x898f('0x40')](_0x3ba804['where'],{'$or':_[_0x898f('0x2f')](_0x3ba804[_0x898f('0x3a')],function(_0x1d49f1){var _0x32716b={};_0x32716b[_0x1d49f1]={'$like':'%'+_0x3aa601[_0x898f('0x34')][_0x898f('0x3f')]+'%'};return _0x32716b;})});}_0x3ba804=_[_0x898f('0x40')]({},_0x3ba804,_0x3aa601[_0x898f('0x4f')]);return _0x1498f1[_0x898f('0x4c')](_0x3ba804);}})[_0x898f('0x2b')](function(_0x1ecb7e){if(_0x1ecb7e){_0x229280=_0x1ecb7e['length'];if(!_0x3aa601[_0x898f('0x34')][_0x898f('0x3b')](_0x898f('0x3c'))){_0x3ba804[_0x898f('0x20')]=qs['limit'](_0x3aa601[_0x898f('0x34')][_0x898f('0x20')]);_0x3ba804['offset']=qs['offset'](_0x3aa601[_0x898f('0x34')][_0x898f('0x23')]);}return _0x1498f1['getSubjects'](_0x3ba804);}})['then'](function(_0x3cd8ce){if(_0x3cd8ce){return _0x3cd8ce?{'count':_0x229280,'rows':_0x3cd8ce}:null;}})['then'](respondWithResult(_0x39aec6,null))[_0x898f('0x49')](handleError(_0x39aec6,null));};exports[_0x898f('0x50')]=function(_0x435c1a,_0x54621f,_0x5891a6){var _0x340e34={};var _0x2dd915={};var _0x314d15;var _0x1e6a7c;return db['FreshsalesConfiguration'][_0x898f('0x4d')]({'where':{'id':_0x435c1a[_0x898f('0x46')]['id']}})[_0x898f('0x2b')](handleEntityNotFound(_0x54621f,null))['then'](function(_0x5f641f){if(_0x5f641f){_0x314d15=_0x5f641f;_0x2dd915[_0x898f('0x38')]=_[_0x898f('0x35')](db[_0x898f('0x51')][_0x898f('0x30')]);_0x2dd915[_0x898f('0x34')]=_[_0x898f('0x35')](_0x435c1a[_0x898f('0x34')]);_0x2dd915['filters']=_[_0x898f('0x37')](_0x2dd915['model'],_0x2dd915[_0x898f('0x34')]);_0x340e34[_0x898f('0x3a')]=_['intersection'](_0x2dd915[_0x898f('0x38')],qs['fields'](_0x435c1a[_0x898f('0x34')][_0x898f('0x39')]));_0x340e34[_0x898f('0x3a')]=_0x340e34[_0x898f('0x3a')][_0x898f('0x47')]?_0x340e34[_0x898f('0x3a')]:_0x2dd915[_0x898f('0x38')];_0x340e34['order']=qs[_0x898f('0x3e')](_0x435c1a[_0x898f('0x34')][_0x898f('0x3e')]);_0x340e34[_0x898f('0x41')]=qs[_0x898f('0x36')](_['pick'](_0x435c1a[_0x898f('0x34')],_0x2dd915[_0x898f('0x36')]));if(_0x435c1a[_0x898f('0x34')][_0x898f('0x3f')]){_0x340e34[_0x898f('0x41')]=_[_0x898f('0x40')](_0x340e34[_0x898f('0x41')],{'$or':_[_0x898f('0x2f')](_0x340e34[_0x898f('0x3a')],function(_0x4f6409){var _0x5eeccf={};_0x5eeccf[_0x4f6409]={'$like':'%'+_0x435c1a[_0x898f('0x34')][_0x898f('0x3f')]+'%'};return _0x5eeccf;})});}_0x340e34=_['merge']({},_0x340e34,_0x435c1a['options']);return _0x314d15['getDescriptions'](_0x340e34);}})[_0x898f('0x2b')](function(_0x2e0e84){if(_0x2e0e84){_0x1e6a7c=_0x2e0e84[_0x898f('0x47')];if(!_0x435c1a[_0x898f('0x34')][_0x898f('0x3b')]('nolimit')){_0x340e34['limit']=qs[_0x898f('0x20')](_0x435c1a[_0x898f('0x34')][_0x898f('0x20')]);_0x340e34[_0x898f('0x23')]=qs[_0x898f('0x23')](_0x435c1a[_0x898f('0x34')][_0x898f('0x23')]);}return _0x314d15[_0x898f('0x50')](_0x340e34);}})[_0x898f('0x2b')](function(_0x57c3cd){if(_0x57c3cd){return _0x57c3cd?{'count':_0x1e6a7c,'rows':_0x57c3cd}:null;}})['then'](respondWithResult(_0x54621f,null))[_0x898f('0x49')](handleError(_0x54621f,null));};exports['getFields']=function(_0x192cc7,_0x6f10af,_0x528250){var _0x1232dc={};var _0xc9c4cc={};var _0x28f596;var _0x200953;return db['FreshsalesConfiguration'][_0x898f('0x4d')]({'where':{'id':_0x192cc7['params']['id']}})[_0x898f('0x2b')](handleEntityNotFound(_0x6f10af,null))[_0x898f('0x2b')](function(_0x59085f){if(_0x59085f){_0x28f596=_0x59085f;_0xc9c4cc[_0x898f('0x38')]=_[_0x898f('0x35')](db[_0x898f('0x51')][_0x898f('0x30')]);_0xc9c4cc[_0x898f('0x34')]=_[_0x898f('0x35')](_0x192cc7[_0x898f('0x34')]);_0xc9c4cc['filters']=_[_0x898f('0x37')](_0xc9c4cc[_0x898f('0x38')],_0xc9c4cc[_0x898f('0x34')]);_0x1232dc[_0x898f('0x3a')]=_[_0x898f('0x37')](_0xc9c4cc['model'],qs[_0x898f('0x39')](_0x192cc7[_0x898f('0x34')]['fields']));_0x1232dc[_0x898f('0x3a')]=_0x1232dc[_0x898f('0x3a')][_0x898f('0x47')]?_0x1232dc['attributes']:_0xc9c4cc[_0x898f('0x38')];_0x1232dc[_0x898f('0x3d')]=qs[_0x898f('0x3e')](_0x192cc7[_0x898f('0x34')][_0x898f('0x3e')]);_0x1232dc[_0x898f('0x41')]=qs[_0x898f('0x36')](_[_0x898f('0x4e')](_0x192cc7[_0x898f('0x34')],_0xc9c4cc[_0x898f('0x36')]));if(_0x192cc7[_0x898f('0x34')][_0x898f('0x3f')]){_0x1232dc[_0x898f('0x41')]=_['merge'](_0x1232dc[_0x898f('0x41')],{'$or':_[_0x898f('0x2f')](_0x1232dc['attributes'],function(_0x4df737){var _0x13188b={};_0x13188b[_0x4df737]={'$like':'%'+_0x192cc7[_0x898f('0x34')]['filter']+'%'};return _0x13188b;})});}_0x1232dc=_['merge']({},_0x1232dc,_0x192cc7['options']);return _0x28f596[_0x898f('0x52')](_0x1232dc);}})[_0x898f('0x2b')](function(_0x5af067){if(_0x5af067){_0x200953=_0x5af067[_0x898f('0x47')];if(!_0x192cc7[_0x898f('0x34')]['hasOwnProperty'](_0x898f('0x3c'))){_0x1232dc['limit']=qs['limit'](_0x192cc7[_0x898f('0x34')][_0x898f('0x20')]);_0x1232dc[_0x898f('0x23')]=qs[_0x898f('0x23')](_0x192cc7['query'][_0x898f('0x23')]);}return _0x28f596[_0x898f('0x52')](_0x1232dc);}})['then'](function(_0xcb78){if(_0xcb78){return _0xcb78?{'count':_0x200953,'rows':_0xcb78}:null;}})[_0x898f('0x2b')](respondWithResult(_0x6f10af,null))['catch'](handleError(_0x6f10af,null));}; \ No newline at end of file +var _0xa85e=['json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa85e,0x123));var _0xea85=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xa85e[_0x4a5494];return _0x57cbb5;};'use strict';var emlformat=require(_0xea85('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea85('0x1'));var jsonpatch=require(_0xea85('0x2'));var rp=require('request-promise');var moment=require(_0xea85('0x3'));var BPromise=require(_0xea85('0x4'));var Mustache=require(_0xea85('0x5'));var util=require(_0xea85('0x6'));var path=require(_0xea85('0x7'));var sox=require(_0xea85('0x8'));var csv=require(_0xea85('0x9'));var ejs=require(_0xea85('0xa'));var fs=require('fs');var fs_extra=require(_0xea85('0xb'));var _=require(_0xea85('0xc'));var squel=require(_0xea85('0xd'));var crypto=require(_0xea85('0xe'));var jsforce=require(_0xea85('0xf'));var deskjs=require(_0xea85('0x10'));var toCsv=require('to-csv');var querystring=require(_0xea85('0x11'));var Papa=require(_0xea85('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea85('0x13'));var hardwareService=require(_0xea85('0x14'));var logger=require(_0xea85('0x15'))(_0xea85('0x16'));var utils=require('../../config/utils');var config=require(_0xea85('0x17'));var licenseUtil=require(_0xea85('0x18'));var db=require(_0xea85('0x19'))['db'];function respondWithStatusCode(_0x5f52a5,_0x409f46){_0x409f46=_0x409f46||0xcc;return function(_0x219330){if(_0x219330){return _0x5f52a5[_0xea85('0x1a')](_0x409f46);}return _0x5f52a5[_0xea85('0x1b')](_0x409f46)[_0xea85('0x1c')]();};}function respondWithResult(_0x583ed8,_0x3a5e84){_0x3a5e84=_0x3a5e84||0xc8;return function(_0x41cc68){if(_0x41cc68){return _0x583ed8[_0xea85('0x1b')](_0x3a5e84)[_0xea85('0x1d')](_0x41cc68);}};}function respondWithFilteredResult(_0x541398,_0x489033){return function(_0xaaa9f){if(_0xaaa9f){var _0x2800ed=typeof _0x489033[_0xea85('0x1e')]==='undefined'&&typeof _0x489033[_0xea85('0x1f')]==='undefined';var _0x5ae23e=_0xaaa9f[_0xea85('0x20')];var _0x4ff135=_0x2800ed?0x0:_0x489033[_0xea85('0x1e')];var _0x575e32=_0x2800ed?_0xaaa9f['count']:_0x489033['offset']+_0x489033[_0xea85('0x1f')];var _0x2f7c3a;if(_0x575e32>=_0x5ae23e){_0x575e32=_0x5ae23e;_0x2f7c3a=0xc8;}else{_0x2f7c3a=0xce;}_0x541398[_0xea85('0x1b')](_0x2f7c3a);return _0x541398[_0xea85('0x21')](_0xea85('0x22'),_0x4ff135+'-'+_0x575e32+'/'+_0x5ae23e)[_0xea85('0x1d')](_0xaaa9f);}return null;};}function patchUpdates(_0x29e559){return function(_0x44388b){try{jsonpatch[_0xea85('0x23')](_0x44388b,_0x29e559,!![]);}catch(_0x18b4bf){return BPromise['reject'](_0x18b4bf);}return _0x44388b[_0xea85('0x24')]();};}function saveUpdates(_0x140374,_0x5d3bd2){return function(_0x5960ea){if(_0x5960ea){return _0x5960ea[_0xea85('0x25')](_0x140374)[_0xea85('0x26')](function(_0x487be8){return _0x487be8;});}return null;};}function removeEntity(_0x1f1dab,_0x690dbd){return function(_0xacba02){if(_0xacba02){return _0xacba02[_0xea85('0x27')]()[_0xea85('0x26')](function(){_0x1f1dab[_0xea85('0x1b')](0xcc)[_0xea85('0x1c')]();});}};}function handleEntityNotFound(_0x15240d,_0x168e7e){return function(_0x55a746){if(!_0x55a746){_0x15240d[_0xea85('0x1a')](0x194);}return _0x55a746;};}function handleError(_0x60ec35,_0x4ad5a7){_0x4ad5a7=_0x4ad5a7||0x1f4;return function(_0x5819f9){logger[_0xea85('0x28')](_0x5819f9[_0xea85('0x29')]);if(_0x5819f9[_0xea85('0x2a')]){delete _0x5819f9[_0xea85('0x2a')];}_0x60ec35[_0xea85('0x1b')](_0x4ad5a7)[_0xea85('0x2b')](_0x5819f9);};}exports[_0xea85('0x2c')]=function(_0x45b323,_0x583357){var _0x2f3016={},_0x2da581={},_0x11f54e={'count':0x0,'rows':[]};var _0x5421ee=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x90ab80){return{'name':_0x90ab80['fieldName'],'type':_0x90ab80[_0xea85('0x2d')]['key']};});_0x2da581[_0xea85('0x2e')]=_['map'](_0x5421ee,_0xea85('0x2a'));_0x2da581[_0xea85('0x2f')]=_['keys'](_0x45b323[_0xea85('0x2f')]);_0x2da581[_0xea85('0x30')]=_['intersection'](_0x2da581[_0xea85('0x2e')],_0x2da581[_0xea85('0x2f')]);_0x2f3016[_0xea85('0x31')]=_[_0xea85('0x32')](_0x2da581[_0xea85('0x2e')],qs[_0xea85('0x33')](_0x45b323['query'][_0xea85('0x33')]));_0x2f3016[_0xea85('0x31')]=_0x2f3016[_0xea85('0x31')][_0xea85('0x34')]?_0x2f3016['attributes']:_0x2da581[_0xea85('0x2e')];if(!_0x45b323[_0xea85('0x2f')]['hasOwnProperty'](_0xea85('0x35'))){_0x2f3016[_0xea85('0x1f')]=qs[_0xea85('0x1f')](_0x45b323['query'][_0xea85('0x1f')]);_0x2f3016[_0xea85('0x1e')]=qs['offset'](_0x45b323[_0xea85('0x2f')]['offset']);}_0x2f3016[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x45b323['query'][_0xea85('0x37')]);_0x2f3016[_0xea85('0x38')]=qs['filters'](_['pick'](_0x45b323[_0xea85('0x2f')],_0x2da581['filters']),_0x5421ee);if(_0x45b323['query'][_0xea85('0x39')]){_0x2f3016[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x2f3016['where'],{'$or':_[_0xea85('0x3b')](_0x5421ee,function(_0x51b4c3){if(_0x51b4c3[_0xea85('0x2d')]!==_0xea85('0x3c')){var _0xf4a688={};_0xf4a688[_0x51b4c3['name']]={'$like':'%'+_0x45b323[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0xf4a688;}})});}_0x2f3016=_['merge']({},_0x2f3016,_0x45b323['options']);var _0x12852c={'where':_0x2f3016[_0xea85('0x38')]};return db[_0xea85('0x3d')][_0xea85('0x20')](_0x12852c)[_0xea85('0x26')](function(_0x43fd89){_0x11f54e[_0xea85('0x20')]=_0x43fd89;if(_0x45b323[_0xea85('0x2f')][_0xea85('0x3e')]){_0x2f3016[_0xea85('0x3f')]=[{'all':!![]}];}return db[_0xea85('0x3d')][_0xea85('0x40')](_0x2f3016);})[_0xea85('0x26')](function(_0x47824c){_0x11f54e[_0xea85('0x41')]=_0x47824c;return _0x11f54e;})[_0xea85('0x26')](respondWithFilteredResult(_0x583357,_0x2f3016))[_0xea85('0x42')](handleError(_0x583357,null));};exports['show']=function(_0xe2addf,_0xb3e9f8){var _0x18b6ec={'raw':![],'where':{'id':_0xe2addf[_0xea85('0x43')]['id']}},_0x123f7a={};_0x123f7a[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x3d')][_0xea85('0x45')]);_0x123f7a[_0xea85('0x2f')]=_[_0xea85('0x44')](_0xe2addf['query']);_0x123f7a[_0xea85('0x30')]=_[_0xea85('0x32')](_0x123f7a[_0xea85('0x2e')],_0x123f7a['query']);_0x18b6ec[_0xea85('0x31')]=_[_0xea85('0x32')](_0x123f7a[_0xea85('0x2e')],qs[_0xea85('0x33')](_0xe2addf[_0xea85('0x2f')][_0xea85('0x33')]));_0x18b6ec['attributes']=_0x18b6ec[_0xea85('0x31')]['length']?_0x18b6ec[_0xea85('0x31')]:_0x123f7a[_0xea85('0x2e')];if(_0xe2addf[_0xea85('0x2f')][_0xea85('0x3e')]){_0x18b6ec['include']=[{'all':!![]}];}_0x18b6ec=_[_0xea85('0x3a')]({},_0x18b6ec,_0xe2addf[_0xea85('0x46')]);return db[_0xea85('0x3d')][_0xea85('0x47')](_0x18b6ec)[_0xea85('0x26')](handleEntityNotFound(_0xb3e9f8,null))[_0xea85('0x26')](respondWithResult(_0xb3e9f8,null))['catch'](handleError(_0xb3e9f8,null));};exports[_0xea85('0x48')]=function(_0xf1596b,_0x4442db){return db[_0xea85('0x3d')][_0xea85('0x48')](_0xf1596b[_0xea85('0x49')],{})[_0xea85('0x26')](respondWithResult(_0x4442db,0xc9))[_0xea85('0x42')](handleError(_0x4442db,null));};exports['update']=function(_0x402a75,_0x42e953){if(_0x402a75[_0xea85('0x49')]['id']){delete _0x402a75['body']['id'];}return db[_0xea85('0x3d')][_0xea85('0x47')]({'where':{'id':_0x402a75['params']['id']}})['then'](handleEntityNotFound(_0x42e953,null))[_0xea85('0x26')](saveUpdates(_0x402a75[_0xea85('0x49')],null))['then'](respondWithResult(_0x42e953,null))[_0xea85('0x42')](handleError(_0x42e953,null));};exports[_0xea85('0x27')]=function(_0x2fcaa0,_0x36a3bf){return db[_0xea85('0x3d')][_0xea85('0x47')]({'where':{'id':_0x2fcaa0['params']['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x36a3bf,null))[_0xea85('0x26')](removeEntity(_0x36a3bf,null))['catch'](handleError(_0x36a3bf,null));};exports[_0xea85('0x4a')]=function(_0x37f9af,_0x49a8d7,_0x37ae33){var _0x4f3776={};var _0x41d552={};var _0xbb6d5f;var _0x2c6e2d;return db[_0xea85('0x3d')][_0xea85('0x4b')]({'where':{'id':_0x37f9af[_0xea85('0x43')]['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x49a8d7,null))['then'](function(_0x56a16c){if(_0x56a16c){_0xbb6d5f=_0x56a16c;_0x41d552['model']=_[_0xea85('0x44')](db[_0xea85('0x4c')][_0xea85('0x45')]);_0x41d552[_0xea85('0x2f')]=_[_0xea85('0x44')](_0x37f9af['query']);_0x41d552[_0xea85('0x30')]=_[_0xea85('0x32')](_0x41d552[_0xea85('0x2e')],_0x41d552[_0xea85('0x2f')]);_0x4f3776[_0xea85('0x31')]=_['intersection'](_0x41d552[_0xea85('0x2e')],qs[_0xea85('0x33')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x33')]));_0x4f3776['attributes']=_0x4f3776[_0xea85('0x31')]['length']?_0x4f3776[_0xea85('0x31')]:_0x41d552[_0xea85('0x2e')];_0x4f3776[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x37')]);_0x4f3776['where']=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x37f9af[_0xea85('0x2f')],_0x41d552['filters']));if(_0x37f9af[_0xea85('0x2f')][_0xea85('0x39')]){_0x4f3776[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x4f3776[_0xea85('0x38')],{'$or':_[_0xea85('0x3b')](_0x4f3776['attributes'],function(_0xe1cc06){var _0x162c6b={};_0x162c6b[_0xe1cc06]={'$like':'%'+_0x37f9af[_0xea85('0x2f')]['filter']+'%'};return _0x162c6b;})});}_0x4f3776=_[_0xea85('0x3a')]({},_0x4f3776,_0x37f9af['options']);return _0xbb6d5f[_0xea85('0x4a')](_0x4f3776);}})['then'](function(_0x405e6e){if(_0x405e6e){_0x2c6e2d=_0x405e6e[_0xea85('0x34')];if(!_0x37f9af[_0xea85('0x2f')]['hasOwnProperty']('nolimit')){_0x4f3776[_0xea85('0x1f')]=qs[_0xea85('0x1f')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x1f')]);_0x4f3776[_0xea85('0x1e')]=qs[_0xea85('0x1e')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x1e')]);}return _0xbb6d5f[_0xea85('0x4a')](_0x4f3776);}})[_0xea85('0x26')](function(_0x3098e1){if(_0x3098e1){return _0x3098e1?{'count':_0x2c6e2d,'rows':_0x3098e1}:null;}})['then'](respondWithResult(_0x49a8d7,null))[_0xea85('0x42')](handleError(_0x49a8d7,null));};exports['getDescriptions']=function(_0x466625,_0xae61a4,_0x556cc3){var _0x5955a0={};var _0x3f7a96={};var _0x329710;var _0xf5b214;return db[_0xea85('0x3d')][_0xea85('0x4b')]({'where':{'id':_0x466625['params']['id']}})[_0xea85('0x26')](handleEntityNotFound(_0xae61a4,null))['then'](function(_0xcce7de){if(_0xcce7de){_0x329710=_0xcce7de;_0x3f7a96[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x4c')][_0xea85('0x45')]);_0x3f7a96[_0xea85('0x2f')]=_['keys'](_0x466625[_0xea85('0x2f')]);_0x3f7a96[_0xea85('0x30')]=_[_0xea85('0x32')](_0x3f7a96[_0xea85('0x2e')],_0x3f7a96[_0xea85('0x2f')]);_0x5955a0[_0xea85('0x31')]=_[_0xea85('0x32')](_0x3f7a96[_0xea85('0x2e')],qs['fields'](_0x466625[_0xea85('0x2f')]['fields']));_0x5955a0['attributes']=_0x5955a0[_0xea85('0x31')][_0xea85('0x34')]?_0x5955a0[_0xea85('0x31')]:_0x3f7a96[_0xea85('0x2e')];_0x5955a0[_0xea85('0x36')]=qs['sort'](_0x466625[_0xea85('0x2f')][_0xea85('0x37')]);_0x5955a0[_0xea85('0x38')]=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x466625[_0xea85('0x2f')],_0x3f7a96[_0xea85('0x30')]));if(_0x466625['query'][_0xea85('0x39')]){_0x5955a0[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x5955a0[_0xea85('0x38')],{'$or':_[_0xea85('0x3b')](_0x5955a0[_0xea85('0x31')],function(_0x3188ba){var _0x2ea2a9={};_0x2ea2a9[_0x3188ba]={'$like':'%'+_0x466625[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0x2ea2a9;})});}_0x5955a0=_[_0xea85('0x3a')]({},_0x5955a0,_0x466625['options']);return _0x329710['getDescriptions'](_0x5955a0);}})[_0xea85('0x26')](function(_0x48c7e4){if(_0x48c7e4){_0xf5b214=_0x48c7e4[_0xea85('0x34')];if(!_0x466625[_0xea85('0x2f')][_0xea85('0x4e')](_0xea85('0x35'))){_0x5955a0[_0xea85('0x1f')]=qs['limit'](_0x466625[_0xea85('0x2f')][_0xea85('0x1f')]);_0x5955a0['offset']=qs[_0xea85('0x1e')](_0x466625[_0xea85('0x2f')][_0xea85('0x1e')]);}return _0x329710['getDescriptions'](_0x5955a0);}})[_0xea85('0x26')](function(_0x473c5e){if(_0x473c5e){return _0x473c5e?{'count':_0xf5b214,'rows':_0x473c5e}:null;}})[_0xea85('0x26')](respondWithResult(_0xae61a4,null))['catch'](handleError(_0xae61a4,null));};exports['getFields']=function(_0x59a71f,_0x52210c,_0x3d4ff5){var _0x4d0014={};var _0x5caca0={};var _0x5cd185;var _0x10aeec;return db[_0xea85('0x3d')]['findOne']({'where':{'id':_0x59a71f[_0xea85('0x43')]['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x52210c,null))[_0xea85('0x26')](function(_0x2ca2d2){if(_0x2ca2d2){_0x5cd185=_0x2ca2d2;_0x5caca0[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x4c')]['rawAttributes']);_0x5caca0[_0xea85('0x2f')]=_[_0xea85('0x44')](_0x59a71f[_0xea85('0x2f')]);_0x5caca0['filters']=_[_0xea85('0x32')](_0x5caca0[_0xea85('0x2e')],_0x5caca0[_0xea85('0x2f')]);_0x4d0014[_0xea85('0x31')]=_[_0xea85('0x32')](_0x5caca0[_0xea85('0x2e')],qs['fields'](_0x59a71f[_0xea85('0x2f')][_0xea85('0x33')]));_0x4d0014[_0xea85('0x31')]=_0x4d0014[_0xea85('0x31')][_0xea85('0x34')]?_0x4d0014[_0xea85('0x31')]:_0x5caca0[_0xea85('0x2e')];_0x4d0014[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x59a71f[_0xea85('0x2f')][_0xea85('0x37')]);_0x4d0014[_0xea85('0x38')]=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x59a71f[_0xea85('0x2f')],_0x5caca0[_0xea85('0x30')]));if(_0x59a71f[_0xea85('0x2f')][_0xea85('0x39')]){_0x4d0014[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x4d0014['where'],{'$or':_[_0xea85('0x3b')](_0x4d0014[_0xea85('0x31')],function(_0x3e32ce){var _0x5cea35={};_0x5cea35[_0x3e32ce]={'$like':'%'+_0x59a71f[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0x5cea35;})});}_0x4d0014=_['merge']({},_0x4d0014,_0x59a71f['options']);return _0x5cd185['getFields'](_0x4d0014);}})[_0xea85('0x26')](function(_0x1393fd){if(_0x1393fd){_0x10aeec=_0x1393fd[_0xea85('0x34')];if(!_0x59a71f['query'][_0xea85('0x4e')](_0xea85('0x35'))){_0x4d0014['limit']=qs[_0xea85('0x1f')](_0x59a71f[_0xea85('0x2f')][_0xea85('0x1f')]);_0x4d0014[_0xea85('0x1e')]=qs[_0xea85('0x1e')](_0x59a71f[_0xea85('0x2f')]['offset']);}return _0x5cd185[_0xea85('0x4f')](_0x4d0014);}})[_0xea85('0x26')](function(_0xf25fe9){if(_0xf25fe9){return _0xf25fe9?{'count':_0x10aeec,'rows':_0xf25fe9}:null;}})[_0xea85('0x26')](respondWithResult(_0x52210c,null))[_0xea85('0x42')](handleError(_0x52210c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0c88274..a124b57 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 _0x7d4a=['lodash','util','../../config/logger','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x7d4a,0xc8));var _0xa7d4=function(_0x9bb8a,_0x504c24){_0x9bb8a=_0x9bb8a-0x0;var _0x3b5b34=_0x7d4a[_0x9bb8a];return _0x3b5b34;};'use strict';var _=require(_0xa7d4('0x0'));var util=require(_0xa7d4('0x1'));var logger=require(_0xa7d4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa7d4('0x3'));var fs=require('fs');var path=require(_0xa7d4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa7d4('0x5'));module[_0xa7d4('0x6')]=function(_0x34b075,_0x52d1ec){return _0x34b075[_0xa7d4('0x7')](_0xa7d4('0x8'),attributes,{'tableName':_0xa7d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac2=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x40042d,_0x3ce810){var _0x3889a1=function(_0x2fdcbb){while(--_0x2fdcbb){_0x40042d['push'](_0x40042d['shift']());}};_0x3889a1(++_0x3ce810);}(_0x7ac2,0x8e));var _0x27ac=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x7ac2[_0x21bfab];return _0x4db318;};'use strict';var _=require(_0x27ac('0x0'));var util=require(_0x27ac('0x1'));var logger=require(_0x27ac('0x2'))(_0x27ac('0x3'));var moment=require(_0x27ac('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x27ac('0x5'));var rimraf=require(_0x27ac('0x6'));var config=require(_0x27ac('0x7'));var attributes=require(_0x27ac('0x8'));module[_0x27ac('0x9')]=function(_0x685d5e,_0x259710){return _0x685d5e[_0x27ac('0xa')](_0x27ac('0xb'),attributes,{'tableName':_0x27ac('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 8886c52..c983255 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 _0xf2af=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x97eb75,_0x17c7c5){var _0x5bb240=function(_0x2d5856){while(--_0x2d5856){_0x97eb75['push'](_0x97eb75['shift']());}};_0x5bb240(++_0x17c7c5);}(_0xf2af,0x164));var _0xff2a=function(_0x2297a3,_0x6f5189){_0x2297a3=_0x2297a3-0x0;var _0x78fae7=_0xf2af[_0x2297a3];return _0x78fae7;};'use strict';var _=require(_0xff2a('0x0'));var util=require(_0xff2a('0x1'));var moment=require('moment');var BPromise=require(_0xff2a('0x2'));var rs=require(_0xff2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff2a('0x4'))['db'];var utils=require(_0xff2a('0x5'));var logger=require(_0xff2a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff2a('0x7'));var client=jayson[_0xff2a('0x8')][_0xff2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f6bf,_0x618464,_0x504ccc){return new BPromise(function(_0x2cf0a4,_0x1d0b98){return client['request'](_0x35f6bf,_0x504ccc)[_0xff2a('0xa')](function(_0x15396e){logger[_0xff2a('0xb')](_0xff2a('0xc'),_0x618464,_0xff2a('0xd'));logger[_0xff2a('0xe')](_0xff2a('0xf'),_0x618464,'request\x20sent',JSON[_0xff2a('0x10')](_0x15396e));if(_0x15396e['error']){if(_0x15396e['error']['code']===0x1f4){logger[_0xff2a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x618464,_0x15396e[_0xff2a('0x11')][_0xff2a('0x12')]);return _0x1d0b98(_0x15396e[_0xff2a('0x11')][_0xff2a('0x12')]);}logger[_0xff2a('0x11')](_0xff2a('0xc'),_0x618464,_0x15396e[_0xff2a('0x11')]['message']);return _0x2cf0a4(_0x15396e[_0xff2a('0x11')][_0xff2a('0x12')]);}else{logger[_0xff2a('0xb')](_0xff2a('0xc'),_0x618464,_0xff2a('0xd'));_0x2cf0a4(_0x15396e[_0xff2a('0x13')]['message']);}})[_0xff2a('0x14')](function(_0x298d98){logger[_0xff2a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x618464,_0x298d98);_0x1d0b98(_0x298d98);});});} \ No newline at end of file +var _0xc080=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5be4fa,_0x2436a8){var _0x10940c=function(_0x3df19e){while(--_0x3df19e){_0x5be4fa['push'](_0x5be4fa['shift']());}};_0x10940c(++_0x2436a8);}(_0xc080,0xe6));var _0x0c08=function(_0x29f562,_0x10d66c){_0x29f562=_0x29f562-0x0;var _0x2d4e21=_0xc080[_0x29f562];return _0x2d4e21;};'use strict';var _=require(_0x0c08('0x0'));var util=require(_0x0c08('0x1'));var moment=require(_0x0c08('0x2'));var BPromise=require(_0x0c08('0x3'));var rs=require(_0x0c08('0x4'));var fs=require('fs');var Redis=require(_0x0c08('0x5'));var db=require(_0x0c08('0x6'))['db'];var utils=require(_0x0c08('0x7'));var logger=require('../../config/logger')(_0x0c08('0x8'));var config=require(_0x0c08('0x9'));var jayson=require(_0x0c08('0xa'));var client=jayson[_0x0c08('0xb')][_0x0c08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21549b,_0x52f7cc,_0x434b7a){return new BPromise(function(_0x35dacd,_0x1493e2){return client[_0x0c08('0xd')](_0x21549b,_0x434b7a)[_0x0c08('0xe')](function(_0x1ab3ad){logger[_0x0c08('0xf')](_0x0c08('0x10'),_0x52f7cc,_0x0c08('0x11'));logger[_0x0c08('0x12')](_0x0c08('0x13'),_0x52f7cc,_0x0c08('0x11'),JSON[_0x0c08('0x14')](_0x1ab3ad));if(_0x1ab3ad[_0x0c08('0x15')]){if(_0x1ab3ad[_0x0c08('0x15')]['code']===0x1f4){logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x1ab3ad[_0x0c08('0x15')]['message']);return _0x1493e2(_0x1ab3ad['error'][_0x0c08('0x16')]);}logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x1ab3ad['error']['message']);return _0x35dacd(_0x1ab3ad[_0x0c08('0x15')][_0x0c08('0x16')]);}else{logger[_0x0c08('0xf')](_0x0c08('0x10'),_0x52f7cc,_0x0c08('0x11'));_0x35dacd(_0x1ab3ad[_0x0c08('0x17')]['message']);}})['catch'](function(_0x566773){logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x566773);_0x1493e2(_0x566773);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ec5e5bf..554a01c 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 _0xac65=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x49f10e,_0x5a0751){var _0x1fdb0e=function(_0x291bc8){while(--_0x291bc8){_0x49f10e['push'](_0x49f10e['shift']());}};_0x1fdb0e(++_0x5a0751);}(_0xac65,0x11d));var _0x5ac6=function(_0x3693de,_0x5f1340){_0x3693de=_0x3693de-0x0;var _0x2604d6=_0xac65[_0x3693de];return _0x2604d6;};'use strict';var multer=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var path=require(_0x5ac6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ac6('0x3'));var router=express[_0x5ac6('0x4')]();var fs_extra=require(_0x5ac6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var controller=require(_0x5ac6('0x8'));router['get']('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xa')]);router[_0x5ac6('0xb')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xd')]);router[_0x5ac6('0xe')]('/',auth[_0x5ac6('0x9')](),controller[_0x5ac6('0xf')]);router[_0x5ac6('0x10')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x11')]);router[_0x5ac6('0x12')](_0x5ac6('0xc'),auth[_0x5ac6('0x9')](),controller[_0x5ac6('0x13')]);module[_0x5ac6('0x14')]=router; \ No newline at end of file +var _0xe630=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2d57f5,_0x52973e){var _0x4a4198=function(_0x4db3c7){while(--_0x4db3c7){_0x2d57f5['push'](_0x2d57f5['shift']());}};_0x4a4198(++_0x52973e);}(_0xe630,0x149));var _0x0e63=function(_0x3a8b41,_0x122312){_0x3a8b41=_0x3a8b41-0x0;var _0x19cb35=_0xe630[_0x3a8b41];return _0x19cb35;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0xd')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0xf')](_0x0e63('0xb'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x11')](_0x0e63('0xb'),auth[_0x0e63('0x9')](),controller['destroy']);module[_0x0e63('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2db2192..20a01d8 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 _0xc57c=['picklist','STRING','ENUM','sequelize','string','variable','customVariable','keyValue'];(function(_0x5b3933,_0x318159){var _0x3d15ad=function(_0x45dbb8){while(--_0x45dbb8){_0x5b3933['push'](_0x5b3933['shift']());}};_0x3d15ad(++_0x318159);}(_0xc57c,0x1b3));var _0xcc57=function(_0x211e99,_0x308b2a){_0x211e99=_0x211e99-0x0;var _0x1b403b=_0xc57c[_0x211e99];return _0x1b403b;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xcc57('0x1'),_0xcc57('0x2'),_0xcc57('0x3'),_0xcc57('0x4'),_0xcc57('0x5')),'defaultValue':_0xcc57('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcc57('0x6')]},'keyType':{'type':Sequelize[_0xcc57('0x7')]('string',_0xcc57('0x2'),_0xcc57('0x3'))},'keyContent':{'type':Sequelize[_0xcc57('0x6')]},'idField':{'type':Sequelize[_0xcc57('0x6')]},'nameField':{'type':Sequelize[_0xcc57('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc57('0x6')]}}; \ No newline at end of file +var _0xa7a9=['ENUM','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x210549,_0x271b24){var _0x340067=function(_0x4591a5){while(--_0x4591a5){_0x210549['push'](_0x210549['shift']());}};_0x340067(++_0x271b24);}(_0xa7a9,0x1dd));var _0x9a7a=function(_0x314079,_0x49341a){_0x314079=_0x314079-0x0;var _0x2a18d3=_0xa7a9[_0x314079];return _0x2a18d3;};'use strict';var Sequelize=require('sequelize');module[_0x9a7a('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9a7a('0x1'),_0x9a7a('0x2'),_0x9a7a('0x3'),_0x9a7a('0x4'),'picklist'),'defaultValue':_0x9a7a('0x1')},'content':{'type':Sequelize[_0x9a7a('0x5')]},'key':{'type':Sequelize[_0x9a7a('0x5')]},'keyType':{'type':Sequelize[_0x9a7a('0x6')](_0x9a7a('0x1'),_0x9a7a('0x2'),_0x9a7a('0x3'))},'keyContent':{'type':Sequelize[_0x9a7a('0x5')]},'idField':{'type':Sequelize[_0x9a7a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a7a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 295f229..d6a45ef 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 _0xd0c7=['rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','reject','save','update','then','error','stack','send','key','map','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','keys','FreshsalesField'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd0c7,0x172));var _0x7d0c=function(_0x2c1fcc,_0x3a9ae7){_0x2c1fcc=_0x2c1fcc-0x0;var _0x3e2503=_0xd0c7[_0x2c1fcc];return _0x3e2503;};'use strict';var emlformat=require(_0x7d0c('0x0'));var rimraf=require(_0x7d0c('0x1'));var zipdir=require(_0x7d0c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d0c('0x3'));var BPromise=require(_0x7d0c('0x4'));var Mustache=require(_0x7d0c('0x5'));var util=require(_0x7d0c('0x6'));var path=require(_0x7d0c('0x7'));var sox=require(_0x7d0c('0x8'));var csv=require(_0x7d0c('0x9'));var ejs=require(_0x7d0c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d0c('0xb'));var squel=require(_0x7d0c('0xc'));var crypto=require(_0x7d0c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7d0c('0x9'));var querystring=require('querystring');var Papa=require(_0x7d0c('0xe'));var Redis=require(_0x7d0c('0xf'));var authService=require(_0x7d0c('0x10'));var qs=require(_0x7d0c('0x11'));var as=require(_0x7d0c('0x12'));var hardwareService=require(_0x7d0c('0x13'));var logger=require(_0x7d0c('0x14'))(_0x7d0c('0x15'));var utils=require(_0x7d0c('0x16'));var config=require(_0x7d0c('0x17'));var licenseUtil=require(_0x7d0c('0x18'));var db=require(_0x7d0c('0x19'))['db'];function respondWithStatusCode(_0x48e7ef,_0x25304e){_0x25304e=_0x25304e||0xcc;return function(_0x2233de){if(_0x2233de){return _0x48e7ef[_0x7d0c('0x1a')](_0x25304e);}return _0x48e7ef[_0x7d0c('0x1b')](_0x25304e)[_0x7d0c('0x1c')]();};}function respondWithResult(_0x3aa2f5,_0x1f31e1){_0x1f31e1=_0x1f31e1||0xc8;return function(_0x113b57){if(_0x113b57){return _0x3aa2f5[_0x7d0c('0x1b')](_0x1f31e1)[_0x7d0c('0x1d')](_0x113b57);}};}function respondWithFilteredResult(_0x17dc9f,_0x2d9b3a){return function(_0x34b1ff){if(_0x34b1ff){var _0x1ef0dc=typeof _0x2d9b3a[_0x7d0c('0x1e')]===_0x7d0c('0x1f')&&typeof _0x2d9b3a[_0x7d0c('0x20')]===_0x7d0c('0x1f');var _0x1f9ffd=_0x34b1ff[_0x7d0c('0x21')];var _0x435979=_0x1ef0dc?0x0:_0x2d9b3a[_0x7d0c('0x1e')];var _0x327a9d=_0x1ef0dc?_0x34b1ff['count']:_0x2d9b3a[_0x7d0c('0x1e')]+_0x2d9b3a['limit'];var _0x5c20d8;if(_0x327a9d>=_0x1f9ffd){_0x327a9d=_0x1f9ffd;_0x5c20d8=0xc8;}else{_0x5c20d8=0xce;}_0x17dc9f[_0x7d0c('0x1b')](_0x5c20d8);return _0x17dc9f[_0x7d0c('0x22')]('Content-Range',_0x435979+'-'+_0x327a9d+'/'+_0x1f9ffd)[_0x7d0c('0x1d')](_0x34b1ff);}return null;};}function patchUpdates(_0x476f5c){return function(_0x140166){try{jsonpatch['apply'](_0x140166,_0x476f5c,!![]);}catch(_0x5efc76){return BPromise[_0x7d0c('0x23')](_0x5efc76);}return _0x140166[_0x7d0c('0x24')]();};}function saveUpdates(_0x1d34e0,_0x139c3d){return function(_0x487886){if(_0x487886){return _0x487886[_0x7d0c('0x25')](_0x1d34e0)[_0x7d0c('0x26')](function(_0x48b5d2){return _0x48b5d2;});}return null;};}function removeEntity(_0x99dd33,_0x56985c){return function(_0x55985f){if(_0x55985f){return _0x55985f['destroy']()[_0x7d0c('0x26')](function(){_0x99dd33[_0x7d0c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee36b,_0x153240){return function(_0x1a1c7b){if(!_0x1a1c7b){_0x1ee36b['sendStatus'](0x194);}return _0x1a1c7b;};}function handleError(_0xf3eb98,_0x5c3bdf){_0x5c3bdf=_0x5c3bdf||0x1f4;return function(_0x1fed65){logger[_0x7d0c('0x27')](_0x1fed65[_0x7d0c('0x28')]);if(_0x1fed65['name']){delete _0x1fed65['name'];}_0xf3eb98['status'](_0x5c3bdf)[_0x7d0c('0x29')](_0x1fed65);};}exports['index']=function(_0x3a14bf,_0x52a015){var _0x1a2f17={},_0x5c9524={},_0x141ebb={'count':0x0,'rows':[]};var _0x3a898f=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x44cbb4){return{'name':_0x44cbb4['fieldName'],'type':_0x44cbb4['type'][_0x7d0c('0x2a')]};});_0x5c9524['model']=_[_0x7d0c('0x2b')](_0x3a898f,_0x7d0c('0x2c'));_0x5c9524[_0x7d0c('0x2d')]=_['keys'](_0x3a14bf[_0x7d0c('0x2d')]);_0x5c9524[_0x7d0c('0x2e')]=_[_0x7d0c('0x2f')](_0x5c9524[_0x7d0c('0x30')],_0x5c9524['query']);_0x1a2f17['attributes']=_[_0x7d0c('0x2f')](_0x5c9524[_0x7d0c('0x30')],qs['fields'](_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x31')]));_0x1a2f17[_0x7d0c('0x32')]=_0x1a2f17['attributes'][_0x7d0c('0x33')]?_0x1a2f17['attributes']:_0x5c9524['model'];if(!_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x34')]('nolimit')){_0x1a2f17['limit']=qs[_0x7d0c('0x20')](_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x20')]);_0x1a2f17[_0x7d0c('0x1e')]=qs[_0x7d0c('0x1e')](_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x1e')]);}_0x1a2f17[_0x7d0c('0x35')]=qs[_0x7d0c('0x36')](_0x3a14bf['query'][_0x7d0c('0x36')]);_0x1a2f17['where']=qs[_0x7d0c('0x2e')](_[_0x7d0c('0x37')](_0x3a14bf[_0x7d0c('0x2d')],_0x5c9524[_0x7d0c('0x2e')]),_0x3a898f);if(_0x3a14bf[_0x7d0c('0x2d')]['filter']){_0x1a2f17[_0x7d0c('0x38')]=_[_0x7d0c('0x39')](_0x1a2f17[_0x7d0c('0x38')],{'$or':_['map'](_0x3a898f,function(_0x28e076){if(_0x28e076['type']!==_0x7d0c('0x3a')){var _0x3bfb7f={};_0x3bfb7f[_0x28e076['name']]={'$like':'%'+_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x3b')]+'%'};return _0x3bfb7f;}})});}_0x1a2f17=_[_0x7d0c('0x39')]({},_0x1a2f17,_0x3a14bf[_0x7d0c('0x3c')]);var _0x3f3da2={'where':_0x1a2f17[_0x7d0c('0x38')]};return db['FreshsalesField'][_0x7d0c('0x21')](_0x3f3da2)['then'](function(_0x221125){_0x141ebb[_0x7d0c('0x21')]=_0x221125;if(_0x3a14bf[_0x7d0c('0x2d')][_0x7d0c('0x3d')]){_0x1a2f17[_0x7d0c('0x3e')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x1a2f17);})[_0x7d0c('0x26')](function(_0x396f83){_0x141ebb[_0x7d0c('0x3f')]=_0x396f83;return _0x141ebb;})[_0x7d0c('0x26')](respondWithFilteredResult(_0x52a015,_0x1a2f17))[_0x7d0c('0x40')](handleError(_0x52a015,null));};exports['show']=function(_0xc2ec8f,_0x5de2e1){var _0x131aec={'raw':!![],'where':{'id':_0xc2ec8f[_0x7d0c('0x41')]['id']}},_0x24e7d3={};_0x24e7d3[_0x7d0c('0x30')]=_[_0x7d0c('0x42')](db[_0x7d0c('0x43')][_0x7d0c('0x44')]);_0x24e7d3[_0x7d0c('0x2d')]=_[_0x7d0c('0x42')](_0xc2ec8f['query']);_0x24e7d3[_0x7d0c('0x2e')]=_[_0x7d0c('0x2f')](_0x24e7d3['model'],_0x24e7d3[_0x7d0c('0x2d')]);_0x131aec[_0x7d0c('0x32')]=_['intersection'](_0x24e7d3['model'],qs[_0x7d0c('0x31')](_0xc2ec8f[_0x7d0c('0x2d')][_0x7d0c('0x31')]));_0x131aec['attributes']=_0x131aec[_0x7d0c('0x32')][_0x7d0c('0x33')]?_0x131aec[_0x7d0c('0x32')]:_0x24e7d3['model'];if(_0xc2ec8f['query'][_0x7d0c('0x3d')]){_0x131aec[_0x7d0c('0x3e')]=[{'all':!![]}];}_0x131aec=_[_0x7d0c('0x39')]({},_0x131aec,_0xc2ec8f[_0x7d0c('0x3c')]);return db['FreshsalesField'][_0x7d0c('0x45')](_0x131aec)['then'](handleEntityNotFound(_0x5de2e1,null))[_0x7d0c('0x26')](respondWithResult(_0x5de2e1,null))[_0x7d0c('0x40')](handleError(_0x5de2e1,null));};exports[_0x7d0c('0x46')]=function(_0x166cab,_0x2fe40f){return db[_0x7d0c('0x43')][_0x7d0c('0x46')](_0x166cab[_0x7d0c('0x47')],{})['then'](respondWithResult(_0x2fe40f,0xc9))['catch'](handleError(_0x2fe40f,null));};exports[_0x7d0c('0x25')]=function(_0x1c0c63,_0x555524){if(_0x1c0c63[_0x7d0c('0x47')]['id']){delete _0x1c0c63[_0x7d0c('0x47')]['id'];}return db[_0x7d0c('0x43')]['find']({'where':{'id':_0x1c0c63[_0x7d0c('0x41')]['id']}})[_0x7d0c('0x26')](handleEntityNotFound(_0x555524,null))[_0x7d0c('0x26')](saveUpdates(_0x1c0c63[_0x7d0c('0x47')],null))[_0x7d0c('0x26')](respondWithResult(_0x555524,null))[_0x7d0c('0x40')](handleError(_0x555524,null));};exports[_0x7d0c('0x48')]=function(_0x23bc7c,_0x505d05){return db[_0x7d0c('0x43')][_0x7d0c('0x45')]({'where':{'id':_0x23bc7c[_0x7d0c('0x41')]['id']}})[_0x7d0c('0x26')](handleEntityNotFound(_0x505d05,null))[_0x7d0c('0x26')](removeEntity(_0x505d05,null))[_0x7d0c('0x40')](handleError(_0x505d05,null));}; \ No newline at end of file +var _0x1408=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','then','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','FreshsalesField','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2e3aef,_0x4202d2){var _0x1502d2=function(_0x28d5a2){while(--_0x28d5a2){_0x2e3aef['push'](_0x2e3aef['shift']());}};_0x1502d2(++_0x4202d2);}(_0x1408,0x114));var _0x8140=function(_0x4cf1d3,_0x48b8ce){_0x4cf1d3=_0x4cf1d3-0x0;var _0x5655d8=_0x1408[_0x4cf1d3];return _0x5655d8;};'use strict';var emlformat=require(_0x8140('0x0'));var rimraf=require(_0x8140('0x1'));var zipdir=require(_0x8140('0x2'));var jsonpatch=require(_0x8140('0x3'));var rp=require(_0x8140('0x4'));var moment=require('moment');var BPromise=require(_0x8140('0x5'));var Mustache=require(_0x8140('0x6'));var util=require(_0x8140('0x7'));var path=require(_0x8140('0x8'));var sox=require(_0x8140('0x9'));var csv=require(_0x8140('0xa'));var ejs=require(_0x8140('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8140('0xc'));var squel=require(_0x8140('0xd'));var crypto=require(_0x8140('0xe'));var jsforce=require(_0x8140('0xf'));var deskjs=require(_0x8140('0x10'));var toCsv=require(_0x8140('0xa'));var querystring=require(_0x8140('0x11'));var Papa=require(_0x8140('0x12'));var Redis=require(_0x8140('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8140('0x14'));var hardwareService=require(_0x8140('0x15'));var logger=require(_0x8140('0x16'))(_0x8140('0x17'));var utils=require(_0x8140('0x18'));var config=require(_0x8140('0x19'));var licenseUtil=require(_0x8140('0x1a'));var db=require(_0x8140('0x1b'))['db'];function respondWithStatusCode(_0xea4bac,_0x12435c){_0x12435c=_0x12435c||0xcc;return function(_0x4f62bd){if(_0x4f62bd){return _0xea4bac[_0x8140('0x1c')](_0x12435c);}return _0xea4bac[_0x8140('0x1d')](_0x12435c)['end']();};}function respondWithResult(_0x2660b5,_0x333774){_0x333774=_0x333774||0xc8;return function(_0xc9bce0){if(_0xc9bce0){return _0x2660b5[_0x8140('0x1d')](_0x333774)[_0x8140('0x1e')](_0xc9bce0);}};}function respondWithFilteredResult(_0x29b1fd,_0x32ea57){return function(_0x138152){if(_0x138152){var _0x45676a=typeof _0x32ea57['offset']===_0x8140('0x1f')&&typeof _0x32ea57[_0x8140('0x20')]==='undefined';var _0x353430=_0x138152['count'];var _0x5986eb=_0x45676a?0x0:_0x32ea57[_0x8140('0x21')];var _0x174760=_0x45676a?_0x138152[_0x8140('0x22')]:_0x32ea57[_0x8140('0x21')]+_0x32ea57[_0x8140('0x20')];var _0x1293f7;if(_0x174760>=_0x353430){_0x174760=_0x353430;_0x1293f7=0xc8;}else{_0x1293f7=0xce;}_0x29b1fd[_0x8140('0x1d')](_0x1293f7);return _0x29b1fd[_0x8140('0x23')](_0x8140('0x24'),_0x5986eb+'-'+_0x174760+'/'+_0x353430)[_0x8140('0x1e')](_0x138152);}return null;};}function patchUpdates(_0x10cb93){return function(_0x13f27c){try{jsonpatch['apply'](_0x13f27c,_0x10cb93,!![]);}catch(_0x34e6a9){return BPromise[_0x8140('0x25')](_0x34e6a9);}return _0x13f27c[_0x8140('0x26')]();};}function saveUpdates(_0x4665d1,_0x432aaf){return function(_0x2e3c85){if(_0x2e3c85){return _0x2e3c85[_0x8140('0x27')](_0x4665d1)['then'](function(_0x36b625){return _0x36b625;});}return null;};}function removeEntity(_0x357fef,_0x414405){return function(_0x478259){if(_0x478259){return _0x478259[_0x8140('0x28')]()[_0x8140('0x29')](function(){_0x357fef[_0x8140('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ef4f,_0x1e4030){return function(_0x23f9ae){if(!_0x23f9ae){_0x23ef4f[_0x8140('0x1c')](0x194);}return _0x23f9ae;};}function handleError(_0x574986,_0xa0a80c){_0xa0a80c=_0xa0a80c||0x1f4;return function(_0x57d682){logger['error'](_0x57d682[_0x8140('0x2a')]);if(_0x57d682[_0x8140('0x2b')]){delete _0x57d682[_0x8140('0x2b')];}_0x574986[_0x8140('0x1d')](_0xa0a80c)['send'](_0x57d682);};}exports[_0x8140('0x2c')]=function(_0x35120a,_0x6310d7){var _0xaa98e4={},_0x42ee58={},_0x959e2f={'count':0x0,'rows':[]};var _0x48568a=_['map'](db['FreshsalesField'][_0x8140('0x2d')],function(_0x1ed0fa){return{'name':_0x1ed0fa[_0x8140('0x2e')],'type':_0x1ed0fa[_0x8140('0x2f')][_0x8140('0x30')]};});_0x42ee58[_0x8140('0x31')]=_[_0x8140('0x32')](_0x48568a,_0x8140('0x2b'));_0x42ee58['query']=_[_0x8140('0x33')](_0x35120a[_0x8140('0x34')]);_0x42ee58[_0x8140('0x35')]=_[_0x8140('0x36')](_0x42ee58[_0x8140('0x31')],_0x42ee58[_0x8140('0x34')]);_0xaa98e4[_0x8140('0x37')]=_[_0x8140('0x36')](_0x42ee58['model'],qs[_0x8140('0x38')](_0x35120a[_0x8140('0x34')][_0x8140('0x38')]));_0xaa98e4[_0x8140('0x37')]=_0xaa98e4[_0x8140('0x37')][_0x8140('0x39')]?_0xaa98e4['attributes']:_0x42ee58[_0x8140('0x31')];if(!_0x35120a[_0x8140('0x34')][_0x8140('0x3a')]('nolimit')){_0xaa98e4[_0x8140('0x20')]=qs[_0x8140('0x20')](_0x35120a[_0x8140('0x34')]['limit']);_0xaa98e4[_0x8140('0x21')]=qs[_0x8140('0x21')](_0x35120a[_0x8140('0x34')][_0x8140('0x21')]);}_0xaa98e4['order']=qs[_0x8140('0x3b')](_0x35120a[_0x8140('0x34')][_0x8140('0x3b')]);_0xaa98e4[_0x8140('0x3c')]=qs['filters'](_['pick'](_0x35120a[_0x8140('0x34')],_0x42ee58[_0x8140('0x35')]),_0x48568a);if(_0x35120a[_0x8140('0x34')][_0x8140('0x3d')]){_0xaa98e4['where']=_[_0x8140('0x3e')](_0xaa98e4[_0x8140('0x3c')],{'$or':_[_0x8140('0x32')](_0x48568a,function(_0x2a8dd3){if(_0x2a8dd3[_0x8140('0x2f')]!==_0x8140('0x3f')){var _0x44d4f0={};_0x44d4f0[_0x2a8dd3[_0x8140('0x2b')]]={'$like':'%'+_0x35120a[_0x8140('0x34')]['filter']+'%'};return _0x44d4f0;}})});}_0xaa98e4=_[_0x8140('0x3e')]({},_0xaa98e4,_0x35120a['options']);var _0xb63107={'where':_0xaa98e4[_0x8140('0x3c')]};return db['FreshsalesField']['count'](_0xb63107)[_0x8140('0x29')](function(_0x356c9e){_0x959e2f['count']=_0x356c9e;if(_0x35120a[_0x8140('0x34')][_0x8140('0x40')]){_0xaa98e4[_0x8140('0x41')]=[{'all':!![]}];}return db[_0x8140('0x42')][_0x8140('0x43')](_0xaa98e4);})[_0x8140('0x29')](function(_0x120348){_0x959e2f['rows']=_0x120348;return _0x959e2f;})[_0x8140('0x29')](respondWithFilteredResult(_0x6310d7,_0xaa98e4))[_0x8140('0x44')](handleError(_0x6310d7,null));};exports[_0x8140('0x45')]=function(_0x4a3aaa,_0x42509a){var _0x54d23c={'raw':!![],'where':{'id':_0x4a3aaa[_0x8140('0x46')]['id']}},_0x5b9592={};_0x5b9592['model']=_[_0x8140('0x33')](db[_0x8140('0x42')][_0x8140('0x2d')]);_0x5b9592[_0x8140('0x34')]=_[_0x8140('0x33')](_0x4a3aaa[_0x8140('0x34')]);_0x5b9592['filters']=_[_0x8140('0x36')](_0x5b9592['model'],_0x5b9592[_0x8140('0x34')]);_0x54d23c[_0x8140('0x37')]=_[_0x8140('0x36')](_0x5b9592[_0x8140('0x31')],qs[_0x8140('0x38')](_0x4a3aaa['query'][_0x8140('0x38')]));_0x54d23c[_0x8140('0x37')]=_0x54d23c[_0x8140('0x37')]['length']?_0x54d23c[_0x8140('0x37')]:_0x5b9592[_0x8140('0x31')];if(_0x4a3aaa['query'][_0x8140('0x40')]){_0x54d23c['include']=[{'all':!![]}];}_0x54d23c=_[_0x8140('0x3e')]({},_0x54d23c,_0x4a3aaa['options']);return db[_0x8140('0x42')]['find'](_0x54d23c)['then'](handleEntityNotFound(_0x42509a,null))[_0x8140('0x29')](respondWithResult(_0x42509a,null))[_0x8140('0x44')](handleError(_0x42509a,null));};exports[_0x8140('0x47')]=function(_0x542af0,_0x2fe581){return db[_0x8140('0x42')][_0x8140('0x47')](_0x542af0[_0x8140('0x48')],{})[_0x8140('0x29')](respondWithResult(_0x2fe581,0xc9))[_0x8140('0x44')](handleError(_0x2fe581,null));};exports[_0x8140('0x27')]=function(_0x407324,_0x137ff1){if(_0x407324[_0x8140('0x48')]['id']){delete _0x407324[_0x8140('0x48')]['id'];}return db[_0x8140('0x42')][_0x8140('0x49')]({'where':{'id':_0x407324[_0x8140('0x46')]['id']}})[_0x8140('0x29')](handleEntityNotFound(_0x137ff1,null))['then'](saveUpdates(_0x407324[_0x8140('0x48')],null))['then'](respondWithResult(_0x137ff1,null))[_0x8140('0x44')](handleError(_0x137ff1,null));};exports[_0x8140('0x28')]=function(_0x1abb3e,_0x11e535){return db[_0x8140('0x42')][_0x8140('0x49')]({'where':{'id':_0x1abb3e[_0x8140('0x46')]['id']}})['then'](handleEntityNotFound(_0x11e535,null))['then'](removeEntity(_0x11e535,null))[_0x8140('0x44')](handleError(_0x11e535,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ac864d5..0da221a 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 _0x3d04=['request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1eaa44,_0x43f5de){var _0x41b1d1=function(_0x1eb4ff){while(--_0x1eb4ff){_0x1eaa44['push'](_0x1eaa44['shift']());}};_0x41b1d1(++_0x43f5de);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x43d0('0xb'),'fields':[_0x43d0('0xc'),_0x43d0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a9a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util'];(function(_0x23be33,_0x2695e9){var _0x53202c=function(_0x566243){while(--_0x566243){_0x23be33['push'](_0x23be33['shift']());}};_0x53202c(++_0x2695e9);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8a9a[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var logger=require(_0xa8a9('0x1'))(_0xa8a9('0x2'));var moment=require(_0xa8a9('0x3'));var BPromise=require(_0xa8a9('0x4'));var rp=require(_0xa8a9('0x5'));var fs=require('fs');var path=require(_0xa8a9('0x6'));var rimraf=require(_0xa8a9('0x7'));var config=require(_0xa8a9('0x8'));var attributes=require(_0xa8a9('0x9'));module[_0xa8a9('0xa')]=function(_0x1de1c6,_0x4ac303){return _0x1de1c6[_0xa8a9('0xb')]('FreshsalesField',attributes,{'tableName':_0xa8a9('0xc'),'paranoid':![],'indexes':[{'name':_0xa8a9('0xd'),'fields':[_0xa8a9('0xe'),_0xa8a9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c645650..40c48dc 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0xadb5,0xad));var _0x5adb=function(_0x4c095c,_0xb6b157){_0x4c095c=_0x4c095c-0x0;var _0xd41b1a=_0xadb5[_0x4c095c];return _0xd41b1a;};'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']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c40ba,_0xca7576){var _0x3d3426=function(_0x3450a8){while(--_0x3450a8){_0x1c40ba['push'](_0x1c40ba['shift']());}};_0x3d3426(++_0xca7576);}(_0x1623,0xab));var _0x3162=function(_0x33a059,_0x34af2d){_0x33a059=_0x33a059-0x0;var _0x2a25bf=_0x1623[_0x33a059];return _0x2a25bf;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 41fd505..085ab23 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(_0x3d1a04,_0x4b72c4){var _0x589731=function(_0x54edfd){while(--_0x54edfd){_0x3d1a04['push'](_0x3d1a04['shift']());}};_0x589731(++_0x4b72c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0xdbd844,_0xc853d0){var _0x16ba40=function(_0x3714b0){while(--_0x3714b0){_0xdbd844['push'](_0xdbd844['shift']());}};_0x16ba40(++_0xc853d0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index edffb4b..c5986f3 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 _0x0257=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x20ed65,_0x2ca552){var _0x49ee0b=function(_0x7cc9d6){while(--_0x7cc9d6){_0x20ed65['push'](_0x20ed65['shift']());}};_0x49ee0b(++_0x2ca552);}(_0x0257,0x1db));var _0x7025=function(_0x3a7a50,_0xf3ba4b){_0x3a7a50=_0x3a7a50-0x0;var _0x2f8187=_0x0257[_0x3a7a50];return _0x2f8187;};'use strict';var Sequelize=require('sequelize');module[_0x7025('0x0')]={'name':{'type':Sequelize[_0x7025('0x1')]},'description':{'type':Sequelize[_0x7025('0x1')]},'username':{'type':Sequelize[_0x7025('0x1')],'unique':_0x7025('0x2')},'remoteUri':{'type':Sequelize[_0x7025('0x1')]},'password':{'type':Sequelize[_0x7025('0x1')]},'clientId':{'type':Sequelize[_0x7025('0x1')]},'clientSecret':{'type':Sequelize[_0x7025('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7025('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7025('0x3')](_0x7025('0x4'),_0x7025('0x5')),'defaultValue':_0x7025('0x4')}}; \ No newline at end of file +var _0xf65d=['STRING','username','integrationTab','newTab','sequelize'];(function(_0x5b84ff,_0x47e637){var _0xf145d9=function(_0x554033){while(--_0x554033){_0x5b84ff['push'](_0x5b84ff['shift']());}};_0xf145d9(++_0x47e637);}(_0xf65d,0x9f));var _0xdf65=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xf65d[_0x5e9a69];return _0x5979c8;};'use strict';var Sequelize=require(_0xdf65('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf65('0x1')]},'description':{'type':Sequelize[_0xdf65('0x1')]},'username':{'type':Sequelize[_0xdf65('0x1')],'unique':_0xdf65('0x2')},'remoteUri':{'type':Sequelize[_0xdf65('0x1')]},'password':{'type':Sequelize[_0xdf65('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdf65('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdf65('0x3'),_0xdf65('0x4')),'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 c5b2241..f8dd978 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 _0xe0a3=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','params','find','catch','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','merge','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceField','getFields','remoteUri','clientId','password','slice','substring','lastIndexOf','Connection','username','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','update','then','name','send','SalesforceAccount','rawAttributes','type','map','query','keys','filters','intersection','model'];(function(_0x447499,_0x5c37dc){var _0xb84a73=function(_0x237eb8){while(--_0x237eb8){_0x447499['push'](_0x447499['shift']());}};_0xb84a73(++_0x5c37dc);}(_0xe0a3,0xba));var _0x3e0a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe0a3[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x3e0a('0x0'));var rimraf=require(_0x3e0a('0x1'));var zipdir=require(_0x3e0a('0x2'));var jsonpatch=require(_0x3e0a('0x3'));var rp=require(_0x3e0a('0x4'));var moment=require(_0x3e0a('0x5'));var BPromise=require(_0x3e0a('0x6'));var Mustache=require(_0x3e0a('0x7'));var util=require('util');var path=require(_0x3e0a('0x8'));var sox=require(_0x3e0a('0x9'));var csv=require(_0x3e0a('0xa'));var ejs=require(_0x3e0a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e0a('0xc'));var squel=require(_0x3e0a('0xd'));var crypto=require(_0x3e0a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3e0a('0xf'));var toCsv=require(_0x3e0a('0xa'));var querystring=require(_0x3e0a('0x10'));var Papa=require(_0x3e0a('0x11'));var Redis=require(_0x3e0a('0x12'));var authService=require(_0x3e0a('0x13'));var qs=require(_0x3e0a('0x14'));var as=require(_0x3e0a('0x15'));var hardwareService=require(_0x3e0a('0x16'));var logger=require(_0x3e0a('0x17'))(_0x3e0a('0x18'));var utils=require(_0x3e0a('0x19'));var config=require(_0x3e0a('0x1a'));var licenseUtil=require(_0x3e0a('0x1b'));var db=require(_0x3e0a('0x1c'))['db'];var integrations=require(_0x3e0a('0x1d'));function respondWithStatusCode(_0x11aa1c,_0x4fc4b9){_0x4fc4b9=_0x4fc4b9||0xcc;return function(_0x12acc8){if(_0x12acc8){return _0x11aa1c[_0x3e0a('0x1e')](_0x4fc4b9);}return _0x11aa1c['status'](_0x4fc4b9)[_0x3e0a('0x1f')]();};}function respondWithResult(_0x490c3e,_0x10e7af){_0x10e7af=_0x10e7af||0xc8;return function(_0x49b509){if(_0x49b509){return _0x490c3e[_0x3e0a('0x20')](_0x10e7af)['json'](_0x49b509);}};}function respondWithFilteredResult(_0x5555b5,_0x259e26){return function(_0x2eaeec){if(_0x2eaeec){var _0x45f950=typeof _0x259e26[_0x3e0a('0x21')]===_0x3e0a('0x22')&&typeof _0x259e26['limit']==='undefined';var _0x5168f2=_0x2eaeec[_0x3e0a('0x23')];var _0x20d313=_0x45f950?0x0:_0x259e26['offset'];var _0x5d1e83=_0x45f950?_0x2eaeec[_0x3e0a('0x23')]:_0x259e26[_0x3e0a('0x21')]+_0x259e26[_0x3e0a('0x24')];var _0x37b6c8;if(_0x5d1e83>=_0x5168f2){_0x5d1e83=_0x5168f2;_0x37b6c8=0xc8;}else{_0x37b6c8=0xce;}_0x5555b5[_0x3e0a('0x20')](_0x37b6c8);return _0x5555b5[_0x3e0a('0x25')]('Content-Range',_0x20d313+'-'+_0x5d1e83+'/'+_0x5168f2)[_0x3e0a('0x26')](_0x2eaeec);}return null;};}function patchUpdates(_0x111add){return function(_0x3d54c4){try{jsonpatch[_0x3e0a('0x27')](_0x3d54c4,_0x111add,!![]);}catch(_0x5b08e0){return BPromise[_0x3e0a('0x28')](_0x5b08e0);}return _0x3d54c4['save']();};}function saveUpdates(_0x3cee8a,_0xd3ce32){return function(_0x3d0e65){if(_0x3d0e65){return _0x3d0e65[_0x3e0a('0x29')](_0x3cee8a)[_0x3e0a('0x2a')](function(_0x429dd2){return _0x429dd2;});}return null;};}function removeEntity(_0x25b342,_0x30a4e6){return function(_0x5c5038){if(_0x5c5038){return _0x5c5038['destroy']()['then'](function(){_0x25b342[_0x3e0a('0x20')](0xcc)[_0x3e0a('0x1f')]();});}};}function handleEntityNotFound(_0x544fa3,_0x53a566){return function(_0x4e6352){if(!_0x4e6352){_0x544fa3['sendStatus'](0x194);}return _0x4e6352;};}function handleError(_0x258587,_0x38b4d7){_0x38b4d7=_0x38b4d7||0x1f4;return function(_0x2db7d5){logger['error'](_0x2db7d5['stack']);if(_0x2db7d5['name']){delete _0x2db7d5[_0x3e0a('0x2b')];}_0x258587[_0x3e0a('0x20')](_0x38b4d7)[_0x3e0a('0x2c')](_0x2db7d5);};}exports['index']=function(_0x59a468,_0x18b858){var _0x1b7bff={},_0x334a67={},_0x535534={'count':0x0,'rows':[]};var _0x488a61=_['map'](db[_0x3e0a('0x2d')][_0x3e0a('0x2e')],function(_0x393951){return{'name':_0x393951['fieldName'],'type':_0x393951[_0x3e0a('0x2f')]['key']};});_0x334a67['model']=_[_0x3e0a('0x30')](_0x488a61,_0x3e0a('0x2b'));_0x334a67[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x59a468[_0x3e0a('0x31')]);_0x334a67[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0x334a67[_0x3e0a('0x35')],_0x334a67[_0x3e0a('0x31')]);_0x1b7bff[_0x3e0a('0x36')]=_[_0x3e0a('0x34')](_0x334a67[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x1b7bff['attributes']=_0x1b7bff[_0x3e0a('0x36')][_0x3e0a('0x38')]?_0x1b7bff[_0x3e0a('0x36')]:_0x334a67[_0x3e0a('0x35')];if(!_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x39')](_0x3e0a('0x3a'))){_0x1b7bff[_0x3e0a('0x24')]=qs[_0x3e0a('0x24')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x24')]);_0x1b7bff[_0x3e0a('0x21')]=qs[_0x3e0a('0x21')](_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x21')]);}_0x1b7bff[_0x3e0a('0x3b')]=qs['sort'](_0x59a468['query'][_0x3e0a('0x3c')]);_0x1b7bff[_0x3e0a('0x3d')]=qs[_0x3e0a('0x33')](_[_0x3e0a('0x3e')](_0x59a468['query'],_0x334a67[_0x3e0a('0x33')]),_0x488a61);if(_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x3f')]){_0x1b7bff[_0x3e0a('0x3d')]=_['merge'](_0x1b7bff[_0x3e0a('0x3d')],{'$or':_['map'](_0x488a61,function(_0x110cd8){if(_0x110cd8[_0x3e0a('0x2f')]!==_0x3e0a('0x40')){var _0x45c776={};_0x45c776[_0x110cd8[_0x3e0a('0x2b')]]={'$like':'%'+_0x59a468[_0x3e0a('0x31')]['filter']+'%'};return _0x45c776;}})});}_0x1b7bff=_['merge']({},_0x1b7bff,_0x59a468[_0x3e0a('0x41')]);var _0x54754f={'where':_0x1b7bff[_0x3e0a('0x3d')]};return db[_0x3e0a('0x2d')][_0x3e0a('0x23')](_0x54754f)[_0x3e0a('0x2a')](function(_0x2e669e){_0x535534[_0x3e0a('0x23')]=_0x2e669e;if(_0x59a468[_0x3e0a('0x31')][_0x3e0a('0x42')]){_0x1b7bff[_0x3e0a('0x43')]=[{'all':!![]}];}return db[_0x3e0a('0x2d')]['findAll'](_0x1b7bff);})['then'](function(_0xcd9d69){_0x535534['rows']=_0xcd9d69;return _0x535534;})[_0x3e0a('0x2a')](respondWithFilteredResult(_0x18b858,_0x1b7bff))['catch'](handleError(_0x18b858,null));};exports['show']=function(_0x21ed7e,_0x12db0e){var _0x5cd60f={'raw':![],'where':{'id':_0x21ed7e[_0x3e0a('0x44')]['id']}},_0xc33302={};_0xc33302[_0x3e0a('0x35')]=_[_0x3e0a('0x32')](db[_0x3e0a('0x2d')]['rawAttributes']);_0xc33302[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x21ed7e['query']);_0xc33302[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0xc33302['model'],_0xc33302[_0x3e0a('0x31')]);_0x5cd60f[_0x3e0a('0x36')]=_['intersection'](_0xc33302[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x21ed7e[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x5cd60f['attributes']=_0x5cd60f[_0x3e0a('0x36')][_0x3e0a('0x38')]?_0x5cd60f[_0x3e0a('0x36')]:_0xc33302[_0x3e0a('0x35')];if(_0x21ed7e[_0x3e0a('0x31')]['includeAll']){_0x5cd60f['include']=[{'all':!![]}];}_0x5cd60f=_['merge']({},_0x5cd60f,_0x21ed7e[_0x3e0a('0x41')]);return db[_0x3e0a('0x2d')][_0x3e0a('0x45')](_0x5cd60f)['then'](handleEntityNotFound(_0x12db0e,null))['then'](respondWithResult(_0x12db0e,null))[_0x3e0a('0x46')](handleError(_0x12db0e,null));};exports[_0x3e0a('0x47')]=function(_0x3516ff,_0x33e5cb){return db[_0x3e0a('0x2d')][_0x3e0a('0x47')](_0x3516ff[_0x3e0a('0x48')],{})[_0x3e0a('0x2a')](respondWithResult(_0x33e5cb,0xc9))[_0x3e0a('0x46')](handleError(_0x33e5cb,null));};exports['update']=function(_0x4bc24,_0x3ab14d){if(_0x4bc24['body']['id']){delete _0x4bc24['body']['id'];}return db[_0x3e0a('0x2d')][_0x3e0a('0x45')]({'where':{'id':_0x4bc24[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x3ab14d,null))[_0x3e0a('0x2a')](saveUpdates(_0x4bc24['body'],null))['then'](respondWithResult(_0x3ab14d,null))[_0x3e0a('0x46')](handleError(_0x3ab14d,null));};exports[_0x3e0a('0x49')]=function(_0x5106f0,_0x369680){return db[_0x3e0a('0x2d')]['find']({'where':{'id':_0x5106f0[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x369680,null))[_0x3e0a('0x2a')](removeEntity(_0x369680,null))['catch'](handleError(_0x369680,null));};exports[_0x3e0a('0x4a')]=function(_0x52d0b6,_0x5588e6,_0x4e00ec){var _0x16c187={};var _0x3e1e8f={};var _0x28ba6a;var _0x3fb30e;return db[_0x3e0a('0x2d')][_0x3e0a('0x4b')]({'where':{'id':_0x52d0b6[_0x3e0a('0x44')]['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x5588e6,null))[_0x3e0a('0x2a')](function(_0x81223a){if(_0x81223a){_0x28ba6a=_0x81223a;_0x3e1e8f[_0x3e0a('0x35')]=_[_0x3e0a('0x32')](db[_0x3e0a('0x4c')][_0x3e0a('0x2e')]);_0x3e1e8f[_0x3e0a('0x31')]=_[_0x3e0a('0x32')](_0x52d0b6['query']);_0x3e1e8f[_0x3e0a('0x33')]=_[_0x3e0a('0x34')](_0x3e1e8f[_0x3e0a('0x35')],_0x3e1e8f['query']);_0x16c187['attributes']=_['intersection'](_0x3e1e8f[_0x3e0a('0x35')],qs[_0x3e0a('0x37')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x37')]));_0x16c187[_0x3e0a('0x36')]=_0x16c187['attributes'][_0x3e0a('0x38')]?_0x16c187[_0x3e0a('0x36')]:_0x3e1e8f['model'];_0x16c187[_0x3e0a('0x3b')]=qs[_0x3e0a('0x3c')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x3c')]);_0x16c187['where']=qs[_0x3e0a('0x33')](_[_0x3e0a('0x3e')](_0x52d0b6[_0x3e0a('0x31')],_0x3e1e8f[_0x3e0a('0x33')]));if(_0x52d0b6['query'][_0x3e0a('0x3f')]){_0x16c187[_0x3e0a('0x3d')]=_[_0x3e0a('0x4d')](_0x16c187['where'],{'$or':_[_0x3e0a('0x30')](_0x16c187[_0x3e0a('0x36')],function(_0x244b04){var _0x57d7eb={};_0x57d7eb[_0x244b04]={'$like':'%'+_0x52d0b6['query']['filter']+'%'};return _0x57d7eb;})});}_0x16c187=_[_0x3e0a('0x4d')]({},_0x16c187,_0x52d0b6[_0x3e0a('0x41')]);return _0x28ba6a[_0x3e0a('0x4a')](_0x16c187);}})['then'](function(_0x1a48a5){if(_0x1a48a5){_0x3fb30e=_0x1a48a5[_0x3e0a('0x38')];if(!_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x39')]('nolimit')){_0x16c187[_0x3e0a('0x24')]=qs['limit'](_0x52d0b6['query'][_0x3e0a('0x24')]);_0x16c187[_0x3e0a('0x21')]=qs[_0x3e0a('0x21')](_0x52d0b6[_0x3e0a('0x31')][_0x3e0a('0x21')]);}return _0x28ba6a[_0x3e0a('0x4a')](_0x16c187);}})[_0x3e0a('0x2a')](function(_0x35492a){if(_0x35492a){return _0x35492a?{'count':_0x3fb30e,'rows':_0x35492a}:null;}})[_0x3e0a('0x2a')](respondWithResult(_0x5588e6,null))['catch'](handleError(_0x5588e6,null));};exports[_0x3e0a('0x4e')]=function(_0x2259fb,_0x3c85b4,_0x561823){if(_0x2259fb[_0x3e0a('0x48')]['id']){delete _0x2259fb[_0x3e0a('0x48')]['id'];}return db[_0x3e0a('0x2d')]['findOne']({'where':{'id':_0x2259fb['params']['id']}})[_0x3e0a('0x2a')](handleEntityNotFound(_0x3c85b4,null))[_0x3e0a('0x2a')](function(_0x3dcc22){if(_0x3dcc22){_0x2259fb[_0x3e0a('0x48')]['AccountId']=_0x3dcc22['id'];_0x2259fb[_0x3e0a('0x48')][_0x3e0a('0x4f')]=integrations[_0x3e0a('0x50')](_0x2259fb['body'][_0x3e0a('0x51')],_0x2259fb[_0x3e0a('0x48')]['type']);_0x2259fb[_0x3e0a('0x48')]['Descriptions']=integrations[_0x3e0a('0x52')](_0x2259fb[_0x3e0a('0x48')][_0x3e0a('0x51')],_0x2259fb['body']['type']);return db[_0x3e0a('0x4c')][_0x3e0a('0x47')](_0x2259fb['body'],{'include':[{'model':db[_0x3e0a('0x53')],'as':'Subjects'},{'model':db[_0x3e0a('0x53')],'as':'Descriptions'}]});}return null;})[_0x3e0a('0x2a')](respondWithResult(_0x3c85b4,null))['catch'](handleError(_0x3c85b4,null));};exports[_0x3e0a('0x54')]=function(_0x4c26c8,_0x270c44,_0x24632d){var _0x1e54c2;var _0x40f030='';var _0x49d1f2='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x4c26c8[_0x3e0a('0x44')]['id']},'attributes':['id',_0x3e0a('0x55'),_0x3e0a('0x56'),'clientSecret','username',_0x3e0a('0x57'),'securityToken']})['then'](handleEntityNotFound(_0x270c44,null))[_0x3e0a('0x2a')](function(_0x562ab8){if(_0x562ab8){_0x40f030=_0x562ab8[_0x3e0a('0x55')];var _0x442127=_0x40f030[_0x3e0a('0x58')](-0x1);if(_0x442127==='/'){_0x40f030=_0x40f030[_0x3e0a('0x59')](0x0,_0x40f030[_0x3e0a('0x5a')](_0x442127));}_0x1e54c2=new jsforce[(_0x3e0a('0x5b'))]({'oauth2':{'loginUrl':_0x40f030,'clientId':_0x562ab8['clientId'],'clientSecret':_0x562ab8['clientSecret']}});return _0x1e54c2['login'](_0x562ab8[_0x3e0a('0x5c')],_0x562ab8[_0x3e0a('0x57')]['concat'](_0x562ab8[_0x3e0a('0x5d')]));}})[_0x3e0a('0x2a')](function(_0x44632a){if(_0x44632a){if(!_[_0x3e0a('0x5e')](_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x5f')])){_0x49d1f2=_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x5f')];}return _0x1e54c2[_0x3e0a('0x60')](_0x49d1f2)['describe']();}})[_0x3e0a('0x2a')](function(_0x2e8b84){var _0x525261=[_0x3e0a('0x61'),_0x3e0a('0x62'),_0x3e0a('0x63'),_0x3e0a('0x64'),_0x3e0a('0x65'),'Description'];var _0x1aad3c=[_0x3e0a('0x66'),_0x3e0a('0x67'),_0x3e0a('0x68'),_0x3e0a('0x69'),_0x3e0a('0x6a'),'textarea',_0x3e0a('0x6b')];if(_0x2e8b84){_[_0x3e0a('0x6c')](_0x2e8b84[_0x3e0a('0x37')],function(_0x102ece){return _0x525261[_0x3e0a('0x6d')](_0x102ece[_0x3e0a('0x2b')])||!_0x1aad3c[_0x3e0a('0x6d')](_0x102ece['type']);});return{'count':_0x2e8b84[_0x3e0a('0x37')]['length'],'rows':_[_0x3e0a('0x30')](_0x2e8b84['fields'],function(_0xf26f8c){return{'id':_0xf26f8c[_0x3e0a('0x2b')],'name':_0xf26f8c[_0x3e0a('0x6e')],'custom':_0xf26f8c['custom'],'options':_0xf26f8c[_0x3e0a('0x6f')][_0x3e0a('0x38')]>0x0?_[_0x3e0a('0x30')](_0xf26f8c[_0x3e0a('0x6f')],function(_0x541e1c){return{'name':_0x541e1c['label'],'value':_0x541e1c[_0x3e0a('0x70')]};}):_0xf26f8c[_0x3e0a('0x2f')]==_0x3e0a('0x69')?[{'name':_0x3e0a('0x71'),'value':_0x3e0a('0x72')},{'name':_0x3e0a('0x73'),'value':'false'}]:[]};})};}})[_0x3e0a('0x2a')](respondWithResult(_0x270c44,null))[_0x3e0a('0x46')](function(_0x4d3178){var _0x4c1857=_0x4c26c8[_0x3e0a('0x31')][_0x3e0a('0x74')]?0x1f4:_0x4d3178[_0x3e0a('0x75')]||0x1f4;logger['error'](_0x3e0a('0x76'),_0x3e0a('0x54'),_0x4c1857,JSON[_0x3e0a('0x77')](_0x4d3178));delete _0x4d3178[_0x3e0a('0x2b')];if(_0x4c1857===0x191){_0x4c1857=0x190;}_0x270c44[_0x3e0a('0x20')](_0x4c1857)[_0x3e0a('0x2c')](_0x4c26c8[_0x3e0a('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4d3178['statusCode']}:_0x4d3178);});}; \ No newline at end of file +var _0xe198=['ticketType','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','remove','includes','label','custom','picklistValues','true','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SalesforceAccount','includeAll','include','catch','params','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','clientId','clientSecret','securityToken','substring','lastIndexOf','login','password','concat'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe198,0x15d));var _0x8e19=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe198[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x8e19('0x0'));var rimraf=require(_0x8e19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e19('0x2'));var rp=require('request-promise');var moment=require(_0x8e19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e19('0x4'));var util=require(_0x8e19('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8e19('0x6'));var ejs=require(_0x8e19('0x7'));var fs=require('fs');var fs_extra=require(_0x8e19('0x8'));var _=require('lodash');var squel=require(_0x8e19('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e19('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8e19('0xb'));var Papa=require(_0x8e19('0xc'));var Redis=require(_0x8e19('0xd'));var authService=require(_0x8e19('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8e19('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e19('0x10'))('api');var utils=require(_0x8e19('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8e19('0x12'));var db=require(_0x8e19('0x13'))['db'];var integrations=require(_0x8e19('0x14'));function respondWithStatusCode(_0x31ce87,_0x19667c){_0x19667c=_0x19667c||0xcc;return function(_0x5b3c97){if(_0x5b3c97){return _0x31ce87[_0x8e19('0x15')](_0x19667c);}return _0x31ce87[_0x8e19('0x16')](_0x19667c)[_0x8e19('0x17')]();};}function respondWithResult(_0x3a7784,_0x280666){_0x280666=_0x280666||0xc8;return function(_0x3955bf){if(_0x3955bf){return _0x3a7784['status'](_0x280666)[_0x8e19('0x18')](_0x3955bf);}};}function respondWithFilteredResult(_0x2a520b,_0x5b859d){return function(_0x2edcfa){if(_0x2edcfa){var _0x334fc7=typeof _0x5b859d[_0x8e19('0x19')]==='undefined'&&typeof _0x5b859d[_0x8e19('0x1a')]===_0x8e19('0x1b');var _0x2277ae=_0x2edcfa[_0x8e19('0x1c')];var _0x44284b=_0x334fc7?0x0:_0x5b859d['offset'];var _0x1f8b91=_0x334fc7?_0x2edcfa['count']:_0x5b859d['offset']+_0x5b859d[_0x8e19('0x1a')];var _0x5dfe47;if(_0x1f8b91>=_0x2277ae){_0x1f8b91=_0x2277ae;_0x5dfe47=0xc8;}else{_0x5dfe47=0xce;}_0x2a520b[_0x8e19('0x16')](_0x5dfe47);return _0x2a520b[_0x8e19('0x1d')]('Content-Range',_0x44284b+'-'+_0x1f8b91+'/'+_0x2277ae)[_0x8e19('0x18')](_0x2edcfa);}return null;};}function patchUpdates(_0x339a2d){return function(_0x13cd71){try{jsonpatch[_0x8e19('0x1e')](_0x13cd71,_0x339a2d,!![]);}catch(_0x37955f){return BPromise[_0x8e19('0x1f')](_0x37955f);}return _0x13cd71['save']();};}function saveUpdates(_0x3bb838,_0x46efde){return function(_0xb16ea7){if(_0xb16ea7){return _0xb16ea7[_0x8e19('0x20')](_0x3bb838)[_0x8e19('0x21')](function(_0x31713d){return _0x31713d;});}return null;};}function removeEntity(_0x4eb00a,_0x41cdf7){return function(_0x5d1ac3){if(_0x5d1ac3){return _0x5d1ac3[_0x8e19('0x22')]()['then'](function(){_0x4eb00a[_0x8e19('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56be58,_0x26bce3){return function(_0x5928d8){if(!_0x5928d8){_0x56be58[_0x8e19('0x15')](0x194);}return _0x5928d8;};}function handleError(_0x135009,_0xe75cbb){_0xe75cbb=_0xe75cbb||0x1f4;return function(_0x32100a){logger[_0x8e19('0x23')](_0x32100a[_0x8e19('0x24')]);if(_0x32100a[_0x8e19('0x25')]){delete _0x32100a['name'];}_0x135009[_0x8e19('0x16')](_0xe75cbb)[_0x8e19('0x26')](_0x32100a);};}exports[_0x8e19('0x27')]=function(_0x580b54,_0xfd4bb7){var _0xea6733={},_0x457dda={},_0x2bf23e={'count':0x0,'rows':[]};var _0x2c4bc0=_['map'](db['SalesforceAccount'][_0x8e19('0x28')],function(_0x5957bd){return{'name':_0x5957bd['fieldName'],'type':_0x5957bd[_0x8e19('0x29')]['key']};});_0x457dda[_0x8e19('0x2a')]=_[_0x8e19('0x2b')](_0x2c4bc0,_0x8e19('0x25'));_0x457dda[_0x8e19('0x2c')]=_[_0x8e19('0x2d')](_0x580b54[_0x8e19('0x2c')]);_0x457dda[_0x8e19('0x2e')]=_['intersection'](_0x457dda[_0x8e19('0x2a')],_0x457dda[_0x8e19('0x2c')]);_0xea6733['attributes']=_[_0x8e19('0x2f')](_0x457dda[_0x8e19('0x2a')],qs['fields'](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x30')]));_0xea6733[_0x8e19('0x31')]=_0xea6733['attributes'][_0x8e19('0x32')]?_0xea6733[_0x8e19('0x31')]:_0x457dda[_0x8e19('0x2a')];if(!_0x580b54[_0x8e19('0x2c')]['hasOwnProperty'](_0x8e19('0x33'))){_0xea6733[_0x8e19('0x1a')]=qs[_0x8e19('0x1a')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x1a')]);_0xea6733['offset']=qs[_0x8e19('0x19')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x19')]);}_0xea6733[_0x8e19('0x34')]=qs[_0x8e19('0x35')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x35')]);_0xea6733[_0x8e19('0x36')]=qs[_0x8e19('0x2e')](_[_0x8e19('0x37')](_0x580b54[_0x8e19('0x2c')],_0x457dda['filters']),_0x2c4bc0);if(_0x580b54['query'][_0x8e19('0x38')]){_0xea6733['where']=_[_0x8e19('0x39')](_0xea6733[_0x8e19('0x36')],{'$or':_[_0x8e19('0x2b')](_0x2c4bc0,function(_0x2fa54a){if(_0x2fa54a[_0x8e19('0x29')]!==_0x8e19('0x3a')){var _0x41528b={};_0x41528b[_0x2fa54a[_0x8e19('0x25')]]={'$like':'%'+_0x580b54[_0x8e19('0x2c')][_0x8e19('0x38')]+'%'};return _0x41528b;}})});}_0xea6733=_[_0x8e19('0x39')]({},_0xea6733,_0x580b54['options']);var _0x587c94={'where':_0xea6733[_0x8e19('0x36')]};return db[_0x8e19('0x3b')][_0x8e19('0x1c')](_0x587c94)[_0x8e19('0x21')](function(_0x3bfb11){_0x2bf23e[_0x8e19('0x1c')]=_0x3bfb11;if(_0x580b54[_0x8e19('0x2c')][_0x8e19('0x3c')]){_0xea6733[_0x8e19('0x3d')]=[{'all':!![]}];}return db[_0x8e19('0x3b')]['findAll'](_0xea6733);})[_0x8e19('0x21')](function(_0x1b16e5){_0x2bf23e['rows']=_0x1b16e5;return _0x2bf23e;})['then'](respondWithFilteredResult(_0xfd4bb7,_0xea6733))[_0x8e19('0x3e')](handleError(_0xfd4bb7,null));};exports['show']=function(_0x587cb9,_0x30f7e4){var _0x35e8ed={'raw':![],'where':{'id':_0x587cb9[_0x8e19('0x3f')]['id']}},_0x405f7e={};_0x405f7e[_0x8e19('0x2a')]=_['keys'](db['SalesforceAccount'][_0x8e19('0x28')]);_0x405f7e[_0x8e19('0x2c')]=_[_0x8e19('0x2d')](_0x587cb9[_0x8e19('0x2c')]);_0x405f7e[_0x8e19('0x2e')]=_[_0x8e19('0x2f')](_0x405f7e[_0x8e19('0x2a')],_0x405f7e['query']);_0x35e8ed[_0x8e19('0x31')]=_[_0x8e19('0x2f')](_0x405f7e[_0x8e19('0x2a')],qs[_0x8e19('0x30')](_0x587cb9[_0x8e19('0x2c')][_0x8e19('0x30')]));_0x35e8ed[_0x8e19('0x31')]=_0x35e8ed['attributes'][_0x8e19('0x32')]?_0x35e8ed['attributes']:_0x405f7e[_0x8e19('0x2a')];if(_0x587cb9[_0x8e19('0x2c')]['includeAll']){_0x35e8ed[_0x8e19('0x3d')]=[{'all':!![]}];}_0x35e8ed=_[_0x8e19('0x39')]({},_0x35e8ed,_0x587cb9[_0x8e19('0x40')]);return db[_0x8e19('0x3b')][_0x8e19('0x41')](_0x35e8ed)[_0x8e19('0x21')](handleEntityNotFound(_0x30f7e4,null))[_0x8e19('0x21')](respondWithResult(_0x30f7e4,null))[_0x8e19('0x3e')](handleError(_0x30f7e4,null));};exports[_0x8e19('0x42')]=function(_0x49277c,_0x249f11){return db[_0x8e19('0x3b')]['create'](_0x49277c[_0x8e19('0x43')],{})[_0x8e19('0x21')](respondWithResult(_0x249f11,0xc9))[_0x8e19('0x3e')](handleError(_0x249f11,null));};exports[_0x8e19('0x20')]=function(_0xfeca16,_0x4d7592){if(_0xfeca16['body']['id']){delete _0xfeca16[_0x8e19('0x43')]['id'];}return db[_0x8e19('0x3b')][_0x8e19('0x41')]({'where':{'id':_0xfeca16['params']['id']}})[_0x8e19('0x21')](handleEntityNotFound(_0x4d7592,null))[_0x8e19('0x21')](saveUpdates(_0xfeca16[_0x8e19('0x43')],null))['then'](respondWithResult(_0x4d7592,null))['catch'](handleError(_0x4d7592,null));};exports[_0x8e19('0x22')]=function(_0x5808e0,_0x4e0211){return db[_0x8e19('0x3b')][_0x8e19('0x41')]({'where':{'id':_0x5808e0[_0x8e19('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e0211,null))[_0x8e19('0x21')](removeEntity(_0x4e0211,null))['catch'](handleError(_0x4e0211,null));};exports[_0x8e19('0x44')]=function(_0x33eb0c,_0x506083,_0x451127){var _0x52de01={};var _0x3c15d6={};var _0x5ef09a;var _0x344cc9;return db[_0x8e19('0x3b')][_0x8e19('0x45')]({'where':{'id':_0x33eb0c[_0x8e19('0x3f')]['id']}})['then'](handleEntityNotFound(_0x506083,null))[_0x8e19('0x21')](function(_0x329e08){if(_0x329e08){_0x5ef09a=_0x329e08;_0x3c15d6[_0x8e19('0x2a')]=_[_0x8e19('0x2d')](db[_0x8e19('0x46')]['rawAttributes']);_0x3c15d6['query']=_['keys'](_0x33eb0c[_0x8e19('0x2c')]);_0x3c15d6[_0x8e19('0x2e')]=_[_0x8e19('0x2f')](_0x3c15d6[_0x8e19('0x2a')],_0x3c15d6[_0x8e19('0x2c')]);_0x52de01['attributes']=_[_0x8e19('0x2f')](_0x3c15d6[_0x8e19('0x2a')],qs[_0x8e19('0x30')](_0x33eb0c[_0x8e19('0x2c')][_0x8e19('0x30')]));_0x52de01[_0x8e19('0x31')]=_0x52de01['attributes'][_0x8e19('0x32')]?_0x52de01[_0x8e19('0x31')]:_0x3c15d6[_0x8e19('0x2a')];_0x52de01[_0x8e19('0x34')]=qs[_0x8e19('0x35')](_0x33eb0c[_0x8e19('0x2c')]['sort']);_0x52de01[_0x8e19('0x36')]=qs[_0x8e19('0x2e')](_[_0x8e19('0x37')](_0x33eb0c['query'],_0x3c15d6[_0x8e19('0x2e')]));if(_0x33eb0c[_0x8e19('0x2c')]['filter']){_0x52de01[_0x8e19('0x36')]=_[_0x8e19('0x39')](_0x52de01[_0x8e19('0x36')],{'$or':_[_0x8e19('0x2b')](_0x52de01['attributes'],function(_0x5d19b2){var _0x9e9611={};_0x9e9611[_0x5d19b2]={'$like':'%'+_0x33eb0c[_0x8e19('0x2c')]['filter']+'%'};return _0x9e9611;})});}_0x52de01=_[_0x8e19('0x39')]({},_0x52de01,_0x33eb0c[_0x8e19('0x40')]);return _0x5ef09a['getConfigurations'](_0x52de01);}})[_0x8e19('0x21')](function(_0x117bb6){if(_0x117bb6){_0x344cc9=_0x117bb6[_0x8e19('0x32')];if(!_0x33eb0c[_0x8e19('0x2c')]['hasOwnProperty'](_0x8e19('0x33'))){_0x52de01[_0x8e19('0x1a')]=qs[_0x8e19('0x1a')](_0x33eb0c[_0x8e19('0x2c')][_0x8e19('0x1a')]);_0x52de01[_0x8e19('0x19')]=qs[_0x8e19('0x19')](_0x33eb0c['query'][_0x8e19('0x19')]);}return _0x5ef09a[_0x8e19('0x44')](_0x52de01);}})[_0x8e19('0x21')](function(_0x555883){if(_0x555883){return _0x555883?{'count':_0x344cc9,'rows':_0x555883}:null;}})[_0x8e19('0x21')](respondWithResult(_0x506083,null))[_0x8e19('0x3e')](handleError(_0x506083,null));};exports[_0x8e19('0x47')]=function(_0x515fec,_0x480d89,_0x4e1d77){if(_0x515fec[_0x8e19('0x43')]['id']){delete _0x515fec['body']['id'];}return db[_0x8e19('0x3b')][_0x8e19('0x45')]({'where':{'id':_0x515fec['params']['id']}})['then'](handleEntityNotFound(_0x480d89,null))['then'](function(_0x19125f){if(_0x19125f){_0x515fec[_0x8e19('0x43')][_0x8e19('0x48')]=_0x19125f['id'];_0x515fec[_0x8e19('0x43')][_0x8e19('0x49')]=integrations[_0x8e19('0x4a')](_0x515fec[_0x8e19('0x43')][_0x8e19('0x4b')],_0x515fec[_0x8e19('0x43')][_0x8e19('0x29')]);_0x515fec[_0x8e19('0x43')][_0x8e19('0x4c')]=integrations['getDescriptions'](_0x515fec['body'][_0x8e19('0x4b')],_0x515fec[_0x8e19('0x43')][_0x8e19('0x29')]);return db[_0x8e19('0x46')]['create'](_0x515fec[_0x8e19('0x43')],{'include':[{'model':db['SalesforceField'],'as':_0x8e19('0x49')},{'model':db['SalesforceField'],'as':_0x8e19('0x4c')}]});}return null;})['then'](respondWithResult(_0x480d89,null))['catch'](handleError(_0x480d89,null));};exports[_0x8e19('0x4d')]=function(_0x3fe1ca,_0x588819,_0x26aadb){var _0x412e6e;var _0x529cb9='';var _0x195e8d='Task';return db['SalesforceAccount'][_0x8e19('0x45')]({'where':{'id':_0x3fe1ca[_0x8e19('0x3f')]['id']},'attributes':['id',_0x8e19('0x4e'),_0x8e19('0x4f'),_0x8e19('0x50'),'username','password',_0x8e19('0x51')]})[_0x8e19('0x21')](handleEntityNotFound(_0x588819,null))[_0x8e19('0x21')](function(_0x77986d){if(_0x77986d){_0x529cb9=_0x77986d[_0x8e19('0x4e')];var _0x37bb83=_0x529cb9['slice'](-0x1);if(_0x37bb83==='/'){_0x529cb9=_0x529cb9[_0x8e19('0x52')](0x0,_0x529cb9[_0x8e19('0x53')](_0x37bb83));}_0x412e6e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x529cb9,'clientId':_0x77986d[_0x8e19('0x4f')],'clientSecret':_0x77986d[_0x8e19('0x50')]}});return _0x412e6e[_0x8e19('0x54')](_0x77986d['username'],_0x77986d[_0x8e19('0x55')][_0x8e19('0x56')](_0x77986d[_0x8e19('0x51')]));}})[_0x8e19('0x21')](function(_0x2c30c1){if(_0x2c30c1){if(!_['isNil'](_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x57')])){_0x195e8d=_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x57')];}return _0x412e6e['sobject'](_0x195e8d)[_0x8e19('0x58')]();}})[_0x8e19('0x21')](function(_0x2243b0){var _0x308e02=['OwnerId','ActivityDate',_0x8e19('0x59'),_0x8e19('0x5a'),_0x8e19('0x5b'),_0x8e19('0x5c')];var _0x27c469=[_0x8e19('0x5d'),_0x8e19('0x5e'),_0x8e19('0x5f'),'boolean',_0x8e19('0x60'),_0x8e19('0x61'),'phone'];if(_0x2243b0){_[_0x8e19('0x62')](_0x2243b0[_0x8e19('0x30')],function(_0x4231fc){return _0x308e02[_0x8e19('0x63')](_0x4231fc[_0x8e19('0x25')])||!_0x27c469['includes'](_0x4231fc[_0x8e19('0x29')]);});return{'count':_0x2243b0['fields'][_0x8e19('0x32')],'rows':_['map'](_0x2243b0[_0x8e19('0x30')],function(_0x1b2f1d){return{'id':_0x1b2f1d[_0x8e19('0x25')],'name':_0x1b2f1d[_0x8e19('0x64')],'custom':_0x1b2f1d[_0x8e19('0x65')],'options':_0x1b2f1d[_0x8e19('0x66')][_0x8e19('0x32')]>0x0?_[_0x8e19('0x2b')](_0x1b2f1d[_0x8e19('0x66')],function(_0x11a487){return{'name':_0x11a487[_0x8e19('0x64')],'value':_0x11a487['value']};}):_0x1b2f1d[_0x8e19('0x29')]=='boolean'?[{'name':'True','value':_0x8e19('0x67')},{'name':'False','value':'false'}]:[]};})};}})[_0x8e19('0x21')](respondWithResult(_0x588819,null))['catch'](function(_0x37cacd){var _0x134f49=_0x3fe1ca['query'][_0x8e19('0x68')]?0x1f4:_0x37cacd['statusCode']||0x1f4;logger['error'](_0x8e19('0x69'),'getFields',_0x134f49,JSON[_0x8e19('0x6a')](_0x37cacd));delete _0x37cacd[_0x8e19('0x25')];if(_0x134f49===0x191){_0x134f49=0x190;}_0x588819[_0x8e19('0x16')](_0x134f49)[_0x8e19('0x26')](_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x68')]?{'message':_0x8e19('0x6b'),'statusCode':_0x37cacd[_0x8e19('0x6c')]}:_0x37cacd);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 952ad41..c8bf5f5 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 _0x4e4d=['bluebird','request-promise','rimraf','../../config/environment','define','SalesforceAccount','util','../../config/logger','api','moment'];(function(_0x3ab6e6,_0x52c840){var _0xdf569e=function(_0x1294c9){while(--_0x1294c9){_0x3ab6e6['push'](_0x3ab6e6['shift']());}};_0xdf569e(++_0x52c840);}(_0x4e4d,0xba));var _0xd4e4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4e4d[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0xd4e4('0x0'));var logger=require(_0xd4e4('0x1'))(_0xd4e4('0x2'));var moment=require(_0xd4e4('0x3'));var BPromise=require(_0xd4e4('0x4'));var rp=require(_0xd4e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4e4('0x6'));var config=require(_0xd4e4('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4e28f1,_0x38ee7e){return _0x4e28f1[_0xd4e4('0x8')](_0xd4e4('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x634f=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x4a51e5,_0x9a2979){var _0x505d2f=function(_0x3b0daf){while(--_0x3b0daf){_0x4a51e5['push'](_0x4a51e5['shift']());}};_0x505d2f(++_0x9a2979);}(_0x634f,0xa2));var _0xf634=function(_0xcf38aa,_0x3c8af7){_0xcf38aa=_0xcf38aa-0x0;var _0x33ee4a=_0x634f[_0xcf38aa];return _0x33ee4a;};'use strict';var _=require('lodash');var util=require(_0xf634('0x0'));var logger=require(_0xf634('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf634('0x2'));var rp=require(_0xf634('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf634('0x4'));var config=require(_0xf634('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xf634('0x6'));module['exports']=function(_0x4cb85c,_0x55c5f8){return _0x4cb85c[_0xf634('0x7')](_0xf634('0x8'),attributes,{'tableName':_0xf634('0x9'),'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 e7ea735..b24da45 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 _0x4744=['../../config/environment','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowSalesforceAccount','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x4744,0x107));var _0x4474=function(_0x4de8ca,_0x5ce026){_0x4de8ca=_0x4de8ca-0x0;var _0x4deb83=_0x4744[_0x4de8ca];return _0x4deb83;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc08a4c,_0x3024cd,_0x1dcdf0){return new BPromise(function(_0x387297,_0x247b66){return client[_0x4474('0xb')](_0xc08a4c,_0x1dcdf0)['then'](function(_0x17c4f7){logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,_0x4474('0xe'));logger[_0x4474('0xf')](_0x4474('0x10'),_0x3024cd,_0x4474('0xe'),JSON['stringify'](_0x17c4f7));if(_0x17c4f7['error']){if(_0x17c4f7['error']['code']===0x1f4){logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7['error'][_0x4474('0x12')]);return _0x247b66(_0x17c4f7['error'][_0x4474('0x12')]);}logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);return _0x387297(_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);}else{logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,'request\x20sent');_0x387297(_0x17c4f7[_0x4474('0x13')]['message']);}})['catch'](function(_0x46b79d){logger[_0x4474('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3024cd,_0x46b79d);_0x247b66(_0x46b79d);});});}exports[_0x4474('0x14')]=function(_0x356a37){var _0x1dc845=this;return new Promise(function(_0x22ed33,_0x21debd){return db[_0x4474('0x15')]['findAll']({'raw':_0x356a37[_0x4474('0x16')]?_0x356a37['options'][_0x4474('0x17')]===undefined?!![]:![]:!![],'where':_0x356a37[_0x4474('0x16')]?_0x356a37[_0x4474('0x16')][_0x4474('0x18')]||null:null,'attributes':_0x356a37['options']?_0x356a37['options'][_0x4474('0x19')]||null:null,'limit':_0x356a37[_0x4474('0x16')]?_0x356a37['options'][_0x4474('0x1a')]||null:null,'include':_0x356a37[_0x4474('0x16')]?_0x356a37[_0x4474('0x16')][_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x356a37[_0x4474('0x16')][_0x4474('0x1b')],function(_0x3009d8){return{'model':db[_0x3009d8[_0x4474('0x1d')]],'as':_0x3009d8['as'],'attributes':_0x3009d8[_0x4474('0x19')],'include':_0x3009d8[_0x4474('0x1b')]?_['map'](_0x3009d8[_0x4474('0x1b')],function(_0xd34139){return{'model':db[_0xd34139[_0x4474('0x1d')]],'as':_0xd34139['as'],'attributes':_0xd34139['attributes'],'include':_0xd34139['include']?_['map'](_0xd34139['include'],function(_0x5870aa){return{'model':db[_0x5870aa[_0x4474('0x1d')]],'as':_0x5870aa['as'],'attributes':_0x5870aa[_0x4474('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37e58d){logger[_0x4474('0xc')](_0x4474('0x14'),_0x356a37);logger[_0x4474('0xf')](_0x4474('0x14'),_0x356a37,JSON[_0x4474('0x1e')](_0x37e58d));_0x22ed33(_0x37e58d);})[_0x4474('0x1f')](function(_0x3be419){logger[_0x4474('0x11')](_0x4474('0x14'),_0x3be419[_0x4474('0x12')],_0x356a37);_0x21debd(_0x1dc845[_0x4474('0x11')](0x1f4,_0x3be419['message']));});});};exports[_0x4474('0x20')]=function(_0x19f048){var _0x283963=this;return new Promise(function(_0x49b381,_0xc1b736){return db[_0x4474('0x15')]['find']({'raw':_0x19f048[_0x4474('0x16')]?_0x19f048[_0x4474('0x16')][_0x4474('0x17')]===undefined?!![]:![]:!![],'where':_0x19f048[_0x4474('0x16')]?_0x19f048['options'][_0x4474('0x18')]||null:null,'attributes':_0x19f048['options']?_0x19f048[_0x4474('0x16')][_0x4474('0x19')]||null:null,'include':_0x19f048['options']?_0x19f048['options']['include']?_[_0x4474('0x1c')](_0x19f048[_0x4474('0x16')][_0x4474('0x1b')],function(_0x15a96d){return{'model':db[_0x15a96d[_0x4474('0x1d')]],'as':_0x15a96d['as'],'attributes':_0x15a96d[_0x4474('0x19')],'include':_0x15a96d[_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x15a96d[_0x4474('0x1b')],function(_0x5e650e){return{'model':db[_0x5e650e['model']],'as':_0x5e650e['as'],'attributes':_0x5e650e['attributes'],'include':_0x5e650e[_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x5e650e[_0x4474('0x1b')],function(_0xbe64b3){return{'model':db[_0xbe64b3[_0x4474('0x1d')]],'as':_0xbe64b3['as'],'attributes':_0xbe64b3[_0x4474('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4474('0x21')](function(_0x2d7fbd){logger['info']('ShowSalesforceAccount',_0x19f048);logger[_0x4474('0xf')](_0x4474('0x20'),_0x19f048,JSON['stringify'](_0x2d7fbd));_0x49b381(_0x2d7fbd);})[_0x4474('0x1f')](function(_0x48c1e0){logger[_0x4474('0x11')]('ShowSalesforceAccount',_0x48c1e0[_0x4474('0x12')],_0x19f048);_0xc1b736(_0x283963[_0x4474('0x11')](0x1f4,_0x48c1e0[_0x4474('0x12')]));});});}; \ No newline at end of file +var _0xe65b=['jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4df189,_0x4e3c0d){var _0x36b9d0=function(_0x113aed){while(--_0x113aed){_0x4df189['push'](_0x4df189['shift']());}};_0x36b9d0(++_0x4e3c0d);}(_0xe65b,0xf9));var _0xbe65=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe65b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbe65('0x0'));var util=require(_0xbe65('0x1'));var moment=require(_0xbe65('0x2'));var BPromise=require(_0xbe65('0x3'));var rs=require(_0xbe65('0x4'));var fs=require('fs');var Redis=require(_0xbe65('0x5'));var db=require(_0xbe65('0x6'))['db'];var utils=require(_0xbe65('0x7'));var logger=require(_0xbe65('0x8'))(_0xbe65('0x9'));var config=require('../../config/environment');var jayson=require(_0xbe65('0xa'));var client=jayson[_0xbe65('0xb')][_0xbe65('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b2343,_0x2959e4,_0x4f62e7){return new BPromise(function(_0x2a1f1a,_0x9d4133){return client['request'](_0x5b2343,_0x4f62e7)[_0xbe65('0xd')](function(_0x39ea56){logger['info'](_0xbe65('0xe'),_0x2959e4,_0xbe65('0xf'));logger[_0xbe65('0x10')](_0xbe65('0x11'),_0x2959e4,_0xbe65('0xf'),JSON[_0xbe65('0x12')](_0x39ea56));if(_0x39ea56[_0xbe65('0x13')]){if(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x14')]===0x1f4){logger['error'](_0xbe65('0xe'),_0x2959e4,_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);return _0x9d4133(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);}logger[_0xbe65('0x13')](_0xbe65('0xe'),_0x2959e4,_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);return _0x2a1f1a(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);}else{logger[_0xbe65('0x16')]('SalesforceAccount,\x20%s,\x20%s',_0x2959e4,'request\x20sent');_0x2a1f1a(_0x39ea56[_0xbe65('0x17')][_0xbe65('0x15')]);}})[_0xbe65('0x18')](function(_0x57349c){logger[_0xbe65('0x13')](_0xbe65('0xe'),_0x2959e4,_0x57349c);_0x9d4133(_0x57349c);});});}exports[_0xbe65('0x19')]=function(_0xf91b21){var _0x32b5fc=this;return new Promise(function(_0x2bb0ee,_0x596404){return db[_0xbe65('0x1a')][_0xbe65('0x1b')]({'raw':_0xf91b21['options']?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x1d')]===undefined?!![]:![]:!![],'where':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21['options'][_0xbe65('0x1e')]||null:null,'attributes':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x1f')]||null:null,'limit':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21['options'][_0xbe65('0x20')]||null:null,'include':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x21')]?_[_0xbe65('0x22')](_0xf91b21[_0xbe65('0x1c')]['include'],function(_0x34c4ff){return{'model':db[_0x34c4ff[_0xbe65('0x23')]],'as':_0x34c4ff['as'],'attributes':_0x34c4ff[_0xbe65('0x1f')],'include':_0x34c4ff[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x34c4ff[_0xbe65('0x21')],function(_0x4a0773){return{'model':db[_0x4a0773[_0xbe65('0x23')]],'as':_0x4a0773['as'],'attributes':_0x4a0773[_0xbe65('0x1f')],'include':_0x4a0773['include']?_['map'](_0x4a0773[_0xbe65('0x21')],function(_0x12f233){return{'model':db[_0x12f233[_0xbe65('0x23')]],'as':_0x12f233['as'],'attributes':_0x12f233[_0xbe65('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f843b){logger[_0xbe65('0x16')](_0xbe65('0x19'),_0xf91b21);logger[_0xbe65('0x10')]('GetSalesforceAccount',_0xf91b21,JSON[_0xbe65('0x12')](_0x1f843b));_0x2bb0ee(_0x1f843b);})[_0xbe65('0x18')](function(_0xb0cebf){logger[_0xbe65('0x13')](_0xbe65('0x19'),_0xb0cebf[_0xbe65('0x15')],_0xf91b21);_0x596404(_0x32b5fc[_0xbe65('0x13')](0x1f4,_0xb0cebf[_0xbe65('0x15')]));});});};exports[_0xbe65('0x24')]=function(_0x5926d7){var _0x540a35=this;return new Promise(function(_0x5db38b,_0x10faf5){return db[_0xbe65('0x1a')]['find']({'raw':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x1d')]===undefined?!![]:![]:!![],'where':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7['options'][_0xbe65('0x1e')]||null:null,'attributes':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x1f')]||null:null,'include':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x21')]?_['map'](_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x21')],function(_0x270637){return{'model':db[_0x270637[_0xbe65('0x23')]],'as':_0x270637['as'],'attributes':_0x270637[_0xbe65('0x1f')],'include':_0x270637[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x270637['include'],function(_0x19bf28){return{'model':db[_0x19bf28[_0xbe65('0x23')]],'as':_0x19bf28['as'],'attributes':_0x19bf28[_0xbe65('0x1f')],'include':_0x19bf28[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x19bf28[_0xbe65('0x21')],function(_0x11363e){return{'model':db[_0x11363e['model']],'as':_0x11363e['as'],'attributes':_0x11363e[_0xbe65('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbe65('0xd')](function(_0x4940e1){logger[_0xbe65('0x16')](_0xbe65('0x24'),_0x5926d7);logger[_0xbe65('0x10')](_0xbe65('0x24'),_0x5926d7,JSON[_0xbe65('0x12')](_0x4940e1));_0x5db38b(_0x4940e1);})[_0xbe65('0x18')](function(_0x3be595){logger['error'](_0xbe65('0x24'),_0x3be595[_0xbe65('0x15')],_0x5926d7);_0x10faf5(_0x540a35[_0xbe65('0x13')](0x1f4,_0x3be595[_0xbe65('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 15b39c5..398aad0 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x53a9ec,_0x1f41f2){var _0x194cda=function(_0x3f843b){while(--_0x3f843b){_0x53a9ec['push'](_0x53a9ec['shift']());}};_0x194cda(++_0x1f41f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ea6c0,_0x27bcff){_0x5ea6c0=_0x5ea6c0-0x0;var _0x1d8906=_0x5f2f[_0x5ea6c0];return _0x1d8906;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0b0e[_0x4b73a2];return _0x383c66;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('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 14aa7d9..0088e67 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 _0xccf2=['STRING','Case','Task','ENUM','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports'];(function(_0x2eaf81,_0x2c41da){var _0x3ed5fc=function(_0x186b87){while(--_0x186b87){_0x2eaf81['push'](_0x2eaf81['shift']());}};_0x3ed5fc(++_0x2c41da);}(_0xccf2,0xc4));var _0x2ccf=function(_0x2d49dc,_0x3f7af0){_0x2d49dc=_0x2d49dc-0x0;var _0x193c97=_0xccf2[_0x2d49dc];return _0x193c97;};'use strict';var Sequelize=require(_0x2ccf('0x0'));module[_0x2ccf('0x1')]={'name':{'type':Sequelize[_0x2ccf('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0x2ccf('0x3')),'defaultValue':_0x2ccf('0x4')},'moduleSearch':{'type':Sequelize[_0x2ccf('0x5')](_0x2ccf('0x6'),_0x2ccf('0x7'),_0x2ccf('0x8'),_0x2ccf('0x9'),_0x2ccf('0xa')),'defaultValue':_0x2ccf('0x6')},'moduleCreate':{'type':Sequelize[_0x2ccf('0x5')]('nothing',_0x2ccf('0x7'),_0x2ccf('0x8'),'account'),'defaultValue':_0x2ccf('0x8')},'leadId':{'type':Sequelize[_0x2ccf('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x2ccf('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x2ccf('0x2')]}}; \ No newline at end of file +var _0x7a85=['Case','contact_lead','lead','account_contact_lead','contact','account','sequelize','STRING','ENUM','Task'];(function(_0x599ef7,_0x244949){var _0x9ed478=function(_0x1f5008){while(--_0x1f5008){_0x599ef7['push'](_0x599ef7['shift']());}};_0x9ed478(++_0x244949);}(_0x7a85,0x16e));var _0x57a8=function(_0x5ca82c,_0x3b304b){_0x5ca82c=_0x5ca82c-0x0;var _0x46089b=_0x7a85[_0x5ca82c];return _0x46089b;};'use strict';var Sequelize=require(_0x57a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x57a8('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x57a8('0x2')](_0x57a8('0x3'),_0x57a8('0x4')),'defaultValue':_0x57a8('0x3')},'moduleSearch':{'type':Sequelize[_0x57a8('0x2')](_0x57a8('0x5'),'contact',_0x57a8('0x6'),_0x57a8('0x7'),'account'),'defaultValue':_0x57a8('0x5')},'moduleCreate':{'type':Sequelize[_0x57a8('0x2')]('nothing',_0x57a8('0x8'),'lead',_0x57a8('0x9')),'defaultValue':_0x57a8('0x6')},'leadId':{'type':Sequelize[_0x57a8('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x57a8('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x57a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ad24737..47756aa 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 _0xf2fa=['Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','length','find','create','catch','body','params','getFields','SalesforceField','pick','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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','sendStatus','status','offset','undefined','limit','count','set'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xf2fa,0x12f));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaf2f('0x0'));var rimraf=require(_0xaf2f('0x1'));var zipdir=require(_0xaf2f('0x2'));var jsonpatch=require(_0xaf2f('0x3'));var rp=require('request-promise');var moment=require(_0xaf2f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf2f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xaf2f('0x6'));var csv=require(_0xaf2f('0x7'));var ejs=require(_0xaf2f('0x8'));var fs=require('fs');var fs_extra=require(_0xaf2f('0x9'));var _=require(_0xaf2f('0xa'));var squel=require('squel');var crypto=require(_0xaf2f('0xb'));var jsforce=require(_0xaf2f('0xc'));var deskjs=require(_0xaf2f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaf2f('0xe'));var Papa=require(_0xaf2f('0xf'));var Redis=require(_0xaf2f('0x10'));var authService=require(_0xaf2f('0x11'));var qs=require(_0xaf2f('0x12'));var as=require(_0xaf2f('0x13'));var hardwareService=require(_0xaf2f('0x14'));var logger=require(_0xaf2f('0x15'))(_0xaf2f('0x16'));var utils=require(_0xaf2f('0x17'));var config=require(_0xaf2f('0x18'));var licenseUtil=require(_0xaf2f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bea57,_0x35977c){_0x35977c=_0x35977c||0xcc;return function(_0x443276){if(_0x443276){return _0x2bea57[_0xaf2f('0x1a')](_0x35977c);}return _0x2bea57['status'](_0x35977c)['end']();};}function respondWithResult(_0x2ee210,_0x3d3de2){_0x3d3de2=_0x3d3de2||0xc8;return function(_0x25b90d){if(_0x25b90d){return _0x2ee210[_0xaf2f('0x1b')](_0x3d3de2)['json'](_0x25b90d);}};}function respondWithFilteredResult(_0xf25d57,_0x45fded){return function(_0x40c377){if(_0x40c377){var _0x23bd16=typeof _0x45fded[_0xaf2f('0x1c')]===_0xaf2f('0x1d')&&typeof _0x45fded[_0xaf2f('0x1e')]===_0xaf2f('0x1d');var _0x111b5c=_0x40c377[_0xaf2f('0x1f')];var _0x5e20be=_0x23bd16?0x0:_0x45fded[_0xaf2f('0x1c')];var _0xa891a0=_0x23bd16?_0x40c377[_0xaf2f('0x1f')]:_0x45fded[_0xaf2f('0x1c')]+_0x45fded[_0xaf2f('0x1e')];var _0x4fcac8;if(_0xa891a0>=_0x111b5c){_0xa891a0=_0x111b5c;_0x4fcac8=0xc8;}else{_0x4fcac8=0xce;}_0xf25d57[_0xaf2f('0x1b')](_0x4fcac8);return _0xf25d57[_0xaf2f('0x20')](_0xaf2f('0x21'),_0x5e20be+'-'+_0xa891a0+'/'+_0x111b5c)[_0xaf2f('0x22')](_0x40c377);}return null;};}function patchUpdates(_0x2be4a8){return function(_0x1908d2){try{jsonpatch[_0xaf2f('0x23')](_0x1908d2,_0x2be4a8,!![]);}catch(_0x3f0e47){return BPromise[_0xaf2f('0x24')](_0x3f0e47);}return _0x1908d2[_0xaf2f('0x25')]();};}function saveUpdates(_0x266b09,_0x9c71d2){return function(_0x334d7){if(_0x334d7){return _0x334d7[_0xaf2f('0x26')](_0x266b09)[_0xaf2f('0x27')](function(_0xaaa640){return _0xaaa640;});}return null;};}function removeEntity(_0xf1ef9d,_0x36ed71){return function(_0x14cff2){if(_0x14cff2){return _0x14cff2[_0xaf2f('0x28')]()['then'](function(){_0xf1ef9d[_0xaf2f('0x1b')](0xcc)[_0xaf2f('0x29')]();});}};}function handleEntityNotFound(_0xcf0788,_0x414afe){return function(_0x1a6a57){if(!_0x1a6a57){_0xcf0788['sendStatus'](0x194);}return _0x1a6a57;};}function handleError(_0x10461b,_0x155582){_0x155582=_0x155582||0x1f4;return function(_0x3c0179){logger[_0xaf2f('0x2a')](_0x3c0179['stack']);if(_0x3c0179['name']){delete _0x3c0179[_0xaf2f('0x2b')];}_0x10461b[_0xaf2f('0x1b')](_0x155582)[_0xaf2f('0x2c')](_0x3c0179);};}exports['index']=function(_0x328fd1,_0x1f4b58){var _0x48bb42={},_0x3b2ec0={},_0x10b06f={'count':0x0,'rows':[]};var _0x43814e=_[_0xaf2f('0x2d')](db[_0xaf2f('0x2e')][_0xaf2f('0x2f')],function(_0x383f26){return{'name':_0x383f26[_0xaf2f('0x30')],'type':_0x383f26['type'][_0xaf2f('0x31')]};});_0x3b2ec0['model']=_[_0xaf2f('0x2d')](_0x43814e,'name');_0x3b2ec0[_0xaf2f('0x32')]=_[_0xaf2f('0x33')](_0x328fd1['query']);_0x3b2ec0[_0xaf2f('0x34')]=_[_0xaf2f('0x35')](_0x3b2ec0[_0xaf2f('0x36')],_0x3b2ec0[_0xaf2f('0x32')]);_0x48bb42[_0xaf2f('0x37')]=_['intersection'](_0x3b2ec0[_0xaf2f('0x36')],qs['fields'](_0x328fd1[_0xaf2f('0x32')]['fields']));_0x48bb42[_0xaf2f('0x37')]=_0x48bb42[_0xaf2f('0x37')]['length']?_0x48bb42[_0xaf2f('0x37')]:_0x3b2ec0['model'];if(!_0x328fd1[_0xaf2f('0x32')][_0xaf2f('0x38')]('nolimit')){_0x48bb42['limit']=qs['limit'](_0x328fd1['query']['limit']);_0x48bb42[_0xaf2f('0x1c')]=qs[_0xaf2f('0x1c')](_0x328fd1[_0xaf2f('0x32')][_0xaf2f('0x1c')]);}_0x48bb42[_0xaf2f('0x39')]=qs[_0xaf2f('0x3a')](_0x328fd1[_0xaf2f('0x32')][_0xaf2f('0x3a')]);_0x48bb42[_0xaf2f('0x3b')]=qs[_0xaf2f('0x34')](_['pick'](_0x328fd1['query'],_0x3b2ec0['filters']),_0x43814e);if(_0x328fd1['query'][_0xaf2f('0x3c')]){_0x48bb42[_0xaf2f('0x3b')]=_[_0xaf2f('0x3d')](_0x48bb42['where'],{'$or':_[_0xaf2f('0x2d')](_0x43814e,function(_0x13f24a){if(_0x13f24a[_0xaf2f('0x3e')]!==_0xaf2f('0x3f')){var _0x1d5592={};_0x1d5592[_0x13f24a[_0xaf2f('0x2b')]]={'$like':'%'+_0x328fd1['query'][_0xaf2f('0x3c')]+'%'};return _0x1d5592;}})});}_0x48bb42=_[_0xaf2f('0x3d')]({},_0x48bb42,_0x328fd1[_0xaf2f('0x40')]);var _0x2c24bd={'where':_0x48bb42[_0xaf2f('0x3b')]};return db[_0xaf2f('0x2e')][_0xaf2f('0x1f')](_0x2c24bd)['then'](function(_0x970e36){_0x10b06f[_0xaf2f('0x1f')]=_0x970e36;if(_0x328fd1[_0xaf2f('0x32')][_0xaf2f('0x41')]){_0x48bb42[_0xaf2f('0x42')]=[{'all':!![]}];}return db[_0xaf2f('0x2e')][_0xaf2f('0x43')](_0x48bb42);})[_0xaf2f('0x27')](function(_0x28bb3d){_0x10b06f[_0xaf2f('0x44')]=_0x28bb3d;return _0x10b06f;})[_0xaf2f('0x27')](respondWithFilteredResult(_0x1f4b58,_0x48bb42))['catch'](handleError(_0x1f4b58,null));};exports[_0xaf2f('0x45')]=function(_0x4c8685,_0x3de9eb){var _0xba0161={'raw':![],'where':{'id':_0x4c8685['params']['id']}},_0x3302c6={};_0x3302c6[_0xaf2f('0x36')]=_[_0xaf2f('0x33')](db[_0xaf2f('0x2e')]['rawAttributes']);_0x3302c6[_0xaf2f('0x32')]=_[_0xaf2f('0x33')](_0x4c8685[_0xaf2f('0x32')]);_0x3302c6['filters']=_['intersection'](_0x3302c6[_0xaf2f('0x36')],_0x3302c6[_0xaf2f('0x32')]);_0xba0161[_0xaf2f('0x37')]=_[_0xaf2f('0x35')](_0x3302c6[_0xaf2f('0x36')],qs['fields'](_0x4c8685[_0xaf2f('0x32')][_0xaf2f('0x46')]));_0xba0161[_0xaf2f('0x37')]=_0xba0161[_0xaf2f('0x37')][_0xaf2f('0x47')]?_0xba0161[_0xaf2f('0x37')]:_0x3302c6[_0xaf2f('0x36')];if(_0x4c8685[_0xaf2f('0x32')]['includeAll']){_0xba0161[_0xaf2f('0x42')]=[{'all':!![]}];}_0xba0161=_[_0xaf2f('0x3d')]({},_0xba0161,_0x4c8685['options']);return db[_0xaf2f('0x2e')][_0xaf2f('0x48')](_0xba0161)['then'](handleEntityNotFound(_0x3de9eb,null))[_0xaf2f('0x27')](respondWithResult(_0x3de9eb,null))['catch'](handleError(_0x3de9eb,null));};exports['create']=function(_0x23ca32,_0x1cf1f0){return db['SalesforceConfiguration'][_0xaf2f('0x49')](_0x23ca32['body'],{})['then'](respondWithResult(_0x1cf1f0,0xc9))[_0xaf2f('0x4a')](handleError(_0x1cf1f0,null));};exports[_0xaf2f('0x26')]=function(_0x3f6ff8,_0x198c5f){if(_0x3f6ff8[_0xaf2f('0x4b')]['id']){delete _0x3f6ff8[_0xaf2f('0x4b')]['id'];}return db['SalesforceConfiguration'][_0xaf2f('0x48')]({'where':{'id':_0x3f6ff8[_0xaf2f('0x4c')]['id']}})[_0xaf2f('0x27')](handleEntityNotFound(_0x198c5f,null))['then'](saveUpdates(_0x3f6ff8[_0xaf2f('0x4b')],null))[_0xaf2f('0x27')](respondWithResult(_0x198c5f,null))[_0xaf2f('0x4a')](handleError(_0x198c5f,null));};exports[_0xaf2f('0x28')]=function(_0x4ee818,_0x2f7da3){return db[_0xaf2f('0x2e')][_0xaf2f('0x48')]({'where':{'id':_0x4ee818[_0xaf2f('0x4c')]['id']}})[_0xaf2f('0x27')](handleEntityNotFound(_0x2f7da3,null))[_0xaf2f('0x27')](removeEntity(_0x2f7da3,null))[_0xaf2f('0x4a')](handleError(_0x2f7da3,null));};exports[_0xaf2f('0x4d')]=function(_0x4e4829,_0x492d0f,_0x489d35){var _0x236b4f={};var _0x5d09ca={};var _0x5ea7d4;var _0x4689dc;return db[_0xaf2f('0x2e')]['findOne']({'where':{'id':_0x4e4829[_0xaf2f('0x4c')]['id']}})[_0xaf2f('0x27')](handleEntityNotFound(_0x492d0f,null))[_0xaf2f('0x27')](function(_0x2ac2f5){if(_0x2ac2f5){_0x5ea7d4=_0x2ac2f5;_0x5d09ca['model']=_[_0xaf2f('0x33')](db[_0xaf2f('0x4e')]['rawAttributes']);_0x5d09ca[_0xaf2f('0x32')]=_[_0xaf2f('0x33')](_0x4e4829[_0xaf2f('0x32')]);_0x5d09ca['filters']=_[_0xaf2f('0x35')](_0x5d09ca[_0xaf2f('0x36')],_0x5d09ca[_0xaf2f('0x32')]);_0x236b4f[_0xaf2f('0x37')]=_[_0xaf2f('0x35')](_0x5d09ca[_0xaf2f('0x36')],qs[_0xaf2f('0x46')](_0x4e4829[_0xaf2f('0x32')][_0xaf2f('0x46')]));_0x236b4f[_0xaf2f('0x37')]=_0x236b4f['attributes']['length']?_0x236b4f[_0xaf2f('0x37')]:_0x5d09ca['model'];_0x236b4f[_0xaf2f('0x39')]=qs['sort'](_0x4e4829['query']['sort']);_0x236b4f[_0xaf2f('0x3b')]=qs[_0xaf2f('0x34')](_[_0xaf2f('0x4f')](_0x4e4829[_0xaf2f('0x32')],_0x5d09ca[_0xaf2f('0x34')]));if(_0x4e4829['query']['filter']){_0x236b4f[_0xaf2f('0x3b')]=_[_0xaf2f('0x3d')](_0x236b4f['where'],{'$or':_[_0xaf2f('0x2d')](_0x236b4f[_0xaf2f('0x37')],function(_0x298e9e){var _0x402602={};_0x402602[_0x298e9e]={'$like':'%'+_0x4e4829[_0xaf2f('0x32')]['filter']+'%'};return _0x402602;})});}_0x236b4f=_[_0xaf2f('0x3d')]({},_0x236b4f,_0x4e4829[_0xaf2f('0x40')]);return _0x5ea7d4[_0xaf2f('0x4d')](_0x236b4f);}})[_0xaf2f('0x27')](function(_0x166005){if(_0x166005){_0x4689dc=_0x166005[_0xaf2f('0x47')];if(!_0x4e4829[_0xaf2f('0x32')][_0xaf2f('0x38')]('nolimit')){_0x236b4f[_0xaf2f('0x1e')]=qs['limit'](_0x4e4829[_0xaf2f('0x32')][_0xaf2f('0x1e')]);_0x236b4f['offset']=qs[_0xaf2f('0x1c')](_0x4e4829[_0xaf2f('0x32')][_0xaf2f('0x1c')]);}return _0x5ea7d4['getFields'](_0x236b4f);}})[_0xaf2f('0x27')](function(_0x79a87){if(_0x79a87){return _0x79a87?{'count':_0x4689dc,'rows':_0x79a87}:null;}})[_0xaf2f('0x27')](respondWithResult(_0x492d0f,null))['catch'](handleError(_0x492d0f,null));};exports[_0xaf2f('0x50')]=function(_0x22885a,_0x3ef538,_0x4cfa83){var _0x3654f8={};var _0x1360da={};var _0x5e481f;var _0x18759c;return db[_0xaf2f('0x2e')][_0xaf2f('0x51')]({'where':{'id':_0x22885a[_0xaf2f('0x4c')]['id']}})[_0xaf2f('0x27')](handleEntityNotFound(_0x3ef538,null))[_0xaf2f('0x27')](function(_0x4fbf37){if(_0x4fbf37){_0x5e481f=_0x4fbf37;_0x1360da[_0xaf2f('0x36')]=_[_0xaf2f('0x33')](db[_0xaf2f('0x4e')][_0xaf2f('0x2f')]);_0x1360da[_0xaf2f('0x32')]=_['keys'](_0x22885a['query']);_0x1360da[_0xaf2f('0x34')]=_[_0xaf2f('0x35')](_0x1360da[_0xaf2f('0x36')],_0x1360da[_0xaf2f('0x32')]);_0x3654f8['attributes']=_[_0xaf2f('0x35')](_0x1360da[_0xaf2f('0x36')],qs[_0xaf2f('0x46')](_0x22885a[_0xaf2f('0x32')][_0xaf2f('0x46')]));_0x3654f8[_0xaf2f('0x37')]=_0x3654f8[_0xaf2f('0x37')][_0xaf2f('0x47')]?_0x3654f8[_0xaf2f('0x37')]:_0x1360da[_0xaf2f('0x36')];_0x3654f8[_0xaf2f('0x39')]=qs[_0xaf2f('0x3a')](_0x22885a[_0xaf2f('0x32')]['sort']);_0x3654f8[_0xaf2f('0x3b')]=qs[_0xaf2f('0x34')](_[_0xaf2f('0x4f')](_0x22885a['query'],_0x1360da[_0xaf2f('0x34')]));if(_0x22885a['query'][_0xaf2f('0x3c')]){_0x3654f8[_0xaf2f('0x3b')]=_[_0xaf2f('0x3d')](_0x3654f8['where'],{'$or':_[_0xaf2f('0x2d')](_0x3654f8[_0xaf2f('0x37')],function(_0x4a07a2){var _0x2b2f64={};_0x2b2f64[_0x4a07a2]={'$like':'%'+_0x22885a['query']['filter']+'%'};return _0x2b2f64;})});}_0x3654f8=_[_0xaf2f('0x3d')]({},_0x3654f8,_0x22885a['options']);return _0x5e481f[_0xaf2f('0x50')](_0x3654f8);}})[_0xaf2f('0x27')](function(_0x2d187a){if(_0x2d187a){_0x18759c=_0x2d187a['length'];if(!_0x22885a[_0xaf2f('0x32')][_0xaf2f('0x38')](_0xaf2f('0x52'))){_0x3654f8[_0xaf2f('0x1e')]=qs[_0xaf2f('0x1e')](_0x22885a[_0xaf2f('0x32')][_0xaf2f('0x1e')]);_0x3654f8['offset']=qs['offset'](_0x22885a['query'][_0xaf2f('0x1c')]);}return _0x5e481f[_0xaf2f('0x50')](_0x3654f8);}})[_0xaf2f('0x27')](function(_0x39cae5){if(_0x39cae5){return _0x39cae5?{'count':_0x18759c,'rows':_0x39cae5}:null;}})['then'](respondWithResult(_0x3ef538,null))['catch'](handleError(_0x3ef538,null));};exports[_0xaf2f('0x53')]=function(_0x46d90f,_0x4f3f2e,_0x51c8ea){var _0x34a902={};var _0x473dc7={};var _0x107931;var _0x127309;return db[_0xaf2f('0x2e')]['findOne']({'where':{'id':_0x46d90f[_0xaf2f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f3f2e,null))['then'](function(_0x2da26e){if(_0x2da26e){_0x107931=_0x2da26e;_0x473dc7[_0xaf2f('0x36')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x473dc7['query']=_[_0xaf2f('0x33')](_0x46d90f[_0xaf2f('0x32')]);_0x473dc7['filters']=_[_0xaf2f('0x35')](_0x473dc7[_0xaf2f('0x36')],_0x473dc7[_0xaf2f('0x32')]);_0x34a902[_0xaf2f('0x37')]=_[_0xaf2f('0x35')](_0x473dc7['model'],qs[_0xaf2f('0x46')](_0x46d90f[_0xaf2f('0x32')][_0xaf2f('0x46')]));_0x34a902['attributes']=_0x34a902[_0xaf2f('0x37')][_0xaf2f('0x47')]?_0x34a902[_0xaf2f('0x37')]:_0x473dc7[_0xaf2f('0x36')];_0x34a902[_0xaf2f('0x39')]=qs[_0xaf2f('0x3a')](_0x46d90f['query'][_0xaf2f('0x3a')]);_0x34a902[_0xaf2f('0x3b')]=qs[_0xaf2f('0x34')](_[_0xaf2f('0x4f')](_0x46d90f['query'],_0x473dc7[_0xaf2f('0x34')]));if(_0x46d90f[_0xaf2f('0x32')][_0xaf2f('0x3c')]){_0x34a902[_0xaf2f('0x3b')]=_[_0xaf2f('0x3d')](_0x34a902[_0xaf2f('0x3b')],{'$or':_[_0xaf2f('0x2d')](_0x34a902['attributes'],function(_0xf4266e){var _0x234208={};_0x234208[_0xf4266e]={'$like':'%'+_0x46d90f['query']['filter']+'%'};return _0x234208;})});}_0x34a902=_[_0xaf2f('0x3d')]({},_0x34a902,_0x46d90f[_0xaf2f('0x40')]);return _0x107931['getDescriptions'](_0x34a902);}})[_0xaf2f('0x27')](function(_0x29f0cc){if(_0x29f0cc){_0x127309=_0x29f0cc[_0xaf2f('0x47')];if(!_0x46d90f[_0xaf2f('0x32')]['hasOwnProperty'](_0xaf2f('0x52'))){_0x34a902[_0xaf2f('0x1e')]=qs[_0xaf2f('0x1e')](_0x46d90f['query']['limit']);_0x34a902[_0xaf2f('0x1c')]=qs[_0xaf2f('0x1c')](_0x46d90f['query'][_0xaf2f('0x1c')]);}return _0x107931['getDescriptions'](_0x34a902);}})[_0xaf2f('0x27')](function(_0x569e12){if(_0x569e12){return _0x569e12?{'count':_0x127309,'rows':_0x569e12}:null;}})['then'](respondWithResult(_0x4f3f2e,null))[_0xaf2f('0x4a')](handleError(_0x4f3f2e,null));}; \ No newline at end of file +var _0xc254=['params','length','include','options','find','catch','create','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show'];(function(_0x2a3b44,_0x653ff3){var _0x4b45d2=function(_0x50a0f5){while(--_0x50a0f5){_0x2a3b44['push'](_0x2a3b44['shift']());}};_0x4b45d2(++_0x653ff3);}(_0xc254,0x1ed));var _0x4c25=function(_0x5216a5,_0x43fdf8){_0x5216a5=_0x5216a5-0x0;var _0x44d64b=_0xc254[_0x5216a5];return _0x44d64b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c25('0x0'));var jsonpatch=require(_0x4c25('0x1'));var rp=require(_0x4c25('0x2'));var moment=require(_0x4c25('0x3'));var BPromise=require(_0x4c25('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c25('0x5'));var sox=require(_0x4c25('0x6'));var csv=require(_0x4c25('0x7'));var ejs=require(_0x4c25('0x8'));var fs=require('fs');var fs_extra=require(_0x4c25('0x9'));var _=require(_0x4c25('0xa'));var squel=require(_0x4c25('0xb'));var crypto=require('crypto');var jsforce=require(_0x4c25('0xc'));var deskjs=require(_0x4c25('0xd'));var toCsv=require(_0x4c25('0x7'));var querystring=require(_0x4c25('0xe'));var Papa=require(_0x4c25('0xf'));var Redis=require(_0x4c25('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c25('0x11'));var as=require(_0x4c25('0x12'));var hardwareService=require(_0x4c25('0x13'));var logger=require(_0x4c25('0x14'))(_0x4c25('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4c25('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c564,_0x2201be){_0x2201be=_0x2201be||0xcc;return function(_0x5b921d){if(_0x5b921d){return _0x28c564[_0x4c25('0x17')](_0x2201be);}return _0x28c564['status'](_0x2201be)[_0x4c25('0x18')]();};}function respondWithResult(_0x55fae2,_0x3c178f){_0x3c178f=_0x3c178f||0xc8;return function(_0x1bfdf7){if(_0x1bfdf7){return _0x55fae2[_0x4c25('0x19')](_0x3c178f)[_0x4c25('0x1a')](_0x1bfdf7);}};}function respondWithFilteredResult(_0x101cb3,_0x509b10){return function(_0x29d036){if(_0x29d036){var _0x29f526=typeof _0x509b10[_0x4c25('0x1b')]===_0x4c25('0x1c')&&typeof _0x509b10[_0x4c25('0x1d')]==='undefined';var _0x4ea7e1=_0x29d036[_0x4c25('0x1e')];var _0x9b96ca=_0x29f526?0x0:_0x509b10[_0x4c25('0x1b')];var _0x137143=_0x29f526?_0x29d036[_0x4c25('0x1e')]:_0x509b10[_0x4c25('0x1b')]+_0x509b10['limit'];var _0x58f99d;if(_0x137143>=_0x4ea7e1){_0x137143=_0x4ea7e1;_0x58f99d=0xc8;}else{_0x58f99d=0xce;}_0x101cb3[_0x4c25('0x19')](_0x58f99d);return _0x101cb3[_0x4c25('0x1f')]('Content-Range',_0x9b96ca+'-'+_0x137143+'/'+_0x4ea7e1)[_0x4c25('0x1a')](_0x29d036);}return null;};}function patchUpdates(_0x5fb8a2){return function(_0x24c8f3){try{jsonpatch[_0x4c25('0x20')](_0x24c8f3,_0x5fb8a2,!![]);}catch(_0x27a03b){return BPromise[_0x4c25('0x21')](_0x27a03b);}return _0x24c8f3['save']();};}function saveUpdates(_0x5e0d05,_0x3790d7){return function(_0x48ac93){if(_0x48ac93){return _0x48ac93[_0x4c25('0x22')](_0x5e0d05)[_0x4c25('0x23')](function(_0x535c52){return _0x535c52;});}return null;};}function removeEntity(_0x1fef83,_0x52bc21){return function(_0x52ef30){if(_0x52ef30){return _0x52ef30[_0x4c25('0x24')]()[_0x4c25('0x23')](function(){_0x1fef83[_0x4c25('0x19')](0xcc)[_0x4c25('0x18')]();});}};}function handleEntityNotFound(_0x807bf7,_0x531e80){return function(_0x278bd0){if(!_0x278bd0){_0x807bf7[_0x4c25('0x17')](0x194);}return _0x278bd0;};}function handleError(_0x489a6e,_0xbe8a38){_0xbe8a38=_0xbe8a38||0x1f4;return function(_0x42e8cb){logger[_0x4c25('0x25')](_0x42e8cb[_0x4c25('0x26')]);if(_0x42e8cb['name']){delete _0x42e8cb[_0x4c25('0x27')];}_0x489a6e[_0x4c25('0x19')](_0xbe8a38)['send'](_0x42e8cb);};}exports[_0x4c25('0x28')]=function(_0x8c51a6,_0x2f1f3d){var _0x1ca83b={},_0x1448f={},_0x4ce969={'count':0x0,'rows':[]};var _0xa5626a=_[_0x4c25('0x29')](db[_0x4c25('0x2a')][_0x4c25('0x2b')],function(_0x253b9e){return{'name':_0x253b9e[_0x4c25('0x2c')],'type':_0x253b9e[_0x4c25('0x2d')][_0x4c25('0x2e')]};});_0x1448f[_0x4c25('0x2f')]=_['map'](_0xa5626a,_0x4c25('0x27'));_0x1448f[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0x8c51a6[_0x4c25('0x30')]);_0x1448f[_0x4c25('0x32')]=_['intersection'](_0x1448f['model'],_0x1448f[_0x4c25('0x30')]);_0x1ca83b[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x1448f['model'],qs['fields'](_0x8c51a6['query'][_0x4c25('0x35')]));_0x1ca83b['attributes']=_0x1ca83b[_0x4c25('0x33')]['length']?_0x1ca83b[_0x4c25('0x33')]:_0x1448f[_0x4c25('0x2f')];if(!_0x8c51a6['query'][_0x4c25('0x36')](_0x4c25('0x37'))){_0x1ca83b['limit']=qs['limit'](_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x1ca83b[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0x8c51a6['query']['offset']);}_0x1ca83b[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0x8c51a6['query'][_0x4c25('0x39')]);_0x1ca83b[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0x8c51a6[_0x4c25('0x30')],_0x1448f[_0x4c25('0x32')]),_0xa5626a);if(_0x8c51a6['query'][_0x4c25('0x3c')]){_0x1ca83b[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x1ca83b[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0xa5626a,function(_0x7cf14c){if(_0x7cf14c[_0x4c25('0x2d')]!==_0x4c25('0x3e')){var _0x5ac09a={};_0x5ac09a[_0x7cf14c[_0x4c25('0x27')]]={'$like':'%'+_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x3c')]+'%'};return _0x5ac09a;}})});}_0x1ca83b=_[_0x4c25('0x3d')]({},_0x1ca83b,_0x8c51a6['options']);var _0x917ea1={'where':_0x1ca83b[_0x4c25('0x3a')]};return db[_0x4c25('0x2a')][_0x4c25('0x1e')](_0x917ea1)['then'](function(_0x5f47ba){_0x4ce969[_0x4c25('0x1e')]=_0x5f47ba;if(_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x3f')]){_0x1ca83b['include']=[{'all':!![]}];}return db[_0x4c25('0x2a')][_0x4c25('0x40')](_0x1ca83b);})['then'](function(_0x408bdc){_0x4ce969[_0x4c25('0x41')]=_0x408bdc;return _0x4ce969;})[_0x4c25('0x23')](respondWithFilteredResult(_0x2f1f3d,_0x1ca83b))['catch'](handleError(_0x2f1f3d,null));};exports[_0x4c25('0x42')]=function(_0x59247b,_0x16dd5a){var _0x3aa69f={'raw':![],'where':{'id':_0x59247b[_0x4c25('0x43')]['id']}},_0x3ab6b6={};_0x3ab6b6[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db['SalesforceConfiguration'][_0x4c25('0x2b')]);_0x3ab6b6[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0x59247b[_0x4c25('0x30')]);_0x3ab6b6[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x3ab6b6[_0x4c25('0x2f')],_0x3ab6b6['query']);_0x3aa69f[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x3ab6b6[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0x59247b[_0x4c25('0x30')][_0x4c25('0x35')]));_0x3aa69f['attributes']=_0x3aa69f[_0x4c25('0x33')][_0x4c25('0x44')]?_0x3aa69f[_0x4c25('0x33')]:_0x3ab6b6[_0x4c25('0x2f')];if(_0x59247b[_0x4c25('0x30')][_0x4c25('0x3f')]){_0x3aa69f[_0x4c25('0x45')]=[{'all':!![]}];}_0x3aa69f=_['merge']({},_0x3aa69f,_0x59247b[_0x4c25('0x46')]);return db[_0x4c25('0x2a')][_0x4c25('0x47')](_0x3aa69f)[_0x4c25('0x23')](handleEntityNotFound(_0x16dd5a,null))[_0x4c25('0x23')](respondWithResult(_0x16dd5a,null))[_0x4c25('0x48')](handleError(_0x16dd5a,null));};exports[_0x4c25('0x49')]=function(_0xbc1ff7,_0x5d7146){return db[_0x4c25('0x2a')]['create'](_0xbc1ff7['body'],{})['then'](respondWithResult(_0x5d7146,0xc9))[_0x4c25('0x48')](handleError(_0x5d7146,null));};exports['update']=function(_0x3d987c,_0x5e981d){if(_0x3d987c[_0x4c25('0x4a')]['id']){delete _0x3d987c[_0x4c25('0x4a')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x3d987c[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x5e981d,null))['then'](saveUpdates(_0x3d987c['body'],null))[_0x4c25('0x23')](respondWithResult(_0x5e981d,null))[_0x4c25('0x48')](handleError(_0x5e981d,null));};exports[_0x4c25('0x24')]=function(_0x5be2a9,_0x346eb7){return db[_0x4c25('0x2a')][_0x4c25('0x47')]({'where':{'id':_0x5be2a9[_0x4c25('0x43')]['id']}})['then'](handleEntityNotFound(_0x346eb7,null))['then'](removeEntity(_0x346eb7,null))[_0x4c25('0x48')](handleError(_0x346eb7,null));};exports[_0x4c25('0x4b')]=function(_0xa4f5fd,_0x327e96,_0x5dc40f){var _0x238682={};var _0x3edae0={};var _0x43210f;var _0x19aadc;return db[_0x4c25('0x2a')][_0x4c25('0x4c')]({'where':{'id':_0xa4f5fd[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x327e96,null))[_0x4c25('0x23')](function(_0x489dca){if(_0x489dca){_0x43210f=_0x489dca;_0x3edae0[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db['SalesforceField'][_0x4c25('0x2b')]);_0x3edae0[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0xa4f5fd[_0x4c25('0x30')]);_0x3edae0[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x3edae0[_0x4c25('0x2f')],_0x3edae0['query']);_0x238682['attributes']=_['intersection'](_0x3edae0[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0xa4f5fd['query'][_0x4c25('0x35')]));_0x238682[_0x4c25('0x33')]=_0x238682[_0x4c25('0x33')]['length']?_0x238682[_0x4c25('0x33')]:_0x3edae0['model'];_0x238682[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0xa4f5fd['query']['sort']);_0x238682[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0xa4f5fd[_0x4c25('0x30')],_0x3edae0['filters']));if(_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x3c')]){_0x238682[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x238682[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0x238682[_0x4c25('0x33')],function(_0x1e6b90){var _0x2d8c2a={};_0x2d8c2a[_0x1e6b90]={'$like':'%'+_0xa4f5fd[_0x4c25('0x30')]['filter']+'%'};return _0x2d8c2a;})});}_0x238682=_[_0x4c25('0x3d')]({},_0x238682,_0xa4f5fd['options']);return _0x43210f[_0x4c25('0x4b')](_0x238682);}})['then'](function(_0x1e3d8b){if(_0x1e3d8b){_0x19aadc=_0x1e3d8b[_0x4c25('0x44')];if(!_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x36')](_0x4c25('0x37'))){_0x238682['limit']=qs[_0x4c25('0x1d')](_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x238682['offset']=qs[_0x4c25('0x1b')](_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x1b')]);}return _0x43210f[_0x4c25('0x4b')](_0x238682);}})[_0x4c25('0x23')](function(_0x226deb){if(_0x226deb){return _0x226deb?{'count':_0x19aadc,'rows':_0x226deb}:null;}})['then'](respondWithResult(_0x327e96,null))[_0x4c25('0x48')](handleError(_0x327e96,null));};exports[_0x4c25('0x4d')]=function(_0x216cfc,_0x3a2169,_0xaae38e){var _0x19b659={};var _0x375fba={};var _0x1bea76;var _0x4693f9;return db['SalesforceConfiguration'][_0x4c25('0x4c')]({'where':{'id':_0x216cfc[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x3a2169,null))[_0x4c25('0x23')](function(_0x5c6498){if(_0x5c6498){_0x1bea76=_0x5c6498;_0x375fba[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db[_0x4c25('0x4e')][_0x4c25('0x2b')]);_0x375fba['query']=_[_0x4c25('0x31')](_0x216cfc[_0x4c25('0x30')]);_0x375fba[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x375fba['model'],_0x375fba[_0x4c25('0x30')]);_0x19b659[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x375fba[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0x216cfc['query'][_0x4c25('0x35')]));_0x19b659[_0x4c25('0x33')]=_0x19b659[_0x4c25('0x33')][_0x4c25('0x44')]?_0x19b659[_0x4c25('0x33')]:_0x375fba[_0x4c25('0x2f')];_0x19b659[_0x4c25('0x38')]=qs['sort'](_0x216cfc[_0x4c25('0x30')][_0x4c25('0x39')]);_0x19b659[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0x216cfc['query'],_0x375fba[_0x4c25('0x32')]));if(_0x216cfc[_0x4c25('0x30')]['filter']){_0x19b659[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x19b659[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0x19b659['attributes'],function(_0x57e11a){var _0x11fc0a={};_0x11fc0a[_0x57e11a]={'$like':'%'+_0x216cfc[_0x4c25('0x30')][_0x4c25('0x3c')]+'%'};return _0x11fc0a;})});}_0x19b659=_[_0x4c25('0x3d')]({},_0x19b659,_0x216cfc[_0x4c25('0x46')]);return _0x1bea76[_0x4c25('0x4d')](_0x19b659);}})[_0x4c25('0x23')](function(_0x2e91c4){if(_0x2e91c4){_0x4693f9=_0x2e91c4['length'];if(!_0x216cfc[_0x4c25('0x30')][_0x4c25('0x36')](_0x4c25('0x37'))){_0x19b659[_0x4c25('0x1d')]=qs[_0x4c25('0x1d')](_0x216cfc[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x19b659[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0x216cfc[_0x4c25('0x30')]['offset']);}return _0x1bea76['getSubjects'](_0x19b659);}})[_0x4c25('0x23')](function(_0x12c153){if(_0x12c153){return _0x12c153?{'count':_0x4693f9,'rows':_0x12c153}:null;}})['then'](respondWithResult(_0x3a2169,null))[_0x4c25('0x48')](handleError(_0x3a2169,null));};exports[_0x4c25('0x4f')]=function(_0xf3d14d,_0x24aea0,_0x563402){var _0x17837d={};var _0xd6876f={};var _0x374202;var _0x3bdb6d;return db[_0x4c25('0x2a')][_0x4c25('0x4c')]({'where':{'id':_0xf3d14d[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x24aea0,null))[_0x4c25('0x23')](function(_0x2b3af4){if(_0x2b3af4){_0x374202=_0x2b3af4;_0xd6876f[_0x4c25('0x2f')]=_['keys'](db[_0x4c25('0x4e')][_0x4c25('0x2b')]);_0xd6876f[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0xf3d14d[_0x4c25('0x30')]);_0xd6876f[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0xd6876f[_0x4c25('0x2f')],_0xd6876f[_0x4c25('0x30')]);_0x17837d['attributes']=_['intersection'](_0xd6876f[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0xf3d14d['query'][_0x4c25('0x35')]));_0x17837d['attributes']=_0x17837d['attributes'][_0x4c25('0x44')]?_0x17837d[_0x4c25('0x33')]:_0xd6876f[_0x4c25('0x2f')];_0x17837d[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x39')]);_0x17837d[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0xf3d14d[_0x4c25('0x30')],_0xd6876f[_0x4c25('0x32')]));if(_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x3c')]){_0x17837d['where']=_[_0x4c25('0x3d')](_0x17837d['where'],{'$or':_[_0x4c25('0x29')](_0x17837d[_0x4c25('0x33')],function(_0x39c6aa){var _0x47a0d5={};_0x47a0d5[_0x39c6aa]={'$like':'%'+_0xf3d14d['query']['filter']+'%'};return _0x47a0d5;})});}_0x17837d=_['merge']({},_0x17837d,_0xf3d14d[_0x4c25('0x46')]);return _0x374202[_0x4c25('0x4f')](_0x17837d);}})[_0x4c25('0x23')](function(_0x589e12){if(_0x589e12){_0x3bdb6d=_0x589e12['length'];if(!_0xf3d14d[_0x4c25('0x30')]['hasOwnProperty'](_0x4c25('0x37'))){_0x17837d[_0x4c25('0x1d')]=qs['limit'](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x17837d[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x1b')]);}return _0x374202[_0x4c25('0x4f')](_0x17837d);}})[_0x4c25('0x23')](function(_0xfb09d7){if(_0xfb09d7){return _0xfb09d7?{'count':_0x3bdb6d,'rows':_0xfb09d7}:null;}})['then'](respondWithResult(_0x24aea0,null))['catch'](handleError(_0x24aea0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 5be3f76..8605559 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 _0x07ff=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x07ff,0x1d5));var _0xf07f=function(_0x1e98fc,_0x196cda){_0x1e98fc=_0x1e98fc-0x0;var _0x4c8041=_0x07ff[_0x1e98fc];return _0x4c8041;};'use strict';var _=require(_0xf07f('0x0'));var util=require(_0xf07f('0x1'));var logger=require(_0xf07f('0x2'))(_0xf07f('0x3'));var moment=require(_0xf07f('0x4'));var BPromise=require(_0xf07f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf07f('0x6'));var rimraf=require(_0xf07f('0x7'));var config=require(_0xf07f('0x8'));var attributes=require(_0xf07f('0x9'));module[_0xf07f('0xa')]=function(_0x5031f6,_0x36b72e){return _0x5031f6[_0xf07f('0xb')](_0xf07f('0xc'),attributes,{'tableName':_0xf07f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa12e=['../../config/environment','exports','define','int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x53abfa,_0xd4ea1d){var _0x119d56=function(_0x2f33e5){while(--_0x2f33e5){_0x53abfa['push'](_0x53abfa['shift']());}};_0x119d56(++_0xd4ea1d);}(_0xa12e,0x1bc));var _0xea12=function(_0x3fd086,_0x4b6e5e){_0x3fd086=_0x3fd086-0x0;var _0x1147b8=_0xa12e[_0x3fd086];return _0x1147b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea12('0x0'))('api');var moment=require(_0xea12('0x1'));var BPromise=require(_0xea12('0x2'));var rp=require(_0xea12('0x3'));var fs=require('fs');var path=require(_0xea12('0x4'));var rimraf=require(_0xea12('0x5'));var config=require(_0xea12('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xea12('0x7')]=function(_0x3a4019,_0x57418b){return _0x3a4019[_0xea12('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xea12('0x9'),'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 582422f..324cd87 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 _0xd4fb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd4fb,0x1b7));var _0xbd4f=function(_0x4ae6a1,_0x76c9a1){_0x4ae6a1=_0x4ae6a1-0x0;var _0x108a97=_0xd4fb[_0x4ae6a1];return _0x108a97;};'use strict';var _=require('lodash');var util=require(_0xbd4f('0x0'));var moment=require(_0xbd4f('0x1'));var BPromise=require(_0xbd4f('0x2'));var rs=require(_0xbd4f('0x3'));var fs=require('fs');var Redis=require(_0xbd4f('0x4'));var db=require(_0xbd4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd4f('0x6'))(_0xbd4f('0x7'));var config=require(_0xbd4f('0x8'));var jayson=require(_0xbd4f('0x9'));var client=jayson[_0xbd4f('0xa')][_0xbd4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cd37c,_0x2ad1f0,_0x2b7b13){return new BPromise(function(_0x1df587,_0x309c25){return client[_0xbd4f('0xc')](_0x3cd37c,_0x2b7b13)['then'](function(_0x328689){logger['info'](_0xbd4f('0xd'),_0x2ad1f0,'request\x20sent');logger['debug'](_0xbd4f('0xe'),_0x2ad1f0,_0xbd4f('0xf'),JSON['stringify'](_0x328689));if(_0x328689[_0xbd4f('0x10')]){if(_0x328689[_0xbd4f('0x10')][_0xbd4f('0x11')]===0x1f4){logger[_0xbd4f('0x10')](_0xbd4f('0xd'),_0x2ad1f0,_0x328689[_0xbd4f('0x10')][_0xbd4f('0x12')]);return _0x309c25(_0x328689[_0xbd4f('0x10')]['message']);}logger[_0xbd4f('0x10')](_0xbd4f('0xd'),_0x2ad1f0,_0x328689['error'][_0xbd4f('0x12')]);return _0x1df587(_0x328689[_0xbd4f('0x10')]['message']);}else{logger['info'](_0xbd4f('0xd'),_0x2ad1f0,_0xbd4f('0xf'));_0x1df587(_0x328689[_0xbd4f('0x13')][_0xbd4f('0x12')]);}})['catch'](function(_0x4a149c){logger['error'](_0xbd4f('0xd'),_0x2ad1f0,_0x4a149c);_0x309c25(_0x4a149c);});});} \ No newline at end of file +var _0x550a=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x550a,0x1d5));var _0xa550=function(_0x42336c,_0x53f761){_0x42336c=_0x42336c-0x0;var _0x8609de=_0x550a[_0x42336c];return _0x8609de;};'use strict';var _=require(_0xa550('0x0'));var util=require('util');var moment=require(_0xa550('0x1'));var BPromise=require(_0xa550('0x2'));var rs=require(_0xa550('0x3'));var fs=require('fs');var Redis=require(_0xa550('0x4'));var db=require(_0xa550('0x5'))['db'];var utils=require(_0xa550('0x6'));var logger=require(_0xa550('0x7'))(_0xa550('0x8'));var config=require('../../config/environment');var jayson=require(_0xa550('0x9'));var client=jayson[_0xa550('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3735be,_0x321a2c,_0x72a889){return new BPromise(function(_0x5392ee,_0x1ff6e3){return client[_0xa550('0xb')](_0x3735be,_0x72a889)[_0xa550('0xc')](function(_0x18282a){logger[_0xa550('0xd')](_0xa550('0xe'),_0x321a2c,_0xa550('0xf'));logger[_0xa550('0x10')](_0xa550('0x11'),_0x321a2c,_0xa550('0xf'),JSON[_0xa550('0x12')](_0x18282a));if(_0x18282a['error']){if(_0x18282a['error'][_0xa550('0x13')]===0x1f4){logger[_0xa550('0x14')](_0xa550('0xe'),_0x321a2c,_0x18282a[_0xa550('0x14')][_0xa550('0x15')]);return _0x1ff6e3(_0x18282a['error'][_0xa550('0x15')]);}logger[_0xa550('0x14')](_0xa550('0xe'),_0x321a2c,_0x18282a[_0xa550('0x14')]['message']);return _0x5392ee(_0x18282a[_0xa550('0x14')][_0xa550('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x321a2c,_0xa550('0xf'));_0x5392ee(_0x18282a[_0xa550('0x16')][_0xa550('0x15')]);}})[_0xa550('0x17')](function(_0x5a4235){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x321a2c,_0x5a4235);_0x1ff6e3(_0x5a4235);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 27c5edd..52fce34 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 _0x9ac3=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x1781d6,_0x4c8455){var _0x352034=function(_0x36349c){while(--_0x36349c){_0x1781d6['push'](_0x1781d6['shift']());}};_0x352034(++_0x4c8455);}(_0x9ac3,0xdf));var _0x39ac=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x9ac3[_0x1b4c04];return _0x374f5d;};'use strict';var multer=require(_0x39ac('0x0'));var util=require(_0x39ac('0x1'));var path=require(_0x39ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x39ac('0x3'));var router=express[_0x39ac('0x4')]();var fs_extra=require(_0x39ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x39ac('0x6'));var config=require(_0x39ac('0x7'));var controller=require('./intSalesforceField.controller');router[_0x39ac('0x8')]('/',auth[_0x39ac('0x9')](),controller[_0x39ac('0xa')]);router[_0x39ac('0x8')](_0x39ac('0xb'),auth[_0x39ac('0x9')](),controller[_0x39ac('0xc')]);router[_0x39ac('0xd')]('/',auth[_0x39ac('0x9')](),controller[_0x39ac('0xe')]);router[_0x39ac('0xf')](_0x39ac('0xb'),auth[_0x39ac('0x9')](),controller[_0x39ac('0x10')]);router['delete']('/:id',auth[_0x39ac('0x9')](),controller[_0x39ac('0x11')]);module[_0x39ac('0x12')]=router; \ No newline at end of file +var _0x561c=['update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x561c,0x1c2));var _0xc561=function(_0x4fced0,_0x3616c5){_0x4fced0=_0x4fced0-0x0;var _0x25686c=_0x561c[_0x4fced0];return _0x25686c;};'use strict';var multer=require(_0xc561('0x0'));var util=require(_0xc561('0x1'));var path=require('path');var timeout=require(_0xc561('0x2'));var express=require(_0xc561('0x3'));var router=express['Router']();var fs_extra=require(_0xc561('0x4'));var auth=require(_0xc561('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc561('0x6'));var controller=require('./intSalesforceField.controller');router[_0xc561('0x7')]('/',auth[_0xc561('0x8')](),controller[_0xc561('0x9')]);router[_0xc561('0x7')](_0xc561('0xa'),auth[_0xc561('0x8')](),controller['show']);router[_0xc561('0xb')]('/',auth[_0xc561('0x8')](),controller[_0xc561('0xc')]);router[_0xc561('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc561('0xe')]);router['delete'](_0xc561('0xa'),auth[_0xc561('0x8')](),controller[_0xc561('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cd568f1..5d1557b 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 _0x52bc=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52bc,0xe5));var _0xc52b=function(_0x3aa42f,_0x3894e2){_0x3aa42f=_0x3aa42f-0x0;var _0x58da68=_0x52bc[_0x3aa42f];return _0x58da68;};'use strict';var Sequelize=require(_0xc52b('0x0'));module[_0xc52b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc52b('0x2'),_0xc52b('0x3'),_0xc52b('0x4'),_0xc52b('0x5'),_0xc52b('0x6')),'defaultValue':_0xc52b('0x2')},'content':{'type':Sequelize[_0xc52b('0x7')]},'key':{'type':Sequelize[_0xc52b('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc52b('0x2'),_0xc52b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xc52b('0x7')]}}; \ No newline at end of file +var _0x6ed8=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6ed8,0xe7));var _0x86ed=function(_0x153b12,_0x231224){_0x153b12=_0x153b12-0x0;var _0x3c8106=_0x6ed8[_0x153b12];return _0x3c8106;};'use strict';var Sequelize=require(_0x86ed('0x0'));module[_0x86ed('0x1')]={'type':{'type':Sequelize[_0x86ed('0x2')](_0x86ed('0x3'),'variable',_0x86ed('0x4'),_0x86ed('0x5'),_0x86ed('0x6')),'defaultValue':_0x86ed('0x3')},'content':{'type':Sequelize[_0x86ed('0x7')]},'key':{'type':Sequelize[_0x86ed('0x7')]},'keyType':{'type':Sequelize[_0x86ed('0x2')](_0x86ed('0x3'),_0x86ed('0x8'),_0x86ed('0x4'))},'keyContent':{'type':Sequelize[_0x86ed('0x7')]},'idField':{'type':Sequelize[_0x86ed('0x7')]},'variableName':{'type':Sequelize[_0x86ed('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cff1da0..928c05e 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 _0x83dc=['end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','SalesforceField','includeAll','rows','include','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x83dc,0xb8));var _0xc83d=function(_0x4e8df4,_0x59ad8e){_0x4e8df4=_0x4e8df4-0x0;var _0x5b183d=_0x83dc[_0x4e8df4];return _0x5b183d;};'use strict';var emlformat=require(_0xc83d('0x0'));var rimraf=require(_0xc83d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc83d('0x2'));var rp=require('request-promise');var moment=require(_0xc83d('0x3'));var BPromise=require(_0xc83d('0x4'));var Mustache=require('mustache');var util=require(_0xc83d('0x5'));var path=require(_0xc83d('0x6'));var sox=require(_0xc83d('0x7'));var csv=require(_0xc83d('0x8'));var ejs=require(_0xc83d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc83d('0xa'));var crypto=require(_0xc83d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc83d('0xc'));var toCsv=require(_0xc83d('0x8'));var querystring=require(_0xc83d('0xd'));var Papa=require('papaparse');var Redis=require(_0xc83d('0xe'));var authService=require(_0xc83d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc83d('0x10'));var logger=require('../../config/logger')(_0xc83d('0x11'));var utils=require('../../config/utils');var config=require(_0xc83d('0x12'));var licenseUtil=require(_0xc83d('0x13'));var db=require(_0xc83d('0x14'))['db'];function respondWithStatusCode(_0x3b419d,_0x45e4e0){_0x45e4e0=_0x45e4e0||0xcc;return function(_0x2d1dd2){if(_0x2d1dd2){return _0x3b419d[_0xc83d('0x15')](_0x45e4e0);}return _0x3b419d[_0xc83d('0x16')](_0x45e4e0)[_0xc83d('0x17')]();};}function respondWithResult(_0x57a01f,_0x48c514){_0x48c514=_0x48c514||0xc8;return function(_0x6eac31){if(_0x6eac31){return _0x57a01f[_0xc83d('0x16')](_0x48c514)['json'](_0x6eac31);}};}function respondWithFilteredResult(_0x5ecfcb,_0x1ed6a3){return function(_0x1a98c7){if(_0x1a98c7){var _0x1bc7ff=typeof _0x1ed6a3[_0xc83d('0x18')]===_0xc83d('0x19')&&typeof _0x1ed6a3[_0xc83d('0x1a')]===_0xc83d('0x19');var _0x24d692=_0x1a98c7[_0xc83d('0x1b')];var _0x1df177=_0x1bc7ff?0x0:_0x1ed6a3['offset'];var _0x57c95a=_0x1bc7ff?_0x1a98c7[_0xc83d('0x1b')]:_0x1ed6a3[_0xc83d('0x18')]+_0x1ed6a3[_0xc83d('0x1a')];var _0x53d50d;if(_0x57c95a>=_0x24d692){_0x57c95a=_0x24d692;_0x53d50d=0xc8;}else{_0x53d50d=0xce;}_0x5ecfcb[_0xc83d('0x16')](_0x53d50d);return _0x5ecfcb[_0xc83d('0x1c')](_0xc83d('0x1d'),_0x1df177+'-'+_0x57c95a+'/'+_0x24d692)[_0xc83d('0x1e')](_0x1a98c7);}return null;};}function patchUpdates(_0x56eed5){return function(_0x14c59c){try{jsonpatch['apply'](_0x14c59c,_0x56eed5,!![]);}catch(_0x4f69fe){return BPromise[_0xc83d('0x1f')](_0x4f69fe);}return _0x14c59c['save']();};}function saveUpdates(_0x787fec,_0x39ce24){return function(_0x54939d){if(_0x54939d){return _0x54939d[_0xc83d('0x20')](_0x787fec)[_0xc83d('0x21')](function(_0x4ccc31){return _0x4ccc31;});}return null;};}function removeEntity(_0x2db3b8,_0x47ccf6){return function(_0x497802){if(_0x497802){return _0x497802[_0xc83d('0x22')]()['then'](function(){_0x2db3b8[_0xc83d('0x16')](0xcc)[_0xc83d('0x17')]();});}};}function handleEntityNotFound(_0x472e0e,_0x48e19d){return function(_0x1cb1af){if(!_0x1cb1af){_0x472e0e['sendStatus'](0x194);}return _0x1cb1af;};}function handleError(_0x5d1acf,_0x31eaa){_0x31eaa=_0x31eaa||0x1f4;return function(_0x2ba85b){logger[_0xc83d('0x23')](_0x2ba85b[_0xc83d('0x24')]);if(_0x2ba85b[_0xc83d('0x25')]){delete _0x2ba85b[_0xc83d('0x25')];}_0x5d1acf[_0xc83d('0x16')](_0x31eaa)[_0xc83d('0x26')](_0x2ba85b);};}exports[_0xc83d('0x27')]=function(_0xb76c3a,_0x59b9bd){var _0x3599e2={},_0x32428b={},_0x1b8123={'count':0x0,'rows':[]};var _0x49a4e6=_['map'](db['SalesforceField'][_0xc83d('0x28')],function(_0x20b50d){return{'name':_0x20b50d['fieldName'],'type':_0x20b50d[_0xc83d('0x29')][_0xc83d('0x2a')]};});_0x32428b['model']=_[_0xc83d('0x2b')](_0x49a4e6,_0xc83d('0x25'));_0x32428b[_0xc83d('0x2c')]=_[_0xc83d('0x2d')](_0xb76c3a['query']);_0x32428b[_0xc83d('0x2e')]=_['intersection'](_0x32428b[_0xc83d('0x2f')],_0x32428b[_0xc83d('0x2c')]);_0x3599e2['attributes']=_[_0xc83d('0x30')](_0x32428b[_0xc83d('0x2f')],qs[_0xc83d('0x31')](_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x31')]));_0x3599e2[_0xc83d('0x32')]=_0x3599e2[_0xc83d('0x32')][_0xc83d('0x33')]?_0x3599e2[_0xc83d('0x32')]:_0x32428b[_0xc83d('0x2f')];if(!_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x34')]('nolimit')){_0x3599e2['limit']=qs['limit'](_0xb76c3a[_0xc83d('0x2c')]['limit']);_0x3599e2['offset']=qs[_0xc83d('0x18')](_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x18')]);}_0x3599e2[_0xc83d('0x35')]=qs[_0xc83d('0x36')](_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x36')]);_0x3599e2['where']=qs['filters'](_[_0xc83d('0x37')](_0xb76c3a[_0xc83d('0x2c')],_0x32428b[_0xc83d('0x2e')]),_0x49a4e6);if(_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x38')]){_0x3599e2[_0xc83d('0x39')]=_[_0xc83d('0x3a')](_0x3599e2[_0xc83d('0x39')],{'$or':_[_0xc83d('0x2b')](_0x49a4e6,function(_0x49a654){if(_0x49a654[_0xc83d('0x29')]!=='VIRTUAL'){var _0x27c2c1={};_0x27c2c1[_0x49a654['name']]={'$like':'%'+_0xb76c3a[_0xc83d('0x2c')]['filter']+'%'};return _0x27c2c1;}})});}_0x3599e2=_[_0xc83d('0x3a')]({},_0x3599e2,_0xb76c3a[_0xc83d('0x3b')]);var _0x471d55={'where':_0x3599e2['where']};return db[_0xc83d('0x3c')][_0xc83d('0x1b')](_0x471d55)[_0xc83d('0x21')](function(_0x4c3f3f){_0x1b8123[_0xc83d('0x1b')]=_0x4c3f3f;if(_0xb76c3a[_0xc83d('0x2c')][_0xc83d('0x3d')]){_0x3599e2['include']=[{'all':!![]}];}return db[_0xc83d('0x3c')]['findAll'](_0x3599e2);})['then'](function(_0x6df03f){_0x1b8123[_0xc83d('0x3e')]=_0x6df03f;return _0x1b8123;})[_0xc83d('0x21')](respondWithFilteredResult(_0x59b9bd,_0x3599e2))['catch'](handleError(_0x59b9bd,null));};exports['show']=function(_0x505b8e,_0x2e4a24){var _0x5b055d={'raw':!![],'where':{'id':_0x505b8e['params']['id']}},_0xf3096c={};_0xf3096c['model']=_[_0xc83d('0x2d')](db[_0xc83d('0x3c')]['rawAttributes']);_0xf3096c[_0xc83d('0x2c')]=_[_0xc83d('0x2d')](_0x505b8e[_0xc83d('0x2c')]);_0xf3096c['filters']=_['intersection'](_0xf3096c[_0xc83d('0x2f')],_0xf3096c[_0xc83d('0x2c')]);_0x5b055d[_0xc83d('0x32')]=_[_0xc83d('0x30')](_0xf3096c[_0xc83d('0x2f')],qs['fields'](_0x505b8e[_0xc83d('0x2c')][_0xc83d('0x31')]));_0x5b055d[_0xc83d('0x32')]=_0x5b055d['attributes']['length']?_0x5b055d[_0xc83d('0x32')]:_0xf3096c[_0xc83d('0x2f')];if(_0x505b8e[_0xc83d('0x2c')]['includeAll']){_0x5b055d[_0xc83d('0x3f')]=[{'all':!![]}];}_0x5b055d=_[_0xc83d('0x3a')]({},_0x5b055d,_0x505b8e[_0xc83d('0x3b')]);return db[_0xc83d('0x3c')]['find'](_0x5b055d)[_0xc83d('0x21')](handleEntityNotFound(_0x2e4a24,null))[_0xc83d('0x21')](respondWithResult(_0x2e4a24,null))[_0xc83d('0x40')](handleError(_0x2e4a24,null));};exports[_0xc83d('0x41')]=function(_0x3c24a4,_0x28104a){return db[_0xc83d('0x3c')]['create'](_0x3c24a4['body'],{})['then'](respondWithResult(_0x28104a,0xc9))[_0xc83d('0x40')](handleError(_0x28104a,null));};exports[_0xc83d('0x20')]=function(_0x3ad6c7,_0x2861fc){if(_0x3ad6c7[_0xc83d('0x42')]['id']){delete _0x3ad6c7[_0xc83d('0x42')]['id'];}return db[_0xc83d('0x3c')][_0xc83d('0x43')]({'where':{'id':_0x3ad6c7[_0xc83d('0x44')]['id']}})[_0xc83d('0x21')](handleEntityNotFound(_0x2861fc,null))[_0xc83d('0x21')](saveUpdates(_0x3ad6c7['body'],null))[_0xc83d('0x21')](respondWithResult(_0x2861fc,null))[_0xc83d('0x40')](handleError(_0x2861fc,null));};exports[_0xc83d('0x22')]=function(_0x3d06e3,_0x3d8140){return db[_0xc83d('0x3c')][_0xc83d('0x43')]({'where':{'id':_0x3d06e3[_0xc83d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d8140,null))[_0xc83d('0x21')](removeEntity(_0x3d8140,null))[_0xc83d('0x40')](handleError(_0x3d8140,null));}; \ No newline at end of file +var _0xfaf6=['map','SalesforceField','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaf6,0x193));var _0x6faf=function(_0x4f42db,_0x5d1f80){_0x4f42db=_0x4f42db-0x0;var _0xa64249=_0xfaf6[_0x4f42db];return _0xa64249;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6faf('0x0'));var zipdir=require(_0x6faf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6faf('0x2'));var moment=require(_0x6faf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6faf('0x4'));var util=require(_0x6faf('0x5'));var path=require(_0x6faf('0x6'));var sox=require(_0x6faf('0x7'));var csv=require(_0x6faf('0x8'));var ejs=require(_0x6faf('0x9'));var fs=require('fs');var fs_extra=require(_0x6faf('0xa'));var _=require(_0x6faf('0xb'));var squel=require(_0x6faf('0xc'));var crypto=require(_0x6faf('0xd'));var jsforce=require(_0x6faf('0xe'));var deskjs=require(_0x6faf('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6faf('0x10'));var Redis=require('ioredis');var authService=require(_0x6faf('0x11'));var qs=require(_0x6faf('0x12'));var as=require(_0x6faf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6faf('0x14'))(_0x6faf('0x15'));var utils=require(_0x6faf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d573a,_0x2ad56f){_0x2ad56f=_0x2ad56f||0xcc;return function(_0x2d7dfb){if(_0x2d7dfb){return _0x2d573a[_0x6faf('0x17')](_0x2ad56f);}return _0x2d573a[_0x6faf('0x18')](_0x2ad56f)['end']();};}function respondWithResult(_0x531031,_0x4ae5d1){_0x4ae5d1=_0x4ae5d1||0xc8;return function(_0x4ec156){if(_0x4ec156){return _0x531031[_0x6faf('0x18')](_0x4ae5d1)[_0x6faf('0x19')](_0x4ec156);}};}function respondWithFilteredResult(_0x2ee3df,_0x351e6c){return function(_0x230e76){if(_0x230e76){var _0x2b673e=typeof _0x351e6c[_0x6faf('0x1a')]===_0x6faf('0x1b')&&typeof _0x351e6c[_0x6faf('0x1c')]===_0x6faf('0x1b');var _0x4f0467=_0x230e76[_0x6faf('0x1d')];var _0x2bffb8=_0x2b673e?0x0:_0x351e6c[_0x6faf('0x1a')];var _0x24d422=_0x2b673e?_0x230e76[_0x6faf('0x1d')]:_0x351e6c[_0x6faf('0x1a')]+_0x351e6c[_0x6faf('0x1c')];var _0x3e480c;if(_0x24d422>=_0x4f0467){_0x24d422=_0x4f0467;_0x3e480c=0xc8;}else{_0x3e480c=0xce;}_0x2ee3df[_0x6faf('0x18')](_0x3e480c);return _0x2ee3df[_0x6faf('0x1e')]('Content-Range',_0x2bffb8+'-'+_0x24d422+'/'+_0x4f0467)[_0x6faf('0x19')](_0x230e76);}return null;};}function patchUpdates(_0x513947){return function(_0x230ff3){try{jsonpatch['apply'](_0x230ff3,_0x513947,!![]);}catch(_0x51870b){return BPromise[_0x6faf('0x1f')](_0x51870b);}return _0x230ff3[_0x6faf('0x20')]();};}function saveUpdates(_0x365acf,_0xaa1e68){return function(_0x40b4f1){if(_0x40b4f1){return _0x40b4f1[_0x6faf('0x21')](_0x365acf)[_0x6faf('0x22')](function(_0x3f0abc){return _0x3f0abc;});}return null;};}function removeEntity(_0x555355,_0x581322){return function(_0x33075d){if(_0x33075d){return _0x33075d[_0x6faf('0x23')]()[_0x6faf('0x22')](function(){_0x555355[_0x6faf('0x18')](0xcc)[_0x6faf('0x24')]();});}};}function handleEntityNotFound(_0x570d64,_0x5ed5fe){return function(_0x1b4289){if(!_0x1b4289){_0x570d64[_0x6faf('0x17')](0x194);}return _0x1b4289;};}function handleError(_0x4381e7,_0x4a64c0){_0x4a64c0=_0x4a64c0||0x1f4;return function(_0x426653){logger[_0x6faf('0x25')](_0x426653[_0x6faf('0x26')]);if(_0x426653[_0x6faf('0x27')]){delete _0x426653[_0x6faf('0x27')];}_0x4381e7[_0x6faf('0x18')](_0x4a64c0)[_0x6faf('0x28')](_0x426653);};}exports['index']=function(_0x3ad49a,_0x1c826b){var _0xea8ad2={},_0x2e4d52={},_0x415cb1={'count':0x0,'rows':[]};var _0x124379=_[_0x6faf('0x29')](db[_0x6faf('0x2a')][_0x6faf('0x2b')],function(_0xf1028e){return{'name':_0xf1028e[_0x6faf('0x2c')],'type':_0xf1028e['type'][_0x6faf('0x2d')]};});_0x2e4d52['model']=_[_0x6faf('0x29')](_0x124379,'name');_0x2e4d52[_0x6faf('0x2e')]=_[_0x6faf('0x2f')](_0x3ad49a[_0x6faf('0x2e')]);_0x2e4d52[_0x6faf('0x30')]=_[_0x6faf('0x31')](_0x2e4d52['model'],_0x2e4d52[_0x6faf('0x2e')]);_0xea8ad2[_0x6faf('0x32')]=_[_0x6faf('0x31')](_0x2e4d52[_0x6faf('0x33')],qs[_0x6faf('0x34')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x34')]));_0xea8ad2['attributes']=_0xea8ad2[_0x6faf('0x32')][_0x6faf('0x35')]?_0xea8ad2['attributes']:_0x2e4d52[_0x6faf('0x33')];if(!_0x3ad49a['query'][_0x6faf('0x36')](_0x6faf('0x37'))){_0xea8ad2[_0x6faf('0x1c')]=qs[_0x6faf('0x1c')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x1c')]);_0xea8ad2[_0x6faf('0x1a')]=qs[_0x6faf('0x1a')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x1a')]);}_0xea8ad2[_0x6faf('0x38')]=qs[_0x6faf('0x39')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x39')]);_0xea8ad2['where']=qs[_0x6faf('0x30')](_['pick'](_0x3ad49a[_0x6faf('0x2e')],_0x2e4d52['filters']),_0x124379);if(_0x3ad49a['query'][_0x6faf('0x3a')]){_0xea8ad2[_0x6faf('0x3b')]=_[_0x6faf('0x3c')](_0xea8ad2[_0x6faf('0x3b')],{'$or':_[_0x6faf('0x29')](_0x124379,function(_0x5ce5e8){if(_0x5ce5e8[_0x6faf('0x3d')]!==_0x6faf('0x3e')){var _0x39e4c1={};_0x39e4c1[_0x5ce5e8[_0x6faf('0x27')]]={'$like':'%'+_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x3a')]+'%'};return _0x39e4c1;}})});}_0xea8ad2=_[_0x6faf('0x3c')]({},_0xea8ad2,_0x3ad49a[_0x6faf('0x3f')]);var _0x210362={'where':_0xea8ad2[_0x6faf('0x3b')]};return db[_0x6faf('0x2a')][_0x6faf('0x1d')](_0x210362)[_0x6faf('0x22')](function(_0x333f5c){_0x415cb1[_0x6faf('0x1d')]=_0x333f5c;if(_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x40')]){_0xea8ad2[_0x6faf('0x41')]=[{'all':!![]}];}return db[_0x6faf('0x2a')][_0x6faf('0x42')](_0xea8ad2);})[_0x6faf('0x22')](function(_0x47c367){_0x415cb1[_0x6faf('0x43')]=_0x47c367;return _0x415cb1;})[_0x6faf('0x22')](respondWithFilteredResult(_0x1c826b,_0xea8ad2))[_0x6faf('0x44')](handleError(_0x1c826b,null));};exports[_0x6faf('0x45')]=function(_0x214827,_0x25f052){var _0x5e234c={'raw':!![],'where':{'id':_0x214827[_0x6faf('0x46')]['id']}},_0x6126ef={};_0x6126ef[_0x6faf('0x33')]=_[_0x6faf('0x2f')](db[_0x6faf('0x2a')][_0x6faf('0x2b')]);_0x6126ef[_0x6faf('0x2e')]=_[_0x6faf('0x2f')](_0x214827['query']);_0x6126ef[_0x6faf('0x30')]=_[_0x6faf('0x31')](_0x6126ef['model'],_0x6126ef[_0x6faf('0x2e')]);_0x5e234c[_0x6faf('0x32')]=_[_0x6faf('0x31')](_0x6126ef['model'],qs[_0x6faf('0x34')](_0x214827[_0x6faf('0x2e')]['fields']));_0x5e234c[_0x6faf('0x32')]=_0x5e234c[_0x6faf('0x32')][_0x6faf('0x35')]?_0x5e234c[_0x6faf('0x32')]:_0x6126ef[_0x6faf('0x33')];if(_0x214827[_0x6faf('0x2e')][_0x6faf('0x40')]){_0x5e234c['include']=[{'all':!![]}];}_0x5e234c=_[_0x6faf('0x3c')]({},_0x5e234c,_0x214827[_0x6faf('0x3f')]);return db[_0x6faf('0x2a')][_0x6faf('0x47')](_0x5e234c)['then'](handleEntityNotFound(_0x25f052,null))['then'](respondWithResult(_0x25f052,null))[_0x6faf('0x44')](handleError(_0x25f052,null));};exports[_0x6faf('0x48')]=function(_0x499618,_0x4bd2ea){return db[_0x6faf('0x2a')]['create'](_0x499618[_0x6faf('0x49')],{})[_0x6faf('0x22')](respondWithResult(_0x4bd2ea,0xc9))['catch'](handleError(_0x4bd2ea,null));};exports['update']=function(_0x37ad9e,_0x5e7126){if(_0x37ad9e[_0x6faf('0x49')]['id']){delete _0x37ad9e['body']['id'];}return db[_0x6faf('0x2a')][_0x6faf('0x47')]({'where':{'id':_0x37ad9e[_0x6faf('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e7126,null))[_0x6faf('0x22')](saveUpdates(_0x37ad9e[_0x6faf('0x49')],null))[_0x6faf('0x22')](respondWithResult(_0x5e7126,null))['catch'](handleError(_0x5e7126,null));};exports[_0x6faf('0x23')]=function(_0x46e45f,_0x2d9690){return db[_0x6faf('0x2a')][_0x6faf('0x47')]({'where':{'id':_0x46e45f[_0x6faf('0x46')]['id']}})[_0x6faf('0x22')](handleEntityNotFound(_0x2d9690,null))[_0x6faf('0x22')](removeEntity(_0x2d9690,null))[_0x6faf('0x44')](handleError(_0x2d9690,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b076bb5..e178d47 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 _0x101d=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x101d,0x13a));var _0xd101=function(_0x570e5b,_0x5196ae){_0x570e5b=_0x570e5b-0x0;var _0x22737f=_0x101d[_0x570e5b];return _0x22737f;};'use strict';var _=require(_0xd101('0x0'));var util=require('util');var logger=require(_0xd101('0x1'))(_0xd101('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd101('0x3'));var fs=require('fs');var path=require(_0xd101('0x4'));var rimraf=require(_0xd101('0x5'));var config=require(_0xd101('0x6'));var attributes=require(_0xd101('0x7'));module[_0xd101('0x8')]=function(_0x2dcbfc,_0x56f120){return _0x2dcbfc[_0xd101('0x9')](_0xd101('0xa'),attributes,{'tableName':_0xd101('0xb'),'paranoid':![],'indexes':[{'name':_0xd101('0xc'),'fields':[_0xd101('0xd'),_0xd101('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5f1=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','../../config/logger','request-promise'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc5f1,0x11d));var _0x1c5f=function(_0x275b89,_0x4ca760){_0x275b89=_0x275b89-0x0;var _0x254304=_0xc5f1[_0x275b89];return _0x254304;};'use strict';var _=require(_0x1c5f('0x0'));var util=require('util');var logger=require(_0x1c5f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c5f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c5f('0x3'));var config=require(_0x1c5f('0x4'));var attributes=require(_0x1c5f('0x5'));module[_0x1c5f('0x6')]=function(_0x34dd0f,_0x616b76){return _0x34dd0f[_0x1c5f('0x7')](_0x1c5f('0x8'),attributes,{'tableName':_0x1c5f('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1c5f('0xa'),_0x1c5f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 246bf7d..130c0a3 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 _0x316f=['lodash','moment','../../mysqldb','../../config/utils','../../config/logger','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x316f,0xea));var _0xf316=function(_0x3aa97b,_0x56af66){_0x3aa97b=_0x3aa97b-0x0;var _0x36857f=_0x316f[_0x3aa97b];return _0x36857f;};'use strict';var _=require(_0xf316('0x0'));var util=require('util');var moment=require(_0xf316('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf316('0x2'))['db'];var utils=require(_0xf316('0x3'));var logger=require(_0xf316('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf316('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7156,_0x26a573,_0x19f23c){return new BPromise(function(_0x332bf7,_0x36e051){return client[_0xf316('0x6')](_0x1e7156,_0x19f23c)[_0xf316('0x7')](function(_0x1bf310){logger['info'](_0xf316('0x8'),_0x26a573,_0xf316('0x9'));logger[_0xf316('0xa')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x26a573,_0xf316('0x9'),JSON[_0xf316('0xb')](_0x1bf310));if(_0x1bf310[_0xf316('0xc')]){if(_0x1bf310['error'][_0xf316('0xd')]===0x1f4){logger[_0xf316('0xc')]('SalesforceField,\x20%s,\x20%s',_0x26a573,_0x1bf310[_0xf316('0xc')][_0xf316('0xe')]);return _0x36e051(_0x1bf310[_0xf316('0xc')][_0xf316('0xe')]);}logger[_0xf316('0xc')](_0xf316('0x8'),_0x26a573,_0x1bf310[_0xf316('0xc')][_0xf316('0xe')]);return _0x332bf7(_0x1bf310['error'][_0xf316('0xe')]);}else{logger[_0xf316('0xf')](_0xf316('0x8'),_0x26a573,_0xf316('0x9'));_0x332bf7(_0x1bf310[_0xf316('0x10')][_0xf316('0xe')]);}})[_0xf316('0x11')](function(_0x2a518e){logger[_0xf316('0xc')]('SalesforceField,\x20%s,\x20%s',_0x26a573,_0x2a518e);_0x36e051(_0x2a518e);});});} \ No newline at end of file +var _0x8d9f=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x8d9f,0x16f));var _0xf8d9=function(_0x532577,_0x22e2fe){_0x532577=_0x532577-0x0;var _0x5fdc7e=_0x8d9f[_0x532577];return _0x5fdc7e;};'use strict';var _=require(_0xf8d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8d9('0x1'));var fs=require('fs');var Redis=require(_0xf8d9('0x2'));var db=require(_0xf8d9('0x3'))['db'];var utils=require(_0xf8d9('0x4'));var logger=require(_0xf8d9('0x5'))(_0xf8d9('0x6'));var config=require('../../config/environment');var jayson=require(_0xf8d9('0x7'));var client=jayson[_0xf8d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1565,_0xc9e3bc,_0x4bf38d){return new BPromise(function(_0x4c7171,_0x5d7043){return client['request'](_0x2d1565,_0x4bf38d)[_0xf8d9('0x9')](function(_0xaf4ce){logger[_0xf8d9('0xa')](_0xf8d9('0xb'),_0xc9e3bc,'request\x20sent');logger[_0xf8d9('0xc')](_0xf8d9('0xd'),_0xc9e3bc,_0xf8d9('0xe'),JSON[_0xf8d9('0xf')](_0xaf4ce));if(_0xaf4ce[_0xf8d9('0x10')]){if(_0xaf4ce[_0xf8d9('0x10')]['code']===0x1f4){logger[_0xf8d9('0x10')]('SalesforceField,\x20%s,\x20%s',_0xc9e3bc,_0xaf4ce['error'][_0xf8d9('0x11')]);return _0x5d7043(_0xaf4ce['error'][_0xf8d9('0x11')]);}logger[_0xf8d9('0x10')](_0xf8d9('0xb'),_0xc9e3bc,_0xaf4ce[_0xf8d9('0x10')][_0xf8d9('0x11')]);return _0x4c7171(_0xaf4ce[_0xf8d9('0x10')][_0xf8d9('0x11')]);}else{logger[_0xf8d9('0xa')](_0xf8d9('0xb'),_0xc9e3bc,_0xf8d9('0xe'));_0x4c7171(_0xaf4ce['result']['message']);}})[_0xf8d9('0x12')](function(_0x1ecfae){logger[_0xf8d9('0x10')](_0xf8d9('0xb'),_0xc9e3bc,_0x1ecfae);_0x5d7043(_0x1ecfae);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b917795..1cabcf2 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 _0x0c24=['get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0x0c24,0x13b));var _0x40c2=function(_0xe9ce81,_0x4d48bb){_0xe9ce81=_0xe9ce81-0x0;var _0x27c089=_0x0c24[_0xe9ce81];return _0x27c089;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40c2('0x0'));var timeout=require(_0x40c2('0x1'));var express=require('express');var router=express[_0x40c2('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x40c2('0x3'));var config=require(_0x40c2('0x4'));var controller=require(_0x40c2('0x5'));router['get']('/',auth[_0x40c2('0x6')](),controller[_0x40c2('0x7')]);router[_0x40c2('0x8')](_0x40c2('0x9'),auth[_0x40c2('0x6')](),controller[_0x40c2('0xa')]);router['get'](_0x40c2('0xb'),auth[_0x40c2('0x6')](),controller[_0x40c2('0xc')]);router[_0x40c2('0x8')](_0x40c2('0xd'),auth[_0x40c2('0x6')](),controller[_0x40c2('0xe')]);router[_0x40c2('0xf')]('/',auth[_0x40c2('0x6')](),controller[_0x40c2('0x10')]);router['post'](_0x40c2('0xb'),auth[_0x40c2('0x6')](),controller[_0x40c2('0x11')]);router[_0x40c2('0x12')](_0x40c2('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x40c2('0x9'),auth[_0x40c2('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a63=['express','fs-extra','./intServicenowAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','util','connect-timeout'];(function(_0xaced19,_0x4fa58f){var _0x352cda=function(_0x26e45f){while(--_0x26e45f){_0xaced19['push'](_0xaced19['shift']());}};_0x352cda(++_0x4fa58f);}(_0x7a63,0xfa));var _0x37a6=function(_0x5043e2,_0x9547b0){_0x5043e2=_0x5043e2-0x0;var _0xdd7961=_0x7a63[_0x5043e2];return _0xdd7961;};'use strict';var multer=require('multer');var util=require(_0x37a6('0x0'));var path=require('path');var timeout=require(_0x37a6('0x1'));var express=require(_0x37a6('0x2'));var router=express['Router']();var fs_extra=require(_0x37a6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x37a6('0x4'));router['get']('/',auth[_0x37a6('0x5')](),controller['index']);router['get'](_0x37a6('0x6'),auth[_0x37a6('0x5')](),controller[_0x37a6('0x7')]);router[_0x37a6('0x8')](_0x37a6('0x9'),auth[_0x37a6('0x5')](),controller[_0x37a6('0xa')]);router[_0x37a6('0x8')](_0x37a6('0xb'),auth[_0x37a6('0x5')](),controller[_0x37a6('0xc')]);router[_0x37a6('0xd')]('/',auth[_0x37a6('0x5')](),controller[_0x37a6('0xe')]);router[_0x37a6('0xd')](_0x37a6('0x9'),auth[_0x37a6('0x5')](),controller['addConfiguration']);router[_0x37a6('0xf')](_0x37a6('0x6'),auth[_0x37a6('0x5')](),controller[_0x37a6('0x10')]);router[_0x37a6('0x11')]('/:id',auth[_0x37a6('0x5')](),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 526d6b3..e02c48b 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 _0xc778=['exports','STRING','remoteUri','sequelize'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xc778,0x1d7));var _0x8c77=function(_0x1f6084,_0x116f5b){_0x1f6084=_0x1f6084-0x0;var _0x15ccf7=_0xc778[_0x1f6084];return _0x15ccf7;};'use strict';var Sequelize=require(_0x8c77('0x0'));module[_0x8c77('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c77('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8c77('0x2')],'unique':_0x8c77('0x3')},'serverUrl':{'type':Sequelize[_0x8c77('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1ba5=['username','sequelize','STRING'];(function(_0x309834,_0x22659a){var _0x528398=function(_0x2e0cbb){while(--_0x2e0cbb){_0x309834['push'](_0x309834['shift']());}};_0x528398(++_0x22659a);}(_0x1ba5,0xfd));var _0x51ba=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1ba5[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x51ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x51ba('0x1')]},'description':{'type':Sequelize[_0x51ba('0x1')]},'username':{'type':Sequelize[_0x51ba('0x1')],'unique':_0x51ba('0x2')},'password':{'type':Sequelize[_0x51ba('0x1')]},'email':{'type':Sequelize[_0x51ba('0x1')]},'remoteUri':{'type':Sequelize[_0x51ba('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x51ba('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 4396cbf..338b90d 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 _0xb1c1=['params','find','create','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','hold_reason','close_code','notify','incident_state','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','comments_and_work_notes','due_date','escalation','upon_approval','correlation_id','location','password','remoteUri','slice','substring','lastIndexOf','format','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','all','TCL:\x20_object','label','push','concat','error','send','test','Wrong\x20credentials','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','stack','name','index','map','ServicenowAccount','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x33fab6,_0x532a04){var _0x314e60=function(_0x56e5d6){while(--_0x56e5d6){_0x33fab6['push'](_0x33fab6['shift']());}};_0x314e60(++_0x532a04);}(_0xb1c1,0x124));var _0x1b1c=function(_0xec84e,_0x3a4944){_0xec84e=_0xec84e-0x0;var _0x21b7f9=_0xb1c1[_0xec84e];return _0x21b7f9;};'use strict';var emlformat=require(_0x1b1c('0x0'));var rimraf=require(_0x1b1c('0x1'));var zipdir=require(_0x1b1c('0x2'));var jsonpatch=require(_0x1b1c('0x3'));var rp=require(_0x1b1c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b1c('0x5'));var util=require(_0x1b1c('0x6'));var path=require(_0x1b1c('0x7'));var sox=require(_0x1b1c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b1c('0x9'));var _=require('lodash');var squel=require(_0x1b1c('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b1c('0xb'));var deskjs=require(_0x1b1c('0xc'));var toCsv=require(_0x1b1c('0xd'));var querystring=require('querystring');var Papa=require(_0x1b1c('0xe'));var Redis=require(_0x1b1c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1b1c('0x10'));var as=require(_0x1b1c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1b1c('0x12'));var utils=require(_0x1b1c('0x13'));var config=require(_0x1b1c('0x14'));var licenseUtil=require(_0x1b1c('0x15'));var db=require(_0x1b1c('0x16'))['db'];var integrations=require(_0x1b1c('0x17'));function respondWithStatusCode(_0x1570c2,_0x50aa0f){_0x50aa0f=_0x50aa0f||0xcc;return function(_0x358acd){if(_0x358acd){return _0x1570c2['sendStatus'](_0x50aa0f);}return _0x1570c2[_0x1b1c('0x18')](_0x50aa0f)['end']();};}function respondWithResult(_0x9a0ac0,_0x311296){_0x311296=_0x311296||0xc8;return function(_0x513e32){if(_0x513e32){return _0x9a0ac0[_0x1b1c('0x18')](_0x311296)[_0x1b1c('0x19')](_0x513e32);}};}function respondWithFilteredResult(_0x5c2269,_0x3581da){return function(_0x7deeb9){if(_0x7deeb9){var _0x30cbe0=typeof _0x3581da[_0x1b1c('0x1a')]===_0x1b1c('0x1b')&&typeof _0x3581da[_0x1b1c('0x1c')]===_0x1b1c('0x1b');var _0x3db76e=_0x7deeb9[_0x1b1c('0x1d')];var _0x1bb4a4=_0x30cbe0?0x0:_0x3581da[_0x1b1c('0x1a')];var _0x4d6447=_0x30cbe0?_0x7deeb9[_0x1b1c('0x1d')]:_0x3581da[_0x1b1c('0x1a')]+_0x3581da[_0x1b1c('0x1c')];var _0x2860b8;if(_0x4d6447>=_0x3db76e){_0x4d6447=_0x3db76e;_0x2860b8=0xc8;}else{_0x2860b8=0xce;}_0x5c2269[_0x1b1c('0x18')](_0x2860b8);return _0x5c2269[_0x1b1c('0x1e')]('Content-Range',_0x1bb4a4+'-'+_0x4d6447+'/'+_0x3db76e)[_0x1b1c('0x19')](_0x7deeb9);}return null;};}function patchUpdates(_0x43a167){return function(_0x19f98a){try{jsonpatch['apply'](_0x19f98a,_0x43a167,!![]);}catch(_0x1a95e6){return BPromise[_0x1b1c('0x1f')](_0x1a95e6);}return _0x19f98a[_0x1b1c('0x20')]();};}function saveUpdates(_0x497e24,_0x5469b0){return function(_0x1caa15){if(_0x1caa15){return _0x1caa15[_0x1b1c('0x21')](_0x497e24)[_0x1b1c('0x22')](function(_0x196e40){return _0x196e40;});}return null;};}function removeEntity(_0x496806,_0x47cd22){return function(_0x103fc8){if(_0x103fc8){return _0x103fc8[_0x1b1c('0x23')]()[_0x1b1c('0x22')](function(){_0x496806['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35dcdc,_0xffe393){return function(_0x511338){if(!_0x511338){_0x35dcdc[_0x1b1c('0x24')](0x194);}return _0x511338;};}function handleError(_0x1b9125,_0x269c19){_0x269c19=_0x269c19||0x1f4;return function(_0x3aa8c7){logger['error'](_0x3aa8c7[_0x1b1c('0x25')]);if(_0x3aa8c7[_0x1b1c('0x26')]){delete _0x3aa8c7['name'];}_0x1b9125[_0x1b1c('0x18')](_0x269c19)['send'](_0x3aa8c7);};}exports[_0x1b1c('0x27')]=function(_0x5420be,_0xb89d26){var _0x468579={},_0xd8fb14={},_0xe320ea={'count':0x0,'rows':[]};var _0x5b0448=_[_0x1b1c('0x28')](db[_0x1b1c('0x29')][_0x1b1c('0x2a')],function(_0x5e26b5){return{'name':_0x5e26b5['fieldName'],'type':_0x5e26b5[_0x1b1c('0x2b')]['key']};});_0xd8fb14['model']=_[_0x1b1c('0x28')](_0x5b0448,_0x1b1c('0x26'));_0xd8fb14['query']=_[_0x1b1c('0x2c')](_0x5420be[_0x1b1c('0x2d')]);_0xd8fb14[_0x1b1c('0x2e')]=_['intersection'](_0xd8fb14[_0x1b1c('0x2f')],_0xd8fb14[_0x1b1c('0x2d')]);_0x468579[_0x1b1c('0x30')]=_[_0x1b1c('0x31')](_0xd8fb14[_0x1b1c('0x2f')],qs['fields'](_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x32')]));_0x468579[_0x1b1c('0x30')]=_0x468579[_0x1b1c('0x30')][_0x1b1c('0x33')]?_0x468579[_0x1b1c('0x30')]:_0xd8fb14['model'];if(!_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x34')]('nolimit')){_0x468579[_0x1b1c('0x1c')]=qs[_0x1b1c('0x1c')](_0x5420be[_0x1b1c('0x2d')]['limit']);_0x468579[_0x1b1c('0x1a')]=qs[_0x1b1c('0x1a')](_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x1a')]);}_0x468579[_0x1b1c('0x35')]=qs[_0x1b1c('0x36')](_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x36')]);_0x468579['where']=qs[_0x1b1c('0x2e')](_[_0x1b1c('0x37')](_0x5420be[_0x1b1c('0x2d')],_0xd8fb14[_0x1b1c('0x2e')]),_0x5b0448);if(_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x38')]){_0x468579[_0x1b1c('0x39')]=_['merge'](_0x468579[_0x1b1c('0x39')],{'$or':_[_0x1b1c('0x28')](_0x5b0448,function(_0x15acee){if(_0x15acee[_0x1b1c('0x2b')]!==_0x1b1c('0x3a')){var _0x576611={};_0x576611[_0x15acee['name']]={'$like':'%'+_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x38')]+'%'};return _0x576611;}})});}_0x468579=_[_0x1b1c('0x3b')]({},_0x468579,_0x5420be[_0x1b1c('0x3c')]);var _0x57f5df={'where':_0x468579[_0x1b1c('0x39')]};return db['ServicenowAccount'][_0x1b1c('0x1d')](_0x57f5df)['then'](function(_0xe5c1f7){_0xe320ea[_0x1b1c('0x1d')]=_0xe5c1f7;if(_0x5420be[_0x1b1c('0x2d')][_0x1b1c('0x3d')]){_0x468579[_0x1b1c('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1b1c('0x3f')](_0x468579);})[_0x1b1c('0x22')](function(_0x1fdc65){_0xe320ea[_0x1b1c('0x40')]=_0x1fdc65;return _0xe320ea;})[_0x1b1c('0x22')](respondWithFilteredResult(_0xb89d26,_0x468579))[_0x1b1c('0x41')](handleError(_0xb89d26,null));};exports['show']=function(_0x401176,_0x317fda){var _0x4b1c3e={'raw':![],'where':{'id':_0x401176[_0x1b1c('0x42')]['id']}},_0x91a899={};_0x91a899['model']=_[_0x1b1c('0x2c')](db[_0x1b1c('0x29')][_0x1b1c('0x2a')]);_0x91a899[_0x1b1c('0x2d')]=_[_0x1b1c('0x2c')](_0x401176[_0x1b1c('0x2d')]);_0x91a899[_0x1b1c('0x2e')]=_[_0x1b1c('0x31')](_0x91a899[_0x1b1c('0x2f')],_0x91a899['query']);_0x4b1c3e[_0x1b1c('0x30')]=_[_0x1b1c('0x31')](_0x91a899[_0x1b1c('0x2f')],qs[_0x1b1c('0x32')](_0x401176[_0x1b1c('0x2d')][_0x1b1c('0x32')]));_0x4b1c3e[_0x1b1c('0x30')]=_0x4b1c3e[_0x1b1c('0x30')][_0x1b1c('0x33')]?_0x4b1c3e[_0x1b1c('0x30')]:_0x91a899[_0x1b1c('0x2f')];if(_0x401176[_0x1b1c('0x2d')][_0x1b1c('0x3d')]){_0x4b1c3e[_0x1b1c('0x3e')]=[{'all':!![]}];}_0x4b1c3e=_['merge']({},_0x4b1c3e,_0x401176[_0x1b1c('0x3c')]);return db[_0x1b1c('0x29')][_0x1b1c('0x43')](_0x4b1c3e)['then'](handleEntityNotFound(_0x317fda,null))[_0x1b1c('0x22')](respondWithResult(_0x317fda,null))[_0x1b1c('0x41')](handleError(_0x317fda,null));};exports[_0x1b1c('0x44')]=function(_0x4acfec,_0x3b1f2a){return db[_0x1b1c('0x29')][_0x1b1c('0x44')](_0x4acfec[_0x1b1c('0x45')],{})[_0x1b1c('0x22')](respondWithResult(_0x3b1f2a,0xc9))[_0x1b1c('0x41')](handleError(_0x3b1f2a,null));};exports[_0x1b1c('0x21')]=function(_0x49fb29,_0x24631a){if(_0x49fb29[_0x1b1c('0x45')]['id']){delete _0x49fb29['body']['id'];}return db[_0x1b1c('0x29')]['find']({'where':{'id':_0x49fb29[_0x1b1c('0x42')]['id']}})[_0x1b1c('0x22')](handleEntityNotFound(_0x24631a,null))['then'](saveUpdates(_0x49fb29[_0x1b1c('0x45')],null))['then'](respondWithResult(_0x24631a,null))[_0x1b1c('0x41')](handleError(_0x24631a,null));};exports['destroy']=function(_0x3583b9,_0x220949){return db['ServicenowAccount'][_0x1b1c('0x43')]({'where':{'id':_0x3583b9['params']['id']}})[_0x1b1c('0x22')](handleEntityNotFound(_0x220949,null))[_0x1b1c('0x22')](removeEntity(_0x220949,null))['catch'](handleError(_0x220949,null));};exports[_0x1b1c('0x46')]=function(_0x5a4217,_0x11868e,_0x3f3c90){var _0x54a8d4={};var _0x21b4f7={};var _0xf37649;var _0x110141;return db[_0x1b1c('0x29')][_0x1b1c('0x47')]({'where':{'id':_0x5a4217[_0x1b1c('0x42')]['id']}})['then'](handleEntityNotFound(_0x11868e,null))[_0x1b1c('0x22')](function(_0x308588){if(_0x308588){_0xf37649=_0x308588;_0x21b4f7[_0x1b1c('0x2f')]=_['keys'](db['ServicenowConfiguration'][_0x1b1c('0x2a')]);_0x21b4f7[_0x1b1c('0x2d')]=_['keys'](_0x5a4217[_0x1b1c('0x2d')]);_0x21b4f7[_0x1b1c('0x2e')]=_[_0x1b1c('0x31')](_0x21b4f7[_0x1b1c('0x2f')],_0x21b4f7[_0x1b1c('0x2d')]);_0x54a8d4[_0x1b1c('0x30')]=_[_0x1b1c('0x31')](_0x21b4f7[_0x1b1c('0x2f')],qs[_0x1b1c('0x32')](_0x5a4217['query'][_0x1b1c('0x32')]));_0x54a8d4[_0x1b1c('0x30')]=_0x54a8d4['attributes'][_0x1b1c('0x33')]?_0x54a8d4[_0x1b1c('0x30')]:_0x21b4f7[_0x1b1c('0x2f')];_0x54a8d4[_0x1b1c('0x35')]=qs[_0x1b1c('0x36')](_0x5a4217[_0x1b1c('0x2d')][_0x1b1c('0x36')]);_0x54a8d4[_0x1b1c('0x39')]=qs[_0x1b1c('0x2e')](_['pick'](_0x5a4217[_0x1b1c('0x2d')],_0x21b4f7[_0x1b1c('0x2e')]));if(_0x5a4217[_0x1b1c('0x2d')][_0x1b1c('0x38')]){_0x54a8d4['where']=_[_0x1b1c('0x3b')](_0x54a8d4[_0x1b1c('0x39')],{'$or':_['map'](_0x54a8d4[_0x1b1c('0x30')],function(_0x214a02){var _0x353319={};_0x353319[_0x214a02]={'$like':'%'+_0x5a4217['query'][_0x1b1c('0x38')]+'%'};return _0x353319;})});}_0x54a8d4=_[_0x1b1c('0x3b')]({},_0x54a8d4,_0x5a4217[_0x1b1c('0x3c')]);return _0xf37649[_0x1b1c('0x46')](_0x54a8d4);}})[_0x1b1c('0x22')](function(_0x14fbe4){if(_0x14fbe4){_0x110141=_0x14fbe4[_0x1b1c('0x33')];if(!_0x5a4217[_0x1b1c('0x2d')]['hasOwnProperty']('nolimit')){_0x54a8d4[_0x1b1c('0x1c')]=qs[_0x1b1c('0x1c')](_0x5a4217[_0x1b1c('0x2d')]['limit']);_0x54a8d4[_0x1b1c('0x1a')]=qs[_0x1b1c('0x1a')](_0x5a4217[_0x1b1c('0x2d')][_0x1b1c('0x1a')]);}return _0xf37649[_0x1b1c('0x46')](_0x54a8d4);}})[_0x1b1c('0x22')](function(_0x3eb608){if(_0x3eb608){return _0x3eb608?{'count':_0x110141,'rows':_0x3eb608}:null;}})[_0x1b1c('0x22')](respondWithResult(_0x11868e,null))[_0x1b1c('0x41')](handleError(_0x11868e,null));};exports['addConfiguration']=function(_0x22cd78,_0x3231ba,_0x134a7e){if(_0x22cd78[_0x1b1c('0x45')]['id']){delete _0x22cd78[_0x1b1c('0x45')]['id'];}return db[_0x1b1c('0x29')][_0x1b1c('0x47')]({'where':{'id':_0x22cd78[_0x1b1c('0x42')]['id']}})[_0x1b1c('0x22')](handleEntityNotFound(_0x3231ba,null))[_0x1b1c('0x22')](function(_0xf4f1d1){if(_0xf4f1d1){_0x22cd78['body'][_0x1b1c('0x48')]=_0xf4f1d1['id'];_0x22cd78[_0x1b1c('0x45')][_0x1b1c('0x49')]=integrations[_0x1b1c('0x4a')](_0x22cd78['body']['channel'],_0x22cd78[_0x1b1c('0x45')][_0x1b1c('0x2b')]);_0x22cd78[_0x1b1c('0x45')][_0x1b1c('0x4b')]=integrations[_0x1b1c('0x4c')](_0x22cd78[_0x1b1c('0x45')][_0x1b1c('0x4d')],_0x22cd78[_0x1b1c('0x45')]['type']);return db[_0x1b1c('0x4e')][_0x1b1c('0x44')](_0x22cd78[_0x1b1c('0x45')],{'include':[{'model':db['ServicenowField'],'as':_0x1b1c('0x49')},{'model':db[_0x1b1c('0x4f')],'as':'Descriptions'}]});}return null;})[_0x1b1c('0x22')](respondWithResult(_0x3231ba,null))[_0x1b1c('0x41')](handleError(_0x3231ba,null));};exports[_0x1b1c('0x50')]=function(_0x5c4cf0,_0x1c99ee,_0x4af230){var _0x50516d=['made_sla',_0x1b1c('0x51'),'knowledge','subcategory',_0x1b1c('0x52'),_0x1b1c('0x53'),_0x1b1c('0x54'),'severity',_0x1b1c('0x55')];var _0xc1e359=['parent',_0x1b1c('0x56'),_0x1b1c('0x57'),_0x1b1c('0x58'),_0x1b1c('0x59'),_0x1b1c('0x5a'),'child_incidents',_0x1b1c('0x51'),_0x1b1c('0x5b'),_0x1b1c('0x5c'),_0x1b1c('0x5d'),_0x1b1c('0x5e'),_0x1b1c('0x5f'),_0x1b1c('0x60'),_0x1b1c('0x61'),_0x1b1c('0x62'),_0x1b1c('0x63'),_0x1b1c('0x64'),_0x1b1c('0x65'),_0x1b1c('0x35'),_0x1b1c('0x66'),'closed_at','cmdb_ci',_0x1b1c('0x67'),_0x1b1c('0x68'),_0x1b1c('0x69'),_0x1b1c('0x6a'),_0x1b1c('0x6b'),_0x1b1c('0x6c'),_0x1b1c('0x6d'),_0x1b1c('0x6e'),_0x1b1c('0x6f'),'expected_start','opened_at',_0x1b1c('0x70'),_0x1b1c('0x71'),'work_end',_0x1b1c('0x72'),'resolved_at','caller_id',_0x1b1c('0x73'),'subcategory',_0x1b1c('0x74'),_0x1b1c('0x75'),_0x1b1c('0x52'),_0x1b1c('0x76'),_0x1b1c('0x77'),_0x1b1c('0x78'),_0x1b1c('0x79'),_0x1b1c('0x7a'),'additional_assignee_list',_0x1b1c('0x7b'),_0x1b1c('0x7c'),_0x1b1c('0x53'),_0x1b1c('0x7d'),'close_notes',_0x1b1c('0x7e'),_0x1b1c('0x7f'),_0x1b1c('0x80'),_0x1b1c('0x81'),_0x1b1c('0x82'),_0x1b1c('0x83'),_0x1b1c('0x54'),_0x1b1c('0x84'),_0x1b1c('0x85'),_0x1b1c('0x86'),_0x1b1c('0x87'),_0x1b1c('0x88'),_0x1b1c('0x89'),_0x1b1c('0x8a'),_0x1b1c('0x8b'),'sla_due','approval',_0x1b1c('0x8c'),_0x1b1c('0x8d'),'sys_mod_count','reopen_count','sys_tags',_0x1b1c('0x8e'),_0x1b1c('0x8f'),_0x1b1c('0x90'),_0x1b1c('0x91'),_0x1b1c('0x55')];var _0x510f30='';var _0x35d9be='';var _0x16c919=[];var _0x20f8b3='';var _0x216ba3='';var _0x1271b5=[];var _0x30b379='';var _0x2506df='';var _0x4a8c92={};var _0x4b77b3='';return db[_0x1b1c('0x29')][_0x1b1c('0x47')]({'where':{'id':_0x5c4cf0['params']['id']},'attributes':['id','username',_0x1b1c('0x92'),'email',_0x1b1c('0x93'),'serverUrl']})['then'](handleEntityNotFound(_0x1c99ee,null))['then'](function(_0x1ff23f){if(_0x1ff23f){_0x4b77b3=_0x1ff23f[_0x1b1c('0x93')];var _0x35223e=_0x4b77b3[_0x1b1c('0x94')](-0x1);if(_0x35223e==='/'){_0x4b77b3=_0x4b77b3[_0x1b1c('0x95')](0x0,_0x4b77b3[_0x1b1c('0x96')](_0x35223e));}_0x2506df=util[_0x1b1c('0x97')]('%s/api/now/doc/table/schema/',_0x4b77b3);_0x30b379=util['format']('%s/api/now/table/',_0x4b77b3);_0x4a8c92={'user':_0x1ff23f[_0x1b1c('0x98')],'pass':_0x1ff23f[_0x1b1c('0x92')]};var _0x4da9a5={'method':_0x1b1c('0x99'),'uri':_0x2506df+_0x1b1c('0x9a'),'auth':_0x4a8c92,'json':!![]};return rp(_0x4da9a5);}})[_0x1b1c('0x22')](function(_0x40fae9){if(_0x40fae9['result'][_0x1b1c('0x33')]>0x0){_0x510f30=_0x40fae9[_0x1b1c('0x9b')];}console[_0x1b1c('0x9c')]('incident\x20table\x20objects',_0x510f30);_0x1271b5=[];_0x35d9be=Object[_0x1b1c('0x9d')]([],_0x510f30);_[_0x1b1c('0x9e')](_0x35d9be,function(_0x2fe053){return!_0x50516d[_0x1b1c('0x9f')](_0x2fe053[_0x1b1c('0x26')]);});_0x35d9be[_0x1b1c('0xa0')](function(_0x5a7711){var _0x339c57=createFieldObject(_0x30b379,_0x4a8c92,_0x5a7711[_0x1b1c('0xa1')],_0x5a7711['name'],_0x5a7711['label'],![]);_0x1271b5['push'](_0x339c57);});return Promise[_0x1b1c('0xa2')](_0x1271b5);})[_0x1b1c('0x22')](function(_0x598fa9){_0x16c919=_0x598fa9;_0x20f8b3=Object[_0x1b1c('0x9d')]([],_0x510f30);console[_0x1b1c('0x9c')](_0x1b1c('0xa3'),_0x510f30);_[_0x1b1c('0x9e')](_0x20f8b3,function(_0xaa6359){return _0xc1e359[_0x1b1c('0x9f')](_0xaa6359[_0x1b1c('0x26')]);});console[_0x1b1c('0x9c')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x20f8b3);_0x1271b5=[];_0x20f8b3['forEach'](function(_0x343a98){var _0x5ab6fd=createFieldObject(_0x30b379,_0x4a8c92,_0x343a98['internalType'],_0x343a98[_0x1b1c('0x26')],_0x343a98[_0x1b1c('0xa4')],!![]);_0x1271b5[_0x1b1c('0xa5')](_0x5ab6fd);});return Promise[_0x1b1c('0xa2')](_0x1271b5);})[_0x1b1c('0x22')](function(_0x9f78a2){_0x216ba3=_0x9f78a2;var _0x4c11b3=_0x16c919[_0x1b1c('0xa6')](_0x216ba3);return{'count':_0x4c11b3['length'],'rows':_0x4c11b3};})[_0x1b1c('0x22')](respondWithResult(_0x1c99ee,null))[_0x1b1c('0x41')](function(_0x5a4e43){console[_0x1b1c('0x9c')]('ServiceNow\x20error:\x20'+_0x5a4e43);var _0x36e11b=_0x5c4cf0[_0x1b1c('0x2d')]['test']?0x1f4:_0x5a4e43['statusCode']||0x1f4;logger[_0x1b1c('0xa7')](_0x5a4e43['stack']);delete _0x5a4e43[_0x1b1c('0x26')];if(_0x36e11b===0x191){_0x36e11b=0x190;}_0x1c99ee['status'](_0x36e11b)[_0x1b1c('0xa8')](_0x5c4cf0[_0x1b1c('0x2d')][_0x1b1c('0xa9')]?{'message':_0x1b1c('0xaa'),'statusCode':_0x5a4e43[_0x1b1c('0xab')]}:_0x5a4e43);});};function createFieldObject(_0x477af4,_0x53505d,_0x532c63,_0x529c1f,_0x339b0c,_0x1127eb){return new Promise(function(_0x49e625,_0x3cd0eb){var _0x32973c={'id':_0x529c1f,'name':_0x339b0c,'custom':_0x1127eb};if(_0x532c63===_0x1b1c('0xac')){_0x32973c['options']=[{'name':'True','value':_0x1b1c('0xad')},{'name':_0x1b1c('0xae'),'value':_0x1b1c('0xaf')}];_0x49e625(_0x32973c);}else{var _0x311615={'method':_0x1b1c('0x99'),'uri':_0x477af4+_0x1b1c('0xb0')+_0x529c1f,'auth':_0x53505d,'json':!![]};return rp(_0x311615)[_0x1b1c('0x22')](function(_0x49ff4c){var _0x545cf6=[];if(_0x49ff4c[_0x1b1c('0x9b')][_0x1b1c('0x33')]>0x0){_0x49ff4c[_0x1b1c('0x9b')][_0x1b1c('0xa0')](function(_0x380a89){if(_0x380a89[_0x1b1c('0xb1')]===_0x1b1c('0xaf')){var _0x248f6e={'name':_0x380a89[_0x1b1c('0xa4')],'value':_0x380a89[_0x1b1c('0xb2')]};_0x545cf6[_0x1b1c('0xa5')](_0x248f6e);}});}_0x32973c[_0x1b1c('0x3c')]=_0x545cf6;if(_0x32973c['options'][_0x1b1c('0x33')]>0x0){_0x49e625(_0x32973c);}else{if(_0x1127eb==![]){_0x49e625();}else{_0x49e625(_0x32973c);}}});}});} \ No newline at end of file +var _0xec47=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','filter','merge','options','ServicenowAccount','includeAll','include','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','business_duration','group_list','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','forEach','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','True','false','GET','inactive','value','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26fec8,_0x7899c){var _0x2f05f3=function(_0x1c2fc1){while(--_0x1c2fc1){_0x26fec8['push'](_0x26fec8['shift']());}};_0x2f05f3(++_0x7899c);}(_0xec47,0x15d));var _0x7ec4=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xec47[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x7ec4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ec4('0x1'));var moment=require(_0x7ec4('0x2'));var BPromise=require(_0x7ec4('0x3'));var Mustache=require(_0x7ec4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7ec4('0x5'));var csv=require(_0x7ec4('0x6'));var ejs=require(_0x7ec4('0x7'));var fs=require('fs');var fs_extra=require(_0x7ec4('0x8'));var _=require(_0x7ec4('0x9'));var squel=require(_0x7ec4('0xa'));var crypto=require(_0x7ec4('0xb'));var jsforce=require(_0x7ec4('0xc'));var deskjs=require(_0x7ec4('0xd'));var toCsv=require(_0x7ec4('0x6'));var querystring=require(_0x7ec4('0xe'));var Papa=require(_0x7ec4('0xf'));var Redis=require(_0x7ec4('0x10'));var authService=require(_0x7ec4('0x11'));var qs=require(_0x7ec4('0x12'));var as=require(_0x7ec4('0x13'));var hardwareService=require(_0x7ec4('0x14'));var logger=require('../../config/logger')(_0x7ec4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ec4('0x16'))['db'];var integrations=require(_0x7ec4('0x17'));function respondWithStatusCode(_0x34e634,_0x380427){_0x380427=_0x380427||0xcc;return function(_0x5754be){if(_0x5754be){return _0x34e634[_0x7ec4('0x18')](_0x380427);}return _0x34e634[_0x7ec4('0x19')](_0x380427)[_0x7ec4('0x1a')]();};}function respondWithResult(_0x44de42,_0xe25be4){_0xe25be4=_0xe25be4||0xc8;return function(_0x527255){if(_0x527255){return _0x44de42[_0x7ec4('0x19')](_0xe25be4)[_0x7ec4('0x1b')](_0x527255);}};}function respondWithFilteredResult(_0xfdb7d3,_0x6d6bf8){return function(_0x46651c){if(_0x46651c){var _0xb90279=typeof _0x6d6bf8['offset']===_0x7ec4('0x1c')&&typeof _0x6d6bf8[_0x7ec4('0x1d')]==='undefined';var _0x3a3524=_0x46651c[_0x7ec4('0x1e')];var _0x2e60a7=_0xb90279?0x0:_0x6d6bf8[_0x7ec4('0x1f')];var _0x1d0094=_0xb90279?_0x46651c[_0x7ec4('0x1e')]:_0x6d6bf8[_0x7ec4('0x1f')]+_0x6d6bf8[_0x7ec4('0x1d')];var _0x5904f8;if(_0x1d0094>=_0x3a3524){_0x1d0094=_0x3a3524;_0x5904f8=0xc8;}else{_0x5904f8=0xce;}_0xfdb7d3[_0x7ec4('0x19')](_0x5904f8);return _0xfdb7d3[_0x7ec4('0x20')](_0x7ec4('0x21'),_0x2e60a7+'-'+_0x1d0094+'/'+_0x3a3524)[_0x7ec4('0x1b')](_0x46651c);}return null;};}function patchUpdates(_0x2b8420){return function(_0x5044c6){try{jsonpatch['apply'](_0x5044c6,_0x2b8420,!![]);}catch(_0x53b58a){return BPromise[_0x7ec4('0x22')](_0x53b58a);}return _0x5044c6[_0x7ec4('0x23')]();};}function saveUpdates(_0x52ff03,_0x1bc42d){return function(_0x4b5b1a){if(_0x4b5b1a){return _0x4b5b1a[_0x7ec4('0x24')](_0x52ff03)[_0x7ec4('0x25')](function(_0x82f025){return _0x82f025;});}return null;};}function removeEntity(_0x5f3e14,_0x2a4f58){return function(_0x5864e3){if(_0x5864e3){return _0x5864e3['destroy']()[_0x7ec4('0x25')](function(){_0x5f3e14['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e02e,_0x40b1e3){return function(_0x4d9eb8){if(!_0x4d9eb8){_0x14e02e[_0x7ec4('0x18')](0x194);}return _0x4d9eb8;};}function handleError(_0x124902,_0x338e1a){_0x338e1a=_0x338e1a||0x1f4;return function(_0x288c3a){logger[_0x7ec4('0x26')](_0x288c3a['stack']);if(_0x288c3a['name']){delete _0x288c3a[_0x7ec4('0x27')];}_0x124902[_0x7ec4('0x19')](_0x338e1a)[_0x7ec4('0x28')](_0x288c3a);};}exports['index']=function(_0xfcd3e2,_0x5cfae5){var _0x15afba={},_0x14a30a={},_0x37da23={'count':0x0,'rows':[]};var _0x8dea82=_[_0x7ec4('0x29')](db['ServicenowAccount'][_0x7ec4('0x2a')],function(_0x55c1d9){return{'name':_0x55c1d9[_0x7ec4('0x2b')],'type':_0x55c1d9[_0x7ec4('0x2c')][_0x7ec4('0x2d')]};});_0x14a30a[_0x7ec4('0x2e')]=_[_0x7ec4('0x29')](_0x8dea82,'name');_0x14a30a['query']=_[_0x7ec4('0x2f')](_0xfcd3e2['query']);_0x14a30a[_0x7ec4('0x30')]=_[_0x7ec4('0x31')](_0x14a30a[_0x7ec4('0x2e')],_0x14a30a[_0x7ec4('0x32')]);_0x15afba[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0x14a30a[_0x7ec4('0x2e')],qs[_0x7ec4('0x34')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x34')]));_0x15afba[_0x7ec4('0x33')]=_0x15afba[_0x7ec4('0x33')]['length']?_0x15afba[_0x7ec4('0x33')]:_0x14a30a[_0x7ec4('0x2e')];if(!_0xfcd3e2[_0x7ec4('0x32')]['hasOwnProperty'](_0x7ec4('0x35'))){_0x15afba[_0x7ec4('0x1d')]=qs[_0x7ec4('0x1d')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x1d')]);_0x15afba[_0x7ec4('0x1f')]=qs[_0x7ec4('0x1f')](_0xfcd3e2[_0x7ec4('0x32')]['offset']);}_0x15afba[_0x7ec4('0x36')]=qs[_0x7ec4('0x37')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x37')]);_0x15afba[_0x7ec4('0x38')]=qs['filters'](_['pick'](_0xfcd3e2[_0x7ec4('0x32')],_0x14a30a[_0x7ec4('0x30')]),_0x8dea82);if(_0xfcd3e2['query'][_0x7ec4('0x39')]){_0x15afba[_0x7ec4('0x38')]=_['merge'](_0x15afba[_0x7ec4('0x38')],{'$or':_[_0x7ec4('0x29')](_0x8dea82,function(_0x24937a){if(_0x24937a['type']!=='VIRTUAL'){var _0x591989={};_0x591989[_0x24937a[_0x7ec4('0x27')]]={'$like':'%'+_0xfcd3e2[_0x7ec4('0x32')]['filter']+'%'};return _0x591989;}})});}_0x15afba=_[_0x7ec4('0x3a')]({},_0x15afba,_0xfcd3e2[_0x7ec4('0x3b')]);var _0x4602b9={'where':_0x15afba[_0x7ec4('0x38')]};return db[_0x7ec4('0x3c')][_0x7ec4('0x1e')](_0x4602b9)[_0x7ec4('0x25')](function(_0x436010){_0x37da23['count']=_0x436010;if(_0xfcd3e2['query'][_0x7ec4('0x3d')]){_0x15afba[_0x7ec4('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x15afba);})['then'](function(_0x1ef2c8){_0x37da23['rows']=_0x1ef2c8;return _0x37da23;})[_0x7ec4('0x25')](respondWithFilteredResult(_0x5cfae5,_0x15afba))[_0x7ec4('0x3f')](handleError(_0x5cfae5,null));};exports[_0x7ec4('0x40')]=function(_0x551212,_0x578ae5){var _0xcb823f={'raw':![],'where':{'id':_0x551212[_0x7ec4('0x41')]['id']}},_0xa6cfc6={};_0xa6cfc6[_0x7ec4('0x2e')]=_[_0x7ec4('0x2f')](db[_0x7ec4('0x3c')]['rawAttributes']);_0xa6cfc6[_0x7ec4('0x32')]=_[_0x7ec4('0x2f')](_0x551212['query']);_0xa6cfc6['filters']=_[_0x7ec4('0x31')](_0xa6cfc6[_0x7ec4('0x2e')],_0xa6cfc6[_0x7ec4('0x32')]);_0xcb823f[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0xa6cfc6[_0x7ec4('0x2e')],qs[_0x7ec4('0x34')](_0x551212[_0x7ec4('0x32')]['fields']));_0xcb823f[_0x7ec4('0x33')]=_0xcb823f[_0x7ec4('0x33')][_0x7ec4('0x42')]?_0xcb823f[_0x7ec4('0x33')]:_0xa6cfc6['model'];if(_0x551212[_0x7ec4('0x32')]['includeAll']){_0xcb823f[_0x7ec4('0x3e')]=[{'all':!![]}];}_0xcb823f=_['merge']({},_0xcb823f,_0x551212[_0x7ec4('0x3b')]);return db[_0x7ec4('0x3c')][_0x7ec4('0x43')](_0xcb823f)[_0x7ec4('0x25')](handleEntityNotFound(_0x578ae5,null))[_0x7ec4('0x25')](respondWithResult(_0x578ae5,null))[_0x7ec4('0x3f')](handleError(_0x578ae5,null));};exports['create']=function(_0x53d30a,_0x4f9758){return db['ServicenowAccount'][_0x7ec4('0x44')](_0x53d30a[_0x7ec4('0x45')],{})[_0x7ec4('0x25')](respondWithResult(_0x4f9758,0xc9))[_0x7ec4('0x3f')](handleError(_0x4f9758,null));};exports[_0x7ec4('0x24')]=function(_0x598ef4,_0x3b36fb){if(_0x598ef4[_0x7ec4('0x45')]['id']){delete _0x598ef4[_0x7ec4('0x45')]['id'];}return db[_0x7ec4('0x3c')][_0x7ec4('0x43')]({'where':{'id':_0x598ef4[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x3b36fb,null))['then'](saveUpdates(_0x598ef4[_0x7ec4('0x45')],null))[_0x7ec4('0x25')](respondWithResult(_0x3b36fb,null))[_0x7ec4('0x3f')](handleError(_0x3b36fb,null));};exports[_0x7ec4('0x46')]=function(_0x31d6d5,_0x34fe9e){return db['ServicenowAccount']['find']({'where':{'id':_0x31d6d5['params']['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x34fe9e,null))[_0x7ec4('0x25')](removeEntity(_0x34fe9e,null))['catch'](handleError(_0x34fe9e,null));};exports[_0x7ec4('0x47')]=function(_0x1d9da0,_0x1a85b5,_0x7cec5c){var _0x2e046a={};var _0x5c89fa={};var _0x5bd4d3;var _0x543e16;return db[_0x7ec4('0x3c')][_0x7ec4('0x48')]({'where':{'id':_0x1d9da0[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x1a85b5,null))['then'](function(_0x595188){if(_0x595188){_0x5bd4d3=_0x595188;_0x5c89fa[_0x7ec4('0x2e')]=_[_0x7ec4('0x2f')](db[_0x7ec4('0x49')][_0x7ec4('0x2a')]);_0x5c89fa['query']=_[_0x7ec4('0x2f')](_0x1d9da0[_0x7ec4('0x32')]);_0x5c89fa['filters']=_[_0x7ec4('0x31')](_0x5c89fa[_0x7ec4('0x2e')],_0x5c89fa['query']);_0x2e046a[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0x5c89fa['model'],qs[_0x7ec4('0x34')](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x34')]));_0x2e046a[_0x7ec4('0x33')]=_0x2e046a[_0x7ec4('0x33')]['length']?_0x2e046a[_0x7ec4('0x33')]:_0x5c89fa[_0x7ec4('0x2e')];_0x2e046a[_0x7ec4('0x36')]=qs['sort'](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x37')]);_0x2e046a[_0x7ec4('0x38')]=qs[_0x7ec4('0x30')](_[_0x7ec4('0x4a')](_0x1d9da0[_0x7ec4('0x32')],_0x5c89fa[_0x7ec4('0x30')]));if(_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x39')]){_0x2e046a[_0x7ec4('0x38')]=_[_0x7ec4('0x3a')](_0x2e046a[_0x7ec4('0x38')],{'$or':_[_0x7ec4('0x29')](_0x2e046a['attributes'],function(_0x461995){var _0x2c90a1={};_0x2c90a1[_0x461995]={'$like':'%'+_0x1d9da0['query'][_0x7ec4('0x39')]+'%'};return _0x2c90a1;})});}_0x2e046a=_[_0x7ec4('0x3a')]({},_0x2e046a,_0x1d9da0['options']);return _0x5bd4d3[_0x7ec4('0x47')](_0x2e046a);}})[_0x7ec4('0x25')](function(_0x154a9d){if(_0x154a9d){_0x543e16=_0x154a9d[_0x7ec4('0x42')];if(!_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x4b')](_0x7ec4('0x35'))){_0x2e046a[_0x7ec4('0x1d')]=qs['limit'](_0x1d9da0[_0x7ec4('0x32')]['limit']);_0x2e046a['offset']=qs[_0x7ec4('0x1f')](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x1f')]);}return _0x5bd4d3[_0x7ec4('0x47')](_0x2e046a);}})[_0x7ec4('0x25')](function(_0x3a60cd){if(_0x3a60cd){return _0x3a60cd?{'count':_0x543e16,'rows':_0x3a60cd}:null;}})[_0x7ec4('0x25')](respondWithResult(_0x1a85b5,null))['catch'](handleError(_0x1a85b5,null));};exports[_0x7ec4('0x4c')]=function(_0x3b6d1d,_0x4388ae,_0x6c22c5){if(_0x3b6d1d[_0x7ec4('0x45')]['id']){delete _0x3b6d1d['body']['id'];}return db[_0x7ec4('0x3c')]['findOne']({'where':{'id':_0x3b6d1d[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x4388ae,null))[_0x7ec4('0x25')](function(_0x2da46e){if(_0x2da46e){_0x3b6d1d[_0x7ec4('0x45')]['AccountId']=_0x2da46e['id'];_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x4d')]=integrations[_0x7ec4('0x4e')](_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x4f')],_0x3b6d1d['body']['type']);_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x50')]=integrations[_0x7ec4('0x51')](_0x3b6d1d[_0x7ec4('0x45')]['channel'],_0x3b6d1d[_0x7ec4('0x45')]['type']);return db[_0x7ec4('0x49')]['create'](_0x3b6d1d[_0x7ec4('0x45')],{'include':[{'model':db[_0x7ec4('0x52')],'as':_0x7ec4('0x4d')},{'model':db[_0x7ec4('0x52')],'as':_0x7ec4('0x50')}]});}return null;})[_0x7ec4('0x25')](respondWithResult(_0x4388ae,null))[_0x7ec4('0x3f')](handleError(_0x4388ae,null));};exports['getFields']=function(_0x587604,_0x358f1c,_0x171fcc){var _0x45b1ee=[_0x7ec4('0x53'),_0x7ec4('0x54'),_0x7ec4('0x55'),'subcategory',_0x7ec4('0x56'),_0x7ec4('0x57'),'incident_state',_0x7ec4('0x58'),_0x7ec4('0x59')];var _0x575d26=['parent',_0x7ec4('0x53'),_0x7ec4('0x5a'),_0x7ec4('0x5b'),_0x7ec4('0x5c'),_0x7ec4('0x5d'),_0x7ec4('0x5e'),_0x7ec4('0x54'),_0x7ec4('0x5f'),_0x7ec4('0x60'),_0x7ec4('0x61'),_0x7ec4('0x62'),_0x7ec4('0x63'),'user_input',_0x7ec4('0x64'),_0x7ec4('0x65'),_0x7ec4('0x66'),_0x7ec4('0x67'),_0x7ec4('0x55'),'order',_0x7ec4('0x68'),_0x7ec4('0x69'),_0x7ec4('0x6a'),_0x7ec4('0x6b'),_0x7ec4('0x6c'),_0x7ec4('0x6d'),_0x7ec4('0x6e'),'business_service','priority',_0x7ec4('0x6f'),_0x7ec4('0x70'),_0x7ec4('0x71'),'expected_start','opened_at',_0x7ec4('0x72'),_0x7ec4('0x73'),'work_end','reopened_time',_0x7ec4('0x74'),_0x7ec4('0x75'),_0x7ec4('0x76'),'subcategory','work_notes',_0x7ec4('0x77'),'close_code',_0x7ec4('0x78'),_0x7ec4('0x79'),_0x7ec4('0x7a'),_0x7ec4('0x7b'),'business_stc','additional_assignee_list',_0x7ec4('0x7c'),_0x7ec4('0x7d'),_0x7ec4('0x57'),_0x7ec4('0x7e'),_0x7ec4('0x7f'),'closed_by',_0x7ec4('0x80'),_0x7ec4('0x81'),_0x7ec4('0x82'),_0x7ec4('0x83'),'reopened_by','incident_state',_0x7ec4('0x84'),_0x7ec4('0x85'),_0x7ec4('0x86'),_0x7ec4('0x87'),_0x7ec4('0x88'),_0x7ec4('0x89'),'severity',_0x7ec4('0x8a'),_0x7ec4('0x8b'),_0x7ec4('0x8c'),_0x7ec4('0x8d'),'due_date',_0x7ec4('0x8e'),_0x7ec4('0x8f'),_0x7ec4('0x90'),_0x7ec4('0x91'),_0x7ec4('0x92'),_0x7ec4('0x93'),_0x7ec4('0x94'),_0x7ec4('0x59')];var _0x264ffb='';var _0x2722be='';var _0x42bb99=[];var _0x5deeb9='';var _0x372c2d='';var _0x405fdb=[];var _0x442ba0='';var _0x40055a='';var _0x4b6805={};var _0x36366f='';return db[_0x7ec4('0x3c')]['findOne']({'where':{'id':_0x587604[_0x7ec4('0x41')]['id']},'attributes':['id',_0x7ec4('0x95'),'password',_0x7ec4('0x96'),'remoteUri',_0x7ec4('0x97')]})['then'](handleEntityNotFound(_0x358f1c,null))[_0x7ec4('0x25')](function(_0x53f7df){if(_0x53f7df){_0x36366f=_0x53f7df[_0x7ec4('0x98')];var _0x471f8f=_0x36366f[_0x7ec4('0x99')](-0x1);if(_0x471f8f==='/'){_0x36366f=_0x36366f[_0x7ec4('0x9a')](0x0,_0x36366f[_0x7ec4('0x9b')](_0x471f8f));}_0x40055a=util[_0x7ec4('0x9c')](_0x7ec4('0x9d'),_0x36366f);_0x442ba0=util[_0x7ec4('0x9c')](_0x7ec4('0x9e'),_0x36366f);_0x4b6805={'user':_0x53f7df[_0x7ec4('0x95')],'pass':_0x53f7df[_0x7ec4('0x9f')]};var _0x3e3b0a={'method':'GET','uri':_0x40055a+_0x7ec4('0xa0'),'auth':_0x4b6805,'json':!![]};return rp(_0x3e3b0a);}})['then'](function(_0x5cb4c0){if(_0x5cb4c0[_0x7ec4('0xa1')]['length']>0x0){_0x264ffb=_0x5cb4c0['result'];}console[_0x7ec4('0xa2')](_0x7ec4('0xa3'),_0x264ffb);_0x405fdb=[];_0x2722be=Object['assign']([],_0x264ffb);_['remove'](_0x2722be,function(_0x1624ab){return!_0x45b1ee[_0x7ec4('0xa4')](_0x1624ab[_0x7ec4('0x27')]);});_0x2722be[_0x7ec4('0xa5')](function(_0x269e40){var _0x4cc738=createFieldObject(_0x442ba0,_0x4b6805,_0x269e40['internalType'],_0x269e40[_0x7ec4('0x27')],_0x269e40[_0x7ec4('0xa6')],![]);_0x405fdb[_0x7ec4('0xa7')](_0x4cc738);});return Promise[_0x7ec4('0xa8')](_0x405fdb);})['then'](function(_0x324e93){_0x42bb99=_0x324e93;_0x5deeb9=Object[_0x7ec4('0xa9')]([],_0x264ffb);console['log'](_0x7ec4('0xaa'),_0x264ffb);_['remove'](_0x5deeb9,function(_0x44b8be){return _0x575d26[_0x7ec4('0xa4')](_0x44b8be[_0x7ec4('0x27')]);});console[_0x7ec4('0xa2')](_0x7ec4('0xab'),_0x5deeb9);_0x405fdb=[];_0x5deeb9[_0x7ec4('0xa5')](function(_0x5cc278){var _0x26e513=createFieldObject(_0x442ba0,_0x4b6805,_0x5cc278['internalType'],_0x5cc278['name'],_0x5cc278['label'],!![]);_0x405fdb[_0x7ec4('0xa7')](_0x26e513);});return Promise[_0x7ec4('0xa8')](_0x405fdb);})[_0x7ec4('0x25')](function(_0x757f4c){_0x372c2d=_0x757f4c;var _0x1fa6f0=_0x42bb99[_0x7ec4('0xac')](_0x372c2d);return{'count':_0x1fa6f0[_0x7ec4('0x42')],'rows':_0x1fa6f0};})['then'](respondWithResult(_0x358f1c,null))['catch'](function(_0x3ea4e6){console[_0x7ec4('0xa2')](_0x7ec4('0xad')+_0x3ea4e6);var _0x44b68a=_0x587604[_0x7ec4('0x32')][_0x7ec4('0xae')]?0x1f4:_0x3ea4e6[_0x7ec4('0xaf')]||0x1f4;logger['error'](_0x3ea4e6[_0x7ec4('0xb0')]);delete _0x3ea4e6[_0x7ec4('0x27')];if(_0x44b68a===0x191){_0x44b68a=0x190;}_0x358f1c['status'](_0x44b68a)[_0x7ec4('0x28')](_0x587604[_0x7ec4('0x32')][_0x7ec4('0xae')]?{'message':_0x7ec4('0xb1'),'statusCode':_0x3ea4e6[_0x7ec4('0xaf')]}:_0x3ea4e6);});};function createFieldObject(_0x381dd1,_0x4b18b2,_0x3ee873,_0x2bef6b,_0x4ea6f0,_0x1831c3){return new Promise(function(_0x3a911b,_0xed4c84){var _0x29d3e3={'id':_0x2bef6b,'name':_0x4ea6f0,'custom':_0x1831c3};if(_0x3ee873==='boolean'){_0x29d3e3['options']=[{'name':_0x7ec4('0xb2'),'value':'true'},{'name':'False','value':_0x7ec4('0xb3')}];_0x3a911b(_0x29d3e3);}else{var _0x1bf95e={'method':_0x7ec4('0xb4'),'uri':_0x381dd1+'sys_choice?sysparm_query=name=incident^element='+_0x2bef6b,'auth':_0x4b18b2,'json':!![]};return rp(_0x1bf95e)[_0x7ec4('0x25')](function(_0x568806){var _0xd5a229=[];if(_0x568806['result'][_0x7ec4('0x42')]>0x0){_0x568806['result'][_0x7ec4('0xa5')](function(_0x56857a){if(_0x56857a[_0x7ec4('0xb5')]===_0x7ec4('0xb3')){var _0x32f106={'name':_0x56857a[_0x7ec4('0xa6')],'value':_0x56857a[_0x7ec4('0xb6')]};_0xd5a229[_0x7ec4('0xa7')](_0x32f106);}});}_0x29d3e3[_0x7ec4('0x3b')]=_0xd5a229;if(_0x29d3e3[_0x7ec4('0x3b')]['length']>0x0){_0x3a911b(_0x29d3e3);}else{if(_0x1831c3==![]){_0x3a911b();}else{_0x3a911b(_0x29d3e3);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0b718cf..361fc55 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x5496,0x175));var _0x6549=function(_0x4d2bae,_0x4e4263){_0x4d2bae=_0x4d2bae-0x0;var _0x44dd06=_0x5496[_0x4d2bae];return _0x44dd06;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x2385a5,_0x4dec8b){var _0x1de46f=function(_0x2ae199){while(--_0x2ae199){_0x2385a5['push'](_0x2385a5['shift']());}};_0x1de46f(++_0x4dec8b);}(_0xa630,0xbe));var _0x0a63=function(_0x44bff2,_0x176a27){_0x44bff2=_0x44bff2-0x0;var _0x1a7248=_0xa630[_0x44bff2];return _0x1a7248;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index acf3588..0c2c701 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 _0x1b9d=['rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','ShowServicenowAccount','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x258e78,_0x1b4e61){var _0x31e454=function(_0x46c7b2){while(--_0x46c7b2){_0x258e78['push'](_0x258e78['shift']());}};_0x31e454(++_0x1b4e61);}(_0x1b9d,0x103));var _0xd1b9=function(_0x5b2544,_0x10be79){_0x5b2544=_0x5b2544-0x0;var _0x289d42=_0x1b9d[_0x5b2544];return _0x289d42;};'use strict';var _=require('lodash');var util=require(_0xd1b9('0x0'));var moment=require(_0xd1b9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1b9('0x4'))(_0xd1b9('0x5'));var config=require(_0xd1b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd1b9('0x7')][_0xd1b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x418b31,_0x40d8f0,_0xf4d502){return new BPromise(function(_0x1ef001,_0x24281d){return client[_0xd1b9('0x9')](_0x418b31,_0xf4d502)[_0xd1b9('0xa')](function(_0x39d148){logger[_0xd1b9('0xb')](_0xd1b9('0xc'),_0x40d8f0,_0xd1b9('0xd'));logger[_0xd1b9('0xe')](_0xd1b9('0xf'),_0x40d8f0,_0xd1b9('0xd'),JSON[_0xd1b9('0x10')](_0x39d148));if(_0x39d148['error']){if(_0x39d148[_0xd1b9('0x11')][_0xd1b9('0x12')]===0x1f4){logger['error'](_0xd1b9('0xc'),_0x40d8f0,_0x39d148['error'][_0xd1b9('0x13')]);return _0x24281d(_0x39d148['error']['message']);}logger[_0xd1b9('0x11')](_0xd1b9('0xc'),_0x40d8f0,_0x39d148[_0xd1b9('0x11')][_0xd1b9('0x13')]);return _0x1ef001(_0x39d148['error'][_0xd1b9('0x13')]);}else{logger[_0xd1b9('0xb')](_0xd1b9('0xc'),_0x40d8f0,_0xd1b9('0xd'));_0x1ef001(_0x39d148[_0xd1b9('0x14')]['message']);}})[_0xd1b9('0x15')](function(_0x3624cd){logger[_0xd1b9('0x11')](_0xd1b9('0xc'),_0x40d8f0,_0x3624cd);_0x24281d(_0x3624cd);});});}exports[_0xd1b9('0x16')]=function(_0x535d28){var _0x40957e=this;return new Promise(function(_0x55d7f3,_0x5c86cf){return db[_0xd1b9('0x17')][_0xd1b9('0x18')]({'raw':_0x535d28[_0xd1b9('0x19')]?_0x535d28[_0xd1b9('0x19')][_0xd1b9('0x1a')]===undefined?!![]:![]:!![],'where':_0x535d28[_0xd1b9('0x19')]?_0x535d28[_0xd1b9('0x19')][_0xd1b9('0x1b')]||null:null,'attributes':_0x535d28[_0xd1b9('0x19')]?_0x535d28[_0xd1b9('0x19')]['attributes']||null:null,'limit':_0x535d28[_0xd1b9('0x19')]?_0x535d28[_0xd1b9('0x19')]['limit']||null:null,'include':_0x535d28['options']?_0x535d28[_0xd1b9('0x19')][_0xd1b9('0x1c')]?_[_0xd1b9('0x1d')](_0x535d28[_0xd1b9('0x19')][_0xd1b9('0x1c')],function(_0x430b26){return{'model':db[_0x430b26[_0xd1b9('0x1e')]],'as':_0x430b26['as'],'attributes':_0x430b26[_0xd1b9('0x1f')],'include':_0x430b26[_0xd1b9('0x1c')]?_[_0xd1b9('0x1d')](_0x430b26[_0xd1b9('0x1c')],function(_0x3f36d9){return{'model':db[_0x3f36d9[_0xd1b9('0x1e')]],'as':_0x3f36d9['as'],'attributes':_0x3f36d9[_0xd1b9('0x1f')],'include':_0x3f36d9[_0xd1b9('0x1c')]?_[_0xd1b9('0x1d')](_0x3f36d9[_0xd1b9('0x1c')],function(_0x3acb01){return{'model':db[_0x3acb01['model']],'as':_0x3acb01['as'],'attributes':_0x3acb01[_0xd1b9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd1b9('0xa')](function(_0x12c2af){logger[_0xd1b9('0xb')](_0xd1b9('0x16'),_0x535d28);logger[_0xd1b9('0xe')](_0xd1b9('0x16'),_0x535d28,JSON['stringify'](_0x12c2af));_0x55d7f3(_0x12c2af);})['catch'](function(_0x340844){logger[_0xd1b9('0x11')](_0xd1b9('0x16'),_0x340844[_0xd1b9('0x13')],_0x535d28);_0x5c86cf(_0x40957e[_0xd1b9('0x11')](0x1f4,_0x340844[_0xd1b9('0x13')]));});});};exports[_0xd1b9('0x20')]=function(_0x210e02){var _0x14ae0e=this;return new Promise(function(_0x166f3f,_0x55b691){return db[_0xd1b9('0x17')]['find']({'raw':_0x210e02['options']?_0x210e02[_0xd1b9('0x19')][_0xd1b9('0x1a')]===undefined?!![]:![]:!![],'where':_0x210e02[_0xd1b9('0x19')]?_0x210e02[_0xd1b9('0x19')][_0xd1b9('0x1b')]||null:null,'attributes':_0x210e02[_0xd1b9('0x19')]?_0x210e02['options'][_0xd1b9('0x1f')]||null:null,'include':_0x210e02['options']?_0x210e02['options'][_0xd1b9('0x1c')]?_[_0xd1b9('0x1d')](_0x210e02[_0xd1b9('0x19')][_0xd1b9('0x1c')],function(_0x145159){return{'model':db[_0x145159[_0xd1b9('0x1e')]],'as':_0x145159['as'],'attributes':_0x145159[_0xd1b9('0x1f')],'include':_0x145159[_0xd1b9('0x1c')]?_[_0xd1b9('0x1d')](_0x145159['include'],function(_0x40ef96){return{'model':db[_0x40ef96[_0xd1b9('0x1e')]],'as':_0x40ef96['as'],'attributes':_0x40ef96[_0xd1b9('0x1f')],'include':_0x40ef96[_0xd1b9('0x1c')]?_['map'](_0x40ef96[_0xd1b9('0x1c')],function(_0x4b3907){return{'model':db[_0x4b3907[_0xd1b9('0x1e')]],'as':_0x4b3907['as'],'attributes':_0x4b3907['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1b9('0xa')](function(_0x3d4e09){logger[_0xd1b9('0xb')](_0xd1b9('0x20'),_0x210e02);logger[_0xd1b9('0xe')](_0xd1b9('0x20'),_0x210e02,JSON[_0xd1b9('0x10')](_0x3d4e09));_0x166f3f(_0x3d4e09);})[_0xd1b9('0x15')](function(_0x399f1f){logger[_0xd1b9('0x11')](_0xd1b9('0x20'),_0x399f1f['message'],_0x210e02);_0x55b691(_0x14ae0e[_0xd1b9('0x11')](0x1f4,_0x399f1f[_0xd1b9('0x13')]));});});}; \ No newline at end of file +var _0xee4b=['../../config/logger','../../config/environment','jayson/promise','http','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','GetServicenowAccount','find','model','then','ShowServicenowAccount','util','moment','bluebird','ioredis','../../config/utils'];(function(_0xec6119,_0x21d2dc){var _0x2ac416=function(_0x4caf78){while(--_0x4caf78){_0xec6119['push'](_0xec6119['shift']());}};_0x2ac416(++_0x21d2dc);}(_0xee4b,0x10b));var _0xbee4=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xee4b[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require('lodash');var util=require(_0xbee4('0x0'));var moment=require(_0xbee4('0x1'));var BPromise=require(_0xbee4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbee4('0x4'));var logger=require(_0xbee4('0x5'))('rpc');var config=require(_0xbee4('0x6'));var jayson=require(_0xbee4('0x7'));var client=jayson['client'][_0xbee4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1520ea,_0x1b492d,_0x4c4227){return new BPromise(function(_0x31b451,_0x441dfe){return client['request'](_0x1520ea,_0x4c4227)['then'](function(_0x4ae84a){logger['info'](_0xbee4('0x9'),_0x1b492d,'request\x20sent');logger[_0xbee4('0xa')](_0xbee4('0xb'),_0x1b492d,_0xbee4('0xc'),JSON[_0xbee4('0xd')](_0x4ae84a));if(_0x4ae84a[_0xbee4('0xe')]){if(_0x4ae84a[_0xbee4('0xe')][_0xbee4('0xf')]===0x1f4){logger['error'](_0xbee4('0x9'),_0x1b492d,_0x4ae84a[_0xbee4('0xe')][_0xbee4('0x10')]);return _0x441dfe(_0x4ae84a['error']['message']);}logger['error'](_0xbee4('0x9'),_0x1b492d,_0x4ae84a[_0xbee4('0xe')][_0xbee4('0x10')]);return _0x31b451(_0x4ae84a[_0xbee4('0xe')]['message']);}else{logger[_0xbee4('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1b492d,_0xbee4('0xc'));_0x31b451(_0x4ae84a[_0xbee4('0x12')][_0xbee4('0x10')]);}})[_0xbee4('0x13')](function(_0x1e1808){logger[_0xbee4('0xe')](_0xbee4('0x9'),_0x1b492d,_0x1e1808);_0x441dfe(_0x1e1808);});});}exports['GetServicenowAccount']=function(_0x2c8d23){var _0x160731=this;return new Promise(function(_0x2c3584,_0x290966){return db[_0xbee4('0x14')][_0xbee4('0x15')]({'raw':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x17')]===undefined?!![]:![]:!![],'where':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x18')]||null:null,'attributes':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x19')]||null:null,'limit':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x1a')]||null:null,'include':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x1b')]?_[_0xbee4('0x1c')](_0x2c8d23['options'][_0xbee4('0x1b')],function(_0x559730){return{'model':db[_0x559730['model']],'as':_0x559730['as'],'attributes':_0x559730[_0xbee4('0x19')],'include':_0x559730['include']?_[_0xbee4('0x1c')](_0x559730[_0xbee4('0x1b')],function(_0x5655b9){return{'model':db[_0x5655b9['model']],'as':_0x5655b9['as'],'attributes':_0x5655b9[_0xbee4('0x19')],'include':_0x5655b9[_0xbee4('0x1b')]?_[_0xbee4('0x1c')](_0x5655b9[_0xbee4('0x1b')],function(_0x578921){return{'model':db[_0x578921['model']],'as':_0x578921['as'],'attributes':_0x578921[_0xbee4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e0ab1){logger[_0xbee4('0x11')]('GetServicenowAccount',_0x2c8d23);logger[_0xbee4('0xa')](_0xbee4('0x1d'),_0x2c8d23,JSON['stringify'](_0x3e0ab1));_0x2c3584(_0x3e0ab1);})['catch'](function(_0x4152b7){logger['error'](_0xbee4('0x1d'),_0x4152b7[_0xbee4('0x10')],_0x2c8d23);_0x290966(_0x160731[_0xbee4('0xe')](0x1f4,_0x4152b7['message']));});});};exports['ShowServicenowAccount']=function(_0x186c01){var _0x5e678a=this;return new Promise(function(_0x105785,_0x2f76b8){return db[_0xbee4('0x14')][_0xbee4('0x1e')]({'raw':_0x186c01[_0xbee4('0x16')]?_0x186c01[_0xbee4('0x16')][_0xbee4('0x17')]===undefined?!![]:![]:!![],'where':_0x186c01['options']?_0x186c01[_0xbee4('0x16')]['where']||null:null,'attributes':_0x186c01[_0xbee4('0x16')]?_0x186c01['options'][_0xbee4('0x19')]||null:null,'include':_0x186c01[_0xbee4('0x16')]?_0x186c01[_0xbee4('0x16')]['include']?_[_0xbee4('0x1c')](_0x186c01[_0xbee4('0x16')][_0xbee4('0x1b')],function(_0x310316){return{'model':db[_0x310316[_0xbee4('0x1f')]],'as':_0x310316['as'],'attributes':_0x310316[_0xbee4('0x19')],'include':_0x310316['include']?_[_0xbee4('0x1c')](_0x310316[_0xbee4('0x1b')],function(_0x490d69){return{'model':db[_0x490d69[_0xbee4('0x1f')]],'as':_0x490d69['as'],'attributes':_0x490d69[_0xbee4('0x19')],'include':_0x490d69['include']?_[_0xbee4('0x1c')](_0x490d69[_0xbee4('0x1b')],function(_0x427370){return{'model':db[_0x427370['model']],'as':_0x427370['as'],'attributes':_0x427370['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee4('0x20')](function(_0x128b9f){logger[_0xbee4('0x11')](_0xbee4('0x21'),_0x186c01);logger['debug'](_0xbee4('0x21'),_0x186c01,JSON[_0xbee4('0xd')](_0x128b9f));_0x105785(_0x128b9f);})['catch'](function(_0x430003){logger[_0xbee4('0xe')](_0xbee4('0x21'),_0x430003[_0xbee4('0x10')],_0x186c01);_0x2f76b8(_0x5e678a[_0xbee4('0xe')](0x1f4,_0x430003[_0xbee4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5bdaebd..90810ed 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 _0x4314=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x4314,0xf2));var _0x4431=function(_0x13dc5d,_0x2f78d1){_0x13dc5d=_0x13dc5d-0x0;var _0x1590a2=_0x4314[_0x13dc5d];return _0x1590a2;};'use strict';var multer=require(_0x4431('0x0'));var util=require(_0x4431('0x1'));var path=require(_0x4431('0x2'));var timeout=require(_0x4431('0x3'));var express=require(_0x4431('0x4'));var router=express[_0x4431('0x5')]();var fs_extra=require(_0x4431('0x6'));var auth=require(_0x4431('0x7'));var interaction=require(_0x4431('0x8'));var config=require('../../config/environment');var controller=require(_0x4431('0x9'));router[_0x4431('0xa')]('/',auth[_0x4431('0xb')](),controller[_0x4431('0xc')]);router[_0x4431('0xa')](_0x4431('0xd'),auth[_0x4431('0xb')](),controller[_0x4431('0xe')]);router[_0x4431('0xa')](_0x4431('0xf'),auth[_0x4431('0xb')](),controller[_0x4431('0x10')]);router['get'](_0x4431('0x11'),auth[_0x4431('0xb')](),controller[_0x4431('0x12')]);router['get'](_0x4431('0x13'),auth['isAuthenticated'](),controller[_0x4431('0x14')]);router[_0x4431('0x15')]('/',auth['isAuthenticated'](),controller[_0x4431('0x16')]);router[_0x4431('0x17')](_0x4431('0xd'),auth[_0x4431('0xb')](),controller['update']);router['delete'](_0x4431('0xd'),auth[_0x4431('0xb')](),controller[_0x4431('0x18')]);module[_0x4431('0x19')]=router; \ No newline at end of file +var _0x4131=['isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','/:id','update','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller'];(function(_0xabdeb2,_0x3e6fb5){var _0x1c785a=function(_0x4c44ce){while(--_0x4c44ce){_0xabdeb2['push'](_0xabdeb2['shift']());}};_0x1c785a(++_0x3e6fb5);}(_0x4131,0xcb));var _0x1413=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x4131[_0x29c3b2];return _0x4b3aa7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1413('0x0'));var express=require(_0x1413('0x1'));var router=express['Router']();var fs_extra=require(_0x1413('0x2'));var auth=require(_0x1413('0x3'));var interaction=require(_0x1413('0x4'));var config=require('../../config/environment');var controller=require(_0x1413('0x5'));router['get']('/',auth[_0x1413('0x6')](),controller[_0x1413('0x7')]);router[_0x1413('0x8')]('/:id',auth[_0x1413('0x6')](),controller[_0x1413('0x9')]);router[_0x1413('0x8')](_0x1413('0xa'),auth[_0x1413('0x6')](),controller[_0x1413('0xb')]);router[_0x1413('0x8')](_0x1413('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1413('0x8')]('/:id/descriptions',auth[_0x1413('0x6')](),controller[_0x1413('0xd')]);router[_0x1413('0xe')]('/',auth['isAuthenticated'](),controller[_0x1413('0xf')]);router['put'](_0x1413('0x10'),auth[_0x1413('0x6')](),controller[_0x1413('0x11')]);router['delete']('/:id',auth[_0x1413('0x6')](),controller['destroy']);module[_0x1413('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0db87d5..b915d0d 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 _0x9834=['sequelize','exports','STRING'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x9834,0x171));var _0x4983=function(_0x1a0869,_0x4999d4){_0x1a0869=_0x1a0869-0x0;var _0x11fc8e=_0x9834[_0x1a0869];return _0x11fc8e;};'use strict';var Sequelize=require(_0x4983('0x0'));module[_0x4983('0x1')]={'name':{'type':Sequelize[_0x4983('0x2')]},'description':{'type':Sequelize[_0x4983('0x2')]}}; \ No newline at end of file +var _0x2f1a=['exports','STRING'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x2f1a,0x1c8));var _0xa2f1=function(_0x5d2343,_0x3bb026){_0x5d2343=_0x5d2343-0x0;var _0x5633aa=_0x2f1a[_0x5d2343];return _0x5633aa;};'use strict';var Sequelize=require('sequelize');module[_0xa2f1('0x0')]={'name':{'type':Sequelize[_0xa2f1('0x1')]},'description':{'type':Sequelize[_0xa2f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a99de9f..48a3ec4 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 _0x0972=['path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField','getSubjects','order','getDescriptions','rimraf','zip-dir','bluebird','mustache','util'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0x0972,0xe8));var _0x2097=function(_0xc1017a,_0x4e3dad){_0xc1017a=_0xc1017a-0x0;var _0x1e8aad=_0x0972[_0xc1017a];return _0x1e8aad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2097('0x2'));var Mustache=require(_0x2097('0x3'));var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2097('0xa'));var jsforce=require(_0x2097('0xb'));var deskjs=require(_0x2097('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2097('0xd'));var Papa=require('papaparse');var Redis=require(_0x2097('0xe'));var authService=require(_0x2097('0xf'));var qs=require(_0x2097('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2097('0x11'));var logger=require(_0x2097('0x12'))(_0x2097('0x13'));var utils=require('../../config/utils');var config=require(_0x2097('0x14'));var licenseUtil=require(_0x2097('0x15'));var db=require(_0x2097('0x16'))['db'];function respondWithStatusCode(_0x2d16b3,_0xb395d2){_0xb395d2=_0xb395d2||0xcc;return function(_0x3107c2){if(_0x3107c2){return _0x2d16b3[_0x2097('0x17')](_0xb395d2);}return _0x2d16b3[_0x2097('0x18')](_0xb395d2)[_0x2097('0x19')]();};}function respondWithResult(_0x25cee4,_0x4ea899){_0x4ea899=_0x4ea899||0xc8;return function(_0x54ef42){if(_0x54ef42){return _0x25cee4[_0x2097('0x18')](_0x4ea899)[_0x2097('0x1a')](_0x54ef42);}};}function respondWithFilteredResult(_0x416c53,_0x317221){return function(_0x548d23){if(_0x548d23){var _0x140085=typeof _0x317221[_0x2097('0x1b')]==='undefined'&&typeof _0x317221[_0x2097('0x1c')]===_0x2097('0x1d');var _0x4cf792=_0x548d23[_0x2097('0x1e')];var _0x5c4386=_0x140085?0x0:_0x317221[_0x2097('0x1b')];var _0x5eff7f=_0x140085?_0x548d23['count']:_0x317221[_0x2097('0x1b')]+_0x317221[_0x2097('0x1c')];var _0x1cc576;if(_0x5eff7f>=_0x4cf792){_0x5eff7f=_0x4cf792;_0x1cc576=0xc8;}else{_0x1cc576=0xce;}_0x416c53[_0x2097('0x18')](_0x1cc576);return _0x416c53[_0x2097('0x1f')](_0x2097('0x20'),_0x5c4386+'-'+_0x5eff7f+'/'+_0x4cf792)[_0x2097('0x1a')](_0x548d23);}return null;};}function patchUpdates(_0x475eb6){return function(_0x3e2af6){try{jsonpatch['apply'](_0x3e2af6,_0x475eb6,!![]);}catch(_0x4284a4){return BPromise['reject'](_0x4284a4);}return _0x3e2af6[_0x2097('0x21')]();};}function saveUpdates(_0x640566,_0x4f83e4){return function(_0x45f380){if(_0x45f380){return _0x45f380[_0x2097('0x22')](_0x640566)[_0x2097('0x23')](function(_0x1c94af){return _0x1c94af;});}return null;};}function removeEntity(_0x2b635f,_0x115a2d){return function(_0x5e373a){if(_0x5e373a){return _0x5e373a[_0x2097('0x24')]()[_0x2097('0x23')](function(){_0x2b635f[_0x2097('0x18')](0xcc)[_0x2097('0x19')]();});}};}function handleEntityNotFound(_0x184cb0,_0x4b5c76){return function(_0x11d29b){if(!_0x11d29b){_0x184cb0[_0x2097('0x17')](0x194);}return _0x11d29b;};}function handleError(_0x49a4df,_0x44cb90){_0x44cb90=_0x44cb90||0x1f4;return function(_0x37113a){logger[_0x2097('0x25')](_0x37113a['stack']);if(_0x37113a[_0x2097('0x26')]){delete _0x37113a[_0x2097('0x26')];}_0x49a4df[_0x2097('0x18')](_0x44cb90)[_0x2097('0x27')](_0x37113a);};}exports[_0x2097('0x28')]=function(_0x3b133f,_0x513d47){var _0x109359={},_0x227eab={},_0x43cc42={'count':0x0,'rows':[]};var _0x23bc59=_[_0x2097('0x29')](db[_0x2097('0x2a')][_0x2097('0x2b')],function(_0x105db3){return{'name':_0x105db3[_0x2097('0x2c')],'type':_0x105db3[_0x2097('0x2d')]['key']};});_0x227eab['model']=_[_0x2097('0x29')](_0x23bc59,_0x2097('0x26'));_0x227eab['query']=_[_0x2097('0x2e')](_0x3b133f[_0x2097('0x2f')]);_0x227eab[_0x2097('0x30')]=_[_0x2097('0x31')](_0x227eab[_0x2097('0x32')],_0x227eab[_0x2097('0x2f')]);_0x109359[_0x2097('0x33')]=_[_0x2097('0x31')](_0x227eab[_0x2097('0x32')],qs[_0x2097('0x34')](_0x3b133f[_0x2097('0x2f')][_0x2097('0x34')]));_0x109359['attributes']=_0x109359[_0x2097('0x33')][_0x2097('0x35')]?_0x109359[_0x2097('0x33')]:_0x227eab[_0x2097('0x32')];if(!_0x3b133f['query'][_0x2097('0x36')](_0x2097('0x37'))){_0x109359[_0x2097('0x1c')]=qs[_0x2097('0x1c')](_0x3b133f['query'][_0x2097('0x1c')]);_0x109359['offset']=qs['offset'](_0x3b133f[_0x2097('0x2f')][_0x2097('0x1b')]);}_0x109359['order']=qs[_0x2097('0x38')](_0x3b133f[_0x2097('0x2f')][_0x2097('0x38')]);_0x109359['where']=qs[_0x2097('0x30')](_[_0x2097('0x39')](_0x3b133f[_0x2097('0x2f')],_0x227eab[_0x2097('0x30')]),_0x23bc59);if(_0x3b133f['query'][_0x2097('0x3a')]){_0x109359[_0x2097('0x3b')]=_[_0x2097('0x3c')](_0x109359[_0x2097('0x3b')],{'$or':_[_0x2097('0x29')](_0x23bc59,function(_0x1f610e){if(_0x1f610e['type']!==_0x2097('0x3d')){var _0xfae024={};_0xfae024[_0x1f610e[_0x2097('0x26')]]={'$like':'%'+_0x3b133f[_0x2097('0x2f')][_0x2097('0x3a')]+'%'};return _0xfae024;}})});}_0x109359=_['merge']({},_0x109359,_0x3b133f[_0x2097('0x3e')]);var _0x115613={'where':_0x109359[_0x2097('0x3b')]};return db[_0x2097('0x2a')][_0x2097('0x1e')](_0x115613)[_0x2097('0x23')](function(_0x8b29b8){_0x43cc42[_0x2097('0x1e')]=_0x8b29b8;if(_0x3b133f[_0x2097('0x2f')]['includeAll']){_0x109359[_0x2097('0x3f')]=[{'all':!![]}];}return db[_0x2097('0x2a')][_0x2097('0x40')](_0x109359);})[_0x2097('0x23')](function(_0xb5f4d7){_0x43cc42[_0x2097('0x41')]=_0xb5f4d7;return _0x43cc42;})['then'](respondWithFilteredResult(_0x513d47,_0x109359))[_0x2097('0x42')](handleError(_0x513d47,null));};exports[_0x2097('0x43')]=function(_0x28ff38,_0x2ac3d1){var _0x3eadfe={'raw':![],'where':{'id':_0x28ff38[_0x2097('0x44')]['id']}},_0x342bca={};_0x342bca[_0x2097('0x32')]=_[_0x2097('0x2e')](db[_0x2097('0x2a')][_0x2097('0x2b')]);_0x342bca['query']=_[_0x2097('0x2e')](_0x28ff38[_0x2097('0x2f')]);_0x342bca[_0x2097('0x30')]=_[_0x2097('0x31')](_0x342bca[_0x2097('0x32')],_0x342bca['query']);_0x3eadfe['attributes']=_[_0x2097('0x31')](_0x342bca['model'],qs[_0x2097('0x34')](_0x28ff38['query'][_0x2097('0x34')]));_0x3eadfe[_0x2097('0x33')]=_0x3eadfe[_0x2097('0x33')][_0x2097('0x35')]?_0x3eadfe[_0x2097('0x33')]:_0x342bca['model'];if(_0x28ff38['query'][_0x2097('0x45')]){_0x3eadfe['include']=[{'all':!![]}];}_0x3eadfe=_[_0x2097('0x3c')]({},_0x3eadfe,_0x28ff38[_0x2097('0x3e')]);return db[_0x2097('0x2a')][_0x2097('0x46')](_0x3eadfe)[_0x2097('0x23')](handleEntityNotFound(_0x2ac3d1,null))[_0x2097('0x23')](respondWithResult(_0x2ac3d1,null))[_0x2097('0x42')](handleError(_0x2ac3d1,null));};exports[_0x2097('0x47')]=function(_0x49a951,_0x131925){return db[_0x2097('0x2a')][_0x2097('0x47')](_0x49a951[_0x2097('0x48')],{})['then'](respondWithResult(_0x131925,0xc9))[_0x2097('0x42')](handleError(_0x131925,null));};exports['update']=function(_0x41d4e3,_0x1d6ba5){if(_0x41d4e3[_0x2097('0x48')]['id']){delete _0x41d4e3[_0x2097('0x48')]['id'];}return db['ServicenowConfiguration'][_0x2097('0x46')]({'where':{'id':_0x41d4e3[_0x2097('0x44')]['id']}})[_0x2097('0x23')](handleEntityNotFound(_0x1d6ba5,null))[_0x2097('0x23')](saveUpdates(_0x41d4e3[_0x2097('0x48')],null))[_0x2097('0x23')](respondWithResult(_0x1d6ba5,null))[_0x2097('0x42')](handleError(_0x1d6ba5,null));};exports['destroy']=function(_0x44f688,_0x3ceac5){return db['ServicenowConfiguration'][_0x2097('0x46')]({'where':{'id':_0x44f688[_0x2097('0x44')]['id']}})[_0x2097('0x23')](handleEntityNotFound(_0x3ceac5,null))['then'](removeEntity(_0x3ceac5,null))['catch'](handleError(_0x3ceac5,null));};exports[_0x2097('0x49')]=function(_0x30eca3,_0x1f07c6,_0x145034){var _0x1e55e9={};var _0x392293={};var _0x5e1211;var _0x57960c;return db['ServicenowConfiguration'][_0x2097('0x4a')]({'where':{'id':_0x30eca3[_0x2097('0x44')]['id']}})[_0x2097('0x23')](handleEntityNotFound(_0x1f07c6,null))[_0x2097('0x23')](function(_0x409386){if(_0x409386){_0x5e1211=_0x409386;_0x392293[_0x2097('0x32')]=_[_0x2097('0x2e')](db[_0x2097('0x4b')][_0x2097('0x2b')]);_0x392293[_0x2097('0x2f')]=_['keys'](_0x30eca3[_0x2097('0x2f')]);_0x392293[_0x2097('0x30')]=_[_0x2097('0x31')](_0x392293[_0x2097('0x32')],_0x392293[_0x2097('0x2f')]);_0x1e55e9[_0x2097('0x33')]=_[_0x2097('0x31')](_0x392293[_0x2097('0x32')],qs['fields'](_0x30eca3[_0x2097('0x2f')][_0x2097('0x34')]));_0x1e55e9[_0x2097('0x33')]=_0x1e55e9['attributes'][_0x2097('0x35')]?_0x1e55e9['attributes']:_0x392293[_0x2097('0x32')];_0x1e55e9['order']=qs['sort'](_0x30eca3[_0x2097('0x2f')][_0x2097('0x38')]);_0x1e55e9['where']=qs['filters'](_[_0x2097('0x39')](_0x30eca3[_0x2097('0x2f')],_0x392293[_0x2097('0x30')]));if(_0x30eca3[_0x2097('0x2f')]['filter']){_0x1e55e9[_0x2097('0x3b')]=_['merge'](_0x1e55e9[_0x2097('0x3b')],{'$or':_[_0x2097('0x29')](_0x1e55e9[_0x2097('0x33')],function(_0x3f8b7e){var _0x198ffe={};_0x198ffe[_0x3f8b7e]={'$like':'%'+_0x30eca3[_0x2097('0x2f')][_0x2097('0x3a')]+'%'};return _0x198ffe;})});}_0x1e55e9=_[_0x2097('0x3c')]({},_0x1e55e9,_0x30eca3[_0x2097('0x3e')]);return _0x5e1211[_0x2097('0x49')](_0x1e55e9);}})['then'](function(_0x1dbc20){if(_0x1dbc20){_0x57960c=_0x1dbc20[_0x2097('0x35')];if(!_0x30eca3[_0x2097('0x2f')][_0x2097('0x36')](_0x2097('0x37'))){_0x1e55e9[_0x2097('0x1c')]=qs[_0x2097('0x1c')](_0x30eca3[_0x2097('0x2f')][_0x2097('0x1c')]);_0x1e55e9['offset']=qs[_0x2097('0x1b')](_0x30eca3['query'][_0x2097('0x1b')]);}return _0x5e1211[_0x2097('0x49')](_0x1e55e9);}})[_0x2097('0x23')](function(_0x46445e){if(_0x46445e){return _0x46445e?{'count':_0x57960c,'rows':_0x46445e}:null;}})[_0x2097('0x23')](respondWithResult(_0x1f07c6,null))[_0x2097('0x42')](handleError(_0x1f07c6,null));};exports[_0x2097('0x4c')]=function(_0x2859fe,_0x1d5fec,_0x28da6f){var _0xde64e4={};var _0x3a2f04={};var _0x6ff735;var _0xc5dc81;return db[_0x2097('0x2a')]['findOne']({'where':{'id':_0x2859fe['params']['id']}})[_0x2097('0x23')](handleEntityNotFound(_0x1d5fec,null))['then'](function(_0x5b8bce){if(_0x5b8bce){_0x6ff735=_0x5b8bce;_0x3a2f04[_0x2097('0x32')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x3a2f04[_0x2097('0x2f')]=_[_0x2097('0x2e')](_0x2859fe[_0x2097('0x2f')]);_0x3a2f04['filters']=_[_0x2097('0x31')](_0x3a2f04[_0x2097('0x32')],_0x3a2f04[_0x2097('0x2f')]);_0xde64e4['attributes']=_['intersection'](_0x3a2f04['model'],qs['fields'](_0x2859fe[_0x2097('0x2f')][_0x2097('0x34')]));_0xde64e4[_0x2097('0x33')]=_0xde64e4[_0x2097('0x33')][_0x2097('0x35')]?_0xde64e4['attributes']:_0x3a2f04['model'];_0xde64e4[_0x2097('0x4d')]=qs[_0x2097('0x38')](_0x2859fe[_0x2097('0x2f')]['sort']);_0xde64e4['where']=qs[_0x2097('0x30')](_['pick'](_0x2859fe[_0x2097('0x2f')],_0x3a2f04[_0x2097('0x30')]));if(_0x2859fe['query'][_0x2097('0x3a')]){_0xde64e4[_0x2097('0x3b')]=_['merge'](_0xde64e4[_0x2097('0x3b')],{'$or':_['map'](_0xde64e4[_0x2097('0x33')],function(_0x539f24){var _0xe63164={};_0xe63164[_0x539f24]={'$like':'%'+_0x2859fe[_0x2097('0x2f')][_0x2097('0x3a')]+'%'};return _0xe63164;})});}_0xde64e4=_['merge']({},_0xde64e4,_0x2859fe[_0x2097('0x3e')]);return _0x6ff735[_0x2097('0x4c')](_0xde64e4);}})[_0x2097('0x23')](function(_0x20bbc7){if(_0x20bbc7){_0xc5dc81=_0x20bbc7[_0x2097('0x35')];if(!_0x2859fe[_0x2097('0x2f')][_0x2097('0x36')]('nolimit')){_0xde64e4[_0x2097('0x1c')]=qs[_0x2097('0x1c')](_0x2859fe[_0x2097('0x2f')][_0x2097('0x1c')]);_0xde64e4[_0x2097('0x1b')]=qs[_0x2097('0x1b')](_0x2859fe[_0x2097('0x2f')]['offset']);}return _0x6ff735[_0x2097('0x4c')](_0xde64e4);}})['then'](function(_0x31506e){if(_0x31506e){return _0x31506e?{'count':_0xc5dc81,'rows':_0x31506e}:null;}})['then'](respondWithResult(_0x1d5fec,null))['catch'](handleError(_0x1d5fec,null));};exports['getDescriptions']=function(_0xeb291e,_0x41bb85,_0x2b4756){var _0x510faf={};var _0x2b1637={};var _0x18623a;var _0x558135;return db['ServicenowConfiguration'][_0x2097('0x4a')]({'where':{'id':_0xeb291e[_0x2097('0x44')]['id']}})[_0x2097('0x23')](handleEntityNotFound(_0x41bb85,null))[_0x2097('0x23')](function(_0x33ea24){if(_0x33ea24){_0x18623a=_0x33ea24;_0x2b1637['model']=_['keys'](db[_0x2097('0x4b')]['rawAttributes']);_0x2b1637[_0x2097('0x2f')]=_[_0x2097('0x2e')](_0xeb291e['query']);_0x2b1637[_0x2097('0x30')]=_['intersection'](_0x2b1637[_0x2097('0x32')],_0x2b1637[_0x2097('0x2f')]);_0x510faf['attributes']=_['intersection'](_0x2b1637[_0x2097('0x32')],qs[_0x2097('0x34')](_0xeb291e[_0x2097('0x2f')][_0x2097('0x34')]));_0x510faf[_0x2097('0x33')]=_0x510faf[_0x2097('0x33')]['length']?_0x510faf[_0x2097('0x33')]:_0x2b1637[_0x2097('0x32')];_0x510faf[_0x2097('0x4d')]=qs[_0x2097('0x38')](_0xeb291e[_0x2097('0x2f')][_0x2097('0x38')]);_0x510faf['where']=qs['filters'](_[_0x2097('0x39')](_0xeb291e[_0x2097('0x2f')],_0x2b1637['filters']));if(_0xeb291e[_0x2097('0x2f')][_0x2097('0x3a')]){_0x510faf[_0x2097('0x3b')]=_[_0x2097('0x3c')](_0x510faf[_0x2097('0x3b')],{'$or':_[_0x2097('0x29')](_0x510faf[_0x2097('0x33')],function(_0x22eeb4){var _0x74207f={};_0x74207f[_0x22eeb4]={'$like':'%'+_0xeb291e['query'][_0x2097('0x3a')]+'%'};return _0x74207f;})});}_0x510faf=_[_0x2097('0x3c')]({},_0x510faf,_0xeb291e[_0x2097('0x3e')]);return _0x18623a[_0x2097('0x4e')](_0x510faf);}})[_0x2097('0x23')](function(_0x105225){if(_0x105225){_0x558135=_0x105225[_0x2097('0x35')];if(!_0xeb291e[_0x2097('0x2f')]['hasOwnProperty']('nolimit')){_0x510faf[_0x2097('0x1c')]=qs[_0x2097('0x1c')](_0xeb291e['query']['limit']);_0x510faf[_0x2097('0x1b')]=qs['offset'](_0xeb291e['query'][_0x2097('0x1b')]);}return _0x18623a['getDescriptions'](_0x510faf);}})['then'](function(_0x1a8496){if(_0x1a8496){return _0x1a8496?{'count':_0x558135,'rows':_0x1a8496}:null;}})[_0x2097('0x23')](respondWithResult(_0x41bb85,null))['catch'](handleError(_0x41bb85,null));}; \ No newline at end of file +var _0x56f2=['filters','model','attributes','length','hasOwnProperty','nolimit','pick','filter','where','merge','options','count','includeAll','include','catch','params','intersection','fields','find','create','body','getFields','findOne','ServicenowField','sort','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','status','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x56f2,0x189));var _0x256f=function(_0x8f0d61,_0x3175c7){_0x8f0d61=_0x8f0d61-0x0;var _0xa10bda=_0x56f2[_0x8f0d61];return _0xa10bda;};'use strict';var emlformat=require(_0x256f('0x0'));var rimraf=require(_0x256f('0x1'));var zipdir=require(_0x256f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x256f('0x3'));var moment=require(_0x256f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x256f('0x5'));var util=require('util');var path=require(_0x256f('0x6'));var sox=require(_0x256f('0x7'));var csv=require('to-csv');var ejs=require(_0x256f('0x8'));var fs=require('fs');var fs_extra=require(_0x256f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x256f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x256f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x256f('0xc'));var qs=require(_0x256f('0xd'));var as=require(_0x256f('0xe'));var hardwareService=require(_0x256f('0xf'));var logger=require(_0x256f('0x10'))(_0x256f('0x11'));var utils=require(_0x256f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x256f('0x13'));var db=require(_0x256f('0x14'))['db'];function respondWithStatusCode(_0x252a06,_0x517b8b){_0x517b8b=_0x517b8b||0xcc;return function(_0x2611cb){if(_0x2611cb){return _0x252a06[_0x256f('0x15')](_0x517b8b);}return _0x252a06['status'](_0x517b8b)[_0x256f('0x16')]();};}function respondWithResult(_0xc0c4bc,_0xc61460){_0xc61460=_0xc61460||0xc8;return function(_0x31456){if(_0x31456){return _0xc0c4bc['status'](_0xc61460)['json'](_0x31456);}};}function respondWithFilteredResult(_0x5d0475,_0x8ce2ae){return function(_0x2466c2){if(_0x2466c2){var _0x455bab=typeof _0x8ce2ae[_0x256f('0x17')]===_0x256f('0x18')&&typeof _0x8ce2ae[_0x256f('0x19')]===_0x256f('0x18');var _0x48e574=_0x2466c2['count'];var _0x53a219=_0x455bab?0x0:_0x8ce2ae['offset'];var _0x544fe9=_0x455bab?_0x2466c2['count']:_0x8ce2ae['offset']+_0x8ce2ae['limit'];var _0x2f60ba;if(_0x544fe9>=_0x48e574){_0x544fe9=_0x48e574;_0x2f60ba=0xc8;}else{_0x2f60ba=0xce;}_0x5d0475['status'](_0x2f60ba);return _0x5d0475['set'](_0x256f('0x1a'),_0x53a219+'-'+_0x544fe9+'/'+_0x48e574)['json'](_0x2466c2);}return null;};}function patchUpdates(_0x4988eb){return function(_0x8b54c7){try{jsonpatch[_0x256f('0x1b')](_0x8b54c7,_0x4988eb,!![]);}catch(_0x23359a){return BPromise[_0x256f('0x1c')](_0x23359a);}return _0x8b54c7['save']();};}function saveUpdates(_0x4d046c,_0x1a9243){return function(_0x3926ea){if(_0x3926ea){return _0x3926ea[_0x256f('0x1d')](_0x4d046c)[_0x256f('0x1e')](function(_0x20833d){return _0x20833d;});}return null;};}function removeEntity(_0x1f9d7f,_0x3631db){return function(_0x156a44){if(_0x156a44){return _0x156a44[_0x256f('0x1f')]()[_0x256f('0x1e')](function(){_0x1f9d7f[_0x256f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255130,_0x3a749b){return function(_0xb3d3){if(!_0xb3d3){_0x255130['sendStatus'](0x194);}return _0xb3d3;};}function handleError(_0x2d1349,_0x4bcdb8){_0x4bcdb8=_0x4bcdb8||0x1f4;return function(_0x5d1703){logger['error'](_0x5d1703[_0x256f('0x21')]);if(_0x5d1703[_0x256f('0x22')]){delete _0x5d1703[_0x256f('0x22')];}_0x2d1349[_0x256f('0x20')](_0x4bcdb8)[_0x256f('0x23')](_0x5d1703);};}exports[_0x256f('0x24')]=function(_0x5cba83,_0x36d163){var _0x15fa1b={},_0x2c0604={},_0x2a572a={'count':0x0,'rows':[]};var _0x5b271d=_[_0x256f('0x25')](db[_0x256f('0x26')][_0x256f('0x27')],function(_0x1a1152){return{'name':_0x1a1152[_0x256f('0x28')],'type':_0x1a1152[_0x256f('0x29')][_0x256f('0x2a')]};});_0x2c0604['model']=_[_0x256f('0x25')](_0x5b271d,_0x256f('0x22'));_0x2c0604[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x5cba83[_0x256f('0x2b')]);_0x2c0604[_0x256f('0x2d')]=_['intersection'](_0x2c0604[_0x256f('0x2e')],_0x2c0604[_0x256f('0x2b')]);_0x15fa1b[_0x256f('0x2f')]=_['intersection'](_0x2c0604[_0x256f('0x2e')],qs['fields'](_0x5cba83['query']['fields']));_0x15fa1b[_0x256f('0x2f')]=_0x15fa1b[_0x256f('0x2f')][_0x256f('0x30')]?_0x15fa1b[_0x256f('0x2f')]:_0x2c0604[_0x256f('0x2e')];if(!_0x5cba83[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x15fa1b[_0x256f('0x19')]=qs['limit'](_0x5cba83[_0x256f('0x2b')][_0x256f('0x19')]);_0x15fa1b['offset']=qs[_0x256f('0x17')](_0x5cba83[_0x256f('0x2b')][_0x256f('0x17')]);}_0x15fa1b['order']=qs['sort'](_0x5cba83[_0x256f('0x2b')]['sort']);_0x15fa1b['where']=qs[_0x256f('0x2d')](_[_0x256f('0x33')](_0x5cba83[_0x256f('0x2b')],_0x2c0604['filters']),_0x5b271d);if(_0x5cba83['query'][_0x256f('0x34')]){_0x15fa1b[_0x256f('0x35')]=_[_0x256f('0x36')](_0x15fa1b['where'],{'$or':_['map'](_0x5b271d,function(_0x1c6cf1){if(_0x1c6cf1['type']!=='VIRTUAL'){var _0xf186b={};_0xf186b[_0x1c6cf1[_0x256f('0x22')]]={'$like':'%'+_0x5cba83['query']['filter']+'%'};return _0xf186b;}})});}_0x15fa1b=_['merge']({},_0x15fa1b,_0x5cba83[_0x256f('0x37')]);var _0x593563={'where':_0x15fa1b[_0x256f('0x35')]};return db[_0x256f('0x26')][_0x256f('0x38')](_0x593563)[_0x256f('0x1e')](function(_0x593d18){_0x2a572a['count']=_0x593d18;if(_0x5cba83['query'][_0x256f('0x39')]){_0x15fa1b[_0x256f('0x3a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x15fa1b);})[_0x256f('0x1e')](function(_0x4d49e1){_0x2a572a['rows']=_0x4d49e1;return _0x2a572a;})[_0x256f('0x1e')](respondWithFilteredResult(_0x36d163,_0x15fa1b))[_0x256f('0x3b')](handleError(_0x36d163,null));};exports['show']=function(_0x3848eb,_0x12dabe){var _0x3a21d8={'raw':![],'where':{'id':_0x3848eb[_0x256f('0x3c')]['id']}},_0x5f07ca={};_0x5f07ca[_0x256f('0x2e')]=_[_0x256f('0x2c')](db['ServicenowConfiguration'][_0x256f('0x27')]);_0x5f07ca[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x3848eb[_0x256f('0x2b')]);_0x5f07ca[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x5f07ca[_0x256f('0x2e')],_0x5f07ca['query']);_0x3a21d8[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x5f07ca[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3848eb['query']['fields']));_0x3a21d8[_0x256f('0x2f')]=_0x3a21d8['attributes'][_0x256f('0x30')]?_0x3a21d8[_0x256f('0x2f')]:_0x5f07ca[_0x256f('0x2e')];if(_0x3848eb[_0x256f('0x2b')]['includeAll']){_0x3a21d8['include']=[{'all':!![]}];}_0x3a21d8=_[_0x256f('0x36')]({},_0x3a21d8,_0x3848eb[_0x256f('0x37')]);return db[_0x256f('0x26')][_0x256f('0x3f')](_0x3a21d8)['then'](handleEntityNotFound(_0x12dabe,null))[_0x256f('0x1e')](respondWithResult(_0x12dabe,null))[_0x256f('0x3b')](handleError(_0x12dabe,null));};exports[_0x256f('0x40')]=function(_0x162faf,_0x235cba){return db[_0x256f('0x26')]['create'](_0x162faf[_0x256f('0x41')],{})[_0x256f('0x1e')](respondWithResult(_0x235cba,0xc9))['catch'](handleError(_0x235cba,null));};exports[_0x256f('0x1d')]=function(_0x21ae1a,_0xf164f4){if(_0x21ae1a[_0x256f('0x41')]['id']){delete _0x21ae1a['body']['id'];}return db[_0x256f('0x26')][_0x256f('0x3f')]({'where':{'id':_0x21ae1a[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0xf164f4,null))[_0x256f('0x1e')](saveUpdates(_0x21ae1a[_0x256f('0x41')],null))[_0x256f('0x1e')](respondWithResult(_0xf164f4,null))[_0x256f('0x3b')](handleError(_0xf164f4,null));};exports[_0x256f('0x1f')]=function(_0x1ec81e,_0x44ab01){return db[_0x256f('0x26')]['find']({'where':{'id':_0x1ec81e[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x44ab01,null))[_0x256f('0x1e')](removeEntity(_0x44ab01,null))[_0x256f('0x3b')](handleError(_0x44ab01,null));};exports[_0x256f('0x42')]=function(_0x3943ba,_0x30cbc0,_0x161f70){var _0x101cb3={};var _0x23758b={};var _0x21ea85;var _0x2cd53b;return db[_0x256f('0x26')][_0x256f('0x43')]({'where':{'id':_0x3943ba[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x30cbc0,null))[_0x256f('0x1e')](function(_0x38171d){if(_0x38171d){_0x21ea85=_0x38171d;_0x23758b[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x23758b['query']=_['keys'](_0x3943ba[_0x256f('0x2b')]);_0x23758b[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x23758b[_0x256f('0x2e')],_0x23758b[_0x256f('0x2b')]);_0x101cb3['attributes']=_['intersection'](_0x23758b[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3943ba['query']['fields']));_0x101cb3[_0x256f('0x2f')]=_0x101cb3[_0x256f('0x2f')][_0x256f('0x30')]?_0x101cb3[_0x256f('0x2f')]:_0x23758b[_0x256f('0x2e')];_0x101cb3['order']=qs[_0x256f('0x45')](_0x3943ba[_0x256f('0x2b')][_0x256f('0x45')]);_0x101cb3['where']=qs[_0x256f('0x2d')](_[_0x256f('0x33')](_0x3943ba[_0x256f('0x2b')],_0x23758b[_0x256f('0x2d')]));if(_0x3943ba[_0x256f('0x2b')]['filter']){_0x101cb3[_0x256f('0x35')]=_['merge'](_0x101cb3['where'],{'$or':_[_0x256f('0x25')](_0x101cb3[_0x256f('0x2f')],function(_0x5f1636){var _0x547aee={};_0x547aee[_0x5f1636]={'$like':'%'+_0x3943ba[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x547aee;})});}_0x101cb3=_[_0x256f('0x36')]({},_0x101cb3,_0x3943ba['options']);return _0x21ea85[_0x256f('0x42')](_0x101cb3);}})['then'](function(_0x1deca8){if(_0x1deca8){_0x2cd53b=_0x1deca8[_0x256f('0x30')];if(!_0x3943ba[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x101cb3[_0x256f('0x19')]=qs[_0x256f('0x19')](_0x3943ba[_0x256f('0x2b')][_0x256f('0x19')]);_0x101cb3['offset']=qs['offset'](_0x3943ba[_0x256f('0x2b')][_0x256f('0x17')]);}return _0x21ea85[_0x256f('0x42')](_0x101cb3);}})['then'](function(_0x1539b2){if(_0x1539b2){return _0x1539b2?{'count':_0x2cd53b,'rows':_0x1539b2}:null;}})[_0x256f('0x1e')](respondWithResult(_0x30cbc0,null))[_0x256f('0x3b')](handleError(_0x30cbc0,null));};exports[_0x256f('0x46')]=function(_0x56169e,_0x3bc764,_0x1ff38b){var _0x4c8609={};var _0x2ec2f5={};var _0x1c7cf1;var _0x4cd401;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x56169e[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x3bc764,null))[_0x256f('0x1e')](function(_0x9cda94){if(_0x9cda94){_0x1c7cf1=_0x9cda94;_0x2ec2f5[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x2ec2f5['query']=_[_0x256f('0x2c')](_0x56169e[_0x256f('0x2b')]);_0x2ec2f5[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x2ec2f5[_0x256f('0x2e')],_0x2ec2f5[_0x256f('0x2b')]);_0x4c8609[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x2ec2f5[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x56169e[_0x256f('0x2b')][_0x256f('0x3e')]));_0x4c8609['attributes']=_0x4c8609[_0x256f('0x2f')]['length']?_0x4c8609[_0x256f('0x2f')]:_0x2ec2f5['model'];_0x4c8609[_0x256f('0x47')]=qs[_0x256f('0x45')](_0x56169e['query'][_0x256f('0x45')]);_0x4c8609['where']=qs[_0x256f('0x2d')](_['pick'](_0x56169e[_0x256f('0x2b')],_0x2ec2f5[_0x256f('0x2d')]));if(_0x56169e['query'][_0x256f('0x34')]){_0x4c8609[_0x256f('0x35')]=_[_0x256f('0x36')](_0x4c8609[_0x256f('0x35')],{'$or':_[_0x256f('0x25')](_0x4c8609[_0x256f('0x2f')],function(_0x2c1f44){var _0x40d394={};_0x40d394[_0x2c1f44]={'$like':'%'+_0x56169e[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x40d394;})});}_0x4c8609=_['merge']({},_0x4c8609,_0x56169e[_0x256f('0x37')]);return _0x1c7cf1[_0x256f('0x46')](_0x4c8609);}})[_0x256f('0x1e')](function(_0x42fde9){if(_0x42fde9){_0x4cd401=_0x42fde9[_0x256f('0x30')];if(!_0x56169e[_0x256f('0x2b')]['hasOwnProperty']('nolimit')){_0x4c8609[_0x256f('0x19')]=qs[_0x256f('0x19')](_0x56169e[_0x256f('0x2b')][_0x256f('0x19')]);_0x4c8609['offset']=qs[_0x256f('0x17')](_0x56169e[_0x256f('0x2b')][_0x256f('0x17')]);}return _0x1c7cf1[_0x256f('0x46')](_0x4c8609);}})['then'](function(_0x186be9){if(_0x186be9){return _0x186be9?{'count':_0x4cd401,'rows':_0x186be9}:null;}})[_0x256f('0x1e')](respondWithResult(_0x3bc764,null))[_0x256f('0x3b')](handleError(_0x3bc764,null));};exports[_0x256f('0x48')]=function(_0x3aa8f8,_0x2cad1d,_0x20445d){var _0x21f206={};var _0x55a2a5={};var _0x453800;var _0xd91849;return db['ServicenowConfiguration'][_0x256f('0x43')]({'where':{'id':_0x3aa8f8[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x2cad1d,null))['then'](function(_0x1334ce){if(_0x1334ce){_0x453800=_0x1334ce;_0x55a2a5[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x55a2a5[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x3aa8f8['query']);_0x55a2a5[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x55a2a5[_0x256f('0x2e')],_0x55a2a5[_0x256f('0x2b')]);_0x21f206[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x55a2a5[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x3e')]));_0x21f206[_0x256f('0x2f')]=_0x21f206[_0x256f('0x2f')]['length']?_0x21f206['attributes']:_0x55a2a5[_0x256f('0x2e')];_0x21f206[_0x256f('0x47')]=qs[_0x256f('0x45')](_0x3aa8f8['query'][_0x256f('0x45')]);_0x21f206[_0x256f('0x35')]=qs[_0x256f('0x2d')](_['pick'](_0x3aa8f8[_0x256f('0x2b')],_0x55a2a5[_0x256f('0x2d')]));if(_0x3aa8f8[_0x256f('0x2b')]['filter']){_0x21f206[_0x256f('0x35')]=_[_0x256f('0x36')](_0x21f206[_0x256f('0x35')],{'$or':_[_0x256f('0x25')](_0x21f206['attributes'],function(_0x232557){var _0x3715a2={};_0x3715a2[_0x232557]={'$like':'%'+_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x3715a2;})});}_0x21f206=_[_0x256f('0x36')]({},_0x21f206,_0x3aa8f8['options']);return _0x453800[_0x256f('0x48')](_0x21f206);}})[_0x256f('0x1e')](function(_0x3be6a1){if(_0x3be6a1){_0xd91849=_0x3be6a1[_0x256f('0x30')];if(!_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x21f206[_0x256f('0x19')]=qs['limit'](_0x3aa8f8[_0x256f('0x2b')]['limit']);_0x21f206[_0x256f('0x17')]=qs[_0x256f('0x17')](_0x3aa8f8['query'][_0x256f('0x17')]);}return _0x453800[_0x256f('0x48')](_0x21f206);}})[_0x256f('0x1e')](function(_0x3dac6b){if(_0x3dac6b){return _0x3dac6b?{'count':_0xd91849,'rows':_0x3dac6b}:null;}})[_0x256f('0x1e')](respondWithResult(_0x2cad1d,null))[_0x256f('0x3b')](handleError(_0x2cad1d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0c42dac..64f3c66 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x55257d,_0x3998ec){var _0x4d296d=function(_0x522f05){while(--_0x522f05){_0x55257d['push'](_0x55257d['shift']());}};_0x4d296d(++_0x3998ec);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ae8b5,_0x2a2cb6){_0x2ae8b5=_0x2ae8b5-0x0;var _0x29def1=_0xb10b[_0x2ae8b5];return _0x29def1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2f=['int_servicenow_configurations','lodash','util','bluebird','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6f2f[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf6f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x3'));var config=require(_0xf6f2('0x4'));var attributes=require(_0xf6f2('0x5'));module['exports']=function(_0x5c540a,_0x1123bb){return _0x5c540a[_0xf6f2('0x6')](_0xf6f2('0x7'),attributes,{'tableName':_0xf6f2('0x8'),'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 64c72b4..59d6883 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 _0x54ea=['jayson/promise','http','request','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x3e40d2,_0x117937){var _0x1b7c06=function(_0x15504c){while(--_0x15504c){_0x3e40d2['push'](_0x3e40d2['shift']());}};_0x1b7c06(++_0x117937);}(_0x54ea,0x80));var _0xa54e=function(_0x500d0b,_0xb3e47e){_0x500d0b=_0x500d0b-0x0;var _0x35bd23=_0x54ea[_0x500d0b];return _0x35bd23;};'use strict';var _=require(_0xa54e('0x0'));var util=require(_0xa54e('0x1'));var moment=require(_0xa54e('0x2'));var BPromise=require(_0xa54e('0x3'));var rs=require(_0xa54e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa54e('0x5'));var logger=require('../../config/logger')(_0xa54e('0x6'));var config=require('../../config/environment');var jayson=require(_0xa54e('0x7'));var client=jayson['client'][_0xa54e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a6f9c,_0x44956a,_0x355883){return new BPromise(function(_0x4899e1,_0x2f7a47){return client[_0xa54e('0x9')](_0x4a6f9c,_0x355883)['then'](function(_0x22af85){logger['info'](_0xa54e('0xa'),_0x44956a,'request\x20sent');logger['debug'](_0xa54e('0xb'),_0x44956a,_0xa54e('0xc'),JSON['stringify'](_0x22af85));if(_0x22af85[_0xa54e('0xd')]){if(_0x22af85['error']['code']===0x1f4){logger['error'](_0xa54e('0xa'),_0x44956a,_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);return _0x2f7a47(_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);}logger[_0xa54e('0xd')](_0xa54e('0xa'),_0x44956a,_0x22af85[_0xa54e('0xd')]['message']);return _0x4899e1(_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);}else{logger['info'](_0xa54e('0xa'),_0x44956a,_0xa54e('0xc'));_0x4899e1(_0x22af85['result'][_0xa54e('0xe')]);}})['catch'](function(_0x59c901){logger[_0xa54e('0xd')](_0xa54e('0xa'),_0x44956a,_0x59c901);_0x2f7a47(_0x59c901);});});} \ No newline at end of file +var _0x544f=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x399505,_0x8b6f35){var _0x1ad2d0=function(_0x3de0){while(--_0x3de0){_0x399505['push'](_0x399505['shift']());}};_0x1ad2d0(++_0x8b6f35);}(_0x544f,0x104));var _0xf544=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x544f[_0x211632];return _0x5a1da1;};'use strict';var _=require('lodash');var util=require(_0xf544('0x0'));var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf544('0x4'));var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef09f,_0x56bc50,_0x12824a){return new BPromise(function(_0x17dd2b,_0x13cbea){return client['request'](_0x5ef09f,_0x12824a)[_0xf544('0x9')](function(_0x1a5ac3){logger[_0xf544('0xa')](_0xf544('0xb'),_0x56bc50,_0xf544('0xc'));logger[_0xf544('0xd')](_0xf544('0xe'),_0x56bc50,_0xf544('0xc'),JSON[_0xf544('0xf')](_0x1a5ac3));if(_0x1a5ac3[_0xf544('0x10')]){if(_0x1a5ac3[_0xf544('0x10')][_0xf544('0x11')]===0x1f4){logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x1a5ac3[_0xf544('0x10')][_0xf544('0x12')]);return _0x13cbea(_0x1a5ac3[_0xf544('0x10')][_0xf544('0x12')]);}logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x1a5ac3[_0xf544('0x10')]['message']);return _0x17dd2b(_0x1a5ac3['error'][_0xf544('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x56bc50,_0xf544('0xc'));_0x17dd2b(_0x1a5ac3[_0xf544('0x13')]['message']);}})[_0xf544('0x14')](function(_0x438b93){logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x438b93);_0x13cbea(_0x438b93);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0c0f96a..33abd9f 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 _0x9b0f=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0x9b0f,0x14b));var _0xf9b0=function(_0x59d8d0,_0x11d4a2){_0x59d8d0=_0x59d8d0-0x0;var _0xb812a3=_0x9b0f[_0x59d8d0];return _0xb812a3;};'use strict';var multer=require(_0xf9b0('0x0'));var util=require(_0xf9b0('0x1'));var path=require(_0xf9b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf9b0('0x3'));var router=express[_0xf9b0('0x4')]();var fs_extra=require(_0xf9b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf9b0('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xf9b0('0x7')]('/',auth[_0xf9b0('0x8')](),controller[_0xf9b0('0x9')]);router[_0xf9b0('0x7')](_0xf9b0('0xa'),auth[_0xf9b0('0x8')](),controller['show']);router[_0xf9b0('0xb')]('/',auth[_0xf9b0('0x8')](),controller['create']);router[_0xf9b0('0xc')]('/:id',auth[_0xf9b0('0x8')](),controller['update']);router[_0xf9b0('0xd')](_0xf9b0('0xa'),auth[_0xf9b0('0x8')](),controller[_0xf9b0('0xe')]);module[_0xf9b0('0xf')]=router; \ No newline at end of file +var _0xaeac=['update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xaeac,0x1dd));var _0xcaea=function(_0x3dbc61,_0x4129f4){_0x3dbc61=_0x3dbc61-0x0;var _0x5578fb=_0xaeac[_0x3dbc61];return _0x5578fb;};'use strict';var multer=require(_0xcaea('0x0'));var util=require('util');var path=require(_0xcaea('0x1'));var timeout=require(_0xcaea('0x2'));var express=require(_0xcaea('0x3'));var router=express[_0xcaea('0x4')]();var fs_extra=require(_0xcaea('0x5'));var auth=require(_0xcaea('0x6'));var interaction=require(_0xcaea('0x7'));var config=require('../../config/environment');var controller=require(_0xcaea('0x8'));router['get']('/',auth[_0xcaea('0x9')](),controller[_0xcaea('0xa')]);router[_0xcaea('0xb')](_0xcaea('0xc'),auth[_0xcaea('0x9')](),controller[_0xcaea('0xd')]);router[_0xcaea('0xe')]('/',auth[_0xcaea('0x9')](),controller[_0xcaea('0xf')]);router[_0xcaea('0x10')]('/:id',auth[_0xcaea('0x9')](),controller[_0xcaea('0x11')]);router['delete'](_0xcaea('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcaea('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c94ee6a..4d72b96 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 _0x6beb=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING','string'];(function(_0x5700ff,_0x297928){var _0x221adf=function(_0x5e6e24){while(--_0x5e6e24){_0x5700ff['push'](_0x5700ff['shift']());}};_0x221adf(++_0x297928);}(_0x6beb,0xa9));var _0xb6be=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6beb[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xb6be('0x0'));module[_0xb6be('0x1')]={'type':{'type':Sequelize[_0xb6be('0x2')]('string','variable',_0xb6be('0x3'),_0xb6be('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb6be('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb6be('0x2')](_0xb6be('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb6be('0x5')]},'nameField':{'type':Sequelize[_0xb6be('0x5')]},'customField':{'type':Sequelize[_0xb6be('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6be('0x5')]}}; \ No newline at end of file +var _0x2906=['picklist','string','STRING','variable','sequelize','exports','ENUM','keyValue'];(function(_0x367885,_0x33be20){var _0x426e30=function(_0x526d3b){while(--_0x526d3b){_0x367885['push'](_0x367885['shift']());}};_0x426e30(++_0x33be20);}(_0x2906,0x124));var _0x6290=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0x2906[_0x31282b];return _0x19c632;};'use strict';var Sequelize=require(_0x6290('0x0'));module[_0x6290('0x1')]={'type':{'type':Sequelize[_0x6290('0x2')]('string','variable','customVariable',_0x6290('0x3'),_0x6290('0x4')),'defaultValue':_0x6290('0x5')},'content':{'type':Sequelize[_0x6290('0x6')]},'key':{'type':Sequelize[_0x6290('0x6')]},'keyType':{'type':Sequelize[_0x6290('0x2')](_0x6290('0x5'),_0x6290('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x6290('0x6')]},'idField':{'type':Sequelize[_0x6290('0x6')]},'nameField':{'type':Sequelize[_0x6290('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6290('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1ed7c99..15d884e 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 _0xdc27=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','map','ServicenowField','rawAttributes','fieldName','type','key','model','query'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdc27,0x66));var _0x7dc2=function(_0x36d00e,_0x5b4769){_0x36d00e=_0x36d00e-0x0;var _0x5603f8=_0xdc27[_0x36d00e];return _0x5603f8;};'use strict';var emlformat=require(_0x7dc2('0x0'));var rimraf=require(_0x7dc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc2('0x2'));var rp=require(_0x7dc2('0x3'));var moment=require(_0x7dc2('0x4'));var BPromise=require(_0x7dc2('0x5'));var Mustache=require(_0x7dc2('0x6'));var util=require(_0x7dc2('0x7'));var path=require(_0x7dc2('0x8'));var sox=require(_0x7dc2('0x9'));var csv=require('to-csv');var ejs=require(_0x7dc2('0xa'));var fs=require('fs');var fs_extra=require(_0x7dc2('0xb'));var _=require(_0x7dc2('0xc'));var squel=require('squel');var crypto=require(_0x7dc2('0xd'));var jsforce=require(_0x7dc2('0xe'));var deskjs=require(_0x7dc2('0xf'));var toCsv=require(_0x7dc2('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7dc2('0x11'));var authService=require(_0x7dc2('0x12'));var qs=require(_0x7dc2('0x13'));var as=require(_0x7dc2('0x14'));var hardwareService=require(_0x7dc2('0x15'));var logger=require(_0x7dc2('0x16'))(_0x7dc2('0x17'));var utils=require(_0x7dc2('0x18'));var config=require(_0x7dc2('0x19'));var licenseUtil=require(_0x7dc2('0x1a'));var db=require(_0x7dc2('0x1b'))['db'];function respondWithStatusCode(_0x29492b,_0x3d3fe5){_0x3d3fe5=_0x3d3fe5||0xcc;return function(_0xa3ab3){if(_0xa3ab3){return _0x29492b[_0x7dc2('0x1c')](_0x3d3fe5);}return _0x29492b[_0x7dc2('0x1d')](_0x3d3fe5)[_0x7dc2('0x1e')]();};}function respondWithResult(_0x255926,_0x310ea7){_0x310ea7=_0x310ea7||0xc8;return function(_0x10dd98){if(_0x10dd98){return _0x255926['status'](_0x310ea7)[_0x7dc2('0x1f')](_0x10dd98);}};}function respondWithFilteredResult(_0x1a11af,_0x18bd95){return function(_0x5ad100){if(_0x5ad100){var _0x377995=typeof _0x18bd95[_0x7dc2('0x20')]===_0x7dc2('0x21')&&typeof _0x18bd95['limit']===_0x7dc2('0x21');var _0x1bc18d=_0x5ad100[_0x7dc2('0x22')];var _0x27bea0=_0x377995?0x0:_0x18bd95[_0x7dc2('0x20')];var _0x1366dd=_0x377995?_0x5ad100[_0x7dc2('0x22')]:_0x18bd95[_0x7dc2('0x20')]+_0x18bd95['limit'];var _0x5291f9;if(_0x1366dd>=_0x1bc18d){_0x1366dd=_0x1bc18d;_0x5291f9=0xc8;}else{_0x5291f9=0xce;}_0x1a11af[_0x7dc2('0x1d')](_0x5291f9);return _0x1a11af[_0x7dc2('0x23')](_0x7dc2('0x24'),_0x27bea0+'-'+_0x1366dd+'/'+_0x1bc18d)[_0x7dc2('0x1f')](_0x5ad100);}return null;};}function patchUpdates(_0x3bc315){return function(_0x240eec){try{jsonpatch[_0x7dc2('0x25')](_0x240eec,_0x3bc315,!![]);}catch(_0x196167){return BPromise['reject'](_0x196167);}return _0x240eec[_0x7dc2('0x26')]();};}function saveUpdates(_0x436106,_0x3790d2){return function(_0xbe7c64){if(_0xbe7c64){return _0xbe7c64[_0x7dc2('0x27')](_0x436106)[_0x7dc2('0x28')](function(_0x55ee9e){return _0x55ee9e;});}return null;};}function removeEntity(_0x356bae,_0x59e4e2){return function(_0x59affb){if(_0x59affb){return _0x59affb[_0x7dc2('0x29')]()[_0x7dc2('0x28')](function(){_0x356bae[_0x7dc2('0x1d')](0xcc)[_0x7dc2('0x1e')]();});}};}function handleEntityNotFound(_0x2698ac,_0x2d45d5){return function(_0x52c871){if(!_0x52c871){_0x2698ac[_0x7dc2('0x1c')](0x194);}return _0x52c871;};}function handleError(_0x49fa16,_0x3326ee){_0x3326ee=_0x3326ee||0x1f4;return function(_0x207af9){logger['error'](_0x207af9[_0x7dc2('0x2a')]);if(_0x207af9['name']){delete _0x207af9[_0x7dc2('0x2b')];}_0x49fa16[_0x7dc2('0x1d')](_0x3326ee)['send'](_0x207af9);};}exports['index']=function(_0x3a8b78,_0x222c67){var _0x6f4119={},_0x3551b9={},_0x5f1e51={'count':0x0,'rows':[]};var _0x400aa3=_[_0x7dc2('0x2c')](db[_0x7dc2('0x2d')][_0x7dc2('0x2e')],function(_0x15dde0){return{'name':_0x15dde0[_0x7dc2('0x2f')],'type':_0x15dde0[_0x7dc2('0x30')][_0x7dc2('0x31')]};});_0x3551b9[_0x7dc2('0x32')]=_[_0x7dc2('0x2c')](_0x400aa3,'name');_0x3551b9[_0x7dc2('0x33')]=_[_0x7dc2('0x34')](_0x3a8b78[_0x7dc2('0x33')]);_0x3551b9[_0x7dc2('0x35')]=_[_0x7dc2('0x36')](_0x3551b9[_0x7dc2('0x32')],_0x3551b9[_0x7dc2('0x33')]);_0x6f4119[_0x7dc2('0x37')]=_[_0x7dc2('0x36')](_0x3551b9[_0x7dc2('0x32')],qs['fields'](_0x3a8b78[_0x7dc2('0x33')][_0x7dc2('0x38')]));_0x6f4119[_0x7dc2('0x37')]=_0x6f4119['attributes']['length']?_0x6f4119[_0x7dc2('0x37')]:_0x3551b9[_0x7dc2('0x32')];if(!_0x3a8b78['query'][_0x7dc2('0x39')](_0x7dc2('0x3a'))){_0x6f4119[_0x7dc2('0x3b')]=qs[_0x7dc2('0x3b')](_0x3a8b78['query']['limit']);_0x6f4119[_0x7dc2('0x20')]=qs['offset'](_0x3a8b78[_0x7dc2('0x33')][_0x7dc2('0x20')]);}_0x6f4119[_0x7dc2('0x3c')]=qs['sort'](_0x3a8b78[_0x7dc2('0x33')][_0x7dc2('0x3d')]);_0x6f4119[_0x7dc2('0x3e')]=qs[_0x7dc2('0x35')](_[_0x7dc2('0x3f')](_0x3a8b78[_0x7dc2('0x33')],_0x3551b9[_0x7dc2('0x35')]),_0x400aa3);if(_0x3a8b78['query'][_0x7dc2('0x40')]){_0x6f4119['where']=_['merge'](_0x6f4119[_0x7dc2('0x3e')],{'$or':_[_0x7dc2('0x2c')](_0x400aa3,function(_0x210684){if(_0x210684[_0x7dc2('0x30')]!==_0x7dc2('0x41')){var _0x19efe2={};_0x19efe2[_0x210684[_0x7dc2('0x2b')]]={'$like':'%'+_0x3a8b78[_0x7dc2('0x33')][_0x7dc2('0x40')]+'%'};return _0x19efe2;}})});}_0x6f4119=_[_0x7dc2('0x42')]({},_0x6f4119,_0x3a8b78[_0x7dc2('0x43')]);var _0x5583cd={'where':_0x6f4119[_0x7dc2('0x3e')]};return db[_0x7dc2('0x2d')][_0x7dc2('0x22')](_0x5583cd)['then'](function(_0x5e02ba){_0x5f1e51[_0x7dc2('0x22')]=_0x5e02ba;if(_0x3a8b78['query'][_0x7dc2('0x44')]){_0x6f4119[_0x7dc2('0x45')]=[{'all':!![]}];}return db[_0x7dc2('0x2d')][_0x7dc2('0x46')](_0x6f4119);})[_0x7dc2('0x28')](function(_0x3f4df6){_0x5f1e51['rows']=_0x3f4df6;return _0x5f1e51;})['then'](respondWithFilteredResult(_0x222c67,_0x6f4119))[_0x7dc2('0x47')](handleError(_0x222c67,null));};exports['show']=function(_0x347bb4,_0x2e04c6){var _0x4afbb1={'raw':!![],'where':{'id':_0x347bb4[_0x7dc2('0x48')]['id']}},_0x11c5ad={};_0x11c5ad['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x11c5ad[_0x7dc2('0x33')]=_[_0x7dc2('0x34')](_0x347bb4[_0x7dc2('0x33')]);_0x11c5ad['filters']=_[_0x7dc2('0x36')](_0x11c5ad['model'],_0x11c5ad[_0x7dc2('0x33')]);_0x4afbb1['attributes']=_[_0x7dc2('0x36')](_0x11c5ad['model'],qs[_0x7dc2('0x38')](_0x347bb4['query'][_0x7dc2('0x38')]));_0x4afbb1[_0x7dc2('0x37')]=_0x4afbb1[_0x7dc2('0x37')][_0x7dc2('0x49')]?_0x4afbb1[_0x7dc2('0x37')]:_0x11c5ad[_0x7dc2('0x32')];if(_0x347bb4[_0x7dc2('0x33')]['includeAll']){_0x4afbb1[_0x7dc2('0x45')]=[{'all':!![]}];}_0x4afbb1=_[_0x7dc2('0x42')]({},_0x4afbb1,_0x347bb4[_0x7dc2('0x43')]);return db[_0x7dc2('0x2d')][_0x7dc2('0x4a')](_0x4afbb1)[_0x7dc2('0x28')](handleEntityNotFound(_0x2e04c6,null))[_0x7dc2('0x28')](respondWithResult(_0x2e04c6,null))[_0x7dc2('0x47')](handleError(_0x2e04c6,null));};exports['create']=function(_0x487a38,_0x5a14eb){return db[_0x7dc2('0x2d')][_0x7dc2('0x4b')](_0x487a38[_0x7dc2('0x4c')],{})[_0x7dc2('0x28')](respondWithResult(_0x5a14eb,0xc9))[_0x7dc2('0x47')](handleError(_0x5a14eb,null));};exports[_0x7dc2('0x27')]=function(_0x50fd16,_0x364c2a){if(_0x50fd16['body']['id']){delete _0x50fd16['body']['id'];}return db[_0x7dc2('0x2d')]['find']({'where':{'id':_0x50fd16['params']['id']}})[_0x7dc2('0x28')](handleEntityNotFound(_0x364c2a,null))[_0x7dc2('0x28')](saveUpdates(_0x50fd16[_0x7dc2('0x4c')],null))[_0x7dc2('0x28')](respondWithResult(_0x364c2a,null))[_0x7dc2('0x47')](handleError(_0x364c2a,null));};exports[_0x7dc2('0x29')]=function(_0x20600f,_0x126a12){return db['ServicenowField']['find']({'where':{'id':_0x20600f['params']['id']}})['then'](handleEntityNotFound(_0x126a12,null))[_0x7dc2('0x28')](removeEntity(_0x126a12,null))['catch'](handleError(_0x126a12,null));}; \ No newline at end of file +var _0x7aec=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','destroy','find'];(function(_0x13437b,_0x1d0b36){var _0x49336e=function(_0x2ff46c){while(--_0x2ff46c){_0x13437b['push'](_0x13437b['shift']());}};_0x49336e(++_0x1d0b36);}(_0x7aec,0x1bc));var _0xc7ae=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7aec[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xc7ae('0x0'));var rimraf=require(_0xc7ae('0x1'));var zipdir=require(_0xc7ae('0x2'));var jsonpatch=require(_0xc7ae('0x3'));var rp=require(_0xc7ae('0x4'));var moment=require('moment');var BPromise=require(_0xc7ae('0x5'));var Mustache=require('mustache');var util=require(_0xc7ae('0x6'));var path=require(_0xc7ae('0x7'));var sox=require(_0xc7ae('0x8'));var csv=require(_0xc7ae('0x9'));var ejs=require(_0xc7ae('0xa'));var fs=require('fs');var fs_extra=require(_0xc7ae('0xb'));var _=require('lodash');var squel=require(_0xc7ae('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc7ae('0xd'));var toCsv=require(_0xc7ae('0x9'));var querystring=require(_0xc7ae('0xe'));var Papa=require('papaparse');var Redis=require(_0xc7ae('0xf'));var authService=require(_0xc7ae('0x10'));var qs=require(_0xc7ae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7ae('0x12'));var logger=require(_0xc7ae('0x13'))(_0xc7ae('0x14'));var utils=require(_0xc7ae('0x15'));var config=require(_0xc7ae('0x16'));var licenseUtil=require(_0xc7ae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fde94,_0x588a9b){_0x588a9b=_0x588a9b||0xcc;return function(_0x1d2fce){if(_0x1d2fce){return _0x2fde94[_0xc7ae('0x18')](_0x588a9b);}return _0x2fde94[_0xc7ae('0x19')](_0x588a9b)[_0xc7ae('0x1a')]();};}function respondWithResult(_0x3c91f5,_0x599e2f){_0x599e2f=_0x599e2f||0xc8;return function(_0x15b067){if(_0x15b067){return _0x3c91f5[_0xc7ae('0x19')](_0x599e2f)['json'](_0x15b067);}};}function respondWithFilteredResult(_0x183c01,_0x31a8bc){return function(_0x219c46){if(_0x219c46){var _0x36d871=typeof _0x31a8bc['offset']===_0xc7ae('0x1b')&&typeof _0x31a8bc[_0xc7ae('0x1c')]===_0xc7ae('0x1b');var _0x1be005=_0x219c46['count'];var _0x3926f2=_0x36d871?0x0:_0x31a8bc[_0xc7ae('0x1d')];var _0x2cf0de=_0x36d871?_0x219c46[_0xc7ae('0x1e')]:_0x31a8bc[_0xc7ae('0x1d')]+_0x31a8bc[_0xc7ae('0x1c')];var _0x508705;if(_0x2cf0de>=_0x1be005){_0x2cf0de=_0x1be005;_0x508705=0xc8;}else{_0x508705=0xce;}_0x183c01['status'](_0x508705);return _0x183c01['set'](_0xc7ae('0x1f'),_0x3926f2+'-'+_0x2cf0de+'/'+_0x1be005)[_0xc7ae('0x20')](_0x219c46);}return null;};}function patchUpdates(_0x5236a3){return function(_0x48a67a){try{jsonpatch[_0xc7ae('0x21')](_0x48a67a,_0x5236a3,!![]);}catch(_0xd5d598){return BPromise[_0xc7ae('0x22')](_0xd5d598);}return _0x48a67a[_0xc7ae('0x23')]();};}function saveUpdates(_0x4edfa6,_0x555f4a){return function(_0x1e09e0){if(_0x1e09e0){return _0x1e09e0[_0xc7ae('0x24')](_0x4edfa6)['then'](function(_0x6319be){return _0x6319be;});}return null;};}function removeEntity(_0x2bff8e,_0x22bbf9){return function(_0x301d73){if(_0x301d73){return _0x301d73['destroy']()[_0xc7ae('0x25')](function(){_0x2bff8e['status'](0xcc)[_0xc7ae('0x1a')]();});}};}function handleEntityNotFound(_0x2ff1c0,_0x204da0){return function(_0x148bc2){if(!_0x148bc2){_0x2ff1c0[_0xc7ae('0x18')](0x194);}return _0x148bc2;};}function handleError(_0x465937,_0x126696){_0x126696=_0x126696||0x1f4;return function(_0x5cbb90){logger['error'](_0x5cbb90['stack']);if(_0x5cbb90['name']){delete _0x5cbb90[_0xc7ae('0x26')];}_0x465937[_0xc7ae('0x19')](_0x126696)[_0xc7ae('0x27')](_0x5cbb90);};}exports[_0xc7ae('0x28')]=function(_0x5090b5,_0x1af74d){var _0x15caf2={},_0x2a5af6={},_0x1a4fa5={'count':0x0,'rows':[]};var _0xd06ece=_[_0xc7ae('0x29')](db[_0xc7ae('0x2a')][_0xc7ae('0x2b')],function(_0x17bce6){return{'name':_0x17bce6[_0xc7ae('0x2c')],'type':_0x17bce6[_0xc7ae('0x2d')][_0xc7ae('0x2e')]};});_0x2a5af6[_0xc7ae('0x2f')]=_[_0xc7ae('0x29')](_0xd06ece,_0xc7ae('0x26'));_0x2a5af6[_0xc7ae('0x30')]=_[_0xc7ae('0x31')](_0x5090b5['query']);_0x2a5af6[_0xc7ae('0x32')]=_['intersection'](_0x2a5af6[_0xc7ae('0x2f')],_0x2a5af6[_0xc7ae('0x30')]);_0x15caf2['attributes']=_['intersection'](_0x2a5af6['model'],qs[_0xc7ae('0x33')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x33')]));_0x15caf2[_0xc7ae('0x34')]=_0x15caf2[_0xc7ae('0x34')]['length']?_0x15caf2[_0xc7ae('0x34')]:_0x2a5af6[_0xc7ae('0x2f')];if(!_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x35')]('nolimit')){_0x15caf2[_0xc7ae('0x1c')]=qs[_0xc7ae('0x1c')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x1c')]);_0x15caf2[_0xc7ae('0x1d')]=qs[_0xc7ae('0x1d')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x1d')]);}_0x15caf2['order']=qs[_0xc7ae('0x36')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x36')]);_0x15caf2[_0xc7ae('0x37')]=qs['filters'](_[_0xc7ae('0x38')](_0x5090b5[_0xc7ae('0x30')],_0x2a5af6[_0xc7ae('0x32')]),_0xd06ece);if(_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x39')]){_0x15caf2[_0xc7ae('0x37')]=_['merge'](_0x15caf2[_0xc7ae('0x37')],{'$or':_[_0xc7ae('0x29')](_0xd06ece,function(_0x798003){if(_0x798003[_0xc7ae('0x2d')]!==_0xc7ae('0x3a')){var _0x5ae3e0={};_0x5ae3e0[_0x798003[_0xc7ae('0x26')]]={'$like':'%'+_0x5090b5['query'][_0xc7ae('0x39')]+'%'};return _0x5ae3e0;}})});}_0x15caf2=_[_0xc7ae('0x3b')]({},_0x15caf2,_0x5090b5[_0xc7ae('0x3c')]);var _0x57cf37={'where':_0x15caf2[_0xc7ae('0x37')]};return db['ServicenowField'][_0xc7ae('0x1e')](_0x57cf37)[_0xc7ae('0x25')](function(_0x137688){_0x1a4fa5[_0xc7ae('0x1e')]=_0x137688;if(_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x3d')]){_0x15caf2[_0xc7ae('0x3e')]=[{'all':!![]}];}return db[_0xc7ae('0x2a')][_0xc7ae('0x3f')](_0x15caf2);})[_0xc7ae('0x25')](function(_0xc016c0){_0x1a4fa5[_0xc7ae('0x40')]=_0xc016c0;return _0x1a4fa5;})['then'](respondWithFilteredResult(_0x1af74d,_0x15caf2))[_0xc7ae('0x41')](handleError(_0x1af74d,null));};exports[_0xc7ae('0x42')]=function(_0xebe2a9,_0x391734){var _0x4a328b={'raw':!![],'where':{'id':_0xebe2a9[_0xc7ae('0x43')]['id']}},_0x9ba3d5={};_0x9ba3d5['model']=_[_0xc7ae('0x31')](db[_0xc7ae('0x2a')][_0xc7ae('0x2b')]);_0x9ba3d5['query']=_['keys'](_0xebe2a9[_0xc7ae('0x30')]);_0x9ba3d5[_0xc7ae('0x32')]=_[_0xc7ae('0x44')](_0x9ba3d5[_0xc7ae('0x2f')],_0x9ba3d5[_0xc7ae('0x30')]);_0x4a328b['attributes']=_['intersection'](_0x9ba3d5[_0xc7ae('0x2f')],qs['fields'](_0xebe2a9[_0xc7ae('0x30')][_0xc7ae('0x33')]));_0x4a328b['attributes']=_0x4a328b[_0xc7ae('0x34')][_0xc7ae('0x45')]?_0x4a328b[_0xc7ae('0x34')]:_0x9ba3d5[_0xc7ae('0x2f')];if(_0xebe2a9[_0xc7ae('0x30')]['includeAll']){_0x4a328b[_0xc7ae('0x3e')]=[{'all':!![]}];}_0x4a328b=_[_0xc7ae('0x3b')]({},_0x4a328b,_0xebe2a9[_0xc7ae('0x3c')]);return db['ServicenowField']['find'](_0x4a328b)[_0xc7ae('0x25')](handleEntityNotFound(_0x391734,null))[_0xc7ae('0x25')](respondWithResult(_0x391734,null))[_0xc7ae('0x41')](handleError(_0x391734,null));};exports['create']=function(_0x4053b6,_0x1cf504){return db[_0xc7ae('0x2a')][_0xc7ae('0x46')](_0x4053b6[_0xc7ae('0x47')],{})[_0xc7ae('0x25')](respondWithResult(_0x1cf504,0xc9))[_0xc7ae('0x41')](handleError(_0x1cf504,null));};exports[_0xc7ae('0x24')]=function(_0x5dc4d9,_0x53ac85){if(_0x5dc4d9[_0xc7ae('0x47')]['id']){delete _0x5dc4d9[_0xc7ae('0x47')]['id'];}return db[_0xc7ae('0x2a')]['find']({'where':{'id':_0x5dc4d9['params']['id']}})[_0xc7ae('0x25')](handleEntityNotFound(_0x53ac85,null))[_0xc7ae('0x25')](saveUpdates(_0x5dc4d9[_0xc7ae('0x47')],null))[_0xc7ae('0x25')](respondWithResult(_0x53ac85,null))['catch'](handleError(_0x53ac85,null));};exports[_0xc7ae('0x48')]=function(_0x1ef5de,_0x34d4dc){return db['ServicenowField'][_0xc7ae('0x49')]({'where':{'id':_0x1ef5de['params']['id']}})[_0xc7ae('0x25')](handleEntityNotFound(_0x34d4dc,null))[_0xc7ae('0x25')](removeEntity(_0x34d4dc,null))[_0xc7ae('0x41')](handleError(_0x34d4dc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d772c22..8c8e1f1 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 _0x7518=['exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x20ad50,_0x4d0568){var _0x2fae36=function(_0x2995ed){while(--_0x2995ed){_0x20ad50['push'](_0x20ad50['shift']());}};_0x2fae36(++_0x4d0568);}(_0x7518,0x10a));var _0x8751=function(_0xd467d7,_0x2f13cd){_0xd467d7=_0xd467d7-0x0;var _0x23b23d=_0x7518[_0xd467d7];return _0x23b23d;};'use strict';var _=require(_0x8751('0x0'));var util=require(_0x8751('0x1'));var logger=require(_0x8751('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8751('0x3'));var rp=require(_0x8751('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8751('0x5'));var config=require('../../config/environment');var attributes=require(_0x8751('0x6'));module[_0x8751('0x7')]=function(_0x12a578,_0x4cf6db){return _0x12a578[_0x8751('0x8')](_0x8751('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x8751('0xa'),'fields':[_0x8751('0xb'),_0x8751('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2359=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x461c8b,_0xe50dc4){var _0x5e18e4=function(_0x343419){while(--_0x343419){_0x461c8b['push'](_0x461c8b['shift']());}};_0x5e18e4(++_0xe50dc4);}(_0x2359,0x1a2));var _0x9235=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2359[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x9235('0x0'));var logger=require(_0x9235('0x1'))(_0x9235('0x2'));var moment=require('moment');var BPromise=require(_0x9235('0x3'));var rp=require(_0x9235('0x4'));var fs=require('fs');var path=require(_0x9235('0x5'));var rimraf=require(_0x9235('0x6'));var config=require(_0x9235('0x7'));var attributes=require(_0x9235('0x8'));module[_0x9235('0x9')]=function(_0x3709d1,_0x54ebd5){return _0x3709d1[_0x9235('0xa')](_0x9235('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9235('0xc'),'fields':[_0x9235('0xd'),_0x9235('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 1da3caf..0b9cfaa 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xda3f,0xec));var _0xfda3=function(_0x54a4ba,_0x2f97e7){_0x54a4ba=_0x54a4ba-0x0;var _0x215837=_0xda3f[_0x54a4ba];return _0x215837;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0xd6a357,_0x3830f6){var _0x4f1ecc=function(_0x22e3fa){while(--_0x22e3fa){_0xd6a357['push'](_0xd6a357['shift']());}};_0x4f1ecc(++_0x3830f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xcb91[_0x580971];return _0x16d873;};'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')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 431756e..83e178b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x46c28c,_0x5ba431){var _0x23cbe3=function(_0x57998b){while(--_0x57998b){_0x46c28c['push'](_0x46c28c['shift']());}};_0x23cbe3(++_0x5ba431);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x53ff54,_0x110554){var _0x270f9a=function(_0x641425){while(--_0x641425){_0x53ff54['push'](_0x53ff54['shift']());}};_0x270f9a(++_0x110554);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b28b211..1b4e91e 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(_0x18f27c,_0x2f305f){var _0x1ad8e0=function(_0x4b7891){while(--_0x4b7891){_0x18f27c['push'](_0x18f27c['shift']());}};_0x1ad8e0(++_0x2f305f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0xf7dec8,_0x31721c){var _0xf08623=function(_0x50b931){while(--_0x50b931){_0xf7dec8['push'](_0xf7dec8['shift']());}};_0xf08623(++_0x31721c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 9b0f1f2..36be0e5 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 _0x24f5=['get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','Descriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired'];(function(_0x14a2dd,_0x63c12b){var _0xc24989=function(_0x5a038e){while(--_0x5a038e){_0x14a2dd['push'](_0x14a2dd['shift']());}};_0xc24989(++_0x63c12b);}(_0x24f5,0x104));var _0x524f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24f5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x524f('0x0'));var rimraf=require(_0x524f('0x1'));var zipdir=require(_0x524f('0x2'));var jsonpatch=require(_0x524f('0x3'));var rp=require(_0x524f('0x4'));var moment=require(_0x524f('0x5'));var BPromise=require(_0x524f('0x6'));var Mustache=require(_0x524f('0x7'));var util=require(_0x524f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x524f('0x9'));var ejs=require(_0x524f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x524f('0xb'));var squel=require(_0x524f('0xc'));var crypto=require(_0x524f('0xd'));var jsforce=require(_0x524f('0xe'));var deskjs=require(_0x524f('0xf'));var toCsv=require(_0x524f('0x9'));var querystring=require('querystring');var Papa=require(_0x524f('0x10'));var Redis=require(_0x524f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x524f('0x12'));var hardwareService=require(_0x524f('0x13'));var logger=require(_0x524f('0x14'))(_0x524f('0x15'));var utils=require(_0x524f('0x16'));var config=require(_0x524f('0x17'));var licenseUtil=require(_0x524f('0x18'));var db=require(_0x524f('0x19'))['db'];var integrations=require(_0x524f('0x1a'));function respondWithStatusCode(_0xf5d45c,_0x242c01){_0x242c01=_0x242c01||0xcc;return function(_0x3db058){if(_0x3db058){return _0xf5d45c[_0x524f('0x1b')](_0x242c01);}return _0xf5d45c[_0x524f('0x1c')](_0x242c01)[_0x524f('0x1d')]();};}function respondWithResult(_0x232db8,_0x573d1f){_0x573d1f=_0x573d1f||0xc8;return function(_0x2e9d52){if(_0x2e9d52){return _0x232db8[_0x524f('0x1c')](_0x573d1f)[_0x524f('0x1e')](_0x2e9d52);}};}function respondWithFilteredResult(_0x427ecd,_0x180e7e){return function(_0x27f4d7){if(_0x27f4d7){var _0x4c87f5=typeof _0x180e7e[_0x524f('0x1f')]===_0x524f('0x20')&&typeof _0x180e7e[_0x524f('0x21')]==='undefined';var _0x1cbffc=_0x27f4d7['count'];var _0xa5df29=_0x4c87f5?0x0:_0x180e7e[_0x524f('0x1f')];var _0x4626b8=_0x4c87f5?_0x27f4d7[_0x524f('0x22')]:_0x180e7e[_0x524f('0x1f')]+_0x180e7e[_0x524f('0x21')];var _0x10c805;if(_0x4626b8>=_0x1cbffc){_0x4626b8=_0x1cbffc;_0x10c805=0xc8;}else{_0x10c805=0xce;}_0x427ecd[_0x524f('0x1c')](_0x10c805);return _0x427ecd[_0x524f('0x23')](_0x524f('0x24'),_0xa5df29+'-'+_0x4626b8+'/'+_0x1cbffc)[_0x524f('0x1e')](_0x27f4d7);}return null;};}function patchUpdates(_0x65a5bc){return function(_0x1eed18){try{jsonpatch[_0x524f('0x25')](_0x1eed18,_0x65a5bc,!![]);}catch(_0x4c80a6){return BPromise['reject'](_0x4c80a6);}return _0x1eed18['save']();};}function saveUpdates(_0x2a0d10,_0x364fc6){return function(_0x251e93){if(_0x251e93){return _0x251e93[_0x524f('0x26')](_0x2a0d10)['then'](function(_0x416030){return _0x416030;});}return null;};}function removeEntity(_0x2400f6,_0xd573b6){return function(_0x1f307a){if(_0x1f307a){return _0x1f307a[_0x524f('0x27')]()[_0x524f('0x28')](function(){_0x2400f6['status'](0xcc)[_0x524f('0x1d')]();});}};}function handleEntityNotFound(_0x348aad,_0x638492){return function(_0x49ae96){if(!_0x49ae96){_0x348aad[_0x524f('0x1b')](0x194);}return _0x49ae96;};}function handleError(_0x3a1593,_0x254408){_0x254408=_0x254408||0x1f4;return function(_0x552b38){logger[_0x524f('0x29')](_0x552b38[_0x524f('0x2a')]);if(_0x552b38[_0x524f('0x2b')]){delete _0x552b38[_0x524f('0x2b')];}_0x3a1593[_0x524f('0x1c')](_0x254408)[_0x524f('0x2c')](_0x552b38);};}exports[_0x524f('0x2d')]=function(_0x4a5b72,_0x3e35ce){var _0x2c629a={},_0x362968={},_0x5bb1fd={'count':0x0,'rows':[]};var _0xe0053=_[_0x524f('0x2e')](db[_0x524f('0x2f')]['rawAttributes'],function(_0x14f452){return{'name':_0x14f452[_0x524f('0x30')],'type':_0x14f452[_0x524f('0x31')]['key']};});_0x362968[_0x524f('0x32')]=_[_0x524f('0x2e')](_0xe0053,_0x524f('0x2b'));_0x362968[_0x524f('0x33')]=_[_0x524f('0x34')](_0x4a5b72['query']);_0x362968[_0x524f('0x35')]=_[_0x524f('0x36')](_0x362968[_0x524f('0x32')],_0x362968[_0x524f('0x33')]);_0x2c629a[_0x524f('0x37')]=_[_0x524f('0x36')](_0x362968[_0x524f('0x32')],qs[_0x524f('0x38')](_0x4a5b72[_0x524f('0x33')][_0x524f('0x38')]));_0x2c629a[_0x524f('0x37')]=_0x2c629a[_0x524f('0x37')][_0x524f('0x39')]?_0x2c629a[_0x524f('0x37')]:_0x362968[_0x524f('0x32')];if(!_0x4a5b72[_0x524f('0x33')][_0x524f('0x3a')](_0x524f('0x3b'))){_0x2c629a[_0x524f('0x21')]=qs[_0x524f('0x21')](_0x4a5b72[_0x524f('0x33')]['limit']);_0x2c629a[_0x524f('0x1f')]=qs[_0x524f('0x1f')](_0x4a5b72['query'][_0x524f('0x1f')]);}_0x2c629a[_0x524f('0x3c')]=qs[_0x524f('0x3d')](_0x4a5b72[_0x524f('0x33')]['sort']);_0x2c629a[_0x524f('0x3e')]=qs['filters'](_[_0x524f('0x3f')](_0x4a5b72[_0x524f('0x33')],_0x362968[_0x524f('0x35')]),_0xe0053);if(_0x4a5b72[_0x524f('0x33')]['filter']){_0x2c629a[_0x524f('0x3e')]=_[_0x524f('0x40')](_0x2c629a['where'],{'$or':_['map'](_0xe0053,function(_0x3dbaf4){if(_0x3dbaf4[_0x524f('0x31')]!==_0x524f('0x41')){var _0x19c5d3={};_0x19c5d3[_0x3dbaf4[_0x524f('0x2b')]]={'$like':'%'+_0x4a5b72[_0x524f('0x33')][_0x524f('0x42')]+'%'};return _0x19c5d3;}})});}_0x2c629a=_[_0x524f('0x40')]({},_0x2c629a,_0x4a5b72[_0x524f('0x43')]);var _0x4cdd29={'where':_0x2c629a[_0x524f('0x3e')]};return db[_0x524f('0x2f')]['count'](_0x4cdd29)[_0x524f('0x28')](function(_0x3e3cd4){_0x5bb1fd['count']=_0x3e3cd4;if(_0x4a5b72['query']['includeAll']){_0x2c629a[_0x524f('0x44')]=[{'all':!![]}];}return db[_0x524f('0x2f')]['findAll'](_0x2c629a);})['then'](function(_0x365fa7){_0x5bb1fd[_0x524f('0x45')]=_0x365fa7;return _0x5bb1fd;})[_0x524f('0x28')](respondWithFilteredResult(_0x3e35ce,_0x2c629a))[_0x524f('0x46')](handleError(_0x3e35ce,null));};exports[_0x524f('0x47')]=function(_0x1e6b4f,_0x56e95f){var _0x2b11ba={'raw':![],'where':{'id':_0x1e6b4f[_0x524f('0x48')]['id']}},_0x5199a0={};_0x5199a0[_0x524f('0x32')]=_['keys'](db['SugarcrmAccount'][_0x524f('0x49')]);_0x5199a0[_0x524f('0x33')]=_[_0x524f('0x34')](_0x1e6b4f[_0x524f('0x33')]);_0x5199a0['filters']=_[_0x524f('0x36')](_0x5199a0[_0x524f('0x32')],_0x5199a0['query']);_0x2b11ba['attributes']=_[_0x524f('0x36')](_0x5199a0[_0x524f('0x32')],qs[_0x524f('0x38')](_0x1e6b4f[_0x524f('0x33')]['fields']));_0x2b11ba[_0x524f('0x37')]=_0x2b11ba[_0x524f('0x37')][_0x524f('0x39')]?_0x2b11ba[_0x524f('0x37')]:_0x5199a0[_0x524f('0x32')];if(_0x1e6b4f[_0x524f('0x33')][_0x524f('0x4a')]){_0x2b11ba['include']=[{'all':!![]}];}_0x2b11ba=_[_0x524f('0x40')]({},_0x2b11ba,_0x1e6b4f[_0x524f('0x43')]);return db['SugarcrmAccount'][_0x524f('0x4b')](_0x2b11ba)[_0x524f('0x28')](handleEntityNotFound(_0x56e95f,null))[_0x524f('0x28')](respondWithResult(_0x56e95f,null))[_0x524f('0x46')](handleError(_0x56e95f,null));};exports['create']=function(_0x1b94e1,_0x53e9c9){return db[_0x524f('0x2f')][_0x524f('0x4c')](_0x1b94e1[_0x524f('0x4d')],{})[_0x524f('0x28')](respondWithResult(_0x53e9c9,0xc9))['catch'](handleError(_0x53e9c9,null));};exports[_0x524f('0x26')]=function(_0x2c0207,_0x5a0174){if(_0x2c0207['body']['id']){delete _0x2c0207[_0x524f('0x4d')]['id'];}return db['SugarcrmAccount'][_0x524f('0x4b')]({'where':{'id':_0x2c0207[_0x524f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a0174,null))[_0x524f('0x28')](saveUpdates(_0x2c0207[_0x524f('0x4d')],null))[_0x524f('0x28')](respondWithResult(_0x5a0174,null))[_0x524f('0x46')](handleError(_0x5a0174,null));};exports[_0x524f('0x27')]=function(_0x5c0b22,_0x411ed7){return db[_0x524f('0x2f')]['find']({'where':{'id':_0x5c0b22['params']['id']}})[_0x524f('0x28')](handleEntityNotFound(_0x411ed7,null))[_0x524f('0x28')](removeEntity(_0x411ed7,null))['catch'](handleError(_0x411ed7,null));};exports[_0x524f('0x4e')]=function(_0x52673f,_0x4f47a3,_0x488e97){var _0xdc4722={};var _0x57e876={};var _0x4b2fd1;var _0x1c1a32;return db[_0x524f('0x2f')][_0x524f('0x4f')]({'where':{'id':_0x52673f[_0x524f('0x48')]['id']}})[_0x524f('0x28')](handleEntityNotFound(_0x4f47a3,null))[_0x524f('0x28')](function(_0x3047b0){if(_0x3047b0){_0x4b2fd1=_0x3047b0;_0x57e876[_0x524f('0x32')]=_[_0x524f('0x34')](db[_0x524f('0x50')]['rawAttributes']);_0x57e876[_0x524f('0x33')]=_[_0x524f('0x34')](_0x52673f[_0x524f('0x33')]);_0x57e876[_0x524f('0x35')]=_['intersection'](_0x57e876[_0x524f('0x32')],_0x57e876['query']);_0xdc4722[_0x524f('0x37')]=_[_0x524f('0x36')](_0x57e876[_0x524f('0x32')],qs[_0x524f('0x38')](_0x52673f[_0x524f('0x33')][_0x524f('0x38')]));_0xdc4722[_0x524f('0x37')]=_0xdc4722['attributes'][_0x524f('0x39')]?_0xdc4722['attributes']:_0x57e876[_0x524f('0x32')];_0xdc4722[_0x524f('0x3c')]=qs[_0x524f('0x3d')](_0x52673f['query'][_0x524f('0x3d')]);_0xdc4722[_0x524f('0x3e')]=qs[_0x524f('0x35')](_[_0x524f('0x3f')](_0x52673f['query'],_0x57e876['filters']));if(_0x52673f[_0x524f('0x33')][_0x524f('0x42')]){_0xdc4722[_0x524f('0x3e')]=_[_0x524f('0x40')](_0xdc4722[_0x524f('0x3e')],{'$or':_['map'](_0xdc4722[_0x524f('0x37')],function(_0x12cd44){var _0xf68470={};_0xf68470[_0x12cd44]={'$like':'%'+_0x52673f[_0x524f('0x33')]['filter']+'%'};return _0xf68470;})});}_0xdc4722=_[_0x524f('0x40')]({},_0xdc4722,_0x52673f['options']);return _0x4b2fd1['getConfigurations'](_0xdc4722);}})[_0x524f('0x28')](function(_0x2fe848){if(_0x2fe848){_0x1c1a32=_0x2fe848[_0x524f('0x39')];if(!_0x52673f['query'][_0x524f('0x3a')](_0x524f('0x3b'))){_0xdc4722[_0x524f('0x21')]=qs[_0x524f('0x21')](_0x52673f[_0x524f('0x33')][_0x524f('0x21')]);_0xdc4722[_0x524f('0x1f')]=qs[_0x524f('0x1f')](_0x52673f[_0x524f('0x33')][_0x524f('0x1f')]);}return _0x4b2fd1['getConfigurations'](_0xdc4722);}})[_0x524f('0x28')](function(_0x547a84){if(_0x547a84){return _0x547a84?{'count':_0x1c1a32,'rows':_0x547a84}:null;}})['then'](respondWithResult(_0x4f47a3,null))[_0x524f('0x46')](handleError(_0x4f47a3,null));};exports[_0x524f('0x51')]=function(_0x3055bf,_0xbd4b36,_0x37b379){if(_0x3055bf[_0x524f('0x4d')]['id']){delete _0x3055bf[_0x524f('0x4d')]['id'];}return db[_0x524f('0x2f')][_0x524f('0x4f')]({'where':{'id':_0x3055bf[_0x524f('0x48')]['id']}})[_0x524f('0x28')](handleEntityNotFound(_0xbd4b36,null))['then'](function(_0x1cf426){if(_0x1cf426){_0x3055bf[_0x524f('0x4d')][_0x524f('0x52')]=_0x1cf426['id'];_0x3055bf[_0x524f('0x4d')][_0x524f('0x53')]=integrations['getSubjects'](_0x3055bf[_0x524f('0x4d')]['channel'],_0x3055bf[_0x524f('0x4d')][_0x524f('0x31')]);_0x3055bf['body'][_0x524f('0x54')]=integrations['getDescriptions'](_0x3055bf['body'][_0x524f('0x55')],_0x3055bf[_0x524f('0x4d')][_0x524f('0x31')]);return db[_0x524f('0x50')]['create'](_0x3055bf['body'],{'include':[{'model':db[_0x524f('0x56')],'as':_0x524f('0x53')},{'model':db[_0x524f('0x56')],'as':_0x524f('0x54')}]});}return null;})[_0x524f('0x28')](respondWithResult(_0xbd4b36,null))[_0x524f('0x46')](handleError(_0xbd4b36,null));};exports[_0x524f('0x57')]=function(_0x5cb65e,_0x1ffbcc,_0xacd6e4){var _0x514a48='';var _0x3d985b=['id',_0x524f('0x2b'),'assigned_user_id',_0x524f('0x58'),_0x524f('0x59'),_0x524f('0x5a'),_0x524f('0x5b'),_0x524f('0x5c'),'parent_id',_0x524f('0x5d'),_0x524f('0x5e'),'direction'];return db[_0x524f('0x2f')][_0x524f('0x4f')]({'where':{'id':_0x5cb65e['params']['id']},'attributes':['id','username','password',_0x524f('0x5f')]})[_0x524f('0x28')](handleEntityNotFound(_0x1ffbcc,null))[_0x524f('0x28')](function(_0x47e449){if(_0x47e449){_0x514a48=_0x47e449[_0x524f('0x5f')];var _0x2892eb=_0x514a48[_0x524f('0x60')](-0x1);if(_0x2892eb==='/'){_0x514a48=_0x514a48[_0x524f('0x61')](0x0,_0x514a48[_0x524f('0x62')](_0x2892eb));}return rp({'method':_0x524f('0x63'),'uri':util[_0x524f('0x64')](_0x524f('0x65'),_0x514a48,_0x524f('0x66')),'json':!![],'form':{'method':_0x524f('0x67'),'input_type':_0x524f('0x68'),'response_type':_0x524f('0x68'),'rest_data':JSON[_0x524f('0x69')]({'user_auth':{'user_name':_0x47e449[_0x524f('0x6a')],'password':_0x47e449[_0x524f('0x6b')],'encryption':_0x524f('0x6c')},'application':_0x524f('0x6d')})}});}})[_0x524f('0x28')](function(_0x3df676){if(_0x3df676&&_0x3df676[_0x524f('0x2b')]!==_0x524f('0x6e')&&_0x3df676[_0x524f('0x2b')]!==_0x524f('0x6f')){return rp({'method':_0x524f('0x63'),'uri':util[_0x524f('0x64')](_0x524f('0x65'),_0x514a48,_0x524f('0x66')),'json':!![],'form':{'method':_0x524f('0x70'),'input_type':_0x524f('0x68'),'response_type':_0x524f('0x68'),'rest_data':JSON[_0x524f('0x69')]({'session':_0x3df676['id'],'module_name':'Calls'})}})[_0x524f('0x28')](function(_0x495367){if(_0x495367){var _0x4afc88=_[_0x524f('0x71')](_0x495367[_0x524f('0x72')]);_[_0x524f('0x73')](_0x4afc88,function(_0x344d66){return _0x3d985b[_0x524f('0x74')](_0x344d66[_0x524f('0x2b')]);});return{'count':_0x4afc88[_0x524f('0x39')],'rows':_['map'](_0x4afc88,function(_0x502d6f){return{'id':_0x502d6f[_0x524f('0x2b')],'name':_0x502d6f[_0x524f('0x75')],'custom':_[_0x524f('0x76')](_0x502d6f[_0x524f('0x2b')],'_c')?!![]:![],'options':_0x502d6f[_0x524f('0x43')]?_[_0x524f('0x2e')](_[_0x524f('0x71')](_0x502d6f['options']),function(_0x4fc1e7){return{'name':_0x4fc1e7[_0x524f('0x77')],'value':_0x4fc1e7[_0x524f('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0x1ffbcc,null))['catch'](function(_0x3f0458){var _0x3a2a1d=_0x5cb65e[_0x524f('0x33')][_0x524f('0x78')]?0x1f4:_0x3f0458[_0x524f('0x79')]||0x1f4;logger[_0x524f('0x29')](_0x524f('0x7a'),_0x524f('0x57'),_0x3a2a1d,JSON['stringify'](_0x3f0458));delete _0x3f0458[_0x524f('0x2b')];if(_0x3a2a1d===0x191){_0x3a2a1d=0x190;}_0x1ffbcc[_0x524f('0x1c')](_0x3a2a1d)[_0x524f('0x2c')](_0x5cb65e[_0x524f('0x33')]['test']?{'message':_0x524f('0x7b'),'statusCode':_0x3f0458[_0x524f('0x79')]}:_0x3f0458);});}else{var _0x107211=0x1f4;_0x1ffbcc[_0x524f('0x1c')](_0x107211)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x2b3d=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','body','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x28b52c,_0x21888a){var _0x2ab877=function(_0xa5b7d0){while(--_0xa5b7d0){_0x28b52c['push'](_0x28b52c['shift']());}};_0x2ab877(++_0x21888a);}(_0x2b3d,0x1dd));var _0xd2b3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b3d[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xd2b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2b3('0x1'));var jsonpatch=require(_0xd2b3('0x2'));var rp=require(_0xd2b3('0x3'));var moment=require(_0xd2b3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2b3('0x5'));var path=require(_0xd2b3('0x6'));var sox=require('sox');var csv=require(_0xd2b3('0x7'));var ejs=require(_0xd2b3('0x8'));var fs=require('fs');var fs_extra=require(_0xd2b3('0x9'));var _=require(_0xd2b3('0xa'));var squel=require('squel');var crypto=require(_0xd2b3('0xb'));var jsforce=require(_0xd2b3('0xc'));var deskjs=require(_0xd2b3('0xd'));var toCsv=require(_0xd2b3('0x7'));var querystring=require(_0xd2b3('0xe'));var Papa=require('papaparse');var Redis=require(_0xd2b3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd2b3('0x10'));var as=require(_0xd2b3('0x11'));var hardwareService=require(_0xd2b3('0x12'));var logger=require(_0xd2b3('0x13'))('api');var utils=require(_0xd2b3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd2b3('0x15'));var db=require(_0xd2b3('0x16'))['db'];var integrations=require(_0xd2b3('0x17'));function respondWithStatusCode(_0x2aa6b1,_0x5d26f5){_0x5d26f5=_0x5d26f5||0xcc;return function(_0x294b2d){if(_0x294b2d){return _0x2aa6b1[_0xd2b3('0x18')](_0x5d26f5);}return _0x2aa6b1[_0xd2b3('0x19')](_0x5d26f5)[_0xd2b3('0x1a')]();};}function respondWithResult(_0x2aba57,_0x229b71){_0x229b71=_0x229b71||0xc8;return function(_0x5a339d){if(_0x5a339d){return _0x2aba57[_0xd2b3('0x19')](_0x229b71)[_0xd2b3('0x1b')](_0x5a339d);}};}function respondWithFilteredResult(_0x591b3e,_0x17f110){return function(_0x233810){if(_0x233810){var _0x45f76d=typeof _0x17f110[_0xd2b3('0x1c')]===_0xd2b3('0x1d')&&typeof _0x17f110[_0xd2b3('0x1e')]===_0xd2b3('0x1d');var _0x31073f=_0x233810[_0xd2b3('0x1f')];var _0x197696=_0x45f76d?0x0:_0x17f110[_0xd2b3('0x1c')];var _0x5a4535=_0x45f76d?_0x233810[_0xd2b3('0x1f')]:_0x17f110['offset']+_0x17f110[_0xd2b3('0x1e')];var _0xc7c9d1;if(_0x5a4535>=_0x31073f){_0x5a4535=_0x31073f;_0xc7c9d1=0xc8;}else{_0xc7c9d1=0xce;}_0x591b3e[_0xd2b3('0x19')](_0xc7c9d1);return _0x591b3e[_0xd2b3('0x20')](_0xd2b3('0x21'),_0x197696+'-'+_0x5a4535+'/'+_0x31073f)[_0xd2b3('0x1b')](_0x233810);}return null;};}function patchUpdates(_0x4798d8){return function(_0x276e63){try{jsonpatch[_0xd2b3('0x22')](_0x276e63,_0x4798d8,!![]);}catch(_0x5861e5){return BPromise[_0xd2b3('0x23')](_0x5861e5);}return _0x276e63[_0xd2b3('0x24')]();};}function saveUpdates(_0x21501e,_0x7e9b37){return function(_0x2c738e){if(_0x2c738e){return _0x2c738e[_0xd2b3('0x25')](_0x21501e)[_0xd2b3('0x26')](function(_0x920082){return _0x920082;});}return null;};}function removeEntity(_0x6ef951,_0x418c97){return function(_0x383853){if(_0x383853){return _0x383853['destroy']()[_0xd2b3('0x26')](function(){_0x6ef951[_0xd2b3('0x19')](0xcc)[_0xd2b3('0x1a')]();});}};}function handleEntityNotFound(_0x104bc0,_0x49de7d){return function(_0x15855b){if(!_0x15855b){_0x104bc0[_0xd2b3('0x18')](0x194);}return _0x15855b;};}function handleError(_0x2f505f,_0x505ffd){_0x505ffd=_0x505ffd||0x1f4;return function(_0x757d07){logger[_0xd2b3('0x27')](_0x757d07[_0xd2b3('0x28')]);if(_0x757d07[_0xd2b3('0x29')]){delete _0x757d07[_0xd2b3('0x29')];}_0x2f505f['status'](_0x505ffd)[_0xd2b3('0x2a')](_0x757d07);};}exports[_0xd2b3('0x2b')]=function(_0x57388b,_0x4bddb9){var _0x17414c={},_0x574707={},_0x2141f5={'count':0x0,'rows':[]};var _0x5925a1=_[_0xd2b3('0x2c')](db[_0xd2b3('0x2d')][_0xd2b3('0x2e')],function(_0x569abf){return{'name':_0x569abf[_0xd2b3('0x2f')],'type':_0x569abf[_0xd2b3('0x30')][_0xd2b3('0x31')]};});_0x574707[_0xd2b3('0x32')]=_['map'](_0x5925a1,_0xd2b3('0x29'));_0x574707[_0xd2b3('0x33')]=_['keys'](_0x57388b[_0xd2b3('0x33')]);_0x574707[_0xd2b3('0x34')]=_['intersection'](_0x574707['model'],_0x574707['query']);_0x17414c['attributes']=_[_0xd2b3('0x35')](_0x574707[_0xd2b3('0x32')],qs['fields'](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x36')]));_0x17414c[_0xd2b3('0x37')]=_0x17414c[_0xd2b3('0x37')][_0xd2b3('0x38')]?_0x17414c[_0xd2b3('0x37')]:_0x574707[_0xd2b3('0x32')];if(!_0x57388b['query']['hasOwnProperty'](_0xd2b3('0x39'))){_0x17414c[_0xd2b3('0x1e')]=qs[_0xd2b3('0x1e')](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x1e')]);_0x17414c[_0xd2b3('0x1c')]=qs[_0xd2b3('0x1c')](_0x57388b['query']['offset']);}_0x17414c[_0xd2b3('0x3a')]=qs[_0xd2b3('0x3b')](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x3b')]);_0x17414c['where']=qs[_0xd2b3('0x34')](_[_0xd2b3('0x3c')](_0x57388b[_0xd2b3('0x33')],_0x574707[_0xd2b3('0x34')]),_0x5925a1);if(_0x57388b[_0xd2b3('0x33')]['filter']){_0x17414c[_0xd2b3('0x3d')]=_[_0xd2b3('0x3e')](_0x17414c[_0xd2b3('0x3d')],{'$or':_[_0xd2b3('0x2c')](_0x5925a1,function(_0x10a278){if(_0x10a278[_0xd2b3('0x30')]!==_0xd2b3('0x3f')){var _0x54faed={};_0x54faed[_0x10a278['name']]={'$like':'%'+_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x40')]+'%'};return _0x54faed;}})});}_0x17414c=_['merge']({},_0x17414c,_0x57388b[_0xd2b3('0x41')]);var _0x2add58={'where':_0x17414c[_0xd2b3('0x3d')]};return db[_0xd2b3('0x2d')][_0xd2b3('0x1f')](_0x2add58)['then'](function(_0x442101){_0x2141f5[_0xd2b3('0x1f')]=_0x442101;if(_0x57388b['query'][_0xd2b3('0x42')]){_0x17414c[_0xd2b3('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xd2b3('0x44')](_0x17414c);})[_0xd2b3('0x26')](function(_0xee1728){_0x2141f5[_0xd2b3('0x45')]=_0xee1728;return _0x2141f5;})[_0xd2b3('0x26')](respondWithFilteredResult(_0x4bddb9,_0x17414c))['catch'](handleError(_0x4bddb9,null));};exports[_0xd2b3('0x46')]=function(_0x373ca6,_0x6dcfb4){var _0x51c8cb={'raw':![],'where':{'id':_0x373ca6[_0xd2b3('0x47')]['id']}},_0x25ce80={};_0x25ce80[_0xd2b3('0x32')]=_[_0xd2b3('0x48')](db[_0xd2b3('0x2d')][_0xd2b3('0x2e')]);_0x25ce80[_0xd2b3('0x33')]=_[_0xd2b3('0x48')](_0x373ca6[_0xd2b3('0x33')]);_0x25ce80['filters']=_['intersection'](_0x25ce80['model'],_0x25ce80[_0xd2b3('0x33')]);_0x51c8cb[_0xd2b3('0x37')]=_['intersection'](_0x25ce80[_0xd2b3('0x32')],qs['fields'](_0x373ca6[_0xd2b3('0x33')][_0xd2b3('0x36')]));_0x51c8cb[_0xd2b3('0x37')]=_0x51c8cb[_0xd2b3('0x37')][_0xd2b3('0x38')]?_0x51c8cb['attributes']:_0x25ce80[_0xd2b3('0x32')];if(_0x373ca6[_0xd2b3('0x33')][_0xd2b3('0x42')]){_0x51c8cb[_0xd2b3('0x43')]=[{'all':!![]}];}_0x51c8cb=_[_0xd2b3('0x3e')]({},_0x51c8cb,_0x373ca6[_0xd2b3('0x41')]);return db[_0xd2b3('0x2d')][_0xd2b3('0x49')](_0x51c8cb)['then'](handleEntityNotFound(_0x6dcfb4,null))[_0xd2b3('0x26')](respondWithResult(_0x6dcfb4,null))[_0xd2b3('0x4a')](handleError(_0x6dcfb4,null));};exports[_0xd2b3('0x4b')]=function(_0xa6d063,_0x491c0b){return db[_0xd2b3('0x2d')][_0xd2b3('0x4b')](_0xa6d063['body'],{})[_0xd2b3('0x26')](respondWithResult(_0x491c0b,0xc9))[_0xd2b3('0x4a')](handleError(_0x491c0b,null));};exports[_0xd2b3('0x25')]=function(_0x4d8057,_0x4b2cde){if(_0x4d8057['body']['id']){delete _0x4d8057['body']['id'];}return db[_0xd2b3('0x2d')][_0xd2b3('0x49')]({'where':{'id':_0x4d8057[_0xd2b3('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b2cde,null))[_0xd2b3('0x26')](saveUpdates(_0x4d8057['body'],null))['then'](respondWithResult(_0x4b2cde,null))[_0xd2b3('0x4a')](handleError(_0x4b2cde,null));};exports[_0xd2b3('0x4c')]=function(_0x1fbd74,_0x4d2496){return db['SugarcrmAccount'][_0xd2b3('0x49')]({'where':{'id':_0x1fbd74[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x4d2496,null))[_0xd2b3('0x26')](removeEntity(_0x4d2496,null))['catch'](handleError(_0x4d2496,null));};exports[_0xd2b3('0x4d')]=function(_0x486926,_0x511ebb,_0x36be81){var _0x16f2d7={};var _0x358d0d={};var _0xb4523a;var _0x3237e3;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x486926[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x511ebb,null))['then'](function(_0x28550e){if(_0x28550e){_0xb4523a=_0x28550e;_0x358d0d[_0xd2b3('0x32')]=_[_0xd2b3('0x48')](db[_0xd2b3('0x4e')][_0xd2b3('0x2e')]);_0x358d0d[_0xd2b3('0x33')]=_[_0xd2b3('0x48')](_0x486926[_0xd2b3('0x33')]);_0x358d0d['filters']=_[_0xd2b3('0x35')](_0x358d0d[_0xd2b3('0x32')],_0x358d0d[_0xd2b3('0x33')]);_0x16f2d7[_0xd2b3('0x37')]=_[_0xd2b3('0x35')](_0x358d0d[_0xd2b3('0x32')],qs[_0xd2b3('0x36')](_0x486926[_0xd2b3('0x33')]['fields']));_0x16f2d7[_0xd2b3('0x37')]=_0x16f2d7['attributes'][_0xd2b3('0x38')]?_0x16f2d7[_0xd2b3('0x37')]:_0x358d0d['model'];_0x16f2d7['order']=qs['sort'](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x3b')]);_0x16f2d7[_0xd2b3('0x3d')]=qs[_0xd2b3('0x34')](_[_0xd2b3('0x3c')](_0x486926[_0xd2b3('0x33')],_0x358d0d[_0xd2b3('0x34')]));if(_0x486926[_0xd2b3('0x33')][_0xd2b3('0x40')]){_0x16f2d7[_0xd2b3('0x3d')]=_[_0xd2b3('0x3e')](_0x16f2d7['where'],{'$or':_[_0xd2b3('0x2c')](_0x16f2d7[_0xd2b3('0x37')],function(_0x3bd748){var _0x56a2e4={};_0x56a2e4[_0x3bd748]={'$like':'%'+_0x486926[_0xd2b3('0x33')][_0xd2b3('0x40')]+'%'};return _0x56a2e4;})});}_0x16f2d7=_[_0xd2b3('0x3e')]({},_0x16f2d7,_0x486926['options']);return _0xb4523a[_0xd2b3('0x4d')](_0x16f2d7);}})['then'](function(_0x356d3b){if(_0x356d3b){_0x3237e3=_0x356d3b['length'];if(!_0x486926[_0xd2b3('0x33')][_0xd2b3('0x4f')](_0xd2b3('0x39'))){_0x16f2d7[_0xd2b3('0x1e')]=qs[_0xd2b3('0x1e')](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x1e')]);_0x16f2d7[_0xd2b3('0x1c')]=qs[_0xd2b3('0x1c')](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x1c')]);}return _0xb4523a[_0xd2b3('0x4d')](_0x16f2d7);}})[_0xd2b3('0x26')](function(_0x7d145f){if(_0x7d145f){return _0x7d145f?{'count':_0x3237e3,'rows':_0x7d145f}:null;}})[_0xd2b3('0x26')](respondWithResult(_0x511ebb,null))[_0xd2b3('0x4a')](handleError(_0x511ebb,null));};exports[_0xd2b3('0x50')]=function(_0xb9c2ff,_0x7382ac,_0x36ae64){if(_0xb9c2ff[_0xd2b3('0x51')]['id']){delete _0xb9c2ff[_0xd2b3('0x51')]['id'];}return db[_0xd2b3('0x2d')][_0xd2b3('0x52')]({'where':{'id':_0xb9c2ff[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x7382ac,null))['then'](function(_0xa7e270){if(_0xa7e270){_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x53')]=_0xa7e270['id'];_0xb9c2ff['body'][_0xd2b3('0x54')]=integrations[_0xd2b3('0x55')](_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x56')],_0xb9c2ff[_0xd2b3('0x51')]['type']);_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x57')]=integrations[_0xd2b3('0x58')](_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x56')],_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x30')]);return db[_0xd2b3('0x4e')][_0xd2b3('0x4b')](_0xb9c2ff['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xd2b3('0x54')},{'model':db[_0xd2b3('0x59')],'as':_0xd2b3('0x57')}]});}return null;})['then'](respondWithResult(_0x7382ac,null))[_0xd2b3('0x4a')](handleError(_0x7382ac,null));};exports['getFields']=function(_0x4169c9,_0x3b60ad,_0x1eb572){var _0x5a8ce7='';var _0x215d79=['id',_0xd2b3('0x29'),_0xd2b3('0x5a'),_0xd2b3('0x5b'),'description',_0xd2b3('0x5c'),_0xd2b3('0x5d'),'duration_minutes','parent_id',_0xd2b3('0x5e'),_0xd2b3('0x5f'),_0xd2b3('0x60')];return db[_0xd2b3('0x2d')][_0xd2b3('0x52')]({'where':{'id':_0x4169c9['params']['id']},'attributes':['id',_0xd2b3('0x61'),_0xd2b3('0x62'),_0xd2b3('0x63')]})[_0xd2b3('0x26')](handleEntityNotFound(_0x3b60ad,null))[_0xd2b3('0x26')](function(_0x1068d1){if(_0x1068d1){_0x5a8ce7=_0x1068d1['remoteUri'];var _0x5c5d66=_0x5a8ce7[_0xd2b3('0x64')](-0x1);if(_0x5c5d66==='/'){_0x5a8ce7=_0x5a8ce7[_0xd2b3('0x65')](0x0,_0x5a8ce7[_0xd2b3('0x66')](_0x5c5d66));}return rp({'method':_0xd2b3('0x67'),'uri':util[_0xd2b3('0x68')](_0xd2b3('0x69'),_0x5a8ce7,_0xd2b3('0x6a')),'json':!![],'form':{'method':_0xd2b3('0x6b'),'input_type':_0xd2b3('0x6c'),'response_type':_0xd2b3('0x6c'),'rest_data':JSON[_0xd2b3('0x6d')]({'user_auth':{'user_name':_0x1068d1[_0xd2b3('0x61')],'password':_0x1068d1[_0xd2b3('0x62')],'encryption':_0xd2b3('0x6e')},'application':_0xd2b3('0x6f')})}});}})[_0xd2b3('0x26')](function(_0xed2e3c){if(_0xed2e3c&&_0xed2e3c['name']!==_0xd2b3('0x70')&&_0xed2e3c[_0xd2b3('0x29')]!==_0xd2b3('0x71')){return rp({'method':_0xd2b3('0x67'),'uri':util[_0xd2b3('0x68')](_0xd2b3('0x69'),_0x5a8ce7,_0xd2b3('0x6a')),'json':!![],'form':{'method':_0xd2b3('0x72'),'input_type':_0xd2b3('0x6c'),'response_type':'JSON','rest_data':JSON[_0xd2b3('0x6d')]({'session':_0xed2e3c['id'],'module_name':_0xd2b3('0x73')})}})['then'](function(_0x141f7d){if(_0x141f7d){var _0x5af229=_[_0xd2b3('0x74')](_0x141f7d[_0xd2b3('0x75')]);_[_0xd2b3('0x76')](_0x5af229,function(_0x314bae){return _0x215d79[_0xd2b3('0x77')](_0x314bae['name']);});return{'count':_0x5af229[_0xd2b3('0x38')],'rows':_[_0xd2b3('0x2c')](_0x5af229,function(_0x42abe8){return{'id':_0x42abe8[_0xd2b3('0x29')],'name':_0x42abe8['label'],'custom':_[_0xd2b3('0x78')](_0x42abe8[_0xd2b3('0x29')],'_c')?!![]:![],'options':_0x42abe8[_0xd2b3('0x41')]?_[_0xd2b3('0x2c')](_['values'](_0x42abe8['options']),function(_0x410438){return{'name':_0x410438[_0xd2b3('0x79')],'value':_0x410438[_0xd2b3('0x29')]};}):[]};})};}})[_0xd2b3('0x26')](respondWithResult(_0x3b60ad,null))['catch'](function(_0x371d8e){var _0x2bcf6c=_0x4169c9['query'][_0xd2b3('0x7a')]?0x1f4:_0x371d8e['statusCode']||0x1f4;logger[_0xd2b3('0x27')](_0xd2b3('0x7b'),_0xd2b3('0x7c'),_0x2bcf6c,JSON['stringify'](_0x371d8e));delete _0x371d8e[_0xd2b3('0x29')];if(_0x2bcf6c===0x191){_0x2bcf6c=0x190;}_0x3b60ad[_0xd2b3('0x19')](_0x2bcf6c)[_0xd2b3('0x2a')](_0x4169c9[_0xd2b3('0x33')][_0xd2b3('0x7a')]?{'message':_0xd2b3('0x7d'),'statusCode':_0x371d8e['statusCode']}:_0x371d8e);});}else{var _0x5e2104=0x1f4;_0x3b60ad[_0xd2b3('0x19')](_0x5e2104)[_0xd2b3('0x2a')]({'message':'Wrong\x20credentials','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 2094ecc..9bea431 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 _0xf108=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0xcc124d,_0x472460){var _0xc0a543=function(_0x459a13){while(--_0x459a13){_0xcc124d['push'](_0xcc124d['shift']());}};_0xc0a543(++_0x472460);}(_0xf108,0x1d9));var _0x8f10=function(_0x5b0131,_0xb7d6bf){_0x5b0131=_0x5b0131-0x0;var _0x49507b=_0xf108[_0x5b0131];return _0x49507b;};'use strict';var _=require(_0x8f10('0x0'));var util=require('util');var logger=require(_0x8f10('0x1'))(_0x8f10('0x2'));var moment=require(_0x8f10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f10('0x4'));var config=require(_0x8f10('0x5'));var attributes=require(_0x8f10('0x6'));var integrations=require(_0x8f10('0x7'));module[_0x8f10('0x8')]=function(_0x235737,_0x212efc){return _0x235737[_0x8f10('0x9')](_0x8f10('0xa'),attributes,{'tableName':_0x8f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43c=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2c8860,_0x2b953c){var _0x5cdd3a=function(_0xe8601c){while(--_0xe8601c){_0x2c8860['push'](_0x2c8860['shift']());}};_0x5cdd3a(++_0x2b953c);}(_0xb43c,0x1ea));var _0xcb43=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb43c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xcb43('0x0'));var util=require(_0xcb43('0x1'));var logger=require(_0xcb43('0x2'))(_0xcb43('0x3'));var moment=require(_0xcb43('0x4'));var BPromise=require(_0xcb43('0x5'));var rp=require(_0xcb43('0x6'));var fs=require('fs');var path=require(_0xcb43('0x7'));var rimraf=require(_0xcb43('0x8'));var config=require(_0xcb43('0x9'));var attributes=require(_0xcb43('0xa'));var integrations=require(_0xcb43('0xb'));module['exports']=function(_0x3a6dfe,_0x3d412d){return _0x3a6dfe[_0xcb43('0xc')](_0xcb43('0xd'),attributes,{'tableName':_0xcb43('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 13b2e92..a0dd22e 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 _0x9bdc=['limit','include','map','model','attributes','stringify','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0x3ddb6f,_0x254d4a){var _0x3d24a1=function(_0x492c18){while(--_0x492c18){_0x3ddb6f['push'](_0x3ddb6f['shift']());}};_0x3d24a1(++_0x254d4a);}(_0x9bdc,0x6b));var _0xc9bd=function(_0x5a0ac5,_0x139cbd){_0x5a0ac5=_0x5a0ac5-0x0;var _0x32d90c=_0x9bdc[_0x5a0ac5];return _0x32d90c;};'use strict';var _=require('lodash');var util=require(_0xc9bd('0x0'));var moment=require(_0xc9bd('0x1'));var BPromise=require(_0xc9bd('0x2'));var rs=require(_0xc9bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9bd('0x4'))['db'];var utils=require(_0xc9bd('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc9bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9bd('0x7')][_0xc9bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58d241,_0x4f21b7,_0x87f93c){return new BPromise(function(_0x26910e,_0x462b12){return client[_0xc9bd('0x9')](_0x58d241,_0x87f93c)[_0xc9bd('0xa')](function(_0x1a71a0){logger['info'](_0xc9bd('0xb'),_0x4f21b7,_0xc9bd('0xc'));logger[_0xc9bd('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4f21b7,'request\x20sent',JSON['stringify'](_0x1a71a0));if(_0x1a71a0[_0xc9bd('0xe')]){if(_0x1a71a0[_0xc9bd('0xe')]['code']===0x1f4){logger[_0xc9bd('0xe')](_0xc9bd('0xb'),_0x4f21b7,_0x1a71a0['error'][_0xc9bd('0xf')]);return _0x462b12(_0x1a71a0[_0xc9bd('0xe')][_0xc9bd('0xf')]);}logger['error'](_0xc9bd('0xb'),_0x4f21b7,_0x1a71a0['error']['message']);return _0x26910e(_0x1a71a0[_0xc9bd('0xe')][_0xc9bd('0xf')]);}else{logger[_0xc9bd('0x10')](_0xc9bd('0xb'),_0x4f21b7,_0xc9bd('0xc'));_0x26910e(_0x1a71a0[_0xc9bd('0x11')][_0xc9bd('0xf')]);}})[_0xc9bd('0x12')](function(_0x21822c){logger[_0xc9bd('0xe')](_0xc9bd('0xb'),_0x4f21b7,_0x21822c);_0x462b12(_0x21822c);});});}exports[_0xc9bd('0x13')]=function(_0x1f1422){var _0x4fbda1=this;return new Promise(function(_0x1a57b9,_0x513cea){return db[_0xc9bd('0x14')][_0xc9bd('0x15')]({'raw':_0x1f1422['options']?_0x1f1422[_0xc9bd('0x16')][_0xc9bd('0x17')]===undefined?!![]:![]:!![],'where':_0x1f1422[_0xc9bd('0x16')]?_0x1f1422[_0xc9bd('0x16')][_0xc9bd('0x18')]||null:null,'attributes':_0x1f1422[_0xc9bd('0x16')]?_0x1f1422[_0xc9bd('0x16')]['attributes']||null:null,'limit':_0x1f1422[_0xc9bd('0x16')]?_0x1f1422[_0xc9bd('0x16')][_0xc9bd('0x19')]||null:null,'include':_0x1f1422['options']?_0x1f1422['options'][_0xc9bd('0x1a')]?_[_0xc9bd('0x1b')](_0x1f1422[_0xc9bd('0x16')][_0xc9bd('0x1a')],function(_0x1748db){return{'model':db[_0x1748db[_0xc9bd('0x1c')]],'as':_0x1748db['as'],'attributes':_0x1748db[_0xc9bd('0x1d')],'include':_0x1748db['include']?_[_0xc9bd('0x1b')](_0x1748db[_0xc9bd('0x1a')],function(_0x349b2b){return{'model':db[_0x349b2b[_0xc9bd('0x1c')]],'as':_0x349b2b['as'],'attributes':_0x349b2b[_0xc9bd('0x1d')],'include':_0x349b2b[_0xc9bd('0x1a')]?_[_0xc9bd('0x1b')](_0x349b2b['include'],function(_0x5e26e7){return{'model':db[_0x5e26e7[_0xc9bd('0x1c')]],'as':_0x5e26e7['as'],'attributes':_0x5e26e7[_0xc9bd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39680d){logger[_0xc9bd('0x10')](_0xc9bd('0x13'),_0x1f1422);logger['debug']('GetSugarcrmAccount',_0x1f1422,JSON[_0xc9bd('0x1e')](_0x39680d));_0x1a57b9(_0x39680d);})['catch'](function(_0x4f860e){logger[_0xc9bd('0xe')]('GetSugarcrmAccount',_0x4f860e[_0xc9bd('0xf')],_0x1f1422);_0x513cea(_0x4fbda1[_0xc9bd('0xe')](0x1f4,_0x4f860e[_0xc9bd('0xf')]));});});};exports[_0xc9bd('0x1f')]=function(_0x3fa23f){var _0x2056cf=this;return new Promise(function(_0x26afe1,_0x569946){return db[_0xc9bd('0x14')][_0xc9bd('0x20')]({'raw':_0x3fa23f[_0xc9bd('0x16')]?_0x3fa23f[_0xc9bd('0x16')][_0xc9bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3fa23f[_0xc9bd('0x16')]?_0x3fa23f['options'][_0xc9bd('0x18')]||null:null,'attributes':_0x3fa23f['options']?_0x3fa23f[_0xc9bd('0x16')][_0xc9bd('0x1d')]||null:null,'include':_0x3fa23f[_0xc9bd('0x16')]?_0x3fa23f['options'][_0xc9bd('0x1a')]?_[_0xc9bd('0x1b')](_0x3fa23f[_0xc9bd('0x16')]['include'],function(_0x11b5c2){return{'model':db[_0x11b5c2[_0xc9bd('0x1c')]],'as':_0x11b5c2['as'],'attributes':_0x11b5c2[_0xc9bd('0x1d')],'include':_0x11b5c2[_0xc9bd('0x1a')]?_[_0xc9bd('0x1b')](_0x11b5c2[_0xc9bd('0x1a')],function(_0x1772dc){return{'model':db[_0x1772dc['model']],'as':_0x1772dc['as'],'attributes':_0x1772dc[_0xc9bd('0x1d')],'include':_0x1772dc['include']?_['map'](_0x1772dc[_0xc9bd('0x1a')],function(_0x3d8139){return{'model':db[_0x3d8139['model']],'as':_0x3d8139['as'],'attributes':_0x3d8139['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9bd('0xa')](function(_0x16d41d){logger['info'](_0xc9bd('0x1f'),_0x3fa23f);logger['debug'](_0xc9bd('0x1f'),_0x3fa23f,JSON['stringify'](_0x16d41d));_0x26afe1(_0x16d41d);})['catch'](function(_0x157ad3){logger[_0xc9bd('0xe')]('ShowSugarcrmAccount',_0x157ad3['message'],_0x3fa23f);_0x569946(_0x2056cf['error'](0x1f4,_0x157ad3[_0xc9bd('0xf')]));});});}; \ No newline at end of file +var _0xa21e=['error','code','message','SugarcrmAccount','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xa21e,0x1cd));var _0xea21=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xa21e[_0x305b20];return _0x26d64a;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var moment=require(_0xea21('0x2'));var BPromise=require(_0xea21('0x3'));var rs=require(_0xea21('0x4'));var fs=require('fs');var Redis=require(_0xea21('0x5'));var db=require(_0xea21('0x6'))['db'];var utils=require(_0xea21('0x7'));var logger=require(_0xea21('0x8'))(_0xea21('0x9'));var config=require(_0xea21('0xa'));var jayson=require(_0xea21('0xb'));var client=jayson['client'][_0xea21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37a7d0,_0x27555e,_0x585e38){return new BPromise(function(_0x2541fa,_0x41d8ff){return client[_0xea21('0xd')](_0x37a7d0,_0x585e38)['then'](function(_0x4cc675){logger[_0xea21('0xe')](_0xea21('0xf'),_0x27555e,_0xea21('0x10'));logger[_0xea21('0x11')](_0xea21('0x12'),_0x27555e,_0xea21('0x10'),JSON[_0xea21('0x13')](_0x4cc675));if(_0x4cc675[_0xea21('0x14')]){if(_0x4cc675[_0xea21('0x14')][_0xea21('0x15')]===0x1f4){logger[_0xea21('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x27555e,_0x4cc675[_0xea21('0x14')]['message']);return _0x41d8ff(_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);}logger[_0xea21('0x14')](_0xea21('0xf'),_0x27555e,_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);return _0x2541fa(_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);}else{logger[_0xea21('0xe')](_0xea21('0xf'),_0x27555e,_0xea21('0x10'));_0x2541fa(_0x4cc675['result']['message']);}})['catch'](function(_0x4fb655){logger[_0xea21('0x14')](_0xea21('0xf'),_0x27555e,_0x4fb655);_0x41d8ff(_0x4fb655);});});}exports['GetSugarcrmAccount']=function(_0x33a324){var _0x598653=this;return new Promise(function(_0x4b4e0c,_0xbfc678){return db[_0xea21('0x17')]['findAll']({'raw':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x19')]===undefined?!![]:![]:!![],'where':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')]['where']||null:null,'attributes':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1a')]||null:null,'limit':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1b')]||null:null,'include':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x33a324[_0xea21('0x18')][_0xea21('0x1c')],function(_0x5ac6d5){return{'model':db[_0x5ac6d5[_0xea21('0x1e')]],'as':_0x5ac6d5['as'],'attributes':_0x5ac6d5[_0xea21('0x1a')],'include':_0x5ac6d5[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x5ac6d5[_0xea21('0x1c')],function(_0x27df35){return{'model':db[_0x27df35[_0xea21('0x1e')]],'as':_0x27df35['as'],'attributes':_0x27df35[_0xea21('0x1a')],'include':_0x27df35[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x27df35[_0xea21('0x1c')],function(_0x1c25ca){return{'model':db[_0x1c25ca[_0xea21('0x1e')]],'as':_0x1c25ca['as'],'attributes':_0x1c25ca[_0xea21('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc9640c){logger[_0xea21('0xe')](_0xea21('0x1f'),_0x33a324);logger[_0xea21('0x11')]('GetSugarcrmAccount',_0x33a324,JSON[_0xea21('0x13')](_0xc9640c));_0x4b4e0c(_0xc9640c);})[_0xea21('0x20')](function(_0xfec518){logger[_0xea21('0x14')]('GetSugarcrmAccount',_0xfec518[_0xea21('0x16')],_0x33a324);_0xbfc678(_0x598653[_0xea21('0x14')](0x1f4,_0xfec518['message']));});});};exports[_0xea21('0x21')]=function(_0x2018a8){var _0x2b2ebc=this;return new Promise(function(_0x38a443,_0x4c78b6){return db['SugarcrmAccount'][_0xea21('0x22')]({'raw':_0x2018a8['options']?_0x2018a8['options'][_0xea21('0x19')]===undefined?!![]:![]:!![],'where':_0x2018a8[_0xea21('0x18')]?_0x2018a8['options'][_0xea21('0x23')]||null:null,'attributes':_0x2018a8[_0xea21('0x18')]?_0x2018a8[_0xea21('0x18')][_0xea21('0x1a')]||null:null,'include':_0x2018a8[_0xea21('0x18')]?_0x2018a8['options'][_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x2018a8[_0xea21('0x18')][_0xea21('0x1c')],function(_0xcbf0f7){return{'model':db[_0xcbf0f7[_0xea21('0x1e')]],'as':_0xcbf0f7['as'],'attributes':_0xcbf0f7[_0xea21('0x1a')],'include':_0xcbf0f7[_0xea21('0x1c')]?_['map'](_0xcbf0f7[_0xea21('0x1c')],function(_0x1218c1){return{'model':db[_0x1218c1['model']],'as':_0x1218c1['as'],'attributes':_0x1218c1[_0xea21('0x1a')],'include':_0x1218c1[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x1218c1[_0xea21('0x1c')],function(_0x4a997b){return{'model':db[_0x4a997b['model']],'as':_0x4a997b['as'],'attributes':_0x4a997b['attributes']};}):[]};}):[]};}):[]:[]})[_0xea21('0x24')](function(_0x2a18bd){logger[_0xea21('0xe')](_0xea21('0x21'),_0x2018a8);logger[_0xea21('0x11')](_0xea21('0x21'),_0x2018a8,JSON[_0xea21('0x13')](_0x2a18bd));_0x38a443(_0x2a18bd);})[_0xea21('0x20')](function(_0x53ddd4){logger['error'](_0xea21('0x21'),_0x53ddd4['message'],_0x2018a8);_0x4c78b6(_0x2b2ebc[_0xea21('0x14')](0x1f4,_0x53ddd4[_0xea21('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 62cb873..ee5b3c1 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 _0xd869=['get','isAuthenticated','index','show','/:id/fields','getFields','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd869,0x19a));var _0x9d86=function(_0x5d860a,_0xe2505b){_0x5d860a=_0x5d860a-0x0;var _0x2bd13a=_0xd869[_0x5d860a];return _0x2bd13a;};'use strict';var multer=require(_0x9d86('0x0'));var util=require(_0x9d86('0x1'));var path=require(_0x9d86('0x2'));var timeout=require(_0x9d86('0x3'));var express=require('express');var router=express[_0x9d86('0x4')]();var fs_extra=require(_0x9d86('0x5'));var auth=require(_0x9d86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d86('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x9d86('0x8')]('/',auth[_0x9d86('0x9')](),controller[_0x9d86('0xa')]);router[_0x9d86('0x8')]('/:id',auth[_0x9d86('0x9')](),controller[_0x9d86('0xb')]);router[_0x9d86('0x8')](_0x9d86('0xc'),auth[_0x9d86('0x9')](),controller[_0x9d86('0xd')]);router['get']('/:id/subjects',auth[_0x9d86('0x9')](),controller['getSubjects']);router[_0x9d86('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9d86('0xe')]);router[_0x9d86('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d86('0x10')]);router[_0x9d86('0x11')](_0x9d86('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x9d86('0x13')](_0x9d86('0x12'),auth[_0x9d86('0x9')](),controller[_0x9d86('0x14')]);module[_0x9d86('0x15')]=router; \ No newline at end of file +var _0x9536=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x36fec2,_0x567797){var _0x21741c=function(_0x4fe689){while(--_0x4fe689){_0x36fec2['push'](_0x36fec2['shift']());}};_0x21741c(++_0x567797);}(_0x9536,0x109));var _0x6953=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x9536[_0x3b7b8a];return _0x441206;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require('connect-timeout');var express=require(_0x6953('0x3'));var router=express['Router']();var fs_extra=require(_0x6953('0x4'));var auth=require(_0x6953('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller[_0x6953('0xa')]);router[_0x6953('0x8')](_0x6953('0xb'),auth[_0x6953('0x9')](),controller[_0x6953('0xc')]);router[_0x6953('0x8')]('/:id/fields',auth[_0x6953('0x9')](),controller[_0x6953('0xd')]);router[_0x6953('0x8')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);router['post']('/',auth[_0x6953('0x9')](),controller[_0x6953('0x12')]);router[_0x6953('0x13')](_0x6953('0xb'),auth[_0x6953('0x9')](),controller[_0x6953('0x14')]);router[_0x6953('0x15')](_0x6953('0xb'),auth['isAuthenticated'](),controller[_0x6953('0x16')]);module[_0x6953('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3a26325..3a3f506 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 _0x4498=['sequelize','STRING'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4498,0x142));var _0x8449=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x4498[_0x5c6299];return _0x23b564;};'use strict';var Sequelize=require(_0x8449('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8449('0x1')]}}; \ No newline at end of file +var _0xdbe0=['sequelize','exports','STRING'];(function(_0x38c2f7,_0x4f190f){var _0x426ab9=function(_0x5dc07a){while(--_0x5dc07a){_0x38c2f7['push'](_0x38c2f7['shift']());}};_0x426ab9(++_0x4f190f);}(_0xdbe0,0x168));var _0x0dbe=function(_0x36ee5c,_0x2700c7){_0x36ee5c=_0x36ee5c-0x0;var _0x3002be=_0xdbe0[_0x36ee5c];return _0x3002be;};'use strict';var Sequelize=require(_0x0dbe('0x0'));module[_0x0dbe('0x1')]={'name':{'type':Sequelize[_0x0dbe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index eee3b3f..2f17af9 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 _0xc1b4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','catch','show','params','include','merge','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc1b4,0x88));var _0x4c1b=function(_0x4be26b,_0x4afabe){_0x4be26b=_0x4be26b-0x0;var _0x1b6885=_0xc1b4[_0x4be26b];return _0x1b6885;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c1b('0x0'));var zipdir=require(_0x4c1b('0x1'));var jsonpatch=require(_0x4c1b('0x2'));var rp=require(_0x4c1b('0x3'));var moment=require(_0x4c1b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c1b('0x5'));var path=require(_0x4c1b('0x6'));var sox=require('sox');var csv=require(_0x4c1b('0x7'));var ejs=require(_0x4c1b('0x8'));var fs=require('fs');var fs_extra=require(_0x4c1b('0x9'));var _=require('lodash');var squel=require(_0x4c1b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c1b('0xb'));var toCsv=require(_0x4c1b('0x7'));var querystring=require(_0x4c1b('0xc'));var Papa=require(_0x4c1b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c1b('0xe'));var as=require(_0x4c1b('0xf'));var hardwareService=require(_0x4c1b('0x10'));var logger=require('../../config/logger')(_0x4c1b('0x11'));var utils=require('../../config/utils');var config=require(_0x4c1b('0x12'));var licenseUtil=require(_0x4c1b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x106c9c,_0x208015){_0x208015=_0x208015||0xcc;return function(_0x222576){if(_0x222576){return _0x106c9c['sendStatus'](_0x208015);}return _0x106c9c[_0x4c1b('0x14')](_0x208015)[_0x4c1b('0x15')]();};}function respondWithResult(_0x30462c,_0x5d14bd){_0x5d14bd=_0x5d14bd||0xc8;return function(_0x24bc83){if(_0x24bc83){return _0x30462c[_0x4c1b('0x14')](_0x5d14bd)[_0x4c1b('0x16')](_0x24bc83);}};}function respondWithFilteredResult(_0x47fb69,_0x42910a){return function(_0x41cfe5){if(_0x41cfe5){var _0x384e56=typeof _0x42910a['offset']===_0x4c1b('0x17')&&typeof _0x42910a['limit']===_0x4c1b('0x17');var _0x26e98f=_0x41cfe5[_0x4c1b('0x18')];var _0x5a15e3=_0x384e56?0x0:_0x42910a[_0x4c1b('0x19')];var _0x1cfe57=_0x384e56?_0x41cfe5[_0x4c1b('0x18')]:_0x42910a[_0x4c1b('0x19')]+_0x42910a[_0x4c1b('0x1a')];var _0x1f3e91;if(_0x1cfe57>=_0x26e98f){_0x1cfe57=_0x26e98f;_0x1f3e91=0xc8;}else{_0x1f3e91=0xce;}_0x47fb69['status'](_0x1f3e91);return _0x47fb69['set'](_0x4c1b('0x1b'),_0x5a15e3+'-'+_0x1cfe57+'/'+_0x26e98f)['json'](_0x41cfe5);}return null;};}function patchUpdates(_0x485c65){return function(_0x3241e9){try{jsonpatch['apply'](_0x3241e9,_0x485c65,!![]);}catch(_0x2ec1e6){return BPromise[_0x4c1b('0x1c')](_0x2ec1e6);}return _0x3241e9[_0x4c1b('0x1d')]();};}function saveUpdates(_0x513891,_0x29f74e){return function(_0x41961a){if(_0x41961a){return _0x41961a[_0x4c1b('0x1e')](_0x513891)['then'](function(_0xa3fa9){return _0xa3fa9;});}return null;};}function removeEntity(_0x4918ca,_0x835e30){return function(_0x404f31){if(_0x404f31){return _0x404f31[_0x4c1b('0x1f')]()[_0x4c1b('0x20')](function(){_0x4918ca[_0x4c1b('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc3ee,_0x4af229){return function(_0x5cc90b){if(!_0x5cc90b){_0x1bc3ee[_0x4c1b('0x21')](0x194);}return _0x5cc90b;};}function handleError(_0x384df0,_0x59a3b5){_0x59a3b5=_0x59a3b5||0x1f4;return function(_0xca08f6){logger[_0x4c1b('0x22')](_0xca08f6[_0x4c1b('0x23')]);if(_0xca08f6['name']){delete _0xca08f6[_0x4c1b('0x24')];}_0x384df0[_0x4c1b('0x14')](_0x59a3b5)[_0x4c1b('0x25')](_0xca08f6);};}exports[_0x4c1b('0x26')]=function(_0x5446e8,_0x357cef){var _0x30999e={},_0x26d879={},_0x20927b={'count':0x0,'rows':[]};var _0x4a6fd7=_[_0x4c1b('0x27')](db[_0x4c1b('0x28')][_0x4c1b('0x29')],function(_0x351638){return{'name':_0x351638[_0x4c1b('0x2a')],'type':_0x351638[_0x4c1b('0x2b')]['key']};});_0x26d879['model']=_['map'](_0x4a6fd7,'name');_0x26d879['query']=_[_0x4c1b('0x2c')](_0x5446e8[_0x4c1b('0x2d')]);_0x26d879[_0x4c1b('0x2e')]=_[_0x4c1b('0x2f')](_0x26d879[_0x4c1b('0x30')],_0x26d879[_0x4c1b('0x2d')]);_0x30999e[_0x4c1b('0x31')]=_[_0x4c1b('0x2f')](_0x26d879[_0x4c1b('0x30')],qs[_0x4c1b('0x32')](_0x5446e8[_0x4c1b('0x2d')]['fields']));_0x30999e[_0x4c1b('0x31')]=_0x30999e[_0x4c1b('0x31')][_0x4c1b('0x33')]?_0x30999e[_0x4c1b('0x31')]:_0x26d879[_0x4c1b('0x30')];if(!_0x5446e8[_0x4c1b('0x2d')][_0x4c1b('0x34')](_0x4c1b('0x35'))){_0x30999e[_0x4c1b('0x1a')]=qs[_0x4c1b('0x1a')](_0x5446e8['query']['limit']);_0x30999e[_0x4c1b('0x19')]=qs[_0x4c1b('0x19')](_0x5446e8[_0x4c1b('0x2d')][_0x4c1b('0x19')]);}_0x30999e[_0x4c1b('0x36')]=qs['sort'](_0x5446e8[_0x4c1b('0x2d')][_0x4c1b('0x37')]);_0x30999e['where']=qs['filters'](_[_0x4c1b('0x38')](_0x5446e8[_0x4c1b('0x2d')],_0x26d879[_0x4c1b('0x2e')]),_0x4a6fd7);if(_0x5446e8[_0x4c1b('0x2d')][_0x4c1b('0x39')]){_0x30999e[_0x4c1b('0x3a')]=_['merge'](_0x30999e['where'],{'$or':_['map'](_0x4a6fd7,function(_0x54e7f9){if(_0x54e7f9[_0x4c1b('0x2b')]!==_0x4c1b('0x3b')){var _0x186128={};_0x186128[_0x54e7f9[_0x4c1b('0x24')]]={'$like':'%'+_0x5446e8['query'][_0x4c1b('0x39')]+'%'};return _0x186128;}})});}_0x30999e=_['merge']({},_0x30999e,_0x5446e8[_0x4c1b('0x3c')]);var _0x2f6918={'where':_0x30999e[_0x4c1b('0x3a')]};return db[_0x4c1b('0x28')][_0x4c1b('0x18')](_0x2f6918)[_0x4c1b('0x20')](function(_0x53479d){_0x20927b['count']=_0x53479d;if(_0x5446e8[_0x4c1b('0x2d')][_0x4c1b('0x3d')]){_0x30999e['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x30999e);})[_0x4c1b('0x20')](function(_0x47085c){_0x20927b['rows']=_0x47085c;return _0x20927b;})[_0x4c1b('0x20')](respondWithFilteredResult(_0x357cef,_0x30999e))[_0x4c1b('0x3e')](handleError(_0x357cef,null));};exports[_0x4c1b('0x3f')]=function(_0x426d02,_0x4834f6){var _0x215dee={'raw':![],'where':{'id':_0x426d02[_0x4c1b('0x40')]['id']}},_0x5e0a13={};_0x5e0a13[_0x4c1b('0x30')]=_[_0x4c1b('0x2c')](db[_0x4c1b('0x28')]['rawAttributes']);_0x5e0a13[_0x4c1b('0x2d')]=_[_0x4c1b('0x2c')](_0x426d02[_0x4c1b('0x2d')]);_0x5e0a13['filters']=_[_0x4c1b('0x2f')](_0x5e0a13[_0x4c1b('0x30')],_0x5e0a13[_0x4c1b('0x2d')]);_0x215dee[_0x4c1b('0x31')]=_[_0x4c1b('0x2f')](_0x5e0a13['model'],qs[_0x4c1b('0x32')](_0x426d02[_0x4c1b('0x2d')][_0x4c1b('0x32')]));_0x215dee[_0x4c1b('0x31')]=_0x215dee[_0x4c1b('0x31')][_0x4c1b('0x33')]?_0x215dee[_0x4c1b('0x31')]:_0x5e0a13['model'];if(_0x426d02[_0x4c1b('0x2d')][_0x4c1b('0x3d')]){_0x215dee[_0x4c1b('0x41')]=[{'all':!![]}];}_0x215dee=_[_0x4c1b('0x42')]({},_0x215dee,_0x426d02['options']);return db[_0x4c1b('0x28')][_0x4c1b('0x43')](_0x215dee)[_0x4c1b('0x20')](handleEntityNotFound(_0x4834f6,null))[_0x4c1b('0x20')](respondWithResult(_0x4834f6,null))[_0x4c1b('0x3e')](handleError(_0x4834f6,null));};exports[_0x4c1b('0x44')]=function(_0x5ec393,_0x2f1f16){return db[_0x4c1b('0x28')][_0x4c1b('0x44')](_0x5ec393[_0x4c1b('0x45')],{})[_0x4c1b('0x20')](respondWithResult(_0x2f1f16,0xc9))['catch'](handleError(_0x2f1f16,null));};exports[_0x4c1b('0x1e')]=function(_0x59a09c,_0x27d16f){if(_0x59a09c['body']['id']){delete _0x59a09c[_0x4c1b('0x45')]['id'];}return db['SugarcrmConfiguration'][_0x4c1b('0x43')]({'where':{'id':_0x59a09c[_0x4c1b('0x40')]['id']}})[_0x4c1b('0x20')](handleEntityNotFound(_0x27d16f,null))[_0x4c1b('0x20')](saveUpdates(_0x59a09c[_0x4c1b('0x45')],null))[_0x4c1b('0x20')](respondWithResult(_0x27d16f,null))[_0x4c1b('0x3e')](handleError(_0x27d16f,null));};exports[_0x4c1b('0x1f')]=function(_0x5caca7,_0x2181cd){return db[_0x4c1b('0x28')][_0x4c1b('0x43')]({'where':{'id':_0x5caca7[_0x4c1b('0x40')]['id']}})[_0x4c1b('0x20')](handleEntityNotFound(_0x2181cd,null))['then'](removeEntity(_0x2181cd,null))[_0x4c1b('0x3e')](handleError(_0x2181cd,null));};exports[_0x4c1b('0x46')]=function(_0xfec99f,_0xc05e,_0x7594b1){var _0x39b8ac={};var _0x171b21={};var _0x795aba;var _0x101307;return db[_0x4c1b('0x28')][_0x4c1b('0x47')]({'where':{'id':_0xfec99f['params']['id']}})[_0x4c1b('0x20')](handleEntityNotFound(_0xc05e,null))['then'](function(_0x4ebe56){if(_0x4ebe56){_0x795aba=_0x4ebe56;_0x171b21[_0x4c1b('0x30')]=_[_0x4c1b('0x2c')](db['SugarcrmField']['rawAttributes']);_0x171b21[_0x4c1b('0x2d')]=_[_0x4c1b('0x2c')](_0xfec99f[_0x4c1b('0x2d')]);_0x171b21[_0x4c1b('0x2e')]=_[_0x4c1b('0x2f')](_0x171b21[_0x4c1b('0x30')],_0x171b21[_0x4c1b('0x2d')]);_0x39b8ac[_0x4c1b('0x31')]=_[_0x4c1b('0x2f')](_0x171b21[_0x4c1b('0x30')],qs[_0x4c1b('0x32')](_0xfec99f['query']['fields']));_0x39b8ac[_0x4c1b('0x31')]=_0x39b8ac[_0x4c1b('0x31')]['length']?_0x39b8ac[_0x4c1b('0x31')]:_0x171b21[_0x4c1b('0x30')];_0x39b8ac['order']=qs[_0x4c1b('0x37')](_0xfec99f['query'][_0x4c1b('0x37')]);_0x39b8ac[_0x4c1b('0x3a')]=qs[_0x4c1b('0x2e')](_[_0x4c1b('0x38')](_0xfec99f[_0x4c1b('0x2d')],_0x171b21['filters']));if(_0xfec99f[_0x4c1b('0x2d')][_0x4c1b('0x39')]){_0x39b8ac[_0x4c1b('0x3a')]=_[_0x4c1b('0x42')](_0x39b8ac[_0x4c1b('0x3a')],{'$or':_['map'](_0x39b8ac[_0x4c1b('0x31')],function(_0x19a96c){var _0x121456={};_0x121456[_0x19a96c]={'$like':'%'+_0xfec99f[_0x4c1b('0x2d')][_0x4c1b('0x39')]+'%'};return _0x121456;})});}_0x39b8ac=_['merge']({},_0x39b8ac,_0xfec99f['options']);return _0x795aba['getFields'](_0x39b8ac);}})[_0x4c1b('0x20')](function(_0x11335c){if(_0x11335c){_0x101307=_0x11335c[_0x4c1b('0x33')];if(!_0xfec99f['query'][_0x4c1b('0x34')](_0x4c1b('0x35'))){_0x39b8ac[_0x4c1b('0x1a')]=qs[_0x4c1b('0x1a')](_0xfec99f[_0x4c1b('0x2d')][_0x4c1b('0x1a')]);_0x39b8ac['offset']=qs[_0x4c1b('0x19')](_0xfec99f[_0x4c1b('0x2d')]['offset']);}return _0x795aba[_0x4c1b('0x46')](_0x39b8ac);}})[_0x4c1b('0x20')](function(_0x1a9619){if(_0x1a9619){return _0x1a9619?{'count':_0x101307,'rows':_0x1a9619}:null;}})['then'](respondWithResult(_0xc05e,null))[_0x4c1b('0x3e')](handleError(_0xc05e,null));};exports['getSubjects']=function(_0x30ae4b,_0x84f484,_0x2be764){var _0x493dbf={};var _0x1c6f23={};var _0x5c66a0;var _0x35113f;return db[_0x4c1b('0x28')][_0x4c1b('0x47')]({'where':{'id':_0x30ae4b['params']['id']}})[_0x4c1b('0x20')](handleEntityNotFound(_0x84f484,null))[_0x4c1b('0x20')](function(_0x592d74){if(_0x592d74){_0x5c66a0=_0x592d74;_0x1c6f23[_0x4c1b('0x30')]=_[_0x4c1b('0x2c')](db[_0x4c1b('0x48')][_0x4c1b('0x29')]);_0x1c6f23[_0x4c1b('0x2d')]=_['keys'](_0x30ae4b[_0x4c1b('0x2d')]);_0x1c6f23['filters']=_[_0x4c1b('0x2f')](_0x1c6f23[_0x4c1b('0x30')],_0x1c6f23['query']);_0x493dbf[_0x4c1b('0x31')]=_[_0x4c1b('0x2f')](_0x1c6f23[_0x4c1b('0x30')],qs[_0x4c1b('0x32')](_0x30ae4b['query'][_0x4c1b('0x32')]));_0x493dbf[_0x4c1b('0x31')]=_0x493dbf[_0x4c1b('0x31')]['length']?_0x493dbf['attributes']:_0x1c6f23[_0x4c1b('0x30')];_0x493dbf['order']=qs['sort'](_0x30ae4b[_0x4c1b('0x2d')][_0x4c1b('0x37')]);_0x493dbf[_0x4c1b('0x3a')]=qs[_0x4c1b('0x2e')](_['pick'](_0x30ae4b[_0x4c1b('0x2d')],_0x1c6f23['filters']));if(_0x30ae4b[_0x4c1b('0x2d')]['filter']){_0x493dbf[_0x4c1b('0x3a')]=_['merge'](_0x493dbf['where'],{'$or':_[_0x4c1b('0x27')](_0x493dbf['attributes'],function(_0x2513c7){var _0x2eb3a9={};_0x2eb3a9[_0x2513c7]={'$like':'%'+_0x30ae4b[_0x4c1b('0x2d')][_0x4c1b('0x39')]+'%'};return _0x2eb3a9;})});}_0x493dbf=_[_0x4c1b('0x42')]({},_0x493dbf,_0x30ae4b[_0x4c1b('0x3c')]);return _0x5c66a0[_0x4c1b('0x49')](_0x493dbf);}})[_0x4c1b('0x20')](function(_0x5d3499){if(_0x5d3499){_0x35113f=_0x5d3499[_0x4c1b('0x33')];if(!_0x30ae4b[_0x4c1b('0x2d')]['hasOwnProperty'](_0x4c1b('0x35'))){_0x493dbf[_0x4c1b('0x1a')]=qs[_0x4c1b('0x1a')](_0x30ae4b[_0x4c1b('0x2d')][_0x4c1b('0x1a')]);_0x493dbf[_0x4c1b('0x19')]=qs['offset'](_0x30ae4b['query'][_0x4c1b('0x19')]);}return _0x5c66a0[_0x4c1b('0x49')](_0x493dbf);}})[_0x4c1b('0x20')](function(_0x2832c5){if(_0x2832c5){return _0x2832c5?{'count':_0x35113f,'rows':_0x2832c5}:null;}})[_0x4c1b('0x20')](respondWithResult(_0x84f484,null))[_0x4c1b('0x3e')](handleError(_0x84f484,null));};exports[_0x4c1b('0x4a')]=function(_0xa9a5c5,_0x4a3bbe,_0x475a0c){var _0x4fc8ce={};var _0x6f91e1={};var _0x9a80c9;var _0x55a43b;return db[_0x4c1b('0x28')][_0x4c1b('0x47')]({'where':{'id':_0xa9a5c5[_0x4c1b('0x40')]['id']}})[_0x4c1b('0x20')](handleEntityNotFound(_0x4a3bbe,null))[_0x4c1b('0x20')](function(_0x43e58f){if(_0x43e58f){_0x9a80c9=_0x43e58f;_0x6f91e1[_0x4c1b('0x30')]=_[_0x4c1b('0x2c')](db[_0x4c1b('0x48')][_0x4c1b('0x29')]);_0x6f91e1[_0x4c1b('0x2d')]=_['keys'](_0xa9a5c5[_0x4c1b('0x2d')]);_0x6f91e1['filters']=_[_0x4c1b('0x2f')](_0x6f91e1[_0x4c1b('0x30')],_0x6f91e1[_0x4c1b('0x2d')]);_0x4fc8ce[_0x4c1b('0x31')]=_[_0x4c1b('0x2f')](_0x6f91e1[_0x4c1b('0x30')],qs['fields'](_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x32')]));_0x4fc8ce[_0x4c1b('0x31')]=_0x4fc8ce[_0x4c1b('0x31')][_0x4c1b('0x33')]?_0x4fc8ce['attributes']:_0x6f91e1[_0x4c1b('0x30')];_0x4fc8ce['order']=qs[_0x4c1b('0x37')](_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x37')]);_0x4fc8ce[_0x4c1b('0x3a')]=qs[_0x4c1b('0x2e')](_[_0x4c1b('0x38')](_0xa9a5c5[_0x4c1b('0x2d')],_0x6f91e1[_0x4c1b('0x2e')]));if(_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x39')]){_0x4fc8ce[_0x4c1b('0x3a')]=_[_0x4c1b('0x42')](_0x4fc8ce[_0x4c1b('0x3a')],{'$or':_[_0x4c1b('0x27')](_0x4fc8ce[_0x4c1b('0x31')],function(_0x378a2c){var _0x2e771b={};_0x2e771b[_0x378a2c]={'$like':'%'+_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x39')]+'%'};return _0x2e771b;})});}_0x4fc8ce=_['merge']({},_0x4fc8ce,_0xa9a5c5[_0x4c1b('0x3c')]);return _0x9a80c9[_0x4c1b('0x4a')](_0x4fc8ce);}})[_0x4c1b('0x20')](function(_0x2c194c){if(_0x2c194c){_0x55a43b=_0x2c194c[_0x4c1b('0x33')];if(!_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x34')](_0x4c1b('0x35'))){_0x4fc8ce[_0x4c1b('0x1a')]=qs[_0x4c1b('0x1a')](_0xa9a5c5[_0x4c1b('0x2d')]['limit']);_0x4fc8ce[_0x4c1b('0x19')]=qs['offset'](_0xa9a5c5[_0x4c1b('0x2d')][_0x4c1b('0x19')]);}return _0x9a80c9[_0x4c1b('0x4a')](_0x4fc8ce);}})[_0x4c1b('0x20')](function(_0x248440){if(_0x248440){return _0x248440?{'count':_0x55a43b,'rows':_0x248440}:null;}})[_0x4c1b('0x20')](respondWithResult(_0x4a3bbe,null))[_0x4c1b('0x3e')](handleError(_0x4a3bbe,null));}; \ No newline at end of file +var _0x41bb=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','name','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne','SugarcrmField','getSubjects','keys','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4ded63,_0x3bb556){var _0x5deae9=function(_0x54800c){while(--_0x54800c){_0x4ded63['push'](_0x4ded63['shift']());}};_0x5deae9(++_0x3bb556);}(_0x41bb,0x8d));var _0xb41b=function(_0x1239ad,_0x3a66a0){_0x1239ad=_0x1239ad-0x0;var _0x173b03=_0x41bb[_0x1239ad];return _0x173b03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb41b('0x0'));var jsonpatch=require(_0xb41b('0x1'));var rp=require(_0xb41b('0x2'));var moment=require(_0xb41b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb41b('0x4'));var path=require('path');var sox=require(_0xb41b('0x5'));var csv=require(_0xb41b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0x7'));var jsforce=require(_0xb41b('0x8'));var deskjs=require(_0xb41b('0x9'));var toCsv=require(_0xb41b('0x6'));var querystring=require(_0xb41b('0xa'));var Papa=require(_0xb41b('0xb'));var Redis=require(_0xb41b('0xc'));var authService=require(_0xb41b('0xd'));var qs=require(_0xb41b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb41b('0xf'));var logger=require(_0xb41b('0x10'))(_0xb41b('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb41b('0x12'));var db=require(_0xb41b('0x13'))['db'];function respondWithStatusCode(_0x118953,_0x3db83b){_0x3db83b=_0x3db83b||0xcc;return function(_0x155e69){if(_0x155e69){return _0x118953[_0xb41b('0x14')](_0x3db83b);}return _0x118953[_0xb41b('0x15')](_0x3db83b)[_0xb41b('0x16')]();};}function respondWithResult(_0x4be730,_0x402157){_0x402157=_0x402157||0xc8;return function(_0x67159a){if(_0x67159a){return _0x4be730[_0xb41b('0x15')](_0x402157)[_0xb41b('0x17')](_0x67159a);}};}function respondWithFilteredResult(_0x50d5ea,_0x568416){return function(_0x488185){if(_0x488185){var _0x5af704=typeof _0x568416[_0xb41b('0x18')]===_0xb41b('0x19')&&typeof _0x568416[_0xb41b('0x1a')]===_0xb41b('0x19');var _0x4f5315=_0x488185[_0xb41b('0x1b')];var _0x133056=_0x5af704?0x0:_0x568416['offset'];var _0x322e57=_0x5af704?_0x488185[_0xb41b('0x1b')]:_0x568416['offset']+_0x568416[_0xb41b('0x1a')];var _0x5f28aa;if(_0x322e57>=_0x4f5315){_0x322e57=_0x4f5315;_0x5f28aa=0xc8;}else{_0x5f28aa=0xce;}_0x50d5ea[_0xb41b('0x15')](_0x5f28aa);return _0x50d5ea[_0xb41b('0x1c')](_0xb41b('0x1d'),_0x133056+'-'+_0x322e57+'/'+_0x4f5315)[_0xb41b('0x17')](_0x488185);}return null;};}function patchUpdates(_0x3ee518){return function(_0x29e6b4){try{jsonpatch[_0xb41b('0x1e')](_0x29e6b4,_0x3ee518,!![]);}catch(_0x165867){return BPromise['reject'](_0x165867);}return _0x29e6b4['save']();};}function saveUpdates(_0x3abbd9,_0x1c4ffb){return function(_0x3b2913){if(_0x3b2913){return _0x3b2913[_0xb41b('0x1f')](_0x3abbd9)[_0xb41b('0x20')](function(_0x55204f){return _0x55204f;});}return null;};}function removeEntity(_0x5a869b,_0x4a1a79){return function(_0x43eef4){if(_0x43eef4){return _0x43eef4[_0xb41b('0x21')]()[_0xb41b('0x20')](function(){_0x5a869b['status'](0xcc)[_0xb41b('0x16')]();});}};}function handleEntityNotFound(_0x2f613b,_0x329a3f){return function(_0x50dbb6){if(!_0x50dbb6){_0x2f613b[_0xb41b('0x14')](0x194);}return _0x50dbb6;};}function handleError(_0x1d3215,_0x1feb75){_0x1feb75=_0x1feb75||0x1f4;return function(_0x5e2535){logger[_0xb41b('0x22')](_0x5e2535[_0xb41b('0x23')]);if(_0x5e2535['name']){delete _0x5e2535['name'];}_0x1d3215[_0xb41b('0x15')](_0x1feb75)[_0xb41b('0x24')](_0x5e2535);};}exports[_0xb41b('0x25')]=function(_0x3bcb04,_0x44d06c){var _0x56f7d3={},_0x135e46={},_0x446309={'count':0x0,'rows':[]};var _0x3a0bba=_[_0xb41b('0x26')](db[_0xb41b('0x27')][_0xb41b('0x28')],function(_0x396d50){return{'name':_0x396d50[_0xb41b('0x29')],'type':_0x396d50['type'][_0xb41b('0x2a')]};});_0x135e46['model']=_[_0xb41b('0x26')](_0x3a0bba,_0xb41b('0x2b'));_0x135e46['query']=_['keys'](_0x3bcb04[_0xb41b('0x2c')]);_0x135e46['filters']=_[_0xb41b('0x2d')](_0x135e46[_0xb41b('0x2e')],_0x135e46[_0xb41b('0x2c')]);_0x56f7d3[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x135e46[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x3bcb04['query'][_0xb41b('0x30')]));_0x56f7d3['attributes']=_0x56f7d3[_0xb41b('0x2f')]['length']?_0x56f7d3[_0xb41b('0x2f')]:_0x135e46[_0xb41b('0x2e')];if(!_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x31')](_0xb41b('0x32'))){_0x56f7d3[_0xb41b('0x1a')]=qs['limit'](_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x56f7d3[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x3bcb04[_0xb41b('0x2c')]['offset']);}_0x56f7d3[_0xb41b('0x33')]=qs['sort'](_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x56f7d3[_0xb41b('0x35')]=qs['filters'](_[_0xb41b('0x36')](_0x3bcb04[_0xb41b('0x2c')],_0x135e46[_0xb41b('0x37')]),_0x3a0bba);if(_0x3bcb04[_0xb41b('0x2c')]['filter']){_0x56f7d3[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x56f7d3[_0xb41b('0x35')],{'$or':_[_0xb41b('0x26')](_0x3a0bba,function(_0x1ad12c){if(_0x1ad12c['type']!==_0xb41b('0x39')){var _0x179607={};_0x179607[_0x1ad12c[_0xb41b('0x2b')]]={'$like':'%'+_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x3a')]+'%'};return _0x179607;}})});}_0x56f7d3=_[_0xb41b('0x38')]({},_0x56f7d3,_0x3bcb04[_0xb41b('0x3b')]);var _0x2cda9a={'where':_0x56f7d3[_0xb41b('0x35')]};return db['SugarcrmConfiguration'][_0xb41b('0x1b')](_0x2cda9a)[_0xb41b('0x20')](function(_0x34c50f){_0x446309[_0xb41b('0x1b')]=_0x34c50f;if(_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x3c')]){_0x56f7d3['include']=[{'all':!![]}];}return db[_0xb41b('0x27')][_0xb41b('0x3d')](_0x56f7d3);})['then'](function(_0x261d23){_0x446309[_0xb41b('0x3e')]=_0x261d23;return _0x446309;})[_0xb41b('0x20')](respondWithFilteredResult(_0x44d06c,_0x56f7d3))[_0xb41b('0x3f')](handleError(_0x44d06c,null));};exports[_0xb41b('0x40')]=function(_0x4cf9a1,_0x5ef350){var _0xe82b4c={'raw':![],'where':{'id':_0x4cf9a1[_0xb41b('0x41')]['id']}},_0x423a1e={};_0x423a1e[_0xb41b('0x2e')]=_['keys'](db[_0xb41b('0x27')][_0xb41b('0x28')]);_0x423a1e[_0xb41b('0x2c')]=_['keys'](_0x4cf9a1['query']);_0x423a1e[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x423a1e[_0xb41b('0x2e')],_0x423a1e[_0xb41b('0x2c')]);_0xe82b4c[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x423a1e['model'],qs[_0xb41b('0x30')](_0x4cf9a1[_0xb41b('0x2c')][_0xb41b('0x30')]));_0xe82b4c[_0xb41b('0x2f')]=_0xe82b4c[_0xb41b('0x2f')][_0xb41b('0x42')]?_0xe82b4c[_0xb41b('0x2f')]:_0x423a1e[_0xb41b('0x2e')];if(_0x4cf9a1[_0xb41b('0x2c')][_0xb41b('0x3c')]){_0xe82b4c[_0xb41b('0x43')]=[{'all':!![]}];}_0xe82b4c=_[_0xb41b('0x38')]({},_0xe82b4c,_0x4cf9a1['options']);return db[_0xb41b('0x27')][_0xb41b('0x44')](_0xe82b4c)[_0xb41b('0x20')](handleEntityNotFound(_0x5ef350,null))[_0xb41b('0x20')](respondWithResult(_0x5ef350,null))[_0xb41b('0x3f')](handleError(_0x5ef350,null));};exports['create']=function(_0x4b6e34,_0x2b1139){return db[_0xb41b('0x27')][_0xb41b('0x45')](_0x4b6e34['body'],{})[_0xb41b('0x20')](respondWithResult(_0x2b1139,0xc9))[_0xb41b('0x3f')](handleError(_0x2b1139,null));};exports[_0xb41b('0x1f')]=function(_0x16761f,_0x398fe5){if(_0x16761f['body']['id']){delete _0x16761f[_0xb41b('0x46')]['id'];}return db['SugarcrmConfiguration'][_0xb41b('0x44')]({'where':{'id':_0x16761f[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x398fe5,null))['then'](saveUpdates(_0x16761f[_0xb41b('0x46')],null))[_0xb41b('0x20')](respondWithResult(_0x398fe5,null))[_0xb41b('0x3f')](handleError(_0x398fe5,null));};exports[_0xb41b('0x21')]=function(_0x3fa402,_0x540861){return db[_0xb41b('0x27')][_0xb41b('0x44')]({'where':{'id':_0x3fa402[_0xb41b('0x41')]['id']}})['then'](handleEntityNotFound(_0x540861,null))[_0xb41b('0x20')](removeEntity(_0x540861,null))['catch'](handleError(_0x540861,null));};exports[_0xb41b('0x47')]=function(_0x2b5957,_0x23a18b,_0x16de8e){var _0x323b2c={};var _0x3d91ce={};var _0x29862d;var _0x3de8b2;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x2b5957[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x23a18b,null))['then'](function(_0x11b369){if(_0x11b369){_0x29862d=_0x11b369;_0x3d91ce[_0xb41b('0x2e')]=_['keys'](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x3d91ce[_0xb41b('0x2c')]=_['keys'](_0x2b5957[_0xb41b('0x2c')]);_0x3d91ce[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x3d91ce['model'],_0x3d91ce[_0xb41b('0x2c')]);_0x323b2c[_0xb41b('0x2f')]=_['intersection'](_0x3d91ce[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x323b2c['attributes']=_0x323b2c[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x323b2c['attributes']:_0x3d91ce[_0xb41b('0x2e')];_0x323b2c[_0xb41b('0x33')]=qs[_0xb41b('0x34')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x323b2c[_0xb41b('0x35')]=qs[_0xb41b('0x37')](_['pick'](_0x2b5957[_0xb41b('0x2c')],_0x3d91ce[_0xb41b('0x37')]));if(_0x2b5957['query'][_0xb41b('0x3a')]){_0x323b2c[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x323b2c[_0xb41b('0x35')],{'$or':_[_0xb41b('0x26')](_0x323b2c[_0xb41b('0x2f')],function(_0x21bff7){var _0xac836c={};_0xac836c[_0x21bff7]={'$like':'%'+_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x3a')]+'%'};return _0xac836c;})});}_0x323b2c=_['merge']({},_0x323b2c,_0x2b5957[_0xb41b('0x3b')]);return _0x29862d['getFields'](_0x323b2c);}})[_0xb41b('0x20')](function(_0xd89aa8){if(_0xd89aa8){_0x3de8b2=_0xd89aa8['length'];if(!_0x2b5957[_0xb41b('0x2c')]['hasOwnProperty']('nolimit')){_0x323b2c[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x323b2c[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x29862d[_0xb41b('0x47')](_0x323b2c);}})[_0xb41b('0x20')](function(_0x5c0840){if(_0x5c0840){return _0x5c0840?{'count':_0x3de8b2,'rows':_0x5c0840}:null;}})['then'](respondWithResult(_0x23a18b,null))[_0xb41b('0x3f')](handleError(_0x23a18b,null));};exports[_0xb41b('0x4a')]=function(_0x190353,_0x5adb82,_0x934a00){var _0x22642b={};var _0x2b44a2={};var _0x712461;var _0xb00776;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x190353[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x5adb82,null))['then'](function(_0x8ce739){if(_0x8ce739){_0x712461=_0x8ce739;_0x2b44a2['model']=_[_0xb41b('0x4b')](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x2b44a2[_0xb41b('0x2c')]=_[_0xb41b('0x4b')](_0x190353[_0xb41b('0x2c')]);_0x2b44a2[_0xb41b('0x37')]=_['intersection'](_0x2b44a2[_0xb41b('0x2e')],_0x2b44a2['query']);_0x22642b[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x2b44a2[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x190353[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x22642b['attributes']=_0x22642b[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x22642b[_0xb41b('0x2f')]:_0x2b44a2[_0xb41b('0x2e')];_0x22642b['order']=qs['sort'](_0x190353['query']['sort']);_0x22642b[_0xb41b('0x35')]=qs['filters'](_[_0xb41b('0x36')](_0x190353[_0xb41b('0x2c')],_0x2b44a2['filters']));if(_0x190353[_0xb41b('0x2c')][_0xb41b('0x3a')]){_0x22642b[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x22642b[_0xb41b('0x35')],{'$or':_['map'](_0x22642b['attributes'],function(_0x26ec9f){var _0x15a640={};_0x15a640[_0x26ec9f]={'$like':'%'+_0x190353['query'][_0xb41b('0x3a')]+'%'};return _0x15a640;})});}_0x22642b=_['merge']({},_0x22642b,_0x190353[_0xb41b('0x3b')]);return _0x712461[_0xb41b('0x4a')](_0x22642b);}})['then'](function(_0xbdaa8a){if(_0xbdaa8a){_0xb00776=_0xbdaa8a[_0xb41b('0x42')];if(!_0x190353['query'][_0xb41b('0x31')]('nolimit')){_0x22642b[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x190353[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x22642b[_0xb41b('0x18')]=qs['offset'](_0x190353[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x712461['getSubjects'](_0x22642b);}})['then'](function(_0x4f10ef){if(_0x4f10ef){return _0x4f10ef?{'count':_0xb00776,'rows':_0x4f10ef}:null;}})[_0xb41b('0x20')](respondWithResult(_0x5adb82,null))[_0xb41b('0x3f')](handleError(_0x5adb82,null));};exports['getDescriptions']=function(_0x5286b4,_0x26ab5f,_0x30d200){var _0x4b8830={};var _0x22b7a9={};var _0x2c114c;var _0x951592;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x5286b4[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x26ab5f,null))[_0xb41b('0x20')](function(_0x539bba){if(_0x539bba){_0x2c114c=_0x539bba;_0x22b7a9[_0xb41b('0x2e')]=_[_0xb41b('0x4b')](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x22b7a9[_0xb41b('0x2c')]=_[_0xb41b('0x4b')](_0x5286b4[_0xb41b('0x2c')]);_0x22b7a9[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x22b7a9[_0xb41b('0x2e')],_0x22b7a9[_0xb41b('0x2c')]);_0x4b8830[_0xb41b('0x2f')]=_['intersection'](_0x22b7a9[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x4b8830[_0xb41b('0x2f')]=_0x4b8830[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x4b8830[_0xb41b('0x2f')]:_0x22b7a9[_0xb41b('0x2e')];_0x4b8830[_0xb41b('0x33')]=qs[_0xb41b('0x34')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x4b8830[_0xb41b('0x35')]=qs[_0xb41b('0x37')](_['pick'](_0x5286b4['query'],_0x22b7a9['filters']));if(_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x3a')]){_0x4b8830['where']=_[_0xb41b('0x38')](_0x4b8830['where'],{'$or':_[_0xb41b('0x26')](_0x4b8830[_0xb41b('0x2f')],function(_0x2746bb){var _0x574c26={};_0x574c26[_0x2746bb]={'$like':'%'+_0x5286b4['query'][_0xb41b('0x3a')]+'%'};return _0x574c26;})});}_0x4b8830=_['merge']({},_0x4b8830,_0x5286b4[_0xb41b('0x3b')]);return _0x2c114c[_0xb41b('0x4c')](_0x4b8830);}})['then'](function(_0xe01fbd){if(_0xe01fbd){_0x951592=_0xe01fbd['length'];if(!_0x5286b4[_0xb41b('0x2c')]['hasOwnProperty'](_0xb41b('0x32'))){_0x4b8830[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x5286b4['query'][_0xb41b('0x1a')]);_0x4b8830[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x2c114c[_0xb41b('0x4c')](_0x4b8830);}})[_0xb41b('0x20')](function(_0x10ab8e){if(_0x10ab8e){return _0x10ab8e?{'count':_0x951592,'rows':_0x10ab8e}:null;}})[_0xb41b('0x20')](respondWithResult(_0x26ab5f,null))[_0xb41b('0x3f')](handleError(_0x26ab5f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7fe4edf..e0a3ddb 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 _0x5fe9=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fe9,0x1e3));var _0x95fe=function(_0x6d141f,_0x35cead){_0x6d141f=_0x6d141f-0x0;var _0x56cd37=_0x5fe9[_0x6d141f];return _0x56cd37;};'use strict';var _=require(_0x95fe('0x0'));var util=require('util');var logger=require(_0x95fe('0x1'))('api');var moment=require(_0x95fe('0x2'));var BPromise=require(_0x95fe('0x3'));var rp=require(_0x95fe('0x4'));var fs=require('fs');var path=require(_0x95fe('0x5'));var rimraf=require(_0x95fe('0x6'));var config=require(_0x95fe('0x7'));var attributes=require(_0x95fe('0x8'));module[_0x95fe('0x9')]=function(_0x26dcf4,_0x1b4d9f){return _0x26dcf4[_0x95fe('0xa')](_0x95fe('0xb'),attributes,{'tableName':_0x95fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a0a=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','util'];(function(_0xa1126d,_0x2bcf58){var _0x224cbd=function(_0x3f0a24){while(--_0x3f0a24){_0xa1126d['push'](_0xa1126d['shift']());}};_0x224cbd(++_0x2bcf58);}(_0x6a0a,0x7d));var _0xa6a0=function(_0x4bb32f,_0x2217e){_0x4bb32f=_0x4bb32f-0x0;var _0x2dd6e6=_0x6a0a[_0x4bb32f];return _0x2dd6e6;};'use strict';var _=require('lodash');var util=require(_0xa6a0('0x0'));var logger=require('../../config/logger')(_0xa6a0('0x1'));var moment=require(_0xa6a0('0x2'));var BPromise=require('bluebird');var rp=require(_0xa6a0('0x3'));var fs=require('fs');var path=require(_0xa6a0('0x4'));var rimraf=require(_0xa6a0('0x5'));var config=require(_0xa6a0('0x6'));var attributes=require(_0xa6a0('0x7'));module['exports']=function(_0x500c27,_0x2a21a4){return _0x500c27[_0xa6a0('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 d3decb7..7e6b14a 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 _0x8620=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5983c2,_0x55c6b5){var _0xe3474a=function(_0x39a8e2){while(--_0x39a8e2){_0x5983c2['push'](_0x5983c2['shift']());}};_0xe3474a(++_0x55c6b5);}(_0x8620,0xe4));var _0x0862=function(_0x5e6dba,_0x26ef04){_0x5e6dba=_0x5e6dba-0x0;var _0x5eacbf=_0x8620[_0x5e6dba];return _0x5eacbf;};'use strict';var _=require(_0x0862('0x0'));var util=require(_0x0862('0x1'));var moment=require('moment');var BPromise=require(_0x0862('0x2'));var rs=require(_0x0862('0x3'));var fs=require('fs');var Redis=require(_0x0862('0x4'));var db=require(_0x0862('0x5'))['db'];var utils=require(_0x0862('0x6'));var logger=require('../../config/logger')(_0x0862('0x7'));var config=require(_0x0862('0x8'));var jayson=require(_0x0862('0x9'));var client=jayson[_0x0862('0xa')][_0x0862('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x305548,_0x480c80,_0x4530be){return new BPromise(function(_0x127a3b,_0x4b360f){return client[_0x0862('0xc')](_0x305548,_0x4530be)[_0x0862('0xd')](function(_0x1a3219){logger['info'](_0x0862('0xe'),_0x480c80,_0x0862('0xf'));logger[_0x0862('0x10')](_0x0862('0x11'),_0x480c80,'request\x20sent',JSON['stringify'](_0x1a3219));if(_0x1a3219[_0x0862('0x12')]){if(_0x1a3219[_0x0862('0x12')][_0x0862('0x13')]===0x1f4){logger[_0x0862('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x480c80,_0x1a3219['error'][_0x0862('0x14')]);return _0x4b360f(_0x1a3219['error'][_0x0862('0x14')]);}logger[_0x0862('0x12')](_0x0862('0xe'),_0x480c80,_0x1a3219['error'][_0x0862('0x14')]);return _0x127a3b(_0x1a3219[_0x0862('0x12')][_0x0862('0x14')]);}else{logger[_0x0862('0x15')](_0x0862('0xe'),_0x480c80,'request\x20sent');_0x127a3b(_0x1a3219['result'][_0x0862('0x14')]);}})['catch'](function(_0x352031){logger[_0x0862('0x12')](_0x0862('0xe'),_0x480c80,_0x352031);_0x4b360f(_0x352031);});});} \ No newline at end of file +var _0xf158=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5a0cb1,_0x29729c){var _0x419d9c=function(_0x594f0b){while(--_0x594f0b){_0x5a0cb1['push'](_0x5a0cb1['shift']());}};_0x419d9c(++_0x29729c);}(_0xf158,0x11c));var _0x8f15=function(_0xd9ac69,_0x28c02c){_0xd9ac69=_0xd9ac69-0x0;var _0x411264=_0xf158[_0xd9ac69];return _0x411264;};'use strict';var _=require(_0x8f15('0x0'));var util=require(_0x8f15('0x1'));var moment=require('moment');var BPromise=require(_0x8f15('0x2'));var rs=require(_0x8f15('0x3'));var fs=require('fs');var Redis=require(_0x8f15('0x4'));var db=require(_0x8f15('0x5'))['db'];var utils=require(_0x8f15('0x6'));var logger=require(_0x8f15('0x7'))(_0x8f15('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f15('0x9'));var client=jayson[_0x8f15('0xa')][_0x8f15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b45e,_0x163b08,_0x4e405c){return new BPromise(function(_0x29f8cd,_0x433e4e){return client[_0x8f15('0xc')](_0x52b45e,_0x4e405c)['then'](function(_0x45924c){logger['info'](_0x8f15('0xd'),_0x163b08,_0x8f15('0xe'));logger['debug'](_0x8f15('0xf'),_0x163b08,_0x8f15('0xe'),JSON[_0x8f15('0x10')](_0x45924c));if(_0x45924c[_0x8f15('0x11')]){if(_0x45924c[_0x8f15('0x11')][_0x8f15('0x12')]===0x1f4){logger[_0x8f15('0x11')](_0x8f15('0xd'),_0x163b08,_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);return _0x433e4e(_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);}logger[_0x8f15('0x11')](_0x8f15('0xd'),_0x163b08,_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);return _0x29f8cd(_0x45924c[_0x8f15('0x11')]['message']);}else{logger[_0x8f15('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x163b08,'request\x20sent');_0x29f8cd(_0x45924c['result'][_0x8f15('0x13')]);}})[_0x8f15('0x15')](function(_0x14fe00){logger['error'](_0x8f15('0xd'),_0x163b08,_0x14fe00);_0x433e4e(_0x14fe00);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1eb7eab..983c3d6 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 _0x6e57=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','update','delete','destroy'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0x6e57,0x1cb));var _0x76e5=function(_0x4ebb94,_0xaa8481){_0x4ebb94=_0x4ebb94-0x0;var _0x5b3a72=_0x6e57[_0x4ebb94];return _0x5b3a72;};'use strict';var multer=require('multer');var util=require(_0x76e5('0x0'));var path=require(_0x76e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x76e5('0x2'));var router=express[_0x76e5('0x3')]();var fs_extra=require(_0x76e5('0x4'));var auth=require(_0x76e5('0x5'));var interaction=require(_0x76e5('0x6'));var config=require(_0x76e5('0x7'));var controller=require(_0x76e5('0x8'));router[_0x76e5('0x9')]('/',auth['isAuthenticated'](),controller[_0x76e5('0xa')]);router[_0x76e5('0x9')](_0x76e5('0xb'),auth[_0x76e5('0xc')](),controller[_0x76e5('0xd')]);router['post']('/',auth[_0x76e5('0xc')](),controller['create']);router['put']('/:id',auth[_0x76e5('0xc')](),controller[_0x76e5('0xe')]);router[_0x76e5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x76e5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf287=['Router','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','util','path','connect-timeout','express'];(function(_0xcd9559,_0xa22f6a){var _0x35de0b=function(_0x54d465){while(--_0x54d465){_0xcd9559['push'](_0xcd9559['shift']());}};_0x35de0b(++_0xa22f6a);}(_0xf287,0x9c));var _0x7f28=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf287[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x7f28('0x0'));var path=require(_0x7f28('0x1'));var timeout=require(_0x7f28('0x2'));var express=require(_0x7f28('0x3'));var router=express[_0x7f28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f28('0x5'));var config=require('../../config/environment');var controller=require(_0x7f28('0x6'));router[_0x7f28('0x7')]('/',auth[_0x7f28('0x8')](),controller[_0x7f28('0x9')]);router[_0x7f28('0x7')](_0x7f28('0xa'),auth[_0x7f28('0x8')](),controller[_0x7f28('0xb')]);router['post']('/',auth[_0x7f28('0x8')](),controller[_0x7f28('0xc')]);router[_0x7f28('0xd')]('/:id',auth[_0x7f28('0x8')](),controller[_0x7f28('0xe')]);router['delete']('/:id',auth[_0x7f28('0x8')](),controller['destroy']);module[_0x7f28('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index cc6d028..d5d1ff6 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 _0xaa87=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x1b0e06,_0x799bcf){var _0x3e797f=function(_0x1aaf5f){while(--_0x1aaf5f){_0x1b0e06['push'](_0x1b0e06['shift']());}};_0x3e797f(++_0x799bcf);}(_0xaa87,0xec));var _0x7aa8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xaa87[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x7aa8('0x0'));module[_0x7aa8('0x1')]={'type':{'type':Sequelize[_0x7aa8('0x2')](_0x7aa8('0x3'),_0x7aa8('0x4'),'customVariable',_0x7aa8('0x5'),'picklist'),'defaultValue':_0x7aa8('0x3')},'content':{'type':Sequelize[_0x7aa8('0x6')]},'key':{'type':Sequelize[_0x7aa8('0x6')]},'keyType':{'type':Sequelize[_0x7aa8('0x2')](_0x7aa8('0x3'),_0x7aa8('0x4'),_0x7aa8('0x7'))},'keyContent':{'type':Sequelize[_0x7aa8('0x6')]},'idField':{'type':Sequelize[_0x7aa8('0x6')]},'nameField':{'type':Sequelize[_0x7aa8('0x6')]},'customField':{'type':Sequelize[_0x7aa8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7aa8('0x6')]}}; \ No newline at end of file +var _0xf853=['variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf853,0x12b));var _0x3f85=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xf853[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0x3f85('0x0'));module['exports']={'type':{'type':Sequelize[_0x3f85('0x1')](_0x3f85('0x2'),'variable',_0x3f85('0x3'),_0x3f85('0x4'),_0x3f85('0x5')),'defaultValue':_0x3f85('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3f85('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3f85('0x7'),_0x3f85('0x3'))},'keyContent':{'type':Sequelize[_0x3f85('0x6')]},'idField':{'type':Sequelize[_0x3f85('0x6')]},'nameField':{'type':Sequelize[_0x3f85('0x6')]},'customField':{'type':Sequelize[_0x3f85('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f85('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5a7eab8..1f5cd40 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 _0xe1ef=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe1ef,0x1e8));var _0xfe1e=function(_0x438feb,_0x38e592){_0x438feb=_0x438feb-0x0;var _0x24de5d=_0xe1ef[_0x438feb];return _0x24de5d;};'use strict';var emlformat=require(_0xfe1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe1e('0x1'));var jsonpatch=require(_0xfe1e('0x2'));var rp=require(_0xfe1e('0x3'));var moment=require(_0xfe1e('0x4'));var BPromise=require(_0xfe1e('0x5'));var Mustache=require('mustache');var util=require(_0xfe1e('0x6'));var path=require(_0xfe1e('0x7'));var sox=require(_0xfe1e('0x8'));var csv=require(_0xfe1e('0x9'));var ejs=require(_0xfe1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe1e('0xb'));var squel=require(_0xfe1e('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe1e('0xd'));var deskjs=require(_0xfe1e('0xe'));var toCsv=require(_0xfe1e('0x9'));var querystring=require(_0xfe1e('0xf'));var Papa=require('papaparse');var Redis=require(_0xfe1e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfe1e('0x11'));var as=require(_0xfe1e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe1e('0x13'));var utils=require('../../config/utils');var config=require(_0xfe1e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe1e('0x15'))['db'];function respondWithStatusCode(_0x42982d,_0x208da4){_0x208da4=_0x208da4||0xcc;return function(_0x2bfcf6){if(_0x2bfcf6){return _0x42982d[_0xfe1e('0x16')](_0x208da4);}return _0x42982d[_0xfe1e('0x17')](_0x208da4)['end']();};}function respondWithResult(_0x50e5b6,_0x147488){_0x147488=_0x147488||0xc8;return function(_0x1e834f){if(_0x1e834f){return _0x50e5b6[_0xfe1e('0x17')](_0x147488)[_0xfe1e('0x18')](_0x1e834f);}};}function respondWithFilteredResult(_0x4820fa,_0x105832){return function(_0x4a3c80){if(_0x4a3c80){var _0x2a43e8=typeof _0x105832[_0xfe1e('0x19')]===_0xfe1e('0x1a')&&typeof _0x105832[_0xfe1e('0x1b')]===_0xfe1e('0x1a');var _0x48e691=_0x4a3c80[_0xfe1e('0x1c')];var _0x5a38d7=_0x2a43e8?0x0:_0x105832['offset'];var _0x12c356=_0x2a43e8?_0x4a3c80['count']:_0x105832['offset']+_0x105832[_0xfe1e('0x1b')];var _0x16d54;if(_0x12c356>=_0x48e691){_0x12c356=_0x48e691;_0x16d54=0xc8;}else{_0x16d54=0xce;}_0x4820fa[_0xfe1e('0x17')](_0x16d54);return _0x4820fa[_0xfe1e('0x1d')]('Content-Range',_0x5a38d7+'-'+_0x12c356+'/'+_0x48e691)[_0xfe1e('0x18')](_0x4a3c80);}return null;};}function patchUpdates(_0x21245a){return function(_0x3d0024){try{jsonpatch['apply'](_0x3d0024,_0x21245a,!![]);}catch(_0x224e74){return BPromise[_0xfe1e('0x1e')](_0x224e74);}return _0x3d0024[_0xfe1e('0x1f')]();};}function saveUpdates(_0x2075b3,_0x2cda7f){return function(_0x415cd1){if(_0x415cd1){return _0x415cd1[_0xfe1e('0x20')](_0x2075b3)[_0xfe1e('0x21')](function(_0x14dcf8){return _0x14dcf8;});}return null;};}function removeEntity(_0x5ee8ef,_0x1b499a){return function(_0x3c1910){if(_0x3c1910){return _0x3c1910[_0xfe1e('0x22')]()[_0xfe1e('0x21')](function(){_0x5ee8ef[_0xfe1e('0x17')](0xcc)[_0xfe1e('0x23')]();});}};}function handleEntityNotFound(_0x82c2f,_0x5ba574){return function(_0x2b3c9a){if(!_0x2b3c9a){_0x82c2f[_0xfe1e('0x16')](0x194);}return _0x2b3c9a;};}function handleError(_0x26d308,_0xbc25b3){_0xbc25b3=_0xbc25b3||0x1f4;return function(_0x1d808e){logger['error'](_0x1d808e[_0xfe1e('0x24')]);if(_0x1d808e[_0xfe1e('0x25')]){delete _0x1d808e[_0xfe1e('0x25')];}_0x26d308[_0xfe1e('0x17')](_0xbc25b3)[_0xfe1e('0x26')](_0x1d808e);};}exports[_0xfe1e('0x27')]=function(_0x2b17eb,_0x5b35e0){var _0x15abac={},_0x203af7={},_0x2b4270={'count':0x0,'rows':[]};var _0x2f6c83=_[_0xfe1e('0x28')](db[_0xfe1e('0x29')]['rawAttributes'],function(_0x17b4eb){return{'name':_0x17b4eb[_0xfe1e('0x2a')],'type':_0x17b4eb[_0xfe1e('0x2b')][_0xfe1e('0x2c')]};});_0x203af7[_0xfe1e('0x2d')]=_[_0xfe1e('0x28')](_0x2f6c83,_0xfe1e('0x25'));_0x203af7[_0xfe1e('0x2e')]=_[_0xfe1e('0x2f')](_0x2b17eb[_0xfe1e('0x2e')]);_0x203af7[_0xfe1e('0x30')]=_[_0xfe1e('0x31')](_0x203af7['model'],_0x203af7[_0xfe1e('0x2e')]);_0x15abac[_0xfe1e('0x32')]=_[_0xfe1e('0x31')](_0x203af7['model'],qs[_0xfe1e('0x33')](_0x2b17eb['query']['fields']));_0x15abac[_0xfe1e('0x32')]=_0x15abac[_0xfe1e('0x32')]['length']?_0x15abac[_0xfe1e('0x32')]:_0x203af7[_0xfe1e('0x2d')];if(!_0x2b17eb[_0xfe1e('0x2e')][_0xfe1e('0x34')](_0xfe1e('0x35'))){_0x15abac[_0xfe1e('0x1b')]=qs[_0xfe1e('0x1b')](_0x2b17eb['query'][_0xfe1e('0x1b')]);_0x15abac[_0xfe1e('0x19')]=qs[_0xfe1e('0x19')](_0x2b17eb['query']['offset']);}_0x15abac['order']=qs[_0xfe1e('0x36')](_0x2b17eb['query'][_0xfe1e('0x36')]);_0x15abac['where']=qs[_0xfe1e('0x30')](_[_0xfe1e('0x37')](_0x2b17eb['query'],_0x203af7[_0xfe1e('0x30')]),_0x2f6c83);if(_0x2b17eb['query'][_0xfe1e('0x38')]){_0x15abac['where']=_[_0xfe1e('0x39')](_0x15abac[_0xfe1e('0x3a')],{'$or':_[_0xfe1e('0x28')](_0x2f6c83,function(_0x5e037a){if(_0x5e037a['type']!==_0xfe1e('0x3b')){var _0x311d86={};_0x311d86[_0x5e037a[_0xfe1e('0x25')]]={'$like':'%'+_0x2b17eb[_0xfe1e('0x2e')]['filter']+'%'};return _0x311d86;}})});}_0x15abac=_['merge']({},_0x15abac,_0x2b17eb[_0xfe1e('0x3c')]);var _0x1b00bb={'where':_0x15abac[_0xfe1e('0x3a')]};return db[_0xfe1e('0x29')][_0xfe1e('0x1c')](_0x1b00bb)[_0xfe1e('0x21')](function(_0x490faa){_0x2b4270[_0xfe1e('0x1c')]=_0x490faa;if(_0x2b17eb['query'][_0xfe1e('0x3d')]){_0x15abac[_0xfe1e('0x3e')]=[{'all':!![]}];}return db[_0xfe1e('0x29')][_0xfe1e('0x3f')](_0x15abac);})[_0xfe1e('0x21')](function(_0x4cf33e){_0x2b4270[_0xfe1e('0x40')]=_0x4cf33e;return _0x2b4270;})[_0xfe1e('0x21')](respondWithFilteredResult(_0x5b35e0,_0x15abac))[_0xfe1e('0x41')](handleError(_0x5b35e0,null));};exports['show']=function(_0x1798bf,_0x5ce017){var _0x3646b5={'raw':!![],'where':{'id':_0x1798bf[_0xfe1e('0x42')]['id']}},_0x4a581e={};_0x4a581e[_0xfe1e('0x2d')]=_[_0xfe1e('0x2f')](db[_0xfe1e('0x29')][_0xfe1e('0x43')]);_0x4a581e[_0xfe1e('0x2e')]=_[_0xfe1e('0x2f')](_0x1798bf[_0xfe1e('0x2e')]);_0x4a581e['filters']=_[_0xfe1e('0x31')](_0x4a581e['model'],_0x4a581e['query']);_0x3646b5[_0xfe1e('0x32')]=_[_0xfe1e('0x31')](_0x4a581e[_0xfe1e('0x2d')],qs['fields'](_0x1798bf[_0xfe1e('0x2e')][_0xfe1e('0x33')]));_0x3646b5[_0xfe1e('0x32')]=_0x3646b5[_0xfe1e('0x32')][_0xfe1e('0x44')]?_0x3646b5[_0xfe1e('0x32')]:_0x4a581e['model'];if(_0x1798bf[_0xfe1e('0x2e')][_0xfe1e('0x3d')]){_0x3646b5[_0xfe1e('0x3e')]=[{'all':!![]}];}_0x3646b5=_[_0xfe1e('0x39')]({},_0x3646b5,_0x1798bf[_0xfe1e('0x3c')]);return db['SugarcrmField'][_0xfe1e('0x45')](_0x3646b5)[_0xfe1e('0x21')](handleEntityNotFound(_0x5ce017,null))[_0xfe1e('0x21')](respondWithResult(_0x5ce017,null))[_0xfe1e('0x41')](handleError(_0x5ce017,null));};exports[_0xfe1e('0x46')]=function(_0x42cc0a,_0xf554e3){return db[_0xfe1e('0x29')]['create'](_0x42cc0a[_0xfe1e('0x47')],{})['then'](respondWithResult(_0xf554e3,0xc9))[_0xfe1e('0x41')](handleError(_0xf554e3,null));};exports['update']=function(_0x1c598a,_0x3b5119){if(_0x1c598a[_0xfe1e('0x47')]['id']){delete _0x1c598a[_0xfe1e('0x47')]['id'];}return db[_0xfe1e('0x29')][_0xfe1e('0x45')]({'where':{'id':_0x1c598a[_0xfe1e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b5119,null))[_0xfe1e('0x21')](saveUpdates(_0x1c598a['body'],null))[_0xfe1e('0x21')](respondWithResult(_0x3b5119,null))[_0xfe1e('0x41')](handleError(_0x3b5119,null));};exports[_0xfe1e('0x22')]=function(_0x4f4a3c,_0x4af5a4){return db[_0xfe1e('0x29')][_0xfe1e('0x45')]({'where':{'id':_0x4f4a3c[_0xfe1e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4af5a4,null))[_0xfe1e('0x21')](removeEntity(_0x4af5a4,null))[_0xfe1e('0x41')](handleError(_0x4af5a4,null));}; \ No newline at end of file +var _0x60b4=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','then','show','params','rawAttributes','includeAll','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','error','stack','name','send','index','SugarcrmField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3ad9ae,_0x438393){var _0x3dc8c2=function(_0x4b6186){while(--_0x4b6186){_0x3ad9ae['push'](_0x3ad9ae['shift']());}};_0x3dc8c2(++_0x438393);}(_0x60b4,0x19b));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x460b('0x0'));var zipdir=require(_0x460b('0x1'));var jsonpatch=require(_0x460b('0x2'));var rp=require(_0x460b('0x3'));var moment=require(_0x460b('0x4'));var BPromise=require(_0x460b('0x5'));var Mustache=require(_0x460b('0x6'));var util=require(_0x460b('0x7'));var path=require(_0x460b('0x8'));var sox=require('sox');var csv=require(_0x460b('0x9'));var ejs=require(_0x460b('0xa'));var fs=require('fs');var fs_extra=require(_0x460b('0xb'));var _=require(_0x460b('0xc'));var squel=require(_0x460b('0xd'));var crypto=require(_0x460b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x460b('0xf'));var toCsv=require(_0x460b('0x9'));var querystring=require(_0x460b('0x10'));var Papa=require('papaparse');var Redis=require(_0x460b('0x11'));var authService=require(_0x460b('0x12'));var qs=require(_0x460b('0x13'));var as=require(_0x460b('0x14'));var hardwareService=require(_0x460b('0x15'));var logger=require(_0x460b('0x16'))(_0x460b('0x17'));var utils=require('../../config/utils');var config=require(_0x460b('0x18'));var licenseUtil=require(_0x460b('0x19'));var db=require(_0x460b('0x1a'))['db'];function respondWithStatusCode(_0x3737b7,_0x49fd8f){_0x49fd8f=_0x49fd8f||0xcc;return function(_0x21f083){if(_0x21f083){return _0x3737b7[_0x460b('0x1b')](_0x49fd8f);}return _0x3737b7[_0x460b('0x1c')](_0x49fd8f)[_0x460b('0x1d')]();};}function respondWithResult(_0x412d91,_0x336824){_0x336824=_0x336824||0xc8;return function(_0x25691d){if(_0x25691d){return _0x412d91[_0x460b('0x1c')](_0x336824)[_0x460b('0x1e')](_0x25691d);}};}function respondWithFilteredResult(_0x388caf,_0x381823){return function(_0x36c46f){if(_0x36c46f){var _0x295633=typeof _0x381823[_0x460b('0x1f')]===_0x460b('0x20')&&typeof _0x381823[_0x460b('0x21')]===_0x460b('0x20');var _0x37aadc=_0x36c46f[_0x460b('0x22')];var _0x13b77a=_0x295633?0x0:_0x381823[_0x460b('0x1f')];var _0x3cf274=_0x295633?_0x36c46f[_0x460b('0x22')]:_0x381823[_0x460b('0x1f')]+_0x381823[_0x460b('0x21')];var _0x5c3574;if(_0x3cf274>=_0x37aadc){_0x3cf274=_0x37aadc;_0x5c3574=0xc8;}else{_0x5c3574=0xce;}_0x388caf[_0x460b('0x1c')](_0x5c3574);return _0x388caf['set']('Content-Range',_0x13b77a+'-'+_0x3cf274+'/'+_0x37aadc)[_0x460b('0x1e')](_0x36c46f);}return null;};}function patchUpdates(_0x419c19){return function(_0x5da555){try{jsonpatch[_0x460b('0x23')](_0x5da555,_0x419c19,!![]);}catch(_0x454272){return BPromise['reject'](_0x454272);}return _0x5da555['save']();};}function saveUpdates(_0x4ce7b4,_0x1cfb9c){return function(_0x468ce4){if(_0x468ce4){return _0x468ce4[_0x460b('0x24')](_0x4ce7b4)['then'](function(_0x357967){return _0x357967;});}return null;};}function removeEntity(_0xdf6253,_0x3a5855){return function(_0x3511de){if(_0x3511de){return _0x3511de['destroy']()['then'](function(){_0xdf6253[_0x460b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x272a56,_0x2579bd){return function(_0x4074f1){if(!_0x4074f1){_0x272a56[_0x460b('0x1b')](0x194);}return _0x4074f1;};}function handleError(_0x142bcb,_0x405af3){_0x405af3=_0x405af3||0x1f4;return function(_0x4c1101){logger[_0x460b('0x25')](_0x4c1101[_0x460b('0x26')]);if(_0x4c1101['name']){delete _0x4c1101[_0x460b('0x27')];}_0x142bcb[_0x460b('0x1c')](_0x405af3)[_0x460b('0x28')](_0x4c1101);};}exports[_0x460b('0x29')]=function(_0x2e760b,_0x34311d){var _0x14ebbd={},_0x5b6619={},_0xeacf0e={'count':0x0,'rows':[]};var _0x18abfe=_['map'](db[_0x460b('0x2a')]['rawAttributes'],function(_0x34e1ec){return{'name':_0x34e1ec[_0x460b('0x2b')],'type':_0x34e1ec[_0x460b('0x2c')][_0x460b('0x2d')]};});_0x5b6619[_0x460b('0x2e')]=_[_0x460b('0x2f')](_0x18abfe,_0x460b('0x27'));_0x5b6619[_0x460b('0x30')]=_[_0x460b('0x31')](_0x2e760b[_0x460b('0x30')]);_0x5b6619[_0x460b('0x32')]=_[_0x460b('0x33')](_0x5b6619[_0x460b('0x2e')],_0x5b6619[_0x460b('0x30')]);_0x14ebbd[_0x460b('0x34')]=_[_0x460b('0x33')](_0x5b6619[_0x460b('0x2e')],qs[_0x460b('0x35')](_0x2e760b[_0x460b('0x30')][_0x460b('0x35')]));_0x14ebbd[_0x460b('0x34')]=_0x14ebbd['attributes'][_0x460b('0x36')]?_0x14ebbd['attributes']:_0x5b6619[_0x460b('0x2e')];if(!_0x2e760b[_0x460b('0x30')][_0x460b('0x37')](_0x460b('0x38'))){_0x14ebbd[_0x460b('0x21')]=qs[_0x460b('0x21')](_0x2e760b[_0x460b('0x30')]['limit']);_0x14ebbd[_0x460b('0x1f')]=qs[_0x460b('0x1f')](_0x2e760b['query']['offset']);}_0x14ebbd[_0x460b('0x39')]=qs[_0x460b('0x3a')](_0x2e760b[_0x460b('0x30')]['sort']);_0x14ebbd[_0x460b('0x3b')]=qs[_0x460b('0x32')](_[_0x460b('0x3c')](_0x2e760b[_0x460b('0x30')],_0x5b6619[_0x460b('0x32')]),_0x18abfe);if(_0x2e760b[_0x460b('0x30')][_0x460b('0x3d')]){_0x14ebbd[_0x460b('0x3b')]=_[_0x460b('0x3e')](_0x14ebbd[_0x460b('0x3b')],{'$or':_[_0x460b('0x2f')](_0x18abfe,function(_0x49edc7){if(_0x49edc7['type']!==_0x460b('0x3f')){var _0x3af237={};_0x3af237[_0x49edc7['name']]={'$like':'%'+_0x2e760b[_0x460b('0x30')][_0x460b('0x3d')]+'%'};return _0x3af237;}})});}_0x14ebbd=_[_0x460b('0x3e')]({},_0x14ebbd,_0x2e760b[_0x460b('0x40')]);var _0x23365b={'where':_0x14ebbd[_0x460b('0x3b')]};return db[_0x460b('0x2a')][_0x460b('0x22')](_0x23365b)['then'](function(_0x3e3a41){_0xeacf0e['count']=_0x3e3a41;if(_0x2e760b[_0x460b('0x30')]['includeAll']){_0x14ebbd[_0x460b('0x41')]=[{'all':!![]}];}return db[_0x460b('0x2a')][_0x460b('0x42')](_0x14ebbd);})['then'](function(_0x2f7633){_0xeacf0e[_0x460b('0x43')]=_0x2f7633;return _0xeacf0e;})[_0x460b('0x44')](respondWithFilteredResult(_0x34311d,_0x14ebbd))['catch'](handleError(_0x34311d,null));};exports[_0x460b('0x45')]=function(_0x205f3f,_0x27dee7){var _0x3640ed={'raw':!![],'where':{'id':_0x205f3f[_0x460b('0x46')]['id']}},_0x3cde41={};_0x3cde41[_0x460b('0x2e')]=_[_0x460b('0x31')](db['SugarcrmField'][_0x460b('0x47')]);_0x3cde41[_0x460b('0x30')]=_[_0x460b('0x31')](_0x205f3f[_0x460b('0x30')]);_0x3cde41[_0x460b('0x32')]=_['intersection'](_0x3cde41[_0x460b('0x2e')],_0x3cde41[_0x460b('0x30')]);_0x3640ed[_0x460b('0x34')]=_[_0x460b('0x33')](_0x3cde41['model'],qs[_0x460b('0x35')](_0x205f3f['query'][_0x460b('0x35')]));_0x3640ed['attributes']=_0x3640ed['attributes'][_0x460b('0x36')]?_0x3640ed[_0x460b('0x34')]:_0x3cde41[_0x460b('0x2e')];if(_0x205f3f[_0x460b('0x30')][_0x460b('0x48')]){_0x3640ed[_0x460b('0x41')]=[{'all':!![]}];}_0x3640ed=_['merge']({},_0x3640ed,_0x205f3f[_0x460b('0x40')]);return db[_0x460b('0x2a')][_0x460b('0x49')](_0x3640ed)['then'](handleEntityNotFound(_0x27dee7,null))['then'](respondWithResult(_0x27dee7,null))[_0x460b('0x4a')](handleError(_0x27dee7,null));};exports[_0x460b('0x4b')]=function(_0x209f78,_0x18fd5e){return db[_0x460b('0x2a')][_0x460b('0x4b')](_0x209f78[_0x460b('0x4c')],{})[_0x460b('0x44')](respondWithResult(_0x18fd5e,0xc9))[_0x460b('0x4a')](handleError(_0x18fd5e,null));};exports[_0x460b('0x24')]=function(_0x21e055,_0x106683){if(_0x21e055[_0x460b('0x4c')]['id']){delete _0x21e055['body']['id'];}return db[_0x460b('0x2a')][_0x460b('0x49')]({'where':{'id':_0x21e055[_0x460b('0x46')]['id']}})['then'](handleEntityNotFound(_0x106683,null))[_0x460b('0x44')](saveUpdates(_0x21e055[_0x460b('0x4c')],null))['then'](respondWithResult(_0x106683,null))[_0x460b('0x4a')](handleError(_0x106683,null));};exports[_0x460b('0x4d')]=function(_0x29f440,_0xc9383e){return db[_0x460b('0x2a')][_0x460b('0x49')]({'where':{'id':_0x29f440[_0x460b('0x46')]['id']}})[_0x460b('0x44')](handleEntityNotFound(_0xc9383e,null))[_0x460b('0x44')](removeEntity(_0xc9383e,null))['catch'](handleError(_0xc9383e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index df1db1d..8b32a4b 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 _0xda45=['rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1a127a,_0x42f6e6){var _0x2a724b=function(_0x23e765){while(--_0x23e765){_0x1a127a['push'](_0x1a127a['shift']());}};_0x2a724b(++_0x42f6e6);}(_0xda45,0x94));var _0x5da4=function(_0x5b108f,_0x1d9448){_0x5b108f=_0x5b108f-0x0;var _0xf32ff5=_0xda45[_0x5b108f];return _0xf32ff5;};'use strict';var _=require(_0x5da4('0x0'));var util=require(_0x5da4('0x1'));var logger=require(_0x5da4('0x2'))(_0x5da4('0x3'));var moment=require('moment');var BPromise=require(_0x5da4('0x4'));var rp=require(_0x5da4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5da4('0x6'));var config=require(_0x5da4('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x5da4('0x8')]=function(_0x5a0ff4,_0x328c49){return _0x5a0ff4[_0x5da4('0x9')](_0x5da4('0xa'),attributes,{'tableName':_0x5da4('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x5da4('0xc'),_0x5da4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6173=['../../config/logger','api','moment','bluebird','request-promise','rimraf','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x3ed98f,_0x56e4){var _0x420125=function(_0x1bd919){while(--_0x1bd919){_0x3ed98f['push'](_0x3ed98f['shift']());}};_0x420125(++_0x56e4);}(_0x6173,0x81));var _0x3617=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6173[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3617('0x0'));var util=require('util');var logger=require(_0x3617('0x1'))(_0x3617('0x2'));var moment=require(_0x3617('0x3'));var BPromise=require(_0x3617('0x4'));var rp=require(_0x3617('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3617('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2e2607,_0x7846c0){return _0x2e2607[_0x3617('0x7')](_0x3617('0x8'),attributes,{'tableName':_0x3617('0x9'),'paranoid':![],'indexes':[{'name':_0x3617('0xa'),'fields':[_0x3617('0xb'),_0x3617('0xc')],'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 bdadf35..ea38d9b 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 _0xdd8f=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x202f73,_0x5bd0ee){var _0x2719e9=function(_0x40b7a2){while(--_0x40b7a2){_0x202f73['push'](_0x202f73['shift']());}};_0x2719e9(++_0x5bd0ee);}(_0xdd8f,0x184));var _0xfdd8=function(_0x81f9b3,_0x8a608a){_0x81f9b3=_0x81f9b3-0x0;var _0x2cfe71=_0xdd8f[_0x81f9b3];return _0x2cfe71;};'use strict';var _=require(_0xfdd8('0x0'));var util=require(_0xfdd8('0x1'));var moment=require(_0xfdd8('0x2'));var BPromise=require(_0xfdd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdd8('0x4'));var db=require(_0xfdd8('0x5'))['db'];var utils=require(_0xfdd8('0x6'));var logger=require(_0xfdd8('0x7'))(_0xfdd8('0x8'));var config=require(_0xfdd8('0x9'));var jayson=require(_0xfdd8('0xa'));var client=jayson[_0xfdd8('0xb')][_0xfdd8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3245b8,_0x48cdca,_0x14d7de){return new BPromise(function(_0x52fb7d,_0x165b75){return client[_0xfdd8('0xd')](_0x3245b8,_0x14d7de)['then'](function(_0xdb5d9e){logger[_0xfdd8('0xe')](_0xfdd8('0xf'),_0x48cdca,_0xfdd8('0x10'));logger[_0xfdd8('0x11')](_0xfdd8('0x12'),_0x48cdca,_0xfdd8('0x10'),JSON[_0xfdd8('0x13')](_0xdb5d9e));if(_0xdb5d9e['error']){if(_0xdb5d9e[_0xfdd8('0x14')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x48cdca,_0xdb5d9e[_0xfdd8('0x14')][_0xfdd8('0x15')]);return _0x165b75(_0xdb5d9e['error'][_0xfdd8('0x15')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x48cdca,_0xdb5d9e['error'][_0xfdd8('0x15')]);return _0x52fb7d(_0xdb5d9e[_0xfdd8('0x14')][_0xfdd8('0x15')]);}else{logger[_0xfdd8('0xe')](_0xfdd8('0xf'),_0x48cdca,'request\x20sent');_0x52fb7d(_0xdb5d9e[_0xfdd8('0x16')]['message']);}})[_0xfdd8('0x17')](function(_0x18e6dd){logger['error'](_0xfdd8('0xf'),_0x48cdca,_0x18e6dd);_0x165b75(_0x18e6dd);});});} \ No newline at end of file +var _0xbfde=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x4d6bb9,_0x5b2248){var _0x3d4596=function(_0x230f0f){while(--_0x230f0f){_0x4d6bb9['push'](_0x4d6bb9['shift']());}};_0x3d4596(++_0x5b2248);}(_0xbfde,0xd4));var _0xebfd=function(_0x45bd5d,_0x22d27c){_0x45bd5d=_0x45bd5d-0x0;var _0x5c7636=_0xbfde[_0x45bd5d];return _0x5c7636;};'use strict';var _=require(_0xebfd('0x0'));var util=require(_0xebfd('0x1'));var moment=require(_0xebfd('0x2'));var BPromise=require(_0xebfd('0x3'));var rs=require(_0xebfd('0x4'));var fs=require('fs');var Redis=require(_0xebfd('0x5'));var db=require(_0xebfd('0x6'))['db'];var utils=require(_0xebfd('0x7'));var logger=require(_0xebfd('0x8'))(_0xebfd('0x9'));var config=require(_0xebfd('0xa'));var jayson=require(_0xebfd('0xb'));var client=jayson['client'][_0xebfd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549dd2,_0x26733e,_0x194cb1){return new BPromise(function(_0x22b187,_0x2aaf8e){return client[_0xebfd('0xd')](_0x549dd2,_0x194cb1)[_0xebfd('0xe')](function(_0x3583ca){logger[_0xebfd('0xf')](_0xebfd('0x10'),_0x26733e,_0xebfd('0x11'));logger[_0xebfd('0x12')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x26733e,'request\x20sent',JSON[_0xebfd('0x13')](_0x3583ca));if(_0x3583ca[_0xebfd('0x14')]){if(_0x3583ca[_0xebfd('0x14')][_0xebfd('0x15')]===0x1f4){logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x3583ca[_0xebfd('0x14')][_0xebfd('0x16')]);return _0x2aaf8e(_0x3583ca[_0xebfd('0x14')]['message']);}logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x3583ca[_0xebfd('0x14')][_0xebfd('0x16')]);return _0x22b187(_0x3583ca['error'][_0xebfd('0x16')]);}else{logger[_0xebfd('0xf')](_0xebfd('0x10'),_0x26733e,_0xebfd('0x11'));_0x22b187(_0x3583ca[_0xebfd('0x17')][_0xebfd('0x16')]);}})['catch'](function(_0x10a0f6){logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x10a0f6);_0x2aaf8e(_0x10a0f6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 28924be..54d3464 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 _0xe6c1=['../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','fs-extra'];(function(_0x2c1cc2,_0xc7f2c2){var _0x3abecc=function(_0x179329){while(--_0x179329){_0x2c1cc2['push'](_0x2c1cc2['shift']());}};_0x3abecc(++_0xc7f2c2);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x1e6c('0x0'));var path=require(_0x1e6c('0x1'));var timeout=require(_0x1e6c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e6c('0x3'));var auth=require(_0x1e6c('0x4'));var interaction=require(_0x1e6c('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1e6c('0x6')]);router[_0x1e6c('0x7')](_0x1e6c('0x8'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xa')]);router[_0x1e6c('0x7')](_0x1e6c('0xb'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xc')]);router[_0x1e6c('0x7')](_0x1e6c('0xd'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0xe')]);router[_0x1e6c('0xf')]('/',auth[_0x1e6c('0x9')](),controller[_0x1e6c('0x10')]);router[_0x1e6c('0xf')](_0x1e6c('0xb'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0x11')]);router[_0x1e6c('0x12')]('/:id',auth[_0x1e6c('0x9')](),controller[_0x1e6c('0x13')]);router['delete'](_0x1e6c('0x8'),auth[_0x1e6c('0x9')](),controller[_0x1e6c('0x14')]);module[_0x1e6c('0x15')]=router; \ No newline at end of file +var _0xda65=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x3fb31f,_0x465f4a){var _0x263d6e=function(_0x1a765d){while(--_0x1a765d){_0x3fb31f['push'](_0x3fb31f['shift']());}};_0x263d6e(++_0x465f4a);}(_0xda65,0x1d0));var _0x5da6=function(_0x3e2cc4,_0x2f5b0a){_0x3e2cc4=_0x3e2cc4-0x0;var _0x2ceff6=_0xda65[_0x3e2cc4];return _0x2ceff6;};'use strict';var multer=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var path=require(_0x5da6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5da6('0x3'));var router=express[_0x5da6('0x4')]();var fs_extra=require(_0x5da6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5da6('0x6'));var controller=require(_0x5da6('0x7'));router[_0x5da6('0x8')]('/',auth[_0x5da6('0x9')](),controller[_0x5da6('0xa')]);router['get'](_0x5da6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5da6('0x8')]('/:id/configurations',auth[_0x5da6('0x9')](),controller[_0x5da6('0xc')]);router[_0x5da6('0x8')](_0x5da6('0xd'),auth[_0x5da6('0x9')](),controller[_0x5da6('0xe')]);router[_0x5da6('0xf')]('/',auth[_0x5da6('0x9')](),controller['create']);router[_0x5da6('0xf')](_0x5da6('0x10'),auth[_0x5da6('0x9')](),controller[_0x5da6('0x11')]);router[_0x5da6('0x12')](_0x5da6('0xb'),auth[_0x5da6('0x9')](),controller[_0x5da6('0x13')]);router[_0x5da6('0x14')]('/:id',auth[_0x5da6('0x9')](),controller[_0x5da6('0x15')]);module[_0x5da6('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 8b5b8cb..7867338 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 _0x55f1=['sequelize','STRING','HelpDesk'];(function(_0x4ea1a5,_0x152de4){var _0x41d36b=function(_0x71f624){while(--_0x71f624){_0x4ea1a5['push'](_0x4ea1a5['shift']());}};_0x41d36b(++_0x152de4);}(_0x55f1,0x11d));var _0x155f=function(_0xee5466,_0x49d605){_0xee5466=_0xee5466-0x0;var _0xd5f2fc=_0x55f1[_0xee5466];return _0xd5f2fc;};'use strict';var Sequelize=require(_0x155f('0x0'));module['exports']={'name':{'type':Sequelize[_0x155f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x155f('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':_0x155f('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x155f('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x155f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3e46=['STRING','HelpDesk','sequelize','exports'];(function(_0xa72cf,_0x24a05c){var _0x263735=function(_0x21b2ae){while(--_0x21b2ae){_0xa72cf['push'](_0xa72cf['shift']());}};_0x263735(++_0x24a05c);}(_0x3e46,0x10e));var _0x63e4=function(_0x10a27f,_0x5885c2){_0x10a27f=_0x10a27f-0x0;var _0x228a1a=_0x3e46[_0x10a27f];return _0x228a1a;};'use strict';var Sequelize=require(_0x63e4('0x0'));module[_0x63e4('0x1')]={'name':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![],'defaultValue':_0x63e4('0x3')},'remoteUri':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x63e4('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 f6b52e4..9eb9399 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 _0x8d09=['bluebird','util','path','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','index','map','rawAttributes','type','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','includeAll','include','rows','catch','params','keys','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','username','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','autogenerated','reference','owner','remove','includes','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x350744,_0x7d9b13){var _0x14ad39=function(_0x1306dd){while(--_0x1306dd){_0x350744['push'](_0x350744['shift']());}};_0x14ad39(++_0x7d9b13);}(_0x8d09,0xdf));var _0x98d0=function(_0x643e3d,_0x53262a){_0x643e3d=_0x643e3d-0x0;var _0x2fb4fe=_0x8d09[_0x643e3d];return _0x2fb4fe;};'use strict';var emlformat=require(_0x98d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98d0('0x1'));var jsonpatch=require(_0x98d0('0x2'));var rp=require(_0x98d0('0x3'));var moment=require(_0x98d0('0x4'));var BPromise=require(_0x98d0('0x5'));var Mustache=require('mustache');var util=require(_0x98d0('0x6'));var path=require(_0x98d0('0x7'));var sox=require('sox');var csv=require(_0x98d0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x98d0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98d0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x98d0('0xb'));var Papa=require(_0x98d0('0xc'));var Redis=require(_0x98d0('0xd'));var authService=require(_0x98d0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x98d0('0xf'));var hardwareService=require(_0x98d0('0x10'));var logger=require(_0x98d0('0x11'))(_0x98d0('0x12'));var utils=require(_0x98d0('0x13'));var config=require(_0x98d0('0x14'));var licenseUtil=require(_0x98d0('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x98d0('0x16'));function respondWithStatusCode(_0x9d2386,_0x286cef){_0x286cef=_0x286cef||0xcc;return function(_0x334507){if(_0x334507){return _0x9d2386[_0x98d0('0x17')](_0x286cef);}return _0x9d2386['status'](_0x286cef)[_0x98d0('0x18')]();};}function respondWithResult(_0x1571d6,_0x1c0569){_0x1c0569=_0x1c0569||0xc8;return function(_0x1f3621){if(_0x1f3621){return _0x1571d6[_0x98d0('0x19')](_0x1c0569)[_0x98d0('0x1a')](_0x1f3621);}};}function respondWithFilteredResult(_0x488880,_0x32f207){return function(_0x3d4e4b){if(_0x3d4e4b){var _0x1fc66e=typeof _0x32f207[_0x98d0('0x1b')]===_0x98d0('0x1c')&&typeof _0x32f207[_0x98d0('0x1d')]===_0x98d0('0x1c');var _0x340a6a=_0x3d4e4b['count'];var _0x227cb8=_0x1fc66e?0x0:_0x32f207[_0x98d0('0x1b')];var _0x2642ae=_0x1fc66e?_0x3d4e4b[_0x98d0('0x1e')]:_0x32f207[_0x98d0('0x1b')]+_0x32f207[_0x98d0('0x1d')];var _0x11e660;if(_0x2642ae>=_0x340a6a){_0x2642ae=_0x340a6a;_0x11e660=0xc8;}else{_0x11e660=0xce;}_0x488880[_0x98d0('0x19')](_0x11e660);return _0x488880['set'](_0x98d0('0x1f'),_0x227cb8+'-'+_0x2642ae+'/'+_0x340a6a)['json'](_0x3d4e4b);}return null;};}function patchUpdates(_0x5e6233){return function(_0x5411fa){try{jsonpatch[_0x98d0('0x20')](_0x5411fa,_0x5e6233,!![]);}catch(_0x126ead){return BPromise[_0x98d0('0x21')](_0x126ead);}return _0x5411fa[_0x98d0('0x22')]();};}function saveUpdates(_0x9094c,_0x44c0e0){return function(_0x3a87fe){if(_0x3a87fe){return _0x3a87fe['update'](_0x9094c)[_0x98d0('0x23')](function(_0x3b2d94){return _0x3b2d94;});}return null;};}function removeEntity(_0x3a7e2d,_0x2cc101){return function(_0x46ac4d){if(_0x46ac4d){return _0x46ac4d['destroy']()[_0x98d0('0x23')](function(){_0x3a7e2d[_0x98d0('0x19')](0xcc)[_0x98d0('0x18')]();});}};}function handleEntityNotFound(_0x5ec879,_0x32cfdf){return function(_0x3b3cdb){if(!_0x3b3cdb){_0x5ec879['sendStatus'](0x194);}return _0x3b3cdb;};}function handleError(_0x35d1b9,_0x215294){_0x215294=_0x215294||0x1f4;return function(_0x1114ac){logger[_0x98d0('0x24')](_0x1114ac[_0x98d0('0x25')]);if(_0x1114ac['name']){delete _0x1114ac['name'];}_0x35d1b9['status'](_0x215294)['send'](_0x1114ac);};}exports[_0x98d0('0x26')]=function(_0x5b371b,_0x203d70){var _0x3e1838={},_0x575086={},_0x1020ab={'count':0x0,'rows':[]};var _0x53e918=_[_0x98d0('0x27')](db['VtigerAccount'][_0x98d0('0x28')],function(_0x19de1a){return{'name':_0x19de1a['fieldName'],'type':_0x19de1a[_0x98d0('0x29')]['key']};});_0x575086[_0x98d0('0x2a')]=_[_0x98d0('0x27')](_0x53e918,_0x98d0('0x2b'));_0x575086[_0x98d0('0x2c')]=_['keys'](_0x5b371b[_0x98d0('0x2c')]);_0x575086[_0x98d0('0x2d')]=_[_0x98d0('0x2e')](_0x575086[_0x98d0('0x2a')],_0x575086['query']);_0x3e1838['attributes']=_[_0x98d0('0x2e')](_0x575086['model'],qs[_0x98d0('0x2f')](_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x2f')]));_0x3e1838[_0x98d0('0x30')]=_0x3e1838[_0x98d0('0x30')][_0x98d0('0x31')]?_0x3e1838[_0x98d0('0x30')]:_0x575086[_0x98d0('0x2a')];if(!_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x32')](_0x98d0('0x33'))){_0x3e1838[_0x98d0('0x1d')]=qs['limit'](_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x1d')]);_0x3e1838[_0x98d0('0x1b')]=qs[_0x98d0('0x1b')](_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x1b')]);}_0x3e1838[_0x98d0('0x34')]=qs[_0x98d0('0x35')](_0x5b371b[_0x98d0('0x2c')]['sort']);_0x3e1838[_0x98d0('0x36')]=qs['filters'](_[_0x98d0('0x37')](_0x5b371b['query'],_0x575086[_0x98d0('0x2d')]),_0x53e918);if(_0x5b371b['query'][_0x98d0('0x38')]){_0x3e1838['where']=_[_0x98d0('0x39')](_0x3e1838['where'],{'$or':_['map'](_0x53e918,function(_0x487fa3){if(_0x487fa3['type']!==_0x98d0('0x3a')){var _0x39f499={};_0x39f499[_0x487fa3['name']]={'$like':'%'+_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x38')]+'%'};return _0x39f499;}})});}_0x3e1838=_[_0x98d0('0x39')]({},_0x3e1838,_0x5b371b[_0x98d0('0x3b')]);var _0x3f96e6={'where':_0x3e1838[_0x98d0('0x36')]};return db[_0x98d0('0x3c')][_0x98d0('0x1e')](_0x3f96e6)[_0x98d0('0x23')](function(_0x22050a){_0x1020ab[_0x98d0('0x1e')]=_0x22050a;if(_0x5b371b[_0x98d0('0x2c')][_0x98d0('0x3d')]){_0x3e1838[_0x98d0('0x3e')]=[{'all':!![]}];}return db[_0x98d0('0x3c')]['findAll'](_0x3e1838);})[_0x98d0('0x23')](function(_0x2f0beb){_0x1020ab[_0x98d0('0x3f')]=_0x2f0beb;return _0x1020ab;})['then'](respondWithFilteredResult(_0x203d70,_0x3e1838))[_0x98d0('0x40')](handleError(_0x203d70,null));};exports['show']=function(_0x1cebed,_0x32fdac){var _0x48a757={'raw':![],'where':{'id':_0x1cebed[_0x98d0('0x41')]['id']}},_0xf7621c={};_0xf7621c[_0x98d0('0x2a')]=_[_0x98d0('0x42')](db[_0x98d0('0x3c')][_0x98d0('0x28')]);_0xf7621c['query']=_[_0x98d0('0x42')](_0x1cebed[_0x98d0('0x2c')]);_0xf7621c[_0x98d0('0x2d')]=_[_0x98d0('0x2e')](_0xf7621c[_0x98d0('0x2a')],_0xf7621c[_0x98d0('0x2c')]);_0x48a757[_0x98d0('0x30')]=_['intersection'](_0xf7621c[_0x98d0('0x2a')],qs[_0x98d0('0x2f')](_0x1cebed[_0x98d0('0x2c')][_0x98d0('0x2f')]));_0x48a757['attributes']=_0x48a757[_0x98d0('0x30')][_0x98d0('0x31')]?_0x48a757['attributes']:_0xf7621c[_0x98d0('0x2a')];if(_0x1cebed[_0x98d0('0x2c')][_0x98d0('0x3d')]){_0x48a757['include']=[{'all':!![]}];}_0x48a757=_[_0x98d0('0x39')]({},_0x48a757,_0x1cebed[_0x98d0('0x3b')]);return db['VtigerAccount'][_0x98d0('0x43')](_0x48a757)[_0x98d0('0x23')](handleEntityNotFound(_0x32fdac,null))[_0x98d0('0x23')](respondWithResult(_0x32fdac,null))['catch'](handleError(_0x32fdac,null));};exports[_0x98d0('0x44')]=function(_0x5b4cb6,_0x41ce43){return db['VtigerAccount']['create'](_0x5b4cb6[_0x98d0('0x45')],{})[_0x98d0('0x23')](respondWithResult(_0x41ce43,0xc9))[_0x98d0('0x40')](handleError(_0x41ce43,null));};exports[_0x98d0('0x46')]=function(_0x353599,_0x67a48f){if(_0x353599[_0x98d0('0x45')]['id']){delete _0x353599[_0x98d0('0x45')]['id'];}return db[_0x98d0('0x3c')][_0x98d0('0x43')]({'where':{'id':_0x353599['params']['id']}})['then'](handleEntityNotFound(_0x67a48f,null))['then'](saveUpdates(_0x353599[_0x98d0('0x45')],null))['then'](respondWithResult(_0x67a48f,null))[_0x98d0('0x40')](handleError(_0x67a48f,null));};exports['destroy']=function(_0x380e4e,_0x251f26){return db[_0x98d0('0x3c')][_0x98d0('0x43')]({'where':{'id':_0x380e4e[_0x98d0('0x41')]['id']}})[_0x98d0('0x23')](handleEntityNotFound(_0x251f26,null))[_0x98d0('0x23')](removeEntity(_0x251f26,null))[_0x98d0('0x40')](handleError(_0x251f26,null));};exports[_0x98d0('0x47')]=function(_0xcd3ddc,_0x232a5c,_0x5a0f91){var _0x14c8e7={};var _0x300f12={};var _0x11de2a;var _0x3ff98a;return db['VtigerAccount'][_0x98d0('0x48')]({'where':{'id':_0xcd3ddc[_0x98d0('0x41')]['id']}})[_0x98d0('0x23')](handleEntityNotFound(_0x232a5c,null))[_0x98d0('0x23')](function(_0x3f90d2){if(_0x3f90d2){_0x11de2a=_0x3f90d2;_0x300f12['model']=_[_0x98d0('0x42')](db[_0x98d0('0x49')][_0x98d0('0x28')]);_0x300f12[_0x98d0('0x2c')]=_[_0x98d0('0x42')](_0xcd3ddc[_0x98d0('0x2c')]);_0x300f12[_0x98d0('0x2d')]=_[_0x98d0('0x2e')](_0x300f12[_0x98d0('0x2a')],_0x300f12[_0x98d0('0x2c')]);_0x14c8e7[_0x98d0('0x30')]=_[_0x98d0('0x2e')](_0x300f12[_0x98d0('0x2a')],qs[_0x98d0('0x2f')](_0xcd3ddc['query']['fields']));_0x14c8e7[_0x98d0('0x30')]=_0x14c8e7[_0x98d0('0x30')][_0x98d0('0x31')]?_0x14c8e7[_0x98d0('0x30')]:_0x300f12[_0x98d0('0x2a')];_0x14c8e7['order']=qs[_0x98d0('0x35')](_0xcd3ddc[_0x98d0('0x2c')][_0x98d0('0x35')]);_0x14c8e7[_0x98d0('0x36')]=qs[_0x98d0('0x2d')](_[_0x98d0('0x37')](_0xcd3ddc[_0x98d0('0x2c')],_0x300f12[_0x98d0('0x2d')]));if(_0xcd3ddc[_0x98d0('0x2c')][_0x98d0('0x38')]){_0x14c8e7[_0x98d0('0x36')]=_[_0x98d0('0x39')](_0x14c8e7['where'],{'$or':_['map'](_0x14c8e7['attributes'],function(_0x3b2182){var _0x6b01f4={};_0x6b01f4[_0x3b2182]={'$like':'%'+_0xcd3ddc[_0x98d0('0x2c')]['filter']+'%'};return _0x6b01f4;})});}_0x14c8e7=_[_0x98d0('0x39')]({},_0x14c8e7,_0xcd3ddc[_0x98d0('0x3b')]);return _0x11de2a['getConfigurations'](_0x14c8e7);}})[_0x98d0('0x23')](function(_0x5d9ed7){if(_0x5d9ed7){_0x3ff98a=_0x5d9ed7[_0x98d0('0x31')];if(!_0xcd3ddc[_0x98d0('0x2c')][_0x98d0('0x32')]('nolimit')){_0x14c8e7[_0x98d0('0x1d')]=qs[_0x98d0('0x1d')](_0xcd3ddc[_0x98d0('0x2c')][_0x98d0('0x1d')]);_0x14c8e7[_0x98d0('0x1b')]=qs[_0x98d0('0x1b')](_0xcd3ddc[_0x98d0('0x2c')][_0x98d0('0x1b')]);}return _0x11de2a[_0x98d0('0x47')](_0x14c8e7);}})[_0x98d0('0x23')](function(_0x4cc834){if(_0x4cc834){return _0x4cc834?{'count':_0x3ff98a,'rows':_0x4cc834}:null;}})['then'](respondWithResult(_0x232a5c,null))[_0x98d0('0x40')](handleError(_0x232a5c,null));};exports['addConfiguration']=function(_0x5aacac,_0x444f95,_0x2bb0ef){if(_0x5aacac[_0x98d0('0x45')]['id']){delete _0x5aacac['body']['id'];}return db[_0x98d0('0x3c')][_0x98d0('0x48')]({'where':{'id':_0x5aacac[_0x98d0('0x41')]['id']}})[_0x98d0('0x23')](handleEntityNotFound(_0x444f95,null))[_0x98d0('0x23')](function(_0x109e00){if(_0x109e00){_0x5aacac[_0x98d0('0x45')]['AccountId']=_0x109e00['id'];_0x5aacac[_0x98d0('0x45')][_0x98d0('0x4a')]=integrations[_0x98d0('0x4b')](_0x5aacac[_0x98d0('0x45')][_0x98d0('0x4c')],_0x5aacac[_0x98d0('0x45')][_0x98d0('0x29')]);_0x5aacac[_0x98d0('0x45')][_0x98d0('0x4d')]=integrations[_0x98d0('0x4e')](_0x5aacac[_0x98d0('0x45')][_0x98d0('0x4c')],_0x5aacac[_0x98d0('0x45')][_0x98d0('0x29')]);return db[_0x98d0('0x49')][_0x98d0('0x44')](_0x5aacac[_0x98d0('0x45')],{'include':[{'model':db[_0x98d0('0x4f')],'as':_0x98d0('0x4a')},{'model':db[_0x98d0('0x4f')],'as':_0x98d0('0x4d')}]});}return null;})['then'](respondWithResult(_0x444f95,null))['catch'](handleError(_0x444f95,null));};var md5=require(_0x98d0('0x50'));exports[_0x98d0('0x51')]=function(_0xf75592,_0xe3f191,_0x221c6d){var _0x1afee1=null;var _0x2416e5=null;var _0x10b5ab=null;var _0x4af07d=null;var _0x1a8f09='';return db[_0x98d0('0x3c')]['findOne']({'where':{'id':_0xf75592['params']['id']},'attributes':['id',_0x98d0('0x2b'),'username','description',_0x98d0('0x52'),_0x98d0('0x53'),_0x98d0('0x54'),'accessKey']})['then'](handleEntityNotFound(_0xe3f191,null))[_0x98d0('0x23')](function(_0x373cf8){if(_0x373cf8){_0x1afee1=_0x373cf8[_0x98d0('0x55')];_0x2416e5=_0x373cf8[_0x98d0('0x56')];_0x10b5ab=_0x373cf8[_0x98d0('0x52')];_0x1a8f09=_0x373cf8[_0x98d0('0x53')];var _0x490fae=_0x1a8f09['slice'](-0x1);if(_0x490fae==='/'){_0x1a8f09=_0x1a8f09[_0x98d0('0x57')](0x0,_0x1a8f09[_0x98d0('0x58')](_0x490fae));}_0x4af07d=util['format'](_0x98d0('0x59'),_0x1a8f09);var _0x353039={'method':_0x98d0('0x5a'),'uri':_0x4af07d,'qs':{'operation':_0x98d0('0x5b'),'username':_0x373cf8['username']},'json':!![]};return rp(_0x353039);}})['then'](function(_0x36d58f){if(_0x36d58f[_0x98d0('0x5c')]){var _0x2f9ec7={'method':_0x98d0('0x5d'),'uri':_0x4af07d,'form':{'operation':_0x98d0('0x5e'),'username':_0x1afee1,'accessKey':md5(_0x36d58f[_0x98d0('0x5f')]['token']+_0x2416e5)},'json':!![]};return rp(_0x2f9ec7);}})[_0x98d0('0x23')](function(_0x3f8d58){if(_0x3f8d58[_0x98d0('0x5c')]){var _0x1567d6={'method':'GET','uri':_0x4af07d,'qs':{'operation':'describe','username':_0x1afee1,'sessionName':_0x3f8d58['result']['sessionName'],'elementType':_0x10b5ab},'json':!![]};return rp(_0x1567d6);}})[_0x98d0('0x23')](function(_0x3a1da5){if(_0x3a1da5[_0x98d0('0x5c')]){var _0x216e78=[_0x98d0('0x60'),_0x98d0('0x61'),_0x98d0('0x62')];_[_0x98d0('0x63')](_0x3a1da5[_0x98d0('0x5f')][_0x98d0('0x2f')],function(_0x5d4f60){return _0x216e78[_0x98d0('0x64')](_0x5d4f60[_0x98d0('0x29')]['name']);});_[_0x98d0('0x63')](_0x3a1da5[_0x98d0('0x5f')][_0x98d0('0x2f')],function(_0x50b41a){return _0x50b41a['editable']===_0x98d0('0x65');});return{'count':_0x3a1da5[_0x98d0('0x5f')]['fields']['length'],'rows':_[_0x98d0('0x27')](_0x3a1da5[_0x98d0('0x5f')][_0x98d0('0x2f')],function(_0x5a36a9){return{'id':_0x5a36a9['name'],'name':_0x5a36a9[_0x98d0('0x66')],'custom':_[_0x98d0('0x67')](_0x5a36a9[_0x98d0('0x2b')],'cf_')?!![]:![],'options':_0x5a36a9[_0x98d0('0x29')][_0x98d0('0x2b')]===_0x98d0('0x68')&&_0x5a36a9[_0x98d0('0x29')][_0x98d0('0x69')][_0x98d0('0x31')]>0x0?_[_0x98d0('0x27')](_0x5a36a9[_0x98d0('0x29')][_0x98d0('0x69')],function(_0x5e3280){return{'name':_0x5e3280[_0x98d0('0x66')],'value':_0x5e3280['value']};}):[]};})};}})[_0x98d0('0x23')](respondWithResult(_0xe3f191,null))[_0x98d0('0x40')](function(_0x4abdbb){console[_0x98d0('0x6a')](_0x98d0('0x6b')+_0x4abdbb);var _0x5a4d38=_0xf75592[_0x98d0('0x2c')][_0x98d0('0x6c')]?0x1f4:_0x4abdbb[_0x98d0('0x6d')]||0x1f4;logger[_0x98d0('0x24')](_0x98d0('0x6e'),_0x98d0('0x51'),_0x5a4d38,JSON[_0x98d0('0x6f')](_0x4abdbb));delete _0x4abdbb[_0x98d0('0x2b')];if(_0x5a4d38===0x191){_0x5a4d38=0x190;}_0xe3f191[_0x98d0('0x19')](_0x5a4d38)[_0x98d0('0x70')](_0xf75592['query'][_0x98d0('0x6c')]?{'message':_0x98d0('0x71'),'statusCode':_0x4abdbb[_0x98d0('0x6d')]}:_0x4abdbb);});}; \ No newline at end of file +var _0xea77=['getDescriptions','channel','md5','getFields','username','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','reference','owner','remove','includes','editable','label','startsWith','picklist','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','end','name','send','index','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','create','body','destroy','getConfigurations','VtigerConfiguration','map','addConfiguration','findOne','AccountId','Subjects','Descriptions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea77,0x120));var _0x7ea7=function(_0x11b812,_0x5d1820){_0x11b812=_0x11b812-0x0;var _0x430554=_0xea77[_0x11b812];return _0x430554;};'use strict';var emlformat=require(_0x7ea7('0x0'));var rimraf=require(_0x7ea7('0x1'));var zipdir=require(_0x7ea7('0x2'));var jsonpatch=require(_0x7ea7('0x3'));var rp=require(_0x7ea7('0x4'));var moment=require(_0x7ea7('0x5'));var BPromise=require(_0x7ea7('0x6'));var Mustache=require(_0x7ea7('0x7'));var util=require(_0x7ea7('0x8'));var path=require(_0x7ea7('0x9'));var sox=require(_0x7ea7('0xa'));var csv=require(_0x7ea7('0xb'));var ejs=require(_0x7ea7('0xc'));var fs=require('fs');var fs_extra=require(_0x7ea7('0xd'));var _=require(_0x7ea7('0xe'));var squel=require(_0x7ea7('0xf'));var crypto=require(_0x7ea7('0x10'));var jsforce=require(_0x7ea7('0x11'));var deskjs=require(_0x7ea7('0x12'));var toCsv=require('to-csv');var querystring=require(_0x7ea7('0x13'));var Papa=require(_0x7ea7('0x14'));var Redis=require(_0x7ea7('0x15'));var authService=require(_0x7ea7('0x16'));var qs=require(_0x7ea7('0x17'));var as=require(_0x7ea7('0x18'));var hardwareService=require(_0x7ea7('0x19'));var logger=require(_0x7ea7('0x1a'))(_0x7ea7('0x1b'));var utils=require('../../config/utils');var config=require(_0x7ea7('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ea7('0x1d'))['db'];var integrations=require(_0x7ea7('0x1e'));function respondWithStatusCode(_0xf9fb31,_0x5b7837){_0x5b7837=_0x5b7837||0xcc;return function(_0x2eceae){if(_0x2eceae){return _0xf9fb31[_0x7ea7('0x1f')](_0x5b7837);}return _0xf9fb31[_0x7ea7('0x20')](_0x5b7837)['end']();};}function respondWithResult(_0x23f020,_0x55f90d){_0x55f90d=_0x55f90d||0xc8;return function(_0xa78ccd){if(_0xa78ccd){return _0x23f020[_0x7ea7('0x20')](_0x55f90d)['json'](_0xa78ccd);}};}function respondWithFilteredResult(_0x24c23d,_0x4b01b9){return function(_0x31336c){if(_0x31336c){var _0x5cc7d5=typeof _0x4b01b9[_0x7ea7('0x21')]===_0x7ea7('0x22')&&typeof _0x4b01b9['limit']===_0x7ea7('0x22');var _0x29f9c3=_0x31336c['count'];var _0x22c9c9=_0x5cc7d5?0x0:_0x4b01b9[_0x7ea7('0x21')];var _0x1b99a9=_0x5cc7d5?_0x31336c['count']:_0x4b01b9[_0x7ea7('0x21')]+_0x4b01b9[_0x7ea7('0x23')];var _0xfe13eb;if(_0x1b99a9>=_0x29f9c3){_0x1b99a9=_0x29f9c3;_0xfe13eb=0xc8;}else{_0xfe13eb=0xce;}_0x24c23d['status'](_0xfe13eb);return _0x24c23d[_0x7ea7('0x24')](_0x7ea7('0x25'),_0x22c9c9+'-'+_0x1b99a9+'/'+_0x29f9c3)[_0x7ea7('0x26')](_0x31336c);}return null;};}function patchUpdates(_0xcea3ce){return function(_0x4885c5){try{jsonpatch[_0x7ea7('0x27')](_0x4885c5,_0xcea3ce,!![]);}catch(_0x5f30ee){return BPromise[_0x7ea7('0x28')](_0x5f30ee);}return _0x4885c5[_0x7ea7('0x29')]();};}function saveUpdates(_0x1d8fb9,_0x3b61bf){return function(_0x2515f7){if(_0x2515f7){return _0x2515f7[_0x7ea7('0x2a')](_0x1d8fb9)[_0x7ea7('0x2b')](function(_0x460f12){return _0x460f12;});}return null;};}function removeEntity(_0x50a225,_0xa73f06){return function(_0x35d776){if(_0x35d776){return _0x35d776['destroy']()[_0x7ea7('0x2b')](function(){_0x50a225[_0x7ea7('0x20')](0xcc)[_0x7ea7('0x2c')]();});}};}function handleEntityNotFound(_0x3c020a,_0x3c074c){return function(_0x11297f){if(!_0x11297f){_0x3c020a[_0x7ea7('0x1f')](0x194);}return _0x11297f;};}function handleError(_0x4819cc,_0x1b43c3){_0x1b43c3=_0x1b43c3||0x1f4;return function(_0x18a911){logger['error'](_0x18a911['stack']);if(_0x18a911[_0x7ea7('0x2d')]){delete _0x18a911['name'];}_0x4819cc[_0x7ea7('0x20')](_0x1b43c3)[_0x7ea7('0x2e')](_0x18a911);};}exports[_0x7ea7('0x2f')]=function(_0x15d932,_0x26e816){var _0xcb0c4b={},_0x12176c={},_0x5d9fa0={'count':0x0,'rows':[]};var _0x2c7584=_['map'](db[_0x7ea7('0x30')]['rawAttributes'],function(_0x39bf00){return{'name':_0x39bf00[_0x7ea7('0x31')],'type':_0x39bf00[_0x7ea7('0x32')][_0x7ea7('0x33')]};});_0x12176c[_0x7ea7('0x34')]=_['map'](_0x2c7584,_0x7ea7('0x2d'));_0x12176c[_0x7ea7('0x35')]=_[_0x7ea7('0x36')](_0x15d932[_0x7ea7('0x35')]);_0x12176c[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x12176c[_0x7ea7('0x34')],_0x12176c[_0x7ea7('0x35')]);_0xcb0c4b[_0x7ea7('0x39')]=_[_0x7ea7('0x38')](_0x12176c[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x15d932['query'][_0x7ea7('0x3a')]));_0xcb0c4b['attributes']=_0xcb0c4b[_0x7ea7('0x39')]['length']?_0xcb0c4b[_0x7ea7('0x39')]:_0x12176c[_0x7ea7('0x34')];if(!_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x3b')](_0x7ea7('0x3c'))){_0xcb0c4b['limit']=qs['limit'](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x23')]);_0xcb0c4b[_0x7ea7('0x21')]=qs[_0x7ea7('0x21')](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x21')]);}_0xcb0c4b[_0x7ea7('0x3d')]=qs['sort'](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x3e')]);_0xcb0c4b[_0x7ea7('0x3f')]=qs[_0x7ea7('0x37')](_[_0x7ea7('0x40')](_0x15d932['query'],_0x12176c[_0x7ea7('0x37')]),_0x2c7584);if(_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x41')]){_0xcb0c4b[_0x7ea7('0x3f')]=_['merge'](_0xcb0c4b[_0x7ea7('0x3f')],{'$or':_['map'](_0x2c7584,function(_0x306627){if(_0x306627[_0x7ea7('0x32')]!==_0x7ea7('0x42')){var _0x297a44={};_0x297a44[_0x306627[_0x7ea7('0x2d')]]={'$like':'%'+_0x15d932[_0x7ea7('0x35')]['filter']+'%'};return _0x297a44;}})});}_0xcb0c4b=_[_0x7ea7('0x43')]({},_0xcb0c4b,_0x15d932[_0x7ea7('0x44')]);var _0xeb00e4={'where':_0xcb0c4b[_0x7ea7('0x3f')]};return db[_0x7ea7('0x30')][_0x7ea7('0x45')](_0xeb00e4)['then'](function(_0xf4c0f9){_0x5d9fa0['count']=_0xf4c0f9;if(_0x15d932[_0x7ea7('0x35')]['includeAll']){_0xcb0c4b[_0x7ea7('0x46')]=[{'all':!![]}];}return db[_0x7ea7('0x30')][_0x7ea7('0x47')](_0xcb0c4b);})[_0x7ea7('0x2b')](function(_0xa67e1b){_0x5d9fa0['rows']=_0xa67e1b;return _0x5d9fa0;})['then'](respondWithFilteredResult(_0x26e816,_0xcb0c4b))[_0x7ea7('0x48')](handleError(_0x26e816,null));};exports[_0x7ea7('0x49')]=function(_0x38c973,_0x169b93){var _0x4e61df={'raw':![],'where':{'id':_0x38c973[_0x7ea7('0x4a')]['id']}},_0x1fdb48={};_0x1fdb48[_0x7ea7('0x34')]=_['keys'](db[_0x7ea7('0x30')][_0x7ea7('0x4b')]);_0x1fdb48['query']=_['keys'](_0x38c973[_0x7ea7('0x35')]);_0x1fdb48[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x1fdb48[_0x7ea7('0x34')],_0x1fdb48[_0x7ea7('0x35')]);_0x4e61df[_0x7ea7('0x39')]=_[_0x7ea7('0x38')](_0x1fdb48[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x38c973[_0x7ea7('0x35')]['fields']));_0x4e61df['attributes']=_0x4e61df[_0x7ea7('0x39')][_0x7ea7('0x4c')]?_0x4e61df[_0x7ea7('0x39')]:_0x1fdb48[_0x7ea7('0x34')];if(_0x38c973[_0x7ea7('0x35')][_0x7ea7('0x4d')]){_0x4e61df[_0x7ea7('0x46')]=[{'all':!![]}];}_0x4e61df=_[_0x7ea7('0x43')]({},_0x4e61df,_0x38c973[_0x7ea7('0x44')]);return db[_0x7ea7('0x30')][_0x7ea7('0x4e')](_0x4e61df)[_0x7ea7('0x2b')](handleEntityNotFound(_0x169b93,null))[_0x7ea7('0x2b')](respondWithResult(_0x169b93,null))['catch'](handleError(_0x169b93,null));};exports[_0x7ea7('0x4f')]=function(_0x1b47b3,_0x4b80b3){return db[_0x7ea7('0x30')][_0x7ea7('0x4f')](_0x1b47b3[_0x7ea7('0x50')],{})[_0x7ea7('0x2b')](respondWithResult(_0x4b80b3,0xc9))[_0x7ea7('0x48')](handleError(_0x4b80b3,null));};exports['update']=function(_0x2e3294,_0x511e50){if(_0x2e3294[_0x7ea7('0x50')]['id']){delete _0x2e3294[_0x7ea7('0x50')]['id'];}return db[_0x7ea7('0x30')]['find']({'where':{'id':_0x2e3294['params']['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0x511e50,null))['then'](saveUpdates(_0x2e3294[_0x7ea7('0x50')],null))[_0x7ea7('0x2b')](respondWithResult(_0x511e50,null))[_0x7ea7('0x48')](handleError(_0x511e50,null));};exports[_0x7ea7('0x51')]=function(_0x42d8de,_0xad1fda){return db[_0x7ea7('0x30')][_0x7ea7('0x4e')]({'where':{'id':_0x42d8de[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0xad1fda,null))['then'](removeEntity(_0xad1fda,null))[_0x7ea7('0x48')](handleError(_0xad1fda,null));};exports[_0x7ea7('0x52')]=function(_0x33caf1,_0x3080a2,_0x2b4ed8){var _0x4d8936={};var _0x14f2b6={};var _0x16a6be;var _0x386fa5;return db['VtigerAccount']['findOne']({'where':{'id':_0x33caf1[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0x3080a2,null))[_0x7ea7('0x2b')](function(_0x4cb276){if(_0x4cb276){_0x16a6be=_0x4cb276;_0x14f2b6[_0x7ea7('0x34')]=_[_0x7ea7('0x36')](db[_0x7ea7('0x53')]['rawAttributes']);_0x14f2b6[_0x7ea7('0x35')]=_[_0x7ea7('0x36')](_0x33caf1[_0x7ea7('0x35')]);_0x14f2b6[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x14f2b6[_0x7ea7('0x34')],_0x14f2b6[_0x7ea7('0x35')]);_0x4d8936['attributes']=_[_0x7ea7('0x38')](_0x14f2b6[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x3a')]));_0x4d8936['attributes']=_0x4d8936[_0x7ea7('0x39')]['length']?_0x4d8936[_0x7ea7('0x39')]:_0x14f2b6[_0x7ea7('0x34')];_0x4d8936[_0x7ea7('0x3d')]=qs['sort'](_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x3e')]);_0x4d8936[_0x7ea7('0x3f')]=qs[_0x7ea7('0x37')](_[_0x7ea7('0x40')](_0x33caf1[_0x7ea7('0x35')],_0x14f2b6['filters']));if(_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x41')]){_0x4d8936['where']=_[_0x7ea7('0x43')](_0x4d8936[_0x7ea7('0x3f')],{'$or':_[_0x7ea7('0x54')](_0x4d8936['attributes'],function(_0x5f1cf2){var _0x38d467={};_0x38d467[_0x5f1cf2]={'$like':'%'+_0x33caf1['query'][_0x7ea7('0x41')]+'%'};return _0x38d467;})});}_0x4d8936=_[_0x7ea7('0x43')]({},_0x4d8936,_0x33caf1['options']);return _0x16a6be[_0x7ea7('0x52')](_0x4d8936);}})[_0x7ea7('0x2b')](function(_0x3e2a56){if(_0x3e2a56){_0x386fa5=_0x3e2a56[_0x7ea7('0x4c')];if(!_0x33caf1['query'][_0x7ea7('0x3b')]('nolimit')){_0x4d8936['limit']=qs[_0x7ea7('0x23')](_0x33caf1[_0x7ea7('0x35')]['limit']);_0x4d8936[_0x7ea7('0x21')]=qs[_0x7ea7('0x21')](_0x33caf1['query'][_0x7ea7('0x21')]);}return _0x16a6be[_0x7ea7('0x52')](_0x4d8936);}})[_0x7ea7('0x2b')](function(_0x1d46fa){if(_0x1d46fa){return _0x1d46fa?{'count':_0x386fa5,'rows':_0x1d46fa}:null;}})['then'](respondWithResult(_0x3080a2,null))[_0x7ea7('0x48')](handleError(_0x3080a2,null));};exports[_0x7ea7('0x55')]=function(_0x19271f,_0xb85a89,_0x2ba441){if(_0x19271f[_0x7ea7('0x50')]['id']){delete _0x19271f['body']['id'];}return db['VtigerAccount'][_0x7ea7('0x56')]({'where':{'id':_0x19271f[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0xb85a89,null))['then'](function(_0x2aa8f3){if(_0x2aa8f3){_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x57')]=_0x2aa8f3['id'];_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x58')]=integrations['getSubjects'](_0x19271f[_0x7ea7('0x50')]['channel'],_0x19271f[_0x7ea7('0x50')]['type']);_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x59')]=integrations[_0x7ea7('0x5a')](_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x5b')],_0x19271f['body'][_0x7ea7('0x32')]);return db[_0x7ea7('0x53')][_0x7ea7('0x4f')](_0x19271f[_0x7ea7('0x50')],{'include':[{'model':db['VtigerField'],'as':_0x7ea7('0x58')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x7ea7('0x2b')](respondWithResult(_0xb85a89,null))[_0x7ea7('0x48')](handleError(_0xb85a89,null));};var md5=require(_0x7ea7('0x5c'));exports[_0x7ea7('0x5d')]=function(_0x3a8508,_0x410412,_0x3398bb){var _0x57bde9=null;var _0x2dba95=null;var _0x33823c=null;var _0x2caad2=null;var _0x422f38='';return db['VtigerAccount'][_0x7ea7('0x56')]({'where':{'id':_0x3a8508['params']['id']},'attributes':['id',_0x7ea7('0x2d'),_0x7ea7('0x5e'),'description','moduleName',_0x7ea7('0x5f'),_0x7ea7('0x60'),_0x7ea7('0x61')]})['then'](handleEntityNotFound(_0x410412,null))[_0x7ea7('0x2b')](function(_0x1083d5){if(_0x1083d5){_0x57bde9=_0x1083d5[_0x7ea7('0x5e')];_0x2dba95=_0x1083d5[_0x7ea7('0x61')];_0x33823c=_0x1083d5['moduleName'];_0x422f38=_0x1083d5[_0x7ea7('0x5f')];var _0x1573b7=_0x422f38[_0x7ea7('0x62')](-0x1);if(_0x1573b7==='/'){_0x422f38=_0x422f38[_0x7ea7('0x63')](0x0,_0x422f38[_0x7ea7('0x64')](_0x1573b7));}_0x2caad2=util[_0x7ea7('0x65')](_0x7ea7('0x66'),_0x422f38);var _0xa56793={'method':'GET','uri':_0x2caad2,'qs':{'operation':_0x7ea7('0x67'),'username':_0x1083d5[_0x7ea7('0x5e')]},'json':!![]};return rp(_0xa56793);}})[_0x7ea7('0x2b')](function(_0x9b6532){if(_0x9b6532[_0x7ea7('0x68')]){var _0x30ff9b={'method':_0x7ea7('0x69'),'uri':_0x2caad2,'form':{'operation':_0x7ea7('0x6a'),'username':_0x57bde9,'accessKey':md5(_0x9b6532[_0x7ea7('0x6b')][_0x7ea7('0x6c')]+_0x2dba95)},'json':!![]};return rp(_0x30ff9b);}})[_0x7ea7('0x2b')](function(_0x2c4041){if(_0x2c4041[_0x7ea7('0x68')]){var _0x2c679c={'method':_0x7ea7('0x6d'),'uri':_0x2caad2,'qs':{'operation':_0x7ea7('0x6e'),'username':_0x57bde9,'sessionName':_0x2c4041[_0x7ea7('0x6b')][_0x7ea7('0x6f')],'elementType':_0x33823c},'json':!![]};return rp(_0x2c679c);}})[_0x7ea7('0x2b')](function(_0x4aef0b){if(_0x4aef0b[_0x7ea7('0x68')]){var _0x31f59f=['autogenerated',_0x7ea7('0x70'),_0x7ea7('0x71')];_[_0x7ea7('0x72')](_0x4aef0b[_0x7ea7('0x6b')][_0x7ea7('0x3a')],function(_0x3612a0){return _0x31f59f[_0x7ea7('0x73')](_0x3612a0[_0x7ea7('0x32')][_0x7ea7('0x2d')]);});_['remove'](_0x4aef0b['result'][_0x7ea7('0x3a')],function(_0x243983){return _0x243983[_0x7ea7('0x74')]==='false';});return{'count':_0x4aef0b[_0x7ea7('0x6b')]['fields']['length'],'rows':_[_0x7ea7('0x54')](_0x4aef0b[_0x7ea7('0x6b')]['fields'],function(_0xe9164a){return{'id':_0xe9164a[_0x7ea7('0x2d')],'name':_0xe9164a[_0x7ea7('0x75')],'custom':_[_0x7ea7('0x76')](_0xe9164a['name'],'cf_')?!![]:![],'options':_0xe9164a['type']['name']===_0x7ea7('0x77')&&_0xe9164a[_0x7ea7('0x32')]['picklistValues'][_0x7ea7('0x4c')]>0x0?_[_0x7ea7('0x54')](_0xe9164a[_0x7ea7('0x32')]['picklistValues'],function(_0x1bdf9b){return{'name':_0x1bdf9b['label'],'value':_0x1bdf9b['value']};}):[]};})};}})[_0x7ea7('0x2b')](respondWithResult(_0x410412,null))[_0x7ea7('0x48')](function(_0x2f3687){console['log'](_0x7ea7('0x78')+_0x2f3687);var _0x4bbd9b=_0x3a8508[_0x7ea7('0x35')][_0x7ea7('0x79')]?0x1f4:_0x2f3687[_0x7ea7('0x7a')]||0x1f4;logger[_0x7ea7('0x7b')](_0x7ea7('0x7c'),'getFields',_0x4bbd9b,JSON['stringify'](_0x2f3687));delete _0x2f3687[_0x7ea7('0x2d')];if(_0x4bbd9b===0x191){_0x4bbd9b=0x190;}_0x410412[_0x7ea7('0x20')](_0x4bbd9b)[_0x7ea7('0x2e')](_0x3a8508[_0x7ea7('0x35')][_0x7ea7('0x79')]?{'message':_0x7ea7('0x7d'),'statusCode':_0x2f3687[_0x7ea7('0x7a')]}:_0x2f3687);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a03981c..f43394f 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 _0x225a=['../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x51c47a,_0x24dc08){var _0x3413bd=function(_0x38d57a){while(--_0x38d57a){_0x51c47a['push'](_0x51c47a['shift']());}};_0x3413bd(++_0x24dc08);}(_0x225a,0x18a));var _0xa225=function(_0x25cfc2,_0x5a5776){_0x25cfc2=_0x25cfc2-0x0;var _0x34ffba=_0x225a[_0x25cfc2];return _0x34ffba;};'use strict';var _=require(_0xa225('0x0'));var util=require('util');var logger=require(_0xa225('0x1'))(_0xa225('0x2'));var moment=require(_0xa225('0x3'));var BPromise=require('bluebird');var rp=require(_0xa225('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa225('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa225('0x6'));module[_0xa225('0x7')]=function(_0x40fcca,_0x187c5c){return _0x40fcca['define'](_0xa225('0x8'),attributes,{'tableName':_0xa225('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x876e=['api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x876e,0x11c));var _0xe876=function(_0x165c23,_0x38cfc6){_0x165c23=_0x165c23-0x0;var _0x8e4bfc=_0x876e[_0x165c23];return _0x8e4bfc;};'use strict';var _=require(_0xe876('0x0'));var util=require('util');var logger=require(_0xe876('0x1'))(_0xe876('0x2'));var moment=require(_0xe876('0x3'));var BPromise=require(_0xe876('0x4'));var rp=require(_0xe876('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe876('0x6'));module[_0xe876('0x7')]=function(_0x145e2d,_0x33aff2){return _0x145e2d[_0xe876('0x8')](_0xe876('0x9'),attributes,{'tableName':_0xe876('0xa'),'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 b58e6c2..110f7a0 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 _0x373d=['VtigerAccount','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x373d,0x1e2));var _0xd373=function(_0x4b9f35,_0x287585){_0x4b9f35=_0x4b9f35-0x0;var _0x200ea1=_0x373d[_0x4b9f35];return _0x200ea1;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['GetVtigerAccount']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['VtigerAccount']['findAll']({'raw':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x15')]===undefined?!![]:![]:!![],'where':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0x460259['options']?_0x460259[_0xd373('0x14')][_0xd373('0x17')]||null:null,'limit':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x18')]||null:null,'include':_0x460259[_0xd373('0x14')]?_0x460259['options'][_0xd373('0x19')]?_[_0xd373('0x1a')](_0x460259[_0xd373('0x14')][_0xd373('0x19')],function(_0x217ee7){return{'model':db[_0x217ee7[_0xd373('0x1b')]],'as':_0x217ee7['as'],'attributes':_0x217ee7[_0xd373('0x17')],'include':_0x217ee7[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x217ee7[_0xd373('0x19')],function(_0x437110){return{'model':db[_0x437110[_0xd373('0x1b')]],'as':_0x437110['as'],'attributes':_0x437110[_0xd373('0x17')],'include':_0x437110[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x437110[_0xd373('0x19')],function(_0x50b987){return{'model':db[_0x50b987[_0xd373('0x1b')]],'as':_0x50b987['as'],'attributes':_0x50b987[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x45ee58){logger[_0xd373('0xa')](_0xd373('0x1d'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x1d'),_0x460259,JSON[_0xd373('0xd')](_0x45ee58));_0x55c5c7(_0x45ee58);})[_0xd373('0x13')](function(_0xbc420b){logger[_0xd373('0xe')](_0xd373('0x1d'),_0xbc420b['message'],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0xbc420b['message']));});});};exports['ShowVtigerAccount']=function(_0xedc8f3){var _0x15da6c=this;return new Promise(function(_0x25e016,_0x23024c){return db[_0xd373('0x1e')]['find']({'raw':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x17')]||null:null,'include':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')]?_['map'](_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')],function(_0x420c73){return{'model':db[_0x420c73[_0xd373('0x1b')]],'as':_0x420c73['as'],'attributes':_0x420c73[_0xd373('0x17')],'include':_0x420c73[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x420c73[_0xd373('0x19')],function(_0xaa62aa){return{'model':db[_0xaa62aa[_0xd373('0x1b')]],'as':_0xaa62aa['as'],'attributes':_0xaa62aa[_0xd373('0x17')],'include':_0xaa62aa[_0xd373('0x19')]?_[_0xd373('0x1a')](_0xaa62aa[_0xd373('0x19')],function(_0x22429c){return{'model':db[_0x22429c['model']],'as':_0x22429c['as'],'attributes':_0x22429c[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x186e39){logger[_0xd373('0xa')]('ShowVtigerAccount',_0xedc8f3);logger[_0xd373('0xc')](_0xd373('0x1f'),_0xedc8f3,JSON[_0xd373('0xd')](_0x186e39));_0x25e016(_0x186e39);})[_0xd373('0x13')](function(_0x38d8ec){logger[_0xd373('0xe')]('ShowVtigerAccount',_0x38d8ec['message'],_0xedc8f3);_0x23024c(_0x15da6c[_0xd373('0xe')](0x1f4,_0x38d8ec['message']));});});}; \ No newline at end of file +var _0x0fd9=['../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x0fd9[_0x1aa3fe];return _0x163cee;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});}exports[_0x90fd('0x15')]=function(_0x1fcc87){var _0x4d8f3b=this;return new Promise(function(_0x3f9c76,_0x16e9e3){return db[_0x90fd('0x16')][_0x90fd('0x17')]({'raw':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'limit':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')]['limit']||null:null,'include':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x30f67e){return{'model':db[_0x30f67e[_0x90fd('0x1e')]],'as':_0x30f67e['as'],'attributes':_0x30f67e['attributes'],'include':_0x30f67e[_0x90fd('0x1c')]?_['map'](_0x30f67e[_0x90fd('0x1c')],function(_0x18d5b3){return{'model':db[_0x18d5b3[_0x90fd('0x1e')]],'as':_0x18d5b3['as'],'attributes':_0x18d5b3[_0x90fd('0x1b')],'include':_0x18d5b3[_0x90fd('0x1c')]?_['map'](_0x18d5b3[_0x90fd('0x1c')],function(_0xe333f0){return{'model':db[_0xe333f0[_0x90fd('0x1e')]],'as':_0xe333f0['as'],'attributes':_0xe333f0[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x428bc2){logger['info']('GetVtigerAccount',_0x1fcc87);logger[_0x90fd('0xe')](_0x90fd('0x15'),_0x1fcc87,JSON[_0x90fd('0x10')](_0x428bc2));_0x3f9c76(_0x428bc2);})[_0x90fd('0x14')](function(_0x397aaf){logger['error']('GetVtigerAccount',_0x397aaf[_0x90fd('0x13')],_0x1fcc87);_0x16e9e3(_0x4d8f3b[_0x90fd('0x11')](0x1f4,_0x397aaf[_0x90fd('0x13')]));});});};exports[_0x90fd('0x20')]=function(_0x4a3ae4){var _0x59aede=this;return new Promise(function(_0x12dea4,_0x21a9cf){return db[_0x90fd('0x16')][_0x90fd('0x21')]({'raw':_0x4a3ae4['options']?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'include':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x209e5c){return{'model':db[_0x209e5c[_0x90fd('0x1e')]],'as':_0x209e5c['as'],'attributes':_0x209e5c['attributes'],'include':_0x209e5c[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x209e5c[_0x90fd('0x1c')],function(_0x3aee5){return{'model':db[_0x3aee5[_0x90fd('0x1e')]],'as':_0x3aee5['as'],'attributes':_0x3aee5[_0x90fd('0x1b')],'include':_0x3aee5[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x3aee5[_0x90fd('0x1c')],function(_0x186f4f){return{'model':db[_0x186f4f[_0x90fd('0x1e')]],'as':_0x186f4f['as'],'attributes':_0x186f4f[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x4c20b0){logger[_0x90fd('0xb')](_0x90fd('0x20'),_0x4a3ae4);logger[_0x90fd('0xe')](_0x90fd('0x20'),_0x4a3ae4,JSON['stringify'](_0x4c20b0));_0x12dea4(_0x4c20b0);})[_0x90fd('0x14')](function(_0x2c4f37){logger[_0x90fd('0x11')]('ShowVtigerAccount',_0x2c4f37['message'],_0x4a3ae4);_0x21a9cf(_0x59aede[_0x90fd('0x11')](0x1f4,_0x2c4f37[_0x90fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2b26ac5..c4556fc 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 _0x9e18=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1e83f4,_0x550f83){var _0x484f9c=function(_0x2a453a){while(--_0x2a453a){_0x1e83f4['push'](_0x1e83f4['shift']());}};_0x484f9c(++_0x550f83);}(_0x9e18,0x19e));var _0x89e1=function(_0x454876,_0x580571){_0x454876=_0x454876-0x0;var _0x1084e6=_0x9e18[_0x454876];return _0x1084e6;};'use strict';var multer=require(_0x89e1('0x0'));var util=require(_0x89e1('0x1'));var path=require(_0x89e1('0x2'));var timeout=require('connect-timeout');var express=require(_0x89e1('0x3'));var router=express['Router']();var fs_extra=require(_0x89e1('0x4'));var auth=require(_0x89e1('0x5'));var interaction=require(_0x89e1('0x6'));var config=require(_0x89e1('0x7'));var controller=require(_0x89e1('0x8'));router[_0x89e1('0x9')]('/',auth['isAuthenticated'](),controller[_0x89e1('0xa')]);router['get'](_0x89e1('0xb'),auth[_0x89e1('0xc')](),controller[_0x89e1('0xd')]);router[_0x89e1('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x89e1('0xe')]);router[_0x89e1('0x9')](_0x89e1('0xf'),auth[_0x89e1('0xc')](),controller[_0x89e1('0x10')]);router[_0x89e1('0x9')](_0x89e1('0x11'),auth[_0x89e1('0xc')](),controller[_0x89e1('0x12')]);router[_0x89e1('0x13')]('/',auth['isAuthenticated'](),controller[_0x89e1('0x14')]);router[_0x89e1('0x15')](_0x89e1('0xb'),auth[_0x89e1('0xc')](),controller[_0x89e1('0x16')]);router[_0x89e1('0x17')](_0x89e1('0xb'),auth[_0x89e1('0xc')](),controller[_0x89e1('0x18')]);module[_0x89e1('0x19')]=router; \ No newline at end of file +var _0x462c=['getSubjects','getDescriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/fields','isAuthenticated','getFields'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x462c,0x167));var _0xc462=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x462c[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xc462('0x0'));var path=require(_0xc462('0x1'));var timeout=require(_0xc462('0x2'));var express=require(_0xc462('0x3'));var router=express[_0xc462('0x4')]();var fs_extra=require(_0xc462('0x5'));var auth=require(_0xc462('0x6'));var interaction=require(_0xc462('0x7'));var config=require(_0xc462('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc462('0x9')](_0xc462('0xa'),auth['isAuthenticated'](),controller[_0xc462('0xb')]);router['get'](_0xc462('0xc'),auth[_0xc462('0xd')](),controller[_0xc462('0xe')]);router[_0xc462('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xc462('0xf')]);router[_0xc462('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc462('0x10')]);router['post']('/',auth[_0xc462('0xd')](),controller[_0xc462('0x11')]);router[_0xc462('0x12')](_0xc462('0xa'),auth[_0xc462('0xd')](),controller[_0xc462('0x13')]);router[_0xc462('0x14')](_0xc462('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc462('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 199c1f6..ef1ee66 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 _0x5111=['exports','sequelize'];(function(_0x11e2b0,_0x386c82){var _0x1b9672=function(_0x51096d){while(--_0x51096d){_0x11e2b0['push'](_0x11e2b0['shift']());}};_0x1b9672(++_0x386c82);}(_0x5111,0x137));var _0x1511=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5111[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x1511('0x0'));module[_0x1511('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x058c=['STRING','sequelize','exports'];(function(_0x15ca34,_0x286541){var _0x44b8be=function(_0x143f29){while(--_0x143f29){_0x15ca34['push'](_0x15ca34['shift']());}};_0x44b8be(++_0x286541);}(_0x058c,0x166));var _0xc058=function(_0x487f2a,_0xd5690){_0x487f2a=_0x487f2a-0x0;var _0x418e46=_0x058c[_0x487f2a];return _0x418e46;};'use strict';var Sequelize=require(_0xc058('0x0'));module[_0xc058('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc058('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c91834d..844e201 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 _0xdf0a=['getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find'];(function(_0x38ebf5,_0x27c9df){var _0x462037=function(_0x53b204){while(--_0x53b204){_0x38ebf5['push'](_0x38ebf5['shift']());}};_0x462037(++_0x27c9df);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x56ec31,_0x4b6690){_0x56ec31=_0x56ec31-0x0;var _0x30bd0f=_0xdf0a[_0x56ec31];return _0x30bd0f;};'use strict';var emlformat=require(_0xadf0('0x0'));var rimraf=require(_0xadf0('0x1'));var zipdir=require(_0xadf0('0x2'));var jsonpatch=require(_0xadf0('0x3'));var rp=require(_0xadf0('0x4'));var moment=require('moment');var BPromise=require(_0xadf0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xadf0('0x6'));var sox=require(_0xadf0('0x7'));var csv=require('to-csv');var ejs=require(_0xadf0('0x8'));var fs=require('fs');var fs_extra=require(_0xadf0('0x9'));var _=require(_0xadf0('0xa'));var squel=require(_0xadf0('0xb'));var crypto=require(_0xadf0('0xc'));var jsforce=require(_0xadf0('0xd'));var deskjs=require(_0xadf0('0xe'));var toCsv=require(_0xadf0('0xf'));var querystring=require('querystring');var Papa=require(_0xadf0('0x10'));var Redis=require(_0xadf0('0x11'));var authService=require(_0xadf0('0x12'));var qs=require(_0xadf0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadf0('0x14'));var logger=require(_0xadf0('0x15'))(_0xadf0('0x16'));var utils=require(_0xadf0('0x17'));var config=require(_0xadf0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xadf0('0x19'))['db'];function respondWithStatusCode(_0x2fcb9f,_0x216dec){_0x216dec=_0x216dec||0xcc;return function(_0x1fcefa){if(_0x1fcefa){return _0x2fcb9f[_0xadf0('0x1a')](_0x216dec);}return _0x2fcb9f[_0xadf0('0x1b')](_0x216dec)[_0xadf0('0x1c')]();};}function respondWithResult(_0x4d9601,_0x2d09ef){_0x2d09ef=_0x2d09ef||0xc8;return function(_0x30cdba){if(_0x30cdba){return _0x4d9601[_0xadf0('0x1b')](_0x2d09ef)[_0xadf0('0x1d')](_0x30cdba);}};}function respondWithFilteredResult(_0xa303e1,_0x212441){return function(_0x329420){if(_0x329420){var _0x1cd099=typeof _0x212441[_0xadf0('0x1e')]===_0xadf0('0x1f')&&typeof _0x212441['limit']===_0xadf0('0x1f');var _0x3beccb=_0x329420[_0xadf0('0x20')];var _0x4b64a8=_0x1cd099?0x0:_0x212441['offset'];var _0x30f688=_0x1cd099?_0x329420['count']:_0x212441['offset']+_0x212441[_0xadf0('0x21')];var _0x27b006;if(_0x30f688>=_0x3beccb){_0x30f688=_0x3beccb;_0x27b006=0xc8;}else{_0x27b006=0xce;}_0xa303e1[_0xadf0('0x1b')](_0x27b006);return _0xa303e1[_0xadf0('0x22')](_0xadf0('0x23'),_0x4b64a8+'-'+_0x30f688+'/'+_0x3beccb)[_0xadf0('0x1d')](_0x329420);}return null;};}function patchUpdates(_0x36145a){return function(_0x3a0971){try{jsonpatch[_0xadf0('0x24')](_0x3a0971,_0x36145a,!![]);}catch(_0x1196a7){return BPromise[_0xadf0('0x25')](_0x1196a7);}return _0x3a0971[_0xadf0('0x26')]();};}function saveUpdates(_0x195538,_0x5833eb){return function(_0x3243c2){if(_0x3243c2){return _0x3243c2[_0xadf0('0x27')](_0x195538)[_0xadf0('0x28')](function(_0x1ba248){return _0x1ba248;});}return null;};}function removeEntity(_0x457548,_0x2d3771){return function(_0x1e0eaf){if(_0x1e0eaf){return _0x1e0eaf[_0xadf0('0x29')]()['then'](function(){_0x457548['status'](0xcc)[_0xadf0('0x1c')]();});}};}function handleEntityNotFound(_0x373cfa,_0x4c7520){return function(_0x153512){if(!_0x153512){_0x373cfa['sendStatus'](0x194);}return _0x153512;};}function handleError(_0x347744,_0x1aad81){_0x1aad81=_0x1aad81||0x1f4;return function(_0x5d66e8){logger[_0xadf0('0x2a')](_0x5d66e8[_0xadf0('0x2b')]);if(_0x5d66e8[_0xadf0('0x2c')]){delete _0x5d66e8['name'];}_0x347744[_0xadf0('0x1b')](_0x1aad81)['send'](_0x5d66e8);};}exports[_0xadf0('0x2d')]=function(_0x334cad,_0x3d2040){var _0x21ad08={},_0x200efa={},_0x342364={'count':0x0,'rows':[]};var _0x494ee6=_[_0xadf0('0x2e')](db[_0xadf0('0x2f')][_0xadf0('0x30')],function(_0x325576){return{'name':_0x325576[_0xadf0('0x31')],'type':_0x325576[_0xadf0('0x32')][_0xadf0('0x33')]};});_0x200efa[_0xadf0('0x34')]=_['map'](_0x494ee6,_0xadf0('0x2c'));_0x200efa[_0xadf0('0x35')]=_[_0xadf0('0x36')](_0x334cad[_0xadf0('0x35')]);_0x200efa[_0xadf0('0x37')]=_['intersection'](_0x200efa[_0xadf0('0x34')],_0x200efa['query']);_0x21ad08['attributes']=_[_0xadf0('0x38')](_0x200efa['model'],qs[_0xadf0('0x39')](_0x334cad[_0xadf0('0x35')]['fields']));_0x21ad08[_0xadf0('0x3a')]=_0x21ad08[_0xadf0('0x3a')][_0xadf0('0x3b')]?_0x21ad08[_0xadf0('0x3a')]:_0x200efa[_0xadf0('0x34')];if(!_0x334cad['query'][_0xadf0('0x3c')](_0xadf0('0x3d'))){_0x21ad08[_0xadf0('0x21')]=qs[_0xadf0('0x21')](_0x334cad[_0xadf0('0x35')][_0xadf0('0x21')]);_0x21ad08['offset']=qs[_0xadf0('0x1e')](_0x334cad[_0xadf0('0x35')][_0xadf0('0x1e')]);}_0x21ad08[_0xadf0('0x3e')]=qs[_0xadf0('0x3f')](_0x334cad[_0xadf0('0x35')]['sort']);_0x21ad08[_0xadf0('0x40')]=qs[_0xadf0('0x37')](_[_0xadf0('0x41')](_0x334cad[_0xadf0('0x35')],_0x200efa[_0xadf0('0x37')]),_0x494ee6);if(_0x334cad[_0xadf0('0x35')][_0xadf0('0x42')]){_0x21ad08['where']=_[_0xadf0('0x43')](_0x21ad08[_0xadf0('0x40')],{'$or':_[_0xadf0('0x2e')](_0x494ee6,function(_0x219cc5){if(_0x219cc5[_0xadf0('0x32')]!=='VIRTUAL'){var _0x104d3d={};_0x104d3d[_0x219cc5[_0xadf0('0x2c')]]={'$like':'%'+_0x334cad[_0xadf0('0x35')]['filter']+'%'};return _0x104d3d;}})});}_0x21ad08=_[_0xadf0('0x43')]({},_0x21ad08,_0x334cad[_0xadf0('0x44')]);var _0x66a7d7={'where':_0x21ad08[_0xadf0('0x40')]};return db[_0xadf0('0x2f')][_0xadf0('0x20')](_0x66a7d7)['then'](function(_0x71827e){_0x342364[_0xadf0('0x20')]=_0x71827e;if(_0x334cad['query'][_0xadf0('0x45')]){_0x21ad08[_0xadf0('0x46')]=[{'all':!![]}];}return db[_0xadf0('0x2f')][_0xadf0('0x47')](_0x21ad08);})['then'](function(_0xdd2411){_0x342364[_0xadf0('0x48')]=_0xdd2411;return _0x342364;})[_0xadf0('0x28')](respondWithFilteredResult(_0x3d2040,_0x21ad08))[_0xadf0('0x49')](handleError(_0x3d2040,null));};exports[_0xadf0('0x4a')]=function(_0x1df733,_0x21a253){var _0x42a9fe={'raw':![],'where':{'id':_0x1df733[_0xadf0('0x4b')]['id']}},_0x14687c={};_0x14687c['model']=_[_0xadf0('0x36')](db[_0xadf0('0x2f')][_0xadf0('0x30')]);_0x14687c[_0xadf0('0x35')]=_[_0xadf0('0x36')](_0x1df733['query']);_0x14687c['filters']=_[_0xadf0('0x38')](_0x14687c[_0xadf0('0x34')],_0x14687c[_0xadf0('0x35')]);_0x42a9fe['attributes']=_['intersection'](_0x14687c[_0xadf0('0x34')],qs[_0xadf0('0x39')](_0x1df733[_0xadf0('0x35')][_0xadf0('0x39')]));_0x42a9fe['attributes']=_0x42a9fe[_0xadf0('0x3a')][_0xadf0('0x3b')]?_0x42a9fe[_0xadf0('0x3a')]:_0x14687c[_0xadf0('0x34')];if(_0x1df733[_0xadf0('0x35')][_0xadf0('0x45')]){_0x42a9fe[_0xadf0('0x46')]=[{'all':!![]}];}_0x42a9fe=_[_0xadf0('0x43')]({},_0x42a9fe,_0x1df733[_0xadf0('0x44')]);return db['VtigerConfiguration']['find'](_0x42a9fe)[_0xadf0('0x28')](handleEntityNotFound(_0x21a253,null))[_0xadf0('0x28')](respondWithResult(_0x21a253,null))[_0xadf0('0x49')](handleError(_0x21a253,null));};exports[_0xadf0('0x4c')]=function(_0xf80642,_0x31239d){return db['VtigerConfiguration'][_0xadf0('0x4c')](_0xf80642[_0xadf0('0x4d')],{})[_0xadf0('0x28')](respondWithResult(_0x31239d,0xc9))[_0xadf0('0x49')](handleError(_0x31239d,null));};exports[_0xadf0('0x27')]=function(_0x3f4fbe,_0x29156d){if(_0x3f4fbe[_0xadf0('0x4d')]['id']){delete _0x3f4fbe[_0xadf0('0x4d')]['id'];}return db[_0xadf0('0x2f')][_0xadf0('0x4e')]({'where':{'id':_0x3f4fbe[_0xadf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29156d,null))[_0xadf0('0x28')](saveUpdates(_0x3f4fbe[_0xadf0('0x4d')],null))['then'](respondWithResult(_0x29156d,null))[_0xadf0('0x49')](handleError(_0x29156d,null));};exports['destroy']=function(_0x48fa01,_0x2564c8){return db['VtigerConfiguration']['find']({'where':{'id':_0x48fa01[_0xadf0('0x4b')]['id']}})[_0xadf0('0x28')](handleEntityNotFound(_0x2564c8,null))['then'](removeEntity(_0x2564c8,null))[_0xadf0('0x49')](handleError(_0x2564c8,null));};exports[_0xadf0('0x4f')]=function(_0xeafa91,_0x104bc5,_0x41cdf4){var _0x3816ac={};var _0x4d97a3={};var _0x39fdc0;var _0x3269b0;return db[_0xadf0('0x2f')][_0xadf0('0x50')]({'where':{'id':_0xeafa91['params']['id']}})[_0xadf0('0x28')](handleEntityNotFound(_0x104bc5,null))[_0xadf0('0x28')](function(_0x180100){if(_0x180100){_0x39fdc0=_0x180100;_0x4d97a3[_0xadf0('0x34')]=_['keys'](db[_0xadf0('0x51')]['rawAttributes']);_0x4d97a3[_0xadf0('0x35')]=_[_0xadf0('0x36')](_0xeafa91[_0xadf0('0x35')]);_0x4d97a3[_0xadf0('0x37')]=_['intersection'](_0x4d97a3[_0xadf0('0x34')],_0x4d97a3['query']);_0x3816ac['attributes']=_[_0xadf0('0x38')](_0x4d97a3[_0xadf0('0x34')],qs[_0xadf0('0x39')](_0xeafa91['query']['fields']));_0x3816ac[_0xadf0('0x3a')]=_0x3816ac[_0xadf0('0x3a')][_0xadf0('0x3b')]?_0x3816ac[_0xadf0('0x3a')]:_0x4d97a3[_0xadf0('0x34')];_0x3816ac['order']=qs[_0xadf0('0x3f')](_0xeafa91[_0xadf0('0x35')]['sort']);_0x3816ac['where']=qs[_0xadf0('0x37')](_['pick'](_0xeafa91['query'],_0x4d97a3[_0xadf0('0x37')]));if(_0xeafa91['query'][_0xadf0('0x42')]){_0x3816ac[_0xadf0('0x40')]=_[_0xadf0('0x43')](_0x3816ac[_0xadf0('0x40')],{'$or':_[_0xadf0('0x2e')](_0x3816ac[_0xadf0('0x3a')],function(_0x43e6cd){var _0x4d2a82={};_0x4d2a82[_0x43e6cd]={'$like':'%'+_0xeafa91[_0xadf0('0x35')]['filter']+'%'};return _0x4d2a82;})});}_0x3816ac=_[_0xadf0('0x43')]({},_0x3816ac,_0xeafa91[_0xadf0('0x44')]);return _0x39fdc0[_0xadf0('0x4f')](_0x3816ac);}})[_0xadf0('0x28')](function(_0x3f000f){if(_0x3f000f){_0x3269b0=_0x3f000f[_0xadf0('0x3b')];if(!_0xeafa91[_0xadf0('0x35')][_0xadf0('0x3c')](_0xadf0('0x3d'))){_0x3816ac[_0xadf0('0x21')]=qs['limit'](_0xeafa91[_0xadf0('0x35')]['limit']);_0x3816ac[_0xadf0('0x1e')]=qs['offset'](_0xeafa91[_0xadf0('0x35')][_0xadf0('0x1e')]);}return _0x39fdc0[_0xadf0('0x4f')](_0x3816ac);}})[_0xadf0('0x28')](function(_0x55f171){if(_0x55f171){return _0x55f171?{'count':_0x3269b0,'rows':_0x55f171}:null;}})[_0xadf0('0x28')](respondWithResult(_0x104bc5,null))[_0xadf0('0x49')](handleError(_0x104bc5,null));};exports['getSubjects']=function(_0x46dcf6,_0x2ec58f,_0x883cb2){var _0x28d4a3={};var _0x3eccea={};var _0xff14d7;var _0x261d29;return db[_0xadf0('0x2f')][_0xadf0('0x50')]({'where':{'id':_0x46dcf6[_0xadf0('0x4b')]['id']}})[_0xadf0('0x28')](handleEntityNotFound(_0x2ec58f,null))[_0xadf0('0x28')](function(_0x58df4a){if(_0x58df4a){_0xff14d7=_0x58df4a;_0x3eccea[_0xadf0('0x34')]=_[_0xadf0('0x36')](db[_0xadf0('0x51')][_0xadf0('0x30')]);_0x3eccea[_0xadf0('0x35')]=_[_0xadf0('0x36')](_0x46dcf6['query']);_0x3eccea[_0xadf0('0x37')]=_[_0xadf0('0x38')](_0x3eccea['model'],_0x3eccea['query']);_0x28d4a3[_0xadf0('0x3a')]=_[_0xadf0('0x38')](_0x3eccea[_0xadf0('0x34')],qs[_0xadf0('0x39')](_0x46dcf6[_0xadf0('0x35')][_0xadf0('0x39')]));_0x28d4a3[_0xadf0('0x3a')]=_0x28d4a3[_0xadf0('0x3a')][_0xadf0('0x3b')]?_0x28d4a3[_0xadf0('0x3a')]:_0x3eccea[_0xadf0('0x34')];_0x28d4a3[_0xadf0('0x3e')]=qs[_0xadf0('0x3f')](_0x46dcf6[_0xadf0('0x35')][_0xadf0('0x3f')]);_0x28d4a3['where']=qs[_0xadf0('0x37')](_[_0xadf0('0x41')](_0x46dcf6[_0xadf0('0x35')],_0x3eccea[_0xadf0('0x37')]));if(_0x46dcf6[_0xadf0('0x35')][_0xadf0('0x42')]){_0x28d4a3['where']=_['merge'](_0x28d4a3[_0xadf0('0x40')],{'$or':_[_0xadf0('0x2e')](_0x28d4a3['attributes'],function(_0x2e3d17){var _0x340be4={};_0x340be4[_0x2e3d17]={'$like':'%'+_0x46dcf6[_0xadf0('0x35')][_0xadf0('0x42')]+'%'};return _0x340be4;})});}_0x28d4a3=_[_0xadf0('0x43')]({},_0x28d4a3,_0x46dcf6[_0xadf0('0x44')]);return _0xff14d7[_0xadf0('0x52')](_0x28d4a3);}})['then'](function(_0x5aedff){if(_0x5aedff){_0x261d29=_0x5aedff[_0xadf0('0x3b')];if(!_0x46dcf6['query'][_0xadf0('0x3c')](_0xadf0('0x3d'))){_0x28d4a3[_0xadf0('0x21')]=qs[_0xadf0('0x21')](_0x46dcf6['query']['limit']);_0x28d4a3[_0xadf0('0x1e')]=qs[_0xadf0('0x1e')](_0x46dcf6['query']['offset']);}return _0xff14d7[_0xadf0('0x52')](_0x28d4a3);}})[_0xadf0('0x28')](function(_0x261019){if(_0x261019){return _0x261019?{'count':_0x261d29,'rows':_0x261019}:null;}})['then'](respondWithResult(_0x2ec58f,null))[_0xadf0('0x49')](handleError(_0x2ec58f,null));};exports[_0xadf0('0x53')]=function(_0x118ecc,_0x16a3ee,_0x10867e){var _0x4e2376={};var _0x124a56={};var _0x3f7746;var _0x53f6d5;return db[_0xadf0('0x2f')][_0xadf0('0x50')]({'where':{'id':_0x118ecc['params']['id']}})['then'](handleEntityNotFound(_0x16a3ee,null))['then'](function(_0x5a906a){if(_0x5a906a){_0x3f7746=_0x5a906a;_0x124a56['model']=_[_0xadf0('0x36')](db[_0xadf0('0x51')]['rawAttributes']);_0x124a56[_0xadf0('0x35')]=_[_0xadf0('0x36')](_0x118ecc['query']);_0x124a56['filters']=_[_0xadf0('0x38')](_0x124a56[_0xadf0('0x34')],_0x124a56['query']);_0x4e2376[_0xadf0('0x3a')]=_['intersection'](_0x124a56[_0xadf0('0x34')],qs[_0xadf0('0x39')](_0x118ecc[_0xadf0('0x35')][_0xadf0('0x39')]));_0x4e2376['attributes']=_0x4e2376[_0xadf0('0x3a')]['length']?_0x4e2376[_0xadf0('0x3a')]:_0x124a56[_0xadf0('0x34')];_0x4e2376[_0xadf0('0x3e')]=qs[_0xadf0('0x3f')](_0x118ecc['query']['sort']);_0x4e2376[_0xadf0('0x40')]=qs['filters'](_[_0xadf0('0x41')](_0x118ecc[_0xadf0('0x35')],_0x124a56['filters']));if(_0x118ecc[_0xadf0('0x35')][_0xadf0('0x42')]){_0x4e2376[_0xadf0('0x40')]=_['merge'](_0x4e2376['where'],{'$or':_[_0xadf0('0x2e')](_0x4e2376[_0xadf0('0x3a')],function(_0x2a49cf){var _0x14b2b2={};_0x14b2b2[_0x2a49cf]={'$like':'%'+_0x118ecc['query']['filter']+'%'};return _0x14b2b2;})});}_0x4e2376=_[_0xadf0('0x43')]({},_0x4e2376,_0x118ecc[_0xadf0('0x44')]);return _0x3f7746[_0xadf0('0x53')](_0x4e2376);}})[_0xadf0('0x28')](function(_0x43f94b){if(_0x43f94b){_0x53f6d5=_0x43f94b[_0xadf0('0x3b')];if(!_0x118ecc[_0xadf0('0x35')][_0xadf0('0x3c')](_0xadf0('0x3d'))){_0x4e2376[_0xadf0('0x21')]=qs[_0xadf0('0x21')](_0x118ecc[_0xadf0('0x35')][_0xadf0('0x21')]);_0x4e2376[_0xadf0('0x1e')]=qs['offset'](_0x118ecc[_0xadf0('0x35')]['offset']);}return _0x3f7746[_0xadf0('0x53')](_0x4e2376);}})['then'](function(_0x21249d){if(_0x21249d){return _0x21249d?{'count':_0x53f6d5,'rows':_0x21249d}:null;}})[_0xadf0('0x28')](respondWithResult(_0x16a3ee,null))[_0xadf0('0x49')](handleError(_0x16a3ee,null));}; \ No newline at end of file +var _0x2313=['mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','merge','options','includeAll','include','VtigerConfiguration','rows','catch','show','params','length','create','body','find','findOne','sort','filter','nolimit','getFields','getSubjects','getDescriptions','VtigerField','eml-format','fast-json-patch','moment','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2313,0x191));var _0x3231=function(_0x27ef87,_0x9d9c1f){_0x27ef87=_0x27ef87-0x0;var _0x39a887=_0x2313[_0x27ef87];return _0x39a887;};'use strict';var emlformat=require(_0x3231('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3231('0x1'));var rp=require('request-promise');var moment=require(_0x3231('0x2'));var BPromise=require(_0x3231('0x3'));var Mustache=require(_0x3231('0x4'));var util=require('util');var path=require(_0x3231('0x5'));var sox=require('sox');var csv=require(_0x3231('0x6'));var ejs=require(_0x3231('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3231('0x8'));var squel=require(_0x3231('0x9'));var crypto=require(_0x3231('0xa'));var jsforce=require(_0x3231('0xb'));var deskjs=require(_0x3231('0xc'));var toCsv=require(_0x3231('0x6'));var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require(_0x3231('0x10'));var qs=require(_0x3231('0x11'));var as=require(_0x3231('0x12'));var hardwareService=require(_0x3231('0x13'));var logger=require(_0x3231('0x14'))(_0x3231('0x15'));var utils=require(_0x3231('0x16'));var config=require(_0x3231('0x17'));var licenseUtil=require(_0x3231('0x18'));var db=require(_0x3231('0x19'))['db'];function respondWithStatusCode(_0x143d6c,_0x4cd784){_0x4cd784=_0x4cd784||0xcc;return function(_0x30f4e5){if(_0x30f4e5){return _0x143d6c[_0x3231('0x1a')](_0x4cd784);}return _0x143d6c['status'](_0x4cd784)['end']();};}function respondWithResult(_0x32f0bf,_0x5c1e28){_0x5c1e28=_0x5c1e28||0xc8;return function(_0x27de1d){if(_0x27de1d){return _0x32f0bf[_0x3231('0x1b')](_0x5c1e28)[_0x3231('0x1c')](_0x27de1d);}};}function respondWithFilteredResult(_0x378015,_0x538db9){return function(_0x58f108){if(_0x58f108){var _0x41eaa2=typeof _0x538db9[_0x3231('0x1d')]===_0x3231('0x1e')&&typeof _0x538db9[_0x3231('0x1f')]===_0x3231('0x1e');var _0x275292=_0x58f108[_0x3231('0x20')];var _0x560050=_0x41eaa2?0x0:_0x538db9[_0x3231('0x1d')];var _0x42123b=_0x41eaa2?_0x58f108[_0x3231('0x20')]:_0x538db9[_0x3231('0x1d')]+_0x538db9['limit'];var _0x488c62;if(_0x42123b>=_0x275292){_0x42123b=_0x275292;_0x488c62=0xc8;}else{_0x488c62=0xce;}_0x378015['status'](_0x488c62);return _0x378015[_0x3231('0x21')](_0x3231('0x22'),_0x560050+'-'+_0x42123b+'/'+_0x275292)['json'](_0x58f108);}return null;};}function patchUpdates(_0x4c0f7c){return function(_0x5cb4d3){try{jsonpatch[_0x3231('0x23')](_0x5cb4d3,_0x4c0f7c,!![]);}catch(_0x1285cc){return BPromise['reject'](_0x1285cc);}return _0x5cb4d3[_0x3231('0x24')]();};}function saveUpdates(_0x1e80f1,_0x446eba){return function(_0x132823){if(_0x132823){return _0x132823[_0x3231('0x25')](_0x1e80f1)[_0x3231('0x26')](function(_0x23c5d5){return _0x23c5d5;});}return null;};}function removeEntity(_0x1e4eb4,_0x2332f1){return function(_0x13a616){if(_0x13a616){return _0x13a616[_0x3231('0x27')]()[_0x3231('0x26')](function(){_0x1e4eb4[_0x3231('0x1b')](0xcc)[_0x3231('0x28')]();});}};}function handleEntityNotFound(_0x4078f2,_0x2dbda3){return function(_0x16c223){if(!_0x16c223){_0x4078f2['sendStatus'](0x194);}return _0x16c223;};}function handleError(_0x95ee3,_0x380315){_0x380315=_0x380315||0x1f4;return function(_0x3fdf50){logger[_0x3231('0x29')](_0x3fdf50[_0x3231('0x2a')]);if(_0x3fdf50[_0x3231('0x2b')]){delete _0x3fdf50[_0x3231('0x2b')];}_0x95ee3[_0x3231('0x1b')](_0x380315)[_0x3231('0x2c')](_0x3fdf50);};}exports['index']=function(_0x1156c8,_0x1d4839){var _0x146707={},_0x3caa93={},_0x1a2118={'count':0x0,'rows':[]};var _0x26b63d=_[_0x3231('0x2d')](db['VtigerConfiguration'][_0x3231('0x2e')],function(_0x9ac9cd){return{'name':_0x9ac9cd['fieldName'],'type':_0x9ac9cd[_0x3231('0x2f')][_0x3231('0x30')]};});_0x3caa93[_0x3231('0x31')]=_['map'](_0x26b63d,_0x3231('0x2b'));_0x3caa93[_0x3231('0x32')]=_[_0x3231('0x33')](_0x1156c8[_0x3231('0x32')]);_0x3caa93[_0x3231('0x34')]=_[_0x3231('0x35')](_0x3caa93[_0x3231('0x31')],_0x3caa93[_0x3231('0x32')]);_0x146707[_0x3231('0x36')]=_['intersection'](_0x3caa93[_0x3231('0x31')],qs[_0x3231('0x37')](_0x1156c8['query'][_0x3231('0x37')]));_0x146707[_0x3231('0x36')]=_0x146707[_0x3231('0x36')]['length']?_0x146707[_0x3231('0x36')]:_0x3caa93['model'];if(!_0x1156c8[_0x3231('0x32')][_0x3231('0x38')]('nolimit')){_0x146707[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x1156c8[_0x3231('0x32')][_0x3231('0x1f')]);_0x146707['offset']=qs[_0x3231('0x1d')](_0x1156c8[_0x3231('0x32')]['offset']);}_0x146707[_0x3231('0x39')]=qs['sort'](_0x1156c8['query']['sort']);_0x146707[_0x3231('0x3a')]=qs['filters'](_[_0x3231('0x3b')](_0x1156c8[_0x3231('0x32')],_0x3caa93[_0x3231('0x34')]),_0x26b63d);if(_0x1156c8[_0x3231('0x32')]['filter']){_0x146707[_0x3231('0x3a')]=_['merge'](_0x146707[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x26b63d,function(_0x190e8d){if(_0x190e8d[_0x3231('0x2f')]!=='VIRTUAL'){var _0x56daca={};_0x56daca[_0x190e8d[_0x3231('0x2b')]]={'$like':'%'+_0x1156c8[_0x3231('0x32')]['filter']+'%'};return _0x56daca;}})});}_0x146707=_[_0x3231('0x3c')]({},_0x146707,_0x1156c8[_0x3231('0x3d')]);var _0x3e23e9={'where':_0x146707['where']};return db['VtigerConfiguration'][_0x3231('0x20')](_0x3e23e9)[_0x3231('0x26')](function(_0xc44132){_0x1a2118[_0x3231('0x20')]=_0xc44132;if(_0x1156c8[_0x3231('0x32')][_0x3231('0x3e')]){_0x146707[_0x3231('0x3f')]=[{'all':!![]}];}return db[_0x3231('0x40')]['findAll'](_0x146707);})[_0x3231('0x26')](function(_0x2a20b5){_0x1a2118[_0x3231('0x41')]=_0x2a20b5;return _0x1a2118;})[_0x3231('0x26')](respondWithFilteredResult(_0x1d4839,_0x146707))[_0x3231('0x42')](handleError(_0x1d4839,null));};exports[_0x3231('0x43')]=function(_0xc939b,_0xdb3d92){var _0x1c7bb1={'raw':![],'where':{'id':_0xc939b[_0x3231('0x44')]['id']}},_0x2fc150={};_0x2fc150[_0x3231('0x31')]=_['keys'](db[_0x3231('0x40')][_0x3231('0x2e')]);_0x2fc150[_0x3231('0x32')]=_[_0x3231('0x33')](_0xc939b[_0x3231('0x32')]);_0x2fc150[_0x3231('0x34')]=_['intersection'](_0x2fc150[_0x3231('0x31')],_0x2fc150['query']);_0x1c7bb1[_0x3231('0x36')]=_[_0x3231('0x35')](_0x2fc150[_0x3231('0x31')],qs[_0x3231('0x37')](_0xc939b[_0x3231('0x32')][_0x3231('0x37')]));_0x1c7bb1[_0x3231('0x36')]=_0x1c7bb1[_0x3231('0x36')][_0x3231('0x45')]?_0x1c7bb1[_0x3231('0x36')]:_0x2fc150[_0x3231('0x31')];if(_0xc939b['query'][_0x3231('0x3e')]){_0x1c7bb1[_0x3231('0x3f')]=[{'all':!![]}];}_0x1c7bb1=_['merge']({},_0x1c7bb1,_0xc939b[_0x3231('0x3d')]);return db[_0x3231('0x40')]['find'](_0x1c7bb1)[_0x3231('0x26')](handleEntityNotFound(_0xdb3d92,null))[_0x3231('0x26')](respondWithResult(_0xdb3d92,null))[_0x3231('0x42')](handleError(_0xdb3d92,null));};exports[_0x3231('0x46')]=function(_0x4b521e,_0x3a78b7){return db[_0x3231('0x40')]['create'](_0x4b521e[_0x3231('0x47')],{})[_0x3231('0x26')](respondWithResult(_0x3a78b7,0xc9))[_0x3231('0x42')](handleError(_0x3a78b7,null));};exports[_0x3231('0x25')]=function(_0x2742e7,_0x2033c3){if(_0x2742e7[_0x3231('0x47')]['id']){delete _0x2742e7[_0x3231('0x47')]['id'];}return db[_0x3231('0x40')][_0x3231('0x48')]({'where':{'id':_0x2742e7[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x2033c3,null))[_0x3231('0x26')](saveUpdates(_0x2742e7[_0x3231('0x47')],null))[_0x3231('0x26')](respondWithResult(_0x2033c3,null))[_0x3231('0x42')](handleError(_0x2033c3,null));};exports[_0x3231('0x27')]=function(_0x3d7f29,_0x386bcd){return db['VtigerConfiguration'][_0x3231('0x48')]({'where':{'id':_0x3d7f29[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x386bcd,null))['then'](removeEntity(_0x386bcd,null))[_0x3231('0x42')](handleError(_0x386bcd,null));};exports['getFields']=function(_0x1a8d3b,_0x28be02,_0xc85958){var _0x344f42={};var _0xb13705={};var _0x1ee3a4;var _0x2a8590;return db[_0x3231('0x40')][_0x3231('0x49')]({'where':{'id':_0x1a8d3b[_0x3231('0x44')]['id']}})['then'](handleEntityNotFound(_0x28be02,null))['then'](function(_0x558f56){if(_0x558f56){_0x1ee3a4=_0x558f56;_0xb13705[_0x3231('0x31')]=_[_0x3231('0x33')](db['VtigerField'][_0x3231('0x2e')]);_0xb13705[_0x3231('0x32')]=_[_0x3231('0x33')](_0x1a8d3b[_0x3231('0x32')]);_0xb13705['filters']=_[_0x3231('0x35')](_0xb13705[_0x3231('0x31')],_0xb13705['query']);_0x344f42[_0x3231('0x36')]=_['intersection'](_0xb13705[_0x3231('0x31')],qs[_0x3231('0x37')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x37')]));_0x344f42[_0x3231('0x36')]=_0x344f42[_0x3231('0x36')][_0x3231('0x45')]?_0x344f42[_0x3231('0x36')]:_0xb13705[_0x3231('0x31')];_0x344f42[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x4a')]);_0x344f42[_0x3231('0x3a')]=qs['filters'](_['pick'](_0x1a8d3b['query'],_0xb13705['filters']));if(_0x1a8d3b['query'][_0x3231('0x4b')]){_0x344f42[_0x3231('0x3a')]=_[_0x3231('0x3c')](_0x344f42[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x344f42[_0x3231('0x36')],function(_0x46f3ec){var _0x408167={};_0x408167[_0x46f3ec]={'$like':'%'+_0x1a8d3b[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x408167;})});}_0x344f42=_[_0x3231('0x3c')]({},_0x344f42,_0x1a8d3b[_0x3231('0x3d')]);return _0x1ee3a4['getFields'](_0x344f42);}})[_0x3231('0x26')](function(_0xb77df5){if(_0xb77df5){_0x2a8590=_0xb77df5[_0x3231('0x45')];if(!_0x1a8d3b[_0x3231('0x32')]['hasOwnProperty'](_0x3231('0x4c'))){_0x344f42[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x1f')]);_0x344f42[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x1d')]);}return _0x1ee3a4[_0x3231('0x4d')](_0x344f42);}})[_0x3231('0x26')](function(_0xc06a83){if(_0xc06a83){return _0xc06a83?{'count':_0x2a8590,'rows':_0xc06a83}:null;}})['then'](respondWithResult(_0x28be02,null))[_0x3231('0x42')](handleError(_0x28be02,null));};exports[_0x3231('0x4e')]=function(_0x281527,_0x2eb8a2,_0x1df559){var _0xb37162={};var _0x45f7cc={};var _0x470b32;var _0x1a06b2;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x281527[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x2eb8a2,null))['then'](function(_0xf8afd7){if(_0xf8afd7){_0x470b32=_0xf8afd7;_0x45f7cc[_0x3231('0x31')]=_['keys'](db['VtigerField'][_0x3231('0x2e')]);_0x45f7cc[_0x3231('0x32')]=_[_0x3231('0x33')](_0x281527['query']);_0x45f7cc[_0x3231('0x34')]=_[_0x3231('0x35')](_0x45f7cc[_0x3231('0x31')],_0x45f7cc[_0x3231('0x32')]);_0xb37162[_0x3231('0x36')]=_['intersection'](_0x45f7cc[_0x3231('0x31')],qs[_0x3231('0x37')](_0x281527[_0x3231('0x32')][_0x3231('0x37')]));_0xb37162[_0x3231('0x36')]=_0xb37162[_0x3231('0x36')][_0x3231('0x45')]?_0xb37162[_0x3231('0x36')]:_0x45f7cc[_0x3231('0x31')];_0xb37162[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x281527['query'][_0x3231('0x4a')]);_0xb37162['where']=qs[_0x3231('0x34')](_[_0x3231('0x3b')](_0x281527[_0x3231('0x32')],_0x45f7cc[_0x3231('0x34')]));if(_0x281527[_0x3231('0x32')]['filter']){_0xb37162[_0x3231('0x3a')]=_['merge'](_0xb37162[_0x3231('0x3a')],{'$or':_['map'](_0xb37162[_0x3231('0x36')],function(_0x4e9719){var _0x26c8c1={};_0x26c8c1[_0x4e9719]={'$like':'%'+_0x281527[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x26c8c1;})});}_0xb37162=_[_0x3231('0x3c')]({},_0xb37162,_0x281527[_0x3231('0x3d')]);return _0x470b32[_0x3231('0x4e')](_0xb37162);}})['then'](function(_0x447a84){if(_0x447a84){_0x1a06b2=_0x447a84['length'];if(!_0x281527[_0x3231('0x32')][_0x3231('0x38')](_0x3231('0x4c'))){_0xb37162[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x281527[_0x3231('0x32')][_0x3231('0x1f')]);_0xb37162[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x281527['query'][_0x3231('0x1d')]);}return _0x470b32[_0x3231('0x4e')](_0xb37162);}})[_0x3231('0x26')](function(_0x362df6){if(_0x362df6){return _0x362df6?{'count':_0x1a06b2,'rows':_0x362df6}:null;}})['then'](respondWithResult(_0x2eb8a2,null))[_0x3231('0x42')](handleError(_0x2eb8a2,null));};exports[_0x3231('0x4f')]=function(_0x3b69d6,_0x56a944,_0x1f83b9){var _0x35f464={};var _0x19034f={};var _0x302ea8;var _0x2aa2e7;return db[_0x3231('0x40')][_0x3231('0x49')]({'where':{'id':_0x3b69d6[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x56a944,null))['then'](function(_0x161304){if(_0x161304){_0x302ea8=_0x161304;_0x19034f[_0x3231('0x31')]=_['keys'](db[_0x3231('0x50')][_0x3231('0x2e')]);_0x19034f[_0x3231('0x32')]=_[_0x3231('0x33')](_0x3b69d6['query']);_0x19034f[_0x3231('0x34')]=_[_0x3231('0x35')](_0x19034f[_0x3231('0x31')],_0x19034f['query']);_0x35f464[_0x3231('0x36')]=_['intersection'](_0x19034f[_0x3231('0x31')],qs['fields'](_0x3b69d6[_0x3231('0x32')][_0x3231('0x37')]));_0x35f464[_0x3231('0x36')]=_0x35f464[_0x3231('0x36')][_0x3231('0x45')]?_0x35f464[_0x3231('0x36')]:_0x19034f[_0x3231('0x31')];_0x35f464[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x3b69d6['query'][_0x3231('0x4a')]);_0x35f464['where']=qs['filters'](_[_0x3231('0x3b')](_0x3b69d6[_0x3231('0x32')],_0x19034f[_0x3231('0x34')]));if(_0x3b69d6[_0x3231('0x32')]['filter']){_0x35f464[_0x3231('0x3a')]=_[_0x3231('0x3c')](_0x35f464[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x35f464['attributes'],function(_0x5267ea){var _0x440a03={};_0x440a03[_0x5267ea]={'$like':'%'+_0x3b69d6[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x440a03;})});}_0x35f464=_[_0x3231('0x3c')]({},_0x35f464,_0x3b69d6['options']);return _0x302ea8['getDescriptions'](_0x35f464);}})['then'](function(_0x2105ef){if(_0x2105ef){_0x2aa2e7=_0x2105ef['length'];if(!_0x3b69d6[_0x3231('0x32')][_0x3231('0x38')]('nolimit')){_0x35f464[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x3b69d6[_0x3231('0x32')][_0x3231('0x1f')]);_0x35f464[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x3b69d6['query']['offset']);}return _0x302ea8['getDescriptions'](_0x35f464);}})[_0x3231('0x26')](function(_0x34d74d){if(_0x34d74d){return _0x34d74d?{'count':_0x2aa2e7,'rows':_0x34d74d}:null;}})[_0x3231('0x26')](respondWithResult(_0x56a944,null))[_0x3231('0x42')](handleError(_0x56a944,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5da10dc..7ae4870 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 _0x5d9f=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x194da4,_0x2c4e3e){var _0x9d5ca=function(_0x21783d){while(--_0x21783d){_0x194da4['push'](_0x194da4['shift']());}};_0x9d5ca(++_0x2c4e3e);}(_0x5d9f,0x1c4));var _0xf5d9=function(_0x22f736,_0x4b6901){_0x22f736=_0x22f736-0x0;var _0x534c72=_0x5d9f[_0x22f736];return _0x534c72;};'use strict';var _=require(_0xf5d9('0x0'));var util=require(_0xf5d9('0x1'));var logger=require(_0xf5d9('0x2'))(_0xf5d9('0x3'));var moment=require(_0xf5d9('0x4'));var BPromise=require(_0xf5d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5d9('0x6'));var rimraf=require(_0xf5d9('0x7'));var config=require(_0xf5d9('0x8'));var attributes=require(_0xf5d9('0x9'));module[_0xf5d9('0xa')]=function(_0x574c44,_0x3ff338){return _0x574c44[_0xf5d9('0xb')](_0xf5d9('0xc'),attributes,{'tableName':_0xf5d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ad8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','util','../../config/logger','api'];(function(_0x4ecf10,_0x1f6ea7){var _0x2e737b=function(_0x35dc90){while(--_0x35dc90){_0x4ecf10['push'](_0x4ecf10['shift']());}};_0x2e737b(++_0x1f6ea7);}(_0x9ad8,0x16e));var _0x89ad=function(_0x36e4dc,_0x4cc695){_0x36e4dc=_0x36e4dc-0x0;var _0x303297=_0x9ad8[_0x36e4dc];return _0x303297;};'use strict';var _=require('lodash');var util=require(_0x89ad('0x0'));var logger=require(_0x89ad('0x1'))(_0x89ad('0x2'));var moment=require(_0x89ad('0x3'));var BPromise=require(_0x89ad('0x4'));var rp=require(_0x89ad('0x5'));var fs=require('fs');var path=require(_0x89ad('0x6'));var rimraf=require(_0x89ad('0x7'));var config=require(_0x89ad('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x4839eb,_0x2862bd){return _0x4839eb['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','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 9889f2c..7d99140 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 _0xe7f4=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0xe7f4,0x1ba));var _0x4e7f=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xe7f4[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x4e7f('0x0'));var util=require(_0x4e7f('0x1'));var moment=require(_0x4e7f('0x2'));var BPromise=require(_0x4e7f('0x3'));var rs=require(_0x4e7f('0x4'));var fs=require('fs');var Redis=require(_0x4e7f('0x5'));var db=require(_0x4e7f('0x6'))['db'];var utils=require(_0x4e7f('0x7'));var logger=require(_0x4e7f('0x8'))(_0x4e7f('0x9'));var config=require('../../config/environment');var jayson=require(_0x4e7f('0xa'));var client=jayson[_0x4e7f('0xb')][_0x4e7f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c61b0,_0x6dc55b,_0x4a0e3b){return new BPromise(function(_0x1fd440,_0x40ad55){return client[_0x4e7f('0xd')](_0x4c61b0,_0x4a0e3b)[_0x4e7f('0xe')](function(_0x30828d){logger[_0x4e7f('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x6dc55b,_0x4e7f('0x10'));logger[_0x4e7f('0x11')](_0x4e7f('0x12'),_0x6dc55b,_0x4e7f('0x10'),JSON[_0x4e7f('0x13')](_0x30828d));if(_0x30828d['error']){if(_0x30828d[_0x4e7f('0x14')][_0x4e7f('0x15')]===0x1f4){logger[_0x4e7f('0x14')](_0x4e7f('0x16'),_0x6dc55b,_0x30828d[_0x4e7f('0x14')][_0x4e7f('0x17')]);return _0x40ad55(_0x30828d[_0x4e7f('0x14')][_0x4e7f('0x17')]);}logger[_0x4e7f('0x14')](_0x4e7f('0x16'),_0x6dc55b,_0x30828d['error'][_0x4e7f('0x17')]);return _0x1fd440(_0x30828d[_0x4e7f('0x14')][_0x4e7f('0x17')]);}else{logger[_0x4e7f('0xf')](_0x4e7f('0x16'),_0x6dc55b,_0x4e7f('0x10'));_0x1fd440(_0x30828d[_0x4e7f('0x18')][_0x4e7f('0x17')]);}})[_0x4e7f('0x19')](function(_0x35fd2d){logger['error'](_0x4e7f('0x16'),_0x6dc55b,_0x35fd2d);_0x40ad55(_0x35fd2d);});});} \ No newline at end of file +var _0x2f2f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerConfiguration,\x20%s,\x20%s','info','result','catch','util','moment'];(function(_0x37bc10,_0x528f6f){var _0x10fff1=function(_0x295057){while(--_0x295057){_0x37bc10['push'](_0x37bc10['shift']());}};_0x10fff1(++_0x528f6f);}(_0x2f2f,0x1a0));var _0xf2f2=function(_0xdc5855,_0x356a7f){_0xdc5855=_0xdc5855-0x0;var _0x4996fd=_0x2f2f[_0xdc5855];return _0x4996fd;};'use strict';var _=require('lodash');var util=require(_0xf2f2('0x0'));var moment=require(_0xf2f2('0x1'));var BPromise=require(_0xf2f2('0x2'));var rs=require(_0xf2f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2f2('0x4'))['db'];var utils=require(_0xf2f2('0x5'));var logger=require(_0xf2f2('0x6'))(_0xf2f2('0x7'));var config=require(_0xf2f2('0x8'));var jayson=require(_0xf2f2('0x9'));var client=jayson[_0xf2f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2194c6,_0xf143f8,_0x3efc71){return new BPromise(function(_0x25edaa,_0x43668a){return client['request'](_0x2194c6,_0x3efc71)[_0xf2f2('0xb')](function(_0x12796a){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xf143f8,_0xf2f2('0xc'));logger[_0xf2f2('0xd')](_0xf2f2('0xe'),_0xf143f8,'request\x20sent',JSON[_0xf2f2('0xf')](_0x12796a));if(_0x12796a[_0xf2f2('0x10')]){if(_0x12796a[_0xf2f2('0x10')]['code']===0x1f4){logger[_0xf2f2('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xf143f8,_0x12796a['error']['message']);return _0x43668a(_0x12796a['error'][_0xf2f2('0x11')]);}logger[_0xf2f2('0x10')](_0xf2f2('0x12'),_0xf143f8,_0x12796a[_0xf2f2('0x10')][_0xf2f2('0x11')]);return _0x25edaa(_0x12796a[_0xf2f2('0x10')][_0xf2f2('0x11')]);}else{logger[_0xf2f2('0x13')](_0xf2f2('0x12'),_0xf143f8,_0xf2f2('0xc'));_0x25edaa(_0x12796a[_0xf2f2('0x14')]['message']);}})[_0xf2f2('0x15')](function(_0xd44aa){logger[_0xf2f2('0x10')](_0xf2f2('0x12'),_0xf143f8,_0xd44aa);_0x43668a(_0xd44aa);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fe9e947..6a9f301 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 _0xac5a=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xac5a,0x13b));var _0xaac5=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xac5a[_0x307d86];return _0x361745;};'use strict';var multer=require('multer');var util=require(_0xaac5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaac5('0x1'));var router=express['Router']();var fs_extra=require(_0xaac5('0x2'));var auth=require(_0xaac5('0x3'));var interaction=require(_0xaac5('0x4'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0xaac5('0x5')]('/',auth[_0xaac5('0x6')](),controller['index']);router[_0xaac5('0x5')](_0xaac5('0x7'),auth[_0xaac5('0x6')](),controller[_0xaac5('0x8')]);router[_0xaac5('0x9')]('/',auth[_0xaac5('0x6')](),controller[_0xaac5('0xa')]);router[_0xaac5('0xb')]('/:id',auth[_0xaac5('0x6')](),controller[_0xaac5('0xc')]);router[_0xaac5('0xd')](_0xaac5('0x7'),auth[_0xaac5('0x6')](),controller[_0xaac5('0xe')]);module[_0xaac5('0xf')]=router; \ No newline at end of file +var _0x1758=['update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','post','create','put'];(function(_0x464f02,_0x42ceb3){var _0x1491be=function(_0x3159fe){while(--_0x3159fe){_0x464f02['push'](_0x464f02['shift']());}};_0x1491be(++_0x42ceb3);}(_0x1758,0x10f));var _0x8175=function(_0x438051,_0x40d9cd){_0x438051=_0x438051-0x0;var _0x4e0f75=_0x1758[_0x438051];return _0x4e0f75;};'use strict';var multer=require(_0x8175('0x0'));var util=require(_0x8175('0x1'));var path=require(_0x8175('0x2'));var timeout=require('connect-timeout');var express=require(_0x8175('0x3'));var router=express[_0x8175('0x4')]();var fs_extra=require(_0x8175('0x5'));var auth=require(_0x8175('0x6'));var interaction=require(_0x8175('0x7'));var config=require(_0x8175('0x8'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x8175('0x9')](),controller['index']);router['get']('/:id',auth[_0x8175('0x9')](),controller[_0x8175('0xa')]);router[_0x8175('0xb')]('/',auth[_0x8175('0x9')](),controller[_0x8175('0xc')]);router[_0x8175('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8175('0xe')]);router[_0x8175('0xf')](_0x8175('0x10'),auth[_0x8175('0x9')](),controller[_0x8175('0x11')]);module[_0x8175('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index bac1688..d917f9e 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 _0x8e23=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x8e23,0x1d3));var _0x38e2=function(_0x31219f,_0x4a545b){_0x31219f=_0x31219f-0x0;var _0x1e1067=_0x8e23[_0x31219f];return _0x1e1067;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x38e2('0x0')](_0x38e2('0x1'),_0x38e2('0x2'),_0x38e2('0x3'),_0x38e2('0x4'),_0x38e2('0x5')),'defaultValue':_0x38e2('0x1')},'content':{'type':Sequelize[_0x38e2('0x6')]},'key':{'type':Sequelize[_0x38e2('0x6')]},'keyType':{'type':Sequelize[_0x38e2('0x0')](_0x38e2('0x1'),_0x38e2('0x2'),_0x38e2('0x3'))},'keyContent':{'type':Sequelize[_0x38e2('0x6')]},'idField':{'type':Sequelize[_0x38e2('0x6')]},'nameField':{'type':Sequelize[_0x38e2('0x6')]},'customField':{'type':Sequelize[_0x38e2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5427=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x360ec3,_0x2d9166){var _0x2db7d1=function(_0x5817c8){while(--_0x5817c8){_0x360ec3['push'](_0x360ec3['shift']());}};_0x2db7d1(++_0x2d9166);}(_0x5427,0x1b7));var _0x7542=function(_0x4e43f8,_0x353fef){_0x4e43f8=_0x4e43f8-0x0;var _0xebaebd=_0x5427[_0x4e43f8];return _0xebaebd;};'use strict';var Sequelize=require('sequelize');module[_0x7542('0x0')]={'type':{'type':Sequelize[_0x7542('0x1')](_0x7542('0x2'),_0x7542('0x3'),_0x7542('0x4'),'keyValue',_0x7542('0x5')),'defaultValue':_0x7542('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7542('0x1')](_0x7542('0x2'),_0x7542('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7542('0x6')]},'idField':{'type':Sequelize[_0x7542('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7542('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ce3f451..47e1e26 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 _0x2325=['json','apply','reject','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','Content-Range'];(function(_0x56e7a7,_0x5394cf){var _0x37b570=function(_0x54edde){while(--_0x54edde){_0x56e7a7['push'](_0x56e7a7['shift']());}};_0x37b570(++_0x5394cf);}(_0x2325,0xc2));var _0x5232=function(_0x136301,_0xd06f76){_0x136301=_0x136301-0x0;var _0x4d0379=_0x2325[_0x136301];return _0x4d0379;};'use strict';var emlformat=require(_0x5232('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5232('0x1'));var jsonpatch=require(_0x5232('0x2'));var rp=require(_0x5232('0x3'));var moment=require(_0x5232('0x4'));var BPromise=require(_0x5232('0x5'));var Mustache=require(_0x5232('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5232('0x7'));var ejs=require(_0x5232('0x8'));var fs=require('fs');var fs_extra=require(_0x5232('0x9'));var _=require(_0x5232('0xa'));var squel=require(_0x5232('0xb'));var crypto=require(_0x5232('0xc'));var jsforce=require(_0x5232('0xd'));var deskjs=require(_0x5232('0xe'));var toCsv=require(_0x5232('0x7'));var querystring=require(_0x5232('0xf'));var Papa=require(_0x5232('0x10'));var Redis=require(_0x5232('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5232('0x12'));var as=require(_0x5232('0x13'));var hardwareService=require(_0x5232('0x14'));var logger=require('../../config/logger')(_0x5232('0x15'));var utils=require(_0x5232('0x16'));var config=require(_0x5232('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5232('0x18'))['db'];function respondWithStatusCode(_0x5e67db,_0x1ec249){_0x1ec249=_0x1ec249||0xcc;return function(_0x497d62){if(_0x497d62){return _0x5e67db['sendStatus'](_0x1ec249);}return _0x5e67db[_0x5232('0x19')](_0x1ec249)[_0x5232('0x1a')]();};}function respondWithResult(_0x5d1b2,_0xbaabc7){_0xbaabc7=_0xbaabc7||0xc8;return function(_0x19db61){if(_0x19db61){return _0x5d1b2[_0x5232('0x19')](_0xbaabc7)['json'](_0x19db61);}};}function respondWithFilteredResult(_0x49f013,_0x572579){return function(_0x3f48c0){if(_0x3f48c0){var _0xdebd2b=typeof _0x572579[_0x5232('0x1b')]===_0x5232('0x1c')&&typeof _0x572579['limit']==='undefined';var _0x3bc9d6=_0x3f48c0['count'];var _0xabfbcc=_0xdebd2b?0x0:_0x572579[_0x5232('0x1b')];var _0x5276e2=_0xdebd2b?_0x3f48c0['count']:_0x572579[_0x5232('0x1b')]+_0x572579[_0x5232('0x1d')];var _0x4217a1;if(_0x5276e2>=_0x3bc9d6){_0x5276e2=_0x3bc9d6;_0x4217a1=0xc8;}else{_0x4217a1=0xce;}_0x49f013[_0x5232('0x19')](_0x4217a1);return _0x49f013['set'](_0x5232('0x1e'),_0xabfbcc+'-'+_0x5276e2+'/'+_0x3bc9d6)[_0x5232('0x1f')](_0x3f48c0);}return null;};}function patchUpdates(_0x55d182){return function(_0x52844f){try{jsonpatch[_0x5232('0x20')](_0x52844f,_0x55d182,!![]);}catch(_0x45387b){return BPromise[_0x5232('0x21')](_0x45387b);}return _0x52844f['save']();};}function saveUpdates(_0x5cc033,_0x25a5c1){return function(_0x50abca){if(_0x50abca){return _0x50abca['update'](_0x5cc033)[_0x5232('0x22')](function(_0x1c6a42){return _0x1c6a42;});}return null;};}function removeEntity(_0x3dc228,_0xd8d0c6){return function(_0x126e77){if(_0x126e77){return _0x126e77[_0x5232('0x23')]()['then'](function(){_0x3dc228[_0x5232('0x19')](0xcc)[_0x5232('0x1a')]();});}};}function handleEntityNotFound(_0x63c50b,_0x4691bc){return function(_0x2aa00c){if(!_0x2aa00c){_0x63c50b['sendStatus'](0x194);}return _0x2aa00c;};}function handleError(_0x3b4872,_0x2c8142){_0x2c8142=_0x2c8142||0x1f4;return function(_0x10dd8f){logger[_0x5232('0x24')](_0x10dd8f[_0x5232('0x25')]);if(_0x10dd8f[_0x5232('0x26')]){delete _0x10dd8f[_0x5232('0x26')];}_0x3b4872[_0x5232('0x19')](_0x2c8142)[_0x5232('0x27')](_0x10dd8f);};}exports[_0x5232('0x28')]=function(_0x313a0e,_0x5b5834){var _0x1a9bb6={},_0x5ac60f={},_0xee0cbb={'count':0x0,'rows':[]};var _0x26c87f=_['map'](db[_0x5232('0x29')][_0x5232('0x2a')],function(_0x7d07be){return{'name':_0x7d07be[_0x5232('0x2b')],'type':_0x7d07be[_0x5232('0x2c')][_0x5232('0x2d')]};});_0x5ac60f['model']=_[_0x5232('0x2e')](_0x26c87f,_0x5232('0x26'));_0x5ac60f[_0x5232('0x2f')]=_[_0x5232('0x30')](_0x313a0e[_0x5232('0x2f')]);_0x5ac60f[_0x5232('0x31')]=_[_0x5232('0x32')](_0x5ac60f[_0x5232('0x33')],_0x5ac60f[_0x5232('0x2f')]);_0x1a9bb6[_0x5232('0x34')]=_[_0x5232('0x32')](_0x5ac60f[_0x5232('0x33')],qs['fields'](_0x313a0e['query']['fields']));_0x1a9bb6['attributes']=_0x1a9bb6['attributes'][_0x5232('0x35')]?_0x1a9bb6[_0x5232('0x34')]:_0x5ac60f[_0x5232('0x33')];if(!_0x313a0e['query'][_0x5232('0x36')]('nolimit')){_0x1a9bb6[_0x5232('0x1d')]=qs['limit'](_0x313a0e['query']['limit']);_0x1a9bb6[_0x5232('0x1b')]=qs[_0x5232('0x1b')](_0x313a0e['query']['offset']);}_0x1a9bb6[_0x5232('0x37')]=qs[_0x5232('0x38')](_0x313a0e[_0x5232('0x2f')][_0x5232('0x38')]);_0x1a9bb6[_0x5232('0x39')]=qs['filters'](_[_0x5232('0x3a')](_0x313a0e['query'],_0x5ac60f[_0x5232('0x31')]),_0x26c87f);if(_0x313a0e[_0x5232('0x2f')][_0x5232('0x3b')]){_0x1a9bb6[_0x5232('0x39')]=_[_0x5232('0x3c')](_0x1a9bb6[_0x5232('0x39')],{'$or':_[_0x5232('0x2e')](_0x26c87f,function(_0x3e3a9e){if(_0x3e3a9e[_0x5232('0x2c')]!==_0x5232('0x3d')){var _0x222063={};_0x222063[_0x3e3a9e[_0x5232('0x26')]]={'$like':'%'+_0x313a0e[_0x5232('0x2f')]['filter']+'%'};return _0x222063;}})});}_0x1a9bb6=_[_0x5232('0x3c')]({},_0x1a9bb6,_0x313a0e[_0x5232('0x3e')]);var _0x161b16={'where':_0x1a9bb6[_0x5232('0x39')]};return db[_0x5232('0x29')][_0x5232('0x3f')](_0x161b16)[_0x5232('0x22')](function(_0x470189){_0xee0cbb[_0x5232('0x3f')]=_0x470189;if(_0x313a0e[_0x5232('0x2f')][_0x5232('0x40')]){_0x1a9bb6[_0x5232('0x41')]=[{'all':!![]}];}return db[_0x5232('0x29')][_0x5232('0x42')](_0x1a9bb6);})[_0x5232('0x22')](function(_0xbe530f){_0xee0cbb[_0x5232('0x43')]=_0xbe530f;return _0xee0cbb;})[_0x5232('0x22')](respondWithFilteredResult(_0x5b5834,_0x1a9bb6))[_0x5232('0x44')](handleError(_0x5b5834,null));};exports[_0x5232('0x45')]=function(_0xe1f206,_0xf2f720){var _0x35209c={'raw':!![],'where':{'id':_0xe1f206[_0x5232('0x46')]['id']}},_0x241954={};_0x241954['model']=_[_0x5232('0x30')](db[_0x5232('0x29')]['rawAttributes']);_0x241954[_0x5232('0x2f')]=_[_0x5232('0x30')](_0xe1f206[_0x5232('0x2f')]);_0x241954[_0x5232('0x31')]=_[_0x5232('0x32')](_0x241954[_0x5232('0x33')],_0x241954[_0x5232('0x2f')]);_0x35209c[_0x5232('0x34')]=_[_0x5232('0x32')](_0x241954[_0x5232('0x33')],qs['fields'](_0xe1f206[_0x5232('0x2f')][_0x5232('0x47')]));_0x35209c[_0x5232('0x34')]=_0x35209c[_0x5232('0x34')]['length']?_0x35209c[_0x5232('0x34')]:_0x241954['model'];if(_0xe1f206[_0x5232('0x2f')][_0x5232('0x40')]){_0x35209c['include']=[{'all':!![]}];}_0x35209c=_[_0x5232('0x3c')]({},_0x35209c,_0xe1f206[_0x5232('0x3e')]);return db[_0x5232('0x29')]['find'](_0x35209c)[_0x5232('0x22')](handleEntityNotFound(_0xf2f720,null))['then'](respondWithResult(_0xf2f720,null))[_0x5232('0x44')](handleError(_0xf2f720,null));};exports['create']=function(_0x547219,_0x3b2a60){return db[_0x5232('0x29')][_0x5232('0x48')](_0x547219[_0x5232('0x49')],{})[_0x5232('0x22')](respondWithResult(_0x3b2a60,0xc9))[_0x5232('0x44')](handleError(_0x3b2a60,null));};exports['update']=function(_0x3cfb93,_0x4916db){if(_0x3cfb93['body']['id']){delete _0x3cfb93[_0x5232('0x49')]['id'];}return db[_0x5232('0x29')][_0x5232('0x4a')]({'where':{'id':_0x3cfb93[_0x5232('0x46')]['id']}})[_0x5232('0x22')](handleEntityNotFound(_0x4916db,null))[_0x5232('0x22')](saveUpdates(_0x3cfb93[_0x5232('0x49')],null))['then'](respondWithResult(_0x4916db,null))[_0x5232('0x44')](handleError(_0x4916db,null));};exports['destroy']=function(_0x4fa8d2,_0x5f0ac1){return db[_0x5232('0x29')][_0x5232('0x4a')]({'where':{'id':_0x4fa8d2[_0x5232('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f0ac1,null))[_0x5232('0x22')](removeEntity(_0x5f0ac1,null))[_0x5232('0x44')](handleError(_0x5f0ac1,null));}; \ No newline at end of file +var _0x3ac3=['set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','findAll','show','params','includeAll','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count'];(function(_0x1c3205,_0x264f4c){var _0x1abf87=function(_0x151e8d){while(--_0x151e8d){_0x1c3205['push'](_0x1c3205['shift']());}};_0x1abf87(++_0x264f4c);}(_0x3ac3,0x155));var _0x33ac=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x3ac3[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require(_0x33ac('0x0'));var rimraf=require(_0x33ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33ac('0x2'));var rp=require(_0x33ac('0x3'));var moment=require(_0x33ac('0x4'));var BPromise=require(_0x33ac('0x5'));var Mustache=require('mustache');var util=require(_0x33ac('0x6'));var path=require(_0x33ac('0x7'));var sox=require('sox');var csv=require(_0x33ac('0x8'));var ejs=require(_0x33ac('0x9'));var fs=require('fs');var fs_extra=require(_0x33ac('0xa'));var _=require('lodash');var squel=require(_0x33ac('0xb'));var crypto=require('crypto');var jsforce=require(_0x33ac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33ac('0x8'));var querystring=require(_0x33ac('0xd'));var Papa=require(_0x33ac('0xe'));var Redis=require(_0x33ac('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33ac('0x10'));var as=require(_0x33ac('0x11'));var hardwareService=require(_0x33ac('0x12'));var logger=require(_0x33ac('0x13'))(_0x33ac('0x14'));var utils=require(_0x33ac('0x15'));var config=require(_0x33ac('0x16'));var licenseUtil=require(_0x33ac('0x17'));var db=require(_0x33ac('0x18'))['db'];function respondWithStatusCode(_0x2976fb,_0x1814c4){_0x1814c4=_0x1814c4||0xcc;return function(_0x290551){if(_0x290551){return _0x2976fb[_0x33ac('0x19')](_0x1814c4);}return _0x2976fb[_0x33ac('0x1a')](_0x1814c4)['end']();};}function respondWithResult(_0x53a94f,_0x2cd1f4){_0x2cd1f4=_0x2cd1f4||0xc8;return function(_0x46a5cb){if(_0x46a5cb){return _0x53a94f[_0x33ac('0x1a')](_0x2cd1f4)['json'](_0x46a5cb);}};}function respondWithFilteredResult(_0x3a31ef,_0x1b58b3){return function(_0x462a8){if(_0x462a8){var _0x1ea475=typeof _0x1b58b3[_0x33ac('0x1b')]==='undefined'&&typeof _0x1b58b3['limit']==='undefined';var _0x372170=_0x462a8[_0x33ac('0x1c')];var _0x3a435d=_0x1ea475?0x0:_0x1b58b3[_0x33ac('0x1b')];var _0x6e1f7b=_0x1ea475?_0x462a8[_0x33ac('0x1c')]:_0x1b58b3[_0x33ac('0x1b')]+_0x1b58b3['limit'];var _0x2e4b29;if(_0x6e1f7b>=_0x372170){_0x6e1f7b=_0x372170;_0x2e4b29=0xc8;}else{_0x2e4b29=0xce;}_0x3a31ef[_0x33ac('0x1a')](_0x2e4b29);return _0x3a31ef[_0x33ac('0x1d')]('Content-Range',_0x3a435d+'-'+_0x6e1f7b+'/'+_0x372170)[_0x33ac('0x1e')](_0x462a8);}return null;};}function patchUpdates(_0x533519){return function(_0x309785){try{jsonpatch[_0x33ac('0x1f')](_0x309785,_0x533519,!![]);}catch(_0x16c3a2){return BPromise[_0x33ac('0x20')](_0x16c3a2);}return _0x309785[_0x33ac('0x21')]();};}function saveUpdates(_0x303568,_0xab919){return function(_0x381d4d){if(_0x381d4d){return _0x381d4d[_0x33ac('0x22')](_0x303568)[_0x33ac('0x23')](function(_0x2e7da9){return _0x2e7da9;});}return null;};}function removeEntity(_0x2a97ff,_0x2ff36c){return function(_0x33b83e){if(_0x33b83e){return _0x33b83e['destroy']()[_0x33ac('0x23')](function(){_0x2a97ff['status'](0xcc)[_0x33ac('0x24')]();});}};}function handleEntityNotFound(_0x29aad1,_0x24855f){return function(_0x4ed4fd){if(!_0x4ed4fd){_0x29aad1[_0x33ac('0x19')](0x194);}return _0x4ed4fd;};}function handleError(_0x5d4c0a,_0x34114a){_0x34114a=_0x34114a||0x1f4;return function(_0x16087d){logger[_0x33ac('0x25')](_0x16087d[_0x33ac('0x26')]);if(_0x16087d[_0x33ac('0x27')]){delete _0x16087d['name'];}_0x5d4c0a[_0x33ac('0x1a')](_0x34114a)[_0x33ac('0x28')](_0x16087d);};}exports[_0x33ac('0x29')]=function(_0x204684,_0x1fe80d){var _0x179649={},_0xd45e6b={},_0x552a1d={'count':0x0,'rows':[]};var _0x42e971=_[_0x33ac('0x2a')](db[_0x33ac('0x2b')][_0x33ac('0x2c')],function(_0x151f17){return{'name':_0x151f17[_0x33ac('0x2d')],'type':_0x151f17['type'][_0x33ac('0x2e')]};});_0xd45e6b['model']=_[_0x33ac('0x2a')](_0x42e971,'name');_0xd45e6b[_0x33ac('0x2f')]=_[_0x33ac('0x30')](_0x204684['query']);_0xd45e6b['filters']=_[_0x33ac('0x31')](_0xd45e6b[_0x33ac('0x32')],_0xd45e6b['query']);_0x179649[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0xd45e6b[_0x33ac('0x32')],qs[_0x33ac('0x34')](_0x204684['query'][_0x33ac('0x34')]));_0x179649['attributes']=_0x179649[_0x33ac('0x33')][_0x33ac('0x35')]?_0x179649[_0x33ac('0x33')]:_0xd45e6b[_0x33ac('0x32')];if(!_0x204684['query'][_0x33ac('0x36')]('nolimit')){_0x179649[_0x33ac('0x37')]=qs[_0x33ac('0x37')](_0x204684['query'][_0x33ac('0x37')]);_0x179649[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x204684[_0x33ac('0x2f')][_0x33ac('0x1b')]);}_0x179649[_0x33ac('0x38')]=qs[_0x33ac('0x39')](_0x204684['query'][_0x33ac('0x39')]);_0x179649[_0x33ac('0x3a')]=qs[_0x33ac('0x3b')](_['pick'](_0x204684['query'],_0xd45e6b[_0x33ac('0x3b')]),_0x42e971);if(_0x204684['query'][_0x33ac('0x3c')]){_0x179649[_0x33ac('0x3a')]=_[_0x33ac('0x3d')](_0x179649['where'],{'$or':_['map'](_0x42e971,function(_0x37284a){if(_0x37284a[_0x33ac('0x3e')]!==_0x33ac('0x3f')){var _0x40a0ef={};_0x40a0ef[_0x37284a['name']]={'$like':'%'+_0x204684['query']['filter']+'%'};return _0x40a0ef;}})});}_0x179649=_[_0x33ac('0x3d')]({},_0x179649,_0x204684['options']);var _0x219385={'where':_0x179649[_0x33ac('0x3a')]};return db['VtigerField'][_0x33ac('0x1c')](_0x219385)[_0x33ac('0x23')](function(_0x102d85){_0x552a1d[_0x33ac('0x1c')]=_0x102d85;if(_0x204684[_0x33ac('0x2f')]['includeAll']){_0x179649['include']=[{'all':!![]}];}return db[_0x33ac('0x2b')][_0x33ac('0x40')](_0x179649);})[_0x33ac('0x23')](function(_0x3cb77e){_0x552a1d['rows']=_0x3cb77e;return _0x552a1d;})['then'](respondWithFilteredResult(_0x1fe80d,_0x179649))['catch'](handleError(_0x1fe80d,null));};exports[_0x33ac('0x41')]=function(_0x55aa74,_0x2dd4a2){var _0x1aebf3={'raw':!![],'where':{'id':_0x55aa74[_0x33ac('0x42')]['id']}},_0x178a17={};_0x178a17['model']=_[_0x33ac('0x30')](db['VtigerField'][_0x33ac('0x2c')]);_0x178a17[_0x33ac('0x2f')]=_[_0x33ac('0x30')](_0x55aa74['query']);_0x178a17[_0x33ac('0x3b')]=_['intersection'](_0x178a17[_0x33ac('0x32')],_0x178a17[_0x33ac('0x2f')]);_0x1aebf3[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x178a17['model'],qs[_0x33ac('0x34')](_0x55aa74[_0x33ac('0x2f')][_0x33ac('0x34')]));_0x1aebf3['attributes']=_0x1aebf3[_0x33ac('0x33')][_0x33ac('0x35')]?_0x1aebf3[_0x33ac('0x33')]:_0x178a17[_0x33ac('0x32')];if(_0x55aa74['query'][_0x33ac('0x43')]){_0x1aebf3['include']=[{'all':!![]}];}_0x1aebf3=_[_0x33ac('0x3d')]({},_0x1aebf3,_0x55aa74[_0x33ac('0x44')]);return db[_0x33ac('0x2b')][_0x33ac('0x45')](_0x1aebf3)[_0x33ac('0x23')](handleEntityNotFound(_0x2dd4a2,null))['then'](respondWithResult(_0x2dd4a2,null))[_0x33ac('0x46')](handleError(_0x2dd4a2,null));};exports[_0x33ac('0x47')]=function(_0x19d5e1,_0x555130){return db['VtigerField'][_0x33ac('0x47')](_0x19d5e1[_0x33ac('0x48')],{})['then'](respondWithResult(_0x555130,0xc9))[_0x33ac('0x46')](handleError(_0x555130,null));};exports[_0x33ac('0x22')]=function(_0xc0b6a2,_0x3ea7c3){if(_0xc0b6a2[_0x33ac('0x48')]['id']){delete _0xc0b6a2['body']['id'];}return db[_0x33ac('0x2b')][_0x33ac('0x45')]({'where':{'id':_0xc0b6a2[_0x33ac('0x42')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x3ea7c3,null))['then'](saveUpdates(_0xc0b6a2[_0x33ac('0x48')],null))[_0x33ac('0x23')](respondWithResult(_0x3ea7c3,null))['catch'](handleError(_0x3ea7c3,null));};exports[_0x33ac('0x49')]=function(_0x58da03,_0xc3b001){return db['VtigerField'][_0x33ac('0x45')]({'where':{'id':_0x58da03['params']['id']}})['then'](handleEntityNotFound(_0xc3b001,null))['then'](removeEntity(_0xc3b001,null))[_0x33ac('0x46')](handleError(_0xc3b001,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c3755ce..7c11e89 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 _0x0a5b=['request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','FieldId','lodash','util','../../config/logger','moment'];(function(_0x121b29,_0xe62994){var _0x354381=function(_0x51b2b0){while(--_0x51b2b0){_0x121b29['push'](_0x121b29['shift']());}};_0x354381(++_0xe62994);}(_0x0a5b,0x1e6));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb0a5('0x0'));var util=require(_0xb0a5('0x1'));var logger=require(_0xb0a5('0x2'))('api');var moment=require(_0xb0a5('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0a5('0x4'));var fs=require('fs');var path=require(_0xb0a5('0x5'));var rimraf=require(_0xb0a5('0x6'));var config=require(_0xb0a5('0x7'));var attributes=require(_0xb0a5('0x8'));module[_0xb0a5('0x9')]=function(_0x1bbb43,_0x415fb8){return _0x1bbb43[_0xb0a5('0xa')](_0xb0a5('0xb'),attributes,{'tableName':_0xb0a5('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xb0a5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0672=['rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x0672,0x78));var _0x2067=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x0672[_0x529abc];return _0x453afa;};'use strict';var _=require(_0x2067('0x0'));var util=require(_0x2067('0x1'));var logger=require(_0x2067('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2067('0x3'));var rp=require(_0x2067('0x4'));var fs=require('fs');var path=require(_0x2067('0x5'));var rimraf=require(_0x2067('0x6'));var config=require(_0x2067('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x2067('0x8')]=function(_0x2412cd,_0x4964ba){return _0x2412cd[_0x2067('0x9')](_0x2067('0xa'),attributes,{'tableName':_0x2067('0xb'),'paranoid':![],'indexes':[{'name':_0x2067('0xc'),'fields':['idField',_0x2067('0xd')],'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 fab3f37..48ed98f 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 _0xfadd=['client','http','then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7f1086,_0x434356){var _0x358a47=function(_0x1f14ab){while(--_0x1f14ab){_0x7f1086['push'](_0x7f1086['shift']());}};_0x358a47(++_0x434356);}(_0xfadd,0x1da));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var moment=require(_0xdfad('0x2'));var BPromise=require(_0xdfad('0x3'));var rs=require(_0xdfad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfad('0x5'))['db'];var utils=require(_0xdfad('0x6'));var logger=require(_0xdfad('0x7'))(_0xdfad('0x8'));var config=require(_0xdfad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfad('0xa')][_0xdfad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe9a3e2,_0x1032ac,_0x29306d){return new BPromise(function(_0x30a77e,_0x157a48){return client['request'](_0xe9a3e2,_0x29306d)[_0xdfad('0xc')](function(_0x1ea4e3){logger[_0xdfad('0xd')](_0xdfad('0xe'),_0x1032ac,'request\x20sent');logger[_0xdfad('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1032ac,_0xdfad('0x10'),JSON['stringify'](_0x1ea4e3));if(_0x1ea4e3[_0xdfad('0x11')]){if(_0x1ea4e3[_0xdfad('0x11')][_0xdfad('0x12')]===0x1f4){logger[_0xdfad('0x11')](_0xdfad('0xe'),_0x1032ac,_0x1ea4e3[_0xdfad('0x11')][_0xdfad('0x13')]);return _0x157a48(_0x1ea4e3[_0xdfad('0x11')][_0xdfad('0x13')]);}logger[_0xdfad('0x11')](_0xdfad('0xe'),_0x1032ac,_0x1ea4e3['error'][_0xdfad('0x13')]);return _0x30a77e(_0x1ea4e3['error'][_0xdfad('0x13')]);}else{logger[_0xdfad('0xd')](_0xdfad('0xe'),_0x1032ac,_0xdfad('0x10'));_0x30a77e(_0x1ea4e3[_0xdfad('0x14')][_0xdfad('0x13')]);}})[_0xdfad('0x15')](function(_0x17ce76){logger['error']('VtigerField,\x20%s,\x20%s',_0x1032ac,_0x17ce76);_0x157a48(_0x17ce76);});});} \ No newline at end of file +var _0x824d=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerField,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x10a1b1,_0x2be66e){var _0x57fada=function(_0x112aa0){while(--_0x112aa0){_0x10a1b1['push'](_0x10a1b1['shift']());}};_0x57fada(++_0x2be66e);}(_0x824d,0x141));var _0xd824=function(_0x27b10e,_0x2f0b91){_0x27b10e=_0x27b10e-0x0;var _0x2a5eb9=_0x824d[_0x27b10e];return _0x2a5eb9;};'use strict';var _=require(_0xd824('0x0'));var util=require(_0xd824('0x1'));var moment=require(_0xd824('0x2'));var BPromise=require(_0xd824('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd824('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd824('0x5'));var logger=require(_0xd824('0x6'))('rpc');var config=require(_0xd824('0x7'));var jayson=require(_0xd824('0x8'));var client=jayson[_0xd824('0x9')][_0xd824('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227877,_0xbbadc,_0x4f5f94){return new BPromise(function(_0x2739cb,_0x4e90ed){return client[_0xd824('0xb')](_0x227877,_0x4f5f94)[_0xd824('0xc')](function(_0x4e653b){logger[_0xd824('0xd')]('VtigerField,\x20%s,\x20%s',_0xbbadc,_0xd824('0xe'));logger['debug'](_0xd824('0xf'),_0xbbadc,_0xd824('0xe'),JSON[_0xd824('0x10')](_0x4e653b));if(_0x4e653b[_0xd824('0x11')]){if(_0x4e653b[_0xd824('0x11')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0xbbadc,_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);return _0x4e90ed(_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);}logger[_0xd824('0x11')](_0xd824('0x13'),_0xbbadc,_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);return _0x2739cb(_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);}else{logger[_0xd824('0xd')](_0xd824('0x13'),_0xbbadc,_0xd824('0xe'));_0x2739cb(_0x4e653b['result'][_0xd824('0x12')]);}})[_0xd824('0x14')](function(_0x35873e){logger[_0xd824('0x11')](_0xd824('0x13'),_0xbbadc,_0x35873e);_0x4e90ed(_0x35873e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 017aa53..c766ac1 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 _0x4198=['get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','create','post','/:id','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x4198,0x174));var _0x8419=function(_0x1cc416,_0x475130){_0x1cc416=_0x1cc416-0x0;var _0x467e0a=_0x4198[_0x1cc416];return _0x467e0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8419('0x0'));var timeout=require(_0x8419('0x1'));var express=require(_0x8419('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8419('0x3'));var interaction=require(_0x8419('0x4'));var config=require(_0x8419('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x8419('0x6')]('/',auth[_0x8419('0x7')](),controller[_0x8419('0x8')]);router[_0x8419('0x6')]('/:id',auth[_0x8419('0x7')](),controller['show']);router[_0x8419('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8419('0x9')]);router[_0x8419('0x6')](_0x8419('0xa'),auth[_0x8419('0x7')](),controller[_0x8419('0xb')]);router['post']('/',auth[_0x8419('0x7')](),controller[_0x8419('0xc')]);router[_0x8419('0xd')]('/:id/configurations',auth[_0x8419('0x7')](),controller['addConfiguration']);router['put'](_0x8419('0xe'),auth[_0x8419('0x7')](),controller[_0x8419('0xf')]);router['delete']('/:id',auth[_0x8419('0x7')](),controller[_0x8419('0x10')]);module[_0x8419('0x11')]=router; \ No newline at end of file +var _0xcb03=['post','create','/:id/configurations','addConfiguration','/:id','destroy','exports','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0x442691,_0x274600){var _0x10d16f=function(_0x5b22d8){while(--_0x5b22d8){_0x442691['push'](_0x442691['shift']());}};_0x10d16f(++_0x274600);}(_0xcb03,0x19f));var _0x3cb0=function(_0x5cdc8a,_0x1633cc){_0x5cdc8a=_0x5cdc8a-0x0;var _0x3f66a0=_0xcb03[_0x5cdc8a];return _0x3f66a0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3cb0('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cb0('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb0('0x2'));var controller=require('./intZendeskAccount.controller');router[_0x3cb0('0x3')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x5')]);router[_0x3cb0('0x3')]('/:id',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x6')]);router[_0x3cb0('0x3')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3cb0('0x7')]);router[_0x3cb0('0x3')](_0x3cb0('0x8'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x9')]);router[_0x3cb0('0xa')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xb')]);router[_0x3cb0('0xa')](_0x3cb0('0xc'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xd')]);router['put']('/:id',auth[_0x3cb0('0x4')](),controller['update']);router['delete'](_0x3cb0('0xe'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xf')]);module[_0x3cb0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fc9d03a..4145eb9 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 _0x50e5=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0x50e5,0xb7));var _0x550e=function(_0x30c648,_0x123c98){_0x30c648=_0x30c648-0x0;var _0x2d0a58=_0x50e5[_0x30c648];return _0x2d0a58;};'use strict';var Sequelize=require(_0x550e('0x0'));module[_0x550e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x550e('0x2')]},'username':{'type':Sequelize[_0x550e('0x2')],'unique':_0x550e('0x3')},'password':{'type':Sequelize[_0x550e('0x2')]},'token':{'type':Sequelize[_0x550e('0x2')]},'remoteUri':{'type':Sequelize[_0x550e('0x2')],'unique':_0x550e('0x4')},'authType':{'type':Sequelize[_0x550e('0x5')](_0x550e('0x6'),_0x550e('0x7')),'defaultValue':_0x550e('0x6')},'serverUrl':{'type':Sequelize[_0x550e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x550e('0x8'),_0x550e('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcf71=['username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x2d6f90,_0x3c43d4){var _0x529147=function(_0x20c241){while(--_0x20c241){_0x2d6f90['push'](_0x2d6f90['shift']());}};_0x529147(++_0x3c43d4);}(_0xcf71,0xba));var _0x1cf7=function(_0x4f4ca5,_0x4c02b8){_0x4f4ca5=_0x4f4ca5-0x0;var _0x4a2021=_0xcf71[_0x4f4ca5];return _0x4a2021;};'use strict';var Sequelize=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'name':{'type':Sequelize[_0x1cf7('0x2')]},'description':{'type':Sequelize[_0x1cf7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1cf7('0x3')},'password':{'type':Sequelize[_0x1cf7('0x2')]},'token':{'type':Sequelize[_0x1cf7('0x2')]},'remoteUri':{'type':Sequelize[_0x1cf7('0x2')],'unique':_0x1cf7('0x4')},'authType':{'type':Sequelize[_0x1cf7('0x5')](_0x1cf7('0x6'),_0x1cf7('0x7')),'defaultValue':_0x1cf7('0x6')},'serverUrl':{'type':Sequelize[_0x1cf7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1cf7('0x5')](_0x1cf7('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 95d640e..718f256 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 _0x0713=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','toString','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ZendeskAccount'];(function(_0xd1cb37,_0x24d583){var _0x322a54=function(_0x5c671a){while(--_0x5c671a){_0xd1cb37['push'](_0xd1cb37['shift']());}};_0x322a54(++_0x24d583);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5330a8,_0x1826ca){_0x1826ca=_0x1826ca||0xcc;return function(_0x5dc13b){if(_0x5dc13b){return _0x5330a8[_0x3071('0x1b')](_0x1826ca);}return _0x5330a8[_0x3071('0x1c')](_0x1826ca)['end']();};}function respondWithResult(_0x104e73,_0x4e1219){_0x4e1219=_0x4e1219||0xc8;return function(_0x2fc15d){if(_0x2fc15d){return _0x104e73[_0x3071('0x1c')](_0x4e1219)[_0x3071('0x1d')](_0x2fc15d);}};}function respondWithFilteredResult(_0x1f14e1,_0x1caa5d){return function(_0x2a6a4b){if(_0x2a6a4b){var _0x157a47=typeof _0x1caa5d[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1caa5d[_0x3071('0x20')]==='undefined';var _0x224996=_0x2a6a4b[_0x3071('0x21')];var _0x1068d9=_0x157a47?0x0:_0x1caa5d[_0x3071('0x1e')];var _0x3acf0e=_0x157a47?_0x2a6a4b[_0x3071('0x21')]:_0x1caa5d[_0x3071('0x1e')]+_0x1caa5d[_0x3071('0x20')];var _0x502a16;if(_0x3acf0e>=_0x224996){_0x3acf0e=_0x224996;_0x502a16=0xc8;}else{_0x502a16=0xce;}_0x1f14e1[_0x3071('0x1c')](_0x502a16);return _0x1f14e1[_0x3071('0x22')](_0x3071('0x23'),_0x1068d9+'-'+_0x3acf0e+'/'+_0x224996)['json'](_0x2a6a4b);}return null;};}function patchUpdates(_0xb8f4e3){return function(_0x5cd80d){try{jsonpatch[_0x3071('0x24')](_0x5cd80d,_0xb8f4e3,!![]);}catch(_0x43128c){return BPromise[_0x3071('0x25')](_0x43128c);}return _0x5cd80d[_0x3071('0x26')]();};}function saveUpdates(_0x33090c,_0x34c50e){return function(_0x3c5cef){if(_0x3c5cef){return _0x3c5cef[_0x3071('0x27')](_0x33090c)['then'](function(_0x481a51){return _0x481a51;});}return null;};}function removeEntity(_0x2ce48a,_0xb05b1d){return function(_0x412652){if(_0x412652){return _0x412652[_0x3071('0x28')]()[_0x3071('0x29')](function(){_0x2ce48a[_0x3071('0x1c')](0xcc)[_0x3071('0x2a')]();});}};}function handleEntityNotFound(_0x1fe727,_0x1de5fb){return function(_0x4c7130){if(!_0x4c7130){_0x1fe727[_0x3071('0x1b')](0x194);}return _0x4c7130;};}function handleError(_0x3f1e6e,_0x177138){_0x177138=_0x177138||0x1f4;return function(_0x4d5c4b){logger[_0x3071('0x2b')](_0x4d5c4b[_0x3071('0x2c')]);if(_0x4d5c4b[_0x3071('0x2d')]){delete _0x4d5c4b[_0x3071('0x2d')];}_0x3f1e6e[_0x3071('0x1c')](_0x177138)[_0x3071('0x2e')](_0x4d5c4b);};}exports[_0x3071('0x2f')]=function(_0x3921a1,_0x32f1b4){var _0x292205={},_0x254fc8={},_0x5aba96={'count':0x0,'rows':[]};var _0x4f1484=_[_0x3071('0x30')](db[_0x3071('0x31')][_0x3071('0x32')],function(_0x40be95){return{'name':_0x40be95[_0x3071('0x33')],'type':_0x40be95[_0x3071('0x34')][_0x3071('0x35')]};});_0x254fc8[_0x3071('0x36')]=_['map'](_0x4f1484,'name');_0x254fc8['query']=_[_0x3071('0x37')](_0x3921a1[_0x3071('0x38')]);_0x254fc8['filters']=_[_0x3071('0x39')](_0x254fc8[_0x3071('0x36')],_0x254fc8[_0x3071('0x38')]);_0x292205[_0x3071('0x3a')]=_['intersection'](_0x254fc8[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x3921a1[_0x3071('0x38')][_0x3071('0x3b')]));_0x292205[_0x3071('0x3a')]=_0x292205[_0x3071('0x3a')][_0x3071('0x3c')]?_0x292205[_0x3071('0x3a')]:_0x254fc8['model'];if(!_0x3921a1[_0x3071('0x38')]['hasOwnProperty']('nolimit')){_0x292205[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x3921a1['query'][_0x3071('0x20')]);_0x292205[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x3921a1[_0x3071('0x38')][_0x3071('0x1e')]);}_0x292205[_0x3071('0x3d')]=qs['sort'](_0x3921a1[_0x3071('0x38')][_0x3071('0x3e')]);_0x292205['where']=qs[_0x3071('0x3f')](_['pick'](_0x3921a1[_0x3071('0x38')],_0x254fc8[_0x3071('0x3f')]),_0x4f1484);if(_0x3921a1['query']['filter']){_0x292205[_0x3071('0x40')]=_[_0x3071('0x41')](_0x292205[_0x3071('0x40')],{'$or':_['map'](_0x4f1484,function(_0x4dea69){if(_0x4dea69['type']!==_0x3071('0x42')){var _0x4b7928={};_0x4b7928[_0x4dea69[_0x3071('0x2d')]]={'$like':'%'+_0x3921a1[_0x3071('0x38')][_0x3071('0x43')]+'%'};return _0x4b7928;}})});}_0x292205=_[_0x3071('0x41')]({},_0x292205,_0x3921a1[_0x3071('0x44')]);var _0x593c9c={'where':_0x292205['where']};return db[_0x3071('0x31')][_0x3071('0x21')](_0x593c9c)[_0x3071('0x29')](function(_0x1f69a6){_0x5aba96['count']=_0x1f69a6;if(_0x3921a1[_0x3071('0x38')][_0x3071('0x45')]){_0x292205[_0x3071('0x46')]=[{'all':!![]}];}return db[_0x3071('0x31')][_0x3071('0x47')](_0x292205);})[_0x3071('0x29')](function(_0x56a9d8){_0x5aba96[_0x3071('0x48')]=_0x56a9d8;return _0x5aba96;})['then'](respondWithFilteredResult(_0x32f1b4,_0x292205))['catch'](handleError(_0x32f1b4,null));};exports['show']=function(_0x47ceaf,_0x2992e6){var _0x1be8b6={'raw':![],'where':{'id':_0x47ceaf[_0x3071('0x49')]['id']}},_0x67b2fb={};_0x67b2fb[_0x3071('0x36')]=_[_0x3071('0x37')](db[_0x3071('0x31')][_0x3071('0x32')]);_0x67b2fb['query']=_[_0x3071('0x37')](_0x47ceaf[_0x3071('0x38')]);_0x67b2fb[_0x3071('0x3f')]=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],_0x67b2fb['query']);_0x1be8b6['attributes']=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x47ceaf[_0x3071('0x38')][_0x3071('0x3b')]));_0x1be8b6['attributes']=_0x1be8b6[_0x3071('0x3a')]['length']?_0x1be8b6[_0x3071('0x3a')]:_0x67b2fb['model'];if(_0x47ceaf['query'][_0x3071('0x45')]){_0x1be8b6['include']=[{'all':!![]}];}_0x1be8b6=_[_0x3071('0x41')]({},_0x1be8b6,_0x47ceaf['options']);return db[_0x3071('0x31')][_0x3071('0x4a')](_0x1be8b6)[_0x3071('0x29')](handleEntityNotFound(_0x2992e6,null))[_0x3071('0x29')](respondWithResult(_0x2992e6,null))['catch'](handleError(_0x2992e6,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){return db['ZendeskAccount'][_0x3071('0x4b')](_0x575c12[_0x3071('0x4c')],{})['then'](respondWithResult(_0xd273ec,0xc9))[_0x3071('0x4d')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x224a70,_0x38bcc2){if(_0x224a70[_0x3071('0x4c')]['id']){delete _0x224a70[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')]['find']({'where':{'id':_0x224a70[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x38bcc2,null))[_0x3071('0x29')](saveUpdates(_0x224a70[_0x3071('0x4c')],null))['then'](respondWithResult(_0x38bcc2,null))[_0x3071('0x4d')](handleError(_0x38bcc2,null));};exports[_0x3071('0x28')]=function(_0x1b832e,_0x2307dd){return db[_0x3071('0x31')][_0x3071('0x4a')]({'where':{'id':_0x1b832e[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x2307dd,null))[_0x3071('0x29')](removeEntity(_0x2307dd,null))[_0x3071('0x4d')](handleError(_0x2307dd,null));};exports[_0x3071('0x4e')]=function(_0x111115,_0x24977b,_0x114f1f){var _0x1656de={};var _0x12be97={};var _0x596cdd;var _0x47a438;return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x111115[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x24977b,null))[_0x3071('0x29')](function(_0x514821){if(_0x514821){_0x596cdd=_0x514821;_0x12be97[_0x3071('0x36')]=_[_0x3071('0x37')](db['ZendeskConfiguration']['rawAttributes']);_0x12be97[_0x3071('0x38')]=_[_0x3071('0x37')](_0x111115[_0x3071('0x38')]);_0x12be97[_0x3071('0x3f')]=_['intersection'](_0x12be97[_0x3071('0x36')],_0x12be97[_0x3071('0x38')]);_0x1656de[_0x3071('0x3a')]=_[_0x3071('0x39')](_0x12be97[_0x3071('0x36')],qs['fields'](_0x111115[_0x3071('0x38')][_0x3071('0x3b')]));_0x1656de[_0x3071('0x3a')]=_0x1656de[_0x3071('0x3a')][_0x3071('0x3c')]?_0x1656de[_0x3071('0x3a')]:_0x12be97[_0x3071('0x36')];_0x1656de['order']=qs['sort'](_0x111115[_0x3071('0x38')]['sort']);_0x1656de[_0x3071('0x40')]=qs[_0x3071('0x3f')](_['pick'](_0x111115[_0x3071('0x38')],_0x12be97[_0x3071('0x3f')]));if(_0x111115['query'][_0x3071('0x43')]){_0x1656de[_0x3071('0x40')]=_[_0x3071('0x41')](_0x1656de[_0x3071('0x40')],{'$or':_[_0x3071('0x30')](_0x1656de['attributes'],function(_0x327ef0){var _0x313a54={};_0x313a54[_0x327ef0]={'$like':'%'+_0x111115[_0x3071('0x38')]['filter']+'%'};return _0x313a54;})});}_0x1656de=_[_0x3071('0x41')]({},_0x1656de,_0x111115[_0x3071('0x44')]);return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x379723){if(_0x379723){_0x47a438=_0x379723[_0x3071('0x3c')];if(!_0x111115[_0x3071('0x38')][_0x3071('0x4f')](_0x3071('0x50'))){_0x1656de['limit']=qs[_0x3071('0x20')](_0x111115[_0x3071('0x38')][_0x3071('0x20')]);_0x1656de[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x111115[_0x3071('0x38')][_0x3071('0x1e')]);}return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x302680){if(_0x302680){return _0x302680?{'count':_0x47a438,'rows':_0x302680}:null;}})[_0x3071('0x29')](respondWithResult(_0x24977b,null))['catch'](handleError(_0x24977b,null));};exports[_0x3071('0x51')]=function(_0x315044,_0x279594,_0x3ed86c){if(_0x315044[_0x3071('0x4c')]['id']){delete _0x315044[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')][_0x3071('0x52')]({'where':{'id':_0x315044['params']['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x279594,null))[_0x3071('0x29')](function(_0x59ba87){if(_0x59ba87){_0x315044['body'][_0x3071('0x53')]=_0x59ba87['id'];_0x315044[_0x3071('0x4c')][_0x3071('0x54')]=integrations[_0x3071('0x55')](_0x315044['body']['channel'],_0x315044[_0x3071('0x4c')]['type']);_0x315044['body']['Descriptions']=integrations['getDescriptions'](_0x315044[_0x3071('0x4c')][_0x3071('0x56')],_0x315044[_0x3071('0x4c')]['type']);return db[_0x3071('0x57')][_0x3071('0x4b')](_0x315044[_0x3071('0x4c')],{'include':[{'model':db[_0x3071('0x58')],'as':'Subjects'},{'model':db[_0x3071('0x58')],'as':_0x3071('0x59')}]});}return null;})['then'](respondWithResult(_0x279594,null))[_0x3071('0x4d')](handleError(_0x279594,null));};exports[_0x3071('0x5a')]=function(_0x388cd1,_0x40c258,_0x4edd23){var _0x11ffdd='';return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x388cd1['params']['id']},'attributes':['id',_0x3071('0x5b'),_0x3071('0x5c'),_0x3071('0x5d'),'authType','remoteUri']})[_0x3071('0x29')](handleEntityNotFound(_0x40c258,null))[_0x3071('0x29')](function(_0x3bad84){if(_0x3bad84){_0x11ffdd=_0x3bad84[_0x3071('0x5e')];var _0x2f1935=_0x11ffdd[_0x3071('0x5f')](-0x1);if(_0x2f1935==='/'){_0x11ffdd=_0x11ffdd[_0x3071('0x60')](0x0,_0x11ffdd[_0x3071('0x61')](_0x2f1935));}var _0x5eed64={'method':_0x3071('0x62'),'uri':util['format'](_0x3071('0x63'),_0x11ffdd,_0x3071('0x64')),'json':!![]};switch(_0x3bad84[_0x3071('0x65')]){case _0x3071('0x5c'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')](_0x3071('0x68'),new Buffer(util[_0x3071('0x67')]('%s:%s',_0x3bad84[_0x3071('0x5b')],_0x3bad84[_0x3071('0x5c')]))[_0x3071('0x69')]('base64'))};break;case _0x3071('0x5d'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')]('Basic\x20%s',new Buffer(util['format'](_0x3071('0x6a'),_0x3bad84['username'],_0x3bad84[_0x3071('0x5d')]))[_0x3071('0x69')](_0x3071('0x6b')))};break;default:throw new db[(_0x3071('0x6c'))][(_0x3071('0x6d'))](_0x3071('0x6e'));}return rp(_0x5eed64);}})[_0x3071('0x29')](function(_0x4c67ec){if(_0x4c67ec){var _0x1f2be3=[_0x3071('0x6f'),_0x3071('0x70'),_0x3071('0x71'),_0x3071('0x72')];_[_0x3071('0x73')](_0x4c67ec[_0x3071('0x64')],function(_0x277377){return _0x1f2be3['includes'](_0x277377[_0x3071('0x34')]);});return{'count':_0x4c67ec['ticket_fields'][_0x3071('0x3c')],'rows':_[_0x3071('0x30')](_0x4c67ec[_0x3071('0x64')],function(_0x45879b){return{'id':_0x45879b['id'],'name':_0x45879b[_0x3071('0x74')]>0x7?_0x45879b[_0x3071('0x75')]:_0x45879b[_0x3071('0x34')],'custom':_0x45879b[_0x3071('0x74')]>0x7?!![]:![],'options':_0x45879b[_0x3071('0x76')]?_0x45879b[_0x3071('0x76')]:_0x45879b['custom_field_options']?_0x45879b[_0x3071('0x77')]:[]};})};}})[_0x3071('0x29')](respondWithResult(_0x40c258,null))['catch'](function(_0x156826){var _0x3b7c95=_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?0x1f4:_0x156826[_0x3071('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3071('0x5a'),_0x3b7c95,JSON['stringify'](_0x156826));delete _0x156826[_0x3071('0x2d')];if(_0x3b7c95===0x191){_0x3b7c95=0x190;}_0x40c258[_0x3071('0x1c')](_0x3b7c95)[_0x3071('0x2e')](_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?{'message':_0x3071('0x7a'),'statusCode':_0x156826['statusCode']}:_0x156826);});}; \ No newline at end of file +var _0x7af2=['pick','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x34d8b0,_0x4fb629){var _0x2708bc=function(_0x2bca7d){while(--_0x2bca7d){_0x34d8b0['push'](_0x34d8b0['shift']());}};_0x2708bc(++_0x4fb629);}(_0x7af2,0x119));var _0x27af=function(_0x1acb07,_0x44fa67){_0x1acb07=_0x1acb07-0x0;var _0x4df84e=_0x7af2[_0x1acb07];return _0x4df84e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x406340,_0x203501){_0x203501=_0x203501||0xcc;return function(_0x1fd964){if(_0x1fd964){return _0x406340[_0x27af('0x17')](_0x203501);}return _0x406340[_0x27af('0x18')](_0x203501)[_0x27af('0x19')]();};}function respondWithResult(_0x234825,_0x3da435){_0x3da435=_0x3da435||0xc8;return function(_0x423222){if(_0x423222){return _0x234825[_0x27af('0x18')](_0x3da435)[_0x27af('0x1a')](_0x423222);}};}function respondWithFilteredResult(_0x9c2d4b,_0x2d7800){return function(_0x3102c4){if(_0x3102c4){var _0x2bfc9=typeof _0x2d7800[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x2d7800[_0x27af('0x1d')]==='undefined';var _0x315661=_0x3102c4[_0x27af('0x1e')];var _0x5997ae=_0x2bfc9?0x0:_0x2d7800['offset'];var _0x20a6d7=_0x2bfc9?_0x3102c4[_0x27af('0x1e')]:_0x2d7800[_0x27af('0x1b')]+_0x2d7800[_0x27af('0x1d')];var _0xec699a;if(_0x20a6d7>=_0x315661){_0x20a6d7=_0x315661;_0xec699a=0xc8;}else{_0xec699a=0xce;}_0x9c2d4b['status'](_0xec699a);return _0x9c2d4b[_0x27af('0x1f')](_0x27af('0x20'),_0x5997ae+'-'+_0x20a6d7+'/'+_0x315661)[_0x27af('0x1a')](_0x3102c4);}return null;};}function patchUpdates(_0x5e7c19){return function(_0x19afb1){try{jsonpatch[_0x27af('0x21')](_0x19afb1,_0x5e7c19,!![]);}catch(_0x2ae47e){return BPromise['reject'](_0x2ae47e);}return _0x19afb1[_0x27af('0x22')]();};}function saveUpdates(_0x2460f4,_0x30720b){return function(_0x2af76d){if(_0x2af76d){return _0x2af76d[_0x27af('0x23')](_0x2460f4)[_0x27af('0x24')](function(_0x43dd9e){return _0x43dd9e;});}return null;};}function removeEntity(_0x35b36d,_0x2e1bb0){return function(_0x49780b){if(_0x49780b){return _0x49780b['destroy']()['then'](function(){_0x35b36d[_0x27af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12625c,_0x396326){return function(_0x4ba49f){if(!_0x4ba49f){_0x12625c[_0x27af('0x17')](0x194);}return _0x4ba49f;};}function handleError(_0x1d9341,_0x463e36){_0x463e36=_0x463e36||0x1f4;return function(_0x424490){logger[_0x27af('0x25')](_0x424490[_0x27af('0x26')]);if(_0x424490[_0x27af('0x27')]){delete _0x424490['name'];}_0x1d9341[_0x27af('0x18')](_0x463e36)[_0x27af('0x28')](_0x424490);};}exports[_0x27af('0x29')]=function(_0xe009a,_0x25d65a){var _0xa08dd9={},_0x42a5b7={},_0x2b26ac={'count':0x0,'rows':[]};var _0x4406e2=_[_0x27af('0x2a')](db[_0x27af('0x2b')]['rawAttributes'],function(_0x15e867){return{'name':_0x15e867[_0x27af('0x2c')],'type':_0x15e867[_0x27af('0x2d')][_0x27af('0x2e')]};});_0x42a5b7[_0x27af('0x2f')]=_[_0x27af('0x2a')](_0x4406e2,'name');_0x42a5b7['query']=_[_0x27af('0x30')](_0xe009a[_0x27af('0x31')]);_0x42a5b7['filters']=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],_0x42a5b7[_0x27af('0x31')]);_0xa08dd9[_0x27af('0x33')]=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xe009a[_0x27af('0x31')][_0x27af('0x34')]));_0xa08dd9[_0x27af('0x33')]=_0xa08dd9[_0x27af('0x33')]['length']?_0xa08dd9['attributes']:_0x42a5b7[_0x27af('0x2f')];if(!_0xe009a[_0x27af('0x31')]['hasOwnProperty'](_0x27af('0x35'))){_0xa08dd9[_0x27af('0x1d')]=qs['limit'](_0xe009a[_0x27af('0x31')][_0x27af('0x1d')]);_0xa08dd9[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xe009a[_0x27af('0x31')]['offset']);}_0xa08dd9[_0x27af('0x36')]=qs[_0x27af('0x37')](_0xe009a['query']['sort']);_0xa08dd9[_0x27af('0x38')]=qs[_0x27af('0x39')](_[_0x27af('0x3a')](_0xe009a[_0x27af('0x31')],_0x42a5b7[_0x27af('0x39')]),_0x4406e2);if(_0xe009a[_0x27af('0x31')]['filter']){_0xa08dd9[_0x27af('0x38')]=_['merge'](_0xa08dd9[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x4406e2,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x5f5504={};_0x5f5504[_0x2a6b14[_0x27af('0x27')]]={'$like':'%'+_0xe009a[_0x27af('0x31')][_0x27af('0x3c')]+'%'};return _0x5f5504;}})});}_0xa08dd9=_[_0x27af('0x3d')]({},_0xa08dd9,_0xe009a[_0x27af('0x3e')]);var _0x32b558={'where':_0xa08dd9[_0x27af('0x38')]};return db[_0x27af('0x2b')][_0x27af('0x1e')](_0x32b558)[_0x27af('0x24')](function(_0xda424e){_0x2b26ac[_0x27af('0x1e')]=_0xda424e;if(_0xe009a[_0x27af('0x31')][_0x27af('0x3f')]){_0xa08dd9['include']=[{'all':!![]}];}return db[_0x27af('0x2b')][_0x27af('0x40')](_0xa08dd9);})[_0x27af('0x24')](function(_0x373c05){_0x2b26ac['rows']=_0x373c05;return _0x2b26ac;})[_0x27af('0x24')](respondWithFilteredResult(_0x25d65a,_0xa08dd9))['catch'](handleError(_0x25d65a,null));};exports['show']=function(_0x2425dd,_0x3c9c81){var _0x279f99={'raw':![],'where':{'id':_0x2425dd[_0x27af('0x41')]['id']}},_0x17efd6={};_0x17efd6[_0x27af('0x2f')]=_[_0x27af('0x30')](db[_0x27af('0x2b')][_0x27af('0x42')]);_0x17efd6[_0x27af('0x31')]=_[_0x27af('0x30')](_0x2425dd[_0x27af('0x31')]);_0x17efd6['filters']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],_0x17efd6['query']);_0x279f99['attributes']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x2425dd[_0x27af('0x31')][_0x27af('0x34')]));_0x279f99['attributes']=_0x279f99[_0x27af('0x33')]['length']?_0x279f99[_0x27af('0x33')]:_0x17efd6[_0x27af('0x2f')];if(_0x2425dd[_0x27af('0x31')][_0x27af('0x3f')]){_0x279f99[_0x27af('0x43')]=[{'all':!![]}];}_0x279f99=_[_0x27af('0x3d')]({},_0x279f99,_0x2425dd[_0x27af('0x3e')]);return db['ZendeskAccount']['find'](_0x279f99)[_0x27af('0x24')](handleEntityNotFound(_0x3c9c81,null))['then'](respondWithResult(_0x3c9c81,null))[_0x27af('0x44')](handleError(_0x3c9c81,null));};exports[_0x27af('0x45')]=function(_0x226025,_0x389962){return db[_0x27af('0x2b')][_0x27af('0x45')](_0x226025[_0x27af('0x46')],{})['then'](respondWithResult(_0x389962,0xc9))[_0x27af('0x44')](handleError(_0x389962,null));};exports[_0x27af('0x23')]=function(_0x20e180,_0x3fdc0e){if(_0x20e180[_0x27af('0x46')]['id']){delete _0x20e180['body']['id'];}return db[_0x27af('0x2b')][_0x27af('0x47')]({'where':{'id':_0x20e180[_0x27af('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fdc0e,null))['then'](saveUpdates(_0x20e180[_0x27af('0x46')],null))[_0x27af('0x24')](respondWithResult(_0x3fdc0e,null))[_0x27af('0x44')](handleError(_0x3fdc0e,null));};exports['destroy']=function(_0x495794,_0x2fad23){return db['ZendeskAccount'][_0x27af('0x47')]({'where':{'id':_0x495794[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2fad23,null))[_0x27af('0x24')](removeEntity(_0x2fad23,null))[_0x27af('0x44')](handleError(_0x2fad23,null));};exports[_0x27af('0x48')]=function(_0x123533,_0x374794,_0x1b6d94){var _0x24d8bf={};var _0x23369a={};var _0x5c02c1;var _0x76ed78;return db[_0x27af('0x2b')][_0x27af('0x49')]({'where':{'id':_0x123533[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x374794,null))[_0x27af('0x24')](function(_0x20c155){if(_0x20c155){_0x5c02c1=_0x20c155;_0x23369a[_0x27af('0x2f')]=_['keys'](db[_0x27af('0x4a')]['rawAttributes']);_0x23369a[_0x27af('0x31')]=_[_0x27af('0x30')](_0x123533[_0x27af('0x31')]);_0x23369a['filters']=_[_0x27af('0x32')](_0x23369a['model'],_0x23369a[_0x27af('0x31')]);_0x24d8bf[_0x27af('0x33')]=_[_0x27af('0x32')](_0x23369a['model'],qs[_0x27af('0x34')](_0x123533['query'][_0x27af('0x34')]));_0x24d8bf['attributes']=_0x24d8bf[_0x27af('0x33')][_0x27af('0x4b')]?_0x24d8bf[_0x27af('0x33')]:_0x23369a['model'];_0x24d8bf['order']=qs[_0x27af('0x37')](_0x123533[_0x27af('0x31')][_0x27af('0x37')]);_0x24d8bf[_0x27af('0x38')]=qs['filters'](_[_0x27af('0x3a')](_0x123533[_0x27af('0x31')],_0x23369a[_0x27af('0x39')]));if(_0x123533[_0x27af('0x31')][_0x27af('0x3c')]){_0x24d8bf[_0x27af('0x38')]=_['merge'](_0x24d8bf[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x24d8bf[_0x27af('0x33')],function(_0x2401c7){var _0x49eb46={};_0x49eb46[_0x2401c7]={'$like':'%'+_0x123533[_0x27af('0x31')]['filter']+'%'};return _0x49eb46;})});}_0x24d8bf=_[_0x27af('0x3d')]({},_0x24d8bf,_0x123533[_0x27af('0x3e')]);return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x13a5a8){if(_0x13a5a8){_0x76ed78=_0x13a5a8['length'];if(!_0x123533['query'][_0x27af('0x4c')](_0x27af('0x35'))){_0x24d8bf[_0x27af('0x1d')]=qs['limit'](_0x123533[_0x27af('0x31')][_0x27af('0x1d')]);_0x24d8bf['offset']=qs[_0x27af('0x1b')](_0x123533[_0x27af('0x31')]['offset']);}return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x1fa50b){if(_0x1fa50b){return _0x1fa50b?{'count':_0x76ed78,'rows':_0x1fa50b}:null;}})['then'](respondWithResult(_0x374794,null))['catch'](handleError(_0x374794,null));};exports[_0x27af('0x4d')]=function(_0xf97695,_0x2a8534,_0x266220){if(_0xf97695[_0x27af('0x46')]['id']){delete _0xf97695[_0x27af('0x46')]['id'];}return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0xf97695['params']['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2a8534,null))[_0x27af('0x24')](function(_0xa692f6){if(_0xa692f6){_0xf97695[_0x27af('0x46')][_0x27af('0x4e')]=_0xa692f6['id'];_0xf97695[_0x27af('0x46')][_0x27af('0x4f')]=integrations[_0x27af('0x50')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695[_0x27af('0x46')][_0x27af('0x2d')]);_0xf97695[_0x27af('0x46')][_0x27af('0x52')]=integrations[_0x27af('0x53')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695['body'][_0x27af('0x2d')]);return db[_0x27af('0x4a')]['create'](_0xf97695[_0x27af('0x46')],{'include':[{'model':db[_0x27af('0x54')],'as':_0x27af('0x4f')},{'model':db[_0x27af('0x54')],'as':_0x27af('0x52')}]});}return null;})[_0x27af('0x24')](respondWithResult(_0x2a8534,null))['catch'](handleError(_0x2a8534,null));};exports[_0x27af('0x55')]=function(_0x31a595,_0x3a2958,_0x4ab463){var _0x5d7af4='';return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0x31a595[_0x27af('0x41')]['id']},'attributes':['id',_0x27af('0x56'),_0x27af('0x57'),_0x27af('0x58'),_0x27af('0x59'),'remoteUri']})[_0x27af('0x24')](handleEntityNotFound(_0x3a2958,null))[_0x27af('0x24')](function(_0x4ac2a3){if(_0x4ac2a3){_0x5d7af4=_0x4ac2a3[_0x27af('0x5a')];var _0xc0a98c=_0x5d7af4['slice'](-0x1);if(_0xc0a98c==='/'){_0x5d7af4=_0x5d7af4['substring'](0x0,_0x5d7af4[_0x27af('0x5b')](_0xc0a98c));}var _0x287f7c={'method':_0x27af('0x5c'),'uri':util[_0x27af('0x5d')](_0x27af('0x5e'),_0x5d7af4,_0x27af('0x5f')),'json':!![]};switch(_0x4ac2a3[_0x27af('0x59')]){case'password':_0x287f7c[_0x27af('0x60')]={'Authorization':util[_0x27af('0x5d')](_0x27af('0x61'),new Buffer(util[_0x27af('0x5d')]('%s:%s',_0x4ac2a3['username'],_0x4ac2a3[_0x27af('0x57')]))[_0x27af('0x62')](_0x27af('0x63')))};break;case _0x27af('0x58'):_0x287f7c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x27af('0x5d')](_0x27af('0x64'),_0x4ac2a3[_0x27af('0x56')],_0x4ac2a3[_0x27af('0x58')]))[_0x27af('0x62')](_0x27af('0x63')))};break;default:throw new db['Sequelize']['ValidationError'](_0x27af('0x65'));}return rp(_0x287f7c);}})[_0x27af('0x24')](function(_0x55637f){if(_0x55637f){var _0x2c3d30=['subject','description',_0x27af('0x66'),_0x27af('0x67')];_[_0x27af('0x68')](_0x55637f[_0x27af('0x5f')],function(_0x2b7e18){return _0x2c3d30[_0x27af('0x69')](_0x2b7e18[_0x27af('0x2d')]);});return{'count':_0x55637f[_0x27af('0x5f')][_0x27af('0x4b')],'rows':_[_0x27af('0x2a')](_0x55637f[_0x27af('0x5f')],function(_0x4dd124){return{'id':_0x4dd124['id'],'name':_0x4dd124[_0x27af('0x6a')]>0x7?_0x4dd124[_0x27af('0x6b')]:_0x4dd124[_0x27af('0x2d')],'custom':_0x4dd124['position']>0x7?!![]:![],'options':_0x4dd124[_0x27af('0x6c')]?_0x4dd124[_0x27af('0x6c')]:_0x4dd124[_0x27af('0x6d')]?_0x4dd124['custom_field_options']:[]};})};}})[_0x27af('0x24')](respondWithResult(_0x3a2958,null))['catch'](function(_0x118d06){var _0x9350fa=_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?0x1f4:_0x118d06[_0x27af('0x6f')]||0x1f4;logger[_0x27af('0x25')](_0x27af('0x70'),_0x27af('0x55'),_0x9350fa,JSON['stringify'](_0x118d06));delete _0x118d06[_0x27af('0x27')];if(_0x9350fa===0x191){_0x9350fa=0x190;}_0x3a2958['status'](_0x9350fa)[_0x27af('0x28')](_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x118d06['statusCode']}:_0x118d06);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 59e9986..135502c 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 _0xae75=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment'];(function(_0x5dd7a6,_0x1e23d9){var _0x330c53=function(_0x41213e){while(--_0x41213e){_0x5dd7a6['push'](_0x5dd7a6['shift']());}};_0x330c53(++_0x1e23d9);}(_0xae75,0xce));var _0x5ae7=function(_0x2b40f3,_0x46b0b0){_0x2b40f3=_0x2b40f3-0x0;var _0x51fd7f=_0xae75[_0x2b40f3];return _0x51fd7f;};'use strict';var _=require(_0x5ae7('0x0'));var util=require(_0x5ae7('0x1'));var logger=require('../../config/logger')(_0x5ae7('0x2'));var moment=require(_0x5ae7('0x3'));var BPromise=require(_0x5ae7('0x4'));var rp=require(_0x5ae7('0x5'));var fs=require('fs');var path=require(_0x5ae7('0x6'));var rimraf=require(_0x5ae7('0x7'));var config=require(_0x5ae7('0x8'));var attributes=require(_0x5ae7('0x9'));var integrations=require(_0x5ae7('0xa'));module[_0x5ae7('0xb')]=function(_0x3009ef,_0x3c8813){return _0x3009ef[_0x5ae7('0xc')](_0x5ae7('0xd'),attributes,{'tableName':_0x5ae7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x070b=['define','int_zendesk_accounts','lodash','util','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x4421a0,_0x1525bc){var _0x5626d0=function(_0x56d43e){while(--_0x56d43e){_0x4421a0['push'](_0x4421a0['shift']());}};_0x5626d0(++_0x1525bc);}(_0x070b,0x124));var _0xb070=function(_0x1a5046,_0x563002){_0x1a5046=_0x1a5046-0x0;var _0x5a14c2=_0x070b[_0x1a5046];return _0x5a14c2;};'use strict';var _=require(_0xb070('0x0'));var util=require(_0xb070('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb070('0x2'));var rp=require(_0xb070('0x3'));var fs=require('fs');var path=require(_0xb070('0x4'));var rimraf=require('rimraf');var config=require(_0xb070('0x5'));var attributes=require(_0xb070('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xb070('0x7')]=function(_0x2c7589,_0x4a1d57){return _0x2c7589[_0xb070('0x8')]('ZendeskAccount',attributes,{'tableName':_0xb070('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 27fd30d..3b16640 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 _0xd068=['attributes','limit','include','model','map','then','debug','stringify','find','where','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw'];(function(_0x1bbc70,_0x1b47cc){var _0x45ee80=function(_0x4db689){while(--_0x4db689){_0x1bbc70['push'](_0x1bbc70['shift']());}};_0x45ee80(++_0x1b47cc);}(_0xd068,0xce));var _0x8d06=function(_0x19537c,_0x251fc2){_0x19537c=_0x19537c-0x0;var _0x178d93=_0xd068[_0x19537c];return _0x178d93;};'use strict';var _=require(_0x8d06('0x0'));var util=require(_0x8d06('0x1'));var moment=require(_0x8d06('0x2'));var BPromise=require(_0x8d06('0x3'));var rs=require(_0x8d06('0x4'));var fs=require('fs');var Redis=require(_0x8d06('0x5'));var db=require(_0x8d06('0x6'))['db'];var utils=require(_0x8d06('0x7'));var logger=require(_0x8d06('0x8'))(_0x8d06('0x9'));var config=require(_0x8d06('0xa'));var jayson=require(_0x8d06('0xb'));var client=jayson[_0x8d06('0xc')][_0x8d06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb52bab,_0x41b883,_0x3f1a0b){return new BPromise(function(_0x15f26f,_0x50fc05){return client[_0x8d06('0xe')](_0xb52bab,_0x3f1a0b)['then'](function(_0xc29343){logger[_0x8d06('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x41b883,_0x8d06('0x10'));logger['debug'](_0x8d06('0x11'),_0x41b883,_0x8d06('0x10'),JSON['stringify'](_0xc29343));if(_0xc29343['error']){if(_0xc29343['error'][_0x8d06('0x12')]===0x1f4){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343['error'][_0x8d06('0x15')]);return _0x50fc05(_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);}logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);return _0x15f26f(_0xc29343['error']['message']);}else{logger[_0x8d06('0xf')](_0x8d06('0x14'),_0x41b883,'request\x20sent');_0x15f26f(_0xc29343['result'][_0x8d06('0x15')]);}})[_0x8d06('0x16')](function(_0x5de921){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0x5de921);_0x50fc05(_0x5de921);});});}exports[_0x8d06('0x17')]=function(_0x2f63e1){var _0x5d64d6=this;return new Promise(function(_0x244423,_0x1352c8){return db[_0x8d06('0x18')][_0x8d06('0x19')]({'raw':_0x2f63e1[_0x8d06('0x1a')]?_0x2f63e1[_0x8d06('0x1a')][_0x8d06('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f63e1[_0x8d06('0x1a')]?_0x2f63e1[_0x8d06('0x1a')]['where']||null:null,'attributes':_0x2f63e1['options']?_0x2f63e1['options'][_0x8d06('0x1c')]||null:null,'limit':_0x2f63e1[_0x8d06('0x1a')]?_0x2f63e1['options'][_0x8d06('0x1d')]||null:null,'include':_0x2f63e1[_0x8d06('0x1a')]?_0x2f63e1['options'][_0x8d06('0x1e')]?_['map'](_0x2f63e1[_0x8d06('0x1a')]['include'],function(_0x19a935){return{'model':db[_0x19a935[_0x8d06('0x1f')]],'as':_0x19a935['as'],'attributes':_0x19a935[_0x8d06('0x1c')],'include':_0x19a935['include']?_[_0x8d06('0x20')](_0x19a935['include'],function(_0x5a6de4){return{'model':db[_0x5a6de4[_0x8d06('0x1f')]],'as':_0x5a6de4['as'],'attributes':_0x5a6de4[_0x8d06('0x1c')],'include':_0x5a6de4[_0x8d06('0x1e')]?_['map'](_0x5a6de4['include'],function(_0x2e9513){return{'model':db[_0x2e9513['model']],'as':_0x2e9513['as'],'attributes':_0x2e9513['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d06('0x21')](function(_0x3744a2){logger[_0x8d06('0xf')]('GetZendeskAccount',_0x2f63e1);logger[_0x8d06('0x22')](_0x8d06('0x17'),_0x2f63e1,JSON[_0x8d06('0x23')](_0x3744a2));_0x244423(_0x3744a2);})['catch'](function(_0x3bb6d1){logger[_0x8d06('0x13')](_0x8d06('0x17'),_0x3bb6d1[_0x8d06('0x15')],_0x2f63e1);_0x1352c8(_0x5d64d6[_0x8d06('0x13')](0x1f4,_0x3bb6d1[_0x8d06('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x4c81e5){var _0xb5b28=this;return new Promise(function(_0x17fdb2,_0x3a426b){return db[_0x8d06('0x18')][_0x8d06('0x24')]({'raw':_0x4c81e5['options']?_0x4c81e5[_0x8d06('0x1a')][_0x8d06('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c81e5[_0x8d06('0x1a')]?_0x4c81e5[_0x8d06('0x1a')][_0x8d06('0x25')]||null:null,'attributes':_0x4c81e5['options']?_0x4c81e5[_0x8d06('0x1a')][_0x8d06('0x1c')]||null:null,'include':_0x4c81e5[_0x8d06('0x1a')]?_0x4c81e5[_0x8d06('0x1a')][_0x8d06('0x1e')]?_['map'](_0x4c81e5[_0x8d06('0x1a')][_0x8d06('0x1e')],function(_0x4ca7d5){return{'model':db[_0x4ca7d5[_0x8d06('0x1f')]],'as':_0x4ca7d5['as'],'attributes':_0x4ca7d5['attributes'],'include':_0x4ca7d5[_0x8d06('0x1e')]?_['map'](_0x4ca7d5[_0x8d06('0x1e')],function(_0x4648be){return{'model':db[_0x4648be[_0x8d06('0x1f')]],'as':_0x4648be['as'],'attributes':_0x4648be[_0x8d06('0x1c')],'include':_0x4648be['include']?_[_0x8d06('0x20')](_0x4648be[_0x8d06('0x1e')],function(_0x53cde8){return{'model':db[_0x53cde8[_0x8d06('0x1f')]],'as':_0x53cde8['as'],'attributes':_0x53cde8[_0x8d06('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8d06('0x21')](function(_0x3d839e){logger['info'](_0x8d06('0x26'),_0x4c81e5);logger[_0x8d06('0x22')](_0x8d06('0x26'),_0x4c81e5,JSON[_0x8d06('0x23')](_0x3d839e));_0x17fdb2(_0x3d839e);})[_0x8d06('0x16')](function(_0x30a567){logger[_0x8d06('0x13')](_0x8d06('0x26'),_0x30a567[_0x8d06('0x15')],_0x4c81e5);_0x3a426b(_0xb5b28['error'](0x1f4,_0x30a567[_0x8d06('0x15')]));});});}; \ No newline at end of file +var _0x8aeb=['attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8aeb,0x1ce));var _0xb8ae=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x8aeb[_0x3fcc20];return _0x15d3ce;};'use strict';var _=require(_0xb8ae('0x0'));var util=require(_0xb8ae('0x1'));var moment=require(_0xb8ae('0x2'));var BPromise=require(_0xb8ae('0x3'));var rs=require(_0xb8ae('0x4'));var fs=require('fs');var Redis=require(_0xb8ae('0x5'));var db=require(_0xb8ae('0x6'))['db'];var utils=require(_0xb8ae('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb8ae('0x8'));var jayson=require(_0xb8ae('0x9'));var client=jayson['client'][_0xb8ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f380b,_0x1e3124,_0x883a53){return new BPromise(function(_0x49c3e8,_0x463594){return client['request'](_0x5f380b,_0x883a53)[_0xb8ae('0xb')](function(_0x57fe79){logger[_0xb8ae('0xc')](_0xb8ae('0xd'),_0x1e3124,_0xb8ae('0xe'));logger[_0xb8ae('0xf')](_0xb8ae('0x10'),_0x1e3124,_0xb8ae('0xe'),JSON[_0xb8ae('0x11')](_0x57fe79));if(_0x57fe79[_0xb8ae('0x12')]){if(_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x13')]===0x1f4){logger[_0xb8ae('0x12')](_0xb8ae('0xd'),_0x1e3124,_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x14')]);return _0x463594(_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x14')]);}logger['error'](_0xb8ae('0xd'),_0x1e3124,_0x57fe79['error'][_0xb8ae('0x14')]);return _0x49c3e8(_0x57fe79[_0xb8ae('0x12')]['message']);}else{logger[_0xb8ae('0xc')](_0xb8ae('0xd'),_0x1e3124,_0xb8ae('0xe'));_0x49c3e8(_0x57fe79[_0xb8ae('0x15')][_0xb8ae('0x14')]);}})[_0xb8ae('0x16')](function(_0x27a53c){logger[_0xb8ae('0x12')](_0xb8ae('0xd'),_0x1e3124,_0x27a53c);_0x463594(_0x27a53c);});});}exports[_0xb8ae('0x17')]=function(_0x1a6544){var _0xb2f222=this;return new Promise(function(_0x47b19c,_0x181d92){return db[_0xb8ae('0x18')][_0xb8ae('0x19')]({'raw':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a6544['options']?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1b')]||null:null,'attributes':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1c')]||null:null,'limit':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1d')]||null:null,'include':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1e')]?_['map'](_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1e')],function(_0x1638e4){return{'model':db[_0x1638e4[_0xb8ae('0x1f')]],'as':_0x1638e4['as'],'attributes':_0x1638e4['attributes'],'include':_0x1638e4[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x1638e4[_0xb8ae('0x1e')],function(_0x5a6667){return{'model':db[_0x5a6667[_0xb8ae('0x1f')]],'as':_0x5a6667['as'],'attributes':_0x5a6667[_0xb8ae('0x1c')],'include':_0x5a6667[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x5a6667[_0xb8ae('0x1e')],function(_0xb81a8){return{'model':db[_0xb81a8[_0xb8ae('0x1f')]],'as':_0xb81a8['as'],'attributes':_0xb81a8[_0xb8ae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb8ae('0xb')](function(_0x5dde6c){logger['info'](_0xb8ae('0x17'),_0x1a6544);logger[_0xb8ae('0xf')](_0xb8ae('0x17'),_0x1a6544,JSON['stringify'](_0x5dde6c));_0x47b19c(_0x5dde6c);})[_0xb8ae('0x16')](function(_0x2866e5){logger[_0xb8ae('0x12')]('GetZendeskAccount',_0x2866e5['message'],_0x1a6544);_0x181d92(_0xb2f222[_0xb8ae('0x12')](0x1f4,_0x2866e5[_0xb8ae('0x14')]));});});};exports[_0xb8ae('0x21')]=function(_0x242f02){var _0x1a23e0=this;return new Promise(function(_0x46d595,_0x2a6650){return db[_0xb8ae('0x18')][_0xb8ae('0x22')]({'raw':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')][_0xb8ae('0x1b')]||null:null,'attributes':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')]['attributes']||null:null,'include':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')][_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x242f02[_0xb8ae('0x1a')]['include'],function(_0x104dea){return{'model':db[_0x104dea[_0xb8ae('0x1f')]],'as':_0x104dea['as'],'attributes':_0x104dea[_0xb8ae('0x1c')],'include':_0x104dea[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x104dea[_0xb8ae('0x1e')],function(_0x576ba3){return{'model':db[_0x576ba3[_0xb8ae('0x1f')]],'as':_0x576ba3['as'],'attributes':_0x576ba3[_0xb8ae('0x1c')],'include':_0x576ba3[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x576ba3[_0xb8ae('0x1e')],function(_0x5d0142){return{'model':db[_0x5d0142[_0xb8ae('0x1f')]],'as':_0x5d0142['as'],'attributes':_0x5d0142[_0xb8ae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb8ae('0xb')](function(_0x25c5be){logger[_0xb8ae('0xc')](_0xb8ae('0x21'),_0x242f02);logger['debug'](_0xb8ae('0x21'),_0x242f02,JSON[_0xb8ae('0x11')](_0x25c5be));_0x46d595(_0x25c5be);})[_0xb8ae('0x16')](function(_0x114fe2){logger[_0xb8ae('0x12')]('ShowZendeskAccount',_0x114fe2['message'],_0x242f02);_0x2a6650(_0x1a23e0[_0xb8ae('0x12')](0x1f4,_0x114fe2[_0xb8ae('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8166848..cd2c614 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x485f02,_0x394251){var _0x3ae77a=function(_0x539b3a){while(--_0x539b3a){_0x485f02['push'](_0x485f02['shift']());}};_0x3ae77a(++_0x394251);}(_0xa571,0x107));var _0x1a57=function(_0x37e68c,_0x2acb4e){_0x37e68c=_0x37e68c-0x0;var _0xe91fe6=_0xa571[_0x37e68c];return _0xe91fe6;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x40425a,_0x1c483b){var _0x178913=function(_0x5ea1d8){while(--_0x5ea1d8){_0x40425a['push'](_0x40425a['shift']());}};_0x178913(++_0x1c483b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1bda6c,_0x5440b1){_0x1bda6c=_0x1bda6c-0x0;var _0x501a86=_0x5eb8[_0x1bda6c];return _0x501a86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 64388ef..4fba652 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 _0x5500=['exports','STRING','sequelize'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0x5500,0x14f));var _0x0550=function(_0x2d4d70,_0x50ec98){_0x2d4d70=_0x2d4d70-0x0;var _0x243d91=_0x5500[_0x2d4d70];return _0x243d91;};'use strict';var Sequelize=require(_0x0550('0x0'));module[_0x0550('0x1')]={'name':{'type':Sequelize[_0x0550('0x2')]},'description':{'type':Sequelize[_0x0550('0x2')]}}; \ No newline at end of file +var _0x8956=['exports','sequelize'];(function(_0x4802d3,_0x249890){var _0x22b852=function(_0x45588c){while(--_0x45588c){_0x4802d3['push'](_0x4802d3['shift']());}};_0x22b852(++_0x249890);}(_0x8956,0xed));var _0x6895=function(_0x2ecfc4,_0x14585d){_0x2ecfc4=_0x2ecfc4-0x0;var _0x536372=_0x8956[_0x2ecfc4];return _0x536372;};'use strict';var Sequelize=require(_0x6895('0x0'));module[_0x6895('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2e30e53..d7e2e5b 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 _0x6e74=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','create','body','find','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x174e66,_0x3ef28d){var _0x1d3a43=function(_0x2ad145){while(--_0x2ad145){_0x174e66['push'](_0x174e66['shift']());}};_0x1d3a43(++_0x3ef28d);}(_0x6e74,0x1e6));var _0x46e7=function(_0x1a6f90,_0x1ccc0c){_0x1a6f90=_0x1a6f90-0x0;var _0x554974=_0x6e74[_0x1a6f90];return _0x554974;};'use strict';var emlformat=require(_0x46e7('0x0'));var rimraf=require(_0x46e7('0x1'));var zipdir=require(_0x46e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46e7('0x3'));var moment=require(_0x46e7('0x4'));var BPromise=require(_0x46e7('0x5'));var Mustache=require(_0x46e7('0x6'));var util=require(_0x46e7('0x7'));var path=require(_0x46e7('0x8'));var sox=require(_0x46e7('0x9'));var csv=require(_0x46e7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46e7('0xb'));var _=require('lodash');var squel=require(_0x46e7('0xc'));var crypto=require(_0x46e7('0xd'));var jsforce=require(_0x46e7('0xe'));var deskjs=require(_0x46e7('0xf'));var toCsv=require(_0x46e7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x46e7('0x10'));var qs=require(_0x46e7('0x11'));var as=require(_0x46e7('0x12'));var hardwareService=require(_0x46e7('0x13'));var logger=require('../../config/logger')(_0x46e7('0x14'));var utils=require(_0x46e7('0x15'));var config=require(_0x46e7('0x16'));var licenseUtil=require(_0x46e7('0x17'));var db=require(_0x46e7('0x18'))['db'];function respondWithStatusCode(_0x3a7191,_0x7d412c){_0x7d412c=_0x7d412c||0xcc;return function(_0x4b3529){if(_0x4b3529){return _0x3a7191[_0x46e7('0x19')](_0x7d412c);}return _0x3a7191['status'](_0x7d412c)[_0x46e7('0x1a')]();};}function respondWithResult(_0xf261b9,_0x17a4dd){_0x17a4dd=_0x17a4dd||0xc8;return function(_0x513e9f){if(_0x513e9f){return _0xf261b9['status'](_0x17a4dd)[_0x46e7('0x1b')](_0x513e9f);}};}function respondWithFilteredResult(_0x24bdbc,_0x4e9ad5){return function(_0x58605d){if(_0x58605d){var _0x471d60=typeof _0x4e9ad5[_0x46e7('0x1c')]===_0x46e7('0x1d')&&typeof _0x4e9ad5[_0x46e7('0x1e')]===_0x46e7('0x1d');var _0x56b7ae=_0x58605d[_0x46e7('0x1f')];var _0x1d696e=_0x471d60?0x0:_0x4e9ad5['offset'];var _0x135e23=_0x471d60?_0x58605d['count']:_0x4e9ad5[_0x46e7('0x1c')]+_0x4e9ad5['limit'];var _0x52f990;if(_0x135e23>=_0x56b7ae){_0x135e23=_0x56b7ae;_0x52f990=0xc8;}else{_0x52f990=0xce;}_0x24bdbc[_0x46e7('0x20')](_0x52f990);return _0x24bdbc[_0x46e7('0x21')](_0x46e7('0x22'),_0x1d696e+'-'+_0x135e23+'/'+_0x56b7ae)[_0x46e7('0x1b')](_0x58605d);}return null;};}function patchUpdates(_0x3db9e0){return function(_0x1d2d47){try{jsonpatch[_0x46e7('0x23')](_0x1d2d47,_0x3db9e0,!![]);}catch(_0x557ed8){return BPromise[_0x46e7('0x24')](_0x557ed8);}return _0x1d2d47[_0x46e7('0x25')]();};}function saveUpdates(_0x34054b,_0x16ec2a){return function(_0x1884c6){if(_0x1884c6){return _0x1884c6[_0x46e7('0x26')](_0x34054b)[_0x46e7('0x27')](function(_0x4a7b7b){return _0x4a7b7b;});}return null;};}function removeEntity(_0x10a177,_0x1305cc){return function(_0x2f74bb){if(_0x2f74bb){return _0x2f74bb[_0x46e7('0x28')]()[_0x46e7('0x27')](function(){_0x10a177[_0x46e7('0x20')](0xcc)[_0x46e7('0x1a')]();});}};}function handleEntityNotFound(_0x3152bb,_0x39dbc9){return function(_0x52b75d){if(!_0x52b75d){_0x3152bb[_0x46e7('0x19')](0x194);}return _0x52b75d;};}function handleError(_0x20c9ce,_0x315027){_0x315027=_0x315027||0x1f4;return function(_0x20d56c){logger[_0x46e7('0x29')](_0x20d56c[_0x46e7('0x2a')]);if(_0x20d56c[_0x46e7('0x2b')]){delete _0x20d56c[_0x46e7('0x2b')];}_0x20c9ce[_0x46e7('0x20')](_0x315027)[_0x46e7('0x2c')](_0x20d56c);};}exports[_0x46e7('0x2d')]=function(_0x1a1c51,_0x3eb12a){var _0x317e2a={},_0x21fccb={},_0x2197b3={'count':0x0,'rows':[]};var _0x4df034=_[_0x46e7('0x2e')](db['ZendeskConfiguration'][_0x46e7('0x2f')],function(_0x295c7d){return{'name':_0x295c7d[_0x46e7('0x30')],'type':_0x295c7d[_0x46e7('0x31')][_0x46e7('0x32')]};});_0x21fccb[_0x46e7('0x33')]=_[_0x46e7('0x2e')](_0x4df034,_0x46e7('0x2b'));_0x21fccb[_0x46e7('0x34')]=_[_0x46e7('0x35')](_0x1a1c51['query']);_0x21fccb[_0x46e7('0x36')]=_[_0x46e7('0x37')](_0x21fccb['model'],_0x21fccb[_0x46e7('0x34')]);_0x317e2a['attributes']=_[_0x46e7('0x37')](_0x21fccb['model'],qs[_0x46e7('0x38')](_0x1a1c51[_0x46e7('0x34')]['fields']));_0x317e2a[_0x46e7('0x39')]=_0x317e2a[_0x46e7('0x39')][_0x46e7('0x3a')]?_0x317e2a['attributes']:_0x21fccb[_0x46e7('0x33')];if(!_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x3b')](_0x46e7('0x3c'))){_0x317e2a[_0x46e7('0x1e')]=qs[_0x46e7('0x1e')](_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x1e')]);_0x317e2a[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x1c')]);}_0x317e2a[_0x46e7('0x3d')]=qs[_0x46e7('0x3e')](_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x3e')]);_0x317e2a[_0x46e7('0x3f')]=qs[_0x46e7('0x36')](_[_0x46e7('0x40')](_0x1a1c51['query'],_0x21fccb[_0x46e7('0x36')]),_0x4df034);if(_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x41')]){_0x317e2a[_0x46e7('0x3f')]=_['merge'](_0x317e2a[_0x46e7('0x3f')],{'$or':_[_0x46e7('0x2e')](_0x4df034,function(_0x43361b){if(_0x43361b[_0x46e7('0x31')]!==_0x46e7('0x42')){var _0x5415b0={};_0x5415b0[_0x43361b[_0x46e7('0x2b')]]={'$like':'%'+_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x41')]+'%'};return _0x5415b0;}})});}_0x317e2a=_[_0x46e7('0x43')]({},_0x317e2a,_0x1a1c51[_0x46e7('0x44')]);var _0x5c5506={'where':_0x317e2a['where']};return db['ZendeskConfiguration']['count'](_0x5c5506)[_0x46e7('0x27')](function(_0x103b74){_0x2197b3[_0x46e7('0x1f')]=_0x103b74;if(_0x1a1c51[_0x46e7('0x34')][_0x46e7('0x45')]){_0x317e2a[_0x46e7('0x46')]=[{'all':!![]}];}return db[_0x46e7('0x47')][_0x46e7('0x48')](_0x317e2a);})[_0x46e7('0x27')](function(_0x887bd1){_0x2197b3[_0x46e7('0x49')]=_0x887bd1;return _0x2197b3;})[_0x46e7('0x27')](respondWithFilteredResult(_0x3eb12a,_0x317e2a))[_0x46e7('0x4a')](handleError(_0x3eb12a,null));};exports[_0x46e7('0x4b')]=function(_0x9fabf5,_0x25ad1c){var _0x1de941={'raw':![],'where':{'id':_0x9fabf5[_0x46e7('0x4c')]['id']}},_0x348509={};_0x348509[_0x46e7('0x33')]=_[_0x46e7('0x35')](db['ZendeskConfiguration'][_0x46e7('0x2f')]);_0x348509[_0x46e7('0x34')]=_['keys'](_0x9fabf5['query']);_0x348509[_0x46e7('0x36')]=_['intersection'](_0x348509[_0x46e7('0x33')],_0x348509[_0x46e7('0x34')]);_0x1de941['attributes']=_['intersection'](_0x348509['model'],qs[_0x46e7('0x38')](_0x9fabf5[_0x46e7('0x34')][_0x46e7('0x38')]));_0x1de941[_0x46e7('0x39')]=_0x1de941['attributes']['length']?_0x1de941[_0x46e7('0x39')]:_0x348509[_0x46e7('0x33')];if(_0x9fabf5[_0x46e7('0x34')][_0x46e7('0x45')]){_0x1de941['include']=[{'all':!![]}];}_0x1de941=_[_0x46e7('0x43')]({},_0x1de941,_0x9fabf5['options']);return db[_0x46e7('0x47')]['find'](_0x1de941)[_0x46e7('0x27')](handleEntityNotFound(_0x25ad1c,null))[_0x46e7('0x27')](respondWithResult(_0x25ad1c,null))[_0x46e7('0x4a')](handleError(_0x25ad1c,null));};exports[_0x46e7('0x4d')]=function(_0x2333c2,_0xb46b54){return db[_0x46e7('0x47')][_0x46e7('0x4d')](_0x2333c2[_0x46e7('0x4e')],{})[_0x46e7('0x27')](respondWithResult(_0xb46b54,0xc9))[_0x46e7('0x4a')](handleError(_0xb46b54,null));};exports[_0x46e7('0x26')]=function(_0x25b86e,_0x2fdd94){if(_0x25b86e['body']['id']){delete _0x25b86e['body']['id'];}return db[_0x46e7('0x47')][_0x46e7('0x4f')]({'where':{'id':_0x25b86e[_0x46e7('0x4c')]['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x2fdd94,null))[_0x46e7('0x27')](saveUpdates(_0x25b86e[_0x46e7('0x4e')],null))[_0x46e7('0x27')](respondWithResult(_0x2fdd94,null))['catch'](handleError(_0x2fdd94,null));};exports['destroy']=function(_0x1da129,_0x28db20){return db[_0x46e7('0x47')][_0x46e7('0x4f')]({'where':{'id':_0x1da129[_0x46e7('0x4c')]['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x28db20,null))[_0x46e7('0x27')](removeEntity(_0x28db20,null))[_0x46e7('0x4a')](handleError(_0x28db20,null));};exports[_0x46e7('0x50')]=function(_0x4aafd2,_0x2cd89e,_0x47f422){var _0x5ea7ff={};var _0x400a73={};var _0x5ecc82;var _0x2952a9;return db[_0x46e7('0x47')]['findOne']({'where':{'id':_0x4aafd2['params']['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x2cd89e,null))['then'](function(_0x3656d4){if(_0x3656d4){_0x5ecc82=_0x3656d4;_0x400a73[_0x46e7('0x33')]=_['keys'](db[_0x46e7('0x51')][_0x46e7('0x2f')]);_0x400a73['query']=_[_0x46e7('0x35')](_0x4aafd2['query']);_0x400a73[_0x46e7('0x36')]=_['intersection'](_0x400a73[_0x46e7('0x33')],_0x400a73[_0x46e7('0x34')]);_0x5ea7ff['attributes']=_[_0x46e7('0x37')](_0x400a73[_0x46e7('0x33')],qs[_0x46e7('0x38')](_0x4aafd2[_0x46e7('0x34')][_0x46e7('0x38')]));_0x5ea7ff[_0x46e7('0x39')]=_0x5ea7ff[_0x46e7('0x39')][_0x46e7('0x3a')]?_0x5ea7ff[_0x46e7('0x39')]:_0x400a73[_0x46e7('0x33')];_0x5ea7ff[_0x46e7('0x3d')]=qs['sort'](_0x4aafd2[_0x46e7('0x34')][_0x46e7('0x3e')]);_0x5ea7ff[_0x46e7('0x3f')]=qs[_0x46e7('0x36')](_[_0x46e7('0x40')](_0x4aafd2['query'],_0x400a73[_0x46e7('0x36')]));if(_0x4aafd2['query']['filter']){_0x5ea7ff[_0x46e7('0x3f')]=_['merge'](_0x5ea7ff[_0x46e7('0x3f')],{'$or':_[_0x46e7('0x2e')](_0x5ea7ff[_0x46e7('0x39')],function(_0x99a1a8){var _0xdfefdb={};_0xdfefdb[_0x99a1a8]={'$like':'%'+_0x4aafd2[_0x46e7('0x34')][_0x46e7('0x41')]+'%'};return _0xdfefdb;})});}_0x5ea7ff=_[_0x46e7('0x43')]({},_0x5ea7ff,_0x4aafd2[_0x46e7('0x44')]);return _0x5ecc82['getFields'](_0x5ea7ff);}})[_0x46e7('0x27')](function(_0x3355b9){if(_0x3355b9){_0x2952a9=_0x3355b9['length'];if(!_0x4aafd2['query'][_0x46e7('0x3b')](_0x46e7('0x3c'))){_0x5ea7ff[_0x46e7('0x1e')]=qs[_0x46e7('0x1e')](_0x4aafd2[_0x46e7('0x34')][_0x46e7('0x1e')]);_0x5ea7ff[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x4aafd2['query'][_0x46e7('0x1c')]);}return _0x5ecc82[_0x46e7('0x50')](_0x5ea7ff);}})[_0x46e7('0x27')](function(_0x1ef2e7){if(_0x1ef2e7){return _0x1ef2e7?{'count':_0x2952a9,'rows':_0x1ef2e7}:null;}})[_0x46e7('0x27')](respondWithResult(_0x2cd89e,null))[_0x46e7('0x4a')](handleError(_0x2cd89e,null));};exports['getSubjects']=function(_0x37faa9,_0x5f30b6,_0x2f203f){var _0x4032a8={};var _0x3c3e36={};var _0x22e1d5;var _0x2c3a46;return db[_0x46e7('0x47')]['findOne']({'where':{'id':_0x37faa9[_0x46e7('0x4c')]['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x5f30b6,null))[_0x46e7('0x27')](function(_0x192b97){if(_0x192b97){_0x22e1d5=_0x192b97;_0x3c3e36[_0x46e7('0x33')]=_['keys'](db[_0x46e7('0x51')]['rawAttributes']);_0x3c3e36[_0x46e7('0x34')]=_[_0x46e7('0x35')](_0x37faa9[_0x46e7('0x34')]);_0x3c3e36[_0x46e7('0x36')]=_[_0x46e7('0x37')](_0x3c3e36[_0x46e7('0x33')],_0x3c3e36[_0x46e7('0x34')]);_0x4032a8[_0x46e7('0x39')]=_[_0x46e7('0x37')](_0x3c3e36[_0x46e7('0x33')],qs[_0x46e7('0x38')](_0x37faa9[_0x46e7('0x34')][_0x46e7('0x38')]));_0x4032a8['attributes']=_0x4032a8[_0x46e7('0x39')][_0x46e7('0x3a')]?_0x4032a8[_0x46e7('0x39')]:_0x3c3e36['model'];_0x4032a8[_0x46e7('0x3d')]=qs[_0x46e7('0x3e')](_0x37faa9[_0x46e7('0x34')][_0x46e7('0x3e')]);_0x4032a8[_0x46e7('0x3f')]=qs[_0x46e7('0x36')](_[_0x46e7('0x40')](_0x37faa9[_0x46e7('0x34')],_0x3c3e36[_0x46e7('0x36')]));if(_0x37faa9['query'][_0x46e7('0x41')]){_0x4032a8['where']=_[_0x46e7('0x43')](_0x4032a8[_0x46e7('0x3f')],{'$or':_[_0x46e7('0x2e')](_0x4032a8[_0x46e7('0x39')],function(_0x21c811){var _0x3a93b9={};_0x3a93b9[_0x21c811]={'$like':'%'+_0x37faa9[_0x46e7('0x34')]['filter']+'%'};return _0x3a93b9;})});}_0x4032a8=_[_0x46e7('0x43')]({},_0x4032a8,_0x37faa9[_0x46e7('0x44')]);return _0x22e1d5[_0x46e7('0x52')](_0x4032a8);}})['then'](function(_0x3db921){if(_0x3db921){_0x2c3a46=_0x3db921[_0x46e7('0x3a')];if(!_0x37faa9['query'][_0x46e7('0x3b')]('nolimit')){_0x4032a8['limit']=qs[_0x46e7('0x1e')](_0x37faa9[_0x46e7('0x34')][_0x46e7('0x1e')]);_0x4032a8[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x37faa9['query'][_0x46e7('0x1c')]);}return _0x22e1d5[_0x46e7('0x52')](_0x4032a8);}})['then'](function(_0x2a869a){if(_0x2a869a){return _0x2a869a?{'count':_0x2c3a46,'rows':_0x2a869a}:null;}})[_0x46e7('0x27')](respondWithResult(_0x5f30b6,null))[_0x46e7('0x4a')](handleError(_0x5f30b6,null));};exports['getDescriptions']=function(_0x341aad,_0x394327,_0x467b53){var _0x42f8c1={};var _0x525dbc={};var _0x4edda4;var _0x54fa53;return db['ZendeskConfiguration'][_0x46e7('0x53')]({'where':{'id':_0x341aad[_0x46e7('0x4c')]['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x394327,null))[_0x46e7('0x27')](function(_0x3995f4){if(_0x3995f4){_0x4edda4=_0x3995f4;_0x525dbc[_0x46e7('0x33')]=_[_0x46e7('0x35')](db[_0x46e7('0x51')]['rawAttributes']);_0x525dbc[_0x46e7('0x34')]=_[_0x46e7('0x35')](_0x341aad['query']);_0x525dbc['filters']=_[_0x46e7('0x37')](_0x525dbc['model'],_0x525dbc['query']);_0x42f8c1[_0x46e7('0x39')]=_[_0x46e7('0x37')](_0x525dbc['model'],qs['fields'](_0x341aad[_0x46e7('0x34')][_0x46e7('0x38')]));_0x42f8c1['attributes']=_0x42f8c1[_0x46e7('0x39')]['length']?_0x42f8c1[_0x46e7('0x39')]:_0x525dbc['model'];_0x42f8c1[_0x46e7('0x3d')]=qs['sort'](_0x341aad[_0x46e7('0x34')][_0x46e7('0x3e')]);_0x42f8c1['where']=qs[_0x46e7('0x36')](_['pick'](_0x341aad[_0x46e7('0x34')],_0x525dbc[_0x46e7('0x36')]));if(_0x341aad[_0x46e7('0x34')][_0x46e7('0x41')]){_0x42f8c1[_0x46e7('0x3f')]=_['merge'](_0x42f8c1[_0x46e7('0x3f')],{'$or':_['map'](_0x42f8c1['attributes'],function(_0x21a847){var _0x1fe30e={};_0x1fe30e[_0x21a847]={'$like':'%'+_0x341aad[_0x46e7('0x34')][_0x46e7('0x41')]+'%'};return _0x1fe30e;})});}_0x42f8c1=_[_0x46e7('0x43')]({},_0x42f8c1,_0x341aad['options']);return _0x4edda4[_0x46e7('0x54')](_0x42f8c1);}})[_0x46e7('0x27')](function(_0x118ad5){if(_0x118ad5){_0x54fa53=_0x118ad5[_0x46e7('0x3a')];if(!_0x341aad[_0x46e7('0x34')][_0x46e7('0x3b')](_0x46e7('0x3c'))){_0x42f8c1[_0x46e7('0x1e')]=qs[_0x46e7('0x1e')](_0x341aad[_0x46e7('0x34')][_0x46e7('0x1e')]);_0x42f8c1[_0x46e7('0x1c')]=qs['offset'](_0x341aad['query']['offset']);}return _0x4edda4[_0x46e7('0x54')](_0x42f8c1);}})[_0x46e7('0x27')](function(_0x4ec548){if(_0x4ec548){return _0x4ec548?{'count':_0x54fa53,'rows':_0x4ec548}:null;}})[_0x46e7('0x27')](respondWithResult(_0x394327,null))[_0x46e7('0x4a')](handleError(_0x394327,null));};exports[_0x46e7('0x55')]=function(_0x499e88,_0xa3882b,_0x120065){var _0x1e436f={};var _0x74a7dc={};var _0x1426c2;var _0x3eeee8;return db['ZendeskConfiguration'][_0x46e7('0x53')]({'where':{'id':_0x499e88[_0x46e7('0x4c')]['id']}})['then'](handleEntityNotFound(_0xa3882b,null))[_0x46e7('0x27')](function(_0x1944ea){if(_0x1944ea){_0x1426c2=_0x1944ea;_0x74a7dc['model']=_['keys'](db[_0x46e7('0x56')][_0x46e7('0x2f')]);_0x74a7dc[_0x46e7('0x34')]=_['keys'](_0x499e88[_0x46e7('0x34')]);_0x74a7dc[_0x46e7('0x36')]=_[_0x46e7('0x37')](_0x74a7dc['model'],_0x74a7dc['query']);_0x1e436f['attributes']=_[_0x46e7('0x37')](_0x74a7dc[_0x46e7('0x33')],qs[_0x46e7('0x38')](_0x499e88['query'][_0x46e7('0x38')]));_0x1e436f[_0x46e7('0x39')]=_0x1e436f['attributes'][_0x46e7('0x3a')]?_0x1e436f['attributes']:_0x74a7dc[_0x46e7('0x33')];_0x1e436f['order']=qs[_0x46e7('0x3e')](_0x499e88[_0x46e7('0x34')][_0x46e7('0x3e')]);_0x1e436f['where']=qs[_0x46e7('0x36')](_[_0x46e7('0x40')](_0x499e88[_0x46e7('0x34')],_0x74a7dc['filters']));if(_0x499e88['query']['filter']){_0x1e436f['where']=_[_0x46e7('0x43')](_0x1e436f[_0x46e7('0x3f')],{'$or':_[_0x46e7('0x2e')](_0x1e436f[_0x46e7('0x39')],function(_0x26cbe8){var _0x2e5dda={};_0x2e5dda[_0x26cbe8]={'$like':'%'+_0x499e88[_0x46e7('0x34')][_0x46e7('0x41')]+'%'};return _0x2e5dda;})});}_0x1e436f=_[_0x46e7('0x43')]({},_0x1e436f,_0x499e88['options']);return _0x1426c2[_0x46e7('0x55')](_0x1e436f);}})[_0x46e7('0x27')](function(_0x4770b6){if(_0x4770b6){_0x3eeee8=_0x4770b6[_0x46e7('0x3a')];if(!_0x499e88[_0x46e7('0x34')]['hasOwnProperty'](_0x46e7('0x3c'))){_0x1e436f[_0x46e7('0x1e')]=qs[_0x46e7('0x1e')](_0x499e88['query'][_0x46e7('0x1e')]);_0x1e436f[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x499e88[_0x46e7('0x34')]['offset']);}return _0x1426c2[_0x46e7('0x55')](_0x1e436f);}})[_0x46e7('0x27')](function(_0x515dd8){if(_0x515dd8){return _0x515dd8?{'count':_0x3eeee8,'rows':_0x515dd8}:null;}})[_0x46e7('0x27')](respondWithResult(_0xa3882b,null))[_0x46e7('0x4a')](handleError(_0xa3882b,null));};exports[_0x46e7('0x57')]=function(_0x17f7ff,_0x3817d9,_0x2b765a){if(_0x17f7ff[_0x46e7('0x4e')]['id']){delete _0x17f7ff[_0x46e7('0x4e')]['id'];}return db[_0x46e7('0x47')]['findOne']({'where':{'id':_0x17f7ff[_0x46e7('0x4c')]['id']}})[_0x46e7('0x27')](handleEntityNotFound(_0x3817d9,null))[_0x46e7('0x27')](function(_0x1ceb16){if(_0x1ceb16){return _0x1ceb16['setTags'](_0x17f7ff[_0x46e7('0x4e')]['ids']||[]);}return null;})[_0x46e7('0x27')](respondWithResult(_0x3817d9,null))[_0x46e7('0x4a')](handleError(_0x3817d9,null));}; \ No newline at end of file +var _0xe3c9=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','findOne','ZendeskField','merge','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query'];(function(_0xe37cad,_0x9fcbdd){var _0x24593e=function(_0x4170bb){while(--_0x4170bb){_0xe37cad['push'](_0xe37cad['shift']());}};_0x24593e(++_0x9fcbdd);}(_0xe3c9,0x1dd));var _0x9e3c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe3c9[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0x9e3c('0x0'));var rimraf=require(_0x9e3c('0x1'));var zipdir=require(_0x9e3c('0x2'));var jsonpatch=require(_0x9e3c('0x3'));var rp=require(_0x9e3c('0x4'));var moment=require(_0x9e3c('0x5'));var BPromise=require(_0x9e3c('0x6'));var Mustache=require('mustache');var util=require(_0x9e3c('0x7'));var path=require(_0x9e3c('0x8'));var sox=require(_0x9e3c('0x9'));var csv=require('to-csv');var ejs=require(_0x9e3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x9e3c('0xc'));var deskjs=require(_0x9e3c('0xd'));var toCsv=require(_0x9e3c('0xe'));var querystring=require(_0x9e3c('0xf'));var Papa=require(_0x9e3c('0x10'));var Redis=require(_0x9e3c('0x11'));var authService=require(_0x9e3c('0x12'));var qs=require(_0x9e3c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e3c('0x14'));var logger=require('../../config/logger')(_0x9e3c('0x15'));var utils=require(_0x9e3c('0x16'));var config=require(_0x9e3c('0x17'));var licenseUtil=require(_0x9e3c('0x18'));var db=require(_0x9e3c('0x19'))['db'];function respondWithStatusCode(_0xf73e6,_0x550c22){_0x550c22=_0x550c22||0xcc;return function(_0x2228b9){if(_0x2228b9){return _0xf73e6['sendStatus'](_0x550c22);}return _0xf73e6['status'](_0x550c22)[_0x9e3c('0x1a')]();};}function respondWithResult(_0x38b9dd,_0x427d80){_0x427d80=_0x427d80||0xc8;return function(_0x5d03d2){if(_0x5d03d2){return _0x38b9dd[_0x9e3c('0x1b')](_0x427d80)[_0x9e3c('0x1c')](_0x5d03d2);}};}function respondWithFilteredResult(_0x2631bd,_0x1fac25){return function(_0x496f3b){if(_0x496f3b){var _0x4720b4=typeof _0x1fac25[_0x9e3c('0x1d')]===_0x9e3c('0x1e')&&typeof _0x1fac25[_0x9e3c('0x1f')]===_0x9e3c('0x1e');var _0xe4f966=_0x496f3b[_0x9e3c('0x20')];var _0x288f4c=_0x4720b4?0x0:_0x1fac25['offset'];var _0x3eee29=_0x4720b4?_0x496f3b['count']:_0x1fac25[_0x9e3c('0x1d')]+_0x1fac25['limit'];var _0x44722e;if(_0x3eee29>=_0xe4f966){_0x3eee29=_0xe4f966;_0x44722e=0xc8;}else{_0x44722e=0xce;}_0x2631bd[_0x9e3c('0x1b')](_0x44722e);return _0x2631bd[_0x9e3c('0x21')](_0x9e3c('0x22'),_0x288f4c+'-'+_0x3eee29+'/'+_0xe4f966)[_0x9e3c('0x1c')](_0x496f3b);}return null;};}function patchUpdates(_0x5dabfa){return function(_0x57096b){try{jsonpatch[_0x9e3c('0x23')](_0x57096b,_0x5dabfa,!![]);}catch(_0x14ffbc){return BPromise[_0x9e3c('0x24')](_0x14ffbc);}return _0x57096b['save']();};}function saveUpdates(_0x9c3411,_0x56202a){return function(_0x3becd1){if(_0x3becd1){return _0x3becd1['update'](_0x9c3411)[_0x9e3c('0x25')](function(_0x1f8dc1){return _0x1f8dc1;});}return null;};}function removeEntity(_0x474ef2,_0x51d9e0){return function(_0x106692){if(_0x106692){return _0x106692['destroy']()[_0x9e3c('0x25')](function(){_0x474ef2[_0x9e3c('0x1b')](0xcc)[_0x9e3c('0x1a')]();});}};}function handleEntityNotFound(_0x5e6e56,_0xc9cd40){return function(_0x1f94c3){if(!_0x1f94c3){_0x5e6e56[_0x9e3c('0x26')](0x194);}return _0x1f94c3;};}function handleError(_0x3af2b8,_0x422324){_0x422324=_0x422324||0x1f4;return function(_0x164588){logger[_0x9e3c('0x27')](_0x164588[_0x9e3c('0x28')]);if(_0x164588['name']){delete _0x164588[_0x9e3c('0x29')];}_0x3af2b8[_0x9e3c('0x1b')](_0x422324)['send'](_0x164588);};}exports[_0x9e3c('0x2a')]=function(_0xe4b4c8,_0x2af732){var _0x529777={},_0x2003c7={},_0x2744bb={'count':0x0,'rows':[]};var _0x401609=_[_0x9e3c('0x2b')](db[_0x9e3c('0x2c')][_0x9e3c('0x2d')],function(_0x194668){return{'name':_0x194668[_0x9e3c('0x2e')],'type':_0x194668[_0x9e3c('0x2f')][_0x9e3c('0x30')]};});_0x2003c7[_0x9e3c('0x31')]=_[_0x9e3c('0x2b')](_0x401609,_0x9e3c('0x29'));_0x2003c7[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0xe4b4c8['query']);_0x2003c7[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2003c7[_0x9e3c('0x31')],_0x2003c7[_0x9e3c('0x32')]);_0x529777[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x2003c7['model'],qs[_0x9e3c('0x37')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x529777[_0x9e3c('0x36')]=_0x529777[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x529777[_0x9e3c('0x36')]:_0x2003c7['model'];if(!_0xe4b4c8[_0x9e3c('0x32')]['hasOwnProperty'](_0x9e3c('0x39'))){_0x529777[_0x9e3c('0x1f')]=qs[_0x9e3c('0x1f')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x529777[_0x9e3c('0x1d')]=qs[_0x9e3c('0x1d')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}_0x529777[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0xe4b4c8['query'][_0x9e3c('0x3b')]);_0x529777['where']=qs['filters'](_[_0x9e3c('0x3c')](_0xe4b4c8[_0x9e3c('0x32')],_0x2003c7[_0x9e3c('0x34')]),_0x401609);if(_0xe4b4c8['query'][_0x9e3c('0x3d')]){_0x529777[_0x9e3c('0x3e')]=_['merge'](_0x529777[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0x401609,function(_0x3bfe96){if(_0x3bfe96[_0x9e3c('0x2f')]!==_0x9e3c('0x3f')){var _0x45db4d={};_0x45db4d[_0x3bfe96[_0x9e3c('0x29')]]={'$like':'%'+_0xe4b4c8['query'][_0x9e3c('0x3d')]+'%'};return _0x45db4d;}})});}_0x529777=_['merge']({},_0x529777,_0xe4b4c8[_0x9e3c('0x40')]);var _0x448c62={'where':_0x529777[_0x9e3c('0x3e')]};return db[_0x9e3c('0x2c')][_0x9e3c('0x20')](_0x448c62)[_0x9e3c('0x25')](function(_0x5b56c0){_0x2744bb[_0x9e3c('0x20')]=_0x5b56c0;if(_0xe4b4c8['query'][_0x9e3c('0x41')]){_0x529777[_0x9e3c('0x42')]=[{'all':!![]}];}return db[_0x9e3c('0x2c')][_0x9e3c('0x43')](_0x529777);})[_0x9e3c('0x25')](function(_0x234bf2){_0x2744bb[_0x9e3c('0x44')]=_0x234bf2;return _0x2744bb;})['then'](respondWithFilteredResult(_0x2af732,_0x529777))[_0x9e3c('0x45')](handleError(_0x2af732,null));};exports[_0x9e3c('0x46')]=function(_0x30e426,_0x27e435){var _0x4713d4={'raw':![],'where':{'id':_0x30e426[_0x9e3c('0x47')]['id']}},_0x53d2f8={};_0x53d2f8[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x2c')]['rawAttributes']);_0x53d2f8[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x30e426['query']);_0x53d2f8['filters']=_[_0x9e3c('0x35')](_0x53d2f8['model'],_0x53d2f8['query']);_0x4713d4[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x53d2f8[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x30e426[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x4713d4[_0x9e3c('0x36')]=_0x4713d4[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x4713d4[_0x9e3c('0x36')]:_0x53d2f8[_0x9e3c('0x31')];if(_0x30e426['query'][_0x9e3c('0x41')]){_0x4713d4[_0x9e3c('0x42')]=[{'all':!![]}];}_0x4713d4=_['merge']({},_0x4713d4,_0x30e426['options']);return db['ZendeskConfiguration']['find'](_0x4713d4)[_0x9e3c('0x25')](handleEntityNotFound(_0x27e435,null))['then'](respondWithResult(_0x27e435,null))[_0x9e3c('0x45')](handleError(_0x27e435,null));};exports['create']=function(_0x4294b4,_0x39c8f6){return db[_0x9e3c('0x2c')][_0x9e3c('0x48')](_0x4294b4[_0x9e3c('0x49')],{})[_0x9e3c('0x25')](respondWithResult(_0x39c8f6,0xc9))['catch'](handleError(_0x39c8f6,null));};exports[_0x9e3c('0x4a')]=function(_0x31e2ec,_0x4c07b2){if(_0x31e2ec[_0x9e3c('0x49')]['id']){delete _0x31e2ec[_0x9e3c('0x49')]['id'];}return db[_0x9e3c('0x2c')]['find']({'where':{'id':_0x31e2ec[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x4c07b2,null))[_0x9e3c('0x25')](saveUpdates(_0x31e2ec[_0x9e3c('0x49')],null))[_0x9e3c('0x25')](respondWithResult(_0x4c07b2,null))['catch'](handleError(_0x4c07b2,null));};exports[_0x9e3c('0x4b')]=function(_0x4db292,_0x386610){return db[_0x9e3c('0x2c')][_0x9e3c('0x4c')]({'where':{'id':_0x4db292['params']['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x386610,null))[_0x9e3c('0x25')](removeEntity(_0x386610,null))[_0x9e3c('0x45')](handleError(_0x386610,null));};exports['getFields']=function(_0x40566a,_0x37cad6,_0x201e07){var _0x20e963={};var _0x2935db={};var _0x4ff1c1;var _0x5f594e;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x40566a['params']['id']}})['then'](handleEntityNotFound(_0x37cad6,null))[_0x9e3c('0x25')](function(_0x3601c1){if(_0x3601c1){_0x4ff1c1=_0x3601c1;_0x2935db[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x4e')][_0x9e3c('0x2d')]);_0x2935db[_0x9e3c('0x32')]=_['keys'](_0x40566a[_0x9e3c('0x32')]);_0x2935db[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2935db[_0x9e3c('0x31')],_0x2935db['query']);_0x20e963[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x2935db[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x20e963[_0x9e3c('0x36')]=_0x20e963['attributes'][_0x9e3c('0x38')]?_0x20e963[_0x9e3c('0x36')]:_0x2935db[_0x9e3c('0x31')];_0x20e963[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x40566a['query']['sort']);_0x20e963[_0x9e3c('0x3e')]=qs['filters'](_[_0x9e3c('0x3c')](_0x40566a[_0x9e3c('0x32')],_0x2935db[_0x9e3c('0x34')]));if(_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x3d')]){_0x20e963[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x20e963['where'],{'$or':_['map'](_0x20e963[_0x9e3c('0x36')],function(_0xefeff2){var _0x55fd2e={};_0x55fd2e[_0xefeff2]={'$like':'%'+_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x55fd2e;})});}_0x20e963=_[_0x9e3c('0x4f')]({},_0x20e963,_0x40566a[_0x9e3c('0x40')]);return _0x4ff1c1[_0x9e3c('0x50')](_0x20e963);}})[_0x9e3c('0x25')](function(_0x186d89){if(_0x186d89){_0x5f594e=_0x186d89[_0x9e3c('0x38')];if(!_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x51')](_0x9e3c('0x39'))){_0x20e963['limit']=qs[_0x9e3c('0x1f')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x20e963['offset']=qs[_0x9e3c('0x1d')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x4ff1c1[_0x9e3c('0x50')](_0x20e963);}})[_0x9e3c('0x25')](function(_0x4e6b1b){if(_0x4e6b1b){return _0x4e6b1b?{'count':_0x5f594e,'rows':_0x4e6b1b}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x37cad6,null))[_0x9e3c('0x45')](handleError(_0x37cad6,null));};exports[_0x9e3c('0x52')]=function(_0x3ce7e2,_0x2f0231,_0x1951d5){var _0xa3ef60={};var _0x126119={};var _0x4af277;var _0x397cb4;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x3ce7e2[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x2f0231,null))['then'](function(_0xa98204){if(_0xa98204){_0x4af277=_0xa98204;_0x126119['model']=_['keys'](db['ZendeskField'][_0x9e3c('0x2d')]);_0x126119[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x3ce7e2['query']);_0x126119[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x126119[_0x9e3c('0x31')],_0x126119['query']);_0xa3ef60[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x126119[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0xa3ef60[_0x9e3c('0x36')]=_0xa3ef60['attributes']['length']?_0xa3ef60[_0x9e3c('0x36')]:_0x126119[_0x9e3c('0x31')];_0xa3ef60[_0x9e3c('0x3a')]=qs['sort'](_0x3ce7e2['query'][_0x9e3c('0x3b')]);_0xa3ef60[_0x9e3c('0x3e')]=qs[_0x9e3c('0x34')](_[_0x9e3c('0x3c')](_0x3ce7e2['query'],_0x126119[_0x9e3c('0x34')]));if(_0x3ce7e2['query'][_0x9e3c('0x3d')]){_0xa3ef60[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0xa3ef60[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0xa3ef60[_0x9e3c('0x36')],function(_0x58cca7){var _0x464dd5={};_0x464dd5[_0x58cca7]={'$like':'%'+_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x464dd5;})});}_0xa3ef60=_[_0x9e3c('0x4f')]({},_0xa3ef60,_0x3ce7e2[_0x9e3c('0x40')]);return _0x4af277[_0x9e3c('0x52')](_0xa3ef60);}})['then'](function(_0x579463){if(_0x579463){_0x397cb4=_0x579463['length'];if(!_0x3ce7e2['query']['hasOwnProperty'](_0x9e3c('0x39'))){_0xa3ef60['limit']=qs[_0x9e3c('0x1f')](_0x3ce7e2['query']['limit']);_0xa3ef60['offset']=qs['offset'](_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x4af277['getSubjects'](_0xa3ef60);}})['then'](function(_0xb1d4cf){if(_0xb1d4cf){return _0xb1d4cf?{'count':_0x397cb4,'rows':_0xb1d4cf}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x2f0231,null))[_0x9e3c('0x45')](handleError(_0x2f0231,null));};exports['getDescriptions']=function(_0x124d16,_0x38e6b2,_0x1af391){var _0x50b8e0={};var _0x2e9374={};var _0x36da1e;var _0x3e1ad2;return db[_0x9e3c('0x2c')]['findOne']({'where':{'id':_0x124d16[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x38e6b2,null))['then'](function(_0x1eec65){if(_0x1eec65){_0x36da1e=_0x1eec65;_0x2e9374[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x4e')][_0x9e3c('0x2d')]);_0x2e9374['query']=_[_0x9e3c('0x33')](_0x124d16['query']);_0x2e9374[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2e9374[_0x9e3c('0x31')],_0x2e9374[_0x9e3c('0x32')]);_0x50b8e0['attributes']=_[_0x9e3c('0x35')](_0x2e9374['model'],qs['fields'](_0x124d16[_0x9e3c('0x32')]['fields']));_0x50b8e0[_0x9e3c('0x36')]=_0x50b8e0[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x50b8e0[_0x9e3c('0x36')]:_0x2e9374[_0x9e3c('0x31')];_0x50b8e0[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x3b')]);_0x50b8e0[_0x9e3c('0x3e')]=qs[_0x9e3c('0x34')](_[_0x9e3c('0x3c')](_0x124d16[_0x9e3c('0x32')],_0x2e9374['filters']));if(_0x124d16[_0x9e3c('0x32')]['filter']){_0x50b8e0[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x50b8e0[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0x50b8e0[_0x9e3c('0x36')],function(_0x17b255){var _0x4932be={};_0x4932be[_0x17b255]={'$like':'%'+_0x124d16['query']['filter']+'%'};return _0x4932be;})});}_0x50b8e0=_[_0x9e3c('0x4f')]({},_0x50b8e0,_0x124d16[_0x9e3c('0x40')]);return _0x36da1e[_0x9e3c('0x53')](_0x50b8e0);}})['then'](function(_0x1f7398){if(_0x1f7398){_0x3e1ad2=_0x1f7398[_0x9e3c('0x38')];if(!_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x51')]('nolimit')){_0x50b8e0['limit']=qs[_0x9e3c('0x1f')](_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x50b8e0['offset']=qs['offset'](_0x124d16[_0x9e3c('0x32')]['offset']);}return _0x36da1e['getDescriptions'](_0x50b8e0);}})[_0x9e3c('0x25')](function(_0x3eba18){if(_0x3eba18){return _0x3eba18?{'count':_0x3e1ad2,'rows':_0x3eba18}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x38e6b2,null))[_0x9e3c('0x45')](handleError(_0x38e6b2,null));};exports[_0x9e3c('0x54')]=function(_0x463359,_0x483fe6,_0x58d64e){var _0x2ab1fc={};var _0x123e89={};var _0x2ff7e5;var _0x4084a0;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x463359[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x483fe6,null))[_0x9e3c('0x25')](function(_0x534623){if(_0x534623){_0x2ff7e5=_0x534623;_0x123e89[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x55')][_0x9e3c('0x2d')]);_0x123e89[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x463359[_0x9e3c('0x32')]);_0x123e89[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x123e89[_0x9e3c('0x31')],_0x123e89[_0x9e3c('0x32')]);_0x2ab1fc['attributes']=_[_0x9e3c('0x35')](_0x123e89[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x2ab1fc['attributes']=_0x2ab1fc['attributes']['length']?_0x2ab1fc[_0x9e3c('0x36')]:_0x123e89[_0x9e3c('0x31')];_0x2ab1fc[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3b')]);_0x2ab1fc[_0x9e3c('0x3e')]=qs['filters'](_[_0x9e3c('0x3c')](_0x463359[_0x9e3c('0x32')],_0x123e89[_0x9e3c('0x34')]));if(_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3d')]){_0x2ab1fc[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x2ab1fc['where'],{'$or':_[_0x9e3c('0x2b')](_0x2ab1fc[_0x9e3c('0x36')],function(_0x17031a){var _0x7859a1={};_0x7859a1[_0x17031a]={'$like':'%'+_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x7859a1;})});}_0x2ab1fc=_['merge']({},_0x2ab1fc,_0x463359[_0x9e3c('0x40')]);return _0x2ff7e5['getTags'](_0x2ab1fc);}})[_0x9e3c('0x25')](function(_0xb5cb92){if(_0xb5cb92){_0x4084a0=_0xb5cb92[_0x9e3c('0x38')];if(!_0x463359[_0x9e3c('0x32')][_0x9e3c('0x51')](_0x9e3c('0x39'))){_0x2ab1fc[_0x9e3c('0x1f')]=qs[_0x9e3c('0x1f')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x2ab1fc[_0x9e3c('0x1d')]=qs[_0x9e3c('0x1d')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x2ff7e5[_0x9e3c('0x54')](_0x2ab1fc);}})['then'](function(_0x1c14b0){if(_0x1c14b0){return _0x1c14b0?{'count':_0x4084a0,'rows':_0x1c14b0}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x483fe6,null))[_0x9e3c('0x45')](handleError(_0x483fe6,null));};exports[_0x9e3c('0x56')]=function(_0x1db1e7,_0x4d4736,_0x577af7){if(_0x1db1e7[_0x9e3c('0x49')]['id']){delete _0x1db1e7['body']['id'];}return db['ZendeskConfiguration'][_0x9e3c('0x4d')]({'where':{'id':_0x1db1e7[_0x9e3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d4736,null))[_0x9e3c('0x25')](function(_0x43d25d){if(_0x43d25d){return _0x43d25d[_0x9e3c('0x56')](_0x1db1e7[_0x9e3c('0x49')][_0x9e3c('0x57')]||[]);}return null;})[_0x9e3c('0x25')](respondWithResult(_0x4d4736,null))[_0x9e3c('0x45')](handleError(_0x4d4736,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2af9c01..08b3939 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 _0xb44a=['../../config/logger','moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x50020b,_0x10202d){var _0x1fece3=function(_0x3a4016){while(--_0x3a4016){_0x50020b['push'](_0x50020b['shift']());}};_0x1fece3(++_0x10202d);}(_0xb44a,0x1c2));var _0xab44=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xb44a[_0x37756b];return _0x46efec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x21cb67,_0x2efea6){var _0x5e7493=function(_0x516c6b){while(--_0x516c6b){_0x21cb67['push'](_0x21cb67['shift']());}};_0x5e7493(++_0x2efea6);}(_0x9348,0x10d));var _0x8934=function(_0x4db861,_0x128af7){_0x4db861=_0x4db861-0x0;var _0x42ffcb=_0x9348[_0x4db861];return _0x42ffcb;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index c922103..7818b84 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 _0x2ba0=['request','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ba0,0x18b));var _0x02ba=function(_0xef6ca9,_0x1f7287){_0xef6ca9=_0xef6ca9-0x0;var _0x2261ad=_0x2ba0[_0xef6ca9];return _0x2261ad;};'use strict';var _=require('lodash');var util=require(_0x02ba('0x0'));var moment=require(_0x02ba('0x1'));var BPromise=require(_0x02ba('0x2'));var rs=require(_0x02ba('0x3'));var fs=require('fs');var Redis=require(_0x02ba('0x4'));var db=require(_0x02ba('0x5'))['db'];var utils=require(_0x02ba('0x6'));var logger=require(_0x02ba('0x7'))(_0x02ba('0x8'));var config=require(_0x02ba('0x9'));var jayson=require(_0x02ba('0xa'));var client=jayson[_0x02ba('0xb')][_0x02ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b3647,_0x33018b,_0x3810aa){return new BPromise(function(_0x2341e9,_0x2a4af6){return client[_0x02ba('0xd')](_0x2b3647,_0x3810aa)['then'](function(_0x2a54b8){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x33018b,_0x02ba('0xe'));logger['debug'](_0x02ba('0xf'),_0x33018b,_0x02ba('0xe'),JSON[_0x02ba('0x10')](_0x2a54b8));if(_0x2a54b8[_0x02ba('0x11')]){if(_0x2a54b8['error'][_0x02ba('0x12')]===0x1f4){logger[_0x02ba('0x11')](_0x02ba('0x13'),_0x33018b,_0x2a54b8[_0x02ba('0x11')][_0x02ba('0x14')]);return _0x2a4af6(_0x2a54b8['error'][_0x02ba('0x14')]);}logger[_0x02ba('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x33018b,_0x2a54b8[_0x02ba('0x11')]['message']);return _0x2341e9(_0x2a54b8[_0x02ba('0x11')]['message']);}else{logger[_0x02ba('0x15')](_0x02ba('0x13'),_0x33018b,_0x02ba('0xe'));_0x2341e9(_0x2a54b8[_0x02ba('0x16')][_0x02ba('0x14')]);}})[_0x02ba('0x17')](function(_0x18c4e2){logger[_0x02ba('0x11')](_0x02ba('0x13'),_0x33018b,_0x18c4e2);_0x2a4af6(_0x18c4e2);});});} \ No newline at end of file +var _0xccad=['message','result','catch','ZendeskConfiguration,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x48f7cc,_0x462000){var _0x162c86=function(_0x3c1d85){while(--_0x3c1d85){_0x48f7cc['push'](_0x48f7cc['shift']());}};_0x162c86(++_0x462000);}(_0xccad,0x1e4));var _0xdcca=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xccad[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xdcca('0x0'));var util=require('util');var moment=require(_0xdcca('0x1'));var BPromise=require(_0xdcca('0x2'));var rs=require(_0xdcca('0x3'));var fs=require('fs');var Redis=require(_0xdcca('0x4'));var db=require(_0xdcca('0x5'))['db'];var utils=require(_0xdcca('0x6'));var logger=require(_0xdcca('0x7'))(_0xdcca('0x8'));var config=require(_0xdcca('0x9'));var jayson=require(_0xdcca('0xa'));var client=jayson[_0xdcca('0xb')][_0xdcca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x521548,_0x174788,_0x142ba0){return new BPromise(function(_0x2a358d,_0x15c3d9){return client['request'](_0x521548,_0x142ba0)[_0xdcca('0xd')](function(_0x5e804e){logger[_0xdcca('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0xdcca('0xf'));logger[_0xdcca('0x10')](_0xdcca('0x11'),_0x174788,'request\x20sent',JSON[_0xdcca('0x12')](_0x5e804e));if(_0x5e804e[_0xdcca('0x13')]){if(_0x5e804e[_0xdcca('0x13')]['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);return _0x15c3d9(_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);}logger[_0xdcca('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);return _0x2a358d(_0x5e804e['error']['message']);}else{logger[_0xdcca('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0xdcca('0xf'));_0x2a358d(_0x5e804e[_0xdcca('0x15')][_0xdcca('0x14')]);}})[_0xdcca('0x16')](function(_0x3dc667){logger[_0xdcca('0x13')](_0xdcca('0x17'),_0x174788,_0x3dc667);_0x15c3d9(_0x3dc667);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e2ff93f..81a7cf7 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 _0x9db4=['show','post','create','put','delete','/:id','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','isAuthenticated'];(function(_0x2e8052,_0x42f72c){var _0x22c6bf=function(_0x556b0b){while(--_0x556b0b){_0x2e8052['push'](_0x2e8052['shift']());}};_0x22c6bf(++_0x42f72c);}(_0x9db4,0x1a5));var _0x49db=function(_0x4f9ae3,_0x10435c){_0x4f9ae3=_0x4f9ae3-0x0;var _0x4ddd33=_0x9db4[_0x4f9ae3];return _0x4ddd33;};'use strict';var multer=require(_0x49db('0x0'));var util=require(_0x49db('0x1'));var path=require('path');var timeout=require(_0x49db('0x2'));var express=require('express');var router=express[_0x49db('0x3')]();var fs_extra=require(_0x49db('0x4'));var auth=require(_0x49db('0x5'));var interaction=require(_0x49db('0x6'));var config=require(_0x49db('0x7'));var controller=require(_0x49db('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x49db('0x9')]);router['get']('/:id',auth[_0x49db('0xa')](),controller[_0x49db('0xb')]);router[_0x49db('0xc')]('/',auth[_0x49db('0xa')](),controller[_0x49db('0xd')]);router[_0x49db('0xe')]('/:id',auth[_0x49db('0xa')](),controller['update']);router[_0x49db('0xf')](_0x49db('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x49db('0x11')]=router; \ No newline at end of file +var _0xe3de=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x269b00,_0xc5ac96){var _0x52b4d0=function(_0x5a5b7e){while(--_0x5a5b7e){_0x269b00['push'](_0x269b00['shift']());}};_0x52b4d0(++_0xc5ac96);}(_0xe3de,0xc8));var _0xee3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe3de[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xee3d('0x0'));var path=require('path');var timeout=require(_0xee3d('0x1'));var express=require(_0xee3d('0x2'));var router=express[_0xee3d('0x3')]();var fs_extra=require(_0xee3d('0x4'));var auth=require(_0xee3d('0x5'));var interaction=require(_0xee3d('0x6'));var config=require(_0xee3d('0x7'));var controller=require('./intZendeskField.controller');router[_0xee3d('0x8')]('/',auth[_0xee3d('0x9')](),controller[_0xee3d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xee3d('0xb')]('/',auth[_0xee3d('0x9')](),controller[_0xee3d('0xc')]);router[_0xee3d('0xd')](_0xee3d('0xe'),auth[_0xee3d('0x9')](),controller[_0xee3d('0xf')]);router['delete'](_0xee3d('0xe'),auth[_0xee3d('0x9')](),controller[_0xee3d('0x10')]);module[_0xee3d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0b0fcf2..a963796 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 _0xcbfc=['customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x39332c,_0x52cfc9){var _0x5c2397=function(_0x1b3c83){while(--_0x1b3c83){_0x39332c['push'](_0x39332c['shift']());}};_0x5c2397(++_0x52cfc9);}(_0xcbfc,0x104));var _0xccbf=function(_0x3e0fac,_0x8998d3){_0x3e0fac=_0x3e0fac-0x0;var _0x3e7f0d=_0xcbfc[_0x3e0fac];return _0x3e7f0d;};'use strict';var Sequelize=require(_0xccbf('0x0'));module['exports']={'type':{'type':Sequelize[_0xccbf('0x1')](_0xccbf('0x2'),_0xccbf('0x3'),_0xccbf('0x4'),'keyValue',_0xccbf('0x5')),'defaultValue':_0xccbf('0x2')},'content':{'type':Sequelize[_0xccbf('0x6')]},'key':{'type':Sequelize[_0xccbf('0x6')]},'keyType':{'type':Sequelize[_0xccbf('0x1')](_0xccbf('0x2'),_0xccbf('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xccbf('0x6')]},'customField':{'type':Sequelize[_0xccbf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccbf('0x6')]}}; \ No newline at end of file +var _0x823b=['STRING','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x48b454,_0xafeae){var _0x521cb4=function(_0x497e62){while(--_0x497e62){_0x48b454['push'](_0x48b454['shift']());}};_0x521cb4(++_0xafeae);}(_0x823b,0xfd));var _0xb823=function(_0x50a6ee,_0x31a00c){_0x50a6ee=_0x50a6ee-0x0;var _0x5e4627=_0x823b[_0x50a6ee];return _0x5e4627;};'use strict';var Sequelize=require('sequelize');module[_0xb823('0x0')]={'type':{'type':Sequelize[_0xb823('0x1')](_0xb823('0x2'),_0xb823('0x3'),_0xb823('0x4'),'keyValue',_0xb823('0x5')),'defaultValue':_0xb823('0x2')},'content':{'type':Sequelize[_0xb823('0x6')]},'key':{'type':Sequelize[_0xb823('0x6')]},'keyType':{'type':Sequelize[_0xb823('0x1')](_0xb823('0x2'),_0xb823('0x3'),_0xb823('0x4'))},'keyContent':{'type':Sequelize[_0xb823('0x6')]},'idField':{'type':Sequelize[_0xb823('0x6')]},'nameField':{'type':Sequelize[_0xb823('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb823('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8ac23c0..2ffad4e 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 _0xd8c4=['crypto','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','reject','save','update','then','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','findAll','rows','catch','show','params','keys','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x534f7c,_0x3eb489){var _0x5c3e22=function(_0x5dd4a4){while(--_0x5dd4a4){_0x534f7c['push'](_0x534f7c['shift']());}};_0x5c3e22(++_0x3eb489);}(_0xd8c4,0x16a));var _0x4d8c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd8c4[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x4d8c('0x0'));var rimraf=require(_0x4d8c('0x1'));var zipdir=require(_0x4d8c('0x2'));var jsonpatch=require(_0x4d8c('0x3'));var rp=require(_0x4d8c('0x4'));var moment=require(_0x4d8c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4d8c('0x6'));var util=require(_0x4d8c('0x7'));var path=require(_0x4d8c('0x8'));var sox=require('sox');var csv=require(_0x4d8c('0x9'));var ejs=require(_0x4d8c('0xa'));var fs=require('fs');var fs_extra=require(_0x4d8c('0xb'));var _=require('lodash');var squel=require(_0x4d8c('0xc'));var crypto=require(_0x4d8c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d8c('0x9'));var querystring=require(_0x4d8c('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d8c('0xf'));var authService=require(_0x4d8c('0x10'));var qs=require(_0x4d8c('0x11'));var as=require(_0x4d8c('0x12'));var hardwareService=require(_0x4d8c('0x13'));var logger=require('../../config/logger')(_0x4d8c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d8c('0x15'));var db=require(_0x4d8c('0x16'))['db'];function respondWithStatusCode(_0x23a820,_0x217e01){_0x217e01=_0x217e01||0xcc;return function(_0x3aeda1){if(_0x3aeda1){return _0x23a820[_0x4d8c('0x17')](_0x217e01);}return _0x23a820[_0x4d8c('0x18')](_0x217e01)[_0x4d8c('0x19')]();};}function respondWithResult(_0x3e3f4e,_0x4b5d67){_0x4b5d67=_0x4b5d67||0xc8;return function(_0x1aec6a){if(_0x1aec6a){return _0x3e3f4e[_0x4d8c('0x18')](_0x4b5d67)[_0x4d8c('0x1a')](_0x1aec6a);}};}function respondWithFilteredResult(_0x2a9948,_0x4635a0){return function(_0xf0fa94){if(_0xf0fa94){var _0x556b02=typeof _0x4635a0[_0x4d8c('0x1b')]===_0x4d8c('0x1c')&&typeof _0x4635a0[_0x4d8c('0x1d')]===_0x4d8c('0x1c');var _0x439fbd=_0xf0fa94[_0x4d8c('0x1e')];var _0x5453a5=_0x556b02?0x0:_0x4635a0[_0x4d8c('0x1b')];var _0x19f8ed=_0x556b02?_0xf0fa94[_0x4d8c('0x1e')]:_0x4635a0[_0x4d8c('0x1b')]+_0x4635a0[_0x4d8c('0x1d')];var _0x261f90;if(_0x19f8ed>=_0x439fbd){_0x19f8ed=_0x439fbd;_0x261f90=0xc8;}else{_0x261f90=0xce;}_0x2a9948[_0x4d8c('0x18')](_0x261f90);return _0x2a9948[_0x4d8c('0x1f')]('Content-Range',_0x5453a5+'-'+_0x19f8ed+'/'+_0x439fbd)[_0x4d8c('0x1a')](_0xf0fa94);}return null;};}function patchUpdates(_0x181b04){return function(_0x525e67){try{jsonpatch[_0x4d8c('0x20')](_0x525e67,_0x181b04,!![]);}catch(_0x5ae9d2){return BPromise[_0x4d8c('0x21')](_0x5ae9d2);}return _0x525e67[_0x4d8c('0x22')]();};}function saveUpdates(_0x49fb00,_0xbe4b1a){return function(_0x3dac11){if(_0x3dac11){return _0x3dac11[_0x4d8c('0x23')](_0x49fb00)[_0x4d8c('0x24')](function(_0x13f5f5){return _0x13f5f5;});}return null;};}function removeEntity(_0x51b265,_0x1e15f9){return function(_0x5518de){if(_0x5518de){return _0x5518de['destroy']()[_0x4d8c('0x24')](function(){_0x51b265['status'](0xcc)[_0x4d8c('0x19')]();});}};}function handleEntityNotFound(_0x37910f,_0x4fffa1){return function(_0x153809){if(!_0x153809){_0x37910f[_0x4d8c('0x17')](0x194);}return _0x153809;};}function handleError(_0x22fbde,_0x1b66b9){_0x1b66b9=_0x1b66b9||0x1f4;return function(_0x160e3e){logger[_0x4d8c('0x25')](_0x160e3e[_0x4d8c('0x26')]);if(_0x160e3e[_0x4d8c('0x27')]){delete _0x160e3e[_0x4d8c('0x27')];}_0x22fbde[_0x4d8c('0x18')](_0x1b66b9)['send'](_0x160e3e);};}exports[_0x4d8c('0x28')]=function(_0x39a5e6,_0x371876){var _0x25d5c8={},_0x1f745e={},_0x2bc105={'count':0x0,'rows':[]};var _0x4ff63d=_[_0x4d8c('0x29')](db[_0x4d8c('0x2a')][_0x4d8c('0x2b')],function(_0x2ea2ca){return{'name':_0x2ea2ca[_0x4d8c('0x2c')],'type':_0x2ea2ca['type'][_0x4d8c('0x2d')]};});_0x1f745e['model']=_[_0x4d8c('0x29')](_0x4ff63d,_0x4d8c('0x27'));_0x1f745e[_0x4d8c('0x2e')]=_['keys'](_0x39a5e6['query']);_0x1f745e[_0x4d8c('0x2f')]=_[_0x4d8c('0x30')](_0x1f745e[_0x4d8c('0x31')],_0x1f745e['query']);_0x25d5c8[_0x4d8c('0x32')]=_[_0x4d8c('0x30')](_0x1f745e['model'],qs[_0x4d8c('0x33')](_0x39a5e6['query']['fields']));_0x25d5c8[_0x4d8c('0x32')]=_0x25d5c8[_0x4d8c('0x32')][_0x4d8c('0x34')]?_0x25d5c8[_0x4d8c('0x32')]:_0x1f745e['model'];if(!_0x39a5e6[_0x4d8c('0x2e')][_0x4d8c('0x35')](_0x4d8c('0x36'))){_0x25d5c8[_0x4d8c('0x1d')]=qs[_0x4d8c('0x1d')](_0x39a5e6[_0x4d8c('0x2e')][_0x4d8c('0x1d')]);_0x25d5c8[_0x4d8c('0x1b')]=qs[_0x4d8c('0x1b')](_0x39a5e6[_0x4d8c('0x2e')][_0x4d8c('0x1b')]);}_0x25d5c8[_0x4d8c('0x37')]=qs['sort'](_0x39a5e6[_0x4d8c('0x2e')][_0x4d8c('0x38')]);_0x25d5c8[_0x4d8c('0x39')]=qs['filters'](_[_0x4d8c('0x3a')](_0x39a5e6[_0x4d8c('0x2e')],_0x1f745e['filters']),_0x4ff63d);if(_0x39a5e6[_0x4d8c('0x2e')]['filter']){_0x25d5c8[_0x4d8c('0x39')]=_[_0x4d8c('0x3b')](_0x25d5c8[_0x4d8c('0x39')],{'$or':_[_0x4d8c('0x29')](_0x4ff63d,function(_0x165df5){if(_0x165df5[_0x4d8c('0x3c')]!==_0x4d8c('0x3d')){var _0x194bab={};_0x194bab[_0x165df5[_0x4d8c('0x27')]]={'$like':'%'+_0x39a5e6[_0x4d8c('0x2e')][_0x4d8c('0x3e')]+'%'};return _0x194bab;}})});}_0x25d5c8=_[_0x4d8c('0x3b')]({},_0x25d5c8,_0x39a5e6['options']);var _0x7f986b={'where':_0x25d5c8[_0x4d8c('0x39')]};return db[_0x4d8c('0x2a')][_0x4d8c('0x1e')](_0x7f986b)[_0x4d8c('0x24')](function(_0x58b0e5){_0x2bc105[_0x4d8c('0x1e')]=_0x58b0e5;if(_0x39a5e6[_0x4d8c('0x2e')]['includeAll']){_0x25d5c8['include']=[{'all':!![]}];}return db[_0x4d8c('0x2a')][_0x4d8c('0x3f')](_0x25d5c8);})[_0x4d8c('0x24')](function(_0x157a49){_0x2bc105[_0x4d8c('0x40')]=_0x157a49;return _0x2bc105;})['then'](respondWithFilteredResult(_0x371876,_0x25d5c8))[_0x4d8c('0x41')](handleError(_0x371876,null));};exports[_0x4d8c('0x42')]=function(_0x2b2c97,_0x5cca0d){var _0x4b324d={'raw':!![],'where':{'id':_0x2b2c97[_0x4d8c('0x43')]['id']}},_0x3a4a21={};_0x3a4a21[_0x4d8c('0x31')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x3a4a21[_0x4d8c('0x2e')]=_[_0x4d8c('0x44')](_0x2b2c97[_0x4d8c('0x2e')]);_0x3a4a21[_0x4d8c('0x2f')]=_[_0x4d8c('0x30')](_0x3a4a21[_0x4d8c('0x31')],_0x3a4a21[_0x4d8c('0x2e')]);_0x4b324d['attributes']=_[_0x4d8c('0x30')](_0x3a4a21[_0x4d8c('0x31')],qs[_0x4d8c('0x33')](_0x2b2c97[_0x4d8c('0x2e')]['fields']));_0x4b324d[_0x4d8c('0x32')]=_0x4b324d[_0x4d8c('0x32')]['length']?_0x4b324d[_0x4d8c('0x32')]:_0x3a4a21[_0x4d8c('0x31')];if(_0x2b2c97[_0x4d8c('0x2e')]['includeAll']){_0x4b324d[_0x4d8c('0x45')]=[{'all':!![]}];}_0x4b324d=_[_0x4d8c('0x3b')]({},_0x4b324d,_0x2b2c97[_0x4d8c('0x46')]);return db[_0x4d8c('0x2a')][_0x4d8c('0x47')](_0x4b324d)[_0x4d8c('0x24')](handleEntityNotFound(_0x5cca0d,null))[_0x4d8c('0x24')](respondWithResult(_0x5cca0d,null))[_0x4d8c('0x41')](handleError(_0x5cca0d,null));};exports['create']=function(_0x16c404,_0x50f730){return db[_0x4d8c('0x2a')][_0x4d8c('0x48')](_0x16c404[_0x4d8c('0x49')],{})[_0x4d8c('0x24')](respondWithResult(_0x50f730,0xc9))[_0x4d8c('0x41')](handleError(_0x50f730,null));};exports[_0x4d8c('0x23')]=function(_0xfdf35b,_0x47ac7c){if(_0xfdf35b[_0x4d8c('0x49')]['id']){delete _0xfdf35b['body']['id'];}return db[_0x4d8c('0x2a')]['find']({'where':{'id':_0xfdf35b[_0x4d8c('0x43')]['id']}})[_0x4d8c('0x24')](handleEntityNotFound(_0x47ac7c,null))[_0x4d8c('0x24')](saveUpdates(_0xfdf35b[_0x4d8c('0x49')],null))['then'](respondWithResult(_0x47ac7c,null))[_0x4d8c('0x41')](handleError(_0x47ac7c,null));};exports[_0x4d8c('0x4a')]=function(_0x543f2d,_0x15e4e1){return db['ZendeskField'][_0x4d8c('0x47')]({'where':{'id':_0x543f2d['params']['id']}})['then'](handleEntityNotFound(_0x15e4e1,null))[_0x4d8c('0x24')](removeEntity(_0x15e4e1,null))[_0x4d8c('0x41')](handleError(_0x15e4e1,null));}; \ No newline at end of file +var _0xe559=['util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x24289d,_0x9c3c26){var _0x17fdab=function(_0x5c5d69){while(--_0x5c5d69){_0x24289d['push'](_0x24289d['shift']());}};_0x17fdab(++_0x9c3c26);}(_0xe559,0x176));var _0x9e55=function(_0x16eb02,_0x418683){_0x16eb02=_0x16eb02-0x0;var _0x163928=_0xe559[_0x16eb02];return _0x163928;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e55('0x0'));var zipdir=require(_0x9e55('0x1'));var jsonpatch=require(_0x9e55('0x2'));var rp=require(_0x9e55('0x3'));var moment=require(_0x9e55('0x4'));var BPromise=require(_0x9e55('0x5'));var Mustache=require('mustache');var util=require(_0x9e55('0x6'));var path=require(_0x9e55('0x7'));var sox=require(_0x9e55('0x8'));var csv=require('to-csv');var ejs=require(_0x9e55('0x9'));var fs=require('fs');var fs_extra=require(_0x9e55('0xa'));var _=require(_0x9e55('0xb'));var squel=require(_0x9e55('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e55('0xd'));var toCsv=require(_0x9e55('0xe'));var querystring=require('querystring');var Papa=require(_0x9e55('0xf'));var Redis=require(_0x9e55('0x10'));var authService=require(_0x9e55('0x11'));var qs=require(_0x9e55('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e55('0x13'));var logger=require(_0x9e55('0x14'))(_0x9e55('0x15'));var utils=require('../../config/utils');var config=require(_0x9e55('0x16'));var licenseUtil=require(_0x9e55('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22ad92,_0x28d924){_0x28d924=_0x28d924||0xcc;return function(_0x232911){if(_0x232911){return _0x22ad92[_0x9e55('0x18')](_0x28d924);}return _0x22ad92['status'](_0x28d924)['end']();};}function respondWithResult(_0x371720,_0x4d84e1){_0x4d84e1=_0x4d84e1||0xc8;return function(_0x1b6a3a){if(_0x1b6a3a){return _0x371720['status'](_0x4d84e1)[_0x9e55('0x19')](_0x1b6a3a);}};}function respondWithFilteredResult(_0x1d8e8a,_0x2de722){return function(_0x10d055){if(_0x10d055){var _0x199035=typeof _0x2de722[_0x9e55('0x1a')]===_0x9e55('0x1b')&&typeof _0x2de722[_0x9e55('0x1c')]===_0x9e55('0x1b');var _0x535aeb=_0x10d055[_0x9e55('0x1d')];var _0x1d49fd=_0x199035?0x0:_0x2de722['offset'];var _0x34f0a3=_0x199035?_0x10d055['count']:_0x2de722[_0x9e55('0x1a')]+_0x2de722[_0x9e55('0x1c')];var _0x4f5daf;if(_0x34f0a3>=_0x535aeb){_0x34f0a3=_0x535aeb;_0x4f5daf=0xc8;}else{_0x4f5daf=0xce;}_0x1d8e8a[_0x9e55('0x1e')](_0x4f5daf);return _0x1d8e8a[_0x9e55('0x1f')]('Content-Range',_0x1d49fd+'-'+_0x34f0a3+'/'+_0x535aeb)[_0x9e55('0x19')](_0x10d055);}return null;};}function patchUpdates(_0xd4fb8a){return function(_0x3f672e){try{jsonpatch[_0x9e55('0x20')](_0x3f672e,_0xd4fb8a,!![]);}catch(_0x372d45){return BPromise[_0x9e55('0x21')](_0x372d45);}return _0x3f672e[_0x9e55('0x22')]();};}function saveUpdates(_0x123a15,_0x3b382b){return function(_0x16d9ed){if(_0x16d9ed){return _0x16d9ed[_0x9e55('0x23')](_0x123a15)[_0x9e55('0x24')](function(_0x4a7075){return _0x4a7075;});}return null;};}function removeEntity(_0x44de13,_0x5aba8e){return function(_0x1420b2){if(_0x1420b2){return _0x1420b2['destroy']()[_0x9e55('0x24')](function(){_0x44de13[_0x9e55('0x1e')](0xcc)[_0x9e55('0x25')]();});}};}function handleEntityNotFound(_0x173d27,_0xfb6415){return function(_0x3dfde0){if(!_0x3dfde0){_0x173d27[_0x9e55('0x18')](0x194);}return _0x3dfde0;};}function handleError(_0x31fbdf,_0x14ea8d){_0x14ea8d=_0x14ea8d||0x1f4;return function(_0xce28cd){logger[_0x9e55('0x26')](_0xce28cd[_0x9e55('0x27')]);if(_0xce28cd[_0x9e55('0x28')]){delete _0xce28cd[_0x9e55('0x28')];}_0x31fbdf[_0x9e55('0x1e')](_0x14ea8d)[_0x9e55('0x29')](_0xce28cd);};}exports[_0x9e55('0x2a')]=function(_0x1451fc,_0x4a0b62){var _0x1e5b32={},_0x117e8d={},_0x155e15={'count':0x0,'rows':[]};var _0x6f16fa=_[_0x9e55('0x2b')](db[_0x9e55('0x2c')][_0x9e55('0x2d')],function(_0x2e9dbf){return{'name':_0x2e9dbf[_0x9e55('0x2e')],'type':_0x2e9dbf[_0x9e55('0x2f')][_0x9e55('0x30')]};});_0x117e8d[_0x9e55('0x31')]=_[_0x9e55('0x2b')](_0x6f16fa,_0x9e55('0x28'));_0x117e8d[_0x9e55('0x32')]=_[_0x9e55('0x33')](_0x1451fc[_0x9e55('0x32')]);_0x117e8d['filters']=_[_0x9e55('0x34')](_0x117e8d[_0x9e55('0x31')],_0x117e8d[_0x9e55('0x32')]);_0x1e5b32['attributes']=_['intersection'](_0x117e8d[_0x9e55('0x31')],qs[_0x9e55('0x35')](_0x1451fc[_0x9e55('0x32')][_0x9e55('0x35')]));_0x1e5b32[_0x9e55('0x36')]=_0x1e5b32['attributes']['length']?_0x1e5b32['attributes']:_0x117e8d[_0x9e55('0x31')];if(!_0x1451fc[_0x9e55('0x32')][_0x9e55('0x37')](_0x9e55('0x38'))){_0x1e5b32[_0x9e55('0x1c')]=qs[_0x9e55('0x1c')](_0x1451fc['query'][_0x9e55('0x1c')]);_0x1e5b32[_0x9e55('0x1a')]=qs[_0x9e55('0x1a')](_0x1451fc[_0x9e55('0x32')][_0x9e55('0x1a')]);}_0x1e5b32[_0x9e55('0x39')]=qs[_0x9e55('0x3a')](_0x1451fc[_0x9e55('0x32')]['sort']);_0x1e5b32[_0x9e55('0x3b')]=qs[_0x9e55('0x3c')](_[_0x9e55('0x3d')](_0x1451fc[_0x9e55('0x32')],_0x117e8d['filters']),_0x6f16fa);if(_0x1451fc[_0x9e55('0x32')][_0x9e55('0x3e')]){_0x1e5b32[_0x9e55('0x3b')]=_[_0x9e55('0x3f')](_0x1e5b32[_0x9e55('0x3b')],{'$or':_['map'](_0x6f16fa,function(_0x4943de){if(_0x4943de[_0x9e55('0x2f')]!==_0x9e55('0x40')){var _0x350e8e={};_0x350e8e[_0x4943de[_0x9e55('0x28')]]={'$like':'%'+_0x1451fc['query'][_0x9e55('0x3e')]+'%'};return _0x350e8e;}})});}_0x1e5b32=_['merge']({},_0x1e5b32,_0x1451fc[_0x9e55('0x41')]);var _0x341bbd={'where':_0x1e5b32[_0x9e55('0x3b')]};return db[_0x9e55('0x2c')][_0x9e55('0x1d')](_0x341bbd)[_0x9e55('0x24')](function(_0x44b791){_0x155e15['count']=_0x44b791;if(_0x1451fc[_0x9e55('0x32')][_0x9e55('0x42')]){_0x1e5b32[_0x9e55('0x43')]=[{'all':!![]}];}return db[_0x9e55('0x2c')]['findAll'](_0x1e5b32);})[_0x9e55('0x24')](function(_0x4d9e8d){_0x155e15[_0x9e55('0x44')]=_0x4d9e8d;return _0x155e15;})[_0x9e55('0x24')](respondWithFilteredResult(_0x4a0b62,_0x1e5b32))[_0x9e55('0x45')](handleError(_0x4a0b62,null));};exports['show']=function(_0x12a4e3,_0xba8b74){var _0x12e467={'raw':!![],'where':{'id':_0x12a4e3['params']['id']}},_0x307217={};_0x307217['model']=_[_0x9e55('0x33')](db['ZendeskField'][_0x9e55('0x2d')]);_0x307217[_0x9e55('0x32')]=_[_0x9e55('0x33')](_0x12a4e3[_0x9e55('0x32')]);_0x307217[_0x9e55('0x3c')]=_[_0x9e55('0x34')](_0x307217['model'],_0x307217[_0x9e55('0x32')]);_0x12e467[_0x9e55('0x36')]=_[_0x9e55('0x34')](_0x307217[_0x9e55('0x31')],qs[_0x9e55('0x35')](_0x12a4e3[_0x9e55('0x32')]['fields']));_0x12e467[_0x9e55('0x36')]=_0x12e467[_0x9e55('0x36')][_0x9e55('0x46')]?_0x12e467[_0x9e55('0x36')]:_0x307217['model'];if(_0x12a4e3[_0x9e55('0x32')][_0x9e55('0x42')]){_0x12e467[_0x9e55('0x43')]=[{'all':!![]}];}_0x12e467=_['merge']({},_0x12e467,_0x12a4e3[_0x9e55('0x41')]);return db[_0x9e55('0x2c')][_0x9e55('0x47')](_0x12e467)[_0x9e55('0x24')](handleEntityNotFound(_0xba8b74,null))[_0x9e55('0x24')](respondWithResult(_0xba8b74,null))[_0x9e55('0x45')](handleError(_0xba8b74,null));};exports[_0x9e55('0x48')]=function(_0x18dae1,_0x5bff75){return db[_0x9e55('0x2c')][_0x9e55('0x48')](_0x18dae1[_0x9e55('0x49')],{})[_0x9e55('0x24')](respondWithResult(_0x5bff75,0xc9))[_0x9e55('0x45')](handleError(_0x5bff75,null));};exports['update']=function(_0x9e9e5b,_0x110a28){if(_0x9e9e5b[_0x9e55('0x49')]['id']){delete _0x9e9e5b['body']['id'];}return db['ZendeskField'][_0x9e55('0x47')]({'where':{'id':_0x9e9e5b[_0x9e55('0x4a')]['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x110a28,null))[_0x9e55('0x24')](saveUpdates(_0x9e9e5b[_0x9e55('0x49')],null))[_0x9e55('0x24')](respondWithResult(_0x110a28,null))[_0x9e55('0x45')](handleError(_0x110a28,null));};exports[_0x9e55('0x4b')]=function(_0x49eb66,_0x1a8f7c){return db[_0x9e55('0x2c')][_0x9e55('0x47')]({'where':{'id':_0x49eb66['params']['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x1a8f7c,null))[_0x9e55('0x24')](removeEntity(_0x1a8f7c,null))[_0x9e55('0x45')](handleError(_0x1a8f7c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6822d69..c92b304 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 _0x99f3=['request-promise','path','rimraf','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1245bf,_0x50c456){var _0xb66454=function(_0x22ac09){while(--_0x22ac09){_0x1245bf['push'](_0x1245bf['shift']());}};_0xb66454(++_0x50c456);}(_0x99f3,0x15a));var _0x399f=function(_0xc65ae2,_0x53119a){_0xc65ae2=_0xc65ae2-0x0;var _0x2432ea=_0x99f3[_0xc65ae2];return _0x2432ea;};'use strict';var _=require(_0x399f('0x0'));var util=require(_0x399f('0x1'));var logger=require(_0x399f('0x2'))(_0x399f('0x3'));var moment=require(_0x399f('0x4'));var BPromise=require(_0x399f('0x5'));var rp=require(_0x399f('0x6'));var fs=require('fs');var path=require(_0x399f('0x7'));var rimraf=require(_0x399f('0x8'));var config=require('../../config/environment');var attributes=require(_0x399f('0x9'));module[_0x399f('0xa')]=function(_0x38c33a,_0x2f51c2){return _0x38c33a[_0x399f('0xb')]('ZendeskField',attributes,{'tableName':_0x399f('0xc'),'paranoid':![],'indexes':[{'name':_0x399f('0xd'),'fields':[_0x399f('0xe'),_0x399f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe481=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xaf5cee,_0x33c89e){var _0x45f1fc=function(_0xac16f9){while(--_0xac16f9){_0xaf5cee['push'](_0xaf5cee['shift']());}};_0x45f1fc(++_0x33c89e);}(_0xe481,0x65));var _0x1e48=function(_0x1abcb6,_0x1ef8b0){_0x1abcb6=_0x1abcb6-0x0;var _0x40a2e9=_0xe481[_0x1abcb6];return _0x40a2e9;};'use strict';var _=require(_0x1e48('0x0'));var util=require(_0x1e48('0x1'));var logger=require(_0x1e48('0x2'))(_0x1e48('0x3'));var moment=require(_0x1e48('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e48('0x5'));var fs=require('fs');var path=require(_0x1e48('0x6'));var rimraf=require(_0x1e48('0x7'));var config=require(_0x1e48('0x8'));var attributes=require(_0x1e48('0x9'));module[_0x1e48('0xa')]=function(_0x5e2bee,_0x50f780){return _0x5e2bee['define'](_0x1e48('0xb'),attributes,{'tableName':_0x1e48('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1e48('0xd'),_0x1e48('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 4708ae6..87e3bd4 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 _0x713c=['client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x342db6,_0x841a43){var _0x18bd25=function(_0x4c3359){while(--_0x4c3359){_0x342db6['push'](_0x342db6['shift']());}};_0x18bd25(++_0x841a43);}(_0x713c,0x156));var _0xc713=function(_0x41e821,_0x379426){_0x41e821=_0x41e821-0x0;var _0x163ae1=_0x713c[_0x41e821];return _0x163ae1;};'use strict';var _=require(_0xc713('0x0'));var util=require(_0xc713('0x1'));var moment=require(_0xc713('0x2'));var BPromise=require('bluebird');var rs=require(_0xc713('0x3'));var fs=require('fs');var Redis=require(_0xc713('0x4'));var db=require(_0xc713('0x5'))['db'];var utils=require(_0xc713('0x6'));var logger=require(_0xc713('0x7'))(_0xc713('0x8'));var config=require('../../config/environment');var jayson=require(_0xc713('0x9'));var client=jayson[_0xc713('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x132677,_0x2da518,_0x25d5c6){return new BPromise(function(_0x2bf7c5,_0x5b652e){return client[_0xc713('0xb')](_0x132677,_0x25d5c6)[_0xc713('0xc')](function(_0x3e9bfe){logger[_0xc713('0xd')](_0xc713('0xe'),_0x2da518,_0xc713('0xf'));logger[_0xc713('0x10')](_0xc713('0x11'),_0x2da518,_0xc713('0xf'),JSON['stringify'](_0x3e9bfe));if(_0x3e9bfe[_0xc713('0x12')]){if(_0x3e9bfe[_0xc713('0x12')]['code']===0x1f4){logger[_0xc713('0x12')](_0xc713('0xe'),_0x2da518,_0x3e9bfe[_0xc713('0x12')][_0xc713('0x13')]);return _0x5b652e(_0x3e9bfe[_0xc713('0x12')][_0xc713('0x13')]);}logger[_0xc713('0x12')](_0xc713('0xe'),_0x2da518,_0x3e9bfe[_0xc713('0x12')][_0xc713('0x13')]);return _0x2bf7c5(_0x3e9bfe[_0xc713('0x12')]['message']);}else{logger[_0xc713('0xd')](_0xc713('0xe'),_0x2da518,_0xc713('0xf'));_0x2bf7c5(_0x3e9bfe[_0xc713('0x14')][_0xc713('0x13')]);}})[_0xc713('0x15')](function(_0x2f414f){logger['error'](_0xc713('0xe'),_0x2da518,_0x2f414f);_0x5b652e(_0x2f414f);});});} \ No newline at end of file +var _0x4fe7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x6c52d4,_0x49f51b){var _0x22e61e=function(_0x91dca0){while(--_0x91dca0){_0x6c52d4['push'](_0x6c52d4['shift']());}};_0x22e61e(++_0x49f51b);}(_0x4fe7,0x1e0));var _0x74fe=function(_0x198a9d,_0x4780fe){_0x198a9d=_0x198a9d-0x0;var _0x73f65e=_0x4fe7[_0x198a9d];return _0x73f65e;};'use strict';var _=require(_0x74fe('0x0'));var util=require(_0x74fe('0x1'));var moment=require(_0x74fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x74fe('0x3'));var fs=require('fs');var Redis=require(_0x74fe('0x4'));var db=require(_0x74fe('0x5'))['db'];var utils=require(_0x74fe('0x6'));var logger=require(_0x74fe('0x7'))(_0x74fe('0x8'));var config=require(_0x74fe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fe78,_0x569fd0,_0x31f3b8){return new BPromise(function(_0x29645e,_0x50963a){return client[_0x74fe('0xb')](_0x19fe78,_0x31f3b8)['then'](function(_0xe00273){logger[_0x74fe('0xc')](_0x74fe('0xd'),_0x569fd0,_0x74fe('0xe'));logger[_0x74fe('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x569fd0,_0x74fe('0xe'),JSON[_0x74fe('0x10')](_0xe00273));if(_0xe00273[_0x74fe('0x11')]){if(_0xe00273[_0x74fe('0x11')][_0x74fe('0x12')]===0x1f4){logger[_0x74fe('0x11')](_0x74fe('0xd'),_0x569fd0,_0xe00273[_0x74fe('0x11')][_0x74fe('0x13')]);return _0x50963a(_0xe00273[_0x74fe('0x11')]['message']);}logger['error'](_0x74fe('0xd'),_0x569fd0,_0xe00273['error'][_0x74fe('0x13')]);return _0x29645e(_0xe00273[_0x74fe('0x11')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x569fd0,_0x74fe('0xe'));_0x29645e(_0xe00273[_0x74fe('0x14')][_0x74fe('0x13')]);}})[_0x74fe('0x15')](function(_0x2c1dbf){logger[_0x74fe('0x11')](_0x74fe('0xd'),_0x569fd0,_0x2c1dbf);_0x50963a(_0x2c1dbf);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 38a0f07..934a24b 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 _0x463a=['create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getFields','post'];(function(_0x5c1329,_0x44d752){var _0x282631=function(_0x92755d){while(--_0x92755d){_0x5c1329['push'](_0x5c1329['shift']());}};_0x282631(++_0x44d752);}(_0x463a,0x11d));var _0xa463=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x463a[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xa463('0x0'));var path=require(_0xa463('0x1'));var timeout=require(_0xa463('0x2'));var express=require(_0xa463('0x3'));var router=express[_0xa463('0x4')]();var fs_extra=require(_0xa463('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa463('0x6'));var controller=require(_0xa463('0x7'));router['get']('/',auth[_0xa463('0x8')](),controller['index']);router['get'](_0xa463('0x9'),auth['isAuthenticated'](),controller[_0xa463('0xa')]);router[_0xa463('0xb')](_0xa463('0xc'),auth[_0xa463('0x8')](),controller['getConfigurations']);router[_0xa463('0xb')]('/:id/fields',auth[_0xa463('0x8')](),controller[_0xa463('0xd')]);router[_0xa463('0xe')]('/',auth[_0xa463('0x8')](),controller[_0xa463('0xf')]);router[_0xa463('0xe')](_0xa463('0xc'),auth[_0xa463('0x8')](),controller[_0xa463('0x10')]);router['put'](_0xa463('0x9'),auth[_0xa463('0x8')](),controller[_0xa463('0x11')]);router[_0xa463('0x12')]('/:id',auth[_0xa463('0x8')](),controller['destroy']);module[_0xa463('0x13')]=router; \ No newline at end of file +var _0xfe21=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x275bb8,_0x3c09e0){var _0x26aed3=function(_0x51e1e5){while(--_0x51e1e5){_0x275bb8['push'](_0x275bb8['shift']());}};_0x26aed3(++_0x3c09e0);}(_0xfe21,0x1e4));var _0x1fe2=function(_0x346de2,_0x14793c){_0x346de2=_0x346de2-0x0;var _0x385877=_0xfe21[_0x346de2];return _0x385877;};'use strict';var multer=require(_0x1fe2('0x0'));var util=require(_0x1fe2('0x1'));var path=require(_0x1fe2('0x2'));var timeout=require(_0x1fe2('0x3'));var express=require(_0x1fe2('0x4'));var router=express['Router']();var fs_extra=require(_0x1fe2('0x5'));var auth=require(_0x1fe2('0x6'));var interaction=require(_0x1fe2('0x7'));var config=require(_0x1fe2('0x8'));var controller=require(_0x1fe2('0x9'));router['get']('/',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xb')]);router[_0x1fe2('0xc')]('/:id',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xd')]);router[_0x1fe2('0xc')](_0x1fe2('0xe'),auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xf')]);router[_0x1fe2('0xc')](_0x1fe2('0x10'),auth[_0x1fe2('0xa')](),controller['getFields']);router[_0x1fe2('0x11')]('/',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0x12')]);router[_0x1fe2('0x11')](_0x1fe2('0xe'),auth['isAuthenticated'](),controller[_0x1fe2('0x13')]);router['put'](_0x1fe2('0x14'),auth[_0x1fe2('0xa')](),controller[_0x1fe2('0x15')]);router[_0x1fe2('0x16')](_0x1fe2('0x14'),auth[_0x1fe2('0xa')](),controller['destroy']);module[_0x1fe2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 25c6f35..aa69343 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['exports','STRING','sequelize'];(function(_0x591f63,_0x3d435c){var _0x4e7ede=function(_0x2b9b1d){while(--_0x2b9b1d){_0x591f63['push'](_0x591f63['shift']());}};_0x4e7ede(++_0x3d435c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x5e3165,_0x13878d){_0x5e3165=_0x5e3165-0x0;var _0x24f1b8=_0xa8a8[_0x5e3165];return _0x24f1b8;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0xb4e6=['sequelize','STRING'];(function(_0x222a14,_0x378764){var _0x3f074a=function(_0x514cc4){while(--_0x514cc4){_0x222a14['push'](_0x222a14['shift']());}};_0x3f074a(++_0x378764);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb4e6[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 413beac..9e6fa2f 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 _0xdaab=['/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','zone','serverUrl','zoho.eu','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','end','error','stack','send','index','ZohoAccount','rawAttributes','type','key','map','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','include','find','create','body','update','params','destroy','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST'];(function(_0x505606,_0x38ed25){var _0x3d2e1a=function(_0x2f26ca){while(--_0x2f26ca){_0x505606['push'](_0x505606['shift']());}};_0x3d2e1a(++_0x38ed25);}(_0xdaab,0xa2));var _0xbdaa=function(_0x123902,_0x4912bf){_0x123902=_0x123902-0x0;var _0x1464f1=_0xdaab[_0x123902];return _0x1464f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbdaa('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbdaa('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbdaa('0x2'));var util=require(_0xbdaa('0x3'));var path=require('path');var sox=require(_0xbdaa('0x4'));var csv=require(_0xbdaa('0x5'));var ejs=require(_0xbdaa('0x6'));var fs=require('fs');var fs_extra=require(_0xbdaa('0x7'));var _=require(_0xbdaa('0x8'));var squel=require(_0xbdaa('0x9'));var crypto=require(_0xbdaa('0xa'));var jsforce=require(_0xbdaa('0xb'));var deskjs=require(_0xbdaa('0xc'));var toCsv=require(_0xbdaa('0x5'));var querystring=require(_0xbdaa('0xd'));var Papa=require(_0xbdaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbdaa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdaa('0x10'));var logger=require(_0xbdaa('0x11'))(_0xbdaa('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdaa('0x13'));var db=require(_0xbdaa('0x14'))['db'];var integrations=require(_0xbdaa('0x15'));function respondWithStatusCode(_0x64d824,_0x32f6dc){_0x32f6dc=_0x32f6dc||0xcc;return function(_0x3eae1e){if(_0x3eae1e){return _0x64d824[_0xbdaa('0x16')](_0x32f6dc);}return _0x64d824[_0xbdaa('0x17')](_0x32f6dc)['end']();};}function respondWithResult(_0x37017c,_0x140184){_0x140184=_0x140184||0xc8;return function(_0xe1789f){if(_0xe1789f){return _0x37017c[_0xbdaa('0x17')](_0x140184)[_0xbdaa('0x18')](_0xe1789f);}};}function respondWithFilteredResult(_0x3e3db1,_0xe2d81c){return function(_0x35a4d0){if(_0x35a4d0){var _0x2d1b23=typeof _0xe2d81c[_0xbdaa('0x19')]===_0xbdaa('0x1a')&&typeof _0xe2d81c[_0xbdaa('0x1b')]===_0xbdaa('0x1a');var _0x2aabce=_0x35a4d0[_0xbdaa('0x1c')];var _0x1b2676=_0x2d1b23?0x0:_0xe2d81c[_0xbdaa('0x19')];var _0x4b9f1c=_0x2d1b23?_0x35a4d0['count']:_0xe2d81c[_0xbdaa('0x19')]+_0xe2d81c[_0xbdaa('0x1b')];var _0x313be0;if(_0x4b9f1c>=_0x2aabce){_0x4b9f1c=_0x2aabce;_0x313be0=0xc8;}else{_0x313be0=0xce;}_0x3e3db1[_0xbdaa('0x17')](_0x313be0);return _0x3e3db1['set'](_0xbdaa('0x1d'),_0x1b2676+'-'+_0x4b9f1c+'/'+_0x2aabce)[_0xbdaa('0x18')](_0x35a4d0);}return null;};}function patchUpdates(_0x518250){return function(_0x1dd330){try{jsonpatch['apply'](_0x1dd330,_0x518250,!![]);}catch(_0x45ac49){return BPromise[_0xbdaa('0x1e')](_0x45ac49);}return _0x1dd330[_0xbdaa('0x1f')]();};}function saveUpdates(_0x40da68,_0x222de5){return function(_0x668b6f){if(_0x668b6f){return _0x668b6f['update'](_0x40da68)[_0xbdaa('0x20')](function(_0x392da0){return _0x392da0;});}return null;};}function removeEntity(_0x11d42b,_0x5bf165){return function(_0x4b6dfe){if(_0x4b6dfe){return _0x4b6dfe['destroy']()[_0xbdaa('0x20')](function(){_0x11d42b[_0xbdaa('0x17')](0xcc)[_0xbdaa('0x21')]();});}};}function handleEntityNotFound(_0x4e3975,_0x5c3c1b){return function(_0x4e9bdf){if(!_0x4e9bdf){_0x4e3975[_0xbdaa('0x16')](0x194);}return _0x4e9bdf;};}function handleError(_0x26918c,_0x1f92a3){_0x1f92a3=_0x1f92a3||0x1f4;return function(_0x4eb095){logger[_0xbdaa('0x22')](_0x4eb095[_0xbdaa('0x23')]);if(_0x4eb095['name']){delete _0x4eb095['name'];}_0x26918c[_0xbdaa('0x17')](_0x1f92a3)[_0xbdaa('0x24')](_0x4eb095);};}exports[_0xbdaa('0x25')]=function(_0x310631,_0x4dbf91){var _0x264464={},_0x1171ca={},_0x98081d={'count':0x0,'rows':[]};var _0x52082e=_['map'](db[_0xbdaa('0x26')][_0xbdaa('0x27')],function(_0x3e3341){return{'name':_0x3e3341['fieldName'],'type':_0x3e3341[_0xbdaa('0x28')][_0xbdaa('0x29')]};});_0x1171ca['model']=_[_0xbdaa('0x2a')](_0x52082e,_0xbdaa('0x2b'));_0x1171ca[_0xbdaa('0x2c')]=_['keys'](_0x310631[_0xbdaa('0x2c')]);_0x1171ca[_0xbdaa('0x2d')]=_['intersection'](_0x1171ca[_0xbdaa('0x2e')],_0x1171ca['query']);_0x264464[_0xbdaa('0x2f')]=_[_0xbdaa('0x30')](_0x1171ca['model'],qs[_0xbdaa('0x31')](_0x310631['query'][_0xbdaa('0x31')]));_0x264464['attributes']=_0x264464[_0xbdaa('0x2f')][_0xbdaa('0x32')]?_0x264464['attributes']:_0x1171ca[_0xbdaa('0x2e')];if(!_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x33')](_0xbdaa('0x34'))){_0x264464[_0xbdaa('0x1b')]=qs[_0xbdaa('0x1b')](_0x310631[_0xbdaa('0x2c')]['limit']);_0x264464[_0xbdaa('0x19')]=qs[_0xbdaa('0x19')](_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x19')]);}_0x264464[_0xbdaa('0x35')]=qs[_0xbdaa('0x36')](_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x36')]);_0x264464[_0xbdaa('0x37')]=qs['filters'](_[_0xbdaa('0x38')](_0x310631[_0xbdaa('0x2c')],_0x1171ca[_0xbdaa('0x2d')]),_0x52082e);if(_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x39')]){_0x264464[_0xbdaa('0x37')]=_[_0xbdaa('0x3a')](_0x264464[_0xbdaa('0x37')],{'$or':_[_0xbdaa('0x2a')](_0x52082e,function(_0x4d4bd2){if(_0x4d4bd2[_0xbdaa('0x28')]!==_0xbdaa('0x3b')){var _0x24f1a2={};_0x24f1a2[_0x4d4bd2[_0xbdaa('0x2b')]]={'$like':'%'+_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x39')]+'%'};return _0x24f1a2;}})});}_0x264464=_[_0xbdaa('0x3a')]({},_0x264464,_0x310631[_0xbdaa('0x3c')]);var _0xcec347={'where':_0x264464['where']};return db[_0xbdaa('0x26')][_0xbdaa('0x1c')](_0xcec347)[_0xbdaa('0x20')](function(_0x4d3bd0){_0x98081d[_0xbdaa('0x1c')]=_0x4d3bd0;if(_0x310631[_0xbdaa('0x2c')][_0xbdaa('0x3d')]){_0x264464['include']=[{'all':!![]}];}return db[_0xbdaa('0x26')][_0xbdaa('0x3e')](_0x264464);})[_0xbdaa('0x20')](function(_0x40471d){_0x98081d['rows']=_0x40471d;return _0x98081d;})[_0xbdaa('0x20')](respondWithFilteredResult(_0x4dbf91,_0x264464))[_0xbdaa('0x3f')](handleError(_0x4dbf91,null));};exports[_0xbdaa('0x40')]=function(_0x2beff6,_0x4b134c){var _0x1360db={'raw':![],'where':{'id':_0x2beff6['params']['id']}},_0x108407={};_0x108407[_0xbdaa('0x2e')]=_[_0xbdaa('0x41')](db[_0xbdaa('0x26')][_0xbdaa('0x27')]);_0x108407[_0xbdaa('0x2c')]=_['keys'](_0x2beff6['query']);_0x108407['filters']=_[_0xbdaa('0x30')](_0x108407['model'],_0x108407['query']);_0x1360db[_0xbdaa('0x2f')]=_[_0xbdaa('0x30')](_0x108407[_0xbdaa('0x2e')],qs[_0xbdaa('0x31')](_0x2beff6['query'][_0xbdaa('0x31')]));_0x1360db[_0xbdaa('0x2f')]=_0x1360db[_0xbdaa('0x2f')][_0xbdaa('0x32')]?_0x1360db[_0xbdaa('0x2f')]:_0x108407['model'];if(_0x2beff6[_0xbdaa('0x2c')][_0xbdaa('0x3d')]){_0x1360db[_0xbdaa('0x42')]=[{'all':!![]}];}_0x1360db=_['merge']({},_0x1360db,_0x2beff6[_0xbdaa('0x3c')]);return db['ZohoAccount'][_0xbdaa('0x43')](_0x1360db)['then'](handleEntityNotFound(_0x4b134c,null))[_0xbdaa('0x20')](respondWithResult(_0x4b134c,null))[_0xbdaa('0x3f')](handleError(_0x4b134c,null));};exports['create']=function(_0x55194c,_0xf78a20){return db[_0xbdaa('0x26')][_0xbdaa('0x44')](_0x55194c[_0xbdaa('0x45')],{})[_0xbdaa('0x20')](respondWithResult(_0xf78a20,0xc9))[_0xbdaa('0x3f')](handleError(_0xf78a20,null));};exports[_0xbdaa('0x46')]=function(_0x5c01b0,_0x330446){if(_0x5c01b0[_0xbdaa('0x45')]['id']){delete _0x5c01b0[_0xbdaa('0x45')]['id'];}return db[_0xbdaa('0x26')][_0xbdaa('0x43')]({'where':{'id':_0x5c01b0[_0xbdaa('0x47')]['id']}})[_0xbdaa('0x20')](handleEntityNotFound(_0x330446,null))[_0xbdaa('0x20')](saveUpdates(_0x5c01b0[_0xbdaa('0x45')],null))[_0xbdaa('0x20')](respondWithResult(_0x330446,null))['catch'](handleError(_0x330446,null));};exports[_0xbdaa('0x48')]=function(_0x1c39eb,_0x2444aa){return db[_0xbdaa('0x26')][_0xbdaa('0x43')]({'where':{'id':_0x1c39eb[_0xbdaa('0x47')]['id']}})[_0xbdaa('0x20')](handleEntityNotFound(_0x2444aa,null))['then'](removeEntity(_0x2444aa,null))[_0xbdaa('0x3f')](handleError(_0x2444aa,null));};exports['getConfigurations']=function(_0x1cdad3,_0x5da88f,_0x32f980){var _0x374c18={};var _0x304473={};var _0x169067;var _0x43c081;return db['ZohoAccount'][_0xbdaa('0x49')]({'where':{'id':_0x1cdad3[_0xbdaa('0x47')]['id']}})[_0xbdaa('0x20')](handleEntityNotFound(_0x5da88f,null))['then'](function(_0xde712){if(_0xde712){_0x169067=_0xde712;_0x304473[_0xbdaa('0x2e')]=_[_0xbdaa('0x41')](db[_0xbdaa('0x4a')][_0xbdaa('0x27')]);_0x304473['query']=_[_0xbdaa('0x41')](_0x1cdad3['query']);_0x304473[_0xbdaa('0x2d')]=_[_0xbdaa('0x30')](_0x304473['model'],_0x304473[_0xbdaa('0x2c')]);_0x374c18[_0xbdaa('0x2f')]=_['intersection'](_0x304473['model'],qs[_0xbdaa('0x31')](_0x1cdad3[_0xbdaa('0x2c')][_0xbdaa('0x31')]));_0x374c18[_0xbdaa('0x2f')]=_0x374c18['attributes'][_0xbdaa('0x32')]?_0x374c18['attributes']:_0x304473[_0xbdaa('0x2e')];_0x374c18[_0xbdaa('0x35')]=qs['sort'](_0x1cdad3[_0xbdaa('0x2c')]['sort']);_0x374c18[_0xbdaa('0x37')]=qs[_0xbdaa('0x2d')](_[_0xbdaa('0x38')](_0x1cdad3['query'],_0x304473[_0xbdaa('0x2d')]));if(_0x1cdad3['query'][_0xbdaa('0x39')]){_0x374c18[_0xbdaa('0x37')]=_['merge'](_0x374c18['where'],{'$or':_['map'](_0x374c18[_0xbdaa('0x2f')],function(_0x56795b){var _0x4ea631={};_0x4ea631[_0x56795b]={'$like':'%'+_0x1cdad3[_0xbdaa('0x2c')][_0xbdaa('0x39')]+'%'};return _0x4ea631;})});}_0x374c18=_['merge']({},_0x374c18,_0x1cdad3[_0xbdaa('0x3c')]);return _0x169067['getConfigurations'](_0x374c18);}})['then'](function(_0x33578f){if(_0x33578f){_0x43c081=_0x33578f['length'];if(!_0x1cdad3[_0xbdaa('0x2c')][_0xbdaa('0x33')]('nolimit')){_0x374c18['limit']=qs[_0xbdaa('0x1b')](_0x1cdad3[_0xbdaa('0x2c')][_0xbdaa('0x1b')]);_0x374c18[_0xbdaa('0x19')]=qs[_0xbdaa('0x19')](_0x1cdad3[_0xbdaa('0x2c')][_0xbdaa('0x19')]);}return _0x169067[_0xbdaa('0x4b')](_0x374c18);}})[_0xbdaa('0x20')](function(_0x12ef7b){if(_0x12ef7b){return _0x12ef7b?{'count':_0x43c081,'rows':_0x12ef7b}:null;}})[_0xbdaa('0x20')](respondWithResult(_0x5da88f,null))['catch'](handleError(_0x5da88f,null));};exports[_0xbdaa('0x4c')]=function(_0x561dea,_0x464f7b,_0x6e91d0){if(_0x561dea[_0xbdaa('0x45')]['id']){delete _0x561dea['body']['id'];}return db[_0xbdaa('0x26')][_0xbdaa('0x49')]({'where':{'id':_0x561dea['params']['id']}})[_0xbdaa('0x20')](handleEntityNotFound(_0x464f7b,null))[_0xbdaa('0x20')](function(_0x3d309e){if(_0x3d309e){_0x561dea[_0xbdaa('0x45')][_0xbdaa('0x4d')]=_0x3d309e['id'];_0x561dea[_0xbdaa('0x45')][_0xbdaa('0x4e')]=integrations['getSubjects'](_0x561dea[_0xbdaa('0x45')][_0xbdaa('0x4f')],_0x561dea[_0xbdaa('0x45')][_0xbdaa('0x28')]);_0x561dea['body'][_0xbdaa('0x50')]=integrations['getDescriptions'](_0x561dea[_0xbdaa('0x45')][_0xbdaa('0x4f')],_0x561dea[_0xbdaa('0x45')]['type']);return db['ZohoConfiguration'][_0xbdaa('0x44')](_0x561dea['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xbdaa('0x51')],'as':_0xbdaa('0x50')}]});}return null;})[_0xbdaa('0x20')](respondWithResult(_0x464f7b,null))[_0xbdaa('0x3f')](handleError(_0x464f7b,null));};function getAccessToken(_0x530703){return new Promise(function(_0x5028d6,_0x55976c){var _0x113a18;switch(_0x530703['zone']){case'US':_0x113a18=_0xbdaa('0x52');break;case'AU':_0x113a18=_0xbdaa('0x53');break;case'EU':_0x113a18=_0xbdaa('0x54');break;case'IN':_0x113a18=_0xbdaa('0x55');break;case'CN':_0x113a18=_0xbdaa('0x56');break;default:_0x113a18=_0xbdaa('0x54');break;}var _0x3a48e7={'method':_0xbdaa('0x57'),'uri':_0x113a18+_0xbdaa('0x58'),'qs':{'refresh_token':_0x530703[_0xbdaa('0x59')],'client_id':_0x530703[_0xbdaa('0x5a')],'client_secret':_0x530703[_0xbdaa('0x5b')],'grant_type':_0xbdaa('0x5c')},'json':!![]};return rp(_0x3a48e7)[_0xbdaa('0x20')](function(_0x2f6ff0){if(_0x2f6ff0[_0xbdaa('0x5d')]){_0x5028d6(_0x2f6ff0[_0xbdaa('0x5d')]);}else{_0x55976c('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xbdaa('0x3f')](function(_0x51ce8d){_0x55976c(_0x51ce8d);});});}exports['getFields']=function(_0x1d507d,_0x5caee8,_0x4599d1){var _0x5e6b29,_0x6678d9,_0x4dbada,_0x22b3c8,_0x5c04ae;return db[_0xbdaa('0x26')][_0xbdaa('0x49')]({'where':{'id':_0x1d507d[_0xbdaa('0x47')]['id']},'attributes':['id',_0xbdaa('0x5e'),_0xbdaa('0x5f'),_0xbdaa('0x5a'),_0xbdaa('0x5b'),_0xbdaa('0x60'),'code',_0xbdaa('0x59')]})[_0xbdaa('0x20')](handleEntityNotFound(_0x5caee8,null))[_0xbdaa('0x20')](function(_0x10c353){_0x5c04ae=_0x10c353;_0x5e6b29=_0x5c04ae[_0xbdaa('0x5e')];_0x6678d9=_0x5e6b29===_0xbdaa('0x61')?'eu':'com';_0x4dbada=_0x5c04ae[_0xbdaa('0x60')];var _0x1e8059=_0x4dbada[_0xbdaa('0x62')](-0x1);if(_0x1e8059==='/'||_0x1e8059==='\x5c'||_0x1e8059===':'){_0x4dbada=_0x4dbada[_0xbdaa('0x63')](0x0,_0x4dbada[_0xbdaa('0x64')](_0x1e8059));}if(!_0x5c04ae[_0xbdaa('0x59')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5c04ae);})[_0xbdaa('0x20')](function(_0x17b9e8){if(_0x17b9e8){return rp({'method':_0xbdaa('0x65'),'uri':util[_0xbdaa('0x66')](_0xbdaa('0x67'),_0x6678d9),'qs':{'module':_0xbdaa('0x68')},'headers':{'Authorization':_0xbdaa('0x69')+_0x17b9e8},'json':!![]});}})['then'](function(_0x532d64){if(_0x532d64){if(_0x532d64[_0xbdaa('0x6a')]&&_0x532d64[_0xbdaa('0x6a')][_0xbdaa('0x22')]){throw new Error(_0x532d64[_0xbdaa('0x6a')]['error'][_0xbdaa('0x6b')]);}var _0x456249=[];var _0x32b3cd=[];var _0x5dbaa0=[_0xbdaa('0x6c'),'Subject',_0xbdaa('0x6d'),'WhoId',_0xbdaa('0x6e'),'Call_Result',_0xbdaa('0x6f'),'Call_Type'];_0x32b3cd=_[_0xbdaa('0x70')](_0x532d64[_0xbdaa('0x31')],function(_0x26be7f){return _0x5dbaa0[_0xbdaa('0x71')](_0x26be7f[_0xbdaa('0x72')]);});for(var _0x2a177f=0x0;_0x2a177f<_0x32b3cd['length'];_0x2a177f++){if(_0x32b3cd[_0x2a177f][_0xbdaa('0x73')]===![]){_0x456249[_0xbdaa('0x74')]({'id':_0x32b3cd[_0x2a177f]['id'],'name':_0x32b3cd[_0x2a177f][_0xbdaa('0x75')],'custom':_0x32b3cd[_0x2a177f]['custom_field'],'options':_0x32b3cd[_0x2a177f]['data_type']==='picklist'&&_0x32b3cd[_0x2a177f]['pick_list_values']['length']>-0x1?_[_0xbdaa('0x2a')](_0x32b3cd[_0x2a177f][_0xbdaa('0x76')],function(_0x2145ef){return{'name':_0x2145ef,'value':_0x2145ef};}):[]});}}return{'count':_0x456249[_0xbdaa('0x32')],'rows':_0x456249};}else{return{'count':0x0,'rows':[]};}})[_0xbdaa('0x20')](respondWithResult(_0x5caee8,null))['catch'](function(_0x57f1b7){var _0x57d8e0=_0x1d507d[_0xbdaa('0x2c')][_0xbdaa('0x77')]?0x1f4:_0x57f1b7[_0xbdaa('0x78')]||0x1f4;logger[_0xbdaa('0x22')](_0xbdaa('0x79'),_0xbdaa('0x7a'),_0x57d8e0,JSON[_0xbdaa('0x7b')](_0x57f1b7));delete _0x57f1b7[_0xbdaa('0x2b')];if(_0x57d8e0===0x191){_0x57d8e0=0x190;}_0x5caee8[_0xbdaa('0x17')](_0x57d8e0)[_0xbdaa('0x24')](_0x1d507d[_0xbdaa('0x2c')][_0xbdaa('0x77')]?{'message':_0xbdaa('0x7c'),'statusCode':_0x57f1b7[_0xbdaa('0x78')]}:_0x57f1b7);});}; \ No newline at end of file +var _0x5c4c=['clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','ZohoAccount','type','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken'];(function(_0x3f2fbb,_0xa096c2){var _0x3a080e=function(_0x11c418){while(--_0x11c418){_0x3f2fbb['push'](_0x3f2fbb['shift']());}};_0x3a080e(++_0xa096c2);}(_0x5c4c,0x11c));var _0xc5c4=function(_0x188b0b,_0x90fbaf){_0x188b0b=_0x188b0b-0x0;var _0x1b7d87=_0x5c4c[_0x188b0b];return _0x1b7d87;};'use strict';var emlformat=require(_0xc5c4('0x0'));var rimraf=require(_0xc5c4('0x1'));var zipdir=require(_0xc5c4('0x2'));var jsonpatch=require(_0xc5c4('0x3'));var rp=require('request-promise');var moment=require(_0xc5c4('0x4'));var BPromise=require(_0xc5c4('0x5'));var Mustache=require(_0xc5c4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc5c4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5c4('0x8'));var _=require(_0xc5c4('0x9'));var squel=require('squel');var crypto=require(_0xc5c4('0xa'));var jsforce=require(_0xc5c4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc5c4('0x7'));var querystring=require('querystring');var Papa=require(_0xc5c4('0xc'));var Redis=require(_0xc5c4('0xd'));var authService=require(_0xc5c4('0xe'));var qs=require(_0xc5c4('0xf'));var as=require(_0xc5c4('0x10'));var hardwareService=require(_0xc5c4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc5c4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc5c4('0x13'));var db=require(_0xc5c4('0x14'))['db'];var integrations=require(_0xc5c4('0x15'));function respondWithStatusCode(_0x290ed0,_0x35bc6f){_0x35bc6f=_0x35bc6f||0xcc;return function(_0x4fa56c){if(_0x4fa56c){return _0x290ed0[_0xc5c4('0x16')](_0x35bc6f);}return _0x290ed0[_0xc5c4('0x17')](_0x35bc6f)[_0xc5c4('0x18')]();};}function respondWithResult(_0x1acb2f,_0x242897){_0x242897=_0x242897||0xc8;return function(_0xe1244){if(_0xe1244){return _0x1acb2f[_0xc5c4('0x17')](_0x242897)[_0xc5c4('0x19')](_0xe1244);}};}function respondWithFilteredResult(_0x25b637,_0x3ddbc7){return function(_0x4b1c45){if(_0x4b1c45){var _0x4277be=typeof _0x3ddbc7[_0xc5c4('0x1a')]==='undefined'&&typeof _0x3ddbc7[_0xc5c4('0x1b')]==='undefined';var _0x24ce5d=_0x4b1c45[_0xc5c4('0x1c')];var _0x565465=_0x4277be?0x0:_0x3ddbc7['offset'];var _0x3389ec=_0x4277be?_0x4b1c45[_0xc5c4('0x1c')]:_0x3ddbc7[_0xc5c4('0x1a')]+_0x3ddbc7[_0xc5c4('0x1b')];var _0x3f07f0;if(_0x3389ec>=_0x24ce5d){_0x3389ec=_0x24ce5d;_0x3f07f0=0xc8;}else{_0x3f07f0=0xce;}_0x25b637[_0xc5c4('0x17')](_0x3f07f0);return _0x25b637[_0xc5c4('0x1d')](_0xc5c4('0x1e'),_0x565465+'-'+_0x3389ec+'/'+_0x24ce5d)[_0xc5c4('0x19')](_0x4b1c45);}return null;};}function patchUpdates(_0x1fd511){return function(_0x1db53e){try{jsonpatch[_0xc5c4('0x1f')](_0x1db53e,_0x1fd511,!![]);}catch(_0x5b1956){return BPromise[_0xc5c4('0x20')](_0x5b1956);}return _0x1db53e['save']();};}function saveUpdates(_0x1aca81,_0x54ebbc){return function(_0x43ec8c){if(_0x43ec8c){return _0x43ec8c[_0xc5c4('0x21')](_0x1aca81)[_0xc5c4('0x22')](function(_0x2cfc61){return _0x2cfc61;});}return null;};}function removeEntity(_0x325df1,_0x5a5561){return function(_0x508dbc){if(_0x508dbc){return _0x508dbc[_0xc5c4('0x23')]()[_0xc5c4('0x22')](function(){_0x325df1[_0xc5c4('0x17')](0xcc)[_0xc5c4('0x18')]();});}};}function handleEntityNotFound(_0x420b6b,_0x4f18dc){return function(_0x45e6b0){if(!_0x45e6b0){_0x420b6b[_0xc5c4('0x16')](0x194);}return _0x45e6b0;};}function handleError(_0x74dbce,_0x1c160d){_0x1c160d=_0x1c160d||0x1f4;return function(_0x2efd0f){logger[_0xc5c4('0x24')](_0x2efd0f[_0xc5c4('0x25')]);if(_0x2efd0f['name']){delete _0x2efd0f['name'];}_0x74dbce[_0xc5c4('0x17')](_0x1c160d)[_0xc5c4('0x26')](_0x2efd0f);};}exports[_0xc5c4('0x27')]=function(_0x3ffb50,_0x49348e){var _0x1539d3={},_0x424d99={},_0x2afcd1={'count':0x0,'rows':[]};var _0x3975b8=_[_0xc5c4('0x28')](db[_0xc5c4('0x29')]['rawAttributes'],function(_0x5b5f51){return{'name':_0x5b5f51['fieldName'],'type':_0x5b5f51[_0xc5c4('0x2a')]['key']};});_0x424d99[_0xc5c4('0x2b')]=_['map'](_0x3975b8,_0xc5c4('0x2c'));_0x424d99['query']=_['keys'](_0x3ffb50['query']);_0x424d99['filters']=_['intersection'](_0x424d99[_0xc5c4('0x2b')],_0x424d99[_0xc5c4('0x2d')]);_0x1539d3[_0xc5c4('0x2e')]=_[_0xc5c4('0x2f')](_0x424d99[_0xc5c4('0x2b')],qs[_0xc5c4('0x30')](_0x3ffb50['query'][_0xc5c4('0x30')]));_0x1539d3[_0xc5c4('0x2e')]=_0x1539d3['attributes'][_0xc5c4('0x31')]?_0x1539d3[_0xc5c4('0x2e')]:_0x424d99[_0xc5c4('0x2b')];if(!_0x3ffb50['query'][_0xc5c4('0x32')](_0xc5c4('0x33'))){_0x1539d3[_0xc5c4('0x1b')]=qs[_0xc5c4('0x1b')](_0x3ffb50['query'][_0xc5c4('0x1b')]);_0x1539d3['offset']=qs[_0xc5c4('0x1a')](_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x1a')]);}_0x1539d3[_0xc5c4('0x34')]=qs[_0xc5c4('0x35')](_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x35')]);_0x1539d3['where']=qs[_0xc5c4('0x36')](_['pick'](_0x3ffb50[_0xc5c4('0x2d')],_0x424d99[_0xc5c4('0x36')]),_0x3975b8);if(_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x37')]){_0x1539d3['where']=_[_0xc5c4('0x38')](_0x1539d3[_0xc5c4('0x39')],{'$or':_[_0xc5c4('0x28')](_0x3975b8,function(_0x5be3d2){if(_0x5be3d2[_0xc5c4('0x2a')]!==_0xc5c4('0x3a')){var _0x3db6ad={};_0x3db6ad[_0x5be3d2[_0xc5c4('0x2c')]]={'$like':'%'+_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x37')]+'%'};return _0x3db6ad;}})});}_0x1539d3=_[_0xc5c4('0x38')]({},_0x1539d3,_0x3ffb50[_0xc5c4('0x3b')]);var _0x5d1b9c={'where':_0x1539d3[_0xc5c4('0x39')]};return db[_0xc5c4('0x29')]['count'](_0x5d1b9c)[_0xc5c4('0x22')](function(_0xb18cc2){_0x2afcd1[_0xc5c4('0x1c')]=_0xb18cc2;if(_0x3ffb50[_0xc5c4('0x2d')]['includeAll']){_0x1539d3['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xc5c4('0x3c')](_0x1539d3);})[_0xc5c4('0x22')](function(_0x248557){_0x2afcd1[_0xc5c4('0x3d')]=_0x248557;return _0x2afcd1;})[_0xc5c4('0x22')](respondWithFilteredResult(_0x49348e,_0x1539d3))[_0xc5c4('0x3e')](handleError(_0x49348e,null));};exports[_0xc5c4('0x3f')]=function(_0x3579ea,_0x100680){var _0x34a79b={'raw':![],'where':{'id':_0x3579ea[_0xc5c4('0x40')]['id']}},_0x218926={};_0x218926[_0xc5c4('0x2b')]=_[_0xc5c4('0x41')](db[_0xc5c4('0x29')][_0xc5c4('0x42')]);_0x218926['query']=_[_0xc5c4('0x41')](_0x3579ea[_0xc5c4('0x2d')]);_0x218926['filters']=_['intersection'](_0x218926[_0xc5c4('0x2b')],_0x218926[_0xc5c4('0x2d')]);_0x34a79b[_0xc5c4('0x2e')]=_['intersection'](_0x218926[_0xc5c4('0x2b')],qs['fields'](_0x3579ea[_0xc5c4('0x2d')]['fields']));_0x34a79b['attributes']=_0x34a79b['attributes']['length']?_0x34a79b[_0xc5c4('0x2e')]:_0x218926[_0xc5c4('0x2b')];if(_0x3579ea[_0xc5c4('0x2d')]['includeAll']){_0x34a79b[_0xc5c4('0x43')]=[{'all':!![]}];}_0x34a79b=_['merge']({},_0x34a79b,_0x3579ea[_0xc5c4('0x3b')]);return db['ZohoAccount'][_0xc5c4('0x44')](_0x34a79b)[_0xc5c4('0x22')](handleEntityNotFound(_0x100680,null))[_0xc5c4('0x22')](respondWithResult(_0x100680,null))['catch'](handleError(_0x100680,null));};exports[_0xc5c4('0x45')]=function(_0x3c71fc,_0x1b859b){return db[_0xc5c4('0x29')][_0xc5c4('0x45')](_0x3c71fc[_0xc5c4('0x46')],{})[_0xc5c4('0x22')](respondWithResult(_0x1b859b,0xc9))[_0xc5c4('0x3e')](handleError(_0x1b859b,null));};exports[_0xc5c4('0x21')]=function(_0x3f2b21,_0x402f8f){if(_0x3f2b21[_0xc5c4('0x46')]['id']){delete _0x3f2b21[_0xc5c4('0x46')]['id'];}return db[_0xc5c4('0x29')][_0xc5c4('0x44')]({'where':{'id':_0x3f2b21[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x402f8f,null))['then'](saveUpdates(_0x3f2b21[_0xc5c4('0x46')],null))[_0xc5c4('0x22')](respondWithResult(_0x402f8f,null))[_0xc5c4('0x3e')](handleError(_0x402f8f,null));};exports[_0xc5c4('0x23')]=function(_0x38686e,_0x620a0d){return db[_0xc5c4('0x29')][_0xc5c4('0x44')]({'where':{'id':_0x38686e[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x620a0d,null))[_0xc5c4('0x22')](removeEntity(_0x620a0d,null))['catch'](handleError(_0x620a0d,null));};exports[_0xc5c4('0x47')]=function(_0x891087,_0x3cd80f,_0x418d92){var _0x215d1d={};var _0x520a8d={};var _0x565180;var _0x12005b;return db['ZohoAccount']['findOne']({'where':{'id':_0x891087['params']['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x3cd80f,null))[_0xc5c4('0x22')](function(_0x1df7df){if(_0x1df7df){_0x565180=_0x1df7df;_0x520a8d[_0xc5c4('0x2b')]=_[_0xc5c4('0x41')](db[_0xc5c4('0x48')]['rawAttributes']);_0x520a8d[_0xc5c4('0x2d')]=_[_0xc5c4('0x41')](_0x891087[_0xc5c4('0x2d')]);_0x520a8d[_0xc5c4('0x36')]=_['intersection'](_0x520a8d[_0xc5c4('0x2b')],_0x520a8d[_0xc5c4('0x2d')]);_0x215d1d[_0xc5c4('0x2e')]=_[_0xc5c4('0x2f')](_0x520a8d['model'],qs[_0xc5c4('0x30')](_0x891087[_0xc5c4('0x2d')][_0xc5c4('0x30')]));_0x215d1d[_0xc5c4('0x2e')]=_0x215d1d[_0xc5c4('0x2e')][_0xc5c4('0x31')]?_0x215d1d[_0xc5c4('0x2e')]:_0x520a8d[_0xc5c4('0x2b')];_0x215d1d[_0xc5c4('0x34')]=qs[_0xc5c4('0x35')](_0x891087[_0xc5c4('0x2d')]['sort']);_0x215d1d[_0xc5c4('0x39')]=qs[_0xc5c4('0x36')](_['pick'](_0x891087[_0xc5c4('0x2d')],_0x520a8d['filters']));if(_0x891087['query'][_0xc5c4('0x37')]){_0x215d1d['where']=_[_0xc5c4('0x38')](_0x215d1d[_0xc5c4('0x39')],{'$or':_[_0xc5c4('0x28')](_0x215d1d['attributes'],function(_0x170234){var _0x321a49={};_0x321a49[_0x170234]={'$like':'%'+_0x891087['query'][_0xc5c4('0x37')]+'%'};return _0x321a49;})});}_0x215d1d=_[_0xc5c4('0x38')]({},_0x215d1d,_0x891087[_0xc5c4('0x3b')]);return _0x565180[_0xc5c4('0x47')](_0x215d1d);}})[_0xc5c4('0x22')](function(_0x57440d){if(_0x57440d){_0x12005b=_0x57440d[_0xc5c4('0x31')];if(!_0x891087[_0xc5c4('0x2d')][_0xc5c4('0x32')]('nolimit')){_0x215d1d[_0xc5c4('0x1b')]=qs[_0xc5c4('0x1b')](_0x891087['query'][_0xc5c4('0x1b')]);_0x215d1d[_0xc5c4('0x1a')]=qs['offset'](_0x891087['query'][_0xc5c4('0x1a')]);}return _0x565180['getConfigurations'](_0x215d1d);}})['then'](function(_0x307aff){if(_0x307aff){return _0x307aff?{'count':_0x12005b,'rows':_0x307aff}:null;}})[_0xc5c4('0x22')](respondWithResult(_0x3cd80f,null))[_0xc5c4('0x3e')](handleError(_0x3cd80f,null));};exports[_0xc5c4('0x49')]=function(_0x4eb0ca,_0xfd765b,_0x352541){if(_0x4eb0ca['body']['id']){delete _0x4eb0ca[_0xc5c4('0x46')]['id'];}return db[_0xc5c4('0x29')][_0xc5c4('0x4a')]({'where':{'id':_0x4eb0ca[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0xfd765b,null))['then'](function(_0x1d425e){if(_0x1d425e){_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x4b')]=_0x1d425e['id'];_0x4eb0ca[_0xc5c4('0x46')]['Subjects']=integrations[_0xc5c4('0x4c')](_0x4eb0ca[_0xc5c4('0x46')]['channel'],_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x2a')]);_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x4d')]=integrations[_0xc5c4('0x4e')](_0x4eb0ca[_0xc5c4('0x46')]['channel'],_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x2a')]);return db['ZohoConfiguration'][_0xc5c4('0x45')](_0x4eb0ca[_0xc5c4('0x46')],{'include':[{'model':db[_0xc5c4('0x4f')],'as':_0xc5c4('0x50')},{'model':db[_0xc5c4('0x4f')],'as':'Descriptions'}]});}return null;})[_0xc5c4('0x22')](respondWithResult(_0xfd765b,null))[_0xc5c4('0x3e')](handleError(_0xfd765b,null));};function getAccessToken(_0x18be03){return new Promise(function(_0x292b1a,_0x568c83){var _0x5082c0;switch(_0x18be03[_0xc5c4('0x51')]){case'US':_0x5082c0=_0xc5c4('0x52');break;case'AU':_0x5082c0=_0xc5c4('0x53');break;case'EU':_0x5082c0=_0xc5c4('0x54');break;case'IN':_0x5082c0='https://accounts.zoho.in';break;case'CN':_0x5082c0=_0xc5c4('0x55');break;default:_0x5082c0='https://accounts.zoho.eu';break;}var _0x56cc96={'method':'POST','uri':_0x5082c0+_0xc5c4('0x56'),'qs':{'refresh_token':_0x18be03[_0xc5c4('0x57')],'client_id':_0x18be03['clientId'],'client_secret':_0x18be03[_0xc5c4('0x58')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x56cc96)['then'](function(_0x71ae5f){if(_0x71ae5f[_0xc5c4('0x59')]){_0x292b1a(_0x71ae5f['access_token']);}else{_0x568c83(_0xc5c4('0x5a'));}})[_0xc5c4('0x3e')](function(_0x1a1319){_0x568c83(_0x1a1319);});});}exports[_0xc5c4('0x5b')]=function(_0x5ccb54,_0x28ccdc,_0x2d0c4b){var _0x5c51ad,_0x31eda5,_0xce511c,_0x5483b1,_0x52b4a9;return db['ZohoAccount']['findOne']({'where':{'id':_0x5ccb54[_0xc5c4('0x40')]['id']},'attributes':['id',_0xc5c4('0x5c'),'zone',_0xc5c4('0x5d'),_0xc5c4('0x58'),'serverUrl',_0xc5c4('0x5e'),'refreshToken']})[_0xc5c4('0x22')](handleEntityNotFound(_0x28ccdc,null))[_0xc5c4('0x22')](function(_0x150eb0){_0x52b4a9=_0x150eb0;_0x5c51ad=_0x52b4a9[_0xc5c4('0x5c')];_0x31eda5=_0x5c51ad===_0xc5c4('0x5f')?'eu':'com';_0xce511c=_0x52b4a9['serverUrl'];var _0x1d011b=_0xce511c[_0xc5c4('0x60')](-0x1);if(_0x1d011b==='/'||_0x1d011b==='\x5c'||_0x1d011b===':'){_0xce511c=_0xce511c[_0xc5c4('0x61')](0x0,_0xce511c[_0xc5c4('0x62')](_0x1d011b));}if(!_0x52b4a9[_0xc5c4('0x57')]){throw new Error(_0xc5c4('0x63'));}return getAccessToken(_0x52b4a9);})[_0xc5c4('0x22')](function(_0x52ec9c){if(_0x52ec9c){return rp({'method':'GET','uri':util[_0xc5c4('0x64')](_0xc5c4('0x65'),_0x31eda5),'qs':{'module':_0xc5c4('0x66')},'headers':{'Authorization':_0xc5c4('0x67')+_0x52ec9c},'json':!![]});}})[_0xc5c4('0x22')](function(_0x257418){if(_0x257418){if(_0x257418[_0xc5c4('0x68')]&&_0x257418[_0xc5c4('0x68')][_0xc5c4('0x24')]){throw new Error(_0x257418[_0xc5c4('0x68')][_0xc5c4('0x24')][_0xc5c4('0x69')]);}var _0x13293b=[];var _0x448c5b=[];var _0x5ec318=['Owner',_0xc5c4('0x6a'),_0xc5c4('0x6b'),_0xc5c4('0x6c'),_0xc5c4('0x6d'),_0xc5c4('0x6e'),_0xc5c4('0x6f'),_0xc5c4('0x70')];_0x448c5b=_[_0xc5c4('0x71')](_0x257418[_0xc5c4('0x30')],function(_0x30027f){return _0x5ec318[_0xc5c4('0x72')](_0x30027f[_0xc5c4('0x73')]);});for(var _0x3367ba=0x0;_0x3367ba<_0x448c5b[_0xc5c4('0x31')];_0x3367ba++){if(_0x448c5b[_0x3367ba]['system_mandatory']===![]){_0x13293b[_0xc5c4('0x74')]({'id':_0x448c5b[_0x3367ba]['id'],'name':_0x448c5b[_0x3367ba][_0xc5c4('0x75')],'custom':_0x448c5b[_0x3367ba][_0xc5c4('0x76')],'options':_0x448c5b[_0x3367ba]['data_type']===_0xc5c4('0x77')&&_0x448c5b[_0x3367ba][_0xc5c4('0x78')][_0xc5c4('0x31')]>-0x1?_[_0xc5c4('0x28')](_0x448c5b[_0x3367ba][_0xc5c4('0x78')],function(_0x5c4afb){return{'name':_0x5c4afb,'value':_0x5c4afb};}):[]});}}return{'count':_0x13293b[_0xc5c4('0x31')],'rows':_0x13293b};}else{return{'count':0x0,'rows':[]};}})[_0xc5c4('0x22')](respondWithResult(_0x28ccdc,null))[_0xc5c4('0x3e')](function(_0x4c0a53){var _0x1407c6=_0x5ccb54[_0xc5c4('0x2d')][_0xc5c4('0x79')]?0x1f4:_0x4c0a53[_0xc5c4('0x7a')]||0x1f4;logger[_0xc5c4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xc5c4('0x5b'),_0x1407c6,JSON['stringify'](_0x4c0a53));delete _0x4c0a53[_0xc5c4('0x2c')];if(_0x1407c6===0x191){_0x1407c6=0x190;}_0x28ccdc['status'](_0x1407c6)[_0xc5c4('0x26')](_0x5ccb54[_0xc5c4('0x2d')][_0xc5c4('0x79')]?{'message':_0xc5c4('0x7b'),'statusCode':_0x4c0a53[_0xc5c4('0x7a')]}:_0x4c0a53);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7663c98..71a76ec 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 _0x582c=['define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.au','POST','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x582c,0x154));var _0xc582=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0x582c[_0x1ebd10];return _0x1004d3;};'use strict';var _=require(_0xc582('0x0'));var util=require(_0xc582('0x1'));var logger=require(_0xc582('0x2'))(_0xc582('0x3'));var moment=require('moment');var BPromise=require(_0xc582('0x4'));var rp=require(_0xc582('0x5'));var fs=require('fs');var path=require(_0xc582('0x6'));var rimraf=require(_0xc582('0x7'));var config=require(_0xc582('0x8'));var attributes=require(_0xc582('0x9'));var integrations=require(_0xc582('0xa'));module[_0xc582('0xb')]=function(_0x1777e1,_0x4787f7){return _0x1777e1[_0xc582('0xc')](_0xc582('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49c571,_0x40a0e7,_0x5369c8){if(_0x49c571[_0xc582('0xe')](_0xc582('0xf'))||_0x49c571[_0xc582('0xe')](_0xc582('0x10'))||_0x49c571[_0xc582('0xe')](_0xc582('0x11'))||_0x49c571['changed'](_0xc582('0x12'))||_0x49c571[_0xc582('0xe')](_0xc582('0x13'))||_0x49c571[_0xc582('0xe')](_0xc582('0x14'))){var _0x42b67a,_0x1475cd;_0x42b67a=_0x49c571[_0xc582('0x10')];var _0x4010d2=_0x42b67a[_0xc582('0x15')](-0x1);if(_0x4010d2==='/'||_0x4010d2==='\x5c'||_0x4010d2===':'){_0x42b67a=_0x42b67a['substring'](0x0,_0x42b67a[_0xc582('0x16')](_0x4010d2));}switch(_0x49c571[_0xc582('0xf')]){case'US':_0x1475cd=_0xc582('0x17');break;case'AU':_0x1475cd='https://accounts.zoho.com.au';break;case'IN':_0x1475cd=_0xc582('0x18');break;case'CN':_0x1475cd=_0xc582('0x19');break;default:_0x1475cd=_0xc582('0x1a');break;}var _0x33979e={'method':'POST','uri':_0x1475cd+_0xc582('0x1b'),'form':{'grant_type':_0xc582('0x1c'),'client_id':_0x49c571[_0xc582('0x11')],'client_secret':_0x49c571[_0xc582('0x12')],'redirect_uri':_0x49c571['serverUrl'],'code':_0x49c571['code']},'headers':{'Content-Type':_0xc582('0x1d')}};return rp(_0x33979e)[_0xc582('0x1e')](function(_0x23e71e){var _0x105ead=JSON[_0xc582('0x1f')](_0x23e71e);if(_0x105ead['refresh_token']){_0x49c571[_0xc582('0x20')]=_0x105ead[_0xc582('0x21')];logger[_0xc582('0x22')](util['format'](_0xc582('0x23'),_0x49c571[_0xc582('0x24')],_0x49c571['id']));}else{logger[_0xc582('0x25')](util[_0xc582('0x26')](_0xc582('0x27'),_0x49c571[_0xc582('0x24')],_0x49c571['id']),util[_0xc582('0x28')](_0x105ead,{'showHidden':![],'depth':null}));}return _0x5369c8(null,_0x40a0e7);})[_0xc582('0x29')](function(_0x368aa9){logger[_0xc582('0x25')](util['format'](_0xc582('0x27'),_0x49c571[_0xc582('0x24')],_0x49c571['id']),util[_0xc582('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x5369c8(_0x368aa9);});}else{return _0x5369c8(null,_0x40a0e7);}},'beforeUpdate':function(_0x1220ce,_0x256f0f,_0x25fb5d){if(_0x1220ce[_0xc582('0xe')](_0xc582('0xf'))||_0x1220ce[_0xc582('0xe')](_0xc582('0x10'))||_0x1220ce[_0xc582('0xe')]('clientId')||_0x1220ce['changed'](_0xc582('0x12'))||_0x1220ce[_0xc582('0xe')](_0xc582('0x13'))||_0x1220ce[_0xc582('0xe')](_0xc582('0x14'))){var _0xcfba57,_0x5060a1;_0xcfba57=_0x1220ce[_0xc582('0x10')];var _0x6e3989=_0xcfba57[_0xc582('0x15')](-0x1);if(_0x6e3989==='/'||_0x6e3989==='\x5c'||_0x6e3989===':'){_0xcfba57=_0xcfba57['substring'](0x0,_0xcfba57[_0xc582('0x16')](_0x6e3989));}switch(_0x1220ce[_0xc582('0xf')]){case'US':_0x5060a1=_0xc582('0x17');break;case'AU':_0x5060a1=_0xc582('0x2a');break;case'IN':_0x5060a1=_0xc582('0x18');break;case'CN':_0x5060a1=_0xc582('0x19');break;default:_0x5060a1=_0xc582('0x1a');break;}var _0x5e024e={'method':_0xc582('0x2b'),'uri':_0x5060a1+_0xc582('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x1220ce['clientId'],'client_secret':_0x1220ce[_0xc582('0x12')],'redirect_uri':_0x1220ce[_0xc582('0x10')],'code':_0x1220ce[_0xc582('0x13')]},'headers':{'Content-Type':_0xc582('0x1d')}};return rp(_0x5e024e)['then'](function(_0xaae3cc){var _0x1f3a32=JSON[_0xc582('0x1f')](_0xaae3cc);if(_0x1f3a32['refresh_token']){_0x1220ce['refreshToken']=_0x1f3a32[_0xc582('0x21')];logger[_0xc582('0x22')](util[_0xc582('0x26')](_0xc582('0x23'),_0x1220ce[_0xc582('0x24')],_0x1220ce['id']));}else{logger[_0xc582('0x25')](util[_0xc582('0x26')](_0xc582('0x27'),_0x1220ce[_0xc582('0x24')],_0x1220ce['id']),util['inspect'](_0x1f3a32,{'showHidden':![],'depth':null}));}return _0x25fb5d(null,_0x256f0f);})[_0xc582('0x29')](function(_0x3403db){logger['error'](util['format'](_0xc582('0x27'),_0x1220ce['name'],_0x1220ce['id']),util[_0xc582('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x25fb5d(_0x3403db);});}else{return _0x25fb5d(null,_0x256f0f);}}}});}; \ No newline at end of file +var _0xec98=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','zone','substring','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','moment','path','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice'];(function(_0x320e94,_0x4140b1){var _0x1002be=function(_0x3244e2){while(--_0x3244e2){_0x320e94['push'](_0x320e94['shift']());}};_0x1002be(++_0x4140b1);}(_0xec98,0x11b));var _0x8ec9=function(_0x149c17,_0x1be90f){_0x149c17=_0x149c17-0x0;var _0x38ff55=_0xec98[_0x149c17];return _0x38ff55;};'use strict';var _=require(_0x8ec9('0x0'));var util=require(_0x8ec9('0x1'));var logger=require(_0x8ec9('0x2'))(_0x8ec9('0x3'));var moment=require(_0x8ec9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ec9('0x5'));var rimraf=require('rimraf');var config=require(_0x8ec9('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8ec9('0x7'));module[_0x8ec9('0x8')]=function(_0x4ebf84,_0x46ccb9){return _0x4ebf84[_0x8ec9('0x9')](_0x8ec9('0xa'),attributes,{'tableName':_0x8ec9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x315afe,_0x2dd136,_0x212b36){if(_0x315afe[_0x8ec9('0xc')]('zone')||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0xd'))||_0x315afe['changed'](_0x8ec9('0xe'))||_0x315afe[_0x8ec9('0xc')]('clientSecret')||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0xf'))||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0x10'))){var _0x38900a,_0x4f76b6;_0x38900a=_0x315afe[_0x8ec9('0xd')];var _0x1927bf=_0x38900a[_0x8ec9('0x11')](-0x1);if(_0x1927bf==='/'||_0x1927bf==='\x5c'||_0x1927bf===':'){_0x38900a=_0x38900a['substring'](0x0,_0x38900a[_0x8ec9('0x12')](_0x1927bf));}switch(_0x315afe['zone']){case'US':_0x4f76b6=_0x8ec9('0x13');break;case'AU':_0x4f76b6=_0x8ec9('0x14');break;case'IN':_0x4f76b6=_0x8ec9('0x15');break;case'CN':_0x4f76b6='https://accounts.zoho.com.cn';break;default:_0x4f76b6=_0x8ec9('0x16');break;}var _0x2e5472={'method':_0x8ec9('0x17'),'uri':_0x4f76b6+_0x8ec9('0x18'),'form':{'grant_type':_0x8ec9('0x19'),'client_id':_0x315afe[_0x8ec9('0xe')],'client_secret':_0x315afe[_0x8ec9('0x1a')],'redirect_uri':_0x315afe[_0x8ec9('0xd')],'code':_0x315afe[_0x8ec9('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2e5472)[_0x8ec9('0x1b')](function(_0xa03ba1){var _0x29ee75=JSON[_0x8ec9('0x1c')](_0xa03ba1);if(_0x29ee75['refresh_token']){_0x315afe[_0x8ec9('0x1d')]=_0x29ee75[_0x8ec9('0x1e')];logger[_0x8ec9('0x1f')](util[_0x8ec9('0x20')](_0x8ec9('0x21'),_0x315afe[_0x8ec9('0x22')],_0x315afe['id']));}else{logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x315afe[_0x8ec9('0x22')],_0x315afe['id']),util[_0x8ec9('0x24')](_0x29ee75,{'showHidden':![],'depth':null}));}return _0x212b36(null,_0x2dd136);})[_0x8ec9('0x25')](function(_0x258aea){logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')](_0x8ec9('0x26'),_0x315afe['name'],_0x315afe['id']),util[_0x8ec9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x212b36(_0x258aea);});}else{return _0x212b36(null,_0x2dd136);}},'beforeUpdate':function(_0x1f1b22,_0x3910f7,_0x5b735a){if(_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0x27'))||_0x1f1b22['changed'](_0x8ec9('0xd'))||_0x1f1b22['changed'](_0x8ec9('0xe'))||_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0x1a'))||_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0xf'))||_0x1f1b22[_0x8ec9('0xc')]('host')){var _0x2ae1b5,_0x5f41f9;_0x2ae1b5=_0x1f1b22['serverUrl'];var _0x40da85=_0x2ae1b5['slice'](-0x1);if(_0x40da85==='/'||_0x40da85==='\x5c'||_0x40da85===':'){_0x2ae1b5=_0x2ae1b5[_0x8ec9('0x28')](0x0,_0x2ae1b5[_0x8ec9('0x12')](_0x40da85));}switch(_0x1f1b22['zone']){case'US':_0x5f41f9=_0x8ec9('0x13');break;case'AU':_0x5f41f9=_0x8ec9('0x14');break;case'IN':_0x5f41f9=_0x8ec9('0x15');break;case'CN':_0x5f41f9=_0x8ec9('0x29');break;default:_0x5f41f9='https://accounts.zoho.eu';break;}var _0xa2903c={'method':_0x8ec9('0x17'),'uri':_0x5f41f9+_0x8ec9('0x18'),'form':{'grant_type':_0x8ec9('0x19'),'client_id':_0x1f1b22[_0x8ec9('0xe')],'client_secret':_0x1f1b22[_0x8ec9('0x1a')],'redirect_uri':_0x1f1b22[_0x8ec9('0xd')],'code':_0x1f1b22[_0x8ec9('0xf')]},'headers':{'Content-Type':_0x8ec9('0x2a')}};return rp(_0xa2903c)['then'](function(_0x1e3a05){var _0x2534db=JSON['parse'](_0x1e3a05);if(_0x2534db[_0x8ec9('0x1e')]){_0x1f1b22[_0x8ec9('0x1d')]=_0x2534db[_0x8ec9('0x1e')];logger['info'](util[_0x8ec9('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']),util['inspect'](_0x2534db,{'showHidden':![],'depth':null}));}return _0x5b735a(null,_0x3910f7);})[_0x8ec9('0x25')](function(_0x2a5346){logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')](_0x8ec9('0x26'),_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']),util[_0x8ec9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b735a(_0x2a5346);});}else{return _0x5b735a(null,_0x3910f7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 13d26c6..a0cb64f 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 _0x6b1b=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowZohoAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57671f,_0x4da2b2){var _0x1f80c4=function(_0x168cd0){while(--_0x168cd0){_0x57671f['push'](_0x57671f['shift']());}};_0x1f80c4(++_0x4da2b2);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x6b1b[_0x3c4737];return _0x2bb926;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});}exports[_0xb6b1('0x14')]=function(_0x51fb33){var _0x47a204=this;return new Promise(function(_0x581e28,_0x1bdf63){return db[_0xb6b1('0x15')][_0xb6b1('0x16')]({'raw':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x51fb33['options']?_0x51fb33['options'][_0xb6b1('0x19')]||null:null,'attributes':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['attributes']||null:null,'limit':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33['options']['limit']||null:null,'include':_0x51fb33[_0xb6b1('0x17')]?_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x51fb33[_0xb6b1('0x17')][_0xb6b1('0x1a')],function(_0x1eb1b2){return{'model':db[_0x1eb1b2[_0xb6b1('0x1c')]],'as':_0x1eb1b2['as'],'attributes':_0x1eb1b2[_0xb6b1('0x1d')],'include':_0x1eb1b2[_0xb6b1('0x1a')]?_['map'](_0x1eb1b2[_0xb6b1('0x1a')],function(_0x4f1e2e){return{'model':db[_0x4f1e2e[_0xb6b1('0x1c')]],'as':_0x4f1e2e['as'],'attributes':_0x4f1e2e['attributes'],'include':_0x4f1e2e[_0xb6b1('0x1a')]?_['map'](_0x4f1e2e[_0xb6b1('0x1a')],function(_0x387603){return{'model':db[_0x387603[_0xb6b1('0x1c')]],'as':_0x387603['as'],'attributes':_0x387603[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0x188627){logger[_0xb6b1('0xd')](_0xb6b1('0x14'),_0x51fb33);logger[_0xb6b1('0x1e')]('GetZohoAccount',_0x51fb33,JSON[_0xb6b1('0xf')](_0x188627));_0x581e28(_0x188627);})['catch'](function(_0x427efb){logger[_0xb6b1('0x10')](_0xb6b1('0x14'),_0x427efb[_0xb6b1('0x12')],_0x51fb33);_0x1bdf63(_0x47a204[_0xb6b1('0x10')](0x1f4,_0x427efb[_0xb6b1('0x12')]));});});};exports[_0xb6b1('0x1f')]=function(_0x59094f){var _0x427797=this;return new Promise(function(_0x2ccd37,_0x1791a2){return db['ZohoAccount'][_0xb6b1('0x20')]({'raw':_0x59094f[_0xb6b1('0x17')]?_0x59094f['options'][_0xb6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')][_0xb6b1('0x19')]||null:null,'attributes':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['attributes']||null:null,'include':_0x59094f[_0xb6b1('0x17')]?_0x59094f[_0xb6b1('0x17')]['include']?_[_0xb6b1('0x1b')](_0x59094f['options'][_0xb6b1('0x1a')],function(_0x242ec3){return{'model':db[_0x242ec3[_0xb6b1('0x1c')]],'as':_0x242ec3['as'],'attributes':_0x242ec3[_0xb6b1('0x1d')],'include':_0x242ec3[_0xb6b1('0x1a')]?_[_0xb6b1('0x1b')](_0x242ec3['include'],function(_0x203d8e){return{'model':db[_0x203d8e[_0xb6b1('0x1c')]],'as':_0x203d8e['as'],'attributes':_0x203d8e[_0xb6b1('0x1d')],'include':_0x203d8e[_0xb6b1('0x1a')]?_['map'](_0x203d8e['include'],function(_0x4b9125){return{'model':db[_0x4b9125[_0xb6b1('0x1c')]],'as':_0x4b9125['as'],'attributes':_0x4b9125[_0xb6b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb6b1('0xc')](function(_0xe9cc){logger[_0xb6b1('0xd')](_0xb6b1('0x1f'),_0x59094f);logger[_0xb6b1('0x1e')](_0xb6b1('0x1f'),_0x59094f,JSON[_0xb6b1('0xf')](_0xe9cc));_0x2ccd37(_0xe9cc);})[_0xb6b1('0x13')](function(_0x9abbe1){logger[_0xb6b1('0x10')]('ShowZohoAccount',_0x9abbe1[_0xb6b1('0x12')],_0x59094f);_0x1791a2(_0x427797[_0xb6b1('0x10')](0x1f4,_0x9abbe1[_0xb6b1('0x12')]));});});}; \ No newline at end of file +var _0x4849=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZohoAccount','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4849,0xf8));var _0x9484=function(_0x50760b,_0x11a4e1){_0x50760b=_0x50760b-0x0;var _0x18b3ce=_0x4849[_0x50760b];return _0x18b3ce;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});}exports[_0x9484('0x19')]=function(_0xa279e2){var _0x26ec8b=this;return new Promise(function(_0x232694,_0x4b900f){return db[_0x9484('0x1a')][_0x9484('0x1b')]({'raw':_0xa279e2['options']?_0xa279e2[_0x9484('0x1c')][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0xa279e2['options']?_0xa279e2[_0x9484('0x1c')]['where']||null:null,'attributes':_0xa279e2[_0x9484('0x1c')]?_0xa279e2['options'][_0x9484('0x1e')]||null:null,'limit':_0xa279e2[_0x9484('0x1c')]?_0xa279e2[_0x9484('0x1c')][_0x9484('0x1f')]||null:null,'include':_0xa279e2['options']?_0xa279e2['options'][_0x9484('0x20')]?_['map'](_0xa279e2[_0x9484('0x1c')]['include'],function(_0x1ca809){return{'model':db[_0x1ca809[_0x9484('0x21')]],'as':_0x1ca809['as'],'attributes':_0x1ca809[_0x9484('0x1e')],'include':_0x1ca809['include']?_[_0x9484('0x22')](_0x1ca809[_0x9484('0x20')],function(_0x2e158e){return{'model':db[_0x2e158e['model']],'as':_0x2e158e['as'],'attributes':_0x2e158e['attributes'],'include':_0x2e158e['include']?_[_0x9484('0x22')](_0x2e158e[_0x9484('0x20')],function(_0x4f76f5){return{'model':db[_0x4f76f5[_0x9484('0x21')]],'as':_0x4f76f5['as'],'attributes':_0x4f76f5[_0x9484('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xd')](function(_0x5ecf12){logger[_0x9484('0xe')]('GetZohoAccount',_0xa279e2);logger[_0x9484('0x11')](_0x9484('0x19'),_0xa279e2,JSON[_0x9484('0x13')](_0x5ecf12));_0x232694(_0x5ecf12);})[_0x9484('0x18')](function(_0x48c6e1){logger['error'](_0x9484('0x19'),_0x48c6e1[_0x9484('0x16')],_0xa279e2);_0x4b900f(_0x26ec8b['error'](0x1f4,_0x48c6e1[_0x9484('0x16')]));});});};exports[_0x9484('0x23')]=function(_0x2d3e4c){var _0x19a849=this;return new Promise(function(_0x20a080,_0x4b6a24){return db[_0x9484('0x1a')][_0x9484('0x24')]({'raw':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x25')]||null:null,'attributes':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c['options'][_0x9484('0x1e')]||null:null,'include':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x20')]?_[_0x9484('0x22')](_0x2d3e4c['options'][_0x9484('0x20')],function(_0x33b765){return{'model':db[_0x33b765['model']],'as':_0x33b765['as'],'attributes':_0x33b765[_0x9484('0x1e')],'include':_0x33b765['include']?_[_0x9484('0x22')](_0x33b765[_0x9484('0x20')],function(_0x2f8195){return{'model':db[_0x2f8195['model']],'as':_0x2f8195['as'],'attributes':_0x2f8195[_0x9484('0x1e')],'include':_0x2f8195[_0x9484('0x20')]?_['map'](_0x2f8195[_0x9484('0x20')],function(_0x5392ee){return{'model':db[_0x5392ee[_0x9484('0x21')]],'as':_0x5392ee['as'],'attributes':_0x5392ee[_0x9484('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xd')](function(_0x299321){logger[_0x9484('0xe')]('ShowZohoAccount',_0x2d3e4c);logger['debug'](_0x9484('0x23'),_0x2d3e4c,JSON[_0x9484('0x13')](_0x299321));_0x20a080(_0x299321);})['catch'](function(_0xb0b77e){logger['error'](_0x9484('0x23'),_0xb0b77e['message'],_0x2d3e4c);_0x4b6a24(_0x19a849[_0x9484('0x14')](0x1f4,_0xb0b77e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 71bc738..4a6d90a 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 _0xbe63=['./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xbe63,0x99));var _0x3be6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbe63[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require(_0x3be6('0x0'));var path=require(_0x3be6('0x1'));var timeout=require(_0x3be6('0x2'));var express=require(_0x3be6('0x3'));var router=express[_0x3be6('0x4')]();var fs_extra=require(_0x3be6('0x5'));var auth=require(_0x3be6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3be6('0x7'));var controller=require(_0x3be6('0x8'));router[_0x3be6('0x9')]('/',auth[_0x3be6('0xa')](),controller[_0x3be6('0xb')]);router['get'](_0x3be6('0xc'),auth['isAuthenticated'](),controller[_0x3be6('0xd')]);router[_0x3be6('0x9')](_0x3be6('0xe'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x3be6('0xf'),auth[_0x3be6('0xa')](),controller[_0x3be6('0x10')]);router[_0x3be6('0x9')](_0x3be6('0x11'),auth[_0x3be6('0xa')](),controller[_0x3be6('0x12')]);router[_0x3be6('0x13')]('/',auth[_0x3be6('0xa')](),controller['create']);router[_0x3be6('0x14')](_0x3be6('0xc'),auth[_0x3be6('0xa')](),controller[_0x3be6('0x15')]);router['delete'](_0x3be6('0xc'),auth[_0x3be6('0xa')](),controller[_0x3be6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3dfe=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x7450d2,_0x46afc8){var _0x5987aa=function(_0x5cd719){while(--_0x5cd719){_0x7450d2['push'](_0x7450d2['shift']());}};_0x5987aa(++_0x46afc8);}(_0x3dfe,0x1aa));var _0xe3df=function(_0x56c78b,_0x37063f){_0x56c78b=_0x56c78b-0x0;var _0xb63210=_0x3dfe[_0x56c78b];return _0xb63210;};'use strict';var multer=require('multer');var util=require(_0xe3df('0x0'));var path=require(_0xe3df('0x1'));var timeout=require(_0xe3df('0x2'));var express=require(_0xe3df('0x3'));var router=express[_0xe3df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe3df('0x5'));var interaction=require(_0xe3df('0x6'));var config=require(_0xe3df('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xe3df('0x8')]('/',auth[_0xe3df('0x9')](),controller[_0xe3df('0xa')]);router[_0xe3df('0x8')](_0xe3df('0xb'),auth[_0xe3df('0x9')](),controller['show']);router[_0xe3df('0x8')](_0xe3df('0xc'),auth[_0xe3df('0x9')](),controller[_0xe3df('0xd')]);router[_0xe3df('0x8')]('/:id/subjects',auth[_0xe3df('0x9')](),controller[_0xe3df('0xe')]);router[_0xe3df('0x8')](_0xe3df('0xf'),auth[_0xe3df('0x9')](),controller[_0xe3df('0x10')]);router[_0xe3df('0x11')]('/',auth[_0xe3df('0x9')](),controller[_0xe3df('0x12')]);router[_0xe3df('0x13')](_0xe3df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe3df('0x14')](_0xe3df('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe3df('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 301ceb7..6132587 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 _0x875a=['contact','nothing','lead','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x4d7a8b,_0x3afdcd){var _0x9b5113=function(_0x1a529f){while(--_0x1a529f){_0x4d7a8b['push'](_0x4d7a8b['shift']());}};_0x9b5113(++_0x3afdcd);}(_0x875a,0x184));var _0xa875=function(_0x4c6ace,_0x2ca0ba){_0x4c6ace=_0x4c6ace-0x0;var _0x19fe6a=_0x875a[_0x4c6ace];return _0x19fe6a;};'use strict';var Sequelize=require(_0xa875('0x0'));module[_0xa875('0x1')]={'name':{'type':Sequelize[_0xa875('0x2')]},'moduleCreate':{'type':Sequelize[_0xa875('0x3')]('lead',_0xa875('0x4'),_0xa875('0x5')),'defaultValue':_0xa875('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0xa875('0x7'),_0xa875('0x4'),_0xa875('0x6')),'defaultValue':_0xa875('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa562=['exports','STRING','ENUM','nothing','lead','contact','contact_lead','sequelize'];(function(_0x4ca50f,_0x351493){var _0x45182e=function(_0x1a97b7){while(--_0x1a97b7){_0x4ca50f['push'](_0x4ca50f['shift']());}};_0x45182e(++_0x351493);}(_0xa562,0xef));var _0x2a56=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa562[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x2a56('0x0'));module[_0x2a56('0x1')]={'name':{'type':Sequelize[_0x2a56('0x2')]},'moduleCreate':{'type':Sequelize[_0x2a56('0x3')]('lead','contact',_0x2a56('0x4')),'defaultValue':_0x2a56('0x5')},'moduleSearch':{'type':Sequelize[_0x2a56('0x3')]('contact_lead',_0x2a56('0x6'),_0x2a56('0x5')),'defaultValue':_0x2a56('0x7')},'description':{'type':Sequelize[_0x2a56('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 39c8e49..9ef44d3 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 _0xbfe6=['nolimit','sort','where','pick','type','filter','options','include','findAll','rows','catch','show','params','keys','length','merge','find','body','findOne','ZohoField','order','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','ZohoConfiguration','rawAttributes','key','map','query','filters','intersection','model','attributes','fields'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xbfe6,0x1a4));var _0x6bfe=function(_0x4cf77b,_0x2b7491){_0x4cf77b=_0x4cf77b-0x0;var _0x1d1bee=_0xbfe6[_0x4cf77b];return _0x1d1bee;};'use strict';var emlformat=require(_0x6bfe('0x0'));var rimraf=require(_0x6bfe('0x1'));var zipdir=require(_0x6bfe('0x2'));var jsonpatch=require(_0x6bfe('0x3'));var rp=require(_0x6bfe('0x4'));var moment=require(_0x6bfe('0x5'));var BPromise=require(_0x6bfe('0x6'));var Mustache=require(_0x6bfe('0x7'));var util=require(_0x6bfe('0x8'));var path=require(_0x6bfe('0x9'));var sox=require('sox');var csv=require(_0x6bfe('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bfe('0xb'));var _=require(_0x6bfe('0xc'));var squel=require(_0x6bfe('0xd'));var crypto=require('crypto');var jsforce=require(_0x6bfe('0xe'));var deskjs=require(_0x6bfe('0xf'));var toCsv=require(_0x6bfe('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6bfe('0x10'));var authService=require(_0x6bfe('0x11'));var qs=require(_0x6bfe('0x12'));var as=require(_0x6bfe('0x13'));var hardwareService=require(_0x6bfe('0x14'));var logger=require(_0x6bfe('0x15'))(_0x6bfe('0x16'));var utils=require(_0x6bfe('0x17'));var config=require(_0x6bfe('0x18'));var licenseUtil=require(_0x6bfe('0x19'));var db=require(_0x6bfe('0x1a'))['db'];function respondWithStatusCode(_0x108e7a,_0x134a2a){_0x134a2a=_0x134a2a||0xcc;return function(_0x4d1310){if(_0x4d1310){return _0x108e7a['sendStatus'](_0x134a2a);}return _0x108e7a[_0x6bfe('0x1b')](_0x134a2a)[_0x6bfe('0x1c')]();};}function respondWithResult(_0x1c43a9,_0x364064){_0x364064=_0x364064||0xc8;return function(_0x29484d){if(_0x29484d){return _0x1c43a9[_0x6bfe('0x1b')](_0x364064)[_0x6bfe('0x1d')](_0x29484d);}};}function respondWithFilteredResult(_0x3faf62,_0xa2f1ec){return function(_0x21183b){if(_0x21183b){var _0x555660=typeof _0xa2f1ec[_0x6bfe('0x1e')]===_0x6bfe('0x1f')&&typeof _0xa2f1ec[_0x6bfe('0x20')]===_0x6bfe('0x1f');var _0x1f92fd=_0x21183b[_0x6bfe('0x21')];var _0x452609=_0x555660?0x0:_0xa2f1ec['offset'];var _0x346bc7=_0x555660?_0x21183b[_0x6bfe('0x21')]:_0xa2f1ec[_0x6bfe('0x1e')]+_0xa2f1ec[_0x6bfe('0x20')];var _0x5de39d;if(_0x346bc7>=_0x1f92fd){_0x346bc7=_0x1f92fd;_0x5de39d=0xc8;}else{_0x5de39d=0xce;}_0x3faf62[_0x6bfe('0x1b')](_0x5de39d);return _0x3faf62['set'](_0x6bfe('0x22'),_0x452609+'-'+_0x346bc7+'/'+_0x1f92fd)['json'](_0x21183b);}return null;};}function patchUpdates(_0x57d447){return function(_0x46a975){try{jsonpatch[_0x6bfe('0x23')](_0x46a975,_0x57d447,!![]);}catch(_0x219304){return BPromise['reject'](_0x219304);}return _0x46a975['save']();};}function saveUpdates(_0x98f4fb,_0x522e00){return function(_0x5effa0){if(_0x5effa0){return _0x5effa0[_0x6bfe('0x24')](_0x98f4fb)[_0x6bfe('0x25')](function(_0x2d776d){return _0x2d776d;});}return null;};}function removeEntity(_0x529b4d,_0x2e5cde){return function(_0x597aed){if(_0x597aed){return _0x597aed[_0x6bfe('0x26')]()[_0x6bfe('0x25')](function(){_0x529b4d[_0x6bfe('0x1b')](0xcc)[_0x6bfe('0x1c')]();});}};}function handleEntityNotFound(_0x404616,_0x2be8d3){return function(_0x2eb452){if(!_0x2eb452){_0x404616[_0x6bfe('0x27')](0x194);}return _0x2eb452;};}function handleError(_0x12637a,_0x258cae){_0x258cae=_0x258cae||0x1f4;return function(_0x3745fa){logger['error'](_0x3745fa[_0x6bfe('0x28')]);if(_0x3745fa[_0x6bfe('0x29')]){delete _0x3745fa[_0x6bfe('0x29')];}_0x12637a[_0x6bfe('0x1b')](_0x258cae)[_0x6bfe('0x2a')](_0x3745fa);};}exports[_0x6bfe('0x2b')]=function(_0x4b231d,_0x1798c1){var _0x3da340={},_0x2178e0={},_0x2876cb={'count':0x0,'rows':[]};var _0x7319fb=_['map'](db[_0x6bfe('0x2c')][_0x6bfe('0x2d')],function(_0x6b83c6){return{'name':_0x6b83c6['fieldName'],'type':_0x6b83c6['type'][_0x6bfe('0x2e')]};});_0x2178e0['model']=_[_0x6bfe('0x2f')](_0x7319fb,_0x6bfe('0x29'));_0x2178e0[_0x6bfe('0x30')]=_['keys'](_0x4b231d[_0x6bfe('0x30')]);_0x2178e0[_0x6bfe('0x31')]=_[_0x6bfe('0x32')](_0x2178e0[_0x6bfe('0x33')],_0x2178e0[_0x6bfe('0x30')]);_0x3da340[_0x6bfe('0x34')]=_[_0x6bfe('0x32')](_0x2178e0[_0x6bfe('0x33')],qs[_0x6bfe('0x35')](_0x4b231d['query'][_0x6bfe('0x35')]));_0x3da340[_0x6bfe('0x34')]=_0x3da340[_0x6bfe('0x34')]['length']?_0x3da340[_0x6bfe('0x34')]:_0x2178e0[_0x6bfe('0x33')];if(!_0x4b231d[_0x6bfe('0x30')]['hasOwnProperty'](_0x6bfe('0x36'))){_0x3da340[_0x6bfe('0x20')]=qs[_0x6bfe('0x20')](_0x4b231d[_0x6bfe('0x30')][_0x6bfe('0x20')]);_0x3da340['offset']=qs[_0x6bfe('0x1e')](_0x4b231d[_0x6bfe('0x30')][_0x6bfe('0x1e')]);}_0x3da340['order']=qs[_0x6bfe('0x37')](_0x4b231d[_0x6bfe('0x30')][_0x6bfe('0x37')]);_0x3da340[_0x6bfe('0x38')]=qs['filters'](_[_0x6bfe('0x39')](_0x4b231d['query'],_0x2178e0[_0x6bfe('0x31')]),_0x7319fb);if(_0x4b231d[_0x6bfe('0x30')]['filter']){_0x3da340[_0x6bfe('0x38')]=_['merge'](_0x3da340[_0x6bfe('0x38')],{'$or':_[_0x6bfe('0x2f')](_0x7319fb,function(_0x3ac8d0){if(_0x3ac8d0[_0x6bfe('0x3a')]!=='VIRTUAL'){var _0xd72fd8={};_0xd72fd8[_0x3ac8d0['name']]={'$like':'%'+_0x4b231d[_0x6bfe('0x30')][_0x6bfe('0x3b')]+'%'};return _0xd72fd8;}})});}_0x3da340=_['merge']({},_0x3da340,_0x4b231d[_0x6bfe('0x3c')]);var _0x4c33f1={'where':_0x3da340[_0x6bfe('0x38')]};return db[_0x6bfe('0x2c')][_0x6bfe('0x21')](_0x4c33f1)[_0x6bfe('0x25')](function(_0x20b64e){_0x2876cb[_0x6bfe('0x21')]=_0x20b64e;if(_0x4b231d['query']['includeAll']){_0x3da340[_0x6bfe('0x3d')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x6bfe('0x3e')](_0x3da340);})[_0x6bfe('0x25')](function(_0x50a3b8){_0x2876cb[_0x6bfe('0x3f')]=_0x50a3b8;return _0x2876cb;})[_0x6bfe('0x25')](respondWithFilteredResult(_0x1798c1,_0x3da340))[_0x6bfe('0x40')](handleError(_0x1798c1,null));};exports[_0x6bfe('0x41')]=function(_0x252a7f,_0x2355d8){var _0x1ba64e={'raw':![],'where':{'id':_0x252a7f[_0x6bfe('0x42')]['id']}},_0xbb9aac={};_0xbb9aac['model']=_[_0x6bfe('0x43')](db[_0x6bfe('0x2c')][_0x6bfe('0x2d')]);_0xbb9aac[_0x6bfe('0x30')]=_[_0x6bfe('0x43')](_0x252a7f[_0x6bfe('0x30')]);_0xbb9aac[_0x6bfe('0x31')]=_[_0x6bfe('0x32')](_0xbb9aac['model'],_0xbb9aac['query']);_0x1ba64e[_0x6bfe('0x34')]=_[_0x6bfe('0x32')](_0xbb9aac['model'],qs[_0x6bfe('0x35')](_0x252a7f[_0x6bfe('0x30')][_0x6bfe('0x35')]));_0x1ba64e[_0x6bfe('0x34')]=_0x1ba64e['attributes'][_0x6bfe('0x44')]?_0x1ba64e[_0x6bfe('0x34')]:_0xbb9aac[_0x6bfe('0x33')];if(_0x252a7f[_0x6bfe('0x30')]['includeAll']){_0x1ba64e[_0x6bfe('0x3d')]=[{'all':!![]}];}_0x1ba64e=_[_0x6bfe('0x45')]({},_0x1ba64e,_0x252a7f[_0x6bfe('0x3c')]);return db[_0x6bfe('0x2c')][_0x6bfe('0x46')](_0x1ba64e)[_0x6bfe('0x25')](handleEntityNotFound(_0x2355d8,null))[_0x6bfe('0x25')](respondWithResult(_0x2355d8,null))['catch'](handleError(_0x2355d8,null));};exports['create']=function(_0x54b46d,_0x9acaa7){return db['ZohoConfiguration']['create'](_0x54b46d[_0x6bfe('0x47')],{})[_0x6bfe('0x25')](respondWithResult(_0x9acaa7,0xc9))['catch'](handleError(_0x9acaa7,null));};exports['update']=function(_0x57f99a,_0x392eab){if(_0x57f99a['body']['id']){delete _0x57f99a[_0x6bfe('0x47')]['id'];}return db[_0x6bfe('0x2c')][_0x6bfe('0x46')]({'where':{'id':_0x57f99a[_0x6bfe('0x42')]['id']}})[_0x6bfe('0x25')](handleEntityNotFound(_0x392eab,null))[_0x6bfe('0x25')](saveUpdates(_0x57f99a['body'],null))[_0x6bfe('0x25')](respondWithResult(_0x392eab,null))['catch'](handleError(_0x392eab,null));};exports[_0x6bfe('0x26')]=function(_0x3b38ad,_0x3cd7d9){return db['ZohoConfiguration']['find']({'where':{'id':_0x3b38ad[_0x6bfe('0x42')]['id']}})[_0x6bfe('0x25')](handleEntityNotFound(_0x3cd7d9,null))['then'](removeEntity(_0x3cd7d9,null))[_0x6bfe('0x40')](handleError(_0x3cd7d9,null));};exports['getFields']=function(_0x63c522,_0x5d87d1,_0xf09001){var _0x2d44b1={};var _0x41d3db={};var _0xb87283;var _0x48e294;return db['ZohoConfiguration'][_0x6bfe('0x48')]({'where':{'id':_0x63c522[_0x6bfe('0x42')]['id']}})[_0x6bfe('0x25')](handleEntityNotFound(_0x5d87d1,null))['then'](function(_0x390748){if(_0x390748){_0xb87283=_0x390748;_0x41d3db[_0x6bfe('0x33')]=_['keys'](db[_0x6bfe('0x49')]['rawAttributes']);_0x41d3db[_0x6bfe('0x30')]=_['keys'](_0x63c522[_0x6bfe('0x30')]);_0x41d3db[_0x6bfe('0x31')]=_[_0x6bfe('0x32')](_0x41d3db[_0x6bfe('0x33')],_0x41d3db['query']);_0x2d44b1[_0x6bfe('0x34')]=_['intersection'](_0x41d3db[_0x6bfe('0x33')],qs[_0x6bfe('0x35')](_0x63c522['query'][_0x6bfe('0x35')]));_0x2d44b1[_0x6bfe('0x34')]=_0x2d44b1[_0x6bfe('0x34')][_0x6bfe('0x44')]?_0x2d44b1[_0x6bfe('0x34')]:_0x41d3db[_0x6bfe('0x33')];_0x2d44b1[_0x6bfe('0x4a')]=qs[_0x6bfe('0x37')](_0x63c522[_0x6bfe('0x30')]['sort']);_0x2d44b1[_0x6bfe('0x38')]=qs['filters'](_['pick'](_0x63c522['query'],_0x41d3db[_0x6bfe('0x31')]));if(_0x63c522[_0x6bfe('0x30')]['filter']){_0x2d44b1[_0x6bfe('0x38')]=_['merge'](_0x2d44b1[_0x6bfe('0x38')],{'$or':_[_0x6bfe('0x2f')](_0x2d44b1[_0x6bfe('0x34')],function(_0x42f3d4){var _0x3a3d7a={};_0x3a3d7a[_0x42f3d4]={'$like':'%'+_0x63c522['query'][_0x6bfe('0x3b')]+'%'};return _0x3a3d7a;})});}_0x2d44b1=_['merge']({},_0x2d44b1,_0x63c522[_0x6bfe('0x3c')]);return _0xb87283['getFields'](_0x2d44b1);}})['then'](function(_0x4984ee){if(_0x4984ee){_0x48e294=_0x4984ee[_0x6bfe('0x44')];if(!_0x63c522[_0x6bfe('0x30')][_0x6bfe('0x4b')](_0x6bfe('0x36'))){_0x2d44b1[_0x6bfe('0x20')]=qs[_0x6bfe('0x20')](_0x63c522['query'][_0x6bfe('0x20')]);_0x2d44b1['offset']=qs['offset'](_0x63c522[_0x6bfe('0x30')]['offset']);}return _0xb87283[_0x6bfe('0x4c')](_0x2d44b1);}})[_0x6bfe('0x25')](function(_0x34673c){if(_0x34673c){return _0x34673c?{'count':_0x48e294,'rows':_0x34673c}:null;}})[_0x6bfe('0x25')](respondWithResult(_0x5d87d1,null))[_0x6bfe('0x40')](handleError(_0x5d87d1,null));};exports[_0x6bfe('0x4d')]=function(_0x3e39ca,_0x25881e,_0x5c7d21){var _0x18dc3c={};var _0x43efb8={};var _0x44e10e;var _0x212aa7;return db['ZohoConfiguration'][_0x6bfe('0x48')]({'where':{'id':_0x3e39ca[_0x6bfe('0x42')]['id']}})[_0x6bfe('0x25')](handleEntityNotFound(_0x25881e,null))['then'](function(_0x5d9df8){if(_0x5d9df8){_0x44e10e=_0x5d9df8;_0x43efb8['model']=_[_0x6bfe('0x43')](db[_0x6bfe('0x49')][_0x6bfe('0x2d')]);_0x43efb8[_0x6bfe('0x30')]=_['keys'](_0x3e39ca[_0x6bfe('0x30')]);_0x43efb8[_0x6bfe('0x31')]=_['intersection'](_0x43efb8[_0x6bfe('0x33')],_0x43efb8[_0x6bfe('0x30')]);_0x18dc3c[_0x6bfe('0x34')]=_[_0x6bfe('0x32')](_0x43efb8['model'],qs[_0x6bfe('0x35')](_0x3e39ca[_0x6bfe('0x30')]['fields']));_0x18dc3c[_0x6bfe('0x34')]=_0x18dc3c[_0x6bfe('0x34')]['length']?_0x18dc3c[_0x6bfe('0x34')]:_0x43efb8[_0x6bfe('0x33')];_0x18dc3c[_0x6bfe('0x4a')]=qs[_0x6bfe('0x37')](_0x3e39ca['query'][_0x6bfe('0x37')]);_0x18dc3c[_0x6bfe('0x38')]=qs[_0x6bfe('0x31')](_[_0x6bfe('0x39')](_0x3e39ca[_0x6bfe('0x30')],_0x43efb8[_0x6bfe('0x31')]));if(_0x3e39ca[_0x6bfe('0x30')][_0x6bfe('0x3b')]){_0x18dc3c[_0x6bfe('0x38')]=_[_0x6bfe('0x45')](_0x18dc3c['where'],{'$or':_['map'](_0x18dc3c[_0x6bfe('0x34')],function(_0x1a249e){var _0x586e03={};_0x586e03[_0x1a249e]={'$like':'%'+_0x3e39ca[_0x6bfe('0x30')][_0x6bfe('0x3b')]+'%'};return _0x586e03;})});}_0x18dc3c=_[_0x6bfe('0x45')]({},_0x18dc3c,_0x3e39ca['options']);return _0x44e10e[_0x6bfe('0x4d')](_0x18dc3c);}})[_0x6bfe('0x25')](function(_0x369924){if(_0x369924){_0x212aa7=_0x369924[_0x6bfe('0x44')];if(!_0x3e39ca[_0x6bfe('0x30')]['hasOwnProperty'](_0x6bfe('0x36'))){_0x18dc3c[_0x6bfe('0x20')]=qs[_0x6bfe('0x20')](_0x3e39ca[_0x6bfe('0x30')][_0x6bfe('0x20')]);_0x18dc3c[_0x6bfe('0x1e')]=qs[_0x6bfe('0x1e')](_0x3e39ca[_0x6bfe('0x30')][_0x6bfe('0x1e')]);}return _0x44e10e[_0x6bfe('0x4d')](_0x18dc3c);}})[_0x6bfe('0x25')](function(_0x5b74d0){if(_0x5b74d0){return _0x5b74d0?{'count':_0x212aa7,'rows':_0x5b74d0}:null;}})['then'](respondWithResult(_0x25881e,null))[_0x6bfe('0x40')](handleError(_0x25881e,null));};exports[_0x6bfe('0x4e')]=function(_0x2b3d8a,_0x39d34a,_0x1f5ef0){var _0x3998b5={};var _0x2249e3={};var _0x41bb88;var _0xb4cba0;return db[_0x6bfe('0x2c')][_0x6bfe('0x48')]({'where':{'id':_0x2b3d8a['params']['id']}})['then'](handleEntityNotFound(_0x39d34a,null))['then'](function(_0x2eb93d){if(_0x2eb93d){_0x41bb88=_0x2eb93d;_0x2249e3[_0x6bfe('0x33')]=_['keys'](db['ZohoField']['rawAttributes']);_0x2249e3[_0x6bfe('0x30')]=_[_0x6bfe('0x43')](_0x2b3d8a[_0x6bfe('0x30')]);_0x2249e3[_0x6bfe('0x31')]=_['intersection'](_0x2249e3[_0x6bfe('0x33')],_0x2249e3[_0x6bfe('0x30')]);_0x3998b5['attributes']=_[_0x6bfe('0x32')](_0x2249e3[_0x6bfe('0x33')],qs[_0x6bfe('0x35')](_0x2b3d8a[_0x6bfe('0x30')][_0x6bfe('0x35')]));_0x3998b5[_0x6bfe('0x34')]=_0x3998b5[_0x6bfe('0x34')][_0x6bfe('0x44')]?_0x3998b5[_0x6bfe('0x34')]:_0x2249e3[_0x6bfe('0x33')];_0x3998b5[_0x6bfe('0x4a')]=qs[_0x6bfe('0x37')](_0x2b3d8a[_0x6bfe('0x30')][_0x6bfe('0x37')]);_0x3998b5[_0x6bfe('0x38')]=qs[_0x6bfe('0x31')](_[_0x6bfe('0x39')](_0x2b3d8a['query'],_0x2249e3['filters']));if(_0x2b3d8a[_0x6bfe('0x30')][_0x6bfe('0x3b')]){_0x3998b5['where']=_[_0x6bfe('0x45')](_0x3998b5[_0x6bfe('0x38')],{'$or':_[_0x6bfe('0x2f')](_0x3998b5[_0x6bfe('0x34')],function(_0x57617b){var _0x1d8ce0={};_0x1d8ce0[_0x57617b]={'$like':'%'+_0x2b3d8a[_0x6bfe('0x30')][_0x6bfe('0x3b')]+'%'};return _0x1d8ce0;})});}_0x3998b5=_[_0x6bfe('0x45')]({},_0x3998b5,_0x2b3d8a[_0x6bfe('0x3c')]);return _0x41bb88['getDescriptions'](_0x3998b5);}})[_0x6bfe('0x25')](function(_0x1a6968){if(_0x1a6968){_0xb4cba0=_0x1a6968[_0x6bfe('0x44')];if(!_0x2b3d8a[_0x6bfe('0x30')][_0x6bfe('0x4b')]('nolimit')){_0x3998b5[_0x6bfe('0x20')]=qs['limit'](_0x2b3d8a['query'][_0x6bfe('0x20')]);_0x3998b5[_0x6bfe('0x1e')]=qs[_0x6bfe('0x1e')](_0x2b3d8a[_0x6bfe('0x30')]['offset']);}return _0x41bb88[_0x6bfe('0x4e')](_0x3998b5);}})[_0x6bfe('0x25')](function(_0x44bfa9){if(_0x44bfa9){return _0x44bfa9?{'count':_0xb4cba0,'rows':_0x44bfa9}:null;}})[_0x6bfe('0x25')](respondWithResult(_0x39d34a,null))[_0x6bfe('0x40')](handleError(_0x39d34a,null));}; \ No newline at end of file +var _0xa3bd=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','getFields','findOne','getSubjects','ZohoField','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x555d2d,_0x2509b4){var _0x2697a9=function(_0x361d1e){while(--_0x361d1e){_0x555d2d['push'](_0x555d2d['shift']());}};_0x2697a9(++_0x2509b4);}(_0xa3bd,0x85));var _0xda3b=function(_0x6ce75e,_0x232e49){_0x6ce75e=_0x6ce75e-0x0;var _0x5f06db=_0xa3bd[_0x6ce75e];return _0x5f06db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda3b('0x1'));var rp=require('request-promise');var moment=require(_0xda3b('0x2'));var BPromise=require(_0xda3b('0x3'));var Mustache=require(_0xda3b('0x4'));var util=require(_0xda3b('0x5'));var path=require(_0xda3b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda3b('0x7'));var fs=require('fs');var fs_extra=require(_0xda3b('0x8'));var _=require('lodash');var squel=require(_0xda3b('0x9'));var crypto=require(_0xda3b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xda3b('0xb'));var toCsv=require(_0xda3b('0xc'));var querystring=require(_0xda3b('0xd'));var Papa=require(_0xda3b('0xe'));var Redis=require(_0xda3b('0xf'));var authService=require(_0xda3b('0x10'));var qs=require(_0xda3b('0x11'));var as=require(_0xda3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda3b('0x13'))(_0xda3b('0x14'));var utils=require(_0xda3b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xda3b('0x16'));var db=require(_0xda3b('0x17'))['db'];function respondWithStatusCode(_0x130abc,_0x5b5dc1){_0x5b5dc1=_0x5b5dc1||0xcc;return function(_0x51b348){if(_0x51b348){return _0x130abc[_0xda3b('0x18')](_0x5b5dc1);}return _0x130abc[_0xda3b('0x19')](_0x5b5dc1)[_0xda3b('0x1a')]();};}function respondWithResult(_0x17e3af,_0x20f235){_0x20f235=_0x20f235||0xc8;return function(_0x20bdd1){if(_0x20bdd1){return _0x17e3af[_0xda3b('0x19')](_0x20f235)[_0xda3b('0x1b')](_0x20bdd1);}};}function respondWithFilteredResult(_0x3a5da7,_0x25bbaf){return function(_0x1dfc83){if(_0x1dfc83){var _0x4473b0=typeof _0x25bbaf[_0xda3b('0x1c')]===_0xda3b('0x1d')&&typeof _0x25bbaf['limit']==='undefined';var _0x2d04a5=_0x1dfc83[_0xda3b('0x1e')];var _0x239b91=_0x4473b0?0x0:_0x25bbaf[_0xda3b('0x1c')];var _0x4e8b6a=_0x4473b0?_0x1dfc83[_0xda3b('0x1e')]:_0x25bbaf[_0xda3b('0x1c')]+_0x25bbaf[_0xda3b('0x1f')];var _0x458033;if(_0x4e8b6a>=_0x2d04a5){_0x4e8b6a=_0x2d04a5;_0x458033=0xc8;}else{_0x458033=0xce;}_0x3a5da7[_0xda3b('0x19')](_0x458033);return _0x3a5da7[_0xda3b('0x20')](_0xda3b('0x21'),_0x239b91+'-'+_0x4e8b6a+'/'+_0x2d04a5)[_0xda3b('0x1b')](_0x1dfc83);}return null;};}function patchUpdates(_0x2c7bd9){return function(_0x5115ce){try{jsonpatch[_0xda3b('0x22')](_0x5115ce,_0x2c7bd9,!![]);}catch(_0xdc99d1){return BPromise[_0xda3b('0x23')](_0xdc99d1);}return _0x5115ce[_0xda3b('0x24')]();};}function saveUpdates(_0x4a554f,_0x4e7f39){return function(_0x15afe5){if(_0x15afe5){return _0x15afe5[_0xda3b('0x25')](_0x4a554f)[_0xda3b('0x26')](function(_0x131d19){return _0x131d19;});}return null;};}function removeEntity(_0x4bd10e,_0x2ff35c){return function(_0x54038c){if(_0x54038c){return _0x54038c[_0xda3b('0x27')]()['then'](function(){_0x4bd10e[_0xda3b('0x19')](0xcc)[_0xda3b('0x1a')]();});}};}function handleEntityNotFound(_0x33f822,_0x2bfa38){return function(_0x4aecfc){if(!_0x4aecfc){_0x33f822[_0xda3b('0x18')](0x194);}return _0x4aecfc;};}function handleError(_0x239c38,_0x32763e){_0x32763e=_0x32763e||0x1f4;return function(_0x19e152){logger[_0xda3b('0x28')](_0x19e152[_0xda3b('0x29')]);if(_0x19e152[_0xda3b('0x2a')]){delete _0x19e152['name'];}_0x239c38['status'](_0x32763e)[_0xda3b('0x2b')](_0x19e152);};}exports[_0xda3b('0x2c')]=function(_0x5e0fae,_0x4e922f){var _0x42832e={},_0x3516ea={},_0x47727c={'count':0x0,'rows':[]};var _0x42a88f=_[_0xda3b('0x2d')](db[_0xda3b('0x2e')]['rawAttributes'],function(_0x2afcf8){return{'name':_0x2afcf8['fieldName'],'type':_0x2afcf8['type'][_0xda3b('0x2f')]};});_0x3516ea['model']=_[_0xda3b('0x2d')](_0x42a88f,_0xda3b('0x2a'));_0x3516ea['query']=_[_0xda3b('0x30')](_0x5e0fae[_0xda3b('0x31')]);_0x3516ea[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x3516ea[_0xda3b('0x34')],_0x3516ea[_0xda3b('0x31')]);_0x42832e[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x3516ea[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x36')]));_0x42832e[_0xda3b('0x35')]=_0x42832e[_0xda3b('0x35')][_0xda3b('0x37')]?_0x42832e[_0xda3b('0x35')]:_0x3516ea[_0xda3b('0x34')];if(!_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x42832e['limit']=qs[_0xda3b('0x1f')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x1f')]);_0x42832e[_0xda3b('0x1c')]=qs[_0xda3b('0x1c')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x1c')]);}_0x42832e[_0xda3b('0x3a')]=qs['sort'](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x42832e[_0xda3b('0x3c')]=qs['filters'](_[_0xda3b('0x3d')](_0x5e0fae[_0xda3b('0x31')],_0x3516ea[_0xda3b('0x32')]),_0x42a88f);if(_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3e')]){_0x42832e['where']=_[_0xda3b('0x3f')](_0x42832e[_0xda3b('0x3c')],{'$or':_['map'](_0x42a88f,function(_0x1a6f03){if(_0x1a6f03[_0xda3b('0x40')]!==_0xda3b('0x41')){var _0x37a8c6={};_0x37a8c6[_0x1a6f03['name']]={'$like':'%'+_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0x37a8c6;}})});}_0x42832e=_[_0xda3b('0x3f')]({},_0x42832e,_0x5e0fae[_0xda3b('0x42')]);var _0x1d2b08={'where':_0x42832e[_0xda3b('0x3c')]};return db[_0xda3b('0x2e')][_0xda3b('0x1e')](_0x1d2b08)[_0xda3b('0x26')](function(_0x4563f1){_0x47727c[_0xda3b('0x1e')]=_0x4563f1;if(_0x5e0fae[_0xda3b('0x31')]['includeAll']){_0x42832e[_0xda3b('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xda3b('0x44')](_0x42832e);})[_0xda3b('0x26')](function(_0x34cdc7){_0x47727c[_0xda3b('0x45')]=_0x34cdc7;return _0x47727c;})['then'](respondWithFilteredResult(_0x4e922f,_0x42832e))[_0xda3b('0x46')](handleError(_0x4e922f,null));};exports[_0xda3b('0x47')]=function(_0x407e0e,_0x272b64){var _0x386ead={'raw':![],'where':{'id':_0x407e0e[_0xda3b('0x48')]['id']}},_0x427ee0={};_0x427ee0[_0xda3b('0x34')]=_['keys'](db[_0xda3b('0x2e')][_0xda3b('0x49')]);_0x427ee0[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x407e0e[_0xda3b('0x31')]);_0x427ee0[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x427ee0[_0xda3b('0x34')],_0x427ee0[_0xda3b('0x31')]);_0x386ead[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x427ee0[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x407e0e['query'][_0xda3b('0x36')]));_0x386ead[_0xda3b('0x35')]=_0x386ead[_0xda3b('0x35')][_0xda3b('0x37')]?_0x386ead[_0xda3b('0x35')]:_0x427ee0[_0xda3b('0x34')];if(_0x407e0e[_0xda3b('0x31')][_0xda3b('0x4a')]){_0x386ead['include']=[{'all':!![]}];}_0x386ead=_[_0xda3b('0x3f')]({},_0x386ead,_0x407e0e['options']);return db[_0xda3b('0x2e')][_0xda3b('0x4b')](_0x386ead)[_0xda3b('0x26')](handleEntityNotFound(_0x272b64,null))[_0xda3b('0x26')](respondWithResult(_0x272b64,null))[_0xda3b('0x46')](handleError(_0x272b64,null));};exports['create']=function(_0x33c290,_0x5decbb){return db[_0xda3b('0x2e')]['create'](_0x33c290[_0xda3b('0x4c')],{})['then'](respondWithResult(_0x5decbb,0xc9))[_0xda3b('0x46')](handleError(_0x5decbb,null));};exports[_0xda3b('0x25')]=function(_0x3c2fb2,_0xc33f){if(_0x3c2fb2[_0xda3b('0x4c')]['id']){delete _0x3c2fb2[_0xda3b('0x4c')]['id'];}return db['ZohoConfiguration'][_0xda3b('0x4b')]({'where':{'id':_0x3c2fb2[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0xc33f,null))[_0xda3b('0x26')](saveUpdates(_0x3c2fb2[_0xda3b('0x4c')],null))[_0xda3b('0x26')](respondWithResult(_0xc33f,null))[_0xda3b('0x46')](handleError(_0xc33f,null));};exports[_0xda3b('0x27')]=function(_0x3eca1,_0x350811){return db[_0xda3b('0x2e')][_0xda3b('0x4b')]({'where':{'id':_0x3eca1[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x350811,null))[_0xda3b('0x26')](removeEntity(_0x350811,null))['catch'](handleError(_0x350811,null));};exports[_0xda3b('0x4d')]=function(_0x4bcaec,_0x280052,_0x2dad23){var _0x8ea05e={};var _0x59ede3={};var _0x3da91c;var _0x1f589f;return db[_0xda3b('0x2e')][_0xda3b('0x4e')]({'where':{'id':_0x4bcaec['params']['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x280052,null))[_0xda3b('0x26')](function(_0x39d2a5){if(_0x39d2a5){_0x3da91c=_0x39d2a5;_0x59ede3[_0xda3b('0x34')]=_[_0xda3b('0x30')](db['ZohoField'][_0xda3b('0x49')]);_0x59ede3[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x4bcaec['query']);_0x59ede3[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x59ede3[_0xda3b('0x34')],_0x59ede3[_0xda3b('0x31')]);_0x8ea05e[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x59ede3[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x36')]));_0x8ea05e[_0xda3b('0x35')]=_0x8ea05e[_0xda3b('0x35')][_0xda3b('0x37')]?_0x8ea05e[_0xda3b('0x35')]:_0x59ede3[_0xda3b('0x34')];_0x8ea05e[_0xda3b('0x3a')]=qs[_0xda3b('0x3b')](_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x8ea05e[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_[_0xda3b('0x3d')](_0x4bcaec[_0xda3b('0x31')],_0x59ede3[_0xda3b('0x32')]));if(_0x4bcaec['query'][_0xda3b('0x3e')]){_0x8ea05e[_0xda3b('0x3c')]=_[_0xda3b('0x3f')](_0x8ea05e['where'],{'$or':_[_0xda3b('0x2d')](_0x8ea05e['attributes'],function(_0x24fa0e){var _0xb00c51={};_0xb00c51[_0x24fa0e]={'$like':'%'+_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0xb00c51;})});}_0x8ea05e=_[_0xda3b('0x3f')]({},_0x8ea05e,_0x4bcaec['options']);return _0x3da91c[_0xda3b('0x4d')](_0x8ea05e);}})['then'](function(_0xe11722){if(_0xe11722){_0x1f589f=_0xe11722['length'];if(!_0x4bcaec['query'][_0xda3b('0x38')](_0xda3b('0x39'))){_0x8ea05e[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x4bcaec['query'][_0xda3b('0x1f')]);_0x8ea05e['offset']=qs['offset'](_0x4bcaec['query'][_0xda3b('0x1c')]);}return _0x3da91c[_0xda3b('0x4d')](_0x8ea05e);}})['then'](function(_0x3052fd){if(_0x3052fd){return _0x3052fd?{'count':_0x1f589f,'rows':_0x3052fd}:null;}})[_0xda3b('0x26')](respondWithResult(_0x280052,null))[_0xda3b('0x46')](handleError(_0x280052,null));};exports[_0xda3b('0x4f')]=function(_0x3e2fcc,_0x5eceed,_0x2c3f34){var _0x24a87f={};var _0x8986f1={};var _0x41e04d;var _0x3d68a6;return db[_0xda3b('0x2e')][_0xda3b('0x4e')]({'where':{'id':_0x3e2fcc[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x5eceed,null))[_0xda3b('0x26')](function(_0x3df680){if(_0x3df680){_0x41e04d=_0x3df680;_0x8986f1[_0xda3b('0x34')]=_[_0xda3b('0x30')](db[_0xda3b('0x50')][_0xda3b('0x49')]);_0x8986f1[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x3e2fcc[_0xda3b('0x31')]);_0x8986f1[_0xda3b('0x32')]=_['intersection'](_0x8986f1['model'],_0x8986f1[_0xda3b('0x31')]);_0x24a87f[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x8986f1[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x3e2fcc[_0xda3b('0x31')]['fields']));_0x24a87f[_0xda3b('0x35')]=_0x24a87f['attributes'][_0xda3b('0x37')]?_0x24a87f[_0xda3b('0x35')]:_0x8986f1[_0xda3b('0x34')];_0x24a87f[_0xda3b('0x3a')]=qs[_0xda3b('0x3b')](_0x3e2fcc['query'][_0xda3b('0x3b')]);_0x24a87f[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_['pick'](_0x3e2fcc[_0xda3b('0x31')],_0x8986f1[_0xda3b('0x32')]));if(_0x3e2fcc['query'][_0xda3b('0x3e')]){_0x24a87f['where']=_['merge'](_0x24a87f['where'],{'$or':_[_0xda3b('0x2d')](_0x24a87f[_0xda3b('0x35')],function(_0x1ca31e){var _0x503eb6={};_0x503eb6[_0x1ca31e]={'$like':'%'+_0x3e2fcc[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0x503eb6;})});}_0x24a87f=_[_0xda3b('0x3f')]({},_0x24a87f,_0x3e2fcc[_0xda3b('0x42')]);return _0x41e04d['getSubjects'](_0x24a87f);}})['then'](function(_0xe9d53){if(_0xe9d53){_0x3d68a6=_0xe9d53['length'];if(!_0x3e2fcc[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x24a87f[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x3e2fcc[_0xda3b('0x31')]['limit']);_0x24a87f[_0xda3b('0x1c')]=qs[_0xda3b('0x1c')](_0x3e2fcc['query'][_0xda3b('0x1c')]);}return _0x41e04d['getSubjects'](_0x24a87f);}})['then'](function(_0x54428a){if(_0x54428a){return _0x54428a?{'count':_0x3d68a6,'rows':_0x54428a}:null;}})[_0xda3b('0x26')](respondWithResult(_0x5eceed,null))['catch'](handleError(_0x5eceed,null));};exports['getDescriptions']=function(_0x35ecf4,_0x365466,_0x19cb7a){var _0x2831ee={};var _0x56681d={};var _0x17d021;var _0x3b930f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x35ecf4[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x365466,null))[_0xda3b('0x26')](function(_0x3efded){if(_0x3efded){_0x17d021=_0x3efded;_0x56681d[_0xda3b('0x34')]=_['keys'](db[_0xda3b('0x50')]['rawAttributes']);_0x56681d[_0xda3b('0x31')]=_['keys'](_0x35ecf4['query']);_0x56681d[_0xda3b('0x32')]=_['intersection'](_0x56681d[_0xda3b('0x34')],_0x56681d[_0xda3b('0x31')]);_0x2831ee[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x56681d[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x35ecf4[_0xda3b('0x31')]['fields']));_0x2831ee['attributes']=_0x2831ee['attributes'][_0xda3b('0x37')]?_0x2831ee[_0xda3b('0x35')]:_0x56681d[_0xda3b('0x34')];_0x2831ee['order']=qs[_0xda3b('0x3b')](_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x2831ee[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_[_0xda3b('0x3d')](_0x35ecf4[_0xda3b('0x31')],_0x56681d[_0xda3b('0x32')]));if(_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3e')]){_0x2831ee[_0xda3b('0x3c')]=_['merge'](_0x2831ee[_0xda3b('0x3c')],{'$or':_[_0xda3b('0x2d')](_0x2831ee[_0xda3b('0x35')],function(_0x4bcdd2){var _0xd3a0da={};_0xd3a0da[_0x4bcdd2]={'$like':'%'+_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0xd3a0da;})});}_0x2831ee=_['merge']({},_0x2831ee,_0x35ecf4[_0xda3b('0x42')]);return _0x17d021[_0xda3b('0x51')](_0x2831ee);}})[_0xda3b('0x26')](function(_0x4d4e63){if(_0x4d4e63){_0x3b930f=_0x4d4e63[_0xda3b('0x37')];if(!_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x2831ee[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x35ecf4[_0xda3b('0x31')]['limit']);_0x2831ee['offset']=qs[_0xda3b('0x1c')](_0x35ecf4['query'][_0xda3b('0x1c')]);}return _0x17d021[_0xda3b('0x51')](_0x2831ee);}})['then'](function(_0x63ea0e){if(_0x63ea0e){return _0x63ea0e?{'count':_0x3b930f,'rows':_0x63ea0e}:null;}})[_0xda3b('0x26')](respondWithResult(_0x365466,null))[_0xda3b('0x46')](handleError(_0x365466,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d21605b..0b23995 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 _0xab2f=['int_zoho_configurations','lodash','util','api','bluebird','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xab2f,0xa1));var _0xfab2=function(_0x43e5e0,_0x215765){_0x43e5e0=_0x43e5e0-0x0;var _0x2bf17b=_0xab2f[_0x43e5e0];return _0x2bf17b;};'use strict';var _=require(_0xfab2('0x0'));var util=require(_0xfab2('0x1'));var logger=require('../../config/logger')(_0xfab2('0x2'));var moment=require('moment');var BPromise=require(_0xfab2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfab2('0x4'));var config=require(_0xfab2('0x5'));var attributes=require(_0xfab2('0x6'));module[_0xfab2('0x7')]=function(_0x418ac9,_0x5db922){return _0x418ac9[_0xfab2('0x8')]('ZohoConfiguration',attributes,{'tableName':_0xfab2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6e=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','api','moment'];(function(_0x1d27a8,_0x2f5d59){var _0x37adc5=function(_0x354a20){while(--_0x354a20){_0x1d27a8['push'](_0x1d27a8['shift']());}};_0x37adc5(++_0x2f5d59);}(_0x8d6e,0x14e));var _0xe8d6=function(_0x513e7d,_0x37015c){_0x513e7d=_0x513e7d-0x0;var _0x61215d=_0x8d6e[_0x513e7d];return _0x61215d;};'use strict';var _=require(_0xe8d6('0x0'));var util=require(_0xe8d6('0x1'));var logger=require('../../config/logger')(_0xe8d6('0x2'));var moment=require(_0xe8d6('0x3'));var BPromise=require(_0xe8d6('0x4'));var rp=require(_0xe8d6('0x5'));var fs=require('fs');var path=require(_0xe8d6('0x6'));var rimraf=require(_0xe8d6('0x7'));var config=require(_0xe8d6('0x8'));var attributes=require(_0xe8d6('0x9'));module[_0xe8d6('0xa')]=function(_0x34f221,_0x1eb69b){return _0x34f221[_0xe8d6('0xb')](_0xe8d6('0xc'),attributes,{'tableName':'int_zoho_configurations','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 08c29d4..f25927c 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 _0x78b4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78b4,0x1a0));var _0x478b=function(_0x3063be,_0x453f01){_0x3063be=_0x3063be-0x0;var _0x3f075f=_0x78b4[_0x3063be];return _0x3f075f;};'use strict';var _=require(_0x478b('0x0'));var util=require('util');var moment=require(_0x478b('0x1'));var BPromise=require(_0x478b('0x2'));var rs=require(_0x478b('0x3'));var fs=require('fs');var Redis=require(_0x478b('0x4'));var db=require(_0x478b('0x5'))['db'];var utils=require(_0x478b('0x6'));var logger=require(_0x478b('0x7'))(_0x478b('0x8'));var config=require(_0x478b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x478b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40715f,_0x325980,_0x9b338a){return new BPromise(function(_0x54d807,_0x342e91){return client[_0x478b('0xb')](_0x40715f,_0x9b338a)[_0x478b('0xc')](function(_0x3e6c4d){logger[_0x478b('0xd')](_0x478b('0xe'),_0x325980,_0x478b('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x325980,_0x478b('0xf'),JSON[_0x478b('0x10')](_0x3e6c4d));if(_0x3e6c4d[_0x478b('0x11')]){if(_0x3e6c4d[_0x478b('0x11')][_0x478b('0x12')]===0x1f4){logger[_0x478b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x325980,_0x3e6c4d[_0x478b('0x11')]['message']);return _0x342e91(_0x3e6c4d[_0x478b('0x11')]['message']);}logger[_0x478b('0x11')](_0x478b('0xe'),_0x325980,_0x3e6c4d[_0x478b('0x11')][_0x478b('0x13')]);return _0x54d807(_0x3e6c4d[_0x478b('0x11')][_0x478b('0x13')]);}else{logger[_0x478b('0xd')](_0x478b('0xe'),_0x325980,_0x478b('0xf'));_0x54d807(_0x3e6c4d[_0x478b('0x14')][_0x478b('0x13')]);}})[_0x478b('0x15')](function(_0x52e369){logger[_0x478b('0x11')](_0x478b('0xe'),_0x325980,_0x52e369);_0x342e91(_0x52e369);});});} \ No newline at end of file +var _0x543e=['error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15ce76,_0x302986){var _0x5ed7ef=function(_0x1d296c){while(--_0x1d296c){_0x15ce76['push'](_0x15ce76['shift']());}};_0x5ed7ef(++_0x302986);}(_0x543e,0x1e9));var _0xe543=function(_0x3da2f5,_0x423ce2){_0x3da2f5=_0x3da2f5-0x0;var _0x6c3805=_0x543e[_0x3da2f5];return _0x6c3805;};'use strict';var _=require('lodash');var util=require(_0xe543('0x0'));var moment=require(_0xe543('0x1'));var BPromise=require(_0xe543('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe543('0x3'));var db=require(_0xe543('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe543('0x5'))(_0xe543('0x6'));var config=require('../../config/environment');var jayson=require(_0xe543('0x7'));var client=jayson[_0xe543('0x8')][_0xe543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a693b,_0x26804c,_0x172fc7){return new BPromise(function(_0x58a7bf,_0x11d641){return client[_0xe543('0xa')](_0x1a693b,_0x172fc7)[_0xe543('0xb')](function(_0x3cab75){logger['info'](_0xe543('0xc'),_0x26804c,_0xe543('0xd'));logger[_0xe543('0xe')](_0xe543('0xf'),_0x26804c,_0xe543('0xd'),JSON[_0xe543('0x10')](_0x3cab75));if(_0x3cab75[_0xe543('0x11')]){if(_0x3cab75['error'][_0xe543('0x12')]===0x1f4){logger[_0xe543('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x26804c,_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);return _0x11d641(_0x3cab75['error']['message']);}logger[_0xe543('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x26804c,_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);return _0x58a7bf(_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);}else{logger[_0xe543('0x14')](_0xe543('0xc'),_0x26804c,_0xe543('0xd'));_0x58a7bf(_0x3cab75[_0xe543('0x15')][_0xe543('0x13')]);}})['catch'](function(_0x3bab9d){logger[_0xe543('0x11')](_0xe543('0xc'),_0x26804c,_0x3bab9d);_0x11d641(_0x3bab9d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5f04d26..929b8d8 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 _0x39da=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x5d9b63,_0x3f7035){var _0x18c034=function(_0x2a4a6e){while(--_0x2a4a6e){_0x5d9b63['push'](_0x5d9b63['shift']());}};_0x18c034(++_0x3f7035);}(_0x39da,0x14e));var _0xa39d=function(_0xb7e82,_0x20bd61){_0xb7e82=_0xb7e82-0x0;var _0xac3795=_0x39da[_0xb7e82];return _0xac3795;};'use strict';var multer=require(_0xa39d('0x0'));var util=require(_0xa39d('0x1'));var path=require(_0xa39d('0x2'));var timeout=require(_0xa39d('0x3'));var express=require(_0xa39d('0x4'));var router=express[_0xa39d('0x5')]();var fs_extra=require(_0xa39d('0x6'));var auth=require(_0xa39d('0x7'));var interaction=require(_0xa39d('0x8'));var config=require(_0xa39d('0x9'));var controller=require(_0xa39d('0xa'));router[_0xa39d('0xb')]('/',auth[_0xa39d('0xc')](),controller[_0xa39d('0xd')]);router['get'](_0xa39d('0xe'),auth[_0xa39d('0xc')](),controller[_0xa39d('0xf')]);router[_0xa39d('0x10')]('/',auth[_0xa39d('0xc')](),controller[_0xa39d('0x11')]);router[_0xa39d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa39d('0x13')]);router[_0xa39d('0x14')](_0xa39d('0xe'),auth[_0xa39d('0xc')](),controller[_0xa39d('0x15')]);module[_0xa39d('0x16')]=router; \ No newline at end of file +var _0xb3dd=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x3ba1bc,_0x236e7c){var _0x2d3e1e=function(_0x34312a){while(--_0x34312a){_0x3ba1bc['push'](_0x3ba1bc['shift']());}};_0x2d3e1e(++_0x236e7c);}(_0xb3dd,0xce));var _0xdb3d=function(_0x1c0fda,_0x3e99f0){_0x1c0fda=_0x1c0fda-0x0;var _0x3f8fda=_0xb3dd[_0x1c0fda];return _0x3f8fda;};'use strict';var multer=require(_0xdb3d('0x0'));var util=require(_0xdb3d('0x1'));var path=require('path');var timeout=require(_0xdb3d('0x2'));var express=require(_0xdb3d('0x3'));var router=express[_0xdb3d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdb3d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb3d('0x6'));var controller=require('./intZohoField.controller');router[_0xdb3d('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb3d('0x8')]);router[_0xdb3d('0x7')]('/:id',auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xa')]);router[_0xdb3d('0xb')]('/',auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xc')]);router[_0xdb3d('0xd')](_0xdb3d('0xe'),auth[_0xdb3d('0x9')](),controller['update']);router['delete'](_0xdb3d('0xe'),auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xf')]);module[_0xdb3d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f5500ae..7d7812d 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 _0x6a92=['picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x4b70d3,_0x5a0c87){var _0x910389=function(_0x2b947a){while(--_0x2b947a){_0x4b70d3['push'](_0x4b70d3['shift']());}};_0x910389(++_0x5a0c87);}(_0x6a92,0x1a2));var _0x26a9=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6a92[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x26a9('0x0'));module[_0x26a9('0x1')]={'type':{'type':Sequelize[_0x26a9('0x2')]('string',_0x26a9('0x3'),_0x26a9('0x4'),'keyValue',_0x26a9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x26a9('0x6')]},'key':{'type':Sequelize[_0x26a9('0x6')]},'keyType':{'type':Sequelize[_0x26a9('0x2')](_0x26a9('0x7'),_0x26a9('0x3'),_0x26a9('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x26a9('0x6')]},'nameField':{'type':Sequelize[_0x26a9('0x6')]},'customField':{'type':Sequelize[_0x26a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26a9('0x6')]}}; \ No newline at end of file +var _0xbe86=['customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x4799ef,_0x25cf0f){var _0x5a68f1=function(_0x2bef5b){while(--_0x2bef5b){_0x4799ef['push'](_0x4799ef['shift']());}};_0x5a68f1(++_0x25cf0f);}(_0xbe86,0xd4));var _0x6be8=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xbe86[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x6be8('0x0'));module[_0x6be8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6be8('0x2'),_0x6be8('0x3'),_0x6be8('0x4'),_0x6be8('0x5'),_0x6be8('0x6')),'defaultValue':_0x6be8('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6be8('0x7')]},'keyType':{'type':Sequelize[_0x6be8('0x8')](_0x6be8('0x2'),'variable',_0x6be8('0x4'))},'keyContent':{'type':Sequelize[_0x6be8('0x7')]},'idField':{'type':Sequelize[_0x6be8('0x7')]},'nameField':{'type':Sequelize[_0x6be8('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6be8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a2c49ce..ea0b527 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 _0x3c36=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x3c36,0x10c));var _0x63c3=function(_0x57e6ce,_0x2ff989){_0x57e6ce=_0x57e6ce-0x0;var _0x2e309a=_0x3c36[_0x57e6ce];return _0x2e309a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63c3('0x0'));var jsonpatch=require(_0x63c3('0x1'));var rp=require(_0x63c3('0x2'));var moment=require('moment');var BPromise=require(_0x63c3('0x3'));var Mustache=require(_0x63c3('0x4'));var util=require(_0x63c3('0x5'));var path=require('path');var sox=require(_0x63c3('0x6'));var csv=require(_0x63c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x63c3('0x8'));var crypto=require('crypto');var jsforce=require(_0x63c3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x63c3('0x7'));var querystring=require(_0x63c3('0xa'));var Papa=require(_0x63c3('0xb'));var Redis=require(_0x63c3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x63c3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x63c3('0xe'))(_0x63c3('0xf'));var utils=require(_0x63c3('0x10'));var config=require(_0x63c3('0x11'));var licenseUtil=require(_0x63c3('0x12'));var db=require(_0x63c3('0x13'))['db'];function respondWithStatusCode(_0x5c7f7a,_0x52d056){_0x52d056=_0x52d056||0xcc;return function(_0x52e2ca){if(_0x52e2ca){return _0x5c7f7a['sendStatus'](_0x52d056);}return _0x5c7f7a[_0x63c3('0x14')](_0x52d056)[_0x63c3('0x15')]();};}function respondWithResult(_0x222c7d,_0x40620c){_0x40620c=_0x40620c||0xc8;return function(_0x4355e2){if(_0x4355e2){return _0x222c7d[_0x63c3('0x14')](_0x40620c)['json'](_0x4355e2);}};}function respondWithFilteredResult(_0x13a600,_0x2aad91){return function(_0x1b0cbd){if(_0x1b0cbd){var _0x37977f=typeof _0x2aad91[_0x63c3('0x16')]===_0x63c3('0x17')&&typeof _0x2aad91[_0x63c3('0x18')]===_0x63c3('0x17');var _0x12194d=_0x1b0cbd[_0x63c3('0x19')];var _0x4c80ff=_0x37977f?0x0:_0x2aad91[_0x63c3('0x16')];var _0x5984e2=_0x37977f?_0x1b0cbd[_0x63c3('0x19')]:_0x2aad91[_0x63c3('0x16')]+_0x2aad91['limit'];var _0x1e2a7d;if(_0x5984e2>=_0x12194d){_0x5984e2=_0x12194d;_0x1e2a7d=0xc8;}else{_0x1e2a7d=0xce;}_0x13a600[_0x63c3('0x14')](_0x1e2a7d);return _0x13a600[_0x63c3('0x1a')](_0x63c3('0x1b'),_0x4c80ff+'-'+_0x5984e2+'/'+_0x12194d)[_0x63c3('0x1c')](_0x1b0cbd);}return null;};}function patchUpdates(_0x5c32a6){return function(_0x95271c){try{jsonpatch[_0x63c3('0x1d')](_0x95271c,_0x5c32a6,!![]);}catch(_0x2561fc){return BPromise['reject'](_0x2561fc);}return _0x95271c[_0x63c3('0x1e')]();};}function saveUpdates(_0x1b3348,_0x5a3b0a){return function(_0x4e2adf){if(_0x4e2adf){return _0x4e2adf['update'](_0x1b3348)[_0x63c3('0x1f')](function(_0x19e9c7){return _0x19e9c7;});}return null;};}function removeEntity(_0x431e63,_0x430478){return function(_0x2866b4){if(_0x2866b4){return _0x2866b4['destroy']()[_0x63c3('0x1f')](function(){_0x431e63[_0x63c3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420332,_0x1a3d1c){return function(_0x129a3c){if(!_0x129a3c){_0x420332[_0x63c3('0x20')](0x194);}return _0x129a3c;};}function handleError(_0x2696db,_0xd9df9c){_0xd9df9c=_0xd9df9c||0x1f4;return function(_0x4e7dcf){logger[_0x63c3('0x21')](_0x4e7dcf[_0x63c3('0x22')]);if(_0x4e7dcf[_0x63c3('0x23')]){delete _0x4e7dcf['name'];}_0x2696db[_0x63c3('0x14')](_0xd9df9c)[_0x63c3('0x24')](_0x4e7dcf);};}exports[_0x63c3('0x25')]=function(_0x34a36a,_0x39fefc){var _0x2eaca9={},_0x32cc56={},_0x2f37b2={'count':0x0,'rows':[]};var _0x5e2e17=_[_0x63c3('0x26')](db[_0x63c3('0x27')]['rawAttributes'],function(_0x940925){return{'name':_0x940925[_0x63c3('0x28')],'type':_0x940925[_0x63c3('0x29')][_0x63c3('0x2a')]};});_0x32cc56[_0x63c3('0x2b')]=_[_0x63c3('0x26')](_0x5e2e17,_0x63c3('0x23'));_0x32cc56[_0x63c3('0x2c')]=_[_0x63c3('0x2d')](_0x34a36a['query']);_0x32cc56[_0x63c3('0x2e')]=_['intersection'](_0x32cc56['model'],_0x32cc56['query']);_0x2eaca9[_0x63c3('0x2f')]=_[_0x63c3('0x30')](_0x32cc56['model'],qs[_0x63c3('0x31')](_0x34a36a[_0x63c3('0x2c')][_0x63c3('0x31')]));_0x2eaca9[_0x63c3('0x2f')]=_0x2eaca9[_0x63c3('0x2f')][_0x63c3('0x32')]?_0x2eaca9[_0x63c3('0x2f')]:_0x32cc56[_0x63c3('0x2b')];if(!_0x34a36a[_0x63c3('0x2c')][_0x63c3('0x33')](_0x63c3('0x34'))){_0x2eaca9['limit']=qs[_0x63c3('0x18')](_0x34a36a[_0x63c3('0x2c')][_0x63c3('0x18')]);_0x2eaca9[_0x63c3('0x16')]=qs[_0x63c3('0x16')](_0x34a36a['query'][_0x63c3('0x16')]);}_0x2eaca9[_0x63c3('0x35')]=qs['sort'](_0x34a36a[_0x63c3('0x2c')][_0x63c3('0x36')]);_0x2eaca9['where']=qs[_0x63c3('0x2e')](_[_0x63c3('0x37')](_0x34a36a['query'],_0x32cc56[_0x63c3('0x2e')]),_0x5e2e17);if(_0x34a36a[_0x63c3('0x2c')]['filter']){_0x2eaca9[_0x63c3('0x38')]=_['merge'](_0x2eaca9[_0x63c3('0x38')],{'$or':_[_0x63c3('0x26')](_0x5e2e17,function(_0x2d7a23){if(_0x2d7a23[_0x63c3('0x29')]!==_0x63c3('0x39')){var _0x3c229b={};_0x3c229b[_0x2d7a23[_0x63c3('0x23')]]={'$like':'%'+_0x34a36a[_0x63c3('0x2c')]['filter']+'%'};return _0x3c229b;}})});}_0x2eaca9=_[_0x63c3('0x3a')]({},_0x2eaca9,_0x34a36a['options']);var _0x117c4e={'where':_0x2eaca9[_0x63c3('0x38')]};return db[_0x63c3('0x27')][_0x63c3('0x19')](_0x117c4e)[_0x63c3('0x1f')](function(_0x542cc7){_0x2f37b2['count']=_0x542cc7;if(_0x34a36a[_0x63c3('0x2c')][_0x63c3('0x3b')]){_0x2eaca9[_0x63c3('0x3c')]=[{'all':!![]}];}return db[_0x63c3('0x27')][_0x63c3('0x3d')](_0x2eaca9);})['then'](function(_0x1a49f1){_0x2f37b2[_0x63c3('0x3e')]=_0x1a49f1;return _0x2f37b2;})[_0x63c3('0x1f')](respondWithFilteredResult(_0x39fefc,_0x2eaca9))[_0x63c3('0x3f')](handleError(_0x39fefc,null));};exports[_0x63c3('0x40')]=function(_0xf6cee8,_0x554c52){var _0x4b3447={'raw':!![],'where':{'id':_0xf6cee8[_0x63c3('0x41')]['id']}},_0x327476={};_0x327476[_0x63c3('0x2b')]=_[_0x63c3('0x2d')](db[_0x63c3('0x27')][_0x63c3('0x42')]);_0x327476[_0x63c3('0x2c')]=_['keys'](_0xf6cee8[_0x63c3('0x2c')]);_0x327476[_0x63c3('0x2e')]=_['intersection'](_0x327476[_0x63c3('0x2b')],_0x327476[_0x63c3('0x2c')]);_0x4b3447[_0x63c3('0x2f')]=_[_0x63c3('0x30')](_0x327476['model'],qs[_0x63c3('0x31')](_0xf6cee8[_0x63c3('0x2c')]['fields']));_0x4b3447[_0x63c3('0x2f')]=_0x4b3447[_0x63c3('0x2f')][_0x63c3('0x32')]?_0x4b3447[_0x63c3('0x2f')]:_0x327476[_0x63c3('0x2b')];if(_0xf6cee8[_0x63c3('0x2c')][_0x63c3('0x3b')]){_0x4b3447[_0x63c3('0x3c')]=[{'all':!![]}];}_0x4b3447=_[_0x63c3('0x3a')]({},_0x4b3447,_0xf6cee8['options']);return db['ZohoField'][_0x63c3('0x43')](_0x4b3447)[_0x63c3('0x1f')](handleEntityNotFound(_0x554c52,null))[_0x63c3('0x1f')](respondWithResult(_0x554c52,null))[_0x63c3('0x3f')](handleError(_0x554c52,null));};exports['create']=function(_0x1553b5,_0x37f48d){return db[_0x63c3('0x27')][_0x63c3('0x44')](_0x1553b5[_0x63c3('0x45')],{})['then'](respondWithResult(_0x37f48d,0xc9))['catch'](handleError(_0x37f48d,null));};exports['update']=function(_0x36912e,_0xeb1f66){if(_0x36912e[_0x63c3('0x45')]['id']){delete _0x36912e[_0x63c3('0x45')]['id'];}return db[_0x63c3('0x27')][_0x63c3('0x43')]({'where':{'id':_0x36912e['params']['id']}})[_0x63c3('0x1f')](handleEntityNotFound(_0xeb1f66,null))[_0x63c3('0x1f')](saveUpdates(_0x36912e[_0x63c3('0x45')],null))[_0x63c3('0x1f')](respondWithResult(_0xeb1f66,null))[_0x63c3('0x3f')](handleError(_0xeb1f66,null));};exports[_0x63c3('0x46')]=function(_0x51cfe5,_0x5660d4){return db[_0x63c3('0x27')][_0x63c3('0x43')]({'where':{'id':_0x51cfe5['params']['id']}})['then'](handleEntityNotFound(_0x5660d4,null))[_0x63c3('0x1f')](removeEntity(_0x5660d4,null))['catch'](handleError(_0x5660d4,null));}; \ No newline at end of file +var _0xaf3c=['request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir'];(function(_0xf9cc12,_0x8a5a90){var _0x1827fa=function(_0x2a2e66){while(--_0x2a2e66){_0xf9cc12['push'](_0xf9cc12['shift']());}};_0x1827fa(++_0x8a5a90);}(_0xaf3c,0x16f));var _0xcaf3=function(_0x3b9f02,_0x4eed0c){_0x3b9f02=_0x3b9f02-0x0;var _0x31f7eb=_0xaf3c[_0x3b9f02];return _0x31f7eb;};'use strict';var emlformat=require(_0xcaf3('0x0'));var rimraf=require(_0xcaf3('0x1'));var zipdir=require(_0xcaf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcaf3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcaf3('0x5'));var ejs=require(_0xcaf3('0x6'));var fs=require('fs');var fs_extra=require(_0xcaf3('0x7'));var _=require(_0xcaf3('0x8'));var squel=require(_0xcaf3('0x9'));var crypto=require(_0xcaf3('0xa'));var jsforce=require(_0xcaf3('0xb'));var deskjs=require(_0xcaf3('0xc'));var toCsv=require(_0xcaf3('0x5'));var querystring=require(_0xcaf3('0xd'));var Papa=require(_0xcaf3('0xe'));var Redis=require(_0xcaf3('0xf'));var authService=require(_0xcaf3('0x10'));var qs=require(_0xcaf3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaf3('0x12'));var logger=require(_0xcaf3('0x13'))('api');var utils=require(_0xcaf3('0x14'));var config=require(_0xcaf3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34d6c6,_0x394349){_0x394349=_0x394349||0xcc;return function(_0x1f14d2){if(_0x1f14d2){return _0x34d6c6[_0xcaf3('0x16')](_0x394349);}return _0x34d6c6['status'](_0x394349)[_0xcaf3('0x17')]();};}function respondWithResult(_0x34c589,_0x5194a6){_0x5194a6=_0x5194a6||0xc8;return function(_0x1a1c4a){if(_0x1a1c4a){return _0x34c589[_0xcaf3('0x18')](_0x5194a6)[_0xcaf3('0x19')](_0x1a1c4a);}};}function respondWithFilteredResult(_0x3681e0,_0x355349){return function(_0x2e9eb7){if(_0x2e9eb7){var _0x5d3d14=typeof _0x355349[_0xcaf3('0x1a')]===_0xcaf3('0x1b')&&typeof _0x355349[_0xcaf3('0x1c')]===_0xcaf3('0x1b');var _0x234e27=_0x2e9eb7['count'];var _0x436c27=_0x5d3d14?0x0:_0x355349[_0xcaf3('0x1a')];var _0x2ef9d2=_0x5d3d14?_0x2e9eb7[_0xcaf3('0x1d')]:_0x355349[_0xcaf3('0x1a')]+_0x355349[_0xcaf3('0x1c')];var _0x56f25a;if(_0x2ef9d2>=_0x234e27){_0x2ef9d2=_0x234e27;_0x56f25a=0xc8;}else{_0x56f25a=0xce;}_0x3681e0[_0xcaf3('0x18')](_0x56f25a);return _0x3681e0[_0xcaf3('0x1e')](_0xcaf3('0x1f'),_0x436c27+'-'+_0x2ef9d2+'/'+_0x234e27)[_0xcaf3('0x19')](_0x2e9eb7);}return null;};}function patchUpdates(_0x593244){return function(_0x4ae5c1){try{jsonpatch[_0xcaf3('0x20')](_0x4ae5c1,_0x593244,!![]);}catch(_0x1c2c3){return BPromise[_0xcaf3('0x21')](_0x1c2c3);}return _0x4ae5c1[_0xcaf3('0x22')]();};}function saveUpdates(_0x4b1f44,_0x45f8e3){return function(_0x47dcdc){if(_0x47dcdc){return _0x47dcdc[_0xcaf3('0x23')](_0x4b1f44)[_0xcaf3('0x24')](function(_0x1b20d8){return _0x1b20d8;});}return null;};}function removeEntity(_0x1656f2,_0x2b6342){return function(_0x324cf1){if(_0x324cf1){return _0x324cf1[_0xcaf3('0x25')]()[_0xcaf3('0x24')](function(){_0x1656f2[_0xcaf3('0x18')](0xcc)[_0xcaf3('0x17')]();});}};}function handleEntityNotFound(_0x1d46ed,_0x51ab0b){return function(_0x3f562d){if(!_0x3f562d){_0x1d46ed[_0xcaf3('0x16')](0x194);}return _0x3f562d;};}function handleError(_0x4608f,_0x11c9c7){_0x11c9c7=_0x11c9c7||0x1f4;return function(_0x56dd8a){logger['error'](_0x56dd8a[_0xcaf3('0x26')]);if(_0x56dd8a[_0xcaf3('0x27')]){delete _0x56dd8a[_0xcaf3('0x27')];}_0x4608f[_0xcaf3('0x18')](_0x11c9c7)[_0xcaf3('0x28')](_0x56dd8a);};}exports[_0xcaf3('0x29')]=function(_0x46176d,_0x3aa500){var _0x579afc={},_0x1fd3ce={},_0x282032={'count':0x0,'rows':[]};var _0x5293b0=_['map'](db['ZohoField'][_0xcaf3('0x2a')],function(_0x2f7811){return{'name':_0x2f7811[_0xcaf3('0x2b')],'type':_0x2f7811['type'][_0xcaf3('0x2c')]};});_0x1fd3ce[_0xcaf3('0x2d')]=_[_0xcaf3('0x2e')](_0x5293b0,_0xcaf3('0x27'));_0x1fd3ce['query']=_[_0xcaf3('0x2f')](_0x46176d[_0xcaf3('0x30')]);_0x1fd3ce[_0xcaf3('0x31')]=_[_0xcaf3('0x32')](_0x1fd3ce[_0xcaf3('0x2d')],_0x1fd3ce[_0xcaf3('0x30')]);_0x579afc[_0xcaf3('0x33')]=_[_0xcaf3('0x32')](_0x1fd3ce[_0xcaf3('0x2d')],qs[_0xcaf3('0x34')](_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x34')]));_0x579afc[_0xcaf3('0x33')]=_0x579afc[_0xcaf3('0x33')][_0xcaf3('0x35')]?_0x579afc[_0xcaf3('0x33')]:_0x1fd3ce[_0xcaf3('0x2d')];if(!_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x36')](_0xcaf3('0x37'))){_0x579afc[_0xcaf3('0x1c')]=qs[_0xcaf3('0x1c')](_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x1c')]);_0x579afc[_0xcaf3('0x1a')]=qs[_0xcaf3('0x1a')](_0x46176d['query'][_0xcaf3('0x1a')]);}_0x579afc[_0xcaf3('0x38')]=qs['sort'](_0x46176d['query']['sort']);_0x579afc[_0xcaf3('0x39')]=qs[_0xcaf3('0x31')](_[_0xcaf3('0x3a')](_0x46176d['query'],_0x1fd3ce['filters']),_0x5293b0);if(_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x3b')]){_0x579afc['where']=_[_0xcaf3('0x3c')](_0x579afc[_0xcaf3('0x39')],{'$or':_[_0xcaf3('0x2e')](_0x5293b0,function(_0x11ba19){if(_0x11ba19['type']!==_0xcaf3('0x3d')){var _0x3d4786={};_0x3d4786[_0x11ba19['name']]={'$like':'%'+_0x46176d[_0xcaf3('0x30')]['filter']+'%'};return _0x3d4786;}})});}_0x579afc=_[_0xcaf3('0x3c')]({},_0x579afc,_0x46176d[_0xcaf3('0x3e')]);var _0x3cf7d9={'where':_0x579afc[_0xcaf3('0x39')]};return db[_0xcaf3('0x3f')][_0xcaf3('0x1d')](_0x3cf7d9)[_0xcaf3('0x24')](function(_0x3d29f6){_0x282032['count']=_0x3d29f6;if(_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x40')]){_0x579afc[_0xcaf3('0x41')]=[{'all':!![]}];}return db[_0xcaf3('0x3f')][_0xcaf3('0x42')](_0x579afc);})['then'](function(_0x35e758){_0x282032[_0xcaf3('0x43')]=_0x35e758;return _0x282032;})['then'](respondWithFilteredResult(_0x3aa500,_0x579afc))[_0xcaf3('0x44')](handleError(_0x3aa500,null));};exports[_0xcaf3('0x45')]=function(_0xff9336,_0x1f2d42){var _0x388430={'raw':!![],'where':{'id':_0xff9336[_0xcaf3('0x46')]['id']}},_0xa6bf43={};_0xa6bf43[_0xcaf3('0x2d')]=_[_0xcaf3('0x2f')](db[_0xcaf3('0x3f')]['rawAttributes']);_0xa6bf43[_0xcaf3('0x30')]=_[_0xcaf3('0x2f')](_0xff9336['query']);_0xa6bf43[_0xcaf3('0x31')]=_[_0xcaf3('0x32')](_0xa6bf43[_0xcaf3('0x2d')],_0xa6bf43[_0xcaf3('0x30')]);_0x388430['attributes']=_[_0xcaf3('0x32')](_0xa6bf43[_0xcaf3('0x2d')],qs['fields'](_0xff9336[_0xcaf3('0x30')]['fields']));_0x388430[_0xcaf3('0x33')]=_0x388430[_0xcaf3('0x33')][_0xcaf3('0x35')]?_0x388430[_0xcaf3('0x33')]:_0xa6bf43[_0xcaf3('0x2d')];if(_0xff9336[_0xcaf3('0x30')][_0xcaf3('0x40')]){_0x388430[_0xcaf3('0x41')]=[{'all':!![]}];}_0x388430=_['merge']({},_0x388430,_0xff9336[_0xcaf3('0x3e')]);return db[_0xcaf3('0x3f')][_0xcaf3('0x47')](_0x388430)[_0xcaf3('0x24')](handleEntityNotFound(_0x1f2d42,null))['then'](respondWithResult(_0x1f2d42,null))[_0xcaf3('0x44')](handleError(_0x1f2d42,null));};exports['create']=function(_0x3371e5,_0x487b15){return db[_0xcaf3('0x3f')][_0xcaf3('0x48')](_0x3371e5[_0xcaf3('0x49')],{})[_0xcaf3('0x24')](respondWithResult(_0x487b15,0xc9))[_0xcaf3('0x44')](handleError(_0x487b15,null));};exports[_0xcaf3('0x23')]=function(_0x3077a8,_0x3a7b49){if(_0x3077a8[_0xcaf3('0x49')]['id']){delete _0x3077a8[_0xcaf3('0x49')]['id'];}return db[_0xcaf3('0x3f')]['find']({'where':{'id':_0x3077a8['params']['id']}})[_0xcaf3('0x24')](handleEntityNotFound(_0x3a7b49,null))[_0xcaf3('0x24')](saveUpdates(_0x3077a8['body'],null))[_0xcaf3('0x24')](respondWithResult(_0x3a7b49,null))[_0xcaf3('0x44')](handleError(_0x3a7b49,null));};exports[_0xcaf3('0x25')]=function(_0x28e25c,_0x19471c){return db[_0xcaf3('0x3f')][_0xcaf3('0x47')]({'where':{'id':_0x28e25c['params']['id']}})[_0xcaf3('0x24')](handleEntityNotFound(_0x19471c,null))[_0xcaf3('0x24')](removeEntity(_0x19471c,null))[_0xcaf3('0x44')](handleError(_0x19471c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index dc588a7..ffc2246 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 _0x77d4=['exports','define','zoho_unique_index','util','api','bluebird','request-promise','../../config/environment','./intZohoField.attributes'];(function(_0x910b22,_0x57e873){var _0x1f594d=function(_0x19dfa3){while(--_0x19dfa3){_0x910b22['push'](_0x910b22['shift']());}};_0x1f594d(++_0x57e873);}(_0x77d4,0x108));var _0x477d=function(_0x2f8bce,_0xc2c504){_0x2f8bce=_0x2f8bce-0x0;var _0x10c703=_0x77d4[_0x2f8bce];return _0x10c703;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));module[_0x477d('0x6')]=function(_0x471fca,_0x2545e5){return _0x471fca[_0x477d('0x7')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x477d('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'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 8f01d9a..f4adffd 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 _0x1d52=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','moment','bluebird','randomstring'];(function(_0x1dfb8a,_0x5fb121){var _0x4364d3=function(_0x41d45c){while(--_0x41d45c){_0x1dfb8a['push'](_0x1dfb8a['shift']());}};_0x4364d3(++_0x5fb121);}(_0x1d52,0xce));var _0x21d5=function(_0x502f43,_0x2d4457){_0x502f43=_0x502f43-0x0;var _0x59cf39=_0x1d52[_0x502f43];return _0x59cf39;};'use strict';var _=require(_0x21d5('0x0'));var util=require('util');var moment=require(_0x21d5('0x1'));var BPromise=require(_0x21d5('0x2'));var rs=require(_0x21d5('0x3'));var fs=require('fs');var Redis=require(_0x21d5('0x4'));var db=require(_0x21d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x21d5('0x6'))(_0x21d5('0x7'));var config=require(_0x21d5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21d5('0x9')][_0x21d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3993,_0x88a0ba,_0x5ee3d7){return new BPromise(function(_0x4e0182,_0x53a41e){return client[_0x21d5('0xb')](_0x2c3993,_0x5ee3d7)[_0x21d5('0xc')](function(_0x1e48e7){logger['info'](_0x21d5('0xd'),_0x88a0ba,_0x21d5('0xe'));logger[_0x21d5('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x88a0ba,'request\x20sent',JSON['stringify'](_0x1e48e7));if(_0x1e48e7['error']){if(_0x1e48e7[_0x21d5('0x10')][_0x21d5('0x11')]===0x1f4){logger[_0x21d5('0x10')]('ZohoField,\x20%s,\x20%s',_0x88a0ba,_0x1e48e7[_0x21d5('0x10')]['message']);return _0x53a41e(_0x1e48e7[_0x21d5('0x10')][_0x21d5('0x12')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x88a0ba,_0x1e48e7['error'][_0x21d5('0x12')]);return _0x4e0182(_0x1e48e7['error'][_0x21d5('0x12')]);}else{logger[_0x21d5('0x13')](_0x21d5('0xd'),_0x88a0ba,_0x21d5('0xe'));_0x4e0182(_0x1e48e7[_0x21d5('0x14')]['message']);}})['catch'](function(_0x159a60){logger[_0x21d5('0x10')](_0x21d5('0xd'),_0x88a0ba,_0x159a60);_0x53a41e(_0x159a60);});});} \ No newline at end of file +var _0xbee3=['../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis'];(function(_0x216ae6,_0x38cdd5){var _0x4205c9=function(_0x342254){while(--_0x342254){_0x216ae6['push'](_0x216ae6['shift']());}};_0x4205c9(++_0x38cdd5);}(_0xbee3,0xc3));var _0x3bee=function(_0xa9673c,_0x1b34fc){_0xa9673c=_0xa9673c-0x0;var _0x473f56=_0xbee3[_0xa9673c];return _0x473f56;};'use strict';var _=require(_0x3bee('0x0'));var util=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x3bee('0x3'));var fs=require('fs');var Redis=require(_0x3bee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x5'));var logger=require(_0x3bee('0x6'))(_0x3bee('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x532791,_0x410f0f,_0x327cfe){return new BPromise(function(_0x525248,_0x187f51){return client[_0x3bee('0x9')](_0x532791,_0x327cfe)[_0x3bee('0xa')](function(_0x387a22){logger[_0x3bee('0xb')](_0x3bee('0xc'),_0x410f0f,_0x3bee('0xd'));logger[_0x3bee('0xe')](_0x3bee('0xf'),_0x410f0f,'request\x20sent',JSON[_0x3bee('0x10')](_0x387a22));if(_0x387a22[_0x3bee('0x11')]){if(_0x387a22[_0x3bee('0x11')][_0x3bee('0x12')]===0x1f4){logger['error'](_0x3bee('0xc'),_0x410f0f,_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);return _0x187f51(_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);}logger[_0x3bee('0x11')](_0x3bee('0xc'),_0x410f0f,_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);return _0x525248(_0x387a22[_0x3bee('0x11')]['message']);}else{logger[_0x3bee('0xb')]('ZohoField,\x20%s,\x20%s',_0x410f0f,_0x3bee('0xd'));_0x525248(_0x387a22['result']['message']);}})['catch'](function(_0x4f92db){logger['error'](_0x3bee('0xc'),_0x410f0f,_0x4f92db);_0x187f51(_0x4f92db);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b3dc210..fdde43f 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(_0x31a8af,_0x5ed655){var _0x4295e4=function(_0x250985){while(--_0x250985){_0x31a8af['push'](_0x31a8af['shift']());}};_0x4295e4(++_0x5ed655);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index de235b5..befc62c 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 _0x04ad=['sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0xcd6a42,_0x222146){var _0x4da1b3=function(_0xfc902b){while(--_0xfc902b){_0xcd6a42['push'](_0xcd6a42['shift']());}};_0x4da1b3(++_0x222146);}(_0x04ad,0x1b9));var _0xd04a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04ad[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd04a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd04a('0x1')],'allowNull':![],'unique':_0xd04a('0x2')},'version':{'type':Sequelize[_0xd04a('0x1')],'allowNull':![],'unique':_0xd04a('0x2')},'main':{'type':Sequelize[_0xd04a('0x1')],'defaultValue':_0xd04a('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xd04a('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xd04a('0x4')]},'active':{'type':Sequelize[_0xd04a('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd04a('0x1')]},'logo':{'type':Sequelize[_0xd04a('0x1')]},'state':{'type':Sequelize[_0xd04a('0x1')],'unique':_0xd04a('0x6')},'description':{'type':Sequelize[_0xd04a('0x1')]},'title':{'type':Sequelize[_0xd04a('0x1')]},'remoteUri':{'type':Sequelize[_0xd04a('0x1')]},'link':{'type':Sequelize[_0xd04a('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1cea=['STRING','unique_name_and_version','app.js','state','sequelize','exports'];(function(_0x2f9f09,_0x1b9685){var _0x4dd5f2=function(_0x24b512){while(--_0x24b512){_0x2f9f09['push'](_0x2f9f09['shift']());}};_0x4dd5f2(++_0x1b9685);}(_0x1cea,0x142));var _0xa1ce=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x1cea[_0x31c19c];return _0x1a87f7;};'use strict';var Sequelize=require(_0xa1ce('0x0'));module[_0xa1ce('0x1')]={'name':{'type':Sequelize[_0xa1ce('0x2')],'allowNull':![],'unique':_0xa1ce('0x3')},'version':{'type':Sequelize[_0xa1ce('0x2')],'allowNull':![],'unique':_0xa1ce('0x3')},'main':{'type':Sequelize[_0xa1ce('0x2')],'defaultValue':_0xa1ce('0x4')},'filename':{'type':Sequelize[_0xa1ce('0x2')]},'path':{'type':Sequelize[_0xa1ce('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xa1ce('0x2')]},'logo':{'type':Sequelize[_0xa1ce('0x2')]},'state':{'type':Sequelize[_0xa1ce('0x2')],'unique':_0xa1ce('0x5')},'description':{'type':Sequelize[_0xa1ce('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa1ce('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7c01464..dd33cfc 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x9a8a53,_0x12c34c){var _0x36a168=function(_0x50822c){while(--_0x50822c){_0x9a8a53['push'](_0x9a8a53['shift']());}};_0x36a168(++_0x12c34c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xfcf0[_0x277fa3];return _0x2e4520;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file +var _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x1527c8,_0x10cdcf){var _0x5880c7=function(_0x5b9e9e){while(--_0x5b9e9e){_0x1527c8['push'](_0x1527c8['shift']());}};_0x5880c7(++_0x10cdcf);}(_0x6343,0x168));var _0x3634=function(_0x509c00,_0x2208ef){_0x509c00=_0x509c00-0x0;var _0x509ccc=_0x6343[_0x509c00];return _0x509ccc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 648d175..e893eef 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 _0xa279=['integrations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','Integration'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xa279,0x8d));var _0x9a27=function(_0x2224f7,_0x4ccb31){_0x2224f7=_0x2224f7-0x0;var _0x54c8c2=_0xa279[_0x2224f7];return _0x54c8c2;};'use strict';var _=require(_0x9a27('0x0'));var util=require(_0x9a27('0x1'));var logger=require(_0x9a27('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9a27('0x3'));var rp=require(_0x9a27('0x4'));var fs=require('fs');var path=require(_0x9a27('0x5'));var rimraf=require(_0x9a27('0x6'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x9a27('0x7')]=function(_0xacac00,_0x271356){return _0xacac00['define'](_0x9a27('0x8'),attributes,{'tableName':_0x9a27('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e3e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','api'];(function(_0x17fb0a,_0x5cb5ff){var _0x1b93c7=function(_0x3a3b87){while(--_0x3a3b87){_0x17fb0a['push'](_0x17fb0a['shift']());}};_0x1b93c7(++_0x5cb5ff);}(_0x9e3e,0x8e));var _0xe9e3=function(_0x2da61b,_0xd52a4c){_0x2da61b=_0x2da61b-0x0;var _0x3e01fc=_0x9e3e[_0x2da61b];return _0x3e01fc;};'use strict';var _=require(_0xe9e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9e3('0x1'));var moment=require(_0xe9e3('0x2'));var BPromise=require(_0xe9e3('0x3'));var rp=require(_0xe9e3('0x4'));var fs=require('fs');var path=require(_0xe9e3('0x5'));var rimraf=require(_0xe9e3('0x6'));var config=require(_0xe9e3('0x7'));var attributes=require(_0xe9e3('0x8'));module[_0xe9e3('0x9')]=function(_0x14aacc,_0x51f92c){return _0x14aacc['define'](_0xe9e3('0xa'),attributes,{'tableName':_0xe9e3('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 7ac3644..144fb99 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 _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x5d1280,_0x54bcdb){var _0x110d27=function(_0x5dda47){while(--_0x5dda47){_0x5d1280['push'](_0x5d1280['shift']());}};_0x110d27(++_0x54bcdb);}(_0xd943,0x15d));var _0x3d94=function(_0x3342a4,_0x4fe42e){_0x3342a4=_0x3342a4-0x0;var _0x54824f=_0xd943[_0x3342a4];return _0x54824f;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4b735d,_0x3417f3){var _0xf1844d=function(_0x17d01b){while(--_0x17d01b){_0x4b735d['push'](_0x4b735d['shift']());}};_0xf1844d(++_0x3417f3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 218dad1..cef0d9a 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x264aef,_0x10f42f){_0x264aef=_0x264aef-0x0;var _0x5d1eab=_0x5f2f[_0x264aef];return _0x5d1eab;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0295,0x1f0));var _0x5029=function(_0x1da5f4,_0x44bca7){_0x1da5f4=_0x1da5f4-0x0;var _0x58e944=_0x0295[_0x1da5f4];return _0x58e944;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d133416..23dbf31 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 _0x2b77=['TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4ae318,_0x3f2cd3){var _0x13706d=function(_0x170ceb){while(--_0x170ceb){_0x4ae318['push'](_0x4ae318['shift']());}};_0x13706d(++_0x3f2cd3);}(_0x2b77,0xec));var _0x72b7=function(_0x1a1022,_0x26610d){_0x1a1022=_0x1a1022-0x0;var _0x2b358d=_0x2b77[_0x1a1022];return _0x2b358d;};'use strict';var Sequelize=require(_0x72b7('0x0'));module[_0x72b7('0x1')]={'integration':{'type':Sequelize[_0x72b7('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x72b7('0x2')]},'ticketId':{'type':Sequelize[_0x72b7('0x2')]},'integrationId':{'type':Sequelize[_0x72b7('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x72b7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x72b7('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x72b7('0x2')]},'agentcalledAt':{'type':Sequelize[_0x72b7('0x4')]},'agentconnectAt':{'type':Sequelize[_0x72b7('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x72b7('0x4')]},'talktime':{'type':Sequelize[_0x72b7('0x3')]},'agentacw':{'type':Sequelize[_0x72b7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x72b7('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x72b7('0x4')]},'agentdump':{'type':Sequelize[_0x72b7('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x72b7('0x4')]},'lastevent':{'type':Sequelize[_0x72b7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x72b7('0x3')]},'channelstatedesc':{'type':Sequelize[_0x72b7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x72b7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x72b7('0x2')]},'accountcode':{'type':Sequelize[_0x72b7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x72b7('0x2')]},'destchannelstate':{'type':Sequelize[_0x72b7('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x72b7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x72b7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x72b7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x72b7('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x72b7('0x2')]},'destcontext':{'type':Sequelize[_0x72b7('0x2')]},'destexten':{'type':Sequelize[_0x72b7('0x2')]},'destpriority':{'type':Sequelize[_0x72b7('0x2')]},'destuniqueid':{'type':Sequelize[_0x72b7('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x72b7('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x72b7('0x2')]},'to':{'type':Sequelize[_0x72b7('0x2')]},'cc':{'type':Sequelize[_0x72b7('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x72b7('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x72b7('0x7'),_0x72b7('0x8'),_0x72b7('0x9'),_0x72b7('0xa'))},'url':{'type':Sequelize[_0x72b7('0x2')]},'app':{'type':Sequelize[_0x72b7('0x2')]},'appdata':{'type':Sequelize[_0x72b7('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1292=['TEXT','ENUM','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x1292,0x16c));var _0x2129=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1292[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x2129('0x0'));module[_0x2129('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2129('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2129('0x2')]},'integrationId':{'type':Sequelize[_0x2129('0x3')]},'contacts':{'type':Sequelize[_0x2129('0x2')]},'uniqueid':{'type':Sequelize[_0x2129('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2129('0x2')]},'queue':{'type':Sequelize[_0x2129('0x2')]},'interface':{'type':Sequelize[_0x2129('0x2')]},'membername':{'type':Sequelize[_0x2129('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2129('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2129('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2129('0x4')]},'talktime':{'type':Sequelize[_0x2129('0x3')]},'agentacw':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2129('0x3')]},'reason':{'type':Sequelize[_0x2129('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2129('0x4')]},'lastevent':{'type':Sequelize[_0x2129('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2129('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2129('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2129('0x2')]},'accountcode':{'type':Sequelize[_0x2129('0x2')]},'context':{'type':Sequelize[_0x2129('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x2129('0x2')]},'destchannelstate':{'type':Sequelize[_0x2129('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2129('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2129('0x2')]},'destcalleridname':{'type':Sequelize[_0x2129('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2129('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2129('0x2')]},'destaccountcode':{'type':Sequelize[_0x2129('0x2')]},'destcontext':{'type':Sequelize[_0x2129('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2129('0x2')]},'destuniqueid':{'type':Sequelize[_0x2129('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2129('0x2')]},'subject':{'type':Sequelize[_0x2129('0x2')]},'from':{'type':Sequelize[_0x2129('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2129('0x2')]},'attachment':{'type':Sequelize[_0x2129('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x2129('0x7')]('SENT','SENDING',_0x2129('0x8'),_0x2129('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x2129('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b5cf5e0..fe0f223 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 _0x60bf=['VIRTUAL','includeAll','rows','catch','params','length','options','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','where','pick','filter','merge'];(function(_0x198ee0,_0x417c93){var _0x35203d=function(_0x1bc563){while(--_0x1bc563){_0x198ee0['push'](_0x198ee0['shift']());}};_0x35203d(++_0x417c93);}(_0x60bf,0x163));var _0xf60b=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x60bf[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0xf60b('0x0'));var rimraf=require(_0xf60b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf60b('0x2'));var moment=require(_0xf60b('0x3'));var BPromise=require(_0xf60b('0x4'));var Mustache=require(_0xf60b('0x5'));var util=require(_0xf60b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf60b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf60b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf60b('0x9'));var deskjs=require(_0xf60b('0xa'));var toCsv=require(_0xf60b('0xb'));var querystring=require(_0xf60b('0xc'));var Papa=require(_0xf60b('0xd'));var Redis=require('ioredis');var authService=require(_0xf60b('0xe'));var qs=require(_0xf60b('0xf'));var as=require(_0xf60b('0x10'));var hardwareService=require(_0xf60b('0x11'));var logger=require(_0xf60b('0x12'))(_0xf60b('0x13'));var utils=require(_0xf60b('0x14'));var config=require(_0xf60b('0x15'));var licenseUtil=require(_0xf60b('0x16'));var db=require(_0xf60b('0x17'))['db'];function respondWithStatusCode(_0x29740f,_0x496631){_0x496631=_0x496631||0xcc;return function(_0x1550d6){if(_0x1550d6){return _0x29740f[_0xf60b('0x18')](_0x496631);}return _0x29740f[_0xf60b('0x19')](_0x496631)[_0xf60b('0x1a')]();};}function respondWithResult(_0x443785,_0x1301a7){_0x1301a7=_0x1301a7||0xc8;return function(_0xfe670e){if(_0xfe670e){return _0x443785[_0xf60b('0x19')](_0x1301a7)[_0xf60b('0x1b')](_0xfe670e);}};}function respondWithFilteredResult(_0x4d303e,_0x188e22){return function(_0x40c1e3){if(_0x40c1e3){var _0x285ed2=typeof _0x188e22[_0xf60b('0x1c')]==='undefined'&&typeof _0x188e22[_0xf60b('0x1d')]===_0xf60b('0x1e');var _0x1db21a=_0x40c1e3['count'];var _0x11e349=_0x285ed2?0x0:_0x188e22[_0xf60b('0x1c')];var _0x13c9b0=_0x285ed2?_0x40c1e3[_0xf60b('0x1f')]:_0x188e22[_0xf60b('0x1c')]+_0x188e22[_0xf60b('0x1d')];var _0x317231;if(_0x13c9b0>=_0x1db21a){_0x13c9b0=_0x1db21a;_0x317231=0xc8;}else{_0x317231=0xce;}_0x4d303e[_0xf60b('0x19')](_0x317231);return _0x4d303e[_0xf60b('0x20')]('Content-Range',_0x11e349+'-'+_0x13c9b0+'/'+_0x1db21a)[_0xf60b('0x1b')](_0x40c1e3);}return null;};}function patchUpdates(_0x50753a){return function(_0x2ebf25){try{jsonpatch[_0xf60b('0x21')](_0x2ebf25,_0x50753a,!![]);}catch(_0x4e28a5){return BPromise[_0xf60b('0x22')](_0x4e28a5);}return _0x2ebf25[_0xf60b('0x23')]();};}function saveUpdates(_0x3a1c60,_0x376fb0){return function(_0x176138){if(_0x176138){return _0x176138[_0xf60b('0x24')](_0x3a1c60)[_0xf60b('0x25')](function(_0x532570){return _0x532570;});}return null;};}function removeEntity(_0x6b443e,_0x48965f){return function(_0x5a3cb8){if(_0x5a3cb8){return _0x5a3cb8['destroy']()[_0xf60b('0x25')](function(){_0x6b443e[_0xf60b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520fe1,_0x132dc2){return function(_0x58fbdc){if(!_0x58fbdc){_0x520fe1[_0xf60b('0x18')](0x194);}return _0x58fbdc;};}function handleError(_0x400366,_0x1969c0){_0x1969c0=_0x1969c0||0x1f4;return function(_0x56322c){logger['error'](_0x56322c[_0xf60b('0x26')]);if(_0x56322c[_0xf60b('0x27')]){delete _0x56322c[_0xf60b('0x27')];}_0x400366[_0xf60b('0x19')](_0x1969c0)[_0xf60b('0x28')](_0x56322c);};}exports[_0xf60b('0x29')]=function(_0x5e7fa2,_0x37d846){var _0x13c0fe={},_0x1a229f={},_0x500c7f={'count':0x0,'rows':[]};var _0x163055=_[_0xf60b('0x2a')](db[_0xf60b('0x2b')][_0xf60b('0x2c')],function(_0x5a7c9d){return{'name':_0x5a7c9d[_0xf60b('0x2d')],'type':_0x5a7c9d[_0xf60b('0x2e')]['key']};});_0x1a229f[_0xf60b('0x2f')]=_[_0xf60b('0x2a')](_0x163055,'name');_0x1a229f[_0xf60b('0x30')]=_[_0xf60b('0x31')](_0x5e7fa2[_0xf60b('0x30')]);_0x1a229f[_0xf60b('0x32')]=_['intersection'](_0x1a229f[_0xf60b('0x2f')],_0x1a229f[_0xf60b('0x30')]);_0x13c0fe[_0xf60b('0x33')]=_[_0xf60b('0x34')](_0x1a229f[_0xf60b('0x2f')],qs[_0xf60b('0x35')](_0x5e7fa2['query'][_0xf60b('0x35')]));_0x13c0fe[_0xf60b('0x33')]=_0x13c0fe[_0xf60b('0x33')]['length']?_0x13c0fe[_0xf60b('0x33')]:_0x1a229f['model'];if(!_0x5e7fa2['query'][_0xf60b('0x36')]('nolimit')){_0x13c0fe[_0xf60b('0x1d')]=qs[_0xf60b('0x1d')](_0x5e7fa2[_0xf60b('0x30')][_0xf60b('0x1d')]);_0x13c0fe[_0xf60b('0x1c')]=qs[_0xf60b('0x1c')](_0x5e7fa2['query']['offset']);}_0x13c0fe['order']=qs['sort'](_0x5e7fa2['query']['sort']);_0x13c0fe[_0xf60b('0x37')]=qs['filters'](_[_0xf60b('0x38')](_0x5e7fa2[_0xf60b('0x30')],_0x1a229f[_0xf60b('0x32')]),_0x163055);if(_0x5e7fa2[_0xf60b('0x30')][_0xf60b('0x39')]){_0x13c0fe[_0xf60b('0x37')]=_[_0xf60b('0x3a')](_0x13c0fe[_0xf60b('0x37')],{'$or':_[_0xf60b('0x2a')](_0x163055,function(_0x1e61d2){if(_0x1e61d2[_0xf60b('0x2e')]!==_0xf60b('0x3b')){var _0xc67343={};_0xc67343[_0x1e61d2[_0xf60b('0x27')]]={'$like':'%'+_0x5e7fa2[_0xf60b('0x30')]['filter']+'%'};return _0xc67343;}})});}_0x13c0fe=_[_0xf60b('0x3a')]({},_0x13c0fe,_0x5e7fa2['options']);var _0x381fe7={'where':_0x13c0fe[_0xf60b('0x37')]};return db[_0xf60b('0x2b')]['count'](_0x381fe7)[_0xf60b('0x25')](function(_0xeed025){_0x500c7f[_0xf60b('0x1f')]=_0xeed025;if(_0x5e7fa2[_0xf60b('0x30')][_0xf60b('0x3c')]){_0x13c0fe['include']=[{'all':!![]}];}return db[_0xf60b('0x2b')]['findAll'](_0x13c0fe);})[_0xf60b('0x25')](function(_0x4ed9f5){_0x500c7f[_0xf60b('0x3d')]=_0x4ed9f5;return _0x500c7f;})[_0xf60b('0x25')](respondWithFilteredResult(_0x37d846,_0x13c0fe))[_0xf60b('0x3e')](handleError(_0x37d846,null));};exports['show']=function(_0x558049,_0x2106ea){var _0x50f77d={'raw':![],'where':{'id':_0x558049[_0xf60b('0x3f')]['id']}},_0x442ba5={};_0x442ba5[_0xf60b('0x2f')]=_[_0xf60b('0x31')](db['IntegrationReport'][_0xf60b('0x2c')]);_0x442ba5[_0xf60b('0x30')]=_['keys'](_0x558049[_0xf60b('0x30')]);_0x442ba5[_0xf60b('0x32')]=_[_0xf60b('0x34')](_0x442ba5[_0xf60b('0x2f')],_0x442ba5[_0xf60b('0x30')]);_0x50f77d['attributes']=_[_0xf60b('0x34')](_0x442ba5[_0xf60b('0x2f')],qs['fields'](_0x558049[_0xf60b('0x30')][_0xf60b('0x35')]));_0x50f77d[_0xf60b('0x33')]=_0x50f77d[_0xf60b('0x33')][_0xf60b('0x40')]?_0x50f77d[_0xf60b('0x33')]:_0x442ba5[_0xf60b('0x2f')];if(_0x558049[_0xf60b('0x30')][_0xf60b('0x3c')]){_0x50f77d['include']=[{'all':!![]}];}_0x50f77d=_[_0xf60b('0x3a')]({},_0x50f77d,_0x558049[_0xf60b('0x41')]);return db[_0xf60b('0x2b')]['find'](_0x50f77d)[_0xf60b('0x25')](handleEntityNotFound(_0x2106ea,null))[_0xf60b('0x25')](respondWithResult(_0x2106ea,null))[_0xf60b('0x3e')](handleError(_0x2106ea,null));};exports[_0xf60b('0x42')]=function(_0x5f0dc0,_0x2a1bec){return db[_0xf60b('0x2b')][_0xf60b('0x42')](_0x5f0dc0[_0xf60b('0x43')],{})[_0xf60b('0x25')](respondWithResult(_0x2a1bec,0xc9))['catch'](handleError(_0x2a1bec,null));};exports['update']=function(_0x153e56,_0x44e26b){if(_0x153e56[_0xf60b('0x43')]['id']){delete _0x153e56[_0xf60b('0x43')]['id'];}return db['IntegrationReport'][_0xf60b('0x44')]({'where':{'id':_0x153e56[_0xf60b('0x3f')]['id']}})[_0xf60b('0x25')](handleEntityNotFound(_0x44e26b,null))[_0xf60b('0x25')](saveUpdates(_0x153e56[_0xf60b('0x43')],null))[_0xf60b('0x25')](respondWithResult(_0x44e26b,null))[_0xf60b('0x3e')](handleError(_0x44e26b,null));};exports['destroy']=function(_0x27277e,_0x32236b){return db[_0xf60b('0x2b')][_0xf60b('0x44')]({'where':{'id':_0x27277e[_0xf60b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x32236b,null))[_0xf60b('0x25')](removeEntity(_0x32236b,null))['catch'](handleError(_0x32236b,null));};exports['describe']=function(_0x2412c5,_0x133922){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x133922,null))[_0xf60b('0x3e')](handleError(_0x133922,null));}; \ No newline at end of file +var _0xba44=['attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','keys','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','limit','count','set','Content-Range','reject','save','then','destroy','end','error','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0xba44,0xb4));var _0x4ba4=function(_0x15ef66,_0x5cdaf9){_0x15ef66=_0x15ef66-0x0;var _0x5bd16b=_0xba44[_0x15ef66];return _0x5bd16b;};'use strict';var emlformat=require(_0x4ba4('0x0'));var rimraf=require(_0x4ba4('0x1'));var zipdir=require(_0x4ba4('0x2'));var jsonpatch=require(_0x4ba4('0x3'));var rp=require('request-promise');var moment=require(_0x4ba4('0x4'));var BPromise=require(_0x4ba4('0x5'));var Mustache=require('mustache');var util=require(_0x4ba4('0x6'));var path=require(_0x4ba4('0x7'));var sox=require(_0x4ba4('0x8'));var csv=require(_0x4ba4('0x9'));var ejs=require(_0x4ba4('0xa'));var fs=require('fs');var fs_extra=require(_0x4ba4('0xb'));var _=require(_0x4ba4('0xc'));var squel=require(_0x4ba4('0xd'));var crypto=require(_0x4ba4('0xe'));var jsforce=require(_0x4ba4('0xf'));var deskjs=require(_0x4ba4('0x10'));var toCsv=require(_0x4ba4('0x9'));var querystring=require(_0x4ba4('0x11'));var Papa=require(_0x4ba4('0x12'));var Redis=require(_0x4ba4('0x13'));var authService=require(_0x4ba4('0x14'));var qs=require(_0x4ba4('0x15'));var as=require(_0x4ba4('0x16'));var hardwareService=require(_0x4ba4('0x17'));var logger=require(_0x4ba4('0x18'))(_0x4ba4('0x19'));var utils=require(_0x4ba4('0x1a'));var config=require(_0x4ba4('0x1b'));var licenseUtil=require(_0x4ba4('0x1c'));var db=require(_0x4ba4('0x1d'))['db'];function respondWithStatusCode(_0x24e9f7,_0x144077){_0x144077=_0x144077||0xcc;return function(_0x13b74c){if(_0x13b74c){return _0x24e9f7[_0x4ba4('0x1e')](_0x144077);}return _0x24e9f7[_0x4ba4('0x1f')](_0x144077)['end']();};}function respondWithResult(_0x3b451c,_0x274824){_0x274824=_0x274824||0xc8;return function(_0x24703a){if(_0x24703a){return _0x3b451c[_0x4ba4('0x1f')](_0x274824)[_0x4ba4('0x20')](_0x24703a);}};}function respondWithFilteredResult(_0x30db32,_0x1df5e2){return function(_0x4275b2){if(_0x4275b2){var _0x38c215=typeof _0x1df5e2[_0x4ba4('0x21')]==='undefined'&&typeof _0x1df5e2[_0x4ba4('0x22')]==='undefined';var _0x2bac5b=_0x4275b2[_0x4ba4('0x23')];var _0x24bbcf=_0x38c215?0x0:_0x1df5e2['offset'];var _0x501068=_0x38c215?_0x4275b2[_0x4ba4('0x23')]:_0x1df5e2[_0x4ba4('0x21')]+_0x1df5e2[_0x4ba4('0x22')];var _0x175014;if(_0x501068>=_0x2bac5b){_0x501068=_0x2bac5b;_0x175014=0xc8;}else{_0x175014=0xce;}_0x30db32[_0x4ba4('0x1f')](_0x175014);return _0x30db32[_0x4ba4('0x24')](_0x4ba4('0x25'),_0x24bbcf+'-'+_0x501068+'/'+_0x2bac5b)[_0x4ba4('0x20')](_0x4275b2);}return null;};}function patchUpdates(_0x2e8c89){return function(_0xc68c78){try{jsonpatch['apply'](_0xc68c78,_0x2e8c89,!![]);}catch(_0x5d7889){return BPromise[_0x4ba4('0x26')](_0x5d7889);}return _0xc68c78[_0x4ba4('0x27')]();};}function saveUpdates(_0x278f57,_0x1f07df){return function(_0x35dd86){if(_0x35dd86){return _0x35dd86['update'](_0x278f57)[_0x4ba4('0x28')](function(_0x43bdb1){return _0x43bdb1;});}return null;};}function removeEntity(_0x540b1a,_0x384889){return function(_0x34e8c0){if(_0x34e8c0){return _0x34e8c0[_0x4ba4('0x29')]()[_0x4ba4('0x28')](function(){_0x540b1a[_0x4ba4('0x1f')](0xcc)[_0x4ba4('0x2a')]();});}};}function handleEntityNotFound(_0x28c608,_0xf1c891){return function(_0x2d7b10){if(!_0x2d7b10){_0x28c608[_0x4ba4('0x1e')](0x194);}return _0x2d7b10;};}function handleError(_0x2f6385,_0x28e9e2){_0x28e9e2=_0x28e9e2||0x1f4;return function(_0x4f17c1){logger[_0x4ba4('0x2b')](_0x4f17c1['stack']);if(_0x4f17c1[_0x4ba4('0x2c')]){delete _0x4f17c1[_0x4ba4('0x2c')];}_0x2f6385['status'](_0x28e9e2)['send'](_0x4f17c1);};}exports[_0x4ba4('0x2d')]=function(_0x2c2ee3,_0x39589d){var _0x382401={},_0x7f7756={},_0x205fb3={'count':0x0,'rows':[]};var _0x17438c=_[_0x4ba4('0x2e')](db[_0x4ba4('0x2f')][_0x4ba4('0x30')],function(_0x42a791){return{'name':_0x42a791[_0x4ba4('0x31')],'type':_0x42a791[_0x4ba4('0x32')][_0x4ba4('0x33')]};});_0x7f7756[_0x4ba4('0x34')]=_['map'](_0x17438c,_0x4ba4('0x2c'));_0x7f7756[_0x4ba4('0x35')]=_['keys'](_0x2c2ee3[_0x4ba4('0x35')]);_0x7f7756[_0x4ba4('0x36')]=_[_0x4ba4('0x37')](_0x7f7756[_0x4ba4('0x34')],_0x7f7756[_0x4ba4('0x35')]);_0x382401['attributes']=_[_0x4ba4('0x37')](_0x7f7756[_0x4ba4('0x34')],qs[_0x4ba4('0x38')](_0x2c2ee3[_0x4ba4('0x35')]['fields']));_0x382401[_0x4ba4('0x39')]=_0x382401[_0x4ba4('0x39')]['length']?_0x382401['attributes']:_0x7f7756[_0x4ba4('0x34')];if(!_0x2c2ee3['query'][_0x4ba4('0x3a')](_0x4ba4('0x3b'))){_0x382401['limit']=qs[_0x4ba4('0x22')](_0x2c2ee3[_0x4ba4('0x35')]['limit']);_0x382401[_0x4ba4('0x21')]=qs[_0x4ba4('0x21')](_0x2c2ee3[_0x4ba4('0x35')]['offset']);}_0x382401[_0x4ba4('0x3c')]=qs[_0x4ba4('0x3d')](_0x2c2ee3[_0x4ba4('0x35')]['sort']);_0x382401['where']=qs[_0x4ba4('0x36')](_['pick'](_0x2c2ee3[_0x4ba4('0x35')],_0x7f7756['filters']),_0x17438c);if(_0x2c2ee3['query'][_0x4ba4('0x3e')]){_0x382401[_0x4ba4('0x3f')]=_[_0x4ba4('0x40')](_0x382401[_0x4ba4('0x3f')],{'$or':_['map'](_0x17438c,function(_0x5658f9){if(_0x5658f9[_0x4ba4('0x32')]!==_0x4ba4('0x41')){var _0x324ccd={};_0x324ccd[_0x5658f9[_0x4ba4('0x2c')]]={'$like':'%'+_0x2c2ee3[_0x4ba4('0x35')][_0x4ba4('0x3e')]+'%'};return _0x324ccd;}})});}_0x382401=_[_0x4ba4('0x40')]({},_0x382401,_0x2c2ee3[_0x4ba4('0x42')]);var _0x5f55df={'where':_0x382401[_0x4ba4('0x3f')]};return db[_0x4ba4('0x2f')][_0x4ba4('0x23')](_0x5f55df)[_0x4ba4('0x28')](function(_0x19daae){_0x205fb3[_0x4ba4('0x23')]=_0x19daae;if(_0x2c2ee3[_0x4ba4('0x35')]['includeAll']){_0x382401[_0x4ba4('0x43')]=[{'all':!![]}];}return db[_0x4ba4('0x2f')]['findAll'](_0x382401);})['then'](function(_0x164d20){_0x205fb3[_0x4ba4('0x44')]=_0x164d20;return _0x205fb3;})[_0x4ba4('0x28')](respondWithFilteredResult(_0x39589d,_0x382401))[_0x4ba4('0x45')](handleError(_0x39589d,null));};exports[_0x4ba4('0x46')]=function(_0x7d0f5b,_0x4f0bf8){var _0x2a42a6={'raw':![],'where':{'id':_0x7d0f5b['params']['id']}},_0x343083={};_0x343083[_0x4ba4('0x34')]=_['keys'](db[_0x4ba4('0x2f')][_0x4ba4('0x30')]);_0x343083[_0x4ba4('0x35')]=_[_0x4ba4('0x47')](_0x7d0f5b[_0x4ba4('0x35')]);_0x343083[_0x4ba4('0x36')]=_['intersection'](_0x343083[_0x4ba4('0x34')],_0x343083[_0x4ba4('0x35')]);_0x2a42a6['attributes']=_[_0x4ba4('0x37')](_0x343083['model'],qs[_0x4ba4('0x38')](_0x7d0f5b[_0x4ba4('0x35')][_0x4ba4('0x38')]));_0x2a42a6[_0x4ba4('0x39')]=_0x2a42a6[_0x4ba4('0x39')][_0x4ba4('0x48')]?_0x2a42a6[_0x4ba4('0x39')]:_0x343083[_0x4ba4('0x34')];if(_0x7d0f5b['query']['includeAll']){_0x2a42a6[_0x4ba4('0x43')]=[{'all':!![]}];}_0x2a42a6=_['merge']({},_0x2a42a6,_0x7d0f5b[_0x4ba4('0x42')]);return db[_0x4ba4('0x2f')][_0x4ba4('0x49')](_0x2a42a6)[_0x4ba4('0x28')](handleEntityNotFound(_0x4f0bf8,null))[_0x4ba4('0x28')](respondWithResult(_0x4f0bf8,null))['catch'](handleError(_0x4f0bf8,null));};exports[_0x4ba4('0x4a')]=function(_0x329ea9,_0x44889f){return db[_0x4ba4('0x2f')]['create'](_0x329ea9[_0x4ba4('0x4b')],{})[_0x4ba4('0x28')](respondWithResult(_0x44889f,0xc9))['catch'](handleError(_0x44889f,null));};exports[_0x4ba4('0x4c')]=function(_0x5b5773,_0x5c58ca){if(_0x5b5773['body']['id']){delete _0x5b5773[_0x4ba4('0x4b')]['id'];}return db['IntegrationReport'][_0x4ba4('0x49')]({'where':{'id':_0x5b5773[_0x4ba4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c58ca,null))[_0x4ba4('0x28')](saveUpdates(_0x5b5773[_0x4ba4('0x4b')],null))['then'](respondWithResult(_0x5c58ca,null))[_0x4ba4('0x45')](handleError(_0x5c58ca,null));};exports[_0x4ba4('0x29')]=function(_0x1af9e3,_0x59b8a6){return db[_0x4ba4('0x2f')]['find']({'where':{'id':_0x1af9e3[_0x4ba4('0x4d')]['id']}})[_0x4ba4('0x28')](handleEntityNotFound(_0x59b8a6,null))[_0x4ba4('0x28')](removeEntity(_0x59b8a6,null))[_0x4ba4('0x45')](handleError(_0x59b8a6,null));};exports[_0x4ba4('0x4e')]=function(_0x281c9a,_0x44ab1b){return db['IntegrationReport'][_0x4ba4('0x4e')]()[_0x4ba4('0x28')](respondWithResult(_0x44ab1b,null))[_0x4ba4('0x45')](handleError(_0x44ab1b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c21f098..2baa296 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 _0x7d12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','api'];(function(_0x288c64,_0x23285d){var _0x535dbc=function(_0x2bc8d9){while(--_0x2bc8d9){_0x288c64['push'](_0x288c64['shift']());}};_0x535dbc(++_0x23285d);}(_0x7d12,0x1d1));var _0x27d1=function(_0x5a6497,_0xb2da19){_0x5a6497=_0x5a6497-0x0;var _0x5a4b45=_0x7d12[_0x5a6497];return _0x5a4b45;};'use strict';var _=require(_0x27d1('0x0'));var util=require(_0x27d1('0x1'));var logger=require('../../config/logger')(_0x27d1('0x2'));var moment=require(_0x27d1('0x3'));var BPromise=require(_0x27d1('0x4'));var rp=require(_0x27d1('0x5'));var fs=require('fs');var path=require(_0x27d1('0x6'));var rimraf=require(_0x27d1('0x7'));var config=require(_0x27d1('0x8'));var attributes=require(_0x27d1('0x9'));module[_0x27d1('0xa')]=function(_0x41761c,_0x457346){return _0x41761c['define'](_0x27d1('0xb'),attributes,{'tableName':_0x27d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5943=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x5af949,_0x1829db){var _0x4eecb8=function(_0x55e642){while(--_0x55e642){_0x5af949['push'](_0x5af949['shift']());}};_0x4eecb8(++_0x1829db);}(_0x5943,0x16c));var _0x3594=function(_0xbd18a3,_0x1baf74){_0xbd18a3=_0xbd18a3-0x0;var _0x16207e=_0x5943[_0xbd18a3];return _0x16207e;};'use strict';var _=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var logger=require(_0x3594('0x2'))(_0x3594('0x3'));var moment=require(_0x3594('0x4'));var BPromise=require(_0x3594('0x5'));var rp=require(_0x3594('0x6'));var fs=require('fs');var path=require(_0x3594('0x7'));var rimraf=require(_0x3594('0x8'));var config=require(_0x3594('0x9'));var attributes=require(_0x3594('0xa'));module[_0x3594('0xb')]=function(_0x4fdd40,_0xf3b897){return _0x4fdd40[_0x3594('0xc')]('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 aa5804c..29f7e3c 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b3eae,_0x41f362){var _0x3b54d9=function(_0x12bd27){while(--_0x12bd27){_0x1b3eae['push'](_0x1b3eae['shift']());}};_0x3b54d9(++_0x41f362);}(_0xda19,0xd5));var _0x9da1=function(_0x150def,_0x4414f7){_0x150def=_0x150def-0x0;var _0x32d179=_0xda19[_0x150def];return _0x32d179;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x687b,0x14a));var _0xb687=function(_0x480957,_0x2632b7){_0x480957=_0x480957-0x0;var _0x5101d3=_0x687b[_0x480957];return _0x5101d3;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2fc9634..966ffa9 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 _0x254a=['get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x9916fe,_0x1a5566){var _0x507ba8=function(_0x17e176){while(--_0x17e176){_0x9916fe['push'](_0x9916fe['shift']());}};_0x507ba8(++_0x1a5566);}(_0x254a,0x138));var _0xa254=function(_0x494f4d,_0x2807fa){_0x494f4d=_0x494f4d-0x0;var _0x3e7dfc=_0x254a[_0x494f4d];return _0x3e7dfc;};'use strict';var multer=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var path=require(_0xa254('0x2'));var timeout=require('connect-timeout');var express=require(_0xa254('0x3'));var router=express[_0xa254('0x4')]();var fs_extra=require(_0xa254('0x5'));var auth=require(_0xa254('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa254('0x7'));var controller=require('./interval.controller');router[_0xa254('0x8')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0xa')]);router['get']('/:id',auth[_0xa254('0x9')](),controller[_0xa254('0xb')]);router['get'](_0xa254('0xc'),auth['isAuthenticated'](),controller[_0xa254('0xd')]);router[_0xa254('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa254('0xe')](_0xa254('0xc'),auth[_0xa254('0x9')](),controller[_0xa254('0xf')]);router[_0xa254('0xe')]('/:id/sub_intervals/create_many',auth[_0xa254('0x9')](),controller['addIntervals']);router['put'](_0xa254('0x10'),auth[_0xa254('0x9')](),controller['update']);router[_0xa254('0x11')](_0xa254('0x10'),auth[_0xa254('0x9')](),controller[_0xa254('0x12')]);module[_0xa254('0x13')]=router; \ No newline at end of file +var _0x848e=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x221493,_0x522e03){var _0x359a1b=function(_0x485b74){while(--_0x485b74){_0x221493['push'](_0x221493['shift']());}};_0x359a1b(++_0x522e03);}(_0x848e,0x1e2));var _0xe848=function(_0x542b23,_0x5c7613){_0x542b23=_0x542b23-0x0;var _0x148946=_0x848e[_0x542b23];return _0x148946;};'use strict';var multer=require(_0xe848('0x0'));var util=require('util');var path=require(_0xe848('0x1'));var timeout=require(_0xe848('0x2'));var express=require('express');var router=express[_0xe848('0x3')]();var fs_extra=require(_0xe848('0x4'));var auth=require(_0xe848('0x5'));var interaction=require(_0xe848('0x6'));var config=require(_0xe848('0x7'));var controller=require(_0xe848('0x8'));router[_0xe848('0x9')]('/',auth[_0xe848('0xa')](),controller['index']);router[_0xe848('0x9')](_0xe848('0xb'),auth[_0xe848('0xa')](),controller['show']);router['get'](_0xe848('0xc'),auth[_0xe848('0xa')](),controller[_0xe848('0xd')]);router[_0xe848('0xe')]('/',auth['isAuthenticated'](),controller[_0xe848('0xf')]);router[_0xe848('0xe')]('/:id/sub_intervals',auth[_0xe848('0xa')](),controller[_0xe848('0x10')]);router[_0xe848('0xe')](_0xe848('0x11'),auth[_0xe848('0xa')](),controller[_0xe848('0x12')]);router[_0xe848('0x13')](_0xe848('0xb'),auth['isAuthenticated'](),controller[_0xe848('0x14')]);router[_0xe848('0x15')](_0xe848('0xb'),auth[_0xe848('0xa')](),controller[_0xe848('0x16')]);module[_0xe848('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 24c11a5..1f4a1ee 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 _0x35c0=['sequelize','exports','STRING'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x35c0,0x1a7));var _0x035c=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x35c0[_0x539fb2];return _0x4d583d;};'use strict';var Sequelize=require(_0x035c('0x0'));module[_0x035c('0x1')]={'name':{'type':Sequelize[_0x035c('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x035c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9dca=['STRING','sequelize','exports'];(function(_0x2aaa12,_0x2c36df){var _0xeb48ff=function(_0x3a2640){while(--_0x3a2640){_0x2aaa12['push'](_0x2aaa12['shift']());}};_0xeb48ff(++_0x2c36df);}(_0x9dca,0x17e));var _0xa9dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9dca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa9dc('0x0'));module[_0xa9dc('0x1')]={'name':{'type':Sequelize[_0xa9dc('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa9dc('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 8af7f1b..7398b14 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 _0x07ed=['../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','Interval','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','length','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Intervals','UserProfileSection','autoAssociation','addInterval','params','IntervalId','getIntervals','findOne','map','nolimit','addIntervals','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x07ed,0x9c));var _0xd07e=function(_0xe4e6c6,_0x45a683){_0xe4e6c6=_0xe4e6c6-0x0;var _0x175b25=_0x07ed[_0xe4e6c6];return _0x175b25;};'use strict';var emlformat=require(_0xd07e('0x0'));var rimraf=require(_0xd07e('0x1'));var zipdir=require(_0xd07e('0x2'));var jsonpatch=require(_0xd07e('0x3'));var rp=require(_0xd07e('0x4'));var moment=require(_0xd07e('0x5'));var BPromise=require(_0xd07e('0x6'));var Mustache=require('mustache');var util=require(_0xd07e('0x7'));var path=require(_0xd07e('0x8'));var sox=require(_0xd07e('0x9'));var csv=require(_0xd07e('0xa'));var ejs=require(_0xd07e('0xb'));var fs=require('fs');var fs_extra=require(_0xd07e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd07e('0xd'));var jsforce=require(_0xd07e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd07e('0xa'));var querystring=require(_0xd07e('0xf'));var Papa=require(_0xd07e('0x10'));var Redis=require(_0xd07e('0x11'));var authService=require(_0xd07e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd07e('0x13'));var hardwareService=require(_0xd07e('0x14'));var logger=require(_0xd07e('0x15'))('api');var utils=require(_0xd07e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd07e('0x17'));var db=require(_0xd07e('0x18'))['db'];var extensions=require(_0xd07e('0x19'));function respondWithStatusCode(_0x4eb56c,_0x12c8f8){_0x12c8f8=_0x12c8f8||0xcc;return function(_0x246a69){if(_0x246a69){return _0x4eb56c[_0xd07e('0x1a')](_0x12c8f8);}return _0x4eb56c[_0xd07e('0x1b')](_0x12c8f8)[_0xd07e('0x1c')]();};}function respondWithResult(_0x55a4e0,_0x4bbe51){_0x4bbe51=_0x4bbe51||0xc8;return function(_0x20903f){if(_0x20903f){return _0x55a4e0[_0xd07e('0x1b')](_0x4bbe51)[_0xd07e('0x1d')](_0x20903f);}};}function respondWithFilteredResult(_0x10aa6f,_0x1ea4eb){return function(_0xaaabc8){if(_0xaaabc8){var _0x56b9d5=typeof _0x1ea4eb[_0xd07e('0x1e')]===_0xd07e('0x1f')&&typeof _0x1ea4eb['limit']===_0xd07e('0x1f');var _0x4e714e=_0xaaabc8[_0xd07e('0x20')];var _0xfaf2da=_0x56b9d5?0x0:_0x1ea4eb[_0xd07e('0x1e')];var _0x2d6cc3=_0x56b9d5?_0xaaabc8[_0xd07e('0x20')]:_0x1ea4eb[_0xd07e('0x1e')]+_0x1ea4eb['limit'];var _0x54270c;if(_0x2d6cc3>=_0x4e714e){_0x2d6cc3=_0x4e714e;_0x54270c=0xc8;}else{_0x54270c=0xce;}_0x10aa6f[_0xd07e('0x1b')](_0x54270c);return _0x10aa6f['set']('Content-Range',_0xfaf2da+'-'+_0x2d6cc3+'/'+_0x4e714e)[_0xd07e('0x1d')](_0xaaabc8);}return null;};}function patchUpdates(_0x2c50b2){return function(_0x3cd2c1){try{jsonpatch[_0xd07e('0x21')](_0x3cd2c1,_0x2c50b2,!![]);}catch(_0x3b1ef2){return BPromise[_0xd07e('0x22')](_0x3b1ef2);}return _0x3cd2c1[_0xd07e('0x23')]();};}function saveUpdates(_0x191e89,_0x522192){return function(_0x48b0b5){if(_0x48b0b5){return _0x48b0b5[_0xd07e('0x24')](_0x191e89)[_0xd07e('0x25')](function(_0x18dbcd){return _0x18dbcd;});}return null;};}function removeEntity(_0x5dfbfe,_0x175a99){return function(_0x1bb4d0){if(_0x1bb4d0){return _0x1bb4d0[_0xd07e('0x26')]()[_0xd07e('0x25')](function(){var _0x8eccd4=_0x1bb4d0['get']({'plain':!![]});var _0xaa8c4e='Intervals';return db[_0xd07e('0x27')][_0xd07e('0x26')]({'where':{'type':_0xaa8c4e,'resourceId':_0x8eccd4['id']}})[_0xd07e('0x25')](function(){return _0x1bb4d0;});})['then'](function(){_0x5dfbfe[_0xd07e('0x1b')](0xcc)[_0xd07e('0x1c')]();});}};}function handleEntityNotFound(_0x9548e2,_0x1fdd78){return function(_0x142dff){if(!_0x142dff){_0x9548e2[_0xd07e('0x1a')](0x194);}return _0x142dff;};}function handleError(_0x38756a,_0x3de8e7){_0x3de8e7=_0x3de8e7||0x1f4;return function(_0x1494fb){logger[_0xd07e('0x28')](_0x1494fb[_0xd07e('0x29')]);if(_0x1494fb['name']){delete _0x1494fb[_0xd07e('0x2a')];}_0x38756a[_0xd07e('0x1b')](_0x3de8e7)[_0xd07e('0x2b')](_0x1494fb);};}exports['index']=function(_0x3441f2,_0x570b21){var _0x35fcd0={},_0x2f6c4a={},_0x25216b={'count':0x0,'rows':[]};var _0x3a4ee9=_['map'](db[_0xd07e('0x2c')][_0xd07e('0x2d')],function(_0x57ffd0){return{'name':_0x57ffd0[_0xd07e('0x2e')],'type':_0x57ffd0['type'][_0xd07e('0x2f')]};});_0x2f6c4a[_0xd07e('0x30')]=_['map'](_0x3a4ee9,_0xd07e('0x2a'));_0x2f6c4a['query']=_[_0xd07e('0x31')](_0x3441f2[_0xd07e('0x32')]);_0x2f6c4a[_0xd07e('0x33')]=_[_0xd07e('0x34')](_0x2f6c4a[_0xd07e('0x30')],_0x2f6c4a[_0xd07e('0x32')]);_0x35fcd0[_0xd07e('0x35')]=_['intersection'](_0x2f6c4a[_0xd07e('0x30')],qs[_0xd07e('0x36')](_0x3441f2[_0xd07e('0x32')][_0xd07e('0x36')]));_0x35fcd0['attributes']=_0x35fcd0[_0xd07e('0x35')]['length']?_0x35fcd0[_0xd07e('0x35')]:_0x2f6c4a[_0xd07e('0x30')];if(!_0x3441f2[_0xd07e('0x32')]['hasOwnProperty']('nolimit')){_0x35fcd0[_0xd07e('0x37')]=qs[_0xd07e('0x37')](_0x3441f2['query'][_0xd07e('0x37')]);_0x35fcd0['offset']=qs[_0xd07e('0x1e')](_0x3441f2[_0xd07e('0x32')][_0xd07e('0x1e')]);}_0x35fcd0[_0xd07e('0x38')]=qs[_0xd07e('0x39')](_0x3441f2['query']['sort']);_0x35fcd0[_0xd07e('0x3a')]=qs[_0xd07e('0x33')](_[_0xd07e('0x3b')](_0x3441f2['query'],_0x2f6c4a[_0xd07e('0x33')]),_0x3a4ee9);if(_0x3441f2['query'][_0xd07e('0x3c')]){_0x35fcd0[_0xd07e('0x3a')]=_['merge'](_0x35fcd0['where'],{'$or':_['map'](_0x3a4ee9,function(_0x1deaef){if(_0x1deaef[_0xd07e('0x3d')]!==_0xd07e('0x3e')){var _0xf58982={};_0xf58982[_0x1deaef[_0xd07e('0x2a')]]={'$like':'%'+_0x3441f2['query'][_0xd07e('0x3c')]+'%'};return _0xf58982;}})});}_0x35fcd0=_['merge']({},_0x35fcd0,_0x3441f2['options']);var _0x14e803={'where':_0x35fcd0[_0xd07e('0x3a')]};return db['Interval'][_0xd07e('0x20')](_0x14e803)['then'](function(_0x43c6da){_0x25216b[_0xd07e('0x20')]=_0x43c6da;if(_0x3441f2[_0xd07e('0x32')][_0xd07e('0x3f')]){_0x35fcd0[_0xd07e('0x40')]=[{'all':!![]}];}return db['Interval'][_0xd07e('0x41')](_0x35fcd0);})[_0xd07e('0x25')](function(_0x241843){_0x25216b[_0xd07e('0x42')]=_0x241843;return _0x25216b;})[_0xd07e('0x25')](respondWithFilteredResult(_0x570b21,_0x35fcd0))['catch'](handleError(_0x570b21,null));};exports[_0xd07e('0x43')]=function(_0x3d69e7,_0x962bdb){var _0x41bfd4={'raw':!![],'where':{'id':_0x3d69e7['params']['id']}},_0x4a7423={};_0x4a7423['model']=_['keys'](db[_0xd07e('0x2c')][_0xd07e('0x2d')]);_0x4a7423[_0xd07e('0x32')]=_[_0xd07e('0x31')](_0x3d69e7[_0xd07e('0x32')]);_0x4a7423['filters']=_['intersection'](_0x4a7423[_0xd07e('0x30')],_0x4a7423[_0xd07e('0x32')]);_0x41bfd4[_0xd07e('0x35')]=_[_0xd07e('0x34')](_0x4a7423[_0xd07e('0x30')],qs[_0xd07e('0x36')](_0x3d69e7[_0xd07e('0x32')][_0xd07e('0x36')]));_0x41bfd4[_0xd07e('0x35')]=_0x41bfd4[_0xd07e('0x35')][_0xd07e('0x44')]?_0x41bfd4[_0xd07e('0x35')]:_0x4a7423['model'];if(_0x3d69e7[_0xd07e('0x32')][_0xd07e('0x3f')]){_0x41bfd4[_0xd07e('0x40')]=[{'all':!![]}];}_0x41bfd4=_[_0xd07e('0x45')]({},_0x41bfd4,_0x3d69e7[_0xd07e('0x46')]);return db[_0xd07e('0x2c')][_0xd07e('0x47')](_0x41bfd4)['then'](handleEntityNotFound(_0x962bdb,null))[_0xd07e('0x25')](respondWithResult(_0x962bdb,null))[_0xd07e('0x48')](handleError(_0x962bdb,null));};exports[_0xd07e('0x49')]=function(_0x4658b9,_0x3f60d6){return db[_0xd07e('0x2c')][_0xd07e('0x49')](_0x4658b9[_0xd07e('0x4a')],{})[_0xd07e('0x25')](function(_0x5834d3){var _0x4627e6=_0x4658b9[_0xd07e('0x4b')]['get']({'plain':!![]});if(!_0x4627e6)throw new Error(_0xd07e('0x4c'));if(_0x4627e6['role']===_0xd07e('0x4b')){var _0x19156d=_0x5834d3[_0xd07e('0x4d')]({'plain':!![]});var _0x5a75be=_0xd07e('0x4e');return db[_0xd07e('0x4f')][_0xd07e('0x47')]({'where':{'name':_0x5a75be,'userProfileId':_0x4627e6['userProfileId']},'raw':!![]})[_0xd07e('0x25')](function(_0x36b648){if(_0x36b648&&_0x36b648[_0xd07e('0x50')]===0x0){return db[_0xd07e('0x27')][_0xd07e('0x49')]({'name':_0x19156d[_0xd07e('0x2a')],'resourceId':_0x19156d['id'],'type':_0x36b648['name'],'sectionId':_0x36b648['id']},{})[_0xd07e('0x25')](function(){return _0x5834d3;});}else{return _0x5834d3;}})[_0xd07e('0x48')](function(_0x12eb9c){logger[_0xd07e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12eb9c);throw _0x12eb9c;});}return _0x5834d3;})[_0xd07e('0x25')](respondWithResult(_0x3f60d6,0xc9))[_0xd07e('0x48')](handleError(_0x3f60d6,null));};exports[_0xd07e('0x24')]=function(_0x1ecc92,_0x679df2){if(_0x1ecc92['body']['id']){delete _0x1ecc92[_0xd07e('0x4a')]['id'];}return db[_0xd07e('0x2c')][_0xd07e('0x47')]({'where':{'id':_0x1ecc92['params']['id']}})[_0xd07e('0x25')](handleEntityNotFound(_0x679df2,null))[_0xd07e('0x25')](saveUpdates(_0x1ecc92[_0xd07e('0x4a')],null))[_0xd07e('0x25')](respondWithResult(_0x679df2,null))[_0xd07e('0x48')](handleError(_0x679df2,null));};exports[_0xd07e('0x26')]=function(_0x3cb765,_0x4f4ded){return db['Interval'][_0xd07e('0x47')]({'where':{'id':_0x3cb765['params']['id']}})[_0xd07e('0x25')](handleEntityNotFound(_0x4f4ded,null))[_0xd07e('0x25')](removeEntity(_0x4f4ded,null))[_0xd07e('0x48')](handleError(_0x4f4ded,null));};exports[_0xd07e('0x51')]=function(_0x5e0e00,_0x224562,_0x3093c9){if(_0x5e0e00['body']['id']){delete _0x5e0e00[_0xd07e('0x4a')]['id'];}return db[_0xd07e('0x2c')]['find']({'where':{'id':_0x5e0e00[_0xd07e('0x52')]['id']}})[_0xd07e('0x25')](handleEntityNotFound(_0x224562,null))[_0xd07e('0x25')](function(_0xe0cb1a){if(_0xe0cb1a){_0x5e0e00['body'][_0xd07e('0x53')]=_0xe0cb1a['id'];return db[_0xd07e('0x2c')][_0xd07e('0x49')](_0x5e0e00[_0xd07e('0x4a')]);}})['then'](respondWithResult(_0x224562,null))[_0xd07e('0x48')](handleError(_0x224562,null));};exports[_0xd07e('0x54')]=function(_0x423646,_0x2ed683,_0x2eebf9){var _0x24ea81={};var _0x5a81b1={};var _0x12233c;var _0x201950;return db[_0xd07e('0x2c')][_0xd07e('0x55')]({'where':{'id':_0x423646['params']['id']}})['then'](handleEntityNotFound(_0x2ed683,null))[_0xd07e('0x25')](function(_0x75d0a4){if(_0x75d0a4){_0x12233c=_0x75d0a4;_0x5a81b1[_0xd07e('0x30')]=_[_0xd07e('0x31')](db[_0xd07e('0x2c')][_0xd07e('0x2d')]);_0x5a81b1[_0xd07e('0x32')]=_[_0xd07e('0x31')](_0x423646[_0xd07e('0x32')]);_0x5a81b1['filters']=_[_0xd07e('0x34')](_0x5a81b1[_0xd07e('0x30')],_0x5a81b1['query']);_0x24ea81[_0xd07e('0x35')]=_[_0xd07e('0x34')](_0x5a81b1[_0xd07e('0x30')],qs[_0xd07e('0x36')](_0x423646[_0xd07e('0x32')][_0xd07e('0x36')]));_0x24ea81[_0xd07e('0x35')]=_0x24ea81[_0xd07e('0x35')][_0xd07e('0x44')]?_0x24ea81[_0xd07e('0x35')]:_0x5a81b1[_0xd07e('0x30')];_0x24ea81[_0xd07e('0x38')]=qs[_0xd07e('0x39')](_0x423646[_0xd07e('0x32')][_0xd07e('0x39')]);_0x24ea81['where']=qs['filters'](_[_0xd07e('0x3b')](_0x423646['query'],_0x5a81b1[_0xd07e('0x33')]));if(_0x423646[_0xd07e('0x32')][_0xd07e('0x3c')]){_0x24ea81['where']=_[_0xd07e('0x45')](_0x24ea81[_0xd07e('0x3a')],{'$or':_[_0xd07e('0x56')](_0x24ea81[_0xd07e('0x35')],function(_0x197316){var _0x48f15f={};_0x48f15f[_0x197316]={'$like':'%'+_0x423646[_0xd07e('0x32')][_0xd07e('0x3c')]+'%'};return _0x48f15f;})});}_0x24ea81=_['merge']({},_0x24ea81,_0x423646[_0xd07e('0x46')]);return _0x12233c[_0xd07e('0x54')](_0x24ea81);}})[_0xd07e('0x25')](function(_0x524c85){if(_0x524c85){_0x201950=_0x524c85[_0xd07e('0x44')];if(!_0x423646[_0xd07e('0x32')]['hasOwnProperty'](_0xd07e('0x57'))){_0x24ea81[_0xd07e('0x37')]=qs[_0xd07e('0x37')](_0x423646[_0xd07e('0x32')][_0xd07e('0x37')]);_0x24ea81[_0xd07e('0x1e')]=qs[_0xd07e('0x1e')](_0x423646[_0xd07e('0x32')]['offset']);}return _0x12233c['getIntervals'](_0x24ea81);}})[_0xd07e('0x25')](function(_0x41d261){if(_0x41d261){return _0x41d261?{'count':_0x201950,'rows':_0x41d261}:null;}})[_0xd07e('0x25')](respondWithResult(_0x2ed683,null))[_0xd07e('0x48')](handleError(_0x2ed683,null));};exports[_0xd07e('0x58')]=function(_0x507d01,_0x4236e3,_0x3cd06e){return db[_0xd07e('0x2c')][_0xd07e('0x55')]({'where':{'id':_0x507d01['params']['id']}})[_0xd07e('0x25')](handleEntityNotFound(_0x4236e3,null))[_0xd07e('0x25')](function(_0x43ec86){if(_0x43ec86){return db['sequelize']['transaction'](function(_0x4b8808){return db[_0xd07e('0x2c')][_0xd07e('0x26')]({'where':{'IntervalId':_0x507d01['params']['id']},'transaction':_0x4b8808})[_0xd07e('0x25')](function(_0x54ee2e){var _0x5a2b0d=_[_0xd07e('0x56')](_0x507d01[_0xd07e('0x4a')],function(_0xcd592d){delete _0xcd592d['id'];_0xcd592d[_0xd07e('0x53')]=_0x507d01['params']['id'];return _0xcd592d;});return db[_0xd07e('0x2c')][_0xd07e('0x59')](_0x5a2b0d,{'transaction':_0x4b8808});});})[_0xd07e('0x25')](function(){return db['Interval'][_0xd07e('0x41')]({'where':{'IntervalId':_0x507d01[_0xd07e('0x52')]['id']}});});}})[_0xd07e('0x25')](respondWithResult(_0x4236e3,null))['catch'](handleError(_0x4236e3,null));}; \ No newline at end of file +var _0xcc43=['IntervalId','getIntervals','findOne','pick','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','error','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','catch','params','find','create','body','user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','destroy','addInterval'];(function(_0x3eb9d6,_0x1995b8){var _0x1329eb=function(_0x2d3287){while(--_0x2d3287){_0x3eb9d6['push'](_0x3eb9d6['shift']());}};_0x1329eb(++_0x1995b8);}(_0xcc43,0x16a));var _0x3cc4=function(_0x517a2d,_0x21e839){_0x517a2d=_0x517a2d-0x0;var _0x42498c=_0xcc43[_0x517a2d];return _0x42498c;};'use strict';var emlformat=require(_0x3cc4('0x0'));var rimraf=require(_0x3cc4('0x1'));var zipdir=require(_0x3cc4('0x2'));var jsonpatch=require(_0x3cc4('0x3'));var rp=require(_0x3cc4('0x4'));var moment=require(_0x3cc4('0x5'));var BPromise=require(_0x3cc4('0x6'));var Mustache=require(_0x3cc4('0x7'));var util=require(_0x3cc4('0x8'));var path=require(_0x3cc4('0x9'));var sox=require(_0x3cc4('0xa'));var csv=require(_0x3cc4('0xb'));var ejs=require(_0x3cc4('0xc'));var fs=require('fs');var fs_extra=require(_0x3cc4('0xd'));var _=require(_0x3cc4('0xe'));var squel=require(_0x3cc4('0xf'));var crypto=require('crypto');var jsforce=require(_0x3cc4('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3cc4('0x11'));var Papa=require(_0x3cc4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3cc4('0x13'));var as=require(_0x3cc4('0x14'));var hardwareService=require(_0x3cc4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3cc4('0x16'));var config=require(_0x3cc4('0x17'));var licenseUtil=require(_0x3cc4('0x18'));var db=require(_0x3cc4('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2a942c,_0x3708c5){_0x3708c5=_0x3708c5||0xcc;return function(_0x11c230){if(_0x11c230){return _0x2a942c[_0x3cc4('0x1a')](_0x3708c5);}return _0x2a942c[_0x3cc4('0x1b')](_0x3708c5)[_0x3cc4('0x1c')]();};}function respondWithResult(_0x32bd57,_0x34b9db){_0x34b9db=_0x34b9db||0xc8;return function(_0x369543){if(_0x369543){return _0x32bd57[_0x3cc4('0x1b')](_0x34b9db)['json'](_0x369543);}};}function respondWithFilteredResult(_0x1f24ca,_0x16e0f5){return function(_0x23ce97){if(_0x23ce97){var _0xed928=typeof _0x16e0f5[_0x3cc4('0x1d')]==='undefined'&&typeof _0x16e0f5['limit']===_0x3cc4('0x1e');var _0x12b247=_0x23ce97[_0x3cc4('0x1f')];var _0x40aa01=_0xed928?0x0:_0x16e0f5[_0x3cc4('0x1d')];var _0x3cfba2=_0xed928?_0x23ce97[_0x3cc4('0x1f')]:_0x16e0f5[_0x3cc4('0x1d')]+_0x16e0f5[_0x3cc4('0x20')];var _0x13cae4;if(_0x3cfba2>=_0x12b247){_0x3cfba2=_0x12b247;_0x13cae4=0xc8;}else{_0x13cae4=0xce;}_0x1f24ca[_0x3cc4('0x1b')](_0x13cae4);return _0x1f24ca['set'](_0x3cc4('0x21'),_0x40aa01+'-'+_0x3cfba2+'/'+_0x12b247)[_0x3cc4('0x22')](_0x23ce97);}return null;};}function patchUpdates(_0xdedc6e){return function(_0x10a729){try{jsonpatch[_0x3cc4('0x23')](_0x10a729,_0xdedc6e,!![]);}catch(_0x5a6148){return BPromise[_0x3cc4('0x24')](_0x5a6148);}return _0x10a729[_0x3cc4('0x25')]();};}function saveUpdates(_0x2c9456,_0x52c868){return function(_0x30b67c){if(_0x30b67c){return _0x30b67c[_0x3cc4('0x26')](_0x2c9456)[_0x3cc4('0x27')](function(_0x36f699){return _0x36f699;});}return null;};}function removeEntity(_0x38f4fd,_0x1cd39a){return function(_0x364c9b){if(_0x364c9b){return _0x364c9b['destroy']()['then'](function(){var _0x558e37=_0x364c9b[_0x3cc4('0x28')]({'plain':!![]});var _0x211861='Intervals';return db[_0x3cc4('0x29')]['destroy']({'where':{'type':_0x211861,'resourceId':_0x558e37['id']}})['then'](function(){return _0x364c9b;});})[_0x3cc4('0x27')](function(){_0x38f4fd[_0x3cc4('0x1b')](0xcc)[_0x3cc4('0x1c')]();});}};}function handleEntityNotFound(_0x16d6b4,_0x26a8e0){return function(_0x16fbfc){if(!_0x16fbfc){_0x16d6b4['sendStatus'](0x194);}return _0x16fbfc;};}function handleError(_0x24af94,_0x47111d){_0x47111d=_0x47111d||0x1f4;return function(_0x4da71f){logger[_0x3cc4('0x2a')](_0x4da71f['stack']);if(_0x4da71f[_0x3cc4('0x2b')]){delete _0x4da71f[_0x3cc4('0x2b')];}_0x24af94[_0x3cc4('0x1b')](_0x47111d)['send'](_0x4da71f);};}exports[_0x3cc4('0x2c')]=function(_0x220acb,_0x3fd21d){var _0x24ca02={},_0x141635={},_0x43e3c0={'count':0x0,'rows':[]};var _0x191eab=_[_0x3cc4('0x2d')](db[_0x3cc4('0x2e')][_0x3cc4('0x2f')],function(_0x180ff3){return{'name':_0x180ff3[_0x3cc4('0x30')],'type':_0x180ff3[_0x3cc4('0x31')][_0x3cc4('0x32')]};});_0x141635[_0x3cc4('0x33')]=_[_0x3cc4('0x2d')](_0x191eab,_0x3cc4('0x2b'));_0x141635[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0x220acb[_0x3cc4('0x34')]);_0x141635['filters']=_[_0x3cc4('0x36')](_0x141635['model'],_0x141635[_0x3cc4('0x34')]);_0x24ca02[_0x3cc4('0x37')]=_[_0x3cc4('0x36')](_0x141635[_0x3cc4('0x33')],qs[_0x3cc4('0x38')](_0x220acb['query']['fields']));_0x24ca02[_0x3cc4('0x37')]=_0x24ca02['attributes'][_0x3cc4('0x39')]?_0x24ca02[_0x3cc4('0x37')]:_0x141635[_0x3cc4('0x33')];if(!_0x220acb['query'][_0x3cc4('0x3a')](_0x3cc4('0x3b'))){_0x24ca02[_0x3cc4('0x20')]=qs[_0x3cc4('0x20')](_0x220acb['query'][_0x3cc4('0x20')]);_0x24ca02[_0x3cc4('0x1d')]=qs[_0x3cc4('0x1d')](_0x220acb[_0x3cc4('0x34')][_0x3cc4('0x1d')]);}_0x24ca02[_0x3cc4('0x3c')]=qs['sort'](_0x220acb[_0x3cc4('0x34')][_0x3cc4('0x3d')]);_0x24ca02[_0x3cc4('0x3e')]=qs[_0x3cc4('0x3f')](_['pick'](_0x220acb[_0x3cc4('0x34')],_0x141635[_0x3cc4('0x3f')]),_0x191eab);if(_0x220acb[_0x3cc4('0x34')]['filter']){_0x24ca02[_0x3cc4('0x3e')]=_[_0x3cc4('0x40')](_0x24ca02[_0x3cc4('0x3e')],{'$or':_[_0x3cc4('0x2d')](_0x191eab,function(_0x57136b){if(_0x57136b['type']!=='VIRTUAL'){var _0xa7c750={};_0xa7c750[_0x57136b[_0x3cc4('0x2b')]]={'$like':'%'+_0x220acb['query'][_0x3cc4('0x41')]+'%'};return _0xa7c750;}})});}_0x24ca02=_['merge']({},_0x24ca02,_0x220acb[_0x3cc4('0x42')]);var _0x3612c1={'where':_0x24ca02[_0x3cc4('0x3e')]};return db[_0x3cc4('0x2e')]['count'](_0x3612c1)[_0x3cc4('0x27')](function(_0x3ade4e){_0x43e3c0[_0x3cc4('0x1f')]=_0x3ade4e;if(_0x220acb['query'][_0x3cc4('0x43')]){_0x24ca02[_0x3cc4('0x44')]=[{'all':!![]}];}return db[_0x3cc4('0x2e')][_0x3cc4('0x45')](_0x24ca02);})[_0x3cc4('0x27')](function(_0x506e91){_0x43e3c0['rows']=_0x506e91;return _0x43e3c0;})[_0x3cc4('0x27')](respondWithFilteredResult(_0x3fd21d,_0x24ca02))[_0x3cc4('0x46')](handleError(_0x3fd21d,null));};exports['show']=function(_0xcfecd3,_0x1e0780){var _0x128e18={'raw':!![],'where':{'id':_0xcfecd3[_0x3cc4('0x47')]['id']}},_0x2246b8={};_0x2246b8[_0x3cc4('0x33')]=_['keys'](db[_0x3cc4('0x2e')]['rawAttributes']);_0x2246b8[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0xcfecd3[_0x3cc4('0x34')]);_0x2246b8[_0x3cc4('0x3f')]=_['intersection'](_0x2246b8[_0x3cc4('0x33')],_0x2246b8[_0x3cc4('0x34')]);_0x128e18['attributes']=_[_0x3cc4('0x36')](_0x2246b8[_0x3cc4('0x33')],qs['fields'](_0xcfecd3[_0x3cc4('0x34')][_0x3cc4('0x38')]));_0x128e18[_0x3cc4('0x37')]=_0x128e18[_0x3cc4('0x37')][_0x3cc4('0x39')]?_0x128e18[_0x3cc4('0x37')]:_0x2246b8[_0x3cc4('0x33')];if(_0xcfecd3[_0x3cc4('0x34')]['includeAll']){_0x128e18[_0x3cc4('0x44')]=[{'all':!![]}];}_0x128e18=_[_0x3cc4('0x40')]({},_0x128e18,_0xcfecd3[_0x3cc4('0x42')]);return db[_0x3cc4('0x2e')][_0x3cc4('0x48')](_0x128e18)[_0x3cc4('0x27')](handleEntityNotFound(_0x1e0780,null))[_0x3cc4('0x27')](respondWithResult(_0x1e0780,null))[_0x3cc4('0x46')](handleError(_0x1e0780,null));};exports['create']=function(_0x464bbb,_0xa89b45){return db[_0x3cc4('0x2e')][_0x3cc4('0x49')](_0x464bbb[_0x3cc4('0x4a')],{})[_0x3cc4('0x27')](function(_0x5163ce){var _0x3f7058=_0x464bbb[_0x3cc4('0x4b')][_0x3cc4('0x28')]({'plain':!![]});if(!_0x3f7058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f7058[_0x3cc4('0x4c')]===_0x3cc4('0x4b')){var _0x5d4f9d=_0x5163ce[_0x3cc4('0x28')]({'plain':!![]});var _0x4e743e=_0x3cc4('0x4d');return db[_0x3cc4('0x4e')]['find']({'where':{'name':_0x4e743e,'userProfileId':_0x3f7058[_0x3cc4('0x4f')]},'raw':!![]})[_0x3cc4('0x27')](function(_0x21b1c2){if(_0x21b1c2&&_0x21b1c2[_0x3cc4('0x50')]===0x0){return db[_0x3cc4('0x29')][_0x3cc4('0x49')]({'name':_0x5d4f9d['name'],'resourceId':_0x5d4f9d['id'],'type':_0x21b1c2[_0x3cc4('0x2b')],'sectionId':_0x21b1c2['id']},{})[_0x3cc4('0x27')](function(){return _0x5163ce;});}else{return _0x5163ce;}})[_0x3cc4('0x46')](function(_0x5660e8){logger[_0x3cc4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5660e8);throw _0x5660e8;});}return _0x5163ce;})[_0x3cc4('0x27')](respondWithResult(_0xa89b45,0xc9))[_0x3cc4('0x46')](handleError(_0xa89b45,null));};exports['update']=function(_0x445848,_0x31e2fd){if(_0x445848['body']['id']){delete _0x445848[_0x3cc4('0x4a')]['id'];}return db['Interval'][_0x3cc4('0x48')]({'where':{'id':_0x445848[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x31e2fd,null))['then'](saveUpdates(_0x445848[_0x3cc4('0x4a')],null))[_0x3cc4('0x27')](respondWithResult(_0x31e2fd,null))[_0x3cc4('0x46')](handleError(_0x31e2fd,null));};exports[_0x3cc4('0x51')]=function(_0x20f7db,_0x68bcb6){return db['Interval'][_0x3cc4('0x48')]({'where':{'id':_0x20f7db['params']['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x68bcb6,null))[_0x3cc4('0x27')](removeEntity(_0x68bcb6,null))[_0x3cc4('0x46')](handleError(_0x68bcb6,null));};exports[_0x3cc4('0x52')]=function(_0x6c08ac,_0x678ce3,_0x3bff60){if(_0x6c08ac['body']['id']){delete _0x6c08ac[_0x3cc4('0x4a')]['id'];}return db[_0x3cc4('0x2e')][_0x3cc4('0x48')]({'where':{'id':_0x6c08ac[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x678ce3,null))['then'](function(_0x30ab97){if(_0x30ab97){_0x6c08ac[_0x3cc4('0x4a')][_0x3cc4('0x53')]=_0x30ab97['id'];return db[_0x3cc4('0x2e')]['create'](_0x6c08ac[_0x3cc4('0x4a')]);}})[_0x3cc4('0x27')](respondWithResult(_0x678ce3,null))[_0x3cc4('0x46')](handleError(_0x678ce3,null));};exports[_0x3cc4('0x54')]=function(_0x568745,_0x3c83c7,_0x548290){var _0x107263={};var _0x287818={};var _0x5e60a0;var _0x5daaf2;return db['Interval'][_0x3cc4('0x55')]({'where':{'id':_0x568745[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x3c83c7,null))[_0x3cc4('0x27')](function(_0x4bff00){if(_0x4bff00){_0x5e60a0=_0x4bff00;_0x287818[_0x3cc4('0x33')]=_[_0x3cc4('0x35')](db[_0x3cc4('0x2e')][_0x3cc4('0x2f')]);_0x287818[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0x568745[_0x3cc4('0x34')]);_0x287818['filters']=_[_0x3cc4('0x36')](_0x287818['model'],_0x287818[_0x3cc4('0x34')]);_0x107263[_0x3cc4('0x37')]=_[_0x3cc4('0x36')](_0x287818[_0x3cc4('0x33')],qs[_0x3cc4('0x38')](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x38')]));_0x107263['attributes']=_0x107263[_0x3cc4('0x37')][_0x3cc4('0x39')]?_0x107263[_0x3cc4('0x37')]:_0x287818['model'];_0x107263[_0x3cc4('0x3c')]=qs[_0x3cc4('0x3d')](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x3d')]);_0x107263['where']=qs[_0x3cc4('0x3f')](_[_0x3cc4('0x56')](_0x568745[_0x3cc4('0x34')],_0x287818['filters']));if(_0x568745[_0x3cc4('0x34')][_0x3cc4('0x41')]){_0x107263[_0x3cc4('0x3e')]=_[_0x3cc4('0x40')](_0x107263['where'],{'$or':_[_0x3cc4('0x2d')](_0x107263[_0x3cc4('0x37')],function(_0x125363){var _0x1fe824={};_0x1fe824[_0x125363]={'$like':'%'+_0x568745[_0x3cc4('0x34')][_0x3cc4('0x41')]+'%'};return _0x1fe824;})});}_0x107263=_[_0x3cc4('0x40')]({},_0x107263,_0x568745[_0x3cc4('0x42')]);return _0x5e60a0[_0x3cc4('0x54')](_0x107263);}})[_0x3cc4('0x27')](function(_0x4f1db4){if(_0x4f1db4){_0x5daaf2=_0x4f1db4[_0x3cc4('0x39')];if(!_0x568745[_0x3cc4('0x34')][_0x3cc4('0x3a')](_0x3cc4('0x3b'))){_0x107263[_0x3cc4('0x20')]=qs[_0x3cc4('0x20')](_0x568745['query']['limit']);_0x107263[_0x3cc4('0x1d')]=qs['offset'](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x1d')]);}return _0x5e60a0[_0x3cc4('0x54')](_0x107263);}})[_0x3cc4('0x27')](function(_0x378828){if(_0x378828){return _0x378828?{'count':_0x5daaf2,'rows':_0x378828}:null;}})['then'](respondWithResult(_0x3c83c7,null))['catch'](handleError(_0x3c83c7,null));};exports[_0x3cc4('0x57')]=function(_0x201d1d,_0x3b0388,_0x37b9f1){return db[_0x3cc4('0x2e')][_0x3cc4('0x55')]({'where':{'id':_0x201d1d[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x3b0388,null))[_0x3cc4('0x27')](function(_0x4a14f8){if(_0x4a14f8){return db['sequelize'][_0x3cc4('0x58')](function(_0x2d6e5f){return db[_0x3cc4('0x2e')][_0x3cc4('0x51')]({'where':{'IntervalId':_0x201d1d[_0x3cc4('0x47')]['id']},'transaction':_0x2d6e5f})[_0x3cc4('0x27')](function(_0x756fa7){var _0x5146e8=_['map'](_0x201d1d[_0x3cc4('0x4a')],function(_0x90730a){delete _0x90730a['id'];_0x90730a[_0x3cc4('0x53')]=_0x201d1d['params']['id'];return _0x90730a;});return db[_0x3cc4('0x2e')]['bulkCreate'](_0x5146e8,{'transaction':_0x2d6e5f});});})[_0x3cc4('0x27')](function(){return db[_0x3cc4('0x2e')][_0x3cc4('0x45')]({'where':{'IntervalId':_0x201d1d[_0x3cc4('0x47')]['id']}});});}})[_0x3cc4('0x27')](respondWithResult(_0x3b0388,null))[_0x3cc4('0x46')](handleError(_0x3b0388,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bdb9e6f..3e4d142 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 _0x3376=['lodash','util','api','moment','request-promise','path','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite'];(function(_0x3ac322,_0xe480e2){var _0x58d119=function(_0x2b6f42){while(--_0x2b6f42){_0x3ac322['push'](_0x3ac322['shift']());}};_0x58d119(++_0xe480e2);}(_0x3376,0xe7));var _0x6337=function(_0x47922d,_0x28b05d){_0x47922d=_0x47922d-0x0;var _0xdba4ca=_0x3376[_0x47922d];return _0xdba4ca;};'use strict';var _=require(_0x6337('0x0'));var util=require(_0x6337('0x1'));var logger=require('../../config/logger')(_0x6337('0x2'));var moment=require(_0x6337('0x3'));var BPromise=require('bluebird');var rp=require(_0x6337('0x4'));var fs=require('fs');var path=require(_0x6337('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x6337('0x6'));module[_0x6337('0x7')]=function(_0x32cef0,_0x492eb9){return _0x32cef0[_0x6337('0x8')]('Interval',attributes,{'tableName':_0x6337('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9f489f,_0x5109b9){extensions['rewrite'](_0x32cef0,_0x9f489f);},'afterBulkCreate':function(_0x84b828,_0x59195a,_0x338bf8){_0x338bf8();extensions[_0x6337('0xa')](_0x32cef0,_0x84b828[0x0]);},'afterUpdate':function(_0x11e464,_0x28c775){extensions[_0x6337('0xa')](_0x32cef0,_0x11e464);},'afterDestroy':function(_0x16ad5a,_0x38db7f){extensions[_0x6337('0xa')](_0x32cef0,_0x16ad5a);}}});}; \ No newline at end of file +var _0x3dd2=['define','Interval','tools_intervals','rewrite','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x233b27,_0x112d95){var _0x173764=function(_0x1a42ae){while(--_0x1a42ae){_0x233b27['push'](_0x233b27['shift']());}};_0x173764(++_0x112d95);}(_0x3dd2,0x93));var _0x23dd=function(_0x3fa308,_0x1816e5){_0x3fa308=_0x3fa308-0x0;var _0x4eba5c=_0x3dd2[_0x3fa308];return _0x4eba5c;};'use strict';var _=require(_0x23dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x23dd('0x1'));var moment=require(_0x23dd('0x2'));var BPromise=require(_0x23dd('0x3'));var rp=require(_0x23dd('0x4'));var fs=require('fs');var path=require(_0x23dd('0x5'));var rimraf=require('rimraf');var config=require(_0x23dd('0x6'));var attributes=require(_0x23dd('0x7'));var extensions=require(_0x23dd('0x8'));module['exports']=function(_0x5bbd4c,_0x5d7d3d){return _0x5bbd4c[_0x23dd('0x9')](_0x23dd('0xa'),attributes,{'tableName':_0x23dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x62bcb3,_0x30dbd2){extensions['rewrite'](_0x5bbd4c,_0x62bcb3);},'afterBulkCreate':function(_0x4cb83b,_0x5438e1,_0x319e61){_0x319e61();extensions[_0x23dd('0xc')](_0x5bbd4c,_0x4cb83b[0x0]);},'afterUpdate':function(_0x412406,_0x5aeedf){extensions[_0x23dd('0xc')](_0x5bbd4c,_0x412406);},'afterDestroy':function(_0x6a3231,_0x468ccb){extensions[_0x23dd('0xc')](_0x5bbd4c,_0x6a3231);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a014927..c77af56 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(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_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 diff --git a/server/api/jira/index.js b/server/api/jira/index.js index aa3ee5b..08c96ce 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(_0x4e1893,_0xf8ae72){var _0x1545d5=function(_0x525093){while(--_0x525093){_0x4e1893['push'](_0x4e1893['shift']());}};_0x1545d5(++_0xf8ae72);}(_0x2032,0xd9));var _0x2203=function(_0x2d9b9a,_0x1d7e97){_0x2d9b9a=_0x2d9b9a-0x0;var _0x1af01e=_0x2032[_0x2d9b9a];return _0x1af01e;};'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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('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 40381d2..b6fb4fa 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 _0x8d5c=['summary','Report','\x20from\x20','description','stringify','issuetype','customfield_11500','email','oldToken','fields','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','utf8','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8d5c,0xde));var _0xc8d5=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0x8d5c[_0x4e7c2];return _0x84bb35;};'use strict';var BPromise=require(_0xc8d5('0x0'));var https=require(_0xc8d5('0x1'));var logger=require(_0xc8d5('0x2'))(_0xc8d5('0x3'));var USERNAME=_0xc8d5('0x4');var PASSWORD=_0xc8d5('0x5');function openIssue(_0x3d1a43,_0x5d760b){var _0x3637f5={'fields':{'project':{'key':_0x3d1a43[_0xc8d5('0x6')]||_0xc8d5('0x7')},'summary':(_0x3d1a43[_0xc8d5('0x8')]||_0xc8d5('0x9'))+_0xc8d5('0xa')+_0x3d1a43['ip'],'description':_0x3d1a43[_0xc8d5('0xb')]||JSON[_0xc8d5('0xc')](_0x3d1a43),'issuetype':{'name':_0x3d1a43[_0xc8d5('0xd')]||'Bug'}}};_0x3637f5['fields'][_0xc8d5('0xe')]=_0x3d1a43[_0xc8d5('0xf')];_0x3637f5['fields']['customfield_11501']=_0x3d1a43[_0xc8d5('0x10')];_0x3637f5[_0xc8d5('0x11')][_0xc8d5('0x12')]=_0x3d1a43[_0xc8d5('0x13')];_0x3637f5[_0xc8d5('0x11')][_0xc8d5('0x14')]=_0x3d1a43[_0xc8d5('0x15')];_0x3637f5[_0xc8d5('0x11')]['customfield_11504']=_0x3d1a43[_0xc8d5('0x16')];_0x3637f5[_0xc8d5('0x11')][_0xc8d5('0x17')]=_0x3d1a43['ip'];var _0x2f26aa={'host':_0xc8d5('0x18'),'port':0x1bb,'path':_0xc8d5('0x19'),'method':_0xc8d5('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xc8d5('0x1b'),'Authorization':_0xc8d5('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0xc8d5('0x1d')](_0xc8d5('0x1e'))}};var _0x441a37=JSON[_0xc8d5('0xc')](_0x3637f5);var _0x26d34c=https['request'](_0x2f26aa,function(_0x38a4c2){_0x38a4c2['setEncoding'](_0xc8d5('0x1f'));var _0x340633='';_0x38a4c2['on']('data',function(_0x57c478){_0x340633+=_0x57c478;});_0x38a4c2['on'](_0xc8d5('0x20'),function(){if(_0x5d760b){return _0x5d760b[_0xc8d5('0x21')](_0x38a4c2[_0xc8d5('0x22')])[_0xc8d5('0x23')](JSON['parse'](_0x340633));}});});_0x26d34c['on'](_0xc8d5('0x24'),function(_0x1879d2){if(_0x5d760b){return _0x5d760b[_0xc8d5('0x21')](0x1f4)[_0xc8d5('0x23')]({'errors':[{'message':_0xc8d5('0x25'),'type':'api.jira'}]});}});_0x26d34c[_0xc8d5('0x26')](_0x441a37);_0x26d34c['end']();}exports['openIssue']=openIssue;exports[_0xc8d5('0x27')]=function(_0x13c01c,_0x2d6a6b){_0x13c01c[_0xc8d5('0x28')]['ip']=_0x13c01c[_0xc8d5('0x29')][_0xc8d5('0x2a')]||_0x13c01c['connection'][_0xc8d5('0x2b')]||_0x13c01c[_0xc8d5('0x2c')][_0xc8d5('0x2b')]||_0x13c01c[_0xc8d5('0x2d')][_0xc8d5('0x2c')][_0xc8d5('0x2b')];return openIssue(_0x13c01c[_0xc8d5('0x28')],_0x2d6a6b);}; \ No newline at end of file +var _0xe8a5=['email','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','fields','customfield_11500'];(function(_0x700fbe,_0x14e29d){var _0x3c54a6=function(_0x3c3eb4){while(--_0x3c3eb4){_0x700fbe['push'](_0x700fbe['shift']());}};_0x3c54a6(++_0x14e29d);}(_0xe8a5,0x1ee));var _0x5e8a=function(_0x28d4cc,_0x4a6868){_0x28d4cc=_0x28d4cc-0x0;var _0x32a33c=_0xe8a5[_0x28d4cc];return _0x32a33c;};'use strict';var BPromise=require(_0x5e8a('0x0'));var https=require(_0x5e8a('0x1'));var logger=require(_0x5e8a('0x2'))('api');var USERNAME=_0x5e8a('0x3');var PASSWORD=_0x5e8a('0x4');function openIssue(_0x4c5d45,_0x1774c8){var _0x3afc89={'fields':{'project':{'key':_0x4c5d45[_0x5e8a('0x5')]||_0x5e8a('0x6')},'summary':(_0x4c5d45['summary']||_0x5e8a('0x7'))+_0x5e8a('0x8')+_0x4c5d45['ip'],'description':_0x4c5d45[_0x5e8a('0x9')]||JSON[_0x5e8a('0xa')](_0x4c5d45),'issuetype':{'name':_0x4c5d45['issuetype']||'Bug'}}};_0x3afc89[_0x5e8a('0xb')][_0x5e8a('0xc')]=_0x4c5d45[_0x5e8a('0xd')];_0x3afc89[_0x5e8a('0xb')]['customfield_11501']=_0x4c5d45['oldToken'];_0x3afc89[_0x5e8a('0xb')]['customfield_11502']=_0x4c5d45[_0x5e8a('0xe')];_0x3afc89[_0x5e8a('0xb')]['customfield_11503']=_0x4c5d45[_0x5e8a('0xf')];_0x3afc89['fields'][_0x5e8a('0x10')]=_0x4c5d45[_0x5e8a('0x11')];_0x3afc89[_0x5e8a('0xb')][_0x5e8a('0x12')]=_0x4c5d45['ip'];var _0x28c51b={'host':_0x5e8a('0x13'),'port':0x1bb,'path':_0x5e8a('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x5e8a('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x5e8a('0x16')]('base64')}};var _0x4aec11=JSON[_0x5e8a('0xa')](_0x3afc89);var _0x524847=https['request'](_0x28c51b,function(_0x539252){_0x539252['setEncoding'](_0x5e8a('0x17'));var _0xed07ea='';_0x539252['on'](_0x5e8a('0x18'),function(_0x1cf7c3){_0xed07ea+=_0x1cf7c3;});_0x539252['on']('end',function(){if(_0x1774c8){return _0x1774c8[_0x5e8a('0x19')](_0x539252[_0x5e8a('0x1a')])[_0x5e8a('0x1b')](JSON['parse'](_0xed07ea));}});});_0x524847['on'](_0x5e8a('0x1c'),function(_0x269419){if(_0x1774c8){return _0x1774c8['status'](0x1f4)[_0x5e8a('0x1b')]({'errors':[{'message':_0x5e8a('0x1d'),'type':'api.jira'}]});}});_0x524847[_0x5e8a('0x1e')](_0x4aec11);_0x524847[_0x5e8a('0x1f')]();}exports[_0x5e8a('0x20')]=openIssue;exports[_0x5e8a('0x21')]=function(_0x1d6e06,_0x255c4f){_0x1d6e06[_0x5e8a('0x22')]['ip']=_0x1d6e06['headers'][_0x5e8a('0x23')]||_0x1d6e06['connection'][_0x5e8a('0x24')]||_0x1d6e06[_0x5e8a('0x25')][_0x5e8a('0x24')]||_0x1d6e06[_0x5e8a('0x26')]['socket'][_0x5e8a('0x24')];return openIssue(_0x1d6e06[_0x5e8a('0x22')],_0x255c4f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 77f41b5..f33a12e 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x668b=['get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index'];(function(_0x2763d7,_0x22dbed){var _0x5d96d4=function(_0x57e62e){while(--_0x57e62e){_0x2763d7['push'](_0x2763d7['shift']());}};_0x5d96d4(++_0x22dbed);}(_0x668b,0x140));var _0xb668=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x668b[_0xacb1e2];return _0x463815;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')](_0xb668('0xd'),auth['isAuthenticated'](),controller[_0xb668('0x12')]);router[_0xb668('0x13')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x14')]);module[_0xb668('0x15')]=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x502643,_0x2a2900){var _0xd6c2ad=function(_0x8dd690){while(--_0x8dd690){_0x502643['push'](_0x502643['shift']());}};_0xd6c2ad(++_0x2a2900);}(_0xa74f,0x9a));var _0xfa74=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xa74f[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('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 2ec9e58..eb48225 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x4048a5,_0x2598d6){_0x4048a5=_0x4048a5-0x0;var _0x4efa64=_0x7a54[_0x4048a5];return _0x4efa64;};'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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x326523,_0x462305){_0x326523=_0x326523-0x0;var _0x5497eb=_0x7a54[_0x326523];return _0x5497eb;};'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 fee8a0b..ce87448 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 _0x975b=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x3c7a3e,_0x55ab39){var _0x56b7ef=function(_0x23413b){while(--_0x23413b){_0x3c7a3e['push'](_0x3c7a3e['shift']());}};_0x56b7ef(++_0x55ab39);}(_0x975b,0x1c9));var _0xb975=function(_0x1f13f0,_0x66cc8d){_0x1f13f0=_0x1f13f0-0x0;var _0xeda5eb=_0x975b[_0x1f13f0];return _0xeda5eb;};'use strict';var emlformat=require(_0xb975('0x0'));var rimraf=require(_0xb975('0x1'));var zipdir=require(_0xb975('0x2'));var jsonpatch=require(_0xb975('0x3'));var rp=require(_0xb975('0x4'));var moment=require(_0xb975('0x5'));var BPromise=require(_0xb975('0x6'));var Mustache=require('mustache');var util=require(_0xb975('0x7'));var path=require(_0xb975('0x8'));var sox=require(_0xb975('0x9'));var csv=require(_0xb975('0xa'));var ejs=require(_0xb975('0xb'));var fs=require('fs');var fs_extra=require(_0xb975('0xc'));var _=require(_0xb975('0xd'));var squel=require('squel');var crypto=require(_0xb975('0xe'));var jsforce=require(_0xb975('0xf'));var deskjs=require(_0xb975('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb975('0x11'));var Papa=require(_0xb975('0x12'));var Redis=require(_0xb975('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb975('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb975('0x15'));var logger=require('../../config/logger')(_0xb975('0x16'));var utils=require('../../config/utils');var config=require(_0xb975('0x17'));var licenseUtil=require(_0xb975('0x18'));var db=require(_0xb975('0x19'))['db'];function respondWithStatusCode(_0x1c4b77,_0x13ca28){_0x13ca28=_0x13ca28||0xcc;return function(_0x558727){if(_0x558727){return _0x1c4b77[_0xb975('0x1a')](_0x13ca28);}return _0x1c4b77[_0xb975('0x1b')](_0x13ca28)[_0xb975('0x1c')]();};}function respondWithResult(_0x24919e,_0x5cea50){_0x5cea50=_0x5cea50||0xc8;return function(_0x470ead){if(_0x470ead){return _0x24919e[_0xb975('0x1b')](_0x5cea50)[_0xb975('0x1d')](_0x470ead);}};}function respondWithFilteredResult(_0x4b1ede,_0x24f8ec){return function(_0x3da9e9){if(_0x3da9e9){var _0x36d959=typeof _0x24f8ec['offset']===_0xb975('0x1e')&&typeof _0x24f8ec['limit']===_0xb975('0x1e');var _0x34e062=_0x3da9e9[_0xb975('0x1f')];var _0x347a04=_0x36d959?0x0:_0x24f8ec[_0xb975('0x20')];var _0x327728=_0x36d959?_0x3da9e9[_0xb975('0x1f')]:_0x24f8ec['offset']+_0x24f8ec['limit'];var _0x2abb84;if(_0x327728>=_0x34e062){_0x327728=_0x34e062;_0x2abb84=0xc8;}else{_0x2abb84=0xce;}_0x4b1ede[_0xb975('0x1b')](_0x2abb84);return _0x4b1ede[_0xb975('0x21')](_0xb975('0x22'),_0x347a04+'-'+_0x327728+'/'+_0x34e062)['json'](_0x3da9e9);}return null;};}function patchUpdates(_0x39af85){return function(_0x49adfa){try{jsonpatch[_0xb975('0x23')](_0x49adfa,_0x39af85,!![]);}catch(_0x3f0876){return BPromise[_0xb975('0x24')](_0x3f0876);}return _0x49adfa['save']();};}function saveUpdates(_0xe7a5f0,_0x493c0b){return function(_0x5d1312){if(_0x5d1312){return _0x5d1312[_0xb975('0x25')](_0xe7a5f0)[_0xb975('0x26')](function(_0x226f21){return _0x226f21;});}return null;};}function removeEntity(_0xa4d4c,_0x35dcc6){return function(_0x5620fc){if(_0x5620fc){return _0x5620fc[_0xb975('0x27')]()['then'](function(){_0xa4d4c[_0xb975('0x1b')](0xcc)[_0xb975('0x1c')]();});}};}function handleEntityNotFound(_0xc0d861,_0x263f73){return function(_0x5309c6){if(!_0x5309c6){_0xc0d861[_0xb975('0x1a')](0x194);}return _0x5309c6;};}function handleError(_0x2824bf,_0x41905e){_0x41905e=_0x41905e||0x1f4;return function(_0xed596){logger['error'](_0xed596[_0xb975('0x28')]);if(_0xed596[_0xb975('0x29')]){delete _0xed596[_0xb975('0x29')];}_0x2824bf[_0xb975('0x1b')](_0x41905e)[_0xb975('0x2a')](_0xed596);};}exports[_0xb975('0x2b')]=function(_0x442bc6,_0x135cc9){var _0x2d730d={},_0x514451={},_0x2b1319={'count':0x0,'rows':[]};var _0x2b3ec2=_[_0xb975('0x2c')](db[_0xb975('0x2d')][_0xb975('0x2e')],function(_0x3bd5cb){return{'name':_0x3bd5cb[_0xb975('0x2f')],'type':_0x3bd5cb[_0xb975('0x30')][_0xb975('0x31')]};});_0x514451[_0xb975('0x32')]=_[_0xb975('0x2c')](_0x2b3ec2,'name');_0x514451[_0xb975('0x33')]=_['keys'](_0x442bc6['query']);_0x514451[_0xb975('0x34')]=_['intersection'](_0x514451[_0xb975('0x32')],_0x514451[_0xb975('0x33')]);_0x2d730d['attributes']=_[_0xb975('0x35')](_0x514451['model'],qs[_0xb975('0x36')](_0x442bc6[_0xb975('0x33')][_0xb975('0x36')]));_0x2d730d[_0xb975('0x37')]=_0x2d730d[_0xb975('0x37')]['length']?_0x2d730d[_0xb975('0x37')]:_0x514451['model'];if(!_0x442bc6['query'][_0xb975('0x38')](_0xb975('0x39'))){_0x2d730d[_0xb975('0x3a')]=qs[_0xb975('0x3a')](_0x442bc6[_0xb975('0x33')][_0xb975('0x3a')]);_0x2d730d[_0xb975('0x20')]=qs[_0xb975('0x20')](_0x442bc6['query'][_0xb975('0x20')]);}_0x2d730d[_0xb975('0x3b')]=qs['sort'](_0x442bc6[_0xb975('0x33')][_0xb975('0x3c')]);_0x2d730d[_0xb975('0x3d')]=qs[_0xb975('0x34')](_[_0xb975('0x3e')](_0x442bc6[_0xb975('0x33')],_0x514451[_0xb975('0x34')]),_0x2b3ec2);if(_0x442bc6['query'][_0xb975('0x3f')]){_0x2d730d['where']=_[_0xb975('0x40')](_0x2d730d[_0xb975('0x3d')],{'$or':_['map'](_0x2b3ec2,function(_0x2341e6){if(_0x2341e6['type']!==_0xb975('0x41')){var _0x378e54={};_0x378e54[_0x2341e6[_0xb975('0x29')]]={'$like':'%'+_0x442bc6[_0xb975('0x33')][_0xb975('0x3f')]+'%'};return _0x378e54;}})});}_0x2d730d=_[_0xb975('0x40')]({},_0x2d730d,_0x442bc6[_0xb975('0x42')]);var _0x2781ab={'where':_0x2d730d['where']};return db[_0xb975('0x2d')][_0xb975('0x1f')](_0x2781ab)[_0xb975('0x26')](function(_0x562e0d){_0x2b1319['count']=_0x562e0d;if(_0x442bc6[_0xb975('0x33')][_0xb975('0x43')]){_0x2d730d[_0xb975('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x2d730d);})[_0xb975('0x26')](function(_0x335011){_0x2b1319[_0xb975('0x45')]=_0x335011;return _0x2b1319;})[_0xb975('0x26')](respondWithFilteredResult(_0x135cc9,_0x2d730d))['catch'](handleError(_0x135cc9,null));};exports[_0xb975('0x46')]=function(_0x17d594,_0xe5c7e7){var _0x160e58={'raw':!![],'where':{'id':_0x17d594[_0xb975('0x47')]['id']}},_0x55f550={};_0x55f550[_0xb975('0x32')]=_['keys'](db['JscriptyAnswerReport'][_0xb975('0x2e')]);_0x55f550['query']=_['keys'](_0x17d594[_0xb975('0x33')]);_0x55f550['filters']=_[_0xb975('0x35')](_0x55f550[_0xb975('0x32')],_0x55f550['query']);_0x160e58[_0xb975('0x37')]=_[_0xb975('0x35')](_0x55f550[_0xb975('0x32')],qs[_0xb975('0x36')](_0x17d594[_0xb975('0x33')]['fields']));_0x160e58[_0xb975('0x37')]=_0x160e58[_0xb975('0x37')][_0xb975('0x48')]?_0x160e58['attributes']:_0x55f550[_0xb975('0x32')];if(_0x17d594[_0xb975('0x33')][_0xb975('0x43')]){_0x160e58['include']=[{'all':!![]}];}_0x160e58=_[_0xb975('0x40')]({},_0x160e58,_0x17d594[_0xb975('0x42')]);return db[_0xb975('0x2d')][_0xb975('0x49')](_0x160e58)['then'](handleEntityNotFound(_0xe5c7e7,null))['then'](respondWithResult(_0xe5c7e7,null))['catch'](handleError(_0xe5c7e7,null));};exports[_0xb975('0x4a')]=function(_0x4483ba,_0x15bc77){return db[_0xb975('0x2d')][_0xb975('0x4a')](_0x4483ba[_0xb975('0x4b')],{})[_0xb975('0x26')](respondWithResult(_0x15bc77,0xc9))[_0xb975('0x4c')](handleError(_0x15bc77,null));};exports[_0xb975('0x25')]=function(_0x466251,_0x1a3268){if(_0x466251['body']['id']){delete _0x466251[_0xb975('0x4b')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x466251['params']['id']}})[_0xb975('0x26')](handleEntityNotFound(_0x1a3268,null))[_0xb975('0x26')](saveUpdates(_0x466251['body'],null))[_0xb975('0x26')](respondWithResult(_0x1a3268,null))[_0xb975('0x4c')](handleError(_0x1a3268,null));};exports[_0xb975('0x27')]=function(_0x22743c,_0x1f9544){return db[_0xb975('0x2d')][_0xb975('0x49')]({'where':{'id':_0x22743c[_0xb975('0x47')]['id']}})[_0xb975('0x26')](handleEntityNotFound(_0x1f9544,null))['then'](removeEntity(_0x1f9544,null))['catch'](handleError(_0x1f9544,null));};exports['describe']=function(_0x3cedf9,_0x1a1f97){return db['JscriptyAnswerReport'][_0xb975('0x4d')]()[_0xb975('0x26')](respondWithResult(_0x1a1f97,null))[_0xb975('0x4c')](handleError(_0x1a1f97,null));}; \ No newline at end of file +var _0x31f0=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','JscriptyAnswerReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31f0,0xb7));var _0x031f=function(_0x2b963b,_0x55f37e){_0x2b963b=_0x2b963b-0x0;var _0x525a7e=_0x31f0[_0x2b963b];return _0x525a7e;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}exports[_0x031f('0x2a')]=function(_0xb6ed6c,_0xaf5bea){var _0xfaa36={},_0x301bd2={},_0x52b544={'count':0x0,'rows':[]};var _0x1f62eb=_[_0x031f('0x2b')](db[_0x031f('0x2c')][_0x031f('0x2d')],function(_0x428ec4){return{'name':_0x428ec4[_0x031f('0x2e')],'type':_0x428ec4[_0x031f('0x2f')][_0x031f('0x30')]};});_0x301bd2[_0x031f('0x31')]=_[_0x031f('0x2b')](_0x1f62eb,_0x031f('0x28'));_0x301bd2['query']=_[_0x031f('0x32')](_0xb6ed6c[_0x031f('0x33')]);_0x301bd2[_0x031f('0x34')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],_0x301bd2[_0x031f('0x33')]);_0xfaa36[_0x031f('0x36')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],qs[_0x031f('0x37')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x37')]));_0xfaa36[_0x031f('0x36')]=_0xfaa36['attributes'][_0x031f('0x38')]?_0xfaa36[_0x031f('0x36')]:_0x301bd2['model'];if(!_0xb6ed6c[_0x031f('0x33')][_0x031f('0x39')]('nolimit')){_0xfaa36[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x1c')]);_0xfaa36['offset']=qs['offset'](_0xb6ed6c[_0x031f('0x33')]['offset']);}_0xfaa36[_0x031f('0x3a')]=qs[_0x031f('0x3b')](_0xb6ed6c[_0x031f('0x33')]['sort']);_0xfaa36['where']=qs[_0x031f('0x34')](_['pick'](_0xb6ed6c['query'],_0x301bd2[_0x031f('0x34')]),_0x1f62eb);if(_0xb6ed6c[_0x031f('0x33')][_0x031f('0x3c')]){_0xfaa36[_0x031f('0x3d')]=_[_0x031f('0x3e')](_0xfaa36[_0x031f('0x3d')],{'$or':_[_0x031f('0x2b')](_0x1f62eb,function(_0x55c85f){if(_0x55c85f[_0x031f('0x2f')]!==_0x031f('0x3f')){var _0xb3b188={};_0xb3b188[_0x55c85f[_0x031f('0x28')]]={'$like':'%'+_0xb6ed6c['query'][_0x031f('0x3c')]+'%'};return _0xb3b188;}})});}_0xfaa36=_[_0x031f('0x3e')]({},_0xfaa36,_0xb6ed6c[_0x031f('0x40')]);var _0x5895f6={'where':_0xfaa36[_0x031f('0x3d')]};return db[_0x031f('0x2c')]['count'](_0x5895f6)[_0x031f('0x26')](function(_0x268dc7){_0x52b544['count']=_0x268dc7;if(_0xb6ed6c['query'][_0x031f('0x41')]){_0xfaa36[_0x031f('0x42')]=[{'all':!![]}];}return db[_0x031f('0x2c')][_0x031f('0x43')](_0xfaa36);})[_0x031f('0x26')](function(_0xf0fb95){_0x52b544[_0x031f('0x44')]=_0xf0fb95;return _0x52b544;})['then'](respondWithFilteredResult(_0xaf5bea,_0xfaa36))[_0x031f('0x45')](handleError(_0xaf5bea,null));};exports[_0x031f('0x46')]=function(_0x4d701e,_0x12279a){var _0x505e93={'raw':!![],'where':{'id':_0x4d701e[_0x031f('0x47')]['id']}},_0x456a98={};_0x456a98['model']=_[_0x031f('0x32')](db[_0x031f('0x2c')][_0x031f('0x2d')]);_0x456a98['query']=_[_0x031f('0x32')](_0x4d701e[_0x031f('0x33')]);_0x456a98[_0x031f('0x34')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],_0x456a98[_0x031f('0x33')]);_0x505e93[_0x031f('0x36')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],qs['fields'](_0x4d701e[_0x031f('0x33')][_0x031f('0x37')]));_0x505e93[_0x031f('0x36')]=_0x505e93[_0x031f('0x36')][_0x031f('0x38')]?_0x505e93[_0x031f('0x36')]:_0x456a98[_0x031f('0x31')];if(_0x4d701e[_0x031f('0x33')][_0x031f('0x41')]){_0x505e93['include']=[{'all':!![]}];}_0x505e93=_[_0x031f('0x3e')]({},_0x505e93,_0x4d701e['options']);return db['JscriptyAnswerReport'][_0x031f('0x48')](_0x505e93)[_0x031f('0x26')](handleEntityNotFound(_0x12279a,null))[_0x031f('0x26')](respondWithResult(_0x12279a,null))[_0x031f('0x45')](handleError(_0x12279a,null));};exports[_0x031f('0x49')]=function(_0x553f01,_0x309642){return db[_0x031f('0x2c')][_0x031f('0x49')](_0x553f01['body'],{})[_0x031f('0x26')](respondWithResult(_0x309642,0xc9))[_0x031f('0x45')](handleError(_0x309642,null));};exports[_0x031f('0x24')]=function(_0x318829,_0x2c93ea){if(_0x318829[_0x031f('0x4a')]['id']){delete _0x318829['body']['id'];}return db['JscriptyAnswerReport'][_0x031f('0x48')]({'where':{'id':_0x318829['params']['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x2c93ea,null))[_0x031f('0x26')](saveUpdates(_0x318829['body'],null))[_0x031f('0x26')](respondWithResult(_0x2c93ea,null))['catch'](handleError(_0x2c93ea,null));};exports['destroy']=function(_0x35a949,_0x48ca85){return db[_0x031f('0x2c')]['find']({'where':{'id':_0x35a949[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x48ca85,null))['then'](removeEntity(_0x48ca85,null))[_0x031f('0x45')](handleError(_0x48ca85,null));};exports[_0x031f('0x4b')]=function(_0x57e32d,_0x46471a){return db['JscriptyAnswerReport'][_0x031f('0x4b')]()['then'](respondWithResult(_0x46471a,null))[_0x031f('0x45')](handleError(_0x46471a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1105259..49c369e 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 _0xe5ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x6fd730,_0x3b1344){var _0x2cb7d7=function(_0x513997){while(--_0x513997){_0x6fd730['push'](_0x6fd730['shift']());}};_0x2cb7d7(++_0x3b1344);}(_0xe5ec,0x85));var _0xce5e=function(_0x35d546,_0x3d9ba3){_0x35d546=_0x35d546-0x0;var _0x4349e5=_0xe5ec[_0x35d546];return _0x4349e5;};'use strict';var _=require(_0xce5e('0x0'));var util=require(_0xce5e('0x1'));var logger=require(_0xce5e('0x2'))(_0xce5e('0x3'));var moment=require(_0xce5e('0x4'));var BPromise=require(_0xce5e('0x5'));var rp=require(_0xce5e('0x6'));var fs=require('fs');var path=require(_0xce5e('0x7'));var rimraf=require(_0xce5e('0x8'));var config=require(_0xce5e('0x9'));var attributes=require(_0xce5e('0xa'));module[_0xce5e('0xb')]=function(_0x15be1b,_0x46ab4d){return _0x15be1b[_0xce5e('0xc')](_0xce5e('0xd'),attributes,{'tableName':_0xce5e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x230e=['report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x230e,0x18d));var _0xe230=function(_0x2f0977,_0x2e8eef){_0x2f0977=_0x2f0977-0x0;var _0xcab959=_0x230e[_0x2f0977];return _0xcab959;};'use strict';var _=require(_0xe230('0x0'));var util=require('util');var logger=require(_0xe230('0x1'))('api');var moment=require(_0xe230('0x2'));var BPromise=require(_0xe230('0x3'));var rp=require(_0xe230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe230('0x5'));var config=require(_0xe230('0x6'));var attributes=require(_0xe230('0x7'));module[_0xe230('0x8')]=function(_0x310e49,_0x596c43){return _0x310e49['define'](_0xe230('0x9'),attributes,{'tableName':_0xe230('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 95e90e0..3e2fd19 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 _0x928e=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x31236c,_0x34f702){var _0x12eb2f=function(_0x6bb9a){while(--_0x6bb9a){_0x31236c['push'](_0x31236c['shift']());}};_0x12eb2f(++_0x34f702);}(_0x928e,0x1b9));var _0xe928=function(_0x519a68,_0x1205e5){_0x519a68=_0x519a68-0x0;var _0x58b02d=_0x928e[_0x519a68];return _0x58b02d;};'use strict';var _=require(_0xe928('0x0'));var util=require(_0xe928('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe928('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe928('0x3'));var logger=require(_0xe928('0x4'))(_0xe928('0x5'));var config=require(_0xe928('0x6'));var jayson=require(_0xe928('0x7'));var client=jayson[_0xe928('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419b27,_0x33d41c,_0x1318f8){return new BPromise(function(_0x13664a,_0xb27587){return client[_0xe928('0x9')](_0x419b27,_0x1318f8)[_0xe928('0xa')](function(_0x489579){logger['info'](_0xe928('0xb'),_0x33d41c,'request\x20sent');logger[_0xe928('0xc')](_0xe928('0xd'),_0x33d41c,'request\x20sent',JSON[_0xe928('0xe')](_0x489579));if(_0x489579[_0xe928('0xf')]){if(_0x489579[_0xe928('0xf')][_0xe928('0x10')]===0x1f4){logger[_0xe928('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x33d41c,_0x489579[_0xe928('0xf')][_0xe928('0x11')]);return _0xb27587(_0x489579[_0xe928('0xf')][_0xe928('0x11')]);}logger[_0xe928('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x33d41c,_0x489579['error'][_0xe928('0x11')]);return _0x13664a(_0x489579[_0xe928('0xf')][_0xe928('0x11')]);}else{logger[_0xe928('0x12')](_0xe928('0xb'),_0x33d41c,_0xe928('0x13'));_0x13664a(_0x489579[_0xe928('0x14')]['message']);}})[_0xe928('0x15')](function(_0x5bcda6){logger[_0xe928('0xf')](_0xe928('0xb'),_0x33d41c,_0x5bcda6);_0xb27587(_0x5bcda6);});});} \ No newline at end of file +var _0x4c1d=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4c1d,0x123));var _0xd4c1=function(_0x66c3a2,_0x25c17a){_0x66c3a2=_0x66c3a2-0x0;var _0x2a6940=_0x4c1d[_0x66c3a2];return _0x2a6940;};'use strict';var _=require(_0xd4c1('0x0'));var util=require(_0xd4c1('0x1'));var moment=require('moment');var BPromise=require(_0xd4c1('0x2'));var rs=require(_0xd4c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c1('0x4'))['db'];var utils=require(_0xd4c1('0x5'));var logger=require(_0xd4c1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd4c1('0x7'));var client=jayson[_0xd4c1('0x8')][_0xd4c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e2fd0,_0x19717d,_0x50f2bc){return new BPromise(function(_0x4e325e,_0xb87c6){return client[_0xd4c1('0xa')](_0x5e2fd0,_0x50f2bc)[_0xd4c1('0xb')](function(_0x1d011a){logger[_0xd4c1('0xc')](_0xd4c1('0xd'),_0x19717d,_0xd4c1('0xe'));logger['debug'](_0xd4c1('0xf'),_0x19717d,'request\x20sent',JSON[_0xd4c1('0x10')](_0x1d011a));if(_0x1d011a[_0xd4c1('0x11')]){if(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x12')]===0x1f4){logger['error'](_0xd4c1('0xd'),_0x19717d,_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);return _0xb87c6(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);}logger[_0xd4c1('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x19717d,_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);return _0x4e325e(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);}else{logger[_0xd4c1('0xc')](_0xd4c1('0xd'),_0x19717d,_0xd4c1('0xe'));_0x4e325e(_0x1d011a[_0xd4c1('0x14')]['message']);}})[_0xd4c1('0x15')](function(_0x550c05){logger[_0xd4c1('0x11')](_0xd4c1('0xd'),_0x19717d,_0x550c05);_0xb87c6(_0x550c05);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index dec80d0..4e755e8 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 _0xe8e7=['isAuthenticated','getSessions','/:id/answers','30s','getSummary','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','index','/:id','get','/:id/sessions'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe8e7,0x6d));var _0x7e8e=function(_0x50fe81,_0x51c211){_0x50fe81=_0x50fe81-0x0;var _0x4338fd=_0xe8e7[_0x50fe81];return _0x4338fd;};'use strict';var multer=require(_0x7e8e('0x0'));var util=require(_0x7e8e('0x1'));var path=require(_0x7e8e('0x2'));var timeout=require(_0x7e8e('0x3'));var express=require('express');var router=express[_0x7e8e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7e8e('0x5'));var config=require(_0x7e8e('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7e8e('0x7')]);router['get'](_0x7e8e('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7e8e('0x9')](_0x7e8e('0xa'),auth[_0x7e8e('0xb')](),controller[_0x7e8e('0xc')]);router[_0x7e8e('0x9')](_0x7e8e('0xd'),auth[_0x7e8e('0xb')](),controller['getAnswers']);router[_0x7e8e('0x9')]('/:id/summary',auth[_0x7e8e('0xb')](),timeout(_0x7e8e('0xe')),controller[_0x7e8e('0xf')]);router[_0x7e8e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e8e('0x10')](_0x7e8e('0x11'),auth[_0x7e8e('0xb')](),controller[_0x7e8e('0x12')]);router[_0x7e8e('0x13')](_0x7e8e('0x8'),auth[_0x7e8e('0xb')](),controller[_0x7e8e('0x14')]);router[_0x7e8e('0x15')]('/:id',auth[_0x7e8e('0xb')](),controller[_0x7e8e('0x16')]);module[_0x7e8e('0x17')]=router; \ No newline at end of file +var _0x53a3=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller'];(function(_0x3b773e,_0x48bd3b){var _0x595937=function(_0x4ee38f){while(--_0x4ee38f){_0x3b773e['push'](_0x3b773e['shift']());}};_0x595937(++_0x48bd3b);}(_0x53a3,0xe0));var _0x353a=function(_0x7460d8,_0x2fc1a1){_0x7460d8=_0x7460d8-0x0;var _0x338f82=_0x53a3[_0x7460d8];return _0x338f82;};'use strict';var multer=require('multer');var util=require(_0x353a('0x0'));var path=require('path');var timeout=require(_0x353a('0x1'));var express=require('express');var router=express[_0x353a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x353a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x353a('0x4'));var controller=require(_0x353a('0x5'));router[_0x353a('0x6')]('/',auth[_0x353a('0x7')](),controller[_0x353a('0x8')]);router['get'](_0x353a('0x9'),auth[_0x353a('0x7')](),controller[_0x353a('0xa')]);router['get'](_0x353a('0xb'),auth[_0x353a('0x7')](),controller[_0x353a('0xc')]);router[_0x353a('0x6')]('/:id/answers',auth[_0x353a('0x7')](),controller['getAnswers']);router[_0x353a('0x6')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0x353a('0xd')]);router[_0x353a('0xe')]('/',auth[_0x353a('0x7')](),controller[_0x353a('0xf')]);router['post'](_0x353a('0x10'),auth[_0x353a('0x7')](),controller[_0x353a('0x11')]);router[_0x353a('0x12')]('/:id',auth[_0x353a('0x7')](),controller[_0x353a('0x13')]);router[_0x353a('0x14')](_0x353a('0x9'),auth['isAuthenticated'](),controller[_0x353a('0x15')]);module[_0x353a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f17e83e..32e51a1 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 _0x25b0=['BOOLEAN','sequelize','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name'];(function(_0x1189aa,_0x4b72ac){var _0x4ccc94=function(_0x386c5e){while(--_0x386c5e){_0x1189aa['push'](_0x1189aa['shift']());}};_0x4ccc94(++_0x4b72ac);}(_0x25b0,0x178));var _0x025b=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0x25b0[_0x2dfd0e];return _0x343af6;};'use strict';var Sequelize=require(_0x025b('0x0'));var _=require('lodash');var util=require(_0x025b('0x1'));module[_0x025b('0x2')]={'name':{'type':Sequelize[_0x025b('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x025b('0x3')]},'formData':{'type':Sequelize[_0x025b('0x4')](_0x025b('0x5')),'set':function(_0x57bb98){if(_[_0x025b('0x6')](_0x57bb98)){this[_0x025b('0x7')](_0x025b('0x8'),JSON[_0x025b('0x9')](_0x57bb98));}else if(_[_0x025b('0xa')](_0x57bb98)){this[_0x025b('0x7')]('formData',_0x57bb98);}else{this[_0x025b('0x7')](_0x025b('0x8'),util[_0x025b('0xb')](_0x025b('0xc'),this['getDataValue'](_0x025b('0xd'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x025b('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xc431=['description','BOOLEAN','sequelize','util','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x24c55d,_0x35e9f0){var _0x3776ba=function(_0x45c5e0){while(--_0x45c5e0){_0x24c55d['push'](_0x24c55d['shift']());}};_0x3776ba(++_0x35e9f0);}(_0xc431,0x179));var _0x1c43=function(_0x259633,_0x59586b){_0x259633=_0x259633-0x0;var _0x2b9761=_0xc431[_0x259633];return _0x2b9761;};'use strict';var Sequelize=require(_0x1c43('0x0'));var _=require('lodash');var util=require(_0x1c43('0x1'));module['exports']={'name':{'type':Sequelize[_0x1c43('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x1c43('0x2')]},'formData':{'type':Sequelize[_0x1c43('0x3')](_0x1c43('0x4')),'set':function(_0x3b5058){if(_[_0x1c43('0x5')](_0x3b5058)){this[_0x1c43('0x6')]('formData',JSON[_0x1c43('0x7')](_0x3b5058));}else if(_[_0x1c43('0x8')](_0x3b5058)){this['setDataValue'](_0x1c43('0x9'),_0x3b5058);}else{this['setDataValue'](_0x1c43('0x9'),util['format'](_0x1c43('0xa'),this[_0x1c43('0xb')](_0x1c43('0xc'))||'',this['getDataValue'](_0x1c43('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1c43('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1c43('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d42136d..a133819 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 _0xbb58=['fromCharCode','indexOf','toString','getSummary','parse','startTime','findAll','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','then','get','Projects','UserProfileResource','error','stack','name','index','JscriptyProject','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','findOne','JscriptySessionReport','rawAttributes','length','order','pick','ProjectId','getAnswers','JscriptyAnswerReport','number'];(function(_0x1309ff,_0x154836){var _0xcffd53=function(_0x4a6231){while(--_0x4a6231){_0x1309ff['push'](_0x1309ff['shift']());}};_0xcffd53(++_0x154836);}(_0xbb58,0x17b));var _0x8bb5=function(_0x5c55b1,_0x33f1c9){_0x5c55b1=_0x5c55b1-0x0;var _0x435e5c=_0xbb58[_0x5c55b1];return _0x435e5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bb5('0x0'));var zipdir=require(_0x8bb5('0x1'));var jsonpatch=require(_0x8bb5('0x2'));var rp=require(_0x8bb5('0x3'));var moment=require(_0x8bb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8bb5('0x5'));var util=require(_0x8bb5('0x6'));var path=require(_0x8bb5('0x7'));var sox=require(_0x8bb5('0x8'));var csv=require(_0x8bb5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bb5('0xa'));var squel=require(_0x8bb5('0xb'));var crypto=require('crypto');var jsforce=require(_0x8bb5('0xc'));var deskjs=require(_0x8bb5('0xd'));var toCsv=require(_0x8bb5('0x9'));var querystring=require(_0x8bb5('0xe'));var Papa=require(_0x8bb5('0xf'));var Redis=require('ioredis');var authService=require(_0x8bb5('0x10'));var qs=require(_0x8bb5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bb5('0x12'));var logger=require(_0x8bb5('0x13'))(_0x8bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x8bb5('0x15'));var licenseUtil=require(_0x8bb5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35d9db,_0x3204e7){_0x3204e7=_0x3204e7||0xcc;return function(_0x279342){if(_0x279342){return _0x35d9db[_0x8bb5('0x17')](_0x3204e7);}return _0x35d9db[_0x8bb5('0x18')](_0x3204e7)[_0x8bb5('0x19')]();};}function respondWithResult(_0x53c048,_0x577505){_0x577505=_0x577505||0xc8;return function(_0x3c2fde){if(_0x3c2fde){return _0x53c048[_0x8bb5('0x18')](_0x577505)['json'](_0x3c2fde);}};}function respondWithFilteredResult(_0x19a5aa,_0xa07378){return function(_0x2d41df){if(_0x2d41df){var _0x3960fd=typeof _0xa07378[_0x8bb5('0x1a')]==='undefined'&&typeof _0xa07378[_0x8bb5('0x1b')]===_0x8bb5('0x1c');var _0x3c287f=_0x2d41df[_0x8bb5('0x1d')];var _0x429682=_0x3960fd?0x0:_0xa07378['offset'];var _0x3a7ba4=_0x3960fd?_0x2d41df[_0x8bb5('0x1d')]:_0xa07378[_0x8bb5('0x1a')]+_0xa07378[_0x8bb5('0x1b')];var _0x2b97e3;if(_0x3a7ba4>=_0x3c287f){_0x3a7ba4=_0x3c287f;_0x2b97e3=0xc8;}else{_0x2b97e3=0xce;}_0x19a5aa['status'](_0x2b97e3);return _0x19a5aa[_0x8bb5('0x1e')](_0x8bb5('0x1f'),_0x429682+'-'+_0x3a7ba4+'/'+_0x3c287f)[_0x8bb5('0x20')](_0x2d41df);}return null;};}function patchUpdates(_0x3dc753){return function(_0x10e23c){try{jsonpatch[_0x8bb5('0x21')](_0x10e23c,_0x3dc753,!![]);}catch(_0x53f7cc){return BPromise['reject'](_0x53f7cc);}return _0x10e23c['save']();};}function saveUpdates(_0x13bae3,_0x389018){return function(_0x541afa){if(_0x541afa){return _0x541afa['update'](_0x13bae3)[_0x8bb5('0x22')](function(_0x2f1b69){return _0x2f1b69;});}return null;};}function removeEntity(_0x5b2678,_0x4559d4){return function(_0xb29f16){if(_0xb29f16){return _0xb29f16['destroy']()[_0x8bb5('0x22')](function(){var _0x3c5f01=_0xb29f16[_0x8bb5('0x23')]({'plain':!![]});var _0x1583d9=_0x8bb5('0x24');return db[_0x8bb5('0x25')]['destroy']({'where':{'type':_0x1583d9,'resourceId':_0x3c5f01['id']}})[_0x8bb5('0x22')](function(){return _0xb29f16;});})[_0x8bb5('0x22')](function(){_0x5b2678['status'](0xcc)[_0x8bb5('0x19')]();});}};}function handleEntityNotFound(_0xfc438c,_0x49e535){return function(_0xef9879){if(!_0xef9879){_0xfc438c[_0x8bb5('0x17')](0x194);}return _0xef9879;};}function handleError(_0x35106a,_0x40f31a){_0x40f31a=_0x40f31a||0x1f4;return function(_0x40a628){logger[_0x8bb5('0x26')](_0x40a628[_0x8bb5('0x27')]);if(_0x40a628[_0x8bb5('0x28')]){delete _0x40a628['name'];}_0x35106a[_0x8bb5('0x18')](_0x40f31a)['send'](_0x40a628);};}exports[_0x8bb5('0x29')]=function(_0x1f8e39,_0x194ee8){var _0xb5aad0={},_0x541c17={},_0x4d21f1={'count':0x0,'rows':[]};var _0x2f990d=_['map'](db[_0x8bb5('0x2a')]['rawAttributes'],function(_0x52d045){return{'name':_0x52d045[_0x8bb5('0x2b')],'type':_0x52d045[_0x8bb5('0x2c')][_0x8bb5('0x2d')]};});_0x541c17['model']=_[_0x8bb5('0x2e')](_0x2f990d,'name');_0x541c17['query']=_[_0x8bb5('0x2f')](_0x1f8e39[_0x8bb5('0x30')]);_0x541c17[_0x8bb5('0x31')]=_[_0x8bb5('0x32')](_0x541c17[_0x8bb5('0x33')],_0x541c17[_0x8bb5('0x30')]);_0xb5aad0[_0x8bb5('0x34')]=_[_0x8bb5('0x32')](_0x541c17['model'],qs[_0x8bb5('0x35')](_0x1f8e39[_0x8bb5('0x30')]['fields']));_0xb5aad0[_0x8bb5('0x34')]=_0xb5aad0[_0x8bb5('0x34')]['length']?_0xb5aad0[_0x8bb5('0x34')]:_0x541c17[_0x8bb5('0x33')];if(!_0x1f8e39[_0x8bb5('0x30')][_0x8bb5('0x36')](_0x8bb5('0x37'))){_0xb5aad0['limit']=qs[_0x8bb5('0x1b')](_0x1f8e39[_0x8bb5('0x30')][_0x8bb5('0x1b')]);_0xb5aad0[_0x8bb5('0x1a')]=qs[_0x8bb5('0x1a')](_0x1f8e39[_0x8bb5('0x30')][_0x8bb5('0x1a')]);}_0xb5aad0['order']=qs[_0x8bb5('0x38')](_0x1f8e39[_0x8bb5('0x30')]['sort']);_0xb5aad0[_0x8bb5('0x39')]=qs[_0x8bb5('0x31')](_['pick'](_0x1f8e39[_0x8bb5('0x30')],_0x541c17['filters']),_0x2f990d);if(_0x1f8e39['query'][_0x8bb5('0x3a')]){_0xb5aad0['where']=_[_0x8bb5('0x3b')](_0xb5aad0[_0x8bb5('0x39')],{'$or':_[_0x8bb5('0x2e')](_0x2f990d,function(_0x55efce){if(_0x55efce[_0x8bb5('0x2c')]!==_0x8bb5('0x3c')){var _0x388569={};_0x388569[_0x55efce['name']]={'$like':'%'+_0x1f8e39[_0x8bb5('0x30')][_0x8bb5('0x3a')]+'%'};return _0x388569;}})});}_0xb5aad0=_[_0x8bb5('0x3b')]({},_0xb5aad0,_0x1f8e39['options']);var _0x37d76c={'where':_0xb5aad0[_0x8bb5('0x39')]};return db[_0x8bb5('0x2a')][_0x8bb5('0x1d')](_0x37d76c)[_0x8bb5('0x22')](function(_0x4bc63e){_0x4d21f1['count']=_0x4bc63e;if(_0x1f8e39[_0x8bb5('0x30')][_0x8bb5('0x3d')]){_0xb5aad0[_0x8bb5('0x3e')]=[{'all':!![]}];}return db[_0x8bb5('0x2a')]['findAll'](_0xb5aad0);})[_0x8bb5('0x22')](function(_0x400a6a){_0x4d21f1[_0x8bb5('0x3f')]=_0x400a6a;return _0x4d21f1;})[_0x8bb5('0x22')](respondWithFilteredResult(_0x194ee8,_0xb5aad0))[_0x8bb5('0x40')](handleError(_0x194ee8,null));};exports[_0x8bb5('0x41')]=function(_0x27b989,_0x158b11){var _0x932182={'raw':![],'where':{'id':_0x27b989[_0x8bb5('0x42')]['id']}},_0x105f7f={};_0x105f7f[_0x8bb5('0x33')]=_[_0x8bb5('0x2f')](db[_0x8bb5('0x2a')]['rawAttributes']);_0x105f7f[_0x8bb5('0x30')]=_['keys'](_0x27b989[_0x8bb5('0x30')]);_0x105f7f[_0x8bb5('0x31')]=_[_0x8bb5('0x32')](_0x105f7f[_0x8bb5('0x33')],_0x105f7f[_0x8bb5('0x30')]);_0x932182[_0x8bb5('0x34')]=_[_0x8bb5('0x32')](_0x105f7f[_0x8bb5('0x33')],qs[_0x8bb5('0x35')](_0x27b989[_0x8bb5('0x30')][_0x8bb5('0x35')]));_0x932182['attributes']=_0x932182[_0x8bb5('0x34')]['length']?_0x932182[_0x8bb5('0x34')]:_0x105f7f[_0x8bb5('0x33')];if(_0x27b989[_0x8bb5('0x30')]['includeAll']){_0x932182['include']=[{'all':!![]}];}_0x932182=_[_0x8bb5('0x3b')]({},_0x932182,_0x27b989[_0x8bb5('0x43')]);return db['JscriptyProject'][_0x8bb5('0x44')](_0x932182)['then'](handleEntityNotFound(_0x158b11,null))[_0x8bb5('0x22')](respondWithResult(_0x158b11,null))['catch'](handleError(_0x158b11,null));};exports[_0x8bb5('0x45')]=function(_0x1de5d6,_0x1656e2){return db[_0x8bb5('0x2a')]['create'](_0x1de5d6[_0x8bb5('0x46')],{})[_0x8bb5('0x22')](function(_0x771d79){var _0x1efe0a=_0x1de5d6['user']['get']({'plain':!![]});if(!_0x1efe0a)throw new Error(_0x8bb5('0x47'));if(_0x1efe0a[_0x8bb5('0x48')]===_0x8bb5('0x49')){var _0x58b609=_0x771d79[_0x8bb5('0x23')]({'plain':!![]});var _0xbe6801=_0x8bb5('0x24');return db[_0x8bb5('0x4a')][_0x8bb5('0x44')]({'where':{'name':_0xbe6801,'userProfileId':_0x1efe0a[_0x8bb5('0x4b')]},'raw':!![]})[_0x8bb5('0x22')](function(_0x1fd7bd){if(_0x1fd7bd&&_0x1fd7bd[_0x8bb5('0x4c')]===0x0){return db[_0x8bb5('0x25')][_0x8bb5('0x45')]({'name':_0x58b609['name'],'resourceId':_0x58b609['id'],'type':_0x1fd7bd[_0x8bb5('0x28')],'sectionId':_0x1fd7bd['id']},{})[_0x8bb5('0x22')](function(){return _0x771d79;});}else{return _0x771d79;}})[_0x8bb5('0x40')](function(_0x400973){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x400973);throw _0x400973;});}return _0x771d79;})[_0x8bb5('0x22')](respondWithResult(_0x1656e2,0xc9))[_0x8bb5('0x40')](handleError(_0x1656e2,null));};exports['clone']=function(_0x47cf9e,_0x17dbe3){var _0x1a41b2={'where':{'id':_0x47cf9e[_0x8bb5('0x42')]['id']}},_0x1730e8={};_0x1730e8[_0x8bb5('0x33')]=_[_0x8bb5('0x2f')](db[_0x8bb5('0x2a')]['rawAttributes']);_0x1a41b2['attributes']=_[_0x8bb5('0x32')](_0x1730e8['model'],qs[_0x8bb5('0x35')](_0x47cf9e['query']['fields']));_0x1a41b2[_0x8bb5('0x34')]=_0x1a41b2[_0x8bb5('0x34')]['length']?_0x1a41b2[_0x8bb5('0x34')]:_0x1730e8[_0x8bb5('0x33')];if(_0x47cf9e['query']['includeAll']){_0x1a41b2[_0x8bb5('0x3e')]=[{'all':!![]}];}_0x1a41b2=_['merge']({},_0x1a41b2,_0x47cf9e[_0x8bb5('0x43')]);return db['JscriptyProject'][_0x8bb5('0x44')](_0x1a41b2)['then'](handleEntityNotFound(_0x17dbe3,null))[_0x8bb5('0x22')](function(_0x3730f6){if(_0x3730f6){var _0xd2ed66=_0x3730f6[_0x8bb5('0x23')]({'plain':!![]});_0xd2ed66=qs[_0x8bb5('0x4d')](_0xd2ed66,['id',_0x8bb5('0x4e'),_0x8bb5('0x4f')]);_0x47cf9e[_0x8bb5('0x46')]=_[_0x8bb5('0x4d')](_0x47cf9e[_0x8bb5('0x46')],['id',_0x8bb5('0x4e'),_0x8bb5('0x4f')]);return db['JscriptyProject'][_0x8bb5('0x45')](_[_0x8bb5('0x3b')](_0xd2ed66,_0x47cf9e['body']),{'include':_0x47cf9e[_0x8bb5('0x30')][_0x8bb5('0x3d')]?[{'all':!![]}]:undefined})[_0x8bb5('0x22')](function(_0x14bbce){var _0x309a91=_0x47cf9e[_0x8bb5('0x49')][_0x8bb5('0x23')]({'plain':!![]});if(!_0x309a91)throw new Error(_0x8bb5('0x47'));if(_0x309a91[_0x8bb5('0x48')]==='user'){var _0x16ae7f=_0x14bbce[_0x8bb5('0x23')]({'plain':!![]});var _0x66dd38=_0x8bb5('0x24');return db[_0x8bb5('0x4a')][_0x8bb5('0x44')]({'where':{'name':_0x66dd38,'userProfileId':_0x309a91[_0x8bb5('0x4b')]},'raw':!![]})[_0x8bb5('0x22')](function(_0x4c439c){if(_0x4c439c&&_0x4c439c[_0x8bb5('0x4c')]===0x0){return db[_0x8bb5('0x25')]['create']({'name':_0x16ae7f['name'],'resourceId':_0x16ae7f['id'],'type':_0x4c439c[_0x8bb5('0x28')],'sectionId':_0x4c439c['id']},{})[_0x8bb5('0x22')](function(){return _0x14bbce;});}else{return _0x14bbce;}})[_0x8bb5('0x40')](function(_0x4f6689){logger[_0x8bb5('0x26')](_0x8bb5('0x50'),_0x4f6689);throw _0x4f6689;});}return _0x14bbce;});}})[_0x8bb5('0x22')](respondWithResult(_0x17dbe3,0xc9))[_0x8bb5('0x40')](handleError(_0x17dbe3,null));};exports[_0x8bb5('0x51')]=function(_0x2beaf6,_0x5d8b5e){if(_0x2beaf6[_0x8bb5('0x46')]['id']){delete _0x2beaf6['body']['id'];}return db[_0x8bb5('0x2a')][_0x8bb5('0x44')]({'where':{'id':_0x2beaf6[_0x8bb5('0x42')]['id']}})[_0x8bb5('0x22')](handleEntityNotFound(_0x5d8b5e,null))[_0x8bb5('0x22')](saveUpdates(_0x2beaf6[_0x8bb5('0x46')],null))['then'](respondWithResult(_0x5d8b5e,null))['catch'](handleError(_0x5d8b5e,null));};exports[_0x8bb5('0x52')]=function(_0x2ef082,_0x4955ea){return db[_0x8bb5('0x2a')][_0x8bb5('0x44')]({'where':{'id':_0x2ef082[_0x8bb5('0x42')]['id']}})[_0x8bb5('0x22')](handleEntityNotFound(_0x4955ea,null))[_0x8bb5('0x22')](removeEntity(_0x4955ea,null))[_0x8bb5('0x40')](handleError(_0x4955ea,null));};exports['getSessions']=function(_0x44aa8b,_0x58b613,_0x5cd7fd){var _0x15e055={'raw':!![],'where':{}};var _0x1d6350={};var _0x5460a1={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8bb5('0x53')]({'where':{'id':_0x44aa8b[_0x8bb5('0x42')]['id']}})['then'](handleEntityNotFound(_0x58b613,null))['then'](function(_0x286d50){if(_0x286d50){_0x1d6350[_0x8bb5('0x33')]=_[_0x8bb5('0x2f')](db[_0x8bb5('0x54')][_0x8bb5('0x55')]);_0x1d6350[_0x8bb5('0x30')]=_[_0x8bb5('0x2f')](_0x44aa8b[_0x8bb5('0x30')]);_0x1d6350[_0x8bb5('0x31')]=_[_0x8bb5('0x32')](_0x1d6350[_0x8bb5('0x33')],_0x1d6350[_0x8bb5('0x30')]);_0x15e055[_0x8bb5('0x34')]=_['intersection'](_0x1d6350[_0x8bb5('0x33')],qs['fields'](_0x44aa8b[_0x8bb5('0x30')][_0x8bb5('0x35')]));_0x15e055['attributes']=_0x15e055[_0x8bb5('0x34')][_0x8bb5('0x56')]?_0x15e055[_0x8bb5('0x34')]:_0x1d6350[_0x8bb5('0x33')];if(!_0x44aa8b[_0x8bb5('0x30')][_0x8bb5('0x36')]('nolimit')){_0x15e055[_0x8bb5('0x1b')]=qs[_0x8bb5('0x1b')](_0x44aa8b[_0x8bb5('0x30')]['limit']);_0x15e055[_0x8bb5('0x1a')]=qs[_0x8bb5('0x1a')](_0x44aa8b[_0x8bb5('0x30')]['offset']);}_0x15e055[_0x8bb5('0x57')]=qs[_0x8bb5('0x38')](_0x44aa8b[_0x8bb5('0x30')]['sort']);_0x15e055[_0x8bb5('0x39')]=qs[_0x8bb5('0x31')](_[_0x8bb5('0x58')](_0x44aa8b[_0x8bb5('0x30')],_0x1d6350[_0x8bb5('0x31')]));_0x15e055[_0x8bb5('0x39')][_0x8bb5('0x59')]=_0x286d50['id'];if(_0x44aa8b['query']['filter']){_0x15e055[_0x8bb5('0x39')]=_['merge'](_0x15e055[_0x8bb5('0x39')],{'$or':_[_0x8bb5('0x2e')](_0x15e055[_0x8bb5('0x34')],function(_0x1c3074){var _0x5b6520={};_0x5b6520[_0x1c3074]={'$like':'%'+_0x44aa8b[_0x8bb5('0x30')]['filter']+'%'};return _0x5b6520;})});}_0x15e055=_[_0x8bb5('0x3b')]({},_0x15e055,_0x44aa8b['options']);return db[_0x8bb5('0x54')][_0x8bb5('0x1d')]({'where':_0x15e055[_0x8bb5('0x39')]})[_0x8bb5('0x22')](function(_0x2b1005){_0x5460a1['count']=_0x2b1005;if(_0x44aa8b[_0x8bb5('0x30')][_0x8bb5('0x3d')]){_0x15e055['include']=[{'all':!![]}];}return db[_0x8bb5('0x54')]['findAll'](_0x15e055);})['then'](function(_0x40d710){_0x5460a1[_0x8bb5('0x3f')]=_0x40d710;return _0x5460a1;});}})['then'](respondWithFilteredResult(_0x58b613,_0x15e055))[_0x8bb5('0x40')](handleError(_0x58b613,null));};exports[_0x8bb5('0x5a')]=function(_0x3c7770,_0x52b3ac,_0x23b959){var _0x33c185={'raw':!![],'where':{}};var _0x309407={};var _0x319ee7={'count':0x0,'rows':[]};return db[_0x8bb5('0x2a')][_0x8bb5('0x53')]({'where':{'id':_0x3c7770[_0x8bb5('0x42')]['id']}})[_0x8bb5('0x22')](handleEntityNotFound(_0x52b3ac,null))[_0x8bb5('0x22')](function(_0x6ae78c){if(_0x6ae78c){_0x309407[_0x8bb5('0x33')]=_[_0x8bb5('0x2f')](db[_0x8bb5('0x5b')]['rawAttributes']);_0x309407[_0x8bb5('0x30')]=_[_0x8bb5('0x2f')](_0x3c7770['query']);_0x309407[_0x8bb5('0x31')]=_[_0x8bb5('0x32')](_0x309407[_0x8bb5('0x33')],_0x309407[_0x8bb5('0x30')]);_0x33c185[_0x8bb5('0x34')]=_[_0x8bb5('0x32')](_0x309407[_0x8bb5('0x33')],qs[_0x8bb5('0x35')](_0x3c7770[_0x8bb5('0x30')][_0x8bb5('0x35')]));_0x33c185[_0x8bb5('0x34')]=_0x33c185[_0x8bb5('0x34')][_0x8bb5('0x56')]?_0x33c185[_0x8bb5('0x34')]:_0x309407['model'];if(!_0x3c7770[_0x8bb5('0x30')]['hasOwnProperty'](_0x8bb5('0x37'))){_0x33c185[_0x8bb5('0x1b')]=qs['limit'](_0x3c7770[_0x8bb5('0x30')][_0x8bb5('0x1b')]);_0x33c185[_0x8bb5('0x1a')]=qs['offset'](_0x3c7770[_0x8bb5('0x30')][_0x8bb5('0x1a')]);}_0x33c185[_0x8bb5('0x57')]=qs[_0x8bb5('0x38')](_0x3c7770['query'][_0x8bb5('0x38')]);_0x33c185[_0x8bb5('0x39')]=qs[_0x8bb5('0x31')](_['pick'](_0x3c7770['query'],_0x309407[_0x8bb5('0x31')]));_0x33c185[_0x8bb5('0x39')][_0x8bb5('0x59')]=_0x6ae78c['id'];if(_0x3c7770[_0x8bb5('0x30')]['filter']){_0x33c185[_0x8bb5('0x39')]=_['merge'](_0x33c185[_0x8bb5('0x39')],{'$or':_[_0x8bb5('0x2e')](_0x33c185[_0x8bb5('0x34')],function(_0xf61349){var _0x32e90e={};_0x32e90e[_0xf61349]={'$like':'%'+_0x3c7770[_0x8bb5('0x30')][_0x8bb5('0x3a')]+'%'};return _0x32e90e;})});}_0x33c185=_[_0x8bb5('0x3b')]({},_0x33c185,_0x3c7770[_0x8bb5('0x43')]);return db[_0x8bb5('0x5b')][_0x8bb5('0x1d')]({'where':_0x33c185[_0x8bb5('0x39')]})[_0x8bb5('0x22')](function(_0x5490b2){_0x319ee7['count']=_0x5490b2;if(_0x3c7770[_0x8bb5('0x30')][_0x8bb5('0x3d')]){_0x33c185[_0x8bb5('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x33c185);})[_0x8bb5('0x22')](function(_0x4282c5){_0x319ee7['rows']=_0x4282c5;return _0x319ee7;});}})[_0x8bb5('0x22')](respondWithFilteredResult(_0x52b3ac,_0x33c185))[_0x8bb5('0x40')](handleError(_0x52b3ac,null));};function char(_0x3d5308){return _0x8bb5('0x5c')===typeof _0x3d5308?String[_0x8bb5('0x5d')][_0x8bb5('0x21')](null,arguments):_0x3d5308;}function needsEncapsulation(_0x25bd91){return!!_0x25bd91&&(_0x25bd91['toString']()[_0x8bb5('0x5e')](char(0xd))>=0x0||_0x25bd91[_0x8bb5('0x5f')]()[_0x8bb5('0x5e')](char(0xa))>=0x0||_0x25bd91[_0x8bb5('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x25bd91[_0x8bb5('0x5f')]()[_0x8bb5('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x3167a5){var _0x38a1a5=char(0x22),_0xcdf4f8='\x5c'+char(0x22),_0x25bb4b=_0x3167a5['toString']()['replace'](new RegExp(_0x38a1a5,'g'),_0xcdf4f8);return _0x38a1a5+_0x25bb4b+_0x38a1a5;}exports[_0x8bb5('0x60')]=function(_0x339ae5,_0x3ba58d,_0x38ef1c){var _0x7a6134,_0x3b8a53;var _0x5e8f29={'where':{'ProjectId':_0x339ae5[_0x8bb5('0x42')]['id']}};if(_0x339ae5[_0x8bb5('0x30')]['startTime']){_0x5e8f29[_0x8bb5('0x39')]['starttime']=JSON[_0x8bb5('0x61')](_0x339ae5['query'][_0x8bb5('0x62')]);}return db[_0x8bb5('0x54')][_0x8bb5('0x63')](_0x5e8f29)['then'](handleEntityNotFound(_0x3ba58d,null))['then'](function(_0x3423da){if(_0x3423da){_0x7a6134=_0x3423da;return db[_0x8bb5('0x64')][_0x8bb5('0x63')]({'where':{'SessionId':{'$in':_[_0x8bb5('0x2e')](_0x7a6134,'id')},'ProjectId':_0x339ae5[_0x8bb5('0x42')]['id']},'order':_0x8bb5('0x65')});}})[_0x8bb5('0x22')](handleEntityNotFound(_0x3ba58d,null))[_0x8bb5('0x22')](function(_0x3c7d72){if(_0x3c7d72){_0x3b8a53=_0x3c7d72;var _0x44c449={};for(var _0x4e27ee=0x0,_0x29cc63=_0x3b8a53[_0x8bb5('0x56')];_0x4e27ee<_0x29cc63;_0x4e27ee++){if(!_0x44c449[_0x8bb5('0x36')](_0x3b8a53[_0x4e27ee]['questionId'])){_0x44c449[_0x3b8a53[_0x4e27ee][_0x8bb5('0x66')]]=needsEncapsulation(_0x3b8a53[_0x4e27ee][_0x8bb5('0x67')])?encapsulate(_0x3b8a53[_0x4e27ee][_0x8bb5('0x67')]):_0x3b8a53[_0x4e27ee][_0x8bb5('0x67')];}}var _0x11307e=[],_0xb1ee55={};for(var _0x2c80c1=0x0,_0x153cb2=_0x7a6134[_0x8bb5('0x56')];_0x2c80c1<_0x153cb2;_0x2c80c1++){_0xb1ee55={'ProjectId':_0x339ae5[_0x8bb5('0x42')]['id'],'SessionId':_0x7a6134[_0x2c80c1]['id'],'StartTime':moment(_0x7a6134[_0x2c80c1][_0x8bb5('0x68')])['format'](_0x8bb5('0x69'))};for(var _0x464e9c=0x0,_0x567cf2=_0x3b8a53[_0x8bb5('0x56')];_0x464e9c<_0x567cf2;_0x464e9c++){if(_0x3b8a53[_0x464e9c][_0x8bb5('0x6a')]==_0x7a6134[_0x2c80c1]['id']&&_0x44c449['hasOwnProperty'](_0x3b8a53[_0x464e9c][_0x8bb5('0x66')])){_0xb1ee55[_0x44c449[_0x3b8a53[_0x464e9c][_0x8bb5('0x66')]]]=_0x3b8a53[_0x464e9c][_0x8bb5('0x6b')];}}for(var _0xddca1f in _0x44c449){if(!_0xb1ee55[_0x8bb5('0x36')](_0x44c449[_0xddca1f])){_0xb1ee55[_0x44c449[_0xddca1f]]=null;}}_0x11307e[_0x8bb5('0x6c')](_0xb1ee55);}return _0x11307e;}})[_0x8bb5('0x22')](function(_0x2ba9e6){if(!_['isEmpty'](_0x2ba9e6)){var _0x37d87e=toCsv(_0x2ba9e6);var _0x43c090=Date[_0x8bb5('0x6d')]();fs[_0x8bb5('0x6e')](util[_0x8bb5('0x6f')](_0x8bb5('0x70'),_0x339ae5[_0x8bb5('0x42')]['id'],_0x43c090),_0x37d87e);_0x3ba58d['setHeader'](_0x8bb5('0x71'),_0x8bb5('0x72')+util[_0x8bb5('0x6f')](_0x8bb5('0x73'),_0x339ae5['params']['id'],_0x43c090));_0x3ba58d[_0x8bb5('0x74')]('Content-type','text/csv');return _0x3ba58d[_0x8bb5('0x75')](util[_0x8bb5('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x339ae5['params']['id'],_0x43c090));}else{return _0x3ba58d['sendStatus'](0xcc);}})[_0x8bb5('0x40')](handleError(_0x3ba58d,null));}; \ No newline at end of file +var _0xf457=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','catch','show','params','keys','length','includeAll','create','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','user','role','Projects','getSessions','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse'];(function(_0x47e981,_0x5e46b5){var _0xe8d12d=function(_0xb539c2){while(--_0xb539c2){_0x47e981['push'](_0x47e981['shift']());}};_0xe8d12d(++_0x5e46b5);}(_0xf457,0x1c8));var _0x7f45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf457[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7f45('0x0'));var rimraf=require(_0x7f45('0x1'));var zipdir=require(_0x7f45('0x2'));var jsonpatch=require(_0x7f45('0x3'));var rp=require('request-promise');var moment=require(_0x7f45('0x4'));var BPromise=require(_0x7f45('0x5'));var Mustache=require(_0x7f45('0x6'));var util=require('util');var path=require(_0x7f45('0x7'));var sox=require(_0x7f45('0x8'));var csv=require(_0x7f45('0x9'));var ejs=require(_0x7f45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f45('0xb'));var crypto=require(_0x7f45('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f45('0xd'));var toCsv=require(_0x7f45('0x9'));var querystring=require(_0x7f45('0xe'));var Papa=require(_0x7f45('0xf'));var Redis=require(_0x7f45('0x10'));var authService=require(_0x7f45('0x11'));var qs=require(_0x7f45('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f45('0x13'));var logger=require('../../config/logger')(_0x7f45('0x14'));var utils=require(_0x7f45('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f45('0x16'));var db=require(_0x7f45('0x17'))['db'];function respondWithStatusCode(_0x4ad96a,_0x17410f){_0x17410f=_0x17410f||0xcc;return function(_0x4394df){if(_0x4394df){return _0x4ad96a['sendStatus'](_0x17410f);}return _0x4ad96a[_0x7f45('0x18')](_0x17410f)[_0x7f45('0x19')]();};}function respondWithResult(_0x95ccd6,_0x580310){_0x580310=_0x580310||0xc8;return function(_0x15b1b7){if(_0x15b1b7){return _0x95ccd6[_0x7f45('0x18')](_0x580310)[_0x7f45('0x1a')](_0x15b1b7);}};}function respondWithFilteredResult(_0x330353,_0x1218b4){return function(_0x454d17){if(_0x454d17){var _0x45bee8=typeof _0x1218b4['offset']===_0x7f45('0x1b')&&typeof _0x1218b4['limit']==='undefined';var _0x120d31=_0x454d17[_0x7f45('0x1c')];var _0x133cee=_0x45bee8?0x0:_0x1218b4[_0x7f45('0x1d')];var _0x4852cc=_0x45bee8?_0x454d17[_0x7f45('0x1c')]:_0x1218b4[_0x7f45('0x1d')]+_0x1218b4[_0x7f45('0x1e')];var _0x2390c4;if(_0x4852cc>=_0x120d31){_0x4852cc=_0x120d31;_0x2390c4=0xc8;}else{_0x2390c4=0xce;}_0x330353['status'](_0x2390c4);return _0x330353[_0x7f45('0x1f')](_0x7f45('0x20'),_0x133cee+'-'+_0x4852cc+'/'+_0x120d31)[_0x7f45('0x1a')](_0x454d17);}return null;};}function patchUpdates(_0x5d67dd){return function(_0x2fd236){try{jsonpatch[_0x7f45('0x21')](_0x2fd236,_0x5d67dd,!![]);}catch(_0x5d4af2){return BPromise[_0x7f45('0x22')](_0x5d4af2);}return _0x2fd236[_0x7f45('0x23')]();};}function saveUpdates(_0x50a9d6,_0x28388b){return function(_0x3dae9c){if(_0x3dae9c){return _0x3dae9c[_0x7f45('0x24')](_0x50a9d6)[_0x7f45('0x25')](function(_0x1d0b7a){return _0x1d0b7a;});}return null;};}function removeEntity(_0x3917b3,_0x5438ad){return function(_0x5d8561){if(_0x5d8561){return _0x5d8561[_0x7f45('0x26')]()['then'](function(){var _0x272c46=_0x5d8561[_0x7f45('0x27')]({'plain':!![]});var _0x3c5ed7='Projects';return db[_0x7f45('0x28')][_0x7f45('0x26')]({'where':{'type':_0x3c5ed7,'resourceId':_0x272c46['id']}})['then'](function(){return _0x5d8561;});})['then'](function(){_0x3917b3[_0x7f45('0x18')](0xcc)[_0x7f45('0x19')]();});}};}function handleEntityNotFound(_0x9ca8d5,_0x3b522b){return function(_0x126c32){if(!_0x126c32){_0x9ca8d5[_0x7f45('0x29')](0x194);}return _0x126c32;};}function handleError(_0x58f494,_0x5c01a5){_0x5c01a5=_0x5c01a5||0x1f4;return function(_0x583244){logger[_0x7f45('0x2a')](_0x583244[_0x7f45('0x2b')]);if(_0x583244[_0x7f45('0x2c')]){delete _0x583244[_0x7f45('0x2c')];}_0x58f494[_0x7f45('0x18')](_0x5c01a5)[_0x7f45('0x2d')](_0x583244);};}exports[_0x7f45('0x2e')]=function(_0x15a0b4,_0x29c6e1){var _0x317bb4={},_0x2f9169={},_0x3c1be7={'count':0x0,'rows':[]};var _0x2c08db=_[_0x7f45('0x2f')](db['JscriptyProject'][_0x7f45('0x30')],function(_0x570ce8){return{'name':_0x570ce8[_0x7f45('0x31')],'type':_0x570ce8[_0x7f45('0x32')][_0x7f45('0x33')]};});_0x2f9169[_0x7f45('0x34')]=_[_0x7f45('0x2f')](_0x2c08db,_0x7f45('0x2c'));_0x2f9169[_0x7f45('0x35')]=_['keys'](_0x15a0b4[_0x7f45('0x35')]);_0x2f9169[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x2f9169[_0x7f45('0x34')],_0x2f9169['query']);_0x317bb4[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x2f9169['model'],qs[_0x7f45('0x39')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x39')]));_0x317bb4['attributes']=_0x317bb4[_0x7f45('0x38')]['length']?_0x317bb4['attributes']:_0x2f9169[_0x7f45('0x34')];if(!_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3a')](_0x7f45('0x3b'))){_0x317bb4[_0x7f45('0x1e')]=qs[_0x7f45('0x1e')](_0x15a0b4[_0x7f45('0x35')]['limit']);_0x317bb4['offset']=qs[_0x7f45('0x1d')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x1d')]);}_0x317bb4[_0x7f45('0x3c')]=qs[_0x7f45('0x3d')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3d')]);_0x317bb4[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_['pick'](_0x15a0b4[_0x7f45('0x35')],_0x2f9169[_0x7f45('0x36')]),_0x2c08db);if(_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3f')]){_0x317bb4['where']=_[_0x7f45('0x40')](_0x317bb4[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0x2c08db,function(_0x2d3e1d){if(_0x2d3e1d[_0x7f45('0x32')]!==_0x7f45('0x41')){var _0x4881d2={};_0x4881d2[_0x2d3e1d[_0x7f45('0x2c')]]={'$like':'%'+_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3f')]+'%'};return _0x4881d2;}})});}_0x317bb4=_[_0x7f45('0x40')]({},_0x317bb4,_0x15a0b4[_0x7f45('0x42')]);var _0x30f488={'where':_0x317bb4['where']};return db[_0x7f45('0x43')][_0x7f45('0x1c')](_0x30f488)[_0x7f45('0x25')](function(_0x407e01){_0x3c1be7['count']=_0x407e01;if(_0x15a0b4[_0x7f45('0x35')]['includeAll']){_0x317bb4[_0x7f45('0x44')]=[{'all':!![]}];}return db[_0x7f45('0x43')][_0x7f45('0x45')](_0x317bb4);})[_0x7f45('0x25')](function(_0x447dec){_0x3c1be7['rows']=_0x447dec;return _0x3c1be7;})[_0x7f45('0x25')](respondWithFilteredResult(_0x29c6e1,_0x317bb4))[_0x7f45('0x46')](handleError(_0x29c6e1,null));};exports[_0x7f45('0x47')]=function(_0x16e11d,_0x55f86c){var _0x42ce83={'raw':![],'where':{'id':_0x16e11d[_0x7f45('0x48')]['id']}},_0x451892={};_0x451892['model']=_[_0x7f45('0x49')](db[_0x7f45('0x43')][_0x7f45('0x30')]);_0x451892['query']=_[_0x7f45('0x49')](_0x16e11d['query']);_0x451892[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x451892[_0x7f45('0x34')],_0x451892[_0x7f45('0x35')]);_0x42ce83[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x451892['model'],qs[_0x7f45('0x39')](_0x16e11d[_0x7f45('0x35')][_0x7f45('0x39')]));_0x42ce83['attributes']=_0x42ce83[_0x7f45('0x38')][_0x7f45('0x4a')]?_0x42ce83[_0x7f45('0x38')]:_0x451892['model'];if(_0x16e11d[_0x7f45('0x35')][_0x7f45('0x4b')]){_0x42ce83['include']=[{'all':!![]}];}_0x42ce83=_[_0x7f45('0x40')]({},_0x42ce83,_0x16e11d['options']);return db['JscriptyProject']['find'](_0x42ce83)[_0x7f45('0x25')](handleEntityNotFound(_0x55f86c,null))['then'](respondWithResult(_0x55f86c,null))['catch'](handleError(_0x55f86c,null));};exports['create']=function(_0x58d14d,_0x2a1300){return db[_0x7f45('0x43')][_0x7f45('0x4c')](_0x58d14d['body'],{})['then'](function(_0x427f66){var _0xec196f=_0x58d14d['user'][_0x7f45('0x27')]({'plain':!![]});if(!_0xec196f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec196f['role']==='user'){var _0x3ade33=_0x427f66[_0x7f45('0x27')]({'plain':!![]});var _0x4b273f='Projects';return db[_0x7f45('0x4d')][_0x7f45('0x4e')]({'where':{'name':_0x4b273f,'userProfileId':_0xec196f['userProfileId']},'raw':!![]})[_0x7f45('0x25')](function(_0x481a57){if(_0x481a57&&_0x481a57[_0x7f45('0x4f')]===0x0){return db[_0x7f45('0x28')][_0x7f45('0x4c')]({'name':_0x3ade33[_0x7f45('0x2c')],'resourceId':_0x3ade33['id'],'type':_0x481a57[_0x7f45('0x2c')],'sectionId':_0x481a57['id']},{})[_0x7f45('0x25')](function(){return _0x427f66;});}else{return _0x427f66;}})[_0x7f45('0x46')](function(_0xb443ce){logger[_0x7f45('0x2a')](_0x7f45('0x50'),_0xb443ce);throw _0xb443ce;});}return _0x427f66;})[_0x7f45('0x25')](respondWithResult(_0x2a1300,0xc9))[_0x7f45('0x46')](handleError(_0x2a1300,null));};exports[_0x7f45('0x51')]=function(_0x20ea6b,_0x33ba70){var _0x5467f1={'where':{'id':_0x20ea6b['params']['id']}},_0x28cbd0={};_0x28cbd0[_0x7f45('0x34')]=_[_0x7f45('0x49')](db[_0x7f45('0x43')][_0x7f45('0x30')]);_0x5467f1[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x28cbd0[_0x7f45('0x34')],qs[_0x7f45('0x39')](_0x20ea6b[_0x7f45('0x35')][_0x7f45('0x39')]));_0x5467f1[_0x7f45('0x38')]=_0x5467f1['attributes']['length']?_0x5467f1[_0x7f45('0x38')]:_0x28cbd0[_0x7f45('0x34')];if(_0x20ea6b[_0x7f45('0x35')][_0x7f45('0x4b')]){_0x5467f1[_0x7f45('0x44')]=[{'all':!![]}];}_0x5467f1=_[_0x7f45('0x40')]({},_0x5467f1,_0x20ea6b[_0x7f45('0x42')]);return db[_0x7f45('0x43')]['find'](_0x5467f1)[_0x7f45('0x25')](handleEntityNotFound(_0x33ba70,null))['then'](function(_0xda86bc){if(_0xda86bc){var _0xd30932=_0xda86bc[_0x7f45('0x27')]({'plain':!![]});_0xd30932=qs[_0x7f45('0x52')](_0xd30932,['id','createdAt',_0x7f45('0x53')]);_0x20ea6b[_0x7f45('0x54')]=_['omit'](_0x20ea6b[_0x7f45('0x54')],['id',_0x7f45('0x55'),_0x7f45('0x53')]);return db[_0x7f45('0x43')][_0x7f45('0x4c')](_[_0x7f45('0x40')](_0xd30932,_0x20ea6b[_0x7f45('0x54')]),{'include':_0x20ea6b[_0x7f45('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x7f45('0x25')](function(_0xfdf3ae){var _0x10a000=_0x20ea6b[_0x7f45('0x56')]['get']({'plain':!![]});if(!_0x10a000)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10a000[_0x7f45('0x57')]===_0x7f45('0x56')){var _0x2cb361=_0xfdf3ae[_0x7f45('0x27')]({'plain':!![]});var _0x1b9af3=_0x7f45('0x58');return db[_0x7f45('0x4d')][_0x7f45('0x4e')]({'where':{'name':_0x1b9af3,'userProfileId':_0x10a000['userProfileId']},'raw':!![]})[_0x7f45('0x25')](function(_0x5ebf21){if(_0x5ebf21&&_0x5ebf21[_0x7f45('0x4f')]===0x0){return db[_0x7f45('0x28')][_0x7f45('0x4c')]({'name':_0x2cb361[_0x7f45('0x2c')],'resourceId':_0x2cb361['id'],'type':_0x5ebf21[_0x7f45('0x2c')],'sectionId':_0x5ebf21['id']},{})[_0x7f45('0x25')](function(){return _0xfdf3ae;});}else{return _0xfdf3ae;}})['catch'](function(_0x1a969b){logger[_0x7f45('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a969b);throw _0x1a969b;});}return _0xfdf3ae;});}})[_0x7f45('0x25')](respondWithResult(_0x33ba70,0xc9))[_0x7f45('0x46')](handleError(_0x33ba70,null));};exports[_0x7f45('0x24')]=function(_0x5a5b2b,_0x1239db){if(_0x5a5b2b[_0x7f45('0x54')]['id']){delete _0x5a5b2b[_0x7f45('0x54')]['id'];}return db[_0x7f45('0x43')][_0x7f45('0x4e')]({'where':{'id':_0x5a5b2b[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x1239db,null))[_0x7f45('0x25')](saveUpdates(_0x5a5b2b[_0x7f45('0x54')],null))[_0x7f45('0x25')](respondWithResult(_0x1239db,null))['catch'](handleError(_0x1239db,null));};exports[_0x7f45('0x26')]=function(_0x1035d6,_0x232a0d){return db[_0x7f45('0x43')]['find']({'where':{'id':_0x1035d6[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x232a0d,null))[_0x7f45('0x25')](removeEntity(_0x232a0d,null))['catch'](handleError(_0x232a0d,null));};exports[_0x7f45('0x59')]=function(_0x1f883c,_0x32c266,_0x58684f){var _0x4ffe61={'raw':!![],'where':{}};var _0x3f58b8={};var _0x415374={'count':0x0,'rows':[]};return db[_0x7f45('0x43')]['findOne']({'where':{'id':_0x1f883c[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x32c266,null))['then'](function(_0x1de280){if(_0x1de280){_0x3f58b8['model']=_[_0x7f45('0x49')](db[_0x7f45('0x5a')][_0x7f45('0x30')]);_0x3f58b8[_0x7f45('0x35')]=_[_0x7f45('0x49')](_0x1f883c[_0x7f45('0x35')]);_0x3f58b8[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x3f58b8['model'],_0x3f58b8[_0x7f45('0x35')]);_0x4ffe61[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x3f58b8['model'],qs[_0x7f45('0x39')](_0x1f883c[_0x7f45('0x35')][_0x7f45('0x39')]));_0x4ffe61[_0x7f45('0x38')]=_0x4ffe61[_0x7f45('0x38')][_0x7f45('0x4a')]?_0x4ffe61[_0x7f45('0x38')]:_0x3f58b8[_0x7f45('0x34')];if(!_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3a')](_0x7f45('0x3b'))){_0x4ffe61['limit']=qs[_0x7f45('0x1e')](_0x1f883c['query']['limit']);_0x4ffe61[_0x7f45('0x1d')]=qs[_0x7f45('0x1d')](_0x1f883c[_0x7f45('0x35')][_0x7f45('0x1d')]);}_0x4ffe61[_0x7f45('0x3c')]=qs['sort'](_0x1f883c['query']['sort']);_0x4ffe61[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_[_0x7f45('0x5b')](_0x1f883c['query'],_0x3f58b8[_0x7f45('0x36')]));_0x4ffe61[_0x7f45('0x3e')][_0x7f45('0x5c')]=_0x1de280['id'];if(_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3f')]){_0x4ffe61[_0x7f45('0x3e')]=_[_0x7f45('0x40')](_0x4ffe61[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0x4ffe61[_0x7f45('0x38')],function(_0x343de7){var _0x3ce8cf={};_0x3ce8cf[_0x343de7]={'$like':'%'+_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3f')]+'%'};return _0x3ce8cf;})});}_0x4ffe61=_[_0x7f45('0x40')]({},_0x4ffe61,_0x1f883c[_0x7f45('0x42')]);return db['JscriptySessionReport'][_0x7f45('0x1c')]({'where':_0x4ffe61['where']})[_0x7f45('0x25')](function(_0x586384){_0x415374[_0x7f45('0x1c')]=_0x586384;if(_0x1f883c[_0x7f45('0x35')]['includeAll']){_0x4ffe61['include']=[{'all':!![]}];}return db[_0x7f45('0x5a')]['findAll'](_0x4ffe61);})[_0x7f45('0x25')](function(_0x5e240f){_0x415374[_0x7f45('0x5d')]=_0x5e240f;return _0x415374;});}})[_0x7f45('0x25')](respondWithFilteredResult(_0x32c266,_0x4ffe61))[_0x7f45('0x46')](handleError(_0x32c266,null));};exports[_0x7f45('0x5e')]=function(_0x48e4a9,_0x318844,_0x271c91){var _0xaf4fa7={'raw':!![],'where':{}};var _0x4c7bd6={};var _0x4d4beb={'count':0x0,'rows':[]};return db[_0x7f45('0x43')]['findOne']({'where':{'id':_0x48e4a9[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x318844,null))[_0x7f45('0x25')](function(_0x4b1e4a){if(_0x4b1e4a){_0x4c7bd6['model']=_[_0x7f45('0x49')](db[_0x7f45('0x5f')]['rawAttributes']);_0x4c7bd6[_0x7f45('0x35')]=_[_0x7f45('0x49')](_0x48e4a9[_0x7f45('0x35')]);_0x4c7bd6['filters']=_['intersection'](_0x4c7bd6[_0x7f45('0x34')],_0x4c7bd6[_0x7f45('0x35')]);_0xaf4fa7[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x4c7bd6[_0x7f45('0x34')],qs['fields'](_0x48e4a9['query'][_0x7f45('0x39')]));_0xaf4fa7['attributes']=_0xaf4fa7['attributes']['length']?_0xaf4fa7[_0x7f45('0x38')]:_0x4c7bd6[_0x7f45('0x34')];if(!_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x3a')]('nolimit')){_0xaf4fa7['limit']=qs[_0x7f45('0x1e')](_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x1e')]);_0xaf4fa7[_0x7f45('0x1d')]=qs[_0x7f45('0x1d')](_0x48e4a9['query'][_0x7f45('0x1d')]);}_0xaf4fa7[_0x7f45('0x3c')]=qs[_0x7f45('0x3d')](_0x48e4a9[_0x7f45('0x35')]['sort']);_0xaf4fa7[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_[_0x7f45('0x5b')](_0x48e4a9[_0x7f45('0x35')],_0x4c7bd6['filters']));_0xaf4fa7[_0x7f45('0x3e')][_0x7f45('0x5c')]=_0x4b1e4a['id'];if(_0x48e4a9['query']['filter']){_0xaf4fa7[_0x7f45('0x3e')]=_[_0x7f45('0x40')](_0xaf4fa7[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0xaf4fa7['attributes'],function(_0x567da6){var _0x48c023={};_0x48c023[_0x567da6]={'$like':'%'+_0x48e4a9['query']['filter']+'%'};return _0x48c023;})});}_0xaf4fa7=_['merge']({},_0xaf4fa7,_0x48e4a9[_0x7f45('0x42')]);return db['JscriptyAnswerReport'][_0x7f45('0x1c')]({'where':_0xaf4fa7[_0x7f45('0x3e')]})[_0x7f45('0x25')](function(_0x570c32){_0x4d4beb['count']=_0x570c32;if(_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x4b')]){_0xaf4fa7[_0x7f45('0x44')]=[{'all':!![]}];}return db[_0x7f45('0x5f')]['findAll'](_0xaf4fa7);})[_0x7f45('0x25')](function(_0x1c896){_0x4d4beb[_0x7f45('0x5d')]=_0x1c896;return _0x4d4beb;});}})[_0x7f45('0x25')](respondWithFilteredResult(_0x318844,_0xaf4fa7))[_0x7f45('0x46')](handleError(_0x318844,null));};function char(_0x8eb800){return _0x7f45('0x60')===typeof _0x8eb800?String['fromCharCode'][_0x7f45('0x21')](null,arguments):_0x8eb800;}function needsEncapsulation(_0x42acba){return!!_0x42acba&&(_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0xd))>=0x0||_0x42acba['toString']()[_0x7f45('0x62')](char(0xa))>=0x0||_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0x2c))>=0x0||_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0x22))>=0x0);}function encapsulate(_0x52b732){var _0x569394=char(0x22),_0x3d1371='\x5c'+char(0x22),_0x1d6833=_0x52b732[_0x7f45('0x61')]()[_0x7f45('0x63')](new RegExp(_0x569394,'g'),_0x3d1371);return _0x569394+_0x1d6833+_0x569394;}exports['getSummary']=function(_0x111d92,_0x177bab,_0x203f87){var _0x1830b1,_0x282542;var _0x4fb7f9={'where':{'ProjectId':_0x111d92['params']['id']}};if(_0x111d92['query'][_0x7f45('0x64')]){_0x4fb7f9[_0x7f45('0x3e')][_0x7f45('0x65')]=JSON[_0x7f45('0x66')](_0x111d92[_0x7f45('0x35')][_0x7f45('0x64')]);}return db[_0x7f45('0x5a')][_0x7f45('0x45')](_0x4fb7f9)[_0x7f45('0x25')](handleEntityNotFound(_0x177bab,null))['then'](function(_0x4f40e3){if(_0x4f40e3){_0x1830b1=_0x4f40e3;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x7f45('0x2f')](_0x1830b1,'id')},'ProjectId':_0x111d92[_0x7f45('0x48')]['id']},'order':_0x7f45('0x67')});}})[_0x7f45('0x25')](handleEntityNotFound(_0x177bab,null))[_0x7f45('0x25')](function(_0x57858e){if(_0x57858e){_0x282542=_0x57858e;var _0x4b1765={};for(var _0x4b8b3f=0x0,_0x18fdff=_0x282542[_0x7f45('0x4a')];_0x4b8b3f<_0x18fdff;_0x4b8b3f++){if(!_0x4b1765[_0x7f45('0x3a')](_0x282542[_0x4b8b3f][_0x7f45('0x68')])){_0x4b1765[_0x282542[_0x4b8b3f]['questionId']]=needsEncapsulation(_0x282542[_0x4b8b3f]['question'])?encapsulate(_0x282542[_0x4b8b3f][_0x7f45('0x69')]):_0x282542[_0x4b8b3f][_0x7f45('0x69')];}}var _0x5c49a1=[],_0x37a445={};for(var _0x313409=0x0,_0x3bfe68=_0x1830b1[_0x7f45('0x4a')];_0x313409<_0x3bfe68;_0x313409++){_0x37a445={'ProjectId':_0x111d92[_0x7f45('0x48')]['id'],'SessionId':_0x1830b1[_0x313409]['id'],'StartTime':moment(_0x1830b1[_0x313409][_0x7f45('0x65')])[_0x7f45('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1b97ad=0x0,_0x1b9010=_0x282542[_0x7f45('0x4a')];_0x1b97ad<_0x1b9010;_0x1b97ad++){if(_0x282542[_0x1b97ad][_0x7f45('0x6b')]==_0x1830b1[_0x313409]['id']&&_0x4b1765[_0x7f45('0x3a')](_0x282542[_0x1b97ad][_0x7f45('0x68')])){_0x37a445[_0x4b1765[_0x282542[_0x1b97ad][_0x7f45('0x68')]]]=_0x282542[_0x1b97ad][_0x7f45('0x6c')];}}for(var _0x30f369 in _0x4b1765){if(!_0x37a445[_0x7f45('0x3a')](_0x4b1765[_0x30f369])){_0x37a445[_0x4b1765[_0x30f369]]=null;}}_0x5c49a1['push'](_0x37a445);}return _0x5c49a1;}})[_0x7f45('0x25')](function(_0x1a2db9){if(!_[_0x7f45('0x6d')](_0x1a2db9)){var _0x564678=toCsv(_0x1a2db9);var _0x2b8377=Date[_0x7f45('0x6e')]();fs[_0x7f45('0x6f')](util[_0x7f45('0x6a')](_0x7f45('0x70'),_0x111d92['params']['id'],_0x2b8377),_0x564678);_0x177bab['setHeader']('Content-disposition',_0x7f45('0x71')+util[_0x7f45('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x111d92['params']['id'],_0x2b8377));_0x177bab[_0x7f45('0x72')](_0x7f45('0x73'),_0x7f45('0x74'));return _0x177bab[_0x7f45('0x75')](util[_0x7f45('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x111d92['params']['id'],_0x2b8377));}else{return _0x177bab[_0x7f45('0x29')](0xcc);}})[_0x7f45('0x46')](handleError(_0x177bab,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e2a0892..7236cd3 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 _0x6c32=['jscripty_projects','lodash','../../config/logger','moment','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0xa9a4cc,_0x2cf58a){var _0x36569c=function(_0x3adf25){while(--_0x3adf25){_0xa9a4cc['push'](_0xa9a4cc['shift']());}};_0x36569c(++_0x2cf58a);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x26c3('0x0'));var util=require('util');var logger=require(_0x26c3('0x1'))('api');var moment=require(_0x26c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x26c3('0x3'));var fs=require('fs');var path=require(_0x26c3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26c3('0x5'));module[_0x26c3('0x6')]=function(_0x421941,_0x402393){return _0x421941[_0x26c3('0x7')](_0x26c3('0x8'),attributes,{'tableName':_0x26c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefbf=['./jscriptyProject.attributes','define','JscriptyProject','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x281aa8,_0x4f7f8b){var _0x3f0d74=function(_0x456fe7){while(--_0x456fe7){_0x281aa8['push'](_0x281aa8['shift']());}};_0x3f0d74(++_0x4f7f8b);}(_0xefbf,0xa3));var _0xfefb=function(_0x517581,_0x343a77){_0x517581=_0x517581-0x0;var _0xe3061d=_0xefbf[_0x517581];return _0xe3061d;};'use strict';var _=require(_0xfefb('0x0'));var util=require(_0xfefb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfefb('0x2'));var rp=require(_0xfefb('0x3'));var fs=require('fs');var path=require(_0xfefb('0x4'));var rimraf=require(_0xfefb('0x5'));var config=require(_0xfefb('0x6'));var attributes=require(_0xfefb('0x7'));module['exports']=function(_0xaac208,_0x58c767){return _0xaac208[_0xfefb('0x8')](_0xfefb('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index f4daa2e..3415cd6 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c0717,_0x41024b){var _0x30c38c=function(_0x2a6b4f){while(--_0x2a6b4f){_0x3c0717['push'](_0x3c0717['shift']());}};_0x30c38c(++_0x41024b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 _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(_0x114c9d,_0xf0f16e){var _0x4f6252=function(_0x470ae3){while(--_0x470ae3){_0x114c9d['push'](_0x114c9d['shift']());}};_0x4f6252(++_0xf0f16e);}(_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 8a81f43..37504da 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 _0x1247=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','delete','destroy','util','path','connect-timeout'];(function(_0x193f1f,_0x23ba51){var _0x5272fc=function(_0x19e097){while(--_0x19e097){_0x193f1f['push'](_0x193f1f['shift']());}};_0x5272fc(++_0x23ba51);}(_0x1247,0xf9));var _0x7124=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x1247[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require('multer');var util=require(_0x7124('0x0'));var path=require(_0x7124('0x1'));var timeout=require(_0x7124('0x2'));var express=require(_0x7124('0x3'));var router=express[_0x7124('0x4')]();var fs_extra=require(_0x7124('0x5'));var auth=require(_0x7124('0x6'));var interaction=require(_0x7124('0x7'));var config=require('../../config/environment');var controller=require(_0x7124('0x8'));router[_0x7124('0x9')]('/',auth['isAuthenticated'](),controller[_0x7124('0xa')]);router['get']('/describe',auth[_0x7124('0xb')](),controller[_0x7124('0xc')]);router[_0x7124('0x9')](_0x7124('0xd'),auth['isAuthenticated'](),controller[_0x7124('0xe')]);router[_0x7124('0xf')]('/',auth[_0x7124('0xb')](),controller['create']);router['put'](_0x7124('0xd'),auth[_0x7124('0xb')](),controller['update']);router[_0x7124('0x10')](_0x7124('0xd'),auth[_0x7124('0xb')](),controller[_0x7124('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0b25=['../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5339e8,_0x5c56a7){var _0x4a2c58=function(_0x25fd57){while(--_0x25fd57){_0x5339e8['push'](_0x5339e8['shift']());}};_0x4a2c58(++_0x5c56a7);}(_0x0b25,0x105));var _0x50b2=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x0b25[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x50b2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50b2('0x1'));var router=express[_0x50b2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x50b2('0x3'));var interaction=require(_0x50b2('0x4'));var config=require(_0x50b2('0x5'));var controller=require(_0x50b2('0x6'));router['get']('/',auth[_0x50b2('0x7')](),controller[_0x50b2('0x8')]);router[_0x50b2('0x9')](_0x50b2('0xa'),auth['isAuthenticated'](),controller[_0x50b2('0xb')]);router[_0x50b2('0x9')](_0x50b2('0xc'),auth[_0x50b2('0x7')](),controller[_0x50b2('0xd')]);router[_0x50b2('0xe')]('/',auth[_0x50b2('0x7')](),controller[_0x50b2('0xf')]);router[_0x50b2('0x10')](_0x50b2('0xc'),auth[_0x50b2('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x50b2('0x11')]);module[_0x50b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1c3af17..bdfc7de 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x4d94aa,_0x315721){_0x4d94aa=_0x4d94aa-0x0;var _0x1f5fa7=_0x7a54[_0x4d94aa];return _0x1f5fa7;};'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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0xec412e,_0x49a148){_0xec412e=_0xec412e-0x0;var _0x411522=_0x7a54[_0xec412e];return _0x411522;};'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 4616209..5f0a610 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 _0xec3c=['describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','show','params','rawAttributes','find','create','body','catch','update','destroy'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xec3c,0x1b1));var _0xcec3=function(_0x19fc06,_0x3f69f9){_0x19fc06=_0x19fc06-0x0;var _0x99e1bd=_0xec3c[_0x19fc06];return _0x99e1bd;};'use strict';var emlformat=require(_0xcec3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcec3('0x1'));var jsonpatch=require(_0xcec3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcec3('0x3'));var Mustache=require(_0xcec3('0x4'));var util=require(_0xcec3('0x5'));var path=require('path');var sox=require(_0xcec3('0x6'));var csv=require(_0xcec3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcec3('0x8'));var _=require(_0xcec3('0x9'));var squel=require(_0xcec3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcec3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcec3('0xc'));var Redis=require('ioredis');var authService=require(_0xcec3('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcec3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcec3('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xcec3('0x10'));var licenseUtil=require(_0xcec3('0x11'));var db=require(_0xcec3('0x12'))['db'];function respondWithStatusCode(_0x537bea,_0x5c99c5){_0x5c99c5=_0x5c99c5||0xcc;return function(_0x4b0789){if(_0x4b0789){return _0x537bea[_0xcec3('0x13')](_0x5c99c5);}return _0x537bea['status'](_0x5c99c5)[_0xcec3('0x14')]();};}function respondWithResult(_0x5e00bb,_0x422634){_0x422634=_0x422634||0xc8;return function(_0x2fccca){if(_0x2fccca){return _0x5e00bb[_0xcec3('0x15')](_0x422634)[_0xcec3('0x16')](_0x2fccca);}};}function respondWithFilteredResult(_0x4e8ad1,_0x1550af){return function(_0x214447){if(_0x214447){var _0x373014=typeof _0x1550af[_0xcec3('0x17')]==='undefined'&&typeof _0x1550af[_0xcec3('0x18')]===_0xcec3('0x19');var _0x5dd7d3=_0x214447[_0xcec3('0x1a')];var _0x568d46=_0x373014?0x0:_0x1550af[_0xcec3('0x17')];var _0x138825=_0x373014?_0x214447[_0xcec3('0x1a')]:_0x1550af[_0xcec3('0x17')]+_0x1550af[_0xcec3('0x18')];var _0x1f1d27;if(_0x138825>=_0x5dd7d3){_0x138825=_0x5dd7d3;_0x1f1d27=0xc8;}else{_0x1f1d27=0xce;}_0x4e8ad1[_0xcec3('0x15')](_0x1f1d27);return _0x4e8ad1[_0xcec3('0x1b')](_0xcec3('0x1c'),_0x568d46+'-'+_0x138825+'/'+_0x5dd7d3)[_0xcec3('0x16')](_0x214447);}return null;};}function patchUpdates(_0x7f73df){return function(_0x49abd8){try{jsonpatch[_0xcec3('0x1d')](_0x49abd8,_0x7f73df,!![]);}catch(_0x273acc){return BPromise[_0xcec3('0x1e')](_0x273acc);}return _0x49abd8[_0xcec3('0x1f')]();};}function saveUpdates(_0x2b5958,_0x4664b2){return function(_0xf9216a){if(_0xf9216a){return _0xf9216a['update'](_0x2b5958)[_0xcec3('0x20')](function(_0x24a9a9){return _0x24a9a9;});}return null;};}function removeEntity(_0x540a80,_0x5b4c15){return function(_0x3b4ad7){if(_0x3b4ad7){return _0x3b4ad7['destroy']()[_0xcec3('0x20')](function(){_0x540a80[_0xcec3('0x15')](0xcc)[_0xcec3('0x14')]();});}};}function handleEntityNotFound(_0x141441,_0x197d71){return function(_0x5dbdc9){if(!_0x5dbdc9){_0x141441[_0xcec3('0x13')](0x194);}return _0x5dbdc9;};}function handleError(_0x4d3756,_0x5601fd){_0x5601fd=_0x5601fd||0x1f4;return function(_0x21a2f0){logger['error'](_0x21a2f0[_0xcec3('0x21')]);if(_0x21a2f0[_0xcec3('0x22')]){delete _0x21a2f0[_0xcec3('0x22')];}_0x4d3756['status'](_0x5601fd)[_0xcec3('0x23')](_0x21a2f0);};}exports[_0xcec3('0x24')]=function(_0x1b8eeb,_0x30da39){var _0x63a1fa={},_0x492928={},_0x18e76d={'count':0x0,'rows':[]};var _0x5f3c5f=_[_0xcec3('0x25')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x128686){return{'name':_0x128686[_0xcec3('0x26')],'type':_0x128686['type'][_0xcec3('0x27')]};});_0x492928[_0xcec3('0x28')]=_[_0xcec3('0x25')](_0x5f3c5f,_0xcec3('0x22'));_0x492928[_0xcec3('0x29')]=_[_0xcec3('0x2a')](_0x1b8eeb['query']);_0x492928[_0xcec3('0x2b')]=_[_0xcec3('0x2c')](_0x492928[_0xcec3('0x28')],_0x492928[_0xcec3('0x29')]);_0x63a1fa['attributes']=_[_0xcec3('0x2c')](_0x492928['model'],qs[_0xcec3('0x2d')](_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x2d')]));_0x63a1fa[_0xcec3('0x2e')]=_0x63a1fa[_0xcec3('0x2e')][_0xcec3('0x2f')]?_0x63a1fa[_0xcec3('0x2e')]:_0x492928[_0xcec3('0x28')];if(!_0x1b8eeb[_0xcec3('0x29')]['hasOwnProperty'](_0xcec3('0x30'))){_0x63a1fa['limit']=qs[_0xcec3('0x18')](_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x18')]);_0x63a1fa['offset']=qs[_0xcec3('0x17')](_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x17')]);}_0x63a1fa[_0xcec3('0x31')]=qs[_0xcec3('0x32')](_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x32')]);_0x63a1fa[_0xcec3('0x33')]=qs[_0xcec3('0x2b')](_[_0xcec3('0x34')](_0x1b8eeb[_0xcec3('0x29')],_0x492928['filters']),_0x5f3c5f);if(_0x1b8eeb['query'][_0xcec3('0x35')]){_0x63a1fa[_0xcec3('0x33')]=_[_0xcec3('0x36')](_0x63a1fa[_0xcec3('0x33')],{'$or':_['map'](_0x5f3c5f,function(_0x427266){if(_0x427266[_0xcec3('0x37')]!==_0xcec3('0x38')){var _0x1f957e={};_0x1f957e[_0x427266['name']]={'$like':'%'+_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x35')]+'%'};return _0x1f957e;}})});}_0x63a1fa=_[_0xcec3('0x36')]({},_0x63a1fa,_0x1b8eeb[_0xcec3('0x39')]);var _0x36a529={'where':_0x63a1fa[_0xcec3('0x33')]};return db[_0xcec3('0x3a')][_0xcec3('0x1a')](_0x36a529)[_0xcec3('0x20')](function(_0x19a4c1){_0x18e76d[_0xcec3('0x1a')]=_0x19a4c1;if(_0x1b8eeb[_0xcec3('0x29')][_0xcec3('0x3b')]){_0x63a1fa[_0xcec3('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xcec3('0x3d')](_0x63a1fa);})[_0xcec3('0x20')](function(_0x49d36d){_0x18e76d['rows']=_0x49d36d;return _0x18e76d;})[_0xcec3('0x20')](respondWithFilteredResult(_0x30da39,_0x63a1fa))['catch'](handleError(_0x30da39,null));};exports[_0xcec3('0x3e')]=function(_0x1c5f20,_0x2b2fc7){var _0x51eaad={'raw':!![],'where':{'id':_0x1c5f20[_0xcec3('0x3f')]['id']}},_0x23ba42={};_0x23ba42[_0xcec3('0x28')]=_[_0xcec3('0x2a')](db[_0xcec3('0x3a')][_0xcec3('0x40')]);_0x23ba42[_0xcec3('0x29')]=_[_0xcec3('0x2a')](_0x1c5f20['query']);_0x23ba42[_0xcec3('0x2b')]=_[_0xcec3('0x2c')](_0x23ba42[_0xcec3('0x28')],_0x23ba42[_0xcec3('0x29')]);_0x51eaad[_0xcec3('0x2e')]=_[_0xcec3('0x2c')](_0x23ba42[_0xcec3('0x28')],qs[_0xcec3('0x2d')](_0x1c5f20[_0xcec3('0x29')][_0xcec3('0x2d')]));_0x51eaad[_0xcec3('0x2e')]=_0x51eaad[_0xcec3('0x2e')]['length']?_0x51eaad[_0xcec3('0x2e')]:_0x23ba42[_0xcec3('0x28')];if(_0x1c5f20['query'][_0xcec3('0x3b')]){_0x51eaad['include']=[{'all':!![]}];}_0x51eaad=_[_0xcec3('0x36')]({},_0x51eaad,_0x1c5f20[_0xcec3('0x39')]);return db[_0xcec3('0x3a')][_0xcec3('0x41')](_0x51eaad)[_0xcec3('0x20')](handleEntityNotFound(_0x2b2fc7,null))['then'](respondWithResult(_0x2b2fc7,null))['catch'](handleError(_0x2b2fc7,null));};exports[_0xcec3('0x42')]=function(_0x47c14c,_0x46b5c4){return db[_0xcec3('0x3a')]['create'](_0x47c14c[_0xcec3('0x43')],{})[_0xcec3('0x20')](respondWithResult(_0x46b5c4,0xc9))[_0xcec3('0x44')](handleError(_0x46b5c4,null));};exports[_0xcec3('0x45')]=function(_0x1784fb,_0xb5dc){if(_0x1784fb[_0xcec3('0x43')]['id']){delete _0x1784fb[_0xcec3('0x43')]['id'];}return db[_0xcec3('0x3a')]['find']({'where':{'id':_0x1784fb[_0xcec3('0x3f')]['id']}})[_0xcec3('0x20')](handleEntityNotFound(_0xb5dc,null))['then'](saveUpdates(_0x1784fb['body'],null))[_0xcec3('0x20')](respondWithResult(_0xb5dc,null))[_0xcec3('0x44')](handleError(_0xb5dc,null));};exports[_0xcec3('0x46')]=function(_0x334b3b,_0x47a9f5){return db[_0xcec3('0x3a')]['find']({'where':{'id':_0x334b3b[_0xcec3('0x3f')]['id']}})[_0xcec3('0x20')](handleEntityNotFound(_0x47a9f5,null))[_0xcec3('0x20')](removeEntity(_0x47a9f5,null))[_0xcec3('0x44')](handleError(_0x47a9f5,null));};exports[_0xcec3('0x47')]=function(_0x5677f5,_0x1452a3){return db[_0xcec3('0x3a')][_0xcec3('0x47')]()['then'](respondWithResult(_0x1452a3,null))['catch'](handleError(_0x1452a3,null));}; \ No newline at end of file +var _0xd890=['merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter'];(function(_0x3637be,_0x4ec4f4){var _0x179a58=function(_0x44ea58){while(--_0x44ea58){_0x3637be['push'](_0x3637be['shift']());}};_0x179a58(++_0x4ec4f4);}(_0xd890,0x190));var _0x0d89=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xd890[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0x0d89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d89('0x1'));var jsonpatch=require(_0x0d89('0x2'));var rp=require('request-promise');var moment=require(_0x0d89('0x3'));var BPromise=require(_0x0d89('0x4'));var Mustache=require(_0x0d89('0x5'));var util=require(_0x0d89('0x6'));var path=require('path');var sox=require(_0x0d89('0x7'));var csv=require(_0x0d89('0x8'));var ejs=require(_0x0d89('0x9'));var fs=require('fs');var fs_extra=require(_0x0d89('0xa'));var _=require(_0x0d89('0xb'));var squel=require(_0x0d89('0xc'));var crypto=require(_0x0d89('0xd'));var jsforce=require(_0x0d89('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d89('0xf'));var Papa=require(_0x0d89('0x10'));var Redis=require(_0x0d89('0x11'));var authService=require(_0x0d89('0x12'));var qs=require(_0x0d89('0x13'));var as=require(_0x0d89('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d89('0x15'))(_0x0d89('0x16'));var utils=require(_0x0d89('0x17'));var config=require(_0x0d89('0x18'));var licenseUtil=require(_0x0d89('0x19'));var db=require(_0x0d89('0x1a'))['db'];function respondWithStatusCode(_0x5e97c5,_0x5aa59e){_0x5aa59e=_0x5aa59e||0xcc;return function(_0xcddba1){if(_0xcddba1){return _0x5e97c5[_0x0d89('0x1b')](_0x5aa59e);}return _0x5e97c5['status'](_0x5aa59e)[_0x0d89('0x1c')]();};}function respondWithResult(_0x40fa15,_0x5d67fa){_0x5d67fa=_0x5d67fa||0xc8;return function(_0x5647d1){if(_0x5647d1){return _0x40fa15[_0x0d89('0x1d')](_0x5d67fa)[_0x0d89('0x1e')](_0x5647d1);}};}function respondWithFilteredResult(_0x49f43c,_0x5153fd){return function(_0x25576d){if(_0x25576d){var _0x14d374=typeof _0x5153fd[_0x0d89('0x1f')]===_0x0d89('0x20')&&typeof _0x5153fd[_0x0d89('0x21')]===_0x0d89('0x20');var _0x10327e=_0x25576d[_0x0d89('0x22')];var _0xf003f9=_0x14d374?0x0:_0x5153fd[_0x0d89('0x1f')];var _0x2a3e44=_0x14d374?_0x25576d['count']:_0x5153fd[_0x0d89('0x1f')]+_0x5153fd[_0x0d89('0x21')];var _0x25ee42;if(_0x2a3e44>=_0x10327e){_0x2a3e44=_0x10327e;_0x25ee42=0xc8;}else{_0x25ee42=0xce;}_0x49f43c[_0x0d89('0x1d')](_0x25ee42);return _0x49f43c[_0x0d89('0x23')]('Content-Range',_0xf003f9+'-'+_0x2a3e44+'/'+_0x10327e)[_0x0d89('0x1e')](_0x25576d);}return null;};}function patchUpdates(_0x5e3d5f){return function(_0x3bcf1b){try{jsonpatch['apply'](_0x3bcf1b,_0x5e3d5f,!![]);}catch(_0x162643){return BPromise[_0x0d89('0x24')](_0x162643);}return _0x3bcf1b[_0x0d89('0x25')]();};}function saveUpdates(_0xf592cf,_0x348148){return function(_0x5d2429){if(_0x5d2429){return _0x5d2429[_0x0d89('0x26')](_0xf592cf)['then'](function(_0x7ff62f){return _0x7ff62f;});}return null;};}function removeEntity(_0x3bd269,_0x58490d){return function(_0x5bc7cf){if(_0x5bc7cf){return _0x5bc7cf[_0x0d89('0x27')]()[_0x0d89('0x28')](function(){_0x3bd269['status'](0xcc)[_0x0d89('0x1c')]();});}};}function handleEntityNotFound(_0x20d6cc,_0x991ea9){return function(_0x53da36){if(!_0x53da36){_0x20d6cc[_0x0d89('0x1b')](0x194);}return _0x53da36;};}function handleError(_0x52a119,_0x59255a){_0x59255a=_0x59255a||0x1f4;return function(_0x1d9b67){logger[_0x0d89('0x29')](_0x1d9b67[_0x0d89('0x2a')]);if(_0x1d9b67[_0x0d89('0x2b')]){delete _0x1d9b67[_0x0d89('0x2b')];}_0x52a119[_0x0d89('0x1d')](_0x59255a)[_0x0d89('0x2c')](_0x1d9b67);};}exports[_0x0d89('0x2d')]=function(_0xb7a96e,_0x160f49){var _0x17c8d2={},_0x32508e={},_0x154e1e={'count':0x0,'rows':[]};var _0x136c65=_[_0x0d89('0x2e')](db[_0x0d89('0x2f')]['rawAttributes'],function(_0x131d74){return{'name':_0x131d74[_0x0d89('0x30')],'type':_0x131d74[_0x0d89('0x31')]['key']};});_0x32508e[_0x0d89('0x32')]=_[_0x0d89('0x2e')](_0x136c65,_0x0d89('0x2b'));_0x32508e[_0x0d89('0x33')]=_['keys'](_0xb7a96e[_0x0d89('0x33')]);_0x32508e['filters']=_[_0x0d89('0x34')](_0x32508e[_0x0d89('0x32')],_0x32508e[_0x0d89('0x33')]);_0x17c8d2[_0x0d89('0x35')]=_[_0x0d89('0x34')](_0x32508e[_0x0d89('0x32')],qs['fields'](_0xb7a96e[_0x0d89('0x33')][_0x0d89('0x36')]));_0x17c8d2[_0x0d89('0x35')]=_0x17c8d2['attributes'][_0x0d89('0x37')]?_0x17c8d2[_0x0d89('0x35')]:_0x32508e[_0x0d89('0x32')];if(!_0xb7a96e[_0x0d89('0x33')]['hasOwnProperty'](_0x0d89('0x38'))){_0x17c8d2[_0x0d89('0x21')]=qs[_0x0d89('0x21')](_0xb7a96e['query']['limit']);_0x17c8d2['offset']=qs[_0x0d89('0x1f')](_0xb7a96e[_0x0d89('0x33')][_0x0d89('0x1f')]);}_0x17c8d2['order']=qs[_0x0d89('0x39')](_0xb7a96e['query']['sort']);_0x17c8d2[_0x0d89('0x3a')]=qs[_0x0d89('0x3b')](_[_0x0d89('0x3c')](_0xb7a96e['query'],_0x32508e[_0x0d89('0x3b')]),_0x136c65);if(_0xb7a96e['query'][_0x0d89('0x3d')]){_0x17c8d2[_0x0d89('0x3a')]=_[_0x0d89('0x3e')](_0x17c8d2[_0x0d89('0x3a')],{'$or':_[_0x0d89('0x2e')](_0x136c65,function(_0x5a2d9b){if(_0x5a2d9b[_0x0d89('0x31')]!=='VIRTUAL'){var _0x370e22={};_0x370e22[_0x5a2d9b[_0x0d89('0x2b')]]={'$like':'%'+_0xb7a96e['query'][_0x0d89('0x3d')]+'%'};return _0x370e22;}})});}_0x17c8d2=_['merge']({},_0x17c8d2,_0xb7a96e[_0x0d89('0x3f')]);var _0x13ee17={'where':_0x17c8d2[_0x0d89('0x3a')]};return db[_0x0d89('0x2f')]['count'](_0x13ee17)[_0x0d89('0x28')](function(_0x4d02f6){_0x154e1e[_0x0d89('0x22')]=_0x4d02f6;if(_0xb7a96e[_0x0d89('0x33')]['includeAll']){_0x17c8d2[_0x0d89('0x40')]=[{'all':!![]}];}return db[_0x0d89('0x2f')][_0x0d89('0x41')](_0x17c8d2);})[_0x0d89('0x28')](function(_0x125297){_0x154e1e[_0x0d89('0x42')]=_0x125297;return _0x154e1e;})[_0x0d89('0x28')](respondWithFilteredResult(_0x160f49,_0x17c8d2))[_0x0d89('0x43')](handleError(_0x160f49,null));};exports[_0x0d89('0x44')]=function(_0x2b6ff2,_0xdcf69e){var _0x33ad60={'raw':!![],'where':{'id':_0x2b6ff2[_0x0d89('0x45')]['id']}},_0x29e9d5={};_0x29e9d5['model']=_[_0x0d89('0x46')](db[_0x0d89('0x2f')][_0x0d89('0x47')]);_0x29e9d5[_0x0d89('0x33')]=_['keys'](_0x2b6ff2[_0x0d89('0x33')]);_0x29e9d5[_0x0d89('0x3b')]=_[_0x0d89('0x34')](_0x29e9d5[_0x0d89('0x32')],_0x29e9d5[_0x0d89('0x33')]);_0x33ad60['attributes']=_[_0x0d89('0x34')](_0x29e9d5[_0x0d89('0x32')],qs[_0x0d89('0x36')](_0x2b6ff2[_0x0d89('0x33')]['fields']));_0x33ad60[_0x0d89('0x35')]=_0x33ad60[_0x0d89('0x35')][_0x0d89('0x37')]?_0x33ad60[_0x0d89('0x35')]:_0x29e9d5[_0x0d89('0x32')];if(_0x2b6ff2[_0x0d89('0x33')][_0x0d89('0x48')]){_0x33ad60[_0x0d89('0x40')]=[{'all':!![]}];}_0x33ad60=_['merge']({},_0x33ad60,_0x2b6ff2[_0x0d89('0x3f')]);return db[_0x0d89('0x2f')][_0x0d89('0x49')](_0x33ad60)[_0x0d89('0x28')](handleEntityNotFound(_0xdcf69e,null))[_0x0d89('0x28')](respondWithResult(_0xdcf69e,null))[_0x0d89('0x43')](handleError(_0xdcf69e,null));};exports[_0x0d89('0x4a')]=function(_0x5cec76,_0x5f408c){return db['JscriptyQuestionReport'][_0x0d89('0x4a')](_0x5cec76[_0x0d89('0x4b')],{})[_0x0d89('0x28')](respondWithResult(_0x5f408c,0xc9))[_0x0d89('0x43')](handleError(_0x5f408c,null));};exports[_0x0d89('0x26')]=function(_0x2f60b6,_0x4a20e6){if(_0x2f60b6['body']['id']){delete _0x2f60b6['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2f60b6[_0x0d89('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a20e6,null))['then'](saveUpdates(_0x2f60b6[_0x0d89('0x4b')],null))[_0x0d89('0x28')](respondWithResult(_0x4a20e6,null))[_0x0d89('0x43')](handleError(_0x4a20e6,null));};exports[_0x0d89('0x27')]=function(_0x2ba292,_0x5064a2){return db['JscriptyQuestionReport'][_0x0d89('0x49')]({'where':{'id':_0x2ba292[_0x0d89('0x45')]['id']}})[_0x0d89('0x28')](handleEntityNotFound(_0x5064a2,null))[_0x0d89('0x28')](removeEntity(_0x5064a2,null))[_0x0d89('0x43')](handleError(_0x5064a2,null));};exports[_0x0d89('0x4c')]=function(_0x4c3b88,_0x57d513){return db[_0x0d89('0x2f')]['describe']()[_0x0d89('0x28')](respondWithResult(_0x57d513,null))[_0x0d89('0x43')](handleError(_0x57d513,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index feb0f2f..c7a9b0e 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 _0xe4b9=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xe4b9,0x171));var _0x9e4b=function(_0x631f54,_0x137894){_0x631f54=_0x631f54-0x0;var _0x15a3d7=_0xe4b9[_0x631f54];return _0x15a3d7;};'use strict';var _=require(_0x9e4b('0x0'));var util=require(_0x9e4b('0x1'));var logger=require(_0x9e4b('0x2'))(_0x9e4b('0x3'));var moment=require(_0x9e4b('0x4'));var BPromise=require(_0x9e4b('0x5'));var rp=require(_0x9e4b('0x6'));var fs=require('fs');var path=require(_0x9e4b('0x7'));var rimraf=require(_0x9e4b('0x8'));var config=require(_0x9e4b('0x9'));var attributes=require(_0x9e4b('0xa'));module[_0x9e4b('0xb')]=function(_0x50e4db,_0x353e26){return _0x50e4db['define'](_0x9e4b('0xc'),attributes,{'tableName':_0x9e4b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf563=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x196ecc,_0x3d69ba){var _0x21f1d7=function(_0x2bfa48){while(--_0x2bfa48){_0x196ecc['push'](_0x196ecc['shift']());}};_0x21f1d7(++_0x3d69ba);}(_0xf563,0xc6));var _0x3f56=function(_0x5af7b8,_0x5a409f){_0x5af7b8=_0x5af7b8-0x0;var _0x318884=_0xf563[_0x5af7b8];return _0x318884;};'use strict';var _=require(_0x3f56('0x0'));var util=require(_0x3f56('0x1'));var logger=require(_0x3f56('0x2'))(_0x3f56('0x3'));var moment=require(_0x3f56('0x4'));var BPromise=require(_0x3f56('0x5'));var rp=require(_0x3f56('0x6'));var fs=require('fs');var path=require(_0x3f56('0x7'));var rimraf=require(_0x3f56('0x8'));var config=require(_0x3f56('0x9'));var attributes=require(_0x3f56('0xa'));module[_0x3f56('0xb')]=function(_0x27d73e,_0x5844e){return _0x27d73e[_0x3f56('0xc')](_0x3f56('0xd'),attributes,{'tableName':_0x3f56('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 5fbe75e..a8c7efb 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 _0x1b7a=['../../config/utils','client','http','then','info','request\x20sent','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3de5e5,_0x3d3665){var _0x1c6f10=function(_0x3eac89){while(--_0x3eac89){_0x3de5e5['push'](_0x3de5e5['shift']());}};_0x1c6f10(++_0x3d3665);}(_0x1b7a,0x13d));var _0xa1b7=function(_0x45398f,_0x401d29){_0x45398f=_0x45398f-0x0;var _0x1150b7=_0x1b7a[_0x45398f];return _0x1150b7;};'use strict';var _=require(_0xa1b7('0x0'));var util=require(_0xa1b7('0x1'));var moment=require(_0xa1b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1b7('0x3'));var fs=require('fs');var Redis=require(_0xa1b7('0x4'));var db=require(_0xa1b7('0x5'))['db'];var utils=require(_0xa1b7('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1b7('0x7')][_0xa1b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xafe3d,_0xf49dff,_0x866786){return new BPromise(function(_0x29239,_0x16abcf){return client['request'](_0xafe3d,_0x866786)[_0xa1b7('0x9')](function(_0x5df731){logger[_0xa1b7('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf49dff,_0xa1b7('0xb'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xf49dff,_0xa1b7('0xb'),JSON['stringify'](_0x5df731));if(_0x5df731[_0xa1b7('0xc')]){if(_0x5df731[_0xa1b7('0xc')][_0xa1b7('0xd')]===0x1f4){logger[_0xa1b7('0xc')](_0xa1b7('0xe'),_0xf49dff,_0x5df731['error'][_0xa1b7('0xf')]);return _0x16abcf(_0x5df731[_0xa1b7('0xc')][_0xa1b7('0xf')]);}logger[_0xa1b7('0xc')](_0xa1b7('0xe'),_0xf49dff,_0x5df731['error'][_0xa1b7('0xf')]);return _0x29239(_0x5df731['error']['message']);}else{logger[_0xa1b7('0xa')](_0xa1b7('0xe'),_0xf49dff,_0xa1b7('0xb'));_0x29239(_0x5df731[_0xa1b7('0x10')][_0xa1b7('0xf')]);}})['catch'](function(_0x57e6fb){logger[_0xa1b7('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf49dff,_0x57e6fb);_0x16abcf(_0x57e6fb);});});} \ No newline at end of file +var _0x468f=['stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','result','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x25deb7,_0xe5537f){var _0x37fd18=function(_0x45e59d){while(--_0x45e59d){_0x25deb7['push'](_0x25deb7['shift']());}};_0x37fd18(++_0xe5537f);}(_0x468f,0x66));var _0xf468=function(_0x440237,_0x403080){_0x440237=_0x440237-0x0;var _0x59c5b8=_0x468f[_0x440237];return _0x59c5b8;};'use strict';var _=require('lodash');var util=require(_0xf468('0x0'));var moment=require(_0xf468('0x1'));var BPromise=require(_0xf468('0x2'));var rs=require(_0xf468('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf468('0x4'));var logger=require('../../config/logger')(_0xf468('0x5'));var config=require(_0xf468('0x6'));var jayson=require(_0xf468('0x7'));var client=jayson[_0xf468('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2950f7,_0x47aa16,_0x378a10){return new BPromise(function(_0x59b949,_0x4cb817){return client[_0xf468('0x9')](_0x2950f7,_0x378a10)['then'](function(_0x1cb659){logger[_0xf468('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47aa16,'request\x20sent');logger['debug'](_0xf468('0xb'),_0x47aa16,'request\x20sent',JSON[_0xf468('0xc')](_0x1cb659));if(_0x1cb659['error']){if(_0x1cb659[_0xf468('0xd')][_0xf468('0xe')]===0x1f4){logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1cb659[_0xf468('0xd')][_0xf468('0x10')]);return _0x4cb817(_0x1cb659[_0xf468('0xd')][_0xf468('0x10')]);}logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1cb659['error'][_0xf468('0x10')]);return _0x59b949(_0x1cb659['error'][_0xf468('0x10')]);}else{logger[_0xf468('0xa')](_0xf468('0xf'),_0x47aa16,_0xf468('0x11'));_0x59b949(_0x1cb659[_0xf468('0x12')][_0xf468('0x10')]);}})['catch'](function(_0x1f7507){logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1f7507);_0x4cb817(_0x1f7507);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index c0cc912..d06513b 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 _0x6404=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports','util','path','express','fs-extra'];(function(_0x11c52f,_0xd895e8){var _0x495da3=function(_0x5de89a){while(--_0x5de89a){_0x11c52f['push'](_0x11c52f['shift']());}};_0x495da3(++_0xd895e8);}(_0x6404,0x1f4));var _0x4640=function(_0x158a61,_0x4e93a3){_0x158a61=_0x158a61-0x0;var _0x534c81=_0x6404[_0x158a61];return _0x534c81;};'use strict';var multer=require('multer');var util=require(_0x4640('0x0'));var path=require(_0x4640('0x1'));var timeout=require('connect-timeout');var express=require(_0x4640('0x2'));var router=express['Router']();var fs_extra=require(_0x4640('0x3'));var auth=require(_0x4640('0x4'));var interaction=require(_0x4640('0x5'));var config=require('../../config/environment');var controller=require(_0x4640('0x6'));router['get']('/',auth[_0x4640('0x7')](),controller['index']);router[_0x4640('0x8')](_0x4640('0x9'),auth[_0x4640('0x7')](),controller[_0x4640('0xa')]);router['get'](_0x4640('0xb'),auth[_0x4640('0x7')](),controller[_0x4640('0xc')]);router[_0x4640('0x8')](_0x4640('0xd'),auth[_0x4640('0x7')](),controller[_0x4640('0xe')]);router[_0x4640('0xf')]('/',auth[_0x4640('0x7')](),controller[_0x4640('0x10')]);router[_0x4640('0x11')](_0x4640('0xb'),auth['isAuthenticated'](),controller[_0x4640('0x12')]);router['delete'](_0x4640('0xb'),auth['isAuthenticated'](),controller[_0x4640('0x13')]);module[_0x4640('0x14')]=router; \ No newline at end of file +var _0x01d9=['create','put','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0xd5));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require('path');var timeout=require(_0x901d('0x2'));var express=require('express');var router=express[_0x901d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x901d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x901d('0x5'));var controller=require(_0x901d('0x6'));router[_0x901d('0x7')]('/',auth[_0x901d('0x8')](),controller[_0x901d('0x9')]);router[_0x901d('0x7')](_0x901d('0xa'),auth[_0x901d('0x8')](),controller[_0x901d('0xb')]);router['get'](_0x901d('0xc'),auth[_0x901d('0x8')](),controller[_0x901d('0xd')]);router[_0x901d('0x7')](_0x901d('0xe'),auth[_0x901d('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x901d('0x8')](),controller[_0x901d('0xf')]);router[_0x901d('0x10')](_0x901d('0xc'),auth[_0x901d('0x8')](),controller[_0x901d('0x11')]);router['delete'](_0x901d('0xc'),auth['isAuthenticated'](),controller[_0x901d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ddf38b9..ac0fcdc 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 _0x0bb0=['exports','DATE','setDataValue','starttime','STRING','BOOLEAN','moment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0bb0,0x11e));var _0x00bb=function(_0x1f8806,_0x5623c0){_0x1f8806=_0x1f8806-0x0;var _0x39e13f=_0x0bb0[_0x1f8806];return _0x39e13f;};'use strict';var moment=require(_0x00bb('0x0'));var Sequelize=require('sequelize');module[_0x00bb('0x1')]={'starttime':{'type':Sequelize[_0x00bb('0x2')],'set':function(_0x25e1ee){this[_0x00bb('0x3')](_0x00bb('0x4'),_0x25e1ee);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x00bb('0x2')]},'membername':{'type':Sequelize[_0x00bb('0x5')]},'projectname':{'type':Sequelize[_0x00bb('0x5')]},'queue':{'type':Sequelize[_0x00bb('0x5')]},'uniqueid':{'type':Sequelize[_0x00bb('0x5')]},'calleridname':{'type':Sequelize[_0x00bb('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x00bb('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xa533=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa533,0x1c6));var _0x3a53=function(_0xa76db3,_0xf8fd0){_0xa76db3=_0xa76db3-0x0;var _0x47338e=_0xa533[_0xa76db3];return _0x47338e;};'use strict';var moment=require(_0x3a53('0x0'));var Sequelize=require(_0x3a53('0x1'));module[_0x3a53('0x2')]={'starttime':{'type':Sequelize[_0x3a53('0x3')],'set':function(_0x335246){this[_0x3a53('0x4')]('starttime',_0x335246);this[_0x3a53('0x4')](_0x3a53('0x5'),moment()[_0x3a53('0x6')](_0x3a53('0x7')));}},'endtime':{'type':Sequelize[_0x3a53('0x3')]},'membername':{'type':Sequelize[_0x3a53('0x8')]},'projectname':{'type':Sequelize[_0x3a53('0x8')]},'queue':{'type':Sequelize[_0x3a53('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a53('0x8')]},'completed':{'type':Sequelize[_0x3a53('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b5fe3d0..52909d0 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 _0xcdb0=['sort','where','pick','filter','merge','VIRTUAL','options','then','include','rows','catch','show','keys','includeAll','find','create','body','params','describe','JscriptyQuestionReport','order','SessionId','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcdb0,0x146));var _0x0cdb=function(_0x3f9a2d,_0x32d887){_0x3f9a2d=_0x3f9a2d-0x0;var _0x25f8f5=_0xcdb0[_0x3f9a2d];return _0x25f8f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cdb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0cdb('0x1'));var moment=require(_0x0cdb('0x2'));var BPromise=require(_0x0cdb('0x3'));var Mustache=require(_0x0cdb('0x4'));var util=require(_0x0cdb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0cdb('0x6'));var ejs=require(_0x0cdb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cdb('0x8'));var squel=require(_0x0cdb('0x9'));var crypto=require(_0x0cdb('0xa'));var jsforce=require(_0x0cdb('0xb'));var deskjs=require(_0x0cdb('0xc'));var toCsv=require(_0x0cdb('0x6'));var querystring=require('querystring');var Papa=require(_0x0cdb('0xd'));var Redis=require(_0x0cdb('0xe'));var authService=require(_0x0cdb('0xf'));var qs=require(_0x0cdb('0x10'));var as=require(_0x0cdb('0x11'));var hardwareService=require(_0x0cdb('0x12'));var logger=require(_0x0cdb('0x13'))('api');var utils=require(_0x0cdb('0x14'));var config=require(_0x0cdb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cdb('0x16'))['db'];function respondWithStatusCode(_0x3c26bf,_0x5e751){_0x5e751=_0x5e751||0xcc;return function(_0xea94e3){if(_0xea94e3){return _0x3c26bf[_0x0cdb('0x17')](_0x5e751);}return _0x3c26bf[_0x0cdb('0x18')](_0x5e751)[_0x0cdb('0x19')]();};}function respondWithResult(_0x46bf4e,_0x2fc6be){_0x2fc6be=_0x2fc6be||0xc8;return function(_0x4b9974){if(_0x4b9974){return _0x46bf4e[_0x0cdb('0x18')](_0x2fc6be)['json'](_0x4b9974);}};}function respondWithFilteredResult(_0x51daac,_0x5d57de){return function(_0x22bada){if(_0x22bada){var _0x593a0=typeof _0x5d57de[_0x0cdb('0x1a')]===_0x0cdb('0x1b')&&typeof _0x5d57de[_0x0cdb('0x1c')]===_0x0cdb('0x1b');var _0x32ad22=_0x22bada[_0x0cdb('0x1d')];var _0x1385df=_0x593a0?0x0:_0x5d57de[_0x0cdb('0x1a')];var _0x1a6604=_0x593a0?_0x22bada[_0x0cdb('0x1d')]:_0x5d57de[_0x0cdb('0x1a')]+_0x5d57de[_0x0cdb('0x1c')];var _0x3bcc6e;if(_0x1a6604>=_0x32ad22){_0x1a6604=_0x32ad22;_0x3bcc6e=0xc8;}else{_0x3bcc6e=0xce;}_0x51daac[_0x0cdb('0x18')](_0x3bcc6e);return _0x51daac[_0x0cdb('0x1e')](_0x0cdb('0x1f'),_0x1385df+'-'+_0x1a6604+'/'+_0x32ad22)['json'](_0x22bada);}return null;};}function patchUpdates(_0x9c43a8){return function(_0x4163f0){try{jsonpatch['apply'](_0x4163f0,_0x9c43a8,!![]);}catch(_0x3c8c84){return BPromise[_0x0cdb('0x20')](_0x3c8c84);}return _0x4163f0[_0x0cdb('0x21')]();};}function saveUpdates(_0x504251,_0x49295b){return function(_0x5aca03){if(_0x5aca03){return _0x5aca03[_0x0cdb('0x22')](_0x504251)['then'](function(_0x14db58){return _0x14db58;});}return null;};}function removeEntity(_0x1079c6,_0x459ae0){return function(_0x28d8c7){if(_0x28d8c7){return _0x28d8c7[_0x0cdb('0x23')]()['then'](function(){_0x1079c6[_0x0cdb('0x18')](0xcc)[_0x0cdb('0x19')]();});}};}function handleEntityNotFound(_0x53059d,_0x3b21a4){return function(_0x25d8cd){if(!_0x25d8cd){_0x53059d['sendStatus'](0x194);}return _0x25d8cd;};}function handleError(_0x9aad8c,_0x42debb){_0x42debb=_0x42debb||0x1f4;return function(_0x35cd1b){logger[_0x0cdb('0x24')](_0x35cd1b[_0x0cdb('0x25')]);if(_0x35cd1b[_0x0cdb('0x26')]){delete _0x35cd1b[_0x0cdb('0x26')];}_0x9aad8c[_0x0cdb('0x18')](_0x42debb)['send'](_0x35cd1b);};}exports['index']=function(_0x14adfa,_0xe866b1){var _0x25f6e6={},_0x3a9f08={},_0x4aaae5={'count':0x0,'rows':[]};var _0x35feb6=_[_0x0cdb('0x27')](db[_0x0cdb('0x28')][_0x0cdb('0x29')],function(_0x51aa4e){return{'name':_0x51aa4e[_0x0cdb('0x2a')],'type':_0x51aa4e[_0x0cdb('0x2b')][_0x0cdb('0x2c')]};});_0x3a9f08[_0x0cdb('0x2d')]=_[_0x0cdb('0x27')](_0x35feb6,_0x0cdb('0x26'));_0x3a9f08['query']=_['keys'](_0x14adfa['query']);_0x3a9f08[_0x0cdb('0x2e')]=_[_0x0cdb('0x2f')](_0x3a9f08[_0x0cdb('0x2d')],_0x3a9f08[_0x0cdb('0x30')]);_0x25f6e6[_0x0cdb('0x31')]=_[_0x0cdb('0x2f')](_0x3a9f08[_0x0cdb('0x2d')],qs[_0x0cdb('0x32')](_0x14adfa['query'][_0x0cdb('0x32')]));_0x25f6e6[_0x0cdb('0x31')]=_0x25f6e6[_0x0cdb('0x31')][_0x0cdb('0x33')]?_0x25f6e6[_0x0cdb('0x31')]:_0x3a9f08['model'];if(!_0x14adfa['query'][_0x0cdb('0x34')](_0x0cdb('0x35'))){_0x25f6e6[_0x0cdb('0x1c')]=qs[_0x0cdb('0x1c')](_0x14adfa['query'][_0x0cdb('0x1c')]);_0x25f6e6[_0x0cdb('0x1a')]=qs[_0x0cdb('0x1a')](_0x14adfa[_0x0cdb('0x30')][_0x0cdb('0x1a')]);}_0x25f6e6['order']=qs[_0x0cdb('0x36')](_0x14adfa[_0x0cdb('0x30')][_0x0cdb('0x36')]);_0x25f6e6[_0x0cdb('0x37')]=qs[_0x0cdb('0x2e')](_[_0x0cdb('0x38')](_0x14adfa['query'],_0x3a9f08[_0x0cdb('0x2e')]),_0x35feb6);if(_0x14adfa['query'][_0x0cdb('0x39')]){_0x25f6e6[_0x0cdb('0x37')]=_[_0x0cdb('0x3a')](_0x25f6e6[_0x0cdb('0x37')],{'$or':_[_0x0cdb('0x27')](_0x35feb6,function(_0x166028){if(_0x166028[_0x0cdb('0x2b')]!==_0x0cdb('0x3b')){var _0x18e4a5={};_0x18e4a5[_0x166028[_0x0cdb('0x26')]]={'$like':'%'+_0x14adfa['query'][_0x0cdb('0x39')]+'%'};return _0x18e4a5;}})});}_0x25f6e6=_[_0x0cdb('0x3a')]({},_0x25f6e6,_0x14adfa[_0x0cdb('0x3c')]);var _0x5247f1={'where':_0x25f6e6[_0x0cdb('0x37')]};return db['JscriptySessionReport'][_0x0cdb('0x1d')](_0x5247f1)[_0x0cdb('0x3d')](function(_0x45e0d7){_0x4aaae5[_0x0cdb('0x1d')]=_0x45e0d7;if(_0x14adfa['query']['includeAll']){_0x25f6e6[_0x0cdb('0x3e')]=[{'all':!![]}];}return db[_0x0cdb('0x28')]['findAll'](_0x25f6e6);})[_0x0cdb('0x3d')](function(_0x173cf2){_0x4aaae5[_0x0cdb('0x3f')]=_0x173cf2;return _0x4aaae5;})[_0x0cdb('0x3d')](respondWithFilteredResult(_0xe866b1,_0x25f6e6))[_0x0cdb('0x40')](handleError(_0xe866b1,null));};exports[_0x0cdb('0x41')]=function(_0x27b3b6,_0xf28723){var _0x2a3019={'raw':!![],'where':{'id':_0x27b3b6['params']['id']}},_0x4889f2={};_0x4889f2[_0x0cdb('0x2d')]=_[_0x0cdb('0x42')](db['JscriptySessionReport'][_0x0cdb('0x29')]);_0x4889f2['query']=_[_0x0cdb('0x42')](_0x27b3b6['query']);_0x4889f2['filters']=_[_0x0cdb('0x2f')](_0x4889f2[_0x0cdb('0x2d')],_0x4889f2[_0x0cdb('0x30')]);_0x2a3019[_0x0cdb('0x31')]=_[_0x0cdb('0x2f')](_0x4889f2[_0x0cdb('0x2d')],qs[_0x0cdb('0x32')](_0x27b3b6[_0x0cdb('0x30')][_0x0cdb('0x32')]));_0x2a3019[_0x0cdb('0x31')]=_0x2a3019['attributes'][_0x0cdb('0x33')]?_0x2a3019[_0x0cdb('0x31')]:_0x4889f2[_0x0cdb('0x2d')];if(_0x27b3b6[_0x0cdb('0x30')][_0x0cdb('0x43')]){_0x2a3019[_0x0cdb('0x3e')]=[{'all':!![]}];}_0x2a3019=_['merge']({},_0x2a3019,_0x27b3b6['options']);return db[_0x0cdb('0x28')][_0x0cdb('0x44')](_0x2a3019)[_0x0cdb('0x3d')](handleEntityNotFound(_0xf28723,null))[_0x0cdb('0x3d')](respondWithResult(_0xf28723,null))[_0x0cdb('0x40')](handleError(_0xf28723,null));};exports[_0x0cdb('0x45')]=function(_0x4c5166,_0x182e66){return db[_0x0cdb('0x28')][_0x0cdb('0x45')](_0x4c5166['body'],{})[_0x0cdb('0x3d')](respondWithResult(_0x182e66,0xc9))[_0x0cdb('0x40')](handleError(_0x182e66,null));};exports[_0x0cdb('0x22')]=function(_0x3bd11f,_0x4fd493){if(_0x3bd11f[_0x0cdb('0x46')]['id']){delete _0x3bd11f[_0x0cdb('0x46')]['id'];}return db[_0x0cdb('0x28')][_0x0cdb('0x44')]({'where':{'id':_0x3bd11f[_0x0cdb('0x47')]['id']}})[_0x0cdb('0x3d')](handleEntityNotFound(_0x4fd493,null))['then'](saveUpdates(_0x3bd11f[_0x0cdb('0x46')],null))[_0x0cdb('0x3d')](respondWithResult(_0x4fd493,null))[_0x0cdb('0x40')](handleError(_0x4fd493,null));};exports[_0x0cdb('0x23')]=function(_0x1912b5,_0x26802d){return db[_0x0cdb('0x28')][_0x0cdb('0x44')]({'where':{'id':_0x1912b5[_0x0cdb('0x47')]['id']}})[_0x0cdb('0x3d')](handleEntityNotFound(_0x26802d,null))[_0x0cdb('0x3d')](removeEntity(_0x26802d,null))[_0x0cdb('0x40')](handleError(_0x26802d,null));};exports[_0x0cdb('0x48')]=function(_0x54a2f7,_0x110884){return db[_0x0cdb('0x28')][_0x0cdb('0x48')]()[_0x0cdb('0x3d')](respondWithResult(_0x110884,null))[_0x0cdb('0x40')](handleError(_0x110884,null));};exports['getQuestions']=function(_0x3b843a,_0x1fdc73,_0x15bfae){var _0x5f3c56={'raw':!![],'where':{}};var _0x8b523f={};var _0x484800={'count':0x0,'rows':[]};return db[_0x0cdb('0x28')]['findOne']({'where':{'id':_0x3b843a[_0x0cdb('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fdc73,null))[_0x0cdb('0x3d')](function(_0x34bae8){if(_0x34bae8){_0x8b523f['model']=_['keys'](db[_0x0cdb('0x49')][_0x0cdb('0x29')]);_0x8b523f['query']=_['keys'](_0x3b843a[_0x0cdb('0x30')]);_0x8b523f[_0x0cdb('0x2e')]=_[_0x0cdb('0x2f')](_0x8b523f[_0x0cdb('0x2d')],_0x8b523f[_0x0cdb('0x30')]);_0x5f3c56[_0x0cdb('0x31')]=_['intersection'](_0x8b523f[_0x0cdb('0x2d')],qs[_0x0cdb('0x32')](_0x3b843a[_0x0cdb('0x30')][_0x0cdb('0x32')]));_0x5f3c56[_0x0cdb('0x31')]=_0x5f3c56[_0x0cdb('0x31')][_0x0cdb('0x33')]?_0x5f3c56['attributes']:_0x8b523f['model'];if(!_0x3b843a[_0x0cdb('0x30')][_0x0cdb('0x34')]('nolimit')){_0x5f3c56[_0x0cdb('0x1c')]=qs[_0x0cdb('0x1c')](_0x3b843a['query'][_0x0cdb('0x1c')]);_0x5f3c56[_0x0cdb('0x1a')]=qs['offset'](_0x3b843a[_0x0cdb('0x30')][_0x0cdb('0x1a')]);}_0x5f3c56[_0x0cdb('0x4a')]=qs[_0x0cdb('0x36')](_0x3b843a[_0x0cdb('0x30')][_0x0cdb('0x36')]);_0x5f3c56[_0x0cdb('0x37')]=qs['filters'](_[_0x0cdb('0x38')](_0x3b843a[_0x0cdb('0x30')],_0x8b523f[_0x0cdb('0x2e')]));_0x5f3c56[_0x0cdb('0x37')][_0x0cdb('0x4b')]=_0x34bae8['id'];if(_0x3b843a['query']['filter']){_0x5f3c56[_0x0cdb('0x37')]=_['merge'](_0x5f3c56[_0x0cdb('0x37')],{'$or':_[_0x0cdb('0x27')](_0x5f3c56['attributes'],function(_0x32c3e9){var _0x4d39c4={};_0x4d39c4[_0x32c3e9]={'$like':'%'+_0x3b843a[_0x0cdb('0x30')]['filter']+'%'};return _0x4d39c4;})});}_0x5f3c56=_[_0x0cdb('0x3a')]({},_0x5f3c56,_0x3b843a['options']);return db[_0x0cdb('0x49')][_0x0cdb('0x1d')]({'where':_0x5f3c56[_0x0cdb('0x37')]})['then'](function(_0x284c81){_0x484800[_0x0cdb('0x1d')]=_0x284c81;if(_0x3b843a[_0x0cdb('0x30')][_0x0cdb('0x43')]){_0x5f3c56[_0x0cdb('0x3e')]=[{'all':!![]}];}return db[_0x0cdb('0x49')]['findAll'](_0x5f3c56);})[_0x0cdb('0x3d')](function(_0x52da9d){_0x484800[_0x0cdb('0x3f')]=_0x52da9d;return _0x484800;});}})[_0x0cdb('0x3d')](respondWithFilteredResult(_0x1fdc73,_0x5f3c56))['catch'](handleError(_0x1fdc73,null));}; \ No newline at end of file +var _0x1eaf=['bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','JscriptySessionReport','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','findOne','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x1eaf,0x97));var _0xf1ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1eaf[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xf1ea('0x0'));var rimraf=require(_0xf1ea('0x1'));var zipdir=require(_0xf1ea('0x2'));var jsonpatch=require(_0xf1ea('0x3'));var rp=require(_0xf1ea('0x4'));var moment=require('moment');var BPromise=require(_0xf1ea('0x5'));var Mustache=require(_0xf1ea('0x6'));var util=require(_0xf1ea('0x7'));var path=require(_0xf1ea('0x8'));var sox=require(_0xf1ea('0x9'));var csv=require(_0xf1ea('0xa'));var ejs=require(_0xf1ea('0xb'));var fs=require('fs');var fs_extra=require(_0xf1ea('0xc'));var _=require(_0xf1ea('0xd'));var squel=require(_0xf1ea('0xe'));var crypto=require(_0xf1ea('0xf'));var jsforce=require(_0xf1ea('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf1ea('0xa'));var querystring=require(_0xf1ea('0x11'));var Papa=require(_0xf1ea('0x12'));var Redis=require(_0xf1ea('0x13'));var authService=require(_0xf1ea('0x14'));var qs=require(_0xf1ea('0x15'));var as=require(_0xf1ea('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1ea('0x17'))(_0xf1ea('0x18'));var utils=require(_0xf1ea('0x19'));var config=require(_0xf1ea('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2269b9,_0x2dbeef){_0x2dbeef=_0x2dbeef||0xcc;return function(_0x41f2ab){if(_0x41f2ab){return _0x2269b9['sendStatus'](_0x2dbeef);}return _0x2269b9[_0xf1ea('0x1b')](_0x2dbeef)['end']();};}function respondWithResult(_0x53bf84,_0x5855dc){_0x5855dc=_0x5855dc||0xc8;return function(_0x1e041e){if(_0x1e041e){return _0x53bf84[_0xf1ea('0x1b')](_0x5855dc)[_0xf1ea('0x1c')](_0x1e041e);}};}function respondWithFilteredResult(_0x1d9649,_0x198fed){return function(_0x275b44){if(_0x275b44){var _0xcf5b01=typeof _0x198fed[_0xf1ea('0x1d')]===_0xf1ea('0x1e')&&typeof _0x198fed[_0xf1ea('0x1f')]===_0xf1ea('0x1e');var _0x5e017a=_0x275b44[_0xf1ea('0x20')];var _0x18671d=_0xcf5b01?0x0:_0x198fed[_0xf1ea('0x1d')];var _0x5db9a2=_0xcf5b01?_0x275b44[_0xf1ea('0x20')]:_0x198fed[_0xf1ea('0x1d')]+_0x198fed[_0xf1ea('0x1f')];var _0x46e940;if(_0x5db9a2>=_0x5e017a){_0x5db9a2=_0x5e017a;_0x46e940=0xc8;}else{_0x46e940=0xce;}_0x1d9649[_0xf1ea('0x1b')](_0x46e940);return _0x1d9649[_0xf1ea('0x21')](_0xf1ea('0x22'),_0x18671d+'-'+_0x5db9a2+'/'+_0x5e017a)[_0xf1ea('0x1c')](_0x275b44);}return null;};}function patchUpdates(_0x3da0da){return function(_0x46d21c){try{jsonpatch[_0xf1ea('0x23')](_0x46d21c,_0x3da0da,!![]);}catch(_0x40b4e4){return BPromise['reject'](_0x40b4e4);}return _0x46d21c['save']();};}function saveUpdates(_0x207de0,_0x450753){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xf1ea('0x24')](_0x207de0)[_0xf1ea('0x25')](function(_0x3baeb8){return _0x3baeb8;});}return null;};}function removeEntity(_0x324c9e,_0x4239db){return function(_0x25a7e3){if(_0x25a7e3){return _0x25a7e3[_0xf1ea('0x26')]()[_0xf1ea('0x25')](function(){_0x324c9e[_0xf1ea('0x1b')](0xcc)[_0xf1ea('0x27')]();});}};}function handleEntityNotFound(_0x2d500b,_0x4935ea){return function(_0x40bc49){if(!_0x40bc49){_0x2d500b['sendStatus'](0x194);}return _0x40bc49;};}function handleError(_0x561687,_0x7cc6db){_0x7cc6db=_0x7cc6db||0x1f4;return function(_0x4f293f){logger[_0xf1ea('0x28')](_0x4f293f['stack']);if(_0x4f293f[_0xf1ea('0x29')]){delete _0x4f293f[_0xf1ea('0x29')];}_0x561687[_0xf1ea('0x1b')](_0x7cc6db)[_0xf1ea('0x2a')](_0x4f293f);};}exports[_0xf1ea('0x2b')]=function(_0x9a5701,_0xb8d88f){var _0x4a32bc={},_0x4a2cdc={},_0x172e2a={'count':0x0,'rows':[]};var _0x45f8be=_[_0xf1ea('0x2c')](db['JscriptySessionReport']['rawAttributes'],function(_0x3c044e){return{'name':_0x3c044e['fieldName'],'type':_0x3c044e[_0xf1ea('0x2d')]['key']};});_0x4a2cdc[_0xf1ea('0x2e')]=_['map'](_0x45f8be,'name');_0x4a2cdc['query']=_[_0xf1ea('0x2f')](_0x9a5701['query']);_0x4a2cdc[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x4a2cdc[_0xf1ea('0x2e')],_0x4a2cdc[_0xf1ea('0x32')]);_0x4a32bc[_0xf1ea('0x33')]=_[_0xf1ea('0x31')](_0x4a2cdc[_0xf1ea('0x2e')],qs[_0xf1ea('0x34')](_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x34')]));_0x4a32bc[_0xf1ea('0x33')]=_0x4a32bc[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x4a32bc[_0xf1ea('0x33')]:_0x4a2cdc[_0xf1ea('0x2e')];if(!_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x36')](_0xf1ea('0x37'))){_0x4a32bc['limit']=qs['limit'](_0x9a5701['query'][_0xf1ea('0x1f')]);_0x4a32bc['offset']=qs['offset'](_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x1d')]);}_0x4a32bc[_0xf1ea('0x38')]=qs[_0xf1ea('0x39')](_0x9a5701['query']['sort']);_0x4a32bc['where']=qs[_0xf1ea('0x30')](_[_0xf1ea('0x3a')](_0x9a5701[_0xf1ea('0x32')],_0x4a2cdc[_0xf1ea('0x30')]),_0x45f8be);if(_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x3b')]){_0x4a32bc['where']=_[_0xf1ea('0x3c')](_0x4a32bc['where'],{'$or':_[_0xf1ea('0x2c')](_0x45f8be,function(_0x35096a){if(_0x35096a[_0xf1ea('0x2d')]!==_0xf1ea('0x3d')){var _0x180df7={};_0x180df7[_0x35096a[_0xf1ea('0x29')]]={'$like':'%'+_0x9a5701['query'][_0xf1ea('0x3b')]+'%'};return _0x180df7;}})});}_0x4a32bc=_[_0xf1ea('0x3c')]({},_0x4a32bc,_0x9a5701[_0xf1ea('0x3e')]);var _0x458b49={'where':_0x4a32bc[_0xf1ea('0x3f')]};return db[_0xf1ea('0x40')][_0xf1ea('0x20')](_0x458b49)['then'](function(_0x49cb62){_0x172e2a[_0xf1ea('0x20')]=_0x49cb62;if(_0x9a5701[_0xf1ea('0x32')]['includeAll']){_0x4a32bc[_0xf1ea('0x41')]=[{'all':!![]}];}return db[_0xf1ea('0x40')][_0xf1ea('0x42')](_0x4a32bc);})[_0xf1ea('0x25')](function(_0x18d390){_0x172e2a['rows']=_0x18d390;return _0x172e2a;})[_0xf1ea('0x25')](respondWithFilteredResult(_0xb8d88f,_0x4a32bc))[_0xf1ea('0x43')](handleError(_0xb8d88f,null));};exports['show']=function(_0x36e21e,_0x113997){var _0x2f0ff6={'raw':!![],'where':{'id':_0x36e21e[_0xf1ea('0x44')]['id']}},_0x5eea38={};_0x5eea38[_0xf1ea('0x2e')]=_['keys'](db['JscriptySessionReport'][_0xf1ea('0x45')]);_0x5eea38[_0xf1ea('0x32')]=_[_0xf1ea('0x2f')](_0x36e21e[_0xf1ea('0x32')]);_0x5eea38[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x5eea38['model'],_0x5eea38[_0xf1ea('0x32')]);_0x2f0ff6[_0xf1ea('0x33')]=_['intersection'](_0x5eea38[_0xf1ea('0x2e')],qs[_0xf1ea('0x34')](_0x36e21e[_0xf1ea('0x32')][_0xf1ea('0x34')]));_0x2f0ff6[_0xf1ea('0x33')]=_0x2f0ff6[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x2f0ff6[_0xf1ea('0x33')]:_0x5eea38[_0xf1ea('0x2e')];if(_0x36e21e['query'][_0xf1ea('0x46')]){_0x2f0ff6[_0xf1ea('0x41')]=[{'all':!![]}];}_0x2f0ff6=_[_0xf1ea('0x3c')]({},_0x2f0ff6,_0x36e21e[_0xf1ea('0x3e')]);return db[_0xf1ea('0x40')][_0xf1ea('0x47')](_0x2f0ff6)[_0xf1ea('0x25')](handleEntityNotFound(_0x113997,null))['then'](respondWithResult(_0x113997,null))['catch'](handleError(_0x113997,null));};exports[_0xf1ea('0x48')]=function(_0x18700d,_0x475032){return db['JscriptySessionReport'][_0xf1ea('0x48')](_0x18700d[_0xf1ea('0x49')],{})[_0xf1ea('0x25')](respondWithResult(_0x475032,0xc9))[_0xf1ea('0x43')](handleError(_0x475032,null));};exports[_0xf1ea('0x24')]=function(_0x4cba34,_0x254c90){if(_0x4cba34[_0xf1ea('0x49')]['id']){delete _0x4cba34['body']['id'];}return db[_0xf1ea('0x40')]['find']({'where':{'id':_0x4cba34[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x254c90,null))[_0xf1ea('0x25')](saveUpdates(_0x4cba34[_0xf1ea('0x49')],null))[_0xf1ea('0x25')](respondWithResult(_0x254c90,null))['catch'](handleError(_0x254c90,null));};exports[_0xf1ea('0x26')]=function(_0x1af318,_0x3f81b0){return db[_0xf1ea('0x40')][_0xf1ea('0x47')]({'where':{'id':_0x1af318[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f81b0,null))[_0xf1ea('0x25')](removeEntity(_0x3f81b0,null))[_0xf1ea('0x43')](handleError(_0x3f81b0,null));};exports['describe']=function(_0x51c65b,_0x210967){return db['JscriptySessionReport'][_0xf1ea('0x4a')]()['then'](respondWithResult(_0x210967,null))[_0xf1ea('0x43')](handleError(_0x210967,null));};exports['getQuestions']=function(_0x5d5d74,_0x1d264f,_0x2bee6e){var _0x4efe46={'raw':!![],'where':{}};var _0x1fc9a7={};var _0x3405bd={'count':0x0,'rows':[]};return db[_0xf1ea('0x40')][_0xf1ea('0x4b')]({'where':{'id':_0x5d5d74[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d264f,null))[_0xf1ea('0x25')](function(_0x38c25d){if(_0x38c25d){_0x1fc9a7[_0xf1ea('0x2e')]=_[_0xf1ea('0x2f')](db[_0xf1ea('0x4c')][_0xf1ea('0x45')]);_0x1fc9a7[_0xf1ea('0x32')]=_[_0xf1ea('0x2f')](_0x5d5d74[_0xf1ea('0x32')]);_0x1fc9a7[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x1fc9a7[_0xf1ea('0x2e')],_0x1fc9a7[_0xf1ea('0x32')]);_0x4efe46[_0xf1ea('0x33')]=_['intersection'](_0x1fc9a7[_0xf1ea('0x2e')],qs['fields'](_0x5d5d74['query'][_0xf1ea('0x34')]));_0x4efe46[_0xf1ea('0x33')]=_0x4efe46[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x4efe46[_0xf1ea('0x33')]:_0x1fc9a7[_0xf1ea('0x2e')];if(!_0x5d5d74['query'][_0xf1ea('0x36')](_0xf1ea('0x37'))){_0x4efe46[_0xf1ea('0x1f')]=qs['limit'](_0x5d5d74[_0xf1ea('0x32')]['limit']);_0x4efe46['offset']=qs[_0xf1ea('0x1d')](_0x5d5d74[_0xf1ea('0x32')][_0xf1ea('0x1d')]);}_0x4efe46[_0xf1ea('0x38')]=qs[_0xf1ea('0x39')](_0x5d5d74['query'][_0xf1ea('0x39')]);_0x4efe46['where']=qs[_0xf1ea('0x30')](_[_0xf1ea('0x3a')](_0x5d5d74[_0xf1ea('0x32')],_0x1fc9a7['filters']));_0x4efe46[_0xf1ea('0x3f')]['SessionId']=_0x38c25d['id'];if(_0x5d5d74[_0xf1ea('0x32')]['filter']){_0x4efe46[_0xf1ea('0x3f')]=_['merge'](_0x4efe46[_0xf1ea('0x3f')],{'$or':_[_0xf1ea('0x2c')](_0x4efe46[_0xf1ea('0x33')],function(_0x33a640){var _0x327c22={};_0x327c22[_0x33a640]={'$like':'%'+_0x5d5d74['query']['filter']+'%'};return _0x327c22;})});}_0x4efe46=_[_0xf1ea('0x3c')]({},_0x4efe46,_0x5d5d74[_0xf1ea('0x3e')]);return db['JscriptyQuestionReport'][_0xf1ea('0x20')]({'where':_0x4efe46[_0xf1ea('0x3f')]})['then'](function(_0x6f186b){_0x3405bd[_0xf1ea('0x20')]=_0x6f186b;if(_0x5d5d74[_0xf1ea('0x32')][_0xf1ea('0x46')]){_0x4efe46[_0xf1ea('0x41')]=[{'all':!![]}];}return db[_0xf1ea('0x4c')][_0xf1ea('0x42')](_0x4efe46);})[_0xf1ea('0x25')](function(_0x408164){_0x3405bd[_0xf1ea('0x4d')]=_0x408164;return _0x3405bd;});}})['then'](respondWithFilteredResult(_0x1d264f,_0x4efe46))[_0xf1ea('0x43')](handleError(_0x1d264f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8e80f0d..bc96090 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 _0xe2fe=['../../config/environment','exports','define','JscriptySessionReport','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5bf180,_0x4e2320){_0x5bf180=_0x5bf180-0x0;var _0x85d290=_0x3baf[_0x5bf180];return _0x85d290;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 5670dd8..3ed4783 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 _0xcaf2=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x38dcde,_0x5983d9){var _0x35a8bb=function(_0x4e4f6e){while(--_0x4e4f6e){_0x38dcde['push'](_0x38dcde['shift']());}};_0x35a8bb(++_0x5983d9);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xcaf2[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});} \ No newline at end of file +var _0x0adf=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3d3542,_0x52bbd9){_0x3d3542=_0x3d3542-0x0;var _0xc436ff=_0x0adf[_0x3d3542];return _0xc436ff;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 53d31cd..e45ad91 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 _0x002c=['downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./license.controller','get','index','put','update','/download_log_file','isAuthenticated'];(function(_0x5aef67,_0x4cea90){var _0x530197=function(_0xea1c66){while(--_0xea1c66){_0x5aef67['push'](_0x5aef67['shift']());}};_0x530197(++_0x4cea90);}(_0x002c,0x1e1));var _0xc002=function(_0x1e2f09,_0x156b5d){_0x1e2f09=_0x1e2f09-0x0;var _0x445669=_0x002c[_0x1e2f09];return _0x445669;};'use strict';var multer=require(_0xc002('0x0'));var util=require(_0xc002('0x1'));var path=require(_0xc002('0x2'));var timeout=require(_0xc002('0x3'));var express=require(_0xc002('0x4'));var router=express[_0xc002('0x5')]();var fs_extra=require(_0xc002('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc002('0x7'));var controller=require(_0xc002('0x8'));router[_0xc002('0x9')]('/',controller[_0xc002('0xa')]);router[_0xc002('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc002('0xc')]);router[_0xc002('0x9')](_0xc002('0xd'),auth[_0xc002('0xe')](),controller[_0xc002('0xf')]);module['exports']=router; \ No newline at end of file +var _0x194f=['index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x1e0729,_0x329471){var _0x418fe0=function(_0x3b7614){while(--_0x3b7614){_0x1e0729['push'](_0x1e0729['shift']());}};_0x418fe0(++_0x329471);}(_0x194f,0x197));var _0xf194=function(_0x3770d8,_0x25ccb1){_0x3770d8=_0x3770d8-0x0;var _0x9a6ba3=_0x194f[_0x3770d8];return _0x9a6ba3;};'use strict';var multer=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var path=require(_0xf194('0x2'));var timeout=require(_0xf194('0x3'));var express=require(_0xf194('0x4'));var router=express[_0xf194('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf194('0x6'));var interaction=require(_0xf194('0x7'));var config=require(_0xf194('0x8'));var controller=require(_0xf194('0x9'));router[_0xf194('0xa')]('/',controller[_0xf194('0xb')]);router[_0xf194('0xc')](_0xf194('0xd'),auth['isAuthenticated'](),controller[_0xf194('0xe')]);router[_0xf194('0xa')](_0xf194('0xf'),auth[_0xf194('0x10')](),controller[_0xf194('0x11')]);module[_0xf194('0x12')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index eda3dbe..2191c76 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 _0xdf62=['STRING','INTEGER','sequelize','TEXT'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xdf62,0x7a));var _0x2df6=function(_0x1cd381,_0x201eaa){_0x1cd381=_0x1cd381-0x0;var _0x17ab23=_0xdf62[_0x1cd381];return _0x17ab23;};'use strict';var Sequelize=require(_0x2df6('0x0'));module['exports']={'license':{'type':Sequelize[_0x2df6('0x1')]},'data1':{'type':Sequelize[_0x2df6('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x2df6('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4ed4=['INTEGER','sequelize','TEXT','STRING'];(function(_0x4cf7ed,_0x447bf8){var _0x34d716=function(_0x22a177){while(--_0x22a177){_0x4cf7ed['push'](_0x4cf7ed['shift']());}};_0x34d716(++_0x447bf8);}(_0x4ed4,0x13d));var _0x44ed=function(_0x1e46b1,_0x1dbaba){_0x1e46b1=_0x1e46b1-0x0;var _0x3629cf=_0x4ed4[_0x1e46b1];return _0x3629cf;};'use strict';var Sequelize=require(_0x44ed('0x0'));module['exports']={'license':{'type':Sequelize[_0x44ed('0x1')]},'data1':{'type':Sequelize[_0x44ed('0x2')]},'data2':{'type':Sequelize[_0x44ed('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x44ed('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 d5a0809..e110d7d 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 _0xa5fe=['apply','reject','save','update','then','destroy','name','index','model','keys','License','query','filters','intersection','fields','attributes','merge','options','getLicense','body','find','params','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','rimraf','zip-dir','fast-json-patch','moment','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x1614c9,_0xe87ae4){var _0x5847c0=function(_0x11596d){while(--_0x11596d){_0x1614c9['push'](_0x1614c9['shift']());}};_0x5847c0(++_0xe87ae4);}(_0xa5fe,0xfb));var _0xea5f=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xa5fe[_0x487ab4];return _0x3bef77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea5f('0x0'));var zipdir=require(_0xea5f('0x1'));var jsonpatch=require(_0xea5f('0x2'));var rp=require('request-promise');var moment=require(_0xea5f('0x3'));var BPromise=require(_0xea5f('0x4'));var Mustache=require(_0xea5f('0x5'));var util=require(_0xea5f('0x6'));var path=require(_0xea5f('0x7'));var sox=require(_0xea5f('0x8'));var csv=require(_0xea5f('0x9'));var ejs=require(_0xea5f('0xa'));var fs=require('fs');var fs_extra=require(_0xea5f('0xb'));var _=require(_0xea5f('0xc'));var squel=require(_0xea5f('0xd'));var crypto=require('crypto');var jsforce=require(_0xea5f('0xe'));var deskjs=require(_0xea5f('0xf'));var toCsv=require(_0xea5f('0x9'));var querystring=require(_0xea5f('0x10'));var Papa=require(_0xea5f('0x11'));var Redis=require(_0xea5f('0x12'));var authService=require(_0xea5f('0x13'));var qs=require(_0xea5f('0x14'));var as=require(_0xea5f('0x15'));var hardwareService=require(_0xea5f('0x16'));var logger=require(_0xea5f('0x17'))(_0xea5f('0x18'));var utils=require(_0xea5f('0x19'));var config=require(_0xea5f('0x1a'));var licenseUtil=require(_0xea5f('0x1b'));var db=require(_0xea5f('0x1c'))['db'];function respondWithStatusCode(_0x47ff1c,_0xb30d91){_0xb30d91=_0xb30d91||0xcc;return function(_0x18d6bd){if(_0x18d6bd){return _0x47ff1c[_0xea5f('0x1d')](_0xb30d91);}return _0x47ff1c[_0xea5f('0x1e')](_0xb30d91)['end']();};}function respondWithResult(_0x3d7ade,_0x300944){_0x300944=_0x300944||0xc8;return function(_0x2a1604){if(_0x2a1604){return _0x3d7ade[_0xea5f('0x1e')](_0x300944)[_0xea5f('0x1f')](_0x2a1604);}};}function respondWithFilteredResult(_0x3babc5,_0x558d31){return function(_0xf52b03){if(_0xf52b03){var _0x3aac22=typeof _0x558d31[_0xea5f('0x20')]===_0xea5f('0x21')&&typeof _0x558d31[_0xea5f('0x22')]===_0xea5f('0x21');var _0x1f8291=_0xf52b03[_0xea5f('0x23')];var _0x6b64a8=_0x3aac22?0x0:_0x558d31['offset'];var _0x5bbe4b=_0x3aac22?_0xf52b03[_0xea5f('0x23')]:_0x558d31[_0xea5f('0x20')]+_0x558d31['limit'];var _0x537dee;if(_0x5bbe4b>=_0x1f8291){_0x5bbe4b=_0x1f8291;_0x537dee=0xc8;}else{_0x537dee=0xce;}_0x3babc5[_0xea5f('0x1e')](_0x537dee);return _0x3babc5[_0xea5f('0x24')]('Content-Range',_0x6b64a8+'-'+_0x5bbe4b+'/'+_0x1f8291)['json'](_0xf52b03);}return null;};}function patchUpdates(_0x480d7e){return function(_0x2e8f9){try{jsonpatch[_0xea5f('0x25')](_0x2e8f9,_0x480d7e,!![]);}catch(_0x2655b7){return BPromise[_0xea5f('0x26')](_0x2655b7);}return _0x2e8f9[_0xea5f('0x27')]();};}function saveUpdates(_0x48fc7c,_0x308ec0){return function(_0x4b65f4){if(_0x4b65f4){return _0x4b65f4[_0xea5f('0x28')](_0x48fc7c)[_0xea5f('0x29')](function(_0x4427e1){return _0x4427e1;});}return null;};}function removeEntity(_0x103891,_0x32b87d){return function(_0x49fd1a){if(_0x49fd1a){return _0x49fd1a[_0xea5f('0x2a')]()[_0xea5f('0x29')](function(){_0x103891[_0xea5f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20bdf0,_0x367233){return function(_0x5ed07a){if(!_0x5ed07a){_0x20bdf0['sendStatus'](0x194);}return _0x5ed07a;};}function handleError(_0x288820,_0x2e9768){_0x2e9768=_0x2e9768||0x1f4;return function(_0x427c1c){logger['error'](_0x427c1c['stack']);if(_0x427c1c[_0xea5f('0x2b')]){delete _0x427c1c[_0xea5f('0x2b')];}_0x288820[_0xea5f('0x1e')](_0x2e9768)['send'](_0x427c1c);};}var utilLicense=require(_0xea5f('0x1b'));exports[_0xea5f('0x2c')]=function(_0x137c0d,_0xc170c3){var _0x41ca49={'raw':!![],'where':{'id':0x1}},_0x306580={};_0x306580[_0xea5f('0x2d')]=_[_0xea5f('0x2e')](db[_0xea5f('0x2f')]['rawAttributes']);_0x306580[_0xea5f('0x30')]=_['keys'](_0x137c0d['query']);_0x306580[_0xea5f('0x31')]=_[_0xea5f('0x32')](_0x306580['model'],_0x306580[_0xea5f('0x30')]);_0x41ca49['attributes']=_[_0xea5f('0x32')](_0x306580[_0xea5f('0x2d')],qs[_0xea5f('0x33')](_0x137c0d[_0xea5f('0x30')][_0xea5f('0x33')]));_0x41ca49['attributes']=_0x41ca49['attributes']['length']?_0x41ca49[_0xea5f('0x34')]:_0x306580[_0xea5f('0x2d')];_0x41ca49=_[_0xea5f('0x35')]({},_0x41ca49,_0x137c0d[_0xea5f('0x36')]);return utilLicense[_0xea5f('0x37')](_0x41ca49)['then'](respondWithResult(_0xc170c3,null))['catch'](handleError(_0xc170c3,null));};exports[_0xea5f('0x28')]=function(_0x269147,_0x17a429){if(_0x269147['body']['id']){delete _0x269147[_0xea5f('0x38')]['id'];}return db[_0xea5f('0x2f')][_0xea5f('0x39')]({'where':{'id':_0x269147[_0xea5f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x17a429,null))[_0xea5f('0x29')](function(_0x2abab0){var _0xd648e9=_0x2abab0['get']({'plain':!![]});return utilLicense['checkLicense'](_0xd648e9,_0x269147[_0xea5f('0x38')][_0xea5f('0x3b')]);})['then'](function(_0x22b005){if(!_0x22b005[_0xea5f('0x3c')]){return saveUpdates(_0x269147[_0xea5f('0x38')],null);}return _0x22b005;})['then'](respondWithResult(_0x17a429,null))[_0xea5f('0x3d')](handleError(_0x17a429,null));};exports[_0xea5f('0x3e')]=function(_0x55c17c,_0x507056){var _0x569ee0=_0xea5f('0x3f');var _0x1ffbc1=path[_0xea5f('0x40')](_0xea5f('0x41'),_0xea5f('0x42'),_0xea5f('0x43'),_0x569ee0);_0x507056[_0xea5f('0x44')](_0xea5f('0x45'),'attachment;\x20filename='+_0x569ee0);_0x507056[_0xea5f('0x24')](_0xea5f('0x46'),_0xea5f('0x47'));_0x507056['download'](_0x1ffbc1);}; \ No newline at end of file +var _0xb751=['key','catch','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','download','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','keys','License','query','intersection','model','attributes','length','options','update','body','find'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0xb751,0x8d));var _0x1b75=function(_0x1d037b,_0x2c2e7b){_0x1d037b=_0x1d037b-0x0;var _0x4fa19e=_0xb751[_0x1d037b];return _0x4fa19e;};'use strict';var emlformat=require(_0x1b75('0x0'));var rimraf=require(_0x1b75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b75('0x2'));var rp=require('request-promise');var moment=require(_0x1b75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1b75('0x4'));var util=require(_0x1b75('0x5'));var path=require(_0x1b75('0x6'));var sox=require(_0x1b75('0x7'));var csv=require(_0x1b75('0x8'));var ejs=require(_0x1b75('0x9'));var fs=require('fs');var fs_extra=require(_0x1b75('0xa'));var _=require(_0x1b75('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b75('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b75('0x8'));var querystring=require('querystring');var Papa=require(_0x1b75('0xd'));var Redis=require(_0x1b75('0xe'));var authService=require(_0x1b75('0xf'));var qs=require(_0x1b75('0x10'));var as=require(_0x1b75('0x11'));var hardwareService=require(_0x1b75('0x12'));var logger=require(_0x1b75('0x13'))(_0x1b75('0x14'));var utils=require(_0x1b75('0x15'));var config=require(_0x1b75('0x16'));var licenseUtil=require(_0x1b75('0x17'));var db=require(_0x1b75('0x18'))['db'];function respondWithStatusCode(_0x4daa35,_0x3b23f1){_0x3b23f1=_0x3b23f1||0xcc;return function(_0x2e1e09){if(_0x2e1e09){return _0x4daa35[_0x1b75('0x19')](_0x3b23f1);}return _0x4daa35[_0x1b75('0x1a')](_0x3b23f1)['end']();};}function respondWithResult(_0x21ee74,_0x51d120){_0x51d120=_0x51d120||0xc8;return function(_0x234707){if(_0x234707){return _0x21ee74[_0x1b75('0x1a')](_0x51d120)['json'](_0x234707);}};}function respondWithFilteredResult(_0x4fff13,_0x14ecc2){return function(_0x376309){if(_0x376309){var _0x4d1661=typeof _0x14ecc2['offset']===_0x1b75('0x1b')&&typeof _0x14ecc2[_0x1b75('0x1c')]===_0x1b75('0x1b');var _0x22b172=_0x376309['count'];var _0x44e87f=_0x4d1661?0x0:_0x14ecc2['offset'];var _0x1aa94f=_0x4d1661?_0x376309[_0x1b75('0x1d')]:_0x14ecc2['offset']+_0x14ecc2['limit'];var _0x5ec9a9;if(_0x1aa94f>=_0x22b172){_0x1aa94f=_0x22b172;_0x5ec9a9=0xc8;}else{_0x5ec9a9=0xce;}_0x4fff13[_0x1b75('0x1a')](_0x5ec9a9);return _0x4fff13[_0x1b75('0x1e')](_0x1b75('0x1f'),_0x44e87f+'-'+_0x1aa94f+'/'+_0x22b172)[_0x1b75('0x20')](_0x376309);}return null;};}function patchUpdates(_0x4fec33){return function(_0x5109c1){try{jsonpatch[_0x1b75('0x21')](_0x5109c1,_0x4fec33,!![]);}catch(_0x5827cc){return BPromise[_0x1b75('0x22')](_0x5827cc);}return _0x5109c1[_0x1b75('0x23')]();};}function saveUpdates(_0x1054e6,_0x3c67f2){return function(_0x837af9){if(_0x837af9){return _0x837af9['update'](_0x1054e6)[_0x1b75('0x24')](function(_0x16ed7b){return _0x16ed7b;});}return null;};}function removeEntity(_0x46c96d,_0x58ba33){return function(_0x304fd4){if(_0x304fd4){return _0x304fd4[_0x1b75('0x25')]()[_0x1b75('0x24')](function(){_0x46c96d[_0x1b75('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1217b3,_0x4124d0){return function(_0x21ecdd){if(!_0x21ecdd){_0x1217b3['sendStatus'](0x194);}return _0x21ecdd;};}function handleError(_0x3cabbd,_0x34a060){_0x34a060=_0x34a060||0x1f4;return function(_0x43544c){logger[_0x1b75('0x26')](_0x43544c[_0x1b75('0x27')]);if(_0x43544c[_0x1b75('0x28')]){delete _0x43544c['name'];}_0x3cabbd[_0x1b75('0x1a')](_0x34a060)[_0x1b75('0x29')](_0x43544c);};}var utilLicense=require(_0x1b75('0x17'));exports[_0x1b75('0x2a')]=function(_0x349a2e,_0x4e80d6){var _0x23b4c0={'raw':!![],'where':{'id':0x1}},_0x5e5adf={};_0x5e5adf['model']=_[_0x1b75('0x2b')](db[_0x1b75('0x2c')]['rawAttributes']);_0x5e5adf[_0x1b75('0x2d')]=_[_0x1b75('0x2b')](_0x349a2e['query']);_0x5e5adf['filters']=_[_0x1b75('0x2e')](_0x5e5adf[_0x1b75('0x2f')],_0x5e5adf['query']);_0x23b4c0[_0x1b75('0x30')]=_['intersection'](_0x5e5adf['model'],qs['fields'](_0x349a2e[_0x1b75('0x2d')]['fields']));_0x23b4c0[_0x1b75('0x30')]=_0x23b4c0[_0x1b75('0x30')][_0x1b75('0x31')]?_0x23b4c0[_0x1b75('0x30')]:_0x5e5adf['model'];_0x23b4c0=_['merge']({},_0x23b4c0,_0x349a2e[_0x1b75('0x32')]);return utilLicense['getLicense'](_0x23b4c0)[_0x1b75('0x24')](respondWithResult(_0x4e80d6,null))['catch'](handleError(_0x4e80d6,null));};exports[_0x1b75('0x33')]=function(_0x3b6f53,_0x513ca3){if(_0x3b6f53['body']['id']){delete _0x3b6f53[_0x1b75('0x34')]['id'];}return db[_0x1b75('0x2c')][_0x1b75('0x35')]({'where':{'id':_0x3b6f53['params']['id']}})[_0x1b75('0x24')](handleEntityNotFound(_0x513ca3,null))[_0x1b75('0x24')](function(_0x273d61){var _0x37e117=_0x273d61['get']({'plain':!![]});return utilLicense['checkLicense'](_0x37e117,_0x3b6f53[_0x1b75('0x34')][_0x1b75('0x36')]);})['then'](function(_0xe433ce){if(!_0xe433ce['demo']){return saveUpdates(_0x3b6f53[_0x1b75('0x34')],null);}return _0xe433ce;})[_0x1b75('0x24')](respondWithResult(_0x513ca3,null))[_0x1b75('0x37')](handleError(_0x513ca3,null));};exports[_0x1b75('0x38')]=function(_0xb18c26,_0x7a254a){var _0x1c425e=_0x1b75('0x39');var _0x204aaa=path['join'](_0x1b75('0x3a'),_0x1b75('0x3b'),_0x1b75('0x3c'),_0x1c425e);_0x7a254a[_0x1b75('0x3d')](_0x1b75('0x3e'),_0x1b75('0x3f')+_0x1c425e);_0x7a254a[_0x1b75('0x1e')]('Content-Type','text/plain');_0x7a254a[_0x1b75('0x40')](_0x204aaa);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ef8244e..e6f6b22 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 _0x400b=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','License','license'];(function(_0x2b9607,_0x3b5e1d){var _0x3044eb=function(_0x9e91c3){while(--_0x9e91c3){_0x2b9607['push'](_0x2b9607['shift']());}};_0x3044eb(++_0x3b5e1d);}(_0x400b,0x19a));var _0xb400=function(_0xf38b17,_0x492fc7){_0xf38b17=_0xf38b17-0x0;var _0x43d3f7=_0x400b[_0xf38b17];return _0x43d3f7;};'use strict';var _=require(_0xb400('0x0'));var util=require('util');var logger=require(_0xb400('0x1'))('api');var moment=require(_0xb400('0x2'));var BPromise=require('bluebird');var rp=require(_0xb400('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb400('0x4'));var config=require(_0xb400('0x5'));var attributes=require('./license.attributes');module[_0xb400('0x6')]=function(_0x1bf05d,_0x7b167c){return _0x1bf05d[_0xb400('0x7')](_0xb400('0x8'),attributes,{'tableName':_0xb400('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x516a=['rimraf','../../config/environment','exports','define','License','license','../../config/logger','moment','bluebird','path'];(function(_0x13a3ae,_0x1a1374){var _0x444e2d=function(_0x96db06){while(--_0x96db06){_0x13a3ae['push'](_0x13a3ae['shift']());}};_0x444e2d(++_0x1a1374);}(_0x516a,0xe2));var _0xa516=function(_0x28a33e,_0x226e58){_0x28a33e=_0x28a33e-0x0;var _0x2124fb=_0x516a[_0x28a33e];return _0x2124fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa516('0x0'))('api');var moment=require(_0xa516('0x1'));var BPromise=require(_0xa516('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa516('0x3'));var rimraf=require(_0xa516('0x4'));var config=require(_0xa516('0x5'));var attributes=require('./license.attributes');module[_0xa516('0x6')]=function(_0x10d444,_0x2d4581){return _0x10d444[_0xa516('0x7')](_0xa516('0x8'),attributes,{'tableName':_0xa516('0x9'),'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 72ee694..dcd53aa 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 _0xe29b=['request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0xe29b,0x13a));var _0xbe29=function(_0x4d69e4,_0x255c37){_0x4d69e4=_0x4d69e4-0x0;var _0x570059=_0xe29b[_0x4d69e4];return _0x570059;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbe29('0x0'));var BPromise=require(_0xbe29('0x1'));var rs=require(_0xbe29('0x2'));var fs=require('fs');var Redis=require(_0xbe29('0x3'));var db=require(_0xbe29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe29('0x5'))(_0xbe29('0x6'));var config=require(_0xbe29('0x7'));var jayson=require(_0xbe29('0x8'));var client=jayson[_0xbe29('0x9')][_0xbe29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dde0a,_0x426cf1,_0x551796){return new BPromise(function(_0xa56f5b,_0x49911e){return client[_0xbe29('0xb')](_0x3dde0a,_0x551796)[_0xbe29('0xc')](function(_0x3d8f0a){logger[_0xbe29('0xd')](_0xbe29('0xe'),_0x426cf1,'request\x20sent');logger[_0xbe29('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x426cf1,_0xbe29('0x10'),JSON['stringify'](_0x3d8f0a));if(_0x3d8f0a[_0xbe29('0x11')]){if(_0x3d8f0a[_0xbe29('0x11')][_0xbe29('0x12')]===0x1f4){logger[_0xbe29('0x11')]('License,\x20%s,\x20%s',_0x426cf1,_0x3d8f0a[_0xbe29('0x11')]['message']);return _0x49911e(_0x3d8f0a[_0xbe29('0x11')][_0xbe29('0x13')]);}logger[_0xbe29('0x11')](_0xbe29('0xe'),_0x426cf1,_0x3d8f0a['error'][_0xbe29('0x13')]);return _0xa56f5b(_0x3d8f0a[_0xbe29('0x11')][_0xbe29('0x13')]);}else{logger[_0xbe29('0xd')](_0xbe29('0xe'),_0x426cf1,_0xbe29('0x10'));_0xa56f5b(_0x3d8f0a[_0xbe29('0x14')]['message']);}})[_0xbe29('0x15')](function(_0x1cf5d4){logger['error'](_0xbe29('0xe'),_0x426cf1,_0x1cf5d4);_0x49911e(_0x1cf5d4);});});} \ No newline at end of file +var _0xf11d=['client','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x270136,_0x5e2d41){var _0x1deba8=function(_0x107b95){while(--_0x107b95){_0x270136['push'](_0x270136['shift']());}};_0x1deba8(++_0x5e2d41);}(_0xf11d,0x126));var _0xdf11=function(_0x5626ee,_0x314648){_0x5626ee=_0x5626ee-0x0;var _0x42bae0=_0xf11d[_0x5626ee];return _0x42bae0;};'use strict';var _=require('lodash');var util=require(_0xdf11('0x0'));var moment=require(_0xdf11('0x1'));var BPromise=require(_0xdf11('0x2'));var rs=require(_0xdf11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf11('0x4'));var logger=require('../../config/logger')(_0xdf11('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf11('0x6')][_0xdf11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25d457,_0x239aca,_0x597d04){return new BPromise(function(_0x234c4f,_0x5b3e4e){return client[_0xdf11('0x8')](_0x25d457,_0x597d04)[_0xdf11('0x9')](function(_0x535dff){logger[_0xdf11('0xa')](_0xdf11('0xb'),_0x239aca,'request\x20sent');logger['debug'](_0xdf11('0xc'),_0x239aca,_0xdf11('0xd'),JSON[_0xdf11('0xe')](_0x535dff));if(_0x535dff[_0xdf11('0xf')]){if(_0x535dff[_0xdf11('0xf')][_0xdf11('0x10')]===0x1f4){logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x535dff[_0xdf11('0xf')]['message']);return _0x5b3e4e(_0x535dff[_0xdf11('0xf')]['message']);}logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x535dff[_0xdf11('0xf')][_0xdf11('0x11')]);return _0x234c4f(_0x535dff[_0xdf11('0xf')][_0xdf11('0x11')]);}else{logger[_0xdf11('0xa')](_0xdf11('0xb'),_0x239aca,_0xdf11('0xd'));_0x234c4f(_0x535dff[_0xdf11('0x12')]['message']);}})[_0xdf11('0x13')](function(_0x84da81){logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x84da81);_0x5b3e4e(_0x84da81);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e092bb6..0212ca2 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 _0xcf8d=['getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','describe','/:id','/:id/dispositions','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers'];(function(_0x9ea84b,_0x49f47b){var _0x5b80fb=function(_0x48310d){while(--_0x48310d){_0x9ea84b['push'](_0x9ea84b['shift']());}};_0x5b80fb(++_0x49f47b);}(_0xcf8d,0x7a));var _0xdcf8=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0xcf8d[_0x322bef];return _0x229e60;};'use strict';var multer=require('multer');var util=require(_0xdcf8('0x0'));var path=require(_0xdcf8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcf8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdcf8('0x3'));var interaction=require(_0xdcf8('0x4'));var config=require(_0xdcf8('0x5'));var controller=require(_0xdcf8('0x6'));router[_0xdcf8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdcf8('0x7')](_0xdcf8('0x8'),auth['isAuthenticated'](),controller[_0xdcf8('0x9')]);router[_0xdcf8('0x7')](_0xdcf8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdcf8('0x7')](_0xdcf8('0xb'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0xd')]);router[_0xdcf8('0x7')](_0xdcf8('0xe'),auth['isAuthenticated'](),controller[_0xdcf8('0xf')]);router['get'](_0xdcf8('0x10'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x11')]);router['get'](_0xdcf8('0x12'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x13')]);router[_0xdcf8('0x7')](_0xdcf8('0x14'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x15')]);router['get'](_0xdcf8('0x16'),auth['isAuthenticated'](),controller[_0xdcf8('0x17')]);router[_0xdcf8('0x7')](_0xdcf8('0x18'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x19')]);router[_0xdcf8('0x7')](_0xdcf8('0x1a'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x1b')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xdcf8('0x1c')]);router['post'](_0xdcf8('0xb'),auth[_0xdcf8('0xc')](),controller['addDisposition']);router[_0xdcf8('0x1d')](_0xdcf8('0xe'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x1e')]);router['post']('/',auth[_0xdcf8('0xc')](),controller['create']);router[_0xdcf8('0x1d')](_0xdcf8('0x10'),auth['isAuthenticated'](),controller[_0xdcf8('0x1f')]);router[_0xdcf8('0x1d')](_0xdcf8('0x12'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x20')]);router['post']('/:id/interactions',auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x21')]);router[_0xdcf8('0x1d')](_0xdcf8('0x16'),auth['isAuthenticated'](),controller[_0xdcf8('0x22')]);router[_0xdcf8('0x1d')](_0xdcf8('0x23'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x24')]);router[_0xdcf8('0x1d')](_0xdcf8('0x25'),auth['isAuthenticated'](),controller[_0xdcf8('0x26')]);router['put'](_0xdcf8('0xa'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x27')]);router[_0xdcf8('0x28')](_0xdcf8('0xb'),auth['isAuthenticated'](),controller[_0xdcf8('0x29')]);router[_0xdcf8('0x28')](_0xdcf8('0xe'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x2a')]);router[_0xdcf8('0x28')]('/:id/in_servers',auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x2b')]);router['delete'](_0xdcf8('0x12'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x2c')]);router['delete'](_0xdcf8('0xa'),auth[_0xdcf8('0xc')](),controller[_0xdcf8('0x2d')]);router[_0xdcf8('0x28')]('/:id/users',auth['isAuthenticated'](),controller[_0xdcf8('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xc496=['addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','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','/:id/users','getAgents','post','create','addImap','addSmtp','/:id/interactions','/:id/send','send'];(function(_0x447c57,_0x322bc1){var _0x24189a=function(_0x3226a4){while(--_0x3226a4){_0x447c57['push'](_0x447c57['shift']());}};_0x24189a(++_0x322bc1);}(_0xc496,0x15c));var _0x6c49=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xc496[_0x43776a];return _0x18eb8f;};'use strict';var multer=require(_0x6c49('0x0'));var util=require('util');var path=require(_0x6c49('0x1'));var timeout=require(_0x6c49('0x2'));var express=require(_0x6c49('0x3'));var router=express[_0x6c49('0x4')]();var fs_extra=require(_0x6c49('0x5'));var auth=require(_0x6c49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c49('0x7'));var controller=require('./mailAccount.controller');router[_0x6c49('0x8')]('/',auth[_0x6c49('0x9')](),controller[_0x6c49('0xa')]);router['get'](_0x6c49('0xb'),auth[_0x6c49('0x9')](),controller['describe']);router[_0x6c49('0x8')]('/:id',auth[_0x6c49('0x9')](),controller[_0x6c49('0xc')]);router[_0x6c49('0x8')](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller[_0x6c49('0xe')]);router[_0x6c49('0x8')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x10')]);router[_0x6c49('0x8')](_0x6c49('0x11'),auth['isAuthenticated'](),controller[_0x6c49('0x12')]);router['get'](_0x6c49('0x13'),auth['isAuthenticated'](),controller[_0x6c49('0x14')]);router[_0x6c49('0x8')]('/:id/interactions',auth[_0x6c49('0x9')](),controller[_0x6c49('0x15')]);router[_0x6c49('0x8')](_0x6c49('0x16'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x17')]);router[_0x6c49('0x8')](_0x6c49('0x18'),auth['isAuthenticated'](),controller[_0x6c49('0x19')]);router['get'](_0x6c49('0x1a'),auth[_0x6c49('0x9')](),controller['verifySmtp']);router['get'](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x1c')]);router['post'](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller['addDisposition']);router[_0x6c49('0x1d')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller['addAnswer']);router[_0x6c49('0x1d')]('/',auth['isAuthenticated'](),controller[_0x6c49('0x1e')]);router[_0x6c49('0x1d')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x6c49('0x1f')]);router[_0x6c49('0x1d')](_0x6c49('0x13'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x20')]);router[_0x6c49('0x1d')](_0x6c49('0x21'),auth[_0x6c49('0x9')](),controller['addInteraction']);router[_0x6c49('0x1d')](_0x6c49('0x16'),auth[_0x6c49('0x9')](),controller['addApplications']);router['post'](_0x6c49('0x22'),auth['isAuthenticated'](),controller[_0x6c49('0x23')]);router[_0x6c49('0x1d')](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x24')]);router[_0x6c49('0x25')](_0x6c49('0x26'),auth['isAuthenticated'](),controller[_0x6c49('0x27')]);router['delete'](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x28')]);router[_0x6c49('0x29')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2a')]);router['delete'](_0x6c49('0x11'),auth['isAuthenticated'](),controller[_0x6c49('0x2b')]);router['delete'](_0x6c49('0x13'),auth['isAuthenticated'](),controller[_0x6c49('0x2c')]);router[_0x6c49('0x29')](_0x6c49('0x26'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2d')]);router[_0x6c49('0x29')](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2e')]);module[_0x6c49('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 c16d992..9daa90c 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 _0x3d10=['getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail','yahoo','outlook365'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d10,0x123));var _0x03d1=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x3d10[_0x3712e2];return _0x1faff4;};'use strict';var Sequelize=require(_0x03d1('0x0'));module[_0x03d1('0x1')]={'description':{'type':Sequelize[_0x03d1('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x03d1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x03d1('0x4')]},'markAsUnread':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x03d1('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x03d1('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x03d1('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x03d1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03d1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x03d1('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x03d1('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x03d1('0x9'),'set':function(_0x216f77){if(!_0x216f77)this[_0x03d1('0xa')](_0x03d1('0xb'),null);this[_0x03d1('0xa')]('mandatoryDisposition',_0x216f77);}},'provider':{'type':Sequelize['ENUM'](_0x03d1('0xc'),'hotmail',_0x03d1('0xd'),_0x03d1('0xe')),'defaultValue':null,'get':function(){if(!this[_0x03d1('0xf')](_0x03d1('0x10')))return _0x03d1('0x11');return this[_0x03d1('0xf')](_0x03d1('0x10'));},'set':function(_0x495e98){if(_0x495e98===_0x03d1('0x11'))_0x495e98=null;return this[_0x03d1('0xa')](_0x03d1('0x10'),_0x495e98);}}}; \ No newline at end of file +var _0x7b11=['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','mandatoryDisposition','hotmail','outlook365','provider','custom','getDataValue','setDataValue','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7b11,0x11a));var _0x17b1=function(_0x2f4efe,_0x1f3be5){_0x2f4efe=_0x2f4efe-0x0;var _0x4e1668=_0x7b11[_0x2f4efe];return _0x4e1668;};'use strict';var Sequelize=require('sequelize');module[_0x17b1('0x0')]={'description':{'type':Sequelize[_0x17b1('0x1')]},'name':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x17b1('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x17b1('0x3')]},'markAsUnread':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![],'defaultValue':_0x17b1('0x4')},'fontSize':{'type':Sequelize[_0x17b1('0x5')](0x2)[_0x17b1('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x17b1('0x3')],'defaultValue':function(){return _0x17b1('0x7');}},'notificationSound':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x17b1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17b1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17b1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x17b1('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![],'comment':_0x17b1('0x9'),'set':function(_0x503ae6){if(!_0x503ae6)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x17b1('0xa'),_0x503ae6);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x17b1('0xb'),'yahoo',_0x17b1('0xc')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x17b1('0xd')))return _0x17b1('0xe');return this[_0x17b1('0xf')](_0x17b1('0xd'));},'set':function(_0x43fbbf){if(_0x43fbbf===_0x17b1('0xe'))_0x43fbbf=null;return this[_0x17b1('0x10')]('provider',_0x43fbbf);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 341799f..9c1c6d1 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 _0xc4aa=['where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','MailServerIn','MailServerOut','length','find','body','params','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','findOne','rawAttributes','order','pick','removeDispositions','CannedAnswer','getAnswers','MailAccountId','removeAnswers','ids','create','provider','custom','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','fullname','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List','ListId','messageId','subject','attach','out','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','request\x20sent','result','status','end','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','sendStatus','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x206f02,_0x36f322){var _0x8a2663=function(_0x5ac031){while(--_0x5ac031){_0x206f02['push'](_0x206f02['shift']());}};_0x8a2663(++_0x36f322);}(_0xc4aa,0x1f1));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var moment=require(_0xac4a('0x0'));var BPromise=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var path=require('path');var _=require(_0xac4a('0x3'));var juice=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var qs=require(_0xac4a('0x6'));var logger=require(_0xac4a('0x7'))(_0xac4a('0x8'));var config=require(_0xac4a('0x9'));var db=require('../../mysqldb')['db'];config[_0xac4a('0xa')]=_[_0xac4a('0xb')](config[_0xac4a('0xa')],{'host':_0xac4a('0xc'),'port':0x18eb});var socket=require(_0xac4a('0xd'))(new Redis(config[_0xac4a('0xa')]));require(_0xac4a('0xe'))[_0xac4a('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac4a('0x10')][_0xac4a('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x27547f,_0x3fb058,_0x3d508e,_0x550d9f){return new BPromise(function(_0x2eab76,_0xb1e2b){var _0xdd00a8=_0x550d9f||client;return _0xdd00a8[_0xac4a('0x12')](_0x27547f,_0x3d508e)[_0xac4a('0x13')](function(_0x13436c){logger[_0xac4a('0x14')]('MailAccount,\x20%s,\x20%s',_0x3fb058,'request\x20sent');logger['debug'](_0xac4a('0x15'),_0x3fb058,'request\x20sent',JSON[_0xac4a('0x16')](_0x13436c));if(_0x13436c[_0xac4a('0x17')]){if(_0x13436c['error'][_0xac4a('0x18')]===0x1f4){logger[_0xac4a('0x17')](_0xac4a('0x19'),_0x3fb058,_0x13436c[_0xac4a('0x17')][_0xac4a('0x1a')]);return _0xb1e2b(_0x13436c[_0xac4a('0x17')][_0xac4a('0x1a')]);}logger[_0xac4a('0x17')](_0xac4a('0x19'),_0x3fb058,_0x13436c['error'][_0xac4a('0x1a')]);return _0x2eab76(_0x13436c['error'][_0xac4a('0x1a')]);}else{logger[_0xac4a('0x14')]('MailAccount,\x20%s,\x20%s',_0x3fb058,_0xac4a('0x1b'));_0x2eab76(_0x13436c[_0xac4a('0x1c')][_0xac4a('0x1a')]);}})['catch'](function(_0x1c98fe){logger['error'](_0xac4a('0x19'),_0x3fb058,_0x1c98fe);_0xb1e2b(_0x1c98fe);});});}function respondWithStatusCode(_0x1c7e72,_0x26045e){_0x26045e=_0x26045e||0xcc;return function(_0x33d91d){if(_0x33d91d){return _0x1c7e72['sendStatus'](_0x26045e);}return _0x1c7e72[_0xac4a('0x1d')](_0x26045e)[_0xac4a('0x1e')]();};}function respondWithResult(_0x179c00,_0x951587){_0x951587=_0x951587||0xc8;return function(_0x5843b9){if(_0x5843b9){return _0x179c00['status'](_0x951587)[_0xac4a('0x1f')](_0x5843b9);}};}function respondWithFilteredResult(_0x1a137a,_0x970fac){return function(_0x1ca015){if(_0x1ca015){var _0x2c3f91=typeof _0x970fac[_0xac4a('0x20')]===_0xac4a('0x21')&&typeof _0x970fac[_0xac4a('0x22')]===_0xac4a('0x21');var _0x5a146a=_0x1ca015[_0xac4a('0x23')];var _0x4f7893=_0x2c3f91?0x0:_0x970fac[_0xac4a('0x20')];var _0x18a0f7=_0x2c3f91?_0x1ca015[_0xac4a('0x23')]:_0x970fac[_0xac4a('0x20')]+_0x970fac[_0xac4a('0x22')];var _0x217b15;if(_0x18a0f7>=_0x5a146a){_0x18a0f7=_0x5a146a;_0x217b15=0xc8;}else{_0x217b15=0xce;}_0x1a137a[_0xac4a('0x1d')](_0x217b15);return _0x1a137a[_0xac4a('0x24')]('Content-Range',_0x4f7893+'-'+_0x18a0f7+'/'+_0x5a146a)[_0xac4a('0x1f')](_0x1ca015);}return null;};}function saveUpdates(_0xc71399){return function(_0x14712b){if(_0x14712b){return _0x14712b[_0xac4a('0x25')](_0xc71399)[_0xac4a('0x13')](function(_0xb867ef){return _0xb867ef;});}return null;};}function removeEntity(_0x5809bb){return function(_0x12478d){if(_0x12478d){return _0x12478d[_0xac4a('0x26')]()[_0xac4a('0x13')](function(){var _0x382ec8=_0x12478d[_0xac4a('0x27')]({'plain':!![]});var _0x270f9e='MailAccounts';return db[_0xac4a('0x28')][_0xac4a('0x26')]({'where':{'type':_0x270f9e,'resourceId':_0x382ec8['id']}})['then'](function(){return _0x12478d;});})[_0xac4a('0x13')](function(){_0x5809bb['status'](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x406e65){return function(_0x503209){if(!_0x503209){_0x406e65[_0xac4a('0x29')](0x194);}return _0x503209;};}function handleError(_0x393185,_0x4189d7){_0x4189d7=_0x4189d7||0x1f4;return function(_0x3e4841){logger[_0xac4a('0x17')](_0x3e4841['stack']);if(_0x3e4841[_0xac4a('0x2a')]){delete _0x3e4841[_0xac4a('0x2a')];}_0x393185[_0xac4a('0x1d')](_0x4189d7)[_0xac4a('0x2b')](_0x3e4841);};}function getImapHost(_0x54e5aa){switch(_0x54e5aa){case'gmail':return _0xac4a('0x2c');case _0xac4a('0x2d'):return _0xac4a('0x2e');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xac4a('0x2f');}throw new Error(_0xac4a('0x30'),_0x54e5aa);}function getSmtpHost(_0x1a915a){switch(_0x1a915a){case _0xac4a('0x31'):return _0xac4a('0x32');case _0xac4a('0x2d'):return _0xac4a('0x33');case _0xac4a('0x34'):return _0xac4a('0x35');case _0xac4a('0x36'):return _0xac4a('0x37');}throw new Error(_0xac4a('0x30'),_0x1a915a);}function getAuthenticationOptions(_0x5ae641,_0x57bd6d){var _0x15a46e={};var _0x2814b2={};if(_0x5ae641){_0x15a46e['user']=_0x2814b2[_0xac4a('0x38')]=_0x57bd6d[_0xac4a('0x39')];_0x15a46e[_0xac4a('0x3a')]=_0x2814b2[_0xac4a('0x3b')]=_0x57bd6d[_0xac4a('0x3a')];if(_0x57bd6d['modernAuthentication']){_0x15a46e[_0xac4a('0x3c')]=_0x2814b2[_0xac4a('0x3c')]=!![];_0x15a46e[_0xac4a('0x3d')]=_0x2814b2['CloudProviderId']=_0x57bd6d['CloudProviderId'];_0x15a46e[_0xac4a('0x3a')]=_0x2814b2[_0xac4a('0x3b')]=null;}else{_0x15a46e[_0xac4a('0x3d')]=_0x2814b2[_0xac4a('0x3d')]=null;}_0x15a46e[_0xac4a('0x3e')]=getImapHost(_0x5ae641);_0x15a46e['port']=0x3e1;_0x2814b2[_0xac4a('0x3e')]=getSmtpHost(_0x5ae641);_0x2814b2[_0xac4a('0x3f')]=0x24b;_0x2814b2[_0xac4a('0x40')]=![];_0x15a46e[_0xac4a('0x41')]=_0x2814b2['service']=null;}else{if(_0x57bd6d[_0xac4a('0x42')]){_0x15a46e[_0xac4a('0x38')]=_0x2814b2[_0xac4a('0x38')]=_0x57bd6d['username'];_0x15a46e[_0xac4a('0x3a')]=_0x2814b2[_0xac4a('0x3b')]=_0x57bd6d[_0xac4a('0x3a')];}else{_0x15a46e[_0xac4a('0x42')]=_0x2814b2['authentication']=![];_0x15a46e['user']=_0x2814b2[_0xac4a('0x38')]=null;_0x15a46e['password']=_0x2814b2[_0xac4a('0x3b')]=null;}_0x15a46e['host']=_0x57bd6d[_0xac4a('0x43')][_0xac4a('0x3e')];_0x15a46e[_0xac4a('0x3f')]=_0x57bd6d['Imap'][_0xac4a('0x3f')];_0x2814b2[_0xac4a('0x3e')]=_0x57bd6d[_0xac4a('0x44')][_0xac4a('0x3e')];_0x2814b2[_0xac4a('0x3f')]=_0x57bd6d['Smtp']['port'];}return{'Imap':_0x15a46e,'Smtp':_0x2814b2};}exports['index']=function(_0x378335,_0x28aefa){var _0xeb83bc={'include':[{'model':db['MailServerIn'],'as':_0xac4a('0x43')},{'model':db['MailServerOut'],'as':_0xac4a('0x44')},{'model':db['Pause'],'as':_0xac4a('0x45')}]},_0x1eabf1={},_0xe78ac9={'count':0x0,'rows':[]};var _0x4b0a23=_[_0xac4a('0x46')](db[_0xac4a('0x47')]['rawAttributes'],function(_0x30cc6f){return{'name':_0x30cc6f[_0xac4a('0x48')],'type':_0x30cc6f[_0xac4a('0x49')][_0xac4a('0x4a')]};});_0x1eabf1[_0xac4a('0x4b')]=_[_0xac4a('0x46')](_0x4b0a23,_0xac4a('0x2a'));_0x1eabf1[_0xac4a('0x4c')]=_[_0xac4a('0x4d')](_0x378335[_0xac4a('0x4c')]);_0x1eabf1[_0xac4a('0x4e')]=_[_0xac4a('0x4f')](_0x1eabf1[_0xac4a('0x4b')],_0x1eabf1[_0xac4a('0x4c')]);_0xeb83bc[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x1eabf1[_0xac4a('0x4b')],qs['fields'](_0x378335[_0xac4a('0x4c')][_0xac4a('0x51')]));_0xeb83bc[_0xac4a('0x50')]=_0xeb83bc[_0xac4a('0x50')]['length']?_0xeb83bc['attributes']:_0x1eabf1[_0xac4a('0x4b')];if(!_0x378335[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0xeb83bc[_0xac4a('0x22')]=qs[_0xac4a('0x22')](_0x378335[_0xac4a('0x4c')][_0xac4a('0x22')]);_0xeb83bc[_0xac4a('0x20')]=qs[_0xac4a('0x20')](_0x378335[_0xac4a('0x4c')][_0xac4a('0x20')]);}_0xeb83bc['order']=qs[_0xac4a('0x54')](_0x378335[_0xac4a('0x4c')][_0xac4a('0x54')]);_0xeb83bc[_0xac4a('0x55')]=qs[_0xac4a('0x4e')](_['pick'](_0x378335[_0xac4a('0x4c')],_0x1eabf1[_0xac4a('0x4e')]),_0x4b0a23);if(_0x378335['query']['filter']){_0xeb83bc[_0xac4a('0x55')]=_['merge'](_0xeb83bc['where'],{'$or':_['map'](_0x4b0a23,function(_0x82180e){if(_0x82180e['type']!==_0xac4a('0x56')){var _0x34a8ca={};_0x34a8ca[_0x82180e[_0xac4a('0x2a')]]={'$like':'%'+_0x378335[_0xac4a('0x4c')][_0xac4a('0x57')]+'%'};return _0x34a8ca;}})});}_0xeb83bc=_[_0xac4a('0x58')]({},_0xeb83bc,_0x378335[_0xac4a('0x59')]);var _0x232a1c={'where':_0xeb83bc['where']};return db['MailAccount']['count'](_0x232a1c)[_0xac4a('0x13')](function(_0x2d0c3d){_0xe78ac9['count']=_0x2d0c3d;if(_0x378335[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0xeb83bc[_0xac4a('0x5b')]=[{'all':!![]}];}return db[_0xac4a('0x47')][_0xac4a('0x5c')](_0xeb83bc);})['then'](function(_0x3b598f){_0xe78ac9[_0xac4a('0x5d')]=_0x3b598f;return _0xe78ac9;})['then'](respondWithFilteredResult(_0x28aefa,_0xeb83bc))[_0xac4a('0x5e')](handleError(_0x28aefa,null));};exports[_0xac4a('0x5f')]=function(_0x5673c4,_0x5f34d4){var _0x21d61e={'raw':![],'where':{'id':_0x5673c4['params']['id']},'include':[{'model':db[_0xac4a('0x60')],'as':_0xac4a('0x43')},{'model':db[_0xac4a('0x61')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4e19d7={};_0x4e19d7[_0xac4a('0x4b')]=_[_0xac4a('0x4d')](db[_0xac4a('0x47')]['rawAttributes']);_0x4e19d7['query']=_['keys'](_0x5673c4[_0xac4a('0x4c')]);_0x4e19d7[_0xac4a('0x4e')]=_[_0xac4a('0x4f')](_0x4e19d7[_0xac4a('0x4b')],_0x4e19d7[_0xac4a('0x4c')]);_0x21d61e[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x4e19d7['model'],qs[_0xac4a('0x51')](_0x5673c4[_0xac4a('0x4c')]['fields']));_0x21d61e[_0xac4a('0x50')]=_0x21d61e[_0xac4a('0x50')][_0xac4a('0x62')]?_0x21d61e[_0xac4a('0x50')]:_0x4e19d7['model'];if(_0x5673c4[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0x21d61e[_0xac4a('0x5b')]=[{'all':!![]}];}_0x21d61e=_[_0xac4a('0x58')]({},_0x21d61e,_0x5673c4[_0xac4a('0x59')]);return db[_0xac4a('0x47')][_0xac4a('0x63')](_0x21d61e)[_0xac4a('0x13')](handleEntityNotFound(_0x5f34d4,null))[_0xac4a('0x13')](respondWithResult(_0x5f34d4,null))[_0xac4a('0x5e')](handleError(_0x5f34d4,null));};exports['update']=function(_0x44e1c1,_0x337171){if(_0x44e1c1[_0xac4a('0x64')]['id']){delete _0x44e1c1[_0xac4a('0x64')]['id'];}var _0x472267=_0x44e1c1[_0xac4a('0x64')]['provider']==='custom'?null:_0x44e1c1[_0xac4a('0x64')]['provider'];var _0x3483cc=_0x44e1c1[_0xac4a('0x64')]['Imap']||{};var _0x542204=_0x44e1c1[_0xac4a('0x64')]['Smtp']||{};if(_0x472267){_0x3483cc[_0xac4a('0x3e')]=getImapHost(_0x472267);_0x3483cc[_0xac4a('0x3f')]=0x3e1;_0x542204[_0xac4a('0x3e')]=getSmtpHost(_0x472267);_0x542204[_0xac4a('0x3f')]=0x24b;_0x542204[_0xac4a('0x40')]=![];}if(_0x542204[_0xac4a('0x3c')]){_0x542204['secure']=![];}else{_0x542204[_0xac4a('0x3d')]=null;}if(!_0x3483cc['modernAuthentication'])_0x3483cc[_0xac4a('0x3d')]=null;_0x44e1c1[_0xac4a('0x64')][_0xac4a('0x43')]=_0x3483cc;_0x44e1c1[_0xac4a('0x64')]['Smtp']=_0x542204;return db[_0xac4a('0x47')][_0xac4a('0x63')]({'where':{'id':_0x44e1c1[_0xac4a('0x65')]['id']},'include':[{'model':db[_0xac4a('0x60')],'as':'Imap'},{'model':db[_0xac4a('0x61')],'as':_0xac4a('0x44')},{'model':db[_0xac4a('0x66')],'as':'mandatoryDispositionPause'}]})[_0xac4a('0x13')](handleEntityNotFound(_0x337171,null))[_0xac4a('0x13')](function(_0x2bf289){if(!_0x2bf289)throw new Error(_0xac4a('0x67'));if(_0x2bf289['service'])delete _0x44e1c1['body'][_0xac4a('0x43')];return _0x2bf289;})[_0xac4a('0x13')](saveUpdates(_0x44e1c1[_0xac4a('0x64')],null))[_0xac4a('0x13')](function(_0x40f2a1){if(!_0x44e1c1[_0xac4a('0x64')][_0xac4a('0x43')])return _0x40f2a1;return db[_0xac4a('0x60')][_0xac4a('0x25')](_0x44e1c1[_0xac4a('0x64')][_0xac4a('0x43')],{'where':{'MailAccountId':_0x40f2a1['id']}})[_0xac4a('0x13')](function(){return _0x40f2a1;});})[_0xac4a('0x13')](function(_0x172a75){if(!_0x44e1c1[_0xac4a('0x64')][_0xac4a('0x44')])return _0x172a75;return db['MailServerOut']['update'](_0x44e1c1[_0xac4a('0x64')][_0xac4a('0x44')],{'where':{'MailAccountId':_0x172a75['id']}})[_0xac4a('0x13')](function(){return _0x172a75;});})[_0xac4a('0x13')](respondWithResult(_0x337171,null))['catch'](handleError(_0x337171,null));};exports['describe']=function(_0x582f03,_0x47efdb){return db[_0xac4a('0x47')][_0xac4a('0x68')]()[_0xac4a('0x13')](respondWithResult(_0x47efdb,null))[_0xac4a('0x5e')](handleError(_0x47efdb,null));};exports[_0xac4a('0x69')]=function(_0xf8c72e,_0x2575af){if(_0xf8c72e['body']['id']){delete _0xf8c72e[_0xac4a('0x64')]['id'];}return db[_0xac4a('0x47')][_0xac4a('0x63')]({'where':{'id':_0xf8c72e['params']['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x2575af,null))[_0xac4a('0x13')](function(_0x491a83){if(_0x491a83){_0xf8c72e[_0xac4a('0x64')]['MailAccountId']=_0x491a83['id'];return db[_0xac4a('0x6a')]['create'](_0xf8c72e[_0xac4a('0x64')]);}})[_0xac4a('0x13')](respondWithResult(_0x2575af,null))[_0xac4a('0x5e')](handleError(_0x2575af,null));};exports['getDispositions']=function(_0xa835fb,_0x4a8284){var _0x344a5e={'raw':![],'where':{}};var _0x316bac={};var _0x5101c3={'count':0x0,'rows':[]};return db['MailAccount'][_0xac4a('0x6b')]({'where':{'id':_0xa835fb[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x4a8284,null))[_0xac4a('0x13')](function(_0x6a3b91){if(_0x6a3b91){_0x316bac['model']=_[_0xac4a('0x4d')](db[_0xac4a('0x6a')][_0xac4a('0x6c')]);_0x316bac[_0xac4a('0x4c')]=_[_0xac4a('0x4d')](_0xa835fb[_0xac4a('0x4c')]);_0x316bac[_0xac4a('0x4e')]=_['intersection'](_0x316bac[_0xac4a('0x4b')],_0x316bac[_0xac4a('0x4c')]);_0x344a5e[_0xac4a('0x50')]=_['intersection'](_0x316bac[_0xac4a('0x4b')],qs[_0xac4a('0x51')](_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x51')]));_0x344a5e[_0xac4a('0x50')]=_0x344a5e[_0xac4a('0x50')][_0xac4a('0x62')]?_0x344a5e[_0xac4a('0x50')]:_0x316bac[_0xac4a('0x4b')];if(!_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0x344a5e[_0xac4a('0x22')]=qs['limit'](_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x22')]);_0x344a5e[_0xac4a('0x20')]=qs['offset'](_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x20')]);}_0x344a5e[_0xac4a('0x6d')]=qs['sort'](_0xa835fb[_0xac4a('0x4c')]['sort']);_0x344a5e[_0xac4a('0x55')]=qs[_0xac4a('0x4e')](_[_0xac4a('0x6e')](_0xa835fb[_0xac4a('0x4c')],_0x316bac[_0xac4a('0x4e')]));_0x344a5e['where']['MailAccountId']=_0x6a3b91['id'];if(_0xa835fb['query'][_0xac4a('0x57')]){_0x344a5e[_0xac4a('0x55')]=_[_0xac4a('0x58')](_0x344a5e[_0xac4a('0x55')],{'$or':_[_0xac4a('0x46')](_0x344a5e[_0xac4a('0x50')],function(_0x1beac9){var _0x344671={};_0x344671[_0x1beac9]={'$like':'%'+_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x57')]+'%'};return _0x344671;})});}_0x344a5e=_[_0xac4a('0x58')]({},_0x344a5e,_0xa835fb[_0xac4a('0x59')]);return db['Disposition']['count']({'where':_0x344a5e[_0xac4a('0x55')]})[_0xac4a('0x13')](function(_0x180520){_0x5101c3[_0xac4a('0x23')]=_0x180520;if(_0xa835fb[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0x344a5e['include']=[{'all':!![]}];}return db[_0xac4a('0x6a')][_0xac4a('0x5c')](_0x344a5e);})[_0xac4a('0x13')](function(_0xc10ca7){_0x5101c3[_0xac4a('0x5d')]=_0xc10ca7;return _0x5101c3;});}})[_0xac4a('0x13')](respondWithFilteredResult(_0x4a8284,_0x344a5e))['catch'](handleError(_0x4a8284,null));};exports[_0xac4a('0x6f')]=function(_0x20d42c,_0x43f721){return db['MailAccount'][_0xac4a('0x63')]({'where':{'id':_0x20d42c[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x43f721,null))['then'](function(_0x5dd5c6){if(_0x5dd5c6){return _0x5dd5c6['removeDispositions'](_0x20d42c['query']['ids']);}})[_0xac4a('0x13')](respondWithStatusCode(_0x43f721,null))['catch'](handleError(_0x43f721,null));};exports['addAnswer']=function(_0x994557,_0x5d8d35){if(_0x994557[_0xac4a('0x64')]['id']){delete _0x994557[_0xac4a('0x64')]['id'];}return db['MailAccount'][_0xac4a('0x63')]({'where':{'id':_0x994557[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x5d8d35,null))[_0xac4a('0x13')](function(_0x4df1b0){if(_0x4df1b0){_0x994557['body']['MailAccountId']=_0x4df1b0['id'];return db[_0xac4a('0x70')]['create'](_0x994557[_0xac4a('0x64')]);}})[_0xac4a('0x13')](respondWithResult(_0x5d8d35,null))[_0xac4a('0x5e')](handleError(_0x5d8d35,null));};exports[_0xac4a('0x71')]=function(_0x37c72a,_0x3c52d6){var _0x3e91b8={'raw':![],'where':{}};var _0x5c3a50={};var _0x114532={'count':0x0,'rows':[]};return db[_0xac4a('0x47')]['findOne']({'where':{'id':_0x37c72a['params']['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x3c52d6,null))[_0xac4a('0x13')](function(_0x4fc2a9){if(_0x4fc2a9){_0x5c3a50[_0xac4a('0x4b')]=_['keys'](db[_0xac4a('0x70')]['rawAttributes']);_0x5c3a50['query']=_[_0xac4a('0x4d')](_0x37c72a[_0xac4a('0x4c')]);_0x5c3a50[_0xac4a('0x4e')]=_['intersection'](_0x5c3a50[_0xac4a('0x4b')],_0x5c3a50['query']);_0x3e91b8[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x5c3a50[_0xac4a('0x4b')],qs[_0xac4a('0x51')](_0x37c72a[_0xac4a('0x4c')][_0xac4a('0x51')]));_0x3e91b8[_0xac4a('0x50')]=_0x3e91b8['attributes'][_0xac4a('0x62')]?_0x3e91b8[_0xac4a('0x50')]:_0x5c3a50[_0xac4a('0x4b')];if(!_0x37c72a[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0x3e91b8[_0xac4a('0x22')]=qs[_0xac4a('0x22')](_0x37c72a[_0xac4a('0x4c')][_0xac4a('0x22')]);_0x3e91b8[_0xac4a('0x20')]=qs[_0xac4a('0x20')](_0x37c72a[_0xac4a('0x4c')]['offset']);}_0x3e91b8[_0xac4a('0x6d')]=qs[_0xac4a('0x54')](_0x37c72a[_0xac4a('0x4c')]['sort']);_0x3e91b8[_0xac4a('0x55')]=qs['filters'](_['pick'](_0x37c72a[_0xac4a('0x4c')],_0x5c3a50[_0xac4a('0x4e')]));_0x3e91b8[_0xac4a('0x55')][_0xac4a('0x72')]=_0x4fc2a9['id'];if(_0x37c72a[_0xac4a('0x4c')][_0xac4a('0x57')]){_0x3e91b8[_0xac4a('0x55')]=_[_0xac4a('0x58')](_0x3e91b8[_0xac4a('0x55')],{'$or':_[_0xac4a('0x46')](_0x3e91b8['attributes'],function(_0x5286f4){var _0x2bb213={};_0x2bb213[_0x5286f4]={'$like':'%'+_0x37c72a[_0xac4a('0x4c')]['filter']+'%'};return _0x2bb213;})});}_0x3e91b8=_['merge']({},_0x3e91b8,_0x37c72a[_0xac4a('0x59')]);return db[_0xac4a('0x70')][_0xac4a('0x23')]({'where':_0x3e91b8[_0xac4a('0x55')]})[_0xac4a('0x13')](function(_0x215d10){_0x114532[_0xac4a('0x23')]=_0x215d10;if(_0x37c72a[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0x3e91b8[_0xac4a('0x5b')]=[{'all':!![]}];}return db[_0xac4a('0x70')][_0xac4a('0x5c')](_0x3e91b8);})[_0xac4a('0x13')](function(_0x52bf63){_0x114532[_0xac4a('0x5d')]=_0x52bf63;return _0x114532;});}})[_0xac4a('0x13')](respondWithFilteredResult(_0x3c52d6,_0x3e91b8))[_0xac4a('0x5e')](handleError(_0x3c52d6,null));};exports[_0xac4a('0x73')]=function(_0x5c35f6,_0x3340cd){return db[_0xac4a('0x47')][_0xac4a('0x63')]({'where':{'id':_0x5c35f6[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x3340cd,null))['then'](function(_0x5f5b17){if(_0x5f5b17){return _0x5f5b17['removeAnswers'](_0x5c35f6[_0xac4a('0x4c')][_0xac4a('0x74')]);}})[_0xac4a('0x13')](respondWithStatusCode(_0x3340cd,null))['catch'](handleError(_0x3340cd,null));};exports[_0xac4a('0x75')]=function(_0x118b02,_0x108803){var _0x1b1632={'name':_0x118b02[_0xac4a('0x64')][_0xac4a('0x2a')],'key':_0x118b02['body'][_0xac4a('0x4a')],'provider':_0x118b02[_0xac4a('0x64')][_0xac4a('0x76')]===_0xac4a('0x77')?null:_0x118b02[_0xac4a('0x64')][_0xac4a('0x76')],'email':_0x118b02[_0xac4a('0x64')]['email'],'ListId':_0x118b02['body']['ListId'],'active':!_[_0xac4a('0x78')](_0x118b02[_0xac4a('0x64')][_0xac4a('0x79')])?_0x118b02[_0xac4a('0x64')][_0xac4a('0x79')]:!![],'description':_0x118b02[_0xac4a('0x64')][_0xac4a('0x7a')]||null};var _0x4e15a8=getAuthenticationOptions(_0x1b1632[_0xac4a('0x76')],_0x118b02[_0xac4a('0x64')]);_0x1b1632['Imap']=_0x4e15a8[_0xac4a('0x43')];_0x1b1632[_0xac4a('0x44')]=_0x4e15a8[_0xac4a('0x44')];return db[_0xac4a('0x47')]['create'](_0x1b1632,{'include':[{'model':db[_0xac4a('0x61')],'as':_0xac4a('0x44')},{'model':db[_0xac4a('0x60')],'as':_0xac4a('0x43')}]})[_0xac4a('0x13')](function(_0x5e6be7){var _0x3ddf0a=_0x118b02['user'][_0xac4a('0x27')]({'plain':!![]});if(!_0x3ddf0a)throw new Error(_0xac4a('0x7b'));if(_0x3ddf0a[_0xac4a('0x7c')]===_0xac4a('0x38')){var _0x457cdc=_0x5e6be7[_0xac4a('0x27')]({'plain':!![]});return db[_0xac4a('0x7d')][_0xac4a('0x63')]({'where':{'name':_0xac4a('0x7e'),'userProfileId':_0x3ddf0a[_0xac4a('0x7f')]},'raw':!![]})[_0xac4a('0x13')](function(_0xda64c3){if(_0xda64c3&&_0xda64c3[_0xac4a('0x80')]===0x0){return db[_0xac4a('0x28')][_0xac4a('0x75')]({'name':_0x457cdc[_0xac4a('0x2a')],'resourceId':_0x457cdc['id'],'type':_0xda64c3[_0xac4a('0x2a')],'sectionId':_0xda64c3['id']},{})[_0xac4a('0x13')](function(){return _0x5e6be7;});}else{return _0x5e6be7;}})[_0xac4a('0x5e')](function(_0x5404e7){logger[_0xac4a('0x17')](_0xac4a('0x81'),_0x5404e7);throw _0x5404e7;});}return _0x5e6be7;})[_0xac4a('0x13')](respondWithResult(_0x108803,0xc9))[_0xac4a('0x5e')](handleError(_0x108803,null));};exports[_0xac4a('0x82')]=function(_0x90e815,_0x411649){return db['MailAccount'][_0xac4a('0x6b')]({'where':{'id':_0x90e815[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x411649,null))[_0xac4a('0x13')](function(_0x405048){if(_0x405048){return _0x405048[_0xac4a('0x82')]();}return null;})['then'](respondWithResult(_0x411649,null))[_0xac4a('0x5e')](handleError(_0x411649,null));};exports[_0xac4a('0x83')]=function(_0x556069,_0x152f5b){if(_0x556069[_0xac4a('0x64')]['id']){delete _0x556069['body']['id'];}return db['MailAccount'][_0xac4a('0x63')]({'where':{'id':_0x556069[_0xac4a('0x65')]['id']}})['then'](handleEntityNotFound(_0x152f5b,null))[_0xac4a('0x13')](function(_0x2ae9b1){if(_0x2ae9b1){_0x556069[_0xac4a('0x64')][_0xac4a('0x72')]=_0x2ae9b1['id'];return db[_0xac4a('0x60')][_0xac4a('0x75')](_0x556069[_0xac4a('0x64')]);}})[_0xac4a('0x13')](respondWithResult(_0x152f5b,null))[_0xac4a('0x5e')](handleError(_0x152f5b,null));};exports[_0xac4a('0x84')]=function(_0x277810,_0x48932d){return db[_0xac4a('0x47')][_0xac4a('0x6b')]({'where':{'id':_0x277810[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x48932d,null))['then'](function(_0x3c94f0){if(_0x3c94f0){return _0x3c94f0[_0xac4a('0x85')](null);}return null;})[_0xac4a('0x13')](respondWithStatusCode(_0x48932d,null))['catch'](handleError(_0x48932d,null));};exports[_0xac4a('0x86')]=function(_0x171ccf,_0x372421){return db[_0xac4a('0x47')][_0xac4a('0x6b')]({'where':{'id':_0x171ccf[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x372421,null))[_0xac4a('0x13')](function(_0x2299e8){if(_0x2299e8){return _0x2299e8[_0xac4a('0x86')]();}return null;})[_0xac4a('0x13')](respondWithResult(_0x372421,null))[_0xac4a('0x5e')](handleError(_0x372421,null));};exports[_0xac4a('0x87')]=function(_0x4729d9,_0x144056){if(_0x4729d9[_0xac4a('0x64')]['id']){delete _0x4729d9[_0xac4a('0x64')]['id'];}return db[_0xac4a('0x47')][_0xac4a('0x63')]({'where':{'id':_0x4729d9[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x144056,null))['then'](function(_0x1ae39a){if(_0x1ae39a){_0x4729d9[_0xac4a('0x64')][_0xac4a('0x72')]=_0x1ae39a['id'];return db[_0xac4a('0x61')]['create'](_0x4729d9[_0xac4a('0x64')]);}})[_0xac4a('0x13')](respondWithResult(_0x144056,null))[_0xac4a('0x5e')](handleError(_0x144056,null));};exports[_0xac4a('0x88')]=function(_0x58dcd8,_0x17dc70){return db['MailAccount'][_0xac4a('0x6b')]({'where':{'id':_0x58dcd8[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x17dc70,null))['then'](function(_0x4dfc4b){if(_0x4dfc4b){return _0x4dfc4b['setSmtp'](null);}return null;})[_0xac4a('0x13')](respondWithStatusCode(_0x17dc70,null))[_0xac4a('0x5e')](handleError(_0x17dc70,null));};exports['addInteraction']=function(_0x3f64e5,_0x5a474d){return db[_0xac4a('0x89')][_0xac4a('0x63')]({'where':{'id':_0x3f64e5[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x5a474d,null))[_0xac4a('0x13')](function(_0x249ffb){if(_0x249ffb){return _0x249ffb[_0xac4a('0x8a')](_0x3f64e5[_0xac4a('0x64')][_0xac4a('0x74')],_['omit'](_0x3f64e5[_0xac4a('0x64')],[_0xac4a('0x74'),'id'])||{});}})[_0xac4a('0x13')](respondWithResult(_0x5a474d,null))[_0xac4a('0x5e')](handleError(_0x5a474d,null));};exports[_0xac4a('0x8b')]=function(_0x2d4018,_0x3eaa8b){var _0x5e260c={'raw':![],'where':{}};var _0x11d62a={};var _0x3c7f83={'count':0x0,'rows':[]};return db[_0xac4a('0x47')][_0xac4a('0x6b')]({'where':{'id':_0x2d4018[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x3eaa8b,null))[_0xac4a('0x13')](function(_0x5c831c){if(_0x5c831c){_0x11d62a['model']=_[_0xac4a('0x4d')](db[_0xac4a('0x89')][_0xac4a('0x6c')]);_0x11d62a['query']=_[_0xac4a('0x4d')](_0x2d4018[_0xac4a('0x4c')]);_0x11d62a['filters']=_['intersection'](_0x11d62a['model'],_0x11d62a[_0xac4a('0x4c')]);_0x5e260c[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x11d62a['model'],qs['fields'](_0x2d4018[_0xac4a('0x4c')]['fields']));_0x5e260c[_0xac4a('0x50')]=_0x5e260c[_0xac4a('0x50')][_0xac4a('0x62')]?_0x5e260c[_0xac4a('0x50')]:_0x11d62a[_0xac4a('0x4b')];if(!_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0x5e260c[_0xac4a('0x22')]=qs[_0xac4a('0x22')](_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x22')]);_0x5e260c[_0xac4a('0x20')]=qs[_0xac4a('0x20')](_0x2d4018[_0xac4a('0x4c')]['offset']);}_0x5e260c['order']=qs[_0xac4a('0x54')](_0x2d4018[_0xac4a('0x4c')]['sort']);_0x5e260c['where']=qs[_0xac4a('0x4e')](_[_0xac4a('0x6e')](_0x2d4018[_0xac4a('0x4c')],_0x11d62a[_0xac4a('0x4e')]));_0x5e260c[_0xac4a('0x55')][_0xac4a('0x72')]=_0x5c831c['id'];if(_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x57')]){_0x5e260c['where']=_[_0xac4a('0x58')](_0x5e260c['where'],{'$or':_[_0xac4a('0x46')](_0x5e260c[_0xac4a('0x50')],function(_0x5e9c61){var _0x42b1bb={};_0x42b1bb[_0x5e9c61]={'$like':'%'+_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x57')]+'%'};return _0x42b1bb;})});}_0x5e260c=_[_0xac4a('0x58')]({},_0x5e260c,_0x2d4018[_0xac4a('0x59')]);return db[_0xac4a('0x89')]['count']({'where':_0x5e260c[_0xac4a('0x55')]})[_0xac4a('0x13')](function(_0x52124f){_0x3c7f83[_0xac4a('0x23')]=_0x52124f;if(_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0x5e260c[_0xac4a('0x5b')]=[{'model':db[_0xac4a('0x8c')],'as':_0xac4a('0x8d'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xac4a('0x2a'),_0xac4a('0x8e'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xac4a('0x8f'),'attributes':['id','name',_0xac4a('0x90')],'where':_0x2d4018[_0xac4a('0x4c')]['tag']?{'id':_0x2d4018['query'][_0xac4a('0x91')]}:undefined,'required':_0x2d4018[_0xac4a('0x4c')][_0xac4a('0x91')]?!![]:![]}];}return db[_0xac4a('0x89')][_0xac4a('0x5c')](_0x5e260c);})[_0xac4a('0x13')](function(_0x4d2736){_0x3c7f83[_0xac4a('0x5d')]=_0x4d2736;return _0x3c7f83;});}})[_0xac4a('0x13')](respondWithFilteredResult(_0x3eaa8b,_0x5e260c))[_0xac4a('0x5e')](handleError(_0x3eaa8b,null));};exports[_0xac4a('0x92')]=function addApplications(_0x38c577,_0x34e43d){var _0xb70835=_0x38c577[_0xac4a('0x65')]['id'];var _0x3968c6=_0x38c577[_0xac4a('0x64')];var _0x42a0e4=0xc8;var _0x147d34=null;return db[_0xac4a('0x93')][_0xac4a('0x94')]({'isolationLevel':db[_0xac4a('0x93')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x272bac){return db[_0xac4a('0x47')][_0xac4a('0x6b')]({'where':{'id':_0xb70835},'transaction':_0x272bac})[_0xac4a('0x13')](function(_0x261acc){if(_0x261acc){return db[_0xac4a('0x95')][_0xac4a('0x26')]({'where':{'MailAccountId':_0xb70835},'transaction':_0x272bac})[_0xac4a('0x13')](function(){var _0x3def33=_[_0xac4a('0x46')](_0x3968c6,function(_0x567802){_0x567802['MailAccountId']=_0xb70835;return _0x567802;});return db['MailApplication'][_0xac4a('0x96')](_0x3def33,{'transaction':_0x272bac});});}else{_0x42a0e4=0x194;_0x147d34=[];}});})[_0xac4a('0x13')](function(){if(_0x42a0e4!==0x194){return db[_0xac4a('0x95')][_0xac4a('0x97')]({'where':{'MailAccountId':_0xb70835},'order':'priority'})[_0xac4a('0x13')](function(_0x509cf8){_0x147d34=_0x509cf8;});}})[_0xac4a('0x5e')](function(_0x3a16bf){_0x42a0e4=0x1f4;logger[_0xac4a('0x17')](_0x3a16bf[_0xac4a('0x98')]);if(_0x3a16bf[_0xac4a('0x2a')]){delete _0x3a16bf[_0xac4a('0x2a')];}_0x147d34=_0x3a16bf;})['finally'](function(){if(_0x147d34===null){_0x34e43d[_0xac4a('0x29')](_0x42a0e4);}else{if(_0x42a0e4===0x1f4){_0x34e43d[_0xac4a('0x1d')](_0x42a0e4)['send'](_0x147d34);}else{_0x34e43d[_0xac4a('0x1d')](_0x42a0e4)[_0xac4a('0x1f')](_0x147d34);}}});};exports[_0xac4a('0x99')]=function(_0x1bd2de,_0x214539){var _0x281fe6={};var _0x512755={};var _0x378c01;var _0x190b88;return db[_0xac4a('0x47')][_0xac4a('0x6b')]({'where':{'id':_0x1bd2de[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x214539,null))[_0xac4a('0x13')](function(_0x3aa64a){if(_0x3aa64a){_0x378c01=_0x3aa64a;_0x512755[_0xac4a('0x4b')]=_[_0xac4a('0x4d')](db['MailApplication']['rawAttributes']);_0x512755[_0xac4a('0x4c')]=_['keys'](_0x1bd2de[_0xac4a('0x4c')]);_0x512755['filters']=_[_0xac4a('0x4f')](_0x512755[_0xac4a('0x4b')],_0x512755['query']);_0x281fe6['attributes']=_['intersection'](_0x512755['model'],qs['fields'](_0x1bd2de[_0xac4a('0x4c')][_0xac4a('0x51')]));_0x281fe6['attributes']=_0x281fe6[_0xac4a('0x50')]['length']?_0x281fe6[_0xac4a('0x50')]:_0x512755['model'];_0x281fe6[_0xac4a('0x6d')]=qs[_0xac4a('0x54')](_0x1bd2de['query'][_0xac4a('0x54')]);_0x281fe6[_0xac4a('0x55')]=qs[_0xac4a('0x4e')](_[_0xac4a('0x6e')](_0x1bd2de['query'],_0x512755[_0xac4a('0x4e')]));if(_0x1bd2de[_0xac4a('0x4c')][_0xac4a('0x57')]){_0x281fe6[_0xac4a('0x55')]=_[_0xac4a('0x58')](_0x281fe6[_0xac4a('0x55')],{'$or':_[_0xac4a('0x46')](_0x281fe6[_0xac4a('0x50')],function(_0x341f4a){var _0x15f01d={};_0x15f01d[_0x341f4a]={'$like':'%'+_0x1bd2de[_0xac4a('0x4c')][_0xac4a('0x57')]+'%'};return _0x15f01d;})});}_0x281fe6=_[_0xac4a('0x58')]({},_0x281fe6,_0x1bd2de[_0xac4a('0x59')]);return _0x378c01[_0xac4a('0x99')](_0x281fe6);}})[_0xac4a('0x13')](function(_0x2c5517){if(_0x2c5517){_0x190b88=_0x2c5517[_0xac4a('0x62')];if(!_0x1bd2de[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0x281fe6[_0xac4a('0x22')]=qs[_0xac4a('0x22')](_0x1bd2de[_0xac4a('0x4c')][_0xac4a('0x22')]);_0x281fe6[_0xac4a('0x20')]=qs[_0xac4a('0x20')](_0x1bd2de['query'][_0xac4a('0x20')]);}return _0x378c01[_0xac4a('0x99')](_0x281fe6);}})['then'](function(_0x1425b2){if(_0x1425b2){return _0x1425b2?{'count':_0x190b88,'rows':_0x1425b2}:null;}})[_0xac4a('0x13')](respondWithResult(_0x214539,null))[_0xac4a('0x5e')](handleError(_0x214539,null));};exports[_0xac4a('0x9a')]=function(_0x3825f3,_0x25c0e4){var _0x5aa6bc={'raw':!![],'where':{}};var _0x427d1f={};var _0x5bd0ad={'count':0x0,'rows':[]};return db[_0xac4a('0x47')]['findOne']({'where':{'id':_0x3825f3[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x25c0e4,null))[_0xac4a('0x13')](function(_0x182c92){if(_0x182c92){_0x427d1f[_0xac4a('0x4b')]=_[_0xac4a('0x4d')](db[_0xac4a('0x9b')][_0xac4a('0x6c')]);_0x427d1f['query']=_[_0xac4a('0x4d')](_0x3825f3[_0xac4a('0x4c')]);_0x427d1f['filters']=_['intersection'](_0x427d1f[_0xac4a('0x4b')],_0x427d1f[_0xac4a('0x4c')]);_0x5aa6bc[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x427d1f[_0xac4a('0x4b')],qs[_0xac4a('0x51')](_0x3825f3[_0xac4a('0x4c')]['fields']));_0x5aa6bc[_0xac4a('0x50')]=_0x5aa6bc[_0xac4a('0x50')][_0xac4a('0x62')]?_0x5aa6bc[_0xac4a('0x50')]:_0x427d1f[_0xac4a('0x4b')];if(!_0x3825f3[_0xac4a('0x4c')][_0xac4a('0x52')](_0xac4a('0x53'))){_0x5aa6bc[_0xac4a('0x22')]=qs[_0xac4a('0x22')](_0x3825f3['query'][_0xac4a('0x22')]);_0x5aa6bc[_0xac4a('0x20')]=qs[_0xac4a('0x20')](_0x3825f3[_0xac4a('0x4c')][_0xac4a('0x20')]);}_0x5aa6bc['order']=qs[_0xac4a('0x54')](_0x3825f3['query'][_0xac4a('0x54')]);_0x5aa6bc[_0xac4a('0x55')]=qs[_0xac4a('0x4e')](_['pick'](_0x3825f3[_0xac4a('0x4c')],_0x427d1f[_0xac4a('0x4e')]));_0x5aa6bc['where']['MailAccountId']=_0x182c92['id'];if(_0x3825f3['query'][_0xac4a('0x57')]){_0x5aa6bc[_0xac4a('0x55')]=_[_0xac4a('0x58')](_0x5aa6bc[_0xac4a('0x55')],{'$or':_['map'](_0x5aa6bc[_0xac4a('0x50')],function(_0x43bc28){var _0x333f8c={};_0x333f8c[_0x43bc28]={'$like':'%'+_0x3825f3[_0xac4a('0x4c')]['filter']+'%'};return _0x333f8c;})});}if(_0x3825f3[_0xac4a('0x4c')][_0xac4a('0x9c')]){var _0x5ac0e7=_0x3825f3[_0xac4a('0x4c')][_0xac4a('0x9c')][_0xac4a('0x9d')](',');var _0x233cb8={};_0x233cb8[_0x5ac0e7[0x0]]={'$gte':moment(_0x5ac0e7[0x1])[_0xac4a('0x9e')](_0xac4a('0x9f'))};_0x5aa6bc[_0xac4a('0x55')]=_[_0xac4a('0x58')](_0x5aa6bc['where'],_0x233cb8);}_0x5aa6bc=_[_0xac4a('0x58')]({},_0x5aa6bc,_0x3825f3[_0xac4a('0x59')]);return db[_0xac4a('0x9b')][_0xac4a('0x23')]({'where':_0x5aa6bc['where']})[_0xac4a('0x13')](function(_0x18decb){_0x5bd0ad[_0xac4a('0x23')]=_0x18decb;if(_0x3825f3[_0xac4a('0x4c')][_0xac4a('0x5a')]){_0x5aa6bc[_0xac4a('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0xac4a('0x5c')](_0x5aa6bc);})['then'](function(_0x4338c3){if(_0x3825f3[_0xac4a('0x4c')][_0xac4a('0xa0')]==='true'){for(var _0x210fe1=0x0;_0x210fe1<_0x4338c3[_0xac4a('0x62')];_0x210fe1++){_0x4338c3[_0x210fe1][_0xac4a('0x64')]=juice(_0x4338c3[_0x210fe1]['body']);}}_0x5bd0ad[_0xac4a('0x5d')]=_0x4338c3;return _0x5bd0ad;});}})['then'](respondWithFilteredResult(_0x25c0e4,_0x5aa6bc))[_0xac4a('0x5e')](handleError(_0x25c0e4,null));};exports[_0xac4a('0x2b')]=function(_0x220804,_0x457603){var _0x349007,_0x1370a5={},_0x2a873f;if(_0x220804[_0xac4a('0x64')]['to']){_0x2a873f=_0x220804[_0xac4a('0x64')]['to'][_0xac4a('0x9d')](',')[0x0];}return db['MailAccount'][_0xac4a('0x63')]({'where':{'id':_0x220804['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xac4a('0xa1'),'where':{'email':_0x2a873f},'limit':0x1,'order':[['updatedAt',_0xac4a('0xa2')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xac4a('0xa3')],'as':_0xac4a('0xa3'),'raw':!![]}]}]})[_0xac4a('0x13')](handleEntityNotFound(_0x457603,null))[_0xac4a('0x13')](function(_0x484a11){if(!_0x484a11)return;_0x349007=_0x484a11;if(!_0x484a11[_0xac4a('0x44')])throw new Error(_0xac4a('0xa4'));if(_['isNil'](_0x220804[_0xac4a('0x64')][_0xac4a('0xa5')])){_0x220804[_0xac4a('0x64')][_0xac4a('0xa5')]=util['format'](_0xac4a('0xa6'),_0x484a11[_0xac4a('0x2a')],_0x484a11[_0xac4a('0xa7')]||_0x484a11[_0xac4a('0x44')]['user']);}if(_0x220804['body'][_0xac4a('0xa8')]&&_0x220804[_0xac4a('0x64')]['attachments']['length']){for(var _0x5befcd=0x0;_0x5befcd<_0x220804[_0xac4a('0x64')][_0xac4a('0xa8')][_0xac4a('0x62')];_0x5befcd+=0x1){_0x220804[_0xac4a('0x64')][_0xac4a('0xa8')][_0x5befcd]={'filename':_0x220804['body'][_0xac4a('0xa8')][_0x5befcd][_0xac4a('0x2a')],'path':path[_0xac4a('0xa9')](config[_0xac4a('0xaa')],_0xac4a('0xab'),_0x220804[_0xac4a('0x64')][_0xac4a('0xa8')][_0x5befcd][_0xac4a('0xac')])};}}var _0x254eb3=_0x484a11['getSmtpOptions']();return respondWithRpcPromise(_0xac4a('0xad'),_0xac4a('0xae'),{'account':_0x254eb3,'message':_0x220804[_0xac4a('0x64')]});})[_0xac4a('0x13')](function(_0x481d99){if(!_0x481d99)return;_0x1370a5=_0x481d99;if(!_0x349007[_0xac4a('0xaf')])throw new Error('List\x20not\x20found');if(_0x349007['List'][_0xac4a('0xa1')][_0xac4a('0x62')])return _0x349007[_0xac4a('0xaf')][_0xac4a('0xa1')][0x0];return db[_0xac4a('0x8c')][_0xac4a('0x75')](_['defaults'](_0x220804['body'],{'firstName':_0x220804['body']['to'],'email':_0x220804[_0xac4a('0x64')]['to'],'phone':_0x220804['body']['to'],'ListId':_0x349007[_0xac4a('0xb0')]}));})[_0xac4a('0x13')](function(_0x44a411){if(!_0x44a411)return;var _0x2ec7a7={'UserId':_0x220804[_0xac4a('0x38')]['id'],'ContactId':_0x44a411['id'],'MailAccountId':_0x349007['id'],'inReplyTo':_0x1370a5[_0xac4a('0xb1')],'to':_0x220804[_0xac4a('0x64')][_0xac4a('0xa5')],'cc':_0x220804[_0xac4a('0x64')]['cc'],'subject':_0x220804[_0xac4a('0x64')][_0xac4a('0xb2')],'attach':_0x220804[_0xac4a('0x64')][_0xac4a('0xb3')],'firstMsgDirection':_0xac4a('0xb4'),'lastMsgAt':moment()[_0xac4a('0x9e')](_0xac4a('0x9f')),'lastMsgDirection':_0xac4a('0xb4'),'Messages':[_[_0xac4a('0x58')](_0x220804[_0xac4a('0x64')],{'messageId':_0x1370a5[_0xac4a('0xb1')],'sentAt':moment()['format'](_0xac4a('0x9f')),'read':!![],'MailAccountId':_0x349007['id'],'UserId':_0x220804['user']['id'],'ContactId':_0x44a411['id']})]};if(_0x220804[_0xac4a('0x64')][_0xac4a('0xb5')]){_0x2ec7a7=_[_0xac4a('0x58')](_0x2ec7a7,_0x220804['body'][_0xac4a('0xb5')]);}return db['MailInteraction'][_0xac4a('0x75')](_0x2ec7a7,{'include':[{'model':db[_0xac4a('0x9b')],'as':'Messages'}]});})[_0xac4a('0x13')](respondWithResult(_0x457603,null))[_0xac4a('0x5e')](handleError(_0x457603,null));};exports[_0xac4a('0xb6')]=function(_0xf1fb65,_0x1bf7f3){return db[_0xac4a('0x47')][_0xac4a('0x63')]({'where':{'id':_0xf1fb65[_0xac4a('0x65')]['id']},'include':[{'model':db[_0xac4a('0x61')],'as':_0xac4a('0x44'),'raw':!![],'include':[{'model':db[_0xac4a('0xa3')],'as':_0xac4a('0xa3'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1bf7f3,null))[_0xac4a('0x13')](function(_0x483e68){if(!_0x483e68[_0xac4a('0x44')])return;var _0x38286c=_0x483e68[_0xac4a('0xb7')]();return respondWithRpcPromise(_0xac4a('0xb8'),'verifySmtp',{'account':_0x38286c});})[_0xac4a('0x13')](respondWithResult(_0x1bf7f3,null))[_0xac4a('0x5e')](handleError(_0x1bf7f3,null));};exports[_0xac4a('0x26')]=function(_0x2c37ab,_0x31de64){return db['MailAccount']['find']({'where':{'id':_0x2c37ab['params']['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x31de64,null))['then'](function(_0x511de6){if(_0x511de6&&_0x511de6[_0xac4a('0x41')]){throw new db[(_0xac4a('0xb9'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x511de6;})[_0xac4a('0x13')](removeEntity(_0x31de64,null))['catch'](handleError(_0x31de64,null));};exports[_0xac4a('0xba')]=function(_0x4810a6,_0x211475){return db['MailAccount']['find']({'where':{'id':_0x4810a6[_0xac4a('0x65')]['id']}})['then'](handleEntityNotFound(_0x211475,null))['then'](function(_0x1c0657){if(_0x1c0657){return _0x1c0657[_0xac4a('0xba')](_0x4810a6[_0xac4a('0x64')][_0xac4a('0x74')],_['omit'](_0x4810a6[_0xac4a('0x64')],[_0xac4a('0x74'),'id'])||{})[_0xac4a('0xbb')](function(_0x40debd){for(var _0x1e1ffb=0x0;_0x1e1ffb<_0x4810a6[_0xac4a('0x64')][_0xac4a('0x74')][_0xac4a('0x62')];_0x1e1ffb+=0x1){socket[_0xac4a('0xbc')](_0xac4a('0xbd'),{'UserId':Number(_0x4810a6[_0xac4a('0x64')][_0xac4a('0x74')][_0x1e1ffb]),'MailAccountId':Number(_0x4810a6[_0xac4a('0x65')]['id'])});}return _0x40debd;});}})[_0xac4a('0x13')](respondWithResult(_0x211475,null))['catch'](handleError(_0x211475,null));};exports[_0xac4a('0xbe')]=function(_0x52d2bb,_0x496cfc){return db[_0xac4a('0x47')]['find']({'where':{'id':_0x52d2bb[_0xac4a('0x65')]['id']}})['then'](handleEntityNotFound(_0x496cfc,null))[_0xac4a('0x13')](function(_0x319902){if(_0x319902){return _0x319902[_0xac4a('0xbe')](_0x52d2bb[_0xac4a('0x4c')][_0xac4a('0x74')])[_0xac4a('0x13')](function(){if(_[_0xac4a('0xbf')](_0x52d2bb['query']['ids'])){for(var _0x65d8c1=0x0;_0x65d8c1<_0x52d2bb['query'][_0xac4a('0x74')]['length'];_0x65d8c1+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x52d2bb[_0xac4a('0x4c')][_0xac4a('0x74')][_0x65d8c1]),'MailAccountId':Number(_0x52d2bb['params']['id'])});}}else{socket[_0xac4a('0xbc')](_0xac4a('0xc0'),{'UserId':Number(_0x52d2bb[_0xac4a('0x4c')][_0xac4a('0x74')]),'MailAccountId':Number(_0x52d2bb[_0xac4a('0x65')]['id'])});}});}})[_0xac4a('0x13')](respondWithStatusCode(_0x496cfc,null))[_0xac4a('0x5e')](handleError(_0x496cfc,null));};exports[_0xac4a('0xc1')]=function(_0x29b959,_0x872cb7){var _0x49cb45={};var _0x251153={};var _0x12098e;var _0x1d8247;return db[_0xac4a('0x47')]['findOne']({'where':{'id':_0x29b959[_0xac4a('0x65')]['id']}})[_0xac4a('0x13')](handleEntityNotFound(_0x872cb7,null))[_0xac4a('0x13')](function(_0x3ea6f2){if(_0x3ea6f2){_0x12098e=_0x3ea6f2;_0x251153[_0xac4a('0x4b')]=_[_0xac4a('0x4d')](db['User'][_0xac4a('0x6c')]);_0x251153[_0xac4a('0x4c')]=_[_0xac4a('0x4d')](_0x29b959[_0xac4a('0x4c')]);_0x251153[_0xac4a('0x4e')]=_[_0xac4a('0x4f')](_0x251153[_0xac4a('0x4b')],_0x251153[_0xac4a('0x4c')]);_0x49cb45[_0xac4a('0x50')]=_[_0xac4a('0x4f')](_0x251153[_0xac4a('0x4b')],qs[_0xac4a('0x51')](_0x29b959['query'][_0xac4a('0x51')]));_0x49cb45[_0xac4a('0x50')]=_0x49cb45[_0xac4a('0x50')][_0xac4a('0x62')]?_0x49cb45[_0xac4a('0x50')]:_0x251153[_0xac4a('0x4b')];_0x49cb45[_0xac4a('0x6d')]=qs['sort'](_0x29b959[_0xac4a('0x4c')][_0xac4a('0x54')]);_0x49cb45[_0xac4a('0x55')]=qs['filters'](_['pick'](_0x29b959['query'],_0x251153[_0xac4a('0x4e')]));if(_0x29b959[_0xac4a('0x4c')]['filter']){_0x49cb45[_0xac4a('0x55')]=_['merge'](_0x49cb45[_0xac4a('0x55')],{'$or':_[_0xac4a('0x46')](_0x49cb45[_0xac4a('0x50')],function(_0x12fd24){var _0x1caae3={};_0x1caae3[_0x12fd24]={'$like':'%'+_0x29b959[_0xac4a('0x4c')]['filter']+'%'};return _0x1caae3;})});}_0x49cb45=_[_0xac4a('0x58')]({},_0x49cb45,_0x29b959[_0xac4a('0x59')]);return _0x12098e[_0xac4a('0xc1')](_0x49cb45);}})[_0xac4a('0x13')](function(_0x57cbfa){if(_0x57cbfa){_0x1d8247=_0x57cbfa[_0xac4a('0x62')];if(!_0x29b959['query'][_0xac4a('0x52')](_0xac4a('0x53'))){_0x49cb45['limit']=qs['limit'](_0x29b959[_0xac4a('0x4c')][_0xac4a('0x22')]);_0x49cb45[_0xac4a('0x20')]=qs['offset'](_0x29b959[_0xac4a('0x4c')][_0xac4a('0x20')]);}return _0x12098e['getAgents'](_0x49cb45);}})[_0xac4a('0x13')](function(_0x3ae733){if(_0x3ae733){return _0x3ae733?{'count':_0x1d8247,'rows':_0x3ae733}:null;}})[_0xac4a('0x13')](respondWithResult(_0x872cb7,null))[_0xac4a('0x5e')](handleError(_0x872cb7,null));}; \ No newline at end of file +var _0x9ccb=['active','description','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','findOne','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','length','order','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp-mail.outlook.com','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','username','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','show','MailAccount','fields','merge','body','provider','params','describe','addDisposition','find','Disposition','getDispositions','rawAttributes','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','create','rows','removeAnswers','custom','ListId','isNil'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x9ccb,0x117));var _0xb9cc=function(_0x50d56f,_0x5cba9d){_0x50d56f=_0x50d56f-0x0;var _0x1dd8ca=_0x9ccb[_0x50d56f];return _0x1dd8ca;};'use strict';var moment=require(_0xb9cc('0x0'));var BPromise=require('bluebird');var util=require(_0xb9cc('0x1'));var path=require(_0xb9cc('0x2'));var _=require(_0xb9cc('0x3'));var juice=require(_0xb9cc('0x4'));var Redis=require('ioredis');var qs=require(_0xb9cc('0x5'));var logger=require(_0xb9cc('0x6'))(_0xb9cc('0x7'));var config=require('../../config/environment');var db=require(_0xb9cc('0x8'))['db'];config[_0xb9cc('0x9')]=_[_0xb9cc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9cc('0xb'))(new Redis(config[_0xb9cc('0x9')]));require(_0xb9cc('0xc'))[_0xb9cc('0xd')](socket);var jayson=require(_0xb9cc('0xe'));var client=jayson[_0xb9cc('0xf')][_0xb9cc('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5f200c,_0x37c7b6,_0x1b53a9,_0x679d18){return new BPromise(function(_0x125bb0,_0x1316bf){var _0x28cc82=_0x679d18||client;return _0x28cc82[_0xb9cc('0x11')](_0x5f200c,_0x1b53a9)[_0xb9cc('0x12')](function(_0x17c7a0){logger['info'](_0xb9cc('0x13'),_0x37c7b6,_0xb9cc('0x14'));logger['debug'](_0xb9cc('0x15'),_0x37c7b6,_0xb9cc('0x14'),JSON[_0xb9cc('0x16')](_0x17c7a0));if(_0x17c7a0['error']){if(_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x18')]===0x1f4){logger[_0xb9cc('0x17')]('MailAccount,\x20%s,\x20%s',_0x37c7b6,_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x19')]);return _0x1316bf(_0x17c7a0[_0xb9cc('0x17')]['message']);}logger[_0xb9cc('0x17')](_0xb9cc('0x13'),_0x37c7b6,_0x17c7a0['error']['message']);return _0x125bb0(_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x19')]);}else{logger['info'](_0xb9cc('0x13'),_0x37c7b6,'request\x20sent');_0x125bb0(_0x17c7a0[_0xb9cc('0x1a')][_0xb9cc('0x19')]);}})[_0xb9cc('0x1b')](function(_0x5ffe93){logger['error']('MailAccount,\x20%s,\x20%s',_0x37c7b6,_0x5ffe93);_0x1316bf(_0x5ffe93);});});}function respondWithStatusCode(_0x3787b7,_0x3d9372){_0x3d9372=_0x3d9372||0xcc;return function(_0x17927e){if(_0x17927e){return _0x3787b7[_0xb9cc('0x1c')](_0x3d9372);}return _0x3787b7[_0xb9cc('0x1d')](_0x3d9372)['end']();};}function respondWithResult(_0x8471df,_0x2ad956){_0x2ad956=_0x2ad956||0xc8;return function(_0x2e23a9){if(_0x2e23a9){return _0x8471df[_0xb9cc('0x1d')](_0x2ad956)[_0xb9cc('0x1e')](_0x2e23a9);}};}function respondWithFilteredResult(_0x181d9f,_0x3629c2){return function(_0xf1cb5f){if(_0xf1cb5f){var _0x2f9b83=typeof _0x3629c2[_0xb9cc('0x1f')]===_0xb9cc('0x20')&&typeof _0x3629c2[_0xb9cc('0x21')]===_0xb9cc('0x20');var _0x34f714=_0xf1cb5f[_0xb9cc('0x22')];var _0x4f2560=_0x2f9b83?0x0:_0x3629c2[_0xb9cc('0x1f')];var _0x481214=_0x2f9b83?_0xf1cb5f[_0xb9cc('0x22')]:_0x3629c2['offset']+_0x3629c2[_0xb9cc('0x21')];var _0x20b3ea;if(_0x481214>=_0x34f714){_0x481214=_0x34f714;_0x20b3ea=0xc8;}else{_0x20b3ea=0xce;}_0x181d9f[_0xb9cc('0x1d')](_0x20b3ea);return _0x181d9f[_0xb9cc('0x23')]('Content-Range',_0x4f2560+'-'+_0x481214+'/'+_0x34f714)[_0xb9cc('0x1e')](_0xf1cb5f);}return null;};}function saveUpdates(_0x20602d){return function(_0x1e75e5){if(_0x1e75e5){return _0x1e75e5[_0xb9cc('0x24')](_0x20602d)[_0xb9cc('0x12')](function(_0x98290e){return _0x98290e;});}return null;};}function removeEntity(_0x2ba2e0){return function(_0x390ac4){if(_0x390ac4){return _0x390ac4[_0xb9cc('0x25')]()['then'](function(){var _0x519ef7=_0x390ac4[_0xb9cc('0x26')]({'plain':!![]});var _0x524d0a='MailAccounts';return db[_0xb9cc('0x27')][_0xb9cc('0x25')]({'where':{'type':_0x524d0a,'resourceId':_0x519ef7['id']}})[_0xb9cc('0x12')](function(){return _0x390ac4;});})[_0xb9cc('0x12')](function(){_0x2ba2e0[_0xb9cc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425808){return function(_0x30afa0){if(!_0x30afa0){_0x425808[_0xb9cc('0x1c')](0x194);}return _0x30afa0;};}function handleError(_0x1a98a4,_0x4fd23f){_0x4fd23f=_0x4fd23f||0x1f4;return function(_0x5c84f9){logger[_0xb9cc('0x17')](_0x5c84f9[_0xb9cc('0x28')]);if(_0x5c84f9[_0xb9cc('0x29')]){delete _0x5c84f9[_0xb9cc('0x29')];}_0x1a98a4['status'](_0x4fd23f)[_0xb9cc('0x2a')](_0x5c84f9);};}function getImapHost(_0x40dd43){switch(_0x40dd43){case'gmail':return _0xb9cc('0x2b');case _0xb9cc('0x2c'):return _0xb9cc('0x2d');case _0xb9cc('0x2e'):return _0xb9cc('0x2f');case _0xb9cc('0x30'):return'outlook.office365.com';}throw new Error(_0xb9cc('0x31'),_0x40dd43);}function getSmtpHost(_0x29aea3){switch(_0x29aea3){case _0xb9cc('0x32'):return _0xb9cc('0x33');case _0xb9cc('0x2c'):return'smtp.mail.yahoo.com';case _0xb9cc('0x2e'):return _0xb9cc('0x34');case'outlook365':return'smtp.office365.com';}throw new Error(_0xb9cc('0x31'),_0x29aea3);}function getAuthenticationOptions(_0x314742,_0x18ee64){var _0x18943c={};var _0x235896={};if(_0x314742){_0x18943c[_0xb9cc('0x35')]=_0x235896[_0xb9cc('0x35')]=_0x18ee64['username'];_0x18943c['password']=_0x235896[_0xb9cc('0x36')]=_0x18ee64['password'];if(_0x18ee64['modernAuthentication']){_0x18943c[_0xb9cc('0x37')]=_0x235896['modernAuthentication']=!![];_0x18943c[_0xb9cc('0x38')]=_0x235896[_0xb9cc('0x38')]=_0x18ee64[_0xb9cc('0x38')];_0x18943c[_0xb9cc('0x39')]=_0x235896['pass']=null;}else{_0x18943c[_0xb9cc('0x38')]=_0x235896[_0xb9cc('0x38')]=null;}_0x18943c[_0xb9cc('0x3a')]=getImapHost(_0x314742);_0x18943c[_0xb9cc('0x3b')]=0x3e1;_0x235896[_0xb9cc('0x3a')]=getSmtpHost(_0x314742);_0x235896['port']=0x24b;_0x235896[_0xb9cc('0x3c')]=![];_0x18943c[_0xb9cc('0x3d')]=_0x235896[_0xb9cc('0x3d')]=null;}else{if(_0x18ee64['authentication']){_0x18943c[_0xb9cc('0x35')]=_0x235896[_0xb9cc('0x35')]=_0x18ee64[_0xb9cc('0x3e')];_0x18943c[_0xb9cc('0x39')]=_0x235896[_0xb9cc('0x36')]=_0x18ee64[_0xb9cc('0x39')];}else{_0x18943c[_0xb9cc('0x3f')]=_0x235896['authentication']=![];_0x18943c['user']=_0x235896[_0xb9cc('0x35')]=null;_0x18943c['password']=_0x235896[_0xb9cc('0x36')]=null;}_0x18943c['host']=_0x18ee64[_0xb9cc('0x40')][_0xb9cc('0x3a')];_0x18943c[_0xb9cc('0x3b')]=_0x18ee64[_0xb9cc('0x40')][_0xb9cc('0x3b')];_0x235896[_0xb9cc('0x3a')]=_0x18ee64[_0xb9cc('0x41')][_0xb9cc('0x3a')];_0x235896[_0xb9cc('0x3b')]=_0x18ee64['Smtp'][_0xb9cc('0x3b')];}return{'Imap':_0x18943c,'Smtp':_0x235896};}exports[_0xb9cc('0x42')]=function(_0x2d3e44,_0xb81fd9){var _0x293306={'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db[_0xb9cc('0x45')],'as':_0xb9cc('0x46')}]},_0xe8b287={},_0x5d1513={'count':0x0,'rows':[]};var _0xf9bd45=_[_0xb9cc('0x47')](db['MailAccount']['rawAttributes'],function(_0x53232f){return{'name':_0x53232f[_0xb9cc('0x48')],'type':_0x53232f[_0xb9cc('0x49')][_0xb9cc('0x4a')]};});_0xe8b287[_0xb9cc('0x4b')]=_['map'](_0xf9bd45,_0xb9cc('0x29'));_0xe8b287[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x2d3e44[_0xb9cc('0x4c')]);_0xe8b287[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0xe8b287[_0xb9cc('0x4b')],_0xe8b287[_0xb9cc('0x4c')]);_0x293306[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0xe8b287[_0xb9cc('0x4b')],qs['fields'](_0x2d3e44['query']['fields']));_0x293306[_0xb9cc('0x50')]=_0x293306[_0xb9cc('0x50')]['length']?_0x293306[_0xb9cc('0x50')]:_0xe8b287[_0xb9cc('0x4b')];if(!_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x51')]('nolimit')){_0x293306[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x293306['offset']=qs['offset'](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x293306['order']=qs[_0xb9cc('0x52')](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x293306[_0xb9cc('0x53')]=qs['filters'](_[_0xb9cc('0x54')](_0x2d3e44[_0xb9cc('0x4c')],_0xe8b287[_0xb9cc('0x4e')]),_0xf9bd45);if(_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x293306[_0xb9cc('0x53')]=_['merge'](_0x293306['where'],{'$or':_[_0xb9cc('0x47')](_0xf9bd45,function(_0x48900a){if(_0x48900a['type']!=='VIRTUAL'){var _0x52d7e6={};_0x52d7e6[_0x48900a[_0xb9cc('0x29')]]={'$like':'%'+_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x52d7e6;}})});}_0x293306=_['merge']({},_0x293306,_0x2d3e44[_0xb9cc('0x56')]);var _0x5cf1b9={'where':_0x293306['where']};return db['MailAccount'][_0xb9cc('0x22')](_0x5cf1b9)[_0xb9cc('0x12')](function(_0x1f646b){_0x5d1513['count']=_0x1f646b;if(_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x293306[_0xb9cc('0x58')]=[{'all':!![]}];}return db['MailAccount'][_0xb9cc('0x59')](_0x293306);})[_0xb9cc('0x12')](function(_0x1c8c10){_0x5d1513['rows']=_0x1c8c10;return _0x5d1513;})[_0xb9cc('0x12')](respondWithFilteredResult(_0xb81fd9,_0x293306))[_0xb9cc('0x1b')](handleError(_0xb81fd9,null));};exports[_0xb9cc('0x5a')]=function(_0x242ee1,_0x5d2b21){var _0x66dd15={'raw':![],'where':{'id':_0x242ee1['params']['id']},'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':'Smtp'},{'model':db[_0xb9cc('0x45')],'as':_0xb9cc('0x46')}]},_0x905ce1={};_0x905ce1[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x5b')]['rawAttributes']);_0x905ce1[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x242ee1['query']);_0x905ce1[_0xb9cc('0x4e')]=_['intersection'](_0x905ce1[_0xb9cc('0x4b')],_0x905ce1[_0xb9cc('0x4c')]);_0x66dd15[_0xb9cc('0x50')]=_['intersection'](_0x905ce1[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x242ee1[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x66dd15[_0xb9cc('0x50')]=_0x66dd15[_0xb9cc('0x50')]['length']?_0x66dd15[_0xb9cc('0x50')]:_0x905ce1[_0xb9cc('0x4b')];if(_0x242ee1[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x66dd15['include']=[{'all':!![]}];}_0x66dd15=_[_0xb9cc('0x5d')]({},_0x66dd15,_0x242ee1[_0xb9cc('0x56')]);return db[_0xb9cc('0x5b')]['find'](_0x66dd15)[_0xb9cc('0x12')](handleEntityNotFound(_0x5d2b21,null))[_0xb9cc('0x12')](respondWithResult(_0x5d2b21,null))[_0xb9cc('0x1b')](handleError(_0x5d2b21,null));};exports[_0xb9cc('0x24')]=function(_0x1b83bc,_0x339742){if(_0x1b83bc['body']['id']){delete _0x1b83bc[_0xb9cc('0x5e')]['id'];}var _0x30675f=_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x5f')]==='custom'?null:_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x5f')];var _0x5d7edd=_0x1b83bc['body'][_0xb9cc('0x40')]||{};var _0x128a8c=_0x1b83bc[_0xb9cc('0x5e')]['Smtp']||{};if(_0x30675f){_0x5d7edd[_0xb9cc('0x3a')]=getImapHost(_0x30675f);_0x5d7edd['port']=0x3e1;_0x128a8c['host']=getSmtpHost(_0x30675f);_0x128a8c[_0xb9cc('0x3b')]=0x24b;_0x128a8c['secure']=![];}if(_0x128a8c['modernAuthentication']){_0x128a8c['secure']=![];}else{_0x128a8c[_0xb9cc('0x38')]=null;}if(!_0x5d7edd[_0xb9cc('0x37')])_0x5d7edd['CloudProviderId']=null;_0x1b83bc['body']['Imap']=_0x5d7edd;_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x41')]=_0x128a8c;return db['MailAccount']['find']({'where':{'id':_0x1b83bc[_0xb9cc('0x60')]['id']},'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db['Pause'],'as':_0xb9cc('0x46')}]})['then'](handleEntityNotFound(_0x339742,null))[_0xb9cc('0x12')](function(_0x4e3b46){if(!_0x4e3b46)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4e3b46[_0xb9cc('0x3d')])delete _0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')];return _0x4e3b46;})[_0xb9cc('0x12')](saveUpdates(_0x1b83bc['body'],null))[_0xb9cc('0x12')](function(_0x37190a){if(!_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')])return _0x37190a;return db[_0xb9cc('0x43')][_0xb9cc('0x24')](_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')],{'where':{'MailAccountId':_0x37190a['id']}})['then'](function(){return _0x37190a;});})[_0xb9cc('0x12')](function(_0x223bf0){if(!_0x1b83bc['body'][_0xb9cc('0x41')])return _0x223bf0;return db[_0xb9cc('0x44')]['update'](_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x41')],{'where':{'MailAccountId':_0x223bf0['id']}})[_0xb9cc('0x12')](function(){return _0x223bf0;});})[_0xb9cc('0x12')](respondWithResult(_0x339742,null))[_0xb9cc('0x1b')](handleError(_0x339742,null));};exports['describe']=function(_0x4e853b,_0x268996){return db['MailAccount'][_0xb9cc('0x61')]()[_0xb9cc('0x12')](respondWithResult(_0x268996,null))[_0xb9cc('0x1b')](handleError(_0x268996,null));};exports[_0xb9cc('0x62')]=function(_0x1612c1,_0x12bc61){if(_0x1612c1[_0xb9cc('0x5e')]['id']){delete _0x1612c1[_0xb9cc('0x5e')]['id'];}return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x1612c1['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x12bc61,null))[_0xb9cc('0x12')](function(_0x2462fa){if(_0x2462fa){_0x1612c1[_0xb9cc('0x5e')]['MailAccountId']=_0x2462fa['id'];return db[_0xb9cc('0x64')]['create'](_0x1612c1[_0xb9cc('0x5e')]);}})['then'](respondWithResult(_0x12bc61,null))[_0xb9cc('0x1b')](handleError(_0x12bc61,null));};exports[_0xb9cc('0x65')]=function(_0x268484,_0x35dd4d){var _0x3f9ddd={'raw':![],'where':{}};var _0x674d0b={};var _0x523845={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x268484[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x35dd4d,null))[_0xb9cc('0x12')](function(_0x46429c){if(_0x46429c){_0x674d0b[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x64')][_0xb9cc('0x66')]);_0x674d0b[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x268484[_0xb9cc('0x4c')]);_0x674d0b[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x674d0b['model'],_0x674d0b['query']);_0x3f9ddd[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x674d0b[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x3f9ddd['attributes']=_0x3f9ddd[_0xb9cc('0x50')]['length']?_0x3f9ddd[_0xb9cc('0x50')]:_0x674d0b[_0xb9cc('0x4b')];if(!_0x268484[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x3f9ddd[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x3f9ddd['offset']=qs['offset'](_0x268484[_0xb9cc('0x4c')]['offset']);}_0x3f9ddd['order']=qs['sort'](_0x268484['query'][_0xb9cc('0x52')]);_0x3f9ddd[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_['pick'](_0x268484[_0xb9cc('0x4c')],_0x674d0b[_0xb9cc('0x4e')]));_0x3f9ddd['where'][_0xb9cc('0x68')]=_0x46429c['id'];if(_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x3f9ddd[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x3f9ddd[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x3f9ddd[_0xb9cc('0x50')],function(_0x41bb26){var _0x54a833={};_0x54a833[_0x41bb26]={'$like':'%'+_0x268484['query']['filter']+'%'};return _0x54a833;})});}_0x3f9ddd=_['merge']({},_0x3f9ddd,_0x268484['options']);return db[_0xb9cc('0x64')]['count']({'where':_0x3f9ddd[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x540306){_0x523845[_0xb9cc('0x22')]=_0x540306;if(_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x3f9ddd[_0xb9cc('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3f9ddd);})[_0xb9cc('0x12')](function(_0x1dca56){_0x523845['rows']=_0x1dca56;return _0x523845;});}})['then'](respondWithFilteredResult(_0x35dd4d,_0x3f9ddd))[_0xb9cc('0x1b')](handleError(_0x35dd4d,null));};exports[_0xb9cc('0x69')]=function(_0x345ec6,_0xdfede3){return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x345ec6['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xdfede3,null))['then'](function(_0x1900ba){if(_0x1900ba){return _0x1900ba[_0xb9cc('0x69')](_0x345ec6[_0xb9cc('0x4c')][_0xb9cc('0x6a')]);}})[_0xb9cc('0x12')](respondWithStatusCode(_0xdfede3,null))[_0xb9cc('0x1b')](handleError(_0xdfede3,null));};exports[_0xb9cc('0x6b')]=function(_0x11890a,_0x2ad41c){if(_0x11890a[_0xb9cc('0x5e')]['id']){delete _0x11890a['body']['id'];}return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x11890a[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x2ad41c,null))['then'](function(_0x5577cc){if(_0x5577cc){_0x11890a[_0xb9cc('0x5e')][_0xb9cc('0x68')]=_0x5577cc['id'];return db[_0xb9cc('0x6c')][_0xb9cc('0x6d')](_0x11890a[_0xb9cc('0x5e')]);}})[_0xb9cc('0x12')](respondWithResult(_0x2ad41c,null))['catch'](handleError(_0x2ad41c,null));};exports['getAnswers']=function(_0x3df75b,_0x23fa7d){var _0x19bfe4={'raw':![],'where':{}};var _0x1658c8={};var _0x3aec42={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x3df75b[_0xb9cc('0x60')]['id']}})['then'](handleEntityNotFound(_0x23fa7d,null))['then'](function(_0x5787de){if(_0x5787de){_0x1658c8[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x6c')]['rawAttributes']);_0x1658c8[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x3df75b[_0xb9cc('0x4c')]);_0x1658c8['filters']=_[_0xb9cc('0x4f')](_0x1658c8[_0xb9cc('0x4b')],_0x1658c8['query']);_0x19bfe4['attributes']=_[_0xb9cc('0x4f')](_0x1658c8['model'],qs[_0xb9cc('0x5c')](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x19bfe4[_0xb9cc('0x50')]=_0x19bfe4['attributes']['length']?_0x19bfe4[_0xb9cc('0x50')]:_0x1658c8['model'];if(!_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x51')](_0xb9cc('0x67'))){_0x19bfe4[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x3df75b[_0xb9cc('0x4c')]['limit']);_0x19bfe4[_0xb9cc('0x1f')]=qs['offset'](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x19bfe4['order']=qs['sort'](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x19bfe4['where']=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x3df75b[_0xb9cc('0x4c')],_0x1658c8[_0xb9cc('0x4e')]));_0x19bfe4[_0xb9cc('0x53')][_0xb9cc('0x68')]=_0x5787de['id'];if(_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x19bfe4[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x19bfe4['where'],{'$or':_[_0xb9cc('0x47')](_0x19bfe4[_0xb9cc('0x50')],function(_0xec7450){var _0x43fef7={};_0x43fef7[_0xec7450]={'$like':'%'+_0x3df75b[_0xb9cc('0x4c')]['filter']+'%'};return _0x43fef7;})});}_0x19bfe4=_['merge']({},_0x19bfe4,_0x3df75b[_0xb9cc('0x56')]);return db[_0xb9cc('0x6c')][_0xb9cc('0x22')]({'where':_0x19bfe4[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x563f25){_0x3aec42[_0xb9cc('0x22')]=_0x563f25;if(_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x19bfe4[_0xb9cc('0x58')]=[{'all':!![]}];}return db[_0xb9cc('0x6c')][_0xb9cc('0x59')](_0x19bfe4);})[_0xb9cc('0x12')](function(_0x535544){_0x3aec42[_0xb9cc('0x6e')]=_0x535544;return _0x3aec42;});}})[_0xb9cc('0x12')](respondWithFilteredResult(_0x23fa7d,_0x19bfe4))['catch'](handleError(_0x23fa7d,null));};exports[_0xb9cc('0x6f')]=function(_0x4ebffe,_0xef9db3){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x4ebffe[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xef9db3,null))[_0xb9cc('0x12')](function(_0x2d9d54){if(_0x2d9d54){return _0x2d9d54['removeAnswers'](_0x4ebffe[_0xb9cc('0x4c')]['ids']);}})[_0xb9cc('0x12')](respondWithStatusCode(_0xef9db3,null))['catch'](handleError(_0xef9db3,null));};exports[_0xb9cc('0x6d')]=function(_0x1a7783,_0xef5d79){var _0x1b2237={'name':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x29')],'key':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x4a')],'provider':_0x1a7783['body'][_0xb9cc('0x5f')]===_0xb9cc('0x70')?null:_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x5f')],'email':_0x1a7783['body']['email'],'ListId':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x71')],'active':!_[_0xb9cc('0x72')](_0x1a7783['body'][_0xb9cc('0x73')])?_0x1a7783['body'][_0xb9cc('0x73')]:!![],'description':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x74')]||null};var _0x5304ed=getAuthenticationOptions(_0x1b2237[_0xb9cc('0x5f')],_0x1a7783[_0xb9cc('0x5e')]);_0x1b2237[_0xb9cc('0x40')]=_0x5304ed[_0xb9cc('0x40')];_0x1b2237[_0xb9cc('0x41')]=_0x5304ed[_0xb9cc('0x41')];return db['MailAccount']['create'](_0x1b2237,{'include':[{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')}]})[_0xb9cc('0x12')](function(_0x5d47c0){var _0x4e7a02=_0x1a7783[_0xb9cc('0x35')][_0xb9cc('0x26')]({'plain':!![]});if(!_0x4e7a02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e7a02[_0xb9cc('0x75')]===_0xb9cc('0x35')){var _0x2f4ccc=_0x5d47c0[_0xb9cc('0x26')]({'plain':!![]});return db[_0xb9cc('0x76')][_0xb9cc('0x63')]({'where':{'name':_0xb9cc('0x77'),'userProfileId':_0x4e7a02[_0xb9cc('0x78')]},'raw':!![]})['then'](function(_0x4a684c){if(_0x4a684c&&_0x4a684c[_0xb9cc('0x79')]===0x0){return db[_0xb9cc('0x27')][_0xb9cc('0x6d')]({'name':_0x2f4ccc[_0xb9cc('0x29')],'resourceId':_0x2f4ccc['id'],'type':_0x4a684c[_0xb9cc('0x29')],'sectionId':_0x4a684c['id']},{})[_0xb9cc('0x12')](function(){return _0x5d47c0;});}else{return _0x5d47c0;}})[_0xb9cc('0x1b')](function(_0x69a530){logger[_0xb9cc('0x17')](_0xb9cc('0x7a'),_0x69a530);throw _0x69a530;});}return _0x5d47c0;})['then'](respondWithResult(_0xef5d79,0xc9))[_0xb9cc('0x1b')](handleError(_0xef5d79,null));};exports['getImap']=function(_0x264c32,_0x4af19c){return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x264c32[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x4af19c,null))[_0xb9cc('0x12')](function(_0x1444e2){if(_0x1444e2){return _0x1444e2[_0xb9cc('0x7b')]();}return null;})['then'](respondWithResult(_0x4af19c,null))[_0xb9cc('0x1b')](handleError(_0x4af19c,null));};exports[_0xb9cc('0x7c')]=function(_0x26d7a2,_0x1e66fc){if(_0x26d7a2[_0xb9cc('0x5e')]['id']){delete _0x26d7a2[_0xb9cc('0x5e')]['id'];}return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x26d7a2['params']['id']}})['then'](handleEntityNotFound(_0x1e66fc,null))[_0xb9cc('0x12')](function(_0x2fa3f5){if(_0x2fa3f5){_0x26d7a2[_0xb9cc('0x5e')]['MailAccountId']=_0x2fa3f5['id'];return db[_0xb9cc('0x43')][_0xb9cc('0x6d')](_0x26d7a2[_0xb9cc('0x5e')]);}})[_0xb9cc('0x12')](respondWithResult(_0x1e66fc,null))[_0xb9cc('0x1b')](handleError(_0x1e66fc,null));};exports[_0xb9cc('0x7d')]=function(_0x1a56f0,_0x2f251b){return db['MailAccount'][_0xb9cc('0x7e')]({'where':{'id':_0x1a56f0[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x2f251b,null))[_0xb9cc('0x12')](function(_0x29d701){if(_0x29d701){return _0x29d701[_0xb9cc('0x7f')](null);}return null;})[_0xb9cc('0x12')](respondWithStatusCode(_0x2f251b,null))[_0xb9cc('0x1b')](handleError(_0x2f251b,null));};exports['getSmtp']=function(_0x40eca0,_0xb6c91e){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x40eca0[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xb6c91e,null))['then'](function(_0x49c594){if(_0x49c594){return _0x49c594[_0xb9cc('0x80')]();}return null;})[_0xb9cc('0x12')](respondWithResult(_0xb6c91e,null))[_0xb9cc('0x1b')](handleError(_0xb6c91e,null));};exports[_0xb9cc('0x81')]=function(_0xf95f2e,_0x33f378){if(_0xf95f2e[_0xb9cc('0x5e')]['id']){delete _0xf95f2e[_0xb9cc('0x5e')]['id'];}return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0xf95f2e[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x33f378,null))[_0xb9cc('0x12')](function(_0x2ed6e2){if(_0x2ed6e2){_0xf95f2e[_0xb9cc('0x5e')][_0xb9cc('0x68')]=_0x2ed6e2['id'];return db[_0xb9cc('0x44')][_0xb9cc('0x6d')](_0xf95f2e['body']);}})[_0xb9cc('0x12')](respondWithResult(_0x33f378,null))[_0xb9cc('0x1b')](handleError(_0x33f378,null));};exports[_0xb9cc('0x82')]=function(_0x45d4f4,_0x4a4310){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x45d4f4[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x4a4310,null))[_0xb9cc('0x12')](function(_0x4d7546){if(_0x4d7546){return _0x4d7546[_0xb9cc('0x83')](null);}return null;})[_0xb9cc('0x12')](respondWithStatusCode(_0x4a4310,null))[_0xb9cc('0x1b')](handleError(_0x4a4310,null));};exports['addInteraction']=function(_0xe67ead,_0x5cf43f){return db[_0xb9cc('0x84')][_0xb9cc('0x63')]({'where':{'id':_0xe67ead[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x5cf43f,null))[_0xb9cc('0x12')](function(_0x4d1650){if(_0x4d1650){return _0x4d1650['addInteraction'](_0xe67ead[_0xb9cc('0x5e')]['ids'],_[_0xb9cc('0x85')](_0xe67ead[_0xb9cc('0x5e')],[_0xb9cc('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x5cf43f,null))[_0xb9cc('0x1b')](handleError(_0x5cf43f,null));};exports[_0xb9cc('0x86')]=function(_0x48efb5,_0x1ed91f){var _0x489781={'raw':![],'where':{}};var _0x1e13ae={};var _0x50099b={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x48efb5[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x1ed91f,null))[_0xb9cc('0x12')](function(_0x3ff6d7){if(_0x3ff6d7){_0x1e13ae['model']=_[_0xb9cc('0x4d')](db[_0xb9cc('0x84')][_0xb9cc('0x66')]);_0x1e13ae[_0xb9cc('0x4c')]=_['keys'](_0x48efb5['query']);_0x1e13ae[_0xb9cc('0x4e')]=_['intersection'](_0x1e13ae[_0xb9cc('0x4b')],_0x1e13ae[_0xb9cc('0x4c')]);_0x489781[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x1e13ae['model'],qs[_0xb9cc('0x5c')](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x489781[_0xb9cc('0x50')]=_0x489781[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x489781[_0xb9cc('0x50')]:_0x1e13ae[_0xb9cc('0x4b')];if(!_0x48efb5[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x489781[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x489781[_0xb9cc('0x1f')]=qs['offset'](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x489781[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x48efb5['query'][_0xb9cc('0x52')]);_0x489781[_0xb9cc('0x53')]=qs['filters'](_[_0xb9cc('0x54')](_0x48efb5[_0xb9cc('0x4c')],_0x1e13ae[_0xb9cc('0x4e')]));_0x489781['where'][_0xb9cc('0x68')]=_0x3ff6d7['id'];if(_0x48efb5['query'][_0xb9cc('0x55')]){_0x489781[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x489781[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x489781[_0xb9cc('0x50')],function(_0x2809c6){var _0x1c4b37={};_0x1c4b37[_0x2809c6]={'$like':'%'+_0x48efb5[_0xb9cc('0x4c')]['filter']+'%'};return _0x1c4b37;})});}_0x489781=_[_0xb9cc('0x5d')]({},_0x489781,_0x48efb5[_0xb9cc('0x56')]);return db[_0xb9cc('0x84')][_0xb9cc('0x22')]({'where':_0x489781[_0xb9cc('0x53')]})['then'](function(_0x35160a){_0x50099b['count']=_0x35160a;if(_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x489781['include']=[{'model':db[_0xb9cc('0x89')],'as':_0xb9cc('0x8a'),'required':![]},{'model':db[_0xb9cc('0x8b')],'as':_0xb9cc('0x8c'),'attributes':[_0xb9cc('0x29'),_0xb9cc('0x8d'),_0xb9cc('0x8e')],'required':![]},{'model':db[_0xb9cc('0x8f')],'as':_0xb9cc('0x90'),'attributes':['id',_0xb9cc('0x29'),_0xb9cc('0x91')],'where':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]?{'id':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]}:undefined,'required':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]?!![]:![]}];}return db[_0xb9cc('0x84')][_0xb9cc('0x59')](_0x489781);})[_0xb9cc('0x12')](function(_0x2bba94){_0x50099b['rows']=_0x2bba94;return _0x50099b;});}})[_0xb9cc('0x12')](respondWithFilteredResult(_0x1ed91f,_0x489781))['catch'](handleError(_0x1ed91f,null));};exports['addApplications']=function addApplications(_0x53bfe1,_0x393c26){var _0x1137b2=_0x53bfe1[_0xb9cc('0x60')]['id'];var _0x5bf1d9=_0x53bfe1[_0xb9cc('0x5e')];var _0x359e3e=0xc8;var _0x31e796=null;return db[_0xb9cc('0x93')][_0xb9cc('0x94')]({'isolationLevel':db['sequelize'][_0xb9cc('0x95')][_0xb9cc('0x96')][_0xb9cc('0x97')]},function(_0x268a7d){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x1137b2},'transaction':_0x268a7d})['then'](function(_0x465e03){if(_0x465e03){return db[_0xb9cc('0x98')][_0xb9cc('0x25')]({'where':{'MailAccountId':_0x1137b2},'transaction':_0x268a7d})[_0xb9cc('0x12')](function(){var _0x5f524a=_[_0xb9cc('0x47')](_0x5bf1d9,function(_0x456706){_0x456706[_0xb9cc('0x68')]=_0x1137b2;return _0x456706;});return db[_0xb9cc('0x98')][_0xb9cc('0x99')](_0x5f524a,{'transaction':_0x268a7d});});}else{_0x359e3e=0x194;_0x31e796=[];}});})['then'](function(){if(_0x359e3e!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x1137b2},'order':_0xb9cc('0x9a')})['then'](function(_0x19b550){_0x31e796=_0x19b550;});}})[_0xb9cc('0x1b')](function(_0x224cb2){_0x359e3e=0x1f4;logger['error'](_0x224cb2[_0xb9cc('0x28')]);if(_0x224cb2[_0xb9cc('0x29')]){delete _0x224cb2[_0xb9cc('0x29')];}_0x31e796=_0x224cb2;})[_0xb9cc('0x9b')](function(){if(_0x31e796===null){_0x393c26[_0xb9cc('0x1c')](_0x359e3e);}else{if(_0x359e3e===0x1f4){_0x393c26[_0xb9cc('0x1d')](_0x359e3e)[_0xb9cc('0x2a')](_0x31e796);}else{_0x393c26[_0xb9cc('0x1d')](_0x359e3e)[_0xb9cc('0x1e')](_0x31e796);}}});};exports[_0xb9cc('0x9c')]=function(_0x233a35,_0xe47b6a){var _0x44cce6={};var _0x1eb526={};var _0x7ee24b;var _0x2d610d;return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x233a35[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xe47b6a,null))[_0xb9cc('0x12')](function(_0x467d1f){if(_0x467d1f){_0x7ee24b=_0x467d1f;_0x1eb526[_0xb9cc('0x4b')]=_['keys'](db['MailApplication'][_0xb9cc('0x66')]);_0x1eb526['query']=_['keys'](_0x233a35[_0xb9cc('0x4c')]);_0x1eb526['filters']=_[_0xb9cc('0x4f')](_0x1eb526['model'],_0x1eb526[_0xb9cc('0x4c')]);_0x44cce6[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x1eb526[_0xb9cc('0x4b')],qs['fields'](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x44cce6[_0xb9cc('0x50')]=_0x44cce6[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x44cce6[_0xb9cc('0x50')]:_0x1eb526['model'];_0x44cce6[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x44cce6['where']=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x233a35[_0xb9cc('0x4c')],_0x1eb526[_0xb9cc('0x4e')]));if(_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x44cce6['where']=_[_0xb9cc('0x5d')](_0x44cce6[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x44cce6[_0xb9cc('0x50')],function(_0x5688b5){var _0x377165={};_0x377165[_0x5688b5]={'$like':'%'+_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x377165;})});}_0x44cce6=_[_0xb9cc('0x5d')]({},_0x44cce6,_0x233a35[_0xb9cc('0x56')]);return _0x7ee24b['getApplications'](_0x44cce6);}})[_0xb9cc('0x12')](function(_0x782b9b){if(_0x782b9b){_0x2d610d=_0x782b9b[_0xb9cc('0x87')];if(!_0x233a35[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x44cce6[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x233a35[_0xb9cc('0x4c')]['limit']);_0x44cce6['offset']=qs[_0xb9cc('0x1f')](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}return _0x7ee24b[_0xb9cc('0x9c')](_0x44cce6);}})[_0xb9cc('0x12')](function(_0x15806f){if(_0x15806f){return _0x15806f?{'count':_0x2d610d,'rows':_0x15806f}:null;}})['then'](respondWithResult(_0xe47b6a,null))[_0xb9cc('0x1b')](handleError(_0xe47b6a,null));};exports['getMessages']=function(_0x16eb67,_0x266431){var _0x7b552={'raw':!![],'where':{}};var _0x173336={};var _0x5d66e9={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x16eb67['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x266431,null))[_0xb9cc('0x12')](function(_0x4ae893){if(_0x4ae893){_0x173336[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x9d')][_0xb9cc('0x66')]);_0x173336[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x16eb67[_0xb9cc('0x4c')]);_0x173336[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x173336[_0xb9cc('0x4b')],_0x173336[_0xb9cc('0x4c')]);_0x7b552[_0xb9cc('0x50')]=_['intersection'](_0x173336[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x16eb67['query'][_0xb9cc('0x5c')]));_0x7b552[_0xb9cc('0x50')]=_0x7b552[_0xb9cc('0x50')]['length']?_0x7b552[_0xb9cc('0x50')]:_0x173336[_0xb9cc('0x4b')];if(!_0x16eb67[_0xb9cc('0x4c')]['hasOwnProperty']('nolimit')){_0x7b552[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x16eb67[_0xb9cc('0x4c')]['limit']);_0x7b552[_0xb9cc('0x1f')]=qs[_0xb9cc('0x1f')](_0x16eb67['query']['offset']);}_0x7b552[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x16eb67['query'][_0xb9cc('0x52')]);_0x7b552[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_['pick'](_0x16eb67[_0xb9cc('0x4c')],_0x173336[_0xb9cc('0x4e')]));_0x7b552[_0xb9cc('0x53')][_0xb9cc('0x68')]=_0x4ae893['id'];if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x7b552[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x7b552[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x7b552[_0xb9cc('0x50')],function(_0x1a050c){var _0x5859ff={};_0x5859ff[_0x1a050c]={'$like':'%'+_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x5859ff;})});}if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x9e')]){var _0xbd25b7=_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x9e')][_0xb9cc('0x9f')](',');var _0x4ed48b={};_0x4ed48b[_0xbd25b7[0x0]]={'$gte':moment(_0xbd25b7[0x1])[_0xb9cc('0xa0')](_0xb9cc('0xa1'))};_0x7b552['where']=_[_0xb9cc('0x5d')](_0x7b552[_0xb9cc('0x53')],_0x4ed48b);}_0x7b552=_[_0xb9cc('0x5d')]({},_0x7b552,_0x16eb67[_0xb9cc('0x56')]);return db[_0xb9cc('0x9d')][_0xb9cc('0x22')]({'where':_0x7b552[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x1aee24){_0x5d66e9[_0xb9cc('0x22')]=_0x1aee24;if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x7b552['include']=[{'all':!![]}];}return db[_0xb9cc('0x9d')]['findAll'](_0x7b552);})[_0xb9cc('0x12')](function(_0x4b9cea){if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0xa2')]===_0xb9cc('0xa3')){for(var _0xabf51f=0x0;_0xabf51f<_0x4b9cea[_0xb9cc('0x87')];_0xabf51f++){_0x4b9cea[_0xabf51f][_0xb9cc('0x5e')]=juice(_0x4b9cea[_0xabf51f][_0xb9cc('0x5e')]);}}_0x5d66e9[_0xb9cc('0x6e')]=_0x4b9cea;return _0x5d66e9;});}})['then'](respondWithFilteredResult(_0x266431,_0x7b552))['catch'](handleError(_0x266431,null));};exports[_0xb9cc('0x2a')]=function(_0x1c43e7,_0x39e4c3){var _0x306620,_0x66fa8f={},_0x292430;if(_0x1c43e7[_0xb9cc('0x5e')]['to']){_0x292430=_0x1c43e7['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x1c43e7[_0xb9cc('0x60')]['id']},'include':[{'model':db[_0xb9cc('0xa4')],'as':_0xb9cc('0xa5'),'include':[{'model':db[_0xb9cc('0x89')],'as':_0xb9cc('0xa6'),'where':{'email':_0x292430},'limit':0x1,'order':[[_0xb9cc('0xa7'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xb9cc('0x41'),'raw':!![],'include':[{'model':db[_0xb9cc('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0xb9cc('0x12')](handleEntityNotFound(_0x39e4c3,null))['then'](function(_0x48e068){if(!_0x48e068)return;_0x306620=_0x48e068;if(!_0x48e068[_0xb9cc('0x41')])throw new Error(_0xb9cc('0xa9'));if(_[_0xb9cc('0x72')](_0x1c43e7[_0xb9cc('0x5e')]['from'])){_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xaa')]=util['format'](_0xb9cc('0xab'),_0x48e068[_0xb9cc('0x29')],_0x48e068[_0xb9cc('0xac')]||_0x48e068['Smtp'][_0xb9cc('0x35')]);}if(_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xad')]&&_0x1c43e7[_0xb9cc('0x5e')]['attachments']['length']){for(var _0x5b59ff=0x0;_0x5b59ff<_0x1c43e7['body'][_0xb9cc('0xad')]['length'];_0x5b59ff+=0x1){_0x1c43e7[_0xb9cc('0x5e')]['attachments'][_0x5b59ff]={'filename':_0x1c43e7['body'][_0xb9cc('0xad')][_0x5b59ff]['name'],'path':path['join'](config[_0xb9cc('0xae')],_0xb9cc('0xaf'),_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xad')][_0x5b59ff][_0xb9cc('0xb0')])};}}var _0x3447ce=_0x48e068[_0xb9cc('0xb1')]();return respondWithRpcPromise(_0xb9cc('0xb2'),_0xb9cc('0xb3'),{'account':_0x3447ce,'message':_0x1c43e7['body']});})[_0xb9cc('0x12')](function(_0x58de57){if(!_0x58de57)return;_0x66fa8f=_0x58de57;if(!_0x306620[_0xb9cc('0xa5')])throw new Error(_0xb9cc('0xb4'));if(_0x306620['List'][_0xb9cc('0xa6')]['length'])return _0x306620['List'][_0xb9cc('0xa6')][0x0];return db['CmContact']['create'](_[_0xb9cc('0xa')](_0x1c43e7[_0xb9cc('0x5e')],{'firstName':_0x1c43e7[_0xb9cc('0x5e')]['to'],'email':_0x1c43e7[_0xb9cc('0x5e')]['to'],'phone':_0x1c43e7['body']['to'],'ListId':_0x306620[_0xb9cc('0x71')]}));})[_0xb9cc('0x12')](function(_0x1ad57c){if(!_0x1ad57c)return;var _0x5a6262={'UserId':_0x1c43e7[_0xb9cc('0x35')]['id'],'ContactId':_0x1ad57c['id'],'MailAccountId':_0x306620['id'],'inReplyTo':_0x66fa8f[_0xb9cc('0xb5')],'to':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xaa')],'cc':_0x1c43e7['body']['cc'],'subject':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb6')],'attach':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb9cc('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_['merge'](_0x1c43e7[_0xb9cc('0x5e')],{'messageId':_0x66fa8f['messageId'],'sentAt':moment()['format'](_0xb9cc('0xa1')),'read':!![],'MailAccountId':_0x306620['id'],'UserId':_0x1c43e7['user']['id'],'ContactId':_0x1ad57c['id']})]};if(_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb8')]){_0x5a6262=_[_0xb9cc('0x5d')](_0x5a6262,_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb8')]);}return db[_0xb9cc('0x84')][_0xb9cc('0x6d')](_0x5a6262,{'include':[{'model':db[_0xb9cc('0x9d')],'as':_0xb9cc('0xb9')}]});})[_0xb9cc('0x12')](respondWithResult(_0x39e4c3,null))[_0xb9cc('0x1b')](handleError(_0x39e4c3,null));};exports['verifySmtp']=function(_0x4b7f8a,_0x5f1193){return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x4b7f8a[_0xb9cc('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xb9cc('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb9cc('0xa8'),'raw':!![]}]}]})[_0xb9cc('0x12')](handleEntityNotFound(_0x5f1193,null))[_0xb9cc('0x12')](function(_0x1279bd){if(!_0x1279bd[_0xb9cc('0x41')])return;var _0x28a39d=_0x1279bd['getSmtpOptions']();return respondWithRpcPromise(_0xb9cc('0xba'),_0xb9cc('0xbb'),{'account':_0x28a39d});})[_0xb9cc('0x12')](respondWithResult(_0x5f1193,null))[_0xb9cc('0x1b')](handleError(_0x5f1193,null));};exports['destroy']=function(_0xd907be,_0x515f3e){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0xd907be[_0xb9cc('0x60')]['id']}})['then'](handleEntityNotFound(_0x515f3e,null))[_0xb9cc('0x12')](function(_0x341826){if(_0x341826&&_0x341826['service']){throw new db[(_0xb9cc('0xbc'))]['ValidationError'](_0xb9cc('0xbd'));}return _0x341826;})['then'](removeEntity(_0x515f3e,null))[_0xb9cc('0x1b')](handleError(_0x515f3e,null));};exports[_0xb9cc('0xbe')]=function(_0x185f18,_0x52215a){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x185f18[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x52215a,null))[_0xb9cc('0x12')](function(_0x419780){if(_0x419780){return _0x419780[_0xb9cc('0xbe')](_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')],_[_0xb9cc('0x85')](_0x185f18['body'],['ids','id'])||{})[_0xb9cc('0xbf')](function(_0x4e461a){for(var _0x315fe0=0x0;_0x315fe0<_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')][_0xb9cc('0x87')];_0x315fe0+=0x1){socket[_0xb9cc('0xc0')]('userMailAccount:save',{'UserId':Number(_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')][_0x315fe0]),'MailAccountId':Number(_0x185f18[_0xb9cc('0x60')]['id'])});}return _0x4e461a;});}})['then'](respondWithResult(_0x52215a,null))[_0xb9cc('0x1b')](handleError(_0x52215a,null));};exports[_0xb9cc('0xc1')]=function(_0x27c62a,_0x1aa46a){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x27c62a[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x1aa46a,null))[_0xb9cc('0x12')](function(_0x3ac027){if(_0x3ac027){return _0x3ac027[_0xb9cc('0xc1')](_0x27c62a[_0xb9cc('0x4c')][_0xb9cc('0x6a')])[_0xb9cc('0x12')](function(){if(_[_0xb9cc('0xc2')](_0x27c62a[_0xb9cc('0x4c')][_0xb9cc('0x6a')])){for(var _0x54dc81=0x0;_0x54dc81<_0x27c62a[_0xb9cc('0x4c')]['ids'][_0xb9cc('0x87')];_0x54dc81+=0x1){socket['emit'](_0xb9cc('0xc3'),{'UserId':Number(_0x27c62a['query']['ids'][_0x54dc81]),'MailAccountId':Number(_0x27c62a['params']['id'])});}}else{socket['emit'](_0xb9cc('0xc3'),{'UserId':Number(_0x27c62a['query'][_0xb9cc('0x6a')]),'MailAccountId':Number(_0x27c62a[_0xb9cc('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1aa46a,null))[_0xb9cc('0x1b')](handleError(_0x1aa46a,null));};exports[_0xb9cc('0xc4')]=function(_0x43281e,_0x45f5fb){var _0x269632={};var _0x2f2221={};var _0x316038;var _0x47c668;return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x43281e[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x45f5fb,null))[_0xb9cc('0x12')](function(_0x21fde2){if(_0x21fde2){_0x316038=_0x21fde2;_0x2f2221[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db['User'][_0xb9cc('0x66')]);_0x2f2221[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x43281e[_0xb9cc('0x4c')]);_0x2f2221[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x2f2221[_0xb9cc('0x4b')],_0x2f2221[_0xb9cc('0x4c')]);_0x269632['attributes']=_[_0xb9cc('0x4f')](_0x2f2221[_0xb9cc('0x4b')],qs['fields'](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x269632['attributes']=_0x269632[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x269632[_0xb9cc('0x50')]:_0x2f2221[_0xb9cc('0x4b')];_0x269632[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x269632[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x43281e[_0xb9cc('0x4c')],_0x2f2221[_0xb9cc('0x4e')]));if(_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x269632['where']=_[_0xb9cc('0x5d')](_0x269632[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x269632[_0xb9cc('0x50')],function(_0x4df4ba){var _0x19215b={};_0x19215b[_0x4df4ba]={'$like':'%'+_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x19215b;})});}_0x269632=_[_0xb9cc('0x5d')]({},_0x269632,_0x43281e[_0xb9cc('0x56')]);return _0x316038[_0xb9cc('0xc4')](_0x269632);}})[_0xb9cc('0x12')](function(_0x25c983){if(_0x25c983){_0x47c668=_0x25c983[_0xb9cc('0x87')];if(!_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x51')](_0xb9cc('0x67'))){_0x269632[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x269632[_0xb9cc('0x1f')]=qs[_0xb9cc('0x1f')](_0x43281e[_0xb9cc('0x4c')]['offset']);}return _0x316038['getAgents'](_0x269632);}})[_0xb9cc('0x12')](function(_0x5ee882){if(_0x5ee882){return _0x5ee882?{'count':_0x47c668,'rows':_0x5ee882}:null;}})[_0xb9cc('0x12')](respondWithResult(_0x45f5fb,null))[_0xb9cc('0x1b')](handleError(_0x45f5fb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ebe3f7a..a3b4c57 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 _0x958a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x958a,0x128));var _0xa958=function(_0x29cde5,_0x410b9b){_0x29cde5=_0x29cde5-0x0;var _0x22c02f=_0x958a[_0x29cde5];return _0x22c02f;};'use strict';var EventEmitter=require(_0xa958('0x0'));var MailAccount=require(_0xa958('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa958('0x2')](0x0);var events={'afterCreate':_0xa958('0x3'),'afterUpdate':_0xa958('0x4'),'afterDestroy':_0xa958('0x5')};function emitEvent(_0x30f7c5){return function(_0x5194f8,_0x3424b0,_0x578481){MailAccountEvents[_0xa958('0x6')](_0x30f7c5+':'+_0x5194f8['id'],_0x5194f8);MailAccountEvents[_0xa958('0x6')](_0x30f7c5,_0x5194f8);_0x578481(null);};}for(var e in events){if(events[_0xa958('0x7')](e)){var event=events[e];MailAccount[_0xa958('0x8')](e,emitEvent(event));}}module[_0xa958('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x4ccb=['MailAccount','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x570e73,_0x538538){var _0x13134b=function(_0x2b95e9){while(--_0x2b95e9){_0x570e73['push'](_0x570e73['shift']());}};_0x13134b(++_0x538538);}(_0x4ccb,0x196));var _0xb4cc=function(_0x11da30,_0x4e5673){_0x11da30=_0x11da30-0x0;var _0x212ae1=_0x4ccb[_0x11da30];return _0x212ae1;};'use strict';var EventEmitter=require(_0xb4cc('0x0'));var MailAccount=require(_0xb4cc('0x1'))['db'][_0xb4cc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4cc('0x3'),'afterUpdate':_0xb4cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2cdc0c){return function(_0x2ae5e6,_0x23c968,_0x4cad3f){MailAccountEvents[_0xb4cc('0x5')](_0x2cdc0c+':'+_0x2ae5e6['id'],_0x2ae5e6);MailAccountEvents[_0xb4cc('0x5')](_0x2cdc0c,_0x2ae5e6);_0x4cad3f(null);};}for(var e in events){if(events[_0xb4cc('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb4cc('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0b03053..1650a06 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 _0x256d=['provider','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x185e0a,_0x3e4537){var _0x31d9b9=function(_0x5b9401){while(--_0x5b9401){_0x185e0a['push'](_0x185e0a['shift']());}};_0x31d9b9(++_0x3e4537);}(_0x256d,0xdc));var _0xd256=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x256d[_0x4bc65f];return _0x44f85f;};'use strict';var attributes=require(_0xd256('0x0'));module[_0xd256('0x1')]=function(_0x299a29){return _0x299a29[_0xd256('0x2')](_0xd256('0x3'),attributes,{'tableName':_0xd256('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x43b251=this;var _0x4d8f66={'id':_0x43b251['id'],'tls':{'rejectUnauthorized':![]}};if(_0x43b251[_0xd256('0x5')]!=='custom'){_0x4d8f66['service']=_0x43b251[_0xd256('0x5')];}else{_0x4d8f66[_0xd256('0x6')]=_0x43b251[_0xd256('0x7')][_0xd256('0x6')];_0x4d8f66['port']=_0x43b251[_0xd256('0x7')][_0xd256('0x8')];_0x4d8f66['secure']=_0x43b251[_0xd256('0x7')][_0xd256('0x9')];}if(_0x43b251[_0xd256('0x7')]['authentication']){if(_0x43b251[_0xd256('0x7')][_0xd256('0xa')]){if(!_0x43b251['Smtp'][_0xd256('0xb')])throw new Error(_0xd256('0xc'));_0x4d8f66[_0xd256('0xd')]={'type':'OAuth2','user':_0x43b251[_0xd256('0x7')][_0xd256('0xe')],'accessToken':_0x43b251[_0xd256('0x7')][_0xd256('0xb')]['data5']};}else{_0x4d8f66[_0xd256('0xd')]={'user':_0x43b251[_0xd256('0x7')][_0xd256('0xe')],'pass':_0x43b251[_0xd256('0x7')]['pass']};}}return _0x4d8f66;}}});}; \ No newline at end of file +var _0x3003=['provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x9b1e58,_0x275770){var _0x50d9d4=function(_0x392e6e){while(--_0x392e6e){_0x9b1e58['push'](_0x9b1e58['shift']());}};_0x50d9d4(++_0x275770);}(_0x3003,0xb0));var _0x3300=function(_0x37cc1c,_0x5635ab){_0x37cc1c=_0x37cc1c-0x0;var _0x1131a4=_0x3003[_0x37cc1c];return _0x1131a4;};'use strict';var attributes=require(_0x3300('0x0'));module[_0x3300('0x1')]=function(_0x4b6618){return _0x4b6618['define'](_0x3300('0x2'),attributes,{'tableName':_0x3300('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x186bf7=this;var _0xb178b5={'id':_0x186bf7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x186bf7[_0x3300('0x4')]!==_0x3300('0x5')){_0xb178b5[_0x3300('0x6')]=_0x186bf7[_0x3300('0x4')];}else{_0xb178b5[_0x3300('0x7')]=_0x186bf7[_0x3300('0x8')][_0x3300('0x7')];_0xb178b5[_0x3300('0x9')]=_0x186bf7[_0x3300('0x8')]['port'];_0xb178b5[_0x3300('0xa')]=_0x186bf7['Smtp'][_0x3300('0xa')];}if(_0x186bf7[_0x3300('0x8')][_0x3300('0xb')]){if(_0x186bf7[_0x3300('0x8')]['modernAuthentication']){if(!_0x186bf7[_0x3300('0x8')][_0x3300('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xb178b5[_0x3300('0xd')]={'type':_0x3300('0xe'),'user':_0x186bf7[_0x3300('0x8')][_0x3300('0xf')],'accessToken':_0x186bf7['Smtp']['CloudProvider'][_0x3300('0x10')]};}else{_0xb178b5['auth']={'user':_0x186bf7[_0x3300('0x8')]['user'],'pass':_0x186bf7[_0x3300('0x8')][_0x3300('0x11')]};}}return _0xb178b5;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a0944bd..e378a70 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 _0x5fab=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','getSmtpOptions','applications','orderBy','priority','push','length','close','autoclose','*,*,*,*','defaults','ListId','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','interaction','get','created','create','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','attributes','limit','include','model','map','ShowMailAccount','find','where','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','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','MailAccount','account','CmList','List','Contacts','updatedAt'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x5fab,0x177));var _0xb5fa=function(_0x3213b7,_0x6789ca){_0x3213b7=_0x3213b7-0x0;var _0xb960bf=_0x5fab[_0x3213b7];return _0xb960bf;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5fa('0x2'));var Redis=require(_0xb5fa('0x3'));var db=require(_0xb5fa('0x4'))['db'];var logger=require(_0xb5fa('0x5'))(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var jayson=require(_0xb5fa('0x8'));var client=jayson[_0xb5fa('0x9')][_0xb5fa('0xa')]({'port':0x232c});config[_0xb5fa('0xb')]=_['defaults'](config['redis'],{'host':_0xb5fa('0xc'),'port':0x18eb});var socket=require(_0xb5fa('0xd'))(new Redis(config[_0xb5fa('0xb')]));require('./mailAccount.socket')[_0xb5fa('0xe')](socket);function respondWithRpcPromise(_0x38d9a3,_0x2cf4a5,_0x54c7eb){return new BPromise(function(_0x5b5ea8,_0x3a8e1b){return client[_0xb5fa('0xf')](_0x38d9a3,_0x54c7eb)[_0xb5fa('0x10')](function(_0x44e6c8){logger[_0xb5fa('0x11')](_0xb5fa('0x12'),_0x2cf4a5,_0xb5fa('0x13'));logger[_0xb5fa('0x14')](_0xb5fa('0x15'),_0x2cf4a5,'request\x20sent',JSON[_0xb5fa('0x16')](_0x44e6c8));if(_0x44e6c8[_0xb5fa('0x17')]){if(_0x44e6c8['error'][_0xb5fa('0x18')]===0x1f4){logger['error'](_0xb5fa('0x12'),_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x3a8e1b(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x5b5ea8(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0xb5fa('0x13'));_0x5b5ea8(_0x44e6c8[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x324ba5){logger[_0xb5fa('0x17')](_0xb5fa('0x12'),_0x2cf4a5,_0x324ba5);_0x3a8e1b(_0x324ba5);});});}exports[_0xb5fa('0x1c')]=function(_0xc14dc4){var _0x368cb1=this;return new Promise(function(_0x3c8d53,_0x1f5064){return db['MailAccount'][_0xb5fa('0x1d')]({'raw':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')]['where']||null:null,'attributes':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x1f')]||null:null,'limit':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x20')]||null:null,'include':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4['options'][_0xb5fa('0x21')]?_['map'](_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x22')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x11053a[_0xb5fa('0x21')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes'],'include':_0x568870['include']?_[_0xb5fa('0x23')](_0x568870[_0xb5fa('0x21')],function(_0x12c0d4){return{'model':db[_0x12c0d4[_0xb5fa('0x22')]],'as':_0x12c0d4['as'],'attributes':_0x12c0d4[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x358549){logger[_0xb5fa('0x11')](_0xb5fa('0x1c'),_0xc14dc4);logger[_0xb5fa('0x14')](_0xb5fa('0x1c'),_0xc14dc4,JSON[_0xb5fa('0x16')](_0x358549));_0x3c8d53(_0x358549);})[_0xb5fa('0x1b')](function(_0x1f4380){logger[_0xb5fa('0x17')](_0xb5fa('0x1c'),_0x1f4380[_0xb5fa('0x19')],_0xc14dc4);_0x1f5064(_0x368cb1[_0xb5fa('0x17')](0x1f4,_0x1f4380[_0xb5fa('0x19')]));});});};exports[_0xb5fa('0x24')]=function(_0x291938){var _0x370d95=this;return new Promise(function(_0x10fb43,_0x25fc7c){return db['MailAccount'][_0xb5fa('0x25')]({'raw':_0x291938['options']?_0x291938['options']['raw']===undefined?!![]:![]:!![],'where':_0x291938[_0xb5fa('0x1e')]?_0x291938['options'][_0xb5fa('0x26')]||null:null,'attributes':_0x291938['options']?_0x291938['options'][_0xb5fa('0x1f')]||null:null,'include':_0x291938[_0xb5fa('0x1e')]?_0x291938['options']['include']?_[_0xb5fa('0x23')](_0x291938[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x22')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x23')](_0x560b53[_0xb5fa('0x21')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')],'include':_0x204d6b[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x204d6b['include'],function(_0x117694){return{'model':db[_0x117694[_0xb5fa('0x22')]],'as':_0x117694['as'],'attributes':_0x117694[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x5e7770){if(_0x291938['options']['smtp']===!![])_0x5e7770['setDataValue']('smtpOptions',_0x5e7770['getSmtpOptions']());logger[_0xb5fa('0x11')]('ShowMailAccount',_0x291938);logger[_0xb5fa('0x14')](_0xb5fa('0x24'),_0x291938,JSON[_0xb5fa('0x16')](_0x5e7770));_0x10fb43(_0x5e7770);})[_0xb5fa('0x1b')](function(_0x40c1c0){logger[_0xb5fa('0x17')]('ShowMailAccount',_0x40c1c0['message'],_0x291938);_0x25fc7c(_0x370d95['error'](0x1f4,_0x40c1c0[_0xb5fa('0x19')]));});});};exports['NotifyMailAccount']=function(_0x73d425){var _0x5addd5=this;return new Promise(function(_0x58aa97,_0x3cdf63){var _0x42d331={'body':_0x73d425[_0xb5fa('0x27')],'channel':_0xb5fa('0x28')};var _0x5bc93f=_[_0xb5fa('0x29')](_[_0xb5fa('0x2a')](db[_0xb5fa('0x2b')][_0xb5fa('0x2c')]),[_0xb5fa('0x2d'),'updatedAt',_0xb5fa('0x2e'),'ListId']);var _0x233f90=![];if(_0x73d425[_0xb5fa('0x27')]['id']){delete _0x73d425[_0xb5fa('0x27')]['id'];}if(_[_0xb5fa('0x2f')](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x31')));}if(_['isNil'](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')])||_0x73d425['body'][_0xb5fa('0x27')]===''){return _0x3cdf63(_0x5addd5['error'](0x1f4,_0xb5fa('0x32')));}if(_[_0xb5fa('0x2f')](_0x73d425['body']['mapKey'])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x33')+_0x5bc93f));}if(!_[_0xb5fa('0x34')](_0x5bc93f,_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x36')+_0x5bc93f));}var _0x125a5c={};_0x125a5c[_0x73d425['body'][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')]['from'];return db[_0xb5fa('0x37')][_0xb5fa('0x25')]({'where':{'id':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x39')],'as':_0xb5fa('0x3a'),'include':[{'model':db[_0xb5fa('0x2b')],'as':_0xb5fa('0x3b'),'where':_0x125a5c,'limit':0x1,'order':[[_0xb5fa('0x3c'),_0xb5fa('0x3d')]]}]},{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')},{'model':db[_0xb5fa('0x40')],'as':_0xb5fa('0x41'),'include':[{'model':db[_0xb5fa('0x42')],'as':_0xb5fa('0x42')}]}]})[_0xb5fa('0x10')](function(_0x52f5d8){if(_0x52f5d8&&_0x52f5d8['List']){var _0x46194d=_0x52f5d8['get']({'plain':!![]});_0x42d331[_0xb5fa('0x38')]=_[_0xb5fa('0x43')](_0x46194d,['Applications',_0xb5fa('0x3a')]);_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x44')]=_0x52f5d8[_0xb5fa('0x45')]();_0x42d331[_0xb5fa('0x46')]=_0x46194d[_0xb5fa('0x3f')];_0x42d331['list']=_0x46194d[_0xb5fa('0x3a')];_0x42d331['applications']=_[_0xb5fa('0x47')](_0x42d331[_0xb5fa('0x46')],[_0xb5fa('0x48')],['asc']);if(_0x42d331[_0xb5fa('0x38')]&&_0x42d331[_0xb5fa('0x38')]['autoclose']){_0x42d331['applications'][_0xb5fa('0x49')]({'id':0x0,'priority':_0x42d331[_0xb5fa('0x46')][_0xb5fa('0x4a')]+0x1,'app':_0xb5fa('0x4b'),'appdata':_0xb5fa('0x4c'),'interval':_0xb5fa('0x4d')});}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')];}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')];}if(_0x46194d[_0xb5fa('0x3a')][_0xb5fa('0x3b')][_0xb5fa('0x4a')]){return _0x46194d[_0xb5fa('0x3a')]['Contacts'][0x0];}var _0x1900a5=_[_0xb5fa('0x4e')](_0x73d425[_0xb5fa('0x27')],{'firstName':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')],'ListId':_0x46194d[_0xb5fa('0x4f')]});_0x1900a5[_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')];return db['CmContact']['create'](_0x1900a5);}else{throw new Error(_0xb5fa('0x50'));}})[_0xb5fa('0x10')](function(_0x1e78cb){_0x42d331['contact']=_0x1e78cb;if(_0x1e78cb){if(!_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]){_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]=rs[_0xb5fa('0x52')]()+'\x20'+_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x30')];}var _0x4afc02={'ContactId':_0x1e78cb['id'],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'inReplyTo':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x54')],'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'};return db[_0xb5fa('0x57')][_0xb5fa('0x25')]({'where':{'closed':![],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x58')],'as':_0xb5fa('0x59'),'attributes':[_0xb5fa('0x51')],'where':{'messageId':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['inReplyTo']}}]})[_0xb5fa('0x10')](function(_0x34ebd0){if(_0x34ebd0){return[_0x34ebd0,![]];}return db[_0xb5fa('0x57')]['create'](_0x4afc02)[_0xb5fa('0x10')](function(_0x2d786e){return[_0x2d786e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb5fa('0x5a')](function(_0xb535c3,_0x5c25f6){if(_0xb535c3){_0x233f90=_0x5c25f6;if(!_0x5c25f6){return _0xb535c3['update']({'inReplyTo':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')]['message']['subject'],'attach':_0xb535c3['attach']?_0xb535c3[_0xb5fa('0x54')]:_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'});}else{return _0xb535c3;}}})[_0xb5fa('0x10')](function(_0x36b709){_0x42d331[_0xb5fa('0x5b')]=_0x36b709[_0xb5fa('0x5c')]({'plain':!![]});_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x5d')]=_0x233f90;return db[_0xb5fa('0x58')][_0xb5fa('0x5e')]({'body':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'MailInteractionId':_0x36b709['id'],'direction':'in','ContactId':_0x42d331['contact']['id'],'messageId':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'from':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'to':_0x73d425[_0xb5fa('0x27')]['message']['to'],'cc':_0x73d425[_0xb5fa('0x27')]['message']['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')]['message']['attach'],'Attachments':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x5f')],'originTo':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x60')],'originCc':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x61')],'bcc':_0x73d425['body']['message'][_0xb5fa('0x62')],'ChatWebsiteId':_0x73d425['body']['message']['ChatWebsiteId']||null,'originChannel':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x63')]||_0xb5fa('0x64'),'ChatOfflineMessageId':_0x73d425[_0xb5fa('0x27')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb5fa('0x65')],'as':_0xb5fa('0x66')}]});})['then'](function(_0x2d0c95){_0x42d331[_0xb5fa('0x19')]=_0x2d0c95;if(_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]){return db['User'][_0xb5fa('0x25')]({'attributes':['id',_0xb5fa('0x68')],'where':{'id':_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]}})[_0xb5fa('0x10')](function(_0x3348f7){if(_0x3348f7){_0x42d331[_0xb5fa('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb5fa('0x69'),'appdata':_0x3348f7['name']+','+(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x6a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);})[_0xb5fa('0x10')](function(_0x8ce5b8){_0x58aa97(_0x8ce5b8);})[_0xb5fa('0x1b')](function(_0x1bac54){_0x3cdf63(_0x5addd5['error'](0x1f4,_0x1bac54[_0xb5fa('0x19')]));});});}; \ No newline at end of file +var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x564a18,_0x446536){var _0x410f47=function(_0x23fd0c){while(--_0x23fd0c){_0x564a18['push'](_0x564a18['shift']());}};_0x410f47(++_0x446536);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f31a4,_0xa825e){_0x4f31a4=_0x4f31a4-0x0;var _0x491d26=_0x2ef3[_0x4f31a4];return _0x491d26;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4427678..85016c7 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 _0x8863=['save','remove','update','removeListener','length','mailAccount:'];(function(_0x3774f5,_0x46ea55){var _0x144072=function(_0x553afd){while(--_0x553afd){_0x3774f5['push'](_0x3774f5['shift']());}};_0x144072(++_0x46ea55);}(_0x8863,0x1b6));var _0x3886=function(_0x5ae268,_0x4b3d90){_0x5ae268=_0x5ae268-0x0;var _0x3fea8b=_0x8863[_0x5ae268];return _0x3fea8b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3886('0x0'),_0x3886('0x1'),_0x3886('0x2')];function createListener(_0x37a573,_0x569d58){return function(_0x4a6559){_0x569d58['emit'](_0x37a573,_0x4a6559);};}function removeListener(_0x5f2a22,_0xb49846){return function(){MailAccountEvents[_0x3886('0x3')](_0x5f2a22,_0xb49846);};}exports['register']=function(_0x280c47){for(var _0x195fe2=0x0,_0x566503=events[_0x3886('0x4')];_0x195fe2<_0x566503;_0x195fe2++){var _0x6edf8a=events[_0x195fe2];var _0x3a7943=createListener(_0x3886('0x5')+_0x6edf8a,_0x280c47);MailAccountEvents['on'](_0x6edf8a,_0x3a7943);}}; \ No newline at end of file +var _0x8eba=['save','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0xb63c5b,_0x2d4a23){var _0x15479f=function(_0x33eb05){while(--_0x33eb05){_0xb63c5b['push'](_0xb63c5b['shift']());}};_0x15479f(++_0x2d4a23);}(_0x8eba,0xc3));var _0xa8eb=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x8eba[_0x46efd7];return _0x5637e4;};'use strict';var MailAccountEvents=require(_0xa8eb('0x0'));var events=[_0xa8eb('0x1'),'remove','update'];function createListener(_0x4b3a3e,_0x3894f8){return function(_0x322799){_0x3894f8[_0xa8eb('0x2')](_0x4b3a3e,_0x322799);};}function removeListener(_0x2cdf40,_0x52533a){return function(){MailAccountEvents[_0xa8eb('0x3')](_0x2cdf40,_0x52533a);};}exports[_0xa8eb('0x4')]=function(_0x5abab9){for(var _0x321f2f=0x0,_0x5ece80=events[_0xa8eb('0x5')];_0x321f2f<_0x5ece80;_0x321f2f++){var _0x225307=events[_0x321f2f];var _0x509b54=createListener(_0xa8eb('0x6')+_0x225307,_0x5abab9);MailAccountEvents['on'](_0x225307,_0x509b54);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3de07d7..fc46560 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 _0x4383=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','delete','destroy','exports','multer'];(function(_0x56aad3,_0x3d48bc){var _0x1d165a=function(_0x1d4e95){while(--_0x1d4e95){_0x56aad3['push'](_0x56aad3['shift']());}};_0x1d165a(++_0x3d48bc);}(_0x4383,0x10f));var _0x3438=function(_0x34c63f,_0x4b80eb){_0x34c63f=_0x34c63f-0x0;var _0x1e429f=_0x4383[_0x34c63f];return _0x1e429f;};'use strict';var multer=require(_0x3438('0x0'));var util=require(_0x3438('0x1'));var path=require(_0x3438('0x2'));var timeout=require(_0x3438('0x3'));var express=require(_0x3438('0x4'));var router=express[_0x3438('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3438('0x6'));var interaction=require(_0x3438('0x7'));var config=require(_0x3438('0x8'));var controller=require(_0x3438('0x9'));router[_0x3438('0xa')]('/:id',auth[_0x3438('0xb')](),controller[_0x3438('0xc')]);router['put'](_0x3438('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3438('0xe')](_0x3438('0xd'),auth[_0x3438('0xb')](),controller[_0x3438('0xf')]);module[_0x3438('0x10')]=router; \ No newline at end of file +var _0xc35b=['put','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','show'];(function(_0x111c6c,_0x5ac573){var _0x2e983a=function(_0x2c0d8f){while(--_0x2c0d8f){_0x111c6c['push'](_0x111c6c['shift']());}};_0x2e983a(++_0x5ac573);}(_0xc35b,0xb9));var _0xbc35=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xc35b[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0xbc35('0x0'));var util=require(_0xbc35('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc35('0x2'));var router=express[_0xbc35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbc35('0x4'));var interaction=require(_0xbc35('0x5'));var config=require('../../config/environment');var controller=require(_0xbc35('0x6'));router[_0xbc35('0x7')]('/:id',auth[_0xbc35('0x8')](),controller[_0xbc35('0x9')]);router[_0xbc35('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbc35('0xb')](_0xbc35('0xc'),auth['isAuthenticated'](),controller[_0xbc35('0xd')]);module[_0xbc35('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 76b961d..38b45e6 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 _0xba54=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1fb621,_0x4be10f){var _0x14567d=function(_0xc4e7af){while(--_0xc4e7af){_0x1fb621['push'](_0x1fb621['shift']());}};_0x14567d(++_0x4be10f);}(_0xba54,0xa6));var _0x4ba5=function(_0x4c25cf,_0x36da52){_0x4c25cf=_0x4c25cf-0x0;var _0x4da2f5=_0xba54[_0x4c25cf];return _0x4da2f5;};'use strict';var Sequelize=require(_0x4ba5('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4ba5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4ba5('0x2')],'allowNull':![],'defaultValue':_0x4ba5('0x3')},'appdata':{'type':Sequelize[_0x4ba5('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4ba5('0x2')],'defaultValue':_0x4ba5('0x5')}}; \ No newline at end of file +var _0x7e16=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e16,0x1b5));var _0x67e1=function(_0x400525,_0x3cde57){_0x400525=_0x400525-0x0;var _0x1cc5e5=_0x7e16[_0x400525];return _0x1cc5e5;};'use strict';var Sequelize=require(_0x67e1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x67e1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x67e1('0x2')],'allowNull':![],'defaultValue':_0x67e1('0x3')},'appdata':{'type':Sequelize[_0x67e1('0x4')]()},'description':{'type':Sequelize[_0x67e1('0x2')]},'interval':{'type':Sequelize[_0x67e1('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d22c1d7..e2cd3af 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0xaa88[_0x1a8ff0];return _0x3588bf;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +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(_0x309879,_0x29f94a){var _0x480e63=function(_0x8ec1b0){while(--_0x8ec1b0){_0x309879['push'](_0x309879['shift']());}};_0x480e63(++_0x29f94a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x38e9aa,_0x2a8545){_0x38e9aa=_0x38e9aa-0x0;var _0x30122e=_0x9bde[_0x38e9aa];return _0x30122e;};'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 46b3dbe..9c8e81b 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 _0xc82e=['moment','bluebird','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x118733,_0x2bd820){var _0x4777af=function(_0x52886a){while(--_0x52886a){_0x118733['push'](_0x118733['shift']());}};_0x4777af(++_0x2bd820);}(_0xc82e,0x185));var _0xec82=function(_0x4e5747,_0x1705ed){_0x4e5747=_0x4e5747-0x0;var _0xc810a6=_0xc82e[_0x4e5747];return _0xc810a6;};'use strict';var _=require('lodash');var util=require(_0xec82('0x0'));var logger=require(_0xec82('0x1'))(_0xec82('0x2'));var moment=require(_0xec82('0x3'));var BPromise=require(_0xec82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec82('0x5'));var rimraf=require('rimraf');var config=require(_0xec82('0x6'));var attributes=require(_0xec82('0x7'));module[_0xec82('0x8')]=function(_0x3d201b,_0x3b3ab3){return _0x3d201b[_0xec82('0x9')](_0xec82('0xa'),attributes,{'tableName':_0xec82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec82('0xc'),'collate':_0xec82('0xd')});}; \ No newline at end of file +var _0xd7cd=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x461930,_0x329a2a){var _0x382394=function(_0x58a6c5){while(--_0x58a6c5){_0x461930['push'](_0x461930['shift']());}};_0x382394(++_0x329a2a);}(_0xd7cd,0x188));var _0xdd7c=function(_0x225084,_0x51508b){_0x225084=_0x225084-0x0;var _0x5d3376=_0xd7cd[_0x225084];return _0x5d3376;};'use strict';var _=require(_0xdd7c('0x0'));var util=require('util');var logger=require(_0xdd7c('0x1'))(_0xdd7c('0x2'));var moment=require('moment');var BPromise=require(_0xdd7c('0x3'));var rp=require(_0xdd7c('0x4'));var fs=require('fs');var path=require(_0xdd7c('0x5'));var rimraf=require(_0xdd7c('0x6'));var config=require(_0xdd7c('0x7'));var attributes=require(_0xdd7c('0x8'));module[_0xdd7c('0x9')]=function(_0x3576d3,_0x143ed9){return _0x3576d3[_0xdd7c('0xa')](_0xdd7c('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd7c('0xc'),'collate':_0xdd7c('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index eb6f5f6..50f9d62 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 _0xe651=['then','info','request\x20sent','debug','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0xe651,0x1a5));var _0x1e65=function(_0x26a570,_0x257772){_0x26a570=_0x26a570-0x0;var _0x1d22f1=_0xe651[_0x26a570];return _0x1d22f1;};'use strict';var _=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var moment=require(_0x1e65('0x2'));var BPromise=require(_0x1e65('0x3'));var rs=require(_0x1e65('0x4'));var fs=require('fs');var Redis=require(_0x1e65('0x5'));var db=require(_0x1e65('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e65('0x7'))(_0x1e65('0x8'));var config=require(_0x1e65('0x9'));var jayson=require(_0x1e65('0xa'));var client=jayson[_0x1e65('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3e21,_0x16e767,_0x54f991){return new BPromise(function(_0x3975ae,_0x1f1abb){return client[_0x1e65('0xc')](_0x5f3e21,_0x54f991)[_0x1e65('0xd')](function(_0x35144d){logger[_0x1e65('0xe')]('MailApplication,\x20%s,\x20%s',_0x16e767,_0x1e65('0xf'));logger[_0x1e65('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x16e767,_0x1e65('0xf'),JSON[_0x1e65('0x11')](_0x35144d));if(_0x35144d[_0x1e65('0x12')]){if(_0x35144d[_0x1e65('0x12')]['code']===0x1f4){logger[_0x1e65('0x12')](_0x1e65('0x13'),_0x16e767,_0x35144d['error'][_0x1e65('0x14')]);return _0x1f1abb(_0x35144d[_0x1e65('0x12')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x16e767,_0x35144d[_0x1e65('0x12')][_0x1e65('0x14')]);return _0x3975ae(_0x35144d[_0x1e65('0x12')][_0x1e65('0x14')]);}else{logger['info'](_0x1e65('0x13'),_0x16e767,_0x1e65('0xf'));_0x3975ae(_0x35144d[_0x1e65('0x15')][_0x1e65('0x14')]);}})[_0x1e65('0x16')](function(_0x3acde6){logger[_0x1e65('0x12')](_0x1e65('0x13'),_0x16e767,_0x3acde6);_0x1f1abb(_0x3acde6);});});}exports[_0x1e65('0x17')]=function(_0x506fe3){var _0x413d48=this;return new Promise(function(_0x26107c,_0x325e89){return db[_0x1e65('0x18')][_0x1e65('0x19')](_0x506fe3['body'],{'raw':_0x506fe3[_0x1e65('0x1a')]?_0x506fe3['options'][_0x1e65('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506fe3[_0x1e65('0x1a')]?_0x506fe3['options'][_0x1e65('0x1c')]||null:null,'attributes':_0x506fe3[_0x1e65('0x1a')]?_0x506fe3['options'][_0x1e65('0x1d')]||null:null,'limit':_0x506fe3[_0x1e65('0x1a')]?_0x506fe3['options'][_0x1e65('0x1e')]||null:null})[_0x1e65('0xd')](function(_0x19b071){logger[_0x1e65('0xe')](_0x1e65('0x17'),_0x506fe3);logger[_0x1e65('0x10')](_0x1e65('0x17'),_0x506fe3,JSON['stringify'](_0x19b071));_0x26107c(_0x19b071);})['catch'](function(_0x44d4f2){logger['error'](_0x1e65('0x17'),_0x44d4f2[_0x1e65('0x14')],_0x506fe3);_0x325e89(_0x413d48[_0x1e65('0x12')](0x1f4,_0x44d4f2['message']));});});}; \ No newline at end of file +var _0xea42=['result','catch','MailApplication','update','body','options','where','attributes','limit','then','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message'];(function(_0x55d1cc,_0x2e82a4){var _0x2d9901=function(_0x1de8fa){while(--_0x1de8fa){_0x55d1cc['push'](_0x55d1cc['shift']());}};_0x2d9901(++_0x2e82a4);}(_0xea42,0xc5));var _0x2ea4=function(_0xdd286a,_0x1a45aa){_0xdd286a=_0xdd286a-0x0;var _0x4f65c4=_0xea42[_0xdd286a];return _0x4f65c4;};'use strict';var _=require(_0x2ea4('0x0'));var util=require('util');var moment=require(_0x2ea4('0x1'));var BPromise=require(_0x2ea4('0x2'));var rs=require(_0x2ea4('0x3'));var fs=require('fs');var Redis=require(_0x2ea4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea4('0x5'));var logger=require(_0x2ea4('0x6'))('rpc');var config=require(_0x2ea4('0x7'));var jayson=require(_0x2ea4('0x8'));var client=jayson[_0x2ea4('0x9')][_0x2ea4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c1b33,_0x5cd71e,_0x1669fc){return new BPromise(function(_0x6ca376,_0x27c673){return client[_0x2ea4('0xb')](_0x3c1b33,_0x1669fc)['then'](function(_0x28d402){logger[_0x2ea4('0xc')]('MailApplication,\x20%s,\x20%s',_0x5cd71e,_0x2ea4('0xd'));logger[_0x2ea4('0xe')](_0x2ea4('0xf'),_0x5cd71e,_0x2ea4('0xd'),JSON[_0x2ea4('0x10')](_0x28d402));if(_0x28d402[_0x2ea4('0x11')]){if(_0x28d402[_0x2ea4('0x11')]['code']===0x1f4){logger['error'](_0x2ea4('0x12'),_0x5cd71e,_0x28d402[_0x2ea4('0x11')][_0x2ea4('0x13')]);return _0x27c673(_0x28d402[_0x2ea4('0x11')]['message']);}logger[_0x2ea4('0x11')](_0x2ea4('0x12'),_0x5cd71e,_0x28d402[_0x2ea4('0x11')]['message']);return _0x6ca376(_0x28d402['error']['message']);}else{logger[_0x2ea4('0xc')]('MailApplication,\x20%s,\x20%s',_0x5cd71e,_0x2ea4('0xd'));_0x6ca376(_0x28d402[_0x2ea4('0x14')][_0x2ea4('0x13')]);}})[_0x2ea4('0x15')](function(_0x580418){logger[_0x2ea4('0x11')](_0x2ea4('0x12'),_0x5cd71e,_0x580418);_0x27c673(_0x580418);});});}exports['UpdateMailApplication']=function(_0x144276){var _0x3ca675=this;return new Promise(function(_0x56ae1c,_0x49a126){return db[_0x2ea4('0x16')][_0x2ea4('0x17')](_0x144276[_0x2ea4('0x18')],{'raw':_0x144276['options']?_0x144276['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144276[_0x2ea4('0x19')]?_0x144276['options'][_0x2ea4('0x1a')]||null:null,'attributes':_0x144276['options']?_0x144276[_0x2ea4('0x19')][_0x2ea4('0x1b')]||null:null,'limit':_0x144276[_0x2ea4('0x19')]?_0x144276[_0x2ea4('0x19')][_0x2ea4('0x1c')]||null:null})[_0x2ea4('0x1d')](function(_0x31ee59){logger[_0x2ea4('0xc')]('UpdateMailApplication',_0x144276);logger[_0x2ea4('0xe')](_0x2ea4('0x1e'),_0x144276,JSON[_0x2ea4('0x10')](_0x31ee59));_0x56ae1c(_0x31ee59);})[_0x2ea4('0x15')](function(_0x2428f8){logger[_0x2ea4('0x11')](_0x2ea4('0x1e'),_0x2428f8[_0x2ea4('0x13')],_0x144276);_0x49a126(_0x3ca675[_0x2ea4('0x11')](0x1f4,_0x2428f8[_0x2ea4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9e26fef..4de91e7 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 _0x9e67=['./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','mail','addTags','put','update','delete','destroy','/:id/tags','../../components/interaction/service'];(function(_0x5dab77,_0x55d44b){var _0x150afa=function(_0x5eedb2){while(--_0x5eedb2){_0x5dab77['push'](_0x5dab77['shift']());}};_0x150afa(++_0x55d44b);}(_0x9e67,0x83));var _0x79e6=function(_0x3b188d,_0x49e62e){_0x3b188d=_0x3b188d-0x0;var _0x24b91d=_0x9e67[_0x3b188d];return _0x24b91d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x79e6('0x0'));var controller=require(_0x79e6('0x1'));router[_0x79e6('0x2')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x79e6('0x3'),auth[_0x79e6('0x4')](),controller[_0x79e6('0x5')]);router[_0x79e6('0x2')](_0x79e6('0x6'),auth[_0x79e6('0x4')](),controller[_0x79e6('0x7')]);router['get'](_0x79e6('0x8'),auth[_0x79e6('0x4')](),controller[_0x79e6('0x9')]);router['get'](_0x79e6('0xa'),auth[_0x79e6('0x4')](),controller['download']);router[_0x79e6('0xb')]('/',auth[_0x79e6('0x4')](),controller[_0x79e6('0xc')]);router[_0x79e6('0xb')]('/:id/messages',auth[_0x79e6('0x4')](),controller[_0x79e6('0xd')]);router[_0x79e6('0xb')]('/:id/tags',auth[_0x79e6('0x4')](),interaction[_0x79e6('0xe')](_0x79e6('0xf'),'mailinteraction:addtags'),controller[_0x79e6('0x10')]);router[_0x79e6('0x11')](_0x79e6('0x6'),auth['isAuthenticated'](),interaction[_0x79e6('0xe')](_0x79e6('0xf'),'mailinteraction:update'),controller[_0x79e6('0x12')]);router[_0x79e6('0x13')]('/:id',auth[_0x79e6('0x4')](),interaction[_0x79e6('0xe')](_0x79e6('0xf'),'mailinteraction:destroy'),controller[_0x79e6('0x14')]);router['delete'](_0x79e6('0x15'),auth[_0x79e6('0x4')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xd270=['express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','destroy','delete','removeTags','exports'];(function(_0x3ab3bf,_0x19b76c){var _0x47c5d2=function(_0x272062){while(--_0x272062){_0x3ab3bf['push'](_0x3ab3bf['shift']());}};_0x47c5d2(++_0x19b76c);}(_0xd270,0xa8));var _0x0d27=function(_0x3aed72,_0x46eb13){_0x3aed72=_0x3aed72-0x0;var _0x1a84dc=_0xd270[_0x3aed72];return _0x1a84dc;};'use strict';var express=require(_0x0d27('0x0'));var router=express[_0x0d27('0x1')]();var auth=require(_0x0d27('0x2'));var interaction=require(_0x0d27('0x3'));var controller=require(_0x0d27('0x4'));router[_0x0d27('0x5')]('/',auth['isAuthenticated'](),controller[_0x0d27('0x6')]);router[_0x0d27('0x5')](_0x0d27('0x7'),auth[_0x0d27('0x8')](),controller['describe']);router[_0x0d27('0x5')](_0x0d27('0x9'),auth[_0x0d27('0x8')](),controller[_0x0d27('0xa')]);router[_0x0d27('0x5')](_0x0d27('0xb'),auth['isAuthenticated'](),controller[_0x0d27('0xc')]);router[_0x0d27('0x5')]('/:id/download',auth[_0x0d27('0x8')](),controller['download']);router[_0x0d27('0xd')]('/',auth[_0x0d27('0x8')](),controller[_0x0d27('0xe')]);router[_0x0d27('0xd')](_0x0d27('0xb'),auth['isAuthenticated'](),controller[_0x0d27('0xf')]);router['post'](_0x0d27('0x10'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')](_0x0d27('0x12'),_0x0d27('0x13')),controller[_0x0d27('0x14')]);router[_0x0d27('0x15')](_0x0d27('0x9'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')](_0x0d27('0x12'),_0x0d27('0x16')),controller[_0x0d27('0x17')]);router['delete'](_0x0d27('0x9'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')]('mail','mailinteraction:destroy'),controller[_0x0d27('0x18')]);router[_0x0d27('0x19')]('/:id/tags',auth[_0x0d27('0x8')](),controller[_0x0d27('0x1a')]);module[_0x0d27('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1e563ef..de3ec9c 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 _0x8b98=['iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize'];(function(_0xbd89a5,_0x1dbc43){var _0x318560=function(_0x4192c6){while(--_0x4192c6){_0xbd89a5['push'](_0xbd89a5['shift']());}};_0x318560(++_0x1dbc43);}(_0x8b98,0xd7));var _0x88b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8b98[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x88b9('0x0'));var iconv=require(_0x88b9('0x1'));module['exports']={'closed':{'type':Sequelize[_0x88b9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x88b9('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x88b9('0x4')]},'note':{'type':Sequelize[_0x88b9('0x4')]},'inReplyTo':{'type':Sequelize[_0x88b9('0x4')](0x1fe)},'to':{'type':Sequelize[_0x88b9('0x4')]},'cc':{'type':Sequelize[_0x88b9('0x5')](_0x88b9('0x6'))},'subject':{'type':Sequelize[_0x88b9('0x5')]()},'attach':{'type':Sequelize[_0x88b9('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x88b9('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x88b9('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x88b9('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x88b9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb06c=['BOOLEAN','out','ENUM','iconv','exports','DATE','STRING','TEXT'];(function(_0x4b90b3,_0x164fb2){var _0x45472e=function(_0x4580d3){while(--_0x4580d3){_0x4b90b3['push'](_0x4b90b3['shift']());}};_0x45472e(++_0x164fb2);}(_0xb06c,0x123));var _0xcb06=function(_0x5ecba7,_0x1c881d){_0x5ecba7=_0x5ecba7-0x0;var _0x4a0c4d=_0xb06c[_0x5ecba7];return _0x4a0c4d;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xcb06('0x0'));module[_0xcb06('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb06('0x2')]},'disposition':{'type':Sequelize[_0xcb06('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcb06('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcb06('0x3')](0x1fe)},'to':{'type':Sequelize[_0xcb06('0x3')]},'cc':{'type':Sequelize[_0xcb06('0x4')]('long')},'subject':{'type':Sequelize[_0xcb06('0x4')]()},'attach':{'type':Sequelize[_0xcb06('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcb06('0x2')]},'substatus':{'type':Sequelize[_0xcb06('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xcb06('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xcb06('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb06('0x7')]('in',_0xcb06('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcb06('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d657a99..ac0fe66 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 _0x83d3=['sqlOperator','conditions','length','find','unreadMessages','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','value','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','enableEmailPreview','rows','params','includeAll','options','create','body','update','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','addTags','spread','findAll','color','emit','removeTags','unix','root','files','join','server','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','createdAt','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','squel','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','catch','talking','answered','unmanaged','total','closed','UserId','waiting','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','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','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0x83d3,0x17c));var _0x383d=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x83d3[_0x5a7d41];return _0x98d8fa;};'use strict';var emlformat=require(_0x383d('0x0'));var rimraf=require(_0x383d('0x1'));var zipdir=require(_0x383d('0x2'));var moment=require(_0x383d('0x3'));var BPromise=require(_0x383d('0x4'));var util=require('util');var path=require(_0x383d('0x5'));var fs=require('fs');var _=require(_0x383d('0x6'));var squel=require(_0x383d('0x7'));var juice=require(_0x383d('0x8'));var Redis=require('ioredis');var qs=require(_0x383d('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x383d('0xa'));var config=require(_0x383d('0xb'));var db=require(_0x383d('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x383d('0xd')]=_['defaults'](config['redis'],{'host':_0x383d('0xe'),'port':0x18eb});var socket=require(_0x383d('0xf'))(new Redis(config['redis']));require(_0x383d('0x10'))[_0x383d('0x11')](socket);function respondWithStatusCode(_0x1db3ca,_0x1542db){_0x1542db=_0x1542db||0xcc;return function(_0x42a26d){if(_0x42a26d){return _0x1db3ca[_0x383d('0x12')](_0x1542db);}return _0x1db3ca['status'](_0x1542db)['end']();};}function respondWithResult(_0x4f357c,_0x15e7cf){_0x15e7cf=_0x15e7cf||0xc8;return function(_0x538c32){if(_0x538c32){return _0x4f357c[_0x383d('0x13')](_0x15e7cf)[_0x383d('0x14')](_0x538c32);}};}function respondWithFilteredResult(_0x207c1a,_0x3a57f0){return function(_0x4c6d4f){if(_0x4c6d4f){var _0x556fee=typeof _0x3a57f0[_0x383d('0x15')]==='undefined'&&typeof _0x3a57f0[_0x383d('0x16')]==='undefined';var _0x531e18=_0x4c6d4f[_0x383d('0x17')];var _0x31abf5=_0x556fee?0x0:_0x3a57f0['offset'];var _0x55ce21=_0x556fee?_0x4c6d4f[_0x383d('0x17')]:_0x3a57f0[_0x383d('0x15')]+_0x3a57f0['limit'];var _0x475a84;if(_0x55ce21>=_0x531e18){_0x55ce21=_0x531e18;_0x475a84=0xc8;}else{_0x475a84=0xce;}_0x207c1a[_0x383d('0x13')](_0x475a84);return _0x207c1a[_0x383d('0x18')](_0x383d('0x19'),_0x31abf5+'-'+_0x55ce21+'/'+_0x531e18)[_0x383d('0x14')](_0x4c6d4f);}return null;};}function saveUpdates(_0x38a2d7){return function(_0x250327){if(_0x250327){return _0x250327['update'](_0x38a2d7)[_0x383d('0x1a')](function(_0x967e75){return _0x967e75;});}return null;};}function removeEntity(_0x18b93a){return function(_0x324ec4){if(_0x324ec4){return _0x324ec4[_0x383d('0x1b')]()[_0x383d('0x1a')](function(){_0x18b93a[_0x383d('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb2d7){return function(_0x25f1ac){if(!_0x25f1ac){_0x4bb2d7[_0x383d('0x12')](0x194);}return _0x25f1ac;};}function handleError(_0x4e3d9e,_0x17d883){_0x17d883=_0x17d883||0x1f4;return function(_0x885aa1){logger[_0x383d('0x1c')](_0x885aa1[_0x383d('0x1d')]);if(_0x885aa1[_0x383d('0x1e')]){delete _0x885aa1[_0x383d('0x1e')];}_0x4e3d9e[_0x383d('0x13')](_0x17d883)[_0x383d('0x1f')](_0x885aa1);};}function getInteractionUsers(_0x1a3933,_0xd4ce78){return new BPromise(function(_0x4b2e89,_0x599756){try{if(_0xd4ce78[_0x1a3933['id']]){_0x1a3933[_0x383d('0x20')]=_[_0x383d('0x21')](_0xd4ce78[_0x1a3933['id']],function(_0x22ce84){return{'id':_0x22ce84['id'],'fullname':_0x22ce84[_0x383d('0x22')]};});}}catch(_0x267643){_0x599756(_0x267643);}_0x4b2e89(_0x1a3933);});}function getInteractionTags(_0x1d553b,_0x40b06b){return new BPromise(function(_0x4e1d6e,_0x1db6ad){try{if(_0x1d553b[_0x383d('0x23')]){_0x1d553b['Tags']=[];_0x1d553b['TagIds'][_0x383d('0x24')](',')[_0x383d('0x25')](function(_0x13f872){_0x1d553b[_0x383d('0x26')][_0x383d('0x27')](_0x40b06b[_0x13f872]);});}delete _0x1d553b[_0x383d('0x23')];}catch(_0x5deee9){_0x1db6ad(_0x5deee9);}_0x4e1d6e(_0x1d553b);});}function getLastMessageText(_0x1756cd){return new BPromise(function(_0x531b1a,_0x543b8d){return db[_0x383d('0x28')][_0x383d('0x29')]({'where':{'$and':[{'MailInteractionId':_0x1756cd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x383d('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x383d('0x2b'),'raw':!![]})[_0x383d('0x1a')](function(_0x4f8cbf){if(_0x4f8cbf&&_0x4f8cbf[_0x383d('0x2c')]){_0x1756cd[_0x383d('0x2d')]=_['trimStart'](_0x4f8cbf[_0x383d('0x2c')]);}_0x531b1a(_0x1756cd);})['catch'](function(_0x1617ce){_0x543b8d(_0x1617ce);});});}function updateMailInteraction(_0x291014,_0x569176,_0x13b49a,_0x5b76d8){return new BPromise(function(_0x38ddfa,_0x540731){return getInteractionUsers(_0x291014,_0x13b49a)[_0x383d('0x1a')](function(_0x47b74b){return getInteractionTags(_0x47b74b,_0x569176);})[_0x383d('0x1a')](function(_0x5f0522){return getStateInteraction(_0x5f0522);})[_0x383d('0x1a')](function(_0x325798){if(_0x5b76d8){_0x38ddfa(getLastMessageText(_0x325798));}else{_0x38ddfa(_0x325798);}})[_0x383d('0x2e')](function(_0x3b20e6){_0x540731(_0x3b20e6);});});}function getStateInteraction(_0x48a2a9){return new BPromise(function(_0x28254f){_0x48a2a9['waiting']=0x0;_0x48a2a9[_0x383d('0x2f')]=0x0;_0x48a2a9[_0x383d('0x30')]=0x0;_0x48a2a9[_0x383d('0x31')]=0x0;_0x48a2a9[_0x383d('0x32')]=0x0;if(!_0x48a2a9[_0x383d('0x33')]&&!_0x48a2a9[_0x383d('0x34')]){_0x48a2a9['waiting']+=0x1;}if(!_0x48a2a9[_0x383d('0x33')]&&_0x48a2a9[_0x383d('0x34')]){_0x48a2a9[_0x383d('0x2f')]+=0x1;if(_0x48a2a9['waiting']){_0x48a2a9[_0x383d('0x35')]-=0x1;}}if(_0x48a2a9[_0x383d('0x33')]&&_0x48a2a9[_0x383d('0x34')]){_0x48a2a9['answered']+=0x1;if(_0x48a2a9[_0x383d('0x2f')]){_0x48a2a9[_0x383d('0x2f')]-=0x1;}}if(_0x48a2a9[_0x383d('0x33')]&&!_0x48a2a9['UserId']){_0x48a2a9[_0x383d('0x31')]+=0x1;if(_0x48a2a9['waiting']){_0x48a2a9[_0x383d('0x35')]-=0x1;}}_0x48a2a9[_0x383d('0x32')]+=0x1;_0x28254f(_0x48a2a9);});}exports['index']=function(_0x5e5e4f,_0x8ba653){var _0x36ed88={},_0x16ebc3={},_0x170a89={'count':0x0,'rows':[]};var _0x37329c=_[_0x383d('0x21')](db[_0x383d('0x36')][_0x383d('0x37')],function(_0x59b1a9){return{'name':_0x59b1a9[_0x383d('0x38')],'type':_0x59b1a9[_0x383d('0x39')]['key']};});_0x16ebc3[_0x383d('0x3a')]=_[_0x383d('0x21')](_0x37329c,_0x383d('0x1e'));_0x16ebc3[_0x383d('0x3b')]=_[_0x383d('0x3c')](_0x5e5e4f[_0x383d('0x3b')]);_0x16ebc3[_0x383d('0x3d')]=_[_0x383d('0x3e')](_0x16ebc3[_0x383d('0x3a')],_0x16ebc3['query']);_0x36ed88[_0x383d('0x3f')]=_[_0x383d('0x3e')](_0x16ebc3[_0x383d('0x3a')],qs['fields'](_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x40')]));_0x36ed88[_0x383d('0x3f')]=_0x36ed88['attributes']['length']?_0x36ed88[_0x383d('0x3f')]:_0x16ebc3['model'];if(!_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x41')](_0x383d('0x42'))){_0x36ed88[_0x383d('0x16')]=qs[_0x383d('0x16')](_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x16')]);_0x36ed88[_0x383d('0x15')]=qs[_0x383d('0x15')](_0x5e5e4f[_0x383d('0x3b')]['offset']);}_0x36ed88[_0x383d('0x43')]=qs[_0x383d('0x44')](_0x5e5e4f['query'][_0x383d('0x44')]);_0x36ed88[_0x383d('0x45')]=qs['filters'](_[_0x383d('0x46')](_0x5e5e4f['query'],_0x16ebc3[_0x383d('0x3d')]),_0x37329c);var _0x562775=[];var _0x53b25c=squel[_0x383d('0x47')]()[_0x383d('0x48')]('id')[_0x383d('0x48')](_0x383d('0x1e'))[_0x383d('0x48')]('color')[_0x383d('0x49')](_0x383d('0x4a'));var _0x40f6e9=squel[_0x383d('0x47')]()['field'](_0x383d('0x4b'))[_0x383d('0x48')](_0x383d('0x4c'))[_0x383d('0x48')](_0x383d('0x4d'))['from'](_0x383d('0x4e'),'ui')[_0x383d('0x4f')](_0x383d('0x50'),'u',_0x383d('0x51'));var _0x238360=squel[_0x383d('0x47')]()[_0x383d('0x49')](_0x383d('0x52'),'i')[_0x383d('0x4f')](_0x383d('0x53'),'c',_0x383d('0x54'))[_0x383d('0x4f')](_0x383d('0x50'),'o',_0x383d('0x55'))[_0x383d('0x4f')](_0x383d('0x56'),'a',_0x383d('0x57'))[_0x383d('0x4f')](_0x383d('0x58'),'me',_0x383d('0x59'))['left_join'](_0x383d('0x5a'),'it',_0x383d('0x5b'))[_0x383d('0x4f')](_0x383d('0x4a'),'t',_0x383d('0x5c'));var _0x180ecd=squel[_0x383d('0x5d')]();var _0x2c1bc8=[];var _0x5b49e7=squel['expr']();var _0x573b50;if(_0x5e5e4f[_0x383d('0x3b')]['search']){_0x573b50=as[_0x383d('0x5e')](_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x5f')]);var _0x309d71=_0x573b50[_0x383d('0x60')];for(var _0x19068e=0x0;_0x19068e<_0x573b50[_0x383d('0x61')][_0x383d('0x62')];_0x19068e++){var _0x22e83d=_0x573b50[_0x383d('0x61')][_0x19068e];var _0x5892ac='i';var _0x5e6008=_[_0x383d('0x63')](_0x37329c,['name',_0x22e83d[_0x383d('0x48')]]);if(!_0x5e6008){switch(_0x22e83d['field']){case _0x383d('0x64'):if(_0x22e83d['value']==0x1){_0x238360[_0x383d('0x65')]('`'+_0x22e83d['field']+_0x383d('0x66'));}else{_0x238360[_0x383d('0x65')]('`'+_0x22e83d[_0x383d('0x48')]+_0x383d('0x67'));}break;case _0x383d('0x68'):if(_0x22e83d[_0x383d('0x69')]===_0x383d('0x6a')){if(_0x22e83d['value'][_0x383d('0x24')]('\x20')['length']>0x1){_0x180ecd[_0x309d71](_0x383d('0x6b'),qs[_0x383d('0x6c')](_0x22e83d[_0x383d('0x6d')]),null);}else{var _0x318c0f='%'+_0x22e83d[_0x383d('0x6d')]+'%';_0x180ecd[_0x309d71]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x318c0f,_0x318c0f,_0x318c0f);}}else{_0x5e6008=_[_0x383d('0x63')](_0x37329c,[_0x383d('0x1e'),'ContactId']);_0x22e83d['field']=_0x383d('0x6e');_0x2a6543=as[_0x383d('0x6f')](_0x5892ac,_0x5e6008['type'],_0x22e83d);_0x180ecd[_0x309d71](_0x2a6543[_0x383d('0x70')],_0x2a6543[_0x383d('0x6d')][_0x383d('0x71')],_0x2a6543[_0x383d('0x6d')][_0x383d('0x72')]);}break;case _0x383d('0x73'):var _0x16f639=_0x22e83d['value']['split'](',')[_0x383d('0x21')](function(_0x30d850){return Number(_0x30d850);});_0x16f639[_0x383d('0x25')](function(_0x372d74){_0x5b49e7['or'](_0x383d('0x74'),'%,'+_0x372d74+',%');});_0x2c1bc8=_[_0x383d('0x75')](_0x2c1bc8,_0x16f639);break;case'User':if(_0x22e83d[_0x383d('0x69')]===_0x383d('0x6a')){_0x180ecd[_0x309d71](_0x383d('0x76'),'%'+_0x22e83d[_0x383d('0x6d')]+'%',null);}else{_0x5e6008=_[_0x383d('0x63')](_0x37329c,[_0x383d('0x1e'),'UserId']);_0x22e83d[_0x383d('0x48')]=_0x383d('0x34');_0x2a6543=as['buildExpression'](_0x5892ac,_0x5e6008[_0x383d('0x39')],_0x22e83d);_0x180ecd[_0x309d71](_0x2a6543[_0x383d('0x70')],_0x2a6543['value'][_0x383d('0x71')],_0x2a6543[_0x383d('0x6d')][_0x383d('0x72')]);}break;case _0x383d('0x2c'):_0x2a6543=as[_0x383d('0x6f')]('me',null,_0x22e83d);_0x180ecd[_0x309d71](_0x2a6543[_0x383d('0x70')],_0x2a6543[_0x383d('0x6d')][_0x383d('0x71')],_0x2a6543[_0x383d('0x6d')][_0x383d('0x72')]);break;}}else{var _0x2a6543=as[_0x383d('0x6f')](_0x5892ac,_0x5e6008[_0x383d('0x39')],_0x22e83d);_0x180ecd[_0x309d71](_0x2a6543['text'],_0x2a6543[_0x383d('0x6d')][_0x383d('0x71')],_0x2a6543[_0x383d('0x6d')]['end']);}}}else{var _0x367ba1=_(_0x5e5e4f['query'])[_0x383d('0x3c')]()[_0x383d('0x21')](function(_0xcc9c09){return _[_0x383d('0x77')](_0x37329c,[_0x383d('0x1e'),_0xcc9c09])?_0xcc9c09:undefined;})[_0x383d('0x78')]()['value']();if(!_[_0x383d('0x79')](_0x367ba1)){_0x367ba1[_0x383d('0x25')](function(_0x49e16b){if(_0x49e16b==='MailAccountId'){_0x238360[_0x383d('0x45')](_0x383d('0x7a'),[][_0x383d('0x7b')](_0x5e5e4f[_0x383d('0x3b')][_0x49e16b]));}else if(_0x49e16b==='createdAt'){var _0x1e4367=JSON[_0x383d('0x7c')](_0x5e5e4f[_0x383d('0x3b')][_0x49e16b])[_0x383d('0x7d')];var _0xae9e6a=JSON[_0x383d('0x7c')](_0x5e5e4f[_0x383d('0x3b')][_0x49e16b])['$lte'];_0x238360[_0x383d('0x45')](_0x383d('0x7e'),_0x1e4367,_0xae9e6a);}else{if(_0x5e5e4f['query'][_0x49e16b]===_0x383d('0x7f')){_0x238360['where']('i.'+_0x49e16b+_0x383d('0x80'));}else{_0x238360[_0x383d('0x45')]('i.'+_0x49e16b+_0x383d('0x81'),_0x5e5e4f[_0x383d('0x3b')][_0x49e16b]);}}});}if(_0x5e5e4f['query']['read']){if(_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x82')]==0x1){_0x238360[_0x383d('0x65')](_0x383d('0x83'));}else{_0x238360[_0x383d('0x65')](_0x383d('0x84'));}}if(_0x5e5e4f['query'][_0x383d('0x85')]){_0x2c1bc8=_['isArray'](_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x85')])?_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x85')]:new Array(_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x85')]);_0x2c1bc8[_0x383d('0x25')](function(_0x1feaaf){_0x5b49e7['or'](_0x383d('0x74'),'%,'+_0x1feaaf+',%');});}if(_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x86')]){var _0x456100=_0x5e5e4f['query'][_0x383d('0x86')][_0x383d('0x87')]('\x5c','\x5c\x5c')[_0x383d('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x456100)){_0x180ecd['or'](_0x383d('0x88'),_0x456100+'%');}else if(qs[_0x383d('0x89')](_0x456100)){_0x180ecd['or'](_0x383d('0x8a'),_0x456100+'%');}else{_0x180ecd['or'](_0x383d('0x8b'),qs['getFullTextValue'](_0x456100))['or'](_0x383d('0x8c'),qs['getFullTextValue'](_0x456100));}}}_0x238360['where'](_0x180ecd);_0x238360[_0x383d('0x8d')]('i.id');var _0x2d57cd={'type':db[_0x383d('0x8e')]['QueryTypes'][_0x383d('0x8f')],'raw':!![]};var _0x4db108=_0x238360[_0x383d('0x90')]();_0x4db108[_0x383d('0x48')](_0x383d('0x91'));_0x4db108[_0x383d('0x48')](_0x383d('0x92'),'unreadMessages');if(_0x36ed88['order']){_0x36ed88[_0x383d('0x43')][_0x383d('0x25')](function(_0x4a5cde){var _0x478386=_0x4a5cde[0x0]==='contactName'?_0x4a5cde[0x0]:'i.'+_0x4a5cde[0x0];_0x238360['order'](_0x478386,_0x4a5cde[0x1]===_0x383d('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x2c1bc8)){_0x238360[_0x383d('0x65')](_0x5b49e7);_0x4db108[_0x383d('0x45')]('t.id\x20IN\x20?',_0x2c1bc8);}BPromise[_0x383d('0x94')]()[_0x383d('0x1a')](function(){if(!_0x573b50){if(_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x95')])return;_0x4db108[_0x383d('0x45')](_0x383d('0x96'));_0x238360[_0x383d('0x45')](_0x383d('0x96'));return;}if(_0x5e5e4f[_0x383d('0x97')][_0x383d('0x98')]!==_0x383d('0x99'))return;return _0x5e5e4f[_0x383d('0x97')][_0x383d('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4bef72){if(_[_0x383d('0x79')](_0x4bef72)){_0x4db108[_0x383d('0x45')]('i.MailAccountId\x20IS\x20NULL');_0x238360['where'](_0x383d('0x9b'));}else{_0x4db108[_0x383d('0x45')](_0x383d('0x7a'),_[_0x383d('0x21')](_0x4bef72,'id'));_0x238360['where'](_0x383d('0x7a'),_[_0x383d('0x21')](_0x4bef72,'id'));}});})['then'](function(){if(_0x5e5e4f[_0x383d('0x97')][_0x383d('0x98')]===_0x383d('0x99')&&!_0x573b50&&!_0x5e5e4f[_0x383d('0x3b')][_0x383d('0x95')])return[];return db[_0x383d('0x9c')]['query'](_0x4db108[_0x383d('0x9d')](),_0x2d57cd);})[_0x383d('0x1a')](function(_0x56ef7d){_0x170a89[_0x383d('0x17')]=_0x56ef7d['length'];if(_0x170a89[_0x383d('0x17')]===0x0)return[];return db[_0x383d('0x9c')][_0x383d('0x3b')](_0x53b25c['toString'](),_0x2d57cd)[_0x383d('0x1a')](function(_0x1bbaa9){_0x562775=_['keyBy'](_0x1bbaa9,'id');_0x2d57cd=_[_0x383d('0x9e')](_0x2d57cd,{'model':db[_0x383d('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e5e4f['query'][_0x383d('0x40')]){_0x36ed88['attributes'][_0x383d('0x25')](function(_0x463c1f){_0x238360[_0x383d('0x48')]('i.'+_0x463c1f);});}else{_0x238360['field'](_0x383d('0x92'),'unreadMessages');_0x238360[_0x383d('0x48')]('a.key',_0x383d('0x9f'));_0x238360[_0x383d('0x48')](_0x383d('0xa0'),_0x383d('0xa1'));_0x238360[_0x383d('0x48')](_0x383d('0xa2'),_0x383d('0xa3'));_0x238360[_0x383d('0x48')](_0x383d('0xa4'),_0x383d('0xa5'));_0x238360[_0x383d('0x48')](_0x383d('0x91'));_0x238360[_0x383d('0x48')]('i.createdAt');_0x238360['field'](_0x383d('0xa6'));_0x238360[_0x383d('0x48')]('i.closed');_0x238360[_0x383d('0x48')](_0x383d('0xa7'));_0x238360[_0x383d('0x48')](_0x383d('0xa8'));_0x238360[_0x383d('0x48')](_0x383d('0xa9'));_0x238360[_0x383d('0x48')]('i.lastMsgDirection');_0x238360['field'](_0x383d('0xaa'));_0x238360['field'](_0x383d('0xab'));_0x238360[_0x383d('0x48')](_0x383d('0xac'));_0x238360[_0x383d('0x48')](_0x383d('0xad'));_0x238360[_0x383d('0x48')](_0x383d('0xae'));_0x238360[_0x383d('0x48')](_0x383d('0xaf'));_0x238360[_0x383d('0x48')](_0x383d('0xb0'));_0x238360[_0x383d('0x48')](_0x383d('0xb1'));_0x238360['field'](_0x383d('0xb2'));_0x238360[_0x383d('0x48')]('c.firstName','Contact.firstName');_0x238360[_0x383d('0x48')](_0x383d('0xb3'),'Contact.lastName');_0x238360[_0x383d('0x48')](_0x383d('0xb4'),_0x383d('0xb5'));_0x238360[_0x383d('0x48')](_0x383d('0xb6'),_0x383d('0xb7'));_0x238360[_0x383d('0x48')](_0x383d('0xb8'),_0x383d('0xb9'));_0x238360['field']('c.fax',_0x383d('0xba'));_0x238360[_0x383d('0x48')](_0x383d('0xbb'),_0x383d('0xbc'));_0x238360[_0x383d('0x48')](_0x383d('0xbd'),_0x383d('0xbe'));_0x238360[_0x383d('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x383d('0x23'));}if(_0x36ed88[_0x383d('0x16')])_0x238360['limit'](_0x36ed88[_0x383d('0x16')]);if(_0x36ed88[_0x383d('0x15')])_0x238360[_0x383d('0x15')](_0x36ed88[_0x383d('0x15')]);return db['sequelize'][_0x383d('0x3b')](_0x238360[_0x383d('0x9d')](),_0x2d57cd);})[_0x383d('0x1a')](function(_0x31344f){if(_0x31344f[_0x383d('0x62')]>0x0)_0x40f6e9['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x31344f,'id'));return db['sequelize']['query'](_0x40f6e9['toString'](),_0x2d57cd)[_0x383d('0x1a')](function(_0x5f369a){var _0x5a599a=_['groupBy'](_0x5f369a,'MailInteractionId');var _0x391e27=[];return db['Setting'][_0x383d('0x29')]({'attributes':[_0x383d('0xbf')],'raw':!![]})[_0x383d('0x1a')](function(_0x31b07c){var _0x1343ea=_0x31b07c['enableEmailPreview'];_0x31344f[_0x383d('0x25')](function(_0x2e44a6){_0x391e27[_0x383d('0x27')](updateMailInteraction(_0x2e44a6,_0x562775,_0x5a599a,_0x1343ea));});return BPromise['all'](_0x391e27);});});});})['then'](function(_0x42b58a){_0x170a89[_0x383d('0xc0')]=_0x42b58a;return _0x170a89;})[_0x383d('0x1a')](respondWithFilteredResult(_0x8ba653,_0x36ed88))[_0x383d('0x2e')](handleError(_0x8ba653,null));};exports['show']=function(_0x35eb2f,_0x49306e){var _0x39db27={'raw':![],'where':{'id':_0x35eb2f[_0x383d('0xc1')]['id']}},_0x44303c={};_0x44303c[_0x383d('0x3a')]=_[_0x383d('0x3c')](db[_0x383d('0x36')][_0x383d('0x37')]);_0x44303c[_0x383d('0x3b')]=_[_0x383d('0x3c')](_0x35eb2f[_0x383d('0x3b')]);_0x44303c[_0x383d('0x3d')]=_[_0x383d('0x3e')](_0x44303c[_0x383d('0x3a')],_0x44303c['query']);_0x39db27['attributes']=_[_0x383d('0x3e')](_0x44303c[_0x383d('0x3a')],qs[_0x383d('0x40')](_0x35eb2f[_0x383d('0x3b')][_0x383d('0x40')]));_0x39db27[_0x383d('0x3f')]=_0x39db27[_0x383d('0x3f')][_0x383d('0x62')]?_0x39db27[_0x383d('0x3f')]:_0x44303c[_0x383d('0x3a')];if(_0x35eb2f[_0x383d('0x3b')][_0x383d('0xc2')]){_0x39db27['include']=[{'all':!![]}];}_0x39db27=_['merge']({},_0x39db27,_0x35eb2f[_0x383d('0xc3')]);return db[_0x383d('0x36')]['find'](_0x39db27)[_0x383d('0x1a')](handleEntityNotFound(_0x49306e,null))[_0x383d('0x1a')](respondWithResult(_0x49306e,null))['catch'](handleError(_0x49306e,null));};exports[_0x383d('0xc4')]=function(_0x18936,_0x27f752){return db[_0x383d('0x36')][_0x383d('0xc4')](_0x18936[_0x383d('0xc5')],{})[_0x383d('0x1a')](respondWithResult(_0x27f752,0xc9))[_0x383d('0x2e')](handleError(_0x27f752,null));};exports[_0x383d('0xc6')]=function(_0x2e6237,_0x3f0feb){if(_0x2e6237[_0x383d('0xc5')]['id']){delete _0x2e6237[_0x383d('0xc5')]['id'];}return db[_0x383d('0x36')]['find']({'where':{'id':_0x2e6237['params']['id']}})[_0x383d('0x1a')](handleEntityNotFound(_0x3f0feb,null))[_0x383d('0x1a')](saveUpdates(_0x2e6237['body'],null))['then'](respondWithResult(_0x3f0feb,null))[_0x383d('0x2e')](handleError(_0x3f0feb,null));};exports['destroy']=function(_0x379260,_0x50a2e5){return db[_0x383d('0x36')]['find']({'where':{'id':_0x379260['params']['id']}})[_0x383d('0x1a')](handleEntityNotFound(_0x50a2e5,null))['then'](removeEntity(_0x50a2e5,null))['catch'](handleError(_0x50a2e5,null));};exports[_0x383d('0xc7')]=function(_0x37b26c,_0x5ae0ab){return db[_0x383d('0x36')][_0x383d('0xc7')]()[_0x383d('0x1a')](respondWithResult(_0x5ae0ab,null))[_0x383d('0x2e')](handleError(_0x5ae0ab,null));};exports[_0x383d('0xc8')]=function(_0x5294d,_0x4a95b3){return db[_0x383d('0x28')][_0x383d('0x63')]({'where':{'id':_0x5294d[_0x383d('0xc1')]['id']}})['then'](handleEntityNotFound(_0x4a95b3,null))[_0x383d('0x1a')](function(_0x4f45b7){if(_0x4f45b7){return _0x4f45b7[_0x383d('0xc8')](_0x5294d[_0x383d('0xc5')][_0x383d('0xc9')],_[_0x383d('0xca')](_0x5294d[_0x383d('0xc5')],[_0x383d('0xc9'),'id'])||{});}})[_0x383d('0x1a')](respondWithResult(_0x4a95b3,null))[_0x383d('0x2e')](handleError(_0x4a95b3,null));};exports[_0x383d('0xcb')]=function(_0x3e33b7,_0x3e1717){var _0x35c8b0={'raw':![],'where':{}};var _0x477378={};var _0x2ad001={'count':0x0,'rows':[]};return db[_0x383d('0x36')][_0x383d('0x29')]({'where':{'id':_0x3e33b7['params']['id']}})[_0x383d('0x1a')](handleEntityNotFound(_0x3e1717,null))[_0x383d('0x1a')](function(_0x121f39){if(_0x121f39){_0x477378[_0x383d('0x3a')]=_[_0x383d('0x3c')](db[_0x383d('0x28')]['rawAttributes']);_0x477378[_0x383d('0x3b')]=_[_0x383d('0x3c')](_0x3e33b7[_0x383d('0x3b')]);_0x477378[_0x383d('0x3d')]=_['intersection'](_0x477378[_0x383d('0x3a')],_0x477378[_0x383d('0x3b')]);_0x35c8b0[_0x383d('0x3f')]=_[_0x383d('0x3e')](_0x477378[_0x383d('0x3a')],qs[_0x383d('0x40')](_0x3e33b7[_0x383d('0x3b')][_0x383d('0x40')]));_0x35c8b0['attributes']=_0x35c8b0[_0x383d('0x3f')][_0x383d('0x62')]?_0x35c8b0[_0x383d('0x3f')]:_0x477378[_0x383d('0x3a')];if(!_0x3e33b7[_0x383d('0x3b')][_0x383d('0x41')](_0x383d('0x42'))){_0x35c8b0[_0x383d('0x16')]=qs[_0x383d('0x16')](_0x3e33b7[_0x383d('0x3b')][_0x383d('0x16')]);_0x35c8b0['offset']=qs[_0x383d('0x15')](_0x3e33b7['query'][_0x383d('0x15')]);}_0x35c8b0[_0x383d('0x43')]=qs[_0x383d('0x44')](_0x3e33b7['query']['sort']);_0x35c8b0['where']=qs[_0x383d('0x3d')](_[_0x383d('0x46')](_0x3e33b7[_0x383d('0x3b')],_0x477378['filters']));_0x35c8b0[_0x383d('0x45')]['MailInteractionId']=_0x121f39['id'];if(_0x3e33b7[_0x383d('0x3b')][_0x383d('0x86')]){_0x35c8b0[_0x383d('0x45')]=_[_0x383d('0x9e')](_0x35c8b0[_0x383d('0x45')],{'$or':_['map'](_0x35c8b0[_0x383d('0x3f')],function(_0x48399f){var _0x5ed0ae={};_0x5ed0ae[_0x48399f]={'$like':'%'+_0x3e33b7[_0x383d('0x3b')]['filter']+'%'};return _0x5ed0ae;})});}if(_0x3e33b7['query']['$gte']){var _0x10cef8=_0x3e33b7[_0x383d('0x3b')][_0x383d('0x7d')][_0x383d('0x24')](',');var _0x558c5c={};_0x558c5c[_0x10cef8[0x0]]={'$gte':moment(_0x10cef8[0x1])[_0x383d('0xcc')](_0x383d('0xcd'))};_0x35c8b0['where']=_[_0x383d('0x9e')](_0x35c8b0[_0x383d('0x45')],_0x558c5c);}_0x35c8b0=_['merge']({},_0x35c8b0,_0x3e33b7['options']);return db['MailMessage'][_0x383d('0x17')]({'where':_0x35c8b0[_0x383d('0x45')]})['then'](function(_0x427494){_0x2ad001[_0x383d('0x17')]=_0x427494;if(_0x3e33b7[_0x383d('0x3b')][_0x383d('0xc2')]){_0x35c8b0[_0x383d('0xce')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x35c8b0);})['then'](function(_0x52f936){if(_0x3e33b7[_0x383d('0x3b')][_0x383d('0xcf')]===_0x383d('0xd0')){for(var _0x1b8cf8=0x0;_0x1b8cf8<_0x52f936[_0x383d('0x62')];_0x1b8cf8++){_0x52f936[_0x1b8cf8][_0x383d('0xc5')]=juice(_0x52f936[_0x1b8cf8][_0x383d('0xc5')]);}}_0x2ad001['rows']=_0x52f936;return _0x2ad001;});}})[_0x383d('0x1a')](respondWithFilteredResult(_0x3e1717,_0x35c8b0))[_0x383d('0x2e')](handleError(_0x3e1717,null));};exports[_0x383d('0xd1')]=function(_0x119699,_0x59a166){return db[_0x383d('0x36')][_0x383d('0x63')]({'where':{'id':_0x119699['params']['id']}})[_0x383d('0x1a')](handleEntityNotFound(_0x59a166,null))[_0x383d('0x1a')](function(_0x344120){if(_0x344120){return _0x344120['setTags'](_0x119699[_0x383d('0xc5')][_0x383d('0xc9')],_[_0x383d('0xca')](_0x119699[_0x383d('0xc5')],['ids','id'])||{})[_0x383d('0xd2')](function(){return db[_0x383d('0x73')][_0x383d('0xd3')]({'attributes':['id',_0x383d('0x1e'),_0x383d('0xd4')],'where':{'id':_0x119699[_0x383d('0xc5')]['ids']}});})[_0x383d('0x1a')](function(_0x2da404){socket[_0x383d('0xd5')]('mailInteractionTags:save',{'id':Number(_0x119699[_0x383d('0xc1')]['id']),'tags':_0x2da404||[]});return{'id':Number(_0x119699[_0x383d('0xc1')]['id']),'tags':_0x2da404||[]};});}})[_0x383d('0x1a')](respondWithResult(_0x59a166,null))[_0x383d('0x2e')](handleError(_0x59a166,null));};exports[_0x383d('0xd6')]=function(_0x1a44e6,_0x271d25){return db['MailInteraction'][_0x383d('0x63')]({'where':{'id':_0x1a44e6['params']['id']}})[_0x383d('0x1a')](handleEntityNotFound(_0x271d25,null))[_0x383d('0x1a')](function(_0xbc155c){if(_0xbc155c){return _0xbc155c['removeTags'](_0x1a44e6['query'][_0x383d('0xc9')]);}})[_0x383d('0x1a')](respondWithStatusCode(_0x271d25,null))[_0x383d('0x2e')](handleError(_0x271d25,null));};exports['download']=function(_0x5b6145,_0x4e59b3){var _0x35ea90=moment()[_0x383d('0xd7')]()[_0x383d('0x9d')]();var _0x5c6fcd=path['join'](config[_0x383d('0xd8')],'server',_0x383d('0xd9'),'tmp');var _0x29989b=path[_0x383d('0xda')](config['root'],_0x383d('0xdb'),_0x383d('0xd9'),_0x383d('0xdc'));var _0x51797c=path[_0x383d('0xda')](_0x5c6fcd,_0x35ea90);var _0x4eb093=util[_0x383d('0xcc')](_0x383d('0xdd'),_0x5b6145['params']['id'],_0x35ea90);var _0x6d67e=path[_0x383d('0xda')](_0x5c6fcd,_0x4eb093);var _0x3ad6d1=[];if(_0x5b6145['query'][_0x383d('0xdc')]){_0x3ad6d1[_0x383d('0x27')]({'model':db[_0x383d('0xde')],'as':'Attachments','raw':!![]});}var _0x42e05e=[{'model':db['MailMessage'],'as':_0x383d('0xdf'),'attributes':['id',_0x383d('0xc5'),_0x383d('0x49'),'to','cc',_0x383d('0xe0'),_0x383d('0xe1'),_0x383d('0xe2')],'where':{'secret':![]},'order':qs[_0x383d('0x44')]('id'),'include':_0x3ad6d1}];return db[_0x383d('0x36')]['find']({'where':{'id':_0x5b6145['params']['id']},'include':_0x42e05e})[_0x383d('0x1a')](handleEntityNotFound(_0x4e59b3,null))[_0x383d('0x1a')](function(_0x423e2e){if(_0x423e2e&&_0x423e2e[_0x383d('0xdf')]){var _0x2c4807=_0x423e2e[_0x383d('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x51797c);return BPromise[_0x383d('0xe4')](_0x2c4807[_0x383d('0xdf')],function(_0x2215d1,_0x14a9c0){var _0x26f7f2={'from':_0x2215d1['from'],'to':_0x2215d1['to'],'subject':_0x2215d1[_0x383d('0xe1')],'html':htmlEntities[_0x383d('0xe5')](_0x2215d1['body']),'headers':{'Date':moment(_0x2215d1['createdAt'])[_0x383d('0xcc')](_0x383d('0xe6'))},'attachments':[]};if(_0x2215d1['cc']){_0x26f7f2['headers']['Cc']=_0x2215d1['cc'];}if(_0x2215d1[_0x383d('0xe0')]){_0x26f7f2[_0x383d('0xe7')][_0x383d('0xe8')]=_0x2215d1[_0x383d('0xe0')];}return new BPromise(function(_0x522b03,_0x4a0270){if(_0x2215d1['Attachments']){for(var _0x43deff=0x0;_0x43deff<_0x2215d1[_0x383d('0xe9')]['length'];_0x43deff++){var _0xe7e580=_0x2215d1['Attachments'][_0x43deff];var _0x427cd9=path['join'](_0x29989b,_0xe7e580['basename']);if(fs[_0x383d('0xea')](_0x427cd9)){_0x26f7f2[_0x383d('0xdc')][_0x383d('0x27')]({'name':_0xe7e580['name'],'contentType':_0xe7e580['type'],'data':fs['readFileSync'](_0x427cd9)});}}}emlformat['build'](_0x26f7f2,function(_0x38cd61,_0x9cc216){if(_0x38cd61)return _0x4a0270(_0x38cd61);fs[_0x383d('0xeb')](path[_0x383d('0xda')](_0x51797c,util[_0x383d('0xcc')](_0x383d('0xec'),_0x14a9c0)),_0x9cc216);return _0x522b03(_0x9cc216);});});})[_0x383d('0x1a')](function(){return new BPromise(function(_0x58422f,_0x138c9b){zipdir(_0x51797c,{'saveTo':_0x6d67e},function(_0x4cacac,_0x34cbd8){if(_0x4cacac)return _0x138c9b(_0x4cacac);return _0x58422f(_0x34cbd8);});})[_0x383d('0x1a')](function(){return new BPromise(function(_0x4fa550,_0x7dbdb1){rimraf(_0x51797c,function(_0xe3117c){if(_0xe3117c)_0x7dbdb1(_0xe3117c);return _0x4fa550();});});})['then'](function(){return _0x4e59b3['download'](_0x6d67e,_0x4eb093,function(_0x20fcf1){if(!_0x20fcf1)fs[_0x383d('0xed')](_0x6d67e);});});});}else{return _0x4e59b3[_0x383d('0x12')](0xc8);}})[_0x383d('0x2e')](handleError(_0x4e59b3,null));}; \ No newline at end of file +var _0xd285=['Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','rawAttributes','includeAll','create','body','params','destroy','describe','addMessage','ids','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','MailMessage','plainBody','lastMsgText','trimStart','catch','waiting','answered','closed','UserId','talking','unmanaged','total','index','MailInteraction','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','ui.MailInteractionId','from','mail_interactions','cm_contacts','left_join','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName'];(function(_0x136492,_0x701cf4){var _0x1f0083=function(_0x3e7b6e){while(--_0x3e7b6e){_0x136492['push'](_0x136492['shift']());}};_0x1f0083(++_0x701cf4);}(_0xd285,0x132));var _0x5d28=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0xd285[_0x149a9b];return _0x2c2bf6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d28('0x0'));var zipdir=require(_0x5d28('0x1'));var moment=require('moment');var BPromise=require(_0x5d28('0x2'));var util=require(_0x5d28('0x3'));var path=require(_0x5d28('0x4'));var fs=require('fs');var _=require(_0x5d28('0x5'));var squel=require(_0x5d28('0x6'));var juice=require(_0x5d28('0x7'));var Redis=require(_0x5d28('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x5d28('0x9'));var logger=require(_0x5d28('0xa'))(_0x5d28('0xb'));var config=require(_0x5d28('0xc'));var db=require(_0x5d28('0xd'))['db'];var htmlEntities=require(_0x5d28('0xe'));config[_0x5d28('0xf')]=_[_0x5d28('0x10')](config['redis'],{'host':_0x5d28('0x11'),'port':0x18eb});var socket=require(_0x5d28('0x12'))(new Redis(config[_0x5d28('0xf')]));require('./mailInteraction.socket')[_0x5d28('0x13')](socket);function respondWithStatusCode(_0x2b3578,_0x200917){_0x200917=_0x200917||0xcc;return function(_0x8bd756){if(_0x8bd756){return _0x2b3578[_0x5d28('0x14')](_0x200917);}return _0x2b3578[_0x5d28('0x15')](_0x200917)['end']();};}function respondWithResult(_0x39edde,_0x2975a1){_0x2975a1=_0x2975a1||0xc8;return function(_0x3261e7){if(_0x3261e7){return _0x39edde[_0x5d28('0x15')](_0x2975a1)[_0x5d28('0x16')](_0x3261e7);}};}function respondWithFilteredResult(_0xf11686,_0x40df45){return function(_0x542c2f){if(_0x542c2f){var _0x391275=typeof _0x40df45[_0x5d28('0x17')]===_0x5d28('0x18')&&typeof _0x40df45['limit']==='undefined';var _0x25b027=_0x542c2f[_0x5d28('0x19')];var _0x36c340=_0x391275?0x0:_0x40df45[_0x5d28('0x17')];var _0x5de764=_0x391275?_0x542c2f[_0x5d28('0x19')]:_0x40df45[_0x5d28('0x17')]+_0x40df45['limit'];var _0x1004c0;if(_0x5de764>=_0x25b027){_0x5de764=_0x25b027;_0x1004c0=0xc8;}else{_0x1004c0=0xce;}_0xf11686[_0x5d28('0x15')](_0x1004c0);return _0xf11686[_0x5d28('0x1a')](_0x5d28('0x1b'),_0x36c340+'-'+_0x5de764+'/'+_0x25b027)[_0x5d28('0x16')](_0x542c2f);}return null;};}function saveUpdates(_0x4da5b4){return function(_0x204bcc){if(_0x204bcc){return _0x204bcc[_0x5d28('0x1c')](_0x4da5b4)[_0x5d28('0x1d')](function(_0x140aee){return _0x140aee;});}return null;};}function removeEntity(_0x44d8c9){return function(_0x12e0f0){if(_0x12e0f0){return _0x12e0f0['destroy']()[_0x5d28('0x1d')](function(){_0x44d8c9[_0x5d28('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcefd){return function(_0x7041c7){if(!_0x7041c7){_0x1bcefd[_0x5d28('0x14')](0x194);}return _0x7041c7;};}function handleError(_0x5cad4c,_0x1d800b){_0x1d800b=_0x1d800b||0x1f4;return function(_0x283684){logger[_0x5d28('0x1e')](_0x283684[_0x5d28('0x1f')]);if(_0x283684[_0x5d28('0x20')]){delete _0x283684[_0x5d28('0x20')];}_0x5cad4c[_0x5d28('0x15')](_0x1d800b)['send'](_0x283684);};}function getInteractionUsers(_0x5ca889,_0x4edd6d){return new BPromise(function(_0x45f839,_0x2f0688){try{if(_0x4edd6d[_0x5ca889['id']]){_0x5ca889[_0x5d28('0x21')]=_[_0x5d28('0x22')](_0x4edd6d[_0x5ca889['id']],function(_0x274304){return{'id':_0x274304['id'],'fullname':_0x274304['fullname']};});}}catch(_0x210205){_0x2f0688(_0x210205);}_0x45f839(_0x5ca889);});}function getInteractionTags(_0x5ee390,_0x24a085){return new BPromise(function(_0x6db7ce,_0x3cd318){try{if(_0x5ee390[_0x5d28('0x23')]){_0x5ee390[_0x5d28('0x24')]=[];_0x5ee390[_0x5d28('0x23')][_0x5d28('0x25')](',')[_0x5d28('0x26')](function(_0x1ccc81){_0x5ee390['Tags'][_0x5d28('0x27')](_0x24a085[_0x1ccc81]);});}delete _0x5ee390[_0x5d28('0x23')];}catch(_0xfc5c98){_0x3cd318(_0xfc5c98);}_0x6db7ce(_0x5ee390);});}function getLastMessageText(_0x47a877){return new BPromise(function(_0x561570,_0x5ad123){return db[_0x5d28('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x47a877['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x48347a){if(_0x48347a&&_0x48347a[_0x5d28('0x29')]){_0x47a877[_0x5d28('0x2a')]=_[_0x5d28('0x2b')](_0x48347a['plainBody']);}_0x561570(_0x47a877);})[_0x5d28('0x2c')](function(_0x81bfdb){_0x5ad123(_0x81bfdb);});});}function updateMailInteraction(_0x51d2b1,_0x49eef3,_0x144c61,_0x553189){return new BPromise(function(_0x322e90,_0x2f119d){return getInteractionUsers(_0x51d2b1,_0x144c61)['then'](function(_0x21e939){return getInteractionTags(_0x21e939,_0x49eef3);})[_0x5d28('0x1d')](function(_0x1a0db9){return getStateInteraction(_0x1a0db9);})[_0x5d28('0x1d')](function(_0x5cb06a){if(_0x553189){_0x322e90(getLastMessageText(_0x5cb06a));}else{_0x322e90(_0x5cb06a);}})[_0x5d28('0x2c')](function(_0x1302d5){_0x2f119d(_0x1302d5);});});}function getStateInteraction(_0x49ba54){return new BPromise(function(_0x23bdd2){_0x49ba54[_0x5d28('0x2d')]=0x0;_0x49ba54['talking']=0x0;_0x49ba54[_0x5d28('0x2e')]=0x0;_0x49ba54['unmanaged']=0x0;_0x49ba54['total']=0x0;if(!_0x49ba54[_0x5d28('0x2f')]&&!_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x2d')]+=0x1;}if(!_0x49ba54[_0x5d28('0x2f')]&&_0x49ba54[_0x5d28('0x30')]){_0x49ba54['talking']+=0x1;if(_0x49ba54[_0x5d28('0x2d')]){_0x49ba54['waiting']-=0x1;}}if(_0x49ba54[_0x5d28('0x2f')]&&_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x2e')]+=0x1;if(_0x49ba54[_0x5d28('0x31')]){_0x49ba54[_0x5d28('0x31')]-=0x1;}}if(_0x49ba54[_0x5d28('0x2f')]&&!_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x32')]+=0x1;if(_0x49ba54[_0x5d28('0x2d')]){_0x49ba54['waiting']-=0x1;}}_0x49ba54[_0x5d28('0x33')]+=0x1;_0x23bdd2(_0x49ba54);});}exports[_0x5d28('0x34')]=function(_0x5a3eba,_0x2051e3){var _0x111bf5={},_0xddbcfd={},_0x84d11e={'count':0x0,'rows':[]};var _0x1f35a3=_[_0x5d28('0x22')](db[_0x5d28('0x35')]['rawAttributes'],function(_0x22a16f){return{'name':_0x22a16f[_0x5d28('0x36')],'type':_0x22a16f['type'][_0x5d28('0x37')]};});_0xddbcfd['model']=_['map'](_0x1f35a3,'name');_0xddbcfd[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x5a3eba[_0x5d28('0x38')]);_0xddbcfd['filters']=_[_0x5d28('0x3a')](_0xddbcfd[_0x5d28('0x3b')],_0xddbcfd[_0x5d28('0x38')]);_0x111bf5[_0x5d28('0x3c')]=_[_0x5d28('0x3a')](_0xddbcfd[_0x5d28('0x3b')],qs['fields'](_0x5a3eba['query'][_0x5d28('0x3d')]));_0x111bf5[_0x5d28('0x3c')]=_0x111bf5[_0x5d28('0x3c')][_0x5d28('0x3e')]?_0x111bf5[_0x5d28('0x3c')]:_0xddbcfd['model'];if(!_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x3f')]('nolimit')){_0x111bf5[_0x5d28('0x40')]=qs[_0x5d28('0x40')](_0x5a3eba['query'][_0x5d28('0x40')]);_0x111bf5[_0x5d28('0x17')]=qs[_0x5d28('0x17')](_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x17')]);}_0x111bf5[_0x5d28('0x41')]=qs[_0x5d28('0x42')](_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x42')]);_0x111bf5[_0x5d28('0x43')]=qs[_0x5d28('0x44')](_[_0x5d28('0x45')](_0x5a3eba['query'],_0xddbcfd[_0x5d28('0x44')]),_0x1f35a3);var _0x731d1f=[];var _0x550b02=squel[_0x5d28('0x46')]()[_0x5d28('0x47')]('id')[_0x5d28('0x47')](_0x5d28('0x20'))[_0x5d28('0x47')](_0x5d28('0x48'))['from'](_0x5d28('0x49'));var _0x20e808=squel[_0x5d28('0x46')]()['field'](_0x5d28('0x4a'))[_0x5d28('0x47')]('u.fullname')[_0x5d28('0x47')](_0x5d28('0x4b'))[_0x5d28('0x4c')]('user_has_mail_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x21f3d4=squel[_0x5d28('0x46')]()[_0x5d28('0x4c')](_0x5d28('0x4d'),'i')['left_join'](_0x5d28('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5d28('0x4f')]('users','o','o.id\x20=\x20i.UserId')[_0x5d28('0x4f')]('mail_accounts','a',_0x5d28('0x50'))[_0x5d28('0x4f')]('mail_messages','me',_0x5d28('0x51'))['left_join'](_0x5d28('0x52'),'it','it.MailInteractionId\x20=\x20i.id')[_0x5d28('0x4f')](_0x5d28('0x49'),'t',_0x5d28('0x53'));var _0x173674=squel[_0x5d28('0x54')]();var _0x50262b=[];var _0x517dbf=squel['expr']();var _0x210c6d;if(_0x5a3eba['query'][_0x5d28('0x55')]){_0x210c6d=as[_0x5d28('0x56')](_0x5a3eba[_0x5d28('0x38')]['search']);var _0x2eca73=_0x210c6d[_0x5d28('0x57')];for(var _0x3c48e2=0x0;_0x3c48e2<_0x210c6d[_0x5d28('0x58')][_0x5d28('0x3e')];_0x3c48e2++){var _0x3bacc3=_0x210c6d[_0x5d28('0x58')][_0x3c48e2];var _0x1f1267='i';var _0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,[_0x5d28('0x20'),_0x3bacc3['field']]);if(!_0x246d8f){switch(_0x3bacc3[_0x5d28('0x47')]){case _0x5d28('0x5a'):if(_0x3bacc3['value']==0x1){_0x21f3d4[_0x5d28('0x5b')]('`'+_0x3bacc3['field']+'`\x20=\x200');}else{_0x21f3d4[_0x5d28('0x5b')]('`'+_0x3bacc3[_0x5d28('0x47')]+_0x5d28('0x5c'));}break;case'Contact':if(_0x3bacc3[_0x5d28('0x5d')]===_0x5d28('0x5e')){if(_0x3bacc3[_0x5d28('0x5f')][_0x5d28('0x25')]('\x20')[_0x5d28('0x3e')]>0x1){_0x173674[_0x2eca73](_0x5d28('0x60'),qs[_0x5d28('0x61')](_0x3bacc3[_0x5d28('0x5f')]),null);}else{var _0x38511e='%'+_0x3bacc3[_0x5d28('0x5f')]+'%';_0x173674[_0x2eca73](_0x5d28('0x62'),_0x38511e,_0x38511e,_0x38511e);}}else{_0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,[_0x5d28('0x20'),_0x5d28('0x63')]);_0x3bacc3['field']=_0x5d28('0x63');_0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f[_0x5d28('0x65')],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7[_0x5d28('0x66')],_0x37a3e7['value'][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);}break;case _0x5d28('0x69'):var _0x3232f9=_0x3bacc3['value']['split'](',')[_0x5d28('0x22')](function(_0x124117){return Number(_0x124117);});_0x3232f9[_0x5d28('0x26')](function(_0x51b374){_0x517dbf['or'](_0x5d28('0x6a'),'%,'+_0x51b374+',%');});_0x50262b=_[_0x5d28('0x6b')](_0x50262b,_0x3232f9);break;case'User':if(_0x3bacc3[_0x5d28('0x5d')]==='$substring'){_0x173674[_0x2eca73]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3bacc3[_0x5d28('0x5f')]+'%',null);}else{_0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,['name',_0x5d28('0x30')]);_0x3bacc3[_0x5d28('0x47')]=_0x5d28('0x30');_0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f['type'],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7[_0x5d28('0x66')],_0x37a3e7['value'][_0x5d28('0x67')],_0x37a3e7['value'][_0x5d28('0x68')]);}break;case _0x5d28('0x29'):_0x37a3e7=as[_0x5d28('0x64')]('me',null,_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7['text'],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);break;}}else{var _0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f['type'],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7['text'],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);}}}else{var _0x503ce1=_(_0x5a3eba[_0x5d28('0x38')])['keys']()[_0x5d28('0x22')](function(_0x5ac919){return _['some'](_0x1f35a3,['name',_0x5ac919])?_0x5ac919:undefined;})[_0x5d28('0x6c')]()[_0x5d28('0x5f')]();if(!_[_0x5d28('0x6d')](_0x503ce1)){_0x503ce1[_0x5d28('0x26')](function(_0x390706){if(_0x390706===_0x5d28('0x6e')){_0x21f3d4[_0x5d28('0x43')](_0x5d28('0x6f'),[][_0x5d28('0x70')](_0x5a3eba[_0x5d28('0x38')][_0x390706]));}else if(_0x390706===_0x5d28('0x71')){var _0x2fbfe6=JSON[_0x5d28('0x72')](_0x5a3eba[_0x5d28('0x38')][_0x390706])['$gte'];var _0x77d415=JSON[_0x5d28('0x72')](_0x5a3eba[_0x5d28('0x38')][_0x390706])[_0x5d28('0x73')];_0x21f3d4['where'](_0x5d28('0x74'),_0x2fbfe6,_0x77d415);}else{if(_0x5a3eba[_0x5d28('0x38')][_0x390706]==='null'){_0x21f3d4[_0x5d28('0x43')]('i.'+_0x390706+'\x20IS\x20NULL');}else{_0x21f3d4['where']('i.'+_0x390706+'\x20=\x20?',_0x5a3eba[_0x5d28('0x38')][_0x390706]);}}});}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x75')]){if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x75')]==0x1){_0x21f3d4['having'](_0x5d28('0x76'));}else{_0x21f3d4[_0x5d28('0x5b')](_0x5d28('0x77'));}}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x78')]){_0x50262b=_[_0x5d28('0x79')](_0x5a3eba['query'][_0x5d28('0x78')])?_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x78')]:new Array(_0x5a3eba[_0x5d28('0x38')]['tag']);_0x50262b[_0x5d28('0x26')](function(_0x552301){_0x517dbf['or'](_0x5d28('0x6a'),'%,'+_0x552301+',%');});}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x7a')]){var _0x31bda3=_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x7a')][_0x5d28('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5d28('0x7c')](_0x31bda3)){_0x173674['or'](_0x5d28('0x7d'),_0x31bda3+'%');}else if(qs[_0x5d28('0x7e')](_0x31bda3)){_0x173674['or'](_0x5d28('0x7f'),_0x31bda3+'%');}else{_0x173674['or'](_0x5d28('0x80'),qs['getFullTextValue'](_0x31bda3))['or'](_0x5d28('0x81'),qs[_0x5d28('0x61')](_0x31bda3));}}}_0x21f3d4[_0x5d28('0x43')](_0x173674);_0x21f3d4[_0x5d28('0x82')](_0x5d28('0x83'));var _0x377e1d={'type':db[_0x5d28('0x84')][_0x5d28('0x85')][_0x5d28('0x86')],'raw':!![]};var _0x354729=_0x21f3d4[_0x5d28('0x87')]();_0x354729[_0x5d28('0x47')](_0x5d28('0x83'));_0x354729[_0x5d28('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5d28('0x5a'));if(_0x111bf5[_0x5d28('0x41')]){_0x111bf5[_0x5d28('0x41')][_0x5d28('0x26')](function(_0x47aa4d){var _0x320ed2=_0x47aa4d[0x0]==='contactName'?_0x47aa4d[0x0]:'i.'+_0x47aa4d[0x0];_0x21f3d4[_0x5d28('0x41')](_0x320ed2,_0x47aa4d[0x1]===_0x5d28('0x88')?![]:!![]);});}if(!_[_0x5d28('0x6d')](_0x50262b)){_0x21f3d4['having'](_0x517dbf);_0x354729['where'](_0x5d28('0x89'),_0x50262b);}BPromise[_0x5d28('0x8a')]()['then'](function(){if(!_0x210c6d){if(_0x5a3eba['query'][_0x5d28('0x6e')])return;_0x354729[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x21f3d4[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5a3eba[_0x5d28('0x8b')]['role']!==_0x5d28('0x8c'))return;return _0x5a3eba['user']['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x5d28('0x1d')](function(_0x13a8ac){if(_[_0x5d28('0x6d')](_0x13a8ac)){_0x354729[_0x5d28('0x43')](_0x5d28('0x8d'));_0x21f3d4[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NULL');}else{_0x354729['where'](_0x5d28('0x6f'),_[_0x5d28('0x22')](_0x13a8ac,'id'));_0x21f3d4[_0x5d28('0x43')](_0x5d28('0x6f'),_['map'](_0x13a8ac,'id'));}});})[_0x5d28('0x1d')](function(){if(_0x5a3eba[_0x5d28('0x8b')][_0x5d28('0x8e')]==='agent'&&!_0x210c6d&&!_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x6e')])return[];return db[_0x5d28('0x8f')]['query'](_0x354729[_0x5d28('0x90')](),_0x377e1d);})[_0x5d28('0x1d')](function(_0x33adba){_0x84d11e['count']=_0x33adba[_0x5d28('0x3e')];if(_0x84d11e['count']===0x0)return[];return db['sequelize'][_0x5d28('0x38')](_0x550b02[_0x5d28('0x90')](),_0x377e1d)[_0x5d28('0x1d')](function(_0x146b34){_0x731d1f=_[_0x5d28('0x91')](_0x146b34,'id');_0x377e1d=_[_0x5d28('0x92')](_0x377e1d,{'model':db[_0x5d28('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x3d')]){_0x111bf5[_0x5d28('0x3c')][_0x5d28('0x26')](function(_0x1761f6){_0x21f3d4['field']('i.'+_0x1761f6);});}else{_0x21f3d4['field'](_0x5d28('0x93'),_0x5d28('0x5a'));_0x21f3d4['field'](_0x5d28('0x94'),'Account.key');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x95'),_0x5d28('0x96'));_0x21f3d4['field'](_0x5d28('0x97'),_0x5d28('0x98'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x99'),_0x5d28('0x9a'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x83'));_0x21f3d4['field'](_0x5d28('0x9b'));_0x21f3d4[_0x5d28('0x47')]('i.updatedAt');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9c'));_0x21f3d4[_0x5d28('0x47')]('i.closedAt');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9d'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9e'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9f'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa0'));_0x21f3d4['field']('i.disposition');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa1'));_0x21f3d4['field'](_0x5d28('0xa2'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa3'));_0x21f3d4['field']('i.to');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa4'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa5'));_0x21f3d4['field'](_0x5d28('0xa6'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa7'),_0x5d28('0xa8'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa9'),_0x5d28('0xaa'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xab'),_0x5d28('0xac'));_0x21f3d4['field'](_0x5d28('0xad'),_0x5d28('0xae'));_0x21f3d4['field']('c.mobile',_0x5d28('0xaf'));_0x21f3d4[_0x5d28('0x47')]('c.fax',_0x5d28('0xb0'));_0x21f3d4[_0x5d28('0x47')]('o.fullname',_0x5d28('0xb1'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xb2'),_0x5d28('0xb3'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xb4'),'TagIds');}if(_0x111bf5[_0x5d28('0x40')])_0x21f3d4[_0x5d28('0x40')](_0x111bf5[_0x5d28('0x40')]);if(_0x111bf5[_0x5d28('0x17')])_0x21f3d4[_0x5d28('0x17')](_0x111bf5[_0x5d28('0x17')]);return db['sequelize'][_0x5d28('0x38')](_0x21f3d4[_0x5d28('0x90')](),_0x377e1d);})[_0x5d28('0x1d')](function(_0x4937a6){if(_0x4937a6[_0x5d28('0x3e')]>0x0)_0x20e808[_0x5d28('0x43')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x4937a6,'id'));return db['sequelize'][_0x5d28('0x38')](_0x20e808['toString'](),_0x377e1d)['then'](function(_0x423d0c){var _0x550c3b=_[_0x5d28('0xb5')](_0x423d0c,_0x5d28('0xb6'));var _0x20114d=[];return db[_0x5d28('0xb7')][_0x5d28('0xb8')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x5d28('0x1d')](function(_0xb568b8){var _0x284c3e=_0xb568b8[_0x5d28('0xb9')];_0x4937a6['forEach'](function(_0x21a233){_0x20114d[_0x5d28('0x27')](updateMailInteraction(_0x21a233,_0x731d1f,_0x550c3b,_0x284c3e));});return BPromise[_0x5d28('0xba')](_0x20114d);});});});})[_0x5d28('0x1d')](function(_0x4de2e3){_0x84d11e[_0x5d28('0xbb')]=_0x4de2e3;return _0x84d11e;})[_0x5d28('0x1d')](respondWithFilteredResult(_0x2051e3,_0x111bf5))['catch'](handleError(_0x2051e3,null));};exports[_0x5d28('0xbc')]=function(_0x594885,_0x40699f){var _0x76653c={'raw':![],'where':{'id':_0x594885['params']['id']}},_0xb22651={};_0xb22651[_0x5d28('0x3b')]=_[_0x5d28('0x39')](db[_0x5d28('0x35')][_0x5d28('0xbd')]);_0xb22651[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x594885[_0x5d28('0x38')]);_0xb22651[_0x5d28('0x44')]=_[_0x5d28('0x3a')](_0xb22651[_0x5d28('0x3b')],_0xb22651[_0x5d28('0x38')]);_0x76653c[_0x5d28('0x3c')]=_['intersection'](_0xb22651[_0x5d28('0x3b')],qs[_0x5d28('0x3d')](_0x594885[_0x5d28('0x38')]['fields']));_0x76653c[_0x5d28('0x3c')]=_0x76653c['attributes'][_0x5d28('0x3e')]?_0x76653c[_0x5d28('0x3c')]:_0xb22651[_0x5d28('0x3b')];if(_0x594885[_0x5d28('0x38')][_0x5d28('0xbe')]){_0x76653c['include']=[{'all':!![]}];}_0x76653c=_['merge']({},_0x76653c,_0x594885['options']);return db[_0x5d28('0x35')][_0x5d28('0x59')](_0x76653c)['then'](handleEntityNotFound(_0x40699f,null))['then'](respondWithResult(_0x40699f,null))['catch'](handleError(_0x40699f,null));};exports['create']=function(_0xc8cd90,_0x456312){return db[_0x5d28('0x35')][_0x5d28('0xbf')](_0xc8cd90[_0x5d28('0xc0')],{})[_0x5d28('0x1d')](respondWithResult(_0x456312,0xc9))['catch'](handleError(_0x456312,null));};exports['update']=function(_0x23de44,_0x51c88f){if(_0x23de44['body']['id']){delete _0x23de44[_0x5d28('0xc0')]['id'];}return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x23de44[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x51c88f,null))['then'](saveUpdates(_0x23de44[_0x5d28('0xc0')],null))['then'](respondWithResult(_0x51c88f,null))[_0x5d28('0x2c')](handleError(_0x51c88f,null));};exports[_0x5d28('0xc2')]=function(_0x4726b1,_0x34e473){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x4726b1[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x34e473,null))[_0x5d28('0x1d')](removeEntity(_0x34e473,null))[_0x5d28('0x2c')](handleError(_0x34e473,null));};exports[_0x5d28('0xc3')]=function(_0x3e1f59,_0x2a68c9){return db[_0x5d28('0x35')][_0x5d28('0xc3')]()[_0x5d28('0x1d')](respondWithResult(_0x2a68c9,null))[_0x5d28('0x2c')](handleError(_0x2a68c9,null));};exports[_0x5d28('0xc4')]=function(_0x4f55fd,_0x496e83){return db['MailMessage'][_0x5d28('0x59')]({'where':{'id':_0x4f55fd[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x496e83,null))[_0x5d28('0x1d')](function(_0x503814){if(_0x503814){return _0x503814[_0x5d28('0xc4')](_0x4f55fd[_0x5d28('0xc0')][_0x5d28('0xc5')],_['omit'](_0x4f55fd[_0x5d28('0xc0')],[_0x5d28('0xc5'),'id'])||{});}})[_0x5d28('0x1d')](respondWithResult(_0x496e83,null))[_0x5d28('0x2c')](handleError(_0x496e83,null));};exports['getMessages']=function(_0x350a0a,_0x451063){var _0x34316c={'raw':![],'where':{}};var _0x1b0575={};var _0x468fa6={'count':0x0,'rows':[]};return db[_0x5d28('0x35')][_0x5d28('0xb8')]({'where':{'id':_0x350a0a[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x451063,null))[_0x5d28('0x1d')](function(_0x1608f5){if(_0x1608f5){_0x1b0575[_0x5d28('0x3b')]=_[_0x5d28('0x39')](db['MailMessage']['rawAttributes']);_0x1b0575[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x350a0a[_0x5d28('0x38')]);_0x1b0575['filters']=_[_0x5d28('0x3a')](_0x1b0575[_0x5d28('0x3b')],_0x1b0575[_0x5d28('0x38')]);_0x34316c[_0x5d28('0x3c')]=_[_0x5d28('0x3a')](_0x1b0575['model'],qs[_0x5d28('0x3d')](_0x350a0a['query']['fields']));_0x34316c[_0x5d28('0x3c')]=_0x34316c[_0x5d28('0x3c')][_0x5d28('0x3e')]?_0x34316c[_0x5d28('0x3c')]:_0x1b0575[_0x5d28('0x3b')];if(!_0x350a0a[_0x5d28('0x38')][_0x5d28('0x3f')](_0x5d28('0xc6'))){_0x34316c[_0x5d28('0x40')]=qs[_0x5d28('0x40')](_0x350a0a[_0x5d28('0x38')]['limit']);_0x34316c['offset']=qs[_0x5d28('0x17')](_0x350a0a[_0x5d28('0x38')][_0x5d28('0x17')]);}_0x34316c[_0x5d28('0x41')]=qs[_0x5d28('0x42')](_0x350a0a['query'][_0x5d28('0x42')]);_0x34316c[_0x5d28('0x43')]=qs[_0x5d28('0x44')](_[_0x5d28('0x45')](_0x350a0a[_0x5d28('0x38')],_0x1b0575[_0x5d28('0x44')]));_0x34316c[_0x5d28('0x43')][_0x5d28('0xb6')]=_0x1608f5['id'];if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0x7a')]){_0x34316c['where']=_['merge'](_0x34316c[_0x5d28('0x43')],{'$or':_[_0x5d28('0x22')](_0x34316c[_0x5d28('0x3c')],function(_0x186101){var _0x455b14={};_0x455b14[_0x186101]={'$like':'%'+_0x350a0a[_0x5d28('0x38')][_0x5d28('0x7a')]+'%'};return _0x455b14;})});}if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xc7')]){var _0x316c81=_0x350a0a['query'][_0x5d28('0xc7')][_0x5d28('0x25')](',');var _0x246b41={};_0x246b41[_0x316c81[0x0]]={'$gte':moment(_0x316c81[0x1])['format'](_0x5d28('0xc8'))};_0x34316c[_0x5d28('0x43')]=_[_0x5d28('0x92')](_0x34316c['where'],_0x246b41);}_0x34316c=_['merge']({},_0x34316c,_0x350a0a[_0x5d28('0xc9')]);return db[_0x5d28('0x28')][_0x5d28('0x19')]({'where':_0x34316c[_0x5d28('0x43')]})[_0x5d28('0x1d')](function(_0x21f2cd){_0x468fa6[_0x5d28('0x19')]=_0x21f2cd;if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xbe')]){_0x34316c[_0x5d28('0xca')]=[{'all':!![]}];}return db[_0x5d28('0x28')]['findAll'](_0x34316c);})[_0x5d28('0x1d')](function(_0x73229d){if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xcb')]===_0x5d28('0xcc')){for(var _0x11ad05=0x0;_0x11ad05<_0x73229d[_0x5d28('0x3e')];_0x11ad05++){_0x73229d[_0x11ad05]['body']=juice(_0x73229d[_0x11ad05][_0x5d28('0xc0')]);}}_0x468fa6[_0x5d28('0xbb')]=_0x73229d;return _0x468fa6;});}})['then'](respondWithFilteredResult(_0x451063,_0x34316c))[_0x5d28('0x2c')](handleError(_0x451063,null));};exports[_0x5d28('0xcd')]=function(_0x13a23b,_0x55a64b){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x13a23b['params']['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x55a64b,null))[_0x5d28('0x1d')](function(_0x1af2bc){if(_0x1af2bc){return _0x1af2bc[_0x5d28('0xce')](_0x13a23b[_0x5d28('0xc0')][_0x5d28('0xc5')],_[_0x5d28('0xcf')](_0x13a23b[_0x5d28('0xc0')],[_0x5d28('0xc5'),'id'])||{})[_0x5d28('0xd0')](function(){return db[_0x5d28('0x69')]['findAll']({'attributes':['id',_0x5d28('0x20'),'color'],'where':{'id':_0x13a23b[_0x5d28('0xc0')][_0x5d28('0xc5')]}});})[_0x5d28('0x1d')](function(_0x28bef8){socket[_0x5d28('0xd1')](_0x5d28('0xd2'),{'id':Number(_0x13a23b[_0x5d28('0xc1')]['id']),'tags':_0x28bef8||[]});return{'id':Number(_0x13a23b[_0x5d28('0xc1')]['id']),'tags':_0x28bef8||[]};});}})['then'](respondWithResult(_0x55a64b,null))['catch'](handleError(_0x55a64b,null));};exports[_0x5d28('0xd3')]=function(_0x43a304,_0x50cd44){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x43a304['params']['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x50cd44,null))[_0x5d28('0x1d')](function(_0x5e7fa6){if(_0x5e7fa6){return _0x5e7fa6['removeTags'](_0x43a304['query']['ids']);}})['then'](respondWithStatusCode(_0x50cd44,null))[_0x5d28('0x2c')](handleError(_0x50cd44,null));};exports[_0x5d28('0xd4')]=function(_0x577df2,_0x28f1a5){var _0x4cd2d9=moment()[_0x5d28('0xd5')]()[_0x5d28('0x90')]();var _0x412309=path[_0x5d28('0xd6')](config[_0x5d28('0xd7')],_0x5d28('0xd8'),_0x5d28('0xd9'),_0x5d28('0xda'));var _0x31d843=path['join'](config['root'],'server',_0x5d28('0xd9'),_0x5d28('0xdb'));var _0x37808b=path[_0x5d28('0xd6')](_0x412309,_0x4cd2d9);var _0x1b161b=util[_0x5d28('0xdc')](_0x5d28('0xdd'),_0x577df2[_0x5d28('0xc1')]['id'],_0x4cd2d9);var _0x3ad413=path[_0x5d28('0xd6')](_0x412309,_0x1b161b);var _0x549ce0=[];if(_0x577df2[_0x5d28('0x38')][_0x5d28('0xdb')]){_0x549ce0[_0x5d28('0x27')]({'model':db['Attachment'],'as':_0x5d28('0xde'),'raw':!![]});}var _0x94a664=[{'model':db[_0x5d28('0x28')],'as':_0x5d28('0xdf'),'attributes':['id',_0x5d28('0xc0'),_0x5d28('0x4c'),'to','cc',_0x5d28('0xe0'),_0x5d28('0xe1'),_0x5d28('0x71')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x549ce0}];return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x577df2[_0x5d28('0xc1')]['id']},'include':_0x94a664})[_0x5d28('0x1d')](handleEntityNotFound(_0x28f1a5,null))[_0x5d28('0x1d')](function(_0x335b11){if(_0x335b11&&_0x335b11[_0x5d28('0xdf')]){var _0x54c7c8=_0x335b11[_0x5d28('0xe2')]({'plain':!![]});fs[_0x5d28('0xe3')](_0x37808b);return BPromise[_0x5d28('0xe4')](_0x54c7c8[_0x5d28('0xdf')],function(_0x4f79ea,_0x371a22){var _0x5cb08a={'from':_0x4f79ea[_0x5d28('0x4c')],'to':_0x4f79ea['to'],'subject':_0x4f79ea['subject'],'html':htmlEntities[_0x5d28('0xe5')](_0x4f79ea[_0x5d28('0xc0')]),'headers':{'Date':moment(_0x4f79ea[_0x5d28('0x71')])['format'](_0x5d28('0xe6'))},'attachments':[]};if(_0x4f79ea['cc']){_0x5cb08a[_0x5d28('0xe7')]['Cc']=_0x4f79ea['cc'];}if(_0x4f79ea[_0x5d28('0xe0')]){_0x5cb08a['headers']['Bcc']=_0x4f79ea[_0x5d28('0xe0')];}return new BPromise(function(_0x69ddbc,_0x40a08e){if(_0x4f79ea[_0x5d28('0xde')]){for(var _0x16bb3e=0x0;_0x16bb3e<_0x4f79ea[_0x5d28('0xde')][_0x5d28('0x3e')];_0x16bb3e++){var _0x468fa9=_0x4f79ea['Attachments'][_0x16bb3e];var _0x8057c=path[_0x5d28('0xd6')](_0x31d843,_0x468fa9[_0x5d28('0xe8')]);if(fs[_0x5d28('0xe9')](_0x8057c)){_0x5cb08a[_0x5d28('0xdb')]['push']({'name':_0x468fa9[_0x5d28('0x20')],'contentType':_0x468fa9['type'],'data':fs[_0x5d28('0xea')](_0x8057c)});}}}emlformat[_0x5d28('0xeb')](_0x5cb08a,function(_0x14b3fc,_0x516ee0){if(_0x14b3fc)return _0x40a08e(_0x14b3fc);fs['writeFileSync'](path[_0x5d28('0xd6')](_0x37808b,util[_0x5d28('0xdc')]('message%d.eml',_0x371a22)),_0x516ee0);return _0x69ddbc(_0x516ee0);});});})[_0x5d28('0x1d')](function(){return new BPromise(function(_0x1d6b0c,_0x1e9979){zipdir(_0x37808b,{'saveTo':_0x3ad413},function(_0x2bc581,_0x2c4d8b){if(_0x2bc581)return _0x1e9979(_0x2bc581);return _0x1d6b0c(_0x2c4d8b);});})[_0x5d28('0x1d')](function(){return new BPromise(function(_0x50e19d,_0xa78fe2){rimraf(_0x37808b,function(_0x4e4b8d){if(_0x4e4b8d)_0xa78fe2(_0x4e4b8d);return _0x50e19d();});});})['then'](function(){return _0x28f1a5['download'](_0x3ad413,_0x1b161b,function(_0x5068c4){if(!_0x5068c4)fs[_0x5d28('0xec')](_0x3ad413);});});});}else{return _0x28f1a5[_0x5d28('0x14')](0xc8);}})[_0x5d28('0x2c')](handleError(_0x28f1a5,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e7b5ce3..ec1ce9a 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 _0xab6d=['exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab6d,0x1ef));var _0xdab6=function(_0x2cfdf4,_0x56a359){_0x2cfdf4=_0x2cfdf4-0x0;var _0x5ec725=_0xab6d[_0x2cfdf4];return _0x5ec725;};'use strict';var EventEmitter=require(_0xdab6('0x0'));var MailInteraction=require(_0xdab6('0x1'))['db'][_0xdab6('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdab6('0x3')](0x0);var events={'afterCreate':_0xdab6('0x4'),'afterUpdate':'update','afterDestroy':_0xdab6('0x5')};function emitEvent(_0x25c6d9){return function(_0x47ea4f,_0x8421b6,_0x2cbb1f){_0x47ea4f[_0xdab6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3f8b5d){_0x47ea4f[_0xdab6('0x7')](_0xdab6('0x8'),_0x3f8b5d[_0xdab6('0x9')](function(_0x32f8fb){return{'id':_0x32f8fb['id']};}));return MailMessage[_0xdab6('0xa')]({'where':{'MailInteractionId':_0x47ea4f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdab6('0xb')](function(_0x1777fc){_0x47ea4f[_0xdab6('0x7')](_0xdab6('0xc'),_0x1777fc[_0xdab6('0xd')]);MailInteractionEvents[_0xdab6('0xe')](_0x25c6d9+':'+_0x47ea4f['id'],_0x47ea4f);MailInteractionEvents[_0xdab6('0xe')](_0x25c6d9,_0x47ea4f);_0x2cbb1f(null);})[_0xdab6('0xf')](_0x2cbb1f(null));};}for(var e in events){if(events[_0xdab6('0x10')](e)){var event=events[e];MailInteraction[_0xdab6('0x11')](e,emitEvent(event));}}module[_0xdab6('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x2177=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x2177,0x19e));var _0x7217=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x2177[_0x3eb713];return _0x1d7128;};'use strict';var EventEmitter=require(_0x7217('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x7217('0x1')];var MailMessage=require(_0x7217('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7217('0x3')](0x0);var events={'afterCreate':_0x7217('0x4'),'afterUpdate':_0x7217('0x5'),'afterDestroy':_0x7217('0x6')};function emitEvent(_0x46ae0c){return function(_0x132a91,_0x12082a,_0x2dceeb){_0x132a91[_0x7217('0x7')]({'attributes':['id'],'raw':!![]})[_0x7217('0x8')](function(_0x3ae65f){_0x132a91[_0x7217('0x9')](_0x7217('0xa'),_0x3ae65f[_0x7217('0xb')](function(_0xf1841b){return{'id':_0xf1841b['id']};}));return MailMessage[_0x7217('0xc')]({'where':{'MailInteractionId':_0x132a91['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7217('0x8')](function(_0x49105a){_0x132a91['setDataValue'](_0x7217('0xd'),_0x49105a[_0x7217('0xe')]);MailInteractionEvents[_0x7217('0xf')](_0x46ae0c+':'+_0x132a91['id'],_0x132a91);MailInteractionEvents[_0x7217('0xf')](_0x46ae0c,_0x132a91);_0x2dceeb(null);})[_0x7217('0x10')](_0x2dceeb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7217('0x11')](e,emitEvent(event));}}module[_0x7217('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 839e697..1db5a1d 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 _0xa6a0=['closed','closedAt','format','changed','substatus','substatusAt','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5cb97e,_0x40c496){var _0x1be96c=function(_0x3db047){while(--_0x3db047){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1be96c(++_0x40c496);}(_0xa6a0,0x186));var _0x0a6a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa6a0[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0a6a('0x0'));var util=require(_0x0a6a('0x1'));var logger=require(_0x0a6a('0x2'))(_0x0a6a('0x3'));var moment=require(_0x0a6a('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a6a('0x5'));var fs=require('fs');var path=require(_0x0a6a('0x6'));var rimraf=require(_0x0a6a('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x0a6a('0x8')]=function(_0x302841,_0x57f86f){return _0x302841[_0x0a6a('0x9')](_0x0a6a('0xa'),attributes,{'tableName':_0x0a6a('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6a('0xc'),'fields':[_0x0a6a('0xd'),'to'],'type':_0x0a6a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cb532,_0x2cb484,_0x289373){if(_0x4cb532['substatus']){_0x4cb532['substatusAt']=moment()['format'](_0x0a6a('0xf'));}if(_0x4cb532[_0x0a6a('0x10')]){_0x4cb532[_0x0a6a('0x11')]=moment()[_0x0a6a('0x12')](_0x0a6a('0xf'));}_0x289373(null,_0x2cb484);},'beforeUpdate':function(_0x2c93fb,_0x38dcb5,_0x48d991){if(_0x2c93fb[_0x0a6a('0x13')]('substatus')){_0x2c93fb['substatusAt']=_0x2c93fb[_0x0a6a('0x14')]?moment()['format'](_0x0a6a('0xf')):null;}if(_0x2c93fb['changed'](_0x0a6a('0x10'))){_0x2c93fb[_0x0a6a('0x11')]=moment()[_0x0a6a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c93fb[_0x0a6a('0x14')]=null;_0x2c93fb[_0x0a6a('0x15')]=null;}_0x48d991(null,_0x2c93fb);},'afterUpdate':function(_0x38bba5,_0x39cadd,_0x42c41b){var _0x293f63=_0x302841[_0x0a6a('0x16')];var _0x2d686f=_0x38bba5[_0x0a6a('0x17')]({'plain':!![]});if(_0x2d686f[_0x0a6a('0x10')]){return _0x293f63[_0x0a6a('0x18')][_0x0a6a('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x2d686f['id']}})[_0x0a6a('0x1a')](function(){_0x42c41b();})[_0x0a6a('0x1b')](function(_0x66a660){_0x42c41b(_0x66a660);});}else{_0x42c41b();}}},'charset':'utf8mb4','collate':_0x0a6a('0x1c')});}; \ No newline at end of file +var _0x8c84=['../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','api','moment','request-promise'];(function(_0x3e9b31,_0xa0fc7f){var _0x45f15b=function(_0x3b6013){while(--_0x3b6013){_0x3e9b31['push'](_0x3e9b31['shift']());}};_0x45f15b(++_0xa0fc7f);}(_0x8c84,0x64));var _0x48c8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8c84[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x48c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48c8('0x1'));var moment=require(_0x48c8('0x2'));var BPromise=require('bluebird');var rp=require(_0x48c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x48c8('0x4'));var attributes=require('./mailInteraction.attributes');module[_0x48c8('0x5')]=function(_0x2ef65,_0x56d225){return _0x2ef65[_0x48c8('0x6')](_0x48c8('0x7'),attributes,{'tableName':_0x48c8('0x8'),'paranoid':![],'indexes':[{'name':_0x48c8('0x9'),'fields':[_0x48c8('0xa'),'to'],'type':_0x48c8('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29e229,_0x52ba96,_0x40793c){if(_0x29e229[_0x48c8('0xc')]){_0x29e229['substatusAt']=moment()[_0x48c8('0xd')](_0x48c8('0xe'));}if(_0x29e229['closed']){_0x29e229['closedAt']=moment()['format'](_0x48c8('0xe'));}_0x40793c(null,_0x52ba96);},'beforeUpdate':function(_0x28a576,_0x126e0e,_0x4d48a7){if(_0x28a576[_0x48c8('0xf')]('substatus')){_0x28a576[_0x48c8('0x10')]=_0x28a576[_0x48c8('0xc')]?moment()[_0x48c8('0xd')](_0x48c8('0xe')):null;}if(_0x28a576[_0x48c8('0xf')](_0x48c8('0x11'))){_0x28a576[_0x48c8('0x12')]=moment()[_0x48c8('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x28a576[_0x48c8('0xc')]=null;_0x28a576['substatusAt']=null;}_0x4d48a7(null,_0x28a576);},'afterUpdate':function(_0x394cc9,_0x8fa59,_0x6dc361){var _0x41eba6=_0x2ef65[_0x48c8('0x13')];var _0x163af8=_0x394cc9[_0x48c8('0x14')]({'plain':!![]});if(_0x163af8['closed']){return _0x41eba6[_0x48c8('0x15')][_0x48c8('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x163af8['id']}})[_0x48c8('0x17')](function(){_0x6dc361();})[_0x48c8('0x18')](function(_0x20cb0d){_0x6dc361(_0x20cb0d);});}else{_0x6dc361();}}},'charset':'utf8mb4','collate':_0x48c8('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0db2b1c..54e0a83 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 _0x1342=['then','info','request\x20sent','debug','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','MailInteraction','body','options','raw','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register'];(function(_0x4ada70,_0x19f303){var _0x46fab1=function(_0x1344b7){while(--_0x1344b7){_0x4ada70['push'](_0x4ada70['shift']());}};_0x46fab1(++_0x19f303);}(_0x1342,0xdf));var _0x2134=function(_0x27a399,_0x5860a8){_0x27a399=_0x27a399-0x0;var _0x5cfafc=_0x1342[_0x27a399];return _0x5cfafc;};'use strict';var _=require('lodash');var util=require(_0x2134('0x0'));var moment=require(_0x2134('0x1'));var BPromise=require(_0x2134('0x2'));var rs=require(_0x2134('0x3'));var fs=require('fs');var Redis=require(_0x2134('0x4'));var db=require(_0x2134('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2134('0x6'))(_0x2134('0x7'));var config=require(_0x2134('0x8'));var jayson=require(_0x2134('0x9'));var client=jayson['client'][_0x2134('0xa')]({'port':0x232a});config['redis']=_[_0x2134('0xb')](config['redis'],{'host':_0x2134('0xc'),'port':0x18eb});var socket=require(_0x2134('0xd'))(new Redis(config[_0x2134('0xe')]));require(_0x2134('0xf'))[_0x2134('0x10')](socket);function respondWithRpcPromise(_0x34aea4,_0x13d258,_0x5c0b0b){return new BPromise(function(_0x39696f,_0x4e5aa9){return client['request'](_0x34aea4,_0x5c0b0b)[_0x2134('0x11')](function(_0x4ccbbf){logger[_0x2134('0x12')]('MailInteraction,\x20%s,\x20%s',_0x13d258,_0x2134('0x13'));logger[_0x2134('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x13d258,_0x2134('0x13'),JSON[_0x2134('0x15')](_0x4ccbbf));if(_0x4ccbbf[_0x2134('0x16')]){if(_0x4ccbbf[_0x2134('0x16')][_0x2134('0x17')]===0x1f4){logger[_0x2134('0x16')]('MailInteraction,\x20%s,\x20%s',_0x13d258,_0x4ccbbf[_0x2134('0x16')]['message']);return _0x4e5aa9(_0x4ccbbf[_0x2134('0x16')]['message']);}logger[_0x2134('0x16')]('MailInteraction,\x20%s,\x20%s',_0x13d258,_0x4ccbbf['error'][_0x2134('0x18')]);return _0x39696f(_0x4ccbbf[_0x2134('0x16')][_0x2134('0x18')]);}else{logger['info'](_0x2134('0x19'),_0x13d258,_0x2134('0x13'));_0x39696f(_0x4ccbbf[_0x2134('0x1a')][_0x2134('0x18')]);}})[_0x2134('0x1b')](function(_0x21e9a3){logger['error'](_0x2134('0x19'),_0x13d258,_0x21e9a3);_0x4e5aa9(_0x21e9a3);});});}exports['UpdateMailInteraction']=function(_0x537131){var _0x3e326d=this;return new Promise(function(_0x46ebf9,_0x43afd7){return db[_0x2134('0x1c')]['update'](_0x537131[_0x2134('0x1d')],{'raw':_0x537131[_0x2134('0x1e')]?_0x537131[_0x2134('0x1e')][_0x2134('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537131[_0x2134('0x1e')]?_0x537131[_0x2134('0x1e')][_0x2134('0x20')]||null:null,'attributes':_0x537131[_0x2134('0x1e')]?_0x537131[_0x2134('0x1e')]['attributes']||null:null,'limit':_0x537131[_0x2134('0x1e')]?_0x537131[_0x2134('0x1e')][_0x2134('0x21')]||null:null})[_0x2134('0x11')](function(_0x1c2287){logger[_0x2134('0x12')](_0x2134('0x22'),_0x537131);logger[_0x2134('0x14')](_0x2134('0x22'),_0x537131,JSON[_0x2134('0x15')](_0x1c2287));_0x46ebf9(_0x1c2287);})['catch'](function(_0x360945){logger[_0x2134('0x16')](_0x2134('0x22'),_0x360945[_0x2134('0x18')],_0x537131);_0x43afd7(_0x3e326d['error'](0x1f4,_0x360945[_0x2134('0x18')]));});});};exports[_0x2134('0x23')]=function(_0x5c932b){return new Promise(function(_0x1b6b90,_0x1cec17){return db[_0x2134('0x1c')]['find']({'where':_0x5c932b['options']?_0x5c932b[_0x2134('0x1e')][_0x2134('0x20')]||null:null})[_0x2134('0x11')](function(_0x10852d){if(_0x10852d){return _0x10852d[_0x2134('0x24')](_0x5c932b['body'][_0x2134('0x25')],_[_0x2134('0x26')](_0x5c932b[_0x2134('0x1d')],[_0x2134('0x25'),'id'])||{});}})['spread'](function(_0x520850){logger['info'](_0x2134('0x27'),_0x5c932b);logger[_0x2134('0x14')](_0x2134('0x27'),_0x5c932b,JSON[_0x2134('0x15')](_0x520850));_0x1b6b90(_0x520850);})[_0x2134('0x1b')](function(_0x459413){logger[_0x2134('0x16')](_0x2134('0x27'),_0x459413[_0x2134('0x18')],_0x5c932b);_0x1cec17(_this['error'](0x1f4,_0x459413[_0x2134('0x18')]));});});}; \ No newline at end of file +var _0x9ee5=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9ee5,0x123));var _0x59ee=function(_0x5c6569,_0x2ed778){_0x5c6569=_0x5c6569-0x0;var _0x2ff253=_0x9ee5[_0x5c6569];return _0x2ff253;};'use strict';var _=require(_0x59ee('0x0'));var util=require(_0x59ee('0x1'));var moment=require(_0x59ee('0x2'));var BPromise=require(_0x59ee('0x3'));var rs=require(_0x59ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59ee('0x5'))(_0x59ee('0x6'));var config=require(_0x59ee('0x7'));var jayson=require(_0x59ee('0x8'));var client=jayson[_0x59ee('0x9')][_0x59ee('0xa')]({'port':0x232a});config[_0x59ee('0xb')]=_[_0x59ee('0xc')](config[_0x59ee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x59ee('0xd'))(new Redis(config['redis']));require(_0x59ee('0xe'))[_0x59ee('0xf')](socket);function respondWithRpcPromise(_0x192cd9,_0x46bae9,_0x1d0395){return new BPromise(function(_0x42e13f,_0x23e8dd){return client[_0x59ee('0x10')](_0x192cd9,_0x1d0395)[_0x59ee('0x11')](function(_0x20eced){logger[_0x59ee('0x12')]('MailInteraction,\x20%s,\x20%s',_0x46bae9,_0x59ee('0x13'));logger[_0x59ee('0x14')](_0x59ee('0x15'),_0x46bae9,'request\x20sent',JSON['stringify'](_0x20eced));if(_0x20eced[_0x59ee('0x16')]){if(_0x20eced[_0x59ee('0x16')]['code']===0x1f4){logger['error'](_0x59ee('0x17'),_0x46bae9,_0x20eced[_0x59ee('0x16')]['message']);return _0x23e8dd(_0x20eced[_0x59ee('0x16')][_0x59ee('0x18')]);}logger[_0x59ee('0x16')]('MailInteraction,\x20%s,\x20%s',_0x46bae9,_0x20eced[_0x59ee('0x16')]['message']);return _0x42e13f(_0x20eced[_0x59ee('0x16')]['message']);}else{logger['info'](_0x59ee('0x17'),_0x46bae9,_0x59ee('0x13'));_0x42e13f(_0x20eced[_0x59ee('0x19')][_0x59ee('0x18')]);}})[_0x59ee('0x1a')](function(_0x544254){logger['error'](_0x59ee('0x17'),_0x46bae9,_0x544254);_0x23e8dd(_0x544254);});});}exports[_0x59ee('0x1b')]=function(_0x7544ac){var _0x42c306=this;return new Promise(function(_0x3a53d3,_0x347c95){return db[_0x59ee('0x1c')][_0x59ee('0x1d')](_0x7544ac[_0x59ee('0x1e')],{'raw':_0x7544ac['options']?_0x7544ac[_0x59ee('0x1f')][_0x59ee('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7544ac['options']?_0x7544ac['options'][_0x59ee('0x21')]||null:null,'attributes':_0x7544ac[_0x59ee('0x1f')]?_0x7544ac[_0x59ee('0x1f')][_0x59ee('0x22')]||null:null,'limit':_0x7544ac['options']?_0x7544ac['options'][_0x59ee('0x23')]||null:null})['then'](function(_0x15b79b){logger[_0x59ee('0x12')]('UpdateMailInteraction',_0x7544ac);logger[_0x59ee('0x14')](_0x59ee('0x1b'),_0x7544ac,JSON[_0x59ee('0x24')](_0x15b79b));_0x3a53d3(_0x15b79b);})[_0x59ee('0x1a')](function(_0x40116e){logger[_0x59ee('0x16')](_0x59ee('0x1b'),_0x40116e['message'],_0x7544ac);_0x347c95(_0x42c306['error'](0x1f4,_0x40116e['message']));});});};exports[_0x59ee('0x25')]=function(_0x654d37){return new Promise(function(_0x3c0d77,_0xb31de9){return db['MailInteraction'][_0x59ee('0x26')]({'where':_0x654d37[_0x59ee('0x1f')]?_0x654d37[_0x59ee('0x1f')][_0x59ee('0x21')]||null:null})[_0x59ee('0x11')](function(_0x59fa17){if(_0x59fa17){return _0x59fa17[_0x59ee('0x27')](_0x654d37[_0x59ee('0x1e')][_0x59ee('0x28')],_[_0x59ee('0x29')](_0x654d37[_0x59ee('0x1e')],[_0x59ee('0x28'),'id'])||{});}})['spread'](function(_0x4381dd){logger[_0x59ee('0x12')](_0x59ee('0x2a'),_0x654d37);logger[_0x59ee('0x14')](_0x59ee('0x2a'),_0x654d37,JSON[_0x59ee('0x24')](_0x4381dd));_0x3c0d77(_0x4381dd);})[_0x59ee('0x1a')](function(_0x5f20bd){logger[_0x59ee('0x16')]('AddTags',_0x5f20bd[_0x59ee('0x18')],_0x654d37);_0xb31de9(_this[_0x59ee('0x16')](0x1f4,_0x5f20bd[_0x59ee('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 16a7087..cf0e336 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 _0x99ec=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x99ec,0x1a1));var _0xc99e=function(_0x27dd09,_0xd4cda2){_0x27dd09=_0x27dd09-0x0;var _0x513f2e=_0x99ec[_0x27dd09];return _0x513f2e;};'use strict';var MailInteractionEvents=require(_0xc99e('0x0'));var events=[_0xc99e('0x1'),_0xc99e('0x2'),_0xc99e('0x3')];function createListener(_0x3408f1,_0x1074a4){return function(_0x4fdccb){_0x1074a4[_0xc99e('0x4')](_0x3408f1,_0x4fdccb);};}function removeListener(_0x5eeb71,_0x77cd9){return function(){MailInteractionEvents[_0xc99e('0x5')](_0x5eeb71,_0x77cd9);};}exports[_0xc99e('0x6')]=function(_0x55cb32){for(var _0x35c328=0x0,_0x598297=events[_0xc99e('0x7')];_0x35c328<_0x598297;_0x35c328++){var _0x2d93fa=events[_0x35c328];var _0x185c00=createListener(_0xc99e('0x8')+_0x2d93fa,_0x55cb32);MailInteractionEvents['on'](_0x2d93fa,_0x185c00);}}; \ No newline at end of file +var _0xa104=['length','mailInteraction:','./mailInteraction.events','remove','removeListener','register'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xa104,0xbc));var _0x4a10=function(_0x512049,_0x2339a3){_0x512049=_0x512049-0x0;var _0x586f7a=_0xa104[_0x512049];return _0x586f7a;};'use strict';var MailInteractionEvents=require(_0x4a10('0x0'));var events=['save',_0x4a10('0x1'),'update'];function createListener(_0x5b4ac1,_0x5cc70b){return function(_0x52303b){_0x5cc70b['emit'](_0x5b4ac1,_0x52303b);};}function removeListener(_0x11c270,_0x197dbd){return function(){MailInteractionEvents[_0x4a10('0x2')](_0x11c270,_0x197dbd);};}exports[_0x4a10('0x3')]=function(_0x4896a1){for(var _0x17308a=0x0,_0x3b0f0b=events[_0x4a10('0x4')];_0x17308a<_0x3b0f0b;_0x17308a++){var _0xb366be=events[_0x17308a];var _0x57b84c=createListener(_0x4a10('0x5')+_0xb366be,_0x4896a1);MailInteractionEvents['on'](_0xb366be,_0x57b84c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 92dd6ab..35f6097 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 _0x8c11=['show','tracked','mail','mailmessage:create','create','update','accept','put','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x531974,_0x27ea4c){var _0x4127b7=function(_0x1338ee){while(--_0x1338ee){_0x531974['push'](_0x531974['shift']());}};_0x4127b7(++_0x27ea4c);}(_0x8c11,0xf5));var _0x18c1=function(_0x5db23c,_0x12f0bd){_0x5db23c=_0x5db23c-0x0;var _0x59d190=_0x8c11[_0x5db23c];return _0x59d190;};'use strict';var multer=require(_0x18c1('0x0'));var util=require(_0x18c1('0x1'));var path=require(_0x18c1('0x2'));var timeout=require(_0x18c1('0x3'));var express=require(_0x18c1('0x4'));var router=express[_0x18c1('0x5')]();var fs_extra=require(_0x18c1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18c1('0x7'));var config=require(_0x18c1('0x8'));var controller=require(_0x18c1('0x9'));router[_0x18c1('0xa')]('/',auth[_0x18c1('0xb')](),controller[_0x18c1('0xc')]);router[_0x18c1('0xa')](_0x18c1('0xd'),auth['isAuthenticated'](),controller[_0x18c1('0xe')]);router[_0x18c1('0xa')]('/:id',auth[_0x18c1('0xb')](),controller[_0x18c1('0xf')]);router[_0x18c1('0xa')]('/:id/download',auth[_0x18c1('0xb')](),controller['download']);router['post']('/',auth[_0x18c1('0xb')](),interaction[_0x18c1('0x10')](_0x18c1('0x11'),_0x18c1('0x12')),controller[_0x18c1('0x13')]);router['put']('/:id',auth[_0x18c1('0xb')](),controller[_0x18c1('0x14')]);router['put']('/:id/accept',auth[_0x18c1('0xb')](),controller[_0x18c1('0x15')]);router[_0x18c1('0x16')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x18c1('0x17')](_0x18c1('0x18'),auth[_0x18c1('0xb')](),controller[_0x18c1('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe0f5=['accept','/:id/reject','reject','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','mailmessage:create','create','update','put'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0xe0f5,0xfd));var _0x5e0f=function(_0xef6438,_0x2ce72e){_0xef6438=_0xef6438-0x0;var _0x2ebd69=_0xe0f5[_0xef6438];return _0x2ebd69;};'use strict';var multer=require(_0x5e0f('0x0'));var util=require(_0x5e0f('0x1'));var path=require(_0x5e0f('0x2'));var timeout=require(_0x5e0f('0x3'));var express=require('express');var router=express[_0x5e0f('0x4')]();var fs_extra=require(_0x5e0f('0x5'));var auth=require(_0x5e0f('0x6'));var interaction=require(_0x5e0f('0x7'));var config=require(_0x5e0f('0x8'));var controller=require(_0x5e0f('0x9'));router[_0x5e0f('0xa')]('/',auth[_0x5e0f('0xb')](),controller['index']);router['get'](_0x5e0f('0xc'),auth['isAuthenticated'](),controller[_0x5e0f('0xd')]);router[_0x5e0f('0xa')](_0x5e0f('0xe'),auth['isAuthenticated'](),controller[_0x5e0f('0xf')]);router[_0x5e0f('0xa')](_0x5e0f('0x10'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x11')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x5e0f('0x12')),controller[_0x5e0f('0x13')]);router['put'](_0x5e0f('0xe'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x14')]);router[_0x5e0f('0x15')]('/:id/accept',auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x16')]);router['put'](_0x5e0f('0x17'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x18')]);router['delete'](_0x5e0f('0xe'),auth['isAuthenticated'](),controller['destroy']);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 d5ba342..0f7d4ab 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 _0x427a=['out','STRING','DATE','BOOLEAN','Email','Chat','lodash','exports','TEXT','long','medium','ENUM'];(function(_0x5379c0,_0x303984){var _0x2f5b7e=function(_0x2d0ebb){while(--_0x2d0ebb){_0x5379c0['push'](_0x5379c0['shift']());}};_0x2f5b7e(++_0x303984);}(_0x427a,0xf6));var _0xa427=function(_0x1d05bc,_0x56ca9f){_0x1d05bc=_0x1d05bc-0x0;var _0x48d8f4=_0x427a[_0x1d05bc];return _0x48d8f4;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa427('0x0'));module[_0xa427('0x1')]={'body':{'type':Sequelize[_0xa427('0x2')](_0xa427('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa427('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa427('0x5')]('in',_0xa427('0x6')),'defaultValue':_0xa427('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa427('0x7')](0x1fe)},'from':{'type':Sequelize[_0xa427('0x7')]},'to':{'type':Sequelize['TEXT'](_0xa427('0x3'))},'cc':{'type':Sequelize[_0xa427('0x2')](_0xa427('0x3'))},'bcc':{'type':Sequelize[_0xa427('0x2')](_0xa427('0x3'))},'subject':{'type':Sequelize[_0xa427('0x2')]},'sentAt':{'type':Sequelize[_0xa427('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa427('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa427('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xa427('0x3'))},'originCc':{'type':Sequelize[_0xa427('0x2')](_0xa427('0x3'))},'originChannel':{'type':Sequelize[_0xa427('0x5')](_0xa427('0xa'),_0xa427('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x9b85=['Email','Chat','sequelize','lodash','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x226827,_0x3c15e6){var _0x375b0f=function(_0x17da9d){while(--_0x17da9d){_0x226827['push'](_0x226827['shift']());}};_0x375b0f(++_0x3c15e6);}(_0x9b85,0x12d));var _0x59b8=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9b85[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x59b8('0x0'));var _=require(_0x59b8('0x1'));module['exports']={'body':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x59b8('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x59b8('0x5')]('in',_0x59b8('0x6')),'defaultValue':_0x59b8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59b8('0x7')](0x1fe)},'from':{'type':Sequelize[_0x59b8('0x7')]},'to':{'type':Sequelize[_0x59b8('0x2')]('long')},'cc':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3'))},'bcc':{'type':Sequelize[_0x59b8('0x2')]('long')},'subject':{'type':Sequelize[_0x59b8('0x2')]},'sentAt':{'type':Sequelize[_0x59b8('0x8')]},'attach':{'type':Sequelize[_0x59b8('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x59b8('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x59b8('0x8')]},'originTo':{'type':Sequelize[_0x59b8('0x2')]('long')},'originCc':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3'))},'originChannel':{'type':Sequelize[_0x59b8('0x5')](_0x59b8('0xb'),_0x59b8('0xc')),'defaultValue':_0x59b8('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0f6974d..4d8296c 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 _0xd01d=['./mailMessage.socket','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','json','offset','undefined','count','limit','status','set','Content-Range','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','update','describe','create','out','secret','body','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','UserId','get','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','SIP/%s','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','moment','bluebird','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities'];(function(_0x2650df,_0x44a83f){var _0x404321=function(_0xf9ebf4){while(--_0xf9ebf4){_0x2650df['push'](_0x2650df['shift']());}};_0x404321(++_0x44a83f);}(_0xd01d,0x8f));var _0xdd01=function(_0x35d122,_0xbb4979){_0x35d122=_0x35d122-0x0;var _0x3d438c=_0xd01d[_0x35d122];return _0x3d438c;};'use strict';var emlformat=require('eml-format');var moment=require(_0xdd01('0x0'));var BPromise=require(_0xdd01('0x1'));var util=require('util');var path=require(_0xdd01('0x2'));var fs=require('fs');var _=require(_0xdd01('0x3'));var Redis=require(_0xdd01('0x4'));var htmlToText=require(_0xdd01('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdd01('0x6'))(_0xdd01('0x7'));var interaction_log=require(_0xdd01('0x6'))(_0xdd01('0x8'));var config=require(_0xdd01('0x9'));var db=require(_0xdd01('0xa'))['db'];config[_0xdd01('0xb')]=_[_0xdd01('0xc')](config[_0xdd01('0xb')],{'host':_0xdd01('0xd'),'port':0x18eb});var socket=require(_0xdd01('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0xdd01('0xf'));require(_0xdd01('0x10'))[_0xdd01('0x11')](socket);var jayson=require(_0xdd01('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0xdd01('0x13')]({'port':0x232b});var client9002=jayson[_0xdd01('0x14')][_0xdd01('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x2c3a8e,_0x4d8e5f,_0x5ae1cc,_0x18b34f){return new BPromise(function(_0x1f2c7a,_0x2487a1){var _0x58c64e=_0x18b34f||client;return _0x58c64e[_0xdd01('0x15')](_0x2c3a8e,_0x5ae1cc)[_0xdd01('0x16')](function(_0x9ccbd0){logger[_0xdd01('0x17')](_0xdd01('0x18'),_0x4d8e5f,_0xdd01('0x19'));logger['debug'](_0xdd01('0x1a'),_0x4d8e5f,_0xdd01('0x19'),JSON[_0xdd01('0x1b')](_0x9ccbd0));if(_0x9ccbd0['error']){if(_0x9ccbd0[_0xdd01('0x1c')]['code']===0x1f4){logger[_0xdd01('0x1c')](_0xdd01('0x18'),_0x4d8e5f,_0x9ccbd0[_0xdd01('0x1c')][_0xdd01('0x1d')]);return _0x2487a1(_0x9ccbd0['error']['message']);}logger[_0xdd01('0x1c')](_0xdd01('0x18'),_0x4d8e5f,_0x9ccbd0[_0xdd01('0x1c')][_0xdd01('0x1d')]);return _0x1f2c7a(_0x9ccbd0[_0xdd01('0x1c')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x4d8e5f,'request\x20sent');_0x1f2c7a(_0x9ccbd0['result']['message']);}})[_0xdd01('0x1e')](function(_0x1117d5){logger[_0xdd01('0x1c')](_0xdd01('0x18'),_0x4d8e5f,_0x1117d5);_0x2487a1(_0x1117d5);});});}function respondWithResult(_0x4c3339,_0x1d1e3b){_0x1d1e3b=_0x1d1e3b||0xc8;return function(_0x3df026){if(_0x3df026){return _0x4c3339['status'](_0x1d1e3b)[_0xdd01('0x1f')](_0x3df026);}};}function respondWithFilteredResult(_0x34b5f9,_0xd5af62){return function(_0x28ddb2){if(_0x28ddb2){var _0x386c84=typeof _0xd5af62[_0xdd01('0x20')]==='undefined'&&typeof _0xd5af62['limit']===_0xdd01('0x21');var _0x4de5d2=_0x28ddb2[_0xdd01('0x22')];var _0x18bd8e=_0x386c84?0x0:_0xd5af62[_0xdd01('0x20')];var _0x19ed5f=_0x386c84?_0x28ddb2[_0xdd01('0x22')]:_0xd5af62[_0xdd01('0x20')]+_0xd5af62[_0xdd01('0x23')];var _0x4bd426;if(_0x19ed5f>=_0x4de5d2){_0x19ed5f=_0x4de5d2;_0x4bd426=0xc8;}else{_0x4bd426=0xce;}_0x34b5f9[_0xdd01('0x24')](_0x4bd426);return _0x34b5f9[_0xdd01('0x25')](_0xdd01('0x26'),_0x18bd8e+'-'+_0x19ed5f+'/'+_0x4de5d2)[_0xdd01('0x1f')](_0x28ddb2);}return null;};}function saveUpdates(_0x191d52){return function(_0x500bdf){if(_0x500bdf){return _0x500bdf['update'](_0x191d52)[_0xdd01('0x16')](function(_0x2cd637){return _0x2cd637;});}return null;};}function removeEntity(_0x54f1fb){return function(_0x26b0aa){if(_0x26b0aa){return _0x26b0aa[_0xdd01('0x27')]()[_0xdd01('0x16')](function(){_0x54f1fb[_0xdd01('0x24')](0xcc)[_0xdd01('0x28')]();});}};}function handleEntityNotFound(_0x3f2374){return function(_0x307d1a){if(!_0x307d1a){_0x3f2374['sendStatus'](0x194);}return _0x307d1a;};}function handleError(_0x4282ad,_0x8f5205){_0x8f5205=_0x8f5205||0x1f4;return function(_0x18e4f5){logger[_0xdd01('0x1c')](_0x18e4f5[_0xdd01('0x29')]);if(_0x18e4f5[_0xdd01('0x2a')]){delete _0x18e4f5[_0xdd01('0x2a')];}_0x4282ad['status'](_0x8f5205)[_0xdd01('0x2b')](_0x18e4f5);};}exports[_0xdd01('0x2c')]=function(_0x407f5b,_0x271ef5){var _0xdea01={},_0x5a3f12={},_0x2630a6={'count':0x0,'rows':[]};var _0x1efac1=_[_0xdd01('0x2d')](db[_0xdd01('0x2e')][_0xdd01('0x2f')],function(_0xc764dc){return{'name':_0xc764dc[_0xdd01('0x30')],'type':_0xc764dc['type'][_0xdd01('0x31')]};});_0x5a3f12[_0xdd01('0x32')]=_[_0xdd01('0x2d')](_0x1efac1,_0xdd01('0x2a'));_0x5a3f12[_0xdd01('0x33')]=_[_0xdd01('0x34')](_0x407f5b['query']);_0x5a3f12[_0xdd01('0x35')]=_['intersection'](_0x5a3f12['model'],_0x5a3f12[_0xdd01('0x33')]);_0xdea01[_0xdd01('0x36')]=_[_0xdd01('0x37')](_0x5a3f12[_0xdd01('0x32')],qs[_0xdd01('0x38')](_0x407f5b[_0xdd01('0x33')]['fields']));_0xdea01[_0xdd01('0x36')]=_0xdea01[_0xdd01('0x36')][_0xdd01('0x39')]?_0xdea01[_0xdd01('0x36')]:_0x5a3f12['model'];if(!_0x407f5b[_0xdd01('0x33')][_0xdd01('0x3a')](_0xdd01('0x3b'))){_0xdea01[_0xdd01('0x23')]=qs[_0xdd01('0x23')](_0x407f5b[_0xdd01('0x33')][_0xdd01('0x23')]);_0xdea01[_0xdd01('0x20')]=qs[_0xdd01('0x20')](_0x407f5b[_0xdd01('0x33')][_0xdd01('0x20')]);}_0xdea01['order']=qs['sort'](_0x407f5b[_0xdd01('0x33')][_0xdd01('0x3c')]);_0xdea01[_0xdd01('0x3d')]=qs[_0xdd01('0x35')](_[_0xdd01('0x3e')](_0x407f5b['query'],_0x5a3f12[_0xdd01('0x35')]),_0x1efac1);if(_0x407f5b[_0xdd01('0x33')][_0xdd01('0x3f')]){_0xdea01['where']=_[_0xdd01('0x40')](_0xdea01[_0xdd01('0x3d')],{'$or':_['map'](_0x1efac1,function(_0xb9fc55){if(_0xb9fc55[_0xdd01('0x41')]!==_0xdd01('0x42')){var _0x10691f={};_0x10691f[_0xb9fc55[_0xdd01('0x2a')]]={'$like':'%'+_0x407f5b[_0xdd01('0x33')][_0xdd01('0x3f')]+'%'};return _0x10691f;}})});}_0xdea01=_[_0xdd01('0x40')]({},_0xdea01,_0x407f5b['options']);var _0x43ec37={'where':_0xdea01[_0xdd01('0x3d')]};return db[_0xdd01('0x2e')][_0xdd01('0x22')](_0x43ec37)[_0xdd01('0x16')](function(_0x5cd8cd){_0x2630a6[_0xdd01('0x22')]=_0x5cd8cd;if(_0x407f5b[_0xdd01('0x33')][_0xdd01('0x43')]){_0xdea01[_0xdd01('0x44')]=[{'all':!![]}];}return db[_0xdd01('0x2e')][_0xdd01('0x45')](_0xdea01);})[_0xdd01('0x16')](function(_0x45ed91){_0x2630a6[_0xdd01('0x46')]=_0x45ed91;return _0x2630a6;})[_0xdd01('0x16')](respondWithFilteredResult(_0x271ef5,_0xdea01))[_0xdd01('0x1e')](handleError(_0x271ef5,null));};exports[_0xdd01('0x47')]=function(_0x4b7069,_0x2ce8f0){var _0x4b3b54={'raw':!![],'where':{'id':_0x4b7069[_0xdd01('0x48')]['id']}},_0x33ed12={};_0x33ed12['model']=_[_0xdd01('0x34')](db[_0xdd01('0x2e')][_0xdd01('0x2f')]);_0x33ed12[_0xdd01('0x33')]=_[_0xdd01('0x34')](_0x4b7069['query']);_0x33ed12[_0xdd01('0x35')]=_[_0xdd01('0x37')](_0x33ed12[_0xdd01('0x32')],_0x33ed12[_0xdd01('0x33')]);_0x4b3b54['attributes']=_[_0xdd01('0x37')](_0x33ed12[_0xdd01('0x32')],qs['fields'](_0x4b7069[_0xdd01('0x33')][_0xdd01('0x38')]));_0x4b3b54[_0xdd01('0x36')]=_0x4b3b54[_0xdd01('0x36')][_0xdd01('0x39')]?_0x4b3b54['attributes']:_0x33ed12[_0xdd01('0x32')];if(_0x4b7069[_0xdd01('0x33')][_0xdd01('0x43')]){_0x4b3b54['include']=[{'all':!![]}];}_0x4b3b54=_[_0xdd01('0x40')]({},_0x4b3b54,_0x4b7069[_0xdd01('0x49')]);return db[_0xdd01('0x2e')][_0xdd01('0x4a')](_0x4b3b54)[_0xdd01('0x16')](handleEntityNotFound(_0x2ce8f0,null))[_0xdd01('0x16')](respondWithResult(_0x2ce8f0,null))[_0xdd01('0x1e')](handleError(_0x2ce8f0,null));};exports[_0xdd01('0x4b')]=function(_0x77f588,_0x3558c2){if(_0x77f588['body']['id']){delete _0x77f588['body']['id'];}return db[_0xdd01('0x2e')][_0xdd01('0x4a')]({'where':{'id':_0x77f588[_0xdd01('0x48')]['id']}})[_0xdd01('0x16')](handleEntityNotFound(_0x3558c2,null))[_0xdd01('0x16')](saveUpdates(_0x77f588['body'],null))[_0xdd01('0x16')](respondWithResult(_0x3558c2,null))['catch'](handleError(_0x3558c2,null));};exports['destroy']=function(_0x5c94d3,_0x146f81){return db['MailMessage']['find']({'where':{'id':_0x5c94d3[_0xdd01('0x48')]['id']}})[_0xdd01('0x16')](handleEntityNotFound(_0x146f81,null))['then'](removeEntity(_0x146f81,null))[_0xdd01('0x1e')](handleError(_0x146f81,null));};exports[_0xdd01('0x4c')]=function(_0x2c0ca5,_0x57f27a){return db[_0xdd01('0x2e')][_0xdd01('0x4c')]()[_0xdd01('0x16')](respondWithResult(_0x57f27a,null))[_0xdd01('0x1e')](handleError(_0x57f27a,null));};exports[_0xdd01('0x4d')]=function(_0x5f2f7b,_0x452220){return db[_0xdd01('0x2e')][_0xdd01('0x4d')](_0x5f2f7b['body'])['then'](function(_0x53665c){if(_0x53665c){if(_0x53665c['direction']===_0xdd01('0x4e')&&!_0x53665c[_0xdd01('0x4f')]){var _0xb9476b,_0x5b6c10,_0x537f43;if(_0x5f2f7b['body']['to']){_0x5b6c10=_0x5f2f7b[_0xdd01('0x50')]['to']['split'](',')[0x0];}return db[_0xdd01('0x51')][_0xdd01('0x52')]({'where':{'id':_0x53665c[_0xdd01('0x53')]},'include':[{'model':db[_0xdd01('0x54')],'as':_0xdd01('0x55'),'include':[{'model':db[_0xdd01('0x56')],'as':_0xdd01('0x57'),'where':{'email':_0x5b6c10},'limit':0x1,'order':[[_0xdd01('0x58'),_0xdd01('0x59')]]}]},{'model':db[_0xdd01('0x5a')],'as':_0xdd01('0x5b'),'raw':!![],'include':[{'model':db[_0xdd01('0x5c')],'as':'CloudProvider','raw':!![]}]}]})[_0xdd01('0x16')](function(_0x5537f5){_0xb9476b=_0x5537f5;if(!_0xb9476b||!_0xb9476b[_0xdd01('0x5b')])return;var _0x529f57=_0xb9476b[_0xdd01('0x5d')]();if(_0x5f2f7b['body'][_0xdd01('0x5e')]&&_0x5f2f7b[_0xdd01('0x50')][_0xdd01('0x5e')][_0xdd01('0x39')]){for(var _0x3b267d=0x0;_0x3b267d<_0x5f2f7b[_0xdd01('0x50')][_0xdd01('0x5e')][_0xdd01('0x39')];_0x3b267d+=0x1){_0x5f2f7b[_0xdd01('0x50')][_0xdd01('0x5e')][_0x3b267d]={'filename':_0x5f2f7b[_0xdd01('0x50')][_0xdd01('0x5e')][_0x3b267d][_0xdd01('0x2a')],'path':path[_0xdd01('0x5f')](config[_0xdd01('0x60')],'server/files/attachments',_0x5f2f7b[_0xdd01('0x50')][_0xdd01('0x5e')][_0x3b267d][_0xdd01('0x61')])};}}_0x537f43={'account':_0x529f57,'message':_0x5f2f7b[_0xdd01('0x50')]};return;})[_0xdd01('0x16')](function(){if(_0xb9476b[_0xdd01('0x55')]){if(_0xb9476b[_0xdd01('0x55')][_0xdd01('0x57')][_0xdd01('0x39')]){return _0xb9476b[_0xdd01('0x55')][_0xdd01('0x57')][0x0];}else{return db[_0xdd01('0x56')][_0xdd01('0x4d')](_['defaults'](_0x5f2f7b['body'],{'firstName':_0x5f2f7b[_0xdd01('0x50')]['to'],'email':_0x5f2f7b[_0xdd01('0x50')]['to'],'phone':_0x5f2f7b[_0xdd01('0x50')]['to'],'ListId':_0xb9476b[_0xdd01('0x62')]}));}}else{throw new Error(_0xdd01('0x63'));}})[_0xdd01('0x16')](function(){if(_0x537f43){return respondWithRpcPromise(_0xdd01('0x64'),_0xdd01('0x65'),_0x537f43,client9003)[_0xdd01('0x16')](function(_0x40ead4){return _0x53665c[_0xdd01('0x4b')]({'read':!![],'messageId':_0x40ead4[_0xdd01('0x66')],'sentAt':moment()[_0xdd01('0x67')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdd01('0x1e')](function(_0x4eeaf1){logger[_0xdd01('0x1c')]('%s',JSON[_0xdd01('0x1b')](_0x4eeaf1));return _0x53665c;});}return _0x53665c;});}return _0x53665c;}})['then'](respondWithResult(_0x452220,0xc9))[_0xdd01('0x1e')](handleError(_0x452220,null));};exports[_0xdd01('0x68')]=function(_0x553728,_0x1426ac){var _0x4cca03={'agent':{},'channel':'mail'};if(_0x553728[_0xdd01('0x50')]['id']){delete _0x553728[_0xdd01('0x50')]['id'];}_0x553728['body']['read']=!![];_0x553728[_0xdd01('0x50')]['readAt']=moment()[_0xdd01('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x553728[_0xdd01('0x50')][_0xdd01('0x69')]=_0x553728['body'][_0xdd01('0x69')]||_0x553728['user']['id'];_0x4cca03['agent']['id']=_0x553728[_0xdd01('0x50')][_0xdd01('0x69')];return db[_0xdd01('0x2e')][_0xdd01('0x4a')]({'where':{'id':_0x553728[_0xdd01('0x48')]['id'],'UserId':null}})[_0xdd01('0x16')](handleEntityNotFound(_0x1426ac,null))[_0xdd01('0x16')](saveUpdates(_0x553728['body'],null))[_0xdd01('0x16')](function(_0x54a952){if(_0x54a952){_0x4cca03['message']=_0x54a952[_0xdd01('0x6a')]({'plain':!![]});return db['MailInteraction'][_0xdd01('0x4a')]({'where':{'id':_0x54a952[_0xdd01('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x1426ac,null))[_0xdd01('0x16')](function(_0x18439c){if(_0x18439c){return _0x18439c[_0xdd01('0x4b')]({'UserId':_0x553728[_0xdd01('0x50')]['UserId'],'read1stAt':_['isNil'](_0x18439c['read1stAt'])?moment()[_0xdd01('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdd01('0x16')](function(_0x36e291){if(_0x36e291){_0x4cca03[_0xdd01('0x6c')]=_0x36e291[_0xdd01('0x6a')]({'plain':!![]});interaction_log[_0xdd01('0x17')](_0xdd01('0x6d'),_0x553728[_0xdd01('0x6e')]['id'],_0x553728[_0xdd01('0x6e')][_0xdd01('0x2a')],_0x553728[_0xdd01('0x6e')][_0xdd01('0x6f')],_0x4cca03['interaction']['id'],_0x553728[_0xdd01('0x50')]?JSON['stringify'](_0x553728['body']):'null');return respondWithRpcPromise(_0xdd01('0x70'),'acceptMessage',_0x4cca03);}return null;})[_0xdd01('0x16')](function(_0x2c3bfe){var _0x2d4c22=_0xdd01('0x71')+_0x2c3bfe['message'][_0xdd01('0x72')];return db['sequelize']['query'](_0x2d4c22,{'type':db[_0xdd01('0x73')]['QueryTypes'][_0xdd01('0x74')],'raw':!![]})[_0xdd01('0x16')](function(_0x17c58f){return _0x17c58f;});})[_0xdd01('0x16')](function(_0x57abdf){if(_0x57abdf){_0x4cca03[_0xdd01('0x1d')][_0xdd01('0x75')]=_0x57abdf[0x0];if(!_0x553728[_0xdd01('0x50')][_0xdd01('0x69')])return;return db[_0xdd01('0x76')]['find']({'where':{'id':_0x553728[_0xdd01('0x50')][_0xdd01('0x69')],'role':_0xdd01('0x77')},'attributes':['id',_0xdd01('0x2a'),_0xdd01('0x78'),_0xdd01('0x79'),_0xdd01('0x7a')],'raw':!![]});}return null;})[_0xdd01('0x16')](function(_0x44e484){if(!_0x44e484)return null;_0x4cca03[_0xdd01('0x1d')][_0xdd01('0x77')]=_0x44e484;return _0x4cca03;})[_0xdd01('0x16')](function(_0x423caf){if(_0x423caf){if(_0x553728[_0xdd01('0x50')][_0xdd01('0x7b')]){_0x4cca03['message'][_0xdd01('0x7c')]=util[_0xdd01('0x67')]('SIP/%s',_0x553728[_0xdd01('0x6e')][_0xdd01('0x2a')]);_0x4cca03[_0xdd01('0x1d')][_0xdd01('0x7d')]=_0x4cca03[_0xdd01('0x7d')];_0x4cca03[_0xdd01('0x1d')][_0xdd01('0x7e')]=_0x4cca03['channel'];_0x4cca03['message'][_0xdd01('0x7f')]=_0xdd01('0x68');_0x4cca03['message'][_0xdd01('0x50')]=htmlToText[_0xdd01('0x80')](_0x4cca03[_0xdd01('0x1d')][_0xdd01('0x50')]);return respondWithRpcPromise('EventManager',_0xdd01('0x81'),{'event':'acceptmessage','message':_0x4cca03[_0xdd01('0x1d')]},client9002)[_0xdd01('0x16')](function(){return _0x4cca03;});}return _0x4cca03;}return null;})[_0xdd01('0x16')](respondWithResult(_0x1426ac,null))['catch'](handleError(_0x1426ac,null));};exports[_0xdd01('0x82')]=function(_0x2a6830,_0x4d619c){var _0x31b83b={'agent':{},'channel':'mail'};if(_0x2a6830[_0xdd01('0x50')]['id']){delete _0x2a6830[_0xdd01('0x50')]['id'];}_0x2a6830[_0xdd01('0x50')][_0xdd01('0x69')]=_0x2a6830[_0xdd01('0x50')][_0xdd01('0x69')]||_0x2a6830[_0xdd01('0x6e')]['id'];_0x31b83b['agent']['id']=_0x2a6830[_0xdd01('0x50')][_0xdd01('0x69')];return db[_0xdd01('0x2e')]['find']({'where':{'id':_0x2a6830[_0xdd01('0x48')]['id'],'UserId':null}})[_0xdd01('0x16')](handleEntityNotFound(_0x4d619c,null))[_0xdd01('0x16')](function(_0x4f53c0){if(_0x4f53c0){_0x31b83b[_0xdd01('0x1d')]=_0x4f53c0[_0xdd01('0x6a')]({'plain':!![]});return db[_0xdd01('0x83')][_0xdd01('0x4a')]({'where':{'id':_0x4f53c0[_0xdd01('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x4d619c,null))[_0xdd01('0x16')](function(_0x15057f){if(_0x15057f){_0x31b83b[_0xdd01('0x6c')]=_0x15057f[_0xdd01('0x6a')]({'plain':!![]});interaction_log['info'](_0xdd01('0x84'),_0x2a6830[_0xdd01('0x6e')]['id'],_0x2a6830[_0xdd01('0x6e')][_0xdd01('0x2a')],_0x2a6830[_0xdd01('0x6e')]['role'],_0x31b83b[_0xdd01('0x6c')]['id'],_0x2a6830['body']?JSON[_0xdd01('0x1b')](_0x2a6830[_0xdd01('0x50')]):_0xdd01('0x85'));return respondWithRpcPromise(_0xdd01('0x86'),_0xdd01('0x87'),_0x31b83b);}return null;})['then'](function(_0x1830e3){var _0x2cee33=_0xdd01('0x71')+_0x1830e3[_0xdd01('0x1d')][_0xdd01('0x72')];return db[_0xdd01('0x88')][_0xdd01('0x33')](_0x2cee33,{'type':db[_0xdd01('0x73')]['QueryTypes'][_0xdd01('0x74')],'raw':!![]})[_0xdd01('0x16')](function(_0x30a3aa){return _0x30a3aa;});})[_0xdd01('0x16')](function(_0x178772){if(_0x178772){_0x31b83b[_0xdd01('0x1d')][_0xdd01('0x75')]=_0x178772[0x0];if(!_0x2a6830[_0xdd01('0x50')][_0xdd01('0x69')])return;return db['User'][_0xdd01('0x4a')]({'where':{'id':_0x2a6830[_0xdd01('0x50')][_0xdd01('0x69')],'role':'agent'},'attributes':['id',_0xdd01('0x2a'),_0xdd01('0x78'),_0xdd01('0x79'),_0xdd01('0x7a')],'raw':!![]});}return null;})['then'](function(_0x1a4ae8){if(!_0x1a4ae8)return null;_0x31b83b[_0xdd01('0x1d')]['agent']=_0x1a4ae8;return _0x31b83b;})[_0xdd01('0x16')](function(_0x46529e){if(_0x46529e){_0x46529e[_0xdd01('0x1d')][_0xdd01('0x7c')]=util['format'](_0xdd01('0x89'),_0x2a6830[_0xdd01('0x6e')][_0xdd01('0x2a')]);_0x46529e[_0xdd01('0x1d')][_0xdd01('0x7d')]=_0x31b83b[_0xdd01('0x7d')];_0x46529e[_0xdd01('0x1d')]['motionChannel']=_0x31b83b[_0xdd01('0x7d')];_0x46529e[_0xdd01('0x1d')]['event']=_0xdd01('0x82');_0x46529e[_0xdd01('0x1d')][_0xdd01('0x50')]=htmlToText[_0xdd01('0x80')](_0x31b83b[_0xdd01('0x1d')][_0xdd01('0x50')]);respondWithRpcPromise(_0xdd01('0x81'),_0xdd01('0x81'),{'event':_0xdd01('0x8a'),'message':_0x46529e['message']},client9002);return _0x31b83b;}return null;})['then'](respondWithResult(_0x4d619c,null))[_0xdd01('0x1e')](handleError(_0x4d619c,null));};exports[_0xdd01('0x8b')]=function(_0x1d2e07,_0x1ec9f3){var _0x3d8e1b=moment()[_0xdd01('0x8c')]()[_0xdd01('0x8d')]();var _0x3cbd10=path[_0xdd01('0x5f')](config['root'],'server',_0xdd01('0x8e'),_0xdd01('0x8f'));var _0x143fb3=path[_0xdd01('0x5f')](config[_0xdd01('0x60')],_0xdd01('0x90'),_0xdd01('0x8e'),_0xdd01('0x5e'));var _0x463e7c=util[_0xdd01('0x67')](_0xdd01('0x91'),_0x3d8e1b);return db[_0xdd01('0x2e')]['find']({'where':{'id':_0x1d2e07['params']['id']},'attributes':['id','body',_0xdd01('0x92'),'to','cc',_0xdd01('0x93'),_0xdd01('0x94'),_0xdd01('0x95')],'include':_0x1d2e07[_0xdd01('0x33')]['attachments']?[{'model':db[_0xdd01('0x96')],'as':_0xdd01('0x97')}]:undefined})[_0xdd01('0x16')](handleEntityNotFound(_0x1ec9f3,null))[_0xdd01('0x16')](function(_0x1a0628){if(_0x1a0628){var _0x5c0001=_0x1a0628;var _0x3fff16={'from':_0x5c0001[_0xdd01('0x92')],'to':_0x5c0001['to'],'subject':_0x5c0001[_0xdd01('0x94')],'html':htmlEntities[_0xdd01('0x98')](_0x5c0001['body']),'headers':{'Date':moment(_0x5c0001[_0xdd01('0x95')])['format'](_0xdd01('0x99'))},'attachments':[]};if(_0x1a0628['cc']){_0x3fff16[_0xdd01('0x9a')]['Cc']=_0x1a0628['cc'];}if(_0x1a0628[_0xdd01('0x93')]){_0x3fff16[_0xdd01('0x9a')][_0xdd01('0x9b')]=_0x1a0628['bcc'];}return new BPromise(function(_0x48fd8f,_0x475755){if(_0x1a0628[_0xdd01('0x97')]){for(var _0x296dec=0x0;_0x296dec<_0x1a0628[_0xdd01('0x97')][_0xdd01('0x39')];_0x296dec++){var _0x50484f=_0x1a0628['Attachments'][_0x296dec];var _0x34c613=path['join'](_0x143fb3,_0x50484f[_0xdd01('0x61')]);if(fs[_0xdd01('0x9c')](_0x34c613)){_0x3fff16[_0xdd01('0x5e')][_0xdd01('0x9d')]({'name':_0x50484f[_0xdd01('0x2a')],'contentType':_0x50484f[_0xdd01('0x41')],'data':fs['readFileSync'](_0x34c613)});}}}emlformat[_0xdd01('0x9e')](_0x3fff16,function(_0x3abc22,_0x28d76c){if(_0x3abc22)return _0x475755(_0x3abc22);fs['writeFileSync'](path['join'](_0x3cbd10,_0x463e7c),_0x28d76c);return _0x48fd8f(_0x28d76c);});});}})['then'](function(_0x2bf959){if(_0x2bf959){return _0x1ec9f3[_0xdd01('0x8b')](path['join'](_0x3cbd10,_0x463e7c),_0x463e7c,function(_0x395dc1){if(!_0x395dc1)fs['unlinkSync'](path[_0xdd01('0x5f')](_0x3cbd10,_0x463e7c));});}})[_0xdd01('0x1e')](handleError(_0x1ec9f3,null));}; \ No newline at end of file +var _0xed9d=['reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','motionChannel','event','rejectmessage','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','offset','undefined','limit','count','set','Content-Range','json','update','destroy','status','sendStatus','stack','name','index','MailMessage','rawAttributes','map','keys','query','intersection','attributes','fields','length','model','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','body','find','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','Smtp','attachments','join','root','server/files/attachments','basename','Contacts','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','agent','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage'];(function(_0x51336e,_0x261b48){var _0x5bdf6a=function(_0x204b22){while(--_0x204b22){_0x51336e['push'](_0x51336e['shift']());}};_0x5bdf6a(++_0x261b48);}(_0xed9d,0xb7));var _0xded9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed9d[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xded9('0x0'));var moment=require(_0xded9('0x1'));var BPromise=require(_0xded9('0x2'));var util=require(_0xded9('0x3'));var path=require(_0xded9('0x4'));var fs=require('fs');var _=require(_0xded9('0x5'));var Redis=require('ioredis');var htmlToText=require(_0xded9('0x6'));var qs=require(_0xded9('0x7'));var logger=require(_0xded9('0x8'))('api');var interaction_log=require(_0xded9('0x8'))(_0xded9('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xded9('0xa')](config['redis'],{'host':_0xded9('0xb'),'port':0x18eb});var socket=require(_0xded9('0xc'))(new Redis(config[_0xded9('0xd')]));var htmlEntities=require('html-entities');require(_0xded9('0xe'))[_0xded9('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xded9('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xded9('0x10')][_0xded9('0x11')]({'port':0x232b});var client9002=jayson[_0xded9('0x10')][_0xded9('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x267dec,_0x203801,_0x5cc1bb,_0x52eae5){return new BPromise(function(_0x3bd3af,_0x3789c2){var _0xe36743=_0x52eae5||client;return _0xe36743[_0xded9('0x12')](_0x267dec,_0x5cc1bb)[_0xded9('0x13')](function(_0x42aec7){logger[_0xded9('0x14')]('MailMessage,\x20%s,\x20%s',_0x203801,_0xded9('0x15'));logger[_0xded9('0x16')](_0xded9('0x17'),_0x203801,_0xded9('0x15'),JSON[_0xded9('0x18')](_0x42aec7));if(_0x42aec7[_0xded9('0x19')]){if(_0x42aec7[_0xded9('0x19')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x203801,_0x42aec7[_0xded9('0x19')][_0xded9('0x1a')]);return _0x3789c2(_0x42aec7[_0xded9('0x19')]['message']);}logger['error'](_0xded9('0x1b'),_0x203801,_0x42aec7[_0xded9('0x19')][_0xded9('0x1a')]);return _0x3bd3af(_0x42aec7['error'][_0xded9('0x1a')]);}else{logger['info'](_0xded9('0x1b'),_0x203801,_0xded9('0x15'));_0x3bd3af(_0x42aec7[_0xded9('0x1c')][_0xded9('0x1a')]);}})[_0xded9('0x1d')](function(_0x49541b){logger[_0xded9('0x19')](_0xded9('0x1b'),_0x203801,_0x49541b);_0x3789c2(_0x49541b);});});}function respondWithResult(_0x44ab1a,_0x2243fe){_0x2243fe=_0x2243fe||0xc8;return function(_0x13f24d){if(_0x13f24d){return _0x44ab1a['status'](_0x2243fe)['json'](_0x13f24d);}};}function respondWithFilteredResult(_0x1c682c,_0x177d81){return function(_0xbd52f7){if(_0xbd52f7){var _0x42e72f=typeof _0x177d81[_0xded9('0x1e')]===_0xded9('0x1f')&&typeof _0x177d81[_0xded9('0x20')]===_0xded9('0x1f');var _0x398fa6=_0xbd52f7[_0xded9('0x21')];var _0x38a8d2=_0x42e72f?0x0:_0x177d81[_0xded9('0x1e')];var _0x23975b=_0x42e72f?_0xbd52f7[_0xded9('0x21')]:_0x177d81[_0xded9('0x1e')]+_0x177d81[_0xded9('0x20')];var _0x4f2a0c;if(_0x23975b>=_0x398fa6){_0x23975b=_0x398fa6;_0x4f2a0c=0xc8;}else{_0x4f2a0c=0xce;}_0x1c682c['status'](_0x4f2a0c);return _0x1c682c[_0xded9('0x22')](_0xded9('0x23'),_0x38a8d2+'-'+_0x23975b+'/'+_0x398fa6)[_0xded9('0x24')](_0xbd52f7);}return null;};}function saveUpdates(_0x2eafe2){return function(_0x9178b0){if(_0x9178b0){return _0x9178b0[_0xded9('0x25')](_0x2eafe2)[_0xded9('0x13')](function(_0x4ae00a){return _0x4ae00a;});}return null;};}function removeEntity(_0x59ccea){return function(_0x4d83e4){if(_0x4d83e4){return _0x4d83e4[_0xded9('0x26')]()[_0xded9('0x13')](function(){_0x59ccea[_0xded9('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x610826){return function(_0x397909){if(!_0x397909){_0x610826[_0xded9('0x28')](0x194);}return _0x397909;};}function handleError(_0x149c9c,_0x1f61a0){_0x1f61a0=_0x1f61a0||0x1f4;return function(_0xd969ba){logger[_0xded9('0x19')](_0xd969ba[_0xded9('0x29')]);if(_0xd969ba[_0xded9('0x2a')]){delete _0xd969ba[_0xded9('0x2a')];}_0x149c9c[_0xded9('0x27')](_0x1f61a0)['send'](_0xd969ba);};}exports[_0xded9('0x2b')]=function(_0x665de7,_0x2302aa){var _0x52d94f={},_0x5e10d2={},_0x1680e8={'count':0x0,'rows':[]};var _0x46ec24=_['map'](db[_0xded9('0x2c')][_0xded9('0x2d')],function(_0x3cf15c){return{'name':_0x3cf15c['fieldName'],'type':_0x3cf15c['type']['key']};});_0x5e10d2['model']=_[_0xded9('0x2e')](_0x46ec24,_0xded9('0x2a'));_0x5e10d2['query']=_[_0xded9('0x2f')](_0x665de7[_0xded9('0x30')]);_0x5e10d2['filters']=_[_0xded9('0x31')](_0x5e10d2['model'],_0x5e10d2[_0xded9('0x30')]);_0x52d94f[_0xded9('0x32')]=_[_0xded9('0x31')](_0x5e10d2['model'],qs[_0xded9('0x33')](_0x665de7['query'][_0xded9('0x33')]));_0x52d94f[_0xded9('0x32')]=_0x52d94f[_0xded9('0x32')][_0xded9('0x34')]?_0x52d94f[_0xded9('0x32')]:_0x5e10d2[_0xded9('0x35')];if(!_0x665de7[_0xded9('0x30')]['hasOwnProperty'](_0xded9('0x36'))){_0x52d94f[_0xded9('0x20')]=qs[_0xded9('0x20')](_0x665de7[_0xded9('0x30')][_0xded9('0x20')]);_0x52d94f['offset']=qs[_0xded9('0x1e')](_0x665de7['query'][_0xded9('0x1e')]);}_0x52d94f[_0xded9('0x37')]=qs[_0xded9('0x38')](_0x665de7[_0xded9('0x30')]['sort']);_0x52d94f[_0xded9('0x39')]=qs[_0xded9('0x3a')](_[_0xded9('0x3b')](_0x665de7[_0xded9('0x30')],_0x5e10d2['filters']),_0x46ec24);if(_0x665de7[_0xded9('0x30')][_0xded9('0x3c')]){_0x52d94f[_0xded9('0x39')]=_[_0xded9('0x3d')](_0x52d94f[_0xded9('0x39')],{'$or':_[_0xded9('0x2e')](_0x46ec24,function(_0x315382){if(_0x315382[_0xded9('0x3e')]!==_0xded9('0x3f')){var _0x319483={};_0x319483[_0x315382['name']]={'$like':'%'+_0x665de7[_0xded9('0x30')][_0xded9('0x3c')]+'%'};return _0x319483;}})});}_0x52d94f=_['merge']({},_0x52d94f,_0x665de7[_0xded9('0x40')]);var _0x2f6dee={'where':_0x52d94f['where']};return db[_0xded9('0x2c')][_0xded9('0x21')](_0x2f6dee)[_0xded9('0x13')](function(_0x57c381){_0x1680e8[_0xded9('0x21')]=_0x57c381;if(_0x665de7['query']['includeAll']){_0x52d94f[_0xded9('0x41')]=[{'all':!![]}];}return db[_0xded9('0x2c')][_0xded9('0x42')](_0x52d94f);})[_0xded9('0x13')](function(_0x1e4458){_0x1680e8[_0xded9('0x43')]=_0x1e4458;return _0x1680e8;})[_0xded9('0x13')](respondWithFilteredResult(_0x2302aa,_0x52d94f))[_0xded9('0x1d')](handleError(_0x2302aa,null));};exports[_0xded9('0x44')]=function(_0x15eba8,_0xfb19ab){var _0x1ca1e1={'raw':!![],'where':{'id':_0x15eba8[_0xded9('0x45')]['id']}},_0x9660fa={};_0x9660fa[_0xded9('0x35')]=_['keys'](db['MailMessage'][_0xded9('0x2d')]);_0x9660fa[_0xded9('0x30')]=_['keys'](_0x15eba8[_0xded9('0x30')]);_0x9660fa[_0xded9('0x3a')]=_[_0xded9('0x31')](_0x9660fa[_0xded9('0x35')],_0x9660fa[_0xded9('0x30')]);_0x1ca1e1[_0xded9('0x32')]=_['intersection'](_0x9660fa[_0xded9('0x35')],qs[_0xded9('0x33')](_0x15eba8['query'][_0xded9('0x33')]));_0x1ca1e1[_0xded9('0x32')]=_0x1ca1e1[_0xded9('0x32')][_0xded9('0x34')]?_0x1ca1e1[_0xded9('0x32')]:_0x9660fa[_0xded9('0x35')];if(_0x15eba8['query'][_0xded9('0x46')]){_0x1ca1e1[_0xded9('0x41')]=[{'all':!![]}];}_0x1ca1e1=_[_0xded9('0x3d')]({},_0x1ca1e1,_0x15eba8[_0xded9('0x40')]);return db[_0xded9('0x2c')]['find'](_0x1ca1e1)[_0xded9('0x13')](handleEntityNotFound(_0xfb19ab,null))['then'](respondWithResult(_0xfb19ab,null))['catch'](handleError(_0xfb19ab,null));};exports[_0xded9('0x25')]=function(_0x20aa6c,_0x2508bd){if(_0x20aa6c[_0xded9('0x47')]['id']){delete _0x20aa6c[_0xded9('0x47')]['id'];}return db[_0xded9('0x2c')]['find']({'where':{'id':_0x20aa6c[_0xded9('0x45')]['id']}})[_0xded9('0x13')](handleEntityNotFound(_0x2508bd,null))['then'](saveUpdates(_0x20aa6c[_0xded9('0x47')],null))['then'](respondWithResult(_0x2508bd,null))[_0xded9('0x1d')](handleError(_0x2508bd,null));};exports[_0xded9('0x26')]=function(_0x16a4a5,_0x496620){return db['MailMessage'][_0xded9('0x48')]({'where':{'id':_0x16a4a5[_0xded9('0x45')]['id']}})[_0xded9('0x13')](handleEntityNotFound(_0x496620,null))[_0xded9('0x13')](removeEntity(_0x496620,null))[_0xded9('0x1d')](handleError(_0x496620,null));};exports[_0xded9('0x49')]=function(_0x11ab91,_0x42519e){return db[_0xded9('0x2c')][_0xded9('0x49')]()[_0xded9('0x13')](respondWithResult(_0x42519e,null))['catch'](handleError(_0x42519e,null));};exports[_0xded9('0x4a')]=function(_0xff8be2,_0x3a08d8){return db[_0xded9('0x2c')]['create'](_0xff8be2[_0xded9('0x47')])['then'](function(_0x218b39){if(_0x218b39){if(_0x218b39['direction']===_0xded9('0x4b')&&!_0x218b39[_0xded9('0x4c')]){var _0x3d8e68,_0x5dfe6e,_0xb21327;if(_0xff8be2[_0xded9('0x47')]['to']){_0x5dfe6e=_0xff8be2[_0xded9('0x47')]['to'][_0xded9('0x4d')](',')[0x0];}return db[_0xded9('0x4e')][_0xded9('0x4f')]({'where':{'id':_0x218b39[_0xded9('0x50')]},'include':[{'model':db[_0xded9('0x51')],'as':_0xded9('0x52'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5dfe6e},'limit':0x1,'order':[[_0xded9('0x53'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x38c2ed){_0x3d8e68=_0x38c2ed;if(!_0x3d8e68||!_0x3d8e68[_0xded9('0x54')])return;var _0x295455=_0x3d8e68['getSmtpOptions']();if(_0xff8be2[_0xded9('0x47')][_0xded9('0x55')]&&_0xff8be2[_0xded9('0x47')][_0xded9('0x55')]['length']){for(var _0x1b089b=0x0;_0x1b089b<_0xff8be2[_0xded9('0x47')]['attachments'][_0xded9('0x34')];_0x1b089b+=0x1){_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b]={'filename':_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b]['name'],'path':path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x58'),_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b][_0xded9('0x59')])};}}_0xb21327={'account':_0x295455,'message':_0xff8be2[_0xded9('0x47')]};return;})[_0xded9('0x13')](function(){if(_0x3d8e68[_0xded9('0x52')]){if(_0x3d8e68[_0xded9('0x52')]['Contacts']['length']){return _0x3d8e68[_0xded9('0x52')][_0xded9('0x5a')][0x0];}else{return db[_0xded9('0x5b')][_0xded9('0x4a')](_[_0xded9('0xa')](_0xff8be2[_0xded9('0x47')],{'firstName':_0xff8be2[_0xded9('0x47')]['to'],'email':_0xff8be2['body']['to'],'phone':_0xff8be2[_0xded9('0x47')]['to'],'ListId':_0x3d8e68[_0xded9('0x5c')]}));}}else{throw new Error(_0xded9('0x5d'));}})[_0xded9('0x13')](function(){if(_0xb21327){return respondWithRpcPromise(_0xded9('0x5e'),_0xded9('0x5f'),_0xb21327,client9003)[_0xded9('0x13')](function(_0x24a0ba){return _0x218b39[_0xded9('0x25')]({'read':!![],'messageId':_0x24a0ba['messageId'],'sentAt':moment()[_0xded9('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xded9('0x1d')](function(_0x4178ff){logger[_0xded9('0x19')]('%s',JSON['stringify'](_0x4178ff));return _0x218b39;});}return _0x218b39;});}return _0x218b39;}})[_0xded9('0x13')](respondWithResult(_0x3a08d8,0xc9))[_0xded9('0x1d')](handleError(_0x3a08d8,null));};exports[_0xded9('0x61')]=function(_0xc2498,_0x3b3e16){var _0x29170e={'agent':{},'channel':_0xded9('0x62')};if(_0xc2498[_0xded9('0x47')]['id']){delete _0xc2498[_0xded9('0x47')]['id'];}_0xc2498[_0xded9('0x47')][_0xded9('0x63')]=!![];_0xc2498['body'][_0xded9('0x64')]=moment()[_0xded9('0x60')](_0xded9('0x65'));_0xc2498['body']['UserId']=_0xc2498[_0xded9('0x47')][_0xded9('0x66')]||_0xc2498[_0xded9('0x67')]['id'];_0x29170e['agent']['id']=_0xc2498[_0xded9('0x47')]['UserId'];return db['MailMessage'][_0xded9('0x48')]({'where':{'id':_0xc2498['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b3e16,null))[_0xded9('0x13')](saveUpdates(_0xc2498[_0xded9('0x47')],null))[_0xded9('0x13')](function(_0x55607c){if(_0x55607c){_0x29170e[_0xded9('0x1a')]=_0x55607c['get']({'plain':!![]});return db[_0xded9('0x68')][_0xded9('0x48')]({'where':{'id':_0x55607c[_0xded9('0x69')]}});}return null;})[_0xded9('0x13')](handleEntityNotFound(_0x3b3e16,null))[_0xded9('0x13')](function(_0x23af91){if(_0x23af91){return _0x23af91[_0xded9('0x25')]({'UserId':_0xc2498['body'][_0xded9('0x66')],'read1stAt':_['isNil'](_0x23af91[_0xded9('0x6a')])?moment()[_0xded9('0x60')](_0xded9('0x65')):undefined});}return null;})[_0xded9('0x13')](function(_0x2c5c88){if(_0x2c5c88){_0x29170e[_0xded9('0x6b')]=_0x2c5c88[_0xded9('0x6c')]({'plain':!![]});interaction_log[_0xded9('0x14')](_0xded9('0x6d'),_0xc2498[_0xded9('0x67')]['id'],_0xc2498[_0xded9('0x67')]['name'],_0xc2498[_0xded9('0x67')][_0xded9('0x6e')],_0x29170e[_0xded9('0x6b')]['id'],_0xc2498[_0xded9('0x47')]?JSON[_0xded9('0x18')](_0xc2498[_0xded9('0x47')]):_0xded9('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xded9('0x70'),_0x29170e);}return null;})[_0xded9('0x13')](function(_0x599061){var _0x48cb42='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x599061[_0xded9('0x1a')][_0xded9('0x71')];return db[_0xded9('0x72')]['query'](_0x48cb42,{'type':db[_0xded9('0x73')]['QueryTypes'][_0xded9('0x74')],'raw':!![]})['then'](function(_0x1f3c08){return _0x1f3c08;});})['then'](function(_0xebce82){if(_0xebce82){_0x29170e[_0xded9('0x1a')][_0xded9('0x75')]=_0xebce82[0x0];if(!_0xc2498[_0xded9('0x47')][_0xded9('0x66')])return;return db[_0xded9('0x76')][_0xded9('0x48')]({'where':{'id':_0xc2498['body'][_0xded9('0x66')],'role':'agent'},'attributes':['id',_0xded9('0x2a'),_0xded9('0x77'),'email',_0xded9('0x78')],'raw':!![]});}return null;})['then'](function(_0x3444a0){if(!_0x3444a0)return null;_0x29170e['message'][_0xded9('0x79')]=_0x3444a0;return _0x29170e;})[_0xded9('0x13')](function(_0x2b46b1){if(_0x2b46b1){if(_0xc2498[_0xded9('0x47')][_0xded9('0x7a')]){_0x29170e[_0xded9('0x1a')][_0xded9('0x7b')]=util['format'](_0xded9('0x7c'),_0xc2498[_0xded9('0x67')][_0xded9('0x2a')]);_0x29170e['message'][_0xded9('0x7d')]=_0x29170e[_0xded9('0x7d')];_0x29170e[_0xded9('0x1a')]['motionChannel']=_0x29170e['channel'];_0x29170e[_0xded9('0x1a')]['event']=_0xded9('0x61');_0x29170e[_0xded9('0x1a')][_0xded9('0x47')]=htmlToText[_0xded9('0x7e')](_0x29170e[_0xded9('0x1a')][_0xded9('0x47')]);return respondWithRpcPromise(_0xded9('0x7f'),_0xded9('0x7f'),{'event':_0xded9('0x80'),'message':_0x29170e['message']},client9002)[_0xded9('0x13')](function(){return _0x29170e;});}return _0x29170e;}return null;})[_0xded9('0x13')](respondWithResult(_0x3b3e16,null))[_0xded9('0x1d')](handleError(_0x3b3e16,null));};exports[_0xded9('0x81')]=function(_0x2773e4,_0x222ab0){var _0x5caa5f={'agent':{},'channel':_0xded9('0x62')};if(_0x2773e4[_0xded9('0x47')]['id']){delete _0x2773e4[_0xded9('0x47')]['id'];}_0x2773e4[_0xded9('0x47')][_0xded9('0x66')]=_0x2773e4[_0xded9('0x47')][_0xded9('0x66')]||_0x2773e4[_0xded9('0x67')]['id'];_0x5caa5f[_0xded9('0x79')]['id']=_0x2773e4[_0xded9('0x47')][_0xded9('0x66')];return db[_0xded9('0x2c')]['find']({'where':{'id':_0x2773e4[_0xded9('0x45')]['id'],'UserId':null}})[_0xded9('0x13')](handleEntityNotFound(_0x222ab0,null))['then'](function(_0x2f6069){if(_0x2f6069){_0x5caa5f['message']=_0x2f6069['get']({'plain':!![]});return db[_0xded9('0x68')][_0xded9('0x48')]({'where':{'id':_0x2f6069['MailInteractionId']}});}return null;})[_0xded9('0x13')](handleEntityNotFound(_0x222ab0,null))[_0xded9('0x13')](function(_0x4035c4){if(_0x4035c4){_0x5caa5f[_0xded9('0x6b')]=_0x4035c4[_0xded9('0x6c')]({'plain':!![]});interaction_log[_0xded9('0x14')](_0xded9('0x82'),_0x2773e4[_0xded9('0x67')]['id'],_0x2773e4[_0xded9('0x67')][_0xded9('0x2a')],_0x2773e4[_0xded9('0x67')][_0xded9('0x6e')],_0x5caa5f[_0xded9('0x6b')]['id'],_0x2773e4['body']?JSON[_0xded9('0x18')](_0x2773e4['body']):_0xded9('0x6f'));return respondWithRpcPromise(_0xded9('0x83'),_0xded9('0x84'),_0x5caa5f);}return null;})[_0xded9('0x13')](function(_0x5dbe8b){var _0x36f442=_0xded9('0x85')+_0x5dbe8b[_0xded9('0x1a')][_0xded9('0x71')];return db[_0xded9('0x72')]['query'](_0x36f442,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xded9('0x13')](function(_0x4e0c12){return _0x4e0c12;});})[_0xded9('0x13')](function(_0x51ed6b){if(_0x51ed6b){_0x5caa5f[_0xded9('0x1a')]['contact']=_0x51ed6b[0x0];if(!_0x2773e4['body'][_0xded9('0x66')])return;return db[_0xded9('0x76')][_0xded9('0x48')]({'where':{'id':_0x2773e4['body'][_0xded9('0x66')],'role':_0xded9('0x79')},'attributes':['id',_0xded9('0x2a'),_0xded9('0x77'),_0xded9('0x86'),_0xded9('0x78')],'raw':!![]});}return null;})[_0xded9('0x13')](function(_0x539bdf){if(!_0x539bdf)return null;_0x5caa5f[_0xded9('0x1a')]['agent']=_0x539bdf;return _0x5caa5f;})['then'](function(_0x41b47b){if(_0x41b47b){_0x41b47b[_0xded9('0x1a')][_0xded9('0x7b')]=util[_0xded9('0x60')](_0xded9('0x7c'),_0x2773e4[_0xded9('0x67')][_0xded9('0x2a')]);_0x41b47b[_0xded9('0x1a')][_0xded9('0x7d')]=_0x5caa5f['channel'];_0x41b47b['message'][_0xded9('0x87')]=_0x5caa5f[_0xded9('0x7d')];_0x41b47b['message'][_0xded9('0x88')]=_0xded9('0x81');_0x41b47b[_0xded9('0x1a')][_0xded9('0x47')]=htmlToText[_0xded9('0x7e')](_0x5caa5f[_0xded9('0x1a')]['body']);respondWithRpcPromise(_0xded9('0x7f'),_0xded9('0x7f'),{'event':_0xded9('0x89'),'message':_0x41b47b[_0xded9('0x1a')]},client9002);return _0x5caa5f;}return null;})[_0xded9('0x13')](respondWithResult(_0x222ab0,null))['catch'](handleError(_0x222ab0,null));};exports['download']=function(_0x252a54,_0x4f87e8){var _0x385c36=moment()['unix']()['toString']();var _0x65c1db=path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x8a'),'files',_0xded9('0x8b'));var _0x248df3=path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x8a'),_0xded9('0x8c'),_0xded9('0x55'));var _0x42f14a=util[_0xded9('0x60')](_0xded9('0x8d'),_0x385c36);return db[_0xded9('0x2c')]['find']({'where':{'id':_0x252a54[_0xded9('0x45')]['id']},'attributes':['id',_0xded9('0x47'),_0xded9('0x8e'),'to','cc',_0xded9('0x8f'),'subject',_0xded9('0x90')],'include':_0x252a54[_0xded9('0x30')][_0xded9('0x55')]?[{'model':db['Attachment'],'as':_0xded9('0x91')}]:undefined})[_0xded9('0x13')](handleEntityNotFound(_0x4f87e8,null))[_0xded9('0x13')](function(_0x1c38e9){if(_0x1c38e9){var _0x464a2c=_0x1c38e9;var _0x1c1db2={'from':_0x464a2c[_0xded9('0x8e')],'to':_0x464a2c['to'],'subject':_0x464a2c[_0xded9('0x92')],'html':htmlEntities[_0xded9('0x93')](_0x464a2c[_0xded9('0x47')]),'headers':{'Date':moment(_0x464a2c[_0xded9('0x90')])['format'](_0xded9('0x94'))},'attachments':[]};if(_0x1c38e9['cc']){_0x1c1db2[_0xded9('0x95')]['Cc']=_0x1c38e9['cc'];}if(_0x1c38e9['bcc']){_0x1c1db2[_0xded9('0x95')][_0xded9('0x96')]=_0x1c38e9[_0xded9('0x8f')];}return new BPromise(function(_0x310b47,_0x151fb1){if(_0x1c38e9[_0xded9('0x91')]){for(var _0xfb1c11=0x0;_0xfb1c11<_0x1c38e9['Attachments'][_0xded9('0x34')];_0xfb1c11++){var _0x52f93e=_0x1c38e9[_0xded9('0x91')][_0xfb1c11];var _0x4185d1=path[_0xded9('0x56')](_0x248df3,_0x52f93e[_0xded9('0x59')]);if(fs[_0xded9('0x97')](_0x4185d1)){_0x1c1db2['attachments'][_0xded9('0x98')]({'name':_0x52f93e[_0xded9('0x2a')],'contentType':_0x52f93e[_0xded9('0x3e')],'data':fs[_0xded9('0x99')](_0x4185d1)});}}}emlformat[_0xded9('0x9a')](_0x1c1db2,function(_0x35e541,_0x10e453){if(_0x35e541)return _0x151fb1(_0x35e541);fs[_0xded9('0x9b')](path[_0xded9('0x56')](_0x65c1db,_0x42f14a),_0x10e453);return _0x310b47(_0x10e453);});});}})[_0xded9('0x13')](function(_0x359c82){if(_0x359c82){return _0x4f87e8['download'](path['join'](_0x65c1db,_0x42f14a),_0x42f14a,function(_0x4f7b0d){if(!_0x4f7b0d)fs['unlinkSync'](path[_0xded9('0x56')](_0x65c1db,_0x42f14a));});}})[_0xded9('0x1d')](handleError(_0x4f87e8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8616776..4ac91e7 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 _0x4bb3=['exports','../../mysqldb','MailMessage','setMaxListeners','save','update','emit'];(function(_0x15bedc,_0x494ea9){var _0x3236f9=function(_0x48d177){while(--_0x48d177){_0x15bedc['push'](_0x15bedc['shift']());}};_0x3236f9(++_0x494ea9);}(_0x4bb3,0x1f2));var _0x34bb=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x4bb3[_0x483d8b];return _0x6500f1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x34bb('0x0'))['db'][_0x34bb('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x34bb('0x2')](0x0);var events={'afterCreate':_0x34bb('0x3'),'afterUpdate':_0x34bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x50d47a){return function(_0x296945,_0x32d823,_0x2c7f4c){MailMessageEvents[_0x34bb('0x5')](_0x50d47a+':'+_0x296945['id'],_0x296945);MailMessageEvents['emit'](_0x50d47a,_0x296945);_0x2c7f4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x34bb('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x2b67=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x2d1f1d,_0x41c1e5){var _0x5c9bfd=function(_0x232253){while(--_0x232253){_0x2d1f1d['push'](_0x2d1f1d['shift']());}};_0x5c9bfd(++_0x41c1e5);}(_0x2b67,0x10e));var _0x72b6=function(_0x2d7cfd,_0x2e4ea4){_0x2d7cfd=_0x2d7cfd-0x0;var _0x57bec7=_0x2b67[_0x2d7cfd];return _0x57bec7;};'use strict';var EventEmitter=require(_0x72b6('0x0'));var MailMessage=require(_0x72b6('0x1'))['db'][_0x72b6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x72b6('0x3')](0x0);var events={'afterCreate':_0x72b6('0x4'),'afterUpdate':_0x72b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3d2dd8){return function(_0x537083,_0x1edf77,_0x4e9327){MailMessageEvents[_0x72b6('0x6')](_0x3d2dd8+':'+_0x537083['id'],_0x537083);MailMessageEvents['emit'](_0x3d2dd8,_0x537083);_0x4e9327(null);};}for(var e in events){if(events[_0x72b6('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x72b6('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 28a6728..1a09df1 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 _0xf042=['define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','html-to-text','path','rimraf','../../config/environment','exports'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xf042,0x9c));var _0x2f04=function(_0x1322fe,_0x144cfe){_0x1322fe=_0x1322fe-0x0;var _0x47494b=_0xf042[_0x1322fe];return _0x47494b;};'use strict';var _=require('lodash');var util=require(_0x2f04('0x0'));var logger=require(_0x2f04('0x1'))('api');var moment=require(_0x2f04('0x2'));var BPromise=require('bluebird');var rp=require(_0x2f04('0x3'));var htmlToText=require(_0x2f04('0x4'));var fs=require('fs');var path=require(_0x2f04('0x5'));var rimraf=require(_0x2f04('0x6'));var config=require(_0x2f04('0x7'));var attributes=require('./mailMessage.attributes');module[_0x2f04('0x8')]=function(_0x374b81,_0x324738){return _0x374b81[_0x2f04('0x9')](_0x2f04('0xa'),attributes,{'tableName':_0x2f04('0xb'),'paranoid':![],'indexes':[{'name':_0x2f04('0xc'),'fields':['messageId']},{'name':_0x2f04('0xd'),'fields':[_0x2f04('0xe'),_0x2f04('0xf')],'type':_0x2f04('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36aca8,_0x354c20,_0x23b6c7){if(_0x36aca8[_0x2f04('0x11')]){_0x36aca8[_0x2f04('0xe')]=htmlToText[_0x2f04('0x12')](_0x36aca8[_0x2f04('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x23b6c7(null,_0x354c20);},'afterCreate':function(_0x595514,_0x24b697,_0x4b4013){var _0x4882f8=_0x374b81[_0x2f04('0x13')];var _0x278679=_0x595514[_0x2f04('0x14')]({'plain':!![]});if(_0x278679[_0x2f04('0x15')]['toLowerCase']()==='in'||_0x278679['direction'][_0x2f04('0x16')]()===_0x2f04('0x17')&&!_0x278679[_0x2f04('0x18')]&&!_[_0x2f04('0x19')](_0x278679[_0x2f04('0x1a')])){_0x4882f8[_0x2f04('0x1b')][_0x2f04('0x1c')]({'where':{'id':_0x278679['MailInteractionId']}})['then'](function(_0x3cb310){if(_0x3cb310){_0x3cb310[_0x2f04('0x1d')]({'lastMsgAt':_0x278679['createdAt'],'lastMsgDirection':_0x278679[_0x2f04('0x15')][_0x2f04('0x16')]()});}})[_0x2f04('0x1e')](function(_0x115ee2){console['error'](_0x115ee2);});}_0x4b4013();}},'charset':_0x2f04('0x1f'),'collate':_0x2f04('0x20')});}; \ No newline at end of file +var _0xebe6=['define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports'];(function(_0x388ad8,_0x54c8e5){var _0x437eaf=function(_0x49f7d5){while(--_0x49f7d5){_0x388ad8['push'](_0x388ad8['shift']());}};_0x437eaf(++_0x54c8e5);}(_0xebe6,0x1b7));var _0x6ebe=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xebe6[_0x2d344f];return _0x2e796b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6ebe('0x0'))('api');var moment=require(_0x6ebe('0x1'));var BPromise=require(_0x6ebe('0x2'));var rp=require(_0x6ebe('0x3'));var htmlToText=require(_0x6ebe('0x4'));var fs=require('fs');var path=require(_0x6ebe('0x5'));var rimraf=require(_0x6ebe('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ebe('0x7'));module[_0x6ebe('0x8')]=function(_0x64da0d,_0x5e48b4){return _0x64da0d[_0x6ebe('0x9')](_0x6ebe('0xa'),attributes,{'tableName':_0x6ebe('0xb'),'paranoid':![],'indexes':[{'name':_0x6ebe('0xc'),'fields':['messageId']},{'name':_0x6ebe('0xd'),'fields':['plainBody',_0x6ebe('0xe')],'type':_0x6ebe('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15407d,_0x1ad2cd,_0x11720f){if(_0x15407d[_0x6ebe('0x10')]){_0x15407d['plainBody']=htmlToText[_0x6ebe('0x11')](_0x15407d[_0x6ebe('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x11720f(null,_0x1ad2cd);},'afterCreate':function(_0x94b60c,_0x25e1b9,_0x3aec00){var _0x4278f8=_0x64da0d[_0x6ebe('0x12')];var _0xa004b9=_0x94b60c['get']({'plain':!![]});if(_0xa004b9[_0x6ebe('0x13')][_0x6ebe('0x14')]()==='in'||_0xa004b9[_0x6ebe('0x13')]['toLowerCase']()==='out'&&!_0xa004b9[_0x6ebe('0x15')]&&!_[_0x6ebe('0x16')](_0xa004b9[_0x6ebe('0x17')])){_0x4278f8[_0x6ebe('0x18')][_0x6ebe('0x19')]({'where':{'id':_0xa004b9[_0x6ebe('0x1a')]}})['then'](function(_0x114947){if(_0x114947){_0x114947[_0x6ebe('0x1b')]({'lastMsgAt':_0xa004b9[_0x6ebe('0x1c')],'lastMsgDirection':_0xa004b9[_0x6ebe('0x13')]['toLowerCase']()});}})[_0x6ebe('0x1d')](function(_0x9a13eb){console[_0x6ebe('0x1e')](_0x9a13eb);});}_0x3aec00();}},'charset':'utf8mb4','collate':_0x6ebe('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 64c34cf..7032778 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 _0xb03e=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options'];(function(_0x2d1967,_0x4914a9){var _0x54f16d=function(_0x4081d8){while(--_0x4081d8){_0x2d1967['push'](_0x2d1967['shift']());}};_0x54f16d(++_0x4914a9);}(_0xb03e,0x1eb));var _0xeb03=function(_0xac19b9,_0xa3fbfd){_0xac19b9=_0xac19b9-0x0;var _0x5bdf26=_0xb03e[_0xac19b9];return _0x5bdf26;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});config[_0xeb03('0xc')]=_[_0xeb03('0xd')](config[_0xeb03('0xc')],{'host':_0xeb03('0xe'),'port':0x18eb});var socket=require(_0xeb03('0xf'))(new Redis(config[_0xeb03('0xc')]));require('./mailMessage.socket')[_0xeb03('0x10')](socket);function respondWithRpcPromise(_0x99f4e2,_0x14cfa0,_0x4f5013){return new BPromise(function(_0x31af2c,_0x48af4f){return client[_0xeb03('0x11')](_0x99f4e2,_0x4f5013)[_0xeb03('0x12')](function(_0x3de728){logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));logger[_0xeb03('0x16')](_0xeb03('0x17'),_0x14cfa0,_0xeb03('0x15'),JSON[_0xeb03('0x18')](_0x3de728));if(_0x3de728[_0xeb03('0x19')]){if(_0x3de728[_0xeb03('0x19')]['code']===0x1f4){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);return _0x48af4f(_0x3de728['error'][_0xeb03('0x1a')]);}logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728['error'][_0xeb03('0x1a')]);return _0x31af2c(_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);}else{logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));_0x31af2c(_0x3de728[_0xeb03('0x1b')][_0xeb03('0x1a')]);}})[_0xeb03('0x1c')](function(_0x469d25){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x469d25);_0x48af4f(_0x469d25);});});}exports[_0xeb03('0x1d')]=function(_0x19bddf){var _0x4d307c=this;return new Promise(function(_0x1bea3f,_0x3855dd){return db[_0xeb03('0x1e')][_0xeb03('0x1f')](_0x19bddf[_0xeb03('0x20')],{'raw':_0x19bddf[_0xeb03('0x21')]?_0x19bddf[_0xeb03('0x21')][_0xeb03('0x22')]===undefined?!![]:![]:!![]})[_0xeb03('0x12')](function(_0x5a704b){logger[_0xeb03('0x13')](_0xeb03('0x1d'),_0x19bddf);logger[_0xeb03('0x16')](_0xeb03('0x1d'),_0x19bddf,JSON[_0xeb03('0x18')](_0x5a704b));_0x1bea3f(_0x5a704b);})['catch'](function(_0x638353){logger[_0xeb03('0x19')](_0xeb03('0x1d'),_0x638353[_0xeb03('0x1a')],_0x19bddf);_0x3855dd(_0x4d307c[_0xeb03('0x19')](0x1f4,_0x638353[_0xeb03('0x1a')]));});});}; \ No newline at end of file +var _0x7708=['info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7708,0x188));var _0x8770=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x7708[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('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(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});config[_0x8770('0x7')]=_[_0x8770('0x8')](config[_0x8770('0x7')],{'host':_0x8770('0x9'),'port':0x18eb});var socket=require(_0x8770('0xa'))(new Redis(config[_0x8770('0x7')]));require('./mailMessage.socket')[_0x8770('0xb')](socket);function respondWithRpcPromise(_0x2ca830,_0x3f357a,_0x4e4551){return new BPromise(function(_0x390af0,_0x10e4a3){return client[_0x8770('0xc')](_0x2ca830,_0x4e4551)[_0x8770('0xd')](function(_0x4a0ca1){logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));logger['debug'](_0x8770('0x11'),_0x3f357a,_0x8770('0x10'),JSON[_0x8770('0x12')](_0x4a0ca1));if(_0x4a0ca1[_0x8770('0x13')]){if(_0x4a0ca1[_0x8770('0x13')][_0x8770('0x14')]===0x1f4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x4a0ca1['error'][_0x8770('0x15')]);return _0x10e4a3(_0x4a0ca1[_0x8770('0x13')]['message']);}logger[_0x8770('0x13')]('MailMessage,\x20%s,\x20%s',_0x3f357a,_0x4a0ca1[_0x8770('0x13')]['message']);return _0x390af0(_0x4a0ca1['error']['message']);}else{logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));_0x390af0(_0x4a0ca1[_0x8770('0x16')]['message']);}})['catch'](function(_0x349bd4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x349bd4);_0x10e4a3(_0x349bd4);});});}exports[_0x8770('0x17')]=function(_0x4d2c7e){var _0x4e1fa6=this;return new Promise(function(_0x3e1fe7,_0x1234dd){return db[_0x8770('0x18')][_0x8770('0x19')](_0x4d2c7e['body'],{'raw':_0x4d2c7e['options']?_0x4d2c7e[_0x8770('0x1a')][_0x8770('0x1b')]===undefined?!![]:![]:!![]})[_0x8770('0xd')](function(_0x2918a7){logger[_0x8770('0xe')](_0x8770('0x17'),_0x4d2c7e);logger['debug'](_0x8770('0x17'),_0x4d2c7e,JSON[_0x8770('0x12')](_0x2918a7));_0x3e1fe7(_0x2918a7);})[_0x8770('0x1c')](function(_0x2515c5){logger['error'](_0x8770('0x17'),_0x2515c5['message'],_0x4d2c7e);_0x1234dd(_0x4e1fa6[_0x8770('0x13')](0x1f4,_0x2515c5[_0x8770('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7330ec6..99d2102 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 _0x5ae6=['update','emit','removeListener','register','length','mailMessage:','save','remove'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x5ae6,0x196));var _0x65ae=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x5ae6[_0x373096];return _0x14a6d0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x65ae('0x0'),_0x65ae('0x1'),_0x65ae('0x2')];function createListener(_0xed8524,_0x5576aa){return function(_0x408c38){_0x5576aa[_0x65ae('0x3')](_0xed8524,_0x408c38);};}function removeListener(_0x29ddb1,_0x548396){return function(){MailMessageEvents[_0x65ae('0x4')](_0x29ddb1,_0x548396);};}exports[_0x65ae('0x5')]=function(_0x34ca3c){for(var _0x34c093=0x0,_0x165d92=events[_0x65ae('0x6')];_0x34c093<_0x165d92;_0x34c093++){var _0x2691a4=events[_0x34c093];var _0x1fd268=createListener(_0x65ae('0x7')+_0x2691a4,_0x34ca3c);MailMessageEvents['on'](_0x2691a4,_0x1fd268);}}; \ No newline at end of file +var _0xef3a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xef3a,0xa6));var _0xaef3=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0xef3a[_0x41bdd4];return _0x5c03a6;};'use strict';var MailMessageEvents=require(_0xaef3('0x0'));var events=['save',_0xaef3('0x1'),'update'];function createListener(_0x340989,_0x5b293e){return function(_0x3d541f){_0x5b293e[_0xaef3('0x2')](_0x340989,_0x3d541f);};}function removeListener(_0x428c2a,_0x12fcc7){return function(){MailMessageEvents[_0xaef3('0x3')](_0x428c2a,_0x12fcc7);};}exports[_0xaef3('0x4')]=function(_0x2f8a0e){for(var _0x29f36b=0x0,_0x1fef7c=events[_0xaef3('0x5')];_0x29f36b<_0x1fef7c;_0x29f36b++){var _0x33cdaa=events[_0x29f36b];var _0x46cf4d=createListener(_0xaef3('0x6')+_0x33cdaa,_0x2f8a0e);MailMessageEvents['on'](_0x33cdaa,_0x46cf4d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9261c0c..788af9c 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 _0x4158=['connect-timeout','express','Router','fs-extra','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x187cda,_0x2e27e8){var _0x1a066d=function(_0x605cce){while(--_0x605cce){_0x187cda['push'](_0x187cda['shift']());}};_0x1a066d(++_0x2e27e8);}(_0x4158,0xcf));var _0x8415=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x4158[_0x2d89ce];return _0x3fad10;};'use strict';var multer=require(_0x8415('0x0'));var util=require(_0x8415('0x1'));var path=require(_0x8415('0x2'));var timeout=require(_0x8415('0x3'));var express=require(_0x8415('0x4'));var router=express[_0x8415('0x5')]();var fs_extra=require(_0x8415('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8415('0x7'));var controller=require(_0x8415('0x8'));router['get']('/',auth[_0x8415('0x9')](),controller['index']);router[_0x8415('0xa')](_0x8415('0xb'),auth[_0x8415('0x9')](),controller[_0x8415('0xc')]);router[_0x8415('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8415('0xd')]);router['get'](_0x8415('0xe'),auth[_0x8415('0x9')](),controller['getMembers']);router[_0x8415('0xa')](_0x8415('0xf'),auth['isAuthenticated'](),controller[_0x8415('0x10')]);router[_0x8415('0xa')](_0x8415('0x11'),auth[_0x8415('0x9')](),controller[_0x8415('0x12')]);router[_0x8415('0x13')]('/',auth[_0x8415('0x9')](),controller[_0x8415('0x14')]);router[_0x8415('0x13')](_0x8415('0xf'),auth[_0x8415('0x9')](),controller[_0x8415('0x15')]);router[_0x8415('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x8415('0x16')]);router[_0x8415('0x17')]('/:id',auth[_0x8415('0x9')](),controller[_0x8415('0x18')]);router[_0x8415('0x19')](_0x8415('0x1a'),auth[_0x8415('0x9')](),controller['destroy']);router[_0x8415('0x19')](_0x8415('0xf'),auth[_0x8415('0x9')](),controller[_0x8415('0x1b')]);router[_0x8415('0x19')](_0x8415('0x11'),auth['isAuthenticated'](),controller[_0x8415('0x1c')]);module[_0x8415('0x1d')]=router; \ No newline at end of file +var _0x309d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x2f7e46,_0x1bbb24){var _0x2840a2=function(_0xbd3899){while(--_0xbd3899){_0x2f7e46['push'](_0x2f7e46['shift']());}};_0x2840a2(++_0x1bbb24);}(_0x309d,0x166));var _0xd309=function(_0x59f063,_0x6c3dbb){_0x59f063=_0x59f063-0x0;var _0x21bdce=_0x309d[_0x59f063];return _0x21bdce;};'use strict';var multer=require(_0xd309('0x0'));var util=require(_0xd309('0x1'));var path=require(_0xd309('0x2'));var timeout=require(_0xd309('0x3'));var express=require(_0xd309('0x4'));var router=express[_0xd309('0x5')]();var fs_extra=require(_0xd309('0x6'));var auth=require(_0xd309('0x7'));var interaction=require(_0xd309('0x8'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xd309('0x9')](),controller['index']);router['get'](_0xd309('0xa'),auth[_0xd309('0x9')](),controller['describe']);router[_0xd309('0xb')]('/:id',auth[_0xd309('0x9')](),controller[_0xd309('0xc')]);router[_0xd309('0xb')](_0xd309('0xd'),auth[_0xd309('0x9')](),controller[_0xd309('0xe')]);router[_0xd309('0xb')](_0xd309('0xf'),auth['isAuthenticated'](),controller[_0xd309('0x10')]);router[_0xd309('0xb')](_0xd309('0x11'),auth[_0xd309('0x9')](),controller[_0xd309('0x12')]);router[_0xd309('0x13')]('/',auth['isAuthenticated'](),controller[_0xd309('0x14')]);router[_0xd309('0x13')](_0xd309('0xf'),auth[_0xd309('0x9')](),controller[_0xd309('0x15')]);router[_0xd309('0x13')](_0xd309('0x11'),auth['isAuthenticated'](),controller[_0xd309('0x16')]);router[_0xd309('0x17')](_0xd309('0x18'),auth[_0xd309('0x9')](),controller[_0xd309('0x19')]);router['delete']('/:id',auth[_0xd309('0x9')](),controller['destroy']);router[_0xd309('0x1a')](_0xd309('0xf'),auth['isAuthenticated'](),controller[_0xd309('0x1b')]);router[_0xd309('0x1a')](_0xd309('0x11'),auth[_0xd309('0x9')](),controller[_0xd309('0x1c')]);module[_0xd309('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index fec1706..e27f559 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 _0x366d=['beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0xa1628d,_0x2a652a){var _0x3475a6=function(_0x295626){while(--_0x295626){_0xa1628d['push'](_0xa1628d['shift']());}};_0x3475a6(++_0x2a652a);}(_0x366d,0xec));var _0xd366=function(_0x966dec,_0x522474){_0x966dec=_0x966dec-0x0;var _0xc94fe1=_0x366d[_0x966dec];return _0xc94fe1;};'use strict';var Sequelize=require('sequelize');module[_0xd366('0x0')]={'name':{'type':Sequelize[_0xd366('0x1')],'unique':_0xd366('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd366('0x1')]},'timeout':{'type':Sequelize[_0xd366('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd366('0x4'),_0xd366('0x5'))}}; \ No newline at end of file +var _0xa7eb=['sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3db34a,_0x51bb10){var _0x27323b=function(_0x4b4323){while(--_0x4b4323){_0x3db34a['push'](_0x3db34a['shift']());}};_0x27323b(++_0x51bb10);}(_0xa7eb,0xdc));var _0xba7e=function(_0x599db5,_0x22eb92){_0x599db5=_0x599db5-0x0;var _0x399d87=_0xa7eb[_0x599db5];return _0x399d87;};'use strict';var Sequelize=require(_0xba7e('0x0'));module[_0xba7e('0x1')]={'name':{'type':Sequelize[_0xba7e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba7e('0x2')]},'timeout':{'type':Sequelize[_0xba7e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba7e('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 905d2e1..5efb57d 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 _0xffb3=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','User','Agents','online','voicePause','sequelize','each','UserMailQueue','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','transaction','removeAgents','userMailQueue:remove','addAgents','ids','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','get','MailQueues','destroy','name','index','map','MailQueue','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','sort','pick','MailQueueId','findAndCountAll','UserId','mailPause'];(function(_0x53e003,_0x289cc3){var _0x55e7d7=function(_0x1c7262){while(--_0x1c7262){_0x53e003['push'](_0x53e003['shift']());}};_0x55e7d7(++_0x289cc3);}(_0xffb3,0xb2));var _0x3ffb=function(_0x1a8fbf,_0x152890){_0x1a8fbf=_0x1a8fbf-0x0;var _0x4181f1=_0xffb3[_0x1a8fbf];return _0x4181f1;};'use strict';var emlformat=require(_0x3ffb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ffb('0x1'));var rp=require(_0x3ffb('0x2'));var moment=require(_0x3ffb('0x3'));var BPromise=require(_0x3ffb('0x4'));var Mustache=require(_0x3ffb('0x5'));var util=require(_0x3ffb('0x6'));var path=require('path');var sox=require(_0x3ffb('0x7'));var csv=require(_0x3ffb('0x8'));var ejs=require(_0x3ffb('0x9'));var fs=require('fs');var fs_extra=require(_0x3ffb('0xa'));var _=require(_0x3ffb('0xb'));var squel=require(_0x3ffb('0xc'));var crypto=require(_0x3ffb('0xd'));var jsforce=require(_0x3ffb('0xe'));var deskjs=require(_0x3ffb('0xf'));var toCsv=require(_0x3ffb('0x8'));var querystring=require(_0x3ffb('0x10'));var Papa=require(_0x3ffb('0x11'));var Redis=require(_0x3ffb('0x12'));var authService=require(_0x3ffb('0x13'));var qs=require(_0x3ffb('0x14'));var as=require(_0x3ffb('0x15'));var hardwareService=require(_0x3ffb('0x16'));var logger=require(_0x3ffb('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3ffb('0x18'));var db=require(_0x3ffb('0x19'))['db'];config[_0x3ffb('0x1a')]=_[_0x3ffb('0x1b')](config[_0x3ffb('0x1a')],{'host':_0x3ffb('0x1c'),'port':0x18eb});var socket=require(_0x3ffb('0x1d'))(new Redis(config[_0x3ffb('0x1a')]));require('./mailQueue.socket')[_0x3ffb('0x1e')](socket);function respondWithStatusCode(_0x2af629,_0x5011ac){_0x5011ac=_0x5011ac||0xcc;return function(_0x1377f4){if(_0x1377f4){return _0x2af629[_0x3ffb('0x1f')](_0x5011ac);}return _0x2af629[_0x3ffb('0x20')](_0x5011ac)[_0x3ffb('0x21')]();};}function respondWithResult(_0x416392,_0x2a5fe2){_0x2a5fe2=_0x2a5fe2||0xc8;return function(_0xaccabf){if(_0xaccabf){return _0x416392[_0x3ffb('0x20')](_0x2a5fe2)[_0x3ffb('0x22')](_0xaccabf);}};}function respondWithFilteredResult(_0x2a3178,_0x4e5dd0){return function(_0x1ad710){if(_0x1ad710){var _0x1ff650=typeof _0x4e5dd0[_0x3ffb('0x23')]===_0x3ffb('0x24')&&typeof _0x4e5dd0['limit']===_0x3ffb('0x24');var _0x4b8387=_0x1ad710[_0x3ffb('0x25')];var _0x469ea9=_0x1ff650?0x0:_0x4e5dd0[_0x3ffb('0x23')];var _0x3fa775=_0x1ff650?_0x1ad710['count']:_0x4e5dd0[_0x3ffb('0x23')]+_0x4e5dd0[_0x3ffb('0x26')];var _0xb17921;if(_0x3fa775>=_0x4b8387){_0x3fa775=_0x4b8387;_0xb17921=0xc8;}else{_0xb17921=0xce;}_0x2a3178['status'](_0xb17921);return _0x2a3178[_0x3ffb('0x27')]('Content-Range',_0x469ea9+'-'+_0x3fa775+'/'+_0x4b8387)[_0x3ffb('0x22')](_0x1ad710);}return null;};}function patchUpdates(_0x42004a){return function(_0x181204){try{jsonpatch[_0x3ffb('0x28')](_0x181204,_0x42004a,!![]);}catch(_0x37574e){return BPromise[_0x3ffb('0x29')](_0x37574e);}return _0x181204['save']();};}function saveUpdates(_0x7e291d,_0x251b98){return function(_0x23379){if(_0x23379){return _0x23379[_0x3ffb('0x2a')](_0x7e291d)[_0x3ffb('0x2b')](function(_0x50dac6){return _0x50dac6;});}return null;};}function removeEntity(_0x577ec6,_0x4f3adb){return function(_0x29d98e){if(_0x29d98e){return _0x29d98e['destroy']()[_0x3ffb('0x2b')](function(){var _0x107f8d=_0x29d98e[_0x3ffb('0x2c')]({'plain':!![]});var _0x5bdb33=_0x3ffb('0x2d');return db['UserProfileResource'][_0x3ffb('0x2e')]({'where':{'type':_0x5bdb33,'resourceId':_0x107f8d['id']}})[_0x3ffb('0x2b')](function(){return _0x29d98e;});})[_0x3ffb('0x2b')](function(){_0x577ec6[_0x3ffb('0x20')](0xcc)[_0x3ffb('0x21')]();});}};}function handleEntityNotFound(_0x5a4f50,_0x4ad9bd){return function(_0x3020e0){if(!_0x3020e0){_0x5a4f50[_0x3ffb('0x1f')](0x194);}return _0x3020e0;};}function handleError(_0xbc4c03,_0x5fb2e1){_0x5fb2e1=_0x5fb2e1||0x1f4;return function(_0x1327e8){logger['error'](_0x1327e8['stack']);if(_0x1327e8[_0x3ffb('0x2f')]){delete _0x1327e8['name'];}_0xbc4c03[_0x3ffb('0x20')](_0x5fb2e1)['send'](_0x1327e8);};}exports[_0x3ffb('0x30')]=function(_0x39cac7,_0x4d3a67){var _0x55c13c={},_0x35bcd3={},_0x202687={'count':0x0,'rows':[]};var _0x591a30=_[_0x3ffb('0x31')](db[_0x3ffb('0x32')]['rawAttributes'],function(_0x13fd66){return{'name':_0x13fd66[_0x3ffb('0x33')],'type':_0x13fd66[_0x3ffb('0x34')][_0x3ffb('0x35')]};});_0x35bcd3['model']=_[_0x3ffb('0x31')](_0x591a30,_0x3ffb('0x2f'));_0x35bcd3[_0x3ffb('0x36')]=_[_0x3ffb('0x37')](_0x39cac7[_0x3ffb('0x36')]);_0x35bcd3[_0x3ffb('0x38')]=_[_0x3ffb('0x39')](_0x35bcd3['model'],_0x35bcd3[_0x3ffb('0x36')]);_0x55c13c[_0x3ffb('0x3a')]=_['intersection'](_0x35bcd3['model'],qs[_0x3ffb('0x3b')](_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x3b')]));_0x55c13c[_0x3ffb('0x3a')]=_0x55c13c[_0x3ffb('0x3a')]['length']?_0x55c13c[_0x3ffb('0x3a')]:_0x35bcd3[_0x3ffb('0x3c')];if(!_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x3d')](_0x3ffb('0x3e'))){_0x55c13c[_0x3ffb('0x26')]=qs[_0x3ffb('0x26')](_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x26')]);_0x55c13c[_0x3ffb('0x23')]=qs[_0x3ffb('0x23')](_0x39cac7[_0x3ffb('0x36')]['offset']);}_0x55c13c[_0x3ffb('0x3f')]=qs['sort'](_0x39cac7[_0x3ffb('0x36')]['sort']);_0x55c13c[_0x3ffb('0x40')]=qs[_0x3ffb('0x38')](_['pick'](_0x39cac7[_0x3ffb('0x36')],_0x35bcd3['filters']),_0x591a30);if(_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x41')]){_0x55c13c[_0x3ffb('0x40')]=_['merge'](_0x55c13c[_0x3ffb('0x40')],{'$or':_[_0x3ffb('0x31')](_0x591a30,function(_0x4c653a){if(_0x4c653a[_0x3ffb('0x34')]!=='VIRTUAL'){var _0x4a6fdc={};_0x4a6fdc[_0x4c653a[_0x3ffb('0x2f')]]={'$like':'%'+_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x41')]+'%'};return _0x4a6fdc;}})});}_0x55c13c=_[_0x3ffb('0x42')]({},_0x55c13c,_0x39cac7[_0x3ffb('0x43')]);var _0x3f8745={'where':_0x55c13c[_0x3ffb('0x40')]};return db[_0x3ffb('0x32')][_0x3ffb('0x25')](_0x3f8745)[_0x3ffb('0x2b')](function(_0x1037fb){_0x202687[_0x3ffb('0x25')]=_0x1037fb;if(_0x39cac7[_0x3ffb('0x36')][_0x3ffb('0x44')]){_0x55c13c[_0x3ffb('0x45')]=[{'all':!![]}];}return db[_0x3ffb('0x32')][_0x3ffb('0x46')](_0x55c13c);})[_0x3ffb('0x2b')](function(_0x24d7fc){_0x202687[_0x3ffb('0x47')]=_0x24d7fc;return _0x202687;})[_0x3ffb('0x2b')](respondWithFilteredResult(_0x4d3a67,_0x55c13c))[_0x3ffb('0x48')](handleError(_0x4d3a67,null));};exports['show']=function(_0x42239e,_0x4f39b0){var _0x28757f={'raw':!![],'where':{'id':_0x42239e[_0x3ffb('0x49')]['id']}},_0xa1f6f6={};_0xa1f6f6[_0x3ffb('0x3c')]=_[_0x3ffb('0x37')](db['MailQueue'][_0x3ffb('0x4a')]);_0xa1f6f6['query']=_[_0x3ffb('0x37')](_0x42239e[_0x3ffb('0x36')]);_0xa1f6f6[_0x3ffb('0x38')]=_[_0x3ffb('0x39')](_0xa1f6f6['model'],_0xa1f6f6[_0x3ffb('0x36')]);_0x28757f['attributes']=_[_0x3ffb('0x39')](_0xa1f6f6[_0x3ffb('0x3c')],qs[_0x3ffb('0x3b')](_0x42239e[_0x3ffb('0x36')][_0x3ffb('0x3b')]));_0x28757f['attributes']=_0x28757f['attributes'][_0x3ffb('0x4b')]?_0x28757f[_0x3ffb('0x3a')]:_0xa1f6f6[_0x3ffb('0x3c')];if(_0x42239e[_0x3ffb('0x36')][_0x3ffb('0x44')]){_0x28757f[_0x3ffb('0x45')]=[{'all':!![]}];}_0x28757f=_[_0x3ffb('0x42')]({},_0x28757f,_0x42239e[_0x3ffb('0x43')]);return db[_0x3ffb('0x32')][_0x3ffb('0x4c')](_0x28757f)[_0x3ffb('0x2b')](handleEntityNotFound(_0x4f39b0,null))[_0x3ffb('0x2b')](respondWithResult(_0x4f39b0,null))[_0x3ffb('0x48')](handleError(_0x4f39b0,null));};exports[_0x3ffb('0x4d')]=function(_0x2dc104,_0x1c1d08){return db[_0x3ffb('0x32')][_0x3ffb('0x4d')](_0x2dc104[_0x3ffb('0x4e')],{})[_0x3ffb('0x2b')](function(_0x89ab2b){var _0x5ec499=_0x2dc104[_0x3ffb('0x4f')][_0x3ffb('0x2c')]({'plain':!![]});if(!_0x5ec499)throw new Error(_0x3ffb('0x50'));if(_0x5ec499[_0x3ffb('0x51')]===_0x3ffb('0x4f')){var _0x1c6e2b=_0x89ab2b[_0x3ffb('0x2c')]({'plain':!![]});var _0x1baa76='MailQueues';return db[_0x3ffb('0x52')]['find']({'where':{'name':_0x1baa76,'userProfileId':_0x5ec499['userProfileId']},'raw':!![]})['then'](function(_0x4e332d){if(_0x4e332d&&_0x4e332d['autoAssociation']===0x0){return db[_0x3ffb('0x53')][_0x3ffb('0x4d')]({'name':_0x1c6e2b['name'],'resourceId':_0x1c6e2b['id'],'type':_0x4e332d[_0x3ffb('0x2f')],'sectionId':_0x4e332d['id']},{})[_0x3ffb('0x2b')](function(){return _0x89ab2b;});}else{return _0x89ab2b;}})[_0x3ffb('0x48')](function(_0x46ac76){logger[_0x3ffb('0x54')](_0x3ffb('0x55'),_0x46ac76);throw _0x46ac76;});}return _0x89ab2b;})[_0x3ffb('0x2b')](respondWithResult(_0x1c1d08,0xc9))[_0x3ffb('0x48')](handleError(_0x1c1d08,null));};exports[_0x3ffb('0x2a')]=function(_0x5126d9,_0x2eab2c){if(_0x5126d9['body']['id']){delete _0x5126d9[_0x3ffb('0x4e')]['id'];}return db[_0x3ffb('0x32')][_0x3ffb('0x4c')]({'where':{'id':_0x5126d9[_0x3ffb('0x49')]['id']}})[_0x3ffb('0x2b')](handleEntityNotFound(_0x2eab2c,null))['then'](saveUpdates(_0x5126d9[_0x3ffb('0x4e')],null))['then'](respondWithResult(_0x2eab2c,null))['catch'](handleError(_0x2eab2c,null));};exports[_0x3ffb('0x2e')]=function(_0x2b21d7,_0x26001b){return db['MailQueue'][_0x3ffb('0x4c')]({'where':{'id':_0x2b21d7[_0x3ffb('0x49')]['id']}})['then'](handleEntityNotFound(_0x26001b,null))[_0x3ffb('0x2b')](removeEntity(_0x26001b,null))[_0x3ffb('0x48')](handleError(_0x26001b,null));};exports[_0x3ffb('0x56')]=function(_0x20804f,_0x4b06c1){return db[_0x3ffb('0x32')][_0x3ffb('0x56')]()[_0x3ffb('0x2b')](respondWithResult(_0x4b06c1,null))[_0x3ffb('0x48')](handleError(_0x4b06c1,null));};exports['getMembers']=function(_0xd4a37c,_0x361ff5,_0x2bcb42){var _0x519540={'raw':!![],'where':{}},_0x10a5dd={},_0x4ea433;return db['MailQueue'][_0x3ffb('0x57')]({'where':{'id':_0xd4a37c[_0x3ffb('0x49')]['id']}})[_0x3ffb('0x2b')](handleEntityNotFound(_0x361ff5,null))[_0x3ffb('0x2b')](function(_0x28a0f3){if(_0x28a0f3){_0x4ea433=_0x28a0f3['get']({'plain':!![]});_0x10a5dd[_0x3ffb('0x3c')]=_[_0x3ffb('0x37')](db['UserMailQueue'][_0x3ffb('0x4a')]);_0x10a5dd[_0x3ffb('0x36')]=_[_0x3ffb('0x37')](_0xd4a37c[_0x3ffb('0x36')]);_0x10a5dd['filters']=_['intersection'](_0x10a5dd[_0x3ffb('0x3c')],_0x10a5dd[_0x3ffb('0x36')]);_0x519540['attributes']=_[_0x3ffb('0x39')](_0x10a5dd['model'],qs[_0x3ffb('0x3b')](_0xd4a37c['query'][_0x3ffb('0x3b')]));_0x519540[_0x3ffb('0x3a')]=_0x519540[_0x3ffb('0x3a')]['length']?_0x519540[_0x3ffb('0x3a')]:_0x10a5dd[_0x3ffb('0x3c')];if(!_0xd4a37c['query'][_0x3ffb('0x3d')]('nolimit')){_0x519540[_0x3ffb('0x26')]=qs[_0x3ffb('0x26')](_0xd4a37c[_0x3ffb('0x36')][_0x3ffb('0x26')]);_0x519540[_0x3ffb('0x23')]=qs[_0x3ffb('0x23')](_0xd4a37c['query'][_0x3ffb('0x23')]);}_0x519540['order']=qs['sort'](_0xd4a37c[_0x3ffb('0x36')][_0x3ffb('0x58')]);_0x519540[_0x3ffb('0x40')]=qs['filters'](_[_0x3ffb('0x59')](_0xd4a37c['query'],_0x10a5dd['filters']));_0x519540[_0x3ffb('0x40')][_0x3ffb('0x5a')]=_0x28a0f3['id'];if(_0xd4a37c['query'][_0x3ffb('0x41')]){_0x519540[_0x3ffb('0x40')]=_['merge'](_0x519540[_0x3ffb('0x40')],{'$or':_[_0x3ffb('0x31')](_0x519540[_0x3ffb('0x3a')],function(_0xe6a285){var _0xd2f11e={};_0xd2f11e[_0xe6a285]={'$like':'%'+_0xd4a37c[_0x3ffb('0x36')]['filter']+'%'};return _0xd2f11e;})});}_0x519540=_[_0x3ffb('0x42')]({},_0x519540,_0xd4a37c[_0x3ffb('0x43')]);return db['UserMailQueue'][_0x3ffb('0x46')](_0x519540);}})[_0x3ffb('0x2b')](function(_0x217d2f){if(_0x217d2f){return db['User'][_0x3ffb('0x5b')]({'where':{'id':_[_0x3ffb('0x31')](_0x217d2f,_0x3ffb('0x5c')),'role':'agent'},'attributes':['id',_0x3ffb('0x2f'),_0x3ffb('0x5d'),_0x3ffb('0x5e'),_0x3ffb('0x5f')]});}})['then'](function(_0x4aab12){if(_0x4aab12){return{'count':_0x4aab12['count'],'rows':_[_0x3ffb('0x31')](_0x4aab12['rows'],function(_0x587037){return{'membername':_0x587037[_0x3ffb('0x2f')],'UserId':_0x587037['id'],'queue_name':_0x4ea433[_0x3ffb('0x2f')],'MailQueueId':_0x4ea433['id'],'interface':util[_0x3ffb('0x60')](_0x3ffb('0x61'),_0x3ffb('0x62'),_0x587037['name']),'penalty':0x0,'paused':_0x587037['mailPause'],'createdAt':_0x587037[_0x3ffb('0x5f')],'updatedAt':_0x587037[_0x3ffb('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x361ff5,_0x519540))[_0x3ffb('0x48')](handleError(_0x361ff5,null));};exports[_0x3ffb('0x63')]=function(_0x231b6e,_0x442429,_0x2c6d52){var _0x590366={};var _0x268319={};var _0x588a89;var _0x3a3395;return db[_0x3ffb('0x32')]['findOne']({'where':{'id':_0x231b6e['params']['id']}})[_0x3ffb('0x2b')](handleEntityNotFound(_0x442429,null))['then'](function(_0x1e45ed){if(_0x1e45ed){_0x588a89=_0x1e45ed;_0x268319[_0x3ffb('0x3c')]=_[_0x3ffb('0x37')](db[_0x3ffb('0x64')][_0x3ffb('0x4a')]);_0x268319[_0x3ffb('0x36')]=_[_0x3ffb('0x37')](_0x231b6e[_0x3ffb('0x36')]);_0x268319['filters']=_['intersection'](_0x268319['model'],_0x268319[_0x3ffb('0x36')]);_0x590366[_0x3ffb('0x3a')]=_['intersection'](_0x268319['model'],qs[_0x3ffb('0x3b')](_0x231b6e['query'][_0x3ffb('0x3b')]));_0x590366[_0x3ffb('0x3a')]=_0x590366[_0x3ffb('0x3a')][_0x3ffb('0x4b')]?_0x590366['attributes']:_0x268319[_0x3ffb('0x3c')];_0x590366[_0x3ffb('0x3f')]=qs[_0x3ffb('0x58')](_0x231b6e[_0x3ffb('0x36')][_0x3ffb('0x58')]);_0x590366[_0x3ffb('0x40')]=qs['filters'](_['pick'](_0x231b6e[_0x3ffb('0x36')],_0x268319[_0x3ffb('0x38')]));if(_0x231b6e[_0x3ffb('0x36')][_0x3ffb('0x41')]){_0x590366[_0x3ffb('0x40')]=_[_0x3ffb('0x42')](_0x590366[_0x3ffb('0x40')],{'$or':_[_0x3ffb('0x31')](_0x590366[_0x3ffb('0x3a')],function(_0x3022be){var _0x438661={};_0x438661[_0x3022be]={'$like':'%'+_0x231b6e[_0x3ffb('0x36')][_0x3ffb('0x41')]+'%'};return _0x438661;})});}_0x590366=_[_0x3ffb('0x42')]({},_0x590366,_0x231b6e['options']);return _0x588a89[_0x3ffb('0x63')](_0x590366);}})[_0x3ffb('0x2b')](function(_0x105b25){if(_0x105b25){_0x3a3395=_0x105b25[_0x3ffb('0x4b')];if(!_0x231b6e[_0x3ffb('0x36')]['hasOwnProperty'](_0x3ffb('0x3e'))){_0x590366['limit']=qs['limit'](_0x231b6e['query'][_0x3ffb('0x26')]);_0x590366[_0x3ffb('0x23')]=qs[_0x3ffb('0x23')](_0x231b6e[_0x3ffb('0x36')][_0x3ffb('0x23')]);}return _0x588a89[_0x3ffb('0x63')](_0x590366);}})[_0x3ffb('0x2b')](function(_0x495cf4){if(_0x495cf4){return _0x495cf4?{'count':_0x3a3395,'rows':_0x495cf4}:null;}})[_0x3ffb('0x2b')](respondWithResult(_0x442429,null))[_0x3ffb('0x48')](handleError(_0x442429,null));};exports[_0x3ffb('0x65')]=function(_0x38cf3e,_0x2e4e32,_0x4ed4a8){var _0x52864a=_0x38cf3e[_0x3ffb('0x4e')]['ids'];return db[_0x3ffb('0x64')][_0x3ffb('0x46')]({'where':{'id':_0x52864a},'attributes':['id'],'include':[{'model':db[_0x3ffb('0x66')],'as':_0x3ffb('0x67'),'attributes':['id',_0x3ffb('0x2f'),_0x3ffb('0x68'),_0x3ffb('0x69'),'interface'],'raw':!![]}]})[_0x3ffb('0x2b')](function(_0x1ea389){if(_0x1ea389){var _0x553198=_['flatMap'](_0x1ea389,function(_0x5c7a9e){var _0x281616=_0x5c7a9e[_0x3ffb('0x2c')]({'plain':!![]});return _0x281616[_0x3ffb('0x67')];});return db[_0x3ffb('0x32')][_0x3ffb('0x4c')]({'where':{'id':_0x38cf3e[_0x3ffb('0x49')]['id']}})[_0x3ffb('0x2b')](function(_0x5abe9f){return db[_0x3ffb('0x6a')]['transaction'](function(_0x81afcc){return _0x5abe9f[_0x3ffb('0x65')](_0x52864a,{'transaction':_0x81afcc})['then'](function(){return BPromise[_0x3ffb('0x6b')](_0x553198,function(_0x3ec389){return db[_0x3ffb('0x6c')]['findOrCreate']({'where':{'UserId':_0x3ec389['id'],'MailQueueId':_0x38cf3e[_0x3ffb('0x49')]['id']},'transaction':_0x81afcc});});})[_0x3ffb('0x2b')](function(){_0x553198[_0x3ffb('0x6d')](function(_0x2aa916){socket[_0x3ffb('0x6e')](_0x3ffb('0x6f'),{'UserId':_0x2aa916['id'],'MailQueueId':_0x5abe9f['id']});});});});});}})[_0x3ffb('0x2b')](respondWithStatusCode(_0x2e4e32,null))[_0x3ffb('0x48')](handleError(_0x2e4e32,null));};exports[_0x3ffb('0x70')]=function(_0x439026,_0x44e4e3,_0x96541a){return db['Team']['findAll']({'where':{'id':_0x439026[_0x3ffb('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ffb('0x67'),'attributes':['id'],'raw':!![]}]})[_0x3ffb('0x2b')](handleEntityNotFound(_0x44e4e3,null))[_0x3ffb('0x2b')](function(_0x25842d){var _0x1c4a44=_[_0x3ffb('0x31')](_0x25842d,'id');var _0x409d35=[];var _0x479504=[];var _0x3c61ee=squel[_0x3ffb('0x71')]();_0x3c61ee['field']('tq.TeamId')[_0x3ffb('0x72')](_0x3ffb('0x73'),'tq')[_0x3ffb('0x74')](_0x3ffb('0x75'),'ut',_0x3ffb('0x76'))[_0x3ffb('0x40')](_0x3ffb('0x77'),_0x439026[_0x3ffb('0x49')]['id']);for(var _0x3fb39d=0x0;_0x3fb39d<_0x25842d[_0x3ffb('0x4b')];_0x3fb39d+=0x1){let _0x2fbe32=_0x25842d[_0x3fb39d];for(var _0x348079=0x0;_0x348079<_0x2fbe32[_0x3ffb('0x67')][_0x3ffb('0x4b')];_0x348079+=0x1){let _0x5d1200=_0x2fbe32[_0x3ffb('0x67')][_0x348079];var _0x9e9a6=_0x3c61ee[_0x3ffb('0x78')]();_0x9e9a6[_0x3ffb('0x40')](_0x3ffb('0x79'),_0x5d1200['id']);_0x479504[_0x3ffb('0x7a')](db[_0x3ffb('0x6a')][_0x3ffb('0x36')](_0x9e9a6[_0x3ffb('0x7b')](),{'type':db[_0x3ffb('0x6a')][_0x3ffb('0x7c')]['SELECT']})[_0x3ffb('0x2b')](function(_0x3e77f7){if(_0x3e77f7[_0x3ffb('0x4b')]===0x1){return _0x5d1200['id'];}else{var _0xd8d6e0=_[_0x3ffb('0x7d')](_['map'](_0x3e77f7,_0x3ffb('0x7e')),function(_0x316bd1){return _['includes'](_0x1c4a44,_0x316bd1);});if(_0xd8d6e0){return _0x5d1200['id'];}}}));}}return BPromise[_0x3ffb('0x7f')](_0x479504)[_0x3ffb('0x2b')](function(_0x1c8595){_0x409d35=_(_0x409d35)['union'](_0x1c8595)['compact']()['value']();return db[_0x3ffb('0x32')][_0x3ffb('0x4c')]({'where':{'id':_0x439026[_0x3ffb('0x49')]['id']}})['then'](function(_0x3061da){return db['sequelize'][_0x3ffb('0x80')](function(_0x2f83b0){return _0x3061da['removeTeams'](_0x439026['query']['ids'],{'transaction':_0x2f83b0})[_0x3ffb('0x2b')](function(){if(!_['isEmpty'](_0x409d35)){return _0x3061da[_0x3ffb('0x81')](_0x409d35,{'transaction':_0x2f83b0});}})[_0x3ffb('0x2b')](function(){_0x409d35['forEach'](function(_0x2ef4dd){socket[_0x3ffb('0x6e')](_0x3ffb('0x82'),{'UserId':_0x2ef4dd,'MailQueueId':_0x3061da['id']});});});});});});})[_0x3ffb('0x2b')](respondWithStatusCode(_0x44e4e3,null))['catch'](handleError(_0x44e4e3,null));};exports[_0x3ffb('0x83')]=function(_0x6bad8,_0x1b087c,_0x7b0364){return db[_0x3ffb('0x32')][_0x3ffb('0x4c')]({'where':{'id':_0x6bad8[_0x3ffb('0x49')]['id']}})[_0x3ffb('0x2b')](handleEntityNotFound(_0x1b087c,null))[_0x3ffb('0x2b')](function(_0x8ca4dc){if(_0x8ca4dc){return _0x8ca4dc[_0x3ffb('0x83')](_0x6bad8[_0x3ffb('0x4e')][_0x3ffb('0x84')],_[_0x3ffb('0x85')](_0x6bad8[_0x3ffb('0x4e')],[_0x3ffb('0x84'),'id'])||{})['spread'](function(_0x7870be){for(var _0x4a2e85=0x0;_0x4a2e85<_0x6bad8[_0x3ffb('0x4e')][_0x3ffb('0x84')][_0x3ffb('0x4b')];_0x4a2e85+=0x1){socket[_0x3ffb('0x6e')](_0x3ffb('0x6f'),{'UserId':Number(_0x6bad8[_0x3ffb('0x4e')][_0x3ffb('0x84')][_0x4a2e85]),'MailQueueId':Number(_0x6bad8['params']['id'])});}return _0x7870be;});}})[_0x3ffb('0x2b')](respondWithResult(_0x1b087c,null))['catch'](handleError(_0x1b087c,null));};exports[_0x3ffb('0x81')]=function(_0x55d15d,_0x4c7506,_0x222247){return db[_0x3ffb('0x32')][_0x3ffb('0x4c')]({'where':{'id':_0x55d15d[_0x3ffb('0x49')]['id']}})[_0x3ffb('0x2b')](handleEntityNotFound(_0x4c7506,null))[_0x3ffb('0x2b')](function(_0x5d8fc7){if(_0x5d8fc7){return _0x5d8fc7[_0x3ffb('0x81')](_0x55d15d[_0x3ffb('0x36')][_0x3ffb('0x84')])[_0x3ffb('0x2b')](function(){if(_[_0x3ffb('0x86')](_0x55d15d['query'][_0x3ffb('0x84')])){for(var _0x3abc9a=0x0;_0x3abc9a<_0x55d15d['query']['ids'][_0x3ffb('0x4b')];_0x3abc9a+=0x1){socket['emit'](_0x3ffb('0x82'),{'UserId':Number(_0x55d15d[_0x3ffb('0x36')][_0x3ffb('0x84')][_0x3abc9a]),'MailQueueId':Number(_0x55d15d[_0x3ffb('0x49')]['id'])});}}else{socket['emit'](_0x3ffb('0x82'),{'UserId':Number(_0x55d15d['query']['ids']),'MailQueueId':Number(_0x55d15d[_0x3ffb('0x49')]['id'])});}});}})[_0x3ffb('0x2b')](respondWithStatusCode(_0x4c7506,null))['catch'](handleError(_0x4c7506,null));};exports[_0x3ffb('0x87')]=function(_0x19a208,_0x317b66,_0x3f19d0){var _0x562a1d={};var _0x1249ba={};var _0x2e38cb;var _0x1c9135;return db[_0x3ffb('0x32')][_0x3ffb('0x57')]({'where':{'id':_0x19a208[_0x3ffb('0x49')]['id']}})['then'](handleEntityNotFound(_0x317b66,null))[_0x3ffb('0x2b')](function(_0x4af1a4){if(_0x4af1a4){_0x2e38cb=_0x4af1a4;_0x1249ba[_0x3ffb('0x3c')]=_['keys'](db['User'][_0x3ffb('0x4a')]);_0x1249ba[_0x3ffb('0x36')]=_[_0x3ffb('0x37')](_0x19a208[_0x3ffb('0x36')]);_0x1249ba['filters']=_['intersection'](_0x1249ba['model'],_0x1249ba[_0x3ffb('0x36')]);_0x562a1d[_0x3ffb('0x3a')]=_[_0x3ffb('0x39')](_0x1249ba[_0x3ffb('0x3c')],qs['fields'](_0x19a208[_0x3ffb('0x36')][_0x3ffb('0x3b')]));_0x562a1d[_0x3ffb('0x3a')]=_0x562a1d['attributes'][_0x3ffb('0x4b')]?_0x562a1d[_0x3ffb('0x3a')]:_0x1249ba['model'];_0x562a1d[_0x3ffb('0x3f')]=qs['sort'](_0x19a208[_0x3ffb('0x36')][_0x3ffb('0x58')]);_0x562a1d[_0x3ffb('0x40')]=qs[_0x3ffb('0x38')](_[_0x3ffb('0x59')](_0x19a208['query'],_0x1249ba['filters']));if(_0x19a208[_0x3ffb('0x36')][_0x3ffb('0x41')]){_0x562a1d[_0x3ffb('0x40')]=_['merge'](_0x562a1d['where'],{'$or':_[_0x3ffb('0x31')](_0x562a1d[_0x3ffb('0x3a')],function(_0x15b1d5){var _0x37e877={};_0x37e877[_0x15b1d5]={'$like':'%'+_0x19a208['query'][_0x3ffb('0x41')]+'%'};return _0x37e877;})});}_0x562a1d=_['merge']({},_0x562a1d,_0x19a208[_0x3ffb('0x43')]);return _0x2e38cb[_0x3ffb('0x87')](_0x562a1d);}})[_0x3ffb('0x2b')](function(_0x5995bb){if(_0x5995bb){_0x1c9135=_0x5995bb['length'];if(!_0x19a208['query']['hasOwnProperty'](_0x3ffb('0x3e'))){_0x562a1d[_0x3ffb('0x26')]=qs[_0x3ffb('0x26')](_0x19a208[_0x3ffb('0x36')][_0x3ffb('0x26')]);_0x562a1d[_0x3ffb('0x23')]=qs['offset'](_0x19a208['query'][_0x3ffb('0x23')]);}return _0x2e38cb[_0x3ffb('0x87')](_0x562a1d);}})[_0x3ffb('0x2b')](function(_0x479d31){if(_0x479d31){return _0x479d31?{'count':_0x1c9135,'rows':_0x479d31}:null;}})[_0x3ffb('0x2b')](respondWithResult(_0x317b66,null))[_0x3ffb('0x48')](handleError(_0x317b66,null));}; \ No newline at end of file +var _0xab55=['all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','each','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','TeamId','includes'];(function(_0x21024f,_0x35e650){var _0x26e8f8=function(_0x3894f2){while(--_0x3894f2){_0x21024f['push'](_0x21024f['shift']());}};_0x26e8f8(++_0x35e650);}(_0xab55,0x139));var _0x5ab5=function(_0x23d493,_0x203293){_0x23d493=_0x23d493-0x0;var _0x36e50a=_0xab55[_0x23d493];return _0x36e50a;};'use strict';var emlformat=require(_0x5ab5('0x0'));var rimraf=require(_0x5ab5('0x1'));var zipdir=require(_0x5ab5('0x2'));var jsonpatch=require(_0x5ab5('0x3'));var rp=require('request-promise');var moment=require(_0x5ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ab5('0x5'));var util=require(_0x5ab5('0x6'));var path=require(_0x5ab5('0x7'));var sox=require(_0x5ab5('0x8'));var csv=require(_0x5ab5('0x9'));var ejs=require(_0x5ab5('0xa'));var fs=require('fs');var fs_extra=require(_0x5ab5('0xb'));var _=require(_0x5ab5('0xc'));var squel=require(_0x5ab5('0xd'));var crypto=require(_0x5ab5('0xe'));var jsforce=require(_0x5ab5('0xf'));var deskjs=require(_0x5ab5('0x10'));var toCsv=require(_0x5ab5('0x9'));var querystring=require(_0x5ab5('0x11'));var Papa=require(_0x5ab5('0x12'));var Redis=require(_0x5ab5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ab5('0x14'));var as=require(_0x5ab5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ab5('0x16'))(_0x5ab5('0x17'));var utils=require(_0x5ab5('0x18'));var config=require(_0x5ab5('0x19'));var licenseUtil=require(_0x5ab5('0x1a'));var db=require(_0x5ab5('0x1b'))['db'];config[_0x5ab5('0x1c')]=_[_0x5ab5('0x1d')](config['redis'],{'host':_0x5ab5('0x1e'),'port':0x18eb});var socket=require(_0x5ab5('0x1f'))(new Redis(config[_0x5ab5('0x1c')]));require(_0x5ab5('0x20'))['register'](socket);function respondWithStatusCode(_0x3da8ea,_0x5f2885){_0x5f2885=_0x5f2885||0xcc;return function(_0x2b1204){if(_0x2b1204){return _0x3da8ea[_0x5ab5('0x21')](_0x5f2885);}return _0x3da8ea[_0x5ab5('0x22')](_0x5f2885)[_0x5ab5('0x23')]();};}function respondWithResult(_0x338aa4,_0x46f7a1){_0x46f7a1=_0x46f7a1||0xc8;return function(_0x473a94){if(_0x473a94){return _0x338aa4[_0x5ab5('0x22')](_0x46f7a1)[_0x5ab5('0x24')](_0x473a94);}};}function respondWithFilteredResult(_0x196c0d,_0x456de0){return function(_0x1fd4f0){if(_0x1fd4f0){var _0x401355=typeof _0x456de0['offset']===_0x5ab5('0x25')&&typeof _0x456de0[_0x5ab5('0x26')]===_0x5ab5('0x25');var _0x2dac5b=_0x1fd4f0[_0x5ab5('0x27')];var _0x20acab=_0x401355?0x0:_0x456de0['offset'];var _0x11ef62=_0x401355?_0x1fd4f0[_0x5ab5('0x27')]:_0x456de0[_0x5ab5('0x28')]+_0x456de0[_0x5ab5('0x26')];var _0x1830b5;if(_0x11ef62>=_0x2dac5b){_0x11ef62=_0x2dac5b;_0x1830b5=0xc8;}else{_0x1830b5=0xce;}_0x196c0d[_0x5ab5('0x22')](_0x1830b5);return _0x196c0d[_0x5ab5('0x29')](_0x5ab5('0x2a'),_0x20acab+'-'+_0x11ef62+'/'+_0x2dac5b)[_0x5ab5('0x24')](_0x1fd4f0);}return null;};}function patchUpdates(_0x4216e2){return function(_0x397348){try{jsonpatch[_0x5ab5('0x2b')](_0x397348,_0x4216e2,!![]);}catch(_0x334d9e){return BPromise['reject'](_0x334d9e);}return _0x397348[_0x5ab5('0x2c')]();};}function saveUpdates(_0x3ae1d4,_0x1f681f){return function(_0x36dcb9){if(_0x36dcb9){return _0x36dcb9['update'](_0x3ae1d4)[_0x5ab5('0x2d')](function(_0x53e702){return _0x53e702;});}return null;};}function removeEntity(_0x3565d7,_0x1ecf1c){return function(_0x2eb156){if(_0x2eb156){return _0x2eb156['destroy']()[_0x5ab5('0x2d')](function(){var _0x2e9e0b=_0x2eb156[_0x5ab5('0x2e')]({'plain':!![]});var _0x31cabd=_0x5ab5('0x2f');return db['UserProfileResource']['destroy']({'where':{'type':_0x31cabd,'resourceId':_0x2e9e0b['id']}})[_0x5ab5('0x2d')](function(){return _0x2eb156;});})[_0x5ab5('0x2d')](function(){_0x3565d7['status'](0xcc)[_0x5ab5('0x23')]();});}};}function handleEntityNotFound(_0x57ee88,_0x448f42){return function(_0x15ab94){if(!_0x15ab94){_0x57ee88[_0x5ab5('0x21')](0x194);}return _0x15ab94;};}function handleError(_0x3ae77c,_0x56b014){_0x56b014=_0x56b014||0x1f4;return function(_0x17b07f){logger[_0x5ab5('0x30')](_0x17b07f[_0x5ab5('0x31')]);if(_0x17b07f[_0x5ab5('0x32')]){delete _0x17b07f[_0x5ab5('0x32')];}_0x3ae77c[_0x5ab5('0x22')](_0x56b014)[_0x5ab5('0x33')](_0x17b07f);};}exports[_0x5ab5('0x34')]=function(_0x55a97f,_0x42619e){var _0x1bc6d3={},_0x2b0fa3={},_0x2383f6={'count':0x0,'rows':[]};var _0x3558b1=_[_0x5ab5('0x35')](db[_0x5ab5('0x36')][_0x5ab5('0x37')],function(_0x34d482){return{'name':_0x34d482[_0x5ab5('0x38')],'type':_0x34d482['type'][_0x5ab5('0x39')]};});_0x2b0fa3['model']=_[_0x5ab5('0x35')](_0x3558b1,_0x5ab5('0x32'));_0x2b0fa3[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x55a97f['query']);_0x2b0fa3[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x2b0fa3[_0x5ab5('0x3e')],_0x2b0fa3['query']);_0x1bc6d3[_0x5ab5('0x3f')]=_['intersection'](_0x2b0fa3['model'],qs['fields'](_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x40')]));_0x1bc6d3[_0x5ab5('0x3f')]=_0x1bc6d3[_0x5ab5('0x3f')][_0x5ab5('0x41')]?_0x1bc6d3[_0x5ab5('0x3f')]:_0x2b0fa3[_0x5ab5('0x3e')];if(!_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x42')]('nolimit')){_0x1bc6d3['limit']=qs[_0x5ab5('0x26')](_0x55a97f[_0x5ab5('0x3a')]['limit']);_0x1bc6d3['offset']=qs[_0x5ab5('0x28')](_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x28')]);}_0x1bc6d3[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x55a97f['query'][_0x5ab5('0x44')]);_0x1bc6d3[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x55a97f['query'],_0x2b0fa3[_0x5ab5('0x3c')]),_0x3558b1);if(_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x46')]){_0x1bc6d3[_0x5ab5('0x45')]=_[_0x5ab5('0x47')](_0x1bc6d3[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x3558b1,function(_0x2b7caa){if(_0x2b7caa[_0x5ab5('0x48')]!==_0x5ab5('0x49')){var _0x267f7a={};_0x267f7a[_0x2b7caa['name']]={'$like':'%'+_0x55a97f['query'][_0x5ab5('0x46')]+'%'};return _0x267f7a;}})});}_0x1bc6d3=_[_0x5ab5('0x47')]({},_0x1bc6d3,_0x55a97f[_0x5ab5('0x4a')]);var _0x6a6cb7={'where':_0x1bc6d3['where']};return db[_0x5ab5('0x36')]['count'](_0x6a6cb7)['then'](function(_0x131006){_0x2383f6[_0x5ab5('0x27')]=_0x131006;if(_0x55a97f[_0x5ab5('0x3a')]['includeAll']){_0x1bc6d3[_0x5ab5('0x4b')]=[{'all':!![]}];}return db[_0x5ab5('0x36')][_0x5ab5('0x4c')](_0x1bc6d3);})['then'](function(_0x5c01b1){_0x2383f6[_0x5ab5('0x4d')]=_0x5c01b1;return _0x2383f6;})[_0x5ab5('0x2d')](respondWithFilteredResult(_0x42619e,_0x1bc6d3))[_0x5ab5('0x4e')](handleError(_0x42619e,null));};exports['show']=function(_0x5c14fc,_0x3a133b){var _0x27954c={'raw':!![],'where':{'id':_0x5c14fc[_0x5ab5('0x4f')]['id']}},_0xd6838d={};_0xd6838d[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db[_0x5ab5('0x36')]['rawAttributes']);_0xd6838d[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x5c14fc[_0x5ab5('0x3a')]);_0xd6838d[_0x5ab5('0x3c')]=_['intersection'](_0xd6838d[_0x5ab5('0x3e')],_0xd6838d[_0x5ab5('0x3a')]);_0x27954c['attributes']=_[_0x5ab5('0x3d')](_0xd6838d[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x5c14fc[_0x5ab5('0x3a')]['fields']));_0x27954c[_0x5ab5('0x3f')]=_0x27954c[_0x5ab5('0x3f')][_0x5ab5('0x41')]?_0x27954c[_0x5ab5('0x3f')]:_0xd6838d[_0x5ab5('0x3e')];if(_0x5c14fc[_0x5ab5('0x3a')][_0x5ab5('0x50')]){_0x27954c['include']=[{'all':!![]}];}_0x27954c=_[_0x5ab5('0x47')]({},_0x27954c,_0x5c14fc[_0x5ab5('0x4a')]);return db[_0x5ab5('0x36')]['find'](_0x27954c)['then'](handleEntityNotFound(_0x3a133b,null))[_0x5ab5('0x2d')](respondWithResult(_0x3a133b,null))[_0x5ab5('0x4e')](handleError(_0x3a133b,null));};exports[_0x5ab5('0x51')]=function(_0x4d1885,_0x5647b9){return db[_0x5ab5('0x36')]['create'](_0x4d1885[_0x5ab5('0x52')],{})['then'](function(_0x490e46){var _0x306715=_0x4d1885[_0x5ab5('0x53')][_0x5ab5('0x2e')]({'plain':!![]});if(!_0x306715)throw new Error(_0x5ab5('0x54'));if(_0x306715[_0x5ab5('0x55')]==='user'){var _0x5e765e=_0x490e46[_0x5ab5('0x2e')]({'plain':!![]});var _0x39d1a6=_0x5ab5('0x2f');return db[_0x5ab5('0x56')][_0x5ab5('0x57')]({'where':{'name':_0x39d1a6,'userProfileId':_0x306715[_0x5ab5('0x58')]},'raw':!![]})[_0x5ab5('0x2d')](function(_0x5b6975){if(_0x5b6975&&_0x5b6975[_0x5ab5('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e765e[_0x5ab5('0x32')],'resourceId':_0x5e765e['id'],'type':_0x5b6975['name'],'sectionId':_0x5b6975['id']},{})[_0x5ab5('0x2d')](function(){return _0x490e46;});}else{return _0x490e46;}})[_0x5ab5('0x4e')](function(_0x58bdc1){logger[_0x5ab5('0x30')](_0x5ab5('0x5a'),_0x58bdc1);throw _0x58bdc1;});}return _0x490e46;})['then'](respondWithResult(_0x5647b9,0xc9))[_0x5ab5('0x4e')](handleError(_0x5647b9,null));};exports[_0x5ab5('0x5b')]=function(_0x290b92,_0x1f756a){if(_0x290b92[_0x5ab5('0x52')]['id']){delete _0x290b92[_0x5ab5('0x52')]['id'];}return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x290b92[_0x5ab5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f756a,null))['then'](saveUpdates(_0x290b92[_0x5ab5('0x52')],null))['then'](respondWithResult(_0x1f756a,null))[_0x5ab5('0x4e')](handleError(_0x1f756a,null));};exports[_0x5ab5('0x5c')]=function(_0x5e99be,_0x5a3248){return db[_0x5ab5('0x36')]['find']({'where':{'id':_0x5e99be['params']['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x5a3248,null))['then'](removeEntity(_0x5a3248,null))['catch'](handleError(_0x5a3248,null));};exports[_0x5ab5('0x5d')]=function(_0x11779b,_0x136fef){return db[_0x5ab5('0x36')][_0x5ab5('0x5d')]()[_0x5ab5('0x2d')](respondWithResult(_0x136fef,null))[_0x5ab5('0x4e')](handleError(_0x136fef,null));};exports[_0x5ab5('0x5e')]=function(_0x5dfc3d,_0x3e2ac7,_0x21a85c){var _0x271e65={'raw':!![],'where':{}},_0x47012f={},_0x476564;return db[_0x5ab5('0x36')][_0x5ab5('0x5f')]({'where':{'id':_0x5dfc3d['params']['id']}})['then'](handleEntityNotFound(_0x3e2ac7,null))[_0x5ab5('0x2d')](function(_0x4c01d4){if(_0x4c01d4){_0x476564=_0x4c01d4['get']({'plain':!![]});_0x47012f['model']=_['keys'](db[_0x5ab5('0x60')][_0x5ab5('0x37')]);_0x47012f[_0x5ab5('0x3a')]=_['keys'](_0x5dfc3d[_0x5ab5('0x3a')]);_0x47012f[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x47012f[_0x5ab5('0x3e')],_0x47012f[_0x5ab5('0x3a')]);_0x271e65[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x47012f[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x5dfc3d['query'][_0x5ab5('0x40')]));_0x271e65[_0x5ab5('0x3f')]=_0x271e65[_0x5ab5('0x3f')]['length']?_0x271e65[_0x5ab5('0x3f')]:_0x47012f['model'];if(!_0x5dfc3d[_0x5ab5('0x3a')]['hasOwnProperty'](_0x5ab5('0x61'))){_0x271e65[_0x5ab5('0x26')]=qs[_0x5ab5('0x26')](_0x5dfc3d[_0x5ab5('0x3a')]['limit']);_0x271e65['offset']=qs[_0x5ab5('0x28')](_0x5dfc3d[_0x5ab5('0x3a')]['offset']);}_0x271e65[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x5dfc3d[_0x5ab5('0x3a')]['sort']);_0x271e65[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x5dfc3d[_0x5ab5('0x3a')],_0x47012f[_0x5ab5('0x3c')]));_0x271e65[_0x5ab5('0x45')][_0x5ab5('0x62')]=_0x4c01d4['id'];if(_0x5dfc3d[_0x5ab5('0x3a')][_0x5ab5('0x46')]){_0x271e65[_0x5ab5('0x45')]=_[_0x5ab5('0x47')](_0x271e65[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x271e65[_0x5ab5('0x3f')],function(_0x32567f){var _0x563fb4={};_0x563fb4[_0x32567f]={'$like':'%'+_0x5dfc3d[_0x5ab5('0x3a')]['filter']+'%'};return _0x563fb4;})});}_0x271e65=_[_0x5ab5('0x47')]({},_0x271e65,_0x5dfc3d[_0x5ab5('0x4a')]);return db[_0x5ab5('0x60')][_0x5ab5('0x4c')](_0x271e65);}})[_0x5ab5('0x2d')](function(_0x44baad){if(_0x44baad){return db[_0x5ab5('0x63')][_0x5ab5('0x64')]({'where':{'id':_[_0x5ab5('0x35')](_0x44baad,_0x5ab5('0x65')),'role':_0x5ab5('0x66')},'attributes':['id',_0x5ab5('0x32'),_0x5ab5('0x67'),_0x5ab5('0x68'),_0x5ab5('0x69')]});}})[_0x5ab5('0x2d')](function(_0x131cfa){if(_0x131cfa){return{'count':_0x131cfa[_0x5ab5('0x27')],'rows':_[_0x5ab5('0x35')](_0x131cfa['rows'],function(_0xee0e43){return{'membername':_0xee0e43[_0x5ab5('0x32')],'UserId':_0xee0e43['id'],'queue_name':_0x476564[_0x5ab5('0x32')],'MailQueueId':_0x476564['id'],'interface':util[_0x5ab5('0x6a')](_0x5ab5('0x6b'),_0x5ab5('0x6c'),_0xee0e43['name']),'penalty':0x0,'paused':_0xee0e43[_0x5ab5('0x67')],'createdAt':_0xee0e43[_0x5ab5('0x69')],'updatedAt':_0xee0e43[_0x5ab5('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3e2ac7,_0x271e65))[_0x5ab5('0x4e')](handleError(_0x3e2ac7,null));};exports[_0x5ab5('0x6d')]=function(_0x286ab2,_0x34e08d,_0x15a4e7){var _0x15b488={};var _0x4a24a9={};var _0x8d1c15;var _0x5c0b30;return db[_0x5ab5('0x36')][_0x5ab5('0x5f')]({'where':{'id':_0x286ab2['params']['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x34e08d,null))['then'](function(_0xa23f13){if(_0xa23f13){_0x8d1c15=_0xa23f13;_0x4a24a9[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db['Team'][_0x5ab5('0x37')]);_0x4a24a9[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x286ab2[_0x5ab5('0x3a')]);_0x4a24a9['filters']=_['intersection'](_0x4a24a9[_0x5ab5('0x3e')],_0x4a24a9['query']);_0x15b488[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x4a24a9[_0x5ab5('0x3e')],qs['fields'](_0x286ab2[_0x5ab5('0x3a')]['fields']));_0x15b488[_0x5ab5('0x3f')]=_0x15b488['attributes'][_0x5ab5('0x41')]?_0x15b488['attributes']:_0x4a24a9['model'];_0x15b488[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x286ab2[_0x5ab5('0x3a')][_0x5ab5('0x44')]);_0x15b488[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x286ab2[_0x5ab5('0x3a')],_0x4a24a9[_0x5ab5('0x3c')]));if(_0x286ab2['query'][_0x5ab5('0x46')]){_0x15b488['where']=_[_0x5ab5('0x47')](_0x15b488['where'],{'$or':_[_0x5ab5('0x35')](_0x15b488['attributes'],function(_0x10213d){var _0x350e62={};_0x350e62[_0x10213d]={'$like':'%'+_0x286ab2['query']['filter']+'%'};return _0x350e62;})});}_0x15b488=_[_0x5ab5('0x47')]({},_0x15b488,_0x286ab2[_0x5ab5('0x4a')]);return _0x8d1c15[_0x5ab5('0x6d')](_0x15b488);}})[_0x5ab5('0x2d')](function(_0x2489cf){if(_0x2489cf){_0x5c0b30=_0x2489cf['length'];if(!_0x286ab2['query'][_0x5ab5('0x42')]('nolimit')){_0x15b488['limit']=qs[_0x5ab5('0x26')](_0x286ab2[_0x5ab5('0x3a')][_0x5ab5('0x26')]);_0x15b488[_0x5ab5('0x28')]=qs[_0x5ab5('0x28')](_0x286ab2['query'][_0x5ab5('0x28')]);}return _0x8d1c15['getTeams'](_0x15b488);}})[_0x5ab5('0x2d')](function(_0x10a1fd){if(_0x10a1fd){return _0x10a1fd?{'count':_0x5c0b30,'rows':_0x10a1fd}:null;}})['then'](respondWithResult(_0x34e08d,null))[_0x5ab5('0x4e')](handleError(_0x34e08d,null));};exports[_0x5ab5('0x6e')]=function(_0x4df8ef,_0x2e8c77,_0xb8eceb){var _0x4f6754=_0x4df8ef[_0x5ab5('0x52')][_0x5ab5('0x6f')];return db[_0x5ab5('0x70')][_0x5ab5('0x4c')]({'where':{'id':_0x4f6754},'attributes':['id'],'include':[{'model':db[_0x5ab5('0x63')],'as':_0x5ab5('0x71'),'attributes':['id',_0x5ab5('0x32'),_0x5ab5('0x72'),_0x5ab5('0x73'),_0x5ab5('0x74')],'raw':!![]}]})[_0x5ab5('0x2d')](function(_0x621746){if(_0x621746){var _0x22ae56=_['flatMap'](_0x621746,function(_0x24dbe3){var _0x40370c=_0x24dbe3[_0x5ab5('0x2e')]({'plain':!![]});return _0x40370c[_0x5ab5('0x71')];});return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x4df8ef[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](function(_0x4fc0ee){return db[_0x5ab5('0x75')]['transaction'](function(_0x1537cc){return _0x4fc0ee[_0x5ab5('0x6e')](_0x4f6754,{'transaction':_0x1537cc})[_0x5ab5('0x2d')](function(){return BPromise[_0x5ab5('0x76')](_0x22ae56,function(_0x309c64){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x309c64['id'],'MailQueueId':_0x4df8ef[_0x5ab5('0x4f')]['id']},'transaction':_0x1537cc});});})[_0x5ab5('0x2d')](function(){_0x22ae56[_0x5ab5('0x77')](function(_0xaf3d1){socket['emit'](_0x5ab5('0x78'),{'UserId':_0xaf3d1['id'],'MailQueueId':_0x4fc0ee['id']});});});});});}})[_0x5ab5('0x2d')](respondWithStatusCode(_0x2e8c77,null))[_0x5ab5('0x4e')](handleError(_0x2e8c77,null));};exports[_0x5ab5('0x79')]=function(_0x35c4f3,_0x186877,_0x462220){return db[_0x5ab5('0x70')][_0x5ab5('0x4c')]({'where':{'id':_0x35c4f3[_0x5ab5('0x3a')][_0x5ab5('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5ab5('0x2d')](handleEntityNotFound(_0x186877,null))[_0x5ab5('0x2d')](function(_0x1653dd){var _0x86045=_[_0x5ab5('0x35')](_0x1653dd,'id');var _0x2e06d4=[];var _0x4c8970=[];var _0x41a0e9=squel[_0x5ab5('0x7a')]();_0x41a0e9['field'](_0x5ab5('0x7b'))['from'](_0x5ab5('0x7c'),'tq')[_0x5ab5('0x7d')](_0x5ab5('0x7e'),'ut',_0x5ab5('0x7f'))[_0x5ab5('0x45')](_0x5ab5('0x80'),_0x35c4f3['params']['id']);for(var _0x40f1ba=0x0;_0x40f1ba<_0x1653dd['length'];_0x40f1ba+=0x1){let _0x1d3857=_0x1653dd[_0x40f1ba];for(var _0x26f217=0x0;_0x26f217<_0x1d3857[_0x5ab5('0x71')][_0x5ab5('0x41')];_0x26f217+=0x1){let _0x5e1e08=_0x1d3857[_0x5ab5('0x71')][_0x26f217];var _0x4cafbd=_0x41a0e9['clone']();_0x4cafbd[_0x5ab5('0x45')]('ut.UserId\x20=\x20?',_0x5e1e08['id']);_0x4c8970[_0x5ab5('0x81')](db[_0x5ab5('0x75')][_0x5ab5('0x3a')](_0x4cafbd[_0x5ab5('0x82')](),{'type':db[_0x5ab5('0x75')][_0x5ab5('0x83')]['SELECT']})[_0x5ab5('0x2d')](function(_0x5f1499){if(_0x5f1499[_0x5ab5('0x41')]===0x1){return _0x5e1e08['id'];}else{var _0x2f96b5=_['every'](_['map'](_0x5f1499,_0x5ab5('0x84')),function(_0x1e9045){return _[_0x5ab5('0x85')](_0x86045,_0x1e9045);});if(_0x2f96b5){return _0x5e1e08['id'];}}}));}}return BPromise[_0x5ab5('0x86')](_0x4c8970)[_0x5ab5('0x2d')](function(_0x36c575){_0x2e06d4=_(_0x2e06d4)[_0x5ab5('0x87')](_0x36c575)[_0x5ab5('0x88')]()[_0x5ab5('0x89')]();return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x35c4f3[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](function(_0x21da96){return db[_0x5ab5('0x75')][_0x5ab5('0x8a')](function(_0x49c401){return _0x21da96[_0x5ab5('0x79')](_0x35c4f3[_0x5ab5('0x3a')][_0x5ab5('0x6f')],{'transaction':_0x49c401})['then'](function(){if(!_[_0x5ab5('0x8b')](_0x2e06d4)){return _0x21da96[_0x5ab5('0x8c')](_0x2e06d4,{'transaction':_0x49c401});}})['then'](function(){_0x2e06d4[_0x5ab5('0x77')](function(_0x3511a9){socket[_0x5ab5('0x8d')](_0x5ab5('0x8e'),{'UserId':_0x3511a9,'MailQueueId':_0x21da96['id']});});});});});});})[_0x5ab5('0x2d')](respondWithStatusCode(_0x186877,null))[_0x5ab5('0x4e')](handleError(_0x186877,null));};exports[_0x5ab5('0x8f')]=function(_0x295620,_0x13bbea,_0x2c0587){return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x295620[_0x5ab5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13bbea,null))[_0x5ab5('0x2d')](function(_0x48af1b){if(_0x48af1b){return _0x48af1b[_0x5ab5('0x8f')](_0x295620[_0x5ab5('0x52')][_0x5ab5('0x6f')],_[_0x5ab5('0x90')](_0x295620[_0x5ab5('0x52')],[_0x5ab5('0x6f'),'id'])||{})[_0x5ab5('0x91')](function(_0x5603d5){for(var _0x5573b5=0x0;_0x5573b5<_0x295620[_0x5ab5('0x52')][_0x5ab5('0x6f')]['length'];_0x5573b5+=0x1){socket[_0x5ab5('0x8d')](_0x5ab5('0x78'),{'UserId':Number(_0x295620['body'][_0x5ab5('0x6f')][_0x5573b5]),'MailQueueId':Number(_0x295620[_0x5ab5('0x4f')]['id'])});}return _0x5603d5;});}})['then'](respondWithResult(_0x13bbea,null))[_0x5ab5('0x4e')](handleError(_0x13bbea,null));};exports[_0x5ab5('0x8c')]=function(_0x3a53ec,_0x3b0f37,_0x226000){return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x3a53ec[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x3b0f37,null))[_0x5ab5('0x2d')](function(_0x5788de){if(_0x5788de){return _0x5788de[_0x5ab5('0x8c')](_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')])[_0x5ab5('0x2d')](function(){if(_[_0x5ab5('0x92')](_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')])){for(var _0x400508=0x0;_0x400508<_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')][_0x5ab5('0x41')];_0x400508+=0x1){socket[_0x5ab5('0x8d')](_0x5ab5('0x8e'),{'UserId':Number(_0x3a53ec[_0x5ab5('0x3a')]['ids'][_0x400508]),'MailQueueId':Number(_0x3a53ec[_0x5ab5('0x4f')]['id'])});}}else{socket['emit'](_0x5ab5('0x8e'),{'UserId':Number(_0x3a53ec[_0x5ab5('0x3a')]['ids']),'MailQueueId':Number(_0x3a53ec['params']['id'])});}});}})[_0x5ab5('0x2d')](respondWithStatusCode(_0x3b0f37,null))[_0x5ab5('0x4e')](handleError(_0x3b0f37,null));};exports['getAgents']=function(_0x3f6389,_0x57a1ff,_0x3f8950){var _0x5744fc={};var _0x561cb8={};var _0x2f4693;var _0x392656;return db['MailQueue']['findOne']({'where':{'id':_0x3f6389[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x57a1ff,null))[_0x5ab5('0x2d')](function(_0x2f5e46){if(_0x2f5e46){_0x2f4693=_0x2f5e46;_0x561cb8[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db[_0x5ab5('0x63')][_0x5ab5('0x37')]);_0x561cb8['query']=_[_0x5ab5('0x3b')](_0x3f6389['query']);_0x561cb8[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x561cb8[_0x5ab5('0x3e')],_0x561cb8['query']);_0x5744fc[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x561cb8[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x3f6389['query']['fields']));_0x5744fc[_0x5ab5('0x3f')]=_0x5744fc['attributes']['length']?_0x5744fc[_0x5ab5('0x3f')]:_0x561cb8['model'];_0x5744fc[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x44')]);_0x5744fc[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_[_0x5ab5('0x93')](_0x3f6389[_0x5ab5('0x3a')],_0x561cb8['filters']));if(_0x3f6389['query'][_0x5ab5('0x46')]){_0x5744fc['where']=_[_0x5ab5('0x47')](_0x5744fc[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x5744fc[_0x5ab5('0x3f')],function(_0x1bdb7c){var _0x47dfd2={};_0x47dfd2[_0x1bdb7c]={'$like':'%'+_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x46')]+'%'};return _0x47dfd2;})});}_0x5744fc=_[_0x5ab5('0x47')]({},_0x5744fc,_0x3f6389[_0x5ab5('0x4a')]);return _0x2f4693[_0x5ab5('0x94')](_0x5744fc);}})['then'](function(_0x4fce1a){if(_0x4fce1a){_0x392656=_0x4fce1a[_0x5ab5('0x41')];if(!_0x3f6389['query'][_0x5ab5('0x42')](_0x5ab5('0x61'))){_0x5744fc[_0x5ab5('0x26')]=qs[_0x5ab5('0x26')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x26')]);_0x5744fc[_0x5ab5('0x28')]=qs[_0x5ab5('0x28')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x28')]);}return _0x2f4693[_0x5ab5('0x94')](_0x5744fc);}})[_0x5ab5('0x2d')](function(_0x208e6b){if(_0x208e6b){return _0x208e6b?{'count':_0x392656,'rows':_0x208e6b}:null;}})['then'](respondWithResult(_0x57a1ff,null))[_0x5ab5('0x4e')](handleError(_0x57a1ff,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6030b11..ac6da78 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 _0xc4bb=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x26e424,_0xfcf210){var _0x2c81d6=function(_0x58feef){while(--_0x58feef){_0x26e424['push'](_0x26e424['shift']());}};_0x2c81d6(++_0xfcf210);}(_0xc4bb,0x165));var _0xbc4b=function(_0x50a82d,_0x4133ce){_0x50a82d=_0x50a82d-0x0;var _0x269717=_0xc4bb[_0x50a82d];return _0x269717;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xbc4b('0x0'))['db'][_0xbc4b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbc4b('0x2')](0x0);var events={'afterCreate':_0xbc4b('0x3'),'afterUpdate':_0xbc4b('0x4'),'afterDestroy':_0xbc4b('0x5')};function emitEvent(_0x298060){return function(_0x23f5e8,_0x14f8a1,_0x33a931){MailQueueEvents[_0xbc4b('0x6')](_0x298060+':'+_0x23f5e8['id'],_0x23f5e8);MailQueueEvents[_0xbc4b('0x6')](_0x298060,_0x23f5e8);_0x33a931(null);};}for(var e in events){if(events[_0xbc4b('0x7')](e)){var event=events[e];MailQueue[_0xbc4b('0x8')](e,emitEvent(event));}}module[_0xbc4b('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x9f64=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x4cbef1,_0x589655){var _0x11a05e=function(_0xa8cbef){while(--_0xa8cbef){_0x4cbef1['push'](_0x4cbef1['shift']());}};_0x11a05e(++_0x589655);}(_0x9f64,0x1dc));var _0x49f6=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x9f64[_0x1b70e3];return _0x1452ab;};'use strict';var EventEmitter=require(_0x49f6('0x0'));var MailQueue=require(_0x49f6('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x49f6('0x2'),'afterUpdate':_0x49f6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5acce7){return function(_0x499de6,_0x3ed4a0,_0x2850e1){MailQueueEvents[_0x49f6('0x4')](_0x5acce7+':'+_0x499de6['id'],_0x499de6);MailQueueEvents[_0x49f6('0x4')](_0x5acce7,_0x499de6);_0x2850e1(null);};}for(var e in events){if(events[_0x49f6('0x5')](e)){var event=events[e];MailQueue[_0x49f6('0x6')](e,emitEvent(event));}}module[_0x49f6('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 09225e4..c371c48 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 _0x8f81=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0x8f81,0x1c7));var _0x18f8=function(_0x519a9a,_0x1e8a03){_0x519a9a=_0x519a9a-0x0;var _0x4d1df8=_0x8f81[_0x519a9a];return _0x4d1df8;};'use strict';var _=require(_0x18f8('0x0'));var util=require(_0x18f8('0x1'));var logger=require(_0x18f8('0x2'))(_0x18f8('0x3'));var moment=require('moment');var BPromise=require(_0x18f8('0x4'));var rp=require(_0x18f8('0x5'));var fs=require('fs');var path=require(_0x18f8('0x6'));var rimraf=require(_0x18f8('0x7'));var config=require('../../config/environment');var attributes=require(_0x18f8('0x8'));module[_0x18f8('0x9')]=function(_0x4a38ec,_0x5173cf){return _0x4a38ec[_0x18f8('0xa')](_0x18f8('0xb'),attributes,{'tableName':_0x18f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0dd=['mail_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x401997,_0x1d36b5){var _0x47048f=function(_0xc0c9cd){while(--_0xc0c9cd){_0x401997['push'](_0x401997['shift']());}};_0x47048f(++_0x1d36b5);}(_0xf0dd,0xb5));var _0xdf0d=function(_0x1abdba,_0x442f96){_0x1abdba=_0x1abdba-0x0;var _0xb618d4=_0xf0dd[_0x1abdba];return _0xb618d4;};'use strict';var _=require('lodash');var util=require(_0xdf0d('0x0'));var logger=require(_0xdf0d('0x1'))('api');var moment=require(_0xdf0d('0x2'));var BPromise=require(_0xdf0d('0x3'));var rp=require(_0xdf0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf0d('0x5'));var config=require(_0xdf0d('0x6'));var attributes=require(_0xdf0d('0x7'));module[_0xdf0d('0x8')]=function(_0x29be03,_0x239ba5){return _0x29be03[_0xdf0d('0x9')](_0xdf0d('0xa'),attributes,{'tableName':_0xdf0d('0xb'),'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 e7ccdc9..598bb83 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 _0x8d62=['code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowMailQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcee5cf,_0x2b290c){var _0x1d8f48=function(_0x5ac614){while(--_0x5ac614){_0xcee5cf['push'](_0xcee5cf['shift']());}};_0x1d8f48(++_0x2b290c);}(_0x8d62,0xb9));var _0x28d6=function(_0x2349fb,_0x2ef32d){_0x2349fb=_0x2349fb-0x0;var _0x1e21cb=_0x8d62[_0x2349fb];return _0x1e21cb;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var moment=require(_0x28d6('0x1'));var BPromise=require(_0x28d6('0x2'));var rs=require(_0x28d6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28d6('0x4'))['db'];var utils=require(_0x28d6('0x5'));var logger=require(_0x28d6('0x6'))(_0x28d6('0x7'));var config=require(_0x28d6('0x8'));var jayson=require(_0x28d6('0x9'));var client=jayson[_0x28d6('0xa')][_0x28d6('0xb')]({'port':0x232a});config[_0x28d6('0xc')]=_['defaults'](config[_0x28d6('0xc')],{'host':_0x28d6('0xd'),'port':0x18eb});var socket=require(_0x28d6('0xe'))(new Redis(config['redis']));require(_0x28d6('0xf'))[_0x28d6('0x10')](socket);function respondWithRpcPromise(_0x490bb8,_0x1132b7,_0x38387b){return new BPromise(function(_0x2cc97c,_0xa01532){return client[_0x28d6('0x11')](_0x490bb8,_0x38387b)[_0x28d6('0x12')](function(_0x42f101){logger[_0x28d6('0x13')](_0x28d6('0x14'),_0x1132b7,_0x28d6('0x15'));logger['debug'](_0x28d6('0x16'),_0x1132b7,'request\x20sent',JSON[_0x28d6('0x17')](_0x42f101));if(_0x42f101['error']){if(_0x42f101[_0x28d6('0x18')][_0x28d6('0x19')]===0x1f4){logger[_0x28d6('0x18')]('MailQueue,\x20%s,\x20%s',_0x1132b7,_0x42f101[_0x28d6('0x18')]['message']);return _0xa01532(_0x42f101['error'][_0x28d6('0x1a')]);}logger[_0x28d6('0x18')]('MailQueue,\x20%s,\x20%s',_0x1132b7,_0x42f101[_0x28d6('0x18')]['message']);return _0x2cc97c(_0x42f101[_0x28d6('0x18')]['message']);}else{logger['info'](_0x28d6('0x14'),_0x1132b7,'request\x20sent');_0x2cc97c(_0x42f101[_0x28d6('0x1b')]['message']);}})[_0x28d6('0x1c')](function(_0x4062b1){logger['error']('MailQueue,\x20%s,\x20%s',_0x1132b7,_0x4062b1);_0xa01532(_0x4062b1);});});}exports[_0x28d6('0x1d')]=function(_0x22503b){var _0x3fab96=this;return new Promise(function(_0x552df4,_0x597fed){return db[_0x28d6('0x1e')][_0x28d6('0x1f')]({'raw':_0x22503b[_0x28d6('0x20')]?_0x22503b[_0x28d6('0x20')][_0x28d6('0x21')]===undefined?!![]:![]:!![],'where':_0x22503b[_0x28d6('0x20')]?_0x22503b['options'][_0x28d6('0x22')]||null:null,'attributes':_0x22503b[_0x28d6('0x20')]?_0x22503b['options'][_0x28d6('0x23')]||null:null,'limit':_0x22503b[_0x28d6('0x20')]?_0x22503b[_0x28d6('0x20')][_0x28d6('0x24')]||null:null,'include':_0x22503b[_0x28d6('0x20')]?_0x22503b[_0x28d6('0x20')][_0x28d6('0x25')]?_[_0x28d6('0x26')](_0x22503b['options']['include'],function(_0x5e107d){return{'model':db[_0x5e107d[_0x28d6('0x27')]],'as':_0x5e107d['as'],'attributes':_0x5e107d[_0x28d6('0x23')],'include':_0x5e107d[_0x28d6('0x25')]?_[_0x28d6('0x26')](_0x5e107d['include'],function(_0x58605a){return{'model':db[_0x58605a[_0x28d6('0x27')]],'as':_0x58605a['as'],'attributes':_0x58605a[_0x28d6('0x23')],'include':_0x58605a[_0x28d6('0x25')]?_[_0x28d6('0x26')](_0x58605a[_0x28d6('0x25')],function(_0x28cc2b){return{'model':db[_0x28cc2b[_0x28d6('0x27')]],'as':_0x28cc2b['as'],'attributes':_0x28cc2b[_0x28d6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x28d6('0x12')](function(_0x37ffe7){logger[_0x28d6('0x13')]('GetMailQueue',_0x22503b);logger[_0x28d6('0x28')](_0x28d6('0x1d'),_0x22503b,JSON[_0x28d6('0x17')](_0x37ffe7));_0x552df4(_0x37ffe7);})[_0x28d6('0x1c')](function(_0x23adef){logger[_0x28d6('0x18')]('GetMailQueue',_0x23adef[_0x28d6('0x1a')],_0x22503b);_0x597fed(_0x3fab96[_0x28d6('0x18')](0x1f4,_0x23adef[_0x28d6('0x1a')]));});});};exports[_0x28d6('0x29')]=function(_0x4c44f5){var _0x394042=this;return new Promise(function(_0x2d9b83,_0x31557e){return db[_0x28d6('0x1e')]['find']({'raw':_0x4c44f5['options']?_0x4c44f5[_0x28d6('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4c44f5[_0x28d6('0x20')]?_0x4c44f5[_0x28d6('0x20')][_0x28d6('0x22')]||null:null,'attributes':_0x4c44f5[_0x28d6('0x20')]?_0x4c44f5[_0x28d6('0x20')]['attributes']||null:null,'include':_0x4c44f5['options']?_0x4c44f5['options']['include']?_[_0x28d6('0x26')](_0x4c44f5[_0x28d6('0x20')][_0x28d6('0x25')],function(_0x4dcacc){return{'model':db[_0x4dcacc[_0x28d6('0x27')]],'as':_0x4dcacc['as'],'attributes':_0x4dcacc[_0x28d6('0x23')],'include':_0x4dcacc[_0x28d6('0x25')]?_[_0x28d6('0x26')](_0x4dcacc[_0x28d6('0x25')],function(_0x51b0b7){return{'model':db[_0x51b0b7[_0x28d6('0x27')]],'as':_0x51b0b7['as'],'attributes':_0x51b0b7[_0x28d6('0x23')],'include':_0x51b0b7[_0x28d6('0x25')]?_[_0x28d6('0x26')](_0x51b0b7[_0x28d6('0x25')],function(_0x45644){return{'model':db[_0x45644[_0x28d6('0x27')]],'as':_0x45644['as'],'attributes':_0x45644[_0x28d6('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58a393){logger[_0x28d6('0x13')](_0x28d6('0x29'),_0x4c44f5);logger[_0x28d6('0x28')](_0x28d6('0x29'),_0x4c44f5,JSON[_0x28d6('0x17')](_0x58a393));_0x2d9b83(_0x58a393);})['catch'](function(_0x494cc9){logger['error'](_0x28d6('0x29'),_0x494cc9[_0x28d6('0x1a')],_0x4c44f5);_0x31557e(_0x394042[_0x28d6('0x18')](0x1f4,_0x494cc9[_0x28d6('0x1a')]));});});}; \ No newline at end of file +var _0xda3f=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','raw','options','where','limit','include','map','model','attributes','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xda3f,0x18b));var _0xfda3=function(_0x4eb94f,_0x3e6f1e){_0x4eb94f=_0x4eb94f-0x0;var _0x1188d0=_0xda3f[_0x4eb94f];return _0x1188d0;};'use strict';var _=require(_0xfda3('0x0'));var util=require(_0xfda3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfda3('0x2'));var fs=require('fs');var Redis=require(_0xfda3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x4'))('rpc');var config=require(_0xfda3('0x5'));var jayson=require(_0xfda3('0x6'));var client=jayson[_0xfda3('0x7')]['http']({'port':0x232a});config[_0xfda3('0x8')]=_['defaults'](config[_0xfda3('0x8')],{'host':_0xfda3('0x9'),'port':0x18eb});var socket=require(_0xfda3('0xa'))(new Redis(config[_0xfda3('0x8')]));require('./mailQueue.socket')[_0xfda3('0xb')](socket);function respondWithRpcPromise(_0x3d50d2,_0x62f20c,_0x3bf6b5){return new BPromise(function(_0x22e825,_0x37a670){return client[_0xfda3('0xc')](_0x3d50d2,_0x3bf6b5)[_0xfda3('0xd')](function(_0x2ab7ad){logger[_0xfda3('0xe')](_0xfda3('0xf'),_0x62f20c,_0xfda3('0x10'));logger[_0xfda3('0x11')](_0xfda3('0x12'),_0x62f20c,_0xfda3('0x10'),JSON[_0xfda3('0x13')](_0x2ab7ad));if(_0x2ab7ad[_0xfda3('0x14')]){if(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x15')]===0x1f4){logger['error'](_0xfda3('0xf'),_0x62f20c,_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);return _0x37a670(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);}logger[_0xfda3('0x14')](_0xfda3('0xf'),_0x62f20c,_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);return _0x22e825(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);}else{logger[_0xfda3('0xe')](_0xfda3('0xf'),_0x62f20c,_0xfda3('0x10'));_0x22e825(_0x2ab7ad[_0xfda3('0x17')][_0xfda3('0x16')]);}})[_0xfda3('0x18')](function(_0x21ca04){logger[_0xfda3('0x14')](_0xfda3('0xf'),_0x62f20c,_0x21ca04);_0x37a670(_0x21ca04);});});}exports[_0xfda3('0x19')]=function(_0x597822){var _0x214952=this;return new Promise(function(_0x2fdfde,_0x25cbc4){return db['MailQueue'][_0xfda3('0x1a')]({'raw':_0x597822['options']?_0x597822['options'][_0xfda3('0x1b')]===undefined?!![]:![]:!![],'where':_0x597822['options']?_0x597822[_0xfda3('0x1c')][_0xfda3('0x1d')]||null:null,'attributes':_0x597822[_0xfda3('0x1c')]?_0x597822[_0xfda3('0x1c')]['attributes']||null:null,'limit':_0x597822[_0xfda3('0x1c')]?_0x597822['options'][_0xfda3('0x1e')]||null:null,'include':_0x597822[_0xfda3('0x1c')]?_0x597822[_0xfda3('0x1c')][_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x597822[_0xfda3('0x1c')][_0xfda3('0x1f')],function(_0x107ce0){return{'model':db[_0x107ce0[_0xfda3('0x21')]],'as':_0x107ce0['as'],'attributes':_0x107ce0[_0xfda3('0x22')],'include':_0x107ce0[_0xfda3('0x1f')]?_['map'](_0x107ce0[_0xfda3('0x1f')],function(_0x3c849c){return{'model':db[_0x3c849c[_0xfda3('0x21')]],'as':_0x3c849c['as'],'attributes':_0x3c849c[_0xfda3('0x22')],'include':_0x3c849c[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x3c849c['include'],function(_0x55ca72){return{'model':db[_0x55ca72[_0xfda3('0x21')]],'as':_0x55ca72['as'],'attributes':_0x55ca72[_0xfda3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfda3('0xd')](function(_0x18ace4){logger[_0xfda3('0xe')](_0xfda3('0x19'),_0x597822);logger[_0xfda3('0x11')]('GetMailQueue',_0x597822,JSON[_0xfda3('0x13')](_0x18ace4));_0x2fdfde(_0x18ace4);})['catch'](function(_0x290086){logger['error'](_0xfda3('0x19'),_0x290086['message'],_0x597822);_0x25cbc4(_0x214952[_0xfda3('0x14')](0x1f4,_0x290086['message']));});});};exports[_0xfda3('0x23')]=function(_0x9a06ad){var _0x22fe08=this;return new Promise(function(_0x349ca9,_0x37931f){return db['MailQueue'][_0xfda3('0x24')]({'raw':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x1d')]||null:null,'attributes':_0x9a06ad['options']?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x22')]||null:null,'include':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x9a06ad[_0xfda3('0x1c')]['include'],function(_0x3a7679){return{'model':db[_0x3a7679[_0xfda3('0x21')]],'as':_0x3a7679['as'],'attributes':_0x3a7679[_0xfda3('0x22')],'include':_0x3a7679[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x3a7679[_0xfda3('0x1f')],function(_0x271b1c){return{'model':db[_0x271b1c[_0xfda3('0x21')]],'as':_0x271b1c['as'],'attributes':_0x271b1c[_0xfda3('0x22')],'include':_0x271b1c[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x271b1c[_0xfda3('0x1f')],function(_0x4fabea){return{'model':db[_0x4fabea[_0xfda3('0x21')]],'as':_0x4fabea['as'],'attributes':_0x4fabea[_0xfda3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfda3('0xd')](function(_0x5349da){logger[_0xfda3('0xe')]('ShowMailQueue',_0x9a06ad);logger[_0xfda3('0x11')](_0xfda3('0x23'),_0x9a06ad,JSON[_0xfda3('0x13')](_0x5349da));_0x349ca9(_0x5349da);})['catch'](function(_0x3c21b3){logger[_0xfda3('0x14')](_0xfda3('0x23'),_0x3c21b3[_0xfda3('0x16')],_0x9a06ad);_0x37931f(_0x22fe08['error'](0x1f4,_0x3c21b3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 054d99b..3a6d66c 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 _0xe6f1=['removeListener','register','length','mailQueue:','save','remove','update','emit'];(function(_0x29560f,_0x1621cc){var _0x49606e=function(_0x44649b){while(--_0x44649b){_0x29560f['push'](_0x29560f['shift']());}};_0x49606e(++_0x1621cc);}(_0xe6f1,0x1d4));var _0x1e6f=function(_0x41b06b,_0x34d7bb){_0x41b06b=_0x41b06b-0x0;var _0x52fce1=_0xe6f1[_0x41b06b];return _0x52fce1;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1e6f('0x0'),_0x1e6f('0x1'),_0x1e6f('0x2')];function createListener(_0x5d9dc0,_0x1ed8a2){return function(_0x214680){_0x1ed8a2[_0x1e6f('0x3')](_0x5d9dc0,_0x214680);};}function removeListener(_0x26ee46,_0x24d502){return function(){MailQueueEvents[_0x1e6f('0x4')](_0x26ee46,_0x24d502);};}exports[_0x1e6f('0x5')]=function(_0x14c56d){for(var _0x298efb=0x0,_0x4d7922=events[_0x1e6f('0x6')];_0x298efb<_0x4d7922;_0x298efb++){var _0x563c4b=events[_0x298efb];var _0x460ec3=createListener(_0x1e6f('0x7')+_0x563c4b,_0x14c56d);MailQueueEvents['on'](_0x563c4b,_0x460ec3);}}; \ No newline at end of file +var _0xc35d=['remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x76d320,_0xfc1f53){var _0x477978=function(_0x1c3365){while(--_0x1c3365){_0x76d320['push'](_0x76d320['shift']());}};_0x477978(++_0xfc1f53);}(_0xc35d,0x12e));var _0xdc35=function(_0x49596e,_0x3c9d9b){_0x49596e=_0x49596e-0x0;var _0x6eca7c=_0xc35d[_0x49596e];return _0x6eca7c;};'use strict';var MailQueueEvents=require(_0xdc35('0x0'));var events=[_0xdc35('0x1'),_0xdc35('0x2'),'update'];function createListener(_0x1f9658,_0x5b1dae){return function(_0x313600){_0x5b1dae[_0xdc35('0x3')](_0x1f9658,_0x313600);};}function removeListener(_0x5bdf91,_0x1daab0){return function(){MailQueueEvents[_0xdc35('0x4')](_0x5bdf91,_0x1daab0);};}exports[_0xdc35('0x5')]=function(_0x492294){for(var _0x33be37=0x0,_0x23cdff=events[_0xdc35('0x6')];_0x33be37<_0x23cdff;_0x33be37++){var _0x56583c=events[_0x33be37];var _0xe4b441=createListener(_0xdc35('0x7')+_0x56583c,_0x492294);MailQueueEvents['on'](_0x56583c,_0xe4b441);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a5f4c07..834e063 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 _0xbec0=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbec0,0x1d2));var _0x0bec=function(_0x5e38bd,_0x3b3d69){_0x5e38bd=_0x5e38bd-0x0;var _0x5a0f04=_0xbec0[_0x5e38bd];return _0x5a0f04;};'use strict';var multer=require('multer');var util=require(_0x0bec('0x0'));var path=require(_0x0bec('0x1'));var timeout=require(_0x0bec('0x2'));var express=require(_0x0bec('0x3'));var router=express[_0x0bec('0x4')]();var fs_extra=require(_0x0bec('0x5'));var auth=require(_0x0bec('0x6'));var interaction=require(_0x0bec('0x7'));var config=require(_0x0bec('0x8'));var controller=require(_0x0bec('0x9'));router[_0x0bec('0xa')]('/',auth[_0x0bec('0xb')](),controller['index']);router[_0x0bec('0xa')](_0x0bec('0xc'),auth[_0x0bec('0xb')](),controller[_0x0bec('0xd')]);router[_0x0bec('0xa')](_0x0bec('0xe'),auth[_0x0bec('0xb')](),controller[_0x0bec('0xf')]);router['post']('/',auth[_0x0bec('0xb')](),controller[_0x0bec('0x10')]);router[_0x0bec('0x11')]('/:id',auth[_0x0bec('0xb')](),controller[_0x0bec('0x12')]);router[_0x0bec('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0bec('0x14')]);module[_0x0bec('0x15')]=router; \ No newline at end of file +var _0x7ed7=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy'];(function(_0x26e6ec,_0x17de5d){var _0x1988d7=function(_0x270524){while(--_0x270524){_0x26e6ec['push'](_0x26e6ec['shift']());}};_0x1988d7(++_0x17de5d);}(_0x7ed7,0x1c3));var _0x77ed=function(_0x4c3ee2,_0x2221fa){_0x4c3ee2=_0x4c3ee2-0x0;var _0x5a5184=_0x7ed7[_0x4c3ee2];return _0x5a5184;};'use strict';var multer=require(_0x77ed('0x0'));var util=require('util');var path=require(_0x77ed('0x1'));var timeout=require(_0x77ed('0x2'));var express=require(_0x77ed('0x3'));var router=express[_0x77ed('0x4')]();var fs_extra=require(_0x77ed('0x5'));var auth=require(_0x77ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77ed('0x7'));var controller=require(_0x77ed('0x8'));router[_0x77ed('0x9')]('/',auth[_0x77ed('0xa')](),controller[_0x77ed('0xb')]);router[_0x77ed('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x77ed('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x77ed('0xa')](),controller[_0x77ed('0xd')]);router['put']('/:id',auth[_0x77ed('0xa')](),controller[_0x77ed('0xe')]);router[_0x77ed('0xf')](_0x77ed('0xc'),auth[_0x77ed('0xa')](),controller[_0x77ed('0x10')]);module[_0x77ed('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f925958..0cd7a52 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 _0xed9a=['sequelize','exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed9a,0xc7));var _0xaed9=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xed9a[_0x278e3c];return _0x3e2d9b;};'use strict';var moment=require(_0xaed9('0x0'));var Sequelize=require(_0xaed9('0x1'));module[_0xaed9('0x2')]={'uniqueid':{'type':Sequelize[_0xaed9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaed9('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaed9('0x4')]},'acceptAt':{'type':Sequelize[_0xaed9('0x4')]},'exitAt':{'type':Sequelize[_0xaed9('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf8f=['moment','sequelize','exports','STRING','DATE'];(function(_0x1a8bb0,_0xc523d4){var _0x146e92=function(_0x59e2ce){while(--_0x59e2ce){_0x1a8bb0['push'](_0x1a8bb0['shift']());}};_0x146e92(++_0xc523d4);}(_0xaf8f,0xcd));var _0xfaf8=function(_0x3e75a1,_0x47051b){_0x3e75a1=_0x3e75a1-0x0;var _0x456c32=_0xaf8f[_0x3e75a1];return _0x456c32;};'use strict';var moment=require(_0xfaf8('0x0'));var Sequelize=require(_0xfaf8('0x1'));module[_0xfaf8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfaf8('0x3')]},'joinAt':{'type':Sequelize[_0xfaf8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfaf8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfaf8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 20eb8bc..b835f23 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 _0x5430=['update','then','destroy','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','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','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x5adc18,_0x364758){var _0x5e2372=function(_0x53b1d){while(--_0x53b1d){_0x5adc18['push'](_0x5adc18['shift']());}};_0x5e2372(++_0x364758);}(_0x5430,0x10c));var _0x0543=function(_0x59b86a,_0x11c612){_0x59b86a=_0x59b86a-0x0;var _0xb3f3b=_0x5430[_0x59b86a];return _0xb3f3b;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=typeof _0x40fb03[_0x0543('0x1c')]==='undefined'&&typeof _0x40fb03[_0x0543('0x1d')]===_0x0543('0x1e');var _0x2dd5cb=_0x1dff7d[_0x0543('0x1f')];var _0x20b396=_0x1cfadf?0x0:_0x40fb03[_0x0543('0x1c')];var _0x577cf0=_0x1cfadf?_0x1dff7d['count']:_0x40fb03[_0x0543('0x1c')]+_0x40fb03['limit'];var _0x50ea84;if(_0x577cf0>=_0x2dd5cb){_0x577cf0=_0x2dd5cb;_0x50ea84=0xc8;}else{_0x50ea84=0xce;}_0xcb09df[_0x0543('0x1a')](_0x50ea84);return _0xcb09df[_0x0543('0x20')](_0x0543('0x21'),_0x20b396+'-'+_0x577cf0+'/'+_0x2dd5cb)['json'](_0x1dff7d);}return null;};}function patchUpdates(_0x3f0452){return function(_0x51c271){try{jsonpatch[_0x0543('0x22')](_0x51c271,_0x3f0452,!![]);}catch(_0x411ec2){return BPromise['reject'](_0x411ec2);}return _0x51c271[_0x0543('0x23')]();};}function saveUpdates(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')](_0x333c72)[_0x0543('0x25')](function(_0x4adba7){return _0x4adba7;});}return null;};}function removeEntity(_0x5979d2,_0x59f1b2){return function(_0xbfe5dc){if(_0xbfe5dc){return _0xbfe5dc[_0x0543('0x26')]()[_0x0543('0x25')](function(){_0x5979d2[_0x0543('0x1a')](0xcc)[_0x0543('0x1b')]();});}};}function handleEntityNotFound(_0x26e500,_0x36d824){return function(_0x17a3de){if(!_0x17a3de){_0x26e500[_0x0543('0x19')](0x194);}return _0x17a3de;};}function handleError(_0xf1eccf,_0x40a261){_0x40a261=_0x40a261||0x1f4;return function(_0x21fc63){logger['error'](_0x21fc63[_0x0543('0x27')]);if(_0x21fc63[_0x0543('0x28')]){delete _0x21fc63[_0x0543('0x28')];}_0xf1eccf['status'](_0x40a261)[_0x0543('0x29')](_0x21fc63);};}exports[_0x0543('0x2a')]=function(_0x41c4a7,_0x10b881){var _0x5dd789={},_0x1732be={},_0x10b9f3={'count':0x0,'rows':[]};var _0x492f60=_['map'](db[_0x0543('0x2b')][_0x0543('0x2c')],function(_0x51d49d){return{'name':_0x51d49d[_0x0543('0x2d')],'type':_0x51d49d[_0x0543('0x2e')][_0x0543('0x2f')]};});_0x1732be[_0x0543('0x30')]=_[_0x0543('0x31')](_0x492f60,_0x0543('0x28'));_0x1732be[_0x0543('0x32')]=_['keys'](_0x41c4a7[_0x0543('0x32')]);_0x1732be['filters']=_[_0x0543('0x33')](_0x1732be[_0x0543('0x30')],_0x1732be[_0x0543('0x32')]);_0x5dd789[_0x0543('0x34')]=_[_0x0543('0x33')](_0x1732be['model'],qs[_0x0543('0x35')](_0x41c4a7['query'][_0x0543('0x35')]));_0x5dd789[_0x0543('0x34')]=_0x5dd789[_0x0543('0x34')][_0x0543('0x36')]?_0x5dd789['attributes']:_0x1732be[_0x0543('0x30')];if(!_0x41c4a7['query'][_0x0543('0x37')](_0x0543('0x38'))){_0x5dd789[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1d')]);_0x5dd789[_0x0543('0x1c')]=qs[_0x0543('0x1c')](_0x41c4a7[_0x0543('0x32')][_0x0543('0x1c')]);}_0x5dd789['order']=qs[_0x0543('0x39')](_0x41c4a7[_0x0543('0x32')]['sort']);_0x5dd789[_0x0543('0x3a')]=qs['filters'](_[_0x0543('0x3b')](_0x41c4a7[_0x0543('0x32')],_0x1732be['filters']),_0x492f60);if(_0x41c4a7['query'][_0x0543('0x3c')]){_0x5dd789[_0x0543('0x3a')]=_['merge'](_0x5dd789[_0x0543('0x3a')],{'$or':_[_0x0543('0x31')](_0x492f60,function(_0x54543f){if(_0x54543f[_0x0543('0x2e')]!==_0x0543('0x3d')){var _0x3ecd70={};_0x3ecd70[_0x54543f[_0x0543('0x28')]]={'$like':'%'+_0x41c4a7[_0x0543('0x32')]['filter']+'%'};return _0x3ecd70;}})});}_0x5dd789=_['merge']({},_0x5dd789,_0x41c4a7['options']);var _0x486d9c={'where':_0x5dd789[_0x0543('0x3a')]};return db[_0x0543('0x2b')][_0x0543('0x1f')](_0x486d9c)['then'](function(_0xc66396){_0x10b9f3[_0x0543('0x1f')]=_0xc66396;if(_0x41c4a7[_0x0543('0x32')][_0x0543('0x3e')]){_0x5dd789[_0x0543('0x3f')]=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5dd789);})['then'](function(_0x24a891){_0x10b9f3[_0x0543('0x41')]=_0x24a891;return _0x10b9f3;})[_0x0543('0x25')](respondWithFilteredResult(_0x10b881,_0x5dd789))[_0x0543('0x42')](handleError(_0x10b881,null));};exports[_0x0543('0x43')]=function(_0x43b7e8,_0x5bf53d){var _0x53dfb8={'raw':!![],'where':{'id':_0x43b7e8[_0x0543('0x44')]['id']}},_0x44116a={};_0x44116a[_0x0543('0x30')]=_[_0x0543('0x45')](db[_0x0543('0x2b')][_0x0543('0x2c')]);_0x44116a[_0x0543('0x32')]=_[_0x0543('0x45')](_0x43b7e8[_0x0543('0x32')]);_0x44116a['filters']=_['intersection'](_0x44116a[_0x0543('0x30')],_0x44116a[_0x0543('0x32')]);_0x53dfb8['attributes']=_['intersection'](_0x44116a[_0x0543('0x30')],qs[_0x0543('0x35')](_0x43b7e8['query'][_0x0543('0x35')]));_0x53dfb8['attributes']=_0x53dfb8[_0x0543('0x34')][_0x0543('0x36')]?_0x53dfb8['attributes']:_0x44116a['model'];if(_0x43b7e8[_0x0543('0x32')]['includeAll']){_0x53dfb8[_0x0543('0x3f')]=[{'all':!![]}];}_0x53dfb8=_[_0x0543('0x46')]({},_0x53dfb8,_0x43b7e8[_0x0543('0x47')]);return db[_0x0543('0x2b')][_0x0543('0x48')](_0x53dfb8)[_0x0543('0x25')](handleEntityNotFound(_0x5bf53d,null))['then'](respondWithResult(_0x5bf53d,null))[_0x0543('0x42')](handleError(_0x5bf53d,null));};exports[_0x0543('0x49')]=function(_0xb8076c,_0xf0a28f){return db[_0x0543('0x2b')]['create'](_0xb8076c[_0x0543('0x4a')],{})['then'](respondWithResult(_0xf0a28f,0xc9))[_0x0543('0x42')](handleError(_0xf0a28f,null));};exports[_0x0543('0x24')]=function(_0x3f4c40,_0x46d398){if(_0x3f4c40[_0x0543('0x4a')]['id']){delete _0x3f4c40[_0x0543('0x4a')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3f4c40['params']['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x46d398,null))[_0x0543('0x25')](saveUpdates(_0x3f4c40['body'],null))[_0x0543('0x25')](respondWithResult(_0x46d398,null))[_0x0543('0x42')](handleError(_0x46d398,null));};exports[_0x0543('0x26')]=function(_0x3d3bfc,_0x90dd22){return db[_0x0543('0x2b')]['find']({'where':{'id':_0x3d3bfc[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x90dd22,null))[_0x0543('0x25')](removeEntity(_0x90dd22,null))[_0x0543('0x42')](handleError(_0x90dd22,null));};exports[_0x0543('0x4b')]=function(_0x449150,_0x265bc1){return db[_0x0543('0x2b')][_0x0543('0x4b')]()[_0x0543('0x25')](respondWithResult(_0x265bc1,null))[_0x0543('0x42')](handleError(_0x265bc1,null));}; \ No newline at end of file +var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x41f4b3,_0x4c535c){var _0x3a4866=function(_0x518e3b){while(--_0x518e3b){_0x41f4b3['push'](_0x41f4b3['shift']());}};_0x3a4866(++_0x4c535c);}(_0x2542,0x169));var _0x2254=function(_0x5084e4,_0xe1e310){_0x5084e4=_0x5084e4-0x0;var _0x485679=_0x2542[_0x5084e4];return _0x485679;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':!![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['MailQueueReport'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0b79d88..1530f27 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 _0x0e76=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x0e76,0xc4));var _0x60e7=function(_0x5d0792,_0x486759){_0x5d0792=_0x5d0792-0x0;var _0x2885a6=_0x0e76[_0x5d0792];return _0x2885a6;};'use strict';var _=require(_0x60e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60e7('0x1'));var moment=require('moment');var BPromise=require(_0x60e7('0x2'));var rp=require(_0x60e7('0x3'));var fs=require('fs');var path=require(_0x60e7('0x4'));var rimraf=require(_0x60e7('0x5'));var config=require(_0x60e7('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x60e7('0x7')]=function(_0x35b628,_0x1fb45c){return _0x35b628[_0x60e7('0x8')](_0x60e7('0x9'),attributes,{'tableName':_0x60e7('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x60e7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfb=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31e0af,_0x18ad3e){var _0x128d84=function(_0x150bec){while(--_0x150bec){_0x31e0af['push'](_0x31e0af['shift']());}};_0x128d84(++_0x18ad3e);}(_0x6bfb,0x8f));var _0xb6bf=function(_0xd506b6,_0x2617ad){_0xd506b6=_0xd506b6-0x0;var _0x4a89db=_0x6bfb[_0xd506b6];return _0x4a89db;};'use strict';var _=require('lodash');var util=require(_0xb6bf('0x0'));var logger=require(_0xb6bf('0x1'))(_0xb6bf('0x2'));var moment=require(_0xb6bf('0x3'));var BPromise=require(_0xb6bf('0x4'));var rp=require(_0xb6bf('0x5'));var fs=require('fs');var path=require(_0xb6bf('0x6'));var rimraf=require(_0xb6bf('0x7'));var config=require(_0xb6bf('0x8'));var attributes=require(_0xb6bf('0x9'));module[_0xb6bf('0xa')]=function(_0x2044a2,_0x3f588f){return _0x2044a2[_0xb6bf('0xb')](_0xb6bf('0xc'),attributes,{'tableName':_0xb6bf('0xd'),'paranoid':![],'indexes':[{'name':_0xb6bf('0xe'),'fields':[_0xb6bf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e7e0988..10787a2 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x3f5e56,_0x2514b6){var _0x20399d=function(_0x411d96){while(--_0x411d96){_0x3f5e56['push'](_0x3f5e56['shift']());}};_0x20399d(++_0x2514b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42b508,_0x5ba68c){_0x42b508=_0x42b508-0x0;var _0x9619ae=_0x5f2f[_0x42b508];return _0x9619ae;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +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(_0x2d781e,_0x41a443){var _0x4d4afa=function(_0x2e51e7){while(--_0x2e51e7){_0x2d781e['push'](_0x2d781e['shift']());}};_0x4d4afa(++_0x41a443);}(_0x326f,0xd1));var _0xf326=function(_0x2b4302,_0x10742c){_0x2b4302=_0x2b4302-0x0;var _0x284f84=_0x326f[_0x2b4302];return _0x284f84;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4633748..13e3243 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d7802,_0x42e06b){var _0x22e238=function(_0x119acf){while(--_0x119acf){_0x5d7802['push'](_0x5d7802['shift']());}};_0x22e238(++_0x42e06b);}(_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(_0xc5c125,_0x50162d){var _0x4a8421=function(_0x4dce40){while(--_0x4dce40){_0xc5c125['push'](_0xc5c125['shift']());}};_0x4a8421(++_0x50162d);}(_0x70e0,0x17b));var _0x070e=function(_0xdb6b4e,_0x36e00e){_0xdb6b4e=_0xdb6b4e-0x0;var _0xf44d72=_0x70e0[_0xdb6b4e];return _0xf44d72;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8edb23a..770873c 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 _0x1aa7=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x1aa7,0x85));var _0x71aa=function(_0x34926f,_0xd86cc8){_0x34926f=_0x34926f-0x0;var _0x16d6e1=_0x1aa7[_0x34926f];return _0x16d6e1;};'use strict';var Sequelize=require(_0x71aa('0x0'));module[_0x71aa('0x1')]={'description':{'type':Sequelize[_0x71aa('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x71aa('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x71aa('0x2')]},'password':{'type':Sequelize[_0x71aa('0x2')]},'port':{'type':Sequelize[_0x71aa('0x4')]},'tls':{'type':Sequelize[_0x71aa('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x71aa('0x5')},'connTimeout':{'type':Sequelize[_0x71aa('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x71aa('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x71aa('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe019=['sequelize','exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x497788,_0x2005aa){var _0x960178=function(_0x2dc0fe){while(--_0x2dc0fe){_0x497788['push'](_0x497788['shift']());}};_0x960178(++_0x2005aa);}(_0xe019,0x1b0));var _0x9e01=function(_0x2ebb95,_0x527878){_0x2ebb95=_0x2ebb95-0x0;var _0x16031a=_0xe019[_0x2ebb95];return _0x16031a;};'use strict';var Sequelize=require(_0x9e01('0x0'));module[_0x9e01('0x1')]={'description':{'type':Sequelize[_0x9e01('0x2')]},'host':{'type':Sequelize[_0x9e01('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x9e01('0x2')]},'password':{'type':Sequelize[_0x9e01('0x2')]},'port':{'type':Sequelize[_0x9e01('0x3')]},'tls':{'type':Sequelize[_0x9e01('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9e01('0x2')],'defaultValue':_0x9e01('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9e01('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ac32f7b..99e3152 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 _0xe081=['define','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./mailServerIn.attributes'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe081,0x1ce));var _0x1e08=function(_0x35342e,_0x45b2b6){_0x35342e=_0x35342e-0x0;var _0x4e139f=_0xe081[_0x35342e];return _0x4e139f;};'use strict';var _=require(_0x1e08('0x0'));var util=require(_0x1e08('0x1'));var logger=require('../../config/logger')(_0x1e08('0x2'));var moment=require(_0x1e08('0x3'));var BPromise=require(_0x1e08('0x4'));var rp=require(_0x1e08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e08('0x6'));var attributes=require(_0x1e08('0x7'));module['exports']=function(_0x2bf554,_0x739ce3){return _0x2bf554[_0x1e08('0x8')]('MailServerIn',attributes,{'tableName':_0x1e08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e2a=['../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util'];(function(_0x16fd61,_0x481acd){var _0x131d3f=function(_0x13cd91){while(--_0x13cd91){_0x16fd61['push'](_0x16fd61['shift']());}};_0x131d3f(++_0x481acd);}(_0x4e2a,0x1a3));var _0xa4e2=function(_0x191e35,_0x172ffa){_0x191e35=_0x191e35-0x0;var _0x4f8ccc=_0x4e2a[_0x191e35];return _0x4f8ccc;};'use strict';var _=require('lodash');var util=require(_0xa4e2('0x0'));var logger=require(_0xa4e2('0x1'))(_0xa4e2('0x2'));var moment=require(_0xa4e2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4e2('0x4'));var fs=require('fs');var path=require(_0xa4e2('0x5'));var rimraf=require(_0xa4e2('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4e2('0x7'));module[_0xa4e2('0x8')]=function(_0x4ce7e0,_0x2e6d8e){return _0x4ce7e0[_0xa4e2('0x9')](_0xa4e2('0xa'),attributes,{'tableName':_0xa4e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index c59aacb..9184949 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 _0x7427=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','MailServerIn,\x20%s,\x20%s','GetMailServerIn','MailServerIn','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5b17ea,_0x164cac){var _0x44d0a0=function(_0x54ac81){while(--_0x54ac81){_0x5b17ea['push'](_0x5b17ea['shift']());}};_0x44d0a0(++_0x164cac);}(_0x7427,0x111));var _0x7742=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x7427[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var moment=require(_0x7742('0x2'));var BPromise=require(_0x7742('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7742('0x4'));var db=require(_0x7742('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7742('0x6'))(_0x7742('0x7'));var config=require(_0x7742('0x8'));var jayson=require(_0x7742('0x9'));var client=jayson[_0x7742('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe55f,_0x2634d5,_0xd21f94){return new BPromise(function(_0x3c6ceb,_0x1da94f){return client[_0x7742('0xb')](_0x4fe55f,_0xd21f94)[_0x7742('0xc')](function(_0x46696e){logger[_0x7742('0xd')]('MailServerIn,\x20%s,\x20%s',_0x2634d5,'request\x20sent');logger[_0x7742('0xe')](_0x7742('0xf'),_0x2634d5,'request\x20sent',JSON[_0x7742('0x10')](_0x46696e));if(_0x46696e['error']){if(_0x46696e['error'][_0x7742('0x11')]===0x1f4){logger[_0x7742('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2634d5,_0x46696e[_0x7742('0x12')][_0x7742('0x13')]);return _0x1da94f(_0x46696e['error']['message']);}logger[_0x7742('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2634d5,_0x46696e['error']['message']);return _0x3c6ceb(_0x46696e['error'][_0x7742('0x13')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x2634d5,_0x7742('0x14'));_0x3c6ceb(_0x46696e['result'][_0x7742('0x13')]);}})[_0x7742('0x15')](function(_0x1f3ffc){logger[_0x7742('0x12')](_0x7742('0x16'),_0x2634d5,_0x1f3ffc);_0x1da94f(_0x1f3ffc);});});}exports[_0x7742('0x17')]=function(_0x4e10c5){var _0x180201=this;return new Promise(function(_0x40a053,_0xccd8e4){return db[_0x7742('0x18')]['findAll']({'raw':_0x4e10c5[_0x7742('0x19')]?_0x4e10c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e10c5['options']?_0x4e10c5['options'][_0x7742('0x1a')]||null:null,'attributes':_0x4e10c5[_0x7742('0x19')]?_0x4e10c5[_0x7742('0x19')][_0x7742('0x1b')]||null:null,'limit':_0x4e10c5[_0x7742('0x19')]?_0x4e10c5['options']['limit']||null:null,'include':_0x4e10c5[_0x7742('0x19')]?_0x4e10c5[_0x7742('0x19')][_0x7742('0x1c')]?_[_0x7742('0x1d')](_0x4e10c5['options'][_0x7742('0x1c')],function(_0x30c1ec){return{'model':db[_0x30c1ec[_0x7742('0x1e')]],'as':_0x30c1ec['as'],'attributes':_0x30c1ec[_0x7742('0x1b')],'include':_0x30c1ec[_0x7742('0x1c')]?_[_0x7742('0x1d')](_0x30c1ec['include'],function(_0x3e7e71){return{'model':db[_0x3e7e71[_0x7742('0x1e')]],'as':_0x3e7e71['as'],'attributes':_0x3e7e71[_0x7742('0x1b')],'include':_0x3e7e71[_0x7742('0x1c')]?_[_0x7742('0x1d')](_0x3e7e71[_0x7742('0x1c')],function(_0x26fdb0){return{'model':db[_0x26fdb0[_0x7742('0x1e')]],'as':_0x26fdb0['as'],'attributes':_0x26fdb0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x239997){logger[_0x7742('0xd')](_0x7742('0x17'),_0x4e10c5);logger['debug'](_0x7742('0x17'),_0x4e10c5,JSON['stringify'](_0x239997));_0x40a053(_0x239997);})['catch'](function(_0x58716d){logger['error'](_0x7742('0x17'),_0x58716d[_0x7742('0x13')],_0x4e10c5);_0xccd8e4(_0x180201[_0x7742('0x12')](0x1f4,_0x58716d[_0x7742('0x13')]));});});}; \ No newline at end of file +var _0x4201=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s'];(function(_0xeb350,_0x1accac){var _0x32323f=function(_0x27c637){while(--_0x27c637){_0xeb350['push'](_0xeb350['shift']());}};_0x32323f(++_0x1accac);}(_0x4201,0x102));var _0x1420=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x4201[_0x287a47];return _0x3fb726;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require(_0x1420('0x2'));var BPromise=require('bluebird');var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1420('0x6'));var config=require(_0x1420('0x7'));var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dae38,_0x174ccf,_0x272e97){return new BPromise(function(_0x5c6211,_0xf9d2f6){return client[_0x1420('0xb')](_0x2dae38,_0x272e97)['then'](function(_0x4cc945){logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));logger[_0x1420('0xf')](_0x1420('0x10'),_0x174ccf,'request\x20sent',JSON['stringify'](_0x4cc945));if(_0x4cc945[_0x1420('0x11')]){if(_0x4cc945[_0x1420('0x11')]['code']===0x1f4){logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0xf9d2f6(_0x4cc945['error'][_0x1420('0x12')]);}logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0x5c6211(_0x4cc945['error'][_0x1420('0x12')]);}else{logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));_0x5c6211(_0x4cc945[_0x1420('0x13')]['message']);}})[_0x1420('0x14')](function(_0x901a0a){logger['error'](_0x1420('0xd'),_0x174ccf,_0x901a0a);_0xf9d2f6(_0x901a0a);});});}exports[_0x1420('0x15')]=function(_0x3f85cb){var _0x3ff1b7=this;return new Promise(function(_0x5634ab,_0x41701e){return db[_0x1420('0x16')][_0x1420('0x17')]({'raw':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x19')]===undefined?!![]:![]:!![],'where':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x1a')]||null:null,'attributes':_0x3f85cb['options']?_0x3f85cb['options'][_0x1420('0x1b')]||null:null,'limit':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x1c')]||null:null,'include':_0x3f85cb['options']?_0x3f85cb['options'][_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x3f85cb[_0x1420('0x18')][_0x1420('0x1d')],function(_0x56aced){return{'model':db[_0x56aced[_0x1420('0x1f')]],'as':_0x56aced['as'],'attributes':_0x56aced[_0x1420('0x1b')],'include':_0x56aced[_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x56aced[_0x1420('0x1d')],function(_0x4cd68a){return{'model':db[_0x4cd68a['model']],'as':_0x4cd68a['as'],'attributes':_0x4cd68a[_0x1420('0x1b')],'include':_0x4cd68a[_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x4cd68a[_0x1420('0x1d')],function(_0x46a04e){return{'model':db[_0x46a04e[_0x1420('0x1f')]],'as':_0x46a04e['as'],'attributes':_0x46a04e[_0x1420('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1420('0x20')](function(_0x210391){logger['info'](_0x1420('0x15'),_0x3f85cb);logger[_0x1420('0xf')](_0x1420('0x15'),_0x3f85cb,JSON[_0x1420('0x21')](_0x210391));_0x5634ab(_0x210391);})[_0x1420('0x14')](function(_0x4d2542){logger['error'](_0x1420('0x15'),_0x4d2542[_0x1420('0x12')],_0x3f85cb);_0x41701e(_0x3ff1b7[_0x1420('0x11')](0x1f4,_0x4d2542[_0x1420('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bf74cf2..9a66352 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_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 +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(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7a54,0x106));var _0x47a5=function(_0xb64b7f,_0x4abf03){_0xb64b7f=_0xb64b7f-0x0;var _0x52f5e0=_0x7a54[_0xb64b7f];return _0x52f5e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3c720a0..0662ff2 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 _0x3f8c=['STRING'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x3f8c,0x104));var _0xc3f8=function(_0x5e1fc7,_0x4e0b02){_0x5e1fc7=_0x5e1fc7-0x0;var _0xea40a4=_0x3f8c[_0x5e1fc7];return _0xea40a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc3f8('0x0')]},'host':{'type':Sequelize[_0xc3f8('0x0')]},'user':{'type':Sequelize[_0xc3f8('0x0')]},'pass':{'type':Sequelize[_0xc3f8('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x3c81,0x102));var _0x13c8=function(_0x29a704,_0x4129dc){_0x29a704=_0x29a704-0x0;var _0x2fdeba=_0x3c81[_0x29a704];return _0x2fdeba;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('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 3e63b5e..f0be4e4 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 _0xe3f8=['update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MailServerOut','length','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe3f8,0x1ca));var _0x8e3f=function(_0x42c84b,_0x269ed0){_0x42c84b=_0x42c84b-0x0;var _0x3bd1c7=_0xe3f8[_0x42c84b];return _0x3bd1c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e3f('0x0'));var zipdir=require(_0x8e3f('0x1'));var jsonpatch=require(_0x8e3f('0x2'));var rp=require(_0x8e3f('0x3'));var moment=require(_0x8e3f('0x4'));var BPromise=require(_0x8e3f('0x5'));var Mustache=require(_0x8e3f('0x6'));var util=require(_0x8e3f('0x7'));var path=require(_0x8e3f('0x8'));var sox=require(_0x8e3f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8e3f('0xa'));var crypto=require(_0x8e3f('0xb'));var jsforce=require(_0x8e3f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8e3f('0xd'));var querystring=require(_0x8e3f('0xe'));var Papa=require(_0x8e3f('0xf'));var Redis=require(_0x8e3f('0x10'));var authService=require(_0x8e3f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e3f('0x12'));var logger=require(_0x8e3f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e3f('0x14'))['db'];function respondWithStatusCode(_0x53c914,_0x230cf6){_0x230cf6=_0x230cf6||0xcc;return function(_0x2ccb53){if(_0x2ccb53){return _0x53c914[_0x8e3f('0x15')](_0x230cf6);}return _0x53c914['status'](_0x230cf6)[_0x8e3f('0x16')]();};}function respondWithResult(_0x4457c6,_0x18f5a7){_0x18f5a7=_0x18f5a7||0xc8;return function(_0xaa1c29){if(_0xaa1c29){return _0x4457c6[_0x8e3f('0x17')](_0x18f5a7)[_0x8e3f('0x18')](_0xaa1c29);}};}function respondWithFilteredResult(_0x1fe5b3,_0x52b645){return function(_0x453340){if(_0x453340){var _0x4f231d=typeof _0x52b645[_0x8e3f('0x19')]===_0x8e3f('0x1a')&&typeof _0x52b645[_0x8e3f('0x1b')]===_0x8e3f('0x1a');var _0x16eb30=_0x453340[_0x8e3f('0x1c')];var _0x237673=_0x4f231d?0x0:_0x52b645[_0x8e3f('0x19')];var _0x21873c=_0x4f231d?_0x453340[_0x8e3f('0x1c')]:_0x52b645[_0x8e3f('0x19')]+_0x52b645[_0x8e3f('0x1b')];var _0x1d53f5;if(_0x21873c>=_0x16eb30){_0x21873c=_0x16eb30;_0x1d53f5=0xc8;}else{_0x1d53f5=0xce;}_0x1fe5b3[_0x8e3f('0x17')](_0x1d53f5);return _0x1fe5b3['set']('Content-Range',_0x237673+'-'+_0x21873c+'/'+_0x16eb30)['json'](_0x453340);}return null;};}function patchUpdates(_0x337568){return function(_0x26b0a9){try{jsonpatch[_0x8e3f('0x1d')](_0x26b0a9,_0x337568,!![]);}catch(_0xa91799){return BPromise[_0x8e3f('0x1e')](_0xa91799);}return _0x26b0a9[_0x8e3f('0x1f')]();};}function saveUpdates(_0x422d64,_0x382048){return function(_0x4818f0){if(_0x4818f0){return _0x4818f0[_0x8e3f('0x20')](_0x422d64)[_0x8e3f('0x21')](function(_0x594c90){return _0x594c90;});}return null;};}function removeEntity(_0x197139,_0x1d053f){return function(_0x4663ee){if(_0x4663ee){return _0x4663ee[_0x8e3f('0x22')]()[_0x8e3f('0x21')](function(){_0x197139['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf7269,_0x1f68bb){return function(_0x49e557){if(!_0x49e557){_0xdf7269[_0x8e3f('0x15')](0x194);}return _0x49e557;};}function handleError(_0x24070a,_0x353940){_0x353940=_0x353940||0x1f4;return function(_0x31712f){logger[_0x8e3f('0x23')](_0x31712f[_0x8e3f('0x24')]);if(_0x31712f[_0x8e3f('0x25')]){delete _0x31712f[_0x8e3f('0x25')];}_0x24070a[_0x8e3f('0x17')](_0x353940)[_0x8e3f('0x26')](_0x31712f);};}exports['index']=function(_0x1d334d,_0xfd30b0){var _0x2d0737={},_0x4b956c={},_0x1d384c={'count':0x0,'rows':[]};var _0x13edfc=_[_0x8e3f('0x27')](db['MailServerOut'][_0x8e3f('0x28')],function(_0x4674a0){return{'name':_0x4674a0[_0x8e3f('0x29')],'type':_0x4674a0[_0x8e3f('0x2a')][_0x8e3f('0x2b')]};});_0x4b956c[_0x8e3f('0x2c')]=_['map'](_0x13edfc,_0x8e3f('0x25'));_0x4b956c[_0x8e3f('0x2d')]=_[_0x8e3f('0x2e')](_0x1d334d['query']);_0x4b956c[_0x8e3f('0x2f')]=_[_0x8e3f('0x30')](_0x4b956c[_0x8e3f('0x2c')],_0x4b956c['query']);_0x2d0737[_0x8e3f('0x31')]=_['intersection'](_0x4b956c[_0x8e3f('0x2c')],qs['fields'](_0x1d334d[_0x8e3f('0x2d')][_0x8e3f('0x32')]));_0x2d0737[_0x8e3f('0x31')]=_0x2d0737['attributes']['length']?_0x2d0737[_0x8e3f('0x31')]:_0x4b956c[_0x8e3f('0x2c')];if(!_0x1d334d[_0x8e3f('0x2d')][_0x8e3f('0x33')](_0x8e3f('0x34'))){_0x2d0737[_0x8e3f('0x1b')]=qs['limit'](_0x1d334d[_0x8e3f('0x2d')][_0x8e3f('0x1b')]);_0x2d0737[_0x8e3f('0x19')]=qs[_0x8e3f('0x19')](_0x1d334d[_0x8e3f('0x2d')][_0x8e3f('0x19')]);}_0x2d0737['order']=qs[_0x8e3f('0x35')](_0x1d334d[_0x8e3f('0x2d')][_0x8e3f('0x35')]);_0x2d0737['where']=qs['filters'](_[_0x8e3f('0x36')](_0x1d334d[_0x8e3f('0x2d')],_0x4b956c[_0x8e3f('0x2f')]),_0x13edfc);if(_0x1d334d[_0x8e3f('0x2d')]['filter']){_0x2d0737['where']=_[_0x8e3f('0x37')](_0x2d0737[_0x8e3f('0x38')],{'$or':_[_0x8e3f('0x27')](_0x13edfc,function(_0x943cc){if(_0x943cc[_0x8e3f('0x2a')]!==_0x8e3f('0x39')){var _0x283d2d={};_0x283d2d[_0x943cc[_0x8e3f('0x25')]]={'$like':'%'+_0x1d334d[_0x8e3f('0x2d')]['filter']+'%'};return _0x283d2d;}})});}_0x2d0737=_[_0x8e3f('0x37')]({},_0x2d0737,_0x1d334d[_0x8e3f('0x3a')]);var _0x32c725={'where':_0x2d0737['where']};return db['MailServerOut'][_0x8e3f('0x1c')](_0x32c725)[_0x8e3f('0x21')](function(_0x33fe53){_0x1d384c[_0x8e3f('0x1c')]=_0x33fe53;if(_0x1d334d['query'][_0x8e3f('0x3b')]){_0x2d0737[_0x8e3f('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x8e3f('0x3d')](_0x2d0737);})['then'](function(_0x36e334){_0x1d384c[_0x8e3f('0x3e')]=_0x36e334;return _0x1d384c;})[_0x8e3f('0x21')](respondWithFilteredResult(_0xfd30b0,_0x2d0737))[_0x8e3f('0x3f')](handleError(_0xfd30b0,null));};exports[_0x8e3f('0x40')]=function(_0x541995,_0x17e73c){var _0xf761dd={'raw':!![],'where':{'id':_0x541995[_0x8e3f('0x41')]['id']}},_0x1a5990={};_0x1a5990[_0x8e3f('0x2c')]=_['keys'](db[_0x8e3f('0x42')][_0x8e3f('0x28')]);_0x1a5990['query']=_[_0x8e3f('0x2e')](_0x541995[_0x8e3f('0x2d')]);_0x1a5990[_0x8e3f('0x2f')]=_[_0x8e3f('0x30')](_0x1a5990[_0x8e3f('0x2c')],_0x1a5990['query']);_0xf761dd[_0x8e3f('0x31')]=_[_0x8e3f('0x30')](_0x1a5990[_0x8e3f('0x2c')],qs[_0x8e3f('0x32')](_0x541995[_0x8e3f('0x2d')][_0x8e3f('0x32')]));_0xf761dd[_0x8e3f('0x31')]=_0xf761dd['attributes'][_0x8e3f('0x43')]?_0xf761dd[_0x8e3f('0x31')]:_0x1a5990['model'];if(_0x541995[_0x8e3f('0x2d')][_0x8e3f('0x3b')]){_0xf761dd['include']=[{'all':!![]}];}_0xf761dd=_[_0x8e3f('0x37')]({},_0xf761dd,_0x541995[_0x8e3f('0x3a')]);return db['MailServerOut'][_0x8e3f('0x44')](_0xf761dd)['then'](handleEntityNotFound(_0x17e73c,null))[_0x8e3f('0x21')](respondWithResult(_0x17e73c,null))[_0x8e3f('0x3f')](handleError(_0x17e73c,null));};exports['create']=function(_0x527a9a,_0x1b885f){return db['MailServerOut']['create'](_0x527a9a['body'],{})[_0x8e3f('0x21')](respondWithResult(_0x1b885f,0xc9))[_0x8e3f('0x3f')](handleError(_0x1b885f,null));};exports[_0x8e3f('0x20')]=function(_0x28755b,_0x186748){if(_0x28755b[_0x8e3f('0x45')]['id']){delete _0x28755b[_0x8e3f('0x45')]['id'];}return db['MailServerOut'][_0x8e3f('0x44')]({'where':{'id':_0x28755b['params']['id']}})[_0x8e3f('0x21')](handleEntityNotFound(_0x186748,null))['then'](saveUpdates(_0x28755b['body'],null))[_0x8e3f('0x21')](respondWithResult(_0x186748,null))['catch'](handleError(_0x186748,null));};exports[_0x8e3f('0x22')]=function(_0x17c611,_0x203682){return db[_0x8e3f('0x42')][_0x8e3f('0x44')]({'where':{'id':_0x17c611[_0x8e3f('0x41')]['id']}})['then'](handleEntityNotFound(_0x203682,null))[_0x8e3f('0x21')](removeEntity(_0x203682,null))[_0x8e3f('0x3f')](handleError(_0x203682,null));}; \ No newline at end of file +var _0x941d=['apply','reject','save','update','then','error','name','index','map','MailServerOut','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','rawAttributes','include','catch','create','body','find','destroy','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x128e88,_0x3311b5){var _0x52bb01=function(_0x69ac93){while(--_0x69ac93){_0x128e88['push'](_0x128e88['shift']());}};_0x52bb01(++_0x3311b5);}(_0x941d,0x18b));var _0xd941=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0x941d[_0x185832];return _0x253dda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd941('0x0'));var zipdir=require(_0xd941('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd941('0x2'));var moment=require(_0xd941('0x3'));var BPromise=require(_0xd941('0x4'));var Mustache=require('mustache');var util=require(_0xd941('0x5'));var path=require(_0xd941('0x6'));var sox=require(_0xd941('0x7'));var csv=require(_0xd941('0x8'));var ejs=require(_0xd941('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd941('0xa'));var crypto=require(_0xd941('0xb'));var jsforce=require(_0xd941('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd941('0xd'));var Papa=require(_0xd941('0xe'));var Redis=require(_0xd941('0xf'));var authService=require(_0xd941('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd941('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd941('0x12'))('api');var utils=require(_0xd941('0x13'));var config=require(_0xd941('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd941('0x15'))['db'];function respondWithStatusCode(_0x515d98,_0x5e5910){_0x5e5910=_0x5e5910||0xcc;return function(_0x422299){if(_0x422299){return _0x515d98['sendStatus'](_0x5e5910);}return _0x515d98[_0xd941('0x16')](_0x5e5910)[_0xd941('0x17')]();};}function respondWithResult(_0x295070,_0x19df41){_0x19df41=_0x19df41||0xc8;return function(_0x1a3d1e){if(_0x1a3d1e){return _0x295070[_0xd941('0x16')](_0x19df41)[_0xd941('0x18')](_0x1a3d1e);}};}function respondWithFilteredResult(_0x44039d,_0x2b01a9){return function(_0x5cf230){if(_0x5cf230){var _0x1c02d9=typeof _0x2b01a9[_0xd941('0x19')]===_0xd941('0x1a')&&typeof _0x2b01a9[_0xd941('0x1b')]===_0xd941('0x1a');var _0x3f47b2=_0x5cf230[_0xd941('0x1c')];var _0x296e05=_0x1c02d9?0x0:_0x2b01a9[_0xd941('0x19')];var _0x45f181=_0x1c02d9?_0x5cf230['count']:_0x2b01a9[_0xd941('0x19')]+_0x2b01a9[_0xd941('0x1b')];var _0x3f281f;if(_0x45f181>=_0x3f47b2){_0x45f181=_0x3f47b2;_0x3f281f=0xc8;}else{_0x3f281f=0xce;}_0x44039d[_0xd941('0x16')](_0x3f281f);return _0x44039d[_0xd941('0x1d')](_0xd941('0x1e'),_0x296e05+'-'+_0x45f181+'/'+_0x3f47b2)[_0xd941('0x18')](_0x5cf230);}return null;};}function patchUpdates(_0x161785){return function(_0x36dd0d){try{jsonpatch[_0xd941('0x1f')](_0x36dd0d,_0x161785,!![]);}catch(_0x2395fd){return BPromise[_0xd941('0x20')](_0x2395fd);}return _0x36dd0d[_0xd941('0x21')]();};}function saveUpdates(_0x2e7dd9,_0x12e2e9){return function(_0x33d959){if(_0x33d959){return _0x33d959[_0xd941('0x22')](_0x2e7dd9)[_0xd941('0x23')](function(_0x3db344){return _0x3db344;});}return null;};}function removeEntity(_0x3de41e,_0x56128b){return function(_0x269cdc){if(_0x269cdc){return _0x269cdc['destroy']()[_0xd941('0x23')](function(){_0x3de41e[_0xd941('0x16')](0xcc)[_0xd941('0x17')]();});}};}function handleEntityNotFound(_0x3be7ce,_0x5f4159){return function(_0x427581){if(!_0x427581){_0x3be7ce['sendStatus'](0x194);}return _0x427581;};}function handleError(_0x5574fa,_0x1ae0fc){_0x1ae0fc=_0x1ae0fc||0x1f4;return function(_0x341f52){logger[_0xd941('0x24')](_0x341f52['stack']);if(_0x341f52[_0xd941('0x25')]){delete _0x341f52[_0xd941('0x25')];}_0x5574fa[_0xd941('0x16')](_0x1ae0fc)['send'](_0x341f52);};}exports[_0xd941('0x26')]=function(_0x9f1b0f,_0x3676fe){var _0x3022be={},_0x519c0d={},_0x193bce={'count':0x0,'rows':[]};var _0x235e6e=_[_0xd941('0x27')](db[_0xd941('0x28')]['rawAttributes'],function(_0x4b8cd2){return{'name':_0x4b8cd2['fieldName'],'type':_0x4b8cd2[_0xd941('0x29')][_0xd941('0x2a')]};});_0x519c0d[_0xd941('0x2b')]=_[_0xd941('0x27')](_0x235e6e,_0xd941('0x25'));_0x519c0d[_0xd941('0x2c')]=_['keys'](_0x9f1b0f[_0xd941('0x2c')]);_0x519c0d[_0xd941('0x2d')]=_[_0xd941('0x2e')](_0x519c0d[_0xd941('0x2b')],_0x519c0d[_0xd941('0x2c')]);_0x3022be[_0xd941('0x2f')]=_[_0xd941('0x2e')](_0x519c0d[_0xd941('0x2b')],qs['fields'](_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x30')]));_0x3022be[_0xd941('0x2f')]=_0x3022be['attributes'][_0xd941('0x31')]?_0x3022be[_0xd941('0x2f')]:_0x519c0d[_0xd941('0x2b')];if(!_0x9f1b0f['query'][_0xd941('0x32')](_0xd941('0x33'))){_0x3022be[_0xd941('0x1b')]=qs[_0xd941('0x1b')](_0x9f1b0f['query']['limit']);_0x3022be[_0xd941('0x19')]=qs['offset'](_0x9f1b0f['query']['offset']);}_0x3022be['order']=qs[_0xd941('0x34')](_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x34')]);_0x3022be['where']=qs[_0xd941('0x2d')](_[_0xd941('0x35')](_0x9f1b0f[_0xd941('0x2c')],_0x519c0d['filters']),_0x235e6e);if(_0x9f1b0f['query']['filter']){_0x3022be[_0xd941('0x36')]=_[_0xd941('0x37')](_0x3022be[_0xd941('0x36')],{'$or':_[_0xd941('0x27')](_0x235e6e,function(_0x8e59b){if(_0x8e59b['type']!==_0xd941('0x38')){var _0x2d9894={};_0x2d9894[_0x8e59b[_0xd941('0x25')]]={'$like':'%'+_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x39')]+'%'};return _0x2d9894;}})});}_0x3022be=_[_0xd941('0x37')]({},_0x3022be,_0x9f1b0f[_0xd941('0x3a')]);var _0x139816={'where':_0x3022be[_0xd941('0x36')]};return db[_0xd941('0x28')][_0xd941('0x1c')](_0x139816)[_0xd941('0x23')](function(_0x3ae975){_0x193bce['count']=_0x3ae975;if(_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x3b')]){_0x3022be['include']=[{'all':!![]}];}return db[_0xd941('0x28')][_0xd941('0x3c')](_0x3022be);})[_0xd941('0x23')](function(_0x300acf){_0x193bce[_0xd941('0x3d')]=_0x300acf;return _0x193bce;})[_0xd941('0x23')](respondWithFilteredResult(_0x3676fe,_0x3022be))['catch'](handleError(_0x3676fe,null));};exports['show']=function(_0x3b6fec,_0xca5ccb){var _0x26b20f={'raw':!![],'where':{'id':_0x3b6fec[_0xd941('0x3e')]['id']}},_0x2cc118={};_0x2cc118[_0xd941('0x2b')]=_[_0xd941('0x3f')](db[_0xd941('0x28')][_0xd941('0x40')]);_0x2cc118[_0xd941('0x2c')]=_[_0xd941('0x3f')](_0x3b6fec['query']);_0x2cc118[_0xd941('0x2d')]=_[_0xd941('0x2e')](_0x2cc118['model'],_0x2cc118['query']);_0x26b20f[_0xd941('0x2f')]=_[_0xd941('0x2e')](_0x2cc118['model'],qs['fields'](_0x3b6fec['query'][_0xd941('0x30')]));_0x26b20f[_0xd941('0x2f')]=_0x26b20f[_0xd941('0x2f')]['length']?_0x26b20f[_0xd941('0x2f')]:_0x2cc118['model'];if(_0x3b6fec['query'][_0xd941('0x3b')]){_0x26b20f[_0xd941('0x41')]=[{'all':!![]}];}_0x26b20f=_[_0xd941('0x37')]({},_0x26b20f,_0x3b6fec[_0xd941('0x3a')]);return db['MailServerOut']['find'](_0x26b20f)[_0xd941('0x23')](handleEntityNotFound(_0xca5ccb,null))[_0xd941('0x23')](respondWithResult(_0xca5ccb,null))[_0xd941('0x42')](handleError(_0xca5ccb,null));};exports[_0xd941('0x43')]=function(_0x5b70b9,_0xbb5671){return db[_0xd941('0x28')]['create'](_0x5b70b9[_0xd941('0x44')],{})[_0xd941('0x23')](respondWithResult(_0xbb5671,0xc9))['catch'](handleError(_0xbb5671,null));};exports['update']=function(_0x9bd3f6,_0x4c7967){if(_0x9bd3f6[_0xd941('0x44')]['id']){delete _0x9bd3f6[_0xd941('0x44')]['id'];}return db[_0xd941('0x28')][_0xd941('0x45')]({'where':{'id':_0x9bd3f6['params']['id']}})[_0xd941('0x23')](handleEntityNotFound(_0x4c7967,null))[_0xd941('0x23')](saveUpdates(_0x9bd3f6[_0xd941('0x44')],null))[_0xd941('0x23')](respondWithResult(_0x4c7967,null))['catch'](handleError(_0x4c7967,null));};exports[_0xd941('0x46')]=function(_0x1bca43,_0xf0a228){return db[_0xd941('0x28')][_0xd941('0x45')]({'where':{'id':_0x1bca43[_0xd941('0x3e')]['id']}})[_0xd941('0x23')](handleEntityNotFound(_0xf0a228,null))[_0xd941('0x23')](removeEntity(_0xf0a228,null))[_0xd941('0x42')](handleError(_0xf0a228,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7532467..65dad7e 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 _0x1430=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','request-promise'];(function(_0x374837,_0x1ee53c){var _0x306f24=function(_0x5bc6c2){while(--_0x5bc6c2){_0x374837['push'](_0x374837['shift']());}};_0x306f24(++_0x1ee53c);}(_0x1430,0x11d));var _0x0143=function(_0x426634,_0x1bbe11){_0x426634=_0x426634-0x0;var _0x1570f1=_0x1430[_0x426634];return _0x1570f1;};'use strict';var _=require(_0x0143('0x0'));var util=require(_0x0143('0x1'));var logger=require(_0x0143('0x2'))('api');var moment=require(_0x0143('0x3'));var BPromise=require('bluebird');var rp=require(_0x0143('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0143('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x0143('0x6')]=function(_0x3b75ba,_0xa0eeaa){return _0x3b75ba[_0x0143('0x7')](_0x0143('0x8'),attributes,{'tableName':_0x0143('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc583=['lodash','../../config/logger','api','moment','bluebird','request-promise','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x558b07,_0x264477){var _0x25cea3=function(_0x478bf1){while(--_0x478bf1){_0x558b07['push'](_0x558b07['shift']());}};_0x25cea3(++_0x264477);}(_0xc583,0x108));var _0x3c58=function(_0x5185a9,_0x1c4718){_0x5185a9=_0x5185a9-0x0;var _0x54b17b=_0xc583[_0x5185a9];return _0x54b17b;};'use strict';var _=require(_0x3c58('0x0'));var util=require('util');var logger=require(_0x3c58('0x1'))(_0x3c58('0x2'));var moment=require(_0x3c58('0x3'));var BPromise=require(_0x3c58('0x4'));var rp=require(_0x3c58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c58('0x6'));module[_0x3c58('0x7')]=function(_0x3a9f7a,_0x1f9b36){return _0x3a9f7a[_0x3c58('0x8')](_0x3c58('0x9'),attributes,{'tableName':_0x3c58('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 b40f3d9..1fe91bf 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x314bb5,_0x476e6a){var _0x32c85e=function(_0x52673d){while(--_0x52673d){_0x314bb5['push'](_0x314bb5['shift']());}};_0x32c85e(++_0x476e6a);}(_0x2ef3,0xba));var _0x32ef=function(_0x50e2c0,_0xcfd5ca){_0x50e2c0=_0x50e2c0-0x0;var _0x537cb9=_0x2ef3[_0x50e2c0];return _0x537cb9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1bdb82,_0x50e7a5){var _0x11a52b=function(_0x5f2d02){while(--_0x5f2d02){_0x1bdb82['push'](_0x1bdb82['shift']());}};_0x11a52b(++_0x50e7a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x2ed33a,_0x1d51ee){_0x2ed33a=_0x2ed33a-0x0;var _0x3ef242=_0x2ef3[_0x2ed33a];return _0x3ef242;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1d6d4b3..7427a31 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 _0xae7b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout'];(function(_0x3c9b51,_0x41d8ab){var _0x4722f6=function(_0x373ba1){while(--_0x373ba1){_0x3c9b51['push'](_0x3c9b51['shift']());}};_0x4722f6(++_0x41d8ab);}(_0xae7b,0x12d));var _0xbae7=function(_0x4fdb0a,_0x47ddfd){_0x4fdb0a=_0x4fdb0a-0x0;var _0x57e3a2=_0xae7b[_0x4fdb0a];return _0x57e3a2;};'use strict';var multer=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var path=require('path');var timeout=require(_0xbae7('0x2'));var express=require(_0xbae7('0x3'));var router=express[_0xbae7('0x4')]();var fs_extra=require(_0xbae7('0x5'));var auth=require(_0xbae7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbae7('0x7'));var controller=require(_0xbae7('0x8'));router['get']('/',auth[_0xbae7('0x9')](),controller['index']);router[_0xbae7('0xa')](_0xbae7('0xb'),auth[_0xbae7('0x9')](),controller['describe']);router[_0xbae7('0xa')](_0xbae7('0xc'),auth[_0xbae7('0x9')](),controller[_0xbae7('0xd')]);router[_0xbae7('0xe')]('/',auth[_0xbae7('0x9')](),controller[_0xbae7('0xf')]);router[_0xbae7('0x10')](_0xbae7('0xc'),auth[_0xbae7('0x9')](),controller[_0xbae7('0x11')]);router['delete']('/:id',auth[_0xbae7('0x9')](),controller['destroy']);module[_0xbae7('0x12')]=router; \ No newline at end of file +var _0x8bef=['create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x8bef,0x1a8));var _0xf8be=function(_0x2b950c,_0x57cc37){_0x2b950c=_0x2b950c-0x0;var _0x592648=_0x8bef[_0x2b950c];return _0x592648;};'use strict';var multer=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var path=require(_0xf8be('0x2'));var timeout=require(_0xf8be('0x3'));var express=require(_0xf8be('0x4'));var router=express[_0xf8be('0x5')]();var fs_extra=require(_0xf8be('0x6'));var auth=require(_0xf8be('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xf8be('0x8')]('/',auth[_0xf8be('0x9')](),controller[_0xf8be('0xa')]);router['get'](_0xf8be('0xb'),auth['isAuthenticated'](),controller[_0xf8be('0xc')]);router['get'](_0xf8be('0xd'),auth[_0xf8be('0x9')](),controller[_0xf8be('0xe')]);router[_0xf8be('0xf')]('/',auth[_0xf8be('0x9')](),controller[_0xf8be('0x10')]);router['put'](_0xf8be('0xd'),auth[_0xf8be('0x9')](),controller[_0xf8be('0x11')]);router['delete']('/:id',auth[_0xf8be('0x9')](),controller[_0xf8be('0x12')]);module[_0xf8be('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9159d22..1da8066 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 _0xbfe8=['exports','name','STRING'];(function(_0x3c6c56,_0x215126){var _0x37220f=function(_0x7cb6ac){while(--_0x7cb6ac){_0x3c6c56['push'](_0x3c6c56['shift']());}};_0x37220f(++_0x215126);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x96846,_0x491ed4){_0x96846=_0x96846-0x0;var _0x1ed627=_0xbfe8[_0x96846];return _0x1ed627;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8bfe('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8bfe('0x2')]}}; \ No newline at end of file +var _0xf40b=['STRING','name','exports'];(function(_0x3de4af,_0x3a27cf){var _0x4f7a6b=function(_0x5bace0){while(--_0x5bace0){_0x3de4af['push'](_0x3de4af['shift']());}};_0x4f7a6b(++_0x3a27cf);}(_0xf40b,0xb0));var _0xbf40=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xf40b[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require('sequelize');module[_0xbf40('0x0')]={'name':{'type':Sequelize[_0xbf40('0x1')],'unique':_0xbf40('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf40('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ddfaec6..7b88bf1 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 _0x2e30=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','filter','where','merge','include','findAll','params','includeAll','options','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x2b39c2,_0x1c6709){var _0x27b41e=function(_0x54230c){while(--_0x54230c){_0x2b39c2['push'](_0x2b39c2['shift']());}};_0x27b41e(++_0x1c6709);}(_0x2e30,0xd1));var _0x02e3=function(_0x56072d,_0x36ac47){_0x56072d=_0x56072d-0x0;var _0x5dd36c=_0x2e30[_0x56072d];return _0x5dd36c;};'use strict';var emlformat=require(_0x02e3('0x0'));var rimraf=require(_0x02e3('0x1'));var zipdir=require(_0x02e3('0x2'));var jsonpatch=require(_0x02e3('0x3'));var rp=require(_0x02e3('0x4'));var moment=require('moment');var BPromise=require(_0x02e3('0x5'));var Mustache=require(_0x02e3('0x6'));var util=require(_0x02e3('0x7'));var path=require('path');var sox=require(_0x02e3('0x8'));var csv=require(_0x02e3('0x9'));var ejs=require(_0x02e3('0xa'));var fs=require('fs');var fs_extra=require(_0x02e3('0xb'));var _=require(_0x02e3('0xc'));var squel=require(_0x02e3('0xd'));var crypto=require('crypto');var jsforce=require(_0x02e3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x02e3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x02e3('0xf'));var authService=require(_0x02e3('0x10'));var qs=require(_0x02e3('0x11'));var as=require(_0x02e3('0x12'));var hardwareService=require(_0x02e3('0x13'));var logger=require(_0x02e3('0x14'))(_0x02e3('0x15'));var utils=require('../../config/utils');var config=require(_0x02e3('0x16'));var licenseUtil=require(_0x02e3('0x17'));var db=require(_0x02e3('0x18'))['db'];function respondWithStatusCode(_0x250839,_0x21bee1){_0x21bee1=_0x21bee1||0xcc;return function(_0x10e296){if(_0x10e296){return _0x250839[_0x02e3('0x19')](_0x21bee1);}return _0x250839[_0x02e3('0x1a')](_0x21bee1)[_0x02e3('0x1b')]();};}function respondWithResult(_0x3527a8,_0x3a7461){_0x3a7461=_0x3a7461||0xc8;return function(_0x55d574){if(_0x55d574){return _0x3527a8[_0x02e3('0x1a')](_0x3a7461)[_0x02e3('0x1c')](_0x55d574);}};}function respondWithFilteredResult(_0x1840b5,_0x599330){return function(_0xb20309){if(_0xb20309){var _0x204fa0=typeof _0x599330[_0x02e3('0x1d')]==='undefined'&&typeof _0x599330['limit']===_0x02e3('0x1e');var _0x35ac7e=_0xb20309[_0x02e3('0x1f')];var _0x626c61=_0x204fa0?0x0:_0x599330[_0x02e3('0x1d')];var _0x35e72f=_0x204fa0?_0xb20309[_0x02e3('0x1f')]:_0x599330[_0x02e3('0x1d')]+_0x599330[_0x02e3('0x20')];var _0x57e50b;if(_0x35e72f>=_0x35ac7e){_0x35e72f=_0x35ac7e;_0x57e50b=0xc8;}else{_0x57e50b=0xce;}_0x1840b5['status'](_0x57e50b);return _0x1840b5['set'](_0x02e3('0x21'),_0x626c61+'-'+_0x35e72f+'/'+_0x35ac7e)[_0x02e3('0x1c')](_0xb20309);}return null;};}function patchUpdates(_0x1e03e5){return function(_0x4d6f7e){try{jsonpatch[_0x02e3('0x22')](_0x4d6f7e,_0x1e03e5,!![]);}catch(_0xa2321b){return BPromise['reject'](_0xa2321b);}return _0x4d6f7e['save']();};}function saveUpdates(_0x31e4f8,_0x459cf){return function(_0x149a33){if(_0x149a33){return _0x149a33[_0x02e3('0x23')](_0x31e4f8)[_0x02e3('0x24')](function(_0x58392b){return _0x58392b;});}return null;};}function removeEntity(_0x36e6e1,_0x1f5922){return function(_0x4ab8e1){if(_0x4ab8e1){return _0x4ab8e1[_0x02e3('0x25')]()['then'](function(){_0x36e6e1[_0x02e3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4352c9,_0x23fe72){return function(_0x1bada9){if(!_0x1bada9){_0x4352c9[_0x02e3('0x19')](0x194);}return _0x1bada9;};}function handleError(_0x1fc8ed,_0x19e5b9){_0x19e5b9=_0x19e5b9||0x1f4;return function(_0x2f4901){logger[_0x02e3('0x26')](_0x2f4901[_0x02e3('0x27')]);if(_0x2f4901[_0x02e3('0x28')]){delete _0x2f4901[_0x02e3('0x28')];}_0x1fc8ed[_0x02e3('0x1a')](_0x19e5b9)[_0x02e3('0x29')](_0x2f4901);};}exports[_0x02e3('0x2a')]=function(_0x48a212,_0x354654){var _0x1acd6d={},_0x14525c={},_0xf49fc2={'count':0x0,'rows':[]};var _0x5c5faf=_[_0x02e3('0x2b')](db[_0x02e3('0x2c')][_0x02e3('0x2d')],function(_0x5897fa){return{'name':_0x5897fa[_0x02e3('0x2e')],'type':_0x5897fa[_0x02e3('0x2f')][_0x02e3('0x30')]};});_0x14525c['model']=_[_0x02e3('0x2b')](_0x5c5faf,_0x02e3('0x28'));_0x14525c[_0x02e3('0x31')]=_[_0x02e3('0x32')](_0x48a212[_0x02e3('0x31')]);_0x14525c[_0x02e3('0x33')]=_['intersection'](_0x14525c[_0x02e3('0x34')],_0x14525c['query']);_0x1acd6d[_0x02e3('0x35')]=_[_0x02e3('0x36')](_0x14525c[_0x02e3('0x34')],qs['fields'](_0x48a212[_0x02e3('0x31')][_0x02e3('0x37')]));_0x1acd6d[_0x02e3('0x35')]=_0x1acd6d[_0x02e3('0x35')][_0x02e3('0x38')]?_0x1acd6d[_0x02e3('0x35')]:_0x14525c[_0x02e3('0x34')];if(!_0x48a212[_0x02e3('0x31')]['hasOwnProperty'](_0x02e3('0x39'))){_0x1acd6d[_0x02e3('0x20')]=qs['limit'](_0x48a212[_0x02e3('0x31')][_0x02e3('0x20')]);_0x1acd6d['offset']=qs['offset'](_0x48a212[_0x02e3('0x31')][_0x02e3('0x1d')]);}_0x1acd6d['order']=qs['sort'](_0x48a212[_0x02e3('0x31')][_0x02e3('0x3a')]);_0x1acd6d['where']=qs[_0x02e3('0x33')](_['pick'](_0x48a212[_0x02e3('0x31')],_0x14525c[_0x02e3('0x33')]),_0x5c5faf);if(_0x48a212['query'][_0x02e3('0x3b')]){_0x1acd6d[_0x02e3('0x3c')]=_['merge'](_0x1acd6d[_0x02e3('0x3c')],{'$or':_[_0x02e3('0x2b')](_0x5c5faf,function(_0x1c7908){if(_0x1c7908[_0x02e3('0x2f')]!=='VIRTUAL'){var _0x2f2d3a={};_0x2f2d3a[_0x1c7908[_0x02e3('0x28')]]={'$like':'%'+_0x48a212[_0x02e3('0x31')]['filter']+'%'};return _0x2f2d3a;}})});}_0x1acd6d=_[_0x02e3('0x3d')]({},_0x1acd6d,_0x48a212['options']);var _0x175709={'where':_0x1acd6d[_0x02e3('0x3c')]};return db[_0x02e3('0x2c')][_0x02e3('0x1f')](_0x175709)[_0x02e3('0x24')](function(_0x337580){_0xf49fc2[_0x02e3('0x1f')]=_0x337580;if(_0x48a212[_0x02e3('0x31')]['includeAll']){_0x1acd6d[_0x02e3('0x3e')]=[{'all':!![]}];}return db[_0x02e3('0x2c')][_0x02e3('0x3f')](_0x1acd6d);})[_0x02e3('0x24')](function(_0x2f1509){_0xf49fc2['rows']=_0x2f1509;return _0xf49fc2;})[_0x02e3('0x24')](respondWithFilteredResult(_0x354654,_0x1acd6d))['catch'](handleError(_0x354654,null));};exports['show']=function(_0x474b9f,_0x264242){var _0x42d828={'raw':!![],'where':{'id':_0x474b9f[_0x02e3('0x40')]['id']}},_0x2c58f9={};_0x2c58f9[_0x02e3('0x34')]=_['keys'](db[_0x02e3('0x2c')][_0x02e3('0x2d')]);_0x2c58f9['query']=_[_0x02e3('0x32')](_0x474b9f['query']);_0x2c58f9['filters']=_[_0x02e3('0x36')](_0x2c58f9[_0x02e3('0x34')],_0x2c58f9[_0x02e3('0x31')]);_0x42d828['attributes']=_[_0x02e3('0x36')](_0x2c58f9[_0x02e3('0x34')],qs[_0x02e3('0x37')](_0x474b9f[_0x02e3('0x31')][_0x02e3('0x37')]));_0x42d828[_0x02e3('0x35')]=_0x42d828[_0x02e3('0x35')][_0x02e3('0x38')]?_0x42d828[_0x02e3('0x35')]:_0x2c58f9[_0x02e3('0x34')];if(_0x474b9f[_0x02e3('0x31')][_0x02e3('0x41')]){_0x42d828[_0x02e3('0x3e')]=[{'all':!![]}];}_0x42d828=_['merge']({},_0x42d828,_0x474b9f[_0x02e3('0x42')]);return db['MailSubstatus'][_0x02e3('0x43')](_0x42d828)[_0x02e3('0x24')](handleEntityNotFound(_0x264242,null))[_0x02e3('0x24')](respondWithResult(_0x264242,null))['catch'](handleError(_0x264242,null));};exports[_0x02e3('0x44')]=function(_0x21d817,_0x429256){return db['MailSubstatus'][_0x02e3('0x44')](_0x21d817['body'],{})[_0x02e3('0x24')](respondWithResult(_0x429256,0xc9))[_0x02e3('0x45')](handleError(_0x429256,null));};exports['update']=function(_0x469352,_0x3206fe){if(_0x469352[_0x02e3('0x46')]['id']){delete _0x469352[_0x02e3('0x46')]['id'];}return db[_0x02e3('0x2c')][_0x02e3('0x43')]({'where':{'id':_0x469352['params']['id']}})[_0x02e3('0x24')](handleEntityNotFound(_0x3206fe,null))['then'](saveUpdates(_0x469352[_0x02e3('0x46')],null))['then'](respondWithResult(_0x3206fe,null))[_0x02e3('0x45')](handleError(_0x3206fe,null));};exports['destroy']=function(_0x438e3b,_0x537d29){return db[_0x02e3('0x2c')][_0x02e3('0x43')]({'where':{'id':_0x438e3b[_0x02e3('0x40')]['id']}})[_0x02e3('0x24')](handleEntityNotFound(_0x537d29,null))[_0x02e3('0x24')](removeEntity(_0x537d29,null))[_0x02e3('0x45')](handleError(_0x537d29,null));};exports[_0x02e3('0x47')]=function(_0x209280,_0x2f51b2){return db['MailSubstatus'][_0x02e3('0x47')]()[_0x02e3('0x24')](respondWithResult(_0x2f51b2,null))[_0x02e3('0x45')](handleError(_0x2f51b2,null));}; \ No newline at end of file +var _0x2c9b=['includeAll','include','rows','catch','show','params','keys','intersection','length','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','key','map','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x45521d,_0x169dfe){var _0x24f9ed=function(_0x54a0e4){while(--_0x54a0e4){_0x45521d['push'](_0x45521d['shift']());}};_0x24f9ed(++_0x169dfe);}(_0x2c9b,0x12d));var _0xb2c9=function(_0x316a77,_0x345d09){_0x316a77=_0x316a77-0x0;var _0x3fb444=_0x2c9b[_0x316a77];return _0x3fb444;};'use strict';var emlformat=require(_0xb2c9('0x0'));var rimraf=require(_0xb2c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2c9('0x2'));var BPromise=require(_0xb2c9('0x3'));var Mustache=require(_0xb2c9('0x4'));var util=require(_0xb2c9('0x5'));var path=require(_0xb2c9('0x6'));var sox=require(_0xb2c9('0x7'));var csv=require('to-csv');var ejs=require(_0xb2c9('0x8'));var fs=require('fs');var fs_extra=require(_0xb2c9('0x9'));var _=require(_0xb2c9('0xa'));var squel=require(_0xb2c9('0xb'));var crypto=require(_0xb2c9('0xc'));var jsforce=require(_0xb2c9('0xd'));var deskjs=require(_0xb2c9('0xe'));var toCsv=require(_0xb2c9('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2c9('0x10'));var authService=require(_0xb2c9('0x11'));var qs=require(_0xb2c9('0x12'));var as=require(_0xb2c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2c9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb2c9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2c9('0x16'))['db'];function respondWithStatusCode(_0x1e5a47,_0x3c0f30){_0x3c0f30=_0x3c0f30||0xcc;return function(_0x3d8af2){if(_0x3d8af2){return _0x1e5a47[_0xb2c9('0x17')](_0x3c0f30);}return _0x1e5a47[_0xb2c9('0x18')](_0x3c0f30)[_0xb2c9('0x19')]();};}function respondWithResult(_0x283f73,_0x5a2dec){_0x5a2dec=_0x5a2dec||0xc8;return function(_0x55a0c9){if(_0x55a0c9){return _0x283f73[_0xb2c9('0x18')](_0x5a2dec)[_0xb2c9('0x1a')](_0x55a0c9);}};}function respondWithFilteredResult(_0x5e049f,_0x3ddd){return function(_0x2c120b){if(_0x2c120b){var _0x110f7a=typeof _0x3ddd[_0xb2c9('0x1b')]===_0xb2c9('0x1c')&&typeof _0x3ddd[_0xb2c9('0x1d')]==='undefined';var _0x3b5f57=_0x2c120b[_0xb2c9('0x1e')];var _0x4e6715=_0x110f7a?0x0:_0x3ddd[_0xb2c9('0x1b')];var _0x34a911=_0x110f7a?_0x2c120b[_0xb2c9('0x1e')]:_0x3ddd[_0xb2c9('0x1b')]+_0x3ddd[_0xb2c9('0x1d')];var _0x29e4d3;if(_0x34a911>=_0x3b5f57){_0x34a911=_0x3b5f57;_0x29e4d3=0xc8;}else{_0x29e4d3=0xce;}_0x5e049f['status'](_0x29e4d3);return _0x5e049f[_0xb2c9('0x1f')](_0xb2c9('0x20'),_0x4e6715+'-'+_0x34a911+'/'+_0x3b5f57)[_0xb2c9('0x1a')](_0x2c120b);}return null;};}function patchUpdates(_0x63ff34){return function(_0x21b5d4){try{jsonpatch['apply'](_0x21b5d4,_0x63ff34,!![]);}catch(_0x298756){return BPromise['reject'](_0x298756);}return _0x21b5d4['save']();};}function saveUpdates(_0xf287c,_0x1f8a97){return function(_0x29330d){if(_0x29330d){return _0x29330d[_0xb2c9('0x21')](_0xf287c)[_0xb2c9('0x22')](function(_0x551b42){return _0x551b42;});}return null;};}function removeEntity(_0x35414b,_0x50e356){return function(_0x50193a){if(_0x50193a){return _0x50193a[_0xb2c9('0x23')]()[_0xb2c9('0x22')](function(){_0x35414b[_0xb2c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3967ff,_0x467576){return function(_0x111c4c){if(!_0x111c4c){_0x3967ff['sendStatus'](0x194);}return _0x111c4c;};}function handleError(_0x43f6bd,_0x348917){_0x348917=_0x348917||0x1f4;return function(_0x213d3e){logger[_0xb2c9('0x24')](_0x213d3e[_0xb2c9('0x25')]);if(_0x213d3e[_0xb2c9('0x26')]){delete _0x213d3e[_0xb2c9('0x26')];}_0x43f6bd[_0xb2c9('0x18')](_0x348917)['send'](_0x213d3e);};}exports[_0xb2c9('0x27')]=function(_0x541842,_0x4a2ff2){var _0x5ecbc1={},_0x205660={},_0x4f68db={'count':0x0,'rows':[]};var _0x569690=_['map'](db[_0xb2c9('0x28')][_0xb2c9('0x29')],function(_0x468531){return{'name':_0x468531[_0xb2c9('0x2a')],'type':_0x468531['type'][_0xb2c9('0x2b')]};});_0x205660['model']=_[_0xb2c9('0x2c')](_0x569690,_0xb2c9('0x26'));_0x205660[_0xb2c9('0x2d')]=_['keys'](_0x541842['query']);_0x205660[_0xb2c9('0x2e')]=_['intersection'](_0x205660[_0xb2c9('0x2f')],_0x205660['query']);_0x5ecbc1[_0xb2c9('0x30')]=_['intersection'](_0x205660['model'],qs['fields'](_0x541842['query'][_0xb2c9('0x31')]));_0x5ecbc1[_0xb2c9('0x30')]=_0x5ecbc1[_0xb2c9('0x30')]['length']?_0x5ecbc1[_0xb2c9('0x30')]:_0x205660[_0xb2c9('0x2f')];if(!_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x32')](_0xb2c9('0x33'))){_0x5ecbc1[_0xb2c9('0x1d')]=qs[_0xb2c9('0x1d')](_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x1d')]);_0x5ecbc1[_0xb2c9('0x1b')]=qs[_0xb2c9('0x1b')](_0x541842['query']['offset']);}_0x5ecbc1[_0xb2c9('0x34')]=qs[_0xb2c9('0x35')](_0x541842['query'][_0xb2c9('0x35')]);_0x5ecbc1[_0xb2c9('0x36')]=qs['filters'](_[_0xb2c9('0x37')](_0x541842[_0xb2c9('0x2d')],_0x205660[_0xb2c9('0x2e')]),_0x569690);if(_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x38')]){_0x5ecbc1['where']=_[_0xb2c9('0x39')](_0x5ecbc1[_0xb2c9('0x36')],{'$or':_[_0xb2c9('0x2c')](_0x569690,function(_0x325c8d){if(_0x325c8d['type']!=='VIRTUAL'){var _0x15e6d5={};_0x15e6d5[_0x325c8d[_0xb2c9('0x26')]]={'$like':'%'+_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x38')]+'%'};return _0x15e6d5;}})});}_0x5ecbc1=_[_0xb2c9('0x39')]({},_0x5ecbc1,_0x541842[_0xb2c9('0x3a')]);var _0x1e207a={'where':_0x5ecbc1[_0xb2c9('0x36')]};return db[_0xb2c9('0x28')][_0xb2c9('0x1e')](_0x1e207a)[_0xb2c9('0x22')](function(_0x544652){_0x4f68db[_0xb2c9('0x1e')]=_0x544652;if(_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x3b')]){_0x5ecbc1[_0xb2c9('0x3c')]=[{'all':!![]}];}return db[_0xb2c9('0x28')]['findAll'](_0x5ecbc1);})[_0xb2c9('0x22')](function(_0x45c76d){_0x4f68db[_0xb2c9('0x3d')]=_0x45c76d;return _0x4f68db;})[_0xb2c9('0x22')](respondWithFilteredResult(_0x4a2ff2,_0x5ecbc1))[_0xb2c9('0x3e')](handleError(_0x4a2ff2,null));};exports[_0xb2c9('0x3f')]=function(_0x271dd6,_0x40c1f6){var _0x29b485={'raw':!![],'where':{'id':_0x271dd6[_0xb2c9('0x40')]['id']}},_0x12d26e={};_0x12d26e['model']=_[_0xb2c9('0x41')](db[_0xb2c9('0x28')]['rawAttributes']);_0x12d26e['query']=_[_0xb2c9('0x41')](_0x271dd6[_0xb2c9('0x2d')]);_0x12d26e['filters']=_['intersection'](_0x12d26e[_0xb2c9('0x2f')],_0x12d26e['query']);_0x29b485[_0xb2c9('0x30')]=_[_0xb2c9('0x42')](_0x12d26e[_0xb2c9('0x2f')],qs[_0xb2c9('0x31')](_0x271dd6['query']['fields']));_0x29b485['attributes']=_0x29b485['attributes'][_0xb2c9('0x43')]?_0x29b485[_0xb2c9('0x30')]:_0x12d26e[_0xb2c9('0x2f')];if(_0x271dd6[_0xb2c9('0x2d')][_0xb2c9('0x3b')]){_0x29b485['include']=[{'all':!![]}];}_0x29b485=_['merge']({},_0x29b485,_0x271dd6[_0xb2c9('0x3a')]);return db['MailSubstatus'][_0xb2c9('0x44')](_0x29b485)[_0xb2c9('0x22')](handleEntityNotFound(_0x40c1f6,null))[_0xb2c9('0x22')](respondWithResult(_0x40c1f6,null))[_0xb2c9('0x3e')](handleError(_0x40c1f6,null));};exports[_0xb2c9('0x45')]=function(_0x4130a9,_0x221abd){return db[_0xb2c9('0x28')][_0xb2c9('0x45')](_0x4130a9[_0xb2c9('0x46')],{})[_0xb2c9('0x22')](respondWithResult(_0x221abd,0xc9))[_0xb2c9('0x3e')](handleError(_0x221abd,null));};exports[_0xb2c9('0x21')]=function(_0x4211cd,_0x3f160c){if(_0x4211cd[_0xb2c9('0x46')]['id']){delete _0x4211cd['body']['id'];}return db[_0xb2c9('0x28')][_0xb2c9('0x44')]({'where':{'id':_0x4211cd[_0xb2c9('0x40')]['id']}})[_0xb2c9('0x22')](handleEntityNotFound(_0x3f160c,null))[_0xb2c9('0x22')](saveUpdates(_0x4211cd['body'],null))[_0xb2c9('0x22')](respondWithResult(_0x3f160c,null))[_0xb2c9('0x3e')](handleError(_0x3f160c,null));};exports[_0xb2c9('0x23')]=function(_0x25c748,_0x3100d9){return db['MailSubstatus'][_0xb2c9('0x44')]({'where':{'id':_0x25c748[_0xb2c9('0x40')]['id']}})[_0xb2c9('0x22')](handleEntityNotFound(_0x3100d9,null))['then'](removeEntity(_0x3100d9,null))['catch'](handleError(_0x3100d9,null));};exports[_0xb2c9('0x47')]=function(_0x11baec,_0x354026){return db[_0xb2c9('0x28')][_0xb2c9('0x47')]()[_0xb2c9('0x22')](respondWithResult(_0x354026,null))[_0xb2c9('0x3e')](handleError(_0x354026,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a9f69b7..1e0ea93 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d65=['emit','hasOwnProperty','hook','exports','MailSubstatus','setMaxListeners','update'];(function(_0x3e1b48,_0x542b14){var _0x5b756d=function(_0x1c38c6){while(--_0x1c38c6){_0x3e1b48['push'](_0x3e1b48['shift']());}};_0x5b756d(++_0x542b14);}(_0x9d65,0x18c));var _0x59d6=function(_0x182af5,_0x2fb4bc){_0x182af5=_0x182af5-0x0;var _0x104988=_0x9d65[_0x182af5];return _0x104988;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x59d6('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x59d6('0x1')](0x0);var events={'afterUpdate':_0x59d6('0x2')};function emitEvent(_0x3f70e1){return function(_0x5b82eb,_0x55794e,_0x899527){MailSubstatusEvents['emit'](_0x3f70e1+':'+_0x5b82eb['id'],_0x5b82eb);MailSubstatusEvents[_0x59d6('0x3')](_0x3f70e1,_0x5b82eb);_0x899527(null);};}for(var e in events){if(events[_0x59d6('0x4')](e)){var event=events[e];MailSubstatus[_0x59d6('0x5')](e,emitEvent(event));}}module[_0x59d6('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x2ed8=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x2ed8,0xce));var _0x82ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ed8[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x82ed('0x0'))['db'][_0x82ed('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x82ed('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4dadf8){return function(_0x1f64fb,_0x2a7ed1,_0x56ebbc){MailSubstatusEvents[_0x82ed('0x3')](_0x4dadf8+':'+_0x1f64fb['id'],_0x1f64fb);MailSubstatusEvents['emit'](_0x4dadf8,_0x1f64fb);_0x56ebbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x82ed('0x4')](e,emitEvent(event));}}module[_0x82ed('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4365e52..87ba322 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 _0x56c0=['mailSubstatus','_previousDataValues','exports','mail_substatuses','update','name'];(function(_0x8cb724,_0x5e78d5){var _0x348d6f=function(_0x7b70ea){while(--_0x7b70ea){_0x8cb724['push'](_0x8cb724['shift']());}};_0x348d6f(++_0x5e78d5);}(_0x56c0,0x68));var _0x056c=function(_0x56bc67,_0x463fc1){_0x56bc67=_0x56bc67-0x0;var _0x5c442f=_0x56c0[_0x56bc67];return _0x5c442f;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x056c('0x0')]=function(_0x593287){var _0x36ced2=_0x593287['models'];return _0x593287['define']('MailSubstatus',attributes,{'tableName':_0x056c('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x13c0b3,_0x4a795f,_0x13ed9e){return _0x36ced2['Condition'][_0x056c('0x2')]({'value':_0x13c0b3[_0x056c('0x3')]},{'where':{'field':_0x056c('0x4'),'value':_0x13c0b3[_0x056c('0x5')][_0x056c('0x3')]}})['then'](function(){_0x13ed9e();})['catch'](function(_0x481bca){_0x13ed9e(_0x481bca);});}}});}; \ No newline at end of file +var _0x0fdc=['define','mail_substatuses','Condition','update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','models'];(function(_0x2dfcff,_0x3025d6){var _0x48eacd=function(_0x4f93ba){while(--_0x4f93ba){_0x2dfcff['push'](_0x2dfcff['shift']());}};_0x48eacd(++_0x3025d6);}(_0x0fdc,0x18d));var _0xc0fd=function(_0x2655de,_0x281ede){_0x2655de=_0x2655de-0x0;var _0x2d62cd=_0x0fdc[_0x2655de];return _0x2d62cd;};'use strict';var attributes=require(_0xc0fd('0x0'));module[_0xc0fd('0x1')]=function(_0x37ae50){var _0x1e475f=_0x37ae50[_0xc0fd('0x2')];return _0x37ae50[_0xc0fd('0x3')]('MailSubstatus',attributes,{'tableName':_0xc0fd('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x30062e,_0x17588b,_0x40f73d){return _0x1e475f[_0xc0fd('0x5')][_0xc0fd('0x6')]({'value':_0x30062e[_0xc0fd('0x7')]},{'where':{'field':_0xc0fd('0x8'),'value':_0x30062e['_previousDataValues'][_0xc0fd('0x7')]}})['then'](function(){_0x40f73d();})[_0xc0fd('0x9')](function(_0x43eb03){_0x40f73d(_0x43eb03);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ccce7c4..f1889b7 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 _0xaeaf=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e4aa6,_0x4d0f16){var _0x159c61=function(_0x434060){while(--_0x434060){_0x5e4aa6['push'](_0x5e4aa6['shift']());}};_0x159c61(++_0x4d0f16);}(_0xaeaf,0x14e));var _0xfaea=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xaeaf[_0x4a45b4];return _0x1a99c9;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var moment=require(_0xfaea('0x2'));var BPromise=require(_0xfaea('0x3'));var rs=require(_0xfaea('0x4'));var fs=require('fs');var Redis=require(_0xfaea('0x5'));var db=require(_0xfaea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaea('0x7'))(_0xfaea('0x8'));var config=require(_0xfaea('0x9'));var jayson=require(_0xfaea('0xa'));var client=jayson['client'][_0xfaea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b45c,_0x26263e,_0x3a3646){return new BPromise(function(_0x26176e,_0x4fcefe){return client[_0xfaea('0xc')](_0x45b45c,_0x3a3646)[_0xfaea('0xd')](function(_0x5d1dd2){logger[_0xfaea('0xe')](_0xfaea('0xf'),_0x26263e,_0xfaea('0x10'));logger['debug'](_0xfaea('0x11'),_0x26263e,_0xfaea('0x10'),JSON[_0xfaea('0x12')](_0x5d1dd2));if(_0x5d1dd2['error']){if(_0x5d1dd2[_0xfaea('0x13')][_0xfaea('0x14')]===0x1f4){logger[_0xfaea('0x13')](_0xfaea('0xf'),_0x26263e,_0x5d1dd2[_0xfaea('0x13')]['message']);return _0x4fcefe(_0x5d1dd2[_0xfaea('0x13')]['message']);}logger[_0xfaea('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x26263e,_0x5d1dd2[_0xfaea('0x13')][_0xfaea('0x15')]);return _0x26176e(_0x5d1dd2['error'][_0xfaea('0x15')]);}else{logger[_0xfaea('0xe')](_0xfaea('0xf'),_0x26263e,_0xfaea('0x10'));_0x26176e(_0x5d1dd2[_0xfaea('0x16')]['message']);}})['catch'](function(_0xc2a588){logger[_0xfaea('0x13')](_0xfaea('0xf'),_0x26263e,_0xc2a588);_0x4fcefe(_0xc2a588);});});} \ No newline at end of file +var _0x8ba0=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x555434,_0x95d8fb){_0x555434=_0x555434-0x0;var _0x21c04f=_0x8ba0[_0x555434];return _0x21c04f;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var moment=require(_0x08ba('0x2'));var BPromise=require(_0x08ba('0x3'));var rs=require(_0x08ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08ba('0x5'));var logger=require(_0x08ba('0x6'))(_0x08ba('0x7'));var config=require(_0x08ba('0x8'));var jayson=require(_0x08ba('0x9'));var client=jayson[_0x08ba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235354,_0x11f6a1,_0x37bcdf){return new BPromise(function(_0x451f15,_0x1f6051){return client['request'](_0x235354,_0x37bcdf)[_0x08ba('0xb')](function(_0x5eb94f){logger[_0x08ba('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x11f6a1,_0x08ba('0xd'));logger[_0x08ba('0xe')](_0x08ba('0xf'),_0x11f6a1,_0x08ba('0xd'),JSON[_0x08ba('0x10')](_0x5eb94f));if(_0x5eb94f[_0x08ba('0x11')]){if(_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x12')]===0x1f4){logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x1f6051(_0x5eb94f['error'][_0x08ba('0x14')]);}logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x451f15(_0x5eb94f[_0x08ba('0x11')]['message']);}else{logger[_0x08ba('0xc')](_0x08ba('0x13'),_0x11f6a1,_0x08ba('0xd'));_0x451f15(_0x5eb94f[_0x08ba('0x15')][_0x08ba('0x14')]);}})['catch'](function(_0x4b5a04){logger[_0x08ba('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x11f6a1,_0x4b5a04);_0x1f6051(_0x4b5a04);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 60b2bd8..8e25613 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 _0x0442=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x22fc1c,_0x3b5187){var _0x4e5518=function(_0x3c34ad){while(--_0x3c34ad){_0x22fc1c['push'](_0x22fc1c['shift']());}};_0x4e5518(++_0x3b5187);}(_0x0442,0x15d));var _0x2044=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x0442[_0x45ce08];return _0x23dff2;};'use strict';var multer=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var path=require(_0x2044('0x2'));var timeout=require(_0x2044('0x3'));var express=require(_0x2044('0x4'));var router=express[_0x2044('0x5')]();var fs_extra=require(_0x2044('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2044('0x7'));var config=require(_0x2044('0x8'));var controller=require(_0x2044('0x9'));router[_0x2044('0xa')]('/',auth[_0x2044('0xb')](),controller[_0x2044('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x2044('0xd'),auth[_0x2044('0xb')](),controller['show']);router[_0x2044('0xe')]('/',auth[_0x2044('0xb')](),controller[_0x2044('0xf')]);router[_0x2044('0x10')](_0x2044('0xd'),auth[_0x2044('0xb')](),controller[_0x2044('0x11')]);router[_0x2044('0x12')](_0x2044('0xd'),auth['isAuthenticated'](),controller[_0x2044('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe06a=['/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','create','update'];(function(_0x3e1be4,_0x3961d9){var _0x33eafc=function(_0x5572d5){while(--_0x5572d5){_0x3e1be4['push'](_0x3e1be4['shift']());}};_0x33eafc(++_0x3961d9);}(_0xe06a,0x11f));var _0xae06=function(_0x3c7adb,_0x7d489d){_0x3c7adb=_0x3c7adb-0x0;var _0x1b45f6=_0xe06a[_0x3c7adb];return _0x1b45f6;};'use strict';var multer=require(_0xae06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae06('0x1'));var express=require(_0xae06('0x2'));var router=express[_0xae06('0x3')]();var fs_extra=require(_0xae06('0x4'));var auth=require(_0xae06('0x5'));var interaction=require(_0xae06('0x6'));var config=require(_0xae06('0x7'));var controller=require(_0xae06('0x8'));router[_0xae06('0x9')]('/',auth['isAuthenticated'](),controller[_0xae06('0xa')]);router[_0xae06('0x9')](_0xae06('0xb'),auth[_0xae06('0xc')](),controller[_0xae06('0xd')]);router['get']('/:id',auth[_0xae06('0xc')](),controller[_0xae06('0xe')]);router['post']('/',auth[_0xae06('0xc')](),controller[_0xae06('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xae06('0x10')]);router['delete'](_0xae06('0x11'),auth[_0xae06('0xc')](),controller[_0xae06('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6a73a0c..5fa8fa2 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x540aee,_0x205191){var _0x524f8c=function(_0x22e9de){while(--_0x22e9de){_0x540aee['push'](_0x540aee['shift']());}};_0x524f8c(++_0x205191);}(_0x70e0,0x17b));var _0x070e=function(_0x31ee94,_0x2ae508){_0x31ee94=_0x31ee94-0x0;var _0x1faa39=_0x70e0[_0x31ee94];return _0x1faa39;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xb43b,0x1b2));var _0xbb43=function(_0x29475f,_0x39e8e9){_0x29475f=_0x29475f-0x0;var _0x5411cb=_0xb43b[_0x29475f];return _0x5411cb;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1385ed8..8014a2b 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 _0x40bb=['nolimit','sort','filters','pick','where','type','VIRTUAL','merge','options','includeAll','findAll','show','params','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x116f37,_0x13d9ae){var _0x52d6fa=function(_0x14b158){while(--_0x14b158){_0x116f37['push'](_0x116f37['shift']());}};_0x52d6fa(++_0x13d9ae);}(_0x40bb,0x1c1));var _0xb40b=function(_0x91a7b9,_0x72d1ba){_0x91a7b9=_0x91a7b9-0x0;var _0x4b9ce0=_0x40bb[_0x91a7b9];return _0x4b9ce0;};'use strict';var emlformat=require(_0xb40b('0x0'));var rimraf=require(_0xb40b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb40b('0x2'));var rp=require(_0xb40b('0x3'));var moment=require(_0xb40b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb40b('0x5'));var util=require(_0xb40b('0x6'));var path=require(_0xb40b('0x7'));var sox=require(_0xb40b('0x8'));var csv=require('to-csv');var ejs=require(_0xb40b('0x9'));var fs=require('fs');var fs_extra=require(_0xb40b('0xa'));var _=require(_0xb40b('0xb'));var squel=require(_0xb40b('0xc'));var crypto=require(_0xb40b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb40b('0xe'));var toCsv=require(_0xb40b('0xf'));var querystring=require('querystring');var Papa=require(_0xb40b('0x10'));var Redis=require(_0xb40b('0x11'));var authService=require(_0xb40b('0x12'));var qs=require(_0xb40b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb40b('0x14'));var config=require(_0xb40b('0x15'));var licenseUtil=require(_0xb40b('0x16'));var db=require(_0xb40b('0x17'))['db'];function respondWithStatusCode(_0x2305ae,_0xa24b93){_0xa24b93=_0xa24b93||0xcc;return function(_0x12ac5d){if(_0x12ac5d){return _0x2305ae[_0xb40b('0x18')](_0xa24b93);}return _0x2305ae['status'](_0xa24b93)[_0xb40b('0x19')]();};}function respondWithResult(_0x463680,_0x647c7e){_0x647c7e=_0x647c7e||0xc8;return function(_0x16eae8){if(_0x16eae8){return _0x463680[_0xb40b('0x1a')](_0x647c7e)['json'](_0x16eae8);}};}function respondWithFilteredResult(_0x1bdd90,_0x3db786){return function(_0x1bd93c){if(_0x1bd93c){var _0x3d3e15=typeof _0x3db786[_0xb40b('0x1b')]===_0xb40b('0x1c')&&typeof _0x3db786[_0xb40b('0x1d')]===_0xb40b('0x1c');var _0x2723dc=_0x1bd93c[_0xb40b('0x1e')];var _0x938104=_0x3d3e15?0x0:_0x3db786[_0xb40b('0x1b')];var _0x24be47=_0x3d3e15?_0x1bd93c[_0xb40b('0x1e')]:_0x3db786[_0xb40b('0x1b')]+_0x3db786[_0xb40b('0x1d')];var _0x436868;if(_0x24be47>=_0x2723dc){_0x24be47=_0x2723dc;_0x436868=0xc8;}else{_0x436868=0xce;}_0x1bdd90[_0xb40b('0x1a')](_0x436868);return _0x1bdd90[_0xb40b('0x1f')](_0xb40b('0x20'),_0x938104+'-'+_0x24be47+'/'+_0x2723dc)[_0xb40b('0x21')](_0x1bd93c);}return null;};}function patchUpdates(_0x1ad80a){return function(_0x5473d4){try{jsonpatch[_0xb40b('0x22')](_0x5473d4,_0x1ad80a,!![]);}catch(_0x113751){return BPromise[_0xb40b('0x23')](_0x113751);}return _0x5473d4['save']();};}function saveUpdates(_0x402e34,_0x20b045){return function(_0x522a2d){if(_0x522a2d){return _0x522a2d[_0xb40b('0x24')](_0x402e34)[_0xb40b('0x25')](function(_0x17de49){return _0x17de49;});}return null;};}function removeEntity(_0x7a4b47,_0x86f3c3){return function(_0x2ae938){if(_0x2ae938){return _0x2ae938[_0xb40b('0x26')]()[_0xb40b('0x25')](function(){_0x7a4b47[_0xb40b('0x1a')](0xcc)[_0xb40b('0x19')]();});}};}function handleEntityNotFound(_0x24bab5,_0x19fb02){return function(_0x58cf77){if(!_0x58cf77){_0x24bab5['sendStatus'](0x194);}return _0x58cf77;};}function handleError(_0x3da70b,_0x36b332){_0x36b332=_0x36b332||0x1f4;return function(_0x2b08b0){logger[_0xb40b('0x27')](_0x2b08b0[_0xb40b('0x28')]);if(_0x2b08b0['name']){delete _0x2b08b0[_0xb40b('0x29')];}_0x3da70b[_0xb40b('0x1a')](_0x36b332)['send'](_0x2b08b0);};}exports[_0xb40b('0x2a')]=function(_0x78374a,_0x5db922){var _0x353fcf={},_0x3eb643={},_0x7c337f={'count':0x0,'rows':[]};var _0x3e0a8d=_[_0xb40b('0x2b')](db[_0xb40b('0x2c')][_0xb40b('0x2d')],function(_0x5a2292){return{'name':_0x5a2292[_0xb40b('0x2e')],'type':_0x5a2292['type'][_0xb40b('0x2f')]};});_0x3eb643[_0xb40b('0x30')]=_[_0xb40b('0x2b')](_0x3e0a8d,'name');_0x3eb643[_0xb40b('0x31')]=_[_0xb40b('0x32')](_0x78374a['query']);_0x3eb643['filters']=_[_0xb40b('0x33')](_0x3eb643[_0xb40b('0x30')],_0x3eb643[_0xb40b('0x31')]);_0x353fcf[_0xb40b('0x34')]=_[_0xb40b('0x33')](_0x3eb643['model'],qs[_0xb40b('0x35')](_0x78374a[_0xb40b('0x31')][_0xb40b('0x35')]));_0x353fcf['attributes']=_0x353fcf[_0xb40b('0x34')][_0xb40b('0x36')]?_0x353fcf[_0xb40b('0x34')]:_0x3eb643[_0xb40b('0x30')];if(!_0x78374a[_0xb40b('0x31')]['hasOwnProperty'](_0xb40b('0x37'))){_0x353fcf[_0xb40b('0x1d')]=qs[_0xb40b('0x1d')](_0x78374a[_0xb40b('0x31')][_0xb40b('0x1d')]);_0x353fcf[_0xb40b('0x1b')]=qs[_0xb40b('0x1b')](_0x78374a[_0xb40b('0x31')][_0xb40b('0x1b')]);}_0x353fcf['order']=qs[_0xb40b('0x38')](_0x78374a[_0xb40b('0x31')][_0xb40b('0x38')]);_0x353fcf['where']=qs[_0xb40b('0x39')](_[_0xb40b('0x3a')](_0x78374a[_0xb40b('0x31')],_0x3eb643[_0xb40b('0x39')]),_0x3e0a8d);if(_0x78374a[_0xb40b('0x31')]['filter']){_0x353fcf[_0xb40b('0x3b')]=_['merge'](_0x353fcf[_0xb40b('0x3b')],{'$or':_[_0xb40b('0x2b')](_0x3e0a8d,function(_0x4f19b1){if(_0x4f19b1[_0xb40b('0x3c')]!==_0xb40b('0x3d')){var _0x54e4ca={};_0x54e4ca[_0x4f19b1[_0xb40b('0x29')]]={'$like':'%'+_0x78374a[_0xb40b('0x31')]['filter']+'%'};return _0x54e4ca;}})});}_0x353fcf=_[_0xb40b('0x3e')]({},_0x353fcf,_0x78374a[_0xb40b('0x3f')]);var _0x5f4549={'where':_0x353fcf[_0xb40b('0x3b')]};return db['MailTransferReport']['count'](_0x5f4549)[_0xb40b('0x25')](function(_0x6d1455){_0x7c337f[_0xb40b('0x1e')]=_0x6d1455;if(_0x78374a[_0xb40b('0x31')][_0xb40b('0x40')]){_0x353fcf['include']=[{'all':!![]}];}return db[_0xb40b('0x2c')][_0xb40b('0x41')](_0x353fcf);})[_0xb40b('0x25')](function(_0x28dbfd){_0x7c337f['rows']=_0x28dbfd;return _0x7c337f;})['then'](respondWithFilteredResult(_0x5db922,_0x353fcf))['catch'](handleError(_0x5db922,null));};exports[_0xb40b('0x42')]=function(_0x2c07da,_0x3a1b93){var _0x4ccd32={'raw':!![],'where':{'id':_0x2c07da[_0xb40b('0x43')]['id']}},_0x20053f={};_0x20053f[_0xb40b('0x30')]=_[_0xb40b('0x32')](db[_0xb40b('0x2c')]['rawAttributes']);_0x20053f[_0xb40b('0x31')]=_[_0xb40b('0x32')](_0x2c07da[_0xb40b('0x31')]);_0x20053f[_0xb40b('0x39')]=_[_0xb40b('0x33')](_0x20053f[_0xb40b('0x30')],_0x20053f[_0xb40b('0x31')]);_0x4ccd32[_0xb40b('0x34')]=_['intersection'](_0x20053f['model'],qs[_0xb40b('0x35')](_0x2c07da[_0xb40b('0x31')][_0xb40b('0x35')]));_0x4ccd32[_0xb40b('0x34')]=_0x4ccd32[_0xb40b('0x34')][_0xb40b('0x36')]?_0x4ccd32[_0xb40b('0x34')]:_0x20053f[_0xb40b('0x30')];if(_0x2c07da[_0xb40b('0x31')]['includeAll']){_0x4ccd32['include']=[{'all':!![]}];}_0x4ccd32=_[_0xb40b('0x3e')]({},_0x4ccd32,_0x2c07da['options']);return db[_0xb40b('0x2c')]['find'](_0x4ccd32)['then'](handleEntityNotFound(_0x3a1b93,null))[_0xb40b('0x25')](respondWithResult(_0x3a1b93,null))['catch'](handleError(_0x3a1b93,null));};exports[_0xb40b('0x44')]=function(_0x3287a7,_0x27e0c6){return db[_0xb40b('0x2c')]['create'](_0x3287a7[_0xb40b('0x45')],{})['then'](respondWithResult(_0x27e0c6,0xc9))[_0xb40b('0x46')](handleError(_0x27e0c6,null));};exports[_0xb40b('0x24')]=function(_0x5e4406,_0x408bb0){if(_0x5e4406[_0xb40b('0x45')]['id']){delete _0x5e4406[_0xb40b('0x45')]['id'];}return db[_0xb40b('0x2c')]['find']({'where':{'id':_0x5e4406[_0xb40b('0x43')]['id']}})['then'](handleEntityNotFound(_0x408bb0,null))['then'](saveUpdates(_0x5e4406[_0xb40b('0x45')],null))[_0xb40b('0x25')](respondWithResult(_0x408bb0,null))['catch'](handleError(_0x408bb0,null));};exports['destroy']=function(_0x295fa2,_0x44373c){return db['MailTransferReport']['find']({'where':{'id':_0x295fa2[_0xb40b('0x43')]['id']}})['then'](handleEntityNotFound(_0x44373c,null))[_0xb40b('0x25')](removeEntity(_0x44373c,null))[_0xb40b('0x46')](handleError(_0x44373c,null));};exports['describe']=function(_0x3be43d,_0x263fc9){return db[_0xb40b('0x2c')][_0xb40b('0x47')]()['then'](respondWithResult(_0x263fc9,null))[_0xb40b('0x46')](handleError(_0x263fc9,null));}; \ No newline at end of file +var _0xcf76=['eml-format','zip-dir','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','options','MailTransferReport','includeAll','include','findAll','rows','params','find','catch','create','body','describe'];(function(_0x1a723e,_0x25b9af){var _0x3958d6=function(_0x344f1a){while(--_0x344f1a){_0x1a723e['push'](_0x1a723e['shift']());}};_0x3958d6(++_0x25b9af);}(_0xcf76,0xd8));var _0x6cf7=function(_0x163864,_0x5e48ef){_0x163864=_0x163864-0x0;var _0x3e1c19=_0xcf76[_0x163864];return _0x3e1c19;};'use strict';var emlformat=require(_0x6cf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cf7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6cf7('0x2'));var BPromise=require(_0x6cf7('0x3'));var Mustache=require('mustache');var util=require(_0x6cf7('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cf7('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cf7('0x6'));var squel=require(_0x6cf7('0x7'));var crypto=require(_0x6cf7('0x8'));var jsforce=require(_0x6cf7('0x9'));var deskjs=require(_0x6cf7('0xa'));var toCsv=require(_0x6cf7('0xb'));var querystring=require(_0x6cf7('0xc'));var Papa=require('papaparse');var Redis=require(_0x6cf7('0xd'));var authService=require(_0x6cf7('0xe'));var qs=require(_0x6cf7('0xf'));var as=require(_0x6cf7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6cf7('0x11'))(_0x6cf7('0x12'));var utils=require(_0x6cf7('0x13'));var config=require(_0x6cf7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cf7('0x15'))['db'];function respondWithStatusCode(_0x97dbde,_0x5841a2){_0x5841a2=_0x5841a2||0xcc;return function(_0xa7d2a2){if(_0xa7d2a2){return _0x97dbde[_0x6cf7('0x16')](_0x5841a2);}return _0x97dbde['status'](_0x5841a2)[_0x6cf7('0x17')]();};}function respondWithResult(_0x50b98a,_0x49e699){_0x49e699=_0x49e699||0xc8;return function(_0x570fda){if(_0x570fda){return _0x50b98a['status'](_0x49e699)[_0x6cf7('0x18')](_0x570fda);}};}function respondWithFilteredResult(_0x486794,_0x207dc5){return function(_0x27a37d){if(_0x27a37d){var _0xa9ee72=typeof _0x207dc5[_0x6cf7('0x19')]===_0x6cf7('0x1a')&&typeof _0x207dc5[_0x6cf7('0x1b')]===_0x6cf7('0x1a');var _0x1ec936=_0x27a37d[_0x6cf7('0x1c')];var _0x5a91ae=_0xa9ee72?0x0:_0x207dc5[_0x6cf7('0x19')];var _0x3f73ce=_0xa9ee72?_0x27a37d[_0x6cf7('0x1c')]:_0x207dc5[_0x6cf7('0x19')]+_0x207dc5[_0x6cf7('0x1b')];var _0x22b70a;if(_0x3f73ce>=_0x1ec936){_0x3f73ce=_0x1ec936;_0x22b70a=0xc8;}else{_0x22b70a=0xce;}_0x486794['status'](_0x22b70a);return _0x486794[_0x6cf7('0x1d')](_0x6cf7('0x1e'),_0x5a91ae+'-'+_0x3f73ce+'/'+_0x1ec936)['json'](_0x27a37d);}return null;};}function patchUpdates(_0x190cf8){return function(_0x379b0c){try{jsonpatch[_0x6cf7('0x1f')](_0x379b0c,_0x190cf8,!![]);}catch(_0x33667f){return BPromise[_0x6cf7('0x20')](_0x33667f);}return _0x379b0c[_0x6cf7('0x21')]();};}function saveUpdates(_0x1e533b,_0x361201){return function(_0x88c5c7){if(_0x88c5c7){return _0x88c5c7[_0x6cf7('0x22')](_0x1e533b)[_0x6cf7('0x23')](function(_0x13d603){return _0x13d603;});}return null;};}function removeEntity(_0x30f97c,_0x1c2da0){return function(_0x2c4c85){if(_0x2c4c85){return _0x2c4c85[_0x6cf7('0x24')]()[_0x6cf7('0x23')](function(){_0x30f97c[_0x6cf7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3623ce,_0x5c07db){return function(_0x3ac266){if(!_0x3ac266){_0x3623ce['sendStatus'](0x194);}return _0x3ac266;};}function handleError(_0x259fd9,_0x2c1346){_0x2c1346=_0x2c1346||0x1f4;return function(_0x9f5151){logger['error'](_0x9f5151[_0x6cf7('0x26')]);if(_0x9f5151[_0x6cf7('0x27')]){delete _0x9f5151[_0x6cf7('0x27')];}_0x259fd9[_0x6cf7('0x25')](_0x2c1346)[_0x6cf7('0x28')](_0x9f5151);};}exports[_0x6cf7('0x29')]=function(_0x87d2d,_0x4dcf00){var _0x201071={},_0x334b7e={},_0x51ba47={'count':0x0,'rows':[]};var _0x560ebb=_[_0x6cf7('0x2a')](db['MailTransferReport'][_0x6cf7('0x2b')],function(_0x449847){return{'name':_0x449847['fieldName'],'type':_0x449847[_0x6cf7('0x2c')]['key']};});_0x334b7e[_0x6cf7('0x2d')]=_[_0x6cf7('0x2a')](_0x560ebb,'name');_0x334b7e[_0x6cf7('0x2e')]=_[_0x6cf7('0x2f')](_0x87d2d[_0x6cf7('0x2e')]);_0x334b7e[_0x6cf7('0x30')]=_[_0x6cf7('0x31')](_0x334b7e[_0x6cf7('0x2d')],_0x334b7e[_0x6cf7('0x2e')]);_0x201071['attributes']=_['intersection'](_0x334b7e[_0x6cf7('0x2d')],qs[_0x6cf7('0x32')](_0x87d2d['query'][_0x6cf7('0x32')]));_0x201071[_0x6cf7('0x33')]=_0x201071['attributes'][_0x6cf7('0x34')]?_0x201071[_0x6cf7('0x33')]:_0x334b7e[_0x6cf7('0x2d')];if(!_0x87d2d[_0x6cf7('0x2e')][_0x6cf7('0x35')](_0x6cf7('0x36'))){_0x201071[_0x6cf7('0x1b')]=qs[_0x6cf7('0x1b')](_0x87d2d['query'][_0x6cf7('0x1b')]);_0x201071[_0x6cf7('0x19')]=qs['offset'](_0x87d2d['query'][_0x6cf7('0x19')]);}_0x201071['order']=qs['sort'](_0x87d2d[_0x6cf7('0x2e')]['sort']);_0x201071['where']=qs['filters'](_[_0x6cf7('0x37')](_0x87d2d['query'],_0x334b7e[_0x6cf7('0x30')]),_0x560ebb);if(_0x87d2d['query'][_0x6cf7('0x38')]){_0x201071[_0x6cf7('0x39')]=_['merge'](_0x201071[_0x6cf7('0x39')],{'$or':_['map'](_0x560ebb,function(_0x3a4088){if(_0x3a4088[_0x6cf7('0x2c')]!==_0x6cf7('0x3a')){var _0xcc25ef={};_0xcc25ef[_0x3a4088[_0x6cf7('0x27')]]={'$like':'%'+_0x87d2d[_0x6cf7('0x2e')][_0x6cf7('0x38')]+'%'};return _0xcc25ef;}})});}_0x201071=_[_0x6cf7('0x3b')]({},_0x201071,_0x87d2d[_0x6cf7('0x3c')]);var _0x469f0a={'where':_0x201071[_0x6cf7('0x39')]};return db[_0x6cf7('0x3d')]['count'](_0x469f0a)[_0x6cf7('0x23')](function(_0x58c4b9){_0x51ba47[_0x6cf7('0x1c')]=_0x58c4b9;if(_0x87d2d['query'][_0x6cf7('0x3e')]){_0x201071[_0x6cf7('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x6cf7('0x40')](_0x201071);})[_0x6cf7('0x23')](function(_0x4a6623){_0x51ba47[_0x6cf7('0x41')]=_0x4a6623;return _0x51ba47;})[_0x6cf7('0x23')](respondWithFilteredResult(_0x4dcf00,_0x201071))['catch'](handleError(_0x4dcf00,null));};exports['show']=function(_0x5ad5fd,_0x23c7e5){var _0x4cd8f9={'raw':!![],'where':{'id':_0x5ad5fd[_0x6cf7('0x42')]['id']}},_0x329767={};_0x329767[_0x6cf7('0x2d')]=_[_0x6cf7('0x2f')](db[_0x6cf7('0x3d')][_0x6cf7('0x2b')]);_0x329767['query']=_[_0x6cf7('0x2f')](_0x5ad5fd[_0x6cf7('0x2e')]);_0x329767['filters']=_[_0x6cf7('0x31')](_0x329767[_0x6cf7('0x2d')],_0x329767['query']);_0x4cd8f9[_0x6cf7('0x33')]=_[_0x6cf7('0x31')](_0x329767['model'],qs[_0x6cf7('0x32')](_0x5ad5fd[_0x6cf7('0x2e')][_0x6cf7('0x32')]));_0x4cd8f9['attributes']=_0x4cd8f9[_0x6cf7('0x33')][_0x6cf7('0x34')]?_0x4cd8f9['attributes']:_0x329767[_0x6cf7('0x2d')];if(_0x5ad5fd[_0x6cf7('0x2e')][_0x6cf7('0x3e')]){_0x4cd8f9[_0x6cf7('0x3f')]=[{'all':!![]}];}_0x4cd8f9=_[_0x6cf7('0x3b')]({},_0x4cd8f9,_0x5ad5fd['options']);return db[_0x6cf7('0x3d')][_0x6cf7('0x43')](_0x4cd8f9)[_0x6cf7('0x23')](handleEntityNotFound(_0x23c7e5,null))[_0x6cf7('0x23')](respondWithResult(_0x23c7e5,null))[_0x6cf7('0x44')](handleError(_0x23c7e5,null));};exports[_0x6cf7('0x45')]=function(_0x6b403b,_0x4cb82b){return db[_0x6cf7('0x3d')]['create'](_0x6b403b[_0x6cf7('0x46')],{})[_0x6cf7('0x23')](respondWithResult(_0x4cb82b,0xc9))['catch'](handleError(_0x4cb82b,null));};exports[_0x6cf7('0x22')]=function(_0x12e8cd,_0x34986b){if(_0x12e8cd['body']['id']){delete _0x12e8cd[_0x6cf7('0x46')]['id'];}return db['MailTransferReport'][_0x6cf7('0x43')]({'where':{'id':_0x12e8cd[_0x6cf7('0x42')]['id']}})['then'](handleEntityNotFound(_0x34986b,null))[_0x6cf7('0x23')](saveUpdates(_0x12e8cd[_0x6cf7('0x46')],null))[_0x6cf7('0x23')](respondWithResult(_0x34986b,null))[_0x6cf7('0x44')](handleError(_0x34986b,null));};exports[_0x6cf7('0x24')]=function(_0x4ac66f,_0x164295){return db[_0x6cf7('0x3d')][_0x6cf7('0x43')]({'where':{'id':_0x4ac66f[_0x6cf7('0x42')]['id']}})[_0x6cf7('0x23')](handleEntityNotFound(_0x164295,null))[_0x6cf7('0x23')](removeEntity(_0x164295,null))['catch'](handleError(_0x164295,null));};exports[_0x6cf7('0x47')]=function(_0x4234a6,_0x2cf71a){return db[_0x6cf7('0x3d')][_0x6cf7('0x47')]()['then'](respondWithResult(_0x2cf71a,null))[_0x6cf7('0x44')](handleError(_0x2cf71a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d3712a6..21c5cd7 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 _0xfde9=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xfde9,0x66));var _0x9fde=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0xfde9[_0x38f737];return _0x7afda3;};'use strict';var _=require(_0x9fde('0x0'));var util=require(_0x9fde('0x1'));var logger=require(_0x9fde('0x2'))(_0x9fde('0x3'));var moment=require(_0x9fde('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fde('0x5'));var fs=require('fs');var path=require(_0x9fde('0x6'));var rimraf=require('rimraf');var config=require(_0x9fde('0x7'));var attributes=require(_0x9fde('0x8'));module[_0x9fde('0x9')]=function(_0x2e512a,_0x23419b){return _0x2e512a[_0x9fde('0xa')](_0x9fde('0xb'),attributes,{'tableName':_0x9fde('0xc'),'paranoid':![],'indexes':[{'name':_0x9fde('0xd'),'fields':[_0x9fde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc569=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc569,0x159));var _0x9c56=function(_0x4ea0ee,_0xd1b8df){_0x4ea0ee=_0x4ea0ee-0x0;var _0x1c8195=_0xc569[_0x4ea0ee];return _0x1c8195;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var logger=require(_0x9c56('0x2'))('api');var moment=require(_0x9c56('0x3'));var BPromise=require(_0x9c56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c56('0x5'));var rimraf=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x9c56('0x8')]=function(_0x2e2421,_0xe6ba11){return _0x2e2421[_0x9c56('0x9')]('MailTransferReport',attributes,{'tableName':_0x9c56('0xa'),'paranoid':![],'indexes':[{'name':_0x9c56('0xb'),'fields':[_0x9c56('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 c140ee6..a4a7505 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 _0xef86=['MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x1cf50b,_0x21d016){var _0x50c49b=function(_0x1fe0a2){while(--_0x1fe0a2){_0x1cf50b['push'](_0x1cf50b['shift']());}};_0x50c49b(++_0x21d016);}(_0xef86,0x87));var _0x6ef8=function(_0x9f891a,_0x353d5f){_0x9f891a=_0x9f891a-0x0;var _0x1680ac=_0xef86[_0x9f891a];return _0x1680ac;};'use strict';var _=require(_0x6ef8('0x0'));var util=require(_0x6ef8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ef8('0x2'));var fs=require('fs');var Redis=require(_0x6ef8('0x3'));var db=require(_0x6ef8('0x4'))['db'];var utils=require(_0x6ef8('0x5'));var logger=require(_0x6ef8('0x6'))(_0x6ef8('0x7'));var config=require(_0x6ef8('0x8'));var jayson=require(_0x6ef8('0x9'));var client=jayson['client'][_0x6ef8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37874f,_0x25ab67,_0x171f93){return new BPromise(function(_0x132eb2,_0x150c93){return client['request'](_0x37874f,_0x171f93)[_0x6ef8('0xb')](function(_0x3135c5){logger['info'](_0x6ef8('0xc'),_0x25ab67,_0x6ef8('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x25ab67,_0x6ef8('0xd'),JSON[_0x6ef8('0xe')](_0x3135c5));if(_0x3135c5[_0x6ef8('0xf')]){if(_0x3135c5[_0x6ef8('0xf')][_0x6ef8('0x10')]===0x1f4){logger[_0x6ef8('0xf')](_0x6ef8('0xc'),_0x25ab67,_0x3135c5['error']['message']);return _0x150c93(_0x3135c5[_0x6ef8('0xf')][_0x6ef8('0x11')]);}logger[_0x6ef8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x25ab67,_0x3135c5[_0x6ef8('0xf')][_0x6ef8('0x11')]);return _0x132eb2(_0x3135c5[_0x6ef8('0xf')][_0x6ef8('0x11')]);}else{logger[_0x6ef8('0x12')](_0x6ef8('0xc'),_0x25ab67,_0x6ef8('0xd'));_0x132eb2(_0x3135c5[_0x6ef8('0x13')][_0x6ef8('0x11')]);}})[_0x6ef8('0x14')](function(_0x168401){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x25ab67,_0x168401);_0x150c93(_0x168401);});});} \ No newline at end of file +var _0xa0f2=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x187290,_0x45491f){var _0x4b8f25=function(_0x5a81d6){while(--_0x5a81d6){_0x187290['push'](_0x187290['shift']());}};_0x4b8f25(++_0x45491f);}(_0xa0f2,0xfd));var _0x2a0f=function(_0x39a2b5,_0x243fc2){_0x39a2b5=_0x39a2b5-0x0;var _0x2f2b26=_0xa0f2[_0x39a2b5];return _0x2f2b26;};'use strict';var _=require(_0x2a0f('0x0'));var util=require(_0x2a0f('0x1'));var moment=require(_0x2a0f('0x2'));var BPromise=require(_0x2a0f('0x3'));var rs=require(_0x2a0f('0x4'));var fs=require('fs');var Redis=require(_0x2a0f('0x5'));var db=require(_0x2a0f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2a0f('0x7'));var jayson=require(_0x2a0f('0x8'));var client=jayson[_0x2a0f('0x9')][_0x2a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a8c4c,_0x291d31,_0x406c23){return new BPromise(function(_0x2a2f01,_0x11d619){return client[_0x2a0f('0xb')](_0x3a8c4c,_0x406c23)[_0x2a0f('0xc')](function(_0x46936d){logger[_0x2a0f('0xd')](_0x2a0f('0xe'),_0x291d31,_0x2a0f('0xf'));logger[_0x2a0f('0x10')](_0x2a0f('0x11'),_0x291d31,_0x2a0f('0xf'),JSON[_0x2a0f('0x12')](_0x46936d));if(_0x46936d[_0x2a0f('0x13')]){if(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x14')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x46936d['error'][_0x2a0f('0x15')]);return _0x11d619(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x15')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x46936d['error']['message']);return _0x2a2f01(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x15')]);}else{logger[_0x2a0f('0xd')](_0x2a0f('0xe'),_0x291d31,_0x2a0f('0xf'));_0x2a2f01(_0x46936d[_0x2a0f('0x16')][_0x2a0f('0x15')]);}})[_0x2a0f('0x17')](function(_0x1a6267){logger[_0x2a0f('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x1a6267);_0x11d619(_0x1a6267);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f5f5884..04a2666 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 _0x0a7f=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x0a7f,0xd1));var _0xf0a7=function(_0x152b03,_0x2b427f){_0x152b03=_0x152b03-0x0;var _0x5a5d4b=_0x0a7f[_0x152b03];return _0x5a5d4b;};'use strict';var multer=require('multer');var util=require(_0xf0a7('0x0'));var path=require('path');var timeout=require(_0xf0a7('0x1'));var express=require(_0xf0a7('0x2'));var router=express[_0xf0a7('0x3')]();var fs_extra=require(_0xf0a7('0x4'));var auth=require(_0xf0a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf0a7('0x6'));var controller=require(_0xf0a7('0x7'));router[_0xf0a7('0x8')]('/',auth[_0xf0a7('0x9')](),controller[_0xf0a7('0xa')]);router[_0xf0a7('0x8')](_0xf0a7('0xb'),auth[_0xf0a7('0x9')](),controller[_0xf0a7('0xc')]);router[_0xf0a7('0x8')](_0xf0a7('0xd'),auth[_0xf0a7('0x9')](),controller[_0xf0a7('0xe')]);router[_0xf0a7('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0a7('0x10')]);router[_0xf0a7('0x11')](_0xf0a7('0xd'),auth['isAuthenticated'](),controller[_0xf0a7('0x12')]);router[_0xf0a7('0x13')]('/:id',auth[_0xf0a7('0x9')](),controller[_0xf0a7('0x14')]);module[_0xf0a7('0x15')]=router; \ No newline at end of file +var _0xe88a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','show','post','create','put','/:id','update','delete','exports','multer','path'];(function(_0x235f7f,_0x4cc112){var _0x3bf31e=function(_0x618236){while(--_0x618236){_0x235f7f['push'](_0x235f7f['shift']());}};_0x3bf31e(++_0x4cc112);}(_0xe88a,0xb2));var _0xae88=function(_0x46f3a9,_0x21030c){_0x46f3a9=_0x46f3a9-0x0;var _0x46126d=_0xe88a[_0x46f3a9];return _0x46126d;};'use strict';var multer=require(_0xae88('0x0'));var util=require('util');var path=require(_0xae88('0x1'));var timeout=require(_0xae88('0x2'));var express=require('express');var router=express[_0xae88('0x3')]();var fs_extra=require(_0xae88('0x4'));var auth=require(_0xae88('0x5'));var interaction=require(_0xae88('0x6'));var config=require(_0xae88('0x7'));var controller=require(_0xae88('0x8'));router[_0xae88('0x9')]('/',auth[_0xae88('0xa')](),controller['index']);router[_0xae88('0x9')](_0xae88('0xb'),auth[_0xae88('0xa')](),controller['describe']);router['get']('/:id',auth[_0xae88('0xa')](),controller[_0xae88('0xc')]);router[_0xae88('0xd')]('/',auth['isAuthenticated'](),controller[_0xae88('0xe')]);router[_0xae88('0xf')](_0xae88('0x10'),auth[_0xae88('0xa')](),controller[_0xae88('0x11')]);router[_0xae88('0x12')]('/:id',auth[_0xae88('0xa')](),controller['destroy']);module[_0xae88('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 046a9cd..f153d8e 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 _0x54da=['setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x38787c,_0x1b0d05){var _0x547738=function(_0x367ad7){while(--_0x367ad7){_0x38787c['push'](_0x38787c['shift']());}};_0x547738(++_0x1b0d05);}(_0x54da,0x96));var _0xa54d=function(_0x30d9e2,_0x112c43){_0x30d9e2=_0x30d9e2-0x0;var _0x5116bd=_0x54da[_0x30d9e2];return _0x5116bd;};'use strict';var Sequelize=require(_0xa54d('0x0'));var moment=require(_0xa54d('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa54d('0x2')]},'interface':{'type':Sequelize[_0xa54d('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xa54d('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xa54d('0x4')]},'enterAt':{'type':Sequelize[_0xa54d('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xd3a541){var _0xc77ffb=moment(_0xd3a541);var _0x3630f8=moment(this[_0xa54d('0x6')](_0xa54d('0x7')));var _0x224cb9=_0xc77ffb[_0xa54d('0x8')](_0x3630f8,_0xa54d('0x9'));this[_0xa54d('0xa')](_0xa54d('0xb'),_0xd3a541);this[_0xa54d('0xa')](_0xa54d('0xc'),_0x224cb9>=0x0?_0x224cb9:null);}},'data1':{'type':Sequelize[_0xa54d('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xa54d('0x2')],'comment':_0xa54d('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xa54d('0xe')},'data5':{'type':Sequelize[_0xa54d('0x2')],'comment':_0xa54d('0xf')},'role':{'type':Sequelize[_0xa54d('0x2')]},'internal':{'type':Sequelize[_0xa54d('0x4')]},'uniqueid':{'type':Sequelize[_0xa54d('0x2')]}}; \ No newline at end of file +var _0x1298=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x1298,0xb6));var _0x8129=function(_0x17e2c3,_0x34c7e8){_0x17e2c3=_0x17e2c3-0x0;var _0xe89998=_0x1298[_0x17e2c3];return _0xe89998;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x8129('0x0')]},'membername':{'type':Sequelize[_0x8129('0x0')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8129('0x0')],'defaultValue':_0x8129('0x1'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x8129('0x2')]},'enterAt':{'type':Sequelize[_0x8129('0x3')]},'exitAt':{'type':Sequelize[_0x8129('0x3')],'set':function(_0x43725a){var _0x88593d=moment(_0x43725a);var _0x3e81da=moment(this[_0x8129('0x4')](_0x8129('0x5')));var _0x17a578=_0x88593d[_0x8129('0x6')](_0x3e81da,'seconds');this[_0x8129('0x7')](_0x8129('0x8'),_0x43725a);this[_0x8129('0x7')]('duration',_0x17a578>=0x0?_0x17a578:null);}},'data1':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0x9')},'data2':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xa')},'data3':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xb')},'data4':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xc')},'data5':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xd')},'role':{'type':Sequelize[_0x8129('0x0')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8129('0x0')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 9cea832..c29904a 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x4f282e,_0x13e57d){var _0x35a946=function(_0xab5aff){while(--_0xab5aff){_0x4f282e['push'](_0x4f282e['shift']());}};_0x35a946(++_0x13e57d);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4702ce,_0x576524){_0x4702ce=_0x4702ce-0x0;var _0x3d1f4c=_0xedd9[_0x4702ce];return _0x3d1f4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 610090d..69592f5 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 _0x72bd=['../../config/logger','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x72bd,0xcf));var _0xd72b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x72bd[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xd72b('0x0'));var util=require('util');var logger=require(_0xd72b('0x1'))(_0xd72b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd72b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd72b('0x4'));var config=require(_0xd72b('0x5'));var attributes=require(_0xd72b('0x6'));module['exports']=function(_0x3f3b04,_0x1668d8){return _0x3f3b04[_0xd72b('0x7')](_0xd72b('0x8'),attributes,{'tableName':_0xd72b('0x9'),'paranoid':![],'indexes':[{'name':_0xd72b('0xa'),'fields':[_0xd72b('0xb'),_0xd72b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc754=['interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','MemberReport','membername'];(function(_0x5591a2,_0x5a0810){var _0x3a1472=function(_0x3ae0c2){while(--_0x3ae0c2){_0x5591a2['push'](_0x5591a2['shift']());}};_0x3a1472(++_0x5a0810);}(_0xc754,0x1e2));var _0x4c75=function(_0x262500,_0x521df7){_0x262500=_0x262500-0x0;var _0xcb154f=_0xc754[_0x262500];return _0xcb154f;};'use strict';var _=require(_0x4c75('0x0'));var util=require(_0x4c75('0x1'));var logger=require(_0x4c75('0x2'))(_0x4c75('0x3'));var moment=require(_0x4c75('0x4'));var BPromise=require(_0x4c75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4c75('0x6'));var config=require(_0x4c75('0x7'));var attributes=require('./memberReport.attributes');module[_0x4c75('0x8')]=function(_0x526a85,_0x190111){return _0x526a85[_0x4c75('0x9')](_0x4c75('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4c75('0xb'),_0x4c75('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index fb65e45..2e0c2d9 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 _0xfb82=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','where','limit','include','map','attributes','model','catch','raw','CreateMemberReport','update','body','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xfb82,0x17f));var _0x2fb8=function(_0x404c54,_0x357186){_0x404c54=_0x404c54-0x0;var _0x44d83b=_0xfb82[_0x404c54];return _0x44d83b;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var moment=require(_0x2fb8('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fb8('0x3'));var fs=require('fs');var Redis=require(_0x2fb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fb8('0x5'));var logger=require(_0x2fb8('0x6'))(_0x2fb8('0x7'));var config=require(_0x2fb8('0x8'));var jayson=require(_0x2fb8('0x9'));var client=jayson[_0x2fb8('0xa')][_0x2fb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8ede42,_0x420bec,_0x1f7575){return new BPromise(function(_0x5d58fa,_0xf3961c){return client[_0x2fb8('0xc')](_0x8ede42,_0x1f7575)[_0x2fb8('0xd')](function(_0x29be44){logger[_0x2fb8('0xe')](_0x2fb8('0xf'),_0x420bec,_0x2fb8('0x10'));logger[_0x2fb8('0x11')](_0x2fb8('0x12'),_0x420bec,_0x2fb8('0x10'),JSON[_0x2fb8('0x13')](_0x29be44));if(_0x29be44['error']){if(_0x29be44[_0x2fb8('0x14')][_0x2fb8('0x15')]===0x1f4){logger[_0x2fb8('0x14')](_0x2fb8('0xf'),_0x420bec,_0x29be44['error']['message']);return _0xf3961c(_0x29be44[_0x2fb8('0x14')]['message']);}logger[_0x2fb8('0x14')](_0x2fb8('0xf'),_0x420bec,_0x29be44['error'][_0x2fb8('0x16')]);return _0x5d58fa(_0x29be44[_0x2fb8('0x14')]['message']);}else{logger['info'](_0x2fb8('0xf'),_0x420bec,_0x2fb8('0x10'));_0x5d58fa(_0x29be44[_0x2fb8('0x17')][_0x2fb8('0x16')]);}})['catch'](function(_0x3fda1b){logger[_0x2fb8('0x14')]('MemberReport,\x20%s,\x20%s',_0x420bec,_0x3fda1b);_0xf3961c(_0x3fda1b);});});}exports[_0x2fb8('0x18')]=function(_0x40d128){var _0x41356=this;return new Promise(function(_0x524c14,_0x48a7c2){return db[_0x2fb8('0x19')][_0x2fb8('0x1a')]({'raw':_0x40d128[_0x2fb8('0x1b')]?_0x40d128[_0x2fb8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40d128[_0x2fb8('0x1b')]?_0x40d128[_0x2fb8('0x1b')][_0x2fb8('0x1c')]||null:null,'attributes':_0x40d128[_0x2fb8('0x1b')]?_0x40d128[_0x2fb8('0x1b')]['attributes']||null:null,'limit':_0x40d128[_0x2fb8('0x1b')]?_0x40d128[_0x2fb8('0x1b')][_0x2fb8('0x1d')]||null:null,'include':_0x40d128['options']?_0x40d128['options'][_0x2fb8('0x1e')]?_[_0x2fb8('0x1f')](_0x40d128[_0x2fb8('0x1b')][_0x2fb8('0x1e')],function(_0x475883){return{'model':db[_0x475883['model']],'as':_0x475883['as'],'attributes':_0x475883[_0x2fb8('0x20')],'include':_0x475883[_0x2fb8('0x1e')]?_[_0x2fb8('0x1f')](_0x475883[_0x2fb8('0x1e')],function(_0x3bfc46){return{'model':db[_0x3bfc46[_0x2fb8('0x21')]],'as':_0x3bfc46['as'],'attributes':_0x3bfc46[_0x2fb8('0x20')],'include':_0x3bfc46['include']?_[_0x2fb8('0x1f')](_0x3bfc46['include'],function(_0x3bee6c){return{'model':db[_0x3bee6c[_0x2fb8('0x21')]],'as':_0x3bee6c['as'],'attributes':_0x3bee6c[_0x2fb8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2fb8('0xd')](function(_0x2054c9){logger[_0x2fb8('0xe')](_0x2fb8('0x18'),_0x40d128);logger[_0x2fb8('0x11')](_0x2fb8('0x18'),_0x40d128,JSON[_0x2fb8('0x13')](_0x2054c9));_0x524c14(_0x2054c9);})[_0x2fb8('0x22')](function(_0x245078){logger[_0x2fb8('0x14')](_0x2fb8('0x18'),_0x245078[_0x2fb8('0x16')],_0x40d128);_0x48a7c2(_0x41356[_0x2fb8('0x14')](0x1f4,_0x245078['message']));});});};exports['CreateMemberReport']=function(_0x24fce9){var _0x148418=this;return new Promise(function(_0x50c07d,_0x5d6930){return db[_0x2fb8('0x19')]['create'](_0x24fce9['body'],{'raw':_0x24fce9[_0x2fb8('0x1b')]?_0x24fce9[_0x2fb8('0x1b')][_0x2fb8('0x23')]===undefined?!![]:![]:!![]})[_0x2fb8('0xd')](function(_0x440f20){logger[_0x2fb8('0xe')](_0x2fb8('0x24'),_0x24fce9);logger[_0x2fb8('0x11')]('CreateMemberReport',_0x24fce9,JSON['stringify'](_0x440f20));_0x50c07d(_0x440f20);})[_0x2fb8('0x22')](function(_0x7a1729){logger[_0x2fb8('0x14')](_0x2fb8('0x24'),_0x7a1729[_0x2fb8('0x16')],_0x24fce9);_0x5d6930(_0x148418[_0x2fb8('0x14')](0x1f4,_0x7a1729[_0x2fb8('0x16')]));});});};exports['UpdateMemberReport']=function(_0x94779b){var _0x12ca46=this;return new Promise(function(_0x4602cf,_0x161287){return db[_0x2fb8('0x19')][_0x2fb8('0x25')](_0x94779b[_0x2fb8('0x26')],{'raw':_0x94779b['options']?_0x94779b[_0x2fb8('0x1b')][_0x2fb8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x94779b[_0x2fb8('0x1b')]?_0x94779b['options'][_0x2fb8('0x1c')]||null:null,'attributes':_0x94779b[_0x2fb8('0x1b')]?_0x94779b[_0x2fb8('0x1b')][_0x2fb8('0x20')]||null:null,'limit':_0x94779b[_0x2fb8('0x1b')]?_0x94779b['options'][_0x2fb8('0x1d')]||null:null})[_0x2fb8('0xd')](function(_0x4fa698){logger['info'](_0x2fb8('0x27'),_0x94779b);logger[_0x2fb8('0x11')](_0x2fb8('0x27'),_0x94779b,JSON['stringify'](_0x4fa698));_0x4602cf(_0x4fa698);})[_0x2fb8('0x22')](function(_0x5c901d){logger[_0x2fb8('0x14')](_0x2fb8('0x27'),_0x5c901d[_0x2fb8('0x16')],_0x94779b);_0x161287(_0x12ca46[_0x2fb8('0x14')](0x1f4,_0x5c901d[_0x2fb8('0x16')]));});});}; \ No newline at end of file +var _0x29af=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','update','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x9033ca,_0x12aaec){var _0x13edb6=function(_0x2f7f9d){while(--_0x2f7f9d){_0x9033ca['push'](_0x9033ca['shift']());}};_0x13edb6(++_0x12aaec);}(_0x29af,0x134));var _0xf29a=function(_0x44d116,_0x4932bc){_0x44d116=_0x44d116-0x0;var _0x142e09=_0x29af[_0x44d116];return _0x142e09;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('MemberReport,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findAll']({'raw':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')]||null:null,'attributes':_0xd4ca39['options']?_0xd4ca39[_0xf29a('0x17')]['attributes']||null:null,'limit':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x19')]||null:null,'include':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39['options'][_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')],function(_0x35af39){return{'model':db[_0x35af39[_0xf29a('0x1c')]],'as':_0x35af39['as'],'attributes':_0x35af39[_0xf29a('0x1d')],'include':_0x35af39['include']?_['map'](_0x35af39['include'],function(_0x262a5f){return{'model':db[_0x262a5f['model']],'as':_0x262a5f['as'],'attributes':_0x262a5f[_0xf29a('0x1d')],'include':_0x262a5f[_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0x262a5f['include'],function(_0x181c3a){return{'model':db[_0x181c3a[_0xf29a('0x1c')]],'as':_0x181c3a['as'],'attributes':_0x181c3a[_0xf29a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf29a('0x9')](function(_0x11d1a6){logger[_0xf29a('0xa')]('GetMemberReport',_0xd4ca39);logger[_0xf29a('0xb')](_0xf29a('0x15'),_0xd4ca39,JSON['stringify'](_0x11d1a6));_0x296829(_0x11d1a6);})['catch'](function(_0x4fdd1b){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x4fdd1b[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4fdd1b[_0xf29a('0x12')]));});});};exports[_0xf29a('0x1e')]=function(_0x694c05){var _0x50b221=this;return new Promise(function(_0x2b10d1,_0x3e31c3){return db[_0xf29a('0x16')][_0xf29a('0x1f')](_0x694c05[_0xf29a('0x20')],{'raw':_0x694c05[_0xf29a('0x17')]?_0x694c05[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf29a('0x9')](function(_0x566b1d){logger[_0xf29a('0xa')](_0xf29a('0x1e'),_0x694c05);logger[_0xf29a('0xb')](_0xf29a('0x1e'),_0x694c05,JSON[_0xf29a('0xe')](_0x566b1d));_0x2b10d1(_0x566b1d);})['catch'](function(_0x12110d){logger['error'](_0xf29a('0x1e'),_0x12110d[_0xf29a('0x12')],_0x694c05);_0x3e31c3(_0x50b221['error'](0x1f4,_0x12110d[_0xf29a('0x12')]));});});};exports[_0xf29a('0x21')]=function(_0x5b1834){var _0x13b011=this;return new Promise(function(_0x399698,_0x422cd8){return db[_0xf29a('0x16')][_0xf29a('0x22')](_0x5b1834[_0xf29a('0x20')],{'raw':_0x5b1834['options']?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b1834[_0xf29a('0x17')]?_0x5b1834['options'][_0xf29a('0x18')]||null:null,'attributes':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x1d')]||null:null,'limit':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x19')]||null:null})[_0xf29a('0x9')](function(_0x1fde1e){logger[_0xf29a('0xa')](_0xf29a('0x21'),_0x5b1834);logger[_0xf29a('0xb')]('UpdateMemberReport',_0x5b1834,JSON['stringify'](_0x1fde1e));_0x399698(_0x1fde1e);})[_0xf29a('0x14')](function(_0x1650a7){logger[_0xf29a('0xf')]('UpdateMemberReport',_0x1650a7[_0xf29a('0x12')],_0x5b1834);_0x422cd8(_0x13b011[_0xf29a('0xf')](0x1f4,_0x1650a7[_0xf29a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index acd301e..2a7f07b 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 _0x7a6d=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout'];(function(_0x440a9b,_0x19435a){var _0x4fe804=function(_0x984809){while(--_0x984809){_0x440a9b['push'](_0x440a9b['shift']());}};_0x4fe804(++_0x19435a);}(_0x7a6d,0x99));var _0xd7a6=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x7a6d[_0x286bfb];return _0x52b683;};'use strict';var multer=require(_0xd7a6('0x0'));var util=require(_0xd7a6('0x1'));var path=require('path');var timeout=require(_0xd7a6('0x2'));var express=require(_0xd7a6('0x3'));var router=express[_0xd7a6('0x4')]();var fs_extra=require(_0xd7a6('0x5'));var auth=require(_0xd7a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd7a6('0x7'));var controller=require(_0xd7a6('0x8'));router[_0xd7a6('0x9')]('/',controller[_0xd7a6('0xa')]);module[_0xd7a6('0xb')]=router; \ No newline at end of file +var _0x7c24=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x7c24,0x186));var _0x47c2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7c24[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var path=require(_0x47c2('0x2'));var timeout=require(_0x47c2('0x3'));var express=require('express');var router=express[_0x47c2('0x4')]();var fs_extra=require(_0x47c2('0x5'));var auth=require(_0x47c2('0x6'));var interaction=require(_0x47c2('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x47c2('0x8')]('/',controller[_0x47c2('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e8d6653..6c38901 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 _0x8a37=['sequelize','version'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8a37,0x80));var _0x78a3=function(_0x5c3b58,_0x5c737c){_0x5c3b58=_0x5c3b58-0x0;var _0x1c068e=_0x8a37[_0x5c3b58];return _0x1c068e;};'use strict';var Sequelize=require(_0x78a3('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x78a3('0x1')}}; \ No newline at end of file +var _0x1c6a=['version','exports','STRING'];(function(_0x32328d,_0x290434){var _0x317092=function(_0x2ec2d5){while(--_0x2ec2d5){_0x32328d['push'](_0x32328d['shift']());}};_0x317092(++_0x290434);}(_0x1c6a,0x154));var _0xa1c6=function(_0x5e24d7,_0x11218f){_0x5e24d7=_0x5e24d7-0x0;var _0x10063d=_0x1c6a[_0x5e24d7];return _0x10063d;};'use strict';var Sequelize=require('sequelize');module[_0xa1c6('0x0')]={'version':{'type':Sequelize[_0xa1c6('0x1')],'unique':_0xa1c6('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1fd6e40..8856692 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 _0x8d40=['send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','eml-format','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','error','stack','name'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8d40,0x9b));var _0x08d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8d40[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x08d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x08d4('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x08d4('0x3'));var path=require(_0x08d4('0x4'));var sox=require(_0x08d4('0x5'));var csv=require(_0x08d4('0x6'));var ejs=require(_0x08d4('0x7'));var fs=require('fs');var fs_extra=require(_0x08d4('0x8'));var _=require(_0x08d4('0x9'));var squel=require(_0x08d4('0xa'));var crypto=require('crypto');var jsforce=require(_0x08d4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08d4('0xc'));var Papa=require('papaparse');var Redis=require(_0x08d4('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08d4('0xe'));var hardwareService=require(_0x08d4('0xf'));var logger=require(_0x08d4('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x08d4('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x08d4('0x12'))['db'];function respondWithStatusCode(_0xca385a,_0x215ded){_0x215ded=_0x215ded||0xcc;return function(_0x4aa858){if(_0x4aa858){return _0xca385a[_0x08d4('0x13')](_0x215ded);}return _0xca385a[_0x08d4('0x14')](_0x215ded)['end']();};}function respondWithResult(_0x5dfc36,_0x41fb2f){_0x41fb2f=_0x41fb2f||0xc8;return function(_0x124b9b){if(_0x124b9b){return _0x5dfc36[_0x08d4('0x14')](_0x41fb2f)[_0x08d4('0x15')](_0x124b9b);}};}function respondWithFilteredResult(_0x59d10f,_0x2addae){return function(_0x563be4){if(_0x563be4){var _0x52ff13=typeof _0x2addae['offset']===_0x08d4('0x16')&&typeof _0x2addae[_0x08d4('0x17')]===_0x08d4('0x16');var _0x251800=_0x563be4[_0x08d4('0x18')];var _0x1e433e=_0x52ff13?0x0:_0x2addae[_0x08d4('0x19')];var _0x34c204=_0x52ff13?_0x563be4[_0x08d4('0x18')]:_0x2addae[_0x08d4('0x19')]+_0x2addae[_0x08d4('0x17')];var _0x516e86;if(_0x34c204>=_0x251800){_0x34c204=_0x251800;_0x516e86=0xc8;}else{_0x516e86=0xce;}_0x59d10f[_0x08d4('0x14')](_0x516e86);return _0x59d10f['set'](_0x08d4('0x1a'),_0x1e433e+'-'+_0x34c204+'/'+_0x251800)[_0x08d4('0x15')](_0x563be4);}return null;};}function patchUpdates(_0x290b0c){return function(_0x4b29a0){try{jsonpatch[_0x08d4('0x1b')](_0x4b29a0,_0x290b0c,!![]);}catch(_0x4027f7){return BPromise['reject'](_0x4027f7);}return _0x4b29a0[_0x08d4('0x1c')]();};}function saveUpdates(_0x1ce3bb,_0x19a1db){return function(_0x17cbf3){if(_0x17cbf3){return _0x17cbf3['update'](_0x1ce3bb)[_0x08d4('0x1d')](function(_0x21c8fe){return _0x21c8fe;});}return null;};}function removeEntity(_0xf248f4,_0x5140b0){return function(_0x43a311){if(_0x43a311){return _0x43a311[_0x08d4('0x1e')]()[_0x08d4('0x1d')](function(){_0xf248f4[_0x08d4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ec5a,_0x146f0b){return function(_0x53a595){if(!_0x53a595){_0x30ec5a['sendStatus'](0x194);}return _0x53a595;};}function handleError(_0x36fba2,_0x3f06e9){_0x3f06e9=_0x3f06e9||0x1f4;return function(_0x34f3d1){logger[_0x08d4('0x1f')](_0x34f3d1[_0x08d4('0x20')]);if(_0x34f3d1[_0x08d4('0x21')]){delete _0x34f3d1[_0x08d4('0x21')];}_0x36fba2[_0x08d4('0x14')](_0x3f06e9)[_0x08d4('0x22')](_0x34f3d1);};}exports[_0x08d4('0x23')]=function(_0x611a65,_0x1884cf){var _0x101fcb={},_0x5c3ac9={},_0x277f90={'count':0x0,'rows':[]};var _0xb1620b=_[_0x08d4('0x24')](db[_0x08d4('0x25')][_0x08d4('0x26')],function(_0xb8abda){return{'name':_0xb8abda[_0x08d4('0x27')],'type':_0xb8abda[_0x08d4('0x28')][_0x08d4('0x29')]};});_0x5c3ac9[_0x08d4('0x2a')]=_[_0x08d4('0x24')](_0xb1620b,'name');_0x5c3ac9[_0x08d4('0x2b')]=_[_0x08d4('0x2c')](_0x611a65[_0x08d4('0x2b')]);_0x5c3ac9['filters']=_[_0x08d4('0x2d')](_0x5c3ac9[_0x08d4('0x2a')],_0x5c3ac9[_0x08d4('0x2b')]);_0x101fcb[_0x08d4('0x2e')]=_[_0x08d4('0x2d')](_0x5c3ac9[_0x08d4('0x2a')],qs[_0x08d4('0x2f')](_0x611a65[_0x08d4('0x2b')][_0x08d4('0x2f')]));_0x101fcb[_0x08d4('0x2e')]=_0x101fcb[_0x08d4('0x2e')][_0x08d4('0x30')]?_0x101fcb[_0x08d4('0x2e')]:_0x5c3ac9[_0x08d4('0x2a')];if(!_0x611a65[_0x08d4('0x2b')][_0x08d4('0x31')](_0x08d4('0x32'))){_0x101fcb[_0x08d4('0x17')]=qs[_0x08d4('0x17')](_0x611a65[_0x08d4('0x2b')][_0x08d4('0x17')]);_0x101fcb[_0x08d4('0x19')]=qs[_0x08d4('0x19')](_0x611a65[_0x08d4('0x2b')]['offset']);}_0x101fcb[_0x08d4('0x33')]=qs[_0x08d4('0x34')](_0x611a65['query'][_0x08d4('0x34')]);_0x101fcb[_0x08d4('0x35')]=qs[_0x08d4('0x36')](_[_0x08d4('0x37')](_0x611a65['query'],_0x5c3ac9[_0x08d4('0x36')]),_0xb1620b);if(_0x611a65[_0x08d4('0x2b')][_0x08d4('0x38')]){_0x101fcb[_0x08d4('0x35')]=_[_0x08d4('0x39')](_0x101fcb[_0x08d4('0x35')],{'$or':_[_0x08d4('0x24')](_0xb1620b,function(_0x324e91){if(_0x324e91[_0x08d4('0x28')]!==_0x08d4('0x3a')){var _0x18e33a={};_0x18e33a[_0x324e91['name']]={'$like':'%'+_0x611a65['query'][_0x08d4('0x38')]+'%'};return _0x18e33a;}})});}_0x101fcb=_[_0x08d4('0x39')]({},_0x101fcb,_0x611a65['options']);var _0x266bcc={'where':_0x101fcb['where']};return db['Migration'][_0x08d4('0x18')](_0x266bcc)[_0x08d4('0x1d')](function(_0x30e8e2){_0x277f90[_0x08d4('0x18')]=_0x30e8e2;if(_0x611a65[_0x08d4('0x2b')][_0x08d4('0x3b')]){_0x101fcb[_0x08d4('0x3c')]=[{'all':!![]}];}return db[_0x08d4('0x25')]['findAll'](_0x101fcb);})[_0x08d4('0x1d')](function(_0x41ee37){_0x277f90[_0x08d4('0x3d')]=_0x41ee37;return _0x277f90;})['then'](respondWithFilteredResult(_0x1884cf,_0x101fcb))[_0x08d4('0x3e')](handleError(_0x1884cf,null));}; \ No newline at end of file +var _0x4bc7=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch'];(function(_0x52cbb2,_0x53c30c){var _0x11ec1e=function(_0x56d57e){while(--_0x56d57e){_0x52cbb2['push'](_0x52cbb2['shift']());}};_0x11ec1e(++_0x53c30c);}(_0x4bc7,0x1a4));var _0x74bc=function(_0x426fcf,_0x5b7ca1){_0x426fcf=_0x426fcf-0x0;var _0x4780ce=_0x4bc7[_0x426fcf];return _0x4780ce;};'use strict';var emlformat=require(_0x74bc('0x0'));var rimraf=require(_0x74bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74bc('0x2'));var rp=require(_0x74bc('0x3'));var moment=require('moment');var BPromise=require(_0x74bc('0x4'));var Mustache=require(_0x74bc('0x5'));var util=require(_0x74bc('0x6'));var path=require('path');var sox=require(_0x74bc('0x7'));var csv=require(_0x74bc('0x8'));var ejs=require(_0x74bc('0x9'));var fs=require('fs');var fs_extra=require(_0x74bc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74bc('0xb'));var deskjs=require(_0x74bc('0xc'));var toCsv=require(_0x74bc('0x8'));var querystring=require(_0x74bc('0xd'));var Papa=require('papaparse');var Redis=require(_0x74bc('0xe'));var authService=require(_0x74bc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x74bc('0x10'));var hardwareService=require(_0x74bc('0x11'));var logger=require('../../config/logger')(_0x74bc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74bc('0x13'))['db'];function respondWithStatusCode(_0x3c8540,_0x31fde8){_0x31fde8=_0x31fde8||0xcc;return function(_0x590802){if(_0x590802){return _0x3c8540[_0x74bc('0x14')](_0x31fde8);}return _0x3c8540['status'](_0x31fde8)['end']();};}function respondWithResult(_0x13f936,_0xdf4720){_0xdf4720=_0xdf4720||0xc8;return function(_0x381a22){if(_0x381a22){return _0x13f936[_0x74bc('0x15')](_0xdf4720)['json'](_0x381a22);}};}function respondWithFilteredResult(_0x2b2ab6,_0x3c9481){return function(_0x128c05){if(_0x128c05){var _0x3f3de3=typeof _0x3c9481['offset']===_0x74bc('0x16')&&typeof _0x3c9481[_0x74bc('0x17')]==='undefined';var _0x21ac14=_0x128c05[_0x74bc('0x18')];var _0x3752eb=_0x3f3de3?0x0:_0x3c9481['offset'];var _0x603262=_0x3f3de3?_0x128c05[_0x74bc('0x18')]:_0x3c9481[_0x74bc('0x19')]+_0x3c9481[_0x74bc('0x17')];var _0x416050;if(_0x603262>=_0x21ac14){_0x603262=_0x21ac14;_0x416050=0xc8;}else{_0x416050=0xce;}_0x2b2ab6[_0x74bc('0x15')](_0x416050);return _0x2b2ab6[_0x74bc('0x1a')](_0x74bc('0x1b'),_0x3752eb+'-'+_0x603262+'/'+_0x21ac14)['json'](_0x128c05);}return null;};}function patchUpdates(_0x329c4a){return function(_0x4f297e){try{jsonpatch[_0x74bc('0x1c')](_0x4f297e,_0x329c4a,!![]);}catch(_0x50ae85){return BPromise[_0x74bc('0x1d')](_0x50ae85);}return _0x4f297e[_0x74bc('0x1e')]();};}function saveUpdates(_0x4c4d0a,_0x10c1fa){return function(_0x2028d3){if(_0x2028d3){return _0x2028d3[_0x74bc('0x1f')](_0x4c4d0a)['then'](function(_0x435342){return _0x435342;});}return null;};}function removeEntity(_0x99faa1,_0x48de6a){return function(_0x38c7b5){if(_0x38c7b5){return _0x38c7b5['destroy']()[_0x74bc('0x20')](function(){_0x99faa1[_0x74bc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4804,_0xe90a6b){return function(_0x5a556d){if(!_0x5a556d){_0x4e4804[_0x74bc('0x14')](0x194);}return _0x5a556d;};}function handleError(_0x5b4001,_0x35cce7){_0x35cce7=_0x35cce7||0x1f4;return function(_0xc8b796){logger['error'](_0xc8b796[_0x74bc('0x21')]);if(_0xc8b796[_0x74bc('0x22')]){delete _0xc8b796[_0x74bc('0x22')];}_0x5b4001['status'](_0x35cce7)[_0x74bc('0x23')](_0xc8b796);};}exports[_0x74bc('0x24')]=function(_0x29a576,_0x42bf15){var _0x91f31d={},_0xc33f76={},_0x3239bc={'count':0x0,'rows':[]};var _0x236874=_['map'](db[_0x74bc('0x25')][_0x74bc('0x26')],function(_0x25d5d5){return{'name':_0x25d5d5['fieldName'],'type':_0x25d5d5[_0x74bc('0x27')]['key']};});_0xc33f76[_0x74bc('0x28')]=_[_0x74bc('0x29')](_0x236874,_0x74bc('0x22'));_0xc33f76['query']=_[_0x74bc('0x2a')](_0x29a576[_0x74bc('0x2b')]);_0xc33f76[_0x74bc('0x2c')]=_[_0x74bc('0x2d')](_0xc33f76[_0x74bc('0x28')],_0xc33f76['query']);_0x91f31d[_0x74bc('0x2e')]=_[_0x74bc('0x2d')](_0xc33f76[_0x74bc('0x28')],qs[_0x74bc('0x2f')](_0x29a576['query']['fields']));_0x91f31d[_0x74bc('0x2e')]=_0x91f31d[_0x74bc('0x2e')]['length']?_0x91f31d[_0x74bc('0x2e')]:_0xc33f76['model'];if(!_0x29a576[_0x74bc('0x2b')][_0x74bc('0x30')](_0x74bc('0x31'))){_0x91f31d['limit']=qs[_0x74bc('0x17')](_0x29a576[_0x74bc('0x2b')][_0x74bc('0x17')]);_0x91f31d[_0x74bc('0x19')]=qs[_0x74bc('0x19')](_0x29a576[_0x74bc('0x2b')][_0x74bc('0x19')]);}_0x91f31d[_0x74bc('0x32')]=qs[_0x74bc('0x33')](_0x29a576[_0x74bc('0x2b')]['sort']);_0x91f31d[_0x74bc('0x34')]=qs[_0x74bc('0x2c')](_['pick'](_0x29a576[_0x74bc('0x2b')],_0xc33f76[_0x74bc('0x2c')]),_0x236874);if(_0x29a576[_0x74bc('0x2b')][_0x74bc('0x35')]){_0x91f31d[_0x74bc('0x34')]=_[_0x74bc('0x36')](_0x91f31d[_0x74bc('0x34')],{'$or':_[_0x74bc('0x29')](_0x236874,function(_0x310b93){if(_0x310b93['type']!==_0x74bc('0x37')){var _0x27cb7d={};_0x27cb7d[_0x310b93['name']]={'$like':'%'+_0x29a576[_0x74bc('0x2b')][_0x74bc('0x35')]+'%'};return _0x27cb7d;}})});}_0x91f31d=_['merge']({},_0x91f31d,_0x29a576['options']);var _0x18f154={'where':_0x91f31d['where']};return db[_0x74bc('0x25')][_0x74bc('0x18')](_0x18f154)[_0x74bc('0x20')](function(_0x119c33){_0x3239bc[_0x74bc('0x18')]=_0x119c33;if(_0x29a576[_0x74bc('0x2b')][_0x74bc('0x38')]){_0x91f31d[_0x74bc('0x39')]=[{'all':!![]}];}return db[_0x74bc('0x25')][_0x74bc('0x3a')](_0x91f31d);})[_0x74bc('0x20')](function(_0x54357c){_0x3239bc['rows']=_0x54357c;return _0x3239bc;})[_0x74bc('0x20')](respondWithFilteredResult(_0x42bf15,_0x91f31d))[_0x74bc('0x3b')](handleError(_0x42bf15,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9957bd2..4e5ea87 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 _0xcbd3=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash'];(function(_0x249b04,_0x208607){var _0x3c17ad=function(_0x255ca5){while(--_0x255ca5){_0x249b04['push'](_0x249b04['shift']());}};_0x3c17ad(++_0x208607);}(_0xcbd3,0x185));var _0x3cbd=function(_0x335fee,_0x57bc55){_0x335fee=_0x335fee-0x0;var _0x5df754=_0xcbd3[_0x335fee];return _0x5df754;};'use strict';var _=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var logger=require(_0x3cbd('0x2'))('api');var moment=require(_0x3cbd('0x3'));var BPromise=require(_0x3cbd('0x4'));var rp=require(_0x3cbd('0x5'));var fs=require('fs');var path=require(_0x3cbd('0x6'));var rimraf=require(_0x3cbd('0x7'));var config=require(_0x3cbd('0x8'));var attributes=require(_0x3cbd('0x9'));module[_0x3cbd('0xa')]=function(_0x1f17c6,_0x5def8a){return _0x1f17c6[_0x3cbd('0xb')](_0x3cbd('0xc'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd304=['Migration','migrations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x6b3ae,_0x46829e){var _0x425750=function(_0x3ee744){while(--_0x3ee744){_0x6b3ae['push'](_0x6b3ae['shift']());}};_0x425750(++_0x46829e);}(_0xd304,0xce));var _0x4d30=function(_0x17c7de,_0x8a5de7){_0x17c7de=_0x17c7de-0x0;var _0x5b4ce4=_0xd304[_0x17c7de];return _0x5b4ce4;};'use strict';var _=require(_0x4d30('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d30('0x1'));var moment=require(_0x4d30('0x2'));var BPromise=require(_0x4d30('0x3'));var rp=require(_0x4d30('0x4'));var fs=require('fs');var path=require(_0x4d30('0x5'));var rimraf=require(_0x4d30('0x6'));var config=require(_0x4d30('0x7'));var attributes=require(_0x4d30('0x8'));module['exports']=function(_0x5c161b,_0x5045e1){return _0x5c161b[_0x4d30('0x9')](_0x4d30('0xa'),attributes,{'tableName':_0x4d30('0xb'),'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 61a591e..3feb994 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 _0xa571=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0xa571,0x107));var _0x1a57=function(_0x1b3eda,_0x4084a2){_0x1b3eda=_0x1b3eda-0x0;var _0x48812c=_0xa571[_0x1b3eda];return _0x48812c;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('Migration,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ No newline at end of file +var _0x8f37=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8f37,0x190));var _0x78f3=function(_0x30985e,_0xa2fc12){_0x30985e=_0x30985e-0x0;var _0x442630=_0x8f37[_0x30985e];return _0x442630;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var moment=require(_0x78f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f3('0x3'));var db=require(_0x78f3('0x4'))['db'];var utils=require(_0x78f3('0x5'));var logger=require('../../config/logger')(_0x78f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x78f3('0x7'));var client=jayson['client'][_0x78f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc185,_0x492dc7,_0x58bd73){return new BPromise(function(_0x55e353,_0x35d861){return client[_0x78f3('0x9')](_0x3dc185,_0x58bd73)['then'](function(_0x20c081){logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));logger[_0x78f3('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x492dc7,_0x78f3('0xc'),JSON[_0x78f3('0xe')](_0x20c081));if(_0x20c081['error']){if(_0x20c081[_0x78f3('0xf')][_0x78f3('0x10')]===0x1f4){logger[_0x78f3('0xf')]('Migration,\x20%s,\x20%s',_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x35d861(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x55e353(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}else{logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));_0x55e353(_0x20c081[_0x78f3('0x12')][_0x78f3('0x11')]);}})[_0x78f3('0x13')](function(_0x39adfc){logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x39adfc);_0x35d861(_0x39adfc);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bc1e0c9..1b751a4 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 _0x3457=['delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x5e092b,_0x233222){var _0x396697=function(_0x1e4b14){while(--_0x1e4b14){_0x5e092b['push'](_0x5e092b['shift']());}};_0x396697(++_0x233222);}(_0x3457,0x93));var _0x7345=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3457[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7345('0x0'));var router=express[_0x7345('0x1')]();var fs_extra=require(_0x7345('0x2'));var auth=require(_0x7345('0x3'));var interaction=require(_0x7345('0x4'));var config=require(_0x7345('0x5'));var controller=require('./network.controller');router[_0x7345('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7345('0x7'),auth[_0x7345('0x8')](),controller[_0x7345('0x9')]);router[_0x7345('0xa')]('/',auth[_0x7345('0x8')](),controller[_0x7345('0xb')]);router['put'](_0x7345('0x7'),auth[_0x7345('0x8')](),controller[_0x7345('0xc')]);router[_0x7345('0xd')]('/:id',auth[_0x7345('0x8')](),controller[_0x7345('0xe')]);module[_0x7345('0xf')]=router; \ No newline at end of file +var _0x9e8a=['/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0x4def26,_0x4fc754){var _0x1e0932=function(_0x79ea72){while(--_0x79ea72){_0x4def26['push'](_0x4def26['shift']());}};_0x1e0932(++_0x4fc754);}(_0x9e8a,0x112));var _0xa9e8=function(_0x5ddc32,_0x2f5670){_0x5ddc32=_0x5ddc32-0x0;var _0x3e03bf=_0x9e8a[_0x5ddc32];return _0x3e03bf;};'use strict';var multer=require(_0xa9e8('0x0'));var util=require(_0xa9e8('0x1'));var path=require(_0xa9e8('0x2'));var timeout=require(_0xa9e8('0x3'));var express=require(_0xa9e8('0x4'));var router=express[_0xa9e8('0x5')]();var fs_extra=require(_0xa9e8('0x6'));var auth=require(_0xa9e8('0x7'));var interaction=require(_0xa9e8('0x8'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa9e8('0x9')]);router[_0xa9e8('0xa')](_0xa9e8('0xb'),auth[_0xa9e8('0xc')](),controller[_0xa9e8('0xd')]);router['post']('/',auth[_0xa9e8('0xc')](),controller[_0xa9e8('0xe')]);router[_0xa9e8('0xf')](_0xa9e8('0xb'),auth['isAuthenticated'](),controller[_0xa9e8('0x10')]);router[_0xa9e8('0x11')](_0xa9e8('0xb'),auth[_0xa9e8('0xc')](),controller['destroy']);module[_0xa9e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1b4fa82..57c72c6 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 _0x3bb9=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x3ccd3d,_0x5db944){var _0x27ff3c=function(_0x1d31a9){while(--_0x1d31a9){_0x3ccd3d['push'](_0x3ccd3d['shift']());}};_0x27ff3c(++_0x5db944);}(_0x3bb9,0xee));var _0x93bb=function(_0x4e68b2,_0x3698d5){_0x4e68b2=_0x4e68b2-0x0;var _0x32ed13=_0x3bb9[_0x4e68b2];return _0x32ed13;};'use strict';var Sequelize=require(_0x93bb('0x0'));module[_0x93bb('0x1')]={'type':{'type':Sequelize[_0x93bb('0x2')](_0x93bb('0x3'),_0x93bb('0x4'),_0x93bb('0x5'),_0x93bb('0x6'))},'value':{'type':Sequelize[_0x93bb('0x7')]},'username':{'type':Sequelize[_0x93bb('0x7')]},'password':{'type':Sequelize[_0x93bb('0x7')]}}; \ No newline at end of file +var _0xe841=['ENUM','externip','turn','STRING','exports'];(function(_0x563234,_0x55fb4a){var _0x52061f=function(_0x395b12){while(--_0x395b12){_0x563234['push'](_0x563234['shift']());}};_0x52061f(++_0x55fb4a);}(_0xe841,0x13f));var _0x1e84=function(_0x84353f,_0x11f17a){_0x84353f=_0x84353f-0x0;var _0x2f449c=_0xe841[_0x84353f];return _0x2f449c;};'use strict';var Sequelize=require('sequelize');module[_0x1e84('0x0')]={'type':{'type':Sequelize[_0x1e84('0x1')]('localnet',_0x1e84('0x2'),'stun',_0x1e84('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1e84('0x4')]},'password':{'type':Sequelize[_0x1e84('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 68b1d21..36b1457 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 _0xb28a=['server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','toLowerCase','chan_sip.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','intersection','options','find','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','join'];(function(_0x5638e2,_0x2436c7){var _0x485065=function(_0x1a7724){while(--_0x1a7724){_0x5638e2['push'](_0x5638e2['shift']());}};_0x485065(++_0x2436c7);}(_0xb28a,0x10d));var _0xab28=function(_0x519f83,_0x2fe0ce){_0x519f83=_0x519f83-0x0;var _0x257434=_0xb28a[_0x519f83];return _0x257434;};'use strict';var util=require(_0xab28('0x0'));var path=require(_0xab28('0x1'));var ejs=require(_0xab28('0x2'));var fs=require('fs');var _=require(_0xab28('0x3'));var qs=require(_0xab28('0x4'));var logger=require(_0xab28('0x5'))(_0xab28('0x6'));var config=require(_0xab28('0x7'));var db=require(_0xab28('0x8'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xab28('0x9')][_0xab28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6b0a,_0x471e65,_0x1cbe07,_0x8327e0){return new Promise(function(_0x4a86c3,_0x191eb8){var _0xf4348c=_0x8327e0||client;return _0xf4348c[_0xab28('0xb')](_0x1a6b0a,_0x1cbe07)[_0xab28('0xc')](function(_0x13e085){logger['info'](_0xab28('0xd'),_0x471e65,_0xab28('0xe'));logger['debug'](_0xab28('0xf'),_0x471e65,_0xab28('0xe'),JSON[_0xab28('0x10')](_0x13e085));if(_0x13e085['error']){if(_0x13e085[_0xab28('0x11')][_0xab28('0x12')]===0x1f4){logger[_0xab28('0x11')]('Network,\x20%s,\x20%s',_0x471e65,_0x13e085[_0xab28('0x11')][_0xab28('0x13')]);return _0x191eb8(_0x13e085['error']['message']);}logger[_0xab28('0x11')](_0xab28('0xd'),_0x471e65,_0x13e085[_0xab28('0x11')][_0xab28('0x13')]);return _0x4a86c3(_0x13e085['error'][_0xab28('0x13')]);}else{logger['info'](_0xab28('0xd'),_0x471e65,_0xab28('0xe'));_0x4a86c3(_0x13e085['result'][_0xab28('0x13')]);}})[_0xab28('0x14')](function(_0x2659f0){logger[_0xab28('0x11')](_0xab28('0xd'),_0x471e65,_0x2659f0);_0x191eb8(_0x2659f0);});});}function respondWithResult(_0x7e652b,_0x3bbf91){_0x3bbf91=_0x3bbf91||0xc8;return function(_0x1429e5){if(_0x1429e5){return _0x7e652b[_0xab28('0x15')](_0x3bbf91)['json'](_0x1429e5);}};}function respondWithFilteredResult(_0x2776ba,_0x54fe7f){return function(_0x3efdc3){if(_0x3efdc3){var _0x1cbc68=typeof _0x54fe7f[_0xab28('0x16')]===_0xab28('0x17')&&typeof _0x54fe7f[_0xab28('0x18')]===_0xab28('0x17');var _0x5b4448=_0x3efdc3['count'];var _0x3f30a5=_0x1cbc68?0x0:_0x54fe7f[_0xab28('0x16')];var _0x25149f=_0x1cbc68?_0x3efdc3[_0xab28('0x19')]:_0x54fe7f[_0xab28('0x16')]+_0x54fe7f[_0xab28('0x18')];var _0x30b245;if(_0x25149f>=_0x5b4448){_0x25149f=_0x5b4448;_0x30b245=0xc8;}else{_0x30b245=0xce;}_0x2776ba[_0xab28('0x15')](_0x30b245);return _0x2776ba[_0xab28('0x1a')](_0xab28('0x1b'),_0x3f30a5+'-'+_0x25149f+'/'+_0x5b4448)[_0xab28('0x1c')](_0x3efdc3);}return null;};}function saveUpdates(_0x322afc){return function(_0x3c063f){if(_0x3c063f){return _0x3c063f[_0xab28('0x1d')](_0x322afc)[_0xab28('0xc')](function(_0x4ca4a8){return _0x4ca4a8;});}return null;};}function removeEntity(_0x416834){return function(_0x5f5c1c){if(_0x5f5c1c){return _0x5f5c1c[_0xab28('0x1e')]()['then'](function(){_0x416834[_0xab28('0x15')](0xcc)[_0xab28('0x1f')]();});}};}function handleEntityNotFound(_0x2aac93){return function(_0x5d4da4){if(!_0x5d4da4){_0x2aac93[_0xab28('0x20')](0x194);}return _0x5d4da4;};}function handleError(_0x390b78,_0x11e332){_0x11e332=_0x11e332||0x1f4;return function(_0x430e55){logger[_0xab28('0x11')](_0x430e55[_0xab28('0x21')]);if(_0x430e55[_0xab28('0x22')]){delete _0x430e55['name'];}_0x390b78[_0xab28('0x15')](_0x11e332)[_0xab28('0x23')](_0x430e55);};}exports[_0xab28('0x24')]=function(_0x46a467,_0x598054){var _0x531671={},_0xf39be1={},_0x294b5d={'count':0x0,'rows':[]};var _0x486d83=_['map'](db[_0xab28('0x25')][_0xab28('0x26')],function(_0x1f6605){return{'name':_0x1f6605[_0xab28('0x27')],'type':_0x1f6605[_0xab28('0x28')]['key']};});_0xf39be1[_0xab28('0x29')]=_[_0xab28('0x2a')](_0x486d83,_0xab28('0x22'));_0xf39be1[_0xab28('0x2b')]=_['keys'](_0x46a467['query']);_0xf39be1[_0xab28('0x2c')]=_['intersection'](_0xf39be1[_0xab28('0x29')],_0xf39be1[_0xab28('0x2b')]);_0x531671[_0xab28('0x2d')]=_['intersection'](_0xf39be1['model'],qs[_0xab28('0x2e')](_0x46a467[_0xab28('0x2b')][_0xab28('0x2e')]));_0x531671['attributes']=_0x531671['attributes'][_0xab28('0x2f')]?_0x531671[_0xab28('0x2d')]:_0xf39be1[_0xab28('0x29')];if(!_0x46a467[_0xab28('0x2b')][_0xab28('0x30')]('nolimit')){_0x531671[_0xab28('0x18')]=qs[_0xab28('0x18')](_0x46a467[_0xab28('0x2b')]['limit']);_0x531671[_0xab28('0x16')]=qs['offset'](_0x46a467[_0xab28('0x2b')][_0xab28('0x16')]);}_0x531671[_0xab28('0x31')]=qs[_0xab28('0x32')](_0x46a467['query'][_0xab28('0x32')]);_0x531671[_0xab28('0x33')]=qs[_0xab28('0x2c')](_[_0xab28('0x34')](_0x46a467[_0xab28('0x2b')],_0xf39be1[_0xab28('0x2c')]),_0x486d83);if(_0x46a467[_0xab28('0x2b')][_0xab28('0x35')]){_0x531671[_0xab28('0x33')]=_[_0xab28('0x36')](_0x531671[_0xab28('0x33')],{'$or':_[_0xab28('0x2a')](_0x486d83,function(_0x4b5376){if(_0x4b5376[_0xab28('0x28')]!==_0xab28('0x37')){var _0x91b15f={};_0x91b15f[_0x4b5376[_0xab28('0x22')]]={'$like':'%'+_0x46a467[_0xab28('0x2b')][_0xab28('0x35')]+'%'};return _0x91b15f;}})});}_0x531671=_[_0xab28('0x36')]({},_0x531671,_0x46a467['options']);var _0x75154e={'where':_0x531671['where']};return db[_0xab28('0x25')][_0xab28('0x19')](_0x75154e)[_0xab28('0xc')](function(_0x25c4f1){_0x294b5d[_0xab28('0x19')]=_0x25c4f1;if(_0x46a467['query'][_0xab28('0x38')]){_0x531671[_0xab28('0x39')]=[{'all':!![]}];}return db[_0xab28('0x25')][_0xab28('0x3a')](_0x531671);})[_0xab28('0xc')](function(_0x57df87){_0x294b5d[_0xab28('0x3b')]=_0x57df87;return _0x294b5d;})['then'](respondWithFilteredResult(_0x598054,_0x531671))[_0xab28('0x14')](handleError(_0x598054,null));};exports['show']=function(_0x50c8bc,_0x5e6aa4){var _0x39626a={'raw':!![],'where':{'id':_0x50c8bc[_0xab28('0x3c')]['id']}},_0x348d6d={};_0x348d6d['model']=_[_0xab28('0x3d')](db[_0xab28('0x25')]['rawAttributes']);_0x348d6d[_0xab28('0x2b')]=_[_0xab28('0x3d')](_0x50c8bc[_0xab28('0x2b')]);_0x348d6d['filters']=_['intersection'](_0x348d6d[_0xab28('0x29')],_0x348d6d[_0xab28('0x2b')]);_0x39626a[_0xab28('0x2d')]=_[_0xab28('0x3e')](_0x348d6d[_0xab28('0x29')],qs['fields'](_0x50c8bc['query']['fields']));_0x39626a[_0xab28('0x2d')]=_0x39626a[_0xab28('0x2d')][_0xab28('0x2f')]?_0x39626a[_0xab28('0x2d')]:_0x348d6d[_0xab28('0x29')];if(_0x50c8bc[_0xab28('0x2b')][_0xab28('0x38')]){_0x39626a[_0xab28('0x39')]=[{'all':!![]}];}_0x39626a=_[_0xab28('0x36')]({},_0x39626a,_0x50c8bc[_0xab28('0x3f')]);return db[_0xab28('0x25')][_0xab28('0x40')](_0x39626a)[_0xab28('0xc')](handleEntityNotFound(_0x5e6aa4,null))[_0xab28('0xc')](respondWithResult(_0x5e6aa4,null))['catch'](handleError(_0x5e6aa4,null));};exports[_0xab28('0x41')]=function(_0x5626a2,_0x24e5d0){var _0x20ca32;return db[_0xab28('0x25')][_0xab28('0x41')](_0x5626a2[_0xab28('0x42')],{'raw':!![]})[_0xab28('0xc')](function(_0x4df012){_0x20ca32=_0x4df012;return db['Network'][_0xab28('0x3a')]({'where':{'type':_0x5626a2['body']['type']},'raw':!![]});})[_0xab28('0xc')](function(_0x52cd16){if(_0x20ca32[_0xab28('0x28')][_0xab28('0x43')]()==_0xab28('0x44')){var _0x42b667=fs['readFileSync'](path['join'](config[_0xab28('0x45')],_0xab28('0x46')),_0xab28('0x47'));var _0xafd17d=ejs[_0xab28('0x48')](_0x42b667,{'networks':_0x52cd16||[]});fs[_0xab28('0x49')](_0xab28('0x4a'),_0xafd17d);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x41'),{'module':'res_stun_monitor.so'});}else if(_0x20ca32['type'][_0xab28('0x43')]()==_0xab28('0x4c')){var _0x53eda1=fs[_0xab28('0x4d')](path[_0xab28('0x4e')](config[_0xab28('0x45')],_0xab28('0x4f')),_0xab28('0x47'));var _0x15cafa=ejs['render'](_0x53eda1,{'networks':_0x52cd16||[]});fs['writeFileSync'](_0xab28('0x50'),_0x15cafa);return respondWithRpcPromise('Reload','create',{'module':_0xab28('0x51')});}else{var _0x523633=fs[_0xab28('0x4d')](path[_0xab28('0x4e')](config['root'],'server/files/templates/network.ejs'),_0xab28('0x47'));var _0x513d72=ejs[_0xab28('0x48')](_0x523633,{'networks':_0x52cd16||[]});fs[_0xab28('0x49')](util[_0xab28('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x5626a2[_0xab28('0x42')][_0xab28('0x28')][_0xab28('0x53')]()),_0x513d72);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x41'),{'module':_0xab28('0x54')});}})[_0xab28('0xc')](function(){return _0x20ca32;})[_0xab28('0xc')](respondWithResult(_0x24e5d0,0xc9))['catch'](handleError(_0x24e5d0,null));};exports['update']=function(_0x4f7e22,_0x22fde9){var _0x29f536;return db[_0xab28('0x25')][_0xab28('0x40')]({'where':{'id':_0x4f7e22['params']['id']}})['then'](handleEntityNotFound(_0x22fde9,null))[_0xab28('0xc')](saveUpdates(_0x4f7e22[_0xab28('0x42')],null))[_0xab28('0xc')](function(_0x5c01ce){if(_0x5c01ce){_0x29f536=_0x5c01ce;return db[_0xab28('0x25')][_0xab28('0x3a')]({'where':{'type':_0x29f536['type']},'raw':!![]});}return null;})[_0xab28('0xc')](function(_0x323706){if(_0x29f536[_0xab28('0x28')][_0xab28('0x43')]()==_0xab28('0x44')){var _0x19f74f=fs[_0xab28('0x4d')](path[_0xab28('0x4e')](config[_0xab28('0x45')],_0xab28('0x46')),'utf8');var _0x290482=ejs[_0xab28('0x48')](_0x19f74f,{'networks':_0x323706||[]});fs[_0xab28('0x49')](_0xab28('0x4a'),_0x290482);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x1d'),{'module':_0xab28('0x51')});}else if(_0x29f536[_0xab28('0x28')][_0xab28('0x43')]()==_0xab28('0x4c')){var _0x808b92=fs['readFileSync'](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xab28('0x47'));var _0xb274d7=ejs[_0xab28('0x48')](_0x808b92,{'networks':_0x323706||[]});fs[_0xab28('0x49')](_0xab28('0x50'),_0xb274d7);return respondWithRpcPromise('Reload',_0xab28('0x1d'),{'module':_0xab28('0x51')});}else{var _0x2d9a18=fs['readFileSync'](path[_0xab28('0x4e')](config['root'],_0xab28('0x55')),'utf8');var _0x221c18=ejs[_0xab28('0x48')](_0x2d9a18,{'networks':_0x323706||[]});fs['writeFileSync'](util[_0xab28('0x52')](_0xab28('0x56'),_0x4f7e22['body'][_0xab28('0x28')][_0xab28('0x53')]()),_0x221c18);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x1d'),{'module':_0xab28('0x54')});}})[_0xab28('0xc')](function(_0x57ba6e){if(_0x57ba6e){return _0x29f536;}return null;})[_0xab28('0xc')](respondWithResult(_0x22fde9,null))[_0xab28('0x14')](handleError(_0x22fde9,null));};exports['destroy']=function(_0x302b79,_0x82fa4a){var _0x403a79;return db[_0xab28('0x25')][_0xab28('0x40')]({'where':{'id':_0x302b79['params']['id']}})[_0xab28('0xc')](function(_0x8cb7c1){_0x403a79=_0x8cb7c1;return _0x8cb7c1;})[_0xab28('0xc')](handleEntityNotFound(_0x82fa4a,null))['then'](removeEntity(_0x82fa4a,null))['then'](function(){if(_0x403a79){return db['Network'][_0xab28('0x3a')]({'where':{'type':_0x403a79[_0xab28('0x28')]},'raw':!![]});}})[_0xab28('0xc')](function(_0x4a603c){if(_0x403a79[_0xab28('0x28')]['toUpperCase']()==_0xab28('0x44')){var _0x503857=fs[_0xab28('0x4d')](path[_0xab28('0x4e')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x563e42=ejs[_0xab28('0x48')](_0x503857,{'networks':_0x4a603c||[]});fs[_0xab28('0x49')](_0xab28('0x4a'),_0x563e42);return respondWithRpcPromise('Reload','destroy',{'module':_0xab28('0x51')});}else if(_0x403a79[_0xab28('0x28')][_0xab28('0x43')]()=='TURN'){var _0x272e83=fs[_0xab28('0x4d')](path['join'](config[_0xab28('0x45')],'server/files/templates/turn_multiple.ejs'),_0xab28('0x47'));var _0x2fe309=ejs['render'](_0x272e83,{'networks':_0x4a603c||[]});fs[_0xab28('0x49')](_0xab28('0x50'),_0x2fe309);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x1e'),{'module':_0xab28('0x51')});}else{var _0x3e95c7=fs[_0xab28('0x4d')](path[_0xab28('0x4e')](config[_0xab28('0x45')],'server/files/templates/network.ejs'),'utf8');var _0x40fdca=ejs[_0xab28('0x48')](_0x3e95c7,{'networks':_0x4a603c||[]});fs[_0xab28('0x49')](util[_0xab28('0x52')](_0xab28('0x56'),_0x403a79[_0xab28('0x28')]['toLowerCase']()),_0x40fdca);return respondWithRpcPromise(_0xab28('0x4b'),_0xab28('0x1e'),{'module':_0xab28('0x54')});}})[_0xab28('0x14')](handleError(_0x82fa4a,null));}; \ No newline at end of file +var _0xc7c2=['update','then','destroy','name','send','index','map','Network','rawAttributes','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','rows','params','keys','length','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x3add04,_0x496410){var _0x2dccb2=function(_0x34d99a){while(--_0x34d99a){_0x3add04['push'](_0x3add04['shift']());}};_0x2dccb2(++_0x496410);}(_0xc7c2,0x13b));var _0x2c7c=function(_0x5d5125,_0xb6224f){_0x5d5125=_0x5d5125-0x0;var _0x1443a1=_0xc7c2[_0x5d5125];return _0x1443a1;};'use strict';var util=require(_0x2c7c('0x0'));var path=require(_0x2c7c('0x1'));var ejs=require(_0x2c7c('0x2'));var fs=require('fs');var _=require(_0x2c7c('0x3'));var qs=require(_0x2c7c('0x4'));var logger=require(_0x2c7c('0x5'))(_0x2c7c('0x6'));var config=require(_0x2c7c('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2c7c('0x8'));var client=jayson[_0x2c7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b984d,_0x3b84f8,_0x40bb93,_0x3e65d1){return new Promise(function(_0x247336,_0xb71d45){var _0x3f696d=_0x3e65d1||client;return _0x3f696d[_0x2c7c('0xa')](_0x5b984d,_0x40bb93)['then'](function(_0x357b40){logger['info'](_0x2c7c('0xb'),_0x3b84f8,_0x2c7c('0xc'));logger[_0x2c7c('0xd')](_0x2c7c('0xe'),_0x3b84f8,'request\x20sent',JSON[_0x2c7c('0xf')](_0x357b40));if(_0x357b40[_0x2c7c('0x10')]){if(_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x11')]===0x1f4){logger[_0x2c7c('0x10')](_0x2c7c('0xb'),_0x3b84f8,_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x12')]);return _0xb71d45(_0x357b40[_0x2c7c('0x10')]['message']);}logger['error'](_0x2c7c('0xb'),_0x3b84f8,_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x12')]);return _0x247336(_0x357b40['error'][_0x2c7c('0x12')]);}else{logger[_0x2c7c('0x13')](_0x2c7c('0xb'),_0x3b84f8,_0x2c7c('0xc'));_0x247336(_0x357b40['result'][_0x2c7c('0x12')]);}})[_0x2c7c('0x14')](function(_0x368803){logger[_0x2c7c('0x10')](_0x2c7c('0xb'),_0x3b84f8,_0x368803);_0xb71d45(_0x368803);});});}function respondWithResult(_0x4b8531,_0x31df8c){_0x31df8c=_0x31df8c||0xc8;return function(_0x59a45c){if(_0x59a45c){return _0x4b8531[_0x2c7c('0x15')](_0x31df8c)[_0x2c7c('0x16')](_0x59a45c);}};}function respondWithFilteredResult(_0x1c9846,_0x5088d5){return function(_0x2d081c){if(_0x2d081c){var _0x59c96a=typeof _0x5088d5[_0x2c7c('0x17')]==='undefined'&&typeof _0x5088d5['limit']===_0x2c7c('0x18');var _0xd7b2d9=_0x2d081c[_0x2c7c('0x19')];var _0xd44f8d=_0x59c96a?0x0:_0x5088d5['offset'];var _0xd947aa=_0x59c96a?_0x2d081c[_0x2c7c('0x19')]:_0x5088d5[_0x2c7c('0x17')]+_0x5088d5[_0x2c7c('0x1a')];var _0x491d2c;if(_0xd947aa>=_0xd7b2d9){_0xd947aa=_0xd7b2d9;_0x491d2c=0xc8;}else{_0x491d2c=0xce;}_0x1c9846[_0x2c7c('0x15')](_0x491d2c);return _0x1c9846[_0x2c7c('0x1b')](_0x2c7c('0x1c'),_0xd44f8d+'-'+_0xd947aa+'/'+_0xd7b2d9)[_0x2c7c('0x16')](_0x2d081c);}return null;};}function saveUpdates(_0x16100f){return function(_0x31b9ae){if(_0x31b9ae){return _0x31b9ae[_0x2c7c('0x1d')](_0x16100f)[_0x2c7c('0x1e')](function(_0x21497a){return _0x21497a;});}return null;};}function removeEntity(_0x11b0fa){return function(_0x226654){if(_0x226654){return _0x226654[_0x2c7c('0x1f')]()['then'](function(){_0x11b0fa[_0x2c7c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ded11){return function(_0x1ad2df){if(!_0x1ad2df){_0x2ded11['sendStatus'](0x194);}return _0x1ad2df;};}function handleError(_0x378fad,_0x18d9c4){_0x18d9c4=_0x18d9c4||0x1f4;return function(_0x2717fd){logger[_0x2c7c('0x10')](_0x2717fd['stack']);if(_0x2717fd[_0x2c7c('0x20')]){delete _0x2717fd[_0x2c7c('0x20')];}_0x378fad[_0x2c7c('0x15')](_0x18d9c4)[_0x2c7c('0x21')](_0x2717fd);};}exports[_0x2c7c('0x22')]=function(_0x2a6b1e,_0x92a336){var _0x3ba817={},_0x23b3e3={},_0x32f073={'count':0x0,'rows':[]};var _0x196f0e=_[_0x2c7c('0x23')](db[_0x2c7c('0x24')][_0x2c7c('0x25')],function(_0x3a6232){return{'name':_0x3a6232['fieldName'],'type':_0x3a6232['type'][_0x2c7c('0x26')]};});_0x23b3e3[_0x2c7c('0x27')]=_[_0x2c7c('0x23')](_0x196f0e,'name');_0x23b3e3[_0x2c7c('0x28')]=_['keys'](_0x2a6b1e[_0x2c7c('0x28')]);_0x23b3e3['filters']=_['intersection'](_0x23b3e3[_0x2c7c('0x27')],_0x23b3e3[_0x2c7c('0x28')]);_0x3ba817[_0x2c7c('0x29')]=_[_0x2c7c('0x2a')](_0x23b3e3['model'],qs['fields'](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2b')]));_0x3ba817['attributes']=_0x3ba817[_0x2c7c('0x29')]['length']?_0x3ba817['attributes']:_0x23b3e3[_0x2c7c('0x27')];if(!_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2c')](_0x2c7c('0x2d'))){_0x3ba817[_0x2c7c('0x1a')]=qs[_0x2c7c('0x1a')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x1a')]);_0x3ba817[_0x2c7c('0x17')]=qs[_0x2c7c('0x17')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x17')]);}_0x3ba817[_0x2c7c('0x2e')]=qs[_0x2c7c('0x2f')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2f')]);_0x3ba817[_0x2c7c('0x30')]=qs['filters'](_[_0x2c7c('0x31')](_0x2a6b1e[_0x2c7c('0x28')],_0x23b3e3[_0x2c7c('0x32')]),_0x196f0e);if(_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x33')]){_0x3ba817[_0x2c7c('0x30')]=_['merge'](_0x3ba817[_0x2c7c('0x30')],{'$or':_['map'](_0x196f0e,function(_0x4b213b){if(_0x4b213b[_0x2c7c('0x34')]!==_0x2c7c('0x35')){var _0x3818b5={};_0x3818b5[_0x4b213b[_0x2c7c('0x20')]]={'$like':'%'+_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x33')]+'%'};return _0x3818b5;}})});}_0x3ba817=_[_0x2c7c('0x36')]({},_0x3ba817,_0x2a6b1e[_0x2c7c('0x37')]);var _0x15c0f4={'where':_0x3ba817['where']};return db['Network'][_0x2c7c('0x19')](_0x15c0f4)[_0x2c7c('0x1e')](function(_0x12a297){_0x32f073['count']=_0x12a297;if(_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x38')]){_0x3ba817[_0x2c7c('0x39')]=[{'all':!![]}];}return db['Network']['findAll'](_0x3ba817);})[_0x2c7c('0x1e')](function(_0xc752b7){_0x32f073[_0x2c7c('0x3a')]=_0xc752b7;return _0x32f073;})[_0x2c7c('0x1e')](respondWithFilteredResult(_0x92a336,_0x3ba817))[_0x2c7c('0x14')](handleError(_0x92a336,null));};exports['show']=function(_0x5b187a,_0x3a8277){var _0x1fc1e4={'raw':!![],'where':{'id':_0x5b187a[_0x2c7c('0x3b')]['id']}},_0x9d5ac5={};_0x9d5ac5[_0x2c7c('0x27')]=_[_0x2c7c('0x3c')](db['Network']['rawAttributes']);_0x9d5ac5[_0x2c7c('0x28')]=_[_0x2c7c('0x3c')](_0x5b187a['query']);_0x9d5ac5['filters']=_[_0x2c7c('0x2a')](_0x9d5ac5[_0x2c7c('0x27')],_0x9d5ac5[_0x2c7c('0x28')]);_0x1fc1e4[_0x2c7c('0x29')]=_['intersection'](_0x9d5ac5[_0x2c7c('0x27')],qs[_0x2c7c('0x2b')](_0x5b187a['query'][_0x2c7c('0x2b')]));_0x1fc1e4[_0x2c7c('0x29')]=_0x1fc1e4[_0x2c7c('0x29')][_0x2c7c('0x3d')]?_0x1fc1e4[_0x2c7c('0x29')]:_0x9d5ac5[_0x2c7c('0x27')];if(_0x5b187a['query'][_0x2c7c('0x38')]){_0x1fc1e4['include']=[{'all':!![]}];}_0x1fc1e4=_['merge']({},_0x1fc1e4,_0x5b187a[_0x2c7c('0x37')]);return db[_0x2c7c('0x24')][_0x2c7c('0x3e')](_0x1fc1e4)[_0x2c7c('0x1e')](handleEntityNotFound(_0x3a8277,null))[_0x2c7c('0x1e')](respondWithResult(_0x3a8277,null))[_0x2c7c('0x14')](handleError(_0x3a8277,null));};exports[_0x2c7c('0x3f')]=function(_0x54094e,_0x446eba){var _0x597612;return db[_0x2c7c('0x24')][_0x2c7c('0x3f')](_0x54094e[_0x2c7c('0x40')],{'raw':!![]})['then'](function(_0x439636){_0x597612=_0x439636;return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x54094e['body'][_0x2c7c('0x34')]},'raw':!![]});})[_0x2c7c('0x1e')](function(_0x203ae7){if(_0x597612[_0x2c7c('0x34')][_0x2c7c('0x42')]()==_0x2c7c('0x43')){var _0x2a715c=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],_0x2c7c('0x47')),_0x2c7c('0x48'));var _0x2da2fd=ejs[_0x2c7c('0x49')](_0x2a715c,{'networks':_0x203ae7||[]});fs[_0x2c7c('0x4a')](_0x2c7c('0x4b'),_0x2da2fd);return respondWithRpcPromise('Reload',_0x2c7c('0x3f'),{'module':_0x2c7c('0x4c')});}else if(_0x597612[_0x2c7c('0x34')]['toUpperCase']()==_0x2c7c('0x4d')){var _0x4d3bb0=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/turn_multiple.ejs'),_0x2c7c('0x48'));var _0x209cec=ejs[_0x2c7c('0x49')](_0x4d3bb0,{'networks':_0x203ae7||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0x209cec);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x3f'),{'module':_0x2c7c('0x4c')});}else{var _0x5acb9e=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/network.ejs'),_0x2c7c('0x48'));var _0x153d72=ejs[_0x2c7c('0x49')](_0x5acb9e,{'networks':_0x203ae7||[]});fs[_0x2c7c('0x4a')](util[_0x2c7c('0x50')](_0x2c7c('0x51'),_0x54094e[_0x2c7c('0x40')][_0x2c7c('0x34')][_0x2c7c('0x52')]()),_0x153d72);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x3f'),{'module':_0x2c7c('0x53')});}})[_0x2c7c('0x1e')](function(){return _0x597612;})[_0x2c7c('0x1e')](respondWithResult(_0x446eba,0xc9))['catch'](handleError(_0x446eba,null));};exports[_0x2c7c('0x1d')]=function(_0x3fbe00,_0x297d0d){var _0x527070;return db[_0x2c7c('0x24')]['find']({'where':{'id':_0x3fbe00[_0x2c7c('0x3b')]['id']}})[_0x2c7c('0x1e')](handleEntityNotFound(_0x297d0d,null))[_0x2c7c('0x1e')](saveUpdates(_0x3fbe00[_0x2c7c('0x40')],null))['then'](function(_0x2958e1){if(_0x2958e1){_0x527070=_0x2958e1;return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x527070[_0x2c7c('0x34')]},'raw':!![]});}return null;})['then'](function(_0x627a6f){if(_0x527070[_0x2c7c('0x34')][_0x2c7c('0x42')]()=='STUN'){var _0x274bfa=fs['readFileSync'](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],_0x2c7c('0x47')),_0x2c7c('0x48'));var _0x28cc23=ejs[_0x2c7c('0x49')](_0x274bfa,{'networks':_0x627a6f||[]});fs[_0x2c7c('0x4a')](_0x2c7c('0x4b'),_0x28cc23);return respondWithRpcPromise('Reload',_0x2c7c('0x1d'),{'module':_0x2c7c('0x4c')});}else if(_0x527070[_0x2c7c('0x34')][_0x2c7c('0x42')]()==_0x2c7c('0x4d')){var _0x33bcd1=fs[_0x2c7c('0x44')](path['join'](config[_0x2c7c('0x46')],'server/files/templates/turn_multiple.ejs'),_0x2c7c('0x48'));var _0xb7d56=ejs['render'](_0x33bcd1,{'networks':_0x627a6f||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0xb7d56);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x1d'),{'module':_0x2c7c('0x4c')});}else{var _0x4aac5f=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/network.ejs'),_0x2c7c('0x48'));var _0x2e75f3=ejs[_0x2c7c('0x49')](_0x4aac5f,{'networks':_0x627a6f||[]});fs[_0x2c7c('0x4a')](util['format'](_0x2c7c('0x51'),_0x3fbe00[_0x2c7c('0x40')][_0x2c7c('0x34')][_0x2c7c('0x52')]()),_0x2e75f3);return respondWithRpcPromise(_0x2c7c('0x4f'),'update',{'module':'chan_sip.so'});}})[_0x2c7c('0x1e')](function(_0x4e986a){if(_0x4e986a){return _0x527070;}return null;})[_0x2c7c('0x1e')](respondWithResult(_0x297d0d,null))[_0x2c7c('0x14')](handleError(_0x297d0d,null));};exports['destroy']=function(_0x14d061,_0x47f97d){var _0x4f9f3e;return db[_0x2c7c('0x24')][_0x2c7c('0x3e')]({'where':{'id':_0x14d061['params']['id']}})[_0x2c7c('0x1e')](function(_0x5a7f34){_0x4f9f3e=_0x5a7f34;return _0x5a7f34;})[_0x2c7c('0x1e')](handleEntityNotFound(_0x47f97d,null))[_0x2c7c('0x1e')](removeEntity(_0x47f97d,null))[_0x2c7c('0x1e')](function(){if(_0x4f9f3e){return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x4f9f3e[_0x2c7c('0x34')]},'raw':!![]});}})[_0x2c7c('0x1e')](function(_0x633a4b){if(_0x4f9f3e['type'][_0x2c7c('0x42')]()==_0x2c7c('0x43')){var _0x219dd6=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config['root'],_0x2c7c('0x47')),'utf8');var _0x144e7a=ejs[_0x2c7c('0x49')](_0x219dd6,{'networks':_0x633a4b||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x144e7a);return respondWithRpcPromise(_0x2c7c('0x4f'),'destroy',{'module':_0x2c7c('0x4c')});}else if(_0x4f9f3e['type'][_0x2c7c('0x42')]()==_0x2c7c('0x4d')){var _0x2a4bf3=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config['root'],_0x2c7c('0x54')),_0x2c7c('0x48'));var _0x5e9401=ejs[_0x2c7c('0x49')](_0x2a4bf3,{'networks':_0x633a4b||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0x5e9401);return respondWithRpcPromise('Reload',_0x2c7c('0x1f'),{'module':_0x2c7c('0x4c')});}else{var _0x31b8c8=fs[_0x2c7c('0x44')](path['join'](config[_0x2c7c('0x46')],_0x2c7c('0x55')),_0x2c7c('0x48'));var _0x2ed260=ejs[_0x2c7c('0x49')](_0x31b8c8,{'networks':_0x633a4b||[]});fs[_0x2c7c('0x4a')](util[_0x2c7c('0x50')](_0x2c7c('0x51'),_0x4f9f3e[_0x2c7c('0x34')]['toLowerCase']()),_0x2ed260);return respondWithRpcPromise('Reload',_0x2c7c('0x1f'),{'module':_0x2c7c('0x53')});}})[_0x2c7c('0x14')](handleError(_0x47f97d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5d04e4c..e501db3 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 _0x5b02=['define','Network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x307163,_0x3b041c){var _0x726a2b=function(_0x10b856){while(--_0x10b856){_0x307163['push'](_0x307163['shift']());}};_0x726a2b(++_0x3b041c);}(_0x5b02,0xe9));var _0x25b0=function(_0x1a3caa,_0x1f2ffb){_0x1a3caa=_0x1a3caa-0x0;var _0x127fca=_0x5b02[_0x1a3caa];return _0x127fca;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x235a=['exports','Network','network','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0x235a,0x1ef));var _0xa235=function(_0x28aeb8,_0x219a45){_0x28aeb8=_0x28aeb8-0x0;var _0x54d600=_0x235a[_0x28aeb8];return _0x54d600;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))('api');var moment=require(_0xa235('0x3'));var BPromise=require('bluebird');var rp=require(_0xa235('0x4'));var fs=require('fs');var path=require(_0xa235('0x5'));var rimraf=require(_0xa235('0x6'));var config=require(_0xa235('0x7'));var attributes=require(_0xa235('0x8'));module[_0xa235('0x9')]=function(_0x2961c8,_0x1707fc){return _0x2961c8['define'](_0xa235('0xa'),attributes,{'tableName':_0xa235('0xb'),'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 1ca5786..9030ed7 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(_0x3f47c0,_0x4dfa32){var _0x4d9378=function(_0x185b5e){while(--_0x185b5e){_0x3f47c0['push'](_0x3f47c0['shift']());}};_0x4d9378(++_0x4dfa32);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x334652,_0x30114e){_0x334652=_0x334652-0x0;var _0x192aaf=_0x7a54[_0x334652];return _0x192aaf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 0bcabc1..afea93d 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 _0xedac=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeAnswers','removeAgents','exports'];(function(_0x1a671b,_0x3ed44f){var _0x5dc98e=function(_0x34305e){while(--_0x34305e){_0x1a671b['push'](_0x1a671b['shift']());}};_0x5dc98e(++_0x3ed44f);}(_0xedac,0x128));var _0xceda=function(_0x3e4334,_0x4b3cc7){_0x3e4334=_0x3e4334-0x0;var _0x53de40=_0xedac[_0x3e4334];return _0x53de40;};'use strict';var multer=require(_0xceda('0x0'));var util=require(_0xceda('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xceda('0x2')]();var fs_extra=require(_0xceda('0x3'));var auth=require(_0xceda('0x4'));var interaction=require(_0xceda('0x5'));var config=require('../../config/environment');var controller=require(_0xceda('0x6'));router[_0xceda('0x7')]('/',auth[_0xceda('0x8')](),controller[_0xceda('0x9')]);router['get'](_0xceda('0xa'),auth['isAuthenticated'](),controller[_0xceda('0xb')]);router[_0xceda('0x7')](_0xceda('0xc'),auth[_0xceda('0x8')](),controller['show']);router[_0xceda('0x7')](_0xceda('0xd'),auth[_0xceda('0x8')](),controller[_0xceda('0xe')]);router[_0xceda('0x7')](_0xceda('0xf'),auth[_0xceda('0x8')](),controller[_0xceda('0x10')]);router[_0xceda('0x7')]('/:id/applications',auth[_0xceda('0x8')](),controller[_0xceda('0x11')]);router[_0xceda('0x7')](_0xceda('0x12'),auth[_0xceda('0x8')](),controller['getInteractions']);router[_0xceda('0x7')](_0xceda('0x13'),auth[_0xceda('0x8')](),controller[_0xceda('0x14')]);router[_0xceda('0x15')]('/',auth[_0xceda('0x8')](),controller[_0xceda('0x16')]);router[_0xceda('0x15')](_0xceda('0xd'),auth[_0xceda('0x8')](),controller[_0xceda('0x17')]);router['post']('/:id/canned_answers',auth[_0xceda('0x8')](),controller[_0xceda('0x18')]);router['post'](_0xceda('0x19'),controller[_0xceda('0x1a')]);router[_0xceda('0x15')]('/:id/applications',auth[_0xceda('0x8')](),controller[_0xceda('0x1b')]);router[_0xceda('0x15')]('/:id/users',auth[_0xceda('0x8')](),controller[_0xceda('0x1c')]);router[_0xceda('0x15')](_0xceda('0x1d'),auth[_0xceda('0x8')](),controller[_0xceda('0x1e')]);router[_0xceda('0x1f')](_0xceda('0xc'),auth[_0xceda('0x8')](),controller['update']);router[_0xceda('0x20')](_0xceda('0xc'),auth['isAuthenticated'](),controller[_0xceda('0x21')]);router[_0xceda('0x20')](_0xceda('0xd'),auth[_0xceda('0x8')](),controller['removeDispositions']);router[_0xceda('0x20')](_0xceda('0xf'),auth['isAuthenticated'](),controller[_0xceda('0x22')]);router['delete'](_0xceda('0x13'),auth[_0xceda('0x8')](),controller[_0xceda('0x23')]);module[_0xceda('0x24')]=router; \ No newline at end of file +var _0xa457=['addAnswer','/:id/notify','notify','/:id/users','addAgents','send','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','post','create','addDisposition'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0xa457,0x1d4));var _0x7a45=function(_0x396134,_0x553aeb){_0x396134=_0x396134-0x0;var _0x463cd1=_0xa457[_0x396134];return _0x463cd1;};'use strict';var multer=require(_0x7a45('0x0'));var util=require(_0x7a45('0x1'));var path=require(_0x7a45('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a45('0x3'));var router=express[_0x7a45('0x4')]();var fs_extra=require(_0x7a45('0x5'));var auth=require(_0x7a45('0x6'));var interaction=require(_0x7a45('0x7'));var config=require('../../config/environment');var controller=require(_0x7a45('0x8'));router[_0x7a45('0x9')]('/',auth[_0x7a45('0xa')](),controller['index']);router[_0x7a45('0x9')](_0x7a45('0xb'),auth[_0x7a45('0xa')](),controller[_0x7a45('0xc')]);router[_0x7a45('0x9')]('/:id',auth[_0x7a45('0xa')](),controller['show']);router[_0x7a45('0x9')](_0x7a45('0xd'),auth['isAuthenticated'](),controller[_0x7a45('0xe')]);router[_0x7a45('0x9')](_0x7a45('0xf'),auth[_0x7a45('0xa')](),controller['getAnswers']);router[_0x7a45('0x9')](_0x7a45('0x10'),auth['isAuthenticated'](),controller[_0x7a45('0x11')]);router[_0x7a45('0x9')](_0x7a45('0x12'),auth[_0x7a45('0xa')](),controller['getInteractions']);router['get']('/:id/users',auth[_0x7a45('0xa')](),controller['getAgents']);router[_0x7a45('0x13')]('/',auth[_0x7a45('0xa')](),controller[_0x7a45('0x14')]);router[_0x7a45('0x13')]('/:id/dispositions',auth[_0x7a45('0xa')](),controller[_0x7a45('0x15')]);router[_0x7a45('0x13')](_0x7a45('0xf'),auth['isAuthenticated'](),controller[_0x7a45('0x16')]);router['post'](_0x7a45('0x17'),controller[_0x7a45('0x18')]);router[_0x7a45('0x13')](_0x7a45('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x7a45('0x13')](_0x7a45('0x19'),auth['isAuthenticated'](),controller[_0x7a45('0x1a')]);router[_0x7a45('0x13')]('/:id/send',auth[_0x7a45('0xa')](),controller[_0x7a45('0x1b')]);router[_0x7a45('0x1c')](_0x7a45('0x1d'),auth[_0x7a45('0xa')](),controller[_0x7a45('0x1e')]);router[_0x7a45('0x1f')]('/:id',auth[_0x7a45('0xa')](),controller[_0x7a45('0x20')]);router[_0x7a45('0x1f')](_0x7a45('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7a45('0x1f')](_0x7a45('0xf'),auth[_0x7a45('0xa')](),controller['removeAnswers']);router[_0x7a45('0x1f')]('/:id/users',auth[_0x7a45('0xa')](),controller[_0x7a45('0x21')]);module[_0x7a45('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 06e1a13..beb1304 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 _0xa98d=['STRING','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x36e11c,_0x5ba8f2){var _0x4d0410=function(_0x5da551){while(--_0x5da551){_0x36e11c['push'](_0x36e11c['shift']());}};_0x4d0410(++_0x5ba8f2);}(_0xa98d,0xf9));var _0xda98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa98d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xda98('0x0'));var rs=require(_0xda98('0x1'));module[_0xda98('0x2')]={'name':{'type':Sequelize[_0xda98('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xda98('0x3')],'defaultValue':function(){return rs[_0xda98('0x4')]();}},'replyUri':{'type':Sequelize[_0xda98('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xda98('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xda98('0x5')],'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[_0xda98('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xda98('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xda98('0x3')]},'queueTransfer':{'type':Sequelize[_0xda98('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xda98('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xda98('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xda98('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xda98('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xda98('0x6')],'defaultValue':![],'comment':_0xda98('0x8'),'set':function(_0x7204e2){if(!_0x7204e2)this['setDataValue'](_0xda98('0x9'),null);this[_0xda98('0xa')](_0xda98('0xb'),_0x7204e2);}}}; \ No newline at end of file +var _0x36e5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4841b0,_0x12ba5d){var _0xc8064c=function(_0x29d943){while(--_0x29d943){_0x4841b0['push'](_0x4841b0['shift']());}};_0xc8064c(++_0x12ba5d);}(_0x36e5,0xbd));var _0x536e=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x36e5[_0xe1441d];return _0x2ef242;};'use strict';var Sequelize=require(_0x536e('0x0'));var rs=require('randomstring');module[_0x536e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x536e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x536e('0x3')]},'token':{'type':Sequelize[_0x536e('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x536e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x536e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x536e('0x4')],'defaultValue':function(){return _0x536e('0x5');}},'notificationSound':{'type':Sequelize[_0x536e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x536e('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x536e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![],'comment':_0x536e('0x9'),'set':function(_0x1997b){if(!_0x1997b)this[_0x536e('0xa')](_0x536e('0xb'),null);this[_0x536e('0xa')](_0x536e('0xc'),_0x1997b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 964a2a7..b8847c3 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 _0xd420=['openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','from','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','stack','name','send','map','OpenchannelAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd420,0x1d9));var _0x0d42=function(_0x191064,_0x192dd2){_0x191064=_0x191064-0x0;var _0x34cb63=_0xd420[_0x191064];return _0x34cb63;};'use strict';var emlformat=require(_0x0d42('0x0'));var rimraf=require(_0x0d42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d42('0x2'));var rp=require(_0x0d42('0x3'));var moment=require(_0x0d42('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d42('0x5'));var util=require(_0x0d42('0x6'));var path=require(_0x0d42('0x7'));var sox=require(_0x0d42('0x8'));var csv=require(_0x0d42('0x9'));var ejs=require(_0x0d42('0xa'));var fs=require('fs');var fs_extra=require(_0x0d42('0xb'));var _=require(_0x0d42('0xc'));var squel=require(_0x0d42('0xd'));var crypto=require(_0x0d42('0xe'));var jsforce=require(_0x0d42('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d42('0x10'));var qs=require(_0x0d42('0x11'));var as=require(_0x0d42('0x12'));var hardwareService=require(_0x0d42('0x13'));var logger=require(_0x0d42('0x14'))(_0x0d42('0x15'));var utils=require('../../config/utils');var config=require(_0x0d42('0x16'));var licenseUtil=require(_0x0d42('0x17'));var db=require(_0x0d42('0x18'))['db'];config[_0x0d42('0x19')]=_[_0x0d42('0x1a')](config[_0x0d42('0x19')],{'host':_0x0d42('0x1b'),'port':0x18eb});var socket=require(_0x0d42('0x1c'))(new Redis(config[_0x0d42('0x19')]));require(_0x0d42('0x1d'))[_0x0d42('0x1e')](socket);var jayson=require(_0x0d42('0x1f'));var client=jayson['client'][_0x0d42('0x20')]({'port':0x232c});var client9002=jayson[_0x0d42('0x21')][_0x0d42('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x35d055,_0x56f6bd,_0x2d133d,_0x47e594){return new BPromise(function(_0x132c4e,_0x3863e7){var _0x5c342c=_0x47e594||client;return _0x5c342c[_0x0d42('0x22')](_0x35d055,_0x2d133d)[_0x0d42('0x23')](function(_0x20cda7){logger[_0x0d42('0x24')](_0x0d42('0x25'),_0x56f6bd,_0x0d42('0x26'));logger[_0x0d42('0x27')](_0x0d42('0x28'),_0x56f6bd,_0x0d42('0x26'),JSON[_0x0d42('0x29')](_0x20cda7));if(_0x20cda7[_0x0d42('0x2a')]){if(_0x20cda7['error'][_0x0d42('0x2b')]===0x1f4){logger[_0x0d42('0x2a')](_0x0d42('0x25'),_0x56f6bd,_0x20cda7['error']['message']);return _0x3863e7(_0x20cda7[_0x0d42('0x2a')][_0x0d42('0x2c')]);}logger[_0x0d42('0x2a')](_0x0d42('0x25'),_0x56f6bd,_0x20cda7[_0x0d42('0x2a')][_0x0d42('0x2c')]);return _0x132c4e(_0x20cda7[_0x0d42('0x2a')][_0x0d42('0x2c')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x56f6bd,_0x0d42('0x26'));_0x132c4e(_0x20cda7[_0x0d42('0x2d')][_0x0d42('0x2c')]);}})[_0x0d42('0x2e')](function(_0x494982){logger[_0x0d42('0x2a')](_0x0d42('0x25'),_0x56f6bd,_0x494982);_0x3863e7(_0x494982);});});}function respondWithStatusCode(_0x1479fe,_0x300803){_0x300803=_0x300803||0xcc;return function(_0x59bb93){if(_0x59bb93){return _0x1479fe[_0x0d42('0x2f')](_0x300803);}return _0x1479fe[_0x0d42('0x30')](_0x300803)[_0x0d42('0x31')]();};}function respondWithResult(_0x3423a6,_0x4ec447){_0x4ec447=_0x4ec447||0xc8;return function(_0x981064){if(_0x981064){return _0x3423a6[_0x0d42('0x30')](_0x4ec447)[_0x0d42('0x32')](_0x981064);}};}function respondWithFilteredResult(_0x4271a0,_0x4ecd88){return function(_0x59cec0){if(_0x59cec0){var _0x17978d=typeof _0x4ecd88[_0x0d42('0x33')]===_0x0d42('0x34')&&typeof _0x4ecd88[_0x0d42('0x35')]===_0x0d42('0x34');var _0x170e66=_0x59cec0[_0x0d42('0x36')];var _0x16c763=_0x17978d?0x0:_0x4ecd88[_0x0d42('0x33')];var _0x1c6d45=_0x17978d?_0x59cec0['count']:_0x4ecd88[_0x0d42('0x33')]+_0x4ecd88['limit'];var _0x46439c;if(_0x1c6d45>=_0x170e66){_0x1c6d45=_0x170e66;_0x46439c=0xc8;}else{_0x46439c=0xce;}_0x4271a0[_0x0d42('0x30')](_0x46439c);return _0x4271a0[_0x0d42('0x37')](_0x0d42('0x38'),_0x16c763+'-'+_0x1c6d45+'/'+_0x170e66)['json'](_0x59cec0);}return null;};}function patchUpdates(_0x40c8d6){return function(_0x135a77){try{jsonpatch[_0x0d42('0x39')](_0x135a77,_0x40c8d6,!![]);}catch(_0x5d72c2){return BPromise['reject'](_0x5d72c2);}return _0x135a77[_0x0d42('0x3a')]();};}function saveUpdates(_0x15d0df,_0x4f2dc0){return function(_0xffce89){if(_0xffce89){return _0xffce89[_0x0d42('0x3b')](_0x15d0df)[_0x0d42('0x23')](function(_0x391cea){return _0x391cea;});}return null;};}function removeEntity(_0x2e967b,_0xb0a07a){return function(_0x261396){if(_0x261396){return _0x261396[_0x0d42('0x3c')]()[_0x0d42('0x23')](function(){var _0x42cdc0=_0x261396[_0x0d42('0x3d')]({'plain':!![]});var _0x2d4f52=_0x0d42('0x3e');return db['UserProfileResource'][_0x0d42('0x3c')]({'where':{'type':_0x2d4f52,'resourceId':_0x42cdc0['id']}})[_0x0d42('0x23')](function(){return _0x261396;});})[_0x0d42('0x23')](function(){_0x2e967b['status'](0xcc)[_0x0d42('0x31')]();});}};}function handleEntityNotFound(_0x3dca7f,_0x73d768){return function(_0x4592cc){if(!_0x4592cc){_0x3dca7f[_0x0d42('0x2f')](0x194);}return _0x4592cc;};}function handleError(_0x1650ca,_0x1edf56){_0x1edf56=_0x1edf56||0x1f4;return function(_0x356ddc){logger['error'](_0x356ddc[_0x0d42('0x3f')]);if(_0x356ddc['name']){delete _0x356ddc[_0x0d42('0x40')];}_0x1650ca[_0x0d42('0x30')](_0x1edf56)[_0x0d42('0x41')](_0x356ddc);};}exports['index']=function(_0x3b17f5,_0xea715c){var _0x4a97e1={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xa1c557={},_0x453299={'count':0x0,'rows':[]};var _0x31e76b=_[_0x0d42('0x42')](db[_0x0d42('0x43')]['rawAttributes'],function(_0x459609){return{'name':_0x459609[_0x0d42('0x44')],'type':_0x459609[_0x0d42('0x45')]['key']};});_0xa1c557[_0x0d42('0x46')]=_['map'](_0x31e76b,_0x0d42('0x40'));_0xa1c557['query']=_[_0x0d42('0x47')](_0x3b17f5[_0x0d42('0x48')]);_0xa1c557[_0x0d42('0x49')]=_[_0x0d42('0x4a')](_0xa1c557[_0x0d42('0x46')],_0xa1c557[_0x0d42('0x48')]);_0x4a97e1[_0x0d42('0x4b')]=_[_0x0d42('0x4a')](_0xa1c557[_0x0d42('0x46')],qs[_0x0d42('0x4c')](_0x3b17f5[_0x0d42('0x48')]['fields']));_0x4a97e1['attributes']=_0x4a97e1[_0x0d42('0x4b')][_0x0d42('0x4d')]?_0x4a97e1[_0x0d42('0x4b')]:_0xa1c557['model'];if(!_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x4e')](_0x0d42('0x4f'))){_0x4a97e1[_0x0d42('0x35')]=qs[_0x0d42('0x35')](_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x35')]);_0x4a97e1[_0x0d42('0x33')]=qs[_0x0d42('0x33')](_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x33')]);}_0x4a97e1[_0x0d42('0x50')]=qs[_0x0d42('0x51')](_0x3b17f5[_0x0d42('0x48')]['sort']);_0x4a97e1[_0x0d42('0x52')]=qs[_0x0d42('0x49')](_[_0x0d42('0x53')](_0x3b17f5['query'],_0xa1c557[_0x0d42('0x49')]),_0x31e76b);if(_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x54')]){_0x4a97e1[_0x0d42('0x52')]=_['merge'](_0x4a97e1[_0x0d42('0x52')],{'$or':_[_0x0d42('0x42')](_0x31e76b,function(_0x4981ca){if(_0x4981ca[_0x0d42('0x45')]!=='VIRTUAL'){var _0x53d147={};_0x53d147[_0x4981ca['name']]={'$like':'%'+_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x54')]+'%'};return _0x53d147;}})});}_0x4a97e1=_[_0x0d42('0x55')]({},_0x4a97e1,_0x3b17f5['options']);var _0x4e178d={'where':_0x4a97e1['where']};return db[_0x0d42('0x43')]['count'](_0x4e178d)[_0x0d42('0x23')](function(_0x256e40){_0x453299[_0x0d42('0x36')]=_0x256e40;if(_0x3b17f5[_0x0d42('0x48')][_0x0d42('0x56')]){_0x4a97e1[_0x0d42('0x57')]=[{'all':!![]}];}return db[_0x0d42('0x43')][_0x0d42('0x58')](_0x4a97e1);})[_0x0d42('0x23')](function(_0x15a5f0){_0x453299[_0x0d42('0x59')]=_0x15a5f0;return _0x453299;})[_0x0d42('0x23')](respondWithFilteredResult(_0xea715c,_0x4a97e1))['catch'](handleError(_0xea715c,null));};exports[_0x0d42('0x5a')]=function(_0x5d003f,_0x35da16){var _0x5ae0a3={'raw':![],'where':{'id':_0x5d003f[_0x0d42('0x5b')]['id']},'include':[{'model':db[_0x0d42('0x5c')],'as':_0x0d42('0x5d')}]},_0x163a2a={};_0x163a2a[_0x0d42('0x46')]=_[_0x0d42('0x47')](db[_0x0d42('0x43')][_0x0d42('0x5e')]);_0x163a2a[_0x0d42('0x48')]=_[_0x0d42('0x47')](_0x5d003f['query']);_0x163a2a[_0x0d42('0x49')]=_[_0x0d42('0x4a')](_0x163a2a[_0x0d42('0x46')],_0x163a2a['query']);_0x5ae0a3[_0x0d42('0x4b')]=_[_0x0d42('0x4a')](_0x163a2a[_0x0d42('0x46')],qs[_0x0d42('0x4c')](_0x5d003f[_0x0d42('0x48')][_0x0d42('0x4c')]));_0x5ae0a3[_0x0d42('0x4b')]=_0x5ae0a3[_0x0d42('0x4b')][_0x0d42('0x4d')]?_0x5ae0a3[_0x0d42('0x4b')]:_0x163a2a['model'];if(_0x5d003f[_0x0d42('0x48')]['includeAll']){_0x5ae0a3[_0x0d42('0x57')]=[{'all':!![]}];}_0x5ae0a3=_[_0x0d42('0x55')]({},_0x5ae0a3,_0x5d003f[_0x0d42('0x5f')]);return db['OpenchannelAccount']['find'](_0x5ae0a3)[_0x0d42('0x23')](handleEntityNotFound(_0x35da16,null))['then'](respondWithResult(_0x35da16,null))[_0x0d42('0x2e')](handleError(_0x35da16,null));};exports[_0x0d42('0x60')]=function(_0x168a31,_0x15c0ec){return db[_0x0d42('0x43')][_0x0d42('0x60')](_0x168a31[_0x0d42('0x61')],{})[_0x0d42('0x23')](function(_0x5befa2){var _0x25dbac=_0x168a31['user'][_0x0d42('0x3d')]({'plain':!![]});if(!_0x25dbac)throw new Error(_0x0d42('0x62'));if(_0x25dbac[_0x0d42('0x63')]===_0x0d42('0x64')){var _0x2f2efd=_0x5befa2[_0x0d42('0x3d')]({'plain':!![]});var _0x5aec6e=_0x0d42('0x3e');return db[_0x0d42('0x65')][_0x0d42('0x66')]({'where':{'name':_0x5aec6e,'userProfileId':_0x25dbac[_0x0d42('0x67')]},'raw':!![]})[_0x0d42('0x23')](function(_0x2de512){if(_0x2de512&&_0x2de512[_0x0d42('0x68')]===0x0){return db[_0x0d42('0x69')][_0x0d42('0x60')]({'name':_0x2f2efd[_0x0d42('0x40')],'resourceId':_0x2f2efd['id'],'type':_0x2de512[_0x0d42('0x40')],'sectionId':_0x2de512['id']},{})[_0x0d42('0x23')](function(){return _0x5befa2;});}else{return _0x5befa2;}})[_0x0d42('0x2e')](function(_0x579a22){logger[_0x0d42('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x579a22);throw _0x579a22;});}return _0x5befa2;})[_0x0d42('0x23')](respondWithResult(_0x15c0ec,0xc9))[_0x0d42('0x2e')](handleError(_0x15c0ec,null));};exports[_0x0d42('0x3b')]=function(_0x25b773,_0x48701f){if(_0x25b773[_0x0d42('0x61')]['id']){delete _0x25b773[_0x0d42('0x61')]['id'];}return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x25b773[_0x0d42('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x0d42('0x5d')}]})[_0x0d42('0x23')](handleEntityNotFound(_0x48701f,null))[_0x0d42('0x23')](saveUpdates(_0x25b773[_0x0d42('0x61')],null))[_0x0d42('0x23')](respondWithResult(_0x48701f,null))['catch'](handleError(_0x48701f,null));};exports['destroy']=function(_0x136aba,_0x14aa78){return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x136aba['params']['id']}})['then'](handleEntityNotFound(_0x14aa78,null))[_0x0d42('0x23')](removeEntity(_0x14aa78,null))[_0x0d42('0x2e')](handleError(_0x14aa78,null));};exports[_0x0d42('0x6a')]=function(_0x22bc18,_0x5512f4){return db[_0x0d42('0x43')]['describe']()['then'](respondWithResult(_0x5512f4,null))[_0x0d42('0x2e')](handleError(_0x5512f4,null));};exports[_0x0d42('0x6b')]=function(_0x4759fc,_0x45e01a,_0x55df07){if(_0x4759fc[_0x0d42('0x61')]['id']){delete _0x4759fc['body']['id'];}return db[_0x0d42('0x43')]['find']({'where':{'id':_0x4759fc[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x45e01a,null))[_0x0d42('0x23')](function(_0x34b909){if(_0x34b909){_0x4759fc[_0x0d42('0x61')][_0x0d42('0x6c')]=_0x34b909['id'];return db[_0x0d42('0x6d')][_0x0d42('0x60')](_0x4759fc[_0x0d42('0x61')]);}})[_0x0d42('0x23')](respondWithResult(_0x45e01a,null))[_0x0d42('0x2e')](handleError(_0x45e01a,null));};exports[_0x0d42('0x6e')]=function(_0x2fa58b,_0x31e126,_0x5b55a6){var _0x596e6b={'raw':![],'where':{}};var _0x43c715={};var _0x4a46d1={'count':0x0,'rows':[]};return db[_0x0d42('0x43')][_0x0d42('0x6f')]({'where':{'id':_0x2fa58b[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x31e126,null))['then'](function(_0x7176aa){if(_0x7176aa){_0x43c715['model']=_[_0x0d42('0x47')](db[_0x0d42('0x6d')]['rawAttributes']);_0x43c715[_0x0d42('0x48')]=_[_0x0d42('0x47')](_0x2fa58b[_0x0d42('0x48')]);_0x43c715[_0x0d42('0x49')]=_['intersection'](_0x43c715['model'],_0x43c715[_0x0d42('0x48')]);_0x596e6b[_0x0d42('0x4b')]=_[_0x0d42('0x4a')](_0x43c715['model'],qs[_0x0d42('0x4c')](_0x2fa58b['query']['fields']));_0x596e6b['attributes']=_0x596e6b[_0x0d42('0x4b')]['length']?_0x596e6b[_0x0d42('0x4b')]:_0x43c715[_0x0d42('0x46')];if(!_0x2fa58b[_0x0d42('0x48')]['hasOwnProperty'](_0x0d42('0x4f'))){_0x596e6b[_0x0d42('0x35')]=qs[_0x0d42('0x35')](_0x2fa58b[_0x0d42('0x48')]['limit']);_0x596e6b[_0x0d42('0x33')]=qs['offset'](_0x2fa58b[_0x0d42('0x48')]['offset']);}_0x596e6b[_0x0d42('0x50')]=qs[_0x0d42('0x51')](_0x2fa58b[_0x0d42('0x48')][_0x0d42('0x51')]);_0x596e6b['where']=qs[_0x0d42('0x49')](_[_0x0d42('0x53')](_0x2fa58b[_0x0d42('0x48')],_0x43c715['filters']));_0x596e6b[_0x0d42('0x52')][_0x0d42('0x6c')]=_0x7176aa['id'];if(_0x2fa58b[_0x0d42('0x48')][_0x0d42('0x54')]){_0x596e6b['where']=_[_0x0d42('0x55')](_0x596e6b[_0x0d42('0x52')],{'$or':_[_0x0d42('0x42')](_0x596e6b['attributes'],function(_0x2b61bd){var _0x1a0181={};_0x1a0181[_0x2b61bd]={'$like':'%'+_0x2fa58b[_0x0d42('0x48')][_0x0d42('0x54')]+'%'};return _0x1a0181;})});}_0x596e6b=_['merge']({},_0x596e6b,_0x2fa58b['options']);return db[_0x0d42('0x6d')][_0x0d42('0x36')]({'where':_0x596e6b[_0x0d42('0x52')]})[_0x0d42('0x23')](function(_0x55bd1d){_0x4a46d1[_0x0d42('0x36')]=_0x55bd1d;if(_0x2fa58b[_0x0d42('0x48')]['includeAll']){_0x596e6b[_0x0d42('0x57')]=[{'all':!![]}];}return db[_0x0d42('0x6d')][_0x0d42('0x58')](_0x596e6b);})['then'](function(_0x212773){_0x4a46d1[_0x0d42('0x59')]=_0x212773;return _0x4a46d1;});}})[_0x0d42('0x23')](respondWithFilteredResult(_0x31e126,_0x596e6b))[_0x0d42('0x2e')](handleError(_0x31e126,null));};exports[_0x0d42('0x70')]=function(_0x92fb87,_0x1447d5,_0x54583f){return db[_0x0d42('0x43')]['find']({'where':{'id':_0x92fb87[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x1447d5,null))[_0x0d42('0x23')](function(_0xa140b3){if(_0xa140b3){return _0xa140b3[_0x0d42('0x70')](_0x92fb87[_0x0d42('0x48')]['ids']);}})[_0x0d42('0x23')](respondWithStatusCode(_0x1447d5,null))[_0x0d42('0x2e')](handleError(_0x1447d5,null));};exports[_0x0d42('0x71')]=function(_0x3bbf16,_0x20261c,_0x31b723){if(_0x3bbf16[_0x0d42('0x61')]['id']){delete _0x3bbf16[_0x0d42('0x61')]['id'];}return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x3bbf16['params']['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x20261c,null))['then'](function(_0x33d8cb){if(_0x33d8cb){_0x3bbf16['body']['OpenchannelAccountId']=_0x33d8cb['id'];return db[_0x0d42('0x72')][_0x0d42('0x60')](_0x3bbf16[_0x0d42('0x61')]);}})[_0x0d42('0x23')](respondWithResult(_0x20261c,null))[_0x0d42('0x2e')](handleError(_0x20261c,null));};exports[_0x0d42('0x73')]=function(_0x53da81,_0x5bc65e,_0x1dec00){var _0x1fe308={'raw':![],'where':{}};var _0x1be440={};var _0x3b9da8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0d42('0x6f')]({'where':{'id':_0x53da81['params']['id']}})['then'](handleEntityNotFound(_0x5bc65e,null))[_0x0d42('0x23')](function(_0x211d1e){if(_0x211d1e){_0x1be440[_0x0d42('0x46')]=_[_0x0d42('0x47')](db[_0x0d42('0x72')][_0x0d42('0x5e')]);_0x1be440[_0x0d42('0x48')]=_['keys'](_0x53da81['query']);_0x1be440['filters']=_[_0x0d42('0x4a')](_0x1be440[_0x0d42('0x46')],_0x1be440[_0x0d42('0x48')]);_0x1fe308['attributes']=_[_0x0d42('0x4a')](_0x1be440[_0x0d42('0x46')],qs[_0x0d42('0x4c')](_0x53da81[_0x0d42('0x48')][_0x0d42('0x4c')]));_0x1fe308[_0x0d42('0x4b')]=_0x1fe308['attributes'][_0x0d42('0x4d')]?_0x1fe308[_0x0d42('0x4b')]:_0x1be440['model'];if(!_0x53da81[_0x0d42('0x48')][_0x0d42('0x4e')](_0x0d42('0x4f'))){_0x1fe308['limit']=qs[_0x0d42('0x35')](_0x53da81['query'][_0x0d42('0x35')]);_0x1fe308[_0x0d42('0x33')]=qs[_0x0d42('0x33')](_0x53da81[_0x0d42('0x48')][_0x0d42('0x33')]);}_0x1fe308['order']=qs[_0x0d42('0x51')](_0x53da81[_0x0d42('0x48')][_0x0d42('0x51')]);_0x1fe308[_0x0d42('0x52')]=qs[_0x0d42('0x49')](_['pick'](_0x53da81[_0x0d42('0x48')],_0x1be440[_0x0d42('0x49')]));_0x1fe308[_0x0d42('0x52')][_0x0d42('0x6c')]=_0x211d1e['id'];if(_0x53da81['query'][_0x0d42('0x54')]){_0x1fe308['where']=_['merge'](_0x1fe308[_0x0d42('0x52')],{'$or':_['map'](_0x1fe308[_0x0d42('0x4b')],function(_0x4f22a9){var _0x20f4f5={};_0x20f4f5[_0x4f22a9]={'$like':'%'+_0x53da81[_0x0d42('0x48')][_0x0d42('0x54')]+'%'};return _0x20f4f5;})});}_0x1fe308=_[_0x0d42('0x55')]({},_0x1fe308,_0x53da81[_0x0d42('0x5f')]);return db['CannedAnswer'][_0x0d42('0x36')]({'where':_0x1fe308[_0x0d42('0x52')]})[_0x0d42('0x23')](function(_0x57cbd9){_0x3b9da8[_0x0d42('0x36')]=_0x57cbd9;if(_0x53da81[_0x0d42('0x48')][_0x0d42('0x56')]){_0x1fe308['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0d42('0x58')](_0x1fe308);})['then'](function(_0x174d03){_0x3b9da8[_0x0d42('0x59')]=_0x174d03;return _0x3b9da8;});}})['then'](respondWithFilteredResult(_0x5bc65e,_0x1fe308))['catch'](handleError(_0x5bc65e,null));};exports[_0x0d42('0x74')]=function(_0x254714,_0x2d244b,_0x407a19){return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x254714[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x2d244b,null))['then'](function(_0x141f49){if(_0x141f49){return _0x141f49[_0x0d42('0x74')](_0x254714[_0x0d42('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x2d244b,null))[_0x0d42('0x2e')](handleError(_0x2d244b,null));};exports[_0x0d42('0x75')]=function(_0x3ff104,_0x563d8f,_0x22790b){var _0x41eafc={'body':_0x3ff104['body'],'channel':_0x0d42('0x76')};var _0x307911=[];var _0x4db638=[];var _0x311869={};var _0x409b8d=![];return db[_0x0d42('0x77')][_0x0d42('0x6a')]()[_0x0d42('0x23')](function(_0x25544e){if(!_0x25544e){throw new db[(_0x0d42('0x78'))]['ValidationError'](_0x0d42('0x79'));}_0x307911=_['difference'](_[_0x0d42('0x47')](_0x25544e),[_0x0d42('0x7a'),_0x0d42('0x7b')]);_0x4db638=_[_0x0d42('0x7c')](_[_0x0d42('0x47')](_0x25544e),[_0x0d42('0x7a'),_0x0d42('0x7b'),_0x0d42('0x7d'),_0x0d42('0x7e')]);if(_0x3ff104[_0x0d42('0x61')]['id']){delete _0x3ff104[_0x0d42('0x61')]['id'];}if(_['isNil'](_0x3ff104[_0x0d42('0x61')]['from'])){throw new db[(_0x0d42('0x78'))]['ValidationError'](_0x0d42('0x7f'));}if(_[_0x0d42('0x80')](_0x3ff104[_0x0d42('0x61')][_0x0d42('0x61')])||_0x3ff104['body']['body']===''){throw new db[(_0x0d42('0x78'))][(_0x0d42('0x81'))](_0x0d42('0x82'));}if(_[_0x0d42('0x80')](_0x3ff104[_0x0d42('0x61')][_0x0d42('0x83')])){throw new db['Sequelize']['ValidationError'](_0x0d42('0x84')+_0x4db638);}if(!_[_0x0d42('0x85')](_0x4db638,_0x3ff104['body'][_0x0d42('0x83')])){throw new db['Sequelize']['ValidationError'](_0x0d42('0x86')+_0x4db638);}_0x311869[_0x3ff104[_0x0d42('0x61')]['mapKey']]=_0x3ff104['body']['from'];})[_0x0d42('0x23')](function(){return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x3ff104['params']['id']},'include':[{'model':db['CmList'],'as':_0x0d42('0x87'),'include':[{'model':db[_0x0d42('0x77')],'as':_0x0d42('0x88'),'where':_0x311869,'limit':0x1,'order':[['updatedAt',_0x0d42('0x89')]]}]},{'model':db[_0x0d42('0x8a')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x563d8f,null))['then'](function(_0x34cdc9){if(_0x34cdc9&&_0x34cdc9['List']){_0x41eafc[_0x0d42('0x8b')]=_0x34cdc9;_0x41eafc[_0x0d42('0x8c')]=_0x34cdc9[_0x0d42('0x8d')];_0x41eafc[_0x0d42('0x8e')]=_0x34cdc9['List'];_0x41eafc['applications']=_[_0x0d42('0x8f')](_0x41eafc['applications'],[_0x0d42('0x90')],[_0x0d42('0x91')]);if(_0x41eafc[_0x0d42('0x8b')][_0x0d42('0x8d')]){delete _0x41eafc[_0x0d42('0x8b')][_0x0d42('0x8d')];}if(_0x41eafc['account'][_0x0d42('0x87')]&&_0x41eafc[_0x0d42('0x8b')][_0x0d42('0x87')][_0x0d42('0x88')][_0x0d42('0x4d')]){return _0x41eafc[_0x0d42('0x8b')][_0x0d42('0x87')][_0x0d42('0x88')][0x0];}var _0x46458a=_[_0x0d42('0x1a')](_0x3ff104['body'],{'firstName':_0x3ff104[_0x0d42('0x61')][_0x0d42('0x92')],'ListId':_0x34cdc9[_0x0d42('0x7e')]});_0x46458a[_0x3ff104['body'][_0x0d42('0x83')]]=_0x3ff104[_0x0d42('0x61')]['from'];return db[_0x0d42('0x77')][_0x0d42('0x60')](_0x46458a,{'fields':_0x307911,'raw':!![]});}})['then'](handleEntityNotFound(_0x563d8f,null))['then'](function(_0x5012e7){_0x41eafc['contact']=_0x5012e7;if(_0x5012e7){var _0x138f7e={'ContactId':_0x5012e7['id'],'OpenchannelAccountId':_0x3ff104[_0x0d42('0x5b')]['id'],'from':(_0x5012e7[_0x0d42('0x93')]||'')+'\x20'+(_0x5012e7[_0x0d42('0x94')]||'')};var _0x378b9e={'OpenchannelAccountId':_0x3ff104['params']['id'],'closed':![]};if(_0x3ff104[_0x0d42('0x61')][_0x0d42('0x95')]){_0x378b9e[_0x0d42('0x95')]=_0x3ff104['body'][_0x0d42('0x95')];return db['OpenchannelInteraction'][_0x0d42('0x66')]({'where':_0x378b9e})[_0x0d42('0x23')](function(_0x293781){if(_0x293781){return[_0x293781,![]];}_0x138f7e[_0x0d42('0x95')]=_0x3ff104[_0x0d42('0x61')][_0x0d42('0x95')];_0x138f7e[_0x0d42('0x96')]=_0x3ff104['body'][_0x0d42('0x96')];return db[_0x0d42('0x97')][_0x0d42('0x60')](_0x138f7e)['then'](function(_0x26f127){return[_0x26f127,!![]];});});}else{_0x378b9e[_0x0d42('0x95')]=null;}_0x378b9e[_0x0d42('0x98')]=_0x5012e7['id'];return db['OpenchannelInteraction'][_0x0d42('0x66')]({'where':_0x378b9e})[_0x0d42('0x23')](function(_0x1d2e1b){if(_0x1d2e1b){return[_0x1d2e1b,![]];}return db[_0x0d42('0x97')][_0x0d42('0x60')](_0x138f7e)['then'](function(_0x3252df){return[_0x3252df,!![]];});});}})[_0x0d42('0x99')](function(_0x3ea1fa,_0x26c7ee){if(_0x3ea1fa){_0x409b8d=_0x26c7ee;if(!_0x26c7ee){var _0x3b4501={'from':(_0x41eafc[_0x0d42('0x9a')][_0x0d42('0x93')]||'')+'\x20'+(_0x41eafc[_0x0d42('0x9a')]['lastName']||'')};if(_0x3ff104[_0x0d42('0x61')][_0x0d42('0x95')]&&_0x3ff104['body'][_0x0d42('0x9b')]&&_0x3ff104['body']['threadId']!=_0x3ff104['body']['messageId']){_0x3b4501[_0x0d42('0x95')]=_0x3ff104[_0x0d42('0x61')][_0x0d42('0x9b')];}return _0x3ea1fa[_0x0d42('0x3b')](_0x3b4501);}else{return _0x3ea1fa;}}})[_0x0d42('0x23')](function(_0x380f22){_0x41eafc[_0x0d42('0x9c')]=_0x380f22[_0x0d42('0x3d')]({'plain':!![]});_0x41eafc[_0x0d42('0x9c')][_0x0d42('0x9d')]=_0x409b8d;if(_0x41eafc[_0x0d42('0x9c')]['created']){if(_0x41eafc['account'][_0x0d42('0x9e')]){_0x41eafc[_0x0d42('0x8c')][_0x0d42('0x9f')]({'id':0x0,'priority':_0x41eafc['applications'][_0x0d42('0x4d')]+0x1,'app':_0x0d42('0xa0'),'appdata':_0x0d42('0xa1'),'interval':_0x0d42('0xa2')});}}return db[_0x0d42('0xa3')][_0x0d42('0x60')]({'body':_0x3ff104[_0x0d42('0x61')][_0x0d42('0x61')],'OpenchannelAccountId':_0x3ff104[_0x0d42('0x5b')]['id'],'OpenchannelInteractionId':_0x380f22['id'],'direction':'in','ContactId':_0x41eafc[_0x0d42('0x9a')]['id'],'AttachmentId':_0x3ff104[_0x0d42('0x61')][_0x0d42('0xa4')]});})[_0x0d42('0x23')](function(_0x574303){_0x41eafc[_0x0d42('0x2c')]=_0x574303;if(_0x41eafc[_0x0d42('0x9c')][_0x0d42('0xa5')]){return db[_0x0d42('0xa6')][_0x0d42('0x66')]({'attributes':['id','name'],'where':{'id':_0x41eafc['interaction'][_0x0d42('0xa5')]}})[_0x0d42('0x23')](function(_0x47230d){if(_0x47230d){_0x41eafc[_0x0d42('0x8c')][_0x0d42('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47230d[_0x0d42('0x40')]+','+(_0x41eafc[_0x0d42('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0x0d42('0xa2')});_0x41eafc[_0x0d42('0xa8')]=![];}return respondWithRpcPromise(_0x0d42('0xa9'),'startRouting',_0x41eafc);});}return respondWithRpcPromise('Start',_0x0d42('0xaa'),_0x41eafc);})['then'](function(_0x2f7504){respondWithRpcPromise(_0x0d42('0xab'),_0x0d42('0xab'),{'event':_0x0d42('0x75'),'message':_0x2f7504},client9002);return _0x2f7504;})['then'](respondWithResult(_0x563d8f,null))['catch'](handleError(_0x563d8f,null));};exports[_0x0d42('0xac')]=function(_0x55d4b3,_0x147931){var _0xaeaf47=_0x55d4b3[_0x0d42('0x5b')]['id'];var _0x4620ca=_0x55d4b3[_0x0d42('0x61')];var _0x4fc00b=0xc8;var _0x2d0f0c=null;return db['sequelize'][_0x0d42('0xad')]({'isolationLevel':db['sequelize'][_0x0d42('0xae')][_0x0d42('0xaf')][_0x0d42('0xb0')]},function(_0x1ee397){return db[_0x0d42('0x43')][_0x0d42('0x6f')]({'where':{'id':_0xaeaf47},'transaction':_0x1ee397})[_0x0d42('0x23')](function(_0x32ba1e){if(_0x32ba1e){return db[_0x0d42('0x8a')][_0x0d42('0x3c')]({'where':{'OpenchannelAccountId':_0xaeaf47},'transaction':_0x1ee397})['then'](function(){var _0x55e01=_[_0x0d42('0x42')](_0x4620ca,function(_0x170329){_0x170329[_0x0d42('0x6c')]=_0xaeaf47;return _0x170329;});return db[_0x0d42('0x8a')][_0x0d42('0xb1')](_0x55e01,{'transaction':_0x1ee397});});}else{_0x4fc00b=0x194;_0x2d0f0c=[];}});})[_0x0d42('0x23')](function(){if(_0x4fc00b!==0x194){return db[_0x0d42('0x8a')][_0x0d42('0xb2')]({'where':{'OpenchannelAccountId':_0xaeaf47},'order':'priority'})[_0x0d42('0x23')](function(_0x4cb5a4){_0x2d0f0c=_0x4cb5a4;});}})[_0x0d42('0x2e')](function(_0x3902ac){_0x4fc00b=0x1f4;logger[_0x0d42('0x2a')](_0x3902ac[_0x0d42('0x3f')]);if(_0x3902ac[_0x0d42('0x40')]){delete _0x3902ac[_0x0d42('0x40')];}_0x2d0f0c=_0x3902ac;})['finally'](function(){if(_0x2d0f0c===null){_0x147931[_0x0d42('0x2f')](_0x4fc00b);}else{if(_0x4fc00b===0x1f4){_0x147931['status'](_0x4fc00b)[_0x0d42('0x41')](_0x2d0f0c);}else{_0x147931[_0x0d42('0x30')](_0x4fc00b)[_0x0d42('0x32')](_0x2d0f0c);}}});};exports[_0x0d42('0xb3')]=function(_0x7a8c05,_0x82a0e8,_0x111923){var _0x24ed37={};var _0x5f4f7e={};var _0x2f0c91;var _0x4394ca;return db[_0x0d42('0x43')]['findOne']({'where':{'id':_0x7a8c05[_0x0d42('0x5b')]['id']}})['then'](handleEntityNotFound(_0x82a0e8,null))[_0x0d42('0x23')](function(_0x4f8cc6){if(_0x4f8cc6){_0x2f0c91=_0x4f8cc6;_0x5f4f7e[_0x0d42('0x46')]=_[_0x0d42('0x47')](db[_0x0d42('0x8a')][_0x0d42('0x5e')]);_0x5f4f7e[_0x0d42('0x48')]=_['keys'](_0x7a8c05['query']);_0x5f4f7e[_0x0d42('0x49')]=_[_0x0d42('0x4a')](_0x5f4f7e[_0x0d42('0x46')],_0x5f4f7e[_0x0d42('0x48')]);_0x24ed37[_0x0d42('0x4b')]=_[_0x0d42('0x4a')](_0x5f4f7e[_0x0d42('0x46')],qs[_0x0d42('0x4c')](_0x7a8c05[_0x0d42('0x48')][_0x0d42('0x4c')]));_0x24ed37[_0x0d42('0x4b')]=_0x24ed37[_0x0d42('0x4b')]['length']?_0x24ed37[_0x0d42('0x4b')]:_0x5f4f7e['model'];_0x24ed37[_0x0d42('0x50')]=qs[_0x0d42('0x51')](_0x7a8c05['query'][_0x0d42('0x51')]);_0x24ed37[_0x0d42('0x52')]=qs[_0x0d42('0x49')](_[_0x0d42('0x53')](_0x7a8c05[_0x0d42('0x48')],_0x5f4f7e['filters']));if(_0x7a8c05['query'][_0x0d42('0x54')]){_0x24ed37[_0x0d42('0x52')]=_[_0x0d42('0x55')](_0x24ed37[_0x0d42('0x52')],{'$or':_[_0x0d42('0x42')](_0x24ed37[_0x0d42('0x4b')],function(_0x2edb9c){var _0x186928={};_0x186928[_0x2edb9c]={'$like':'%'+_0x7a8c05['query'][_0x0d42('0x54')]+'%'};return _0x186928;})});}_0x24ed37=_[_0x0d42('0x55')]({},_0x24ed37,_0x7a8c05['options']);return _0x2f0c91[_0x0d42('0xb3')](_0x24ed37);}})['then'](function(_0x5e6f9d){if(_0x5e6f9d){_0x4394ca=_0x5e6f9d[_0x0d42('0x4d')];if(!_0x7a8c05[_0x0d42('0x48')][_0x0d42('0x4e')]('nolimit')){_0x24ed37['limit']=qs[_0x0d42('0x35')](_0x7a8c05[_0x0d42('0x48')][_0x0d42('0x35')]);_0x24ed37[_0x0d42('0x33')]=qs[_0x0d42('0x33')](_0x7a8c05['query'][_0x0d42('0x33')]);}return _0x2f0c91[_0x0d42('0xb3')](_0x24ed37);}})[_0x0d42('0x23')](function(_0x1c3719){if(_0x1c3719){return _0x1c3719?{'count':_0x4394ca,'rows':_0x1c3719}:null;}})[_0x0d42('0x23')](respondWithResult(_0x82a0e8,null))[_0x0d42('0x2e')](handleError(_0x82a0e8,null));};exports['getInteractions']=function(_0x433ad8,_0x3f49b2,_0x16cb99){var _0x16535b={'raw':![],'where':{}};var _0x41b205={};var _0x3b51bf={'count':0x0,'rows':[]};return db[_0x0d42('0x43')]['findOne']({'where':{'id':_0x433ad8[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x3f49b2,null))['then'](function(_0x1461a4){if(_0x1461a4){_0x41b205[_0x0d42('0x46')]=_[_0x0d42('0x47')](db[_0x0d42('0x97')][_0x0d42('0x5e')]);_0x41b205[_0x0d42('0x48')]=_[_0x0d42('0x47')](_0x433ad8[_0x0d42('0x48')]);_0x41b205[_0x0d42('0x49')]=_[_0x0d42('0x4a')](_0x41b205['model'],_0x41b205[_0x0d42('0x48')]);_0x16535b['attributes']=_[_0x0d42('0x4a')](_0x41b205['model'],qs['fields'](_0x433ad8['query']['fields']));_0x16535b['attributes']=_0x16535b[_0x0d42('0x4b')][_0x0d42('0x4d')]?_0x16535b[_0x0d42('0x4b')]:_0x41b205[_0x0d42('0x46')];if(!_0x433ad8[_0x0d42('0x48')][_0x0d42('0x4e')]('nolimit')){_0x16535b[_0x0d42('0x35')]=qs[_0x0d42('0x35')](_0x433ad8[_0x0d42('0x48')][_0x0d42('0x35')]);_0x16535b[_0x0d42('0x33')]=qs[_0x0d42('0x33')](_0x433ad8[_0x0d42('0x48')]['offset']);}_0x16535b[_0x0d42('0x50')]=qs[_0x0d42('0x51')](_0x433ad8[_0x0d42('0x48')][_0x0d42('0x51')]);_0x16535b[_0x0d42('0x52')]=qs['filters'](_[_0x0d42('0x53')](_0x433ad8[_0x0d42('0x48')],_0x41b205[_0x0d42('0x49')]));_0x16535b[_0x0d42('0x52')][_0x0d42('0x6c')]=_0x1461a4['id'];if(_0x433ad8[_0x0d42('0x48')][_0x0d42('0x54')]){_0x16535b['where']=_[_0x0d42('0x55')](_0x16535b[_0x0d42('0x52')],{'$or':_[_0x0d42('0x42')](_0x16535b[_0x0d42('0x4b')],function(_0x5b5780){var _0x11d4db={};_0x11d4db[_0x5b5780]={'$like':'%'+_0x433ad8[_0x0d42('0x48')]['filter']+'%'};return _0x11d4db;})});}_0x16535b=_[_0x0d42('0x55')]({},_0x16535b,_0x433ad8['options']);return db['OpenchannelInteraction']['count']({'where':_0x16535b[_0x0d42('0x52')]})['then'](function(_0x3b2d22){_0x3b51bf[_0x0d42('0x36')]=_0x3b2d22;if(_0x433ad8[_0x0d42('0x48')]['includeAll']){_0x16535b[_0x0d42('0x57')]=[{'model':db['CmContact'],'as':_0x0d42('0xb4'),'required':![]},{'model':db[_0x0d42('0xa6')],'as':'Owner','attributes':[_0x0d42('0x40'),_0x0d42('0xb5'),_0x0d42('0xb6')],'required':![]},{'model':db[_0x0d42('0xb7')],'as':_0x0d42('0xb8'),'attributes':['id',_0x0d42('0x40'),'color'],'where':_0x433ad8[_0x0d42('0x48')]['tag']?{'id':_0x433ad8[_0x0d42('0x48')][_0x0d42('0xb9')]}:undefined,'required':_0x433ad8[_0x0d42('0x48')]['tag']?!![]:![]}];}return db[_0x0d42('0x97')][_0x0d42('0x58')](_0x16535b);})[_0x0d42('0x23')](function(_0x273af7){_0x3b51bf[_0x0d42('0x59')]=_0x273af7;return _0x3b51bf;});}})[_0x0d42('0x23')](respondWithFilteredResult(_0x3f49b2,_0x16535b))['catch'](handleError(_0x3f49b2,null));};exports['addAgents']=function(_0x4efc2d,_0x4645d6,_0x585933){return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0x4efc2d[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x4645d6,null))['then'](function(_0x424e99){if(_0x424e99){return _0x424e99[_0x0d42('0xba')](_0x4efc2d[_0x0d42('0x61')][_0x0d42('0xbb')],_[_0x0d42('0xbc')](_0x4efc2d[_0x0d42('0x61')],['ids','id'])||{})['spread'](function(_0x2c19af){for(var _0x43021b=0x0;_0x43021b<_0x4efc2d['body']['ids'][_0x0d42('0x4d')];_0x43021b+=0x1){socket[_0x0d42('0xbd')](_0x0d42('0xbe'),{'UserId':Number(_0x4efc2d['body'][_0x0d42('0xbb')][_0x43021b]),'OpenchannelAccountId':Number(_0x4efc2d[_0x0d42('0x5b')]['id'])});}return _0x2c19af;});}})['then'](respondWithResult(_0x4645d6,null))[_0x0d42('0x2e')](handleError(_0x4645d6,null));};exports[_0x0d42('0xbf')]=function(_0x3914ae,_0x2db417,_0x248a05){return db['OpenchannelAccount'][_0x0d42('0x66')]({'where':{'id':_0x3914ae[_0x0d42('0x5b')]['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x2db417,null))[_0x0d42('0x23')](function(_0x7cbf7){if(_0x7cbf7){return _0x7cbf7[_0x0d42('0xbf')](_0x3914ae['query'][_0x0d42('0xbb')])[_0x0d42('0x23')](function(){if(_['isArray'](_0x3914ae['query']['ids'])){for(var _0x24f67e=0x0;_0x24f67e<_0x3914ae[_0x0d42('0x48')]['ids']['length'];_0x24f67e+=0x1){socket['emit'](_0x0d42('0xc0'),{'UserId':Number(_0x3914ae['query'][_0x0d42('0xbb')][_0x24f67e]),'OpenchannelAccountId':Number(_0x3914ae[_0x0d42('0x5b')]['id'])});}}else{socket[_0x0d42('0xbd')](_0x0d42('0xc0'),{'UserId':Number(_0x3914ae[_0x0d42('0x48')][_0x0d42('0xbb')]),'OpenchannelAccountId':Number(_0x3914ae[_0x0d42('0x5b')]['id'])});}});}})[_0x0d42('0x23')](respondWithStatusCode(_0x2db417,null))[_0x0d42('0x2e')](handleError(_0x2db417,null));};exports[_0x0d42('0xc1')]=function(_0x1b670a,_0x4968c0,_0x4685dd){var _0x1b46f1={};var _0x3fc4c7={};var _0x131083;var _0x2c3149;return db[_0x0d42('0x43')]['findOne']({'where':{'id':_0x1b670a['params']['id']}})[_0x0d42('0x23')](handleEntityNotFound(_0x4968c0,null))[_0x0d42('0x23')](function(_0x51f44b){if(_0x51f44b){_0x131083=_0x51f44b;_0x3fc4c7[_0x0d42('0x46')]=_[_0x0d42('0x47')](db['User'][_0x0d42('0x5e')]);_0x3fc4c7[_0x0d42('0x48')]=_[_0x0d42('0x47')](_0x1b670a[_0x0d42('0x48')]);_0x3fc4c7[_0x0d42('0x49')]=_[_0x0d42('0x4a')](_0x3fc4c7[_0x0d42('0x46')],_0x3fc4c7[_0x0d42('0x48')]);_0x1b46f1['attributes']=_[_0x0d42('0x4a')](_0x3fc4c7['model'],qs['fields'](_0x1b670a['query']['fields']));_0x1b46f1[_0x0d42('0x4b')]=_0x1b46f1[_0x0d42('0x4b')][_0x0d42('0x4d')]?_0x1b46f1[_0x0d42('0x4b')]:_0x3fc4c7[_0x0d42('0x46')];_0x1b46f1[_0x0d42('0x50')]=qs[_0x0d42('0x51')](_0x1b670a[_0x0d42('0x48')][_0x0d42('0x51')]);_0x1b46f1[_0x0d42('0x52')]=qs[_0x0d42('0x49')](_[_0x0d42('0x53')](_0x1b670a['query'],_0x3fc4c7['filters']));if(_0x1b670a[_0x0d42('0x48')][_0x0d42('0x54')]){_0x1b46f1['where']=_[_0x0d42('0x55')](_0x1b46f1['where'],{'$or':_['map'](_0x1b46f1[_0x0d42('0x4b')],function(_0x2d878a){var _0x5168a6={};_0x5168a6[_0x2d878a]={'$like':'%'+_0x1b670a['query'][_0x0d42('0x54')]+'%'};return _0x5168a6;})});}_0x1b46f1=_[_0x0d42('0x55')]({},_0x1b46f1,_0x1b670a[_0x0d42('0x5f')]);return _0x131083[_0x0d42('0xc1')](_0x1b46f1);}})[_0x0d42('0x23')](function(_0xb294d2){if(_0xb294d2){_0x2c3149=_0xb294d2[_0x0d42('0x4d')];if(!_0x1b670a['query']['hasOwnProperty'](_0x0d42('0x4f'))){_0x1b46f1[_0x0d42('0x35')]=qs['limit'](_0x1b670a['query'][_0x0d42('0x35')]);_0x1b46f1['offset']=qs[_0x0d42('0x33')](_0x1b670a[_0x0d42('0x48')][_0x0d42('0x33')]);}return _0x131083[_0x0d42('0xc1')](_0x1b46f1);}})['then'](function(_0x2a0eab){if(_0x2a0eab){return _0x2a0eab?{'count':_0x2c3149,'rows':_0x2a0eab}:null;}})[_0x0d42('0x23')](respondWithResult(_0x4968c0,null))[_0x0d42('0x2e')](handleError(_0x4968c0,null));};exports['send']=function(_0xdd4dc7,_0x171938,_0x39e909){var _0x64c345,_0x2f15f2,_0x171916;if(_['isNil'](_0xdd4dc7[_0x0d42('0x61')][_0x0d42('0x61')])||_0xdd4dc7['body']['body']===''){throw new db[(_0x0d42('0x78'))][(_0x0d42('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d42('0x80')](_0xdd4dc7[_0x0d42('0x61')]['to'])){}_0x64c345=_0xdd4dc7['body']['to'];return db[_0x0d42('0x43')]['findOne']({'where':{'id':_0xdd4dc7[_0x0d42('0x5b')]['id']}})['then'](handleEntityNotFound(_0x171938,null))[_0x0d42('0x23')](function(_0xf91974){if(_0xf91974){return db[_0x0d42('0x43')][_0x0d42('0x66')]({'where':{'id':_0xf91974['id']},'include':[{'model':db['CmList'],'as':_0x0d42('0x87'),'include':[{'model':db[_0x0d42('0x77')],'as':_0x0d42('0x88'),'where':{[_0xf91974[_0x0d42('0x83')]]:_0x64c345},'limit':0x1,'order':[[_0x0d42('0x7b'),_0x0d42('0x89')]]}]}]})[_0x0d42('0x23')](handleEntityNotFound(_0x171938,null))[_0x0d42('0x23')](function(_0x5155b3){if(_0x5155b3&&_0x5155b3[_0x0d42('0x87')]){_0x2f15f2=_0x5155b3[_0x0d42('0x3d')]({'plain':!![]});if(_0x2f15f2[_0x0d42('0x87')]&&_0x2f15f2[_0x0d42('0x87')][_0x0d42('0x88')][_0x0d42('0x4d')]){return _0x2f15f2[_0x0d42('0x87')][_0x0d42('0x88')][0x0];}return db[_0x0d42('0x77')][_0x0d42('0x60')](_[_0x0d42('0x1a')](_0xdd4dc7[_0x0d42('0x61')],{'firstName':_0x64c345,[_0x5155b3[_0x0d42('0x83')]]:_0x64c345,'phone':_0x64c345,'ListId':_0x2f15f2[_0x0d42('0x7e')]}));}})[_0x0d42('0x23')](handleEntityNotFound(_0x171938,null))[_0x0d42('0x23')](function(_0x45b1e5){if(_0x45b1e5){_0x171916=_0x45b1e5;return db[_0x0d42('0x97')][_0x0d42('0x66')]({'where':{'ContactId':_0x171916['id'],'closed':![],'OpenchannelAccountId':_0x2f15f2['id']}})['then'](function(_0x31907b){if(_0x31907b){return[_0x31907b,![]];}return db['OpenchannelInteraction'][_0x0d42('0x60')]({'UserId':_0xdd4dc7[_0x0d42('0x64')]['id'],'ContactId':_0x171916['id'],'OpenchannelAccountId':_0x2f15f2['id'],'lastMsgDirection':'out','firstMsgDirection':_0x0d42('0xc2'),'Messages':[_[_0x0d42('0x55')](_0xdd4dc7[_0x0d42('0x61')],{'read':![],'body':_0xdd4dc7['body'][_0x0d42('0x61')],'OpenchannelAccountId':_0x2f15f2['id'],'UserId':_0xdd4dc7[_0x0d42('0x64')]['id'],'ContactId':_0x171916['id']})]},{'include':[{'model':db[_0x0d42('0xa3')],'as':_0x0d42('0xc3')}]})[_0x0d42('0x23')](function(_0x1c707c){return[_0x1c707c,!![]];});});}})[_0x0d42('0x99')](function(_0x102293,_0x34f516){if(_0x34f516){return _0x102293;}return db[_0x0d42('0xa3')]['create'](_[_0x0d42('0x55')](_0xdd4dc7[_0x0d42('0x61')],{'read':![],'body':_0xdd4dc7[_0x0d42('0x61')][_0x0d42('0x61')],'OpenchannelAccountId':_0x2f15f2['id'],'OpenchannelInteractionId':_0x102293['id'],'UserId':_0xdd4dc7[_0x0d42('0x64')]['id'],'ContactId':_0x171916['id']}))[_0x0d42('0x23')](function(_0x4242d9){_0x102293['dataValues'][_0x0d42('0xc3')]=[];_0x102293[_0x0d42('0xc4')][_0x0d42('0xc3')][_0x0d42('0x9f')](_0x4242d9['dataValues']);return _0x102293;});});}})[_0x0d42('0x23')](respondWithResult(_0x171938,null))[_0x0d42('0x2e')](handleError(_0x171938,null));}; \ No newline at end of file +var _0x8137=['client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','OpenchannelAccount','findAll','rows','catch','show','keys','include','options','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise'];(function(_0x3673f3,_0x1c9cb5){var _0x327920=function(_0x53e432){while(--_0x53e432){_0x3673f3['push'](_0x3673f3['shift']());}};_0x327920(++_0x1c9cb5);}(_0x8137,0x16b));var _0x7813=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x8137[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x7813('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7813('0x1'));var BPromise=require(_0x7813('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7813('0x3'));var ejs=require(_0x7813('0x4'));var fs=require('fs');var fs_extra=require(_0x7813('0x5'));var _=require(_0x7813('0x6'));var squel=require(_0x7813('0x7'));var crypto=require(_0x7813('0x8'));var jsforce=require(_0x7813('0x9'));var deskjs=require(_0x7813('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7813('0xb'));var authService=require(_0x7813('0xc'));var qs=require(_0x7813('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7813('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7813('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x7813('0x10'))['db'];config[_0x7813('0x11')]=_[_0x7813('0x12')](config[_0x7813('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x7813('0x13'))(new Redis(config[_0x7813('0x11')]));require(_0x7813('0x14'))[_0x7813('0x15')](socket);var jayson=require(_0x7813('0x16'));var client=jayson[_0x7813('0x17')][_0x7813('0x18')]({'port':0x232c});var client9002=jayson[_0x7813('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24284b,_0x854b52,_0xbe5f29,_0x2e7e32){return new BPromise(function(_0x50dde1,_0x297349){var _0x2235a2=_0x2e7e32||client;return _0x2235a2[_0x7813('0x19')](_0x24284b,_0xbe5f29)['then'](function(_0x2cdb30){logger['info'](_0x7813('0x1a'),_0x854b52,_0x7813('0x1b'));logger[_0x7813('0x1c')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x854b52,'request\x20sent',JSON[_0x7813('0x1d')](_0x2cdb30));if(_0x2cdb30[_0x7813('0x1e')]){if(_0x2cdb30[_0x7813('0x1e')][_0x7813('0x1f')]===0x1f4){logger[_0x7813('0x1e')](_0x7813('0x1a'),_0x854b52,_0x2cdb30[_0x7813('0x1e')][_0x7813('0x20')]);return _0x297349(_0x2cdb30[_0x7813('0x1e')]['message']);}logger[_0x7813('0x1e')](_0x7813('0x1a'),_0x854b52,_0x2cdb30[_0x7813('0x1e')][_0x7813('0x20')]);return _0x50dde1(_0x2cdb30[_0x7813('0x1e')]['message']);}else{logger['info'](_0x7813('0x1a'),_0x854b52,'request\x20sent');_0x50dde1(_0x2cdb30[_0x7813('0x21')][_0x7813('0x20')]);}})['catch'](function(_0x988ea6){logger[_0x7813('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x854b52,_0x988ea6);_0x297349(_0x988ea6);});});}function respondWithStatusCode(_0x27d212,_0x28e03f){_0x28e03f=_0x28e03f||0xcc;return function(_0xc6b7b6){if(_0xc6b7b6){return _0x27d212[_0x7813('0x22')](_0x28e03f);}return _0x27d212[_0x7813('0x23')](_0x28e03f)[_0x7813('0x24')]();};}function respondWithResult(_0x592538,_0x1051f4){_0x1051f4=_0x1051f4||0xc8;return function(_0x1e8460){if(_0x1e8460){return _0x592538[_0x7813('0x23')](_0x1051f4)[_0x7813('0x25')](_0x1e8460);}};}function respondWithFilteredResult(_0x1ea7f9,_0x8d3b87){return function(_0x507c54){if(_0x507c54){var _0x2ac976=typeof _0x8d3b87['offset']===_0x7813('0x26')&&typeof _0x8d3b87[_0x7813('0x27')]===_0x7813('0x26');var _0x392635=_0x507c54[_0x7813('0x28')];var _0x3ef104=_0x2ac976?0x0:_0x8d3b87['offset'];var _0x21e954=_0x2ac976?_0x507c54[_0x7813('0x28')]:_0x8d3b87[_0x7813('0x29')]+_0x8d3b87['limit'];var _0x492420;if(_0x21e954>=_0x392635){_0x21e954=_0x392635;_0x492420=0xc8;}else{_0x492420=0xce;}_0x1ea7f9[_0x7813('0x23')](_0x492420);return _0x1ea7f9[_0x7813('0x2a')](_0x7813('0x2b'),_0x3ef104+'-'+_0x21e954+'/'+_0x392635)[_0x7813('0x25')](_0x507c54);}return null;};}function patchUpdates(_0x50d351){return function(_0x141662){try{jsonpatch[_0x7813('0x2c')](_0x141662,_0x50d351,!![]);}catch(_0x1d4b27){return BPromise[_0x7813('0x2d')](_0x1d4b27);}return _0x141662[_0x7813('0x2e')]();};}function saveUpdates(_0x5233c5,_0xb87dde){return function(_0x47dfe0){if(_0x47dfe0){return _0x47dfe0[_0x7813('0x2f')](_0x5233c5)[_0x7813('0x30')](function(_0x170990){return _0x170990;});}return null;};}function removeEntity(_0x15fce2,_0x1ec053){return function(_0x412540){if(_0x412540){return _0x412540[_0x7813('0x31')]()[_0x7813('0x30')](function(){var _0x10c0ee=_0x412540[_0x7813('0x32')]({'plain':!![]});var _0x19bd33=_0x7813('0x33');return db[_0x7813('0x34')][_0x7813('0x31')]({'where':{'type':_0x19bd33,'resourceId':_0x10c0ee['id']}})[_0x7813('0x30')](function(){return _0x412540;});})[_0x7813('0x30')](function(){_0x15fce2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7697,_0x4b4a6f){return function(_0x598ae1){if(!_0x598ae1){_0x4c7697[_0x7813('0x22')](0x194);}return _0x598ae1;};}function handleError(_0x475068,_0xf0972b){_0xf0972b=_0xf0972b||0x1f4;return function(_0x16e9b5){logger['error'](_0x16e9b5[_0x7813('0x35')]);if(_0x16e9b5['name']){delete _0x16e9b5['name'];}_0x475068[_0x7813('0x23')](_0xf0972b)['send'](_0x16e9b5);};}exports[_0x7813('0x36')]=function(_0x5aebe4,_0x2a6e3c){var _0x1bd93e={'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]},_0x47b4ef={},_0x43c164={'count':0x0,'rows':[]};var _0x25efeb=_[_0x7813('0x39')](db['OpenchannelAccount'][_0x7813('0x3a')],function(_0x3dd99f){return{'name':_0x3dd99f[_0x7813('0x3b')],'type':_0x3dd99f[_0x7813('0x3c')][_0x7813('0x3d')]};});_0x47b4ef[_0x7813('0x3e')]=_[_0x7813('0x39')](_0x25efeb,_0x7813('0x3f'));_0x47b4ef[_0x7813('0x40')]=_['keys'](_0x5aebe4[_0x7813('0x40')]);_0x47b4ef[_0x7813('0x41')]=_[_0x7813('0x42')](_0x47b4ef[_0x7813('0x3e')],_0x47b4ef[_0x7813('0x40')]);_0x1bd93e[_0x7813('0x43')]=_[_0x7813('0x42')](_0x47b4ef[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x44')]));_0x1bd93e[_0x7813('0x43')]=_0x1bd93e[_0x7813('0x43')][_0x7813('0x45')]?_0x1bd93e['attributes']:_0x47b4ef['model'];if(!_0x5aebe4[_0x7813('0x40')]['hasOwnProperty']('nolimit')){_0x1bd93e[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x27')]);_0x1bd93e['offset']=qs[_0x7813('0x29')](_0x5aebe4[_0x7813('0x40')]['offset']);}_0x1bd93e[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x47')]);_0x1bd93e[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x5aebe4[_0x7813('0x40')],_0x47b4ef[_0x7813('0x41')]),_0x25efeb);if(_0x5aebe4[_0x7813('0x40')][_0x7813('0x4a')]){_0x1bd93e[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x1bd93e[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x25efeb,function(_0x10d4b0){if(_0x10d4b0[_0x7813('0x3c')]!==_0x7813('0x4c')){var _0x2d7ba8={};_0x2d7ba8[_0x10d4b0[_0x7813('0x3f')]]={'$like':'%'+_0x5aebe4['query'][_0x7813('0x4a')]+'%'};return _0x2d7ba8;}})});}_0x1bd93e=_[_0x7813('0x4b')]({},_0x1bd93e,_0x5aebe4['options']);var _0x51e67c={'where':_0x1bd93e[_0x7813('0x48')]};return db['OpenchannelAccount'][_0x7813('0x28')](_0x51e67c)[_0x7813('0x30')](function(_0x4a69e1){_0x43c164[_0x7813('0x28')]=_0x4a69e1;if(_0x5aebe4['query'][_0x7813('0x4d')]){_0x1bd93e['include']=[{'all':!![]}];}return db[_0x7813('0x4e')][_0x7813('0x4f')](_0x1bd93e);})[_0x7813('0x30')](function(_0x547675){_0x43c164[_0x7813('0x50')]=_0x547675;return _0x43c164;})['then'](respondWithFilteredResult(_0x2a6e3c,_0x1bd93e))[_0x7813('0x51')](handleError(_0x2a6e3c,null));};exports[_0x7813('0x52')]=function(_0x34e5c7,_0x32153e){var _0x3939cc={'raw':![],'where':{'id':_0x34e5c7['params']['id']},'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]},_0x1c4dc7={};_0x1c4dc7[_0x7813('0x3e')]=_['keys'](db[_0x7813('0x4e')][_0x7813('0x3a')]);_0x1c4dc7[_0x7813('0x40')]=_[_0x7813('0x53')](_0x34e5c7['query']);_0x1c4dc7['filters']=_[_0x7813('0x42')](_0x1c4dc7[_0x7813('0x3e')],_0x1c4dc7['query']);_0x3939cc[_0x7813('0x43')]=_['intersection'](_0x1c4dc7['model'],qs[_0x7813('0x44')](_0x34e5c7['query'][_0x7813('0x44')]));_0x3939cc[_0x7813('0x43')]=_0x3939cc[_0x7813('0x43')][_0x7813('0x45')]?_0x3939cc[_0x7813('0x43')]:_0x1c4dc7[_0x7813('0x3e')];if(_0x34e5c7['query'][_0x7813('0x4d')]){_0x3939cc[_0x7813('0x54')]=[{'all':!![]}];}_0x3939cc=_['merge']({},_0x3939cc,_0x34e5c7[_0x7813('0x55')]);return db['OpenchannelAccount']['find'](_0x3939cc)['then'](handleEntityNotFound(_0x32153e,null))[_0x7813('0x30')](respondWithResult(_0x32153e,null))[_0x7813('0x51')](handleError(_0x32153e,null));};exports[_0x7813('0x56')]=function(_0x48cfb0,_0x20f788){return db[_0x7813('0x4e')][_0x7813('0x56')](_0x48cfb0[_0x7813('0x57')],{})[_0x7813('0x30')](function(_0x25e2e9){var _0x451fbd=_0x48cfb0[_0x7813('0x58')][_0x7813('0x32')]({'plain':!![]});if(!_0x451fbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451fbd[_0x7813('0x59')]===_0x7813('0x58')){var _0x4c1d21=_0x25e2e9[_0x7813('0x32')]({'plain':!![]});var _0x4d93b8=_0x7813('0x33');return db['UserProfileSection'][_0x7813('0x5a')]({'where':{'name':_0x4d93b8,'userProfileId':_0x451fbd['userProfileId']},'raw':!![]})[_0x7813('0x30')](function(_0x299ca1){if(_0x299ca1&&_0x299ca1[_0x7813('0x5b')]===0x0){return db['UserProfileResource'][_0x7813('0x56')]({'name':_0x4c1d21[_0x7813('0x3f')],'resourceId':_0x4c1d21['id'],'type':_0x299ca1[_0x7813('0x3f')],'sectionId':_0x299ca1['id']},{})[_0x7813('0x30')](function(){return _0x25e2e9;});}else{return _0x25e2e9;}})[_0x7813('0x51')](function(_0x575d92){logger[_0x7813('0x1e')](_0x7813('0x5c'),_0x575d92);throw _0x575d92;});}return _0x25e2e9;})['then'](respondWithResult(_0x20f788,0xc9))[_0x7813('0x51')](handleError(_0x20f788,null));};exports[_0x7813('0x2f')]=function(_0x38c5cc,_0x1a2d19){if(_0x38c5cc[_0x7813('0x57')]['id']){delete _0x38c5cc[_0x7813('0x57')]['id'];}return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x38c5cc[_0x7813('0x5d')]['id']},'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]})['then'](handleEntityNotFound(_0x1a2d19,null))[_0x7813('0x30')](saveUpdates(_0x38c5cc[_0x7813('0x57')],null))[_0x7813('0x30')](respondWithResult(_0x1a2d19,null))['catch'](handleError(_0x1a2d19,null));};exports[_0x7813('0x31')]=function(_0xe190d9,_0xe8fa8f){return db[_0x7813('0x4e')]['find']({'where':{'id':_0xe190d9[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xe8fa8f,null))['then'](removeEntity(_0xe8fa8f,null))[_0x7813('0x51')](handleError(_0xe8fa8f,null));};exports[_0x7813('0x5e')]=function(_0x1f377a,_0x2bc40e){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x2bc40e,null))['catch'](handleError(_0x2bc40e,null));};exports[_0x7813('0x5f')]=function(_0x3d0169,_0x4132d3,_0x22aa8b){if(_0x3d0169[_0x7813('0x57')]['id']){delete _0x3d0169[_0x7813('0x57')]['id'];}return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x3d0169['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x4132d3,null))['then'](function(_0x427b5e){if(_0x427b5e){_0x3d0169['body'][_0x7813('0x60')]=_0x427b5e['id'];return db[_0x7813('0x61')][_0x7813('0x56')](_0x3d0169[_0x7813('0x57')]);}})[_0x7813('0x30')](respondWithResult(_0x4132d3,null))['catch'](handleError(_0x4132d3,null));};exports[_0x7813('0x62')]=function(_0x1ffed4,_0xb69913,_0xb37ccf){var _0x15d22d={'raw':![],'where':{}};var _0x351b58={};var _0x56474e={'count':0x0,'rows':[]};return db[_0x7813('0x4e')]['findOne']({'where':{'id':_0x1ffed4['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xb69913,null))[_0x7813('0x30')](function(_0x51d19f){if(_0x51d19f){_0x351b58[_0x7813('0x3e')]=_[_0x7813('0x53')](db['Disposition'][_0x7813('0x3a')]);_0x351b58[_0x7813('0x40')]=_[_0x7813('0x53')](_0x1ffed4['query']);_0x351b58[_0x7813('0x41')]=_['intersection'](_0x351b58['model'],_0x351b58[_0x7813('0x40')]);_0x15d22d[_0x7813('0x43')]=_['intersection'](_0x351b58[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x1ffed4[_0x7813('0x40')][_0x7813('0x44')]));_0x15d22d[_0x7813('0x43')]=_0x15d22d['attributes']['length']?_0x15d22d[_0x7813('0x43')]:_0x351b58[_0x7813('0x3e')];if(!_0x1ffed4[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x15d22d['limit']=qs['limit'](_0x1ffed4[_0x7813('0x40')]['limit']);_0x15d22d[_0x7813('0x29')]=qs['offset'](_0x1ffed4[_0x7813('0x40')]['offset']);}_0x15d22d[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x1ffed4[_0x7813('0x40')][_0x7813('0x47')]);_0x15d22d['where']=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x1ffed4[_0x7813('0x40')],_0x351b58[_0x7813('0x41')]));_0x15d22d[_0x7813('0x48')]['OpenchannelAccountId']=_0x51d19f['id'];if(_0x1ffed4['query'][_0x7813('0x4a')]){_0x15d22d[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x15d22d[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x15d22d[_0x7813('0x43')],function(_0x5527ca){var _0x21a270={};_0x21a270[_0x5527ca]={'$like':'%'+_0x1ffed4[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x21a270;})});}_0x15d22d=_['merge']({},_0x15d22d,_0x1ffed4[_0x7813('0x55')]);return db[_0x7813('0x61')]['count']({'where':_0x15d22d[_0x7813('0x48')]})['then'](function(_0x2efea9){_0x56474e[_0x7813('0x28')]=_0x2efea9;if(_0x1ffed4[_0x7813('0x40')]['includeAll']){_0x15d22d['include']=[{'all':!![]}];}return db[_0x7813('0x61')][_0x7813('0x4f')](_0x15d22d);})[_0x7813('0x30')](function(_0x114ab2){_0x56474e['rows']=_0x114ab2;return _0x56474e;});}})[_0x7813('0x30')](respondWithFilteredResult(_0xb69913,_0x15d22d))[_0x7813('0x51')](handleError(_0xb69913,null));};exports['removeDispositions']=function(_0x1acef3,_0x1af10f,_0x4e325d){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x1acef3['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x1af10f,null))[_0x7813('0x30')](function(_0x3fd2b4){if(_0x3fd2b4){return _0x3fd2b4[_0x7813('0x65')](_0x1acef3['query'][_0x7813('0x66')]);}})[_0x7813('0x30')](respondWithStatusCode(_0x1af10f,null))['catch'](handleError(_0x1af10f,null));};exports[_0x7813('0x67')]=function(_0x4d0c77,_0x367ed6,_0xe427cb){if(_0x4d0c77['body']['id']){delete _0x4d0c77[_0x7813('0x57')]['id'];}return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x4d0c77[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x367ed6,null))[_0x7813('0x30')](function(_0x133733){if(_0x133733){_0x4d0c77['body'][_0x7813('0x60')]=_0x133733['id'];return db[_0x7813('0x68')][_0x7813('0x56')](_0x4d0c77[_0x7813('0x57')]);}})[_0x7813('0x30')](respondWithResult(_0x367ed6,null))[_0x7813('0x51')](handleError(_0x367ed6,null));};exports[_0x7813('0x69')]=function(_0x136b18,_0x5bed72,_0x547b4b){var _0x41703b={'raw':![],'where':{}};var _0x2293fe={};var _0x448258={'count':0x0,'rows':[]};return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x136b18[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x5bed72,null))[_0x7813('0x30')](function(_0x1b987b){if(_0x1b987b){_0x2293fe[_0x7813('0x3e')]=_[_0x7813('0x53')](db[_0x7813('0x68')][_0x7813('0x3a')]);_0x2293fe[_0x7813('0x40')]=_[_0x7813('0x53')](_0x136b18['query']);_0x2293fe['filters']=_['intersection'](_0x2293fe[_0x7813('0x3e')],_0x2293fe[_0x7813('0x40')]);_0x41703b[_0x7813('0x43')]=_[_0x7813('0x42')](_0x2293fe[_0x7813('0x3e')],qs['fields'](_0x136b18[_0x7813('0x40')][_0x7813('0x44')]));_0x41703b['attributes']=_0x41703b[_0x7813('0x43')][_0x7813('0x45')]?_0x41703b['attributes']:_0x2293fe[_0x7813('0x3e')];if(!_0x136b18[_0x7813('0x40')]['hasOwnProperty'](_0x7813('0x64'))){_0x41703b['limit']=qs['limit'](_0x136b18[_0x7813('0x40')][_0x7813('0x27')]);_0x41703b[_0x7813('0x29')]=qs[_0x7813('0x29')](_0x136b18['query'][_0x7813('0x29')]);}_0x41703b[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x136b18[_0x7813('0x40')][_0x7813('0x47')]);_0x41703b[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x136b18[_0x7813('0x40')],_0x2293fe[_0x7813('0x41')]));_0x41703b[_0x7813('0x48')][_0x7813('0x60')]=_0x1b987b['id'];if(_0x136b18['query']['filter']){_0x41703b[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x41703b[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x41703b[_0x7813('0x43')],function(_0x27d2f9){var _0x9cdd95={};_0x9cdd95[_0x27d2f9]={'$like':'%'+_0x136b18[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x9cdd95;})});}_0x41703b=_[_0x7813('0x4b')]({},_0x41703b,_0x136b18[_0x7813('0x55')]);return db[_0x7813('0x68')][_0x7813('0x28')]({'where':_0x41703b[_0x7813('0x48')]})[_0x7813('0x30')](function(_0x25c473){_0x448258[_0x7813('0x28')]=_0x25c473;if(_0x136b18[_0x7813('0x40')][_0x7813('0x4d')]){_0x41703b['include']=[{'all':!![]}];}return db[_0x7813('0x68')]['findAll'](_0x41703b);})[_0x7813('0x30')](function(_0x3b85dd){_0x448258['rows']=_0x3b85dd;return _0x448258;});}})[_0x7813('0x30')](respondWithFilteredResult(_0x5bed72,_0x41703b))[_0x7813('0x51')](handleError(_0x5bed72,null));};exports[_0x7813('0x6b')]=function(_0xa6a253,_0x54717a,_0x12416b){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0xa6a253[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x54717a,null))[_0x7813('0x30')](function(_0x20a69f){if(_0x20a69f){return _0x20a69f[_0x7813('0x6b')](_0xa6a253[_0x7813('0x40')][_0x7813('0x66')]);}})[_0x7813('0x30')](respondWithStatusCode(_0x54717a,null))['catch'](handleError(_0x54717a,null));};exports[_0x7813('0x6c')]=function(_0x5b8c5f,_0x366e7c,_0x5d0a6b){var _0x48da6e={'body':_0x5b8c5f[_0x7813('0x57')],'channel':_0x7813('0x6d')};var _0x3c773f=[];var _0x17843c=[];var _0x388b3a={};var _0x3840a7=![];return db['CmContact'][_0x7813('0x5e')]()[_0x7813('0x30')](function(_0xc3c03f){if(!_0xc3c03f){throw new db[(_0x7813('0x6e'))]['ValidationError']('no\x20available\x20attributes');}_0x3c773f=_['difference'](_[_0x7813('0x53')](_0xc3c03f),[_0x7813('0x6f'),_0x7813('0x70')]);_0x17843c=_[_0x7813('0x71')](_['keys'](_0xc3c03f),[_0x7813('0x6f'),_0x7813('0x70'),_0x7813('0x72'),_0x7813('0x73')]);if(_0x5b8c5f[_0x7813('0x57')]['id']){delete _0x5b8c5f[_0x7813('0x57')]['id'];}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')])){throw new db[(_0x7813('0x6e'))]['ValidationError'](_0x7813('0x76'));}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x57')])||_0x5b8c5f['body'][_0x7813('0x57')]===''){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')])){throw new db['Sequelize'][(_0x7813('0x77'))](_0x7813('0x79')+_0x17843c);}if(!_[_0x7813('0x7a')](_0x17843c,_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')])){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))](_0x7813('0x7b')+_0x17843c);}_0x388b3a[_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')]]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')];})[_0x7813('0x30')](function(){return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x5b8c5f[_0x7813('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x7813('0x7c'),'include':[{'model':db[_0x7813('0x7d')],'as':_0x7813('0x7e'),'where':_0x388b3a,'limit':0x1,'order':[[_0x7813('0x70'),_0x7813('0x7f')]]}]},{'model':db[_0x7813('0x80')],'as':_0x7813('0x81')}]});})['then'](handleEntityNotFound(_0x366e7c,null))[_0x7813('0x30')](function(_0x20b2e5){if(_0x20b2e5&&_0x20b2e5[_0x7813('0x7c')]){_0x48da6e[_0x7813('0x82')]=_0x20b2e5;_0x48da6e[_0x7813('0x83')]=_0x20b2e5[_0x7813('0x81')];_0x48da6e['list']=_0x20b2e5[_0x7813('0x7c')];_0x48da6e['applications']=_[_0x7813('0x84')](_0x48da6e['applications'],['priority'],[_0x7813('0x85')]);if(_0x48da6e['account'][_0x7813('0x81')]){delete _0x48da6e[_0x7813('0x82')][_0x7813('0x81')];}if(_0x48da6e[_0x7813('0x82')][_0x7813('0x7c')]&&_0x48da6e[_0x7813('0x82')][_0x7813('0x7c')][_0x7813('0x7e')][_0x7813('0x45')]){return _0x48da6e[_0x7813('0x82')][_0x7813('0x7c')]['Contacts'][0x0];}var _0x199932=_[_0x7813('0x12')](_0x5b8c5f[_0x7813('0x57')],{'firstName':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')],'ListId':_0x20b2e5[_0x7813('0x73')]});_0x199932[_0x5b8c5f[_0x7813('0x57')]['mapKey']]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')];return db[_0x7813('0x7d')][_0x7813('0x56')](_0x199932,{'fields':_0x3c773f,'raw':!![]});}})[_0x7813('0x30')](handleEntityNotFound(_0x366e7c,null))[_0x7813('0x30')](function(_0x1cae9d){_0x48da6e[_0x7813('0x86')]=_0x1cae9d;if(_0x1cae9d){var _0x22c824={'ContactId':_0x1cae9d['id'],'OpenchannelAccountId':_0x5b8c5f['params']['id'],'from':(_0x1cae9d[_0x7813('0x87')]||'')+'\x20'+(_0x1cae9d[_0x7813('0x88')]||'')};var _0x599f59={'OpenchannelAccountId':_0x5b8c5f[_0x7813('0x5d')]['id'],'closed':![]};if(_0x5b8c5f['body'][_0x7813('0x89')]){_0x599f59[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x89')];return db[_0x7813('0x8a')]['find']({'where':_0x599f59})['then'](function(_0x160a6f){if(_0x160a6f){return[_0x160a6f,![]];}_0x22c824[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')]['threadId'];_0x22c824[_0x7813('0x8b')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x8b')];return db['OpenchannelInteraction'][_0x7813('0x56')](_0x22c824)[_0x7813('0x30')](function(_0x5ec0f1){return[_0x5ec0f1,!![]];});});}else{_0x599f59[_0x7813('0x89')]=null;}_0x599f59[_0x7813('0x8c')]=_0x1cae9d['id'];return db[_0x7813('0x8a')][_0x7813('0x5a')]({'where':_0x599f59})[_0x7813('0x30')](function(_0xdce55){if(_0xdce55){return[_0xdce55,![]];}return db['OpenchannelInteraction'][_0x7813('0x56')](_0x22c824)['then'](function(_0x1176f8){return[_0x1176f8,!![]];});});}})['spread'](function(_0xb2a637,_0x30f2cc){if(_0xb2a637){_0x3840a7=_0x30f2cc;if(!_0x30f2cc){var _0x3bcf24={'from':(_0x48da6e['contact'][_0x7813('0x87')]||'')+'\x20'+(_0x48da6e['contact'][_0x7813('0x88')]||'')};if(_0x5b8c5f['body'][_0x7813('0x89')]&&_0x5b8c5f['body']['messageId']&&_0x5b8c5f[_0x7813('0x57')][_0x7813('0x89')]!=_0x5b8c5f[_0x7813('0x57')]['messageId']){_0x3bcf24[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x8d')];}return _0xb2a637['update'](_0x3bcf24);}else{return _0xb2a637;}}})[_0x7813('0x30')](function(_0x2b8882){_0x48da6e[_0x7813('0x8e')]=_0x2b8882['get']({'plain':!![]});_0x48da6e['interaction'][_0x7813('0x8f')]=_0x3840a7;if(_0x48da6e[_0x7813('0x8e')]['created']){if(_0x48da6e[_0x7813('0x82')][_0x7813('0x90')]){_0x48da6e[_0x7813('0x83')][_0x7813('0x91')]({'id':0x0,'priority':_0x48da6e[_0x7813('0x83')]['length']+0x1,'app':'close','appdata':_0x7813('0x92'),'interval':'*,*,*,*'});}}return db[_0x7813('0x93')][_0x7813('0x56')]({'body':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x57')],'OpenchannelAccountId':_0x5b8c5f[_0x7813('0x5d')]['id'],'OpenchannelInteractionId':_0x2b8882['id'],'direction':'in','ContactId':_0x48da6e['contact']['id'],'AttachmentId':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x94')]});})[_0x7813('0x30')](function(_0x1c7bb1){_0x48da6e[_0x7813('0x20')]=_0x1c7bb1;if(_0x48da6e[_0x7813('0x8e')]['UserId']){return db[_0x7813('0x95')][_0x7813('0x5a')]({'attributes':['id','name'],'where':{'id':_0x48da6e['interaction'][_0x7813('0x96')]}})['then'](function(_0x5b2231){if(_0x5b2231){_0x48da6e[_0x7813('0x83')][_0x7813('0x97')]({'id':0x0,'priority':0x0,'app':_0x7813('0x98'),'appdata':_0x5b2231['name']+','+(_0x48da6e['account'][_0x7813('0x99')]||0xa),'interval':_0x7813('0x9a')});_0x48da6e[_0x7813('0x9b')]=![];}return respondWithRpcPromise(_0x7813('0x9c'),_0x7813('0x9d'),_0x48da6e);});}return respondWithRpcPromise(_0x7813('0x9c'),_0x7813('0x9d'),_0x48da6e);})['then'](function(_0x52b491){respondWithRpcPromise(_0x7813('0x9e'),_0x7813('0x9e'),{'event':_0x7813('0x6c'),'message':_0x52b491},client9002);return _0x52b491;})['then'](respondWithResult(_0x366e7c,null))[_0x7813('0x51')](handleError(_0x366e7c,null));};exports[_0x7813('0x9f')]=function(_0x22c9df,_0x22abc2){var _0x28f4ca=_0x22c9df['params']['id'];var _0x50bc92=_0x22c9df[_0x7813('0x57')];var _0x67fc48=0xc8;var _0x1beb92=null;return db[_0x7813('0xa0')][_0x7813('0xa1')]({'isolationLevel':db[_0x7813('0xa0')][_0x7813('0xa2')][_0x7813('0xa3')][_0x7813('0xa4')]},function(_0x136286){return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x28f4ca},'transaction':_0x136286})['then'](function(_0x58661f){if(_0x58661f){return db[_0x7813('0x80')]['destroy']({'where':{'OpenchannelAccountId':_0x28f4ca},'transaction':_0x136286})[_0x7813('0x30')](function(){var _0x3fb04f=_['map'](_0x50bc92,function(_0x35e94d){_0x35e94d[_0x7813('0x60')]=_0x28f4ca;return _0x35e94d;});return db[_0x7813('0x80')][_0x7813('0xa5')](_0x3fb04f,{'transaction':_0x136286});});}else{_0x67fc48=0x194;_0x1beb92=[];}});})[_0x7813('0x30')](function(){if(_0x67fc48!==0x194){return db[_0x7813('0x80')][_0x7813('0xa6')]({'where':{'OpenchannelAccountId':_0x28f4ca},'order':'priority'})['then'](function(_0xfdc4e2){_0x1beb92=_0xfdc4e2;});}})['catch'](function(_0x2b51cb){_0x67fc48=0x1f4;logger[_0x7813('0x1e')](_0x2b51cb['stack']);if(_0x2b51cb[_0x7813('0x3f')]){delete _0x2b51cb[_0x7813('0x3f')];}_0x1beb92=_0x2b51cb;})[_0x7813('0xa7')](function(){if(_0x1beb92===null){_0x22abc2[_0x7813('0x22')](_0x67fc48);}else{if(_0x67fc48===0x1f4){_0x22abc2[_0x7813('0x23')](_0x67fc48)[_0x7813('0xa8')](_0x1beb92);}else{_0x22abc2[_0x7813('0x23')](_0x67fc48)[_0x7813('0x25')](_0x1beb92);}}});};exports[_0x7813('0xa9')]=function(_0x54f289,_0x14b1d7,_0x1baaee){var _0x287b24={};var _0x53d16a={};var _0x41259f;var _0xbfc605;return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x54f289[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x14b1d7,null))['then'](function(_0x2eb98c){if(_0x2eb98c){_0x41259f=_0x2eb98c;_0x53d16a[_0x7813('0x3e')]=_[_0x7813('0x53')](db['OpenchannelApplication'][_0x7813('0x3a')]);_0x53d16a[_0x7813('0x40')]=_['keys'](_0x54f289[_0x7813('0x40')]);_0x53d16a[_0x7813('0x41')]=_[_0x7813('0x42')](_0x53d16a[_0x7813('0x3e')],_0x53d16a[_0x7813('0x40')]);_0x287b24[_0x7813('0x43')]=_[_0x7813('0x42')](_0x53d16a['model'],qs[_0x7813('0x44')](_0x54f289[_0x7813('0x40')]['fields']));_0x287b24['attributes']=_0x287b24['attributes'][_0x7813('0x45')]?_0x287b24['attributes']:_0x53d16a[_0x7813('0x3e')];_0x287b24[_0x7813('0x46')]=qs['sort'](_0x54f289[_0x7813('0x40')][_0x7813('0x47')]);_0x287b24[_0x7813('0x48')]=qs['filters'](_['pick'](_0x54f289[_0x7813('0x40')],_0x53d16a[_0x7813('0x41')]));if(_0x54f289[_0x7813('0x40')]['filter']){_0x287b24[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x287b24['where'],{'$or':_[_0x7813('0x39')](_0x287b24[_0x7813('0x43')],function(_0x291b9c){var _0x48caf9={};_0x48caf9[_0x291b9c]={'$like':'%'+_0x54f289[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x48caf9;})});}_0x287b24=_[_0x7813('0x4b')]({},_0x287b24,_0x54f289['options']);return _0x41259f['getApplications'](_0x287b24);}})['then'](function(_0x1fcb2b){if(_0x1fcb2b){_0xbfc605=_0x1fcb2b[_0x7813('0x45')];if(!_0x54f289[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x287b24[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x54f289[_0x7813('0x40')][_0x7813('0x27')]);_0x287b24['offset']=qs[_0x7813('0x29')](_0x54f289[_0x7813('0x40')]['offset']);}return _0x41259f[_0x7813('0xa9')](_0x287b24);}})[_0x7813('0x30')](function(_0x2620bc){if(_0x2620bc){return _0x2620bc?{'count':_0xbfc605,'rows':_0x2620bc}:null;}})['then'](respondWithResult(_0x14b1d7,null))['catch'](handleError(_0x14b1d7,null));};exports[_0x7813('0xaa')]=function(_0x3ba701,_0x4a9c39,_0x2f4fb7){var _0x22f8a8={'raw':![],'where':{}};var _0x152d0e={};var _0x5b618a={'count':0x0,'rows':[]};return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x3ba701['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x4a9c39,null))[_0x7813('0x30')](function(_0x305a45){if(_0x305a45){_0x152d0e[_0x7813('0x3e')]=_[_0x7813('0x53')](db['OpenchannelInteraction']['rawAttributes']);_0x152d0e['query']=_['keys'](_0x3ba701['query']);_0x152d0e[_0x7813('0x41')]=_['intersection'](_0x152d0e['model'],_0x152d0e[_0x7813('0x40')]);_0x22f8a8[_0x7813('0x43')]=_[_0x7813('0x42')](_0x152d0e['model'],qs[_0x7813('0x44')](_0x3ba701[_0x7813('0x40')]['fields']));_0x22f8a8[_0x7813('0x43')]=_0x22f8a8[_0x7813('0x43')][_0x7813('0x45')]?_0x22f8a8['attributes']:_0x152d0e['model'];if(!_0x3ba701[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x22f8a8[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x3ba701['query']['limit']);_0x22f8a8[_0x7813('0x29')]=qs[_0x7813('0x29')](_0x3ba701[_0x7813('0x40')][_0x7813('0x29')]);}_0x22f8a8['order']=qs['sort'](_0x3ba701['query']['sort']);_0x22f8a8[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x3ba701['query'],_0x152d0e[_0x7813('0x41')]));_0x22f8a8[_0x7813('0x48')][_0x7813('0x60')]=_0x305a45['id'];if(_0x3ba701[_0x7813('0x40')][_0x7813('0x4a')]){_0x22f8a8['where']=_['merge'](_0x22f8a8[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x22f8a8['attributes'],function(_0x58a33e){var _0xd5abc5={};_0xd5abc5[_0x58a33e]={'$like':'%'+_0x3ba701['query'][_0x7813('0x4a')]+'%'};return _0xd5abc5;})});}_0x22f8a8=_[_0x7813('0x4b')]({},_0x22f8a8,_0x3ba701[_0x7813('0x55')]);return db[_0x7813('0x8a')]['count']({'where':_0x22f8a8[_0x7813('0x48')]})[_0x7813('0x30')](function(_0x5d60a7){_0x5b618a['count']=_0x5d60a7;if(_0x3ba701[_0x7813('0x40')][_0x7813('0x4d')]){_0x22f8a8[_0x7813('0x54')]=[{'model':db[_0x7813('0x7d')],'as':_0x7813('0xab'),'required':![]},{'model':db[_0x7813('0x95')],'as':_0x7813('0xac'),'attributes':[_0x7813('0x3f'),_0x7813('0xad'),_0x7813('0xae')],'required':![]},{'model':db[_0x7813('0xaf')],'as':_0x7813('0xb0'),'attributes':['id',_0x7813('0x3f'),_0x7813('0xb1')],'where':_0x3ba701['query'][_0x7813('0xb2')]?{'id':_0x3ba701[_0x7813('0x40')][_0x7813('0xb2')]}:undefined,'required':_0x3ba701[_0x7813('0x40')][_0x7813('0xb2')]?!![]:![]}];}return db[_0x7813('0x8a')][_0x7813('0x4f')](_0x22f8a8);})[_0x7813('0x30')](function(_0x2d9dfc){_0x5b618a[_0x7813('0x50')]=_0x2d9dfc;return _0x5b618a;});}})[_0x7813('0x30')](respondWithFilteredResult(_0x4a9c39,_0x22f8a8))[_0x7813('0x51')](handleError(_0x4a9c39,null));};exports[_0x7813('0xb3')]=function(_0x178aab,_0x128eba,_0x12eb1f){return db['OpenchannelAccount']['find']({'where':{'id':_0x178aab[_0x7813('0x5d')]['id']}})['then'](handleEntityNotFound(_0x128eba,null))['then'](function(_0x511a13){if(_0x511a13){return _0x511a13[_0x7813('0xb3')](_0x178aab['body'][_0x7813('0x66')],_[_0x7813('0xb4')](_0x178aab[_0x7813('0x57')],[_0x7813('0x66'),'id'])||{})[_0x7813('0xb5')](function(_0x52fb59){for(var _0x3b6941=0x0;_0x3b6941<_0x178aab[_0x7813('0x57')]['ids'][_0x7813('0x45')];_0x3b6941+=0x1){socket[_0x7813('0xb6')](_0x7813('0xb7'),{'UserId':Number(_0x178aab['body'][_0x7813('0x66')][_0x3b6941]),'OpenchannelAccountId':Number(_0x178aab['params']['id'])});}return _0x52fb59;});}})[_0x7813('0x30')](respondWithResult(_0x128eba,null))[_0x7813('0x51')](handleError(_0x128eba,null));};exports[_0x7813('0xb8')]=function(_0x287994,_0x231150,_0x5f03db){return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x287994['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x231150,null))[_0x7813('0x30')](function(_0x1cfd81){if(_0x1cfd81){return _0x1cfd81[_0x7813('0xb8')](_0x287994[_0x7813('0x40')]['ids'])[_0x7813('0x30')](function(){if(_[_0x7813('0xb9')](_0x287994[_0x7813('0x40')][_0x7813('0x66')])){for(var _0xa8c413=0x0;_0xa8c413<_0x287994[_0x7813('0x40')][_0x7813('0x66')][_0x7813('0x45')];_0xa8c413+=0x1){socket[_0x7813('0xb6')](_0x7813('0xba'),{'UserId':Number(_0x287994[_0x7813('0x40')][_0x7813('0x66')][_0xa8c413]),'OpenchannelAccountId':Number(_0x287994[_0x7813('0x5d')]['id'])});}}else{socket[_0x7813('0xb6')](_0x7813('0xba'),{'UserId':Number(_0x287994[_0x7813('0x40')][_0x7813('0x66')]),'OpenchannelAccountId':Number(_0x287994[_0x7813('0x5d')]['id'])});}});}})[_0x7813('0x30')](respondWithStatusCode(_0x231150,null))[_0x7813('0x51')](handleError(_0x231150,null));};exports[_0x7813('0xbb')]=function(_0x1e75c9,_0x1d51f3,_0x2e30da){var _0x39a44a={};var _0x2db0be={};var _0x122fd8;var _0x3c6556;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1e75c9[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x1d51f3,null))[_0x7813('0x30')](function(_0x3d68eb){if(_0x3d68eb){_0x122fd8=_0x3d68eb;_0x2db0be[_0x7813('0x3e')]=_[_0x7813('0x53')](db[_0x7813('0x95')][_0x7813('0x3a')]);_0x2db0be[_0x7813('0x40')]=_['keys'](_0x1e75c9[_0x7813('0x40')]);_0x2db0be[_0x7813('0x41')]=_['intersection'](_0x2db0be[_0x7813('0x3e')],_0x2db0be[_0x7813('0x40')]);_0x39a44a['attributes']=_[_0x7813('0x42')](_0x2db0be[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x1e75c9['query'][_0x7813('0x44')]));_0x39a44a['attributes']=_0x39a44a[_0x7813('0x43')][_0x7813('0x45')]?_0x39a44a[_0x7813('0x43')]:_0x2db0be[_0x7813('0x3e')];_0x39a44a[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x1e75c9[_0x7813('0x40')][_0x7813('0x47')]);_0x39a44a['where']=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x1e75c9[_0x7813('0x40')],_0x2db0be[_0x7813('0x41')]));if(_0x1e75c9[_0x7813('0x40')][_0x7813('0x4a')]){_0x39a44a[_0x7813('0x48')]=_['merge'](_0x39a44a[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x39a44a[_0x7813('0x43')],function(_0x38962b){var _0x15bfec={};_0x15bfec[_0x38962b]={'$like':'%'+_0x1e75c9[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x15bfec;})});}_0x39a44a=_[_0x7813('0x4b')]({},_0x39a44a,_0x1e75c9[_0x7813('0x55')]);return _0x122fd8[_0x7813('0xbb')](_0x39a44a);}})[_0x7813('0x30')](function(_0x35a04b){if(_0x35a04b){_0x3c6556=_0x35a04b[_0x7813('0x45')];if(!_0x1e75c9[_0x7813('0x40')][_0x7813('0x63')]('nolimit')){_0x39a44a[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x1e75c9['query'][_0x7813('0x27')]);_0x39a44a[_0x7813('0x29')]=qs['offset'](_0x1e75c9[_0x7813('0x40')][_0x7813('0x29')]);}return _0x122fd8[_0x7813('0xbb')](_0x39a44a);}})[_0x7813('0x30')](function(_0x29c223){if(_0x29c223){return _0x29c223?{'count':_0x3c6556,'rows':_0x29c223}:null;}})[_0x7813('0x30')](respondWithResult(_0x1d51f3,null))[_0x7813('0x51')](handleError(_0x1d51f3,null));};exports['send']=function(_0x3f93c3,_0xc69a37,_0x47b645){var _0x3ea0f9,_0x2c6654,_0x107776;if(_[_0x7813('0x74')](_0x3f93c3[_0x7813('0x57')]['body'])||_0x3f93c3[_0x7813('0x57')][_0x7813('0x57')]===''){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))](_0x7813('0xbc'));}if(_[_0x7813('0x74')](_0x3f93c3[_0x7813('0x57')]['to'])){}_0x3ea0f9=_0x3f93c3[_0x7813('0x57')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3f93c3[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))[_0x7813('0x30')](function(_0x61c346){if(_0x61c346){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x61c346['id']},'include':[{'model':db[_0x7813('0xbd')],'as':_0x7813('0x7c'),'include':[{'model':db['CmContact'],'as':_0x7813('0x7e'),'where':{[_0x61c346[_0x7813('0x78')]]:_0x3ea0f9},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))[_0x7813('0x30')](function(_0x5d59fa){if(_0x5d59fa&&_0x5d59fa[_0x7813('0x7c')]){_0x2c6654=_0x5d59fa['get']({'plain':!![]});if(_0x2c6654[_0x7813('0x7c')]&&_0x2c6654[_0x7813('0x7c')]['Contacts'][_0x7813('0x45')]){return _0x2c6654[_0x7813('0x7c')]['Contacts'][0x0];}return db[_0x7813('0x7d')][_0x7813('0x56')](_[_0x7813('0x12')](_0x3f93c3[_0x7813('0x57')],{'firstName':_0x3ea0f9,[_0x5d59fa[_0x7813('0x78')]]:_0x3ea0f9,'phone':_0x3ea0f9,'ListId':_0x2c6654[_0x7813('0x73')]}));}})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))['then'](function(_0x1d1925){if(_0x1d1925){_0x107776=_0x1d1925;return db[_0x7813('0x8a')][_0x7813('0x5a')]({'where':{'ContactId':_0x107776['id'],'closed':![],'OpenchannelAccountId':_0x2c6654['id']}})[_0x7813('0x30')](function(_0x5ab444){if(_0x5ab444){return[_0x5ab444,![]];}return db[_0x7813('0x8a')]['create']({'UserId':_0x3f93c3['user']['id'],'ContactId':_0x107776['id'],'OpenchannelAccountId':_0x2c6654['id'],'lastMsgDirection':_0x7813('0xbe'),'firstMsgDirection':_0x7813('0xbe'),'Messages':[_[_0x7813('0x4b')](_0x3f93c3['body'],{'read':![],'body':_0x3f93c3['body'][_0x7813('0x57')],'OpenchannelAccountId':_0x2c6654['id'],'UserId':_0x3f93c3[_0x7813('0x58')]['id'],'ContactId':_0x107776['id']})]},{'include':[{'model':db[_0x7813('0x93')],'as':_0x7813('0xbf')}]})[_0x7813('0x30')](function(_0x60b623){return[_0x60b623,!![]];});});}})[_0x7813('0xb5')](function(_0x4630ee,_0x30e9c4){if(_0x30e9c4){return _0x4630ee;}return db[_0x7813('0x93')][_0x7813('0x56')](_[_0x7813('0x4b')](_0x3f93c3[_0x7813('0x57')],{'read':![],'body':_0x3f93c3[_0x7813('0x57')]['body'],'OpenchannelAccountId':_0x2c6654['id'],'OpenchannelInteractionId':_0x4630ee['id'],'UserId':_0x3f93c3[_0x7813('0x58')]['id'],'ContactId':_0x107776['id']}))[_0x7813('0x30')](function(_0x5c4ed4){_0x4630ee['dataValues']['Messages']=[];_0x4630ee['dataValues'][_0x7813('0xbf')][_0x7813('0x91')](_0x5c4ed4[_0x7813('0xc0')]);return _0x4630ee;});});}})[_0x7813('0x30')](respondWithResult(_0xc69a37,null))['catch'](handleError(_0xc69a37,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ba1b065..64154fc 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 _0x6f0d=['remove','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x4ffdd8,_0x599b7b){var _0x5e2187=function(_0x38ca95){while(--_0x38ca95){_0x4ffdd8['push'](_0x4ffdd8['shift']());}};_0x5e2187(++_0x599b7b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x556b7c,_0x42f215){_0x556b7c=_0x556b7c-0x0;var _0x148409=_0x6f0d[_0x556b7c];return _0x148409;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd6f0('0x0'))['db'][_0xd6f0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd6f0('0x2')](0x0);var events={'afterCreate':_0xd6f0('0x3'),'afterUpdate':'update','afterDestroy':_0xd6f0('0x4')};function emitEvent(_0x135a93){return function(_0x2f78fb,_0x25344b,_0x3a757f){OpenchannelAccountEvents['emit'](_0x135a93+':'+_0x2f78fb['id'],_0x2f78fb);OpenchannelAccountEvents[_0xd6f0('0x5')](_0x135a93,_0x2f78fb);_0x3a757f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd6f0('0x6')](e,emitEvent(event));}}module[_0xd6f0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x1a431c,_0x1728db){var _0x4f64af=function(_0x33193f){while(--_0x33193f){_0x1a431c['push'](_0x1a431c['shift']());}};_0x4f64af(++_0x1728db);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1a86ed,_0xf98741){_0x1a86ed=_0x1a86ed-0x0;var _0xba6025=_0xb58b[_0x1a86ed];return _0xba6025;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d7bc128..e93c9de 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(_0x51e2b1,_0x488e7f){var _0xd2534a=function(_0x3e63fc){while(--_0x3e63fc){_0x51e2b1['push'](_0x51e2b1['shift']());}};_0xd2534a(++_0x488e7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x389976,_0x4bde4d){var _0xfbc2a=function(_0x39223b){while(--_0x39223b){_0x389976['push'](_0x389976['shift']());}};_0xfbc2a(++_0x4bde4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5998311..8d019c4 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 _0x536f=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});config[_0xf536('0x8')]=_['defaults'](config['redis'],{'host':_0xf536('0x9'),'port':0x18eb});var socket=require(_0xf536('0xa'))(new Redis(config[_0xf536('0x8')]));require(_0xf536('0xb'))['register'](socket);function respondWithRpcPromise(_0x4e7088,_0xbfbdfc,_0x1e0ebc){return new BPromise(function(_0x550a82,_0x4868bd){return client[_0xf536('0xc')](_0x4e7088,_0x1e0ebc)[_0xf536('0xd')](function(_0x16c1ae){logger[_0xf536('0xe')](_0xf536('0xf'),_0xbfbdfc,'request\x20sent');logger[_0xf536('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xbfbdfc,_0xf536('0x11'),JSON[_0xf536('0x12')](_0x16c1ae));if(_0x16c1ae[_0xf536('0x13')]){if(_0x16c1ae[_0xf536('0x13')][_0xf536('0x14')]===0x1f4){logger[_0xf536('0x13')](_0xf536('0xf'),_0xbfbdfc,_0x16c1ae[_0xf536('0x13')][_0xf536('0x15')]);return _0x4868bd(_0x16c1ae[_0xf536('0x13')][_0xf536('0x15')]);}logger[_0xf536('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0xbfbdfc,_0x16c1ae[_0xf536('0x13')]['message']);return _0x550a82(_0x16c1ae[_0xf536('0x13')]['message']);}else{logger[_0xf536('0xe')](_0xf536('0xf'),_0xbfbdfc,_0xf536('0x11'));_0x550a82(_0x16c1ae[_0xf536('0x16')][_0xf536('0x15')]);}})[_0xf536('0x17')](function(_0x271e4d){logger[_0xf536('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0xbfbdfc,_0x271e4d);_0x4868bd(_0x271e4d);});});} \ No newline at end of file +var _0x7af2=['register','request','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x3ecdd8,_0xb82b0d){var _0x3d23c9=function(_0x2712cb){while(--_0x2712cb){_0x3ecdd8['push'](_0x3ecdd8['shift']());}};_0x3d23c9(++_0xb82b0d);}(_0x7af2,0x119));var _0x27af=function(_0x8fad8c,_0xf1573b){_0x8fad8c=_0x8fad8c-0x0;var _0xae3eb6=_0x7af2[_0x8fad8c];return _0xae3eb6;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});config[_0x27af('0xc')]=_['defaults'](config[_0x27af('0xc')],{'host':_0x27af('0xd'),'port':0x18eb});var socket=require(_0x27af('0xe'))(new Redis(config['redis']));require(_0x27af('0xf'))[_0x27af('0x10')](socket);function respondWithRpcPromise(_0x5841aa,_0x4e27bf,_0x1617c0){return new BPromise(function(_0x582a9e,_0x4d4729){return client[_0x27af('0x11')](_0x5841aa,_0x1617c0)['then'](function(_0x50fe01){logger[_0x27af('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e27bf,_0x27af('0x13'));logger['debug'](_0x27af('0x14'),_0x4e27bf,_0x27af('0x13'),JSON[_0x27af('0x15')](_0x50fe01));if(_0x50fe01[_0x27af('0x16')]){if(_0x50fe01[_0x27af('0x16')][_0x27af('0x17')]===0x1f4){logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);return _0x4d4729(_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);}logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);return _0x582a9e(_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);}else{logger['info'](_0x27af('0x18'),_0x4e27bf,_0x27af('0x13'));_0x582a9e(_0x50fe01['result']['message']);}})[_0x27af('0x1a')](function(_0x478572){logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x478572);_0x4d4729(_0x478572);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8dd0d2a..ba79b83 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 _0x55e0=['emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x55e0,0xdc));var _0x055e=function(_0x188e5a,_0x12b8d0){_0x188e5a=_0x188e5a-0x0;var _0x34aeee=_0x55e0[_0x188e5a];return _0x34aeee;};'use strict';var OpenchannelAccountEvents=require(_0x055e('0x0'));var events=[_0x055e('0x1'),_0x055e('0x2'),_0x055e('0x3')];function createListener(_0x5b82b9,_0x578882){return function(_0x3a2ee6){_0x578882[_0x055e('0x4')](_0x5b82b9,_0x3a2ee6);};}function removeListener(_0x33cd7b,_0x2773e4){return function(){OpenchannelAccountEvents[_0x055e('0x5')](_0x33cd7b,_0x2773e4);};}exports[_0x055e('0x6')]=function(_0x490ee1){for(var _0x5239f6=0x0,_0x4384ff=events['length'];_0x5239f6<_0x4384ff;_0x5239f6++){var _0x8e7824=events[_0x5239f6];var _0x3c4cf=createListener(_0x055e('0x7')+_0x8e7824,_0x490ee1);OpenchannelAccountEvents['on'](_0x8e7824,_0x3c4cf);}}; \ No newline at end of file +var _0xe189=['update','removeListener','register','length','./openchannelAccount.events'];(function(_0x471905,_0x23a91d){var _0x37bb7a=function(_0x99c55e){while(--_0x99c55e){_0x471905['push'](_0x471905['shift']());}};_0x37bb7a(++_0x23a91d);}(_0xe189,0x194));var _0x9e18=function(_0x439b73,_0x26944e){_0x439b73=_0x439b73-0x0;var _0xa8d3c=_0xe189[_0x439b73];return _0xa8d3c;};'use strict';var OpenchannelAccountEvents=require(_0x9e18('0x0'));var events=['save','remove',_0x9e18('0x1')];function createListener(_0x2bc037,_0x22eac1){return function(_0x30a009){_0x22eac1['emit'](_0x2bc037,_0x30a009);};}function removeListener(_0x49b0f7,_0x1c652d){return function(){OpenchannelAccountEvents[_0x9e18('0x2')](_0x49b0f7,_0x1c652d);};}exports[_0x9e18('0x3')]=function(_0x53d7c9){for(var _0x3e6881=0x0,_0x5e6097=events[_0x9e18('0x4')];_0x3e6881<_0x5e6097;_0x3e6881++){var _0x2e4691=events[_0x3e6881];var _0x4656a4=createListener('openchannelAccount:'+_0x2e4691,_0x53d7c9);OpenchannelAccountEvents['on'](_0x2e4691,_0x4656a4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ad73258..745497d 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 _0xa239=['index','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1d26b2,_0x2b96e4){var _0x46f2dc=function(_0x2abead){while(--_0x2abead){_0x1d26b2['push'](_0x1d26b2['shift']());}};_0x46f2dc(++_0x2b96e4);}(_0xa239,0x183));var _0x9a23=function(_0x5b28d0,_0x1e0a43){_0x5b28d0=_0x5b28d0-0x0;var _0xd35d8a=_0xa239[_0x5b28d0];return _0xd35d8a;};'use strict';var multer=require(_0x9a23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a23('0x1'));var express=require(_0x9a23('0x2'));var router=express['Router']();var fs_extra=require(_0x9a23('0x3'));var auth=require(_0x9a23('0x4'));var interaction=require(_0x9a23('0x5'));var config=require(_0x9a23('0x6'));var controller=require('./openchannelApplication.controller');router[_0x9a23('0x7')]('/',auth[_0x9a23('0x8')](),controller[_0x9a23('0x9')]);router[_0x9a23('0x7')](_0x9a23('0xa'),auth['isAuthenticated'](),controller[_0x9a23('0xb')]);router[_0x9a23('0xc')]('/',auth[_0x9a23('0x8')](),controller[_0x9a23('0xd')]);router[_0x9a23('0xe')](_0x9a23('0xa'),auth[_0x9a23('0x8')](),controller[_0x9a23('0xf')]);router[_0x9a23('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9a23('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3bf4=['show','post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x4aba2e,_0x4ea482){var _0x232149=function(_0x23eefa){while(--_0x23eefa){_0x4aba2e['push'](_0x4aba2e['shift']());}};_0x232149(++_0x4ea482);}(_0x3bf4,0x197));var _0x43bf=function(_0x389242,_0x34461e){_0x389242=_0x389242-0x0;var _0x3b47b3=_0x3bf4[_0x389242];return _0x3b47b3;};'use strict';var multer=require('multer');var util=require(_0x43bf('0x0'));var path=require(_0x43bf('0x1'));var timeout=require(_0x43bf('0x2'));var express=require('express');var router=express[_0x43bf('0x3')]();var fs_extra=require(_0x43bf('0x4'));var auth=require(_0x43bf('0x5'));var interaction=require(_0x43bf('0x6'));var config=require(_0x43bf('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x43bf('0x8')](),controller[_0x43bf('0x9')]);router[_0x43bf('0xa')]('/:id',auth[_0x43bf('0x8')](),controller[_0x43bf('0xb')]);router[_0x43bf('0xc')]('/',auth[_0x43bf('0x8')](),controller[_0x43bf('0xd')]);router['put']('/:id',auth[_0x43bf('0x8')](),controller[_0x43bf('0xe')]);router[_0x43bf('0xf')](_0x43bf('0x10'),auth['isAuthenticated'](),controller[_0x43bf('0x11')]);module[_0x43bf('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f533dad..4085a26 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 _0x4964=['exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4964,0x8a));var _0x4496=function(_0x22fbe3,_0x9f2690){_0x22fbe3=_0x22fbe3-0x0;var _0x3eb108=_0x4964[_0x22fbe3];return _0x3eb108;};'use strict';var Sequelize=require('sequelize');module[_0x4496('0x0')]={'priority':{'type':Sequelize[_0x4496('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4496('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4496('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0b6f=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x0b6f,0x134));var _0xf0b6=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x0b6f[_0x14476b];return _0x24e2e8;};'use strict';var Sequelize=require(_0xf0b6('0x0'));module[_0xf0b6('0x1')]={'priority':{'type':Sequelize[_0xf0b6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf0b6('0x3')],'allowNull':![],'defaultValue':_0xf0b6('0x4')},'appdata':{'type':Sequelize[_0xf0b6('0x5')]()},'description':{'type':Sequelize[_0xf0b6('0x3')]},'interval':{'type':Sequelize[_0xf0b6('0x3')],'defaultValue':_0xf0b6('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0822950..7288714 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 _0x85ff=['map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','offset','count','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name'];(function(_0x492f06,_0x2696dc){var _0x2638ad=function(_0x5e1b5d){while(--_0x5e1b5d){_0x492f06['push'](_0x492f06['shift']());}};_0x2638ad(++_0x2696dc);}(_0x85ff,0x6b));var _0xf85f=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x85ff[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xf85f('0x0'));var rimraf=require(_0xf85f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf85f('0x2'));var rp=require(_0xf85f('0x3'));var moment=require(_0xf85f('0x4'));var BPromise=require(_0xf85f('0x5'));var Mustache=require(_0xf85f('0x6'));var util=require(_0xf85f('0x7'));var path=require(_0xf85f('0x8'));var sox=require(_0xf85f('0x9'));var csv=require('to-csv');var ejs=require(_0xf85f('0xa'));var fs=require('fs');var fs_extra=require(_0xf85f('0xb'));var _=require(_0xf85f('0xc'));var squel=require(_0xf85f('0xd'));var crypto=require(_0xf85f('0xe'));var jsforce=require(_0xf85f('0xf'));var deskjs=require(_0xf85f('0x10'));var toCsv=require(_0xf85f('0x11'));var querystring=require('querystring');var Papa=require(_0xf85f('0x12'));var Redis=require(_0xf85f('0x13'));var authService=require(_0xf85f('0x14'));var qs=require(_0xf85f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf85f('0x16'));var logger=require(_0xf85f('0x17'))(_0xf85f('0x18'));var utils=require('../../config/utils');var config=require(_0xf85f('0x19'));var licenseUtil=require(_0xf85f('0x1a'));var db=require(_0xf85f('0x1b'))['db'];function respondWithStatusCode(_0x1dffad,_0x5a9138){_0x5a9138=_0x5a9138||0xcc;return function(_0x3a7743){if(_0x3a7743){return _0x1dffad['sendStatus'](_0x5a9138);}return _0x1dffad['status'](_0x5a9138)[_0xf85f('0x1c')]();};}function respondWithResult(_0x203a78,_0xf1afb9){_0xf1afb9=_0xf1afb9||0xc8;return function(_0x2a6226){if(_0x2a6226){return _0x203a78['status'](_0xf1afb9)[_0xf85f('0x1d')](_0x2a6226);}};}function respondWithFilteredResult(_0x1d2026,_0x475858){return function(_0x5c3469){if(_0x5c3469){var _0x3369bd=typeof _0x475858['offset']==='undefined'&&typeof _0x475858[_0xf85f('0x1e')]===_0xf85f('0x1f');var _0x445da9=_0x5c3469['count'];var _0x24b8a7=_0x3369bd?0x0:_0x475858[_0xf85f('0x20')];var _0x2c455c=_0x3369bd?_0x5c3469[_0xf85f('0x21')]:_0x475858[_0xf85f('0x20')]+_0x475858[_0xf85f('0x1e')];var _0x5f1359;if(_0x2c455c>=_0x445da9){_0x2c455c=_0x445da9;_0x5f1359=0xc8;}else{_0x5f1359=0xce;}_0x1d2026[_0xf85f('0x22')](_0x5f1359);return _0x1d2026[_0xf85f('0x23')](_0xf85f('0x24'),_0x24b8a7+'-'+_0x2c455c+'/'+_0x445da9)[_0xf85f('0x1d')](_0x5c3469);}return null;};}function patchUpdates(_0x2811b0){return function(_0x37c7d5){try{jsonpatch[_0xf85f('0x25')](_0x37c7d5,_0x2811b0,!![]);}catch(_0x1fd38c){return BPromise[_0xf85f('0x26')](_0x1fd38c);}return _0x37c7d5['save']();};}function saveUpdates(_0x875f3e,_0x36ebe8){return function(_0x2d7ec6){if(_0x2d7ec6){return _0x2d7ec6[_0xf85f('0x27')](_0x875f3e)[_0xf85f('0x28')](function(_0xf6bbcf){return _0xf6bbcf;});}return null;};}function removeEntity(_0x191b62,_0x2abafc){return function(_0x1ac826){if(_0x1ac826){return _0x1ac826[_0xf85f('0x29')]()[_0xf85f('0x28')](function(){_0x191b62['status'](0xcc)[_0xf85f('0x1c')]();});}};}function handleEntityNotFound(_0x4e3708,_0x16040c){return function(_0x450410){if(!_0x450410){_0x4e3708[_0xf85f('0x2a')](0x194);}return _0x450410;};}function handleError(_0x9b5917,_0x2a36d3){_0x2a36d3=_0x2a36d3||0x1f4;return function(_0x499297){logger[_0xf85f('0x2b')](_0x499297['stack']);if(_0x499297[_0xf85f('0x2c')]){delete _0x499297[_0xf85f('0x2c')];}_0x9b5917[_0xf85f('0x22')](_0x2a36d3)['send'](_0x499297);};}exports['index']=function(_0x509872,_0x51d964){var _0x4b8b22={},_0x4e688c={},_0x174525={'count':0x0,'rows':[]};var _0x4a4690=_[_0xf85f('0x2d')](db[_0xf85f('0x2e')][_0xf85f('0x2f')],function(_0x21261f){return{'name':_0x21261f[_0xf85f('0x30')],'type':_0x21261f['type'][_0xf85f('0x31')]};});_0x4e688c[_0xf85f('0x32')]=_[_0xf85f('0x2d')](_0x4a4690,_0xf85f('0x2c'));_0x4e688c['query']=_[_0xf85f('0x33')](_0x509872[_0xf85f('0x34')]);_0x4e688c[_0xf85f('0x35')]=_[_0xf85f('0x36')](_0x4e688c[_0xf85f('0x32')],_0x4e688c[_0xf85f('0x34')]);_0x4b8b22[_0xf85f('0x37')]=_[_0xf85f('0x36')](_0x4e688c['model'],qs['fields'](_0x509872[_0xf85f('0x34')][_0xf85f('0x38')]));_0x4b8b22['attributes']=_0x4b8b22[_0xf85f('0x37')][_0xf85f('0x39')]?_0x4b8b22[_0xf85f('0x37')]:_0x4e688c[_0xf85f('0x32')];if(!_0x509872[_0xf85f('0x34')]['hasOwnProperty'](_0xf85f('0x3a'))){_0x4b8b22[_0xf85f('0x1e')]=qs[_0xf85f('0x1e')](_0x509872[_0xf85f('0x34')]['limit']);_0x4b8b22['offset']=qs[_0xf85f('0x20')](_0x509872[_0xf85f('0x34')]['offset']);}_0x4b8b22[_0xf85f('0x3b')]=qs['sort'](_0x509872[_0xf85f('0x34')][_0xf85f('0x3c')]);_0x4b8b22[_0xf85f('0x3d')]=qs[_0xf85f('0x35')](_['pick'](_0x509872[_0xf85f('0x34')],_0x4e688c['filters']),_0x4a4690);if(_0x509872['query']['filter']){_0x4b8b22[_0xf85f('0x3d')]=_[_0xf85f('0x3e')](_0x4b8b22[_0xf85f('0x3d')],{'$or':_[_0xf85f('0x2d')](_0x4a4690,function(_0x3b37db){if(_0x3b37db['type']!==_0xf85f('0x3f')){var _0x226507={};_0x226507[_0x3b37db[_0xf85f('0x2c')]]={'$like':'%'+_0x509872[_0xf85f('0x34')][_0xf85f('0x40')]+'%'};return _0x226507;}})});}_0x4b8b22=_['merge']({},_0x4b8b22,_0x509872[_0xf85f('0x41')]);var _0x2caa25={'where':_0x4b8b22[_0xf85f('0x3d')]};return db[_0xf85f('0x2e')][_0xf85f('0x21')](_0x2caa25)[_0xf85f('0x28')](function(_0x1236ea){_0x174525[_0xf85f('0x21')]=_0x1236ea;if(_0x509872[_0xf85f('0x34')][_0xf85f('0x42')]){_0x4b8b22[_0xf85f('0x43')]=[{'all':!![]}];}return db[_0xf85f('0x2e')][_0xf85f('0x44')](_0x4b8b22);})[_0xf85f('0x28')](function(_0x5b4cd8){_0x174525[_0xf85f('0x45')]=_0x5b4cd8;return _0x174525;})['then'](respondWithFilteredResult(_0x51d964,_0x4b8b22))[_0xf85f('0x46')](handleError(_0x51d964,null));};exports[_0xf85f('0x47')]=function(_0x37e680,_0x3ae308){var _0x19d87a={'raw':!![],'where':{'id':_0x37e680[_0xf85f('0x48')]['id']}},_0xdb76ef={};_0xdb76ef[_0xf85f('0x32')]=_[_0xf85f('0x33')](db[_0xf85f('0x2e')]['rawAttributes']);_0xdb76ef[_0xf85f('0x34')]=_[_0xf85f('0x33')](_0x37e680['query']);_0xdb76ef[_0xf85f('0x35')]=_[_0xf85f('0x36')](_0xdb76ef[_0xf85f('0x32')],_0xdb76ef['query']);_0x19d87a[_0xf85f('0x37')]=_['intersection'](_0xdb76ef[_0xf85f('0x32')],qs[_0xf85f('0x38')](_0x37e680[_0xf85f('0x34')][_0xf85f('0x38')]));_0x19d87a[_0xf85f('0x37')]=_0x19d87a['attributes']['length']?_0x19d87a[_0xf85f('0x37')]:_0xdb76ef[_0xf85f('0x32')];if(_0x37e680['query'][_0xf85f('0x42')]){_0x19d87a[_0xf85f('0x43')]=[{'all':!![]}];}_0x19d87a=_[_0xf85f('0x3e')]({},_0x19d87a,_0x37e680[_0xf85f('0x41')]);return db['OpenchannelApplication'][_0xf85f('0x49')](_0x19d87a)[_0xf85f('0x28')](handleEntityNotFound(_0x3ae308,null))[_0xf85f('0x28')](respondWithResult(_0x3ae308,null))[_0xf85f('0x46')](handleError(_0x3ae308,null));};exports[_0xf85f('0x4a')]=function(_0x26330e,_0x2af09b){return db[_0xf85f('0x2e')][_0xf85f('0x4a')](_0x26330e[_0xf85f('0x4b')],{})[_0xf85f('0x28')](respondWithResult(_0x2af09b,0xc9))['catch'](handleError(_0x2af09b,null));};exports[_0xf85f('0x27')]=function(_0xeefd1e,_0x4977fc){if(_0xeefd1e[_0xf85f('0x4b')]['id']){delete _0xeefd1e[_0xf85f('0x4b')]['id'];}return db[_0xf85f('0x2e')]['find']({'where':{'id':_0xeefd1e[_0xf85f('0x48')]['id']}})['then'](handleEntityNotFound(_0x4977fc,null))['then'](saveUpdates(_0xeefd1e[_0xf85f('0x4b')],null))['then'](respondWithResult(_0x4977fc,null))[_0xf85f('0x46')](handleError(_0x4977fc,null));};exports[_0xf85f('0x29')]=function(_0x2364cc,_0x5a1be3){return db['OpenchannelApplication'][_0xf85f('0x49')]({'where':{'id':_0x2364cc[_0xf85f('0x48')]['id']}})[_0xf85f('0x28')](handleEntityNotFound(_0x5a1be3,null))[_0xf85f('0x28')](removeEntity(_0x5a1be3,null))[_0xf85f('0x46')](handleError(_0x5a1be3,null));}; \ No newline at end of file +var _0x3c8c=['OpenchannelApplication','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x382759,_0x3af145){var _0x5b087c=function(_0x2ec4a2){while(--_0x2ec4a2){_0x382759['push'](_0x382759['shift']());}};_0x5b087c(++_0x3af145);}(_0x3c8c,0xa2));var _0xc3c8=function(_0x34cc16,_0x54ef8a){_0x34cc16=_0x34cc16-0x0;var _0x4551e6=_0x3c8c[_0x34cc16];return _0x4551e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c8('0x0'));var zipdir=require(_0xc3c8('0x1'));var jsonpatch=require(_0xc3c8('0x2'));var rp=require(_0xc3c8('0x3'));var moment=require(_0xc3c8('0x4'));var BPromise=require(_0xc3c8('0x5'));var Mustache=require(_0xc3c8('0x6'));var util=require('util');var path=require(_0xc3c8('0x7'));var sox=require('sox');var csv=require(_0xc3c8('0x8'));var ejs=require(_0xc3c8('0x9'));var fs=require('fs');var fs_extra=require(_0xc3c8('0xa'));var _=require('lodash');var squel=require(_0xc3c8('0xb'));var crypto=require(_0xc3c8('0xc'));var jsforce=require(_0xc3c8('0xd'));var deskjs=require(_0xc3c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc3c8('0xf'));var Papa=require(_0xc3c8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3c8('0x11'));var as=require(_0xc3c8('0x12'));var hardwareService=require(_0xc3c8('0x13'));var logger=require(_0xc3c8('0x14'))('api');var utils=require(_0xc3c8('0x15'));var config=require(_0xc3c8('0x16'));var licenseUtil=require(_0xc3c8('0x17'));var db=require(_0xc3c8('0x18'))['db'];function respondWithStatusCode(_0x45d8e2,_0x271687){_0x271687=_0x271687||0xcc;return function(_0x497a22){if(_0x497a22){return _0x45d8e2[_0xc3c8('0x19')](_0x271687);}return _0x45d8e2['status'](_0x271687)['end']();};}function respondWithResult(_0xecd136,_0xda0d9c){_0xda0d9c=_0xda0d9c||0xc8;return function(_0x583d6d){if(_0x583d6d){return _0xecd136[_0xc3c8('0x1a')](_0xda0d9c)[_0xc3c8('0x1b')](_0x583d6d);}};}function respondWithFilteredResult(_0x554544,_0x1dd192){return function(_0x1c4086){if(_0x1c4086){var _0x488677=typeof _0x1dd192[_0xc3c8('0x1c')]==='undefined'&&typeof _0x1dd192[_0xc3c8('0x1d')]===_0xc3c8('0x1e');var _0x1a662a=_0x1c4086[_0xc3c8('0x1f')];var _0xeddf0c=_0x488677?0x0:_0x1dd192[_0xc3c8('0x1c')];var _0x958e1d=_0x488677?_0x1c4086['count']:_0x1dd192['offset']+_0x1dd192['limit'];var _0xc55e42;if(_0x958e1d>=_0x1a662a){_0x958e1d=_0x1a662a;_0xc55e42=0xc8;}else{_0xc55e42=0xce;}_0x554544['status'](_0xc55e42);return _0x554544[_0xc3c8('0x20')]('Content-Range',_0xeddf0c+'-'+_0x958e1d+'/'+_0x1a662a)[_0xc3c8('0x1b')](_0x1c4086);}return null;};}function patchUpdates(_0x4bdcd4){return function(_0x3e193b){try{jsonpatch[_0xc3c8('0x21')](_0x3e193b,_0x4bdcd4,!![]);}catch(_0x2e3b3d){return BPromise[_0xc3c8('0x22')](_0x2e3b3d);}return _0x3e193b[_0xc3c8('0x23')]();};}function saveUpdates(_0x435d29,_0x40fd1b){return function(_0x3cddc1){if(_0x3cddc1){return _0x3cddc1[_0xc3c8('0x24')](_0x435d29)[_0xc3c8('0x25')](function(_0x1f1a79){return _0x1f1a79;});}return null;};}function removeEntity(_0x2459ad,_0x310a41){return function(_0xdbe626){if(_0xdbe626){return _0xdbe626[_0xc3c8('0x26')]()[_0xc3c8('0x25')](function(){_0x2459ad[_0xc3c8('0x1a')](0xcc)[_0xc3c8('0x27')]();});}};}function handleEntityNotFound(_0x922442,_0x1f8a2b){return function(_0x5377d5){if(!_0x5377d5){_0x922442['sendStatus'](0x194);}return _0x5377d5;};}function handleError(_0x3ff084,_0x17c456){_0x17c456=_0x17c456||0x1f4;return function(_0x3d907d){logger['error'](_0x3d907d[_0xc3c8('0x28')]);if(_0x3d907d[_0xc3c8('0x29')]){delete _0x3d907d[_0xc3c8('0x29')];}_0x3ff084[_0xc3c8('0x1a')](_0x17c456)[_0xc3c8('0x2a')](_0x3d907d);};}exports[_0xc3c8('0x2b')]=function(_0x2e4a8a,_0x4f3151){var _0x4441a5={},_0x558ab5={},_0x5443a2={'count':0x0,'rows':[]};var _0xa3a00a=_['map'](db['OpenchannelApplication'][_0xc3c8('0x2c')],function(_0x5903b6){return{'name':_0x5903b6[_0xc3c8('0x2d')],'type':_0x5903b6[_0xc3c8('0x2e')][_0xc3c8('0x2f')]};});_0x558ab5[_0xc3c8('0x30')]=_[_0xc3c8('0x31')](_0xa3a00a,_0xc3c8('0x29'));_0x558ab5[_0xc3c8('0x32')]=_[_0xc3c8('0x33')](_0x2e4a8a[_0xc3c8('0x32')]);_0x558ab5[_0xc3c8('0x34')]=_[_0xc3c8('0x35')](_0x558ab5[_0xc3c8('0x30')],_0x558ab5[_0xc3c8('0x32')]);_0x4441a5['attributes']=_['intersection'](_0x558ab5[_0xc3c8('0x30')],qs[_0xc3c8('0x36')](_0x2e4a8a[_0xc3c8('0x32')]['fields']));_0x4441a5['attributes']=_0x4441a5[_0xc3c8('0x37')][_0xc3c8('0x38')]?_0x4441a5[_0xc3c8('0x37')]:_0x558ab5[_0xc3c8('0x30')];if(!_0x2e4a8a[_0xc3c8('0x32')]['hasOwnProperty'](_0xc3c8('0x39'))){_0x4441a5[_0xc3c8('0x1d')]=qs[_0xc3c8('0x1d')](_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x1d')]);_0x4441a5[_0xc3c8('0x1c')]=qs[_0xc3c8('0x1c')](_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x1c')]);}_0x4441a5[_0xc3c8('0x3a')]=qs[_0xc3c8('0x3b')](_0x2e4a8a['query'][_0xc3c8('0x3b')]);_0x4441a5[_0xc3c8('0x3c')]=qs['filters'](_[_0xc3c8('0x3d')](_0x2e4a8a[_0xc3c8('0x32')],_0x558ab5[_0xc3c8('0x34')]),_0xa3a00a);if(_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x3e')]){_0x4441a5['where']=_[_0xc3c8('0x3f')](_0x4441a5[_0xc3c8('0x3c')],{'$or':_[_0xc3c8('0x31')](_0xa3a00a,function(_0x40054f){if(_0x40054f['type']!==_0xc3c8('0x40')){var _0x54d995={};_0x54d995[_0x40054f[_0xc3c8('0x29')]]={'$like':'%'+_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x3e')]+'%'};return _0x54d995;}})});}_0x4441a5=_['merge']({},_0x4441a5,_0x2e4a8a[_0xc3c8('0x41')]);var _0x2510a0={'where':_0x4441a5[_0xc3c8('0x3c')]};return db[_0xc3c8('0x42')][_0xc3c8('0x1f')](_0x2510a0)[_0xc3c8('0x25')](function(_0x4f35b2){_0x5443a2[_0xc3c8('0x1f')]=_0x4f35b2;if(_0x2e4a8a[_0xc3c8('0x32')]['includeAll']){_0x4441a5[_0xc3c8('0x43')]=[{'all':!![]}];}return db[_0xc3c8('0x42')]['findAll'](_0x4441a5);})['then'](function(_0x3bd32d){_0x5443a2[_0xc3c8('0x44')]=_0x3bd32d;return _0x5443a2;})['then'](respondWithFilteredResult(_0x4f3151,_0x4441a5))[_0xc3c8('0x45')](handleError(_0x4f3151,null));};exports[_0xc3c8('0x46')]=function(_0x18dda1,_0x1b264b){var _0x457b57={'raw':!![],'where':{'id':_0x18dda1[_0xc3c8('0x47')]['id']}},_0x2df914={};_0x2df914[_0xc3c8('0x30')]=_['keys'](db[_0xc3c8('0x42')]['rawAttributes']);_0x2df914[_0xc3c8('0x32')]=_[_0xc3c8('0x33')](_0x18dda1[_0xc3c8('0x32')]);_0x2df914[_0xc3c8('0x34')]=_['intersection'](_0x2df914[_0xc3c8('0x30')],_0x2df914[_0xc3c8('0x32')]);_0x457b57[_0xc3c8('0x37')]=_['intersection'](_0x2df914[_0xc3c8('0x30')],qs[_0xc3c8('0x36')](_0x18dda1[_0xc3c8('0x32')][_0xc3c8('0x36')]));_0x457b57[_0xc3c8('0x37')]=_0x457b57['attributes'][_0xc3c8('0x38')]?_0x457b57['attributes']:_0x2df914[_0xc3c8('0x30')];if(_0x18dda1[_0xc3c8('0x32')][_0xc3c8('0x48')]){_0x457b57[_0xc3c8('0x43')]=[{'all':!![]}];}_0x457b57=_[_0xc3c8('0x3f')]({},_0x457b57,_0x18dda1[_0xc3c8('0x41')]);return db[_0xc3c8('0x42')]['find'](_0x457b57)['then'](handleEntityNotFound(_0x1b264b,null))[_0xc3c8('0x25')](respondWithResult(_0x1b264b,null))[_0xc3c8('0x45')](handleError(_0x1b264b,null));};exports[_0xc3c8('0x49')]=function(_0x14301f,_0xb27734){return db[_0xc3c8('0x42')][_0xc3c8('0x49')](_0x14301f[_0xc3c8('0x4a')],{})['then'](respondWithResult(_0xb27734,0xc9))[_0xc3c8('0x45')](handleError(_0xb27734,null));};exports[_0xc3c8('0x24')]=function(_0x387114,_0x2c0f58){if(_0x387114[_0xc3c8('0x4a')]['id']){delete _0x387114[_0xc3c8('0x4a')]['id'];}return db['OpenchannelApplication'][_0xc3c8('0x4b')]({'where':{'id':_0x387114['params']['id']}})['then'](handleEntityNotFound(_0x2c0f58,null))[_0xc3c8('0x25')](saveUpdates(_0x387114[_0xc3c8('0x4a')],null))[_0xc3c8('0x25')](respondWithResult(_0x2c0f58,null))[_0xc3c8('0x45')](handleError(_0x2c0f58,null));};exports[_0xc3c8('0x26')]=function(_0xb86d81,_0x4ba374){return db[_0xc3c8('0x42')][_0xc3c8('0x4b')]({'where':{'id':_0xb86d81[_0xc3c8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ba374,null))[_0xc3c8('0x25')](removeEntity(_0x4ba374,null))['catch'](handleError(_0x4ba374,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b89b373..25a089c 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 _0x7127=['utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x38cadf,_0x3a79c4){var _0x2fa9e9=function(_0x1d94d4){while(--_0x1d94d4){_0x38cadf['push'](_0x38cadf['shift']());}};_0x2fa9e9(++_0x3a79c4);}(_0x7127,0x1b1));var _0x7712=function(_0x5e6caf,_0x231e2a){_0x5e6caf=_0x5e6caf-0x0;var _0x3a1666=_0x7127[_0x5e6caf];return _0x3a1666;};'use strict';var _=require(_0x7712('0x0'));var util=require('util');var logger=require(_0x7712('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7712('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7712('0x3'));var rimraf=require(_0x7712('0x4'));var config=require(_0x7712('0x5'));var attributes=require(_0x7712('0x6'));module[_0x7712('0x7')]=function(_0x1d1c97,_0x4a4a36){return _0x1d1c97[_0x7712('0x8')](_0x7712('0x9'),attributes,{'tableName':_0x7712('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7712('0xb')});}; \ No newline at end of file +var _0x3422=['define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x1986ee,_0x166c6c){var _0x5a6022=function(_0x40c75b){while(--_0x40c75b){_0x1986ee['push'](_0x1986ee['shift']());}};_0x5a6022(++_0x166c6c);}(_0x3422,0x11c));var _0x2342=function(_0x7ff20,_0x4342ba){_0x7ff20=_0x7ff20-0x0;var _0x1e7d3c=_0x3422[_0x7ff20];return _0x1e7d3c;};'use strict';var _=require(_0x2342('0x0'));var util=require(_0x2342('0x1'));var logger=require(_0x2342('0x2'))(_0x2342('0x3'));var moment=require(_0x2342('0x4'));var BPromise=require(_0x2342('0x5'));var rp=require(_0x2342('0x6'));var fs=require('fs');var path=require(_0x2342('0x7'));var rimraf=require('rimraf');var config=require(_0x2342('0x8'));var attributes=require(_0x2342('0x9'));module['exports']=function(_0x31b7b7,_0x43eb68){return _0x31b7b7[_0x2342('0xa')](_0x2342('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2342('0xc'),'collate':_0x2342('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ca4c6ac..249137a 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 _0x1981=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','moment','bluebird','ioredis','../../config/utils'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x1981,0x1a0));var _0x1198=function(_0x42bef8,_0x1ed865){_0x42bef8=_0x42bef8-0x0;var _0x2c436e=_0x1981[_0x42bef8];return _0x2c436e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1198('0x0'));var BPromise=require(_0x1198('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1198('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1198('0x3'));var logger=require(_0x1198('0x4'))(_0x1198('0x5'));var config=require(_0x1198('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1198('0x7')][_0x1198('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56c858,_0x550911,_0x2a8b2c){return new BPromise(function(_0x57a1fd,_0x241a3b){return client[_0x1198('0x9')](_0x56c858,_0x2a8b2c)[_0x1198('0xa')](function(_0x59bf0a){logger[_0x1198('0xb')](_0x1198('0xc'),_0x550911,'request\x20sent');logger[_0x1198('0xd')](_0x1198('0xe'),_0x550911,_0x1198('0xf'),JSON[_0x1198('0x10')](_0x59bf0a));if(_0x59bf0a[_0x1198('0x11')]){if(_0x59bf0a['error'][_0x1198('0x12')]===0x1f4){logger['error'](_0x1198('0xc'),_0x550911,_0x59bf0a[_0x1198('0x11')][_0x1198('0x13')]);return _0x241a3b(_0x59bf0a['error']['message']);}logger[_0x1198('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x550911,_0x59bf0a['error']['message']);return _0x57a1fd(_0x59bf0a[_0x1198('0x11')]['message']);}else{logger[_0x1198('0xb')](_0x1198('0xc'),_0x550911,_0x1198('0xf'));_0x57a1fd(_0x59bf0a[_0x1198('0x14')][_0x1198('0x13')]);}})[_0x1198('0x15')](function(_0x498256){logger['error'](_0x1198('0xc'),_0x550911,_0x498256);_0x241a3b(_0x498256);});});}exports[_0x1198('0x16')]=function(_0x30ff2b){var _0x43c1a7=this;return new Promise(function(_0x523a26,_0xc129d){return db[_0x1198('0x17')][_0x1198('0x18')](_0x30ff2b[_0x1198('0x19')],{'raw':_0x30ff2b[_0x1198('0x1a')]?_0x30ff2b['options'][_0x1198('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ff2b[_0x1198('0x1a')]?_0x30ff2b[_0x1198('0x1a')][_0x1198('0x1c')]||null:null,'attributes':_0x30ff2b[_0x1198('0x1a')]?_0x30ff2b['options']['attributes']||null:null,'limit':_0x30ff2b['options']?_0x30ff2b[_0x1198('0x1a')][_0x1198('0x1d')]||null:null})[_0x1198('0xa')](function(_0xbee4ab){logger['info']('UpdateOpenchannelApplication',_0x30ff2b);logger[_0x1198('0xd')](_0x1198('0x16'),_0x30ff2b,JSON[_0x1198('0x10')](_0xbee4ab));_0x523a26(_0xbee4ab);})['catch'](function(_0x182639){logger[_0x1198('0x11')](_0x1198('0x16'),_0x182639[_0x1198('0x13')],_0x30ff2b);_0xc129d(_0x43c1a7[_0x1198('0x11')](0x1f4,_0x182639[_0x1198('0x13')]));});});}; \ No newline at end of file +var _0x088f=['options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelApplication','body'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x088f,0xc0));var _0xf088=function(_0x27a51c,_0x4cb759){_0x27a51c=_0x27a51c-0x0;var _0x398c13=_0x088f[_0x27a51c];return _0x398c13;};'use strict';var _=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var moment=require('moment');var BPromise=require(_0xf088('0x2'));var rs=require(_0xf088('0x3'));var fs=require('fs');var Redis=require(_0xf088('0x4'));var db=require(_0xf088('0x5'))['db'];var utils=require(_0xf088('0x6'));var logger=require(_0xf088('0x7'))(_0xf088('0x8'));var config=require(_0xf088('0x9'));var jayson=require(_0xf088('0xa'));var client=jayson['client'][_0xf088('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4269cf,_0x2eaa47,_0x468b62){return new BPromise(function(_0x4da1cd,_0x44ba9b){return client[_0xf088('0xc')](_0x4269cf,_0x468b62)[_0xf088('0xd')](function(_0x3a71ed){logger[_0xf088('0xe')](_0xf088('0xf'),_0x2eaa47,_0xf088('0x10'));logger[_0xf088('0x11')](_0xf088('0x12'),_0x2eaa47,'request\x20sent',JSON[_0xf088('0x13')](_0x3a71ed));if(_0x3a71ed['error']){if(_0x3a71ed[_0xf088('0x14')]['code']===0x1f4){logger[_0xf088('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x2eaa47,_0x3a71ed[_0xf088('0x14')]['message']);return _0x44ba9b(_0x3a71ed['error'][_0xf088('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2eaa47,_0x3a71ed['error'][_0xf088('0x15')]);return _0x4da1cd(_0x3a71ed[_0xf088('0x14')][_0xf088('0x15')]);}else{logger[_0xf088('0xe')](_0xf088('0xf'),_0x2eaa47,'request\x20sent');_0x4da1cd(_0x3a71ed[_0xf088('0x16')][_0xf088('0x15')]);}})['catch'](function(_0x3ff24c){logger[_0xf088('0x14')](_0xf088('0xf'),_0x2eaa47,_0x3ff24c);_0x44ba9b(_0x3ff24c);});});}exports['UpdateOpenchannelApplication']=function(_0x4c4fdf){var _0x981a1a=this;return new Promise(function(_0x5bb3b0,_0x4ce460){return db[_0xf088('0x17')]['update'](_0x4c4fdf[_0xf088('0x18')],{'raw':_0x4c4fdf['options']?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf['options'][_0xf088('0x1b')]||null:null,'attributes':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1c')]||null:null,'limit':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1d')]||null:null})['then'](function(_0x5f5f52){logger[_0xf088('0xe')](_0xf088('0x1e'),_0x4c4fdf);logger[_0xf088('0x11')]('UpdateOpenchannelApplication',_0x4c4fdf,JSON[_0xf088('0x13')](_0x5f5f52));_0x5bb3b0(_0x5f5f52);})['catch'](function(_0x1af110){logger[_0xf088('0x14')]('UpdateOpenchannelApplication',_0x1af110[_0xf088('0x15')],_0x4c4fdf);_0x4ce460(_0x981a1a[_0xf088('0x14')](0x1f4,_0x1af110[_0xf088('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e87fce5..4a0a964 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 _0x5f82=['download','post','create','/:id/messages','/:id/tags','tracked','openchannel','addTags','update','delete','openchannelinteraction:destroy','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages'];(function(_0x4c8071,_0x455666){var _0x2437d1=function(_0x5bb1c5){while(--_0x5bb1c5){_0x4c8071['push'](_0x4c8071['shift']());}};_0x2437d1(++_0x455666);}(_0x5f82,0xb4));var _0x25f8=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x5f82[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0x25f8('0x0'));var util=require(_0x25f8('0x1'));var path=require(_0x25f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x25f8('0x3'));var router=express['Router']();var fs_extra=require(_0x25f8('0x4'));var auth=require(_0x25f8('0x5'));var interaction=require(_0x25f8('0x6'));var config=require(_0x25f8('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x25f8('0x8')]('/',auth[_0x25f8('0x9')](),controller[_0x25f8('0xa')]);router[_0x25f8('0x8')](_0x25f8('0xb'),auth['isAuthenticated'](),controller[_0x25f8('0xc')]);router['get'](_0x25f8('0xd'),auth[_0x25f8('0x9')](),controller[_0x25f8('0xe')]);router[_0x25f8('0x8')]('/:id/messages',auth[_0x25f8('0x9')](),controller[_0x25f8('0xf')]);router[_0x25f8('0x8')]('/:id/download',auth[_0x25f8('0x9')](),controller[_0x25f8('0x10')]);router[_0x25f8('0x11')]('/',auth['isAuthenticated'](),controller[_0x25f8('0x12')]);router[_0x25f8('0x11')](_0x25f8('0x13'),auth[_0x25f8('0x9')](),controller['addMessage']);router[_0x25f8('0x11')](_0x25f8('0x14'),auth[_0x25f8('0x9')](),interaction[_0x25f8('0x15')](_0x25f8('0x16'),'openchannelinteraction:addtags'),controller[_0x25f8('0x17')]);router['put']('/:id',auth[_0x25f8('0x9')](),interaction['tracked'](_0x25f8('0x16'),'openchannelinteraction:update'),controller[_0x25f8('0x18')]);router[_0x25f8('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x25f8('0x15')](_0x25f8('0x16'),_0x25f8('0x1a')),controller[_0x25f8('0x1b')]);router[_0x25f8('0x19')](_0x25f8('0x14'),auth[_0x25f8('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x274d=['download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','removeTags','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x3dd3ef,_0x215b18){var _0x1bae52=function(_0x51d737){while(--_0x51d737){_0x3dd3ef['push'](_0x3dd3ef['shift']());}};_0x1bae52(++_0x215b18);}(_0x274d,0x1a1));var _0xd274=function(_0x5c4f2c,_0x577691){_0x5c4f2c=_0x5c4f2c-0x0;var _0x37d8c3=_0x274d[_0x5c4f2c];return _0x37d8c3;};'use strict';var multer=require(_0xd274('0x0'));var util=require(_0xd274('0x1'));var path=require('path');var timeout=require(_0xd274('0x2'));var express=require('express');var router=express[_0xd274('0x3')]();var fs_extra=require(_0xd274('0x4'));var auth=require(_0xd274('0x5'));var interaction=require(_0xd274('0x6'));var config=require('../../config/environment');var controller=require(_0xd274('0x7'));router[_0xd274('0x8')]('/',auth[_0xd274('0x9')](),controller[_0xd274('0xa')]);router[_0xd274('0x8')](_0xd274('0xb'),auth[_0xd274('0x9')](),controller[_0xd274('0xc')]);router['get'](_0xd274('0xd'),auth['isAuthenticated'](),controller[_0xd274('0xe')]);router[_0xd274('0x8')](_0xd274('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xd274('0x10'),auth[_0xd274('0x9')](),controller[_0xd274('0x11')]);router[_0xd274('0x12')]('/',auth[_0xd274('0x9')](),controller[_0xd274('0x13')]);router[_0xd274('0x12')]('/:id/messages',auth[_0xd274('0x9')](),controller[_0xd274('0x14')]);router['post'](_0xd274('0x15'),auth[_0xd274('0x9')](),interaction[_0xd274('0x16')](_0xd274('0x17'),_0xd274('0x18')),controller[_0xd274('0x19')]);router[_0xd274('0x1a')](_0xd274('0xd'),auth[_0xd274('0x9')](),interaction[_0xd274('0x16')](_0xd274('0x17'),'openchannelinteraction:update'),controller[_0xd274('0x1b')]);router[_0xd274('0x1c')](_0xd274('0xd'),auth['isAuthenticated'](),interaction[_0xd274('0x16')](_0xd274('0x17'),_0xd274('0x1d')),controller['destroy']);router[_0xd274('0x1c')](_0xd274('0x15'),auth[_0xd274('0x9')](),controller[_0xd274('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4309099..e9b38c4 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 _0x280f=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0x280f,0xe2));var _0xf280=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x280f[_0x3c0dcc];return _0x1a224c;};'use strict';var Sequelize=require(_0xf280('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf280('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf280('0x2')]},'disposition':{'type':Sequelize[_0xf280('0x3')]},'secondDisposition':{'type':Sequelize[_0xf280('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf280('0x3')]},'note':{'type':Sequelize[_0xf280('0x3')]},'read1stAt':{'type':Sequelize[_0xf280('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf280('0x3')]},'lastMsgAt':{'type':Sequelize[_0xf280('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf280('0x4')]('in',_0xf280('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xf280('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf280('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xf280('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x1e69=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x57450d,_0x1fae74){var _0x6d1f3d=function(_0x40b7d1){while(--_0x40b7d1){_0x57450d['push'](_0x57450d['shift']());}};_0x6d1f3d(++_0x1fae74);}(_0x1e69,0x85));var _0x91e6=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0x1e69[_0x34e46d];return _0x1cc6aa;};'use strict';var Sequelize=require('sequelize');module[_0x91e6('0x0')]={'closed':{'type':Sequelize[_0x91e6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91e6('0x2')]},'disposition':{'type':Sequelize[_0x91e6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x91e6('0x3')]},'read1stAt':{'type':Sequelize[_0x91e6('0x2')]},'threadId':{'type':Sequelize[_0x91e6('0x3')]},'externalUrl':{'type':Sequelize[_0x91e6('0x3')]},'lastMsgAt':{'type':Sequelize[_0x91e6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x91e6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x91e6('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 eec95c8..9c5ace7 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 _0x7756=['firstName','lastName','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','Tags','TagIds','forEach','push','catch','waiting','unmanaged','total','closed','UserId','talking','index','map','OpenchannelInteraction','type','key','model','query','attributes','fields','length','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','keys','some','compact','isEmpty','OpenchannelAccountId','concat','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?','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','Sequelize','QueryTypes','SELECT','clone','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','toString','a.key','Account.key','a.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','rawAttributes','intersection','includeAll','include','merge','options','create','destroy','describe','addMessage','ids','findOne','OpenchannelMessage','hasOwnProperty','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','openchannelInteractionTags:save','removeTags','download','join','root','tmp','server','files','attachments','User','CmContact','Attachment','direction','secret','OpenchannelAccount','Account','fullname','get','mkdirSync','Owner','N.A.','closedAt','disposition','Public','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','System'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x7756,0x1f4));var _0x6775=function(_0x3e7ddf,_0xa3d57b){_0x3e7ddf=_0x3e7ddf-0x0;var _0x4657cc=_0x7756[_0x3e7ddf];return _0x4657cc;};'use strict';var emlformat=require(_0x6775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6775('0x1'));var jsonpatch=require(_0x6775('0x2'));var rp=require(_0x6775('0x3'));var moment=require('moment');var BPromise=require(_0x6775('0x4'));var Mustache=require(_0x6775('0x5'));var util=require(_0x6775('0x6'));var path=require(_0x6775('0x7'));var sox=require(_0x6775('0x8'));var csv=require(_0x6775('0x9'));var ejs=require(_0x6775('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6775('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6775('0xc'));var deskjs=require(_0x6775('0xd'));var toCsv=require(_0x6775('0x9'));var querystring=require(_0x6775('0xe'));var Papa=require(_0x6775('0xf'));var Redis=require(_0x6775('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6775('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6775('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6775('0x13'));var utils=require(_0x6775('0x14'));var config=require(_0x6775('0x15'));var licenseUtil=require(_0x6775('0x16'));var db=require('../../mysqldb')['db'];config[_0x6775('0x17')]=_[_0x6775('0x18')](config[_0x6775('0x17')],{'host':_0x6775('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6775('0x1a'))['register'](socket);function respondWithStatusCode(_0x3b0fdc,_0x44dae6){_0x44dae6=_0x44dae6||0xcc;return function(_0x5c2dbb){if(_0x5c2dbb){return _0x3b0fdc[_0x6775('0x1b')](_0x44dae6);}return _0x3b0fdc[_0x6775('0x1c')](_0x44dae6)[_0x6775('0x1d')]();};}function respondWithResult(_0x300726,_0xba8921){_0xba8921=_0xba8921||0xc8;return function(_0x39348d){if(_0x39348d){return _0x300726[_0x6775('0x1c')](_0xba8921)[_0x6775('0x1e')](_0x39348d);}};}function respondWithFilteredResult(_0x224346,_0x5ea015){return function(_0x5d392c){if(_0x5d392c){var _0x34fcfd=typeof _0x5ea015[_0x6775('0x1f')]===_0x6775('0x20')&&typeof _0x5ea015[_0x6775('0x21')]===_0x6775('0x20');var _0x25fe71=_0x5d392c[_0x6775('0x22')];var _0x15f420=_0x34fcfd?0x0:_0x5ea015[_0x6775('0x1f')];var _0x5d7655=_0x34fcfd?_0x5d392c[_0x6775('0x22')]:_0x5ea015[_0x6775('0x1f')]+_0x5ea015[_0x6775('0x21')];var _0x1210b3;if(_0x5d7655>=_0x25fe71){_0x5d7655=_0x25fe71;_0x1210b3=0xc8;}else{_0x1210b3=0xce;}_0x224346[_0x6775('0x1c')](_0x1210b3);return _0x224346[_0x6775('0x23')]('Content-Range',_0x15f420+'-'+_0x5d7655+'/'+_0x25fe71)[_0x6775('0x1e')](_0x5d392c);}return null;};}function patchUpdates(_0x1f3e6c){return function(_0x1d2ce2){try{jsonpatch[_0x6775('0x24')](_0x1d2ce2,_0x1f3e6c,!![]);}catch(_0x2f8895){return BPromise[_0x6775('0x25')](_0x2f8895);}return _0x1d2ce2['save']();};}function saveUpdates(_0x150754,_0x57ee81){return function(_0x2e352e){if(_0x2e352e){return _0x2e352e[_0x6775('0x26')](_0x150754)['then'](function(_0x4ff37d){return _0x4ff37d;});}return null;};}function removeEntity(_0x1d19c5,_0x45777b){return function(_0x1a1379){if(_0x1a1379){return _0x1a1379['destroy']()[_0x6775('0x27')](function(){_0x1d19c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b84c1,_0x116fcf){return function(_0x15ac84){if(!_0x15ac84){_0x1b84c1['sendStatus'](0x194);}return _0x15ac84;};}function handleError(_0x105126,_0x1541f5){_0x1541f5=_0x1541f5||0x1f4;return function(_0x4f24a9){logger[_0x6775('0x28')](_0x4f24a9['stack']);if(_0x4f24a9['name']){delete _0x4f24a9[_0x6775('0x29')];}_0x105126[_0x6775('0x1c')](_0x1541f5)['send'](_0x4f24a9);};}function getInteractionUsers(_0x26b53a,_0x38b45a){return new BPromise(function(_0x6ecc2c,_0x27c1b5){try{if(_0x38b45a[_0x26b53a['id']]){_0x26b53a['Users']=_['map'](_0x38b45a[_0x26b53a['id']],function(_0x165305){return{'id':_0x165305['id'],'fullname':_0x165305['fullname']};});}}catch(_0x237bcd){_0x27c1b5(_0x237bcd);}_0x6ecc2c(_0x26b53a);});}function getInteractionTags(_0x2cff67,_0x4a39c9){return new BPromise(function(_0x4acdc3,_0x5dbcea){try{if(_0x2cff67['TagIds']){_0x2cff67[_0x6775('0x2a')]=[];_0x2cff67[_0x6775('0x2b')]['split'](',')[_0x6775('0x2c')](function(_0x96ed04){_0x2cff67[_0x6775('0x2a')][_0x6775('0x2d')](_0x4a39c9[_0x96ed04]);});}delete _0x2cff67[_0x6775('0x2b')];}catch(_0x1a1ea6){_0x5dbcea(_0x1a1ea6);}_0x4acdc3(_0x2cff67);});}function updateOpenchannelInteraction(_0x333f1b,_0x398033,_0x409b7f){return new BPromise(function(_0x46ea89,_0xfc2bd0){return getInteractionUsers(_0x333f1b,_0x409b7f)[_0x6775('0x27')](function(_0x52fa7b){return getInteractionTags(_0x52fa7b,_0x398033);})[_0x6775('0x27')](function(_0x4df412){return getStateInteraction(_0x4df412);})[_0x6775('0x27')](function(_0x31cc14){_0x46ea89(_0x31cc14);})[_0x6775('0x2e')](function(_0x127626){_0xfc2bd0(_0x127626);});});}function getStateInteraction(_0x10f854){return new BPromise(function(_0x31f6b5){_0x10f854[_0x6775('0x2f')]=0x0;_0x10f854['talking']=0x0;_0x10f854['answered']=0x0;_0x10f854[_0x6775('0x30')]=0x0;_0x10f854[_0x6775('0x31')]=0x0;if(!_0x10f854[_0x6775('0x32')]&&!_0x10f854[_0x6775('0x33')]){_0x10f854[_0x6775('0x2f')]+=0x1;}if(!_0x10f854[_0x6775('0x32')]&&_0x10f854['UserId']){_0x10f854[_0x6775('0x34')]+=0x1;if(_0x10f854[_0x6775('0x2f')]){_0x10f854[_0x6775('0x2f')]-=0x1;}}if(_0x10f854[_0x6775('0x32')]&&_0x10f854['UserId']){_0x10f854['answered']+=0x1;if(_0x10f854[_0x6775('0x34')]){_0x10f854[_0x6775('0x34')]-=0x1;}}if(_0x10f854['closed']&&!_0x10f854[_0x6775('0x33')]){_0x10f854[_0x6775('0x30')]+=0x1;if(_0x10f854[_0x6775('0x2f')]){_0x10f854[_0x6775('0x2f')]-=0x1;}}_0x10f854[_0x6775('0x31')]+=0x1;_0x31f6b5(_0x10f854);});}exports[_0x6775('0x35')]=function(_0x348bcc,_0x5ad14b){var _0x535d50={},_0x42ccdf={},_0x33277d={'count':0x0,'rows':[]};var _0x303eb9=_[_0x6775('0x36')](db[_0x6775('0x37')]['rawAttributes'],function(_0x19d58b){return{'name':_0x19d58b['fieldName'],'type':_0x19d58b[_0x6775('0x38')][_0x6775('0x39')]};});_0x42ccdf[_0x6775('0x3a')]=_[_0x6775('0x36')](_0x303eb9,_0x6775('0x29'));_0x42ccdf[_0x6775('0x3b')]=_['keys'](_0x348bcc[_0x6775('0x3b')]);_0x42ccdf['filters']=_['intersection'](_0x42ccdf[_0x6775('0x3a')],_0x42ccdf['query']);_0x535d50[_0x6775('0x3c')]=_['intersection'](_0x42ccdf[_0x6775('0x3a')],qs['fields'](_0x348bcc[_0x6775('0x3b')][_0x6775('0x3d')]));_0x535d50[_0x6775('0x3c')]=_0x535d50[_0x6775('0x3c')][_0x6775('0x3e')]?_0x535d50[_0x6775('0x3c')]:_0x42ccdf[_0x6775('0x3a')];if(!_0x348bcc[_0x6775('0x3b')]['hasOwnProperty']('nolimit')){_0x535d50[_0x6775('0x21')]=qs[_0x6775('0x21')](_0x348bcc[_0x6775('0x3b')][_0x6775('0x21')]);_0x535d50[_0x6775('0x1f')]=qs[_0x6775('0x1f')](_0x348bcc[_0x6775('0x3b')][_0x6775('0x1f')]);}_0x535d50[_0x6775('0x3f')]=qs[_0x6775('0x40')](_0x348bcc[_0x6775('0x3b')][_0x6775('0x40')]);_0x535d50[_0x6775('0x41')]=qs['filters'](_[_0x6775('0x42')](_0x348bcc[_0x6775('0x3b')],_0x42ccdf[_0x6775('0x43')]),_0x303eb9);var _0x390a33=[];var _0x56e155=squel[_0x6775('0x44')]()['field']('id')[_0x6775('0x45')](_0x6775('0x29'))[_0x6775('0x45')](_0x6775('0x46'))[_0x6775('0x47')](_0x6775('0x48'));var _0xcc22aa=squel[_0x6775('0x44')]()[_0x6775('0x45')](_0x6775('0x49'))[_0x6775('0x45')](_0x6775('0x4a'))['field'](_0x6775('0x4b'))['from']('user_has_openchannel_interactions','ui')['left_join'](_0x6775('0x4c'),'u',_0x6775('0x4d'));var _0x49e03c=squel[_0x6775('0x44')]()[_0x6775('0x47')](_0x6775('0x4e'),'i')[_0x6775('0x4f')](_0x6775('0x50'),'c',_0x6775('0x51'))['left_join'](_0x6775('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x6775('0x4f')](_0x6775('0x52'),'a',_0x6775('0x53'))[_0x6775('0x4f')](_0x6775('0x54'),'me',_0x6775('0x55'))[_0x6775('0x4f')]('openchannel_interaction_has_tags','it',_0x6775('0x56'))[_0x6775('0x4f')](_0x6775('0x48'),'t',_0x6775('0x57'));var _0xa8a82b=squel[_0x6775('0x58')]();var _0x204e1e=[];var _0x217de3=squel[_0x6775('0x58')]();var _0x308a73;if(_0x348bcc[_0x6775('0x3b')]['search']){_0x308a73=as['parseSearch'](_0x348bcc['query'][_0x6775('0x59')]);var _0xbd746d=_0x308a73[_0x6775('0x5a')];for(var _0x23e9ed=0x0;_0x23e9ed<_0x308a73[_0x6775('0x5b')][_0x6775('0x3e')];_0x23e9ed++){var _0x239f01=_0x308a73[_0x6775('0x5b')][_0x23e9ed];var _0x5549de='i';var _0x34bffe=_['find'](_0x303eb9,['name',_0x239f01['field']]);if(!_0x34bffe){switch(_0x239f01[_0x6775('0x45')]){case _0x6775('0x5c'):if(_0x239f01[_0x6775('0x5d')]==0x1){_0x49e03c['having']('`'+_0x239f01[_0x6775('0x45')]+_0x6775('0x5e'));}else{_0x49e03c[_0x6775('0x5f')]('`'+_0x239f01[_0x6775('0x45')]+_0x6775('0x60'));}break;case _0x6775('0x61'):if(_0x239f01['operator']==='$substring'){if(_0x239f01[_0x6775('0x5d')]['split']('\x20')[_0x6775('0x3e')]>0x1){_0xa8a82b[_0xbd746d](_0x6775('0x62'),qs[_0x6775('0x63')](_0x239f01[_0x6775('0x5d')]),null);}else{var _0x50b2bd='%'+_0x239f01[_0x6775('0x5d')]+'%';_0xa8a82b[_0xbd746d](_0x6775('0x64'),_0x50b2bd,_0x50b2bd,_0x50b2bd);}}else{_0x34bffe=_[_0x6775('0x65')](_0x303eb9,[_0x6775('0x29'),_0x6775('0x66')]);_0x239f01[_0x6775('0x45')]='ContactId';_0x227876=as['buildExpression'](_0x5549de,_0x34bffe[_0x6775('0x38')],_0x239f01);_0xa8a82b[_0xbd746d](_0x227876[_0x6775('0x67')],_0x227876['value'][_0x6775('0x68')],_0x227876[_0x6775('0x5d')][_0x6775('0x1d')]);}break;case _0x6775('0x69'):var _0x80ff58=_0x239f01['value'][_0x6775('0x6a')](',')['map'](function(_0x54d81b){return Number(_0x54d81b);});_0x80ff58[_0x6775('0x2c')](function(_0x5b20bf){_0x217de3['or'](_0x6775('0x6b'),'%,'+_0x5b20bf+',%');});_0x204e1e=_[_0x6775('0x6c')](_0x204e1e,_0x80ff58);break;case'User':if(_0x239f01['operator']===_0x6775('0x6d')){_0xa8a82b[_0xbd746d](_0x6775('0x6e'),'%'+_0x239f01[_0x6775('0x5d')]+'%',null);}else{_0x34bffe=_[_0x6775('0x65')](_0x303eb9,[_0x6775('0x29'),_0x6775('0x33')]);_0x239f01[_0x6775('0x45')]='UserId';_0x227876=as[_0x6775('0x6f')](_0x5549de,_0x34bffe[_0x6775('0x38')],_0x239f01);_0xa8a82b[_0xbd746d](_0x227876[_0x6775('0x67')],_0x227876[_0x6775('0x5d')][_0x6775('0x68')],_0x227876[_0x6775('0x5d')][_0x6775('0x1d')]);}break;case _0x6775('0x70'):_0x227876=as[_0x6775('0x6f')]('me',null,_0x239f01);_0xa8a82b[_0xbd746d](_0x227876[_0x6775('0x67')],_0x227876[_0x6775('0x5d')][_0x6775('0x68')],_0x227876['value'][_0x6775('0x1d')]);break;}}else{var _0x227876=as['buildExpression'](_0x5549de,_0x34bffe[_0x6775('0x38')],_0x239f01);_0xa8a82b[_0xbd746d](_0x227876[_0x6775('0x67')],_0x227876[_0x6775('0x5d')][_0x6775('0x68')],_0x227876[_0x6775('0x5d')][_0x6775('0x1d')]);}}}else{var _0x33af45=_(_0x348bcc['query'])[_0x6775('0x71')]()[_0x6775('0x36')](function(_0x40b49a){return _[_0x6775('0x72')](_0x303eb9,['name',_0x40b49a])?_0x40b49a:undefined;})[_0x6775('0x73')]()[_0x6775('0x5d')]();if(!_[_0x6775('0x74')](_0x33af45)){_0x33af45[_0x6775('0x2c')](function(_0x16573f){if(_0x16573f===_0x6775('0x75')){_0x49e03c[_0x6775('0x41')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6775('0x76')](_0x348bcc[_0x6775('0x3b')][_0x16573f]));}else if(_0x16573f===_0x6775('0x77')){var _0x2327d4=JSON[_0x6775('0x78')](_0x348bcc[_0x6775('0x3b')][_0x16573f])[_0x6775('0x79')];var _0x357bdd=JSON['parse'](_0x348bcc[_0x6775('0x3b')][_0x16573f])[_0x6775('0x7a')];_0x49e03c[_0x6775('0x41')](_0x6775('0x7b'),_0x2327d4,_0x357bdd);}else{if(_0x348bcc[_0x6775('0x3b')][_0x16573f]===_0x6775('0x7c')){_0x49e03c[_0x6775('0x41')]('i.'+_0x16573f+_0x6775('0x7d'));}else{_0x49e03c['where']('i.'+_0x16573f+_0x6775('0x7e'),_0x348bcc[_0x6775('0x3b')][_0x16573f]);}}});}if(_0x348bcc[_0x6775('0x3b')][_0x6775('0x7f')]){if(_0x348bcc['query'][_0x6775('0x7f')]==0x1){_0x49e03c[_0x6775('0x5f')](_0x6775('0x80'));}else{_0x49e03c[_0x6775('0x5f')](_0x6775('0x81'));}}if(_0x348bcc[_0x6775('0x3b')][_0x6775('0x82')]){_0x204e1e=_[_0x6775('0x83')](_0x348bcc[_0x6775('0x3b')][_0x6775('0x82')])?_0x348bcc[_0x6775('0x3b')][_0x6775('0x82')]:new Array(_0x348bcc['query']['tag']);_0x204e1e['forEach'](function(_0x1c6087){_0x217de3['or'](_0x6775('0x6b'),'%,'+_0x1c6087+',%');});}if(_0x348bcc['query'][_0x6775('0x84')]){var _0x1395f8=_0x348bcc[_0x6775('0x3b')][_0x6775('0x84')][_0x6775('0x85')]('\x5c','\x5c\x5c')[_0x6775('0x85')](/'/g,'\x27\x27');if(qs[_0x6775('0x86')](_0x1395f8)){_0xa8a82b['or'](_0x6775('0x87'),_0x1395f8+'%');}else{_0xa8a82b['or'](_0x6775('0x88'),qs['getFullTextValue'](_0x1395f8))['or'](_0x6775('0x89'),_0x1395f8+'%')['or'](_0x6775('0x8a'),_0x1395f8+'%');}}}_0x49e03c[_0x6775('0x41')](_0xa8a82b);_0x49e03c[_0x6775('0x8b')](_0x6775('0x8c'));var _0x3600c5={'type':db[_0x6775('0x8d')][_0x6775('0x8e')][_0x6775('0x8f')],'raw':!![]};var _0x53fb92=_0x49e03c[_0x6775('0x90')]();_0x53fb92['field'](_0x6775('0x8c'));_0x53fb92[_0x6775('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x535d50[_0x6775('0x3f')]){_0x535d50['order'][_0x6775('0x2c')](function(_0x5d7284){var _0x4d7d73=_0x5d7284[0x0]==='contactName'?_0x5d7284[0x0]:'i.'+_0x5d7284[0x0];_0x49e03c[_0x6775('0x3f')](_0x4d7d73,_0x5d7284[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6775('0x74')](_0x204e1e)){_0x49e03c[_0x6775('0x5f')](_0x217de3);_0x53fb92[_0x6775('0x41')](_0x6775('0x91'),_0x204e1e);}BPromise[_0x6775('0x92')]()['then'](function(){if(!_0x308a73){if(_0x348bcc['query'][_0x6775('0x75')])return;_0x53fb92['where'](_0x6775('0x93'));_0x49e03c[_0x6775('0x41')](_0x6775('0x93'));return;}if(_0x348bcc['user'][_0x6775('0x94')]!==_0x6775('0x95'))return;return _0x348bcc['user'][_0x6775('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c2f93){if(_[_0x6775('0x74')](_0x4c2f93)){_0x53fb92[_0x6775('0x41')](_0x6775('0x97'));_0x49e03c[_0x6775('0x41')](_0x6775('0x97'));}else{_0x53fb92[_0x6775('0x41')](_0x6775('0x98'),_[_0x6775('0x36')](_0x4c2f93,'id'));_0x49e03c['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x6775('0x36')](_0x4c2f93,'id'));}});})[_0x6775('0x27')](function(){if(_0x348bcc[_0x6775('0x99')]['role']===_0x6775('0x95')&&!_0x308a73&&!_0x348bcc[_0x6775('0x3b')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x6775('0x3b')](_0x53fb92[_0x6775('0x9a')](),_0x3600c5);})[_0x6775('0x27')](function(_0x421103){_0x33277d[_0x6775('0x22')]=_0x421103[_0x6775('0x3e')];if(_0x33277d[_0x6775('0x22')]===0x0)return[];return db['sequelize'][_0x6775('0x3b')](_0x56e155[_0x6775('0x9a')](),_0x3600c5)[_0x6775('0x27')](function(_0x5e96ff){_0x390a33=_['keyBy'](_0x5e96ff,'id');_0x3600c5=_['merge'](_0x3600c5,{'model':db[_0x6775('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x348bcc[_0x6775('0x3b')][_0x6775('0x3d')]){_0x535d50[_0x6775('0x3c')][_0x6775('0x2c')](function(_0x3581e3){_0x49e03c[_0x6775('0x45')]('i.'+_0x3581e3);});}else{_0x49e03c[_0x6775('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6775('0x5c'));_0x49e03c[_0x6775('0x45')](_0x6775('0x9b'),_0x6775('0x9c'));_0x49e03c['field'](_0x6775('0x9d'),'Account.mandatoryDisposition');_0x49e03c[_0x6775('0x45')]('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',_0x6775('0x9e'));_0x49e03c[_0x6775('0x45')](_0x6775('0x9f'));_0x49e03c[_0x6775('0x45')](_0x6775('0xa0'),_0x6775('0xa1'));_0x49e03c[_0x6775('0x45')]('c.lastName','Contact.lastName');_0x49e03c['field'](_0x6775('0xa2'),_0x6775('0xa3'));_0x49e03c[_0x6775('0x45')](_0x6775('0xa4'),'Contact.phone');_0x49e03c[_0x6775('0x45')](_0x6775('0xa5'),_0x6775('0xa6'));_0x49e03c[_0x6775('0x45')](_0x6775('0xa7'),_0x6775('0xa8'));_0x49e03c['field']('o.fullname',_0x6775('0xa9'));_0x49e03c[_0x6775('0x45')](_0x6775('0xaa'),_0x6775('0xab'));_0x49e03c[_0x6775('0x45')](_0x6775('0xac'),_0x6775('0x2b'));}if(_0x535d50[_0x6775('0x21')])_0x49e03c[_0x6775('0x21')](_0x535d50['limit']);if(_0x535d50['offset'])_0x49e03c[_0x6775('0x1f')](_0x535d50['offset']);return db[_0x6775('0xad')][_0x6775('0x3b')](_0x49e03c['toString'](),_0x3600c5);})[_0x6775('0x27')](function(_0x3a06e4){if(_0x3a06e4['length']>0x0)_0xcc22aa[_0x6775('0x41')](_0x6775('0xae'),_['map'](_0x3a06e4,'id'));return db[_0x6775('0xad')][_0x6775('0x3b')](_0xcc22aa[_0x6775('0x9a')](),_0x3600c5)[_0x6775('0x27')](function(_0x153718){var _0x4bf949=_[_0x6775('0xaf')](_0x153718,_0x6775('0xb0'));var _0x25d01d=[];_0x3a06e4[_0x6775('0x2c')](function(_0x33a8cd){_0x25d01d['push'](updateOpenchannelInteraction(_0x33a8cd,_0x390a33,_0x4bf949));});return BPromise[_0x6775('0xb1')](_0x25d01d);});});})[_0x6775('0x27')](function(_0x2d8f11){_0x33277d[_0x6775('0xb2')]=_0x2d8f11;return _0x33277d;})['then'](respondWithFilteredResult(_0x5ad14b,_0x535d50))['catch'](handleError(_0x5ad14b,null));};exports[_0x6775('0xb3')]=function(_0x2056e9,_0x26d517){var _0x5d2a0e={};if(_0x2056e9['query'][_0x6775('0x38')]&&_0x2056e9['query'][_0x6775('0x38')]===_0x6775('0x47')){_0x5d2a0e['from']=_0x2056e9['params']['id'];}else{_0x5d2a0e['id']=_0x2056e9[_0x6775('0xb4')]['id'];}var _0x1f35a3={'raw':![],'where':_0x5d2a0e},_0x1c02e2={};_0x1c02e2[_0x6775('0x3a')]=_['keys'](db[_0x6775('0x37')][_0x6775('0xb5')]);_0x1c02e2[_0x6775('0x3b')]=_[_0x6775('0x71')](_0x2056e9['query']);_0x1c02e2[_0x6775('0x43')]=_[_0x6775('0xb6')](_0x1c02e2[_0x6775('0x3a')],_0x1c02e2[_0x6775('0x3b')]);_0x1f35a3[_0x6775('0x3c')]=_[_0x6775('0xb6')](_0x1c02e2[_0x6775('0x3a')],qs[_0x6775('0x3d')](_0x2056e9[_0x6775('0x3b')][_0x6775('0x3d')]));_0x1f35a3[_0x6775('0x3c')]=_0x1f35a3[_0x6775('0x3c')][_0x6775('0x3e')]?_0x1f35a3[_0x6775('0x3c')]:_0x1c02e2['model'];if(_0x2056e9[_0x6775('0x3b')][_0x6775('0xb7')]){_0x1f35a3[_0x6775('0xb8')]=[{'all':!![]}];}_0x1f35a3=_[_0x6775('0xb9')]({},_0x1f35a3,_0x2056e9[_0x6775('0xba')]);return db['OpenchannelInteraction'][_0x6775('0x65')](_0x1f35a3)[_0x6775('0x27')](handleEntityNotFound(_0x26d517,null))[_0x6775('0x27')](respondWithResult(_0x26d517,null))[_0x6775('0x2e')](handleError(_0x26d517,null));};exports[_0x6775('0xbb')]=function(_0x28dd08,_0x4df6de){return db[_0x6775('0x37')]['create'](_0x28dd08[_0x6775('0x70')],{})[_0x6775('0x27')](respondWithResult(_0x4df6de,0xc9))['catch'](handleError(_0x4df6de,null));};exports['update']=function(_0x2286ad,_0x343740){if(_0x2286ad['body']['id']){delete _0x2286ad[_0x6775('0x70')]['id'];}return db[_0x6775('0x37')][_0x6775('0x65')]({'where':{'id':_0x2286ad['params']['id']}})[_0x6775('0x27')](handleEntityNotFound(_0x343740,null))[_0x6775('0x27')](saveUpdates(_0x2286ad[_0x6775('0x70')],null))[_0x6775('0x27')](respondWithResult(_0x343740,null))[_0x6775('0x2e')](handleError(_0x343740,null));};exports[_0x6775('0xbc')]=function(_0x54c5bb,_0x1ad5a9){return db[_0x6775('0x37')][_0x6775('0x65')]({'where':{'id':_0x54c5bb[_0x6775('0xb4')]['id']}})[_0x6775('0x27')](handleEntityNotFound(_0x1ad5a9,null))[_0x6775('0x27')](removeEntity(_0x1ad5a9,null))['catch'](handleError(_0x1ad5a9,null));};exports['describe']=function(_0xe057b5,_0x4ab58d){return db[_0x6775('0x37')][_0x6775('0xbd')]()[_0x6775('0x27')](respondWithResult(_0x4ab58d,null))[_0x6775('0x2e')](handleError(_0x4ab58d,null));};exports[_0x6775('0xbe')]=function(_0x289cf9,_0x67f492,_0x29b838){return db['OpenchannelMessage'][_0x6775('0x65')]({'where':{'id':_0x289cf9[_0x6775('0xb4')]['id']}})[_0x6775('0x27')](handleEntityNotFound(_0x67f492,null))[_0x6775('0x27')](function(_0x3a6a54){if(_0x3a6a54){return _0x3a6a54['addMessage'](_0x289cf9[_0x6775('0x70')][_0x6775('0xbf')],_['omit'](_0x289cf9[_0x6775('0x70')],[_0x6775('0xbf'),'id'])||{});}})[_0x6775('0x27')](respondWithResult(_0x67f492,null))['catch'](handleError(_0x67f492,null));};exports['getMessages']=function(_0x49128c,_0x449e1b,_0x2a00c7){var _0x108afb={'raw':![],'where':{}};var _0xac0720={};var _0x2c6838={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x6775('0xc0')]({'where':{'id':_0x49128c[_0x6775('0xb4')]['id']}})['then'](handleEntityNotFound(_0x449e1b,null))[_0x6775('0x27')](function(_0x304195){if(_0x304195){_0xac0720[_0x6775('0x3a')]=_['keys'](db[_0x6775('0xc1')][_0x6775('0xb5')]);_0xac0720[_0x6775('0x3b')]=_[_0x6775('0x71')](_0x49128c[_0x6775('0x3b')]);_0xac0720[_0x6775('0x43')]=_[_0x6775('0xb6')](_0xac0720['model'],_0xac0720[_0x6775('0x3b')]);_0x108afb['attributes']=_[_0x6775('0xb6')](_0xac0720[_0x6775('0x3a')],qs[_0x6775('0x3d')](_0x49128c[_0x6775('0x3b')]['fields']));_0x108afb['attributes']=_0x108afb[_0x6775('0x3c')][_0x6775('0x3e')]?_0x108afb['attributes']:_0xac0720[_0x6775('0x3a')];if(!_0x49128c['query'][_0x6775('0xc2')](_0x6775('0xc3'))){_0x108afb[_0x6775('0x21')]=qs[_0x6775('0x21')](_0x49128c[_0x6775('0x3b')][_0x6775('0x21')]);_0x108afb['offset']=qs[_0x6775('0x1f')](_0x49128c['query'][_0x6775('0x1f')]);}_0x108afb[_0x6775('0x3f')]=qs['sort'](_0x49128c['query'][_0x6775('0x40')]);_0x108afb[_0x6775('0x41')]=qs[_0x6775('0x43')](_[_0x6775('0x42')](_0x49128c[_0x6775('0x3b')],_0xac0720[_0x6775('0x43')]));_0x108afb[_0x6775('0x41')]['OpenchannelInteractionId']=_0x304195['id'];if(_0x49128c[_0x6775('0x3b')]['filter']){_0x108afb[_0x6775('0x41')]=_[_0x6775('0xb9')](_0x108afb[_0x6775('0x41')],{'$or':_['map'](_0x108afb[_0x6775('0x3c')],function(_0xefba44){var _0x4de84c={};_0x4de84c[_0xefba44]={'$like':'%'+_0x49128c[_0x6775('0x3b')][_0x6775('0x84')]+'%'};return _0x4de84c;})});}if(_0x49128c[_0x6775('0x3b')][_0x6775('0x79')]){var _0x2f0df7=_0x49128c[_0x6775('0x3b')][_0x6775('0x79')][_0x6775('0x6a')](',');var _0x86c341={};_0x86c341[_0x2f0df7[0x0]]={'$gte':moment(_0x2f0df7[0x1])[_0x6775('0xc4')](_0x6775('0xc5'))};_0x108afb[_0x6775('0x41')]=_[_0x6775('0xb9')](_0x108afb[_0x6775('0x41')],_0x86c341);}_0x108afb=_[_0x6775('0xb9')]({},_0x108afb,_0x49128c[_0x6775('0xba')]);return db[_0x6775('0xc1')]['count']({'where':_0x108afb['where']})[_0x6775('0x27')](function(_0x22b8bc){_0x2c6838[_0x6775('0x22')]=_0x22b8bc;if(_0x49128c[_0x6775('0x3b')]['includeAll']){_0x108afb['include']=[{'all':!![]}];}return db[_0x6775('0xc1')][_0x6775('0xc6')](_0x108afb);})[_0x6775('0x27')](function(_0x2198df){_0x2c6838[_0x6775('0xb2')]=_0x2198df;return _0x2c6838;});}})[_0x6775('0x27')](respondWithFilteredResult(_0x449e1b,_0x108afb))[_0x6775('0x2e')](handleError(_0x449e1b,null));};exports[_0x6775('0xc7')]=function(_0x510ff4,_0x1b5fec,_0x43769f){return db[_0x6775('0x37')][_0x6775('0x65')]({'where':{'id':_0x510ff4[_0x6775('0xb4')]['id']}})[_0x6775('0x27')](handleEntityNotFound(_0x1b5fec,null))['then'](function(_0x24a14c){if(_0x24a14c){return _0x24a14c[_0x6775('0xc8')](_0x510ff4[_0x6775('0x70')][_0x6775('0xbf')],_[_0x6775('0xc9')](_0x510ff4[_0x6775('0x70')],[_0x6775('0xbf'),'id'])||{})[_0x6775('0xca')](function(){return db[_0x6775('0x69')][_0x6775('0xc6')]({'attributes':['id',_0x6775('0x29'),'color'],'where':{'id':_0x510ff4['body'][_0x6775('0xbf')]}});})[_0x6775('0x27')](function(_0x562a54){socket['emit'](_0x6775('0xcb'),{'id':Number(_0x510ff4[_0x6775('0xb4')]['id']),'tags':_0x562a54||[]});return{'id':Number(_0x510ff4['params']['id']),'tags':_0x562a54||[]};});}})[_0x6775('0x27')](respondWithResult(_0x1b5fec,null))[_0x6775('0x2e')](handleError(_0x1b5fec,null));};exports['removeTags']=function(_0x175e39,_0x38d672,_0x539d2c){return db[_0x6775('0x37')][_0x6775('0x65')]({'where':{'id':_0x175e39[_0x6775('0xb4')]['id']}})[_0x6775('0x27')](handleEntityNotFound(_0x38d672,null))[_0x6775('0x27')](function(_0x2523a9){if(_0x2523a9){return _0x2523a9[_0x6775('0xcc')](_0x175e39[_0x6775('0x3b')][_0x6775('0xbf')]);}})[_0x6775('0x27')](respondWithStatusCode(_0x38d672,null))[_0x6775('0x2e')](handleError(_0x38d672,null));};exports[_0x6775('0xcd')]=function(_0x19961d,_0x463777){var _0x5ecd12=moment()['unix']()['toString']();var _0x49b418=path[_0x6775('0xce')](config[_0x6775('0xcf')],'server','files',_0x6775('0xd0'));var _0x1ec514=path[_0x6775('0xce')](config[_0x6775('0xcf')],_0x6775('0xd1'),_0x6775('0xd2'),_0x6775('0xd3'));var _0x13b4ab=path[_0x6775('0xce')](_0x49b418,_0x5ecd12);var _0x45810d=util[_0x6775('0xc4')]('transcript-%d-%s.zip',_0x19961d['params']['id'],_0x5ecd12);var _0x92f42f=path[_0x6775('0xce')](_0x49b418,_0x45810d);var _0x261a93=[];_0x261a93['push']({'model':db[_0x6775('0xd4')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x261a93[_0x6775('0x2d')]({'model':db[_0x6775('0xd5')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x19961d[_0x6775('0x3b')][_0x6775('0xd3')]){_0x261a93['push']({'model':db[_0x6775('0xd6')],'as':_0x6775('0xd6'),'raw':!![]});}var _0xd9366d=[{'model':db[_0x6775('0xc1')],'as':'Messages','attributes':['id',_0x6775('0x70'),_0x6775('0x77'),_0x6775('0xd7'),_0x6775('0xd8'),_0x6775('0x7f')],'include':_0x261a93}];_0xd9366d[_0x6775('0x2d')]({'model':db[_0x6775('0xd9')],'as':_0x6775('0xda'),'attributes':['id','name']});_0xd9366d['push']({'model':db[_0x6775('0xd4')],'as':'Owner','attributes':['id',_0x6775('0xdb')]});return db[_0x6775('0x37')][_0x6775('0x65')]({'where':{'id':_0x19961d[_0x6775('0xb4')]['id']},'include':_0xd9366d})[_0x6775('0x27')](handleEntityNotFound(_0x463777,null))[_0x6775('0x27')](function(_0x346b6c){if(_0x346b6c){var _0x34c02f=_0x346b6c[_0x6775('0xdc')]({'plain':!![]});fs[_0x6775('0xdd')](_0x13b4ab);var _0x5d64f8={'channel':'Openchannel','account':_0x34c02f[_0x6775('0xda')][_0x6775('0x29')],'agent':_0x34c02f[_0x6775('0xde')]?_0x34c02f['Owner']['fullname']:_0x6775('0xdf'),'createdAt':moment(_0x34c02f[_0x6775('0x77')])[_0x6775('0xc4')](_0x6775('0xc5'))['toString'](),'closedAt':_0x34c02f[_0x6775('0x32')]?moment(_0x34c02f[_0x6775('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6775('0x9a')]():'','disposition':_0x34c02f[_0x6775('0xe1')],'visibility':_0x34c02f['threadId']?_0x6775('0xe2'):_0x6775('0xe3'),'messages':_(_0x34c02f[_0x6775('0xe4')])[_0x6775('0x84')]({'secret':![]})['map'](function(_0x23d071){if(_0x23d071[_0x6775('0xd6')]){var _0x41b157=path['join'](_0x1ec514,_0x23d071[_0x6775('0xd6')][_0x6775('0xe5')]);if(fs['existsSync'](_0x41b157)){fs[_0x6775('0xe6')](_0x41b157)[_0x6775('0xe7')](fs[_0x6775('0xe8')](path[_0x6775('0xce')](_0x13b4ab,_0x23d071['Attachment'][_0x6775('0xe5')])));}}return{'date':moment(_0x23d071['createdAt'])[_0x6775('0xc4')](_0x6775('0xc5'))[_0x6775('0x9a')](),'sender':_0x23d071[_0x6775('0xd7')]===_0x6775('0xe9')?_0x23d071['User']?_0x23d071[_0x6775('0xd4')]['fullname']:_0x6775('0xea'):_0x23d071[_0x6775('0x61')][_0x6775('0xeb')]+(_0x23d071[_0x6775('0x61')][_0x6775('0xec')]?'\x20'+_0x23d071[_0x6775('0x61')][_0x6775('0xec')]:''),'body':_0x23d071[_0x6775('0xd6')]?_0x23d071['Attachment'][_0x6775('0xe5')]:_0x23d071[_0x6775('0x70')],'direction':_0x23d071[_0x6775('0xd7')]===_0x6775('0xe9')?'A':'C','secret':_0x23d071[_0x6775('0xd8')],'read':_0x23d071['read'],'attachment':_0x23d071[_0x6775('0xd6')]};})[_0x6775('0x5d')]()};return ejs['renderFile'](path[_0x6775('0xce')](config['root'],'server',_0x6775('0xed'),_0x6775('0xee')),{'interaction':_0x5d64f8})[_0x6775('0x27')](function(_0x2cc2cc){var _0x397edc=path[_0x6775('0xce')](_0x13b4ab,_0x6775('0xef')+_0x34c02f['id']+'-'+_0x5ecd12+_0x6775('0xf0'));var _0x527bab={'path':_0x397edc,'channel':_0x6775('0xf1'),'interactionId':_0x34c02f['id']};return pdf[_0x6775('0xf2')](_0x2cc2cc,_0x527bab);})['then'](function(){return new BPromise(function(_0x3ea5e1,_0x4c3f2a){zipdir(_0x13b4ab,{'saveTo':_0x92f42f},function(_0x50db82,_0x4c4c7f){if(_0x50db82)return _0x4c3f2a(_0x50db82);return _0x3ea5e1(_0x4c4c7f);});})[_0x6775('0x27')](function(){return new BPromise(function(_0x1e4c6c,_0x10aca4){rimraf(_0x13b4ab,function(_0x120d89){if(_0x120d89)_0x10aca4(_0x120d89);return _0x1e4c6c();});});})['then'](function(){return _0x463777[_0x6775('0xcd')](_0x92f42f,_0x45810d,function(_0x5692a1){if(_0x5692a1){console[_0x6775('0xf3')](_0x6775('0xf4'),_0x5692a1);}else{fs['unlinkSync'](_0x92f42f);}});});});}else{return _0x463777['sendStatus'](0xc8);}})[_0x6775('0x2e')](handleError(_0x463777,null));}; \ No newline at end of file +var _0xf276=['openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','OpenchannelAccountId','where','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','unreadMessages','a.key','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','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','OpenchannelInteraction','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','N.A.','threadId','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','transcript-','.pdf','Openchannel','log','err','unlinkSync','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','Users','map','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','field','color','from','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId'];(function(_0x17ce87,_0x1974d0){var _0x2c094e=function(_0x3e679c){while(--_0x3e679c){_0x17ce87['push'](_0x17ce87['shift']());}};_0x2c094e(++_0x1974d0);}(_0xf276,0x9c));var _0x6f27=function(_0x2c2eba,_0x3434d8){_0x2c2eba=_0x2c2eba-0x0;var _0x257ca8=_0xf276[_0x2c2eba];return _0x257ca8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6f27('0x0'));var rp=require(_0x6f27('0x1'));var moment=require(_0x6f27('0x2'));var BPromise=require(_0x6f27('0x3'));var Mustache=require(_0x6f27('0x4'));var util=require(_0x6f27('0x5'));var path=require('path');var sox=require(_0x6f27('0x6'));var csv=require('to-csv');var ejs=require(_0x6f27('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f27('0x8'));var squel=require('squel');var crypto=require(_0x6f27('0x9'));var jsforce=require(_0x6f27('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6f27('0xb'));var querystring=require(_0x6f27('0xc'));var Papa=require(_0x6f27('0xd'));var Redis=require('ioredis');var authService=require(_0x6f27('0xe'));var qs=require(_0x6f27('0xf'));var as=require(_0x6f27('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6f27('0x11'));var logger=require(_0x6f27('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6f27('0x13'));var licenseUtil=require(_0x6f27('0x14'));var db=require(_0x6f27('0x15'))['db'];config[_0x6f27('0x16')]=_['defaults'](config[_0x6f27('0x16')],{'host':_0x6f27('0x17'),'port':0x18eb});var socket=require(_0x6f27('0x18'))(new Redis(config[_0x6f27('0x16')]));require(_0x6f27('0x19'))[_0x6f27('0x1a')](socket);function respondWithStatusCode(_0x1f7911,_0x343350){_0x343350=_0x343350||0xcc;return function(_0x458551){if(_0x458551){return _0x1f7911[_0x6f27('0x1b')](_0x343350);}return _0x1f7911[_0x6f27('0x1c')](_0x343350)[_0x6f27('0x1d')]();};}function respondWithResult(_0x5b988f,_0x40d8b5){_0x40d8b5=_0x40d8b5||0xc8;return function(_0x10d54c){if(_0x10d54c){return _0x5b988f[_0x6f27('0x1c')](_0x40d8b5)['json'](_0x10d54c);}};}function respondWithFilteredResult(_0x58b2cf,_0x4ec72a){return function(_0x368b0a){if(_0x368b0a){var _0x201ffd=typeof _0x4ec72a[_0x6f27('0x1e')]===_0x6f27('0x1f')&&typeof _0x4ec72a[_0x6f27('0x20')]==='undefined';var _0x1428a5=_0x368b0a[_0x6f27('0x21')];var _0x436dfd=_0x201ffd?0x0:_0x4ec72a['offset'];var _0x57d449=_0x201ffd?_0x368b0a[_0x6f27('0x21')]:_0x4ec72a[_0x6f27('0x1e')]+_0x4ec72a[_0x6f27('0x20')];var _0x268e93;if(_0x57d449>=_0x1428a5){_0x57d449=_0x1428a5;_0x268e93=0xc8;}else{_0x268e93=0xce;}_0x58b2cf[_0x6f27('0x1c')](_0x268e93);return _0x58b2cf[_0x6f27('0x22')]('Content-Range',_0x436dfd+'-'+_0x57d449+'/'+_0x1428a5)['json'](_0x368b0a);}return null;};}function patchUpdates(_0x24ec5a){return function(_0x3b355e){try{jsonpatch[_0x6f27('0x23')](_0x3b355e,_0x24ec5a,!![]);}catch(_0x3ee86b){return BPromise[_0x6f27('0x24')](_0x3ee86b);}return _0x3b355e[_0x6f27('0x25')]();};}function saveUpdates(_0x20e011,_0x1110d0){return function(_0x243404){if(_0x243404){return _0x243404[_0x6f27('0x26')](_0x20e011)[_0x6f27('0x27')](function(_0x96a5fc){return _0x96a5fc;});}return null;};}function removeEntity(_0x24851b,_0x32f088){return function(_0x50df23){if(_0x50df23){return _0x50df23[_0x6f27('0x28')]()[_0x6f27('0x27')](function(){_0x24851b[_0x6f27('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9b95,_0x24750a){return function(_0xc8d25){if(!_0xc8d25){_0x3e9b95[_0x6f27('0x1b')](0x194);}return _0xc8d25;};}function handleError(_0x4468f1,_0x4761d5){_0x4761d5=_0x4761d5||0x1f4;return function(_0x5f2c84){logger['error'](_0x5f2c84[_0x6f27('0x29')]);if(_0x5f2c84[_0x6f27('0x2a')]){delete _0x5f2c84[_0x6f27('0x2a')];}_0x4468f1['status'](_0x4761d5)[_0x6f27('0x2b')](_0x5f2c84);};}function getInteractionUsers(_0x51e5a1,_0x2eee82){return new BPromise(function(_0x4e8bab,_0x5bc958){try{if(_0x2eee82[_0x51e5a1['id']]){_0x51e5a1[_0x6f27('0x2c')]=_[_0x6f27('0x2d')](_0x2eee82[_0x51e5a1['id']],function(_0x21376b){return{'id':_0x21376b['id'],'fullname':_0x21376b['fullname']};});}}catch(_0x5db769){_0x5bc958(_0x5db769);}_0x4e8bab(_0x51e5a1);});}function getInteractionTags(_0x290d5c,_0xf2100){return new BPromise(function(_0xc213a9,_0x50fe5c){try{if(_0x290d5c['TagIds']){_0x290d5c[_0x6f27('0x2e')]=[];_0x290d5c['TagIds'][_0x6f27('0x2f')](',')[_0x6f27('0x30')](function(_0x275a75){_0x290d5c[_0x6f27('0x2e')][_0x6f27('0x31')](_0xf2100[_0x275a75]);});}delete _0x290d5c['TagIds'];}catch(_0x2268c3){_0x50fe5c(_0x2268c3);}_0xc213a9(_0x290d5c);});}function updateOpenchannelInteraction(_0x4a6258,_0x2ded2,_0xfefe07){return new BPromise(function(_0x36c991,_0x15f4e0){return getInteractionUsers(_0x4a6258,_0xfefe07)[_0x6f27('0x27')](function(_0x10897c){return getInteractionTags(_0x10897c,_0x2ded2);})[_0x6f27('0x27')](function(_0x3dfc0f){return getStateInteraction(_0x3dfc0f);})[_0x6f27('0x27')](function(_0x558148){_0x36c991(_0x558148);})[_0x6f27('0x32')](function(_0x391177){_0x15f4e0(_0x391177);});});}function getStateInteraction(_0x1a9054){return new BPromise(function(_0x55360f){_0x1a9054[_0x6f27('0x33')]=0x0;_0x1a9054[_0x6f27('0x34')]=0x0;_0x1a9054[_0x6f27('0x35')]=0x0;_0x1a9054[_0x6f27('0x36')]=0x0;_0x1a9054[_0x6f27('0x37')]=0x0;if(!_0x1a9054[_0x6f27('0x38')]&&!_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x33')]+=0x1;}if(!_0x1a9054[_0x6f27('0x38')]&&_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x34')]+=0x1;if(_0x1a9054[_0x6f27('0x33')]){_0x1a9054[_0x6f27('0x33')]-=0x1;}}if(_0x1a9054[_0x6f27('0x38')]&&_0x1a9054['UserId']){_0x1a9054[_0x6f27('0x35')]+=0x1;if(_0x1a9054[_0x6f27('0x34')]){_0x1a9054[_0x6f27('0x34')]-=0x1;}}if(_0x1a9054['closed']&&!_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x36')]+=0x1;if(_0x1a9054[_0x6f27('0x33')]){_0x1a9054[_0x6f27('0x33')]-=0x1;}}_0x1a9054[_0x6f27('0x37')]+=0x1;_0x55360f(_0x1a9054);});}exports['index']=function(_0x2eb9ef,_0x382d92){var _0x34cdc9={},_0x1ba4eb={},_0x461de6={'count':0x0,'rows':[]};var _0x2aa765=_[_0x6f27('0x2d')](db['OpenchannelInteraction'][_0x6f27('0x3a')],function(_0x219eb4){return{'name':_0x219eb4[_0x6f27('0x3b')],'type':_0x219eb4[_0x6f27('0x3c')][_0x6f27('0x3d')]};});_0x1ba4eb[_0x6f27('0x3e')]=_['map'](_0x2aa765,_0x6f27('0x2a'));_0x1ba4eb[_0x6f27('0x3f')]=_[_0x6f27('0x40')](_0x2eb9ef[_0x6f27('0x3f')]);_0x1ba4eb[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x1ba4eb['model'],_0x1ba4eb[_0x6f27('0x3f')]);_0x34cdc9[_0x6f27('0x43')]=_['intersection'](_0x1ba4eb[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x2eb9ef['query']['fields']));_0x34cdc9[_0x6f27('0x43')]=_0x34cdc9['attributes'][_0x6f27('0x45')]?_0x34cdc9[_0x6f27('0x43')]:_0x1ba4eb['model'];if(!_0x2eb9ef[_0x6f27('0x3f')]['hasOwnProperty'](_0x6f27('0x46'))){_0x34cdc9[_0x6f27('0x20')]=qs[_0x6f27('0x20')](_0x2eb9ef[_0x6f27('0x3f')]['limit']);_0x34cdc9[_0x6f27('0x1e')]=qs[_0x6f27('0x1e')](_0x2eb9ef[_0x6f27('0x3f')]['offset']);}_0x34cdc9[_0x6f27('0x47')]=qs[_0x6f27('0x48')](_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x48')]);_0x34cdc9['where']=qs[_0x6f27('0x41')](_['pick'](_0x2eb9ef[_0x6f27('0x3f')],_0x1ba4eb[_0x6f27('0x41')]),_0x2aa765);var _0x2924f2=[];var _0x4749ab=squel['select']()['field']('id')[_0x6f27('0x49')](_0x6f27('0x2a'))[_0x6f27('0x49')](_0x6f27('0x4a'))[_0x6f27('0x4b')]('tools_tags');var _0x166681=squel[_0x6f27('0x4c')]()[_0x6f27('0x49')](_0x6f27('0x4d'))[_0x6f27('0x49')](_0x6f27('0x4e'))[_0x6f27('0x49')]('ui.OpenchannelInteractionId')['from'](_0x6f27('0x4f'),'ui')[_0x6f27('0x50')](_0x6f27('0x51'),'u',_0x6f27('0x52'));var _0x41c1dd=squel['select']()[_0x6f27('0x4b')](_0x6f27('0x53'),'i')[_0x6f27('0x50')](_0x6f27('0x54'),'c',_0x6f27('0x55'))[_0x6f27('0x50')](_0x6f27('0x51'),'o',_0x6f27('0x56'))[_0x6f27('0x50')]('openchannel_accounts','a',_0x6f27('0x57'))[_0x6f27('0x50')](_0x6f27('0x58'),'me',_0x6f27('0x59'))[_0x6f27('0x50')](_0x6f27('0x5a'),'it',_0x6f27('0x5b'))[_0x6f27('0x50')](_0x6f27('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x21180b=squel[_0x6f27('0x5d')]();var _0x51ec37=[];var _0x41eeea=squel[_0x6f27('0x5d')]();var _0x588114;if(_0x2eb9ef['query'][_0x6f27('0x5e')]){_0x588114=as[_0x6f27('0x5f')](_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x5e')]);var _0x42c359=_0x588114[_0x6f27('0x60')];for(var _0x3328e0=0x0;_0x3328e0<_0x588114[_0x6f27('0x61')][_0x6f27('0x45')];_0x3328e0++){var _0x1b63f8=_0x588114[_0x6f27('0x61')][_0x3328e0];var _0x25a6ae='i';var _0x39736e=_[_0x6f27('0x62')](_0x2aa765,[_0x6f27('0x2a'),_0x1b63f8[_0x6f27('0x49')]]);if(!_0x39736e){switch(_0x1b63f8['field']){case'unreadMessages':if(_0x1b63f8[_0x6f27('0x63')]==0x1){_0x41c1dd[_0x6f27('0x64')]('`'+_0x1b63f8['field']+_0x6f27('0x65'));}else{_0x41c1dd['having']('`'+_0x1b63f8[_0x6f27('0x49')]+_0x6f27('0x66'));}break;case _0x6f27('0x67'):if(_0x1b63f8[_0x6f27('0x68')]===_0x6f27('0x69')){if(_0x1b63f8['value'][_0x6f27('0x2f')]('\x20')[_0x6f27('0x45')]>0x1){_0x21180b[_0x42c359](_0x6f27('0x6a'),qs['getFullTextValue'](_0x1b63f8[_0x6f27('0x63')]),null);}else{var _0x35d4d8='%'+_0x1b63f8['value']+'%';_0x21180b[_0x42c359](_0x6f27('0x6b'),_0x35d4d8,_0x35d4d8,_0x35d4d8);}}else{_0x39736e=_[_0x6f27('0x62')](_0x2aa765,['name','ContactId']);_0x1b63f8[_0x6f27('0x49')]=_0x6f27('0x6c');_0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e['type'],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5[_0x6f27('0x6e')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5['value'][_0x6f27('0x1d')]);}break;case _0x6f27('0x70'):var _0x5a811d=_0x1b63f8[_0x6f27('0x63')]['split'](',')[_0x6f27('0x2d')](function(_0x6d893a){return Number(_0x6d893a);});_0x5a811d[_0x6f27('0x30')](function(_0x267a01){_0x41eeea['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x267a01+',%');});_0x51ec37=_['union'](_0x51ec37,_0x5a811d);break;case'User':if(_0x1b63f8['operator']===_0x6f27('0x69')){_0x21180b[_0x42c359](_0x6f27('0x71'),'%'+_0x1b63f8['value']+'%',null);}else{_0x39736e=_[_0x6f27('0x62')](_0x2aa765,[_0x6f27('0x2a'),'UserId']);_0x1b63f8[_0x6f27('0x49')]='UserId';_0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e[_0x6f27('0x3c')],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5[_0x6f27('0x6e')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')]['end']);}break;case _0x6f27('0x72'):_0x41a1a5=as['buildExpression']('me',null,_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5['text'],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x1d')]);break;}}else{var _0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e['type'],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5['text'],_0x41a1a5['value'][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x1d')]);}}}else{var _0x21afaf=_(_0x2eb9ef['query'])['keys']()[_0x6f27('0x2d')](function(_0xb2e83d){return _[_0x6f27('0x73')](_0x2aa765,[_0x6f27('0x2a'),_0xb2e83d])?_0xb2e83d:undefined;})['compact']()[_0x6f27('0x63')]();if(!_[_0x6f27('0x74')](_0x21afaf)){_0x21afaf[_0x6f27('0x30')](function(_0x2c828a){if(_0x2c828a===_0x6f27('0x75')){_0x41c1dd[_0x6f27('0x76')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6f27('0x77')](_0x2eb9ef['query'][_0x2c828a]));}else if(_0x2c828a===_0x6f27('0x78')){var _0x244daa=JSON['parse'](_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a])[_0x6f27('0x79')];var _0x1bdfb0=JSON[_0x6f27('0x7a')](_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a])[_0x6f27('0x7b')];_0x41c1dd[_0x6f27('0x76')](_0x6f27('0x7c'),_0x244daa,_0x1bdfb0);}else{if(_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a]===_0x6f27('0x7d')){_0x41c1dd['where']('i.'+_0x2c828a+_0x6f27('0x7e'));}else{_0x41c1dd['where']('i.'+_0x2c828a+_0x6f27('0x7f'),_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a]);}}});}if(_0x2eb9ef[_0x6f27('0x3f')]['read']){if(_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x80')]==0x1){_0x41c1dd[_0x6f27('0x64')](_0x6f27('0x81'));}else{_0x41c1dd[_0x6f27('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x2eb9ef['query'][_0x6f27('0x82')]){_0x51ec37=_[_0x6f27('0x83')](_0x2eb9ef[_0x6f27('0x3f')]['tag'])?_0x2eb9ef[_0x6f27('0x3f')]['tag']:new Array(_0x2eb9ef['query'][_0x6f27('0x82')]);_0x51ec37[_0x6f27('0x30')](function(_0x180e4e){_0x41eeea['or'](_0x6f27('0x84'),'%,'+_0x180e4e+',%');});}if(_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x85')]){var _0x44527b=_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x85')][_0x6f27('0x86')]('\x5c','\x5c\x5c')[_0x6f27('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44527b)){_0x21180b['or'](_0x6f27('0x87'),_0x44527b+'%');}else{_0x21180b['or'](_0x6f27('0x88'),qs['getFullTextValue'](_0x44527b))['or'](_0x6f27('0x89'),_0x44527b+'%')['or'](_0x6f27('0x8a'),_0x44527b+'%');}}}_0x41c1dd['where'](_0x21180b);_0x41c1dd[_0x6f27('0x8b')](_0x6f27('0x8c'));var _0x5dc9cb={'type':db[_0x6f27('0x8d')][_0x6f27('0x8e')]['SELECT'],'raw':!![]};var _0x31b684=_0x41c1dd[_0x6f27('0x8f')]();_0x31b684[_0x6f27('0x49')]('i.id');_0x31b684[_0x6f27('0x49')](_0x6f27('0x90'),'unreadMessages');if(_0x34cdc9[_0x6f27('0x47')]){_0x34cdc9[_0x6f27('0x47')][_0x6f27('0x30')](function(_0x3eb928){var _0xa410b4=_0x3eb928[0x0]===_0x6f27('0x91')?_0x3eb928[0x0]:'i.'+_0x3eb928[0x0];_0x41c1dd[_0x6f27('0x47')](_0xa410b4,_0x3eb928[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6f27('0x74')](_0x51ec37)){_0x41c1dd[_0x6f27('0x64')](_0x41eeea);_0x31b684[_0x6f27('0x76')](_0x6f27('0x92'),_0x51ec37);}BPromise[_0x6f27('0x93')]()['then'](function(){if(!_0x588114){if(_0x2eb9ef['query'][_0x6f27('0x75')])return;_0x31b684[_0x6f27('0x76')](_0x6f27('0x94'));_0x41c1dd[_0x6f27('0x76')](_0x6f27('0x94'));return;}if(_0x2eb9ef['user'][_0x6f27('0x95')]!==_0x6f27('0x96'))return;return _0x2eb9ef['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x6f27('0x27')](function(_0x36a98f){if(_['isEmpty'](_0x36a98f)){_0x31b684[_0x6f27('0x76')](_0x6f27('0x97'));_0x41c1dd[_0x6f27('0x76')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x31b684['where'](_0x6f27('0x98'),_[_0x6f27('0x2d')](_0x36a98f,'id'));_0x41c1dd['where'](_0x6f27('0x98'),_[_0x6f27('0x2d')](_0x36a98f,'id'));}});})[_0x6f27('0x27')](function(){if(_0x2eb9ef['user']['role']===_0x6f27('0x96')&&!_0x588114&&!_0x2eb9ef['query'][_0x6f27('0x75')])return[];return db['sequelize'][_0x6f27('0x3f')](_0x31b684[_0x6f27('0x99')](),_0x5dc9cb);})['then'](function(_0xefa3ef){_0x461de6['count']=_0xefa3ef[_0x6f27('0x45')];if(_0x461de6['count']===0x0)return[];return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x4749ab[_0x6f27('0x99')](),_0x5dc9cb)[_0x6f27('0x27')](function(_0x4488c8){_0x2924f2=_[_0x6f27('0x9b')](_0x4488c8,'id');_0x5dc9cb=_[_0x6f27('0x9c')](_0x5dc9cb,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eb9ef[_0x6f27('0x3f')]['fields']){_0x34cdc9[_0x6f27('0x43')]['forEach'](function(_0x1777d2){_0x41c1dd[_0x6f27('0x49')]('i.'+_0x1777d2);});}else{_0x41c1dd['field'](_0x6f27('0x90'),_0x6f27('0x9d'));_0x41c1dd['field'](_0x6f27('0x9e'),_0x6f27('0x9f'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa0'),_0x6f27('0xa1'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa2'),'contactName');_0x41c1dd['field'](_0x6f27('0xa3'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa4'),_0x6f27('0xa5'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa6'),_0x6f27('0xa7'));_0x41c1dd[_0x6f27('0x49')]('c.email',_0x6f27('0xa8'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa9'),_0x6f27('0xaa'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xab'),_0x6f27('0xac'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xad'),_0x6f27('0xae'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xaf'),_0x6f27('0xb0'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xb1'),_0x6f27('0xb2'));_0x41c1dd['field'](_0x6f27('0xb3'),_0x6f27('0xb4'));}if(_0x34cdc9[_0x6f27('0x20')])_0x41c1dd['limit'](_0x34cdc9[_0x6f27('0x20')]);if(_0x34cdc9[_0x6f27('0x1e')])_0x41c1dd['offset'](_0x34cdc9['offset']);return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x41c1dd[_0x6f27('0x99')](),_0x5dc9cb);})[_0x6f27('0x27')](function(_0x3f45e2){if(_0x3f45e2[_0x6f27('0x45')]>0x0)_0x166681['where'](_0x6f27('0xb5'),_[_0x6f27('0x2d')](_0x3f45e2,'id'));return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x166681[_0x6f27('0x99')](),_0x5dc9cb)['then'](function(_0x565c30){var _0x4e8b84=_[_0x6f27('0xb6')](_0x565c30,_0x6f27('0xb7'));var _0x1e02be=[];_0x3f45e2[_0x6f27('0x30')](function(_0x26c8f6){_0x1e02be[_0x6f27('0x31')](updateOpenchannelInteraction(_0x26c8f6,_0x2924f2,_0x4e8b84));});return BPromise[_0x6f27('0xb8')](_0x1e02be);});});})['then'](function(_0x5eff89){_0x461de6[_0x6f27('0xb9')]=_0x5eff89;return _0x461de6;})[_0x6f27('0x27')](respondWithFilteredResult(_0x382d92,_0x34cdc9))[_0x6f27('0x32')](handleError(_0x382d92,null));};exports[_0x6f27('0xba')]=function(_0x275441,_0xf1d608){var _0x30b2ca={};if(_0x275441[_0x6f27('0x3f')][_0x6f27('0x3c')]&&_0x275441[_0x6f27('0x3f')][_0x6f27('0x3c')]==='from'){_0x30b2ca[_0x6f27('0x4b')]=_0x275441[_0x6f27('0xbb')]['id'];}else{_0x30b2ca['id']=_0x275441[_0x6f27('0xbb')]['id'];}var _0x5bff92={'raw':![],'where':_0x30b2ca},_0x4b10c0={};_0x4b10c0[_0x6f27('0x3e')]=_[_0x6f27('0x40')](db[_0x6f27('0xbc')][_0x6f27('0x3a')]);_0x4b10c0['query']=_[_0x6f27('0x40')](_0x275441[_0x6f27('0x3f')]);_0x4b10c0[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x4b10c0[_0x6f27('0x3e')],_0x4b10c0['query']);_0x5bff92['attributes']=_[_0x6f27('0x42')](_0x4b10c0[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x275441[_0x6f27('0x3f')][_0x6f27('0x44')]));_0x5bff92['attributes']=_0x5bff92['attributes'][_0x6f27('0x45')]?_0x5bff92[_0x6f27('0x43')]:_0x4b10c0[_0x6f27('0x3e')];if(_0x275441[_0x6f27('0x3f')][_0x6f27('0xbd')]){_0x5bff92[_0x6f27('0xbe')]=[{'all':!![]}];}_0x5bff92=_[_0x6f27('0x9c')]({},_0x5bff92,_0x275441['options']);return db[_0x6f27('0xbc')][_0x6f27('0x62')](_0x5bff92)[_0x6f27('0x27')](handleEntityNotFound(_0xf1d608,null))[_0x6f27('0x27')](respondWithResult(_0xf1d608,null))[_0x6f27('0x32')](handleError(_0xf1d608,null));};exports[_0x6f27('0xbf')]=function(_0x2cd90c,_0x4e649a){return db[_0x6f27('0xbc')][_0x6f27('0xbf')](_0x2cd90c[_0x6f27('0x72')],{})[_0x6f27('0x27')](respondWithResult(_0x4e649a,0xc9))[_0x6f27('0x32')](handleError(_0x4e649a,null));};exports[_0x6f27('0x26')]=function(_0x532b18,_0x4ad0c1){if(_0x532b18['body']['id']){delete _0x532b18[_0x6f27('0x72')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x532b18['params']['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x4ad0c1,null))[_0x6f27('0x27')](saveUpdates(_0x532b18[_0x6f27('0x72')],null))['then'](respondWithResult(_0x4ad0c1,null))[_0x6f27('0x32')](handleError(_0x4ad0c1,null));};exports['destroy']=function(_0x377879,_0x411bab){return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x377879[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x411bab,null))['then'](removeEntity(_0x411bab,null))[_0x6f27('0x32')](handleError(_0x411bab,null));};exports[_0x6f27('0xc0')]=function(_0x3e8ad6,_0x42b79f){return db[_0x6f27('0xbc')][_0x6f27('0xc0')]()[_0x6f27('0x27')](respondWithResult(_0x42b79f,null))['catch'](handleError(_0x42b79f,null));};exports[_0x6f27('0xc1')]=function(_0x2dd1d7,_0xfe23e0,_0x240d8d){return db[_0x6f27('0xc2')][_0x6f27('0x62')]({'where':{'id':_0x2dd1d7[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0xfe23e0,null))[_0x6f27('0x27')](function(_0x2cdce6){if(_0x2cdce6){return _0x2cdce6['addMessage'](_0x2dd1d7[_0x6f27('0x72')][_0x6f27('0xc3')],_[_0x6f27('0xc4')](_0x2dd1d7[_0x6f27('0x72')],[_0x6f27('0xc3'),'id'])||{});}})['then'](respondWithResult(_0xfe23e0,null))['catch'](handleError(_0xfe23e0,null));};exports['getMessages']=function(_0x34f88b,_0x21c15c,_0x5e3017){var _0x436788={'raw':![],'where':{}};var _0x5769bf={};var _0x1cff55={'count':0x0,'rows':[]};return db[_0x6f27('0xbc')][_0x6f27('0xc5')]({'where':{'id':_0x34f88b[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x21c15c,null))[_0x6f27('0x27')](function(_0x2e83a9){if(_0x2e83a9){_0x5769bf[_0x6f27('0x3e')]=_['keys'](db[_0x6f27('0xc2')][_0x6f27('0x3a')]);_0x5769bf[_0x6f27('0x3f')]=_['keys'](_0x34f88b['query']);_0x5769bf[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x5769bf[_0x6f27('0x3e')],_0x5769bf['query']);_0x436788['attributes']=_[_0x6f27('0x42')](_0x5769bf[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x44')]));_0x436788[_0x6f27('0x43')]=_0x436788[_0x6f27('0x43')][_0x6f27('0x45')]?_0x436788[_0x6f27('0x43')]:_0x5769bf[_0x6f27('0x3e')];if(!_0x34f88b['query'][_0x6f27('0xc6')](_0x6f27('0x46'))){_0x436788[_0x6f27('0x20')]=qs[_0x6f27('0x20')](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x20')]);_0x436788[_0x6f27('0x1e')]=qs[_0x6f27('0x1e')](_0x34f88b[_0x6f27('0x3f')]['offset']);}_0x436788[_0x6f27('0x47')]=qs['sort'](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x48')]);_0x436788[_0x6f27('0x76')]=qs[_0x6f27('0x41')](_[_0x6f27('0xc7')](_0x34f88b[_0x6f27('0x3f')],_0x5769bf[_0x6f27('0x41')]));_0x436788['where'][_0x6f27('0xb7')]=_0x2e83a9['id'];if(_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x85')]){_0x436788[_0x6f27('0x76')]=_['merge'](_0x436788[_0x6f27('0x76')],{'$or':_['map'](_0x436788[_0x6f27('0x43')],function(_0x1869b1){var _0x15c51a={};_0x15c51a[_0x1869b1]={'$like':'%'+_0x34f88b[_0x6f27('0x3f')]['filter']+'%'};return _0x15c51a;})});}if(_0x34f88b['query'][_0x6f27('0x79')]){var _0x3394e5=_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x79')][_0x6f27('0x2f')](',');var _0x2b168a={};_0x2b168a[_0x3394e5[0x0]]={'$gte':moment(_0x3394e5[0x1])[_0x6f27('0xc8')](_0x6f27('0xc9'))};_0x436788[_0x6f27('0x76')]=_[_0x6f27('0x9c')](_0x436788[_0x6f27('0x76')],_0x2b168a);}_0x436788=_[_0x6f27('0x9c')]({},_0x436788,_0x34f88b[_0x6f27('0xca')]);return db['OpenchannelMessage'][_0x6f27('0x21')]({'where':_0x436788[_0x6f27('0x76')]})['then'](function(_0x53956b){_0x1cff55['count']=_0x53956b;if(_0x34f88b[_0x6f27('0x3f')][_0x6f27('0xbd')]){_0x436788[_0x6f27('0xbe')]=[{'all':!![]}];}return db[_0x6f27('0xc2')][_0x6f27('0xcb')](_0x436788);})[_0x6f27('0x27')](function(_0x2335eb){_0x1cff55[_0x6f27('0xb9')]=_0x2335eb;return _0x1cff55;});}})[_0x6f27('0x27')](respondWithFilteredResult(_0x21c15c,_0x436788))[_0x6f27('0x32')](handleError(_0x21c15c,null));};exports[_0x6f27('0xcc')]=function(_0x170fcf,_0x39931f,_0x3044eb){return db['OpenchannelInteraction'][_0x6f27('0x62')]({'where':{'id':_0x170fcf['params']['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x39931f,null))[_0x6f27('0x27')](function(_0x3f8bbd){if(_0x3f8bbd){return _0x3f8bbd['setTags'](_0x170fcf[_0x6f27('0x72')][_0x6f27('0xc3')],_[_0x6f27('0xc4')](_0x170fcf['body'],[_0x6f27('0xc3'),'id'])||{})[_0x6f27('0xcd')](function(){return db[_0x6f27('0x70')]['findAll']({'attributes':['id',_0x6f27('0x2a'),_0x6f27('0x4a')],'where':{'id':_0x170fcf[_0x6f27('0x72')][_0x6f27('0xc3')]}});})['then'](function(_0x2c6f13){socket[_0x6f27('0xce')](_0x6f27('0xcf'),{'id':Number(_0x170fcf[_0x6f27('0xbb')]['id']),'tags':_0x2c6f13||[]});return{'id':Number(_0x170fcf[_0x6f27('0xbb')]['id']),'tags':_0x2c6f13||[]};});}})[_0x6f27('0x27')](respondWithResult(_0x39931f,null))['catch'](handleError(_0x39931f,null));};exports['removeTags']=function(_0x4353bb,_0x4852d0,_0x53419e){return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x4353bb[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x4852d0,null))[_0x6f27('0x27')](function(_0x157200){if(_0x157200){return _0x157200[_0x6f27('0xd0')](_0x4353bb[_0x6f27('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x4852d0,null))[_0x6f27('0x32')](handleError(_0x4852d0,null));};exports[_0x6f27('0xd1')]=function(_0x323afa,_0x3f195c){var _0x1b97fe=moment()[_0x6f27('0xd2')]()[_0x6f27('0x99')]();var _0xd7bebe=path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),_0x6f27('0xd5'),'tmp');var _0x157e27=path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),_0x6f27('0xd5'),_0x6f27('0xd6'));var _0x1f1313=path[_0x6f27('0xd3')](_0xd7bebe,_0x1b97fe);var _0x2b1b8f=util[_0x6f27('0xc8')](_0x6f27('0xd7'),_0x323afa[_0x6f27('0xbb')]['id'],_0x1b97fe);var _0xa07d86=path[_0x6f27('0xd3')](_0xd7bebe,_0x2b1b8f);var _0x450bd6=[];_0x450bd6['push']({'model':db[_0x6f27('0xd8')],'as':_0x6f27('0xd8'),'attributes':['id','fullname'],'raw':!![]});_0x450bd6['push']({'model':db[_0x6f27('0xd9')],'as':'Contact','attributes':['id','firstName',_0x6f27('0xda')],'raw':!![]});if(_0x323afa[_0x6f27('0x3f')][_0x6f27('0xd6')]){_0x450bd6[_0x6f27('0x31')]({'model':db[_0x6f27('0xdb')],'as':_0x6f27('0xdb'),'raw':!![]});}var _0x2627c9=[{'model':db[_0x6f27('0xc2')],'as':_0x6f27('0xdc'),'attributes':['id',_0x6f27('0x72'),'createdAt','direction',_0x6f27('0xdd'),_0x6f27('0x80')],'include':_0x450bd6}];_0x2627c9[_0x6f27('0x31')]({'model':db[_0x6f27('0xde')],'as':_0x6f27('0xdf'),'attributes':['id',_0x6f27('0x2a')]});_0x2627c9['push']({'model':db[_0x6f27('0xd8')],'as':_0x6f27('0xe0'),'attributes':['id',_0x6f27('0xe1')]});return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x323afa[_0x6f27('0xbb')]['id']},'include':_0x2627c9})[_0x6f27('0x27')](handleEntityNotFound(_0x3f195c,null))[_0x6f27('0x27')](function(_0x46e06f){if(_0x46e06f){var _0x50ecbf=_0x46e06f[_0x6f27('0xe2')]({'plain':!![]});fs[_0x6f27('0xe3')](_0x1f1313);var _0x55e48a={'channel':'Openchannel','account':_0x50ecbf[_0x6f27('0xdf')][_0x6f27('0x2a')],'agent':_0x50ecbf[_0x6f27('0xe0')]?_0x50ecbf[_0x6f27('0xe0')][_0x6f27('0xe1')]:_0x6f27('0xe4'),'createdAt':moment(_0x50ecbf[_0x6f27('0x78')])[_0x6f27('0xc8')](_0x6f27('0xc9'))[_0x6f27('0x99')](),'closedAt':_0x50ecbf[_0x6f27('0x38')]?moment(_0x50ecbf['closedAt'])[_0x6f27('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f27('0x99')]():'','disposition':_0x50ecbf['disposition'],'visibility':_0x50ecbf[_0x6f27('0xe5')]?'Public':'Private','messages':_(_0x50ecbf['Messages'])[_0x6f27('0x85')]({'secret':![]})[_0x6f27('0x2d')](function(_0x1a509a){if(_0x1a509a['Attachment']){var _0x5b82ba=path['join'](_0x157e27,_0x1a509a[_0x6f27('0xdb')][_0x6f27('0xe6')]);if(fs['existsSync'](_0x5b82ba)){fs[_0x6f27('0xe7')](_0x5b82ba)[_0x6f27('0xe8')](fs[_0x6f27('0xe9')](path[_0x6f27('0xd3')](_0x1f1313,_0x1a509a[_0x6f27('0xdb')][_0x6f27('0xe6')])));}}return{'date':moment(_0x1a509a['createdAt'])[_0x6f27('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f27('0x99')](),'sender':_0x1a509a[_0x6f27('0xea')]===_0x6f27('0xeb')?_0x1a509a[_0x6f27('0xd8')]?_0x1a509a['User']['fullname']:_0x6f27('0xec'):_0x1a509a[_0x6f27('0x67')][_0x6f27('0xed')]+(_0x1a509a[_0x6f27('0x67')][_0x6f27('0xda')]?'\x20'+_0x1a509a['Contact'][_0x6f27('0xda')]:''),'body':_0x1a509a['Attachment']?_0x1a509a[_0x6f27('0xdb')]['basename']:_0x1a509a['body'],'direction':_0x1a509a[_0x6f27('0xea')]===_0x6f27('0xeb')?'A':'C','secret':_0x1a509a['secret'],'read':_0x1a509a[_0x6f27('0x80')],'attachment':_0x1a509a[_0x6f27('0xdb')]};})[_0x6f27('0x63')]()};return ejs['renderFile'](path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),'views','downloadInteraction.ejs'),{'interaction':_0x55e48a})['then'](function(_0x47697e){var _0x6b9097=path[_0x6f27('0xd3')](_0x1f1313,_0x6f27('0xee')+_0x50ecbf['id']+'-'+_0x1b97fe+_0x6f27('0xef'));var _0x855878={'path':_0x6b9097,'channel':_0x6f27('0xf0'),'interactionId':_0x50ecbf['id']};return pdf['createPdfFromHTML'](_0x47697e,_0x855878);})[_0x6f27('0x27')](function(){return new BPromise(function(_0x34aa26,_0x5c1812){zipdir(_0x1f1313,{'saveTo':_0xa07d86},function(_0x5cbba9,_0x30615f){if(_0x5cbba9)return _0x5c1812(_0x5cbba9);return _0x34aa26(_0x30615f);});})[_0x6f27('0x27')](function(){return new BPromise(function(_0x2791ef,_0x3e0e86){rimraf(_0x1f1313,function(_0x43b3b0){if(_0x43b3b0)_0x3e0e86(_0x43b3b0);return _0x2791ef();});});})['then'](function(){return _0x3f195c[_0x6f27('0xd1')](_0xa07d86,_0x2b1b8f,function(_0x42a0e5){if(_0x42a0e5){console[_0x6f27('0xf1')](_0x6f27('0xf2'),_0x42a0e5);}else{fs[_0x6f27('0xf3')](_0xa07d86);}});});});}else{return _0x3f195c[_0x6f27('0x1b')](0xc8);}})[_0x6f27('0x32')](handleError(_0x3f195c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 752ff91..3c59077 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 _0x6f17=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x51ddc7,_0x2e4a46){var _0x4df04e=function(_0x2a7b31){while(--_0x2a7b31){_0x51ddc7['push'](_0x51ddc7['shift']());}};_0x4df04e(++_0x2e4a46);}(_0x6f17,0x1b0));var _0x76f1=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x6f17[_0x2070da];return _0x4f9fe1;};'use strict';var EventEmitter=require(_0x76f1('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x76f1('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x76f1('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x76f1('0x3')](0x0);var events={'afterCreate':_0x76f1('0x4'),'afterUpdate':_0x76f1('0x5'),'afterDestroy':_0x76f1('0x6')};function emitEvent(_0x470036){return function(_0x21499a,_0x882756,_0x9c85fc){_0x21499a[_0x76f1('0x7')]({'attributes':['id'],'raw':!![]})[_0x76f1('0x8')](function(_0x1997e0){_0x21499a[_0x76f1('0x9')](_0x76f1('0xa'),_0x1997e0[_0x76f1('0xb')](function(_0x186df3){return{'id':_0x186df3['id']};}));return OpenchannelMessage[_0x76f1('0xc')]({'where':{'OpenchannelInteractionId':_0x21499a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x76f1('0x8')](function(_0x4cb50a){_0x21499a['setDataValue'](_0x76f1('0xd'),_0x4cb50a[_0x76f1('0xe')]);OpenchannelInteractionEvents[_0x76f1('0xf')](_0x470036+':'+_0x21499a['id'],_0x21499a);OpenchannelInteractionEvents[_0x76f1('0xf')](_0x470036,_0x21499a);_0x9c85fc(null);})[_0x76f1('0x10')](_0x9c85fc(null));};}for(var e in events){if(events[_0x76f1('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x76f1('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6d5f=['map','emit','catch','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','then','setDataValue','Users'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0x6d5f,0xad));var _0xf6d5=function(_0x2f3c85,_0x5498e8){_0x2f3c85=_0x2f3c85-0x0;var _0x4d2ce3=_0x6d5f[_0x2f3c85];return _0x4d2ce3;};'use strict';var EventEmitter=require(_0xf6d5('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xf6d5('0x1')];var OpenchannelMessage=require(_0xf6d5('0x2'))['db'][_0xf6d5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6d5('0x4'),'afterUpdate':_0xf6d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x393f52){return function(_0x11d989,_0x44ae60,_0x28e7ce){_0x11d989['getUsers']({'attributes':['id'],'raw':!![]})[_0xf6d5('0x6')](function(_0x1b7810){_0x11d989[_0xf6d5('0x7')](_0xf6d5('0x8'),_0x1b7810[_0xf6d5('0x9')](function(_0x1e34a7){return{'id':_0x1e34a7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x11d989['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcfeddf){_0x11d989['setDataValue']('unreadMessages',_0xcfeddf['length']);OpenchannelInteractionEvents[_0xf6d5('0xa')](_0x393f52+':'+_0x11d989['id'],_0x11d989);OpenchannelInteractionEvents[_0xf6d5('0xa')](_0x393f52,_0x11d989);_0x28e7ce(null);})[_0xf6d5('0xb')](_0x28e7ce(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf6d5('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 2de2181..a1fd1a1 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 _0xe202=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe202,0x194));var _0x2e20=function(_0x17622c,_0x5fefa6){_0x17622c=_0x17622c-0x0;var _0xe60cfd=_0xe202[_0x17622c];return _0xe60cfd;};'use strict';var _=require(_0x2e20('0x0'));var util=require(_0x2e20('0x1'));var logger=require(_0x2e20('0x2'))(_0x2e20('0x3'));var moment=require(_0x2e20('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e20('0x5'));var rimraf=require(_0x2e20('0x6'));var config=require('../../config/environment');var attributes=require(_0x2e20('0x7'));module[_0x2e20('0x8')]=function(_0xacf618,_0x2c56af){return _0xacf618[_0x2e20('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x2e20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2e20('0xb'),'hooks':{'beforeUpdate':function(_0x1b571b,_0x172e51,_0x281a19){if(_0x1b571b[_0x2e20('0xc')]('closed')){_0x1b571b[_0x2e20('0xd')]=moment()[_0x2e20('0xe')](_0x2e20('0xf'));}_0x281a19(null,_0x1b571b);}}});}; \ No newline at end of file +var _0x3128=['moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','format','lodash','util'];(function(_0x8f088a,_0x1a74b5){var _0x115ecb=function(_0xad0519){while(--_0xad0519){_0x8f088a['push'](_0x8f088a['shift']());}};_0x115ecb(++_0x1a74b5);}(_0x3128,0xd0));var _0x8312=function(_0x2c0830,_0x1df98b){_0x2c0830=_0x2c0830-0x0;var _0x3df376=_0x3128[_0x2c0830];return _0x3df376;};'use strict';var _=require(_0x8312('0x0'));var util=require(_0x8312('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8312('0x2'));var BPromise=require(_0x8312('0x3'));var rp=require(_0x8312('0x4'));var fs=require('fs');var path=require(_0x8312('0x5'));var rimraf=require(_0x8312('0x6'));var config=require('../../config/environment');var attributes=require(_0x8312('0x7'));module[_0x8312('0x8')]=function(_0x4d547d,_0x54a636){return _0x4d547d[_0x8312('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x8312('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8312('0xb'),'hooks':{'beforeUpdate':function(_0x477b64,_0xc609ae,_0x1be5c7){if(_0x477b64[_0x8312('0xc')](_0x8312('0xd'))){_0x477b64['closedAt']=moment()[_0x8312('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1be5c7(null,_0x477b64);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 02c0f27..735ac4a 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 _0x0b20=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x0b20,0x134));var _0x00b2=function(_0x587ae4,_0x56c9f7){_0x587ae4=_0x587ae4-0x0;var _0x1cc8ee=_0x0b20[_0x587ae4];return _0x1cc8ee;};'use strict';var _=require(_0x00b2('0x0'));var util=require(_0x00b2('0x1'));var moment=require(_0x00b2('0x2'));var BPromise=require(_0x00b2('0x3'));var rs=require(_0x00b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00b2('0x5'))['db'];var utils=require(_0x00b2('0x6'));var logger=require(_0x00b2('0x7'))('rpc');var config=require(_0x00b2('0x8'));var jayson=require(_0x00b2('0x9'));var client=jayson[_0x00b2('0xa')][_0x00b2('0xb')]({'port':0x232a});config[_0x00b2('0xc')]=_[_0x00b2('0xd')](config['redis'],{'host':_0x00b2('0xe'),'port':0x18eb});var socket=require(_0x00b2('0xf'))(new Redis(config[_0x00b2('0xc')]));require(_0x00b2('0x10'))[_0x00b2('0x11')](socket);function respondWithRpcPromise(_0x393191,_0x31c791,_0x3261b0){return new BPromise(function(_0x43ba5b,_0x9c689){return client[_0x00b2('0x12')](_0x393191,_0x3261b0)[_0x00b2('0x13')](function(_0xd7f385){logger[_0x00b2('0x14')](_0x00b2('0x15'),_0x31c791,_0x00b2('0x16'));logger[_0x00b2('0x17')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x31c791,_0x00b2('0x16'),JSON[_0x00b2('0x18')](_0xd7f385));if(_0xd7f385['error']){if(_0xd7f385[_0x00b2('0x19')][_0x00b2('0x1a')]===0x1f4){logger[_0x00b2('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x31c791,_0xd7f385[_0x00b2('0x19')]['message']);return _0x9c689(_0xd7f385[_0x00b2('0x19')][_0x00b2('0x1b')]);}logger['error'](_0x00b2('0x15'),_0x31c791,_0xd7f385[_0x00b2('0x19')][_0x00b2('0x1b')]);return _0x43ba5b(_0xd7f385['error'][_0x00b2('0x1b')]);}else{logger[_0x00b2('0x14')](_0x00b2('0x15'),_0x31c791,_0x00b2('0x16'));_0x43ba5b(_0xd7f385[_0x00b2('0x1c')][_0x00b2('0x1b')]);}})[_0x00b2('0x1d')](function(_0xe925c4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x31c791,_0xe925c4);_0x9c689(_0xe925c4);});});}exports[_0x00b2('0x1e')]=function(_0x35195b){var _0x39359d=this;return new Promise(function(_0x3a7480,_0x251423){return db[_0x00b2('0x1f')][_0x00b2('0x20')](_0x35195b['body'],{'raw':_0x35195b[_0x00b2('0x21')]?_0x35195b[_0x00b2('0x21')][_0x00b2('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35195b[_0x00b2('0x21')]?_0x35195b[_0x00b2('0x21')][_0x00b2('0x23')]||null:null,'attributes':_0x35195b[_0x00b2('0x21')]?_0x35195b[_0x00b2('0x21')][_0x00b2('0x24')]||null:null,'limit':_0x35195b[_0x00b2('0x21')]?_0x35195b[_0x00b2('0x21')][_0x00b2('0x25')]||null:null})[_0x00b2('0x13')](function(_0x68713){logger[_0x00b2('0x14')](_0x00b2('0x1e'),_0x35195b);logger['debug'](_0x00b2('0x1e'),_0x35195b,JSON['stringify'](_0x68713));_0x3a7480(_0x68713);})[_0x00b2('0x1d')](function(_0x4ce07e){logger[_0x00b2('0x19')](_0x00b2('0x1e'),_0x4ce07e[_0x00b2('0x1b')],_0x35195b);_0x251423(_0x39359d['error'](0x1f4,_0x4ce07e[_0x00b2('0x1b')]));});});};exports[_0x00b2('0x26')]=function(_0x5c0bea){return new Promise(function(_0x431f9f,_0x556939){return db['OpenchannelInteraction'][_0x00b2('0x27')]({'where':_0x5c0bea[_0x00b2('0x21')]?_0x5c0bea[_0x00b2('0x21')][_0x00b2('0x23')]||null:null})[_0x00b2('0x13')](function(_0xadbd7d){if(_0xadbd7d){return _0xadbd7d[_0x00b2('0x28')](_0x5c0bea[_0x00b2('0x29')][_0x00b2('0x2a')],_['omit'](_0x5c0bea['body'],[_0x00b2('0x2a'),'id'])||{});}})[_0x00b2('0x2b')](function(_0x219f91){logger[_0x00b2('0x14')](_0x00b2('0x2c'),_0x5c0bea);logger['debug'](_0x00b2('0x2c'),_0x5c0bea,JSON[_0x00b2('0x18')](_0x219f91));_0x431f9f(_0x219f91);})[_0x00b2('0x1d')](function(_0x3e1ae5){logger[_0x00b2('0x19')](_0x00b2('0x2c'),_0x3e1ae5[_0x00b2('0x1b')],_0x5c0bea);_0x556939(_this[_0x00b2('0x19')](0x1f4,_0x3e1ae5[_0x00b2('0x1b')]));});});}; \ No newline at end of file +var _0xb268=['ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags'];(function(_0x59360e,_0x2d96fc){var _0x2163e6=function(_0x268c55){while(--_0x268c55){_0x59360e['push'](_0x59360e['shift']());}};_0x2163e6(++_0x2d96fc);}(_0xb268,0x16b));var _0x8b26=function(_0x40b24e,_0x38e559){_0x40b24e=_0x40b24e-0x0;var _0x458673=_0xb268[_0x40b24e];return _0x458673;};'use strict';var _=require(_0x8b26('0x0'));var util=require(_0x8b26('0x1'));var moment=require(_0x8b26('0x2'));var BPromise=require(_0x8b26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b26('0x4'));var db=require(_0x8b26('0x5'))['db'];var utils=require(_0x8b26('0x6'));var logger=require(_0x8b26('0x7'))(_0x8b26('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b26('0x9')][_0x8b26('0xa')]({'port':0x232a});config[_0x8b26('0xb')]=_['defaults'](config[_0x8b26('0xb')],{'host':_0x8b26('0xc'),'port':0x18eb});var socket=require(_0x8b26('0xd'))(new Redis(config['redis']));require(_0x8b26('0xe'))['register'](socket);function respondWithRpcPromise(_0x16fff7,_0x57639f,_0x17dcac){return new BPromise(function(_0x1f640a,_0x393d72){return client[_0x8b26('0xf')](_0x16fff7,_0x17dcac)[_0x8b26('0x10')](function(_0x21664f){logger[_0x8b26('0x11')](_0x8b26('0x12'),_0x57639f,_0x8b26('0x13'));logger[_0x8b26('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x57639f,_0x8b26('0x13'),JSON[_0x8b26('0x15')](_0x21664f));if(_0x21664f['error']){if(_0x21664f[_0x8b26('0x16')][_0x8b26('0x17')]===0x1f4){logger[_0x8b26('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x57639f,_0x21664f[_0x8b26('0x16')][_0x8b26('0x18')]);return _0x393d72(_0x21664f[_0x8b26('0x16')][_0x8b26('0x18')]);}logger[_0x8b26('0x16')](_0x8b26('0x12'),_0x57639f,_0x21664f[_0x8b26('0x16')]['message']);return _0x1f640a(_0x21664f['error']['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x57639f,_0x8b26('0x13'));_0x1f640a(_0x21664f[_0x8b26('0x19')][_0x8b26('0x18')]);}})[_0x8b26('0x1a')](function(_0x589ea8){logger[_0x8b26('0x16')](_0x8b26('0x12'),_0x57639f,_0x589ea8);_0x393d72(_0x589ea8);});});}exports[_0x8b26('0x1b')]=function(_0x5df1e1){var _0xdc3b22=this;return new Promise(function(_0xe6c2da,_0x484e1d){return db[_0x8b26('0x1c')]['update'](_0x5df1e1[_0x8b26('0x1d')],{'raw':_0x5df1e1['options']?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df1e1['options']?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x20')]||null:null,'attributes':_0x5df1e1[_0x8b26('0x1e')]?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x21')]||null:null,'limit':_0x5df1e1[_0x8b26('0x1e')]?_0x5df1e1[_0x8b26('0x1e')]['limit']||null:null})[_0x8b26('0x10')](function(_0x4515af){logger[_0x8b26('0x11')](_0x8b26('0x1b'),_0x5df1e1);logger['debug'](_0x8b26('0x1b'),_0x5df1e1,JSON['stringify'](_0x4515af));_0xe6c2da(_0x4515af);})[_0x8b26('0x1a')](function(_0x389a1c){logger['error'](_0x8b26('0x1b'),_0x389a1c['message'],_0x5df1e1);_0x484e1d(_0xdc3b22[_0x8b26('0x16')](0x1f4,_0x389a1c[_0x8b26('0x18')]));});});};exports[_0x8b26('0x22')]=function(_0x3bf23b){return new Promise(function(_0x314cbf,_0x1f3662){return db[_0x8b26('0x1c')][_0x8b26('0x23')]({'where':_0x3bf23b[_0x8b26('0x1e')]?_0x3bf23b[_0x8b26('0x1e')][_0x8b26('0x20')]||null:null})['then'](function(_0x5d2728){if(_0x5d2728){return _0x5d2728[_0x8b26('0x24')](_0x3bf23b[_0x8b26('0x1d')]['ids'],_['omit'](_0x3bf23b[_0x8b26('0x1d')],[_0x8b26('0x25'),'id'])||{});}})[_0x8b26('0x26')](function(_0x1b983b){logger['info']('AddTags',_0x3bf23b);logger[_0x8b26('0x14')](_0x8b26('0x27'),_0x3bf23b,JSON[_0x8b26('0x15')](_0x1b983b));_0x314cbf(_0x1b983b);})['catch'](function(_0x505fed){logger[_0x8b26('0x16')](_0x8b26('0x27'),_0x505fed[_0x8b26('0x18')],_0x3bf23b);_0x1f3662(_this[_0x8b26('0x16')](0x1f4,_0x505fed[_0x8b26('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7ffa253..a386154 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 _0xc087=['remove','update','emit','removeListener','register','./openchannelInteraction.events','save'];(function(_0x3802d4,_0x448650){var _0x34b26e=function(_0x2aeee7){while(--_0x2aeee7){_0x3802d4['push'](_0x3802d4['shift']());}};_0x34b26e(++_0x448650);}(_0xc087,0xbb));var _0x7c08=function(_0x81e6e2,_0x3565ca){_0x81e6e2=_0x81e6e2-0x0;var _0x56bb71=_0xc087[_0x81e6e2];return _0x56bb71;};'use strict';var OpenchannelInteractionEvents=require(_0x7c08('0x0'));var events=[_0x7c08('0x1'),_0x7c08('0x2'),_0x7c08('0x3')];function createListener(_0x1d913b,_0x221df7){return function(_0x159582){_0x221df7[_0x7c08('0x4')](_0x1d913b,_0x159582);};}function removeListener(_0x959df1,_0x2793e0){return function(){OpenchannelInteractionEvents[_0x7c08('0x5')](_0x959df1,_0x2793e0);};}exports[_0x7c08('0x6')]=function(_0xe7dbef){for(var _0x5b1c86=0x0,_0x10876a=events['length'];_0x5b1c86<_0x10876a;_0x5b1c86++){var _0x2702d4=events[_0x5b1c86];var _0x52baee=createListener('openchannelInteraction:'+_0x2702d4,_0xe7dbef);OpenchannelInteractionEvents['on'](_0x2702d4,_0x52baee);}}; \ No newline at end of file +var _0x573a=['register','./openchannelInteraction.events','save','remove','update'];(function(_0x542a26,_0x4ad587){var _0x19b9fd=function(_0x4ed263){while(--_0x4ed263){_0x542a26['push'](_0x542a26['shift']());}};_0x19b9fd(++_0x4ad587);}(_0x573a,0x114));var _0xa573=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x573a[_0x155c64];return _0x1f154a;};'use strict';var OpenchannelInteractionEvents=require(_0xa573('0x0'));var events=[_0xa573('0x1'),_0xa573('0x2'),_0xa573('0x3')];function createListener(_0x2b0c73,_0x4b0553){return function(_0x8bfc7){_0x4b0553['emit'](_0x2b0c73,_0x8bfc7);};}function removeListener(_0x33bba8,_0x46b0c1){return function(){OpenchannelInteractionEvents['removeListener'](_0x33bba8,_0x46b0c1);};}exports[_0xa573('0x4')]=function(_0x35e579){for(var _0x37344a=0x0,_0x44946d=events['length'];_0x37344a<_0x44946d;_0x37344a++){var _0x262750=events[_0x37344a];var _0xa22b7b=createListener('openchannelInteraction:'+_0x262750,_0x35e579);OpenchannelInteractionEvents['on'](_0x262750,_0xa22b7b);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bcbaaa3..870456d 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x4ab866,_0x40e607){var _0x56047a=function(_0x112c87){while(--_0x112c87){_0x4ab866['push'](_0x4ab866['shift']());}};_0x56047a(++_0x40e607);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x568ccb,_0x449b5a){var _0x3bb5a7=function(_0x257e9c){while(--_0x257e9c){_0x568ccb['push'](_0x568ccb['shift']());}};_0x3bb5a7(++_0x449b5a);}(_0xe706,0xa3));var _0x6e70=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0xe706[_0x42ca15];return _0x1c6ded;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c87e0af..3d375a9 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 _0x6b24=['exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x6b24,0x1ce));var _0x46b2=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0x6b24[_0x52fa77];return _0x477535;};'use strict';var Sequelize=require('sequelize');module[_0x46b2('0x0')]={'body':{'type':Sequelize[_0x46b2('0x1')](_0x46b2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x46b2('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x46b2('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x46b2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x236c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT','medium'];(function(_0x4bc6b0,_0x26a100){var _0x54a4b8=function(_0x5391c7){while(--_0x5391c7){_0x4bc6b0['push'](_0x4bc6b0['shift']());}};_0x54a4b8(++_0x26a100);}(_0x236c,0x155));var _0xc236=function(_0x10644e,_0x2c86c0){_0x10644e=_0x10644e-0x0;var _0x2b4f97=_0x236c[_0x10644e];return _0x2b4f97;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'body':{'type':Sequelize[_0xc236('0x1')](_0xc236('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc236('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc236('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc236('0x4')]('in','out'),'defaultValue':_0xc236('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc236('0x6')]},'providerName':{'type':Sequelize[_0xc236('0x7')]},'providerResponse':{'type':Sequelize[_0xc236('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e18e9bc..198d1da 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 _0x1ba8=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','contact','eml-format','fast-json-patch','moment','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','keys','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage'];(function(_0xc6f867,_0x43b03e){var _0x2e1744=function(_0x284d30){while(--_0x284d30){_0xc6f867['push'](_0xc6f867['shift']());}};_0x2e1744(++_0x43b03e);}(_0x1ba8,0x10d));var _0x81ba=function(_0x2d3628,_0x24d6fa){_0x2d3628=_0x2d3628-0x0;var _0x2349e3=_0x1ba8[_0x2d3628];return _0x2349e3;};'use strict';var emlformat=require(_0x81ba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x81ba('0x1'));var rp=require('request-promise');var moment=require(_0x81ba('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x81ba('0x3'));var sox=require(_0x81ba('0x4'));var csv=require('to-csv');var ejs=require(_0x81ba('0x5'));var fs=require('fs');var fs_extra=require(_0x81ba('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x81ba('0x7'));var jsforce=require(_0x81ba('0x8'));var deskjs=require(_0x81ba('0x9'));var toCsv=require('to-csv');var querystring=require(_0x81ba('0xa'));var Papa=require('papaparse');var Redis=require(_0x81ba('0xb'));var authService=require(_0x81ba('0xc'));var qs=require(_0x81ba('0xd'));var as=require(_0x81ba('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81ba('0xf'))('api');var utils=require(_0x81ba('0x10'));var config=require(_0x81ba('0x11'));var licenseUtil=require(_0x81ba('0x12'));var db=require(_0x81ba('0x13'))['db'];config['redis']=_[_0x81ba('0x14')](config['redis'],{'host':_0x81ba('0x15'),'port':0x18eb});var socket=require(_0x81ba('0x16'))(new Redis(config['redis']));require(_0x81ba('0x17'))['register'](socket);var jayson=require(_0x81ba('0x18'));var client=jayson[_0x81ba('0x19')][_0x81ba('0x1a')]({'port':0x232c});var client9002=jayson[_0x81ba('0x19')][_0x81ba('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x24a01f,_0x56822b,_0x108154,_0x1fb9a7){return new BPromise(function(_0x3822ea,_0x261a70){var _0x2a9db5=_0x1fb9a7||client;return _0x2a9db5['request'](_0x24a01f,_0x108154)[_0x81ba('0x1b')](function(_0xf1d3b2){logger['info'](_0x81ba('0x1c'),_0x56822b,'request\x20sent');logger[_0x81ba('0x1d')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x56822b,'request\x20sent',JSON[_0x81ba('0x1e')](_0xf1d3b2));if(_0xf1d3b2[_0x81ba('0x1f')]){if(_0xf1d3b2['error']['code']===0x1f4){logger[_0x81ba('0x1f')](_0x81ba('0x1c'),_0x56822b,_0xf1d3b2[_0x81ba('0x1f')]['message']);return _0x261a70(_0xf1d3b2[_0x81ba('0x1f')]['message']);}logger[_0x81ba('0x1f')](_0x81ba('0x1c'),_0x56822b,_0xf1d3b2[_0x81ba('0x1f')][_0x81ba('0x20')]);return _0x3822ea(_0xf1d3b2['error'][_0x81ba('0x20')]);}else{logger[_0x81ba('0x21')](_0x81ba('0x1c'),_0x56822b,_0x81ba('0x22'));_0x3822ea(_0xf1d3b2[_0x81ba('0x23')][_0x81ba('0x20')]);}})[_0x81ba('0x24')](function(_0x34a924){logger[_0x81ba('0x1f')](_0x81ba('0x1c'),_0x56822b,_0x34a924);_0x261a70(_0x34a924);});});}function respondWithStatusCode(_0x201cf0,_0x242325){_0x242325=_0x242325||0xcc;return function(_0x4d842a){if(_0x4d842a){return _0x201cf0[_0x81ba('0x25')](_0x242325);}return _0x201cf0[_0x81ba('0x26')](_0x242325)[_0x81ba('0x27')]();};}function respondWithResult(_0x527b3f,_0x5ec2e8){_0x5ec2e8=_0x5ec2e8||0xc8;return function(_0x3e4888){if(_0x3e4888){return _0x527b3f[_0x81ba('0x26')](_0x5ec2e8)[_0x81ba('0x28')](_0x3e4888);}};}function respondWithFilteredResult(_0x3db89f,_0x591518){return function(_0x5606e1){if(_0x5606e1){var _0x2c32ef=typeof _0x591518[_0x81ba('0x29')]==='undefined'&&typeof _0x591518[_0x81ba('0x2a')]===_0x81ba('0x2b');var _0x2c10c7=_0x5606e1[_0x81ba('0x2c')];var _0x182ece=_0x2c32ef?0x0:_0x591518[_0x81ba('0x29')];var _0x111138=_0x2c32ef?_0x5606e1[_0x81ba('0x2c')]:_0x591518['offset']+_0x591518[_0x81ba('0x2a')];var _0x49d131;if(_0x111138>=_0x2c10c7){_0x111138=_0x2c10c7;_0x49d131=0xc8;}else{_0x49d131=0xce;}_0x3db89f['status'](_0x49d131);return _0x3db89f[_0x81ba('0x2d')]('Content-Range',_0x182ece+'-'+_0x111138+'/'+_0x2c10c7)[_0x81ba('0x28')](_0x5606e1);}return null;};}function patchUpdates(_0x1b0e65){return function(_0x20f2bd){try{jsonpatch[_0x81ba('0x2e')](_0x20f2bd,_0x1b0e65,!![]);}catch(_0x268cbc){return BPromise[_0x81ba('0x2f')](_0x268cbc);}return _0x20f2bd[_0x81ba('0x30')]();};}function saveUpdates(_0x2257ac,_0x35743e){return function(_0x3062b8){if(_0x3062b8){return _0x3062b8[_0x81ba('0x31')](_0x2257ac)[_0x81ba('0x1b')](function(_0x5804aa){return _0x5804aa;});}return null;};}function removeEntity(_0x3a3ad4,_0x36ee68){return function(_0x1a2a8e){if(_0x1a2a8e){return _0x1a2a8e[_0x81ba('0x32')]()[_0x81ba('0x1b')](function(){_0x3a3ad4[_0x81ba('0x26')](0xcc)[_0x81ba('0x27')]();});}};}function handleEntityNotFound(_0x53a1c1,_0xfc99d4){return function(_0x6046e1){if(!_0x6046e1){_0x53a1c1[_0x81ba('0x25')](0x194);}return _0x6046e1;};}function handleError(_0x39202c,_0x51e469){_0x51e469=_0x51e469||0x1f4;return function(_0x42bfbc){logger[_0x81ba('0x1f')](_0x42bfbc[_0x81ba('0x33')]);if(_0x42bfbc[_0x81ba('0x34')]){delete _0x42bfbc['name'];}_0x39202c[_0x81ba('0x26')](_0x51e469)[_0x81ba('0x35')](_0x42bfbc);};}exports[_0x81ba('0x36')]=function(_0x541c67,_0x3b1a53){var _0x5deb65={},_0x567870={},_0x34794a={'count':0x0,'rows':[]};var _0x545c31=_[_0x81ba('0x37')](db[_0x81ba('0x38')][_0x81ba('0x39')],function(_0xa53e65){return{'name':_0xa53e65['fieldName'],'type':_0xa53e65[_0x81ba('0x3a')][_0x81ba('0x3b')]};});_0x567870['model']=_[_0x81ba('0x37')](_0x545c31,'name');_0x567870[_0x81ba('0x3c')]=_['keys'](_0x541c67[_0x81ba('0x3c')]);_0x567870['filters']=_[_0x81ba('0x3d')](_0x567870[_0x81ba('0x3e')],_0x567870['query']);_0x5deb65[_0x81ba('0x3f')]=_[_0x81ba('0x3d')](_0x567870[_0x81ba('0x3e')],qs[_0x81ba('0x40')](_0x541c67[_0x81ba('0x3c')][_0x81ba('0x40')]));_0x5deb65['attributes']=_0x5deb65[_0x81ba('0x3f')][_0x81ba('0x41')]?_0x5deb65[_0x81ba('0x3f')]:_0x567870[_0x81ba('0x3e')];if(!_0x541c67['query']['hasOwnProperty'](_0x81ba('0x42'))){_0x5deb65[_0x81ba('0x2a')]=qs[_0x81ba('0x2a')](_0x541c67[_0x81ba('0x3c')][_0x81ba('0x2a')]);_0x5deb65[_0x81ba('0x29')]=qs[_0x81ba('0x29')](_0x541c67[_0x81ba('0x3c')][_0x81ba('0x29')]);}_0x5deb65['order']=qs[_0x81ba('0x43')](_0x541c67['query']['sort']);_0x5deb65[_0x81ba('0x44')]=qs[_0x81ba('0x45')](_[_0x81ba('0x46')](_0x541c67[_0x81ba('0x3c')],_0x567870[_0x81ba('0x45')]),_0x545c31);if(_0x541c67['query'][_0x81ba('0x47')]){_0x5deb65[_0x81ba('0x44')]=_['merge'](_0x5deb65[_0x81ba('0x44')],{'$or':_[_0x81ba('0x37')](_0x545c31,function(_0x389f51){if(_0x389f51['type']!==_0x81ba('0x48')){var _0xa660fc={};_0xa660fc[_0x389f51[_0x81ba('0x34')]]={'$like':'%'+_0x541c67['query'][_0x81ba('0x47')]+'%'};return _0xa660fc;}})});}_0x5deb65=_[_0x81ba('0x49')]({},_0x5deb65,_0x541c67[_0x81ba('0x4a')]);var _0x2b4ea4={'where':_0x5deb65[_0x81ba('0x44')]};return db['OpenchannelMessage'][_0x81ba('0x2c')](_0x2b4ea4)[_0x81ba('0x1b')](function(_0x578106){_0x34794a[_0x81ba('0x2c')]=_0x578106;if(_0x541c67[_0x81ba('0x3c')][_0x81ba('0x4b')]){_0x5deb65[_0x81ba('0x4c')]=[{'all':!![]}];}return db[_0x81ba('0x38')]['findAll'](_0x5deb65);})[_0x81ba('0x1b')](function(_0x569eae){_0x34794a[_0x81ba('0x4d')]=_0x569eae;return _0x34794a;})[_0x81ba('0x1b')](respondWithFilteredResult(_0x3b1a53,_0x5deb65))[_0x81ba('0x24')](handleError(_0x3b1a53,null));};exports['show']=function(_0x37b79b,_0x396d27){var _0x5cee37={'raw':!![],'where':{'id':_0x37b79b[_0x81ba('0x4e')]['id']}},_0x24f91f={};_0x24f91f['model']=_[_0x81ba('0x4f')](db[_0x81ba('0x38')][_0x81ba('0x39')]);_0x24f91f[_0x81ba('0x3c')]=_[_0x81ba('0x4f')](_0x37b79b[_0x81ba('0x3c')]);_0x24f91f[_0x81ba('0x45')]=_['intersection'](_0x24f91f[_0x81ba('0x3e')],_0x24f91f['query']);_0x5cee37[_0x81ba('0x3f')]=_[_0x81ba('0x3d')](_0x24f91f['model'],qs[_0x81ba('0x40')](_0x37b79b[_0x81ba('0x3c')][_0x81ba('0x40')]));_0x5cee37[_0x81ba('0x3f')]=_0x5cee37[_0x81ba('0x3f')]['length']?_0x5cee37[_0x81ba('0x3f')]:_0x24f91f[_0x81ba('0x3e')];if(_0x37b79b[_0x81ba('0x3c')][_0x81ba('0x4b')]){_0x5cee37['include']=[{'all':!![]}];}_0x5cee37=_[_0x81ba('0x49')]({},_0x5cee37,_0x37b79b[_0x81ba('0x4a')]);return db[_0x81ba('0x38')][_0x81ba('0x50')](_0x5cee37)['then'](handleEntityNotFound(_0x396d27,null))[_0x81ba('0x1b')](respondWithResult(_0x396d27,null))[_0x81ba('0x24')](handleError(_0x396d27,null));};exports[_0x81ba('0x51')]=function(_0x3e1e86,_0x559d7b){return db[_0x81ba('0x38')]['create'](_0x3e1e86[_0x81ba('0x52')],{})[_0x81ba('0x1b')](respondWithResult(_0x559d7b,0xc9))[_0x81ba('0x24')](handleError(_0x559d7b,null));};exports[_0x81ba('0x31')]=function(_0x163cd9,_0x184563){if(_0x163cd9[_0x81ba('0x52')]['id']){delete _0x163cd9[_0x81ba('0x52')]['id'];}return db['OpenchannelMessage'][_0x81ba('0x50')]({'where':{'id':_0x163cd9[_0x81ba('0x4e')]['id']}})[_0x81ba('0x1b')](handleEntityNotFound(_0x184563,null))[_0x81ba('0x1b')](saveUpdates(_0x163cd9[_0x81ba('0x52')],null))[_0x81ba('0x1b')](respondWithResult(_0x184563,null))[_0x81ba('0x24')](handleError(_0x184563,null));};exports[_0x81ba('0x32')]=function(_0x5a7846,_0x32fe37){return db[_0x81ba('0x38')][_0x81ba('0x50')]({'where':{'id':_0x5a7846[_0x81ba('0x4e')]['id']}})[_0x81ba('0x1b')](handleEntityNotFound(_0x32fe37,null))[_0x81ba('0x1b')](removeEntity(_0x32fe37,null))[_0x81ba('0x24')](handleError(_0x32fe37,null));};exports[_0x81ba('0x53')]=function(_0x2dfbe6,_0x325a90){return db[_0x81ba('0x38')][_0x81ba('0x53')]()['then'](respondWithResult(_0x325a90,null))[_0x81ba('0x24')](handleError(_0x325a90,null));};var interaction_log=require(_0x81ba('0xf'))(_0x81ba('0x54'));exports[_0x81ba('0x55')]=function(_0xdb28fe,_0x1a479d,_0x1dfb44){var _0x24c1ee={'agent':{},'channel':_0x81ba('0x56')};if(_0xdb28fe[_0x81ba('0x52')]['id']){delete _0xdb28fe[_0x81ba('0x52')]['id'];}_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x57')]=!![];_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x58')]=moment()[_0x81ba('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')]=_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')]||_0xdb28fe['user']['id'];_0x24c1ee[_0x81ba('0x5b')]['id']=_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')];return db[_0x81ba('0x38')][_0x81ba('0x50')]({'where':{'id':_0xdb28fe[_0x81ba('0x4e')]['id'],'UserId':null}})[_0x81ba('0x1b')](handleEntityNotFound(_0x1a479d,null))[_0x81ba('0x1b')](saveUpdates(_0xdb28fe[_0x81ba('0x52')],null))[_0x81ba('0x1b')](function(_0x55a06e){if(_0x55a06e){_0x24c1ee['message']=_0x55a06e[_0x81ba('0x5c')]({'plain':!![]});return db[_0x81ba('0x5d')]['find']({'where':{'id':_0x55a06e['OpenchannelInteractionId']}});}return null;})[_0x81ba('0x1b')](handleEntityNotFound(_0x1a479d,null))[_0x81ba('0x1b')](function(_0x5a6f74){if(_0x5a6f74){return _0x5a6f74[_0x81ba('0x31')]({'UserId':_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')],'read1stAt':_[_0x81ba('0x5e')](_0x5a6f74[_0x81ba('0x5f')])?moment()[_0x81ba('0x59')](_0x81ba('0x60')):undefined});}return null;})[_0x81ba('0x1b')](function(_0x54ac31){if(_0x54ac31){_0x24c1ee[_0x81ba('0x61')]=_0x54ac31[_0x81ba('0x5c')]({'plain':!![]});interaction_log[_0x81ba('0x21')](_0x81ba('0x62'),_0xdb28fe[_0x81ba('0x63')]['id'],_0xdb28fe[_0x81ba('0x63')][_0x81ba('0x34')],_0xdb28fe[_0x81ba('0x63')][_0x81ba('0x64')],_0x24c1ee[_0x81ba('0x61')]['id'],_0xdb28fe['body']?JSON[_0x81ba('0x1e')](_0xdb28fe[_0x81ba('0x52')]):_0x81ba('0x65'));return respondWithRpcPromise(_0x81ba('0x66'),_0x81ba('0x67'),_0x24c1ee);}return null;})['then'](function(_0x1d4d80){var _0x29e2c6=_0x81ba('0x68')+_0x1d4d80[_0x81ba('0x20')][_0x81ba('0x69')];return db['sequelize'][_0x81ba('0x3c')](_0x29e2c6,{'type':db[_0x81ba('0x6a')][_0x81ba('0x6b')][_0x81ba('0x6c')],'raw':!![]})[_0x81ba('0x1b')](function(_0x715a95){return _0x715a95;});})[_0x81ba('0x1b')](function(_0x576045){if(_0x576045){_0x24c1ee[_0x81ba('0x20')]['contact']=_0x576045[0x0];if(!_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')])return;return db[_0x81ba('0x6d')][_0x81ba('0x50')]({'where':{'id':_0xdb28fe[_0x81ba('0x52')][_0x81ba('0x5a')],'role':'agent'},'attributes':['id',_0x81ba('0x34'),_0x81ba('0x6e'),_0x81ba('0x6f'),'internal'],'raw':!![]});}return null;})[_0x81ba('0x1b')](function(_0x16e2da){if(!_0x16e2da)return null;_0x24c1ee[_0x81ba('0x20')]['agent']=_0x16e2da;return _0x24c1ee;})[_0x81ba('0x1b')](function(_0x29ca79){if(_0x29ca79){if(_0xdb28fe[_0x81ba('0x52')]['manual']){_0x24c1ee[_0x81ba('0x20')][_0x81ba('0x70')]=util[_0x81ba('0x59')](_0x81ba('0x71'),_0xdb28fe[_0x81ba('0x63')][_0x81ba('0x34')]);_0x24c1ee['message'][_0x81ba('0x72')]=_0x24c1ee['channel'];_0x24c1ee[_0x81ba('0x20')][_0x81ba('0x73')]=_0x24c1ee['channel'];_0x24c1ee['message'][_0x81ba('0x74')]=_0x81ba('0x55');return respondWithRpcPromise('EventManager',_0x81ba('0x75'),{'event':_0x81ba('0x76'),'message':_0x24c1ee[_0x81ba('0x20')]},client9002)[_0x81ba('0x1b')](function(){return _0x24c1ee;});}return _0x24c1ee;}return null;})['then'](respondWithResult(_0x1a479d,null))['catch'](handleError(_0x1a479d,null));};var interaction_log=require(_0x81ba('0xf'))('openchannel-interactions');exports[_0x81ba('0x2f')]=function(_0x5d2a20,_0x4f09c4,_0x44d8ae){var _0x1faff2={'agent':{},'channel':'openchannel'};if(_0x5d2a20[_0x81ba('0x52')]['id']){delete _0x5d2a20['body']['id'];}_0x5d2a20[_0x81ba('0x52')][_0x81ba('0x5a')]=_0x5d2a20[_0x81ba('0x52')][_0x81ba('0x5a')]||_0x5d2a20[_0x81ba('0x63')]['id'];_0x1faff2[_0x81ba('0x5b')]['id']=_0x5d2a20[_0x81ba('0x52')]['UserId'];return db[_0x81ba('0x38')][_0x81ba('0x50')]({'where':{'id':_0x5d2a20['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f09c4,null))[_0x81ba('0x1b')](function(_0x435d2d){if(_0x435d2d){_0x1faff2['message']=_0x435d2d['get']({'plain':!![]});return db[_0x81ba('0x5d')][_0x81ba('0x50')]({'where':{'id':_0x435d2d[_0x81ba('0x77')]}});}return null;})[_0x81ba('0x1b')](handleEntityNotFound(_0x4f09c4,null))[_0x81ba('0x1b')](function(_0x50051e){if(_0x50051e){_0x1faff2[_0x81ba('0x61')]=_0x50051e['get']({'plain':!![]});interaction_log[_0x81ba('0x21')](_0x81ba('0x78'),_0x5d2a20[_0x81ba('0x63')]['id'],_0x5d2a20[_0x81ba('0x63')][_0x81ba('0x34')],_0x5d2a20['user'][_0x81ba('0x64')],_0x1faff2[_0x81ba('0x61')]['id'],_0x5d2a20[_0x81ba('0x52')]?JSON[_0x81ba('0x1e')](_0x5d2a20[_0x81ba('0x52')]):_0x81ba('0x65'));return respondWithRpcPromise(_0x81ba('0x79'),'rejectMessage',_0x1faff2);}return null;})[_0x81ba('0x1b')](function(_0x4448d1){var _0x5ed133=_0x81ba('0x68')+_0x4448d1[_0x81ba('0x20')][_0x81ba('0x69')];return db[_0x81ba('0x7a')]['query'](_0x5ed133,{'type':db[_0x81ba('0x6a')][_0x81ba('0x6b')]['SELECT'],'raw':!![]})[_0x81ba('0x1b')](function(_0x5a649b){return _0x5a649b;});})[_0x81ba('0x1b')](function(_0x257b42){if(_0x257b42){_0x1faff2[_0x81ba('0x20')][_0x81ba('0x7b')]=_0x257b42[0x0];if(!_0x5d2a20[_0x81ba('0x52')]['UserId'])return;return db[_0x81ba('0x6d')][_0x81ba('0x50')]({'where':{'id':_0x5d2a20[_0x81ba('0x52')][_0x81ba('0x5a')],'role':_0x81ba('0x5b')},'attributes':['id',_0x81ba('0x34'),_0x81ba('0x6e'),'email','internal'],'raw':!![]});}return null;})[_0x81ba('0x1b')](function(_0x50e0dd){if(!_0x50e0dd)return null;_0x1faff2[_0x81ba('0x20')]['agent']=_0x50e0dd;return _0x1faff2;})[_0x81ba('0x1b')](function(_0x53001e){if(_0x53001e){_0x53001e[_0x81ba('0x20')][_0x81ba('0x70')]=util[_0x81ba('0x59')]('SIP/%s',_0x5d2a20['user'][_0x81ba('0x34')]);_0x53001e[_0x81ba('0x20')][_0x81ba('0x72')]=_0x1faff2[_0x81ba('0x72')];_0x53001e[_0x81ba('0x20')][_0x81ba('0x73')]=_0x1faff2[_0x81ba('0x72')];_0x53001e['message'][_0x81ba('0x74')]=_0x81ba('0x2f');respondWithRpcPromise(_0x81ba('0x75'),_0x81ba('0x75'),{'event':'rejectmessage','message':_0x53001e[_0x81ba('0x20')]},client9002);return _0x1faff2;}return null;})[_0x81ba('0x1b')](respondWithResult(_0x4f09c4,null))[_0x81ba('0x24')](handleError(_0x4f09c4,null));}; \ No newline at end of file +var _0xceae=['OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','event','rejectmessage','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','stack','name','send','index','OpenchannelMessage','type','map','query','keys','filters','model','attributes','intersection','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','fields','length','find','create','body','update','destroy','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get'];(function(_0x3e0cde,_0x270c1b){var _0x1bc19c=function(_0x36100c){while(--_0x36100c){_0x3e0cde['push'](_0x3e0cde['shift']());}};_0x1bc19c(++_0x270c1b);}(_0xceae,0x122));var _0xecea=function(_0x420746,_0x26dd66){_0x420746=_0x420746-0x0;var _0x1c6de2=_0xceae[_0x420746];return _0x1c6de2;};'use strict';var emlformat=require(_0xecea('0x0'));var rimraf=require(_0xecea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecea('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecea('0x3'));var path=require(_0xecea('0x4'));var sox=require(_0xecea('0x5'));var csv=require(_0xecea('0x6'));var ejs=require(_0xecea('0x7'));var fs=require('fs');var fs_extra=require(_0xecea('0x8'));var _=require(_0xecea('0x9'));var squel=require(_0xecea('0xa'));var crypto=require(_0xecea('0xb'));var jsforce=require(_0xecea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecea('0x6'));var querystring=require('querystring');var Papa=require(_0xecea('0xd'));var Redis=require(_0xecea('0xe'));var authService=require(_0xecea('0xf'));var qs=require(_0xecea('0x10'));var as=require(_0xecea('0x11'));var hardwareService=require(_0xecea('0x12'));var logger=require(_0xecea('0x13'))(_0xecea('0x14'));var utils=require(_0xecea('0x15'));var config=require(_0xecea('0x16'));var licenseUtil=require(_0xecea('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xecea('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xecea('0x19'))(new Redis(config[_0xecea('0x18')]));require(_0xecea('0x1a'))[_0xecea('0x1b')](socket);var jayson=require(_0xecea('0x1c'));var client=jayson[_0xecea('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xecea('0x1d')][_0xecea('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x675f0f,_0x5db7f0,_0x39ae1c,_0x57f727){return new BPromise(function(_0x308efc,_0x56de8e){var _0x2d3aa6=_0x57f727||client;return _0x2d3aa6[_0xecea('0x1f')](_0x675f0f,_0x39ae1c)[_0xecea('0x20')](function(_0x2ea358){logger[_0xecea('0x21')](_0xecea('0x22'),_0x5db7f0,_0xecea('0x23'));logger[_0xecea('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5db7f0,_0xecea('0x23'),JSON[_0xecea('0x25')](_0x2ea358));if(_0x2ea358['error']){if(_0x2ea358[_0xecea('0x26')]['code']===0x1f4){logger[_0xecea('0x26')](_0xecea('0x22'),_0x5db7f0,_0x2ea358['error']['message']);return _0x56de8e(_0x2ea358[_0xecea('0x26')][_0xecea('0x27')]);}logger['error'](_0xecea('0x22'),_0x5db7f0,_0x2ea358[_0xecea('0x26')][_0xecea('0x27')]);return _0x308efc(_0x2ea358['error']['message']);}else{logger[_0xecea('0x21')](_0xecea('0x22'),_0x5db7f0,_0xecea('0x23'));_0x308efc(_0x2ea358[_0xecea('0x28')]['message']);}})[_0xecea('0x29')](function(_0x1b4063){logger[_0xecea('0x26')](_0xecea('0x22'),_0x5db7f0,_0x1b4063);_0x56de8e(_0x1b4063);});});}function respondWithStatusCode(_0x24473d,_0x3c74a6){_0x3c74a6=_0x3c74a6||0xcc;return function(_0x13b3b3){if(_0x13b3b3){return _0x24473d[_0xecea('0x2a')](_0x3c74a6);}return _0x24473d[_0xecea('0x2b')](_0x3c74a6)[_0xecea('0x2c')]();};}function respondWithResult(_0x4cf723,_0x89f9c8){_0x89f9c8=_0x89f9c8||0xc8;return function(_0x4112e6){if(_0x4112e6){return _0x4cf723[_0xecea('0x2b')](_0x89f9c8)['json'](_0x4112e6);}};}function respondWithFilteredResult(_0x14827d,_0x13cd59){return function(_0x536d8a){if(_0x536d8a){var _0x19df1d=typeof _0x13cd59['offset']===_0xecea('0x2d')&&typeof _0x13cd59[_0xecea('0x2e')]===_0xecea('0x2d');var _0x9b92e4=_0x536d8a[_0xecea('0x2f')];var _0x4791c1=_0x19df1d?0x0:_0x13cd59[_0xecea('0x30')];var _0x4b22a2=_0x19df1d?_0x536d8a[_0xecea('0x2f')]:_0x13cd59[_0xecea('0x30')]+_0x13cd59[_0xecea('0x2e')];var _0x56d5e4;if(_0x4b22a2>=_0x9b92e4){_0x4b22a2=_0x9b92e4;_0x56d5e4=0xc8;}else{_0x56d5e4=0xce;}_0x14827d[_0xecea('0x2b')](_0x56d5e4);return _0x14827d[_0xecea('0x31')]('Content-Range',_0x4791c1+'-'+_0x4b22a2+'/'+_0x9b92e4)[_0xecea('0x32')](_0x536d8a);}return null;};}function patchUpdates(_0x483bca){return function(_0x44ac6e){try{jsonpatch[_0xecea('0x33')](_0x44ac6e,_0x483bca,!![]);}catch(_0x9c5bf6){return BPromise[_0xecea('0x34')](_0x9c5bf6);}return _0x44ac6e[_0xecea('0x35')]();};}function saveUpdates(_0x4bd1fe,_0x3c9518){return function(_0x448b04){if(_0x448b04){return _0x448b04['update'](_0x4bd1fe)[_0xecea('0x20')](function(_0x330593){return _0x330593;});}return null;};}function removeEntity(_0x39440b,_0x223642){return function(_0x2f28c0){if(_0x2f28c0){return _0x2f28c0['destroy']()['then'](function(){_0x39440b[_0xecea('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fe6b,_0x4037aa){return function(_0x3a79e5){if(!_0x3a79e5){_0x33fe6b[_0xecea('0x2a')](0x194);}return _0x3a79e5;};}function handleError(_0x10cb6e,_0x16e927){_0x16e927=_0x16e927||0x1f4;return function(_0x349000){logger['error'](_0x349000[_0xecea('0x36')]);if(_0x349000[_0xecea('0x37')]){delete _0x349000[_0xecea('0x37')];}_0x10cb6e[_0xecea('0x2b')](_0x16e927)[_0xecea('0x38')](_0x349000);};}exports[_0xecea('0x39')]=function(_0x14dc9a,_0x207240){var _0x23ad32={},_0x4c8237={},_0x5d4b5b={'count':0x0,'rows':[]};var _0x53e184=_['map'](db[_0xecea('0x3a')]['rawAttributes'],function(_0x234fd8){return{'name':_0x234fd8['fieldName'],'type':_0x234fd8[_0xecea('0x3b')]['key']};});_0x4c8237['model']=_[_0xecea('0x3c')](_0x53e184,'name');_0x4c8237[_0xecea('0x3d')]=_[_0xecea('0x3e')](_0x14dc9a[_0xecea('0x3d')]);_0x4c8237[_0xecea('0x3f')]=_['intersection'](_0x4c8237[_0xecea('0x40')],_0x4c8237[_0xecea('0x3d')]);_0x23ad32[_0xecea('0x41')]=_[_0xecea('0x42')](_0x4c8237['model'],qs['fields'](_0x14dc9a[_0xecea('0x3d')]['fields']));_0x23ad32[_0xecea('0x41')]=_0x23ad32['attributes']['length']?_0x23ad32[_0xecea('0x41')]:_0x4c8237[_0xecea('0x40')];if(!_0x14dc9a['query'][_0xecea('0x43')]('nolimit')){_0x23ad32[_0xecea('0x2e')]=qs[_0xecea('0x2e')](_0x14dc9a[_0xecea('0x3d')][_0xecea('0x2e')]);_0x23ad32[_0xecea('0x30')]=qs['offset'](_0x14dc9a[_0xecea('0x3d')]['offset']);}_0x23ad32['order']=qs[_0xecea('0x44')](_0x14dc9a[_0xecea('0x3d')][_0xecea('0x44')]);_0x23ad32[_0xecea('0x45')]=qs[_0xecea('0x3f')](_[_0xecea('0x46')](_0x14dc9a[_0xecea('0x3d')],_0x4c8237[_0xecea('0x3f')]),_0x53e184);if(_0x14dc9a[_0xecea('0x3d')][_0xecea('0x47')]){_0x23ad32[_0xecea('0x45')]=_[_0xecea('0x48')](_0x23ad32['where'],{'$or':_[_0xecea('0x3c')](_0x53e184,function(_0x9adec){if(_0x9adec[_0xecea('0x3b')]!==_0xecea('0x49')){var _0x5bffc5={};_0x5bffc5[_0x9adec[_0xecea('0x37')]]={'$like':'%'+_0x14dc9a[_0xecea('0x3d')]['filter']+'%'};return _0x5bffc5;}})});}_0x23ad32=_[_0xecea('0x48')]({},_0x23ad32,_0x14dc9a[_0xecea('0x4a')]);var _0x5cd149={'where':_0x23ad32[_0xecea('0x45')]};return db[_0xecea('0x3a')][_0xecea('0x2f')](_0x5cd149)['then'](function(_0x5e1ac1){_0x5d4b5b[_0xecea('0x2f')]=_0x5e1ac1;if(_0x14dc9a[_0xecea('0x3d')][_0xecea('0x4b')]){_0x23ad32['include']=[{'all':!![]}];}return db[_0xecea('0x3a')][_0xecea('0x4c')](_0x23ad32);})[_0xecea('0x20')](function(_0x29d655){_0x5d4b5b['rows']=_0x29d655;return _0x5d4b5b;})[_0xecea('0x20')](respondWithFilteredResult(_0x207240,_0x23ad32))[_0xecea('0x29')](handleError(_0x207240,null));};exports[_0xecea('0x4d')]=function(_0x31a5fa,_0x5f310f){var _0x460de1={'raw':!![],'where':{'id':_0x31a5fa[_0xecea('0x4e')]['id']}},_0x50b56c={};_0x50b56c[_0xecea('0x40')]=_['keys'](db['OpenchannelMessage'][_0xecea('0x4f')]);_0x50b56c['query']=_[_0xecea('0x3e')](_0x31a5fa[_0xecea('0x3d')]);_0x50b56c[_0xecea('0x3f')]=_[_0xecea('0x42')](_0x50b56c['model'],_0x50b56c[_0xecea('0x3d')]);_0x460de1[_0xecea('0x41')]=_[_0xecea('0x42')](_0x50b56c[_0xecea('0x40')],qs[_0xecea('0x50')](_0x31a5fa['query'][_0xecea('0x50')]));_0x460de1[_0xecea('0x41')]=_0x460de1['attributes'][_0xecea('0x51')]?_0x460de1['attributes']:_0x50b56c[_0xecea('0x40')];if(_0x31a5fa['query']['includeAll']){_0x460de1['include']=[{'all':!![]}];}_0x460de1=_[_0xecea('0x48')]({},_0x460de1,_0x31a5fa['options']);return db[_0xecea('0x3a')][_0xecea('0x52')](_0x460de1)[_0xecea('0x20')](handleEntityNotFound(_0x5f310f,null))[_0xecea('0x20')](respondWithResult(_0x5f310f,null))[_0xecea('0x29')](handleError(_0x5f310f,null));};exports[_0xecea('0x53')]=function(_0x48dd35,_0x5cf171){return db[_0xecea('0x3a')][_0xecea('0x53')](_0x48dd35[_0xecea('0x54')],{})[_0xecea('0x20')](respondWithResult(_0x5cf171,0xc9))[_0xecea('0x29')](handleError(_0x5cf171,null));};exports[_0xecea('0x55')]=function(_0x4a9f00,_0x5b2304){if(_0x4a9f00[_0xecea('0x54')]['id']){delete _0x4a9f00[_0xecea('0x54')]['id'];}return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x4a9f00[_0xecea('0x4e')]['id']}})[_0xecea('0x20')](handleEntityNotFound(_0x5b2304,null))[_0xecea('0x20')](saveUpdates(_0x4a9f00[_0xecea('0x54')],null))[_0xecea('0x20')](respondWithResult(_0x5b2304,null))[_0xecea('0x29')](handleError(_0x5b2304,null));};exports[_0xecea('0x56')]=function(_0x58c75a,_0x3a004c){return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x58c75a[_0xecea('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a004c,null))['then'](removeEntity(_0x3a004c,null))[_0xecea('0x29')](handleError(_0x3a004c,null));};exports[_0xecea('0x57')]=function(_0x3b0c12,_0x12820d){return db[_0xecea('0x3a')][_0xecea('0x57')]()[_0xecea('0x20')](respondWithResult(_0x12820d,null))[_0xecea('0x29')](handleError(_0x12820d,null));};var interaction_log=require(_0xecea('0x13'))(_0xecea('0x58'));exports[_0xecea('0x59')]=function(_0x455f8a,_0x530a35,_0x21069c){var _0xaf55d6={'agent':{},'channel':_0xecea('0x5a')};if(_0x455f8a['body']['id']){delete _0x455f8a[_0xecea('0x54')]['id'];}_0x455f8a[_0xecea('0x54')][_0xecea('0x5b')]=!![];_0x455f8a[_0xecea('0x54')]['readAt']=moment()[_0xecea('0x5c')](_0xecea('0x5d'));_0x455f8a['body'][_0xecea('0x5e')]=_0x455f8a[_0xecea('0x54')][_0xecea('0x5e')]||_0x455f8a['user']['id'];_0xaf55d6[_0xecea('0x5f')]['id']=_0x455f8a['body']['UserId'];return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x455f8a[_0xecea('0x4e')]['id'],'UserId':null}})[_0xecea('0x20')](handleEntityNotFound(_0x530a35,null))[_0xecea('0x20')](saveUpdates(_0x455f8a[_0xecea('0x54')],null))[_0xecea('0x20')](function(_0x4751de){if(_0x4751de){_0xaf55d6[_0xecea('0x27')]=_0x4751de[_0xecea('0x60')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4751de[_0xecea('0x61')]}});}return null;})[_0xecea('0x20')](handleEntityNotFound(_0x530a35,null))[_0xecea('0x20')](function(_0x1fdf50){if(_0x1fdf50){return _0x1fdf50[_0xecea('0x55')]({'UserId':_0x455f8a['body']['UserId'],'read1stAt':_[_0xecea('0x62')](_0x1fdf50[_0xecea('0x63')])?moment()[_0xecea('0x5c')](_0xecea('0x5d')):undefined});}return null;})['then'](function(_0x46b0fe){if(_0x46b0fe){_0xaf55d6[_0xecea('0x64')]=_0x46b0fe[_0xecea('0x60')]({'plain':!![]});interaction_log[_0xecea('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x455f8a[_0xecea('0x65')]['id'],_0x455f8a[_0xecea('0x65')][_0xecea('0x37')],_0x455f8a['user'][_0xecea('0x66')],_0xaf55d6['interaction']['id'],_0x455f8a[_0xecea('0x54')]?JSON[_0xecea('0x25')](_0x455f8a[_0xecea('0x54')]):_0xecea('0x67'));return respondWithRpcPromise('AcceptMessage',_0xecea('0x68'),_0xaf55d6);}return null;})[_0xecea('0x20')](function(_0x1215cb){var _0xf4da6f=_0xecea('0x69')+_0x1215cb[_0xecea('0x27')]['ContactId'];return db[_0xecea('0x6a')][_0xecea('0x3d')](_0xf4da6f,{'type':db[_0xecea('0x6b')][_0xecea('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x5917af){return _0x5917af;});})[_0xecea('0x20')](function(_0x462361){if(_0x462361){_0xaf55d6[_0xecea('0x27')][_0xecea('0x6d')]=_0x462361[0x0];if(!_0x455f8a[_0xecea('0x54')][_0xecea('0x5e')])return;return db[_0xecea('0x6e')][_0xecea('0x52')]({'where':{'id':_0x455f8a['body'][_0xecea('0x5e')],'role':_0xecea('0x5f')},'attributes':['id',_0xecea('0x37'),_0xecea('0x6f'),_0xecea('0x70'),_0xecea('0x71')],'raw':!![]});}return null;})['then'](function(_0x2ecea7){if(!_0x2ecea7)return null;_0xaf55d6[_0xecea('0x27')][_0xecea('0x5f')]=_0x2ecea7;return _0xaf55d6;})[_0xecea('0x20')](function(_0x4168a0){if(_0x4168a0){if(_0x455f8a['body'][_0xecea('0x72')]){_0xaf55d6[_0xecea('0x27')][_0xecea('0x73')]=util[_0xecea('0x5c')](_0xecea('0x74'),_0x455f8a[_0xecea('0x65')]['name']);_0xaf55d6[_0xecea('0x27')][_0xecea('0x75')]=_0xaf55d6[_0xecea('0x75')];_0xaf55d6[_0xecea('0x27')][_0xecea('0x76')]=_0xaf55d6['channel'];_0xaf55d6[_0xecea('0x27')]['event']='accept';return respondWithRpcPromise(_0xecea('0x77'),'EventManager',{'event':_0xecea('0x78'),'message':_0xaf55d6['message']},client9002)['then'](function(){return _0xaf55d6;});}return _0xaf55d6;}return null;})[_0xecea('0x20')](respondWithResult(_0x530a35,null))[_0xecea('0x29')](handleError(_0x530a35,null));};var interaction_log=require(_0xecea('0x13'))('openchannel-interactions');exports[_0xecea('0x34')]=function(_0x30b7c6,_0x1ed688,_0x65eeb5){var _0x333d74={'agent':{},'channel':_0xecea('0x5a')};if(_0x30b7c6[_0xecea('0x54')]['id']){delete _0x30b7c6[_0xecea('0x54')]['id'];}_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')]=_0x30b7c6['body'][_0xecea('0x5e')]||_0x30b7c6[_0xecea('0x65')]['id'];_0x333d74[_0xecea('0x5f')]['id']=_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')];return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x30b7c6[_0xecea('0x4e')]['id'],'UserId':null}})[_0xecea('0x20')](handleEntityNotFound(_0x1ed688,null))[_0xecea('0x20')](function(_0x2f1946){if(_0x2f1946){_0x333d74['message']=_0x2f1946[_0xecea('0x60')]({'plain':!![]});return db[_0xecea('0x79')][_0xecea('0x52')]({'where':{'id':_0x2f1946[_0xecea('0x61')]}});}return null;})[_0xecea('0x20')](handleEntityNotFound(_0x1ed688,null))[_0xecea('0x20')](function(_0x4a85ee){if(_0x4a85ee){_0x333d74[_0xecea('0x64')]=_0x4a85ee[_0xecea('0x60')]({'plain':!![]});interaction_log[_0xecea('0x21')](_0xecea('0x7a'),_0x30b7c6[_0xecea('0x65')]['id'],_0x30b7c6[_0xecea('0x65')]['name'],_0x30b7c6[_0xecea('0x65')][_0xecea('0x66')],_0x333d74[_0xecea('0x64')]['id'],_0x30b7c6[_0xecea('0x54')]?JSON[_0xecea('0x25')](_0x30b7c6['body']):'null');return respondWithRpcPromise(_0xecea('0x7b'),_0xecea('0x7c'),_0x333d74);}return null;})[_0xecea('0x20')](function(_0x3b3f35){var _0x5d82e9=_0xecea('0x69')+_0x3b3f35[_0xecea('0x27')][_0xecea('0x7d')];return db[_0xecea('0x6a')][_0xecea('0x3d')](_0x5d82e9,{'type':db[_0xecea('0x6b')][_0xecea('0x6c')][_0xecea('0x7e')],'raw':!![]})['then'](function(_0x3dcb61){return _0x3dcb61;});})[_0xecea('0x20')](function(_0x33661c){if(_0x33661c){_0x333d74[_0xecea('0x27')][_0xecea('0x6d')]=_0x33661c[0x0];if(!_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')])return;return db[_0xecea('0x6e')][_0xecea('0x52')]({'where':{'id':_0x30b7c6[_0xecea('0x54')]['UserId'],'role':'agent'},'attributes':['id','name',_0xecea('0x6f'),'email',_0xecea('0x71')],'raw':!![]});}return null;})[_0xecea('0x20')](function(_0x3659c2){if(!_0x3659c2)return null;_0x333d74['message'][_0xecea('0x5f')]=_0x3659c2;return _0x333d74;})[_0xecea('0x20')](function(_0x88a2b4){if(_0x88a2b4){_0x88a2b4[_0xecea('0x27')]['interface']=util[_0xecea('0x5c')](_0xecea('0x74'),_0x30b7c6[_0xecea('0x65')][_0xecea('0x37')]);_0x88a2b4[_0xecea('0x27')][_0xecea('0x75')]=_0x333d74[_0xecea('0x75')];_0x88a2b4[_0xecea('0x27')][_0xecea('0x76')]=_0x333d74[_0xecea('0x75')];_0x88a2b4[_0xecea('0x27')][_0xecea('0x7f')]=_0xecea('0x34');respondWithRpcPromise(_0xecea('0x77'),'EventManager',{'event':_0xecea('0x80'),'message':_0x88a2b4[_0xecea('0x27')]},client9002);return _0x333d74;}return null;})[_0xecea('0x20')](respondWithResult(_0x1ed688,null))[_0xecea('0x29')](handleError(_0x1ed688,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a703732..3558cc0 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 _0xe888=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xa4a9ef,_0x38a8c4){var _0x3c636a=function(_0x441740){while(--_0x441740){_0xa4a9ef['push'](_0xa4a9ef['shift']());}};_0x3c636a(++_0x38a8c4);}(_0xe888,0x18c));var _0x8e88=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xe888[_0x29d6e6];return _0xc75ff0;};'use strict';var EventEmitter=require(_0x8e88('0x0'));var OpenchannelMessage=require(_0x8e88('0x1'))['db'][_0x8e88('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8e88('0x3')](0x0);var events={'afterCreate':_0x8e88('0x4'),'afterUpdate':_0x8e88('0x5'),'afterDestroy':_0x8e88('0x6')};function emitEvent(_0x5f200a){return function(_0x36de32,_0x64656e,_0x3947a0){OpenchannelMessageEvents[_0x8e88('0x7')](_0x5f200a+':'+_0x36de32['id'],_0x36de32);OpenchannelMessageEvents['emit'](_0x5f200a,_0x36de32);_0x3947a0(null);};}for(var e in events){if(events[_0x8e88('0x8')](e)){var event=events[e];OpenchannelMessage[_0x8e88('0x9')](e,emitEvent(event));}}module[_0x8e88('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8ba2=['save','remove','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x30ccf6,_0xa32e16){var _0x3ded66=function(_0x58e12d){while(--_0x58e12d){_0x30ccf6['push'](_0x30ccf6['shift']());}};_0x3ded66(++_0xa32e16);}(_0x8ba2,0xac));var _0x28ba=function(_0x4a3b5f,_0x2bb9e4){_0x4a3b5f=_0x4a3b5f-0x0;var _0x257228=_0x8ba2[_0x4a3b5f];return _0x257228;};'use strict';var EventEmitter=require(_0x28ba('0x0'));var OpenchannelMessage=require(_0x28ba('0x1'))['db'][_0x28ba('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x28ba('0x3')](0x0);var events={'afterCreate':_0x28ba('0x4'),'afterUpdate':'update','afterDestroy':_0x28ba('0x5')};function emitEvent(_0x299ff3){return function(_0x18026c,_0x5519d,_0x5e69da){OpenchannelMessageEvents['emit'](_0x299ff3+':'+_0x18026c['id'],_0x18026c);OpenchannelMessageEvents[_0x28ba('0x6')](_0x299ff3,_0x18026c);_0x5e69da(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x28ba('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index dbb4a2e..5f3dd48 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 _0x394e=['info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','Contact','method','POST'];(function(_0x1f553d,_0x24100a){var _0x4fa347=function(_0x3a7bb7){while(--_0x3a7bb7){_0x1f553d['push'](_0x1f553d['shift']());}};_0x4fa347(++_0x24100a);}(_0x394e,0x18f));var _0xe394=function(_0x2aa639,_0x1f0504){_0x2aa639=_0x2aa639-0x0;var _0x489951=_0x394e[_0x2aa639];return _0x489951;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var logger=require(_0xe394('0x2'))(_0xe394('0x3'));var moment=require(_0xe394('0x4'));var BPromise=require(_0xe394('0x5'));var rp=require(_0xe394('0x6'));var fs=require('fs');var path=require(_0xe394('0x7'));var rimraf=require(_0xe394('0x8'));var config=require(_0xe394('0x9'));var attributes=require(_0xe394('0xa'));module['exports']=function(_0x4656f0,_0x5061a9){return _0x4656f0['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe394('0xb'),'fields':[_0xe394('0xc')],'type':_0xe394('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5468a0,_0x49c326,_0x3e79ca){var _0x587531=_0x4656f0[_0xe394('0xe')];var _0x3fe3d6=_0x5468a0[_0xe394('0xf')]({'plain':!![]});if(_0x3fe3d6[_0xe394('0x10')][_0xe394('0x11')]()==='in'||_0x3fe3d6[_0xe394('0x10')][_0xe394('0x11')]()===_0xe394('0x12')&&!_0x3fe3d6['secret']&&!_['isNil'](_0x3fe3d6[_0xe394('0x13')])){_0x587531[_0xe394('0x14')]['findOne']({'where':{'id':_0x3fe3d6[_0xe394('0x15')]}})[_0xe394('0x16')](function(_0xa80bbf){if(_0xa80bbf){_0xa80bbf['update']({'lastMsgAt':_0x3fe3d6[_0xe394('0x17')],'lastMsgDirection':_0x3fe3d6['direction'][_0xe394('0x11')]()});}})[_0xe394('0x18')](function(_0x293482){console[_0xe394('0x19')](_0x293482);});}if(_0x3fe3d6['direction']===_0xe394('0x12')&&!_0x3fe3d6[_0xe394('0x1a')]){var _0x100a02;_0x587531[_0xe394('0x1b')][_0xe394('0x1c')]()[_0xe394('0x16')](function(_0x269bfe){return _0x587531[_0xe394('0x1d')]['find']({'where':{'id':_0x3fe3d6[_0xe394('0x1e')]},'include':[{'model':_0x587531[_0xe394('0x14')],'as':_0xe394('0x1f'),'where':{'id':_0x3fe3d6[_0xe394('0x15')]},'limit':0x1,'include':[{'model':_0x587531[_0xe394('0x1b')],'as':'Contact','attributes':_[_0xe394('0x20')](_0x269bfe)}]}]});})['then'](function(_0x5825d3){_0x100a02=_0x5825d3[_0xe394('0xf')]({'plain':!![]});if(_0x100a02&&_0x100a02[_0xe394('0x21')]){logger['info'](_0xe394('0x22'),'afterCreate',util[_0xe394('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x3fe3d6['id'],_0x100a02[_0xe394('0x21')]));if(_0x100a02[_0xe394('0x1f')]&&_0x100a02[_0xe394('0x1f')][_0xe394('0x24')]){_0x3fe3d6[_0xe394('0x25')]=_[_0xe394('0x26')](_0x100a02[_0xe394('0x1f')][0x0],'Contact');_0x3fe3d6[_0xe394('0x27')]=_0x100a02[_0xe394('0x1f')][0x0]['Contact'];}var _0x49c326={'method':'POST','uri':encodeURI(_0x100a02[_0xe394('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x49c326[_0xe394('0x28')]){case'GET':_0x49c326['qs']=_0x3fe3d6;break;case _0xe394('0x29'):_0x49c326[_0xe394('0xc')]=_0x3fe3d6;break;}return rp(_0x49c326)['then'](function(_0x12581b){logger[_0xe394('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0xe394('0x2b'),util['format'](_0xe394('0x2c'),_0x3fe3d6['id'],_0x100a02[_0xe394('0x21')]));if(_0x12581b[_0xe394('0xc')]['threadId']&&_0x12581b[_0xe394('0xc')][_0xe394('0x2d')]!=_0x3fe3d6[_0xe394('0x25')][_0xe394('0x2d')]){return _0x587531[_0xe394('0x14')]['update']({'threadId':_0x12581b[_0xe394('0xc')]['threadId']},{'where':{'id':_0x3fe3d6[_0xe394('0x25')]['id']}});}else{return;}})[_0xe394('0x16')](function(){return _0x5468a0['update']({'read':!![]});})[_0xe394('0x18')](function(_0x43fefa){logger[_0xe394('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0xe394('0x2b'),util[_0xe394('0x2e')](_0x43fefa,{'showHidden':![],'depth':null}));_0x3e79ca();});}else{_0x3e79ca();}})[_0xe394('0x2f')](function(){_0x3e79ca();});}else{_0x3e79ca();}}},'charset':_0xe394('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3bcb=['update','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction'];(function(_0x15fd13,_0x46d10f){var _0x48a2ea=function(_0x367be1){while(--_0x367be1){_0x15fd13['push'](_0x15fd13['shift']());}};_0x48a2ea(++_0x46d10f);}(_0x3bcb,0xc7));var _0xb3bc=function(_0x2a4c80,_0x3280b9){_0x2a4c80=_0x2a4c80-0x0;var _0x3b781d=_0x3bcb[_0x2a4c80];return _0x3b781d;};'use strict';var _=require(_0xb3bc('0x0'));var util=require(_0xb3bc('0x1'));var logger=require(_0xb3bc('0x2'))('api');var moment=require(_0xb3bc('0x3'));var BPromise=require(_0xb3bc('0x4'));var rp=require(_0xb3bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3bc('0x6'));var config=require(_0xb3bc('0x7'));var attributes=require(_0xb3bc('0x8'));module['exports']=function(_0x4af6b8,_0x745c58){return _0x4af6b8['define'](_0xb3bc('0x9'),attributes,{'tableName':_0xb3bc('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xb3bc('0xb')],'type':_0xb3bc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e0094,_0x132736,_0x238597){var _0x59f867=_0x4af6b8[_0xb3bc('0xd')];var _0x52f224=_0x4e0094['get']({'plain':!![]});if(_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()==='in'||_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()===_0xb3bc('0x10')&&!_0x52f224['secret']&&!_['isNil'](_0x52f224[_0xb3bc('0x11')])){_0x59f867[_0xb3bc('0x12')][_0xb3bc('0x13')]({'where':{'id':_0x52f224['OpenchannelInteractionId']}})[_0xb3bc('0x14')](function(_0xbca52c){if(_0xbca52c){_0xbca52c['update']({'lastMsgAt':_0x52f224[_0xb3bc('0x15')],'lastMsgDirection':_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()});}})[_0xb3bc('0x16')](function(_0x39755c){console[_0xb3bc('0x17')](_0x39755c);});}if(_0x52f224[_0xb3bc('0xe')]===_0xb3bc('0x10')&&!_0x52f224['secret']){var _0x133ac6;_0x59f867[_0xb3bc('0x18')]['describe']()[_0xb3bc('0x14')](function(_0x1df3ff){return _0x59f867[_0xb3bc('0x19')][_0xb3bc('0x1a')]({'where':{'id':_0x52f224[_0xb3bc('0x1b')]},'include':[{'model':_0x59f867[_0xb3bc('0x12')],'as':_0xb3bc('0x1c'),'where':{'id':_0x52f224[_0xb3bc('0x1d')]},'limit':0x1,'include':[{'model':_0x59f867[_0xb3bc('0x18')],'as':_0xb3bc('0x1e'),'attributes':_[_0xb3bc('0x1f')](_0x1df3ff)}]}]});})[_0xb3bc('0x14')](function(_0x47c34b){_0x133ac6=_0x47c34b[_0xb3bc('0x20')]({'plain':!![]});if(_0x133ac6&&_0x133ac6[_0xb3bc('0x21')]){logger[_0xb3bc('0x22')](_0xb3bc('0x23'),_0xb3bc('0x24'),util[_0xb3bc('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x52f224['id'],_0x133ac6[_0xb3bc('0x21')]));if(_0x133ac6['Interactions']&&_0x133ac6[_0xb3bc('0x1c')][_0xb3bc('0x26')]){_0x52f224['Interaction']=_[_0xb3bc('0x27')](_0x133ac6[_0xb3bc('0x1c')][0x0],'Contact');_0x52f224[_0xb3bc('0x1e')]=_0x133ac6[_0xb3bc('0x1c')][0x0][_0xb3bc('0x1e')];}var _0x132736={'method':_0xb3bc('0x28'),'uri':encodeURI(_0x133ac6[_0xb3bc('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x132736[_0xb3bc('0x29')]){case _0xb3bc('0x2a'):_0x132736['qs']=_0x52f224;break;case _0xb3bc('0x28'):_0x132736[_0xb3bc('0xb')]=_0x52f224;break;}return rp(_0x132736)[_0xb3bc('0x14')](function(_0x5101e3){logger['info'](_0xb3bc('0x23'),'afterCreate',util['format'](_0xb3bc('0x2b'),_0x52f224['id'],_0x133ac6[_0xb3bc('0x21')]));if(_0x5101e3[_0xb3bc('0xb')][_0xb3bc('0x2c')]&&_0x5101e3['body'][_0xb3bc('0x2c')]!=_0x52f224[_0xb3bc('0x2d')]['threadId']){return _0x59f867[_0xb3bc('0x12')]['update']({'threadId':_0x5101e3['body'][_0xb3bc('0x2c')]},{'where':{'id':_0x52f224[_0xb3bc('0x2d')]['id']}});}else{return;}})[_0xb3bc('0x14')](function(){return _0x4e0094[_0xb3bc('0x2e')]({'read':!![]});})[_0xb3bc('0x16')](function(_0x4c889c){logger['error'](_0xb3bc('0x23'),_0xb3bc('0x24'),util[_0xb3bc('0x2f')](_0x4c889c,{'showHidden':![],'depth':null}));_0x238597();});}else{_0x238597();}})['finally'](function(){_0x238597();});}else{_0x238597();}}},'charset':'utf8mb4','collate':_0xb3bc('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4eb0635..48a6169 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(_0x2a68f4,_0x10cafd){var _0x2627c1=function(_0x3a85c5){while(--_0x3a85c5){_0x2a68f4['push'](_0x2a68f4['shift']());}};_0x2627c1(++_0x10cafd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17c5f6,_0x4f3fd6){_0x17c5f6=_0x17c5f6-0x0;var _0x13aaa9=_0x5f2f[_0x17c5f6];return _0x13aaa9;};'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(_0x3a73be,_0x31d42e){var _0x4c2683=function(_0x47e79c){while(--_0x47e79c){_0x3a73be['push'](_0x3a73be['shift']());}};_0x4c2683(++_0x31d42e);}(_0x2ef3,0xba));var _0x32ef=function(_0x58bf9f,_0x2874c8){_0x58bf9f=_0x58bf9f-0x0;var _0x46fd11=_0x2ef3[_0x58bf9f];return _0x46fd11;};'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 981725b..e6872a7 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 _0x3658=['length','./openchannelMessage.events','remove','update','removeListener','register'];(function(_0x239a99,_0x2eea66){var _0x5e65dc=function(_0x2f16ff){while(--_0x2f16ff){_0x239a99['push'](_0x239a99['shift']());}};_0x5e65dc(++_0x2eea66);}(_0x3658,0x133));var _0x8365=function(_0x5b420e,_0x55036c){_0x5b420e=_0x5b420e-0x0;var _0x1e3620=_0x3658[_0x5b420e];return _0x1e3620;};'use strict';var OpenchannelMessageEvents=require(_0x8365('0x0'));var events=['save',_0x8365('0x1'),_0x8365('0x2')];function createListener(_0x2c7bc6,_0x2c9dd4){return function(_0x33248d){_0x2c9dd4['emit'](_0x2c7bc6,_0x33248d);};}function removeListener(_0x8235bf,_0x180491){return function(){OpenchannelMessageEvents[_0x8365('0x3')](_0x8235bf,_0x180491);};}exports[_0x8365('0x4')]=function(_0x26f5ba){for(var _0xab4632=0x0,_0x26b59a=events[_0x8365('0x5')];_0xab4632<_0x26b59a;_0xab4632++){var _0x4de325=events[_0xab4632];var _0x30d132=createListener('openchannelMessage:'+_0x4de325,_0x26f5ba);OpenchannelMessageEvents['on'](_0x4de325,_0x30d132);}}; \ No newline at end of file +var _0x9208=['update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x532e50,_0x593264){var _0x3c2a6c=function(_0x467557){while(--_0x467557){_0x532e50['push'](_0x532e50['shift']());}};_0x3c2a6c(++_0x593264);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelMessageEvents=require(_0x8920('0x0'));var events=[_0x8920('0x1'),'remove',_0x8920('0x2')];function createListener(_0x4efd40,_0x5b3c92){return function(_0x338547){_0x5b3c92[_0x8920('0x3')](_0x4efd40,_0x338547);};}function removeListener(_0x14ee6c,_0x3b2573){return function(){OpenchannelMessageEvents['removeListener'](_0x14ee6c,_0x3b2573);};}exports[_0x8920('0x4')]=function(_0x126772){for(var _0x194026=0x0,_0x54eb58=events[_0x8920('0x5')];_0x194026<_0x54eb58;_0x194026++){var _0x185860=events[_0x194026];var _0x24f425=createListener(_0x8920('0x6')+_0x185860,_0x126772);OpenchannelMessageEvents['on'](_0x185860,_0x24f425);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 469cdfe..ed8788b 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 _0x4ad4=['describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe'];(function(_0x2e1948,_0x4c6937){var _0x494586=function(_0x55dd93){while(--_0x55dd93){_0x2e1948['push'](_0x2e1948['shift']());}};_0x494586(++_0x4c6937);}(_0x4ad4,0x1d0));var _0x44ad=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x4ad4[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x44ad('0x0'));var util=require(_0x44ad('0x1'));var path=require(_0x44ad('0x2'));var timeout=require(_0x44ad('0x3'));var express=require(_0x44ad('0x4'));var router=express[_0x44ad('0x5')]();var fs_extra=require(_0x44ad('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x44ad('0x7'));var controller=require(_0x44ad('0x8'));router[_0x44ad('0x9')]('/',auth[_0x44ad('0xa')](),controller['index']);router[_0x44ad('0x9')](_0x44ad('0xb'),auth[_0x44ad('0xa')](),controller[_0x44ad('0xc')]);router['get'](_0x44ad('0xd'),auth[_0x44ad('0xa')](),controller[_0x44ad('0xe')]);router[_0x44ad('0x9')](_0x44ad('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x44ad('0x9')](_0x44ad('0x10'),auth['isAuthenticated'](),controller[_0x44ad('0x11')]);router[_0x44ad('0x9')]('/:id/users',auth[_0x44ad('0xa')](),controller[_0x44ad('0x12')]);router[_0x44ad('0x13')]('/',auth[_0x44ad('0xa')](),controller['create']);router[_0x44ad('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x44ad('0x14')]);router['post'](_0x44ad('0x15'),auth[_0x44ad('0xa')](),controller['addAgents']);router['put'](_0x44ad('0xd'),auth[_0x44ad('0xa')](),controller[_0x44ad('0x16')]);router['delete'](_0x44ad('0xd'),auth[_0x44ad('0xa')](),controller[_0x44ad('0x17')]);router[_0x44ad('0x18')](_0x44ad('0x10'),auth[_0x44ad('0xa')](),controller[_0x44ad('0x19')]);router[_0x44ad('0x18')]('/:id/users',auth[_0x44ad('0xa')](),controller[_0x44ad('0x1a')]);module[_0x44ad('0x1b')]=router; \ No newline at end of file +var _0xfdd6=['addAgents','/:id','delete','destroy','removeTeams','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x74445f,_0xcb007c){var _0x4d4ff3=function(_0x4e92df){while(--_0x4e92df){_0x74445f['push'](_0x74445f['shift']());}};_0x4d4ff3(++_0xcb007c);}(_0xfdd6,0x6d));var _0x6fdd=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xfdd6[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x6fdd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6fdd('0x1'));var express=require(_0x6fdd('0x2'));var router=express[_0x6fdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6fdd('0x4'));var interaction=require(_0x6fdd('0x5'));var config=require(_0x6fdd('0x6'));var controller=require('./openchannelQueue.controller');router[_0x6fdd('0x7')]('/',auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x9')]);router['get'](_0x6fdd('0xa'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xb')]);router[_0x6fdd('0x7')]('/:id',auth[_0x6fdd('0x8')](),controller['show']);router['get'](_0x6fdd('0xc'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xd')]);router[_0x6fdd('0x7')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xf')]);router[_0x6fdd('0x7')](_0x6fdd('0x10'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x11')]);router[_0x6fdd('0x12')]('/',auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x13')]);router[_0x6fdd('0x12')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x14')]);router[_0x6fdd('0x12')](_0x6fdd('0x10'),auth['isAuthenticated'](),controller[_0x6fdd('0x15')]);router['put'](_0x6fdd('0x16'),auth[_0x6fdd('0x8')](),controller['update']);router[_0x6fdd('0x17')](_0x6fdd('0x16'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x18')]);router[_0x6fdd('0x17')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x19')]);router[_0x6fdd('0x17')]('/:id/users',auth[_0x6fdd('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c38cb8f..5683166 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 _0x2449=['STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x41bf1c,_0x8b1a9e){var _0x2c92ec=function(_0x46ccac){while(--_0x46ccac){_0x41bf1c['push'](_0x41bf1c['shift']());}};_0x2c92ec(++_0x8b1a9e);}(_0x2449,0x19d));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9244('0x0')]={'name':{'type':Sequelize[_0x9244('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9244('0x1')]},'timeout':{'type':Sequelize[_0x9244('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9244('0x3'),_0x9244('0x4'),_0x9244('0x5'))}}; \ No newline at end of file +var _0xac16=['ENUM','rrmemory','beepall','exports','STRING','INTEGER'];(function(_0x114da0,_0x19188f){var _0x5f1d8a=function(_0x154c3d){while(--_0x154c3d){_0x114da0['push'](_0x114da0['shift']());}};_0x5f1d8a(++_0x19188f);}(_0xac16,0xff));var _0x6ac1=function(_0x2b2405,_0x4860d9){_0x2b2405=_0x2b2405-0x0;var _0x3e69ac=_0xac16[_0x2b2405];return _0x3e69ac;};'use strict';var Sequelize=require('sequelize');module[_0x6ac1('0x0')]={'name':{'type':Sequelize[_0x6ac1('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6ac1('0x1')]},'timeout':{'type':Sequelize[_0x6ac1('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ac1('0x3')](_0x6ac1('0x4'),_0x6ac1('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index eee8d82..4fdb5e6 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 _0x6c6f=['count','set','Content-Range','apply','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','rawAttributes','nolimit','UserOpenchannelQueue','UserId','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','User','select','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','value','removeTeams','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','pick','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6c6f,0x17e));var _0xf6c6=function(_0x393c19,_0x982666){_0x393c19=_0x393c19-0x0;var _0x2ce688=_0x6c6f[_0x393c19];return _0x2ce688;};'use strict';var emlformat=require(_0xf6c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6c6('0x2'));var moment=require('moment');var BPromise=require(_0xf6c6('0x3'));var Mustache=require(_0xf6c6('0x4'));var util=require(_0xf6c6('0x5'));var path=require(_0xf6c6('0x6'));var sox=require(_0xf6c6('0x7'));var csv=require(_0xf6c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6c6('0x9'));var squel=require('squel');var crypto=require(_0xf6c6('0xa'));var jsforce=require(_0xf6c6('0xb'));var deskjs=require(_0xf6c6('0xc'));var toCsv=require(_0xf6c6('0x8'));var querystring=require(_0xf6c6('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6c6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf6c6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6c6('0x10'));var logger=require('../../config/logger')(_0xf6c6('0x11'));var utils=require(_0xf6c6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf6c6('0x13'));var db=require(_0xf6c6('0x14'))['db'];config[_0xf6c6('0x15')]=_[_0xf6c6('0x16')](config[_0xf6c6('0x15')],{'host':_0xf6c6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6c6('0x15')]));require('./openchannelQueue.socket')[_0xf6c6('0x18')](socket);function respondWithStatusCode(_0x3838ab,_0x5ddb65){_0x5ddb65=_0x5ddb65||0xcc;return function(_0x10c0b4){if(_0x10c0b4){return _0x3838ab[_0xf6c6('0x19')](_0x5ddb65);}return _0x3838ab['status'](_0x5ddb65)[_0xf6c6('0x1a')]();};}function respondWithResult(_0x46436d,_0x2b7a79){_0x2b7a79=_0x2b7a79||0xc8;return function(_0x50ac61){if(_0x50ac61){return _0x46436d[_0xf6c6('0x1b')](_0x2b7a79)[_0xf6c6('0x1c')](_0x50ac61);}};}function respondWithFilteredResult(_0x39ee18,_0x5c0663){return function(_0x19c585){if(_0x19c585){var _0xa0b4e1=typeof _0x5c0663[_0xf6c6('0x1d')]===_0xf6c6('0x1e')&&typeof _0x5c0663[_0xf6c6('0x1f')]===_0xf6c6('0x1e');var _0x4da118=_0x19c585[_0xf6c6('0x20')];var _0x5e25b0=_0xa0b4e1?0x0:_0x5c0663['offset'];var _0x54b34f=_0xa0b4e1?_0x19c585['count']:_0x5c0663['offset']+_0x5c0663[_0xf6c6('0x1f')];var _0x5e2872;if(_0x54b34f>=_0x4da118){_0x54b34f=_0x4da118;_0x5e2872=0xc8;}else{_0x5e2872=0xce;}_0x39ee18[_0xf6c6('0x1b')](_0x5e2872);return _0x39ee18[_0xf6c6('0x21')](_0xf6c6('0x22'),_0x5e25b0+'-'+_0x54b34f+'/'+_0x4da118)[_0xf6c6('0x1c')](_0x19c585);}return null;};}function patchUpdates(_0x5720c6){return function(_0x29f5e7){try{jsonpatch[_0xf6c6('0x23')](_0x29f5e7,_0x5720c6,!![]);}catch(_0x572eb7){return BPromise[_0xf6c6('0x24')](_0x572eb7);}return _0x29f5e7['save']();};}function saveUpdates(_0x58b4c5,_0x31a416){return function(_0x7bd3d8){if(_0x7bd3d8){return _0x7bd3d8[_0xf6c6('0x25')](_0x58b4c5)[_0xf6c6('0x26')](function(_0x6b78ff){return _0x6b78ff;});}return null;};}function removeEntity(_0x30898d,_0x3f339f){return function(_0x5d9ef6){if(_0x5d9ef6){return _0x5d9ef6[_0xf6c6('0x27')]()[_0xf6c6('0x26')](function(){var _0x33f73d=_0x5d9ef6[_0xf6c6('0x28')]({'plain':!![]});var _0x40f7f6=_0xf6c6('0x29');return db[_0xf6c6('0x2a')][_0xf6c6('0x27')]({'where':{'type':_0x40f7f6,'resourceId':_0x33f73d['id']}})[_0xf6c6('0x26')](function(){return _0x5d9ef6;});})[_0xf6c6('0x26')](function(){_0x30898d['status'](0xcc)[_0xf6c6('0x1a')]();});}};}function handleEntityNotFound(_0x580f65,_0x4db049){return function(_0x892da9){if(!_0x892da9){_0x580f65[_0xf6c6('0x19')](0x194);}return _0x892da9;};}function handleError(_0x9e8aae,_0x49a680){_0x49a680=_0x49a680||0x1f4;return function(_0x46b47e){logger[_0xf6c6('0x2b')](_0x46b47e[_0xf6c6('0x2c')]);if(_0x46b47e[_0xf6c6('0x2d')]){delete _0x46b47e['name'];}_0x9e8aae[_0xf6c6('0x1b')](_0x49a680)[_0xf6c6('0x2e')](_0x46b47e);};}exports[_0xf6c6('0x2f')]=function(_0x11a9d7,_0x3f3685){var _0x46a4c3={},_0x4d1894={},_0x2f0d56={'count':0x0,'rows':[]};var _0x1915c2=_[_0xf6c6('0x30')](db[_0xf6c6('0x31')]['rawAttributes'],function(_0x70f8ba){return{'name':_0x70f8ba[_0xf6c6('0x32')],'type':_0x70f8ba[_0xf6c6('0x33')][_0xf6c6('0x34')]};});_0x4d1894[_0xf6c6('0x35')]=_[_0xf6c6('0x30')](_0x1915c2,_0xf6c6('0x2d'));_0x4d1894['query']=_[_0xf6c6('0x36')](_0x11a9d7[_0xf6c6('0x37')]);_0x4d1894['filters']=_[_0xf6c6('0x38')](_0x4d1894['model'],_0x4d1894[_0xf6c6('0x37')]);_0x46a4c3[_0xf6c6('0x39')]=_[_0xf6c6('0x38')](_0x4d1894[_0xf6c6('0x35')],qs[_0xf6c6('0x3a')](_0x11a9d7['query']['fields']));_0x46a4c3[_0xf6c6('0x39')]=_0x46a4c3[_0xf6c6('0x39')][_0xf6c6('0x3b')]?_0x46a4c3[_0xf6c6('0x39')]:_0x4d1894[_0xf6c6('0x35')];if(!_0x11a9d7[_0xf6c6('0x37')][_0xf6c6('0x3c')]('nolimit')){_0x46a4c3['limit']=qs[_0xf6c6('0x1f')](_0x11a9d7[_0xf6c6('0x37')]['limit']);_0x46a4c3['offset']=qs[_0xf6c6('0x1d')](_0x11a9d7['query'][_0xf6c6('0x1d')]);}_0x46a4c3[_0xf6c6('0x3d')]=qs[_0xf6c6('0x3e')](_0x11a9d7[_0xf6c6('0x37')][_0xf6c6('0x3e')]);_0x46a4c3[_0xf6c6('0x3f')]=qs[_0xf6c6('0x40')](_['pick'](_0x11a9d7[_0xf6c6('0x37')],_0x4d1894['filters']),_0x1915c2);if(_0x11a9d7[_0xf6c6('0x37')][_0xf6c6('0x41')]){_0x46a4c3[_0xf6c6('0x3f')]=_['merge'](_0x46a4c3[_0xf6c6('0x3f')],{'$or':_[_0xf6c6('0x30')](_0x1915c2,function(_0x13ae0b){if(_0x13ae0b[_0xf6c6('0x33')]!==_0xf6c6('0x42')){var _0x4c51a8={};_0x4c51a8[_0x13ae0b[_0xf6c6('0x2d')]]={'$like':'%'+_0x11a9d7['query'][_0xf6c6('0x41')]+'%'};return _0x4c51a8;}})});}_0x46a4c3=_[_0xf6c6('0x43')]({},_0x46a4c3,_0x11a9d7[_0xf6c6('0x44')]);var _0x1264c0={'where':_0x46a4c3[_0xf6c6('0x3f')]};return db[_0xf6c6('0x31')][_0xf6c6('0x20')](_0x1264c0)[_0xf6c6('0x26')](function(_0x3f99fb){_0x2f0d56[_0xf6c6('0x20')]=_0x3f99fb;if(_0x11a9d7[_0xf6c6('0x37')]['includeAll']){_0x46a4c3[_0xf6c6('0x45')]=[{'all':!![]}];}return db[_0xf6c6('0x31')][_0xf6c6('0x46')](_0x46a4c3);})[_0xf6c6('0x26')](function(_0x29c985){_0x2f0d56[_0xf6c6('0x47')]=_0x29c985;return _0x2f0d56;})[_0xf6c6('0x26')](respondWithFilteredResult(_0x3f3685,_0x46a4c3))[_0xf6c6('0x48')](handleError(_0x3f3685,null));};exports[_0xf6c6('0x49')]=function(_0xcdc38,_0x2da760){var _0x2e6822={'raw':!![],'where':{'id':_0xcdc38['params']['id']}},_0x514a9a={};_0x514a9a[_0xf6c6('0x35')]=_['keys'](db[_0xf6c6('0x31')]['rawAttributes']);_0x514a9a[_0xf6c6('0x37')]=_[_0xf6c6('0x36')](_0xcdc38[_0xf6c6('0x37')]);_0x514a9a[_0xf6c6('0x40')]=_[_0xf6c6('0x38')](_0x514a9a[_0xf6c6('0x35')],_0x514a9a['query']);_0x2e6822[_0xf6c6('0x39')]=_['intersection'](_0x514a9a[_0xf6c6('0x35')],qs[_0xf6c6('0x3a')](_0xcdc38[_0xf6c6('0x37')][_0xf6c6('0x3a')]));_0x2e6822[_0xf6c6('0x39')]=_0x2e6822[_0xf6c6('0x39')]['length']?_0x2e6822['attributes']:_0x514a9a['model'];if(_0xcdc38[_0xf6c6('0x37')]['includeAll']){_0x2e6822[_0xf6c6('0x45')]=[{'all':!![]}];}_0x2e6822=_[_0xf6c6('0x43')]({},_0x2e6822,_0xcdc38[_0xf6c6('0x44')]);return db[_0xf6c6('0x31')]['find'](_0x2e6822)[_0xf6c6('0x26')](handleEntityNotFound(_0x2da760,null))[_0xf6c6('0x26')](respondWithResult(_0x2da760,null))[_0xf6c6('0x48')](handleError(_0x2da760,null));};exports[_0xf6c6('0x4a')]=function(_0xa852bd,_0x3876b4){return db['OpenchannelQueue'][_0xf6c6('0x4a')](_0xa852bd['body'],{})[_0xf6c6('0x26')](function(_0x54c363){var _0x302b50=_0xa852bd[_0xf6c6('0x4b')][_0xf6c6('0x28')]({'plain':!![]});if(!_0x302b50)throw new Error(_0xf6c6('0x4c'));if(_0x302b50[_0xf6c6('0x4d')]==='user'){var _0x89e64=_0x54c363[_0xf6c6('0x28')]({'plain':!![]});var _0x4ddc60=_0xf6c6('0x29');return db[_0xf6c6('0x4e')][_0xf6c6('0x4f')]({'where':{'name':_0x4ddc60,'userProfileId':_0x302b50[_0xf6c6('0x50')]},'raw':!![]})['then'](function(_0x584a26){if(_0x584a26&&_0x584a26[_0xf6c6('0x51')]===0x0){return db[_0xf6c6('0x2a')][_0xf6c6('0x4a')]({'name':_0x89e64[_0xf6c6('0x2d')],'resourceId':_0x89e64['id'],'type':_0x584a26[_0xf6c6('0x2d')],'sectionId':_0x584a26['id']},{})[_0xf6c6('0x26')](function(){return _0x54c363;});}else{return _0x54c363;}})[_0xf6c6('0x48')](function(_0x47fefc){logger['error'](_0xf6c6('0x52'),_0x47fefc);throw _0x47fefc;});}return _0x54c363;})['then'](respondWithResult(_0x3876b4,0xc9))['catch'](handleError(_0x3876b4,null));};exports[_0xf6c6('0x25')]=function(_0x2e47da,_0x493fb8){if(_0x2e47da['body']['id']){delete _0x2e47da[_0xf6c6('0x53')]['id'];}return db[_0xf6c6('0x31')]['find']({'where':{'id':_0x2e47da[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x493fb8,null))[_0xf6c6('0x26')](saveUpdates(_0x2e47da[_0xf6c6('0x53')],null))['then'](respondWithResult(_0x493fb8,null))[_0xf6c6('0x48')](handleError(_0x493fb8,null));};exports[_0xf6c6('0x27')]=function(_0x5b85f6,_0x316d12){return db[_0xf6c6('0x31')][_0xf6c6('0x4f')]({'where':{'id':_0x5b85f6['params']['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x316d12,null))[_0xf6c6('0x26')](removeEntity(_0x316d12,null))['catch'](handleError(_0x316d12,null));};exports[_0xf6c6('0x55')]=function(_0x2bbc33,_0x2e17e5){return db[_0xf6c6('0x31')][_0xf6c6('0x55')]()[_0xf6c6('0x26')](respondWithResult(_0x2e17e5,null))[_0xf6c6('0x48')](handleError(_0x2e17e5,null));};exports[_0xf6c6('0x56')]=function(_0x48ed3e,_0x3f0464,_0x294cdb){var _0x36fba0={'raw':!![],'where':{}},_0x21b757={},_0x26938b;return db[_0xf6c6('0x31')]['findOne']({'where':{'id':_0x48ed3e[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x3f0464,null))[_0xf6c6('0x26')](function(_0x14667b){if(_0x14667b){_0x26938b=_0x14667b['get']({'plain':!![]});_0x21b757['model']=_[_0xf6c6('0x36')](db['UserOpenchannelQueue'][_0xf6c6('0x57')]);_0x21b757['query']=_['keys'](_0x48ed3e[_0xf6c6('0x37')]);_0x21b757[_0xf6c6('0x40')]=_['intersection'](_0x21b757[_0xf6c6('0x35')],_0x21b757['query']);_0x36fba0[_0xf6c6('0x39')]=_[_0xf6c6('0x38')](_0x21b757[_0xf6c6('0x35')],qs[_0xf6c6('0x3a')](_0x48ed3e[_0xf6c6('0x37')]['fields']));_0x36fba0[_0xf6c6('0x39')]=_0x36fba0[_0xf6c6('0x39')][_0xf6c6('0x3b')]?_0x36fba0[_0xf6c6('0x39')]:_0x21b757[_0xf6c6('0x35')];if(!_0x48ed3e[_0xf6c6('0x37')]['hasOwnProperty'](_0xf6c6('0x58'))){_0x36fba0[_0xf6c6('0x1f')]=qs[_0xf6c6('0x1f')](_0x48ed3e[_0xf6c6('0x37')][_0xf6c6('0x1f')]);_0x36fba0['offset']=qs[_0xf6c6('0x1d')](_0x48ed3e[_0xf6c6('0x37')]['offset']);}_0x36fba0[_0xf6c6('0x3d')]=qs['sort'](_0x48ed3e[_0xf6c6('0x37')][_0xf6c6('0x3e')]);_0x36fba0[_0xf6c6('0x3f')]=qs['filters'](_['pick'](_0x48ed3e['query'],_0x21b757[_0xf6c6('0x40')]));_0x36fba0[_0xf6c6('0x3f')]['OpenchannelQueueId']=_0x14667b['id'];if(_0x48ed3e[_0xf6c6('0x37')][_0xf6c6('0x41')]){_0x36fba0['where']=_[_0xf6c6('0x43')](_0x36fba0[_0xf6c6('0x3f')],{'$or':_['map'](_0x36fba0[_0xf6c6('0x39')],function(_0x53a1b2){var _0x2c31cc={};_0x2c31cc[_0x53a1b2]={'$like':'%'+_0x48ed3e[_0xf6c6('0x37')][_0xf6c6('0x41')]+'%'};return _0x2c31cc;})});}_0x36fba0=_['merge']({},_0x36fba0,_0x48ed3e['options']);return db[_0xf6c6('0x59')]['findAll'](_0x36fba0);}})[_0xf6c6('0x26')](function(_0x479b89){if(_0x479b89){return db['User']['findAndCountAll']({'where':{'id':_[_0xf6c6('0x30')](_0x479b89,_0xf6c6('0x5a')),'role':'agent'},'attributes':['id',_0xf6c6('0x2d'),_0xf6c6('0x5b'),_0xf6c6('0x5c'),_0xf6c6('0x5d')]});}})[_0xf6c6('0x26')](function(_0x20e13a){if(_0x20e13a){return{'count':_0x20e13a['count'],'rows':_[_0xf6c6('0x30')](_0x20e13a['rows'],function(_0x3e3fea){return{'membername':_0x3e3fea[_0xf6c6('0x2d')],'UserId':_0x3e3fea['id'],'queue_name':_0x26938b[_0xf6c6('0x2d')],'OpenchannelQueueId':_0x26938b['id'],'interface':util['format'](_0xf6c6('0x5e'),_0xf6c6('0x5f'),_0x3e3fea['name']),'penalty':0x0,'paused':_0x3e3fea['openchannelPause'],'createdAt':_0x3e3fea['createdAt'],'updatedAt':_0x3e3fea[_0xf6c6('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf6c6('0x26')](respondWithFilteredResult(_0x3f0464,_0x36fba0))[_0xf6c6('0x48')](handleError(_0x3f0464,null));};exports[_0xf6c6('0x60')]=function(_0x36a87e,_0x2ff378,_0x247c81){var _0x7a35d2={};var _0xaf3da1={};var _0x566a95;var _0x4abcd0;return db[_0xf6c6('0x31')][_0xf6c6('0x61')]({'where':{'id':_0x36a87e[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x2ff378,null))[_0xf6c6('0x26')](function(_0x251135){if(_0x251135){_0x566a95=_0x251135;_0xaf3da1[_0xf6c6('0x35')]=_[_0xf6c6('0x36')](db['Team']['rawAttributes']);_0xaf3da1[_0xf6c6('0x37')]=_[_0xf6c6('0x36')](_0x36a87e[_0xf6c6('0x37')]);_0xaf3da1[_0xf6c6('0x40')]=_[_0xf6c6('0x38')](_0xaf3da1['model'],_0xaf3da1['query']);_0x7a35d2[_0xf6c6('0x39')]=_['intersection'](_0xaf3da1[_0xf6c6('0x35')],qs[_0xf6c6('0x3a')](_0x36a87e[_0xf6c6('0x37')][_0xf6c6('0x3a')]));_0x7a35d2[_0xf6c6('0x39')]=_0x7a35d2['attributes'][_0xf6c6('0x3b')]?_0x7a35d2[_0xf6c6('0x39')]:_0xaf3da1[_0xf6c6('0x35')];_0x7a35d2[_0xf6c6('0x3d')]=qs[_0xf6c6('0x3e')](_0x36a87e['query'][_0xf6c6('0x3e')]);_0x7a35d2['where']=qs[_0xf6c6('0x40')](_['pick'](_0x36a87e[_0xf6c6('0x37')],_0xaf3da1['filters']));if(_0x36a87e[_0xf6c6('0x37')][_0xf6c6('0x41')]){_0x7a35d2[_0xf6c6('0x3f')]=_['merge'](_0x7a35d2['where'],{'$or':_[_0xf6c6('0x30')](_0x7a35d2[_0xf6c6('0x39')],function(_0x5e13fc){var _0x3498a2={};_0x3498a2[_0x5e13fc]={'$like':'%'+_0x36a87e['query'][_0xf6c6('0x41')]+'%'};return _0x3498a2;})});}_0x7a35d2=_[_0xf6c6('0x43')]({},_0x7a35d2,_0x36a87e[_0xf6c6('0x44')]);return _0x566a95[_0xf6c6('0x60')](_0x7a35d2);}})[_0xf6c6('0x26')](function(_0x4e9fe2){if(_0x4e9fe2){_0x4abcd0=_0x4e9fe2[_0xf6c6('0x3b')];if(!_0x36a87e[_0xf6c6('0x37')][_0xf6c6('0x3c')](_0xf6c6('0x58'))){_0x7a35d2[_0xf6c6('0x1f')]=qs['limit'](_0x36a87e[_0xf6c6('0x37')][_0xf6c6('0x1f')]);_0x7a35d2[_0xf6c6('0x1d')]=qs[_0xf6c6('0x1d')](_0x36a87e['query'][_0xf6c6('0x1d')]);}return _0x566a95['getTeams'](_0x7a35d2);}})[_0xf6c6('0x26')](function(_0x4217e6){if(_0x4217e6){return _0x4217e6?{'count':_0x4abcd0,'rows':_0x4217e6}:null;}})[_0xf6c6('0x26')](respondWithResult(_0x2ff378,null))[_0xf6c6('0x48')](handleError(_0x2ff378,null));};exports[_0xf6c6('0x62')]=function(_0x1132cb,_0x4e63da,_0x1ef1df){var _0x162287=_0x1132cb[_0xf6c6('0x53')]['ids'];return db[_0xf6c6('0x63')][_0xf6c6('0x46')]({'where':{'id':_0x162287},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf6c6('0x64'),'attributes':['id',_0xf6c6('0x2d'),_0xf6c6('0x65'),_0xf6c6('0x66'),_0xf6c6('0x67')],'raw':!![]}]})['then'](function(_0x498e4f){if(_0x498e4f){var _0x163d92=_[_0xf6c6('0x68')](_0x498e4f,function(_0x25d8c3){var _0x4a5859=_0x25d8c3['get']({'plain':!![]});return _0x4a5859[_0xf6c6('0x64')];});return db['OpenchannelQueue'][_0xf6c6('0x4f')]({'where':{'id':_0x1132cb[_0xf6c6('0x54')]['id']}})['then'](function(_0x273109){return db[_0xf6c6('0x69')][_0xf6c6('0x6a')](function(_0x17dbd1){return _0x273109['addTeams'](_0x162287,{'transaction':_0x17dbd1})[_0xf6c6('0x26')](function(){return BPromise['each'](_0x163d92,function(_0x83ba74){return db[_0xf6c6('0x59')][_0xf6c6('0x6b')]({'where':{'UserId':_0x83ba74['id'],'OpenchannelQueueId':_0x1132cb[_0xf6c6('0x54')]['id']},'transaction':_0x17dbd1});});})[_0xf6c6('0x26')](function(){_0x163d92[_0xf6c6('0x6c')](function(_0x526fea){socket[_0xf6c6('0x6d')](_0xf6c6('0x6e'),{'UserId':_0x526fea['id'],'OpenchannelQueueId':_0x273109['id']});});});});});}})[_0xf6c6('0x26')](respondWithStatusCode(_0x4e63da,null))[_0xf6c6('0x48')](handleError(_0x4e63da,null));};exports['removeTeams']=function(_0x40b765,_0x51703b,_0x59d714){return db[_0xf6c6('0x63')][_0xf6c6('0x46')]({'where':{'id':_0x40b765['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf6c6('0x6f')],'as':_0xf6c6('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51703b,null))['then'](function(_0x6b49af){var _0x56c76b=_[_0xf6c6('0x30')](_0x6b49af,'id');var _0x250d97=[];var _0x4a4c9c=[];var _0x10b305=squel[_0xf6c6('0x70')]();_0x10b305['field']('tq.TeamId')[_0xf6c6('0x71')](_0xf6c6('0x72'),'tq')[_0xf6c6('0x73')]('user_has_teams','ut',_0xf6c6('0x74'))['where'](_0xf6c6('0x75'),_0x40b765[_0xf6c6('0x54')]['id']);for(var _0x489eca=0x0;_0x489eca<_0x6b49af[_0xf6c6('0x3b')];_0x489eca+=0x1){let _0x142ac8=_0x6b49af[_0x489eca];for(var _0x187222=0x0;_0x187222<_0x142ac8[_0xf6c6('0x64')][_0xf6c6('0x3b')];_0x187222+=0x1){let _0x3c3f07=_0x142ac8['Agents'][_0x187222];var _0x3f727c=_0x10b305[_0xf6c6('0x76')]();_0x3f727c[_0xf6c6('0x3f')](_0xf6c6('0x77'),_0x3c3f07['id']);_0x4a4c9c['push'](db[_0xf6c6('0x69')][_0xf6c6('0x37')](_0x3f727c[_0xf6c6('0x78')](),{'type':db[_0xf6c6('0x69')][_0xf6c6('0x79')][_0xf6c6('0x7a')]})['then'](function(_0x7dbf69){if(_0x7dbf69[_0xf6c6('0x3b')]===0x1){return _0x3c3f07['id'];}else{var _0x89f44f=_[_0xf6c6('0x7b')](_[_0xf6c6('0x30')](_0x7dbf69,'TeamId'),function(_0x51b6bf){return _['includes'](_0x56c76b,_0x51b6bf);});if(_0x89f44f){return _0x3c3f07['id'];}}}));}}return BPromise[_0xf6c6('0x7c')](_0x4a4c9c)['then'](function(_0x1f8877){_0x250d97=_(_0x250d97)[_0xf6c6('0x7d')](_0x1f8877)[_0xf6c6('0x7e')]()[_0xf6c6('0x7f')]();return db[_0xf6c6('0x31')][_0xf6c6('0x4f')]({'where':{'id':_0x40b765[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](function(_0x359d13){return db[_0xf6c6('0x69')][_0xf6c6('0x6a')](function(_0x57e0e3){return _0x359d13[_0xf6c6('0x80')](_0x40b765[_0xf6c6('0x37')][_0xf6c6('0x81')],{'transaction':_0x57e0e3})[_0xf6c6('0x26')](function(){if(!_[_0xf6c6('0x82')](_0x250d97)){return _0x359d13[_0xf6c6('0x83')](_0x250d97,{'transaction':_0x57e0e3});}})[_0xf6c6('0x26')](function(){_0x250d97[_0xf6c6('0x6c')](function(_0x5a31f7){socket[_0xf6c6('0x6d')](_0xf6c6('0x84'),{'UserId':_0x5a31f7,'OpenchannelQueueId':_0x359d13['id']});});});});});});})[_0xf6c6('0x26')](respondWithStatusCode(_0x51703b,null))[_0xf6c6('0x48')](handleError(_0x51703b,null));};exports[_0xf6c6('0x85')]=function(_0x57e696,_0x58dc66,_0x564c5c){return db[_0xf6c6('0x31')][_0xf6c6('0x4f')]({'where':{'id':_0x57e696[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x58dc66,null))[_0xf6c6('0x26')](function(_0x208fff){if(_0x208fff){return _0x208fff[_0xf6c6('0x85')](_0x57e696[_0xf6c6('0x53')][_0xf6c6('0x81')],_[_0xf6c6('0x86')](_0x57e696[_0xf6c6('0x53')],[_0xf6c6('0x81'),'id'])||{})[_0xf6c6('0x87')](function(_0x2f7563){for(var _0x18f6c6=0x0;_0x18f6c6<_0x57e696['body']['ids'][_0xf6c6('0x3b')];_0x18f6c6+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x57e696[_0xf6c6('0x53')][_0xf6c6('0x81')][_0x18f6c6]),'OpenchannelQueueId':Number(_0x57e696[_0xf6c6('0x54')]['id'])});}return _0x2f7563;});}})[_0xf6c6('0x26')](respondWithResult(_0x58dc66,null))[_0xf6c6('0x48')](handleError(_0x58dc66,null));};exports[_0xf6c6('0x83')]=function(_0x5f5b00,_0x201f36,_0x2ab876){return db['OpenchannelQueue'][_0xf6c6('0x4f')]({'where':{'id':_0x5f5b00['params']['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x201f36,null))[_0xf6c6('0x26')](function(_0x544ad0){if(_0x544ad0){return _0x544ad0[_0xf6c6('0x83')](_0x5f5b00['query'][_0xf6c6('0x81')])[_0xf6c6('0x26')](function(){if(_[_0xf6c6('0x88')](_0x5f5b00['query']['ids'])){for(var _0x5c6f85=0x0;_0x5c6f85<_0x5f5b00[_0xf6c6('0x37')][_0xf6c6('0x81')]['length'];_0x5c6f85+=0x1){socket[_0xf6c6('0x6d')](_0xf6c6('0x84'),{'UserId':Number(_0x5f5b00[_0xf6c6('0x37')]['ids'][_0x5c6f85]),'OpenchannelQueueId':Number(_0x5f5b00[_0xf6c6('0x54')]['id'])});}}else{socket[_0xf6c6('0x6d')](_0xf6c6('0x84'),{'UserId':Number(_0x5f5b00['query'][_0xf6c6('0x81')]),'OpenchannelQueueId':Number(_0x5f5b00[_0xf6c6('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x201f36,null))[_0xf6c6('0x48')](handleError(_0x201f36,null));};exports['getAgents']=function(_0xb99b8c,_0x4c9e34,_0x462770){var _0x95b61c={};var _0x3b81a8={};var _0x36d9da;var _0x3e30a4;return db[_0xf6c6('0x31')][_0xf6c6('0x61')]({'where':{'id':_0xb99b8c[_0xf6c6('0x54')]['id']}})[_0xf6c6('0x26')](handleEntityNotFound(_0x4c9e34,null))[_0xf6c6('0x26')](function(_0x32af67){if(_0x32af67){_0x36d9da=_0x32af67;_0x3b81a8[_0xf6c6('0x35')]=_[_0xf6c6('0x36')](db['User']['rawAttributes']);_0x3b81a8[_0xf6c6('0x37')]=_[_0xf6c6('0x36')](_0xb99b8c['query']);_0x3b81a8[_0xf6c6('0x40')]=_[_0xf6c6('0x38')](_0x3b81a8[_0xf6c6('0x35')],_0x3b81a8[_0xf6c6('0x37')]);_0x95b61c[_0xf6c6('0x39')]=_[_0xf6c6('0x38')](_0x3b81a8['model'],qs[_0xf6c6('0x3a')](_0xb99b8c['query'][_0xf6c6('0x3a')]));_0x95b61c[_0xf6c6('0x39')]=_0x95b61c[_0xf6c6('0x39')][_0xf6c6('0x3b')]?_0x95b61c['attributes']:_0x3b81a8[_0xf6c6('0x35')];_0x95b61c[_0xf6c6('0x3d')]=qs['sort'](_0xb99b8c['query'][_0xf6c6('0x3e')]);_0x95b61c[_0xf6c6('0x3f')]=qs['filters'](_[_0xf6c6('0x89')](_0xb99b8c[_0xf6c6('0x37')],_0x3b81a8['filters']));if(_0xb99b8c[_0xf6c6('0x37')][_0xf6c6('0x41')]){_0x95b61c[_0xf6c6('0x3f')]=_[_0xf6c6('0x43')](_0x95b61c['where'],{'$or':_[_0xf6c6('0x30')](_0x95b61c['attributes'],function(_0x35b8bd){var _0x526f9b={};_0x526f9b[_0x35b8bd]={'$like':'%'+_0xb99b8c[_0xf6c6('0x37')][_0xf6c6('0x41')]+'%'};return _0x526f9b;})});}_0x95b61c=_['merge']({},_0x95b61c,_0xb99b8c[_0xf6c6('0x44')]);return _0x36d9da['getAgents'](_0x95b61c);}})[_0xf6c6('0x26')](function(_0x5262ee){if(_0x5262ee){_0x3e30a4=_0x5262ee['length'];if(!_0xb99b8c[_0xf6c6('0x37')][_0xf6c6('0x3c')](_0xf6c6('0x58'))){_0x95b61c[_0xf6c6('0x1f')]=qs['limit'](_0xb99b8c['query'][_0xf6c6('0x1f')]);_0x95b61c[_0xf6c6('0x1d')]=qs['offset'](_0xb99b8c[_0xf6c6('0x37')][_0xf6c6('0x1d')]);}return _0x36d9da['getAgents'](_0x95b61c);}})['then'](function(_0x5c3d33){if(_0x5c3d33){return _0x5c3d33?{'count':_0x3e30a4,'rows':_0x5c3d33}:null;}})['then'](respondWithResult(_0x4c9e34,null))[_0xf6c6('0x48')](handleError(_0x4c9e34,null));}; \ No newline at end of file +var _0xe215=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserOpenchannelQueue','rawAttributes','hasOwnProperty','nolimit','User','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','removeTeams','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x2279c4,_0x592acb){var _0x2f6fe9=function(_0xb2fb0a){while(--_0xb2fb0a){_0x2279c4['push'](_0x2279c4['shift']());}};_0x2f6fe9(++_0x592acb);}(_0xe215,0x7e));var _0x5e21=function(_0x37ea74,_0x2a330c){_0x37ea74=_0x37ea74-0x0;var _0x5bc73e=_0xe215[_0x37ea74];return _0x5bc73e;};'use strict';var emlformat=require(_0x5e21('0x0'));var rimraf=require(_0x5e21('0x1'));var zipdir=require(_0x5e21('0x2'));var jsonpatch=require(_0x5e21('0x3'));var rp=require(_0x5e21('0x4'));var moment=require(_0x5e21('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e21('0x6'));var path=require(_0x5e21('0x7'));var sox=require(_0x5e21('0x8'));var csv=require(_0x5e21('0x9'));var ejs=require(_0x5e21('0xa'));var fs=require('fs');var fs_extra=require(_0x5e21('0xb'));var _=require('lodash');var squel=require(_0x5e21('0xc'));var crypto=require(_0x5e21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5e21('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5e21('0xf'));var Papa=require('papaparse');var Redis=require(_0x5e21('0x10'));var authService=require(_0x5e21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5e21('0x12'));var hardwareService=require(_0x5e21('0x13'));var logger=require(_0x5e21('0x14'))('api');var utils=require(_0x5e21('0x15'));var config=require(_0x5e21('0x16'));var licenseUtil=require(_0x5e21('0x17'));var db=require(_0x5e21('0x18'))['db'];config[_0x5e21('0x19')]=_[_0x5e21('0x1a')](config[_0x5e21('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e21('0x1b'))(new Redis(config[_0x5e21('0x19')]));require(_0x5e21('0x1c'))[_0x5e21('0x1d')](socket);function respondWithStatusCode(_0x28fb3f,_0x303862){_0x303862=_0x303862||0xcc;return function(_0x2b34a5){if(_0x2b34a5){return _0x28fb3f[_0x5e21('0x1e')](_0x303862);}return _0x28fb3f[_0x5e21('0x1f')](_0x303862)[_0x5e21('0x20')]();};}function respondWithResult(_0x1a12de,_0x4ce711){_0x4ce711=_0x4ce711||0xc8;return function(_0x10669f){if(_0x10669f){return _0x1a12de[_0x5e21('0x1f')](_0x4ce711)[_0x5e21('0x21')](_0x10669f);}};}function respondWithFilteredResult(_0x5a5eb6,_0x3260ad){return function(_0x33e97b){if(_0x33e97b){var _0x4a368f=typeof _0x3260ad[_0x5e21('0x22')]===_0x5e21('0x23')&&typeof _0x3260ad[_0x5e21('0x24')]===_0x5e21('0x23');var _0x33e900=_0x33e97b['count'];var _0x5ae50a=_0x4a368f?0x0:_0x3260ad[_0x5e21('0x22')];var _0x4e1fad=_0x4a368f?_0x33e97b[_0x5e21('0x25')]:_0x3260ad['offset']+_0x3260ad[_0x5e21('0x24')];var _0x47d1b6;if(_0x4e1fad>=_0x33e900){_0x4e1fad=_0x33e900;_0x47d1b6=0xc8;}else{_0x47d1b6=0xce;}_0x5a5eb6[_0x5e21('0x1f')](_0x47d1b6);return _0x5a5eb6[_0x5e21('0x26')](_0x5e21('0x27'),_0x5ae50a+'-'+_0x4e1fad+'/'+_0x33e900)[_0x5e21('0x21')](_0x33e97b);}return null;};}function patchUpdates(_0x1684de){return function(_0x25705b){try{jsonpatch[_0x5e21('0x28')](_0x25705b,_0x1684de,!![]);}catch(_0x3dd501){return BPromise[_0x5e21('0x29')](_0x3dd501);}return _0x25705b[_0x5e21('0x2a')]();};}function saveUpdates(_0x17e038,_0x15db3a){return function(_0x4ed106){if(_0x4ed106){return _0x4ed106[_0x5e21('0x2b')](_0x17e038)[_0x5e21('0x2c')](function(_0x47f3f9){return _0x47f3f9;});}return null;};}function removeEntity(_0x383c34,_0x328f02){return function(_0x495d81){if(_0x495d81){return _0x495d81[_0x5e21('0x2d')]()[_0x5e21('0x2c')](function(){var _0x2c5bef=_0x495d81[_0x5e21('0x2e')]({'plain':!![]});var _0x2d77e8='OpenchannelQueues';return db[_0x5e21('0x2f')][_0x5e21('0x2d')]({'where':{'type':_0x2d77e8,'resourceId':_0x2c5bef['id']}})['then'](function(){return _0x495d81;});})[_0x5e21('0x2c')](function(){_0x383c34[_0x5e21('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14474a,_0x5b14cc){return function(_0x9af34d){if(!_0x9af34d){_0x14474a['sendStatus'](0x194);}return _0x9af34d;};}function handleError(_0x49f0e4,_0x3fb730){_0x3fb730=_0x3fb730||0x1f4;return function(_0x505ad0){logger[_0x5e21('0x30')](_0x505ad0[_0x5e21('0x31')]);if(_0x505ad0['name']){delete _0x505ad0[_0x5e21('0x32')];}_0x49f0e4[_0x5e21('0x1f')](_0x3fb730)[_0x5e21('0x33')](_0x505ad0);};}exports[_0x5e21('0x34')]=function(_0x4ef5ed,_0x2baf34){var _0x4ccfc4={},_0x31faff={},_0x2bec37={'count':0x0,'rows':[]};var _0x2e3b36=_[_0x5e21('0x35')](db[_0x5e21('0x36')]['rawAttributes'],function(_0x3b4fbf){return{'name':_0x3b4fbf[_0x5e21('0x37')],'type':_0x3b4fbf['type']['key']};});_0x31faff[_0x5e21('0x38')]=_[_0x5e21('0x35')](_0x2e3b36,_0x5e21('0x32'));_0x31faff['query']=_[_0x5e21('0x39')](_0x4ef5ed[_0x5e21('0x3a')]);_0x31faff[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x31faff[_0x5e21('0x38')],_0x31faff[_0x5e21('0x3a')]);_0x4ccfc4[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x31faff['model'],qs[_0x5e21('0x3e')](_0x4ef5ed[_0x5e21('0x3a')]['fields']));_0x4ccfc4['attributes']=_0x4ccfc4['attributes'][_0x5e21('0x3f')]?_0x4ccfc4[_0x5e21('0x3d')]:_0x31faff[_0x5e21('0x38')];if(!_0x4ef5ed['query']['hasOwnProperty']('nolimit')){_0x4ccfc4[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x4ccfc4[_0x5e21('0x22')]=qs['offset'](_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x22')]);}_0x4ccfc4[_0x5e21('0x40')]=qs[_0x5e21('0x41')](_0x4ef5ed['query']['sort']);_0x4ccfc4[_0x5e21('0x42')]=qs['filters'](_[_0x5e21('0x43')](_0x4ef5ed[_0x5e21('0x3a')],_0x31faff[_0x5e21('0x3b')]),_0x2e3b36);if(_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x44')]){_0x4ccfc4[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x4ccfc4[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0x2e3b36,function(_0x12fa75){if(_0x12fa75['type']!==_0x5e21('0x46')){var _0x223b48={};_0x223b48[_0x12fa75['name']]={'$like':'%'+_0x4ef5ed[_0x5e21('0x3a')]['filter']+'%'};return _0x223b48;}})});}_0x4ccfc4=_[_0x5e21('0x45')]({},_0x4ccfc4,_0x4ef5ed[_0x5e21('0x47')]);var _0x4e8298={'where':_0x4ccfc4[_0x5e21('0x42')]};return db[_0x5e21('0x36')][_0x5e21('0x25')](_0x4e8298)[_0x5e21('0x2c')](function(_0x252629){_0x2bec37[_0x5e21('0x25')]=_0x252629;if(_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x48')]){_0x4ccfc4[_0x5e21('0x49')]=[{'all':!![]}];}return db[_0x5e21('0x36')][_0x5e21('0x4a')](_0x4ccfc4);})[_0x5e21('0x2c')](function(_0x14d1cc){_0x2bec37[_0x5e21('0x4b')]=_0x14d1cc;return _0x2bec37;})[_0x5e21('0x2c')](respondWithFilteredResult(_0x2baf34,_0x4ccfc4))['catch'](handleError(_0x2baf34,null));};exports['show']=function(_0x3c4fb5,_0x4700ee){var _0x3da03b={'raw':!![],'where':{'id':_0x3c4fb5[_0x5e21('0x4c')]['id']}},_0x49aeed={};_0x49aeed[_0x5e21('0x38')]=_[_0x5e21('0x39')](db[_0x5e21('0x36')]['rawAttributes']);_0x49aeed[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x3c4fb5['query']);_0x49aeed[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x49aeed[_0x5e21('0x38')],_0x49aeed['query']);_0x3da03b[_0x5e21('0x3d')]=_['intersection'](_0x49aeed[_0x5e21('0x38')],qs['fields'](_0x3c4fb5['query'][_0x5e21('0x3e')]));_0x3da03b[_0x5e21('0x3d')]=_0x3da03b['attributes']['length']?_0x3da03b['attributes']:_0x49aeed[_0x5e21('0x38')];if(_0x3c4fb5['query'][_0x5e21('0x48')]){_0x3da03b['include']=[{'all':!![]}];}_0x3da03b=_['merge']({},_0x3da03b,_0x3c4fb5[_0x5e21('0x47')]);return db[_0x5e21('0x36')][_0x5e21('0x4d')](_0x3da03b)[_0x5e21('0x2c')](handleEntityNotFound(_0x4700ee,null))[_0x5e21('0x2c')](respondWithResult(_0x4700ee,null))[_0x5e21('0x4e')](handleError(_0x4700ee,null));};exports['create']=function(_0x33a35e,_0xfd3faa){return db['OpenchannelQueue'][_0x5e21('0x4f')](_0x33a35e[_0x5e21('0x50')],{})[_0x5e21('0x2c')](function(_0x3d9245){var _0xd05877=_0x33a35e[_0x5e21('0x51')][_0x5e21('0x2e')]({'plain':!![]});if(!_0xd05877)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd05877[_0x5e21('0x52')]===_0x5e21('0x51')){var _0x3babfb=_0x3d9245[_0x5e21('0x2e')]({'plain':!![]});var _0x5e5083='OpenchannelQueues';return db[_0x5e21('0x53')]['find']({'where':{'name':_0x5e5083,'userProfileId':_0xd05877[_0x5e21('0x54')]},'raw':!![]})[_0x5e21('0x2c')](function(_0x834652){if(_0x834652&&_0x834652[_0x5e21('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x3babfb[_0x5e21('0x32')],'resourceId':_0x3babfb['id'],'type':_0x834652['name'],'sectionId':_0x834652['id']},{})['then'](function(){return _0x3d9245;});}else{return _0x3d9245;}})[_0x5e21('0x4e')](function(_0x15a15a){logger[_0x5e21('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15a15a);throw _0x15a15a;});}return _0x3d9245;})['then'](respondWithResult(_0xfd3faa,0xc9))['catch'](handleError(_0xfd3faa,null));};exports[_0x5e21('0x2b')]=function(_0x1aa998,_0x238cb0){if(_0x1aa998[_0x5e21('0x50')]['id']){delete _0x1aa998[_0x5e21('0x50')]['id'];}return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x1aa998[_0x5e21('0x4c')]['id']}})['then'](handleEntityNotFound(_0x238cb0,null))[_0x5e21('0x2c')](saveUpdates(_0x1aa998[_0x5e21('0x50')],null))[_0x5e21('0x2c')](respondWithResult(_0x238cb0,null))['catch'](handleError(_0x238cb0,null));};exports[_0x5e21('0x2d')]=function(_0x19e70e,_0x399ac4){return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x19e70e[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x399ac4,null))[_0x5e21('0x2c')](removeEntity(_0x399ac4,null))[_0x5e21('0x4e')](handleError(_0x399ac4,null));};exports[_0x5e21('0x56')]=function(_0x1892b0,_0x4bfb88){return db['OpenchannelQueue']['describe']()[_0x5e21('0x2c')](respondWithResult(_0x4bfb88,null))['catch'](handleError(_0x4bfb88,null));};exports[_0x5e21('0x57')]=function(_0x4c4ad4,_0x214645,_0x8c023b){var _0xc4e6dd={'raw':!![],'where':{}},_0x4c0c89={},_0x5b96aa;return db[_0x5e21('0x36')]['findOne']({'where':{'id':_0x4c4ad4[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x214645,null))['then'](function(_0x4b1ffa){if(_0x4b1ffa){_0x5b96aa=_0x4b1ffa[_0x5e21('0x2e')]({'plain':!![]});_0x4c0c89['model']=_['keys'](db[_0x5e21('0x58')][_0x5e21('0x59')]);_0x4c0c89[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x4c4ad4[_0x5e21('0x3a')]);_0x4c0c89[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x4c0c89[_0x5e21('0x38')],_0x4c0c89['query']);_0xc4e6dd[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x4c0c89['model'],qs[_0x5e21('0x3e')](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x3e')]));_0xc4e6dd['attributes']=_0xc4e6dd['attributes'][_0x5e21('0x3f')]?_0xc4e6dd[_0x5e21('0x3d')]:_0x4c0c89['model'];if(!_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x5a')](_0x5e21('0x5b'))){_0xc4e6dd[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x24')]);_0xc4e6dd[_0x5e21('0x22')]=qs['offset'](_0x4c4ad4[_0x5e21('0x3a')]['offset']);}_0xc4e6dd[_0x5e21('0x40')]=qs['sort'](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x41')]);_0xc4e6dd['where']=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x4c4ad4[_0x5e21('0x3a')],_0x4c0c89[_0x5e21('0x3b')]));_0xc4e6dd[_0x5e21('0x42')]['OpenchannelQueueId']=_0x4b1ffa['id'];if(_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x44')]){_0xc4e6dd[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0xc4e6dd[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0xc4e6dd[_0x5e21('0x3d')],function(_0x22a505){var _0x166250={};_0x166250[_0x22a505]={'$like':'%'+_0x4c4ad4['query'][_0x5e21('0x44')]+'%'};return _0x166250;})});}_0xc4e6dd=_[_0x5e21('0x45')]({},_0xc4e6dd,_0x4c4ad4[_0x5e21('0x47')]);return db[_0x5e21('0x58')]['findAll'](_0xc4e6dd);}})[_0x5e21('0x2c')](function(_0x4f0ab0){if(_0x4f0ab0){return db[_0x5e21('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x4f0ab0,'UserId'),'role':'agent'},'attributes':['id',_0x5e21('0x32'),'openchannelPause',_0x5e21('0x5d'),_0x5e21('0x5e')]});}})[_0x5e21('0x2c')](function(_0x13548a){if(_0x13548a){return{'count':_0x13548a[_0x5e21('0x25')],'rows':_[_0x5e21('0x35')](_0x13548a[_0x5e21('0x4b')],function(_0x3fa2ed){return{'membername':_0x3fa2ed[_0x5e21('0x32')],'UserId':_0x3fa2ed['id'],'queue_name':_0x5b96aa[_0x5e21('0x32')],'OpenchannelQueueId':_0x5b96aa['id'],'interface':util['format'](_0x5e21('0x5f'),_0x5e21('0x60'),_0x3fa2ed['name']),'penalty':0x0,'paused':_0x3fa2ed[_0x5e21('0x61')],'createdAt':_0x3fa2ed[_0x5e21('0x5e')],'updatedAt':_0x3fa2ed[_0x5e21('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5e21('0x2c')](respondWithFilteredResult(_0x214645,_0xc4e6dd))['catch'](handleError(_0x214645,null));};exports[_0x5e21('0x62')]=function(_0x114a4f,_0x296687,_0x4635a2){var _0x37b669={};var _0x274882={};var _0x1a39a1;var _0x591ef3;return db[_0x5e21('0x36')][_0x5e21('0x63')]({'where':{'id':_0x114a4f['params']['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x296687,null))[_0x5e21('0x2c')](function(_0x4e742e){if(_0x4e742e){_0x1a39a1=_0x4e742e;_0x274882[_0x5e21('0x38')]=_['keys'](db[_0x5e21('0x64')]['rawAttributes']);_0x274882[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x114a4f['query']);_0x274882[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x274882[_0x5e21('0x38')],_0x274882[_0x5e21('0x3a')]);_0x37b669['attributes']=_[_0x5e21('0x3c')](_0x274882[_0x5e21('0x38')],qs[_0x5e21('0x3e')](_0x114a4f[_0x5e21('0x3a')]['fields']));_0x37b669['attributes']=_0x37b669['attributes']['length']?_0x37b669[_0x5e21('0x3d')]:_0x274882['model'];_0x37b669[_0x5e21('0x40')]=qs[_0x5e21('0x41')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x41')]);_0x37b669[_0x5e21('0x42')]=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x114a4f[_0x5e21('0x3a')],_0x274882[_0x5e21('0x3b')]));if(_0x114a4f['query'][_0x5e21('0x44')]){_0x37b669[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x37b669[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0x37b669[_0x5e21('0x3d')],function(_0x27bf3f){var _0x3a9149={};_0x3a9149[_0x27bf3f]={'$like':'%'+_0x114a4f['query'][_0x5e21('0x44')]+'%'};return _0x3a9149;})});}_0x37b669=_[_0x5e21('0x45')]({},_0x37b669,_0x114a4f[_0x5e21('0x47')]);return _0x1a39a1[_0x5e21('0x62')](_0x37b669);}})[_0x5e21('0x2c')](function(_0x463441){if(_0x463441){_0x591ef3=_0x463441['length'];if(!_0x114a4f[_0x5e21('0x3a')]['hasOwnProperty'](_0x5e21('0x5b'))){_0x37b669[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x37b669['offset']=qs[_0x5e21('0x22')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x22')]);}return _0x1a39a1['getTeams'](_0x37b669);}})['then'](function(_0x10494b){if(_0x10494b){return _0x10494b?{'count':_0x591ef3,'rows':_0x10494b}:null;}})[_0x5e21('0x2c')](respondWithResult(_0x296687,null))[_0x5e21('0x4e')](handleError(_0x296687,null));};exports[_0x5e21('0x65')]=function(_0x2a2819,_0x29c891,_0x1ba420){var _0x3c9df7=_0x2a2819[_0x5e21('0x50')][_0x5e21('0x66')];return db[_0x5e21('0x64')][_0x5e21('0x4a')]({'where':{'id':_0x3c9df7},'attributes':['id'],'include':[{'model':db[_0x5e21('0x5c')],'as':_0x5e21('0x67'),'attributes':['id',_0x5e21('0x32'),_0x5e21('0x68'),_0x5e21('0x69'),_0x5e21('0x6a')],'raw':!![]}]})[_0x5e21('0x2c')](function(_0xd41d94){if(_0xd41d94){var _0x2770a6=_['flatMap'](_0xd41d94,function(_0x37d604){var _0x56c602=_0x37d604[_0x5e21('0x2e')]({'plain':!![]});return _0x56c602['Agents'];});return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x2a2819[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](function(_0x43ac5c){return db[_0x5e21('0x6b')]['transaction'](function(_0x1c062a){return _0x43ac5c[_0x5e21('0x65')](_0x3c9df7,{'transaction':_0x1c062a})[_0x5e21('0x2c')](function(){return BPromise[_0x5e21('0x6c')](_0x2770a6,function(_0x45e608){return db[_0x5e21('0x58')][_0x5e21('0x6d')]({'where':{'UserId':_0x45e608['id'],'OpenchannelQueueId':_0x2a2819['params']['id']},'transaction':_0x1c062a});});})[_0x5e21('0x2c')](function(){_0x2770a6['forEach'](function(_0x211aac){socket[_0x5e21('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x211aac['id'],'OpenchannelQueueId':_0x43ac5c['id']});});});});});}})[_0x5e21('0x2c')](respondWithStatusCode(_0x29c891,null))['catch'](handleError(_0x29c891,null));};exports[_0x5e21('0x6f')]=function(_0x29a2c2,_0x1ab0ad,_0x54594e){return db[_0x5e21('0x64')][_0x5e21('0x4a')]({'where':{'id':_0x29a2c2[_0x5e21('0x3a')][_0x5e21('0x66')]},'attributes':['id'],'include':[{'model':db[_0x5e21('0x5c')],'as':_0x5e21('0x67'),'attributes':['id'],'raw':!![]}]})[_0x5e21('0x2c')](handleEntityNotFound(_0x1ab0ad,null))[_0x5e21('0x2c')](function(_0x517a8f){var _0x453918=_[_0x5e21('0x35')](_0x517a8f,'id');var _0x47e2dc=[];var _0x1152ee=[];var _0x459291=squel['select']();_0x459291['field'](_0x5e21('0x70'))['from']('team_has_openchannel_queues','tq')['join'](_0x5e21('0x71'),'ut',_0x5e21('0x72'))[_0x5e21('0x42')](_0x5e21('0x73'),_0x29a2c2[_0x5e21('0x4c')]['id']);for(var _0x2bfec5=0x0;_0x2bfec5<_0x517a8f[_0x5e21('0x3f')];_0x2bfec5+=0x1){let _0x241a3d=_0x517a8f[_0x2bfec5];for(var _0x561ff2=0x0;_0x561ff2<_0x241a3d[_0x5e21('0x67')][_0x5e21('0x3f')];_0x561ff2+=0x1){let _0x298d60=_0x241a3d[_0x5e21('0x67')][_0x561ff2];var _0x59e705=_0x459291['clone']();_0x59e705[_0x5e21('0x42')](_0x5e21('0x74'),_0x298d60['id']);_0x1152ee['push'](db[_0x5e21('0x6b')]['query'](_0x59e705['toString'](),{'type':db[_0x5e21('0x6b')][_0x5e21('0x75')][_0x5e21('0x76')]})[_0x5e21('0x2c')](function(_0x52e4fe){if(_0x52e4fe[_0x5e21('0x3f')]===0x1){return _0x298d60['id'];}else{var _0x231209=_[_0x5e21('0x77')](_['map'](_0x52e4fe,_0x5e21('0x78')),function(_0x1541c9){return _['includes'](_0x453918,_0x1541c9);});if(_0x231209){return _0x298d60['id'];}}}));}}return BPromise[_0x5e21('0x79')](_0x1152ee)['then'](function(_0x58eaa5){_0x47e2dc=_(_0x47e2dc)[_0x5e21('0x7a')](_0x58eaa5)[_0x5e21('0x7b')]()[_0x5e21('0x7c')]();return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x29a2c2[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](function(_0x3ce8f3){return db[_0x5e21('0x6b')]['transaction'](function(_0x1020b8){return _0x3ce8f3[_0x5e21('0x6f')](_0x29a2c2[_0x5e21('0x3a')][_0x5e21('0x66')],{'transaction':_0x1020b8})[_0x5e21('0x2c')](function(){if(!_[_0x5e21('0x7d')](_0x47e2dc)){return _0x3ce8f3['removeAgents'](_0x47e2dc,{'transaction':_0x1020b8});}})[_0x5e21('0x2c')](function(){_0x47e2dc[_0x5e21('0x7e')](function(_0x216585){socket['emit'](_0x5e21('0x7f'),{'UserId':_0x216585,'OpenchannelQueueId':_0x3ce8f3['id']});});});});});});})[_0x5e21('0x2c')](respondWithStatusCode(_0x1ab0ad,null))[_0x5e21('0x4e')](handleError(_0x1ab0ad,null));};exports[_0x5e21('0x80')]=function(_0x5c0db8,_0x356f9c,_0x54f890){return db['OpenchannelQueue'][_0x5e21('0x4d')]({'where':{'id':_0x5c0db8[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x356f9c,null))[_0x5e21('0x2c')](function(_0x1042c8){if(_0x1042c8){return _0x1042c8[_0x5e21('0x80')](_0x5c0db8['body'][_0x5e21('0x66')],_[_0x5e21('0x81')](_0x5c0db8[_0x5e21('0x50')],['ids','id'])||{})[_0x5e21('0x82')](function(_0x107aae){for(var _0x827664=0x0;_0x827664<_0x5c0db8[_0x5e21('0x50')][_0x5e21('0x66')][_0x5e21('0x3f')];_0x827664+=0x1){socket[_0x5e21('0x6e')](_0x5e21('0x83'),{'UserId':Number(_0x5c0db8['body'][_0x5e21('0x66')][_0x827664]),'OpenchannelQueueId':Number(_0x5c0db8['params']['id'])});}return _0x107aae;});}})[_0x5e21('0x2c')](respondWithResult(_0x356f9c,null))[_0x5e21('0x4e')](handleError(_0x356f9c,null));};exports[_0x5e21('0x84')]=function(_0xb45059,_0x327cbb,_0x22ab17){return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0xb45059[_0x5e21('0x4c')]['id']}})['then'](handleEntityNotFound(_0x327cbb,null))[_0x5e21('0x2c')](function(_0x51ff29){if(_0x51ff29){return _0x51ff29['removeAgents'](_0xb45059['query'][_0x5e21('0x66')])[_0x5e21('0x2c')](function(){if(_[_0x5e21('0x85')](_0xb45059[_0x5e21('0x3a')]['ids'])){for(var _0x4075b8=0x0;_0x4075b8<_0xb45059['query'][_0x5e21('0x66')]['length'];_0x4075b8+=0x1){socket[_0x5e21('0x6e')](_0x5e21('0x7f'),{'UserId':Number(_0xb45059[_0x5e21('0x3a')]['ids'][_0x4075b8]),'OpenchannelQueueId':Number(_0xb45059[_0x5e21('0x4c')]['id'])});}}else{socket[_0x5e21('0x6e')](_0x5e21('0x7f'),{'UserId':Number(_0xb45059[_0x5e21('0x3a')][_0x5e21('0x66')]),'OpenchannelQueueId':Number(_0xb45059[_0x5e21('0x4c')]['id'])});}});}})[_0x5e21('0x2c')](respondWithStatusCode(_0x327cbb,null))[_0x5e21('0x4e')](handleError(_0x327cbb,null));};exports[_0x5e21('0x86')]=function(_0x42f095,_0x2af006,_0x26db8b){var _0x133d39={};var _0x5dcb4a={};var _0x2cb5a4;var _0x16a772;return db[_0x5e21('0x36')]['findOne']({'where':{'id':_0x42f095[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x2af006,null))[_0x5e21('0x2c')](function(_0x477f22){if(_0x477f22){_0x2cb5a4=_0x477f22;_0x5dcb4a[_0x5e21('0x38')]=_[_0x5e21('0x39')](db[_0x5e21('0x5c')][_0x5e21('0x59')]);_0x5dcb4a[_0x5e21('0x3a')]=_['keys'](_0x42f095['query']);_0x5dcb4a['filters']=_[_0x5e21('0x3c')](_0x5dcb4a[_0x5e21('0x38')],_0x5dcb4a['query']);_0x133d39[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x5dcb4a[_0x5e21('0x38')],qs[_0x5e21('0x3e')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x3e')]));_0x133d39[_0x5e21('0x3d')]=_0x133d39[_0x5e21('0x3d')][_0x5e21('0x3f')]?_0x133d39[_0x5e21('0x3d')]:_0x5dcb4a[_0x5e21('0x38')];_0x133d39['order']=qs[_0x5e21('0x41')](_0x42f095['query'][_0x5e21('0x41')]);_0x133d39['where']=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x42f095[_0x5e21('0x3a')],_0x5dcb4a[_0x5e21('0x3b')]));if(_0x42f095[_0x5e21('0x3a')][_0x5e21('0x44')]){_0x133d39[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x133d39['where'],{'$or':_[_0x5e21('0x35')](_0x133d39[_0x5e21('0x3d')],function(_0x146e8a){var _0x3b44f4={};_0x3b44f4[_0x146e8a]={'$like':'%'+_0x42f095['query'][_0x5e21('0x44')]+'%'};return _0x3b44f4;})});}_0x133d39=_[_0x5e21('0x45')]({},_0x133d39,_0x42f095[_0x5e21('0x47')]);return _0x2cb5a4[_0x5e21('0x86')](_0x133d39);}})[_0x5e21('0x2c')](function(_0x4a12dc){if(_0x4a12dc){_0x16a772=_0x4a12dc['length'];if(!_0x42f095['query'][_0x5e21('0x5a')](_0x5e21('0x5b'))){_0x133d39[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x133d39['offset']=qs[_0x5e21('0x22')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x22')]);}return _0x2cb5a4[_0x5e21('0x86')](_0x133d39);}})[_0x5e21('0x2c')](function(_0x342ed8){if(_0x342ed8){return _0x342ed8?{'count':_0x16a772,'rows':_0x342ed8}:null;}})['then'](respondWithResult(_0x2af006,null))[_0x5e21('0x4e')](handleError(_0x2af006,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1faf3d7..66eec1c 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 _0xe828=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xe828,0x1ed));var _0x8e82=function(_0x44c79f,_0x21f727){_0x44c79f=_0x44c79f-0x0;var _0x4089ef=_0xe828[_0x44c79f];return _0x4089ef;};'use strict';var EventEmitter=require(_0x8e82('0x0'));var OpenchannelQueue=require(_0x8e82('0x1'))['db'][_0x8e82('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8e82('0x3')](0x0);var events={'afterCreate':_0x8e82('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x51a380){return function(_0x24d867,_0x41b9bd,_0x3fbf67){OpenchannelQueueEvents[_0x8e82('0x5')](_0x51a380+':'+_0x24d867['id'],_0x24d867);OpenchannelQueueEvents[_0x8e82('0x5')](_0x51a380,_0x24d867);_0x3fbf67(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x8e82('0x6')](e,emitEvent(event));}}module[_0x8e82('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6824=['update','remove','emit','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x258175,_0x55aac3){var _0x2a02fd=function(_0x61bace){while(--_0x61bace){_0x258175['push'](_0x258175['shift']());}};_0x2a02fd(++_0x55aac3);}(_0x6824,0x1ed));var _0x4682=function(_0x14696a,_0x469311){_0x14696a=_0x14696a-0x0;var _0x2cfd9d=_0x6824[_0x14696a];return _0x2cfd9d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x4682('0x0'))['db'][_0x4682('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4682('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4682('0x3'),'afterDestroy':_0x4682('0x4')};function emitEvent(_0x2554bd){return function(_0xf082eb,_0x1fbb5e,_0x261acb){OpenchannelQueueEvents['emit'](_0x2554bd+':'+_0xf082eb['id'],_0xf082eb);OpenchannelQueueEvents[_0x4682('0x5')](_0x2554bd,_0xf082eb);_0x261acb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4682('0x6')](e,emitEvent(event));}}module[_0x4682('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 1a03ae1..d9f8e33 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 _0x7f0b=['exports','define','openchannel_queues','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2cf08a,_0x352fcb){var _0x3b35a8=function(_0x28da49){while(--_0x28da49){_0x2cf08a['push'](_0x2cf08a['shift']());}};_0x3b35a8(++_0x352fcb);}(_0x7f0b,0xb7));var _0xb7f0=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x7f0b[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0xb7f0('0x0'));var util=require(_0xb7f0('0x1'));var logger=require(_0xb7f0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb7f0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f0('0x4'));var rimraf=require(_0xb7f0('0x5'));var config=require(_0xb7f0('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xb7f0('0x7')]=function(_0x363ba2,_0x243295){return _0x363ba2[_0xb7f0('0x8')]('OpenchannelQueue',attributes,{'tableName':_0xb7f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a0=['bluebird','request-promise','rimraf','../../config/environment','exports','define','util','api'];(function(_0x55e87b,_0x4a3f46){var _0x3ab3e0=function(_0x81f4b6){while(--_0x81f4b6){_0x55e87b['push'](_0x55e87b['shift']());}};_0x3ab3e0(++_0x4a3f46);}(_0xe4a0,0x1be));var _0x0e4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe4a0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x0e4a('0x0'));var logger=require('../../config/logger')(_0x0e4a('0x1'));var moment=require('moment');var BPromise=require(_0x0e4a('0x2'));var rp=require(_0x0e4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e4a('0x4'));var config=require(_0x0e4a('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x0e4a('0x6')]=function(_0x5331d6,_0x3ae0bb){return _0x5331d6[_0x0e4a('0x7')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 453e5d3..6c1d835 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 _0x3c49=['redis','request','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','model','map','stringify','debug','ShowOpenchannelQueue','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter'];(function(_0x56a46f,_0x33366e){var _0xe54ede=function(_0x1a8aa8){while(--_0x1a8aa8){_0x56a46f['push'](_0x56a46f['shift']());}};_0xe54ede(++_0x33366e);}(_0x3c49,0xa4));var _0x93c4=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x3c49[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x93c4('0x0'));var util=require('util');var moment=require(_0x93c4('0x1'));var BPromise=require(_0x93c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93c4('0x4'));var logger=require(_0x93c4('0x5'))(_0x93c4('0x6'));var config=require('../../config/environment');var jayson=require(_0x93c4('0x7'));var client=jayson[_0x93c4('0x8')]['http']({'port':0x232a});config['redis']=_[_0x93c4('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x93c4('0xa'))(new Redis(config[_0x93c4('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x27e263,_0x5ab85b,_0x3c4166){return new BPromise(function(_0x442f2c,_0x5d443f){return client[_0x93c4('0xc')](_0x27e263,_0x3c4166)[_0x93c4('0xd')](function(_0x554a35){logger[_0x93c4('0xe')](_0x93c4('0xf'),_0x5ab85b,'request\x20sent');logger['debug'](_0x93c4('0x10'),_0x5ab85b,'request\x20sent',JSON['stringify'](_0x554a35));if(_0x554a35[_0x93c4('0x11')]){if(_0x554a35[_0x93c4('0x11')][_0x93c4('0x12')]===0x1f4){logger[_0x93c4('0x11')](_0x93c4('0xf'),_0x5ab85b,_0x554a35[_0x93c4('0x11')]['message']);return _0x5d443f(_0x554a35[_0x93c4('0x11')][_0x93c4('0x13')]);}logger['error'](_0x93c4('0xf'),_0x5ab85b,_0x554a35[_0x93c4('0x11')]['message']);return _0x442f2c(_0x554a35['error']['message']);}else{logger[_0x93c4('0xe')](_0x93c4('0xf'),_0x5ab85b,_0x93c4('0x14'));_0x442f2c(_0x554a35[_0x93c4('0x15')][_0x93c4('0x13')]);}})['catch'](function(_0x211012){logger[_0x93c4('0x11')](_0x93c4('0xf'),_0x5ab85b,_0x211012);_0x5d443f(_0x211012);});});}exports[_0x93c4('0x16')]=function(_0x266384){var _0x32f8b1=this;return new Promise(function(_0x5d1060,_0x3f1d96){return db[_0x93c4('0x17')]['findAll']({'raw':_0x266384['options']?_0x266384[_0x93c4('0x18')][_0x93c4('0x19')]===undefined?!![]:![]:!![],'where':_0x266384[_0x93c4('0x18')]?_0x266384[_0x93c4('0x18')][_0x93c4('0x1a')]||null:null,'attributes':_0x266384[_0x93c4('0x18')]?_0x266384[_0x93c4('0x18')][_0x93c4('0x1b')]||null:null,'limit':_0x266384[_0x93c4('0x18')]?_0x266384[_0x93c4('0x18')]['limit']||null:null,'include':_0x266384[_0x93c4('0x18')]?_0x266384[_0x93c4('0x18')][_0x93c4('0x1c')]?_['map'](_0x266384[_0x93c4('0x18')][_0x93c4('0x1c')],function(_0x18e7a8){return{'model':db[_0x18e7a8[_0x93c4('0x1d')]],'as':_0x18e7a8['as'],'attributes':_0x18e7a8['attributes'],'include':_0x18e7a8[_0x93c4('0x1c')]?_[_0x93c4('0x1e')](_0x18e7a8[_0x93c4('0x1c')],function(_0x442848){return{'model':db[_0x442848[_0x93c4('0x1d')]],'as':_0x442848['as'],'attributes':_0x442848['attributes'],'include':_0x442848[_0x93c4('0x1c')]?_['map'](_0x442848[_0x93c4('0x1c')],function(_0x5229d8){return{'model':db[_0x5229d8[_0x93c4('0x1d')]],'as':_0x5229d8['as'],'attributes':_0x5229d8[_0x93c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x93c4('0xd')](function(_0x385b29){logger['info'](_0x93c4('0x16'),_0x266384);logger['debug']('GetOpenchannelQueue',_0x266384,JSON[_0x93c4('0x1f')](_0x385b29));_0x5d1060(_0x385b29);})['catch'](function(_0x19d7a9){logger[_0x93c4('0x11')](_0x93c4('0x16'),_0x19d7a9['message'],_0x266384);_0x3f1d96(_0x32f8b1[_0x93c4('0x11')](0x1f4,_0x19d7a9[_0x93c4('0x13')]));});});};exports['ShowOpenchannelQueue']=function(_0x4d3df2){var _0x2a38ab=this;return new Promise(function(_0x480a5c,_0x1c1cb1){return db['OpenchannelQueue']['find']({'raw':_0x4d3df2[_0x93c4('0x18')]?_0x4d3df2[_0x93c4('0x18')][_0x93c4('0x19')]===undefined?!![]:![]:!![],'where':_0x4d3df2[_0x93c4('0x18')]?_0x4d3df2['options'][_0x93c4('0x1a')]||null:null,'attributes':_0x4d3df2[_0x93c4('0x18')]?_0x4d3df2['options'][_0x93c4('0x1b')]||null:null,'include':_0x4d3df2['options']?_0x4d3df2[_0x93c4('0x18')][_0x93c4('0x1c')]?_[_0x93c4('0x1e')](_0x4d3df2[_0x93c4('0x18')][_0x93c4('0x1c')],function(_0x340e68){return{'model':db[_0x340e68[_0x93c4('0x1d')]],'as':_0x340e68['as'],'attributes':_0x340e68[_0x93c4('0x1b')],'include':_0x340e68['include']?_[_0x93c4('0x1e')](_0x340e68[_0x93c4('0x1c')],function(_0x21447a){return{'model':db[_0x21447a[_0x93c4('0x1d')]],'as':_0x21447a['as'],'attributes':_0x21447a[_0x93c4('0x1b')],'include':_0x21447a[_0x93c4('0x1c')]?_[_0x93c4('0x1e')](_0x21447a[_0x93c4('0x1c')],function(_0x1cb771){return{'model':db[_0x1cb771['model']],'as':_0x1cb771['as'],'attributes':_0x1cb771[_0x93c4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32fffd){logger['info']('ShowOpenchannelQueue',_0x4d3df2);logger[_0x93c4('0x20')](_0x93c4('0x21'),_0x4d3df2,JSON[_0x93c4('0x1f')](_0x32fffd));_0x480a5c(_0x32fffd);})[_0x93c4('0x22')](function(_0x5d1db1){logger[_0x93c4('0x11')](_0x93c4('0x21'),_0x5d1db1['message'],_0x4d3df2);_0x1c1cb1(_0x2a38ab['error'](0x1f4,_0x5d1db1['message']));});});}; \ No newline at end of file +var _0x4a23=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue'];(function(_0x46bd02,_0x3c73cc){var _0x2b0f33=function(_0x1e9b88){while(--_0x1e9b88){_0x46bd02['push'](_0x46bd02['shift']());}};_0x2b0f33(++_0x3c73cc);}(_0x4a23,0xda));var _0x34a2=function(_0xdbe3c0,_0x18d4b3){_0xdbe3c0=_0xdbe3c0-0x0;var _0x162603=_0x4a23[_0xdbe3c0];return _0x162603;};'use strict';var _=require(_0x34a2('0x0'));var util=require(_0x34a2('0x1'));var moment=require('moment');var BPromise=require(_0x34a2('0x2'));var rs=require(_0x34a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34a2('0x5'));var config=require(_0x34a2('0x6'));var jayson=require(_0x34a2('0x7'));var client=jayson[_0x34a2('0x8')][_0x34a2('0x9')]({'port':0x232a});config[_0x34a2('0xa')]=_[_0x34a2('0xb')](config[_0x34a2('0xa')],{'host':_0x34a2('0xc'),'port':0x18eb});var socket=require(_0x34a2('0xd'))(new Redis(config[_0x34a2('0xa')]));require(_0x34a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x4e3309,_0x552669,_0xb0748){return new BPromise(function(_0x3af308,_0x24cb77){return client[_0x34a2('0xf')](_0x4e3309,_0xb0748)[_0x34a2('0x10')](function(_0x296878){logger[_0x34a2('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x552669,_0x34a2('0x12'));logger[_0x34a2('0x13')](_0x34a2('0x14'),_0x552669,'request\x20sent',JSON['stringify'](_0x296878));if(_0x296878[_0x34a2('0x15')]){if(_0x296878[_0x34a2('0x15')][_0x34a2('0x16')]===0x1f4){logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x296878['error']['message']);return _0x24cb77(_0x296878[_0x34a2('0x15')][_0x34a2('0x18')]);}logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x296878[_0x34a2('0x15')][_0x34a2('0x18')]);return _0x3af308(_0x296878[_0x34a2('0x15')]['message']);}else{logger[_0x34a2('0x11')](_0x34a2('0x17'),_0x552669,_0x34a2('0x12'));_0x3af308(_0x296878[_0x34a2('0x19')][_0x34a2('0x18')]);}})[_0x34a2('0x1a')](function(_0x2bffd6){logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x2bffd6);_0x24cb77(_0x2bffd6);});});}exports[_0x34a2('0x1b')]=function(_0x16edb7){var _0x993e3f=this;return new Promise(function(_0x1cbecc,_0x59447e){return db[_0x34a2('0x1c')][_0x34a2('0x1d')]({'raw':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7['options'][_0x34a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x16edb7['options']?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x20')]||null:null,'attributes':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7['options'][_0x34a2('0x21')]||null:null,'limit':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x22')]||null:null,'include':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x16edb7['options']['include'],function(_0x35f0c2){return{'model':db[_0x35f0c2[_0x34a2('0x25')]],'as':_0x35f0c2['as'],'attributes':_0x35f0c2[_0x34a2('0x21')],'include':_0x35f0c2[_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x35f0c2[_0x34a2('0x23')],function(_0x152970){return{'model':db[_0x152970[_0x34a2('0x25')]],'as':_0x152970['as'],'attributes':_0x152970[_0x34a2('0x21')],'include':_0x152970[_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x152970[_0x34a2('0x23')],function(_0x288b77){return{'model':db[_0x288b77[_0x34a2('0x25')]],'as':_0x288b77['as'],'attributes':_0x288b77[_0x34a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x34a2('0x10')](function(_0x546d60){logger[_0x34a2('0x11')](_0x34a2('0x1b'),_0x16edb7);logger[_0x34a2('0x13')]('GetOpenchannelQueue',_0x16edb7,JSON[_0x34a2('0x26')](_0x546d60));_0x1cbecc(_0x546d60);})[_0x34a2('0x1a')](function(_0x239e6a){logger[_0x34a2('0x15')](_0x34a2('0x1b'),_0x239e6a[_0x34a2('0x18')],_0x16edb7);_0x59447e(_0x993e3f[_0x34a2('0x15')](0x1f4,_0x239e6a[_0x34a2('0x18')]));});});};exports[_0x34a2('0x27')]=function(_0x23dd5c){var _0x58a761=this;return new Promise(function(_0x1e8c15,_0x393d70){return db[_0x34a2('0x1c')][_0x34a2('0x28')]({'raw':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c['options'][_0x34a2('0x20')]||null:null,'attributes':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')][_0x34a2('0x21')]||null:null,'include':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')][_0x34a2('0x23')]?_['map'](_0x23dd5c['options'][_0x34a2('0x23')],function(_0x488e20){return{'model':db[_0x488e20[_0x34a2('0x25')]],'as':_0x488e20['as'],'attributes':_0x488e20['attributes'],'include':_0x488e20['include']?_[_0x34a2('0x24')](_0x488e20[_0x34a2('0x23')],function(_0x3d4c8b){return{'model':db[_0x3d4c8b[_0x34a2('0x25')]],'as':_0x3d4c8b['as'],'attributes':_0x3d4c8b[_0x34a2('0x21')],'include':_0x3d4c8b['include']?_['map'](_0x3d4c8b[_0x34a2('0x23')],function(_0x9a14b5){return{'model':db[_0x9a14b5[_0x34a2('0x25')]],'as':_0x9a14b5['as'],'attributes':_0x9a14b5[_0x34a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x34a2('0x10')](function(_0x68cbe9){logger[_0x34a2('0x11')](_0x34a2('0x27'),_0x23dd5c);logger[_0x34a2('0x13')](_0x34a2('0x27'),_0x23dd5c,JSON[_0x34a2('0x26')](_0x68cbe9));_0x1e8c15(_0x68cbe9);})[_0x34a2('0x1a')](function(_0xcfae2d){logger[_0x34a2('0x15')]('ShowOpenchannelQueue',_0xcfae2d['message'],_0x23dd5c);_0x393d70(_0x58a761['error'](0x1f4,_0xcfae2d[_0x34a2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7bd7a9a..19ba33d 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 _0xb1a0=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','emit'];(function(_0x11a11e,_0x2a1df5){var _0x3f5322=function(_0x275f0b){while(--_0x275f0b){_0x11a11e['push'](_0x11a11e['shift']());}};_0x3f5322(++_0x2a1df5);}(_0xb1a0,0x169));var _0x0b1a=function(_0x29907c,_0x1b8567){_0x29907c=_0x29907c-0x0;var _0x222c5f=_0xb1a0[_0x29907c];return _0x222c5f;};'use strict';var OpenchannelQueueEvents=require(_0x0b1a('0x0'));var events=[_0x0b1a('0x1'),'remove','update'];function createListener(_0x26bc97,_0xebfd41){return function(_0x4f16ab){_0xebfd41[_0x0b1a('0x2')](_0x26bc97,_0x4f16ab);};}function removeListener(_0x3dfc96,_0x35a296){return function(){OpenchannelQueueEvents[_0x0b1a('0x3')](_0x3dfc96,_0x35a296);};}exports[_0x0b1a('0x4')]=function(_0x363d13){for(var _0x31b80b=0x0,_0x30b501=events[_0x0b1a('0x5')];_0x31b80b<_0x30b501;_0x31b80b++){var _0x568c78=events[_0x31b80b];var _0x3e55e2=createListener(_0x0b1a('0x6')+_0x568c78,_0x363d13);OpenchannelQueueEvents['on'](_0x568c78,_0x3e55e2);}}; \ No newline at end of file +var _0xc7b9=['update','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc7b9,0x6d));var _0x9c7b=function(_0xdd8cd6,_0x56b6b8){_0xdd8cd6=_0xdd8cd6-0x0;var _0x3bf99d=_0xc7b9[_0xdd8cd6];return _0x3bf99d;};'use strict';var OpenchannelQueueEvents=require(_0x9c7b('0x0'));var events=[_0x9c7b('0x1'),_0x9c7b('0x2'),_0x9c7b('0x3')];function createListener(_0x5ce65e,_0x3f8cf9){return function(_0x498823){_0x3f8cf9['emit'](_0x5ce65e,_0x498823);};}function removeListener(_0x16aff6,_0x56a9b0){return function(){OpenchannelQueueEvents[_0x9c7b('0x4')](_0x16aff6,_0x56a9b0);};}exports[_0x9c7b('0x5')]=function(_0x44332d){for(var _0x24b170=0x0,_0xf4a381=events[_0x9c7b('0x6')];_0x24b170<_0xf4a381;_0x24b170++){var _0x464b69=events[_0x24b170];var _0x507aa2=createListener('openchannelQueue:'+_0x464b69,_0x44332d);OpenchannelQueueEvents['on'](_0x464b69,_0x507aa2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 80647ca..526ff1f 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 _0xd33a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','/:id','delete','exports','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd33a,0x7c));var _0xad33=function(_0x188d66,_0x2df5ad){_0x188d66=_0x188d66-0x0;var _0x15b1e2=_0xd33a[_0x188d66];return _0x15b1e2;};'use strict';var multer=require('multer');var util=require(_0xad33('0x0'));var path=require(_0xad33('0x1'));var timeout=require(_0xad33('0x2'));var express=require('express');var router=express[_0xad33('0x3')]();var fs_extra=require(_0xad33('0x4'));var auth=require(_0xad33('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xad33('0x6'));var controller=require(_0xad33('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xad33('0x8')]);router[_0xad33('0x9')](_0xad33('0xa'),auth[_0xad33('0xb')](),controller[_0xad33('0xc')]);router[_0xad33('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad33('0xd')]);router[_0xad33('0xe')]('/',auth[_0xad33('0xb')](),controller['create']);router['put'](_0xad33('0xf'),auth[_0xad33('0xb')](),controller['update']);router[_0xad33('0x10')]('/:id',auth[_0xad33('0xb')](),controller['destroy']);module[_0xad33('0x11')]=router; \ No newline at end of file +var _0x0c10=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x2d5f36,_0xb24d71){var _0x910218=function(_0x1c71ba){while(--_0x1c71ba){_0x2d5f36['push'](_0x2d5f36['shift']());}};_0x910218(++_0xb24d71);}(_0x0c10,0x152));var _0x00c1=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0x0c10[_0x2ac4af];return _0x3a36df;};'use strict';var multer=require(_0x00c1('0x0'));var util=require(_0x00c1('0x1'));var path=require(_0x00c1('0x2'));var timeout=require(_0x00c1('0x3'));var express=require('express');var router=express[_0x00c1('0x4')]();var fs_extra=require(_0x00c1('0x5'));var auth=require(_0x00c1('0x6'));var interaction=require(_0x00c1('0x7'));var config=require(_0x00c1('0x8'));var controller=require(_0x00c1('0x9'));router[_0x00c1('0xa')]('/',auth[_0x00c1('0xb')](),controller[_0x00c1('0xc')]);router[_0x00c1('0xa')](_0x00c1('0xd'),auth[_0x00c1('0xb')](),controller[_0x00c1('0xe')]);router[_0x00c1('0xa')](_0x00c1('0xf'),auth['isAuthenticated'](),controller[_0x00c1('0x10')]);router['post']('/',auth[_0x00c1('0xb')](),controller[_0x00c1('0x11')]);router[_0x00c1('0x12')](_0x00c1('0xf'),auth[_0x00c1('0xb')](),controller['update']);router[_0x00c1('0x13')](_0x00c1('0xf'),auth[_0x00c1('0xb')](),controller['destroy']);module[_0x00c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 49947c6..61f7865 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 _0x6759=['STRING','DATE','moment','exports'];(function(_0x34eeb0,_0xd2e77){var _0xab1084=function(_0xeb4007){while(--_0xeb4007){_0x34eeb0['push'](_0x34eeb0['shift']());}};_0xab1084(++_0xd2e77);}(_0x6759,0x126));var _0x9675=function(_0x3a6c22,_0x25539e){_0x3a6c22=_0x3a6c22-0x0;var _0x61930a=_0x6759[_0x3a6c22];return _0x61930a;};'use strict';var moment=require(_0x9675('0x0'));var Sequelize=require('sequelize');module[_0x9675('0x1')]={'uniqueid':{'type':Sequelize[_0x9675('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9675('0x2')]},'joinAt':{'type':Sequelize[_0x9675('0x3')]},'leaveAt':{'type':Sequelize[_0x9675('0x3')]},'acceptAt':{'type':Sequelize[_0x9675('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9675('0x2')]}}; \ No newline at end of file +var _0x9a0b=['exports','STRING','DATE'];(function(_0x3fb1b9,_0x5ba4dd){var _0x2ae401=function(_0x5bd3a8){while(--_0x5bd3a8){_0x3fb1b9['push'](_0x3fb1b9['shift']());}};_0x2ae401(++_0x5ba4dd);}(_0x9a0b,0xff));var _0xb9a0=function(_0x120538,_0x3a2cbc){_0x120538=_0x120538-0x0;var _0x3186c0=_0x9a0b[_0x120538];return _0x3186c0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb9a0('0x0')]={'uniqueid':{'type':Sequelize[_0xb9a0('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb9a0('0x2')]},'leaveAt':{'type':Sequelize[_0xb9a0('0x2')]},'acceptAt':{'type':Sequelize[_0xb9a0('0x2')]},'exitAt':{'type':Sequelize[_0xb9a0('0x2')]},'reason':{'type':Sequelize[_0xb9a0('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 71769ba..3c35dc4 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 _0x101c=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','end','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0xedea6a,_0x23fa84){var _0x3bc2f8=function(_0x2f5644){while(--_0x2f5644){_0xedea6a['push'](_0xedea6a['shift']());}};_0x3bc2f8(++_0x23fa84);}(_0x101c,0xd6));var _0xc101=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x101c[_0x59ae8f];return _0x3900b5;};'use strict';var emlformat=require(_0xc101('0x0'));var rimraf=require(_0xc101('0x1'));var zipdir=require(_0xc101('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc101('0x3'));var moment=require(_0xc101('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc101('0x5'));var sox=require(_0xc101('0x6'));var csv=require(_0xc101('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc101('0x8'));var _=require('lodash');var squel=require(_0xc101('0x9'));var crypto=require(_0xc101('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc101('0xb'));var toCsv=require(_0xc101('0x7'));var querystring=require(_0xc101('0xc'));var Papa=require(_0xc101('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc101('0xe'));var as=require(_0xc101('0xf'));var hardwareService=require(_0xc101('0x10'));var logger=require(_0xc101('0x11'))(_0xc101('0x12'));var utils=require('../../config/utils');var config=require(_0xc101('0x13'));var licenseUtil=require(_0xc101('0x14'));var db=require(_0xc101('0x15'))['db'];function respondWithStatusCode(_0x56d34e,_0x9058b7){_0x9058b7=_0x9058b7||0xcc;return function(_0x4d6ae8){if(_0x4d6ae8){return _0x56d34e['sendStatus'](_0x9058b7);}return _0x56d34e['status'](_0x9058b7)['end']();};}function respondWithResult(_0x247b8b,_0x3dc446){_0x3dc446=_0x3dc446||0xc8;return function(_0x2b5b44){if(_0x2b5b44){return _0x247b8b[_0xc101('0x16')](_0x3dc446)[_0xc101('0x17')](_0x2b5b44);}};}function respondWithFilteredResult(_0x18c072,_0x10b9ee){return function(_0x83a9f7){if(_0x83a9f7){var _0x3f20bd=typeof _0x10b9ee[_0xc101('0x18')]==='undefined'&&typeof _0x10b9ee['limit']===_0xc101('0x19');var _0x21f5d2=_0x83a9f7[_0xc101('0x1a')];var _0x3f45e4=_0x3f20bd?0x0:_0x10b9ee['offset'];var _0x1195b6=_0x3f20bd?_0x83a9f7[_0xc101('0x1a')]:_0x10b9ee[_0xc101('0x18')]+_0x10b9ee[_0xc101('0x1b')];var _0x410aa9;if(_0x1195b6>=_0x21f5d2){_0x1195b6=_0x21f5d2;_0x410aa9=0xc8;}else{_0x410aa9=0xce;}_0x18c072[_0xc101('0x16')](_0x410aa9);return _0x18c072[_0xc101('0x1c')](_0xc101('0x1d'),_0x3f45e4+'-'+_0x1195b6+'/'+_0x21f5d2)[_0xc101('0x17')](_0x83a9f7);}return null;};}function patchUpdates(_0x625714){return function(_0x5ccee3){try{jsonpatch[_0xc101('0x1e')](_0x5ccee3,_0x625714,!![]);}catch(_0x347ec5){return BPromise[_0xc101('0x1f')](_0x347ec5);}return _0x5ccee3['save']();};}function saveUpdates(_0x3a0bec,_0x3cbdcb){return function(_0x5143b6){if(_0x5143b6){return _0x5143b6['update'](_0x3a0bec)['then'](function(_0x129c8c){return _0x129c8c;});}return null;};}function removeEntity(_0x19e8bb,_0xfd6ea5){return function(_0x1c61b6){if(_0x1c61b6){return _0x1c61b6[_0xc101('0x20')]()[_0xc101('0x21')](function(){_0x19e8bb['status'](0xcc)[_0xc101('0x22')]();});}};}function handleEntityNotFound(_0x51f3f8,_0x16c4f0){return function(_0x3c6a48){if(!_0x3c6a48){_0x51f3f8[_0xc101('0x23')](0x194);}return _0x3c6a48;};}function handleError(_0x5b30b6,_0x217c52){_0x217c52=_0x217c52||0x1f4;return function(_0x4d141a){logger[_0xc101('0x24')](_0x4d141a[_0xc101('0x25')]);if(_0x4d141a[_0xc101('0x26')]){delete _0x4d141a[_0xc101('0x26')];}_0x5b30b6[_0xc101('0x16')](_0x217c52)['send'](_0x4d141a);};}exports[_0xc101('0x27')]=function(_0x374dc7,_0x2ba4dd){var _0x48d646={},_0x2d1c85={},_0x146eb0={'count':0x0,'rows':[]};var _0x28b580=_[_0xc101('0x28')](db[_0xc101('0x29')][_0xc101('0x2a')],function(_0x4a67f2){return{'name':_0x4a67f2[_0xc101('0x2b')],'type':_0x4a67f2[_0xc101('0x2c')][_0xc101('0x2d')]};});_0x2d1c85[_0xc101('0x2e')]=_[_0xc101('0x28')](_0x28b580,'name');_0x2d1c85['query']=_[_0xc101('0x2f')](_0x374dc7[_0xc101('0x30')]);_0x2d1c85[_0xc101('0x31')]=_['intersection'](_0x2d1c85[_0xc101('0x2e')],_0x2d1c85[_0xc101('0x30')]);_0x48d646[_0xc101('0x32')]=_[_0xc101('0x33')](_0x2d1c85[_0xc101('0x2e')],qs[_0xc101('0x34')](_0x374dc7[_0xc101('0x30')][_0xc101('0x34')]));_0x48d646[_0xc101('0x32')]=_0x48d646[_0xc101('0x32')][_0xc101('0x35')]?_0x48d646[_0xc101('0x32')]:_0x2d1c85[_0xc101('0x2e')];if(!_0x374dc7['query'][_0xc101('0x36')](_0xc101('0x37'))){_0x48d646['limit']=qs[_0xc101('0x1b')](_0x374dc7[_0xc101('0x30')][_0xc101('0x1b')]);_0x48d646['offset']=qs[_0xc101('0x18')](_0x374dc7[_0xc101('0x30')]['offset']);}_0x48d646[_0xc101('0x38')]=qs[_0xc101('0x39')](_0x374dc7['query'][_0xc101('0x39')]);_0x48d646[_0xc101('0x3a')]=qs[_0xc101('0x31')](_[_0xc101('0x3b')](_0x374dc7['query'],_0x2d1c85[_0xc101('0x31')]),_0x28b580);if(_0x374dc7[_0xc101('0x30')][_0xc101('0x3c')]){_0x48d646[_0xc101('0x3a')]=_[_0xc101('0x3d')](_0x48d646[_0xc101('0x3a')],{'$or':_['map'](_0x28b580,function(_0x2e3d0c){if(_0x2e3d0c[_0xc101('0x2c')]!==_0xc101('0x3e')){var _0x35ae8a={};_0x35ae8a[_0x2e3d0c[_0xc101('0x26')]]={'$like':'%'+_0x374dc7[_0xc101('0x30')]['filter']+'%'};return _0x35ae8a;}})});}_0x48d646=_[_0xc101('0x3d')]({},_0x48d646,_0x374dc7[_0xc101('0x3f')]);var _0x2235a7={'where':_0x48d646[_0xc101('0x3a')]};return db[_0xc101('0x29')][_0xc101('0x1a')](_0x2235a7)[_0xc101('0x21')](function(_0xbbbcf5){_0x146eb0[_0xc101('0x1a')]=_0xbbbcf5;if(_0x374dc7['query'][_0xc101('0x40')]){_0x48d646[_0xc101('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xc101('0x42')](_0x48d646);})[_0xc101('0x21')](function(_0x3ff552){_0x146eb0[_0xc101('0x43')]=_0x3ff552;return _0x146eb0;})[_0xc101('0x21')](respondWithFilteredResult(_0x2ba4dd,_0x48d646))[_0xc101('0x44')](handleError(_0x2ba4dd,null));};exports['show']=function(_0x547aae,_0xd8a717){var _0x2cbe28={'raw':!![],'where':{'id':_0x547aae[_0xc101('0x45')]['id']}},_0x31f137={};_0x31f137[_0xc101('0x2e')]=_[_0xc101('0x2f')](db[_0xc101('0x29')][_0xc101('0x2a')]);_0x31f137[_0xc101('0x30')]=_[_0xc101('0x2f')](_0x547aae['query']);_0x31f137[_0xc101('0x31')]=_[_0xc101('0x33')](_0x31f137[_0xc101('0x2e')],_0x31f137[_0xc101('0x30')]);_0x2cbe28[_0xc101('0x32')]=_['intersection'](_0x31f137['model'],qs['fields'](_0x547aae['query'][_0xc101('0x34')]));_0x2cbe28['attributes']=_0x2cbe28[_0xc101('0x32')][_0xc101('0x35')]?_0x2cbe28['attributes']:_0x31f137['model'];if(_0x547aae[_0xc101('0x30')][_0xc101('0x40')]){_0x2cbe28[_0xc101('0x41')]=[{'all':!![]}];}_0x2cbe28=_[_0xc101('0x3d')]({},_0x2cbe28,_0x547aae[_0xc101('0x3f')]);return db[_0xc101('0x29')]['find'](_0x2cbe28)[_0xc101('0x21')](handleEntityNotFound(_0xd8a717,null))[_0xc101('0x21')](respondWithResult(_0xd8a717,null))['catch'](handleError(_0xd8a717,null));};exports[_0xc101('0x46')]=function(_0x17176,_0x3ac568){return db[_0xc101('0x29')][_0xc101('0x46')](_0x17176['body'],{})[_0xc101('0x21')](respondWithResult(_0x3ac568,0xc9))[_0xc101('0x44')](handleError(_0x3ac568,null));};exports[_0xc101('0x47')]=function(_0x30aac3,_0x26d34a){if(_0x30aac3[_0xc101('0x48')]['id']){delete _0x30aac3[_0xc101('0x48')]['id'];}return db[_0xc101('0x29')][_0xc101('0x49')]({'where':{'id':_0x30aac3[_0xc101('0x45')]['id']}})['then'](handleEntityNotFound(_0x26d34a,null))['then'](saveUpdates(_0x30aac3[_0xc101('0x48')],null))[_0xc101('0x21')](respondWithResult(_0x26d34a,null))[_0xc101('0x44')](handleError(_0x26d34a,null));};exports[_0xc101('0x20')]=function(_0x5e68fe,_0x13333c){return db[_0xc101('0x29')][_0xc101('0x49')]({'where':{'id':_0x5e68fe[_0xc101('0x45')]['id']}})[_0xc101('0x21')](handleEntityNotFound(_0x13333c,null))[_0xc101('0x21')](removeEntity(_0x13333c,null))[_0xc101('0x44')](handleError(_0x13333c,null));};exports['describe']=function(_0x3c6d17,_0x7e936c){return db[_0xc101('0x29')][_0xc101('0x4a')]()['then'](respondWithResult(_0x7e936c,null))[_0xc101('0x44')](handleError(_0x7e936c,null));}; \ No newline at end of file +var _0x08d8=['apply','save','update','destroy','then','error','stack','name','index','map','OpenchannelQueueReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08d8,0x10d));var _0x808d=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x08d8[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0x808d('0x0'));var rimraf=require(_0x808d('0x1'));var zipdir=require(_0x808d('0x2'));var jsonpatch=require(_0x808d('0x3'));var rp=require(_0x808d('0x4'));var moment=require(_0x808d('0x5'));var BPromise=require(_0x808d('0x6'));var Mustache=require(_0x808d('0x7'));var util=require(_0x808d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x808d('0x9'));var ejs=require(_0x808d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x808d('0xb'));var crypto=require(_0x808d('0xc'));var jsforce=require(_0x808d('0xd'));var deskjs=require(_0x808d('0xe'));var toCsv=require(_0x808d('0x9'));var querystring=require(_0x808d('0xf'));var Papa=require(_0x808d('0x10'));var Redis=require(_0x808d('0x11'));var authService=require(_0x808d('0x12'));var qs=require(_0x808d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x808d('0x14'));var logger=require(_0x808d('0x15'))(_0x808d('0x16'));var utils=require('../../config/utils');var config=require(_0x808d('0x17'));var licenseUtil=require(_0x808d('0x18'));var db=require(_0x808d('0x19'))['db'];function respondWithStatusCode(_0x45db11,_0x345c55){_0x345c55=_0x345c55||0xcc;return function(_0x5ba3e5){if(_0x5ba3e5){return _0x45db11[_0x808d('0x1a')](_0x345c55);}return _0x45db11[_0x808d('0x1b')](_0x345c55)[_0x808d('0x1c')]();};}function respondWithResult(_0x567a3c,_0x56eab1){_0x56eab1=_0x56eab1||0xc8;return function(_0x3c97f2){if(_0x3c97f2){return _0x567a3c[_0x808d('0x1b')](_0x56eab1)[_0x808d('0x1d')](_0x3c97f2);}};}function respondWithFilteredResult(_0x3899f9,_0x5908f8){return function(_0x4b9b4c){if(_0x4b9b4c){var _0x28f3a4=typeof _0x5908f8[_0x808d('0x1e')]===_0x808d('0x1f')&&typeof _0x5908f8[_0x808d('0x20')]===_0x808d('0x1f');var _0x3888ba=_0x4b9b4c[_0x808d('0x21')];var _0x1604fc=_0x28f3a4?0x0:_0x5908f8[_0x808d('0x1e')];var _0x232297=_0x28f3a4?_0x4b9b4c[_0x808d('0x21')]:_0x5908f8[_0x808d('0x1e')]+_0x5908f8[_0x808d('0x20')];var _0x14247d;if(_0x232297>=_0x3888ba){_0x232297=_0x3888ba;_0x14247d=0xc8;}else{_0x14247d=0xce;}_0x3899f9['status'](_0x14247d);return _0x3899f9['set'](_0x808d('0x22'),_0x1604fc+'-'+_0x232297+'/'+_0x3888ba)[_0x808d('0x1d')](_0x4b9b4c);}return null;};}function patchUpdates(_0x4c7648){return function(_0x559188){try{jsonpatch[_0x808d('0x23')](_0x559188,_0x4c7648,!![]);}catch(_0x519a22){return BPromise['reject'](_0x519a22);}return _0x559188[_0x808d('0x24')]();};}function saveUpdates(_0x40757d,_0x221056){return function(_0x16f3cc){if(_0x16f3cc){return _0x16f3cc[_0x808d('0x25')](_0x40757d)['then'](function(_0x5a4aa6){return _0x5a4aa6;});}return null;};}function removeEntity(_0x57a183,_0x41dc47){return function(_0x3391cb){if(_0x3391cb){return _0x3391cb[_0x808d('0x26')]()[_0x808d('0x27')](function(){_0x57a183[_0x808d('0x1b')](0xcc)[_0x808d('0x1c')]();});}};}function handleEntityNotFound(_0x14883e,_0x492446){return function(_0x18537f){if(!_0x18537f){_0x14883e[_0x808d('0x1a')](0x194);}return _0x18537f;};}function handleError(_0xc54eaa,_0x3ab4f1){_0x3ab4f1=_0x3ab4f1||0x1f4;return function(_0x3d2e67){logger[_0x808d('0x28')](_0x3d2e67[_0x808d('0x29')]);if(_0x3d2e67[_0x808d('0x2a')]){delete _0x3d2e67['name'];}_0xc54eaa['status'](_0x3ab4f1)['send'](_0x3d2e67);};}exports[_0x808d('0x2b')]=function(_0x44262a,_0x2adb7a){var _0x16ab8f={},_0x1f26b3={},_0x48fa0a={'count':0x0,'rows':[]};var _0x3eb6d1=_[_0x808d('0x2c')](db[_0x808d('0x2d')]['rawAttributes'],function(_0x3a6a9e){return{'name':_0x3a6a9e[_0x808d('0x2e')],'type':_0x3a6a9e['type']['key']};});_0x1f26b3['model']=_[_0x808d('0x2c')](_0x3eb6d1,_0x808d('0x2a'));_0x1f26b3[_0x808d('0x2f')]=_[_0x808d('0x30')](_0x44262a[_0x808d('0x2f')]);_0x1f26b3[_0x808d('0x31')]=_[_0x808d('0x32')](_0x1f26b3[_0x808d('0x33')],_0x1f26b3[_0x808d('0x2f')]);_0x16ab8f[_0x808d('0x34')]=_[_0x808d('0x32')](_0x1f26b3['model'],qs['fields'](_0x44262a[_0x808d('0x2f')][_0x808d('0x35')]));_0x16ab8f['attributes']=_0x16ab8f[_0x808d('0x34')][_0x808d('0x36')]?_0x16ab8f[_0x808d('0x34')]:_0x1f26b3[_0x808d('0x33')];if(!_0x44262a[_0x808d('0x2f')][_0x808d('0x37')](_0x808d('0x38'))){_0x16ab8f[_0x808d('0x20')]=qs[_0x808d('0x20')](_0x44262a[_0x808d('0x2f')][_0x808d('0x20')]);_0x16ab8f[_0x808d('0x1e')]=qs[_0x808d('0x1e')](_0x44262a[_0x808d('0x2f')][_0x808d('0x1e')]);}_0x16ab8f['order']=qs[_0x808d('0x39')](_0x44262a[_0x808d('0x2f')]['sort']);_0x16ab8f['where']=qs[_0x808d('0x31')](_[_0x808d('0x3a')](_0x44262a[_0x808d('0x2f')],_0x1f26b3[_0x808d('0x31')]),_0x3eb6d1);if(_0x44262a[_0x808d('0x2f')]['filter']){_0x16ab8f[_0x808d('0x3b')]=_[_0x808d('0x3c')](_0x16ab8f[_0x808d('0x3b')],{'$or':_['map'](_0x3eb6d1,function(_0x439b88){if(_0x439b88[_0x808d('0x3d')]!=='VIRTUAL'){var _0x5aa651={};_0x5aa651[_0x439b88[_0x808d('0x2a')]]={'$like':'%'+_0x44262a['query'][_0x808d('0x3e')]+'%'};return _0x5aa651;}})});}_0x16ab8f=_[_0x808d('0x3c')]({},_0x16ab8f,_0x44262a[_0x808d('0x3f')]);var _0x1c5ccf={'where':_0x16ab8f[_0x808d('0x3b')]};return db[_0x808d('0x2d')][_0x808d('0x21')](_0x1c5ccf)[_0x808d('0x27')](function(_0x51ceb8){_0x48fa0a[_0x808d('0x21')]=_0x51ceb8;if(_0x44262a['query']['includeAll']){_0x16ab8f[_0x808d('0x40')]=[{'all':!![]}];}return db[_0x808d('0x2d')][_0x808d('0x41')](_0x16ab8f);})[_0x808d('0x27')](function(_0x2f05bf){_0x48fa0a[_0x808d('0x42')]=_0x2f05bf;return _0x48fa0a;})[_0x808d('0x27')](respondWithFilteredResult(_0x2adb7a,_0x16ab8f))[_0x808d('0x43')](handleError(_0x2adb7a,null));};exports[_0x808d('0x44')]=function(_0x5c6e4f,_0x5d9802){var _0x1bcc49={'raw':!![],'where':{'id':_0x5c6e4f[_0x808d('0x45')]['id']}},_0x3e95a9={};_0x3e95a9[_0x808d('0x33')]=_['keys'](db[_0x808d('0x2d')][_0x808d('0x46')]);_0x3e95a9[_0x808d('0x2f')]=_[_0x808d('0x30')](_0x5c6e4f[_0x808d('0x2f')]);_0x3e95a9['filters']=_[_0x808d('0x32')](_0x3e95a9[_0x808d('0x33')],_0x3e95a9['query']);_0x1bcc49[_0x808d('0x34')]=_[_0x808d('0x32')](_0x3e95a9[_0x808d('0x33')],qs['fields'](_0x5c6e4f[_0x808d('0x2f')]['fields']));_0x1bcc49[_0x808d('0x34')]=_0x1bcc49[_0x808d('0x34')][_0x808d('0x36')]?_0x1bcc49['attributes']:_0x3e95a9[_0x808d('0x33')];if(_0x5c6e4f[_0x808d('0x2f')][_0x808d('0x47')]){_0x1bcc49[_0x808d('0x40')]=[{'all':!![]}];}_0x1bcc49=_[_0x808d('0x3c')]({},_0x1bcc49,_0x5c6e4f[_0x808d('0x3f')]);return db[_0x808d('0x2d')][_0x808d('0x48')](_0x1bcc49)['then'](handleEntityNotFound(_0x5d9802,null))[_0x808d('0x27')](respondWithResult(_0x5d9802,null))[_0x808d('0x43')](handleError(_0x5d9802,null));};exports[_0x808d('0x49')]=function(_0x1b216b,_0x180cb3){return db[_0x808d('0x2d')][_0x808d('0x49')](_0x1b216b[_0x808d('0x4a')],{})[_0x808d('0x27')](respondWithResult(_0x180cb3,0xc9))[_0x808d('0x43')](handleError(_0x180cb3,null));};exports[_0x808d('0x25')]=function(_0x3bbfdd,_0x10d7fc){if(_0x3bbfdd[_0x808d('0x4a')]['id']){delete _0x3bbfdd[_0x808d('0x4a')]['id'];}return db[_0x808d('0x2d')][_0x808d('0x48')]({'where':{'id':_0x3bbfdd[_0x808d('0x45')]['id']}})['then'](handleEntityNotFound(_0x10d7fc,null))[_0x808d('0x27')](saveUpdates(_0x3bbfdd[_0x808d('0x4a')],null))[_0x808d('0x27')](respondWithResult(_0x10d7fc,null))[_0x808d('0x43')](handleError(_0x10d7fc,null));};exports[_0x808d('0x26')]=function(_0x258a35,_0x2b636d){return db[_0x808d('0x2d')][_0x808d('0x48')]({'where':{'id':_0x258a35[_0x808d('0x45')]['id']}})[_0x808d('0x27')](handleEntityNotFound(_0x2b636d,null))[_0x808d('0x27')](removeEntity(_0x2b636d,null))[_0x808d('0x43')](handleError(_0x2b636d,null));};exports[_0x808d('0x4b')]=function(_0x590b3d,_0x2897cf){return db[_0x808d('0x2d')][_0x808d('0x4b')]()[_0x808d('0x27')](respondWithResult(_0x2897cf,null))[_0x808d('0x43')](handleError(_0x2897cf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9c3f37f..eb3c5a9 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(_0x3317be,_0x5492d3){var _0xb81899=function(_0x4c00d2){while(--_0x4c00d2){_0x3317be['push'](_0x3317be['shift']());}};_0xb81899(++_0x5492d3);}(_0x1261,0x144));var _0x1126=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x1261[_0x3b632f];return _0x10e788;};'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(_0x363511,_0x209b25){var _0x404c72=function(_0x368f80){while(--_0x368f80){_0x363511['push'](_0x363511['shift']());}};_0x404c72(++_0x209b25);}(_0x1261,0x144));var _0x1126=function(_0x27a5bb,_0x3f4cfb){_0x27a5bb=_0x27a5bb-0x0;var _0x2e17ea=_0x1261[_0x27a5bb];return _0x2e17ea;};'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 6f0a516..a1658ac 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 _0x1b0e=['create','options','raw','stringify','OpenchannelQueueReport','update','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1b0e,0x132));var _0xe1b0=function(_0x32cd68,_0x502595){_0x32cd68=_0x32cd68-0x0;var _0x309748=_0x1b0e[_0x32cd68];return _0x309748;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['OpenchannelQueueReport'][_0xe1b0('0x18')](_0x2928b6['body'],{'raw':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e0a89){logger[_0xe1b0('0xd')]('CreateOpenchannelQueueReport',_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x1b')](_0x3e0a89));_0x5c195f(_0x3e0a89);})['catch'](function(_0x3c0824){logger['error']('CreateOpenchannelQueueReport',_0x3c0824['message'],_0x2928b6);_0x5b300e(_0x349f90['error'](0x1f4,_0x3c0824[_0xe1b0('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x289ed3){var _0x28e39a=this;return new Promise(function(_0x37d006,_0x55a2be){return db[_0xe1b0('0x1c')][_0xe1b0('0x1d')](_0x289ed3['body'],{'raw':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')]['where']||null:null,'attributes':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1e')]||null:null,'limit':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1f')]||null:null})[_0xe1b0('0xc')](function(_0x1c19cd){logger['info'](_0xe1b0('0x20'),_0x289ed3);logger[_0xe1b0('0x10')]('UpdateOpenchannelQueueReport',_0x289ed3,JSON[_0xe1b0('0x1b')](_0x1c19cd));_0x37d006(_0x1c19cd);})[_0xe1b0('0x16')](function(_0x4a01d8){logger['error'](_0xe1b0('0x20'),_0x4a01d8[_0xe1b0('0x14')],_0x289ed3);_0x55a2be(_0x28e39a[_0xe1b0('0x12')](0x1f4,_0x4a01d8[_0xe1b0('0x14')]));});});}; \ No newline at end of file +var _0xfff0=['../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','where','attributes','limit','info','UpdateOpenchannelQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1ce859,_0x46401e){var _0x2150f5=function(_0x51b6cf){while(--_0x51b6cf){_0x1ce859['push'](_0x1ce859['shift']());}};_0x2150f5(++_0x46401e);}(_0xfff0,0x139));var _0x0fff=function(_0x114b2b,_0x6b7d2f){_0x114b2b=_0x114b2b-0x0;var _0x36db44=_0xfff0[_0x114b2b];return _0x36db44;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['CreateOpenchannelQueueReport']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')](_0x48f36d[_0x0fff('0x16')],{'raw':_0x48f36d['options']?_0x48f36d[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![]})[_0x0fff('0xa')](function(_0x49d211){logger['info'](_0x0fff('0x19'),_0x48f36d);logger[_0x0fff('0xd')](_0x0fff('0x19'),_0x48f36d,JSON[_0x0fff('0xf')](_0x49d211));_0x606792(_0x49d211);})['catch'](function(_0x155132){logger[_0x0fff('0x10')](_0x0fff('0x19'),_0x155132[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f[_0x0fff('0x10')](0x1f4,_0x155132[_0x0fff('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x6a116c){var _0x29f702=this;return new Promise(function(_0x37e090,_0x24cd18){return db[_0x0fff('0x14')][_0x0fff('0x1a')](_0x6a116c['body'],{'raw':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1b')]||null:null,'attributes':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1c')]||null:null,'limit':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1d')]||null:null})['then'](function(_0x7046a3){logger[_0x0fff('0x1e')](_0x0fff('0x1f'),_0x6a116c);logger[_0x0fff('0xd')](_0x0fff('0x1f'),_0x6a116c,JSON[_0x0fff('0xf')](_0x7046a3));_0x37e090(_0x7046a3);})['catch'](function(_0x31f9a4){logger[_0x0fff('0x10')](_0x0fff('0x1f'),_0x31f9a4['message'],_0x6a116c);_0x24cd18(_0x29f702[_0x0fff('0x10')](0x1f4,_0x31f9a4[_0x0fff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 28dab44..cab7262 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 _0x22ff=['util','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1bc9ce,_0x14e561){var _0x2d4a74=function(_0x51c8fd){while(--_0x51c8fd){_0x1bc9ce['push'](_0x1bc9ce['shift']());}};_0x2d4a74(++_0x14e561);}(_0x22ff,0x11d));var _0xf22f=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x22ff[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require('multer');var util=require(_0xf22f('0x0'));var path=require(_0xf22f('0x1'));var timeout=require(_0xf22f('0x2'));var express=require(_0xf22f('0x3'));var router=express['Router']();var fs_extra=require(_0xf22f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf22f('0x5'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xf22f('0x6')](),controller[_0xf22f('0x7')]);router[_0xf22f('0x8')](_0xf22f('0x9'),auth[_0xf22f('0x6')](),controller[_0xf22f('0xa')]);router['get'](_0xf22f('0xb'),auth[_0xf22f('0x6')](),controller[_0xf22f('0xc')]);router[_0xf22f('0xd')]('/',auth[_0xf22f('0x6')](),controller[_0xf22f('0xe')]);router[_0xf22f('0xf')]('/:id',auth[_0xf22f('0x6')](),controller[_0xf22f('0x10')]);router[_0xf22f('0x11')](_0xf22f('0xb'),auth[_0xf22f('0x6')](),controller[_0xf22f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd180=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd180,0x18e));var _0x0d18=function(_0x4faf96,_0x1db35c){_0x4faf96=_0x4faf96-0x0;var _0x28ff12=_0xd180[_0x4faf96];return _0x28ff12;};'use strict';var multer=require('multer');var util=require(_0x0d18('0x0'));var path=require(_0x0d18('0x1'));var timeout=require(_0x0d18('0x2'));var express=require(_0x0d18('0x3'));var router=express[_0x0d18('0x4')]();var fs_extra=require(_0x0d18('0x5'));var auth=require(_0x0d18('0x6'));var interaction=require(_0x0d18('0x7'));var config=require(_0x0d18('0x8'));var controller=require(_0x0d18('0x9'));router[_0x0d18('0xa')]('/',auth[_0x0d18('0xb')](),controller[_0x0d18('0xc')]);router[_0x0d18('0xa')](_0x0d18('0xd'),auth[_0x0d18('0xb')](),controller[_0x0d18('0xe')]);router['get']('/:id',auth[_0x0d18('0xb')](),controller[_0x0d18('0xf')]);router[_0x0d18('0x10')]('/',auth['isAuthenticated'](),controller[_0x0d18('0x11')]);router[_0x0d18('0x12')](_0x0d18('0x13'),auth[_0x0d18('0xb')](),controller[_0x0d18('0x14')]);router[_0x0d18('0x15')](_0x0d18('0x13'),auth[_0x0d18('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f3ae796..a12210d 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x7f9387,_0x299a12){var _0x3d07f1=function(_0x24feef){while(--_0x24feef){_0x7f9387['push'](_0x7f9387['shift']());}};_0x3d07f1(++_0x299a12);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x401ec9,_0x77c73f){var _0x8ef3a1=function(_0x171c3c){while(--_0x171c3c){_0x401ec9['push'](_0x401ec9['shift']());}};_0x8ef3a1(++_0x77c73f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x4b84[_0x5d0609];return _0xaa3fd1;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index fb2de2d..cfe305e 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 _0xdb74=['where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','nolimit','order','sort'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xdb74,0xf5));var _0x4db7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdb74[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x4db7('0x0'));var rimraf=require(_0x4db7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4db7('0x2'));var moment=require(_0x4db7('0x3'));var BPromise=require(_0x4db7('0x4'));var Mustache=require(_0x4db7('0x5'));var util=require(_0x4db7('0x6'));var path=require(_0x4db7('0x7'));var sox=require(_0x4db7('0x8'));var csv=require(_0x4db7('0x9'));var ejs=require(_0x4db7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4db7('0xb'));var crypto=require('crypto');var jsforce=require(_0x4db7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4db7('0x9'));var querystring=require(_0x4db7('0xd'));var Papa=require(_0x4db7('0xe'));var Redis=require(_0x4db7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4db7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4db7('0x11'));var logger=require(_0x4db7('0x12'))(_0x4db7('0x13'));var utils=require(_0x4db7('0x14'));var config=require(_0x4db7('0x15'));var licenseUtil=require(_0x4db7('0x16'));var db=require(_0x4db7('0x17'))['db'];function respondWithStatusCode(_0x729a40,_0x2d303c){_0x2d303c=_0x2d303c||0xcc;return function(_0x112f04){if(_0x112f04){return _0x729a40['sendStatus'](_0x2d303c);}return _0x729a40['status'](_0x2d303c)['end']();};}function respondWithResult(_0xf9463d,_0x1afafe){_0x1afafe=_0x1afafe||0xc8;return function(_0x628e7d){if(_0x628e7d){return _0xf9463d[_0x4db7('0x18')](_0x1afafe)[_0x4db7('0x19')](_0x628e7d);}};}function respondWithFilteredResult(_0x295e0b,_0x5cca2a){return function(_0x4fb99e){if(_0x4fb99e){var _0x512ed2=typeof _0x5cca2a[_0x4db7('0x1a')]===_0x4db7('0x1b')&&typeof _0x5cca2a['limit']===_0x4db7('0x1b');var _0x3ad484=_0x4fb99e[_0x4db7('0x1c')];var _0x2b3783=_0x512ed2?0x0:_0x5cca2a[_0x4db7('0x1a')];var _0x1df05c=_0x512ed2?_0x4fb99e[_0x4db7('0x1c')]:_0x5cca2a[_0x4db7('0x1a')]+_0x5cca2a[_0x4db7('0x1d')];var _0x2ed38f;if(_0x1df05c>=_0x3ad484){_0x1df05c=_0x3ad484;_0x2ed38f=0xc8;}else{_0x2ed38f=0xce;}_0x295e0b[_0x4db7('0x18')](_0x2ed38f);return _0x295e0b['set'](_0x4db7('0x1e'),_0x2b3783+'-'+_0x1df05c+'/'+_0x3ad484)['json'](_0x4fb99e);}return null;};}function patchUpdates(_0x2941a6){return function(_0x5c202e){try{jsonpatch[_0x4db7('0x1f')](_0x5c202e,_0x2941a6,!![]);}catch(_0x4c5845){return BPromise['reject'](_0x4c5845);}return _0x5c202e[_0x4db7('0x20')]();};}function saveUpdates(_0x4c67e8,_0x4cbb35){return function(_0x44cbe7){if(_0x44cbe7){return _0x44cbe7[_0x4db7('0x21')](_0x4c67e8)[_0x4db7('0x22')](function(_0x5de5f2){return _0x5de5f2;});}return null;};}function removeEntity(_0x5e92ac,_0x3ab62b){return function(_0x40044b){if(_0x40044b){return _0x40044b[_0x4db7('0x23')]()['then'](function(){_0x5e92ac[_0x4db7('0x18')](0xcc)[_0x4db7('0x24')]();});}};}function handleEntityNotFound(_0x135542,_0x2009d6){return function(_0xd9a1ff){if(!_0xd9a1ff){_0x135542[_0x4db7('0x25')](0x194);}return _0xd9a1ff;};}function handleError(_0x373196,_0x137a80){_0x137a80=_0x137a80||0x1f4;return function(_0x209381){logger[_0x4db7('0x26')](_0x209381[_0x4db7('0x27')]);if(_0x209381[_0x4db7('0x28')]){delete _0x209381[_0x4db7('0x28')];}_0x373196[_0x4db7('0x18')](_0x137a80)[_0x4db7('0x29')](_0x209381);};}exports['index']=function(_0x5cb920,_0x4ad61c){var _0x41f6c9={},_0x3b16ff={},_0x3f6c2b={'count':0x0,'rows':[]};var _0x15d1c1=_[_0x4db7('0x2a')](db[_0x4db7('0x2b')][_0x4db7('0x2c')],function(_0x496a2b){return{'name':_0x496a2b[_0x4db7('0x2d')],'type':_0x496a2b['type']['key']};});_0x3b16ff['model']=_['map'](_0x15d1c1,_0x4db7('0x28'));_0x3b16ff[_0x4db7('0x2e')]=_['keys'](_0x5cb920[_0x4db7('0x2e')]);_0x3b16ff['filters']=_[_0x4db7('0x2f')](_0x3b16ff[_0x4db7('0x30')],_0x3b16ff['query']);_0x41f6c9['attributes']=_[_0x4db7('0x2f')](_0x3b16ff[_0x4db7('0x30')],qs[_0x4db7('0x31')](_0x5cb920['query'][_0x4db7('0x31')]));_0x41f6c9[_0x4db7('0x32')]=_0x41f6c9[_0x4db7('0x32')][_0x4db7('0x33')]?_0x41f6c9[_0x4db7('0x32')]:_0x3b16ff[_0x4db7('0x30')];if(!_0x5cb920[_0x4db7('0x2e')]['hasOwnProperty'](_0x4db7('0x34'))){_0x41f6c9[_0x4db7('0x1d')]=qs[_0x4db7('0x1d')](_0x5cb920[_0x4db7('0x2e')][_0x4db7('0x1d')]);_0x41f6c9[_0x4db7('0x1a')]=qs[_0x4db7('0x1a')](_0x5cb920[_0x4db7('0x2e')]['offset']);}_0x41f6c9[_0x4db7('0x35')]=qs[_0x4db7('0x36')](_0x5cb920[_0x4db7('0x2e')]['sort']);_0x41f6c9[_0x4db7('0x37')]=qs[_0x4db7('0x38')](_[_0x4db7('0x39')](_0x5cb920['query'],_0x3b16ff[_0x4db7('0x38')]),_0x15d1c1);if(_0x5cb920[_0x4db7('0x2e')][_0x4db7('0x3a')]){_0x41f6c9[_0x4db7('0x37')]=_[_0x4db7('0x3b')](_0x41f6c9[_0x4db7('0x37')],{'$or':_['map'](_0x15d1c1,function(_0x158c56){if(_0x158c56[_0x4db7('0x3c')]!==_0x4db7('0x3d')){var _0x1dac69={};_0x1dac69[_0x158c56['name']]={'$like':'%'+_0x5cb920['query'][_0x4db7('0x3a')]+'%'};return _0x1dac69;}})});}_0x41f6c9=_['merge']({},_0x41f6c9,_0x5cb920[_0x4db7('0x3e')]);var _0x50af20={'where':_0x41f6c9[_0x4db7('0x37')]};return db[_0x4db7('0x2b')][_0x4db7('0x1c')](_0x50af20)[_0x4db7('0x22')](function(_0x1db29c){_0x3f6c2b[_0x4db7('0x1c')]=_0x1db29c;if(_0x5cb920['query'][_0x4db7('0x3f')]){_0x41f6c9[_0x4db7('0x40')]=[{'all':!![]}];}return db[_0x4db7('0x2b')][_0x4db7('0x41')](_0x41f6c9);})['then'](function(_0x3e8a2d){_0x3f6c2b[_0x4db7('0x42')]=_0x3e8a2d;return _0x3f6c2b;})['then'](respondWithFilteredResult(_0x4ad61c,_0x41f6c9))['catch'](handleError(_0x4ad61c,null));};exports[_0x4db7('0x43')]=function(_0x5834b9,_0x2cb383){var _0x3b1344={'raw':!![],'where':{'id':_0x5834b9[_0x4db7('0x44')]['id']}},_0x53f0d3={};_0x53f0d3['model']=_['keys'](db[_0x4db7('0x2b')][_0x4db7('0x2c')]);_0x53f0d3[_0x4db7('0x2e')]=_[_0x4db7('0x45')](_0x5834b9[_0x4db7('0x2e')]);_0x53f0d3[_0x4db7('0x38')]=_['intersection'](_0x53f0d3[_0x4db7('0x30')],_0x53f0d3['query']);_0x3b1344['attributes']=_[_0x4db7('0x2f')](_0x53f0d3['model'],qs['fields'](_0x5834b9['query'][_0x4db7('0x31')]));_0x3b1344[_0x4db7('0x32')]=_0x3b1344[_0x4db7('0x32')][_0x4db7('0x33')]?_0x3b1344[_0x4db7('0x32')]:_0x53f0d3[_0x4db7('0x30')];if(_0x5834b9[_0x4db7('0x2e')][_0x4db7('0x3f')]){_0x3b1344[_0x4db7('0x40')]=[{'all':!![]}];}_0x3b1344=_['merge']({},_0x3b1344,_0x5834b9[_0x4db7('0x3e')]);return db[_0x4db7('0x2b')][_0x4db7('0x46')](_0x3b1344)[_0x4db7('0x22')](handleEntityNotFound(_0x2cb383,null))[_0x4db7('0x22')](respondWithResult(_0x2cb383,null))[_0x4db7('0x47')](handleError(_0x2cb383,null));};exports[_0x4db7('0x48')]=function(_0x20cf71,_0x2ae375){return db[_0x4db7('0x2b')]['create'](_0x20cf71[_0x4db7('0x49')],{})[_0x4db7('0x22')](respondWithResult(_0x2ae375,0xc9))[_0x4db7('0x47')](handleError(_0x2ae375,null));};exports['update']=function(_0x33d3ac,_0x57d44e){if(_0x33d3ac[_0x4db7('0x49')]['id']){delete _0x33d3ac[_0x4db7('0x49')]['id'];}return db[_0x4db7('0x2b')][_0x4db7('0x46')]({'where':{'id':_0x33d3ac[_0x4db7('0x44')]['id']}})['then'](handleEntityNotFound(_0x57d44e,null))[_0x4db7('0x22')](saveUpdates(_0x33d3ac[_0x4db7('0x49')],null))[_0x4db7('0x22')](respondWithResult(_0x57d44e,null))['catch'](handleError(_0x57d44e,null));};exports[_0x4db7('0x23')]=function(_0x5c2cb9,_0x28456c){return db[_0x4db7('0x2b')][_0x4db7('0x46')]({'where':{'id':_0x5c2cb9[_0x4db7('0x44')]['id']}})[_0x4db7('0x22')](handleEntityNotFound(_0x28456c,null))[_0x4db7('0x22')](removeEntity(_0x28456c,null))[_0x4db7('0x47')](handleError(_0x28456c,null));};exports[_0x4db7('0x4a')]=function(_0x424e12,_0x1cad29){return db['OpenchannelTransferReport'][_0x4db7('0x4a')]()[_0x4db7('0x22')](respondWithResult(_0x1cad29,null))[_0x4db7('0x47')](handleError(_0x1cad29,null));}; \ No newline at end of file +var _0x9164=['to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js'];(function(_0x1d0024,_0x3bcd79){var _0x26e247=function(_0x4ad9ad){while(--_0x4ad9ad){_0x1d0024['push'](_0x1d0024['shift']());}};_0x26e247(++_0x3bcd79);}(_0x9164,0x150));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4916('0x0'));var rimraf=require(_0x4916('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4916('0x2'));var rp=require(_0x4916('0x3'));var moment=require(_0x4916('0x4'));var BPromise=require(_0x4916('0x5'));var Mustache=require(_0x4916('0x6'));var util=require(_0x4916('0x7'));var path=require(_0x4916('0x8'));var sox=require(_0x4916('0x9'));var csv=require('to-csv');var ejs=require(_0x4916('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4916('0xb'));var squel=require(_0x4916('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4916('0xd'));var toCsv=require(_0x4916('0xe'));var querystring=require(_0x4916('0xf'));var Papa=require(_0x4916('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4916('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4916('0x12'))(_0x4916('0x13'));var utils=require(_0x4916('0x14'));var config=require(_0x4916('0x15'));var licenseUtil=require(_0x4916('0x16'));var db=require(_0x4916('0x17'))['db'];function respondWithStatusCode(_0x18af76,_0x3db3c6){_0x3db3c6=_0x3db3c6||0xcc;return function(_0x8d0394){if(_0x8d0394){return _0x18af76['sendStatus'](_0x3db3c6);}return _0x18af76['status'](_0x3db3c6)[_0x4916('0x18')]();};}function respondWithResult(_0x2946fb,_0x324225){_0x324225=_0x324225||0xc8;return function(_0x375aea){if(_0x375aea){return _0x2946fb[_0x4916('0x19')](_0x324225)[_0x4916('0x1a')](_0x375aea);}};}function respondWithFilteredResult(_0x1a4357,_0x559486){return function(_0x16fb22){if(_0x16fb22){var _0x558d32=typeof _0x559486[_0x4916('0x1b')]===_0x4916('0x1c')&&typeof _0x559486['limit']==='undefined';var _0x3b9861=_0x16fb22[_0x4916('0x1d')];var _0x306f14=_0x558d32?0x0:_0x559486['offset'];var _0x22e222=_0x558d32?_0x16fb22[_0x4916('0x1d')]:_0x559486['offset']+_0x559486[_0x4916('0x1e')];var _0x3fae47;if(_0x22e222>=_0x3b9861){_0x22e222=_0x3b9861;_0x3fae47=0xc8;}else{_0x3fae47=0xce;}_0x1a4357[_0x4916('0x19')](_0x3fae47);return _0x1a4357['set']('Content-Range',_0x306f14+'-'+_0x22e222+'/'+_0x3b9861)[_0x4916('0x1a')](_0x16fb22);}return null;};}function patchUpdates(_0x55b7e6){return function(_0x4c40e8){try{jsonpatch[_0x4916('0x1f')](_0x4c40e8,_0x55b7e6,!![]);}catch(_0x4acb18){return BPromise['reject'](_0x4acb18);}return _0x4c40e8[_0x4916('0x20')]();};}function saveUpdates(_0x466493,_0x3371a5){return function(_0x5a3851){if(_0x5a3851){return _0x5a3851[_0x4916('0x21')](_0x466493)[_0x4916('0x22')](function(_0x290434){return _0x290434;});}return null;};}function removeEntity(_0x3adb10,_0x575c60){return function(_0xd3250b){if(_0xd3250b){return _0xd3250b[_0x4916('0x23')]()[_0x4916('0x22')](function(){_0x3adb10[_0x4916('0x19')](0xcc)[_0x4916('0x18')]();});}};}function handleEntityNotFound(_0x107f2d,_0x2bda02){return function(_0x3cde2e){if(!_0x3cde2e){_0x107f2d[_0x4916('0x24')](0x194);}return _0x3cde2e;};}function handleError(_0x46f19d,_0x342116){_0x342116=_0x342116||0x1f4;return function(_0x320dd2){logger[_0x4916('0x25')](_0x320dd2['stack']);if(_0x320dd2[_0x4916('0x26')]){delete _0x320dd2['name'];}_0x46f19d[_0x4916('0x19')](_0x342116)[_0x4916('0x27')](_0x320dd2);};}exports[_0x4916('0x28')]=function(_0x116597,_0x3db3e0){var _0x5c8ecd={},_0x41562d={},_0x46e358={'count':0x0,'rows':[]};var _0x4b3937=_[_0x4916('0x29')](db[_0x4916('0x2a')][_0x4916('0x2b')],function(_0x7aeb1){return{'name':_0x7aeb1[_0x4916('0x2c')],'type':_0x7aeb1[_0x4916('0x2d')]['key']};});_0x41562d[_0x4916('0x2e')]=_['map'](_0x4b3937,_0x4916('0x26'));_0x41562d[_0x4916('0x2f')]=_[_0x4916('0x30')](_0x116597[_0x4916('0x2f')]);_0x41562d[_0x4916('0x31')]=_['intersection'](_0x41562d[_0x4916('0x2e')],_0x41562d[_0x4916('0x2f')]);_0x5c8ecd[_0x4916('0x32')]=_[_0x4916('0x33')](_0x41562d['model'],qs[_0x4916('0x34')](_0x116597[_0x4916('0x2f')][_0x4916('0x34')]));_0x5c8ecd[_0x4916('0x32')]=_0x5c8ecd[_0x4916('0x32')]['length']?_0x5c8ecd['attributes']:_0x41562d[_0x4916('0x2e')];if(!_0x116597[_0x4916('0x2f')]['hasOwnProperty']('nolimit')){_0x5c8ecd['limit']=qs['limit'](_0x116597[_0x4916('0x2f')][_0x4916('0x1e')]);_0x5c8ecd[_0x4916('0x1b')]=qs[_0x4916('0x1b')](_0x116597[_0x4916('0x2f')][_0x4916('0x1b')]);}_0x5c8ecd[_0x4916('0x35')]=qs[_0x4916('0x36')](_0x116597[_0x4916('0x2f')][_0x4916('0x36')]);_0x5c8ecd['where']=qs['filters'](_[_0x4916('0x37')](_0x116597[_0x4916('0x2f')],_0x41562d[_0x4916('0x31')]),_0x4b3937);if(_0x116597[_0x4916('0x2f')][_0x4916('0x38')]){_0x5c8ecd['where']=_[_0x4916('0x39')](_0x5c8ecd['where'],{'$or':_[_0x4916('0x29')](_0x4b3937,function(_0x288052){if(_0x288052[_0x4916('0x2d')]!==_0x4916('0x3a')){var _0x4e21cd={};_0x4e21cd[_0x288052[_0x4916('0x26')]]={'$like':'%'+_0x116597['query']['filter']+'%'};return _0x4e21cd;}})});}_0x5c8ecd=_[_0x4916('0x39')]({},_0x5c8ecd,_0x116597['options']);var _0x287b4e={'where':_0x5c8ecd[_0x4916('0x3b')]};return db[_0x4916('0x2a')][_0x4916('0x1d')](_0x287b4e)['then'](function(_0x9c97e2){_0x46e358[_0x4916('0x1d')]=_0x9c97e2;if(_0x116597[_0x4916('0x2f')][_0x4916('0x3c')]){_0x5c8ecd['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x5c8ecd);})[_0x4916('0x22')](function(_0x514425){_0x46e358['rows']=_0x514425;return _0x46e358;})[_0x4916('0x22')](respondWithFilteredResult(_0x3db3e0,_0x5c8ecd))[_0x4916('0x3d')](handleError(_0x3db3e0,null));};exports[_0x4916('0x3e')]=function(_0x137d4f,_0x168282){var _0x1738ba={'raw':!![],'where':{'id':_0x137d4f[_0x4916('0x3f')]['id']}},_0x490e45={};_0x490e45[_0x4916('0x2e')]=_[_0x4916('0x30')](db[_0x4916('0x2a')]['rawAttributes']);_0x490e45[_0x4916('0x2f')]=_['keys'](_0x137d4f[_0x4916('0x2f')]);_0x490e45['filters']=_[_0x4916('0x33')](_0x490e45['model'],_0x490e45[_0x4916('0x2f')]);_0x1738ba[_0x4916('0x32')]=_[_0x4916('0x33')](_0x490e45[_0x4916('0x2e')],qs['fields'](_0x137d4f[_0x4916('0x2f')][_0x4916('0x34')]));_0x1738ba[_0x4916('0x32')]=_0x1738ba[_0x4916('0x32')][_0x4916('0x40')]?_0x1738ba[_0x4916('0x32')]:_0x490e45[_0x4916('0x2e')];if(_0x137d4f[_0x4916('0x2f')][_0x4916('0x3c')]){_0x1738ba['include']=[{'all':!![]}];}_0x1738ba=_[_0x4916('0x39')]({},_0x1738ba,_0x137d4f[_0x4916('0x41')]);return db['OpenchannelTransferReport'][_0x4916('0x42')](_0x1738ba)[_0x4916('0x22')](handleEntityNotFound(_0x168282,null))[_0x4916('0x22')](respondWithResult(_0x168282,null))[_0x4916('0x3d')](handleError(_0x168282,null));};exports[_0x4916('0x43')]=function(_0x2214b9,_0x308e0e){return db[_0x4916('0x2a')][_0x4916('0x43')](_0x2214b9[_0x4916('0x44')],{})[_0x4916('0x22')](respondWithResult(_0x308e0e,0xc9))[_0x4916('0x3d')](handleError(_0x308e0e,null));};exports[_0x4916('0x21')]=function(_0x6af2b,_0x408e57){if(_0x6af2b['body']['id']){delete _0x6af2b[_0x4916('0x44')]['id'];}return db[_0x4916('0x2a')][_0x4916('0x42')]({'where':{'id':_0x6af2b['params']['id']}})['then'](handleEntityNotFound(_0x408e57,null))['then'](saveUpdates(_0x6af2b['body'],null))[_0x4916('0x22')](respondWithResult(_0x408e57,null))['catch'](handleError(_0x408e57,null));};exports['destroy']=function(_0x42fca7,_0x9016ea){return db[_0x4916('0x2a')][_0x4916('0x42')]({'where':{'id':_0x42fca7[_0x4916('0x3f')]['id']}})[_0x4916('0x22')](handleEntityNotFound(_0x9016ea,null))['then'](removeEntity(_0x9016ea,null))[_0x4916('0x3d')](handleError(_0x9016ea,null));};exports[_0x4916('0x45')]=function(_0x4710fd,_0x41e4a2){return db[_0x4916('0x2a')][_0x4916('0x45')]()['then'](respondWithResult(_0x41e4a2,null))[_0x4916('0x3d')](handleError(_0x41e4a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e55a3f9..d2c98c8 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 _0xc4b7=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4b7,0x1a8));var _0x7c4b=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4b7[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0x7c4b('0x0'));var logger=require('../../config/logger')(_0x7c4b('0x1'));var moment=require(_0x7c4b('0x2'));var BPromise=require(_0x7c4b('0x3'));var rp=require(_0x7c4b('0x4'));var fs=require('fs');var path=require(_0x7c4b('0x5'));var rimraf=require(_0x7c4b('0x6'));var config=require(_0x7c4b('0x7'));var attributes=require(_0x7c4b('0x8'));module[_0x7c4b('0x9')]=function(_0x2953b0,_0x1ba724){return _0x2953b0[_0x7c4b('0xa')](_0x7c4b('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7c4b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07ce=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid'];(function(_0x2ddc1f,_0x36a583){var _0xa912ca=function(_0x5a80c8){while(--_0x5a80c8){_0x2ddc1f['push'](_0x2ddc1f['shift']());}};_0xa912ca(++_0x36a583);}(_0x07ce,0x138));var _0xe07c=function(_0x22a3b3,_0x1fe930){_0x22a3b3=_0x22a3b3-0x0;var _0x3b9ffa=_0x07ce[_0x22a3b3];return _0x3b9ffa;};'use strict';var _=require('lodash');var util=require(_0xe07c('0x0'));var logger=require(_0xe07c('0x1'))(_0xe07c('0x2'));var moment=require('moment');var BPromise=require(_0xe07c('0x3'));var rp=require(_0xe07c('0x4'));var fs=require('fs');var path=require(_0xe07c('0x5'));var rimraf=require('rimraf');var config=require(_0xe07c('0x6'));var attributes=require(_0xe07c('0x7'));module[_0xe07c('0x8')]=function(_0x41514b,_0x43531f){return _0x41514b[_0xe07c('0x9')](_0xe07c('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe07c('0xb'),'fields':[_0xe07c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 89df295..8156a3e 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 _0x56a4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x680915,_0x3adb5d){var _0x526071=function(_0xdc17ef){while(--_0xdc17ef){_0x680915['push'](_0x680915['shift']());}};_0x526071(++_0x3adb5d);}(_0x56a4,0x11b));var _0x456a=function(_0x1f55f9,_0xf5c554){_0x1f55f9=_0x1f55f9-0x0;var _0x885614=_0x56a4[_0x1f55f9];return _0x885614;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b38d,_0x497df4,_0x2b6329){return new BPromise(function(_0x20c8e0,_0x37f1b4){return client['request'](_0x52b38d,_0x2b6329)[_0x456a('0xa')](function(_0x595c4b){logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));logger[_0x456a('0xe')](_0x456a('0xf'),_0x497df4,_0x456a('0xd'),JSON[_0x456a('0x10')](_0x595c4b));if(_0x595c4b[_0x456a('0x11')]){if(_0x595c4b[_0x456a('0x11')][_0x456a('0x12')]===0x1f4){logger[_0x456a('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x37f1b4(_0x595c4b['error'][_0x456a('0x13')]);}logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x20c8e0(_0x595c4b[_0x456a('0x11')][_0x456a('0x13')]);}else{logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));_0x20c8e0(_0x595c4b[_0x456a('0x14')]['message']);}})[_0x456a('0x15')](function(_0x42f7d8){logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x42f7d8);_0x37f1b4(_0x42f7d8);});});} \ No newline at end of file +var _0x43fd=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5cd5a0,_0x43d0c5){_0x5cd5a0=_0x5cd5a0-0x0;var _0x566bb7=_0x43fd[_0x5cd5a0];return _0x566bb7;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3fa69dd..d84ed73 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 _0xd554=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','post','put','delete'];(function(_0x154f5c,_0x579fcf){var _0x5360f6=function(_0x3b3cad){while(--_0x3b3cad){_0x154f5c['push'](_0x154f5c['shift']());}};_0x5360f6(++_0x579fcf);}(_0xd554,0xb2));var _0x4d55=function(_0x38c708,_0x3ef98c){_0x38c708=_0x38c708-0x0;var _0x555f78=_0xd554[_0x38c708];return _0x555f78;};'use strict';var multer=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var path=require(_0x4d55('0x2'));var timeout=require(_0x4d55('0x3'));var express=require(_0x4d55('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d55('0x6'));var controller=require(_0x4d55('0x7'));router[_0x4d55('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d55('0x8')](_0x4d55('0x9'),auth[_0x4d55('0xa')](),controller['show']);router[_0x4d55('0xb')]('/',auth[_0x4d55('0xa')](),controller['create']);router[_0x4d55('0xc')](_0x4d55('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4d55('0xd')](_0x4d55('0x9'),auth['isAuthenticated'](),controller[_0x4d55('0xe')]);module[_0x4d55('0xf')]=router; \ No newline at end of file +var _0xf313=['get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1a105a,_0x1ad733){var _0x3fa8f0=function(_0x1fec29){while(--_0x1fec29){_0x1a105a['push'](_0x1a105a['shift']());}};_0x3fa8f0(++_0x1ad733);}(_0xf313,0x12b));var _0x3f31=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf313[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x3f31('0x0'));var util=require('util');var path=require(_0x3f31('0x1'));var timeout=require(_0x3f31('0x2'));var express=require('express');var router=express[_0x3f31('0x3')]();var fs_extra=require(_0x3f31('0x4'));var auth=require(_0x3f31('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3f31('0x6'));var controller=require('./pause.controller');router[_0x3f31('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f31('0x8')]);router[_0x3f31('0x7')](_0x3f31('0x9'),auth['isAuthenticated'](),controller[_0x3f31('0xa')]);router['post']('/',auth[_0x3f31('0xb')](),controller[_0x3f31('0xc')]);router[_0x3f31('0xd')](_0x3f31('0x9'),auth[_0x3f31('0xb')](),controller[_0x3f31('0xe')]);router[_0x3f31('0xf')](_0x3f31('0x9'),auth[_0x3f31('0xb')](),controller[_0x3f31('0x10')]);module[_0x3f31('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 075b6e1..75ec7ba 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 _0x4f6b=['STRING','name','sequelize'];(function(_0x4227dc,_0x3032b8){var _0x3783bc=function(_0x4f92a){while(--_0x4f92a){_0x4227dc['push'](_0x4227dc['shift']());}};_0x3783bc(++_0x3032b8);}(_0x4f6b,0xec));var _0xb4f6=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4f6b[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0xb4f6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4f6('0x1')],'unique':_0xb4f6('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc498=['exports','STRING','sequelize'];(function(_0x11c6b2,_0x163c3f){var _0x490197=function(_0x25c356){while(--_0x25c356){_0x11c6b2['push'](_0x11c6b2['shift']());}};_0x490197(++_0x163c3f);}(_0xc498,0x1ca));var _0x8c49=function(_0x21989a,_0x2ae349){_0x21989a=_0x21989a-0x0;var _0x39154d=_0xc498[_0x21989a];return _0x39154d;};'use strict';var Sequelize=require(_0x8c49('0x0'));module[_0x8c49('0x1')]={'name':{'type':Sequelize[_0x8c49('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8c49('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2f0eb86..94d1930 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 _0x88fe=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','error','stack','name','send','index','map','Pause','fieldName','type','key','model','query','filters'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0x88fe,0x1c0));var _0xe88f=function(_0x1c100b,_0x5e17a0){_0x1c100b=_0x1c100b-0x0;var _0x2417fe=_0x88fe[_0x1c100b];return _0x2417fe;};'use strict';var emlformat=require(_0xe88f('0x0'));var rimraf=require(_0xe88f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe88f('0x2'));var rp=require(_0xe88f('0x3'));var moment=require(_0xe88f('0x4'));var BPromise=require(_0xe88f('0x5'));var Mustache=require(_0xe88f('0x6'));var util=require(_0xe88f('0x7'));var path=require(_0xe88f('0x8'));var sox=require(_0xe88f('0x9'));var csv=require('to-csv');var ejs=require(_0xe88f('0xa'));var fs=require('fs');var fs_extra=require(_0xe88f('0xb'));var _=require(_0xe88f('0xc'));var squel=require(_0xe88f('0xd'));var crypto=require('crypto');var jsforce=require(_0xe88f('0xe'));var deskjs=require(_0xe88f('0xf'));var toCsv=require(_0xe88f('0x10'));var querystring=require(_0xe88f('0x11'));var Papa=require(_0xe88f('0x12'));var Redis=require(_0xe88f('0x13'));var authService=require(_0xe88f('0x14'));var qs=require(_0xe88f('0x15'));var as=require(_0xe88f('0x16'));var hardwareService=require(_0xe88f('0x17'));var logger=require(_0xe88f('0x18'))('api');var utils=require(_0xe88f('0x19'));var config=require(_0xe88f('0x1a'));var licenseUtil=require(_0xe88f('0x1b'));var db=require(_0xe88f('0x1c'))['db'];function respondWithStatusCode(_0x25c3dc,_0x48a93f){_0x48a93f=_0x48a93f||0xcc;return function(_0x4aed96){if(_0x4aed96){return _0x25c3dc[_0xe88f('0x1d')](_0x48a93f);}return _0x25c3dc[_0xe88f('0x1e')](_0x48a93f)[_0xe88f('0x1f')]();};}function respondWithResult(_0x3b611f,_0x394660){_0x394660=_0x394660||0xc8;return function(_0x339e79){if(_0x339e79){return _0x3b611f[_0xe88f('0x1e')](_0x394660)[_0xe88f('0x20')](_0x339e79);}};}function respondWithFilteredResult(_0x4ab040,_0x39a38c){return function(_0x230637){if(_0x230637){var _0x258e75=typeof _0x39a38c[_0xe88f('0x21')]===_0xe88f('0x22')&&typeof _0x39a38c[_0xe88f('0x23')]===_0xe88f('0x22');var _0x538036=_0x230637[_0xe88f('0x24')];var _0x4301e2=_0x258e75?0x0:_0x39a38c['offset'];var _0x3ca8b0=_0x258e75?_0x230637[_0xe88f('0x24')]:_0x39a38c[_0xe88f('0x21')]+_0x39a38c['limit'];var _0x2d885b;if(_0x3ca8b0>=_0x538036){_0x3ca8b0=_0x538036;_0x2d885b=0xc8;}else{_0x2d885b=0xce;}_0x4ab040[_0xe88f('0x1e')](_0x2d885b);return _0x4ab040[_0xe88f('0x25')](_0xe88f('0x26'),_0x4301e2+'-'+_0x3ca8b0+'/'+_0x538036)['json'](_0x230637);}return null;};}function patchUpdates(_0x2e6c61){return function(_0x28b943){try{jsonpatch['apply'](_0x28b943,_0x2e6c61,!![]);}catch(_0x2c824c){return BPromise['reject'](_0x2c824c);}return _0x28b943['save']();};}function saveUpdates(_0x391aa1,_0x4a10b7){return function(_0x3718cc){if(_0x3718cc){return _0x3718cc[_0xe88f('0x27')](_0x391aa1)['then'](function(_0x4239ca){return _0x4239ca;});}return null;};}function removeEntity(_0x260cac,_0x200406){return function(_0x47bd17){if(_0x47bd17){return _0x47bd17[_0xe88f('0x28')]()[_0xe88f('0x29')](function(){var _0x4bf4ac=_0x47bd17[_0xe88f('0x2a')]({'plain':!![]});var _0x10a55e='Pauses';return db['UserProfileResource'][_0xe88f('0x28')]({'where':{'type':_0x10a55e,'resourceId':_0x4bf4ac['id']}})[_0xe88f('0x29')](function(){return _0x47bd17;});})['then'](function(){_0x260cac['status'](0xcc)[_0xe88f('0x1f')]();});}};}function handleEntityNotFound(_0x184e85,_0x215be3){return function(_0x33e55d){if(!_0x33e55d){_0x184e85[_0xe88f('0x1d')](0x194);}return _0x33e55d;};}function handleError(_0x1879b1,_0x3ca8ba){_0x3ca8ba=_0x3ca8ba||0x1f4;return function(_0x849240){logger[_0xe88f('0x2b')](_0x849240[_0xe88f('0x2c')]);if(_0x849240[_0xe88f('0x2d')]){delete _0x849240[_0xe88f('0x2d')];}_0x1879b1['status'](_0x3ca8ba)[_0xe88f('0x2e')](_0x849240);};}exports[_0xe88f('0x2f')]=function(_0x3b8c49,_0x96e186){var _0x16ad2e={},_0x1d0781={},_0x1f82a1={'count':0x0,'rows':[]};var _0x1d0c18=_[_0xe88f('0x30')](db[_0xe88f('0x31')]['rawAttributes'],function(_0x413997){return{'name':_0x413997[_0xe88f('0x32')],'type':_0x413997[_0xe88f('0x33')][_0xe88f('0x34')]};});_0x1d0781[_0xe88f('0x35')]=_[_0xe88f('0x30')](_0x1d0c18,_0xe88f('0x2d'));_0x1d0781[_0xe88f('0x36')]=_['keys'](_0x3b8c49['query']);_0x1d0781[_0xe88f('0x37')]=_[_0xe88f('0x38')](_0x1d0781[_0xe88f('0x35')],_0x1d0781[_0xe88f('0x36')]);_0x16ad2e[_0xe88f('0x39')]=_[_0xe88f('0x38')](_0x1d0781[_0xe88f('0x35')],qs['fields'](_0x3b8c49['query']['fields']));_0x16ad2e['attributes']=_0x16ad2e['attributes'][_0xe88f('0x3a')]?_0x16ad2e[_0xe88f('0x39')]:_0x1d0781[_0xe88f('0x35')];if(!_0x3b8c49[_0xe88f('0x36')][_0xe88f('0x3b')](_0xe88f('0x3c'))){_0x16ad2e[_0xe88f('0x23')]=qs[_0xe88f('0x23')](_0x3b8c49[_0xe88f('0x36')]['limit']);_0x16ad2e[_0xe88f('0x21')]=qs['offset'](_0x3b8c49[_0xe88f('0x36')]['offset']);}_0x16ad2e[_0xe88f('0x3d')]=qs['sort'](_0x3b8c49[_0xe88f('0x36')][_0xe88f('0x3e')]);_0x16ad2e['where']=qs[_0xe88f('0x37')](_['pick'](_0x3b8c49[_0xe88f('0x36')],_0x1d0781[_0xe88f('0x37')]),_0x1d0c18);if(_0x3b8c49[_0xe88f('0x36')][_0xe88f('0x3f')]){_0x16ad2e[_0xe88f('0x40')]=_[_0xe88f('0x41')](_0x16ad2e[_0xe88f('0x40')],{'$or':_['map'](_0x1d0c18,function(_0x4627fb){if(_0x4627fb[_0xe88f('0x33')]!==_0xe88f('0x42')){var _0x212794={};_0x212794[_0x4627fb[_0xe88f('0x2d')]]={'$like':'%'+_0x3b8c49['query']['filter']+'%'};return _0x212794;}})});}_0x16ad2e=_['merge']({},_0x16ad2e,_0x3b8c49[_0xe88f('0x43')]);var _0x4646ac={'where':_0x16ad2e[_0xe88f('0x40')]};return db[_0xe88f('0x31')][_0xe88f('0x24')](_0x4646ac)['then'](function(_0x7c8b4f){_0x1f82a1[_0xe88f('0x24')]=_0x7c8b4f;if(_0x3b8c49['query'][_0xe88f('0x44')]){_0x16ad2e[_0xe88f('0x45')]=[{'all':!![]}];}return db[_0xe88f('0x31')][_0xe88f('0x46')](_0x16ad2e);})['then'](function(_0x488293){_0x1f82a1[_0xe88f('0x47')]=_0x488293;return _0x1f82a1;})['then'](respondWithFilteredResult(_0x96e186,_0x16ad2e))[_0xe88f('0x48')](handleError(_0x96e186,null));};exports[_0xe88f('0x49')]=function(_0x2d36d3,_0x5184b6){var _0x2d3fb2={'raw':!![],'where':{'id':_0x2d36d3[_0xe88f('0x4a')]['id']}},_0xe8c669={};_0xe8c669[_0xe88f('0x35')]=_[_0xe88f('0x4b')](db['Pause'][_0xe88f('0x4c')]);_0xe8c669['query']=_[_0xe88f('0x4b')](_0x2d36d3[_0xe88f('0x36')]);_0xe8c669[_0xe88f('0x37')]=_[_0xe88f('0x38')](_0xe8c669[_0xe88f('0x35')],_0xe8c669[_0xe88f('0x36')]);_0x2d3fb2[_0xe88f('0x39')]=_[_0xe88f('0x38')](_0xe8c669[_0xe88f('0x35')],qs['fields'](_0x2d36d3['query']['fields']));_0x2d3fb2[_0xe88f('0x39')]=_0x2d3fb2[_0xe88f('0x39')][_0xe88f('0x3a')]?_0x2d3fb2[_0xe88f('0x39')]:_0xe8c669['model'];if(_0x2d36d3['query'][_0xe88f('0x44')]){_0x2d3fb2[_0xe88f('0x45')]=[{'all':!![]}];}_0x2d3fb2=_[_0xe88f('0x41')]({},_0x2d3fb2,_0x2d36d3[_0xe88f('0x43')]);return db[_0xe88f('0x31')][_0xe88f('0x4d')](_0x2d3fb2)[_0xe88f('0x29')](handleEntityNotFound(_0x5184b6,null))[_0xe88f('0x29')](respondWithResult(_0x5184b6,null))[_0xe88f('0x48')](handleError(_0x5184b6,null));};exports[_0xe88f('0x4e')]=function(_0x54d959,_0x48a2ed){return db[_0xe88f('0x31')][_0xe88f('0x4e')](_0x54d959[_0xe88f('0x4f')],{})[_0xe88f('0x29')](function(_0x3175e6){var _0x16e777=_0x54d959[_0xe88f('0x50')][_0xe88f('0x2a')]({'plain':!![]});if(!_0x16e777)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16e777[_0xe88f('0x51')]===_0xe88f('0x50')){var _0x173687=_0x3175e6[_0xe88f('0x2a')]({'plain':!![]});var _0x25bd9d='Pauses';return db['UserProfileSection'][_0xe88f('0x4d')]({'where':{'name':_0x25bd9d,'userProfileId':_0x16e777['userProfileId']},'raw':!![]})['then'](function(_0x1c17cc){if(_0x1c17cc&&_0x1c17cc['autoAssociation']===0x0){return db[_0xe88f('0x52')][_0xe88f('0x4e')]({'name':_0x173687[_0xe88f('0x2d')],'resourceId':_0x173687['id'],'type':_0x1c17cc['name'],'sectionId':_0x1c17cc['id']},{})[_0xe88f('0x29')](function(){return _0x3175e6;});}else{return _0x3175e6;}})[_0xe88f('0x48')](function(_0x543eda){logger[_0xe88f('0x2b')](_0xe88f('0x53'),_0x543eda);throw _0x543eda;});}return _0x3175e6;})[_0xe88f('0x29')](respondWithResult(_0x48a2ed,0xc9))[_0xe88f('0x48')](handleError(_0x48a2ed,null));};exports[_0xe88f('0x27')]=function(_0x1015b2,_0x4afccd){if(_0x1015b2[_0xe88f('0x4f')]['id']){delete _0x1015b2['body']['id'];}return db['Pause'][_0xe88f('0x4d')]({'where':{'id':_0x1015b2[_0xe88f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4afccd,null))[_0xe88f('0x29')](saveUpdates(_0x1015b2['body'],null))[_0xe88f('0x29')](respondWithResult(_0x4afccd,null))[_0xe88f('0x48')](handleError(_0x4afccd,null));};exports[_0xe88f('0x28')]=function(_0x12ce1d,_0x2ec51c){return db[_0xe88f('0x31')][_0xe88f('0x4d')]({'where':{'id':_0x12ce1d[_0xe88f('0x4a')]['id']}})[_0xe88f('0x29')](handleEntityNotFound(_0x2ec51c,null))[_0xe88f('0x29')](removeEntity(_0x2ec51c,null))[_0xe88f('0x48')](handleError(_0x2ec51c,null));}; \ No newline at end of file +var _0xfcb4=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','get','Pauses','status','end','error','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcb4,0x132));var _0x4fcb=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfcb4[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x4fcb('0x0'));var rimraf=require(_0x4fcb('0x1'));var zipdir=require(_0x4fcb('0x2'));var jsonpatch=require(_0x4fcb('0x3'));var rp=require('request-promise');var moment=require(_0x4fcb('0x4'));var BPromise=require(_0x4fcb('0x5'));var Mustache=require(_0x4fcb('0x6'));var util=require(_0x4fcb('0x7'));var path=require(_0x4fcb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4fcb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fcb('0xa'));var squel=require(_0x4fcb('0xb'));var crypto=require(_0x4fcb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4fcb('0xd'));var Papa=require('papaparse');var Redis=require(_0x4fcb('0xe'));var authService=require(_0x4fcb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fcb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fcb('0x11'));var utils=require(_0x4fcb('0x12'));var config=require(_0x4fcb('0x13'));var licenseUtil=require(_0x4fcb('0x14'));var db=require(_0x4fcb('0x15'))['db'];function respondWithStatusCode(_0x37296b,_0x3f59c5){_0x3f59c5=_0x3f59c5||0xcc;return function(_0x4cbf4f){if(_0x4cbf4f){return _0x37296b[_0x4fcb('0x16')](_0x3f59c5);}return _0x37296b['status'](_0x3f59c5)['end']();};}function respondWithResult(_0x5813ed,_0x485af5){_0x485af5=_0x485af5||0xc8;return function(_0x97d4fb){if(_0x97d4fb){return _0x5813ed['status'](_0x485af5)[_0x4fcb('0x17')](_0x97d4fb);}};}function respondWithFilteredResult(_0x38ef21,_0x823e94){return function(_0x2e703e){if(_0x2e703e){var _0x121ace=typeof _0x823e94[_0x4fcb('0x18')]===_0x4fcb('0x19')&&typeof _0x823e94[_0x4fcb('0x1a')]===_0x4fcb('0x19');var _0x5d1e7a=_0x2e703e['count'];var _0xf198a2=_0x121ace?0x0:_0x823e94[_0x4fcb('0x18')];var _0x178e7c=_0x121ace?_0x2e703e['count']:_0x823e94[_0x4fcb('0x18')]+_0x823e94['limit'];var _0x185df1;if(_0x178e7c>=_0x5d1e7a){_0x178e7c=_0x5d1e7a;_0x185df1=0xc8;}else{_0x185df1=0xce;}_0x38ef21['status'](_0x185df1);return _0x38ef21[_0x4fcb('0x1b')](_0x4fcb('0x1c'),_0xf198a2+'-'+_0x178e7c+'/'+_0x5d1e7a)[_0x4fcb('0x17')](_0x2e703e);}return null;};}function patchUpdates(_0x6e501){return function(_0x5c01f0){try{jsonpatch[_0x4fcb('0x1d')](_0x5c01f0,_0x6e501,!![]);}catch(_0x497f5a){return BPromise[_0x4fcb('0x1e')](_0x497f5a);}return _0x5c01f0['save']();};}function saveUpdates(_0x1c6a84,_0x196e84){return function(_0x522185){if(_0x522185){return _0x522185[_0x4fcb('0x1f')](_0x1c6a84)['then'](function(_0x523437){return _0x523437;});}return null;};}function removeEntity(_0x33c289,_0x3a735d){return function(_0x2fc7ff){if(_0x2fc7ff){return _0x2fc7ff[_0x4fcb('0x20')]()[_0x4fcb('0x21')](function(){var _0x4bab8c=_0x2fc7ff[_0x4fcb('0x22')]({'plain':!![]});var _0xd30f69=_0x4fcb('0x23');return db['UserProfileResource'][_0x4fcb('0x20')]({'where':{'type':_0xd30f69,'resourceId':_0x4bab8c['id']}})['then'](function(){return _0x2fc7ff;});})['then'](function(){_0x33c289[_0x4fcb('0x24')](0xcc)[_0x4fcb('0x25')]();});}};}function handleEntityNotFound(_0x22f34f,_0x513500){return function(_0x102ba4){if(!_0x102ba4){_0x22f34f[_0x4fcb('0x16')](0x194);}return _0x102ba4;};}function handleError(_0x2f4b2f,_0x5ea34f){_0x5ea34f=_0x5ea34f||0x1f4;return function(_0x27ef5d){logger[_0x4fcb('0x26')](_0x27ef5d['stack']);if(_0x27ef5d[_0x4fcb('0x27')]){delete _0x27ef5d[_0x4fcb('0x27')];}_0x2f4b2f[_0x4fcb('0x24')](_0x5ea34f)[_0x4fcb('0x28')](_0x27ef5d);};}exports['index']=function(_0x25925c,_0x192b0c){var _0x24f764={},_0x1d36db={},_0x84dd0a={'count':0x0,'rows':[]};var _0x2c474a=_[_0x4fcb('0x29')](db[_0x4fcb('0x2a')][_0x4fcb('0x2b')],function(_0x44a328){return{'name':_0x44a328[_0x4fcb('0x2c')],'type':_0x44a328[_0x4fcb('0x2d')][_0x4fcb('0x2e')]};});_0x1d36db[_0x4fcb('0x2f')]=_[_0x4fcb('0x29')](_0x2c474a,_0x4fcb('0x27'));_0x1d36db[_0x4fcb('0x30')]=_[_0x4fcb('0x31')](_0x25925c[_0x4fcb('0x30')]);_0x1d36db[_0x4fcb('0x32')]=_['intersection'](_0x1d36db[_0x4fcb('0x2f')],_0x1d36db[_0x4fcb('0x30')]);_0x24f764[_0x4fcb('0x33')]=_[_0x4fcb('0x34')](_0x1d36db[_0x4fcb('0x2f')],qs[_0x4fcb('0x35')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x35')]));_0x24f764['attributes']=_0x24f764[_0x4fcb('0x33')][_0x4fcb('0x36')]?_0x24f764[_0x4fcb('0x33')]:_0x1d36db[_0x4fcb('0x2f')];if(!_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x37')](_0x4fcb('0x38'))){_0x24f764[_0x4fcb('0x1a')]=qs[_0x4fcb('0x1a')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x1a')]);_0x24f764[_0x4fcb('0x18')]=qs[_0x4fcb('0x18')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x18')]);}_0x24f764['order']=qs['sort'](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x39')]);_0x24f764[_0x4fcb('0x3a')]=qs['filters'](_['pick'](_0x25925c[_0x4fcb('0x30')],_0x1d36db[_0x4fcb('0x32')]),_0x2c474a);if(_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x3b')]){_0x24f764[_0x4fcb('0x3a')]=_[_0x4fcb('0x3c')](_0x24f764[_0x4fcb('0x3a')],{'$or':_[_0x4fcb('0x29')](_0x2c474a,function(_0x5daee){if(_0x5daee[_0x4fcb('0x2d')]!==_0x4fcb('0x3d')){var _0x195aa5={};_0x195aa5[_0x5daee[_0x4fcb('0x27')]]={'$like':'%'+_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x3b')]+'%'};return _0x195aa5;}})});}_0x24f764=_[_0x4fcb('0x3c')]({},_0x24f764,_0x25925c['options']);var _0x340021={'where':_0x24f764['where']};return db[_0x4fcb('0x2a')]['count'](_0x340021)[_0x4fcb('0x21')](function(_0x23229f){_0x84dd0a[_0x4fcb('0x3e')]=_0x23229f;if(_0x25925c['query'][_0x4fcb('0x3f')]){_0x24f764[_0x4fcb('0x40')]=[{'all':!![]}];}return db[_0x4fcb('0x2a')][_0x4fcb('0x41')](_0x24f764);})[_0x4fcb('0x21')](function(_0x486bcc){_0x84dd0a['rows']=_0x486bcc;return _0x84dd0a;})['then'](respondWithFilteredResult(_0x192b0c,_0x24f764))[_0x4fcb('0x42')](handleError(_0x192b0c,null));};exports[_0x4fcb('0x43')]=function(_0x96f486,_0x5edba0){var _0x2c3da8={'raw':!![],'where':{'id':_0x96f486[_0x4fcb('0x44')]['id']}},_0x2a68cb={};_0x2a68cb[_0x4fcb('0x2f')]=_[_0x4fcb('0x31')](db[_0x4fcb('0x2a')]['rawAttributes']);_0x2a68cb[_0x4fcb('0x30')]=_['keys'](_0x96f486[_0x4fcb('0x30')]);_0x2a68cb['filters']=_[_0x4fcb('0x34')](_0x2a68cb[_0x4fcb('0x2f')],_0x2a68cb[_0x4fcb('0x30')]);_0x2c3da8['attributes']=_[_0x4fcb('0x34')](_0x2a68cb[_0x4fcb('0x2f')],qs[_0x4fcb('0x35')](_0x96f486['query']['fields']));_0x2c3da8['attributes']=_0x2c3da8['attributes'][_0x4fcb('0x36')]?_0x2c3da8[_0x4fcb('0x33')]:_0x2a68cb[_0x4fcb('0x2f')];if(_0x96f486[_0x4fcb('0x30')][_0x4fcb('0x3f')]){_0x2c3da8['include']=[{'all':!![]}];}_0x2c3da8=_[_0x4fcb('0x3c')]({},_0x2c3da8,_0x96f486['options']);return db['Pause']['find'](_0x2c3da8)[_0x4fcb('0x21')](handleEntityNotFound(_0x5edba0,null))['then'](respondWithResult(_0x5edba0,null))['catch'](handleError(_0x5edba0,null));};exports[_0x4fcb('0x45')]=function(_0x21d698,_0x4dade2){return db[_0x4fcb('0x2a')][_0x4fcb('0x45')](_0x21d698[_0x4fcb('0x46')],{})['then'](function(_0x1ab671){var _0x570e9f=_0x21d698[_0x4fcb('0x47')][_0x4fcb('0x22')]({'plain':!![]});if(!_0x570e9f)throw new Error(_0x4fcb('0x48'));if(_0x570e9f[_0x4fcb('0x49')]===_0x4fcb('0x47')){var _0xf52789=_0x1ab671[_0x4fcb('0x22')]({'plain':!![]});var _0x4d93c6=_0x4fcb('0x23');return db[_0x4fcb('0x4a')]['find']({'where':{'name':_0x4d93c6,'userProfileId':_0x570e9f[_0x4fcb('0x4b')]},'raw':!![]})[_0x4fcb('0x21')](function(_0x2aae81){if(_0x2aae81&&_0x2aae81[_0x4fcb('0x4c')]===0x0){return db[_0x4fcb('0x4d')]['create']({'name':_0xf52789[_0x4fcb('0x27')],'resourceId':_0xf52789['id'],'type':_0x2aae81[_0x4fcb('0x27')],'sectionId':_0x2aae81['id']},{})[_0x4fcb('0x21')](function(){return _0x1ab671;});}else{return _0x1ab671;}})[_0x4fcb('0x42')](function(_0x3b4d26){logger[_0x4fcb('0x26')](_0x4fcb('0x4e'),_0x3b4d26);throw _0x3b4d26;});}return _0x1ab671;})[_0x4fcb('0x21')](respondWithResult(_0x4dade2,0xc9))[_0x4fcb('0x42')](handleError(_0x4dade2,null));};exports[_0x4fcb('0x1f')]=function(_0x5556fd,_0x422279){if(_0x5556fd[_0x4fcb('0x46')]['id']){delete _0x5556fd[_0x4fcb('0x46')]['id'];}return db[_0x4fcb('0x2a')][_0x4fcb('0x4f')]({'where':{'id':_0x5556fd[_0x4fcb('0x44')]['id']}})[_0x4fcb('0x21')](handleEntityNotFound(_0x422279,null))[_0x4fcb('0x21')](saveUpdates(_0x5556fd[_0x4fcb('0x46')],null))[_0x4fcb('0x21')](respondWithResult(_0x422279,null))[_0x4fcb('0x42')](handleError(_0x422279,null));};exports[_0x4fcb('0x20')]=function(_0x9b03,_0xc5891c){return db[_0x4fcb('0x2a')]['find']({'where':{'id':_0x9b03[_0x4fcb('0x44')]['id']}})['then'](handleEntityNotFound(_0xc5891c,null))[_0x4fcb('0x21')](removeEntity(_0xc5891c,null))[_0x4fcb('0x42')](handleError(_0xc5891c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 86f12d8..73c02e9 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x3be4fe,_0x5ec893){var _0x26d5b2=function(_0x3abe2c){while(--_0x3abe2c){_0x3be4fe['push'](_0x3be4fe['shift']());}};_0x26d5b2(++_0x5ec893);}(_0xe14b,0x93));var _0xbe14=function(_0x41b149,_0x185afd){_0x41b149=_0x41b149-0x0;var _0x18db1f=_0xe14b[_0x41b149];return _0x18db1f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x2d393f,_0x39ecd2){var _0x40f8da=function(_0x34f20b){while(--_0x34f20b){_0x2d393f['push'](_0x2d393f['shift']());}};_0x40f8da(++_0x39ecd2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x5fc3[_0x495e9f];return _0xb249d2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e6771a4..e1cb57a 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x406f83,_0x52c4e6){var _0x4cc57e=function(_0x1b3b52){while(--_0x1b3b52){_0x406f83['push'](_0x406f83['shift']());}};_0x4cc57e(++_0x52c4e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0xb10b[_0x52ab8a];return _0x5d6ddc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2472d3,_0x393ee9){var _0x4b3c72=function(_0x20e96e){while(--_0x20e96e){_0x2472d3['push'](_0x2472d3['shift']());}};_0x4b3c72(++_0x393ee9);}(_0xb10b,0x12a));var _0xbb10=function(_0x6afa2d,_0x8c0e0f){_0x6afa2d=_0x6afa2d-0x0;var _0x1698ee=_0xb10b[_0x6afa2d];return _0x1698ee;};'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 2537ba0..8512441 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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x29df38,_0x5bab7a){var _0x372c5b=function(_0x4851c5){while(--_0x4851c5){_0x29df38['push'](_0x29df38['shift']());}};_0x372c5b(++_0x5bab7a);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file +var _0xe5b3=['now','file','upload','/webhook','webhookPost','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','extname'];(function(_0x26277b,_0x447ca9){var _0x612880=function(_0x2bfb08){while(--_0x2bfb08){_0x26277b['push'](_0x26277b['shift']());}};_0x612880(++_0x447ca9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x19c485,_0x2392ce){_0x19c485=_0x19c485-0x0;var _0x1104b6=_0xe5b3[_0x19c485];return _0x1104b6;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/webhook',controller[_0x3e5b('0xc')]);router[_0x3e5b('0xa')](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['show']);router['get'](_0x3e5b('0xf'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x10')]);var upload=multer({'storage':multer[_0x3e5b('0x11')]({'destination':function(_0xeeaabc,_0x522e9e,_0x3be027){_0x3be027(null,path['join'](config[_0x3e5b('0x12')],_0x3e5b('0x13')));},'filename':function(_0x4d69dd,_0x374068,_0x20b97b){_0x374068[_0x3e5b('0x14')]=_0x374068[_0x3e5b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20b97b(null,util[_0x3e5b('0x15')]('%s-%s%s',path['basename'](_0x374068['originalname'],path[_0x3e5b('0x16')](_0x374068[_0x3e5b('0x14')])),Date[_0x3e5b('0x17')](),path['extname'](_0x374068[_0x3e5b('0x14')])));}})});router['post']('/',upload['single'](_0x3e5b('0x18')),controller[_0x3e5b('0x19')]);router['post'](_0x3e5b('0x1a'),controller[_0x3e5b('0x1b')]);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['update']);router['delete'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x1c')]);module[_0x3e5b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 235c362..245dde0 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 _0x82ae=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x82ae,0x1db));var _0xe82a=function(_0x4ff5e5,_0x673163){_0x4ff5e5=_0x4ff5e5-0x0;var _0x2cae14=_0x82ae[_0x4ff5e5];return _0x2cae14;};'use strict';var Sequelize=require(_0xe82a('0x0'));module[_0xe82a('0x1')]={'name':{'type':Sequelize[_0xe82a('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0xe82a('0x3'))},'description':{'type':Sequelize[_0xe82a('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xe82a('0x5')},'active':{'type':Sequelize[_0xe82a('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xe82a('0x7'),_0xe82a('0x8'),_0xe82a('0x9'),_0xe82a('0xa')),'defaultValue':_0xe82a('0x9'),'comment':_0xe82a('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xe82a('0x2')]},'agentUrl':{'type':Sequelize[_0xe82a('0x2')]},'scriptName':{'type':Sequelize[_0xe82a('0x2')]},'scriptPath':{'type':Sequelize[_0xe82a('0x2')]}}; \ No newline at end of file +var _0x11e0=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0x11e0,0xc3));var _0x011e=function(_0x3a8f9b,_0xa6a7ca){_0x3a8f9b=_0x3a8f9b-0x0;var _0x30ae2b=_0x11e0[_0x3a8f9b];return _0x30ae2b;};'use strict';var Sequelize=require(_0x011e('0x0'));module[_0x011e('0x1')]={'name':{'type':Sequelize[_0x011e('0x2')]},'type':{'type':Sequelize[_0x011e('0x3')](_0x011e('0x4'),_0x011e('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x011e('0x6')]},'path':{'type':Sequelize[_0x011e('0x2')],'comment':_0x011e('0x7')},'active':{'type':Sequelize[_0x011e('0x8')],'defaultValue':0x0,'comment':_0x011e('0x9')},'sidebar':{'type':Sequelize[_0x011e('0x3')]('adminOnly','agentOnly','always','never'),'defaultValue':_0x011e('0xa'),'comment':_0x011e('0xb')},'icon':{'type':Sequelize[_0x011e('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x011e('0x2')]},'scriptName':{'type':Sequelize[_0x011e('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 8c709b6..2580f0f 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 _0x80b6=['Error\x20while\x20generating\x20the\x20zip\x20archive','dirname','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Plugins','name','send','Plugin','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','merge','options','include','findAll','rows','catch','rawAttributes','includeAll','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','error','Sequelize','Error'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x80b6,0x197));var _0x680b=function(_0x24a10d,_0x4dd37c){_0x24a10d=_0x24a10d-0x0;var _0x87f80=_0x80b6[_0x24a10d];return _0x87f80;};'use strict';var emlformat=require(_0x680b('0x0'));var rimraf=require(_0x680b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x680b('0x2'));var moment=require(_0x680b('0x3'));var BPromise=require(_0x680b('0x4'));var Mustache=require(_0x680b('0x5'));var util=require(_0x680b('0x6'));var path=require(_0x680b('0x7'));var sox=require('sox');var csv=require(_0x680b('0x8'));var ejs=require(_0x680b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x680b('0xa'));var crypto=require(_0x680b('0xb'));var jsforce=require(_0x680b('0xc'));var deskjs=require(_0x680b('0xd'));var toCsv=require(_0x680b('0x8'));var querystring=require('querystring');var Papa=require(_0x680b('0xe'));var extract=require(_0x680b('0xf'));var rimraf=require('rimraf');var archiver=require(_0x680b('0x10'));var Redis=require(_0x680b('0x11'));var authService=require(_0x680b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x680b('0x13'))(_0x680b('0x14'));var utils=require(_0x680b('0x15'));var config=require(_0x680b('0x16'));var licenseUtil=require(_0x680b('0x17'));var db=require(_0x680b('0x18'))['db'];config['redis']=_['defaults'](config[_0x680b('0x19')],{'host':_0x680b('0x1a'),'port':0x18eb});var socket=require(_0x680b('0x1b'))(new Redis(config[_0x680b('0x19')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x33327c,_0x4822e9){_0x4822e9=_0x4822e9||0xcc;return function(_0x28ed33){if(_0x28ed33){return _0x33327c[_0x680b('0x1c')](_0x4822e9);}return _0x33327c[_0x680b('0x1d')](_0x4822e9)[_0x680b('0x1e')]();};}function respondWithResult(_0x597ab3,_0x5dc466){_0x5dc466=_0x5dc466||0xc8;return function(_0x3ff5f7){if(_0x3ff5f7){return _0x597ab3[_0x680b('0x1d')](_0x5dc466)[_0x680b('0x1f')](_0x3ff5f7);}};}function respondWithFilteredResult(_0x21f748,_0x507273){return function(_0x39fc94){if(_0x39fc94){var _0x5424df=typeof _0x507273[_0x680b('0x20')]===_0x680b('0x21')&&typeof _0x507273[_0x680b('0x22')]===_0x680b('0x21');var _0x5d1c33=_0x39fc94[_0x680b('0x23')];var _0x2da635=_0x5424df?0x0:_0x507273[_0x680b('0x20')];var _0x176e9c=_0x5424df?_0x39fc94[_0x680b('0x23')]:_0x507273[_0x680b('0x20')]+_0x507273[_0x680b('0x22')];var _0x37e1ac;if(_0x176e9c>=_0x5d1c33){_0x176e9c=_0x5d1c33;_0x37e1ac=0xc8;}else{_0x37e1ac=0xce;}_0x21f748[_0x680b('0x1d')](_0x37e1ac);return _0x21f748[_0x680b('0x24')]('Content-Range',_0x2da635+'-'+_0x176e9c+'/'+_0x5d1c33)[_0x680b('0x1f')](_0x39fc94);}return null;};}function patchUpdates(_0x475390){return function(_0x3acba1){try{jsonpatch[_0x680b('0x25')](_0x3acba1,_0x475390,!![]);}catch(_0xfb0fad){return BPromise[_0x680b('0x26')](_0xfb0fad);}return _0x3acba1[_0x680b('0x27')]();};}function saveUpdates(_0x1a2d03,_0x2f08f0){return function(_0x5495bf){if(_0x5495bf){return _0x5495bf[_0x680b('0x28')](_0x1a2d03)[_0x680b('0x29')](function(_0x3462a2){return _0x3462a2;});}return null;};}function removeEntity(_0x13f1c1,_0x5540d1){return function(_0x105d8b){if(_0x105d8b){return _0x105d8b[_0x680b('0x2a')]()[_0x680b('0x29')](function(){var _0x1b4c40=_0x105d8b['get']({'plain':!![]});var _0x3ff66b=_0x680b('0x2b');return db['UserProfileResource'][_0x680b('0x2a')]({'where':{'type':_0x3ff66b,'resourceId':_0x1b4c40['id']}})[_0x680b('0x29')](function(){return _0x105d8b;});})['then'](function(){_0x13f1c1[_0x680b('0x1d')](0xcc)[_0x680b('0x1e')]();});}};}function handleEntityNotFound(_0x5be21d,_0x194eaa){return function(_0x2a81e8){if(!_0x2a81e8){_0x5be21d[_0x680b('0x1c')](0x194);}return _0x2a81e8;};}function handleError(_0x39c28c,_0x136e72){_0x136e72=_0x136e72||0x1f4;return function(_0x11959b){logger['error'](_0x11959b['stack']);if(_0x11959b[_0x680b('0x2c')]){delete _0x11959b[_0x680b('0x2c')];}_0x39c28c['status'](_0x136e72)[_0x680b('0x2d')](_0x11959b);};}exports['index']=function(_0x1ac21d,_0x1d77bc){var _0x8e7487={},_0x4b301d={},_0x1c9356={'count':0x0,'rows':[]};var _0x40fb2d=_['map'](db[_0x680b('0x2e')]['rawAttributes'],function(_0x45dbeb){return{'name':_0x45dbeb[_0x680b('0x2f')],'type':_0x45dbeb[_0x680b('0x30')]['key']};});_0x4b301d['model']=_['map'](_0x40fb2d,_0x680b('0x2c'));_0x4b301d[_0x680b('0x31')]=_[_0x680b('0x32')](_0x1ac21d[_0x680b('0x31')]);_0x4b301d['filters']=_[_0x680b('0x33')](_0x4b301d['model'],_0x4b301d['query']);_0x8e7487[_0x680b('0x34')]=_[_0x680b('0x33')](_0x4b301d[_0x680b('0x35')],qs['fields'](_0x1ac21d[_0x680b('0x31')][_0x680b('0x36')]));_0x8e7487[_0x680b('0x34')]=_0x8e7487['attributes'][_0x680b('0x37')]?_0x8e7487['attributes']:_0x4b301d['model'];if(!_0x1ac21d[_0x680b('0x31')][_0x680b('0x38')]('nolimit')){_0x8e7487[_0x680b('0x22')]=qs[_0x680b('0x22')](_0x1ac21d[_0x680b('0x31')][_0x680b('0x22')]);_0x8e7487['offset']=qs['offset'](_0x1ac21d[_0x680b('0x31')][_0x680b('0x20')]);}_0x8e7487[_0x680b('0x39')]=qs[_0x680b('0x3a')](_0x1ac21d[_0x680b('0x31')][_0x680b('0x3a')]);_0x8e7487[_0x680b('0x3b')]=qs[_0x680b('0x3c')](_[_0x680b('0x3d')](_0x1ac21d[_0x680b('0x31')],_0x4b301d[_0x680b('0x3c')]),_0x40fb2d);if(_0x1ac21d[_0x680b('0x31')][_0x680b('0x3e')]){_0x8e7487[_0x680b('0x3b')]=_['merge'](_0x8e7487[_0x680b('0x3b')],{'$or':_[_0x680b('0x3f')](_0x40fb2d,function(_0x4dbf96){if(_0x4dbf96[_0x680b('0x30')]!=='VIRTUAL'){var _0x3cac4e={};_0x3cac4e[_0x4dbf96[_0x680b('0x2c')]]={'$like':'%'+_0x1ac21d[_0x680b('0x31')][_0x680b('0x3e')]+'%'};return _0x3cac4e;}})});}_0x8e7487=_[_0x680b('0x40')]({},_0x8e7487,_0x1ac21d[_0x680b('0x41')]);var _0x45900f={'where':_0x8e7487[_0x680b('0x3b')]};return db[_0x680b('0x2e')][_0x680b('0x23')](_0x45900f)[_0x680b('0x29')](function(_0x3eaf75){_0x1c9356[_0x680b('0x23')]=_0x3eaf75;if(_0x1ac21d[_0x680b('0x31')]['includeAll']){_0x8e7487[_0x680b('0x42')]=[{'all':!![]}];}return db[_0x680b('0x2e')][_0x680b('0x43')](_0x8e7487);})['then'](function(_0x387985){_0x1c9356[_0x680b('0x44')]=_0x387985;return _0x1c9356;})[_0x680b('0x29')](respondWithFilteredResult(_0x1d77bc,_0x8e7487))[_0x680b('0x45')](handleError(_0x1d77bc,null));};exports['show']=function(_0x49d130,_0x8d2b23){var _0x21a908={'raw':!![],'where':{'id':_0x49d130['params']['id']}},_0x33a611={};_0x33a611[_0x680b('0x35')]=_[_0x680b('0x32')](db[_0x680b('0x2e')][_0x680b('0x46')]);_0x33a611[_0x680b('0x31')]=_[_0x680b('0x32')](_0x49d130['query']);_0x33a611[_0x680b('0x3c')]=_[_0x680b('0x33')](_0x33a611[_0x680b('0x35')],_0x33a611['query']);_0x21a908[_0x680b('0x34')]=_[_0x680b('0x33')](_0x33a611[_0x680b('0x35')],qs[_0x680b('0x36')](_0x49d130['query'][_0x680b('0x36')]));_0x21a908[_0x680b('0x34')]=_0x21a908['attributes']['length']?_0x21a908['attributes']:_0x33a611[_0x680b('0x35')];if(_0x49d130[_0x680b('0x31')][_0x680b('0x47')]){_0x21a908[_0x680b('0x42')]=[{'all':!![]}];}_0x21a908=_[_0x680b('0x40')]({},_0x21a908,_0x49d130[_0x680b('0x41')]);return db[_0x680b('0x2e')][_0x680b('0x48')](_0x21a908)['then'](handleEntityNotFound(_0x8d2b23,null))[_0x680b('0x29')](respondWithResult(_0x8d2b23,null))[_0x680b('0x45')](handleError(_0x8d2b23,null));};exports[_0x680b('0x49')]=function(_0x1860ae,_0x32c1a8,_0x25f1b5){return db[_0x680b('0x2e')][_0x680b('0x48')]({'where':{'id':_0x1860ae[_0x680b('0x4a')]['id']},'attributes':[_0x680b('0x2c'),_0x680b('0x7')],'raw':!![]})[_0x680b('0x29')](handleEntityNotFound(_0x32c1a8,null))['then'](function(_0x1ff3f4){if(_0x1ff3f4){var _0x52d480=path[_0x680b('0x4b')](config[_0x680b('0x4c')],_0x680b('0x4d'),util[_0x680b('0x4e')](_0x680b('0x4f'),path[_0x680b('0x50')](_0x1ff3f4[_0x680b('0x7')])));var _0x53761e=fs[_0x680b('0x51')](_0x52d480);var _0x231acd=archiver(_0x680b('0x52'),{'zlib':{'level':0x9}});_0x231acd['on'](_0x680b('0x53'),function(_0x4229be){if(_0x4229be['code']===_0x680b('0x54')){logger[_0x680b('0x55')](_0x4229be);}else{throw new db[(_0x680b('0x56'))][(_0x680b('0x57'))](_0x680b('0x58'));}});_0x231acd['on']('error',function(_0x205c57){throw new db[(_0x680b('0x56'))][(_0x680b('0x57'))](_0x680b('0x58'));});_0x231acd['pipe'](_0x53761e);_0x231acd['glob']('**/*',{'cwd':path[_0x680b('0x4b')](config[_0x680b('0x4c')],_0x680b('0x4d'),path[_0x680b('0x59')](_0x1ff3f4[_0x680b('0x7')])),'ignore':[path['join'](path['basename'](_0x1ff3f4[_0x680b('0x7')]),'node_modules/**/*'),path[_0x680b('0x4b')](path[_0x680b('0x50')](_0x1ff3f4[_0x680b('0x7')]),_0x680b('0x5a'))],'nodir':!![]})[_0x680b('0x5b')]();_0x53761e['on']('close',function(){if(!fs[_0x680b('0x5c')](_0x52d480)){throw new db['Sequelize'][(_0x680b('0x57'))](_0x680b('0x5d'));}return _0x32c1a8[_0x680b('0x49')](_0x52d480,util[_0x680b('0x4e')](_0x680b('0x4f'),path[_0x680b('0x50')](_0x1ff3f4['path'])),function(_0x41df7e){if(_0x41df7e){throw new db[(_0x680b('0x56'))]['Error'](_0x680b('0x5e'));}fs[_0x680b('0x5f')](_0x52d480);logger[_0x680b('0x60')]('Download\x20completed');logger[_0x680b('0x60')](_0x680b('0x61'));});});}return null;})[_0x680b('0x45')](handleError(_0x32c1a8,null));};exports[_0x680b('0x62')]=function(_0x48d072,_0x5f56cc,_0x3d94e3){var _0x59fdcf=path[_0x680b('0x50')](_0x48d072[_0x680b('0x63')][_0x680b('0x64')],path[_0x680b('0x65')](_0x48d072['file'][_0x680b('0x64')]));var _0x9a364e=path[_0x680b('0x4b')](config[_0x680b('0x4c')],'server/files/plugins',_0x48d072[_0x680b('0x63')]['filename']);var _0x59814b=path[_0x680b('0x4b')](config[_0x680b('0x4c')],'server/files/plugins',_0x59fdcf);logger[_0x680b('0x60')](_0x680b('0x66'),_0x9a364e);logger['info'](_0x680b('0x67'),_0x59814b);try{fs['chmodSync'](_0x9a364e,parseInt(_0x680b('0x68'),0x8));extract(_0x9a364e,{'dir':_0x59814b},function(_0x291c06){if(_0x291c06){logger[_0x680b('0x55')](_0x291c06);handleError(_0x291c06,!![]);};var _0x2679ab=fs['readdirSync'](_0x59814b);if(_0x2679ab[_0x680b('0x37')]>0x1){removeReferences(_0x9a364e,_0x59814b);logger[_0x680b('0x55')](_0x680b('0x69'));return _0x3d94e3(new Error(_0x680b('0x69')));}var _0x4a8fb4=fs[_0x680b('0x6a')](path[_0x680b('0x4b')](_0x59814b,_0x2679ab[0x0]));if(_0x4a8fb4['isFile']()){removeReferences(_0x9a364e,_0x59814b);logger[_0x680b('0x55')]('Invalid\x20plugin\x20structure');return _0x3d94e3(new Error(_0x680b('0x69')));}if(_0x4a8fb4[_0x680b('0x6b')]()){var _0x8d582b=fs[_0x680b('0x6c')](path[_0x680b('0x4b')](_0x59814b,_0x2679ab[0x0]));if(_0x8d582b['length']===0x0){removeReferences(_0x9a364e,_0x59814b);logger[_0x680b('0x55')](_0x680b('0x69'));return _0x3d94e3(new Error(_0x680b('0x69')));}var _0x467211=_0x8d582b[_0x680b('0x6d')](function(_0xb30171){return _0xb30171==='manifest.json';});if(!_0x467211){return _0x3d94e3(new Error(_0x680b('0x6e')));}var _0x5d0ffe=fs[_0x680b('0x6f')](path[_0x680b('0x4b')](_0x59814b,_0x2679ab[0x0],_0x680b('0x70')));var _0x1eb382=JSON[_0x680b('0x71')](_0x5d0ffe);if('undefined'==typeof _0x1eb382[_0x680b('0x2c')]){return _0x3d94e3(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x1eb382[_0x680b('0x30')]){return _0x3d94e3(new Error(_0x680b('0x72')));}if('undefined'==typeof _0x1eb382[_0x680b('0x73')]){return _0x3d94e3(new Error(_0x680b('0x74')));}if(_0x680b('0x21')==typeof _0x1eb382['parameters']){return _0x3d94e3(new Error(_0x680b('0x75')));}if(_0x1eb382[_0x680b('0x30')]===_0x680b('0x76')){if('undefined'==typeof _0x1eb382[_0x680b('0x77')][_0x680b('0x78')]){return _0x3d94e3(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x680b('0x21')==typeof _0x1eb382['parameters'][_0x680b('0x78')][_0x680b('0x79')]&&_0x680b('0x21')==typeof _0x1eb382['parameters'][_0x680b('0x78')][_0x680b('0x7a')]){return _0x3d94e3(new Error(_0x680b('0x7b')));}}else if(_0x1eb382[_0x680b('0x30')]==='script'){if(_0x680b('0x21')==typeof _0x1eb382[_0x680b('0x77')][_0x680b('0x7c')]){return _0x3d94e3(new Error(_0x680b('0x7d')));}if(_0x680b('0x21')==typeof _0x1eb382['parameters']['scriptPath']){return _0x3d94e3(new Error(_0x680b('0x7e')));}}else{return _0x3d94e3(new Error(_0x680b('0x7f')));}var _0x45c421=_0x1eb382['name'];var _0x2ce5e0=_0x1eb382[_0x680b('0x80')];var _0x2ef9a3=_0x1eb382[_0x680b('0x30')];var _0x330656=_0x1eb382[_0x680b('0x81')]?_0x1eb382[_0x680b('0x81')]:_0x680b('0x82');var _0x35c75d=_0x1eb382[_0x680b('0x83')]?_0x1eb382[_0x680b('0x83')]:'icon-apps';var _0x39febc='';var _0x27b030='';var _0x12c069='';var _0x257a69='';var _0xfabfe3=_0x1eb382[_0x680b('0x73')];if(_0x2ef9a3==='html'){if(_0x680b('0x21')!=typeof _0x1eb382[_0x680b('0x77')][_0x680b('0x78')][_0x680b('0x79')]){var _0xb6fc86=_0x1eb382['parameters'][_0x680b('0x78')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x680b('0x84')](_0xb6fc86)){_0x39febc=path[_0x680b('0x4b')](_0x680b('0x85'),_0x59fdcf,_0x2679ab[0x0],_0xb6fc86);}else{_0x39febc=_0xb6fc86;}}else{logger[_0x680b('0x60')](_0x680b('0x86'));}if(_0x680b('0x21')!=typeof _0x1eb382['parameters'][_0x680b('0x78')][_0x680b('0x7a')]){var _0x3f35b8=_0x1eb382['parameters']['views'][_0x680b('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x680b('0x84')](_0x3f35b8)){_0x27b030=path['join'](_0x680b('0x85'),_0x59fdcf,_0x2679ab[0x0],_0x3f35b8);}else{_0x27b030=_0x3f35b8;}}else{logger[_0x680b('0x60')](_0x680b('0x87'));}}else if(_0x2ef9a3===_0x680b('0x88')){_0x12c069=_0x1eb382['parameters']['scriptName'];_0x257a69=_0x1eb382[_0x680b('0x77')]['scriptPath'];if(_0x680b('0x21')!=typeof _0x1eb382['parameters'][_0x680b('0x78')]){if(_0x680b('0x21')!=typeof _0x1eb382['parameters']['views'][_0x680b('0x79')]){var _0xb6fc86=_0x1eb382[_0x680b('0x77')][_0x680b('0x78')][_0x680b('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0xb6fc86)){_0x39febc=path[_0x680b('0x4b')](_0x680b('0x85'),_0x59fdcf,_0x2679ab[0x0],_0xb6fc86);}else{_0x39febc=_0xb6fc86;}}if(_0x680b('0x21')!=typeof _0x1eb382['parameters'][_0x680b('0x78')][_0x680b('0x7a')]){var _0x3f35b8=_0x1eb382['parameters']['views'][_0x680b('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x680b('0x84')](_0x3f35b8)){_0x27b030=path[_0x680b('0x4b')]('plugins',_0x59fdcf,_0x2679ab[0x0],_0x3f35b8);}else{_0x27b030=_0x3f35b8;}}}}var _0xa3a5ba={'name':_0x45c421,'description':_0x2ce5e0,'path':path[_0x680b('0x4b')](_0x59fdcf,_0x2679ab[0x0]),'type':_0x2ef9a3,'sidebar':_0x330656,'icon':_0x35c75d,'adminUrl':_0x39febc,'agentUrl':_0x27b030,'scriptName':_0x12c069,'scriptPath':_0x257a69,'version':_0xfabfe3};removeReferences(_0x9a364e,null);return db[_0x680b('0x2e')]['create'](_0xa3a5ba)[_0x680b('0x29')](function(_0x3ddf98){var _0x24d136={'role':_0x48d072['body']['role'],'userProfileId':_0x48d072[_0x680b('0x89')][_0x680b('0x8a')]};if(!_0x24d136)throw new Error(_0x680b('0x8b'));if(_0x24d136[_0x680b('0x8c')]===_0x680b('0x8d')){var _0x233b7d=_0x3ddf98[_0x680b('0x8e')]({'plain':!![]});return db[_0x680b('0x8f')][_0x680b('0x48')]({'where':{'name':_0x680b('0x2b'),'userProfileId':_0x24d136[_0x680b('0x8a')]},'raw':!![]})[_0x680b('0x29')](function(_0x57be4a){if(_0x57be4a&&_0x57be4a['autoAssociation']===0x0){return db[_0x680b('0x90')][_0x680b('0x91')]({'name':_0x233b7d[_0x680b('0x2c')],'resourceId':_0x233b7d['id'],'type':_0x57be4a[_0x680b('0x2c')],'sectionId':_0x57be4a['id']},{})['then'](function(){return _0x3ddf98;});}else{return _0x3ddf98;}})[_0x680b('0x45')](function(_0x4eb6ff){logger[_0x680b('0x55')](_0x680b('0x92'),_0x4eb6ff);throw _0x4eb6ff;});}return _0x3ddf98;})[_0x680b('0x29')](respondWithResult(_0x5f56cc,null))[_0x680b('0x45')](handleError(_0x5f56cc,null));}});}catch(_0x45e12a){_0x5f56cc[_0x680b('0x1d')](0x1f4)['send'](_0x45e12a);}};function removeReferences(_0x41ade6,_0x4cc5fb){try{if(_0x41ade6){fs[_0x680b('0x5f')](_0x41ade6);logger[_0x680b('0x60')](_0x680b('0x93'));}if(_0x4cc5fb){rimraf(_0x4cc5fb,function(){});logger[_0x680b('0x60')]('Extracted\x20folder\x20removed');}}catch(_0x3894af){logger[_0x680b('0x55')](_0x3894af);}}exports[_0x680b('0x28')]=function(_0x2a8913,_0x3cfba9,_0x588bc6){return db[_0x680b('0x2e')]['find']({'where':{'id':_0x2a8913[_0x680b('0x4a')]['id']}})[_0x680b('0x29')](handleEntityNotFound(_0x3cfba9,null))['then'](saveUpdates(_0x2a8913[_0x680b('0x89')],null))[_0x680b('0x29')](respondWithResult(_0x3cfba9,null))['catch'](handleError(_0x3cfba9,null));};exports[_0x680b('0x94')]=function(_0x2d7015,_0x6ac28b,_0x456c6e){return db[_0x680b('0x2e')][_0x680b('0x48')]({'where':{'id':_0x2d7015[_0x680b('0x4a')]['id']}})[_0x680b('0x29')](function(_0x569e7f){if(_0x569e7f){return _0x569e7f['destroy']();}})[_0x680b('0x29')](function(_0x417410){rimraf(path[_0x680b('0x4b')](config[_0x680b('0x4c')],_0x680b('0x4d'),path[_0x680b('0x59')](_0x417410['path'])),function(){});return _0x417410;})[_0x680b('0x29')](handleEntityNotFound(_0x6ac28b,null))[_0x680b('0x29')](respondWithStatusCode(_0x6ac28b,null))[_0x680b('0x45')](handleError(_0x6ac28b,null));};exports[_0x680b('0x95')]=function(_0x234ad0,_0x301424,_0x36ab48){return BPromise[_0x680b('0x96')]()[_0x680b('0x29')](function(){if(!_0x234ad0[_0x680b('0x31')][_0x680b('0x7')]){throw new Error(_0x680b('0x97'));}if(!_0x234ad0[_0x680b('0x31')][_0x680b('0x98')]){throw new Error(_0x680b('0x99'));}var _0x2f7998=_0x234ad0[_0x680b('0x31')][_0x680b('0x9a')]?_0x234ad0[_0x680b('0x31')]['hostname']+':'+_0x234ad0[_0x680b('0x31')][_0x680b('0x98')]:_0x680b('0x9b')+_0x234ad0[_0x680b('0x31')]['port'];var _0x550ec3=_0x234ad0[_0x680b('0x31')][_0x680b('0x1f')]?_0x234ad0['query'][_0x680b('0x1f')]:!![];var _0x2ae6fd=_0x234ad0[_0x680b('0x31')][_0x680b('0x9c')]?_0x234ad0[_0x680b('0x31')][_0x680b('0x9c')]:null;var _0x13a76e={'method':_0x234ad0[_0x680b('0x9d')],'uri':util[_0x680b('0x4e')](_0x680b('0x9e'),_0x2f7998,_0x234ad0['query'][_0x680b('0x7')]),'json':_0x550ec3,'resolveWithFullResponse':!![],'encoding':_0x2ae6fd,'qs':_0x234ad0[_0x680b('0x31')]};if(_0x234ad0[_0x680b('0x9f')]){_0x13a76e['headers']=_0x234ad0[_0x680b('0x9f')];if(_0x13a76e[_0x680b('0x9f')][_0x680b('0xa0')]){delete _0x13a76e[_0x680b('0x9f')][_0x680b('0xa0')];}}if(_0x13a76e[_0x680b('0x9f')][_0x680b('0xa1')]){delete _0x13a76e[_0x680b('0x9f')][_0x680b('0xa1')];}return rp(_0x13a76e);})[_0x680b('0x29')](function(_0x2ff0b2){if(_0x2ff0b2){_0x301424['set'](_0x2ff0b2[_0x680b('0x9f')]);logger['info'](_0x2ff0b2[_0x680b('0x89')]);if(_[_0x680b('0xa2')](_0x234ad0[_0x680b('0x31')][_0x680b('0x7')],_0x680b('0x49'))&&_0x2ff0b2[_0x680b('0xa3')]==0x1f4){return _0x301424[_0x680b('0x1c')](_0x2ff0b2['statusCode']);}else{return _0x301424[_0x680b('0x1d')](_0x2ff0b2[_0x680b('0xa3')])[_0x680b('0x2d')](_0x2ff0b2[_0x680b('0x89')]);}}else{return _0x301424[_0x680b('0x1c')](0xc8);}})['catch'](handleError(_0x301424,null));};exports[_0x680b('0xa4')]=function(_0x1bf1b2,_0x1dc60f,_0x47f447){return BPromise[_0x680b('0x96')]()[_0x680b('0x29')](function(){if(!_0x1bf1b2[_0x680b('0x31')]['path']){throw new Error(_0x680b('0x97'));}if(!_0x1bf1b2[_0x680b('0x31')][_0x680b('0x98')]){throw new Error(_0x680b('0x99'));}var _0x14c4e5=_0x1bf1b2['query'][_0x680b('0x9a')]?_0x1bf1b2[_0x680b('0x31')][_0x680b('0x9a')]+':'+_0x1bf1b2['query'][_0x680b('0x98')]:_0x680b('0x9b')+_0x1bf1b2[_0x680b('0x31')][_0x680b('0x98')];var _0x1e2b87=_0x1bf1b2['query']['json']?_0x1bf1b2[_0x680b('0x31')][_0x680b('0x1f')]:!![];var _0x2d5c99=_0x1bf1b2[_0x680b('0x31')][_0x680b('0x9c')]?_0x1bf1b2[_0x680b('0x31')][_0x680b('0x9c')]:null;var _0x3243ba={'method':_0x1bf1b2['method'],'uri':util[_0x680b('0x4e')](_0x680b('0x9e'),_0x14c4e5,_0x1bf1b2[_0x680b('0x31')][_0x680b('0x7')]),'json':_0x1e2b87,'resolveWithFullResponse':!![],'encoding':_0x2d5c99,'body':_0x1bf1b2[_0x680b('0x89')]};if(_0x1bf1b2[_0x680b('0x9f')]){_0x3243ba[_0x680b('0x9f')]=_0x1bf1b2[_0x680b('0x9f')];if(_0x3243ba[_0x680b('0x9f')][_0x680b('0xa0')]){delete _0x3243ba[_0x680b('0x9f')]['content-length'];}}if(_0x3243ba[_0x680b('0x9f')]['content-type']){delete _0x3243ba['headers']['content-type'];}return rp(_0x3243ba);})[_0x680b('0x29')](function(_0xb71da5){if(_0xb71da5){_0x1dc60f['set'](_0xb71da5[_0x680b('0x9f')]);logger[_0x680b('0x60')](_0xb71da5['body']);return _0x1dc60f[_0x680b('0x1d')](_0xb71da5[_0x680b('0xa3')])[_0x680b('0x2d')](_0xb71da5[_0x680b('0x89')]);}else{return _0x1dc60f[_0x680b('0x1c')](0xc8);}})['catch'](handleError(_0x1dc60f,null));}; \ No newline at end of file +var _0xc929=['Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','update','delete','find','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','then','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','findAll','rows','catch','params','includeAll','include','options','download','path','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info'];(function(_0x3fd6ae,_0x332c75){var _0x204d55=function(_0xe316f3){while(--_0xe316f3){_0x3fd6ae['push'](_0x3fd6ae['shift']());}};_0x204d55(++_0x332c75);}(_0xc929,0xee));var _0x9c92=function(_0x4a1f95,_0x579846){_0x4a1f95=_0x4a1f95-0x0;var _0x2bed91=_0xc929[_0x4a1f95];return _0x2bed91;};'use strict';var emlformat=require(_0x9c92('0x0'));var rimraf=require(_0x9c92('0x1'));var zipdir=require(_0x9c92('0x2'));var jsonpatch=require(_0x9c92('0x3'));var rp=require(_0x9c92('0x4'));var moment=require(_0x9c92('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c92('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9c92('0x7'));var ejs=require(_0x9c92('0x8'));var fs=require('fs');var fs_extra=require(_0x9c92('0x9'));var _=require('lodash');var squel=require(_0x9c92('0xa'));var crypto=require('crypto');var jsforce=require(_0x9c92('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9c92('0x7'));var querystring=require(_0x9c92('0xc'));var Papa=require('papaparse');var extract=require(_0x9c92('0xd'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x9c92('0xe'));var authService=require(_0x9c92('0xf'));var qs=require(_0x9c92('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c92('0x11'))('api');var utils=require(_0x9c92('0x12'));var config=require(_0x9c92('0x13'));var licenseUtil=require(_0x9c92('0x14'));var db=require(_0x9c92('0x15'))['db'];config[_0x9c92('0x16')]=_[_0x9c92('0x17')](config[_0x9c92('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c92('0x16')]));require(_0x9c92('0x18'))[_0x9c92('0x19')](socket);function respondWithStatusCode(_0x1381a0,_0x2dc170){_0x2dc170=_0x2dc170||0xcc;return function(_0x33f6d0){if(_0x33f6d0){return _0x1381a0[_0x9c92('0x1a')](_0x2dc170);}return _0x1381a0['status'](_0x2dc170)[_0x9c92('0x1b')]();};}function respondWithResult(_0x4e589a,_0x195f4c){_0x195f4c=_0x195f4c||0xc8;return function(_0x3a7afe){if(_0x3a7afe){return _0x4e589a[_0x9c92('0x1c')](_0x195f4c)[_0x9c92('0x1d')](_0x3a7afe);}};}function respondWithFilteredResult(_0xc34fde,_0x2db3b3){return function(_0x197267){if(_0x197267){var _0x1d9ed1=typeof _0x2db3b3['offset']===_0x9c92('0x1e')&&typeof _0x2db3b3[_0x9c92('0x1f')]===_0x9c92('0x1e');var _0x48fea2=_0x197267[_0x9c92('0x20')];var _0x28944e=_0x1d9ed1?0x0:_0x2db3b3[_0x9c92('0x21')];var _0x5cef78=_0x1d9ed1?_0x197267['count']:_0x2db3b3[_0x9c92('0x21')]+_0x2db3b3[_0x9c92('0x1f')];var _0x2aeddc;if(_0x5cef78>=_0x48fea2){_0x5cef78=_0x48fea2;_0x2aeddc=0xc8;}else{_0x2aeddc=0xce;}_0xc34fde['status'](_0x2aeddc);return _0xc34fde[_0x9c92('0x22')]('Content-Range',_0x28944e+'-'+_0x5cef78+'/'+_0x48fea2)[_0x9c92('0x1d')](_0x197267);}return null;};}function patchUpdates(_0x38df88){return function(_0x2ef159){try{jsonpatch['apply'](_0x2ef159,_0x38df88,!![]);}catch(_0xb9962){return BPromise[_0x9c92('0x23')](_0xb9962);}return _0x2ef159[_0x9c92('0x24')]();};}function saveUpdates(_0x5646cd,_0x2a41a0){return function(_0x512041){if(_0x512041){return _0x512041['update'](_0x5646cd)[_0x9c92('0x25')](function(_0x108a5f){return _0x108a5f;});}return null;};}function removeEntity(_0x4d694c,_0x5ea3c2){return function(_0x4db889){if(_0x4db889){return _0x4db889['destroy']()[_0x9c92('0x25')](function(){var _0xcafdb6=_0x4db889[_0x9c92('0x26')]({'plain':!![]});var _0x4867dd='Plugins';return db[_0x9c92('0x27')]['destroy']({'where':{'type':_0x4867dd,'resourceId':_0xcafdb6['id']}})[_0x9c92('0x25')](function(){return _0x4db889;});})['then'](function(){_0x4d694c[_0x9c92('0x1c')](0xcc)[_0x9c92('0x1b')]();});}};}function handleEntityNotFound(_0x4d5c31,_0x1b6fb1){return function(_0x2aeb59){if(!_0x2aeb59){_0x4d5c31[_0x9c92('0x1a')](0x194);}return _0x2aeb59;};}function handleError(_0x4361cd,_0x5ddbb7){_0x5ddbb7=_0x5ddbb7||0x1f4;return function(_0x471571){logger[_0x9c92('0x28')](_0x471571[_0x9c92('0x29')]);if(_0x471571[_0x9c92('0x2a')]){delete _0x471571['name'];}_0x4361cd[_0x9c92('0x1c')](_0x5ddbb7)[_0x9c92('0x2b')](_0x471571);};}exports[_0x9c92('0x2c')]=function(_0x57d96f,_0x33db62){var _0x208a33={},_0x3900e8={},_0x59ed90={'count':0x0,'rows':[]};var _0x368691=_[_0x9c92('0x2d')](db[_0x9c92('0x2e')][_0x9c92('0x2f')],function(_0x11ab6a){return{'name':_0x11ab6a[_0x9c92('0x30')],'type':_0x11ab6a[_0x9c92('0x31')][_0x9c92('0x32')]};});_0x3900e8[_0x9c92('0x33')]=_['map'](_0x368691,'name');_0x3900e8[_0x9c92('0x34')]=_[_0x9c92('0x35')](_0x57d96f[_0x9c92('0x34')]);_0x3900e8[_0x9c92('0x36')]=_[_0x9c92('0x37')](_0x3900e8[_0x9c92('0x33')],_0x3900e8[_0x9c92('0x34')]);_0x208a33[_0x9c92('0x38')]=_[_0x9c92('0x37')](_0x3900e8[_0x9c92('0x33')],qs['fields'](_0x57d96f['query'][_0x9c92('0x39')]));_0x208a33[_0x9c92('0x38')]=_0x208a33[_0x9c92('0x38')][_0x9c92('0x3a')]?_0x208a33['attributes']:_0x3900e8['model'];if(!_0x57d96f[_0x9c92('0x34')][_0x9c92('0x3b')]('nolimit')){_0x208a33['limit']=qs[_0x9c92('0x1f')](_0x57d96f[_0x9c92('0x34')][_0x9c92('0x1f')]);_0x208a33['offset']=qs['offset'](_0x57d96f[_0x9c92('0x34')]['offset']);}_0x208a33[_0x9c92('0x3c')]=qs['sort'](_0x57d96f['query'][_0x9c92('0x3d')]);_0x208a33['where']=qs[_0x9c92('0x36')](_['pick'](_0x57d96f[_0x9c92('0x34')],_0x3900e8[_0x9c92('0x36')]),_0x368691);if(_0x57d96f[_0x9c92('0x34')][_0x9c92('0x3e')]){_0x208a33[_0x9c92('0x3f')]=_[_0x9c92('0x40')](_0x208a33[_0x9c92('0x3f')],{'$or':_[_0x9c92('0x2d')](_0x368691,function(_0x584697){if(_0x584697['type']!==_0x9c92('0x41')){var _0x23c12e={};_0x23c12e[_0x584697[_0x9c92('0x2a')]]={'$like':'%'+_0x57d96f['query'][_0x9c92('0x3e')]+'%'};return _0x23c12e;}})});}_0x208a33=_[_0x9c92('0x40')]({},_0x208a33,_0x57d96f['options']);var _0x4ce582={'where':_0x208a33['where']};return db[_0x9c92('0x2e')][_0x9c92('0x20')](_0x4ce582)[_0x9c92('0x25')](function(_0x5524f6){_0x59ed90[_0x9c92('0x20')]=_0x5524f6;if(_0x57d96f[_0x9c92('0x34')]['includeAll']){_0x208a33['include']=[{'all':!![]}];}return db['Plugin'][_0x9c92('0x42')](_0x208a33);})[_0x9c92('0x25')](function(_0x2db52b){_0x59ed90[_0x9c92('0x43')]=_0x2db52b;return _0x59ed90;})['then'](respondWithFilteredResult(_0x33db62,_0x208a33))[_0x9c92('0x44')](handleError(_0x33db62,null));};exports['show']=function(_0x2cf015,_0x6003c9){var _0x272459={'raw':!![],'where':{'id':_0x2cf015[_0x9c92('0x45')]['id']}},_0x479d9c={};_0x479d9c[_0x9c92('0x33')]=_[_0x9c92('0x35')](db[_0x9c92('0x2e')][_0x9c92('0x2f')]);_0x479d9c['query']=_[_0x9c92('0x35')](_0x2cf015[_0x9c92('0x34')]);_0x479d9c[_0x9c92('0x36')]=_[_0x9c92('0x37')](_0x479d9c[_0x9c92('0x33')],_0x479d9c['query']);_0x272459['attributes']=_['intersection'](_0x479d9c[_0x9c92('0x33')],qs[_0x9c92('0x39')](_0x2cf015[_0x9c92('0x34')][_0x9c92('0x39')]));_0x272459[_0x9c92('0x38')]=_0x272459['attributes'][_0x9c92('0x3a')]?_0x272459[_0x9c92('0x38')]:_0x479d9c[_0x9c92('0x33')];if(_0x2cf015[_0x9c92('0x34')][_0x9c92('0x46')]){_0x272459[_0x9c92('0x47')]=[{'all':!![]}];}_0x272459=_[_0x9c92('0x40')]({},_0x272459,_0x2cf015[_0x9c92('0x48')]);return db[_0x9c92('0x2e')]['find'](_0x272459)[_0x9c92('0x25')](handleEntityNotFound(_0x6003c9,null))[_0x9c92('0x25')](respondWithResult(_0x6003c9,null))[_0x9c92('0x44')](handleError(_0x6003c9,null));};exports[_0x9c92('0x49')]=function(_0x4dcba7,_0x58d811,_0xd1ca06){return db[_0x9c92('0x2e')]['find']({'where':{'id':_0x4dcba7[_0x9c92('0x45')]['id']},'attributes':['name',_0x9c92('0x4a')],'raw':!![]})[_0x9c92('0x25')](handleEntityNotFound(_0x58d811,null))[_0x9c92('0x25')](function(_0x558460){if(_0x558460){var _0x5ead9d=path[_0x9c92('0x4b')](config['root'],_0x9c92('0x4c'),util[_0x9c92('0x4d')](_0x9c92('0x4e'),path[_0x9c92('0x4f')](_0x558460['path'])));var _0x34f254=fs[_0x9c92('0x50')](_0x5ead9d);var _0x54a0be=archiver(_0x9c92('0x51'),{'zlib':{'level':0x9}});_0x54a0be['on']('warning',function(_0x476a9a){if(_0x476a9a[_0x9c92('0x52')]===_0x9c92('0x53')){logger[_0x9c92('0x28')](_0x476a9a);}else{throw new db[(_0x9c92('0x54'))][(_0x9c92('0x55'))](_0x9c92('0x56'));}});_0x54a0be['on'](_0x9c92('0x28'),function(_0x5526ae){throw new db[(_0x9c92('0x54'))]['Error'](_0x9c92('0x56'));});_0x54a0be[_0x9c92('0x57')](_0x34f254);_0x54a0be[_0x9c92('0x58')](_0x9c92('0x59'),{'cwd':path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],_0x9c92('0x4c'),path['dirname'](_0x558460[_0x9c92('0x4a')])),'ignore':[path['join'](path['basename'](_0x558460[_0x9c92('0x4a')]),'node_modules/**/*'),path[_0x9c92('0x4b')](path[_0x9c92('0x4f')](_0x558460[_0x9c92('0x4a')]),_0x9c92('0x5b'))],'nodir':!![]})[_0x9c92('0x5c')]();_0x34f254['on'](_0x9c92('0x5d'),function(){if(!fs[_0x9c92('0x5e')](_0x5ead9d)){throw new db[(_0x9c92('0x54'))][(_0x9c92('0x55'))]('Plugin\x20not\x20found');}return _0x58d811[_0x9c92('0x49')](_0x5ead9d,util[_0x9c92('0x4d')](_0x9c92('0x4e'),path[_0x9c92('0x4f')](_0x558460[_0x9c92('0x4a')])),function(_0x2e928a){if(_0x2e928a){throw new db[(_0x9c92('0x54'))]['Error'](_0x9c92('0x5f'));}fs[_0x9c92('0x60')](_0x5ead9d);logger[_0x9c92('0x61')](_0x9c92('0x62'));logger[_0x9c92('0x61')](_0x9c92('0x63'));});});}return null;})[_0x9c92('0x44')](handleError(_0x58d811,null));};exports[_0x9c92('0x64')]=function(_0x1e0744,_0x453580,_0x20c947){var _0x3d2cb5=path[_0x9c92('0x4f')](_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')],path['extname'](_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')]));var _0x4d2c64=path[_0x9c92('0x4b')](config['root'],'server/files/plugins',_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')]);var _0x49d9c4=path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],_0x9c92('0x4c'),_0x3d2cb5);logger[_0x9c92('0x61')](_0x9c92('0x67'),_0x4d2c64);logger[_0x9c92('0x61')](_0x9c92('0x68'),_0x49d9c4);try{fs[_0x9c92('0x69')](_0x4d2c64,parseInt(_0x9c92('0x6a'),0x8));extract(_0x4d2c64,{'dir':_0x49d9c4},function(_0x38cbfe){if(_0x38cbfe){logger[_0x9c92('0x28')](_0x38cbfe);handleError(_0x38cbfe,!![]);};var _0x2051a9=fs[_0x9c92('0x6b')](_0x49d9c4);if(_0x2051a9['length']>0x1){removeReferences(_0x4d2c64,_0x49d9c4);logger['error'](_0x9c92('0x6c'));return _0x20c947(new Error('Invalid\x20plugin\x20structure'));}var _0x57f54d=fs['lstatSync'](path['join'](_0x49d9c4,_0x2051a9[0x0]));if(_0x57f54d[_0x9c92('0x6d')]()){removeReferences(_0x4d2c64,_0x49d9c4);logger[_0x9c92('0x28')](_0x9c92('0x6c'));return _0x20c947(new Error(_0x9c92('0x6c')));}if(_0x57f54d[_0x9c92('0x6e')]()){var _0x14cd89=fs[_0x9c92('0x6b')](path[_0x9c92('0x4b')](_0x49d9c4,_0x2051a9[0x0]));if(_0x14cd89[_0x9c92('0x3a')]===0x0){removeReferences(_0x4d2c64,_0x49d9c4);logger[_0x9c92('0x28')](_0x9c92('0x6c'));return _0x20c947(new Error(_0x9c92('0x6c')));}var _0x25c645=_0x14cd89[_0x9c92('0x6f')](function(_0x3c280e){return _0x3c280e===_0x9c92('0x70');});if(!_0x25c645){return _0x20c947(new Error(_0x9c92('0x71')));}var _0x188f59=fs[_0x9c92('0x72')](path['join'](_0x49d9c4,_0x2051a9[0x0],'manifest.json'));var _0x3ef626=JSON[_0x9c92('0x73')](_0x188f59);if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x2a')]){return _0x20c947(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x31')]){return _0x20c947(new Error(_0x9c92('0x74')));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x75')]){return _0x20c947(new Error(_0x9c92('0x76')));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')]){return _0x20c947(new Error(_0x9c92('0x78')));}if(_0x3ef626[_0x9c92('0x31')]===_0x9c92('0x79')){if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]){return _0x20c947(new Error(_0x9c92('0x7b')));}if(_0x9c92('0x1e')==typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x7c')]&&_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]['agent']){return _0x20c947(new Error(_0x9c92('0x7d')));}}else if(_0x3ef626[_0x9c92('0x31')]===_0x9c92('0x7e')){if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7f')]){return _0x20c947(new Error(_0x9c92('0x80')));}if('undefined'==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x81')]){return _0x20c947(new Error(_0x9c92('0x82')));}}else{return _0x20c947(new Error(_0x9c92('0x83')));}var _0x17c90f=_0x3ef626['name'];var _0x3fa001=_0x3ef626[_0x9c92('0x84')];var _0x27aca1=_0x3ef626[_0x9c92('0x31')];var _0x10a6a4=_0x3ef626[_0x9c92('0x85')]?_0x3ef626[_0x9c92('0x85')]:_0x9c92('0x86');var _0xc0505=_0x3ef626[_0x9c92('0x87')]?_0x3ef626[_0x9c92('0x87')]:_0x9c92('0x88');var _0x4b6b04='';var _0x4017b3='';var _0x17d6e5='';var _0x4c5df3='';var _0x48dd94=_0x3ef626[_0x9c92('0x75')];if(_0x27aca1==='html'){if(_0x9c92('0x1e')!=typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]['admin']){var _0x497d4a=_0x3ef626['parameters']['views'][_0x9c92('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x497d4a)){_0x4b6b04=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x497d4a);}else{_0x4b6b04=_0x497d4a;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9c92('0x1e')!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x8b')]){var _0x2c7af9=_0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')][_0x9c92('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x2c7af9)){_0x4017b3=path[_0x9c92('0x4b')]('plugins',_0x3d2cb5,_0x2051a9[0x0],_0x2c7af9);}else{_0x4017b3=_0x2c7af9;}}else{logger[_0x9c92('0x61')](_0x9c92('0x8c'));}}else if(_0x27aca1===_0x9c92('0x7e')){_0x17d6e5=_0x3ef626['parameters'][_0x9c92('0x7f')];_0x4c5df3=_0x3ef626[_0x9c92('0x77')][_0x9c92('0x81')];if(_0x9c92('0x1e')!=typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]){if('undefined'!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x7c')]){var _0x497d4a=_0x3ef626['parameters']['views'][_0x9c92('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x497d4a)){_0x4b6b04=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x497d4a);}else{_0x4b6b04=_0x497d4a;}}if(_0x9c92('0x1e')!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x8b')]){var _0x2c7af9=_0x3ef626['parameters'][_0x9c92('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x2c7af9)){_0x4017b3=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x2c7af9);}else{_0x4017b3=_0x2c7af9;}}}}var _0x216258={'name':_0x17c90f,'description':_0x3fa001,'path':path[_0x9c92('0x4b')](_0x3d2cb5,_0x2051a9[0x0]),'type':_0x27aca1,'sidebar':_0x10a6a4,'icon':_0xc0505,'adminUrl':_0x4b6b04,'agentUrl':_0x4017b3,'scriptName':_0x17d6e5,'scriptPath':_0x4c5df3,'version':_0x48dd94};removeReferences(_0x4d2c64,null);return db[_0x9c92('0x2e')][_0x9c92('0x8d')](_0x216258)[_0x9c92('0x25')](function(_0x180fa6){var _0x2f886={'role':_0x1e0744['body'][_0x9c92('0x8e')],'userProfileId':_0x1e0744[_0x9c92('0x8f')][_0x9c92('0x90')]};if(!_0x2f886)throw new Error(_0x9c92('0x91'));if(_0x2f886[_0x9c92('0x8e')]===_0x9c92('0x92')){var _0x242d47=_0x180fa6[_0x9c92('0x26')]({'plain':!![]});return db[_0x9c92('0x93')]['find']({'where':{'name':'Plugins','userProfileId':_0x2f886[_0x9c92('0x90')]},'raw':!![]})[_0x9c92('0x25')](function(_0x11157d){if(_0x11157d&&_0x11157d[_0x9c92('0x94')]===0x0){return db[_0x9c92('0x27')][_0x9c92('0x8d')]({'name':_0x242d47[_0x9c92('0x2a')],'resourceId':_0x242d47['id'],'type':_0x11157d['name'],'sectionId':_0x11157d['id']},{})[_0x9c92('0x25')](function(){return _0x180fa6;});}else{return _0x180fa6;}})[_0x9c92('0x44')](function(_0x3b87c0){logger[_0x9c92('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b87c0);throw _0x3b87c0;});}return _0x180fa6;})[_0x9c92('0x25')](respondWithResult(_0x453580,null))[_0x9c92('0x44')](handleError(_0x453580,null));}});}catch(_0x1b4628){_0x453580[_0x9c92('0x1c')](0x1f4)[_0x9c92('0x2b')](_0x1b4628);}};function removeReferences(_0x662c33,_0x40e2c1){try{if(_0x662c33){fs[_0x9c92('0x60')](_0x662c33);logger[_0x9c92('0x61')](_0x9c92('0x95'));}if(_0x40e2c1){rimraf(_0x40e2c1,function(){});logger[_0x9c92('0x61')]('Extracted\x20folder\x20removed');}}catch(_0x40d324){logger[_0x9c92('0x28')](_0x40d324);}}exports[_0x9c92('0x96')]=function(_0x15b753,_0x4c68a5,_0x2ed5ff){return db[_0x9c92('0x2e')]['find']({'where':{'id':_0x15b753[_0x9c92('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c68a5,null))[_0x9c92('0x25')](saveUpdates(_0x15b753[_0x9c92('0x8f')],null))['then'](respondWithResult(_0x4c68a5,null))[_0x9c92('0x44')](handleError(_0x4c68a5,null));};exports[_0x9c92('0x97')]=function(_0x1ec30e,_0x3b339e,_0x547a66){return db[_0x9c92('0x2e')][_0x9c92('0x98')]({'where':{'id':_0x1ec30e[_0x9c92('0x45')]['id']}})['then'](function(_0x141f27){if(_0x141f27){return _0x141f27['destroy']();}})[_0x9c92('0x25')](function(_0x88a69b){rimraf(path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],'server/files/plugins',path['dirname'](_0x88a69b['path'])),function(){});return _0x88a69b;})[_0x9c92('0x25')](handleEntityNotFound(_0x3b339e,null))[_0x9c92('0x25')](respondWithStatusCode(_0x3b339e,null))[_0x9c92('0x44')](handleError(_0x3b339e,null));};exports['webhookGet']=function(_0x36ed5e,_0x87cd9d,_0xa0f221){return BPromise[_0x9c92('0x99')]()[_0x9c92('0x25')](function(){if(!_0x36ed5e['query'][_0x9c92('0x4a')]){throw new Error(_0x9c92('0x9a'));}if(!_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')]){throw new Error(_0x9c92('0x9c'));}var _0x361bf9=_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9d')]?_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9d')]+':'+_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')]:_0x9c92('0x9e')+_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')];var _0x2df32a=_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x1d')]?_0x36ed5e['query'][_0x9c92('0x1d')]:!![];var _0x3aa6f4=_0x36ed5e[_0x9c92('0x34')]['encoding']?_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9f')]:null;var _0x3de6a9={'method':_0x36ed5e[_0x9c92('0xa0')],'uri':util['format'](_0x9c92('0xa1'),_0x361bf9,_0x36ed5e[_0x9c92('0x34')]['path']),'json':_0x2df32a,'resolveWithFullResponse':!![],'encoding':_0x3aa6f4,'qs':_0x36ed5e[_0x9c92('0x34')]};if(_0x36ed5e[_0x9c92('0xa2')]){_0x3de6a9[_0x9c92('0xa2')]=_0x36ed5e[_0x9c92('0xa2')];if(_0x3de6a9['headers'][_0x9c92('0xa3')]){delete _0x3de6a9[_0x9c92('0xa2')][_0x9c92('0xa3')];}}if(_0x3de6a9[_0x9c92('0xa2')]['content-type']){delete _0x3de6a9[_0x9c92('0xa2')][_0x9c92('0xa4')];}return rp(_0x3de6a9);})['then'](function(_0x28fe87){if(_0x28fe87){_0x87cd9d[_0x9c92('0x22')](_0x28fe87[_0x9c92('0xa2')]);logger[_0x9c92('0x61')](_0x28fe87[_0x9c92('0x8f')]);if(_[_0x9c92('0xa5')](_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x4a')],_0x9c92('0x49'))&&_0x28fe87[_0x9c92('0xa6')]==0x1f4){return _0x87cd9d[_0x9c92('0x1a')](_0x28fe87[_0x9c92('0xa6')]);}else{return _0x87cd9d[_0x9c92('0x1c')](_0x28fe87[_0x9c92('0xa6')])[_0x9c92('0x2b')](_0x28fe87[_0x9c92('0x8f')]);}}else{return _0x87cd9d[_0x9c92('0x1a')](0xc8);}})[_0x9c92('0x44')](handleError(_0x87cd9d,null));};exports[_0x9c92('0xa7')]=function(_0x1cb25c,_0x45d231,_0x75d66){return BPromise[_0x9c92('0x99')]()[_0x9c92('0x25')](function(){if(!_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x4a')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9b')]){throw new Error(_0x9c92('0x9c'));}var _0x4dc9a4=_0x1cb25c['query'][_0x9c92('0x9d')]?_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9d')]+':'+_0x1cb25c['query'][_0x9c92('0x9b')]:_0x9c92('0x9e')+_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9b')];var _0xfadbb6=_0x1cb25c['query'][_0x9c92('0x1d')]?_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x1d')]:!![];var _0x1c7136=_0x1cb25c['query'][_0x9c92('0x9f')]?_0x1cb25c['query'][_0x9c92('0x9f')]:null;var _0x52a2b6={'method':_0x1cb25c[_0x9c92('0xa0')],'uri':util[_0x9c92('0x4d')](_0x9c92('0xa1'),_0x4dc9a4,_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x4a')]),'json':_0xfadbb6,'resolveWithFullResponse':!![],'encoding':_0x1c7136,'body':_0x1cb25c['body']};if(_0x1cb25c[_0x9c92('0xa2')]){_0x52a2b6[_0x9c92('0xa2')]=_0x1cb25c['headers'];if(_0x52a2b6[_0x9c92('0xa2')]['content-length']){delete _0x52a2b6['headers'][_0x9c92('0xa3')];}}if(_0x52a2b6[_0x9c92('0xa2')][_0x9c92('0xa4')]){delete _0x52a2b6[_0x9c92('0xa2')][_0x9c92('0xa4')];}return rp(_0x52a2b6);})[_0x9c92('0x25')](function(_0x1f0d60){if(_0x1f0d60){_0x45d231[_0x9c92('0x22')](_0x1f0d60[_0x9c92('0xa2')]);logger[_0x9c92('0x61')](_0x1f0d60[_0x9c92('0x8f')]);return _0x45d231[_0x9c92('0x1c')](_0x1f0d60[_0x9c92('0xa6')])[_0x9c92('0x2b')](_0x1f0d60[_0x9c92('0x8f')]);}else{return _0x45d231[_0x9c92('0x1a')](0xc8);}})['catch'](handleError(_0x45d231,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3a70946..e663e75 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 _0x16d8=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x1100f1,_0xe8308f){var _0x1c7c02=function(_0xaa84b2){while(--_0xaa84b2){_0x1100f1['push'](_0x1100f1['shift']());}};_0x1c7c02(++_0xe8308f);}(_0x16d8,0xa3));var _0x816d=function(_0x49beb8,_0x55b135){_0x49beb8=_0x49beb8-0x0;var _0x8a3566=_0x16d8[_0x49beb8];return _0x8a3566;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x816d('0x0'))['db'][_0x816d('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x816d('0x2')](0x0);var events={'afterCreate':_0x816d('0x3'),'afterUpdate':_0x816d('0x4'),'afterDestroy':_0x816d('0x5')};function emitEvent(_0x24b6d0){return function(_0x2c491b,_0x29b15c,_0x4fb0f2){PluginEvents[_0x816d('0x6')](_0x24b6d0+':'+_0x2c491b['id'],_0x2c491b);PluginEvents['emit'](_0x24b6d0,_0x2c491b);_0x4fb0f2(null);};}for(var e in events){if(events[_0x816d('0x7')](e)){var event=events[e];Plugin[_0x816d('0x8')](e,emitEvent(event));}}module[_0x816d('0x9')]=PluginEvents; \ No newline at end of file +var _0x86b8=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86b8,0x15d));var _0x886b=function(_0x1912c2,_0x3557b6){_0x1912c2=_0x1912c2-0x0;var _0x316758=_0x86b8[_0x1912c2];return _0x316758;};'use strict';var EventEmitter=require(_0x886b('0x0'));var Plugin=require(_0x886b('0x1'))['db'][_0x886b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x886b('0x3'),'afterUpdate':'update','afterDestroy':_0x886b('0x4')};function emitEvent(_0x8d89c9){return function(_0x4191fb,_0x4d3769,_0xc815){PluginEvents['emit'](_0x8d89c9+':'+_0x4191fb['id'],_0x4191fb);PluginEvents['emit'](_0x8d89c9,_0x4191fb);_0xc815(null);};}for(var e in events){if(events[_0x886b('0x5')](e)){var event=events[e];Plugin[_0x886b('0x6')](e,emitEvent(event));}}module[_0x886b('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 98493c7..04946d6 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 _0x8e13=['request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','api','bluebird'];(function(_0x429457,_0x167539){var _0x9eaaca=function(_0x5e4d29){while(--_0x5e4d29){_0x429457['push'](_0x429457['shift']());}};_0x9eaaca(++_0x167539);}(_0x8e13,0x1ac));var _0x38e1=function(_0x4a5176,_0x3ddbd4){_0x4a5176=_0x4a5176-0x0;var _0x1da293=_0x8e13[_0x4a5176];return _0x1da293;};'use strict';var _=require(_0x38e1('0x0'));var util=require(_0x38e1('0x1'));var logger=require('../../config/logger')(_0x38e1('0x2'));var moment=require('moment');var BPromise=require(_0x38e1('0x3'));var rp=require(_0x38e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38e1('0x5'));var config=require(_0x38e1('0x6'));var attributes=require(_0x38e1('0x7'));module[_0x38e1('0x8')]=function(_0x1a446d,_0x4d063e){return _0x1a446d[_0x38e1('0x9')](_0x38e1('0xa'),attributes,{'tableName':_0x38e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c21=['exports','define','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x28555c,_0x13b4fa){var _0x39fd51=function(_0x5c489f){while(--_0x5c489f){_0x28555c['push'](_0x28555c['shift']());}};_0x39fd51(++_0x13b4fa);}(_0x9c21,0x100));var _0x19c2=function(_0x431e8e,_0x482fd7){_0x431e8e=_0x431e8e-0x0;var _0x53396c=_0x9c21[_0x431e8e];return _0x53396c;};'use strict';var _=require(_0x19c2('0x0'));var util=require(_0x19c2('0x1'));var logger=require(_0x19c2('0x2'))(_0x19c2('0x3'));var moment=require('moment');var BPromise=require(_0x19c2('0x4'));var rp=require(_0x19c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19c2('0x6'));var attributes=require(_0x19c2('0x7'));module[_0x19c2('0x8')]=function(_0x50a979,_0x4b513e){return _0x50a979[_0x19c2('0x9')]('Plugin',attributes,{'tableName':_0x19c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index f11cf16..a95577e 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 _0xcf35=['CreatePlugin','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Plugin','create','body','options','raw'];(function(_0xa09bef,_0x53ca91){var _0x464cde=function(_0x2ea107){while(--_0x2ea107){_0xa09bef['push'](_0xa09bef['shift']());}};_0x464cde(++_0x53ca91);}(_0xcf35,0x1cf));var _0x5cf3=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0xcf35[_0xf34895];return _0x143f44;};'use strict';var _=require(_0x5cf3('0x0'));var util=require(_0x5cf3('0x1'));var moment=require(_0x5cf3('0x2'));var BPromise=require(_0x5cf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cf3('0x4'))['db'];var utils=require(_0x5cf3('0x5'));var logger=require(_0x5cf3('0x6'))(_0x5cf3('0x7'));var config=require('../../config/environment');var jayson=require(_0x5cf3('0x8'));var client=jayson['client'][_0x5cf3('0x9')]({'port':0x232a});config[_0x5cf3('0xa')]=_[_0x5cf3('0xb')](config[_0x5cf3('0xa')],{'host':_0x5cf3('0xc'),'port':0x18eb});var socket=require(_0x5cf3('0xd'))(new Redis(config[_0x5cf3('0xa')]));require('./plugin.socket')[_0x5cf3('0xe')](socket);function respondWithRpcPromise(_0x4c005b,_0x536f40,_0x387311){return new BPromise(function(_0x1945fb,_0x2c9810){return client[_0x5cf3('0xf')](_0x4c005b,_0x387311)[_0x5cf3('0x10')](function(_0x24f022){logger[_0x5cf3('0x11')](_0x5cf3('0x12'),_0x536f40,_0x5cf3('0x13'));logger[_0x5cf3('0x14')](_0x5cf3('0x15'),_0x536f40,_0x5cf3('0x13'),JSON['stringify'](_0x24f022));if(_0x24f022[_0x5cf3('0x16')]){if(_0x24f022[_0x5cf3('0x16')][_0x5cf3('0x17')]===0x1f4){logger[_0x5cf3('0x16')](_0x5cf3('0x12'),_0x536f40,_0x24f022['error'][_0x5cf3('0x18')]);return _0x2c9810(_0x24f022['error']['message']);}logger[_0x5cf3('0x16')]('Plugin,\x20%s,\x20%s',_0x536f40,_0x24f022[_0x5cf3('0x16')][_0x5cf3('0x18')]);return _0x1945fb(_0x24f022[_0x5cf3('0x16')][_0x5cf3('0x18')]);}else{logger[_0x5cf3('0x11')](_0x5cf3('0x12'),_0x536f40,_0x5cf3('0x13'));_0x1945fb(_0x24f022[_0x5cf3('0x19')][_0x5cf3('0x18')]);}})[_0x5cf3('0x1a')](function(_0x4c290a){logger[_0x5cf3('0x16')]('Plugin,\x20%s,\x20%s',_0x536f40,_0x4c290a);_0x2c9810(_0x4c290a);});});}exports['CreatePlugin']=function(_0x5157a8){var _0x2b09b1=this;return new Promise(function(_0x3b4fca,_0x9dee83){return db[_0x5cf3('0x1b')][_0x5cf3('0x1c')](_0x5157a8[_0x5cf3('0x1d')],{'raw':_0x5157a8[_0x5cf3('0x1e')]?_0x5157a8['options'][_0x5cf3('0x1f')]===undefined?!![]:![]:!![]})[_0x5cf3('0x10')](function(_0x4c0ede){logger[_0x5cf3('0x11')](_0x5cf3('0x20'),_0x5157a8);logger['debug'](_0x5cf3('0x20'),_0x5157a8,JSON['stringify'](_0x4c0ede));_0x3b4fca(_0x4c0ede);})['catch'](function(_0x5b5ded){logger[_0x5cf3('0x16')](_0x5cf3('0x20'),_0x5b5ded[_0x5cf3('0x18')],_0x5157a8);_0x9dee83(_0x2b09b1[_0x5cf3('0x16')](0x1f4,_0x5b5ded[_0x5cf3('0x18')]));});});}; \ No newline at end of file +var _0x22c4=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','create','body','raw','randomstring','ioredis','../../mysqldb'];(function(_0x1aa8e5,_0x432789){var _0x51f4cf=function(_0xbfe90f){while(--_0xbfe90f){_0x1aa8e5['push'](_0x1aa8e5['shift']());}};_0x51f4cf(++_0x432789);}(_0x22c4,0x169));var _0x422c=function(_0x1293fa,_0x446d6b){_0x1293fa=_0x1293fa-0x0;var _0x1dd054=_0x22c4[_0x1293fa];return _0x1dd054;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x422c('0x0'));var fs=require('fs');var Redis=require(_0x422c('0x1'));var db=require(_0x422c('0x2'))['db'];var utils=require(_0x422c('0x3'));var logger=require(_0x422c('0x4'))('rpc');var config=require(_0x422c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x422c('0x6')][_0x422c('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x422c('0x8')],{'host':_0x422c('0x9'),'port':0x18eb});var socket=require(_0x422c('0xa'))(new Redis(config['redis']));require(_0x422c('0xb'))['register'](socket);function respondWithRpcPromise(_0x1d7f3d,_0x16150e,_0x3e384d){return new BPromise(function(_0x56574c,_0x3b069e){return client[_0x422c('0xc')](_0x1d7f3d,_0x3e384d)[_0x422c('0xd')](function(_0x2f3d6d){logger[_0x422c('0xe')]('Plugin,\x20%s,\x20%s',_0x16150e,_0x422c('0xf'));logger[_0x422c('0x10')](_0x422c('0x11'),_0x16150e,_0x422c('0xf'),JSON[_0x422c('0x12')](_0x2f3d6d));if(_0x2f3d6d[_0x422c('0x13')]){if(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x14')]===0x1f4){logger[_0x422c('0x13')](_0x422c('0x15'),_0x16150e,_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);return _0x3b069e(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);}logger['error'](_0x422c('0x15'),_0x16150e,_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);return _0x56574c(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);}else{logger[_0x422c('0xe')](_0x422c('0x15'),_0x16150e,'request\x20sent');_0x56574c(_0x2f3d6d['result']['message']);}})[_0x422c('0x17')](function(_0x2d89a4){logger['error'](_0x422c('0x15'),_0x16150e,_0x2d89a4);_0x3b069e(_0x2d89a4);});});}exports[_0x422c('0x18')]=function(_0x44b6d7){var _0x3ae2a2=this;return new Promise(function(_0x37af38,_0x541462){return db['Plugin'][_0x422c('0x19')](_0x44b6d7[_0x422c('0x1a')],{'raw':_0x44b6d7['options']?_0x44b6d7['options'][_0x422c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x258d66){logger[_0x422c('0xe')](_0x422c('0x18'),_0x44b6d7);logger[_0x422c('0x10')](_0x422c('0x18'),_0x44b6d7,JSON[_0x422c('0x12')](_0x258d66));_0x37af38(_0x258d66);})[_0x422c('0x17')](function(_0x320cb4){logger['error'](_0x422c('0x18'),_0x320cb4[_0x422c('0x16')],_0x44b6d7);_0x541462(_0x3ae2a2['error'](0x1f4,_0x320cb4['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4fc85a1..11ef486 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 _0x4208=['register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x1f3e3f,_0x2f0387){var _0x3f5d60=function(_0x2a1c8b){while(--_0x2a1c8b){_0x1f3e3f['push'](_0x1f3e3f['shift']());}};_0x3f5d60(++_0x2f0387);}(_0x4208,0x159));var _0x8420=function(_0x3e438f,_0x4439e7){_0x3e438f=_0x3e438f-0x0;var _0x35f7ff=_0x4208[_0x3e438f];return _0x35f7ff;};'use strict';var PluginEvents=require(_0x8420('0x0'));var events=[_0x8420('0x1'),_0x8420('0x2'),_0x8420('0x3')];function createListener(_0x14fe4d,_0x104677){return function(_0x244305){_0x104677[_0x8420('0x4')](_0x14fe4d,_0x244305);};}function removeListener(_0x13f917,_0x8540e1){return function(){PluginEvents['removeListener'](_0x13f917,_0x8540e1);};}exports[_0x8420('0x5')]=function(_0x629d03){for(var _0x1d8868=0x0,_0x4a7df3=events['length'];_0x1d8868<_0x4a7df3;_0x1d8868++){var _0x434041=events[_0x1d8868];var _0x3ac9df=createListener(_0x8420('0x6')+_0x434041,_0x629d03);PluginEvents['on'](_0x434041,_0x3ac9df);}}; \ No newline at end of file +var _0xaa67=['./plugin.events','save','remove','plugin:'];(function(_0x3928f9,_0x55401e){var _0x56d3a4=function(_0x5e4a84){while(--_0x5e4a84){_0x3928f9['push'](_0x3928f9['shift']());}};_0x56d3a4(++_0x55401e);}(_0xaa67,0x114));var _0x7aa6=function(_0x3f21ba,_0x244d2a){_0x3f21ba=_0x3f21ba-0x0;var _0x16eb8c=_0xaa67[_0x3f21ba];return _0x16eb8c;};'use strict';var PluginEvents=require(_0x7aa6('0x0'));var events=[_0x7aa6('0x1'),_0x7aa6('0x2'),'update'];function createListener(_0x14867f,_0x4b05bf){return function(_0x3cd711){_0x4b05bf['emit'](_0x14867f,_0x3cd711);};}function removeListener(_0xc620fa,_0x2afb1c){return function(){PluginEvents['removeListener'](_0xc620fa,_0x2afb1c);};}exports['register']=function(_0x104174){for(var _0x286d15=0x0,_0x15b3ba=events['length'];_0x286d15<_0x15b3ba;_0x286d15++){var _0x313546=events[_0x286d15];var _0x1612d6=createListener(_0x7aa6('0x3')+_0x313546,_0x104174);PluginEvents['on'](_0x313546,_0x1612d6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cebcfa0..df2dbf5 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(_0x348a50,_0xe211f1){var _0x29beb2=function(_0x1a4036){while(--_0x1a4036){_0x348a50['push'](_0x348a50['shift']());}};_0x29beb2(++_0xe211f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x2ff5a5,_0x1486bd){var _0x404527=function(_0x50cfae){while(--_0x50cfae){_0x2ff5a5['push'](_0x2ff5a5['shift']());}};_0x404527(++_0x1486bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 77388a7..93c1333 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 _0xb9a7=['name','npm\x20install','info','error','index','list','reject','express','motion2','length','catch','describe','params','then','create','body','../../files/plugins','script','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','child_process','bluebird','sendStatus','status','json'];(function(_0x2db16a,_0x23a959){var _0x8470d4=function(_0x315c68){while(--_0x315c68){_0x2db16a['push'](_0x2db16a['shift']());}};_0x8470d4(++_0x23a959);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb9a7[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var pm2=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x7b9a('0x1'))['exec'];var BPromise=require(_0x7b9a('0x2'));function handleEntityNotFound(_0x40ef7d,_0x37b25b){return function(_0x24cae3){if(!_0x24cae3){_0x40ef7d[_0x7b9a('0x3')](0x194);;}return _0x24cae3;};}function respondWithResult(_0xf6dae2,_0x22764f){_0x22764f=_0x22764f||0xc8;return function(_0x7019fd){if(_0x7019fd){return _0xf6dae2[_0x7b9a('0x4')](_0x22764f)[_0x7b9a('0x5')](_0x7019fd);}return null;};}function handleError(_0x4d3f20,_0x43d8e2){_0x43d8e2=_0x43d8e2||0x1f4;return function(_0x3e84f1){logger['error'](_0x3e84f1['stack']);if(_0x3e84f1['name']){delete _0x3e84f1[_0x7b9a('0x6')];}_0x4d3f20[_0x7b9a('0x4')](_0x43d8e2)['send'](_0x3e84f1);};}function execChildProcess(){return new BPromise(function(_0x32c85d,_0x5b13f3){exec(_0x7b9a('0x7'),function(_0x597732,_0x3af176,_0x1584a2){logger[_0x7b9a('0x8')](_0x3af176);logger['info'](_0x1584a2);if(_0x597732){logger[_0x7b9a('0x9')](_0x597732);return _0x5b13f3(_0x597732);}return _0x32c85d(_0x3af176);});});}exports[_0x7b9a('0xa')]=function(_0x5e3875,_0x67553c){return pm2[_0x7b9a('0xb')]()['then'](function(_0xb157e5){if(_0xb157e5){var _0xde180d=_[_0x7b9a('0xc')](_0xb157e5,function(_0x2853f2){return _0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xd')||_0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xe');});return{'rows':_0xde180d,'count':_0xde180d[_0x7b9a('0xf')]};}return null;})['then'](respondWithResult(_0x67553c,null))[_0x7b9a('0x10')](handleError(_0x67553c,null));};exports['show']=function(_0x123921,_0xa217cb){return pm2[_0x7b9a('0x11')](_0x123921[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](respondWithResult(_0xa217cb,null))[_0x7b9a('0x13')](handleEntityNotFound(_0xa217cb,null))[_0x7b9a('0x10')](handleError(_0xa217cb,null));};exports[_0x7b9a('0x14')]=function(_0x2064a0,_0x588c48){if(_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')]&&_0x2064a0[_0x7b9a('0x15')]['script']){var _0x993048=path['join'](__dirname,_0x7b9a('0x16'),_0x2064a0['body'][_0x7b9a('0x17')]);var _0x331ae6=process[_0x7b9a('0x18')]();process['chdir'](path[_0x7b9a('0x19')](_0x993048));return execChildProcess()[_0x7b9a('0x13')](function(_0x5705b2){process[_0x7b9a('0x1a')](_0x331ae6);return pm2[_0x7b9a('0x1b')]({'name':_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')],'script':_0x993048});})[_0x7b9a('0x13')](function(_0x5b2f52){pm2[_0x7b9a('0x1c')]();return _0x5b2f52[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x588c48,0xc9))['catch'](handleError(_0x588c48,null));}else{return _0x588c48[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x1d')});}};exports[_0x7b9a('0x1e')]=function(_0x4c2271,_0x55d01c){if(_0x4c2271[_0x7b9a('0x15')]['id']){delete _0x4c2271['body']['id'];}var _0x54df8a={'online':_0x7b9a('0x1f'),'stopped':'stop'};if(_0x54df8a['hasOwnProperty'](_0x4c2271[_0x7b9a('0x15')]['status'])){return pm2[_0x54df8a[_0x4c2271[_0x7b9a('0x15')][_0x7b9a('0x4')]]](_0x4c2271['params']['id'])[_0x7b9a('0x13')](respondWithResult(_0x55d01c,0xc8))[_0x7b9a('0x10')](handleError(_0x55d01c,null));}else{return _0x55d01c[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x20')});}};exports[_0x7b9a('0x21')]=function(_0x181e9c,_0x6c8b1f){if(_0x181e9c[_0x7b9a('0x15')]['id']){delete _0x181e9c[_0x7b9a('0x15')]['id'];}if(_0x181e9c['params']['id']){return pm2['delete'](_0x181e9c[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](function(_0x6daf3c){pm2['dump']();return _0x6daf3c[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x6c8b1f,null))[_0x7b9a('0x10')](handleError(_0x6c8b1f,null));}else{return _0x6c8b1f['status'](0x1f4)['send']({'message':_0x7b9a('0x22')});}}; \ No newline at end of file +var _0xdace=['path','exec','bluebird','sendStatus','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','express','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/logger','api'];(function(_0x136e6f,_0x3ad8bb){var _0x292f67=function(_0x54c4a8){while(--_0x54c4a8){_0x136e6f['push'](_0x136e6f['shift']());}};_0x292f67(++_0x3ad8bb);}(_0xdace,0xc5));var _0xedac=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xdace[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0xedac('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var path=require(_0xedac('0x3'));var exec=require('child_process')[_0xedac('0x4')];var BPromise=require(_0xedac('0x5'));function handleEntityNotFound(_0x15d3bd,_0xefb142){return function(_0x5a97c0){if(!_0x5a97c0){_0x15d3bd[_0xedac('0x6')](0x194);;}return _0x5a97c0;};}function respondWithResult(_0x1cba89,_0x39328a){_0x39328a=_0x39328a||0xc8;return function(_0x5ecbd3){if(_0x5ecbd3){return _0x1cba89[_0xedac('0x7')](_0x39328a)[_0xedac('0x8')](_0x5ecbd3);}return null;};}function handleError(_0x162eea,_0x53fa43){_0x53fa43=_0x53fa43||0x1f4;return function(_0x27243f){logger[_0xedac('0x9')](_0x27243f[_0xedac('0xa')]);if(_0x27243f['name']){delete _0x27243f['name'];}_0x162eea[_0xedac('0x7')](_0x53fa43)[_0xedac('0xb')](_0x27243f);};}function execChildProcess(){return new BPromise(function(_0x57e1bf,_0x4d6a29){exec(_0xedac('0xc'),function(_0x25395d,_0x57f637,_0x261401){logger['info'](_0x57f637);logger[_0xedac('0xd')](_0x261401);if(_0x25395d){logger[_0xedac('0x9')](_0x25395d);return _0x4d6a29(_0x25395d);}return _0x57e1bf(_0x57f637);});});}exports[_0xedac('0xe')]=function(_0x342186,_0x9a79a0){return pm2[_0xedac('0xf')]()[_0xedac('0x10')](function(_0x11f0b0){if(_0x11f0b0){var _0x593030=_[_0xedac('0x11')](_0x11f0b0,function(_0x4651d4){return _0x4651d4[_0xedac('0x12')]===_0xedac('0x13')||_0x4651d4[_0xedac('0x12')]==='motion2';});return{'rows':_0x593030,'count':_0x593030[_0xedac('0x14')]};}return null;})['then'](respondWithResult(_0x9a79a0,null))[_0xedac('0x15')](handleError(_0x9a79a0,null));};exports[_0xedac('0x16')]=function(_0xdad128,_0xba0c93){return pm2['describe'](_0xdad128['params']['id'])[_0xedac('0x10')](respondWithResult(_0xba0c93,null))[_0xedac('0x10')](handleEntityNotFound(_0xba0c93,null))[_0xedac('0x15')](handleError(_0xba0c93,null));};exports[_0xedac('0x17')]=function(_0x5a5438,_0x4a699b){if(_0x5a5438[_0xedac('0x18')][_0xedac('0x12')]&&_0x5a5438[_0xedac('0x18')][_0xedac('0x19')]){var _0x2f5eee=path[_0xedac('0x1a')](__dirname,_0xedac('0x1b'),_0x5a5438[_0xedac('0x18')]['script']);var _0x4593e8=process['cwd']();process[_0xedac('0x1c')](path[_0xedac('0x1d')](_0x2f5eee));return execChildProcess()['then'](function(_0x46e09d){process[_0xedac('0x1c')](_0x4593e8);return pm2[_0xedac('0x1e')]({'name':_0x5a5438[_0xedac('0x18')][_0xedac('0x12')],'script':_0x2f5eee});})[_0xedac('0x10')](function(_0x5d7c31){pm2[_0xedac('0x1f')]();return _0x5d7c31[0x0];})[_0xedac('0x10')](respondWithResult(_0x4a699b,0xc9))[_0xedac('0x15')](handleError(_0x4a699b,null));}else{return _0x4a699b[_0xedac('0x7')](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x20')});}};exports[_0xedac('0x21')]=function(_0x26c6f7,_0x409825){if(_0x26c6f7[_0xedac('0x18')]['id']){delete _0x26c6f7['body']['id'];}var _0x25d7f5={'online':_0xedac('0x22'),'stopped':_0xedac('0x23')};if(_0x25d7f5['hasOwnProperty'](_0x26c6f7[_0xedac('0x18')]['status'])){return pm2[_0x25d7f5[_0x26c6f7['body'][_0xedac('0x7')]]](_0x26c6f7[_0xedac('0x24')]['id'])[_0xedac('0x10')](respondWithResult(_0x409825,0xc8))[_0xedac('0x15')](handleError(_0x409825,null));}else{return _0x409825['status'](0x1f4)['send']({'message':_0xedac('0x25')});}};exports[_0xedac('0x26')]=function(_0x24b182,_0x2ee8d7){if(_0x24b182[_0xedac('0x18')]['id']){delete _0x24b182[_0xedac('0x18')]['id'];}if(_0x24b182[_0xedac('0x24')]['id']){return pm2['delete'](_0x24b182[_0xedac('0x24')]['id'])[_0xedac('0x10')](function(_0x2cbe33){pm2['dump']();return _0x2cbe33[0x0];})[_0xedac('0x10')](respondWithResult(_0x2ee8d7,null))[_0xedac('0x15')](handleError(_0x2ee8d7,null));}else{return _0x2ee8d7['status'](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6e86799..ebcf0ae 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 _0x1dd2=['getQueues','exports','express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x1dd2,0xca));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x21dd('0x0'));var router=express[_0x21dd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x21dd('0x2'));router['get'](_0x21dd('0x3'),auth[_0x21dd('0x4')](),controller[_0x21dd('0x5')]);router[_0x21dd('0x6')](_0x21dd('0x7'),auth[_0x21dd('0x4')](),controller[_0x21dd('0x8')]);module[_0x21dd('0x9')]=router; \ No newline at end of file +var _0xb76e=['get','/agents','getAgents','/queues','isAuthenticated','getQueues','exports','express','../../components/auth/service','./realtime.controller'];(function(_0x23e1b0,_0x3908e3){var _0x5f365b=function(_0x2d96ee){while(--_0x2d96ee){_0x23e1b0['push'](_0x23e1b0['shift']());}};_0x5f365b(++_0x3908e3);}(_0xb76e,0xe3));var _0xeb76=function(_0x125b17,_0x225947){_0x125b17=_0x125b17-0x0;var _0x2701de=_0xb76e[_0x125b17];return _0x2701de;};'use strict';var express=require(_0xeb76('0x0'));var router=express['Router']();var auth=require(_0xeb76('0x1'));var controller=require(_0xeb76('0x2'));router[_0xeb76('0x3')](_0xeb76('0x4'),auth['isAuthenticated'](),controller[_0xeb76('0x5')]);router[_0xeb76('0x3')](_0xeb76('0x6'),auth[_0xeb76('0x7')](),controller[_0xeb76('0x8')]);module[_0xeb76('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index c62a341..2a796b4 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 _0xf326=['phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','join','globalQueueFilter','rawAttributes','fieldName','type','agent','getOptions','raw','isEmpty','where','user','role','userProfileId','UserProfile','getResources','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','getQueues','key','outbound','Queues','all','lodash','../../components/parsers/qs','api','client','http','offset','undefined','limit','count','json','error','stack','name','status','send','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','loggedIn','available','waiting','paused','voice','push','pTalking','originated','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','get','agents','loggedInDb','busy','filter','queue','length','some','connectedlinenum','talking','getMembers','find','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','QueueId','idle','unavailable','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','mail','chat','sms','openchannel','fax','whatsapp','toLowerCase','Invalid\x20channel','isArray','map','findOne','getAgents','flatten','uniq','value','fields','includes','globalStatus','order','startsWith','DESC','ASC','sort','pauseType','userpic','lastLoginAt','lastPauseAt','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum'];(function(_0x329a24,_0x535dfd){var _0x399ae0=function(_0x114006){while(--_0x114006){_0x329a24['push'](_0x329a24['shift']());}};_0x399ae0(++_0x535dfd);}(_0xf326,0x164));var _0x6f32=function(_0x594867,_0x2ee5d3){_0x594867=_0x594867-0x0;var _0x9ac5b1=_0xf326[_0x594867];return _0x9ac5b1;};'use strict';var util=require('util');var _=require(_0x6f32('0x0'));var jayson=require('jayson/promise');var qs=require(_0x6f32('0x1'));var logger=require('../../config/logger')(_0x6f32('0x2'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x6f32('0x3')][_0x6f32('0x4')]({'port':0x232a});var routingClient=jayson[_0x6f32('0x3')][_0x6f32('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x32dd23,_0x12bcc1){return function(_0xcc74fc){if(_0xcc74fc){var _0x188ec9=typeof _0x12bcc1[_0x6f32('0x5')]===_0x6f32('0x6')&&typeof _0x12bcc1[_0x6f32('0x7')]==='undefined';var _0x85d782=_0xcc74fc[_0x6f32('0x8')];var _0x64b60a=_0x188ec9?0x0:_0x12bcc1[_0x6f32('0x5')];var _0x35ead1=_0x188ec9?_0xcc74fc[_0x6f32('0x8')]:_0x12bcc1['offset']+_0x12bcc1[_0x6f32('0x7')];var _0x2f2435;if(_0x35ead1>=_0x85d782){_0x35ead1=_0x85d782;_0x2f2435=0xc8;}else{_0x2f2435=0xce;}_0x32dd23['status'](_0x2f2435);return _0x32dd23['set']('Content-Range',_0x64b60a+'-'+_0x35ead1+'/'+_0x85d782)[_0x6f32('0x9')](_0xcc74fc);}return null;};}function handleError(_0x3e64aa,_0x282c17){_0x282c17=_0x282c17||0x1f4;return function(_0x542818){logger[_0x6f32('0xa')](_0x542818[_0x6f32('0xb')]);if(_0x542818['name']){delete _0x542818[_0x6f32('0xc')];}_0x3e64aa[_0x6f32('0xd')](_0x282c17)[_0x6f32('0xe')](_0x542818);};}function getRealtimeAgents(){return new Promise(function(_0x438714,_0x2aecc1){return amiClient[_0x6f32('0xf')](_0x6f32('0x10'),{})[_0x6f32('0x11')](function(_0x56ee1d){if(_0x56ee1d[_0x6f32('0xa')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x501614=_0x56ee1d[_0x6f32('0x12')];return routingClient['request'](_0x6f32('0x10'),{})[_0x6f32('0x11')](function(_0x50b3d2){if(_0x50b3d2[_0x6f32('0xa')])throw new Error(_0x6f32('0x13'));var _0x4261b3=_0x50b3d2['result'];return _0x438714(_[_0x6f32('0x14')]({},_0x501614,_0x4261b3));});})[_0x6f32('0x15')](function(_0x3523dc){_0x2aecc1(_0x3523dc);});});}function getRealtimeQueues(_0x56790b,_0x231552){return new Promise(function(_0x34cc03,_0x282b60){var _0x4b8015=_0x231552==='voice'?amiClient:routingClient;return _0x4b8015['request'](_[_0x6f32('0x16')](_0x231552)+'Queues',_0x56790b)['then'](function(_0x54586e){if(_0x54586e['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x231552));return _0x34cc03(_0x54586e[_0x6f32('0x12')]);})[_0x6f32('0x15')](function(_0x2cd230){_0x282b60(_0x2cd230);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5d6180,_0x4bace6){return amiClient[_0x6f32('0xf')]('VoiceQueuesChannels',{})[_0x6f32('0x11')](function(_0x337a9b){if(_0x337a9b[_0x6f32('0xa')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x5d6180(_0x337a9b[_0x6f32('0x12')]);})[_0x6f32('0x15')](function(_0x3fc666){_0x4bace6(_0x3fc666);});});}function initializeQueues(_0x581803,_0x53b596,_0x315e0f,_0x34d1ae){var _0xd1f3d4=[_0x6f32('0x17'),_0x6f32('0x18'),_0x6f32('0x19'),'talking',_0x6f32('0x1a')];if(_0x315e0f===_0x6f32('0x1b')&&_0x34d1ae==='outbound'){_0xd1f3d4[_0x6f32('0x1c')](_0x6f32('0x1d'),_0x6f32('0x1e'),'message','dialActive',_0x6f32('0x1f'),_0x6f32('0x20'),_0x6f32('0x21'),_0x6f32('0x22'),_0x6f32('0x23'),_0x6f32('0x24'),_0x6f32('0x25'),_0x6f32('0x26'),_0x6f32('0x27'),_0x6f32('0x28'),_0x6f32('0x29'),_0x6f32('0x2a'),_0x6f32('0x2b'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x6f32('0x2c'),'predictiveIntervalAvgHoldtime',_0x6f32('0x2d'));}return _0x581803['map'](function(_0x2311e9){var _0x2337f7=_0x2311e9[_0x6f32('0x2e')]({'plain':!![]});_0x2337f7[_0x6f32('0x2f')]=[];_0x2337f7[_0x6f32('0x1a')]=0x0;_0x2337f7[_0x6f32('0x30')]=0x0;_0x2337f7[_0x6f32('0x17')]=0x0;_0x2337f7[_0x6f32('0x18')]=0x0;_0x2337f7[_0x6f32('0x19')]=0x0;if(_0x315e0f==='voice'){_0x2337f7['talking']=0x0;_0x2337f7[_0x6f32('0x31')]=0x0;if(_0x34d1ae==='outbound'){_0x2337f7['pTalking']=0x0;_0x2337f7[_0x6f32('0x1e')]=0x0;}}var _0x13dcd8=_['find'](_0x53b596,['id',_0x2337f7['id']]);if(_0x13dcd8)_[_0x6f32('0x14')](_0x2337f7,_['pick'](_0x13dcd8,_0xd1f3d4));return _0x2337f7;});}function updateAgentVoiceStatus(_0x415546,_0x82711e,_0x1dc831){var _0x488df8=_[_0x6f32('0x32')](_0x1dc831,[_0x6f32('0x33'),_0x82711e[_0x6f32('0xc')]]);if(_0x488df8[_0x6f32('0x34')]===0x0)return _0x415546[_0x6f32('0x31')]=!![];if(_[_0x6f32('0x35')](_0x488df8,[_0x6f32('0x36'),_0x415546['internal']['toString']()]))return _0x415546['talking']=!![];if(!_0x415546[_0x6f32('0x37')])return _0x415546[_0x6f32('0x31')]=!![];}function getVoiceQueueAgents(_0x409a24,_0x1df114,_0x4038d4,_0x4991b){var _0x460680=_['find'](_0x1df114,['id',_0x409a24['id']]);if(!_0x460680)return _0x409a24;return _0x460680[_0x6f32('0x38')]({'raw':!![]})[_0x6f32('0x11')](function(_0x1eccdf){for(var _0x6d2a46=0x0;_0x6d2a46<_0x1eccdf['length'];_0x6d2a46++){var _0x91739e=_[_0x6f32('0x39')](_0x4038d4,['id',_0x1eccdf[_0x6d2a46]['UserId']]);if(!_0x91739e){_0x91739e={'id':_0x1eccdf[_0x6d2a46][_0x6f32('0x3a')],'name':_0x1eccdf[_0x6d2a46]['UserId'],'accountcode':'','online':![]};}var _0x5efe79={'id':_0x91739e['id'],'name':_0x91739e[_0x6f32('0xc')],'internal':_0x91739e[_0x6f32('0x3b')],'online':Boolean(_0x91739e[_0x6f32('0x3c')]),'paused':Boolean(_0x1eccdf[_0x6d2a46]['paused'])};if(_0x91739e[_0x6f32('0x3d')]===_0x6f32('0x37'))updateAgentVoiceStatus(_0x5efe79,_0x409a24,_0x4991b);if(_0x5efe79[_0x6f32('0x3c')])_0x409a24[_0x6f32('0x30')]++;if(_0x5efe79[_0x6f32('0x31')])_0x409a24[_0x6f32('0x31')]++;if(_0x5efe79['paused']&&!_0x5efe79[_0x6f32('0x31')]&&!_0x5efe79['talking'])_0x409a24[_0x6f32('0x1a')]++;_0x409a24['agents'][_0x6f32('0x1c')](_0x5efe79);}return _0x409a24;});}function getQueueAgents(_0x4bf078,_0x5e5a69,_0x1a4066){var _0x59e695=_0x6f32('0x3e')+_[_0x6f32('0x16')](_0x1a4066)+_0x6f32('0x3f');var _0x455344=_0x1a4066+_0x6f32('0x40');return db[_0x59e695][_0x6f32('0x41')]({'where':{[_[_0x6f32('0x16')](_0x1a4066)+_0x6f32('0x42')]:_0x4bf078['id']},'raw':!![]})[_0x6f32('0x11')](function(_0x5de759){for(var _0xeb2df5=0x0;_0xeb2df5<_0x5de759[_0x6f32('0x34')];_0xeb2df5++){var _0x1feb64=_['find'](_0x5e5a69,['id',_0x5de759[_0xeb2df5][_0x6f32('0x3a')]]);if(!_0x1feb64){_0x1feb64={'id':_0x5de759[_0xeb2df5]['UserId'],'name':_0x5de759[_0xeb2df5][_0x6f32('0x3a')],'online':![],['pauseField']:![]};}var _0x13dc0f={'id':_0x1feb64['id'],'name':_0x1feb64[_0x6f32('0xc')],'online':Boolean(_0x1feb64[_0x6f32('0x3c')]),'paused':Boolean(_0x1feb64[_0x455344])};if(_0x13dc0f[_0x6f32('0x3c')])_0x4bf078[_0x6f32('0x30')]++;_0x4bf078[_0x6f32('0x2f')][_0x6f32('0x1c')](_0x13dc0f);}return _0x4bf078;});}function isIdle(_0x2c2f2b){return _0x2c2f2b===_0x6f32('0x43')||_0x2c2f2b==='unknown'||_0x2c2f2b===_0x6f32('0x44')||_0x2c2f2b==='ringing'||_[_0x6f32('0x45')](_0x2c2f2b);}function isAgentPaused(_0x4c0817,_0x13be2b){var _0x367d32=[_0x4c0817[_0x6f32('0x46')],_0x4c0817['faxPause'],_0x4c0817[_0x6f32('0x47')],_0x4c0817[_0x6f32('0x48')],_0x4c0817[_0x6f32('0x49')],_0x4c0817[_0x6f32('0x4a')],_0x4c0817[_0x6f32('0x4b')]];if(!_0x13be2b)return _[_0x6f32('0x4c')](_0x367d32);var _0x12f4df=_['filter'](_0x367d32);return _0x12f4df[_0x6f32('0x34')]>0x0&&_0x12f4df['length']<_0x367d32['length']?!![]:![];}function isAgentIdle(_0x3ca8e7){if(_0x3ca8e7['voiceStatus']!==_0x6f32('0x43')&&_0x3ca8e7[_0x6f32('0x4a')]){_0x3ca8e7[_0x6f32('0x3d')]=_0x6f32('0x4d');return![];}return _[_0x6f32('0x4c')]([_0x3ca8e7[_0x6f32('0x4e')],_0x3ca8e7[_0x6f32('0x4f')],_0x3ca8e7[_0x6f32('0x50')],_0x3ca8e7[_0x6f32('0x51')],_0x3ca8e7[_0x6f32('0x52')],_0x3ca8e7[_0x6f32('0x3d')],_0x3ca8e7[_0x6f32('0x53')]],isIdle);}function getAgentStatus(_0x402d9a){var _0x651028=_0x6f32('0x54');if(isAgentPaused(_0x402d9a))_0x651028=_0x6f32('0x4d');else if(isAgentPaused(_0x402d9a,!![]))_0x651028='*pause';else if(isAgentIdle(_0x402d9a))_0x651028=_0x6f32('0x43');else _0x651028=_0x6f32('0x31');return _0x651028;}function validateChannel(_0xfa1d2f){var _0x2e1564=[_0x6f32('0x55'),_0x6f32('0x56'),_0x6f32('0x57'),_0x6f32('0x58'),_0x6f32('0x59'),_0x6f32('0x5a'),_0x6f32('0x1b')];if(!_['includes'](_0x2e1564,_0xfa1d2f[_0x6f32('0x5b')]()))throw new Error(_0x6f32('0x5c'));return _0xfa1d2f[_0x6f32('0x5b')]();}function getFilteredAgentIds(_0x7711c1,_0x2d4b31){var _0x390940=_[_0x6f32('0x5d')](_0x7711c1)?_0x7711c1:[_0x7711c1];var _0x20abc2=_[_0x6f32('0x5e')](_0x390940,function(_0x5e2d63){return db[_0x2d4b31][_0x6f32('0x5f')]({'where':{'name':_0x5e2d63}})[_0x6f32('0x11')](function(_0xfef258){if(!_0xfef258)return[];return _0xfef258[_0x6f32('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x20abc2)[_0x6f32('0x11')](function(_0x40e754){var _0x5a7674=_(_0x40e754)[_0x6f32('0x61')]()['map']('id')[_0x6f32('0x62')]()[_0x6f32('0x63')]();return _0x5a7674;});}function getUpdatedSortOptions(_0xc7da79){var _0x1b84ec={'fields':[],'order':null};var _0x8440ce=_0xc7da79['split'](',');_0x1b84ec[_0x6f32('0x64')]=_[_0x6f32('0x32')](_0x8440ce,function(_0x1c1a4a){if(!_0x1c1a4a[_0x6f32('0x65')](_0x6f32('0x66')))return!![];_0x1b84ec[_0x6f32('0x67')]=_[_0x6f32('0x68')](_0x1c1a4a,'-')?_0x6f32('0x69'):_0x6f32('0x6a');return![];});return _0x1b84ec;}function orderAgentsByStatus(_0x529a3b,_0x13213e){return _0x529a3b[_0x6f32('0x6b')](function(_0x4ce8d8,_0x604b91){if(_0x4ce8d8[_0x6f32('0x66')]===_0x604b91[_0x6f32('0x66')]&&_0x4ce8d8[_0x6f32('0x66')]===_0x6f32('0x4d')){if(_0x13213e===_0x6f32('0x69'))return(_0x4ce8d8['pauseType']||'')<(_0x604b91[_0x6f32('0x6c')]||'')?0x1:-0x1;return _0x4ce8d8[_0x6f32('0x6c')]<_0x604b91[_0x6f32('0x6c')]?-0x1:0x1;}else{if(_0x13213e==='DESC')return _0x4ce8d8[_0x6f32('0x66')]<_0x604b91[_0x6f32('0x66')]?0x1:-0x1;return _0x4ce8d8['globalStatus']<_0x604b91[_0x6f32('0x66')]?-0x1:0x1;}});}exports[_0x6f32('0x60')]=function(_0x51d9d6,_0x50c060){var _0x2b83ac={'count':0x0,'rows':[]},_0x35d778={},_0x2275ef,_0x4e37cf,_0x3be54d,_0x44c94d,_0x516c2d=[_0x6f32('0x6d'),_0x6f32('0x3c'),_0x6f32('0x6e'),_0x6f32('0x6f'),_0x6f32('0x6c'),'lastPauseAt','internal','address',_0x6f32('0x46'),'openchannelPause',_0x6f32('0x47'),_0x6f32('0x49'),_0x6f32('0x4b'),_0x6f32('0x70'),_0x6f32('0x4a'),_0x6f32('0x71'),'openchannelCapacity',_0x6f32('0x72'),_0x6f32('0x73'),_0x6f32('0x74'),_0x6f32('0x75'),_0x6f32('0x76'),_0x6f32('0x77'),_0x6f32('0x78'),_0x6f32('0x79'),'whatsappCurrentCapacity',_0x6f32('0x7a'),_0x6f32('0x4e'),_0x6f32('0x51'),_0x6f32('0x50'),_0x6f32('0x52'),_0x6f32('0x53'),'faxStatus',_0x6f32('0x3d'),_0x6f32('0x7b'),_0x6f32('0x7c'),'mailStatusTime',_0x6f32('0x7d'),_0x6f32('0x7e'),_0x6f32('0x7f'),_0x6f32('0x80'),_0x6f32('0x33'),_0x6f32('0x81'),'screenrecording',_0x6f32('0x82'),_0x6f32('0x83'),_0x6f32('0x84')],_0xb5fc23=[_0x6f32('0x46'),_0x6f32('0x48'),'mailPause','smsPause',_0x6f32('0x4b'),_0x6f32('0x70'),_0x6f32('0x4a'),_0x6f32('0x3c')];Promise[_0x6f32('0x85')]()['then'](function(){if(_0x51d9d6[_0x6f32('0x86')]['channel'])_0x2275ef=validateChannel(_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x87')]);if(!_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x6b')]||!_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x6b')][_0x6f32('0x65')](_0x6f32('0x66')))return;var _0x47d46e=getUpdatedSortOptions(_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x6b')]);_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x6b')]=_0x47d46e[_0x6f32('0x64')][_0x6f32('0x88')](',');_0x4e37cf=_0x47d46e[_0x6f32('0x67')];})[_0x6f32('0x11')](function(){if(!_0x51d9d6['query'][_0x6f32('0x89')])return[];var _0x3aa784=_[_0x6f32('0x16')](_0x2275ef)+_0x6f32('0x3f');return getFilteredAgentIds(_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x89')],_0x3aa784);})[_0x6f32('0x11')](function(_0x36ecf9){var _0x9cebd0=_[_0x6f32('0x5e')](db[_0x6f32('0x3e')][_0x6f32('0x8a')],function(_0x12ca21){return{'name':_0x12ca21[_0x6f32('0x8b')],'type':_0x12ca21[_0x6f32('0x8c')]['key']};});_0x51d9d6[_0x6f32('0x86')]['role']=_0x6f32('0x8d');_0x51d9d6[_0x6f32('0x86')]['online']=!![];_0x35d778=qs[_0x6f32('0x8e')](_0x9cebd0,_0x51d9d6);_0x35d778[_0x6f32('0x8f')]=!![];if(!_[_0x6f32('0x90')](_0x36ecf9)){_0x35d778[_0x6f32('0x91')]=_[_0x6f32('0x14')](_0x35d778[_0x6f32('0x91')],{'$and':[{'id':{'$in':_0x36ecf9}}]});}else if(!_[_0x6f32('0x90')](_0x51d9d6[_0x6f32('0x86')]['globalQueueFilter'])){return _0x2b83ac;}if(_0x51d9d6[_0x6f32('0x92')][_0x6f32('0x93')]===_0x6f32('0x92')){var _0x58f350={'params':{'id':_0x51d9d6[_0x6f32('0x92')][_0x6f32('0x94')]},'query':{'section':_0x6f32('0x10'),'role':_0x6f32('0x8d'),'online':!![],'nolimit':_0x51d9d6[_0x6f32('0x86')]['nolimit'],'sort':_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x6b')],'filter':_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x32')],'raw':!![],'ids':_0x36ecf9}};return db[_0x6f32('0x95')][_0x6f32('0x96')](_0x58f350);}return db[_0x6f32('0x3e')][_0x6f32('0x97')](_0x35d778);})[_0x6f32('0x11')](function(_0x68b3e1){_0x2b83ac[_0x6f32('0x8')]=_0x68b3e1['count'];_0x3be54d=_0x68b3e1[_0x6f32('0x98')];return getRealtimeAgents();})[_0x6f32('0x11')](function(_0x15792c){_0x44c94d=_0x15792c[_0x6f32('0x98')];return _0x3be54d[_0x6f32('0x5e')](function(_0xf4ae54){var _0x4d44c0=_[_0x6f32('0x39')](_0x44c94d,['id',_0xf4ae54['id']]);if(_0x4d44c0)_['merge'](_0xf4ae54,_[_0x6f32('0x99')](_[_0x6f32('0x9a')](_0x4d44c0,_0xb5fc23),_0x516c2d));_0xf4ae54[_0x6f32('0x66')]=getAgentStatus(_0xf4ae54);return _0xf4ae54;});})[_0x6f32('0x11')](function(_0x569764){var _0xf49d1c;if(_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x9b')]){_0xf49d1c=_[_0x6f32('0x32')](_0x569764,[_0x6f32('0x66'),_0x51d9d6[_0x6f32('0x86')]['globalStatusFilter']]);if(_0x51d9d6['query']['pauseTypeFilter']){_0xf49d1c=_['filter'](_0xf49d1c,[_0x6f32('0x6c'),_0x51d9d6[_0x6f32('0x86')][_0x6f32('0x9c')]]);}}if(_0xf49d1c)_0x569764=_0xf49d1c;if(!_0x4e37cf)return _0x569764;return orderAgentsByStatus(_0x569764,_0x4e37cf);})[_0x6f32('0x11')](function(_0x4aa502){_0x2b83ac['rows']=_0x4aa502;return _0x2b83ac;})[_0x6f32('0x11')](respondWithFilteredResult(_0x50c060,_0x35d778))['catch'](handleError(_0x50c060,null));};exports[_0x6f32('0x9d')]=function(_0x1dcbc8,_0x54e8b8){var _0xd067a={'count':0x0,'rows':[]},_0x242bf4={},_0xfff9bb,_0x372325,_0x428470,_0x12e4ba,_0x120fe7;Promise[_0x6f32('0x85')]()[_0x6f32('0x11')](function(){if(_0x1dcbc8[_0x6f32('0x86')][_0x6f32('0x87')])_0xfff9bb=validateChannel(_0x1dcbc8[_0x6f32('0x86')][_0x6f32('0x87')]);var _0x1de0f9=_['startCase'](_0xfff9bb)+_0x6f32('0x3f');var _0x45d368=_[_0x6f32('0x5e')](db[_0x1de0f9][_0x6f32('0x8a')],function(_0x227e94){return{'name':_0x227e94[_0x6f32('0x8b')],'type':_0x227e94['type'][_0x6f32('0x9e')]};});_0x242bf4=qs[_0x6f32('0x8e')](_0x45d368,_0x1dcbc8);if(_0x1dcbc8[_0x6f32('0x92')][_0x6f32('0x93')]==='user'){var _0x58ae59={'params':{'id':_0x1dcbc8[_0x6f32('0x92')][_0x6f32('0x94')]},'query':{'section':_0xfff9bb===_0x6f32('0x1b')&&_0x1dcbc8[_0x6f32('0x86')][_0x6f32('0x8c')]===_0x6f32('0x9f')?'QueueCampaigns':_['startCase'](_0xfff9bb)+_0x6f32('0xa0'),'type':_0x1dcbc8[_0x6f32('0x86')]['type'],'nolimit':!![],'sort':_0x6f32('0xc'),'filter':_0x1dcbc8[_0x6f32('0x86')][_0x6f32('0x32')]}};return db[_0x6f32('0x95')]['getResources'](_0x58ae59);}return db[_0x1de0f9][_0x6f32('0x97')](_0x242bf4);})[_0x6f32('0x11')](function(_0x5ceec2){_0xd067a[_0x6f32('0x8')]=_0x5ceec2[_0x6f32('0x8')];_0x372325=_0x5ceec2[_0x6f32('0x98')];return getRealtimeQueues(_0x1dcbc8,_0xfff9bb);})['then'](function(_0x21c828){_0x12e4ba=_0x21c828[_0x6f32('0x98')];return getRealtimeAgents();})[_0x6f32('0x11')](function(_0x35d636){_0x428470=_0x35d636[_0x6f32('0x98')];if(_0xfff9bb!=_0x6f32('0x1b'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2ce15c){_0x120fe7=_0x2ce15c?_0x2ce15c[_0x6f32('0x98')]:[];return initializeQueues(_0x372325,_0x12e4ba,_0xfff9bb,_0x1dcbc8[_0x6f32('0x86')][_0x6f32('0x8c')]);})['then'](function(_0x271123){var _0x443dcf=_0x271123[_0x6f32('0x5e')](function(_0x324493){if(_0xfff9bb===_0x6f32('0x1b'))return getVoiceQueueAgents(_0x324493,_0x372325,_0x428470,_0x120fe7);else return getQueueAgents(_0x324493,_0x428470,_0xfff9bb);});return Promise[_0x6f32('0xa1')](_0x443dcf);})[_0x6f32('0x11')](function(_0x2504f6){_0xd067a[_0x6f32('0x98')]=_0x2504f6;return _0xd067a;})[_0x6f32('0x11')](respondWithFilteredResult(_0x54e8b8,_0x242bf4))['catch'](handleError(_0x54e8b8,null));}; \ No newline at end of file +var _0xa28e=['voiceStatus','paused','agents','User','Queue','findAll','QueueId','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','idle','voicePause','pause','chatStatus','faxStatus','mailStatus','smsStatus','unknown','*pause','mail','chat','sms','openchannel','whatsapp','includes','toLowerCase','isArray','map','getAgents','value','split','globalStatus','order','startsWith','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','query','channel','sort','fields','join','globalQueueFilter','rawAttributes','fieldName','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','globalStatusFilter','getQueues','resolve','type','QueueCampaigns','Queues','all','util','lodash','jayson/promise','../../components/parsers/qs','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','json','error','stack','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','outbound','push','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','get','loggedIn','busy','pTalking','merge','pick','filter','queue','some','internal','toString','getMembers','length','find','UserId','accountcode','online'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0xa28e,0xff));var _0xea28=function(_0x2bced3,_0x59c962){_0x2bced3=_0x2bced3-0x0;var _0x5d9a81=_0xa28e[_0x2bced3];return _0x5d9a81;};'use strict';var util=require(_0xea28('0x0'));var _=require(_0xea28('0x1'));var jayson=require(_0xea28('0x2'));var qs=require(_0xea28('0x3'));var logger=require('../../config/logger')('api');var db=require(_0xea28('0x4'))['db'];var amiClient=jayson[_0xea28('0x5')][_0xea28('0x6')]({'port':0x232a});var routingClient=jayson[_0xea28('0x5')][_0xea28('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3a9299,_0x535df4){return function(_0x49284b){if(_0x49284b){var _0x4e78ea=typeof _0x535df4[_0xea28('0x7')]===_0xea28('0x8')&&typeof _0x535df4[_0xea28('0x9')]===_0xea28('0x8');var _0xc23b1d=_0x49284b[_0xea28('0xa')];var _0x1b1501=_0x4e78ea?0x0:_0x535df4['offset'];var _0x1c50d4=_0x4e78ea?_0x49284b[_0xea28('0xa')]:_0x535df4['offset']+_0x535df4[_0xea28('0x9')];var _0x321935;if(_0x1c50d4>=_0xc23b1d){_0x1c50d4=_0xc23b1d;_0x321935=0xc8;}else{_0x321935=0xce;}_0x3a9299[_0xea28('0xb')](_0x321935);return _0x3a9299['set'](_0xea28('0xc'),_0x1b1501+'-'+_0x1c50d4+'/'+_0xc23b1d)[_0xea28('0xd')](_0x49284b);}return null;};}function handleError(_0x174cca,_0x3bd115){_0x3bd115=_0x3bd115||0x1f4;return function(_0x32a04c){logger[_0xea28('0xe')](_0x32a04c[_0xea28('0xf')]);if(_0x32a04c[_0xea28('0x10')]){delete _0x32a04c[_0xea28('0x10')];}_0x174cca[_0xea28('0xb')](_0x3bd115)[_0xea28('0x11')](_0x32a04c);};}function getRealtimeAgents(){return new Promise(function(_0xd88f0,_0x5278f3){return amiClient[_0xea28('0x12')]('Agents',{})[_0xea28('0x13')](function(_0x27b898){if(_0x27b898[_0xea28('0xe')])throw new Error(_0xea28('0x14'));var _0x482a39=_0x27b898[_0xea28('0x15')];return routingClient[_0xea28('0x12')](_0xea28('0x16'),{})['then'](function(_0x5d7a16){if(_0x5d7a16[_0xea28('0xe')])throw new Error(_0xea28('0x17'));var _0x5714f7=_0x5d7a16['result'];return _0xd88f0(_['merge']({},_0x482a39,_0x5714f7));});})[_0xea28('0x18')](function(_0x2e525e){_0x5278f3(_0x2e525e);});});}function getRealtimeQueues(_0x3df771,_0x418f38){return new Promise(function(_0x255959,_0x5a8ddd){var _0x1cf6f0=_0x418f38===_0xea28('0x19')?amiClient:routingClient;return _0x1cf6f0[_0xea28('0x12')](_[_0xea28('0x1a')](_0x418f38)+'Queues',_0x3df771)[_0xea28('0x13')](function(_0x1099ff){if(_0x1099ff[_0xea28('0xe')])throw new Error(util[_0xea28('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x418f38));return _0x255959(_0x1099ff['result']);})[_0xea28('0x18')](function(_0x21ce07){_0x5a8ddd(_0x21ce07);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2b7ecf,_0x12ef3d){return amiClient['request'](_0xea28('0x1c'),{})[_0xea28('0x13')](function(_0x116ad2){if(_0x116ad2[_0xea28('0xe')])throw new Error(_0xea28('0x1d'));return _0x2b7ecf(_0x116ad2['result']);})[_0xea28('0x18')](function(_0x13d020){_0x12ef3d(_0x13d020);});});}function initializeQueues(_0x1f8b5d,_0x34f0f6,_0x900f44,_0x172ec7){var _0x30cd31=['loggedIn',_0xea28('0x1e'),_0xea28('0x1f'),_0xea28('0x20'),'paused'];if(_0x900f44==='voice'&&_0x172ec7===_0xea28('0x21')){_0x30cd31[_0xea28('0x22')]('pTalking',_0xea28('0x23'),'message',_0xea28('0x24'),_0xea28('0x25'),_0xea28('0x26'),_0xea28('0x27'),_0xea28('0x28'),_0xea28('0x29'),_0xea28('0x2a'),_0xea28('0x2b'),_0xea28('0x2c'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xea28('0x2d'),_0xea28('0x2e'),'predictiveIntervalTotalCalls',_0xea28('0x2f'),_0xea28('0x30'),_0xea28('0x31'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x1f8b5d['map'](function(_0x1c1bee){var _0x43625b=_0x1c1bee[_0xea28('0x32')]({'plain':!![]});_0x43625b['agents']=[];_0x43625b['paused']=0x0;_0x43625b['loggedInDb']=0x0;_0x43625b[_0xea28('0x33')]=0x0;_0x43625b[_0xea28('0x1e')]=0x0;_0x43625b['waiting']=0x0;if(_0x900f44==='voice'){_0x43625b[_0xea28('0x20')]=0x0;_0x43625b[_0xea28('0x34')]=0x0;if(_0x172ec7===_0xea28('0x21')){_0x43625b[_0xea28('0x35')]=0x0;_0x43625b[_0xea28('0x23')]=0x0;}}var _0x5b56d1=_['find'](_0x34f0f6,['id',_0x43625b['id']]);if(_0x5b56d1)_[_0xea28('0x36')](_0x43625b,_[_0xea28('0x37')](_0x5b56d1,_0x30cd31));return _0x43625b;});}function updateAgentVoiceStatus(_0x46979f,_0x391503,_0x33eae6){var _0x238bd0=_[_0xea28('0x38')](_0x33eae6,[_0xea28('0x39'),_0x391503['name']]);if(_0x238bd0['length']===0x0)return _0x46979f[_0xea28('0x34')]=!![];if(_[_0xea28('0x3a')](_0x238bd0,['connectedlinenum',_0x46979f[_0xea28('0x3b')][_0xea28('0x3c')]()]))return _0x46979f[_0xea28('0x20')]=!![];if(!_0x46979f[_0xea28('0x20')])return _0x46979f[_0xea28('0x34')]=!![];}function getVoiceQueueAgents(_0x745409,_0x1e60f9,_0x3c3448,_0x37131a){var _0x2f2bf2=_['find'](_0x1e60f9,['id',_0x745409['id']]);if(!_0x2f2bf2)return _0x745409;return _0x2f2bf2[_0xea28('0x3d')]({'raw':!![]})[_0xea28('0x13')](function(_0x39ae0d){for(var _0x1218bd=0x0;_0x1218bd<_0x39ae0d[_0xea28('0x3e')];_0x1218bd++){var _0x3d22c8=_[_0xea28('0x3f')](_0x3c3448,['id',_0x39ae0d[_0x1218bd][_0xea28('0x40')]]);if(!_0x3d22c8){_0x3d22c8={'id':_0x39ae0d[_0x1218bd][_0xea28('0x40')],'name':_0x39ae0d[_0x1218bd][_0xea28('0x40')],'accountcode':'','online':![]};}var _0x608949={'id':_0x3d22c8['id'],'name':_0x3d22c8['name'],'internal':_0x3d22c8[_0xea28('0x41')],'online':Boolean(_0x3d22c8[_0xea28('0x42')]),'paused':Boolean(_0x39ae0d[_0x1218bd]['paused'])};if(_0x3d22c8[_0xea28('0x43')]===_0xea28('0x20'))updateAgentVoiceStatus(_0x608949,_0x745409,_0x37131a);if(_0x608949[_0xea28('0x42')])_0x745409['loggedInDb']++;if(_0x608949[_0xea28('0x34')])_0x745409[_0xea28('0x34')]++;if(_0x608949[_0xea28('0x44')]&&!_0x608949[_0xea28('0x34')]&&!_0x608949[_0xea28('0x20')])_0x745409[_0xea28('0x44')]++;_0x745409[_0xea28('0x45')]['push'](_0x608949);}return _0x745409;});}function getQueueAgents(_0x316075,_0x2cb4dc,_0x2d33e8){var _0x4921be=_0xea28('0x46')+_[_0xea28('0x1a')](_0x2d33e8)+_0xea28('0x47');var _0xf2584a=_0x2d33e8+'Pause';return db[_0x4921be][_0xea28('0x48')]({'where':{[_[_0xea28('0x1a')](_0x2d33e8)+_0xea28('0x49')]:_0x316075['id']},'raw':!![]})[_0xea28('0x13')](function(_0x3a29e0){for(var _0xfbbc35=0x0;_0xfbbc35<_0x3a29e0[_0xea28('0x3e')];_0xfbbc35++){var _0x1b353e=_['find'](_0x2cb4dc,['id',_0x3a29e0[_0xfbbc35][_0xea28('0x40')]]);if(!_0x1b353e){_0x1b353e={'id':_0x3a29e0[_0xfbbc35][_0xea28('0x40')],'name':_0x3a29e0[_0xfbbc35][_0xea28('0x40')],'online':![],['pauseField']:![]};}var _0x354748={'id':_0x1b353e['id'],'name':_0x1b353e['name'],'online':Boolean(_0x1b353e['online']),'paused':Boolean(_0x1b353e[_0xf2584a])};if(_0x354748[_0xea28('0x42')])_0x316075['loggedInDb']++;_0x316075[_0xea28('0x45')][_0xea28('0x22')](_0x354748);}return _0x316075;});}function isIdle(_0x14e340){return _0x14e340==='idle'||_0x14e340==='unknown'||_0x14e340==='unavailable'||_0x14e340===_0xea28('0x4a')||_[_0xea28('0x4b')](_0x14e340);}function isAgentPaused(_0x3508a0,_0x27df23){var _0x2e9bbd=[_0x3508a0[_0xea28('0x4c')],_0x3508a0[_0xea28('0x4d')],_0x3508a0[_0xea28('0x4e')],_0x3508a0[_0xea28('0x4f')],_0x3508a0[_0xea28('0x50')],_0x3508a0['voicePause'],_0x3508a0[_0xea28('0x51')]];if(!_0x27df23)return _[_0xea28('0x52')](_0x2e9bbd);var _0x3d6d94=_['filter'](_0x2e9bbd);return _0x3d6d94[_0xea28('0x3e')]>0x0&&_0x3d6d94[_0xea28('0x3e')]<_0x2e9bbd[_0xea28('0x3e')]?!![]:![];}function isAgentIdle(_0x402382){if(_0x402382[_0xea28('0x43')]!==_0xea28('0x53')&&_0x402382[_0xea28('0x54')]){_0x402382[_0xea28('0x43')]=_0xea28('0x55');return![];}return _[_0xea28('0x52')]([_0x402382[_0xea28('0x56')],_0x402382[_0xea28('0x57')],_0x402382[_0xea28('0x58')],_0x402382['openchannelStatus'],_0x402382[_0xea28('0x59')],_0x402382[_0xea28('0x43')],_0x402382['whatsappStatus']],isIdle);}function getAgentStatus(_0x41b0e2){var _0x385432=_0xea28('0x5a');if(isAgentPaused(_0x41b0e2))_0x385432=_0xea28('0x55');else if(isAgentPaused(_0x41b0e2,!![]))_0x385432=_0xea28('0x5b');else if(isAgentIdle(_0x41b0e2))_0x385432=_0xea28('0x53');else _0x385432='busy';return _0x385432;}function validateChannel(_0x4d70f4){var _0x519b26=[_0xea28('0x5c'),_0xea28('0x5d'),_0xea28('0x5e'),_0xea28('0x5f'),'fax',_0xea28('0x60'),_0xea28('0x19')];if(!_[_0xea28('0x61')](_0x519b26,_0x4d70f4['toLowerCase']()))throw new Error('Invalid\x20channel');return _0x4d70f4[_0xea28('0x62')]();}function getFilteredAgentIds(_0x30b9cd,_0x2efaa9){var _0x4ef814=_[_0xea28('0x63')](_0x30b9cd)?_0x30b9cd:[_0x30b9cd];var _0x29c94e=_[_0xea28('0x64')](_0x4ef814,function(_0x267d46){return db[_0x2efaa9]['findOne']({'where':{'name':_0x267d46}})[_0xea28('0x13')](function(_0xbb3259){if(!_0xbb3259)return[];return _0xbb3259[_0xea28('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x29c94e)[_0xea28('0x13')](function(_0x4f3735){var _0xd437e2=_(_0x4f3735)['flatten']()['map']('id')['uniq']()[_0xea28('0x66')]();return _0xd437e2;});}function getUpdatedSortOptions(_0x158c71){var _0x4ce696={'fields':[],'order':null};var _0x5574ba=_0x158c71[_0xea28('0x67')](',');_0x4ce696['fields']=_['filter'](_0x5574ba,function(_0x31e2d5){if(!_0x31e2d5[_0xea28('0x61')](_0xea28('0x68')))return!![];_0x4ce696[_0xea28('0x69')]=_[_0xea28('0x6a')](_0x31e2d5,'-')?_0xea28('0x6b'):'ASC';return![];});return _0x4ce696;}function orderAgentsByStatus(_0x49b2f3,_0x43cf67){return _0x49b2f3['sort'](function(_0x498fd7,_0x32787a){if(_0x498fd7[_0xea28('0x68')]===_0x32787a[_0xea28('0x68')]&&_0x498fd7[_0xea28('0x68')]===_0xea28('0x55')){if(_0x43cf67===_0xea28('0x6b'))return(_0x498fd7['pauseType']||'')<(_0x32787a['pauseType']||'')?0x1:-0x1;return _0x498fd7[_0xea28('0x6c')]<_0x32787a[_0xea28('0x6c')]?-0x1:0x1;}else{if(_0x43cf67===_0xea28('0x6b'))return _0x498fd7[_0xea28('0x68')]<_0x32787a[_0xea28('0x68')]?0x1:-0x1;return _0x498fd7['globalStatus']<_0x32787a['globalStatus']?-0x1:0x1;}});}exports['getAgents']=function(_0x34b534,_0x2bffbe){var _0x27ef7d={'count':0x0,'rows':[]},_0x42b40a={},_0x20de15,_0x436c3b,_0xfac5e1,_0x5c85e5,_0x23b63b=[_0xea28('0x6d'),_0xea28('0x42'),_0xea28('0x6e'),_0xea28('0x6f'),_0xea28('0x6c'),_0xea28('0x6f'),_0xea28('0x3b'),'address',_0xea28('0x4c'),_0xea28('0x4f'),_0xea28('0x4e'),_0xea28('0x50'),_0xea28('0x51'),_0xea28('0x4d'),_0xea28('0x54'),_0xea28('0x70'),_0xea28('0x71'),_0xea28('0x72'),'smsCapacity',_0xea28('0x73'),_0xea28('0x74'),'chatCurrentCapacity',_0xea28('0x75'),_0xea28('0x76'),_0xea28('0x77'),_0xea28('0x78'),_0xea28('0x79'),_0xea28('0x56'),_0xea28('0x7a'),_0xea28('0x58'),'smsStatus',_0xea28('0x7b'),_0xea28('0x57'),_0xea28('0x43'),_0xea28('0x7c'),_0xea28('0x7d'),'mailStatusTime',_0xea28('0x7e'),_0xea28('0x7f'),'faxStatusTime','voiceStatusTime',_0xea28('0x39'),_0xea28('0x80'),'screenrecording',_0xea28('0x81'),_0xea28('0x82'),_0xea28('0x83')],_0x481018=['chatPause',_0xea28('0x4f'),_0xea28('0x4e'),_0xea28('0x50'),'whatsappPause',_0xea28('0x4d'),_0xea28('0x54'),'online'];Promise['resolve']()[_0xea28('0x13')](function(){if(_0x34b534[_0xea28('0x84')][_0xea28('0x85')])_0x20de15=validateChannel(_0x34b534[_0xea28('0x84')]['channel']);if(!_0x34b534[_0xea28('0x84')][_0xea28('0x86')]||!_0x34b534[_0xea28('0x84')][_0xea28('0x86')][_0xea28('0x61')](_0xea28('0x68')))return;var _0x430dab=getUpdatedSortOptions(_0x34b534[_0xea28('0x84')]['sort']);_0x34b534[_0xea28('0x84')][_0xea28('0x86')]=_0x430dab[_0xea28('0x87')][_0xea28('0x88')](',');_0x436c3b=_0x430dab['order'];})[_0xea28('0x13')](function(){if(!_0x34b534[_0xea28('0x84')][_0xea28('0x89')])return[];var _0x3cac48=_[_0xea28('0x1a')](_0x20de15)+_0xea28('0x47');return getFilteredAgentIds(_0x34b534[_0xea28('0x84')][_0xea28('0x89')],_0x3cac48);})['then'](function(_0x2f48d1){var _0x1aa5d6=_[_0xea28('0x64')](db['User'][_0xea28('0x8a')],function(_0x4b6b4c){return{'name':_0x4b6b4c[_0xea28('0x8b')],'type':_0x4b6b4c['type'][_0xea28('0x8c')]};});_0x34b534[_0xea28('0x84')][_0xea28('0x8d')]=_0xea28('0x8e');_0x34b534[_0xea28('0x84')]['online']=!![];_0x42b40a=qs[_0xea28('0x8f')](_0x1aa5d6,_0x34b534);_0x42b40a[_0xea28('0x90')]=!![];if(!_[_0xea28('0x91')](_0x2f48d1)){_0x42b40a['where']=_['merge'](_0x42b40a[_0xea28('0x92')],{'$and':[{'id':{'$in':_0x2f48d1}}]});}else if(!_[_0xea28('0x91')](_0x34b534[_0xea28('0x84')]['globalQueueFilter'])){return _0x27ef7d;}if(_0x34b534[_0xea28('0x93')][_0xea28('0x8d')]===_0xea28('0x93')){var _0x3b3511={'params':{'id':_0x34b534[_0xea28('0x93')][_0xea28('0x94')]},'query':{'section':_0xea28('0x16'),'role':'agent','online':!![],'nolimit':_0x34b534[_0xea28('0x84')][_0xea28('0x95')],'sort':_0x34b534[_0xea28('0x84')][_0xea28('0x86')],'filter':_0x34b534[_0xea28('0x84')][_0xea28('0x38')],'raw':!![],'ids':_0x2f48d1}};return db[_0xea28('0x96')][_0xea28('0x97')](_0x3b3511);}return db[_0xea28('0x46')][_0xea28('0x98')](_0x42b40a);})['then'](function(_0x20ff14){_0x27ef7d[_0xea28('0xa')]=_0x20ff14[_0xea28('0xa')];_0xfac5e1=_0x20ff14[_0xea28('0x99')];return getRealtimeAgents();})[_0xea28('0x13')](function(_0x5da90c){_0x5c85e5=_0x5da90c[_0xea28('0x99')];return _0xfac5e1[_0xea28('0x64')](function(_0x723f10){var _0x40bf63=_[_0xea28('0x3f')](_0x5c85e5,['id',_0x723f10['id']]);if(_0x40bf63)_['merge'](_0x723f10,_[_0xea28('0x37')](_['omit'](_0x40bf63,_0x481018),_0x23b63b));_0x723f10['globalStatus']=getAgentStatus(_0x723f10);return _0x723f10;});})[_0xea28('0x13')](function(_0x340dec){var _0xa4b167;if(_0x34b534[_0xea28('0x84')][_0xea28('0x9a')]){_0xa4b167=_[_0xea28('0x38')](_0x340dec,[_0xea28('0x68'),_0x34b534[_0xea28('0x84')][_0xea28('0x9a')]]);if(_0x34b534[_0xea28('0x84')]['pauseTypeFilter']){_0xa4b167=_['filter'](_0xa4b167,[_0xea28('0x6c'),_0x34b534[_0xea28('0x84')]['pauseTypeFilter']]);}}if(_0xa4b167)_0x340dec=_0xa4b167;if(!_0x436c3b)return _0x340dec;return orderAgentsByStatus(_0x340dec,_0x436c3b);})[_0xea28('0x13')](function(_0x5cebba){_0x27ef7d[_0xea28('0x99')]=_0x5cebba;return _0x27ef7d;})[_0xea28('0x13')](respondWithFilteredResult(_0x2bffbe,_0x42b40a))['catch'](handleError(_0x2bffbe,null));};exports[_0xea28('0x9b')]=function(_0x25bb64,_0x287a1d){var _0x3e9f08={'count':0x0,'rows':[]},_0xea0e35={},_0x5e3ff8,_0x481fff,_0x5bba7d,_0x2653c0,_0x2477b9;Promise[_0xea28('0x9c')]()[_0xea28('0x13')](function(){if(_0x25bb64[_0xea28('0x84')]['channel'])_0x5e3ff8=validateChannel(_0x25bb64['query'][_0xea28('0x85')]);var _0x368790=_[_0xea28('0x1a')](_0x5e3ff8)+_0xea28('0x47');var _0x451588=_[_0xea28('0x64')](db[_0x368790][_0xea28('0x8a')],function(_0x444ec2){return{'name':_0x444ec2[_0xea28('0x8b')],'type':_0x444ec2[_0xea28('0x9d')][_0xea28('0x8c')]};});_0xea0e35=qs[_0xea28('0x8f')](_0x451588,_0x25bb64);if(_0x25bb64['user']['role']===_0xea28('0x93')){var _0x2a8fce={'params':{'id':_0x25bb64[_0xea28('0x93')][_0xea28('0x94')]},'query':{'section':_0x5e3ff8===_0xea28('0x19')&&_0x25bb64['query'][_0xea28('0x9d')]==='outbound'?_0xea28('0x9e'):_[_0xea28('0x1a')](_0x5e3ff8)+_0xea28('0x9f'),'type':_0x25bb64[_0xea28('0x84')]['type'],'nolimit':!![],'sort':_0xea28('0x10'),'filter':_0x25bb64[_0xea28('0x84')][_0xea28('0x38')]}};return db[_0xea28('0x96')][_0xea28('0x97')](_0x2a8fce);}return db[_0x368790][_0xea28('0x98')](_0xea0e35);})['then'](function(_0x435435){_0x3e9f08[_0xea28('0xa')]=_0x435435[_0xea28('0xa')];_0x481fff=_0x435435[_0xea28('0x99')];return getRealtimeQueues(_0x25bb64,_0x5e3ff8);})[_0xea28('0x13')](function(_0x3c035a){_0x2653c0=_0x3c035a['rows'];return getRealtimeAgents();})[_0xea28('0x13')](function(_0x5a8ee0){_0x5bba7d=_0x5a8ee0[_0xea28('0x99')];if(_0x5e3ff8!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xea28('0x13')](function(_0x50210b){_0x2477b9=_0x50210b?_0x50210b[_0xea28('0x99')]:[];return initializeQueues(_0x481fff,_0x2653c0,_0x5e3ff8,_0x25bb64[_0xea28('0x84')][_0xea28('0x9d')]);})['then'](function(_0x1b9386){var _0x25aa34=_0x1b9386['map'](function(_0x1cf17f){if(_0x5e3ff8===_0xea28('0x19'))return getVoiceQueueAgents(_0x1cf17f,_0x481fff,_0x5bba7d,_0x2477b9);else return getQueueAgents(_0x1cf17f,_0x5bba7d,_0x5e3ff8);});return Promise[_0xea28('0xa0')](_0x25aa34);})[_0xea28('0x13')](function(_0x4e72fe){_0x3e9f08['rows']=_0x4e72fe;return _0x3e9f08;})[_0xea28('0x13')](respondWithFilteredResult(_0x287a1d,_0xea0e35))[_0xea28('0x18')](handleError(_0x287a1d,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 09b10c2..f70d77a 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(_0x5800a5,_0x2823f6){var _0x420c85=function(_0x42e2e7){while(--_0x42e2e7){_0x5800a5['push'](_0x5800a5['shift']());}};_0x420c85(++_0x2823f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x45995c,_0x2f14a3){var _0x5ba272=function(_0x3837e4){while(--_0x3837e4){_0x45995c['push'](_0x45995c['shift']());}};_0x5ba272(++_0x2f14a3);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index f5647ff..cb33db0 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 _0xc7a3=['DATE','exports','INTEGER','STRING'];(function(_0x4efd3c,_0x3d2062){var _0x3a7892=function(_0x6145e7){while(--_0x6145e7){_0x4efd3c['push'](_0x4efd3c['shift']());}};_0x3a7892(++_0x3d2062);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x5c2310,_0x2cacbf){_0x5c2310=_0x5c2310-0x0;var _0x3d6433=_0xc7a3[_0x5c2310];return _0x3d6433;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'state':{'type':Sequelize[_0x3c7a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3c7a('0x2')]},'scheduledat':{'type':Sequelize[_0x3c7a('0x3')]},'uniqueid':{'type':Sequelize[_0x3c7a('0x2')]},'starttime':{'type':Sequelize[_0x3c7a('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3c7a('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3c7a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3c7a('0x2')]}}; \ No newline at end of file +var _0x78e0=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x20534c,_0x372ab1){var _0x362700=function(_0x311ccf){while(--_0x311ccf){_0x20534c['push'](_0x20534c['shift']());}};_0x362700(++_0x372ab1);}(_0x78e0,0x13e));var _0x078e=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x78e0[_0xf34895];return _0x143f44;};'use strict';var Sequelize=require(_0x078e('0x0'));module[_0x078e('0x1')]={'state':{'type':Sequelize[_0x078e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x078e('0x3')]},'scheduledat':{'type':Sequelize[_0x078e('0x4')]},'uniqueid':{'type':Sequelize[_0x078e('0x3')]},'starttime':{'type':Sequelize[_0x078e('0x4')]},'responsetime':{'type':Sequelize[_0x078e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x078e('0x3')]},'membername':{'type':Sequelize[_0x078e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 85447a3..a058763 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 _0xf828=['report_agent_preview','lodash','util','api','moment','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x2c8d5c,_0x4f563b){var _0x287575=function(_0x2351bb){while(--_0x2351bb){_0x2c8d5c['push'](_0x2c8d5c['shift']());}};_0x287575(++_0x4f563b);}(_0xf828,0xb5));var _0x8f82=function(_0x438513,_0x4b0847){_0x438513=_0x438513-0x0;var _0x316dde=_0xf828[_0x438513];return _0x316dde;};'use strict';var _=require(_0x8f82('0x0'));var util=require(_0x8f82('0x1'));var logger=require('../../config/logger')(_0x8f82('0x2'));var moment=require(_0x8f82('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f82('0x4'));var fs=require('fs');var path=require(_0x8f82('0x5'));var rimraf=require(_0x8f82('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f82('0x7'));module[_0x8f82('0x8')]=function(_0x2c8c3d,_0x40cc26){return _0x2c8c3d[_0x8f82('0x9')](_0x8f82('0xa'),attributes,{'tableName':_0x8f82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65c7=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x1a212a,_0x64496b){var _0x22d075=function(_0x1b745a){while(--_0x1b745a){_0x1a212a['push'](_0x1a212a['shift']());}};_0x22d075(++_0x64496b);}(_0x65c7,0xe1));var _0x765c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x65c7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x765c('0x0'));var util=require('util');var logger=require(_0x765c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x765c('0x2'));var rimraf=require(_0x765c('0x3'));var config=require(_0x765c('0x4'));var attributes=require(_0x765c('0x5'));module[_0x765c('0x6')]=function(_0x9d7d93,_0x28e2b9){return _0x9d7d93[_0x765c('0x7')](_0x765c('0x8'),attributes,{'tableName':_0x765c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 1b9d7ad..807acf4 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 _0x9ae3=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateReportAgentPreview','create','body','options','raw','lodash'];(function(_0x50f957,_0x351291){var _0x4fecea=function(_0x118324){while(--_0x118324){_0x50f957['push'](_0x50f957['shift']());}};_0x4fecea(++_0x351291);}(_0x9ae3,0xbf));var _0x39ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9ae3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x39ae('0x0'));var util=require(_0x39ae('0x1'));var moment=require(_0x39ae('0x2'));var BPromise=require(_0x39ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39ae('0x4'))['db'];var utils=require(_0x39ae('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x39ae('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x39ae('0x7')][_0x39ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25a348,_0x552b58,_0x4332f9){return new BPromise(function(_0x7b74f8,_0x3652d2){return client[_0x39ae('0x9')](_0x25a348,_0x4332f9)['then'](function(_0x292087){logger[_0x39ae('0xa')](_0x39ae('0xb'),_0x552b58,_0x39ae('0xc'));logger[_0x39ae('0xd')](_0x39ae('0xe'),_0x552b58,'request\x20sent',JSON[_0x39ae('0xf')](_0x292087));if(_0x292087['error']){if(_0x292087[_0x39ae('0x10')]['code']===0x1f4){logger[_0x39ae('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x552b58,_0x292087['error']['message']);return _0x3652d2(_0x292087[_0x39ae('0x10')][_0x39ae('0x11')]);}logger[_0x39ae('0x10')](_0x39ae('0xb'),_0x552b58,_0x292087[_0x39ae('0x10')]['message']);return _0x7b74f8(_0x292087[_0x39ae('0x10')][_0x39ae('0x11')]);}else{logger[_0x39ae('0xa')](_0x39ae('0xb'),_0x552b58,'request\x20sent');_0x7b74f8(_0x292087['result'][_0x39ae('0x11')]);}})[_0x39ae('0x12')](function(_0x2972e2){logger[_0x39ae('0x10')](_0x39ae('0xb'),_0x552b58,_0x2972e2);_0x3652d2(_0x2972e2);});});}exports[_0x39ae('0x13')]=function(_0xa85df7){var _0x2e7aef=this;return new Promise(function(_0x3ac4e9,_0x27bdde){return db['ReportAgentPreview'][_0x39ae('0x14')](_0xa85df7[_0x39ae('0x15')],{'raw':_0xa85df7['options']?_0xa85df7[_0x39ae('0x16')][_0x39ae('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x39c5ff){logger[_0x39ae('0xa')]('CreateReportAgentPreview',_0xa85df7);logger[_0x39ae('0xd')]('CreateReportAgentPreview',_0xa85df7,JSON[_0x39ae('0xf')](_0x39c5ff));_0x3ac4e9(_0x39c5ff);})[_0x39ae('0x12')](function(_0x33a4e1){logger[_0x39ae('0x10')](_0x39ae('0x13'),_0x33a4e1[_0x39ae('0x11')],_0xa85df7);_0x27bdde(_0x2e7aef['error'](0x1f4,_0x33a4e1[_0x39ae('0x11')]));});});}; \ No newline at end of file +var _0x8e41=['body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','create'];(function(_0x2d6be0,_0x27a2e4){var _0x376401=function(_0x5cd71b){while(--_0x5cd71b){_0x2d6be0['push'](_0x2d6be0['shift']());}};_0x376401(++_0x27a2e4);}(_0x8e41,0x112));var _0x18e4=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x8e41[_0x338338];return _0x3cf852;};'use strict';var _=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var moment=require(_0x18e4('0x2'));var BPromise=require(_0x18e4('0x3'));var rs=require(_0x18e4('0x4'));var fs=require('fs');var Redis=require(_0x18e4('0x5'));var db=require(_0x18e4('0x6'))['db'];var utils=require(_0x18e4('0x7'));var logger=require(_0x18e4('0x8'))(_0x18e4('0x9'));var config=require(_0x18e4('0xa'));var jayson=require(_0x18e4('0xb'));var client=jayson[_0x18e4('0xc')][_0x18e4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1cd14e,_0x3b896f,_0x5d9fb8){return new BPromise(function(_0x556441,_0x1a0cda){return client['request'](_0x1cd14e,_0x5d9fb8)['then'](function(_0x1febd7){logger[_0x18e4('0xe')](_0x18e4('0xf'),_0x3b896f,_0x18e4('0x10'));logger['debug'](_0x18e4('0x11'),_0x3b896f,_0x18e4('0x10'),JSON[_0x18e4('0x12')](_0x1febd7));if(_0x1febd7[_0x18e4('0x13')]){if(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x14')]===0x1f4){logger[_0x18e4('0x13')](_0x18e4('0xf'),_0x3b896f,_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);return _0x1a0cda(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);}logger['error'](_0x18e4('0xf'),_0x3b896f,_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);return _0x556441(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);}else{logger[_0x18e4('0xe')](_0x18e4('0xf'),_0x3b896f,_0x18e4('0x10'));_0x556441(_0x1febd7[_0x18e4('0x16')]['message']);}})[_0x18e4('0x17')](function(_0x34eaef){logger[_0x18e4('0x13')](_0x18e4('0xf'),_0x3b896f,_0x34eaef);_0x1a0cda(_0x34eaef);});});}exports['CreateReportAgentPreview']=function(_0xf8b316){var _0x319ab2=this;return new Promise(function(_0x28d24a,_0x36e549){return db[_0x18e4('0x18')][_0x18e4('0x19')](_0xf8b316[_0x18e4('0x1a')],{'raw':_0xf8b316['options']?_0xf8b316[_0x18e4('0x1b')][_0x18e4('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x17adb5){logger[_0x18e4('0xe')](_0x18e4('0x1d'),_0xf8b316);logger['debug'](_0x18e4('0x1d'),_0xf8b316,JSON[_0x18e4('0x12')](_0x17adb5));_0x28d24a(_0x17adb5);})[_0x18e4('0x17')](function(_0x12d36d){logger['error'](_0x18e4('0x1d'),_0x12d36d['message'],_0xf8b316);_0x36e549(_0x319ab2['error'](0x1f4,_0x12d36d['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e9cbe12..a3bd674 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 _0x1d6c=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x457d50,_0x3b9d36){var _0x26e448=function(_0x416358){while(--_0x416358){_0x457d50['push'](_0x457d50['shift']());}};_0x26e448(++_0x3b9d36);}(_0x1d6c,0x1b3));var _0xc1d6=function(_0x358c99,_0xe427f9){_0x358c99=_0x358c99-0x0;var _0x359d32=_0x1d6c[_0x358c99];return _0x359d32;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require(_0xc1d6('0x2'));var express=require(_0xc1d6('0x3'));var router=express['Router']();var auth=require(_0xc1d6('0x4'));var controller=require('./rpc.controller');router['get']('/voice/channels',auth['isAuthenticated'](),controller[_0xc1d6('0x5')]);router[_0xc1d6('0x6')](_0xc1d6('0x7'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xc1d6('0x6')](_0xc1d6('0x8'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0xa')]);router[_0xc1d6('0x6')](_0xc1d6('0xb'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0xc1d6('0x6')](_0xc1d6('0xc'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0xd')]);router[_0xc1d6('0x6')]('/mail/queues',auth[_0xc1d6('0x9')](),controller[_0xc1d6('0xe')]);router['get'](_0xc1d6('0xf'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x10')]);router[_0xc1d6('0x6')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x12')]);router[_0xc1d6('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0xc1d6('0x13')]);router['get'](_0xc1d6('0x14'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x15')]);router[_0xc1d6('0x6')](_0xc1d6('0x16'),auth[_0xc1d6('0x9')](),controller['faxQueues']);router['get'](_0xc1d6('0x17'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x18')]);router[_0xc1d6('0x6')]('/voice/queues/channels',auth[_0xc1d6('0x9')](),controller['voiceQueuesChannels']);router['get'](_0xc1d6('0x19'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x1a')]);router[_0xc1d6('0x6')](_0xc1d6('0x1b'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x1c')]);router['get'](_0xc1d6('0x1d'),auth[_0xc1d6('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0xc1d6('0x6')](_0xc1d6('0x1e'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x1f')]);router['put'](_0xc1d6('0x1e'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x20')]);router[_0xc1d6('0x6')](_0xc1d6('0x21'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x22')]);router['get'](_0xc1d6('0x23'),auth[_0xc1d6('0x9')](),controller['outboundChannels']);router['get']('/agents',auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x24')]);router[_0xc1d6('0x25')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xc1d6('0x26')]);router['get'](_0xc1d6('0x27'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x28')]);router[_0xc1d6('0x6')](_0xc1d6('0x29'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x2a')]);router['get']('/campaigns',auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x2b')]);router[_0xc1d6('0x6')](_0xc1d6('0x2c'),auth[_0xc1d6('0x9')](),controller['faxAccounts']);router[_0xc1d6('0x6')](_0xc1d6('0x2d'),auth[_0xc1d6('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xc1d6('0x6')](_0xc1d6('0x2e'),auth['isAuthenticated'](),controller[_0xc1d6('0x2f')]);router[_0xc1d6('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x30')]);router[_0xc1d6('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc1d6('0x6')](_0xc1d6('0x31'),auth['isAuthenticated'](),controller[_0xc1d6('0x32')]);router['get'](_0xc1d6('0x33'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xc1d6('0x34'),auth['isAuthenticated'](),controller[_0xc1d6('0x35')]);router[_0xc1d6('0x36')](_0xc1d6('0x37'),auth['isAuthenticated'](),controller[_0xc1d6('0x38')]('mail'));router[_0xc1d6('0x6')]('/mail/queues/:id',auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x39')]);router['post'](_0xc1d6('0x3a'),auth['isAuthenticated'](),controller['queueNotify'](_0xc1d6('0x3b')));router[_0xc1d6('0x6')](_0xc1d6('0x3c'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x3d')]);router[_0xc1d6('0x36')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc1d6('0x38')](_0xc1d6('0x3e')));router[_0xc1d6('0x6')](_0xc1d6('0x3f'),auth['isAuthenticated'](),controller[_0xc1d6('0x40')]);router[_0xc1d6('0x36')](_0xc1d6('0x41'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x38')]('openchannel'));router['get'](_0xc1d6('0x42'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x43')]);router['post'](_0xc1d6('0x44'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x38')](_0xc1d6('0x45')));router[_0xc1d6('0x36')](_0xc1d6('0x46'),auth[_0xc1d6('0x9')](),controller['queueNotify'](_0xc1d6('0x47')));router[_0xc1d6('0x6')](_0xc1d6('0x48'),auth[_0xc1d6('0x9')](),controller['showSmsQueues']);router[_0xc1d6('0x6')](_0xc1d6('0x49'),auth[_0xc1d6('0x9')](),controller[_0xc1d6('0x4a')]);router[_0xc1d6('0x36')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xc1d6('0x4b')]);module[_0xc1d6('0x4c')]=router; \ No newline at end of file +var _0x7a2f=['faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x7a2f,0x108));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var path=require(_0xf7a2('0x2'));var express=require('express');var router=express[_0xf7a2('0x3')]();var auth=require(_0xf7a2('0x4'));var controller=require(_0xf7a2('0x5'));router[_0xf7a2('0x6')](_0xf7a2('0x7'),auth[_0xf7a2('0x8')](),controller['voiceChannels']);router[_0xf7a2('0x6')](_0xf7a2('0x9'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xa')]);router[_0xf7a2('0x6')](_0xf7a2('0xb'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xc')]);router['get'](_0xf7a2('0xd'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xe')]);router[_0xf7a2('0x6')](_0xf7a2('0xf'),auth[_0xf7a2('0x8')](),controller['chatQueues']);router['get'](_0xf7a2('0x10'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x11')]);router[_0xf7a2('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xf7a2('0x12')]);router['get'](_0xf7a2('0x13'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x14')]);router['get']('/sms/queues',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x15')]);router[_0xf7a2('0x6')]('/whatsapp/queues',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x16')]);router['get'](_0xf7a2('0x17'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x18')]);router[_0xf7a2('0x6')](_0xf7a2('0x19'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1a')]);router[_0xf7a2('0x6')](_0xf7a2('0x1b'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1c')]);router[_0xf7a2('0x6')](_0xf7a2('0x1d'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1e')]);router[_0xf7a2('0x6')](_0xf7a2('0x1f'),auth[_0xf7a2('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xf7a2('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x20')]);router[_0xf7a2('0x6')]('/voice/queues/:id',auth[_0xf7a2('0x8')](),controller['showVoiceQueues']);router[_0xf7a2('0x21')]('/voice/queues/:id',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x22')]);router[_0xf7a2('0x6')](_0xf7a2('0x23'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x24')]);router[_0xf7a2('0x6')](_0xf7a2('0x25'),auth[_0xf7a2('0x8')](),controller['outboundChannels']);router[_0xf7a2('0x6')]('/agents',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x26')]);router[_0xf7a2('0x21')](_0xf7a2('0x27'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x28')]);router['get'](_0xf7a2('0x29'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2a')]);router[_0xf7a2('0x6')](_0xf7a2('0x2b'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2c')]);router[_0xf7a2('0x6')]('/campaigns',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2d')]);router[_0xf7a2('0x6')](_0xf7a2('0x2e'),auth['isAuthenticated'](),controller[_0xf7a2('0x2f')]);router[_0xf7a2('0x6')](_0xf7a2('0x30'),auth[_0xf7a2('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xf7a2('0x6')]('/mail/queues/waitinginteractions',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x31')]);router[_0xf7a2('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf7a2('0x32')]);router[_0xf7a2('0x6')](_0xf7a2('0x33'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x34')]);router['get'](_0xf7a2('0x35'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x36')]);router[_0xf7a2('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x37')]);router[_0xf7a2('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf7a2('0x38')]);router['post'](_0xf7a2('0x39'),auth['isAuthenticated'](),controller[_0xf7a2('0x3a')](_0xf7a2('0x3b')));router[_0xf7a2('0x6')](_0xf7a2('0x3c'),auth[_0xf7a2('0x8')](),controller['showMailQueues']);router[_0xf7a2('0x3d')](_0xf7a2('0x3e'),auth[_0xf7a2('0x8')](),controller['queueNotify'](_0xf7a2('0x3f')));router['get'](_0xf7a2('0x40'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x3a')](_0xf7a2('0x42')));router[_0xf7a2('0x6')](_0xf7a2('0x43'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x44')]);router[_0xf7a2('0x3d')]('/openchannel/queues/:id/notify',auth[_0xf7a2('0x8')](),controller['queueNotify'](_0xf7a2('0x45')));router['get'](_0xf7a2('0x46'),auth['isAuthenticated'](),controller[_0xf7a2('0x47')]);router[_0xf7a2('0x3d')](_0xf7a2('0x48'),auth['isAuthenticated'](),controller[_0xf7a2('0x3a')](_0xf7a2('0x49')));router['post']('/whatsapp/queues/:id/notify',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x3a')]('whatsapp'));router[_0xf7a2('0x6')](_0xf7a2('0x4a'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x4b')]);router[_0xf7a2('0x6')](_0xf7a2('0x4c'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x4d')]);router[_0xf7a2('0x3d')](_0xf7a2('0x4e'),auth['isAuthenticated'](),controller[_0xf7a2('0x4f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 30e87c7..9e645f5 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0x11e1fc,_0x198eb2){var _0x406868=function(_0x2cb52d){while(--_0x2cb52d){_0x11e1fc['push'](_0x11e1fc['shift']());}};_0x406868(++_0x198eb2);}(_0x8ef6,0xf2));var _0x68ef=function(_0x22f15a,_0x3cc8d5){_0x22f15a=_0x22f15a-0x0;var _0xa8a571=_0x8ef6[_0x22f15a];return _0xa8a571;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file +var _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x3fd7c0,_0x1acce2){var _0x1310cc=function(_0x5827af){while(--_0x5827af){_0x3fd7c0['push'](_0x3fd7c0['shift']());}};_0x1310cc(++_0x1acce2);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e640ae5..4b834e8 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 _0x9dc0=['get','isAuthenticated','index','/:id','show','/:id/run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x141a31,_0x3ab263){var _0x44b4e3=function(_0x488a3c){while(--_0x488a3c){_0x141a31['push'](_0x141a31['shift']());}};_0x44b4e3(++_0x3ab263);}(_0x9dc0,0x175));var _0x09dc=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x9dc0[_0x35d775];return _0x59384d;};'use strict';var multer=require(_0x09dc('0x0'));var util=require(_0x09dc('0x1'));var path=require(_0x09dc('0x2'));var timeout=require(_0x09dc('0x3'));var express=require('express');var router=express[_0x09dc('0x4')]();var fs_extra=require(_0x09dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x09dc('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x09dc('0x7')]('/',auth[_0x09dc('0x8')](),controller[_0x09dc('0x9')]);router[_0x09dc('0x7')](_0x09dc('0xa'),auth[_0x09dc('0x8')](),controller[_0x09dc('0xb')]);router[_0x09dc('0x7')](_0x09dc('0xc'),auth[_0x09dc('0x8')](),controller['run']);router[_0x09dc('0xd')]('/',auth[_0x09dc('0x8')](),controller[_0x09dc('0xe')]);router[_0x09dc('0xf')](_0x09dc('0xa'),auth[_0x09dc('0x8')](),controller[_0x09dc('0x10')]);router[_0x09dc('0x11')](_0x09dc('0xa'),auth[_0x09dc('0x8')](),controller['destroy']);module[_0x09dc('0x12')]=router; \ No newline at end of file +var _0xd6f2=['../../components/auth/service','../../config/environment','./schedule.controller','get','/:id','show','/:id/run','isAuthenticated','run','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xd6f2,0x18a));var _0x2d6f=function(_0xd14bb1,_0x1ed15b){_0xd14bb1=_0xd14bb1-0x0;var _0x11c5b6=_0xd6f2[_0xd14bb1];return _0x11c5b6;};'use strict';var multer=require(_0x2d6f('0x0'));var util=require(_0x2d6f('0x1'));var path=require(_0x2d6f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d6f('0x3'));var router=express[_0x2d6f('0x4')]();var fs_extra=require(_0x2d6f('0x5'));var auth=require(_0x2d6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d6f('0x7'));var controller=require(_0x2d6f('0x8'));router[_0x2d6f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2d6f('0xa'),auth['isAuthenticated'](),controller[_0x2d6f('0xb')]);router[_0x2d6f('0x9')](_0x2d6f('0xc'),auth[_0x2d6f('0xd')](),controller[_0x2d6f('0xe')]);router[_0x2d6f('0xf')]('/',auth[_0x2d6f('0xd')](),controller[_0x2d6f('0x10')]);router[_0x2d6f('0x11')](_0x2d6f('0xa'),auth[_0x2d6f('0xd')](),controller['update']);router['delete'](_0x2d6f('0xa'),auth[_0x2d6f('0xd')](),controller[_0x2d6f('0x12')]);module[_0x2d6f('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6e77933..af34068 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 _0x8905=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x36cd7a,_0x15d7e0){var _0x5e1399=function(_0x2210b6){while(--_0x2210b6){_0x36cd7a['push'](_0x36cd7a['shift']());}};_0x5e1399(++_0x15d7e0);}(_0x8905,0x114));var _0x5890=function(_0x1bfa36,_0x263bdf){_0x1bfa36=_0x1bfa36-0x0;var _0xbc1919=_0x8905[_0x1bfa36];return _0xbc1919;};'use strict';var Sequelize=require(_0x5890('0x0'));module[_0x5890('0x1')]={'name':{'type':Sequelize[_0x5890('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5890('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5890('0x2')],'allowNull':![],'defaultValue':_0x5890('0x4')},'startAt':{'type':Sequelize[_0x5890('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5890('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5890('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5890('0x7')]('years',_0x5890('0x8'),_0x5890('0x9'),_0x5890('0xa'),_0x5890('0xb'),_0x5890('0xc'),_0x5890('0xd')),'allowNull':![],'defaultValue':_0x5890('0xb')},'output':{'type':Sequelize[_0x5890('0x7')](_0x5890('0xe'),_0x5890('0xf'),_0x5890('0x10')),'allowNull':![],'defaultValue':_0x5890('0xe')},'type':{'type':Sequelize['ENUM'](_0x5890('0x11'),_0x5890('0x12')),'allowNull':![],'defaultValue':_0x5890('0x11')},'sendMail':{'type':Sequelize[_0x5890('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5890('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa594=['BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x531ee7,_0x2b1aa7){var _0xf1439d=function(_0x3a6c45){while(--_0x3a6c45){_0x531ee7['push'](_0x531ee7['shift']());}};_0xf1439d(++_0x2b1aa7);}(_0xa594,0x13d));var _0x4a59=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xa594[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0x4a59('0x0'));module[_0x4a59('0x1')]={'name':{'type':Sequelize[_0x4a59('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4a59('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4a59('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4a59('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4a59('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4a59('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0x7'),_0x4a59('0x8'),_0x4a59('0x9'),_0x4a59('0xa'),'days',_0x4a59('0xb'),_0x4a59('0xc')),'allowNull':![],'defaultValue':_0x4a59('0xd')},'output':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0xe'),_0x4a59('0xf'),_0x4a59('0x10')),'allowNull':![],'defaultValue':_0x4a59('0xe')},'type':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0x11'),_0x4a59('0x12')),'allowNull':![],'defaultValue':_0x4a59('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x4a59('0x2')]},'cc':{'type':Sequelize[_0x4a59('0x13')]},'bcc':{'type':Sequelize[_0x4a59('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 73d128f..3b41a48 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 _0x3089=['limit','count','set','Content-Range','json','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','end','error','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','update','run','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined'];(function(_0x53feda,_0x8d5d13){var _0x2c0b4f=function(_0xc82721){while(--_0xc82721){_0x53feda['push'](_0x53feda['shift']());}};_0x2c0b4f(++_0x8d5d13);}(_0x3089,0x142));var _0x9308=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3089[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x9308('0x0'));var rimraf=require(_0x9308('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9308('0x2'));var rp=require('request-promise');var moment=require(_0x9308('0x3'));var BPromise=require(_0x9308('0x4'));var Mustache=require(_0x9308('0x5'));var util=require('util');var path=require(_0x9308('0x6'));var sox=require(_0x9308('0x7'));var csv=require(_0x9308('0x8'));var ejs=require(_0x9308('0x9'));var fs=require('fs');var fs_extra=require(_0x9308('0xa'));var _=require(_0x9308('0xb'));var squel=require(_0x9308('0xc'));var crypto=require(_0x9308('0xd'));var jsforce=require(_0x9308('0xe'));var deskjs=require(_0x9308('0xf'));var toCsv=require(_0x9308('0x8'));var querystring=require('querystring');var Papa=require(_0x9308('0x10'));var Redis=require(_0x9308('0x11'));var authService=require(_0x9308('0x12'));var qs=require(_0x9308('0x13'));var as=require(_0x9308('0x14'));var hardwareService=require(_0x9308('0x15'));var logger=require(_0x9308('0x16'))(_0x9308('0x17'));var utils=require('../../config/utils');var config=require(_0x9308('0x18'));var licenseUtil=require(_0x9308('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115c1a,_0x217aaf){_0x217aaf=_0x217aaf||0xcc;return function(_0xebcac6){if(_0xebcac6){return _0x115c1a[_0x9308('0x1a')](_0x217aaf);}return _0x115c1a['status'](_0x217aaf)['end']();};}function respondWithResult(_0x22987b,_0x13b3bc){_0x13b3bc=_0x13b3bc||0xc8;return function(_0x4dc1c4){if(_0x4dc1c4){return _0x22987b[_0x9308('0x1b')](_0x13b3bc)['json'](_0x4dc1c4);}};}function respondWithFilteredResult(_0x5497e0,_0x25419c){return function(_0x2c782d){if(_0x2c782d){var _0x3f365c=typeof _0x25419c[_0x9308('0x1c')]===_0x9308('0x1d')&&typeof _0x25419c[_0x9308('0x1e')]===_0x9308('0x1d');var _0x32abed=_0x2c782d[_0x9308('0x1f')];var _0x380a12=_0x3f365c?0x0:_0x25419c[_0x9308('0x1c')];var _0x5a6def=_0x3f365c?_0x2c782d[_0x9308('0x1f')]:_0x25419c[_0x9308('0x1c')]+_0x25419c[_0x9308('0x1e')];var _0x28eb6e;if(_0x5a6def>=_0x32abed){_0x5a6def=_0x32abed;_0x28eb6e=0xc8;}else{_0x28eb6e=0xce;}_0x5497e0[_0x9308('0x1b')](_0x28eb6e);return _0x5497e0[_0x9308('0x20')](_0x9308('0x21'),_0x380a12+'-'+_0x5a6def+'/'+_0x32abed)[_0x9308('0x22')](_0x2c782d);}return null;};}function patchUpdates(_0x1354c4){return function(_0x554951){try{jsonpatch[_0x9308('0x23')](_0x554951,_0x1354c4,!![]);}catch(_0x3ef005){return BPromise[_0x9308('0x24')](_0x3ef005);}return _0x554951[_0x9308('0x25')]();};}function saveUpdates(_0x6b12a6,_0x4e31dc){return function(_0x173b34){if(_0x173b34){return _0x173b34['update'](_0x6b12a6)[_0x9308('0x26')](function(_0x4f6916){return _0x4f6916;});}return null;};}function removeEntity(_0x17e585,_0x426a0b){return function(_0x1bd03e){if(_0x1bd03e){return _0x1bd03e['destroy']()['then'](function(){var _0x165175=_0x1bd03e[_0x9308('0x27')]({'plain':!![]});var _0x236f14=_0x9308('0x28');return db[_0x9308('0x29')][_0x9308('0x2a')]({'where':{'type':_0x236f14,'resourceId':_0x165175['id']}})[_0x9308('0x26')](function(){return _0x1bd03e;});})['then'](function(){_0x17e585[_0x9308('0x1b')](0xcc)[_0x9308('0x2b')]();});}};}function handleEntityNotFound(_0x1e9521,_0x2a7425){return function(_0x1d95ff){if(!_0x1d95ff){_0x1e9521['sendStatus'](0x194);}return _0x1d95ff;};}function handleError(_0x42c665,_0x2c23b6){_0x2c23b6=_0x2c23b6||0x1f4;return function(_0x1e401e){logger[_0x9308('0x2c')](_0x1e401e['stack']);if(_0x1e401e[_0x9308('0x2d')]){delete _0x1e401e[_0x9308('0x2d')];}_0x42c665['status'](_0x2c23b6)[_0x9308('0x2e')](_0x1e401e);};}exports[_0x9308('0x2f')]=function(_0x32b886,_0x456fcb){var _0x19e919={},_0x2b32ec={},_0x474f5a={'count':0x0,'rows':[]};var _0x4137f7=_[_0x9308('0x30')](db[_0x9308('0x31')][_0x9308('0x32')],function(_0x10b5dc){return{'name':_0x10b5dc['fieldName'],'type':_0x10b5dc[_0x9308('0x33')][_0x9308('0x34')]};});_0x2b32ec[_0x9308('0x35')]=_[_0x9308('0x30')](_0x4137f7,'name');_0x2b32ec[_0x9308('0x36')]=_[_0x9308('0x37')](_0x32b886[_0x9308('0x36')]);_0x2b32ec['filters']=_[_0x9308('0x38')](_0x2b32ec[_0x9308('0x35')],_0x2b32ec[_0x9308('0x36')]);_0x19e919[_0x9308('0x39')]=_['intersection'](_0x2b32ec[_0x9308('0x35')],qs['fields'](_0x32b886['query']['fields']));_0x19e919[_0x9308('0x39')]=_0x19e919['attributes'][_0x9308('0x3a')]?_0x19e919[_0x9308('0x39')]:_0x2b32ec[_0x9308('0x35')];if(!_0x32b886[_0x9308('0x36')][_0x9308('0x3b')](_0x9308('0x3c'))){_0x19e919['limit']=qs['limit'](_0x32b886[_0x9308('0x36')][_0x9308('0x1e')]);_0x19e919[_0x9308('0x1c')]=qs[_0x9308('0x1c')](_0x32b886[_0x9308('0x36')]['offset']);}_0x19e919[_0x9308('0x3d')]=qs[_0x9308('0x3e')](_0x32b886[_0x9308('0x36')][_0x9308('0x3e')]);_0x19e919[_0x9308('0x3f')]=qs[_0x9308('0x40')](_[_0x9308('0x41')](_0x32b886[_0x9308('0x36')],_0x2b32ec['filters']),_0x4137f7);if(_0x32b886['query']['filter']){_0x19e919[_0x9308('0x3f')]=_[_0x9308('0x42')](_0x19e919[_0x9308('0x3f')],{'$or':_['map'](_0x4137f7,function(_0x26fd4e){if(_0x26fd4e[_0x9308('0x33')]!==_0x9308('0x43')){var _0x2de5b7={};_0x2de5b7[_0x26fd4e[_0x9308('0x2d')]]={'$like':'%'+_0x32b886[_0x9308('0x36')][_0x9308('0x44')]+'%'};return _0x2de5b7;}})});}_0x19e919=_['merge']({},_0x19e919,_0x32b886[_0x9308('0x45')]);var _0x55cdda={'where':_0x19e919[_0x9308('0x3f')]};return db[_0x9308('0x31')]['count'](_0x55cdda)[_0x9308('0x26')](function(_0x1a5155){_0x474f5a[_0x9308('0x1f')]=_0x1a5155;if(_0x32b886[_0x9308('0x36')]['includeAll']){_0x19e919['include']=[{'all':!![]}];}return db[_0x9308('0x31')][_0x9308('0x46')](_0x19e919);})[_0x9308('0x26')](function(_0x1182de){_0x474f5a[_0x9308('0x47')]=_0x1182de;return _0x474f5a;})[_0x9308('0x26')](respondWithFilteredResult(_0x456fcb,_0x19e919))['catch'](handleError(_0x456fcb,null));};exports['show']=function(_0xaf1e1b,_0x1e57ad){var _0x1a1327={'raw':![],'where':{'id':_0xaf1e1b[_0x9308('0x48')]['id']}},_0x58ad21={};_0x58ad21[_0x9308('0x35')]=_[_0x9308('0x37')](db['Schedule'][_0x9308('0x32')]);_0x58ad21[_0x9308('0x36')]=_[_0x9308('0x37')](_0xaf1e1b[_0x9308('0x36')]);_0x58ad21[_0x9308('0x40')]=_[_0x9308('0x38')](_0x58ad21[_0x9308('0x35')],_0x58ad21[_0x9308('0x36')]);_0x1a1327[_0x9308('0x39')]=_['intersection'](_0x58ad21[_0x9308('0x35')],qs[_0x9308('0x49')](_0xaf1e1b[_0x9308('0x36')][_0x9308('0x49')]));_0x1a1327[_0x9308('0x39')]=_0x1a1327[_0x9308('0x39')][_0x9308('0x3a')]?_0x1a1327[_0x9308('0x39')]:_0x58ad21[_0x9308('0x35')];if(_0xaf1e1b['query']['includeAll']){_0x1a1327[_0x9308('0x4a')]=[{'all':!![]}];}_0x1a1327=_[_0x9308('0x42')]({},_0x1a1327,_0xaf1e1b[_0x9308('0x45')]);return db[_0x9308('0x31')][_0x9308('0x4b')](_0x1a1327)[_0x9308('0x26')](handleEntityNotFound(_0x1e57ad,null))[_0x9308('0x26')](respondWithResult(_0x1e57ad,null))['catch'](handleError(_0x1e57ad,null));};exports['create']=function(_0x39cac7,_0x16edf2){return db[_0x9308('0x31')][_0x9308('0x4c')](_0x39cac7[_0x9308('0x4d')],{})[_0x9308('0x26')](function(_0xf0efe){var _0x10e2c6=_0x39cac7[_0x9308('0x4e')][_0x9308('0x27')]({'plain':!![]});if(!_0x10e2c6)throw new Error(_0x9308('0x4f'));if(_0x10e2c6[_0x9308('0x50')]===_0x9308('0x4e')){var _0x491fca=_0xf0efe['get']({'plain':!![]});var _0x12d696=_0x9308('0x28');return db[_0x9308('0x51')][_0x9308('0x4b')]({'where':{'name':_0x12d696,'userProfileId':_0x10e2c6[_0x9308('0x52')]},'raw':!![]})['then'](function(_0x5552d8){if(_0x5552d8&&_0x5552d8[_0x9308('0x53')]===0x0){return db[_0x9308('0x29')][_0x9308('0x4c')]({'name':_0x491fca[_0x9308('0x2d')],'resourceId':_0x491fca['id'],'type':_0x5552d8[_0x9308('0x2d')],'sectionId':_0x5552d8['id']},{})['then'](function(){return _0xf0efe;});}else{return _0xf0efe;}})[_0x9308('0x54')](function(_0x1368cb){logger[_0x9308('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1368cb);throw _0x1368cb;});}return _0xf0efe;})[_0x9308('0x26')](respondWithResult(_0x16edf2,0xc9))['catch'](handleError(_0x16edf2,null));};exports[_0x9308('0x55')]=function(_0x55623b,_0x357e10){if(_0x55623b[_0x9308('0x4d')]['id']){delete _0x55623b['body']['id'];}return db[_0x9308('0x31')]['find']({'where':{'id':_0x55623b[_0x9308('0x48')]['id']}})[_0x9308('0x26')](handleEntityNotFound(_0x357e10,null))[_0x9308('0x26')](saveUpdates(_0x55623b[_0x9308('0x4d')],null))[_0x9308('0x26')](respondWithResult(_0x357e10,null))[_0x9308('0x54')](handleError(_0x357e10,null));};exports[_0x9308('0x2a')]=function(_0x131b77,_0x188dec){return db[_0x9308('0x31')][_0x9308('0x4b')]({'where':{'id':_0x131b77['params']['id']}})[_0x9308('0x26')](handleEntityNotFound(_0x188dec,null))[_0x9308('0x26')](removeEntity(_0x188dec,null))[_0x9308('0x54')](handleError(_0x188dec,null));};exports[_0x9308('0x56')]=function(_0x2b6ed2,_0x54eb4a,_0x4a8e28){var _0x5307f4=require(_0x9308('0x57'));return db['Schedule']['find']({'where':{'id':_0x2b6ed2[_0x9308('0x48')]['id']},'raw':!![]})[_0x9308('0x26')](handleEntityNotFound(_0x54eb4a,null))['then'](function(){_0x5307f4[_0x9308('0x56')](_0x2b6ed2[_0x9308('0x48')]['id']);})[_0x9308('0x26')](respondWithStatusCode(_0x54eb4a,null))[_0x9308('0x54')](handleError(_0x54eb4a,null));}; \ No newline at end of file +var _0xaaa3=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','pick','filter','where','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','length','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','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xaaa3,0x145));var _0x3aaa=function(_0x379557,_0x5ab49){_0x379557=_0x379557-0x0;var _0x441372=_0xaaa3[_0x379557];return _0x441372;};'use strict';var emlformat=require(_0x3aaa('0x0'));var rimraf=require(_0x3aaa('0x1'));var zipdir=require(_0x3aaa('0x2'));var jsonpatch=require(_0x3aaa('0x3'));var rp=require(_0x3aaa('0x4'));var moment=require(_0x3aaa('0x5'));var BPromise=require(_0x3aaa('0x6'));var Mustache=require(_0x3aaa('0x7'));var util=require(_0x3aaa('0x8'));var path=require(_0x3aaa('0x9'));var sox=require(_0x3aaa('0xa'));var csv=require(_0x3aaa('0xb'));var ejs=require(_0x3aaa('0xc'));var fs=require('fs');var fs_extra=require(_0x3aaa('0xd'));var _=require(_0x3aaa('0xe'));var squel=require('squel');var crypto=require(_0x3aaa('0xf'));var jsforce=require(_0x3aaa('0x10'));var deskjs=require(_0x3aaa('0x11'));var toCsv=require(_0x3aaa('0xb'));var querystring=require('querystring');var Papa=require(_0x3aaa('0x12'));var Redis=require(_0x3aaa('0x13'));var authService=require(_0x3aaa('0x14'));var qs=require(_0x3aaa('0x15'));var as=require(_0x3aaa('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3aaa('0x17'));var config=require(_0x3aaa('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426940,_0x40704e){_0x40704e=_0x40704e||0xcc;return function(_0x10c17d){if(_0x10c17d){return _0x426940[_0x3aaa('0x19')](_0x40704e);}return _0x426940[_0x3aaa('0x1a')](_0x40704e)[_0x3aaa('0x1b')]();};}function respondWithResult(_0x3582ab,_0x2eaaa5){_0x2eaaa5=_0x2eaaa5||0xc8;return function(_0x471d23){if(_0x471d23){return _0x3582ab[_0x3aaa('0x1a')](_0x2eaaa5)[_0x3aaa('0x1c')](_0x471d23);}};}function respondWithFilteredResult(_0x579b88,_0x284129){return function(_0x3dca1a){if(_0x3dca1a){var _0x547dc7=typeof _0x284129[_0x3aaa('0x1d')]===_0x3aaa('0x1e')&&typeof _0x284129[_0x3aaa('0x1f')]===_0x3aaa('0x1e');var _0x58e285=_0x3dca1a[_0x3aaa('0x20')];var _0x375dc0=_0x547dc7?0x0:_0x284129[_0x3aaa('0x1d')];var _0x3c8117=_0x547dc7?_0x3dca1a[_0x3aaa('0x20')]:_0x284129[_0x3aaa('0x1d')]+_0x284129[_0x3aaa('0x1f')];var _0x5b344d;if(_0x3c8117>=_0x58e285){_0x3c8117=_0x58e285;_0x5b344d=0xc8;}else{_0x5b344d=0xce;}_0x579b88['status'](_0x5b344d);return _0x579b88[_0x3aaa('0x21')](_0x3aaa('0x22'),_0x375dc0+'-'+_0x3c8117+'/'+_0x58e285)['json'](_0x3dca1a);}return null;};}function patchUpdates(_0x2a6cdd){return function(_0x3ee229){try{jsonpatch[_0x3aaa('0x23')](_0x3ee229,_0x2a6cdd,!![]);}catch(_0x449390){return BPromise[_0x3aaa('0x24')](_0x449390);}return _0x3ee229['save']();};}function saveUpdates(_0x231c7d,_0x1a8ee1){return function(_0x23154e){if(_0x23154e){return _0x23154e[_0x3aaa('0x25')](_0x231c7d)[_0x3aaa('0x26')](function(_0x2be360){return _0x2be360;});}return null;};}function removeEntity(_0xec7fb9,_0x17a4b9){return function(_0x5d6685){if(_0x5d6685){return _0x5d6685[_0x3aaa('0x27')]()['then'](function(){var _0x212794=_0x5d6685[_0x3aaa('0x28')]({'plain':!![]});var _0x17f9a6=_0x3aaa('0x29');return db['UserProfileResource'][_0x3aaa('0x27')]({'where':{'type':_0x17f9a6,'resourceId':_0x212794['id']}})[_0x3aaa('0x26')](function(){return _0x5d6685;});})[_0x3aaa('0x26')](function(){_0xec7fb9[_0x3aaa('0x1a')](0xcc)[_0x3aaa('0x1b')]();});}};}function handleEntityNotFound(_0x46a304,_0x2dbb2a){return function(_0x220696){if(!_0x220696){_0x46a304[_0x3aaa('0x19')](0x194);}return _0x220696;};}function handleError(_0x38d18b,_0x3b0bd1){_0x3b0bd1=_0x3b0bd1||0x1f4;return function(_0x14376b){logger['error'](_0x14376b[_0x3aaa('0x2a')]);if(_0x14376b[_0x3aaa('0x2b')]){delete _0x14376b['name'];}_0x38d18b['status'](_0x3b0bd1)['send'](_0x14376b);};}exports[_0x3aaa('0x2c')]=function(_0x120727,_0x161571){var _0x3ab0dd={},_0x1f73d4={},_0x587453={'count':0x0,'rows':[]};var _0x412678=_[_0x3aaa('0x2d')](db['Schedule']['rawAttributes'],function(_0xd2ffad){return{'name':_0xd2ffad[_0x3aaa('0x2e')],'type':_0xd2ffad[_0x3aaa('0x2f')][_0x3aaa('0x30')]};});_0x1f73d4[_0x3aaa('0x31')]=_[_0x3aaa('0x2d')](_0x412678,'name');_0x1f73d4[_0x3aaa('0x32')]=_[_0x3aaa('0x33')](_0x120727[_0x3aaa('0x32')]);_0x1f73d4[_0x3aaa('0x34')]=_['intersection'](_0x1f73d4['model'],_0x1f73d4[_0x3aaa('0x32')]);_0x3ab0dd[_0x3aaa('0x35')]=_[_0x3aaa('0x36')](_0x1f73d4[_0x3aaa('0x31')],qs[_0x3aaa('0x37')](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x37')]));_0x3ab0dd[_0x3aaa('0x35')]=_0x3ab0dd[_0x3aaa('0x35')]['length']?_0x3ab0dd[_0x3aaa('0x35')]:_0x1f73d4[_0x3aaa('0x31')];if(!_0x120727[_0x3aaa('0x32')][_0x3aaa('0x38')]('nolimit')){_0x3ab0dd[_0x3aaa('0x1f')]=qs[_0x3aaa('0x1f')](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x1f')]);_0x3ab0dd[_0x3aaa('0x1d')]=qs['offset'](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x1d')]);}_0x3ab0dd['order']=qs['sort'](_0x120727[_0x3aaa('0x32')]['sort']);_0x3ab0dd['where']=qs[_0x3aaa('0x34')](_[_0x3aaa('0x39')](_0x120727['query'],_0x1f73d4[_0x3aaa('0x34')]),_0x412678);if(_0x120727[_0x3aaa('0x32')][_0x3aaa('0x3a')]){_0x3ab0dd[_0x3aaa('0x3b')]=_[_0x3aaa('0x3c')](_0x3ab0dd['where'],{'$or':_[_0x3aaa('0x2d')](_0x412678,function(_0x3d39f0){if(_0x3d39f0[_0x3aaa('0x2f')]!==_0x3aaa('0x3d')){var _0x5dd61c={};_0x5dd61c[_0x3d39f0[_0x3aaa('0x2b')]]={'$like':'%'+_0x120727[_0x3aaa('0x32')]['filter']+'%'};return _0x5dd61c;}})});}_0x3ab0dd=_[_0x3aaa('0x3c')]({},_0x3ab0dd,_0x120727[_0x3aaa('0x3e')]);var _0x33abc0={'where':_0x3ab0dd['where']};return db[_0x3aaa('0x3f')][_0x3aaa('0x20')](_0x33abc0)[_0x3aaa('0x26')](function(_0x5b0352){_0x587453[_0x3aaa('0x20')]=_0x5b0352;if(_0x120727[_0x3aaa('0x32')][_0x3aaa('0x40')]){_0x3ab0dd[_0x3aaa('0x41')]=[{'all':!![]}];}return db['Schedule'][_0x3aaa('0x42')](_0x3ab0dd);})['then'](function(_0x10749a){_0x587453['rows']=_0x10749a;return _0x587453;})[_0x3aaa('0x26')](respondWithFilteredResult(_0x161571,_0x3ab0dd))[_0x3aaa('0x43')](handleError(_0x161571,null));};exports['show']=function(_0x309ab0,_0x3786ce){var _0x70912a={'raw':![],'where':{'id':_0x309ab0['params']['id']}},_0x5ccc8b={};_0x5ccc8b['model']=_[_0x3aaa('0x33')](db[_0x3aaa('0x3f')]['rawAttributes']);_0x5ccc8b['query']=_[_0x3aaa('0x33')](_0x309ab0['query']);_0x5ccc8b[_0x3aaa('0x34')]=_[_0x3aaa('0x36')](_0x5ccc8b['model'],_0x5ccc8b[_0x3aaa('0x32')]);_0x70912a[_0x3aaa('0x35')]=_[_0x3aaa('0x36')](_0x5ccc8b[_0x3aaa('0x31')],qs[_0x3aaa('0x37')](_0x309ab0[_0x3aaa('0x32')][_0x3aaa('0x37')]));_0x70912a[_0x3aaa('0x35')]=_0x70912a[_0x3aaa('0x35')][_0x3aaa('0x44')]?_0x70912a[_0x3aaa('0x35')]:_0x5ccc8b['model'];if(_0x309ab0[_0x3aaa('0x32')][_0x3aaa('0x40')]){_0x70912a[_0x3aaa('0x41')]=[{'all':!![]}];}_0x70912a=_[_0x3aaa('0x3c')]({},_0x70912a,_0x309ab0['options']);return db[_0x3aaa('0x3f')]['find'](_0x70912a)['then'](handleEntityNotFound(_0x3786ce,null))[_0x3aaa('0x26')](respondWithResult(_0x3786ce,null))[_0x3aaa('0x43')](handleError(_0x3786ce,null));};exports[_0x3aaa('0x45')]=function(_0x536ba4,_0x3f5642){return db[_0x3aaa('0x3f')][_0x3aaa('0x45')](_0x536ba4[_0x3aaa('0x46')],{})[_0x3aaa('0x26')](function(_0x3f13ec){var _0x267081=_0x536ba4[_0x3aaa('0x47')][_0x3aaa('0x28')]({'plain':!![]});if(!_0x267081)throw new Error(_0x3aaa('0x48'));if(_0x267081[_0x3aaa('0x49')]===_0x3aaa('0x47')){var _0x34429f=_0x3f13ec[_0x3aaa('0x28')]({'plain':!![]});var _0x35dedf=_0x3aaa('0x29');return db['UserProfileSection'][_0x3aaa('0x4a')]({'where':{'name':_0x35dedf,'userProfileId':_0x267081[_0x3aaa('0x4b')]},'raw':!![]})[_0x3aaa('0x26')](function(_0xbe266d){if(_0xbe266d&&_0xbe266d[_0x3aaa('0x4c')]===0x0){return db[_0x3aaa('0x4d')][_0x3aaa('0x45')]({'name':_0x34429f[_0x3aaa('0x2b')],'resourceId':_0x34429f['id'],'type':_0xbe266d[_0x3aaa('0x2b')],'sectionId':_0xbe266d['id']},{})[_0x3aaa('0x26')](function(){return _0x3f13ec;});}else{return _0x3f13ec;}})[_0x3aaa('0x43')](function(_0x475d60){logger[_0x3aaa('0x4e')](_0x3aaa('0x4f'),_0x475d60);throw _0x475d60;});}return _0x3f13ec;})[_0x3aaa('0x26')](respondWithResult(_0x3f5642,0xc9))[_0x3aaa('0x43')](handleError(_0x3f5642,null));};exports[_0x3aaa('0x25')]=function(_0x560112,_0x5263ff){if(_0x560112[_0x3aaa('0x46')]['id']){delete _0x560112['body']['id'];}return db[_0x3aaa('0x3f')][_0x3aaa('0x4a')]({'where':{'id':_0x560112[_0x3aaa('0x50')]['id']}})[_0x3aaa('0x26')](handleEntityNotFound(_0x5263ff,null))['then'](saveUpdates(_0x560112['body'],null))['then'](respondWithResult(_0x5263ff,null))['catch'](handleError(_0x5263ff,null));};exports['destroy']=function(_0x28d826,_0x33a3ce){return db['Schedule'][_0x3aaa('0x4a')]({'where':{'id':_0x28d826[_0x3aaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x33a3ce,null))[_0x3aaa('0x26')](removeEntity(_0x33a3ce,null))['catch'](handleError(_0x33a3ce,null));};exports[_0x3aaa('0x51')]=function(_0x92caf8,_0x1e99aa,_0x562c6c){var _0x92b024=require(_0x3aaa('0x52'));return db[_0x3aaa('0x3f')][_0x3aaa('0x4a')]({'where':{'id':_0x92caf8[_0x3aaa('0x50')]['id']},'raw':!![]})[_0x3aaa('0x26')](handleEntityNotFound(_0x1e99aa,null))[_0x3aaa('0x26')](function(){_0x92b024[_0x3aaa('0x51')](_0x92caf8['params']['id']);})[_0x3aaa('0x26')](respondWithStatusCode(_0x1e99aa,null))[_0x3aaa('0x43')](handleError(_0x1e99aa,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 83434fb..8c7d319 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 _0x2a31=['../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0x2a31,0x131));var _0x12a3=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x2a31[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var logger=require(_0x12a3('0x2'))(_0x12a3('0x3'));var moment=require(_0x12a3('0x4'));var BPromise=require('bluebird');var rp=require(_0x12a3('0x5'));var fs=require('fs');var path=require(_0x12a3('0x6'));var rimraf=require('rimraf');var config=require(_0x12a3('0x7'));var attributes=require(_0x12a3('0x8'));module['exports']=function(_0x130546,_0x425023){return _0x130546[_0x12a3('0x9')](_0x12a3('0xa'),attributes,{'tableName':_0x12a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf4b=['moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash','../../config/logger','api'];(function(_0x5251dd,_0xc0f589){var _0x4d8295=function(_0x3d51df){while(--_0x3d51df){_0x5251dd['push'](_0x5251dd['shift']());}};_0x4d8295(++_0xc0f589);}(_0xbf4b,0x17e));var _0xbbf4=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0xbf4b[_0x348fec];return _0x5914c7;};'use strict';var _=require(_0xbbf4('0x0'));var util=require('util');var logger=require(_0xbbf4('0x1'))(_0xbbf4('0x2'));var moment=require(_0xbbf4('0x3'));var BPromise=require(_0xbbf4('0x4'));var rp=require(_0xbbf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbf4('0x6'));var config=require(_0xbbf4('0x7'));var attributes=require(_0xbbf4('0x8'));module[_0xbbf4('0x9')]=function(_0x572df9,_0x1c6913){return _0x572df9['define']('Schedule',attributes,{'tableName':_0xbbf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 2403581..b0939b2 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 _0x2ab1=['error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x3e7cc4,_0x5cea91){var _0x1640cf=function(_0x23b7d1){while(--_0x23b7d1){_0x3e7cc4['push'](_0x3e7cc4['shift']());}};_0x1640cf(++_0x5cea91);}(_0x2ab1,0xde));var _0x12ab=function(_0x3f00f0,_0x4130b7){_0x3f00f0=_0x3f00f0-0x0;var _0x2d671d=_0x2ab1[_0x3f00f0];return _0x2d671d;};'use strict';var _=require(_0x12ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12ab('0x1'));var rs=require(_0x12ab('0x2'));var fs=require('fs');var Redis=require(_0x12ab('0x3'));var db=require(_0x12ab('0x4'))['db'];var utils=require(_0x12ab('0x5'));var logger=require(_0x12ab('0x6'))(_0x12ab('0x7'));var config=require(_0x12ab('0x8'));var jayson=require(_0x12ab('0x9'));var client=jayson[_0x12ab('0xa')][_0x12ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6dad28,_0x197a51,_0x223422){return new BPromise(function(_0x3177e1,_0x1f4f60){return client[_0x12ab('0xc')](_0x6dad28,_0x223422)[_0x12ab('0xd')](function(_0x493350){logger[_0x12ab('0xe')]('Schedule,\x20%s,\x20%s',_0x197a51,_0x12ab('0xf'));logger[_0x12ab('0x10')](_0x12ab('0x11'),_0x197a51,_0x12ab('0xf'),JSON['stringify'](_0x493350));if(_0x493350[_0x12ab('0x12')]){if(_0x493350[_0x12ab('0x12')][_0x12ab('0x13')]===0x1f4){logger[_0x12ab('0x12')](_0x12ab('0x14'),_0x197a51,_0x493350['error'][_0x12ab('0x15')]);return _0x1f4f60(_0x493350[_0x12ab('0x12')]['message']);}logger['error'](_0x12ab('0x14'),_0x197a51,_0x493350[_0x12ab('0x12')]['message']);return _0x3177e1(_0x493350[_0x12ab('0x12')][_0x12ab('0x15')]);}else{logger['info'](_0x12ab('0x14'),_0x197a51,_0x12ab('0xf'));_0x3177e1(_0x493350[_0x12ab('0x16')]['message']);}})[_0x12ab('0x17')](function(_0x4572cf){logger[_0x12ab('0x12')](_0x12ab('0x14'),_0x197a51,_0x4572cf);_0x1f4f60(_0x4572cf);});});} \ No newline at end of file +var _0xe08b=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e0d64,_0x130b92){var _0x3dab88=function(_0x161dd1){while(--_0x161dd1){_0x1e0d64['push'](_0x1e0d64['shift']());}};_0x3dab88(++_0x130b92);}(_0xe08b,0xab));var _0xbe08=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xe08b[_0x12a2a6];return _0x1754ae;};'use strict';var _=require('lodash');var util=require(_0xbe08('0x0'));var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require(_0xbe08('0x3'));var fs=require('fs');var Redis=require(_0xbe08('0x4'));var db=require(_0xbe08('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c55dc,_0x466910,_0x2ce9a5){return new BPromise(function(_0xe141b3,_0x42e1b1){return client[_0xbe08('0xc')](_0x2c55dc,_0x2ce9a5)[_0xbe08('0xd')](function(_0x3822eb){logger['info'](_0xbe08('0xe'),_0x466910,_0xbe08('0xf'));logger[_0xbe08('0x10')](_0xbe08('0x11'),_0x466910,_0xbe08('0xf'),JSON[_0xbe08('0x12')](_0x3822eb));if(_0x3822eb['error']){if(_0x3822eb[_0xbe08('0x13')][_0xbe08('0x14')]===0x1f4){logger[_0xbe08('0x13')](_0xbe08('0xe'),_0x466910,_0x3822eb[_0xbe08('0x13')][_0xbe08('0x15')]);return _0x42e1b1(_0x3822eb[_0xbe08('0x13')][_0xbe08('0x15')]);}logger[_0xbe08('0x13')]('Schedule,\x20%s,\x20%s',_0x466910,_0x3822eb[_0xbe08('0x13')]['message']);return _0xe141b3(_0x3822eb['error']['message']);}else{logger[_0xbe08('0x16')]('Schedule,\x20%s,\x20%s',_0x466910,'request\x20sent');_0xe141b3(_0x3822eb['result'][_0xbe08('0x15')]);}})[_0xbe08('0x17')](function(_0x394555){logger[_0xbe08('0x13')](_0xbe08('0xe'),_0x466910,_0x394555);_0x42e1b1(_0x394555);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index dcf6862..0d3b3e7 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 _0xbb66=['index','isAuthenticated','describe','show','/:id/download','post','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get'];(function(_0xd25857,_0x50a82a){var _0x4f5131=function(_0xcababe){while(--_0xcababe){_0xd25857['push'](_0xd25857['shift']());}};_0x4f5131(++_0x50a82a);}(_0xbb66,0xbf));var _0x6bb6=function(_0x576d1d,_0x44b457){_0x576d1d=_0x576d1d-0x0;var _0x56ad86=_0xbb66[_0x576d1d];return _0x56ad86;};'use strict';var multer=require(_0x6bb6('0x0'));var util=require(_0x6bb6('0x1'));var path=require(_0x6bb6('0x2'));var timeout=require(_0x6bb6('0x3'));var express=require('express');var router=express[_0x6bb6('0x4')]();var fs_extra=require(_0x6bb6('0x5'));var auth=require(_0x6bb6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6bb6('0x7'));router[_0x6bb6('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bb6('0x9')]);router[_0x6bb6('0x8')]('/describe',auth[_0x6bb6('0xa')](),controller[_0x6bb6('0xb')]);router['get']('/:id',auth[_0x6bb6('0xa')](),controller[_0x6bb6('0xc')]);router['get'](_0x6bb6('0xd'),auth[_0x6bb6('0xa')](),controller['download']);router[_0x6bb6('0xe')]('/',auth[_0x6bb6('0xa')](),controller['create']);router[_0x6bb6('0xf')]('/:id',auth[_0x6bb6('0xa')](),controller[_0x6bb6('0x10')]);router['delete'](_0x6bb6('0x11'),auth[_0x6bb6('0xa')](),controller[_0x6bb6('0x12')]);module[_0x6bb6('0x13')]=router; \ No newline at end of file +var _0xb879=['../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaf2173,_0x54fa84){var _0x3c1d14=function(_0x5dbefe){while(--_0x5dbefe){_0xaf2173['push'](_0xaf2173['shift']());}};_0x3c1d14(++_0x54fa84);}(_0xb879,0x158));var _0x9b87=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb879[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x9b87('0x0'));var util=require(_0x9b87('0x1'));var path=require(_0x9b87('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b87('0x3'));var router=express[_0x9b87('0x4')]();var fs_extra=require(_0x9b87('0x5'));var auth=require(_0x9b87('0x6'));var interaction=require(_0x9b87('0x7'));var config=require(_0x9b87('0x8'));var controller=require('./screenRecording.controller');router[_0x9b87('0x9')]('/',auth[_0x9b87('0xa')](),controller['index']);router[_0x9b87('0x9')]('/describe',auth[_0x9b87('0xa')](),controller[_0x9b87('0xb')]);router[_0x9b87('0x9')](_0x9b87('0xc'),auth['isAuthenticated'](),controller[_0x9b87('0xd')]);router[_0x9b87('0x9')](_0x9b87('0xe'),auth[_0x9b87('0xa')](),controller[_0x9b87('0xf')]);router['post']('/',auth[_0x9b87('0xa')](),controller[_0x9b87('0x10')]);router[_0x9b87('0x11')](_0x9b87('0xc'),auth[_0x9b87('0xa')](),controller[_0x9b87('0x12')]);router[_0x9b87('0x13')](_0x9b87('0xc'),auth[_0x9b87('0xa')](),controller[_0x9b87('0x14')]);module[_0x9b87('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 8e40bd3..3f8b1a4 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 _0x11c8=['subtract','duration','DATE','startedAt','toString','closedAt','createdAt','format','MM-DD-YYYY\x20HH:mm','updatedAt','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x11c8,0x19a));var _0x811c=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0x11c8[_0x67c7e2];return _0x52b665;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x811c('0x0'));var path=require(_0x811c('0x1'));var config=require('../../config/environment');module[_0x811c('0x2')]={'format':{'type':Sequelize[_0x811c('0x3')],'get':function(){return this[_0x811c('0x4')](_0x811c('0x5'))?path[_0x811c('0x6')](this[_0x811c('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x811c('0x7')]},'channel':{'type':Sequelize[_0x811c('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x126cc2){var _0x8af784=_0x126cc2[_0x811c('0x8')](/\\/g,'/');this[_0x811c('0x9')]('value',_0x8af784);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5be7fc){this['setDataValue']('startedAt',moment()[_0x811c('0xa')](_0x5be7fc,'ms'));this[_0x811c('0x9')]('closedAt',moment());this[_0x811c('0x9')](_0x811c('0xb'),_0x5be7fc);}},'startedAt':{'type':Sequelize[_0x811c('0xc')],'get':function(){return moment(this[_0x811c('0x4')](_0x811c('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x811c('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x811c('0x4')](_0x811c('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x811c('0xe')]();}},'createdAt':{'type':Sequelize[_0x811c('0xc')],'get':function(){return moment(this[_0x811c('0x4')](_0x811c('0x10')))[_0x811c('0x11')](_0x811c('0x12'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x811c('0x4')](_0x811c('0x13')))[_0x811c('0x11')](_0x811c('0x12'))[_0x811c('0xe')]();}}}; \ No newline at end of file +var _0x8861=['subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue'];(function(_0x2448d0,_0x31838c){var _0x555642=function(_0x154717){while(--_0x154717){_0x2448d0['push'](_0x2448d0['shift']());}};_0x555642(++_0x31838c);}(_0x8861,0x6d));var _0x1886=function(_0xaaf822,_0x2c26a7){_0xaaf822=_0xaaf822-0x0;var _0x508570=_0x8861[_0xaaf822];return _0x508570;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x1886('0x0'));var config=require(_0x1886('0x1'));module[_0x1886('0x2')]={'format':{'type':Sequelize[_0x1886('0x3')],'get':function(){return this[_0x1886('0x4')](_0x1886('0x5'))?path[_0x1886('0x6')](this[_0x1886('0x4')](_0x1886('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x1886('0x7')]},'channel':{'type':Sequelize[_0x1886('0x7')]},'value':{'type':Sequelize[_0x1886('0x7')],'set':function(_0x39e8fd){var _0x43e483=_0x39e8fd[_0x1886('0x8')](/\\/g,'/');this['setDataValue'](_0x1886('0x5'),_0x43e483);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1886('0x9')],'set':function(_0x489fed){this[_0x1886('0xa')]('startedAt',moment()[_0x1886('0xb')](_0x489fed,'ms'));this[_0x1886('0xa')](_0x1886('0xc'),moment());this[_0x1886('0xa')](_0x1886('0xd'),_0x489fed);}},'startedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this['getDataValue'](_0x1886('0xf')))[_0x1886('0x10')](_0x1886('0x11'))[_0x1886('0x12')]();}},'closedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this[_0x1886('0x4')]('closedAt'))['format'](_0x1886('0x11'))[_0x1886('0x12')]();}},'createdAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this['getDataValue'](_0x1886('0x13')))[_0x1886('0x10')](_0x1886('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this[_0x1886('0x4')]('updatedAt'))[_0x1886('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x1886('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 22b0fde..7aa931f 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 _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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'];(function(_0x56eaf0,_0x437314){var _0x31399e=function(_0x3f2e58){while(--_0x3f2e58){_0x56eaf0['push'](_0x56eaf0['shift']());}};_0x31399e(++_0x437314);}(_0x98a8,0x12c));var _0x898a=function(_0x382972,_0x496a61){_0x382972=_0x382972-0x0;var _0x1b4d3a=_0x98a8[_0x382972];return _0x1b4d3a;};'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'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file +var _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xa630,0xbe));var _0x0a63=function(_0x373b36,_0x3bc444){_0x373b36=_0x373b36-0x0;var _0x3f8649=_0xa630[_0x373b36];return _0x3f8649;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3317057..bbfa173 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 _0xa888=['moment','bluebird','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa888,0x11a));var _0x8a88=function(_0x25b51d,_0x4a6600){_0x25b51d=_0x25b51d-0x0;var _0x3eeb68=_0xa888[_0x25b51d];return _0x3eeb68;};'use strict';var _=require(_0x8a88('0x0'));var util=require(_0x8a88('0x1'));var logger=require(_0x8a88('0x2'))(_0x8a88('0x3'));var moment=require(_0x8a88('0x4'));var BPromise=require(_0x8a88('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8a88('0x6'));var attributes=require(_0x8a88('0x7'));module[_0x8a88('0x8')]=function(_0x1b35a1,_0x160885){return _0x1b35a1['define']('ScreenRecording',attributes,{'tableName':_0x8a88('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x8a88('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8899=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x4a99a6,_0x5a7dad){var _0x5b1a07=function(_0x7ab9e7){while(--_0x7ab9e7){_0x4a99a6['push'](_0x4a99a6['shift']());}};_0x5b1a07(++_0x5a7dad);}(_0x8899,0x1a8));var _0x9889=function(_0x5dd347,_0x49ef2c){_0x5dd347=_0x5dd347-0x0;var _0xf097e5=_0x8899[_0x5dd347];return _0xf097e5;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require(_0x9889('0x2'))(_0x9889('0x3'));var moment=require(_0x9889('0x4'));var BPromise=require(_0x9889('0x5'));var rp=require(_0x9889('0x6'));var fs=require('fs');var path=require(_0x9889('0x7'));var rimraf=require(_0x9889('0x8'));var config=require('../../config/environment');var attributes=require(_0x9889('0x9'));module[_0x9889('0xa')]=function(_0x1613f3,_0x8babf9){return _0x1613f3['define']('ScreenRecording',attributes,{'tableName':_0x9889('0xb'),'paranoid':![],'indexes':[{'name':_0x9889('0xc'),'fields':[_0x9889('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9d635f1..d892731 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 _0x0826=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5f55b2,_0x670200){var _0xa0ddd1=function(_0x52f60d){while(--_0x52f60d){_0x5f55b2['push'](_0x5f55b2['shift']());}};_0xa0ddd1(++_0x670200);}(_0x0826,0x1b4));var _0x6082=function(_0x33c822,_0x175fcb){_0x33c822=_0x33c822-0x0;var _0x4ed00c=_0x0826[_0x33c822];return _0x4ed00c;};'use strict';var _=require(_0x6082('0x0'));var util=require('util');var moment=require(_0x6082('0x1'));var BPromise=require(_0x6082('0x2'));var rs=require(_0x6082('0x3'));var fs=require('fs');var Redis=require(_0x6082('0x4'));var db=require(_0x6082('0x5'))['db'];var utils=require(_0x6082('0x6'));var logger=require(_0x6082('0x7'))(_0x6082('0x8'));var config=require('../../config/environment');var jayson=require(_0x6082('0x9'));var client=jayson['client'][_0x6082('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498e09,_0xb0539d,_0x21d3ea){return new BPromise(function(_0x3385e0,_0x25797a){return client[_0x6082('0xb')](_0x498e09,_0x21d3ea)[_0x6082('0xc')](function(_0x331157){logger['info'](_0x6082('0xd'),_0xb0539d,_0x6082('0xe'));logger[_0x6082('0xf')](_0x6082('0x10'),_0xb0539d,_0x6082('0xe'),JSON['stringify'](_0x331157));if(_0x331157[_0x6082('0x11')]){if(_0x331157[_0x6082('0x11')][_0x6082('0x12')]===0x1f4){logger[_0x6082('0x11')]('ScreenRecording,\x20%s,\x20%s',_0xb0539d,_0x331157[_0x6082('0x11')]['message']);return _0x25797a(_0x331157[_0x6082('0x11')]['message']);}logger[_0x6082('0x11')]('ScreenRecording,\x20%s,\x20%s',_0xb0539d,_0x331157[_0x6082('0x11')][_0x6082('0x13')]);return _0x3385e0(_0x331157[_0x6082('0x11')][_0x6082('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0xb0539d,_0x6082('0xe'));_0x3385e0(_0x331157[_0x6082('0x14')][_0x6082('0x13')]);}})['catch'](function(_0x8d864b){logger[_0x6082('0x11')]('ScreenRecording,\x20%s,\x20%s',_0xb0539d,_0x8d864b);_0x25797a(_0x8d864b);});});} \ No newline at end of file +var _0x3528=['jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x321553,_0x5c0cb5){var _0x2c770b=function(_0x12e998){while(--_0x12e998){_0x321553['push'](_0x321553['shift']());}};_0x2c770b(++_0x5c0cb5);}(_0x3528,0x143));var _0x8352=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3528[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8352('0x0'));var moment=require(_0x8352('0x1'));var BPromise=require(_0x8352('0x2'));var rs=require(_0x8352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8352('0x4'))['db'];var utils=require(_0x8352('0x5'));var logger=require('../../config/logger')(_0x8352('0x6'));var config=require('../../config/environment');var jayson=require(_0x8352('0x7'));var client=jayson[_0x8352('0x8')][_0x8352('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x484e51,_0x201b15,_0x28b87b){return new BPromise(function(_0x1817a1,_0x31b6ff){return client[_0x8352('0xa')](_0x484e51,_0x28b87b)[_0x8352('0xb')](function(_0x37bb03){logger[_0x8352('0xc')](_0x8352('0xd'),_0x201b15,_0x8352('0xe'));logger[_0x8352('0xf')](_0x8352('0x10'),_0x201b15,_0x8352('0xe'),JSON[_0x8352('0x11')](_0x37bb03));if(_0x37bb03[_0x8352('0x12')]){if(_0x37bb03[_0x8352('0x12')][_0x8352('0x13')]===0x1f4){logger['error'](_0x8352('0xd'),_0x201b15,_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);return _0x31b6ff(_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);}logger[_0x8352('0x12')](_0x8352('0xd'),_0x201b15,_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);return _0x1817a1(_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);}else{logger[_0x8352('0xc')](_0x8352('0xd'),_0x201b15,_0x8352('0xe'));_0x1817a1(_0x37bb03['result'][_0x8352('0x14')]);}})[_0x8352('0x15')](function(_0x3a253f){logger[_0x8352('0x12')](_0x8352('0xd'),_0x201b15,_0x3a253f);_0x31b6ff(_0x3a253f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 208e1f1..a2e4125 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 _0xfbde=['root','logologin','extname','addPreferred','favicon','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','index','get','getDate','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','join'];(function(_0x51c4f9,_0x34b3ba){var _0x49d693=function(_0xe367c1){while(--_0xe367c1){_0x51c4f9['push'](_0x51c4f9['shift']());}};_0x49d693(++_0x34b3ba);}(_0xfbde,0xb2));var _0xefbd=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xfbde[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0xefbd('0x0'));var util=require(_0xefbd('0x1'));var path=require(_0xefbd('0x2'));var timeout=require(_0xefbd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefbd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xefbd('0x5'));var config=require(_0xefbd('0x6'));var controller=require(_0xefbd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xefbd('0x8')]);router[_0xefbd('0x9')]('/now',controller[_0xefbd('0xa')]);router[_0xefbd('0x9')]('/:id',controller[_0xefbd('0xb')]);router[_0xefbd('0x9')]('/:id/logo',controller[_0xefbd('0xc')]);router['get'](_0xefbd('0xd'),controller[_0xefbd('0xe')]);router['get']('/:id/gdpr',controller[_0xefbd('0xf')]);router[_0xefbd('0x9')](_0xefbd('0x10'),controller[_0xefbd('0x11')]);router[_0xefbd('0x9')](_0xefbd('0x12'),controller[_0xefbd('0x13')]);var upload=multer({'storage':multer[_0xefbd('0x14')]({'destination':function(_0xde5f50,_0x4ae9c1,_0x15e0cc){_0x15e0cc(null,path['join'](config['root'],_0xefbd('0x15')));},'filename':function(_0x34eed7,_0x924e58,_0x55bdd3){_0x55bdd3(null,util[_0xefbd('0x16')](_0xefbd('0x17'),_0xefbd('0x18'),path['extname'](_0x924e58[_0xefbd('0x19')])));}})});router[_0xefbd('0x1a')](_0xefbd('0x1b'),upload[_0xefbd('0x1c')](_0xefbd('0x1d')),controller[_0xefbd('0x1e')]);var upload=multer({'storage':multer[_0xefbd('0x14')]({'destination':function(_0xf12a42,_0x404a01,_0x28f4d1){_0x28f4d1(null,path[_0xefbd('0x1f')](config[_0xefbd('0x20')],_0xefbd('0x15')));},'filename':function(_0x43b1a7,_0xeb8c06,_0x511399){_0x511399(null,util[_0xefbd('0x16')](_0xefbd('0x17'),_0xefbd('0x21'),path[_0xefbd('0x22')](_0xeb8c06[_0xefbd('0x19')])));}})});router[_0xefbd('0x1a')](_0xefbd('0xd'),upload[_0xefbd('0x1c')](_0xefbd('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa8dd98,_0x2b58c8,_0x41925e){_0x41925e(null,path['join'](config[_0xefbd('0x20')],_0xefbd('0x15')));},'filename':function(_0x42b80f,_0x235ad8,_0x1fd111){_0x1fd111(null,util[_0xefbd('0x16')]('%s%s','preferred',path['extname'](_0x235ad8['originalname'])));}})});router['post'](_0xefbd('0x10'),upload[_0xefbd('0x1c')]('file'),controller[_0xefbd('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x414e01,_0x256195,_0x541e24){_0x541e24(null,path[_0xefbd('0x1f')](config['root'],_0xefbd('0x15')));},'filename':function(_0x532eed,_0x43cb65,_0x1aa4a9){_0x1aa4a9(null,util['format'](_0xefbd('0x17'),_0xefbd('0x24'),path[_0xefbd('0x22')](_0x43cb65[_0xefbd('0x19')])));}})});router[_0xefbd('0x1a')](_0xefbd('0x12'),upload[_0xefbd('0x1c')](_0xefbd('0x1d')),controller['addFavicon']);router[_0xefbd('0x25')](_0xefbd('0x26'),auth[_0xefbd('0x27')](),controller[_0xefbd('0x28')]);module[_0xefbd('0x29')]=router; \ No newline at end of file +var _0x5316=['index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','logologin','originalname','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated'];(function(_0x5e64bb,_0x1abf81){var _0x32cd6c=function(_0x22e596){while(--_0x22e596){_0x5e64bb['push'](_0x5e64bb['shift']());}};_0x32cd6c(++_0x1abf81);}(_0x5316,0xe6));var _0x6531=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x5316[_0xb65ffb];return _0x58f55c;};'use strict';var multer=require(_0x6531('0x0'));var util=require('util');var path=require(_0x6531('0x1'));var timeout=require(_0x6531('0x2'));var express=require(_0x6531('0x3'));var router=express['Router']();var fs_extra=require(_0x6531('0x4'));var auth=require(_0x6531('0x5'));var interaction=require(_0x6531('0x6'));var config=require('../../config/environment');var controller=require(_0x6531('0x7'));router[_0x6531('0x8')]('/',auth[_0x6531('0x9')](),controller[_0x6531('0xa')]);router[_0x6531('0x8')](_0x6531('0xb'),controller['getDate']);router['get'](_0x6531('0xc'),controller[_0x6531('0xd')]);router[_0x6531('0x8')](_0x6531('0xe'),controller['getLogo']);router[_0x6531('0x8')](_0x6531('0xf'),controller[_0x6531('0x10')]);router['get'](_0x6531('0x11'),controller['gdpr']);router[_0x6531('0x8')](_0x6531('0x12'),controller['getPreferred']);router[_0x6531('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x6531('0x13')]({'destination':function(_0x116176,_0x304926,_0x678263){_0x678263(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x2a8f6f,_0x54718a,_0x5d3dc3){_0x5d3dc3(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x19'),path[_0x6531('0x1a')](_0x54718a['originalname'])));}})});router[_0x6531('0x1b')]('/:id/logo',upload[_0x6531('0x1c')](_0x6531('0x1d')),controller[_0x6531('0x1e')]);var upload=multer({'storage':multer[_0x6531('0x13')]({'destination':function(_0x153c6f,_0x37d5d8,_0x3cc3ae){_0x3cc3ae(null,path[_0x6531('0x14')](config['root'],_0x6531('0x16')));},'filename':function(_0x52ae54,_0x3f6cb9,_0x35cd0d){_0x35cd0d(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x1f'),path[_0x6531('0x1a')](_0x3f6cb9[_0x6531('0x20')])));}})});router['post'](_0x6531('0xf'),upload[_0x6531('0x1c')](_0x6531('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ac636,_0x2a3121,_0x22c16b){_0x22c16b(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x3e305a,_0x3caa35,_0x2d641f){_0x2d641f(null,util[_0x6531('0x17')](_0x6531('0x18'),'preferred',path['extname'](_0x3caa35['originalname'])));}})});router[_0x6531('0x1b')](_0x6531('0x12'),upload[_0x6531('0x1c')](_0x6531('0x1d')),controller[_0x6531('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34a1ef,_0x5b205c,_0xda3eaa){_0xda3eaa(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x2252d2,_0x2dc71f,_0x50c96b){_0x50c96b(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x22'),path[_0x6531('0x1a')](_0x2dc71f['originalname'])));}})});router[_0x6531('0x1b')](_0x6531('0x23'),upload['single']('file'),controller[_0x6531('0x24')]);router[_0x6531('0x25')](_0x6531('0xc'),auth[_0x6531('0x9')](),controller[_0x6531('0x26')]);module[_0x6531('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fb17bca..365ef81 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4ca2fe,_0x2dc461){var _0x1f0e40=function(_0xcb7386){while(--_0xcb7386){_0x4ca2fe['push'](_0x4ca2fe['shift']());}};_0x1f0e40(++_0x2dc461);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x26bee6,_0x53e09e){var _0x4f2896=function(_0x16ebff){while(--_0x16ebff){_0x26bee6['push'](_0x26bee6['shift']());}};_0x4f2896(++_0x53e09e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a7d8e8a..8d09f5c 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 _0xd54a=['request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','include','rows','catch','params','rawAttributes','fields','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','getFavicon','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client'];(function(_0x498d4f,_0x6e928e){var _0x1c81a8=function(_0x11dd33){while(--_0x11dd33){_0x498d4f['push'](_0x498d4f['shift']());}};_0x1c81a8(++_0x6e928e);}(_0xd54a,0x1df));var _0xad54=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xd54a[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0xad54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad54('0x1'));var jsonpatch=require(_0xad54('0x2'));var rp=require('request-promise');var moment=require(_0xad54('0x3'));var BPromise=require(_0xad54('0x4'));var Mustache=require(_0xad54('0x5'));var util=require('util');var path=require(_0xad54('0x6'));var sox=require(_0xad54('0x7'));var csv=require(_0xad54('0x8'));var ejs=require(_0xad54('0x9'));var fs=require('fs');var fs_extra=require(_0xad54('0xa'));var _=require(_0xad54('0xb'));var squel=require(_0xad54('0xc'));var crypto=require(_0xad54('0xd'));var jsforce=require(_0xad54('0xe'));var deskjs=require(_0xad54('0xf'));var toCsv=require(_0xad54('0x8'));var querystring=require(_0xad54('0x10'));var Papa=require(_0xad54('0x11'));var Redis=require(_0xad54('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xad54('0x13'));var as=require(_0xad54('0x14'));var hardwareService=require(_0xad54('0x15'));var logger=require('../../config/logger')(_0xad54('0x16'));var utils=require(_0xad54('0x17'));var config=require(_0xad54('0x18'));var licenseUtil=require(_0xad54('0x19'));var db=require(_0xad54('0x1a'))['db'];var jayson=require(_0xad54('0x1b'));var client=jayson[_0xad54('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53f5d4,_0x563814,_0x581228,_0x383be7){return new BPromise(function(_0x160abd,_0x756f15){var _0x3a82dc=_0x383be7||client;return _0x3a82dc[_0xad54('0x1d')](_0x53f5d4,_0x581228)[_0xad54('0x1e')](function(_0x54c5c0){logger['info']('Setting,\x20%s,\x20%s',_0x563814,_0xad54('0x1f'));logger[_0xad54('0x20')](_0xad54('0x21'),_0x563814,'request\x20sent',JSON[_0xad54('0x22')](_0x54c5c0));if(_0x54c5c0[_0xad54('0x23')]){if(_0x54c5c0[_0xad54('0x23')][_0xad54('0x24')]===0x1f4){logger[_0xad54('0x23')](_0xad54('0x25'),_0x563814,_0x54c5c0[_0xad54('0x23')]['message']);return _0x756f15(_0x54c5c0[_0xad54('0x23')][_0xad54('0x26')]);}logger[_0xad54('0x23')](_0xad54('0x25'),_0x563814,_0x54c5c0[_0xad54('0x23')]['message']);return _0x160abd(_0x54c5c0[_0xad54('0x23')][_0xad54('0x26')]);}else{logger[_0xad54('0x27')](_0xad54('0x25'),_0x563814,_0xad54('0x1f'));_0x160abd(_0x54c5c0[_0xad54('0x28')][_0xad54('0x26')]);}})['catch'](function(_0x5ae5d5){logger[_0xad54('0x23')](_0xad54('0x25'),_0x563814,_0x5ae5d5);_0x756f15(_0x5ae5d5);});});}function respondWithStatusCode(_0x47e353,_0x2ba34a){_0x2ba34a=_0x2ba34a||0xcc;return function(_0x5a161b){if(_0x5a161b){return _0x47e353[_0xad54('0x29')](_0x2ba34a);}return _0x47e353[_0xad54('0x2a')](_0x2ba34a)[_0xad54('0x2b')]();};}function respondWithResult(_0x5f49b2,_0x935bd4){_0x935bd4=_0x935bd4||0xc8;return function(_0x378aa3){if(_0x378aa3){return _0x5f49b2[_0xad54('0x2a')](_0x935bd4)['json'](_0x378aa3);}};}function respondWithFilteredResult(_0x20b83d,_0x406ed9){return function(_0x4d639f){if(_0x4d639f){var _0x5e4f8c=typeof _0x406ed9[_0xad54('0x2c')]===_0xad54('0x2d')&&typeof _0x406ed9[_0xad54('0x2e')]===_0xad54('0x2d');var _0x9b4ca6=_0x4d639f[_0xad54('0x2f')];var _0x22f374=_0x5e4f8c?0x0:_0x406ed9['offset'];var _0x49d0f8=_0x5e4f8c?_0x4d639f['count']:_0x406ed9['offset']+_0x406ed9[_0xad54('0x2e')];var _0x4b4f21;if(_0x49d0f8>=_0x9b4ca6){_0x49d0f8=_0x9b4ca6;_0x4b4f21=0xc8;}else{_0x4b4f21=0xce;}_0x20b83d[_0xad54('0x2a')](_0x4b4f21);return _0x20b83d[_0xad54('0x30')](_0xad54('0x31'),_0x22f374+'-'+_0x49d0f8+'/'+_0x9b4ca6)[_0xad54('0x32')](_0x4d639f);}return null;};}function patchUpdates(_0x3618b1){return function(_0x483528){try{jsonpatch['apply'](_0x483528,_0x3618b1,!![]);}catch(_0x21c9fc){return BPromise[_0xad54('0x33')](_0x21c9fc);}return _0x483528[_0xad54('0x34')]();};}function saveUpdates(_0x2075c2,_0x8697af){return function(_0x34221d){if(_0x34221d){return _0x34221d[_0xad54('0x35')](_0x2075c2)[_0xad54('0x1e')](function(_0xd5ea5d){return _0xd5ea5d;});}return null;};}function removeEntity(_0x3b7200,_0x4f9f60){return function(_0xee778d){if(_0xee778d){return _0xee778d[_0xad54('0x36')]()[_0xad54('0x1e')](function(){_0x3b7200[_0xad54('0x2a')](0xcc)[_0xad54('0x2b')]();});}};}function handleEntityNotFound(_0x14caec,_0x277b46){return function(_0x39d43e){if(!_0x39d43e){_0x14caec[_0xad54('0x29')](0x194);}return _0x39d43e;};}function handleError(_0x384866,_0x4760a6){_0x4760a6=_0x4760a6||0x1f4;return function(_0x56fda0){logger[_0xad54('0x23')](_0x56fda0[_0xad54('0x37')]);if(_0x56fda0[_0xad54('0x38')]){delete _0x56fda0[_0xad54('0x38')];}_0x384866[_0xad54('0x2a')](_0x4760a6)[_0xad54('0x39')](_0x56fda0);};}exports[_0xad54('0x3a')]=function(_0x891f15,_0x3edca7){var _0x593e4f={},_0x576a76={},_0x31f0ea={'count':0x0,'rows':[]};var _0x498264=_[_0xad54('0x3b')](db['Setting']['rawAttributes'],function(_0x4e405a){return{'name':_0x4e405a[_0xad54('0x3c')],'type':_0x4e405a[_0xad54('0x3d')][_0xad54('0x3e')]};});_0x576a76['model']=_['map'](_0x498264,_0xad54('0x38'));_0x576a76[_0xad54('0x3f')]=_[_0xad54('0x40')](_0x891f15[_0xad54('0x3f')]);_0x576a76[_0xad54('0x41')]=_[_0xad54('0x42')](_0x576a76[_0xad54('0x43')],_0x576a76[_0xad54('0x3f')]);_0x593e4f['attributes']=_['intersection'](_0x576a76[_0xad54('0x43')],qs['fields'](_0x891f15[_0xad54('0x3f')]['fields']));_0x593e4f['attributes']=_0x593e4f[_0xad54('0x44')][_0xad54('0x45')]?_0x593e4f[_0xad54('0x44')]:_0x576a76['model'];if(!_0x891f15[_0xad54('0x3f')][_0xad54('0x46')](_0xad54('0x47'))){_0x593e4f[_0xad54('0x2e')]=qs[_0xad54('0x2e')](_0x891f15[_0xad54('0x3f')][_0xad54('0x2e')]);_0x593e4f[_0xad54('0x2c')]=qs[_0xad54('0x2c')](_0x891f15['query']['offset']);}_0x593e4f['order']=qs[_0xad54('0x48')](_0x891f15[_0xad54('0x3f')]['sort']);_0x593e4f[_0xad54('0x49')]=qs[_0xad54('0x41')](_[_0xad54('0x4a')](_0x891f15['query'],_0x576a76[_0xad54('0x41')]),_0x498264);if(_0x891f15['query'][_0xad54('0x4b')]){_0x593e4f['where']=_[_0xad54('0x4c')](_0x593e4f['where'],{'$or':_[_0xad54('0x3b')](_0x498264,function(_0x1ab67d){if(_0x1ab67d['type']!==_0xad54('0x4d')){var _0x22301e={};_0x22301e[_0x1ab67d[_0xad54('0x38')]]={'$like':'%'+_0x891f15[_0xad54('0x3f')][_0xad54('0x4b')]+'%'};return _0x22301e;}})});}_0x593e4f=_[_0xad54('0x4c')]({},_0x593e4f,_0x891f15[_0xad54('0x4e')]);var _0x589652={'where':_0x593e4f[_0xad54('0x49')]};return db[_0xad54('0x4f')][_0xad54('0x2f')](_0x589652)[_0xad54('0x1e')](function(_0x4a22ad){_0x31f0ea[_0xad54('0x2f')]=_0x4a22ad;if(_0x891f15[_0xad54('0x3f')][_0xad54('0x50')]){_0x593e4f[_0xad54('0x51')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x593e4f);})[_0xad54('0x1e')](function(_0x544bcb){_0x31f0ea[_0xad54('0x52')]=_0x544bcb;return _0x31f0ea;})[_0xad54('0x1e')](respondWithFilteredResult(_0x3edca7,_0x593e4f))[_0xad54('0x53')](handleError(_0x3edca7,null));};exports['show']=function(_0x5157d4,_0x38f483){var _0x1add27={'raw':![],'where':{'id':_0x5157d4[_0xad54('0x54')]['id']}},_0x6b29de={};_0x6b29de[_0xad54('0x43')]=_[_0xad54('0x40')](db[_0xad54('0x4f')][_0xad54('0x55')]);_0x6b29de[_0xad54('0x3f')]=_[_0xad54('0x40')](_0x5157d4[_0xad54('0x3f')]);_0x6b29de[_0xad54('0x41')]=_[_0xad54('0x42')](_0x6b29de[_0xad54('0x43')],_0x6b29de[_0xad54('0x3f')]);_0x1add27['attributes']=_[_0xad54('0x42')](_0x6b29de[_0xad54('0x43')],qs['fields'](_0x5157d4[_0xad54('0x3f')][_0xad54('0x56')]));_0x1add27[_0xad54('0x44')]=_0x1add27[_0xad54('0x44')][_0xad54('0x45')]?_0x1add27[_0xad54('0x44')]:_0x6b29de[_0xad54('0x43')];if(_0x5157d4[_0xad54('0x3f')][_0xad54('0x50')]){_0x1add27[_0xad54('0x51')]=[{'all':!![]}];}_0x1add27=_[_0xad54('0x4c')]({},_0x1add27,_0x5157d4['options']);return db[_0xad54('0x4f')][_0xad54('0x57')](_0x1add27)[_0xad54('0x1e')](handleEntityNotFound(_0x38f483,null))[_0xad54('0x1e')](respondWithResult(_0x38f483,null))['catch'](handleError(_0x38f483,null));};exports['update']=function(_0x3d600a,_0x149f65){if(_0x3d600a[_0xad54('0x58')]['id']){delete _0x3d600a['body']['id'];}return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x3d600a[_0xad54('0x54')]['id']}})['then'](handleEntityNotFound(_0x149f65,null))[_0xad54('0x1e')](saveUpdates(_0x3d600a[_0xad54('0x58')],null))[_0xad54('0x1e')](respondWithResult(_0x149f65,null))[_0xad54('0x53')](handleError(_0x149f65,null));};exports[_0xad54('0x59')]=function(_0x5456f4,_0x2829de,_0x1752c2){if(_0x5456f4[_0xad54('0x5a')]&&_0x5456f4['file']['filename']){_0x5456f4[_0xad54('0x58')][_0xad54('0x5b')]=_0x5456f4[_0xad54('0x5a')][_0xad54('0x5c')];}return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x5456f4[_0xad54('0x54')]['id']}})[_0xad54('0x1e')](handleEntityNotFound(_0x2829de,null))[_0xad54('0x1e')](saveUpdates(_0x5456f4[_0xad54('0x58')],null))[_0xad54('0x1e')](respondWithResult(_0x2829de,null))[_0xad54('0x53')](handleError(_0x2829de,null));};exports[_0xad54('0x5d')]=function(_0xe10d6c,_0x1bcbb4,_0x3e3e5a){if(_0xe10d6c[_0xad54('0x5a')]&&_0xe10d6c['file']['filename']){_0xe10d6c[_0xad54('0x58')][_0xad54('0x5e')]=_0xe10d6c[_0xad54('0x5a')][_0xad54('0x5c')];}return db['Setting'][_0xad54('0x57')]({'where':{'id':_0xe10d6c[_0xad54('0x54')]['id']}})[_0xad54('0x1e')](handleEntityNotFound(_0x1bcbb4,null))[_0xad54('0x1e')](saveUpdates(_0xe10d6c[_0xad54('0x58')],null))['then'](respondWithResult(_0x1bcbb4,null))[_0xad54('0x53')](handleError(_0x1bcbb4,null));};var utilLicense=require(_0xad54('0x19'));exports[_0xad54('0x5f')]=function(_0x116c96,_0x47ed05,_0x353162){var _0x316b75='server/files/images/logos';var _0x3c658f={'custom':![]};return utilLicense['getLicense']()[_0xad54('0x1e')](function(_0x5ced46){if(_0x5ced46){_0x3c658f=_0x5ced46;}return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x116c96[_0xad54('0x54')]['id']},'attributes':[_0xad54('0x5b'),_0xad54('0x5e'),_0xad54('0x60'),_0xad54('0x61'),_0xad54('0x62'),_0xad54('0x63'),'defaultPreferred',_0xad54('0x64')],'raw':!![]});})[_0xad54('0x1e')](handleEntityNotFound(_0x47ed05,null))[_0xad54('0x1e')](function(_0x301643){if(_0x301643){var _0xd94412=_0x301643['logo']&&fs[_0xad54('0x65')](path[_0xad54('0x66')](config[_0xad54('0x67')],_0x316b75,_[_0xad54('0x68')](_0x301643[_0xad54('0x5b')])))?path['join'](config['root'],_0x316b75,_[_0xad54('0x68')](_0x301643[_0xad54('0x5b')])):path[_0xad54('0x66')](config[_0xad54('0x67')],_0x316b75,_[_0xad54('0x68')]('default_logo.svg'));var _0xcc7b73=_0xad54('0x69')+_[_0xad54('0x6a')](_0xad54('0x5b'));if(_0x301643[_0xcc7b73]||!_0x3c658f[_0xad54('0x6b')]){_0xd94412=path[_0xad54('0x66')](config['root'],_0x316b75,_['toLower'](_0xad54('0x6c')));}if(!fs[_0xad54('0x65')](_0xd94412)){throw new db[(_0xad54('0x6d'))][(_0xad54('0x6e'))](_[_0xad54('0x6a')](_0xad54('0x5b'))+_0xad54('0x6f'));}return _0x47ed05[_0xad54('0x70')](_0xd94412);}})['catch'](handleError(_0x47ed05,null));};var utilLicense=require(_0xad54('0x19'));exports[_0xad54('0x71')]=function(_0x43c5e7,_0x35d12e,_0x59d805){var _0x7642bf=_0xad54('0x72');var _0x40c3cb={'custom':![]};return utilLicense[_0xad54('0x73')]()['then'](function(_0x1fbb34){if(_0x1fbb34){_0x40c3cb=_0x1fbb34;}return db['Setting']['find']({'where':{'id':_0x43c5e7[_0xad54('0x54')]['id']},'attributes':[_0xad54('0x5b'),_0xad54('0x5e'),_0xad54('0x60'),_0xad54('0x61'),_0xad54('0x62'),_0xad54('0x63'),_0xad54('0x74'),_0xad54('0x64')],'raw':!![]});})[_0xad54('0x1e')](handleEntityNotFound(_0x35d12e,null))['then'](function(_0x1ebc62){if(_0x1ebc62){var _0x3d900c=_0x1ebc62[_0xad54('0x5e')]&&fs[_0xad54('0x65')](path[_0xad54('0x66')](config[_0xad54('0x67')],_0x7642bf,_[_0xad54('0x68')](_0x1ebc62[_0xad54('0x5e')])))?path[_0xad54('0x66')](config[_0xad54('0x67')],_0x7642bf,_[_0xad54('0x68')](_0x1ebc62[_0xad54('0x5e')])):path[_0xad54('0x66')](config['root'],_0x7642bf,_[_0xad54('0x68')](_0xad54('0x75')));var _0x19f1fb='default'+_[_0xad54('0x6a')]('loginLogo');if(_0x1ebc62[_0x19f1fb]||!_0x40c3cb[_0xad54('0x6b')]){_0x3d900c=path[_0xad54('0x66')](config[_0xad54('0x67')],_0x7642bf,_[_0xad54('0x68')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x3d900c)){throw new db[(_0xad54('0x6d'))]['ValidationError'](_[_0xad54('0x6a')]('loginLogo')+_0xad54('0x6f'));}return _0x35d12e[_0xad54('0x70')](_0x3d900c);}})[_0xad54('0x53')](handleError(_0x35d12e,null));};exports[_0xad54('0x76')]=function(_0x3d2fbf,_0x403a73){return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x3d2fbf[_0xad54('0x54')]['id']},'attributes':[_0xad54('0x77')]})['then'](respondWithResult(_0x403a73,null))[_0xad54('0x53')](handleError(_0x403a73,null));};exports['addPreferred']=function(_0xf74ccd,_0x47b42e,_0x7113e3){if(_0xf74ccd[_0xad54('0x5a')]&&_0xf74ccd[_0xad54('0x5a')][_0xad54('0x5c')]){_0xf74ccd[_0xad54('0x58')][_0xad54('0x60')]=_0xf74ccd['file']['filename'];}return db['Setting'][_0xad54('0x57')]({'where':{'id':_0xf74ccd[_0xad54('0x54')]['id']}})[_0xad54('0x1e')](handleEntityNotFound(_0x47b42e,null))[_0xad54('0x1e')](saveUpdates(_0xf74ccd['body'],null))[_0xad54('0x1e')](respondWithResult(_0x47b42e,null))[_0xad54('0x53')](handleError(_0x47b42e,null));};var utilLicense=require('../../config/license/util');exports[_0xad54('0x78')]=function(_0x5bc581,_0x344ac4,_0x36745d){var _0x3f2c31=_0xad54('0x72');var _0x58e718={'custom':![]};return utilLicense[_0xad54('0x73')]()[_0xad54('0x1e')](function(_0x5a6390){if(_0x5a6390){_0x58e718=_0x5a6390;}return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x5bc581[_0xad54('0x54')]['id']},'attributes':[_0xad54('0x5b'),'loginLogo',_0xad54('0x60'),_0xad54('0x61'),_0xad54('0x62'),_0xad54('0x63'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xad54('0x1e')](handleEntityNotFound(_0x344ac4,null))[_0xad54('0x1e')](function(_0x527af0){if(_0x527af0){var _0x2cf00c=_0x527af0[_0xad54('0x60')]&&fs[_0xad54('0x65')](path['join'](config['root'],_0x3f2c31,_[_0xad54('0x68')](_0x527af0[_0xad54('0x60')])))?path[_0xad54('0x66')](config[_0xad54('0x67')],_0x3f2c31,_[_0xad54('0x68')](_0x527af0['preferred'])):path['join'](config['root'],_0x3f2c31,_[_0xad54('0x68')](_0xad54('0x79')));var _0x5048a5=_0xad54('0x69')+_[_0xad54('0x6a')](_0xad54('0x60'));if(_0x527af0[_0x5048a5]||!_0x58e718[_0xad54('0x6b')]||!_0x58e718[_0xad54('0x60')]){_0x2cf00c=path[_0xad54('0x66')](config['root'],_0x3f2c31,_['toLower'](_0xad54('0x79')));}if(!fs[_0xad54('0x65')](_0x2cf00c)){throw new db[(_0xad54('0x6d'))][(_0xad54('0x6e'))](_[_0xad54('0x6a')](_0xad54('0x60'))+_0xad54('0x6f'));}return _0x344ac4['download'](_0x2cf00c);}})[_0xad54('0x53')](handleError(_0x344ac4,null));};exports['addFavicon']=function(_0xd74db,_0x4642aa,_0x4ef9cb){if(_0xd74db[_0xad54('0x5a')]&&_0xd74db[_0xad54('0x5a')]['filename']){_0xd74db[_0xad54('0x58')][_0xad54('0x61')]=_0xd74db[_0xad54('0x5a')][_0xad54('0x5c')];}return db['Setting']['find']({'where':{'id':_0xd74db[_0xad54('0x54')]['id']}})[_0xad54('0x1e')](handleEntityNotFound(_0x4642aa,null))['then'](saveUpdates(_0xd74db[_0xad54('0x58')],null))[_0xad54('0x1e')](respondWithResult(_0x4642aa,null))[_0xad54('0x53')](handleError(_0x4642aa,null));};var utilLicense=require(_0xad54('0x19'));exports[_0xad54('0x7a')]=function(_0x445eb9,_0x1f016d,_0x1df241){var _0x599148=_0xad54('0x72');var _0x100f5c={'custom':![]};return utilLicense[_0xad54('0x73')]()['then'](function(_0x5afe6a){if(_0x5afe6a){_0x100f5c=_0x5afe6a;}return db[_0xad54('0x4f')][_0xad54('0x57')]({'where':{'id':_0x445eb9[_0xad54('0x54')]['id']},'attributes':[_0xad54('0x5b'),_0xad54('0x5e'),_0xad54('0x60'),_0xad54('0x61'),_0xad54('0x62'),'defaultLoginLogo',_0xad54('0x74'),_0xad54('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x1f016d,null))['then'](function(_0x488a7b){if(_0x488a7b){var _0x384e30=_0x488a7b['favicon']&&fs[_0xad54('0x65')](path['join'](config['root'],_0x599148,_[_0xad54('0x68')](_0x488a7b[_0xad54('0x61')])))?path[_0xad54('0x66')](config[_0xad54('0x67')],_0x599148,_[_0xad54('0x68')](_0x488a7b[_0xad54('0x61')])):path[_0xad54('0x66')](config[_0xad54('0x67')],_0x599148,_['toLower']('default_favicon.ico'));var _0x35e699=_0xad54('0x69')+_[_0xad54('0x6a')]('favicon');if(_0x488a7b[_0x35e699]||!_0x100f5c[_0xad54('0x6b')]){_0x384e30=path[_0xad54('0x66')](config[_0xad54('0x67')],_0x599148,_['toLower']('default_favicon.ico'));}if(!fs[_0xad54('0x65')](_0x384e30)){throw new db[(_0xad54('0x6d'))][(_0xad54('0x6e'))](_[_0xad54('0x6a')](_0xad54('0x61'))+_0xad54('0x6f'));}return _0x1f016d[_0xad54('0x70')](_0x384e30);}})[_0xad54('0x53')](handleError(_0x1f016d,null));};exports['getDate']=function(_0x2f86e4,_0x167eb3){var _0x5d02d9={'offset':moment()[_0xad54('0x7b')]()};_0x5d02d9[_0xad54('0x7c')]=moment()[_0xad54('0x7b')](_0x5d02d9[_0xad54('0x2c')])[_0xad54('0x7d')](_0xad54('0x7e'));return _0x167eb3['status'](0xc8)[_0xad54('0x39')](_0x5d02d9);}; \ No newline at end of file +var _0x8828=['addPreferred','getPreferred','default_preferred.png','addFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','sendStatus','name','send','map','Setting','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','body','find','catch','file','filename','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','\x20not\x20found'];(function(_0x3a4dd9,_0x1cbc1a){var _0x2be3ec=function(_0x2c326e){while(--_0x2c326e){_0x3a4dd9['push'](_0x3a4dd9['shift']());}};_0x2be3ec(++_0x1cbc1a);}(_0x8828,0x1d1));var _0x8882=function(_0x85674a,_0x5ca49f){_0x85674a=_0x85674a-0x0;var _0x172a3b=_0x8828[_0x85674a];return _0x172a3b;};'use strict';var emlformat=require(_0x8882('0x0'));var rimraf=require(_0x8882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8882('0x2'));var moment=require(_0x8882('0x3'));var BPromise=require(_0x8882('0x4'));var Mustache=require(_0x8882('0x5'));var util=require(_0x8882('0x6'));var path=require('path');var sox=require(_0x8882('0x7'));var csv=require(_0x8882('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8882('0x9'));var _=require('lodash');var squel=require(_0x8882('0xa'));var crypto=require('crypto');var jsforce=require(_0x8882('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8882('0xc'));var Papa=require(_0x8882('0xd'));var Redis=require(_0x8882('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8882('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8882('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8882('0x11'))['db'];var jayson=require(_0x8882('0x12'));var client=jayson[_0x8882('0x13')][_0x8882('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1a8e46,_0xf9faf5,_0x58c675,_0x5f1107){return new BPromise(function(_0x45d479,_0x25f920){var _0x52488d=_0x5f1107||client;return _0x52488d[_0x8882('0x15')](_0x1a8e46,_0x58c675)[_0x8882('0x16')](function(_0x3cfdd2){logger[_0x8882('0x17')]('Setting,\x20%s,\x20%s',_0xf9faf5,'request\x20sent');logger[_0x8882('0x18')]('Setting,\x20%s,\x20%s,\x20%s',_0xf9faf5,_0x8882('0x19'),JSON[_0x8882('0x1a')](_0x3cfdd2));if(_0x3cfdd2[_0x8882('0x1b')]){if(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1c')]===0x1f4){logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);return _0x25f920(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);}logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3cfdd2['error'][_0x8882('0x1e')]);return _0x45d479(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);}else{logger[_0x8882('0x17')](_0x8882('0x1d'),_0xf9faf5,'request\x20sent');_0x45d479(_0x3cfdd2[_0x8882('0x1f')]['message']);}})['catch'](function(_0x3e295a){logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3e295a);_0x25f920(_0x3e295a);});});}function respondWithStatusCode(_0x57d33a,_0x5f4ddc){_0x5f4ddc=_0x5f4ddc||0xcc;return function(_0x45314d){if(_0x45314d){return _0x57d33a['sendStatus'](_0x5f4ddc);}return _0x57d33a[_0x8882('0x20')](_0x5f4ddc)['end']();};}function respondWithResult(_0x4a4aed,_0x44c95e){_0x44c95e=_0x44c95e||0xc8;return function(_0x552de8){if(_0x552de8){return _0x4a4aed[_0x8882('0x20')](_0x44c95e)[_0x8882('0x21')](_0x552de8);}};}function respondWithFilteredResult(_0x3a8e04,_0x1e68d8){return function(_0x1f9d20){if(_0x1f9d20){var _0x4e09d4=typeof _0x1e68d8[_0x8882('0x22')]===_0x8882('0x23')&&typeof _0x1e68d8[_0x8882('0x24')]===_0x8882('0x23');var _0x237bfd=_0x1f9d20[_0x8882('0x25')];var _0x1eef4f=_0x4e09d4?0x0:_0x1e68d8[_0x8882('0x22')];var _0x5cedd3=_0x4e09d4?_0x1f9d20[_0x8882('0x25')]:_0x1e68d8[_0x8882('0x22')]+_0x1e68d8[_0x8882('0x24')];var _0x3551e7;if(_0x5cedd3>=_0x237bfd){_0x5cedd3=_0x237bfd;_0x3551e7=0xc8;}else{_0x3551e7=0xce;}_0x3a8e04[_0x8882('0x20')](_0x3551e7);return _0x3a8e04[_0x8882('0x26')](_0x8882('0x27'),_0x1eef4f+'-'+_0x5cedd3+'/'+_0x237bfd)[_0x8882('0x21')](_0x1f9d20);}return null;};}function patchUpdates(_0x3f8153){return function(_0x384060){try{jsonpatch[_0x8882('0x28')](_0x384060,_0x3f8153,!![]);}catch(_0x495303){return BPromise['reject'](_0x495303);}return _0x384060[_0x8882('0x29')]();};}function saveUpdates(_0x4717fe,_0x16406c){return function(_0x371be3){if(_0x371be3){return _0x371be3[_0x8882('0x2a')](_0x4717fe)[_0x8882('0x16')](function(_0x508669){return _0x508669;});}return null;};}function removeEntity(_0x318c17,_0x1d68b7){return function(_0x14aee1){if(_0x14aee1){return _0x14aee1[_0x8882('0x2b')]()['then'](function(){_0x318c17['status'](0xcc)[_0x8882('0x2c')]();});}};}function handleEntityNotFound(_0x1c570e,_0x46f1b6){return function(_0x4926d6){if(!_0x4926d6){_0x1c570e[_0x8882('0x2d')](0x194);}return _0x4926d6;};}function handleError(_0xdc9841,_0x1ac946){_0x1ac946=_0x1ac946||0x1f4;return function(_0x159b6f){logger['error'](_0x159b6f['stack']);if(_0x159b6f[_0x8882('0x2e')]){delete _0x159b6f[_0x8882('0x2e')];}_0xdc9841[_0x8882('0x20')](_0x1ac946)[_0x8882('0x2f')](_0x159b6f);};}exports['index']=function(_0x256c28,_0x35daf0){var _0x109eff={},_0x3b027f={},_0x1c5745={'count':0x0,'rows':[]};var _0x24b18d=_[_0x8882('0x30')](db[_0x8882('0x31')][_0x8882('0x32')],function(_0x4a8456){return{'name':_0x4a8456[_0x8882('0x33')],'type':_0x4a8456[_0x8882('0x34')]['key']};});_0x3b027f[_0x8882('0x35')]=_['map'](_0x24b18d,_0x8882('0x2e'));_0x3b027f[_0x8882('0x36')]=_[_0x8882('0x37')](_0x256c28['query']);_0x3b027f['filters']=_['intersection'](_0x3b027f['model'],_0x3b027f[_0x8882('0x36')]);_0x109eff[_0x8882('0x38')]=_[_0x8882('0x39')](_0x3b027f[_0x8882('0x35')],qs[_0x8882('0x3a')](_0x256c28[_0x8882('0x36')]['fields']));_0x109eff['attributes']=_0x109eff['attributes']['length']?_0x109eff[_0x8882('0x38')]:_0x3b027f[_0x8882('0x35')];if(!_0x256c28[_0x8882('0x36')][_0x8882('0x3b')](_0x8882('0x3c'))){_0x109eff[_0x8882('0x24')]=qs['limit'](_0x256c28[_0x8882('0x36')][_0x8882('0x24')]);_0x109eff[_0x8882('0x22')]=qs[_0x8882('0x22')](_0x256c28[_0x8882('0x36')][_0x8882('0x22')]);}_0x109eff['order']=qs['sort'](_0x256c28[_0x8882('0x36')][_0x8882('0x3d')]);_0x109eff[_0x8882('0x3e')]=qs['filters'](_[_0x8882('0x3f')](_0x256c28[_0x8882('0x36')],_0x3b027f[_0x8882('0x40')]),_0x24b18d);if(_0x256c28[_0x8882('0x36')][_0x8882('0x41')]){_0x109eff[_0x8882('0x3e')]=_[_0x8882('0x42')](_0x109eff[_0x8882('0x3e')],{'$or':_[_0x8882('0x30')](_0x24b18d,function(_0x5591f6){if(_0x5591f6[_0x8882('0x34')]!==_0x8882('0x43')){var _0x4383e7={};_0x4383e7[_0x5591f6['name']]={'$like':'%'+_0x256c28[_0x8882('0x36')][_0x8882('0x41')]+'%'};return _0x4383e7;}})});}_0x109eff=_[_0x8882('0x42')]({},_0x109eff,_0x256c28['options']);var _0x5c7ce5={'where':_0x109eff[_0x8882('0x3e')]};return db[_0x8882('0x31')][_0x8882('0x25')](_0x5c7ce5)[_0x8882('0x16')](function(_0x9c8dc){_0x1c5745[_0x8882('0x25')]=_0x9c8dc;if(_0x256c28[_0x8882('0x36')][_0x8882('0x44')]){_0x109eff[_0x8882('0x45')]=[{'all':!![]}];}return db[_0x8882('0x31')][_0x8882('0x46')](_0x109eff);})[_0x8882('0x16')](function(_0x3df3e1){_0x1c5745[_0x8882('0x47')]=_0x3df3e1;return _0x1c5745;})[_0x8882('0x16')](respondWithFilteredResult(_0x35daf0,_0x109eff))['catch'](handleError(_0x35daf0,null));};exports[_0x8882('0x48')]=function(_0x1882ef,_0x346d07){var _0x18011c={'raw':![],'where':{'id':_0x1882ef[_0x8882('0x49')]['id']}},_0x1bbd7d={};_0x1bbd7d[_0x8882('0x35')]=_[_0x8882('0x37')](db['Setting'][_0x8882('0x32')]);_0x1bbd7d['query']=_[_0x8882('0x37')](_0x1882ef[_0x8882('0x36')]);_0x1bbd7d['filters']=_[_0x8882('0x39')](_0x1bbd7d[_0x8882('0x35')],_0x1bbd7d[_0x8882('0x36')]);_0x18011c['attributes']=_[_0x8882('0x39')](_0x1bbd7d[_0x8882('0x35')],qs[_0x8882('0x3a')](_0x1882ef[_0x8882('0x36')][_0x8882('0x3a')]));_0x18011c['attributes']=_0x18011c[_0x8882('0x38')]['length']?_0x18011c[_0x8882('0x38')]:_0x1bbd7d[_0x8882('0x35')];if(_0x1882ef[_0x8882('0x36')][_0x8882('0x44')]){_0x18011c['include']=[{'all':!![]}];}_0x18011c=_[_0x8882('0x42')]({},_0x18011c,_0x1882ef[_0x8882('0x4a')]);return db[_0x8882('0x31')]['find'](_0x18011c)['then'](handleEntityNotFound(_0x346d07,null))[_0x8882('0x16')](respondWithResult(_0x346d07,null))['catch'](handleError(_0x346d07,null));};exports[_0x8882('0x2a')]=function(_0x389e93,_0x19cb8b){if(_0x389e93['body']['id']){delete _0x389e93[_0x8882('0x4b')]['id'];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x389e93['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x19cb8b,null))[_0x8882('0x16')](saveUpdates(_0x389e93[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0x19cb8b,null))[_0x8882('0x4d')](handleError(_0x19cb8b,null));};exports['addLogo']=function(_0x23eac9,_0x5d940d,_0x52ec2f){if(_0x23eac9['file']&&_0x23eac9[_0x8882('0x4e')][_0x8882('0x4f')]){_0x23eac9['body']['logo']=_0x23eac9[_0x8882('0x4e')][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x23eac9['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x5d940d,null))[_0x8882('0x16')](saveUpdates(_0x23eac9[_0x8882('0x4b')],null))['then'](respondWithResult(_0x5d940d,null))[_0x8882('0x4d')](handleError(_0x5d940d,null));};exports['addLogoLogin']=function(_0x458763,_0x35cecd,_0x5c298a){if(_0x458763[_0x8882('0x4e')]&&_0x458763[_0x8882('0x4e')][_0x8882('0x4f')]){_0x458763['body'][_0x8882('0x50')]=_0x458763['file'][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x458763['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x35cecd,null))[_0x8882('0x16')](saveUpdates(_0x458763[_0x8882('0x4b')],null))['then'](respondWithResult(_0x35cecd,null))[_0x8882('0x4d')](handleError(_0x35cecd,null));};var utilLicense=require(_0x8882('0x51'));exports['getLogo']=function(_0x4734b3,_0x51b879,_0x3c430d){var _0x160688=_0x8882('0x52');var _0x4b1c68={'custom':![]};return utilLicense[_0x8882('0x53')]()[_0x8882('0x16')](function(_0x18eea8){if(_0x18eea8){_0x4b1c68=_0x18eea8;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4734b3[_0x8882('0x49')]['id']},'attributes':[_0x8882('0x54'),_0x8882('0x50'),_0x8882('0x55'),_0x8882('0x56'),_0x8882('0x57'),_0x8882('0x58'),'defaultPreferred',_0x8882('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0x51b879,null))[_0x8882('0x16')](function(_0x15659a){if(_0x15659a){var _0x44877d=_0x15659a['logo']&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x160688,_[_0x8882('0x5d')](_0x15659a['logo'])))?path[_0x8882('0x5b')](config['root'],_0x160688,_[_0x8882('0x5d')](_0x15659a[_0x8882('0x54')])):path[_0x8882('0x5b')](config['root'],_0x160688,_['toLower'](_0x8882('0x5e')));var _0x1e2192=_0x8882('0x5f')+_[_0x8882('0x60')]('logo');if(_0x15659a[_0x1e2192]||!_0x4b1c68[_0x8882('0x61')]){_0x44877d=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x160688,_[_0x8882('0x5d')](_0x8882('0x5e')));}if(!fs[_0x8882('0x5a')](_0x44877d)){throw new db[(_0x8882('0x62'))][(_0x8882('0x63'))](_[_0x8882('0x60')](_0x8882('0x54'))+'\x20not\x20found');}return _0x51b879[_0x8882('0x64')](_0x44877d);}})[_0x8882('0x4d')](handleError(_0x51b879,null));};var utilLicense=require(_0x8882('0x51'));exports[_0x8882('0x65')]=function(_0x3676ac,_0x36e675,_0x241b27){var _0x5dfb78=_0x8882('0x52');var _0x3a8010={'custom':![]};return utilLicense[_0x8882('0x53')]()['then'](function(_0x36a119){if(_0x36a119){_0x3a8010=_0x36a119;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x3676ac[_0x8882('0x49')]['id']},'attributes':[_0x8882('0x54'),_0x8882('0x50'),_0x8882('0x55'),_0x8882('0x56'),'defaultLogo',_0x8882('0x58'),_0x8882('0x66'),_0x8882('0x59')],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x36e675,null))[_0x8882('0x16')](function(_0x18c047){if(_0x18c047){var _0x31cdf1=_0x18c047[_0x8882('0x50')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5dfb78,_[_0x8882('0x5d')](_0x18c047[_0x8882('0x50')])))?path['join'](config['root'],_0x5dfb78,_[_0x8882('0x5d')](_0x18c047[_0x8882('0x50')])):path[_0x8882('0x5b')](config['root'],_0x5dfb78,_['toLower'](_0x8882('0x67')));var _0x39d8ad='default'+_[_0x8882('0x60')](_0x8882('0x50'));if(_0x18c047[_0x39d8ad]||!_0x3a8010[_0x8882('0x61')]){_0x31cdf1=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5dfb78,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x31cdf1)){throw new db['Sequelize']['ValidationError'](_[_0x8882('0x60')](_0x8882('0x50'))+_0x8882('0x68'));}return _0x36e675[_0x8882('0x64')](_0x31cdf1);}})[_0x8882('0x4d')](handleError(_0x36e675,null));};exports['gdpr']=function(_0x4ced44,_0x5e8fd3){return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4ced44[_0x8882('0x49')]['id']},'attributes':['securePassword']})[_0x8882('0x16')](respondWithResult(_0x5e8fd3,null))['catch'](handleError(_0x5e8fd3,null));};exports[_0x8882('0x69')]=function(_0x202a52,_0xb4410a,_0x3fd213){if(_0x202a52[_0x8882('0x4e')]&&_0x202a52[_0x8882('0x4e')][_0x8882('0x4f')]){_0x202a52[_0x8882('0x4b')][_0x8882('0x55')]=_0x202a52[_0x8882('0x4e')]['filename'];}return db['Setting'][_0x8882('0x4c')]({'where':{'id':_0x202a52[_0x8882('0x49')]['id']}})[_0x8882('0x16')](handleEntityNotFound(_0xb4410a,null))[_0x8882('0x16')](saveUpdates(_0x202a52[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0xb4410a,null))['catch'](handleError(_0xb4410a,null));};var utilLicense=require(_0x8882('0x51'));exports[_0x8882('0x6a')]=function(_0x2826b8,_0x4ebafd,_0x42916a){var _0x13492e=_0x8882('0x52');var _0x28e261={'custom':![]};return utilLicense['getLicense']()[_0x8882('0x16')](function(_0x371fdd){if(_0x371fdd){_0x28e261=_0x371fdd;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x2826b8[_0x8882('0x49')]['id']},'attributes':['logo',_0x8882('0x50'),'preferred','favicon',_0x8882('0x57'),'defaultLoginLogo',_0x8882('0x66'),'defaultFavicon'],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x4ebafd,null))[_0x8882('0x16')](function(_0x1d3ad7){if(_0x1d3ad7){var _0xb3dec9=_0x1d3ad7[_0x8882('0x55')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x1d3ad7[_0x8882('0x55')])))?path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x1d3ad7[_0x8882('0x55')])):path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x8882('0x6b')));var _0x413286=_0x8882('0x5f')+_[_0x8882('0x60')]('preferred');if(_0x1d3ad7[_0x413286]||!_0x28e261[_0x8882('0x61')]||!_0x28e261[_0x8882('0x55')]){_0xb3dec9=path['join'](config[_0x8882('0x5c')],_0x13492e,_['toLower'](_0x8882('0x6b')));}if(!fs[_0x8882('0x5a')](_0xb3dec9)){throw new db[(_0x8882('0x62'))][(_0x8882('0x63'))](_['upperFirst'](_0x8882('0x55'))+_0x8882('0x68'));}return _0x4ebafd[_0x8882('0x64')](_0xb3dec9);}})[_0x8882('0x4d')](handleError(_0x4ebafd,null));};exports[_0x8882('0x6c')]=function(_0x4c5c65,_0x305c16,_0x1d08a9){if(_0x4c5c65[_0x8882('0x4e')]&&_0x4c5c65[_0x8882('0x4e')][_0x8882('0x4f')]){_0x4c5c65[_0x8882('0x4b')][_0x8882('0x56')]=_0x4c5c65[_0x8882('0x4e')][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4c5c65[_0x8882('0x49')]['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x305c16,null))['then'](saveUpdates(_0x4c5c65[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0x305c16,null))[_0x8882('0x4d')](handleError(_0x305c16,null));};var utilLicense=require(_0x8882('0x51'));exports['getFavicon']=function(_0x181783,_0x5d26c2,_0x312715){var _0x5250b5=_0x8882('0x52');var _0xf4c770={'custom':![]};return utilLicense['getLicense']()[_0x8882('0x16')](function(_0x4fa652){if(_0x4fa652){_0xf4c770=_0x4fa652;}return db['Setting'][_0x8882('0x4c')]({'where':{'id':_0x181783[_0x8882('0x49')]['id']},'attributes':['logo',_0x8882('0x50'),'preferred',_0x8882('0x56'),'defaultLogo',_0x8882('0x58'),'defaultPreferred',_0x8882('0x59')],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x5d26c2,null))['then'](function(_0x5c6f25){if(_0x5c6f25){var _0x37bb4e=_0x5c6f25[_0x8882('0x56')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config['root'],_0x5250b5,_['toLower'](_0x5c6f25[_0x8882('0x56')])))?path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5250b5,_[_0x8882('0x5d')](_0x5c6f25[_0x8882('0x56')])):path['join'](config[_0x8882('0x5c')],_0x5250b5,_['toLower']('default_favicon.ico'));var _0x477156='default'+_['upperFirst'](_0x8882('0x56'));if(_0x5c6f25[_0x477156]||!_0xf4c770[_0x8882('0x61')]){_0x37bb4e=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5250b5,_[_0x8882('0x5d')]('default_favicon.ico'));}if(!fs[_0x8882('0x5a')](_0x37bb4e)){throw new db[(_0x8882('0x62'))]['ValidationError'](_[_0x8882('0x60')](_0x8882('0x56'))+_0x8882('0x68'));}return _0x5d26c2[_0x8882('0x64')](_0x37bb4e);}})[_0x8882('0x4d')](handleError(_0x5d26c2,null));};exports[_0x8882('0x6d')]=function(_0x44b520,_0x3260e0){var _0x1891e1={'offset':moment()[_0x8882('0x6e')]()};_0x1891e1[_0x8882('0x6f')]=moment()[_0x8882('0x6e')](_0x1891e1[_0x8882('0x22')])[_0x8882('0x70')](_0x8882('0x71'));return _0x3260e0[_0x8882('0x20')](0xc8)[_0x8882('0x2f')](_0x1891e1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 674dbd6..81575b0 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x42f1e6,_0x372465){var _0xea2816=function(_0x20050e){while(--_0x20050e){_0x42f1e6['push'](_0x42f1e6['shift']());}};_0xea2816(++_0x372465);}(_0x008c,0x188));var _0xc008=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0x008c[_0x3baaf2];return _0x50e8b0;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 1139d9c..891de88 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 _0xfb13=['Setting','find','options','raw','include','model','attributes','map','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting'];(function(_0x203954,_0x50b29e){var _0x575a9b=function(_0x2f7d63){while(--_0x2f7d63){_0x203954['push'](_0x203954['shift']());}};_0x575a9b(++_0x50b29e);}(_0xfb13,0x116));var _0x3fb1=function(_0x4af269,_0x5c6903){_0x4af269=_0x4af269-0x0;var _0x4dbee8=_0xfb13[_0x4af269];return _0x4dbee8;};'use strict';var _=require(_0x3fb1('0x0'));var util=require(_0x3fb1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fb1('0x2'));var fs=require('fs');var Redis=require(_0x3fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fb1('0x4'));var logger=require(_0x3fb1('0x5'))(_0x3fb1('0x6'));var config=require(_0x3fb1('0x7'));var jayson=require(_0x3fb1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27eefa,_0x3c9c6e,_0xbab84b){return new BPromise(function(_0x6d46d2,_0x20e60c){return client[_0x3fb1('0x9')](_0x27eefa,_0xbab84b)[_0x3fb1('0xa')](function(_0x3ec2c0){logger[_0x3fb1('0xb')](_0x3fb1('0xc'),_0x3c9c6e,_0x3fb1('0xd'));logger[_0x3fb1('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x3c9c6e,_0x3fb1('0xd'),JSON[_0x3fb1('0xf')](_0x3ec2c0));if(_0x3ec2c0['error']){if(_0x3ec2c0[_0x3fb1('0x10')][_0x3fb1('0x11')]===0x1f4){logger[_0x3fb1('0x10')](_0x3fb1('0xc'),_0x3c9c6e,_0x3ec2c0['error'][_0x3fb1('0x12')]);return _0x20e60c(_0x3ec2c0[_0x3fb1('0x10')][_0x3fb1('0x12')]);}logger[_0x3fb1('0x10')](_0x3fb1('0xc'),_0x3c9c6e,_0x3ec2c0[_0x3fb1('0x10')][_0x3fb1('0x12')]);return _0x6d46d2(_0x3ec2c0[_0x3fb1('0x10')]['message']);}else{logger[_0x3fb1('0xb')](_0x3fb1('0xc'),_0x3c9c6e,_0x3fb1('0xd'));_0x6d46d2(_0x3ec2c0[_0x3fb1('0x13')][_0x3fb1('0x12')]);}})[_0x3fb1('0x14')](function(_0x14d850){logger[_0x3fb1('0x10')](_0x3fb1('0xc'),_0x3c9c6e,_0x14d850);_0x20e60c(_0x14d850);});});}exports[_0x3fb1('0x15')]=function(_0x5a80c0){var _0x4480b6=this;return new Promise(function(_0x49d885,_0x5d81b4){return db[_0x3fb1('0x16')][_0x3fb1('0x17')]({'raw':_0x5a80c0[_0x3fb1('0x18')]?_0x5a80c0[_0x3fb1('0x18')][_0x3fb1('0x19')]===undefined?!![]:![]:!![],'where':_0x5a80c0[_0x3fb1('0x18')]?_0x5a80c0[_0x3fb1('0x18')]['where']||null:null,'attributes':_0x5a80c0[_0x3fb1('0x18')]?_0x5a80c0[_0x3fb1('0x18')]['attributes']||null:null,'include':_0x5a80c0['options']?_0x5a80c0['options'][_0x3fb1('0x1a')]?_['map'](_0x5a80c0[_0x3fb1('0x18')][_0x3fb1('0x1a')],function(_0x24e59c){return{'model':db[_0x24e59c[_0x3fb1('0x1b')]],'as':_0x24e59c['as'],'attributes':_0x24e59c[_0x3fb1('0x1c')],'include':_0x24e59c[_0x3fb1('0x1a')]?_[_0x3fb1('0x1d')](_0x24e59c[_0x3fb1('0x1a')],function(_0x3e67e8){return{'model':db[_0x3e67e8[_0x3fb1('0x1b')]],'as':_0x3e67e8['as'],'attributes':_0x3e67e8[_0x3fb1('0x1c')],'include':_0x3e67e8[_0x3fb1('0x1a')]?_[_0x3fb1('0x1d')](_0x3e67e8[_0x3fb1('0x1a')],function(_0x3841b5){return{'model':db[_0x3841b5[_0x3fb1('0x1b')]],'as':_0x3841b5['as'],'attributes':_0x3841b5[_0x3fb1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d5b87){logger[_0x3fb1('0xb')](_0x3fb1('0x15'),_0x5a80c0);logger[_0x3fb1('0xe')](_0x3fb1('0x15'),_0x5a80c0,JSON['stringify'](_0x2d5b87));_0x49d885(_0x2d5b87);})[_0x3fb1('0x14')](function(_0x3d76e9){logger[_0x3fb1('0x10')](_0x3fb1('0x15'),_0x3d76e9[_0x3fb1('0x12')],_0x5a80c0);_0x5d81b4(_0x4480b6[_0x3fb1('0x10')](0x1f4,_0x3d76e9[_0x3fb1('0x12')]));});});}; \ No newline at end of file +var _0x4259=['error','code','message','result','catch','Setting','find','options','where','attributes','include','map','model','info','ShowSetting','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bc9f3,_0x160f7e){var _0x1bb67d=function(_0x2d15a7){while(--_0x2d15a7){_0x2bc9f3['push'](_0x2bc9f3['shift']());}};_0x1bb67d(++_0x160f7e);}(_0x4259,0x6a));var _0x9425=function(_0x4bbf78,_0x102916){_0x4bbf78=_0x4bbf78-0x0;var _0x354286=_0x4259[_0x4bbf78];return _0x354286;};'use strict';var _=require(_0x9425('0x0'));var util=require(_0x9425('0x1'));var moment=require(_0x9425('0x2'));var BPromise=require('bluebird');var rs=require(_0x9425('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9425('0x4'))['db'];var utils=require(_0x9425('0x5'));var logger=require(_0x9425('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9425('0x7'));var client=jayson['client'][_0x9425('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e3ab,_0x37a66d,_0x22f5ce){return new BPromise(function(_0x246d9f,_0xa18253){return client[_0x9425('0x9')](_0x3e3ab,_0x22f5ce)[_0x9425('0xa')](function(_0x27b27d){logger['info'](_0x9425('0xb'),_0x37a66d,_0x9425('0xc'));logger[_0x9425('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x37a66d,_0x9425('0xc'),JSON['stringify'](_0x27b27d));if(_0x27b27d[_0x9425('0xe')]){if(_0x27b27d['error'][_0x9425('0xf')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x37a66d,_0x27b27d[_0x9425('0xe')][_0x9425('0x10')]);return _0xa18253(_0x27b27d['error'][_0x9425('0x10')]);}logger[_0x9425('0xe')]('Setting,\x20%s,\x20%s',_0x37a66d,_0x27b27d['error'][_0x9425('0x10')]);return _0x246d9f(_0x27b27d[_0x9425('0xe')]['message']);}else{logger['info'](_0x9425('0xb'),_0x37a66d,'request\x20sent');_0x246d9f(_0x27b27d[_0x9425('0x11')][_0x9425('0x10')]);}})[_0x9425('0x12')](function(_0x237978){logger[_0x9425('0xe')](_0x9425('0xb'),_0x37a66d,_0x237978);_0xa18253(_0x237978);});});}exports['ShowSetting']=function(_0x10c857){var _0x537857=this;return new Promise(function(_0x2bc61f,_0x207a74){return db[_0x9425('0x13')][_0x9425('0x14')]({'raw':_0x10c857[_0x9425('0x15')]?_0x10c857['options']['raw']===undefined?!![]:![]:!![],'where':_0x10c857[_0x9425('0x15')]?_0x10c857[_0x9425('0x15')][_0x9425('0x16')]||null:null,'attributes':_0x10c857[_0x9425('0x15')]?_0x10c857['options'][_0x9425('0x17')]||null:null,'include':_0x10c857[_0x9425('0x15')]?_0x10c857['options'][_0x9425('0x18')]?_[_0x9425('0x19')](_0x10c857['options'][_0x9425('0x18')],function(_0x430b42){return{'model':db[_0x430b42[_0x9425('0x1a')]],'as':_0x430b42['as'],'attributes':_0x430b42['attributes'],'include':_0x430b42['include']?_['map'](_0x430b42['include'],function(_0x229d5){return{'model':db[_0x229d5[_0x9425('0x1a')]],'as':_0x229d5['as'],'attributes':_0x229d5[_0x9425('0x17')],'include':_0x229d5['include']?_[_0x9425('0x19')](_0x229d5['include'],function(_0x17cd5e){return{'model':db[_0x17cd5e[_0x9425('0x1a')]],'as':_0x17cd5e['as'],'attributes':_0x17cd5e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a444d){logger[_0x9425('0x1b')](_0x9425('0x1c'),_0x10c857);logger[_0x9425('0xd')](_0x9425('0x1c'),_0x10c857,JSON[_0x9425('0x1d')](_0x4a444d));_0x2bc61f(_0x4a444d);})[_0x9425('0x12')](function(_0xe2a629){logger[_0x9425('0xe')](_0x9425('0x1c'),_0xe2a629['message'],_0x10c857);_0x207a74(_0x537857['error'](0x1f4,_0xe2a629[_0x9425('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c4be607..65b6164 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x18a7c6,_0x4bf5ed){_0x18a7c6=_0x18a7c6-0x0;var _0x316139=_0xf494[_0x18a7c6];return _0x316139;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x326f,0xd1));var _0xf326=function(_0x46cc3b,_0x5317c5){_0x46cc3b=_0x46cc3b-0x0;var _0x23af92=_0x326f[_0x46cc3b];return _0x23af92;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a4f171f..f0e992e 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 _0xcfe4=['infobip','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','csc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcfe4,0x153));var _0x4cfe=function(_0x4b24cf,_0x19d1ff){_0x4b24cf=_0x4b24cf-0x0;var _0x65fd41=_0xcfe4[_0x4b24cf];return _0x65fd41;};'use strict';var Sequelize=require(_0x4cfe('0x0'));var rs=require(_0x4cfe('0x1'));module[_0x4cfe('0x2')]={'name':{'type':Sequelize[_0x4cfe('0x3')],'unique':_0x4cfe('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4cfe('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4cfe('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4cfe('0x5')]();}},'phone':{'type':Sequelize[_0x4cfe('0x3')]},'type':{'type':Sequelize[_0x4cfe('0x6')](_0x4cfe('0x7'),_0x4cfe('0x8'),_0x4cfe('0x9'),'clicksend',_0x4cfe('0xa'),_0x4cfe('0xb'),'bandwidth',_0x4cfe('0xc'),_0x4cfe('0xd'),_0x4cfe('0xe'))},'accountSid':{'type':Sequelize[_0x4cfe('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4cfe('0x3')]},'smsMethod':{'type':Sequelize[_0x4cfe('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4cfe('0x3')]},'password':{'type':Sequelize[_0x4cfe('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x4cfe('0x3')]},'senderString':{'type':Sequelize[_0x4cfe('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4cfe('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4cfe('0xf');}},'notificationSound':{'type':Sequelize[_0x4cfe('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4cfe('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4cfe('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4cfe('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4cfe('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cfe('0x11')],'comment':_0x4cfe('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4cfe('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x51a2d5){if(!_0x51a2d5)this[_0x4cfe('0x13')](_0x4cfe('0x14'),null);this[_0x4cfe('0x13')](_0x4cfe('0x15'),_0x51a2d5);}}}; \ No newline at end of file +var _0xce4c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x4b467a,_0x561eca){var _0x227662=function(_0x4329a1){while(--_0x4329a1){_0x4b467a['push'](_0x4b467a['shift']());}};_0x227662(++_0x561eca);}(_0xce4c,0x18b));var _0xcce4=function(_0x3027fd,_0x32c20c){_0x3027fd=_0x3027fd-0x0;var _0x3b3387=_0xce4c[_0x3027fd];return _0x3b3387;};'use strict';var Sequelize=require(_0xcce4('0x0'));var rs=require(_0xcce4('0x1'));module[_0xcce4('0x2')]={'name':{'type':Sequelize[_0xcce4('0x3')],'unique':_0xcce4('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcce4('0x5')]();}},'phone':{'type':Sequelize[_0xcce4('0x3')]},'type':{'type':Sequelize[_0xcce4('0x6')](_0xcce4('0x7'),'skebby',_0xcce4('0x8'),_0xcce4('0x9'),'plivo',_0xcce4('0xa'),_0xcce4('0xb'),_0xcce4('0xc'),_0xcce4('0xd'),_0xcce4('0xe'))},'accountSid':{'type':Sequelize[_0xcce4('0x3')]},'authId':{'type':Sequelize[_0xcce4('0x3')]},'authToken':{'type':Sequelize[_0xcce4('0x3')]},'smsMethod':{'type':Sequelize[_0xcce4('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcce4('0x3')]},'password':{'type':Sequelize[_0xcce4('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xcce4('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xcce4('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcce4('0x10')],'defaultValue':function(){return _0xcce4('0x11');}},'notificationSound':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcce4('0x12')],'comment':_0xcce4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![],'comment':_0xcce4('0x14'),'set':function(_0x1c039b){if(!_0x1c039b)this[_0xcce4('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcce4('0x16'),_0x1c039b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a7488d7..17be1e4 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 _0xfcaf=['util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','filter','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','pick','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','fromNumber','replyMessageId','intelepeer','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','findAndCountAll','getApplications','getInteractions','findOne','Owner','internal','Tag','Tags','color','tag','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','clickatell','bandwidth','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1b1925,_0x563f6b){var _0x3474f1=function(_0x3bda46){while(--_0x3bda46){_0x1b1925['push'](_0x1b1925['shift']());}};_0x3474f1(++_0x563f6b);}(_0xfcaf,0x1bb));var _0xffca=function(_0x4fdd37,_0x6ddb6){_0x4fdd37=_0x4fdd37-0x0;var _0x46d6d1=_0xfcaf[_0x4fdd37];return _0x46d6d1;};'use strict';var emlformat=require(_0xffca('0x0'));var rimraf=require(_0xffca('0x1'));var zipdir=require(_0xffca('0x2'));var jsonpatch=require(_0xffca('0x3'));var rp=require('request-promise');var moment=require(_0xffca('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xffca('0x5'));var path=require(_0xffca('0x6'));var sox=require(_0xffca('0x7'));var csv=require(_0xffca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffca('0x9'));var squel=require(_0xffca('0xa'));var crypto=require(_0xffca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xffca('0xc'));var toCsv=require(_0xffca('0x8'));var querystring=require(_0xffca('0xd'));var Papa=require('papaparse');var Redis=require(_0xffca('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xffca('0xf'));var hardwareService=require(_0xffca('0x10'));var logger=require(_0xffca('0x11'))('api');var utils=require(_0xffca('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xffca('0x13'));var db=require('../../mysqldb')['db'];config[_0xffca('0x14')]=_[_0xffca('0x15')](config[_0xffca('0x14')],{'host':_0xffca('0x16'),'port':0x18eb});var socket=require(_0xffca('0x17'))(new Redis(config[_0xffca('0x14')]));require(_0xffca('0x18'))[_0xffca('0x19')](socket);var jayson=require(_0xffca('0x1a'));var client=jayson[_0xffca('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x44f0df,_0x2aac38,_0x27165b,_0x45dfc7){return new BPromise(function(_0x451ecb,_0x50d9d7){var _0xd054af=_0x45dfc7||client;return _0xd054af[_0xffca('0x1c')](_0x44f0df,_0x27165b)['then'](function(_0x2af594){logger[_0xffca('0x1d')](_0xffca('0x1e'),_0x2aac38,_0xffca('0x1f'));logger['debug'](_0xffca('0x20'),_0x2aac38,_0xffca('0x1f'),JSON[_0xffca('0x21')](_0x2af594));if(_0x2af594[_0xffca('0x22')]){if(_0x2af594[_0xffca('0x22')][_0xffca('0x23')]===0x1f4){logger['error'](_0xffca('0x1e'),_0x2aac38,_0x2af594[_0xffca('0x22')][_0xffca('0x24')]);return _0x50d9d7(_0x2af594[_0xffca('0x22')][_0xffca('0x24')]);}logger[_0xffca('0x22')](_0xffca('0x1e'),_0x2aac38,_0x2af594['error'][_0xffca('0x24')]);return _0x451ecb(_0x2af594[_0xffca('0x22')][_0xffca('0x24')]);}else{logger[_0xffca('0x1d')](_0xffca('0x1e'),_0x2aac38,_0xffca('0x1f'));_0x451ecb(_0x2af594[_0xffca('0x25')]['message']);}})[_0xffca('0x26')](function(_0x3065e5){logger['error'](_0xffca('0x1e'),_0x2aac38,_0x3065e5);_0x50d9d7(_0x3065e5);});});}function respondWithStatusCode(_0x474f89,_0x5909fc){_0x5909fc=_0x5909fc||0xcc;return function(_0x538b02){if(_0x538b02){return _0x474f89[_0xffca('0x27')](_0x5909fc);}return _0x474f89[_0xffca('0x28')](_0x5909fc)[_0xffca('0x29')]();};}function respondWithResult(_0x29f545,_0x47e850){_0x47e850=_0x47e850||0xc8;return function(_0x4158b3){if(_0x4158b3){return _0x29f545[_0xffca('0x28')](_0x47e850)[_0xffca('0x2a')](_0x4158b3);}};}function respondWithFilteredResult(_0x49a3b7,_0x330738){return function(_0x3b30ff){if(_0x3b30ff){var _0x4ee84d=typeof _0x330738[_0xffca('0x2b')]===_0xffca('0x2c')&&typeof _0x330738[_0xffca('0x2d')]==='undefined';var _0x9ddd72=_0x3b30ff[_0xffca('0x2e')];var _0x3587e6=_0x4ee84d?0x0:_0x330738[_0xffca('0x2b')];var _0x154099=_0x4ee84d?_0x3b30ff['count']:_0x330738[_0xffca('0x2b')]+_0x330738[_0xffca('0x2d')];var _0x5ab940;if(_0x154099>=_0x9ddd72){_0x154099=_0x9ddd72;_0x5ab940=0xc8;}else{_0x5ab940=0xce;}_0x49a3b7[_0xffca('0x28')](_0x5ab940);return _0x49a3b7[_0xffca('0x2f')](_0xffca('0x30'),_0x3587e6+'-'+_0x154099+'/'+_0x9ddd72)[_0xffca('0x2a')](_0x3b30ff);}return null;};}function patchUpdates(_0x45cb69){return function(_0x128df8){try{jsonpatch[_0xffca('0x31')](_0x128df8,_0x45cb69,!![]);}catch(_0x1c1b2a){return BPromise['reject'](_0x1c1b2a);}return _0x128df8[_0xffca('0x32')]();};}function saveUpdates(_0x5c2e25,_0x369b5c){return function(_0x3e07c0){if(_0x3e07c0){return _0x3e07c0[_0xffca('0x33')](_0x5c2e25)[_0xffca('0x34')](function(_0x46aca2){return _0x46aca2;});}return null;};}function removeEntity(_0x2dba98,_0x1ec335){return function(_0x3575df){if(_0x3575df){return _0x3575df['destroy']()[_0xffca('0x34')](function(){var _0x5d9250=_0x3575df[_0xffca('0x35')]({'plain':!![]});var _0x5d8803=_0xffca('0x36');return db[_0xffca('0x37')][_0xffca('0x38')]({'where':{'type':_0x5d8803,'resourceId':_0x5d9250['id']}})[_0xffca('0x34')](function(){return _0x3575df;});})[_0xffca('0x34')](function(){_0x2dba98[_0xffca('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eccf1,_0x36e941){return function(_0x4f3481){if(!_0x4f3481){_0x5eccf1[_0xffca('0x27')](0x194);}return _0x4f3481;};}function handleError(_0x34fdbd,_0xbf9095){_0xbf9095=_0xbf9095||0x1f4;return function(_0x4aeaa7){logger[_0xffca('0x22')](_0x4aeaa7[_0xffca('0x39')]);if(_0x4aeaa7[_0xffca('0x3a')]){delete _0x4aeaa7[_0xffca('0x3a')];}_0x34fdbd[_0xffca('0x28')](_0xbf9095)[_0xffca('0x3b')](_0x4aeaa7);};}exports['index']=function(_0x145226,_0x8361f5){var _0x4188cb={'include':[{'model':db[_0xffca('0x3c')],'as':_0xffca('0x3d')}]},_0x1c9bbb={},_0x490114={'count':0x0,'rows':[]};var _0x4696a3=_['map'](db[_0xffca('0x3e')][_0xffca('0x3f')],function(_0x480b8a){return{'name':_0x480b8a[_0xffca('0x40')],'type':_0x480b8a['type'][_0xffca('0x41')]};});_0x1c9bbb[_0xffca('0x42')]=_[_0xffca('0x43')](_0x4696a3,_0xffca('0x3a'));_0x1c9bbb[_0xffca('0x44')]=_['keys'](_0x145226[_0xffca('0x44')]);_0x1c9bbb[_0xffca('0x45')]=_[_0xffca('0x46')](_0x1c9bbb['model'],_0x1c9bbb[_0xffca('0x44')]);_0x4188cb[_0xffca('0x47')]=_[_0xffca('0x46')](_0x1c9bbb[_0xffca('0x42')],qs[_0xffca('0x48')](_0x145226[_0xffca('0x44')]['fields']));_0x4188cb[_0xffca('0x47')]=_0x4188cb[_0xffca('0x47')]['length']?_0x4188cb[_0xffca('0x47')]:_0x1c9bbb[_0xffca('0x42')];if(!_0x145226['query'][_0xffca('0x49')](_0xffca('0x4a'))){_0x4188cb['limit']=qs['limit'](_0x145226['query'][_0xffca('0x2d')]);_0x4188cb[_0xffca('0x2b')]=qs[_0xffca('0x2b')](_0x145226[_0xffca('0x44')][_0xffca('0x2b')]);}_0x4188cb[_0xffca('0x4b')]=qs[_0xffca('0x4c')](_0x145226['query'][_0xffca('0x4c')]);_0x4188cb[_0xffca('0x4d')]=qs[_0xffca('0x45')](_['pick'](_0x145226[_0xffca('0x44')],_0x1c9bbb[_0xffca('0x45')]),_0x4696a3);if(_0x145226[_0xffca('0x44')]['filter']){_0x4188cb[_0xffca('0x4d')]=_[_0xffca('0x4e')](_0x4188cb[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0x4696a3,function(_0x59f449){if(_0x59f449[_0xffca('0x4f')]!==_0xffca('0x50')){var _0x1058a2={};_0x1058a2[_0x59f449[_0xffca('0x3a')]]={'$like':'%'+_0x145226[_0xffca('0x44')]['filter']+'%'};return _0x1058a2;}})});}_0x4188cb=_[_0xffca('0x4e')]({},_0x4188cb,_0x145226[_0xffca('0x51')]);var _0x2b4c21={'where':_0x4188cb[_0xffca('0x4d')]};return db[_0xffca('0x3e')][_0xffca('0x2e')](_0x2b4c21)[_0xffca('0x34')](function(_0x5baba8){_0x490114['count']=_0x5baba8;if(_0x145226[_0xffca('0x44')][_0xffca('0x52')]){_0x4188cb[_0xffca('0x53')]=[{'all':!![]}];}return db[_0xffca('0x3e')][_0xffca('0x54')](_0x4188cb);})[_0xffca('0x34')](function(_0x4594f3){_0x490114[_0xffca('0x55')]=_0x4594f3;return _0x490114;})[_0xffca('0x34')](respondWithFilteredResult(_0x8361f5,_0x4188cb))[_0xffca('0x26')](handleError(_0x8361f5,null));};exports[_0xffca('0x56')]=function(_0xf3e058,_0x4dd645){var _0x3973a2={'raw':![],'where':{'id':_0xf3e058['params']['id']},'include':[{'model':db[_0xffca('0x3c')],'as':_0xffca('0x3d')}]},_0x167492={};_0x167492[_0xffca('0x42')]=_[_0xffca('0x57')](db[_0xffca('0x3e')][_0xffca('0x3f')]);_0x167492[_0xffca('0x44')]=_['keys'](_0xf3e058[_0xffca('0x44')]);_0x167492[_0xffca('0x45')]=_['intersection'](_0x167492[_0xffca('0x42')],_0x167492['query']);_0x3973a2['attributes']=_['intersection'](_0x167492[_0xffca('0x42')],qs[_0xffca('0x48')](_0xf3e058['query'][_0xffca('0x48')]));_0x3973a2['attributes']=_0x3973a2[_0xffca('0x47')][_0xffca('0x58')]?_0x3973a2[_0xffca('0x47')]:_0x167492[_0xffca('0x42')];if(_0xf3e058[_0xffca('0x44')]['includeAll']){_0x3973a2[_0xffca('0x53')]=[{'all':!![]}];}_0x3973a2=_[_0xffca('0x4e')]({},_0x3973a2,_0xf3e058[_0xffca('0x51')]);return db['SmsAccount'][_0xffca('0x59')](_0x3973a2)[_0xffca('0x34')](handleEntityNotFound(_0x4dd645,null))['then'](respondWithResult(_0x4dd645,null))[_0xffca('0x26')](handleError(_0x4dd645,null));};exports[_0xffca('0x5a')]=function(_0x10a0ad,_0x1f3028){return db[_0xffca('0x3e')][_0xffca('0x5a')](_0x10a0ad[_0xffca('0x5b')],{})[_0xffca('0x34')](function(_0x42fb5b){var _0x2945c5=_0x10a0ad[_0xffca('0x5c')]['get']({'plain':!![]});if(!_0x2945c5)throw new Error(_0xffca('0x5d'));if(_0x2945c5[_0xffca('0x5e')]===_0xffca('0x5c')){var _0x5cedc9=_0x42fb5b[_0xffca('0x35')]({'plain':!![]});var _0x12d8fd=_0xffca('0x36');return db[_0xffca('0x5f')][_0xffca('0x59')]({'where':{'name':_0x12d8fd,'userProfileId':_0x2945c5['userProfileId']},'raw':!![]})[_0xffca('0x34')](function(_0x541e75){if(_0x541e75&&_0x541e75['autoAssociation']===0x0){return db[_0xffca('0x37')][_0xffca('0x5a')]({'name':_0x5cedc9['name'],'resourceId':_0x5cedc9['id'],'type':_0x541e75[_0xffca('0x3a')],'sectionId':_0x541e75['id']},{})['then'](function(){return _0x42fb5b;});}else{return _0x42fb5b;}})[_0xffca('0x26')](function(_0x46f705){logger['error'](_0xffca('0x60'),_0x46f705);throw _0x46f705;});}return _0x42fb5b;})[_0xffca('0x34')](respondWithResult(_0x1f3028,0xc9))['catch'](handleError(_0x1f3028,null));};exports[_0xffca('0x33')]=function(_0xf02442,_0x5abc53){if(_0xf02442[_0xffca('0x5b')]['id']){delete _0xf02442[_0xffca('0x5b')]['id'];}return db['SmsAccount'][_0xffca('0x59')]({'where':{'id':_0xf02442[_0xffca('0x61')]['id']},'include':[{'model':db[_0xffca('0x3c')],'as':_0xffca('0x3d')}]})[_0xffca('0x34')](handleEntityNotFound(_0x5abc53,null))['then'](saveUpdates(_0xf02442[_0xffca('0x5b')],null))[_0xffca('0x34')](respondWithResult(_0x5abc53,null))['catch'](handleError(_0x5abc53,null));};exports['destroy']=function(_0x1f48cc,_0x461ccf){return db[_0xffca('0x3e')]['find']({'where':{'id':_0x1f48cc[_0xffca('0x61')]['id']}})['then'](handleEntityNotFound(_0x461ccf,null))[_0xffca('0x34')](removeEntity(_0x461ccf,null))[_0xffca('0x26')](handleError(_0x461ccf,null));};exports['describe']=function(_0x3be0e8,_0x31dd61){return db[_0xffca('0x3e')][_0xffca('0x62')]()[_0xffca('0x34')](respondWithResult(_0x31dd61,null))['catch'](handleError(_0x31dd61,null));};exports['addDisposition']=function(_0x2521c2,_0x2158bb,_0x204ea8){if(_0x2521c2['body']['id']){delete _0x2521c2[_0xffca('0x5b')]['id'];}return db[_0xffca('0x3e')]['find']({'where':{'id':_0x2521c2[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x2158bb,null))[_0xffca('0x34')](function(_0x3ff597){if(_0x3ff597){_0x2521c2[_0xffca('0x5b')]['SmsAccountId']=_0x3ff597['id'];return db[_0xffca('0x63')][_0xffca('0x5a')](_0x2521c2[_0xffca('0x5b')]);}})[_0xffca('0x34')](respondWithResult(_0x2158bb,null))[_0xffca('0x26')](handleError(_0x2158bb,null));};exports[_0xffca('0x64')]=function(_0x241ed8,_0x1e9f69,_0x8020d9){var _0xb9330b={'raw':![],'where':{}};var _0x5ac4cb={};var _0x48ade5={'count':0x0,'rows':[]};return db[_0xffca('0x3e')]['findOne']({'where':{'id':_0x241ed8[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x1e9f69,null))['then'](function(_0xce96fc){if(_0xce96fc){_0x5ac4cb[_0xffca('0x42')]=_[_0xffca('0x57')](db['Disposition'][_0xffca('0x3f')]);_0x5ac4cb[_0xffca('0x44')]=_[_0xffca('0x57')](_0x241ed8['query']);_0x5ac4cb[_0xffca('0x45')]=_[_0xffca('0x46')](_0x5ac4cb['model'],_0x5ac4cb['query']);_0xb9330b[_0xffca('0x47')]=_['intersection'](_0x5ac4cb[_0xffca('0x42')],qs[_0xffca('0x48')](_0x241ed8['query'][_0xffca('0x48')]));_0xb9330b['attributes']=_0xb9330b[_0xffca('0x47')]['length']?_0xb9330b[_0xffca('0x47')]:_0x5ac4cb['model'];if(!_0x241ed8[_0xffca('0x44')]['hasOwnProperty']('nolimit')){_0xb9330b['limit']=qs['limit'](_0x241ed8[_0xffca('0x44')][_0xffca('0x2d')]);_0xb9330b['offset']=qs[_0xffca('0x2b')](_0x241ed8[_0xffca('0x44')][_0xffca('0x2b')]);}_0xb9330b['order']=qs[_0xffca('0x4c')](_0x241ed8[_0xffca('0x44')][_0xffca('0x4c')]);_0xb9330b[_0xffca('0x4d')]=qs[_0xffca('0x45')](_['pick'](_0x241ed8[_0xffca('0x44')],_0x5ac4cb[_0xffca('0x45')]));_0xb9330b[_0xffca('0x4d')]['SmsAccountId']=_0xce96fc['id'];if(_0x241ed8[_0xffca('0x44')][_0xffca('0x65')]){_0xb9330b[_0xffca('0x4d')]=_[_0xffca('0x4e')](_0xb9330b[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0xb9330b[_0xffca('0x47')],function(_0x3d4dec){var _0x19b025={};_0x19b025[_0x3d4dec]={'$like':'%'+_0x241ed8[_0xffca('0x44')][_0xffca('0x65')]+'%'};return _0x19b025;})});}_0xb9330b=_[_0xffca('0x4e')]({},_0xb9330b,_0x241ed8[_0xffca('0x51')]);return db[_0xffca('0x63')]['count']({'where':_0xb9330b['where']})['then'](function(_0x49e9e1){_0x48ade5['count']=_0x49e9e1;if(_0x241ed8[_0xffca('0x44')]['includeAll']){_0xb9330b[_0xffca('0x53')]=[{'all':!![]}];}return db[_0xffca('0x63')]['findAll'](_0xb9330b);})[_0xffca('0x34')](function(_0x506046){_0x48ade5[_0xffca('0x55')]=_0x506046;return _0x48ade5;});}})[_0xffca('0x34')](respondWithFilteredResult(_0x1e9f69,_0xb9330b))[_0xffca('0x26')](handleError(_0x1e9f69,null));};exports[_0xffca('0x66')]=function(_0x345c92,_0x2e8e7a,_0x5b0d72){return db[_0xffca('0x3e')][_0xffca('0x59')]({'where':{'id':_0x345c92[_0xffca('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e8e7a,null))[_0xffca('0x34')](function(_0x1d14e5){if(_0x1d14e5){return _0x1d14e5[_0xffca('0x66')](_0x345c92['query'][_0xffca('0x67')]);}})[_0xffca('0x34')](respondWithStatusCode(_0x2e8e7a,null))[_0xffca('0x26')](handleError(_0x2e8e7a,null));};exports[_0xffca('0x68')]=function(_0xb3adf8,_0x17bb5f,_0xda4d){if(_0xb3adf8[_0xffca('0x5b')]['id']){delete _0xb3adf8[_0xffca('0x5b')]['id'];}return db[_0xffca('0x3e')]['find']({'where':{'id':_0xb3adf8[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x17bb5f,null))[_0xffca('0x34')](function(_0x47b67c){if(_0x47b67c){_0xb3adf8[_0xffca('0x5b')][_0xffca('0x69')]=_0x47b67c['id'];return db[_0xffca('0x6a')]['create'](_0xb3adf8[_0xffca('0x5b')]);}})[_0xffca('0x34')](respondWithResult(_0x17bb5f,null))[_0xffca('0x26')](handleError(_0x17bb5f,null));};exports['getAnswers']=function(_0x37644a,_0x366324,_0x2f4e1a){var _0x1b8c22={'raw':![],'where':{}};var _0x47f0ca={};var _0x55980d={'count':0x0,'rows':[]};return db[_0xffca('0x3e')]['findOne']({'where':{'id':_0x37644a[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x366324,null))[_0xffca('0x34')](function(_0x39a2c8){if(_0x39a2c8){_0x47f0ca['model']=_['keys'](db[_0xffca('0x6a')]['rawAttributes']);_0x47f0ca[_0xffca('0x44')]=_[_0xffca('0x57')](_0x37644a[_0xffca('0x44')]);_0x47f0ca[_0xffca('0x45')]=_[_0xffca('0x46')](_0x47f0ca[_0xffca('0x42')],_0x47f0ca[_0xffca('0x44')]);_0x1b8c22[_0xffca('0x47')]=_['intersection'](_0x47f0ca[_0xffca('0x42')],qs[_0xffca('0x48')](_0x37644a[_0xffca('0x44')][_0xffca('0x48')]));_0x1b8c22['attributes']=_0x1b8c22[_0xffca('0x47')][_0xffca('0x58')]?_0x1b8c22['attributes']:_0x47f0ca[_0xffca('0x42')];if(!_0x37644a[_0xffca('0x44')][_0xffca('0x49')](_0xffca('0x4a'))){_0x1b8c22[_0xffca('0x2d')]=qs[_0xffca('0x2d')](_0x37644a['query']['limit']);_0x1b8c22[_0xffca('0x2b')]=qs[_0xffca('0x2b')](_0x37644a[_0xffca('0x44')][_0xffca('0x2b')]);}_0x1b8c22[_0xffca('0x4b')]=qs['sort'](_0x37644a[_0xffca('0x44')][_0xffca('0x4c')]);_0x1b8c22[_0xffca('0x4d')]=qs[_0xffca('0x45')](_[_0xffca('0x6b')](_0x37644a[_0xffca('0x44')],_0x47f0ca[_0xffca('0x45')]));_0x1b8c22[_0xffca('0x4d')]['SmsAccountId']=_0x39a2c8['id'];if(_0x37644a['query'][_0xffca('0x65')]){_0x1b8c22[_0xffca('0x4d')]=_['merge'](_0x1b8c22[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0x1b8c22[_0xffca('0x47')],function(_0x55cd63){var _0x15ea7b={};_0x15ea7b[_0x55cd63]={'$like':'%'+_0x37644a['query'][_0xffca('0x65')]+'%'};return _0x15ea7b;})});}_0x1b8c22=_[_0xffca('0x4e')]({},_0x1b8c22,_0x37644a[_0xffca('0x51')]);return db[_0xffca('0x6a')][_0xffca('0x2e')]({'where':_0x1b8c22[_0xffca('0x4d')]})[_0xffca('0x34')](function(_0x4397bb){_0x55980d[_0xffca('0x2e')]=_0x4397bb;if(_0x37644a[_0xffca('0x44')]['includeAll']){_0x1b8c22['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xffca('0x54')](_0x1b8c22);})[_0xffca('0x34')](function(_0x46e720){_0x55980d[_0xffca('0x55')]=_0x46e720;return _0x55980d;});}})[_0xffca('0x34')](respondWithFilteredResult(_0x366324,_0x1b8c22))[_0xffca('0x26')](handleError(_0x366324,null));};exports[_0xffca('0x6c')]=function(_0x55f181,_0x3a7f63,_0x1a6cb0){return db[_0xffca('0x3e')][_0xffca('0x59')]({'where':{'id':_0x55f181[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x3a7f63,null))['then'](function(_0x3b7ac5){if(_0x3b7ac5){return _0x3b7ac5[_0xffca('0x6c')](_0x55f181[_0xffca('0x44')][_0xffca('0x67')]);}})[_0xffca('0x34')](respondWithStatusCode(_0x3a7f63,null))['catch'](handleError(_0x3a7f63,null));};exports[_0xffca('0x6d')]=function(_0x4fd0bb,_0x1b65fd,_0x2516ea){var _0x4bf400={'channel':_0xffca('0x6e')};var _0x2b35a9=[];var _0x737a68=[];var _0x4a7874={};return db[_0xffca('0x3e')]['find']({'where':{'id':_0x4fd0bb[_0xffca('0x61')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xffca('0x6f')}]})[_0xffca('0x34')](handleEntityNotFound(_0x1b65fd,null))[_0xffca('0x34')](function(_0x297f72){_0x4bf400[_0xffca('0x70')]=_0x297f72;_0x4bf400[_0xffca('0x71')]=_[_0xffca('0x72')](_0x297f72[_0xffca('0x6f')],[_0xffca('0x73')],[_0xffca('0x74')]);if(_0x4bf400['account'][_0xffca('0x6f')]){delete _0x4bf400[_0xffca('0x70')][_0xffca('0x6f')];}return db[_0xffca('0x75')]['describe']();})[_0xffca('0x34')](function(_0x523038){if(!_0x523038){throw new db[(_0xffca('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0x2b35a9=_[_0xffca('0x77')](_['keys'](_0x523038),[_0xffca('0x78'),'updatedAt']);_0x737a68=_[_0xffca('0x77')](_['keys'](_0x523038),[_0xffca('0x78'),_0xffca('0x79'),_0xffca('0x7a'),_0xffca('0x7b')]);_0x4bf400['body']={'mapKey':'mobile'};if(_0x4bf400[_0xffca('0x70')][_0xffca('0x4f')]){switch(_0x4bf400[_0xffca('0x70')][_0xffca('0x4f')]){case _0xffca('0x7c'):_0x4bf400['body'][_0xffca('0x7d')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x7e')];_0x4bf400['body']['body']=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x7f')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x81')];break;case'skebby':_0x4bf400[_0xffca('0x5b')]['from']='+'+_0x4fd0bb[_0xffca('0x5b')]['sender'];_0x4bf400['body']['body']=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x82')];break;case _0xffca('0x83'):_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')]=_0x4fd0bb['body'][_0xffca('0x7d')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x24')];break;case _0xffca('0x84'):_0x4bf400['body']['from']=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x7d')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x5b')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb['body'][_0xffca('0x85')];break;case _0xffca('0x86'):_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x7e')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb['body'][_0xffca('0x87')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x88')];break;case'infobip':_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')]='+'+_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x89')][0x0]['from'];_0x4bf400['body'][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x89')][0x0]['text'];_0x4bf400[_0xffca('0x5b')]['messageId']=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x89')][0x0][_0xffca('0x80')];break;case _0xffca('0x8a'):_0x4bf400[_0xffca('0x5b')]['from']=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x8b')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')]['segmentedMessage'][_0xffca('0x24')];break;case'clickatell':_0x4bf400[_0xffca('0x5b')]['from']=_0x4fd0bb['body'][_0xffca('0x8c')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')][_0xffca('0x82')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb['body'][_0xffca('0x8d')];break;case'bandwidth':_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb['body'][0x0]['message']['id'];_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')]=_0x4fd0bb[_0xffca('0x5b')][0x0]['message'][_0xffca('0x7d')];_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')][0x0][_0xffca('0x24')][_0xffca('0x82')];break;case _0xffca('0x8e'):_0x4bf400[_0xffca('0x5b')]['from']=_0x4fd0bb['body'][_0xffca('0x7d')];_0x4bf400['body'][_0xffca('0x5b')]=_0x4fd0bb[_0xffca('0x5b')]['message'];_0x4bf400[_0xffca('0x5b')][_0xffca('0x80')]=_0x4fd0bb['body']['refid'];break;}}if(_0x4bf400['body']['id']){delete _0x4bf400['body']['id'];}if(_[_0xffca('0x8f')](_0x4bf400['body'][_0xffca('0x7d')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')])||_0x4bf400['body']['body']===''){throw new db[(_0xffca('0x76'))][(_0xffca('0x90'))](_0xffca('0x91'));}if(_[_0xffca('0x8f')](_0x4bf400[_0xffca('0x5b')][_0xffca('0x92')])){throw new db[(_0xffca('0x76'))][(_0xffca('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x737a68);}if(!_[_0xffca('0x93')](_0x737a68,_0x4bf400[_0xffca('0x5b')][_0xffca('0x92')])){throw new db[(_0xffca('0x76'))][(_0xffca('0x90'))](_0xffca('0x94')+_0x737a68);}_0x4a7874[_0x4bf400[_0xffca('0x5b')]['mapKey']]=_0x4bf400['body'][_0xffca('0x7d')];return db['CmList'][_0xffca('0x59')]({'where':{'id':_0x4bf400['account'][_0xffca('0x7b')]},'include':[{'model':db[_0xffca('0x75')],'as':_0xffca('0x95'),'where':_0x4a7874,'limit':0x1,'order':[[_0xffca('0x79'),_0xffca('0x96')]]}]});})['then'](handleEntityNotFound(_0x1b65fd,null))[_0xffca('0x34')](function(_0xedef11){if(_0xedef11){_0x4bf400[_0xffca('0x97')]=_[_0xffca('0x98')](_0xedef11,['Contacts']);if(_0xedef11[_0xffca('0x95')][_0xffca('0x58')]){return _0xedef11[_0xffca('0x95')][0x0];}var _0x36408f=_[_0xffca('0x15')](_0x4bf400['body'],{'firstName':_0x4bf400['body']['from'],'ListId':_0xedef11['id']});_0x36408f[_0x4bf400[_0xffca('0x5b')][_0xffca('0x92')]]=_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')];return db[_0xffca('0x75')]['create'](_0x36408f,{'fields':_0x2b35a9,'raw':!![]});}})[_0xffca('0x34')](handleEntityNotFound(_0x1b65fd,null))[_0xffca('0x34')](function(_0x595c4c){if(_0x595c4c){_0x4bf400['contact']=_0x595c4c;var _0x4ffe01={'ContactId':_0x595c4c['id'],'phone':_0x4bf400['body'][_0xffca('0x7d')],'SmsAccountId':_0x4fd0bb['params']['id']};var _0x3faf82={'ContactId':_0x595c4c['id'],'SmsAccountId':_0x4fd0bb[_0xffca('0x61')]['id'],'closed':![]};return db[_0xffca('0x99')][_0xffca('0x59')]({'where':_0x3faf82})[_0xffca('0x34')](function(_0x5d6326){if(_0x5d6326){return[_0x5d6326,![]];}return db['SmsInteraction'][_0xffca('0x5a')](_0x4ffe01)[_0xffca('0x34')](function(_0xa76ede){return[_0xa76ede,!![]];});});}})[_0xffca('0x9a')](function(_0x2e2f03,_0x69c808){_0x4bf400[_0xffca('0x9b')]=_0x2e2f03[_0xffca('0x35')]({'plain':!![]});_0x4bf400[_0xffca('0x9b')]['created']=![];if(_0x69c808){if(_0x4bf400[_0xffca('0x70')][_0xffca('0x9c')]){_0x4bf400[_0xffca('0x71')][_0xffca('0x9d')]({'id':0x0,'priority':_0x4bf400['applications'][_0xffca('0x58')]+0x1,'app':_0xffca('0x9e'),'appdata':_0xffca('0x9f'),'interval':'*,*,*,*'});}_0x4bf400[_0xffca('0x9b')][_0xffca('0xa0')]=!![];}return db[_0xffca('0xa1')][_0xffca('0x5a')]({'phone':_0x4bf400[_0xffca('0x5b')][_0xffca('0x7d')],'messageId':_0x4bf400['body']['messageId'],'body':_0x4bf400[_0xffca('0x5b')][_0xffca('0x5b')],'SmsAccountId':_0x4fd0bb[_0xffca('0x61')]['id'],'SmsInteractionId':_0x2e2f03['id'],'direction':'in','ContactId':_0x2e2f03[_0xffca('0xa2')],'AttachmentId':_0x4bf400[_0xffca('0x5b')][_0xffca('0xa3')]});})[_0xffca('0x34')](function(_0x540d45){_0x4bf400[_0xffca('0x24')]=_0x540d45;if(_0x4bf400[_0xffca('0x9b')]['UserId']){return db[_0xffca('0xa4')]['find']({'attributes':['id',_0xffca('0x3a')],'where':{'id':_0x4bf400[_0xffca('0x9b')]['UserId']}})[_0xffca('0x34')](function(_0x4f9868){if(_0x4f9868){_0x4bf400[_0xffca('0x71')][_0xffca('0xa5')]({'id':0x0,'priority':0x0,'app':_0xffca('0xa6'),'appdata':_0x4f9868[_0xffca('0x3a')]+','+(_0x4bf400[_0xffca('0x70')][_0xffca('0xa7')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xffca('0xa8'),_0xffca('0xa9'),_0x4bf400);});}return respondWithRpcPromise(_0xffca('0xa8'),_0xffca('0xa9'),_0x4bf400);})[_0xffca('0x34')](function(_0x2580d8){if(_0x2580d8){var _0x55bc5d=0xc8;var _0x4b960b=_0xffca('0xaa');logger[_0xffca('0x1d')](_0xffca('0x20'),_0x4b960b,_0x55bc5d,_0xffca('0xab'));logger[_0xffca('0xac')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4b960b,_0x55bc5d,_0xffca('0xab'),JSON['stringify'](_0x2580d8));if(_0x4bf400['account'][_0xffca('0x4f')]===_0xffca('0x7c')){return _0x1b65fd['status'](_0x55bc5d)[_0xffca('0x2f')]('Content-Type',_0xffca('0xad'))['send'](_0xffca('0xae'));}else{return _0x1b65fd[_0xffca('0x28')](_0x55bc5d)['json'](_0x2580d8);}}})[_0xffca('0x26')](handleError(_0x1b65fd,null));};exports[_0xffca('0xaf')]=function(_0xad77cc,_0x5a336c){var _0x3f4770=_0xad77cc['params']['id'];var _0x25ba1d=_0xad77cc[_0xffca('0x5b')];var _0xb9e83f=0xc8;var _0x4a4c79=null;return db[_0xffca('0xb0')][_0xffca('0xb1')]({'isolationLevel':db[_0xffca('0xb0')]['Transaction'][_0xffca('0xb2')][_0xffca('0xb3')]},function(_0x444df6){return db['SmsAccount']['findOne']({'where':{'id':_0x3f4770},'transaction':_0x444df6})[_0xffca('0x34')](function(_0x23e2fa){if(_0x23e2fa){return db[_0xffca('0xb4')][_0xffca('0x38')]({'where':{'SmsAccountId':_0x3f4770},'transaction':_0x444df6})[_0xffca('0x34')](function(){var _0x3d7f51=_['map'](_0x25ba1d,function(_0x5ba110){_0x5ba110[_0xffca('0x69')]=_0x3f4770;return _0x5ba110;});return db[_0xffca('0xb4')]['bulkCreate'](_0x3d7f51,{'transaction':_0x444df6});});}else{_0xb9e83f=0x194;_0x4a4c79=[];}});})[_0xffca('0x34')](function(){if(_0xb9e83f!==0x194){return db['SmsApplication'][_0xffca('0xb5')]({'where':{'SmsAccountId':_0x3f4770},'order':_0xffca('0x73')})['then'](function(_0x2ca491){_0x4a4c79=_0x2ca491;});}})['catch'](function(_0x45694c){_0xb9e83f=0x1f4;logger[_0xffca('0x22')](_0x45694c[_0xffca('0x39')]);if(_0x45694c[_0xffca('0x3a')]){delete _0x45694c[_0xffca('0x3a')];}_0x4a4c79=_0x45694c;})['finally'](function(){if(_0x4a4c79===null){_0x5a336c[_0xffca('0x27')](_0xb9e83f);}else{if(_0xb9e83f===0x1f4){_0x5a336c['status'](_0xb9e83f)[_0xffca('0x3b')](_0x4a4c79);}else{_0x5a336c[_0xffca('0x28')](_0xb9e83f)[_0xffca('0x2a')](_0x4a4c79);}}});};exports[_0xffca('0xb6')]=function(_0x1a1cc6,_0x26d980,_0x3f03b){var _0x4dd385={};var _0x2abe01={};var _0x519705;var _0x56a7e4;return db['SmsAccount']['findOne']({'where':{'id':_0x1a1cc6[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x26d980,null))['then'](function(_0x74409){if(_0x74409){_0x519705=_0x74409;_0x2abe01[_0xffca('0x42')]=_[_0xffca('0x57')](db[_0xffca('0xb4')][_0xffca('0x3f')]);_0x2abe01[_0xffca('0x44')]=_[_0xffca('0x57')](_0x1a1cc6[_0xffca('0x44')]);_0x2abe01[_0xffca('0x45')]=_[_0xffca('0x46')](_0x2abe01['model'],_0x2abe01[_0xffca('0x44')]);_0x4dd385[_0xffca('0x47')]=_[_0xffca('0x46')](_0x2abe01['model'],qs['fields'](_0x1a1cc6[_0xffca('0x44')][_0xffca('0x48')]));_0x4dd385['attributes']=_0x4dd385['attributes'][_0xffca('0x58')]?_0x4dd385[_0xffca('0x47')]:_0x2abe01['model'];_0x4dd385[_0xffca('0x4b')]=qs[_0xffca('0x4c')](_0x1a1cc6[_0xffca('0x44')][_0xffca('0x4c')]);_0x4dd385[_0xffca('0x4d')]=qs[_0xffca('0x45')](_[_0xffca('0x6b')](_0x1a1cc6[_0xffca('0x44')],_0x2abe01[_0xffca('0x45')]));if(_0x1a1cc6['query'][_0xffca('0x65')]){_0x4dd385['where']=_['merge'](_0x4dd385[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0x4dd385[_0xffca('0x47')],function(_0x2e385f){var _0x3a5aac={};_0x3a5aac[_0x2e385f]={'$like':'%'+_0x1a1cc6['query'][_0xffca('0x65')]+'%'};return _0x3a5aac;})});}_0x4dd385=_['merge']({},_0x4dd385,_0x1a1cc6[_0xffca('0x51')]);return _0x519705[_0xffca('0xb6')](_0x4dd385);}})[_0xffca('0x34')](function(_0x1e31e6){if(_0x1e31e6){_0x56a7e4=_0x1e31e6[_0xffca('0x58')];if(!_0x1a1cc6['query'][_0xffca('0x49')](_0xffca('0x4a'))){_0x4dd385[_0xffca('0x2d')]=qs[_0xffca('0x2d')](_0x1a1cc6[_0xffca('0x44')][_0xffca('0x2d')]);_0x4dd385[_0xffca('0x2b')]=qs[_0xffca('0x2b')](_0x1a1cc6[_0xffca('0x44')][_0xffca('0x2b')]);}return _0x519705[_0xffca('0xb6')](_0x4dd385);}})[_0xffca('0x34')](function(_0x4205b9){if(_0x4205b9){return _0x4205b9?{'count':_0x56a7e4,'rows':_0x4205b9}:null;}})[_0xffca('0x34')](respondWithResult(_0x26d980,null))['catch'](handleError(_0x26d980,null));};exports[_0xffca('0xb7')]=function(_0x4e6b6c,_0xc8bacd,_0x26e655){var _0x103c1e={'raw':![],'where':{}};var _0x17b856={};var _0x463cf6={'count':0x0,'rows':[]};return db[_0xffca('0x3e')][_0xffca('0xb8')]({'where':{'id':_0x4e6b6c['params']['id']}})['then'](handleEntityNotFound(_0xc8bacd,null))[_0xffca('0x34')](function(_0x37f6d9){if(_0x37f6d9){_0x17b856[_0xffca('0x42')]=_['keys'](db[_0xffca('0x99')][_0xffca('0x3f')]);_0x17b856['query']=_[_0xffca('0x57')](_0x4e6b6c[_0xffca('0x44')]);_0x17b856['filters']=_[_0xffca('0x46')](_0x17b856[_0xffca('0x42')],_0x17b856['query']);_0x103c1e['attributes']=_[_0xffca('0x46')](_0x17b856[_0xffca('0x42')],qs[_0xffca('0x48')](_0x4e6b6c[_0xffca('0x44')][_0xffca('0x48')]));_0x103c1e[_0xffca('0x47')]=_0x103c1e[_0xffca('0x47')][_0xffca('0x58')]?_0x103c1e[_0xffca('0x47')]:_0x17b856[_0xffca('0x42')];if(!_0x4e6b6c['query'][_0xffca('0x49')](_0xffca('0x4a'))){_0x103c1e[_0xffca('0x2d')]=qs[_0xffca('0x2d')](_0x4e6b6c[_0xffca('0x44')]['limit']);_0x103c1e['offset']=qs[_0xffca('0x2b')](_0x4e6b6c[_0xffca('0x44')][_0xffca('0x2b')]);}_0x103c1e[_0xffca('0x4b')]=qs[_0xffca('0x4c')](_0x4e6b6c[_0xffca('0x44')][_0xffca('0x4c')]);_0x103c1e[_0xffca('0x4d')]=qs[_0xffca('0x45')](_[_0xffca('0x6b')](_0x4e6b6c[_0xffca('0x44')],_0x17b856[_0xffca('0x45')]));_0x103c1e[_0xffca('0x4d')][_0xffca('0x69')]=_0x37f6d9['id'];if(_0x4e6b6c[_0xffca('0x44')][_0xffca('0x65')]){_0x103c1e['where']=_[_0xffca('0x4e')](_0x103c1e[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0x103c1e[_0xffca('0x47')],function(_0x40a172){var _0x15729e={};_0x15729e[_0x40a172]={'$like':'%'+_0x4e6b6c[_0xffca('0x44')][_0xffca('0x65')]+'%'};return _0x15729e;})});}_0x103c1e=_[_0xffca('0x4e')]({},_0x103c1e,_0x4e6b6c[_0xffca('0x51')]);return db[_0xffca('0x99')][_0xffca('0x2e')]({'where':_0x103c1e['where']})[_0xffca('0x34')](function(_0x48eeaf){_0x463cf6[_0xffca('0x2e')]=_0x48eeaf;if(_0x4e6b6c['query']['includeAll']){_0x103c1e['include']=[{'model':db[_0xffca('0x75')],'as':'Contact','required':![]},{'model':db[_0xffca('0xa4')],'as':_0xffca('0xb9'),'attributes':['name','fullname',_0xffca('0xba')],'required':![]},{'model':db[_0xffca('0xbb')],'as':_0xffca('0xbc'),'attributes':['id',_0xffca('0x3a'),_0xffca('0xbd')],'where':_0x4e6b6c['query'][_0xffca('0xbe')]?{'id':_0x4e6b6c[_0xffca('0x44')][_0xffca('0xbe')]}:undefined,'required':_0x4e6b6c['query'][_0xffca('0xbe')]?!![]:![]}];}return db[_0xffca('0x99')][_0xffca('0x54')](_0x103c1e);})[_0xffca('0x34')](function(_0x39feda){_0x463cf6['rows']=_0x39feda;return _0x463cf6;});}})[_0xffca('0x34')](respondWithFilteredResult(_0xc8bacd,_0x103c1e))[_0xffca('0x26')](handleError(_0xc8bacd,null));};exports[_0xffca('0x3b')]=function(_0x4aa477,_0x9f4ff0,_0x3dfc2b){var _0x2bad53,_0x4bff8f,_0x4355a7;if(_[_0xffca('0x8f')](_0x4aa477[_0xffca('0x5b')][_0xffca('0x5b')])||_0x4aa477[_0xffca('0x5b')]['body']===''){throw new db['Sequelize'][(_0xffca('0x90'))](_0xffca('0x91'));}if(_[_0xffca('0x8f')](_0x4aa477[_0xffca('0x5b')]['to'])){throw new db[(_0xffca('0x76'))][(_0xffca('0x90'))]('to\x20is\x20mandatory');}_0x2bad53=_0x4aa477['body']['to'];return db[_0xffca('0x3e')]['find']({'where':{'id':_0x4aa477[_0xffca('0x61')]['id']},'include':[{'model':db[_0xffca('0xbf')],'as':'List','include':[{'model':db[_0xffca('0x75')],'as':_0xffca('0x95'),'where':{'mobile':_0x2bad53},'limit':0x1,'order':[[_0xffca('0x79'),_0xffca('0x96')]]}]}]})[_0xffca('0x34')](handleEntityNotFound(_0x9f4ff0,null))['then'](function(_0x5d8932){if(_0x5d8932&&_0x5d8932['List']){_0x4bff8f=_0x5d8932[_0xffca('0x35')]({'plain':!![]});if(_0x4bff8f['List']&&_0x4bff8f[_0xffca('0xc0')][_0xffca('0x95')][_0xffca('0x58')]){return _0x4bff8f['List'][_0xffca('0x95')][0x0];}return db[_0xffca('0x75')][_0xffca('0x5a')](_['defaults'](_0x4aa477['body'],{'firstName':_0x2bad53,'mobile':_0x2bad53,'phone':_0x2bad53,'ListId':_0x4bff8f[_0xffca('0x7b')]}));}})[_0xffca('0x34')](handleEntityNotFound(_0x9f4ff0,null))[_0xffca('0x34')](function(_0x33383d){if(_0x33383d){_0x4355a7=_0x33383d;return db[_0xffca('0x99')][_0xffca('0x59')]({'where':{'ContactId':_0x4355a7['id'],'closed':![],'SmsAccountId':_0x4bff8f['id']}})[_0xffca('0x34')](function(_0x19eafe){if(_0x19eafe){return[_0x19eafe,![]];}return db[_0xffca('0x99')][_0xffca('0x5a')]({'UserId':_0x4aa477[_0xffca('0x5c')]['id'],'ContactId':_0x4355a7['id'],'SmsAccountId':_0x4bff8f['id'],'phone':_0x2bad53,'firstMsgDirection':_0xffca('0xc1'),'Messages':[_[_0xffca('0x4e')](_0x4aa477[_0xffca('0x5b')],{'read':![],'body':_0x4aa477[_0xffca('0x5b')][_0xffca('0x5b')],'phone':_0x2bad53,'SmsAccountId':_0x4bff8f['id'],'UserId':_0x4aa477[_0xffca('0x5c')]['id'],'ContactId':_0x4355a7['id']})]},{'include':[{'model':db[_0xffca('0xa1')],'as':_0xffca('0xc2')}]})[_0xffca('0x34')](function(_0x144395){return[_0x144395,!![]];});});}})[_0xffca('0x9a')](function(_0x1d5048,_0x464254){if(_0x464254){return _0x1d5048;}return db[_0xffca('0xa1')][_0xffca('0x5a')](_[_0xffca('0x4e')](_0x4aa477[_0xffca('0x5b')],{'read':![],'body':_0x4aa477['body'][_0xffca('0x5b')],'phone':_0x2bad53,'SmsAccountId':_0x4bff8f['id'],'SmsInteractionId':_0x1d5048['id'],'UserId':_0x4aa477[_0xffca('0x5c')]['id'],'ContactId':_0x4355a7['id']}))[_0xffca('0x34')](function(_0x1f1263){_0x1d5048[_0xffca('0xc3')][_0xffca('0xc2')]=[];_0x1d5048[_0xffca('0xc3')][_0xffca('0xc2')][_0xffca('0x9d')](_0x1f1263[_0xffca('0xc3')]);return _0x1d5048;});})[_0xffca('0x34')](respondWithResult(_0x9f4ff0,null))['catch'](handleError(_0x9f4ff0,null));};exports[_0xffca('0x28')]=function(_0xbf2b8c,_0x417d3c,_0x254644){if(_0xbf2b8c[_0xffca('0x5b')]['id']){delete _0xbf2b8c[_0xffca('0x5b')]['id'];}var _0x54f57b,_0x243eed,_0xafaa1d;return db[_0xffca('0x3e')][_0xffca('0x59')]({'where':{'id':_0xbf2b8c[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x417d3c,null))['then'](function(_0x56ffb0){if(_0x56ffb0){_0xafaa1d=_0x56ffb0;logger[_0xffca('0xac')](_0xffca('0x20'),_0xffca('0x28'),_0xffca('0xc4'),_0x56ffb0[_0xffca('0x4f')],util[_0xffca('0xc5')](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));switch(_0x56ffb0['type']){case'skebby':if(_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc6')]&&_0xbf2b8c[_0xffca('0x5b')][_0xffca('0x28')]){_0x243eed=_0xbf2b8c[_0xffca('0x5b')][_0xffca('0x28')];return db['SmsMessage'][_0xffca('0x59')]({'where':{'messageId':_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc6')]}});}break;case'connectel':if(_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc7')]&&_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc8')]){_0x243eed=_0xbf2b8c['body']['statusInt'];return db[_0xffca('0xa1')][_0xffca('0x59')]({'where':{'messageId':_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc7')]}});}break;case _0xffca('0x84'):if(_0xbf2b8c[_0xffca('0x5b')][_0xffca('0x85')]&&_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc9')]){_0x243eed=_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xc9')];return db['SmsMessage']['find']({'where':{'messageId':_0xbf2b8c[_0xffca('0x5b')]['message_id']}});}break;case _0xffca('0xca'):var _0x545a17=_0xbf2b8c['body'][_0xffca('0x89')][0x0];if(_0x545a17[_0xffca('0x80')]&&_0x545a17[_0xffca('0x28')][_0xffca('0xcb')]===_0xffca('0xcc')){_0x243eed=_0x545a17[_0xffca('0x28')][_0xffca('0xcb')];return db[_0xffca('0xa1')][_0xffca('0x59')]({'where':{'messageId':_0x545a17[_0xffca('0x80')]}});}break;case _0xffca('0xcd'):if(_0xbf2b8c['body']['messageId']&&_0xbf2b8c['body']['status']){_0x243eed=_0xbf2b8c['body'][_0xffca('0x28')];return db['SmsMessage'][_0xffca('0x59')]({'where':{'messageId':_0xbf2b8c['body'][_0xffca('0x80')]}});}break;case _0xffca('0xce'):if(_0xbf2b8c[_0xffca('0x5b')][0x0][_0xffca('0x24')]['id']){_0x243eed=_0xbf2b8c[_0xffca('0x5b')][0x0][_0xffca('0x4f')];return db['SmsMessage']['find']({'where':{'messageId':_0xbf2b8c['body'][0x0][_0xffca('0x24')]['id']}});}break;case'intelepeer':if(_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xcf')]&&_0xbf2b8c[_0xffca('0x5b')][_0xffca('0x28')]){_0x243eed=_0xbf2b8c['body'][_0xffca('0x28')];return db['SmsMessage'][_0xffca('0x59')]({'where':{'messageId':_0xbf2b8c[_0xffca('0x5b')]['redif']}});}break;}}})[_0xffca('0x34')](handleEntityNotFound(_0x417d3c,null))[_0xffca('0x34')](function(_0x4642a2){if(_0x4642a2){_0x54f57b=_0x4642a2;switch(_0xafaa1d[_0xffca('0x4f')]){case'skebby':if(_0x243eed===_0xffca('0xcc')){return _0x54f57b[_0xffca('0x33')]({'read':!![]});}else{logger[_0xffca('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xffca('0x28'),_0xffca('0xd0'),util['inspect'](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xffca('0x83'):if(_0x243eed==='1'){return _0x54f57b['update']({'read':!![]});}else{logger['error'](_0xffca('0x20'),_0xffca('0x28'),_0xffca('0xd0'),util[_0xffca('0xc5')](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xffca('0x84'):if(!_0xbf2b8c[_0xffca('0x5b')][_0xffca('0xd1')]&&_0x243eed>=0xc8&&_0x243eed<=0xce){return _0x54f57b[_0xffca('0x33')]({'read':!![]});}else{logger['error'](_0xffca('0x20'),_0xffca('0x28'),_0xffca('0x84'),util[_0xffca('0xc5')](_0xbf2b8c['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x276e34=_0xbf2b8c[_0xffca('0x5b')]['results'][0x0];if(_0x276e34[_0xffca('0x28')]['groupName']===_0xffca('0xcc')){return _0x54f57b['update']({'read':!![]});}else{logger[_0xffca('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xffca('0xca'),util[_0xffca('0xc5')](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xffca('0xcd'):if(_0x243eed==_0xffca('0xd2')||_0x243eed==_0xffca('0xd3')){return _0x54f57b['update']({'read':!![]});}else{logger[_0xffca('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xffca('0xcd'),util[_0xffca('0xc5')](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xffca('0xce'):if(_0x243eed==_0xffca('0xd4')){return _0x54f57b[_0xffca('0x33')]({'read':!![]});}else{logger[_0xffca('0x22')](_0xffca('0x20'),'status','bandwidth',util[_0xffca('0xc5')](_0xbf2b8c['body'],{'showHidden':![],'depth':null}));}break;case _0xffca('0x8e'):if(_0x243eed===_0xffca('0xd5')||_0x243eed===_0xffca('0xd6')){return _0x54f57b[_0xffca('0x33')]({'read':!![]});}else{logger['error'](_0xffca('0x20'),_0xffca('0x28'),_0xffca('0x8e'),util[_0xffca('0xc5')](_0xbf2b8c[_0xffca('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x54f57b;}})[_0xffca('0x34')](respondWithResult(_0x417d3c,null))[_0xffca('0x26')](handleError(_0x417d3c,null));};exports['statusGet']=function(_0xfd33ae,_0x5c134a,_0x454644){var _0x41388d,_0xd37d0,_0x311dfd;return db[_0xffca('0x3e')][_0xffca('0x59')]({'where':{'id':_0xfd33ae[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x5c134a,null))[_0xffca('0x34')](function(_0x33374b){if(_0x33374b){_0x311dfd=_0x33374b;logger[_0xffca('0xac')](_0xffca('0x20'),'status','received\x20delivery\x20report\x20from',_0x33374b['type'],util['inspect'](_0xfd33ae[_0xffca('0x44')],{'showHidden':![],'depth':null}));switch(_0x33374b[_0xffca('0x4f')]){case _0xffca('0x8a'):if(_0xfd33ae[_0xffca('0x44')][_0xffca('0xd7')]&&_0xfd33ae[_0xffca('0x44')]['state']){_0xd37d0=_0xfd33ae[_0xffca('0x44')][_0xffca('0xd8')];return db['SmsMessage']['find']({'where':{'messageId':_0xfd33ae[_0xffca('0x44')][_0xffca('0xd7')]}});}break;}}})[_0xffca('0x34')](handleEntityNotFound(_0x5c134a,null))[_0xffca('0x34')](function(_0xe9a389){if(_0xe9a389){_0x41388d=_0xe9a389;switch(_0x311dfd[_0xffca('0x4f')]){case _0xffca('0x8a'):if(_0xd37d0==='2'||_0xd37d0==='6'){return _0x41388d[_0xffca('0x33')]({'read':!![]});}else{logger[_0xffca('0x22')](_0xffca('0x20'),'status','csc',util['inspect'](_0xfd33ae[_0xffca('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x41388d;}})['then'](respondWithResult(_0x5c134a,null))[_0xffca('0x26')](handleError(_0x5c134a,null));};exports[_0xffca('0xd9')]=function(_0x51ae5c,_0x3bad86,_0x4d771b){return db[_0xffca('0x3e')]['find']({'where':{'id':_0x51ae5c[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x3bad86,null))[_0xffca('0x34')](function(_0x47ba84){if(_0x47ba84){return _0x47ba84[_0xffca('0xd9')](_0x51ae5c['body']['ids'],_[_0xffca('0x98')](_0x51ae5c['body'],[_0xffca('0x67'),'id'])||{})[_0xffca('0x9a')](function(_0x251438){for(var _0x1cdabf=0x0;_0x1cdabf<_0x51ae5c[_0xffca('0x5b')]['ids'][_0xffca('0x58')];_0x1cdabf+=0x1){socket[_0xffca('0xda')](_0xffca('0xdb'),{'UserId':Number(_0x51ae5c[_0xffca('0x5b')][_0xffca('0x67')][_0x1cdabf]),'SmsAccountId':Number(_0x51ae5c[_0xffca('0x61')]['id'])});}return _0x251438;});}})[_0xffca('0x34')](respondWithResult(_0x3bad86,null))['catch'](handleError(_0x3bad86,null));};exports[_0xffca('0xdc')]=function(_0x99fd06,_0x3b58f5,_0x1e6be6){return db[_0xffca('0x3e')]['find']({'where':{'id':_0x99fd06[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x3b58f5,null))[_0xffca('0x34')](function(_0x420163){if(_0x420163){return _0x420163['removeAgents'](_0x99fd06[_0xffca('0x44')][_0xffca('0x67')])['then'](function(){if(_[_0xffca('0xdd')](_0x99fd06[_0xffca('0x44')][_0xffca('0x67')])){for(var _0x24805b=0x0;_0x24805b<_0x99fd06[_0xffca('0x44')][_0xffca('0x67')][_0xffca('0x58')];_0x24805b+=0x1){socket['emit'](_0xffca('0xde'),{'UserId':Number(_0x99fd06['query']['ids'][_0x24805b]),'SmsAccountId':Number(_0x99fd06[_0xffca('0x61')]['id'])});}}else{socket[_0xffca('0xda')](_0xffca('0xde'),{'UserId':Number(_0x99fd06[_0xffca('0x44')][_0xffca('0x67')]),'SmsAccountId':Number(_0x99fd06[_0xffca('0x61')]['id'])});}});}})[_0xffca('0x34')](respondWithStatusCode(_0x3b58f5,null))['catch'](handleError(_0x3b58f5,null));};exports['getAgents']=function(_0x28f440,_0x383b43,_0xe2793b){var _0x37a016={};var _0x464135={};var _0xd2f93b;var _0x2b6ba9;return db[_0xffca('0x3e')][_0xffca('0xb8')]({'where':{'id':_0x28f440[_0xffca('0x61')]['id']}})[_0xffca('0x34')](handleEntityNotFound(_0x383b43,null))[_0xffca('0x34')](function(_0x5453dd){if(_0x5453dd){_0xd2f93b=_0x5453dd;_0x464135[_0xffca('0x42')]=_[_0xffca('0x57')](db[_0xffca('0xa4')][_0xffca('0x3f')]);_0x464135[_0xffca('0x44')]=_['keys'](_0x28f440['query']);_0x464135['filters']=_[_0xffca('0x46')](_0x464135[_0xffca('0x42')],_0x464135[_0xffca('0x44')]);_0x37a016[_0xffca('0x47')]=_[_0xffca('0x46')](_0x464135['model'],qs[_0xffca('0x48')](_0x28f440[_0xffca('0x44')]['fields']));_0x37a016[_0xffca('0x47')]=_0x37a016[_0xffca('0x47')][_0xffca('0x58')]?_0x37a016[_0xffca('0x47')]:_0x464135[_0xffca('0x42')];_0x37a016[_0xffca('0x4b')]=qs[_0xffca('0x4c')](_0x28f440[_0xffca('0x44')]['sort']);_0x37a016['where']=qs[_0xffca('0x45')](_[_0xffca('0x6b')](_0x28f440[_0xffca('0x44')],_0x464135[_0xffca('0x45')]));if(_0x28f440[_0xffca('0x44')][_0xffca('0x65')]){_0x37a016['where']=_[_0xffca('0x4e')](_0x37a016[_0xffca('0x4d')],{'$or':_[_0xffca('0x43')](_0x37a016['attributes'],function(_0x3c8566){var _0x565c6d={};_0x565c6d[_0x3c8566]={'$like':'%'+_0x28f440['query'][_0xffca('0x65')]+'%'};return _0x565c6d;})});}_0x37a016=_['merge']({},_0x37a016,_0x28f440[_0xffca('0x51')]);return _0xd2f93b['getAgents'](_0x37a016);}})[_0xffca('0x34')](function(_0x13768d){if(_0x13768d){_0x2b6ba9=_0x13768d[_0xffca('0x58')];if(!_0x28f440[_0xffca('0x44')]['hasOwnProperty'](_0xffca('0x4a'))){_0x37a016[_0xffca('0x2d')]=qs[_0xffca('0x2d')](_0x28f440[_0xffca('0x44')][_0xffca('0x2d')]);_0x37a016[_0xffca('0x2b')]=qs[_0xffca('0x2b')](_0x28f440[_0xffca('0x44')]['offset']);}return _0xd2f93b[_0xffca('0xdf')](_0x37a016);}})[_0xffca('0x34')](function(_0x3a9f58){if(_0x3a9f58){return _0x3a9f58?{'count':_0x2b6ba9,'rows':_0x3a9f58}:null;}})[_0xffca('0x34')](respondWithResult(_0x383b43,null))[_0xffca('0x26')](handleError(_0x383b43,null));}; \ No newline at end of file +var _0x8754=['messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','CmList','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','intelepeer','redif','DELIVERED','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','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/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','map','SmsAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From'];(function(_0x829914,_0x8e6ba){var _0x4a1250=function(_0x3c048c){while(--_0x3c048c){_0x829914['push'](_0x829914['shift']());}};_0x4a1250(++_0x8e6ba);}(_0x8754,0x69));var _0x4875=function(_0x20ef5b,_0x592331){_0x20ef5b=_0x20ef5b-0x0;var _0x177ef1=_0x8754[_0x20ef5b];return _0x177ef1;};'use strict';var emlformat=require(_0x4875('0x0'));var rimraf=require(_0x4875('0x1'));var zipdir=require(_0x4875('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4875('0x3'));var moment=require(_0x4875('0x4'));var BPromise=require(_0x4875('0x5'));var Mustache=require(_0x4875('0x6'));var util=require(_0x4875('0x7'));var path=require(_0x4875('0x8'));var sox=require(_0x4875('0x9'));var csv=require(_0x4875('0xa'));var ejs=require(_0x4875('0xb'));var fs=require('fs');var fs_extra=require(_0x4875('0xc'));var _=require(_0x4875('0xd'));var squel=require('squel');var crypto=require(_0x4875('0xe'));var jsforce=require(_0x4875('0xf'));var deskjs=require(_0x4875('0x10'));var toCsv=require(_0x4875('0xa'));var querystring=require(_0x4875('0x11'));var Papa=require(_0x4875('0x12'));var Redis=require(_0x4875('0x13'));var authService=require(_0x4875('0x14'));var qs=require(_0x4875('0x15'));var as=require(_0x4875('0x16'));var hardwareService=require(_0x4875('0x17'));var logger=require(_0x4875('0x18'))(_0x4875('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4875('0x1a'));var db=require(_0x4875('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4875('0x1c'),'port':0x18eb});var socket=require(_0x4875('0x1d'))(new Redis(config[_0x4875('0x1e')]));require(_0x4875('0x1f'))[_0x4875('0x20')](socket);var jayson=require(_0x4875('0x21'));var client=jayson[_0x4875('0x22')][_0x4875('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4e6246,_0x229733,_0x57bd89,_0x2fd8b4){return new BPromise(function(_0xf73750,_0x299c88){var _0x210efb=_0x2fd8b4||client;return _0x210efb[_0x4875('0x24')](_0x4e6246,_0x57bd89)[_0x4875('0x25')](function(_0x3c6288){logger['info'](_0x4875('0x26'),_0x229733,_0x4875('0x27'));logger['debug'](_0x4875('0x28'),_0x229733,_0x4875('0x27'),JSON[_0x4875('0x29')](_0x3c6288));if(_0x3c6288[_0x4875('0x2a')]){if(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2b')]===0x1f4){logger[_0x4875('0x2a')](_0x4875('0x26'),_0x229733,_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);return _0x299c88(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);}logger[_0x4875('0x2a')](_0x4875('0x26'),_0x229733,_0x3c6288[_0x4875('0x2a')]['message']);return _0xf73750(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);}else{logger[_0x4875('0x2d')](_0x4875('0x26'),_0x229733,_0x4875('0x27'));_0xf73750(_0x3c6288[_0x4875('0x2e')]['message']);}})['catch'](function(_0x45978e){logger[_0x4875('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x229733,_0x45978e);_0x299c88(_0x45978e);});});}function respondWithStatusCode(_0x237aaa,_0x466a19){_0x466a19=_0x466a19||0xcc;return function(_0x2ca5b4){if(_0x2ca5b4){return _0x237aaa['sendStatus'](_0x466a19);}return _0x237aaa[_0x4875('0x2f')](_0x466a19)[_0x4875('0x30')]();};}function respondWithResult(_0xb5836c,_0x1897c6){_0x1897c6=_0x1897c6||0xc8;return function(_0x53de0c){if(_0x53de0c){return _0xb5836c[_0x4875('0x2f')](_0x1897c6)[_0x4875('0x31')](_0x53de0c);}};}function respondWithFilteredResult(_0x5940dd,_0x4a3c53){return function(_0x50a12f){if(_0x50a12f){var _0x31856a=typeof _0x4a3c53[_0x4875('0x32')]===_0x4875('0x33')&&typeof _0x4a3c53['limit']===_0x4875('0x33');var _0x6fb23a=_0x50a12f[_0x4875('0x34')];var _0x59b1b8=_0x31856a?0x0:_0x4a3c53[_0x4875('0x32')];var _0x30abfe=_0x31856a?_0x50a12f[_0x4875('0x34')]:_0x4a3c53[_0x4875('0x32')]+_0x4a3c53[_0x4875('0x35')];var _0x1c08ce;if(_0x30abfe>=_0x6fb23a){_0x30abfe=_0x6fb23a;_0x1c08ce=0xc8;}else{_0x1c08ce=0xce;}_0x5940dd[_0x4875('0x2f')](_0x1c08ce);return _0x5940dd[_0x4875('0x36')](_0x4875('0x37'),_0x59b1b8+'-'+_0x30abfe+'/'+_0x6fb23a)['json'](_0x50a12f);}return null;};}function patchUpdates(_0x41edef){return function(_0x2d9920){try{jsonpatch[_0x4875('0x38')](_0x2d9920,_0x41edef,!![]);}catch(_0x2a6458){return BPromise[_0x4875('0x39')](_0x2a6458);}return _0x2d9920[_0x4875('0x3a')]();};}function saveUpdates(_0x37f953,_0x2f6e56){return function(_0x5b44d4){if(_0x5b44d4){return _0x5b44d4['update'](_0x37f953)['then'](function(_0x2dbffb){return _0x2dbffb;});}return null;};}function removeEntity(_0x296599,_0x3303e5){return function(_0x92fc41){if(_0x92fc41){return _0x92fc41['destroy']()[_0x4875('0x25')](function(){var _0x5eb408=_0x92fc41['get']({'plain':!![]});var _0x41142d=_0x4875('0x3b');return db[_0x4875('0x3c')][_0x4875('0x3d')]({'where':{'type':_0x41142d,'resourceId':_0x5eb408['id']}})[_0x4875('0x25')](function(){return _0x92fc41;});})[_0x4875('0x25')](function(){_0x296599['status'](0xcc)[_0x4875('0x30')]();});}};}function handleEntityNotFound(_0x3a29a2,_0x8fb446){return function(_0xb47ac2){if(!_0xb47ac2){_0x3a29a2[_0x4875('0x3e')](0x194);}return _0xb47ac2;};}function handleError(_0xb5ed70,_0xdccf9f){_0xdccf9f=_0xdccf9f||0x1f4;return function(_0x1cfe29){logger['error'](_0x1cfe29[_0x4875('0x3f')]);if(_0x1cfe29[_0x4875('0x40')]){delete _0x1cfe29['name'];}_0xb5ed70[_0x4875('0x2f')](_0xdccf9f)['send'](_0x1cfe29);};}exports['index']=function(_0x20a88d,_0x57f4b2){var _0x3eeaa7={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x198aa3={},_0x38ab62={'count':0x0,'rows':[]};var _0xb60f51=_[_0x4875('0x41')](db[_0x4875('0x42')][_0x4875('0x43')],function(_0x5a0367){return{'name':_0x5a0367[_0x4875('0x44')],'type':_0x5a0367['type'][_0x4875('0x45')]};});_0x198aa3['model']=_[_0x4875('0x41')](_0xb60f51,_0x4875('0x40'));_0x198aa3[_0x4875('0x46')]=_[_0x4875('0x47')](_0x20a88d['query']);_0x198aa3['filters']=_[_0x4875('0x48')](_0x198aa3[_0x4875('0x49')],_0x198aa3[_0x4875('0x46')]);_0x3eeaa7[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x198aa3[_0x4875('0x49')],qs['fields'](_0x20a88d['query'][_0x4875('0x4b')]));_0x3eeaa7['attributes']=_0x3eeaa7['attributes'][_0x4875('0x4c')]?_0x3eeaa7[_0x4875('0x4a')]:_0x198aa3[_0x4875('0x49')];if(!_0x20a88d['query'][_0x4875('0x4d')](_0x4875('0x4e'))){_0x3eeaa7[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x20a88d['query']['limit']);_0x3eeaa7[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x20a88d['query']['offset']);}_0x3eeaa7[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x20a88d[_0x4875('0x46')][_0x4875('0x50')]);_0x3eeaa7[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x20a88d[_0x4875('0x46')],_0x198aa3[_0x4875('0x52')]),_0xb60f51);if(_0x20a88d[_0x4875('0x46')][_0x4875('0x54')]){_0x3eeaa7[_0x4875('0x51')]=_[_0x4875('0x55')](_0x3eeaa7['where'],{'$or':_['map'](_0xb60f51,function(_0x45107d){if(_0x45107d[_0x4875('0x56')]!==_0x4875('0x57')){var _0x36709d={};_0x36709d[_0x45107d[_0x4875('0x40')]]={'$like':'%'+_0x20a88d['query']['filter']+'%'};return _0x36709d;}})});}_0x3eeaa7=_['merge']({},_0x3eeaa7,_0x20a88d['options']);var _0x443684={'where':_0x3eeaa7[_0x4875('0x51')]};return db[_0x4875('0x42')][_0x4875('0x34')](_0x443684)[_0x4875('0x25')](function(_0x1d81a1){_0x38ab62['count']=_0x1d81a1;if(_0x20a88d[_0x4875('0x46')]['includeAll']){_0x3eeaa7[_0x4875('0x58')]=[{'all':!![]}];}return db[_0x4875('0x42')][_0x4875('0x59')](_0x3eeaa7);})[_0x4875('0x25')](function(_0x42e21b){_0x38ab62[_0x4875('0x5a')]=_0x42e21b;return _0x38ab62;})[_0x4875('0x25')](respondWithFilteredResult(_0x57f4b2,_0x3eeaa7))['catch'](handleError(_0x57f4b2,null));};exports[_0x4875('0x5b')]=function(_0x91aba6,_0x14679c){var _0x300adb={'raw':![],'where':{'id':_0x91aba6[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x5d')],'as':_0x4875('0x5e')}]},_0x3e806d={};_0x3e806d[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0x42')][_0x4875('0x43')]);_0x3e806d['query']=_[_0x4875('0x47')](_0x91aba6[_0x4875('0x46')]);_0x3e806d['filters']=_[_0x4875('0x48')](_0x3e806d[_0x4875('0x49')],_0x3e806d[_0x4875('0x46')]);_0x300adb[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x3e806d[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x91aba6[_0x4875('0x46')][_0x4875('0x4b')]));_0x300adb[_0x4875('0x4a')]=_0x300adb['attributes'][_0x4875('0x4c')]?_0x300adb[_0x4875('0x4a')]:_0x3e806d[_0x4875('0x49')];if(_0x91aba6[_0x4875('0x46')][_0x4875('0x5f')]){_0x300adb['include']=[{'all':!![]}];}_0x300adb=_[_0x4875('0x55')]({},_0x300adb,_0x91aba6[_0x4875('0x60')]);return db[_0x4875('0x42')][_0x4875('0x61')](_0x300adb)[_0x4875('0x25')](handleEntityNotFound(_0x14679c,null))[_0x4875('0x25')](respondWithResult(_0x14679c,null))['catch'](handleError(_0x14679c,null));};exports[_0x4875('0x62')]=function(_0x49d519,_0x5c58ad){return db[_0x4875('0x42')][_0x4875('0x62')](_0x49d519[_0x4875('0x63')],{})['then'](function(_0x2f21d7){var _0x619464=_0x49d519[_0x4875('0x64')][_0x4875('0x65')]({'plain':!![]});if(!_0x619464)throw new Error(_0x4875('0x66'));if(_0x619464['role']===_0x4875('0x64')){var _0x29ade6=_0x2f21d7['get']({'plain':!![]});var _0x1f065f=_0x4875('0x3b');return db[_0x4875('0x67')][_0x4875('0x61')]({'where':{'name':_0x1f065f,'userProfileId':_0x619464[_0x4875('0x68')]},'raw':!![]})['then'](function(_0x5a2ff3){if(_0x5a2ff3&&_0x5a2ff3[_0x4875('0x69')]===0x0){return db['UserProfileResource'][_0x4875('0x62')]({'name':_0x29ade6[_0x4875('0x40')],'resourceId':_0x29ade6['id'],'type':_0x5a2ff3[_0x4875('0x40')],'sectionId':_0x5a2ff3['id']},{})[_0x4875('0x25')](function(){return _0x2f21d7;});}else{return _0x2f21d7;}})[_0x4875('0x6a')](function(_0x48fdf3){logger[_0x4875('0x2a')](_0x4875('0x6b'),_0x48fdf3);throw _0x48fdf3;});}return _0x2f21d7;})[_0x4875('0x25')](respondWithResult(_0x5c58ad,0xc9))[_0x4875('0x6a')](handleError(_0x5c58ad,null));};exports[_0x4875('0x6c')]=function(_0x169340,_0x4d5abd){if(_0x169340[_0x4875('0x63')]['id']){delete _0x169340[_0x4875('0x63')]['id'];}return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x169340[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x5d')],'as':_0x4875('0x5e')}]})[_0x4875('0x25')](handleEntityNotFound(_0x4d5abd,null))[_0x4875('0x25')](saveUpdates(_0x169340[_0x4875('0x63')],null))['then'](respondWithResult(_0x4d5abd,null))[_0x4875('0x6a')](handleError(_0x4d5abd,null));};exports[_0x4875('0x3d')]=function(_0x55dfb7,_0x34f110){return db[_0x4875('0x42')]['find']({'where':{'id':_0x55dfb7[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x34f110,null))['then'](removeEntity(_0x34f110,null))[_0x4875('0x6a')](handleError(_0x34f110,null));};exports[_0x4875('0x6d')]=function(_0x2104bf,_0x5daea6){return db[_0x4875('0x42')][_0x4875('0x6d')]()[_0x4875('0x25')](respondWithResult(_0x5daea6,null))[_0x4875('0x6a')](handleError(_0x5daea6,null));};exports[_0x4875('0x6e')]=function(_0x4535f5,_0x34c953,_0x450ea6){if(_0x4535f5['body']['id']){delete _0x4535f5[_0x4875('0x63')]['id'];}return db['SmsAccount'][_0x4875('0x61')]({'where':{'id':_0x4535f5[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x34c953,null))[_0x4875('0x25')](function(_0x4c2029){if(_0x4c2029){_0x4535f5[_0x4875('0x63')][_0x4875('0x6f')]=_0x4c2029['id'];return db[_0x4875('0x70')][_0x4875('0x62')](_0x4535f5['body']);}})[_0x4875('0x25')](respondWithResult(_0x34c953,null))['catch'](handleError(_0x34c953,null));};exports['getDispositions']=function(_0x29ae83,_0x2ace01,_0x482718){var _0x24000f={'raw':![],'where':{}};var _0x3b8227={};var _0x4ff847={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4875('0x71')]({'where':{'id':_0x29ae83[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ace01,null))[_0x4875('0x25')](function(_0x2aae31){if(_0x2aae31){_0x3b8227[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0x70')][_0x4875('0x43')]);_0x3b8227[_0x4875('0x46')]=_[_0x4875('0x47')](_0x29ae83[_0x4875('0x46')]);_0x3b8227[_0x4875('0x52')]=_[_0x4875('0x48')](_0x3b8227[_0x4875('0x49')],_0x3b8227['query']);_0x24000f[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x3b8227['model'],qs[_0x4875('0x4b')](_0x29ae83[_0x4875('0x46')][_0x4875('0x4b')]));_0x24000f['attributes']=_0x24000f[_0x4875('0x4a')][_0x4875('0x4c')]?_0x24000f[_0x4875('0x4a')]:_0x3b8227[_0x4875('0x49')];if(!_0x29ae83['query'][_0x4875('0x4d')]('nolimit')){_0x24000f[_0x4875('0x35')]=qs['limit'](_0x29ae83[_0x4875('0x46')][_0x4875('0x35')]);_0x24000f[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x29ae83['query'][_0x4875('0x32')]);}_0x24000f[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x29ae83['query'][_0x4875('0x50')]);_0x24000f[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x29ae83[_0x4875('0x46')],_0x3b8227[_0x4875('0x52')]));_0x24000f[_0x4875('0x51')]['SmsAccountId']=_0x2aae31['id'];if(_0x29ae83[_0x4875('0x46')][_0x4875('0x54')]){_0x24000f[_0x4875('0x51')]=_[_0x4875('0x55')](_0x24000f[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x24000f[_0x4875('0x4a')],function(_0x3c1abf){var _0x2b4a84={};_0x2b4a84[_0x3c1abf]={'$like':'%'+_0x29ae83[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x2b4a84;})});}_0x24000f=_['merge']({},_0x24000f,_0x29ae83[_0x4875('0x60')]);return db[_0x4875('0x70')][_0x4875('0x34')]({'where':_0x24000f['where']})[_0x4875('0x25')](function(_0x3c3807){_0x4ff847[_0x4875('0x34')]=_0x3c3807;if(_0x29ae83[_0x4875('0x46')]['includeAll']){_0x24000f[_0x4875('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x24000f);})['then'](function(_0x4b68c4){_0x4ff847[_0x4875('0x5a')]=_0x4b68c4;return _0x4ff847;});}})[_0x4875('0x25')](respondWithFilteredResult(_0x2ace01,_0x24000f))['catch'](handleError(_0x2ace01,null));};exports[_0x4875('0x72')]=function(_0x2e50ba,_0x20194f,_0x59f507){return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x2e50ba[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x20194f,null))[_0x4875('0x25')](function(_0x4f9189){if(_0x4f9189){return _0x4f9189[_0x4875('0x72')](_0x2e50ba[_0x4875('0x46')][_0x4875('0x73')]);}})[_0x4875('0x25')](respondWithStatusCode(_0x20194f,null))[_0x4875('0x6a')](handleError(_0x20194f,null));};exports[_0x4875('0x74')]=function(_0x50fd19,_0x1b53cd,_0x3baadf){if(_0x50fd19['body']['id']){delete _0x50fd19[_0x4875('0x63')]['id'];}return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x50fd19['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x1b53cd,null))[_0x4875('0x25')](function(_0x3e3f53){if(_0x3e3f53){_0x50fd19[_0x4875('0x63')][_0x4875('0x6f')]=_0x3e3f53['id'];return db['CannedAnswer'][_0x4875('0x62')](_0x50fd19[_0x4875('0x63')]);}})[_0x4875('0x25')](respondWithResult(_0x1b53cd,null))[_0x4875('0x6a')](handleError(_0x1b53cd,null));};exports['getAnswers']=function(_0x2b1a09,_0x54c0f5,_0x16df1a){var _0x1a1b58={'raw':![],'where':{}};var _0x1f0220={};var _0x42c683={'count':0x0,'rows':[]};return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x2b1a09['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x54c0f5,null))[_0x4875('0x25')](function(_0xcd9d9f){if(_0xcd9d9f){_0x1f0220['model']=_[_0x4875('0x47')](db['CannedAnswer'][_0x4875('0x43')]);_0x1f0220[_0x4875('0x46')]=_[_0x4875('0x47')](_0x2b1a09[_0x4875('0x46')]);_0x1f0220[_0x4875('0x52')]=_['intersection'](_0x1f0220[_0x4875('0x49')],_0x1f0220[_0x4875('0x46')]);_0x1a1b58[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x1f0220['model'],qs[_0x4875('0x4b')](_0x2b1a09[_0x4875('0x46')]['fields']));_0x1a1b58['attributes']=_0x1a1b58[_0x4875('0x4a')][_0x4875('0x4c')]?_0x1a1b58[_0x4875('0x4a')]:_0x1f0220[_0x4875('0x49')];if(!_0x2b1a09['query'][_0x4875('0x4d')](_0x4875('0x4e'))){_0x1a1b58[_0x4875('0x35')]=qs['limit'](_0x2b1a09['query'][_0x4875('0x35')]);_0x1a1b58[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x2b1a09[_0x4875('0x46')][_0x4875('0x32')]);}_0x1a1b58[_0x4875('0x4f')]=qs['sort'](_0x2b1a09[_0x4875('0x46')][_0x4875('0x50')]);_0x1a1b58[_0x4875('0x51')]=qs[_0x4875('0x52')](_['pick'](_0x2b1a09['query'],_0x1f0220[_0x4875('0x52')]));_0x1a1b58['where'][_0x4875('0x6f')]=_0xcd9d9f['id'];if(_0x2b1a09[_0x4875('0x46')]['filter']){_0x1a1b58['where']=_[_0x4875('0x55')](_0x1a1b58[_0x4875('0x51')],{'$or':_['map'](_0x1a1b58[_0x4875('0x4a')],function(_0x204bb3){var _0x4bdda9={};_0x4bdda9[_0x204bb3]={'$like':'%'+_0x2b1a09['query'][_0x4875('0x54')]+'%'};return _0x4bdda9;})});}_0x1a1b58=_['merge']({},_0x1a1b58,_0x2b1a09[_0x4875('0x60')]);return db[_0x4875('0x75')]['count']({'where':_0x1a1b58[_0x4875('0x51')]})[_0x4875('0x25')](function(_0xa3d687){_0x42c683[_0x4875('0x34')]=_0xa3d687;if(_0x2b1a09[_0x4875('0x46')][_0x4875('0x5f')]){_0x1a1b58[_0x4875('0x58')]=[{'all':!![]}];}return db[_0x4875('0x75')]['findAll'](_0x1a1b58);})[_0x4875('0x25')](function(_0x213474){_0x42c683[_0x4875('0x5a')]=_0x213474;return _0x42c683;});}})['then'](respondWithFilteredResult(_0x54c0f5,_0x1a1b58))['catch'](handleError(_0x54c0f5,null));};exports['removeAnswers']=function(_0x4399fb,_0x5a1aba,_0x56c744){return db['SmsAccount'][_0x4875('0x61')]({'where':{'id':_0x4399fb[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5a1aba,null))[_0x4875('0x25')](function(_0x5888e9){if(_0x5888e9){return _0x5888e9[_0x4875('0x76')](_0x4399fb[_0x4875('0x46')][_0x4875('0x73')]);}})[_0x4875('0x25')](respondWithStatusCode(_0x5a1aba,null))[_0x4875('0x6a')](handleError(_0x5a1aba,null));};exports[_0x4875('0x77')]=function(_0x4269cc,_0x2ff06d,_0x305d3f){var _0x41b0bb={'channel':_0x4875('0x78')};var _0x459af5=[];var _0x37a6fa=[];var _0x35f2d1={};return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x4269cc[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x79')],'as':_0x4875('0x7a')}]})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))[_0x4875('0x25')](function(_0x41c8c5){_0x41b0bb[_0x4875('0x7b')]=_0x41c8c5;_0x41b0bb['applications']=_[_0x4875('0x7c')](_0x41c8c5[_0x4875('0x7a')],[_0x4875('0x7d')],[_0x4875('0x7e')]);if(_0x41b0bb[_0x4875('0x7b')]['Applications']){delete _0x41b0bb[_0x4875('0x7b')][_0x4875('0x7a')];}return db[_0x4875('0x7f')][_0x4875('0x6d')]();})[_0x4875('0x25')](function(_0x15f8e4){if(!_0x15f8e4){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0x82'));}_0x459af5=_[_0x4875('0x83')](_['keys'](_0x15f8e4),[_0x4875('0x84'),_0x4875('0x85')]);_0x37a6fa=_[_0x4875('0x83')](_[_0x4875('0x47')](_0x15f8e4),[_0x4875('0x84'),_0x4875('0x85'),_0x4875('0x86'),_0x4875('0x87')]);_0x41b0bb[_0x4875('0x63')]={'mapKey':_0x4875('0x88')};if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]){switch(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]){case'twilio':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x8a')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')]['Body'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x8b')]=_0x4269cc['body'][_0x4875('0x8c')];break;case'skebby':_0x41b0bb['body'][_0x4875('0x89')]='+'+_0x4269cc[_0x4875('0x63')][_0x4875('0x8d')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body']['text'];break;case _0x4875('0x8e'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc['body']['from'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body'][_0x4875('0x2c')];break;case _0x4875('0x8f'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc[_0x4875('0x63')][_0x4875('0x89')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')]['body'];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc['body'][_0x4875('0x90')];break;case _0x4875('0x91'):_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')]['From'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x92')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x93')];break;case _0x4875('0x94'):_0x41b0bb[_0x4875('0x63')]['from']='+'+_0x4269cc[_0x4875('0x63')][_0x4875('0x95')][0x0][_0x4875('0x89')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body'][_0x4875('0x95')][0x0][_0x4875('0x96')];_0x41b0bb['body'][_0x4875('0x8b')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x95')][0x0][_0x4875('0x8b')];break;case _0x4875('0x97'):_0x41b0bb['body']['from']=_0x4269cc[_0x4875('0x63')][_0x4875('0x98')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x99')][_0x4875('0x2c')];break;case _0x4875('0x9a'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc['body'][_0x4875('0x9b')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x96')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x9c')];break;case _0x4875('0x9d'):_0x41b0bb['body'][_0x4875('0x8b')]=_0x4269cc[_0x4875('0x63')][0x0]['message']['id'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')][0x0][_0x4875('0x2c')]['from'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][0x0]['message'][_0x4875('0x96')];break;case'intelepeer':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc['body'][_0x4875('0x89')];_0x41b0bb['body'][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x2c')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x9e')];break;}}if(_0x41b0bb[_0x4875('0x63')]['id']){delete _0x41b0bb[_0x4875('0x63')]['id'];}if(_['isNil'](_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0x9f'));}if(_['isNil'](_0x41b0bb['body']['body'])||_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]===''){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0xa0'));}if(_[_0x4875('0xa1')](_0x41b0bb[_0x4875('0x63')]['mapKey'])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0xa2')+_0x37a6fa);}if(!_[_0x4875('0xa3')](_0x37a6fa,_0x41b0bb['body'][_0x4875('0xa4')])){throw new db['Sequelize'][(_0x4875('0x81'))](_0x4875('0xa5')+_0x37a6fa);}_0x35f2d1[_0x41b0bb[_0x4875('0x63')][_0x4875('0xa4')]]=_0x41b0bb['body'][_0x4875('0x89')];return db['CmList'][_0x4875('0x61')]({'where':{'id':_0x41b0bb[_0x4875('0x7b')][_0x4875('0x87')]},'include':[{'model':db['CmContact'],'as':_0x4875('0xa6'),'where':_0x35f2d1,'limit':0x1,'order':[['updatedAt',_0x4875('0xa7')]]}]});})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))[_0x4875('0x25')](function(_0x47fe09){if(_0x47fe09){_0x41b0bb['list']=_[_0x4875('0xa8')](_0x47fe09,[_0x4875('0xa6')]);if(_0x47fe09[_0x4875('0xa6')][_0x4875('0x4c')]){return _0x47fe09[_0x4875('0xa6')][0x0];}var _0x2c4ed9=_[_0x4875('0xa9')](_0x41b0bb[_0x4875('0x63')],{'firstName':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'ListId':_0x47fe09['id']});_0x2c4ed9[_0x41b0bb[_0x4875('0x63')][_0x4875('0xa4')]]=_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')];return db[_0x4875('0x7f')]['create'](_0x2c4ed9,{'fields':_0x459af5,'raw':!![]});}})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))['then'](function(_0x3c7e4a){if(_0x3c7e4a){_0x41b0bb[_0x4875('0xaa')]=_0x3c7e4a;var _0x5c0ed1={'ContactId':_0x3c7e4a['id'],'phone':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id']};var _0x1275d6={'ContactId':_0x3c7e4a['id'],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id'],'closed':![]};return db[_0x4875('0xab')][_0x4875('0x61')]({'where':_0x1275d6})[_0x4875('0x25')](function(_0x191a56){if(_0x191a56){return[_0x191a56,![]];}return db[_0x4875('0xab')][_0x4875('0x62')](_0x5c0ed1)['then'](function(_0x1f8010){return[_0x1f8010,!![]];});});}})['spread'](function(_0x131301,_0xc7eb55){_0x41b0bb[_0x4875('0xac')]=_0x131301[_0x4875('0x65')]({'plain':!![]});_0x41b0bb[_0x4875('0xac')][_0x4875('0xad')]=![];if(_0xc7eb55){if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0xae')]){_0x41b0bb[_0x4875('0xaf')][_0x4875('0xb0')]({'id':0x0,'priority':_0x41b0bb['applications'][_0x4875('0x4c')]+0x1,'app':_0x4875('0xb1'),'appdata':_0x4875('0xb2'),'interval':_0x4875('0xb3')});}_0x41b0bb[_0x4875('0xac')][_0x4875('0xad')]=!![];}return db[_0x4875('0xb4')][_0x4875('0x62')]({'phone':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'messageId':_0x41b0bb[_0x4875('0x63')][_0x4875('0x8b')],'body':_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id'],'SmsInteractionId':_0x131301['id'],'direction':'in','ContactId':_0x131301[_0x4875('0xb5')],'AttachmentId':_0x41b0bb['body'][_0x4875('0xb6')]});})[_0x4875('0x25')](function(_0x5ef2fc){_0x41b0bb[_0x4875('0x2c')]=_0x5ef2fc;if(_0x41b0bb[_0x4875('0xac')][_0x4875('0xb7')]){return db[_0x4875('0xb8')]['find']({'attributes':['id',_0x4875('0x40')],'where':{'id':_0x41b0bb[_0x4875('0xac')][_0x4875('0xb7')]}})['then'](function(_0x16c290){if(_0x16c290){_0x41b0bb[_0x4875('0xaf')][_0x4875('0xb9')]({'id':0x0,'priority':0x0,'app':_0x4875('0xba'),'appdata':_0x16c290['name']+','+(_0x41b0bb['account'][_0x4875('0xbb')]||0xa),'interval':_0x4875('0xb3')});}return respondWithRpcPromise('Start',_0x4875('0xbc'),_0x41b0bb);});}return respondWithRpcPromise(_0x4875('0xbd'),'startRouting',_0x41b0bb);})[_0x4875('0x25')](function(_0x4cbe6b){if(_0x4cbe6b){var _0x53885b=0xc8;var _0x2c62d8=_0x4875('0xbe');logger[_0x4875('0x2d')](_0x4875('0x28'),_0x2c62d8,_0x53885b,_0x4875('0xbf'));logger[_0x4875('0xc0')](_0x4875('0xc1'),_0x2c62d8,_0x53885b,_0x4875('0xbf'),JSON[_0x4875('0x29')](_0x4cbe6b));if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]===_0x4875('0xc2')){return _0x2ff06d[_0x4875('0x2f')](_0x53885b)[_0x4875('0x36')](_0x4875('0xc3'),_0x4875('0xc4'))[_0x4875('0xc5')](_0x4875('0xc6'));}else{return _0x2ff06d['status'](_0x53885b)[_0x4875('0x31')](_0x4cbe6b);}}})[_0x4875('0x6a')](handleError(_0x2ff06d,null));};exports[_0x4875('0xc7')]=function(_0xb87e06,_0x409834){var _0x27e186=_0xb87e06[_0x4875('0x5c')]['id'];var _0x40e4c0=_0xb87e06[_0x4875('0x63')];var _0x2999b5=0xc8;var _0x4b0788=null;return db['sequelize'][_0x4875('0xc8')]({'isolationLevel':db['sequelize']['Transaction'][_0x4875('0xc9')][_0x4875('0xca')]},function(_0x13ce68){return db['SmsAccount'][_0x4875('0x71')]({'where':{'id':_0x27e186},'transaction':_0x13ce68})[_0x4875('0x25')](function(_0x32ac2b){if(_0x32ac2b){return db[_0x4875('0x79')][_0x4875('0x3d')]({'where':{'SmsAccountId':_0x27e186},'transaction':_0x13ce68})[_0x4875('0x25')](function(){var _0x193244=_[_0x4875('0x41')](_0x40e4c0,function(_0x880793){_0x880793[_0x4875('0x6f')]=_0x27e186;return _0x880793;});return db['SmsApplication']['bulkCreate'](_0x193244,{'transaction':_0x13ce68});});}else{_0x2999b5=0x194;_0x4b0788=[];}});})[_0x4875('0x25')](function(){if(_0x2999b5!==0x194){return db[_0x4875('0x79')][_0x4875('0xcb')]({'where':{'SmsAccountId':_0x27e186},'order':'priority'})['then'](function(_0x42d52c){_0x4b0788=_0x42d52c;});}})['catch'](function(_0x1b195b){_0x2999b5=0x1f4;logger[_0x4875('0x2a')](_0x1b195b[_0x4875('0x3f')]);if(_0x1b195b[_0x4875('0x40')]){delete _0x1b195b[_0x4875('0x40')];}_0x4b0788=_0x1b195b;})['finally'](function(){if(_0x4b0788===null){_0x409834['sendStatus'](_0x2999b5);}else{if(_0x2999b5===0x1f4){_0x409834[_0x4875('0x2f')](_0x2999b5)['send'](_0x4b0788);}else{_0x409834[_0x4875('0x2f')](_0x2999b5)[_0x4875('0x31')](_0x4b0788);}}});};exports[_0x4875('0xcc')]=function(_0x400332,_0x33b7f6,_0x21a6be){var _0xc5de54={};var _0x809285={};var _0x2d8e52;var _0x7f3a4b;return db[_0x4875('0x42')][_0x4875('0x71')]({'where':{'id':_0x400332[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33b7f6,null))[_0x4875('0x25')](function(_0x23588d){if(_0x23588d){_0x2d8e52=_0x23588d;_0x809285[_0x4875('0x49')]=_['keys'](db[_0x4875('0x79')][_0x4875('0x43')]);_0x809285[_0x4875('0x46')]=_[_0x4875('0x47')](_0x400332[_0x4875('0x46')]);_0x809285['filters']=_[_0x4875('0x48')](_0x809285['model'],_0x809285['query']);_0xc5de54['attributes']=_['intersection'](_0x809285[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x400332[_0x4875('0x46')][_0x4875('0x4b')]));_0xc5de54['attributes']=_0xc5de54[_0x4875('0x4a')][_0x4875('0x4c')]?_0xc5de54[_0x4875('0x4a')]:_0x809285['model'];_0xc5de54[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x400332[_0x4875('0x46')][_0x4875('0x50')]);_0xc5de54[_0x4875('0x51')]=qs[_0x4875('0x52')](_['pick'](_0x400332[_0x4875('0x46')],_0x809285[_0x4875('0x52')]));if(_0x400332[_0x4875('0x46')][_0x4875('0x54')]){_0xc5de54[_0x4875('0x51')]=_[_0x4875('0x55')](_0xc5de54[_0x4875('0x51')],{'$or':_['map'](_0xc5de54['attributes'],function(_0x242752){var _0x281f10={};_0x281f10[_0x242752]={'$like':'%'+_0x400332[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x281f10;})});}_0xc5de54=_[_0x4875('0x55')]({},_0xc5de54,_0x400332[_0x4875('0x60')]);return _0x2d8e52['getApplications'](_0xc5de54);}})[_0x4875('0x25')](function(_0x40ab0b){if(_0x40ab0b){_0x7f3a4b=_0x40ab0b[_0x4875('0x4c')];if(!_0x400332[_0x4875('0x46')][_0x4875('0x4d')]('nolimit')){_0xc5de54[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x400332[_0x4875('0x46')][_0x4875('0x35')]);_0xc5de54[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x400332[_0x4875('0x46')][_0x4875('0x32')]);}return _0x2d8e52[_0x4875('0xcc')](_0xc5de54);}})[_0x4875('0x25')](function(_0x204574){if(_0x204574){return _0x204574?{'count':_0x7f3a4b,'rows':_0x204574}:null;}})[_0x4875('0x25')](respondWithResult(_0x33b7f6,null))[_0x4875('0x6a')](handleError(_0x33b7f6,null));};exports[_0x4875('0xcd')]=function(_0x49ad87,_0x45ced9,_0xe4d918){var _0x3e5e05={'raw':![],'where':{}};var _0x2701dc={};var _0x48a3a9={'count':0x0,'rows':[]};return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x49ad87[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x45ced9,null))[_0x4875('0x25')](function(_0x315d9f){if(_0x315d9f){_0x2701dc[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0xab')][_0x4875('0x43')]);_0x2701dc[_0x4875('0x46')]=_['keys'](_0x49ad87[_0x4875('0x46')]);_0x2701dc[_0x4875('0x52')]=_[_0x4875('0x48')](_0x2701dc[_0x4875('0x49')],_0x2701dc[_0x4875('0x46')]);_0x3e5e05[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x2701dc[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x49ad87[_0x4875('0x46')][_0x4875('0x4b')]));_0x3e5e05[_0x4875('0x4a')]=_0x3e5e05[_0x4875('0x4a')][_0x4875('0x4c')]?_0x3e5e05[_0x4875('0x4a')]:_0x2701dc[_0x4875('0x49')];if(!_0x49ad87[_0x4875('0x46')]['hasOwnProperty'](_0x4875('0x4e'))){_0x3e5e05[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x49ad87[_0x4875('0x46')][_0x4875('0x35')]);_0x3e5e05[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x49ad87[_0x4875('0x46')][_0x4875('0x32')]);}_0x3e5e05[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x49ad87['query'][_0x4875('0x50')]);_0x3e5e05[_0x4875('0x51')]=qs['filters'](_[_0x4875('0x53')](_0x49ad87['query'],_0x2701dc[_0x4875('0x52')]));_0x3e5e05[_0x4875('0x51')]['SmsAccountId']=_0x315d9f['id'];if(_0x49ad87[_0x4875('0x46')][_0x4875('0x54')]){_0x3e5e05[_0x4875('0x51')]=_['merge'](_0x3e5e05[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x3e5e05[_0x4875('0x4a')],function(_0x1db4d2){var _0x2929cf={};_0x2929cf[_0x1db4d2]={'$like':'%'+_0x49ad87['query'][_0x4875('0x54')]+'%'};return _0x2929cf;})});}_0x3e5e05=_[_0x4875('0x55')]({},_0x3e5e05,_0x49ad87[_0x4875('0x60')]);return db['SmsInteraction']['count']({'where':_0x3e5e05[_0x4875('0x51')]})[_0x4875('0x25')](function(_0x3b5183){_0x48a3a9[_0x4875('0x34')]=_0x3b5183;if(_0x49ad87[_0x4875('0x46')][_0x4875('0x5f')]){_0x3e5e05[_0x4875('0x58')]=[{'model':db[_0x4875('0x7f')],'as':_0x4875('0xce'),'required':![]},{'model':db[_0x4875('0xb8')],'as':_0x4875('0xcf'),'attributes':[_0x4875('0x40'),_0x4875('0xd0'),'internal'],'required':![]},{'model':db[_0x4875('0xd1')],'as':_0x4875('0xd2'),'attributes':['id',_0x4875('0x40'),_0x4875('0xd3')],'where':_0x49ad87[_0x4875('0x46')]['tag']?{'id':_0x49ad87[_0x4875('0x46')][_0x4875('0xd4')]}:undefined,'required':_0x49ad87[_0x4875('0x46')][_0x4875('0xd4')]?!![]:![]}];}return db[_0x4875('0xab')][_0x4875('0x59')](_0x3e5e05);})[_0x4875('0x25')](function(_0x249eb8){_0x48a3a9[_0x4875('0x5a')]=_0x249eb8;return _0x48a3a9;});}})[_0x4875('0x25')](respondWithFilteredResult(_0x45ced9,_0x3e5e05))[_0x4875('0x6a')](handleError(_0x45ced9,null));};exports[_0x4875('0xc5')]=function(_0x1a32d3,_0xeb8a68,_0x2eb57d){var _0x1759ea,_0x167a39,_0x5d17e0;if(_['isNil'](_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')])||_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')]===''){throw new db[(_0x4875('0x80'))]['ValidationError'](_0x4875('0xa0'));}if(_[_0x4875('0xa1')](_0x1a32d3[_0x4875('0x63')]['to'])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))]('to\x20is\x20mandatory');}_0x1759ea=_0x1a32d3['body']['to'];return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x1a32d3[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0xd5')],'as':_0x4875('0xd6'),'include':[{'model':db[_0x4875('0x7f')],'as':'Contacts','where':{'mobile':_0x1759ea},'limit':0x1,'order':[[_0x4875('0x85'),_0x4875('0xa7')]]}]}]})[_0x4875('0x25')](handleEntityNotFound(_0xeb8a68,null))[_0x4875('0x25')](function(_0x1c2965){if(_0x1c2965&&_0x1c2965[_0x4875('0xd6')]){_0x167a39=_0x1c2965['get']({'plain':!![]});if(_0x167a39['List']&&_0x167a39[_0x4875('0xd6')][_0x4875('0xa6')][_0x4875('0x4c')]){return _0x167a39[_0x4875('0xd6')][_0x4875('0xa6')][0x0];}return db['CmContact'][_0x4875('0x62')](_[_0x4875('0xa9')](_0x1a32d3['body'],{'firstName':_0x1759ea,'mobile':_0x1759ea,'phone':_0x1759ea,'ListId':_0x167a39[_0x4875('0x87')]}));}})['then'](handleEntityNotFound(_0xeb8a68,null))[_0x4875('0x25')](function(_0x3bc0fd){if(_0x3bc0fd){_0x5d17e0=_0x3bc0fd;return db[_0x4875('0xab')][_0x4875('0x61')]({'where':{'ContactId':_0x5d17e0['id'],'closed':![],'SmsAccountId':_0x167a39['id']}})[_0x4875('0x25')](function(_0xdad3fb){if(_0xdad3fb){return[_0xdad3fb,![]];}return db['SmsInteraction'][_0x4875('0x62')]({'UserId':_0x1a32d3[_0x4875('0x64')]['id'],'ContactId':_0x5d17e0['id'],'SmsAccountId':_0x167a39['id'],'phone':_0x1759ea,'firstMsgDirection':_0x4875('0xd7'),'Messages':[_['merge'](_0x1a32d3['body'],{'read':![],'body':_0x1a32d3['body'][_0x4875('0x63')],'phone':_0x1759ea,'SmsAccountId':_0x167a39['id'],'UserId':_0x1a32d3['user']['id'],'ContactId':_0x5d17e0['id']})]},{'include':[{'model':db[_0x4875('0xb4')],'as':_0x4875('0xd8')}]})['then'](function(_0x56ce0f){return[_0x56ce0f,!![]];});});}})[_0x4875('0xd9')](function(_0x1444bc,_0x44058a){if(_0x44058a){return _0x1444bc;}return db[_0x4875('0xb4')][_0x4875('0x62')](_[_0x4875('0x55')](_0x1a32d3[_0x4875('0x63')],{'read':![],'body':_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')],'phone':_0x1759ea,'SmsAccountId':_0x167a39['id'],'SmsInteractionId':_0x1444bc['id'],'UserId':_0x1a32d3[_0x4875('0x64')]['id'],'ContactId':_0x5d17e0['id']}))[_0x4875('0x25')](function(_0x5bc483){_0x1444bc[_0x4875('0xda')]['Messages']=[];_0x1444bc[_0x4875('0xda')]['Messages']['push'](_0x5bc483[_0x4875('0xda')]);return _0x1444bc;});})[_0x4875('0x25')](respondWithResult(_0xeb8a68,null))[_0x4875('0x6a')](handleError(_0xeb8a68,null));};exports[_0x4875('0x2f')]=function(_0x2cffcc,_0x282023,_0x1ddc42){if(_0x2cffcc['body']['id']){delete _0x2cffcc[_0x4875('0x63')]['id'];}var _0x1ab02c,_0x237bda,_0x2c5ae5;return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x2cffcc[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x282023,null))['then'](function(_0x55e5be){if(_0x55e5be){_0x2c5ae5=_0x55e5be;logger[_0x4875('0xc0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4875('0x2f'),_0x4875('0xdb'),_0x55e5be['type'],util[_0x4875('0xdc')](_0x2cffcc['body'],{'showHidden':![],'depth':null}));switch(_0x55e5be[_0x4875('0x56')]){case'skebby':if(_0x2cffcc['body']['skebby_dispatch_id']&&_0x2cffcc[_0x4875('0x63')]['status']){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')];return db['SmsMessage'][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc['body'][_0x4875('0xdd')]}});}break;case _0x4875('0x8e'):if(_0x2cffcc['body'][_0x4875('0xde')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0xdf')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0xdf')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0xde')]}});}break;case'clicksend':if(_0x2cffcc[_0x4875('0x63')][_0x4875('0x90')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0xe0')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0xe0')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0x90')]}});}break;case _0x4875('0x94'):var _0xcc2890=_0x2cffcc['body']['results'][0x0];if(_0xcc2890[_0x4875('0x8b')]&&_0xcc2890[_0x4875('0x2f')][_0x4875('0xe1')]==='DELIVERED'){_0x237bda=_0xcc2890[_0x4875('0x2f')][_0x4875('0xe1')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0xcc2890[_0x4875('0x8b')]}});}break;case _0x4875('0x9a'):if(_0x2cffcc['body'][_0x4875('0x8b')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')];return db['SmsMessage'][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc['body'][_0x4875('0x8b')]}});}break;case _0x4875('0x9d'):if(_0x2cffcc[_0x4875('0x63')][0x0]['message']['id']){_0x237bda=_0x2cffcc[_0x4875('0x63')][0x0][_0x4875('0x56')];return db['SmsMessage']['find']({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][0x0][_0x4875('0x2c')]['id']}});}break;case _0x4875('0xe2'):if(_0x2cffcc[_0x4875('0x63')][_0x4875('0xe3')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')]){_0x237bda=_0x2cffcc[_0x4875('0x63')]['status'];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x282023,null))[_0x4875('0x25')](function(_0x1736da){if(_0x1736da){_0x1ab02c=_0x1736da;switch(_0x2c5ae5[_0x4875('0x56')]){case'skebby':if(_0x237bda===_0x4875('0xe4')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),'skebby',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x8e'):if(_0x237bda==='1'){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4875('0x2f'),_0x4875('0xe5'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x8f'):if(!_0x2cffcc['body'][_0x4875('0xe6')]&&_0x237bda>=0xc8&&_0x237bda<=0xce){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger['error'](_0x4875('0x28'),_0x4875('0x2f'),'clicksend',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x94'):var _0x33abc4=_0x2cffcc[_0x4875('0x63')]['results'][0x0];if(_0x33abc4[_0x4875('0x2f')][_0x4875('0xe1')]===_0x4875('0xe4')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x94'),util[_0x4875('0xdc')](_0x2cffcc['body'],{'showHidden':![],'depth':null}));}break;case _0x4875('0x9a'):if(_0x237bda==_0x4875('0xe7')||_0x237bda==_0x4875('0xe8')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger['error'](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x9a'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x9d'):if(_0x237bda=='message-delivered'){return _0x1ab02c['update']({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x9d'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0xe2'):if(_0x237bda==='DELIVRD'||_0x237bda===_0x4875('0xe9')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),'intelepeer',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x1ab02c;}})[_0x4875('0x25')](respondWithResult(_0x282023,null))[_0x4875('0x6a')](handleError(_0x282023,null));};exports[_0x4875('0xea')]=function(_0x3fcae8,_0x14ec15,_0x18e500){var _0x32e6fa,_0x1384ec,_0x5736c7;return db[_0x4875('0x42')]['find']({'where':{'id':_0x3fcae8['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x14ec15,null))[_0x4875('0x25')](function(_0x555ac){if(_0x555ac){_0x5736c7=_0x555ac;logger[_0x4875('0xc0')](_0x4875('0x28'),_0x4875('0x2f'),'received\x20delivery\x20report\x20from',_0x555ac[_0x4875('0x56')],util[_0x4875('0xdc')](_0x3fcae8[_0x4875('0x46')],{'showHidden':![],'depth':null}));switch(_0x555ac['type']){case _0x4875('0x97'):if(_0x3fcae8['query'][_0x4875('0xeb')]&&_0x3fcae8[_0x4875('0x46')][_0x4875('0xec')]){_0x1384ec=_0x3fcae8[_0x4875('0x46')][_0x4875('0xec')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x3fcae8['query']['message-id']}});}break;}}})[_0x4875('0x25')](handleEntityNotFound(_0x14ec15,null))[_0x4875('0x25')](function(_0x290a53){if(_0x290a53){_0x32e6fa=_0x290a53;switch(_0x5736c7[_0x4875('0x56')]){case'csc':if(_0x1384ec==='2'||_0x1384ec==='6'){return _0x32e6fa['update']({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x97'),util[_0x4875('0xdc')](_0x3fcae8['query'],{'showHidden':![],'depth':null}));};break;}return _0x32e6fa;}})[_0x4875('0x25')](respondWithResult(_0x14ec15,null))[_0x4875('0x6a')](handleError(_0x14ec15,null));};exports['addAgents']=function(_0xd6adf1,_0x26c0bc,_0x189e43){return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0xd6adf1[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x26c0bc,null))[_0x4875('0x25')](function(_0x348646){if(_0x348646){return _0x348646[_0x4875('0xed')](_0xd6adf1['body'][_0x4875('0x73')],_[_0x4875('0xa8')](_0xd6adf1[_0x4875('0x63')],[_0x4875('0x73'),'id'])||{})['spread'](function(_0xcda813){for(var _0x2bc0ca=0x0;_0x2bc0ca<_0xd6adf1[_0x4875('0x63')][_0x4875('0x73')][_0x4875('0x4c')];_0x2bc0ca+=0x1){socket[_0x4875('0xee')](_0x4875('0xef'),{'UserId':Number(_0xd6adf1[_0x4875('0x63')][_0x4875('0x73')][_0x2bc0ca]),'SmsAccountId':Number(_0xd6adf1[_0x4875('0x5c')]['id'])});}return _0xcda813;});}})['then'](respondWithResult(_0x26c0bc,null))[_0x4875('0x6a')](handleError(_0x26c0bc,null));};exports[_0x4875('0xf0')]=function(_0x48cf4a,_0x39d188,_0x36863e){return db['SmsAccount']['find']({'where':{'id':_0x48cf4a[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x39d188,null))[_0x4875('0x25')](function(_0x1a1231){if(_0x1a1231){return _0x1a1231['removeAgents'](_0x48cf4a['query'][_0x4875('0x73')])[_0x4875('0x25')](function(){if(_[_0x4875('0xf1')](_0x48cf4a['query'][_0x4875('0x73')])){for(var _0x4307e5=0x0;_0x4307e5<_0x48cf4a[_0x4875('0x46')]['ids'][_0x4875('0x4c')];_0x4307e5+=0x1){socket[_0x4875('0xee')](_0x4875('0xf2'),{'UserId':Number(_0x48cf4a[_0x4875('0x46')][_0x4875('0x73')][_0x4307e5]),'SmsAccountId':Number(_0x48cf4a['params']['id'])});}}else{socket[_0x4875('0xee')](_0x4875('0xf2'),{'UserId':Number(_0x48cf4a[_0x4875('0x46')]['ids']),'SmsAccountId':Number(_0x48cf4a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39d188,null))[_0x4875('0x6a')](handleError(_0x39d188,null));};exports[_0x4875('0xf3')]=function(_0x407c9e,_0x5f0dec,_0x19a915){var _0x36c258={};var _0xf0515d={};var _0x4e63fb;var _0x2b9be2;return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x407c9e[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x5f0dec,null))[_0x4875('0x25')](function(_0x2f8e1b){if(_0x2f8e1b){_0x4e63fb=_0x2f8e1b;_0xf0515d[_0x4875('0x49')]=_['keys'](db['User'][_0x4875('0x43')]);_0xf0515d[_0x4875('0x46')]=_['keys'](_0x407c9e[_0x4875('0x46')]);_0xf0515d[_0x4875('0x52')]=_[_0x4875('0x48')](_0xf0515d[_0x4875('0x49')],_0xf0515d[_0x4875('0x46')]);_0x36c258['attributes']=_[_0x4875('0x48')](_0xf0515d['model'],qs[_0x4875('0x4b')](_0x407c9e[_0x4875('0x46')]['fields']));_0x36c258[_0x4875('0x4a')]=_0x36c258[_0x4875('0x4a')]['length']?_0x36c258[_0x4875('0x4a')]:_0xf0515d[_0x4875('0x49')];_0x36c258[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x407c9e[_0x4875('0x46')][_0x4875('0x50')]);_0x36c258[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x407c9e[_0x4875('0x46')],_0xf0515d[_0x4875('0x52')]));if(_0x407c9e[_0x4875('0x46')][_0x4875('0x54')]){_0x36c258[_0x4875('0x51')]=_[_0x4875('0x55')](_0x36c258[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x36c258['attributes'],function(_0x3fcdd5){var _0x2c9650={};_0x2c9650[_0x3fcdd5]={'$like':'%'+_0x407c9e[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x2c9650;})});}_0x36c258=_[_0x4875('0x55')]({},_0x36c258,_0x407c9e[_0x4875('0x60')]);return _0x4e63fb[_0x4875('0xf3')](_0x36c258);}})[_0x4875('0x25')](function(_0x3bad46){if(_0x3bad46){_0x2b9be2=_0x3bad46[_0x4875('0x4c')];if(!_0x407c9e[_0x4875('0x46')][_0x4875('0x4d')]('nolimit')){_0x36c258[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x407c9e[_0x4875('0x46')]['limit']);_0x36c258[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x407c9e[_0x4875('0x46')][_0x4875('0x32')]);}return _0x4e63fb[_0x4875('0xf3')](_0x36c258);}})[_0x4875('0x25')](function(_0x334746){if(_0x334746){return _0x334746?{'count':_0x2b9be2,'rows':_0x334746}:null;}})[_0x4875('0x25')](respondWithResult(_0x5f0dec,null))[_0x4875('0x6a')](handleError(_0x5f0dec,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index cdb3603..6961b27 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 _0x9a72=['exports','events','../../mysqldb','SmsAccount','save','update','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a72,0xd9));var _0x29a7=function(_0x1e7c65,_0x2d82b0){_0x1e7c65=_0x1e7c65-0x0;var _0x130828=_0x9a72[_0x1e7c65];return _0x130828;};'use strict';var EventEmitter=require(_0x29a7('0x0'));var SmsAccount=require(_0x29a7('0x1'))['db'][_0x29a7('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29a7('0x3'),'afterUpdate':_0x29a7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8905){return function(_0x438385,_0x5e29e1,_0x21254f){SmsAccountEvents[_0x29a7('0x5')](_0x3c8905+':'+_0x438385['id'],_0x438385);SmsAccountEvents['emit'](_0x3c8905,_0x438385);_0x21254f(null);};}for(var e in events){if(events[_0x29a7('0x6')](e)){var event=events[e];SmsAccount[_0x29a7('0x7')](e,emitEvent(event));}}module[_0x29a7('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xa7f9=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x33cca3,_0x1e954d){var _0x30f6fd=function(_0x55e587){while(--_0x55e587){_0x33cca3['push'](_0x33cca3['shift']());}};_0x30f6fd(++_0x1e954d);}(_0xa7f9,0x87));var _0x9a7f=function(_0x2007e6,_0x43b204){_0x2007e6=_0x2007e6-0x0;var _0x31a410=_0xa7f9[_0x2007e6];return _0x31a410;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9a7f('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9a7f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a7f('0x2'),'afterDestroy':_0x9a7f('0x3')};function emitEvent(_0x53c0a9){return function(_0x5081c2,_0x150eb7,_0x1f8661){SmsAccountEvents[_0x9a7f('0x4')](_0x53c0a9+':'+_0x5081c2['id'],_0x5081c2);SmsAccountEvents[_0x9a7f('0x4')](_0x53c0a9,_0x5081c2);_0x1f8661(null);};}for(var e in events){if(events[_0x9a7f('0x5')](e)){var event=events[e];SmsAccount[_0x9a7f('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 32561a1..c0d4265 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 _0x9607=['../../config/environment','exports','define','sms_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9607,0x67));var _0x7960=function(_0x18424a,_0xf3eba1){_0x18424a=_0x18424a-0x0;var _0x5a278b=_0x9607[_0x18424a];return _0x5a278b;};'use strict';var _=require(_0x7960('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7960('0x1'));var moment=require(_0x7960('0x2'));var BPromise=require(_0x7960('0x3'));var rp=require(_0x7960('0x4'));var fs=require('fs');var path=require(_0x7960('0x5'));var rimraf=require(_0x7960('0x6'));var config=require(_0x7960('0x7'));var attributes=require('./smsAccount.attributes');module[_0x7960('0x8')]=function(_0x152f43,_0x102cb9){return _0x152f43[_0x7960('0x9')]('SmsAccount',attributes,{'tableName':_0x7960('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a35=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','define','util','../../config/logger'];(function(_0xd501b,_0x570d56){var _0x26a42a=function(_0x10a148){while(--_0x10a148){_0xd501b['push'](_0xd501b['shift']());}};_0x26a42a(++_0x570d56);}(_0x3a35,0x1a2));var _0x53a3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3a35[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x53a3('0x0'));var logger=require(_0x53a3('0x1'))(_0x53a3('0x2'));var moment=require(_0x53a3('0x3'));var BPromise=require(_0x53a3('0x4'));var rp=require(_0x53a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53a3('0x6'));var config=require(_0x53a3('0x7'));var attributes=require(_0x53a3('0x8'));module['exports']=function(_0x3ad1db,_0x34533b){return _0x3ad1db[_0x53a3('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b957e00..0aa1375 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 _0xda22=['where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x578147,_0x1a4005){var _0x22a42b=function(_0xe583e5){while(--_0xe583e5){_0x578147['push'](_0x578147['shift']());}};_0x22a42b(++_0x1a4005);}(_0xda22,0x75));var _0x2da2=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0xda22[_0x208749];return _0x3e0042;};'use strict';var _=require('lodash');var util=require(_0x2da2('0x0'));var moment=require(_0x2da2('0x1'));var BPromise=require(_0x2da2('0x2'));var rs=require(_0x2da2('0x3'));var fs=require('fs');var Redis=require(_0x2da2('0x4'));var db=require(_0x2da2('0x5'))['db'];var utils=require(_0x2da2('0x6'));var logger=require(_0x2da2('0x7'))(_0x2da2('0x8'));var config=require(_0x2da2('0x9'));var jayson=require(_0x2da2('0xa'));var client=jayson[_0x2da2('0xb')][_0x2da2('0xc')]({'port':0x232a});config[_0x2da2('0xd')]=_['defaults'](config['redis'],{'host':_0x2da2('0xe'),'port':0x18eb});var socket=require(_0x2da2('0xf'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x587b7e,_0x3614b2,_0x528782){return new BPromise(function(_0x531f36,_0x9348b8){return client['request'](_0x587b7e,_0x528782)[_0x2da2('0x10')](function(_0x179685){logger[_0x2da2('0x11')](_0x2da2('0x12'),_0x3614b2,_0x2da2('0x13'));logger[_0x2da2('0x14')](_0x2da2('0x15'),_0x3614b2,_0x2da2('0x13'),JSON['stringify'](_0x179685));if(_0x179685[_0x2da2('0x16')]){if(_0x179685[_0x2da2('0x16')][_0x2da2('0x17')]===0x1f4){logger[_0x2da2('0x16')](_0x2da2('0x12'),_0x3614b2,_0x179685[_0x2da2('0x16')][_0x2da2('0x18')]);return _0x9348b8(_0x179685['error'][_0x2da2('0x18')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x3614b2,_0x179685[_0x2da2('0x16')]['message']);return _0x531f36(_0x179685['error'][_0x2da2('0x18')]);}else{logger['info'](_0x2da2('0x12'),_0x3614b2,'request\x20sent');_0x531f36(_0x179685[_0x2da2('0x19')]['message']);}})['catch'](function(_0x5c3495){logger[_0x2da2('0x16')](_0x2da2('0x12'),_0x3614b2,_0x5c3495);_0x9348b8(_0x5c3495);});});}exports[_0x2da2('0x1a')]=function(_0x46c6c4){var _0x1cd2b1=this;return new Promise(function(_0x1a49d5,_0x15d402){return db[_0x2da2('0x1b')][_0x2da2('0x1c')]({'raw':_0x46c6c4[_0x2da2('0x1d')]?_0x46c6c4[_0x2da2('0x1d')][_0x2da2('0x1e')]===undefined?!![]:![]:!![],'where':_0x46c6c4[_0x2da2('0x1d')]?_0x46c6c4['options'][_0x2da2('0x1f')]||null:null,'attributes':_0x46c6c4['options']?_0x46c6c4['options'][_0x2da2('0x20')]||null:null,'include':_0x46c6c4[_0x2da2('0x1d')]?_0x46c6c4[_0x2da2('0x1d')][_0x2da2('0x21')]?_[_0x2da2('0x22')](_0x46c6c4[_0x2da2('0x1d')][_0x2da2('0x21')],function(_0x322d64){return{'model':db[_0x322d64[_0x2da2('0x23')]],'as':_0x322d64['as'],'attributes':_0x322d64['attributes'],'include':_0x322d64[_0x2da2('0x21')]?_['map'](_0x322d64[_0x2da2('0x21')],function(_0x22b788){return{'model':db[_0x22b788['model']],'as':_0x22b788['as'],'attributes':_0x22b788[_0x2da2('0x20')],'include':_0x22b788['include']?_[_0x2da2('0x22')](_0x22b788[_0x2da2('0x21')],function(_0x1c77e9){return{'model':db[_0x1c77e9['model']],'as':_0x1c77e9['as'],'attributes':_0x1c77e9[_0x2da2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x89087c){logger['info'](_0x2da2('0x1a'),_0x46c6c4);logger[_0x2da2('0x14')](_0x2da2('0x1a'),_0x46c6c4,JSON[_0x2da2('0x24')](_0x89087c));_0x1a49d5(_0x89087c);})['catch'](function(_0x169006){logger[_0x2da2('0x16')](_0x2da2('0x1a'),_0x169006[_0x2da2('0x18')],_0x46c6c4);_0x15d402(_0x1cd2b1[_0x2da2('0x16')](0x1f4,_0x169006[_0x2da2('0x18')]));});});}; \ No newline at end of file +var _0xa2d8=['defaults','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options','where','map','model','attributes','include','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x12d014,_0x57a28b){var _0x3398de=function(_0x364e3d){while(--_0x364e3d){_0x12d014['push'](_0x12d014['shift']());}};_0x3398de(++_0x57a28b);}(_0xa2d8,0x165));var _0x8a2d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa2d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8a2d('0x0'));var moment=require(_0x8a2d('0x1'));var BPromise=require(_0x8a2d('0x2'));var rs=require(_0x8a2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a2d('0x4'))['db'];var utils=require(_0x8a2d('0x5'));var logger=require(_0x8a2d('0x6'))(_0x8a2d('0x7'));var config=require(_0x8a2d('0x8'));var jayson=require(_0x8a2d('0x9'));var client=jayson[_0x8a2d('0xa')][_0x8a2d('0xb')]({'port':0x232a});config[_0x8a2d('0xc')]=_[_0x8a2d('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8a2d('0xe'))(new Redis(config['redis']));require(_0x8a2d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5dfb0f,_0x227197,_0x4dc66a){return new BPromise(function(_0x4fe7ec,_0x10c958){return client[_0x8a2d('0x10')](_0x5dfb0f,_0x4dc66a)[_0x8a2d('0x11')](function(_0x1734f){logger['info'](_0x8a2d('0x12'),_0x227197,_0x8a2d('0x13'));logger[_0x8a2d('0x14')](_0x8a2d('0x15'),_0x227197,'request\x20sent',JSON[_0x8a2d('0x16')](_0x1734f));if(_0x1734f[_0x8a2d('0x17')]){if(_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x18')]===0x1f4){logger[_0x8a2d('0x17')](_0x8a2d('0x12'),_0x227197,_0x1734f['error'][_0x8a2d('0x19')]);return _0x10c958(_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x19')]);}logger[_0x8a2d('0x17')]('SmsAccount,\x20%s,\x20%s',_0x227197,_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x19')]);return _0x4fe7ec(_0x1734f[_0x8a2d('0x17')]['message']);}else{logger[_0x8a2d('0x1a')](_0x8a2d('0x12'),_0x227197,_0x8a2d('0x13'));_0x4fe7ec(_0x1734f[_0x8a2d('0x1b')]['message']);}})[_0x8a2d('0x1c')](function(_0x222091){logger['error']('SmsAccount,\x20%s,\x20%s',_0x227197,_0x222091);_0x10c958(_0x222091);});});}exports[_0x8a2d('0x1d')]=function(_0x3a345e){var _0x502953=this;return new Promise(function(_0x2d46cf,_0x57ebcf){return db['SmsAccount'][_0x8a2d('0x1e')]({'raw':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e[_0x8a2d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e['options'][_0x8a2d('0x20')]||null:null,'attributes':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e['options']['attributes']||null:null,'include':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e[_0x8a2d('0x1f')]['include']?_[_0x8a2d('0x21')](_0x3a345e[_0x8a2d('0x1f')]['include'],function(_0x425585){return{'model':db[_0x425585[_0x8a2d('0x22')]],'as':_0x425585['as'],'attributes':_0x425585[_0x8a2d('0x23')],'include':_0x425585[_0x8a2d('0x24')]?_[_0x8a2d('0x21')](_0x425585[_0x8a2d('0x24')],function(_0x55a620){return{'model':db[_0x55a620['model']],'as':_0x55a620['as'],'attributes':_0x55a620[_0x8a2d('0x23')],'include':_0x55a620[_0x8a2d('0x24')]?_[_0x8a2d('0x21')](_0x55a620[_0x8a2d('0x24')],function(_0x27851d){return{'model':db[_0x27851d[_0x8a2d('0x22')]],'as':_0x27851d['as'],'attributes':_0x27851d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a2d('0x11')](function(_0x496ab7){logger[_0x8a2d('0x1a')](_0x8a2d('0x1d'),_0x3a345e);logger[_0x8a2d('0x14')](_0x8a2d('0x1d'),_0x3a345e,JSON[_0x8a2d('0x16')](_0x496ab7));_0x2d46cf(_0x496ab7);})[_0x8a2d('0x1c')](function(_0x92f75c){logger[_0x8a2d('0x17')](_0x8a2d('0x1d'),_0x92f75c['message'],_0x3a345e);_0x57ebcf(_0x502953[_0x8a2d('0x17')](0x1f4,_0x92f75c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 50a7a7d..6ec768b 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 c57f63b..ec93bc5 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x519b00,_0x30427a){var _0x35ea24=function(_0x4c93f4){while(--_0x4c93f4){_0x519b00['push'](_0x519b00['shift']());}};_0x35ea24(++_0x30427a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a94b9,_0x353ad1){_0x5a94b9=_0x5a94b9-0x0;var _0x191437=_0xedd9[_0x5a94b9];return _0x191437;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d098c40..5803bbe 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 _0x1ec6=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x2dd47e,_0x1d28ee){var _0x4ddee6=function(_0x4348da){while(--_0x4348da){_0x2dd47e['push'](_0x2dd47e['shift']());}};_0x4ddee6(++_0x1d28ee);}(_0x1ec6,0x1bc));var _0x61ec=function(_0x509fbf,_0x4c5e76){_0x509fbf=_0x509fbf-0x0;var _0x790c7f=_0x1ec6[_0x509fbf];return _0x790c7f;};'use strict';var Sequelize=require(_0x61ec('0x0'));module[_0x61ec('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x61ec('0x2')],'allowNull':![],'defaultValue':_0x61ec('0x3')},'appdata':{'type':Sequelize[_0x61ec('0x4')]()},'description':{'type':Sequelize[_0x61ec('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x61ec('0x5')}}; \ No newline at end of file +var _0x7c35=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7c35,0x139));var _0x57c3=function(_0x4e79ec,_0x56d359){_0x4e79ec=_0x4e79ec-0x0;var _0x5828cd=_0x7c35[_0x4e79ec];return _0x5828cd;};'use strict';var Sequelize=require(_0x57c3('0x0'));module[_0x57c3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x57c3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x57c3('0x3')]()},'description':{'type':Sequelize[_0x57c3('0x2')]},'interval':{'type':Sequelize[_0x57c3('0x2')],'defaultValue':_0x57c3('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1fd9dbe..6ef1295 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 _0xebad=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','show','params','length','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xebad,0x168));var _0xdeba=function(_0x316c97,_0x5517fa){_0x316c97=_0x316c97-0x0;var _0xe7b268=_0xebad[_0x316c97];return _0xe7b268;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdeba('0x0'));var zipdir=require(_0xdeba('0x1'));var jsonpatch=require(_0xdeba('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdeba('0x3'));var Mustache=require(_0xdeba('0x4'));var util=require(_0xdeba('0x5'));var path=require(_0xdeba('0x6'));var sox=require(_0xdeba('0x7'));var csv=require(_0xdeba('0x8'));var ejs=require(_0xdeba('0x9'));var fs=require('fs');var fs_extra=require(_0xdeba('0xa'));var _=require('lodash');var squel=require(_0xdeba('0xb'));var crypto=require(_0xdeba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdeba('0xd'));var toCsv=require(_0xdeba('0x8'));var querystring=require(_0xdeba('0xe'));var Papa=require(_0xdeba('0xf'));var Redis=require(_0xdeba('0x10'));var authService=require(_0xdeba('0x11'));var qs=require(_0xdeba('0x12'));var as=require(_0xdeba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdeba('0x14'))(_0xdeba('0x15'));var utils=require(_0xdeba('0x16'));var config=require(_0xdeba('0x17'));var licenseUtil=require(_0xdeba('0x18'));var db=require(_0xdeba('0x19'))['db'];function respondWithStatusCode(_0x223e12,_0x67c28d){_0x67c28d=_0x67c28d||0xcc;return function(_0x16f70f){if(_0x16f70f){return _0x223e12['sendStatus'](_0x67c28d);}return _0x223e12['status'](_0x67c28d)[_0xdeba('0x1a')]();};}function respondWithResult(_0x35ab5c,_0x559a87){_0x559a87=_0x559a87||0xc8;return function(_0x143f10){if(_0x143f10){return _0x35ab5c[_0xdeba('0x1b')](_0x559a87)['json'](_0x143f10);}};}function respondWithFilteredResult(_0x35f592,_0x2d293a){return function(_0xf651e9){if(_0xf651e9){var _0x5a7f34=typeof _0x2d293a[_0xdeba('0x1c')]===_0xdeba('0x1d')&&typeof _0x2d293a[_0xdeba('0x1e')]===_0xdeba('0x1d');var _0x534cf4=_0xf651e9['count'];var _0xb977a6=_0x5a7f34?0x0:_0x2d293a['offset'];var _0x560b54=_0x5a7f34?_0xf651e9['count']:_0x2d293a['offset']+_0x2d293a[_0xdeba('0x1e')];var _0x293d30;if(_0x560b54>=_0x534cf4){_0x560b54=_0x534cf4;_0x293d30=0xc8;}else{_0x293d30=0xce;}_0x35f592['status'](_0x293d30);return _0x35f592[_0xdeba('0x1f')](_0xdeba('0x20'),_0xb977a6+'-'+_0x560b54+'/'+_0x534cf4)[_0xdeba('0x21')](_0xf651e9);}return null;};}function patchUpdates(_0x1d4fcf){return function(_0x218a2f){try{jsonpatch['apply'](_0x218a2f,_0x1d4fcf,!![]);}catch(_0x523b4a){return BPromise[_0xdeba('0x22')](_0x523b4a);}return _0x218a2f[_0xdeba('0x23')]();};}function saveUpdates(_0x3113c4,_0x2947d3){return function(_0x2a6db6){if(_0x2a6db6){return _0x2a6db6[_0xdeba('0x24')](_0x3113c4)[_0xdeba('0x25')](function(_0x3a6925){return _0x3a6925;});}return null;};}function removeEntity(_0x139000,_0x37cd4a){return function(_0x1e9399){if(_0x1e9399){return _0x1e9399[_0xdeba('0x26')]()['then'](function(){_0x139000['status'](0xcc)[_0xdeba('0x1a')]();});}};}function handleEntityNotFound(_0x268aa6,_0x1c3ffc){return function(_0x290cb2){if(!_0x290cb2){_0x268aa6['sendStatus'](0x194);}return _0x290cb2;};}function handleError(_0x57b86e,_0x41d9bc){_0x41d9bc=_0x41d9bc||0x1f4;return function(_0x33ad30){logger['error'](_0x33ad30['stack']);if(_0x33ad30[_0xdeba('0x27')]){delete _0x33ad30[_0xdeba('0x27')];}_0x57b86e[_0xdeba('0x1b')](_0x41d9bc)[_0xdeba('0x28')](_0x33ad30);};}exports[_0xdeba('0x29')]=function(_0x31a491,_0x309b3f){var _0x33b4c5={},_0x312ca1={},_0x21e21b={'count':0x0,'rows':[]};var _0x1f0468=_[_0xdeba('0x2a')](db[_0xdeba('0x2b')][_0xdeba('0x2c')],function(_0x5efa82){return{'name':_0x5efa82[_0xdeba('0x2d')],'type':_0x5efa82[_0xdeba('0x2e')][_0xdeba('0x2f')]};});_0x312ca1[_0xdeba('0x30')]=_[_0xdeba('0x2a')](_0x1f0468,_0xdeba('0x27'));_0x312ca1['query']=_[_0xdeba('0x31')](_0x31a491[_0xdeba('0x32')]);_0x312ca1[_0xdeba('0x33')]=_[_0xdeba('0x34')](_0x312ca1[_0xdeba('0x30')],_0x312ca1[_0xdeba('0x32')]);_0x33b4c5['attributes']=_[_0xdeba('0x34')](_0x312ca1[_0xdeba('0x30')],qs[_0xdeba('0x35')](_0x31a491[_0xdeba('0x32')][_0xdeba('0x35')]));_0x33b4c5[_0xdeba('0x36')]=_0x33b4c5['attributes']['length']?_0x33b4c5['attributes']:_0x312ca1[_0xdeba('0x30')];if(!_0x31a491['query'][_0xdeba('0x37')](_0xdeba('0x38'))){_0x33b4c5[_0xdeba('0x1e')]=qs[_0xdeba('0x1e')](_0x31a491[_0xdeba('0x32')][_0xdeba('0x1e')]);_0x33b4c5[_0xdeba('0x1c')]=qs['offset'](_0x31a491[_0xdeba('0x32')][_0xdeba('0x1c')]);}_0x33b4c5[_0xdeba('0x39')]=qs['sort'](_0x31a491[_0xdeba('0x32')][_0xdeba('0x3a')]);_0x33b4c5[_0xdeba('0x3b')]=qs['filters'](_[_0xdeba('0x3c')](_0x31a491[_0xdeba('0x32')],_0x312ca1[_0xdeba('0x33')]),_0x1f0468);if(_0x31a491['query'][_0xdeba('0x3d')]){_0x33b4c5[_0xdeba('0x3b')]=_[_0xdeba('0x3e')](_0x33b4c5[_0xdeba('0x3b')],{'$or':_[_0xdeba('0x2a')](_0x1f0468,function(_0xbe7ef5){if(_0xbe7ef5[_0xdeba('0x2e')]!==_0xdeba('0x3f')){var _0x240c92={};_0x240c92[_0xbe7ef5[_0xdeba('0x27')]]={'$like':'%'+_0x31a491['query']['filter']+'%'};return _0x240c92;}})});}_0x33b4c5=_['merge']({},_0x33b4c5,_0x31a491[_0xdeba('0x40')]);var _0x150e2b={'where':_0x33b4c5['where']};return db['SmsApplication'][_0xdeba('0x41')](_0x150e2b)['then'](function(_0x7af606){_0x21e21b['count']=_0x7af606;if(_0x31a491[_0xdeba('0x32')]['includeAll']){_0x33b4c5[_0xdeba('0x42')]=[{'all':!![]}];}return db[_0xdeba('0x2b')]['findAll'](_0x33b4c5);})[_0xdeba('0x25')](function(_0x3d22cc){_0x21e21b['rows']=_0x3d22cc;return _0x21e21b;})['then'](respondWithFilteredResult(_0x309b3f,_0x33b4c5))['catch'](handleError(_0x309b3f,null));};exports[_0xdeba('0x43')]=function(_0x1c5c18,_0x29a22d){var _0x43022d={'raw':!![],'where':{'id':_0x1c5c18[_0xdeba('0x44')]['id']}},_0x3a02c6={};_0x3a02c6[_0xdeba('0x30')]=_[_0xdeba('0x31')](db['SmsApplication'][_0xdeba('0x2c')]);_0x3a02c6['query']=_[_0xdeba('0x31')](_0x1c5c18[_0xdeba('0x32')]);_0x3a02c6[_0xdeba('0x33')]=_['intersection'](_0x3a02c6[_0xdeba('0x30')],_0x3a02c6[_0xdeba('0x32')]);_0x43022d['attributes']=_[_0xdeba('0x34')](_0x3a02c6[_0xdeba('0x30')],qs[_0xdeba('0x35')](_0x1c5c18[_0xdeba('0x32')][_0xdeba('0x35')]));_0x43022d[_0xdeba('0x36')]=_0x43022d['attributes'][_0xdeba('0x45')]?_0x43022d[_0xdeba('0x36')]:_0x3a02c6['model'];if(_0x1c5c18[_0xdeba('0x32')][_0xdeba('0x46')]){_0x43022d[_0xdeba('0x42')]=[{'all':!![]}];}_0x43022d=_[_0xdeba('0x3e')]({},_0x43022d,_0x1c5c18['options']);return db[_0xdeba('0x2b')][_0xdeba('0x47')](_0x43022d)[_0xdeba('0x25')](handleEntityNotFound(_0x29a22d,null))[_0xdeba('0x25')](respondWithResult(_0x29a22d,null))[_0xdeba('0x48')](handleError(_0x29a22d,null));};exports[_0xdeba('0x49')]=function(_0x3a8c1d,_0x44c892){return db[_0xdeba('0x2b')]['create'](_0x3a8c1d[_0xdeba('0x4a')],{})[_0xdeba('0x25')](respondWithResult(_0x44c892,0xc9))[_0xdeba('0x48')](handleError(_0x44c892,null));};exports[_0xdeba('0x24')]=function(_0x4ff466,_0xa994ed){if(_0x4ff466[_0xdeba('0x4a')]['id']){delete _0x4ff466[_0xdeba('0x4a')]['id'];}return db[_0xdeba('0x2b')][_0xdeba('0x47')]({'where':{'id':_0x4ff466[_0xdeba('0x44')]['id']}})[_0xdeba('0x25')](handleEntityNotFound(_0xa994ed,null))[_0xdeba('0x25')](saveUpdates(_0x4ff466[_0xdeba('0x4a')],null))[_0xdeba('0x25')](respondWithResult(_0xa994ed,null))[_0xdeba('0x48')](handleError(_0xa994ed,null));};exports[_0xdeba('0x26')]=function(_0x1b76a5,_0x15d5c0){return db['SmsApplication'][_0xdeba('0x47')]({'where':{'id':_0x1b76a5[_0xdeba('0x44')]['id']}})['then'](handleEntityNotFound(_0x15d5c0,null))['then'](removeEntity(_0x15d5c0,null))[_0xdeba('0x48')](handleError(_0x15d5c0,null));}; \ No newline at end of file +var _0x1b5c=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','SmsApplication','find','create','body','destroy','eml-format','rimraf','fast-json-patch'];(function(_0x2ae0a4,_0x13ff20){var _0x4aacb4=function(_0x28ccb4){while(--_0x28ccb4){_0x2ae0a4['push'](_0x2ae0a4['shift']());}};_0x4aacb4(++_0x13ff20);}(_0x1b5c,0x1b3));var _0xc1b5=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x1b5c[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require(_0xc1b5('0x0'));var rimraf=require(_0xc1b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1b5('0x2'));var rp=require('request-promise');var moment=require(_0xc1b5('0x3'));var BPromise=require(_0xc1b5('0x4'));var Mustache=require(_0xc1b5('0x5'));var util=require('util');var path=require(_0xc1b5('0x6'));var sox=require(_0xc1b5('0x7'));var csv=require(_0xc1b5('0x8'));var ejs=require(_0xc1b5('0x9'));var fs=require('fs');var fs_extra=require(_0xc1b5('0xa'));var _=require(_0xc1b5('0xb'));var squel=require(_0xc1b5('0xc'));var crypto=require(_0xc1b5('0xd'));var jsforce=require(_0xc1b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc1b5('0x8'));var querystring=require(_0xc1b5('0xf'));var Papa=require(_0xc1b5('0x10'));var Redis=require(_0xc1b5('0x11'));var authService=require(_0xc1b5('0x12'));var qs=require(_0xc1b5('0x13'));var as=require(_0xc1b5('0x14'));var hardwareService=require(_0xc1b5('0x15'));var logger=require(_0xc1b5('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc1b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10188a,_0x26bacf){_0x26bacf=_0x26bacf||0xcc;return function(_0x54db71){if(_0x54db71){return _0x10188a['sendStatus'](_0x26bacf);}return _0x10188a[_0xc1b5('0x18')](_0x26bacf)[_0xc1b5('0x19')]();};}function respondWithResult(_0x16c8db,_0x4ef618){_0x4ef618=_0x4ef618||0xc8;return function(_0x55e018){if(_0x55e018){return _0x16c8db[_0xc1b5('0x18')](_0x4ef618)['json'](_0x55e018);}};}function respondWithFilteredResult(_0x1a0001,_0xc94c55){return function(_0x23213d){if(_0x23213d){var _0x53f555=typeof _0xc94c55['offset']===_0xc1b5('0x1a')&&typeof _0xc94c55[_0xc1b5('0x1b')]===_0xc1b5('0x1a');var _0x592b13=_0x23213d['count'];var _0x33be65=_0x53f555?0x0:_0xc94c55['offset'];var _0x2b4bf2=_0x53f555?_0x23213d[_0xc1b5('0x1c')]:_0xc94c55[_0xc1b5('0x1d')]+_0xc94c55[_0xc1b5('0x1b')];var _0x1af221;if(_0x2b4bf2>=_0x592b13){_0x2b4bf2=_0x592b13;_0x1af221=0xc8;}else{_0x1af221=0xce;}_0x1a0001[_0xc1b5('0x18')](_0x1af221);return _0x1a0001[_0xc1b5('0x1e')](_0xc1b5('0x1f'),_0x33be65+'-'+_0x2b4bf2+'/'+_0x592b13)[_0xc1b5('0x20')](_0x23213d);}return null;};}function patchUpdates(_0xc7ef72){return function(_0x3d6664){try{jsonpatch[_0xc1b5('0x21')](_0x3d6664,_0xc7ef72,!![]);}catch(_0x5ed1b9){return BPromise['reject'](_0x5ed1b9);}return _0x3d6664[_0xc1b5('0x22')]();};}function saveUpdates(_0xf557e5,_0x3cfd85){return function(_0x22d438){if(_0x22d438){return _0x22d438['update'](_0xf557e5)[_0xc1b5('0x23')](function(_0x53a3ba){return _0x53a3ba;});}return null;};}function removeEntity(_0x5065fe,_0x334164){return function(_0x4f1fdf){if(_0x4f1fdf){return _0x4f1fdf['destroy']()[_0xc1b5('0x23')](function(){_0x5065fe[_0xc1b5('0x18')](0xcc)[_0xc1b5('0x19')]();});}};}function handleEntityNotFound(_0x331542,_0x3552fa){return function(_0x3d53c3){if(!_0x3d53c3){_0x331542[_0xc1b5('0x24')](0x194);}return _0x3d53c3;};}function handleError(_0xc8060c,_0x1cdc2d){_0x1cdc2d=_0x1cdc2d||0x1f4;return function(_0xa89742){logger[_0xc1b5('0x25')](_0xa89742[_0xc1b5('0x26')]);if(_0xa89742['name']){delete _0xa89742[_0xc1b5('0x27')];}_0xc8060c[_0xc1b5('0x18')](_0x1cdc2d)[_0xc1b5('0x28')](_0xa89742);};}exports['index']=function(_0x2f0215,_0x26c48e){var _0xf91be4={},_0x43cb5d={},_0x5cc4f0={'count':0x0,'rows':[]};var _0x441cc9=_[_0xc1b5('0x29')](db['SmsApplication'][_0xc1b5('0x2a')],function(_0x864bb2){return{'name':_0x864bb2[_0xc1b5('0x2b')],'type':_0x864bb2[_0xc1b5('0x2c')]['key']};});_0x43cb5d[_0xc1b5('0x2d')]=_[_0xc1b5('0x29')](_0x441cc9,_0xc1b5('0x27'));_0x43cb5d['query']=_[_0xc1b5('0x2e')](_0x2f0215[_0xc1b5('0x2f')]);_0x43cb5d[_0xc1b5('0x30')]=_[_0xc1b5('0x31')](_0x43cb5d[_0xc1b5('0x2d')],_0x43cb5d[_0xc1b5('0x2f')]);_0xf91be4[_0xc1b5('0x32')]=_[_0xc1b5('0x31')](_0x43cb5d['model'],qs[_0xc1b5('0x33')](_0x2f0215['query']['fields']));_0xf91be4['attributes']=_0xf91be4[_0xc1b5('0x32')][_0xc1b5('0x34')]?_0xf91be4[_0xc1b5('0x32')]:_0x43cb5d[_0xc1b5('0x2d')];if(!_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x35')](_0xc1b5('0x36'))){_0xf91be4[_0xc1b5('0x1b')]=qs[_0xc1b5('0x1b')](_0x2f0215['query']['limit']);_0xf91be4['offset']=qs[_0xc1b5('0x1d')](_0x2f0215[_0xc1b5('0x2f')]['offset']);}_0xf91be4['order']=qs['sort'](_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x37')]);_0xf91be4[_0xc1b5('0x38')]=qs[_0xc1b5('0x30')](_[_0xc1b5('0x39')](_0x2f0215[_0xc1b5('0x2f')],_0x43cb5d[_0xc1b5('0x30')]),_0x441cc9);if(_0x2f0215['query'][_0xc1b5('0x3a')]){_0xf91be4['where']=_[_0xc1b5('0x3b')](_0xf91be4['where'],{'$or':_['map'](_0x441cc9,function(_0x147dcb){if(_0x147dcb[_0xc1b5('0x2c')]!==_0xc1b5('0x3c')){var _0x13b460={};_0x13b460[_0x147dcb[_0xc1b5('0x27')]]={'$like':'%'+_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x3a')]+'%'};return _0x13b460;}})});}_0xf91be4=_[_0xc1b5('0x3b')]({},_0xf91be4,_0x2f0215[_0xc1b5('0x3d')]);var _0x407a39={'where':_0xf91be4[_0xc1b5('0x38')]};return db['SmsApplication'][_0xc1b5('0x1c')](_0x407a39)[_0xc1b5('0x23')](function(_0x51aaf4){_0x5cc4f0[_0xc1b5('0x1c')]=_0x51aaf4;if(_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x3e')]){_0xf91be4[_0xc1b5('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xc1b5('0x40')](_0xf91be4);})['then'](function(_0x43607d){_0x5cc4f0[_0xc1b5('0x41')]=_0x43607d;return _0x5cc4f0;})[_0xc1b5('0x23')](respondWithFilteredResult(_0x26c48e,_0xf91be4))[_0xc1b5('0x42')](handleError(_0x26c48e,null));};exports['show']=function(_0x319d55,_0x411901){var _0x28bf78={'raw':!![],'where':{'id':_0x319d55[_0xc1b5('0x43')]['id']}},_0x37018e={};_0x37018e[_0xc1b5('0x2d')]=_[_0xc1b5('0x2e')](db['SmsApplication']['rawAttributes']);_0x37018e[_0xc1b5('0x2f')]=_[_0xc1b5('0x2e')](_0x319d55[_0xc1b5('0x2f')]);_0x37018e[_0xc1b5('0x30')]=_[_0xc1b5('0x31')](_0x37018e[_0xc1b5('0x2d')],_0x37018e[_0xc1b5('0x2f')]);_0x28bf78[_0xc1b5('0x32')]=_[_0xc1b5('0x31')](_0x37018e[_0xc1b5('0x2d')],qs[_0xc1b5('0x33')](_0x319d55['query'][_0xc1b5('0x33')]));_0x28bf78[_0xc1b5('0x32')]=_0x28bf78['attributes'][_0xc1b5('0x34')]?_0x28bf78[_0xc1b5('0x32')]:_0x37018e[_0xc1b5('0x2d')];if(_0x319d55['query'][_0xc1b5('0x3e')]){_0x28bf78[_0xc1b5('0x3f')]=[{'all':!![]}];}_0x28bf78=_[_0xc1b5('0x3b')]({},_0x28bf78,_0x319d55[_0xc1b5('0x3d')]);return db[_0xc1b5('0x44')][_0xc1b5('0x45')](_0x28bf78)[_0xc1b5('0x23')](handleEntityNotFound(_0x411901,null))[_0xc1b5('0x23')](respondWithResult(_0x411901,null))['catch'](handleError(_0x411901,null));};exports[_0xc1b5('0x46')]=function(_0x1ed427,_0x5e7362){return db[_0xc1b5('0x44')]['create'](_0x1ed427['body'],{})[_0xc1b5('0x23')](respondWithResult(_0x5e7362,0xc9))['catch'](handleError(_0x5e7362,null));};exports['update']=function(_0x4d0add,_0xcc10d4){if(_0x4d0add[_0xc1b5('0x47')]['id']){delete _0x4d0add[_0xc1b5('0x47')]['id'];}return db[_0xc1b5('0x44')]['find']({'where':{'id':_0x4d0add[_0xc1b5('0x43')]['id']}})[_0xc1b5('0x23')](handleEntityNotFound(_0xcc10d4,null))[_0xc1b5('0x23')](saveUpdates(_0x4d0add[_0xc1b5('0x47')],null))[_0xc1b5('0x23')](respondWithResult(_0xcc10d4,null))['catch'](handleError(_0xcc10d4,null));};exports[_0xc1b5('0x48')]=function(_0x1c4c90,_0x38259d){return db['SmsApplication']['find']({'where':{'id':_0x1c4c90[_0xc1b5('0x43')]['id']}})[_0xc1b5('0x23')](handleEntityNotFound(_0x38259d,null))[_0xc1b5('0x23')](removeEntity(_0x38259d,null))[_0xc1b5('0x42')](handleError(_0x38259d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 50b1920..b857fb2 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 _0xcecb=['api','moment','bluebird','request-promise','path','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x40dc5d,_0x14329b){var _0x1b741=function(_0x43a641){while(--_0x43a641){_0x40dc5d['push'](_0x40dc5d['shift']());}};_0x1b741(++_0x14329b);}(_0xcecb,0xfc));var _0xbcec=function(_0x19bf9c,_0xa5ef2){_0x19bf9c=_0x19bf9c-0x0;var _0x2fd6a6=_0xcecb[_0x19bf9c];return _0x2fd6a6;};'use strict';var _=require(_0xbcec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbcec('0x1'));var moment=require(_0xbcec('0x2'));var BPromise=require(_0xbcec('0x3'));var rp=require(_0xbcec('0x4'));var fs=require('fs');var path=require(_0xbcec('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcec('0x6'));module[_0xbcec('0x7')]=function(_0x4e3ef7,_0x4e321e){return _0x4e3ef7['define']('SmsApplication',attributes,{'tableName':_0xbcec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbcec('0x9'),'collate':_0xbcec('0xa')});}; \ No newline at end of file +var _0x321b=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x3be0af,_0x30dd0f){var _0x339a4c=function(_0x5e6204){while(--_0x5e6204){_0x3be0af['push'](_0x3be0af['shift']());}};_0x339a4c(++_0x30dd0f);}(_0x321b,0x161));var _0xb321=function(_0x58578a,_0x12b225){_0x58578a=_0x58578a-0x0;var _0x49f0a8=_0x321b[_0x58578a];return _0x49f0a8;};'use strict';var _=require(_0xb321('0x0'));var util=require('util');var logger=require(_0xb321('0x1'))(_0xb321('0x2'));var moment=require('moment');var BPromise=require(_0xb321('0x3'));var rp=require(_0xb321('0x4'));var fs=require('fs');var path=require(_0xb321('0x5'));var rimraf=require(_0xb321('0x6'));var config=require(_0xb321('0x7'));var attributes=require(_0xb321('0x8'));module[_0xb321('0x9')]=function(_0x46f15a,_0x40b90a){return _0x46f15a[_0xb321('0xa')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb321('0xb'),'collate':_0xb321('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index edd80ff..c99440d 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 _0x3014=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s'];(function(_0xb0993c,_0x5aa293){var _0x30a203=function(_0xcc4a6){while(--_0xcc4a6){_0xb0993c['push'](_0xb0993c['shift']());}};_0x30a203(++_0x5aa293);}(_0x3014,0x1d7));var _0x4301=function(_0x58b330,_0x549722){_0x58b330=_0x58b330-0x0;var _0xb08407=_0x3014[_0x58b330];return _0xb08407;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var moment=require('moment');var BPromise=require(_0x4301('0x2'));var rs=require(_0x4301('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4301('0x4'));var logger=require(_0x4301('0x5'))(_0x4301('0x6'));var config=require(_0x4301('0x7'));var jayson=require(_0x4301('0x8'));var client=jayson[_0x4301('0x9')][_0x4301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6e61,_0x5013c,_0x1dc855){return new BPromise(function(_0x337800,_0x4d5020){return client['request'](_0x3a6e61,_0x1dc855)[_0x4301('0xb')](function(_0x2d6581){logger['info'](_0x4301('0xc'),_0x5013c,_0x4301('0xd'));logger[_0x4301('0xe')](_0x4301('0xf'),_0x5013c,'request\x20sent',JSON[_0x4301('0x10')](_0x2d6581));if(_0x2d6581['error']){if(_0x2d6581[_0x4301('0x11')][_0x4301('0x12')]===0x1f4){logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x4d5020(_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);}logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x337800(_0x2d6581[_0x4301('0x11')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x5013c,_0x4301('0xd'));_0x337800(_0x2d6581[_0x4301('0x14')][_0x4301('0x13')]);}})[_0x4301('0x15')](function(_0x4da25c){logger['error'](_0x4301('0xc'),_0x5013c,_0x4da25c);_0x4d5020(_0x4da25c);});});} \ No newline at end of file +var _0x8710=['then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x56b645,_0x436a9e){var _0x5dd073=function(_0x2d80a6){while(--_0x2d80a6){_0x56b645['push'](_0x56b645['shift']());}};_0x5dd073(++_0x436a9e);}(_0x8710,0x68));var _0x0871=function(_0x1b93fe,_0x1fb6e7){_0x1b93fe=_0x1b93fe-0x0;var _0x268e0e=_0x8710[_0x1b93fe];return _0x268e0e;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var moment=require('moment');var BPromise=require(_0x0871('0x2'));var rs=require(_0x0871('0x3'));var fs=require('fs');var Redis=require(_0x0871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0871('0x5'));var logger=require(_0x0871('0x6'))('rpc');var config=require(_0x0871('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0871('0x8')][_0x0871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b47f,_0x846dd7,_0x3df2b3){return new BPromise(function(_0x3ed8f4,_0x47dd75){return client[_0x0871('0xa')](_0x18b47f,_0x3df2b3)[_0x0871('0xb')](function(_0x5e9ef){logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,'request\x20sent');logger[_0x0871('0xe')](_0x0871('0xf'),_0x846dd7,_0x0871('0x10'),JSON[_0x0871('0x11')](_0x5e9ef));if(_0x5e9ef[_0x0871('0x12')]){if(_0x5e9ef['error'][_0x0871('0x13')]===0x1f4){logger[_0x0871('0x12')](_0x0871('0xd'),_0x846dd7,_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);return _0x47dd75(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x5e9ef['error'][_0x0871('0x14')]);return _0x3ed8f4(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}else{logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,_0x0871('0x10'));_0x3ed8f4(_0x5e9ef[_0x0871('0x15')][_0x0871('0x14')]);}})[_0x0871('0x16')](function(_0x4decab){logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x4decab);_0x47dd75(_0x4decab);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6d7d9b8..1b2ae71 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 _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x7b3f8a,_0x5358f6){var _0x4d3733=function(_0xb2e717){while(--_0xb2e717){_0x7b3f8a['push'](_0x7b3f8a['shift']());}};_0x4d3733(++_0x5358f6);}(_0x6324,0x142));var _0x4632=function(_0xeceed2,_0x1167ab){_0xeceed2=_0xeceed2-0x0;var _0x2ddb79=_0x6324[_0xeceed2];return _0x2ddb79;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file +var _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x36554f,_0x3b96b0){_0x36554f=_0x36554f-0x0;var _0x5e6691=_0x757a[_0x36554f];return _0x5e6691;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8639816..005adcd 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 _0x576b=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x576b,0x1d9));var _0xb576=function(_0x34af8a,_0x273c0d){_0x34af8a=_0x34af8a-0x0;var _0x7df6de=_0x576b[_0x34af8a];return _0x7df6de;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xb576('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb576('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb576('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb576('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb576('0x2')]},'read1stAt':{'type':Sequelize[_0xb576('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xb576('0x3')]('in',_0xb576('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb576('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xb576('0x3')]('in',_0xb576('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb576('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x4491=['out','BOOLEAN','sequelize','exports','DATE','STRING','ENUM'];(function(_0x1e9300,_0x1cd496){var _0x39573d=function(_0x327de2){while(--_0x327de2){_0x1e9300['push'](_0x1e9300['shift']());}};_0x39573d(++_0x1cd496);}(_0x4491,0x1bb));var _0x1449=function(_0xf3fb84,_0x172dd4){_0xf3fb84=_0xf3fb84-0x0;var _0x554ea0=_0x4491[_0xf3fb84];return _0x554ea0;};'use strict';var Sequelize=require(_0x1449('0x0'));var moment=require('moment');module[_0x1449('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1449('0x2')]},'disposition':{'type':Sequelize[_0x1449('0x3')]},'secondDisposition':{'type':Sequelize[_0x1449('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1449('0x3')]},'note':{'type':Sequelize[_0x1449('0x3')]},'phone':{'type':Sequelize[_0x1449('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1449('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1449('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1449('0x4')]('in',_0x1449('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1449('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8a172c5..60a3dd4 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 _0x61e6=['Users','fullname','TagIds','split','Tags','push','then','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','SmsInteraction','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','filters','select','field','color','from','tools_tags','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','rawAttributes','sort','pick','format','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','System','Contact','lastName','out','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','json','limit','undefined','offset','count','apply','reject','save','update','destroy','end','error','stack','name','send'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x61e6,0x1a3));var _0x661e=function(_0x225154,_0x1fa198){_0x225154=_0x225154-0x0;var _0x16f1ea=_0x61e6[_0x225154];return _0x16f1ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x661e('0x0'));var jsonpatch=require(_0x661e('0x1'));var rp=require(_0x661e('0x2'));var moment=require(_0x661e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x661e('0x4'));var util=require(_0x661e('0x5'));var path=require(_0x661e('0x6'));var sox=require(_0x661e('0x7'));var csv=require(_0x661e('0x8'));var ejs=require(_0x661e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x661e('0xa'));var squel=require(_0x661e('0xb'));var crypto=require(_0x661e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x661e('0x8'));var querystring=require(_0x661e('0xd'));var Papa=require(_0x661e('0xe'));var Redis=require(_0x661e('0xf'));var authService=require(_0x661e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x661e('0x11'));var hardwareService=require(_0x661e('0x12'));var logger=require('../../config/logger')(_0x661e('0x13'));var utils=require(_0x661e('0x14'));var config=require(_0x661e('0x15'));var licenseUtil=require(_0x661e('0x16'));var db=require(_0x661e('0x17'))['db'];config[_0x661e('0x18')]=_['defaults'](config[_0x661e('0x18')],{'host':_0x661e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x661e('0x18')]));require(_0x661e('0x1a'))[_0x661e('0x1b')](socket);function respondWithStatusCode(_0x3bd77c,_0x20503a){_0x20503a=_0x20503a||0xcc;return function(_0xe79a13){if(_0xe79a13){return _0x3bd77c[_0x661e('0x1c')](_0x20503a);}return _0x3bd77c[_0x661e('0x1d')](_0x20503a)['end']();};}function respondWithResult(_0x4cbe81,_0x4f2d2d){_0x4f2d2d=_0x4f2d2d||0xc8;return function(_0x3b0dfa){if(_0x3b0dfa){return _0x4cbe81[_0x661e('0x1d')](_0x4f2d2d)[_0x661e('0x1e')](_0x3b0dfa);}};}function respondWithFilteredResult(_0x553955,_0x50079a){return function(_0x195776){if(_0x195776){var _0x2b0107=typeof _0x50079a['offset']==='undefined'&&typeof _0x50079a[_0x661e('0x1f')]===_0x661e('0x20');var _0x2a81f8=_0x195776['count'];var _0x35dea2=_0x2b0107?0x0:_0x50079a[_0x661e('0x21')];var _0x1b8fc7=_0x2b0107?_0x195776[_0x661e('0x22')]:_0x50079a[_0x661e('0x21')]+_0x50079a['limit'];var _0x3c117d;if(_0x1b8fc7>=_0x2a81f8){_0x1b8fc7=_0x2a81f8;_0x3c117d=0xc8;}else{_0x3c117d=0xce;}_0x553955[_0x661e('0x1d')](_0x3c117d);return _0x553955['set']('Content-Range',_0x35dea2+'-'+_0x1b8fc7+'/'+_0x2a81f8)[_0x661e('0x1e')](_0x195776);}return null;};}function patchUpdates(_0x2c29f9){return function(_0x27ac0d){try{jsonpatch[_0x661e('0x23')](_0x27ac0d,_0x2c29f9,!![]);}catch(_0x42fb11){return BPromise[_0x661e('0x24')](_0x42fb11);}return _0x27ac0d[_0x661e('0x25')]();};}function saveUpdates(_0x3beaed,_0x437ee3){return function(_0x756ea0){if(_0x756ea0){return _0x756ea0[_0x661e('0x26')](_0x3beaed)['then'](function(_0x3f9308){return _0x3f9308;});}return null;};}function removeEntity(_0x2d014a,_0x274902){return function(_0xb0c95b){if(_0xb0c95b){return _0xb0c95b[_0x661e('0x27')]()['then'](function(){_0x2d014a[_0x661e('0x1d')](0xcc)[_0x661e('0x28')]();});}};}function handleEntityNotFound(_0x34f1cc,_0x477b1c){return function(_0x4628f7){if(!_0x4628f7){_0x34f1cc[_0x661e('0x1c')](0x194);}return _0x4628f7;};}function handleError(_0x1b7a9e,_0xc410fe){_0xc410fe=_0xc410fe||0x1f4;return function(_0xdebda0){logger[_0x661e('0x29')](_0xdebda0[_0x661e('0x2a')]);if(_0xdebda0[_0x661e('0x2b')]){delete _0xdebda0[_0x661e('0x2b')];}_0x1b7a9e[_0x661e('0x1d')](_0xc410fe)[_0x661e('0x2c')](_0xdebda0);};}function getInteractionUsers(_0x2d4c9a,_0x3c9b23){return new BPromise(function(_0x51c0b7,_0xf319f){try{if(_0x3c9b23[_0x2d4c9a['id']]){_0x2d4c9a[_0x661e('0x2d')]=_['map'](_0x3c9b23[_0x2d4c9a['id']],function(_0x23195e){return{'id':_0x23195e['id'],'fullname':_0x23195e[_0x661e('0x2e')]};});}}catch(_0x1f1e0c){_0xf319f(_0x1f1e0c);}_0x51c0b7(_0x2d4c9a);});}function getInteractionTags(_0x3c3b4b,_0x106b20){return new BPromise(function(_0x2bcdda,_0x2f58ab){try{if(_0x3c3b4b[_0x661e('0x2f')]){_0x3c3b4b['Tags']=[];_0x3c3b4b[_0x661e('0x2f')][_0x661e('0x30')](',')['forEach'](function(_0x41593d){_0x3c3b4b[_0x661e('0x31')][_0x661e('0x32')](_0x106b20[_0x41593d]);});}delete _0x3c3b4b[_0x661e('0x2f')];}catch(_0x43eedb){_0x2f58ab(_0x43eedb);}_0x2bcdda(_0x3c3b4b);});}function updateSmsInteraction(_0x60aacd,_0xe59acb,_0x5b85cd){return new BPromise(function(_0xb530f2,_0x366af5){return getInteractionUsers(_0x60aacd,_0x5b85cd)[_0x661e('0x33')](function(_0x23c270){return getInteractionTags(_0x23c270,_0xe59acb);})['then'](function(_0x5cc59a){return getStateInteraction(_0x5cc59a);})[_0x661e('0x33')](function(_0x36712b){_0xb530f2(_0x36712b);})[_0x661e('0x34')](function(_0x1741af){_0x366af5(_0x1741af);});});}function getStateInteraction(_0x167cb3){return new BPromise(function(_0x319db3){_0x167cb3[_0x661e('0x35')]=0x0;_0x167cb3[_0x661e('0x36')]=0x0;_0x167cb3[_0x661e('0x37')]=0x0;_0x167cb3['unmanaged']=0x0;_0x167cb3[_0x661e('0x38')]=0x0;if(!_0x167cb3[_0x661e('0x39')]&&!_0x167cb3[_0x661e('0x3a')]){_0x167cb3[_0x661e('0x35')]+=0x1;}if(!_0x167cb3[_0x661e('0x39')]&&_0x167cb3['UserId']){_0x167cb3[_0x661e('0x36')]+=0x1;if(_0x167cb3[_0x661e('0x35')]){_0x167cb3['waiting']-=0x1;}}if(_0x167cb3[_0x661e('0x39')]&&_0x167cb3[_0x661e('0x3a')]){_0x167cb3[_0x661e('0x37')]+=0x1;if(_0x167cb3[_0x661e('0x36')]){_0x167cb3[_0x661e('0x36')]-=0x1;}}if(_0x167cb3['closed']&&!_0x167cb3[_0x661e('0x3a')]){_0x167cb3[_0x661e('0x3b')]+=0x1;if(_0x167cb3[_0x661e('0x35')]){_0x167cb3['waiting']-=0x1;}}_0x167cb3['total']+=0x1;_0x319db3(_0x167cb3);});}exports[_0x661e('0x3c')]=function(_0x50d273,_0x6a5539){var _0xe86c70={},_0x27b03e={},_0x3033ae={'count':0x0,'rows':[]};var _0x2ebbc2=_['map'](db[_0x661e('0x3d')]['rawAttributes'],function(_0x52a0a2){return{'name':_0x52a0a2[_0x661e('0x3e')],'type':_0x52a0a2['type']['key']};});_0x27b03e[_0x661e('0x3f')]=_[_0x661e('0x40')](_0x2ebbc2,'name');_0x27b03e[_0x661e('0x41')]=_[_0x661e('0x42')](_0x50d273[_0x661e('0x41')]);_0x27b03e['filters']=_[_0x661e('0x43')](_0x27b03e['model'],_0x27b03e['query']);_0xe86c70[_0x661e('0x44')]=_['intersection'](_0x27b03e[_0x661e('0x3f')],qs[_0x661e('0x45')](_0x50d273[_0x661e('0x41')]['fields']));_0xe86c70[_0x661e('0x44')]=_0xe86c70['attributes'][_0x661e('0x46')]?_0xe86c70[_0x661e('0x44')]:_0x27b03e['model'];if(!_0x50d273[_0x661e('0x41')][_0x661e('0x47')]('nolimit')){_0xe86c70[_0x661e('0x1f')]=qs[_0x661e('0x1f')](_0x50d273[_0x661e('0x41')]['limit']);_0xe86c70[_0x661e('0x21')]=qs[_0x661e('0x21')](_0x50d273[_0x661e('0x41')][_0x661e('0x21')]);}_0xe86c70[_0x661e('0x48')]=qs['sort'](_0x50d273[_0x661e('0x41')]['sort']);_0xe86c70['where']=qs[_0x661e('0x49')](_['pick'](_0x50d273[_0x661e('0x41')],_0x27b03e[_0x661e('0x49')]),_0x2ebbc2);var _0x693c20=[];var _0x57e84f=squel[_0x661e('0x4a')]()[_0x661e('0x4b')]('id')['field'](_0x661e('0x2b'))[_0x661e('0x4b')](_0x661e('0x4c'))[_0x661e('0x4d')](_0x661e('0x4e'));var _0x4e78bf=squel[_0x661e('0x4a')]()[_0x661e('0x4b')]('u.id')[_0x661e('0x4b')](_0x661e('0x4f'))[_0x661e('0x4b')]('ui.SmsInteractionId')[_0x661e('0x4d')]('user_has_sms_interactions','ui')[_0x661e('0x50')](_0x661e('0x51'),'u',_0x661e('0x52'));var _0x5069eb=squel['select']()[_0x661e('0x4d')](_0x661e('0x53'),'i')[_0x661e('0x50')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x661e('0x51'),'o',_0x661e('0x54'))[_0x661e('0x50')](_0x661e('0x55'),'a','a.id\x20=\x20i.SmsAccountId')[_0x661e('0x50')](_0x661e('0x56'),'me',_0x661e('0x57'))[_0x661e('0x50')](_0x661e('0x58'),'it',_0x661e('0x59'))['left_join']('tools_tags','t',_0x661e('0x5a'));var _0x600ca=squel[_0x661e('0x5b')]();var _0x4e4053=[];var _0x275b11=squel[_0x661e('0x5b')]();var _0x26c963;if(_0x50d273['query']['search']){_0x26c963=as[_0x661e('0x5c')](_0x50d273[_0x661e('0x41')]['search']);var _0x2a5c22=_0x26c963[_0x661e('0x5d')];for(var _0x10f441=0x0;_0x10f441<_0x26c963['conditions'][_0x661e('0x46')];_0x10f441++){var _0x54b731=_0x26c963['conditions'][_0x10f441];var _0x49fc58='i';var _0x4c2192=_[_0x661e('0x5e')](_0x2ebbc2,[_0x661e('0x2b'),_0x54b731[_0x661e('0x4b')]]);if(!_0x4c2192){switch(_0x54b731[_0x661e('0x4b')]){case _0x661e('0x5f'):if(_0x54b731[_0x661e('0x60')]==0x1){_0x5069eb[_0x661e('0x61')]('`'+_0x54b731[_0x661e('0x4b')]+'`\x20=\x200');}else{_0x5069eb[_0x661e('0x61')]('`'+_0x54b731[_0x661e('0x4b')]+_0x661e('0x62'));}break;case'Contact':if(_0x54b731[_0x661e('0x63')]===_0x661e('0x64')){if(_0x54b731[_0x661e('0x60')][_0x661e('0x30')]('\x20')['length']>0x1){_0x600ca[_0x2a5c22](_0x661e('0x65'),qs['getFullTextValue'](_0x54b731[_0x661e('0x60')]),null);}else{var _0x2fedc3='%'+_0x54b731[_0x661e('0x60')]+'%';_0x600ca[_0x2a5c22](_0x661e('0x66'),_0x2fedc3,_0x2fedc3,_0x2fedc3);}}else{_0x4c2192=_[_0x661e('0x5e')](_0x2ebbc2,[_0x661e('0x2b'),_0x661e('0x67')]);_0x54b731[_0x661e('0x4b')]=_0x661e('0x67');_0x1a0849=as[_0x661e('0x68')](_0x49fc58,_0x4c2192[_0x661e('0x69')],_0x54b731);_0x600ca[_0x2a5c22](_0x1a0849[_0x661e('0x6a')],_0x1a0849[_0x661e('0x60')][_0x661e('0x6b')],_0x1a0849['value']['end']);}break;case _0x661e('0x6c'):var _0xaffe5b=_0x54b731[_0x661e('0x60')][_0x661e('0x30')](',')[_0x661e('0x40')](function(_0x4f54b9){return Number(_0x4f54b9);});_0xaffe5b[_0x661e('0x6d')](function(_0x1d2d67){_0x275b11['or'](_0x661e('0x6e'),'%,'+_0x1d2d67+',%');});_0x4e4053=_['union'](_0x4e4053,_0xaffe5b);break;case'User':if(_0x54b731['operator']===_0x661e('0x64')){_0x600ca[_0x2a5c22](_0x661e('0x6f'),'%'+_0x54b731[_0x661e('0x60')]+'%',null);}else{_0x4c2192=_[_0x661e('0x5e')](_0x2ebbc2,[_0x661e('0x2b'),_0x661e('0x3a')]);_0x54b731[_0x661e('0x4b')]=_0x661e('0x3a');_0x1a0849=as[_0x661e('0x68')](_0x49fc58,_0x4c2192[_0x661e('0x69')],_0x54b731);_0x600ca[_0x2a5c22](_0x1a0849[_0x661e('0x6a')],_0x1a0849[_0x661e('0x60')]['start'],_0x1a0849[_0x661e('0x60')][_0x661e('0x28')]);}break;case _0x661e('0x70'):_0x1a0849=as['buildExpression']('me',null,_0x54b731);_0x600ca[_0x2a5c22](_0x1a0849['text'],_0x1a0849[_0x661e('0x60')][_0x661e('0x6b')],_0x1a0849['value'][_0x661e('0x28')]);break;}}else{var _0x1a0849=as[_0x661e('0x68')](_0x49fc58,_0x4c2192[_0x661e('0x69')],_0x54b731);_0x600ca[_0x2a5c22](_0x1a0849['text'],_0x1a0849[_0x661e('0x60')][_0x661e('0x6b')],_0x1a0849[_0x661e('0x60')]['end']);}}}else{var _0x1f8e01=_(_0x50d273[_0x661e('0x41')])[_0x661e('0x42')]()[_0x661e('0x40')](function(_0x5313db){return _['some'](_0x2ebbc2,[_0x661e('0x2b'),_0x5313db])?_0x5313db:undefined;})[_0x661e('0x71')]()[_0x661e('0x60')]();if(!_[_0x661e('0x72')](_0x1f8e01)){_0x1f8e01[_0x661e('0x6d')](function(_0x5c1c2f){if(_0x5c1c2f===_0x661e('0x73')){_0x5069eb['where'](_0x661e('0x74'),[]['concat'](_0x50d273[_0x661e('0x41')][_0x5c1c2f]));}else if(_0x5c1c2f==='createdAt'){var _0x31c4a4=JSON[_0x661e('0x75')](_0x50d273['query'][_0x5c1c2f])[_0x661e('0x76')];var _0x5ac810=JSON[_0x661e('0x75')](_0x50d273[_0x661e('0x41')][_0x5c1c2f])[_0x661e('0x77')];_0x5069eb['where'](_0x661e('0x78'),_0x31c4a4,_0x5ac810);}else{if(_0x50d273[_0x661e('0x41')][_0x5c1c2f]==='null'){_0x5069eb[_0x661e('0x79')]('i.'+_0x5c1c2f+_0x661e('0x7a'));}else{_0x5069eb[_0x661e('0x79')]('i.'+_0x5c1c2f+_0x661e('0x7b'),_0x50d273[_0x661e('0x41')][_0x5c1c2f]);}}});}if(_0x50d273[_0x661e('0x41')][_0x661e('0x7c')]){if(_0x50d273[_0x661e('0x41')][_0x661e('0x7c')]==0x1){_0x5069eb[_0x661e('0x61')](_0x661e('0x7d'));}else{_0x5069eb[_0x661e('0x61')](_0x661e('0x7e'));}}if(_0x50d273['query']['tag']){_0x4e4053=_['isArray'](_0x50d273[_0x661e('0x41')][_0x661e('0x7f')])?_0x50d273['query'][_0x661e('0x7f')]:new Array(_0x50d273[_0x661e('0x41')][_0x661e('0x7f')]);_0x4e4053[_0x661e('0x6d')](function(_0x1b9779){_0x275b11['or'](_0x661e('0x6e'),'%,'+_0x1b9779+',%');});}if(_0x50d273[_0x661e('0x41')][_0x661e('0x80')]){var _0x50139f=_0x50d273[_0x661e('0x41')][_0x661e('0x80')][_0x661e('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x661e('0x82')](_0x50139f)){_0x600ca['or'](_0x661e('0x83'),_0x50139f+'%')['or'](_0x661e('0x84'),_0x50139f+'%');}else{_0x600ca['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x50139f))['or'](_0x661e('0x85'),_0x50139f+'%');}}}_0x5069eb['where'](_0x600ca);_0x5069eb[_0x661e('0x86')](_0x661e('0x87'));var _0x1e8713={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0xef0be=_0x5069eb[_0x661e('0x88')]();_0xef0be['field'](_0x661e('0x87'));_0xef0be[_0x661e('0x4b')](_0x661e('0x89'),'unreadMessages');if(_0xe86c70['order']){_0xe86c70[_0x661e('0x48')]['forEach'](function(_0xfff827){var _0x5d32fe=_0xfff827[0x0]===_0x661e('0x8a')?_0xfff827[0x0]:'i.'+_0xfff827[0x0];_0x5069eb[_0x661e('0x48')](_0x5d32fe,_0xfff827[0x1]==='DESC'?![]:!![]);});}if(!_[_0x661e('0x72')](_0x4e4053)){_0x5069eb[_0x661e('0x61')](_0x275b11);_0xef0be[_0x661e('0x79')](_0x661e('0x8b'),_0x4e4053);}BPromise[_0x661e('0x8c')]()[_0x661e('0x33')](function(){if(!_0x26c963){if(_0x50d273['query'][_0x661e('0x73')])return;_0xef0be[_0x661e('0x79')](_0x661e('0x8d'));_0x5069eb[_0x661e('0x79')](_0x661e('0x8d'));return;}if(_0x50d273['user'][_0x661e('0x8e')]!=='agent')return;return _0x50d273[_0x661e('0x8f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x661e('0x33')](function(_0x41d379){if(_[_0x661e('0x72')](_0x41d379)){_0xef0be[_0x661e('0x79')](_0x661e('0x90'));_0x5069eb[_0x661e('0x79')](_0x661e('0x90'));}else{_0xef0be['where'](_0x661e('0x74'),_[_0x661e('0x40')](_0x41d379,'id'));_0x5069eb[_0x661e('0x79')](_0x661e('0x74'),_[_0x661e('0x40')](_0x41d379,'id'));}});})[_0x661e('0x33')](function(){if(_0x50d273[_0x661e('0x8f')][_0x661e('0x8e')]===_0x661e('0x91')&&!_0x26c963&&!_0x50d273[_0x661e('0x41')][_0x661e('0x73')])return[];return db[_0x661e('0x92')][_0x661e('0x41')](_0xef0be[_0x661e('0x93')](),_0x1e8713);})[_0x661e('0x33')](function(_0x3f3fe5){_0x3033ae[_0x661e('0x22')]=_0x3f3fe5['length'];if(_0x3033ae[_0x661e('0x22')]===0x0)return[];return db[_0x661e('0x92')]['query'](_0x57e84f[_0x661e('0x93')](),_0x1e8713)[_0x661e('0x33')](function(_0xdee57e){_0x693c20=_['keyBy'](_0xdee57e,'id');_0x1e8713=_[_0x661e('0x94')](_0x1e8713,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50d273[_0x661e('0x41')][_0x661e('0x45')]){_0xe86c70['attributes']['forEach'](function(_0x3abf2c){_0x5069eb[_0x661e('0x4b')]('i.'+_0x3abf2c);});}else{_0x5069eb[_0x661e('0x4b')](_0x661e('0x89'),_0x661e('0x5f'));_0x5069eb[_0x661e('0x4b')](_0x661e('0x95'),_0x661e('0x96'));_0x5069eb['field'](_0x661e('0x97'),'Account.mandatoryDisposition');_0x5069eb['field'](_0x661e('0x98'),_0x661e('0x8a'));_0x5069eb['field']('i.*');_0x5069eb[_0x661e('0x4b')](_0x661e('0x99'),_0x661e('0x9a'));_0x5069eb[_0x661e('0x4b')](_0x661e('0x9b'),_0x661e('0x9c'));_0x5069eb['field'](_0x661e('0x9d'),_0x661e('0x9e'));_0x5069eb['field'](_0x661e('0x9f'),_0x661e('0xa0'));_0x5069eb['field'](_0x661e('0xa1'),'Contact.mobile');_0x5069eb['field']('c.fax',_0x661e('0xa2'));_0x5069eb['field'](_0x661e('0xa3'),_0x661e('0xa4'));_0x5069eb[_0x661e('0x4b')](_0x661e('0xa5'),_0x661e('0xa6'));_0x5069eb['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xe86c70[_0x661e('0x1f')])_0x5069eb[_0x661e('0x1f')](_0xe86c70[_0x661e('0x1f')]);if(_0xe86c70[_0x661e('0x21')])_0x5069eb[_0x661e('0x21')](_0xe86c70['offset']);return db[_0x661e('0x92')][_0x661e('0x41')](_0x5069eb[_0x661e('0x93')](),_0x1e8713);})[_0x661e('0x33')](function(_0x2722de){if(_0x2722de[_0x661e('0x46')]>0x0)_0x4e78bf[_0x661e('0x79')](_0x661e('0xa7'),_[_0x661e('0x40')](_0x2722de,'id'));return db['sequelize']['query'](_0x4e78bf[_0x661e('0x93')](),_0x1e8713)[_0x661e('0x33')](function(_0x594dc6){var _0xa7960f=_[_0x661e('0xa8')](_0x594dc6,_0x661e('0xa9'));var _0x3fbb44=[];_0x2722de[_0x661e('0x6d')](function(_0x3251f1){_0x3fbb44['push'](updateSmsInteraction(_0x3251f1,_0x693c20,_0xa7960f));});return BPromise[_0x661e('0xaa')](_0x3fbb44);});});})['then'](function(_0x261293){_0x3033ae[_0x661e('0xab')]=_0x261293;return _0x3033ae;})['then'](respondWithFilteredResult(_0x6a5539,_0xe86c70))[_0x661e('0x34')](handleError(_0x6a5539,null));};exports[_0x661e('0xac')]=function(_0x5b5d6f,_0x76969c){var _0x224b5e={'raw':![],'where':{'id':_0x5b5d6f[_0x661e('0xad')]['id']}},_0x5ee036={};_0x5ee036[_0x661e('0x3f')]=_[_0x661e('0x42')](db[_0x661e('0x3d')]['rawAttributes']);_0x5ee036[_0x661e('0x41')]=_[_0x661e('0x42')](_0x5b5d6f[_0x661e('0x41')]);_0x5ee036[_0x661e('0x49')]=_[_0x661e('0x43')](_0x5ee036[_0x661e('0x3f')],_0x5ee036[_0x661e('0x41')]);_0x224b5e['attributes']=_[_0x661e('0x43')](_0x5ee036[_0x661e('0x3f')],qs[_0x661e('0x45')](_0x5b5d6f['query'][_0x661e('0x45')]));_0x224b5e[_0x661e('0x44')]=_0x224b5e[_0x661e('0x44')][_0x661e('0x46')]?_0x224b5e[_0x661e('0x44')]:_0x5ee036[_0x661e('0x3f')];if(_0x5b5d6f[_0x661e('0x41')][_0x661e('0xae')]){_0x224b5e[_0x661e('0xaf')]=[{'all':!![]}];}_0x224b5e=_[_0x661e('0x94')]({},_0x224b5e,_0x5b5d6f[_0x661e('0xb0')]);return db[_0x661e('0x3d')]['find'](_0x224b5e)[_0x661e('0x33')](handleEntityNotFound(_0x76969c,null))[_0x661e('0x33')](respondWithResult(_0x76969c,null))[_0x661e('0x34')](handleError(_0x76969c,null));};exports[_0x661e('0xb1')]=function(_0x45acab,_0x91720b){return db[_0x661e('0x3d')][_0x661e('0xb1')](_0x45acab[_0x661e('0x70')],{})['then'](respondWithResult(_0x91720b,0xc9))[_0x661e('0x34')](handleError(_0x91720b,null));};exports['update']=function(_0x523e23,_0x1433e0){if(_0x523e23[_0x661e('0x70')]['id']){delete _0x523e23[_0x661e('0x70')]['id'];}return db[_0x661e('0x3d')]['find']({'where':{'id':_0x523e23['params']['id']}})['then'](handleEntityNotFound(_0x1433e0,null))[_0x661e('0x33')](saveUpdates(_0x523e23[_0x661e('0x70')],null))[_0x661e('0x33')](respondWithResult(_0x1433e0,null))[_0x661e('0x34')](handleError(_0x1433e0,null));};exports['destroy']=function(_0x3160ae,_0x7f4f4a){return db[_0x661e('0x3d')][_0x661e('0x5e')]({'where':{'id':_0x3160ae['params']['id']}})[_0x661e('0x33')](handleEntityNotFound(_0x7f4f4a,null))[_0x661e('0x33')](removeEntity(_0x7f4f4a,null))[_0x661e('0x34')](handleError(_0x7f4f4a,null));};exports['describe']=function(_0x3a8b80,_0x4fc341){return db['SmsInteraction'][_0x661e('0xb2')]()[_0x661e('0x33')](respondWithResult(_0x4fc341,null))[_0x661e('0x34')](handleError(_0x4fc341,null));};exports[_0x661e('0xb3')]=function(_0x28ea9a,_0x5e1ffd,_0x51b912){return db[_0x661e('0xb4')]['find']({'where':{'id':_0x28ea9a[_0x661e('0xad')]['id']}})[_0x661e('0x33')](handleEntityNotFound(_0x5e1ffd,null))[_0x661e('0x33')](function(_0x44151a){if(_0x44151a){return _0x44151a[_0x661e('0xb3')](_0x28ea9a[_0x661e('0x70')][_0x661e('0xb5')],_[_0x661e('0xb6')](_0x28ea9a[_0x661e('0x70')],[_0x661e('0xb5'),'id'])||{});}})[_0x661e('0x33')](respondWithResult(_0x5e1ffd,null))[_0x661e('0x34')](handleError(_0x5e1ffd,null));};exports[_0x661e('0xb7')]=function(_0x14286d,_0x4e1b75,_0x2e5a73){var _0x30477e={'raw':![],'where':{}};var _0x4b0709={};var _0x5db3e1={'count':0x0,'rows':[]};return db[_0x661e('0x3d')][_0x661e('0xb8')]({'where':{'id':_0x14286d['params']['id']}})[_0x661e('0x33')](handleEntityNotFound(_0x4e1b75,null))[_0x661e('0x33')](function(_0x154bc7){if(_0x154bc7){_0x4b0709[_0x661e('0x3f')]=_[_0x661e('0x42')](db[_0x661e('0xb4')][_0x661e('0xb9')]);_0x4b0709['query']=_[_0x661e('0x42')](_0x14286d[_0x661e('0x41')]);_0x4b0709[_0x661e('0x49')]=_[_0x661e('0x43')](_0x4b0709['model'],_0x4b0709['query']);_0x30477e['attributes']=_[_0x661e('0x43')](_0x4b0709[_0x661e('0x3f')],qs[_0x661e('0x45')](_0x14286d['query']['fields']));_0x30477e[_0x661e('0x44')]=_0x30477e[_0x661e('0x44')]['length']?_0x30477e[_0x661e('0x44')]:_0x4b0709['model'];if(!_0x14286d[_0x661e('0x41')][_0x661e('0x47')]('nolimit')){_0x30477e[_0x661e('0x1f')]=qs[_0x661e('0x1f')](_0x14286d[_0x661e('0x41')][_0x661e('0x1f')]);_0x30477e[_0x661e('0x21')]=qs[_0x661e('0x21')](_0x14286d[_0x661e('0x41')][_0x661e('0x21')]);}_0x30477e['order']=qs[_0x661e('0xba')](_0x14286d[_0x661e('0x41')]['sort']);_0x30477e['where']=qs[_0x661e('0x49')](_[_0x661e('0xbb')](_0x14286d['query'],_0x4b0709['filters']));_0x30477e[_0x661e('0x79')]['SmsInteractionId']=_0x154bc7['id'];if(_0x14286d[_0x661e('0x41')]['filter']){_0x30477e[_0x661e('0x79')]=_[_0x661e('0x94')](_0x30477e[_0x661e('0x79')],{'$or':_[_0x661e('0x40')](_0x30477e[_0x661e('0x44')],function(_0x11672b){var _0x1d6877={};_0x1d6877[_0x11672b]={'$like':'%'+_0x14286d[_0x661e('0x41')][_0x661e('0x80')]+'%'};return _0x1d6877;})});}if(_0x14286d[_0x661e('0x41')]['$gte']){var _0x1492ce=_0x14286d[_0x661e('0x41')][_0x661e('0x76')][_0x661e('0x30')](',');var _0x2ccccd={};_0x2ccccd[_0x1492ce[0x0]]={'$gte':moment(_0x1492ce[0x1])[_0x661e('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30477e['where']=_[_0x661e('0x94')](_0x30477e[_0x661e('0x79')],_0x2ccccd);}_0x30477e=_[_0x661e('0x94')]({},_0x30477e,_0x14286d[_0x661e('0xb0')]);return db[_0x661e('0xb4')][_0x661e('0x22')]({'where':_0x30477e[_0x661e('0x79')]})[_0x661e('0x33')](function(_0xd8df58){_0x5db3e1[_0x661e('0x22')]=_0xd8df58;if(_0x14286d[_0x661e('0x41')][_0x661e('0xae')]){_0x30477e[_0x661e('0xaf')]=[{'all':!![]}];}return db['SmsMessage'][_0x661e('0xbd')](_0x30477e);})[_0x661e('0x33')](function(_0x5b7270){_0x5db3e1['rows']=_0x5b7270;return _0x5db3e1;});}})['then'](respondWithFilteredResult(_0x4e1b75,_0x30477e))[_0x661e('0x34')](handleError(_0x4e1b75,null));};exports[_0x661e('0xbe')]=function(_0x4af05d,_0x287199,_0x1660c0){return db['SmsInteraction']['find']({'where':{'id':_0x4af05d['params']['id']}})[_0x661e('0x33')](handleEntityNotFound(_0x287199,null))['then'](function(_0x4c0150){if(_0x4c0150){return _0x4c0150[_0x661e('0xbf')](_0x4af05d[_0x661e('0x70')][_0x661e('0xb5')],_[_0x661e('0xb6')](_0x4af05d['body'],[_0x661e('0xb5'),'id'])||{})[_0x661e('0xc0')](function(){return db[_0x661e('0x6c')][_0x661e('0xbd')]({'attributes':['id',_0x661e('0x2b'),_0x661e('0x4c')],'where':{'id':_0x4af05d['body']['ids']}});})[_0x661e('0x33')](function(_0x39e1b1){socket[_0x661e('0xc1')](_0x661e('0xc2'),{'id':Number(_0x4af05d['params']['id']),'tags':_0x39e1b1||[]});return{'id':Number(_0x4af05d['params']['id']),'tags':_0x39e1b1||[]};});}})[_0x661e('0x33')](respondWithResult(_0x287199,null))[_0x661e('0x34')](handleError(_0x287199,null));};exports[_0x661e('0xc3')]=function(_0x3530a5,_0x86e99d,_0x282719){return db['SmsInteraction'][_0x661e('0x5e')]({'where':{'id':_0x3530a5[_0x661e('0xad')]['id']}})[_0x661e('0x33')](handleEntityNotFound(_0x86e99d,null))[_0x661e('0x33')](function(_0x21798d){if(_0x21798d){return _0x21798d[_0x661e('0xc3')](_0x3530a5[_0x661e('0x41')][_0x661e('0xb5')]);}})[_0x661e('0x33')](respondWithStatusCode(_0x86e99d,null))['catch'](handleError(_0x86e99d,null));};exports[_0x661e('0xc4')]=function(_0x4b2fad,_0x261f3){var _0xfacab3=moment()[_0x661e('0xc5')]()['toString']();var _0x1a70c8=path[_0x661e('0xc6')](config[_0x661e('0xc7')],_0x661e('0xc8'),_0x661e('0xc9'),_0x661e('0xca'));var _0x371e28=path[_0x661e('0xc6')](config[_0x661e('0xc7')],'server','files',_0x661e('0xcb'));var _0x106105=path[_0x661e('0xc6')](_0x1a70c8,_0xfacab3);var _0x135e29=util[_0x661e('0xbc')](_0x661e('0xcc'),_0x4b2fad[_0x661e('0xad')]['id'],_0xfacab3);var _0x180acc=path[_0x661e('0xc6')](_0x1a70c8,_0x135e29);var _0x2021e4=[];_0x2021e4[_0x661e('0x32')]({'model':db['User'],'as':_0x661e('0xcd'),'attributes':['id',_0x661e('0x2e')],'raw':!![]});_0x2021e4[_0x661e('0x32')]({'model':db[_0x661e('0xce')],'as':'Contact','attributes':['id',_0x661e('0xcf'),'lastName'],'raw':!![]});var _0x217b8c=[{'model':db['SmsMessage'],'as':_0x661e('0xd0'),'attributes':['id',_0x661e('0x70'),_0x661e('0xd1'),_0x661e('0xd2'),_0x661e('0xd3'),'read'],'include':_0x2021e4}];_0x217b8c[_0x661e('0x32')]({'model':db[_0x661e('0xd4')],'as':_0x661e('0xd5'),'attributes':['id','name']});_0x217b8c[_0x661e('0x32')]({'model':db[_0x661e('0xcd')],'as':_0x661e('0xd6'),'attributes':['id',_0x661e('0x2e')]});return db[_0x661e('0x3d')][_0x661e('0x5e')]({'where':{'id':_0x4b2fad['params']['id']},'include':_0x217b8c})['then'](handleEntityNotFound(_0x261f3,null))[_0x661e('0x33')](function(_0x45da38){if(_0x45da38){var _0x2b76c4=_0x45da38['get']({'plain':!![]});fs['mkdirSync'](_0x106105);var _0x4d2681={'channel':'Sms','account':_0x2b76c4['Account'][_0x661e('0x2b')],'agent':_0x2b76c4[_0x661e('0xd6')]?_0x2b76c4[_0x661e('0xd6')][_0x661e('0x2e')]:_0x661e('0xd7'),'createdAt':moment(_0x2b76c4['createdAt'])[_0x661e('0xbc')](_0x661e('0xd8'))[_0x661e('0x93')](),'closedAt':_0x2b76c4['closed']?moment(_0x2b76c4[_0x661e('0xd9')])[_0x661e('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2b76c4[_0x661e('0xda')],'messages':_(_0x2b76c4[_0x661e('0xd0')])[_0x661e('0x80')]({'secret':![]})['map'](function(_0x3689ba){return{'date':moment(_0x3689ba['createdAt'])['format'](_0x661e('0xd8'))[_0x661e('0x93')](),'sender':_0x3689ba[_0x661e('0xd2')]==='out'?_0x3689ba[_0x661e('0xcd')]?_0x3689ba['User'][_0x661e('0x2e')]:_0x661e('0xdb'):_0x3689ba[_0x661e('0xdc')][_0x661e('0xcf')]+(_0x3689ba[_0x661e('0xdc')][_0x661e('0xdd')]?'\x20'+_0x3689ba[_0x661e('0xdc')][_0x661e('0xdd')]:''),'body':_0x3689ba['body'],'direction':_0x3689ba[_0x661e('0xd2')]===_0x661e('0xde')?'A':'C','secret':_0x3689ba['secret'],'read':_0x3689ba['read']};})[_0x661e('0x60')]()};return ejs['renderFile'](path['join'](config[_0x661e('0xc7')],_0x661e('0xc8'),_0x661e('0xdf'),_0x661e('0xe0')),{'interaction':_0x4d2681})[_0x661e('0x33')](function(_0x4d3dcb){var _0x43da1d=path[_0x661e('0xc6')](_0x106105,_0x661e('0xe1')+_0x2b76c4['id']+'-'+_0xfacab3+_0x661e('0xe2'));var _0x40b191={'path':_0x43da1d,'channel':_0x661e('0xe3'),'interactionId':_0x2b76c4['id']};return pdf[_0x661e('0xe4')](_0x4d3dcb,_0x40b191);})[_0x661e('0x33')](function(){return new BPromise(function(_0x1b093f,_0x13393a){zipdir(_0x106105,{'saveTo':_0x180acc},function(_0x563f8a,_0x59c6d5){if(_0x563f8a)return _0x13393a(_0x563f8a);return _0x1b093f(_0x59c6d5);});})[_0x661e('0x33')](function(){return new BPromise(function(_0x4b91b7,_0x2d4ea5){rimraf(_0x106105,function(_0x4a12ca){if(_0x4a12ca)_0x2d4ea5(_0x4a12ca);return _0x4b91b7();});});})['then'](function(){return _0x261f3[_0x661e('0xc4')](_0x180acc,_0x135e29,function(_0x27e470){if(_0x27e470){console[_0x661e('0xe5')](_0x661e('0xe6'),_0x27e470);}else{fs[_0x661e('0xe7')](_0x180acc);}});});});}else{return _0x261f3[_0x661e('0x1c')](0xc8);}})[_0x661e('0x34')](handleError(_0x261f3,null));}; \ No newline at end of file +var _0x4d0e=['null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','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?','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SmsInteraction','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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','params','includeAll','options','create','body','update','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','color','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','attachments','User','fullname','firstName','lastName','Messages','direction','secret','SmsAccount','Account','mkdirSync','Owner','N.A.','format','closedAt','disposition','out','downloadInteraction.ejs','.pdf','Sms','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','Users','TagIds','split','forEach','push','waiting','answered','unmanaged','total','closed','UserId','talking','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\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?','find','ContactId','buildExpression','type','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','isEmpty','SmsAccountId','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x45071a,_0x406695){var _0x4502ca=function(_0x486222){while(--_0x486222){_0x45071a['push'](_0x45071a['shift']());}};_0x4502ca(++_0x406695);}(_0x4d0e,0x15a));var _0xe4d0=function(_0xe4f9b8,_0x295102){_0xe4f9b8=_0xe4f9b8-0x0;var _0x5d1b78=_0x4d0e[_0xe4f9b8];return _0x5d1b78;};'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(_0xe4d0('0x4'));var BPromise=require(_0xe4d0('0x5'));var Mustache=require(_0xe4d0('0x6'));var util=require(_0xe4d0('0x7'));var path=require(_0xe4d0('0x8'));var sox=require(_0xe4d0('0x9'));var csv=require(_0xe4d0('0xa'));var ejs=require(_0xe4d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4d0('0xc'));var squel=require(_0xe4d0('0xd'));var crypto=require('crypto');var jsforce=require(_0xe4d0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4d0('0xa'));var querystring=require(_0xe4d0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe4d0('0x10'));var qs=require(_0xe4d0('0x11'));var as=require(_0xe4d0('0x12'));var pdf=require(_0xe4d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4d0('0x14'))(_0xe4d0('0x15'));var utils=require('../../config/utils');var config=require(_0xe4d0('0x16'));var licenseUtil=require(_0xe4d0('0x17'));var db=require(_0xe4d0('0x18'))['db'];config[_0xe4d0('0x19')]=_[_0xe4d0('0x1a')](config[_0xe4d0('0x19')],{'host':_0xe4d0('0x1b'),'port':0x18eb});var socket=require(_0xe4d0('0x1c'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xe4d0('0x1d')](socket);function respondWithStatusCode(_0x49af06,_0x5d3842){_0x5d3842=_0x5d3842||0xcc;return function(_0x4450ce){if(_0x4450ce){return _0x49af06['sendStatus'](_0x5d3842);}return _0x49af06[_0xe4d0('0x1e')](_0x5d3842)[_0xe4d0('0x1f')]();};}function respondWithResult(_0x34d63a,_0x24687e){_0x24687e=_0x24687e||0xc8;return function(_0x39c32a){if(_0x39c32a){return _0x34d63a['status'](_0x24687e)[_0xe4d0('0x20')](_0x39c32a);}};}function respondWithFilteredResult(_0x19c8eb,_0x186273){return function(_0x1b91bb){if(_0x1b91bb){var _0xf3673f=typeof _0x186273['offset']===_0xe4d0('0x21')&&typeof _0x186273[_0xe4d0('0x22')]===_0xe4d0('0x21');var _0x61115d=_0x1b91bb[_0xe4d0('0x23')];var _0x2d492b=_0xf3673f?0x0:_0x186273[_0xe4d0('0x24')];var _0x41d76a=_0xf3673f?_0x1b91bb[_0xe4d0('0x23')]:_0x186273[_0xe4d0('0x24')]+_0x186273[_0xe4d0('0x22')];var _0x5e9057;if(_0x41d76a>=_0x61115d){_0x41d76a=_0x61115d;_0x5e9057=0xc8;}else{_0x5e9057=0xce;}_0x19c8eb[_0xe4d0('0x1e')](_0x5e9057);return _0x19c8eb[_0xe4d0('0x25')](_0xe4d0('0x26'),_0x2d492b+'-'+_0x41d76a+'/'+_0x61115d)['json'](_0x1b91bb);}return null;};}function patchUpdates(_0x261b1c){return function(_0x2082be){try{jsonpatch['apply'](_0x2082be,_0x261b1c,!![]);}catch(_0x5ead45){return BPromise[_0xe4d0('0x27')](_0x5ead45);}return _0x2082be[_0xe4d0('0x28')]();};}function saveUpdates(_0x116c32,_0xec74a9){return function(_0x3d2bc9){if(_0x3d2bc9){return _0x3d2bc9['update'](_0x116c32)[_0xe4d0('0x29')](function(_0x5e0fa9){return _0x5e0fa9;});}return null;};}function removeEntity(_0x3ed0d2,_0x134378){return function(_0x4efb10){if(_0x4efb10){return _0x4efb10[_0xe4d0('0x2a')]()[_0xe4d0('0x29')](function(){_0x3ed0d2['status'](0xcc)[_0xe4d0('0x1f')]();});}};}function handleEntityNotFound(_0x4c253d,_0x59b385){return function(_0x5d288b){if(!_0x5d288b){_0x4c253d[_0xe4d0('0x2b')](0x194);}return _0x5d288b;};}function handleError(_0x5532ed,_0x665edc){_0x665edc=_0x665edc||0x1f4;return function(_0x17d603){logger['error'](_0x17d603[_0xe4d0('0x2c')]);if(_0x17d603[_0xe4d0('0x2d')]){delete _0x17d603[_0xe4d0('0x2d')];}_0x5532ed['status'](_0x665edc)[_0xe4d0('0x2e')](_0x17d603);};}function getInteractionUsers(_0x374427,_0x2f82e9){return new BPromise(function(_0x542e86,_0x45751a){try{if(_0x2f82e9[_0x374427['id']]){_0x374427[_0xe4d0('0x2f')]=_['map'](_0x2f82e9[_0x374427['id']],function(_0x29388a){return{'id':_0x29388a['id'],'fullname':_0x29388a['fullname']};});}}catch(_0x277afc){_0x45751a(_0x277afc);}_0x542e86(_0x374427);});}function getInteractionTags(_0x43a063,_0xdae2c6){return new BPromise(function(_0x5a5a4b,_0x464397){try{if(_0x43a063[_0xe4d0('0x30')]){_0x43a063['Tags']=[];_0x43a063['TagIds'][_0xe4d0('0x31')](',')[_0xe4d0('0x32')](function(_0x32437d){_0x43a063['Tags'][_0xe4d0('0x33')](_0xdae2c6[_0x32437d]);});}delete _0x43a063[_0xe4d0('0x30')];}catch(_0x41a55e){_0x464397(_0x41a55e);}_0x5a5a4b(_0x43a063);});}function updateSmsInteraction(_0x5b4ee7,_0x38af8a,_0x59a78c){return new BPromise(function(_0x4933fd,_0x4b0c93){return getInteractionUsers(_0x5b4ee7,_0x59a78c)[_0xe4d0('0x29')](function(_0x12b9fc){return getInteractionTags(_0x12b9fc,_0x38af8a);})[_0xe4d0('0x29')](function(_0x3eb34f){return getStateInteraction(_0x3eb34f);})[_0xe4d0('0x29')](function(_0x518587){_0x4933fd(_0x518587);})['catch'](function(_0x3b99df){_0x4b0c93(_0x3b99df);});});}function getStateInteraction(_0x183da8){return new BPromise(function(_0x17514d){_0x183da8[_0xe4d0('0x34')]=0x0;_0x183da8['talking']=0x0;_0x183da8[_0xe4d0('0x35')]=0x0;_0x183da8[_0xe4d0('0x36')]=0x0;_0x183da8[_0xe4d0('0x37')]=0x0;if(!_0x183da8[_0xe4d0('0x38')]&&!_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x34')]+=0x1;}if(!_0x183da8[_0xe4d0('0x38')]&&_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x3a')]+=0x1;if(_0x183da8[_0xe4d0('0x34')]){_0x183da8[_0xe4d0('0x34')]-=0x1;}}if(_0x183da8[_0xe4d0('0x38')]&&_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x35')]+=0x1;if(_0x183da8[_0xe4d0('0x3a')]){_0x183da8[_0xe4d0('0x3a')]-=0x1;}}if(_0x183da8[_0xe4d0('0x38')]&&!_0x183da8[_0xe4d0('0x39')]){_0x183da8['unmanaged']+=0x1;if(_0x183da8[_0xe4d0('0x34')]){_0x183da8[_0xe4d0('0x34')]-=0x1;}}_0x183da8[_0xe4d0('0x37')]+=0x1;_0x17514d(_0x183da8);});}exports[_0xe4d0('0x3b')]=function(_0x34eda5,_0x5c36ef){var _0x78bdf6={},_0x4727f1={},_0x218bf9={'count':0x0,'rows':[]};var _0xd9f567=_[_0xe4d0('0x3c')](db['SmsInteraction'][_0xe4d0('0x3d')],function(_0x4bea45){return{'name':_0x4bea45[_0xe4d0('0x3e')],'type':_0x4bea45['type']['key']};});_0x4727f1['model']=_['map'](_0xd9f567,_0xe4d0('0x2d'));_0x4727f1['query']=_['keys'](_0x34eda5[_0xe4d0('0x3f')]);_0x4727f1[_0xe4d0('0x40')]=_[_0xe4d0('0x41')](_0x4727f1['model'],_0x4727f1[_0xe4d0('0x3f')]);_0x78bdf6[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x4727f1[_0xe4d0('0x43')],qs[_0xe4d0('0x44')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x44')]));_0x78bdf6[_0xe4d0('0x42')]=_0x78bdf6['attributes'][_0xe4d0('0x45')]?_0x78bdf6[_0xe4d0('0x42')]:_0x4727f1[_0xe4d0('0x43')];if(!_0x34eda5[_0xe4d0('0x3f')]['hasOwnProperty'](_0xe4d0('0x46'))){_0x78bdf6[_0xe4d0('0x22')]=qs[_0xe4d0('0x22')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x22')]);_0x78bdf6[_0xe4d0('0x24')]=qs[_0xe4d0('0x24')](_0x34eda5[_0xe4d0('0x3f')]['offset']);}_0x78bdf6['order']=qs[_0xe4d0('0x47')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x47')]);_0x78bdf6[_0xe4d0('0x48')]=qs[_0xe4d0('0x40')](_[_0xe4d0('0x49')](_0x34eda5['query'],_0x4727f1[_0xe4d0('0x40')]),_0xd9f567);var _0x3718cb=[];var _0x41248f=squel[_0xe4d0('0x4a')]()[_0xe4d0('0x4b')]('id')[_0xe4d0('0x4b')](_0xe4d0('0x2d'))[_0xe4d0('0x4b')]('color')[_0xe4d0('0x4c')](_0xe4d0('0x4d'));var _0x3ff5fa=squel['select']()[_0xe4d0('0x4b')](_0xe4d0('0x4e'))['field'](_0xe4d0('0x4f'))[_0xe4d0('0x4b')]('ui.SmsInteractionId')[_0xe4d0('0x4c')](_0xe4d0('0x50'),'ui')[_0xe4d0('0x51')](_0xe4d0('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x32772e=squel['select']()[_0xe4d0('0x4c')](_0xe4d0('0x53'),'i')[_0xe4d0('0x51')](_0xe4d0('0x54'),'c',_0xe4d0('0x55'))[_0xe4d0('0x51')](_0xe4d0('0x52'),'o',_0xe4d0('0x56'))['left_join']('sms_accounts','a',_0xe4d0('0x57'))[_0xe4d0('0x51')]('sms_messages','me',_0xe4d0('0x58'))['left_join'](_0xe4d0('0x59'),'it',_0xe4d0('0x5a'))[_0xe4d0('0x51')](_0xe4d0('0x4d'),'t',_0xe4d0('0x5b'));var _0x36818d=squel[_0xe4d0('0x5c')]();var _0x14c134=[];var _0x5642bb=squel['expr']();var _0x2661e9;if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x5d')]){_0x2661e9=as[_0xe4d0('0x5e')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x5d')]);var _0x3e72ff=_0x2661e9[_0xe4d0('0x5f')];for(var _0x44e44d=0x0;_0x44e44d<_0x2661e9[_0xe4d0('0x60')][_0xe4d0('0x45')];_0x44e44d++){var _0x2865a4=_0x2661e9[_0xe4d0('0x60')][_0x44e44d];var _0x256777='i';var _0x4eba71=_['find'](_0xd9f567,[_0xe4d0('0x2d'),_0x2865a4['field']]);if(!_0x4eba71){switch(_0x2865a4[_0xe4d0('0x4b')]){case _0xe4d0('0x61'):if(_0x2865a4[_0xe4d0('0x62')]==0x1){_0x32772e[_0xe4d0('0x63')]('`'+_0x2865a4[_0xe4d0('0x4b')]+_0xe4d0('0x64'));}else{_0x32772e[_0xe4d0('0x63')]('`'+_0x2865a4[_0xe4d0('0x4b')]+_0xe4d0('0x65'));}break;case _0xe4d0('0x66'):if(_0x2865a4['operator']===_0xe4d0('0x67')){if(_0x2865a4[_0xe4d0('0x62')][_0xe4d0('0x31')]('\x20')[_0xe4d0('0x45')]>0x1){_0x36818d[_0x3e72ff](_0xe4d0('0x68'),qs[_0xe4d0('0x69')](_0x2865a4[_0xe4d0('0x62')]),null);}else{var _0x3da8b4='%'+_0x2865a4[_0xe4d0('0x62')]+'%';_0x36818d[_0x3e72ff](_0xe4d0('0x6a'),_0x3da8b4,_0x3da8b4,_0x3da8b4);}}else{_0x4eba71=_[_0xe4d0('0x6b')](_0xd9f567,[_0xe4d0('0x2d'),_0xe4d0('0x6c')]);_0x2865a4['field']=_0xe4d0('0x6c');_0x494dac=as[_0xe4d0('0x6d')](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x70')],_0x494dac['value'][_0xe4d0('0x1f')]);}break;case _0xe4d0('0x71'):var _0xec6ffc=_0x2865a4[_0xe4d0('0x62')][_0xe4d0('0x31')](',')[_0xe4d0('0x3c')](function(_0x2fa7d9){return Number(_0x2fa7d9);});_0xec6ffc[_0xe4d0('0x32')](function(_0x35249b){_0x5642bb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35249b+',%');});_0x14c134=_[_0xe4d0('0x72')](_0x14c134,_0xec6ffc);break;case'User':if(_0x2865a4[_0xe4d0('0x73')]===_0xe4d0('0x67')){_0x36818d[_0x3e72ff](_0xe4d0('0x74'),'%'+_0x2865a4[_0xe4d0('0x62')]+'%',null);}else{_0x4eba71=_[_0xe4d0('0x6b')](_0xd9f567,[_0xe4d0('0x2d'),_0xe4d0('0x39')]);_0x2865a4[_0xe4d0('0x4b')]=_0xe4d0('0x39');_0x494dac=as['buildExpression'](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);}break;case'body':_0x494dac=as['buildExpression']('me',null,_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac['value'][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);break;}}else{var _0x494dac=as[_0xe4d0('0x6d')](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac['value'][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);}}}else{var _0x4104a4=_(_0x34eda5['query'])[_0xe4d0('0x75')]()[_0xe4d0('0x3c')](function(_0x3bd1e6){return _[_0xe4d0('0x76')](_0xd9f567,[_0xe4d0('0x2d'),_0x3bd1e6])?_0x3bd1e6:undefined;})['compact']()['value']();if(!_[_0xe4d0('0x77')](_0x4104a4)){_0x4104a4['forEach'](function(_0x521b0c){if(_0x521b0c===_0xe4d0('0x78')){_0x32772e['where']('i.SmsAccountId\x20IN\x20?',[][_0xe4d0('0x79')](_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]));}else if(_0x521b0c===_0xe4d0('0x7a')){var _0x499c28=JSON['parse'](_0x34eda5['query'][_0x521b0c])[_0xe4d0('0x7b')];var _0x1f20dc=JSON['parse'](_0x34eda5['query'][_0x521b0c])[_0xe4d0('0x7c')];_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x7d'),_0x499c28,_0x1f20dc);}else{if(_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]===_0xe4d0('0x7e')){_0x32772e[_0xe4d0('0x48')]('i.'+_0x521b0c+_0xe4d0('0x7f'));}else{_0x32772e[_0xe4d0('0x48')]('i.'+_0x521b0c+'\x20=\x20?',_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]);}}});}if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x80')]){if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x80')]==0x1){_0x32772e[_0xe4d0('0x63')](_0xe4d0('0x81'));}else{_0x32772e[_0xe4d0('0x63')](_0xe4d0('0x82'));}}if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x83')]){_0x14c134=_[_0xe4d0('0x84')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x83')])?_0x34eda5['query']['tag']:new Array(_0x34eda5['query'][_0xe4d0('0x83')]);_0x14c134[_0xe4d0('0x32')](function(_0x6f02d0){_0x5642bb['or'](_0xe4d0('0x85'),'%,'+_0x6f02d0+',%');});}if(_0x34eda5['query'][_0xe4d0('0x86')]){var _0x56683f=_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x86')][_0xe4d0('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x56683f)){_0x36818d['or']('i.id\x20LIKE\x20?',_0x56683f+'%')['or'](_0xe4d0('0x88'),_0x56683f+'%');}else{_0x36818d['or'](_0xe4d0('0x89'),qs[_0xe4d0('0x69')](_0x56683f))['or'](_0xe4d0('0x8a'),_0x56683f+'%');}}}_0x32772e['where'](_0x36818d);_0x32772e['group']('i.id');var _0x2b4722={'type':db[_0xe4d0('0x8b')][_0xe4d0('0x8c')][_0xe4d0('0x8d')],'raw':!![]};var _0xbe3d8b=_0x32772e['clone']();_0xbe3d8b[_0xe4d0('0x4b')]('i.id');_0xbe3d8b[_0xe4d0('0x4b')](_0xe4d0('0x8e'),_0xe4d0('0x61'));if(_0x78bdf6[_0xe4d0('0x8f')]){_0x78bdf6[_0xe4d0('0x8f')][_0xe4d0('0x32')](function(_0x187125){var _0x5b0c86=_0x187125[0x0]===_0xe4d0('0x90')?_0x187125[0x0]:'i.'+_0x187125[0x0];_0x32772e['order'](_0x5b0c86,_0x187125[0x1]===_0xe4d0('0x91')?![]:!![]);});}if(!_[_0xe4d0('0x77')](_0x14c134)){_0x32772e[_0xe4d0('0x63')](_0x5642bb);_0xbe3d8b['where'](_0xe4d0('0x92'),_0x14c134);}BPromise[_0xe4d0('0x93')]()[_0xe4d0('0x29')](function(){if(!_0x2661e9){if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x78')])return;_0xbe3d8b[_0xe4d0('0x48')](_0xe4d0('0x94'));_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x94'));return;}if(_0x34eda5[_0xe4d0('0x95')][_0xe4d0('0x96')]!==_0xe4d0('0x97'))return;return _0x34eda5[_0xe4d0('0x95')][_0xe4d0('0x98')]({'attributes':['id'],'raw':!![]})[_0xe4d0('0x29')](function(_0x9644d6){if(_[_0xe4d0('0x77')](_0x9644d6)){_0xbe3d8b[_0xe4d0('0x48')](_0xe4d0('0x99'));_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x99'));}else{_0xbe3d8b['where'](_0xe4d0('0x9a'),_[_0xe4d0('0x3c')](_0x9644d6,'id'));_0x32772e['where']('i.SmsAccountId\x20IN\x20?',_[_0xe4d0('0x3c')](_0x9644d6,'id'));}});})[_0xe4d0('0x29')](function(){if(_0x34eda5['user'][_0xe4d0('0x96')]==='agent'&&!_0x2661e9&&!_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x78')])return[];return db[_0xe4d0('0x9b')][_0xe4d0('0x3f')](_0xbe3d8b['toString'](),_0x2b4722);})[_0xe4d0('0x29')](function(_0x1b1bb3){_0x218bf9[_0xe4d0('0x23')]=_0x1b1bb3[_0xe4d0('0x45')];if(_0x218bf9[_0xe4d0('0x23')]===0x0)return[];return db['sequelize']['query'](_0x41248f[_0xe4d0('0x9c')](),_0x2b4722)[_0xe4d0('0x29')](function(_0x4713e1){_0x3718cb=_[_0xe4d0('0x9d')](_0x4713e1,'id');_0x2b4722=_[_0xe4d0('0x9e')](_0x2b4722,{'model':db[_0xe4d0('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x44')]){_0x78bdf6[_0xe4d0('0x42')][_0xe4d0('0x32')](function(_0x6cff7){_0x32772e['field']('i.'+_0x6cff7);});}else{_0x32772e['field'](_0xe4d0('0x8e'),_0xe4d0('0x61'));_0x32772e['field'](_0xe4d0('0xa0'),'Account.key');_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa1'),_0xe4d0('0xa2'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa3'),'contactName');_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa4'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa5'),_0xe4d0('0xa6'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa7'),'Contact.lastName');_0x32772e['field'](_0xe4d0('0xa8'),_0xe4d0('0xa9'));_0x32772e['field'](_0xe4d0('0xaa'),_0xe4d0('0xab'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xac'),_0xe4d0('0xad'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xae'),_0xe4d0('0xaf'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xb0'),_0xe4d0('0xb1'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xb2'),_0xe4d0('0xb3'));_0x32772e['field'](_0xe4d0('0xb4'),_0xe4d0('0x30'));}if(_0x78bdf6[_0xe4d0('0x22')])_0x32772e[_0xe4d0('0x22')](_0x78bdf6[_0xe4d0('0x22')]);if(_0x78bdf6[_0xe4d0('0x24')])_0x32772e['offset'](_0x78bdf6[_0xe4d0('0x24')]);return db['sequelize'][_0xe4d0('0x3f')](_0x32772e[_0xe4d0('0x9c')](),_0x2b4722);})[_0xe4d0('0x29')](function(_0x1107a6){if(_0x1107a6[_0xe4d0('0x45')]>0x0)_0x3ff5fa[_0xe4d0('0x48')](_0xe4d0('0xb5'),_[_0xe4d0('0x3c')](_0x1107a6,'id'));return db[_0xe4d0('0x9b')][_0xe4d0('0x3f')](_0x3ff5fa[_0xe4d0('0x9c')](),_0x2b4722)[_0xe4d0('0x29')](function(_0x4fbef9){var _0x228fec=_[_0xe4d0('0xb6')](_0x4fbef9,_0xe4d0('0xb7'));var _0x33237e=[];_0x1107a6[_0xe4d0('0x32')](function(_0xef5d5){_0x33237e['push'](updateSmsInteraction(_0xef5d5,_0x3718cb,_0x228fec));});return BPromise[_0xe4d0('0xb8')](_0x33237e);});});})[_0xe4d0('0x29')](function(_0x404f3a){_0x218bf9[_0xe4d0('0xb9')]=_0x404f3a;return _0x218bf9;})[_0xe4d0('0x29')](respondWithFilteredResult(_0x5c36ef,_0x78bdf6))[_0xe4d0('0xba')](handleError(_0x5c36ef,null));};exports[_0xe4d0('0xbb')]=function(_0x326a04,_0x2a9c24){var _0x4c0db8={'raw':![],'where':{'id':_0x326a04[_0xe4d0('0xbc')]['id']}},_0x1d0b83={};_0x1d0b83['model']=_[_0xe4d0('0x75')](db['SmsInteraction'][_0xe4d0('0x3d')]);_0x1d0b83[_0xe4d0('0x3f')]=_['keys'](_0x326a04[_0xe4d0('0x3f')]);_0x1d0b83[_0xe4d0('0x40')]=_[_0xe4d0('0x41')](_0x1d0b83[_0xe4d0('0x43')],_0x1d0b83['query']);_0x4c0db8[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x1d0b83[_0xe4d0('0x43')],qs['fields'](_0x326a04['query'][_0xe4d0('0x44')]));_0x4c0db8[_0xe4d0('0x42')]=_0x4c0db8[_0xe4d0('0x42')][_0xe4d0('0x45')]?_0x4c0db8[_0xe4d0('0x42')]:_0x1d0b83[_0xe4d0('0x43')];if(_0x326a04[_0xe4d0('0x3f')][_0xe4d0('0xbd')]){_0x4c0db8['include']=[{'all':!![]}];}_0x4c0db8=_[_0xe4d0('0x9e')]({},_0x4c0db8,_0x326a04[_0xe4d0('0xbe')]);return db['SmsInteraction'][_0xe4d0('0x6b')](_0x4c0db8)[_0xe4d0('0x29')](handleEntityNotFound(_0x2a9c24,null))[_0xe4d0('0x29')](respondWithResult(_0x2a9c24,null))[_0xe4d0('0xba')](handleError(_0x2a9c24,null));};exports[_0xe4d0('0xbf')]=function(_0x26f6c9,_0x251e33){return db['SmsInteraction'][_0xe4d0('0xbf')](_0x26f6c9[_0xe4d0('0xc0')],{})[_0xe4d0('0x29')](respondWithResult(_0x251e33,0xc9))['catch'](handleError(_0x251e33,null));};exports[_0xe4d0('0xc1')]=function(_0x382d5f,_0x21f011){if(_0x382d5f[_0xe4d0('0xc0')]['id']){delete _0x382d5f[_0xe4d0('0xc0')]['id'];}return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x382d5f[_0xe4d0('0xbc')]['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x21f011,null))[_0xe4d0('0x29')](saveUpdates(_0x382d5f[_0xe4d0('0xc0')],null))[_0xe4d0('0x29')](respondWithResult(_0x21f011,null))['catch'](handleError(_0x21f011,null));};exports[_0xe4d0('0x2a')]=function(_0x2986d1,_0x225142){return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x2986d1['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x225142,null))['then'](removeEntity(_0x225142,null))[_0xe4d0('0xba')](handleError(_0x225142,null));};exports[_0xe4d0('0xc2')]=function(_0x55ceee,_0x186b52){return db['SmsInteraction'][_0xe4d0('0xc2')]()['then'](respondWithResult(_0x186b52,null))[_0xe4d0('0xba')](handleError(_0x186b52,null));};exports[_0xe4d0('0xc3')]=function(_0x1c1a11,_0x33d3e5,_0x311b54){return db[_0xe4d0('0xc4')][_0xe4d0('0x6b')]({'where':{'id':_0x1c1a11['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x33d3e5,null))[_0xe4d0('0x29')](function(_0x1dd018){if(_0x1dd018){return _0x1dd018[_0xe4d0('0xc3')](_0x1c1a11['body'][_0xe4d0('0xc5')],_[_0xe4d0('0xc6')](_0x1c1a11[_0xe4d0('0xc0')],[_0xe4d0('0xc5'),'id'])||{});}})[_0xe4d0('0x29')](respondWithResult(_0x33d3e5,null))[_0xe4d0('0xba')](handleError(_0x33d3e5,null));};exports['getMessages']=function(_0x214ca2,_0x1bfa6b,_0x46776f){var _0xb9a5c6={'raw':![],'where':{}};var _0x4d9556={};var _0xfeef1c={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe4d0('0xc7')]({'where':{'id':_0x214ca2[_0xe4d0('0xbc')]['id']}})['then'](handleEntityNotFound(_0x1bfa6b,null))[_0xe4d0('0x29')](function(_0x18ee19){if(_0x18ee19){_0x4d9556[_0xe4d0('0x43')]=_[_0xe4d0('0x75')](db[_0xe4d0('0xc4')][_0xe4d0('0x3d')]);_0x4d9556['query']=_['keys'](_0x214ca2['query']);_0x4d9556['filters']=_[_0xe4d0('0x41')](_0x4d9556[_0xe4d0('0x43')],_0x4d9556[_0xe4d0('0x3f')]);_0xb9a5c6[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x4d9556['model'],qs['fields'](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x44')]));_0xb9a5c6[_0xe4d0('0x42')]=_0xb9a5c6[_0xe4d0('0x42')][_0xe4d0('0x45')]?_0xb9a5c6[_0xe4d0('0x42')]:_0x4d9556['model'];if(!_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0xc8')](_0xe4d0('0x46'))){_0xb9a5c6['limit']=qs[_0xe4d0('0x22')](_0x214ca2[_0xe4d0('0x3f')]['limit']);_0xb9a5c6['offset']=qs[_0xe4d0('0x24')](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x24')]);}_0xb9a5c6['order']=qs[_0xe4d0('0x47')](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x47')]);_0xb9a5c6[_0xe4d0('0x48')]=qs[_0xe4d0('0x40')](_[_0xe4d0('0x49')](_0x214ca2[_0xe4d0('0x3f')],_0x4d9556[_0xe4d0('0x40')]));_0xb9a5c6[_0xe4d0('0x48')][_0xe4d0('0xb7')]=_0x18ee19['id'];if(_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x86')]){_0xb9a5c6['where']=_[_0xe4d0('0x9e')](_0xb9a5c6[_0xe4d0('0x48')],{'$or':_[_0xe4d0('0x3c')](_0xb9a5c6[_0xe4d0('0x42')],function(_0x4e4869){var _0x2ba69b={};_0x2ba69b[_0x4e4869]={'$like':'%'+_0x214ca2['query'][_0xe4d0('0x86')]+'%'};return _0x2ba69b;})});}if(_0x214ca2['query'][_0xe4d0('0x7b')]){var _0xca8156=_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x7b')][_0xe4d0('0x31')](',');var _0x36476c={};_0x36476c[_0xca8156[0x0]]={'$gte':moment(_0xca8156[0x1])['format'](_0xe4d0('0xc9'))};_0xb9a5c6[_0xe4d0('0x48')]=_[_0xe4d0('0x9e')](_0xb9a5c6[_0xe4d0('0x48')],_0x36476c);}_0xb9a5c6=_['merge']({},_0xb9a5c6,_0x214ca2[_0xe4d0('0xbe')]);return db[_0xe4d0('0xc4')]['count']({'where':_0xb9a5c6[_0xe4d0('0x48')]})['then'](function(_0x3a38b3){_0xfeef1c[_0xe4d0('0x23')]=_0x3a38b3;if(_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0xbd')]){_0xb9a5c6[_0xe4d0('0xca')]=[{'all':!![]}];}return db['SmsMessage'][_0xe4d0('0xcb')](_0xb9a5c6);})[_0xe4d0('0x29')](function(_0x547b0a){_0xfeef1c[_0xe4d0('0xb9')]=_0x547b0a;return _0xfeef1c;});}})[_0xe4d0('0x29')](respondWithFilteredResult(_0x1bfa6b,_0xb9a5c6))[_0xe4d0('0xba')](handleError(_0x1bfa6b,null));};exports['addTags']=function(_0xb11546,_0x8f9f72,_0x6fce9d){return db['SmsInteraction'][_0xe4d0('0x6b')]({'where':{'id':_0xb11546[_0xe4d0('0xbc')]['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x8f9f72,null))[_0xe4d0('0x29')](function(_0x9e1ab5){if(_0x9e1ab5){return _0x9e1ab5[_0xe4d0('0xcc')](_0xb11546[_0xe4d0('0xc0')][_0xe4d0('0xc5')],_[_0xe4d0('0xc6')](_0xb11546[_0xe4d0('0xc0')],[_0xe4d0('0xc5'),'id'])||{})['spread'](function(){return db[_0xe4d0('0x71')]['findAll']({'attributes':['id',_0xe4d0('0x2d'),_0xe4d0('0xcd')],'where':{'id':_0xb11546['body'][_0xe4d0('0xc5')]}});})['then'](function(_0x2baac1){socket[_0xe4d0('0xce')](_0xe4d0('0xcf'),{'id':Number(_0xb11546[_0xe4d0('0xbc')]['id']),'tags':_0x2baac1||[]});return{'id':Number(_0xb11546['params']['id']),'tags':_0x2baac1||[]};});}})[_0xe4d0('0x29')](respondWithResult(_0x8f9f72,null))[_0xe4d0('0xba')](handleError(_0x8f9f72,null));};exports['removeTags']=function(_0x4adf77,_0x57469c,_0x101136){return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x4adf77['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x57469c,null))['then'](function(_0x97c890){if(_0x97c890){return _0x97c890[_0xe4d0('0xd0')](_0x4adf77[_0xe4d0('0x3f')][_0xe4d0('0xc5')]);}})[_0xe4d0('0x29')](respondWithStatusCode(_0x57469c,null))['catch'](handleError(_0x57469c,null));};exports[_0xe4d0('0xd1')]=function(_0x5913aa,_0x3836e5){var _0x258100=moment()['unix']()['toString']();var _0x3f45da=path[_0xe4d0('0xd2')](config[_0xe4d0('0xd3')],_0xe4d0('0xd4'),_0xe4d0('0xd5'),'tmp');var _0x5a98fb=path['join'](config['root'],_0xe4d0('0xd4'),'files',_0xe4d0('0xd6'));var _0x23898a=path['join'](_0x3f45da,_0x258100);var _0x28fc04=util['format']('transcript-%d-%s.zip',_0x5913aa[_0xe4d0('0xbc')]['id'],_0x258100);var _0x3bbcbb=path[_0xe4d0('0xd2')](_0x3f45da,_0x28fc04);var _0x40262b=[];_0x40262b[_0xe4d0('0x33')]({'model':db[_0xe4d0('0xd7')],'as':_0xe4d0('0xd7'),'attributes':['id',_0xe4d0('0xd8')],'raw':!![]});_0x40262b[_0xe4d0('0x33')]({'model':db['CmContact'],'as':_0xe4d0('0x66'),'attributes':['id',_0xe4d0('0xd9'),_0xe4d0('0xda')],'raw':!![]});var _0x1a0055=[{'model':db[_0xe4d0('0xc4')],'as':_0xe4d0('0xdb'),'attributes':['id',_0xe4d0('0xc0'),'createdAt',_0xe4d0('0xdc'),_0xe4d0('0xdd'),'read'],'include':_0x40262b}];_0x1a0055['push']({'model':db[_0xe4d0('0xde')],'as':_0xe4d0('0xdf'),'attributes':['id',_0xe4d0('0x2d')]});_0x1a0055[_0xe4d0('0x33')]({'model':db[_0xe4d0('0xd7')],'as':'Owner','attributes':['id',_0xe4d0('0xd8')]});return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x5913aa[_0xe4d0('0xbc')]['id']},'include':_0x1a0055})[_0xe4d0('0x29')](handleEntityNotFound(_0x3836e5,null))[_0xe4d0('0x29')](function(_0x450df5){if(_0x450df5){var _0x2a5044=_0x450df5['get']({'plain':!![]});fs[_0xe4d0('0xe0')](_0x23898a);var _0x417c40={'channel':'Sms','account':_0x2a5044[_0xe4d0('0xdf')][_0xe4d0('0x2d')],'agent':_0x2a5044['Owner']?_0x2a5044[_0xe4d0('0xe1')]['fullname']:_0xe4d0('0xe2'),'createdAt':moment(_0x2a5044[_0xe4d0('0x7a')])[_0xe4d0('0xe3')](_0xe4d0('0xc9'))[_0xe4d0('0x9c')](),'closedAt':_0x2a5044[_0xe4d0('0x38')]?moment(_0x2a5044[_0xe4d0('0xe4')])[_0xe4d0('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2a5044[_0xe4d0('0xe5')],'messages':_(_0x2a5044[_0xe4d0('0xdb')])[_0xe4d0('0x86')]({'secret':![]})[_0xe4d0('0x3c')](function(_0x12acc8){return{'date':moment(_0x12acc8[_0xe4d0('0x7a')])[_0xe4d0('0xe3')](_0xe4d0('0xc9'))[_0xe4d0('0x9c')](),'sender':_0x12acc8[_0xe4d0('0xdc')]===_0xe4d0('0xe6')?_0x12acc8[_0xe4d0('0xd7')]?_0x12acc8[_0xe4d0('0xd7')][_0xe4d0('0xd8')]:'System':_0x12acc8[_0xe4d0('0x66')][_0xe4d0('0xd9')]+(_0x12acc8[_0xe4d0('0x66')][_0xe4d0('0xda')]?'\x20'+_0x12acc8['Contact'][_0xe4d0('0xda')]:''),'body':_0x12acc8[_0xe4d0('0xc0')],'direction':_0x12acc8[_0xe4d0('0xdc')]===_0xe4d0('0xe6')?'A':'C','secret':_0x12acc8[_0xe4d0('0xdd')],'read':_0x12acc8['read']};})['value']()};return ejs['renderFile'](path[_0xe4d0('0xd2')](config[_0xe4d0('0xd3')],_0xe4d0('0xd4'),'views',_0xe4d0('0xe7')),{'interaction':_0x417c40})['then'](function(_0xa34124){var _0x3b4995=path[_0xe4d0('0xd2')](_0x23898a,'transcript-'+_0x2a5044['id']+'-'+_0x258100+_0xe4d0('0xe8'));var _0x9a8c04={'path':_0x3b4995,'channel':_0xe4d0('0xe9'),'interactionId':_0x2a5044['id']};return pdf['createPdfFromHTML'](_0xa34124,_0x9a8c04);})[_0xe4d0('0x29')](function(){return new BPromise(function(_0x5b3de0,_0x34426e){zipdir(_0x23898a,{'saveTo':_0x3bbcbb},function(_0x46d0b8,_0x13bfb3){if(_0x46d0b8)return _0x34426e(_0x46d0b8);return _0x5b3de0(_0x13bfb3);});})[_0xe4d0('0x29')](function(){return new BPromise(function(_0x3ed61f,_0x5dc35d){rimraf(_0x23898a,function(_0xa5e94b){if(_0xa5e94b)_0x5dc35d(_0xa5e94b);return _0x3ed61f();});});})[_0xe4d0('0x29')](function(){return _0x3836e5[_0xe4d0('0xd1')](_0x3bbcbb,_0x28fc04,function(_0x5ddbe1){if(_0x5ddbe1){console['log'](_0xe4d0('0xea'),_0x5ddbe1);}else{fs[_0xe4d0('0xeb')](_0x3bbcbb);}});});});}else{return _0x3836e5[_0xe4d0('0x2b')](0xc8);}})['catch'](handleError(_0x3836e5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index df8d8d7..9713aa8 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 _0xf2e3=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xf2e3[_0x9dfc10];return _0x4f938a;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3f2e('0x1')];var SmsMessage=require(_0x3f2e('0x2'))['db'][_0x3f2e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3f2e('0x4')](0x0);var events={'afterCreate':_0x3f2e('0x5'),'afterUpdate':_0x3f2e('0x6'),'afterDestroy':_0x3f2e('0x7')};function emitEvent(_0xabcf5c){return function(_0x216b26,_0x5f254a,_0x33a3b7){_0x216b26[_0x3f2e('0x8')]({'attributes':['id'],'raw':!![]})[_0x3f2e('0x9')](function(_0xdf499f){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xb'),_0xdf499f[_0x3f2e('0xc')](function(_0x434e0c){return{'id':_0x434e0c['id']};}));return SmsMessage[_0x3f2e('0xd')]({'where':{'SmsInteractionId':_0x216b26['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3f2e('0x9')](function(_0x21f22b){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xe'),_0x21f22b[_0x3f2e('0xf')]);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c+':'+_0x216b26['id'],_0x216b26);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c,_0x216b26);_0x33a3b7(null);})[_0x3f2e('0x11')](_0x33a3b7(null));};}for(var e in events){if(events[_0x3f2e('0x12')](e)){var event=events[e];SmsInteraction[_0x3f2e('0x13')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x509140,_0x3f8187){_0x509140=_0x509140-0x0;var _0x4ffd18=_0xcf2f[_0x509140];return _0x4ffd18;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 68bc9d6..e42d09a 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 _0x3e68=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','format'];(function(_0x55e3f2,_0x15a5a2){var _0x48c273=function(_0x5bb0e1){while(--_0x5bb0e1){_0x55e3f2['push'](_0x55e3f2['shift']());}};_0x48c273(++_0x15a5a2);}(_0x3e68,0x97));var _0x83e6=function(_0x2f2507,_0x3c41a0){_0x2f2507=_0x2f2507-0x0;var _0x2e00a4=_0x3e68[_0x2f2507];return _0x2e00a4;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var logger=require('../../config/logger')(_0x83e6('0x2'));var moment=require(_0x83e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x83e6('0x4'));var fs=require('fs');var path=require(_0x83e6('0x5'));var rimraf=require(_0x83e6('0x6'));var config=require('../../config/environment');var attributes=require(_0x83e6('0x7'));module[_0x83e6('0x8')]=function(_0x536e89,_0x15c7b7){return _0x536e89[_0x83e6('0x9')](_0x83e6('0xa'),attributes,{'tableName':_0x83e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49b069,_0x4268d1,_0x3a58bf){if(_0x49b069['changed'](_0x83e6('0xc'))){_0x49b069['closedAt']=moment()[_0x83e6('0xd')](_0x83e6('0xe'));}_0x3a58bf(null,_0x49b069);}}});}; \ No newline at end of file +var _0xcfa2=['closed','closedAt','format','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0x3fd92b,_0x7c1c){var _0x5e75cd=function(_0x15b0e0){while(--_0x15b0e0){_0x3fd92b['push'](_0x3fd92b['shift']());}};_0x5e75cd(++_0x7c1c);}(_0xcfa2,0x193));var _0x2cfa=function(_0x5d4901,_0x2724bb){_0x5d4901=_0x5d4901-0x0;var _0x2b07b1=_0xcfa2[_0x5d4901];return _0x2b07b1;};'use strict';var _=require(_0x2cfa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2cfa('0x1'));var moment=require(_0x2cfa('0x2'));var BPromise=require(_0x2cfa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfa('0x4'));var rimraf=require(_0x2cfa('0x5'));var config=require(_0x2cfa('0x6'));var attributes=require(_0x2cfa('0x7'));module[_0x2cfa('0x8')]=function(_0x38176e,_0x5264f7){return _0x38176e[_0x2cfa('0x9')](_0x2cfa('0xa'),attributes,{'tableName':_0x2cfa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x409658,_0x6f51c7,_0x33b329){if(_0x409658[_0x2cfa('0xc')](_0x2cfa('0xd'))){_0x409658[_0x2cfa('0xe')]=moment()[_0x2cfa('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x33b329(null,_0x409658);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 48506b4..befcbd1 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 _0xc664=['find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','AddTagsToSmsInteraction'];(function(_0x1bb1de,_0x3db4b1){var _0x6708e3=function(_0x359701){while(--_0x359701){_0x1bb1de['push'](_0x1bb1de['shift']());}};_0x6708e3(++_0x3db4b1);}(_0xc664,0xdd));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var moment=require('moment');var BPromise=require(_0x4c66('0x2'));var rs=require(_0x4c66('0x3'));var fs=require('fs');var Redis=require(_0x4c66('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c66('0x5'))(_0x4c66('0x6'));var config=require(_0x4c66('0x7'));var jayson=require(_0x4c66('0x8'));var client=jayson['client'][_0x4c66('0x9')]({'port':0x232a});config[_0x4c66('0xa')]=_[_0x4c66('0xb')](config['redis'],{'host':_0x4c66('0xc'),'port':0x18eb});var socket=require(_0x4c66('0xd'))(new Redis(config[_0x4c66('0xa')]));require(_0x4c66('0xe'))[_0x4c66('0xf')](socket);function respondWithRpcPromise(_0x8302e6,_0x16c8d2,_0x3b8391){return new BPromise(function(_0x276c08,_0x314abe){return client['request'](_0x8302e6,_0x3b8391)[_0x4c66('0x10')](function(_0x6529e7){logger[_0x4c66('0x11')](_0x4c66('0x12'),_0x16c8d2,'request\x20sent');logger[_0x4c66('0x13')](_0x4c66('0x14'),_0x16c8d2,_0x4c66('0x15'),JSON[_0x4c66('0x16')](_0x6529e7));if(_0x6529e7[_0x4c66('0x17')]){if(_0x6529e7[_0x4c66('0x17')][_0x4c66('0x18')]===0x1f4){logger[_0x4c66('0x17')](_0x4c66('0x12'),_0x16c8d2,_0x6529e7[_0x4c66('0x17')][_0x4c66('0x19')]);return _0x314abe(_0x6529e7['error'][_0x4c66('0x19')]);}logger[_0x4c66('0x17')](_0x4c66('0x12'),_0x16c8d2,_0x6529e7[_0x4c66('0x17')][_0x4c66('0x19')]);return _0x276c08(_0x6529e7[_0x4c66('0x17')][_0x4c66('0x19')]);}else{logger[_0x4c66('0x11')](_0x4c66('0x12'),_0x16c8d2,_0x4c66('0x15'));_0x276c08(_0x6529e7[_0x4c66('0x1a')][_0x4c66('0x19')]);}})[_0x4c66('0x1b')](function(_0x3a4c2e){logger[_0x4c66('0x17')](_0x4c66('0x12'),_0x16c8d2,_0x3a4c2e);_0x314abe(_0x3a4c2e);});});}exports[_0x4c66('0x1c')]=function(_0x2a542f){var _0x59f1fc=this;return new Promise(function(_0x7a5c06,_0x494d9c){return db[_0x4c66('0x1d')][_0x4c66('0x1e')](_0x2a542f[_0x4c66('0x1f')],{'raw':_0x2a542f[_0x4c66('0x20')]?_0x2a542f['options'][_0x4c66('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a542f[_0x4c66('0x20')]?_0x2a542f[_0x4c66('0x20')]['where']||null:null,'attributes':_0x2a542f[_0x4c66('0x20')]?_0x2a542f[_0x4c66('0x20')][_0x4c66('0x22')]||null:null,'limit':_0x2a542f[_0x4c66('0x20')]?_0x2a542f[_0x4c66('0x20')][_0x4c66('0x23')]||null:null})['then'](function(_0x105ae6){logger['info'](_0x4c66('0x1c'),_0x2a542f);logger['debug'](_0x4c66('0x1c'),_0x2a542f,JSON['stringify'](_0x105ae6));_0x7a5c06(_0x105ae6);})[_0x4c66('0x1b')](function(_0x2daeca){logger[_0x4c66('0x17')](_0x4c66('0x1c'),_0x2daeca['message'],_0x2a542f);_0x494d9c(_0x59f1fc[_0x4c66('0x17')](0x1f4,_0x2daeca[_0x4c66('0x19')]));});});};exports[_0x4c66('0x24')]=function(_0x15969b){return new Promise(function(_0x639756,_0x36a709){return db[_0x4c66('0x1d')][_0x4c66('0x25')]({'where':_0x15969b[_0x4c66('0x20')]?_0x15969b[_0x4c66('0x20')]['where']||null:null})[_0x4c66('0x10')](function(_0x471e56){if(_0x471e56){return _0x471e56[_0x4c66('0x26')](_0x15969b[_0x4c66('0x1f')][_0x4c66('0x27')],_[_0x4c66('0x28')](_0x15969b['body'],['ids','id'])||{});}})[_0x4c66('0x29')](function(_0x56e481){logger['info']('AddTags',_0x15969b);logger['debug'](_0x4c66('0x2a'),_0x15969b,JSON[_0x4c66('0x16')](_0x56e481));_0x639756(_0x56e481);})['catch'](function(_0x539f14){logger[_0x4c66('0x17')]('AddTags',_0x539f14[_0x4c66('0x19')],_0x15969b);_0x36a709(_this[_0x4c66('0x17')](0x1f4,_0x539f14['message']));});});}; \ No newline at end of file +var _0xe25b=['AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','UpdateSmsInteraction','update','raw','options','where','limit','stringify','AddTagsToSmsInteraction','SmsInteraction','find','addTags','body','omit','spread'];(function(_0x23f0a2,_0x16a681){var _0x5398a8=function(_0x1e292c){while(--_0x1e292c){_0x23f0a2['push'](_0x23f0a2['shift']());}};_0x5398a8(++_0x16a681);}(_0xe25b,0x19b));var _0xbe25=function(_0x13ce1a,_0x7ccc3b){_0x13ce1a=_0x13ce1a-0x0;var _0x46d010=_0xe25b[_0x13ce1a];return _0x46d010;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var moment=require('moment');var BPromise=require(_0xbe25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe25('0x3'));var db=require(_0xbe25('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe25('0x5'))(_0xbe25('0x6'));var config=require(_0xbe25('0x7'));var jayson=require(_0xbe25('0x8'));var client=jayson[_0xbe25('0x9')]['http']({'port':0x232a});config[_0xbe25('0xa')]=_[_0xbe25('0xb')](config[_0xbe25('0xa')],{'host':_0xbe25('0xc'),'port':0x18eb});var socket=require(_0xbe25('0xd'))(new Redis(config[_0xbe25('0xa')]));require(_0xbe25('0xe'))[_0xbe25('0xf')](socket);function respondWithRpcPromise(_0x53a8f7,_0x314bda,_0x191b63){return new BPromise(function(_0x169644,_0x40e266){return client[_0xbe25('0x10')](_0x53a8f7,_0x191b63)[_0xbe25('0x11')](function(_0x32c082){logger[_0xbe25('0x12')](_0xbe25('0x13'),_0x314bda,'request\x20sent');logger[_0xbe25('0x14')](_0xbe25('0x15'),_0x314bda,'request\x20sent',JSON['stringify'](_0x32c082));if(_0x32c082[_0xbe25('0x16')]){if(_0x32c082[_0xbe25('0x16')]['code']===0x1f4){logger[_0xbe25('0x16')](_0xbe25('0x13'),_0x314bda,_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);return _0x40e266(_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);}logger['error'](_0xbe25('0x13'),_0x314bda,_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);return _0x169644(_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);}else{logger[_0xbe25('0x12')](_0xbe25('0x13'),_0x314bda,_0xbe25('0x18'));_0x169644(_0x32c082['result'][_0xbe25('0x17')]);}})[_0xbe25('0x19')](function(_0x10fd47){logger[_0xbe25('0x16')](_0xbe25('0x13'),_0x314bda,_0x10fd47);_0x40e266(_0x10fd47);});});}exports[_0xbe25('0x1a')]=function(_0x100509){var _0x3ad300=this;return new Promise(function(_0x309c7e,_0x1990aa){return db['SmsInteraction'][_0xbe25('0x1b')](_0x100509['body'],{'raw':_0x100509['options']?_0x100509['options'][_0xbe25('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100509[_0xbe25('0x1d')]?_0x100509[_0xbe25('0x1d')][_0xbe25('0x1e')]||null:null,'attributes':_0x100509['options']?_0x100509[_0xbe25('0x1d')]['attributes']||null:null,'limit':_0x100509[_0xbe25('0x1d')]?_0x100509[_0xbe25('0x1d')][_0xbe25('0x1f')]||null:null})[_0xbe25('0x11')](function(_0x2252ff){logger[_0xbe25('0x12')](_0xbe25('0x1a'),_0x100509);logger[_0xbe25('0x14')](_0xbe25('0x1a'),_0x100509,JSON[_0xbe25('0x20')](_0x2252ff));_0x309c7e(_0x2252ff);})[_0xbe25('0x19')](function(_0x534f6f){logger[_0xbe25('0x16')](_0xbe25('0x1a'),_0x534f6f[_0xbe25('0x17')],_0x100509);_0x1990aa(_0x3ad300[_0xbe25('0x16')](0x1f4,_0x534f6f[_0xbe25('0x17')]));});});};exports[_0xbe25('0x21')]=function(_0x14a642){return new Promise(function(_0x1ecc53,_0x4f1531){return db[_0xbe25('0x22')][_0xbe25('0x23')]({'where':_0x14a642[_0xbe25('0x1d')]?_0x14a642[_0xbe25('0x1d')][_0xbe25('0x1e')]||null:null})[_0xbe25('0x11')](function(_0x69bf91){if(_0x69bf91){return _0x69bf91[_0xbe25('0x24')](_0x14a642[_0xbe25('0x25')]['ids'],_[_0xbe25('0x26')](_0x14a642[_0xbe25('0x25')],['ids','id'])||{});}})[_0xbe25('0x27')](function(_0x4198c3){logger[_0xbe25('0x12')](_0xbe25('0x28'),_0x14a642);logger[_0xbe25('0x14')](_0xbe25('0x28'),_0x14a642,JSON[_0xbe25('0x20')](_0x4198c3));_0x1ecc53(_0x4198c3);})['catch'](function(_0x22baf5){logger[_0xbe25('0x16')](_0xbe25('0x28'),_0x22baf5['message'],_0x14a642);_0x4f1531(_this[_0xbe25('0x16')](0x1f4,_0x22baf5[_0xbe25('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0336ec6..5696c14 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 _0x9cab=['removeListener','./smsInteraction.events','save','emit'];(function(_0x3450c0,_0xf186f9){var _0x38b0a9=function(_0x87f6bc){while(--_0x87f6bc){_0x3450c0['push'](_0x3450c0['shift']());}};_0x38b0a9(++_0xf186f9);}(_0x9cab,0x125));var _0xb9ca=function(_0x50a559,_0x5e0fee){_0x50a559=_0x50a559-0x0;var _0x1ce316=_0x9cab[_0x50a559];return _0x1ce316;};'use strict';var SmsInteractionEvents=require(_0xb9ca('0x0'));var events=[_0xb9ca('0x1'),'remove','update'];function createListener(_0x1e3dcc,_0x3c94cb){return function(_0x1c7774){_0x3c94cb[_0xb9ca('0x2')](_0x1e3dcc,_0x1c7774);};}function removeListener(_0x518f08,_0x5651cf){return function(){SmsInteractionEvents[_0xb9ca('0x3')](_0x518f08,_0x5651cf);};}exports['register']=function(_0xbe07c5){for(var _0x6a5069=0x0,_0x50586e=events['length'];_0x6a5069<_0x50586e;_0x6a5069++){var _0x1ed22e=events[_0x6a5069];var _0x4133b2=createListener('smsInteraction:'+_0x1ed22e,_0xbe07c5);SmsInteractionEvents['on'](_0x1ed22e,_0x4133b2);}}; \ No newline at end of file +var _0xfc54=['save','remove','update','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfc54,0x7f));var _0x4fc5=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0xfc54[_0x46c9a5];return _0x5e3eec;};'use strict';var SmsInteractionEvents=require(_0x4fc5('0x0'));var events=[_0x4fc5('0x1'),_0x4fc5('0x2'),_0x4fc5('0x3')];function createListener(_0x36ea5d,_0x54f4dd){return function(_0x50bdcc){_0x54f4dd[_0x4fc5('0x4')](_0x36ea5d,_0x50bdcc);};}function removeListener(_0x1a20ee,_0x1848e0){return function(){SmsInteractionEvents['removeListener'](_0x1a20ee,_0x1848e0);};}exports[_0x4fc5('0x5')]=function(_0x4e4c07){for(var _0x56f906=0x0,_0x562280=events[_0x4fc5('0x6')];_0x56f906<_0x562280;_0x56f906++){var _0x4e84d3=events[_0x56f906];var _0x2d383b=createListener(_0x4fc5('0x7')+_0x4e84d3,_0x4e4c07);SmsInteractionEvents['on'](_0x4e84d3,_0x2d383b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 7c0c28b..ad30d31 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 _0xd758=['update','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put'];(function(_0xf95dce,_0x4d6320){var _0xe38ceb=function(_0x4b248d){while(--_0x4b248d){_0xf95dce['push'](_0xf95dce['shift']());}};_0xe38ceb(++_0x4d6320);}(_0xd758,0x172));var _0x8d75=function(_0x772a23,_0x133c5d){_0x772a23=_0x772a23-0x0;var _0xf4ff3a=_0xd758[_0x772a23];return _0xf4ff3a;};'use strict';var multer=require(_0x8d75('0x0'));var util=require(_0x8d75('0x1'));var path=require(_0x8d75('0x2'));var timeout=require(_0x8d75('0x3'));var express=require(_0x8d75('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d75('0x5'));var interaction=require(_0x8d75('0x6'));var config=require(_0x8d75('0x7'));var controller=require('./smsMessage.controller');router[_0x8d75('0x8')]('/',auth[_0x8d75('0x9')](),controller[_0x8d75('0xa')]);router[_0x8d75('0x8')](_0x8d75('0xb'),auth[_0x8d75('0x9')](),controller[_0x8d75('0xc')]);router['get'](_0x8d75('0xd'),auth[_0x8d75('0x9')](),controller[_0x8d75('0xe')]);router[_0x8d75('0xf')]('/',auth[_0x8d75('0x9')](),interaction[_0x8d75('0x10')]('sms',_0x8d75('0x11')),controller[_0x8d75('0x12')]);router[_0x8d75('0xf')](_0x8d75('0x13'),controller[_0x8d75('0x14')]);router[_0x8d75('0x15')](_0x8d75('0xd'),auth[_0x8d75('0x9')](),controller[_0x8d75('0x16')]);router[_0x8d75('0x15')]('/:id/accept',auth[_0x8d75('0x9')](),controller[_0x8d75('0x17')]);router[_0x8d75('0x15')](_0x8d75('0x18'),auth[_0x8d75('0x9')](),controller['reject']);router[_0x8d75('0x19')]('/:id',auth[_0x8d75('0x9')](),controller[_0x8d75('0x1a')]);module[_0x8d75('0x1b')]=router; \ No newline at end of file +var _0xe084=['../../config/environment','./smsMessage.controller','isAuthenticated','get','/describe','describe','show','post','smsmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept','accept','reject','delete','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x4d3846,_0x19e479){var _0x2f8652=function(_0x59dd43){while(--_0x59dd43){_0x4d3846['push'](_0x4d3846['shift']());}};_0x2f8652(++_0x19e479);}(_0xe084,0x171));var _0x4e08=function(_0x4f1791,_0x3999c6){_0x4f1791=_0x4f1791-0x0;var _0x7ce3e0=_0xe084[_0x4f1791];return _0x7ce3e0;};'use strict';var multer=require(_0x4e08('0x0'));var util=require(_0x4e08('0x1'));var path=require(_0x4e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e08('0x3'));var router=express['Router']();var fs_extra=require(_0x4e08('0x4'));var auth=require(_0x4e08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e08('0x6'));var controller=require(_0x4e08('0x7'));router['get']('/',auth[_0x4e08('0x8')](),controller['index']);router[_0x4e08('0x9')](_0x4e08('0xa'),auth[_0x4e08('0x8')](),controller[_0x4e08('0xb')]);router[_0x4e08('0x9')]('/:id',auth[_0x4e08('0x8')](),controller[_0x4e08('0xc')]);router[_0x4e08('0xd')]('/',auth[_0x4e08('0x8')](),interaction['tracked']('sms',_0x4e08('0xe')),controller[_0x4e08('0xf')]);router['post'](_0x4e08('0x10'),controller[_0x4e08('0x11')]);router['put'](_0x4e08('0x12'),auth[_0x4e08('0x8')](),controller[_0x4e08('0x13')]);router[_0x4e08('0x14')](_0x4e08('0x15'),auth[_0x4e08('0x8')](),controller[_0x4e08('0x16')]);router[_0x4e08('0x14')]('/:id/reject',auth[_0x4e08('0x8')](),controller[_0x4e08('0x17')]);router[_0x4e08('0x18')]('/:id',auth[_0x4e08('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 82b4212..efb90bd 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 _0x33fd=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x33fd,0x84));var _0xd33f=function(_0x2846fc,_0x51e861){_0x2846fc=_0x2846fc-0x0;var _0x779dd6=_0x33fd[_0x2846fc];return _0x779dd6;};'use strict';var Sequelize=require(_0xd33f('0x0'));module[_0xd33f('0x1')]={'body':{'type':Sequelize[_0xd33f('0x2')](_0xd33f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd33f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd33f('0x5')),'defaultValue':_0xd33f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd33f('0x6')]},'readAt':{'type':Sequelize[_0xd33f('0x7')]},'secret':{'type':Sequelize[_0xd33f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb6a3=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x271caa,_0x485e70){var _0x18a8fa=function(_0x205826){while(--_0x205826){_0x271caa['push'](_0x271caa['shift']());}};_0x18a8fa(++_0x485e70);}(_0xb6a3,0xa6));var _0x3b6a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb6a3[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x3b6a('0x0'));module[_0x3b6a('0x1')]={'body':{'type':Sequelize[_0x3b6a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3b6a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b6a('0x4')]('in',_0x3b6a('0x5')),'defaultValue':_0x3b6a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b6a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3b6a('0x6')]},'readAt':{'type':Sequelize[_0x3b6a('0x7')]},'secret':{'type':Sequelize[_0x3b6a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3b6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 80fb013..495f70f 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 _0x9536=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','type','VIRTUAL','SmsMessage','findAll','rows','show','includeAll','include','find','create','update','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','params','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x1c4c64,_0x28aa4e){var _0x585a24=function(_0x54ec69){while(--_0x54ec69){_0x1c4c64['push'](_0x1c4c64['shift']());}};_0x585a24(++_0x28aa4e);}(_0x9536,0x179));var _0x6953=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x9536[_0x35f7f5];return _0x5567a4;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];config[_0x6953('0x1a')]=_['defaults'](config[_0x6953('0x1a')],{'host':_0x6953('0x1b'),'port':0x18eb});var socket=require(_0x6953('0x1c'))(new Redis(config[_0x6953('0x1a')]));require(_0x6953('0x1d'))[_0x6953('0x1e')](socket);var jayson=require(_0x6953('0x1f'));var client=jayson[_0x6953('0x20')][_0x6953('0x21')]({'port':0x232c});var client9002=jayson[_0x6953('0x20')][_0x6953('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x548473,_0x5f49db,_0x399b9b,_0x44e8a2){return new BPromise(function(_0x16b79b,_0x16251d){var _0x510d46=_0x44e8a2||client;return _0x510d46[_0x6953('0x22')](_0x548473,_0x399b9b)[_0x6953('0x23')](function(_0x4b43ae){logger[_0x6953('0x24')](_0x6953('0x25'),_0x5f49db,_0x6953('0x26'));logger[_0x6953('0x27')](_0x6953('0x28'),_0x5f49db,'request\x20sent',JSON[_0x6953('0x29')](_0x4b43ae));if(_0x4b43ae[_0x6953('0x2a')]){if(_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2b')]===0x1f4){logger[_0x6953('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2c')]);return _0x16251d(_0x4b43ae['error'][_0x6953('0x2c')]);}logger[_0x6953('0x2a')](_0x6953('0x25'),_0x5f49db,_0x4b43ae[_0x6953('0x2a')]['message']);return _0x16b79b(_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2c')]);}else{logger[_0x6953('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,'request\x20sent');_0x16b79b(_0x4b43ae['result'][_0x6953('0x2c')]);}})[_0x6953('0x2d')](function(_0x550be4){logger[_0x6953('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,_0x550be4);_0x16251d(_0x550be4);});});}function respondWithStatusCode(_0x328f67,_0x2bf39b){_0x2bf39b=_0x2bf39b||0xcc;return function(_0xcdbce8){if(_0xcdbce8){return _0x328f67[_0x6953('0x2e')](_0x2bf39b);}return _0x328f67[_0x6953('0x2f')](_0x2bf39b)[_0x6953('0x30')]();};}function respondWithResult(_0x53d3dc,_0x3dd890){_0x3dd890=_0x3dd890||0xc8;return function(_0x3c1075){if(_0x3c1075){return _0x53d3dc['status'](_0x3dd890)[_0x6953('0x31')](_0x3c1075);}};}function respondWithFilteredResult(_0x4af39d,_0x173b3c){return function(_0x3b1175){if(_0x3b1175){var _0x426c7c=typeof _0x173b3c['offset']===_0x6953('0x32')&&typeof _0x173b3c[_0x6953('0x33')]===_0x6953('0x32');var _0x47ed2f=_0x3b1175[_0x6953('0x34')];var _0x132a71=_0x426c7c?0x0:_0x173b3c['offset'];var _0x4d856d=_0x426c7c?_0x3b1175[_0x6953('0x34')]:_0x173b3c[_0x6953('0x35')]+_0x173b3c[_0x6953('0x33')];var _0x2312e7;if(_0x4d856d>=_0x47ed2f){_0x4d856d=_0x47ed2f;_0x2312e7=0xc8;}else{_0x2312e7=0xce;}_0x4af39d[_0x6953('0x2f')](_0x2312e7);return _0x4af39d['set'](_0x6953('0x36'),_0x132a71+'-'+_0x4d856d+'/'+_0x47ed2f)['json'](_0x3b1175);}return null;};}function patchUpdates(_0x2d5e76){return function(_0x2e85c7){try{jsonpatch['apply'](_0x2e85c7,_0x2d5e76,!![]);}catch(_0x4a4d41){return BPromise[_0x6953('0x37')](_0x4a4d41);}return _0x2e85c7[_0x6953('0x38')]();};}function saveUpdates(_0x34d10b,_0x4ffa69){return function(_0x28cb92){if(_0x28cb92){return _0x28cb92['update'](_0x34d10b)['then'](function(_0x5eda70){return _0x5eda70;});}return null;};}function removeEntity(_0x5c4a8a,_0x1ef067){return function(_0x6c7862){if(_0x6c7862){return _0x6c7862[_0x6953('0x39')]()[_0x6953('0x23')](function(){_0x5c4a8a[_0x6953('0x2f')](0xcc)[_0x6953('0x30')]();});}};}function handleEntityNotFound(_0x4f6e06,_0x2b76a5){return function(_0x5a8197){if(!_0x5a8197){_0x4f6e06[_0x6953('0x2e')](0x194);}return _0x5a8197;};}function handleError(_0x5c9a4e,_0xc63da7){_0xc63da7=_0xc63da7||0x1f4;return function(_0x383e31){logger[_0x6953('0x2a')](_0x383e31[_0x6953('0x3a')]);if(_0x383e31['name']){delete _0x383e31[_0x6953('0x3b')];}_0x5c9a4e[_0x6953('0x2f')](_0xc63da7)[_0x6953('0x3c')](_0x383e31);};}exports[_0x6953('0x3d')]=function(_0x40b6ea,_0x475ea8){var _0x37b2b3={},_0x81428b={},_0xdf1944={'count':0x0,'rows':[]};var _0x44f206=_[_0x6953('0x3e')](db['SmsMessage'][_0x6953('0x3f')],function(_0x3c03ab){return{'name':_0x3c03ab[_0x6953('0x40')],'type':_0x3c03ab['type']['key']};});_0x81428b[_0x6953('0x41')]=_['map'](_0x44f206,'name');_0x81428b[_0x6953('0x42')]=_[_0x6953('0x43')](_0x40b6ea['query']);_0x81428b[_0x6953('0x44')]=_[_0x6953('0x45')](_0x81428b[_0x6953('0x41')],_0x81428b[_0x6953('0x42')]);_0x37b2b3[_0x6953('0x46')]=_[_0x6953('0x45')](_0x81428b['model'],qs[_0x6953('0x47')](_0x40b6ea[_0x6953('0x42')][_0x6953('0x47')]));_0x37b2b3[_0x6953('0x46')]=_0x37b2b3[_0x6953('0x46')][_0x6953('0x48')]?_0x37b2b3['attributes']:_0x81428b['model'];if(!_0x40b6ea[_0x6953('0x42')]['hasOwnProperty']('nolimit')){_0x37b2b3[_0x6953('0x33')]=qs[_0x6953('0x33')](_0x40b6ea[_0x6953('0x42')][_0x6953('0x33')]);_0x37b2b3[_0x6953('0x35')]=qs['offset'](_0x40b6ea['query'][_0x6953('0x35')]);}_0x37b2b3[_0x6953('0x49')]=qs['sort'](_0x40b6ea[_0x6953('0x42')]['sort']);_0x37b2b3[_0x6953('0x4a')]=qs[_0x6953('0x44')](_[_0x6953('0x4b')](_0x40b6ea[_0x6953('0x42')],_0x81428b['filters']),_0x44f206);if(_0x40b6ea[_0x6953('0x42')][_0x6953('0x4c')]){_0x37b2b3['where']=_[_0x6953('0x4d')](_0x37b2b3[_0x6953('0x4a')],{'$or':_[_0x6953('0x3e')](_0x44f206,function(_0x228139){if(_0x228139[_0x6953('0x4e')]!==_0x6953('0x4f')){var _0x13d1a6={};_0x13d1a6[_0x228139[_0x6953('0x3b')]]={'$like':'%'+_0x40b6ea[_0x6953('0x42')][_0x6953('0x4c')]+'%'};return _0x13d1a6;}})});}_0x37b2b3=_[_0x6953('0x4d')]({},_0x37b2b3,_0x40b6ea['options']);var _0x332223={'where':_0x37b2b3['where']};return db[_0x6953('0x50')][_0x6953('0x34')](_0x332223)[_0x6953('0x23')](function(_0x4c4954){_0xdf1944[_0x6953('0x34')]=_0x4c4954;if(_0x40b6ea[_0x6953('0x42')]['includeAll']){_0x37b2b3['include']=[{'all':!![]}];}return db[_0x6953('0x50')][_0x6953('0x51')](_0x37b2b3);})[_0x6953('0x23')](function(_0x36d75a){_0xdf1944[_0x6953('0x52')]=_0x36d75a;return _0xdf1944;})[_0x6953('0x23')](respondWithFilteredResult(_0x475ea8,_0x37b2b3))[_0x6953('0x2d')](handleError(_0x475ea8,null));};exports[_0x6953('0x53')]=function(_0x2baf90,_0x18e8ef){var _0x1de9f8={'raw':!![],'where':{'id':_0x2baf90['params']['id']}},_0x493a91={};_0x493a91[_0x6953('0x41')]=_[_0x6953('0x43')](db[_0x6953('0x50')][_0x6953('0x3f')]);_0x493a91[_0x6953('0x42')]=_[_0x6953('0x43')](_0x2baf90[_0x6953('0x42')]);_0x493a91[_0x6953('0x44')]=_[_0x6953('0x45')](_0x493a91['model'],_0x493a91['query']);_0x1de9f8['attributes']=_['intersection'](_0x493a91[_0x6953('0x41')],qs[_0x6953('0x47')](_0x2baf90[_0x6953('0x42')]['fields']));_0x1de9f8['attributes']=_0x1de9f8[_0x6953('0x46')][_0x6953('0x48')]?_0x1de9f8[_0x6953('0x46')]:_0x493a91['model'];if(_0x2baf90['query'][_0x6953('0x54')]){_0x1de9f8[_0x6953('0x55')]=[{'all':!![]}];}_0x1de9f8=_['merge']({},_0x1de9f8,_0x2baf90['options']);return db[_0x6953('0x50')][_0x6953('0x56')](_0x1de9f8)[_0x6953('0x23')](handleEntityNotFound(_0x18e8ef,null))[_0x6953('0x23')](respondWithResult(_0x18e8ef,null))[_0x6953('0x2d')](handleError(_0x18e8ef,null));};exports['create']=function(_0x76c0f4,_0x15ff2d){return db['SmsMessage'][_0x6953('0x57')](_0x76c0f4['body'],{})[_0x6953('0x23')](respondWithResult(_0x15ff2d,0xc9))[_0x6953('0x2d')](handleError(_0x15ff2d,null));};exports[_0x6953('0x58')]=function(_0xceaa28,_0x4f24bf){if(_0xceaa28[_0x6953('0x59')]['id']){delete _0xceaa28[_0x6953('0x59')]['id'];}return db[_0x6953('0x50')]['find']({'where':{'id':_0xceaa28['params']['id']}})[_0x6953('0x23')](handleEntityNotFound(_0x4f24bf,null))[_0x6953('0x23')](saveUpdates(_0xceaa28[_0x6953('0x59')],null))['then'](respondWithResult(_0x4f24bf,null))['catch'](handleError(_0x4f24bf,null));};exports[_0x6953('0x39')]=function(_0x2b90f7,_0x4c0f1c){return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x2b90f7['params']['id']}})[_0x6953('0x23')](handleEntityNotFound(_0x4c0f1c,null))[_0x6953('0x23')](removeEntity(_0x4c0f1c,null))[_0x6953('0x2d')](handleError(_0x4c0f1c,null));};exports[_0x6953('0x5a')]=function(_0x1e4e2c,_0x5e4b89){return db[_0x6953('0x50')][_0x6953('0x5a')]()[_0x6953('0x23')](respondWithResult(_0x5e4b89,null))['catch'](handleError(_0x5e4b89,null));};var interaction_log=require('../../config/logger')(_0x6953('0x5b'));exports[_0x6953('0x5c')]=function(_0x33dbe4,_0x2bd209,_0x2659c3){var _0x4cd3a8={'agent':{},'channel':_0x6953('0x5d')};if(_0x33dbe4[_0x6953('0x59')]['id']){delete _0x33dbe4[_0x6953('0x59')]['id'];}_0x33dbe4[_0x6953('0x59')][_0x6953('0x5e')]=!![];_0x33dbe4[_0x6953('0x59')][_0x6953('0x5f')]=moment()[_0x6953('0x60')](_0x6953('0x61'));_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')]=_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')]||_0x33dbe4['user']['id'];_0x4cd3a8[_0x6953('0x63')]['id']=_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')];return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x33dbe4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2bd209,null))[_0x6953('0x23')](saveUpdates(_0x33dbe4['body'],null))[_0x6953('0x23')](function(_0x2b5de2){if(_0x2b5de2){_0x4cd3a8[_0x6953('0x2c')]=_0x2b5de2[_0x6953('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x6953('0x56')]({'where':{'id':_0x2b5de2[_0x6953('0x65')]}});}return null;})[_0x6953('0x23')](handleEntityNotFound(_0x2bd209,null))[_0x6953('0x23')](function(_0x1c3190){if(_0x1c3190){return _0x1c3190[_0x6953('0x58')]({'UserId':_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')],'read1stAt':_[_0x6953('0x66')](_0x1c3190[_0x6953('0x67')])?moment()[_0x6953('0x60')](_0x6953('0x61')):undefined});}return null;})[_0x6953('0x23')](function(_0x425833){if(_0x425833){_0x4cd3a8[_0x6953('0x68')]=_0x425833['get']({'plain':!![]});interaction_log[_0x6953('0x24')](_0x6953('0x69'),_0x33dbe4[_0x6953('0x6a')]['id'],_0x33dbe4[_0x6953('0x6a')][_0x6953('0x3b')],_0x33dbe4[_0x6953('0x6a')][_0x6953('0x6b')],_0x4cd3a8['interaction']['id'],_0x33dbe4[_0x6953('0x59')]?JSON[_0x6953('0x29')](_0x33dbe4['body']):_0x6953('0x6c'));return respondWithRpcPromise(_0x6953('0x6d'),_0x6953('0x6e'),_0x4cd3a8);}return null;})['then'](function(_0x4cb8a4){var _0x1ea573=_0x6953('0x6f')+_0x4cb8a4[_0x6953('0x2c')][_0x6953('0x70')];return db[_0x6953('0x71')][_0x6953('0x42')](_0x1ea573,{'type':db[_0x6953('0x72')][_0x6953('0x73')][_0x6953('0x74')],'raw':!![]})['then'](function(_0x78eb85){return _0x78eb85;});})[_0x6953('0x23')](function(_0x1b641e){if(_0x1b641e){_0x4cd3a8[_0x6953('0x2c')]['contact']=_0x1b641e[0x0];if(!_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')])return;return db[_0x6953('0x75')]['find']({'where':{'id':_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')],'role':_0x6953('0x63')},'attributes':['id',_0x6953('0x3b'),'fullname',_0x6953('0x76'),_0x6953('0x77')],'raw':!![]});}return null;})[_0x6953('0x23')](function(_0x2dcef9){if(!_0x2dcef9)return null;_0x4cd3a8['message']['agent']=_0x2dcef9;return _0x4cd3a8;})[_0x6953('0x23')](function(_0x2310b2){if(_0x2310b2){if(_0x33dbe4['body']['manual']){_0x4cd3a8[_0x6953('0x2c')][_0x6953('0x78')]=util[_0x6953('0x60')](_0x6953('0x79'),_0x33dbe4['user'][_0x6953('0x3b')]);_0x4cd3a8[_0x6953('0x2c')]['channel']=_0x4cd3a8[_0x6953('0x7a')];_0x4cd3a8[_0x6953('0x2c')]['motionChannel']=_0x4cd3a8['channel'];_0x4cd3a8['message'][_0x6953('0x7b')]=_0x6953('0x5c');return respondWithRpcPromise(_0x6953('0x7c'),_0x6953('0x7c'),{'event':_0x6953('0x7d'),'message':_0x4cd3a8[_0x6953('0x2c')]},client9002)[_0x6953('0x23')](function(){return _0x4cd3a8;});}return _0x4cd3a8;}return null;})[_0x6953('0x23')](respondWithResult(_0x2bd209,null))['catch'](handleError(_0x2bd209,null));};var interaction_log=require(_0x6953('0x15'))(_0x6953('0x5b'));exports[_0x6953('0x37')]=function(_0x35ad50,_0xee6759,_0x43ad3d){var _0x481102={'agent':{},'channel':_0x6953('0x5d')};if(_0x35ad50['body']['id']){delete _0x35ad50[_0x6953('0x59')]['id'];}_0x35ad50['body'][_0x6953('0x62')]=_0x35ad50[_0x6953('0x59')][_0x6953('0x62')]||_0x35ad50['user']['id'];_0x481102[_0x6953('0x63')]['id']=_0x35ad50[_0x6953('0x59')][_0x6953('0x62')];return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x35ad50[_0x6953('0x7e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xee6759,null))[_0x6953('0x23')](function(_0x15794b){if(_0x15794b){_0x481102[_0x6953('0x2c')]=_0x15794b[_0x6953('0x64')]({'plain':!![]});return db[_0x6953('0x7f')][_0x6953('0x56')]({'where':{'id':_0x15794b[_0x6953('0x65')]}});}return null;})[_0x6953('0x23')](handleEntityNotFound(_0xee6759,null))[_0x6953('0x23')](function(_0x216b92){if(_0x216b92){_0x481102[_0x6953('0x68')]=_0x216b92['get']({'plain':!![]});interaction_log[_0x6953('0x24')](_0x6953('0x80'),_0x35ad50[_0x6953('0x6a')]['id'],_0x35ad50[_0x6953('0x6a')][_0x6953('0x3b')],_0x35ad50[_0x6953('0x6a')][_0x6953('0x6b')],_0x481102[_0x6953('0x68')]['id'],_0x35ad50[_0x6953('0x59')]?JSON[_0x6953('0x29')](_0x35ad50[_0x6953('0x59')]):'null');return respondWithRpcPromise(_0x6953('0x81'),_0x6953('0x82'),_0x481102);}return null;})[_0x6953('0x23')](function(_0x5a74ab){var _0x51f1f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a74ab['message'][_0x6953('0x70')];return db[_0x6953('0x71')][_0x6953('0x42')](_0x51f1f5,{'type':db[_0x6953('0x72')][_0x6953('0x73')][_0x6953('0x74')],'raw':!![]})[_0x6953('0x23')](function(_0x5e34b6){return _0x5e34b6;});})[_0x6953('0x23')](function(_0x3113c0){if(_0x3113c0){_0x481102[_0x6953('0x2c')]['contact']=_0x3113c0[0x0];if(!_0x35ad50[_0x6953('0x59')][_0x6953('0x62')])return;return db['User'][_0x6953('0x56')]({'where':{'id':_0x35ad50['body']['UserId'],'role':_0x6953('0x63')},'attributes':['id','name','fullname',_0x6953('0x76'),_0x6953('0x77')],'raw':!![]});}return null;})[_0x6953('0x23')](function(_0x512384){if(!_0x512384)return null;_0x481102[_0x6953('0x2c')][_0x6953('0x63')]=_0x512384;return _0x481102;})['then'](function(_0x30de2c){if(_0x30de2c){_0x30de2c[_0x6953('0x2c')][_0x6953('0x78')]=util[_0x6953('0x60')](_0x6953('0x79'),_0x35ad50[_0x6953('0x6a')][_0x6953('0x3b')]);_0x30de2c[_0x6953('0x2c')][_0x6953('0x7a')]=_0x481102['channel'];_0x30de2c[_0x6953('0x2c')][_0x6953('0x83')]=_0x481102['channel'];_0x30de2c[_0x6953('0x2c')][_0x6953('0x7b')]=_0x6953('0x37');respondWithRpcPromise(_0x6953('0x7c'),_0x6953('0x7c'),{'event':_0x6953('0x84'),'message':_0x30de2c[_0x6953('0x2c')]},client9002);return _0x481102;}return null;})['then'](respondWithResult(_0xee6759,null))[_0x6953('0x2d')](handleError(_0xee6759,null));};exports[_0x6953('0x2f')]=function(_0x1481a1,_0x12e2ec,_0x29e68e){if(_0x1481a1[_0x6953('0x59')]['id']){delete _0x1481a1[_0x6953('0x59')]['id'];}var _0x3444cb;return db[_0x6953('0x50')]['find']({'where':{'id':_0x1481a1[_0x6953('0x7e')]['id']}})['then'](handleEntityNotFound(_0x12e2ec,null))[_0x6953('0x23')](function(_0x4ab5bb){if(_0x4ab5bb){_0x3444cb=_0x4ab5bb;return db[_0x6953('0x85')][_0x6953('0x56')]({'where':{'id':_0x4ab5bb[_0x6953('0x86')]}});}})[_0x6953('0x23')](handleEntityNotFound(_0x12e2ec,null))[_0x6953('0x23')](function(_0x5d56db){if(_0x5d56db){logger[_0x6953('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6953('0x2f'),_0x6953('0x87'),_0x5d56db[_0x6953('0x4e')],util[_0x6953('0x88')](_0x1481a1['body'],{'showHidden':![],'depth':null}));switch(_0x5d56db[_0x6953('0x4e')]){case _0x6953('0x89'):if(_0x1481a1[_0x6953('0x59')][_0x6953('0x8a')]&&_0x1481a1[_0x6953('0x59')][_0x6953('0x8a')]===_0x3444cb[_0x6953('0x8b')]){return _0x3444cb['update']({'read':!![]});}else{logger[_0x6953('0x2a')](_0x6953('0x8c'),_0x6953('0x2f'),_0x6953('0x89'),util[_0x6953('0x88')](_0x1481a1['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1481a1['body'][_0x6953('0x8d')]&&_0x1481a1[_0x6953('0x59')][_0x6953('0x8d')]===_0x3444cb['messageId']&&_[_0x6953('0x8e')](['sent',_0x6953('0x8f')],_0x1481a1[_0x6953('0x59')]['Status'])>=0x0){return _0x3444cb[_0x6953('0x58')]({'read':!![]});}else{logger['error'](_0x6953('0x8c'),'status','plivio',util[_0x6953('0x88')](_0x1481a1[_0x6953('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6953('0x90'):var _0x14ad16=_0x1481a1[_0x6953('0x59')][_0x6953('0x91')][0x0];if(_0x14ad16[_0x6953('0x2f')][_0x6953('0x92')]==='DELIVERED'){return _0x3444cb['update']({'read':!![]});}else{logger['error'](_0x6953('0x8c'),_0x6953('0x2f'),_0x6953('0x90'),util[_0x6953('0x88')](_0x1481a1[_0x6953('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3444cb;}})['then'](respondWithResult(_0x12e2ec,null))[_0x6953('0x2d')](handleError(_0x12e2ec,null));}; \ No newline at end of file +var _0xb8a0=['reject','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','moment','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','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','channel','motionChannel','event'];(function(_0x361755,_0x1bfe73){var _0x53a53d=function(_0x4d5e83){while(--_0x4d5e83){_0x361755['push'](_0x361755['shift']());}};_0x53a53d(++_0x1bfe73);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x14db20,_0x25aa0e){_0x14db20=_0x14db20-0x0;var _0x343157=_0xb8a0[_0x14db20];return _0x343157;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b8a('0x0'));var jsonpatch=require(_0x0b8a('0x1'));var rp=require('request-promise');var moment=require(_0x0b8a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0b8a('0x3'));var csv=require(_0x0b8a('0x4'));var ejs=require(_0x0b8a('0x5'));var fs=require('fs');var fs_extra=require(_0x0b8a('0x6'));var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x4'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var licenseUtil=require(_0x0b8a('0x17'));var db=require('../../mysqldb')['db'];config[_0x0b8a('0x18')]=_[_0x0b8a('0x19')](config[_0x0b8a('0x18')],{'host':_0x0b8a('0x1a'),'port':0x18eb});var socket=require(_0x0b8a('0x1b'))(new Redis(config[_0x0b8a('0x18')]));require(_0x0b8a('0x1c'))[_0x0b8a('0x1d')](socket);var jayson=require(_0x0b8a('0x1e'));var client=jayson['client'][_0x0b8a('0x1f')]({'port':0x232c});var client9002=jayson[_0x0b8a('0x20')][_0x0b8a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x554237,_0x1afb89,_0x2f9867,_0x1c5ac2){return new BPromise(function(_0x5a2623,_0x5c562f){var _0x4b58d7=_0x1c5ac2||client;return _0x4b58d7[_0x0b8a('0x21')](_0x554237,_0x2f9867)['then'](function(_0x1a1d6b){logger[_0x0b8a('0x22')](_0x0b8a('0x23'),_0x1afb89,_0x0b8a('0x24'));logger[_0x0b8a('0x25')](_0x0b8a('0x26'),_0x1afb89,_0x0b8a('0x24'),JSON[_0x0b8a('0x27')](_0x1a1d6b));if(_0x1a1d6b[_0x0b8a('0x28')]){if(_0x1a1d6b[_0x0b8a('0x28')][_0x0b8a('0x29')]===0x1f4){logger['error'](_0x0b8a('0x23'),_0x1afb89,_0x1a1d6b[_0x0b8a('0x28')]['message']);return _0x5c562f(_0x1a1d6b[_0x0b8a('0x28')][_0x0b8a('0x2a')]);}logger[_0x0b8a('0x28')](_0x0b8a('0x23'),_0x1afb89,_0x1a1d6b['error'][_0x0b8a('0x2a')]);return _0x5a2623(_0x1a1d6b['error'][_0x0b8a('0x2a')]);}else{logger[_0x0b8a('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1afb89,_0x0b8a('0x24'));_0x5a2623(_0x1a1d6b[_0x0b8a('0x2b')][_0x0b8a('0x2a')]);}})['catch'](function(_0x65f12b){logger[_0x0b8a('0x28')](_0x0b8a('0x23'),_0x1afb89,_0x65f12b);_0x5c562f(_0x65f12b);});});}function respondWithStatusCode(_0x4af078,_0x37f47b){_0x37f47b=_0x37f47b||0xcc;return function(_0x499db6){if(_0x499db6){return _0x4af078[_0x0b8a('0x2c')](_0x37f47b);}return _0x4af078[_0x0b8a('0x2d')](_0x37f47b)[_0x0b8a('0x2e')]();};}function respondWithResult(_0x292097,_0x32670f){_0x32670f=_0x32670f||0xc8;return function(_0x2fc6a7){if(_0x2fc6a7){return _0x292097[_0x0b8a('0x2d')](_0x32670f)[_0x0b8a('0x2f')](_0x2fc6a7);}};}function respondWithFilteredResult(_0x94f6b4,_0xc94471){return function(_0x1e61f4){if(_0x1e61f4){var _0x20b16d=typeof _0xc94471['offset']===_0x0b8a('0x30')&&typeof _0xc94471[_0x0b8a('0x31')]===_0x0b8a('0x30');var _0x22ef59=_0x1e61f4[_0x0b8a('0x32')];var _0x59f54d=_0x20b16d?0x0:_0xc94471[_0x0b8a('0x33')];var _0x4690b6=_0x20b16d?_0x1e61f4['count']:_0xc94471[_0x0b8a('0x33')]+_0xc94471[_0x0b8a('0x31')];var _0x151a2f;if(_0x4690b6>=_0x22ef59){_0x4690b6=_0x22ef59;_0x151a2f=0xc8;}else{_0x151a2f=0xce;}_0x94f6b4[_0x0b8a('0x2d')](_0x151a2f);return _0x94f6b4[_0x0b8a('0x34')]('Content-Range',_0x59f54d+'-'+_0x4690b6+'/'+_0x22ef59)[_0x0b8a('0x2f')](_0x1e61f4);}return null;};}function patchUpdates(_0x3f4967){return function(_0x1d08e9){try{jsonpatch[_0x0b8a('0x35')](_0x1d08e9,_0x3f4967,!![]);}catch(_0x44d7a1){return BPromise['reject'](_0x44d7a1);}return _0x1d08e9[_0x0b8a('0x36')]();};}function saveUpdates(_0x21cecc,_0x559c13){return function(_0x329c56){if(_0x329c56){return _0x329c56[_0x0b8a('0x37')](_0x21cecc)[_0x0b8a('0x38')](function(_0x2e0582){return _0x2e0582;});}return null;};}function removeEntity(_0x4ccb0c,_0x167b25){return function(_0x23d83a){if(_0x23d83a){return _0x23d83a['destroy']()['then'](function(){_0x4ccb0c[_0x0b8a('0x2d')](0xcc)[_0x0b8a('0x2e')]();});}};}function handleEntityNotFound(_0x102ab8,_0x45f418){return function(_0x5dc373){if(!_0x5dc373){_0x102ab8[_0x0b8a('0x2c')](0x194);}return _0x5dc373;};}function handleError(_0xe94bcc,_0x208a5f){_0x208a5f=_0x208a5f||0x1f4;return function(_0x5b2a9a){logger[_0x0b8a('0x28')](_0x5b2a9a[_0x0b8a('0x39')]);if(_0x5b2a9a[_0x0b8a('0x3a')]){delete _0x5b2a9a[_0x0b8a('0x3a')];}_0xe94bcc[_0x0b8a('0x2d')](_0x208a5f)[_0x0b8a('0x3b')](_0x5b2a9a);};}exports[_0x0b8a('0x3c')]=function(_0x2d01c0,_0x1a189a){var _0x406a1a={},_0x53586f={},_0x37635b={'count':0x0,'rows':[]};var _0x34f6e6=_[_0x0b8a('0x3d')](db[_0x0b8a('0x3e')][_0x0b8a('0x3f')],function(_0xe85b9){return{'name':_0xe85b9[_0x0b8a('0x40')],'type':_0xe85b9[_0x0b8a('0x41')]['key']};});_0x53586f[_0x0b8a('0x42')]=_['map'](_0x34f6e6,_0x0b8a('0x3a'));_0x53586f['query']=_[_0x0b8a('0x43')](_0x2d01c0[_0x0b8a('0x44')]);_0x53586f['filters']=_[_0x0b8a('0x45')](_0x53586f[_0x0b8a('0x42')],_0x53586f['query']);_0x406a1a[_0x0b8a('0x46')]=_[_0x0b8a('0x45')](_0x53586f['model'],qs[_0x0b8a('0x47')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x47')]));_0x406a1a['attributes']=_0x406a1a[_0x0b8a('0x46')][_0x0b8a('0x48')]?_0x406a1a['attributes']:_0x53586f[_0x0b8a('0x42')];if(!_0x2d01c0['query'][_0x0b8a('0x49')]('nolimit')){_0x406a1a[_0x0b8a('0x31')]=qs[_0x0b8a('0x31')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x31')]);_0x406a1a[_0x0b8a('0x33')]=qs[_0x0b8a('0x33')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x33')]);}_0x406a1a[_0x0b8a('0x4a')]=qs['sort'](_0x2d01c0[_0x0b8a('0x44')]['sort']);_0x406a1a['where']=qs['filters'](_['pick'](_0x2d01c0[_0x0b8a('0x44')],_0x53586f[_0x0b8a('0x4b')]),_0x34f6e6);if(_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x4c')]){_0x406a1a[_0x0b8a('0x4d')]=_[_0x0b8a('0x4e')](_0x406a1a['where'],{'$or':_[_0x0b8a('0x3d')](_0x34f6e6,function(_0x500f39){if(_0x500f39[_0x0b8a('0x41')]!=='VIRTUAL'){var _0x3d952={};_0x3d952[_0x500f39[_0x0b8a('0x3a')]]={'$like':'%'+_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x4c')]+'%'};return _0x3d952;}})});}_0x406a1a=_[_0x0b8a('0x4e')]({},_0x406a1a,_0x2d01c0[_0x0b8a('0x4f')]);var _0x4f52d0={'where':_0x406a1a[_0x0b8a('0x4d')]};return db[_0x0b8a('0x3e')][_0x0b8a('0x32')](_0x4f52d0)[_0x0b8a('0x38')](function(_0x224b28){_0x37635b[_0x0b8a('0x32')]=_0x224b28;if(_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x50')]){_0x406a1a[_0x0b8a('0x51')]=[{'all':!![]}];}return db[_0x0b8a('0x3e')][_0x0b8a('0x52')](_0x406a1a);})[_0x0b8a('0x38')](function(_0x53793e){_0x37635b[_0x0b8a('0x53')]=_0x53793e;return _0x37635b;})[_0x0b8a('0x38')](respondWithFilteredResult(_0x1a189a,_0x406a1a))[_0x0b8a('0x54')](handleError(_0x1a189a,null));};exports['show']=function(_0x2f13f5,_0x2afd66){var _0x360c11={'raw':!![],'where':{'id':_0x2f13f5['params']['id']}},_0x50a85c={};_0x50a85c[_0x0b8a('0x42')]=_['keys'](db[_0x0b8a('0x3e')][_0x0b8a('0x3f')]);_0x50a85c[_0x0b8a('0x44')]=_[_0x0b8a('0x43')](_0x2f13f5[_0x0b8a('0x44')]);_0x50a85c[_0x0b8a('0x4b')]=_['intersection'](_0x50a85c['model'],_0x50a85c[_0x0b8a('0x44')]);_0x360c11[_0x0b8a('0x46')]=_[_0x0b8a('0x45')](_0x50a85c[_0x0b8a('0x42')],qs['fields'](_0x2f13f5[_0x0b8a('0x44')][_0x0b8a('0x47')]));_0x360c11[_0x0b8a('0x46')]=_0x360c11[_0x0b8a('0x46')][_0x0b8a('0x48')]?_0x360c11['attributes']:_0x50a85c[_0x0b8a('0x42')];if(_0x2f13f5[_0x0b8a('0x44')][_0x0b8a('0x50')]){_0x360c11[_0x0b8a('0x51')]=[{'all':!![]}];}_0x360c11=_[_0x0b8a('0x4e')]({},_0x360c11,_0x2f13f5[_0x0b8a('0x4f')]);return db[_0x0b8a('0x3e')][_0x0b8a('0x55')](_0x360c11)[_0x0b8a('0x38')](handleEntityNotFound(_0x2afd66,null))[_0x0b8a('0x38')](respondWithResult(_0x2afd66,null))[_0x0b8a('0x54')](handleError(_0x2afd66,null));};exports[_0x0b8a('0x56')]=function(_0x5108b1,_0x24200b){return db[_0x0b8a('0x3e')]['create'](_0x5108b1[_0x0b8a('0x57')],{})[_0x0b8a('0x38')](respondWithResult(_0x24200b,0xc9))[_0x0b8a('0x54')](handleError(_0x24200b,null));};exports['update']=function(_0x5da6d0,_0x22a0cc){if(_0x5da6d0[_0x0b8a('0x57')]['id']){delete _0x5da6d0[_0x0b8a('0x57')]['id'];}return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x5da6d0[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x22a0cc,null))[_0x0b8a('0x38')](saveUpdates(_0x5da6d0[_0x0b8a('0x57')],null))['then'](respondWithResult(_0x22a0cc,null))['catch'](handleError(_0x22a0cc,null));};exports[_0x0b8a('0x59')]=function(_0x3f9f38,_0x588b1c){return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x3f9f38[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x588b1c,null))[_0x0b8a('0x38')](removeEntity(_0x588b1c,null))['catch'](handleError(_0x588b1c,null));};exports[_0x0b8a('0x5a')]=function(_0x173221,_0x4a56cc){return db[_0x0b8a('0x3e')][_0x0b8a('0x5a')]()[_0x0b8a('0x38')](respondWithResult(_0x4a56cc,null))[_0x0b8a('0x54')](handleError(_0x4a56cc,null));};var interaction_log=require('../../config/logger')(_0x0b8a('0x5b'));exports['accept']=function(_0x53144f,_0x144beb,_0x22061c){var _0x1fdc20={'agent':{},'channel':_0x0b8a('0x5c')};if(_0x53144f['body']['id']){delete _0x53144f[_0x0b8a('0x57')]['id'];}_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x5d')]=!![];_0x53144f['body']['readAt']=moment()[_0x0b8a('0x5e')](_0x0b8a('0x5f'));_0x53144f[_0x0b8a('0x57')]['UserId']=_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')]||_0x53144f[_0x0b8a('0x61')]['id'];_0x1fdc20['agent']['id']=_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')];return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x53144f['params']['id'],'UserId':null}})[_0x0b8a('0x38')](handleEntityNotFound(_0x144beb,null))['then'](saveUpdates(_0x53144f[_0x0b8a('0x57')],null))[_0x0b8a('0x38')](function(_0x494208){if(_0x494208){_0x1fdc20[_0x0b8a('0x2a')]=_0x494208[_0x0b8a('0x62')]({'plain':!![]});return db[_0x0b8a('0x63')][_0x0b8a('0x55')]({'where':{'id':_0x494208[_0x0b8a('0x64')]}});}return null;})[_0x0b8a('0x38')](handleEntityNotFound(_0x144beb,null))[_0x0b8a('0x38')](function(_0xaff5){if(_0xaff5){return _0xaff5[_0x0b8a('0x37')]({'UserId':_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')],'read1stAt':_['isNil'](_0xaff5[_0x0b8a('0x65')])?moment()[_0x0b8a('0x5e')](_0x0b8a('0x5f')):undefined});}return null;})[_0x0b8a('0x38')](function(_0x5a2aeb){if(_0x5a2aeb){_0x1fdc20[_0x0b8a('0x66')]=_0x5a2aeb[_0x0b8a('0x62')]({'plain':!![]});interaction_log[_0x0b8a('0x22')](_0x0b8a('0x67'),_0x53144f['user']['id'],_0x53144f[_0x0b8a('0x61')][_0x0b8a('0x3a')],_0x53144f[_0x0b8a('0x61')]['role'],_0x1fdc20[_0x0b8a('0x66')]['id'],_0x53144f['body']?JSON[_0x0b8a('0x27')](_0x53144f[_0x0b8a('0x57')]):_0x0b8a('0x68'));return respondWithRpcPromise('AcceptMessage',_0x0b8a('0x69'),_0x1fdc20);}return null;})[_0x0b8a('0x38')](function(_0x5af193){var _0x2332ec=_0x0b8a('0x6a')+_0x5af193[_0x0b8a('0x2a')][_0x0b8a('0x6b')];return db['sequelize'][_0x0b8a('0x44')](_0x2332ec,{'type':db[_0x0b8a('0x6c')][_0x0b8a('0x6d')][_0x0b8a('0x6e')],'raw':!![]})[_0x0b8a('0x38')](function(_0x127900){return _0x127900;});})['then'](function(_0x5a05ad){if(_0x5a05ad){_0x1fdc20[_0x0b8a('0x2a')][_0x0b8a('0x6f')]=_0x5a05ad[0x0];if(!_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')])return;return db[_0x0b8a('0x70')][_0x0b8a('0x55')]({'where':{'id':_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')],'role':_0x0b8a('0x71')},'attributes':['id',_0x0b8a('0x3a'),_0x0b8a('0x72'),_0x0b8a('0x73'),_0x0b8a('0x74')],'raw':!![]});}return null;})[_0x0b8a('0x38')](function(_0x34b55a){if(!_0x34b55a)return null;_0x1fdc20['message'][_0x0b8a('0x71')]=_0x34b55a;return _0x1fdc20;})['then'](function(_0x2e3764){if(_0x2e3764){if(_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x75')]){_0x1fdc20[_0x0b8a('0x2a')][_0x0b8a('0x76')]=util[_0x0b8a('0x5e')](_0x0b8a('0x77'),_0x53144f[_0x0b8a('0x61')][_0x0b8a('0x3a')]);_0x1fdc20[_0x0b8a('0x2a')]['channel']=_0x1fdc20['channel'];_0x1fdc20[_0x0b8a('0x2a')]['motionChannel']=_0x1fdc20['channel'];_0x1fdc20[_0x0b8a('0x2a')]['event']=_0x0b8a('0x78');return respondWithRpcPromise('EventManager',_0x0b8a('0x79'),{'event':_0x0b8a('0x7a'),'message':_0x1fdc20[_0x0b8a('0x2a')]},client9002)[_0x0b8a('0x38')](function(){return _0x1fdc20;});}return _0x1fdc20;}return null;})[_0x0b8a('0x38')](respondWithResult(_0x144beb,null))[_0x0b8a('0x54')](handleError(_0x144beb,null));};var interaction_log=require(_0x0b8a('0x13'))('sms-interactions');exports['reject']=function(_0x1c481d,_0x5b6735,_0x1c5a54){var _0x22bd0f={'agent':{},'channel':_0x0b8a('0x5c')};if(_0x1c481d[_0x0b8a('0x57')]['id']){delete _0x1c481d[_0x0b8a('0x57')]['id'];}_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')]=_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')]||_0x1c481d[_0x0b8a('0x61')]['id'];_0x22bd0f[_0x0b8a('0x71')]['id']=_0x1c481d['body'][_0x0b8a('0x60')];return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x1c481d[_0x0b8a('0x58')]['id'],'UserId':null}})[_0x0b8a('0x38')](handleEntityNotFound(_0x5b6735,null))[_0x0b8a('0x38')](function(_0x3652a5){if(_0x3652a5){_0x22bd0f[_0x0b8a('0x2a')]=_0x3652a5[_0x0b8a('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3652a5['SmsInteractionId']}});}return null;})[_0x0b8a('0x38')](handleEntityNotFound(_0x5b6735,null))[_0x0b8a('0x38')](function(_0x459931){if(_0x459931){_0x22bd0f[_0x0b8a('0x66')]=_0x459931[_0x0b8a('0x62')]({'plain':!![]});interaction_log[_0x0b8a('0x22')](_0x0b8a('0x7b'),_0x1c481d['user']['id'],_0x1c481d['user'][_0x0b8a('0x3a')],_0x1c481d[_0x0b8a('0x61')][_0x0b8a('0x7c')],_0x22bd0f[_0x0b8a('0x66')]['id'],_0x1c481d[_0x0b8a('0x57')]?JSON[_0x0b8a('0x27')](_0x1c481d[_0x0b8a('0x57')]):_0x0b8a('0x68'));return respondWithRpcPromise(_0x0b8a('0x7d'),_0x0b8a('0x7e'),_0x22bd0f);}return null;})['then'](function(_0x103aad){var _0x3cdc30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x103aad[_0x0b8a('0x2a')][_0x0b8a('0x6b')];return db[_0x0b8a('0x7f')][_0x0b8a('0x44')](_0x3cdc30,{'type':db[_0x0b8a('0x6c')]['QueryTypes'][_0x0b8a('0x6e')],'raw':!![]})[_0x0b8a('0x38')](function(_0x4e45d7){return _0x4e45d7;});})[_0x0b8a('0x38')](function(_0x2707c3){if(_0x2707c3){_0x22bd0f[_0x0b8a('0x2a')]['contact']=_0x2707c3[0x0];if(!_0x1c481d['body'][_0x0b8a('0x60')])return;return db[_0x0b8a('0x70')][_0x0b8a('0x55')]({'where':{'id':_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')],'role':_0x0b8a('0x71')},'attributes':['id',_0x0b8a('0x3a'),_0x0b8a('0x72'),_0x0b8a('0x73'),_0x0b8a('0x74')],'raw':!![]});}return null;})[_0x0b8a('0x38')](function(_0x2dcc18){if(!_0x2dcc18)return null;_0x22bd0f[_0x0b8a('0x2a')]['agent']=_0x2dcc18;return _0x22bd0f;})[_0x0b8a('0x38')](function(_0x32bc3f){if(_0x32bc3f){_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x76')]=util['format'](_0x0b8a('0x77'),_0x1c481d['user'][_0x0b8a('0x3a')]);_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x80')]=_0x22bd0f[_0x0b8a('0x80')];_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x81')]=_0x22bd0f[_0x0b8a('0x80')];_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x82')]=_0x0b8a('0x83');respondWithRpcPromise(_0x0b8a('0x79'),_0x0b8a('0x79'),{'event':_0x0b8a('0x84'),'message':_0x32bc3f[_0x0b8a('0x2a')]},client9002);return _0x22bd0f;}return null;})['then'](respondWithResult(_0x5b6735,null))[_0x0b8a('0x54')](handleError(_0x5b6735,null));};exports[_0x0b8a('0x2d')]=function(_0x1e501f,_0x1b287c,_0x5eb97e){if(_0x1e501f[_0x0b8a('0x57')]['id']){delete _0x1e501f[_0x0b8a('0x57')]['id'];}var _0x147c14;return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x1e501f[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x1b287c,null))[_0x0b8a('0x38')](function(_0x22a785){if(_0x22a785){_0x147c14=_0x22a785;return db[_0x0b8a('0x85')][_0x0b8a('0x55')]({'where':{'id':_0x22a785[_0x0b8a('0x86')]}});}})[_0x0b8a('0x38')](handleEntityNotFound(_0x1b287c,null))[_0x0b8a('0x38')](function(_0xb9769a){if(_0xb9769a){logger[_0x0b8a('0x25')](_0x0b8a('0x26'),_0x0b8a('0x2d'),_0x0b8a('0x87'),_0xb9769a[_0x0b8a('0x41')],util['inspect'](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));switch(_0xb9769a[_0x0b8a('0x41')]){case _0x0b8a('0x88'):if(_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x89')]&&_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x89')]===_0x147c14['messageId']){return _0x147c14['update']({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x88'),util[_0x0b8a('0x8b')](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x0b8a('0x8c'):if(_0x1e501f['body'][_0x0b8a('0x8d')]&&_0x1e501f['body']['MessageUUID']===_0x147c14[_0x0b8a('0x8e')]&&_[_0x0b8a('0x8f')](['sent','delivered'],_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x90')])>=0x0){return _0x147c14[_0x0b8a('0x37')]({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x91'),util['inspect'](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x0b8a('0x92'):var _0x1a66c8=_0x1e501f['body'][_0x0b8a('0x93')][0x0];if(_0x1a66c8[_0x0b8a('0x2d')][_0x0b8a('0x94')]===_0x0b8a('0x95')){return _0x147c14[_0x0b8a('0x37')]({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x92'),util[_0x0b8a('0x8b')](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x147c14;}})[_0x0b8a('0x38')](respondWithResult(_0x1b287c,null))[_0x0b8a('0x54')](handleError(_0x1b287c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 05f0441..7079798 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 _0xac65=['update','remove','emit','hook','exports','events','setMaxListeners','save'];(function(_0x1a1d78,_0x445d42){var _0x32aa61=function(_0x1b1901){while(--_0x1b1901){_0x1a1d78['push'](_0x1a1d78['shift']());}};_0x32aa61(++_0x445d42);}(_0xac65,0x155));var _0x5ac6=function(_0x1fc750,_0x93db74){_0x1fc750=_0x1fc750-0x0;var _0x318f3d=_0xac65[_0x1fc750];return _0x318f3d;};'use strict';var EventEmitter=require(_0x5ac6('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5ac6('0x1')](0x0);var events={'afterCreate':_0x5ac6('0x2'),'afterUpdate':_0x5ac6('0x3'),'afterDestroy':_0x5ac6('0x4')};function emitEvent(_0x38c588){return function(_0x159e87,_0x2bd53c,_0x4cdce8){SmsMessageEvents[_0x5ac6('0x5')](_0x38c588+':'+_0x159e87['id'],_0x159e87);SmsMessageEvents[_0x5ac6('0x5')](_0x38c588,_0x159e87);_0x4cdce8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x5ac6('0x6')](e,emitEvent(event));}}module[_0x5ac6('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xd23e=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x43356f,_0x44b293){var _0x3f5546=function(_0x479658){while(--_0x479658){_0x43356f['push'](_0x43356f['shift']());}};_0x3f5546(++_0x44b293);}(_0xd23e,0x181));var _0xed23=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xd23e[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0xed23('0x0'));var SmsMessage=require(_0xed23('0x1'))['db'][_0xed23('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xed23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2702e1){return function(_0x298564,_0x20105d,_0x28b344){SmsMessageEvents['emit'](_0x2702e1+':'+_0x298564['id'],_0x298564);SmsMessageEvents[_0xed23('0x5')](_0x2702e1,_0x298564);_0x28b344(null);};}for(var e in events){if(events[_0xed23('0x6')](e)){var event=events[e];SmsMessage[_0xed23('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e3600d8..321580e 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 _0x6e57=['username','password','smsMethod','sender','POST','user_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','Missing\x20parameters:\x20authToken','format','%s:%s','Basic\x20%s','toString','http_code','data','message_id','clickSend','plivo','authId','/status?token=','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','IBSSO\x20','csc','crypto','login','text','keys','sort','apiKey','createHash','digest','hex','GET','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','uuid','messages','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','Bearer\x20','application/json','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','/api/sms/messages/','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/'];(function(_0x5f0f7a,_0x439f9f){var _0x8db07e=function(_0x12d25e){while(--_0x12d25e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8db07e(++_0x439f9f);}(_0x6e57,0x198));var _0x76e5=function(_0x275117,_0x483046){_0x275117=_0x275117-0x0;var _0x12e760=_0x6e57[_0x275117];return _0x12e760;};'use strict';var _=require(_0x76e5('0x0'));var util=require(_0x76e5('0x1'));var logger=require('../../config/logger')(_0x76e5('0x2'));var moment=require(_0x76e5('0x3'));var BPromise=require(_0x76e5('0x4'));var rp=require(_0x76e5('0x5'));var fs=require('fs');var path=require(_0x76e5('0x6'));var rimraf=require(_0x76e5('0x7'));var config=require(_0x76e5('0x8'));var attributes=require(_0x76e5('0x9'));module[_0x76e5('0xa')]=function(_0x3ce57a,_0x43eb78){return _0x3ce57a[_0x76e5('0xb')](_0x76e5('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x76e5('0xd'),'fields':[_0x76e5('0xd')]},{'name':_0x76e5('0xe'),'fields':[_0x76e5('0xf')],'type':_0x76e5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13aedc,_0x442504,_0x3a58b3){var _0x5bc5df=_0x3ce57a[_0x76e5('0x11')];var _0x2fa8d9=_0x13aedc[_0x76e5('0x12')]({'plain':!![]});if(_0x2fa8d9[_0x76e5('0x13')]['toLowerCase']()==='in'||_0x2fa8d9[_0x76e5('0x13')]['toLowerCase']()===_0x76e5('0x14')&&!_0x2fa8d9[_0x76e5('0x15')]&&!_['isNil'](_0x2fa8d9[_0x76e5('0x16')])&&!_[_0x76e5('0x17')](_0x2fa8d9[_0x76e5('0x18')])){_0x5bc5df[_0x76e5('0x19')][_0x76e5('0x1a')]({'where':{'id':_0x2fa8d9[_0x76e5('0x18')]}})[_0x76e5('0x1b')](function(_0x2db00e){if(_0x2db00e){_0x2db00e[_0x76e5('0x1c')]({'lastMsgAt':_0x2fa8d9['createdAt'],'lastMsgDirection':_0x2fa8d9['direction']['toLowerCase']()});}})['catch'](function(_0x1762cd){console[_0x76e5('0x1d')](_0x1762cd);});}if(_0x2fa8d9[_0x76e5('0x13')]===_0x76e5('0x14')&&!_0x2fa8d9[_0x76e5('0x15')]){var _0x4abe62;_0x5bc5df[_0x76e5('0x1e')][_0x76e5('0x1f')]({'where':{'id':_0x2fa8d9[_0x76e5('0x20')]},'raw':!![]})['then'](function(_0x4b85ed){_0x4abe62=_0x4b85ed;if(_0x4abe62&&_0x4abe62[_0x76e5('0x21')]){switch(_0x4abe62[_0x76e5('0x21')]){case _0x76e5('0x22'):var _0xad0bd7=require(_0x76e5('0x22'));if(_0x4abe62[_0x76e5('0x23')]&&_0x4abe62['authToken']&&_0x4abe62[_0x76e5('0x24')]){var _0x5b60f3=new _0xad0bd7(_0x4abe62['accountSid'],_0x4abe62['authToken']);_0x5b60f3['messages']['create']({'body':_0x2fa8d9[_0x76e5('0xf')],'to':_0x2fa8d9['phone'],'from':_0x4abe62['phone'],'statusCallback':_0x4abe62['remote']+_0x76e5('0x25')+_0x2fa8d9['id']+'/status?token='+_0x4abe62['token']})[_0x76e5('0x1b')](function(_0x204198){if(_0x204198[_0x76e5('0x26')]){return _0x13aedc[_0x76e5('0x1c')]({'messageId':_0x204198[_0x76e5('0x26')]});}})[_0x76e5('0x27')](function(_0x5ca3b1){logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x22'),util['inspect'](_0x5ca3b1,{'showHidden':![],'depth':null}));});}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x76e5('0x2a'):var _0x48d18f=_0x76e5('0x2b');if(_0x4abe62[_0x76e5('0x2c')]&&_0x4abe62[_0x76e5('0x2d')]){var _0x2d4cc2={'recipient':[_0x2fa8d9[_0x76e5('0x24')]],'message':_0x2fa8d9[_0x76e5('0xf')],'message_type':_0x4abe62[_0x76e5('0x2e')]};if(_0x4abe62[_0x76e5('0x2e')]&&_0x4abe62[_0x76e5('0x2e')]!=='SI'){_0x2d4cc2[_0x76e5('0x2f')]=_0x4abe62['phone'];}var _0x1b52f5={'url':_0x48d18f+'login?username='+_0x4abe62[_0x76e5('0x2c')]+'&password='+_0x4abe62[_0x76e5('0x2d')],'method':'GET'};rp(_0x1b52f5)[_0x76e5('0x1b')](function(_0x146ee7){var _0x3e3625=_0x146ee7['split'](';');var _0xdacc40={'user_key':_0x3e3625[0x0],'session_key':_0x3e3625[0x1]};_0x1b52f5={'url':_0x48d18f+'sms','method':_0x76e5('0x30'),'headers':{'user_key':_0xdacc40[_0x76e5('0x31')],'Session_key':_0xdacc40['session_key']},'json':!![],'body':_0x2d4cc2};return rp(_0x1b52f5);})[_0x76e5('0x1b')](function(_0x21ab15){if(_0x21ab15[_0x76e5('0x32')]>=0x1){var _0x48669f={'messageId':_0x21ab15[_0x76e5('0x33')]};if(_0x4abe62['smsMethod']!=='GP'||!_0x4abe62[_0x76e5('0x34')]){_0x48669f[_0x76e5('0x35')]=!![];}return _0x13aedc[_0x76e5('0x1c')](_0x48669f);}else{return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x2a'),util[_0x76e5('0x36')](_0x21ab15,{'showHidden':![],'depth':null}));}})[_0x76e5('0x27')](function(_0x5b025c){return logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x2a'),util['inspect'](_0x5b025c,{'showHidden':![],'depth':null}));});}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x2a'),_0x76e5('0x37'));}break;case _0x76e5('0x38'):if(_0x4abe62[_0x76e5('0x39')]){var _0x19a260={'recipient':_0x2fa8d9[_0x76e5('0x24')],'message':_0x2fa8d9[_0x76e5('0xf')],'sender':_0x4abe62[_0x76e5('0x3a')]||_0x4abe62[_0x76e5('0x24')],'authorization':_0x4abe62[_0x76e5('0x39')]};var _0x442504={'method':_0x76e5('0x30'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x19a260,'json':!![]};rp(_0x442504)[_0x76e5('0x1b')](function(_0x46f070){var _0x356ade={'messageId':_0x46f070['requestid']};if(!_0x4abe62[_0x76e5('0x34')]){_0x356ade[_0x76e5('0x35')]=!![];}return _0x13aedc[_0x76e5('0x1c')](_0x356ade);})[_0x76e5('0x27')](function(_0x23c6a0){logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x38'),util[_0x76e5('0x36')](_0x23c6a0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x76e5('0x38'),_0x76e5('0x3b'));}break;case'clicksend':if(_0x4abe62[_0x76e5('0x2c')]&&_0x4abe62[_0x76e5('0x2d')]){var _0x19a260={'messages':[{'source':'xCALLY\x20Motion','to':_0x2fa8d9['phone'],'body':_0x2fa8d9['body'],'from':_0x4abe62[_0x76e5('0x3a')]||_0x4abe62['phone']}]};var _0x579b43=util[_0x76e5('0x3c')](_0x76e5('0x3d'),_0x4abe62[_0x76e5('0x2c')],_0x4abe62['password']);var _0x442504={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x19a260,'headers':{'Authorization':util[_0x76e5('0x3c')](_0x76e5('0x3e'),new Buffer(_0x579b43)[_0x76e5('0x3f')]('base64'))},'json':!![]};rp(_0x442504)['then'](function(_0x3f0141){if(_0x3f0141[_0x76e5('0x40')]>=0xc8&&_0x3f0141['http_code']<=0xce){if(_0x3f0141[_0x76e5('0x41')]&&_0x3f0141[_0x76e5('0x41')]['queued_count']>0x0){var _0x413013=_['head'](_0x3f0141[_0x76e5('0x41')]['messages']);var _0xe8c308={'messageId':_0x413013[_0x76e5('0x42')]};if(!_0x4abe62[_0x76e5('0x34')]){_0xe8c308[_0x76e5('0x35')]=!![];}return _0x13aedc[_0x76e5('0x1c')](_0xe8c308);}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate','clickSend',util[_0x76e5('0x36')](_0x3f0141,{'showHidden':![],'depth':null}));}}else{logger[_0x76e5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76e5('0x29'),_0x76e5('0x43'),util[_0x76e5('0x36')](_0x3f0141,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2cb5fa){logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x43'),util[_0x76e5('0x36')](_0x2cb5fa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x76e5('0x28'),'afterCreate',_0x76e5('0x43'),_0x76e5('0x37'));}break;case _0x76e5('0x44'):if(_0x4abe62[_0x76e5('0x45')]&&_0x4abe62[_0x76e5('0x39')]){var _0x19a260={'dst':_0x2fa8d9[_0x76e5('0x24')],'text':_0x2fa8d9[_0x76e5('0xf')],'src':_0x4abe62['senderString']||_0x4abe62['phone'],'url':_0x4abe62['remote']+'/api/sms/messages/'+_0x2fa8d9['id']+_0x76e5('0x46')+_0x4abe62[_0x76e5('0x47')]};var _0x579b43=util[_0x76e5('0x3c')]('%s:%s',_0x4abe62[_0x76e5('0x45')],_0x4abe62[_0x76e5('0x39')]);var _0x442504={'method':'POST','uri':util['format'](_0x76e5('0x48'),_0x4abe62[_0x76e5('0x45')]),'body':_0x19a260,'headers':{'Authorization':util[_0x76e5('0x3c')](_0x76e5('0x3e'),new Buffer(_0x579b43)[_0x76e5('0x3f')](_0x76e5('0x49')))},'json':!![]};rp(_0x442504)['then'](function(_0x2557cb){var _0x250562={'messageId':_0x2557cb[_0x76e5('0x4a')][0x0]};return _0x13aedc['update'](_0x250562);})['catch'](function(_0x17e6f0){logger[_0x76e5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x76e5('0x44'),util[_0x76e5('0x36')](_0x17e6f0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x76e5('0x28'),'afterCreate','plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x76e5('0x4b'):if(_0x4abe62[_0x76e5('0x2c')]&&_0x4abe62[_0x76e5('0x2d')]){if(_0x4abe62[_0x76e5('0x4c')]){var _0x6e7b52={'method':'POST','uri':_0x4abe62[_0x76e5('0x4c')]+_0x76e5('0x4d'),'body':{'username':_0x4abe62[_0x76e5('0x2c')],'password':_0x4abe62[_0x76e5('0x2d')]},'json':!![]};return rp(_0x6e7b52)[_0x76e5('0x1b')](function(_0x450644){var _0x217e9e={'method':_0x76e5('0x30'),'uri':_0x4abe62[_0x76e5('0x4c')]+_0x76e5('0x4e'),'body':{'messages':[{'from':_0x4abe62[_0x76e5('0x24')],'destinations':[{'to':_0x2fa8d9[_0x76e5('0x24')]}],'text':_0x2fa8d9[_0x76e5('0xf')],'notifyUrl':_0x4abe62[_0x76e5('0x4f')]+_0x76e5('0x25')+_0x2fa8d9['id']+_0x76e5('0x46')+_0x4abe62[_0x76e5('0x47')],'notifyContentType':'application/json','callbackData':_0x4abe62[_0x76e5('0x24')]+';'+_0x2fa8d9[_0x76e5('0xf')]}]},'headers':{'Authorization':_0x76e5('0x50')+_0x450644[_0x76e5('0x47')]},'json':!![]};return rp(_0x217e9e)[_0x76e5('0x1b')](function(_0x13546b){if(_0x13546b['messages']){var _0x1f43cf={'messageId':_0x13546b['messages'][0x0][_0x76e5('0xd')]};if(!_0x4abe62[_0x76e5('0x34')]){_0x1f43cf[_0x76e5('0x35')]=!![];}return _0x13aedc[_0x76e5('0x1c')](_0x1f43cf);}else{return logger[_0x76e5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x76e5('0x29'),_0x76e5('0x4b'),util[_0x76e5('0x36')](_0x13546b,{'showHidden':![],'depth':null}));}});})[_0x76e5('0x27')](function(_0x454428){return logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x4b'),util[_0x76e5('0x36')](_0x454428,{'showHidden':![],'depth':null}));});}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x4b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x4b'),_0x76e5('0x37'));}break;case _0x76e5('0x51'):var _0x292bc1=require(_0x76e5('0x52'));if(_0x4abe62['apiKey']){var _0x5e2c15={};_0x5e2c15[_0x76e5('0x53')]=_0x4abe62[_0x76e5('0x2c')];_0x5e2c15['phone']=_0x2fa8d9[_0x76e5('0x24')];_0x5e2c15['sender']=_0x4abe62[_0x76e5('0x24')];_0x5e2c15[_0x76e5('0x54')]=_0x2fa8d9[_0x76e5('0xf')];_0x5e2c15['timestamp']=+new Date();var _0x70857f='';var _0x11f7cf='';var _0xe47f25=Object[_0x76e5('0x55')](_0x5e2c15);_0xe47f25[_0x76e5('0x56')]();for(var _0x775ee8=0x0;_0x775ee8<_0xe47f25['length'];_0x775ee8++){if(_0x70857f!=''){_0x70857f+='&';}_0x70857f+=_0xe47f25[_0x775ee8]+'='+encodeURIComponent(_0x5e2c15[_0xe47f25[_0x775ee8]]);_0x11f7cf+=_0x5e2c15[_0xe47f25[_0x775ee8]];}_0x11f7cf+=_0x4abe62[_0x76e5('0x57')];_0x11f7cf=_0x292bc1[_0x76e5('0x58')]('md5')[_0x76e5('0x1c')](_0x11f7cf)[_0x76e5('0x59')](_0x76e5('0x5a'));if(_0x70857f!==''){_0x70857f+='&';}_0x70857f+='signature='+_0x11f7cf;var _0x1b52f5={'method':_0x76e5('0x5b'),'uri':_0x4abe62[_0x76e5('0x4c')]+_0x76e5('0x5c')+_0x70857f,'json':!![]};return rp(_0x1b52f5)[_0x76e5('0x1b')](function(_0x2db805){var _0x14d5ab=Object[_0x76e5('0x55')](_0x2db805);if(_0x2db805[_0x14d5ab[0x0]][_0x76e5('0x1d')]&&parseInt(_0x2db805[_0x14d5ab[0x0]][_0x76e5('0x1d')])===0x0){var _0x224060={'messageId':_0x2db805[_0x14d5ab[0x0]][_0x76e5('0x5d')]};if(!_0x4abe62[_0x76e5('0x34')]){_0x224060[_0x76e5('0x35')]=!![];}return _0x13aedc[_0x76e5('0x1c')](_0x224060);}else{return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x51'),util[_0x76e5('0x36')](_0x2db805[_0x76e5('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4bf210){return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x51'),util['inspect'](_0x4bf210,{'showHidden':![],'depth':null}));});}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x51'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x4abe62[_0x76e5('0x57')]){var _0x18d4be={'method':_0x76e5('0x30'),'uri':_0x76e5('0x5e'),'headers':{'Authorization':_0x4abe62[_0x76e5('0x57')]},'body':{'content':_0x2fa8d9[_0x76e5('0xf')],'to':[_0x2fa8d9[_0x76e5('0x24')]],'from':_0x4abe62[_0x76e5('0x24')],'binary':![],'clientMessageId':_0x76e5('0x5f'),'charset':'UTF-8'},'json':!![]};rp(_0x18d4be)[_0x76e5('0x1b')](function(_0x1225ed){if(!_0x1225ed['error']){var _0x57584a={'messageId':_0x1225ed[_0x76e5('0x60')][0x0][_0x76e5('0x61')]};if(!_0x4abe62[_0x76e5('0x34')]){_0x57584a[_0x76e5('0x35')]=!![];}return _0x13aedc['update'](_0x57584a);}else{return logger['error'](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x62'),util['inspect'](_0x1225ed['error'],{'showHidden':![],'depth':null}));}})[_0x76e5('0x27')](function(_0x1a08fe){return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),'clickatell',util['inspect'](_0x1a08fe,{'showHidden':![],'depth':null}));});}else{logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x62'),_0x76e5('0x63'));}break;case _0x76e5('0x64'):if(_0x4abe62[_0x76e5('0x2c')]&&_0x4abe62['password']){var _0x579b43=util[_0x76e5('0x3c')](_0x76e5('0x3d'),_0x4abe62[_0x76e5('0x2c')],_0x4abe62['password']);var _0x442504={'method':_0x76e5('0x30'),'uri':_0x76e5('0x65')+_0x4abe62['accountId']+_0x76e5('0x66'),'body':{'to':[_0x2fa8d9[_0x76e5('0x24')]],'text':_0x2fa8d9[_0x76e5('0xf')],'from':_0x4abe62[_0x76e5('0x24')],'applicationId':_0x4abe62['applicationId']},'headers':{'Authorization':util['format'](_0x76e5('0x3e'),new Buffer(_0x579b43)[_0x76e5('0x3f')]('base64'))},'json':!![]};rp(_0x442504)['then'](function(_0x44bfa3){if(_0x44bfa3['id']){var _0x5cdf6e={'messageId':_0x44bfa3['id']};return _0x13aedc[_0x76e5('0x1c')](_0x5cdf6e);}else{logger['error'](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x64'),util['inspect'](_0x44bfa3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x53e72d){logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x64'),util[_0x76e5('0x36')](_0x53e72d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x76e5('0x28'),_0x76e5('0x29'),'bandwidth',_0x76e5('0x37'));}break;case _0x76e5('0x67'):if(_0x4abe62[_0x76e5('0x57')]){var _0x53af1a={};var _0x1b52f5={'method':_0x76e5('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x76e5('0x68')+_0x4abe62[_0x76e5('0x57')],'Content-Type':_0x76e5('0x69')},'body':{'from':_0x4abe62['phone'],'to':_0x2fa8d9['phone'],'text':_0x2fa8d9[_0x76e5('0xf')]},'json':!![]};return rp(_0x1b52f5)[_0x76e5('0x1b')](function(_0x3bf625){if(_0x3bf625['code']==0xca){_0x53af1a[_0x76e5('0x6a')]=_0x3bf625;var _0x54701e={'method':_0x76e5('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x4abe62[_0x76e5('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x53af1a['message']['refid']},'json':!![]};return rp(_0x54701e)['then'](function(_0x57774c){_0x53af1a[_0x76e5('0x6b')]=_0x57774c;var _0xa8f8c9={'messageId':_0x53af1a[_0x76e5('0x6a')][_0x76e5('0x6c')],'read':!![]};return _0x13aedc[_0x76e5('0x1c')](_0xa8f8c9);});}else{return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),_0x76e5('0x67'),util[_0x76e5('0x36')](_0x3bf625,{'showHidden':![],'depth':null}));}})[_0x76e5('0x27')](function(_0xf3769b){return logger[_0x76e5('0x1d')](_0x76e5('0x28'),'afterCreate',_0x76e5('0x67'),util[_0x76e5('0x36')](_0xf3769b,{'showHidden':![],'depth':null}));});}else{return logger[_0x76e5('0x1d')](_0x76e5('0x28'),_0x76e5('0x29'),'intelepeer',_0x76e5('0x6d'));}break;}}})[_0x76e5('0x6e')](function(){_0x3a58b3();});}else{_0x3a58b3();}}},'charset':_0x76e5('0x6f'),'collate':_0x76e5('0x70')});}; \ No newline at end of file +var _0x1b3e=['https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','message','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','secret','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','senderString','remote','%s:%s','authId','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','csc','login','text','timestamp','keys','length','apiKey','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1b3e,0x16d));var _0xe1b3=function(_0xaeea2d,_0x32d6be){_0xaeea2d=_0xaeea2d-0x0;var _0x466247=_0x1b3e[_0xaeea2d];return _0x466247;};'use strict';var _=require('lodash');var util=require(_0xe1b3('0x0'));var logger=require(_0xe1b3('0x1'))(_0xe1b3('0x2'));var moment=require('moment');var BPromise=require(_0xe1b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1b3('0x4'));var rimraf=require(_0xe1b3('0x5'));var config=require('../../config/environment');var attributes=require(_0xe1b3('0x6'));module['exports']=function(_0x3e32d6,_0x5b4724){return _0x3e32d6[_0xe1b3('0x7')](_0xe1b3('0x8'),attributes,{'tableName':_0xe1b3('0x9'),'paranoid':![],'indexes':[{'name':_0xe1b3('0xa'),'fields':[_0xe1b3('0xa')]},{'name':_0xe1b3('0xb'),'fields':[_0xe1b3('0xc')],'type':_0xe1b3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c2cdf,_0x5f285c,_0x4d1e11){var _0xb27cf7=_0x3e32d6[_0xe1b3('0xe')];var _0x5b3a6c=_0x3c2cdf['get']({'plain':!![]});if(_0x5b3a6c[_0xe1b3('0xf')][_0xe1b3('0x10')]()==='in'||_0x5b3a6c[_0xe1b3('0xf')][_0xe1b3('0x10')]()===_0xe1b3('0x11')&&!_0x5b3a6c['secret']&&!_['isNil'](_0x5b3a6c[_0xe1b3('0x12')])&&!_['isNil'](_0x5b3a6c['SmsInteractionId'])){_0xb27cf7[_0xe1b3('0x13')][_0xe1b3('0x14')]({'where':{'id':_0x5b3a6c[_0xe1b3('0x15')]}})[_0xe1b3('0x16')](function(_0x4e8a10){if(_0x4e8a10){_0x4e8a10[_0xe1b3('0x17')]({'lastMsgAt':_0x5b3a6c['createdAt'],'lastMsgDirection':_0x5b3a6c['direction'][_0xe1b3('0x10')]()});}})[_0xe1b3('0x18')](function(_0xd73529){console['error'](_0xd73529);});}if(_0x5b3a6c[_0xe1b3('0xf')]==='out'&&!_0x5b3a6c[_0xe1b3('0x19')]){var _0x4173ea;_0xb27cf7['SmsAccount']['find']({'where':{'id':_0x5b3a6c[_0xe1b3('0x1a')]},'raw':!![]})[_0xe1b3('0x16')](function(_0x2a79a1){_0x4173ea=_0x2a79a1;if(_0x4173ea&&_0x4173ea[_0xe1b3('0x1b')]){switch(_0x4173ea[_0xe1b3('0x1b')]){case _0xe1b3('0x1c'):var _0x2ef214=require(_0xe1b3('0x1c'));if(_0x4173ea[_0xe1b3('0x1d')]&&_0x4173ea['authToken']&&_0x4173ea[_0xe1b3('0x1e')]){var _0x35d53e=new _0x2ef214(_0x4173ea[_0xe1b3('0x1d')],_0x4173ea[_0xe1b3('0x1f')]);_0x35d53e[_0xe1b3('0x20')][_0xe1b3('0x21')]({'body':_0x5b3a6c['body'],'to':_0x5b3a6c[_0xe1b3('0x1e')],'from':_0x4173ea[_0xe1b3('0x1e')],'statusCallback':_0x4173ea['remote']+_0xe1b3('0x22')+_0x5b3a6c['id']+_0xe1b3('0x23')+_0x4173ea[_0xe1b3('0x24')]})[_0xe1b3('0x16')](function(_0x28a3cc){if(_0x28a3cc[_0xe1b3('0x25')]){return _0x3c2cdf[_0xe1b3('0x17')]({'messageId':_0x28a3cc[_0xe1b3('0x25')]});}})[_0xe1b3('0x18')](function(_0x1dcce8){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x1c'),util[_0xe1b3('0x29')](_0x1dcce8,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate','twilio',_0xe1b3('0x2a'));}break;case _0xe1b3('0x2b'):var _0x21266b='https://api.skebby.it/API/v1.0/REST/';if(_0x4173ea['username']&&_0x4173ea[_0xe1b3('0x2c')]){var _0x3e5f80={'recipient':[_0x5b3a6c[_0xe1b3('0x1e')]],'message':_0x5b3a6c[_0xe1b3('0xc')],'message_type':_0x4173ea[_0xe1b3('0x2d')]};if(_0x4173ea[_0xe1b3('0x2d')]&&_0x4173ea[_0xe1b3('0x2d')]!=='SI'){_0x3e5f80[_0xe1b3('0x2e')]=_0x4173ea[_0xe1b3('0x1e')];}var _0x4989f6={'url':_0x21266b+_0xe1b3('0x2f')+_0x4173ea['username']+_0xe1b3('0x30')+_0x4173ea['password'],'method':'GET'};rp(_0x4989f6)['then'](function(_0x2201cf){var _0x3978a6=_0x2201cf[_0xe1b3('0x31')](';');var _0x407f5d={'user_key':_0x3978a6[0x0],'session_key':_0x3978a6[0x1]};_0x4989f6={'url':_0x21266b+'sms','method':_0xe1b3('0x32'),'headers':{'user_key':_0x407f5d[_0xe1b3('0x33')],'Session_key':_0x407f5d[_0xe1b3('0x34')]},'json':!![],'body':_0x3e5f80};return rp(_0x4989f6);})['then'](function(_0x39820d){if(_0x39820d[_0xe1b3('0x35')]>=0x1){var _0x1e3e17={'messageId':_0x39820d[_0xe1b3('0x36')]};if(_0x4173ea[_0xe1b3('0x2d')]!=='GP'||!_0x4173ea[_0xe1b3('0x37')]){_0x1e3e17[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x1e3e17);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x2b'),util[_0xe1b3('0x29')](_0x39820d,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x4450fa){return logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x2b'),util[_0xe1b3('0x29')](_0x4450fa,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x2b'),_0xe1b3('0x39'));}break;case _0xe1b3('0x3a'):if(_0x4173ea[_0xe1b3('0x1f')]){var _0x5d635c={'recipient':_0x5b3a6c['phone'],'message':_0x5b3a6c[_0xe1b3('0xc')],'sender':_0x4173ea['senderString']||_0x4173ea[_0xe1b3('0x1e')],'authorization':_0x4173ea[_0xe1b3('0x1f')]};var _0x5f285c={'method':_0xe1b3('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5d635c,'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0x4dcf09){var _0x3b62c6={'messageId':_0x4dcf09['requestid']};if(!_0x4173ea[_0xe1b3('0x37')]){_0x3b62c6[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x3b62c6);})[_0xe1b3('0x18')](function(_0x4b34de){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x3a'),util['inspect'](_0x4b34de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x3a'),_0xe1b3('0x3b'));}break;case _0xe1b3('0x3c'):if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea['password']){var _0x5d635c={'messages':[{'source':_0xe1b3('0x3e'),'to':_0x5b3a6c[_0xe1b3('0x1e')],'body':_0x5b3a6c['body'],'from':_0x4173ea['senderString']||_0x4173ea[_0xe1b3('0x1e')]}]};var _0x38026b=util[_0xe1b3('0x3f')]('%s:%s',_0x4173ea[_0xe1b3('0x3d')],_0x4173ea[_0xe1b3('0x2c')]);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x40'),'body':_0x5d635c,'headers':{'Authorization':util['format'](_0xe1b3('0x41'),new Buffer(_0x38026b)[_0xe1b3('0x42')](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0x2b74d7){if(_0x2b74d7['http_code']>=0xc8&&_0x2b74d7[_0xe1b3('0x44')]<=0xce){if(_0x2b74d7[_0xe1b3('0x45')]&&_0x2b74d7[_0xe1b3('0x45')]['queued_count']>0x0){var _0x2f6d08=_[_0xe1b3('0x46')](_0x2b74d7[_0xe1b3('0x45')][_0xe1b3('0x20')]);var _0x2736e8={'messageId':_0x2f6d08[_0xe1b3('0x47')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x2736e8[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x2736e8);}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x2b74d7,{'showHidden':![],'depth':null}));}}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x2b74d7,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x43f66f){logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x43f66f,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x4173ea['authId']&&_0x4173ea['authToken']){var _0x5d635c={'dst':_0x5b3a6c['phone'],'text':_0x5b3a6c['body'],'src':_0x4173ea[_0xe1b3('0x49')]||_0x4173ea['phone'],'url':_0x4173ea[_0xe1b3('0x4a')]+'/api/sms/messages/'+_0x5b3a6c['id']+'/status?token='+_0x4173ea[_0xe1b3('0x24')]};var _0x38026b=util[_0xe1b3('0x3f')](_0xe1b3('0x4b'),_0x4173ea[_0xe1b3('0x4c')],_0x4173ea['authToken']);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':util[_0xe1b3('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4173ea['authId']),'body':_0x5d635c,'headers':{'Authorization':util[_0xe1b3('0x3f')]('Basic\x20%s',new Buffer(_0x38026b)[_0xe1b3('0x42')](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0xe13d35){var _0x300352={'messageId':_0xe13d35['message_uuid'][0x0]};return _0x3c2cdf[_0xe1b3('0x17')](_0x300352);})[_0xe1b3('0x18')](function(_0x188f7e){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x4d'),util['inspect'](_0x188f7e,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea[_0xe1b3('0x2c')]){if(_0x4173ea[_0xe1b3('0x4e')]){var _0x5c4fa5={'method':_0xe1b3('0x32'),'uri':_0x4173ea[_0xe1b3('0x4e')]+_0xe1b3('0x4f'),'body':{'username':_0x4173ea[_0xe1b3('0x3d')],'password':_0x4173ea[_0xe1b3('0x2c')]},'json':!![]};return rp(_0x5c4fa5)[_0xe1b3('0x16')](function(_0x73bcd6){var _0x232cd5={'method':_0xe1b3('0x32'),'uri':_0x4173ea['baseUrl']+_0xe1b3('0x50'),'body':{'messages':[{'from':_0x4173ea[_0xe1b3('0x1e')],'destinations':[{'to':_0x5b3a6c[_0xe1b3('0x1e')]}],'text':_0x5b3a6c[_0xe1b3('0xc')],'notifyUrl':_0x4173ea[_0xe1b3('0x4a')]+_0xe1b3('0x22')+_0x5b3a6c['id']+'/status?token='+_0x4173ea['token'],'notifyContentType':'application/json','callbackData':_0x4173ea[_0xe1b3('0x1e')]+';'+_0x5b3a6c[_0xe1b3('0xc')]}]},'headers':{'Authorization':_0xe1b3('0x51')+_0x73bcd6['token']},'json':!![]};return rp(_0x232cd5)['then'](function(_0x139b2b){if(_0x139b2b[_0xe1b3('0x20')]){var _0x13b12f={'messageId':_0x139b2b[_0xe1b3('0x20')][0x0][_0xe1b3('0xa')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x13b12f[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x13b12f);}else{return logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x52'),util[_0xe1b3('0x29')](_0x139b2b,{'showHidden':![],'depth':null}));}});})[_0xe1b3('0x18')](function(_0x34069f){return logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x52'),util[_0xe1b3('0x29')](_0x34069f,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xe1b3('0x53'):var _0x45a0d0=require('crypto');if(_0x4173ea['apiKey']){var _0x33b363={};_0x33b363[_0xe1b3('0x54')]=_0x4173ea[_0xe1b3('0x3d')];_0x33b363['phone']=_0x5b3a6c['phone'];_0x33b363[_0xe1b3('0x2e')]=_0x4173ea[_0xe1b3('0x1e')];_0x33b363[_0xe1b3('0x55')]=_0x5b3a6c['body'];_0x33b363[_0xe1b3('0x56')]=+new Date();var _0x1ed39b='';var _0x276133='';var _0x2d3380=Object[_0xe1b3('0x57')](_0x33b363);_0x2d3380['sort']();for(var _0x4bb8b3=0x0;_0x4bb8b3<_0x2d3380[_0xe1b3('0x58')];_0x4bb8b3++){if(_0x1ed39b!=''){_0x1ed39b+='&';}_0x1ed39b+=_0x2d3380[_0x4bb8b3]+'='+encodeURIComponent(_0x33b363[_0x2d3380[_0x4bb8b3]]);_0x276133+=_0x33b363[_0x2d3380[_0x4bb8b3]];}_0x276133+=_0x4173ea[_0xe1b3('0x59')];_0x276133=_0x45a0d0['createHash'](_0xe1b3('0x5a'))[_0xe1b3('0x17')](_0x276133)[_0xe1b3('0x5b')](_0xe1b3('0x5c'));if(_0x1ed39b!==''){_0x1ed39b+='&';}_0x1ed39b+=_0xe1b3('0x5d')+_0x276133;var _0x4989f6={'method':_0xe1b3('0x5e'),'uri':_0x4173ea['baseUrl']+_0xe1b3('0x5f')+_0x1ed39b,'json':!![]};return rp(_0x4989f6)['then'](function(_0x5d21aa){var _0x5a58fe=Object['keys'](_0x5d21aa);if(_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x26')]&&parseInt(_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x26')])===0x0){var _0x5920a6={'messageId':_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x60')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x5920a6[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x5920a6);}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x53'),util[_0xe1b3('0x29')](_0x5d21aa[_0xe1b3('0x26')],{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x340d96){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'csc',util[_0xe1b3('0x29')](_0x340d96,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),'csc',_0xe1b3('0x61'));}break;case _0xe1b3('0x62'):if(_0x4173ea[_0xe1b3('0x59')]){var _0x5e9e5b={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x63'),'headers':{'Authorization':_0x4173ea[_0xe1b3('0x59')]},'body':{'content':_0x5b3a6c[_0xe1b3('0xc')],'to':[_0x5b3a6c['phone']],'from':_0x4173ea[_0xe1b3('0x1e')],'binary':![],'clientMessageId':_0xe1b3('0x64'),'charset':_0xe1b3('0x65')},'json':!![]};rp(_0x5e9e5b)[_0xe1b3('0x16')](function(_0x3c998c){if(!_0x3c998c[_0xe1b3('0x26')]){var _0x513338={'messageId':_0x3c998c[_0xe1b3('0x20')][0x0]['apiMessageId']};if(!_0x4173ea[_0xe1b3('0x37')]){_0x513338['read']=!![];}return _0x3c2cdf['update'](_0x513338);}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'clickatell',util[_0xe1b3('0x29')](_0x3c998c['error'],{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x2fefe2){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x62'),util[_0xe1b3('0x29')](_0x2fefe2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xe1b3('0x66'):if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea['password']){var _0x38026b=util[_0xe1b3('0x3f')](_0xe1b3('0x4b'),_0x4173ea[_0xe1b3('0x3d')],_0x4173ea[_0xe1b3('0x2c')]);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x67')+_0x4173ea[_0xe1b3('0x68')]+_0xe1b3('0x69'),'body':{'to':[_0x5b3a6c[_0xe1b3('0x1e')]],'text':_0x5b3a6c[_0xe1b3('0xc')],'from':_0x4173ea[_0xe1b3('0x1e')],'applicationId':_0x4173ea['applicationId']},'headers':{'Authorization':util['format'](_0xe1b3('0x41'),new Buffer(_0x38026b)['toString'](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)['then'](function(_0x137521){if(_0x137521['id']){var _0x215b67={'messageId':_0x137521['id']};return _0x3c2cdf[_0xe1b3('0x17')](_0x215b67);}else{logger['error'](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x66'),util['inspect'](_0x137521,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x1da770){logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x66'),util[_0xe1b3('0x29')](_0x1da770,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x66'),_0xe1b3('0x39'));}break;case'intelepeer':if(_0x4173ea['apiKey']){var _0x1369aa={};var _0x4989f6={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x4173ea[_0xe1b3('0x59')],'Content-Type':'application/json'},'body':{'from':_0x4173ea[_0xe1b3('0x1e')],'to':_0x5b3a6c[_0xe1b3('0x1e')],'text':_0x5b3a6c[_0xe1b3('0xc')]},'json':!![]};return rp(_0x4989f6)[_0xe1b3('0x16')](function(_0x55a1eb){if(_0x55a1eb['code']==0xca){_0x1369aa['message']=_0x55a1eb;var _0x149840={'method':'POST','uri':_0xe1b3('0x6b'),'headers':{'Authorization':_0xe1b3('0x6c')+_0x4173ea[_0xe1b3('0x59')],'Content-Type':_0xe1b3('0x6d')},'body':{'refid':_0x1369aa[_0xe1b3('0x6e')]['refid']},'json':!![]};return rp(_0x149840)[_0xe1b3('0x16')](function(_0x19804f){_0x1369aa[_0xe1b3('0x6f')]=_0x19804f;var _0x165b6a={'messageId':_0x1369aa[_0xe1b3('0x6e')][_0xe1b3('0x70')],'read':!![]};return _0x3c2cdf['update'](_0x165b6a);});}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x71'),util['inspect'](_0x55a1eb,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x38fb77){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x71'),util[_0xe1b3('0x29')](_0x38fb77,{'showHidden':![],'depth':null}));});}else{return logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe1b3('0x71'),_0xe1b3('0x72'));}break;}}})[_0xe1b3('0x73')](function(){_0x4d1e11();});}else{_0x4d1e11();}}},'charset':_0xe1b3('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c0d59bb..43bac64 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 _0xbed8=['raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','create','body','options'];(function(_0x5012f,_0x1d2391){var _0x4ee5eb=function(_0x3c423d){while(--_0x3c423d){_0x5012f['push'](_0x5012f['shift']());}};_0x4ee5eb(++_0x1d2391);}(_0xbed8,0xd4));var _0x8bed=function(_0x169dff,_0x57be0){_0x169dff=_0x169dff-0x0;var _0x91cf22=_0xbed8[_0x169dff];return _0x91cf22;};'use strict';var _=require(_0x8bed('0x0'));var util=require(_0x8bed('0x1'));var moment=require(_0x8bed('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bed('0x3'));var fs=require('fs');var Redis=require(_0x8bed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bed('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bed('0x6'));var jayson=require(_0x8bed('0x7'));var client=jayson[_0x8bed('0x8')]['http']({'port':0x232a});config[_0x8bed('0x9')]=_[_0x8bed('0xa')](config[_0x8bed('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8bed('0xb'))(new Redis(config[_0x8bed('0x9')]));require('./smsMessage.socket')[_0x8bed('0xc')](socket);function respondWithRpcPromise(_0xe5c6a7,_0x48ce5d,_0x342cb4){return new BPromise(function(_0x39e03e,_0x1be627){return client['request'](_0xe5c6a7,_0x342cb4)[_0x8bed('0xd')](function(_0x347815){logger[_0x8bed('0xe')](_0x8bed('0xf'),_0x48ce5d,_0x8bed('0x10'));logger[_0x8bed('0x11')](_0x8bed('0x12'),_0x48ce5d,_0x8bed('0x10'),JSON['stringify'](_0x347815));if(_0x347815[_0x8bed('0x13')]){if(_0x347815[_0x8bed('0x13')][_0x8bed('0x14')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x48ce5d,_0x347815[_0x8bed('0x13')][_0x8bed('0x15')]);return _0x1be627(_0x347815[_0x8bed('0x13')][_0x8bed('0x15')]);}logger[_0x8bed('0x13')](_0x8bed('0xf'),_0x48ce5d,_0x347815['error'][_0x8bed('0x15')]);return _0x39e03e(_0x347815[_0x8bed('0x13')]['message']);}else{logger[_0x8bed('0xe')](_0x8bed('0xf'),_0x48ce5d,_0x8bed('0x10'));_0x39e03e(_0x347815[_0x8bed('0x16')]['message']);}})[_0x8bed('0x17')](function(_0x3a19db){logger['error'](_0x8bed('0xf'),_0x48ce5d,_0x3a19db);_0x1be627(_0x3a19db);});});}exports[_0x8bed('0x18')]=function(_0x4712c4){var _0x597201=this;return new Promise(function(_0x155284,_0x3845cc){return db['SmsMessage'][_0x8bed('0x19')](_0x4712c4[_0x8bed('0x1a')],{'raw':_0x4712c4[_0x8bed('0x1b')]?_0x4712c4[_0x8bed('0x1b')][_0x8bed('0x1c')]===undefined?!![]:![]:!![]})[_0x8bed('0xd')](function(_0x20d57e){logger[_0x8bed('0xe')](_0x8bed('0x18'),_0x4712c4);logger[_0x8bed('0x11')](_0x8bed('0x18'),_0x4712c4,JSON[_0x8bed('0x1d')](_0x20d57e));_0x155284(_0x20d57e);})['catch'](function(_0x210666){logger[_0x8bed('0x13')](_0x8bed('0x18'),_0x210666[_0x8bed('0x15')],_0x4712c4);_0x3845cc(_0x597201[_0x8bed('0x13')](0x1f4,_0x210666[_0x8bed('0x15')]));});});}; \ No newline at end of file +var _0xc506=['raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsMessage','create','body','options'];(function(_0x50f6e7,_0x566a01){var _0x362e69=function(_0x1c8e53){while(--_0x1c8e53){_0x50f6e7['push'](_0x50f6e7['shift']());}};_0x362e69(++_0x566a01);}(_0xc506,0x16d));var _0x6c50=function(_0x4cdba5,_0x5373a7){_0x4cdba5=_0x4cdba5-0x0;var _0x3be43d=_0xc506[_0x4cdba5];return _0x3be43d;};'use strict';var _=require(_0x6c50('0x0'));var util=require(_0x6c50('0x1'));var moment=require(_0x6c50('0x2'));var BPromise=require(_0x6c50('0x3'));var rs=require(_0x6c50('0x4'));var fs=require('fs');var Redis=require(_0x6c50('0x5'));var db=require(_0x6c50('0x6'))['db'];var utils=require(_0x6c50('0x7'));var logger=require(_0x6c50('0x8'))(_0x6c50('0x9'));var config=require(_0x6c50('0xa'));var jayson=require(_0x6c50('0xb'));var client=jayson[_0x6c50('0xc')][_0x6c50('0xd')]({'port':0x232a});config[_0x6c50('0xe')]=_[_0x6c50('0xf')](config['redis'],{'host':_0x6c50('0x10'),'port':0x18eb});var socket=require(_0x6c50('0x11'))(new Redis(config[_0x6c50('0xe')]));require(_0x6c50('0x12'))['register'](socket);function respondWithRpcPromise(_0x32e0aa,_0x435c86,_0x4ab943){return new BPromise(function(_0x11d094,_0x563620){return client['request'](_0x32e0aa,_0x4ab943)['then'](function(_0x13c358){logger[_0x6c50('0x13')](_0x6c50('0x14'),_0x435c86,_0x6c50('0x15'));logger[_0x6c50('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x435c86,_0x6c50('0x15'),JSON[_0x6c50('0x17')](_0x13c358));if(_0x13c358['error']){if(_0x13c358[_0x6c50('0x18')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x435c86,_0x13c358[_0x6c50('0x18')][_0x6c50('0x19')]);return _0x563620(_0x13c358['error'][_0x6c50('0x19')]);}logger[_0x6c50('0x18')](_0x6c50('0x14'),_0x435c86,_0x13c358['error']['message']);return _0x11d094(_0x13c358['error'][_0x6c50('0x19')]);}else{logger[_0x6c50('0x13')](_0x6c50('0x14'),_0x435c86,'request\x20sent');_0x11d094(_0x13c358[_0x6c50('0x1a')]['message']);}})['catch'](function(_0xc870b1){logger[_0x6c50('0x18')](_0x6c50('0x14'),_0x435c86,_0xc870b1);_0x563620(_0xc870b1);});});}exports[_0x6c50('0x1b')]=function(_0x3163a5){var _0x17208a=this;return new Promise(function(_0x256631,_0x1db0ee){return db['SmsMessage'][_0x6c50('0x1c')](_0x3163a5[_0x6c50('0x1d')],{'raw':_0x3163a5[_0x6c50('0x1e')]?_0x3163a5[_0x6c50('0x1e')][_0x6c50('0x1f')]===undefined?!![]:![]:!![]})[_0x6c50('0x20')](function(_0x52818a){logger[_0x6c50('0x13')](_0x6c50('0x1b'),_0x3163a5);logger[_0x6c50('0x16')]('CreateSmsMessage',_0x3163a5,JSON['stringify'](_0x52818a));_0x256631(_0x52818a);})['catch'](function(_0x2f1f77){logger[_0x6c50('0x18')](_0x6c50('0x1b'),_0x2f1f77[_0x6c50('0x19')],_0x3163a5);_0x1db0ee(_0x17208a[_0x6c50('0x18')](0x1f4,_0x2f1f77[_0x6c50('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ea4e048..0f17787 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 _0x8958=['remove','emit','removeListener','length','smsMessage:','./smsMessage.events','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8958,0x1e1));var _0x8895=function(_0x5266a7,_0x126dd3){_0x5266a7=_0x5266a7-0x0;var _0x551eda=_0x8958[_0x5266a7];return _0x551eda;};'use strict';var SmsMessageEvents=require(_0x8895('0x0'));var events=[_0x8895('0x1'),_0x8895('0x2'),'update'];function createListener(_0x396d13,_0x5810e2){return function(_0x158ecf){_0x5810e2[_0x8895('0x3')](_0x396d13,_0x158ecf);};}function removeListener(_0x11b245,_0x29eca6){return function(){SmsMessageEvents[_0x8895('0x4')](_0x11b245,_0x29eca6);};}exports['register']=function(_0x35acf5){for(var _0x5949f8=0x0,_0x194b6a=events[_0x8895('0x5')];_0x5949f8<_0x194b6a;_0x5949f8++){var _0x2ef4b8=events[_0x5949f8];var _0xec4e6c=createListener(_0x8895('0x6')+_0x2ef4b8,_0x35acf5);SmsMessageEvents['on'](_0x2ef4b8,_0xec4e6c);}}; \ No newline at end of file +var _0x70e4=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x55abb3,_0x5c2552){var _0x586b93=function(_0x5af402){while(--_0x5af402){_0x55abb3['push'](_0x55abb3['shift']());}};_0x586b93(++_0x5c2552);}(_0x70e4,0x11b));var _0x470e=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x70e4[_0x187718];return _0x29ddf4;};'use strict';var SmsMessageEvents=require(_0x470e('0x0'));var events=[_0x470e('0x1'),_0x470e('0x2'),_0x470e('0x3')];function createListener(_0x5125f5,_0x8150f9){return function(_0x2936a1){_0x8150f9[_0x470e('0x4')](_0x5125f5,_0x2936a1);};}function removeListener(_0x33dffa,_0x559ef4){return function(){SmsMessageEvents[_0x470e('0x5')](_0x33dffa,_0x559ef4);};}exports[_0x470e('0x6')]=function(_0x9b3c17){for(var _0x423d74=0x0,_0x451331=events[_0x470e('0x7')];_0x423d74<_0x451331;_0x423d74++){var _0x1e74c7=events[_0x423d74];var _0x38c5ce=createListener(_0x470e('0x8')+_0x1e74c7,_0x9b3c17);SmsMessageEvents['on'](_0x1e74c7,_0x38c5ce);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e37186d..0e6a052 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 _0x5653=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','removeTeams','removeAgents'];(function(_0x276c4b,_0x1db701){var _0x203581=function(_0x1f6091){while(--_0x1f6091){_0x276c4b['push'](_0x276c4b['shift']());}};_0x203581(++_0x1db701);}(_0x5653,0xf4));var _0x3565=function(_0x2b77d0,_0x195d54){_0x2b77d0=_0x2b77d0-0x0;var _0x3a1d32=_0x5653[_0x2b77d0];return _0x3a1d32;};'use strict';var multer=require(_0x3565('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3565('0x1'));var express=require(_0x3565('0x2'));var router=express[_0x3565('0x3')]();var fs_extra=require(_0x3565('0x4'));var auth=require(_0x3565('0x5'));var interaction=require(_0x3565('0x6'));var config=require(_0x3565('0x7'));var controller=require(_0x3565('0x8'));router[_0x3565('0x9')]('/',auth[_0x3565('0xa')](),controller[_0x3565('0xb')]);router[_0x3565('0x9')](_0x3565('0xc'),auth['isAuthenticated'](),controller[_0x3565('0xd')]);router[_0x3565('0x9')](_0x3565('0xe'),auth['isAuthenticated'](),controller[_0x3565('0xf')]);router[_0x3565('0x9')]('/:id/members',auth[_0x3565('0xa')](),controller['getMembers']);router['get'](_0x3565('0x10'),auth[_0x3565('0xa')](),controller[_0x3565('0x11')]);router['get'](_0x3565('0x12'),auth[_0x3565('0xa')](),controller[_0x3565('0x13')]);router[_0x3565('0x14')]('/',auth[_0x3565('0xa')](),controller[_0x3565('0x15')]);router[_0x3565('0x14')](_0x3565('0x10'),auth[_0x3565('0xa')](),controller['addTeams']);router[_0x3565('0x14')](_0x3565('0x12'),auth[_0x3565('0xa')](),controller['addAgents']);router[_0x3565('0x16')]('/:id',auth[_0x3565('0xa')](),controller['update']);router['delete'](_0x3565('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x3565('0x17')]('/:id/teams',auth[_0x3565('0xa')](),controller[_0x3565('0x18')]);router[_0x3565('0x17')](_0x3565('0x12'),auth[_0x3565('0xa')](),controller[_0x3565('0x19')]);module[_0x3565('0x1a')]=router; \ No newline at end of file +var _0xafbb=['index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x4473e4,_0x24eac9){var _0x59f07b=function(_0x1e9abf){while(--_0x1e9abf){_0x4473e4['push'](_0x4473e4['shift']());}};_0x59f07b(++_0x24eac9);}(_0xafbb,0xad));var _0xbafb=function(_0x4bdff0,_0x394598){_0x4bdff0=_0x4bdff0-0x0;var _0x55b5f3=_0xafbb[_0x4bdff0];return _0x55b5f3;};'use strict';var multer=require(_0xbafb('0x0'));var util=require(_0xbafb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbafb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbafb('0x3'));var interaction=require(_0xbafb('0x4'));var config=require(_0xbafb('0x5'));var controller=require(_0xbafb('0x6'));router[_0xbafb('0x7')]('/',auth[_0xbafb('0x8')](),controller[_0xbafb('0x9')]);router['get'](_0xbafb('0xa'),auth['isAuthenticated'](),controller[_0xbafb('0xb')]);router[_0xbafb('0x7')](_0xbafb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbafb('0x7')](_0xbafb('0xd'),auth[_0xbafb('0x8')](),controller[_0xbafb('0xe')]);router[_0xbafb('0x7')](_0xbafb('0xf'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x10')]);router['get'](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller['getAgents']);router[_0xbafb('0x12')]('/',auth[_0xbafb('0x8')](),controller[_0xbafb('0x13')]);router[_0xbafb('0x12')](_0xbafb('0xf'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x14')]);router['post'](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x15')]);router[_0xbafb('0x16')](_0xbafb('0xc'),auth[_0xbafb('0x8')](),controller['update']);router['delete'](_0xbafb('0xc'),auth[_0xbafb('0x8')](),controller['destroy']);router[_0xbafb('0x17')](_0xbafb('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xbafb('0x17')](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x18')]);module[_0xbafb('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 e531c31..23ab52e 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 _0xab1d=['exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x11f82f,_0x3b009a){var _0x2dea06=function(_0x4c0ae9){while(--_0x4c0ae9){_0x11f82f['push'](_0x11f82f['shift']());}};_0x2dea06(++_0x3b009a);}(_0xab1d,0x120));var _0xdab1=function(_0x5da06d,_0x22fa5d){_0x5da06d=_0x5da06d-0x0;var _0x21ef9d=_0xab1d[_0x5da06d];return _0x21ef9d;};'use strict';var Sequelize=require('sequelize');module[_0xdab1('0x0')]={'name':{'type':Sequelize[_0xdab1('0x1')],'unique':_0xdab1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdab1('0x1')]},'timeout':{'type':Sequelize[_0xdab1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdab1('0x4')]('rrmemory','beepall',_0xdab1('0x5'))}}; \ No newline at end of file +var _0x8b8e=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x8b8e,0x1e2));var _0xe8b8=function(_0x314dab,_0x19b6be){_0x314dab=_0x314dab-0x0;var _0x154d75=_0x8b8e[_0x314dab];return _0x154d75;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module[_0xe8b8('0x1')]={'name':{'type':Sequelize[_0xe8b8('0x2')],'unique':_0xe8b8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe8b8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8b8('0x5')]('rrmemory',_0xe8b8('0x6'),_0xe8b8('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 043428e..4230fc1 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 _0xe1a7=['request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','SmsQueue','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','findOne','order','SmsQueueId','UserSmsQueue','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userSmsQueue:save','removeTeams','select','field','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','removeAgents','emit','userSmsQueue:remove','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xca2b5f,_0x40bd77){var _0x15760b=function(_0x3c89a1){while(--_0x3c89a1){_0xca2b5f['push'](_0xca2b5f['shift']());}};_0x15760b(++_0x40bd77);}(_0xe1a7,0x87));var _0x7e1a=function(_0x4433c5,_0xa939f4){_0x4433c5=_0x4433c5-0x0;var _0x4d0371=_0xe1a7[_0x4433c5];return _0x4d0371;};'use strict';var emlformat=require(_0x7e1a('0x0'));var rimraf=require(_0x7e1a('0x1'));var zipdir=require(_0x7e1a('0x2'));var jsonpatch=require(_0x7e1a('0x3'));var rp=require(_0x7e1a('0x4'));var moment=require(_0x7e1a('0x5'));var BPromise=require(_0x7e1a('0x6'));var Mustache=require('mustache');var util=require(_0x7e1a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7e1a('0x8'));var ejs=require(_0x7e1a('0x9'));var fs=require('fs');var fs_extra=require(_0x7e1a('0xa'));var _=require(_0x7e1a('0xb'));var squel=require(_0x7e1a('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e1a('0xd'));var deskjs=require(_0x7e1a('0xe'));var toCsv=require(_0x7e1a('0x8'));var querystring=require(_0x7e1a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e1a('0x10'));var qs=require(_0x7e1a('0x11'));var as=require(_0x7e1a('0x12'));var hardwareService=require(_0x7e1a('0x13'));var logger=require(_0x7e1a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7e1a('0x15'));var licenseUtil=require(_0x7e1a('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7e1a('0x17')](config[_0x7e1a('0x18')],{'host':_0x7e1a('0x19'),'port':0x18eb});var socket=require(_0x7e1a('0x1a'))(new Redis(config['redis']));require(_0x7e1a('0x1b'))[_0x7e1a('0x1c')](socket);function respondWithStatusCode(_0x260642,_0x6c72fa){_0x6c72fa=_0x6c72fa||0xcc;return function(_0x172ef2){if(_0x172ef2){return _0x260642[_0x7e1a('0x1d')](_0x6c72fa);}return _0x260642[_0x7e1a('0x1e')](_0x6c72fa)[_0x7e1a('0x1f')]();};}function respondWithResult(_0xd46fcf,_0x24e198){_0x24e198=_0x24e198||0xc8;return function(_0x3cd406){if(_0x3cd406){return _0xd46fcf['status'](_0x24e198)[_0x7e1a('0x20')](_0x3cd406);}};}function respondWithFilteredResult(_0xab4fde,_0x45ebfd){return function(_0x27169a){if(_0x27169a){var _0x30e9c9=typeof _0x45ebfd[_0x7e1a('0x21')]===_0x7e1a('0x22')&&typeof _0x45ebfd['limit']===_0x7e1a('0x22');var _0x119ce6=_0x27169a[_0x7e1a('0x23')];var _0x172e2f=_0x30e9c9?0x0:_0x45ebfd[_0x7e1a('0x21')];var _0x29906e=_0x30e9c9?_0x27169a['count']:_0x45ebfd[_0x7e1a('0x21')]+_0x45ebfd[_0x7e1a('0x24')];var _0x61dd4a;if(_0x29906e>=_0x119ce6){_0x29906e=_0x119ce6;_0x61dd4a=0xc8;}else{_0x61dd4a=0xce;}_0xab4fde[_0x7e1a('0x1e')](_0x61dd4a);return _0xab4fde['set'](_0x7e1a('0x25'),_0x172e2f+'-'+_0x29906e+'/'+_0x119ce6)[_0x7e1a('0x20')](_0x27169a);}return null;};}function patchUpdates(_0x19035a){return function(_0x4be0e6){try{jsonpatch[_0x7e1a('0x26')](_0x4be0e6,_0x19035a,!![]);}catch(_0x5a8f4f){return BPromise[_0x7e1a('0x27')](_0x5a8f4f);}return _0x4be0e6[_0x7e1a('0x28')]();};}function saveUpdates(_0xa7ce64,_0x4a0b53){return function(_0x277d36){if(_0x277d36){return _0x277d36[_0x7e1a('0x29')](_0xa7ce64)[_0x7e1a('0x2a')](function(_0x94f379){return _0x94f379;});}return null;};}function removeEntity(_0x4b4031,_0x11088f){return function(_0xdb2158){if(_0xdb2158){return _0xdb2158[_0x7e1a('0x2b')]()[_0x7e1a('0x2a')](function(){var _0x1583be=_0xdb2158[_0x7e1a('0x2c')]({'plain':!![]});var _0x78f899='SmsQueues';return db[_0x7e1a('0x2d')][_0x7e1a('0x2b')]({'where':{'type':_0x78f899,'resourceId':_0x1583be['id']}})[_0x7e1a('0x2a')](function(){return _0xdb2158;});})['then'](function(){_0x4b4031[_0x7e1a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386d47,_0x353b4d){return function(_0x107957){if(!_0x107957){_0x386d47[_0x7e1a('0x1d')](0x194);}return _0x107957;};}function handleError(_0x39104f,_0x36097a){_0x36097a=_0x36097a||0x1f4;return function(_0x49f56b){logger[_0x7e1a('0x2e')](_0x49f56b[_0x7e1a('0x2f')]);if(_0x49f56b[_0x7e1a('0x30')]){delete _0x49f56b[_0x7e1a('0x30')];}_0x39104f[_0x7e1a('0x1e')](_0x36097a)[_0x7e1a('0x31')](_0x49f56b);};}exports[_0x7e1a('0x32')]=function(_0x3e3d25,_0x3d703c){var _0x297d69={},_0xf568ac={},_0x37ed74={'count':0x0,'rows':[]};var _0x1925d1=_[_0x7e1a('0x33')](db[_0x7e1a('0x34')]['rawAttributes'],function(_0x35bbd4){return{'name':_0x35bbd4['fieldName'],'type':_0x35bbd4[_0x7e1a('0x35')][_0x7e1a('0x36')]};});_0xf568ac['model']=_[_0x7e1a('0x33')](_0x1925d1,'name');_0xf568ac[_0x7e1a('0x37')]=_['keys'](_0x3e3d25['query']);_0xf568ac[_0x7e1a('0x38')]=_[_0x7e1a('0x39')](_0xf568ac[_0x7e1a('0x3a')],_0xf568ac[_0x7e1a('0x37')]);_0x297d69[_0x7e1a('0x3b')]=_[_0x7e1a('0x39')](_0xf568ac[_0x7e1a('0x3a')],qs[_0x7e1a('0x3c')](_0x3e3d25[_0x7e1a('0x37')]['fields']));_0x297d69[_0x7e1a('0x3b')]=_0x297d69[_0x7e1a('0x3b')][_0x7e1a('0x3d')]?_0x297d69[_0x7e1a('0x3b')]:_0xf568ac[_0x7e1a('0x3a')];if(!_0x3e3d25[_0x7e1a('0x37')][_0x7e1a('0x3e')](_0x7e1a('0x3f'))){_0x297d69[_0x7e1a('0x24')]=qs[_0x7e1a('0x24')](_0x3e3d25[_0x7e1a('0x37')][_0x7e1a('0x24')]);_0x297d69[_0x7e1a('0x21')]=qs['offset'](_0x3e3d25['query'][_0x7e1a('0x21')]);}_0x297d69['order']=qs[_0x7e1a('0x40')](_0x3e3d25['query'][_0x7e1a('0x40')]);_0x297d69[_0x7e1a('0x41')]=qs['filters'](_[_0x7e1a('0x42')](_0x3e3d25[_0x7e1a('0x37')],_0xf568ac[_0x7e1a('0x38')]),_0x1925d1);if(_0x3e3d25[_0x7e1a('0x37')][_0x7e1a('0x43')]){_0x297d69[_0x7e1a('0x41')]=_[_0x7e1a('0x44')](_0x297d69['where'],{'$or':_[_0x7e1a('0x33')](_0x1925d1,function(_0x5cba9c){if(_0x5cba9c['type']!==_0x7e1a('0x45')){var _0x10639b={};_0x10639b[_0x5cba9c[_0x7e1a('0x30')]]={'$like':'%'+_0x3e3d25[_0x7e1a('0x37')][_0x7e1a('0x43')]+'%'};return _0x10639b;}})});}_0x297d69=_[_0x7e1a('0x44')]({},_0x297d69,_0x3e3d25[_0x7e1a('0x46')]);var _0x185ff3={'where':_0x297d69[_0x7e1a('0x41')]};return db[_0x7e1a('0x34')][_0x7e1a('0x23')](_0x185ff3)['then'](function(_0x3354b3){_0x37ed74[_0x7e1a('0x23')]=_0x3354b3;if(_0x3e3d25['query'][_0x7e1a('0x47')]){_0x297d69[_0x7e1a('0x48')]=[{'all':!![]}];}return db['SmsQueue'][_0x7e1a('0x49')](_0x297d69);})['then'](function(_0x4086aa){_0x37ed74[_0x7e1a('0x4a')]=_0x4086aa;return _0x37ed74;})[_0x7e1a('0x2a')](respondWithFilteredResult(_0x3d703c,_0x297d69))[_0x7e1a('0x4b')](handleError(_0x3d703c,null));};exports[_0x7e1a('0x4c')]=function(_0x421845,_0x31f9e1){var _0x532040={'raw':!![],'where':{'id':_0x421845['params']['id']}},_0xd0ae22={};_0xd0ae22[_0x7e1a('0x3a')]=_[_0x7e1a('0x4d')](db[_0x7e1a('0x34')][_0x7e1a('0x4e')]);_0xd0ae22[_0x7e1a('0x37')]=_[_0x7e1a('0x4d')](_0x421845['query']);_0xd0ae22[_0x7e1a('0x38')]=_[_0x7e1a('0x39')](_0xd0ae22['model'],_0xd0ae22[_0x7e1a('0x37')]);_0x532040[_0x7e1a('0x3b')]=_[_0x7e1a('0x39')](_0xd0ae22[_0x7e1a('0x3a')],qs[_0x7e1a('0x3c')](_0x421845[_0x7e1a('0x37')]['fields']));_0x532040[_0x7e1a('0x3b')]=_0x532040['attributes'][_0x7e1a('0x3d')]?_0x532040[_0x7e1a('0x3b')]:_0xd0ae22[_0x7e1a('0x3a')];if(_0x421845['query'][_0x7e1a('0x47')]){_0x532040['include']=[{'all':!![]}];}_0x532040=_['merge']({},_0x532040,_0x421845[_0x7e1a('0x46')]);return db[_0x7e1a('0x34')][_0x7e1a('0x4f')](_0x532040)[_0x7e1a('0x2a')](handleEntityNotFound(_0x31f9e1,null))[_0x7e1a('0x2a')](respondWithResult(_0x31f9e1,null))['catch'](handleError(_0x31f9e1,null));};exports[_0x7e1a('0x50')]=function(_0x306239,_0x1a81b5){return db[_0x7e1a('0x34')][_0x7e1a('0x50')](_0x306239['body'],{})[_0x7e1a('0x2a')](function(_0x1f5572){var _0x669516=_0x306239[_0x7e1a('0x51')][_0x7e1a('0x2c')]({'plain':!![]});if(!_0x669516)throw new Error(_0x7e1a('0x52'));if(_0x669516[_0x7e1a('0x53')]===_0x7e1a('0x51')){var _0x33a08f=_0x1f5572[_0x7e1a('0x2c')]({'plain':!![]});var _0x553c93='SmsQueues';return db[_0x7e1a('0x54')]['find']({'where':{'name':_0x553c93,'userProfileId':_0x669516[_0x7e1a('0x55')]},'raw':!![]})[_0x7e1a('0x2a')](function(_0x473221){if(_0x473221&&_0x473221[_0x7e1a('0x56')]===0x0){return db[_0x7e1a('0x2d')]['create']({'name':_0x33a08f['name'],'resourceId':_0x33a08f['id'],'type':_0x473221['name'],'sectionId':_0x473221['id']},{})[_0x7e1a('0x2a')](function(){return _0x1f5572;});}else{return _0x1f5572;}})[_0x7e1a('0x4b')](function(_0x84ea14){logger[_0x7e1a('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x84ea14);throw _0x84ea14;});}return _0x1f5572;})[_0x7e1a('0x2a')](respondWithResult(_0x1a81b5,0xc9))[_0x7e1a('0x4b')](handleError(_0x1a81b5,null));};exports[_0x7e1a('0x29')]=function(_0x2169ee,_0x263fb8){if(_0x2169ee[_0x7e1a('0x57')]['id']){delete _0x2169ee[_0x7e1a('0x57')]['id'];}return db[_0x7e1a('0x34')][_0x7e1a('0x4f')]({'where':{'id':_0x2169ee['params']['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x263fb8,null))[_0x7e1a('0x2a')](saveUpdates(_0x2169ee['body'],null))[_0x7e1a('0x2a')](respondWithResult(_0x263fb8,null))[_0x7e1a('0x4b')](handleError(_0x263fb8,null));};exports['destroy']=function(_0x2a358c,_0x157c93){return db[_0x7e1a('0x34')][_0x7e1a('0x4f')]({'where':{'id':_0x2a358c[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x157c93,null))[_0x7e1a('0x2a')](removeEntity(_0x157c93,null))[_0x7e1a('0x4b')](handleError(_0x157c93,null));};exports[_0x7e1a('0x59')]=function(_0x4860f1,_0x3fb975){return db[_0x7e1a('0x34')][_0x7e1a('0x59')]()[_0x7e1a('0x2a')](respondWithResult(_0x3fb975,null))[_0x7e1a('0x4b')](handleError(_0x3fb975,null));};exports[_0x7e1a('0x5a')]=function(_0x5dc05e,_0x43e60e,_0x37907a){var _0x4edf3b={'raw':!![],'where':{}},_0xa6fa93={},_0x51a291;return db[_0x7e1a('0x34')][_0x7e1a('0x5b')]({'where':{'id':_0x5dc05e[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x43e60e,null))[_0x7e1a('0x2a')](function(_0x2c0933){if(_0x2c0933){_0x51a291=_0x2c0933[_0x7e1a('0x2c')]({'plain':!![]});_0xa6fa93[_0x7e1a('0x3a')]=_[_0x7e1a('0x4d')](db['UserSmsQueue']['rawAttributes']);_0xa6fa93['query']=_['keys'](_0x5dc05e[_0x7e1a('0x37')]);_0xa6fa93[_0x7e1a('0x38')]=_[_0x7e1a('0x39')](_0xa6fa93[_0x7e1a('0x3a')],_0xa6fa93['query']);_0x4edf3b[_0x7e1a('0x3b')]=_[_0x7e1a('0x39')](_0xa6fa93[_0x7e1a('0x3a')],qs[_0x7e1a('0x3c')](_0x5dc05e[_0x7e1a('0x37')][_0x7e1a('0x3c')]));_0x4edf3b[_0x7e1a('0x3b')]=_0x4edf3b[_0x7e1a('0x3b')][_0x7e1a('0x3d')]?_0x4edf3b[_0x7e1a('0x3b')]:_0xa6fa93['model'];if(!_0x5dc05e['query'][_0x7e1a('0x3e')]('nolimit')){_0x4edf3b[_0x7e1a('0x24')]=qs['limit'](_0x5dc05e['query'][_0x7e1a('0x24')]);_0x4edf3b[_0x7e1a('0x21')]=qs[_0x7e1a('0x21')](_0x5dc05e[_0x7e1a('0x37')][_0x7e1a('0x21')]);}_0x4edf3b[_0x7e1a('0x5c')]=qs[_0x7e1a('0x40')](_0x5dc05e['query']['sort']);_0x4edf3b['where']=qs[_0x7e1a('0x38')](_['pick'](_0x5dc05e[_0x7e1a('0x37')],_0xa6fa93[_0x7e1a('0x38')]));_0x4edf3b[_0x7e1a('0x41')][_0x7e1a('0x5d')]=_0x2c0933['id'];if(_0x5dc05e[_0x7e1a('0x37')][_0x7e1a('0x43')]){_0x4edf3b[_0x7e1a('0x41')]=_[_0x7e1a('0x44')](_0x4edf3b[_0x7e1a('0x41')],{'$or':_[_0x7e1a('0x33')](_0x4edf3b[_0x7e1a('0x3b')],function(_0x33eb72){var _0x3e53e4={};_0x3e53e4[_0x33eb72]={'$like':'%'+_0x5dc05e[_0x7e1a('0x37')][_0x7e1a('0x43')]+'%'};return _0x3e53e4;})});}_0x4edf3b=_[_0x7e1a('0x44')]({},_0x4edf3b,_0x5dc05e[_0x7e1a('0x46')]);return db[_0x7e1a('0x5e')]['findAll'](_0x4edf3b);}})['then'](function(_0x125419){if(_0x125419){return db['User']['findAndCountAll']({'where':{'id':_[_0x7e1a('0x33')](_0x125419,_0x7e1a('0x5f')),'role':_0x7e1a('0x60')},'attributes':['id',_0x7e1a('0x30'),_0x7e1a('0x61'),_0x7e1a('0x62'),_0x7e1a('0x63')]});}})[_0x7e1a('0x2a')](function(_0x32bb65){if(_0x32bb65){return{'count':_0x32bb65[_0x7e1a('0x23')],'rows':_[_0x7e1a('0x33')](_0x32bb65['rows'],function(_0x4b1925){return{'membername':_0x4b1925[_0x7e1a('0x30')],'UserId':_0x4b1925['id'],'queue_name':_0x51a291[_0x7e1a('0x30')],'SmsQueueId':_0x51a291['id'],'interface':util[_0x7e1a('0x64')]('%s/%s',_0x7e1a('0x65'),_0x4b1925[_0x7e1a('0x30')]),'penalty':0x0,'paused':_0x4b1925[_0x7e1a('0x61')],'createdAt':_0x4b1925['createdAt'],'updatedAt':_0x4b1925[_0x7e1a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e1a('0x2a')](respondWithFilteredResult(_0x43e60e,_0x4edf3b))[_0x7e1a('0x4b')](handleError(_0x43e60e,null));};exports[_0x7e1a('0x66')]=function(_0x5bac2e,_0x194ca9,_0x4a6494){var _0x46cd9e={};var _0x3d4382={};var _0x5a0916;var _0x22e7aa;return db[_0x7e1a('0x34')]['findOne']({'where':{'id':_0x5bac2e[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x194ca9,null))['then'](function(_0xaca42f){if(_0xaca42f){_0x5a0916=_0xaca42f;_0x3d4382[_0x7e1a('0x3a')]=_[_0x7e1a('0x4d')](db[_0x7e1a('0x67')]['rawAttributes']);_0x3d4382['query']=_[_0x7e1a('0x4d')](_0x5bac2e[_0x7e1a('0x37')]);_0x3d4382[_0x7e1a('0x38')]=_[_0x7e1a('0x39')](_0x3d4382['model'],_0x3d4382[_0x7e1a('0x37')]);_0x46cd9e[_0x7e1a('0x3b')]=_[_0x7e1a('0x39')](_0x3d4382['model'],qs[_0x7e1a('0x3c')](_0x5bac2e['query']['fields']));_0x46cd9e['attributes']=_0x46cd9e['attributes'][_0x7e1a('0x3d')]?_0x46cd9e['attributes']:_0x3d4382[_0x7e1a('0x3a')];_0x46cd9e[_0x7e1a('0x5c')]=qs['sort'](_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x40')]);_0x46cd9e[_0x7e1a('0x41')]=qs[_0x7e1a('0x38')](_[_0x7e1a('0x42')](_0x5bac2e[_0x7e1a('0x37')],_0x3d4382[_0x7e1a('0x38')]));if(_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x43')]){_0x46cd9e[_0x7e1a('0x41')]=_[_0x7e1a('0x44')](_0x46cd9e[_0x7e1a('0x41')],{'$or':_[_0x7e1a('0x33')](_0x46cd9e[_0x7e1a('0x3b')],function(_0x16d0b1){var _0x4baa5d={};_0x4baa5d[_0x16d0b1]={'$like':'%'+_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x43')]+'%'};return _0x4baa5d;})});}_0x46cd9e=_[_0x7e1a('0x44')]({},_0x46cd9e,_0x5bac2e[_0x7e1a('0x46')]);return _0x5a0916['getTeams'](_0x46cd9e);}})[_0x7e1a('0x2a')](function(_0x4c6b13){if(_0x4c6b13){_0x22e7aa=_0x4c6b13[_0x7e1a('0x3d')];if(!_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x3e')](_0x7e1a('0x3f'))){_0x46cd9e[_0x7e1a('0x24')]=qs[_0x7e1a('0x24')](_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x24')]);_0x46cd9e[_0x7e1a('0x21')]=qs[_0x7e1a('0x21')](_0x5bac2e[_0x7e1a('0x37')][_0x7e1a('0x21')]);}return _0x5a0916['getTeams'](_0x46cd9e);}})['then'](function(_0x461bcc){if(_0x461bcc){return _0x461bcc?{'count':_0x22e7aa,'rows':_0x461bcc}:null;}})[_0x7e1a('0x2a')](respondWithResult(_0x194ca9,null))[_0x7e1a('0x4b')](handleError(_0x194ca9,null));};exports[_0x7e1a('0x68')]=function(_0x185d56,_0x59a1e3,_0xc3d8c2){var _0xe6d5bf=_0x185d56[_0x7e1a('0x57')][_0x7e1a('0x69')];return db[_0x7e1a('0x67')][_0x7e1a('0x49')]({'where':{'id':_0xe6d5bf},'attributes':['id'],'include':[{'model':db[_0x7e1a('0x6a')],'as':_0x7e1a('0x6b'),'attributes':['id','name',_0x7e1a('0x6c'),_0x7e1a('0x6d'),_0x7e1a('0x6e')],'raw':!![]}]})[_0x7e1a('0x2a')](function(_0x95d60a){if(_0x95d60a){var _0x2febfb=_[_0x7e1a('0x6f')](_0x95d60a,function(_0x311ae9){var _0x27d819=_0x311ae9[_0x7e1a('0x2c')]({'plain':!![]});return _0x27d819[_0x7e1a('0x6b')];});return db['SmsQueue'][_0x7e1a('0x4f')]({'where':{'id':_0x185d56[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](function(_0x34c7b4){return db[_0x7e1a('0x70')][_0x7e1a('0x71')](function(_0x1d0e41){return _0x34c7b4[_0x7e1a('0x68')](_0xe6d5bf,{'transaction':_0x1d0e41})['then'](function(){return BPromise[_0x7e1a('0x72')](_0x2febfb,function(_0x19b9d5){return db[_0x7e1a('0x5e')][_0x7e1a('0x73')]({'where':{'UserId':_0x19b9d5['id'],'SmsQueueId':_0x185d56[_0x7e1a('0x58')]['id']},'transaction':_0x1d0e41});});})[_0x7e1a('0x2a')](function(){_0x2febfb['forEach'](function(_0x29a6e0){socket['emit'](_0x7e1a('0x74'),{'UserId':_0x29a6e0['id'],'SmsQueueId':_0x34c7b4['id']});});});});});}})[_0x7e1a('0x2a')](respondWithStatusCode(_0x59a1e3,null))['catch'](handleError(_0x59a1e3,null));};exports[_0x7e1a('0x75')]=function(_0x1fea83,_0x54727b,_0x58b3e5){return db['Team'][_0x7e1a('0x49')]({'where':{'id':_0x1fea83[_0x7e1a('0x37')][_0x7e1a('0x69')]},'attributes':['id'],'include':[{'model':db[_0x7e1a('0x6a')],'as':_0x7e1a('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x7e1a('0x2a')](handleEntityNotFound(_0x54727b,null))[_0x7e1a('0x2a')](function(_0x581b69){var _0x7cbbff=_[_0x7e1a('0x33')](_0x581b69,'id');var _0x5c6ba8=[];var _0x119ac9=[];var _0x23a51c=squel[_0x7e1a('0x76')]();_0x23a51c[_0x7e1a('0x77')]('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x7e1a('0x78')](_0x7e1a('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7e1a('0x41')](_0x7e1a('0x7a'),_0x1fea83[_0x7e1a('0x58')]['id']);for(var _0x5c3e09=0x0;_0x5c3e09<_0x581b69['length'];_0x5c3e09+=0x1){let _0x1dc992=_0x581b69[_0x5c3e09];for(var _0x5001c6=0x0;_0x5001c6<_0x1dc992[_0x7e1a('0x6b')]['length'];_0x5001c6+=0x1){let _0x4792c0=_0x1dc992[_0x7e1a('0x6b')][_0x5001c6];var _0x2fce63=_0x23a51c[_0x7e1a('0x7b')]();_0x2fce63[_0x7e1a('0x41')]('ut.UserId\x20=\x20?',_0x4792c0['id']);_0x119ac9[_0x7e1a('0x7c')](db['sequelize'][_0x7e1a('0x37')](_0x2fce63[_0x7e1a('0x7d')](),{'type':db['sequelize'][_0x7e1a('0x7e')][_0x7e1a('0x7f')]})['then'](function(_0x1b9625){if(_0x1b9625[_0x7e1a('0x3d')]===0x1){return _0x4792c0['id'];}else{var _0x452fa8=_['every'](_['map'](_0x1b9625,_0x7e1a('0x80')),function(_0x3a9cc7){return _[_0x7e1a('0x81')](_0x7cbbff,_0x3a9cc7);});if(_0x452fa8){return _0x4792c0['id'];}}}));}}return BPromise[_0x7e1a('0x82')](_0x119ac9)['then'](function(_0x41379e){_0x5c6ba8=_(_0x5c6ba8)['union'](_0x41379e)[_0x7e1a('0x83')]()[_0x7e1a('0x84')]();return db[_0x7e1a('0x34')][_0x7e1a('0x4f')]({'where':{'id':_0x1fea83['params']['id']}})[_0x7e1a('0x2a')](function(_0x442d3c){return db[_0x7e1a('0x70')][_0x7e1a('0x71')](function(_0x1cae82){return _0x442d3c['removeTeams'](_0x1fea83[_0x7e1a('0x37')][_0x7e1a('0x69')],{'transaction':_0x1cae82})['then'](function(){if(!_['isEmpty'](_0x5c6ba8)){return _0x442d3c[_0x7e1a('0x85')](_0x5c6ba8,{'transaction':_0x1cae82});}})['then'](function(){_0x5c6ba8['forEach'](function(_0xcae372){socket[_0x7e1a('0x86')](_0x7e1a('0x87'),{'UserId':_0xcae372,'SmsQueueId':_0x442d3c['id']});});});});});});})[_0x7e1a('0x2a')](respondWithStatusCode(_0x54727b,null))['catch'](handleError(_0x54727b,null));};exports['addAgents']=function(_0x1bbc3c,_0x7f66b7,_0x23d3b9){return db['SmsQueue']['find']({'where':{'id':_0x1bbc3c[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x7f66b7,null))['then'](function(_0x69594b){if(_0x69594b){return _0x69594b['addAgents'](_0x1bbc3c[_0x7e1a('0x57')][_0x7e1a('0x69')],_[_0x7e1a('0x88')](_0x1bbc3c['body'],[_0x7e1a('0x69'),'id'])||{})['spread'](function(_0x1ce559){for(var _0xa29fa0=0x0;_0xa29fa0<_0x1bbc3c['body'][_0x7e1a('0x69')][_0x7e1a('0x3d')];_0xa29fa0+=0x1){socket['emit'](_0x7e1a('0x74'),{'UserId':Number(_0x1bbc3c[_0x7e1a('0x57')][_0x7e1a('0x69')][_0xa29fa0]),'SmsQueueId':Number(_0x1bbc3c[_0x7e1a('0x58')]['id'])});}return _0x1ce559;});}})[_0x7e1a('0x2a')](respondWithResult(_0x7f66b7,null))[_0x7e1a('0x4b')](handleError(_0x7f66b7,null));};exports['removeAgents']=function(_0x51113f,_0x5b286c,_0x3da414){return db[_0x7e1a('0x34')][_0x7e1a('0x4f')]({'where':{'id':_0x51113f[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x5b286c,null))[_0x7e1a('0x2a')](function(_0x1a802e){if(_0x1a802e){return _0x1a802e[_0x7e1a('0x85')](_0x51113f[_0x7e1a('0x37')][_0x7e1a('0x69')])['then'](function(){if(_[_0x7e1a('0x89')](_0x51113f[_0x7e1a('0x37')]['ids'])){for(var _0x478212=0x0;_0x478212<_0x51113f[_0x7e1a('0x37')][_0x7e1a('0x69')][_0x7e1a('0x3d')];_0x478212+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x51113f['query'][_0x7e1a('0x69')][_0x478212]),'SmsQueueId':Number(_0x51113f[_0x7e1a('0x58')]['id'])});}}else{socket[_0x7e1a('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x51113f[_0x7e1a('0x37')][_0x7e1a('0x69')]),'SmsQueueId':Number(_0x51113f[_0x7e1a('0x58')]['id'])});}});}})[_0x7e1a('0x2a')](respondWithStatusCode(_0x5b286c,null))['catch'](handleError(_0x5b286c,null));};exports[_0x7e1a('0x8a')]=function(_0x28388e,_0x21f752,_0x4076b7){var _0x27a9b2={};var _0x49e773={};var _0x133869;var _0xf9d026;return db['SmsQueue']['findOne']({'where':{'id':_0x28388e[_0x7e1a('0x58')]['id']}})[_0x7e1a('0x2a')](handleEntityNotFound(_0x21f752,null))[_0x7e1a('0x2a')](function(_0x5f4a23){if(_0x5f4a23){_0x133869=_0x5f4a23;_0x49e773[_0x7e1a('0x3a')]=_[_0x7e1a('0x4d')](db[_0x7e1a('0x6a')][_0x7e1a('0x4e')]);_0x49e773['query']=_[_0x7e1a('0x4d')](_0x28388e[_0x7e1a('0x37')]);_0x49e773[_0x7e1a('0x38')]=_[_0x7e1a('0x39')](_0x49e773[_0x7e1a('0x3a')],_0x49e773[_0x7e1a('0x37')]);_0x27a9b2[_0x7e1a('0x3b')]=_[_0x7e1a('0x39')](_0x49e773['model'],qs[_0x7e1a('0x3c')](_0x28388e[_0x7e1a('0x37')][_0x7e1a('0x3c')]));_0x27a9b2[_0x7e1a('0x3b')]=_0x27a9b2[_0x7e1a('0x3b')][_0x7e1a('0x3d')]?_0x27a9b2[_0x7e1a('0x3b')]:_0x49e773[_0x7e1a('0x3a')];_0x27a9b2[_0x7e1a('0x5c')]=qs[_0x7e1a('0x40')](_0x28388e[_0x7e1a('0x37')][_0x7e1a('0x40')]);_0x27a9b2[_0x7e1a('0x41')]=qs[_0x7e1a('0x38')](_[_0x7e1a('0x42')](_0x28388e[_0x7e1a('0x37')],_0x49e773[_0x7e1a('0x38')]));if(_0x28388e['query'][_0x7e1a('0x43')]){_0x27a9b2['where']=_[_0x7e1a('0x44')](_0x27a9b2[_0x7e1a('0x41')],{'$or':_['map'](_0x27a9b2[_0x7e1a('0x3b')],function(_0x4ad8c0){var _0x10e6f4={};_0x10e6f4[_0x4ad8c0]={'$like':'%'+_0x28388e[_0x7e1a('0x37')][_0x7e1a('0x43')]+'%'};return _0x10e6f4;})});}_0x27a9b2=_[_0x7e1a('0x44')]({},_0x27a9b2,_0x28388e['options']);return _0x133869[_0x7e1a('0x8a')](_0x27a9b2);}})[_0x7e1a('0x2a')](function(_0x3a3c06){if(_0x3a3c06){_0xf9d026=_0x3a3c06['length'];if(!_0x28388e[_0x7e1a('0x37')][_0x7e1a('0x3e')](_0x7e1a('0x3f'))){_0x27a9b2[_0x7e1a('0x24')]=qs['limit'](_0x28388e[_0x7e1a('0x37')][_0x7e1a('0x24')]);_0x27a9b2[_0x7e1a('0x21')]=qs[_0x7e1a('0x21')](_0x28388e[_0x7e1a('0x37')]['offset']);}return _0x133869['getAgents'](_0x27a9b2);}})[_0x7e1a('0x2a')](function(_0x24c172){if(_0x24c172){return _0x24c172?{'count':_0xf9d026,'rows':_0x24c172}:null;}})[_0x7e1a('0x2a')](respondWithResult(_0x21f752,null))[_0x7e1a('0x4b')](handleError(_0x21f752,null));}; \ No newline at end of file +var _0x23db=['smsPause','createdAt','%s/%s','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userSmsQueue:save','removeTeams','Team','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','includes','all','union','compact','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','get','UserProfileResource','destroy','end','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','keys','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','error','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x23db,0x141));var _0xb23d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x23db[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0xb23d('0x0'));var rimraf=require(_0xb23d('0x1'));var zipdir=require(_0xb23d('0x2'));var jsonpatch=require(_0xb23d('0x3'));var rp=require(_0xb23d('0x4'));var moment=require(_0xb23d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb23d('0x6'));var path=require(_0xb23d('0x7'));var sox=require('sox');var csv=require(_0xb23d('0x8'));var ejs=require(_0xb23d('0x9'));var fs=require('fs');var fs_extra=require(_0xb23d('0xa'));var _=require(_0xb23d('0xb'));var squel=require(_0xb23d('0xc'));var crypto=require(_0xb23d('0xd'));var jsforce=require(_0xb23d('0xe'));var deskjs=require(_0xb23d('0xf'));var toCsv=require(_0xb23d('0x8'));var querystring=require('querystring');var Papa=require(_0xb23d('0x10'));var Redis=require(_0xb23d('0x11'));var authService=require(_0xb23d('0x12'));var qs=require(_0xb23d('0x13'));var as=require(_0xb23d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb23d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb23d('0x16'));var db=require(_0xb23d('0x17'))['db'];config[_0xb23d('0x18')]=_[_0xb23d('0x19')](config[_0xb23d('0x18')],{'host':_0xb23d('0x1a'),'port':0x18eb});var socket=require(_0xb23d('0x1b'))(new Redis(config['redis']));require(_0xb23d('0x1c'))[_0xb23d('0x1d')](socket);function respondWithStatusCode(_0x2fa37a,_0x199560){_0x199560=_0x199560||0xcc;return function(_0x3cb244){if(_0x3cb244){return _0x2fa37a[_0xb23d('0x1e')](_0x199560);}return _0x2fa37a['status'](_0x199560)['end']();};}function respondWithResult(_0x2fba80,_0x45f0d1){_0x45f0d1=_0x45f0d1||0xc8;return function(_0x1b35d7){if(_0x1b35d7){return _0x2fba80[_0xb23d('0x1f')](_0x45f0d1)[_0xb23d('0x20')](_0x1b35d7);}};}function respondWithFilteredResult(_0x21f5a,_0x5a09c3){return function(_0x37bfe2){if(_0x37bfe2){var _0x3f2c6b=typeof _0x5a09c3[_0xb23d('0x21')]===_0xb23d('0x22')&&typeof _0x5a09c3['limit']===_0xb23d('0x22');var _0x5baf53=_0x37bfe2[_0xb23d('0x23')];var _0x2cb813=_0x3f2c6b?0x0:_0x5a09c3[_0xb23d('0x21')];var _0x1287e8=_0x3f2c6b?_0x37bfe2[_0xb23d('0x23')]:_0x5a09c3[_0xb23d('0x21')]+_0x5a09c3[_0xb23d('0x24')];var _0x4b7fea;if(_0x1287e8>=_0x5baf53){_0x1287e8=_0x5baf53;_0x4b7fea=0xc8;}else{_0x4b7fea=0xce;}_0x21f5a[_0xb23d('0x1f')](_0x4b7fea);return _0x21f5a['set']('Content-Range',_0x2cb813+'-'+_0x1287e8+'/'+_0x5baf53)[_0xb23d('0x20')](_0x37bfe2);}return null;};}function patchUpdates(_0x29cacf){return function(_0x8382ab){try{jsonpatch[_0xb23d('0x25')](_0x8382ab,_0x29cacf,!![]);}catch(_0x9348e1){return BPromise[_0xb23d('0x26')](_0x9348e1);}return _0x8382ab[_0xb23d('0x27')]();};}function saveUpdates(_0x219d34,_0x3f0142){return function(_0x20d4b8){if(_0x20d4b8){return _0x20d4b8[_0xb23d('0x28')](_0x219d34)['then'](function(_0x1f0731){return _0x1f0731;});}return null;};}function removeEntity(_0x145ae9,_0x243416){return function(_0x4e1538){if(_0x4e1538){return _0x4e1538['destroy']()[_0xb23d('0x29')](function(){var _0x2e758e=_0x4e1538[_0xb23d('0x2a')]({'plain':!![]});var _0x33e7bc='SmsQueues';return db[_0xb23d('0x2b')][_0xb23d('0x2c')]({'where':{'type':_0x33e7bc,'resourceId':_0x2e758e['id']}})[_0xb23d('0x29')](function(){return _0x4e1538;});})[_0xb23d('0x29')](function(){_0x145ae9[_0xb23d('0x1f')](0xcc)[_0xb23d('0x2d')]();});}};}function handleEntityNotFound(_0x26990e,_0x867d69){return function(_0x2f039f){if(!_0x2f039f){_0x26990e[_0xb23d('0x1e')](0x194);}return _0x2f039f;};}function handleError(_0x2931a2,_0x269e9a){_0x269e9a=_0x269e9a||0x1f4;return function(_0x917292){logger['error'](_0x917292['stack']);if(_0x917292['name']){delete _0x917292[_0xb23d('0x2e')];}_0x2931a2['status'](_0x269e9a)['send'](_0x917292);};}exports[_0xb23d('0x2f')]=function(_0x49d4cf,_0x2e1775){var _0x42e0eb={},_0x44f3d1={},_0x1926ab={'count':0x0,'rows':[]};var _0x2026e0=_[_0xb23d('0x30')](db[_0xb23d('0x31')][_0xb23d('0x32')],function(_0x372471){return{'name':_0x372471[_0xb23d('0x33')],'type':_0x372471[_0xb23d('0x34')][_0xb23d('0x35')]};});_0x44f3d1[_0xb23d('0x36')]=_[_0xb23d('0x30')](_0x2026e0,_0xb23d('0x2e'));_0x44f3d1[_0xb23d('0x37')]=_['keys'](_0x49d4cf[_0xb23d('0x37')]);_0x44f3d1[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x44f3d1[_0xb23d('0x36')],_0x44f3d1[_0xb23d('0x37')]);_0x42e0eb[_0xb23d('0x3a')]=_[_0xb23d('0x39')](_0x44f3d1[_0xb23d('0x36')],qs['fields'](_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x3b')]));_0x42e0eb[_0xb23d('0x3a')]=_0x42e0eb[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x42e0eb[_0xb23d('0x3a')]:_0x44f3d1[_0xb23d('0x36')];if(!_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x3d')](_0xb23d('0x3e'))){_0x42e0eb[_0xb23d('0x24')]=qs[_0xb23d('0x24')](_0x49d4cf['query'][_0xb23d('0x24')]);_0x42e0eb[_0xb23d('0x21')]=qs[_0xb23d('0x21')](_0x49d4cf['query'][_0xb23d('0x21')]);}_0x42e0eb[_0xb23d('0x3f')]=qs[_0xb23d('0x40')](_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x40')]);_0x42e0eb[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x49d4cf[_0xb23d('0x37')],_0x44f3d1['filters']),_0x2026e0);if(_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x43')]){_0x42e0eb[_0xb23d('0x41')]=_[_0xb23d('0x44')](_0x42e0eb['where'],{'$or':_[_0xb23d('0x30')](_0x2026e0,function(_0x55fddd){if(_0x55fddd['type']!==_0xb23d('0x45')){var _0x4900c0={};_0x4900c0[_0x55fddd[_0xb23d('0x2e')]]={'$like':'%'+_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x4900c0;}})});}_0x42e0eb=_[_0xb23d('0x44')]({},_0x42e0eb,_0x49d4cf['options']);var _0x12d7e8={'where':_0x42e0eb['where']};return db[_0xb23d('0x31')]['count'](_0x12d7e8)[_0xb23d('0x29')](function(_0x53030d){_0x1926ab['count']=_0x53030d;if(_0x49d4cf['query']['includeAll']){_0x42e0eb[_0xb23d('0x46')]=[{'all':!![]}];}return db[_0xb23d('0x31')]['findAll'](_0x42e0eb);})[_0xb23d('0x29')](function(_0x3c3366){_0x1926ab[_0xb23d('0x47')]=_0x3c3366;return _0x1926ab;})[_0xb23d('0x29')](respondWithFilteredResult(_0x2e1775,_0x42e0eb))['catch'](handleError(_0x2e1775,null));};exports['show']=function(_0x3a94eb,_0x32a5cc){var _0x1e1836={'raw':!![],'where':{'id':_0x3a94eb['params']['id']}},_0x298ccc={};_0x298ccc[_0xb23d('0x36')]=_[_0xb23d('0x48')](db[_0xb23d('0x31')][_0xb23d('0x32')]);_0x298ccc['query']=_[_0xb23d('0x48')](_0x3a94eb['query']);_0x298ccc[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x298ccc[_0xb23d('0x36')],_0x298ccc['query']);_0x1e1836[_0xb23d('0x3a')]=_['intersection'](_0x298ccc[_0xb23d('0x36')],qs['fields'](_0x3a94eb[_0xb23d('0x37')][_0xb23d('0x3b')]));_0x1e1836[_0xb23d('0x3a')]=_0x1e1836[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x1e1836[_0xb23d('0x3a')]:_0x298ccc[_0xb23d('0x36')];if(_0x3a94eb[_0xb23d('0x37')][_0xb23d('0x49')]){_0x1e1836['include']=[{'all':!![]}];}_0x1e1836=_[_0xb23d('0x44')]({},_0x1e1836,_0x3a94eb[_0xb23d('0x4a')]);return db['SmsQueue'][_0xb23d('0x4b')](_0x1e1836)['then'](handleEntityNotFound(_0x32a5cc,null))[_0xb23d('0x29')](respondWithResult(_0x32a5cc,null))[_0xb23d('0x4c')](handleError(_0x32a5cc,null));};exports[_0xb23d('0x4d')]=function(_0x4f0956,_0xc78b28){return db[_0xb23d('0x31')]['create'](_0x4f0956[_0xb23d('0x4e')],{})[_0xb23d('0x29')](function(_0x268d90){var _0xbfcf00=_0x4f0956[_0xb23d('0x4f')][_0xb23d('0x2a')]({'plain':!![]});if(!_0xbfcf00)throw new Error(_0xb23d('0x50'));if(_0xbfcf00[_0xb23d('0x51')]==='user'){var _0x5607ec=_0x268d90[_0xb23d('0x2a')]({'plain':!![]});var _0x4ba49c=_0xb23d('0x52');return db[_0xb23d('0x53')][_0xb23d('0x4b')]({'where':{'name':_0x4ba49c,'userProfileId':_0xbfcf00['userProfileId']},'raw':!![]})[_0xb23d('0x29')](function(_0x25f467){if(_0x25f467&&_0x25f467[_0xb23d('0x54')]===0x0){return db['UserProfileResource'][_0xb23d('0x4d')]({'name':_0x5607ec['name'],'resourceId':_0x5607ec['id'],'type':_0x25f467[_0xb23d('0x2e')],'sectionId':_0x25f467['id']},{})[_0xb23d('0x29')](function(){return _0x268d90;});}else{return _0x268d90;}})[_0xb23d('0x4c')](function(_0x2fc4d5){logger[_0xb23d('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc4d5);throw _0x2fc4d5;});}return _0x268d90;})[_0xb23d('0x29')](respondWithResult(_0xc78b28,0xc9))['catch'](handleError(_0xc78b28,null));};exports[_0xb23d('0x28')]=function(_0x357925,_0xfdbf55){if(_0x357925[_0xb23d('0x4e')]['id']){delete _0x357925[_0xb23d('0x4e')]['id'];}return db[_0xb23d('0x31')]['find']({'where':{'id':_0x357925['params']['id']}})['then'](handleEntityNotFound(_0xfdbf55,null))[_0xb23d('0x29')](saveUpdates(_0x357925[_0xb23d('0x4e')],null))[_0xb23d('0x29')](respondWithResult(_0xfdbf55,null))['catch'](handleError(_0xfdbf55,null));};exports[_0xb23d('0x2c')]=function(_0x20f106,_0x10e633){return db['SmsQueue'][_0xb23d('0x4b')]({'where':{'id':_0x20f106[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x10e633,null))[_0xb23d('0x29')](removeEntity(_0x10e633,null))[_0xb23d('0x4c')](handleError(_0x10e633,null));};exports['describe']=function(_0x6ca095,_0x34dbdf){return db['SmsQueue'][_0xb23d('0x57')]()[_0xb23d('0x29')](respondWithResult(_0x34dbdf,null))['catch'](handleError(_0x34dbdf,null));};exports[_0xb23d('0x58')]=function(_0x25507b,_0x2f0467,_0x337986){var _0x40b9b9={'raw':!![],'where':{}},_0x25fc65={},_0x24fb1c;return db['SmsQueue'][_0xb23d('0x59')]({'where':{'id':_0x25507b['params']['id']}})['then'](handleEntityNotFound(_0x2f0467,null))[_0xb23d('0x29')](function(_0x2fcecb){if(_0x2fcecb){_0x24fb1c=_0x2fcecb[_0xb23d('0x2a')]({'plain':!![]});_0x25fc65[_0xb23d('0x36')]=_[_0xb23d('0x48')](db[_0xb23d('0x5a')]['rawAttributes']);_0x25fc65[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x25507b[_0xb23d('0x37')]);_0x25fc65[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x25fc65['model'],_0x25fc65[_0xb23d('0x37')]);_0x40b9b9['attributes']=_[_0xb23d('0x39')](_0x25fc65[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x25507b['query'][_0xb23d('0x3b')]));_0x40b9b9[_0xb23d('0x3a')]=_0x40b9b9['attributes'][_0xb23d('0x3c')]?_0x40b9b9[_0xb23d('0x3a')]:_0x25fc65[_0xb23d('0x36')];if(!_0x25507b['query'][_0xb23d('0x3d')]('nolimit')){_0x40b9b9[_0xb23d('0x24')]=qs[_0xb23d('0x24')](_0x25507b[_0xb23d('0x37')][_0xb23d('0x24')]);_0x40b9b9['offset']=qs[_0xb23d('0x21')](_0x25507b[_0xb23d('0x37')][_0xb23d('0x21')]);}_0x40b9b9[_0xb23d('0x3f')]=qs[_0xb23d('0x40')](_0x25507b[_0xb23d('0x37')]['sort']);_0x40b9b9[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x25507b['query'],_0x25fc65[_0xb23d('0x38')]));_0x40b9b9[_0xb23d('0x41')][_0xb23d('0x5b')]=_0x2fcecb['id'];if(_0x25507b[_0xb23d('0x37')][_0xb23d('0x43')]){_0x40b9b9[_0xb23d('0x41')]=_[_0xb23d('0x44')](_0x40b9b9[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x40b9b9[_0xb23d('0x3a')],function(_0x3a4a27){var _0x4cf7b4={};_0x4cf7b4[_0x3a4a27]={'$like':'%'+_0x25507b['query'][_0xb23d('0x43')]+'%'};return _0x4cf7b4;})});}_0x40b9b9=_['merge']({},_0x40b9b9,_0x25507b[_0xb23d('0x4a')]);return db['UserSmsQueue'][_0xb23d('0x5c')](_0x40b9b9);}})['then'](function(_0x455c2e){if(_0x455c2e){return db[_0xb23d('0x5d')][_0xb23d('0x5e')]({'where':{'id':_[_0xb23d('0x30')](_0x455c2e,_0xb23d('0x5f')),'role':'agent'},'attributes':['id','name',_0xb23d('0x60'),'updatedAt',_0xb23d('0x61')]});}})['then'](function(_0xb4933e){if(_0xb4933e){return{'count':_0xb4933e[_0xb23d('0x23')],'rows':_['map'](_0xb4933e[_0xb23d('0x47')],function(_0x5e82ca){return{'membername':_0x5e82ca[_0xb23d('0x2e')],'UserId':_0x5e82ca['id'],'queue_name':_0x24fb1c[_0xb23d('0x2e')],'SmsQueueId':_0x24fb1c['id'],'interface':util['format'](_0xb23d('0x62'),'SIP',_0x5e82ca[_0xb23d('0x2e')]),'penalty':0x0,'paused':_0x5e82ca[_0xb23d('0x60')],'createdAt':_0x5e82ca[_0xb23d('0x61')],'updatedAt':_0x5e82ca['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f0467,_0x40b9b9))[_0xb23d('0x4c')](handleError(_0x2f0467,null));};exports[_0xb23d('0x63')]=function(_0x12dabc,_0x49b60b,_0x5d09eb){var _0x274760={};var _0x4340a5={};var _0x481015;var _0x2d866e;return db[_0xb23d('0x31')][_0xb23d('0x59')]({'where':{'id':_0x12dabc[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x49b60b,null))[_0xb23d('0x29')](function(_0x3481b0){if(_0x3481b0){_0x481015=_0x3481b0;_0x4340a5[_0xb23d('0x36')]=_[_0xb23d('0x48')](db['Team'][_0xb23d('0x32')]);_0x4340a5[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x12dabc[_0xb23d('0x37')]);_0x4340a5[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x4340a5['model'],_0x4340a5[_0xb23d('0x37')]);_0x274760[_0xb23d('0x3a')]=_[_0xb23d('0x39')](_0x4340a5[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x12dabc[_0xb23d('0x37')]['fields']));_0x274760[_0xb23d('0x3a')]=_0x274760[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x274760['attributes']:_0x4340a5[_0xb23d('0x36')];_0x274760['order']=qs[_0xb23d('0x40')](_0x12dabc[_0xb23d('0x37')]['sort']);_0x274760[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x12dabc[_0xb23d('0x37')],_0x4340a5['filters']));if(_0x12dabc[_0xb23d('0x37')][_0xb23d('0x43')]){_0x274760['where']=_[_0xb23d('0x44')](_0x274760[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x274760[_0xb23d('0x3a')],function(_0x5610d8){var _0x122288={};_0x122288[_0x5610d8]={'$like':'%'+_0x12dabc[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x122288;})});}_0x274760=_[_0xb23d('0x44')]({},_0x274760,_0x12dabc[_0xb23d('0x4a')]);return _0x481015[_0xb23d('0x63')](_0x274760);}})[_0xb23d('0x29')](function(_0x546a24){if(_0x546a24){_0x2d866e=_0x546a24['length'];if(!_0x12dabc[_0xb23d('0x37')][_0xb23d('0x3d')](_0xb23d('0x3e'))){_0x274760['limit']=qs[_0xb23d('0x24')](_0x12dabc[_0xb23d('0x37')]['limit']);_0x274760['offset']=qs[_0xb23d('0x21')](_0x12dabc[_0xb23d('0x37')][_0xb23d('0x21')]);}return _0x481015['getTeams'](_0x274760);}})[_0xb23d('0x29')](function(_0x16fb68){if(_0x16fb68){return _0x16fb68?{'count':_0x2d866e,'rows':_0x16fb68}:null;}})[_0xb23d('0x29')](respondWithResult(_0x49b60b,null))[_0xb23d('0x4c')](handleError(_0x49b60b,null));};exports['addTeams']=function(_0x459deb,_0x1039a1,_0x484c26){var _0x37e440=_0x459deb['body']['ids'];return db['Team'][_0xb23d('0x5c')]({'where':{'id':_0x37e440},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb23d('0x64'),'attributes':['id','name',_0xb23d('0x65'),_0xb23d('0x66'),_0xb23d('0x67')],'raw':!![]}]})[_0xb23d('0x29')](function(_0x13b8fe){if(_0x13b8fe){var _0x582ef5=_[_0xb23d('0x68')](_0x13b8fe,function(_0x2984be){var _0x59e14d=_0x2984be[_0xb23d('0x2a')]({'plain':!![]});return _0x59e14d[_0xb23d('0x64')];});return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0x459deb[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](function(_0xb240ed){return db[_0xb23d('0x69')][_0xb23d('0x6a')](function(_0x3b1ddb){return _0xb240ed[_0xb23d('0x6b')](_0x37e440,{'transaction':_0x3b1ddb})['then'](function(){return BPromise[_0xb23d('0x6c')](_0x582ef5,function(_0x8045b8){return db[_0xb23d('0x5a')]['findOrCreate']({'where':{'UserId':_0x8045b8['id'],'SmsQueueId':_0x459deb[_0xb23d('0x56')]['id']},'transaction':_0x3b1ddb});});})[_0xb23d('0x29')](function(){_0x582ef5[_0xb23d('0x6d')](function(_0x43ee31){socket[_0xb23d('0x6e')](_0xb23d('0x6f'),{'UserId':_0x43ee31['id'],'SmsQueueId':_0xb240ed['id']});});});});});}})[_0xb23d('0x29')](respondWithStatusCode(_0x1039a1,null))[_0xb23d('0x4c')](handleError(_0x1039a1,null));};exports[_0xb23d('0x70')]=function(_0x20a9bc,_0x547965,_0x1c1b14){return db[_0xb23d('0x71')]['findAll']({'where':{'id':_0x20a9bc[_0xb23d('0x37')][_0xb23d('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb23d('0x5d')],'as':_0xb23d('0x64'),'attributes':['id'],'raw':!![]}]})[_0xb23d('0x29')](handleEntityNotFound(_0x547965,null))[_0xb23d('0x29')](function(_0x5be5d2){var _0x1ad4d2=_[_0xb23d('0x30')](_0x5be5d2,'id');var _0x158f13=[];var _0xff9f92=[];var _0x56e7cf=squel[_0xb23d('0x73')]();_0x56e7cf[_0xb23d('0x74')]('tq.TeamId')[_0xb23d('0x75')](_0xb23d('0x76'),'tq')[_0xb23d('0x77')](_0xb23d('0x78'),'ut',_0xb23d('0x79'))[_0xb23d('0x41')](_0xb23d('0x7a'),_0x20a9bc[_0xb23d('0x56')]['id']);for(var _0x3de7c1=0x0;_0x3de7c1<_0x5be5d2[_0xb23d('0x3c')];_0x3de7c1+=0x1){let _0x352816=_0x5be5d2[_0x3de7c1];for(var _0x174f4b=0x0;_0x174f4b<_0x352816[_0xb23d('0x64')][_0xb23d('0x3c')];_0x174f4b+=0x1){let _0x328086=_0x352816[_0xb23d('0x64')][_0x174f4b];var _0x4d49a3=_0x56e7cf[_0xb23d('0x7b')]();_0x4d49a3[_0xb23d('0x41')]('ut.UserId\x20=\x20?',_0x328086['id']);_0xff9f92[_0xb23d('0x7c')](db[_0xb23d('0x69')]['query'](_0x4d49a3['toString'](),{'type':db['sequelize'][_0xb23d('0x7d')][_0xb23d('0x7e')]})[_0xb23d('0x29')](function(_0x5c8bf7){if(_0x5c8bf7[_0xb23d('0x3c')]===0x1){return _0x328086['id'];}else{var _0x2cbc73=_['every'](_[_0xb23d('0x30')](_0x5c8bf7,'TeamId'),function(_0x33cbfc){return _[_0xb23d('0x7f')](_0x1ad4d2,_0x33cbfc);});if(_0x2cbc73){return _0x328086['id'];}}}));}}return BPromise[_0xb23d('0x80')](_0xff9f92)[_0xb23d('0x29')](function(_0x24592b){_0x158f13=_(_0x158f13)[_0xb23d('0x81')](_0x24592b)[_0xb23d('0x82')]()['value']();return db[_0xb23d('0x31')]['find']({'where':{'id':_0x20a9bc[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](function(_0x581673){return db[_0xb23d('0x69')][_0xb23d('0x6a')](function(_0x26fcba){return _0x581673[_0xb23d('0x70')](_0x20a9bc[_0xb23d('0x37')][_0xb23d('0x72')],{'transaction':_0x26fcba})['then'](function(){if(!_[_0xb23d('0x83')](_0x158f13)){return _0x581673['removeAgents'](_0x158f13,{'transaction':_0x26fcba});}})[_0xb23d('0x29')](function(){_0x158f13[_0xb23d('0x6d')](function(_0x520070){socket[_0xb23d('0x6e')](_0xb23d('0x84'),{'UserId':_0x520070,'SmsQueueId':_0x581673['id']});});});});});});})[_0xb23d('0x29')](respondWithStatusCode(_0x547965,null))[_0xb23d('0x4c')](handleError(_0x547965,null));};exports[_0xb23d('0x85')]=function(_0x10f984,_0x3325f1,_0x5687d9){return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0x10f984['params']['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x3325f1,null))[_0xb23d('0x29')](function(_0x447304){if(_0x447304){return _0x447304[_0xb23d('0x85')](_0x10f984[_0xb23d('0x4e')][_0xb23d('0x72')],_[_0xb23d('0x86')](_0x10f984[_0xb23d('0x4e')],['ids','id'])||{})[_0xb23d('0x87')](function(_0x4ad010){for(var _0x933de7=0x0;_0x933de7<_0x10f984['body']['ids']['length'];_0x933de7+=0x1){socket[_0xb23d('0x6e')](_0xb23d('0x6f'),{'UserId':Number(_0x10f984[_0xb23d('0x4e')]['ids'][_0x933de7]),'SmsQueueId':Number(_0x10f984[_0xb23d('0x56')]['id'])});}return _0x4ad010;});}})[_0xb23d('0x29')](respondWithResult(_0x3325f1,null))[_0xb23d('0x4c')](handleError(_0x3325f1,null));};exports[_0xb23d('0x88')]=function(_0xc7cbff,_0x58f355,_0xb2d80f){return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0xc7cbff[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x58f355,null))['then'](function(_0x564f04){if(_0x564f04){return _0x564f04[_0xb23d('0x88')](_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')])[_0xb23d('0x29')](function(){if(_[_0xb23d('0x89')](_0xc7cbff[_0xb23d('0x37')]['ids'])){for(var _0x3db0b9=0x0;_0x3db0b9<_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')][_0xb23d('0x3c')];_0x3db0b9+=0x1){socket[_0xb23d('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0xc7cbff['query'][_0xb23d('0x72')][_0x3db0b9]),'SmsQueueId':Number(_0xc7cbff[_0xb23d('0x56')]['id'])});}}else{socket['emit'](_0xb23d('0x84'),{'UserId':Number(_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')]),'SmsQueueId':Number(_0xc7cbff[_0xb23d('0x56')]['id'])});}});}})[_0xb23d('0x29')](respondWithStatusCode(_0x58f355,null))[_0xb23d('0x4c')](handleError(_0x58f355,null));};exports[_0xb23d('0x8a')]=function(_0x135d92,_0x4fea85,_0x2e5710){var _0x192c47={};var _0x1ab70d={};var _0x2e3649;var _0x5d02b4;return db[_0xb23d('0x31')]['findOne']({'where':{'id':_0x135d92[_0xb23d('0x56')]['id']}})['then'](handleEntityNotFound(_0x4fea85,null))[_0xb23d('0x29')](function(_0x10bc79){if(_0x10bc79){_0x2e3649=_0x10bc79;_0x1ab70d['model']=_[_0xb23d('0x48')](db[_0xb23d('0x5d')][_0xb23d('0x32')]);_0x1ab70d[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x135d92[_0xb23d('0x37')]);_0x1ab70d[_0xb23d('0x38')]=_['intersection'](_0x1ab70d[_0xb23d('0x36')],_0x1ab70d['query']);_0x192c47['attributes']=_[_0xb23d('0x39')](_0x1ab70d[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x135d92['query'][_0xb23d('0x3b')]));_0x192c47[_0xb23d('0x3a')]=_0x192c47[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x192c47[_0xb23d('0x3a')]:_0x1ab70d[_0xb23d('0x36')];_0x192c47[_0xb23d('0x3f')]=qs['sort'](_0x135d92['query'][_0xb23d('0x40')]);_0x192c47[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x135d92[_0xb23d('0x37')],_0x1ab70d[_0xb23d('0x38')]));if(_0x135d92['query'][_0xb23d('0x43')]){_0x192c47['where']=_['merge'](_0x192c47[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x192c47[_0xb23d('0x3a')],function(_0x2653db){var _0x234ea1={};_0x234ea1[_0x2653db]={'$like':'%'+_0x135d92[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x234ea1;})});}_0x192c47=_[_0xb23d('0x44')]({},_0x192c47,_0x135d92[_0xb23d('0x4a')]);return _0x2e3649['getAgents'](_0x192c47);}})[_0xb23d('0x29')](function(_0x1ad626){if(_0x1ad626){_0x5d02b4=_0x1ad626['length'];if(!_0x135d92[_0xb23d('0x37')]['hasOwnProperty'](_0xb23d('0x3e'))){_0x192c47['limit']=qs[_0xb23d('0x24')](_0x135d92['query']['limit']);_0x192c47[_0xb23d('0x21')]=qs[_0xb23d('0x21')](_0x135d92[_0xb23d('0x37')][_0xb23d('0x21')]);}return _0x2e3649[_0xb23d('0x8a')](_0x192c47);}})[_0xb23d('0x29')](function(_0x516f4f){if(_0x516f4f){return _0x516f4f?{'count':_0x5d02b4,'rows':_0x516f4f}:null;}})[_0xb23d('0x29')](respondWithResult(_0x4fea85,null))[_0xb23d('0x4c')](handleError(_0x4fea85,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7d2e78e..9d6c54d 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 _0x8d4c=['emit','events','SmsQueue','setMaxListeners','save','update'];(function(_0x3ee807,_0x318ba5){var _0x5e5e4b=function(_0x34102c){while(--_0x34102c){_0x3ee807['push'](_0x3ee807['shift']());}};_0x5e5e4b(++_0x318ba5);}(_0x8d4c,0x79));var _0xc8d4=function(_0x5a27fe,_0x43993b){_0x5a27fe=_0x5a27fe-0x0;var _0x121c88=_0x8d4c[_0x5a27fe];return _0x121c88;};'use strict';var EventEmitter=require(_0xc8d4('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc8d4('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc8d4('0x2')](0x0);var events={'afterCreate':_0xc8d4('0x3'),'afterUpdate':_0xc8d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48d10d){return function(_0x38c370,_0x119fcd,_0x32e86b){SmsQueueEvents[_0xc8d4('0x5')](_0x48d10d+':'+_0x38c370['id'],_0x38c370);SmsQueueEvents[_0xc8d4('0x5')](_0x48d10d,_0x38c370);_0x32e86b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe02f=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xe02f,0x1d3));var _0xfe02=function(_0x1a3e33,_0xe419f4){_0x1a3e33=_0x1a3e33-0x0;var _0x545085=_0xe02f[_0x1a3e33];return _0x545085;};'use strict';var EventEmitter=require(_0xfe02('0x0'));var SmsQueue=require(_0xfe02('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfe02('0x2')](0x0);var events={'afterCreate':_0xfe02('0x3'),'afterUpdate':_0xfe02('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eb89c){return function(_0x193273,_0x358035,_0x30f101){SmsQueueEvents['emit'](_0x1eb89c+':'+_0x193273['id'],_0x193273);SmsQueueEvents[_0xfe02('0x5')](_0x1eb89c,_0x193273);_0x30f101(null);};}for(var e in events){if(events[_0xfe02('0x6')](e)){var event=events[e];SmsQueue[_0xfe02('0x7')](e,emitEvent(event));}}module[_0xfe02('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 d09e440..fae5889 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 _0x63e1=['util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','sms_queues'];(function(_0x4dfefb,_0x5083d7){var _0x45d5a2=function(_0xfc7a12){while(--_0xfc7a12){_0x4dfefb['push'](_0x4dfefb['shift']());}};_0x45d5a2(++_0x5083d7);}(_0x63e1,0x1cc));var _0x163e=function(_0x474b2f,_0x13c1e1){_0x474b2f=_0x474b2f-0x0;var _0x34e430=_0x63e1[_0x474b2f];return _0x34e430;};'use strict';var _=require('lodash');var util=require(_0x163e('0x0'));var logger=require(_0x163e('0x1'))(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var BPromise=require(_0x163e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163e('0x5'));var rimraf=require(_0x163e('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x163e('0x7')]=function(_0x2c29bd,_0x23952a){return _0x2c29bd[_0x163e('0x8')]('SmsQueue',attributes,{'tableName':_0x163e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ed3=['sms_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x1857ae,_0xc0afe6){var _0x46302c=function(_0x3a34e9){while(--_0x3a34e9){_0x1857ae['push'](_0x1857ae['shift']());}};_0x46302c(++_0xc0afe6);}(_0x9ed3,0x1e1));var _0x39ed=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x9ed3[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require(_0x39ed('0x0'));var logger=require(_0x39ed('0x1'))('api');var moment=require(_0x39ed('0x2'));var BPromise=require(_0x39ed('0x3'));var rp=require(_0x39ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39ed('0x5'));var config=require(_0x39ed('0x6'));var attributes=require(_0x39ed('0x7'));module[_0x39ed('0x8')]=function(_0x54aeb5,_0x5bb4f4){return _0x54aeb5[_0x39ed('0x9')](_0x39ed('0xa'),attributes,{'tableName':_0x39ed('0xb'),'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 d88b342..46895c3 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 _0x1b1d=['../../mysqldb','../../config/utils','client','localhost','socket.io-emitter','redis','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','where','attributes','limit','include','model','map','then','GetSmsQueue','ShowSmsQueue','find','raw','moment','bluebird','ioredis'];(function(_0x35daf5,_0x1cb0a8){var _0x9151e=function(_0x3c5cec){while(--_0x3c5cec){_0x35daf5['push'](_0x35daf5['shift']());}};_0x9151e(++_0x1cb0a8);}(_0x1b1d,0x125));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1b1('0x0'));var BPromise=require(_0xd1b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1b1('0x2'));var db=require(_0xd1b1('0x3'))['db'];var utils=require(_0xd1b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd1b1('0x5')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd1b1('0x6'),'port':0x18eb});var socket=require(_0xd1b1('0x7'))(new Redis(config[_0xd1b1('0x8')]));require(_0xd1b1('0x9'))[_0xd1b1('0xa')](socket);function respondWithRpcPromise(_0x212216,_0x30604e,_0x433589){return new BPromise(function(_0x10d83e,_0x58bd6d){return client[_0xd1b1('0xb')](_0x212216,_0x433589)['then'](function(_0x30ad48){logger[_0xd1b1('0xc')](_0xd1b1('0xd'),_0x30604e,_0xd1b1('0xe'));logger[_0xd1b1('0xf')](_0xd1b1('0x10'),_0x30604e,'request\x20sent',JSON[_0xd1b1('0x11')](_0x30ad48));if(_0x30ad48[_0xd1b1('0x12')]){if(_0x30ad48[_0xd1b1('0x12')][_0xd1b1('0x13')]===0x1f4){logger[_0xd1b1('0x12')]('SmsQueue,\x20%s,\x20%s',_0x30604e,_0x30ad48[_0xd1b1('0x12')]['message']);return _0x58bd6d(_0x30ad48[_0xd1b1('0x12')][_0xd1b1('0x14')]);}logger[_0xd1b1('0x12')]('SmsQueue,\x20%s,\x20%s',_0x30604e,_0x30ad48[_0xd1b1('0x12')][_0xd1b1('0x14')]);return _0x10d83e(_0x30ad48[_0xd1b1('0x12')][_0xd1b1('0x14')]);}else{logger[_0xd1b1('0xc')](_0xd1b1('0xd'),_0x30604e,'request\x20sent');_0x10d83e(_0x30ad48[_0xd1b1('0x15')][_0xd1b1('0x14')]);}})[_0xd1b1('0x16')](function(_0x271d5b){logger['error'](_0xd1b1('0xd'),_0x30604e,_0x271d5b);_0x58bd6d(_0x271d5b);});});}exports['GetSmsQueue']=function(_0x15cc97){var _0x31f68e=this;return new Promise(function(_0x1f753c,_0x542045){return db[_0xd1b1('0x17')][_0xd1b1('0x18')]({'raw':_0x15cc97[_0xd1b1('0x19')]?_0x15cc97[_0xd1b1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x15cc97[_0xd1b1('0x19')]?_0x15cc97[_0xd1b1('0x19')][_0xd1b1('0x1a')]||null:null,'attributes':_0x15cc97[_0xd1b1('0x19')]?_0x15cc97[_0xd1b1('0x19')][_0xd1b1('0x1b')]||null:null,'limit':_0x15cc97['options']?_0x15cc97['options'][_0xd1b1('0x1c')]||null:null,'include':_0x15cc97[_0xd1b1('0x19')]?_0x15cc97[_0xd1b1('0x19')][_0xd1b1('0x1d')]?_['map'](_0x15cc97[_0xd1b1('0x19')][_0xd1b1('0x1d')],function(_0x2a5753){return{'model':db[_0x2a5753[_0xd1b1('0x1e')]],'as':_0x2a5753['as'],'attributes':_0x2a5753[_0xd1b1('0x1b')],'include':_0x2a5753[_0xd1b1('0x1d')]?_[_0xd1b1('0x1f')](_0x2a5753['include'],function(_0x5c0dd7){return{'model':db[_0x5c0dd7['model']],'as':_0x5c0dd7['as'],'attributes':_0x5c0dd7[_0xd1b1('0x1b')],'include':_0x5c0dd7[_0xd1b1('0x1d')]?_[_0xd1b1('0x1f')](_0x5c0dd7[_0xd1b1('0x1d')],function(_0x10b323){return{'model':db[_0x10b323[_0xd1b1('0x1e')]],'as':_0x10b323['as'],'attributes':_0x10b323['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1b1('0x20')](function(_0x5af90f){logger[_0xd1b1('0xc')]('GetSmsQueue',_0x15cc97);logger[_0xd1b1('0xf')](_0xd1b1('0x21'),_0x15cc97,JSON[_0xd1b1('0x11')](_0x5af90f));_0x1f753c(_0x5af90f);})[_0xd1b1('0x16')](function(_0x11c3cc){logger[_0xd1b1('0x12')]('GetSmsQueue',_0x11c3cc[_0xd1b1('0x14')],_0x15cc97);_0x542045(_0x31f68e['error'](0x1f4,_0x11c3cc[_0xd1b1('0x14')]));});});};exports[_0xd1b1('0x22')]=function(_0x511071){var _0x38bcbe=this;return new Promise(function(_0x10082a,_0xfd7cdd){return db[_0xd1b1('0x17')][_0xd1b1('0x23')]({'raw':_0x511071['options']?_0x511071[_0xd1b1('0x19')][_0xd1b1('0x24')]===undefined?!![]:![]:!![],'where':_0x511071[_0xd1b1('0x19')]?_0x511071[_0xd1b1('0x19')][_0xd1b1('0x1a')]||null:null,'attributes':_0x511071['options']?_0x511071[_0xd1b1('0x19')][_0xd1b1('0x1b')]||null:null,'include':_0x511071['options']?_0x511071['options']['include']?_['map'](_0x511071['options'][_0xd1b1('0x1d')],function(_0x8ec60c){return{'model':db[_0x8ec60c[_0xd1b1('0x1e')]],'as':_0x8ec60c['as'],'attributes':_0x8ec60c['attributes'],'include':_0x8ec60c[_0xd1b1('0x1d')]?_['map'](_0x8ec60c[_0xd1b1('0x1d')],function(_0x53b751){return{'model':db[_0x53b751['model']],'as':_0x53b751['as'],'attributes':_0x53b751[_0xd1b1('0x1b')],'include':_0x53b751[_0xd1b1('0x1d')]?_[_0xd1b1('0x1f')](_0x53b751[_0xd1b1('0x1d')],function(_0x393cb5){return{'model':db[_0x393cb5[_0xd1b1('0x1e')]],'as':_0x393cb5['as'],'attributes':_0x393cb5[_0xd1b1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd1b1('0x20')](function(_0x3eb15d){logger[_0xd1b1('0xc')](_0xd1b1('0x22'),_0x511071);logger[_0xd1b1('0xf')]('ShowSmsQueue',_0x511071,JSON[_0xd1b1('0x11')](_0x3eb15d));_0x10082a(_0x3eb15d);})[_0xd1b1('0x16')](function(_0xfd5bcb){logger['error'](_0xd1b1('0x22'),_0xfd5bcb[_0xd1b1('0x14')],_0x511071);_0xfd7cdd(_0x38bcbe[_0xd1b1('0x12')](0x1f4,_0xfd5bcb[_0xd1b1('0x14')]));});});}; \ No newline at end of file +var _0xcb76=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x321c8d,_0xff6f31){var _0x3d1564=function(_0x26e52b){while(--_0x26e52b){_0x321c8d['push'](_0x321c8d['shift']());}};_0x3d1564(++_0xff6f31);}(_0xcb76,0x8e));var _0x6cb7=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xcb76[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x6cb7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6cb7('0x1'));var rs=require(_0x6cb7('0x2'));var fs=require('fs');var Redis=require(_0x6cb7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb7('0x4'));var logger=require('../../config/logger')(_0x6cb7('0x5'));var config=require(_0x6cb7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6cb7('0x7')][_0x6cb7('0x8')]({'port':0x232a});config[_0x6cb7('0x9')]=_[_0x6cb7('0xa')](config[_0x6cb7('0x9')],{'host':_0x6cb7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cb7('0x9')]));require(_0x6cb7('0xc'))[_0x6cb7('0xd')](socket);function respondWithRpcPromise(_0x1f6460,_0x297f42,_0x1ba56d){return new BPromise(function(_0x29efb3,_0x300f86){return client[_0x6cb7('0xe')](_0x1f6460,_0x1ba56d)[_0x6cb7('0xf')](function(_0x47b2d8){logger[_0x6cb7('0x10')](_0x6cb7('0x11'),_0x297f42,'request\x20sent');logger[_0x6cb7('0x12')](_0x6cb7('0x13'),_0x297f42,_0x6cb7('0x14'),JSON[_0x6cb7('0x15')](_0x47b2d8));if(_0x47b2d8[_0x6cb7('0x16')]){if(_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x17')]===0x1f4){logger[_0x6cb7('0x16')](_0x6cb7('0x11'),_0x297f42,_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);return _0x300f86(_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x297f42,_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);return _0x29efb3(_0x47b2d8[_0x6cb7('0x16')]['message']);}else{logger[_0x6cb7('0x10')](_0x6cb7('0x11'),_0x297f42,_0x6cb7('0x14'));_0x29efb3(_0x47b2d8[_0x6cb7('0x19')][_0x6cb7('0x18')]);}})[_0x6cb7('0x1a')](function(_0x30146d){logger['error']('SmsQueue,\x20%s,\x20%s',_0x297f42,_0x30146d);_0x300f86(_0x30146d);});});}exports[_0x6cb7('0x1b')]=function(_0x3db199){var _0x169f21=this;return new Promise(function(_0x4d116c,_0x22af5d){return db[_0x6cb7('0x1c')][_0x6cb7('0x1d')]({'raw':_0x3db199[_0x6cb7('0x1e')]?_0x3db199['options'][_0x6cb7('0x1f')]===undefined?!![]:![]:!![],'where':_0x3db199[_0x6cb7('0x1e')]?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x20')]||null:null,'attributes':_0x3db199['options']?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x21')]||null:null,'limit':_0x3db199[_0x6cb7('0x1e')]?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x22')]||null:null,'include':_0x3db199['options']?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x23')],function(_0x2b51ec){return{'model':db[_0x2b51ec['model']],'as':_0x2b51ec['as'],'attributes':_0x2b51ec[_0x6cb7('0x21')],'include':_0x2b51ec[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x2b51ec[_0x6cb7('0x23')],function(_0x16a34c){return{'model':db[_0x16a34c[_0x6cb7('0x25')]],'as':_0x16a34c['as'],'attributes':_0x16a34c['attributes'],'include':_0x16a34c['include']?_[_0x6cb7('0x24')](_0x16a34c[_0x6cb7('0x23')],function(_0x30b702){return{'model':db[_0x30b702[_0x6cb7('0x25')]],'as':_0x30b702['as'],'attributes':_0x30b702[_0x6cb7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa34118){logger[_0x6cb7('0x10')](_0x6cb7('0x1b'),_0x3db199);logger[_0x6cb7('0x12')]('GetSmsQueue',_0x3db199,JSON[_0x6cb7('0x15')](_0xa34118));_0x4d116c(_0xa34118);})['catch'](function(_0x50cabc){logger['error'](_0x6cb7('0x1b'),_0x50cabc[_0x6cb7('0x18')],_0x3db199);_0x22af5d(_0x169f21[_0x6cb7('0x16')](0x1f4,_0x50cabc['message']));});});};exports[_0x6cb7('0x26')]=function(_0x443cc2){var _0xf8a185=this;return new Promise(function(_0x5cf32f,_0x51e4ba){return db[_0x6cb7('0x1c')][_0x6cb7('0x27')]({'raw':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2['options'][_0x6cb7('0x1f')]===undefined?!![]:![]:!![],'where':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x20')]||null:null,'attributes':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x21')]||null:null,'include':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2['options'][_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x23')],function(_0x51b51c){return{'model':db[_0x51b51c[_0x6cb7('0x25')]],'as':_0x51b51c['as'],'attributes':_0x51b51c['attributes'],'include':_0x51b51c[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x51b51c['include'],function(_0x392d26){return{'model':db[_0x392d26[_0x6cb7('0x25')]],'as':_0x392d26['as'],'attributes':_0x392d26[_0x6cb7('0x21')],'include':_0x392d26[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x392d26['include'],function(_0x4f620d){return{'model':db[_0x4f620d[_0x6cb7('0x25')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0x6cb7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6cb7('0xf')](function(_0xee38ed){logger[_0x6cb7('0x10')](_0x6cb7('0x26'),_0x443cc2);logger[_0x6cb7('0x12')](_0x6cb7('0x26'),_0x443cc2,JSON[_0x6cb7('0x15')](_0xee38ed));_0x5cf32f(_0xee38ed);})['catch'](function(_0x4b4030){logger[_0x6cb7('0x16')](_0x6cb7('0x26'),_0x4b4030[_0x6cb7('0x18')],_0x443cc2);_0x51e4ba(_0xf8a185[_0x6cb7('0x16')](0x1f4,_0x4b4030[_0x6cb7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index cff59fc..85117e4 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 _0x4995=['register','length','./smsQueue.events','save','remove','update','emit'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x4995,0x64));var _0x5499=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4995[_0x5b644e];return _0x49c6bf;};'use strict';var SmsQueueEvents=require(_0x5499('0x0'));var events=[_0x5499('0x1'),_0x5499('0x2'),_0x5499('0x3')];function createListener(_0x2b1f39,_0x516b4a){return function(_0x3be369){_0x516b4a[_0x5499('0x4')](_0x2b1f39,_0x3be369);};}function removeListener(_0x1b54b8,_0x11ac04){return function(){SmsQueueEvents['removeListener'](_0x1b54b8,_0x11ac04);};}exports[_0x5499('0x5')]=function(_0x4609e2){for(var _0x2cedbe=0x0,_0xcdf4fc=events[_0x5499('0x6')];_0x2cedbe<_0xcdf4fc;_0x2cedbe++){var _0x1e8c0e=events[_0x2cedbe];var _0x3fad0a=createListener('smsQueue:'+_0x1e8c0e,_0x4609e2);SmsQueueEvents['on'](_0x1e8c0e,_0x3fad0a);}}; \ No newline at end of file +var _0xb889=['./smsQueue.events','save','update','emit','removeListener','register','length'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb889,0xb6));var _0x9b88=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb889[_0x342baa];return _0x1208f3;};'use strict';var SmsQueueEvents=require(_0x9b88('0x0'));var events=[_0x9b88('0x1'),'remove',_0x9b88('0x2')];function createListener(_0x251861,_0x4fe2b6){return function(_0x12adb1){_0x4fe2b6[_0x9b88('0x3')](_0x251861,_0x12adb1);};}function removeListener(_0xbb14e1,_0x42d3dc){return function(){SmsQueueEvents[_0x9b88('0x4')](_0xbb14e1,_0x42d3dc);};}exports[_0x9b88('0x5')]=function(_0x57c54e){for(var _0x1b7ff1=0x0,_0x4a8652=events[_0x9b88('0x6')];_0x1b7ff1<_0x4a8652;_0x1b7ff1++){var _0x38b404=events[_0x1b7ff1];var _0x48231f=createListener('smsQueue:'+_0x38b404,_0x57c54e);SmsQueueEvents['on'](_0x38b404,_0x48231f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1801ba8..f26196b 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 _0x9c48=['delete','multer','util','path','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x497141,_0x365823){var _0x281aa5=function(_0x42a167){while(--_0x42a167){_0x497141['push'](_0x497141['shift']());}};_0x281aa5(++_0x365823);}(_0x9c48,0xa1));var _0x89c4=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x9c48[_0x1a809b];return _0x5d90e6;};'use strict';var multer=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var path=require(_0x89c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var fs_extra=require(_0x89c4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89c4('0x6'));var controller=require(_0x89c4('0x7'));router['get']('/',auth[_0x89c4('0x8')](),controller[_0x89c4('0x9')]);router[_0x89c4('0xa')](_0x89c4('0xb'),auth[_0x89c4('0x8')](),controller[_0x89c4('0xc')]);router[_0x89c4('0xa')](_0x89c4('0xd'),auth[_0x89c4('0x8')](),controller[_0x89c4('0xe')]);router[_0x89c4('0xf')]('/',auth[_0x89c4('0x8')](),controller[_0x89c4('0x10')]);router[_0x89c4('0x11')](_0x89c4('0xd'),auth[_0x89c4('0x8')](),controller[_0x89c4('0x12')]);router[_0x89c4('0x13')](_0x89c4('0xd'),auth[_0x89c4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xad68=['/:id','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','put'];(function(_0x5a0b6c,_0x175969){var _0x539441=function(_0x36eeb1){while(--_0x36eeb1){_0x5a0b6c['push'](_0x5a0b6c['shift']());}};_0x539441(++_0x175969);}(_0xad68,0x100));var _0x8ad6=function(_0x11a287,_0x57df55){_0x11a287=_0x11a287-0x0;var _0x111e64=_0xad68[_0x11a287];return _0x111e64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ad6('0x0'));var timeout=require(_0x8ad6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ad6('0x2'));var auth=require(_0x8ad6('0x3'));var interaction=require(_0x8ad6('0x4'));var config=require(_0x8ad6('0x5'));var controller=require(_0x8ad6('0x6'));router[_0x8ad6('0x7')]('/',auth[_0x8ad6('0x8')](),controller['index']);router[_0x8ad6('0x7')](_0x8ad6('0x9'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0xa')]);router[_0x8ad6('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8ad6('0xb')]);router[_0x8ad6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ad6('0xd')](_0x8ad6('0xe'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0xf')]);router[_0x8ad6('0x10')](_0x8ad6('0xe'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index aeb1865..b82cdfe 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 _0xebab=['STRING','DATE','moment','sequelize','exports'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xebab,0x124));var _0xbeba=function(_0x5ab17d,_0x3b50f0){_0x5ab17d=_0x5ab17d-0x0;var _0x26c17f=_0xebab[_0x5ab17d];return _0x26c17f;};'use strict';var moment=require(_0xbeba('0x0'));var Sequelize=require(_0xbeba('0x1'));module[_0xbeba('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbeba('0x3')]},'joinAt':{'type':Sequelize[_0xbeba('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbeba('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbeba('0x3')]}}; \ No newline at end of file +var _0x830f=['DATE','moment','sequelize','exports','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x830f,0x1a0));var _0xf830=function(_0x14601f,_0x3a8258){_0x14601f=_0x14601f-0x0;var _0x3a4923=_0x830f[_0x14601f];return _0x3a4923;};'use strict';var moment=require(_0xf830('0x0'));var Sequelize=require(_0xf830('0x1'));module[_0xf830('0x2')]={'uniqueid':{'type':Sequelize[_0xf830('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf830('0x4')]},'reason':{'type':Sequelize[_0xf830('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d153cce..9b42452 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 _0x52ca=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x1546c5,_0x2f88dd){var _0x2e7535=function(_0x1f2b56){while(--_0x1f2b56){_0x1546c5['push'](_0x1546c5['shift']());}};_0x2e7535(++_0x2f88dd);}(_0x52ca,0xa7));var _0xa52c=function(_0x43f754,_0x2b1985){_0x43f754=_0x43f754-0x0;var _0x3e0b61=_0x52ca[_0x43f754];return _0x3e0b61;};'use strict';var emlformat=require(_0xa52c('0x0'));var rimraf=require(_0xa52c('0x1'));var zipdir=require(_0xa52c('0x2'));var jsonpatch=require(_0xa52c('0x3'));var rp=require(_0xa52c('0x4'));var moment=require('moment');var BPromise=require(_0xa52c('0x5'));var Mustache=require(_0xa52c('0x6'));var util=require(_0xa52c('0x7'));var path=require('path');var sox=require(_0xa52c('0x8'));var csv=require('to-csv');var ejs=require(_0xa52c('0x9'));var fs=require('fs');var fs_extra=require(_0xa52c('0xa'));var _=require('lodash');var squel=require(_0xa52c('0xb'));var crypto=require('crypto');var jsforce=require(_0xa52c('0xc'));var deskjs=require(_0xa52c('0xd'));var toCsv=require(_0xa52c('0xe'));var querystring=require(_0xa52c('0xf'));var Papa=require(_0xa52c('0x10'));var Redis=require(_0xa52c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa52c('0x12'));var as=require(_0xa52c('0x13'));var hardwareService=require(_0xa52c('0x14'));var logger=require(_0xa52c('0x15'))(_0xa52c('0x16'));var utils=require(_0xa52c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa52c('0x18'));var db=require(_0xa52c('0x19'))['db'];function respondWithStatusCode(_0x2de5be,_0x14669e){_0x14669e=_0x14669e||0xcc;return function(_0x333d50){if(_0x333d50){return _0x2de5be['sendStatus'](_0x14669e);}return _0x2de5be[_0xa52c('0x1a')](_0x14669e)[_0xa52c('0x1b')]();};}function respondWithResult(_0x2e8a8e,_0x2639f4){_0x2639f4=_0x2639f4||0xc8;return function(_0x4dc914){if(_0x4dc914){return _0x2e8a8e[_0xa52c('0x1a')](_0x2639f4)[_0xa52c('0x1c')](_0x4dc914);}};}function respondWithFilteredResult(_0xa6de6e,_0x211b39){return function(_0x2363b8){if(_0x2363b8){var _0x5d30f4=typeof _0x211b39[_0xa52c('0x1d')]==='undefined'&&typeof _0x211b39[_0xa52c('0x1e')]==='undefined';var _0x3bf8b3=_0x2363b8[_0xa52c('0x1f')];var _0x226480=_0x5d30f4?0x0:_0x211b39[_0xa52c('0x1d')];var _0x75b89d=_0x5d30f4?_0x2363b8['count']:_0x211b39['offset']+_0x211b39[_0xa52c('0x1e')];var _0x354e7d;if(_0x75b89d>=_0x3bf8b3){_0x75b89d=_0x3bf8b3;_0x354e7d=0xc8;}else{_0x354e7d=0xce;}_0xa6de6e[_0xa52c('0x1a')](_0x354e7d);return _0xa6de6e[_0xa52c('0x20')](_0xa52c('0x21'),_0x226480+'-'+_0x75b89d+'/'+_0x3bf8b3)[_0xa52c('0x1c')](_0x2363b8);}return null;};}function patchUpdates(_0x1e6a88){return function(_0x3d608a){try{jsonpatch[_0xa52c('0x22')](_0x3d608a,_0x1e6a88,!![]);}catch(_0x3887ae){return BPromise[_0xa52c('0x23')](_0x3887ae);}return _0x3d608a['save']();};}function saveUpdates(_0x4640b0,_0x1bf275){return function(_0x191943){if(_0x191943){return _0x191943[_0xa52c('0x24')](_0x4640b0)['then'](function(_0x101d8c){return _0x101d8c;});}return null;};}function removeEntity(_0x108bfe,_0x117a05){return function(_0x349d02){if(_0x349d02){return _0x349d02[_0xa52c('0x25')]()[_0xa52c('0x26')](function(){_0x108bfe[_0xa52c('0x1a')](0xcc)[_0xa52c('0x1b')]();});}};}function handleEntityNotFound(_0x314f1b,_0x91300c){return function(_0x39dfa0){if(!_0x39dfa0){_0x314f1b[_0xa52c('0x27')](0x194);}return _0x39dfa0;};}function handleError(_0x13a980,_0x8e9c7f){_0x8e9c7f=_0x8e9c7f||0x1f4;return function(_0x3f5c4a){logger['error'](_0x3f5c4a[_0xa52c('0x28')]);if(_0x3f5c4a['name']){delete _0x3f5c4a[_0xa52c('0x29')];}_0x13a980[_0xa52c('0x1a')](_0x8e9c7f)[_0xa52c('0x2a')](_0x3f5c4a);};}exports[_0xa52c('0x2b')]=function(_0x1443af,_0x48e816){var _0x102bfe={},_0xcad106={},_0x547b0c={'count':0x0,'rows':[]};var _0x5d9938=_[_0xa52c('0x2c')](db[_0xa52c('0x2d')][_0xa52c('0x2e')],function(_0xecb759){return{'name':_0xecb759[_0xa52c('0x2f')],'type':_0xecb759[_0xa52c('0x30')][_0xa52c('0x31')]};});_0xcad106[_0xa52c('0x32')]=_[_0xa52c('0x2c')](_0x5d9938,_0xa52c('0x29'));_0xcad106[_0xa52c('0x33')]=_['keys'](_0x1443af[_0xa52c('0x33')]);_0xcad106[_0xa52c('0x34')]=_[_0xa52c('0x35')](_0xcad106[_0xa52c('0x32')],_0xcad106['query']);_0x102bfe[_0xa52c('0x36')]=_['intersection'](_0xcad106[_0xa52c('0x32')],qs[_0xa52c('0x37')](_0x1443af['query'][_0xa52c('0x37')]));_0x102bfe[_0xa52c('0x36')]=_0x102bfe[_0xa52c('0x36')][_0xa52c('0x38')]?_0x102bfe[_0xa52c('0x36')]:_0xcad106['model'];if(!_0x1443af['query'][_0xa52c('0x39')]('nolimit')){_0x102bfe[_0xa52c('0x1e')]=qs[_0xa52c('0x1e')](_0x1443af[_0xa52c('0x33')]['limit']);_0x102bfe[_0xa52c('0x1d')]=qs[_0xa52c('0x1d')](_0x1443af['query'][_0xa52c('0x1d')]);}_0x102bfe[_0xa52c('0x3a')]=qs[_0xa52c('0x3b')](_0x1443af['query']['sort']);_0x102bfe[_0xa52c('0x3c')]=qs[_0xa52c('0x34')](_[_0xa52c('0x3d')](_0x1443af['query'],_0xcad106['filters']),_0x5d9938);if(_0x1443af['query'][_0xa52c('0x3e')]){_0x102bfe[_0xa52c('0x3c')]=_[_0xa52c('0x3f')](_0x102bfe['where'],{'$or':_[_0xa52c('0x2c')](_0x5d9938,function(_0x417a9a){if(_0x417a9a['type']!==_0xa52c('0x40')){var _0x4b9361={};_0x4b9361[_0x417a9a['name']]={'$like':'%'+_0x1443af[_0xa52c('0x33')][_0xa52c('0x3e')]+'%'};return _0x4b9361;}})});}_0x102bfe=_['merge']({},_0x102bfe,_0x1443af[_0xa52c('0x41')]);var _0x4f9631={'where':_0x102bfe[_0xa52c('0x3c')]};return db[_0xa52c('0x2d')][_0xa52c('0x1f')](_0x4f9631)[_0xa52c('0x26')](function(_0x222ca7){_0x547b0c['count']=_0x222ca7;if(_0x1443af[_0xa52c('0x33')][_0xa52c('0x42')]){_0x102bfe[_0xa52c('0x43')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa52c('0x44')](_0x102bfe);})[_0xa52c('0x26')](function(_0x5b6010){_0x547b0c[_0xa52c('0x45')]=_0x5b6010;return _0x547b0c;})[_0xa52c('0x26')](respondWithFilteredResult(_0x48e816,_0x102bfe))[_0xa52c('0x46')](handleError(_0x48e816,null));};exports[_0xa52c('0x47')]=function(_0x5ef6ff,_0x271bfd){var _0xf5621a={'raw':!![],'where':{'id':_0x5ef6ff[_0xa52c('0x48')]['id']}},_0x154a90={};_0x154a90[_0xa52c('0x32')]=_['keys'](db[_0xa52c('0x2d')][_0xa52c('0x2e')]);_0x154a90['query']=_['keys'](_0x5ef6ff['query']);_0x154a90[_0xa52c('0x34')]=_[_0xa52c('0x35')](_0x154a90[_0xa52c('0x32')],_0x154a90[_0xa52c('0x33')]);_0xf5621a['attributes']=_[_0xa52c('0x35')](_0x154a90[_0xa52c('0x32')],qs[_0xa52c('0x37')](_0x5ef6ff[_0xa52c('0x33')][_0xa52c('0x37')]));_0xf5621a[_0xa52c('0x36')]=_0xf5621a[_0xa52c('0x36')][_0xa52c('0x38')]?_0xf5621a[_0xa52c('0x36')]:_0x154a90[_0xa52c('0x32')];if(_0x5ef6ff[_0xa52c('0x33')]['includeAll']){_0xf5621a[_0xa52c('0x43')]=[{'all':!![]}];}_0xf5621a=_[_0xa52c('0x3f')]({},_0xf5621a,_0x5ef6ff[_0xa52c('0x41')]);return db[_0xa52c('0x2d')][_0xa52c('0x49')](_0xf5621a)[_0xa52c('0x26')](handleEntityNotFound(_0x271bfd,null))['then'](respondWithResult(_0x271bfd,null))[_0xa52c('0x46')](handleError(_0x271bfd,null));};exports[_0xa52c('0x4a')]=function(_0x3a08d9,_0x5bbc5e){return db['SmsQueueReport']['create'](_0x3a08d9['body'],{})[_0xa52c('0x26')](respondWithResult(_0x5bbc5e,0xc9))[_0xa52c('0x46')](handleError(_0x5bbc5e,null));};exports[_0xa52c('0x24')]=function(_0x22830c,_0x49906){if(_0x22830c[_0xa52c('0x4b')]['id']){delete _0x22830c[_0xa52c('0x4b')]['id'];}return db[_0xa52c('0x2d')]['find']({'where':{'id':_0x22830c[_0xa52c('0x48')]['id']}})[_0xa52c('0x26')](handleEntityNotFound(_0x49906,null))[_0xa52c('0x26')](saveUpdates(_0x22830c[_0xa52c('0x4b')],null))[_0xa52c('0x26')](respondWithResult(_0x49906,null))[_0xa52c('0x46')](handleError(_0x49906,null));};exports[_0xa52c('0x25')]=function(_0x12e79a,_0x1eb4fe){return db[_0xa52c('0x2d')]['find']({'where':{'id':_0x12e79a['params']['id']}})[_0xa52c('0x26')](handleEntityNotFound(_0x1eb4fe,null))[_0xa52c('0x26')](removeEntity(_0x1eb4fe,null))[_0xa52c('0x46')](handleError(_0x1eb4fe,null));};exports[_0xa52c('0x4c')]=function(_0x466c1b,_0x513562){return db[_0xa52c('0x2d')][_0xa52c('0x4c')]()[_0xa52c('0x26')](respondWithResult(_0x513562,null))['catch'](handleError(_0x513562,null));}; \ No newline at end of file +var _0x0411=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','length','find','create','body'];(function(_0x200661,_0xc8d664){var _0x2b4b91=function(_0x176e9e){while(--_0x176e9e){_0x200661['push'](_0x200661['shift']());}};_0x2b4b91(++_0xc8d664);}(_0x0411,0x1d0));var _0x1041=function(_0x3da7a1,_0x151473){_0x3da7a1=_0x3da7a1-0x0;var _0x3b7290=_0x0411[_0x3da7a1];return _0x3b7290;};'use strict';var emlformat=require(_0x1041('0x0'));var rimraf=require(_0x1041('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1041('0x2'));var rp=require(_0x1041('0x3'));var moment=require(_0x1041('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1041('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1041('0x6'));var csv=require(_0x1041('0x7'));var ejs=require(_0x1041('0x8'));var fs=require('fs');var fs_extra=require(_0x1041('0x9'));var _=require(_0x1041('0xa'));var squel=require(_0x1041('0xb'));var crypto=require(_0x1041('0xc'));var jsforce=require(_0x1041('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1041('0x7'));var querystring=require(_0x1041('0xe'));var Papa=require(_0x1041('0xf'));var Redis=require('ioredis');var authService=require(_0x1041('0x10'));var qs=require(_0x1041('0x11'));var as=require(_0x1041('0x12'));var hardwareService=require(_0x1041('0x13'));var logger=require(_0x1041('0x14'))('api');var utils=require(_0x1041('0x15'));var config=require(_0x1041('0x16'));var licenseUtil=require(_0x1041('0x17'));var db=require(_0x1041('0x18'))['db'];function respondWithStatusCode(_0x50f6d4,_0x5ea4a8){_0x5ea4a8=_0x5ea4a8||0xcc;return function(_0x478311){if(_0x478311){return _0x50f6d4[_0x1041('0x19')](_0x5ea4a8);}return _0x50f6d4[_0x1041('0x1a')](_0x5ea4a8)[_0x1041('0x1b')]();};}function respondWithResult(_0x17e3ed,_0x330f60){_0x330f60=_0x330f60||0xc8;return function(_0x2cb23c){if(_0x2cb23c){return _0x17e3ed[_0x1041('0x1a')](_0x330f60)[_0x1041('0x1c')](_0x2cb23c);}};}function respondWithFilteredResult(_0x3169b4,_0x40d986){return function(_0x5a00b8){if(_0x5a00b8){var _0x4af04c=typeof _0x40d986[_0x1041('0x1d')]==='undefined'&&typeof _0x40d986[_0x1041('0x1e')]===_0x1041('0x1f');var _0x2c2412=_0x5a00b8['count'];var _0x564996=_0x4af04c?0x0:_0x40d986[_0x1041('0x1d')];var _0x27d8e7=_0x4af04c?_0x5a00b8['count']:_0x40d986['offset']+_0x40d986['limit'];var _0x38b9ed;if(_0x27d8e7>=_0x2c2412){_0x27d8e7=_0x2c2412;_0x38b9ed=0xc8;}else{_0x38b9ed=0xce;}_0x3169b4['status'](_0x38b9ed);return _0x3169b4[_0x1041('0x20')](_0x1041('0x21'),_0x564996+'-'+_0x27d8e7+'/'+_0x2c2412)[_0x1041('0x1c')](_0x5a00b8);}return null;};}function patchUpdates(_0x108e67){return function(_0x4c1620){try{jsonpatch['apply'](_0x4c1620,_0x108e67,!![]);}catch(_0x2a6553){return BPromise[_0x1041('0x22')](_0x2a6553);}return _0x4c1620[_0x1041('0x23')]();};}function saveUpdates(_0x3b9aa7,_0x1e42d1){return function(_0x5d987d){if(_0x5d987d){return _0x5d987d[_0x1041('0x24')](_0x3b9aa7)[_0x1041('0x25')](function(_0x5b48e0){return _0x5b48e0;});}return null;};}function removeEntity(_0x362996,_0x2c58ce){return function(_0x1ae82e){if(_0x1ae82e){return _0x1ae82e[_0x1041('0x26')]()['then'](function(){_0x362996[_0x1041('0x1a')](0xcc)[_0x1041('0x1b')]();});}};}function handleEntityNotFound(_0xbec30d,_0x4a6d73){return function(_0x473ef7){if(!_0x473ef7){_0xbec30d['sendStatus'](0x194);}return _0x473ef7;};}function handleError(_0x4239af,_0x5257ca){_0x5257ca=_0x5257ca||0x1f4;return function(_0x32ca6b){logger['error'](_0x32ca6b[_0x1041('0x27')]);if(_0x32ca6b[_0x1041('0x28')]){delete _0x32ca6b[_0x1041('0x28')];}_0x4239af[_0x1041('0x1a')](_0x5257ca)[_0x1041('0x29')](_0x32ca6b);};}exports[_0x1041('0x2a')]=function(_0x7b9ecf,_0x4c3822){var _0x51d428={},_0x4b8dd6={},_0x194f04={'count':0x0,'rows':[]};var _0x5bae02=_[_0x1041('0x2b')](db[_0x1041('0x2c')][_0x1041('0x2d')],function(_0x449eb9){return{'name':_0x449eb9[_0x1041('0x2e')],'type':_0x449eb9[_0x1041('0x2f')][_0x1041('0x30')]};});_0x4b8dd6[_0x1041('0x31')]=_[_0x1041('0x2b')](_0x5bae02,'name');_0x4b8dd6['query']=_[_0x1041('0x32')](_0x7b9ecf[_0x1041('0x33')]);_0x4b8dd6[_0x1041('0x34')]=_[_0x1041('0x35')](_0x4b8dd6[_0x1041('0x31')],_0x4b8dd6[_0x1041('0x33')]);_0x51d428['attributes']=_[_0x1041('0x35')](_0x4b8dd6[_0x1041('0x31')],qs[_0x1041('0x36')](_0x7b9ecf[_0x1041('0x33')][_0x1041('0x36')]));_0x51d428[_0x1041('0x37')]=_0x51d428['attributes']['length']?_0x51d428[_0x1041('0x37')]:_0x4b8dd6[_0x1041('0x31')];if(!_0x7b9ecf[_0x1041('0x33')][_0x1041('0x38')](_0x1041('0x39'))){_0x51d428[_0x1041('0x1e')]=qs[_0x1041('0x1e')](_0x7b9ecf['query'][_0x1041('0x1e')]);_0x51d428[_0x1041('0x1d')]=qs[_0x1041('0x1d')](_0x7b9ecf[_0x1041('0x33')]['offset']);}_0x51d428[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x7b9ecf['query']['sort']);_0x51d428[_0x1041('0x3c')]=qs[_0x1041('0x34')](_['pick'](_0x7b9ecf['query'],_0x4b8dd6[_0x1041('0x34')]),_0x5bae02);if(_0x7b9ecf['query'][_0x1041('0x3d')]){_0x51d428[_0x1041('0x3c')]=_[_0x1041('0x3e')](_0x51d428[_0x1041('0x3c')],{'$or':_['map'](_0x5bae02,function(_0x2fb1ef){if(_0x2fb1ef[_0x1041('0x2f')]!=='VIRTUAL'){var _0x44f065={};_0x44f065[_0x2fb1ef[_0x1041('0x28')]]={'$like':'%'+_0x7b9ecf[_0x1041('0x33')][_0x1041('0x3d')]+'%'};return _0x44f065;}})});}_0x51d428=_['merge']({},_0x51d428,_0x7b9ecf[_0x1041('0x3f')]);var _0x4288db={'where':_0x51d428[_0x1041('0x3c')]};return db['SmsQueueReport'][_0x1041('0x40')](_0x4288db)[_0x1041('0x25')](function(_0x471f39){_0x194f04[_0x1041('0x40')]=_0x471f39;if(_0x7b9ecf[_0x1041('0x33')][_0x1041('0x41')]){_0x51d428[_0x1041('0x42')]=[{'all':!![]}];}return db[_0x1041('0x2c')][_0x1041('0x43')](_0x51d428);})['then'](function(_0x1ec6ae){_0x194f04[_0x1041('0x44')]=_0x1ec6ae;return _0x194f04;})[_0x1041('0x25')](respondWithFilteredResult(_0x4c3822,_0x51d428))[_0x1041('0x45')](handleError(_0x4c3822,null));};exports[_0x1041('0x46')]=function(_0x2eb6be,_0x4741fd){var _0x564831={'raw':!![],'where':{'id':_0x2eb6be['params']['id']}},_0x211fbe={};_0x211fbe[_0x1041('0x31')]=_[_0x1041('0x32')](db[_0x1041('0x2c')][_0x1041('0x2d')]);_0x211fbe[_0x1041('0x33')]=_['keys'](_0x2eb6be['query']);_0x211fbe[_0x1041('0x34')]=_[_0x1041('0x35')](_0x211fbe['model'],_0x211fbe[_0x1041('0x33')]);_0x564831[_0x1041('0x37')]=_[_0x1041('0x35')](_0x211fbe[_0x1041('0x31')],qs[_0x1041('0x36')](_0x2eb6be['query'][_0x1041('0x36')]));_0x564831[_0x1041('0x37')]=_0x564831[_0x1041('0x37')][_0x1041('0x47')]?_0x564831[_0x1041('0x37')]:_0x211fbe['model'];if(_0x2eb6be[_0x1041('0x33')][_0x1041('0x41')]){_0x564831[_0x1041('0x42')]=[{'all':!![]}];}_0x564831=_[_0x1041('0x3e')]({},_0x564831,_0x2eb6be[_0x1041('0x3f')]);return db[_0x1041('0x2c')][_0x1041('0x48')](_0x564831)['then'](handleEntityNotFound(_0x4741fd,null))[_0x1041('0x25')](respondWithResult(_0x4741fd,null))[_0x1041('0x45')](handleError(_0x4741fd,null));};exports[_0x1041('0x49')]=function(_0xab5a9,_0x228117){return db[_0x1041('0x2c')][_0x1041('0x49')](_0xab5a9[_0x1041('0x4a')],{})['then'](respondWithResult(_0x228117,0xc9))[_0x1041('0x45')](handleError(_0x228117,null));};exports[_0x1041('0x24')]=function(_0x24efd8,_0x2891b6){if(_0x24efd8[_0x1041('0x4a')]['id']){delete _0x24efd8[_0x1041('0x4a')]['id'];}return db['SmsQueueReport'][_0x1041('0x48')]({'where':{'id':_0x24efd8[_0x1041('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2891b6,null))[_0x1041('0x25')](saveUpdates(_0x24efd8['body'],null))[_0x1041('0x25')](respondWithResult(_0x2891b6,null))[_0x1041('0x45')](handleError(_0x2891b6,null));};exports[_0x1041('0x26')]=function(_0x1c9f68,_0x309d70){return db[_0x1041('0x2c')][_0x1041('0x48')]({'where':{'id':_0x1c9f68[_0x1041('0x4b')]['id']}})[_0x1041('0x25')](handleEntityNotFound(_0x309d70,null))['then'](removeEntity(_0x309d70,null))[_0x1041('0x45')](handleError(_0x309d70,null));};exports[_0x1041('0x4c')]=function(_0xc499f,_0x150e4c){return db['SmsQueueReport'][_0x1041('0x4c')]()['then'](respondWithResult(_0x150e4c,null))[_0x1041('0x45')](handleError(_0x150e4c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9faf92b..cd1a044 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(_0x1bfbf7,_0x2aa36d){var _0x37a9cb=function(_0x151e68){while(--_0x151e68){_0x1bfbf7['push'](_0x1bfbf7['shift']());}};_0x37a9cb(++_0x2aa36d);}(_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('./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(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_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 bbcbf25..129ff86 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 _0x8fbf=['catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x2dbeab,_0x2381e3){var _0x8037ef=function(_0x292a49){while(--_0x292a49){_0x2dbeab['push'](_0x2dbeab['shift']());}};_0x8037ef(++_0x2381e3);}(_0x8fbf,0x6b));var _0xf8fb=function(_0x465e59,_0xdf54c2){_0x465e59=_0x465e59-0x0;var _0x8501d8=_0x8fbf[_0x465e59];return _0x8501d8;};'use strict';var _=require(_0xf8fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8fb('0x1'));var rs=require(_0xf8fb('0x2'));var fs=require('fs');var Redis=require(_0xf8fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8fb('0x4'));var logger=require(_0xf8fb('0x5'))(_0xf8fb('0x6'));var config=require(_0xf8fb('0x7'));var jayson=require(_0xf8fb('0x8'));var client=jayson[_0xf8fb('0x9')][_0xf8fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5071d4,_0x2186a9,_0x402848){return new BPromise(function(_0x5d7201,_0x5b1e08){return client[_0xf8fb('0xb')](_0x5071d4,_0x402848)['then'](function(_0x565b77){logger['info'](_0xf8fb('0xc'),_0x2186a9,_0xf8fb('0xd'));logger[_0xf8fb('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2186a9,_0xf8fb('0xd'),JSON[_0xf8fb('0xf')](_0x565b77));if(_0x565b77[_0xf8fb('0x10')]){if(_0x565b77[_0xf8fb('0x10')][_0xf8fb('0x11')]===0x1f4){logger['error'](_0xf8fb('0xc'),_0x2186a9,_0x565b77['error'][_0xf8fb('0x12')]);return _0x5b1e08(_0x565b77[_0xf8fb('0x10')]['message']);}logger[_0xf8fb('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x2186a9,_0x565b77[_0xf8fb('0x10')][_0xf8fb('0x12')]);return _0x5d7201(_0x565b77[_0xf8fb('0x10')][_0xf8fb('0x12')]);}else{logger[_0xf8fb('0x13')](_0xf8fb('0xc'),_0x2186a9,_0xf8fb('0xd'));_0x5d7201(_0x565b77[_0xf8fb('0x14')][_0xf8fb('0x12')]);}})[_0xf8fb('0x15')](function(_0x51644b){logger['error'](_0xf8fb('0xc'),_0x2186a9,_0x51644b);_0x5b1e08(_0x51644b);});});}exports[_0xf8fb('0x16')]=function(_0x307dc5){var _0x17e5b7=this;return new Promise(function(_0x11e263,_0x1f96d5){return db[_0xf8fb('0x17')]['create'](_0x307dc5[_0xf8fb('0x18')],{'raw':_0x307dc5[_0xf8fb('0x19')]?_0x307dc5[_0xf8fb('0x19')][_0xf8fb('0x1a')]===undefined?!![]:![]:!![]})[_0xf8fb('0x1b')](function(_0x34ddd3){logger[_0xf8fb('0x13')](_0xf8fb('0x16'),_0x307dc5);logger['debug'](_0xf8fb('0x16'),_0x307dc5,JSON[_0xf8fb('0xf')](_0x34ddd3));_0x11e263(_0x34ddd3);})[_0xf8fb('0x15')](function(_0x30c860){logger[_0xf8fb('0x10')]('CreateSmsQueueReport',_0x30c860[_0xf8fb('0x12')],_0x307dc5);_0x1f96d5(_0x17e5b7[_0xf8fb('0x10')](0x1f4,_0x30c860[_0xf8fb('0x12')]));});});};exports[_0xf8fb('0x1c')]=function(_0x170e33){var _0x1b2a9a=this;return new Promise(function(_0x23efed,_0x29ac2a){return db[_0xf8fb('0x17')][_0xf8fb('0x1d')](_0x170e33[_0xf8fb('0x18')],{'raw':_0x170e33[_0xf8fb('0x19')]?_0x170e33[_0xf8fb('0x19')][_0xf8fb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170e33['options']?_0x170e33[_0xf8fb('0x19')][_0xf8fb('0x1e')]||null:null,'attributes':_0x170e33[_0xf8fb('0x19')]?_0x170e33[_0xf8fb('0x19')][_0xf8fb('0x1f')]||null:null,'limit':_0x170e33[_0xf8fb('0x19')]?_0x170e33[_0xf8fb('0x19')]['limit']||null:null})[_0xf8fb('0x1b')](function(_0x531693){logger[_0xf8fb('0x13')](_0xf8fb('0x1c'),_0x170e33);logger[_0xf8fb('0xe')](_0xf8fb('0x1c'),_0x170e33,JSON[_0xf8fb('0xf')](_0x531693));_0x23efed(_0x531693);})[_0xf8fb('0x15')](function(_0x18776b){logger[_0xf8fb('0x10')](_0xf8fb('0x1c'),_0x18776b[_0xf8fb('0x12')],_0x170e33);_0x29ac2a(_0x1b2a9a[_0xf8fb('0x10')](0x1f4,_0x18776b[_0xf8fb('0x12')]));});});}; \ No newline at end of file +var _0x145a=['UpdateSmsQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','raw','where','attributes'];(function(_0x3d5d0d,_0x4d1362){var _0x7098a1=function(_0x4b5814){while(--_0x4b5814){_0x3d5d0d['push'](_0x3d5d0d['shift']());}};_0x7098a1(++_0x4d1362);}(_0x145a,0x16c));var _0xa145=function(_0x46e27c,_0x325905){_0x46e27c=_0x46e27c-0x0;var _0x1819b0=_0x145a[_0x46e27c];return _0x1819b0;};'use strict';var _=require(_0xa145('0x0'));var util=require('util');var moment=require(_0xa145('0x1'));var BPromise=require(_0xa145('0x2'));var rs=require(_0xa145('0x3'));var fs=require('fs');var Redis=require(_0xa145('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa145('0x5'));var logger=require(_0xa145('0x6'))(_0xa145('0x7'));var config=require('../../config/environment');var jayson=require(_0xa145('0x8'));var client=jayson['client'][_0xa145('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1747fe,_0x400886,_0x41e93d){return new BPromise(function(_0xfa199e,_0x44e955){return client[_0xa145('0xa')](_0x1747fe,_0x41e93d)[_0xa145('0xb')](function(_0x1f3bdb){logger[_0xa145('0xc')](_0xa145('0xd'),_0x400886,'request\x20sent');logger[_0xa145('0xe')](_0xa145('0xf'),_0x400886,_0xa145('0x10'),JSON[_0xa145('0x11')](_0x1f3bdb));if(_0x1f3bdb[_0xa145('0x12')]){if(_0x1f3bdb[_0xa145('0x12')][_0xa145('0x13')]===0x1f4){logger[_0xa145('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x400886,_0x1f3bdb['error'][_0xa145('0x14')]);return _0x44e955(_0x1f3bdb[_0xa145('0x12')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x400886,_0x1f3bdb[_0xa145('0x12')][_0xa145('0x14')]);return _0xfa199e(_0x1f3bdb[_0xa145('0x12')][_0xa145('0x14')]);}else{logger[_0xa145('0xc')](_0xa145('0xd'),_0x400886,'request\x20sent');_0xfa199e(_0x1f3bdb[_0xa145('0x15')][_0xa145('0x14')]);}})[_0xa145('0x16')](function(_0xa6dbc9){logger[_0xa145('0x12')](_0xa145('0xd'),_0x400886,_0xa6dbc9);_0x44e955(_0xa6dbc9);});});}exports[_0xa145('0x17')]=function(_0x39e459){var _0x35956a=this;return new Promise(function(_0xddb30a,_0x228968){return db[_0xa145('0x18')][_0xa145('0x19')](_0x39e459[_0xa145('0x1a')],{'raw':_0x39e459[_0xa145('0x1b')]?_0x39e459['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x46fa49){logger[_0xa145('0xc')]('CreateSmsQueueReport',_0x39e459);logger[_0xa145('0xe')](_0xa145('0x17'),_0x39e459,JSON['stringify'](_0x46fa49));_0xddb30a(_0x46fa49);})[_0xa145('0x16')](function(_0x30515b){logger[_0xa145('0x12')](_0xa145('0x17'),_0x30515b[_0xa145('0x14')],_0x39e459);_0x228968(_0x35956a[_0xa145('0x12')](0x1f4,_0x30515b[_0xa145('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x1702e3){var _0x145cd9=this;return new Promise(function(_0x3bfc4f,_0x1e419f){return db[_0xa145('0x18')][_0xa145('0x1c')](_0x1702e3['body'],{'raw':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1e')]||null:null,'attributes':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1f')]||null:null,'limit':_0x1702e3['options']?_0x1702e3[_0xa145('0x1b')]['limit']||null:null})[_0xa145('0xb')](function(_0x1fe318){logger['info'](_0xa145('0x20'),_0x1702e3);logger[_0xa145('0xe')]('UpdateSmsQueueReport',_0x1702e3,JSON['stringify'](_0x1fe318));_0x3bfc4f(_0x1fe318);})[_0xa145('0x16')](function(_0x3ff781){logger['error'](_0xa145('0x20'),_0x3ff781[_0xa145('0x14')],_0x1702e3);_0x1e419f(_0x145cd9[_0xa145('0x12')](0x1f4,_0x3ff781[_0xa145('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ad5793e..d5fbe5f 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 _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xac9d,0x14d));var _0xdac9=function(_0x24ca1f,_0x3d2164){_0x24ca1f=_0x24ca1f-0x0;var _0x5f4222=_0xac9d[_0x24ca1f];return _0x5f4222;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./smsTransferReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('0x13')]=router; \ No newline at end of file +var _0x61a5=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x61a5,0xf0));var _0x561a=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x61a5[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./smsTransferReport.controller');router[_0x561a('0x8')]('/',auth[_0x561a('0x9')](),controller[_0x561a('0xa')]);router[_0x561a('0x8')](_0x561a('0xb'),auth[_0x561a('0x9')](),controller[_0x561a('0xc')]);router['get'](_0x561a('0xd'),auth['isAuthenticated'](),controller[_0x561a('0xe')]);router[_0x561a('0xf')]('/',auth['isAuthenticated'](),controller[_0x561a('0x10')]);router[_0x561a('0x11')]('/:id',auth[_0x561a('0x9')](),controller['update']);router[_0x561a('0x12')](_0x561a('0xd'),auth[_0x561a('0x9')](),controller[_0x561a('0x13')]);module[_0x561a('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6d88e5b..5c4b479 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x356837,_0x124641){var _0x58010a=function(_0x5008ca){while(--_0x5008ca){_0x356837['push'](_0x356837['shift']());}};_0x58010a(++_0x124641);}(_0xe706,0xa3));var _0x6e70=function(_0x2e1821,_0x51f1be){_0x2e1821=_0x2e1821-0x0;var _0x53188c=_0xe706[_0x2e1821];return _0x53188c;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2e47c1,_0x1bed12){var _0x1a0364=function(_0x12cf22){while(--_0x12cf22){_0x2e47c1['push'](_0x2e47c1['shift']());}};_0x1a0364(++_0x1bed12);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 74b06e1..deaf803 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 _0x3461=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick'];(function(_0x1ac2b9,_0x495c25){var _0xe7898e=function(_0x4845b2){while(--_0x4845b2){_0x1ac2b9['push'](_0x1ac2b9['shift']());}};_0xe7898e(++_0x495c25);}(_0x3461,0x1b3));var _0x1346=function(_0x17ced9,_0x3a9f44){_0x17ced9=_0x17ced9-0x0;var _0x48678d=_0x3461[_0x17ced9];return _0x48678d;};'use strict';var emlformat=require(_0x1346('0x0'));var rimraf=require(_0x1346('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1346('0x2'));var util=require(_0x1346('0x3'));var path=require('path');var sox=require(_0x1346('0x4'));var csv=require(_0x1346('0x5'));var ejs=require(_0x1346('0x6'));var fs=require('fs');var fs_extra=require(_0x1346('0x7'));var _=require(_0x1346('0x8'));var squel=require(_0x1346('0x9'));var crypto=require(_0x1346('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1346('0xb'));var toCsv=require(_0x1346('0x5'));var querystring=require(_0x1346('0xc'));var Papa=require(_0x1346('0xd'));var Redis=require(_0x1346('0xe'));var authService=require(_0x1346('0xf'));var qs=require(_0x1346('0x10'));var as=require(_0x1346('0x11'));var hardwareService=require(_0x1346('0x12'));var logger=require('../../config/logger')(_0x1346('0x13'));var utils=require(_0x1346('0x14'));var config=require(_0x1346('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32e4d0,_0x3d638b){_0x3d638b=_0x3d638b||0xcc;return function(_0x5b2703){if(_0x5b2703){return _0x32e4d0[_0x1346('0x16')](_0x3d638b);}return _0x32e4d0[_0x1346('0x17')](_0x3d638b)[_0x1346('0x18')]();};}function respondWithResult(_0x527f9e,_0x504df1){_0x504df1=_0x504df1||0xc8;return function(_0x9d74c1){if(_0x9d74c1){return _0x527f9e[_0x1346('0x17')](_0x504df1)[_0x1346('0x19')](_0x9d74c1);}};}function respondWithFilteredResult(_0x5bb9f0,_0x45c037){return function(_0xd757a0){if(_0xd757a0){var _0x509ff9=typeof _0x45c037['offset']===_0x1346('0x1a')&&typeof _0x45c037[_0x1346('0x1b')]==='undefined';var _0x37afd0=_0xd757a0[_0x1346('0x1c')];var _0x2bcbe7=_0x509ff9?0x0:_0x45c037[_0x1346('0x1d')];var _0x3bd40d=_0x509ff9?_0xd757a0[_0x1346('0x1c')]:_0x45c037['offset']+_0x45c037[_0x1346('0x1b')];var _0x2ceabc;if(_0x3bd40d>=_0x37afd0){_0x3bd40d=_0x37afd0;_0x2ceabc=0xc8;}else{_0x2ceabc=0xce;}_0x5bb9f0[_0x1346('0x17')](_0x2ceabc);return _0x5bb9f0['set'](_0x1346('0x1e'),_0x2bcbe7+'-'+_0x3bd40d+'/'+_0x37afd0)[_0x1346('0x19')](_0xd757a0);}return null;};}function patchUpdates(_0x5915f9){return function(_0x735cad){try{jsonpatch['apply'](_0x735cad,_0x5915f9,!![]);}catch(_0xcd4d99){return BPromise['reject'](_0xcd4d99);}return _0x735cad[_0x1346('0x1f')]();};}function saveUpdates(_0x4e70c2,_0x3aa3bb){return function(_0x1647cc){if(_0x1647cc){return _0x1647cc[_0x1346('0x20')](_0x4e70c2)[_0x1346('0x21')](function(_0x2b48f0){return _0x2b48f0;});}return null;};}function removeEntity(_0x200759,_0x118de6){return function(_0xb8eb8b){if(_0xb8eb8b){return _0xb8eb8b['destroy']()[_0x1346('0x21')](function(){_0x200759[_0x1346('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1290b1,_0x44e32b){return function(_0x2a561a){if(!_0x2a561a){_0x1290b1[_0x1346('0x16')](0x194);}return _0x2a561a;};}function handleError(_0x31de82,_0x3aa650){_0x3aa650=_0x3aa650||0x1f4;return function(_0x4c4718){logger[_0x1346('0x22')](_0x4c4718[_0x1346('0x23')]);if(_0x4c4718[_0x1346('0x24')]){delete _0x4c4718[_0x1346('0x24')];}_0x31de82['status'](_0x3aa650)[_0x1346('0x25')](_0x4c4718);};}exports[_0x1346('0x26')]=function(_0x286dc9,_0x44fe32){var _0x264596={},_0x5b64fe={},_0x599dea={'count':0x0,'rows':[]};var _0x3aba71=_[_0x1346('0x27')](db[_0x1346('0x28')][_0x1346('0x29')],function(_0x3ba259){return{'name':_0x3ba259['fieldName'],'type':_0x3ba259[_0x1346('0x2a')]['key']};});_0x5b64fe[_0x1346('0x2b')]=_[_0x1346('0x27')](_0x3aba71,_0x1346('0x24'));_0x5b64fe[_0x1346('0x2c')]=_[_0x1346('0x2d')](_0x286dc9[_0x1346('0x2c')]);_0x5b64fe['filters']=_[_0x1346('0x2e')](_0x5b64fe['model'],_0x5b64fe[_0x1346('0x2c')]);_0x264596['attributes']=_[_0x1346('0x2e')](_0x5b64fe['model'],qs[_0x1346('0x2f')](_0x286dc9[_0x1346('0x2c')][_0x1346('0x2f')]));_0x264596[_0x1346('0x30')]=_0x264596[_0x1346('0x30')][_0x1346('0x31')]?_0x264596[_0x1346('0x30')]:_0x5b64fe[_0x1346('0x2b')];if(!_0x286dc9['query'][_0x1346('0x32')]('nolimit')){_0x264596[_0x1346('0x1b')]=qs[_0x1346('0x1b')](_0x286dc9['query'][_0x1346('0x1b')]);_0x264596[_0x1346('0x1d')]=qs[_0x1346('0x1d')](_0x286dc9[_0x1346('0x2c')]['offset']);}_0x264596['order']=qs[_0x1346('0x33')](_0x286dc9[_0x1346('0x2c')][_0x1346('0x33')]);_0x264596[_0x1346('0x34')]=qs[_0x1346('0x35')](_[_0x1346('0x36')](_0x286dc9[_0x1346('0x2c')],_0x5b64fe[_0x1346('0x35')]),_0x3aba71);if(_0x286dc9[_0x1346('0x2c')][_0x1346('0x37')]){_0x264596[_0x1346('0x34')]=_[_0x1346('0x38')](_0x264596['where'],{'$or':_[_0x1346('0x27')](_0x3aba71,function(_0x269b07){if(_0x269b07[_0x1346('0x2a')]!==_0x1346('0x39')){var _0x55c8a3={};_0x55c8a3[_0x269b07[_0x1346('0x24')]]={'$like':'%'+_0x286dc9['query'][_0x1346('0x37')]+'%'};return _0x55c8a3;}})});}_0x264596=_[_0x1346('0x38')]({},_0x264596,_0x286dc9['options']);var _0xc51052={'where':_0x264596[_0x1346('0x34')]};return db['SmsTransferReport'][_0x1346('0x1c')](_0xc51052)[_0x1346('0x21')](function(_0x1f7c5e){_0x599dea[_0x1346('0x1c')]=_0x1f7c5e;if(_0x286dc9[_0x1346('0x2c')][_0x1346('0x3a')]){_0x264596[_0x1346('0x3b')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x1346('0x3c')](_0x264596);})['then'](function(_0x511e51){_0x599dea[_0x1346('0x3d')]=_0x511e51;return _0x599dea;})[_0x1346('0x21')](respondWithFilteredResult(_0x44fe32,_0x264596))[_0x1346('0x3e')](handleError(_0x44fe32,null));};exports[_0x1346('0x3f')]=function(_0xa89c57,_0x346793){var _0x1bfcc9={'raw':!![],'where':{'id':_0xa89c57[_0x1346('0x40')]['id']}},_0x443832={};_0x443832['model']=_[_0x1346('0x2d')](db[_0x1346('0x28')][_0x1346('0x29')]);_0x443832[_0x1346('0x2c')]=_[_0x1346('0x2d')](_0xa89c57[_0x1346('0x2c')]);_0x443832['filters']=_[_0x1346('0x2e')](_0x443832[_0x1346('0x2b')],_0x443832[_0x1346('0x2c')]);_0x1bfcc9['attributes']=_[_0x1346('0x2e')](_0x443832[_0x1346('0x2b')],qs[_0x1346('0x2f')](_0xa89c57['query'][_0x1346('0x2f')]));_0x1bfcc9[_0x1346('0x30')]=_0x1bfcc9[_0x1346('0x30')][_0x1346('0x31')]?_0x1bfcc9[_0x1346('0x30')]:_0x443832[_0x1346('0x2b')];if(_0xa89c57[_0x1346('0x2c')]['includeAll']){_0x1bfcc9[_0x1346('0x3b')]=[{'all':!![]}];}_0x1bfcc9=_['merge']({},_0x1bfcc9,_0xa89c57['options']);return db[_0x1346('0x28')][_0x1346('0x41')](_0x1bfcc9)['then'](handleEntityNotFound(_0x346793,null))[_0x1346('0x21')](respondWithResult(_0x346793,null))[_0x1346('0x3e')](handleError(_0x346793,null));};exports[_0x1346('0x42')]=function(_0x1a08ff,_0x429e67){return db[_0x1346('0x28')][_0x1346('0x42')](_0x1a08ff[_0x1346('0x43')],{})[_0x1346('0x21')](respondWithResult(_0x429e67,0xc9))[_0x1346('0x3e')](handleError(_0x429e67,null));};exports[_0x1346('0x20')]=function(_0x26585f,_0x483fab){if(_0x26585f['body']['id']){delete _0x26585f[_0x1346('0x43')]['id'];}return db['SmsTransferReport'][_0x1346('0x41')]({'where':{'id':_0x26585f[_0x1346('0x40')]['id']}})[_0x1346('0x21')](handleEntityNotFound(_0x483fab,null))[_0x1346('0x21')](saveUpdates(_0x26585f[_0x1346('0x43')],null))[_0x1346('0x21')](respondWithResult(_0x483fab,null))[_0x1346('0x3e')](handleError(_0x483fab,null));};exports[_0x1346('0x44')]=function(_0x11d101,_0x5d3f11){return db[_0x1346('0x28')][_0x1346('0x41')]({'where':{'id':_0x11d101[_0x1346('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d3f11,null))[_0x1346('0x21')](removeEntity(_0x5d3f11,null))[_0x1346('0x3e')](handleError(_0x5d3f11,null));};exports[_0x1346('0x45')]=function(_0x49e0e9,_0x39f2eb){return db[_0x1346('0x28')]['describe']()[_0x1346('0x21')](respondWithResult(_0x39f2eb,null))[_0x1346('0x3e')](handleError(_0x39f2eb,null));}; \ No newline at end of file +var _0x0f72=['VIRTUAL','merge','options','include','findAll','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5236eb,_0x4093f0){var _0x193085=function(_0x49176d){while(--_0x49176d){_0x5236eb['push'](_0x5236eb['shift']());}};_0x193085(++_0x4093f0);}(_0x0f72,0x1d5));var _0x20f7=function(_0x1a4a14,_0x34a5df){_0x1a4a14=_0x1a4a14-0x0;var _0x506897=_0x0f72[_0x1a4a14];return _0x506897;};'use strict';var emlformat=require(_0x20f7('0x0'));var rimraf=require(_0x20f7('0x1'));var zipdir=require(_0x20f7('0x2'));var jsonpatch=require(_0x20f7('0x3'));var rp=require(_0x20f7('0x4'));var moment=require(_0x20f7('0x5'));var BPromise=require(_0x20f7('0x6'));var Mustache=require(_0x20f7('0x7'));var util=require('util');var path=require(_0x20f7('0x8'));var sox=require(_0x20f7('0x9'));var csv=require(_0x20f7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20f7('0xb'));var _=require('lodash');var squel=require(_0x20f7('0xc'));var crypto=require(_0x20f7('0xd'));var jsforce=require(_0x20f7('0xe'));var deskjs=require(_0x20f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x20f7('0x10'));var Papa=require(_0x20f7('0x11'));var Redis=require(_0x20f7('0x12'));var authService=require(_0x20f7('0x13'));var qs=require(_0x20f7('0x14'));var as=require(_0x20f7('0x15'));var hardwareService=require(_0x20f7('0x16'));var logger=require(_0x20f7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x20f7('0x18'));var licenseUtil=require(_0x20f7('0x19'));var db=require(_0x20f7('0x1a'))['db'];function respondWithStatusCode(_0x4914a4,_0x1aee03){_0x1aee03=_0x1aee03||0xcc;return function(_0x4f365e){if(_0x4f365e){return _0x4914a4[_0x20f7('0x1b')](_0x1aee03);}return _0x4914a4[_0x20f7('0x1c')](_0x1aee03)['end']();};}function respondWithResult(_0x577197,_0xf1efee){_0xf1efee=_0xf1efee||0xc8;return function(_0x4d9643){if(_0x4d9643){return _0x577197[_0x20f7('0x1c')](_0xf1efee)['json'](_0x4d9643);}};}function respondWithFilteredResult(_0x5bf075,_0x5c82f2){return function(_0x702920){if(_0x702920){var _0x4682ef=typeof _0x5c82f2[_0x20f7('0x1d')]===_0x20f7('0x1e')&&typeof _0x5c82f2[_0x20f7('0x1f')]===_0x20f7('0x1e');var _0x162459=_0x702920[_0x20f7('0x20')];var _0x453018=_0x4682ef?0x0:_0x5c82f2[_0x20f7('0x1d')];var _0x2b17ea=_0x4682ef?_0x702920['count']:_0x5c82f2[_0x20f7('0x1d')]+_0x5c82f2[_0x20f7('0x1f')];var _0x3ac1d8;if(_0x2b17ea>=_0x162459){_0x2b17ea=_0x162459;_0x3ac1d8=0xc8;}else{_0x3ac1d8=0xce;}_0x5bf075[_0x20f7('0x1c')](_0x3ac1d8);return _0x5bf075[_0x20f7('0x21')]('Content-Range',_0x453018+'-'+_0x2b17ea+'/'+_0x162459)['json'](_0x702920);}return null;};}function patchUpdates(_0x127361){return function(_0x112ae6){try{jsonpatch[_0x20f7('0x22')](_0x112ae6,_0x127361,!![]);}catch(_0x1398f0){return BPromise[_0x20f7('0x23')](_0x1398f0);}return _0x112ae6['save']();};}function saveUpdates(_0x1e8421,_0x3aba7f){return function(_0x3d1b34){if(_0x3d1b34){return _0x3d1b34[_0x20f7('0x24')](_0x1e8421)[_0x20f7('0x25')](function(_0x405917){return _0x405917;});}return null;};}function removeEntity(_0x4201f3,_0x419357){return function(_0x275bf4){if(_0x275bf4){return _0x275bf4[_0x20f7('0x26')]()[_0x20f7('0x25')](function(){_0x4201f3[_0x20f7('0x1c')](0xcc)[_0x20f7('0x27')]();});}};}function handleEntityNotFound(_0x4e72a9,_0xe0aad4){return function(_0x163856){if(!_0x163856){_0x4e72a9[_0x20f7('0x1b')](0x194);}return _0x163856;};}function handleError(_0x424d79,_0x33adbc){_0x33adbc=_0x33adbc||0x1f4;return function(_0x3d4beb){logger[_0x20f7('0x28')](_0x3d4beb[_0x20f7('0x29')]);if(_0x3d4beb[_0x20f7('0x2a')]){delete _0x3d4beb[_0x20f7('0x2a')];}_0x424d79[_0x20f7('0x1c')](_0x33adbc)[_0x20f7('0x2b')](_0x3d4beb);};}exports[_0x20f7('0x2c')]=function(_0x3074b7,_0x61f293){var _0x2b8590={},_0x43f0bf={},_0x5a892b={'count':0x0,'rows':[]};var _0x1ff865=_[_0x20f7('0x2d')](db[_0x20f7('0x2e')][_0x20f7('0x2f')],function(_0x635d1d){return{'name':_0x635d1d[_0x20f7('0x30')],'type':_0x635d1d[_0x20f7('0x31')]['key']};});_0x43f0bf[_0x20f7('0x32')]=_['map'](_0x1ff865,_0x20f7('0x2a'));_0x43f0bf[_0x20f7('0x33')]=_['keys'](_0x3074b7[_0x20f7('0x33')]);_0x43f0bf['filters']=_[_0x20f7('0x34')](_0x43f0bf['model'],_0x43f0bf[_0x20f7('0x33')]);_0x2b8590[_0x20f7('0x35')]=_[_0x20f7('0x34')](_0x43f0bf[_0x20f7('0x32')],qs[_0x20f7('0x36')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x36')]));_0x2b8590[_0x20f7('0x35')]=_0x2b8590['attributes'][_0x20f7('0x37')]?_0x2b8590[_0x20f7('0x35')]:_0x43f0bf[_0x20f7('0x32')];if(!_0x3074b7[_0x20f7('0x33')]['hasOwnProperty'](_0x20f7('0x38'))){_0x2b8590['limit']=qs[_0x20f7('0x1f')](_0x3074b7[_0x20f7('0x33')]['limit']);_0x2b8590[_0x20f7('0x1d')]=qs[_0x20f7('0x1d')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x1d')]);}_0x2b8590[_0x20f7('0x39')]=qs[_0x20f7('0x3a')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x3a')]);_0x2b8590[_0x20f7('0x3b')]=qs[_0x20f7('0x3c')](_[_0x20f7('0x3d')](_0x3074b7[_0x20f7('0x33')],_0x43f0bf[_0x20f7('0x3c')]),_0x1ff865);if(_0x3074b7['query'][_0x20f7('0x3e')]){_0x2b8590[_0x20f7('0x3b')]=_['merge'](_0x2b8590[_0x20f7('0x3b')],{'$or':_[_0x20f7('0x2d')](_0x1ff865,function(_0x2743a8){if(_0x2743a8[_0x20f7('0x31')]!==_0x20f7('0x3f')){var _0x2c01cc={};_0x2c01cc[_0x2743a8[_0x20f7('0x2a')]]={'$like':'%'+_0x3074b7[_0x20f7('0x33')]['filter']+'%'};return _0x2c01cc;}})});}_0x2b8590=_[_0x20f7('0x40')]({},_0x2b8590,_0x3074b7[_0x20f7('0x41')]);var _0x19a201={'where':_0x2b8590['where']};return db[_0x20f7('0x2e')][_0x20f7('0x20')](_0x19a201)[_0x20f7('0x25')](function(_0xdb4465){_0x5a892b[_0x20f7('0x20')]=_0xdb4465;if(_0x3074b7[_0x20f7('0x33')]['includeAll']){_0x2b8590[_0x20f7('0x42')]=[{'all':!![]}];}return db[_0x20f7('0x2e')][_0x20f7('0x43')](_0x2b8590);})[_0x20f7('0x25')](function(_0x5ca700){_0x5a892b['rows']=_0x5ca700;return _0x5a892b;})[_0x20f7('0x25')](respondWithFilteredResult(_0x61f293,_0x2b8590))['catch'](handleError(_0x61f293,null));};exports[_0x20f7('0x44')]=function(_0x5e3f40,_0x14588a){var _0x28c977={'raw':!![],'where':{'id':_0x5e3f40[_0x20f7('0x45')]['id']}},_0x2f3bf2={};_0x2f3bf2['model']=_[_0x20f7('0x46')](db[_0x20f7('0x2e')][_0x20f7('0x2f')]);_0x2f3bf2[_0x20f7('0x33')]=_[_0x20f7('0x46')](_0x5e3f40[_0x20f7('0x33')]);_0x2f3bf2[_0x20f7('0x3c')]=_[_0x20f7('0x34')](_0x2f3bf2['model'],_0x2f3bf2[_0x20f7('0x33')]);_0x28c977[_0x20f7('0x35')]=_[_0x20f7('0x34')](_0x2f3bf2[_0x20f7('0x32')],qs[_0x20f7('0x36')](_0x5e3f40[_0x20f7('0x33')][_0x20f7('0x36')]));_0x28c977[_0x20f7('0x35')]=_0x28c977[_0x20f7('0x35')][_0x20f7('0x37')]?_0x28c977[_0x20f7('0x35')]:_0x2f3bf2['model'];if(_0x5e3f40['query']['includeAll']){_0x28c977[_0x20f7('0x42')]=[{'all':!![]}];}_0x28c977=_[_0x20f7('0x40')]({},_0x28c977,_0x5e3f40[_0x20f7('0x41')]);return db['SmsTransferReport'][_0x20f7('0x47')](_0x28c977)[_0x20f7('0x25')](handleEntityNotFound(_0x14588a,null))[_0x20f7('0x25')](respondWithResult(_0x14588a,null))[_0x20f7('0x48')](handleError(_0x14588a,null));};exports[_0x20f7('0x49')]=function(_0x4abec5,_0x5554f9){return db[_0x20f7('0x2e')][_0x20f7('0x49')](_0x4abec5[_0x20f7('0x4a')],{})[_0x20f7('0x25')](respondWithResult(_0x5554f9,0xc9))['catch'](handleError(_0x5554f9,null));};exports[_0x20f7('0x24')]=function(_0x25543c,_0x1e02a8){if(_0x25543c['body']['id']){delete _0x25543c[_0x20f7('0x4a')]['id'];}return db['SmsTransferReport'][_0x20f7('0x47')]({'where':{'id':_0x25543c['params']['id']}})[_0x20f7('0x25')](handleEntityNotFound(_0x1e02a8,null))[_0x20f7('0x25')](saveUpdates(_0x25543c[_0x20f7('0x4a')],null))[_0x20f7('0x25')](respondWithResult(_0x1e02a8,null))[_0x20f7('0x48')](handleError(_0x1e02a8,null));};exports[_0x20f7('0x26')]=function(_0x15919a,_0x406a66){return db[_0x20f7('0x2e')]['find']({'where':{'id':_0x15919a['params']['id']}})['then'](handleEntityNotFound(_0x406a66,null))[_0x20f7('0x25')](removeEntity(_0x406a66,null))['catch'](handleError(_0x406a66,null));};exports['describe']=function(_0x44f8ea,_0x551123){return db[_0x20f7('0x2e')][_0x20f7('0x4b')]()['then'](respondWithResult(_0x551123,null))['catch'](handleError(_0x551123,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 47c6794..74d1fcc 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 _0x1f63=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','exports','SmsTransferReport','report_sms_transfer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1f63,0x7a));var _0x31f6=function(_0x1e6d6e,_0x5a0b52){_0x1e6d6e=_0x1e6d6e-0x0;var _0x2322a0=_0x1f63[_0x1e6d6e];return _0x2322a0;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require('../../config/logger')(_0x31f6('0x2'));var moment=require(_0x31f6('0x3'));var BPromise=require(_0x31f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31f6('0x5'));var rimraf=require(_0x31f6('0x6'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x31f6('0x7')]=function(_0x11250b,_0xe8437e){return _0x11250b['define'](_0x31f6('0x8'),attributes,{'tableName':_0x31f6('0x9'),'paranoid':![],'indexes':[{'name':_0x31f6('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbda9=['api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x54fff0,_0x5146fe){var _0x1b5524=function(_0x1f4ad6){while(--_0x1f4ad6){_0x54fff0['push'](_0x54fff0['shift']());}};_0x1b5524(++_0x5146fe);}(_0xbda9,0x101));var _0x9bda=function(_0x5db7f2,_0x3d4bc9){_0x5db7f2=_0x5db7f2-0x0;var _0x1bacf9=_0xbda9[_0x5db7f2];return _0x1bacf9;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var logger=require(_0x9bda('0x2'))(_0x9bda('0x3'));var moment=require(_0x9bda('0x4'));var BPromise=require(_0x9bda('0x5'));var rp=require(_0x9bda('0x6'));var fs=require('fs');var path=require(_0x9bda('0x7'));var rimraf=require(_0x9bda('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bda('0x9'));module[_0x9bda('0xa')]=function(_0x26544e,_0x4d2979){return _0x26544e[_0x9bda('0xb')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x9bda('0xc'),'fields':[_0x9bda('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2d59d8e..eb35c88 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 _0xc92f=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x3676fc,_0x369252){var _0x305fa1=function(_0x21b996){while(--_0x21b996){_0x3676fc['push'](_0x3676fc['shift']());}};_0x305fa1(++_0x369252);}(_0xc92f,0xf3));var _0xfc92=function(_0x350201,_0x2228ac){_0x350201=_0x350201-0x0;var _0xabe9f3=_0xc92f[_0x350201];return _0xabe9f3;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var moment=require('moment');var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc92('0x5'));var logger=require(_0xfc92('0x6'))(_0xfc92('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc92('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394026,_0x4e578a,_0xd80968){return new BPromise(function(_0x49db29,_0x432982){return client[_0xfc92('0x9')](_0x394026,_0xd80968)[_0xfc92('0xa')](function(_0x4f37f2){logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));logger['debug'](_0xfc92('0xe'),_0x4e578a,_0xfc92('0xd'),JSON[_0xfc92('0xf')](_0x4f37f2));if(_0x4f37f2[_0xfc92('0x10')]){if(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x11')]===0x1f4){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);return _0x432982(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4e578a,_0x4f37f2['error'][_0xfc92('0x12')]);return _0x49db29(_0x4f37f2[_0xfc92('0x10')]['message']);}else{logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));_0x49db29(_0x4f37f2[_0xfc92('0x13')][_0xfc92('0x12')]);}})[_0xfc92('0x14')](function(_0x492d40){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x492d40);_0x432982(_0x492d40);});});} \ No newline at end of file +var _0xc9b9=['debug','stringify','code','SmsTransferReport,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','rpc','http','request','then','info','request\x20sent'];(function(_0x18227e,_0x30cd35){var _0x3954e6=function(_0x1fe980){while(--_0x1fe980){_0x18227e['push'](_0x18227e['shift']());}};_0x3954e6(++_0x30cd35);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xc9b9[_0x3598bb];return _0x13c837;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c9b('0x0'));var BPromise=require(_0x9c9b('0x1'));var rs=require(_0x9c9b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c9b('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9c9b('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x15d94b,_0x13060c,_0x193305){return new BPromise(function(_0xbbd998,_0x5e0081){return client[_0x9c9b('0x5')](_0x15d94b,_0x193305)[_0x9c9b('0x6')](function(_0x2a2178){logger[_0x9c9b('0x7')]('SmsTransferReport,\x20%s,\x20%s',_0x13060c,_0x9c9b('0x8'));logger[_0x9c9b('0x9')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x13060c,_0x9c9b('0x8'),JSON[_0x9c9b('0xa')](_0x2a2178));if(_0x2a2178['error']){if(_0x2a2178['error'][_0x9c9b('0xb')]===0x1f4){logger['error'](_0x9c9b('0xc'),_0x13060c,_0x2a2178[_0x9c9b('0xd')]['message']);return _0x5e0081(_0x2a2178['error']['message']);}logger['error'](_0x9c9b('0xc'),_0x13060c,_0x2a2178[_0x9c9b('0xd')]['message']);return _0xbbd998(_0x2a2178[_0x9c9b('0xd')][_0x9c9b('0xe')]);}else{logger['info'](_0x9c9b('0xc'),_0x13060c,_0x9c9b('0x8'));_0xbbd998(_0x2a2178[_0x9c9b('0xf')][_0x9c9b('0xe')]);}})[_0x9c9b('0x10')](function(_0x299221){logger[_0x9c9b('0xd')](_0x9c9b('0xc'),_0x13060c,_0x299221);_0x5e0081(_0x299221);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4147344..744c4b3 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 _0x3091=['single','file','create','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3091,0x19b));var _0x1309=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3091[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1309('0x0'));var util=require(_0x1309('0x1'));var path=require(_0x1309('0x2'));var timeout=require(_0x1309('0x3'));var express=require('express');var router=express[_0x1309('0x4')]();var fs_extra=require(_0x1309('0x5'));var auth=require(_0x1309('0x6'));var interaction=require(_0x1309('0x7'));var config=require(_0x1309('0x8'));var controller=require(_0x1309('0x9'));router[_0x1309('0xa')]('/',auth[_0x1309('0xb')](),controller[_0x1309('0xc')]);router['get'](_0x1309('0xd'),auth['isAuthenticated'](),controller[_0x1309('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1309('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x389217,_0x1f4729,_0x567e44){_0x567e44(null,path['join'](config[_0x1309('0x10')],_0x1309('0x11')));},'filename':function(_0x514cf6,_0x11c22b,_0x4f9322){_0x11c22b[_0x1309('0x12')]=_0x11c22b[_0x1309('0x12')][_0x1309('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f9322(null,util['format'](_0x1309('0x14'),path[_0x1309('0x15')](_0x11c22b[_0x1309('0x12')],path['extname'](_0x11c22b[_0x1309('0x12')])),Date['now'](),path[_0x1309('0x16')](_0x11c22b[_0x1309('0x12')])));}})});router[_0x1309('0x17')]('/',upload[_0x1309('0x18')](_0x1309('0x19')),controller[_0x1309('0x1a')]);router['put'](_0x1309('0xd'),auth[_0x1309('0xb')](),controller[_0x1309('0x1b')]);router[_0x1309('0x1c')](_0x1309('0xd'),auth[_0x1309('0xb')](),controller[_0x1309('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb39d=['format','extname','now','post','single','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0x486e6f,_0x395450){var _0x104212=function(_0x368754){while(--_0x368754){_0x486e6f['push'](_0x486e6f['shift']());}};_0x104212(++_0x395450);}(_0xb39d,0x81));var _0xdb39=function(_0x10d358,_0x594e73){_0x10d358=_0x10d358-0x0;var _0x549c73=_0xb39d[_0x10d358];return _0x549c73;};'use strict';var multer=require('multer');var util=require(_0xdb39('0x0'));var path=require(_0xdb39('0x1'));var timeout=require(_0xdb39('0x2'));var express=require(_0xdb39('0x3'));var router=express[_0xdb39('0x4')]();var fs_extra=require(_0xdb39('0x5'));var auth=require(_0xdb39('0x6'));var interaction=require(_0xdb39('0x7'));var config=require(_0xdb39('0x8'));var controller=require(_0xdb39('0x9'));router[_0xdb39('0xa')]('/',auth[_0xdb39('0xb')](),controller[_0xdb39('0xc')]);router[_0xdb39('0xa')](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller['show']);router[_0xdb39('0xa')](_0xdb39('0xe'),auth[_0xdb39('0xb')](),controller[_0xdb39('0xf')]);var upload=multer({'storage':multer[_0xdb39('0x10')]({'destination':function(_0x19d79c,_0x957cd9,_0x61886d){_0x61886d(null,path['join'](config[_0xdb39('0x11')],_0xdb39('0x12')));},'filename':function(_0x6dadd1,_0x2ac5c2,_0x595332){_0x2ac5c2[_0xdb39('0x13')]=_0x2ac5c2[_0xdb39('0x13')][_0xdb39('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x595332(null,util[_0xdb39('0x15')]('%s-%s%s',path['basename'](_0x2ac5c2[_0xdb39('0x13')],path[_0xdb39('0x16')](_0x2ac5c2[_0xdb39('0x13')])),Date[_0xdb39('0x17')](),path[_0xdb39('0x16')](_0x2ac5c2['originalname'])));}})});router[_0xdb39('0x18')]('/',upload[_0xdb39('0x19')]('file'),controller[_0xdb39('0x1a')]);router['put'](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller[_0xdb39('0x1b')]);router[_0xdb39('0x1c')](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller[_0xdb39('0x1c')]);module[_0xdb39('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6dbeedc..b159b78 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 _0xb1c8=['sequelize','exports','STRING','BIGINT','INTEGER','FLOAT'];(function(_0x5e8e29,_0x3a0cd1){var _0x128aa1=function(_0x3e48e9){while(--_0x3e48e9){_0x5e8e29['push'](_0x5e8e29['shift']());}};_0x128aa1(++_0x3a0cd1);}(_0xb1c8,0x114));var _0x8b1c=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xb1c8[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0x8b1c('0x0'));module[_0x8b1c('0x1')]={'name':{'type':Sequelize[_0x8b1c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x8b1c('0x2')]},'display_name':{'type':Sequelize[_0x8b1c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x8b1c('0x2')]},'original_format':{'type':Sequelize[_0x8b1c('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x8b1c('0x3')]},'original_channelCount':{'type':Sequelize[_0x8b1c('0x4')]},'original_bitRate':{'type':Sequelize[_0x8b1c('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x8b1c('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x8b1c('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0d8d=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x592238,_0xc8ff1e){_0x592238=_0x592238-0x0;var _0x4bdf33=_0x0d8d[_0x592238];return _0x4bdf33;};'use strict';var Sequelize=require(_0xd0d8('0x0'));module[_0xd0d8('0x1')]={'name':{'type':Sequelize[_0xd0d8('0x2')],'unique':_0xd0d8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd0d8('0x2')]},'display_name':{'type':Sequelize[_0xd0d8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd0d8('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xd0d8('0x4')]},'original_sampleCount':{'type':Sequelize[_0xd0d8('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd0d8('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd0d8('0x5')]},'converted_channelCount':{'type':Sequelize[_0xd0d8('0x6')]},'converted_bitRate':{'type':Sequelize[_0xd0d8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xd0d8('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a609552..75e092b 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 _0x1862=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','save_name','existsSync','join','root','converted_format','Sequelize','download','format','%s.%s','create','basename','file','originalname','extname','substring','wav','filename','info','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','role','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','start','description','delete','original_format','server/files/sounds/converted','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields'];(function(_0x30fa9d,_0x88c6ee){var _0x5ef4e8=function(_0x4bf428){while(--_0x4bf428){_0x30fa9d['push'](_0x30fa9d['shift']());}};_0x5ef4e8(++_0x88c6ee);}(_0x1862,0x13a));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2186('0x0'));var rimraf=require(_0x2186('0x1'));var zipdir=require(_0x2186('0x2'));var jsonpatch=require(_0x2186('0x3'));var rp=require(_0x2186('0x4'));var moment=require(_0x2186('0x5'));var BPromise=require(_0x2186('0x6'));var Mustache=require(_0x2186('0x7'));var util=require(_0x2186('0x8'));var path=require(_0x2186('0x9'));var sox=require(_0x2186('0xa'));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(_0x2186('0xb'));var crypto=require(_0x2186('0xc'));var jsforce=require(_0x2186('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2186('0xe'));var Papa=require(_0x2186('0xf'));var Redis=require(_0x2186('0x10'));var authService=require(_0x2186('0x11'));var qs=require(_0x2186('0x12'));var as=require(_0x2186('0x13'));var hardwareService=require(_0x2186('0x14'));var logger=require(_0x2186('0x15'))(_0x2186('0x16'));var utils=require(_0x2186('0x17'));var config=require(_0x2186('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5936,_0x3f0b29){_0x3f0b29=_0x3f0b29||0xcc;return function(_0x3118a5){if(_0x3118a5){return _0x5c5936[_0x2186('0x19')](_0x3f0b29);}return _0x5c5936[_0x2186('0x1a')](_0x3f0b29)[_0x2186('0x1b')]();};}function respondWithResult(_0x3d30cc,_0x1afe5c){_0x1afe5c=_0x1afe5c||0xc8;return function(_0x1db98b){if(_0x1db98b){return _0x3d30cc[_0x2186('0x1a')](_0x1afe5c)[_0x2186('0x1c')](_0x1db98b);}};}function respondWithFilteredResult(_0x31c4cb,_0x5717ea){return function(_0x175d82){if(_0x175d82){var _0x5ad19d=typeof _0x5717ea[_0x2186('0x1d')]===_0x2186('0x1e')&&typeof _0x5717ea[_0x2186('0x1f')]===_0x2186('0x1e');var _0x271852=_0x175d82[_0x2186('0x20')];var _0x56e83c=_0x5ad19d?0x0:_0x5717ea[_0x2186('0x1d')];var _0x3c71ac=_0x5ad19d?_0x175d82[_0x2186('0x20')]:_0x5717ea['offset']+_0x5717ea['limit'];var _0x2b2be7;if(_0x3c71ac>=_0x271852){_0x3c71ac=_0x271852;_0x2b2be7=0xc8;}else{_0x2b2be7=0xce;}_0x31c4cb[_0x2186('0x1a')](_0x2b2be7);return _0x31c4cb[_0x2186('0x21')](_0x2186('0x22'),_0x56e83c+'-'+_0x3c71ac+'/'+_0x271852)['json'](_0x175d82);}return null;};}function patchUpdates(_0x559e2f){return function(_0x40dc89){try{jsonpatch[_0x2186('0x23')](_0x40dc89,_0x559e2f,!![]);}catch(_0x2e36a2){return BPromise['reject'](_0x2e36a2);}return _0x40dc89[_0x2186('0x24')]();};}function saveUpdates(_0x546102,_0x2e8eef){return function(_0x578684){if(_0x578684){return _0x578684[_0x2186('0x25')](_0x546102)[_0x2186('0x26')](function(_0x324507){return _0x324507;});}return null;};}function removeEntity(_0x2dda25,_0x252af4){return function(_0x469fc9){if(_0x469fc9){return _0x469fc9['destroy']()[_0x2186('0x26')](function(){var _0x5dec20=_0x469fc9[_0x2186('0x27')]({'plain':!![]});var _0x23c682='Sounds';return db['UserProfileResource'][_0x2186('0x28')]({'where':{'type':_0x23c682,'resourceId':_0x5dec20['id']}})[_0x2186('0x26')](function(){return _0x469fc9;});})[_0x2186('0x26')](function(){_0x2dda25[_0x2186('0x1a')](0xcc)[_0x2186('0x1b')]();});}};}function handleEntityNotFound(_0x3f07d0,_0x43802c){return function(_0x52f50a){if(!_0x52f50a){_0x3f07d0[_0x2186('0x19')](0x194);}return _0x52f50a;};}function handleError(_0x4b94d1,_0x2d2e9c){_0x2d2e9c=_0x2d2e9c||0x1f4;return function(_0xf8b418){logger[_0x2186('0x29')](_0xf8b418[_0x2186('0x2a')]);if(_0xf8b418['name']){delete _0xf8b418[_0x2186('0x2b')];}_0x4b94d1[_0x2186('0x1a')](_0x2d2e9c)[_0x2186('0x2c')](_0xf8b418);};}exports[_0x2186('0x2d')]=function(_0x3631bf,_0x6f058){var _0xa53389={},_0x505989={},_0x43b685={'count':0x0,'rows':[]};var _0x97e9ac=_['map'](db[_0x2186('0x2e')][_0x2186('0x2f')],function(_0x66425e){return{'name':_0x66425e[_0x2186('0x30')],'type':_0x66425e[_0x2186('0x31')][_0x2186('0x32')]};});_0x505989['model']=_[_0x2186('0x33')](_0x97e9ac,_0x2186('0x2b'));_0x505989[_0x2186('0x34')]=_['keys'](_0x3631bf[_0x2186('0x34')]);_0x505989[_0x2186('0x35')]=_['intersection'](_0x505989['model'],_0x505989['query']);_0xa53389[_0x2186('0x36')]=_[_0x2186('0x37')](_0x505989[_0x2186('0x38')],qs[_0x2186('0x39')](_0x3631bf['query'][_0x2186('0x39')]));_0xa53389[_0x2186('0x36')]=_0xa53389[_0x2186('0x36')][_0x2186('0x3a')]?_0xa53389[_0x2186('0x36')]:_0x505989['model'];if(!_0x3631bf[_0x2186('0x34')][_0x2186('0x3b')]('nolimit')){_0xa53389[_0x2186('0x1f')]=qs[_0x2186('0x1f')](_0x3631bf[_0x2186('0x34')]['limit']);_0xa53389[_0x2186('0x1d')]=qs['offset'](_0x3631bf[_0x2186('0x34')][_0x2186('0x1d')]);}_0xa53389[_0x2186('0x3c')]=qs[_0x2186('0x3d')](_0x3631bf[_0x2186('0x34')][_0x2186('0x3d')]);_0xa53389[_0x2186('0x3e')]=qs[_0x2186('0x35')](_[_0x2186('0x3f')](_0x3631bf[_0x2186('0x34')],_0x505989['filters']),_0x97e9ac);if(_0x3631bf[_0x2186('0x34')][_0x2186('0x40')]){_0xa53389[_0x2186('0x3e')]=_[_0x2186('0x41')](_0xa53389[_0x2186('0x3e')],{'$or':_[_0x2186('0x33')](_0x97e9ac,function(_0x557348){if(_0x557348[_0x2186('0x31')]!==_0x2186('0x42')){var _0x8272c6={};_0x8272c6[_0x557348[_0x2186('0x2b')]]={'$like':'%'+_0x3631bf['query'][_0x2186('0x40')]+'%'};return _0x8272c6;}})});}_0xa53389=_[_0x2186('0x41')]({},_0xa53389,_0x3631bf[_0x2186('0x43')]);var _0x4d275a={'where':_0xa53389[_0x2186('0x3e')]};return db['Sound'][_0x2186('0x20')](_0x4d275a)[_0x2186('0x26')](function(_0x3461ce){_0x43b685[_0x2186('0x20')]=_0x3461ce;if(_0x3631bf['query'][_0x2186('0x44')]){_0xa53389[_0x2186('0x45')]=[{'all':!![]}];}return db[_0x2186('0x2e')]['findAll'](_0xa53389);})[_0x2186('0x26')](function(_0x55653b){_0x43b685['rows']=_0x55653b;return _0x43b685;})['then'](respondWithFilteredResult(_0x6f058,_0xa53389))[_0x2186('0x46')](handleError(_0x6f058,null));};exports[_0x2186('0x47')]=function(_0x3a1ed6,_0x17150a){var _0x1d4580={'raw':!![],'where':{'id':_0x3a1ed6[_0x2186('0x48')]['id']}},_0x2d91f0={};_0x2d91f0[_0x2186('0x38')]=_['keys'](db[_0x2186('0x2e')]['rawAttributes']);_0x2d91f0[_0x2186('0x34')]=_[_0x2186('0x49')](_0x3a1ed6[_0x2186('0x34')]);_0x2d91f0['filters']=_['intersection'](_0x2d91f0['model'],_0x2d91f0[_0x2186('0x34')]);_0x1d4580[_0x2186('0x36')]=_['intersection'](_0x2d91f0['model'],qs[_0x2186('0x39')](_0x3a1ed6[_0x2186('0x34')][_0x2186('0x39')]));_0x1d4580[_0x2186('0x36')]=_0x1d4580[_0x2186('0x36')][_0x2186('0x3a')]?_0x1d4580['attributes']:_0x2d91f0['model'];if(_0x3a1ed6[_0x2186('0x34')][_0x2186('0x44')]){_0x1d4580['include']=[{'all':!![]}];}_0x1d4580=_[_0x2186('0x41')]({},_0x1d4580,_0x3a1ed6[_0x2186('0x43')]);return db[_0x2186('0x2e')][_0x2186('0x4a')](_0x1d4580)[_0x2186('0x26')](handleEntityNotFound(_0x17150a,null))[_0x2186('0x26')](respondWithResult(_0x17150a,null))[_0x2186('0x46')](handleError(_0x17150a,null));};exports['download']=function(_0x41d2f7,_0x5398a6,_0x325eb8){return db[_0x2186('0x2e')][_0x2186('0x4a')]({'where':{'id':_0x41d2f7[_0x2186('0x48')]['id']},'attributes':[_0x2186('0x2b'),_0x2186('0x4b'),'converted_format'],'raw':!![]})[_0x2186('0x26')](handleEntityNotFound(_0x5398a6,null))[_0x2186('0x26')](function(_0x1fc9b5){if(_0x1fc9b5){if(!fs[_0x2186('0x4c')](path[_0x2186('0x4d')](config[_0x2186('0x4e')],'server/files/sounds/converted',_0x1fc9b5[_0x2186('0x4b')]+'.'+_0x1fc9b5[_0x2186('0x4f')]))){throw new db[(_0x2186('0x50'))]['ValidationError']('Sound\x20not\x20found');}return _0x5398a6[_0x2186('0x51')](path['join'](config['root'],'server/files/sounds/converted',util[_0x2186('0x52')](_0x2186('0x53'),_0x1fc9b5['save_name'],_0x1fc9b5[_0x2186('0x4f')])),util['format'](_0x2186('0x53'),_0x1fc9b5[_0x2186('0x2b')],_0x1fc9b5[_0x2186('0x4f')]));}return null;})[_0x2186('0x46')](handleError(_0x5398a6,null));};exports[_0x2186('0x54')]=function(_0x522cfb,_0x2875ce,_0x4befc4){var _0x40167c={'name':path[_0x2186('0x55')](_0x522cfb[_0x2186('0x56')][_0x2186('0x57')],path[_0x2186('0x58')](_0x522cfb['file'][_0x2186('0x57')])),'save_name':path[_0x2186('0x55')](_0x522cfb[_0x2186('0x56')]['filename'],path['extname'](_0x522cfb[_0x2186('0x56')]['filename'])),'original_format':path[_0x2186('0x58')](_0x522cfb[_0x2186('0x56')]['originalname'])[_0x2186('0x59')](0x1),'converted_format':_0x2186('0x5a')};var _0x3a85cc=path[_0x2186('0x4d')](config[_0x2186('0x4e')],'server/files/sounds/original',_0x522cfb[_0x2186('0x56')]['filename']);var _0x5b7b39=path[_0x2186('0x4d')](config[_0x2186('0x4e')],'server/files/sounds/converted',util[_0x2186('0x52')](_0x2186('0x53'),path[_0x2186('0x55')](_0x522cfb[_0x2186('0x56')][_0x2186('0x5b')],path[_0x2186('0x58')](_0x522cfb[_0x2186('0x56')]['filename'])),_0x40167c[_0x2186('0x4f')]));logger[_0x2186('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x3a85cc);logger[_0x2186('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x5b7b39);try{fs[_0x2186('0x5d')](_0x3a85cc,parseInt(_0x2186('0x5e'),0x8));var _0xc25638=sox[_0x2186('0x5f')](_0x3a85cc,_0x5b7b39,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xc25638['on'](_0x2186('0x29'),function(_0x3756df){fs[_0x2186('0x60')](_0x3a85cc);_0x2875ce[_0x2186('0x1a')](0x1f4)[_0x2186('0x2c')](_0x3756df);});_0xc25638['on'](_0x2186('0x61'),function(_0x31d87c){_0x40167c['original_duration']=isNaN(_0x31d87c[_0x2186('0x62')])?null:_0x31d87c[_0x2186('0x62')]*0x3e8;_0x40167c[_0x2186('0x63')]=isNaN(_0x31d87c[_0x2186('0x64')])?null:_0x31d87c[_0x2186('0x64')];_0x40167c['original_channelCount']=isNaN(_0x31d87c[_0x2186('0x65')])?null:_0x31d87c[_0x2186('0x65')];_0x40167c[_0x2186('0x66')]=isNaN(_0x31d87c[_0x2186('0x67')])?null:_0x31d87c[_0x2186('0x67')];_0x40167c['original_sampleRate']=isNaN(_0x31d87c[_0x2186('0x68')])?null:_0x31d87c[_0x2186('0x68')];});_0xc25638['on'](_0x2186('0x69'),function(_0x5a4031){_0x40167c[_0x2186('0x6a')]=isNaN(_0x5a4031[_0x2186('0x62')])?null:_0x5a4031[_0x2186('0x62')]*0x3e8;_0x40167c[_0x2186('0x6b')]=isNaN(_0x5a4031['sampleCount'])?null:_0x5a4031[_0x2186('0x64')];_0x40167c[_0x2186('0x6c')]=isNaN(_0x5a4031[_0x2186('0x65')])?null:_0x5a4031['channelCount'];_0x40167c[_0x2186('0x6d')]=isNaN(_0x5a4031['bitRate'])?null:_0x5a4031['bitRate'];_0x40167c[_0x2186('0x6e')]=isNaN(_0x5a4031[_0x2186('0x68')])?null:_0x5a4031[_0x2186('0x68')];});_0xc25638['on'](_0x2186('0x1b'),function(){fs[_0x2186('0x5d')](_0x5b7b39,parseInt(_0x2186('0x5e'),0x8));return db['Sound'][_0x2186('0x54')](_0x40167c)[_0x2186('0x26')](function(_0x7925e3){var _0xd36738={'role':_0x522cfb[_0x2186('0x6f')]['role'],'userProfileId':_0x522cfb[_0x2186('0x6f')][_0x2186('0x70')]};if(!_0xd36738)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd36738[_0x2186('0x71')]===_0x2186('0x72')){var _0x404f08=_0x7925e3[_0x2186('0x27')]({'plain':!![]});return db[_0x2186('0x73')][_0x2186('0x4a')]({'where':{'name':_0x2186('0x74'),'userProfileId':_0xd36738[_0x2186('0x70')]},'raw':!![]})[_0x2186('0x26')](function(_0xfbff3c){if(_0xfbff3c&&_0xfbff3c[_0x2186('0x75')]===0x0){return db[_0x2186('0x76')]['create']({'name':_0x404f08[_0x2186('0x2b')],'resourceId':_0x404f08['id'],'type':_0xfbff3c[_0x2186('0x2b')],'sectionId':_0xfbff3c['id']},{})[_0x2186('0x26')](function(){return _0x7925e3;});}else{return _0x7925e3;}})[_0x2186('0x46')](function(_0x10aaee){logger[_0x2186('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10aaee);throw _0x10aaee;});}return _0x7925e3;})[_0x2186('0x26')](respondWithResult(_0x2875ce,null))['catch'](handleError(_0x2875ce,null));});_0xc25638[_0x2186('0x77')]();}catch(_0x4fb806){_0x2875ce[_0x2186('0x1a')](0x1f4)[_0x2186('0x2c')](_0x4fb806);}};exports['update']=function(_0x31c913,_0x22055e,_0x31d2fa){return db['Sound'][_0x2186('0x4a')]({'where':{'id':_0x31c913[_0x2186('0x48')]['id']}})[_0x2186('0x26')](handleEntityNotFound(_0x22055e,null))[_0x2186('0x26')](saveUpdates(_[_0x2186('0x3f')](_0x31c913['body'],[_0x2186('0x2b'),_0x2186('0x78')]),null))[_0x2186('0x26')](respondWithResult(_0x22055e,null))[_0x2186('0x46')](handleError(_0x22055e,null));};exports[_0x2186('0x79')]=function(_0x974f11,_0x22615f,_0x1fe162){return db[_0x2186('0x2e')][_0x2186('0x4a')]({'where':{'id':_0x974f11[_0x2186('0x48')]['id']}})[_0x2186('0x26')](function(_0x1a34aa){if(_0x1a34aa){return _0x1a34aa[_0x2186('0x28')]();}})[_0x2186('0x26')](function(_0x38a745){var _0x1c8874=path[_0x2186('0x4d')](config[_0x2186('0x4e')],'server/files/sounds/original',util[_0x2186('0x52')](_0x2186('0x53'),_0x38a745[_0x2186('0x4b')],_0x38a745[_0x2186('0x7a')]));var _0x49f6a6=path[_0x2186('0x4d')](config[_0x2186('0x4e')],_0x2186('0x7b'),util['format'](_0x2186('0x53'),_0x38a745['save_name'],_0x38a745[_0x2186('0x4f')]));fs[_0x2186('0x60')](_0x1c8874);fs[_0x2186('0x60')](_0x49f6a6);return _0x38a745;})[_0x2186('0x26')](function(_0x3c9653){if(_0x3c9653){return _0x22615f[_0x2186('0x1a')](0xcc)[_0x2186('0x1b')]();}})[_0x2186('0x26')](handleEntityNotFound(_0x22615f,null))[_0x2186('0x46')](handleError(_0x22615f,null));}; \ No newline at end of file +var _0xaa7a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','name','merge','options','Sound','rows','catch','show','params','keys','length','includeAll','include','find','download','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','create','file','originalname','basename','filename','extname','substring','wav','root','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','error','unlinkSync','send','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','server/files/sounds/original','original_format','end','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x13eec2,_0xe78b42){var _0x46c367=function(_0x3f399a){while(--_0x3f399a){_0x13eec2['push'](_0x13eec2['shift']());}};_0x46c367(++_0xe78b42);}(_0xaa7a,0x16b));var _0xaaa7=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xaa7a[_0x22b68a];return _0x1ac67a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaa7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaa7('0x1'));var rp=require(_0xaaa7('0x2'));var moment=require(_0xaaa7('0x3'));var BPromise=require(_0xaaa7('0x4'));var Mustache=require(_0xaaa7('0x5'));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(_0xaaa7('0x6'));var _=require('lodash');var squel=require(_0xaaa7('0x7'));var crypto=require(_0xaaa7('0x8'));var jsforce=require(_0xaaa7('0x9'));var deskjs=require(_0xaaa7('0xa'));var toCsv=require(_0xaaa7('0xb'));var querystring=require(_0xaaa7('0xc'));var Papa=require(_0xaaa7('0xd'));var Redis=require(_0xaaa7('0xe'));var authService=require(_0xaaa7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaaa7('0x10'));var hardwareService=require(_0xaaa7('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xaaa7('0x12'));var config=require(_0xaaa7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357c63,_0x429298){_0x429298=_0x429298||0xcc;return function(_0x4ab0f1){if(_0x4ab0f1){return _0x357c63[_0xaaa7('0x14')](_0x429298);}return _0x357c63[_0xaaa7('0x15')](_0x429298)['end']();};}function respondWithResult(_0x2e504c,_0x2bb079){_0x2bb079=_0x2bb079||0xc8;return function(_0x48c383){if(_0x48c383){return _0x2e504c['status'](_0x2bb079)[_0xaaa7('0x16')](_0x48c383);}};}function respondWithFilteredResult(_0x3537a2,_0x2f8898){return function(_0x29537d){if(_0x29537d){var _0xcb49f6=typeof _0x2f8898[_0xaaa7('0x17')]===_0xaaa7('0x18')&&typeof _0x2f8898[_0xaaa7('0x19')]===_0xaaa7('0x18');var _0xbc148d=_0x29537d[_0xaaa7('0x1a')];var _0x429357=_0xcb49f6?0x0:_0x2f8898[_0xaaa7('0x17')];var _0x319cb0=_0xcb49f6?_0x29537d['count']:_0x2f8898['offset']+_0x2f8898[_0xaaa7('0x19')];var _0x21b9e8;if(_0x319cb0>=_0xbc148d){_0x319cb0=_0xbc148d;_0x21b9e8=0xc8;}else{_0x21b9e8=0xce;}_0x3537a2[_0xaaa7('0x15')](_0x21b9e8);return _0x3537a2[_0xaaa7('0x1b')](_0xaaa7('0x1c'),_0x429357+'-'+_0x319cb0+'/'+_0xbc148d)[_0xaaa7('0x16')](_0x29537d);}return null;};}function patchUpdates(_0xcd904c){return function(_0x332cbf){try{jsonpatch[_0xaaa7('0x1d')](_0x332cbf,_0xcd904c,!![]);}catch(_0x304301){return BPromise[_0xaaa7('0x1e')](_0x304301);}return _0x332cbf[_0xaaa7('0x1f')]();};}function saveUpdates(_0x3c984f,_0xe9e0cb){return function(_0x4063cc){if(_0x4063cc){return _0x4063cc['update'](_0x3c984f)[_0xaaa7('0x20')](function(_0x55eaf9){return _0x55eaf9;});}return null;};}function removeEntity(_0x45250d,_0x422e66){return function(_0x3f5fb5){if(_0x3f5fb5){return _0x3f5fb5[_0xaaa7('0x21')]()[_0xaaa7('0x20')](function(){var _0x545314=_0x3f5fb5[_0xaaa7('0x22')]({'plain':!![]});var _0x1e6f54='Sounds';return db['UserProfileResource'][_0xaaa7('0x21')]({'where':{'type':_0x1e6f54,'resourceId':_0x545314['id']}})[_0xaaa7('0x20')](function(){return _0x3f5fb5;});})[_0xaaa7('0x20')](function(){_0x45250d[_0xaaa7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db12a,_0x324f35){return function(_0x13077e){if(!_0x13077e){_0x2db12a[_0xaaa7('0x14')](0x194);}return _0x13077e;};}function handleError(_0x1114da,_0x4a8d68){_0x4a8d68=_0x4a8d68||0x1f4;return function(_0x457686){logger['error'](_0x457686['stack']);if(_0x457686['name']){delete _0x457686['name'];}_0x1114da[_0xaaa7('0x15')](_0x4a8d68)['send'](_0x457686);};}exports['index']=function(_0xb30f0b,_0x403054){var _0x134e74={},_0xb038ad={},_0x5a3d66={'count':0x0,'rows':[]};var _0xcf6447=_[_0xaaa7('0x23')](db['Sound'][_0xaaa7('0x24')],function(_0x58ff8b){return{'name':_0x58ff8b['fieldName'],'type':_0x58ff8b[_0xaaa7('0x25')][_0xaaa7('0x26')]};});_0xb038ad[_0xaaa7('0x27')]=_[_0xaaa7('0x23')](_0xcf6447,'name');_0xb038ad[_0xaaa7('0x28')]=_['keys'](_0xb30f0b[_0xaaa7('0x28')]);_0xb038ad[_0xaaa7('0x29')]=_['intersection'](_0xb038ad[_0xaaa7('0x27')],_0xb038ad[_0xaaa7('0x28')]);_0x134e74[_0xaaa7('0x2a')]=_[_0xaaa7('0x2b')](_0xb038ad['model'],qs[_0xaaa7('0x2c')](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x2c')]));_0x134e74[_0xaaa7('0x2a')]=_0x134e74[_0xaaa7('0x2a')]['length']?_0x134e74['attributes']:_0xb038ad['model'];if(!_0xb30f0b['query'][_0xaaa7('0x2d')](_0xaaa7('0x2e'))){_0x134e74['limit']=qs[_0xaaa7('0x19')](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x19')]);_0x134e74['offset']=qs['offset'](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x17')]);}_0x134e74['order']=qs[_0xaaa7('0x2f')](_0xb30f0b[_0xaaa7('0x28')]['sort']);_0x134e74[_0xaaa7('0x30')]=qs['filters'](_['pick'](_0xb30f0b[_0xaaa7('0x28')],_0xb038ad[_0xaaa7('0x29')]),_0xcf6447);if(_0xb30f0b['query'][_0xaaa7('0x31')]){_0x134e74['where']=_['merge'](_0x134e74['where'],{'$or':_[_0xaaa7('0x23')](_0xcf6447,function(_0x3d8000){if(_0x3d8000[_0xaaa7('0x25')]!==_0xaaa7('0x32')){var _0x280a7f={};_0x280a7f[_0x3d8000[_0xaaa7('0x33')]]={'$like':'%'+_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x31')]+'%'};return _0x280a7f;}})});}_0x134e74=_[_0xaaa7('0x34')]({},_0x134e74,_0xb30f0b[_0xaaa7('0x35')]);var _0x12694e={'where':_0x134e74[_0xaaa7('0x30')]};return db[_0xaaa7('0x36')][_0xaaa7('0x1a')](_0x12694e)[_0xaaa7('0x20')](function(_0x49a6bd){_0x5a3d66['count']=_0x49a6bd;if(_0xb30f0b[_0xaaa7('0x28')]['includeAll']){_0x134e74['include']=[{'all':!![]}];}return db[_0xaaa7('0x36')]['findAll'](_0x134e74);})['then'](function(_0x24ee4c){_0x5a3d66[_0xaaa7('0x37')]=_0x24ee4c;return _0x5a3d66;})[_0xaaa7('0x20')](respondWithFilteredResult(_0x403054,_0x134e74))[_0xaaa7('0x38')](handleError(_0x403054,null));};exports[_0xaaa7('0x39')]=function(_0x10b318,_0x57888a){var _0x14c771={'raw':!![],'where':{'id':_0x10b318[_0xaaa7('0x3a')]['id']}},_0x4fd857={};_0x4fd857[_0xaaa7('0x27')]=_[_0xaaa7('0x3b')](db[_0xaaa7('0x36')]['rawAttributes']);_0x4fd857[_0xaaa7('0x28')]=_[_0xaaa7('0x3b')](_0x10b318[_0xaaa7('0x28')]);_0x4fd857[_0xaaa7('0x29')]=_[_0xaaa7('0x2b')](_0x4fd857[_0xaaa7('0x27')],_0x4fd857[_0xaaa7('0x28')]);_0x14c771[_0xaaa7('0x2a')]=_[_0xaaa7('0x2b')](_0x4fd857[_0xaaa7('0x27')],qs[_0xaaa7('0x2c')](_0x10b318['query'][_0xaaa7('0x2c')]));_0x14c771[_0xaaa7('0x2a')]=_0x14c771[_0xaaa7('0x2a')][_0xaaa7('0x3c')]?_0x14c771[_0xaaa7('0x2a')]:_0x4fd857[_0xaaa7('0x27')];if(_0x10b318[_0xaaa7('0x28')][_0xaaa7('0x3d')]){_0x14c771[_0xaaa7('0x3e')]=[{'all':!![]}];}_0x14c771=_[_0xaaa7('0x34')]({},_0x14c771,_0x10b318[_0xaaa7('0x35')]);return db[_0xaaa7('0x36')][_0xaaa7('0x3f')](_0x14c771)[_0xaaa7('0x20')](handleEntityNotFound(_0x57888a,null))['then'](respondWithResult(_0x57888a,null))['catch'](handleError(_0x57888a,null));};exports[_0xaaa7('0x40')]=function(_0x244c86,_0x387ba0,_0x334e51){return db[_0xaaa7('0x36')][_0xaaa7('0x3f')]({'where':{'id':_0x244c86[_0xaaa7('0x3a')]['id']},'attributes':['name',_0xaaa7('0x41'),_0xaaa7('0x42')],'raw':!![]})[_0xaaa7('0x20')](handleEntityNotFound(_0x387ba0,null))['then'](function(_0xde2a9){if(_0xde2a9){if(!fs[_0xaaa7('0x43')](path['join'](config['root'],_0xaaa7('0x44'),_0xde2a9[_0xaaa7('0x41')]+'.'+_0xde2a9[_0xaaa7('0x42')]))){throw new db[(_0xaaa7('0x45'))][(_0xaaa7('0x46'))](_0xaaa7('0x47'));}return _0x387ba0[_0xaaa7('0x40')](path[_0xaaa7('0x48')](config['root'],_0xaaa7('0x44'),util[_0xaaa7('0x49')]('%s.%s',_0xde2a9[_0xaaa7('0x41')],_0xde2a9[_0xaaa7('0x42')])),util['format']('%s.%s',_0xde2a9['name'],_0xde2a9[_0xaaa7('0x42')]));}return null;})[_0xaaa7('0x38')](handleError(_0x387ba0,null));};exports[_0xaaa7('0x4a')]=function(_0x1ee0ee,_0xf6d5f1,_0x3f704f){var _0x1fca34={'name':path['basename'](_0x1ee0ee[_0xaaa7('0x4b')]['originalname'],path['extname'](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4c')])),'save_name':path[_0xaaa7('0x4d')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')],path[_0xaaa7('0x4f')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')])),'original_format':path[_0xaaa7('0x4f')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4c')])[_0xaaa7('0x50')](0x1),'converted_format':_0xaaa7('0x51')};var _0x5f7bb6=path[_0xaaa7('0x48')](config['root'],'server/files/sounds/original',_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')]);var _0x3194ef=path[_0xaaa7('0x48')](config[_0xaaa7('0x52')],_0xaaa7('0x44'),util[_0xaaa7('0x49')](_0xaaa7('0x53'),path['basename'](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')],path[_0xaaa7('0x4f')](_0x1ee0ee['file']['filename'])),_0x1fca34[_0xaaa7('0x42')]));logger['info'](_0xaaa7('0x54'),_0x5f7bb6);logger[_0xaaa7('0x55')](_0xaaa7('0x56'),_0x3194ef);try{fs['chmodSync'](_0x5f7bb6,parseInt('0777',0x8));var _0x45562c=sox[_0xaaa7('0x57')](_0x5f7bb6,_0x3194ef,{'sampleRate':0x1f40,'format':_0xaaa7('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45562c['on'](_0xaaa7('0x58'),function(_0x12f40c){fs[_0xaaa7('0x59')](_0x5f7bb6);_0xf6d5f1[_0xaaa7('0x15')](0x1f4)[_0xaaa7('0x5a')](_0x12f40c);});_0x45562c['on'](_0xaaa7('0x5b'),function(_0x52f830){_0x1fca34[_0xaaa7('0x5c')]=isNaN(_0x52f830['duration'])?null:_0x52f830['duration']*0x3e8;_0x1fca34[_0xaaa7('0x5d')]=isNaN(_0x52f830[_0xaaa7('0x5e')])?null:_0x52f830[_0xaaa7('0x5e')];_0x1fca34['original_channelCount']=isNaN(_0x52f830[_0xaaa7('0x5f')])?null:_0x52f830[_0xaaa7('0x5f')];_0x1fca34[_0xaaa7('0x60')]=isNaN(_0x52f830[_0xaaa7('0x61')])?null:_0x52f830[_0xaaa7('0x61')];_0x1fca34[_0xaaa7('0x62')]=isNaN(_0x52f830[_0xaaa7('0x63')])?null:_0x52f830[_0xaaa7('0x63')];});_0x45562c['on'](_0xaaa7('0x64'),function(_0x16b9c6){_0x1fca34[_0xaaa7('0x65')]=isNaN(_0x16b9c6[_0xaaa7('0x66')])?null:_0x16b9c6[_0xaaa7('0x66')]*0x3e8;_0x1fca34[_0xaaa7('0x67')]=isNaN(_0x16b9c6[_0xaaa7('0x5e')])?null:_0x16b9c6[_0xaaa7('0x5e')];_0x1fca34['converted_channelCount']=isNaN(_0x16b9c6[_0xaaa7('0x5f')])?null:_0x16b9c6[_0xaaa7('0x5f')];_0x1fca34[_0xaaa7('0x68')]=isNaN(_0x16b9c6['bitRate'])?null:_0x16b9c6[_0xaaa7('0x61')];_0x1fca34[_0xaaa7('0x69')]=isNaN(_0x16b9c6[_0xaaa7('0x63')])?null:_0x16b9c6[_0xaaa7('0x63')];});_0x45562c['on']('end',function(){fs[_0xaaa7('0x6a')](_0x3194ef,parseInt(_0xaaa7('0x6b'),0x8));return db[_0xaaa7('0x36')][_0xaaa7('0x4a')](_0x1fca34)['then'](function(_0x201242){var _0x498f6b={'role':_0x1ee0ee[_0xaaa7('0x6c')][_0xaaa7('0x6d')],'userProfileId':_0x1ee0ee[_0xaaa7('0x6c')][_0xaaa7('0x6e')]};if(!_0x498f6b)throw new Error(_0xaaa7('0x6f'));if(_0x498f6b[_0xaaa7('0x6d')]===_0xaaa7('0x70')){var _0x5f4b49=_0x201242[_0xaaa7('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xaaa7('0x3f')]({'where':{'name':_0xaaa7('0x71'),'userProfileId':_0x498f6b['userProfileId']},'raw':!![]})[_0xaaa7('0x20')](function(_0x23dd13){if(_0x23dd13&&_0x23dd13[_0xaaa7('0x72')]===0x0){return db[_0xaaa7('0x73')][_0xaaa7('0x4a')]({'name':_0x5f4b49[_0xaaa7('0x33')],'resourceId':_0x5f4b49['id'],'type':_0x23dd13[_0xaaa7('0x33')],'sectionId':_0x23dd13['id']},{})['then'](function(){return _0x201242;});}else{return _0x201242;}})[_0xaaa7('0x38')](function(_0x28ad0b){logger[_0xaaa7('0x58')](_0xaaa7('0x74'),_0x28ad0b);throw _0x28ad0b;});}return _0x201242;})['then'](respondWithResult(_0xf6d5f1,null))['catch'](handleError(_0xf6d5f1,null));});_0x45562c[_0xaaa7('0x75')]();}catch(_0x2bd528){_0xf6d5f1['status'](0x1f4)[_0xaaa7('0x5a')](_0x2bd528);}};exports[_0xaaa7('0x76')]=function(_0x32842f,_0x4f6cd0,_0x505930){return db[_0xaaa7('0x36')][_0xaaa7('0x3f')]({'where':{'id':_0x32842f[_0xaaa7('0x3a')]['id']}})[_0xaaa7('0x20')](handleEntityNotFound(_0x4f6cd0,null))[_0xaaa7('0x20')](saveUpdates(_[_0xaaa7('0x77')](_0x32842f[_0xaaa7('0x6c')],[_0xaaa7('0x33'),_0xaaa7('0x78')]),null))[_0xaaa7('0x20')](respondWithResult(_0x4f6cd0,null))[_0xaaa7('0x38')](handleError(_0x4f6cd0,null));};exports[_0xaaa7('0x79')]=function(_0x1267e7,_0xdeda05,_0x3db598){return db[_0xaaa7('0x36')]['find']({'where':{'id':_0x1267e7['params']['id']}})[_0xaaa7('0x20')](function(_0x5f184f){if(_0x5f184f){return _0x5f184f['destroy']();}})[_0xaaa7('0x20')](function(_0x55490c){var _0x2d4c3e=path[_0xaaa7('0x48')](config[_0xaaa7('0x52')],_0xaaa7('0x7a'),util[_0xaaa7('0x49')](_0xaaa7('0x53'),_0x55490c['save_name'],_0x55490c[_0xaaa7('0x7b')]));var _0x53db12=path['join'](config['root'],_0xaaa7('0x44'),util[_0xaaa7('0x49')]('%s.%s',_0x55490c[_0xaaa7('0x41')],_0x55490c[_0xaaa7('0x42')]));fs[_0xaaa7('0x59')](_0x2d4c3e);fs[_0xaaa7('0x59')](_0x53db12);return _0x55490c;})['then'](function(_0x53994d){if(_0x53994d){return _0xdeda05['status'](0xcc)[_0xaaa7('0x7c')]();}})[_0xaaa7('0x20')](handleEntityNotFound(_0xdeda05,null))[_0xaaa7('0x38')](handleError(_0xdeda05,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index cc3225f..818f366 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 _0xc0ec=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x263b14,_0x2391ad){var _0x434143=function(_0x231681){while(--_0x231681){_0x263b14['push'](_0x263b14['shift']());}};_0x434143(++_0x2391ad);}(_0xc0ec,0x1cd));var _0xcc0e=function(_0x4279ad,_0x61274e){_0x4279ad=_0x4279ad-0x0;var _0x108b83=_0xc0ec[_0x4279ad];return _0x108b83;};'use strict';var _=require(_0xcc0e('0x0'));var util=require(_0xcc0e('0x1'));var logger=require(_0xcc0e('0x2'))(_0xcc0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc0e('0x4'));var fs=require('fs');var path=require(_0xcc0e('0x5'));var rimraf=require('rimraf');var config=require(_0xcc0e('0x6'));var attributes=require(_0xcc0e('0x7'));module[_0xcc0e('0x8')]=function(_0x581315,_0x57199b){return _0x581315[_0xcc0e('0x9')](_0xcc0e('0xa'),attributes,{'tableName':_0xcc0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06b7=['./sound.attributes','define','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c543d,_0x596974){var _0x2b5fba=function(_0x342124){while(--_0x342124){_0x2c543d['push'](_0x2c543d['shift']());}};_0x2b5fba(++_0x596974);}(_0x06b7,0x117));var _0x706b=function(_0x1530c5,_0x2f67a3){_0x1530c5=_0x1530c5-0x0;var _0x1534d7=_0x06b7[_0x1530c5];return _0x1534d7;};'use strict';var _=require(_0x706b('0x0'));var util=require(_0x706b('0x1'));var logger=require(_0x706b('0x2'))(_0x706b('0x3'));var moment=require('moment');var BPromise=require(_0x706b('0x4'));var rp=require(_0x706b('0x5'));var fs=require('fs');var path=require(_0x706b('0x6'));var rimraf=require(_0x706b('0x7'));var config=require(_0x706b('0x8'));var attributes=require(_0x706b('0x9'));module['exports']=function(_0x24230b,_0x13ca07){return _0x24230b[_0x706b('0xa')]('Sound',attributes,{'tableName':_0x706b('0xb'),'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 101bc0b..50b853f 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 _0xce98=['request\x20sent','debug','stringify','error','code','message','catch','ShowSound','find','options','raw','where','attributes','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Sound,\x20%s,\x20%s'];(function(_0x224c24,_0x4e8c95){var _0x3a4f9b=function(_0x1c47c4){while(--_0x1c47c4){_0x224c24['push'](_0x224c24['shift']());}};_0x3a4f9b(++_0x4e8c95);}(_0xce98,0x11f));var _0x8ce9=function(_0x5afa3f,_0x348da2){_0x5afa3f=_0x5afa3f-0x0;var _0x2dd77e=_0xce98[_0x5afa3f];return _0x2dd77e;};'use strict';var _=require('lodash');var util=require(_0x8ce9('0x0'));var moment=require(_0x8ce9('0x1'));var BPromise=require(_0x8ce9('0x2'));var rs=require(_0x8ce9('0x3'));var fs=require('fs');var Redis=require(_0x8ce9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ce9('0x5'))(_0x8ce9('0x6'));var config=require(_0x8ce9('0x7'));var jayson=require(_0x8ce9('0x8'));var client=jayson[_0x8ce9('0x9')][_0x8ce9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ad0ed,_0x1f9dd3,_0x1e2db9){return new BPromise(function(_0x23ca38,_0x539eed){return client[_0x8ce9('0xb')](_0x4ad0ed,_0x1e2db9)['then'](function(_0x1301ea){logger['info'](_0x8ce9('0xc'),_0x1f9dd3,_0x8ce9('0xd'));logger[_0x8ce9('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x1f9dd3,_0x8ce9('0xd'),JSON[_0x8ce9('0xf')](_0x1301ea));if(_0x1301ea[_0x8ce9('0x10')]){if(_0x1301ea['error'][_0x8ce9('0x11')]===0x1f4){logger[_0x8ce9('0x10')]('Sound,\x20%s,\x20%s',_0x1f9dd3,_0x1301ea[_0x8ce9('0x10')][_0x8ce9('0x12')]);return _0x539eed(_0x1301ea[_0x8ce9('0x10')]['message']);}logger[_0x8ce9('0x10')](_0x8ce9('0xc'),_0x1f9dd3,_0x1301ea[_0x8ce9('0x10')]['message']);return _0x23ca38(_0x1301ea[_0x8ce9('0x10')][_0x8ce9('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x1f9dd3,_0x8ce9('0xd'));_0x23ca38(_0x1301ea['result'][_0x8ce9('0x12')]);}})[_0x8ce9('0x13')](function(_0x409c9c){logger['error']('Sound,\x20%s,\x20%s',_0x1f9dd3,_0x409c9c);_0x539eed(_0x409c9c);});});}exports[_0x8ce9('0x14')]=function(_0x4ae550){var _0x5b9a3a=this;return new Promise(function(_0x4ce43e,_0x462fb7){return db['Sound'][_0x8ce9('0x15')]({'raw':_0x4ae550[_0x8ce9('0x16')]?_0x4ae550[_0x8ce9('0x16')][_0x8ce9('0x17')]===undefined?!![]:![]:!![],'where':_0x4ae550[_0x8ce9('0x16')]?_0x4ae550[_0x8ce9('0x16')][_0x8ce9('0x18')]||null:null,'attributes':_0x4ae550[_0x8ce9('0x16')]?_0x4ae550[_0x8ce9('0x16')][_0x8ce9('0x19')]||null:null,'include':_0x4ae550[_0x8ce9('0x16')]?_0x4ae550[_0x8ce9('0x16')][_0x8ce9('0x1a')]?_[_0x8ce9('0x1b')](_0x4ae550[_0x8ce9('0x16')][_0x8ce9('0x1a')],function(_0x1783e1){return{'model':db[_0x1783e1[_0x8ce9('0x1c')]],'as':_0x1783e1['as'],'attributes':_0x1783e1[_0x8ce9('0x19')],'include':_0x1783e1['include']?_['map'](_0x1783e1[_0x8ce9('0x1a')],function(_0x1b89e1){return{'model':db[_0x1b89e1['model']],'as':_0x1b89e1['as'],'attributes':_0x1b89e1[_0x8ce9('0x19')],'include':_0x1b89e1[_0x8ce9('0x1a')]?_[_0x8ce9('0x1b')](_0x1b89e1[_0x8ce9('0x1a')],function(_0x330cd9){return{'model':db[_0x330cd9[_0x8ce9('0x1c')]],'as':_0x330cd9['as'],'attributes':_0x330cd9[_0x8ce9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319434){logger[_0x8ce9('0x1d')](_0x8ce9('0x14'),_0x4ae550);logger['debug'](_0x8ce9('0x14'),_0x4ae550,JSON[_0x8ce9('0xf')](_0x319434));_0x4ce43e(_0x319434);})[_0x8ce9('0x13')](function(_0x3b2af0){logger[_0x8ce9('0x10')](_0x8ce9('0x14'),_0x3b2af0[_0x8ce9('0x12')],_0x4ae550);_0x462fb7(_0x5b9a3a['error'](0x1f4,_0x3b2af0[_0x8ce9('0x12')]));});});}; \ No newline at end of file +var _0xa70f=['error','code','message','result','catch','ShowSound','Sound','find','options','raw','include','model','attributes','map','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x727e40,_0x55c539){var _0x734039=function(_0x1cc794){while(--_0x1cc794){_0x727e40['push'](_0x727e40['shift']());}};_0x734039(++_0x55c539);}(_0xa70f,0x1b2));var _0xfa70=function(_0x4bcc87,_0x30f832){_0x4bcc87=_0x4bcc87-0x0;var _0x3d4dc1=_0xa70f[_0x4bcc87];return _0x3d4dc1;};'use strict';var _=require('lodash');var util=require(_0xfa70('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa70('0x1'));var fs=require('fs');var Redis=require(_0xfa70('0x2'));var db=require(_0xfa70('0x3'))['db'];var utils=require(_0xfa70('0x4'));var logger=require(_0xfa70('0x5'))(_0xfa70('0x6'));var config=require(_0xfa70('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa70('0x8')][_0xfa70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454343,_0x29a8fd,_0x5d330b){return new BPromise(function(_0x2f4476,_0x3ee940){return client[_0xfa70('0xa')](_0x454343,_0x5d330b)[_0xfa70('0xb')](function(_0xbb3ee7){logger[_0xfa70('0xc')](_0xfa70('0xd'),_0x29a8fd,_0xfa70('0xe'));logger[_0xfa70('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x29a8fd,_0xfa70('0xe'),JSON['stringify'](_0xbb3ee7));if(_0xbb3ee7[_0xfa70('0x10')]){if(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x11')]===0x1f4){logger[_0xfa70('0x10')](_0xfa70('0xd'),_0x29a8fd,_0xbb3ee7[_0xfa70('0x10')]['message']);return _0x3ee940(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);}logger[_0xfa70('0x10')](_0xfa70('0xd'),_0x29a8fd,_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);return _0x2f4476(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x29a8fd,_0xfa70('0xe'));_0x2f4476(_0xbb3ee7[_0xfa70('0x13')][_0xfa70('0x12')]);}})[_0xfa70('0x14')](function(_0x4ed5b7){logger[_0xfa70('0x10')]('Sound,\x20%s,\x20%s',_0x29a8fd,_0x4ed5b7);_0x3ee940(_0x4ed5b7);});});}exports[_0xfa70('0x15')]=function(_0x335ef6){var _0x37e67a=this;return new Promise(function(_0x5cb269,_0x4c7848){return db[_0xfa70('0x16')][_0xfa70('0x17')]({'raw':_0x335ef6['options']?_0x335ef6[_0xfa70('0x18')][_0xfa70('0x19')]===undefined?!![]:![]:!![],'where':_0x335ef6[_0xfa70('0x18')]?_0x335ef6[_0xfa70('0x18')]['where']||null:null,'attributes':_0x335ef6[_0xfa70('0x18')]?_0x335ef6[_0xfa70('0x18')]['attributes']||null:null,'include':_0x335ef6[_0xfa70('0x18')]?_0x335ef6['options'][_0xfa70('0x1a')]?_['map'](_0x335ef6[_0xfa70('0x18')][_0xfa70('0x1a')],function(_0x3252dd){return{'model':db[_0x3252dd[_0xfa70('0x1b')]],'as':_0x3252dd['as'],'attributes':_0x3252dd[_0xfa70('0x1c')],'include':_0x3252dd[_0xfa70('0x1a')]?_[_0xfa70('0x1d')](_0x3252dd[_0xfa70('0x1a')],function(_0x448b71){return{'model':db[_0x448b71[_0xfa70('0x1b')]],'as':_0x448b71['as'],'attributes':_0x448b71[_0xfa70('0x1c')],'include':_0x448b71[_0xfa70('0x1a')]?_[_0xfa70('0x1d')](_0x448b71[_0xfa70('0x1a')],function(_0x2577ef){return{'model':db[_0x2577ef[_0xfa70('0x1b')]],'as':_0x2577ef['as'],'attributes':_0x2577ef[_0xfa70('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfa70('0xb')](function(_0x28070b){logger[_0xfa70('0xc')]('ShowSound',_0x335ef6);logger[_0xfa70('0xf')](_0xfa70('0x15'),_0x335ef6,JSON['stringify'](_0x28070b));_0x5cb269(_0x28070b);})[_0xfa70('0x14')](function(_0x15eed8){logger['error'](_0xfa70('0x15'),_0x15eed8['message'],_0x335ef6);_0x4c7848(_0x37e67a[_0xfa70('0x10')](0x1f4,_0x15eed8[_0xfa70('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 532c5b4..e38543a 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x20c757,_0xf1f53b){var _0x2720f3=function(_0x4d765d){while(--_0x4d765d){_0x20c757['push'](_0x20c757['shift']());}};_0x2720f3(++_0xf1f53b);}(_0xda2d,0x102));var _0xdda2=function(_0x1450d7,_0xaf13cb){_0x1450d7=_0x1450d7-0x0;var _0x743c9b=_0xda2d[_0x1450d7];return _0x743c9b;};'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('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=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','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0x4fc2,0x111));var _0x24fc=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4fc2[_0x5c883f];return _0x4210cc;};'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/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 07e04a4..e83395e 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 _0xe027=['STRING','ENUM','out','sequelize','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe027,0x184));var _0x7e02=function(_0x7151e7,_0x43f35b){_0x7151e7=_0x7151e7-0x0;var _0x5025f7=_0xe027[_0x7151e7];return _0x5025f7;};'use strict';var Sequelize=require(_0x7e02('0x0'));module[_0x7e02('0x1')]={'uniqueid':{'type':Sequelize[_0x7e02('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x7e02('0x3')]('in',_0x7e02('0x4')),'defaultValue':_0x7e02('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7e02('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdd25=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xdd25,0x178));var _0x5dd2=function(_0x425ff3,_0x53a7f6){_0x425ff3=_0x425ff3-0x0;var _0x56f85c=_0xdd25[_0x425ff3];return _0x56f85c;};'use strict';var Sequelize=require('sequelize');module[_0x5dd2('0x0')]={'uniqueid':{'type':Sequelize[_0x5dd2('0x1')]},'body':{'type':Sequelize[_0x5dd2('0x2')](_0x5dd2('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5dd2('0x4')]('in','out'),'defaultValue':_0x5dd2('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5dd2('0x1')]},'providerResponse':{'type':Sequelize[_0x5dd2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 05b8041..89fcf31 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 _0x43c2=['path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','count','apply','reject','save','update','then','status','sendStatus','error','stack','name','send','index','map','SquareMessage','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x43c2,0x1a1));var _0x243c=function(_0x10f045,_0x176e29){_0x10f045=_0x10f045-0x0;var _0x4f99f0=_0x43c2[_0x10f045];return _0x4f99f0;};'use strict';var emlformat=require(_0x243c('0x0'));var rimraf=require(_0x243c('0x1'));var zipdir=require(_0x243c('0x2'));var jsonpatch=require(_0x243c('0x3'));var rp=require(_0x243c('0x4'));var moment=require(_0x243c('0x5'));var BPromise=require(_0x243c('0x6'));var Mustache=require(_0x243c('0x7'));var util=require(_0x243c('0x8'));var path=require(_0x243c('0x9'));var sox=require(_0x243c('0xa'));var csv=require('to-csv');var ejs=require(_0x243c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x243c('0xc'));var squel=require(_0x243c('0xd'));var crypto=require(_0x243c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x243c('0xf'));var toCsv=require(_0x243c('0x10'));var querystring=require(_0x243c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x243c('0x12'));var hardwareService=require(_0x243c('0x13'));var logger=require('../../config/logger')(_0x243c('0x14'));var utils=require(_0x243c('0x15'));var config=require(_0x243c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x243c('0x17'))['db'];function respondWithStatusCode(_0x5cf34c,_0x1712ff){_0x1712ff=_0x1712ff||0xcc;return function(_0x53055c){if(_0x53055c){return _0x5cf34c['sendStatus'](_0x1712ff);}return _0x5cf34c['status'](_0x1712ff)[_0x243c('0x18')]();};}function respondWithResult(_0x59fd8a,_0x197348){_0x197348=_0x197348||0xc8;return function(_0x3b807b){if(_0x3b807b){return _0x59fd8a['status'](_0x197348)['json'](_0x3b807b);}};}function respondWithFilteredResult(_0x6475a5,_0x3be8de){return function(_0x44ea00){if(_0x44ea00){var _0xea9a61=typeof _0x3be8de[_0x243c('0x19')]==='undefined'&&typeof _0x3be8de[_0x243c('0x1a')]==='undefined';var _0x341d40=_0x44ea00['count'];var _0x5f1f45=_0xea9a61?0x0:_0x3be8de[_0x243c('0x19')];var _0x4980c4=_0xea9a61?_0x44ea00[_0x243c('0x1b')]:_0x3be8de[_0x243c('0x19')]+_0x3be8de[_0x243c('0x1a')];var _0x5ed5b1;if(_0x4980c4>=_0x341d40){_0x4980c4=_0x341d40;_0x5ed5b1=0xc8;}else{_0x5ed5b1=0xce;}_0x6475a5['status'](_0x5ed5b1);return _0x6475a5['set']('Content-Range',_0x5f1f45+'-'+_0x4980c4+'/'+_0x341d40)['json'](_0x44ea00);}return null;};}function patchUpdates(_0x13dbe3){return function(_0x74c219){try{jsonpatch[_0x243c('0x1c')](_0x74c219,_0x13dbe3,!![]);}catch(_0x240554){return BPromise[_0x243c('0x1d')](_0x240554);}return _0x74c219[_0x243c('0x1e')]();};}function saveUpdates(_0x9a291f,_0x49bca4){return function(_0x292287){if(_0x292287){return _0x292287[_0x243c('0x1f')](_0x9a291f)[_0x243c('0x20')](function(_0x390646){return _0x390646;});}return null;};}function removeEntity(_0xd767a2,_0x40f4e5){return function(_0x224d70){if(_0x224d70){return _0x224d70['destroy']()[_0x243c('0x20')](function(){_0xd767a2[_0x243c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2930cc,_0x5a8abd){return function(_0x58af80){if(!_0x58af80){_0x2930cc[_0x243c('0x22')](0x194);}return _0x58af80;};}function handleError(_0x53461d,_0xbeab41){_0xbeab41=_0xbeab41||0x1f4;return function(_0x38d006){logger[_0x243c('0x23')](_0x38d006[_0x243c('0x24')]);if(_0x38d006[_0x243c('0x25')]){delete _0x38d006[_0x243c('0x25')];}_0x53461d['status'](_0xbeab41)[_0x243c('0x26')](_0x38d006);};}exports[_0x243c('0x27')]=function(_0x6fdc2f,_0x149ad1){var _0x2501bb={},_0x4749fd={},_0x20896a={'count':0x0,'rows':[]};var _0x248004=_[_0x243c('0x28')](db[_0x243c('0x29')]['rawAttributes'],function(_0x260084){return{'name':_0x260084['fieldName'],'type':_0x260084[_0x243c('0x2a')][_0x243c('0x2b')]};});_0x4749fd[_0x243c('0x2c')]=_[_0x243c('0x28')](_0x248004,_0x243c('0x25'));_0x4749fd[_0x243c('0x2d')]=_[_0x243c('0x2e')](_0x6fdc2f['query']);_0x4749fd[_0x243c('0x2f')]=_['intersection'](_0x4749fd[_0x243c('0x2c')],_0x4749fd[_0x243c('0x2d')]);_0x2501bb[_0x243c('0x30')]=_['intersection'](_0x4749fd[_0x243c('0x2c')],qs[_0x243c('0x31')](_0x6fdc2f[_0x243c('0x2d')][_0x243c('0x31')]));_0x2501bb['attributes']=_0x2501bb['attributes'][_0x243c('0x32')]?_0x2501bb[_0x243c('0x30')]:_0x4749fd[_0x243c('0x2c')];if(!_0x6fdc2f[_0x243c('0x2d')]['hasOwnProperty'](_0x243c('0x33'))){_0x2501bb[_0x243c('0x1a')]=qs['limit'](_0x6fdc2f[_0x243c('0x2d')]['limit']);_0x2501bb[_0x243c('0x19')]=qs[_0x243c('0x19')](_0x6fdc2f[_0x243c('0x2d')][_0x243c('0x19')]);}_0x2501bb[_0x243c('0x34')]=qs[_0x243c('0x35')](_0x6fdc2f[_0x243c('0x2d')][_0x243c('0x35')]);_0x2501bb[_0x243c('0x36')]=qs[_0x243c('0x2f')](_[_0x243c('0x37')](_0x6fdc2f['query'],_0x4749fd[_0x243c('0x2f')]),_0x248004);if(_0x6fdc2f[_0x243c('0x2d')]['filter']){_0x2501bb[_0x243c('0x36')]=_[_0x243c('0x38')](_0x2501bb['where'],{'$or':_[_0x243c('0x28')](_0x248004,function(_0x5dd358){if(_0x5dd358[_0x243c('0x2a')]!=='VIRTUAL'){var _0x3c4da7={};_0x3c4da7[_0x5dd358[_0x243c('0x25')]]={'$like':'%'+_0x6fdc2f[_0x243c('0x2d')]['filter']+'%'};return _0x3c4da7;}})});}_0x2501bb=_[_0x243c('0x38')]({},_0x2501bb,_0x6fdc2f['options']);var _0x15f264={'where':_0x2501bb['where']};return db[_0x243c('0x29')][_0x243c('0x1b')](_0x15f264)[_0x243c('0x20')](function(_0x2e7daa){_0x20896a[_0x243c('0x1b')]=_0x2e7daa;if(_0x6fdc2f[_0x243c('0x2d')][_0x243c('0x39')]){_0x2501bb[_0x243c('0x3a')]=[{'all':!![]}];}return db[_0x243c('0x29')][_0x243c('0x3b')](_0x2501bb);})[_0x243c('0x20')](function(_0x14fb20){_0x20896a[_0x243c('0x3c')]=_0x14fb20;return _0x20896a;})[_0x243c('0x20')](respondWithFilteredResult(_0x149ad1,_0x2501bb))[_0x243c('0x3d')](handleError(_0x149ad1,null));};exports[_0x243c('0x3e')]=function(_0x52e64e,_0x2af31d){var _0x7baeff={'raw':!![],'where':{'id':_0x52e64e[_0x243c('0x3f')]['id']}},_0xd47509={};_0xd47509[_0x243c('0x2c')]=_[_0x243c('0x2e')](db[_0x243c('0x29')][_0x243c('0x40')]);_0xd47509[_0x243c('0x2d')]=_[_0x243c('0x2e')](_0x52e64e[_0x243c('0x2d')]);_0xd47509[_0x243c('0x2f')]=_[_0x243c('0x41')](_0xd47509['model'],_0xd47509[_0x243c('0x2d')]);_0x7baeff[_0x243c('0x30')]=_['intersection'](_0xd47509[_0x243c('0x2c')],qs[_0x243c('0x31')](_0x52e64e['query']['fields']));_0x7baeff[_0x243c('0x30')]=_0x7baeff[_0x243c('0x30')][_0x243c('0x32')]?_0x7baeff['attributes']:_0xd47509[_0x243c('0x2c')];if(_0x52e64e['query']['includeAll']){_0x7baeff[_0x243c('0x3a')]=[{'all':!![]}];}_0x7baeff=_[_0x243c('0x38')]({},_0x7baeff,_0x52e64e[_0x243c('0x42')]);return db['SquareMessage'][_0x243c('0x43')](_0x7baeff)[_0x243c('0x20')](handleEntityNotFound(_0x2af31d,null))[_0x243c('0x20')](respondWithResult(_0x2af31d,null))[_0x243c('0x3d')](handleError(_0x2af31d,null));};exports[_0x243c('0x44')]=function(_0x13cd32,_0x2533b3){return db[_0x243c('0x29')]['create'](_0x13cd32[_0x243c('0x45')],{})[_0x243c('0x20')](respondWithResult(_0x2533b3,0xc9))[_0x243c('0x3d')](handleError(_0x2533b3,null));};exports[_0x243c('0x1f')]=function(_0x3aadca,_0x183d37){if(_0x3aadca[_0x243c('0x45')]['id']){delete _0x3aadca[_0x243c('0x45')]['id'];}return db[_0x243c('0x29')][_0x243c('0x43')]({'where':{'id':_0x3aadca[_0x243c('0x3f')]['id']}})[_0x243c('0x20')](handleEntityNotFound(_0x183d37,null))[_0x243c('0x20')](saveUpdates(_0x3aadca[_0x243c('0x45')],null))[_0x243c('0x20')](respondWithResult(_0x183d37,null))[_0x243c('0x3d')](handleError(_0x183d37,null));};exports[_0x243c('0x46')]=function(_0x651327,_0x29f6ad){return db[_0x243c('0x29')][_0x243c('0x43')]({'where':{'id':_0x651327[_0x243c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x29f6ad,null))['then'](removeEntity(_0x29f6ad,null))[_0x243c('0x3d')](handleError(_0x29f6ad,null));}; \ No newline at end of file +var _0xc674=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort'];(function(_0x4cb92e,_0x2d7349){var _0x3378c8=function(_0x32e43c){while(--_0x32e43c){_0x4cb92e['push'](_0x4cb92e['shift']());}};_0x3378c8(++_0x2d7349);}(_0xc674,0xe8));var _0x4c67=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xc674[_0x277721];return _0x286051;};'use strict';var emlformat=require(_0x4c67('0x0'));var rimraf=require(_0x4c67('0x1'));var zipdir=require(_0x4c67('0x2'));var jsonpatch=require(_0x4c67('0x3'));var rp=require(_0x4c67('0x4'));var moment=require(_0x4c67('0x5'));var BPromise=require(_0x4c67('0x6'));var Mustache=require('mustache');var util=require(_0x4c67('0x7'));var path=require('path');var sox=require(_0x4c67('0x8'));var csv=require(_0x4c67('0x9'));var ejs=require(_0x4c67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c67('0xb'));var crypto=require(_0x4c67('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c67('0x9'));var querystring=require(_0x4c67('0xd'));var Papa=require('papaparse');var Redis=require(_0x4c67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4c67('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c67('0x10'));var logger=require(_0x4c67('0x11'))(_0x4c67('0x12'));var utils=require(_0x4c67('0x13'));var config=require(_0x4c67('0x14'));var licenseUtil=require(_0x4c67('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d87b,_0x46d3b0){_0x46d3b0=_0x46d3b0||0xcc;return function(_0x382563){if(_0x382563){return _0x13d87b['sendStatus'](_0x46d3b0);}return _0x13d87b['status'](_0x46d3b0)[_0x4c67('0x16')]();};}function respondWithResult(_0x307f15,_0x4d8e74){_0x4d8e74=_0x4d8e74||0xc8;return function(_0x497eab){if(_0x497eab){return _0x307f15[_0x4c67('0x17')](_0x4d8e74)[_0x4c67('0x18')](_0x497eab);}};}function respondWithFilteredResult(_0x617aaf,_0x441665){return function(_0x42fdb7){if(_0x42fdb7){var _0x3be40d=typeof _0x441665[_0x4c67('0x19')]===_0x4c67('0x1a')&&typeof _0x441665[_0x4c67('0x1b')]===_0x4c67('0x1a');var _0x5c5d49=_0x42fdb7['count'];var _0x217ce6=_0x3be40d?0x0:_0x441665[_0x4c67('0x19')];var _0x5c062c=_0x3be40d?_0x42fdb7[_0x4c67('0x1c')]:_0x441665[_0x4c67('0x19')]+_0x441665[_0x4c67('0x1b')];var _0x162791;if(_0x5c062c>=_0x5c5d49){_0x5c062c=_0x5c5d49;_0x162791=0xc8;}else{_0x162791=0xce;}_0x617aaf[_0x4c67('0x17')](_0x162791);return _0x617aaf[_0x4c67('0x1d')](_0x4c67('0x1e'),_0x217ce6+'-'+_0x5c062c+'/'+_0x5c5d49)[_0x4c67('0x18')](_0x42fdb7);}return null;};}function patchUpdates(_0x5a96c8){return function(_0x1f5e01){try{jsonpatch[_0x4c67('0x1f')](_0x1f5e01,_0x5a96c8,!![]);}catch(_0x2498dc){return BPromise[_0x4c67('0x20')](_0x2498dc);}return _0x1f5e01['save']();};}function saveUpdates(_0x4905c5,_0x44a0b1){return function(_0x1b34fc){if(_0x1b34fc){return _0x1b34fc[_0x4c67('0x21')](_0x4905c5)[_0x4c67('0x22')](function(_0x586111){return _0x586111;});}return null;};}function removeEntity(_0x2f6fac,_0x2dec4d){return function(_0x495320){if(_0x495320){return _0x495320[_0x4c67('0x23')]()[_0x4c67('0x22')](function(){_0x2f6fac[_0x4c67('0x17')](0xcc)[_0x4c67('0x16')]();});}};}function handleEntityNotFound(_0x38f684,_0x1f5d0e){return function(_0x5b9149){if(!_0x5b9149){_0x38f684[_0x4c67('0x24')](0x194);}return _0x5b9149;};}function handleError(_0x354524,_0x131610){_0x131610=_0x131610||0x1f4;return function(_0x3a5406){logger[_0x4c67('0x25')](_0x3a5406['stack']);if(_0x3a5406[_0x4c67('0x26')]){delete _0x3a5406[_0x4c67('0x26')];}_0x354524['status'](_0x131610)[_0x4c67('0x27')](_0x3a5406);};}exports[_0x4c67('0x28')]=function(_0x4b0191,_0x30648a){var _0x36dc2d={},_0x36d07a={},_0x54bef8={'count':0x0,'rows':[]};var _0x2a9403=_[_0x4c67('0x29')](db[_0x4c67('0x2a')][_0x4c67('0x2b')],function(_0x349dd6){return{'name':_0x349dd6[_0x4c67('0x2c')],'type':_0x349dd6[_0x4c67('0x2d')]['key']};});_0x36d07a[_0x4c67('0x2e')]=_[_0x4c67('0x29')](_0x2a9403,'name');_0x36d07a[_0x4c67('0x2f')]=_[_0x4c67('0x30')](_0x4b0191[_0x4c67('0x2f')]);_0x36d07a[_0x4c67('0x31')]=_['intersection'](_0x36d07a[_0x4c67('0x2e')],_0x36d07a['query']);_0x36dc2d[_0x4c67('0x32')]=_['intersection'](_0x36d07a[_0x4c67('0x2e')],qs[_0x4c67('0x33')](_0x4b0191[_0x4c67('0x2f')]['fields']));_0x36dc2d[_0x4c67('0x32')]=_0x36dc2d[_0x4c67('0x32')][_0x4c67('0x34')]?_0x36dc2d[_0x4c67('0x32')]:_0x36d07a[_0x4c67('0x2e')];if(!_0x4b0191[_0x4c67('0x2f')]['hasOwnProperty'](_0x4c67('0x35'))){_0x36dc2d[_0x4c67('0x1b')]=qs[_0x4c67('0x1b')](_0x4b0191[_0x4c67('0x2f')]['limit']);_0x36dc2d['offset']=qs[_0x4c67('0x19')](_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x19')]);}_0x36dc2d[_0x4c67('0x36')]=qs['sort'](_0x4b0191['query'][_0x4c67('0x37')]);_0x36dc2d[_0x4c67('0x38')]=qs['filters'](_[_0x4c67('0x39')](_0x4b0191[_0x4c67('0x2f')],_0x36d07a[_0x4c67('0x31')]),_0x2a9403);if(_0x4b0191['query'][_0x4c67('0x3a')]){_0x36dc2d[_0x4c67('0x38')]=_[_0x4c67('0x3b')](_0x36dc2d['where'],{'$or':_['map'](_0x2a9403,function(_0x356978){if(_0x356978[_0x4c67('0x2d')]!==_0x4c67('0x3c')){var _0x3a58b7={};_0x3a58b7[_0x356978[_0x4c67('0x26')]]={'$like':'%'+_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x3a')]+'%'};return _0x3a58b7;}})});}_0x36dc2d=_['merge']({},_0x36dc2d,_0x4b0191[_0x4c67('0x3d')]);var _0x2cfe81={'where':_0x36dc2d[_0x4c67('0x38')]};return db[_0x4c67('0x2a')]['count'](_0x2cfe81)[_0x4c67('0x22')](function(_0x3fad44){_0x54bef8['count']=_0x3fad44;if(_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x3e')]){_0x36dc2d[_0x4c67('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x4c67('0x40')](_0x36dc2d);})[_0x4c67('0x22')](function(_0x136cfb){_0x54bef8[_0x4c67('0x41')]=_0x136cfb;return _0x54bef8;})['then'](respondWithFilteredResult(_0x30648a,_0x36dc2d))[_0x4c67('0x42')](handleError(_0x30648a,null));};exports['show']=function(_0x125719,_0x2b37ae){var _0x2dba44={'raw':!![],'where':{'id':_0x125719[_0x4c67('0x43')]['id']}},_0xb24b39={};_0xb24b39['model']=_['keys'](db[_0x4c67('0x2a')][_0x4c67('0x2b')]);_0xb24b39[_0x4c67('0x2f')]=_[_0x4c67('0x30')](_0x125719[_0x4c67('0x2f')]);_0xb24b39[_0x4c67('0x31')]=_['intersection'](_0xb24b39['model'],_0xb24b39[_0x4c67('0x2f')]);_0x2dba44[_0x4c67('0x32')]=_[_0x4c67('0x44')](_0xb24b39[_0x4c67('0x2e')],qs[_0x4c67('0x33')](_0x125719['query'][_0x4c67('0x33')]));_0x2dba44[_0x4c67('0x32')]=_0x2dba44['attributes'][_0x4c67('0x34')]?_0x2dba44[_0x4c67('0x32')]:_0xb24b39[_0x4c67('0x2e')];if(_0x125719['query'][_0x4c67('0x3e')]){_0x2dba44[_0x4c67('0x3f')]=[{'all':!![]}];}_0x2dba44=_[_0x4c67('0x3b')]({},_0x2dba44,_0x125719['options']);return db[_0x4c67('0x2a')][_0x4c67('0x45')](_0x2dba44)[_0x4c67('0x22')](handleEntityNotFound(_0x2b37ae,null))['then'](respondWithResult(_0x2b37ae,null))['catch'](handleError(_0x2b37ae,null));};exports[_0x4c67('0x46')]=function(_0x30e9ec,_0x3a0f12){return db['SquareMessage'][_0x4c67('0x46')](_0x30e9ec[_0x4c67('0x47')],{})[_0x4c67('0x22')](respondWithResult(_0x3a0f12,0xc9))[_0x4c67('0x42')](handleError(_0x3a0f12,null));};exports['update']=function(_0x142e2c,_0x54b262){if(_0x142e2c[_0x4c67('0x47')]['id']){delete _0x142e2c['body']['id'];}return db[_0x4c67('0x2a')][_0x4c67('0x45')]({'where':{'id':_0x142e2c[_0x4c67('0x43')]['id']}})[_0x4c67('0x22')](handleEntityNotFound(_0x54b262,null))[_0x4c67('0x22')](saveUpdates(_0x142e2c[_0x4c67('0x47')],null))['then'](respondWithResult(_0x54b262,null))[_0x4c67('0x42')](handleError(_0x54b262,null));};exports['destroy']=function(_0xf51a4a,_0x996a4d){return db[_0x4c67('0x2a')]['find']({'where':{'id':_0xf51a4a[_0x4c67('0x43')]['id']}})[_0x4c67('0x22')](handleEntityNotFound(_0x996a4d,null))['then'](removeEntity(_0x996a4d,null))[_0x4c67('0x42')](handleError(_0x996a4d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c4d42df..3e5f40a 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 _0xf237=['rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e703d,_0x67d1b){var _0xe94ee1=function(_0x3ffb8b){while(--_0x3ffb8b){_0x1e703d['push'](_0x1e703d['shift']());}};_0xe94ee1(++_0x67d1b);}(_0xf237,0x1f3));var _0x7f23=function(_0x10ceef,_0x290db3){_0x10ceef=_0x10ceef-0x0;var _0x1eb48d=_0xf237[_0x10ceef];return _0x1eb48d;};'use strict';var _=require(_0x7f23('0x0'));var util=require(_0x7f23('0x1'));var logger=require(_0x7f23('0x2'))(_0x7f23('0x3'));var moment=require(_0x7f23('0x4'));var BPromise=require(_0x7f23('0x5'));var rp=require(_0x7f23('0x6'));var fs=require('fs');var path=require(_0x7f23('0x7'));var rimraf=require(_0x7f23('0x8'));var config=require('../../config/environment');var attributes=require(_0x7f23('0x9'));module[_0x7f23('0xa')]=function(_0x4c893e,_0xe5ec8c){return _0x4c893e[_0x7f23('0xb')]('SquareMessage',attributes,{'tableName':_0x7f23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba9=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x31543a,_0x41b33d){var _0x468934=function(_0x1b47be){while(--_0x1b47be){_0x31543a['push'](_0x31543a['shift']());}};_0x468934(++_0x41b33d);}(_0x6ba9,0x1e0));var _0x96ba=function(_0x2ecf59,_0x84bf62){_0x2ecf59=_0x2ecf59-0x0;var _0x5841e6=_0x6ba9[_0x2ecf59];return _0x5841e6;};'use strict';var _=require(_0x96ba('0x0'));var util=require(_0x96ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x96ba('0x2'));var BPromise=require(_0x96ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96ba('0x4'));var rimraf=require(_0x96ba('0x5'));var config=require(_0x96ba('0x6'));var attributes=require(_0x96ba('0x7'));module[_0x96ba('0x8')]=function(_0x192551,_0x464e74){return _0x192551[_0x96ba('0x9')](_0x96ba('0xa'),attributes,{'tableName':_0x96ba('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 0c5b8e7..3bfa62d 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 _0x9d29=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','moment'];(function(_0x219b04,_0x2efe5b){var _0x350bd4=function(_0x370f3f){while(--_0x370f3f){_0x219b04['push'](_0x219b04['shift']());}};_0x350bd4(++_0x2efe5b);}(_0x9d29,0x13d));var _0x99d2=function(_0x432514,_0x3f7a3a){_0x432514=_0x432514-0x0;var _0x3b781b=_0x9d29[_0x432514];return _0x3b781b;};'use strict';var _=require(_0x99d2('0x0'));var util=require('util');var moment=require(_0x99d2('0x1'));var BPromise=require(_0x99d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99d2('0x3'));var db=require(_0x99d2('0x4'))['db'];var utils=require(_0x99d2('0x5'));var logger=require(_0x99d2('0x6'))(_0x99d2('0x7'));var config=require(_0x99d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x99d2('0x9')][_0x99d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed348,_0x2c6120,_0x17284e){return new BPromise(function(_0x42aaec,_0x5d32cf){return client[_0x99d2('0xb')](_0x5ed348,_0x17284e)[_0x99d2('0xc')](function(_0x224693){logger[_0x99d2('0xd')]('SquareMessage,\x20%s,\x20%s',_0x2c6120,_0x99d2('0xe'));logger[_0x99d2('0xf')](_0x99d2('0x10'),_0x2c6120,_0x99d2('0xe'),JSON[_0x99d2('0x11')](_0x224693));if(_0x224693[_0x99d2('0x12')]){if(_0x224693[_0x99d2('0x12')][_0x99d2('0x13')]===0x1f4){logger[_0x99d2('0x12')](_0x99d2('0x14'),_0x2c6120,_0x224693['error'][_0x99d2('0x15')]);return _0x5d32cf(_0x224693[_0x99d2('0x12')][_0x99d2('0x15')]);}logger[_0x99d2('0x12')]('SquareMessage,\x20%s,\x20%s',_0x2c6120,_0x224693[_0x99d2('0x12')][_0x99d2('0x15')]);return _0x42aaec(_0x224693[_0x99d2('0x12')][_0x99d2('0x15')]);}else{logger[_0x99d2('0xd')](_0x99d2('0x14'),_0x2c6120,_0x99d2('0xe'));_0x42aaec(_0x224693['result']['message']);}})['catch'](function(_0x3ecbc4){logger[_0x99d2('0x12')]('SquareMessage,\x20%s,\x20%s',_0x2c6120,_0x3ecbc4);_0x5d32cf(_0x3ecbc4);});});}exports[_0x99d2('0x16')]=function(_0x3fe57e){var _0x45d739=this;return new Promise(function(_0x103366,_0x783bd4){return db[_0x99d2('0x17')][_0x99d2('0x18')](_0x3fe57e[_0x99d2('0x19')],{'raw':_0x3fe57e[_0x99d2('0x1a')]?_0x3fe57e[_0x99d2('0x1a')][_0x99d2('0x1b')]===undefined?!![]:![]:!![]})[_0x99d2('0xc')](function(_0x3667cd){logger['info']('CreateSquareMessage',_0x3fe57e);logger[_0x99d2('0xf')]('CreateSquareMessage',_0x3fe57e,JSON[_0x99d2('0x11')](_0x3667cd));_0x103366(_0x3667cd);})[_0x99d2('0x1c')](function(_0x1d6047){logger[_0x99d2('0x12')](_0x99d2('0x16'),_0x1d6047[_0x99d2('0x15')],_0x3fe57e);_0x783bd4(_0x45d739['error'](0x1f4,_0x1d6047['message']));});});}; \ No newline at end of file +var _0x458c=['SquareMessage','body','options','raw','catch','CreateSquareMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message'];(function(_0x5b408d,_0x26cb67){var _0x4072ce=function(_0x354b6b){while(--_0x354b6b){_0x5b408d['push'](_0x5b408d['shift']());}};_0x4072ce(++_0x26cb67);}(_0x458c,0xf0));var _0xc458=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x458c[_0x5e238b];return _0x389bea;};'use strict';var _=require(_0xc458('0x0'));var util=require(_0xc458('0x1'));var moment=require(_0xc458('0x2'));var BPromise=require(_0xc458('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc458('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc458('0x5'));var logger=require('../../config/logger')(_0xc458('0x6'));var config=require(_0xc458('0x7'));var jayson=require(_0xc458('0x8'));var client=jayson[_0xc458('0x9')][_0xc458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x300396,_0xa36533,_0x56a13e){return new BPromise(function(_0x36c56e,_0x2882cb){return client[_0xc458('0xb')](_0x300396,_0x56a13e)['then'](function(_0x17a3e8){logger[_0xc458('0xc')]('SquareMessage,\x20%s,\x20%s',_0xa36533,_0xc458('0xd'));logger[_0xc458('0xe')](_0xc458('0xf'),_0xa36533,_0xc458('0xd'),JSON[_0xc458('0x10')](_0x17a3e8));if(_0x17a3e8[_0xc458('0x11')]){if(_0x17a3e8['error']['code']===0x1f4){logger[_0xc458('0x11')](_0xc458('0x12'),_0xa36533,_0x17a3e8[_0xc458('0x11')]['message']);return _0x2882cb(_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);}logger[_0xc458('0x11')]('SquareMessage,\x20%s,\x20%s',_0xa36533,_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);return _0x36c56e(_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);}else{logger[_0xc458('0xc')](_0xc458('0x12'),_0xa36533,_0xc458('0xd'));_0x36c56e(_0x17a3e8['result']['message']);}})['catch'](function(_0x4d6acc){logger[_0xc458('0x11')](_0xc458('0x12'),_0xa36533,_0x4d6acc);_0x2882cb(_0x4d6acc);});});}exports['CreateSquareMessage']=function(_0x317672){var _0x30fb75=this;return new Promise(function(_0x5b8744,_0x217edc){return db[_0xc458('0x14')]['create'](_0x317672[_0xc458('0x15')],{'raw':_0x317672[_0xc458('0x16')]?_0x317672[_0xc458('0x16')][_0xc458('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3c3624){logger[_0xc458('0xc')]('CreateSquareMessage',_0x317672);logger[_0xc458('0xe')]('CreateSquareMessage',_0x317672,JSON[_0xc458('0x10')](_0x3c3624));_0x5b8744(_0x3c3624);})[_0xc458('0x18')](function(_0x35ecd5){logger[_0xc458('0x11')](_0xc458('0x19'),_0x35ecd5[_0xc458('0x13')],_0x317672);_0x217edc(_0x30fb75[_0xc458('0x11')](0x1f4,_0x35ecd5[_0xc458('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f357a01..c5a3c2c 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 _0xb0f7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','15s','test','post','create','put'];(function(_0x3845a6,_0x2f7b9c){var _0x5ea7ba=function(_0x5235ba){while(--_0x5235ba){_0x3845a6['push'](_0x3845a6['shift']());}};_0x5ea7ba(++_0x2f7b9c);}(_0xb0f7,0x124));var _0x7b0f=function(_0x412972,_0xb063b8){_0x412972=_0x412972-0x0;var _0x31f3cc=_0xb0f7[_0x412972];return _0x31f3cc;};'use strict';var multer=require(_0x7b0f('0x0'));var util=require(_0x7b0f('0x1'));var path=require(_0x7b0f('0x2'));var timeout=require(_0x7b0f('0x3'));var express=require(_0x7b0f('0x4'));var router=express[_0x7b0f('0x5')]();var fs_extra=require(_0x7b0f('0x6'));var auth=require(_0x7b0f('0x7'));var interaction=require(_0x7b0f('0x8'));var config=require(_0x7b0f('0x9'));var controller=require(_0x7b0f('0xa'));router['get']('/',auth[_0x7b0f('0xb')](),controller[_0x7b0f('0xc')]);router[_0x7b0f('0xd')](_0x7b0f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7b0f('0xd')]('/:id/test',auth[_0x7b0f('0xb')](),timeout(_0x7b0f('0xf')),controller[_0x7b0f('0x10')]);router[_0x7b0f('0x11')]('/',auth[_0x7b0f('0xb')](),controller[_0x7b0f('0x12')]);router[_0x7b0f('0x13')](_0x7b0f('0xe'),auth['isAuthenticated'](),controller[_0x7b0f('0x14')]);router[_0x7b0f('0x15')]('/:id',auth[_0x7b0f('0xb')](),controller[_0x7b0f('0x16')]);module[_0x7b0f('0x17')]=router; \ No newline at end of file +var _0xc078=['../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','15s','test','create','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a7981,_0x30cd1e){var _0x4c64cf=function(_0x572902){while(--_0x572902){_0x1a7981['push'](_0x1a7981['shift']());}};_0x4c64cf(++_0x30cd1e);}(_0xc078,0x1bd));var _0x8c07=function(_0x84fb1f,_0xb68308){_0x84fb1f=_0x84fb1f-0x0;var _0x4eadf9=_0xc078[_0x84fb1f];return _0x4eadf9;};'use strict';var multer=require('multer');var util=require(_0x8c07('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c07('0x1'));var router=express['Router']();var fs_extra=require(_0x8c07('0x2'));var auth=require(_0x8c07('0x3'));var interaction=require(_0x8c07('0x4'));var config=require(_0x8c07('0x5'));var controller=require(_0x8c07('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8c07('0x7')](_0x8c07('0x8'),auth[_0x8c07('0x9')](),controller[_0x8c07('0xa')]);router['get']('/:id/test',auth[_0x8c07('0x9')](),timeout(_0x8c07('0xb')),controller[_0x8c07('0xc')]);router['post']('/',auth[_0x8c07('0x9')](),controller[_0x8c07('0xd')]);router['put'](_0x8c07('0x8'),auth[_0x8c07('0x9')](),controller[_0x8c07('0xe')]);router[_0x8c07('0xf')]('/:id',auth[_0x8c07('0x9')](),controller[_0x8c07('0x10')]);module[_0x8c07('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d1b7748..1d2da96 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 _0x865e=['STRING','name','sequelize','exports'];(function(_0x5beb3b,_0x493142){var _0x44aa86=function(_0x822a50){while(--_0x822a50){_0x5beb3b['push'](_0x5beb3b['shift']());}};_0x44aa86(++_0x493142);}(_0x865e,0x1c6));var _0xe865=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x865e[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0xe865('0x0'));module[_0xe865('0x1')]={'name':{'type':Sequelize[_0xe865('0x2')],'unique':_0xe865('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe865('0x2')]}}; \ No newline at end of file +var _0x43c3=['STRING','sequelize'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x43c3,0xcd));var _0x343c=function(_0x30a115,_0x1869d6){_0x30a115=_0x30a115-0x0;var _0x4cc727=_0x43c3[_0x30a115];return _0x4cc727;};'use strict';var Sequelize=require(_0x343c('0x0'));module['exports']={'name':{'type':Sequelize[_0x343c('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x343c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b00bb7a..8dea263 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 _0xb7b3=['query','keys','filters','attributes','intersection','length','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','sendStatus','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model'];(function(_0x21188a,_0x437f2b){var _0x3fb3fa=function(_0x12f8e4){while(--_0x12f8e4){_0x21188a['push'](_0x21188a['shift']());}};_0x3fb3fa(++_0x437f2b);}(_0xb7b3,0xc4));var _0x3b7b=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0xb7b3[_0x294f3d];return _0x2c8f6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b7b('0x0'));var zipdir=require(_0x3b7b('0x1'));var jsonpatch=require(_0x3b7b('0x2'));var rp=require('request-promise');var moment=require(_0x3b7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b7b('0x4'));var util=require(_0x3b7b('0x5'));var path=require(_0x3b7b('0x6'));var sox=require(_0x3b7b('0x7'));var csv=require('to-csv');var ejs=require(_0x3b7b('0x8'));var fs=require('fs');var fs_extra=require(_0x3b7b('0x9'));var _=require(_0x3b7b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b7b('0xb'));var deskjs=require(_0x3b7b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3b7b('0xd'));var Papa=require(_0x3b7b('0xe'));var Redis=require(_0x3b7b('0xf'));var authService=require(_0x3b7b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b7b('0x11'));var logger=require(_0x3b7b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3b7b('0x13'));var licenseUtil=require(_0x3b7b('0x14'));var db=require(_0x3b7b('0x15'))['db'];function respondWithStatusCode(_0x192dba,_0x49b418){_0x49b418=_0x49b418||0xcc;return function(_0x5358d9){if(_0x5358d9){return _0x192dba['sendStatus'](_0x49b418);}return _0x192dba[_0x3b7b('0x16')](_0x49b418)[_0x3b7b('0x17')]();};}function respondWithResult(_0x2444fe,_0x3cb7e5){_0x3cb7e5=_0x3cb7e5||0xc8;return function(_0x4f2168){if(_0x4f2168){return _0x2444fe[_0x3b7b('0x16')](_0x3cb7e5)[_0x3b7b('0x18')](_0x4f2168);}};}function respondWithFilteredResult(_0x5a47f3,_0x5beca5){return function(_0x374903){if(_0x374903){var _0x4803f8=typeof _0x5beca5[_0x3b7b('0x19')]===_0x3b7b('0x1a')&&typeof _0x5beca5[_0x3b7b('0x1b')]===_0x3b7b('0x1a');var _0x2364f1=_0x374903['count'];var _0xace5ac=_0x4803f8?0x0:_0x5beca5[_0x3b7b('0x19')];var _0x130020=_0x4803f8?_0x374903[_0x3b7b('0x1c')]:_0x5beca5[_0x3b7b('0x19')]+_0x5beca5[_0x3b7b('0x1b')];var _0x4ff89b;if(_0x130020>=_0x2364f1){_0x130020=_0x2364f1;_0x4ff89b=0xc8;}else{_0x4ff89b=0xce;}_0x5a47f3['status'](_0x4ff89b);return _0x5a47f3['set'](_0x3b7b('0x1d'),_0xace5ac+'-'+_0x130020+'/'+_0x2364f1)[_0x3b7b('0x18')](_0x374903);}return null;};}function patchUpdates(_0x450a42){return function(_0x444d28){try{jsonpatch[_0x3b7b('0x1e')](_0x444d28,_0x450a42,!![]);}catch(_0x47e06d){return BPromise[_0x3b7b('0x1f')](_0x47e06d);}return _0x444d28[_0x3b7b('0x20')]();};}function saveUpdates(_0x4a760f,_0x10902c){return function(_0x1b0f33){if(_0x1b0f33){return _0x1b0f33[_0x3b7b('0x21')](_0x4a760f)[_0x3b7b('0x22')](function(_0x6b0dea){return _0x6b0dea;});}return null;};}function removeEntity(_0x1c7c0f,_0x531c07){return function(_0x24436a){if(_0x24436a){return _0x24436a[_0x3b7b('0x23')]()[_0x3b7b('0x22')](function(){var _0x1a3b23=_0x24436a[_0x3b7b('0x24')]({'plain':!![]});var _0xa3aa0f=_0x3b7b('0x25');return db['UserProfileResource'][_0x3b7b('0x23')]({'where':{'type':_0xa3aa0f,'resourceId':_0x1a3b23['id']}})[_0x3b7b('0x22')](function(){return _0x24436a;});})[_0x3b7b('0x22')](function(){_0x1c7c0f['status'](0xcc)[_0x3b7b('0x17')]();});}};}function handleEntityNotFound(_0x2f5eac,_0x7c854f){return function(_0x494543){if(!_0x494543){_0x2f5eac[_0x3b7b('0x26')](0x194);}return _0x494543;};}function handleError(_0x126233,_0xd07ac7){_0xd07ac7=_0xd07ac7||0x1f4;return function(_0x169bf2){logger[_0x3b7b('0x27')](_0x169bf2[_0x3b7b('0x28')]);if(_0x169bf2['name']){delete _0x169bf2[_0x3b7b('0x29')];}_0x126233['status'](_0xd07ac7)['send'](_0x169bf2);};}exports[_0x3b7b('0x2a')]=function(_0x30faa5,_0xfae871){var _0x586555={},_0x5e635d={},_0x1bda4b={'count':0x0,'rows':[]};var _0x2ead52=_[_0x3b7b('0x2b')](db[_0x3b7b('0x2c')][_0x3b7b('0x2d')],function(_0x48b7f3){return{'name':_0x48b7f3[_0x3b7b('0x2e')],'type':_0x48b7f3[_0x3b7b('0x2f')][_0x3b7b('0x30')]};});_0x5e635d[_0x3b7b('0x31')]=_[_0x3b7b('0x2b')](_0x2ead52,'name');_0x5e635d[_0x3b7b('0x32')]=_[_0x3b7b('0x33')](_0x30faa5[_0x3b7b('0x32')]);_0x5e635d[_0x3b7b('0x34')]=_['intersection'](_0x5e635d[_0x3b7b('0x31')],_0x5e635d[_0x3b7b('0x32')]);_0x586555[_0x3b7b('0x35')]=_[_0x3b7b('0x36')](_0x5e635d[_0x3b7b('0x31')],qs['fields'](_0x30faa5[_0x3b7b('0x32')]['fields']));_0x586555[_0x3b7b('0x35')]=_0x586555[_0x3b7b('0x35')][_0x3b7b('0x37')]?_0x586555[_0x3b7b('0x35')]:_0x5e635d['model'];if(!_0x30faa5['query']['hasOwnProperty'](_0x3b7b('0x38'))){_0x586555[_0x3b7b('0x1b')]=qs[_0x3b7b('0x1b')](_0x30faa5[_0x3b7b('0x32')][_0x3b7b('0x1b')]);_0x586555[_0x3b7b('0x19')]=qs[_0x3b7b('0x19')](_0x30faa5[_0x3b7b('0x32')][_0x3b7b('0x19')]);}_0x586555['order']=qs['sort'](_0x30faa5['query']['sort']);_0x586555[_0x3b7b('0x39')]=qs['filters'](_[_0x3b7b('0x3a')](_0x30faa5[_0x3b7b('0x32')],_0x5e635d[_0x3b7b('0x34')]),_0x2ead52);if(_0x30faa5[_0x3b7b('0x32')][_0x3b7b('0x3b')]){_0x586555['where']=_[_0x3b7b('0x3c')](_0x586555['where'],{'$or':_['map'](_0x2ead52,function(_0x7689e7){if(_0x7689e7[_0x3b7b('0x2f')]!=='VIRTUAL'){var _0x4371a7={};_0x4371a7[_0x7689e7[_0x3b7b('0x29')]]={'$like':'%'+_0x30faa5[_0x3b7b('0x32')][_0x3b7b('0x3b')]+'%'};return _0x4371a7;}})});}_0x586555=_[_0x3b7b('0x3c')]({},_0x586555,_0x30faa5[_0x3b7b('0x3d')]);var _0x45a7b4={'where':_0x586555[_0x3b7b('0x39')]};return db['SquareOdbc'][_0x3b7b('0x1c')](_0x45a7b4)[_0x3b7b('0x22')](function(_0x1ed6a3){_0x1bda4b[_0x3b7b('0x1c')]=_0x1ed6a3;if(_0x30faa5[_0x3b7b('0x32')][_0x3b7b('0x3e')]){_0x586555[_0x3b7b('0x3f')]=[{'all':!![]}];}return db[_0x3b7b('0x2c')][_0x3b7b('0x40')](_0x586555);})[_0x3b7b('0x22')](function(_0x901611){_0x1bda4b[_0x3b7b('0x41')]=_0x901611;return _0x1bda4b;})['then'](respondWithFilteredResult(_0xfae871,_0x586555))[_0x3b7b('0x42')](handleError(_0xfae871,null));};exports['show']=function(_0x37d64a,_0x4d80f0){var _0x265be0={'raw':!![],'where':{'id':_0x37d64a[_0x3b7b('0x43')]['id']}},_0x1e0bde={};_0x1e0bde[_0x3b7b('0x31')]=_[_0x3b7b('0x33')](db[_0x3b7b('0x2c')][_0x3b7b('0x2d')]);_0x1e0bde['query']=_[_0x3b7b('0x33')](_0x37d64a['query']);_0x1e0bde[_0x3b7b('0x34')]=_[_0x3b7b('0x36')](_0x1e0bde[_0x3b7b('0x31')],_0x1e0bde[_0x3b7b('0x32')]);_0x265be0[_0x3b7b('0x35')]=_['intersection'](_0x1e0bde[_0x3b7b('0x31')],qs[_0x3b7b('0x44')](_0x37d64a[_0x3b7b('0x32')][_0x3b7b('0x44')]));_0x265be0[_0x3b7b('0x35')]=_0x265be0[_0x3b7b('0x35')][_0x3b7b('0x37')]?_0x265be0[_0x3b7b('0x35')]:_0x1e0bde[_0x3b7b('0x31')];if(_0x37d64a[_0x3b7b('0x32')]['includeAll']){_0x265be0[_0x3b7b('0x3f')]=[{'all':!![]}];}_0x265be0=_[_0x3b7b('0x3c')]({},_0x265be0,_0x37d64a[_0x3b7b('0x3d')]);return db[_0x3b7b('0x2c')]['find'](_0x265be0)[_0x3b7b('0x22')](handleEntityNotFound(_0x4d80f0,null))[_0x3b7b('0x22')](respondWithResult(_0x4d80f0,null))['catch'](handleError(_0x4d80f0,null));};exports[_0x3b7b('0x45')]=function(_0x2b3834,_0x477153){return db['SquareOdbc'][_0x3b7b('0x45')](_0x2b3834[_0x3b7b('0x46')],{})[_0x3b7b('0x22')](function(_0x2ff50c){var _0x3f3b3f=_0x2b3834[_0x3b7b('0x47')][_0x3b7b('0x24')]({'plain':!![]});if(!_0x3f3b3f)throw new Error(_0x3b7b('0x48'));if(_0x3f3b3f[_0x3b7b('0x49')]===_0x3b7b('0x47')){var _0x17443c=_0x2ff50c[_0x3b7b('0x24')]({'plain':!![]});var _0x914eca=_0x3b7b('0x25');return db[_0x3b7b('0x4a')][_0x3b7b('0x4b')]({'where':{'name':_0x914eca,'userProfileId':_0x3f3b3f[_0x3b7b('0x4c')]},'raw':!![]})[_0x3b7b('0x22')](function(_0x4e39b3){if(_0x4e39b3&&_0x4e39b3['autoAssociation']===0x0){return db[_0x3b7b('0x4d')]['create']({'name':_0x17443c[_0x3b7b('0x29')],'resourceId':_0x17443c['id'],'type':_0x4e39b3[_0x3b7b('0x29')],'sectionId':_0x4e39b3['id']},{})[_0x3b7b('0x22')](function(){return _0x2ff50c;});}else{return _0x2ff50c;}})['catch'](function(_0x36722f){logger[_0x3b7b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36722f);throw _0x36722f;});}return _0x2ff50c;})[_0x3b7b('0x22')](respondWithResult(_0x477153,0xc9))[_0x3b7b('0x42')](handleError(_0x477153,null));};exports[_0x3b7b('0x21')]=function(_0x3ab9ff,_0x1364d2){if(_0x3ab9ff[_0x3b7b('0x46')]['id']){delete _0x3ab9ff[_0x3b7b('0x46')]['id'];}return db[_0x3b7b('0x2c')][_0x3b7b('0x4b')]({'where':{'id':_0x3ab9ff[_0x3b7b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1364d2,null))[_0x3b7b('0x22')](saveUpdates(_0x3ab9ff[_0x3b7b('0x46')],null))[_0x3b7b('0x22')](respondWithResult(_0x1364d2,null))['catch'](handleError(_0x1364d2,null));};exports[_0x3b7b('0x23')]=function(_0x28fe11,_0x11f4e4){return db['SquareOdbc'][_0x3b7b('0x4b')]({'where':{'id':_0x28fe11[_0x3b7b('0x43')]['id']}})[_0x3b7b('0x22')](handleEntityNotFound(_0x11f4e4,null))['then'](removeEntity(_0x11f4e4,null))[_0x3b7b('0x42')](handleError(_0x11f4e4,null));};exports[_0x3b7b('0x4e')]=function(_0x4d69c7,_0x417673,_0x43c0bb){var _0x711156;return db[_0x3b7b('0x2c')][_0x3b7b('0x4b')]({'where':{'id':_0x4d69c7[_0x3b7b('0x43')]['id']},'attributes':['id',_0x3b7b('0x4f')]})[_0x3b7b('0x22')](handleEntityNotFound(_0x417673,null))['then'](function(_0x1bacd0){if(_0x1bacd0){var _0x49b2f5=require('odbc')();_0x49b2f5[_0x3b7b('0x50')](_0x1bacd0[_0x3b7b('0x4f')]);_0x49b2f5[_0x3b7b('0x51')]();return _0x1bacd0;}})[_0x3b7b('0x22')](respondWithResult(_0x417673,null))['catch'](handleError(_0x417673,null));}; \ No newline at end of file +var _0x774f=['error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','odbc','dsn','closeSync','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','ODBC','UserProfileResource'];(function(_0x11ce79,_0x4d6025){var _0x4805b7=function(_0xbbd0aa){while(--_0xbbd0aa){_0x11ce79['push'](_0x11ce79['shift']());}};_0x4805b7(++_0x4d6025);}(_0x774f,0x185));var _0xf774=function(_0x46f697,_0x38b6c1){_0x46f697=_0x46f697-0x0;var _0xfc274=_0x774f[_0x46f697];return _0xfc274;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf774('0x0'));var zipdir=require(_0xf774('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf774('0x2'));var moment=require('moment');var BPromise=require(_0xf774('0x3'));var Mustache=require(_0xf774('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf774('0x5'));var csv=require(_0xf774('0x6'));var ejs=require(_0xf774('0x7'));var fs=require('fs');var fs_extra=require(_0xf774('0x8'));var _=require('lodash');var squel=require(_0xf774('0x9'));var crypto=require(_0xf774('0xa'));var jsforce=require(_0xf774('0xb'));var deskjs=require(_0xf774('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf774('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf774('0xe'));var hardwareService=require(_0xf774('0xf'));var logger=require(_0xf774('0x10'))(_0xf774('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf774('0x12'));var db=require(_0xf774('0x13'))['db'];function respondWithStatusCode(_0x921ea6,_0x45c139){_0x45c139=_0x45c139||0xcc;return function(_0x9f2930){if(_0x9f2930){return _0x921ea6[_0xf774('0x14')](_0x45c139);}return _0x921ea6[_0xf774('0x15')](_0x45c139)[_0xf774('0x16')]();};}function respondWithResult(_0xb2324d,_0x1c3ebf){_0x1c3ebf=_0x1c3ebf||0xc8;return function(_0x4c9a1d){if(_0x4c9a1d){return _0xb2324d[_0xf774('0x15')](_0x1c3ebf)[_0xf774('0x17')](_0x4c9a1d);}};}function respondWithFilteredResult(_0x212d63,_0x23ba58){return function(_0x400071){if(_0x400071){var _0x2c4303=typeof _0x23ba58['offset']===_0xf774('0x18')&&typeof _0x23ba58[_0xf774('0x19')]===_0xf774('0x18');var _0x37d40b=_0x400071[_0xf774('0x1a')];var _0x31762a=_0x2c4303?0x0:_0x23ba58['offset'];var _0x542749=_0x2c4303?_0x400071[_0xf774('0x1a')]:_0x23ba58['offset']+_0x23ba58[_0xf774('0x19')];var _0x4f1e64;if(_0x542749>=_0x37d40b){_0x542749=_0x37d40b;_0x4f1e64=0xc8;}else{_0x4f1e64=0xce;}_0x212d63[_0xf774('0x15')](_0x4f1e64);return _0x212d63[_0xf774('0x1b')](_0xf774('0x1c'),_0x31762a+'-'+_0x542749+'/'+_0x37d40b)[_0xf774('0x17')](_0x400071);}return null;};}function patchUpdates(_0x394e01){return function(_0x11dd60){try{jsonpatch[_0xf774('0x1d')](_0x11dd60,_0x394e01,!![]);}catch(_0x1d7d6a){return BPromise[_0xf774('0x1e')](_0x1d7d6a);}return _0x11dd60[_0xf774('0x1f')]();};}function saveUpdates(_0xdba81c,_0x45077c){return function(_0x3632bb){if(_0x3632bb){return _0x3632bb['update'](_0xdba81c)[_0xf774('0x20')](function(_0xf38001){return _0xf38001;});}return null;};}function removeEntity(_0x367b67,_0x5ed6c5){return function(_0x33c70f){if(_0x33c70f){return _0x33c70f[_0xf774('0x21')]()[_0xf774('0x20')](function(){var _0x14ae72=_0x33c70f['get']({'plain':!![]});var _0x204326=_0xf774('0x22');return db[_0xf774('0x23')]['destroy']({'where':{'type':_0x204326,'resourceId':_0x14ae72['id']}})[_0xf774('0x20')](function(){return _0x33c70f;});})[_0xf774('0x20')](function(){_0x367b67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2877d7,_0x343bfd){return function(_0x437bb9){if(!_0x437bb9){_0x2877d7['sendStatus'](0x194);}return _0x437bb9;};}function handleError(_0x3e6aad,_0x5b7ef1){_0x5b7ef1=_0x5b7ef1||0x1f4;return function(_0x332a87){logger[_0xf774('0x24')](_0x332a87[_0xf774('0x25')]);if(_0x332a87['name']){delete _0x332a87[_0xf774('0x26')];}_0x3e6aad[_0xf774('0x15')](_0x5b7ef1)[_0xf774('0x27')](_0x332a87);};}exports['index']=function(_0x3adc68,_0x14e860){var _0x4782c7={},_0xfdfa30={},_0x1f49d5={'count':0x0,'rows':[]};var _0x2e9128=_[_0xf774('0x28')](db['SquareOdbc']['rawAttributes'],function(_0x24d749){return{'name':_0x24d749[_0xf774('0x29')],'type':_0x24d749[_0xf774('0x2a')][_0xf774('0x2b')]};});_0xfdfa30['model']=_[_0xf774('0x28')](_0x2e9128,_0xf774('0x26'));_0xfdfa30[_0xf774('0x2c')]=_[_0xf774('0x2d')](_0x3adc68[_0xf774('0x2c')]);_0xfdfa30[_0xf774('0x2e')]=_[_0xf774('0x2f')](_0xfdfa30[_0xf774('0x30')],_0xfdfa30[_0xf774('0x2c')]);_0x4782c7[_0xf774('0x31')]=_[_0xf774('0x2f')](_0xfdfa30[_0xf774('0x30')],qs[_0xf774('0x32')](_0x3adc68[_0xf774('0x2c')][_0xf774('0x32')]));_0x4782c7[_0xf774('0x31')]=_0x4782c7[_0xf774('0x31')][_0xf774('0x33')]?_0x4782c7[_0xf774('0x31')]:_0xfdfa30['model'];if(!_0x3adc68[_0xf774('0x2c')][_0xf774('0x34')](_0xf774('0x35'))){_0x4782c7[_0xf774('0x19')]=qs[_0xf774('0x19')](_0x3adc68['query'][_0xf774('0x19')]);_0x4782c7[_0xf774('0x36')]=qs[_0xf774('0x36')](_0x3adc68['query']['offset']);}_0x4782c7[_0xf774('0x37')]=qs[_0xf774('0x38')](_0x3adc68[_0xf774('0x2c')][_0xf774('0x38')]);_0x4782c7[_0xf774('0x39')]=qs[_0xf774('0x2e')](_[_0xf774('0x3a')](_0x3adc68[_0xf774('0x2c')],_0xfdfa30[_0xf774('0x2e')]),_0x2e9128);if(_0x3adc68['query'][_0xf774('0x3b')]){_0x4782c7['where']=_[_0xf774('0x3c')](_0x4782c7['where'],{'$or':_[_0xf774('0x28')](_0x2e9128,function(_0x68a8f0){if(_0x68a8f0[_0xf774('0x2a')]!==_0xf774('0x3d')){var _0x2e5a6e={};_0x2e5a6e[_0x68a8f0['name']]={'$like':'%'+_0x3adc68['query'][_0xf774('0x3b')]+'%'};return _0x2e5a6e;}})});}_0x4782c7=_['merge']({},_0x4782c7,_0x3adc68['options']);var _0x175851={'where':_0x4782c7[_0xf774('0x39')]};return db['SquareOdbc'][_0xf774('0x1a')](_0x175851)['then'](function(_0x1f2c74){_0x1f49d5[_0xf774('0x1a')]=_0x1f2c74;if(_0x3adc68['query'][_0xf774('0x3e')]){_0x4782c7[_0xf774('0x3f')]=[{'all':!![]}];}return db[_0xf774('0x40')][_0xf774('0x41')](_0x4782c7);})[_0xf774('0x20')](function(_0x19b58f){_0x1f49d5[_0xf774('0x42')]=_0x19b58f;return _0x1f49d5;})[_0xf774('0x20')](respondWithFilteredResult(_0x14e860,_0x4782c7))[_0xf774('0x43')](handleError(_0x14e860,null));};exports[_0xf774('0x44')]=function(_0x4760ec,_0x4702f8){var _0x41d194={'raw':!![],'where':{'id':_0x4760ec[_0xf774('0x45')]['id']}},_0xa3f510={};_0xa3f510[_0xf774('0x30')]=_[_0xf774('0x2d')](db[_0xf774('0x40')][_0xf774('0x46')]);_0xa3f510['query']=_[_0xf774('0x2d')](_0x4760ec[_0xf774('0x2c')]);_0xa3f510[_0xf774('0x2e')]=_[_0xf774('0x2f')](_0xa3f510[_0xf774('0x30')],_0xa3f510[_0xf774('0x2c')]);_0x41d194[_0xf774('0x31')]=_[_0xf774('0x2f')](_0xa3f510[_0xf774('0x30')],qs['fields'](_0x4760ec[_0xf774('0x2c')][_0xf774('0x32')]));_0x41d194[_0xf774('0x31')]=_0x41d194[_0xf774('0x31')][_0xf774('0x33')]?_0x41d194[_0xf774('0x31')]:_0xa3f510[_0xf774('0x30')];if(_0x4760ec[_0xf774('0x2c')][_0xf774('0x3e')]){_0x41d194[_0xf774('0x3f')]=[{'all':!![]}];}_0x41d194=_[_0xf774('0x3c')]({},_0x41d194,_0x4760ec[_0xf774('0x47')]);return db['SquareOdbc'][_0xf774('0x48')](_0x41d194)[_0xf774('0x20')](handleEntityNotFound(_0x4702f8,null))[_0xf774('0x20')](respondWithResult(_0x4702f8,null))['catch'](handleError(_0x4702f8,null));};exports[_0xf774('0x49')]=function(_0x1a47ed,_0x4fb781){return db[_0xf774('0x40')][_0xf774('0x49')](_0x1a47ed[_0xf774('0x4a')],{})['then'](function(_0x3c8243){var _0x16632e=_0x1a47ed[_0xf774('0x4b')][_0xf774('0x4c')]({'plain':!![]});if(!_0x16632e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16632e[_0xf774('0x4d')]==='user'){var _0x2153bc=_0x3c8243[_0xf774('0x4c')]({'plain':!![]});var _0x330d97='ODBC';return db[_0xf774('0x4e')][_0xf774('0x48')]({'where':{'name':_0x330d97,'userProfileId':_0x16632e[_0xf774('0x4f')]},'raw':!![]})['then'](function(_0x38bc32){if(_0x38bc32&&_0x38bc32['autoAssociation']===0x0){return db[_0xf774('0x23')][_0xf774('0x49')]({'name':_0x2153bc['name'],'resourceId':_0x2153bc['id'],'type':_0x38bc32[_0xf774('0x26')],'sectionId':_0x38bc32['id']},{})['then'](function(){return _0x3c8243;});}else{return _0x3c8243;}})[_0xf774('0x43')](function(_0x3e986e){logger[_0xf774('0x24')](_0xf774('0x50'),_0x3e986e);throw _0x3e986e;});}return _0x3c8243;})[_0xf774('0x20')](respondWithResult(_0x4fb781,0xc9))['catch'](handleError(_0x4fb781,null));};exports[_0xf774('0x51')]=function(_0x5bb3dc,_0x2ea173){if(_0x5bb3dc[_0xf774('0x4a')]['id']){delete _0x5bb3dc[_0xf774('0x4a')]['id'];}return db[_0xf774('0x40')][_0xf774('0x48')]({'where':{'id':_0x5bb3dc[_0xf774('0x45')]['id']}})[_0xf774('0x20')](handleEntityNotFound(_0x2ea173,null))['then'](saveUpdates(_0x5bb3dc[_0xf774('0x4a')],null))['then'](respondWithResult(_0x2ea173,null))['catch'](handleError(_0x2ea173,null));};exports[_0xf774('0x21')]=function(_0x16774c,_0x25324){return db[_0xf774('0x40')]['find']({'where':{'id':_0x16774c[_0xf774('0x45')]['id']}})['then'](handleEntityNotFound(_0x25324,null))[_0xf774('0x20')](removeEntity(_0x25324,null))[_0xf774('0x43')](handleError(_0x25324,null));};exports['test']=function(_0x1f4b9c,_0x1feb7a,_0x1f017b){var _0x4723f4;return db['SquareOdbc'][_0xf774('0x48')]({'where':{'id':_0x1f4b9c[_0xf774('0x45')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x1feb7a,null))[_0xf774('0x20')](function(_0x556098){if(_0x556098){var _0x5454b1=require(_0xf774('0x52'))();_0x5454b1['openSync'](_0x556098[_0xf774('0x53')]);_0x5454b1[_0xf774('0x54')]();return _0x556098;}})[_0xf774('0x20')](respondWithResult(_0x1feb7a,null))[_0xf774('0x43')](handleError(_0x1feb7a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5615f81..f3e5c7a 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 _0xfc9e=['request-promise','./squareOdbc.attributes','define','square_odbc','util','../../config/logger','api','moment','bluebird'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xfc9e,0x94));var _0xefc9=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0xfc9e[_0x838813];return _0x2bd32d;};'use strict';var _=require('lodash');var util=require(_0xefc9('0x0'));var logger=require(_0xefc9('0x1'))(_0xefc9('0x2'));var moment=require(_0xefc9('0x3'));var BPromise=require(_0xefc9('0x4'));var rp=require(_0xefc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xefc9('0x6'));module['exports']=function(_0x13a3f3,_0x1f6be1){return _0x13a3f3[_0xefc9('0x7')]('SquareOdbc',attributes,{'tableName':_0xefc9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88f1=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x88f1,0x1a4));var _0x188f=function(_0x82cdf0,_0x4525b2){_0x82cdf0=_0x82cdf0-0x0;var _0x418d8d=_0x88f1[_0x82cdf0];return _0x418d8d;};'use strict';var _=require(_0x188f('0x0'));var util=require(_0x188f('0x1'));var logger=require(_0x188f('0x2'))(_0x188f('0x3'));var moment=require(_0x188f('0x4'));var BPromise=require(_0x188f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x188f('0x6'));var rimraf=require('rimraf');var config=require(_0x188f('0x7'));var attributes=require(_0x188f('0x8'));module[_0x188f('0x9')]=function(_0x55e297,_0x19e2f3){return _0x55e297[_0x188f('0xa')](_0x188f('0xb'),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 773503b..e8c9071 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 _0x7c6e=['model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include'];(function(_0x2ddfb9,_0x53b0a7){var _0x56abc9=function(_0x2c5ed2){while(--_0x2c5ed2){_0x2ddfb9['push'](_0x2ddfb9['shift']());}};_0x56abc9(++_0x53b0a7);}(_0x7c6e,0x19a));var _0xe7c6=function(_0x42d685,_0x1383dc){_0x42d685=_0x42d685-0x0;var _0x1c91c4=_0x7c6e[_0x42d685];return _0x1c91c4;};'use strict';var _=require(_0xe7c6('0x0'));var util=require(_0xe7c6('0x1'));var moment=require(_0xe7c6('0x2'));var BPromise=require(_0xe7c6('0x3'));var rs=require(_0xe7c6('0x4'));var fs=require('fs');var Redis=require(_0xe7c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7c6('0x6'));var logger=require(_0xe7c6('0x7'))(_0xe7c6('0x8'));var config=require(_0xe7c6('0x9'));var jayson=require(_0xe7c6('0xa'));var client=jayson['client'][_0xe7c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd56d6,_0x1f7393,_0x1ca42d){return new BPromise(function(_0x393fe9,_0x5807d8){return client[_0xe7c6('0xc')](_0xd56d6,_0x1ca42d)[_0xe7c6('0xd')](function(_0x48dd97){logger[_0xe7c6('0xe')](_0xe7c6('0xf'),_0x1f7393,'request\x20sent');logger[_0xe7c6('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x1f7393,_0xe7c6('0x11'),JSON[_0xe7c6('0x12')](_0x48dd97));if(_0x48dd97[_0xe7c6('0x13')]){if(_0x48dd97['error'][_0xe7c6('0x14')]===0x1f4){logger[_0xe7c6('0x13')](_0xe7c6('0xf'),_0x1f7393,_0x48dd97[_0xe7c6('0x13')][_0xe7c6('0x15')]);return _0x5807d8(_0x48dd97['error']['message']);}logger[_0xe7c6('0x13')](_0xe7c6('0xf'),_0x1f7393,_0x48dd97['error'][_0xe7c6('0x15')]);return _0x393fe9(_0x48dd97[_0xe7c6('0x13')][_0xe7c6('0x15')]);}else{logger[_0xe7c6('0xe')](_0xe7c6('0xf'),_0x1f7393,_0xe7c6('0x11'));_0x393fe9(_0x48dd97[_0xe7c6('0x16')]['message']);}})[_0xe7c6('0x17')](function(_0x3f988f){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1f7393,_0x3f988f);_0x5807d8(_0x3f988f);});});}exports[_0xe7c6('0x18')]=function(_0x37e16f){var _0x10d977=this;return new Promise(function(_0x280c25,_0x4ed9e9){return db[_0xe7c6('0x19')][_0xe7c6('0x1a')]({'raw':_0x37e16f[_0xe7c6('0x1b')]?_0x37e16f['options'][_0xe7c6('0x1c')]===undefined?!![]:![]:!![],'where':_0x37e16f[_0xe7c6('0x1b')]?_0x37e16f[_0xe7c6('0x1b')][_0xe7c6('0x1d')]||null:null,'attributes':_0x37e16f['options']?_0x37e16f[_0xe7c6('0x1b')][_0xe7c6('0x1e')]||null:null,'include':_0x37e16f[_0xe7c6('0x1b')]?_0x37e16f['options'][_0xe7c6('0x1f')]?_['map'](_0x37e16f[_0xe7c6('0x1b')][_0xe7c6('0x1f')],function(_0x58c518){return{'model':db[_0x58c518[_0xe7c6('0x20')]],'as':_0x58c518['as'],'attributes':_0x58c518[_0xe7c6('0x1e')],'include':_0x58c518[_0xe7c6('0x1f')]?_[_0xe7c6('0x21')](_0x58c518[_0xe7c6('0x1f')],function(_0x59d6a0){return{'model':db[_0x59d6a0[_0xe7c6('0x20')]],'as':_0x59d6a0['as'],'attributes':_0x59d6a0[_0xe7c6('0x1e')],'include':_0x59d6a0[_0xe7c6('0x1f')]?_[_0xe7c6('0x21')](_0x59d6a0['include'],function(_0x10c974){return{'model':db[_0x10c974[_0xe7c6('0x20')]],'as':_0x10c974['as'],'attributes':_0x10c974[_0xe7c6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe7c6('0xd')](function(_0x160794){logger[_0xe7c6('0xe')]('ShowSquareOdbc',_0x37e16f);logger[_0xe7c6('0x10')](_0xe7c6('0x18'),_0x37e16f,JSON[_0xe7c6('0x12')](_0x160794));_0x280c25(_0x160794);})[_0xe7c6('0x17')](function(_0x231b96){logger[_0xe7c6('0x13')]('ShowSquareOdbc',_0x231b96[_0xe7c6('0x15')],_0x37e16f);_0x4ed9e9(_0x10d977[_0xe7c6('0x13')](0x1f4,_0x231b96[_0xe7c6('0x15')]));});});}; \ No newline at end of file +var _0xc7ac=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareOdbc','options','where','attributes','map','include','model','ShowSquareOdbc'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xc7ac,0x136));var _0xcc7a=function(_0x38eec3,_0x4b9ef2){_0x38eec3=_0x38eec3-0x0;var _0x761220=_0xc7ac[_0x38eec3];return _0x761220;};'use strict';var _=require(_0xcc7a('0x0'));var util=require(_0xcc7a('0x1'));var moment=require(_0xcc7a('0x2'));var BPromise=require(_0xcc7a('0x3'));var rs=require(_0xcc7a('0x4'));var fs=require('fs');var Redis=require(_0xcc7a('0x5'));var db=require(_0xcc7a('0x6'))['db'];var utils=require(_0xcc7a('0x7'));var logger=require(_0xcc7a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc7a('0x9')][_0xcc7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dad95,_0xabd0ed,_0x2180f5){return new BPromise(function(_0x40b801,_0x26a146){return client[_0xcc7a('0xb')](_0x5dad95,_0x2180f5)[_0xcc7a('0xc')](function(_0x148b85){logger['info'](_0xcc7a('0xd'),_0xabd0ed,_0xcc7a('0xe'));logger['debug'](_0xcc7a('0xf'),_0xabd0ed,'request\x20sent',JSON[_0xcc7a('0x10')](_0x148b85));if(_0x148b85['error']){if(_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x12')]===0x1f4){logger['error'](_0xcc7a('0xd'),_0xabd0ed,_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x13')]);return _0x26a146(_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x13')]);}logger[_0xcc7a('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xabd0ed,_0x148b85['error'][_0xcc7a('0x13')]);return _0x40b801(_0x148b85['error'][_0xcc7a('0x13')]);}else{logger[_0xcc7a('0x14')]('SquareOdbc,\x20%s,\x20%s',_0xabd0ed,'request\x20sent');_0x40b801(_0x148b85[_0xcc7a('0x15')]['message']);}})[_0xcc7a('0x16')](function(_0x2a16b1){logger['error'](_0xcc7a('0xd'),_0xabd0ed,_0x2a16b1);_0x26a146(_0x2a16b1);});});}exports['ShowSquareOdbc']=function(_0x586eb6){var _0x5d8be8=this;return new Promise(function(_0x52140c,_0x1e99e4){return db[_0xcc7a('0x17')]['find']({'raw':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x19')]||null:null,'attributes':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x1a')]||null:null,'include':_0x586eb6['options']?_0x586eb6[_0xcc7a('0x18')]['include']?_[_0xcc7a('0x1b')](_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x1c')],function(_0x22ce83){return{'model':db[_0x22ce83[_0xcc7a('0x1d')]],'as':_0x22ce83['as'],'attributes':_0x22ce83['attributes'],'include':_0x22ce83[_0xcc7a('0x1c')]?_[_0xcc7a('0x1b')](_0x22ce83[_0xcc7a('0x1c')],function(_0x416dbc){return{'model':db[_0x416dbc[_0xcc7a('0x1d')]],'as':_0x416dbc['as'],'attributes':_0x416dbc['attributes'],'include':_0x416dbc[_0xcc7a('0x1c')]?_[_0xcc7a('0x1b')](_0x416dbc[_0xcc7a('0x1c')],function(_0x151969){return{'model':db[_0x151969[_0xcc7a('0x1d')]],'as':_0x151969['as'],'attributes':_0x151969[_0xcc7a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc7a('0xc')](function(_0x2b0127){logger[_0xcc7a('0x14')]('ShowSquareOdbc',_0x586eb6);logger['debug'](_0xcc7a('0x1e'),_0x586eb6,JSON['stringify'](_0x2b0127));_0x52140c(_0x2b0127);})[_0xcc7a('0x16')](function(_0x4d82f3){logger[_0xcc7a('0x11')](_0xcc7a('0x1e'),_0x4d82f3['message'],_0x586eb6);_0x1e99e4(_0x5d8be8[_0xcc7a('0x11')](0x1f4,_0x4d82f3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 12aa428..d89bdd0 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 _0x5b2e=['removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','post','create','addUsers','put','update','delete','destroy'];(function(_0x267084,_0x563c79){var _0x17b8bd=function(_0x212995){while(--_0x212995){_0x267084['push'](_0x267084['shift']());}};_0x17b8bd(++_0x563c79);}(_0x5b2e,0x147));var _0xe5b2=function(_0x4fd03e,_0x48a631){_0x4fd03e=_0x4fd03e-0x0;var _0x471df7=_0x5b2e[_0x4fd03e];return _0x471df7;};'use strict';var multer=require(_0xe5b2('0x0'));var util=require(_0xe5b2('0x1'));var path=require(_0xe5b2('0x2'));var timeout=require(_0xe5b2('0x3'));var express=require(_0xe5b2('0x4'));var router=express[_0xe5b2('0x5')]();var fs_extra=require(_0xe5b2('0x6'));var auth=require(_0xe5b2('0x7'));var interaction=require(_0xe5b2('0x8'));var config=require(_0xe5b2('0x9'));var controller=require('./squareProject.controller');router[_0xe5b2('0xa')]('/',auth[_0xe5b2('0xb')](),controller[_0xe5b2('0xc')]);router['get'](_0xe5b2('0xd'),auth[_0xe5b2('0xb')](),controller[_0xe5b2('0xe')]);router[_0xe5b2('0xa')](_0xe5b2('0xf'),auth[_0xe5b2('0xb')](),controller['getUsers']);router[_0xe5b2('0x10')]('/',auth[_0xe5b2('0xb')](),controller[_0xe5b2('0x11')]);router[_0xe5b2('0x10')](_0xe5b2('0xf'),auth[_0xe5b2('0xb')](),controller[_0xe5b2('0x12')]);router[_0xe5b2('0x13')]('/:id',auth[_0xe5b2('0xb')](),controller[_0xe5b2('0x14')]);router[_0xe5b2('0x15')](_0xe5b2('0xd'),auth[_0xe5b2('0xb')](),controller[_0xe5b2('0x16')]);router[_0xe5b2('0x15')](_0xe5b2('0xf'),auth[_0xe5b2('0xb')](),controller[_0xe5b2('0x17')]);module[_0xe5b2('0x18')]=router; \ No newline at end of file +var _0xa03c=['delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update'];(function(_0x244961,_0xdb54c4){var _0x1f15de=function(_0x1709e1){while(--_0x1709e1){_0x244961['push'](_0x244961['shift']());}};_0x1f15de(++_0xdb54c4);}(_0xa03c,0x94));var _0xca03=function(_0x2695dd,_0x1986b1){_0x2695dd=_0x2695dd-0x0;var _0x361e8a=_0xa03c[_0x2695dd];return _0x361e8a;};'use strict';var multer=require(_0xca03('0x0'));var util=require('util');var path=require(_0xca03('0x1'));var timeout=require(_0xca03('0x2'));var express=require(_0xca03('0x3'));var router=express['Router']();var fs_extra=require(_0xca03('0x4'));var auth=require(_0xca03('0x5'));var interaction=require(_0xca03('0x6'));var config=require('../../config/environment');var controller=require(_0xca03('0x7'));router[_0xca03('0x8')]('/',auth[_0xca03('0x9')](),controller[_0xca03('0xa')]);router[_0xca03('0x8')](_0xca03('0xb'),auth['isAuthenticated'](),controller[_0xca03('0xc')]);router[_0xca03('0x8')](_0xca03('0xd'),auth[_0xca03('0x9')](),controller[_0xca03('0xe')]);router[_0xca03('0xf')]('/',auth[_0xca03('0x9')](),controller[_0xca03('0x10')]);router[_0xca03('0xf')](_0xca03('0xd'),auth['isAuthenticated'](),controller[_0xca03('0x11')]);router[_0xca03('0x12')](_0xca03('0xb'),auth[_0xca03('0x9')](),controller[_0xca03('0x13')]);router[_0xca03('0x14')](_0xca03('0xb'),auth[_0xca03('0x9')](),controller[_0xca03('0x15')]);router[_0xca03('0x14')](_0xca03('0xd'),auth[_0xca03('0x9')](),controller[_0xca03('0x16')]);module[_0xca03('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 422c0fd..a839861 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 _0x1cd3=['production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue','toString'];(function(_0x129a29,_0x2ea957){var _0x7d9ea8=function(_0x295bee){while(--_0x295bee){_0x129a29['push'](_0x129a29['shift']());}};_0x7d9ea8(++_0x2ea957);}(_0x1cd3,0xda));var _0x31cd=function(_0x2abc86,_0x15ce12){_0x2abc86=_0x2abc86-0x0;var _0x1120a9=_0x1cd3[_0x2abc86];return _0x1120a9;};'use strict';var Sequelize=require(_0x31cd('0x0'));module[_0x31cd('0x1')]={'name':{'type':Sequelize[_0x31cd('0x2')],'unique':_0x31cd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x31cd('0x2')]},'notes':{'type':Sequelize[_0x31cd('0x4')]},'preproduction':{'type':Sequelize[_0x31cd('0x5')](_0x31cd('0x6')),'get':function(){if(this['getDataValue'](_0x31cd('0x7'))){return this[_0x31cd('0x8')](_0x31cd('0x7'))[_0x31cd('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x31cd('0x5')](_0x31cd('0x6')),'get':function(){if(this[_0x31cd('0x8')](_0x31cd('0xa'))){return this[_0x31cd('0x8')](_0x31cd('0xa'))[_0x31cd('0x9')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x31cd('0xb')]}}; \ No newline at end of file +var _0xf271=['utf8','production','DATE','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','toString'];(function(_0x1fa18a,_0x3be4a9){var _0x1d5a72=function(_0x1c91dc){while(--_0x1c91dc){_0x1fa18a['push'](_0x1fa18a['shift']());}};_0x1d5a72(++_0x3be4a9);}(_0xf271,0x10b));var _0x1f27=function(_0x1f1f7c,_0x4863fe){_0x1f1f7c=_0x1f1f7c-0x0;var _0x277975=_0xf271[_0x1f1f7c];return _0x277975;};'use strict';var Sequelize=require(_0x1f27('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f27('0x1')],'unique':_0x1f27('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1f27('0x3')](_0x1f27('0x4')),'get':function(){if(this[_0x1f27('0x5')](_0x1f27('0x6'))){return this[_0x1f27('0x5')](_0x1f27('0x6'))[_0x1f27('0x7')](_0x1f27('0x8'));}}},'production':{'type':Sequelize[_0x1f27('0x3')](_0x1f27('0x4')),'get':function(){if(this[_0x1f27('0x5')](_0x1f27('0x9'))){return this[_0x1f27('0x5')](_0x1f27('0x9'))[_0x1f27('0x7')](_0x1f27('0x8'));}}},'savedAt':{'type':Sequelize[_0x1f27('0xa')]},'publishedAt':{'type':Sequelize[_0x1f27('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 15abf76..1e5dda1 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 _0xc1c6=['../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','SquareProjects','then','publish','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SquareProject','includeAll','include','rows','show','params','keys','find','catch','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','pick','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis'];(function(_0x15ebdc,_0x59bff2){var _0x29ad66=function(_0x6f0e0c){while(--_0x6f0e0c){_0x15ebdc['push'](_0x15ebdc['shift']());}};_0x29ad66(++_0x59bff2);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2d1a7f,_0x4a0274){_0x2d1a7f=_0x2d1a7f-0x0;var _0x20c713=_0xc1c6[_0x2d1a7f];return _0x20c713;};'use strict';var _=require(_0x6c1c('0x0'));var Redis=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var logger=require('../../config/logger')(_0x6c1c('0x3'));var config=require('../../config/environment');var db=require(_0x6c1c('0x4'))['db'];config[_0x6c1c('0x5')]=_[_0x6c1c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c1c('0x7'))(new Redis(config['redis']));require(_0x6c1c('0x8'))['register'](socket);function respondWithStatusCode(_0xe510ca,_0x2eb1ba){_0x2eb1ba=_0x2eb1ba||0xcc;return function(_0x38369d){if(_0x38369d){return _0xe510ca[_0x6c1c('0x9')](_0x2eb1ba);}return _0xe510ca['status'](_0x2eb1ba)[_0x6c1c('0xa')]();};}function respondWithResult(_0x3ca985,_0x524d21){_0x524d21=_0x524d21||0xc8;return function(_0x147c7b){if(_0x147c7b){return _0x3ca985[_0x6c1c('0xb')](_0x524d21)[_0x6c1c('0xc')](_0x147c7b);}};}function respondWithFilteredResult(_0x1137e8,_0x49fb01){return function(_0x3a25a2){if(_0x3a25a2){var _0x2a4fd4=typeof _0x49fb01[_0x6c1c('0xd')]==='undefined'&&typeof _0x49fb01[_0x6c1c('0xe')]===_0x6c1c('0xf');var _0x2067bd=_0x3a25a2['count'];var _0x2e82e9=_0x2a4fd4?0x0:_0x49fb01['offset'];var _0x357370=_0x2a4fd4?_0x3a25a2[_0x6c1c('0x10')]:_0x49fb01[_0x6c1c('0xd')]+_0x49fb01[_0x6c1c('0xe')];var _0x350e6f;if(_0x357370>=_0x2067bd){_0x357370=_0x2067bd;_0x350e6f=0xc8;}else{_0x350e6f=0xce;}_0x1137e8[_0x6c1c('0xb')](_0x350e6f);return _0x1137e8[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x2e82e9+'-'+_0x357370+'/'+_0x2067bd)[_0x6c1c('0xc')](_0x3a25a2);}return null;};}function saveUpdates(_0x5f3758){return function(_0x3df1b7){if(_0x3df1b7){return _0x3df1b7[_0x6c1c('0x13')](_0x5f3758)['then'](function(_0x3a2d32){return _0x3a2d32;});}return null;};}function removeEntity(_0x237cac){return function(_0x494ffc){if(_0x494ffc){return _0x494ffc[_0x6c1c('0x14')]()['then'](function(){var _0x338dc2=_0x494ffc[_0x6c1c('0x15')]({'plain':!![]});var _0x5a3bb7=_0x6c1c('0x16');return db['UserProfileResource'][_0x6c1c('0x14')]({'where':{'type':_0x5a3bb7,'resourceId':_0x338dc2['id']}})[_0x6c1c('0x17')](function(){return _0x494ffc;});})[_0x6c1c('0x17')](function(){var _0x211f49=new Redis(config[_0x6c1c('0x5')]);_0x211f49[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON[_0x6c1c('0x1a')]({'id':_0x494ffc['id'],'deleted':!![]}));})[_0x6c1c('0x17')](function(){_0x237cac[_0x6c1c('0xb')](0xcc)[_0x6c1c('0xa')]();});}};}function handleEntityNotFound(_0x450b1f){return function(_0x2382c0){if(!_0x2382c0){_0x450b1f[_0x6c1c('0x9')](0x194);}return _0x2382c0;};}function handleError(_0x31fed2,_0x19c269){_0x19c269=_0x19c269||0x1f4;return function(_0x2319d3){logger[_0x6c1c('0x1b')](_0x2319d3[_0x6c1c('0x1c')]);if(_0x2319d3[_0x6c1c('0x1d')]){delete _0x2319d3[_0x6c1c('0x1d')];}_0x31fed2[_0x6c1c('0xb')](_0x19c269)[_0x6c1c('0x1e')](_0x2319d3);};}exports[_0x6c1c('0x1f')]=function(_0x18452d,_0x80bc05){var _0x3b7cc1={},_0x1b9d7d={},_0x2feaf4={'count':0x0,'rows':[]};var _0x5f4568=_[_0x6c1c('0x20')](db['SquareProject'][_0x6c1c('0x21')],function(_0x4c23f8){return{'name':_0x4c23f8[_0x6c1c('0x22')],'type':_0x4c23f8['type'][_0x6c1c('0x23')]};});_0x1b9d7d[_0x6c1c('0x24')]=_['map'](_0x5f4568,_0x6c1c('0x1d'));_0x1b9d7d[_0x6c1c('0x25')]=_['keys'](_0x18452d[_0x6c1c('0x25')]);_0x1b9d7d[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],_0x1b9d7d['query']);_0x3b7cc1['attributes']=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x28')]));_0x3b7cc1[_0x6c1c('0x29')]=_0x3b7cc1['attributes'][_0x6c1c('0x2a')]?_0x3b7cc1[_0x6c1c('0x29')]:_0x1b9d7d['model'];if(!_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2b')](_0x6c1c('0x2c'))){_0x3b7cc1[_0x6c1c('0xe')]=qs['limit'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0xe')]);_0x3b7cc1[_0x6c1c('0xd')]=qs['offset'](_0x18452d[_0x6c1c('0x25')]['offset']);}_0x3b7cc1[_0x6c1c('0x2d')]=qs['sort'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2e')]);_0x3b7cc1[_0x6c1c('0x2f')]=qs['filters'](_['pick'](_0x18452d[_0x6c1c('0x25')],_0x1b9d7d[_0x6c1c('0x26')]),_0x5f4568);if(_0x18452d[_0x6c1c('0x25')]['filter']){_0x3b7cc1[_0x6c1c('0x2f')]=_['merge'](_0x3b7cc1['where'],{'$or':_[_0x6c1c('0x20')](_0x5f4568,function(_0xbafcb3){if(_0xbafcb3[_0x6c1c('0x30')]!==_0x6c1c('0x31')){var _0x4bed10={};_0x4bed10[_0xbafcb3[_0x6c1c('0x1d')]]={'$like':'%'+_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4bed10;}})});}_0x3b7cc1=_[_0x6c1c('0x33')]({},_0x3b7cc1,_0x18452d[_0x6c1c('0x34')]);var _0x398e95={'where':_0x3b7cc1[_0x6c1c('0x2f')]};return db[_0x6c1c('0x35')][_0x6c1c('0x10')](_0x398e95)[_0x6c1c('0x17')](function(_0x47d75e){_0x2feaf4[_0x6c1c('0x10')]=_0x47d75e;if(_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x36')]){_0x3b7cc1[_0x6c1c('0x37')]=[{'all':!![]}];}return db[_0x6c1c('0x35')]['findAll'](_0x3b7cc1);})['then'](function(_0x549db1){_0x2feaf4[_0x6c1c('0x38')]=_0x549db1;return _0x2feaf4;})['then'](respondWithFilteredResult(_0x80bc05,_0x3b7cc1))['catch'](handleError(_0x80bc05,null));};exports[_0x6c1c('0x39')]=function(_0x37244e,_0x5f3f3e){var _0x2b2ae5={'raw':![],'where':{'id':_0x37244e[_0x6c1c('0x3a')]['id']}},_0x40645f={};_0x40645f['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x35')]['rawAttributes']);_0x40645f[_0x6c1c('0x25')]=_['keys'](_0x37244e[_0x6c1c('0x25')]);_0x40645f[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],_0x40645f[_0x6c1c('0x25')]);_0x2b2ae5['attributes']=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x37244e['query'][_0x6c1c('0x28')]));_0x2b2ae5[_0x6c1c('0x29')]=_0x2b2ae5[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x2b2ae5[_0x6c1c('0x29')]:_0x40645f['model'];if(_0x37244e[_0x6c1c('0x25')]['includeAll']){_0x2b2ae5['include']=[{'all':!![]}];}_0x2b2ae5=_['merge']({},_0x2b2ae5,_0x37244e[_0x6c1c('0x34')]);return db[_0x6c1c('0x35')][_0x6c1c('0x3c')](_0x2b2ae5)[_0x6c1c('0x17')](handleEntityNotFound(_0x5f3f3e,null))[_0x6c1c('0x17')](respondWithResult(_0x5f3f3e,null))[_0x6c1c('0x3d')](handleError(_0x5f3f3e,null));};exports[_0x6c1c('0x3e')]=function(_0x167f3b,_0x5ed2d7){return db[_0x6c1c('0x35')][_0x6c1c('0x3e')](_0x167f3b['body'],{})[_0x6c1c('0x17')](function(_0x5518f6){var _0x39e741=_0x167f3b[_0x6c1c('0x3f')][_0x6c1c('0x15')]({'plain':!![]});if(!_0x39e741)throw new Error(_0x6c1c('0x40'));if(_0x39e741[_0x6c1c('0x41')]==='user'){var _0x1fe6e8=_0x5518f6['get']({'plain':!![]});var _0x2a59bc=_0x6c1c('0x16');return db[_0x6c1c('0x42')][_0x6c1c('0x3c')]({'where':{'name':_0x2a59bc,'userProfileId':_0x39e741[_0x6c1c('0x43')]},'raw':!![]})[_0x6c1c('0x17')](function(_0x52c14d){if(_0x52c14d&&_0x52c14d[_0x6c1c('0x44')]===0x0){return db[_0x6c1c('0x45')]['create']({'name':_0x1fe6e8[_0x6c1c('0x1d')],'resourceId':_0x1fe6e8['id'],'type':_0x52c14d[_0x6c1c('0x1d')],'sectionId':_0x52c14d['id']},{})[_0x6c1c('0x17')](function(){return _0x5518f6;});}else{return _0x5518f6;}})[_0x6c1c('0x3d')](function(_0x5badb4){logger[_0x6c1c('0x1b')](_0x6c1c('0x46'),_0x5badb4);throw _0x5badb4;});}return _0x5518f6;})[_0x6c1c('0x17')](respondWithResult(_0x5ed2d7,0xc9))['catch'](handleError(_0x5ed2d7,null));};exports['update']=function(_0x56b367,_0x5714a6){if(_0x56b367['body']['id']){delete _0x56b367[_0x6c1c('0x47')]['id'];}return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x56b367[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x17')](saveUpdates(_0x56b367['body'],null))['then'](function(_0x28bd68){if(!_0x28bd68)return;var _0xd5936=_0x28bd68['get']({'plain':!![]});return _0xd5936;})[_0x6c1c('0x17')](function(_0x25dda9){var _0x3f4303=new Redis(config[_0x6c1c('0x5')]);_0x3f4303[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON['stringify'](_[_0x6c1c('0x48')](_0x25dda9,['id',_0x6c1c('0x1d'),'production'])));return _0x25dda9;})['then'](respondWithResult(_0x5714a6,null))[_0x6c1c('0x3d')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x14')]=function(_0x3a2fef,_0x58ac8d){return db[_0x6c1c('0x35')][_0x6c1c('0x3c')]({'where':{'id':_0x3a2fef[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x58ac8d,null))['then'](removeEntity(_0x58ac8d,null))['catch'](handleError(_0x58ac8d,null));};exports[_0x6c1c('0x49')]=function(_0x1ac7e4,_0x1a8e19){return db['SquareProject']['find']({'where':{'id':_0x1ac7e4[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x1a8e19,null))['then'](function(_0x2a334b){if(_0x2a334b){return _0x2a334b[_0x6c1c('0x49')](_0x1ac7e4[_0x6c1c('0x47')][_0x6c1c('0x4a')],_[_0x6c1c('0x4b')](_0x1ac7e4[_0x6c1c('0x47')],['ids','id'])||{});}})[_0x6c1c('0x17')](respondWithResult(_0x1a8e19,null))['catch'](handleError(_0x1a8e19,null));};exports[_0x6c1c('0x4c')]=function(_0x1930ea,_0x117240){return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x1930ea['params']['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x117240,null))[_0x6c1c('0x17')](function(_0x612be2){if(_0x612be2){return _0x612be2['removeUsers'](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])[_0x6c1c('0x17')](function(){if(_[_0x6c1c('0x4d')](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])){for(var _0xed095f=0x0;_0xed095f<_0x1930ea['query'][_0x6c1c('0x4a')]['length'];_0xed095f+=0x1){socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')][_0xed095f]),'SquareProjectId':Number(_0x1930ea['params']['id'])});}}else{socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')]),'SquareProjectId':Number(_0x1930ea[_0x6c1c('0x3a')]['id'])});}});}})[_0x6c1c('0x17')](respondWithStatusCode(_0x117240,null))[_0x6c1c('0x3d')](handleError(_0x117240,null));};exports[_0x6c1c('0x50')]=function(_0x2d248c,_0x13963a){var _0x26ee48={};var _0x4fa646={};var _0x43d379;var _0x6b05c7;return db[_0x6c1c('0x35')][_0x6c1c('0x51')]({'where':{'id':_0x2d248c[_0x6c1c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13963a,null))[_0x6c1c('0x17')](function(_0x39636a){if(_0x39636a){_0x43d379=_0x39636a;_0x4fa646['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x52')][_0x6c1c('0x21')]);_0x4fa646['query']=_[_0x6c1c('0x3b')](_0x2d248c[_0x6c1c('0x25')]);_0x4fa646[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x4fa646[_0x6c1c('0x24')],_0x4fa646[_0x6c1c('0x25')]);_0x26ee48['attributes']=_['intersection'](_0x4fa646[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x2d248c['query']['fields']));_0x26ee48['attributes']=_0x26ee48[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x26ee48[_0x6c1c('0x29')]:_0x4fa646[_0x6c1c('0x24')];_0x26ee48['order']=qs[_0x6c1c('0x2e')](_0x2d248c['query']['sort']);_0x26ee48['where']=qs[_0x6c1c('0x26')](_[_0x6c1c('0x48')](_0x2d248c[_0x6c1c('0x25')],_0x4fa646[_0x6c1c('0x26')]));if(_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]){_0x26ee48['where']=_[_0x6c1c('0x33')](_0x26ee48[_0x6c1c('0x2f')],{'$or':_[_0x6c1c('0x20')](_0x26ee48['attributes'],function(_0x585a42){var _0x4ea97d={};_0x4ea97d[_0x585a42]={'$like':'%'+_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4ea97d;})});}_0x26ee48=_['merge']({},_0x26ee48,_0x2d248c[_0x6c1c('0x34')]);return _0x43d379['getUsers'](_0x26ee48);}})[_0x6c1c('0x17')](function(_0x1fc46f){if(_0x1fc46f){_0x6b05c7=_0x1fc46f[_0x6c1c('0x2a')];if(!_0x2d248c[_0x6c1c('0x25')]['hasOwnProperty'](_0x6c1c('0x2c'))){_0x26ee48[_0x6c1c('0xe')]=qs['limit'](_0x2d248c['query'][_0x6c1c('0xe')]);_0x26ee48[_0x6c1c('0xd')]=qs[_0x6c1c('0xd')](_0x2d248c['query'][_0x6c1c('0xd')]);}return _0x43d379[_0x6c1c('0x50')](_0x26ee48);}})['then'](function(_0x4a730a){if(_0x4a730a){return _0x4a730a?{'count':_0x6b05c7,'rows':_0x4a730a}:null;}})['then'](respondWithResult(_0x13963a,null))['catch'](handleError(_0x13963a,null));}; \ No newline at end of file +var _0xc2c7=['getUsers','User','order','nolimit','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','stringify','error','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','SquareProject','include','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','publish','agi','production','omit','ids','removeUsers','isArray','emit','userSquareProject:remove'];(function(_0xb47459,_0x591914){var _0x2bb784=function(_0x5727e2){while(--_0x5727e2){_0xb47459['push'](_0xb47459['shift']());}};_0x2bb784(++_0x591914);}(_0xc2c7,0x134));var _0x7c2c=function(_0x14782e,_0x2b7aad){_0x14782e=_0x14782e-0x0;var _0x24cb10=_0xc2c7[_0x14782e];return _0x24cb10;};'use strict';var _=require('lodash');var Redis=require(_0x7c2c('0x0'));var qs=require(_0x7c2c('0x1'));var logger=require(_0x7c2c('0x2'))(_0x7c2c('0x3'));var config=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];config[_0x7c2c('0x6')]=_[_0x7c2c('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7c2c('0x8'))(new Redis(config[_0x7c2c('0x6')]));require(_0x7c2c('0x9'))['register'](socket);function respondWithStatusCode(_0x4abe93,_0x5a1027){_0x5a1027=_0x5a1027||0xcc;return function(_0x2274cd){if(_0x2274cd){return _0x4abe93[_0x7c2c('0xa')](_0x5a1027);}return _0x4abe93[_0x7c2c('0xb')](_0x5a1027)[_0x7c2c('0xc')]();};}function respondWithResult(_0x279cff,_0x57b107){_0x57b107=_0x57b107||0xc8;return function(_0x3093d2){if(_0x3093d2){return _0x279cff[_0x7c2c('0xb')](_0x57b107)[_0x7c2c('0xd')](_0x3093d2);}};}function respondWithFilteredResult(_0x1bfeaf,_0x2587ec){return function(_0x1c66b4){if(_0x1c66b4){var _0x2cb057=typeof _0x2587ec[_0x7c2c('0xe')]===_0x7c2c('0xf')&&typeof _0x2587ec[_0x7c2c('0x10')]===_0x7c2c('0xf');var _0x45847d=_0x1c66b4[_0x7c2c('0x11')];var _0x132133=_0x2cb057?0x0:_0x2587ec[_0x7c2c('0xe')];var _0x29fe58=_0x2cb057?_0x1c66b4['count']:_0x2587ec['offset']+_0x2587ec[_0x7c2c('0x10')];var _0xd1a3db;if(_0x29fe58>=_0x45847d){_0x29fe58=_0x45847d;_0xd1a3db=0xc8;}else{_0xd1a3db=0xce;}_0x1bfeaf[_0x7c2c('0xb')](_0xd1a3db);return _0x1bfeaf['set'](_0x7c2c('0x12'),_0x132133+'-'+_0x29fe58+'/'+_0x45847d)[_0x7c2c('0xd')](_0x1c66b4);}return null;};}function saveUpdates(_0x5e55e0){return function(_0x88f54b){if(_0x88f54b){return _0x88f54b['update'](_0x5e55e0)[_0x7c2c('0x13')](function(_0x51b73c){return _0x51b73c;});}return null;};}function removeEntity(_0x342ea2){return function(_0x3c948a){if(_0x3c948a){return _0x3c948a[_0x7c2c('0x14')]()[_0x7c2c('0x13')](function(){var _0x17df4a=_0x3c948a[_0x7c2c('0x15')]({'plain':!![]});var _0x2c1378=_0x7c2c('0x16');return db[_0x7c2c('0x17')][_0x7c2c('0x14')]({'where':{'type':_0x2c1378,'resourceId':_0x17df4a['id']}})[_0x7c2c('0x13')](function(){return _0x3c948a;});})[_0x7c2c('0x13')](function(){var _0x55116a=new Redis(config[_0x7c2c('0x6')]);_0x55116a['publish']('agi',JSON[_0x7c2c('0x18')]({'id':_0x3c948a['id'],'deleted':!![]}));})[_0x7c2c('0x13')](function(){_0x342ea2[_0x7c2c('0xb')](0xcc)[_0x7c2c('0xc')]();});}};}function handleEntityNotFound(_0x41552f){return function(_0x1883b5){if(!_0x1883b5){_0x41552f[_0x7c2c('0xa')](0x194);}return _0x1883b5;};}function handleError(_0x541368,_0x10c356){_0x10c356=_0x10c356||0x1f4;return function(_0x4dedd8){logger[_0x7c2c('0x19')](_0x4dedd8['stack']);if(_0x4dedd8[_0x7c2c('0x1a')]){delete _0x4dedd8[_0x7c2c('0x1a')];}_0x541368[_0x7c2c('0xb')](_0x10c356)['send'](_0x4dedd8);};}exports['index']=function(_0x31a50c,_0x30c53e){var _0x3d2b8d={},_0x150690={},_0x31d8f3={'count':0x0,'rows':[]};var _0xa8e145=_[_0x7c2c('0x1b')](db['SquareProject'][_0x7c2c('0x1c')],function(_0xf39941){return{'name':_0xf39941[_0x7c2c('0x1d')],'type':_0xf39941[_0x7c2c('0x1e')][_0x7c2c('0x1f')]};});_0x150690[_0x7c2c('0x20')]=_[_0x7c2c('0x1b')](_0xa8e145,_0x7c2c('0x1a'));_0x150690[_0x7c2c('0x21')]=_['keys'](_0x31a50c[_0x7c2c('0x21')]);_0x150690[_0x7c2c('0x22')]=_[_0x7c2c('0x23')](_0x150690[_0x7c2c('0x20')],_0x150690['query']);_0x3d2b8d[_0x7c2c('0x24')]=_[_0x7c2c('0x23')](_0x150690[_0x7c2c('0x20')],qs[_0x7c2c('0x25')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x25')]));_0x3d2b8d[_0x7c2c('0x24')]=_0x3d2b8d['attributes'][_0x7c2c('0x26')]?_0x3d2b8d[_0x7c2c('0x24')]:_0x150690[_0x7c2c('0x20')];if(!_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x27')]('nolimit')){_0x3d2b8d['limit']=qs[_0x7c2c('0x10')](_0x31a50c['query']['limit']);_0x3d2b8d[_0x7c2c('0xe')]=qs[_0x7c2c('0xe')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0xe')]);}_0x3d2b8d['order']=qs[_0x7c2c('0x28')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x28')]);_0x3d2b8d[_0x7c2c('0x29')]=qs[_0x7c2c('0x22')](_[_0x7c2c('0x2a')](_0x31a50c[_0x7c2c('0x21')],_0x150690[_0x7c2c('0x22')]),_0xa8e145);if(_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x2b')]){_0x3d2b8d[_0x7c2c('0x29')]=_[_0x7c2c('0x2c')](_0x3d2b8d[_0x7c2c('0x29')],{'$or':_['map'](_0xa8e145,function(_0x54cbb7){if(_0x54cbb7[_0x7c2c('0x1e')]!=='VIRTUAL'){var _0x4c421c={};_0x4c421c[_0x54cbb7['name']]={'$like':'%'+_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x2b')]+'%'};return _0x4c421c;}})});}_0x3d2b8d=_[_0x7c2c('0x2c')]({},_0x3d2b8d,_0x31a50c[_0x7c2c('0x2d')]);var _0x1cf51e={'where':_0x3d2b8d[_0x7c2c('0x29')]};return db[_0x7c2c('0x2e')][_0x7c2c('0x11')](_0x1cf51e)[_0x7c2c('0x13')](function(_0x3bd119){_0x31d8f3[_0x7c2c('0x11')]=_0x3bd119;if(_0x31a50c['query']['includeAll']){_0x3d2b8d[_0x7c2c('0x2f')]=[{'all':!![]}];}return db[_0x7c2c('0x2e')][_0x7c2c('0x30')](_0x3d2b8d);})[_0x7c2c('0x13')](function(_0x5e8c96){_0x31d8f3[_0x7c2c('0x31')]=_0x5e8c96;return _0x31d8f3;})[_0x7c2c('0x13')](respondWithFilteredResult(_0x30c53e,_0x3d2b8d))[_0x7c2c('0x32')](handleError(_0x30c53e,null));};exports[_0x7c2c('0x33')]=function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'raw':![],'where':{'id':_0x18e288[_0x7c2c('0x34')]['id']}},_0x2e4093={};_0x2e4093['model']=_[_0x7c2c('0x35')](db['SquareProject'][_0x7c2c('0x1c')]);_0x2e4093[_0x7c2c('0x21')]=_['keys'](_0x18e288[_0x7c2c('0x21')]);_0x2e4093['filters']=_[_0x7c2c('0x23')](_0x2e4093[_0x7c2c('0x20')],_0x2e4093[_0x7c2c('0x21')]);_0x12c9cd[_0x7c2c('0x24')]=_['intersection'](_0x2e4093[_0x7c2c('0x20')],qs['fields'](_0x18e288['query'][_0x7c2c('0x25')]));_0x12c9cd[_0x7c2c('0x24')]=_0x12c9cd[_0x7c2c('0x24')]['length']?_0x12c9cd[_0x7c2c('0x24')]:_0x2e4093[_0x7c2c('0x20')];if(_0x18e288['query'][_0x7c2c('0x36')]){_0x12c9cd['include']=[{'all':!![]}];}_0x12c9cd=_[_0x7c2c('0x2c')]({},_0x12c9cd,_0x18e288[_0x7c2c('0x2d')]);return db['SquareProject']['find'](_0x12c9cd)[_0x7c2c('0x13')](handleEntityNotFound(_0x8b0dc9,null))[_0x7c2c('0x13')](respondWithResult(_0x8b0dc9,null))['catch'](handleError(_0x8b0dc9,null));};exports[_0x7c2c('0x37')]=function(_0x58966a,_0x51e3b7){return db[_0x7c2c('0x2e')][_0x7c2c('0x37')](_0x58966a[_0x7c2c('0x38')],{})[_0x7c2c('0x13')](function(_0x6978bc){var _0x23121f=_0x58966a[_0x7c2c('0x39')][_0x7c2c('0x15')]({'plain':!![]});if(!_0x23121f)throw new Error(_0x7c2c('0x3a'));if(_0x23121f['role']==='user'){var _0xeb067b=_0x6978bc[_0x7c2c('0x15')]({'plain':!![]});var _0x3ce2fb='SquareProjects';return db['UserProfileSection'][_0x7c2c('0x3b')]({'where':{'name':_0x3ce2fb,'userProfileId':_0x23121f[_0x7c2c('0x3c')]},'raw':!![]})[_0x7c2c('0x13')](function(_0x2b79d5){if(_0x2b79d5&&_0x2b79d5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xeb067b[_0x7c2c('0x1a')],'resourceId':_0xeb067b['id'],'type':_0x2b79d5[_0x7c2c('0x1a')],'sectionId':_0x2b79d5['id']},{})[_0x7c2c('0x13')](function(){return _0x6978bc;});}else{return _0x6978bc;}})[_0x7c2c('0x32')](function(_0x438cbd){logger['error'](_0x7c2c('0x3d'),_0x438cbd);throw _0x438cbd;});}return _0x6978bc;})[_0x7c2c('0x13')](respondWithResult(_0x51e3b7,0xc9))['catch'](handleError(_0x51e3b7,null));};exports[_0x7c2c('0x3e')]=function(_0x56e09d,_0xfba6a7){if(_0x56e09d[_0x7c2c('0x38')]['id']){delete _0x56e09d[_0x7c2c('0x38')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x56e09d[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x13')](saveUpdates(_0x56e09d[_0x7c2c('0x38')],null))['then'](function(_0x101205){if(!_0x101205)return;var _0x400d79=_0x101205['get']({'plain':!![]});return _0x400d79;})[_0x7c2c('0x13')](function(_0x5d4d02){var _0x5b242c=new Redis(config[_0x7c2c('0x6')]);_0x5b242c[_0x7c2c('0x3f')](_0x7c2c('0x40'),JSON['stringify'](_[_0x7c2c('0x2a')](_0x5d4d02,['id','name',_0x7c2c('0x41')])));return _0x5d4d02;})[_0x7c2c('0x13')](respondWithResult(_0xfba6a7,null))['catch'](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x14')]=function(_0x3750bf,_0x4404e3){return db[_0x7c2c('0x2e')]['find']({'where':{'id':_0x3750bf[_0x7c2c('0x34')]['id']}})[_0x7c2c('0x13')](handleEntityNotFound(_0x4404e3,null))['then'](removeEntity(_0x4404e3,null))[_0x7c2c('0x32')](handleError(_0x4404e3,null));};exports['addUsers']=function(_0x2b912c,_0x3f2eb0){return db[_0x7c2c('0x2e')][_0x7c2c('0x3b')]({'where':{'id':_0x2b912c[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0x3f2eb0,null))[_0x7c2c('0x13')](function(_0x2ec03e){if(_0x2ec03e){return _0x2ec03e['addUsers'](_0x2b912c['body']['ids'],_[_0x7c2c('0x42')](_0x2b912c['body'],[_0x7c2c('0x43'),'id'])||{});}})['then'](respondWithResult(_0x3f2eb0,null))[_0x7c2c('0x32')](handleError(_0x3f2eb0,null));};exports[_0x7c2c('0x44')]=function(_0x455e69,_0xb2924c){return db[_0x7c2c('0x2e')][_0x7c2c('0x3b')]({'where':{'id':_0x455e69[_0x7c2c('0x34')]['id']}})[_0x7c2c('0x13')](handleEntityNotFound(_0xb2924c,null))['then'](function(_0x570cd3){if(_0x570cd3){return _0x570cd3['removeUsers'](_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')])[_0x7c2c('0x13')](function(){if(_[_0x7c2c('0x45')](_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')])){for(var _0x2d04da=0x0;_0x2d04da<_0x455e69[_0x7c2c('0x21')]['ids']['length'];_0x2d04da+=0x1){socket[_0x7c2c('0x46')](_0x7c2c('0x47'),{'UserId':Number(_0x455e69['query'][_0x7c2c('0x43')][_0x2d04da]),'SquareProjectId':Number(_0x455e69['params']['id'])});}}else{socket['emit'](_0x7c2c('0x47'),{'UserId':Number(_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')]),'SquareProjectId':Number(_0x455e69[_0x7c2c('0x34')]['id'])});}});}})[_0x7c2c('0x13')](respondWithStatusCode(_0xb2924c,null))[_0x7c2c('0x32')](handleError(_0xb2924c,null));};exports[_0x7c2c('0x48')]=function(_0x2a4de1,_0xf06cd1){var _0x44b953={};var _0xd01d59={};var _0x43949a;var _0xbe0568;return db[_0x7c2c('0x2e')]['findOne']({'where':{'id':_0x2a4de1[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0xf06cd1,null))['then'](function(_0x4c0a69){if(_0x4c0a69){_0x43949a=_0x4c0a69;_0xd01d59['model']=_[_0x7c2c('0x35')](db[_0x7c2c('0x49')][_0x7c2c('0x1c')]);_0xd01d59[_0x7c2c('0x21')]=_[_0x7c2c('0x35')](_0x2a4de1[_0x7c2c('0x21')]);_0xd01d59['filters']=_[_0x7c2c('0x23')](_0xd01d59[_0x7c2c('0x20')],_0xd01d59[_0x7c2c('0x21')]);_0x44b953[_0x7c2c('0x24')]=_[_0x7c2c('0x23')](_0xd01d59[_0x7c2c('0x20')],qs['fields'](_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x25')]));_0x44b953['attributes']=_0x44b953[_0x7c2c('0x24')][_0x7c2c('0x26')]?_0x44b953['attributes']:_0xd01d59[_0x7c2c('0x20')];_0x44b953[_0x7c2c('0x4a')]=qs['sort'](_0x2a4de1['query'][_0x7c2c('0x28')]);_0x44b953['where']=qs[_0x7c2c('0x22')](_['pick'](_0x2a4de1[_0x7c2c('0x21')],_0xd01d59[_0x7c2c('0x22')]));if(_0x2a4de1['query'][_0x7c2c('0x2b')]){_0x44b953['where']=_[_0x7c2c('0x2c')](_0x44b953[_0x7c2c('0x29')],{'$or':_[_0x7c2c('0x1b')](_0x44b953['attributes'],function(_0x37e646){var _0x156b53={};_0x156b53[_0x37e646]={'$like':'%'+_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x2b')]+'%'};return _0x156b53;})});}_0x44b953=_['merge']({},_0x44b953,_0x2a4de1[_0x7c2c('0x2d')]);return _0x43949a[_0x7c2c('0x48')](_0x44b953);}})[_0x7c2c('0x13')](function(_0x1d75ba){if(_0x1d75ba){_0xbe0568=_0x1d75ba[_0x7c2c('0x26')];if(!_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x27')](_0x7c2c('0x4b'))){_0x44b953[_0x7c2c('0x10')]=qs['limit'](_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x10')]);_0x44b953['offset']=qs[_0x7c2c('0xe')](_0x2a4de1['query']['offset']);}return _0x43949a[_0x7c2c('0x48')](_0x44b953);}})[_0x7c2c('0x13')](function(_0x17a721){if(_0x17a721){return _0x17a721?{'count':_0xbe0568,'rows':_0x17a721}:null;}})['then'](respondWithResult(_0xf06cd1,null))[_0x7c2c('0x32')](handleError(_0xf06cd1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d70868f..c70d526 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 _0x23ee=['SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x45aa4f,_0x248b29){var _0x5eef45=function(_0x5de0d2){while(--_0x5de0d2){_0x45aa4f['push'](_0x45aa4f['shift']());}};_0x5eef45(++_0x248b29);}(_0x23ee,0x1af));var _0xe23e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x23ee[_0x38b2d9];return _0x23a3e1;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe23e('0x0'))['db'][_0xe23e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe23e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe23e('0x3'),'afterDestroy':_0xe23e('0x4')};function emitEvent(_0x1a8541){return function(_0x10c054,_0x5674d4,_0x3a2c6f){SquareProjectEvents[_0xe23e('0x5')](_0x1a8541+':'+_0x10c054['id'],_0x10c054);SquareProjectEvents[_0xe23e('0x5')](_0x1a8541,_0x10c054);_0x3a2c6f(null);};}for(var e in events){if(events[_0xe23e('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe23e('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x3ed0=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0x3ed0,0xf7));var _0x03ed=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x3ed0[_0x2d9e27];return _0xd35381;};'use strict';var EventEmitter=require(_0x03ed('0x0'));var SquareProject=require(_0x03ed('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x03ed('0x2')](0x0);var events={'afterCreate':_0x03ed('0x3'),'afterUpdate':_0x03ed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14ae44){return function(_0x150a66,_0x550d92,_0x2857e7){SquareProjectEvents[_0x03ed('0x5')](_0x14ae44+':'+_0x150a66['id'],_0x150a66);SquareProjectEvents[_0x03ed('0x5')](_0x14ae44,_0x150a66);_0x2857e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x03ed('0x6')](e,emitEvent(event));}}module[_0x03ed('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 03504c5..dfb38a9 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 _0xc860=['moment','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api'];(function(_0x4e192e,_0x54f7bf){var _0x195b34=function(_0x124f06){while(--_0x124f06){_0x4e192e['push'](_0x4e192e['shift']());}};_0x195b34(++_0x54f7bf);}(_0xc860,0x1c8));var _0x0c86=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xc860[_0x202c61];return _0x540691;};'use strict';var _=require(_0x0c86('0x0'));var util=require(_0x0c86('0x1'));var logger=require(_0x0c86('0x2'))(_0x0c86('0x3'));var moment=require(_0x0c86('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c86('0x5'));var rimraf=require(_0x0c86('0x6'));var config=require(_0x0c86('0x7'));var attributes=require(_0x0c86('0x8'));module[_0x0c86('0x9')]=function(_0x3ce9ef,_0x70b0fe){return _0x3ce9ef[_0x0c86('0xa')](_0x0c86('0xb'),attributes,{'tableName':_0x0c86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x420ecb,_0x58d9ce,_0x3abd9e){if(_0x420ecb[_0x0c86('0xd')](_0x0c86('0xe'))){_0x420ecb[_0x0c86('0xf')]=moment()[_0x0c86('0x10')](_0x0c86('0x11'));}if(_0x420ecb[_0x0c86('0xd')](_0x0c86('0x12'))){_0x420ecb[_0x0c86('0x13')]=moment()['format'](_0x0c86('0x11'));}_0x3abd9e(null,_0x420ecb);}}});}; \ No newline at end of file +var _0x676e=['moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','../../config/logger','api'];(function(_0x35e5b3,_0x3864f8){var _0x548d54=function(_0x4926fd){while(--_0x4926fd){_0x35e5b3['push'](_0x35e5b3['shift']());}};_0x548d54(++_0x3864f8);}(_0x676e,0x85));var _0xe676=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x676e[_0x28509b];return _0x1e0b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe676('0x0'))(_0xe676('0x1'));var moment=require(_0xe676('0x2'));var BPromise=require('bluebird');var rp=require(_0xe676('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe676('0x4'));var config=require(_0xe676('0x5'));var attributes=require(_0xe676('0x6'));module[_0xe676('0x7')]=function(_0x1bcc8b,_0x3feffa){return _0x1bcc8b[_0xe676('0x8')](_0xe676('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29d0cf,_0x50190d,_0x2ad782){if(_0x29d0cf[_0xe676('0xa')]('preproduction')){_0x29d0cf['savedAt']=moment()['format'](_0xe676('0xb'));}if(_0x29d0cf[_0xe676('0xa')](_0xe676('0xc'))){_0x29d0cf[_0xe676('0xd')]=moment()[_0xe676('0xe')](_0xe676('0xb'));}_0x2ad782(null,_0x29d0cf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 748661b..e1d7af0 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 _0x555f=['ioredis','../../mysqldb','rpc','../../config/environment','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','attributes','limit','map','include','model','info','debug','stringify','error','message','ShowSquareProject','find','then','lodash'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x555f,0x1f3));var _0xf555=function(_0x22f9c0,_0x35410c){_0x22f9c0=_0x22f9c0-0x0;var _0x1883fe=_0x555f[_0x22f9c0];return _0x1883fe;};'use strict';var _=require(_0xf555('0x0'));var Redis=require(_0xf555('0x1'));var db=require(_0xf555('0x2'))['db'];var logger=require('../../config/logger')(_0xf555('0x3'));var config=require(_0xf555('0x4'));config[_0xf555('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf555('0x5')]));require(_0xf555('0x6'))[_0xf555('0x7')](socket);exports[_0xf555('0x8')]=function(_0x5db490){var _0x19f506=this;return new Promise(function(_0x296017,_0x444559){return db[_0xf555('0x9')][_0xf555('0xa')]({'raw':_0x5db490['options']?_0x5db490['options']['raw']===undefined?!![]:![]:!![],'where':_0x5db490[_0xf555('0xb')]?_0x5db490[_0xf555('0xb')]['where']||null:null,'attributes':_0x5db490['options']?_0x5db490[_0xf555('0xb')][_0xf555('0xc')]||null:null,'limit':_0x5db490[_0xf555('0xb')]?_0x5db490['options'][_0xf555('0xd')]||null:null,'include':_0x5db490['options']?_0x5db490[_0xf555('0xb')]['include']?_[_0xf555('0xe')](_0x5db490[_0xf555('0xb')][_0xf555('0xf')],function(_0x43ec3b){return{'model':db[_0x43ec3b[_0xf555('0x10')]],'as':_0x43ec3b['as'],'attributes':_0x43ec3b[_0xf555('0xc')],'include':_0x43ec3b['include']?_[_0xf555('0xe')](_0x43ec3b[_0xf555('0xf')],function(_0x450670){return{'model':db[_0x450670['model']],'as':_0x450670['as'],'attributes':_0x450670['attributes'],'include':_0x450670[_0xf555('0xf')]?_[_0xf555('0xe')](_0x450670[_0xf555('0xf')],function(_0x3d0916){return{'model':db[_0x3d0916[_0xf555('0x10')]],'as':_0x3d0916['as'],'attributes':_0x3d0916[_0xf555('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x294dbc){logger[_0xf555('0x11')](_0xf555('0x8'),_0x5db490);logger[_0xf555('0x12')](_0xf555('0x8'),_0x5db490,JSON[_0xf555('0x13')](_0x294dbc));_0x296017(_0x294dbc);})['catch'](function(_0xa1a2b1){logger[_0xf555('0x14')](_0xf555('0x8'),_0xa1a2b1[_0xf555('0x15')],_0x5db490);_0x444559(_0x19f506[_0xf555('0x14')](0x1f4,_0xa1a2b1['message']));});});};exports[_0xf555('0x16')]=function(_0x2e05fc){var _0x359738=this;return new Promise(function(_0x424c9a,_0x1610dc){return db[_0xf555('0x9')][_0xf555('0x17')]({'raw':_0x2e05fc[_0xf555('0xb')]?_0x2e05fc[_0xf555('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2e05fc['options']?_0x2e05fc[_0xf555('0xb')]['where']||null:null,'attributes':_0x2e05fc[_0xf555('0xb')]?_0x2e05fc[_0xf555('0xb')][_0xf555('0xc')]||null:null,'include':_0x2e05fc[_0xf555('0xb')]?_0x2e05fc[_0xf555('0xb')][_0xf555('0xf')]?_[_0xf555('0xe')](_0x2e05fc[_0xf555('0xb')][_0xf555('0xf')],function(_0x4b5ee2){return{'model':db[_0x4b5ee2[_0xf555('0x10')]],'as':_0x4b5ee2['as'],'attributes':_0x4b5ee2[_0xf555('0xc')],'include':_0x4b5ee2[_0xf555('0xf')]?_['map'](_0x4b5ee2['include'],function(_0x1b1d84){return{'model':db[_0x1b1d84[_0xf555('0x10')]],'as':_0x1b1d84['as'],'attributes':_0x1b1d84[_0xf555('0xc')],'include':_0x1b1d84[_0xf555('0xf')]?_[_0xf555('0xe')](_0x1b1d84[_0xf555('0xf')],function(_0x2666ed){return{'model':db[_0x2666ed['model']],'as':_0x2666ed['as'],'attributes':_0x2666ed[_0xf555('0xc')]};}):[]};}):[]};}):[]:[]})[_0xf555('0x18')](function(_0x59d63c){logger[_0xf555('0x11')]('ShowSquareProject',_0x2e05fc);logger[_0xf555('0x12')](_0xf555('0x16'),_0x2e05fc,JSON[_0xf555('0x13')](_0x59d63c));_0x424c9a(_0x59d63c);})['catch'](function(_0x31fc1b){logger[_0xf555('0x14')]('ShowSquareProject',_0x31fc1b[_0xf555('0x15')],_0x2e05fc);_0x1610dc(_0x359738['error'](0x1f4,_0x31fc1b['message']));});});}; \ No newline at end of file +var _0x4bf4=['redis','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','limit','map','include','model','then','info','debug','GetSquareProjects','catch','message','error','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x476e31,_0x1284b9){var _0x1620c9=function(_0x91b680){while(--_0x91b680){_0x476e31['push'](_0x476e31['shift']());}};_0x1620c9(++_0x1284b9);}(_0x4bf4,0x19f));var _0x44bf=function(_0x4b8bec,_0x334ef3){_0x4b8bec=_0x4b8bec-0x0;var _0x38e0f5=_0x4bf4[_0x4b8bec];return _0x38e0f5;};'use strict';var _=require(_0x44bf('0x0'));var Redis=require(_0x44bf('0x1'));var db=require(_0x44bf('0x2'))['db'];var logger=require('../../config/logger')(_0x44bf('0x3'));var config=require(_0x44bf('0x4'));config['redis']=_['defaults'](config[_0x44bf('0x5')],{'host':_0x44bf('0x6'),'port':0x18eb});var socket=require(_0x44bf('0x7'))(new Redis(config[_0x44bf('0x5')]));require(_0x44bf('0x8'))[_0x44bf('0x9')](socket);exports['GetSquareProjects']=function(_0x40f4a2){var _0x3d3cee=this;return new Promise(function(_0x5b85cb,_0x580273){return db[_0x44bf('0xa')][_0x44bf('0xb')]({'raw':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')][_0x44bf('0xd')]||null:null,'attributes':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2['options'][_0x44bf('0xe')]||null:null,'limit':_0x40f4a2['options']?_0x40f4a2[_0x44bf('0xc')][_0x44bf('0xf')]||null:null,'include':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')]['include']?_[_0x44bf('0x10')](_0x40f4a2[_0x44bf('0xc')][_0x44bf('0x11')],function(_0x13b8ae){return{'model':db[_0x13b8ae[_0x44bf('0x12')]],'as':_0x13b8ae['as'],'attributes':_0x13b8ae[_0x44bf('0xe')],'include':_0x13b8ae[_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x13b8ae[_0x44bf('0x11')],function(_0x41c89f){return{'model':db[_0x41c89f[_0x44bf('0x12')]],'as':_0x41c89f['as'],'attributes':_0x41c89f['attributes'],'include':_0x41c89f['include']?_[_0x44bf('0x10')](_0x41c89f[_0x44bf('0x11')],function(_0x54a0d6){return{'model':db[_0x54a0d6['model']],'as':_0x54a0d6['as'],'attributes':_0x54a0d6[_0x44bf('0xe')]};}):[]};}):[]};}):[]:[]})[_0x44bf('0x13')](function(_0x3035a0){logger[_0x44bf('0x14')]('GetSquareProjects',_0x40f4a2);logger[_0x44bf('0x15')](_0x44bf('0x16'),_0x40f4a2,JSON['stringify'](_0x3035a0));_0x5b85cb(_0x3035a0);})[_0x44bf('0x17')](function(_0x18f5d6){logger['error'](_0x44bf('0x16'),_0x18f5d6[_0x44bf('0x18')],_0x40f4a2);_0x580273(_0x3d3cee[_0x44bf('0x19')](0x1f4,_0x18f5d6[_0x44bf('0x18')]));});});};exports[_0x44bf('0x1a')]=function(_0x434f36){var _0x2ce181=this;return new Promise(function(_0x4001fe,_0x3b6674){return db[_0x44bf('0xa')]['find']({'raw':_0x434f36[_0x44bf('0xc')]?_0x434f36[_0x44bf('0xc')][_0x44bf('0x1b')]===undefined?!![]:![]:!![],'where':_0x434f36['options']?_0x434f36['options'][_0x44bf('0xd')]||null:null,'attributes':_0x434f36[_0x44bf('0xc')]?_0x434f36['options'][_0x44bf('0xe')]||null:null,'include':_0x434f36[_0x44bf('0xc')]?_0x434f36[_0x44bf('0xc')][_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x434f36[_0x44bf('0xc')][_0x44bf('0x11')],function(_0x4fb163){return{'model':db[_0x4fb163[_0x44bf('0x12')]],'as':_0x4fb163['as'],'attributes':_0x4fb163[_0x44bf('0xe')],'include':_0x4fb163[_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x4fb163['include'],function(_0x4cbf53){return{'model':db[_0x4cbf53['model']],'as':_0x4cbf53['as'],'attributes':_0x4cbf53[_0x44bf('0xe')],'include':_0x4cbf53[_0x44bf('0x11')]?_['map'](_0x4cbf53[_0x44bf('0x11')],function(_0x268a0b){return{'model':db[_0x268a0b['model']],'as':_0x268a0b['as'],'attributes':_0x268a0b[_0x44bf('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23f731){logger[_0x44bf('0x14')](_0x44bf('0x1a'),_0x434f36);logger['debug'](_0x44bf('0x1a'),_0x434f36,JSON['stringify'](_0x23f731));_0x4001fe(_0x23f731);})[_0x44bf('0x17')](function(_0x1e9094){logger[_0x44bf('0x19')](_0x44bf('0x1a'),_0x1e9094[_0x44bf('0x18')],_0x434f36);_0x3b6674(_0x2ce181['error'](0x1f4,_0x1e9094[_0x44bf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 09023ab..155c66a 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 _0xc2fc=['length','squareProject:','./squareProject.events','save','update','emit','register'];(function(_0x162469,_0x513dcf){var _0x4dff90=function(_0x1a0569){while(--_0x1a0569){_0x162469['push'](_0x162469['shift']());}};_0x4dff90(++_0x513dcf);}(_0xc2fc,0xb1));var _0xcc2f=function(_0x58db9b,_0x34071b){_0x58db9b=_0x58db9b-0x0;var _0x58efb9=_0xc2fc[_0x58db9b];return _0x58efb9;};'use strict';var SquareProjectEvents=require(_0xcc2f('0x0'));var events=[_0xcc2f('0x1'),'remove',_0xcc2f('0x2')];function createListener(_0x3b60f7,_0x217f30){return function(_0x4b3224){_0x217f30[_0xcc2f('0x3')](_0x3b60f7,_0x4b3224);};}function removeListener(_0x28a987,_0x193446){return function(){SquareProjectEvents['removeListener'](_0x28a987,_0x193446);};}exports[_0xcc2f('0x4')]=function(_0x2d6655){for(var _0x36b9ad=0x0,_0x3ed3af=events[_0xcc2f('0x5')];_0x36b9ad<_0x3ed3af;_0x36b9ad++){var _0x1257f8=events[_0x36b9ad];var _0x2606e5=createListener(_0xcc2f('0x6')+_0x1257f8,_0x2d6655);SquareProjectEvents['on'](_0x1257f8,_0x2606e5);}}; \ No newline at end of file +var _0x4864=['removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x3ff6c5,_0x4b4a74){var _0x4bf17c=function(_0x5ecb9c){while(--_0x5ecb9c){_0x3ff6c5['push'](_0x3ff6c5['shift']());}};_0x4bf17c(++_0x4b4a74);}(_0x4864,0x14d));var _0x4486=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0x4864[_0x1d92f8];return _0x56dba3;};'use strict';var SquareProjectEvents=require(_0x4486('0x0'));var events=[_0x4486('0x1'),_0x4486('0x2'),'update'];function createListener(_0x4245ba,_0x373db3){return function(_0x4352b0){_0x373db3['emit'](_0x4245ba,_0x4352b0);};}function removeListener(_0x13b8b0,_0x328d23){return function(){SquareProjectEvents[_0x4486('0x3')](_0x13b8b0,_0x328d23);};}exports[_0x4486('0x4')]=function(_0x45fe13){for(var _0x385fff=0x0,_0x314c8f=events[_0x4486('0x5')];_0x385fff<_0x314c8f;_0x385fff++){var _0x27ebd2=events[_0x385fff];var _0x5eeb1e=createListener(_0x4486('0x6')+_0x27ebd2,_0x45fe13);SquareProjectEvents['on'](_0x27ebd2,_0x5eeb1e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6a1f704..2162a2f 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 _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'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('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x47c552,_0x1fbe9e){var _0x2f0b26=function(_0x2fe799){while(--_0x2fe799){_0x47c552['push'](_0x47c552['shift']());}};_0x2f0b26(++_0x1fbe9e);}(_0xabce,0x103));var _0xeabc=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xabce[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 11930db..9a6c8f8 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 _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x38ac44,_0x38c414){var _0x42e9ae=function(_0x5f261c){while(--_0x5f261c){_0x38ac44['push'](_0x38ac44['shift']());}};_0x42e9ae(++_0x38c414);}(_0xac31,0xca));var _0x1ac3=function(_0x4ad37a,_0x40d2eb){_0x4ad37a=_0x4ad37a-0x0;var _0x39e50e=_0xac31[_0x4ad37a];return _0x39e50e;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file +var _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x4c9849,_0x3d673a){var _0x3d0008=function(_0x5e99a6){while(--_0x5e99a6){_0x4c9849['push'](_0x4c9849['shift']());}};_0x3d0008(++_0x3d673a);}(_0xa41a,0x6b));var _0xaa41=function(_0x23346f,_0x237af7){_0x23346f=_0x23346f-0x0;var _0x2409db=_0xa41a[_0x23346f];return _0x2409db;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f31697c..f8ca693 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 _0xeac7=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','SquareRecording','include','findAll','rows','catch','show','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','unlinkSync','.cypher','File:\x20\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xeac7,0x11c));var _0x7eac=function(_0x2845a1,_0x518865){_0x2845a1=_0x2845a1-0x0;var _0x5cb3e6=_0xeac7[_0x2845a1];return _0x5cb3e6;};'use strict';var emlformat=require(_0x7eac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7eac('0x1'));var jsonpatch=require(_0x7eac('0x2'));var rp=require(_0x7eac('0x3'));var moment=require(_0x7eac('0x4'));var BPromise=require(_0x7eac('0x5'));var Mustache=require(_0x7eac('0x6'));var util=require('util');var path=require(_0x7eac('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7eac('0x8'));var fs=require('fs');var fs_extra=require(_0x7eac('0x9'));var _=require(_0x7eac('0xa'));var squel=require(_0x7eac('0xb'));var crypto=require(_0x7eac('0xc'));var jsforce=require(_0x7eac('0xd'));var deskjs=require(_0x7eac('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7eac('0xf'));var Papa=require(_0x7eac('0x10'));var Redis=require(_0x7eac('0x11'));var authService=require(_0x7eac('0x12'));var qs=require(_0x7eac('0x13'));var as=require(_0x7eac('0x14'));var hardwareService=require(_0x7eac('0x15'));var logger=require(_0x7eac('0x16'))(_0x7eac('0x17'));var utils=require(_0x7eac('0x18'));var config=require(_0x7eac('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7eac('0x1a'))['db'];function respondWithStatusCode(_0x193b72,_0x26a47f){_0x26a47f=_0x26a47f||0xcc;return function(_0x23c454){if(_0x23c454){return _0x193b72[_0x7eac('0x1b')](_0x26a47f);}return _0x193b72[_0x7eac('0x1c')](_0x26a47f)[_0x7eac('0x1d')]();};}function respondWithResult(_0x1b08f6,_0x56833b){_0x56833b=_0x56833b||0xc8;return function(_0x10801a){if(_0x10801a){return _0x1b08f6[_0x7eac('0x1c')](_0x56833b)[_0x7eac('0x1e')](_0x10801a);}};}function respondWithFilteredResult(_0x4304a6,_0x2c46f4){return function(_0x1268ba){if(_0x1268ba){var _0x65023b=typeof _0x2c46f4[_0x7eac('0x1f')]==='undefined'&&typeof _0x2c46f4['limit']===_0x7eac('0x20');var _0x5934f6=_0x1268ba['count'];var _0x435e82=_0x65023b?0x0:_0x2c46f4[_0x7eac('0x1f')];var _0x5a54ad=_0x65023b?_0x1268ba[_0x7eac('0x21')]:_0x2c46f4[_0x7eac('0x1f')]+_0x2c46f4[_0x7eac('0x22')];var _0x4ec625;if(_0x5a54ad>=_0x5934f6){_0x5a54ad=_0x5934f6;_0x4ec625=0xc8;}else{_0x4ec625=0xce;}_0x4304a6[_0x7eac('0x1c')](_0x4ec625);return _0x4304a6['set'](_0x7eac('0x23'),_0x435e82+'-'+_0x5a54ad+'/'+_0x5934f6)['json'](_0x1268ba);}return null;};}function patchUpdates(_0x32d6e3){return function(_0x3bd18e){try{jsonpatch[_0x7eac('0x24')](_0x3bd18e,_0x32d6e3,!![]);}catch(_0x33d8e9){return BPromise['reject'](_0x33d8e9);}return _0x3bd18e[_0x7eac('0x25')]();};}function saveUpdates(_0x32d83e,_0x409b54){return function(_0x5ba09){if(_0x5ba09){return _0x5ba09[_0x7eac('0x26')](_0x32d83e)[_0x7eac('0x27')](function(_0x5bc02c){return _0x5bc02c;});}return null;};}function removeEntity(_0x35d525,_0xde1da7){return function(_0xcd6a8b){if(_0xcd6a8b){return _0xcd6a8b[_0x7eac('0x28')]()['then'](function(){_0x35d525[_0x7eac('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df7e3,_0x59420d){return function(_0x25f3c0){if(!_0x25f3c0){_0x2df7e3[_0x7eac('0x1b')](0x194);}return _0x25f3c0;};}function handleError(_0x46d312,_0x5bdfe6){_0x5bdfe6=_0x5bdfe6||0x1f4;return function(_0x474f77){logger[_0x7eac('0x29')](_0x474f77[_0x7eac('0x2a')]);if(_0x474f77[_0x7eac('0x2b')]){delete _0x474f77[_0x7eac('0x2b')];}_0x46d312[_0x7eac('0x1c')](_0x5bdfe6)['send'](_0x474f77);};}exports[_0x7eac('0x2c')]=function(_0x5afce9,_0x43f59e){var _0x24dcc2={},_0x56524a={},_0x580791={'count':0x0,'rows':[]};var _0x44cc80=_[_0x7eac('0x2d')](db['SquareRecording'][_0x7eac('0x2e')],function(_0x259b80){return{'name':_0x259b80[_0x7eac('0x2f')],'type':_0x259b80[_0x7eac('0x30')][_0x7eac('0x31')]};});_0x56524a[_0x7eac('0x32')]=_[_0x7eac('0x2d')](_0x44cc80,_0x7eac('0x2b'));_0x56524a[_0x7eac('0x33')]=_[_0x7eac('0x34')](_0x5afce9[_0x7eac('0x33')]);_0x56524a[_0x7eac('0x35')]=_[_0x7eac('0x36')](_0x56524a[_0x7eac('0x32')],_0x56524a[_0x7eac('0x33')]);_0x24dcc2[_0x7eac('0x37')]=_[_0x7eac('0x36')](_0x56524a[_0x7eac('0x32')],qs[_0x7eac('0x38')](_0x5afce9[_0x7eac('0x33')][_0x7eac('0x38')]));_0x24dcc2['attributes']=_0x24dcc2['attributes'][_0x7eac('0x39')]?_0x24dcc2[_0x7eac('0x37')]:_0x56524a[_0x7eac('0x32')];if(!_0x5afce9[_0x7eac('0x33')][_0x7eac('0x3a')](_0x7eac('0x3b'))){_0x24dcc2[_0x7eac('0x22')]=qs[_0x7eac('0x22')](_0x5afce9[_0x7eac('0x33')][_0x7eac('0x22')]);_0x24dcc2[_0x7eac('0x1f')]=qs['offset'](_0x5afce9['query']['offset']);}_0x24dcc2[_0x7eac('0x3c')]=qs[_0x7eac('0x3d')](_0x5afce9[_0x7eac('0x33')][_0x7eac('0x3d')]);_0x24dcc2[_0x7eac('0x3e')]=qs[_0x7eac('0x35')](_['pick'](_0x5afce9[_0x7eac('0x33')],_0x56524a[_0x7eac('0x35')]),_0x44cc80);if(_0x5afce9['query'][_0x7eac('0x3f')]){_0x24dcc2[_0x7eac('0x3e')]=_[_0x7eac('0x40')](_0x24dcc2[_0x7eac('0x3e')],{'$or':_[_0x7eac('0x2d')](_0x44cc80,function(_0x2944d7){if(_0x2944d7[_0x7eac('0x30')]!=='VIRTUAL'){var _0x2a9109={};_0x2a9109[_0x2944d7['name']]={'$like':'%'+_0x5afce9[_0x7eac('0x33')][_0x7eac('0x3f')]+'%'};return _0x2a9109;}})});}_0x24dcc2=_[_0x7eac('0x40')]({},_0x24dcc2,_0x5afce9[_0x7eac('0x41')]);var _0x285387={'where':_0x24dcc2[_0x7eac('0x3e')]};return db[_0x7eac('0x42')]['count'](_0x285387)[_0x7eac('0x27')](function(_0x5ba6d2){_0x580791[_0x7eac('0x21')]=_0x5ba6d2;if(_0x5afce9[_0x7eac('0x33')]['includeAll']){_0x24dcc2[_0x7eac('0x43')]=[{'all':!![]}];}return db[_0x7eac('0x42')][_0x7eac('0x44')](_0x24dcc2);})['then'](function(_0x39fdfa){_0x580791[_0x7eac('0x45')]=_0x39fdfa;return _0x580791;})[_0x7eac('0x27')](respondWithFilteredResult(_0x43f59e,_0x24dcc2))[_0x7eac('0x46')](handleError(_0x43f59e,null));};exports[_0x7eac('0x47')]=function(_0x1b2b2c,_0x174d9e){var _0x2f8d44={'raw':!![],'where':{'id':_0x1b2b2c['params']['id']}},_0x3c0f3f={};_0x3c0f3f['model']=_[_0x7eac('0x34')](db[_0x7eac('0x42')][_0x7eac('0x2e')]);_0x3c0f3f['query']=_[_0x7eac('0x34')](_0x1b2b2c[_0x7eac('0x33')]);_0x3c0f3f[_0x7eac('0x35')]=_[_0x7eac('0x36')](_0x3c0f3f[_0x7eac('0x32')],_0x3c0f3f[_0x7eac('0x33')]);_0x2f8d44[_0x7eac('0x37')]=_[_0x7eac('0x36')](_0x3c0f3f[_0x7eac('0x32')],qs[_0x7eac('0x38')](_0x1b2b2c['query'][_0x7eac('0x38')]));_0x2f8d44[_0x7eac('0x37')]=_0x2f8d44[_0x7eac('0x37')][_0x7eac('0x39')]?_0x2f8d44[_0x7eac('0x37')]:_0x3c0f3f[_0x7eac('0x32')];if(_0x1b2b2c[_0x7eac('0x33')][_0x7eac('0x48')]){_0x2f8d44[_0x7eac('0x43')]=[{'all':!![]}];}_0x2f8d44=_[_0x7eac('0x40')]({},_0x2f8d44,_0x1b2b2c['options']);return db[_0x7eac('0x42')][_0x7eac('0x49')](_0x2f8d44)[_0x7eac('0x27')](handleEntityNotFound(_0x174d9e,null))['then'](respondWithResult(_0x174d9e,null))[_0x7eac('0x46')](handleError(_0x174d9e,null));};exports[_0x7eac('0x4a')]=function(_0x34ab5c,_0x1edaa3){return db[_0x7eac('0x42')]['create'](_0x34ab5c['body'],{})[_0x7eac('0x27')](respondWithResult(_0x1edaa3,0xc9))[_0x7eac('0x46')](handleError(_0x1edaa3,null));};exports[_0x7eac('0x26')]=function(_0xcb2a3a,_0x1fa135){if(_0xcb2a3a['body']['id']){delete _0xcb2a3a[_0x7eac('0x4b')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0xcb2a3a[_0x7eac('0x4c')]['id']}})[_0x7eac('0x27')](handleEntityNotFound(_0x1fa135,null))[_0x7eac('0x27')](saveUpdates(_0xcb2a3a[_0x7eac('0x4b')],null))[_0x7eac('0x27')](respondWithResult(_0x1fa135,null))[_0x7eac('0x46')](handleError(_0x1fa135,null));};exports[_0x7eac('0x4d')]=function(_0x417cfc,_0x224e46,_0x1f8468){var _0x50cde5=require(_0x7eac('0x4e'));var _0x26da40=![];var _0x37b2ef={};if(_0x417cfc[_0x7eac('0x33')][_0x7eac('0x30')]&&_0x417cfc[_0x7eac('0x33')][_0x7eac('0x30')]==='uniqueid'){_0x37b2ef[_0x7eac('0x4f')]=_0x417cfc[_0x7eac('0x4c')]['id'];}else{_0x37b2ef['id']=_0x417cfc[_0x7eac('0x4c')]['id'];}return db[_0x7eac('0x42')]['find']({'where':_0x37b2ef,'attributes':['id','savePath','filename'],'raw':!![]})[_0x7eac('0x27')](handleEntityNotFound(_0x224e46,null))['then'](function(_0x3e4a25){if(_0x3e4a25){var _0x4f18db=_0x3e4a25[_0x7eac('0x50')];var _0x371e03=util['format']('%s.cypher',_0x4f18db);if(fs['existsSync'](_0x371e03)){_0x26da40=!![];return _0x50cde5[_0x7eac('0x51')](_0x371e03,_0x4f18db,config[_0x7eac('0x52')]['recording'])[_0x7eac('0x27')](function(){return _0x3e4a25;});}return _0x3e4a25;}})[_0x7eac('0x27')](function(_0x3b3e32){if(_0x3b3e32){var _0x5e13c9=_0x3b3e32[_0x7eac('0x50')];if(!fs['existsSync'](_0x5e13c9)){throw new db['Sequelize'][(_0x7eac('0x53'))](_0x7eac('0x54'));}if(_0x3b3e32[_0x7eac('0x55')]){return _0x224e46[_0x7eac('0x4d')](_0x5e13c9,_0x3b3e32[_0x7eac('0x55')]+path['extname'](_0x5e13c9),function(){if(_0x26da40){fs[_0x7eac('0x56')](_0x5e13c9);}});}else{return _0x224e46[_0x7eac('0x4d')](_0x5e13c9,function(_0x21d090){if(_0x26da40){fs['unlink'](_0x5e13c9);}});}}})[_0x7eac('0x46')](function(_0x416124){if(_0x416124[_0x7eac('0x57')]==='SquareRecording\x20not\x20found'){_0x224e46[_0x7eac('0x1c')](0x194)[_0x7eac('0x58')](_0x7eac('0x59'));}else{return handleError(_0x224e46,null);}});};exports[_0x7eac('0x28')]=function(_0x1fe312,_0x265f21){return db[_0x7eac('0x42')]['find']({'where':{'id':_0x1fe312['params']['id']}})[_0x7eac('0x27')](function(_0x802ed2){if(_[_0x7eac('0x5a')](_0x802ed2)){throw new ReferenceError(_0x7eac('0x5b'));}return _0x802ed2;})[_0x7eac('0x27')](function(_0x1d847c){var _0x48fc07=_0x1d847c[_0x7eac('0x50')];logger[_0x7eac('0x5c')](_0x7eac('0x5d'),_0x48fc07);if(!_[_0x7eac('0x5a')](_0x1d847c[_0x7eac('0x50')])&&fs[_0x7eac('0x5e')](_0x48fc07)){logger['info']('File:\x20\x22'+_0x48fc07+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7eac('0x5f')](_0x48fc07);}_0x48fc07=_0x48fc07+_0x7eac('0x60');if(!_[_0x7eac('0x5a')](_0x1d847c['savePath'])&&fs[_0x7eac('0x5e')](_0x48fc07)){logger[_0x7eac('0x5c')](_0x7eac('0x61')+_0x48fc07+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7eac('0x5f')](_0x48fc07);}return _0x1d847c;})[_0x7eac('0x27')](function(_0x35e462){if(!_0x35e462)throw new InternalError();return _0x35e462['destroy']();})[_0x7eac('0x27')](function(){_0x265f21[_0x7eac('0x1c')](0xcc)[_0x7eac('0x1d')]();})['catch'](handleError(_0x265f21,null));}; \ No newline at end of file +var _0x16a7=['eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../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','set','reject','save','update','then','end','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync'];(function(_0x2cb775,_0x54e8db){var _0x3d7f76=function(_0x669a60){while(--_0x669a60){_0x2cb775['push'](_0x2cb775['shift']());}};_0x3d7f76(++_0x54e8db);}(_0x16a7,0x1d1));var _0x716a=function(_0x3ef0bc,_0x54c7d4){_0x3ef0bc=_0x3ef0bc-0x0;var _0x5c923f=_0x16a7[_0x3ef0bc];return _0x5c923f;};'use strict';var emlformat=require(_0x716a('0x0'));var rimraf=require(_0x716a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716a('0x2'));var rp=require('request-promise');var moment=require(_0x716a('0x3'));var BPromise=require(_0x716a('0x4'));var Mustache=require('mustache');var util=require(_0x716a('0x5'));var path=require(_0x716a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x716a('0x7'));var fs=require('fs');var fs_extra=require(_0x716a('0x8'));var _=require(_0x716a('0x9'));var squel=require(_0x716a('0xa'));var crypto=require('crypto');var jsforce=require(_0x716a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x716a('0xc'));var querystring=require(_0x716a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x716a('0xe'));var qs=require(_0x716a('0xf'));var as=require(_0x716a('0x10'));var hardwareService=require(_0x716a('0x11'));var logger=require(_0x716a('0x12'))(_0x716a('0x13'));var utils=require('../../config/utils');var config=require(_0x716a('0x14'));var licenseUtil=require(_0x716a('0x15'));var db=require(_0x716a('0x16'))['db'];function respondWithStatusCode(_0xee7905,_0x2459c9){_0x2459c9=_0x2459c9||0xcc;return function(_0x5ab411){if(_0x5ab411){return _0xee7905[_0x716a('0x17')](_0x2459c9);}return _0xee7905[_0x716a('0x18')](_0x2459c9)['end']();};}function respondWithResult(_0x18d419,_0x272f3a){_0x272f3a=_0x272f3a||0xc8;return function(_0x55e378){if(_0x55e378){return _0x18d419[_0x716a('0x18')](_0x272f3a)[_0x716a('0x19')](_0x55e378);}};}function respondWithFilteredResult(_0x460335,_0x3685cf){return function(_0x4a816f){if(_0x4a816f){var _0x24430b=typeof _0x3685cf[_0x716a('0x1a')]===_0x716a('0x1b')&&typeof _0x3685cf[_0x716a('0x1c')]==='undefined';var _0x574162=_0x4a816f['count'];var _0x2357b3=_0x24430b?0x0:_0x3685cf['offset'];var _0x25557e=_0x24430b?_0x4a816f[_0x716a('0x1d')]:_0x3685cf[_0x716a('0x1a')]+_0x3685cf['limit'];var _0x4abaaf;if(_0x25557e>=_0x574162){_0x25557e=_0x574162;_0x4abaaf=0xc8;}else{_0x4abaaf=0xce;}_0x460335[_0x716a('0x18')](_0x4abaaf);return _0x460335[_0x716a('0x1e')]('Content-Range',_0x2357b3+'-'+_0x25557e+'/'+_0x574162)[_0x716a('0x19')](_0x4a816f);}return null;};}function patchUpdates(_0x33027a){return function(_0x1d2328){try{jsonpatch['apply'](_0x1d2328,_0x33027a,!![]);}catch(_0x60d0d7){return BPromise[_0x716a('0x1f')](_0x60d0d7);}return _0x1d2328[_0x716a('0x20')]();};}function saveUpdates(_0x3185de,_0x54734e){return function(_0x22bb39){if(_0x22bb39){return _0x22bb39[_0x716a('0x21')](_0x3185de)['then'](function(_0x4625fa){return _0x4625fa;});}return null;};}function removeEntity(_0x2e1f85,_0x499b76){return function(_0x4ae261){if(_0x4ae261){return _0x4ae261['destroy']()[_0x716a('0x22')](function(){_0x2e1f85[_0x716a('0x18')](0xcc)[_0x716a('0x23')]();});}};}function handleEntityNotFound(_0x2dfcd5,_0x8d8495){return function(_0x1ddc5e){if(!_0x1ddc5e){_0x2dfcd5[_0x716a('0x17')](0x194);}return _0x1ddc5e;};}function handleError(_0x3bc1b6,_0x51c505){_0x51c505=_0x51c505||0x1f4;return function(_0x44873e){logger['error'](_0x44873e['stack']);if(_0x44873e['name']){delete _0x44873e[_0x716a('0x24')];}_0x3bc1b6[_0x716a('0x18')](_0x51c505)[_0x716a('0x25')](_0x44873e);};}exports[_0x716a('0x26')]=function(_0x2675a7,_0x1f003d){var _0x2a0cfd={},_0x587565={},_0x1d60f2={'count':0x0,'rows':[]};var _0x3c5707=_['map'](db[_0x716a('0x27')][_0x716a('0x28')],function(_0x55a481){return{'name':_0x55a481[_0x716a('0x29')],'type':_0x55a481[_0x716a('0x2a')][_0x716a('0x2b')]};});_0x587565[_0x716a('0x2c')]=_[_0x716a('0x2d')](_0x3c5707,_0x716a('0x24'));_0x587565[_0x716a('0x2e')]=_[_0x716a('0x2f')](_0x2675a7['query']);_0x587565[_0x716a('0x30')]=_[_0x716a('0x31')](_0x587565['model'],_0x587565[_0x716a('0x2e')]);_0x2a0cfd[_0x716a('0x32')]=_[_0x716a('0x31')](_0x587565[_0x716a('0x2c')],qs[_0x716a('0x33')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x33')]));_0x2a0cfd[_0x716a('0x32')]=_0x2a0cfd[_0x716a('0x32')][_0x716a('0x34')]?_0x2a0cfd[_0x716a('0x32')]:_0x587565[_0x716a('0x2c')];if(!_0x2675a7[_0x716a('0x2e')][_0x716a('0x35')](_0x716a('0x36'))){_0x2a0cfd[_0x716a('0x1c')]=qs[_0x716a('0x1c')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x1c')]);_0x2a0cfd[_0x716a('0x1a')]=qs[_0x716a('0x1a')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x1a')]);}_0x2a0cfd[_0x716a('0x37')]=qs[_0x716a('0x38')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x38')]);_0x2a0cfd[_0x716a('0x39')]=qs[_0x716a('0x30')](_[_0x716a('0x3a')](_0x2675a7[_0x716a('0x2e')],_0x587565['filters']),_0x3c5707);if(_0x2675a7[_0x716a('0x2e')]['filter']){_0x2a0cfd[_0x716a('0x39')]=_[_0x716a('0x3b')](_0x2a0cfd[_0x716a('0x39')],{'$or':_[_0x716a('0x2d')](_0x3c5707,function(_0x7b0491){if(_0x7b0491[_0x716a('0x2a')]!==_0x716a('0x3c')){var _0x3c99a7={};_0x3c99a7[_0x7b0491[_0x716a('0x24')]]={'$like':'%'+_0x2675a7[_0x716a('0x2e')]['filter']+'%'};return _0x3c99a7;}})});}_0x2a0cfd=_[_0x716a('0x3b')]({},_0x2a0cfd,_0x2675a7[_0x716a('0x3d')]);var _0xe6c695={'where':_0x2a0cfd[_0x716a('0x39')]};return db[_0x716a('0x27')][_0x716a('0x1d')](_0xe6c695)[_0x716a('0x22')](function(_0x986ef5){_0x1d60f2['count']=_0x986ef5;if(_0x2675a7[_0x716a('0x2e')][_0x716a('0x3e')]){_0x2a0cfd['include']=[{'all':!![]}];}return db[_0x716a('0x27')][_0x716a('0x3f')](_0x2a0cfd);})[_0x716a('0x22')](function(_0x552305){_0x1d60f2['rows']=_0x552305;return _0x1d60f2;})[_0x716a('0x22')](respondWithFilteredResult(_0x1f003d,_0x2a0cfd))[_0x716a('0x40')](handleError(_0x1f003d,null));};exports[_0x716a('0x41')]=function(_0x338e2f,_0xe433af){var _0xb40496={'raw':!![],'where':{'id':_0x338e2f[_0x716a('0x42')]['id']}},_0x31058b={};_0x31058b[_0x716a('0x2c')]=_[_0x716a('0x2f')](db[_0x716a('0x27')][_0x716a('0x28')]);_0x31058b[_0x716a('0x2e')]=_['keys'](_0x338e2f['query']);_0x31058b[_0x716a('0x30')]=_[_0x716a('0x31')](_0x31058b[_0x716a('0x2c')],_0x31058b[_0x716a('0x2e')]);_0xb40496[_0x716a('0x32')]=_[_0x716a('0x31')](_0x31058b['model'],qs[_0x716a('0x33')](_0x338e2f[_0x716a('0x2e')]['fields']));_0xb40496['attributes']=_0xb40496[_0x716a('0x32')][_0x716a('0x34')]?_0xb40496[_0x716a('0x32')]:_0x31058b[_0x716a('0x2c')];if(_0x338e2f[_0x716a('0x2e')][_0x716a('0x3e')]){_0xb40496[_0x716a('0x43')]=[{'all':!![]}];}_0xb40496=_['merge']({},_0xb40496,_0x338e2f['options']);return db[_0x716a('0x27')][_0x716a('0x44')](_0xb40496)[_0x716a('0x22')](handleEntityNotFound(_0xe433af,null))['then'](respondWithResult(_0xe433af,null))['catch'](handleError(_0xe433af,null));};exports[_0x716a('0x45')]=function(_0x7bdbef,_0x47e102){return db[_0x716a('0x27')][_0x716a('0x45')](_0x7bdbef[_0x716a('0x46')],{})[_0x716a('0x22')](respondWithResult(_0x47e102,0xc9))[_0x716a('0x40')](handleError(_0x47e102,null));};exports['update']=function(_0x420a86,_0x99be6f){if(_0x420a86[_0x716a('0x46')]['id']){delete _0x420a86[_0x716a('0x46')]['id'];}return db[_0x716a('0x27')][_0x716a('0x44')]({'where':{'id':_0x420a86[_0x716a('0x42')]['id']}})[_0x716a('0x22')](handleEntityNotFound(_0x99be6f,null))[_0x716a('0x22')](saveUpdates(_0x420a86[_0x716a('0x46')],null))[_0x716a('0x22')](respondWithResult(_0x99be6f,null))[_0x716a('0x40')](handleError(_0x99be6f,null));};exports['download']=function(_0x44f146,_0x1ed086,_0x203a72){var _0x3519be=require(_0x716a('0x47'));var _0x2c5e35=![];var _0x358e47={};if(_0x44f146[_0x716a('0x2e')]['type']&&_0x44f146[_0x716a('0x2e')][_0x716a('0x2a')]==='uniqueid'){_0x358e47['uniqueid']=_0x44f146[_0x716a('0x42')]['id'];}else{_0x358e47['id']=_0x44f146[_0x716a('0x42')]['id'];}return db[_0x716a('0x27')]['find']({'where':_0x358e47,'attributes':['id',_0x716a('0x48'),_0x716a('0x49')],'raw':!![]})[_0x716a('0x22')](handleEntityNotFound(_0x1ed086,null))[_0x716a('0x22')](function(_0x29d780){if(_0x29d780){var _0x4b66ec=_0x29d780[_0x716a('0x48')];var _0x8d69fd=util[_0x716a('0x4a')](_0x716a('0x4b'),_0x4b66ec);if(fs[_0x716a('0x4c')](_0x8d69fd)){_0x2c5e35=!![];return _0x3519be[_0x716a('0x4d')](_0x8d69fd,_0x4b66ec,config[_0x716a('0x4e')][_0x716a('0x4f')])[_0x716a('0x22')](function(){return _0x29d780;});}return _0x29d780;}})['then'](function(_0x5285e5){if(_0x5285e5){var _0x37db6e=_0x5285e5['savePath'];if(!fs[_0x716a('0x4c')](_0x37db6e)){throw new db[(_0x716a('0x50'))][(_0x716a('0x51'))](_0x716a('0x52'));}if(_0x5285e5[_0x716a('0x49')]){return _0x1ed086[_0x716a('0x53')](_0x37db6e,_0x5285e5[_0x716a('0x49')]+path[_0x716a('0x54')](_0x37db6e),function(){if(_0x2c5e35){fs[_0x716a('0x55')](_0x37db6e);}});}else{return _0x1ed086['download'](_0x37db6e,function(_0x5557cb){if(_0x2c5e35){fs[_0x716a('0x55')](_0x37db6e);}});}}})[_0x716a('0x40')](function(_0xfa7fb8){if(_0xfa7fb8['message']===_0x716a('0x52')){_0x1ed086[_0x716a('0x18')](0x194)['send'](_0x716a('0x56'));}else{return handleError(_0x1ed086,null);}});};exports[_0x716a('0x57')]=function(_0x3a205f,_0x770938){return db['SquareRecording'][_0x716a('0x44')]({'where':{'id':_0x3a205f[_0x716a('0x42')]['id']}})['then'](function(_0x57617a){if(_[_0x716a('0x58')](_0x57617a)){throw new ReferenceError(_0x716a('0x59'));}return _0x57617a;})[_0x716a('0x22')](function(_0x4763e8){var _0x41075a=_0x4763e8[_0x716a('0x48')];logger[_0x716a('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x41075a);if(!_[_0x716a('0x58')](_0x4763e8['savePath'])&&fs[_0x716a('0x4c')](_0x41075a)){logger['info'](_0x716a('0x5b')+_0x41075a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x716a('0x5c')](_0x41075a);}_0x41075a=_0x41075a+'.cypher';if(!_[_0x716a('0x58')](_0x4763e8['savePath'])&&fs[_0x716a('0x4c')](_0x41075a)){logger[_0x716a('0x5a')]('File:\x20\x22'+_0x41075a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x716a('0x5c')](_0x41075a);}return _0x4763e8;})[_0x716a('0x22')](function(_0xc61918){if(!_0xc61918)throw new InternalError();return _0xc61918[_0x716a('0x57')]();})[_0x716a('0x22')](function(){_0x770938[_0x716a('0x18')](0xcc)[_0x716a('0x23')]();})['catch'](handleError(_0x770938,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 874c8ff..f1cc7c4 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 _0x3ef7=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3ef7,0xa2));var _0x73ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ef7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var logger=require(_0x73ef('0x1'))(_0x73ef('0x2'));var moment=require(_0x73ef('0x3'));var BPromise=require(_0x73ef('0x4'));var rp=require(_0x73ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var attributes=require(_0x73ef('0x8'));module[_0x73ef('0x9')]=function(_0x4aaf96,_0x18cd10){return _0x4aaf96[_0x73ef('0xa')](_0x73ef('0xb'),attributes,{'tableName':_0x73ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d49=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','api','moment','bluebird'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4d49,0x141));var _0x94d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d49[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var logger=require('../../config/logger')(_0x94d4('0x1'));var moment=require(_0x94d4('0x2'));var BPromise=require(_0x94d4('0x3'));var rp=require(_0x94d4('0x4'));var fs=require('fs');var path=require(_0x94d4('0x5'));var rimraf=require(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var attributes=require(_0x94d4('0x8'));module[_0x94d4('0x9')]=function(_0x4dd133,_0x2b3127){return _0x4dd133[_0x94d4('0xa')](_0x94d4('0xb'),attributes,{'tableName':_0x94d4('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 79981aa..a9b12c8 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 _0x9f6d=['client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x27e1d9,_0x82ba9c){var _0x1a5e76=function(_0x360ca8){while(--_0x360ca8){_0x27e1d9['push'](_0x27e1d9['shift']());}};_0x1a5e76(++_0x82ba9c);}(_0x9f6d,0x140));var _0xd9f6=function(_0x52c97b,_0x512b96){_0x52c97b=_0x52c97b-0x0;var _0x24f98b=_0x9f6d[_0x52c97b];return _0x24f98b;};'use strict';var _=require(_0xd9f6('0x0'));var util=require(_0xd9f6('0x1'));var moment=require(_0xd9f6('0x2'));var BPromise=require(_0xd9f6('0x3'));var rs=require(_0xd9f6('0x4'));var fs=require('fs');var Redis=require(_0xd9f6('0x5'));var db=require(_0xd9f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9f6('0x7'));var config=require(_0xd9f6('0x8'));var jayson=require(_0xd9f6('0x9'));var client=jayson[_0xd9f6('0xa')][_0xd9f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4edd,_0x4df34c,_0x2f839d){return new BPromise(function(_0x4853ae,_0x4aff56){return client[_0xd9f6('0xc')](_0x2f4edd,_0x2f839d)['then'](function(_0x5a12dd){logger[_0xd9f6('0xd')](_0xd9f6('0xe'),_0x4df34c,_0xd9f6('0xf'));logger[_0xd9f6('0x10')](_0xd9f6('0x11'),_0x4df34c,_0xd9f6('0xf'),JSON[_0xd9f6('0x12')](_0x5a12dd));if(_0x5a12dd[_0xd9f6('0x13')]){if(_0x5a12dd['error'][_0xd9f6('0x14')]===0x1f4){logger[_0xd9f6('0x13')]('SquareRecording,\x20%s,\x20%s',_0x4df34c,_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);return _0x4aff56(_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);}logger[_0xd9f6('0x13')](_0xd9f6('0xe'),_0x4df34c,_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);return _0x4853ae(_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);}else{logger[_0xd9f6('0xd')](_0xd9f6('0xe'),_0x4df34c,_0xd9f6('0xf'));_0x4853ae(_0x5a12dd[_0xd9f6('0x16')][_0xd9f6('0x15')]);}})[_0xd9f6('0x17')](function(_0x43afbb){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4df34c,_0x43afbb);_0x4aff56(_0x43afbb);});});}exports[_0xd9f6('0x18')]=function(_0x1b7811){var _0x1fd27a=this;return new Promise(function(_0x2fe111,_0x59600f){return db[_0xd9f6('0x19')][_0xd9f6('0x1a')](_0x1b7811[_0xd9f6('0x1b')],{'raw':_0x1b7811['options']?_0x1b7811['options'][_0xd9f6('0x1c')]===undefined?!![]:![]:!![]})[_0xd9f6('0x1d')](function(_0x472b2a){logger[_0xd9f6('0xd')](_0xd9f6('0x18'),_0x1b7811);logger['debug'](_0xd9f6('0x18'),_0x1b7811,JSON[_0xd9f6('0x12')](_0x472b2a));_0x2fe111(_0x472b2a);})[_0xd9f6('0x17')](function(_0x12b38b){logger['error']('CreateSquareRecording',_0x12b38b[_0xd9f6('0x15')],_0x1b7811);_0x59600f(_0x1fd27a['error'](0x1f4,_0x12b38b[_0xd9f6('0x15')]));});});}; \ No newline at end of file +var _0xfe06=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','info','lodash','util'];(function(_0x3dac2a,_0x2ded9d){var _0x1e598d=function(_0x4d15b1){while(--_0x4d15b1){_0x3dac2a['push'](_0x3dac2a['shift']());}};_0x1e598d(++_0x2ded9d);}(_0xfe06,0x15d));var _0x6fe0=function(_0x155908,_0x33a1f2){_0x155908=_0x155908-0x0;var _0x1f8699=_0xfe06[_0x155908];return _0x1f8699;};'use strict';var _=require(_0x6fe0('0x0'));var util=require(_0x6fe0('0x1'));var moment=require(_0x6fe0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fe0('0x3'));var fs=require('fs');var Redis=require(_0x6fe0('0x4'));var db=require(_0x6fe0('0x5'))['db'];var utils=require(_0x6fe0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fe0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fe0('0x8')][_0x6fe0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c54e,_0x511113,_0x2ec9c8){return new BPromise(function(_0x13bf86,_0x51bc93){return client[_0x6fe0('0xa')](_0x47c54e,_0x2ec9c8)[_0x6fe0('0xb')](function(_0xc60c52){logger['info']('SquareRecording,\x20%s,\x20%s',_0x511113,_0x6fe0('0xc'));logger[_0x6fe0('0xd')](_0x6fe0('0xe'),_0x511113,_0x6fe0('0xc'),JSON[_0x6fe0('0xf')](_0xc60c52));if(_0xc60c52[_0x6fe0('0x10')]){if(_0xc60c52['error']['code']===0x1f4){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52['error'][_0x6fe0('0x12')]);return _0x51bc93(_0xc60c52[_0x6fe0('0x10')]['message']);}logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);return _0x13bf86(_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);}else{logger['info'](_0x6fe0('0x11'),_0x511113,_0x6fe0('0xc'));_0x13bf86(_0xc60c52['result'][_0x6fe0('0x12')]);}})[_0x6fe0('0x13')](function(_0xd0b529){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xd0b529);_0x51bc93(_0xd0b529);});});}exports[_0x6fe0('0x14')]=function(_0x5daab1){var _0x5f33cf=this;return new Promise(function(_0x50e817,_0x560e3c){return db[_0x6fe0('0x15')][_0x6fe0('0x16')](_0x5daab1[_0x6fe0('0x17')],{'raw':_0x5daab1['options']?_0x5daab1[_0x6fe0('0x18')][_0x6fe0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x549f62){logger[_0x6fe0('0x1a')](_0x6fe0('0x14'),_0x5daab1);logger[_0x6fe0('0xd')](_0x6fe0('0x14'),_0x5daab1,JSON[_0x6fe0('0xf')](_0x549f62));_0x50e817(_0x549f62);})['catch'](function(_0x5815dd){logger['error']('CreateSquareRecording',_0x5815dd['message'],_0x5daab1);_0x560e3c(_0x5f33cf[_0x6fe0('0x10')](0x1f4,_0x5815dd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b914ac1..fd8171a 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 _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(_0x3dcb32,_0x28c7fd){var _0x2ce602=function(_0x3012e3){while(--_0x3012e3){_0x3dcb32['push'](_0x3dcb32['shift']());}};_0x2ce602(++_0x28c7fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3ca256,_0xad3514){var _0xf5fa63=function(_0x5819f5){while(--_0x5819f5){_0x3ca256['push'](_0x3ca256['shift']());}};_0xf5fa63(++_0xad3514);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ccbb539..20d5d5c 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 _0x3b91=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1c2094,_0x11ec24){var _0x52285c=function(_0x2f01f3){while(--_0x2f01f3){_0x1c2094['push'](_0x1c2094['shift']());}};_0x52285c(++_0x11ec24);}(_0x3b91,0x127));var _0x13b9=function(_0x3d45b4,_0x4a757a){_0x3d45b4=_0x3d45b4-0x0;var _0x4a85b7=_0x3b91[_0x3d45b4];return _0x4a85b7;};'use strict';var Sequelize=require(_0x13b9('0x0'));module[_0x13b9('0x1')]={'network':{'type':Sequelize[_0x13b9('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x13b9('0x2')]},'language':{'type':Sequelize[_0x13b9('0x2')]},'type':{'type':Sequelize[_0x13b9('0x2')]},'uniqueid':{'type':Sequelize[_0x13b9('0x2')]},'version':{'type':Sequelize[_0x13b9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x13b9('0x2')]},'callingpres':{'type':Sequelize[_0x13b9('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x13b9('0x2')]},'callingtns':{'type':Sequelize[_0x13b9('0x2')]},'dnid':{'type':Sequelize[_0x13b9('0x2')]},'rdnis':{'type':Sequelize[_0x13b9('0x2')]},'context':{'type':Sequelize[_0x13b9('0x2')]},'extension':{'type':Sequelize[_0x13b9('0x2')]},'priority':{'type':Sequelize[_0x13b9('0x2')]},'enhanced':{'type':Sequelize[_0x13b9('0x2')]},'accountcode':{'type':Sequelize[_0x13b9('0x2')]},'threadid':{'type':Sequelize[_0x13b9('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x13b9('0x3')]},'leaveAt':{'type':Sequelize[_0x13b9('0x3')]},'bot':{'type':Sequelize[_0x13b9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x023d=['STRING','DATE','BOOLEAN','exports'];(function(_0x81e5d9,_0x4493fc){var _0x1d00f6=function(_0x3e9acd){while(--_0x3e9acd){_0x81e5d9['push'](_0x81e5d9['shift']());}};_0x1d00f6(++_0x4493fc);}(_0x023d,0x67));var _0xd023=function(_0x15b50e,_0x398bda){_0x15b50e=_0x15b50e-0x0;var _0x9e8ffe=_0x023d[_0x15b50e];return _0x9e8ffe;};'use strict';var Sequelize=require('sequelize');module[_0xd023('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd023('0x1')]},'request':{'type':Sequelize[_0xd023('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd023('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd023('0x1')]},'callerid':{'type':Sequelize[_0xd023('0x1')]},'calleridname':{'type':Sequelize[_0xd023('0x1')]},'callingpres':{'type':Sequelize[_0xd023('0x1')]},'callingani2':{'type':Sequelize[_0xd023('0x1')]},'callington':{'type':Sequelize[_0xd023('0x1')]},'callingtns':{'type':Sequelize[_0xd023('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd023('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd023('0x1')]},'enhanced':{'type':Sequelize[_0xd023('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xd023('0x1')]},'project_name':{'type':Sequelize[_0xd023('0x1')]},'joinAt':{'type':Sequelize[_0xd023('0x2')]},'leaveAt':{'type':Sequelize[_0xd023('0x2')]},'bot':{'type':Sequelize[_0xd023('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 50d568c..804723e 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 _0xe7fa=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1a6dab,_0x101d90){var _0x213504=function(_0x243374){while(--_0x243374){_0x1a6dab['push'](_0x1a6dab['shift']());}};_0x213504(++_0x101d90);}(_0xe7fa,0x112));var _0xae7f=function(_0x1e1837,_0x557d38){_0x1e1837=_0x1e1837-0x0;var _0xafa44d=_0xe7fa[_0x1e1837];return _0xafa44d;};'use strict';var emlformat=require(_0xae7f('0x0'));var rimraf=require(_0xae7f('0x1'));var zipdir=require(_0xae7f('0x2'));var jsonpatch=require(_0xae7f('0x3'));var rp=require(_0xae7f('0x4'));var moment=require('moment');var BPromise=require(_0xae7f('0x5'));var Mustache=require(_0xae7f('0x6'));var util=require(_0xae7f('0x7'));var path=require('path');var sox=require(_0xae7f('0x8'));var csv=require('to-csv');var ejs=require(_0xae7f('0x9'));var fs=require('fs');var fs_extra=require(_0xae7f('0xa'));var _=require(_0xae7f('0xb'));var squel=require(_0xae7f('0xc'));var crypto=require(_0xae7f('0xd'));var jsforce=require(_0xae7f('0xe'));var deskjs=require(_0xae7f('0xf'));var toCsv=require(_0xae7f('0x10'));var querystring=require(_0xae7f('0x11'));var Papa=require(_0xae7f('0x12'));var Redis=require(_0xae7f('0x13'));var authService=require(_0xae7f('0x14'));var qs=require(_0xae7f('0x15'));var as=require(_0xae7f('0x16'));var hardwareService=require(_0xae7f('0x17'));var logger=require('../../config/logger')(_0xae7f('0x18'));var utils=require('../../config/utils');var config=require(_0xae7f('0x19'));var licenseUtil=require(_0xae7f('0x1a'));var db=require(_0xae7f('0x1b'))['db'];function respondWithStatusCode(_0x4dab21,_0x4e8a89){_0x4e8a89=_0x4e8a89||0xcc;return function(_0x40b650){if(_0x40b650){return _0x4dab21['sendStatus'](_0x4e8a89);}return _0x4dab21['status'](_0x4e8a89)[_0xae7f('0x1c')]();};}function respondWithResult(_0x53f2f0,_0x1438d2){_0x1438d2=_0x1438d2||0xc8;return function(_0x2dcd3c){if(_0x2dcd3c){return _0x53f2f0[_0xae7f('0x1d')](_0x1438d2)[_0xae7f('0x1e')](_0x2dcd3c);}};}function respondWithFilteredResult(_0xa6edfc,_0x71246a){return function(_0x161bc8){if(_0x161bc8){var _0x4aef85=typeof _0x71246a[_0xae7f('0x1f')]===_0xae7f('0x20')&&typeof _0x71246a[_0xae7f('0x21')]==='undefined';var _0x4a9691=_0x161bc8[_0xae7f('0x22')];var _0x59d832=_0x4aef85?0x0:_0x71246a[_0xae7f('0x1f')];var _0x7f2a45=_0x4aef85?_0x161bc8[_0xae7f('0x22')]:_0x71246a[_0xae7f('0x1f')]+_0x71246a[_0xae7f('0x21')];var _0xb787e4;if(_0x7f2a45>=_0x4a9691){_0x7f2a45=_0x4a9691;_0xb787e4=0xc8;}else{_0xb787e4=0xce;}_0xa6edfc['status'](_0xb787e4);return _0xa6edfc['set'](_0xae7f('0x23'),_0x59d832+'-'+_0x7f2a45+'/'+_0x4a9691)['json'](_0x161bc8);}return null;};}function patchUpdates(_0x3d6599){return function(_0x334da9){try{jsonpatch[_0xae7f('0x24')](_0x334da9,_0x3d6599,!![]);}catch(_0x5123df){return BPromise[_0xae7f('0x25')](_0x5123df);}return _0x334da9['save']();};}function saveUpdates(_0x239f7c,_0x1ef711){return function(_0x398eb9){if(_0x398eb9){return _0x398eb9['update'](_0x239f7c)[_0xae7f('0x26')](function(_0x145427){return _0x145427;});}return null;};}function removeEntity(_0x5712da,_0x567021){return function(_0x3ef714){if(_0x3ef714){return _0x3ef714[_0xae7f('0x27')]()[_0xae7f('0x26')](function(){_0x5712da[_0xae7f('0x1d')](0xcc)[_0xae7f('0x1c')]();});}};}function handleEntityNotFound(_0x5ba87d,_0x5aeb1d){return function(_0x4ec745){if(!_0x4ec745){_0x5ba87d[_0xae7f('0x28')](0x194);}return _0x4ec745;};}function handleError(_0x4fd802,_0x295adf){_0x295adf=_0x295adf||0x1f4;return function(_0x25ac9f){logger[_0xae7f('0x29')](_0x25ac9f[_0xae7f('0x2a')]);if(_0x25ac9f[_0xae7f('0x2b')]){delete _0x25ac9f['name'];}_0x4fd802[_0xae7f('0x1d')](_0x295adf)[_0xae7f('0x2c')](_0x25ac9f);};}exports[_0xae7f('0x2d')]=function(_0x6a124f,_0x30f9b6){var _0x3e8c7c={},_0x35d3c8={},_0x2e21de={'count':0x0,'rows':[]};var _0x466542=_['map'](db[_0xae7f('0x2e')][_0xae7f('0x2f')],function(_0x4e3127){return{'name':_0x4e3127[_0xae7f('0x30')],'type':_0x4e3127[_0xae7f('0x31')][_0xae7f('0x32')]};});_0x35d3c8[_0xae7f('0x33')]=_[_0xae7f('0x34')](_0x466542,_0xae7f('0x2b'));_0x35d3c8[_0xae7f('0x35')]=_[_0xae7f('0x36')](_0x6a124f['query']);_0x35d3c8[_0xae7f('0x37')]=_[_0xae7f('0x38')](_0x35d3c8[_0xae7f('0x33')],_0x35d3c8['query']);_0x3e8c7c[_0xae7f('0x39')]=_[_0xae7f('0x38')](_0x35d3c8[_0xae7f('0x33')],qs[_0xae7f('0x3a')](_0x6a124f[_0xae7f('0x35')][_0xae7f('0x3a')]));_0x3e8c7c['attributes']=_0x3e8c7c['attributes'][_0xae7f('0x3b')]?_0x3e8c7c[_0xae7f('0x39')]:_0x35d3c8[_0xae7f('0x33')];if(!_0x6a124f['query'][_0xae7f('0x3c')](_0xae7f('0x3d'))){_0x3e8c7c[_0xae7f('0x21')]=qs[_0xae7f('0x21')](_0x6a124f[_0xae7f('0x35')][_0xae7f('0x21')]);_0x3e8c7c[_0xae7f('0x1f')]=qs[_0xae7f('0x1f')](_0x6a124f[_0xae7f('0x35')]['offset']);}_0x3e8c7c[_0xae7f('0x3e')]=qs['sort'](_0x6a124f[_0xae7f('0x35')][_0xae7f('0x3f')]);_0x3e8c7c['where']=qs[_0xae7f('0x37')](_[_0xae7f('0x40')](_0x6a124f[_0xae7f('0x35')],_0x35d3c8['filters']),_0x466542);if(_0x6a124f[_0xae7f('0x35')][_0xae7f('0x41')]){_0x3e8c7c[_0xae7f('0x42')]=_[_0xae7f('0x43')](_0x3e8c7c[_0xae7f('0x42')],{'$or':_[_0xae7f('0x34')](_0x466542,function(_0x20d765){if(_0x20d765[_0xae7f('0x31')]!==_0xae7f('0x44')){var _0x2c5a39={};_0x2c5a39[_0x20d765[_0xae7f('0x2b')]]={'$like':'%'+_0x6a124f['query'][_0xae7f('0x41')]+'%'};return _0x2c5a39;}})});}_0x3e8c7c=_[_0xae7f('0x43')]({},_0x3e8c7c,_0x6a124f[_0xae7f('0x45')]);var _0x555c19={'where':_0x3e8c7c[_0xae7f('0x42')]};return db[_0xae7f('0x2e')][_0xae7f('0x22')](_0x555c19)[_0xae7f('0x26')](function(_0x3529f9){_0x2e21de[_0xae7f('0x22')]=_0x3529f9;if(_0x6a124f[_0xae7f('0x35')][_0xae7f('0x46')]){_0x3e8c7c[_0xae7f('0x47')]=[{'all':!![]}];}return db[_0xae7f('0x2e')][_0xae7f('0x48')](_0x3e8c7c);})['then'](function(_0x17a82c){_0x2e21de[_0xae7f('0x49')]=_0x17a82c;return _0x2e21de;})[_0xae7f('0x26')](respondWithFilteredResult(_0x30f9b6,_0x3e8c7c))[_0xae7f('0x4a')](handleError(_0x30f9b6,null));};exports[_0xae7f('0x4b')]=function(_0x260721,_0x2d5b81){var _0x1dd686={'raw':!![],'where':{'id':_0x260721['params']['id']}},_0x3dc803={};_0x3dc803[_0xae7f('0x33')]=_['keys'](db[_0xae7f('0x2e')]['rawAttributes']);_0x3dc803[_0xae7f('0x35')]=_[_0xae7f('0x36')](_0x260721[_0xae7f('0x35')]);_0x3dc803[_0xae7f('0x37')]=_[_0xae7f('0x38')](_0x3dc803['model'],_0x3dc803[_0xae7f('0x35')]);_0x1dd686[_0xae7f('0x39')]=_['intersection'](_0x3dc803[_0xae7f('0x33')],qs[_0xae7f('0x3a')](_0x260721[_0xae7f('0x35')]['fields']));_0x1dd686[_0xae7f('0x39')]=_0x1dd686['attributes']['length']?_0x1dd686[_0xae7f('0x39')]:_0x3dc803[_0xae7f('0x33')];if(_0x260721[_0xae7f('0x35')][_0xae7f('0x46')]){_0x1dd686[_0xae7f('0x47')]=[{'all':!![]}];}_0x1dd686=_[_0xae7f('0x43')]({},_0x1dd686,_0x260721['options']);return db[_0xae7f('0x2e')][_0xae7f('0x4c')](_0x1dd686)['then'](handleEntityNotFound(_0x2d5b81,null))[_0xae7f('0x26')](respondWithResult(_0x2d5b81,null))[_0xae7f('0x4a')](handleError(_0x2d5b81,null));};exports[_0xae7f('0x4d')]=function(_0x1ab136,_0x2f64a2){return db[_0xae7f('0x2e')][_0xae7f('0x4d')](_0x1ab136[_0xae7f('0x4e')],{})['then'](respondWithResult(_0x2f64a2,0xc9))[_0xae7f('0x4a')](handleError(_0x2f64a2,null));};exports[_0xae7f('0x4f')]=function(_0x228287,_0x3f2fe5){if(_0x228287[_0xae7f('0x4e')]['id']){delete _0x228287['body']['id'];}return db[_0xae7f('0x2e')][_0xae7f('0x4c')]({'where':{'id':_0x228287['params']['id']}})[_0xae7f('0x26')](handleEntityNotFound(_0x3f2fe5,null))[_0xae7f('0x26')](saveUpdates(_0x228287[_0xae7f('0x4e')],null))['then'](respondWithResult(_0x3f2fe5,null))['catch'](handleError(_0x3f2fe5,null));};exports[_0xae7f('0x27')]=function(_0x3db33e,_0x52b456){return db[_0xae7f('0x2e')][_0xae7f('0x4c')]({'where':{'id':_0x3db33e[_0xae7f('0x50')]['id']}})[_0xae7f('0x26')](handleEntityNotFound(_0x52b456,null))[_0xae7f('0x26')](removeEntity(_0x52b456,null))['catch'](handleError(_0x52b456,null));};exports['describe']=function(_0x2e5f9e,_0x20c03e){return db['SquareReport'][_0xae7f('0x51')]()['then'](respondWithResult(_0x20c03e,null))[_0xae7f('0x4a')](handleError(_0x20c03e,null));}; \ No newline at end of file +var _0x6954=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5b8237,_0x327039){var _0x372191=function(_0x59b7b5){while(--_0x59b7b5){_0x5b8237['push'](_0x5b8237['shift']());}};_0x372191(++_0x327039);}(_0x6954,0x8f));var _0x4695=function(_0x460fdd,_0x16703a){_0x460fdd=_0x460fdd-0x0;var _0x4145a7=_0x6954[_0x460fdd];return _0x4145a7;};'use strict';var emlformat=require(_0x4695('0x0'));var rimraf=require(_0x4695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4695('0x2'));var rp=require('request-promise');var moment=require(_0x4695('0x3'));var BPromise=require(_0x4695('0x4'));var Mustache=require(_0x4695('0x5'));var util=require(_0x4695('0x6'));var path=require('path');var sox=require(_0x4695('0x7'));var csv=require(_0x4695('0x8'));var ejs=require(_0x4695('0x9'));var fs=require('fs');var fs_extra=require(_0x4695('0xa'));var _=require(_0x4695('0xb'));var squel=require(_0x4695('0xc'));var crypto=require(_0x4695('0xd'));var jsforce=require(_0x4695('0xe'));var deskjs=require(_0x4695('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4695('0x10'));var Papa=require(_0x4695('0x11'));var Redis=require('ioredis');var authService=require(_0x4695('0x12'));var qs=require(_0x4695('0x13'));var as=require(_0x4695('0x14'));var hardwareService=require(_0x4695('0x15'));var logger=require(_0x4695('0x16'))(_0x4695('0x17'));var utils=require(_0x4695('0x18'));var config=require(_0x4695('0x19'));var licenseUtil=require(_0x4695('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c13e8,_0x158235){_0x158235=_0x158235||0xcc;return function(_0x23bb96){if(_0x23bb96){return _0x4c13e8[_0x4695('0x1b')](_0x158235);}return _0x4c13e8[_0x4695('0x1c')](_0x158235)[_0x4695('0x1d')]();};}function respondWithResult(_0x57dca2,_0x3ac892){_0x3ac892=_0x3ac892||0xc8;return function(_0x4fd6c6){if(_0x4fd6c6){return _0x57dca2['status'](_0x3ac892)[_0x4695('0x1e')](_0x4fd6c6);}};}function respondWithFilteredResult(_0x2ebb78,_0x51cabc){return function(_0x3041dc){if(_0x3041dc){var _0xa69ab0=typeof _0x51cabc[_0x4695('0x1f')]===_0x4695('0x20')&&typeof _0x51cabc[_0x4695('0x21')]===_0x4695('0x20');var _0x54fdbf=_0x3041dc[_0x4695('0x22')];var _0x543b91=_0xa69ab0?0x0:_0x51cabc[_0x4695('0x1f')];var _0x384f88=_0xa69ab0?_0x3041dc['count']:_0x51cabc['offset']+_0x51cabc[_0x4695('0x21')];var _0x5d91d1;if(_0x384f88>=_0x54fdbf){_0x384f88=_0x54fdbf;_0x5d91d1=0xc8;}else{_0x5d91d1=0xce;}_0x2ebb78[_0x4695('0x1c')](_0x5d91d1);return _0x2ebb78[_0x4695('0x23')](_0x4695('0x24'),_0x543b91+'-'+_0x384f88+'/'+_0x54fdbf)[_0x4695('0x1e')](_0x3041dc);}return null;};}function patchUpdates(_0x346d4e){return function(_0x574b1e){try{jsonpatch['apply'](_0x574b1e,_0x346d4e,!![]);}catch(_0x5bdcaf){return BPromise[_0x4695('0x25')](_0x5bdcaf);}return _0x574b1e[_0x4695('0x26')]();};}function saveUpdates(_0x1b34c6,_0x1725e1){return function(_0x43c9e3){if(_0x43c9e3){return _0x43c9e3[_0x4695('0x27')](_0x1b34c6)[_0x4695('0x28')](function(_0x2289a8){return _0x2289a8;});}return null;};}function removeEntity(_0x5e8930,_0x3a1942){return function(_0x509dbf){if(_0x509dbf){return _0x509dbf['destroy']()['then'](function(){_0x5e8930[_0x4695('0x1c')](0xcc)[_0x4695('0x1d')]();});}};}function handleEntityNotFound(_0x102b1c,_0x3346a5){return function(_0x15c997){if(!_0x15c997){_0x102b1c['sendStatus'](0x194);}return _0x15c997;};}function handleError(_0x422358,_0xd985e2){_0xd985e2=_0xd985e2||0x1f4;return function(_0x45dfc6){logger[_0x4695('0x29')](_0x45dfc6[_0x4695('0x2a')]);if(_0x45dfc6[_0x4695('0x2b')]){delete _0x45dfc6[_0x4695('0x2b')];}_0x422358[_0x4695('0x1c')](_0xd985e2)[_0x4695('0x2c')](_0x45dfc6);};}exports[_0x4695('0x2d')]=function(_0x1e8cec,_0x402d15){var _0x39bf9a={},_0x27a538={},_0x1e747f={'count':0x0,'rows':[]};var _0x95171=_[_0x4695('0x2e')](db[_0x4695('0x2f')][_0x4695('0x30')],function(_0x493b72){return{'name':_0x493b72['fieldName'],'type':_0x493b72[_0x4695('0x31')][_0x4695('0x32')]};});_0x27a538[_0x4695('0x33')]=_[_0x4695('0x2e')](_0x95171,_0x4695('0x2b'));_0x27a538['query']=_[_0x4695('0x34')](_0x1e8cec[_0x4695('0x35')]);_0x27a538[_0x4695('0x36')]=_[_0x4695('0x37')](_0x27a538['model'],_0x27a538[_0x4695('0x35')]);_0x39bf9a[_0x4695('0x38')]=_[_0x4695('0x37')](_0x27a538['model'],qs[_0x4695('0x39')](_0x1e8cec['query']['fields']));_0x39bf9a[_0x4695('0x38')]=_0x39bf9a[_0x4695('0x38')]['length']?_0x39bf9a[_0x4695('0x38')]:_0x27a538[_0x4695('0x33')];if(!_0x1e8cec[_0x4695('0x35')][_0x4695('0x3a')](_0x4695('0x3b'))){_0x39bf9a[_0x4695('0x21')]=qs[_0x4695('0x21')](_0x1e8cec[_0x4695('0x35')][_0x4695('0x21')]);_0x39bf9a[_0x4695('0x1f')]=qs[_0x4695('0x1f')](_0x1e8cec[_0x4695('0x35')][_0x4695('0x1f')]);}_0x39bf9a['order']=qs[_0x4695('0x3c')](_0x1e8cec['query']['sort']);_0x39bf9a['where']=qs['filters'](_[_0x4695('0x3d')](_0x1e8cec[_0x4695('0x35')],_0x27a538[_0x4695('0x36')]),_0x95171);if(_0x1e8cec['query']['filter']){_0x39bf9a[_0x4695('0x3e')]=_[_0x4695('0x3f')](_0x39bf9a['where'],{'$or':_[_0x4695('0x2e')](_0x95171,function(_0x6fd2fd){if(_0x6fd2fd[_0x4695('0x31')]!==_0x4695('0x40')){var _0x2b6dd3={};_0x2b6dd3[_0x6fd2fd['name']]={'$like':'%'+_0x1e8cec[_0x4695('0x35')]['filter']+'%'};return _0x2b6dd3;}})});}_0x39bf9a=_['merge']({},_0x39bf9a,_0x1e8cec[_0x4695('0x41')]);var _0x45da01={'where':_0x39bf9a[_0x4695('0x3e')]};return db[_0x4695('0x2f')]['count'](_0x45da01)[_0x4695('0x28')](function(_0x5d1bf4){_0x1e747f['count']=_0x5d1bf4;if(_0x1e8cec['query'][_0x4695('0x42')]){_0x39bf9a[_0x4695('0x43')]=[{'all':!![]}];}return db['SquareReport'][_0x4695('0x44')](_0x39bf9a);})[_0x4695('0x28')](function(_0x1b83c2){_0x1e747f[_0x4695('0x45')]=_0x1b83c2;return _0x1e747f;})['then'](respondWithFilteredResult(_0x402d15,_0x39bf9a))[_0x4695('0x46')](handleError(_0x402d15,null));};exports[_0x4695('0x47')]=function(_0x26a490,_0x35f7ae){var _0x3ca562={'raw':!![],'where':{'id':_0x26a490['params']['id']}},_0x2dfee0={};_0x2dfee0[_0x4695('0x33')]=_[_0x4695('0x34')](db[_0x4695('0x2f')]['rawAttributes']);_0x2dfee0['query']=_['keys'](_0x26a490[_0x4695('0x35')]);_0x2dfee0[_0x4695('0x36')]=_['intersection'](_0x2dfee0[_0x4695('0x33')],_0x2dfee0[_0x4695('0x35')]);_0x3ca562[_0x4695('0x38')]=_['intersection'](_0x2dfee0[_0x4695('0x33')],qs[_0x4695('0x39')](_0x26a490[_0x4695('0x35')][_0x4695('0x39')]));_0x3ca562[_0x4695('0x38')]=_0x3ca562['attributes'][_0x4695('0x48')]?_0x3ca562['attributes']:_0x2dfee0[_0x4695('0x33')];if(_0x26a490[_0x4695('0x35')]['includeAll']){_0x3ca562[_0x4695('0x43')]=[{'all':!![]}];}_0x3ca562=_[_0x4695('0x3f')]({},_0x3ca562,_0x26a490[_0x4695('0x41')]);return db[_0x4695('0x2f')][_0x4695('0x49')](_0x3ca562)[_0x4695('0x28')](handleEntityNotFound(_0x35f7ae,null))[_0x4695('0x28')](respondWithResult(_0x35f7ae,null))[_0x4695('0x46')](handleError(_0x35f7ae,null));};exports['create']=function(_0x1d551c,_0x127c06){return db['SquareReport'][_0x4695('0x4a')](_0x1d551c[_0x4695('0x4b')],{})[_0x4695('0x28')](respondWithResult(_0x127c06,0xc9))[_0x4695('0x46')](handleError(_0x127c06,null));};exports['update']=function(_0x469154,_0x4ef3da){if(_0x469154[_0x4695('0x4b')]['id']){delete _0x469154[_0x4695('0x4b')]['id'];}return db[_0x4695('0x2f')][_0x4695('0x49')]({'where':{'id':_0x469154[_0x4695('0x4c')]['id']}})[_0x4695('0x28')](handleEntityNotFound(_0x4ef3da,null))[_0x4695('0x28')](saveUpdates(_0x469154[_0x4695('0x4b')],null))[_0x4695('0x28')](respondWithResult(_0x4ef3da,null))[_0x4695('0x46')](handleError(_0x4ef3da,null));};exports[_0x4695('0x4d')]=function(_0x412a14,_0x1e218b){return db[_0x4695('0x2f')]['find']({'where':{'id':_0x412a14[_0x4695('0x4c')]['id']}})[_0x4695('0x28')](handleEntityNotFound(_0x1e218b,null))[_0x4695('0x28')](removeEntity(_0x1e218b,null))['catch'](handleError(_0x1e218b,null));};exports[_0x4695('0x4e')]=function(_0x1acb0e,_0x55225d){return db[_0x4695('0x2f')][_0x4695('0x4e')]()[_0x4695('0x28')](respondWithResult(_0x55225d,null))[_0x4695('0x46')](handleError(_0x55225d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b2a7ee9..2af1617 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 _0x323f=['exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x323f,0xa0));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xf323('0x0'));var util=require(_0xf323('0x1'));var logger=require(_0xf323('0x2'))(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var rp=require(_0xf323('0x6'));var fs=require('fs');var path=require(_0xf323('0x7'));var rimraf=require('rimraf');var config=require(_0xf323('0x8'));var attributes=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x812181,_0x6622f2){return _0x812181[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xf323('0xe'),_0xf323('0xf')]},{'name':_0xf323('0x10'),'fields':[_0xf323('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f7=['rimraf','../../config/environment','define','SquareReport','report_square','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xd4f7,0xe8));var _0x7d4f=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xd4f7[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x7d4f('0x0'));var util=require(_0x7d4f('0x1'));var logger=require(_0x7d4f('0x2'))(_0x7d4f('0x3'));var moment=require(_0x7d4f('0x4'));var BPromise=require(_0x7d4f('0x5'));var rp=require(_0x7d4f('0x6'));var fs=require('fs');var path=require(_0x7d4f('0x7'));var rimraf=require(_0x7d4f('0x8'));var config=require(_0x7d4f('0x9'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x2de8d2,_0x35fd6f){return _0x2de8d2[_0x7d4f('0xa')](_0x7d4f('0xb'),attributes,{'tableName':_0x7d4f('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x7d4f('0xd')]},{'name':_0x7d4f('0xe'),'fields':[_0x7d4f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 180abcd..1d49a75 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 _0x2545=['body','options','raw','UpdateSquareReport','SquareReport','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareReport','create'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x2545,0x19b));var _0x5254=function(_0x3a2a31,_0x73e1f9){_0x3a2a31=_0x3a2a31-0x0;var _0x4981b7=_0x2545[_0x3a2a31];return _0x4981b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5254('0x0'));var BPromise=require('bluebird');var rs=require(_0x5254('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5254('0x2'))['db'];var utils=require(_0x5254('0x3'));var logger=require('../../config/logger')(_0x5254('0x4'));var config=require(_0x5254('0x5'));var jayson=require(_0x5254('0x6'));var client=jayson[_0x5254('0x7')][_0x5254('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x202dd0,_0x4a0f09,_0x3bb776){return new BPromise(function(_0x4f4a7e,_0x1b418f){return client[_0x5254('0x9')](_0x202dd0,_0x3bb776)[_0x5254('0xa')](function(_0x4b3fc5){logger['info'](_0x5254('0xb'),_0x4a0f09,'request\x20sent');logger[_0x5254('0xc')](_0x5254('0xd'),_0x4a0f09,_0x5254('0xe'),JSON[_0x5254('0xf')](_0x4b3fc5));if(_0x4b3fc5['error']){if(_0x4b3fc5[_0x5254('0x10')][_0x5254('0x11')]===0x1f4){logger[_0x5254('0x10')](_0x5254('0xb'),_0x4a0f09,_0x4b3fc5['error'][_0x5254('0x12')]);return _0x1b418f(_0x4b3fc5[_0x5254('0x10')][_0x5254('0x12')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4a0f09,_0x4b3fc5[_0x5254('0x10')][_0x5254('0x12')]);return _0x4f4a7e(_0x4b3fc5[_0x5254('0x10')][_0x5254('0x12')]);}else{logger[_0x5254('0x13')](_0x5254('0xb'),_0x4a0f09,'request\x20sent');_0x4f4a7e(_0x4b3fc5[_0x5254('0x14')]['message']);}})[_0x5254('0x15')](function(_0x415a45){logger['error'](_0x5254('0xb'),_0x4a0f09,_0x415a45);_0x1b418f(_0x415a45);});});}exports[_0x5254('0x16')]=function(_0x4ee244){var _0x4341b3=this;return new Promise(function(_0x232f21,_0x5ccc7b){return db['SquareReport'][_0x5254('0x17')](_0x4ee244[_0x5254('0x18')],{'raw':_0x4ee244[_0x5254('0x19')]?_0x4ee244[_0x5254('0x19')][_0x5254('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3642fd){logger[_0x5254('0x13')](_0x5254('0x16'),_0x4ee244);logger[_0x5254('0xc')](_0x5254('0x16'),_0x4ee244,JSON[_0x5254('0xf')](_0x3642fd));_0x232f21(_0x3642fd);})[_0x5254('0x15')](function(_0x18ebba){logger[_0x5254('0x10')](_0x5254('0x16'),_0x18ebba['message'],_0x4ee244);_0x5ccc7b(_0x4341b3[_0x5254('0x10')](0x1f4,_0x18ebba[_0x5254('0x12')]));});});};exports[_0x5254('0x1b')]=function(_0x2c2aef){var _0x559628=this;return new Promise(function(_0x1e3ffe,_0x315ace){return db[_0x5254('0x1c')]['update'](_0x2c2aef[_0x5254('0x18')],{'raw':_0x2c2aef['options']?_0x2c2aef[_0x5254('0x19')][_0x5254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2aef[_0x5254('0x19')]?_0x2c2aef[_0x5254('0x19')]['where']||null:null,'attributes':_0x2c2aef[_0x5254('0x19')]?_0x2c2aef[_0x5254('0x19')]['attributes']||null:null,'limit':_0x2c2aef[_0x5254('0x19')]?_0x2c2aef[_0x5254('0x19')]['limit']||null:null})['then'](function(_0x2950f3){logger['info'](_0x5254('0x1b'),_0x2c2aef);logger[_0x5254('0xc')](_0x5254('0x1b'),_0x2c2aef,JSON[_0x5254('0xf')](_0x2950f3));_0x1e3ffe(_0x2950f3);})['catch'](function(_0xf72549){logger[_0x5254('0x10')](_0x5254('0x1b'),_0xf72549[_0x5254('0x12')],_0x2c2aef);_0x315ace(_0x559628[_0x5254('0x10')](0x1f4,_0xf72549[_0x5254('0x12')]));});});}; \ No newline at end of file +var _0xd307=['message','result','catch','CreateSquareReport','SquareReport','options','then','UpdateSquareReport','body','raw','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e9ed1,_0x7d61ec){var _0x38cd16=function(_0x28e1e2){while(--_0x28e1e2){_0x4e9ed1['push'](_0x4e9ed1['shift']());}};_0x38cd16(++_0x7d61ec);}(_0xd307,0x143));var _0x7d30=function(_0x558d4f,_0x3c32ae){_0x558d4f=_0x558d4f-0x0;var _0x4abb73=_0xd307[_0x558d4f];return _0x4abb73;};'use strict';var _=require(_0x7d30('0x0'));var util=require(_0x7d30('0x1'));var moment=require(_0x7d30('0x2'));var BPromise=require(_0x7d30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d30('0x5'))('rpc');var config=require(_0x7d30('0x6'));var jayson=require(_0x7d30('0x7'));var client=jayson[_0x7d30('0x8')][_0x7d30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10b3eb,_0x4a7bda,_0x1e7bd4){return new BPromise(function(_0x288ed4,_0x724db){return client['request'](_0x10b3eb,_0x1e7bd4)['then'](function(_0x5e0d69){logger[_0x7d30('0xa')](_0x7d30('0xb'),_0x4a7bda,_0x7d30('0xc'));logger[_0x7d30('0xd')](_0x7d30('0xe'),_0x4a7bda,_0x7d30('0xc'),JSON[_0x7d30('0xf')](_0x5e0d69));if(_0x5e0d69[_0x7d30('0x10')]){if(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x11')]===0x1f4){logger[_0x7d30('0x10')]('SquareReport,\x20%s,\x20%s',_0x4a7bda,_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);return _0x724db(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);}logger[_0x7d30('0x10')](_0x7d30('0xb'),_0x4a7bda,_0x5e0d69['error'][_0x7d30('0x12')]);return _0x288ed4(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);}else{logger[_0x7d30('0xa')](_0x7d30('0xb'),_0x4a7bda,'request\x20sent');_0x288ed4(_0x5e0d69[_0x7d30('0x13')][_0x7d30('0x12')]);}})[_0x7d30('0x14')](function(_0x4b8e2c){logger[_0x7d30('0x10')]('SquareReport,\x20%s,\x20%s',_0x4a7bda,_0x4b8e2c);_0x724db(_0x4b8e2c);});});}exports[_0x7d30('0x15')]=function(_0x1da56a){var _0x20e1ca=this;return new Promise(function(_0x4aef11,_0x412aa0){return db[_0x7d30('0x16')]['create'](_0x1da56a['body'],{'raw':_0x1da56a['options']?_0x1da56a[_0x7d30('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7d30('0x18')](function(_0xeb9a80){logger[_0x7d30('0xa')](_0x7d30('0x15'),_0x1da56a);logger[_0x7d30('0xd')](_0x7d30('0x15'),_0x1da56a,JSON['stringify'](_0xeb9a80));_0x4aef11(_0xeb9a80);})['catch'](function(_0x151cce){logger[_0x7d30('0x10')](_0x7d30('0x15'),_0x151cce['message'],_0x1da56a);_0x412aa0(_0x20e1ca[_0x7d30('0x10')](0x1f4,_0x151cce[_0x7d30('0x12')]));});});};exports[_0x7d30('0x19')]=function(_0x4880a2){var _0x3dece2=this;return new Promise(function(_0x4f6207,_0x588edc){return db[_0x7d30('0x16')]['update'](_0x4880a2[_0x7d30('0x1a')],{'raw':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1c')]||null:null,'attributes':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1d')]||null:null,'limit':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1e')]||null:null})[_0x7d30('0x18')](function(_0x451e86){logger['info'](_0x7d30('0x19'),_0x4880a2);logger[_0x7d30('0xd')]('UpdateSquareReport',_0x4880a2,JSON['stringify'](_0x451e86));_0x4f6207(_0x451e86);})['catch'](function(_0x2bac7e){logger['error'](_0x7d30('0x19'),_0x2bac7e[_0x7d30('0x12')],_0x4880a2);_0x588edc(_0x3dece2[_0x7d30('0x10')](0x1f4,_0x2bac7e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2fb3b25..31fbf2d 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 _0x0876=['get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0876,0x15d));var _0x6087=function(_0x20b9fa,_0x4c96fb){_0x20b9fa=_0x20b9fa-0x0;var _0x2d60c9=_0x0876[_0x20b9fa];return _0x2d60c9;};'use strict';var multer=require(_0x6087('0x0'));var util=require(_0x6087('0x1'));var path=require(_0x6087('0x2'));var timeout=require('connect-timeout');var express=require(_0x6087('0x3'));var router=express['Router']();var fs_extra=require(_0x6087('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6087('0x5'));var config=require(_0x6087('0x6'));var controller=require(_0x6087('0x7'));router[_0x6087('0x8')]('/',auth[_0x6087('0x9')](),controller[_0x6087('0xa')]);router[_0x6087('0x8')]('/describe',auth[_0x6087('0x9')](),controller[_0x6087('0xb')]);router[_0x6087('0x8')]('/:id',auth[_0x6087('0x9')](),controller[_0x6087('0xc')]);router[_0x6087('0xd')]('/',auth[_0x6087('0x9')](),controller[_0x6087('0xe')]);router[_0x6087('0xf')](_0x6087('0x10'),auth[_0x6087('0x9')](),controller[_0x6087('0x11')]);router[_0x6087('0x12')](_0x6087('0x10'),auth[_0x6087('0x9')](),controller[_0x6087('0x13')]);module[_0x6087('0x14')]=router; \ No newline at end of file +var _0x1e02=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','exports'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x1e02,0x140));var _0x21e0=function(_0x5e45cd,_0x2e73fe){_0x5e45cd=_0x5e45cd-0x0;var _0x545b4b=_0x1e02[_0x5e45cd];return _0x545b4b;};'use strict';var multer=require('multer');var util=require(_0x21e0('0x0'));var path=require(_0x21e0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e0('0x2')]();var fs_extra=require(_0x21e0('0x3'));var auth=require(_0x21e0('0x4'));var interaction=require(_0x21e0('0x5'));var config=require(_0x21e0('0x6'));var controller=require('./squareReportDetail.controller');router[_0x21e0('0x7')]('/',auth['isAuthenticated'](),controller[_0x21e0('0x8')]);router['get'](_0x21e0('0x9'),auth[_0x21e0('0xa')](),controller[_0x21e0('0xb')]);router['get']('/:id',auth[_0x21e0('0xa')](),controller[_0x21e0('0xc')]);router[_0x21e0('0xd')]('/',auth['isAuthenticated'](),controller[_0x21e0('0xe')]);router[_0x21e0('0xf')]('/:id',auth[_0x21e0('0xa')](),controller[_0x21e0('0x10')]);router[_0x21e0('0x11')](_0x21e0('0x12'),auth[_0x21e0('0xa')](),controller['destroy']);module[_0x21e0('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7155f6b..f94c1b3 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 _0xdd36=['exports','STRING'];(function(_0x47086d,_0x356a60){var _0x5a4c46=function(_0x43113d){while(--_0x43113d){_0x47086d['push'](_0x47086d['shift']());}};_0x5a4c46(++_0x356a60);}(_0xdd36,0xfe));var _0x6dd3=function(_0x5cbb51,_0x3c2086){_0x5cbb51=_0x5cbb51-0x0;var _0x489f77=_0xdd36[_0x5cbb51];return _0x489f77;};'use strict';var Sequelize=require('sequelize');module[_0x6dd3('0x0')]={'uniqueid':{'type':Sequelize[_0x6dd3('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6dd3('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x6dd3('0x1')]},'callerid':{'type':Sequelize[_0x6dd3('0x1')]}}; \ No newline at end of file +var _0x419d=['exports','STRING','TEXT','sequelize'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x419d,0x11f));var _0xd419=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0x419d[_0x4801a0];return _0x338e26;};'use strict';var Sequelize=require(_0xd419('0x0'));module[_0xd419('0x1')]={'uniqueid':{'type':Sequelize[_0xd419('0x2')]},'node':{'type':Sequelize[_0xd419('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xd419('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd419('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ea4c172..edb9378 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 _0xb16c=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','show','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xb16c,0xc7));var _0xcb16=function(_0x1651ae,_0x4f8556){_0x1651ae=_0x1651ae-0x0;var _0x4e79ce=_0xb16c[_0x1651ae];return _0x4e79ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb16('0x0'));var zipdir=require(_0xcb16('0x1'));var jsonpatch=require(_0xcb16('0x2'));var rp=require(_0xcb16('0x3'));var moment=require(_0xcb16('0x4'));var BPromise=require(_0xcb16('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcb16('0x6'));var csv=require(_0xcb16('0x7'));var ejs=require(_0xcb16('0x8'));var fs=require('fs');var fs_extra=require(_0xcb16('0x9'));var _=require(_0xcb16('0xa'));var squel=require(_0xcb16('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb16('0xc'));var deskjs=require(_0xcb16('0xd'));var toCsv=require(_0xcb16('0x7'));var querystring=require(_0xcb16('0xe'));var Papa=require(_0xcb16('0xf'));var Redis=require(_0xcb16('0x10'));var authService=require(_0xcb16('0x11'));var qs=require(_0xcb16('0x12'));var as=require(_0xcb16('0x13'));var hardwareService=require(_0xcb16('0x14'));var logger=require(_0xcb16('0x15'))(_0xcb16('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcb16('0x17'));var db=require(_0xcb16('0x18'))['db'];function respondWithStatusCode(_0x16cdf9,_0xd41901){_0xd41901=_0xd41901||0xcc;return function(_0x1dbbdd){if(_0x1dbbdd){return _0x16cdf9[_0xcb16('0x19')](_0xd41901);}return _0x16cdf9[_0xcb16('0x1a')](_0xd41901)[_0xcb16('0x1b')]();};}function respondWithResult(_0x52e402,_0x3594f2){_0x3594f2=_0x3594f2||0xc8;return function(_0x22d97d){if(_0x22d97d){return _0x52e402[_0xcb16('0x1a')](_0x3594f2)[_0xcb16('0x1c')](_0x22d97d);}};}function respondWithFilteredResult(_0x4c42b3,_0x3b162b){return function(_0x2d51d9){if(_0x2d51d9){var _0x2ca312=typeof _0x3b162b[_0xcb16('0x1d')]===_0xcb16('0x1e')&&typeof _0x3b162b['limit']==='undefined';var _0x52ec97=_0x2d51d9[_0xcb16('0x1f')];var _0x20e063=_0x2ca312?0x0:_0x3b162b[_0xcb16('0x1d')];var _0x36871=_0x2ca312?_0x2d51d9['count']:_0x3b162b['offset']+_0x3b162b[_0xcb16('0x20')];var _0x16e818;if(_0x36871>=_0x52ec97){_0x36871=_0x52ec97;_0x16e818=0xc8;}else{_0x16e818=0xce;}_0x4c42b3[_0xcb16('0x1a')](_0x16e818);return _0x4c42b3[_0xcb16('0x21')]('Content-Range',_0x20e063+'-'+_0x36871+'/'+_0x52ec97)[_0xcb16('0x1c')](_0x2d51d9);}return null;};}function patchUpdates(_0x212afe){return function(_0x2b16b3){try{jsonpatch['apply'](_0x2b16b3,_0x212afe,!![]);}catch(_0x5132fe){return BPromise[_0xcb16('0x22')](_0x5132fe);}return _0x2b16b3[_0xcb16('0x23')]();};}function saveUpdates(_0x165619,_0x1875c8){return function(_0x2aef00){if(_0x2aef00){return _0x2aef00[_0xcb16('0x24')](_0x165619)[_0xcb16('0x25')](function(_0x2d22e2){return _0x2d22e2;});}return null;};}function removeEntity(_0x4748d6,_0x9eac60){return function(_0x13cdc0){if(_0x13cdc0){return _0x13cdc0[_0xcb16('0x26')]()[_0xcb16('0x25')](function(){_0x4748d6['status'](0xcc)[_0xcb16('0x1b')]();});}};}function handleEntityNotFound(_0x37a02c,_0x392c2b){return function(_0x4da3c6){if(!_0x4da3c6){_0x37a02c[_0xcb16('0x19')](0x194);}return _0x4da3c6;};}function handleError(_0x16f279,_0x4ef8f0){_0x4ef8f0=_0x4ef8f0||0x1f4;return function(_0x3bce1c){logger[_0xcb16('0x27')](_0x3bce1c[_0xcb16('0x28')]);if(_0x3bce1c['name']){delete _0x3bce1c[_0xcb16('0x29')];}_0x16f279[_0xcb16('0x1a')](_0x4ef8f0)[_0xcb16('0x2a')](_0x3bce1c);};}exports[_0xcb16('0x2b')]=function(_0x4c0b47,_0x5a9d6a){var _0x14e472={},_0x1c394e={},_0x16e4c2={'count':0x0,'rows':[]};var _0x5173fe=_[_0xcb16('0x2c')](db[_0xcb16('0x2d')][_0xcb16('0x2e')],function(_0x538153){return{'name':_0x538153[_0xcb16('0x2f')],'type':_0x538153['type'][_0xcb16('0x30')]};});_0x1c394e[_0xcb16('0x31')]=_[_0xcb16('0x2c')](_0x5173fe,'name');_0x1c394e[_0xcb16('0x32')]=_[_0xcb16('0x33')](_0x4c0b47[_0xcb16('0x32')]);_0x1c394e[_0xcb16('0x34')]=_[_0xcb16('0x35')](_0x1c394e[_0xcb16('0x31')],_0x1c394e[_0xcb16('0x32')]);_0x14e472[_0xcb16('0x36')]=_[_0xcb16('0x35')](_0x1c394e['model'],qs[_0xcb16('0x37')](_0x4c0b47[_0xcb16('0x32')][_0xcb16('0x37')]));_0x14e472[_0xcb16('0x36')]=_0x14e472[_0xcb16('0x36')][_0xcb16('0x38')]?_0x14e472[_0xcb16('0x36')]:_0x1c394e[_0xcb16('0x31')];if(!_0x4c0b47[_0xcb16('0x32')]['hasOwnProperty']('nolimit')){_0x14e472[_0xcb16('0x20')]=qs[_0xcb16('0x20')](_0x4c0b47[_0xcb16('0x32')][_0xcb16('0x20')]);_0x14e472['offset']=qs['offset'](_0x4c0b47[_0xcb16('0x32')]['offset']);}_0x14e472['order']=qs[_0xcb16('0x39')](_0x4c0b47[_0xcb16('0x32')][_0xcb16('0x39')]);_0x14e472[_0xcb16('0x3a')]=qs[_0xcb16('0x34')](_[_0xcb16('0x3b')](_0x4c0b47[_0xcb16('0x32')],_0x1c394e['filters']),_0x5173fe);if(_0x4c0b47[_0xcb16('0x32')]['filter']){_0x14e472['where']=_[_0xcb16('0x3c')](_0x14e472[_0xcb16('0x3a')],{'$or':_[_0xcb16('0x2c')](_0x5173fe,function(_0x4244da){if(_0x4244da[_0xcb16('0x3d')]!==_0xcb16('0x3e')){var _0x54943e={};_0x54943e[_0x4244da['name']]={'$like':'%'+_0x4c0b47['query'][_0xcb16('0x3f')]+'%'};return _0x54943e;}})});}_0x14e472=_[_0xcb16('0x3c')]({},_0x14e472,_0x4c0b47['options']);var _0x118e46={'where':_0x14e472[_0xcb16('0x3a')]};return db['SquareDetailsReport'][_0xcb16('0x1f')](_0x118e46)[_0xcb16('0x25')](function(_0x523b9e){_0x16e4c2[_0xcb16('0x1f')]=_0x523b9e;if(_0x4c0b47[_0xcb16('0x32')][_0xcb16('0x40')]){_0x14e472['include']=[{'all':!![]}];}return db[_0xcb16('0x2d')]['findAll'](_0x14e472);})[_0xcb16('0x25')](function(_0x236b52){_0x16e4c2[_0xcb16('0x41')]=_0x236b52;return _0x16e4c2;})['then'](respondWithFilteredResult(_0x5a9d6a,_0x14e472))['catch'](handleError(_0x5a9d6a,null));};exports[_0xcb16('0x42')]=function(_0x4e747d,_0x458bdf){var _0x43a82a={'raw':!![],'where':{'id':_0x4e747d[_0xcb16('0x43')]['id']}},_0x10c3f3={};_0x10c3f3[_0xcb16('0x31')]=_['keys'](db[_0xcb16('0x2d')][_0xcb16('0x2e')]);_0x10c3f3['query']=_[_0xcb16('0x33')](_0x4e747d['query']);_0x10c3f3[_0xcb16('0x34')]=_['intersection'](_0x10c3f3[_0xcb16('0x31')],_0x10c3f3['query']);_0x43a82a[_0xcb16('0x36')]=_['intersection'](_0x10c3f3[_0xcb16('0x31')],qs[_0xcb16('0x37')](_0x4e747d['query'][_0xcb16('0x37')]));_0x43a82a[_0xcb16('0x36')]=_0x43a82a['attributes'][_0xcb16('0x38')]?_0x43a82a['attributes']:_0x10c3f3[_0xcb16('0x31')];if(_0x4e747d[_0xcb16('0x32')][_0xcb16('0x40')]){_0x43a82a['include']=[{'all':!![]}];}_0x43a82a=_['merge']({},_0x43a82a,_0x4e747d['options']);return db['SquareDetailsReport'][_0xcb16('0x44')](_0x43a82a)[_0xcb16('0x25')](handleEntityNotFound(_0x458bdf,null))[_0xcb16('0x25')](respondWithResult(_0x458bdf,null))['catch'](handleError(_0x458bdf,null));};exports[_0xcb16('0x45')]=function(_0x2b307a,_0x2b8356){return db['SquareDetailsReport'][_0xcb16('0x45')](_0x2b307a[_0xcb16('0x46')],{})[_0xcb16('0x25')](respondWithResult(_0x2b8356,0xc9))[_0xcb16('0x47')](handleError(_0x2b8356,null));};exports[_0xcb16('0x24')]=function(_0x1428d9,_0x4f58b5){if(_0x1428d9[_0xcb16('0x46')]['id']){delete _0x1428d9[_0xcb16('0x46')]['id'];}return db[_0xcb16('0x2d')]['find']({'where':{'id':_0x1428d9[_0xcb16('0x43')]['id']}})[_0xcb16('0x25')](handleEntityNotFound(_0x4f58b5,null))['then'](saveUpdates(_0x1428d9['body'],null))[_0xcb16('0x25')](respondWithResult(_0x4f58b5,null))[_0xcb16('0x47')](handleError(_0x4f58b5,null));};exports[_0xcb16('0x26')]=function(_0x5bd57b,_0x21c141){return db[_0xcb16('0x2d')]['find']({'where':{'id':_0x5bd57b[_0xcb16('0x43')]['id']}})[_0xcb16('0x25')](handleEntityNotFound(_0x21c141,null))[_0xcb16('0x25')](removeEntity(_0x21c141,null))['catch'](handleError(_0x21c141,null));};exports[_0xcb16('0x48')]=function(_0x3b35da,_0xb96030){return db[_0xcb16('0x2d')][_0xcb16('0x48')]()['then'](respondWithResult(_0xb96030,null))[_0xcb16('0x47')](handleError(_0xb96030,null));}; \ No newline at end of file +var _0x05ec=['reject','save','update','then','destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x11d62e,_0x5b093f){var _0x22b971=function(_0xeba872){while(--_0xeba872){_0x11d62e['push'](_0x11d62e['shift']());}};_0x22b971(++_0x5b093f);}(_0x05ec,0x107));var _0xc05e=function(_0x134527,_0x45f6cc){_0x134527=_0x134527-0x0;var _0x2ee10d=_0x05ec[_0x134527];return _0x2ee10d;};'use strict';var emlformat=require(_0xc05e('0x0'));var rimraf=require(_0xc05e('0x1'));var zipdir=require(_0xc05e('0x2'));var jsonpatch=require(_0xc05e('0x3'));var rp=require('request-promise');var moment=require(_0xc05e('0x4'));var BPromise=require(_0xc05e('0x5'));var Mustache=require(_0xc05e('0x6'));var util=require('util');var path=require(_0xc05e('0x7'));var sox=require(_0xc05e('0x8'));var csv=require(_0xc05e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc05e('0xa'));var _=require(_0xc05e('0xb'));var squel=require(_0xc05e('0xc'));var crypto=require(_0xc05e('0xd'));var jsforce=require(_0xc05e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc05e('0x9'));var querystring=require(_0xc05e('0xf'));var Papa=require('papaparse');var Redis=require(_0xc05e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc05e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc05e('0x12'));var utils=require(_0xc05e('0x13'));var config=require(_0xc05e('0x14'));var licenseUtil=require(_0xc05e('0x15'));var db=require(_0xc05e('0x16'))['db'];function respondWithStatusCode(_0x2489f8,_0x2f1cce){_0x2f1cce=_0x2f1cce||0xcc;return function(_0x5e1449){if(_0x5e1449){return _0x2489f8[_0xc05e('0x17')](_0x2f1cce);}return _0x2489f8[_0xc05e('0x18')](_0x2f1cce)[_0xc05e('0x19')]();};}function respondWithResult(_0x39e8c8,_0x5e92ac){_0x5e92ac=_0x5e92ac||0xc8;return function(_0xaad51e){if(_0xaad51e){return _0x39e8c8[_0xc05e('0x18')](_0x5e92ac)[_0xc05e('0x1a')](_0xaad51e);}};}function respondWithFilteredResult(_0x20274,_0x10d2eb){return function(_0x312061){if(_0x312061){var _0x58cbc3=typeof _0x10d2eb[_0xc05e('0x1b')]===_0xc05e('0x1c')&&typeof _0x10d2eb[_0xc05e('0x1d')]===_0xc05e('0x1c');var _0x19e09d=_0x312061['count'];var _0x496847=_0x58cbc3?0x0:_0x10d2eb[_0xc05e('0x1b')];var _0xb9a696=_0x58cbc3?_0x312061[_0xc05e('0x1e')]:_0x10d2eb[_0xc05e('0x1b')]+_0x10d2eb['limit'];var _0x371c13;if(_0xb9a696>=_0x19e09d){_0xb9a696=_0x19e09d;_0x371c13=0xc8;}else{_0x371c13=0xce;}_0x20274[_0xc05e('0x18')](_0x371c13);return _0x20274[_0xc05e('0x1f')]('Content-Range',_0x496847+'-'+_0xb9a696+'/'+_0x19e09d)['json'](_0x312061);}return null;};}function patchUpdates(_0x5cc25f){return function(_0x1ade80){try{jsonpatch[_0xc05e('0x20')](_0x1ade80,_0x5cc25f,!![]);}catch(_0xde3b1){return BPromise[_0xc05e('0x21')](_0xde3b1);}return _0x1ade80[_0xc05e('0x22')]();};}function saveUpdates(_0x561579,_0xedab56){return function(_0x2fd3dc){if(_0x2fd3dc){return _0x2fd3dc[_0xc05e('0x23')](_0x561579)[_0xc05e('0x24')](function(_0x44ed01){return _0x44ed01;});}return null;};}function removeEntity(_0x146264,_0x542b50){return function(_0x173ac0){if(_0x173ac0){return _0x173ac0[_0xc05e('0x25')]()[_0xc05e('0x24')](function(){_0x146264[_0xc05e('0x18')](0xcc)[_0xc05e('0x19')]();});}};}function handleEntityNotFound(_0x146d34,_0x5940aa){return function(_0x305373){if(!_0x305373){_0x146d34[_0xc05e('0x17')](0x194);}return _0x305373;};}function handleError(_0x475394,_0x2b0285){_0x2b0285=_0x2b0285||0x1f4;return function(_0x4f5bcf){logger[_0xc05e('0x26')](_0x4f5bcf['stack']);if(_0x4f5bcf[_0xc05e('0x27')]){delete _0x4f5bcf[_0xc05e('0x27')];}_0x475394['status'](_0x2b0285)[_0xc05e('0x28')](_0x4f5bcf);};}exports[_0xc05e('0x29')]=function(_0x308670,_0x2f4afd){var _0x3a1801={},_0x296dcb={},_0x47f64d={'count':0x0,'rows':[]};var _0x3cf0a6=_[_0xc05e('0x2a')](db[_0xc05e('0x2b')][_0xc05e('0x2c')],function(_0x548a63){return{'name':_0x548a63[_0xc05e('0x2d')],'type':_0x548a63[_0xc05e('0x2e')]['key']};});_0x296dcb[_0xc05e('0x2f')]=_[_0xc05e('0x2a')](_0x3cf0a6,_0xc05e('0x27'));_0x296dcb[_0xc05e('0x30')]=_['keys'](_0x308670[_0xc05e('0x30')]);_0x296dcb[_0xc05e('0x31')]=_['intersection'](_0x296dcb['model'],_0x296dcb[_0xc05e('0x30')]);_0x3a1801[_0xc05e('0x32')]=_[_0xc05e('0x33')](_0x296dcb[_0xc05e('0x2f')],qs[_0xc05e('0x34')](_0x308670[_0xc05e('0x30')][_0xc05e('0x34')]));_0x3a1801[_0xc05e('0x32')]=_0x3a1801[_0xc05e('0x32')]['length']?_0x3a1801['attributes']:_0x296dcb[_0xc05e('0x2f')];if(!_0x308670[_0xc05e('0x30')][_0xc05e('0x35')](_0xc05e('0x36'))){_0x3a1801[_0xc05e('0x1d')]=qs['limit'](_0x308670['query'][_0xc05e('0x1d')]);_0x3a1801[_0xc05e('0x1b')]=qs[_0xc05e('0x1b')](_0x308670[_0xc05e('0x30')][_0xc05e('0x1b')]);}_0x3a1801['order']=qs[_0xc05e('0x37')](_0x308670[_0xc05e('0x30')][_0xc05e('0x37')]);_0x3a1801['where']=qs[_0xc05e('0x31')](_[_0xc05e('0x38')](_0x308670[_0xc05e('0x30')],_0x296dcb['filters']),_0x3cf0a6);if(_0x308670[_0xc05e('0x30')][_0xc05e('0x39')]){_0x3a1801[_0xc05e('0x3a')]=_[_0xc05e('0x3b')](_0x3a1801[_0xc05e('0x3a')],{'$or':_['map'](_0x3cf0a6,function(_0x43cd69){if(_0x43cd69[_0xc05e('0x2e')]!==_0xc05e('0x3c')){var _0x22d927={};_0x22d927[_0x43cd69[_0xc05e('0x27')]]={'$like':'%'+_0x308670[_0xc05e('0x30')][_0xc05e('0x39')]+'%'};return _0x22d927;}})});}_0x3a1801=_[_0xc05e('0x3b')]({},_0x3a1801,_0x308670[_0xc05e('0x3d')]);var _0x5c5604={'where':_0x3a1801[_0xc05e('0x3a')]};return db['SquareDetailsReport'][_0xc05e('0x1e')](_0x5c5604)['then'](function(_0x20e955){_0x47f64d[_0xc05e('0x1e')]=_0x20e955;if(_0x308670[_0xc05e('0x30')][_0xc05e('0x3e')]){_0x3a1801[_0xc05e('0x3f')]=[{'all':!![]}];}return db[_0xc05e('0x2b')][_0xc05e('0x40')](_0x3a1801);})[_0xc05e('0x24')](function(_0x4bcc12){_0x47f64d['rows']=_0x4bcc12;return _0x47f64d;})[_0xc05e('0x24')](respondWithFilteredResult(_0x2f4afd,_0x3a1801))[_0xc05e('0x41')](handleError(_0x2f4afd,null));};exports[_0xc05e('0x42')]=function(_0xbabb80,_0x4f4f99){var _0x1addb8={'raw':!![],'where':{'id':_0xbabb80[_0xc05e('0x43')]['id']}},_0x36ba30={};_0x36ba30['model']=_['keys'](db[_0xc05e('0x2b')][_0xc05e('0x2c')]);_0x36ba30[_0xc05e('0x30')]=_[_0xc05e('0x44')](_0xbabb80[_0xc05e('0x30')]);_0x36ba30[_0xc05e('0x31')]=_['intersection'](_0x36ba30[_0xc05e('0x2f')],_0x36ba30['query']);_0x1addb8['attributes']=_[_0xc05e('0x33')](_0x36ba30[_0xc05e('0x2f')],qs['fields'](_0xbabb80[_0xc05e('0x30')]['fields']));_0x1addb8[_0xc05e('0x32')]=_0x1addb8['attributes'][_0xc05e('0x45')]?_0x1addb8[_0xc05e('0x32')]:_0x36ba30[_0xc05e('0x2f')];if(_0xbabb80[_0xc05e('0x30')][_0xc05e('0x3e')]){_0x1addb8[_0xc05e('0x3f')]=[{'all':!![]}];}_0x1addb8=_[_0xc05e('0x3b')]({},_0x1addb8,_0xbabb80[_0xc05e('0x3d')]);return db[_0xc05e('0x2b')][_0xc05e('0x46')](_0x1addb8)[_0xc05e('0x24')](handleEntityNotFound(_0x4f4f99,null))[_0xc05e('0x24')](respondWithResult(_0x4f4f99,null))['catch'](handleError(_0x4f4f99,null));};exports[_0xc05e('0x47')]=function(_0x54ca34,_0x10a51c){return db['SquareDetailsReport'][_0xc05e('0x47')](_0x54ca34[_0xc05e('0x48')],{})[_0xc05e('0x24')](respondWithResult(_0x10a51c,0xc9))[_0xc05e('0x41')](handleError(_0x10a51c,null));};exports[_0xc05e('0x23')]=function(_0x36b506,_0x1da9a0){if(_0x36b506[_0xc05e('0x48')]['id']){delete _0x36b506[_0xc05e('0x48')]['id'];}return db[_0xc05e('0x2b')][_0xc05e('0x46')]({'where':{'id':_0x36b506[_0xc05e('0x43')]['id']}})[_0xc05e('0x24')](handleEntityNotFound(_0x1da9a0,null))[_0xc05e('0x24')](saveUpdates(_0x36b506['body'],null))[_0xc05e('0x24')](respondWithResult(_0x1da9a0,null))[_0xc05e('0x41')](handleError(_0x1da9a0,null));};exports['destroy']=function(_0x44c8c4,_0x2bb85b){return db[_0xc05e('0x2b')][_0xc05e('0x46')]({'where':{'id':_0x44c8c4[_0xc05e('0x43')]['id']}})[_0xc05e('0x24')](handleEntityNotFound(_0x2bb85b,null))[_0xc05e('0x24')](removeEntity(_0x2bb85b,null))[_0xc05e('0x41')](handleError(_0x2bb85b,null));};exports[_0xc05e('0x49')]=function(_0x4346d4,_0x11643e){return db[_0xc05e('0x2b')][_0xc05e('0x49')]()[_0xc05e('0x24')](respondWithResult(_0x11643e,null))[_0xc05e('0x41')](handleError(_0x11643e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 391b4bb..41e8871 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 _0x9e29=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','../../config/logger','api'];(function(_0x3e33cf,_0xd5b878){var _0x3c8b1a=function(_0x2059f7){while(--_0x2059f7){_0x3e33cf['push'](_0x3e33cf['shift']());}};_0x3c8b1a(++_0xd5b878);}(_0x9e29,0xca));var _0x99e2=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x9e29[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x99e2('0x0'))(_0x99e2('0x1'));var moment=require(_0x99e2('0x2'));var BPromise=require(_0x99e2('0x3'));var rp=require(_0x99e2('0x4'));var fs=require('fs');var path=require(_0x99e2('0x5'));var rimraf=require(_0x99e2('0x6'));var config=require(_0x99e2('0x7'));var attributes=require(_0x99e2('0x8'));module['exports']=function(_0x39555c,_0x25424d){return _0x39555c[_0x99e2('0x9')](_0x99e2('0xa'),attributes,{'tableName':_0x99e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a7a=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash'];(function(_0xaea4ca,_0x462707){var _0x4e00c3=function(_0x45229d){while(--_0x45229d){_0xaea4ca['push'](_0xaea4ca['shift']());}};_0x4e00c3(++_0x462707);}(_0x8a7a,0x6b));var _0xa8a7=function(_0x405ebb,_0x548660){_0x405ebb=_0x405ebb-0x0;var _0xd89ca9=_0x8a7a[_0x405ebb];return _0xd89ca9;};'use strict';var _=require(_0xa8a7('0x0'));var util=require('util');var logger=require(_0xa8a7('0x1'))(_0xa8a7('0x2'));var moment=require('moment');var BPromise=require(_0xa8a7('0x3'));var rp=require(_0xa8a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8a7('0x5'));var config=require(_0xa8a7('0x6'));var attributes=require(_0xa8a7('0x7'));module[_0xa8a7('0x8')]=function(_0x256bce,_0x3ebb7d){return _0x256bce[_0xa8a7('0x9')](_0xa8a7('0xa'),attributes,{'tableName':_0xa8a7('0xb'),'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 1d7eec6..bdb52a9 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 _0x9861=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','lodash','bluebird','randomstring','ioredis'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x9861,0x176));var _0x1986=function(_0x1fc186,_0x38da58){_0x1fc186=_0x1fc186-0x0;var _0x537609=_0x9861[_0x1fc186];return _0x537609;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1986('0x1'));var rs=require(_0x1986('0x2'));var fs=require('fs');var Redis=require(_0x1986('0x3'));var db=require(_0x1986('0x4'))['db'];var utils=require(_0x1986('0x5'));var logger=require(_0x1986('0x6'))('rpc');var config=require(_0x1986('0x7'));var jayson=require(_0x1986('0x8'));var client=jayson[_0x1986('0x9')][_0x1986('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40a16f,_0xc5e066,_0x412444){return new BPromise(function(_0x4150da,_0x2bd40f){return client[_0x1986('0xb')](_0x40a16f,_0x412444)['then'](function(_0x14f7b4){logger[_0x1986('0xc')](_0x1986('0xd'),_0xc5e066,_0x1986('0xe'));logger['debug'](_0x1986('0xf'),_0xc5e066,_0x1986('0xe'),JSON['stringify'](_0x14f7b4));if(_0x14f7b4[_0x1986('0x10')]){if(_0x14f7b4['error']['code']===0x1f4){logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);return _0x2bd40f(_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);}logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);return _0x4150da(_0x14f7b4['error']['message']);}else{logger[_0x1986('0xc')](_0x1986('0xd'),_0xc5e066,'request\x20sent');_0x4150da(_0x14f7b4[_0x1986('0x12')][_0x1986('0x11')]);}})[_0x1986('0x13')](function(_0x462f14){logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x462f14);_0x2bd40f(_0x462f14);});});}exports[_0x1986('0x14')]=function(_0x15f7b9){var _0x3b2715=this;return new Promise(function(_0x7dec68,_0x257ab1){return db[_0x1986('0x15')][_0x1986('0x16')](_0x15f7b9[_0x1986('0x17')],{'raw':_0x15f7b9['options']?_0x15f7b9[_0x1986('0x18')][_0x1986('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3ab28e){logger[_0x1986('0xc')]('CreateSquareDetailsReport',_0x15f7b9);logger['debug'](_0x1986('0x14'),_0x15f7b9,JSON[_0x1986('0x1a')](_0x3ab28e));_0x7dec68(_0x3ab28e);})[_0x1986('0x13')](function(_0x530aa1){logger[_0x1986('0x10')](_0x1986('0x14'),_0x530aa1[_0x1986('0x11')],_0x15f7b9);_0x257ab1(_0x3b2715['error'](0x1f4,_0x530aa1[_0x1986('0x11')]));});});}; \ No newline at end of file +var _0x02a7=['http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x02a7,0x1a6));var _0x702a=function(_0x1a9c7a,_0x226faf){_0x1a9c7a=_0x1a9c7a-0x0;var _0x1e1740=_0x02a7[_0x1a9c7a];return _0x1e1740;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});}exports[_0x702a('0x16')]=function(_0x340dc2){var _0x2071ad=this;return new Promise(function(_0x3d1550,_0x1885eb){return db['SquareDetailsReport'][_0x702a('0x17')](_0x340dc2[_0x702a('0x18')],{'raw':_0x340dc2[_0x702a('0x19')]?_0x340dc2[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b2998){logger['info'](_0x702a('0x16'),_0x340dc2);logger['debug'](_0x702a('0x16'),_0x340dc2,JSON[_0x702a('0xf')](_0x5b2998));_0x3d1550(_0x5b2998);})['catch'](function(_0x2ca064){logger[_0x702a('0x10')](_0x702a('0x16'),_0x2ca064[_0x702a('0x13')],_0x340dc2);_0x1885eb(_0x2071ad[_0x702a('0x10')](0x1f4,_0x2ca064['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 354dc23..a977d20 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 _0x94cd=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x3bb7eb,_0x3a5798){var _0xd9584=function(_0x223ea5){while(--_0x223ea5){_0x3bb7eb['push'](_0x3bb7eb['shift']());}};_0xd9584(++_0x3a5798);}(_0x94cd,0x7f));var _0xd94c=function(_0x36652c,_0x7e1a6c){_0x36652c=_0x36652c-0x0;var _0x3418f1=_0x94cd[_0x36652c];return _0x3418f1;};'use strict';var express=require(_0xd94c('0x0'));var router=express[_0xd94c('0x1')]();var auth=require(_0xd94c('0x2'));var controller=require(_0xd94c('0x3'));router[_0xd94c('0x4')]('/',auth['isAuthenticated'](),controller[_0xd94c('0x5')]);router[_0xd94c('0x4')](_0xd94c('0x6'),auth[_0xd94c('0x7')](),controller[_0xd94c('0x8')]);module[_0xd94c('0x9')]=router; \ No newline at end of file +var _0xc048=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x24488b,_0x29b82f){var _0x5dad24=function(_0x59a846){while(--_0x59a846){_0x24488b['push'](_0x24488b['shift']());}};_0x5dad24(++_0x29b82f);}(_0xc048,0xde));var _0x8c04=function(_0xcdb11f,_0x29298f){_0xcdb11f=_0xcdb11f-0x0;var _0x4133bd=_0xc048[_0xcdb11f];return _0x4133bd;};'use strict';var express=require(_0x8c04('0x0'));var router=express[_0x8c04('0x1')]();var auth=require(_0x8c04('0x2'));var controller=require(_0x8c04('0x3'));router[_0x8c04('0x4')]('/',auth[_0x8c04('0x5')](),controller[_0x8c04('0x6')]);router['get'](_0x8c04('0x7'),auth[_0x8c04('0x5')](),controller[_0x8c04('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b1d8a58..6b6483f 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 _0x5fb2=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x4fe77d,_0xaad1f1){var _0x296a48=function(_0x444659){while(--_0x444659){_0x4fe77d['push'](_0x4fe77d['shift']());}};_0x296a48(++_0xaad1f1);}(_0x5fb2,0x68));var _0x25fb=function(_0x324f7d,_0x3a0184){_0x324f7d=_0x324f7d-0x0;var _0x158d1e=_0x5fb2[_0x324f7d];return _0x158d1e;};'use strict';var info=require(_0x25fb('0x0'));var exec=require(_0x25fb('0x1'))[_0x25fb('0x2')];var logger=require(_0x25fb('0x3'))(_0x25fb('0x4'));var util=require(_0x25fb('0x5'));var BPromise=require(_0x25fb('0x6'));var _=require(_0x25fb('0x7'));function handleError(_0x2fdc76,_0x59685e,_0x5ab7ab){_0x59685e=_0x59685e||0x1f4;return function(_0x2ac34a){logger[_0x25fb('0x8')](_0x25fb('0x9'),_0x5ab7ab,_0x59685e,util[_0x25fb('0xa')](_0x2ac34a,{'showHidden':![],'depth':null}));delete _0x2ac34a[_0x25fb('0xb')];_0x2fdc76[_0x25fb('0xc')](_0x59685e)[_0x25fb('0xd')](_0x2ac34a);};}exports[_0x25fb('0xe')]=function(_0x5c52a4,_0x3f94e3){return info[_0x25fb('0xf')]()[_0x25fb('0x10')](function(_0x5a4c51){return _0x3f94e3['status'](0xc8)[_0x25fb('0x11')](_0x5a4c51);})[_0x25fb('0x12')](function(_0x414d65){return _0x3f94e3[_0x25fb('0xc')](0x1f4)[_0x25fb('0x11')](_0x414d65);});};exports[_0x25fb('0x13')]=function(_0x7e4efe,_0x3aae5f){var _0x30a6ce=[_0x25fb('0x14')];return new BPromise(function(_0x727c27,_0x13466d){return exec(util[_0x25fb('0x15')](_0x25fb('0x16'),_0x7e4efe[_0x25fb('0x17')][_0x25fb('0x18')]),function(_0x2a5a35,_0x34b93d,_0x19e50a){if(_0x2a5a35){return _0x13466d(_0x2a5a35);}return _0x727c27(_0x34b93d);});})[_0x25fb('0x10')](function(_0x222446){var _0x312ccc=![];var _0x26b729=_0x222446[_0x25fb('0x19')](/\n/);for(var _0x4bb1f8=0x0,_0x3dcc9f=_0x30a6ce[_0x25fb('0x1a')];_0x4bb1f8<_0x3dcc9f,_0x312ccc===![];_0x4bb1f8+=0x1){if(_0x222446[_0x25fb('0x1b')](_0x30a6ce[_0x4bb1f8])>=0x0){_0x312ccc=!![];}}if(!_0x312ccc){throw new Error(util[_0x25fb('0x15')](_0x25fb('0x1c'),_0x7e4efe[_0x25fb('0x17')][_0x25fb('0x18')]));}process[_0x25fb('0x1d')](_0x7e4efe[_0x25fb('0x17')]['pid'],_0x25fb('0x1e'));return _0x3aae5f[_0x25fb('0xc')](0xc8)[_0x25fb('0x11')]({'message':util[_0x25fb('0x15')](_0x25fb('0x1f'),_0x7e4efe[_0x25fb('0x17')][_0x25fb('0x18')])});})[_0x25fb('0x12')](handleError(_0x3aae5f,null,'killProcess'));}; \ No newline at end of file +var _0x1f14=['indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','bluebird','lodash','inspect','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split'];(function(_0x4329f4,_0x172436){var _0x26f3d0=function(_0x6f282f){while(--_0x6f282f){_0x4329f4['push'](_0x4329f4['shift']());}};_0x26f3d0(++_0x172436);}(_0x1f14,0x148));var _0x41f1=function(_0x43eb9d,_0x300a6e){_0x43eb9d=_0x43eb9d-0x0;var _0x4a170b=_0x1f14[_0x43eb9d];return _0x4a170b;};'use strict';var info=require(_0x41f1('0x0'));var exec=require(_0x41f1('0x1'))['exec'];var logger=require(_0x41f1('0x2'))(_0x41f1('0x3'));var util=require('util');var BPromise=require(_0x41f1('0x4'));var _=require(_0x41f1('0x5'));function handleError(_0x50b47d,_0x494753,_0x4b3e8a){_0x494753=_0x494753||0x1f4;return function(_0x750122){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4b3e8a,_0x494753,util[_0x41f1('0x6')](_0x750122,{'showHidden':![],'depth':null}));delete _0x750122[_0x41f1('0x7')];_0x50b47d[_0x41f1('0x8')](_0x494753)[_0x41f1('0x9')](_0x750122);};}exports[_0x41f1('0xa')]=function(_0x2a3596,_0x2aec47){return info[_0x41f1('0xb')]()['then'](function(_0x87bab5){return _0x2aec47['status'](0xc8)[_0x41f1('0xc')](_0x87bab5);})[_0x41f1('0xd')](function(_0x735625){return _0x2aec47[_0x41f1('0x8')](0x1f4)[_0x41f1('0xc')](_0x735625);});};exports[_0x41f1('0xe')]=function(_0x248483,_0x96cfce){var _0x35bcb7=[_0x41f1('0xf')];return new BPromise(function(_0x421dfa,_0x1d63ba){return exec(util[_0x41f1('0x10')](_0x41f1('0x11'),_0x248483[_0x41f1('0x12')][_0x41f1('0x13')]),function(_0x374b30,_0x498e12,_0x27d786){if(_0x374b30){return _0x1d63ba(_0x374b30);}return _0x421dfa(_0x498e12);});})[_0x41f1('0x14')](function(_0x2a7658){var _0x5e331a=![];var _0x3a51e4=_0x2a7658[_0x41f1('0x15')](/\n/);for(var _0x592ca4=0x0,_0xebdd70=_0x35bcb7['length'];_0x592ca4<_0xebdd70,_0x5e331a===![];_0x592ca4+=0x1){if(_0x2a7658[_0x41f1('0x16')](_0x35bcb7[_0x592ca4])>=0x0){_0x5e331a=!![];}}if(!_0x5e331a){throw new Error(util[_0x41f1('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x248483[_0x41f1('0x12')][_0x41f1('0x13')]));}process['kill'](_0x248483[_0x41f1('0x12')][_0x41f1('0x13')],_0x41f1('0x17'));return _0x96cfce['status'](0xc8)['json']({'message':util[_0x41f1('0x10')](_0x41f1('0x18'),_0x248483[_0x41f1('0x12')][_0x41f1('0x13')])});})[_0x41f1('0xd')](handleError(_0x96cfce,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e8f82e4..1ae0b06 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 _0x7779=['/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x4ad142,_0x594af2){var _0x1841db=function(_0xacc001){while(--_0xacc001){_0x4ad142['push'](_0x4ad142['shift']());}};_0x1841db(++_0x594af2);}(_0x7779,0x102));var _0x9777=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0x7779[_0x4bcbc2];return _0xe5b888;};'use strict';var multer=require('multer');var util=require(_0x9777('0x0'));var path=require('path');var timeout=require(_0x9777('0x1'));var express=require(_0x9777('0x2'));var router=express[_0x9777('0x3')]();var fs_extra=require(_0x9777('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9777('0x5'));var config=require(_0x9777('0x6'));var controller=require('./tag.controller');router[_0x9777('0x7')]('/',auth[_0x9777('0x8')](),controller[_0x9777('0x9')]);router[_0x9777('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9777('0xa')]);router[_0x9777('0xb')]('/',auth[_0x9777('0x8')](),controller[_0x9777('0xc')]);router[_0x9777('0xd')](_0x9777('0xe'),auth[_0x9777('0x8')](),controller['update']);router['delete'](_0x9777('0xe'),auth[_0x9777('0x8')](),controller[_0x9777('0xf')]);module[_0x9777('0x10')]=router; \ No newline at end of file +var _0xdaaf=['fs-extra','../../components/auth/service','isAuthenticated','index','/:id','show','post','create','update','delete','util','path','connect-timeout','Router'];(function(_0x3dca36,_0x35e97f){var _0x16aa05=function(_0x483e70){while(--_0x483e70){_0x3dca36['push'](_0x3dca36['shift']());}};_0x16aa05(++_0x35e97f);}(_0xdaaf,0x130));var _0xfdaa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdaaf[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xfdaa('0x0'));var path=require(_0xfdaa('0x1'));var timeout=require(_0xfdaa('0x2'));var express=require('express');var router=express[_0xfdaa('0x3')]();var fs_extra=require(_0xfdaa('0x4'));var auth=require(_0xfdaa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x7')]);router['get'](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x9')]);router[_0xfdaa('0xa')]('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xb')]);router['put']('/:id',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xc')]);router[_0xfdaa('0xd')](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller['destroy']);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 da448e6..46ced95 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 _0x7cdc=['#0091EA','exports','STRING'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x7cdc,0x190));var _0xc7cd=function(_0x336394,_0x39a1e1){_0x336394=_0x336394-0x0;var _0x478477=_0x7cdc[_0x336394];return _0x478477;};'use strict';var Sequelize=require('sequelize');module[_0xc7cd('0x0')]={'name':{'type':Sequelize[_0xc7cd('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc7cd('0x1')],'defaultValue':_0xc7cd('0x2')},'description':{'type':Sequelize[_0xc7cd('0x1')]}}; \ No newline at end of file +var _0x9a2a=['exports','STRING','sequelize'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0x9a2a[_0x5f2fea];return _0x198a0c;};'use strict';var Sequelize=require(_0xa9a2('0x0'));module[_0xa9a2('0x1')]={'name':{'type':Sequelize[_0xa9a2('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa9a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 81a3b86..6954228 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 _0xa0bc=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','sendStatus','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2d9f26,_0x10e8dd){var _0x5c7562=function(_0xc15ae9){while(--_0xc15ae9){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x5c7562(++_0x10e8dd);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];function respondWithStatusCode(_0x3a2e25,_0x22ca9d){_0x22ca9d=_0x22ca9d||0xcc;return function(_0x2ce366){if(_0x2ce366){return _0x3a2e25['sendStatus'](_0x22ca9d);}return _0x3a2e25[_0xca0b('0x1c')](_0x22ca9d)[_0xca0b('0x1d')]();};}function respondWithResult(_0x358972,_0x5da205){_0x5da205=_0x5da205||0xc8;return function(_0x106ed6){if(_0x106ed6){return _0x358972[_0xca0b('0x1c')](_0x5da205)[_0xca0b('0x1e')](_0x106ed6);}};}function respondWithFilteredResult(_0x2beba9,_0x42b68e){return function(_0x404c6d){if(_0x404c6d){var _0x4d7620=typeof _0x42b68e[_0xca0b('0x1f')]===_0xca0b('0x20')&&typeof _0x42b68e['limit']===_0xca0b('0x20');var _0x5db810=_0x404c6d[_0xca0b('0x21')];var _0x5050b7=_0x4d7620?0x0:_0x42b68e[_0xca0b('0x1f')];var _0x32eff7=_0x4d7620?_0x404c6d[_0xca0b('0x21')]:_0x42b68e['offset']+_0x42b68e[_0xca0b('0x22')];var _0x2c0c53;if(_0x32eff7>=_0x5db810){_0x32eff7=_0x5db810;_0x2c0c53=0xc8;}else{_0x2c0c53=0xce;}_0x2beba9['status'](_0x2c0c53);return _0x2beba9[_0xca0b('0x23')](_0xca0b('0x24'),_0x5050b7+'-'+_0x32eff7+'/'+_0x5db810)[_0xca0b('0x1e')](_0x404c6d);}return null;};}function patchUpdates(_0x59bda9){return function(_0x865393){try{jsonpatch[_0xca0b('0x25')](_0x865393,_0x59bda9,!![]);}catch(_0x484e26){return BPromise[_0xca0b('0x26')](_0x484e26);}return _0x865393[_0xca0b('0x27')]();};}function saveUpdates(_0x2ae93b,_0x49e695){return function(_0x119589){if(_0x119589){return _0x119589[_0xca0b('0x28')](_0x2ae93b)[_0xca0b('0x29')](function(_0x504d91){return _0x504d91;});}return null;};}function removeEntity(_0x54fb03,_0x11f5c3){return function(_0x428459){if(_0x428459){return _0x428459[_0xca0b('0x2a')]()[_0xca0b('0x29')](function(){var _0x3ae1dc=_0x428459['get']({'plain':!![]});var _0xe122e8=_0xca0b('0x2b');return db[_0xca0b('0x2c')][_0xca0b('0x2a')]({'where':{'type':_0xe122e8,'resourceId':_0x3ae1dc['id']}})[_0xca0b('0x29')](function(){return _0x428459;});})['then'](function(){_0x54fb03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a6fd,_0xa71d57){return function(_0x3fd832){if(!_0x3fd832){_0x44a6fd[_0xca0b('0x2d')](0x194);}return _0x3fd832;};}function handleError(_0xe7673b,_0x515f83){_0x515f83=_0x515f83||0x1f4;return function(_0x23af62){logger[_0xca0b('0x2e')](_0x23af62[_0xca0b('0x2f')]);if(_0x23af62[_0xca0b('0x30')]){delete _0x23af62[_0xca0b('0x30')];}_0xe7673b[_0xca0b('0x1c')](_0x515f83)[_0xca0b('0x31')](_0x23af62);};}exports['index']=function(_0x6016f6,_0x17a365){var _0x3b72b2={},_0x26f168={},_0x5a8c2f={'count':0x0,'rows':[]};var _0x43cf1a=_[_0xca0b('0x32')](db[_0xca0b('0x33')][_0xca0b('0x34')],function(_0x3beea0){return{'name':_0x3beea0[_0xca0b('0x35')],'type':_0x3beea0[_0xca0b('0x36')][_0xca0b('0x37')]};});_0x26f168[_0xca0b('0x38')]=_[_0xca0b('0x32')](_0x43cf1a,_0xca0b('0x30'));_0x26f168[_0xca0b('0x39')]=_[_0xca0b('0x3a')](_0x6016f6[_0xca0b('0x39')]);_0x26f168[_0xca0b('0x3b')]=_['intersection'](_0x26f168[_0xca0b('0x38')],_0x26f168[_0xca0b('0x39')]);_0x3b72b2[_0xca0b('0x3c')]=_[_0xca0b('0x3d')](_0x26f168['model'],qs[_0xca0b('0x3e')](_0x6016f6[_0xca0b('0x39')]['fields']));_0x3b72b2[_0xca0b('0x3c')]=_0x3b72b2[_0xca0b('0x3c')][_0xca0b('0x3f')]?_0x3b72b2[_0xca0b('0x3c')]:_0x26f168[_0xca0b('0x38')];if(!_0x6016f6[_0xca0b('0x39')][_0xca0b('0x40')](_0xca0b('0x41'))){_0x3b72b2['limit']=qs['limit'](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x22')]);_0x3b72b2[_0xca0b('0x1f')]=qs[_0xca0b('0x1f')](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x1f')]);}_0x3b72b2[_0xca0b('0x42')]=qs[_0xca0b('0x43')](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x43')]);_0x3b72b2[_0xca0b('0x44')]=qs[_0xca0b('0x3b')](_[_0xca0b('0x45')](_0x6016f6[_0xca0b('0x39')],_0x26f168[_0xca0b('0x3b')]),_0x43cf1a);if(_0x6016f6[_0xca0b('0x39')][_0xca0b('0x46')]){_0x3b72b2[_0xca0b('0x44')]=_[_0xca0b('0x47')](_0x3b72b2[_0xca0b('0x44')],{'$or':_[_0xca0b('0x32')](_0x43cf1a,function(_0x25a5a1){if(_0x25a5a1[_0xca0b('0x36')]!==_0xca0b('0x48')){var _0x90dc6c={};_0x90dc6c[_0x25a5a1['name']]={'$like':'%'+_0x6016f6['query'][_0xca0b('0x46')]+'%'};return _0x90dc6c;}})});}_0x3b72b2=_[_0xca0b('0x47')]({},_0x3b72b2,_0x6016f6['options']);var _0x54890e={'where':_0x3b72b2['where']};return db[_0xca0b('0x33')][_0xca0b('0x21')](_0x54890e)[_0xca0b('0x29')](function(_0xf9e175){_0x5a8c2f[_0xca0b('0x21')]=_0xf9e175;if(_0x6016f6['query']['includeAll']){_0x3b72b2[_0xca0b('0x49')]=[{'all':!![]}];}return db['Tag'][_0xca0b('0x4a')](_0x3b72b2);})['then'](function(_0x57bab3){_0x5a8c2f['rows']=_0x57bab3;return _0x5a8c2f;})[_0xca0b('0x29')](respondWithFilteredResult(_0x17a365,_0x3b72b2))[_0xca0b('0x4b')](handleError(_0x17a365,null));};exports[_0xca0b('0x4c')]=function(_0x3448ab,_0x19f760){var _0xcc9be0={'raw':!![],'where':{'id':_0x3448ab[_0xca0b('0x4d')]['id']}},_0x54bcb7={};_0x54bcb7[_0xca0b('0x38')]=_[_0xca0b('0x3a')](db[_0xca0b('0x33')][_0xca0b('0x34')]);_0x54bcb7['query']=_['keys'](_0x3448ab[_0xca0b('0x39')]);_0x54bcb7[_0xca0b('0x3b')]=_[_0xca0b('0x3d')](_0x54bcb7[_0xca0b('0x38')],_0x54bcb7['query']);_0xcc9be0[_0xca0b('0x3c')]=_[_0xca0b('0x3d')](_0x54bcb7[_0xca0b('0x38')],qs[_0xca0b('0x3e')](_0x3448ab['query']['fields']));_0xcc9be0[_0xca0b('0x3c')]=_0xcc9be0[_0xca0b('0x3c')][_0xca0b('0x3f')]?_0xcc9be0['attributes']:_0x54bcb7[_0xca0b('0x38')];if(_0x3448ab[_0xca0b('0x39')]['includeAll']){_0xcc9be0['include']=[{'all':!![]}];}_0xcc9be0=_['merge']({},_0xcc9be0,_0x3448ab[_0xca0b('0x4e')]);return db[_0xca0b('0x33')][_0xca0b('0x4f')](_0xcc9be0)['then'](handleEntityNotFound(_0x19f760,null))['then'](respondWithResult(_0x19f760,null))[_0xca0b('0x4b')](handleError(_0x19f760,null));};exports[_0xca0b('0x50')]=function(_0x250288,_0x174e81){return db[_0xca0b('0x33')][_0xca0b('0x50')](_0x250288['body'],{})['then'](function(_0x499b43){var _0x456ea1=_0x250288[_0xca0b('0x51')]['get']({'plain':!![]});if(!_0x456ea1)throw new Error(_0xca0b('0x52'));if(_0x456ea1[_0xca0b('0x53')]===_0xca0b('0x51')){var _0x535cce=_0x499b43[_0xca0b('0x54')]({'plain':!![]});var _0x5a3734=_0xca0b('0x2b');return db[_0xca0b('0x55')][_0xca0b('0x4f')]({'where':{'name':_0x5a3734,'userProfileId':_0x456ea1[_0xca0b('0x56')]},'raw':!![]})[_0xca0b('0x29')](function(_0x1d569e){if(_0x1d569e&&_0x1d569e[_0xca0b('0x57')]===0x0){return db[_0xca0b('0x2c')][_0xca0b('0x50')]({'name':_0x535cce[_0xca0b('0x30')],'resourceId':_0x535cce['id'],'type':_0x1d569e[_0xca0b('0x30')],'sectionId':_0x1d569e['id']},{})[_0xca0b('0x29')](function(){return _0x499b43;});}else{return _0x499b43;}})[_0xca0b('0x4b')](function(_0x21d2d5){logger[_0xca0b('0x2e')](_0xca0b('0x58'),_0x21d2d5);throw _0x21d2d5;});}return _0x499b43;})[_0xca0b('0x29')](respondWithResult(_0x174e81,0xc9))[_0xca0b('0x4b')](handleError(_0x174e81,null));};exports['update']=function(_0x27fdbd,_0xbef02e){if(_0x27fdbd['body']['id']){delete _0x27fdbd[_0xca0b('0x59')]['id'];}return db[_0xca0b('0x33')][_0xca0b('0x4f')]({'where':{'id':_0x27fdbd[_0xca0b('0x4d')]['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0xbef02e,null))[_0xca0b('0x29')](saveUpdates(_0x27fdbd[_0xca0b('0x59')],null))[_0xca0b('0x29')](respondWithResult(_0xbef02e,null))['catch'](handleError(_0xbef02e,null));};exports[_0xca0b('0x2a')]=function(_0x36feaa,_0x416fd5){return db[_0xca0b('0x33')]['find']({'where':{'id':_0x36feaa['params']['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x416fd5,null))[_0xca0b('0x29')](removeEntity(_0x416fd5,null))['catch'](handleError(_0x416fd5,null));}; \ No newline at end of file +var _0x7794=['stack','name','send','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error'];(function(_0x285e86,_0x183485){var _0x2fe1ca=function(_0x5b646d){while(--_0x5b646d){_0x285e86['push'](_0x285e86['shift']());}};_0x2fe1ca(++_0x183485);}(_0x7794,0x7b));var _0x4779=function(_0x2b5f49,_0x3570be){_0x2b5f49=_0x2b5f49-0x0;var _0xc6e7ff=_0x7794[_0x2b5f49];return _0xc6e7ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4779('0x0'));var zipdir=require(_0x4779('0x1'));var jsonpatch=require(_0x4779('0x2'));var rp=require(_0x4779('0x3'));var moment=require('moment');var BPromise=require(_0x4779('0x4'));var Mustache=require(_0x4779('0x5'));var util=require('util');var path=require(_0x4779('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4779('0x7'));var _=require(_0x4779('0x8'));var squel=require('squel');var crypto=require(_0x4779('0x9'));var jsforce=require(_0x4779('0xa'));var deskjs=require(_0x4779('0xb'));var toCsv=require(_0x4779('0xc'));var querystring=require(_0x4779('0xd'));var Papa=require(_0x4779('0xe'));var Redis=require(_0x4779('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4779('0x10'));var as=require(_0x4779('0x11'));var hardwareService=require(_0x4779('0x12'));var logger=require(_0x4779('0x13'))(_0x4779('0x14'));var utils=require(_0x4779('0x15'));var config=require(_0x4779('0x16'));var licenseUtil=require(_0x4779('0x17'));var db=require(_0x4779('0x18'))['db'];function respondWithStatusCode(_0x13c989,_0x50e17e){_0x50e17e=_0x50e17e||0xcc;return function(_0x5b1219){if(_0x5b1219){return _0x13c989['sendStatus'](_0x50e17e);}return _0x13c989[_0x4779('0x19')](_0x50e17e)[_0x4779('0x1a')]();};}function respondWithResult(_0xb9a06f,_0xddf5cd){_0xddf5cd=_0xddf5cd||0xc8;return function(_0x4fe370){if(_0x4fe370){return _0xb9a06f[_0x4779('0x19')](_0xddf5cd)[_0x4779('0x1b')](_0x4fe370);}};}function respondWithFilteredResult(_0x4d71a0,_0x599deb){return function(_0x1dbbe1){if(_0x1dbbe1){var _0x2de2be=typeof _0x599deb[_0x4779('0x1c')]===_0x4779('0x1d')&&typeof _0x599deb['limit']==='undefined';var _0x445e0b=_0x1dbbe1[_0x4779('0x1e')];var _0x19fbb6=_0x2de2be?0x0:_0x599deb['offset'];var _0x3dbe70=_0x2de2be?_0x1dbbe1['count']:_0x599deb[_0x4779('0x1c')]+_0x599deb[_0x4779('0x1f')];var _0x478fa5;if(_0x3dbe70>=_0x445e0b){_0x3dbe70=_0x445e0b;_0x478fa5=0xc8;}else{_0x478fa5=0xce;}_0x4d71a0[_0x4779('0x19')](_0x478fa5);return _0x4d71a0['set'](_0x4779('0x20'),_0x19fbb6+'-'+_0x3dbe70+'/'+_0x445e0b)[_0x4779('0x1b')](_0x1dbbe1);}return null;};}function patchUpdates(_0x143ef6){return function(_0x298e25){try{jsonpatch[_0x4779('0x21')](_0x298e25,_0x143ef6,!![]);}catch(_0x1ce270){return BPromise['reject'](_0x1ce270);}return _0x298e25[_0x4779('0x22')]();};}function saveUpdates(_0x4f2158,_0x4ad246){return function(_0xd983f0){if(_0xd983f0){return _0xd983f0[_0x4779('0x23')](_0x4f2158)[_0x4779('0x24')](function(_0x2b7ab6){return _0x2b7ab6;});}return null;};}function removeEntity(_0x555cd6,_0x152887){return function(_0x29a39a){if(_0x29a39a){return _0x29a39a[_0x4779('0x25')]()['then'](function(){var _0x340648=_0x29a39a[_0x4779('0x26')]({'plain':!![]});var _0x577b13=_0x4779('0x27');return db[_0x4779('0x28')]['destroy']({'where':{'type':_0x577b13,'resourceId':_0x340648['id']}})[_0x4779('0x24')](function(){return _0x29a39a;});})[_0x4779('0x24')](function(){_0x555cd6[_0x4779('0x19')](0xcc)[_0x4779('0x1a')]();});}};}function handleEntityNotFound(_0x2634c2,_0x254562){return function(_0xeb1850){if(!_0xeb1850){_0x2634c2[_0x4779('0x29')](0x194);}return _0xeb1850;};}function handleError(_0x4b9066,_0x44c162){_0x44c162=_0x44c162||0x1f4;return function(_0x1607a5){logger[_0x4779('0x2a')](_0x1607a5[_0x4779('0x2b')]);if(_0x1607a5[_0x4779('0x2c')]){delete _0x1607a5[_0x4779('0x2c')];}_0x4b9066[_0x4779('0x19')](_0x44c162)[_0x4779('0x2d')](_0x1607a5);};}exports['index']=function(_0x5b1b36,_0x179717){var _0x986bed={},_0xc7e4d1={},_0x15da6d={'count':0x0,'rows':[]};var _0x335d48=_['map'](db[_0x4779('0x2e')][_0x4779('0x2f')],function(_0x1fa222){return{'name':_0x1fa222[_0x4779('0x30')],'type':_0x1fa222['type']['key']};});_0xc7e4d1[_0x4779('0x31')]=_['map'](_0x335d48,_0x4779('0x2c'));_0xc7e4d1[_0x4779('0x32')]=_[_0x4779('0x33')](_0x5b1b36[_0x4779('0x32')]);_0xc7e4d1[_0x4779('0x34')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],_0xc7e4d1[_0x4779('0x32')]);_0x986bed[_0x4779('0x36')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],qs[_0x4779('0x37')](_0x5b1b36['query']['fields']));_0x986bed[_0x4779('0x36')]=_0x986bed['attributes'][_0x4779('0x38')]?_0x986bed['attributes']:_0xc7e4d1[_0x4779('0x31')];if(!_0x5b1b36[_0x4779('0x32')][_0x4779('0x39')](_0x4779('0x3a'))){_0x986bed[_0x4779('0x1f')]=qs['limit'](_0x5b1b36['query'][_0x4779('0x1f')]);_0x986bed[_0x4779('0x1c')]=qs[_0x4779('0x1c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x1c')]);}_0x986bed[_0x4779('0x3b')]=qs[_0x4779('0x3c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x3c')]);_0x986bed[_0x4779('0x3d')]=qs[_0x4779('0x34')](_[_0x4779('0x3e')](_0x5b1b36[_0x4779('0x32')],_0xc7e4d1[_0x4779('0x34')]),_0x335d48);if(_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]){_0x986bed[_0x4779('0x3d')]=_[_0x4779('0x40')](_0x986bed[_0x4779('0x3d')],{'$or':_['map'](_0x335d48,function(_0xa48aa1){if(_0xa48aa1['type']!==_0x4779('0x41')){var _0x1cc7da={};_0x1cc7da[_0xa48aa1[_0x4779('0x2c')]]={'$like':'%'+_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]+'%'};return _0x1cc7da;}})});}_0x986bed=_[_0x4779('0x40')]({},_0x986bed,_0x5b1b36['options']);var _0x2ab9c3={'where':_0x986bed['where']};return db[_0x4779('0x2e')][_0x4779('0x1e')](_0x2ab9c3)[_0x4779('0x24')](function(_0x3a3589){_0x15da6d[_0x4779('0x1e')]=_0x3a3589;if(_0x5b1b36[_0x4779('0x32')]['includeAll']){_0x986bed[_0x4779('0x42')]=[{'all':!![]}];}return db['Tag'][_0x4779('0x43')](_0x986bed);})[_0x4779('0x24')](function(_0x2e60ab){_0x15da6d['rows']=_0x2e60ab;return _0x15da6d;})[_0x4779('0x24')](respondWithFilteredResult(_0x179717,_0x986bed))[_0x4779('0x44')](handleError(_0x179717,null));};exports[_0x4779('0x45')]=function(_0x15520d,_0xbc5a86){var _0x3b0bfd={'raw':!![],'where':{'id':_0x15520d[_0x4779('0x46')]['id']}},_0x13f768={};_0x13f768[_0x4779('0x31')]=_[_0x4779('0x33')](db[_0x4779('0x2e')][_0x4779('0x2f')]);_0x13f768[_0x4779('0x32')]=_[_0x4779('0x33')](_0x15520d[_0x4779('0x32')]);_0x13f768['filters']=_['intersection'](_0x13f768[_0x4779('0x31')],_0x13f768[_0x4779('0x32')]);_0x3b0bfd[_0x4779('0x36')]=_[_0x4779('0x35')](_0x13f768[_0x4779('0x31')],qs[_0x4779('0x37')](_0x15520d[_0x4779('0x32')][_0x4779('0x37')]));_0x3b0bfd['attributes']=_0x3b0bfd[_0x4779('0x36')][_0x4779('0x38')]?_0x3b0bfd[_0x4779('0x36')]:_0x13f768[_0x4779('0x31')];if(_0x15520d[_0x4779('0x32')][_0x4779('0x47')]){_0x3b0bfd['include']=[{'all':!![]}];}_0x3b0bfd=_[_0x4779('0x40')]({},_0x3b0bfd,_0x15520d[_0x4779('0x48')]);return db[_0x4779('0x2e')][_0x4779('0x49')](_0x3b0bfd)[_0x4779('0x24')](handleEntityNotFound(_0xbc5a86,null))['then'](respondWithResult(_0xbc5a86,null))[_0x4779('0x44')](handleError(_0xbc5a86,null));};exports[_0x4779('0x4a')]=function(_0x3873d4,_0x4a1040){return db[_0x4779('0x2e')]['create'](_0x3873d4[_0x4779('0x4b')],{})[_0x4779('0x24')](function(_0x397216){var _0x4f0aaf=_0x3873d4[_0x4779('0x4c')]['get']({'plain':!![]});if(!_0x4f0aaf)throw new Error(_0x4779('0x4d'));if(_0x4f0aaf[_0x4779('0x4e')]===_0x4779('0x4c')){var _0x58e14e=_0x397216['get']({'plain':!![]});var _0x5dc79a=_0x4779('0x27');return db[_0x4779('0x4f')]['find']({'where':{'name':_0x5dc79a,'userProfileId':_0x4f0aaf[_0x4779('0x50')]},'raw':!![]})[_0x4779('0x24')](function(_0x3c7493){if(_0x3c7493&&_0x3c7493[_0x4779('0x51')]===0x0){return db[_0x4779('0x28')]['create']({'name':_0x58e14e[_0x4779('0x2c')],'resourceId':_0x58e14e['id'],'type':_0x3c7493[_0x4779('0x2c')],'sectionId':_0x3c7493['id']},{})[_0x4779('0x24')](function(){return _0x397216;});}else{return _0x397216;}})[_0x4779('0x44')](function(_0x15c180){logger[_0x4779('0x2a')](_0x4779('0x52'),_0x15c180);throw _0x15c180;});}return _0x397216;})[_0x4779('0x24')](respondWithResult(_0x4a1040,0xc9))['catch'](handleError(_0x4a1040,null));};exports['update']=function(_0x1e4bff,_0x34e951){if(_0x1e4bff[_0x4779('0x4b')]['id']){delete _0x1e4bff[_0x4779('0x4b')]['id'];}return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x1e4bff[_0x4779('0x46')]['id']}})['then'](handleEntityNotFound(_0x34e951,null))[_0x4779('0x24')](saveUpdates(_0x1e4bff[_0x4779('0x4b')],null))[_0x4779('0x24')](respondWithResult(_0x34e951,null))['catch'](handleError(_0x34e951,null));};exports['destroy']=function(_0x225734,_0xe836e0){return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x225734[_0x4779('0x46')]['id']}})[_0x4779('0x24')](handleEntityNotFound(_0xe836e0,null))[_0x4779('0x24')](removeEntity(_0xe836e0,null))[_0x4779('0x44')](handleError(_0xe836e0,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 609f72e..daa1179 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 _0x3643=['moment','bluebird','request-promise','../../config/environment','exports','define','Tag','lodash','api'];(function(_0x4973b0,_0x5529ca){var _0x1f68fc=function(_0x29595f){while(--_0x29595f){_0x4973b0['push'](_0x4973b0['shift']());}};_0x1f68fc(++_0x5529ca);}(_0x3643,0xa9));var _0x3364=function(_0x4b749d,_0x322313){_0x4b749d=_0x4b749d-0x0;var _0x424a1a=_0x3643[_0x4b749d];return _0x424a1a;};'use strict';var _=require(_0x3364('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3364('0x1'));var moment=require(_0x3364('0x2'));var BPromise=require(_0x3364('0x3'));var rp=require(_0x3364('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3364('0x5'));var attributes=require('./tag.attributes');module[_0x3364('0x6')]=function(_0x439a3c,_0x5bbfb3){return _0x439a3c[_0x3364('0x7')](_0x3364('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f0=['./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37bb99,_0x2d9e01){var _0x16e07d=function(_0x430802){while(--_0x430802){_0x37bb99['push'](_0x37bb99['shift']());}};_0x16e07d(++_0x2d9e01);}(_0x35f0,0xb9));var _0x035f=function(_0x1ec9cb,_0xccade7){_0x1ec9cb=_0x1ec9cb-0x0;var _0x379582=_0x35f0[_0x1ec9cb];return _0x379582;};'use strict';var _=require(_0x035f('0x0'));var util=require(_0x035f('0x1'));var logger=require(_0x035f('0x2'))(_0x035f('0x3'));var moment=require(_0x035f('0x4'));var BPromise=require(_0x035f('0x5'));var rp=require(_0x035f('0x6'));var fs=require('fs');var path=require(_0x035f('0x7'));var rimraf=require(_0x035f('0x8'));var config=require(_0x035f('0x9'));var attributes=require(_0x035f('0xa'));module['exports']=function(_0x100527,_0x479ef0){return _0x100527['define'](_0x035f('0xb'),attributes,{'tableName':_0x035f('0xc'),'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 4db8129..dc6785a 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 _0xb6b1=['catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','info','result'];(function(_0x178f4f,_0x18bcd2){var _0x12dbac=function(_0x2b1587){while(--_0x2b1587){_0x178f4f['push'](_0x178f4f['shift']());}};_0x12dbac(++_0x18bcd2);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xb6b1[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Tag,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});} \ No newline at end of file +var _0x919e=['client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x547125,_0x423554){var _0x5ac7ad=function(_0x2b001c){while(--_0x2b001c){_0x547125['push'](_0x547125['shift']());}};_0x5ac7ad(++_0x423554);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493b47,_0x7c1fa4,_0x2ceb41){return new BPromise(function(_0x57c3fe,_0x44d418){return client['request'](_0x493b47,_0x2ceb41)[_0xe919('0xb')](function(_0x22ea65){logger[_0xe919('0xc')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0xe919('0xd'));logger[_0xe919('0xe')](_0xe919('0xf'),_0x7c1fa4,'request\x20sent',JSON[_0xe919('0x10')](_0x22ea65));if(_0x22ea65['error']){if(_0x22ea65['error']['code']===0x1f4){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x22ea65[_0xe919('0x11')]['message']);return _0x44d418(_0x22ea65['error'][_0xe919('0x13')]);}logger[_0xe919('0x11')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);return _0x57c3fe(_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);}else{logger[_0xe919('0xc')](_0xe919('0x12'),_0x7c1fa4,_0xe919('0xd'));_0x57c3fe(_0x22ea65['result'][_0xe919('0x13')]);}})['catch'](function(_0x5ba7ad){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x5ba7ad);_0x44d418(_0x5ba7ad);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 49e2991..7bf878a 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 e01731f..d463be3 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 _0x2032=['name','exports','STRING'];(function(_0x13de65,_0x3f6bbf){var _0x3f30c1=function(_0x17429d){while(--_0x17429d){_0x13de65['push'](_0x13de65['shift']());}};_0x3f30c1(++_0x3f6bbf);}(_0x2032,0xd9));var _0x2203=function(_0x2ef19b,_0x2ddea7){_0x2ef19b=_0x2ef19b-0x0;var _0x596aa3=_0x2032[_0x2ef19b];return _0x596aa3;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x142ba8,_0x2c3265){var _0x4dc848=function(_0x331a51){while(--_0x331a51){_0x142ba8['push'](_0x142ba8['shift']());}};_0x4dc848(++_0x2c3265);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ff3e74a..95c060c 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 _0xbb5d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SmsQueueId','UserSmsQueue','ChatQueueId','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','Queue','addQueues','Unknown\x20channel','add','toLowerCase','Queues','ids','remove','addAgents','isArray','Voice','Sms','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','findAll','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','removeAgents','Mail','Fax','Queue:remove','getAgents','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','error','stack','send','index','map','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Team','count','include','catch','show','params','rawAttributes','keys','length','includeAll','find','create','body','user','get'];(function(_0x3e68c3,_0x1b99c8){var _0xd2f2a=function(_0x57882a){while(--_0x57882a){_0x3e68c3['push'](_0x3e68c3['shift']());}};_0xd2f2a(++_0x1b99c8);}(_0xbb5d,0x16b));var _0xdbb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb5d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbb5('0x0'));var zipdir=require(_0xdbb5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbb5('0x2'));var moment=require(_0xdbb5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdbb5('0x4'));var util=require(_0xdbb5('0x5'));var path=require('path');var sox=require(_0xdbb5('0x6'));var csv=require(_0xdbb5('0x7'));var ejs=require(_0xdbb5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdbb5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdbb5('0xa'));var toCsv=require('to-csv');var querystring=require(_0xdbb5('0xb'));var Papa=require(_0xdbb5('0xc'));var Redis=require(_0xdbb5('0xd'));var authService=require(_0xdbb5('0xe'));var qs=require(_0xdbb5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdbb5('0x10'));var config=require(_0xdbb5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbb5('0x12'))['db'];config[_0xdbb5('0x13')]=_[_0xdbb5('0x14')](config['redis'],{'host':_0xdbb5('0x15'),'port':0x18eb});var socket=require(_0xdbb5('0x16'))(new Redis(config[_0xdbb5('0x13')]));require(_0xdbb5('0x17'))[_0xdbb5('0x18')](socket);function respondWithStatusCode(_0x1c4f9b,_0x1052c1){_0x1052c1=_0x1052c1||0xcc;return function(_0xf5d0da){if(_0xf5d0da){return _0x1c4f9b[_0xdbb5('0x19')](_0x1052c1);}return _0x1c4f9b[_0xdbb5('0x1a')](_0x1052c1)[_0xdbb5('0x1b')]();};}function respondWithResult(_0x124ff7,_0x3fa14f){_0x3fa14f=_0x3fa14f||0xc8;return function(_0x3795d7){if(_0x3795d7){return _0x124ff7['status'](_0x3fa14f)[_0xdbb5('0x1c')](_0x3795d7);}};}function respondWithFilteredResult(_0x575685,_0x5e7b0a){return function(_0x5f42c4){if(_0x5f42c4){var _0x150bdc=typeof _0x5e7b0a[_0xdbb5('0x1d')]===_0xdbb5('0x1e')&&typeof _0x5e7b0a[_0xdbb5('0x1f')]===_0xdbb5('0x1e');var _0x1ca258=_0x5f42c4['count'];var _0x25af07=_0x150bdc?0x0:_0x5e7b0a[_0xdbb5('0x1d')];var _0x4dbb77=_0x150bdc?_0x5f42c4['count']:_0x5e7b0a[_0xdbb5('0x1d')]+_0x5e7b0a[_0xdbb5('0x1f')];var _0x1aabf1;if(_0x4dbb77>=_0x1ca258){_0x4dbb77=_0x1ca258;_0x1aabf1=0xc8;}else{_0x1aabf1=0xce;}_0x575685[_0xdbb5('0x1a')](_0x1aabf1);return _0x575685[_0xdbb5('0x20')]('Content-Range',_0x25af07+'-'+_0x4dbb77+'/'+_0x1ca258)['json'](_0x5f42c4);}return null;};}function patchUpdates(_0x12d6b3){return function(_0x15b2bb){try{jsonpatch[_0xdbb5('0x21')](_0x15b2bb,_0x12d6b3,!![]);}catch(_0x3a2750){return BPromise[_0xdbb5('0x22')](_0x3a2750);}return _0x15b2bb['save']();};}function saveUpdates(_0x4a6f52,_0x2828f9){return function(_0x1449fe){if(_0x1449fe){return _0x1449fe[_0xdbb5('0x23')](_0x4a6f52)[_0xdbb5('0x24')](function(_0x447d44){return _0x447d44;});}return null;};}function handleEntityNotFound(_0x181cff,_0x418581){return function(_0x32c5bb){if(!_0x32c5bb){_0x181cff[_0xdbb5('0x19')](0x194);}return _0x32c5bb;};}function handleError(_0x485d80,_0x563f9a){_0x563f9a=_0x563f9a||0x1f4;return function(_0x29b879){logger[_0xdbb5('0x25')](_0x29b879[_0xdbb5('0x26')]);if(_0x29b879['name']){delete _0x29b879['name'];}_0x485d80[_0xdbb5('0x1a')](_0x563f9a)[_0xdbb5('0x27')](_0x29b879);};}exports[_0xdbb5('0x28')]=function(_0x2b320c,_0x36ca36){var _0x1a9915={},_0x17a561={},_0x2fb8ae={'count':0x0,'rows':[]};var _0x430af3=_[_0xdbb5('0x29')](db['Team']['rawAttributes'],function(_0x282028){return{'name':_0x282028['fieldName'],'type':_0x282028[_0xdbb5('0x2a')][_0xdbb5('0x2b')]};});_0x17a561[_0xdbb5('0x2c')]=_['map'](_0x430af3,_0xdbb5('0x2d'));_0x17a561[_0xdbb5('0x2e')]=_['keys'](_0x2b320c[_0xdbb5('0x2e')]);_0x17a561[_0xdbb5('0x2f')]=_[_0xdbb5('0x30')](_0x17a561['model'],_0x17a561[_0xdbb5('0x2e')]);_0x1a9915[_0xdbb5('0x31')]=_[_0xdbb5('0x30')](_0x17a561[_0xdbb5('0x2c')],qs[_0xdbb5('0x32')](_0x2b320c['query'][_0xdbb5('0x32')]));_0x1a9915[_0xdbb5('0x31')]=_0x1a9915[_0xdbb5('0x31')]['length']?_0x1a9915[_0xdbb5('0x31')]:_0x17a561[_0xdbb5('0x2c')];if(!_0x2b320c[_0xdbb5('0x2e')][_0xdbb5('0x33')](_0xdbb5('0x34'))){_0x1a9915['limit']=qs[_0xdbb5('0x1f')](_0x2b320c[_0xdbb5('0x2e')][_0xdbb5('0x1f')]);_0x1a9915[_0xdbb5('0x1d')]=qs['offset'](_0x2b320c[_0xdbb5('0x2e')]['offset']);}_0x1a9915['order']=qs[_0xdbb5('0x35')](_0x2b320c['query'][_0xdbb5('0x35')]);_0x1a9915[_0xdbb5('0x36')]=qs[_0xdbb5('0x2f')](_[_0xdbb5('0x37')](_0x2b320c[_0xdbb5('0x2e')],_0x17a561[_0xdbb5('0x2f')]),_0x430af3);if(_0x2b320c[_0xdbb5('0x2e')][_0xdbb5('0x38')]){_0x1a9915[_0xdbb5('0x36')]=_[_0xdbb5('0x39')](_0x1a9915[_0xdbb5('0x36')],{'$or':_['map'](_0x430af3,function(_0x1e030e){if(_0x1e030e[_0xdbb5('0x2a')]!==_0xdbb5('0x3a')){var _0xd9564d={};_0xd9564d[_0x1e030e[_0xdbb5('0x2d')]]={'$like':'%'+_0x2b320c[_0xdbb5('0x2e')][_0xdbb5('0x38')]+'%'};return _0xd9564d;}})});}_0x1a9915=_[_0xdbb5('0x39')]({},_0x1a9915,_0x2b320c[_0xdbb5('0x3b')]);var _0x5587cc={'where':_0x1a9915[_0xdbb5('0x36')]};return db[_0xdbb5('0x3c')][_0xdbb5('0x3d')](_0x5587cc)[_0xdbb5('0x24')](function(_0x1ee716){_0x2fb8ae[_0xdbb5('0x3d')]=_0x1ee716;if(_0x2b320c[_0xdbb5('0x2e')]['includeAll']){_0x1a9915[_0xdbb5('0x3e')]=[{'all':!![]}];}return db['Team']['findAll'](_0x1a9915);})[_0xdbb5('0x24')](function(_0x84c821){_0x2fb8ae['rows']=_0x84c821;return _0x2fb8ae;})[_0xdbb5('0x24')](respondWithFilteredResult(_0x36ca36,_0x1a9915))[_0xdbb5('0x3f')](handleError(_0x36ca36,null));};exports[_0xdbb5('0x40')]=function(_0x55a677,_0x1eae59){var _0x1e753f={'raw':![],'where':{'id':_0x55a677[_0xdbb5('0x41')]['id']}},_0x3592ae={};_0x3592ae[_0xdbb5('0x2c')]=_['keys'](db['Team'][_0xdbb5('0x42')]);_0x3592ae['query']=_[_0xdbb5('0x43')](_0x55a677[_0xdbb5('0x2e')]);_0x3592ae[_0xdbb5('0x2f')]=_[_0xdbb5('0x30')](_0x3592ae[_0xdbb5('0x2c')],_0x3592ae[_0xdbb5('0x2e')]);_0x1e753f[_0xdbb5('0x31')]=_[_0xdbb5('0x30')](_0x3592ae[_0xdbb5('0x2c')],qs['fields'](_0x55a677[_0xdbb5('0x2e')][_0xdbb5('0x32')]));_0x1e753f['attributes']=_0x1e753f[_0xdbb5('0x31')][_0xdbb5('0x44')]?_0x1e753f[_0xdbb5('0x31')]:_0x3592ae[_0xdbb5('0x2c')];if(_0x55a677[_0xdbb5('0x2e')][_0xdbb5('0x45')]){_0x1e753f['include']=[{'all':!![]}];}_0x1e753f=_[_0xdbb5('0x39')]({},_0x1e753f,_0x55a677[_0xdbb5('0x3b')]);return db[_0xdbb5('0x3c')][_0xdbb5('0x46')](_0x1e753f)['then'](handleEntityNotFound(_0x1eae59,null))[_0xdbb5('0x24')](respondWithResult(_0x1eae59,null))[_0xdbb5('0x3f')](handleError(_0x1eae59,null));};exports[_0xdbb5('0x47')]=function(_0x453106,_0x34e592){return db['Team'][_0xdbb5('0x47')](_0x453106[_0xdbb5('0x48')],{})[_0xdbb5('0x24')](function(_0x1c7427){var _0x42ac18=_0x453106[_0xdbb5('0x49')][_0xdbb5('0x4a')]({'plain':!![]});if(!_0x42ac18)throw new Error(_0xdbb5('0x4b'));if(_0x42ac18['role']===_0xdbb5('0x49')){var _0x227570=_0x1c7427['get']({'plain':!![]});var _0x961556=_0xdbb5('0x4c');return db[_0xdbb5('0x4d')][_0xdbb5('0x46')]({'where':{'name':_0x961556,'userProfileId':_0x42ac18[_0xdbb5('0x4e')]},'raw':!![]})[_0xdbb5('0x24')](function(_0x1a4992){if(_0x1a4992&&_0x1a4992['autoAssociation']===0x0){return db[_0xdbb5('0x4f')][_0xdbb5('0x47')]({'name':_0x227570[_0xdbb5('0x2d')],'resourceId':_0x227570['id'],'type':_0x1a4992[_0xdbb5('0x2d')],'sectionId':_0x1a4992['id']},{})[_0xdbb5('0x24')](function(){return _0x1c7427;});}else{return _0x1c7427;}})[_0xdbb5('0x3f')](function(_0x53a233){logger[_0xdbb5('0x25')](_0xdbb5('0x50'),_0x53a233);throw _0x53a233;});}return _0x1c7427;})[_0xdbb5('0x24')](respondWithResult(_0x34e592,0xc9))[_0xdbb5('0x3f')](handleError(_0x34e592,null));};exports['update']=function(_0x513613,_0x377c33){if(_0x513613['body']['id']){delete _0x513613[_0xdbb5('0x48')]['id'];}return db[_0xdbb5('0x3c')]['find']({'where':{'id':_0x513613[_0xdbb5('0x41')]['id']}})[_0xdbb5('0x24')](handleEntityNotFound(_0x377c33,null))[_0xdbb5('0x24')](saveUpdates(_0x513613['body'],null))[_0xdbb5('0x24')](respondWithResult(_0x377c33,null))[_0xdbb5('0x3f')](handleError(_0x377c33,null));};exports[_0xdbb5('0x51')]=function(_0x709a12,_0xe40e09){var _0x3776b7=_0x709a12[_0xdbb5('0x41')]['id'];var _0xcd0ccd=[];return db[_0xdbb5('0x52')][_0xdbb5('0x53')](function(_0x25b530){var _0xef3eca=_0xdbb5('0x54')+_0x3776b7;return db[_0xdbb5('0x52')][_0xdbb5('0x2e')](_0xef3eca,{'type':db['Sequelize']['QueryTypes'][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530})['then'](function(_0x1a7a6e){_0xcd0ccd=_[_0xdbb5('0x29')](_0x1a7a6e,function(_0x2d91a7){return Number(_0x2d91a7['UserId']);});})[_0xdbb5('0x24')](function(){var _0x1b67ca=_0xdbb5('0x56')+_0x3776b7;return db[_0xdbb5('0x52')]['query'](_0x1b67ca,{'type':db['Sequelize'][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0x1435a3){var _0xae94f1=_[_0xdbb5('0x29')](_0x1435a3,function(_0x39c9a5){return Number(_0x39c9a5[_0xdbb5('0x58')]);});return db['UserVoiceQueue'][_0xdbb5('0x51')]({'where':{'UserId':{'$in':_0xcd0ccd},'VoiceQueueId':{'$in':_0xae94f1}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){var _0x20bfa5=_0xdbb5('0x59')+_0x3776b7;return db['sequelize'][_0xdbb5('0x2e')](_0x20bfa5,{'type':db['Sequelize'][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0x2bbffe){var _0x4a52f0=_[_0xdbb5('0x29')](_0x2bbffe,function(_0x1e4264){return Number(_0x1e4264[_0xdbb5('0x5a')]);});return db[_0xdbb5('0x5b')]['destroy']({'where':{'UserId':{'$in':_0xcd0ccd},'MailQueueId':{'$in':_0x4a52f0}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){var _0x4fc0cf=_0xdbb5('0x5c')+_0x3776b7;return db[_0xdbb5('0x52')][_0xdbb5('0x2e')](_0x4fc0cf,{'type':db[_0xdbb5('0x5d')][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})['then'](function(_0x3c8530){var _0x1e94bf=_[_0xdbb5('0x29')](_0x3c8530,function(_0x536efa){return Number(_0x536efa[_0xdbb5('0x5e')]);});return db[_0xdbb5('0x5f')][_0xdbb5('0x51')]({'where':{'UserId':{'$in':_0xcd0ccd},'SmsQueueId':{'$in':_0x1e94bf}},'transaction':_0x25b530});})['then'](function(){var _0x15b802='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3776b7;return db['sequelize'][_0xdbb5('0x2e')](_0x15b802,{'type':db[_0xdbb5('0x5d')][_0xdbb5('0x57')]['SELECT'],'raw':!![],'transaction':_0x25b530});})['then'](function(_0x45e069){var _0x2d19d8=_[_0xdbb5('0x29')](_0x45e069,function(_0x28a53c){return Number(_0x28a53c[_0xdbb5('0x60')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0xcd0ccd},'ChatQueueId':{'$in':_0x2d19d8}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){var _0x5620ae='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3776b7;return db['sequelize'][_0xdbb5('0x2e')](_0x5620ae,{'type':db['Sequelize'][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0x7c57b2){var _0x46a4cc=_['map'](_0x7c57b2,function(_0x25f5d9){return Number(_0x25f5d9[_0xdbb5('0x61')]);});return db[_0xdbb5('0x62')]['destroy']({'where':{'UserId':{'$in':_0xcd0ccd},'FaxQueueId':{'$in':_0x46a4cc}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){var _0x1c280f='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3776b7;return db[_0xdbb5('0x52')][_0xdbb5('0x2e')](_0x1c280f,{'type':db['Sequelize'][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0x12c36c){var _0x47bb33=_[_0xdbb5('0x29')](_0x12c36c,function(_0x6b8bde){return Number(_0x6b8bde[_0xdbb5('0x63')]);});return db[_0xdbb5('0x64')]['destroy']({'where':{'UserId':{'$in':_0xcd0ccd},'OpenchannelQueueId':{'$in':_0x47bb33}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){var _0x913c09=_0xdbb5('0x65')+_0x3776b7;return db[_0xdbb5('0x52')][_0xdbb5('0x2e')](_0x913c09,{'type':db[_0xdbb5('0x5d')][_0xdbb5('0x57')][_0xdbb5('0x55')],'raw':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0x535762){var _0x3bb4bb=_[_0xdbb5('0x29')](_0x535762,function(_0x4eb013){return Number(_0x4eb013['WhatsappQueueId']);});return db[_0xdbb5('0x66')]['destroy']({'where':{'UserId':{'$in':_0xcd0ccd},'WhatsappQueueId':{'$in':_0x3bb4bb}},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){return db[_0xdbb5('0x67')][_0xdbb5('0x46')]({'where':{'TeamId':_0x3776b7}});})['then'](function(_0x2e18d7){if(_0x2e18d7===null){return;}return db[_0xdbb5('0x68')][_0xdbb5('0x51')]({'where':{'UserId':{'$in':_0xcd0ccd},'VoicePrefixId':_0x2e18d7[_0xdbb5('0x69')]},'transaction':_0x25b530});})[_0xdbb5('0x24')](function(){return db[_0xdbb5('0x3c')][_0xdbb5('0x51')]({'where':{'id':_0x3776b7},'cascade':!![],'transaction':_0x25b530});})[_0xdbb5('0x24')](function(_0xa3a55){if(_0xa3a55===0x0){_0xe40e09[_0xdbb5('0x19')](0x194);}else{return db[_0xdbb5('0x4f')][_0xdbb5('0x51')]({'where':{'type':_0xdbb5('0x4c'),'resourceId':_0x3776b7},'cascade':!![],'transaction':_0x25b530})[_0xdbb5('0x24')](function(){_0xe40e09['status'](0xcc)[_0xdbb5('0x1b')]();});}})[_0xdbb5('0x3f')](function(_0x2ae072){_0xe40e09[_0xdbb5('0x1a')](0x1f4)['send'](_0x2ae072);});});};exports[_0xdbb5('0x6a')]=function(_0x2a075c,_0x4f17c0,_0x5d472d){return db['Team'][_0xdbb5('0x6b')]({'where':{'id':_0x2a075c[_0xdbb5('0x41')]['id']}})[_0xdbb5('0x24')](handleEntityNotFound(_0x4f17c0,null))[_0xdbb5('0x24')](function(_0x3b05de){if(!_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x6c')]||!utils[_0xdbb5('0x6d')](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x6c')])){throw new db[(_0xdbb5('0x5d'))][(_0xdbb5('0x6e'))]('Unknown\x20channel');}var _0x4d8aa6={};var _0x3744dc={};_0x3744dc[_0xdbb5('0x2c')]=_[_0xdbb5('0x43')](db[_[_0xdbb5('0x6f')](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x6c')]['toLowerCase']())+_0xdbb5('0x70')][_0xdbb5('0x42')]);_0x3744dc[_0xdbb5('0x2e')]=_['keys'](_0x2a075c['query']);_0x3744dc[_0xdbb5('0x2f')]=_[_0xdbb5('0x30')](_0x3744dc[_0xdbb5('0x2c')],_0x3744dc[_0xdbb5('0x2e')]);_0x4d8aa6[_0xdbb5('0x31')]=_[_0xdbb5('0x30')](_0x3744dc[_0xdbb5('0x2c')],qs[_0xdbb5('0x32')](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x32')]));_0x4d8aa6[_0xdbb5('0x31')]=_0x4d8aa6[_0xdbb5('0x31')][_0xdbb5('0x44')]?_0x4d8aa6[_0xdbb5('0x31')]:_0x3744dc[_0xdbb5('0x2c')];_0x4d8aa6[_0xdbb5('0x1f')]=qs['limit'](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x1f')]);_0x4d8aa6['offset']=qs[_0xdbb5('0x1d')](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x1d')]);_0x4d8aa6['order']=qs[_0xdbb5('0x35')](_0x2a075c['query']['sort']);_0x4d8aa6['where']=qs[_0xdbb5('0x2f')](_[_0xdbb5('0x37')](_0x2a075c['query'],_0x3744dc[_0xdbb5('0x2f')]));_0x4d8aa6=_[_0xdbb5('0x39')]({},_0x4d8aa6,_0x2a075c['options']);return _0x3b05de['get'+_[_0xdbb5('0x6f')](_0x2a075c[_0xdbb5('0x2e')][_0xdbb5('0x6c')]['toLowerCase']())+'Queues'](_0x4d8aa6);})[_0xdbb5('0x24')](respondWithResult(_0x4f17c0,null))['catch'](handleError(_0x4f17c0,null));};exports[_0xdbb5('0x71')]=function(_0x5c6ea5,_0x2ed04e,_0x55dce0){return db[_0xdbb5('0x3c')][_0xdbb5('0x6b')]({'where':{'id':_0x5c6ea5[_0xdbb5('0x41')]['id']}})[_0xdbb5('0x24')](function(_0x3b0624){if(_0x3b0624){if(!_0x5c6ea5['body'][_0xdbb5('0x6c')]||!utils['isValidChannel'](_0x5c6ea5[_0xdbb5('0x48')][_0xdbb5('0x6c')])){throw new db[(_0xdbb5('0x5d'))][(_0xdbb5('0x6e'))](_0xdbb5('0x72'));}return _0x3b0624[_0xdbb5('0x73')+_['capitalize'](_0x5c6ea5['body'][_0xdbb5('0x6c')][_0xdbb5('0x74')]())+_0xdbb5('0x75')](_0x5c6ea5[_0xdbb5('0x48')][_0xdbb5('0x76')]);}return null;})[_0xdbb5('0x24')](handleEntityNotFound(_0x2ed04e,null))[_0xdbb5('0x24')](respondWithStatusCode(_0x2ed04e,null))[_0xdbb5('0x3f')](handleError(_0x2ed04e,null));};exports['removeQueues']=function(_0x338b70,_0x48fabb,_0x39aaf8){return db[_0xdbb5('0x3c')][_0xdbb5('0x6b')]({'where':{'id':_0x338b70[_0xdbb5('0x41')]['id']}})[_0xdbb5('0x24')](function(_0x4685a4){if(_0x4685a4){if(!_0x338b70[_0xdbb5('0x2e')][_0xdbb5('0x6c')]||!utils[_0xdbb5('0x6d')](_0x338b70[_0xdbb5('0x2e')][_0xdbb5('0x6c')])){throw new db[(_0xdbb5('0x5d'))][(_0xdbb5('0x6e'))]('Unknown\x20channel');}return _0x4685a4[_0xdbb5('0x77')+_[_0xdbb5('0x6f')](_0x338b70['query']['channel'][_0xdbb5('0x74')]())+_0xdbb5('0x75')](_0x338b70[_0xdbb5('0x2e')][_0xdbb5('0x76')]);}return null;})[_0xdbb5('0x24')](handleEntityNotFound(_0x48fabb,null))[_0xdbb5('0x24')](respondWithStatusCode(_0x48fabb,null))[_0xdbb5('0x3f')](handleError(_0x48fabb,null));};exports[_0xdbb5('0x78')]=function(_0x5c3483,_0x49f880){var _0x384ebb=_[_0xdbb5('0x79')](_0x5c3483[_0xdbb5('0x48')][_0xdbb5('0x76')])?_0x5c3483[_0xdbb5('0x48')][_0xdbb5('0x76')]:[_0x5c3483['body'][_0xdbb5('0x76')]];var _0x1cdaa7=_0x5c3483[_0xdbb5('0x41')]['id'];return db[_0xdbb5('0x3c')]['find']({'where':{'id':_0x1cdaa7}})['then'](handleEntityNotFound(_0x49f880,null))[_0xdbb5('0x24')](function(_0x3e8c23){if(_0x3e8c23){var _0x4f07c8=[_0xdbb5('0x7a'),'Chat','Mail',_0xdbb5('0x7b'),'Fax',_0xdbb5('0x7c'),_0xdbb5('0x7d')];return db[_0xdbb5('0x52')][_0xdbb5('0x53')](function(_0x56d798){var _0x25d449=_[_0xdbb5('0x29')](_0x4f07c8,function(_0x4e459f){var _0x48b23f={'attributes':['id','name']};if(_0x4e459f==='Voice'){_0x48b23f[_0xdbb5('0x7e')]={'attributes':[_0xdbb5('0x7f')]};}return _0x3e8c23['get'+_0x4e459f+_0xdbb5('0x75')](_0x48b23f)[_0xdbb5('0x24')](function(_0x97e156){var _0x560a22=_[_0xdbb5('0x29')](_0x97e156,function(_0x15aeee){var _0x262f4d=_[_0xdbb5('0x29')](_0x384ebb,function(_0xe025a2){var _0x1b69fb={'where':{'UserId':_0xe025a2,[_0x4e459f+_0xdbb5('0x80')]:_0x15aeee['id']},'transaction':_0x56d798};if(_0x4e459f===_0xdbb5('0x7a')){_0x1b69fb[_0xdbb5('0x14')]={'penalty':_0x15aeee[_0xdbb5('0x81')][_0xdbb5('0x7f')]};}return db[_0xdbb5('0x82')+_0x4e459f+_0xdbb5('0x70')]['findOrCreate'](_0x1b69fb)[_0xdbb5('0x24')](function(){socket[_0xdbb5('0x83')](_0xdbb5('0x49')+_0x4e459f+_0xdbb5('0x84'),{'UserId':_0xe025a2,[_0x4e459f+'QueueId']:_0x15aeee['id']});if(_0x4e459f!==_0xdbb5('0x7a')){return;}return db[_0xdbb5('0x82')][_0xdbb5('0x85')]({'where':{'id':_0x384ebb,'online':0x1},'attributes':['id',_0xdbb5('0x2d'),'online','voicePause',_0xdbb5('0x86')],'raw':!![]})['then'](function(_0x3c98d0){var _0x56dbfa=_['map'](_0x3c98d0,function(_0x2c5a69){return db[_0xdbb5('0x87')][_0xdbb5('0x88')]({'membername':_0x2c5a69[_0xdbb5('0x2d')],'UserId':_0x2c5a69['id'],'queue_name':_0x15aeee['name'],'VoiceQueueId':_0x15aeee['id'],'interface':_['isNil'](_0x2c5a69[_0xdbb5('0x86')])?util[_0xdbb5('0x89')](_0xdbb5('0x8a'),_0x2c5a69[_0xdbb5('0x2d')]):_0x2c5a69[_0xdbb5('0x86')],'paused':_0x2c5a69[_0xdbb5('0x8b')]||![],'penalty':_0x15aeee[_0xdbb5('0x81')][_0xdbb5('0x7f')]},{'transaction':_0x56d798});});return Promise['all'](_0x56dbfa);});});});return Promise[_0xdbb5('0x8c')](_0x262f4d);});return Promise[_0xdbb5('0x8c')](_0x560a22);})[_0xdbb5('0x24')](function(){return db[_0xdbb5('0x67')]['findOne']({'where':{'teamId':_0x1cdaa7}})[_0xdbb5('0x24')](function(_0x18fe99){if(_0x18fe99){var _0x192855=_[_0xdbb5('0x29')](_0x384ebb,function(_0x5b396b){db[_0xdbb5('0x68')][_0xdbb5('0x88')]({'UserId':_0x5b396b,'VoicePrefixId':_0x18fe99[_0xdbb5('0x69')]});});return Promise[_0xdbb5('0x8c')](_0x192855);}});});});return Promise[_0xdbb5('0x8c')](_0x25d449)[_0xdbb5('0x24')](function(){return _0x3e8c23['addAgents'](_0x384ebb,{'transaction':_0x56d798})['spread'](function(_0x30f863){return _0x30f863;});});});}})[_0xdbb5('0x24')](respondWithResult(_0x49f880,null))[_0xdbb5('0x3f')](handleError(_0x49f880,null));};exports[_0xdbb5('0x8d')]=function(_0x2708e9,_0x55a622){var _0x22c1ed=_[_0xdbb5('0x79')](_0x2708e9['query'][_0xdbb5('0x76')])?_0x2708e9[_0xdbb5('0x2e')][_0xdbb5('0x76')]:[_0x2708e9[_0xdbb5('0x2e')]['ids']];var _0x121cd5=_0x2708e9[_0xdbb5('0x41')]['id'];return db[_0xdbb5('0x3c')]['find']({'where':{'id':_0x121cd5}})[_0xdbb5('0x24')](handleEntityNotFound(_0x55a622,null))['then'](function(_0x451811){if(_0x451811){var _0x5e3345=['Voice','Chat',_0xdbb5('0x8e'),_0xdbb5('0x7b'),_0xdbb5('0x8f'),_0xdbb5('0x7c'),_0xdbb5('0x7d')];return db['sequelize'][_0xdbb5('0x53')](function(_0x18b9ef){var _0x3b1110=_[_0xdbb5('0x29')](_0x5e3345,function(_0x1e1a5e){var _0x5abf23={'attributes':['id',_0xdbb5('0x2d')]};return _0x451811[_0xdbb5('0x4a')+_0x1e1a5e+_0xdbb5('0x75')](_0x5abf23)[_0xdbb5('0x24')](function(_0x22de05){var _0x45fdb6=_[_0xdbb5('0x29')](_0x22de05,function(_0x55d604){return _0x55d604[_0xdbb5('0x8d')](_0x22c1ed,{'transaction':_0x18b9ef})[_0xdbb5('0x24')](function(){var _0x15addc=_[_0xdbb5('0x29')](_0x22c1ed,function(_0x16d342){socket[_0xdbb5('0x83')](_0xdbb5('0x49')+_0x1e1a5e+_0xdbb5('0x90'),{'UserId':Number(_0x16d342),[_0x1e1a5e+_0xdbb5('0x80')]:_0x55d604['id']});if(_0x1e1a5e!=='Voice'){return;}return db[_0xdbb5('0x87')][_0xdbb5('0x51')]({'where':{'VoiceQueueId':_0x55d604['id'],'UserId':_0x16d342},'transaction':_0x18b9ef});});return Promise['all'](_0x15addc);});});return Promise[_0xdbb5('0x8c')](_0x45fdb6);});});return Promise['all'](_0x3b1110)[_0xdbb5('0x24')](function(){return _0x451811[_0xdbb5('0x8d')](_0x22c1ed,{'transaction':_0x18b9ef});})['then'](function(){return db['TeamVoicePrefix'][_0xdbb5('0x6b')]({'where':{'teamId':_0x121cd5}})[_0xdbb5('0x24')](function(_0x2fb078){if(_0x2fb078){var _0x5d7e05=_[_0xdbb5('0x29')](_0x22c1ed,function(_0x4f9499){db[_0xdbb5('0x68')][_0xdbb5('0x51')]({'where':{'UserId':_0x4f9499,'VoicePrefixId':_0x2fb078['VoicePrefixId']}});});return Promise[_0xdbb5('0x8c')](_0x5d7e05);}});});});}})[_0xdbb5('0x24')](respondWithStatusCode(_0x55a622,null))[_0xdbb5('0x3f')](handleError(_0x55a622,null));};exports[_0xdbb5('0x91')]=function(_0x27e1a5,_0x3708d7,_0x19711b){var _0x3838f6={};var _0x50455d={};var _0xe73805;var _0x509bbb;return db[_0xdbb5('0x3c')][_0xdbb5('0x6b')]({'where':{'id':_0x27e1a5['params']['id']}})[_0xdbb5('0x24')](handleEntityNotFound(_0x3708d7,null))['then'](function(_0x4d0f2a){if(_0x4d0f2a){_0xe73805=_0x4d0f2a;_0x50455d[_0xdbb5('0x2c')]=_[_0xdbb5('0x43')](db[_0xdbb5('0x82')][_0xdbb5('0x42')]);_0x50455d[_0xdbb5('0x2e')]=_[_0xdbb5('0x43')](_0x27e1a5[_0xdbb5('0x2e')]);_0x50455d['filters']=_['intersection'](_0x50455d[_0xdbb5('0x2c')],_0x50455d[_0xdbb5('0x2e')]);_0x3838f6[_0xdbb5('0x31')]=_[_0xdbb5('0x30')](_0x50455d[_0xdbb5('0x2c')],qs[_0xdbb5('0x32')](_0x27e1a5['query'][_0xdbb5('0x32')]));_0x3838f6[_0xdbb5('0x31')]=_0x3838f6[_0xdbb5('0x31')][_0xdbb5('0x44')]?_0x3838f6[_0xdbb5('0x31')]:_0x50455d[_0xdbb5('0x2c')];_0x3838f6['order']=qs[_0xdbb5('0x35')](_0x27e1a5[_0xdbb5('0x2e')][_0xdbb5('0x35')]);_0x3838f6[_0xdbb5('0x36')]=qs[_0xdbb5('0x2f')](_[_0xdbb5('0x37')](_0x27e1a5[_0xdbb5('0x2e')],_0x50455d[_0xdbb5('0x2f')]));if(_0x27e1a5[_0xdbb5('0x2e')][_0xdbb5('0x38')]){_0x3838f6['where']=_[_0xdbb5('0x39')](_0x3838f6[_0xdbb5('0x36')],{'$or':_[_0xdbb5('0x29')](_0x3838f6[_0xdbb5('0x31')],function(_0x53be20){var _0x282f3c={};_0x282f3c[_0x53be20]={'$like':'%'+_0x27e1a5['query']['filter']+'%'};return _0x282f3c;})});}_0x3838f6=_[_0xdbb5('0x39')]({},_0x3838f6,_0x27e1a5[_0xdbb5('0x3b')]);return _0xe73805[_0xdbb5('0x91')](_0x3838f6);}})['then'](function(_0x964df0){if(_0x964df0){_0x509bbb=_0x964df0[_0xdbb5('0x44')];if(!_0x27e1a5[_0xdbb5('0x2e')][_0xdbb5('0x33')](_0xdbb5('0x34'))){_0x3838f6[_0xdbb5('0x1f')]=qs[_0xdbb5('0x1f')](_0x27e1a5['query']['limit']);_0x3838f6[_0xdbb5('0x1d')]=qs[_0xdbb5('0x1d')](_0x27e1a5[_0xdbb5('0x2e')]['offset']);}return _0xe73805[_0xdbb5('0x91')](_0x3838f6);}})[_0xdbb5('0x24')](function(_0x53a6b2){if(_0x53a6b2){return _0x53a6b2?{'count':_0x509bbb,'rows':_0x53a6b2}:null;}})['then'](respondWithResult(_0x3708d7,null))['catch'](handleError(_0x3708d7,null));}; \ No newline at end of file +var _0x35b9=['apply','reject','save','update','then','error','stack','name','map','Team','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','catch','params','filters','includeAll','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','Teams','getQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','Queue','toLowerCase','Queues','addQueues','add','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','findAll','interface','isNil','SIP/%s','voicePause','all','upsert','spread','removeAgents','Openchannel','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4c9dc7,_0x609d24){var _0x5b26af=function(_0x23ee1d){while(--_0x23ee1d){_0x4c9dc7['push'](_0x4c9dc7['shift']());}};_0x5b26af(++_0x609d24);}(_0x35b9,0x108));var _0x935b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x35b9[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x935b('0x0'));var rimraf=require(_0x935b('0x1'));var zipdir=require(_0x935b('0x2'));var jsonpatch=require(_0x935b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x935b('0x4'));var Mustache=require(_0x935b('0x5'));var util=require(_0x935b('0x6'));var path=require('path');var sox=require(_0x935b('0x7'));var csv=require(_0x935b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x935b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x935b('0x8'));var querystring=require('querystring');var Papa=require(_0x935b('0xa'));var Redis=require(_0x935b('0xb'));var authService=require(_0x935b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x935b('0xd'));var hardwareService=require(_0x935b('0xe'));var logger=require('../../config/logger')(_0x935b('0xf'));var utils=require(_0x935b('0x10'));var config=require(_0x935b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x935b('0x12'))['db'];config[_0x935b('0x13')]=_['defaults'](config['redis'],{'host':_0x935b('0x14'),'port':0x18eb});var socket=require(_0x935b('0x15'))(new Redis(config['redis']));require(_0x935b('0x16'))[_0x935b('0x17')](socket);function respondWithStatusCode(_0x57dc32,_0x1b8f4d){_0x1b8f4d=_0x1b8f4d||0xcc;return function(_0x4b1e61){if(_0x4b1e61){return _0x57dc32[_0x935b('0x18')](_0x1b8f4d);}return _0x57dc32[_0x935b('0x19')](_0x1b8f4d)[_0x935b('0x1a')]();};}function respondWithResult(_0x2996d7,_0x16832c){_0x16832c=_0x16832c||0xc8;return function(_0xf8c998){if(_0xf8c998){return _0x2996d7[_0x935b('0x19')](_0x16832c)[_0x935b('0x1b')](_0xf8c998);}};}function respondWithFilteredResult(_0x3dfbc2,_0x375d6d){return function(_0x3c14c1){if(_0x3c14c1){var _0x467b32=typeof _0x375d6d[_0x935b('0x1c')]==='undefined'&&typeof _0x375d6d['limit']===_0x935b('0x1d');var _0x5392e7=_0x3c14c1[_0x935b('0x1e')];var _0x17e024=_0x467b32?0x0:_0x375d6d[_0x935b('0x1c')];var _0x452396=_0x467b32?_0x3c14c1[_0x935b('0x1e')]:_0x375d6d[_0x935b('0x1c')]+_0x375d6d[_0x935b('0x1f')];var _0x563821;if(_0x452396>=_0x5392e7){_0x452396=_0x5392e7;_0x563821=0xc8;}else{_0x563821=0xce;}_0x3dfbc2[_0x935b('0x19')](_0x563821);return _0x3dfbc2[_0x935b('0x20')](_0x935b('0x21'),_0x17e024+'-'+_0x452396+'/'+_0x5392e7)[_0x935b('0x1b')](_0x3c14c1);}return null;};}function patchUpdates(_0x1c1d79){return function(_0x3f8831){try{jsonpatch[_0x935b('0x22')](_0x3f8831,_0x1c1d79,!![]);}catch(_0x513804){return BPromise[_0x935b('0x23')](_0x513804);}return _0x3f8831[_0x935b('0x24')]();};}function saveUpdates(_0x196cd1,_0x33ebb3){return function(_0x110e78){if(_0x110e78){return _0x110e78[_0x935b('0x25')](_0x196cd1)[_0x935b('0x26')](function(_0xf08686){return _0xf08686;});}return null;};}function handleEntityNotFound(_0x259af6,_0x1cf2d5){return function(_0x589069){if(!_0x589069){_0x259af6[_0x935b('0x18')](0x194);}return _0x589069;};}function handleError(_0x1199ec,_0x9b3591){_0x9b3591=_0x9b3591||0x1f4;return function(_0x592168){logger[_0x935b('0x27')](_0x592168[_0x935b('0x28')]);if(_0x592168[_0x935b('0x29')]){delete _0x592168[_0x935b('0x29')];}_0x1199ec['status'](_0x9b3591)['send'](_0x592168);};}exports['index']=function(_0x5c80bf,_0xb7ef47){var _0xef459a={},_0x5243fe={},_0x59c057={'count':0x0,'rows':[]};var _0x18c26b=_[_0x935b('0x2a')](db[_0x935b('0x2b')][_0x935b('0x2c')],function(_0x38c1e9){return{'name':_0x38c1e9[_0x935b('0x2d')],'type':_0x38c1e9[_0x935b('0x2e')]['key']};});_0x5243fe[_0x935b('0x2f')]=_['map'](_0x18c26b,_0x935b('0x29'));_0x5243fe[_0x935b('0x30')]=_[_0x935b('0x31')](_0x5c80bf[_0x935b('0x30')]);_0x5243fe['filters']=_[_0x935b('0x32')](_0x5243fe[_0x935b('0x2f')],_0x5243fe[_0x935b('0x30')]);_0xef459a[_0x935b('0x33')]=_[_0x935b('0x32')](_0x5243fe[_0x935b('0x2f')],qs[_0x935b('0x34')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x34')]));_0xef459a[_0x935b('0x33')]=_0xef459a[_0x935b('0x33')][_0x935b('0x35')]?_0xef459a[_0x935b('0x33')]:_0x5243fe[_0x935b('0x2f')];if(!_0x5c80bf[_0x935b('0x30')][_0x935b('0x36')](_0x935b('0x37'))){_0xef459a[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x1f')]);_0xef459a[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0x5c80bf[_0x935b('0x30')]['offset']);}_0xef459a[_0x935b('0x38')]=qs[_0x935b('0x39')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x39')]);_0xef459a[_0x935b('0x3a')]=qs['filters'](_[_0x935b('0x3b')](_0x5c80bf[_0x935b('0x30')],_0x5243fe['filters']),_0x18c26b);if(_0x5c80bf[_0x935b('0x30')][_0x935b('0x3c')]){_0xef459a['where']=_['merge'](_0xef459a['where'],{'$or':_[_0x935b('0x2a')](_0x18c26b,function(_0x29ef58){if(_0x29ef58[_0x935b('0x2e')]!==_0x935b('0x3d')){var _0x282f29={};_0x282f29[_0x29ef58[_0x935b('0x29')]]={'$like':'%'+_0x5c80bf[_0x935b('0x30')][_0x935b('0x3c')]+'%'};return _0x282f29;}})});}_0xef459a=_['merge']({},_0xef459a,_0x5c80bf[_0x935b('0x3e')]);var _0x33431e={'where':_0xef459a['where']};return db[_0x935b('0x2b')][_0x935b('0x1e')](_0x33431e)[_0x935b('0x26')](function(_0x39f91a){_0x59c057[_0x935b('0x1e')]=_0x39f91a;if(_0x5c80bf[_0x935b('0x30')]['includeAll']){_0xef459a['include']=[{'all':!![]}];}return db['Team']['findAll'](_0xef459a);})[_0x935b('0x26')](function(_0x3a48ac){_0x59c057['rows']=_0x3a48ac;return _0x59c057;})[_0x935b('0x26')](respondWithFilteredResult(_0xb7ef47,_0xef459a))[_0x935b('0x3f')](handleError(_0xb7ef47,null));};exports['show']=function(_0x135122,_0x103401){var _0x2da8e6={'raw':![],'where':{'id':_0x135122[_0x935b('0x40')]['id']}},_0x44b33a={};_0x44b33a[_0x935b('0x2f')]=_[_0x935b('0x31')](db[_0x935b('0x2b')][_0x935b('0x2c')]);_0x44b33a[_0x935b('0x30')]=_[_0x935b('0x31')](_0x135122[_0x935b('0x30')]);_0x44b33a[_0x935b('0x41')]=_['intersection'](_0x44b33a['model'],_0x44b33a[_0x935b('0x30')]);_0x2da8e6[_0x935b('0x33')]=_[_0x935b('0x32')](_0x44b33a[_0x935b('0x2f')],qs[_0x935b('0x34')](_0x135122[_0x935b('0x30')][_0x935b('0x34')]));_0x2da8e6[_0x935b('0x33')]=_0x2da8e6['attributes']['length']?_0x2da8e6[_0x935b('0x33')]:_0x44b33a[_0x935b('0x2f')];if(_0x135122['query'][_0x935b('0x42')]){_0x2da8e6[_0x935b('0x43')]=[{'all':!![]}];}_0x2da8e6=_[_0x935b('0x44')]({},_0x2da8e6,_0x135122['options']);return db[_0x935b('0x2b')][_0x935b('0x45')](_0x2da8e6)[_0x935b('0x26')](handleEntityNotFound(_0x103401,null))[_0x935b('0x26')](respondWithResult(_0x103401,null))[_0x935b('0x3f')](handleError(_0x103401,null));};exports['create']=function(_0x5d307e,_0x2c3af8){return db[_0x935b('0x2b')][_0x935b('0x46')](_0x5d307e[_0x935b('0x47')],{})[_0x935b('0x26')](function(_0x20d995){var _0x236b1d=_0x5d307e[_0x935b('0x48')][_0x935b('0x49')]({'plain':!![]});if(!_0x236b1d)throw new Error(_0x935b('0x4a'));if(_0x236b1d[_0x935b('0x4b')]===_0x935b('0x48')){var _0x555927=_0x20d995[_0x935b('0x49')]({'plain':!![]});var _0x16d402='Teams';return db[_0x935b('0x4c')][_0x935b('0x45')]({'where':{'name':_0x16d402,'userProfileId':_0x236b1d[_0x935b('0x4d')]},'raw':!![]})[_0x935b('0x26')](function(_0x2a2468){if(_0x2a2468&&_0x2a2468[_0x935b('0x4e')]===0x0){return db[_0x935b('0x4f')][_0x935b('0x46')]({'name':_0x555927[_0x935b('0x29')],'resourceId':_0x555927['id'],'type':_0x2a2468[_0x935b('0x29')],'sectionId':_0x2a2468['id']},{})[_0x935b('0x26')](function(){return _0x20d995;});}else{return _0x20d995;}})[_0x935b('0x3f')](function(_0x23d488){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23d488);throw _0x23d488;});}return _0x20d995;})[_0x935b('0x26')](respondWithResult(_0x2c3af8,0xc9))[_0x935b('0x3f')](handleError(_0x2c3af8,null));};exports['update']=function(_0x4294bb,_0x5b278b){if(_0x4294bb[_0x935b('0x47')]['id']){delete _0x4294bb[_0x935b('0x47')]['id'];}return db[_0x935b('0x2b')][_0x935b('0x45')]({'where':{'id':_0x4294bb[_0x935b('0x40')]['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x5b278b,null))['then'](saveUpdates(_0x4294bb[_0x935b('0x47')],null))[_0x935b('0x26')](respondWithResult(_0x5b278b,null))['catch'](handleError(_0x5b278b,null));};exports[_0x935b('0x50')]=function(_0x39f6b5,_0x152065){var _0x53c506=_0x39f6b5[_0x935b('0x40')]['id'];var _0x3e43b3=[];return db[_0x935b('0x51')][_0x935b('0x52')](function(_0xc8b7d2){var _0x40072d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x40072d,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2})[_0x935b('0x26')](function(_0x5cb9f9){_0x3e43b3=_['map'](_0x5cb9f9,function(_0xaeeca1){return Number(_0xaeeca1['UserId']);});})[_0x935b('0x26')](function(){var _0x4c4945=_0x935b('0x56')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x4c4945,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})['then'](function(_0x3e11dd){var _0x398fc3=_[_0x935b('0x2a')](_0x3e11dd,function(_0x5a96b0){return Number(_0x5a96b0[_0x935b('0x57')]);});return db[_0x935b('0x58')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'VoiceQueueId':{'$in':_0x398fc3}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x261020=_0x935b('0x59')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x261020,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x46dabc){var _0x40a9dd=_[_0x935b('0x2a')](_0x46dabc,function(_0x11ba04){return Number(_0x11ba04[_0x935b('0x5a')]);});return db['UserMailQueue'][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'MailQueueId':{'$in':_0x40a9dd}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x19ec16=_0x935b('0x5b')+_0x53c506;return db['sequelize'][_0x935b('0x30')](_0x19ec16,{'type':db['Sequelize'][_0x935b('0x54')]['SELECT'],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x5e0ef5){var _0x3ae755=_[_0x935b('0x2a')](_0x5e0ef5,function(_0x1c3462){return Number(_0x1c3462[_0x935b('0x5c')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'SmsQueueId':{'$in':_0x3ae755}},'transaction':_0xc8b7d2});})['then'](function(){var _0x3ffd37=_0x935b('0x5d')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x3ffd37,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x57af8c){var _0xe0e643=_[_0x935b('0x2a')](_0x57af8c,function(_0x2beafa){return Number(_0x2beafa['ChatQueueId']);});return db[_0x935b('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'ChatQueueId':{'$in':_0xe0e643}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x185081='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53c506;return db[_0x935b('0x51')]['query'](_0x185081,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x552313){var _0x6d7d61=_[_0x935b('0x2a')](_0x552313,function(_0x7c9732){return Number(_0x7c9732[_0x935b('0x5f')]);});return db[_0x935b('0x60')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'FaxQueueId':{'$in':_0x6d7d61}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x1aa7d1=_0x935b('0x61')+_0x53c506;return db[_0x935b('0x51')]['query'](_0x1aa7d1,{'type':db[_0x935b('0x53')][_0x935b('0x54')]['SELECT'],'raw':!![],'transaction':_0xc8b7d2});})['then'](function(_0x21745c){var _0x22f9c4=_['map'](_0x21745c,function(_0x697fb){return Number(_0x697fb[_0x935b('0x62')]);});return db[_0x935b('0x63')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'OpenchannelQueueId':{'$in':_0x22f9c4}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x324e9f=_0x935b('0x64')+_0x53c506;return db['sequelize'][_0x935b('0x30')](_0x324e9f,{'type':db[_0x935b('0x53')]['QueryTypes'][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x492516){var _0x349b7a=_['map'](_0x492516,function(_0x9bcd6a){return Number(_0x9bcd6a[_0x935b('0x65')]);});return db[_0x935b('0x66')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'WhatsappQueueId':{'$in':_0x349b7a}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){return db[_0x935b('0x67')][_0x935b('0x45')]({'where':{'TeamId':_0x53c506}});})[_0x935b('0x26')](function(_0x46b617){if(_0x46b617===null){return;}return db[_0x935b('0x68')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'VoicePrefixId':_0x46b617['VoicePrefixId']},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){return db[_0x935b('0x2b')][_0x935b('0x50')]({'where':{'id':_0x53c506},'cascade':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x35b1f3){if(_0x35b1f3===0x0){_0x152065[_0x935b('0x18')](0x194);}else{return db[_0x935b('0x4f')][_0x935b('0x50')]({'where':{'type':_0x935b('0x69'),'resourceId':_0x53c506},'cascade':!![],'transaction':_0xc8b7d2})[_0x935b('0x26')](function(){_0x152065[_0x935b('0x19')](0xcc)[_0x935b('0x1a')]();});}})[_0x935b('0x3f')](function(_0x3f7b46){_0x152065[_0x935b('0x19')](0x1f4)['send'](_0x3f7b46);});});};exports[_0x935b('0x6a')]=function(_0xdbb2c0,_0x15361c,_0x20159d){return db[_0x935b('0x2b')][_0x935b('0x6b')]({'where':{'id':_0xdbb2c0[_0x935b('0x40')]['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x15361c,null))[_0x935b('0x26')](function(_0x574f78){if(!_0xdbb2c0[_0x935b('0x30')]['channel']||!utils[_0x935b('0x6c')](_0xdbb2c0[_0x935b('0x30')]['channel'])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))](_0x935b('0x6e'));}var _0x12389f={};var _0x1f07f0={};_0x1f07f0['model']=_[_0x935b('0x31')](db[_[_0x935b('0x6f')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x70')]['toLowerCase']())+_0x935b('0x71')][_0x935b('0x2c')]);_0x1f07f0[_0x935b('0x30')]=_[_0x935b('0x31')](_0xdbb2c0[_0x935b('0x30')]);_0x1f07f0[_0x935b('0x41')]=_[_0x935b('0x32')](_0x1f07f0[_0x935b('0x2f')],_0x1f07f0[_0x935b('0x30')]);_0x12389f['attributes']=_[_0x935b('0x32')](_0x1f07f0[_0x935b('0x2f')],qs[_0x935b('0x34')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x34')]));_0x12389f[_0x935b('0x33')]=_0x12389f[_0x935b('0x33')][_0x935b('0x35')]?_0x12389f[_0x935b('0x33')]:_0x1f07f0[_0x935b('0x2f')];_0x12389f[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0xdbb2c0[_0x935b('0x30')]['limit']);_0x12389f[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x1c')]);_0x12389f[_0x935b('0x38')]=qs[_0x935b('0x39')](_0xdbb2c0['query']['sort']);_0x12389f['where']=qs[_0x935b('0x41')](_[_0x935b('0x3b')](_0xdbb2c0[_0x935b('0x30')],_0x1f07f0['filters']));_0x12389f=_['merge']({},_0x12389f,_0xdbb2c0[_0x935b('0x3e')]);return _0x574f78[_0x935b('0x49')+_['capitalize'](_0xdbb2c0['query'][_0x935b('0x70')][_0x935b('0x72')]())+_0x935b('0x73')](_0x12389f);})[_0x935b('0x26')](respondWithResult(_0x15361c,null))['catch'](handleError(_0x15361c,null));};exports[_0x935b('0x74')]=function(_0x58a917,_0x425a68,_0x2659ef){return db['Team'][_0x935b('0x6b')]({'where':{'id':_0x58a917[_0x935b('0x40')]['id']}})[_0x935b('0x26')](function(_0x78467){if(_0x78467){if(!_0x58a917['body'][_0x935b('0x70')]||!utils['isValidChannel'](_0x58a917['body'][_0x935b('0x70')])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))]('Unknown\x20channel');}return _0x78467[_0x935b('0x75')+_[_0x935b('0x6f')](_0x58a917[_0x935b('0x47')][_0x935b('0x70')]['toLowerCase']())+_0x935b('0x73')](_0x58a917[_0x935b('0x47')][_0x935b('0x76')]);}return null;})[_0x935b('0x26')](handleEntityNotFound(_0x425a68,null))[_0x935b('0x26')](respondWithStatusCode(_0x425a68,null))['catch'](handleError(_0x425a68,null));};exports['removeQueues']=function(_0xd6586b,_0x28ac39,_0xed6515){return db[_0x935b('0x2b')][_0x935b('0x6b')]({'where':{'id':_0xd6586b[_0x935b('0x40')]['id']}})[_0x935b('0x26')](function(_0x5718c4){if(_0x5718c4){if(!_0xd6586b[_0x935b('0x30')]['channel']||!utils['isValidChannel'](_0xd6586b[_0x935b('0x30')][_0x935b('0x70')])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))](_0x935b('0x6e'));}return _0x5718c4['remove'+_[_0x935b('0x6f')](_0xd6586b['query'][_0x935b('0x70')][_0x935b('0x72')]())+'Queues'](_0xd6586b[_0x935b('0x30')]['ids']);}return null;})['then'](handleEntityNotFound(_0x28ac39,null))['then'](respondWithStatusCode(_0x28ac39,null))[_0x935b('0x3f')](handleError(_0x28ac39,null));};exports[_0x935b('0x77')]=function(_0x7ed618,_0x22b092){var _0x278bed=_[_0x935b('0x78')](_0x7ed618[_0x935b('0x47')][_0x935b('0x76')])?_0x7ed618[_0x935b('0x47')][_0x935b('0x76')]:[_0x7ed618[_0x935b('0x47')][_0x935b('0x76')]];var _0x33092e=_0x7ed618['params']['id'];return db[_0x935b('0x2b')]['find']({'where':{'id':_0x33092e}})[_0x935b('0x26')](handleEntityNotFound(_0x22b092,null))[_0x935b('0x26')](function(_0x4b3bc8){if(_0x4b3bc8){var _0x162cd8=[_0x935b('0x79'),_0x935b('0x7a'),_0x935b('0x7b'),_0x935b('0x7c'),_0x935b('0x7d'),'Openchannel',_0x935b('0x7e')];return db['sequelize'][_0x935b('0x52')](function(_0x20844e){var _0x2134e9=_['map'](_0x162cd8,function(_0x1a0e7d){var _0x2f8da6={'attributes':['id',_0x935b('0x29')]};if(_0x1a0e7d==='Voice'){_0x2f8da6[_0x935b('0x7f')]={'attributes':[_0x935b('0x80')]};}return _0x4b3bc8[_0x935b('0x49')+_0x1a0e7d+_0x935b('0x73')](_0x2f8da6)[_0x935b('0x26')](function(_0x139c34){var _0x4c2af2=_['map'](_0x139c34,function(_0x4a9e8){var _0x21bcf9=_[_0x935b('0x2a')](_0x278bed,function(_0x3fc775){var _0x2a9281={'where':{'UserId':_0x3fc775,[_0x1a0e7d+_0x935b('0x81')]:_0x4a9e8['id']},'transaction':_0x20844e};if(_0x1a0e7d==='Voice'){_0x2a9281[_0x935b('0x82')]={'penalty':_0x4a9e8[_0x935b('0x83')][_0x935b('0x80')]};}return db[_0x935b('0x84')+_0x1a0e7d+_0x935b('0x71')][_0x935b('0x85')](_0x2a9281)[_0x935b('0x26')](function(){socket[_0x935b('0x86')]('user'+_0x1a0e7d+'Queue:save',{'UserId':_0x3fc775,[_0x1a0e7d+'QueueId']:_0x4a9e8['id']});if(_0x1a0e7d!==_0x935b('0x79')){return;}return db[_0x935b('0x84')][_0x935b('0x87')]({'where':{'id':_0x278bed,'online':0x1},'attributes':['id',_0x935b('0x29'),'online','voicePause',_0x935b('0x88')],'raw':!![]})[_0x935b('0x26')](function(_0x557001){var _0x54ede0=_[_0x935b('0x2a')](_0x557001,function(_0x51a81c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x51a81c[_0x935b('0x29')],'UserId':_0x51a81c['id'],'queue_name':_0x4a9e8['name'],'VoiceQueueId':_0x4a9e8['id'],'interface':_[_0x935b('0x89')](_0x51a81c[_0x935b('0x88')])?util['format'](_0x935b('0x8a'),_0x51a81c[_0x935b('0x29')]):_0x51a81c['interface'],'paused':_0x51a81c[_0x935b('0x8b')]||![],'penalty':_0x4a9e8[_0x935b('0x83')][_0x935b('0x80')]},{'transaction':_0x20844e});});return Promise['all'](_0x54ede0);});});});return Promise[_0x935b('0x8c')](_0x21bcf9);});return Promise['all'](_0x4c2af2);})['then'](function(){return db[_0x935b('0x67')]['findOne']({'where':{'teamId':_0x33092e}})[_0x935b('0x26')](function(_0x2cdec6){if(_0x2cdec6){var _0x523ddf=_[_0x935b('0x2a')](_0x278bed,function(_0x59d40c){db[_0x935b('0x68')][_0x935b('0x8d')]({'UserId':_0x59d40c,'VoicePrefixId':_0x2cdec6['VoicePrefixId']});});return Promise['all'](_0x523ddf);}});});});return Promise[_0x935b('0x8c')](_0x2134e9)[_0x935b('0x26')](function(){return _0x4b3bc8[_0x935b('0x77')](_0x278bed,{'transaction':_0x20844e})[_0x935b('0x8e')](function(_0x590f0f){return _0x590f0f;});});});}})[_0x935b('0x26')](respondWithResult(_0x22b092,null))[_0x935b('0x3f')](handleError(_0x22b092,null));};exports[_0x935b('0x8f')]=function(_0x4d70e8,_0x19e22a){var _0x156fb9=_[_0x935b('0x78')](_0x4d70e8[_0x935b('0x30')][_0x935b('0x76')])?_0x4d70e8['query'][_0x935b('0x76')]:[_0x4d70e8['query'][_0x935b('0x76')]];var _0x16d609=_0x4d70e8['params']['id'];return db[_0x935b('0x2b')][_0x935b('0x45')]({'where':{'id':_0x16d609}})[_0x935b('0x26')](handleEntityNotFound(_0x19e22a,null))['then'](function(_0x5f2219){if(_0x5f2219){var _0x2bb765=[_0x935b('0x79'),_0x935b('0x7a'),_0x935b('0x7b'),_0x935b('0x7c'),_0x935b('0x7d'),_0x935b('0x90'),_0x935b('0x7e')];return db[_0x935b('0x51')][_0x935b('0x52')](function(_0x57bee2){var _0x4df516=_['map'](_0x2bb765,function(_0x1895d4){var _0x15c37d={'attributes':['id',_0x935b('0x29')]};return _0x5f2219[_0x935b('0x49')+_0x1895d4+'Queues'](_0x15c37d)[_0x935b('0x26')](function(_0x1e35b8){var _0x1d9d43=_[_0x935b('0x2a')](_0x1e35b8,function(_0x4aa017){return _0x4aa017['removeAgents'](_0x156fb9,{'transaction':_0x57bee2})[_0x935b('0x26')](function(){var _0x35c9c8=_['map'](_0x156fb9,function(_0x205135){socket['emit'](_0x935b('0x48')+_0x1895d4+_0x935b('0x91'),{'UserId':Number(_0x205135),[_0x1895d4+'QueueId']:_0x4aa017['id']});if(_0x1895d4!=='Voice'){return;}return db[_0x935b('0x92')][_0x935b('0x50')]({'where':{'VoiceQueueId':_0x4aa017['id'],'UserId':_0x205135},'transaction':_0x57bee2});});return Promise[_0x935b('0x8c')](_0x35c9c8);});});return Promise[_0x935b('0x8c')](_0x1d9d43);});});return Promise[_0x935b('0x8c')](_0x4df516)[_0x935b('0x26')](function(){return _0x5f2219[_0x935b('0x8f')](_0x156fb9,{'transaction':_0x57bee2});})[_0x935b('0x26')](function(){return db[_0x935b('0x67')][_0x935b('0x6b')]({'where':{'teamId':_0x16d609}})[_0x935b('0x26')](function(_0x517cee){if(_0x517cee){var _0xee50de=_[_0x935b('0x2a')](_0x156fb9,function(_0x20de47){db[_0x935b('0x68')][_0x935b('0x50')]({'where':{'UserId':_0x20de47,'VoicePrefixId':_0x517cee[_0x935b('0x93')]}});});return Promise['all'](_0xee50de);}});});});}})['then'](respondWithStatusCode(_0x19e22a,null))[_0x935b('0x3f')](handleError(_0x19e22a,null));};exports[_0x935b('0x94')]=function(_0x108f27,_0x145be5,_0xd7e2c0){var _0x23e10b={};var _0x2be867={};var _0x2eef38;var _0x383dcb;return db['Team']['findOne']({'where':{'id':_0x108f27['params']['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x145be5,null))['then'](function(_0x53b413){if(_0x53b413){_0x2eef38=_0x53b413;_0x2be867[_0x935b('0x2f')]=_[_0x935b('0x31')](db[_0x935b('0x84')][_0x935b('0x2c')]);_0x2be867[_0x935b('0x30')]=_[_0x935b('0x31')](_0x108f27[_0x935b('0x30')]);_0x2be867[_0x935b('0x41')]=_[_0x935b('0x32')](_0x2be867[_0x935b('0x2f')],_0x2be867[_0x935b('0x30')]);_0x23e10b[_0x935b('0x33')]=_[_0x935b('0x32')](_0x2be867[_0x935b('0x2f')],qs['fields'](_0x108f27[_0x935b('0x30')]['fields']));_0x23e10b[_0x935b('0x33')]=_0x23e10b['attributes'][_0x935b('0x35')]?_0x23e10b['attributes']:_0x2be867['model'];_0x23e10b[_0x935b('0x38')]=qs['sort'](_0x108f27[_0x935b('0x30')][_0x935b('0x39')]);_0x23e10b[_0x935b('0x3a')]=qs[_0x935b('0x41')](_[_0x935b('0x3b')](_0x108f27[_0x935b('0x30')],_0x2be867[_0x935b('0x41')]));if(_0x108f27[_0x935b('0x30')][_0x935b('0x3c')]){_0x23e10b[_0x935b('0x3a')]=_[_0x935b('0x44')](_0x23e10b[_0x935b('0x3a')],{'$or':_['map'](_0x23e10b[_0x935b('0x33')],function(_0xdc6546){var _0x2f6000={};_0x2f6000[_0xdc6546]={'$like':'%'+_0x108f27[_0x935b('0x30')][_0x935b('0x3c')]+'%'};return _0x2f6000;})});}_0x23e10b=_[_0x935b('0x44')]({},_0x23e10b,_0x108f27[_0x935b('0x3e')]);return _0x2eef38[_0x935b('0x94')](_0x23e10b);}})['then'](function(_0x4f046e){if(_0x4f046e){_0x383dcb=_0x4f046e['length'];if(!_0x108f27['query'][_0x935b('0x36')](_0x935b('0x37'))){_0x23e10b[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0x108f27[_0x935b('0x30')][_0x935b('0x1f')]);_0x23e10b[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0x108f27[_0x935b('0x30')][_0x935b('0x1c')]);}return _0x2eef38[_0x935b('0x94')](_0x23e10b);}})[_0x935b('0x26')](function(_0x505a3e){if(_0x505a3e){return _0x505a3e?{'count':_0x383dcb,'rows':_0x505a3e}:null;}})[_0x935b('0x26')](respondWithResult(_0x145be5,null))[_0x935b('0x3f')](handleError(_0x145be5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 105e097..f33ff42 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 _0x2337=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x4d218e,_0x570ea9){var _0x5e6af5=function(_0x16aa57){while(--_0x16aa57){_0x4d218e['push'](_0x4d218e['shift']());}};_0x5e6af5(++_0x570ea9);}(_0x2337,0x102));var _0x7233=function(_0x1fc148,_0x169711){_0x1fc148=_0x1fc148-0x0;var _0x2d7e96=_0x2337[_0x1fc148];return _0x2d7e96;};'use strict';var EventEmitter=require(_0x7233('0x0'));var Team=require(_0x7233('0x1'))['db'][_0x7233('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7233('0x3'),'afterUpdate':'update','afterDestroy':_0x7233('0x4')};function emitEvent(_0x4ee80e){return function(_0x326f3b,_0x1ed7e1,_0x47f50f){TeamEvents[_0x7233('0x5')](_0x4ee80e+':'+_0x326f3b['id'],_0x326f3b);TeamEvents[_0x7233('0x5')](_0x4ee80e,_0x326f3b);_0x47f50f(null);};}for(var e in events){if(events[_0x7233('0x6')](e)){var event=events[e];Team[_0x7233('0x7')](e,emitEvent(event));}}module[_0x7233('0x8')]=TeamEvents; \ No newline at end of file +var _0x1ec4=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2ad003,_0x2d4962){var _0x4cdf67=function(_0x3159e0){while(--_0x3159e0){_0x2ad003['push'](_0x2ad003['shift']());}};_0x4cdf67(++_0x2d4962);}(_0x1ec4,0x6e));var _0x41ec=function(_0x54520c,_0x53843f){_0x54520c=_0x54520c-0x0;var _0x327812=_0x1ec4[_0x54520c];return _0x327812;};'use strict';var EventEmitter=require(_0x41ec('0x0'));var Team=require(_0x41ec('0x1'))['db'][_0x41ec('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x41ec('0x3')](0x0);var events={'afterCreate':_0x41ec('0x4'),'afterUpdate':_0x41ec('0x5'),'afterDestroy':_0x41ec('0x6')};function emitEvent(_0x56b18c){return function(_0x299da8,_0x4e3f4b,_0x34045a){TeamEvents[_0x41ec('0x7')](_0x56b18c+':'+_0x299da8['id'],_0x299da8);TeamEvents[_0x41ec('0x7')](_0x56b18c,_0x299da8);_0x34045a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x41ec('0x8')](e,emitEvent(event));}}module[_0x41ec('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2846e77..1cb8f9b 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 _0xfa46=['Sms','Voice','resolve','map','all','lodash','./team.attributes','get','setDataValue','channel','catch','exports','teams','Chat','Fax','Mail','Openchannel'];(function(_0x4f7be4,_0x53b751){var _0xbd650e=function(_0x2cf6e8){while(--_0x2cf6e8){_0x4f7be4['push'](_0x4f7be4['shift']());}};_0xbd650e(++_0x53b751);}(_0xfa46,0xf3));var _0x6fa4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfa46[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6fa4('0x0'));var attributes=require(_0x6fa4('0x1'));function getQueuesByChannel(_0x15b989,_0x1e3aec){var _0x473b76=_0x6fa4('0x2')+_0x1e3aec+'Queues';return _0x15b989[_0x473b76]()['then'](function(_0x3d681a){return _['map'](_0x3d681a,function(_0x207f82){_0x207f82[_0x6fa4('0x3')](_0x6fa4('0x4'),_0x1e3aec);return _0x207f82;});})[_0x6fa4('0x5')](function(_0xebf68f){throw _0xebf68f;});}module[_0x6fa4('0x6')]=function(_0xa3a626){return _0xa3a626['define']('Team',attributes,{'tableName':_0x6fa4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1e0908=this;var _0x596856=[_0x6fa4('0x8'),_0x6fa4('0x9'),_0x6fa4('0xa'),_0x6fa4('0xb'),_0x6fa4('0xc'),_0x6fa4('0xd'),'Whatsapp'];return Promise[_0x6fa4('0xe')]()['then'](function(){var _0x233555=_[_0x6fa4('0xf')](_0x596856,function(_0xa467fe){return getQueuesByChannel(_0x1e0908,_0xa467fe);});return Promise[_0x6fa4('0x10')](_0x233555);})[_0x6fa4('0x5')](function(_0x616ff1){throw _0x616ff1;});}}});}; \ No newline at end of file +var _0x24f9=['Sms','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','Fax','Mail','Openchannel'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x24f9,0x135));var _0x924f=function(_0x4cb8fe,_0x14ac27){_0x4cb8fe=_0x4cb8fe-0x0;var _0x48cc90=_0x24f9[_0x4cb8fe];return _0x48cc90;};'use strict';var _=require(_0x924f('0x0'));var attributes=require(_0x924f('0x1'));function getQueuesByChannel(_0x597d5d,_0xd05375){var _0x21dbc5=_0x924f('0x2')+_0xd05375+_0x924f('0x3');return _0x597d5d[_0x21dbc5]()[_0x924f('0x4')](function(_0x5ae867){return _[_0x924f('0x5')](_0x5ae867,function(_0x1535bf){_0x1535bf[_0x924f('0x6')](_0x924f('0x7'),_0xd05375);return _0x1535bf;});})[_0x924f('0x8')](function(_0x57ac3e){throw _0x57ac3e;});}module[_0x924f('0x9')]=function(_0x1460ed){return _0x1460ed[_0x924f('0xa')](_0x924f('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x12c853=this;var _0x5d488b=['Chat',_0x924f('0xc'),_0x924f('0xd'),_0x924f('0xe'),_0x924f('0xf'),'Voice','Whatsapp'];return Promise[_0x924f('0x10')]()[_0x924f('0x4')](function(){var _0x43f13f=_[_0x924f('0x5')](_0x5d488b,function(_0x315d0b){return getQueuesByChannel(_0x12c853,_0x315d0b);});return Promise[_0x924f('0x11')](_0x43f13f);})[_0x924f('0x8')](function(_0x49a135){throw _0x49a135;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 94b330d..36ea3b3 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 _0xb7ff=['socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x448757,_0x2f1061){var _0x328498=function(_0x5dfdfb){while(--_0x5dfdfb){_0x448757['push'](_0x448757['shift']());}};_0x328498(++_0x2f1061);}(_0xb7ff,0x79));var _0xfb7f=function(_0x3e6073,_0x4e89cf){_0x3e6073=_0x3e6073-0x0;var _0x4c4640=_0xb7ff[_0x3e6073];return _0x4c4640;};'use strict';var _=require('lodash');var util=require(_0xfb7f('0x0'));var moment=require(_0xfb7f('0x1'));var BPromise=require(_0xfb7f('0x2'));var rs=require(_0xfb7f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7f('0x4'))['db'];var utils=require(_0xfb7f('0x5'));var logger=require('../../config/logger')(_0xfb7f('0x6'));var config=require(_0xfb7f('0x7'));var jayson=require(_0xfb7f('0x8'));var client=jayson[_0xfb7f('0x9')][_0xfb7f('0xa')]({'port':0x232a});config[_0xfb7f('0xb')]=_[_0xfb7f('0xc')](config['redis'],{'host':_0xfb7f('0xd'),'port':0x18eb});var socket=require(_0xfb7f('0xe'))(new Redis(config[_0xfb7f('0xb')]));require(_0xfb7f('0xf'))[_0xfb7f('0x10')](socket);function respondWithRpcPromise(_0x31d771,_0x1338f3,_0x171caa){return new BPromise(function(_0x124035,_0x3527c3){return client['request'](_0x31d771,_0x171caa)[_0xfb7f('0x11')](function(_0x1a8f16){logger[_0xfb7f('0x12')](_0xfb7f('0x13'),_0x1338f3,'request\x20sent');logger['debug'](_0xfb7f('0x14'),_0x1338f3,_0xfb7f('0x15'),JSON[_0xfb7f('0x16')](_0x1a8f16));if(_0x1a8f16['error']){if(_0x1a8f16[_0xfb7f('0x17')]['code']===0x1f4){logger['error'](_0xfb7f('0x13'),_0x1338f3,_0x1a8f16['error'][_0xfb7f('0x18')]);return _0x3527c3(_0x1a8f16[_0xfb7f('0x17')][_0xfb7f('0x18')]);}logger[_0xfb7f('0x17')](_0xfb7f('0x13'),_0x1338f3,_0x1a8f16['error'][_0xfb7f('0x18')]);return _0x124035(_0x1a8f16[_0xfb7f('0x17')][_0xfb7f('0x18')]);}else{logger[_0xfb7f('0x12')](_0xfb7f('0x13'),_0x1338f3,_0xfb7f('0x15'));_0x124035(_0x1a8f16[_0xfb7f('0x19')]['message']);}})[_0xfb7f('0x1a')](function(_0xb9d235){logger[_0xfb7f('0x17')]('Team,\x20%s,\x20%s',_0x1338f3,_0xb9d235);_0x3527c3(_0xb9d235);});});} \ No newline at end of file +var _0x42a1=['Team,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','request','then','info'];(function(_0x5ce7b9,_0x3b0d8b){var _0x1f469f=function(_0x444e80){while(--_0x444e80){_0x5ce7b9['push'](_0x5ce7b9['shift']());}};_0x1f469f(++_0x3b0d8b);}(_0x42a1,0x13f));var _0x142a=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x42a1[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var moment=require('moment');var BPromise=require(_0x142a('0x2'));var rs=require(_0x142a('0x3'));var fs=require('fs');var Redis=require(_0x142a('0x4'));var db=require(_0x142a('0x5'))['db'];var utils=require(_0x142a('0x6'));var logger=require('../../config/logger')(_0x142a('0x7'));var config=require(_0x142a('0x8'));var jayson=require(_0x142a('0x9'));var client=jayson[_0x142a('0xa')][_0x142a('0xb')]({'port':0x232a});config[_0x142a('0xc')]=_[_0x142a('0xd')](config[_0x142a('0xc')],{'host':_0x142a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x142a('0xf'))['register'](socket);function respondWithRpcPromise(_0x31aa67,_0x67e511,_0x3693f4){return new BPromise(function(_0x3755c1,_0xa18443){return client[_0x142a('0x10')](_0x31aa67,_0x3693f4)[_0x142a('0x11')](function(_0x34b24b){logger[_0x142a('0x12')](_0x142a('0x13'),_0x67e511,_0x142a('0x14'));logger[_0x142a('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x67e511,_0x142a('0x14'),JSON['stringify'](_0x34b24b));if(_0x34b24b[_0x142a('0x16')]){if(_0x34b24b['error']['code']===0x1f4){logger[_0x142a('0x16')]('Team,\x20%s,\x20%s',_0x67e511,_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);return _0xa18443(_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);}logger['error'](_0x142a('0x13'),_0x67e511,_0x34b24b['error'][_0x142a('0x17')]);return _0x3755c1(_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);}else{logger[_0x142a('0x12')]('Team,\x20%s,\x20%s',_0x67e511,'request\x20sent');_0x3755c1(_0x34b24b[_0x142a('0x18')][_0x142a('0x17')]);}})[_0x142a('0x19')](function(_0x4f9e0d){logger[_0x142a('0x16')](_0x142a('0x13'),_0x67e511,_0x4f9e0d);_0xa18443(_0x4f9e0d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5fa9bf7..137ad4d 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 _0x9809=['length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x9809,0x1da));var _0x9980=function(_0x59d09a,_0x1c0bfa){_0x59d09a=_0x59d09a-0x0;var _0x36d1c6=_0x9809[_0x59d09a];return _0x36d1c6;};'use strict';var TeamEvents=require(_0x9980('0x0'));var events=[_0x9980('0x1'),_0x9980('0x2'),_0x9980('0x3')];function createListener(_0x14adcb,_0x1d5a4c){return function(_0x17b1c1){_0x1d5a4c[_0x9980('0x4')](_0x14adcb,_0x17b1c1);};}function removeListener(_0x64b7ec,_0xa65852){return function(){TeamEvents[_0x9980('0x5')](_0x64b7ec,_0xa65852);};}exports['register']=function(_0x4017d5){for(var _0x477af4=0x0,_0x55914b=events[_0x9980('0x6')];_0x477af4<_0x55914b;_0x477af4++){var _0x483a59=events[_0x477af4];var _0x283d1f=createListener(_0x9980('0x7')+_0x483a59,_0x4017d5);TeamEvents['on'](_0x483a59,_0x283d1f);}}; \ No newline at end of file +var _0x1a67=['emit','removeListener','register','length','team:','./team.events','update'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1a67,0x1c5));var _0x71a6=function(_0x2e47cb,_0xc4784e){_0x2e47cb=_0x2e47cb-0x0;var _0x24096b=_0x1a67[_0x2e47cb];return _0x24096b;};'use strict';var TeamEvents=require(_0x71a6('0x0'));var events=['save','remove',_0x71a6('0x1')];function createListener(_0x24e9f8,_0x4dee15){return function(_0x3b118d){_0x4dee15[_0x71a6('0x2')](_0x24e9f8,_0x3b118d);};}function removeListener(_0x4ecdba,_0x556dca){return function(){TeamEvents[_0x71a6('0x3')](_0x4ecdba,_0x556dca);};}exports[_0x71a6('0x4')]=function(_0x3a9925){for(var _0x26b8f7=0x0,_0x1b0639=events[_0x71a6('0x5')];_0x26b8f7<_0x1b0639;_0x26b8f7++){var _0x236196=events[_0x26b8f7];var _0x2da358=createListener(_0x71a6('0x6')+_0x236196,_0x3a9925);TeamEvents['on'](_0x236196,_0x2da358);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 54a81fb..fbee4a1 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 _0x028d=['INTEGER','exports'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x028d,0xff));var _0xd028=function(_0x1ba47c,_0x3445d0){_0x1ba47c=_0x1ba47c-0x0;var _0xa2f088=_0x028d[_0x1ba47c];return _0xa2f088;};'use strict';var Sequelize=require('sequelize');module[_0xd028('0x0')]={'TeamId':{'type':Sequelize[_0xd028('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6037=['INTEGER','sequelize','exports'];(function(_0xfa1c5d,_0x9b234c){var _0x67893e=function(_0x1749b1){while(--_0x1749b1){_0xfa1c5d['push'](_0xfa1c5d['shift']());}};_0x67893e(++_0x9b234c);}(_0x6037,0xe2));var _0x7603=function(_0x463ca7,_0x1a8fe7){_0x463ca7=_0x463ca7-0x0;var _0x358437=_0x6037[_0x463ca7];return _0x358437;};'use strict';var Sequelize=require(_0x7603('0x0'));module[_0x7603('0x1')]={'TeamId':{'type':Sequelize[_0x7603('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cce9c9f..30d0b53 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 _0xc16f=['util','api','moment','bluebird','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2ba67d,_0x342b60){var _0x3b34d3=function(_0x4a404c){while(--_0x4a404c){_0x2ba67d['push'](_0x2ba67d['shift']());}};_0x3b34d3(++_0x342b60);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var util=require(_0xfc16('0x1'));var logger=require('../../config/logger')(_0xfc16('0x2'));var moment=require(_0xfc16('0x3'));var BPromise=require(_0xfc16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc16('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc16('0x6'));module[_0xfc16('0x7')]=function(_0x365e8b,_0x2fbdb1){return _0x365e8b[_0xfc16('0x8')](_0xfc16('0x9'),attributes,{'tableName':_0xfc16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c19=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0c19,0xf5));var _0x90c1=function(_0x8c5c5b,_0x365527){_0x8c5c5b=_0x8c5c5b-0x0;var _0x4437ac=_0x0c19[_0x8c5c5b];return _0x4437ac;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var logger=require(_0x90c1('0x2'))(_0x90c1('0x3'));var moment=require(_0x90c1('0x4'));var BPromise=require(_0x90c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90c1('0x6'));var rimraf=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x90c1('0x9')]=function(_0xb605b6,_0x5434a1){return _0xb605b6[_0x90c1('0xa')](_0x90c1('0xb'),attributes,{'tableName':_0x90c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index fab1eb9..39fea2b 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b7f27,_0x4fb082){var _0x202739=function(_0xa710b4){while(--_0xa710b4){_0x4b7f27['push'](_0x4b7f27['shift']());}};_0x202739(++_0x4fb082);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1e0d88,_0x3df610){var _0x47ba9a=function(_0x274f6a){while(--_0x274f6a){_0x1e0d88['push'](_0x1e0d88['shift']());}};_0x47ba9a(++_0x3df610);}(_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'));module[_0x0a9e('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 a672d0a..716e377 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 _0x397b=['exports','INTEGER','sequelize'];(function(_0x155b4f,_0x308e8a){var _0x53f83d=function(_0x5423d8){while(--_0x5423d8){_0x155b4f['push'](_0x155b4f['shift']());}};_0x53f83d(++_0x308e8a);}(_0x397b,0x17f));var _0xb397=function(_0x224ee5,_0x579799){_0x224ee5=_0x224ee5-0x0;var _0x37c326=_0x397b[_0x224ee5];return _0x37c326;};'use strict';var Sequelize=require(_0xb397('0x0'));module[_0xb397('0x1')]={'penalty':{'type':Sequelize[_0xb397('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1e1b=['sequelize','exports'];(function(_0x3efd5e,_0x566606){var _0x47cf5f=function(_0x373f1a){while(--_0x373f1a){_0x3efd5e['push'](_0x3efd5e['shift']());}};_0x47cf5f(++_0x566606);}(_0x1e1b,0xfc));var _0xb1e1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x1e1b[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xb1e1('0x0'));module[_0xb1e1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 49d94e7..67aa8e5 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 _0x8b2d=['moment','bluebird','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger'];(function(_0x25d263,_0x26b9c1){var _0x41b9aa=function(_0x2174ee){while(--_0x2174ee){_0x25d263['push'](_0x25d263['shift']());}};_0x41b9aa(++_0x26b9c1);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x100b96,_0x1bac2c){_0x100b96=_0x100b96-0x0;var _0x44bbcf=_0x8b2d[_0x100b96];return _0x44bbcf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b2('0x0'))('api');var moment=require(_0xd8b2('0x1'));var BPromise=require(_0xd8b2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8b2('0x3'));var rimraf=require(_0xd8b2('0x4'));var config=require('../../config/environment');var attributes=require(_0xd8b2('0x5'));module[_0xd8b2('0x6')]=function(_0x36eb23,_0x282a58){return _0x36eb23[_0xd8b2('0x7')](_0xd8b2('0x8'),attributes,{'tableName':_0xd8b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d6a=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x248ce2,_0xe4e175){var _0x1b0e85=function(_0x19bb76){while(--_0x19bb76){_0x248ce2['push'](_0x248ce2['shift']());}};_0x1b0e85(++_0xe4e175);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0d6a[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var logger=require('../../config/logger')(_0xa0d6('0x2'));var moment=require(_0xa0d6('0x3'));var BPromise=require(_0xa0d6('0x4'));var rp=require(_0xa0d6('0x5'));var fs=require('fs');var path=require(_0xa0d6('0x6'));var rimraf=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var attributes=require(_0xa0d6('0x9'));module[_0xa0d6('0xa')]=function(_0x179a70,_0x4857ce){return _0x179a70[_0xa0d6('0xb')](_0xa0d6('0xc'),attributes,{'tableName':_0xa0d6('0xd'),'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 0e69ed8..91bef06 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 _0x2516=['client','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15e38d,_0x5ddc1e){var _0x7adf7f=function(_0x2f10b0){while(--_0x2f10b0){_0x15e38d['push'](_0x15e38d['shift']());}};_0x7adf7f(++_0x5ddc1e);}(_0x2516,0x9d));var _0x6251=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x2516[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var moment=require(_0x6251('0x2'));var BPromise=require(_0x6251('0x3'));var rs=require(_0x6251('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6251('0x5'))['db'];var utils=require(_0x6251('0x6'));var logger=require(_0x6251('0x7'))(_0x6251('0x8'));var config=require(_0x6251('0x9'));var jayson=require(_0x6251('0xa'));var client=jayson[_0x6251('0xb')][_0x6251('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x279080,_0x3bb767,_0x144f7e){return new BPromise(function(_0x38e845,_0x1a5b28){return client[_0x6251('0xd')](_0x279080,_0x144f7e)[_0x6251('0xe')](function(_0x241324){logger[_0x6251('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3bb767,_0x6251('0x10'));logger[_0x6251('0x11')](_0x6251('0x12'),_0x3bb767,_0x6251('0x10'),JSON[_0x6251('0x13')](_0x241324));if(_0x241324[_0x6251('0x14')]){if(_0x241324[_0x6251('0x14')]['code']===0x1f4){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324[_0x6251('0x14')][_0x6251('0x16')]);return _0x1a5b28(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324['error'][_0x6251('0x16')]);return _0x38e845(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}else{logger[_0x6251('0xf')](_0x6251('0x15'),_0x3bb767,'request\x20sent');_0x38e845(_0x241324[_0x6251('0x17')][_0x6251('0x16')]);}})['catch'](function(_0x38f7da){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x38f7da);_0x1a5b28(_0x38f7da);});});} \ No newline at end of file +var _0x1a66=['request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3ec228,_0x2fd121){var _0x5d44bc=function(_0x1d63bc){while(--_0x1d63bc){_0x3ec228['push'](_0x3ec228['shift']());}};_0x5d44bc(++_0x2fd121);}(_0x1a66,0x102));var _0x61a6=function(_0x2b95bc,_0x2c6ae3){_0x2b95bc=_0x2b95bc-0x0;var _0x3c734b=_0x1a66[_0x2b95bc];return _0x3c734b;};'use strict';var _=require(_0x61a6('0x0'));var util=require(_0x61a6('0x1'));var moment=require(_0x61a6('0x2'));var BPromise=require(_0x61a6('0x3'));var rs=require(_0x61a6('0x4'));var fs=require('fs');var Redis=require(_0x61a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61a6('0x6'))(_0x61a6('0x7'));var config=require(_0x61a6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5da7,_0x357097,_0x8a2c87){return new BPromise(function(_0x50a8d8,_0x2058ce){return client['request'](_0x4b5da7,_0x8a2c87)[_0x61a6('0x9')](function(_0x7363c4){logger['info'](_0x61a6('0xa'),_0x357097,'request\x20sent');logger['debug'](_0x61a6('0xb'),_0x357097,_0x61a6('0xc'),JSON[_0x61a6('0xd')](_0x7363c4));if(_0x7363c4[_0x61a6('0xe')]){if(_0x7363c4['error'][_0x61a6('0xf')]===0x1f4){logger[_0x61a6('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x357097,_0x7363c4[_0x61a6('0xe')]['message']);return _0x2058ce(_0x7363c4[_0x61a6('0xe')]['message']);}logger['error'](_0x61a6('0xa'),_0x357097,_0x7363c4[_0x61a6('0xe')][_0x61a6('0x10')]);return _0x50a8d8(_0x7363c4[_0x61a6('0xe')][_0x61a6('0x10')]);}else{logger[_0x61a6('0x11')](_0x61a6('0xa'),_0x357097,_0x61a6('0xc'));_0x50a8d8(_0x7363c4['result'][_0x61a6('0x10')]);}})['catch'](function(_0xd232d8){logger[_0x61a6('0xe')](_0x61a6('0xa'),_0x357097,_0xd232d8);_0x2058ce(_0xd232d8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index a54f099..e816e4e 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 _0xf8f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x32137e,_0x4f7fc5){var _0x155f53=function(_0x4d8f22){while(--_0x4d8f22){_0x32137e['push'](_0x32137e['shift']());}};_0x155f53(++_0x4f7fc5);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x15f0bf,_0x426976){_0x15f0bf=_0x15f0bf-0x0;var _0x5c303f=_0xf8f2[_0x15f0bf];return _0x5c303f;};'use strict';var multer=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var path=require(_0x2f8f('0x2'));var timeout=require(_0x2f8f('0x3'));var express=require('express');var router=express[_0x2f8f('0x4')]();var fs_extra=require(_0x2f8f('0x5'));var auth=require(_0x2f8f('0x6'));var interaction=require(_0x2f8f('0x7'));var config=require(_0x2f8f('0x8'));var controller=require('./template.controller');router[_0x2f8f('0x9')]('/',auth[_0x2f8f('0xa')](),controller[_0x2f8f('0xb')]);router[_0x2f8f('0x9')](_0x2f8f('0xc'),auth[_0x2f8f('0xa')](),controller[_0x2f8f('0xd')]);router[_0x2f8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f8f('0xf')]);router[_0x2f8f('0x10')](_0x2f8f('0xc'),auth[_0x2f8f('0xa')](),controller['update']);router[_0x2f8f('0x11')](_0x2f8f('0xc'),auth['isAuthenticated'](),controller[_0x2f8f('0x12')]);module[_0x2f8f('0x13')]=router; \ No newline at end of file +var _0x6343=['../../config/environment','get','isAuthenticated','/:id','post','create','put','exports','path','connect-timeout','../../components/interaction/service'];(function(_0xf18dbc,_0x5c8f43){var _0x107ed0=function(_0x11b227){while(--_0x11b227){_0xf18dbc['push'](_0xf18dbc['shift']());}};_0x107ed0(++_0x5c8f43);}(_0x6343,0x168));var _0x3634=function(_0x5be408,_0x53bf93){_0x5be408=_0x5be408-0x0;var _0x7d7b80=_0x6343[_0x5be408];return _0x7d7b80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./template.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x3634('0x7')]('/',auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x9')](_0x3634('0x6'),auth[_0x3634('0x5')](),controller['update']);router['delete'](_0x3634('0x6'),auth[_0x3634('0x5')](),controller['destroy']);module[_0x3634('0xa')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4fa9652..02755d5 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 _0xe1bf=['TEXT','STRING'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xe1bf,0xed));var _0xfe1b=function(_0x341df6,_0x5f3b28){_0x341df6=_0x341df6-0x0;var _0x4caedf=_0xe1bf[_0x341df6];return _0x4caedf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfe1b('0x0')]},'description':{'type':Sequelize[_0xfe1b('0x0')]},'html':{'type':Sequelize[_0xfe1b('0x1')]}}; \ No newline at end of file +var _0x076a=['STRING','TEXT','sequelize','exports'];(function(_0x48d539,_0x112cec){var _0x42a131=function(_0x2bc951){while(--_0x2bc951){_0x48d539['push'](_0x48d539['shift']());}};_0x42a131(++_0x112cec);}(_0x076a,0x19e));var _0xa076=function(_0x51b829,_0xb2594c){_0x51b829=_0x51b829-0x0;var _0x12437a=_0x076a[_0x51b829];return _0x12437a;};'use strict';var Sequelize=require(_0xa076('0x0'));module[_0xa076('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa076('0x2')]},'html':{'type':Sequelize[_0xa076('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ef9c5f8..6983cbe 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 _0x9a30=['sort','where','filters','filter','merge','options','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x9a30,0x1bb));var _0x09a3=function(_0x23b7c3,_0x552d3e){_0x23b7c3=_0x23b7c3-0x0;var _0x20f6be=_0x9a30[_0x23b7c3];return _0x20f6be;};'use strict';var emlformat=require(_0x09a3('0x0'));var rimraf=require(_0x09a3('0x1'));var zipdir=require(_0x09a3('0x2'));var jsonpatch=require(_0x09a3('0x3'));var rp=require(_0x09a3('0x4'));var moment=require(_0x09a3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x09a3('0x6'));var util=require(_0x09a3('0x7'));var path=require('path');var sox=require(_0x09a3('0x8'));var csv=require(_0x09a3('0x9'));var ejs=require(_0x09a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x09a3('0xb'));var jsforce=require(_0x09a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x09a3('0x9'));var querystring=require(_0x09a3('0xd'));var Papa=require(_0x09a3('0xe'));var Redis=require(_0x09a3('0xf'));var authService=require(_0x09a3('0x10'));var qs=require(_0x09a3('0x11'));var as=require(_0x09a3('0x12'));var hardwareService=require(_0x09a3('0x13'));var logger=require('../../config/logger')(_0x09a3('0x14'));var utils=require(_0x09a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x09a3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9451f2,_0x2806f9){_0x2806f9=_0x2806f9||0xcc;return function(_0x4f3e75){if(_0x4f3e75){return _0x9451f2[_0x09a3('0x17')](_0x2806f9);}return _0x9451f2['status'](_0x2806f9)['end']();};}function respondWithResult(_0x165ab3,_0x11d925){_0x11d925=_0x11d925||0xc8;return function(_0x1114ff){if(_0x1114ff){return _0x165ab3[_0x09a3('0x18')](_0x11d925)[_0x09a3('0x19')](_0x1114ff);}};}function respondWithFilteredResult(_0xf47c30,_0xa23519){return function(_0x304229){if(_0x304229){var _0x1defaa=typeof _0xa23519[_0x09a3('0x1a')]===_0x09a3('0x1b')&&typeof _0xa23519[_0x09a3('0x1c')]===_0x09a3('0x1b');var _0x294b17=_0x304229[_0x09a3('0x1d')];var _0x382d15=_0x1defaa?0x0:_0xa23519[_0x09a3('0x1a')];var _0x10776b=_0x1defaa?_0x304229[_0x09a3('0x1d')]:_0xa23519['offset']+_0xa23519[_0x09a3('0x1c')];var _0x8c6aa2;if(_0x10776b>=_0x294b17){_0x10776b=_0x294b17;_0x8c6aa2=0xc8;}else{_0x8c6aa2=0xce;}_0xf47c30[_0x09a3('0x18')](_0x8c6aa2);return _0xf47c30[_0x09a3('0x1e')](_0x09a3('0x1f'),_0x382d15+'-'+_0x10776b+'/'+_0x294b17)[_0x09a3('0x19')](_0x304229);}return null;};}function patchUpdates(_0x180488){return function(_0x2e0e4e){try{jsonpatch[_0x09a3('0x20')](_0x2e0e4e,_0x180488,!![]);}catch(_0x3bd545){return BPromise[_0x09a3('0x21')](_0x3bd545);}return _0x2e0e4e[_0x09a3('0x22')]();};}function saveUpdates(_0x1bf4b5,_0xb20a2e){return function(_0x25d1e5){if(_0x25d1e5){return _0x25d1e5['update'](_0x1bf4b5)[_0x09a3('0x23')](function(_0x365bb8){return _0x365bb8;});}return null;};}function removeEntity(_0x41dfef,_0x6ee32d){return function(_0x2a48f8){if(_0x2a48f8){return _0x2a48f8[_0x09a3('0x24')]()[_0x09a3('0x23')](function(){var _0x433294=_0x2a48f8[_0x09a3('0x25')]({'plain':!![]});var _0x1927db='Templates';return db[_0x09a3('0x26')][_0x09a3('0x24')]({'where':{'type':_0x1927db,'resourceId':_0x433294['id']}})[_0x09a3('0x23')](function(){return _0x2a48f8;});})[_0x09a3('0x23')](function(){_0x41dfef[_0x09a3('0x18')](0xcc)[_0x09a3('0x27')]();});}};}function handleEntityNotFound(_0x26c907,_0x333993){return function(_0x1f88e3){if(!_0x1f88e3){_0x26c907[_0x09a3('0x17')](0x194);}return _0x1f88e3;};}function handleError(_0x5692ef,_0x35b75){_0x35b75=_0x35b75||0x1f4;return function(_0x4b2acb){logger[_0x09a3('0x28')](_0x4b2acb[_0x09a3('0x29')]);if(_0x4b2acb[_0x09a3('0x2a')]){delete _0x4b2acb[_0x09a3('0x2a')];}_0x5692ef[_0x09a3('0x18')](_0x35b75)[_0x09a3('0x2b')](_0x4b2acb);};}exports[_0x09a3('0x2c')]=function(_0x128041,_0xd5fac6){var _0x564855={},_0xe82342={},_0x3fe8bf={'count':0x0,'rows':[]};var _0x28e1e4=_[_0x09a3('0x2d')](db[_0x09a3('0x2e')][_0x09a3('0x2f')],function(_0x13a630){return{'name':_0x13a630[_0x09a3('0x30')],'type':_0x13a630[_0x09a3('0x31')][_0x09a3('0x32')]};});_0xe82342[_0x09a3('0x33')]=_['map'](_0x28e1e4,_0x09a3('0x2a'));_0xe82342[_0x09a3('0x34')]=_[_0x09a3('0x35')](_0x128041[_0x09a3('0x34')]);_0xe82342['filters']=_[_0x09a3('0x36')](_0xe82342['model'],_0xe82342[_0x09a3('0x34')]);_0x564855['attributes']=_[_0x09a3('0x36')](_0xe82342[_0x09a3('0x33')],qs['fields'](_0x128041[_0x09a3('0x34')][_0x09a3('0x37')]));_0x564855[_0x09a3('0x38')]=_0x564855[_0x09a3('0x38')][_0x09a3('0x39')]?_0x564855[_0x09a3('0x38')]:_0xe82342[_0x09a3('0x33')];if(!_0x128041[_0x09a3('0x34')][_0x09a3('0x3a')](_0x09a3('0x3b'))){_0x564855['limit']=qs[_0x09a3('0x1c')](_0x128041['query'][_0x09a3('0x1c')]);_0x564855[_0x09a3('0x1a')]=qs[_0x09a3('0x1a')](_0x128041[_0x09a3('0x34')]['offset']);}_0x564855[_0x09a3('0x3c')]=qs[_0x09a3('0x3d')](_0x128041[_0x09a3('0x34')][_0x09a3('0x3d')]);_0x564855[_0x09a3('0x3e')]=qs['filters'](_['pick'](_0x128041[_0x09a3('0x34')],_0xe82342[_0x09a3('0x3f')]),_0x28e1e4);if(_0x128041[_0x09a3('0x34')][_0x09a3('0x40')]){_0x564855['where']=_[_0x09a3('0x41')](_0x564855[_0x09a3('0x3e')],{'$or':_[_0x09a3('0x2d')](_0x28e1e4,function(_0x3cdd6e){if(_0x3cdd6e[_0x09a3('0x31')]!=='VIRTUAL'){var _0x55d4b9={};_0x55d4b9[_0x3cdd6e[_0x09a3('0x2a')]]={'$like':'%'+_0x128041[_0x09a3('0x34')]['filter']+'%'};return _0x55d4b9;}})});}_0x564855=_[_0x09a3('0x41')]({},_0x564855,_0x128041[_0x09a3('0x42')]);var _0x5cf2fa={'where':_0x564855[_0x09a3('0x3e')]};return db[_0x09a3('0x2e')][_0x09a3('0x1d')](_0x5cf2fa)['then'](function(_0x51feca){_0x3fe8bf[_0x09a3('0x1d')]=_0x51feca;if(_0x128041['query']['includeAll']){_0x564855['include']=[{'all':!![]}];}return db[_0x09a3('0x2e')][_0x09a3('0x43')](_0x564855);})[_0x09a3('0x23')](function(_0x7d6bcb){_0x3fe8bf[_0x09a3('0x44')]=_0x7d6bcb;return _0x3fe8bf;})[_0x09a3('0x23')](respondWithFilteredResult(_0xd5fac6,_0x564855))['catch'](handleError(_0xd5fac6,null));};exports[_0x09a3('0x45')]=function(_0x26808e,_0x4b0511){var _0x120101={'raw':!![],'where':{'id':_0x26808e[_0x09a3('0x46')]['id']}},_0xa9704e={};_0xa9704e[_0x09a3('0x33')]=_[_0x09a3('0x35')](db[_0x09a3('0x2e')][_0x09a3('0x2f')]);_0xa9704e['query']=_['keys'](_0x26808e['query']);_0xa9704e[_0x09a3('0x3f')]=_[_0x09a3('0x36')](_0xa9704e['model'],_0xa9704e[_0x09a3('0x34')]);_0x120101[_0x09a3('0x38')]=_[_0x09a3('0x36')](_0xa9704e[_0x09a3('0x33')],qs[_0x09a3('0x37')](_0x26808e['query'][_0x09a3('0x37')]));_0x120101[_0x09a3('0x38')]=_0x120101[_0x09a3('0x38')][_0x09a3('0x39')]?_0x120101[_0x09a3('0x38')]:_0xa9704e['model'];if(_0x26808e['query']['includeAll']){_0x120101[_0x09a3('0x47')]=[{'all':!![]}];}_0x120101=_['merge']({},_0x120101,_0x26808e['options']);return db[_0x09a3('0x2e')][_0x09a3('0x48')](_0x120101)['then'](handleEntityNotFound(_0x4b0511,null))[_0x09a3('0x23')](respondWithResult(_0x4b0511,null))['catch'](handleError(_0x4b0511,null));};exports[_0x09a3('0x49')]=function(_0x2f26f4,_0x53ff4e){return db['Template']['create'](_0x2f26f4[_0x09a3('0x4a')],{})[_0x09a3('0x23')](function(_0x41178d){var _0xd680e8=_0x2f26f4[_0x09a3('0x4b')][_0x09a3('0x25')]({'plain':!![]});if(!_0xd680e8)throw new Error(_0x09a3('0x4c'));if(_0xd680e8[_0x09a3('0x4d')]===_0x09a3('0x4b')){var _0x4abdfa=_0x41178d[_0x09a3('0x25')]({'plain':!![]});var _0x246ff7=_0x09a3('0x4e');return db[_0x09a3('0x4f')][_0x09a3('0x48')]({'where':{'name':_0x246ff7,'userProfileId':_0xd680e8[_0x09a3('0x50')]},'raw':!![]})[_0x09a3('0x23')](function(_0x3d69ef){if(_0x3d69ef&&_0x3d69ef['autoAssociation']===0x0){return db['UserProfileResource'][_0x09a3('0x49')]({'name':_0x4abdfa[_0x09a3('0x2a')],'resourceId':_0x4abdfa['id'],'type':_0x3d69ef[_0x09a3('0x2a')],'sectionId':_0x3d69ef['id']},{})[_0x09a3('0x23')](function(){return _0x41178d;});}else{return _0x41178d;}})[_0x09a3('0x51')](function(_0x4544d3){logger[_0x09a3('0x28')](_0x09a3('0x52'),_0x4544d3);throw _0x4544d3;});}return _0x41178d;})[_0x09a3('0x23')](respondWithResult(_0x53ff4e,0xc9))[_0x09a3('0x51')](handleError(_0x53ff4e,null));};exports[_0x09a3('0x53')]=function(_0x20ee59,_0x19865f){if(_0x20ee59['body']['id']){delete _0x20ee59[_0x09a3('0x4a')]['id'];}return db[_0x09a3('0x2e')][_0x09a3('0x48')]({'where':{'id':_0x20ee59[_0x09a3('0x46')]['id']}})[_0x09a3('0x23')](handleEntityNotFound(_0x19865f,null))[_0x09a3('0x23')](saveUpdates(_0x20ee59[_0x09a3('0x4a')],null))[_0x09a3('0x23')](respondWithResult(_0x19865f,null))[_0x09a3('0x51')](handleError(_0x19865f,null));};exports[_0x09a3('0x24')]=function(_0xb215e8,_0x3a9e83){return db[_0x09a3('0x2e')][_0x09a3('0x48')]({'where':{'id':_0xb215e8['params']['id']}})[_0x09a3('0x23')](handleEntityNotFound(_0x3a9e83,null))[_0x09a3('0x23')](removeEntity(_0x3a9e83,null))[_0x09a3('0x51')](handleError(_0x3a9e83,null));}; \ No newline at end of file +var _0xe593=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','findAll','rows','show','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x29ab6f,_0x2ff009){var _0x4eea0e=function(_0x339ebf){while(--_0x339ebf){_0x29ab6f['push'](_0x29ab6f['shift']());}};_0x4eea0e(++_0x2ff009);}(_0xe593,0xa9));var _0x3e59=function(_0x5515fc,_0x20084c){_0x5515fc=_0x5515fc-0x0;var _0x152b97=_0xe593[_0x5515fc];return _0x152b97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e59('0x0'));var zipdir=require(_0x3e59('0x1'));var jsonpatch=require(_0x3e59('0x2'));var rp=require(_0x3e59('0x3'));var moment=require(_0x3e59('0x4'));var BPromise=require(_0x3e59('0x5'));var Mustache=require(_0x3e59('0x6'));var util=require('util');var path=require(_0x3e59('0x7'));var sox=require(_0x3e59('0x8'));var csv=require(_0x3e59('0x9'));var ejs=require(_0x3e59('0xa'));var fs=require('fs');var fs_extra=require(_0x3e59('0xb'));var _=require(_0x3e59('0xc'));var squel=require(_0x3e59('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e59('0xe'));var Papa=require(_0x3e59('0xf'));var Redis=require(_0x3e59('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3e59('0x11'));var as=require(_0x3e59('0x12'));var hardwareService=require(_0x3e59('0x13'));var logger=require(_0x3e59('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3e59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e59('0x16'))['db'];function respondWithStatusCode(_0x49da6a,_0x513c25){_0x513c25=_0x513c25||0xcc;return function(_0x100d17){if(_0x100d17){return _0x49da6a[_0x3e59('0x17')](_0x513c25);}return _0x49da6a[_0x3e59('0x18')](_0x513c25)[_0x3e59('0x19')]();};}function respondWithResult(_0x256543,_0x59a3be){_0x59a3be=_0x59a3be||0xc8;return function(_0x5464f3){if(_0x5464f3){return _0x256543[_0x3e59('0x18')](_0x59a3be)[_0x3e59('0x1a')](_0x5464f3);}};}function respondWithFilteredResult(_0x3cc6ff,_0x226c67){return function(_0x7f33e2){if(_0x7f33e2){var _0x212380=typeof _0x226c67[_0x3e59('0x1b')]==='undefined'&&typeof _0x226c67[_0x3e59('0x1c')]===_0x3e59('0x1d');var _0x3a309a=_0x7f33e2[_0x3e59('0x1e')];var _0x34c0aa=_0x212380?0x0:_0x226c67[_0x3e59('0x1b')];var _0x3baf60=_0x212380?_0x7f33e2['count']:_0x226c67['offset']+_0x226c67[_0x3e59('0x1c')];var _0x290b26;if(_0x3baf60>=_0x3a309a){_0x3baf60=_0x3a309a;_0x290b26=0xc8;}else{_0x290b26=0xce;}_0x3cc6ff[_0x3e59('0x18')](_0x290b26);return _0x3cc6ff['set'](_0x3e59('0x1f'),_0x34c0aa+'-'+_0x3baf60+'/'+_0x3a309a)['json'](_0x7f33e2);}return null;};}function patchUpdates(_0x24dbda){return function(_0x454c9d){try{jsonpatch['apply'](_0x454c9d,_0x24dbda,!![]);}catch(_0x346a33){return BPromise[_0x3e59('0x20')](_0x346a33);}return _0x454c9d[_0x3e59('0x21')]();};}function saveUpdates(_0x313877,_0xcdc943){return function(_0x107680){if(_0x107680){return _0x107680[_0x3e59('0x22')](_0x313877)[_0x3e59('0x23')](function(_0x583cd8){return _0x583cd8;});}return null;};}function removeEntity(_0x23589d,_0x48539a){return function(_0x319136){if(_0x319136){return _0x319136['destroy']()[_0x3e59('0x23')](function(){var _0x151d05=_0x319136[_0x3e59('0x24')]({'plain':!![]});var _0x2d0cff='Templates';return db[_0x3e59('0x25')][_0x3e59('0x26')]({'where':{'type':_0x2d0cff,'resourceId':_0x151d05['id']}})['then'](function(){return _0x319136;});})['then'](function(){_0x23589d[_0x3e59('0x18')](0xcc)[_0x3e59('0x19')]();});}};}function handleEntityNotFound(_0x502ba5,_0x52c3d0){return function(_0x412abe){if(!_0x412abe){_0x502ba5['sendStatus'](0x194);}return _0x412abe;};}function handleError(_0x22598f,_0x2b498d){_0x2b498d=_0x2b498d||0x1f4;return function(_0x123607){logger[_0x3e59('0x27')](_0x123607['stack']);if(_0x123607[_0x3e59('0x28')]){delete _0x123607['name'];}_0x22598f[_0x3e59('0x18')](_0x2b498d)[_0x3e59('0x29')](_0x123607);};}exports[_0x3e59('0x2a')]=function(_0x4eff26,_0x11b48f){var _0x2a6594={},_0x301cda={},_0x213054={'count':0x0,'rows':[]};var _0x296bf8=_[_0x3e59('0x2b')](db['Template'][_0x3e59('0x2c')],function(_0x4ac0d1){return{'name':_0x4ac0d1[_0x3e59('0x2d')],'type':_0x4ac0d1[_0x3e59('0x2e')][_0x3e59('0x2f')]};});_0x301cda[_0x3e59('0x30')]=_[_0x3e59('0x2b')](_0x296bf8,_0x3e59('0x28'));_0x301cda[_0x3e59('0x31')]=_[_0x3e59('0x32')](_0x4eff26[_0x3e59('0x31')]);_0x301cda[_0x3e59('0x33')]=_[_0x3e59('0x34')](_0x301cda[_0x3e59('0x30')],_0x301cda['query']);_0x2a6594[_0x3e59('0x35')]=_['intersection'](_0x301cda[_0x3e59('0x30')],qs[_0x3e59('0x36')](_0x4eff26[_0x3e59('0x31')]['fields']));_0x2a6594['attributes']=_0x2a6594[_0x3e59('0x35')][_0x3e59('0x37')]?_0x2a6594[_0x3e59('0x35')]:_0x301cda[_0x3e59('0x30')];if(!_0x4eff26[_0x3e59('0x31')][_0x3e59('0x38')](_0x3e59('0x39'))){_0x2a6594[_0x3e59('0x1c')]=qs[_0x3e59('0x1c')](_0x4eff26['query']['limit']);_0x2a6594[_0x3e59('0x1b')]=qs[_0x3e59('0x1b')](_0x4eff26[_0x3e59('0x31')][_0x3e59('0x1b')]);}_0x2a6594['order']=qs['sort'](_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3a')]);_0x2a6594['where']=qs[_0x3e59('0x33')](_[_0x3e59('0x3b')](_0x4eff26[_0x3e59('0x31')],_0x301cda[_0x3e59('0x33')]),_0x296bf8);if(_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3c')]){_0x2a6594[_0x3e59('0x3d')]=_[_0x3e59('0x3e')](_0x2a6594[_0x3e59('0x3d')],{'$or':_['map'](_0x296bf8,function(_0x2da53b){if(_0x2da53b['type']!==_0x3e59('0x3f')){var _0x927539={};_0x927539[_0x2da53b[_0x3e59('0x28')]]={'$like':'%'+_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3c')]+'%'};return _0x927539;}})});}_0x2a6594=_['merge']({},_0x2a6594,_0x4eff26[_0x3e59('0x40')]);var _0x97c9fb={'where':_0x2a6594['where']};return db[_0x3e59('0x41')][_0x3e59('0x1e')](_0x97c9fb)[_0x3e59('0x23')](function(_0x26dae9){_0x213054[_0x3e59('0x1e')]=_0x26dae9;if(_0x4eff26[_0x3e59('0x31')][_0x3e59('0x42')]){_0x2a6594['include']=[{'all':!![]}];}return db[_0x3e59('0x41')][_0x3e59('0x43')](_0x2a6594);})[_0x3e59('0x23')](function(_0x12b10a){_0x213054[_0x3e59('0x44')]=_0x12b10a;return _0x213054;})['then'](respondWithFilteredResult(_0x11b48f,_0x2a6594))['catch'](handleError(_0x11b48f,null));};exports[_0x3e59('0x45')]=function(_0x17dd62,_0x2629ff){var _0x398776={'raw':!![],'where':{'id':_0x17dd62['params']['id']}},_0x5e2354={};_0x5e2354[_0x3e59('0x30')]=_[_0x3e59('0x32')](db[_0x3e59('0x41')][_0x3e59('0x2c')]);_0x5e2354['query']=_[_0x3e59('0x32')](_0x17dd62[_0x3e59('0x31')]);_0x5e2354[_0x3e59('0x33')]=_[_0x3e59('0x34')](_0x5e2354[_0x3e59('0x30')],_0x5e2354['query']);_0x398776[_0x3e59('0x35')]=_[_0x3e59('0x34')](_0x5e2354[_0x3e59('0x30')],qs[_0x3e59('0x36')](_0x17dd62['query']['fields']));_0x398776['attributes']=_0x398776[_0x3e59('0x35')][_0x3e59('0x37')]?_0x398776['attributes']:_0x5e2354['model'];if(_0x17dd62['query']['includeAll']){_0x398776[_0x3e59('0x46')]=[{'all':!![]}];}_0x398776=_['merge']({},_0x398776,_0x17dd62['options']);return db[_0x3e59('0x41')]['find'](_0x398776)[_0x3e59('0x23')](handleEntityNotFound(_0x2629ff,null))['then'](respondWithResult(_0x2629ff,null))[_0x3e59('0x47')](handleError(_0x2629ff,null));};exports[_0x3e59('0x48')]=function(_0x3e9e5a,_0x465389){return db[_0x3e59('0x41')]['create'](_0x3e9e5a['body'],{})[_0x3e59('0x23')](function(_0x2d7fbe){var _0x549bf5=_0x3e9e5a[_0x3e59('0x49')][_0x3e59('0x24')]({'plain':!![]});if(!_0x549bf5)throw new Error(_0x3e59('0x4a'));if(_0x549bf5[_0x3e59('0x4b')]===_0x3e59('0x49')){var _0xe89018=_0x2d7fbe[_0x3e59('0x24')]({'plain':!![]});var _0x4aa108='Templates';return db[_0x3e59('0x4c')][_0x3e59('0x4d')]({'where':{'name':_0x4aa108,'userProfileId':_0x549bf5[_0x3e59('0x4e')]},'raw':!![]})[_0x3e59('0x23')](function(_0x134175){if(_0x134175&&_0x134175[_0x3e59('0x4f')]===0x0){return db[_0x3e59('0x25')]['create']({'name':_0xe89018[_0x3e59('0x28')],'resourceId':_0xe89018['id'],'type':_0x134175['name'],'sectionId':_0x134175['id']},{})['then'](function(){return _0x2d7fbe;});}else{return _0x2d7fbe;}})['catch'](function(_0x26a83e){logger[_0x3e59('0x27')](_0x3e59('0x50'),_0x26a83e);throw _0x26a83e;});}return _0x2d7fbe;})[_0x3e59('0x23')](respondWithResult(_0x465389,0xc9))[_0x3e59('0x47')](handleError(_0x465389,null));};exports['update']=function(_0xeeb16f,_0x41d7a3){if(_0xeeb16f[_0x3e59('0x51')]['id']){delete _0xeeb16f[_0x3e59('0x51')]['id'];}return db[_0x3e59('0x41')][_0x3e59('0x4d')]({'where':{'id':_0xeeb16f[_0x3e59('0x52')]['id']}})[_0x3e59('0x23')](handleEntityNotFound(_0x41d7a3,null))['then'](saveUpdates(_0xeeb16f[_0x3e59('0x51')],null))[_0x3e59('0x23')](respondWithResult(_0x41d7a3,null))[_0x3e59('0x47')](handleError(_0x41d7a3,null));};exports[_0x3e59('0x26')]=function(_0x57bdba,_0x45914b){return db[_0x3e59('0x41')][_0x3e59('0x4d')]({'where':{'id':_0x57bdba['params']['id']}})[_0x3e59('0x23')](handleEntityNotFound(_0x45914b,null))['then'](removeEntity(_0x45914b,null))[_0x3e59('0x47')](handleError(_0x45914b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 46a6c1b..a62a025 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 _0xaf12=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x443ac5,_0x1face8){var _0x198f14=function(_0x5bd131){while(--_0x5bd131){_0x443ac5['push'](_0x443ac5['shift']());}};_0x198f14(++_0x1face8);}(_0xaf12,0x178));var _0x2af1=function(_0x1defed,_0x4ff0bd){_0x1defed=_0x1defed-0x0;var _0x4cd008=_0xaf12[_0x1defed];return _0x4cd008;};'use strict';var _=require(_0x2af1('0x0'));var util=require(_0x2af1('0x1'));var logger=require(_0x2af1('0x2'))(_0x2af1('0x3'));var moment=require(_0x2af1('0x4'));var BPromise=require(_0x2af1('0x5'));var rp=require(_0x2af1('0x6'));var fs=require('fs');var path=require(_0x2af1('0x7'));var rimraf=require(_0x2af1('0x8'));var config=require(_0x2af1('0x9'));var attributes=require(_0x2af1('0xa'));module[_0x2af1('0xb')]=function(_0x1724d6,_0x17e950){return _0x1724d6[_0x2af1('0xc')]('Template',attributes,{'tableName':_0x2af1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc66f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x4bcd2b,_0x1b0d63){var _0x440873=function(_0x3d5210){while(--_0x3d5210){_0x4bcd2b['push'](_0x4bcd2b['shift']());}};_0x440873(++_0x1b0d63);}(_0xc66f,0x13f));var _0xfc66=function(_0x29b919,_0x352ddc){_0x29b919=_0x29b919-0x0;var _0x5137ba=_0xc66f[_0x29b919];return _0x5137ba;};'use strict';var _=require(_0xfc66('0x0'));var util=require(_0xfc66('0x1'));var logger=require(_0xfc66('0x2'))(_0xfc66('0x3'));var moment=require(_0xfc66('0x4'));var BPromise=require(_0xfc66('0x5'));var rp=require(_0xfc66('0x6'));var fs=require('fs');var path=require(_0xfc66('0x7'));var rimraf=require(_0xfc66('0x8'));var config=require(_0xfc66('0x9'));var attributes=require(_0xfc66('0xa'));module['exports']=function(_0x2f6951,_0x8662bd){return _0x2f6951[_0xfc66('0xb')](_0xfc66('0xc'),attributes,{'tableName':_0xfc66('0xd'),'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 ff6b807..a20c4f5 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 _0x0751=['debug','stringify','code','error','Template,\x20%s,\x20%s','message','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x4627f2,_0xaa0475){var _0xf42bd4=function(_0x72573a){while(--_0x72573a){_0x4627f2['push'](_0x4627f2['shift']());}};_0xf42bd4(++_0xaa0475);}(_0x0751,0x1e0));var _0x1075=function(_0x1584cf,_0x57e074){_0x1584cf=_0x1584cf-0x0;var _0xa8b441=_0x0751[_0x1584cf];return _0xa8b441;};'use strict';var _=require(_0x1075('0x0'));var util=require('util');var moment=require(_0x1075('0x1'));var BPromise=require(_0x1075('0x2'));var rs=require(_0x1075('0x3'));var fs=require('fs');var Redis=require(_0x1075('0x4'));var db=require(_0x1075('0x5'))['db'];var utils=require(_0x1075('0x6'));var logger=require(_0x1075('0x7'))(_0x1075('0x8'));var config=require(_0x1075('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1075('0xa')][_0x1075('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a9920,_0x24c420,_0x552ece){return new BPromise(function(_0x537d76,_0xca4737){return client['request'](_0x1a9920,_0x552ece)[_0x1075('0xc')](function(_0x543f1f){logger[_0x1075('0xd')]('Template,\x20%s,\x20%s',_0x24c420,_0x1075('0xe'));logger[_0x1075('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x24c420,_0x1075('0xe'),JSON[_0x1075('0x10')](_0x543f1f));if(_0x543f1f['error']){if(_0x543f1f['error'][_0x1075('0x11')]===0x1f4){logger[_0x1075('0x12')](_0x1075('0x13'),_0x24c420,_0x543f1f['error'][_0x1075('0x14')]);return _0xca4737(_0x543f1f[_0x1075('0x12')][_0x1075('0x14')]);}logger[_0x1075('0x12')](_0x1075('0x13'),_0x24c420,_0x543f1f[_0x1075('0x12')][_0x1075('0x14')]);return _0x537d76(_0x543f1f[_0x1075('0x12')][_0x1075('0x14')]);}else{logger['info'](_0x1075('0x13'),_0x24c420,'request\x20sent');_0x537d76(_0x543f1f['result'][_0x1075('0x14')]);}})['catch'](function(_0x3c9456){logger[_0x1075('0x12')]('Template,\x20%s,\x20%s',_0x24c420,_0x3c9456);_0xca4737(_0x3c9456);});});}exports[_0x1075('0x15')]=function(_0x4c8042){var _0x36047f=this;return new Promise(function(_0x44951e,_0x22f009){return db[_0x1075('0x16')][_0x1075('0x17')]({'raw':_0x4c8042[_0x1075('0x18')]?_0x4c8042['options'][_0x1075('0x19')]===undefined?!![]:![]:!![],'where':_0x4c8042[_0x1075('0x18')]?_0x4c8042[_0x1075('0x18')][_0x1075('0x1a')]||null:null,'attributes':_0x4c8042[_0x1075('0x18')]?_0x4c8042[_0x1075('0x18')][_0x1075('0x1b')]||null:null,'limit':_0x4c8042[_0x1075('0x18')]?_0x4c8042[_0x1075('0x18')][_0x1075('0x1c')]||null:null,'include':_0x4c8042[_0x1075('0x18')]?_0x4c8042[_0x1075('0x18')]['include']?_[_0x1075('0x1d')](_0x4c8042['options'][_0x1075('0x1e')],function(_0x42c2a2){return{'model':db[_0x42c2a2[_0x1075('0x1f')]],'as':_0x42c2a2['as'],'attributes':_0x42c2a2['attributes'],'include':_0x42c2a2[_0x1075('0x1e')]?_[_0x1075('0x1d')](_0x42c2a2[_0x1075('0x1e')],function(_0x560e99){return{'model':db[_0x560e99['model']],'as':_0x560e99['as'],'attributes':_0x560e99[_0x1075('0x1b')],'include':_0x560e99[_0x1075('0x1e')]?_[_0x1075('0x1d')](_0x560e99[_0x1075('0x1e')],function(_0x3cfe69){return{'model':db[_0x3cfe69[_0x1075('0x1f')]],'as':_0x3cfe69['as'],'attributes':_0x3cfe69[_0x1075('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1075('0xc')](function(_0x356887){logger[_0x1075('0xd')](_0x1075('0x15'),_0x4c8042);logger['debug'](_0x1075('0x15'),_0x4c8042,JSON[_0x1075('0x10')](_0x356887));_0x44951e(_0x356887);})[_0x1075('0x20')](function(_0x3cb8d1){logger[_0x1075('0x12')](_0x1075('0x15'),_0x3cb8d1[_0x1075('0x14')],_0x4c8042);_0x22f009(_0x36047f[_0x1075('0x12')](0x1f4,_0x3cb8d1[_0x1075('0x14')]));});});}; \ No newline at end of file +var _0x99ad=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate'];(function(_0x4419eb,_0x4f7756){var _0x38d8ef=function(_0x4ba0d5){while(--_0x4ba0d5){_0x4419eb['push'](_0x4419eb['shift']());}};_0x38d8ef(++_0x4f7756);}(_0x99ad,0x119));var _0xd99a=function(_0x3a76a1,_0x5982e1){_0x3a76a1=_0x3a76a1-0x0;var _0x319f1d=_0x99ad[_0x3a76a1];return _0x319f1d;};'use strict';var _=require(_0xd99a('0x0'));var util=require(_0xd99a('0x1'));var moment=require(_0xd99a('0x2'));var BPromise=require(_0xd99a('0x3'));var rs=require(_0xd99a('0x4'));var fs=require('fs');var Redis=require(_0xd99a('0x5'));var db=require(_0xd99a('0x6'))['db'];var utils=require(_0xd99a('0x7'));var logger=require(_0xd99a('0x8'))(_0xd99a('0x9'));var config=require('../../config/environment');var jayson=require(_0xd99a('0xa'));var client=jayson[_0xd99a('0xb')][_0xd99a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56412a,_0x5f01bb,_0x28e2f9){return new BPromise(function(_0x5064f5,_0x9c44e5){return client[_0xd99a('0xd')](_0x56412a,_0x28e2f9)[_0xd99a('0xe')](function(_0x4d1bf3){logger[_0xd99a('0xf')](_0xd99a('0x10'),_0x5f01bb,'request\x20sent');logger['debug'](_0xd99a('0x11'),_0x5f01bb,'request\x20sent',JSON[_0xd99a('0x12')](_0x4d1bf3));if(_0x4d1bf3[_0xd99a('0x13')]){if(_0x4d1bf3['error'][_0xd99a('0x14')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x5f01bb,_0x4d1bf3['error'][_0xd99a('0x15')]);return _0x9c44e5(_0x4d1bf3[_0xd99a('0x13')][_0xd99a('0x15')]);}logger[_0xd99a('0x13')]('Template,\x20%s,\x20%s',_0x5f01bb,_0x4d1bf3['error']['message']);return _0x5064f5(_0x4d1bf3['error'][_0xd99a('0x15')]);}else{logger[_0xd99a('0xf')](_0xd99a('0x10'),_0x5f01bb,_0xd99a('0x16'));_0x5064f5(_0x4d1bf3[_0xd99a('0x17')]['message']);}})['catch'](function(_0x449e60){logger[_0xd99a('0x13')](_0xd99a('0x10'),_0x5f01bb,_0x449e60);_0x9c44e5(_0x449e60);});});}exports['GetTemplate']=function(_0x25cdf5){var _0x44c302=this;return new Promise(function(_0x2879ac,_0xecea73){return db['Template'][_0xd99a('0x18')]({'raw':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5['options'][_0xd99a('0x1a')]===undefined?!![]:![]:!![],'where':_0x25cdf5['options']?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1b')]||null:null,'attributes':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1c')]||null:null,'limit':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1d')]||null:null,'include':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1e')]?_[_0xd99a('0x1f')](_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1e')],function(_0x533bd0){return{'model':db[_0x533bd0[_0xd99a('0x20')]],'as':_0x533bd0['as'],'attributes':_0x533bd0[_0xd99a('0x1c')],'include':_0x533bd0[_0xd99a('0x1e')]?_[_0xd99a('0x1f')](_0x533bd0[_0xd99a('0x1e')],function(_0x42c37a){return{'model':db[_0x42c37a[_0xd99a('0x20')]],'as':_0x42c37a['as'],'attributes':_0x42c37a[_0xd99a('0x1c')],'include':_0x42c37a['include']?_[_0xd99a('0x1f')](_0x42c37a[_0xd99a('0x1e')],function(_0x1cfc05){return{'model':db[_0x1cfc05['model']],'as':_0x1cfc05['as'],'attributes':_0x1cfc05[_0xd99a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x393989){logger[_0xd99a('0xf')](_0xd99a('0x21'),_0x25cdf5);logger[_0xd99a('0x22')]('GetTemplate',_0x25cdf5,JSON['stringify'](_0x393989));_0x2879ac(_0x393989);})['catch'](function(_0x357fc1){logger[_0xd99a('0x13')](_0xd99a('0x21'),_0x357fc1[_0xd99a('0x15')],_0x25cdf5);_0xecea73(_0x44c302[_0xd99a('0x13')](0x1f4,_0x357fc1['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 79101ad..fdea3a9 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 _0x9341=['get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','create','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x409602,_0xf5f56f){var _0x10b734=function(_0x1b67d6){while(--_0x1b67d6){_0x409602['push'](_0x409602['shift']());}};_0x10b734(++_0xf5f56f);}(_0x9341,0xff));var _0x1934=function(_0x657755,_0x2af416){_0x657755=_0x657755-0x0;var _0x2d885a=_0x9341[_0x657755];return _0x2d885a;};'use strict';var multer=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var path=require('path');var timeout=require(_0x1934('0x2'));var express=require('express');var router=express[_0x1934('0x3')]();var fs_extra=require(_0x1934('0x4'));var auth=require(_0x1934('0x5'));var interaction=require(_0x1934('0x6'));var config=require(_0x1934('0x7'));var controller=require(_0x1934('0x8'));router[_0x1934('0x9')]('/',auth[_0x1934('0xa')](),controller['index']);router[_0x1934('0x9')](_0x1934('0xb'),auth[_0x1934('0xa')](),controller['show']);router[_0x1934('0x9')](_0x1934('0xc'),auth['isAuthenticated'](),controller[_0x1934('0xd')]);router['get']('/:id/any_conditions',auth[_0x1934('0xa')](),controller[_0x1934('0xe')]);router[_0x1934('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0x1934('0xf')]);router['post']('/',auth[_0x1934('0xa')](),controller[_0x1934('0x10')]);router[_0x1934('0x11')](_0x1934('0xc'),auth[_0x1934('0xa')](),controller[_0x1934('0x12')]);router[_0x1934('0x11')]('/:id/any_conditions',auth[_0x1934('0xa')](),controller[_0x1934('0x13')]);router[_0x1934('0x11')](_0x1934('0x14'),auth[_0x1934('0xa')](),controller[_0x1934('0x15')]);router[_0x1934('0x16')](_0x1934('0xb'),auth[_0x1934('0xa')](),controller[_0x1934('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3b93=['addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create'];(function(_0x1f9dc3,_0x100a49){var _0x2df719=function(_0x54d825){while(--_0x54d825){_0x1f9dc3['push'](_0x1f9dc3['shift']());}};_0x2df719(++_0x100a49);}(_0x3b93,0x92));var _0x33b9=function(_0x4354c9,_0xd26c43){_0x4354c9=_0x4354c9-0x0;var _0x4bea34=_0x3b93[_0x4354c9];return _0x4bea34;};'use strict';var multer=require('multer');var util=require(_0x33b9('0x0'));var path=require(_0x33b9('0x1'));var timeout=require(_0x33b9('0x2'));var express=require(_0x33b9('0x3'));var router=express[_0x33b9('0x4')]();var fs_extra=require(_0x33b9('0x5'));var auth=require(_0x33b9('0x6'));var interaction=require(_0x33b9('0x7'));var config=require(_0x33b9('0x8'));var controller=require(_0x33b9('0x9'));router[_0x33b9('0xa')]('/',auth['isAuthenticated'](),controller[_0x33b9('0xb')]);router[_0x33b9('0xa')](_0x33b9('0xc'),auth[_0x33b9('0xd')](),controller['show']);router[_0x33b9('0xa')](_0x33b9('0xe'),auth['isAuthenticated'](),controller[_0x33b9('0xf')]);router['get'](_0x33b9('0x10'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x11')]);router[_0x33b9('0xa')](_0x33b9('0x12'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x13')]);router[_0x33b9('0x14')]('/',auth['isAuthenticated'](),controller[_0x33b9('0x15')]);router[_0x33b9('0x14')](_0x33b9('0xe'),auth[_0x33b9('0xd')](),controller['addAllCondition']);router[_0x33b9('0x14')]('/:id/any_conditions',auth[_0x33b9('0xd')](),controller['addAnyCondition']);router[_0x33b9('0x14')](_0x33b9('0x12'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x16')]);router[_0x33b9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x33b9('0x18')]);router[_0x33b9('0x19')](_0x33b9('0xc'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x1a')]);module[_0x33b9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index aa016f0..7c12ca1 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 _0xdc25=['sequelize','STRING','BOOLEAN'];(function(_0x36bb95,_0x4fab59){var _0x30fe3e=function(_0x13e8f8){while(--_0x13e8f8){_0x36bb95['push'](_0x36bb95['shift']());}};_0x30fe3e(++_0x4fab59);}(_0xdc25,0x135));var _0x5dc2=function(_0x2fbe69,_0x8e1b61){_0x2fbe69=_0x2fbe69-0x0;var _0x376035=_0xdc25[_0x2fbe69];return _0x376035;};'use strict';var Sequelize=require(_0x5dc2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dc2('0x1')]},'channel':{'type':Sequelize[_0x5dc2('0x1')]},'description':{'type':Sequelize[_0x5dc2('0x1')]},'status':{'type':Sequelize[_0x5dc2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc57c=['BOOLEAN','sequelize','STRING'];(function(_0x3f670b,_0x10f414){var _0x1c0978=function(_0x5c1276){while(--_0x5c1276){_0x3f670b['push'](_0x3f670b['shift']());}};_0x1c0978(++_0x10f414);}(_0xc57c,0x1a2));var _0xcc57=function(_0x2a40a6,_0x267a4a){_0x2a40a6=_0x2a40a6-0x0;var _0xcd7635=_0xc57c[_0x2a40a6];return _0xcd7635;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc57('0x1')]},'channel':{'type':Sequelize[_0xcc57('0x1')]},'description':{'type':Sequelize[_0xcc57('0x1')]},'status':{'type':Sequelize[_0xcc57('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index dc1e5ab..bf52376 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 _0xf955=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','Triggers','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','type','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','Trigger','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','pick','getAnyConditions','addAction','TriggerId','Action','findOne','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x28302f,_0x3d8d33){var _0x14a827=function(_0x67fb7a){while(--_0x67fb7a){_0x28302f['push'](_0x28302f['shift']());}};_0x14a827(++_0x3d8d33);}(_0xf955,0x171));var _0x5f95=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xf955[_0x37c22c];return _0x119d79;};'use strict';var emlformat=require(_0x5f95('0x0'));var rimraf=require(_0x5f95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f95('0x2'));var moment=require(_0x5f95('0x3'));var BPromise=require(_0x5f95('0x4'));var Mustache=require(_0x5f95('0x5'));var util=require('util');var path=require(_0x5f95('0x6'));var sox=require(_0x5f95('0x7'));var csv=require(_0x5f95('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f95('0x9'));var _=require(_0x5f95('0xa'));var squel=require(_0x5f95('0xb'));var crypto=require(_0x5f95('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5f95('0xd'));var toCsv=require(_0x5f95('0x8'));var querystring=require(_0x5f95('0xe'));var Papa=require(_0x5f95('0xf'));var Redis=require(_0x5f95('0x10'));var authService=require(_0x5f95('0x11'));var qs=require(_0x5f95('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f95('0x13'));var utils=require(_0x5f95('0x14'));var config=require(_0x5f95('0x15'));var licenseUtil=require(_0x5f95('0x16'));var db=require(_0x5f95('0x17'))['db'];function respondWithStatusCode(_0x1e4f38,_0x54287d){_0x54287d=_0x54287d||0xcc;return function(_0x47635d){if(_0x47635d){return _0x1e4f38['sendStatus'](_0x54287d);}return _0x1e4f38[_0x5f95('0x18')](_0x54287d)[_0x5f95('0x19')]();};}function respondWithResult(_0x54d7b9,_0x175515){_0x175515=_0x175515||0xc8;return function(_0x430c9c){if(_0x430c9c){return _0x54d7b9[_0x5f95('0x18')](_0x175515)[_0x5f95('0x1a')](_0x430c9c);}};}function respondWithFilteredResult(_0x42d38e,_0x5901b9){return function(_0x1b937d){if(_0x1b937d){var _0x4f677d=typeof _0x5901b9[_0x5f95('0x1b')]===_0x5f95('0x1c')&&typeof _0x5901b9[_0x5f95('0x1d')]===_0x5f95('0x1c');var _0x2d3f5f=_0x1b937d[_0x5f95('0x1e')];var _0x453716=_0x4f677d?0x0:_0x5901b9['offset'];var _0x19dd6a=_0x4f677d?_0x1b937d[_0x5f95('0x1e')]:_0x5901b9[_0x5f95('0x1b')]+_0x5901b9[_0x5f95('0x1d')];var _0xc1f296;if(_0x19dd6a>=_0x2d3f5f){_0x19dd6a=_0x2d3f5f;_0xc1f296=0xc8;}else{_0xc1f296=0xce;}_0x42d38e[_0x5f95('0x18')](_0xc1f296);return _0x42d38e[_0x5f95('0x1f')]('Content-Range',_0x453716+'-'+_0x19dd6a+'/'+_0x2d3f5f)[_0x5f95('0x1a')](_0x1b937d);}return null;};}function patchUpdates(_0x222ed0){return function(_0x36d057){try{jsonpatch[_0x5f95('0x20')](_0x36d057,_0x222ed0,!![]);}catch(_0x485486){return BPromise[_0x5f95('0x21')](_0x485486);}return _0x36d057['save']();};}function saveUpdates(_0x499433,_0x17627a){return function(_0x3b32c7){if(_0x3b32c7){return _0x3b32c7['update'](_0x499433)[_0x5f95('0x22')](function(_0x56475f){return _0x56475f;});}return null;};}function removeEntity(_0x2c7d5e,_0x3ec47b){return function(_0x4af1e4){if(_0x4af1e4){return _0x4af1e4['destroy']()[_0x5f95('0x22')](function(){var _0x23dc3d=_0x4af1e4[_0x5f95('0x23')]({'plain':!![]});var _0x10db67=_0x5f95('0x24');return db[_0x5f95('0x25')][_0x5f95('0x26')]({'where':{'type':_0x10db67,'resourceId':_0x23dc3d['id']}})['then'](function(){return _0x4af1e4;});})[_0x5f95('0x22')](function(){_0x2c7d5e['status'](0xcc)[_0x5f95('0x19')]();});}};}function handleEntityNotFound(_0x19aa11,_0x620ff6){return function(_0xa77b6a){if(!_0xa77b6a){_0x19aa11[_0x5f95('0x27')](0x194);}return _0xa77b6a;};}function handleError(_0x89568e,_0x488c73){_0x488c73=_0x488c73||0x1f4;return function(_0x55be01){logger[_0x5f95('0x28')](_0x55be01[_0x5f95('0x29')]);if(_0x55be01[_0x5f95('0x2a')]){delete _0x55be01['name'];}_0x89568e[_0x5f95('0x18')](_0x488c73)[_0x5f95('0x2b')](_0x55be01);};}exports[_0x5f95('0x2c')]=function(_0x5554cd,_0xb91171){var _0x58346c={},_0x393fe1={},_0x9e8c11={'count':0x0,'rows':[]};var _0x5027d6=_[_0x5f95('0x2d')](db['Trigger']['rawAttributes'],function(_0x183a44){return{'name':_0x183a44['fieldName'],'type':_0x183a44[_0x5f95('0x2e')]['key']};});_0x393fe1['model']=_[_0x5f95('0x2d')](_0x5027d6,_0x5f95('0x2a'));_0x393fe1[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x5554cd['query']);_0x393fe1['filters']=_['intersection'](_0x393fe1[_0x5f95('0x31')],_0x393fe1[_0x5f95('0x2f')]);_0x58346c[_0x5f95('0x32')]=_[_0x5f95('0x33')](_0x393fe1[_0x5f95('0x31')],qs[_0x5f95('0x34')](_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x34')]));_0x58346c['attributes']=_0x58346c[_0x5f95('0x32')]['length']?_0x58346c['attributes']:_0x393fe1[_0x5f95('0x31')];if(!_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x35')](_0x5f95('0x36'))){_0x58346c['limit']=qs['limit'](_0x5554cd['query'][_0x5f95('0x1d')]);_0x58346c[_0x5f95('0x1b')]=qs[_0x5f95('0x1b')](_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x1b')]);}_0x58346c['order']=qs['sort'](_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x37')]);_0x58346c['where']=qs[_0x5f95('0x38')](_['pick'](_0x5554cd['query'],_0x393fe1['filters']),_0x5027d6);if(_0x5554cd[_0x5f95('0x2f')]['filter']){_0x58346c[_0x5f95('0x39')]=_[_0x5f95('0x3a')](_0x58346c['where'],{'$or':_[_0x5f95('0x2d')](_0x5027d6,function(_0x195b30){if(_0x195b30['type']!==_0x5f95('0x3b')){var _0x338350={};_0x338350[_0x195b30['name']]={'$like':'%'+_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x3c')]+'%'};return _0x338350;}})});}_0x58346c=_[_0x5f95('0x3a')]({},_0x58346c,_0x5554cd['options']);var _0x27faa1={'where':_0x58346c['where']};return db[_0x5f95('0x3d')][_0x5f95('0x1e')](_0x27faa1)[_0x5f95('0x22')](function(_0x2e6388){_0x9e8c11[_0x5f95('0x1e')]=_0x2e6388;if(_0x5554cd[_0x5f95('0x2f')][_0x5f95('0x3e')]){_0x58346c[_0x5f95('0x3f')]=[{'all':!![]}];}return db[_0x5f95('0x3d')][_0x5f95('0x40')](_0x58346c);})[_0x5f95('0x22')](function(_0x19e45d){_0x9e8c11[_0x5f95('0x41')]=_0x19e45d;return _0x9e8c11;})['then'](respondWithFilteredResult(_0xb91171,_0x58346c))['catch'](handleError(_0xb91171,null));};exports[_0x5f95('0x42')]=function(_0x26cd57,_0x2d80f0){var _0x1a8c1b={'raw':![],'where':{'id':_0x26cd57[_0x5f95('0x43')]['id']}},_0x3c44a6={};_0x3c44a6[_0x5f95('0x31')]=_['keys'](db[_0x5f95('0x3d')][_0x5f95('0x44')]);_0x3c44a6['query']=_[_0x5f95('0x30')](_0x26cd57[_0x5f95('0x2f')]);_0x3c44a6[_0x5f95('0x38')]=_[_0x5f95('0x33')](_0x3c44a6[_0x5f95('0x31')],_0x3c44a6[_0x5f95('0x2f')]);_0x1a8c1b[_0x5f95('0x32')]=_[_0x5f95('0x33')](_0x3c44a6[_0x5f95('0x31')],qs[_0x5f95('0x34')](_0x26cd57['query'][_0x5f95('0x34')]));_0x1a8c1b[_0x5f95('0x32')]=_0x1a8c1b['attributes'][_0x5f95('0x45')]?_0x1a8c1b[_0x5f95('0x32')]:_0x3c44a6[_0x5f95('0x31')];if(_0x26cd57[_0x5f95('0x2f')]['includeAll']){_0x1a8c1b[_0x5f95('0x3f')]=[{'all':!![]}];}_0x1a8c1b=_['merge']({},_0x1a8c1b,_0x26cd57[_0x5f95('0x46')]);return db[_0x5f95('0x3d')][_0x5f95('0x47')](_0x1a8c1b)[_0x5f95('0x22')](handleEntityNotFound(_0x2d80f0,null))[_0x5f95('0x22')](respondWithResult(_0x2d80f0,null))['catch'](handleError(_0x2d80f0,null));};exports[_0x5f95('0x48')]=function(_0x3532c3,_0x567602){return db[_0x5f95('0x3d')][_0x5f95('0x48')](_0x3532c3[_0x5f95('0x49')],{})['then'](function(_0x3587a1){var _0x46ffb2=_0x3532c3[_0x5f95('0x4a')]['get']({'plain':!![]});if(!_0x46ffb2)throw new Error(_0x5f95('0x4b'));if(_0x46ffb2[_0x5f95('0x4c')]==='user'){var _0x460f94=_0x3587a1[_0x5f95('0x23')]({'plain':!![]});var _0x1cf7e8=_0x5f95('0x24');return db[_0x5f95('0x4d')]['find']({'where':{'name':_0x1cf7e8,'userProfileId':_0x46ffb2[_0x5f95('0x4e')]},'raw':!![]})[_0x5f95('0x22')](function(_0x4f2f0e){if(_0x4f2f0e&&_0x4f2f0e[_0x5f95('0x4f')]===0x0){return db[_0x5f95('0x25')]['create']({'name':_0x460f94['name'],'resourceId':_0x460f94['id'],'type':_0x4f2f0e['name'],'sectionId':_0x4f2f0e['id']},{})[_0x5f95('0x22')](function(){return _0x3587a1;});}else{return _0x3587a1;}})['catch'](function(_0x52b0d5){logger[_0x5f95('0x28')](_0x5f95('0x50'),_0x52b0d5);throw _0x52b0d5;});}return _0x3587a1;})[_0x5f95('0x22')](respondWithResult(_0x567602,0xc9))[_0x5f95('0x51')](handleError(_0x567602,null));};exports[_0x5f95('0x52')]=function(_0x2701be,_0x38be6c){if(_0x2701be[_0x5f95('0x49')]['id']){delete _0x2701be['body']['id'];}return db[_0x5f95('0x3d')][_0x5f95('0x47')]({'where':{'id':_0x2701be['params']['id']}})[_0x5f95('0x22')](handleEntityNotFound(_0x38be6c,null))[_0x5f95('0x22')](saveUpdates(_0x2701be['body'],null))[_0x5f95('0x22')](respondWithResult(_0x38be6c,null))[_0x5f95('0x51')](handleError(_0x38be6c,null));};exports[_0x5f95('0x26')]=function(_0x598eb4,_0x51a7ce){return db[_0x5f95('0x3d')][_0x5f95('0x47')]({'where':{'id':_0x598eb4[_0x5f95('0x43')]['id']}})[_0x5f95('0x22')](handleEntityNotFound(_0x51a7ce,null))[_0x5f95('0x22')](removeEntity(_0x51a7ce,null))[_0x5f95('0x51')](handleError(_0x51a7ce,null));};exports[_0x5f95('0x53')]=function(_0xd3e35d,_0x1e4247,_0x5c74e1){if(_0xd3e35d['body']['id']){delete _0xd3e35d[_0x5f95('0x49')]['id'];}return db[_0x5f95('0x3d')][_0x5f95('0x47')]({'where':{'id':_0xd3e35d[_0x5f95('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e4247,null))[_0x5f95('0x22')](function(_0x35b1fc){if(_0x35b1fc){_0xd3e35d['body'][_0x5f95('0x54')]=_0x35b1fc['id'];return db[_0x5f95('0x55')][_0x5f95('0x48')](_0xd3e35d[_0x5f95('0x49')]);}})[_0x5f95('0x22')](respondWithResult(_0x1e4247,null))[_0x5f95('0x51')](handleError(_0x1e4247,null));};exports[_0x5f95('0x56')]=function(_0x14fdce,_0x4a049b,_0x4b8deb){if(_0x14fdce[_0x5f95('0x49')]['id']){delete _0x14fdce[_0x5f95('0x49')]['id'];}return db[_0x5f95('0x3d')][_0x5f95('0x47')]({'where':{'id':_0x14fdce[_0x5f95('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a049b,null))[_0x5f95('0x22')](function(_0x43af25){if(_0x43af25){_0x14fdce[_0x5f95('0x49')][_0x5f95('0x57')]=_0x43af25['id'];return db[_0x5f95('0x55')][_0x5f95('0x48')](_0x14fdce[_0x5f95('0x49')]);}})[_0x5f95('0x22')](respondWithResult(_0x4a049b,null))[_0x5f95('0x51')](handleError(_0x4a049b,null));};exports[_0x5f95('0x58')]=function(_0x2abdae,_0x31a640,_0x3c9085){var _0xd7a96e={};var _0x25f0a6={};var _0x5db6b0;var _0x279c61;return db['Trigger']['findOne']({'where':{'id':_0x2abdae[_0x5f95('0x43')]['id']}})['then'](handleEntityNotFound(_0x31a640,null))[_0x5f95('0x22')](function(_0x260fcc){if(_0x260fcc){_0x5db6b0=_0x260fcc;_0x25f0a6[_0x5f95('0x31')]=_[_0x5f95('0x30')](db['Condition'][_0x5f95('0x44')]);_0x25f0a6['query']=_[_0x5f95('0x30')](_0x2abdae[_0x5f95('0x2f')]);_0x25f0a6[_0x5f95('0x38')]=_['intersection'](_0x25f0a6[_0x5f95('0x31')],_0x25f0a6[_0x5f95('0x2f')]);_0xd7a96e[_0x5f95('0x32')]=_[_0x5f95('0x33')](_0x25f0a6['model'],qs[_0x5f95('0x34')](_0x2abdae['query']['fields']));_0xd7a96e[_0x5f95('0x32')]=_0xd7a96e['attributes'][_0x5f95('0x45')]?_0xd7a96e[_0x5f95('0x32')]:_0x25f0a6['model'];_0xd7a96e['order']=qs[_0x5f95('0x37')](_0x2abdae[_0x5f95('0x2f')]['sort']);_0xd7a96e[_0x5f95('0x39')]=qs['filters'](_[_0x5f95('0x59')](_0x2abdae[_0x5f95('0x2f')],_0x25f0a6[_0x5f95('0x38')]));if(_0x2abdae[_0x5f95('0x2f')]['filter']){_0xd7a96e[_0x5f95('0x39')]=_[_0x5f95('0x3a')](_0xd7a96e[_0x5f95('0x39')],{'$or':_[_0x5f95('0x2d')](_0xd7a96e['attributes'],function(_0x5574d7){var _0x336c0a={};_0x336c0a[_0x5574d7]={'$like':'%'+_0x2abdae['query'][_0x5f95('0x3c')]+'%'};return _0x336c0a;})});}_0xd7a96e=_[_0x5f95('0x3a')]({},_0xd7a96e,_0x2abdae['options']);return _0x5db6b0[_0x5f95('0x58')](_0xd7a96e);}})['then'](function(_0xfa8b03){if(_0xfa8b03){_0x279c61=_0xfa8b03['length'];if(!_0x2abdae[_0x5f95('0x2f')]['hasOwnProperty']('nolimit')){_0xd7a96e[_0x5f95('0x1d')]=qs[_0x5f95('0x1d')](_0x2abdae[_0x5f95('0x2f')][_0x5f95('0x1d')]);_0xd7a96e[_0x5f95('0x1b')]=qs[_0x5f95('0x1b')](_0x2abdae['query']['offset']);}return _0x5db6b0[_0x5f95('0x58')](_0xd7a96e);}})['then'](function(_0x55806b){if(_0x55806b){return _0x55806b?{'count':_0x279c61,'rows':_0x55806b}:null;}})['then'](respondWithResult(_0x31a640,null))[_0x5f95('0x51')](handleError(_0x31a640,null));};exports['getAnyConditions']=function(_0x3e5cf4,_0x38e2c7,_0x4c041f){var _0x3fd4e7={};var _0x4b6e8e={};var _0x160f62;var _0x2927ea;return db[_0x5f95('0x3d')]['findOne']({'where':{'id':_0x3e5cf4[_0x5f95('0x43')]['id']}})[_0x5f95('0x22')](handleEntityNotFound(_0x38e2c7,null))[_0x5f95('0x22')](function(_0x3d29e2){if(_0x3d29e2){_0x160f62=_0x3d29e2;_0x4b6e8e['model']=_[_0x5f95('0x30')](db[_0x5f95('0x55')][_0x5f95('0x44')]);_0x4b6e8e[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x3e5cf4['query']);_0x4b6e8e['filters']=_[_0x5f95('0x33')](_0x4b6e8e[_0x5f95('0x31')],_0x4b6e8e['query']);_0x3fd4e7[_0x5f95('0x32')]=_['intersection'](_0x4b6e8e['model'],qs[_0x5f95('0x34')](_0x3e5cf4['query']['fields']));_0x3fd4e7['attributes']=_0x3fd4e7[_0x5f95('0x32')][_0x5f95('0x45')]?_0x3fd4e7[_0x5f95('0x32')]:_0x4b6e8e[_0x5f95('0x31')];_0x3fd4e7['order']=qs['sort'](_0x3e5cf4[_0x5f95('0x2f')]['sort']);_0x3fd4e7[_0x5f95('0x39')]=qs[_0x5f95('0x38')](_[_0x5f95('0x59')](_0x3e5cf4['query'],_0x4b6e8e[_0x5f95('0x38')]));if(_0x3e5cf4[_0x5f95('0x2f')]['filter']){_0x3fd4e7[_0x5f95('0x39')]=_[_0x5f95('0x3a')](_0x3fd4e7[_0x5f95('0x39')],{'$or':_[_0x5f95('0x2d')](_0x3fd4e7['attributes'],function(_0x333a7b){var _0x54a0ad={};_0x54a0ad[_0x333a7b]={'$like':'%'+_0x3e5cf4[_0x5f95('0x2f')][_0x5f95('0x3c')]+'%'};return _0x54a0ad;})});}_0x3fd4e7=_['merge']({},_0x3fd4e7,_0x3e5cf4[_0x5f95('0x46')]);return _0x160f62[_0x5f95('0x5a')](_0x3fd4e7);}})[_0x5f95('0x22')](function(_0x4cfa25){if(_0x4cfa25){_0x2927ea=_0x4cfa25['length'];if(!_0x3e5cf4[_0x5f95('0x2f')]['hasOwnProperty'](_0x5f95('0x36'))){_0x3fd4e7[_0x5f95('0x1d')]=qs[_0x5f95('0x1d')](_0x3e5cf4[_0x5f95('0x2f')][_0x5f95('0x1d')]);_0x3fd4e7['offset']=qs[_0x5f95('0x1b')](_0x3e5cf4['query'][_0x5f95('0x1b')]);}return _0x160f62['getAnyConditions'](_0x3fd4e7);}})[_0x5f95('0x22')](function(_0x5c26b4){if(_0x5c26b4){return _0x5c26b4?{'count':_0x2927ea,'rows':_0x5c26b4}:null;}})[_0x5f95('0x22')](respondWithResult(_0x38e2c7,null))[_0x5f95('0x51')](handleError(_0x38e2c7,null));};exports[_0x5f95('0x5b')]=function(_0x147169,_0x283f62,_0x11f074){if(_0x147169[_0x5f95('0x49')]['id']){delete _0x147169[_0x5f95('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x147169[_0x5f95('0x43')]['id']}})[_0x5f95('0x22')](handleEntityNotFound(_0x283f62,null))[_0x5f95('0x22')](function(_0x4d31a2){if(_0x4d31a2){_0x147169[_0x5f95('0x49')][_0x5f95('0x5c')]=_0x4d31a2['id'];return db[_0x5f95('0x5d')][_0x5f95('0x48')](_0x147169[_0x5f95('0x49')]);}})[_0x5f95('0x22')](respondWithResult(_0x283f62,null))[_0x5f95('0x51')](handleError(_0x283f62,null));};exports['getActions']=function(_0x5b7f01,_0x2a7eed,_0x25db23){var _0x26ce5b={};var _0x3b3ba4={};var _0x1ff0a8;var _0x4c279e;return db[_0x5f95('0x3d')][_0x5f95('0x5e')]({'where':{'id':_0x5b7f01['params']['id']}})[_0x5f95('0x22')](handleEntityNotFound(_0x2a7eed,null))['then'](function(_0x131113){if(_0x131113){_0x1ff0a8=_0x131113;_0x3b3ba4['model']=_[_0x5f95('0x30')](db[_0x5f95('0x5d')][_0x5f95('0x44')]);_0x3b3ba4[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x5b7f01[_0x5f95('0x2f')]);_0x3b3ba4[_0x5f95('0x38')]=_[_0x5f95('0x33')](_0x3b3ba4[_0x5f95('0x31')],_0x3b3ba4[_0x5f95('0x2f')]);_0x26ce5b['attributes']=_['intersection'](_0x3b3ba4[_0x5f95('0x31')],qs[_0x5f95('0x34')](_0x5b7f01[_0x5f95('0x2f')][_0x5f95('0x34')]));_0x26ce5b[_0x5f95('0x32')]=_0x26ce5b[_0x5f95('0x32')][_0x5f95('0x45')]?_0x26ce5b['attributes']:_0x3b3ba4[_0x5f95('0x31')];_0x26ce5b['order']=qs[_0x5f95('0x37')](_0x5b7f01[_0x5f95('0x2f')]['sort']);_0x26ce5b['where']=qs[_0x5f95('0x38')](_['pick'](_0x5b7f01[_0x5f95('0x2f')],_0x3b3ba4[_0x5f95('0x38')]));if(_0x5b7f01[_0x5f95('0x2f')][_0x5f95('0x3c')]){_0x26ce5b['where']=_[_0x5f95('0x3a')](_0x26ce5b[_0x5f95('0x39')],{'$or':_['map'](_0x26ce5b['attributes'],function(_0x3dedcd){var _0x190188={};_0x190188[_0x3dedcd]={'$like':'%'+_0x5b7f01['query']['filter']+'%'};return _0x190188;})});}_0x26ce5b=_[_0x5f95('0x3a')]({},_0x26ce5b,_0x5b7f01[_0x5f95('0x46')]);return _0x1ff0a8[_0x5f95('0x5f')](_0x26ce5b);}})['then'](function(_0x1ec0c0){if(_0x1ec0c0){_0x4c279e=_0x1ec0c0[_0x5f95('0x45')];if(!_0x5b7f01[_0x5f95('0x2f')][_0x5f95('0x35')]('nolimit')){_0x26ce5b[_0x5f95('0x1d')]=qs[_0x5f95('0x1d')](_0x5b7f01[_0x5f95('0x2f')][_0x5f95('0x1d')]);_0x26ce5b[_0x5f95('0x1b')]=qs['offset'](_0x5b7f01[_0x5f95('0x2f')]['offset']);}return _0x1ff0a8[_0x5f95('0x5f')](_0x26ce5b);}})[_0x5f95('0x22')](function(_0x3c5730){if(_0x3c5730){return _0x3c5730?{'count':_0x4c279e,'rows':_0x3c5730}:null;}})['then'](respondWithResult(_0x2a7eed,null))[_0x5f95('0x51')](handleError(_0x2a7eed,null));}; \ No newline at end of file +var _0x34a2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','update','then','Triggers','UserProfileResource','destroy','end','error','name','send','index','map','Trigger','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','hasOwnProperty','Action','getActions','eml-format'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0x34a2,0x10d));var _0x234a=function(_0x1d2654,_0x460aec){_0x1d2654=_0x1d2654-0x0;var _0x249fd1=_0x34a2[_0x1d2654];return _0x249fd1;};'use strict';var emlformat=require(_0x234a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x234a('0x1'));var jsonpatch=require(_0x234a('0x2'));var rp=require(_0x234a('0x3'));var moment=require(_0x234a('0x4'));var BPromise=require(_0x234a('0x5'));var Mustache=require(_0x234a('0x6'));var util=require(_0x234a('0x7'));var path=require(_0x234a('0x8'));var sox=require(_0x234a('0x9'));var csv=require(_0x234a('0xa'));var ejs=require(_0x234a('0xb'));var fs=require('fs');var fs_extra=require(_0x234a('0xc'));var _=require(_0x234a('0xd'));var squel=require(_0x234a('0xe'));var crypto=require(_0x234a('0xf'));var jsforce=require(_0x234a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x234a('0x11'));var Redis=require('ioredis');var authService=require(_0x234a('0x12'));var qs=require(_0x234a('0x13'));var as=require(_0x234a('0x14'));var hardwareService=require(_0x234a('0x15'));var logger=require(_0x234a('0x16'))(_0x234a('0x17'));var utils=require('../../config/utils');var config=require(_0x234a('0x18'));var licenseUtil=require(_0x234a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5996aa,_0x4b2004){_0x4b2004=_0x4b2004||0xcc;return function(_0x3a0635){if(_0x3a0635){return _0x5996aa['sendStatus'](_0x4b2004);}return _0x5996aa[_0x234a('0x1a')](_0x4b2004)['end']();};}function respondWithResult(_0x253d48,_0x3739c6){_0x3739c6=_0x3739c6||0xc8;return function(_0x2a2895){if(_0x2a2895){return _0x253d48['status'](_0x3739c6)[_0x234a('0x1b')](_0x2a2895);}};}function respondWithFilteredResult(_0x562bb6,_0x5168b3){return function(_0x465fce){if(_0x465fce){var _0x22ab0e=typeof _0x5168b3[_0x234a('0x1c')]==='undefined'&&typeof _0x5168b3[_0x234a('0x1d')]===_0x234a('0x1e');var _0x56cb63=_0x465fce[_0x234a('0x1f')];var _0x487ad1=_0x22ab0e?0x0:_0x5168b3[_0x234a('0x1c')];var _0xc3e70c=_0x22ab0e?_0x465fce['count']:_0x5168b3[_0x234a('0x1c')]+_0x5168b3['limit'];var _0x220290;if(_0xc3e70c>=_0x56cb63){_0xc3e70c=_0x56cb63;_0x220290=0xc8;}else{_0x220290=0xce;}_0x562bb6['status'](_0x220290);return _0x562bb6[_0x234a('0x20')](_0x234a('0x21'),_0x487ad1+'-'+_0xc3e70c+'/'+_0x56cb63)[_0x234a('0x1b')](_0x465fce);}return null;};}function patchUpdates(_0x2698b3){return function(_0x3a7a35){try{jsonpatch['apply'](_0x3a7a35,_0x2698b3,!![]);}catch(_0x4ed050){return BPromise['reject'](_0x4ed050);}return _0x3a7a35['save']();};}function saveUpdates(_0x55f6ec,_0x398fad){return function(_0x3f9337){if(_0x3f9337){return _0x3f9337[_0x234a('0x22')](_0x55f6ec)[_0x234a('0x23')](function(_0x67ef48){return _0x67ef48;});}return null;};}function removeEntity(_0xba77e3,_0x3858f8){return function(_0x14c6ad){if(_0x14c6ad){return _0x14c6ad['destroy']()[_0x234a('0x23')](function(){var _0x1da39e=_0x14c6ad['get']({'plain':!![]});var _0x1ac724=_0x234a('0x24');return db[_0x234a('0x25')][_0x234a('0x26')]({'where':{'type':_0x1ac724,'resourceId':_0x1da39e['id']}})[_0x234a('0x23')](function(){return _0x14c6ad;});})[_0x234a('0x23')](function(){_0xba77e3['status'](0xcc)[_0x234a('0x27')]();});}};}function handleEntityNotFound(_0x2f94f5,_0xcdfca2){return function(_0x54da60){if(!_0x54da60){_0x2f94f5['sendStatus'](0x194);}return _0x54da60;};}function handleError(_0x4dab02,_0x72179c){_0x72179c=_0x72179c||0x1f4;return function(_0x18745c){logger[_0x234a('0x28')](_0x18745c['stack']);if(_0x18745c['name']){delete _0x18745c[_0x234a('0x29')];}_0x4dab02[_0x234a('0x1a')](_0x72179c)[_0x234a('0x2a')](_0x18745c);};}exports[_0x234a('0x2b')]=function(_0x466306,_0x36e0df){var _0x3fd1ba={},_0x526613={},_0x2ef875={'count':0x0,'rows':[]};var _0x3ee3c1=_[_0x234a('0x2c')](db[_0x234a('0x2d')][_0x234a('0x2e')],function(_0x1ddb0d){return{'name':_0x1ddb0d['fieldName'],'type':_0x1ddb0d['type']['key']};});_0x526613[_0x234a('0x2f')]=_[_0x234a('0x2c')](_0x3ee3c1,'name');_0x526613[_0x234a('0x30')]=_['keys'](_0x466306['query']);_0x526613[_0x234a('0x31')]=_[_0x234a('0x32')](_0x526613['model'],_0x526613['query']);_0x3fd1ba[_0x234a('0x33')]=_[_0x234a('0x32')](_0x526613[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x466306[_0x234a('0x30')][_0x234a('0x34')]));_0x3fd1ba[_0x234a('0x33')]=_0x3fd1ba[_0x234a('0x33')][_0x234a('0x35')]?_0x3fd1ba[_0x234a('0x33')]:_0x526613['model'];if(!_0x466306[_0x234a('0x30')]['hasOwnProperty'](_0x234a('0x36'))){_0x3fd1ba[_0x234a('0x1d')]=qs['limit'](_0x466306[_0x234a('0x30')][_0x234a('0x1d')]);_0x3fd1ba[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x466306[_0x234a('0x30')][_0x234a('0x1c')]);}_0x3fd1ba[_0x234a('0x37')]=qs[_0x234a('0x38')](_0x466306[_0x234a('0x30')][_0x234a('0x38')]);_0x3fd1ba['where']=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x466306[_0x234a('0x30')],_0x526613['filters']),_0x3ee3c1);if(_0x466306['query'][_0x234a('0x3a')]){_0x3fd1ba[_0x234a('0x3b')]=_['merge'](_0x3fd1ba[_0x234a('0x3b')],{'$or':_['map'](_0x3ee3c1,function(_0x4836b5){if(_0x4836b5['type']!==_0x234a('0x3c')){var _0x597184={};_0x597184[_0x4836b5[_0x234a('0x29')]]={'$like':'%'+_0x466306['query'][_0x234a('0x3a')]+'%'};return _0x597184;}})});}_0x3fd1ba=_[_0x234a('0x3d')]({},_0x3fd1ba,_0x466306[_0x234a('0x3e')]);var _0x25c187={'where':_0x3fd1ba['where']};return db[_0x234a('0x2d')]['count'](_0x25c187)['then'](function(_0x43b855){_0x2ef875[_0x234a('0x1f')]=_0x43b855;if(_0x466306[_0x234a('0x30')][_0x234a('0x3f')]){_0x3fd1ba[_0x234a('0x40')]=[{'all':!![]}];}return db[_0x234a('0x2d')][_0x234a('0x41')](_0x3fd1ba);})[_0x234a('0x23')](function(_0x3e524d){_0x2ef875['rows']=_0x3e524d;return _0x2ef875;})[_0x234a('0x23')](respondWithFilteredResult(_0x36e0df,_0x3fd1ba))['catch'](handleError(_0x36e0df,null));};exports[_0x234a('0x42')]=function(_0x2c0406,_0x5112b0){var _0x42716a={'raw':![],'where':{'id':_0x2c0406['params']['id']}},_0x572e16={};_0x572e16[_0x234a('0x2f')]=_[_0x234a('0x43')](db[_0x234a('0x2d')][_0x234a('0x2e')]);_0x572e16[_0x234a('0x30')]=_[_0x234a('0x43')](_0x2c0406[_0x234a('0x30')]);_0x572e16[_0x234a('0x31')]=_[_0x234a('0x32')](_0x572e16[_0x234a('0x2f')],_0x572e16[_0x234a('0x30')]);_0x42716a[_0x234a('0x33')]=_[_0x234a('0x32')](_0x572e16[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x2c0406[_0x234a('0x30')][_0x234a('0x34')]));_0x42716a[_0x234a('0x33')]=_0x42716a[_0x234a('0x33')][_0x234a('0x35')]?_0x42716a[_0x234a('0x33')]:_0x572e16[_0x234a('0x2f')];if(_0x2c0406[_0x234a('0x30')][_0x234a('0x3f')]){_0x42716a['include']=[{'all':!![]}];}_0x42716a=_[_0x234a('0x3d')]({},_0x42716a,_0x2c0406[_0x234a('0x3e')]);return db[_0x234a('0x2d')][_0x234a('0x44')](_0x42716a)[_0x234a('0x23')](handleEntityNotFound(_0x5112b0,null))[_0x234a('0x23')](respondWithResult(_0x5112b0,null))[_0x234a('0x45')](handleError(_0x5112b0,null));};exports[_0x234a('0x46')]=function(_0x578fd7,_0x272974){return db['Trigger'][_0x234a('0x46')](_0x578fd7[_0x234a('0x47')],{})['then'](function(_0x2cd6d0){var _0xe29568=_0x578fd7[_0x234a('0x48')][_0x234a('0x49')]({'plain':!![]});if(!_0xe29568)throw new Error(_0x234a('0x4a'));if(_0xe29568[_0x234a('0x4b')]===_0x234a('0x48')){var _0x225cfd=_0x2cd6d0[_0x234a('0x49')]({'plain':!![]});var _0x59aa80=_0x234a('0x24');return db[_0x234a('0x4c')][_0x234a('0x44')]({'where':{'name':_0x59aa80,'userProfileId':_0xe29568[_0x234a('0x4d')]},'raw':!![]})[_0x234a('0x23')](function(_0x50f83f){if(_0x50f83f&&_0x50f83f[_0x234a('0x4e')]===0x0){return db[_0x234a('0x25')][_0x234a('0x46')]({'name':_0x225cfd[_0x234a('0x29')],'resourceId':_0x225cfd['id'],'type':_0x50f83f['name'],'sectionId':_0x50f83f['id']},{})[_0x234a('0x23')](function(){return _0x2cd6d0;});}else{return _0x2cd6d0;}})[_0x234a('0x45')](function(_0x14004d){logger['error'](_0x234a('0x4f'),_0x14004d);throw _0x14004d;});}return _0x2cd6d0;})[_0x234a('0x23')](respondWithResult(_0x272974,0xc9))[_0x234a('0x45')](handleError(_0x272974,null));};exports[_0x234a('0x22')]=function(_0xffa5ff,_0xbad3e5){if(_0xffa5ff[_0x234a('0x47')]['id']){delete _0xffa5ff[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0xffa5ff['params']['id']}})[_0x234a('0x23')](handleEntityNotFound(_0xbad3e5,null))['then'](saveUpdates(_0xffa5ff[_0x234a('0x47')],null))['then'](respondWithResult(_0xbad3e5,null))[_0x234a('0x45')](handleError(_0xbad3e5,null));};exports[_0x234a('0x26')]=function(_0x359726,_0x41a45e){return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x359726[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x41a45e,null))[_0x234a('0x23')](removeEntity(_0x41a45e,null))[_0x234a('0x45')](handleError(_0x41a45e,null));};exports['addAllCondition']=function(_0x4e01a8,_0x553ab6,_0x24b9cc){if(_0x4e01a8['body']['id']){delete _0x4e01a8[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x4e01a8[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x553ab6,null))[_0x234a('0x23')](function(_0xd486b1){if(_0xd486b1){_0x4e01a8['body']['TriggerAllId']=_0xd486b1['id'];return db[_0x234a('0x51')][_0x234a('0x46')](_0x4e01a8[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x553ab6,null))['catch'](handleError(_0x553ab6,null));};exports[_0x234a('0x52')]=function(_0xe38a95,_0x1d675b,_0x1e752b){if(_0xe38a95['body']['id']){delete _0xe38a95[_0x234a('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0xe38a95[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x1d675b,null))[_0x234a('0x23')](function(_0x537977){if(_0x537977){_0xe38a95[_0x234a('0x47')][_0x234a('0x53')]=_0x537977['id'];return db[_0x234a('0x51')][_0x234a('0x46')](_0xe38a95[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x1d675b,null))['catch'](handleError(_0x1d675b,null));};exports[_0x234a('0x54')]=function(_0x2d64f9,_0x5ed9e0,_0x5de25d){var _0x2f08c9={};var _0x575e2c={};var _0xc7e6d6;var _0x12503f;return db[_0x234a('0x2d')]['findOne']({'where':{'id':_0x2d64f9[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x5ed9e0,null))[_0x234a('0x23')](function(_0xebc853){if(_0xebc853){_0xc7e6d6=_0xebc853;_0x575e2c[_0x234a('0x2f')]=_[_0x234a('0x43')](db[_0x234a('0x51')][_0x234a('0x2e')]);_0x575e2c[_0x234a('0x30')]=_[_0x234a('0x43')](_0x2d64f9['query']);_0x575e2c[_0x234a('0x31')]=_[_0x234a('0x32')](_0x575e2c[_0x234a('0x2f')],_0x575e2c['query']);_0x2f08c9['attributes']=_[_0x234a('0x32')](_0x575e2c['model'],qs[_0x234a('0x34')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x34')]));_0x2f08c9[_0x234a('0x33')]=_0x2f08c9['attributes'][_0x234a('0x35')]?_0x2f08c9['attributes']:_0x575e2c[_0x234a('0x2f')];_0x2f08c9[_0x234a('0x37')]=qs[_0x234a('0x38')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x38')]);_0x2f08c9['where']=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x2d64f9[_0x234a('0x30')],_0x575e2c[_0x234a('0x31')]));if(_0x2d64f9[_0x234a('0x30')][_0x234a('0x3a')]){_0x2f08c9[_0x234a('0x3b')]=_[_0x234a('0x3d')](_0x2f08c9[_0x234a('0x3b')],{'$or':_[_0x234a('0x2c')](_0x2f08c9[_0x234a('0x33')],function(_0x1cc11c){var _0x2acc58={};_0x2acc58[_0x1cc11c]={'$like':'%'+_0x2d64f9[_0x234a('0x30')][_0x234a('0x3a')]+'%'};return _0x2acc58;})});}_0x2f08c9=_['merge']({},_0x2f08c9,_0x2d64f9['options']);return _0xc7e6d6['getAllConditions'](_0x2f08c9);}})['then'](function(_0x15097e){if(_0x15097e){_0x12503f=_0x15097e[_0x234a('0x35')];if(!_0x2d64f9[_0x234a('0x30')]['hasOwnProperty'](_0x234a('0x36'))){_0x2f08c9['limit']=qs[_0x234a('0x1d')](_0x2d64f9[_0x234a('0x30')]['limit']);_0x2f08c9[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x1c')]);}return _0xc7e6d6['getAllConditions'](_0x2f08c9);}})['then'](function(_0x4b4472){if(_0x4b4472){return _0x4b4472?{'count':_0x12503f,'rows':_0x4b4472}:null;}})[_0x234a('0x23')](respondWithResult(_0x5ed9e0,null))[_0x234a('0x45')](handleError(_0x5ed9e0,null));};exports['getAnyConditions']=function(_0x464db6,_0x486c9f,_0x4d274b){var _0x598e05={};var _0x3647ae={};var _0x4f56d4;var _0x402ef6;return db[_0x234a('0x2d')][_0x234a('0x55')]({'where':{'id':_0x464db6['params']['id']}})['then'](handleEntityNotFound(_0x486c9f,null))['then'](function(_0x5c891c){if(_0x5c891c){_0x4f56d4=_0x5c891c;_0x3647ae['model']=_[_0x234a('0x43')](db[_0x234a('0x51')][_0x234a('0x2e')]);_0x3647ae[_0x234a('0x30')]=_['keys'](_0x464db6[_0x234a('0x30')]);_0x3647ae[_0x234a('0x31')]=_[_0x234a('0x32')](_0x3647ae['model'],_0x3647ae[_0x234a('0x30')]);_0x598e05[_0x234a('0x33')]=_[_0x234a('0x32')](_0x3647ae[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x464db6[_0x234a('0x30')][_0x234a('0x34')]));_0x598e05[_0x234a('0x33')]=_0x598e05[_0x234a('0x33')][_0x234a('0x35')]?_0x598e05[_0x234a('0x33')]:_0x3647ae[_0x234a('0x2f')];_0x598e05[_0x234a('0x37')]=qs['sort'](_0x464db6['query']['sort']);_0x598e05[_0x234a('0x3b')]=qs['filters'](_[_0x234a('0x39')](_0x464db6[_0x234a('0x30')],_0x3647ae[_0x234a('0x31')]));if(_0x464db6[_0x234a('0x30')]['filter']){_0x598e05[_0x234a('0x3b')]=_[_0x234a('0x3d')](_0x598e05['where'],{'$or':_[_0x234a('0x2c')](_0x598e05['attributes'],function(_0xd4eea7){var _0x39c511={};_0x39c511[_0xd4eea7]={'$like':'%'+_0x464db6[_0x234a('0x30')]['filter']+'%'};return _0x39c511;})});}_0x598e05=_[_0x234a('0x3d')]({},_0x598e05,_0x464db6[_0x234a('0x3e')]);return _0x4f56d4[_0x234a('0x56')](_0x598e05);}})[_0x234a('0x23')](function(_0x1d226e){if(_0x1d226e){_0x402ef6=_0x1d226e[_0x234a('0x35')];if(!_0x464db6['query'][_0x234a('0x57')](_0x234a('0x36'))){_0x598e05[_0x234a('0x1d')]=qs[_0x234a('0x1d')](_0x464db6[_0x234a('0x30')][_0x234a('0x1d')]);_0x598e05['offset']=qs['offset'](_0x464db6[_0x234a('0x30')][_0x234a('0x1c')]);}return _0x4f56d4[_0x234a('0x56')](_0x598e05);}})[_0x234a('0x23')](function(_0xe66148){if(_0xe66148){return _0xe66148?{'count':_0x402ef6,'rows':_0xe66148}:null;}})[_0x234a('0x23')](respondWithResult(_0x486c9f,null))['catch'](handleError(_0x486c9f,null));};exports['addAction']=function(_0x4a7103,_0x77558b,_0x5e01f1){if(_0x4a7103[_0x234a('0x47')]['id']){delete _0x4a7103[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x4a7103[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x77558b,null))[_0x234a('0x23')](function(_0x5a6c25){if(_0x5a6c25){_0x4a7103[_0x234a('0x47')]['TriggerId']=_0x5a6c25['id'];return db[_0x234a('0x58')][_0x234a('0x46')](_0x4a7103[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x77558b,null))['catch'](handleError(_0x77558b,null));};exports[_0x234a('0x59')]=function(_0x474428,_0x418e84,_0x1b2cb4){var _0x5a487d={};var _0x3e48af={};var _0x57cc85;var _0x204707;return db['Trigger']['findOne']({'where':{'id':_0x474428['params']['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x418e84,null))[_0x234a('0x23')](function(_0x114992){if(_0x114992){_0x57cc85=_0x114992;_0x3e48af['model']=_['keys'](db['Action']['rawAttributes']);_0x3e48af['query']=_[_0x234a('0x43')](_0x474428[_0x234a('0x30')]);_0x3e48af[_0x234a('0x31')]=_[_0x234a('0x32')](_0x3e48af[_0x234a('0x2f')],_0x3e48af[_0x234a('0x30')]);_0x5a487d['attributes']=_[_0x234a('0x32')](_0x3e48af[_0x234a('0x2f')],qs['fields'](_0x474428[_0x234a('0x30')][_0x234a('0x34')]));_0x5a487d['attributes']=_0x5a487d['attributes'][_0x234a('0x35')]?_0x5a487d[_0x234a('0x33')]:_0x3e48af[_0x234a('0x2f')];_0x5a487d['order']=qs[_0x234a('0x38')](_0x474428['query'][_0x234a('0x38')]);_0x5a487d[_0x234a('0x3b')]=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x474428['query'],_0x3e48af['filters']));if(_0x474428['query']['filter']){_0x5a487d['where']=_[_0x234a('0x3d')](_0x5a487d[_0x234a('0x3b')],{'$or':_[_0x234a('0x2c')](_0x5a487d['attributes'],function(_0x46865a){var _0xe705df={};_0xe705df[_0x46865a]={'$like':'%'+_0x474428['query'][_0x234a('0x3a')]+'%'};return _0xe705df;})});}_0x5a487d=_[_0x234a('0x3d')]({},_0x5a487d,_0x474428[_0x234a('0x3e')]);return _0x57cc85[_0x234a('0x59')](_0x5a487d);}})['then'](function(_0x5f422b){if(_0x5f422b){_0x204707=_0x5f422b[_0x234a('0x35')];if(!_0x474428['query'][_0x234a('0x57')](_0x234a('0x36'))){_0x5a487d[_0x234a('0x1d')]=qs[_0x234a('0x1d')](_0x474428[_0x234a('0x30')][_0x234a('0x1d')]);_0x5a487d[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x474428[_0x234a('0x30')][_0x234a('0x1c')]);}return _0x57cc85[_0x234a('0x59')](_0x5a487d);}})[_0x234a('0x23')](function(_0x4f6a07){if(_0x4f6a07){return _0x4f6a07?{'count':_0x204707,'rows':_0x4f6a07}:null;}})[_0x234a('0x23')](respondWithResult(_0x418e84,null))[_0x234a('0x45')](handleError(_0x418e84,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index cc3053b..44d8dfc 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 _0x5697=['moment','./trigger.attributes','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0x2ed113,_0x213ff2){var _0xb91ff7=function(_0x7c34f0){while(--_0x7c34f0){_0x2ed113['push'](_0x2ed113['shift']());}};_0xb91ff7(++_0x213ff2);}(_0x5697,0x1b5));var _0x7569=function(_0x1ec836,_0x1ce2d6){_0x1ec836=_0x1ec836-0x0;var _0x4baf71=_0x5697[_0x1ec836];return _0x4baf71;};'use strict';var _=require(_0x7569('0x0'));var util=require('util');var logger=require(_0x7569('0x1'))(_0x7569('0x2'));var moment=require(_0x7569('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7569('0x4'));module['exports']=function(_0x5705bd,_0x5afe12){return _0x5705bd[_0x7569('0x5')](_0x7569('0x6'),attributes,{'tableName':_0x7569('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b7c=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0x8b7c,0x119));var _0xc8b7=function(_0x2af3e1,_0xb5207f){_0x2af3e1=_0x2af3e1-0x0;var _0xfa27d=_0x8b7c[_0x2af3e1];return _0xfa27d;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'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 cc8e918..e4a4db5 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 _0x88da=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','then','ShowTrigger','find','util'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x88da,0x153));var _0xa88d=function(_0x404a81,_0x556eaa){_0x404a81=_0x404a81-0x0;var _0x4f58ea=_0x88da[_0x404a81];return _0x4f58ea;};'use strict';var _=require('lodash');var util=require(_0xa88d('0x0'));var moment=require(_0xa88d('0x1'));var BPromise=require(_0xa88d('0x2'));var rs=require(_0xa88d('0x3'));var fs=require('fs');var Redis=require(_0xa88d('0x4'));var db=require(_0xa88d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa88d('0x6'))(_0xa88d('0x7'));var config=require(_0xa88d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa88d('0x9')][_0xa88d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x76b893,_0x8c9f19,_0x7200c9){return new BPromise(function(_0x4d9b26,_0x191a2e){return client['request'](_0x76b893,_0x7200c9)['then'](function(_0x5647b0){logger[_0xa88d('0xb')](_0xa88d('0xc'),_0x8c9f19,_0xa88d('0xd'));logger[_0xa88d('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x8c9f19,'request\x20sent',JSON[_0xa88d('0xf')](_0x5647b0));if(_0x5647b0[_0xa88d('0x10')]){if(_0x5647b0[_0xa88d('0x10')][_0xa88d('0x11')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x8c9f19,_0x5647b0[_0xa88d('0x10')][_0xa88d('0x12')]);return _0x191a2e(_0x5647b0[_0xa88d('0x10')][_0xa88d('0x12')]);}logger[_0xa88d('0x10')]('Trigger,\x20%s,\x20%s',_0x8c9f19,_0x5647b0[_0xa88d('0x10')][_0xa88d('0x12')]);return _0x4d9b26(_0x5647b0[_0xa88d('0x10')]['message']);}else{logger[_0xa88d('0xb')](_0xa88d('0xc'),_0x8c9f19,'request\x20sent');_0x4d9b26(_0x5647b0[_0xa88d('0x13')][_0xa88d('0x12')]);}})[_0xa88d('0x14')](function(_0x33fcdd){logger[_0xa88d('0x10')](_0xa88d('0xc'),_0x8c9f19,_0x33fcdd);_0x191a2e(_0x33fcdd);});});}exports[_0xa88d('0x15')]=function(_0x26be4f){var _0x9a211f=this;return new Promise(function(_0x203d89,_0x894b1a){return db[_0xa88d('0x16')]['findAll']({'raw':_0x26be4f[_0xa88d('0x17')]?_0x26be4f['options'][_0xa88d('0x18')]===undefined?!![]:![]:!![],'where':_0x26be4f[_0xa88d('0x17')]?_0x26be4f['options'][_0xa88d('0x19')]||null:null,'attributes':_0x26be4f['options']?_0x26be4f[_0xa88d('0x17')][_0xa88d('0x1a')]||null:null,'limit':_0x26be4f[_0xa88d('0x17')]?_0x26be4f[_0xa88d('0x17')][_0xa88d('0x1b')]||null:null,'include':_0x26be4f[_0xa88d('0x17')]?_0x26be4f[_0xa88d('0x17')][_0xa88d('0x1c')]?_[_0xa88d('0x1d')](_0x26be4f[_0xa88d('0x17')]['include'],function(_0x5371a1){return{'model':db[_0x5371a1[_0xa88d('0x1e')]],'as':_0x5371a1['as'],'attributes':_0x5371a1[_0xa88d('0x1a')],'include':_0x5371a1[_0xa88d('0x1c')]?_[_0xa88d('0x1d')](_0x5371a1[_0xa88d('0x1c')],function(_0x34a40f){return{'model':db[_0x34a40f[_0xa88d('0x1e')]],'as':_0x34a40f['as'],'attributes':_0x34a40f[_0xa88d('0x1a')],'include':_0x34a40f[_0xa88d('0x1c')]?_['map'](_0x34a40f['include'],function(_0x5c780c){return{'model':db[_0x5c780c[_0xa88d('0x1e')]],'as':_0x5c780c['as'],'attributes':_0x5c780c[_0xa88d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa88d('0x1f')](function(_0x11d42c){logger[_0xa88d('0xb')](_0xa88d('0x15'),_0x26be4f);logger['debug'](_0xa88d('0x15'),_0x26be4f,JSON[_0xa88d('0xf')](_0x11d42c));_0x203d89(_0x11d42c);})[_0xa88d('0x14')](function(_0x2b4733){logger['error']('GetTrigger',_0x2b4733[_0xa88d('0x12')],_0x26be4f);_0x894b1a(_0x9a211f[_0xa88d('0x10')](0x1f4,_0x2b4733['message']));});});};exports[_0xa88d('0x20')]=function(_0x54b40a){var _0x3f871e=this;return new Promise(function(_0x560e8,_0x5c8902){return db[_0xa88d('0x16')][_0xa88d('0x21')]({'raw':_0x54b40a[_0xa88d('0x17')]?_0x54b40a[_0xa88d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x54b40a[_0xa88d('0x17')]?_0x54b40a['options'][_0xa88d('0x19')]||null:null,'attributes':_0x54b40a[_0xa88d('0x17')]?_0x54b40a[_0xa88d('0x17')][_0xa88d('0x1a')]||null:null,'include':_0x54b40a[_0xa88d('0x17')]?_0x54b40a['options'][_0xa88d('0x1c')]?_[_0xa88d('0x1d')](_0x54b40a['options'][_0xa88d('0x1c')],function(_0x31be6f){return{'model':db[_0x31be6f[_0xa88d('0x1e')]],'as':_0x31be6f['as'],'attributes':_0x31be6f[_0xa88d('0x1a')],'include':_0x31be6f['include']?_[_0xa88d('0x1d')](_0x31be6f[_0xa88d('0x1c')],function(_0x1e2f57){return{'model':db[_0x1e2f57[_0xa88d('0x1e')]],'as':_0x1e2f57['as'],'attributes':_0x1e2f57[_0xa88d('0x1a')],'include':_0x1e2f57[_0xa88d('0x1c')]?_[_0xa88d('0x1d')](_0x1e2f57['include'],function(_0x3e25ca){return{'model':db[_0x3e25ca[_0xa88d('0x1e')]],'as':_0x3e25ca['as'],'attributes':_0x3e25ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xa88d('0x1f')](function(_0x5ec298){logger[_0xa88d('0xb')](_0xa88d('0x20'),_0x54b40a);logger[_0xa88d('0xe')]('ShowTrigger',_0x54b40a,JSON[_0xa88d('0xf')](_0x5ec298));_0x560e8(_0x5ec298);})[_0xa88d('0x14')](function(_0x12eef5){logger['error'](_0xa88d('0x20'),_0x12eef5[_0xa88d('0x12')],_0x54b40a);_0x5c8902(_0x3f871e[_0xa88d('0x10')](0x1f4,_0x12eef5['message']));});});}; \ No newline at end of file +var _0x4ab6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','model','map','catch','ShowTrigger','find','util','moment','bluebird'];(function(_0x3ff95a,_0x2aeb82){var _0x172fd5=function(_0x424462){while(--_0x424462){_0x3ff95a['push'](_0x3ff95a['shift']());}};_0x172fd5(++_0x2aeb82);}(_0x4ab6,0x19f));var _0x64ab=function(_0x3920b4,_0x4cd07a){_0x3920b4=_0x3920b4-0x0;var _0x1ef94f=_0x4ab6[_0x3920b4];return _0x1ef94f;};'use strict';var _=require('lodash');var util=require(_0x64ab('0x0'));var moment=require(_0x64ab('0x1'));var BPromise=require(_0x64ab('0x2'));var rs=require(_0x64ab('0x3'));var fs=require('fs');var Redis=require(_0x64ab('0x4'));var db=require(_0x64ab('0x5'))['db'];var utils=require(_0x64ab('0x6'));var logger=require(_0x64ab('0x7'))(_0x64ab('0x8'));var config=require(_0x64ab('0x9'));var jayson=require(_0x64ab('0xa'));var client=jayson[_0x64ab('0xb')][_0x64ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18eb22,_0x27a53b,_0x41738c){return new BPromise(function(_0x5cb2e5,_0x44e8a8){return client[_0x64ab('0xd')](_0x18eb22,_0x41738c)[_0x64ab('0xe')](function(_0x2aabeb){logger[_0x64ab('0xf')]('Trigger,\x20%s,\x20%s',_0x27a53b,'request\x20sent');logger[_0x64ab('0x10')](_0x64ab('0x11'),_0x27a53b,_0x64ab('0x12'),JSON[_0x64ab('0x13')](_0x2aabeb));if(_0x2aabeb[_0x64ab('0x14')]){if(_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x15')]===0x1f4){logger[_0x64ab('0x14')](_0x64ab('0x16'),_0x27a53b,_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x17')]);return _0x44e8a8(_0x2aabeb['error'][_0x64ab('0x17')]);}logger['error'](_0x64ab('0x16'),_0x27a53b,_0x2aabeb['error']['message']);return _0x5cb2e5(_0x2aabeb['error'][_0x64ab('0x17')]);}else{logger['info'](_0x64ab('0x16'),_0x27a53b,_0x64ab('0x12'));_0x5cb2e5(_0x2aabeb[_0x64ab('0x18')][_0x64ab('0x17')]);}})['catch'](function(_0x12cb1e){logger[_0x64ab('0x14')]('Trigger,\x20%s,\x20%s',_0x27a53b,_0x12cb1e);_0x44e8a8(_0x12cb1e);});});}exports[_0x64ab('0x19')]=function(_0x20f441){var _0x34a972=this;return new Promise(function(_0x5bf4fa,_0x27579d){return db[_0x64ab('0x1a')][_0x64ab('0x1b')]({'raw':_0x20f441['options']?_0x20f441[_0x64ab('0x1c')][_0x64ab('0x1d')]===undefined?!![]:![]:!![],'where':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')][_0x64ab('0x1e')]||null:null,'attributes':_0x20f441[_0x64ab('0x1c')]?_0x20f441['options'][_0x64ab('0x1f')]||null:null,'limit':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')]['limit']||null:null,'include':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')]['include']?_['map'](_0x20f441['options'][_0x64ab('0x20')],function(_0x5e3506){return{'model':db[_0x5e3506[_0x64ab('0x21')]],'as':_0x5e3506['as'],'attributes':_0x5e3506[_0x64ab('0x1f')],'include':_0x5e3506['include']?_[_0x64ab('0x22')](_0x5e3506['include'],function(_0x416f61){return{'model':db[_0x416f61['model']],'as':_0x416f61['as'],'attributes':_0x416f61[_0x64ab('0x1f')],'include':_0x416f61['include']?_['map'](_0x416f61[_0x64ab('0x20')],function(_0x566b11){return{'model':db[_0x566b11[_0x64ab('0x21')]],'as':_0x566b11['as'],'attributes':_0x566b11['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ab('0xe')](function(_0x335f86){logger[_0x64ab('0xf')]('GetTrigger',_0x20f441);logger[_0x64ab('0x10')]('GetTrigger',_0x20f441,JSON[_0x64ab('0x13')](_0x335f86));_0x5bf4fa(_0x335f86);})[_0x64ab('0x23')](function(_0xb04e8e){logger[_0x64ab('0x14')]('GetTrigger',_0xb04e8e['message'],_0x20f441);_0x27579d(_0x34a972['error'](0x1f4,_0xb04e8e['message']));});});};exports[_0x64ab('0x24')]=function(_0x52e6d8){var _0x1441b3=this;return new Promise(function(_0x2637c9,_0x2aa65d){return db['Trigger'][_0x64ab('0x25')]({'raw':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')][_0x64ab('0x1e')]||null:null,'attributes':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')]['attributes']||null:null,'include':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')]['include']?_[_0x64ab('0x22')](_0x52e6d8[_0x64ab('0x1c')][_0x64ab('0x20')],function(_0x583372){return{'model':db[_0x583372['model']],'as':_0x583372['as'],'attributes':_0x583372[_0x64ab('0x1f')],'include':_0x583372[_0x64ab('0x20')]?_[_0x64ab('0x22')](_0x583372['include'],function(_0xe1cf0){return{'model':db[_0xe1cf0[_0x64ab('0x21')]],'as':_0xe1cf0['as'],'attributes':_0xe1cf0[_0x64ab('0x1f')],'include':_0xe1cf0[_0x64ab('0x20')]?_[_0x64ab('0x22')](_0xe1cf0['include'],function(_0x5e2ee0){return{'model':db[_0x5e2ee0['model']],'as':_0x5e2ee0['as'],'attributes':_0x5e2ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ab('0xe')](function(_0x10c3d7){logger[_0x64ab('0xf')]('ShowTrigger',_0x52e6d8);logger[_0x64ab('0x10')](_0x64ab('0x24'),_0x52e6d8,JSON['stringify'](_0x10c3d7));_0x2637c9(_0x10c3d7);})[_0x64ab('0x23')](function(_0x38f48b){logger[_0x64ab('0x14')](_0x64ab('0x24'),_0x38f48b[_0x64ab('0x17')],_0x52e6d8);_0x2aa65d(_0x1441b3['error'](0x1f4,_0x38f48b['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e2c1413..8cd05ab 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 _0xf021=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','update','delete','destroy','util'];(function(_0x8efee7,_0x184583){var _0x513d65=function(_0x28b1a4){while(--_0x28b1a4){_0x8efee7['push'](_0x8efee7['shift']());}};_0x513d65(++_0x184583);}(_0xf021,0x168));var _0x1f02=function(_0x38de16,_0x2acea8){_0x38de16=_0x38de16-0x0;var _0x594a90=_0xf021[_0x38de16];return _0x594a90;};'use strict';var multer=require('multer');var util=require(_0x1f02('0x0'));var path=require(_0x1f02('0x1'));var timeout=require(_0x1f02('0x2'));var express=require(_0x1f02('0x3'));var router=express[_0x1f02('0x4')]();var fs_extra=require(_0x1f02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var controller=require(_0x1f02('0x8'));router[_0x1f02('0x9')]('/',auth[_0x1f02('0xa')](),controller[_0x1f02('0xb')]);router[_0x1f02('0x9')](_0x1f02('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1f02('0xd')](_0x1f02('0xe'),auth['isAuthenticated'](),controller[_0x1f02('0xf')]);router[_0x1f02('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1f02('0xc'),auth['isAuthenticated'](),controller[_0x1f02('0x10')]);router[_0x1f02('0x11')](_0x1f02('0xc'),auth[_0x1f02('0xa')](),controller[_0x1f02('0x12')]);module['exports']=router; \ No newline at end of file +var _0x47f2=['get','isAuthenticated','show','post','/:id/clone','clone','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47f2,0x186));var _0x247f=function(_0x5dd217,_0x32307f){_0x5dd217=_0x5dd217-0x0;var _0x31bb18=_0x47f2[_0x5dd217];return _0x31bb18;};'use strict';var multer=require(_0x247f('0x0'));var util=require(_0x247f('0x1'));var path=require('path');var timeout=require(_0x247f('0x2'));var express=require(_0x247f('0x3'));var router=express[_0x247f('0x4')]();var fs_extra=require(_0x247f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x247f('0x6'));var config=require(_0x247f('0x7'));var controller=require(_0x247f('0x8'));router[_0x247f('0x9')]('/',auth[_0x247f('0xa')](),controller['index']);router[_0x247f('0x9')]('/:id',auth[_0x247f('0xa')](),controller[_0x247f('0xb')]);router[_0x247f('0xc')](_0x247f('0xd'),auth[_0x247f('0xa')](),controller[_0x247f('0xe')]);router[_0x247f('0xc')]('/',auth[_0x247f('0xa')](),controller[_0x247f('0xf')]);router[_0x247f('0x10')]('/:id',auth[_0x247f('0xa')](),controller['update']);router[_0x247f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x247f('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2d4af1e..12cae62 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 _0x8021=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','join','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','BOOLEAN','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','transport','getDataValue'];(function(_0x247543,_0x368968){var _0x2f3203=function(_0x47a443){while(--_0x47a443){_0x247543['push'](_0x247543['shift']());}};_0x2f3203(++_0x368968);}(_0x8021,0x7e));var _0x1802=function(_0x5cf5fd,_0x4bca34){_0x5cf5fd=_0x5cf5fd-0x0;var _0x4a53ec=_0x8021[_0x5cf5fd];return _0x4a53ec;};'use strict';var Sequelize=require('sequelize');module[_0x1802('0x0')]={'name':{'type':Sequelize[_0x1802('0x1')],'allowNull':![],'unique':_0x1802('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1802('0x3'),_0x1802('0x4'),_0x1802('0x5')),'allowNull':![],'defaultValue':_0x1802('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1802('0x6')]('ALLOWED_NOT_SCREENED',_0x1802('0x7'),_0x1802('0x8'),_0x1802('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x1802('0x1')]},'permit':{'type':Sequelize[_0x1802('0x1')]},'secret':{'type':Sequelize[_0x1802('0x1')]},'md5secret':{'type':Sequelize[_0x1802('0x1')]},'remotesecret':{'type':Sequelize[_0x1802('0x1')]},'transport':{'type':Sequelize[_0x1802('0x1')],'defaultValue':'udp','set':function(_0x7e9be0){this['setDataValue'](_0x1802('0xa'),_0x7e9be0?_0x7e9be0['join'](','):null);},'get':function(){return this[_0x1802('0xb')]('transport')?this[_0x1802('0xb')](_0x1802('0xa'))[_0x1802('0xc')](','):null;},'comment':_0x1802('0xd')},'dtmfmode':{'type':Sequelize[_0x1802('0x6')](_0x1802('0xe'),_0x1802('0xf'),_0x1802('0x10'),'inband',_0x1802('0x11')),'defaultValue':_0x1802('0xe')},'directmedia':{'type':Sequelize[_0x1802('0x6')]('yes','no',_0x1802('0x12'),'update',_0x1802('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1802('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1802('0x1')]},'directmediadeny':{'type':Sequelize[_0x1802('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1802('0x14'),'set':function(_0x2f6a0c){this[_0x1802('0x15')](_0x1802('0x16'),_0x2f6a0c?_0x2f6a0c['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x1802('0xb')](_0x1802('0x16'))['split'](','):null;},'comment':_0x1802('0x17')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1802('0x1')]},'pickupgroup':{'type':Sequelize[_0x1802('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1802('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1802('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1802('0x1')],'defaultValue':_0x1802('0x18')},'allow':{'type':Sequelize[_0x1802('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x16297a){this[_0x1802('0x15')](_0x1802('0x19'),_0x16297a?_0x16297a[_0x1802('0x1a')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1802('0xb')](_0x1802('0x19'))?this[_0x1802('0xb')]('allow')[_0x1802('0xc')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no')},'insecure':{'type':Sequelize[_0x1802('0x1')],'defaultValue':_0x1802('0x1c'),'set':function(_0x23cce8){this['setDataValue']('insecure',_0x23cce8?_0x23cce8['join'](','):null);},'get':function(){return this[_0x1802('0xb')](_0x1802('0x1d'))?this[_0x1802('0xb')](_0x1802('0x1d'))[_0x1802('0xc')](','):null;},'comment':_0x1802('0x1e')},'trustrpid':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no',_0x1802('0x1f'))},'promiscredir':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x1802('0x20')](0xb)},'setvar':{'type':Sequelize[_0x1802('0x1')]},'callerid':{'type':Sequelize[_0x1802('0x1')],'defaultValue':_0x1802('0x21')},'amaflags':{'type':Sequelize[_0x1802('0x1')]},'callcounter':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no'),'defaultValue':_0x1802('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x1802('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x1802('0x1')]},'template':{'type':Sequelize[_0x1802('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no',_0x1802('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1802('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x1802('0x1')]},'session_timers':{'type':Sequelize[_0x1802('0x6')]('accept',_0x1802('0x23'),_0x1802('0x24'))},'session_expires':{'type':Sequelize[_0x1802('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x1802('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x25'),_0x1802('0x26')),'defaultValue':_0x1802('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x1802('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x1802('0x1')]},'fromuser':{'type':Sequelize[_0x1802('0x1')]},'port':{'type':Sequelize[_0x1802('0x20')](0x5)},'qualify':{'type':Sequelize[_0x1802('0x6')]('yes','no'),'defaultValue':_0x1802('0x1b')},'keepalive':{'type':Sequelize[_0x1802('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x1802('0x1')]},'defaultuser':{'type':Sequelize[_0x1802('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1802('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1802('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x1802('0x6')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1802('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x1802('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x1802('0x1')]},'contactdeny':{'type':Sequelize[_0x1802('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x1802('0x1')]},'use_q850_reason':{'type':Sequelize[_0x1802('0x1')]},'maxforwards':{'type':Sequelize[_0x1802('0x20')](0xb)},'encryption':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x1802('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no',_0x1802('0x27'),_0x1802('0x28'))},'dtlsrekey':{'type':Sequelize[_0x1802('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1802('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x1802('0x1')]},'dtlscafile':{'type':Sequelize[_0x1802('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x29'),_0x1802('0x2a'),_0x1802('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x1802('0x1')]},'call_limit':{'type':Sequelize[_0x1802('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x1802('0x1')]},'mohinterpret':{'type':Sequelize[_0x1802('0x1')]},'mohsuggest':{'type':Sequelize[_0x1802('0x1')]},'parkinglot':{'type':Sequelize[_0x1802('0x1')]},'description':{'type':Sequelize[_0x1802('0x1')]},'host':{'type':Sequelize[_0x1802('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1802('0x6')](_0x1802('0x1b'),'no',_0x1802('0x12'),_0x1802('0x2c'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1802('0x1')]},'otherFields':{'type':Sequelize[_0x1802('0x1')]},'active':{'type':Sequelize[_0x1802('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1802('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9b9f=['join','getDataValue','rfc2833','info','inband','yes','nonat','outgoing','force_rport,comedia','setDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','\x22\x22\x20<>','INTEGER','always','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x41b8f9,_0x2e5a01){var _0x5145d1=function(_0x1aafe9){while(--_0x1aafe9){_0x41b8f9['push'](_0x41b8f9['shift']());}};_0x5145d1(++_0x2e5a01);}(_0x9b9f,0x80));var _0xf9b9=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x9b9f[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0xf9b9('0x0'));module['exports']={'name':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'unique':_0xf9b9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf9b9('0x3'),_0xf9b9('0x4'),_0xf9b9('0x5')),'allowNull':![],'defaultValue':_0xf9b9('0x3')},'context':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'defaultValue':_0xf9b9('0x6')},'callingpres':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x8'),_0xf9b9('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xf9b9('0xa'),_0xf9b9('0xb'),_0xf9b9('0xc'),_0xf9b9('0xd'))},'deny':{'type':Sequelize[_0xf9b9('0x1')]},'permit':{'type':Sequelize[_0xf9b9('0x1')]},'secret':{'type':Sequelize[_0xf9b9('0x1')]},'md5secret':{'type':Sequelize[_0xf9b9('0x1')]},'remotesecret':{'type':Sequelize[_0xf9b9('0x1')]},'transport':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0xe'),'set':function(_0x173e7b){this['setDataValue'](_0xf9b9('0xf'),_0x173e7b?_0x173e7b[_0xf9b9('0x10')](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0xf'))?this[_0xf9b9('0x11')](_0xf9b9('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xf9b9('0x12'),_0xf9b9('0x13'),'shortinfo',_0xf9b9('0x14'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x16'),'update',_0xf9b9('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf9b9('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x18'),'set':function(_0x25b06b){this[_0xf9b9('0x19')]('nat',_0x25b06b?_0x25b06b['join'](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0x1a'))?this['getDataValue'](_0xf9b9('0x1a'))[_0xf9b9('0x1b')](','):null;},'comment':_0xf9b9('0x1c')},'callgroup':{'type':Sequelize[_0xf9b9('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf9b9('0x1')]},'pickupgroup':{'type':Sequelize[_0xf9b9('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xf9b9('0x1')]},'language':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x1d')},'allow':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'defaultValue':_0xf9b9('0x1e'),'set':function(_0x3b33b7){this[_0xf9b9('0x19')](_0xf9b9('0x1f'),_0x3b33b7?_0x3b33b7[_0xf9b9('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf9b9('0x11')]('allow')?this[_0xf9b9('0x11')](_0xf9b9('0x1f'))[_0xf9b9('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'insecure':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x20'),'set':function(_0xb2e5a0){this[_0xf9b9('0x19')]('insecure',_0xb2e5a0?_0xb2e5a0[_0xf9b9('0x10')](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0x21'))?this['getDataValue'](_0xf9b9('0x21'))[_0xf9b9('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xf9b9('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xf9b9('0x22')},'amaflags':{'type':Sequelize[_0xf9b9('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf9b9('0x1')]},'videosupport':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'mailbox':{'type':Sequelize[_0xf9b9('0x1')]},'session_timers':{'type':Sequelize[_0xf9b9('0x7')]('accept',_0xf9b9('0x25'),'originate')},'session_expires':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xf9b9('0x26'),_0xf9b9('0x27')),'defaultValue':_0xf9b9('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf9b9('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf9b9('0x15')},'keepalive':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf9b9('0x1')]},'rtptimeout':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xf9b9('0x7')]('yes','no',_0xf9b9('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf9b9('0x1')]},'timert1':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'timerb':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf9b9('0x1')]},'contactacl':{'type':Sequelize[_0xf9b9('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xf9b9('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf9b9('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'force_avp':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'icesupport':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf9b9('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xf9b9('0x1')]},'dtlscipher':{'type':Sequelize[_0xf9b9('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf9b9('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf9b9('0x2a'),_0xf9b9('0x2b'),_0xf9b9('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf9b9('0x1')]},'usereqphone':{'type':Sequelize[_0xf9b9('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf9b9('0x1')]},'recordofffeature':{'type':Sequelize[_0xf9b9('0x1')]},'call_limit':{'type':Sequelize[_0xf9b9('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'vmexten':{'type':Sequelize[_0xf9b9('0x1')]},'mohinterpret':{'type':Sequelize[_0xf9b9('0x1')]},'mohsuggest':{'type':Sequelize[_0xf9b9('0x1')]},'parkinglot':{'type':Sequelize[_0xf9b9('0x1')]},'description':{'type':Sequelize[_0xf9b9('0x1')]},'host':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x2d')},'canreinvite':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x16'),'update',_0xf9b9('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf9b9('0x1')]},'otherFields':{'type':Sequelize[_0xf9b9('0x1')]},'active':{'type':Sequelize[_0xf9b9('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf9b9('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 b46dd91..5abaecc 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b84,0x1cc));var _0x44b8=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x4b84[_0x586fa2];return _0x515be9;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b84,0x1cc));var _0x44b8=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x4b84[_0x146a97];return _0x259d5c;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7387f81..dce4efd 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 _0xae14=['rimraf','../../config/environment','exports','Trunk','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4d0e35,_0x3916de){var _0x2b22c3=function(_0x420b58){while(--_0x420b58){_0x4d0e35['push'](_0x4d0e35['shift']());}};_0x2b22c3(++_0x3916de);}(_0xae14,0xf6));var _0x4ae1=function(_0x5cc0b7,_0x94b26b){_0x5cc0b7=_0x5cc0b7-0x0;var _0x2cf1da=_0xae14[_0x5cc0b7];return _0x2cf1da;};'use strict';var _=require(_0x4ae1('0x0'));var util=require(_0x4ae1('0x1'));var logger=require(_0x4ae1('0x2'))(_0x4ae1('0x3'));var moment=require(_0x4ae1('0x4'));var BPromise=require(_0x4ae1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ae1('0x6'));var rimraf=require(_0x4ae1('0x7'));var config=require(_0x4ae1('0x8'));var attributes=require('./trunk.attributes');module[_0x4ae1('0x9')]=function(_0x1e091a,_0x5272b8){return _0x1e091a['define'](_0x4ae1('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72e3=['rimraf','../../config/environment','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x434990,_0x53a229){var _0x20ac46=function(_0x2cafc3){while(--_0x2cafc3){_0x434990['push'](_0x434990['shift']());}};_0x20ac46(++_0x53a229);}(_0x72e3,0xfb));var _0x372e=function(_0x51c94d,_0x205d6a){_0x51c94d=_0x51c94d-0x0;var _0x5de98c=_0x72e3[_0x51c94d];return _0x5de98c;};'use strict';var _=require(_0x372e('0x0'));var util=require(_0x372e('0x1'));var logger=require(_0x372e('0x2'))('api');var moment=require(_0x372e('0x3'));var BPromise=require(_0x372e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x372e('0x5'));var config=require(_0x372e('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x3c58c2,_0x1a0b32){return _0x3c58c2[_0x372e('0x7')]('Trunk',attributes,{'tableName':'tools_trunks','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 ad318b1..78cb36b 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 _0x078a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Trunk','findAll','options','where','attributes','limit','map','include','model','then','GetTrunk','debug','stringify','find','raw','ShowTrunk','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x078a,0x1c1));var _0xa078=function(_0x339b35,_0x5d876d){_0x339b35=_0x339b35-0x0;var _0x569485=_0x078a[_0x339b35];return _0x569485;};'use strict';var _=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var moment=require(_0xa078('0x2'));var BPromise=require('bluebird');var rs=require(_0xa078('0x3'));var fs=require('fs');var Redis=require(_0xa078('0x4'));var db=require(_0xa078('0x5'))['db'];var utils=require(_0xa078('0x6'));var logger=require(_0xa078('0x7'))(_0xa078('0x8'));var config=require(_0xa078('0x9'));var jayson=require(_0xa078('0xa'));var client=jayson[_0xa078('0xb')][_0xa078('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x459178,_0x489ae9,_0x354649){return new BPromise(function(_0x4409de,_0x304f88){return client[_0xa078('0xd')](_0x459178,_0x354649)['then'](function(_0x2e82e0){logger['info'](_0xa078('0xe'),_0x489ae9,_0xa078('0xf'));logger['debug'](_0xa078('0x10'),_0x489ae9,_0xa078('0xf'),JSON['stringify'](_0x2e82e0));if(_0x2e82e0['error']){if(_0x2e82e0[_0xa078('0x11')][_0xa078('0x12')]===0x1f4){logger[_0xa078('0x11')](_0xa078('0xe'),_0x489ae9,_0x2e82e0[_0xa078('0x11')][_0xa078('0x13')]);return _0x304f88(_0x2e82e0[_0xa078('0x11')][_0xa078('0x13')]);}logger[_0xa078('0x11')](_0xa078('0xe'),_0x489ae9,_0x2e82e0['error'][_0xa078('0x13')]);return _0x4409de(_0x2e82e0[_0xa078('0x11')]['message']);}else{logger[_0xa078('0x14')]('Trunk,\x20%s,\x20%s',_0x489ae9,_0xa078('0xf'));_0x4409de(_0x2e82e0['result']['message']);}})[_0xa078('0x15')](function(_0x55ab5f){logger[_0xa078('0x11')]('Trunk,\x20%s,\x20%s',_0x489ae9,_0x55ab5f);_0x304f88(_0x55ab5f);});});}exports['GetTrunk']=function(_0x26f88b){var _0x321ddc=this;return new Promise(function(_0x545484,_0x20f963){return db[_0xa078('0x16')][_0xa078('0x17')]({'raw':_0x26f88b['options']?_0x26f88b[_0xa078('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x26f88b[_0xa078('0x18')]?_0x26f88b['options'][_0xa078('0x19')]||null:null,'attributes':_0x26f88b['options']?_0x26f88b[_0xa078('0x18')][_0xa078('0x1a')]||null:null,'limit':_0x26f88b[_0xa078('0x18')]?_0x26f88b['options'][_0xa078('0x1b')]||null:null,'include':_0x26f88b[_0xa078('0x18')]?_0x26f88b[_0xa078('0x18')]['include']?_[_0xa078('0x1c')](_0x26f88b[_0xa078('0x18')][_0xa078('0x1d')],function(_0x36b4bb){return{'model':db[_0x36b4bb[_0xa078('0x1e')]],'as':_0x36b4bb['as'],'attributes':_0x36b4bb['attributes'],'include':_0x36b4bb[_0xa078('0x1d')]?_[_0xa078('0x1c')](_0x36b4bb['include'],function(_0x406840){return{'model':db[_0x406840[_0xa078('0x1e')]],'as':_0x406840['as'],'attributes':_0x406840[_0xa078('0x1a')],'include':_0x406840[_0xa078('0x1d')]?_[_0xa078('0x1c')](_0x406840[_0xa078('0x1d')],function(_0x48bcf2){return{'model':db[_0x48bcf2[_0xa078('0x1e')]],'as':_0x48bcf2['as'],'attributes':_0x48bcf2[_0xa078('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa078('0x1f')](function(_0x2145c8){logger[_0xa078('0x14')](_0xa078('0x20'),_0x26f88b);logger[_0xa078('0x21')](_0xa078('0x20'),_0x26f88b,JSON[_0xa078('0x22')](_0x2145c8));_0x545484(_0x2145c8);})['catch'](function(_0x50798d){logger[_0xa078('0x11')](_0xa078('0x20'),_0x50798d[_0xa078('0x13')],_0x26f88b);_0x20f963(_0x321ddc['error'](0x1f4,_0x50798d[_0xa078('0x13')]));});});};exports['ShowTrunk']=function(_0x5d60cd){var _0x12c033=this;return new Promise(function(_0x49f6fc,_0x5219bb){return db[_0xa078('0x16')][_0xa078('0x23')]({'raw':_0x5d60cd['options']?_0x5d60cd[_0xa078('0x18')][_0xa078('0x24')]===undefined?!![]:![]:!![],'where':_0x5d60cd['options']?_0x5d60cd[_0xa078('0x18')][_0xa078('0x19')]||null:null,'attributes':_0x5d60cd[_0xa078('0x18')]?_0x5d60cd['options'][_0xa078('0x1a')]||null:null,'include':_0x5d60cd[_0xa078('0x18')]?_0x5d60cd[_0xa078('0x18')][_0xa078('0x1d')]?_['map'](_0x5d60cd[_0xa078('0x18')][_0xa078('0x1d')],function(_0x2585ca){return{'model':db[_0x2585ca[_0xa078('0x1e')]],'as':_0x2585ca['as'],'attributes':_0x2585ca['attributes'],'include':_0x2585ca[_0xa078('0x1d')]?_['map'](_0x2585ca[_0xa078('0x1d')],function(_0x5a429b){return{'model':db[_0x5a429b[_0xa078('0x1e')]],'as':_0x5a429b['as'],'attributes':_0x5a429b[_0xa078('0x1a')],'include':_0x5a429b['include']?_['map'](_0x5a429b['include'],function(_0x41e6d6){return{'model':db[_0x41e6d6['model']],'as':_0x41e6d6['as'],'attributes':_0x41e6d6[_0xa078('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa078('0x1f')](function(_0x3496a6){logger[_0xa078('0x14')](_0xa078('0x25'),_0x5d60cd);logger[_0xa078('0x21')]('ShowTrunk',_0x5d60cd,JSON[_0xa078('0x22')](_0x3496a6));_0x49f6fc(_0x3496a6);})[_0xa078('0x15')](function(_0x1573d7){logger['error'](_0xa078('0x25'),_0x1573d7[_0xa078('0x13')],_0x5d60cd);_0x5219bb(_0x12c033['error'](0x1f4,_0x1573d7[_0xa078('0x13')]));});});}; \ No newline at end of file +var _0x6334=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options','where','attributes','limit','map','include','model','message','ShowTrunk','Trunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1e36e0,_0x575529){var _0x5ca698=function(_0x1a7697){while(--_0x1a7697){_0x1e36e0['push'](_0x1e36e0['shift']());}};_0x5ca698(++_0x575529);}(_0x6334,0x119));var _0x4633=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x6334[_0x35f6b4];return _0x10f072;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a8997,_0x5647f1,_0x56891d){return new BPromise(function(_0x21af74,_0x148e72){return client['request'](_0x4a8997,_0x56891d)[_0x4633('0xd')](function(_0x31e794){logger[_0x4633('0xe')]('Trunk,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'));logger[_0x4633('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'),JSON[_0x4633('0x11')](_0x31e794));if(_0x31e794[_0x4633('0x12')]){if(_0x31e794[_0x4633('0x12')]['code']===0x1f4){logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794[_0x4633('0x12')]['message']);return _0x148e72(_0x31e794['error']['message']);}logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794['error']['message']);return _0x21af74(_0x31e794[_0x4633('0x12')]['message']);}else{logger[_0x4633('0xe')](_0x4633('0x13'),_0x5647f1,_0x4633('0xf'));_0x21af74(_0x31e794[_0x4633('0x14')]['message']);}})[_0x4633('0x15')](function(_0x15bd98){logger[_0x4633('0x12')]('Trunk,\x20%s,\x20%s',_0x5647f1,_0x15bd98);_0x148e72(_0x15bd98);});});}exports[_0x4633('0x16')]=function(_0x37e536){var _0x1c7186=this;return new Promise(function(_0x2ad562,_0xbab957){return db['Trunk'][_0x4633('0x17')]({'raw':_0x37e536[_0x4633('0x18')]?_0x37e536['options']['raw']===undefined?!![]:![]:!![],'where':_0x37e536[_0x4633('0x18')]?_0x37e536['options'][_0x4633('0x19')]||null:null,'attributes':_0x37e536['options']?_0x37e536['options'][_0x4633('0x1a')]||null:null,'limit':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')][_0x4633('0x1b')]||null:null,'include':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')]['include']?_[_0x4633('0x1c')](_0x37e536['options'][_0x4633('0x1d')],function(_0xcfac3f){return{'model':db[_0xcfac3f[_0x4633('0x1e')]],'as':_0xcfac3f['as'],'attributes':_0xcfac3f[_0x4633('0x1a')],'include':_0xcfac3f[_0x4633('0x1d')]?_['map'](_0xcfac3f[_0x4633('0x1d')],function(_0x399220){return{'model':db[_0x399220[_0x4633('0x1e')]],'as':_0x399220['as'],'attributes':_0x399220[_0x4633('0x1a')],'include':_0x399220[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x399220[_0x4633('0x1d')],function(_0x368582){return{'model':db[_0x368582[_0x4633('0x1e')]],'as':_0x368582['as'],'attributes':_0x368582[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x2539a2){logger[_0x4633('0xe')](_0x4633('0x16'),_0x37e536);logger[_0x4633('0x10')](_0x4633('0x16'),_0x37e536,JSON[_0x4633('0x11')](_0x2539a2));_0x2ad562(_0x2539a2);})[_0x4633('0x15')](function(_0x5de12a){logger[_0x4633('0x12')](_0x4633('0x16'),_0x5de12a[_0x4633('0x1f')],_0x37e536);_0xbab957(_0x1c7186[_0x4633('0x12')](0x1f4,_0x5de12a[_0x4633('0x1f')]));});});};exports[_0x4633('0x20')]=function(_0x559fa5){var _0x23c33c=this;return new Promise(function(_0x52fc85,_0x1d3811){return db[_0x4633('0x21')][_0x4633('0x22')]({'raw':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x23')]===undefined?!![]:![]:!![],'where':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x19')]||null:null,'attributes':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x1a')]||null:null,'include':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')]['include']?_['map'](_0x559fa5[_0x4633('0x18')][_0x4633('0x1d')],function(_0x5177f2){return{'model':db[_0x5177f2[_0x4633('0x1e')]],'as':_0x5177f2['as'],'attributes':_0x5177f2[_0x4633('0x1a')],'include':_0x5177f2[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x5177f2['include'],function(_0x3f92ef){return{'model':db[_0x3f92ef['model']],'as':_0x3f92ef['as'],'attributes':_0x3f92ef[_0x4633('0x1a')],'include':_0x3f92ef[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x3f92ef[_0x4633('0x1d')],function(_0x213768){return{'model':db[_0x213768[_0x4633('0x1e')]],'as':_0x213768['as'],'attributes':_0x213768[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x546390){logger[_0x4633('0xe')](_0x4633('0x20'),_0x559fa5);logger['debug'](_0x4633('0x20'),_0x559fa5,JSON[_0x4633('0x11')](_0x546390));_0x52fc85(_0x546390);})[_0x4633('0x15')](function(_0x468648){logger['error']('ShowTrunk',_0x468648[_0x4633('0x1f')],_0x559fa5);_0x1d3811(_0x23c33c['error'](0x1f4,_0x468648['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 96c9ecc..3086c38 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa02f=['express','./user-setting.controller','/:id','isAuthenticated','update','exports'];(function(_0x13504e,_0x1f3e5){var _0x297ddb=function(_0x337a9b){while(--_0x337a9b){_0x13504e['push'](_0x13504e['shift']());}};_0x297ddb(++_0x1f3e5);}(_0xa02f,0x120));var _0xfa02=function(_0x3691b2,_0x1d496d){_0x3691b2=_0x3691b2-0x0;var _0x2d16bd=_0xa02f[_0x3691b2];return _0x2d16bd;};'use strict';var express=require(_0xfa02('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xfa02('0x1'));router['put'](_0xfa02('0x2'),auth[_0xfa02('0x3')](),controller[_0xfa02('0x4')]);module[_0xfa02('0x5')]=router; \ No newline at end of file +var _0xcfe3=['put','/:id','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x1d0213,_0x337f9e){var _0x18ff7b=function(_0x79afff){while(--_0x79afff){_0x1d0213['push'](_0x1d0213['shift']());}};_0x18ff7b(++_0x337f9e);}(_0xcfe3,0x18c));var _0x3cfe=function(_0x444990,_0x4b4ee6){_0x444990=_0x444990-0x0;var _0x486d89=_0xcfe3[_0x444990];return _0x486d89;};'use strict';var express=require(_0x3cfe('0x0'));var router=express[_0x3cfe('0x1')]();var auth=require(_0x3cfe('0x2'));var controller=require('./user-setting.controller');router[_0x3cfe('0x3')](_0x3cfe('0x4'),auth[_0x3cfe('0x5')](),controller[_0x3cfe('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 0b64f75..3041856 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7f0=['info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error','warning'];(function(_0x42b55c,_0x147895){var _0x352426=function(_0x14e3cc){while(--_0x14e3cc){_0x42b55c['push'](_0x42b55c['shift']());}};_0x352426(++_0x147895);}(_0xf7f0,0x1b6));var _0x0f7f=function(_0xef3cc8,_0x3c08ec){_0xef3cc8=_0xef3cc8-0x0;var _0x132bbf=_0xf7f0[_0xef3cc8];return _0x132bbf;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0f7f('0x0'),_0x0f7f('0x1'),_0x0f7f('0x2'),'debug'];module[_0x0f7f('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0f7f('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0f7f('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x0f7f('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0f7f('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0f7f('0x8')],'unique':_0x0f7f('0x9')}}; \ No newline at end of file +var _0x265b=['UserId','sequelize','error','warning','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x32f7b3,_0x47f0df){var _0x16be9a=function(_0x206985){while(--_0x206985){_0x32f7b3['push'](_0x32f7b3['shift']());}};_0x16be9a(++_0x47f0df);}(_0x265b,0x119));var _0xb265=function(_0x2bc89f,_0xc06799){_0x2bc89f=_0x2bc89f-0x0;var _0x4dfb39=_0x265b[_0x2bc89f];return _0x4dfb39;};'use strict';var Sequelize=require(_0xb265('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb265('0x1'),_0xb265('0x2'),'info','debug'];module[_0xb265('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb265('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb265('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb265('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb265('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb265('0x8')],'unique':_0xb265('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index faf6246..0944605 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6611=['../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','update','then','sendStatus','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','ioredis','../../config/logger','api','../../config/environment'];(function(_0x4cc4aa,_0x171c90){var _0x5b5de2=function(_0x3186da){while(--_0x3186da){_0x4cc4aa['push'](_0x4cc4aa['shift']());}};_0x5b5de2(++_0x171c90);}(_0x6611,0xdd));var _0x1661=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6611[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var Redis=require(_0x1661('0x0'));var logger=require(_0x1661('0x1'))(_0x1661('0x2'));var config=require(_0x1661('0x3'));var db=require(_0x1661('0x4'))['db'];var socket=require(_0x1661('0x5'))(new Redis(config[_0x1661('0x6')]));require(_0x1661('0x7'))[_0x1661('0x8')](socket);config[_0x1661('0x6')]=_[_0x1661('0x9')](config[_0x1661('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x516d22,_0x3f32f3){_0x3f32f3=_0x3f32f3||0xc8;return function(_0x3be60f){if(_0x3be60f){return _0x516d22['status'](_0x3f32f3)['json'](_0x3be60f);}};}function saveUpdates(_0x9a6c9b){return function(_0x403afc){if(_0x403afc){return _0x403afc[_0x1661('0xa')](_0x9a6c9b)[_0x1661('0xb')](function(_0x352ca0){return _0x352ca0;});}return null;};}function handleEntityNotFound(_0x478300){return function(_0x11a269){if(!_0x11a269){_0x478300[_0x1661('0xc')](0x194);}return _0x11a269;};}function handleError(_0x4beb37,_0x156822){_0x156822=_0x156822||0x1f4;return function(_0x2197f2){logger['error'](_0x2197f2[_0x1661('0xd')]);if(_0x2197f2['name']){delete _0x2197f2[_0x1661('0xe')];}_0x4beb37[_0x1661('0xf')](_0x156822)[_0x1661('0x10')](_0x2197f2);};}exports[_0x1661('0xa')]=function(_0x3a2de4,_0x11843d){if(_0x3a2de4[_0x1661('0x11')][_0x1661('0x12')]!==_0x1661('0x13'))throw new Error(_0x1661('0x14'));if(isNaN(Number(_0x3a2de4[_0x1661('0x15')]['id'])))throw new Error(_0x1661('0x16'));return db[_0x1661('0x17')]['find']({'where':{'id':_0x3a2de4['params']['id']}})[_0x1661('0xb')](handleEntityNotFound(_0x11843d,null))[_0x1661('0xb')](saveUpdates(_0x3a2de4['body'],null))[_0x1661('0xb')](respondWithResult(_0x11843d,null))[_0x1661('0x18')](handleError(_0x11843d,null));}; \ No newline at end of file +var _0x385b=['../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','then','sendStatus','error','name','send','user','admin','Unauthorized','params','UserSetting','find','body','catch','ioredis','api'];(function(_0x7577b9,_0x4fe21c){var _0x2660c8=function(_0x3f94ae){while(--_0x3f94ae){_0x7577b9['push'](_0x7577b9['shift']());}};_0x2660c8(++_0x4fe21c);}(_0x385b,0x1a7));var _0xb385=function(_0x55a76a,_0x2d0203){_0x55a76a=_0x55a76a-0x0;var _0x45885a=_0x385b[_0x55a76a];return _0x45885a;};'use strict';var _=require('lodash');var Redis=require(_0xb385('0x0'));var logger=require('../../config/logger')(_0xb385('0x1'));var config=require(_0xb385('0x2'));var db=require(_0xb385('0x3'))['db'];var socket=require(_0xb385('0x4'))(new Redis(config['redis']));require(_0xb385('0x5'))[_0xb385('0x6')](socket);config[_0xb385('0x7')]=_[_0xb385('0x8')](config[_0xb385('0x7')],{'host':_0xb385('0x9'),'port':0x18eb});function respondWithResult(_0x411034,_0x367d50){_0x367d50=_0x367d50||0xc8;return function(_0x5b7929){if(_0x5b7929){return _0x411034[_0xb385('0xa')](_0x367d50)[_0xb385('0xb')](_0x5b7929);}};}function saveUpdates(_0x107223){return function(_0x14861d){if(_0x14861d){return _0x14861d['update'](_0x107223)[_0xb385('0xc')](function(_0x40f65e){return _0x40f65e;});}return null;};}function handleEntityNotFound(_0x524ed4){return function(_0x44b026){if(!_0x44b026){_0x524ed4[_0xb385('0xd')](0x194);}return _0x44b026;};}function handleError(_0x35a5c9,_0x371315){_0x371315=_0x371315||0x1f4;return function(_0x1b0471){logger[_0xb385('0xe')](_0x1b0471['stack']);if(_0x1b0471[_0xb385('0xf')]){delete _0x1b0471['name'];}_0x35a5c9['status'](_0x371315)[_0xb385('0x10')](_0x1b0471);};}exports['update']=function(_0x1421c7,_0x886ece){if(_0x1421c7[_0xb385('0x11')]['role']!==_0xb385('0x12'))throw new Error(_0xb385('0x13'));if(isNaN(Number(_0x1421c7[_0xb385('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xb385('0x15')][_0xb385('0x16')]({'where':{'id':_0x1421c7[_0xb385('0x14')]['id']}})['then'](handleEntityNotFound(_0x886ece,null))[_0xb385('0xc')](saveUpdates(_0x1421c7[_0xb385('0x17')],null))[_0xb385('0xc')](respondWithResult(_0x886ece,null))[_0xb385('0x18')](handleError(_0x886ece,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index f2e1caf..86c90fc 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7f6=['save','update','remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x7ce463,_0x44fe2a){var _0x338c9a=function(_0x20fcf6){while(--_0x20fcf6){_0x7ce463['push'](_0x7ce463['shift']());}};_0x338c9a(++_0x44fe2a);}(_0xd7f6,0x1a6));var _0x6d7f=function(_0x3ea9b7,_0x42d40d){_0x3ea9b7=_0x3ea9b7-0x0;var _0x58582a=_0xd7f6[_0x3ea9b7];return _0x58582a;};'use strict';var EventEmitter=require(_0x6d7f('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6d7f('0x1')](0x0);var events={'afterCreate':_0x6d7f('0x2'),'afterUpdate':_0x6d7f('0x3'),'afterDestroy':_0x6d7f('0x4')};function emitEvent(_0xad5f62){return function(_0x1da5cf,_0x5f4167,_0x21db0d){UserSettingEvents[_0x6d7f('0x5')](_0xad5f62+':'+_0x1da5cf['id'],_0x1da5cf);UserSettingEvents[_0x6d7f('0x5')](_0xad5f62,_0x1da5cf);_0x21db0d(null);};}for(var e in events){if(events[_0x6d7f('0x6')](e)){var event=events[e];UserSetting[_0x6d7f('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x3071=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x8bcb4a,_0x3ad476){var _0x22d7d1=function(_0x3bb2da){while(--_0x3bb2da){_0x8bcb4a['push'](_0x8bcb4a['shift']());}};_0x22d7d1(++_0x3ad476);}(_0x3071,0x160));var _0x1307=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0x3071[_0xd3e0b9];return _0x470133;};'use strict';var EventEmitter=require(_0x1307('0x0'));var UserSetting=require(_0x1307('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1307('0x2'),'afterUpdate':_0x1307('0x3'),'afterDestroy':_0x1307('0x4')};function emitEvent(_0x1dca18){return function(_0x59a48b,_0x4fb19a,_0x4de13c){UserSettingEvents[_0x1307('0x5')](_0x1dca18+':'+_0x59a48b['id'],_0x59a48b);UserSettingEvents['emit'](_0x1dca18,_0x59a48b);_0x4de13c(null);};}for(var e in events){if(events[_0x1307('0x6')](e)){var event=events[e];UserSetting[_0x1307('0x7')](e,emitEvent(event));}}module[_0x1307('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 24a7331..cdf7a47 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc584=['exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x11200e,_0x51edd7){var _0x5445d1=function(_0x995a8c){while(--_0x995a8c){_0x11200e['push'](_0x11200e['shift']());}};_0x5445d1(++_0x51edd7);}(_0xc584,0xa8));var _0x4c58=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xc584[_0x406115];return _0xbbabdb;};'use strict';var attributes=require('./user-setting.attributes');module[_0x4c58('0x0')]=function(_0x1d0f9e){return _0x1d0f9e['define']('UserSetting',attributes,{'tableName':_0x4c58('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5502e6){if(!_0x5502e6[_0x4c58('0x2')])_0x5502e6[_0x4c58('0x3')]=null;else if(_0x5502e6[_0x4c58('0x3')]===null)_0x5502e6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x0833=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabledSince'];(function(_0x1c4b8d,_0x146a41){var _0x203346=function(_0x541d4d){while(--_0x541d4d){_0x1c4b8d['push'](_0x1c4b8d['shift']());}};_0x203346(++_0x146a41);}(_0x0833,0x1bd));var _0x3083=function(_0x17070a,_0x50d2fb){_0x17070a=_0x17070a-0x0;var _0x246a40=_0x0833[_0x17070a];return _0x246a40;};'use strict';var attributes=require(_0x3083('0x0'));module[_0x3083('0x1')]=function(_0x33f231){return _0x33f231[_0x3083('0x2')](_0x3083('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52255d){if(!_0x52255d['clientSideLoggingEnabled'])_0x52255d[_0x3083('0x4')]=null;else if(_0x52255d['clientSideLoggingEnabledSince']===null)_0x52255d[_0x3083('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index c1bc801..371935f 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51ca=['./user-setting.events','save','remove','emit','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x433947,_0x12d5a5){var _0x3e0841=function(_0x58fa43){while(--_0x58fa43){_0x433947['push'](_0x433947['shift']());}};_0x3e0841(++_0x12d5a5);}(_0x51ca,0xd0));var _0xa51c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x51ca[_0x51c819];return _0x15c5d2;};'use strict';var UserSettingEvents=require(_0xa51c('0x0'));var events=[_0xa51c('0x1'),_0xa51c('0x2'),'update'];function createListener(_0x113ef7,_0x481f3c){return function(_0x1dae00){_0x481f3c['emit'](_0x113ef7,_0x1dae00);if(_0x113ef7==='user-setting:update'){_0x481f3c[_0xa51c('0x3')](_0xa51c('0x4')+_0x1dae00[_0xa51c('0x5')],_0x1dae00);}};}exports[_0xa51c('0x6')]=function(_0x354be1){for(var _0x39c3c9=0x0,_0x553309=events['length'];_0x39c3c9<_0x553309;_0x39c3c9++){var _0x12ccb9=events[_0x39c3c9];var _0x17bae8=createListener(_0xa51c('0x7')+_0x12ccb9,_0x354be1);UserSettingEvents['on'](_0x12ccb9,_0x17bae8);}}; \ No newline at end of file +var _0x9bde=['user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','remove','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9bde,0xf8));var _0xe9bd=function(_0x36cfc4,_0x147c92){_0x36cfc4=_0x36cfc4-0x0;var _0x15f180=_0x9bde[_0x36cfc4];return _0x15f180;};'use strict';var UserSettingEvents=require(_0xe9bd('0x0'));var events=['save',_0xe9bd('0x1'),_0xe9bd('0x2')];function createListener(_0x4c0041,_0x3e1a02){return function(_0x354a62){_0x3e1a02[_0xe9bd('0x3')](_0x4c0041,_0x354a62);if(_0x4c0041===_0xe9bd('0x4')){_0x3e1a02[_0xe9bd('0x3')](_0xe9bd('0x5')+_0x354a62[_0xe9bd('0x6')],_0x354a62);}};}exports[_0xe9bd('0x7')]=function(_0x160b2b){for(var _0xb4496c=0x0,_0x29e31d=events['length'];_0xb4496c<_0x29e31d;_0xb4496c++){var _0x4defc5=events[_0xb4496c];var _0x5867bc=createListener(_0xe9bd('0x8')+_0x4defc5,_0x160b2b);UserSettingEvents['on'](_0x4defc5,_0x5867bc);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 131db47..3513305 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 _0xe0c1=['/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','addContacts','/create_many','bulkCreate','join','server/files/images/','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','unpause','addTeams','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe0c1,0x13e));var _0x1e0c=function(_0x25e534,_0x3d82ea){_0x25e534=_0x25e534-0x0;var _0x563cda=_0xe0c1[_0x25e534];return _0x563cda;};'use strict';var multer=require('multer');var util=require(_0x1e0c('0x0'));var path=require(_0x1e0c('0x1'));var timeout=require(_0x1e0c('0x2'));var express=require('express');var router=express[_0x1e0c('0x3')]();var fs_extra=require(_0x1e0c('0x4'));var auth=require(_0x1e0c('0x5'));var interaction=require(_0x1e0c('0x6'));var config=require('../../config/environment');var controller=require(_0x1e0c('0x7'));router['get']('/',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x9')]);router[_0x1e0c('0xa')](_0x1e0c('0xb'),auth[_0x1e0c('0x8')](),controller['describe']);router[_0x1e0c('0xa')](_0x1e0c('0xc'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0xd')]);router[_0x1e0c('0xa')](_0x1e0c('0xe'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0xf')]);router[_0x1e0c('0xa')]('/:id',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x10')]);router[_0x1e0c('0xa')](_0x1e0c('0x11'),controller[_0x1e0c('0x12')]);router[_0x1e0c('0xa')]('/:id/open_tabs',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x13')]);router['get'](_0x1e0c('0x14'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x15')]);router[_0x1e0c('0xa')](_0x1e0c('0x16'),auth['isAuthenticated'](),controller['getQueues']);router['get'](_0x1e0c('0x17'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x18')]);router[_0x1e0c('0xa')]('/:id/groups',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x19')]);router[_0x1e0c('0xa')](_0x1e0c('0x1a'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x1b')]);router[_0x1e0c('0xa')](_0x1e0c('0x1c'),auth[_0x1e0c('0x8')](),controller['getScreenRecordings']);router[_0x1e0c('0xa')](_0x1e0c('0x1d'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x1e')]);router[_0x1e0c('0xa')](_0x1e0c('0x1f'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x20')]);router[_0x1e0c('0xa')](_0x1e0c('0x21'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x22')]);router[_0x1e0c('0xa')](_0x1e0c('0x23'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x24')]);router[_0x1e0c('0xa')](_0x1e0c('0x25'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x26')]);router[_0x1e0c('0xa')](_0x1e0c('0x27'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x28')]);router[_0x1e0c('0xa')](_0x1e0c('0x29'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x2a')]);router['get'](_0x1e0c('0x2b'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x2c')]);router[_0x1e0c('0xa')]('/:id/agents',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x2d')]);router[_0x1e0c('0xa')]('/:id/prefixes',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x2e')]);router[_0x1e0c('0xa')](_0x1e0c('0x2f'),auth[_0x1e0c('0x8')](),controller['getFaxAccounts']);router[_0x1e0c('0xa')](_0x1e0c('0x30'),auth['isAuthenticated'](),controller[_0x1e0c('0x31')]);router['get'](_0x1e0c('0x32'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x33')]);router[_0x1e0c('0xa')](_0x1e0c('0x34'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x35')]);router[_0x1e0c('0xa')](_0x1e0c('0x36'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x37')]);router[_0x1e0c('0xa')](_0x1e0c('0x38'),auth[_0x1e0c('0x8')](),controller['getWhatsappAccounts']);router[_0x1e0c('0xa')](_0x1e0c('0x39'),auth['isAuthenticated'](),controller[_0x1e0c('0x3a')]);router['get'](_0x1e0c('0x3b'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x3c')]);router['get']('/:id/api_key',auth[_0x1e0c('0x8')](),controller['getApiKey']);router[_0x1e0c('0x3d')]('/:id/contacts',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x3e')]);router[_0x1e0c('0x3d')]('/',auth[_0x1e0c('0x8')](),controller['create']);router[_0x1e0c('0x3d')](_0x1e0c('0x3f'),auth['isAuthenticated'](),controller[_0x1e0c('0x40')]);router[_0x1e0c('0x3d')](_0x1e0c('0x16'),auth[_0x1e0c('0x8')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaef20f,_0x143d3f,_0x3f561c){_0x3f561c(null,path[_0x1e0c('0x41')](config['root'],_0x1e0c('0x42')));},'filename':function(_0x16f12f,_0x52e49e,_0x13f598){_0x13f598(null,util['format']('%s-%s',Date[_0x1e0c('0x43')](),_0x52e49e['originalname']));}})});router[_0x1e0c('0x3d')](_0x1e0c('0x11'),upload[_0x1e0c('0x44')](_0x1e0c('0x45')),controller[_0x1e0c('0x46')]);router[_0x1e0c('0x3d')](_0x1e0c('0x47'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x48')]);router[_0x1e0c('0x3d')](_0x1e0c('0x49'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x4a')]);router[_0x1e0c('0x3d')]('/:id/pause',auth[_0x1e0c('0x8')](),controller['pause']);router[_0x1e0c('0x3d')]('/:id/unpause',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x4b')]);router['post']('/:id/teams',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x4c')]);router['post']('/:id/chat_interactions',auth[_0x1e0c('0x8')](),controller['addChatInteractions']);router[_0x1e0c('0x3d')]('/:id/mail_interactions',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x4d')]);router['post'](_0x1e0c('0x4e'),auth[_0x1e0c('0x8')](),controller['addFaxInteractions']);router['post'](_0x1e0c('0x4f'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x50')]);router[_0x1e0c('0x3d')](_0x1e0c('0x51'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x52')]);router[_0x1e0c('0x3d')](_0x1e0c('0x53'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x1e0c('0x3d')](_0x1e0c('0x2f'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x1e0c('0x3d')](_0x1e0c('0x30'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x54')]);router[_0x1e0c('0x3d')](_0x1e0c('0x32'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x55')]);router[_0x1e0c('0x3d')](_0x1e0c('0x34'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x56')]);router[_0x1e0c('0x3d')](_0x1e0c('0x36'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x57')]);router[_0x1e0c('0x3d')](_0x1e0c('0x38'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x58')]);router[_0x1e0c('0x3d')](_0x1e0c('0x39'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x59')]);router[_0x1e0c('0x3d')](_0x1e0c('0x5a'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x5b')]);router[_0x1e0c('0x5c')](_0x1e0c('0x5d'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x5e')]);router['put'](_0x1e0c('0x5f'),auth['isAuthenticated'](),controller[_0x1e0c('0x60')]);router[_0x1e0c('0x61')](_0x1e0c('0x16'),auth[_0x1e0c('0x8')](),controller['removeQueues']);router[_0x1e0c('0x61')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1e0c('0x62')]);router['delete'](_0x1e0c('0x5d'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x63')]);router[_0x1e0c('0x61')](_0x1e0c('0x64'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x65')]);router['delete'](_0x1e0c('0x66'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x67')]);router[_0x1e0c('0x61')](_0x1e0c('0x4e'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x1e0c('0x61')](_0x1e0c('0x4f'),auth[_0x1e0c('0x8')](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0x1e0c('0x8')](),controller['removeOpenchannelInteractions']);router[_0x1e0c('0x61')]('/:id/whatsapp_interactions',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x68')]);router[_0x1e0c('0x61')]('/:id/fax_accounts',auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x69')]);router[_0x1e0c('0x61')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x1e0c('0x8')](),controller['removeOpenchannelAccounts']);router[_0x1e0c('0x61')](_0x1e0c('0x34'),auth[_0x1e0c('0x8')](),controller[_0x1e0c('0x6a')]);router[_0x1e0c('0x61')](_0x1e0c('0x36'),auth['isAuthenticated'](),controller[_0x1e0c('0x6b')]);router['delete'](_0x1e0c('0x38'),auth[_0x1e0c('0x8')](),controller['removeWhatsappAccounts']);router[_0x1e0c('0x61')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x1e0c('0x6c')]);router[_0x1e0c('0x61')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module[_0x1e0c('0x6d')]=router; \ No newline at end of file +var _0x4949=['/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','removeQueues','delete','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','whoami'];(function(_0x2de699,_0x29ccd8){var _0x1754b7=function(_0x4f70ee){while(--_0x4f70ee){_0x2de699['push'](_0x2de699['shift']());}};_0x1754b7(++_0x29ccd8);}(_0x4949,0x68));var _0x9494=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4949[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9494('0x0'));var util=require(_0x9494('0x1'));var path=require('path');var timeout=require(_0x9494('0x2'));var express=require(_0x9494('0x3'));var router=express[_0x9494('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9494('0x5'));var interaction=require(_0x9494('0x6'));var config=require(_0x9494('0x7'));var controller=require(_0x9494('0x8'));router[_0x9494('0x9')]('/',auth['isAuthenticated'](),controller[_0x9494('0xa')]);router[_0x9494('0x9')](_0x9494('0xb'),auth[_0x9494('0xc')](),controller[_0x9494('0xd')]);router[_0x9494('0x9')]('/whoami',auth[_0x9494('0xc')](),controller[_0x9494('0xe')]);router[_0x9494('0x9')](_0x9494('0xf'),auth['isAuthenticated'](),controller[_0x9494('0x10')]);router[_0x9494('0x9')](_0x9494('0x11'),auth[_0x9494('0xc')](),controller['show']);router['get'](_0x9494('0x12'),controller[_0x9494('0x13')]);router[_0x9494('0x9')](_0x9494('0x14'),auth[_0x9494('0xc')](),controller[_0x9494('0x15')]);router['get'](_0x9494('0x16'),auth[_0x9494('0xc')](),controller[_0x9494('0x17')]);router[_0x9494('0x9')]('/:id/queues',auth[_0x9494('0xc')](),controller[_0x9494('0x18')]);router['get'](_0x9494('0x19'),auth[_0x9494('0xc')](),controller['getVoiceQueuesRt']);router[_0x9494('0x9')](_0x9494('0x1a'),auth[_0x9494('0xc')](),controller[_0x9494('0x1b')]);router['get'](_0x9494('0x1c'),auth[_0x9494('0xc')](),controller[_0x9494('0x1d')]);router[_0x9494('0x9')](_0x9494('0x1e'),auth[_0x9494('0xc')](),controller['getScreenRecordings']);router['get'](_0x9494('0x1f'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x9494('0x9')](_0x9494('0x20'),auth[_0x9494('0xc')](),controller[_0x9494('0x21')]);router[_0x9494('0x9')](_0x9494('0x22'),auth[_0x9494('0xc')](),controller['getMailInteractions']);router[_0x9494('0x9')](_0x9494('0x23'),auth['isAuthenticated'](),controller[_0x9494('0x24')]);router[_0x9494('0x9')](_0x9494('0x25'),auth[_0x9494('0xc')](),controller[_0x9494('0x26')]);router['get']('/:id/whatsapp/interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x27')]);router['get'](_0x9494('0x28'),auth[_0x9494('0xc')](),controller[_0x9494('0x29')]);router[_0x9494('0x9')](_0x9494('0x2a'),auth[_0x9494('0xc')](),controller[_0x9494('0x2b')]);router[_0x9494('0x9')](_0x9494('0x2c'),auth[_0x9494('0xc')](),controller[_0x9494('0x2d')]);router[_0x9494('0x9')](_0x9494('0x2e'),auth[_0x9494('0xc')](),controller['getVoicePrefixes']);router[_0x9494('0x9')](_0x9494('0x2f'),auth[_0x9494('0xc')](),controller[_0x9494('0x30')]);router[_0x9494('0x9')](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x32')]);router['get'](_0x9494('0x33'),auth[_0x9494('0xc')](),controller['getOpenchannelAccounts']);router[_0x9494('0x9')]('/:id/sms_accounts',auth[_0x9494('0xc')](),controller[_0x9494('0x34')]);router[_0x9494('0x9')](_0x9494('0x35'),auth[_0x9494('0xc')](),controller[_0x9494('0x36')]);router[_0x9494('0x9')](_0x9494('0x37'),auth[_0x9494('0xc')](),controller['getWhatsappAccounts']);router['get'](_0x9494('0x38'),auth[_0x9494('0xc')](),controller['getSquareProjects']);router['get'](_0x9494('0x39'),auth[_0x9494('0xc')](),controller[_0x9494('0x3a')]);router[_0x9494('0x9')](_0x9494('0x3b'),auth[_0x9494('0xc')](),controller[_0x9494('0x3c')]);router[_0x9494('0x3d')](_0x9494('0x16'),auth['isAuthenticated'](),controller[_0x9494('0x3e')]);router[_0x9494('0x3d')]('/',auth[_0x9494('0xc')](),controller[_0x9494('0x3f')]);router[_0x9494('0x3d')]('/create_many',auth[_0x9494('0xc')](),controller[_0x9494('0x40')]);router[_0x9494('0x3d')](_0x9494('0x41'),auth[_0x9494('0xc')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9494('0x42')]({'destination':function(_0x28b19a,_0x2c4d90,_0x45828c){_0x45828c(null,path[_0x9494('0x43')](config[_0x9494('0x44')],_0x9494('0x45')));},'filename':function(_0x24ad7d,_0x1be2d7,_0x425370){_0x425370(null,util[_0x9494('0x46')](_0x9494('0x47'),Date[_0x9494('0x48')](),_0x1be2d7['originalname']));}})});router[_0x9494('0x3d')]('/:id/avatar',upload[_0x9494('0x49')](_0x9494('0x4a')),controller[_0x9494('0x4b')]);router[_0x9494('0x3d')](_0x9494('0x4c'),auth['isAuthenticated'](),controller[_0x9494('0x4d')]);router[_0x9494('0x3d')]('/:id/logout',auth[_0x9494('0xc')](),controller[_0x9494('0x4e')]);router[_0x9494('0x3d')]('/:id/pause',auth[_0x9494('0xc')](),controller[_0x9494('0x4f')]);router[_0x9494('0x3d')](_0x9494('0x50'),auth[_0x9494('0xc')](),controller['unpause']);router['post']('/:id/teams',auth[_0x9494('0xc')](),controller[_0x9494('0x51')]);router['post']('/:id/chat_interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x52')]);router[_0x9494('0x3d')](_0x9494('0x53'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x9494('0x3d')](_0x9494('0x54'),auth[_0x9494('0xc')](),controller[_0x9494('0x55')]);router['post'](_0x9494('0x56'),auth[_0x9494('0xc')](),controller[_0x9494('0x57')]);router[_0x9494('0x3d')](_0x9494('0x58'),auth[_0x9494('0xc')](),controller[_0x9494('0x59')]);router[_0x9494('0x3d')](_0x9494('0x5a'),auth[_0x9494('0xc')](),controller[_0x9494('0x5b')]);router[_0x9494('0x3d')]('/:id/fax_accounts',auth[_0x9494('0xc')](),controller['addFaxAccounts']);router['post'](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x5c')]);router['post'](_0x9494('0x33'),auth[_0x9494('0xc')](),controller['addOpenchannelAccounts']);router[_0x9494('0x3d')](_0x9494('0x5d'),auth['isAuthenticated'](),controller[_0x9494('0x5e')]);router[_0x9494('0x3d')](_0x9494('0x35'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x9494('0x37'),auth[_0x9494('0xc')](),controller[_0x9494('0x5f')]);router[_0x9494('0x3d')]('/:id/square_projects',auth[_0x9494('0xc')](),controller[_0x9494('0x60')]);router[_0x9494('0x3d')]('/:id/api_key',auth[_0x9494('0xc')](),controller['createApiKey']);router[_0x9494('0x61')](_0x9494('0x11'),auth['isAuthenticated'](),controller[_0x9494('0x62')]);router[_0x9494('0x61')](_0x9494('0x63'),auth[_0x9494('0xc')](),controller[_0x9494('0x64')]);router['delete'](_0x9494('0x41'),auth[_0x9494('0xc')](),controller[_0x9494('0x65')]);router[_0x9494('0x66')](_0x9494('0x28'),auth[_0x9494('0xc')](),controller['removeTeams']);router[_0x9494('0x66')](_0x9494('0x11'),auth[_0x9494('0xc')](),controller[_0x9494('0x67')]);router['delete'](_0x9494('0x68'),auth[_0x9494('0xc')](),controller[_0x9494('0x69')]);router['delete']('/:id/mail_interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x6a')]);router[_0x9494('0x66')](_0x9494('0x54'),auth[_0x9494('0xc')](),controller[_0x9494('0x6b')]);router[_0x9494('0x66')](_0x9494('0x56'),auth[_0x9494('0xc')](),controller[_0x9494('0x6c')]);router[_0x9494('0x66')](_0x9494('0x58'),auth['isAuthenticated'](),controller[_0x9494('0x6d')]);router['delete'](_0x9494('0x5a'),auth[_0x9494('0xc')](),controller[_0x9494('0x6e')]);router[_0x9494('0x66')](_0x9494('0x2f'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x9494('0x66')](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x6f')]);router[_0x9494('0x66')](_0x9494('0x33'),auth['isAuthenticated'](),controller[_0x9494('0x70')]);router[_0x9494('0x66')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x9494('0x71')]);router[_0x9494('0x66')](_0x9494('0x35'),auth[_0x9494('0xc')](),controller[_0x9494('0x72')]);router[_0x9494('0x66')](_0x9494('0x37'),auth[_0x9494('0xc')](),controller[_0x9494('0x73')]);router[_0x9494('0x66')](_0x9494('0x38'),auth[_0x9494('0xc')](),controller[_0x9494('0x74')]);router[_0x9494('0x66')](_0x9494('0x3b'),auth['isAuthenticated'](),controller[_0x9494('0x75')]);module[_0x9494('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8fc4df3..bb5b756 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 _0x008c=['all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','wss','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x3828a8,_0x4cd42f){var _0x49f59f=function(_0x512e2c){while(--_0x512e2c){_0x3828a8['push'](_0x3828a8['shift']());}};_0x49f59f(++_0x4cd42f);}(_0x008c,0x188));var _0xc008=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x008c[_0x50d5ae];return _0x1e8d74;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));module[_0xc008('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc008('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47063f){this[_0xc008('0x6')](_0xc008('0x5'),_0x47063f);this[_0xc008('0x6')](_0xc008('0x7'),_0x47063f);},'comment':_0xc008('0x8')},'fullname':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'set':function(_0x9c8cb2){this['setDataValue'](_0xc008('0xa'),_0x9c8cb2);this['setDataValue'](_0xc008('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x9c8cb2,this[_0xc008('0xc')](_0xc008('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1eacfa){if(_0x1eacfa){this[_0xc008('0x6')]('email',_0x1eacfa[_0xc008('0xe')]());}}},'role':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x10'),_0xc008('0x11'),_0xc008('0x12'),_0xc008('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25e13f){this[_0xc008('0x6')](_0xc008('0xd'),_0x25e13f);this[_0xc008('0x6')](_0xc008('0x15'),_0x25e13f);this['setDataValue']('callerid',util['format'](_0xc008('0x16'),this[_0xc008('0xc')](_0xc008('0xa')),_0x25e13f));}},'salt':{'type':Sequelize[_0xc008('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc008('0x9')]},'city':{'type':Sequelize[_0xc008('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc008('0x18')]},'chatCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc008('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x19')},'ipaddr':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xc008('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x1a'),_0xc008('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xc008('0x1a')},'context':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x1b')},'callingpres':{'type':Sequelize[_0xc008('0xf')]('ALLOWED_NOT_SCREENED',_0xc008('0x1c'),_0xc008('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc008('0x1e'),_0xc008('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x20'),'set':function(_0x2b862d){this[_0xc008('0x6')](_0xc008('0x21'),_0x2b862d?_0x2b862d['join'](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x21'))?this['getDataValue'](_0xc008('0x21'))[_0xc008('0x22')](','):null;},'comment':_0xc008('0x23')},'dtmfmode':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x24'),_0xc008('0x25'),_0xc008('0x26'),_0xc008('0x27'),_0xc008('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x2a'),_0xc008('0x2b'),_0xc008('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x399b64){this[_0xc008('0x6')]('nat',_0x399b64?_0x399b64[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x2e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xc008('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc008('0x9')]},'pickupgroup':{'type':Sequelize[_0xc008('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xc008('0x9')]},'language':{'type':Sequelize[_0xc008('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc008('0x9')]},'disallow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x30')},'allow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x31'),'set':function(_0x387dfd){this[_0xc008('0x6')](_0xc008('0x32'),_0x387dfd?_0x387dfd[_0xc008('0x2d')](';'):_0xc008('0x31'));},'get':function(){return this['getDataValue'](_0xc008('0x32'))?this[_0xc008('0xc')](_0xc008('0x32'))[_0xc008('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'set':function(_0x36e7ae){this[_0xc008('0x6')]('insecure',_0x36e7ae?_0x36e7ae[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x33'))?this[_0xc008('0xc')](_0xc008('0x33'))['split'](','):null;},'comment':_0xc008('0x34')},'trustrpid':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xc008('0x37'),_0xc008('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x39'),_0xc008('0x3a')),'allowNull':!![],'defaultValue':_0xc008('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x3b'),_0xc008('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x3d'),'passive',_0xc008('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc008('0xf')]('yes','no',_0xc008('0x2a'),'update',_0xc008('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc008('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xc008('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc008('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x375e71){this['setDataValue']('showWebBar',_0x375e71);var _0x37ce5e=this[_0xc008('0x41')]({'plain':!![]});switch(_0x375e71){case 0x0:case 0x1:var _0x56e755=_0x37ce5e[_0xc008('0x21')]?_[_0xc008('0x42')](_0x37ce5e[_0xc008('0x21')])?_0x37ce5e[_0xc008('0x21')][_0xc008('0x2d')]():_0x37ce5e[_0xc008('0x21')]:_0xc008('0x20');if(_0x56e755==='wss'){_0x56e755=_0xc008('0x20');}this[_0xc008('0x6')](_0xc008('0x21'),_0x56e755);this[_0xc008('0x6')](_0xc008('0x43'),'no');this[_0xc008('0x6')](_0xc008('0x44'),null);this[_0xc008('0x6')](_0xc008('0x45'),null);this[_0xc008('0x6')](_0xc008('0x46'),null);this[_0xc008('0x6')](_0xc008('0x47'),null);this[_0xc008('0x6')]('dtlsverify',null);this[_0xc008('0x6')](_0xc008('0x48'),null);this[_0xc008('0x6')]('dtlscertfile',null);this[_0xc008('0x6')](_0xc008('0x49'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc008('0x6')](_0xc008('0x21'),_0xc008('0x4a'));this[_0xc008('0x6')](_0xc008('0x43'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x44'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x45'),'yes');this[_0xc008('0x6')](_0xc008('0x46'),_0xc008('0x29'));this[_0xc008('0x6')]('dtlsenable',_0xc008('0x29'));this['setDataValue'](_0xc008('0x4b'),'no');this[_0xc008('0x6')](_0xc008('0x48'),'actpass');this[_0xc008('0x6')](_0xc008('0x4c'),_0x37ce5e[_0xc008('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0xc008('0x6')]('dtlsprivatekey',_0x37ce5e[_0xc008('0x49')]||_0xc008('0x4d'));this[_0xc008('0x6')](_0xc008('0x4e'),_0xc008('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3c30db){this[_0xc008('0x6')]('permissions',_0x3c30db?_0x3c30db[_0xc008('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xc008('0x4f'))?_['map'](this[_0xc008('0xc')]('permissions')[_0xc008('0x22')](','),function(_0x103d75){return parseInt(_0x103d75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc008('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc008('0x50')],'get':function(){return this[_0xc008('0xc')](_0xc008('0x51'))?this[_0xc008('0xc')](_0xc008('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc008('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3b2669){if(typeof _0x3b2669===_0xc008('0x52')){var _0x2edb8e=_0x3b2669==='1'?!![]:_0x3b2669==='0'?![]:_0x3b2669===_0xc008('0x53')?!![]:_0x3b2669===_0xc008('0x54')?![]:![];this[_0xc008('0x6')](_0xc008('0x55'),_0x2edb8e);}else{this['setDataValue']('screenrecording',_0x3b2669);}}},'blocked':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3104cd){this[_0xc008('0x6')]('blocked',_0x3104cd);if(_0x3104cd===!![]){this[_0xc008('0x6')](_0xc008('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0xc008('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc008('0x14')](0x5)[_0xc008('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x1c50b7,_0x57209b){var _0x23e643=function(_0x498d02){while(--_0x498d02){_0x1c50b7['push'](_0x1c50b7['shift']());}};_0x23e643(++_0x57209b);}(_0x70e0,0x17b));var _0x070e=function(_0x2c1f55,_0x501fe3){_0x2c1f55=_0x2c1f55-0x0;var _0x23aa80=_0x70e0[_0x2c1f55];return _0x23aa80;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 79efece..74e2c22 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 _0x4953=['VoiceQueue','online','format','UserVoiceQueueRt','removeQueues','remove','Queues','isArray','QueueId','Queue:remove','addAvatar','userpic','file','filename','join','root','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','pick','hasOwnProperty','CmList','List','Tag','Tags','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','each','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGININPAUSE','concat','isMiddleware','resolve','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','unpause','%s%s','Pause','Team','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','addTeams','getAssociatedQueues','flattenDeep','getDataValue','upsert','UserVoicePrefix','VoicePrefixId','Queue:save','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeTeams','removeAgent','TeamVoicePrefix','getLists','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','inbound','getAgents','flatten','lower','col','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','InteractionId','field','_interactions','OpenTabs','moment','bluebird','util','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','handleError','../../mysqldb','socket.io-emitter','redis','register','localhost','client','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','emit','userNotification:recalc:','destroy','get','role','Users','user','Agents','agent','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','index','rawAttributes','fieldName','type','password','getOptions','where','User','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','length','chat','dataValues','sms','fax','mail','openchannel','all','catch','show','params','differenceBy','keys','salt','filters','intersection','model','fields','merge','options','openTabs','whatsapp','body','describe','omit','ids','Setting','findById','validatePasswordPattern','internal','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','108','109','100','111','115','create','Unauthorized','admin','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','isEmpty','compact','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','voice'];(function(_0x30acd8,_0x18fdfd){var _0x4b5c14=function(_0x3be2ce){while(--_0x3be2ce){_0x30acd8['push'](_0x30acd8['shift']());}};_0x4b5c14(++_0x18fdfd);}(_0x4953,0xe4));var _0x3495=function(_0x523eeb,_0x32e96a){_0x523eeb=_0x523eeb-0x0;var _0x39ab3c=_0x4953[_0x523eeb];return _0x39ab3c;};'use strict';var moment=require(_0x3495('0x0'));var BPromise=require(_0x3495('0x1'));var util=require(_0x3495('0x2'));var path=require(_0x3495('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3495('0x4'));var jayson=require(_0x3495('0x5'));var Redis=require(_0x3495('0x6'));var authService=require(_0x3495('0x7'));var qs=require(_0x3495('0x8'));var logger=require(_0x3495('0x9'))(_0x3495('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3495('0xb'));var APIBadRequestError=require(_0x3495('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x3495('0xc'))['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0x3495('0xd')];var db=require(_0x3495('0xe'))['db'];var socket=require(_0x3495('0xf'))(new Redis(config[_0x3495('0x10')]));require('./user.socket')[_0x3495('0x11')](socket);config['redis']=_['defaults'](config[_0x3495('0x10')],{'host':_0x3495('0x12'),'port':0x18eb});var client=jayson[_0x3495('0x13')][_0x3495('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x17c2d5,_0x4a6cf6,_0x4db6b5,_0x1b7daf){return new BPromise(function(_0x5b5636,_0x43d61f){var _0x11142f=_0x1b7daf||client;return _0x11142f[_0x3495('0x15')](_0x17c2d5,_0x4db6b5)[_0x3495('0x16')](function(_0x3e1346){logger['info'](_0x3495('0x17'),_0x4a6cf6,_0x3495('0x18'));logger[_0x3495('0x19')](_0x3495('0x1a'),_0x4a6cf6,_0x3495('0x18'),JSON[_0x3495('0x1b')](_0x3e1346));if(_0x3e1346[_0x3495('0x1c')]){if(_0x3e1346['error'][_0x3495('0x1d')]===0x1f4){logger[_0x3495('0x1c')](_0x3495('0x17'),_0x4a6cf6,_0x3e1346['error'][_0x3495('0x1e')]);return _0x43d61f(_0x3e1346[_0x3495('0x1c')][_0x3495('0x1e')]);}logger[_0x3495('0x1c')](_0x3495('0x17'),_0x4a6cf6,_0x3e1346[_0x3495('0x1c')][_0x3495('0x1e')]);return _0x5b5636(_0x3e1346[_0x3495('0x1c')][_0x3495('0x1e')]);}else{logger[_0x3495('0x1f')](_0x3495('0x17'),_0x4a6cf6,_0x3495('0x18'));_0x5b5636(_0x3e1346['result'][_0x3495('0x1e')]);}})['catch'](function(_0x1c768d){logger['error'](_0x3495('0x17'),_0x4a6cf6,_0x1c768d);_0x43d61f(_0x1c768d);});});}function respondWithStatusCode(_0x567315,_0x3e4678){_0x3e4678=_0x3e4678||0xcc;return function(_0x221061){if(_0x221061){return _0x567315[_0x3495('0x20')](_0x3e4678);}return _0x567315[_0x3495('0x21')](_0x3e4678)[_0x3495('0x22')]();};}function respondWithResult(_0x421bbd,_0x1523de){_0x1523de=_0x1523de||0xc8;return function(_0xa917fb){if(_0xa917fb){return _0x421bbd[_0x3495('0x21')](_0x1523de)[_0x3495('0x23')](_0xa917fb);}};}function respondWithFilteredResult(_0x39747a,_0x2c8e7e){return function(_0x398ff7){if(_0x398ff7){var _0x446271=typeof _0x2c8e7e[_0x3495('0x24')]===_0x3495('0x25')&&typeof _0x2c8e7e[_0x3495('0x26')]==='undefined';var _0x2b7466=_0x398ff7[_0x3495('0x27')];var _0x31572d=_0x446271?0x0:_0x2c8e7e[_0x3495('0x24')];var _0x4ad9a9=_0x446271?_0x398ff7[_0x3495('0x27')]:_0x2c8e7e[_0x3495('0x24')]+_0x2c8e7e[_0x3495('0x26')];var _0x51e172;if(_0x4ad9a9>=_0x2b7466){_0x4ad9a9=_0x2b7466;_0x51e172=0xc8;}else{_0x51e172=0xce;}_0x39747a['status'](_0x51e172);return _0x39747a[_0x3495('0x28')](_0x3495('0x29'),_0x31572d+'-'+_0x4ad9a9+'/'+_0x2b7466)[_0x3495('0x23')](_0x398ff7);}return null;};}function saveUpdates(_0x19ea1d){return function(_0x2b2e14){if(_0x2b2e14){return _0x2b2e14[_0x3495('0x2a')](_0x19ea1d)[_0x3495('0x16')](function(_0x219cfc){socket[_0x3495('0x2b')](_0x3495('0x2c')+_0x219cfc['id'],{});return _0x219cfc;});}return null;};}function removeEntity(_0x52d435){return function(_0xf442aa){if(_0xf442aa){return _0xf442aa[_0x3495('0x2d')]()['then'](function(){var _0x4575c2=_0xf442aa[_0x3495('0x2e')]({'plain':!![]});if(_0x4575c2[_0x3495('0x2f')]==='admin')return;var _0x1ca431=[{'name':_0x3495('0x30'),'value':_0x3495('0x31'),'ignore':!![]},{'name':_0x3495('0x32'),'value':_0x3495('0x33'),'ignore':![]},{'name':'Telephones','value':_0x3495('0x34'),'ignore':![]}];var _0x5c98ae=_(_0x1ca431)[_0x3495('0x35')](_0x3495('0x36'))[_0x3495('0x37')](_0x3495('0x38'))['value']();if(_[_0x3495('0x39')](_0x5c98ae,_0x4575c2[_0x3495('0x2f')])){return;}var _0x6c4722=_[_0x3495('0x3a')](_0x1ca431,['value',_0x4575c2[_0x3495('0x2f')]])[_0x3495('0x3b')];return db[_0x3495('0x3c')][_0x3495('0x2d')]({'where':{'type':_0x6c4722,'resourceId':_0x4575c2['id']}})['then'](function(){return _0xf442aa;});})['then'](function(){_0x52d435[_0x3495('0x21')](0xcc)[_0x3495('0x22')]();});}};}function handleEntityNotFound(_0x288b3f){return function(_0x250156){if(!_0x250156){_0x288b3f[_0x3495('0x20')](0x194);}return _0x250156;};}function handleError(_0x4ee37c,_0x5415a9){_0x5415a9=_0x5415a9||0x1f4;return function(_0x239a79){logger[_0x3495('0x1c')](_0x239a79['stack']);if(_0x239a79['name']){delete _0x239a79['name'];}_0x4ee37c[_0x3495('0x21')](_0x5415a9)['send'](_0x239a79);};}exports[_0x3495('0x3d')]=function(_0x12bd16,_0x25e2d4){var _0x1f3097={},_0x562805={'count':0x0,'rows':[]};var _0x4e4760=_(db['User'][_0x3495('0x3e')])[_0x3495('0x37')](function(_0x37ccbe){return{'name':_0x37ccbe[_0x3495('0x3f')],'type':_0x37ccbe[_0x3495('0x40')]['key']};})['filter'](function(_0xb1a283){return!_['includes']([_0x3495('0x41'),'salt'],_0xb1a283[_0x3495('0x3b')]);})[_0x3495('0x38')]();_0x1f3097=qs[_0x3495('0x42')](_0x4e4760,_0x12bd16);var _0x555258={'where':_0x1f3097[_0x3495('0x43')]};return db[_0x3495('0x44')][_0x3495('0x27')](_0x555258)[_0x3495('0x16')](function(_0x201079){_0x562805[_0x3495('0x27')]=_0x201079;if(_0x12bd16[_0x3495('0x45')][_0x3495('0x46')]){_0x1f3097[_0x3495('0x47')]=[{'all':!![]}];}if(_0x12bd16[_0x3495('0x45')][_0x3495('0x48')]===_0x3495('0x49')){_0x1f3097[_0x3495('0x47')]=[{'model':db[_0x3495('0x4a')],'as':'userSetting'}];}if(!_['includes'](_0x1f3097[_0x3495('0x4b')],'id')){_0x1f3097[_0x3495('0x4b')][_0x3495('0x4c')]('id');}return db['User'][_0x3495('0x4d')](_0x1f3097);})[_0x3495('0x16')](function(_0x5827b0){_0x562805[_0x3495('0x4e')]=_0x5827b0;if(_0x12bd16['query']['openTabs']===_0x3495('0x49')){var _0x4ebad2=[];for(var _0x367d49=0x0;_0x367d49<_0x562805['rows'][_0x3495('0x4f')];_0x367d49++){_0x4ebad2['push'](get_open_tabs(_0x3495('0x50'),_0x562805[_0x3495('0x4e')][_0x367d49][_0x3495('0x51')]));_0x4ebad2[_0x3495('0x4c')](get_open_tabs(_0x3495('0x52'),_0x562805['rows'][_0x367d49]['dataValues']));_0x4ebad2[_0x3495('0x4c')](get_open_tabs(_0x3495('0x53'),_0x562805[_0x3495('0x4e')][_0x367d49][_0x3495('0x51')]));_0x4ebad2[_0x3495('0x4c')](get_open_tabs(_0x3495('0x54'),_0x562805[_0x3495('0x4e')][_0x367d49][_0x3495('0x51')]));_0x4ebad2['push'](get_open_tabs(_0x3495('0x55'),_0x562805[_0x3495('0x4e')][_0x367d49][_0x3495('0x51')]));_0x4ebad2['push'](get_open_tabs('whatsapp',_0x562805[_0x3495('0x4e')][_0x367d49]['dataValues']));}return BPromise[_0x3495('0x56')](_0x4ebad2)[_0x3495('0x16')](function(){return _0x562805;});}else{return _0x562805;}})[_0x3495('0x16')](respondWithFilteredResult(_0x25e2d4,_0x1f3097))[_0x3495('0x57')](handleError(_0x25e2d4,null));};exports[_0x3495('0x58')]=function(_0x1627dc,_0x149624){var _0x59a71e={'raw':![],'where':{'id':_0x1627dc[_0x3495('0x59')]['id']}},_0x5a88c6={};_0x5a88c6['model']=_[_0x3495('0x5a')](_[_0x3495('0x5b')](db[_0x3495('0x44')]['rawAttributes']),[_0x3495('0x41'),_0x3495('0x5c')]);_0x5a88c6['query']=_[_0x3495('0x5b')](_0x1627dc[_0x3495('0x45')]);_0x5a88c6[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x5a88c6[_0x3495('0x5f')],_0x5a88c6['query']);_0x59a71e[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x5a88c6[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x1627dc[_0x3495('0x45')][_0x3495('0x60')]));_0x59a71e[_0x3495('0x4b')]=_0x59a71e[_0x3495('0x4b')][_0x3495('0x4f')]?_0x59a71e[_0x3495('0x4b')]:_0x5a88c6[_0x3495('0x5f')];if(_0x1627dc[_0x3495('0x45')][_0x3495('0x46')]){_0x59a71e[_0x3495('0x47')]=[{'all':!![]}];}if(_0x1627dc[_0x3495('0x45')][_0x3495('0x48')]===_0x3495('0x49')){_0x59a71e[_0x3495('0x47')]=[{'model':db[_0x3495('0x4a')],'as':_0x3495('0x48')}];}_0x59a71e=_[_0x3495('0x61')]({},_0x59a71e,_0x1627dc[_0x3495('0x62')]);if(!_[_0x3495('0x39')](_0x59a71e[_0x3495('0x4b')],'id')){_0x59a71e['attributes']['push']('id');}return db[_0x3495('0x44')][_0x3495('0x3a')](_0x59a71e)[_0x3495('0x16')](handleEntityNotFound(_0x149624,null))[_0x3495('0x16')](function(_0x5f2512){var _0x4a26b6=[];values=_0x5f2512;if(_0x1627dc[_0x3495('0x45')][_0x3495('0x63')]===_0x3495('0x49')){_0x4a26b6[_0x3495('0x4c')](get_open_tabs(_0x3495('0x50'),_0x5f2512[_0x3495('0x51')]));_0x4a26b6[_0x3495('0x4c')](get_open_tabs(_0x3495('0x52'),_0x5f2512['dataValues']));_0x4a26b6[_0x3495('0x4c')](get_open_tabs(_0x3495('0x55'),_0x5f2512[_0x3495('0x51')]));_0x4a26b6[_0x3495('0x4c')](get_open_tabs(_0x3495('0x64'),_0x5f2512[_0x3495('0x51')]));_0x4a26b6['push'](get_open_tabs('fax',_0x5f2512[_0x3495('0x51')]));_0x4a26b6[_0x3495('0x4c')](get_open_tabs(_0x3495('0x54'),_0x5f2512[_0x3495('0x51')]));return BPromise['all'](_0x4a26b6);}else{return values;}})['then'](function(){return values;})[_0x3495('0x16')](respondWithResult(_0x149624,null))['catch'](handleError(_0x149624,null));};exports[_0x3495('0x2a')]=function(_0x2c26ec,_0x2cf548){if(_0x2c26ec['body']['id']){delete _0x2c26ec['body']['id'];}delete _0x2c26ec[_0x3495('0x65')][_0x3495('0x2f')];return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x2c26ec[_0x3495('0x59')]['id']}})['then'](handleEntityNotFound(_0x2cf548,null))[_0x3495('0x16')](saveUpdates(_0x2c26ec[_0x3495('0x65')],null))[_0x3495('0x16')](respondWithResult(_0x2cf548,null))[_0x3495('0x57')](handleError(_0x2cf548,null));};exports[_0x3495('0x66')]=function(_0x1ee6e2,_0x265045){return db[_0x3495('0x44')][_0x3495('0x66')]()['then'](respondWithResult(_0x265045,null))[_0x3495('0x57')](handleError(_0x265045,null));};exports['addContacts']=function(_0x1ee06d,_0x30f6f0){return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x1ee06d[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x30f6f0,null))['then'](function(_0x2466ca){if(_0x2466ca){return _0x2466ca['addContacts'](_0x1ee06d['body']['ids'],_[_0x3495('0x67')](_0x1ee06d['body'],[_0x3495('0x68'),'id'])||{});}})[_0x3495('0x16')](respondWithResult(_0x30f6f0,null))[_0x3495('0x57')](handleError(_0x30f6f0,null));};function validateUser(_0x3c8f77){return new BPromise(function(_0x4f1fae,_0x4dc23b){if(_0x3c8f77['internal'])return _0x4f1fae(_0x3c8f77);return db[_0x3495('0x69')][_0x3495('0x6a')](0x1)[_0x3495('0x16')](function(_0x3998ad){if(_0x3998ad['securePassword'])authService[_0x3495('0x6b')](_0x3c8f77['password']);db[_0x3495('0x44')]['max'](_0x3495('0x6c'))[_0x3495('0x16')](function(_0x364aea){if(_['isNil'](_0x364aea)){_0x3c8f77['internal']=_0x3998ad[_0x3495('0x6d')]||0x1;return;}if(_[_0x3495('0x6e')](_0x3998ad[_0x3495('0x6d')])||_0x3998ad['min_internal']===_0x364aea){_0x3c8f77[_0x3495('0x6c')]=_0x364aea+0x1;return;}if(_0x3998ad[_0x3495('0x6d')]>_0x364aea){_0x3c8f77[_0x3495('0x6c')]=_0x3998ad[_0x3495('0x6d')];return;}return db[_0x3495('0x6f')][_0x3495('0x45')](_0x3495('0x70'),{'type':db[_0x3495('0x6f')][_0x3495('0x71')][_0x3495('0x72')]})[_0x3495('0x16')](function(_0x3a2d89){if(_0x3a2d89&&_0x3a2d89[_0x3495('0x4f')]){for(var _0x2841d1=0x0,_0x530ff7=_0x3a2d89[_0x3495('0x4f')];_0x2841d1<_0x530ff7&&_['isNil'](_0x3c8f77[_0x3495('0x6c')]);_0x2841d1++){if(_0x3998ad['min_internal']<=_0x3a2d89[_0x2841d1][_0x3495('0x73')]){_0x3c8f77[_0x3495('0x6c')]=_0x3a2d89[_0x2841d1][_0x3495('0x73')];}else if(_0x3998ad[_0x3495('0x6d')]>_0x3a2d89[_0x2841d1][_0x3495('0x73')]&&_0x3998ad[_0x3495('0x6d')]<=_0x3a2d89[_0x2841d1]['to']){_0x3c8f77[_0x3495('0x6c')]=_0x3998ad[_0x3495('0x6d')];}}}if(_['isNil'](_0x3c8f77['internal'])){_0x3c8f77['internal']=_0x364aea+0x1;}return _0x4f1fae(_0x3c8f77);});});})['catch'](function(_0x53d942){_0x4dc23b(_0x53d942);});});}function updateUser(_0x44a039){return new BPromise(function(_0x28383e,_0x2557a9){try{if(_0x44a039[_0x3495('0x74')]){_0x44a039[_0x3495('0x75')]=_0x44a039[_0x3495('0x6c')];_0x44a039[_0x3495('0x76')]={'mailbox':_0x44a039[_0x3495('0x6c')],'password':_0x44a039[_0x3495('0x41')],'fullname':_0x44a039[_0x3495('0x77')],'email':_0x44a039[_0x3495('0x78')]};}if(_0x44a039[_0x3495('0x2f')]===_0x3495('0x33')){if(!_0x44a039[_0x3495('0x79')])_0x44a039[_0x3495('0x79')]=['101',_0x3495('0x7a'),_0x3495('0x7b'),_0x3495('0x7c'),_0x3495('0x7d'),_0x3495('0x7e'),_0x3495('0x7f'),_0x3495('0x80'),_0x3495('0x81'),_0x3495('0x82'),_0x3495('0x83'),_0x3495('0x84'),_0x3495('0x85'),'114',_0x3495('0x86')];}_0x28383e(_0x44a039);}catch(_0x4ded72){_0x2557a9(_0x4ded72);}});}exports[_0x3495('0x87')]=function(_0x49cfb1,_0x21f6de){if(_0x49cfb1[_0x3495('0x31')]['role']==='agent')throw new Error(_0x3495('0x88'));if(_0x49cfb1['body'][_0x3495('0x2f')]===_0x3495('0x31')&&_0x49cfb1[_0x3495('0x31')][_0x3495('0x2f')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x49cfb1[_0x3495('0x65')][_0x3495('0x2f')]===_0x3495('0x89')&&_0x49cfb1['user']['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3495('0x8a')]([_0x49cfb1[_0x3495('0x65')]])['then'](function(){return validateUser(_0x49cfb1[_0x3495('0x65')]);})[_0x3495('0x16')](function(_0x522b55){return updateUser(_0x522b55)[_0x3495('0x16')](function(_0x1fe8ca){if(_0x1fe8ca['role']===_0x3495('0x89')){_0x1fe8ca[_0x3495('0x8b')]=_0x49cfb1[_0x3495('0x31')]['settingsEnabled'];delete _0x1fe8ca[_0x3495('0x8c')];}return _0x1fe8ca;});})[_0x3495('0x16')](function(_0x2f8b3a){return db[_0x3495('0x44')][_0x3495('0x87')](_0x2f8b3a,{'include':[{'model':db[_0x3495('0x76')],'as':'VoiceMail'}]});})[_0x3495('0x16')](function(_0x76daaf){if(_0x49cfb1[_0x3495('0x65')][_0x3495('0x2f')]===_0x3495('0x31'))return _0x76daaf;if(_0x49cfb1[_0x3495('0x31')][_0x3495('0x2f')]!==_0x3495('0x31'))return _0x76daaf;return db[_0x3495('0x8d')][_0x3495('0x3a')]({'where':{'name':_0x76daaf[_0x3495('0x2f')]===_0x3495('0x33')?'Agents':_0x3495('0x8e'),'userProfileId':_0x49cfb1[_0x3495('0x31')][_0x3495('0x8c')]},'raw':!![]})['then'](function(_0x275570){if(!_0x275570||_0x275570[_0x3495('0x8f')]!=0x0)return _0x76daaf;return db[_0x3495('0x3c')][_0x3495('0x87')]({'name':_0x76daaf[_0x3495('0x3b')],'resourceId':_0x76daaf['id'],'type':_0x275570[_0x3495('0x3b')],'sectionId':_0x275570['id']},{})['then'](function(){return _0x76daaf;});})[_0x3495('0x57')](function(_0x5efd05){logger[_0x3495('0x1c')](_0x3495('0x90'),_0x5efd05);throw _0x5efd05;});})[_0x3495('0x16')](respondWithResult(_0x21f6de,0xc9))[_0x3495('0x57')](handleError(_0x21f6de,null));};exports[_0x3495('0x91')]=function(_0x4d6a0b,_0x584dc9){var _0x4c8652=_0x4d6a0b[_0x3495('0x65')];var _0x143af5=[];if(_0x4d6a0b[_0x3495('0x31')][_0x3495('0x2f')]===_0x3495('0x33'))throw new Error(_0x3495('0x88'));if(_[_0x3495('0x92')](_0x4c8652,['role','user'])&&_0x4d6a0b[_0x3495('0x31')][_0x3495('0x2f')]!==_0x3495('0x89')){throw new Error(_0x3495('0x93'));}if(_['some'](_0x4c8652,[_0x3495('0x2f'),_0x3495('0x89')])&&_0x4d6a0b[_0x3495('0x31')][_0x3495('0x2f')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x3495('0x8a')](_0x4c8652)[_0x3495('0x16')](function(){return validateUser(_0x4c8652[0x0]);})['then'](function(){for(var _0x290f87=0x1;_0x290f87<_0x4c8652[_0x3495('0x4f')];_0x290f87++){var _0x16f86c=_0x4c8652[_0x290f87-0x1][_0x3495('0x6c')];if(!_0x4c8652[_0x290f87]['internal'])_0x4c8652[_0x290f87]['internal']=_0x16f86c+0x1;_0x143af5['push'](validateUser(_0x4c8652[_0x290f87]));}return BPromise[_0x3495('0x56')](_0x143af5);})[_0x3495('0x16')](function(){_0x143af5=[];for(var _0x8148c6=0x0;_0x8148c6<_0x4c8652['length'];_0x8148c6++){_0x143af5[_0x3495('0x4c')](updateUser(_0x4c8652[_0x8148c6]));}return BPromise[_0x3495('0x56')](_0x143af5);})['then'](function(){return BPromise['each'](_0x4c8652,function(_0x32780c){return db[_0x3495('0x44')]['create'](_0x32780c,{'include':[{'model':db[_0x3495('0x76')],'as':_0x3495('0x76')}]})[_0x3495('0x16')](function(_0x14f9d3){_0x32780c['id']=_0x14f9d3['id'];return _0x32780c;});});})[_0x3495('0x16')](function(_0x44d1a3){if(_0x4d6a0b['body']['role']===_0x3495('0x31'))return _0x44d1a3;if(_0x4d6a0b[_0x3495('0x31')][_0x3495('0x2f')]!=='user')return _0x44d1a3;var _0x592004=_['some'](_0x44d1a3,function(_0x4bb164){return _0x4bb164[_0x3495('0x2f')]===_0x3495('0x33')||_0x4bb164[_0x3495('0x2f')]===_0x3495('0x34');});if(!_0x592004)return _0x44d1a3;return db['UserProfileSection'][_0x3495('0x4d')]({'where':{'name':{'$or':[_0x3495('0x32'),_0x3495('0x8e')]},'userProfileId':_0x4d6a0b[_0x3495('0x31')]['userProfileId']},'raw':!![]})[_0x3495('0x16')](function(_0x5879de){if(_[_0x3495('0x94')](_0x5879de)||!_[_0x3495('0x92')](_0x5879de,[_0x3495('0x8f'),0x0]))return _0x44d1a3;_0x143af5=[];var _0x4619f1=_(_0x5879de)['map'](function(_0x17fe4e){if(_0x17fe4e[_0x3495('0x8f')]===0x1)return;return _0x17fe4e[_0x3495('0x3b')]==='Agents'?'agent':'telephone';})[_0x3495('0x95')]()['value']();for(var _0x4142d1=0x0;_0x4142d1<_0x44d1a3[_0x3495('0x4f')];_0x4142d1++){if(!_['includes'](_0x4619f1,_0x44d1a3[_0x4142d1][_0x3495('0x2f')]))return;var _0x3e080f=_0x44d1a3[_0x4142d1][_0x3495('0x2f')]==='agent'?_0x3495('0x32'):'Telephones';_0x143af5[_0x3495('0x4c')](db['UserProfileResource']['create']({'name':_0x44d1a3[_0x4142d1][_0x3495('0x3b')],'resourceId':_0x44d1a3[_0x4142d1]['id'],'type':_0x3e080f,'sectionId':_[_0x3495('0x3a')](_0x5879de,[_0x3495('0x3b'),_0x3e080f])['id']},{}));}return BPromise[_0x3495('0x56')](_0x143af5);});})[_0x3495('0x16')](respondWithResult(_0x584dc9,0xc9))[_0x3495('0x57')](handleError(_0x584dc9,null));};exports['changePassword']=function(_0x4034f0,_0x4e7cfc){if(_0x4034f0['body']['id']){delete _0x4034f0[_0x3495('0x65')]['id'];}return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x4034f0['params']['id']}})[_0x3495('0x16')](function(_0x2b94ee){if(!_0x2b94ee)return null;if(_0x2b94ee['id']===_0x4034f0[_0x3495('0x31')]['id']){if(!_0x4034f0['body'][_0x3495('0x96')]||!_0x4034f0['body']['newPassword']){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0x99'));}if(!_0x2b94ee[_0x3495('0x9a')](_0x4034f0[_0x3495('0x65')][_0x3495('0x96')])){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0x9b'));}if(_0x4034f0[_0x3495('0x65')][_0x3495('0x96')]===_0x4034f0[_0x3495('0x65')][_0x3495('0x9c')]){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4034f0[_0x3495('0x31')][_0x3495('0x2f')]===_0x3495('0x89')){if(!_0x4034f0[_0x3495('0x65')][_0x3495('0x9c')]){throw new db[(_0x3495('0x97'))]['ValidationError'](_0x3495('0x9d'));}}else if(_0x4034f0[_0x3495('0x31')][_0x3495('0x2f')]===_0x3495('0x31')){if(!_0x4034f0['body']['newPassword']){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0x9d'));}if(_0x2b94ee['role']!==_0x3495('0x33')){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0x88'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x2b94ee;})[_0x3495('0x16')](handleEntityNotFound(_0x4e7cfc,null))[_0x3495('0x16')](function(_0x287c31){return db[_0x3495('0x69')][_0x3495('0x9e')]({'attributes':['id',_0x3495('0x9f'),_0x3495('0xa0'),'passwordHistoryLimit']})[_0x3495('0x16')](function(_0x1b8fb9){if(_0x1b8fb9[_0x3495('0x9f')])authService['validatePasswordPattern'](_0x4034f0[_0x3495('0x65')][_0x3495('0x9c')]);if(!_0x1b8fb9[_0x3495('0xa0')]||!_0x287c31['previousPasswords'])return _0x287c31;authService['validatePasswordHistory'](_0x4034f0[_0x3495('0x65')][_0x3495('0x9c')],_0x287c31[_0x3495('0xa1')],_0x1b8fb9[_0x3495('0xa2')]);return _0x287c31;})['then'](saveUpdates({'password':_0x4034f0['body'][_0x3495('0x9c')],'passwordResetAt':_0x4034f0[_0x3495('0x31')]['id']==_0x4034f0['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4034f0[_0x3495('0x65')]['newPassword'],_0x287c31[_0x3495('0xa1')])},null));})[_0x3495('0x16')](respondWithResult(_0x4e7cfc,null))['catch'](handleError(_0x4e7cfc,null));};exports[_0x3495('0xa3')]=function(_0x2eddcf,_0x364462){var _0x5b5100=_0x2eddcf[_0x3495('0x65')][_0x3495('0xa4')];return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x2eddcf[_0x3495('0x59')]['id']},'attributes':['id',_0x3495('0x3b'),_0x3495('0x2f'),'online',_0x3495('0xa5'),_0x3495('0xa6'),_0x3495('0xa7')]})[_0x3495('0x16')](handleEntityNotFound(_0x364462,null))[_0x3495('0x16')](function(_0x3a36d6){if(_0x3a36d6){if(!utils[_0x3495('0xa8')](_0x5b5100)){throw new db[(_0x3495('0x97'))]['ValidationError'](_0x3495('0xa9'));}return _0x3a36d6[_0x3495('0xaa')+_['capitalize'](_0x5b5100[_0x3495('0xab')]())+'Queues'](_0x2eddcf[_0x3495('0x65')][_0x3495('0x68')],{'penalty':_0x2eddcf['body'][_0x3495('0xac')]||0x0})[_0x3495('0xad')](function(_0x345202){for(var _0x312489=0x0;_0x312489<_0x2eddcf['body'][_0x3495('0x68')][_0x3495('0x4f')];_0x312489+=0x1){var _0x108525={'UserId':Number(_0x2eddcf['params']['id'])};_0x108525[_[_0x3495('0xae')](_0x5b5100[_0x3495('0xab')]())+'QueueId']=Number(_0x2eddcf['body'][_0x3495('0x68')][_0x312489]);socket[_0x3495('0x2b')](_0x3495('0x31')+_[_0x3495('0xae')](_0x5b5100[_0x3495('0xab')]())+'Queue:save',_0x108525);}return _0x345202;})[_0x3495('0x16')](function(){if(_0x5b5100===_0x3495('0xaf')){return db[_0x3495('0xb0')]['findAll']({'where':{'id':_0x2eddcf['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x3495('0x16')](function(_0x4585d6){var _0x4cb8e3=_0x3a36d6[_0x3495('0x2e')]({'plain':!![]});var _0x4015db=[];if(_0x5b5100===_0x3495('0xaf')&&_0x4cb8e3[_0x3495('0x2f')]==='agent'&&_0x4cb8e3[_0x3495('0xb1')]){for(var _0x495094=0x0;_0x495094<_0x4585d6['length'];_0x495094+=0x1){_0x4015db[_0x3495('0x4c')]({'membername':_0x4cb8e3[_0x3495('0x3b')],'UserId':_0x4cb8e3['id'],'queue_name':_0x4585d6[_0x495094][_0x3495('0x3b')],'VoiceQueueId':_0x4585d6[_0x495094]['id'],'interface':_[_0x3495('0x6e')](_0x4cb8e3[_0x3495('0xa7')])?util[_0x3495('0xb2')]('SIP/%s',_0x4cb8e3[_0x3495('0x3b')]):_0x4cb8e3[_0x3495('0xa7')],'paused':_0x4cb8e3[_0x3495('0xa6')]||![],'penalty':_0x2eddcf[_0x3495('0x65')][_0x3495('0xac')]||0x0});}return BPromise['each'](_0x4015db,function(_0x26f8b9){return db[_0x3495('0xb3')]['upsert'](_0x26f8b9);});}return _0x3a36d6;});}})['then'](respondWithStatusCode(_0x364462,null))[_0x3495('0x57')](handleError(_0x364462,null));};exports[_0x3495('0xb4')]=function(_0xfe1e55,_0x188d56){var _0x289a2b,_0x6508a8;return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0xfe1e55['params']['id']},'attributes':['id','name',_0x3495('0x2f')]})['then'](handleEntityNotFound(_0x188d56,null))[_0x3495('0x16')](function(_0x5a5aea){if(_0x5a5aea){_0x289a2b=_0x5a5aea;if(!_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')]||!utils['isValidChannel'](_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')])){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0xa9'));}return _0x5a5aea[_0x3495('0xb5')+_[_0x3495('0xae')](_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')]['toLowerCase']())+_0x3495('0xb6')](_0xfe1e55[_0x3495('0x45')]['ids']);}})[_0x3495('0x16')](function(_0x299ae2){if(_[_0x3495('0xb7')](_0xfe1e55['query']['ids'])){for(var _0x3967e1=0x0;_0x3967e1<_0xfe1e55[_0x3495('0x45')][_0x3495('0x68')][_0x3495('0x4f')];_0x3967e1+=0x1){_0x6508a8={'UserId':Number(_0xfe1e55['params']['id'])};_0x6508a8[_[_0x3495('0xae')](_0xfe1e55['query'][_0x3495('0xa4')][_0x3495('0xab')]())+_0x3495('0xb8')]=Number(_0xfe1e55[_0x3495('0x45')][_0x3495('0x68')][_0x3967e1]);socket[_0x3495('0x2b')](_0x3495('0x31')+_[_0x3495('0xae')](_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')]['toLowerCase']())+_0x3495('0xb9'),_0x6508a8);}}else{_0x6508a8={'UserId':Number(_0xfe1e55[_0x3495('0x59')]['id'])};_0x6508a8[_[_0x3495('0xae')](_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')][_0x3495('0xab')]())+_0x3495('0xb8')]=Number(_0xfe1e55[_0x3495('0x45')][_0x3495('0x68')]);socket[_0x3495('0x2b')](_0x3495('0x31')+_[_0x3495('0xae')](_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')][_0x3495('0xab')]())+_0x3495('0xb9'),_0x6508a8);}return _0x299ae2;})['then'](function(){if(_0xfe1e55[_0x3495('0x45')][_0x3495('0xa4')]===_0x3495('0xaf')){return db[_0x3495('0xb3')][_0x3495('0x2d')]({'where':{'UserId':_0xfe1e55['params']['id'],'VoiceQueueId':_0xfe1e55[_0x3495('0x45')]['ids']},'individualHooks':!![]})[_0x3495('0x16')](function(){return _0x289a2b;});}return _0x289a2b;})[_0x3495('0x16')](respondWithStatusCode(_0x188d56,null))['catch'](handleError(_0x188d56,null));};exports[_0x3495('0xba')]=function(_0x5a063d,_0x301c83){_0x5a063d[_0x3495('0x65')][_0x3495('0xbb')]=_0x5a063d[_0x3495('0xbc')][_0x3495('0xbd')];return db[_0x3495('0x44')]['find']({'where':{'id':_0x5a063d[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x301c83,null))[_0x3495('0x16')](saveUpdates(_0x5a063d['body'],null))[_0x3495('0x16')](respondWithResult(_0x301c83,null))['catch'](handleError(_0x301c83,null));};exports['getAvatar']=function(_0x150b5e,_0x1e43c7){var _0x1ffc10=path[_0x3495('0xbe')](config[_0x3495('0xbf')],'server/files/images/logos/default_profile.png');return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x150b5e[_0x3495('0x59')]['id']},'attributes':['id',_0x3495('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x1e43c7,null))['then'](function(_0xe2de6){if(_0xe2de6){if(_[_0x3495('0x6e')](_0xe2de6[_0x3495('0xbb')])){return _0x1e43c7[_0x3495('0xc0')](_0x1ffc10);}else{if(!fs[_0x3495('0xc1')](path['join'](config['root'],'server/files/images/',_0xe2de6['userpic']))){return _0x1e43c7[_0x3495('0xc0')](_0x1ffc10);}return _0x1e43c7['download'](path['join'](config['root'],_0x3495('0xc2'),_0xe2de6[_0x3495('0xbb')]));}}})[_0x3495('0x57')](handleError(_0x1e43c7,null));};exports['getOpenTabs']=function(_0x18286a,_0x53d675){return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x18286a[_0x3495('0x59')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x53d675,null))[_0x3495('0x16')](function(_0x38312c){var _0x36001e=[];values=_0x38312c[_0x3495('0x51')];_0x36001e[_0x3495('0x4c')](get_open_tabs(_0x3495('0x50'),_0x38312c['dataValues']));_0x36001e[_0x3495('0x4c')](get_open_tabs('sms',_0x38312c[_0x3495('0x51')]));_0x36001e[_0x3495('0x4c')](get_open_tabs(_0x3495('0x55'),_0x38312c[_0x3495('0x51')]));_0x36001e['push'](get_open_tabs(_0x3495('0x64'),_0x38312c['dataValues']));_0x36001e[_0x3495('0x4c')](get_open_tabs(_0x3495('0x53'),_0x38312c[_0x3495('0x51')]));_0x36001e['push'](get_open_tabs(_0x3495('0x54'),_0x38312c[_0x3495('0x51')]));return BPromise['all'](_0x36001e);})[_0x3495('0x16')](function(_0x27f5f2){if(_0x27f5f2){var _0x2e2ef1=_[_0x3495('0x37')](values[_0x3495('0xc3')],function(_0x2a8110){return{'channel':_0x3495('0xc4'),'id':_0x2a8110['id'],'createdAt':_0x2a8110[_0x3495('0xc5')]};});var _0x333ad6=_[_0x3495('0x37')](values[_0x3495('0xc6')],function(_0x3407a4){return{'channel':_0x3495('0xc7'),'id':_0x3407a4['id'],'createdAt':_0x3407a4['createdAt']};});var _0x2accd6=_[_0x3495('0x37')](values[_0x3495('0xc8')],function(_0x3c1a58){return{'channel':_0x3495('0xc9'),'id':_0x3c1a58['id'],'createdAt':_0x3c1a58[_0x3495('0xc5')]};});var _0x584ecb=_[_0x3495('0x37')](values['MailOpenTabs'],function(_0x5ece93){return{'channel':_0x3495('0xca'),'id':_0x5ece93['id'],'createdAt':_0x5ece93['createdAt']};});var _0x45e0b4=_[_0x3495('0x37')](values[_0x3495('0xcb')],function(_0x3ad8fe){return{'channel':_0x3495('0xcc'),'id':_0x3ad8fe['id'],'createdAt':_0x3ad8fe[_0x3495('0xc5')]};});var _0x30fd6a=_[_0x3495('0x37')](values[_0x3495('0xcd')],function(_0x4b8f11){return{'channel':_0x3495('0xce'),'id':_0x4b8f11['id'],'createdAt':_0x4b8f11[_0x3495('0xc5')]};});var _0x53164e=_['concat'](_0x2e2ef1,_0x333ad6,_0x2accd6,_0x584ecb,_0x45e0b4,_0x30fd6a);var _0x598a93={'count':_0x53164e[_0x3495('0x4f')],'rows':_0x53164e};return _0x598a93;}else return null;})['then'](respondWithResult(_0x53d675,null))[_0x3495('0x57')](handleError(_0x53d675,null));};exports[_0x3495('0xcf')]=function(_0x54c6ea,_0x179801){var _0x1155d9={};var _0x2718e2={};var _0x1d6530;var _0x12b69b;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x54c6ea['params']['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x179801,null))['then'](function(_0x7e1294){if(_0x7e1294){_0x1d6530=_0x7e1294;_0x2718e2[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xd0')]['rawAttributes']);_0x2718e2[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x54c6ea[_0x3495('0x45')]);_0x2718e2['filters']=_[_0x3495('0x5e')](_0x2718e2[_0x3495('0x5f')],_0x2718e2[_0x3495('0x45')]);_0x1155d9['attributes']=_['intersection'](_0x2718e2[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x54c6ea[_0x3495('0x45')][_0x3495('0x60')]));_0x1155d9[_0x3495('0x4b')]=_0x1155d9['attributes'][_0x3495('0x4f')]?_0x1155d9[_0x3495('0x4b')]:_0x2718e2['model'];_0x1155d9[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x54c6ea['query'][_0x3495('0xd2')]);_0x1155d9['where']=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x54c6ea['query'],_0x2718e2[_0x3495('0x5d')]));if(_0x54c6ea[_0x3495('0x45')][_0x3495('0x35')]){_0x1155d9[_0x3495('0x43')]=_[_0x3495('0x61')](_0x1155d9[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x1155d9[_0x3495('0x4b')],function(_0x5e0a42){var _0x12f384={};_0x12f384[_0x5e0a42]={'$like':'%'+_0x54c6ea[_0x3495('0x45')]['filter']+'%'};return _0x12f384;})});}_0x1155d9=_['merge']({},_0x1155d9,_0x54c6ea[_0x3495('0x62')]);return _0x1d6530['getContacts'](_0x1155d9);}})['then'](function(_0x357f18){if(_0x357f18){_0x12b69b=_0x357f18[_0x3495('0x4f')];if(_0x54c6ea['query'][_0x3495('0xd4')](_0x3495('0x46'))){_0x1155d9[_0x3495('0x47')]=[{'model':db[_0x3495('0xd5')],'as':_0x3495('0xd6'),'required':![]},{'model':db[_0x3495('0xd7')],'as':_0x3495('0xd8'),'attributes':['id',_0x3495('0x3b'),'color'],'where':_0x54c6ea['query'][_0x3495('0xd9')]?{'id':_0x54c6ea[_0x3495('0x45')][_0x3495('0xd9')]}:undefined,'required':_0x54c6ea[_0x3495('0x45')]['tag']?!![]:![]}];}if(!_0x54c6ea['query']['hasOwnProperty'](_0x3495('0xda'))){_0x1155d9['limit']=qs[_0x3495('0x26')](_0x54c6ea[_0x3495('0x45')][_0x3495('0x26')]);_0x1155d9[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x54c6ea[_0x3495('0x45')][_0x3495('0x24')]);}return _0x1d6530[_0x3495('0xcf')](_0x1155d9);}})[_0x3495('0x16')](function(_0x33c9fe){if(_0x33c9fe){return _0x33c9fe?{'count':_0x12b69b,'rows':_0x33c9fe}:null;}})['then'](respondWithResult(_0x179801,null))[_0x3495('0x57')](handleError(_0x179801,null));};exports[_0x3495('0xdb')]=function(_0x501a2b,_0x2dfda5){var _0x101b57;var _0x20efa9={};var _0x367822;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x501a2b[_0x3495('0x59')]['id']},'attributes':['id',_0x3495('0x3b'),_0x3495('0x2f')]})['then'](handleEntityNotFound(_0x2dfda5,null))[_0x3495('0x16')](function(_0x3ac568){if(!utils[_0x3495('0xa8')](_0x501a2b['query']['channel'])){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0xa9'));}_0x101b57=_0x3ac568;var _0x3ae1a9={};_0x3ae1a9['model']=_[_0x3495('0x5b')](db[_[_0x3495('0xae')](_0x501a2b[_0x3495('0x45')][_0x3495('0xa4')])+_0x3495('0xdc')][_0x3495('0x3e')]);_0x3ae1a9[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x501a2b[_0x3495('0x45')]);_0x3ae1a9[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x3ae1a9['model'],_0x3ae1a9[_0x3495('0x45')]);_0x20efa9[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x3ae1a9[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x501a2b['query'][_0x3495('0x60')]));_0x20efa9[_0x3495('0x4b')]=_0x20efa9['attributes'][_0x3495('0x4f')]?_0x20efa9[_0x3495('0x4b')]:_0x3ae1a9[_0x3495('0x5f')];_0x20efa9[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x501a2b[_0x3495('0x45')]['sort']);_0x20efa9[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x501a2b[_0x3495('0x45')],_0x3ae1a9['filters']));if(_0x501a2b[_0x3495('0x45')]['filter']){_0x20efa9[_0x3495('0x43')]=_[_0x3495('0x61')](_0x20efa9['where'],{'$or':_[_0x3495('0x37')](_0x20efa9[_0x3495('0x4b')],function(_0x46673a){var _0xa76b8d={};_0xa76b8d[_0x46673a]={'$like':'%'+_0x501a2b[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0xa76b8d;})});}_0x20efa9=_[_0x3495('0x61')]({},_0x20efa9,_0x501a2b[_0x3495('0x62')]);switch(_0x101b57[_0x3495('0x2f')]){case'admin':return db[_[_0x3495('0xae')](_0x501a2b[_0x3495('0x45')][_0x3495('0xa4')])+'Queue'][_0x3495('0x4d')](_0x20efa9);case'user':case _0x3495('0x33'):return _0x101b57[_0x3495('0x2e')+_[_0x3495('0xae')](_0x501a2b[_0x3495('0x45')][_0x3495('0xa4')])+_0x3495('0xb6')](_0x20efa9);default:throw new db['Sequelize'][(_0x3495('0x98'))](_0x3495('0xdd'));}})[_0x3495('0x16')](function(_0x210f16){_0x367822=_0x210f16[_0x3495('0x4f')];if(!_0x501a2b[_0x3495('0x45')]['hasOwnProperty'](_0x3495('0xda'))){_0x20efa9[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x501a2b[_0x3495('0x45')][_0x3495('0x26')]);_0x20efa9['offset']=qs[_0x3495('0x24')](_0x501a2b['query']['offset']);}switch(_0x101b57['role']){case'admin':return db[_[_0x3495('0xae')](_0x501a2b[_0x3495('0x45')][_0x3495('0xa4')])+_0x3495('0xdc')][_0x3495('0x4d')](_0x20efa9);case'user':case _0x3495('0x33'):return _0x101b57[_0x3495('0x2e')+_[_0x3495('0xae')](_0x501a2b[_0x3495('0x45')]['channel'])+_0x3495('0xb6')](_0x20efa9);}})[_0x3495('0x16')](function(_0x2c2b5e){return{'count':_0x367822,'rows':_0x2c2b5e};})[_0x3495('0x16')](respondWithResult(_0x2dfda5,null))['catch'](handleError(_0x2dfda5,null));};exports[_0x3495('0xde')]=function(_0x1ef48d,_0x5a2848){var _0x45f06b={};var _0x42d7ee={};var _0x2b8803;var _0x120fc4;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x1ef48d[_0x3495('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a2848,null))[_0x3495('0x16')](function(_0x89e312){if(_0x89e312){_0x2b8803=_0x89e312;_0x42d7ee[_0x3495('0x5f')]=_[_0x3495('0x5b')](db['UserVoiceQueueRt']['rawAttributes']);_0x42d7ee[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x1ef48d[_0x3495('0x45')]);_0x42d7ee[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x42d7ee[_0x3495('0x5f')],_0x42d7ee[_0x3495('0x45')]);_0x45f06b['attributes']=_[_0x3495('0x5e')](_0x42d7ee[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x1ef48d['query'][_0x3495('0x60')]));_0x45f06b['attributes']=_0x45f06b[_0x3495('0x4b')][_0x3495('0x4f')]?_0x45f06b['attributes']:_0x42d7ee[_0x3495('0x5f')];_0x45f06b[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x1ef48d[_0x3495('0x45')][_0x3495('0xd2')]);_0x45f06b[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x1ef48d['query'],_0x42d7ee[_0x3495('0x5d')]));if(_0x1ef48d[_0x3495('0x45')][_0x3495('0x35')]){_0x45f06b['where']=_[_0x3495('0x61')](_0x45f06b[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x45f06b[_0x3495('0x4b')],function(_0xd5d97){var _0x1cb1e6={};_0x1cb1e6[_0xd5d97]={'$like':'%'+_0x1ef48d[_0x3495('0x45')]['filter']+'%'};return _0x1cb1e6;})});}_0x45f06b=_['merge']({},_0x45f06b,_0x1ef48d[_0x3495('0x62')]);return _0x2b8803['getVoiceQueuesRt'](_0x45f06b);}})[_0x3495('0x16')](function(_0x4accdd){if(_0x4accdd){_0x120fc4=_0x4accdd[_0x3495('0x4f')];if(!_0x1ef48d[_0x3495('0x45')]['hasOwnProperty'](_0x3495('0xda'))){_0x45f06b['limit']=qs[_0x3495('0x26')](_0x1ef48d['query'][_0x3495('0x26')]);_0x45f06b[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x1ef48d[_0x3495('0x45')][_0x3495('0x24')]);}return _0x2b8803['getVoiceQueuesRt'](_0x45f06b);}})[_0x3495('0x16')](function(_0x54e6cb){if(_0x54e6cb){return _0x54e6cb?{'count':_0x120fc4,'rows':_0x54e6cb}:null;}})[_0x3495('0x16')](respondWithResult(_0x5a2848,null))[_0x3495('0x57')](handleError(_0x5a2848,null));};exports['getGroups']=function(_0x21a9c3,_0x2b4fb4){var _0x1acd2b={};var _0x597252={};var _0x554efb;var _0x4078a4;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x21a9c3['params']['id']}})['then'](handleEntityNotFound(_0x2b4fb4,null))[_0x3495('0x16')](function(_0x36511b){if(_0x36511b){_0x554efb=_0x36511b;_0x597252[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xdf')]['rawAttributes']);_0x597252[_0x3495('0x45')]=_['keys'](_0x21a9c3[_0x3495('0x45')]);_0x597252[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x597252[_0x3495('0x5f')],_0x597252[_0x3495('0x45')]);_0x1acd2b[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x597252[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x21a9c3['query']['fields']));_0x1acd2b['attributes']=_0x1acd2b['attributes'][_0x3495('0x4f')]?_0x1acd2b[_0x3495('0x4b')]:_0x597252[_0x3495('0x5f')];_0x1acd2b[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x21a9c3[_0x3495('0x45')][_0x3495('0xd2')]);_0x1acd2b['where']=qs[_0x3495('0x5d')](_['pick'](_0x21a9c3[_0x3495('0x45')],_0x597252['filters']));if(_0x21a9c3[_0x3495('0x45')][_0x3495('0x35')]){_0x1acd2b[_0x3495('0x43')]=_['merge'](_0x1acd2b[_0x3495('0x43')],{'$or':_['map'](_0x1acd2b['attributes'],function(_0x20dd80){var _0x4b500e={};_0x4b500e[_0x20dd80]={'$like':'%'+_0x21a9c3[_0x3495('0x45')]['filter']+'%'};return _0x4b500e;})});}_0x1acd2b=_['merge']({},_0x1acd2b,_0x21a9c3[_0x3495('0x62')]);return _0x554efb[_0x3495('0xe0')](_0x1acd2b);}})[_0x3495('0x16')](function(_0x871884){if(_0x871884){_0x4078a4=_0x871884[_0x3495('0x4f')];if(!_0x21a9c3[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0x1acd2b[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x21a9c3[_0x3495('0x45')][_0x3495('0x26')]);_0x1acd2b['offset']=qs[_0x3495('0x24')](_0x21a9c3[_0x3495('0x45')][_0x3495('0x24')]);}return _0x554efb[_0x3495('0xe0')](_0x1acd2b);}})['then'](function(_0x1236ca){if(_0x1236ca){return _0x1236ca?{'count':_0x4078a4,'rows':_0x1236ca}:null;}})[_0x3495('0x16')](respondWithResult(_0x2b4fb4,null))[_0x3495('0x57')](handleError(_0x2b4fb4,null));};exports[_0x3495('0xe1')]=function(_0x1cd20e,_0x4b0c06){var _0x154cc7={'raw':!![],'where':{}};var _0x34472e={};var _0x391c5d={'count':0x0,'rows':[]};return db['User'][_0x3495('0x9e')]({'where':{'id':_0x1cd20e['params']['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x4b0c06,null))[_0x3495('0x16')](function(_0x145ec1){if(_0x145ec1){_0x34472e[_0x3495('0x5f')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x34472e[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x1cd20e[_0x3495('0x45')]);_0x34472e[_0x3495('0x5d')]=_['intersection'](_0x34472e[_0x3495('0x5f')],_0x34472e[_0x3495('0x45')]);_0x154cc7['attributes']=_[_0x3495('0x5e')](_0x34472e[_0x3495('0x5f')],qs['fields'](_0x1cd20e[_0x3495('0x45')][_0x3495('0x60')]));_0x154cc7[_0x3495('0x4b')]=_0x154cc7[_0x3495('0x4b')][_0x3495('0x4f')]?_0x154cc7[_0x3495('0x4b')]:_0x34472e[_0x3495('0x5f')];if(!_0x1cd20e[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0x154cc7[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x1cd20e['query'][_0x3495('0x26')]);_0x154cc7[_0x3495('0x24')]=qs['offset'](_0x1cd20e[_0x3495('0x45')]['offset']);}_0x154cc7[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x1cd20e['query'][_0x3495('0xd2')]);_0x154cc7[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x1cd20e[_0x3495('0x45')],_0x34472e[_0x3495('0x5d')]));_0x154cc7[_0x3495('0x43')][_0x3495('0xe2')]=_0x145ec1['id'];if(_0x1cd20e[_0x3495('0x45')][_0x3495('0x35')]){_0x154cc7[_0x3495('0x43')]=_['merge'](_0x154cc7[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x154cc7[_0x3495('0x4b')],function(_0x4197f4){var _0x3795b9={};_0x3795b9[_0x4197f4]={'$like':'%'+_0x1cd20e[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x3795b9;})});}_0x154cc7=_[_0x3495('0x61')]({},_0x154cc7,_0x1cd20e[_0x3495('0x62')]);return db[_0x3495('0xe3')][_0x3495('0x27')]({'where':_0x154cc7['where']})[_0x3495('0x16')](function(_0x33efd2){_0x391c5d[_0x3495('0x27')]=_0x33efd2;if(_0x1cd20e[_0x3495('0x45')][_0x3495('0x46')]){_0x154cc7[_0x3495('0x47')]=[{'all':!![]}];}return db[_0x3495('0xe3')][_0x3495('0x4d')](_0x154cc7);})[_0x3495('0x16')](function(_0x302ccf){_0x391c5d[_0x3495('0x4e')]=_0x302ccf;return _0x391c5d;});}})[_0x3495('0x16')](respondWithFilteredResult(_0x4b0c06,_0x154cc7))[_0x3495('0x57')](handleError(_0x4b0c06,null));};exports[_0x3495('0xe4')]=function(_0x413123,_0x19845e){var _0xd636b5={'raw':!![],'where':{}};var _0x3ba8b0={};var _0xae7071={'count':0x0,'rows':[]};return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x413123[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x19845e,null))[_0x3495('0x16')](function(_0x480bcf){if(_0x480bcf){_0x3ba8b0[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xe5')][_0x3495('0x3e')]);_0x3ba8b0['query']=_['keys'](_0x413123[_0x3495('0x45')]);_0x3ba8b0[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x3ba8b0[_0x3495('0x5f')],_0x3ba8b0[_0x3495('0x45')]);_0xd636b5[_0x3495('0x4b')]=_['intersection'](_0x3ba8b0['model'],qs[_0x3495('0x60')](_0x413123[_0x3495('0x45')][_0x3495('0x60')]));_0xd636b5[_0x3495('0x4b')]=_0xd636b5[_0x3495('0x4b')][_0x3495('0x4f')]?_0xd636b5['attributes']:_0x3ba8b0[_0x3495('0x5f')];if(!_0x413123[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0xd636b5[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x413123[_0x3495('0x45')][_0x3495('0x26')]);_0xd636b5[_0x3495('0x24')]=qs['offset'](_0x413123['query'][_0x3495('0x24')]);}_0xd636b5[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x413123[_0x3495('0x45')][_0x3495('0xd2')]);_0xd636b5[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x413123[_0x3495('0x45')],_0x3ba8b0[_0x3495('0x5d')]));_0xd636b5[_0x3495('0x43')]['UserId']=_0x480bcf['id'];if(_0x413123[_0x3495('0x45')]['filter']){_0xd636b5[_0x3495('0x43')]=_[_0x3495('0x61')](_0xd636b5['where'],{'$or':_[_0x3495('0x37')](_0xd636b5[_0x3495('0x4b')],function(_0x3d37cd){var _0x3902ec={};_0x3902ec[_0x3d37cd]={'$like':'%'+_0x413123[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x3902ec;})});}_0xd636b5=_['merge']({},_0xd636b5,_0x413123[_0x3495('0x62')]);return db[_0x3495('0xe5')][_0x3495('0x27')]({'where':_0xd636b5[_0x3495('0x43')]})[_0x3495('0x16')](function(_0x4b3b19){_0xae7071['count']=_0x4b3b19;if(_0x413123['query'][_0x3495('0x46')]){_0xd636b5[_0x3495('0x47')]=[{'all':!![]}];}return db[_0x3495('0xe5')][_0x3495('0x4d')](_0xd636b5);})[_0x3495('0x16')](function(_0x1f3202){_0xae7071[_0x3495('0x4e')]=_0x1f3202;return _0xae7071;});}})[_0x3495('0x16')](respondWithFilteredResult(_0x19845e,_0xd636b5))[_0x3495('0x57')](handleError(_0x19845e,null));};exports[_0x3495('0xe6')]=function(_0x309d75,_0x39fd64){var _0x51daac={};var _0x2b0580={};var _0x4b8327;var _0x4453fb;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x309d75[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x39fd64,null))[_0x3495('0x16')](function(_0x3110dd){if(_0x3110dd){_0x4b8327=_0x3110dd;_0x2b0580[_0x3495('0x5f')]=_['keys'](db[_0x3495('0xe7')]['rawAttributes']);_0x2b0580[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x309d75[_0x3495('0x45')]);_0x2b0580['filters']=_[_0x3495('0x5e')](_0x2b0580[_0x3495('0x5f')],_0x2b0580[_0x3495('0x45')]);_0x51daac['attributes']=_[_0x3495('0x5e')](_0x2b0580['model'],qs['fields'](_0x309d75[_0x3495('0x45')][_0x3495('0x60')]));_0x51daac[_0x3495('0x4b')]=_0x51daac[_0x3495('0x4b')][_0x3495('0x4f')]?_0x51daac[_0x3495('0x4b')]:_0x2b0580[_0x3495('0x5f')];_0x51daac[_0x3495('0xd1')]=qs['sort'](_0x309d75[_0x3495('0x45')][_0x3495('0xd2')]);_0x51daac['where']=qs[_0x3495('0x5d')](_['pick'](_0x309d75[_0x3495('0x45')],_0x2b0580['filters']));if(_0x309d75[_0x3495('0x45')][_0x3495('0x35')]){_0x51daac[_0x3495('0x43')]=_[_0x3495('0x61')](_0x51daac['where'],{'$or':_[_0x3495('0x37')](_0x51daac[_0x3495('0x4b')],function(_0x416d69){var _0x2b6d6c={};_0x2b6d6c[_0x416d69]={'$like':'%'+_0x309d75[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x2b6d6c;})});}_0x51daac=_[_0x3495('0x61')]({},_0x51daac,_0x309d75[_0x3495('0x62')]);return _0x4b8327[_0x3495('0xe6')](_0x51daac);}})[_0x3495('0x16')](function(_0x58cea8){if(_0x58cea8){_0x4453fb=_0x58cea8[_0x3495('0x4f')];if(!_0x309d75[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0x51daac[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x309d75[_0x3495('0x45')][_0x3495('0x26')]);_0x51daac[_0x3495('0x24')]=qs['offset'](_0x309d75[_0x3495('0x45')][_0x3495('0x24')]);}return _0x4b8327[_0x3495('0xe6')](_0x51daac);}})['then'](function(_0x3612de){if(_0x3612de){return _0x3612de?{'count':_0x4453fb,'rows':_0x3612de}:null;}})[_0x3495('0x16')](respondWithResult(_0x39fd64,null))[_0x3495('0x57')](handleError(_0x39fd64,null));};exports[_0x3495('0xe8')]=function(_0x2b13ad,_0x189e0b){var _0x2e3091={};var _0x594b69={};var _0x6b89af;var _0x3b4803;return db['User'][_0x3495('0x9e')]({'where':{'id':_0x2b13ad[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x189e0b,null))[_0x3495('0x16')](function(_0x53d6f3){if(_0x53d6f3){_0x6b89af=_0x53d6f3;_0x594b69[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xe9')][_0x3495('0x3e')]);_0x594b69['query']=_[_0x3495('0x5b')](_0x2b13ad['query']);_0x594b69[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x594b69['model'],_0x594b69[_0x3495('0x45')]);_0x2e3091['attributes']=_[_0x3495('0x5e')](_0x594b69[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x2b13ad[_0x3495('0x45')][_0x3495('0x60')]));_0x2e3091['attributes']=_0x2e3091[_0x3495('0x4b')]['length']?_0x2e3091[_0x3495('0x4b')]:_0x594b69[_0x3495('0x5f')];_0x2e3091[_0x3495('0xd1')]=qs['sort'](_0x2b13ad[_0x3495('0x45')][_0x3495('0xd2')]);_0x2e3091[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x2b13ad[_0x3495('0x45')],_0x594b69[_0x3495('0x5d')]));if(_0x2b13ad['query']['filter']){_0x2e3091[_0x3495('0x43')]=_[_0x3495('0x61')](_0x2e3091[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x2e3091[_0x3495('0x4b')],function(_0x1d3a7f){var _0x39af34={};_0x39af34[_0x1d3a7f]={'$like':'%'+_0x2b13ad[_0x3495('0x45')]['filter']+'%'};return _0x39af34;})});}_0x2e3091=_[_0x3495('0x61')]({},_0x2e3091,_0x2b13ad['options']);return _0x6b89af[_0x3495('0xe8')](_0x2e3091);}})[_0x3495('0x16')](function(_0xf3d053){if(_0xf3d053){_0x3b4803=_0xf3d053[_0x3495('0x4f')];if(!_0x2b13ad[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0x2e3091['limit']=qs[_0x3495('0x26')](_0x2b13ad[_0x3495('0x45')][_0x3495('0x26')]);_0x2e3091[_0x3495('0x24')]=qs['offset'](_0x2b13ad['query'][_0x3495('0x24')]);}return _0x6b89af['getOpenchannelInteractions'](_0x2e3091);}})[_0x3495('0x16')](function(_0x564e85){if(_0x564e85){return _0x564e85?{'count':_0x3b4803,'rows':_0x564e85}:null;}})[_0x3495('0x16')](respondWithResult(_0x189e0b,null))[_0x3495('0x57')](handleError(_0x189e0b,null));};exports[_0x3495('0xea')]=function(_0x3c2e46,_0x289705){var _0x3fcfd2={'raw':!![],'where':{}};var _0x1f8604={};var _0x4e9149={'count':0x0,'rows':[]};return db['User'][_0x3495('0x9e')]({'where':{'id':_0x3c2e46[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x289705,null))[_0x3495('0x16')](function(_0x538c8e){if(_0x538c8e){_0x1f8604[_0x3495('0x5f')]=_[_0x3495('0x5b')](db['MailInteraction']['rawAttributes']);_0x1f8604['query']=_[_0x3495('0x5b')](_0x3c2e46[_0x3495('0x45')]);_0x1f8604[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x1f8604[_0x3495('0x5f')],_0x1f8604[_0x3495('0x45')]);_0x3fcfd2[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x1f8604['model'],qs[_0x3495('0x60')](_0x3c2e46['query']['fields']));_0x3fcfd2[_0x3495('0x4b')]=_0x3fcfd2[_0x3495('0x4b')]['length']?_0x3fcfd2[_0x3495('0x4b')]:_0x1f8604['model'];if(!_0x3c2e46['query'][_0x3495('0xd4')](_0x3495('0xda'))){_0x3fcfd2[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x3c2e46['query'][_0x3495('0x26')]);_0x3fcfd2[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x3c2e46[_0x3495('0x45')][_0x3495('0x24')]);}_0x3fcfd2[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x3c2e46[_0x3495('0x45')][_0x3495('0xd2')]);_0x3fcfd2['where']=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x3c2e46[_0x3495('0x45')],_0x1f8604['filters']));_0x3fcfd2['where'][_0x3495('0xe2')]=_0x538c8e['id'];if(_0x3c2e46[_0x3495('0x45')][_0x3495('0x35')]){_0x3fcfd2[_0x3495('0x43')]=_['merge'](_0x3fcfd2[_0x3495('0x43')],{'$or':_['map'](_0x3fcfd2[_0x3495('0x4b')],function(_0x1a8b2e){var _0x3a0f6e={};_0x3a0f6e[_0x1a8b2e]={'$like':'%'+_0x3c2e46[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x3a0f6e;})});}_0x3fcfd2=_[_0x3495('0x61')]({},_0x3fcfd2,_0x3c2e46[_0x3495('0x62')]);return db[_0x3495('0xeb')]['count']({'where':_0x3fcfd2[_0x3495('0x43')]})['then'](function(_0x4a8e41){_0x4e9149[_0x3495('0x27')]=_0x4a8e41;if(_0x3c2e46[_0x3495('0x45')]['includeAll']){_0x3fcfd2['include']=[{'all':!![]}];}return db[_0x3495('0xeb')][_0x3495('0x4d')](_0x3fcfd2);})[_0x3495('0x16')](function(_0x1d1224){_0x4e9149[_0x3495('0x4e')]=_0x1d1224;return _0x4e9149;});}})[_0x3495('0x16')](respondWithFilteredResult(_0x289705,_0x3fcfd2))[_0x3495('0x57')](handleError(_0x289705,null));};exports['getSmsInteractions']=function(_0x4afd72,_0x1bf402){var _0x7a1c8c={};var _0xa746b6={};var _0x19ed38;var _0x24df49;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x4afd72[_0x3495('0x59')]['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x1bf402,null))[_0x3495('0x16')](function(_0x8b37a8){if(_0x8b37a8){_0x19ed38=_0x8b37a8;_0xa746b6[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xec')][_0x3495('0x3e')]);_0xa746b6[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x4afd72['query']);_0xa746b6[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0xa746b6[_0x3495('0x5f')],_0xa746b6[_0x3495('0x45')]);_0x7a1c8c[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0xa746b6[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x4afd72[_0x3495('0x45')][_0x3495('0x60')]));_0x7a1c8c[_0x3495('0x4b')]=_0x7a1c8c['attributes'][_0x3495('0x4f')]?_0x7a1c8c[_0x3495('0x4b')]:_0xa746b6[_0x3495('0x5f')];_0x7a1c8c[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x4afd72['query'][_0x3495('0xd2')]);_0x7a1c8c[_0x3495('0x43')]=qs[_0x3495('0x5d')](_['pick'](_0x4afd72[_0x3495('0x45')],_0xa746b6['filters']));if(_0x4afd72[_0x3495('0x45')][_0x3495('0x35')]){_0x7a1c8c[_0x3495('0x43')]=_['merge'](_0x7a1c8c[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x7a1c8c[_0x3495('0x4b')],function(_0x150bcb){var _0x4871ab={};_0x4871ab[_0x150bcb]={'$like':'%'+_0x4afd72[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x4871ab;})});}_0x7a1c8c=_[_0x3495('0x61')]({},_0x7a1c8c,_0x4afd72[_0x3495('0x62')]);return _0x19ed38[_0x3495('0xed')](_0x7a1c8c);}})['then'](function(_0x2aa49c){if(_0x2aa49c){_0x24df49=_0x2aa49c[_0x3495('0x4f')];if(!_0x4afd72['query'][_0x3495('0xd4')](_0x3495('0xda'))){_0x7a1c8c[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x4afd72[_0x3495('0x45')]['limit']);_0x7a1c8c[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x4afd72[_0x3495('0x45')][_0x3495('0x24')]);}return _0x19ed38[_0x3495('0xed')](_0x7a1c8c);}})[_0x3495('0x16')](function(_0x38a397){if(_0x38a397){return _0x38a397?{'count':_0x24df49,'rows':_0x38a397}:null;}})[_0x3495('0x16')](respondWithResult(_0x1bf402,null))[_0x3495('0x57')](handleError(_0x1bf402,null));};exports[_0x3495('0xee')]=function(_0x540003,_0x6e4c7e){var _0x1e70f7={};var _0x121269={};var _0x40ed56;var _0x44b98f;return db[_0x3495('0x44')]['findOne']({'where':{'id':_0x540003['params']['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x6e4c7e,null))['then'](function(_0x5f013e){if(_0x5f013e){_0x40ed56=_0x5f013e;_0x121269[_0x3495('0x5f')]=_[_0x3495('0x5b')](db['FaxInteraction'][_0x3495('0x3e')]);_0x121269[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x540003[_0x3495('0x45')]);_0x121269[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x121269[_0x3495('0x5f')],_0x121269['query']);_0x1e70f7[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x121269['model'],qs[_0x3495('0x60')](_0x540003[_0x3495('0x45')]['fields']));_0x1e70f7[_0x3495('0x4b')]=_0x1e70f7[_0x3495('0x4b')][_0x3495('0x4f')]?_0x1e70f7[_0x3495('0x4b')]:_0x121269[_0x3495('0x5f')];_0x1e70f7[_0x3495('0xd1')]=qs['sort'](_0x540003[_0x3495('0x45')]['sort']);_0x1e70f7[_0x3495('0x43')]=qs['filters'](_[_0x3495('0xd3')](_0x540003[_0x3495('0x45')],_0x121269[_0x3495('0x5d')]));if(_0x540003[_0x3495('0x45')][_0x3495('0x35')]){_0x1e70f7[_0x3495('0x43')]=_['merge'](_0x1e70f7['where'],{'$or':_[_0x3495('0x37')](_0x1e70f7['attributes'],function(_0x325ec8){var _0x394240={};_0x394240[_0x325ec8]={'$like':'%'+_0x540003[_0x3495('0x45')]['filter']+'%'};return _0x394240;})});}_0x1e70f7=_[_0x3495('0x61')]({},_0x1e70f7,_0x540003[_0x3495('0x62')]);return _0x40ed56['getFaxInteractions'](_0x1e70f7);}})[_0x3495('0x16')](function(_0x29025f){if(_0x29025f){_0x44b98f=_0x29025f[_0x3495('0x4f')];if(!_0x540003['query']['hasOwnProperty']('nolimit')){_0x1e70f7['limit']=qs[_0x3495('0x26')](_0x540003[_0x3495('0x45')]['limit']);_0x1e70f7[_0x3495('0x24')]=qs['offset'](_0x540003['query'][_0x3495('0x24')]);}return _0x40ed56[_0x3495('0xee')](_0x1e70f7);}})[_0x3495('0x16')](function(_0x411ec9){if(_0x411ec9){return _0x411ec9?{'count':_0x44b98f,'rows':_0x411ec9}:null;}})[_0x3495('0x16')](respondWithResult(_0x6e4c7e,null))[_0x3495('0x57')](handleError(_0x6e4c7e,null));};exports[_0x3495('0xef')]=function(_0x452268,_0x2ecff7){var _0xf7797f={};var _0x3a251a={};var _0x2f7adb;var _0x329fb9;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x452268['params']['id']}})['then'](handleEntityNotFound(_0x2ecff7,null))[_0x3495('0x16')](function(_0xac86a1){if(_0xac86a1){_0x2f7adb=_0xac86a1;_0x3a251a[_0x3495('0x5f')]=_[_0x3495('0x5b')](db['WhatsappInteraction'][_0x3495('0x3e')]);_0x3a251a[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x452268[_0x3495('0x45')]);_0x3a251a[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x3a251a[_0x3495('0x5f')],_0x3a251a[_0x3495('0x45')]);_0xf7797f[_0x3495('0x4b')]=_['intersection'](_0x3a251a['model'],qs[_0x3495('0x60')](_0x452268['query'][_0x3495('0x60')]));_0xf7797f[_0x3495('0x4b')]=_0xf7797f[_0x3495('0x4b')][_0x3495('0x4f')]?_0xf7797f[_0x3495('0x4b')]:_0x3a251a[_0x3495('0x5f')];_0xf7797f[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x452268[_0x3495('0x45')][_0x3495('0xd2')]);_0xf7797f[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x452268[_0x3495('0x45')],_0x3a251a[_0x3495('0x5d')]));if(_0x452268[_0x3495('0x45')][_0x3495('0x35')]){_0xf7797f['where']=_[_0x3495('0x61')](_0xf7797f[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0xf7797f[_0x3495('0x4b')],function(_0x55f8a2){var _0x1ad422={};_0x1ad422[_0x55f8a2]={'$like':'%'+_0x452268[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x1ad422;})});}_0xf7797f=_['merge']({},_0xf7797f,_0x452268['options']);return _0x2f7adb[_0x3495('0xef')](_0xf7797f);}})['then'](function(_0xe75d6){if(_0xe75d6){_0x329fb9=_0xe75d6['length'];if(!_0x452268[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0xf7797f[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x452268[_0x3495('0x45')][_0x3495('0x26')]);_0xf7797f[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x452268[_0x3495('0x45')][_0x3495('0x24')]);}return _0x2f7adb[_0x3495('0xef')](_0xf7797f);}})['then'](function(_0x5c993c){if(_0x5c993c){return _0x5c993c?{'count':_0x329fb9,'rows':_0x5c993c}:null;}})[_0x3495('0x16')](respondWithResult(_0x2ecff7,null))[_0x3495('0x57')](handleError(_0x2ecff7,null));};exports[_0x3495('0xf0')]=function(_0x408c5e,_0x338151,_0x585066){var _0x55ce68;var _0x2e34cc;var _0x421411;var _0x21406c=!_[_0x3495('0x6e')](_0x408c5e['params']['id'])?_0x408c5e[_0x3495('0x59')]['id']:!_[_0x3495('0x6e')](_0x408c5e[_0x3495('0x31')]['id'])?_0x408c5e['user']['id']:null;return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x21406c,'role':{'$or':[_0x3495('0x89'),_0x3495('0x31'),_0x3495('0x33')]}},'attributes':['id',_0x3495('0x3b'),'phone',_0x3495('0xf1'),_0x3495('0x2f'),_0x3495('0x6c'),_0x3495('0xa5')]})['then'](function(_0x531670){if(_0x531670){if(_0x531670[_0x3495('0x2f')]===_0x3495('0x33')){_0x55ce68=_0x531670;if(_0x408c5e['body'][_0x3495('0xa7')]){_0x421411=util[_0x3495('0xb2')](_0x3495('0xf2'),_0x55ce68[_0x408c5e[_0x3495('0x65')][_0x3495('0xa7')]]);}else if(_0x408c5e[_0x3495('0x65')][_0x3495('0xf3')]){_0x421411=util[_0x3495('0xb2')](_0x3495('0xf4'),_0x408c5e[_0x3495('0x65')][_0x3495('0xf3')]);}else{_0x421411=util[_0x3495('0xb2')](_0x3495('0xf4'),_0x55ce68[_0x3495('0x3b')]);}socket['to'](util[_0x3495('0xb2')](_0x3495('0xf5'),_0x55ce68[_0x3495('0x3b')]))[_0x3495('0x2b')](_0x3495('0xf6'),{'user':{'id':_0x55ce68['id'],'name':_0x55ce68[_0x3495('0x3b')]},'ip':_0x408c5e[_0x3495('0xf7')][_0x3495('0xf8')]||_0x408c5e['connection'][_0x3495('0xf9')]||_0x408c5e[_0x3495('0xfa')][_0x3495('0xf9')]||_0x408c5e[_0x3495('0xfb')]['socket'][_0x3495('0xf9')]});return db[_0x3495('0xb3')]['destroy']({'where':{'membername':_0x55ce68[_0x3495('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0xfc'));}})[_0x3495('0x16')](function(){if(_0x55ce68){return _0x55ce68[_0x3495('0xfd')]({'raw':!![]});}})[_0x3495('0x16')](function(_0xf562af){if(_0x55ce68){var _0x5d97e0=[];if(_0xf562af){_0x2e34cc=_0xf562af;if(_0x2e34cc['length']){for(var _0x240980=0x0;_0x240980<_0x2e34cc[_0x3495('0x4f')];_0x240980++){_0x5d97e0[_0x3495('0x4c')]({'membername':_0x55ce68[_0x3495('0x3b')],'UserId':_0x55ce68['id'],'queue_name':_0x2e34cc[_0x240980][_0x3495('0x3b')],'VoiceQueueId':_0x2e34cc[_0x240980]['id'],'interface':_0x421411,'paused':_0x55ce68[_0x3495('0xa5')]||![],'penalty':_0x2e34cc[_0x240980]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x3495('0xfe')](_0x5d97e0,function(_0x3835c7){return db[_0x3495('0xb3')]['upsert'](_0x3835c7);});}}}})[_0x3495('0x16')](function(){if(_0x55ce68){return db[_0x3495('0xff')]['findAll']({'where':{'membername':_0x55ce68['name'],'exitAt':null}});}})[_0x3495('0x16')](function(_0x576970){if(_0x55ce68){var _0x5ee113=[];_0x576970[_0x3495('0x100')](function(_0x321cb3){_0x5ee113[_0x3495('0x4c')](_0x321cb3[_0x3495('0x2a')]({'exitAt':moment()[_0x3495('0xb2')](_0x3495('0x101'))}));});return BPromise[_0x3495('0x56')](_0x5ee113);}})[_0x3495('0x16')](function(){if(_0x55ce68){var _0x27ff29=[];var _0x166443=[];var _0x3e330b=utils[_0x3495('0x102')]();var _0x3cb083={'membername':_0x55ce68[_0x3495('0x3b')],'interface':_0x421411,'enterAt':moment()[_0x3495('0xb2')](_0x3495('0x101')),'role':_0x55ce68[_0x3495('0x2f')],'internal':_0x55ce68[_0x3495('0x6c')]};_0x3e330b[_0x3495('0x100')](function(_0x4179a1){_0x27ff29[_0x3495('0x4c')](_[_0x3495('0x61')]({'channel':_0x4179a1,'type':'LOGIN','data1':_0x408c5e[_0x3495('0x65')]['device'],'data2':_0x421411},_0x3cb083));if(_0x55ce68[_0x3495('0xa5')]){_0x166443[_0x3495('0x4c')](_[_0x3495('0x61')]({'channel':_0x4179a1,'type':'PAUSE','data1':_0x3495('0x103')},_0x3cb083));}});return db['MemberReport']['bulkCreate'](_0x27ff29[_0x3495('0x104')](_0x166443),{'individualHooks':!![]});}})[_0x3495('0x16')](function(){if(_0x55ce68){return _0x55ce68['update']({'online':!![],'lastLoginAt':moment()['format'](_0x3495('0x101')),'voicePause':_0x55ce68['loginInPause']||![],'mailPause':_0x55ce68[_0x3495('0xa5')]||![],'chatPause':_0x55ce68['loginInPause']||![],'faxPause':_0x55ce68[_0x3495('0xa5')]||![],'smsPause':_0x55ce68['loginInPause']||![],'openchannelPause':_0x55ce68[_0x3495('0xa5')]||![],'whatsappPause':_0x55ce68['loginInPause']||![],'pauseType':_0x55ce68[_0x3495('0xa5')]?_0x3495('0x103'):null,'interface':_0x421411,'lastPauseAt':moment()[_0x3495('0xb2')](_0x3495('0x101'))});}})['then'](function(_0x57072d){if(_0x408c5e[_0x3495('0x105')]){return _0x585066();}else{return BPromise[_0x3495('0x106')](_0x57072d)[_0x3495('0x16')](respondWithResult(_0x338151,null));}})[_0x3495('0x57')](handleError(_0x338151,null));};exports['logout']=function(_0x56f518,_0x3a8ffb){var _0x4c61db;return db[_0x3495('0x44')][_0x3495('0x3a')]({'where':{'id':_0x56f518[_0x3495('0x59')]['id'],'role':'agent'},'attributes':['id','name',_0x3495('0x2f')]})[_0x3495('0x16')](handleEntityNotFound(_0x3a8ffb,null))['then'](function(_0x3417fd){if(_0x3417fd){_0x4c61db=_0x3417fd;return db[_0x3495('0xb3')][_0x3495('0x2d')]({'where':{'membername':_0x4c61db['name']},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x3495('0x4d')]({'where':{'membername':_0x4c61db[_0x3495('0x3b')],'exitAt':null}});})[_0x3495('0x16')](function(_0x46b4d5){var _0x2008e1=[];_0x46b4d5[_0x3495('0x100')](function(_0x49ec02){_0x2008e1[_0x3495('0x4c')](_0x49ec02[_0x3495('0x2a')]({'exitAt':moment()[_0x3495('0xb2')](_0x3495('0x101'))}));});return BPromise[_0x3495('0x56')](_0x2008e1);})[_0x3495('0x16')](function(){return _0x4c61db[_0x3495('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3495('0x16')](respondWithResult(_0x3a8ffb,null))[_0x3495('0x57')](handleError(_0x3a8ffb,null));};exports[_0x3495('0x107')]=function(_0xea8677,_0x50f74b){var _0x40c459;return db[_0x3495('0xb3')][_0x3495('0x2a')]({'paused':0x1},{'where':{'UserId':_0xea8677['params']['id']},'individualHooks':!![]})[_0x3495('0x16')](function(){return db['User']['find']({'where':{'id':_0xea8677['params']['id'],'role':_0x3495('0x33')},'attributes':['id',_0x3495('0x3b'),_0x3495('0x2f'),_0x3495('0x6c'),_0x3495('0xa7')]});})['then'](handleEntityNotFound(_0x50f74b,null))[_0x3495('0x16')](function(_0x1b5555){if(_0x1b5555){_0x40c459=_0x1b5555;return respondWithRpcPromise(_0x3495('0x108'),_0x3495('0x107'),{'id':_0x40c459['id'],'name':_0x40c459['name'],'pause':!![]});}})[_0x3495('0x16')](function(){if(_0x40c459){return db['MemberReport']['findAll']({'where':{'membername':_0x40c459[_0x3495('0x3b')],'type':_0x3495('0x109'),'exitAt':null}});}})['then'](function(_0x1cad13){if(_0x1cad13[_0x3495('0x4f')]){var _0x358a56=moment()[_0x3495('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x31b3=0x0,_0x37f98a=_0x1cad13['length'];_0x31b3<_0x37f98a;_0x31b3++){_0x1cad13[_0x31b3][_0x3495('0x10a')]({'exitAt':_0x358a56});}}})[_0x3495('0x16')](function(){var _0x28024a=[];var _0x2833f7=utils[_0x3495('0x102')]();_0x2833f7[_0x3495('0x100')](function(_0x4b0da5){_0x28024a['push']({'channel':_0x4b0da5,'membername':_0x40c459[_0x3495('0x3b')],'interface':_['isNil'](_0x40c459[_0x3495('0xa7')])?util[_0x3495('0xb2')](_0x3495('0xf4'),_0x40c459[_0x3495('0x3b')]):_0x40c459[_0x3495('0xa7')],'type':_0x3495('0x109'),'enterAt':moment()[_0x3495('0xb2')](_0x3495('0x101')),'data1':_0xea8677[_0x3495('0x65')]['type']||'DEFAULT\x20PAUSE','role':_0x40c459['role'],'internal':_0x40c459[_0x3495('0x6c')]});});return db[_0x3495('0xff')]['bulkCreate'](_0x28024a,{'individualHooks':!![]});})[_0x3495('0x16')](function(){return _0x40c459[_0x3495('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xea8677[_0x3495('0x65')][_0x3495('0x40')]||_0x3495('0x10b'),'lastPauseAt':moment()['format'](_0x3495('0x101'))});})[_0x3495('0x16')](respondWithResult(_0x50f74b,null))[_0x3495('0x57')](handleError(_0x50f74b,null));};exports['unpause']=function(_0x3a8176,_0x53e6e4){var _0x18a4f5;return db['User'][_0x3495('0x3a')]({'where':{'id':_0x3a8176['params']['id']},'attributes':['id',_0x3495('0x3b'),'role',_0x3495('0xa6'),_0x3495('0x10c'),'chatPause',_0x3495('0x10d'),_0x3495('0x10e'),_0x3495('0x10f'),_0x3495('0x110'),_0x3495('0x111'),'lastPauseAt']})[_0x3495('0x16')](handleEntityNotFound(_0x53e6e4,null))[_0x3495('0x16')](function(_0x249e4e){if(_0x249e4e){_0x18a4f5=_0x249e4e;if(_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')]&&!utils[_0x3495('0xa8')](_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')])){throw new db[(_0x3495('0x97'))][(_0x3495('0x98'))](_0x3495('0xa9'));}switch(_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')]){case _0x3495('0xaf'):return respondWithRpcPromise('QueuePause',_0x3495('0x112'),{'id':_0x18a4f5['id'],'name':_0x18a4f5[_0x3495('0x3b')],'pause':![]})['then'](function(){return db[_0x3495('0xb3')][_0x3495('0x2a')]({'paused':0x0},{'where':{'UserId':_0x18a4f5['id']},'individualHooks':!![]});})[_0x3495('0x16')](function(){return db['MemberReport']['find']({'where':{'channel':_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')],'membername':_0x18a4f5[_0x3495('0x3b')],'type':_0x3495('0x109'),'exitAt':null}});})['then'](function(_0x408c90){if(_0x408c90){return _0x408c90['update']({'exitAt':moment()[_0x3495('0xb2')](_0x3495('0x101')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x18a4f5['update']({'voicePause':![]});});case _0x3495('0x54'):case'chat':case _0x3495('0x53'):case _0x3495('0x52'):case _0x3495('0x64'):case _0x3495('0x55'):return db['MemberReport'][_0x3495('0x3a')]({'where':{'channel':_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')],'membername':_0x18a4f5['name'],'type':_0x3495('0x109'),'exitAt':null}})[_0x3495('0x16')](function(_0x4a7161){if(_0x4a7161){return _0x4a7161['update']({'exitAt':moment()[_0x3495('0xb2')](_0x3495('0x101')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x3495('0x16')](function(){var _0x391406={};_[_0x3495('0x28')](_0x391406,util[_0x3495('0xb2')](_0x3495('0x113'),_0x3a8176[_0x3495('0x65')][_0x3495('0xa4')],_0x3495('0x114')),![]);return _0x18a4f5['update'](_0x391406);});default:return respondWithRpcPromise(_0x3495('0x108'),'unpause',{'id':_0x18a4f5['id'],'name':_0x18a4f5['name'],'pause':![]})[_0x3495('0x16')](function(){return db[_0x3495('0xb3')][_0x3495('0x2a')]({'paused':0x0},{'where':{'UserId':_0x18a4f5['id']}});})['then'](function(){return db[_0x3495('0xff')][_0x3495('0x4d')]({'where':{'membername':_0x18a4f5[_0x3495('0x3b')],'type':_0x3495('0x109'),'exitAt':null}});})[_0x3495('0x16')](function(_0x1feb35){var _0x40993a=[];_0x1feb35[_0x3495('0x100')](function(_0x54e2eb){_0x40993a['push'](_0x54e2eb[_0x3495('0x2a')]({'exitAt':moment()[_0x3495('0xb2')](_0x3495('0x101')),'data2':'manual'}));});return BPromise[_0x3495('0x56')](_0x40993a);})[_0x3495('0x16')](function(){return _0x18a4f5[_0x3495('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x3495('0x16')](respondWithResult(_0x53e6e4,null))['catch'](handleError(_0x53e6e4,null));};exports['getTeams']=function(_0x481086,_0x11df63){var _0x49b867={};var _0x3a5e03={};var _0x4d0155;var _0xe8eaa7;return db['User'][_0x3495('0x9e')]({'where':{'id':_0x481086['params']['id']}})['then'](handleEntityNotFound(_0x11df63,null))[_0x3495('0x16')](function(_0x189696){if(_0x189696){_0x4d0155=_0x189696;_0x3a5e03[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0x115')][_0x3495('0x3e')]);_0x3a5e03[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x481086[_0x3495('0x45')]);_0x3a5e03[_0x3495('0x5d')]=_['intersection'](_0x3a5e03[_0x3495('0x5f')],_0x3a5e03[_0x3495('0x45')]);_0x49b867[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x3a5e03['model'],qs[_0x3495('0x60')](_0x481086[_0x3495('0x45')][_0x3495('0x60')]));_0x49b867[_0x3495('0x4b')]=_0x49b867[_0x3495('0x4b')][_0x3495('0x4f')]?_0x49b867[_0x3495('0x4b')]:_0x3a5e03[_0x3495('0x5f')];_0x49b867[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x481086[_0x3495('0x45')][_0x3495('0xd2')]);_0x49b867[_0x3495('0x43')]=qs['filters'](_[_0x3495('0xd3')](_0x481086[_0x3495('0x45')],_0x3a5e03[_0x3495('0x5d')]));if(_0x481086[_0x3495('0x45')][_0x3495('0x35')]){_0x49b867['where']=_[_0x3495('0x61')](_0x49b867[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x49b867[_0x3495('0x4b')],function(_0x53eb7f){var _0x321789={};_0x321789[_0x53eb7f]={'$like':'%'+_0x481086[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0x321789;})});}_0x49b867=_[_0x3495('0x61')]({},_0x49b867,_0x481086[_0x3495('0x62')]);return _0x4d0155[_0x3495('0x116')](_0x49b867);}})[_0x3495('0x16')](function(_0x2768b3){if(_0x2768b3){_0xe8eaa7=_0x2768b3[_0x3495('0x4f')];if(!_0x481086['query'][_0x3495('0xd4')](_0x3495('0xda'))){_0x49b867[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x481086['query'][_0x3495('0x26')]);_0x49b867[_0x3495('0x24')]=qs[_0x3495('0x24')](_0x481086[_0x3495('0x45')]['offset']);}return _0x4d0155['getTeams'](_0x49b867);}})['then'](function(_0x3ed26f){if(_0x3ed26f){return _0x3ed26f?{'count':_0xe8eaa7,'rows':_0x3ed26f}:null;}})[_0x3495('0x16')](respondWithResult(_0x11df63,null))['catch'](handleError(_0x11df63,null));};exports['addTeams']=function(_0x45870e,_0x4d6fd7){var _0x14e27e=_0x45870e[_0x3495('0x59')]['id'];var _0x1b54f0=_0x45870e[_0x3495('0x65')]?_0x45870e[_0x3495('0x65')][_0x3495('0x68')]:null;var _0x3ad3f9=[];return Promise['resolve']()[_0x3495('0x16')](function(){if(!_0x1b54f0)throw new APIBadRequestError(_0x3495('0x117'));})[_0x3495('0x16')](function(){return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x14e27e}});})['then'](function(_0x515026){if(!_0x515026)throw new APINotFoundError(util[_0x3495('0xb2')](_0x3495('0x118'),_0x45870e[_0x3495('0x59')]['id']));return db['sequelize']['transaction'](function(_0x498dab){return _0x515026[_0x3495('0x119')](_0x1b54f0,{'transaction':_0x498dab})[_0x3495('0x16')](function(){return db[_0x3495('0x115')][_0x3495('0x4d')]({'where':{'id':{'$in':_0x1b54f0}}});})[_0x3495('0x16')](function(_0x2d60f5){var _0x4fe3a1=_[_0x3495('0x37')](_0x2d60f5,function(_0x2ccdaa){return _0x2ccdaa[_0x3495('0x11a')]();});return Promise[_0x3495('0x56')](_0x4fe3a1);})[_0x3495('0x16')](function(_0x27ac65){_0x3ad3f9=_[_0x3495('0x11b')](_0x27ac65);var _0x3c768b=_['map'](_0x3ad3f9,function(_0x4d973f){return _0x4d973f['addAgent'](_0x515026['id'],{'transaction':_0x498dab});});return Promise[_0x3495('0x56')](_0x3c768b);})[_0x3495('0x16')](function(){if(!_0x515026[_0x3495('0xb1')])return;var _0xb981ad=_['filter'](_0x3ad3f9,function(_0x53c21a){return _0x53c21a[_0x3495('0x11c')](_0x3495('0xa4'))==='Voice';});var _0x554b5e=_[_0x3495('0x37')](_0xb981ad,function(_0x122dbf){return db[_0x3495('0xb3')][_0x3495('0x11d')]({'membername':_0x515026['name'],'UserId':_0x515026['id'],'queue_name':_0x122dbf[_0x3495('0x3b')],'VoiceQueueId':_0x122dbf['id'],'interface':_['isNil'](_0x515026[_0x3495('0xa7')])?util[_0x3495('0xb2')](_0x3495('0xf4'),_0x515026[_0x3495('0x3b')]):_0x515026[_0x3495('0xa7')],'paused':_0x515026[_0x3495('0xa6')]||![],'penalty':_0x515026[_0x3495('0xac')]},{'transaction':_0x498dab});});return Promise[_0x3495('0x56')](_0x554b5e);})['then'](function(){return db['TeamVoicePrefix'][_0x3495('0x4d')]({'where':{'teamId':{'$in':_0x1b54f0}}});})[_0x3495('0x16')](function(_0x9588e8){var _0x1b4207=_[_0x3495('0x37')](_0x9588e8,function(_0x187368){return db[_0x3495('0x11e')]['create']({'UserId':_0x515026['id'],'VoicePrefixId':_0x187368[_0x3495('0x11f')]},{'transaction':_0x498dab});});return Promise[_0x3495('0x56')](_0x1b4207);});});})[_0x3495('0x16')](function(){for(var _0x9af37c=0x0;_0x9af37c<_0x3ad3f9[_0x3495('0x4f')];_0x9af37c++){var _0x28a54c=_0x3ad3f9[_0x9af37c][_0x3495('0x11c')](_0x3495('0xa4'));var _0x484bc4=_0x28a54c+'QueueId';socket[_0x3495('0x2b')](_0x3495('0x31')+_0x28a54c+_0x3495('0x120'),{'UserId':_0x14e27e,['queueField']:_0x3ad3f9[_0x9af37c]['id']});}})[_0x3495('0x16')](respondWithStatusCode(_0x4d6fd7,null))[_0x3495('0x57')](APIHandleError(_0x4d6fd7));};exports['removeTeams']=function(_0x5af077,_0xb46b57){var _0x32f794=_0x5af077[_0x3495('0x59')]['id'];var _0x4c0013=null;if(_0x5af077[_0x3495('0x45')]['ids']){_0x4c0013=_[_0x3495('0xb7')](_0x5af077[_0x3495('0x45')][_0x3495('0x68')])?_0x5af077[_0x3495('0x45')][_0x3495('0x68')]:[_0x5af077[_0x3495('0x45')][_0x3495('0x68')]];}var _0x574b62=[];return Promise[_0x3495('0x106')]()['then'](function(){if(!_0x4c0013)throw new APIBadRequestError(_0x3495('0x121'));})[_0x3495('0x16')](function(){return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x32f794}});})[_0x3495('0x16')](function(_0x12a164){if(!_0x12a164)throw new APINotFoundError(util[_0x3495('0xb2')](_0x3495('0x118'),_0x5af077[_0x3495('0x59')]['id']));return db[_0x3495('0x6f')][_0x3495('0x122')](function(_0x1f87e3){return _0x12a164[_0x3495('0x123')](_0x4c0013,{'transaction':_0x1f87e3})['then'](function(){return db[_0x3495('0x115')][_0x3495('0x4d')]({'where':{'id':{'$in':_0x4c0013}}});})['then'](function(_0x7f4cd1){var _0x1375ba=_[_0x3495('0x37')](_0x7f4cd1,function(_0x35f6d0){return _0x35f6d0[_0x3495('0x11a')]();});return Promise[_0x3495('0x56')](_0x1375ba);})[_0x3495('0x16')](function(_0x46ea81){_0x574b62=_[_0x3495('0x11b')](_0x46ea81);var _0x4d30fe=_[_0x3495('0x37')](_0x574b62,function(_0xac9630){return _0xac9630[_0x3495('0x124')](_0x12a164['id'],{'transaction':_0x1f87e3});});return Promise[_0x3495('0x56')](_0x4d30fe);})[_0x3495('0x16')](function(){if(!_0x12a164[_0x3495('0xb1')])return;var _0x259729=_['filter'](_0x574b62,function(_0x221259){return _0x221259[_0x3495('0x11c')](_0x3495('0xa4'))==='Voice';});var _0x4496e0=_[_0x3495('0x37')](_0x259729,function(_0x173ff8){return db[_0x3495('0xb3')][_0x3495('0x2d')]({'where':{'VoiceQueueId':_0x173ff8['id'],'UserId':_0x12a164['id']},'transaction':_0x1f87e3});});return Promise[_0x3495('0x56')](_0x4496e0);})[_0x3495('0x16')](function(){return db[_0x3495('0x125')][_0x3495('0x4d')]({'where':{'teamId':{'$in':_0x4c0013}}});})[_0x3495('0x16')](function(_0x3af096){var _0x46f312=_[_0x3495('0x37')](_0x3af096,function(_0x424078){return db[_0x3495('0x11e')][_0x3495('0x2d')]({'where':{'UserId':_0x12a164['id'],'VoicePrefixId':_0x424078['VoicePrefixId']}},{'transaction':_0x1f87e3});});return Promise[_0x3495('0x56')](_0x46f312);});});})[_0x3495('0x16')](function(){for(var _0x320cfd=0x0;_0x320cfd<_0x574b62['length'];_0x320cfd++){var _0x3da44c=_0x574b62[_0x320cfd]['getDataValue'](_0x3495('0xa4'));var _0x1a50a2=_0x3da44c+_0x3495('0xb8');socket[_0x3495('0x2b')]('user'+_0x3da44c+_0x3495('0xb9'),{'UserId':_0x32f794,['queueField']:_0x574b62[_0x320cfd]['id']});}})[_0x3495('0x16')](respondWithStatusCode(_0xb46b57,null))[_0x3495('0x57')](APIHandleError(_0xb46b57));};exports['getLists']=function(_0x5396c5,_0x403991){var _0x51ca07={};var _0x4df106={};var _0x1216ac;var _0x560636;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x5396c5['params']['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x403991,null))[_0x3495('0x16')](function(_0x224b86){if(_0x224b86){_0x1216ac=_0x224b86;_0x4df106[_0x3495('0x5f')]=_[_0x3495('0x5b')](db[_0x3495('0xd5')][_0x3495('0x3e')]);_0x4df106[_0x3495('0x45')]=_['keys'](_0x5396c5[_0x3495('0x45')]);_0x4df106[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x4df106[_0x3495('0x5f')],_0x4df106[_0x3495('0x45')]);_0x51ca07[_0x3495('0x4b')]=_[_0x3495('0x5e')](_0x4df106[_0x3495('0x5f')],qs[_0x3495('0x60')](_0x5396c5[_0x3495('0x45')]['fields']));_0x51ca07[_0x3495('0x4b')]=_0x51ca07[_0x3495('0x4b')][_0x3495('0x4f')]?_0x51ca07[_0x3495('0x4b')]:_0x4df106[_0x3495('0x5f')];_0x51ca07[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x5396c5[_0x3495('0x45')]['sort']);_0x51ca07['where']=qs[_0x3495('0x5d')](_['pick'](_0x5396c5[_0x3495('0x45')],_0x4df106[_0x3495('0x5d')]));if(_0x5396c5[_0x3495('0x45')][_0x3495('0x35')]){_0x51ca07[_0x3495('0x43')]=_[_0x3495('0x61')](_0x51ca07[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x51ca07[_0x3495('0x4b')],function(_0x417bcb){var _0xb23b27={};_0xb23b27[_0x417bcb]={'$like':'%'+_0x5396c5[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0xb23b27;})});}_0x51ca07=_[_0x3495('0x61')]({},_0x51ca07,_0x5396c5[_0x3495('0x62')]);return _0x1216ac['getLists'](_0x51ca07);}})[_0x3495('0x16')](function(_0x334d20){if(_0x334d20){_0x560636=_0x334d20[_0x3495('0x4f')];if(!_0x5396c5[_0x3495('0x45')][_0x3495('0xd4')](_0x3495('0xda'))){_0x51ca07[_0x3495('0x26')]=qs[_0x3495('0x26')](_0x5396c5[_0x3495('0x45')][_0x3495('0x26')]);_0x51ca07[_0x3495('0x24')]=qs['offset'](_0x5396c5[_0x3495('0x45')]['offset']);}return _0x1216ac[_0x3495('0x126')](_0x51ca07);}})[_0x3495('0x16')](function(_0x5ba2ab){if(_0x5ba2ab){return _0x5ba2ab?{'count':_0x560636,'rows':_0x5ba2ab}:null;}})[_0x3495('0x16')](respondWithResult(_0x403991,null))[_0x3495('0x57')](handleError(_0x403991,null));};exports['getAgents']=function(_0x7cb34a,_0x4b1443){var _0x4d789c={};var _0x2b6868={};var _0x4694db;return db[_0x3495('0x44')][_0x3495('0x9e')]({'where':{'id':_0x7cb34a['params']['id']}})[_0x3495('0x16')](handleEntityNotFound(_0x4b1443,null))['then'](function(_0x1bb6a7){if(_0x1bb6a7){_0x4694db=_0x1bb6a7;_0x2b6868[_0x3495('0x5f')]=_['keys'](db['User'][_0x3495('0x3e')]);_0x2b6868[_0x3495('0x45')]=_[_0x3495('0x5b')](_0x7cb34a[_0x3495('0x45')]);_0x2b6868[_0x3495('0x5d')]=_[_0x3495('0x5e')](_0x2b6868[_0x3495('0x5f')],_0x2b6868['query']);_0x4d789c[_0x3495('0x4b')]=_['intersection'](_0x2b6868['model'],qs['fields'](_0x7cb34a['query'][_0x3495('0x60')]));_0x4d789c[_0x3495('0x4b')]=_0x4d789c[_0x3495('0x4b')][_0x3495('0x4f')]?_0x4d789c['attributes']:_0x2b6868['model'];_0x4d789c[_0x3495('0xd1')]=qs[_0x3495('0xd2')](_0x7cb34a['query'][_0x3495('0xd2')]);_0x4d789c[_0x3495('0x43')]=qs[_0x3495('0x5d')](_[_0x3495('0xd3')](_0x7cb34a[_0x3495('0x45')],_0x2b6868['filters']));if(_0x7cb34a['query'][_0x3495('0x35')]){_0x4d789c['where']=_['merge'](_0x4d789c[_0x3495('0x43')],{'$or':_[_0x3495('0x37')](_0x4d789c[_0x3495('0x4b')],function(_0x4fb543){var _0xab92cd={};_0xab92cd[_0x4fb543]={'$like':'%'+_0x7cb34a[_0x3495('0x45')][_0x3495('0x35')]+'%'};return _0xab92cd;})});}_0x4d789c[_0x3495('0x5f')]=db['User'];_0x4d789c['as']=_0x3495('0x32');_0x4d789c=_[_0x3495('0x61')]({},_0x4d789c,_0x7cb34a['options']);return _0x4694db[_0x3495('0xfd')]({'include':[_0x4d789c]});}})[_0x3495('0x16')](function(_0x81a6f0){if(_0x81a6f0){var _0x10e02a={},_0x356d19=[];for(var _0x2ca2ad=0x0;_0x2ca2ad<_0x81a6f0['length'];_0x2ca2ad+=0x1){for(var _0x9984c0=0x0,_0x188bb2;_0x9984c0<_0x81a6f0[_0x2ca2ad][_0x3495('0x32')][_0x3495('0x4f')];_0x9984c0+=0x1){_0x188bb2=_0x81a6f0[_0x2ca2ad][_0x3495('0x32')][_0x9984c0][_0x3495('0x2e')]({'plain':!![]});_0x10e02a[_0x188bb2['id']]=_0x188bb2;}}_0x10e02a=_[_0x3495('0x127')](_0x10e02a);for(var _0x5465e3=qs[_0x3495('0x24')](_0x7cb34a[_0x3495('0x45')][_0x3495('0x24')]);_0x5465e3<_0x10e02a[_0x3495('0x4f')]&&_0x356d19[_0x3495('0x4f')]=_0xdf0e79){_0x2659e3=_0xdf0e79;_0x499a13=0xc8;}else{_0x499a13=0xce;}_0x49aaf6[_0x0445('0x22')](_0x499a13);return _0x49aaf6['set'](_0x0445('0x27'),_0x210491+'-'+_0x2659e3+'/'+_0xdf0e79)[_0x0445('0x28')](_0x195e2b);}return null;};}function saveUpdates(_0x28d4da){return function(_0x27b649){if(_0x27b649){return _0x27b649[_0x0445('0x29')](_0x28d4da)[_0x0445('0x2a')](function(_0x54d02f){socket[_0x0445('0x2b')](_0x0445('0x2c')+_0x54d02f['id'],{});return _0x54d02f;});}return null;};}function removeEntity(_0x4c5e70){return function(_0x4a7b23){if(_0x4a7b23){return _0x4a7b23['destroy']()[_0x0445('0x2a')](function(){var _0x1ad78f=_0x4a7b23['get']({'plain':!![]});if(_0x1ad78f[_0x0445('0x2d')]===_0x0445('0x2e'))return;var _0x12437e=[{'name':_0x0445('0x2f'),'value':_0x0445('0x30'),'ignore':!![]},{'name':_0x0445('0x31'),'value':_0x0445('0x32'),'ignore':![]},{'name':_0x0445('0x33'),'value':_0x0445('0x34'),'ignore':![]}];var _0x3e6dff=_(_0x12437e)[_0x0445('0x35')](_0x0445('0x36'))['map'](_0x0445('0x37'))['value']();if(_['includes'](_0x3e6dff,_0x1ad78f[_0x0445('0x2d')])){return;}var _0x40e866=_[_0x0445('0x38')](_0x12437e,['value',_0x1ad78f['role']])[_0x0445('0x39')];return db[_0x0445('0x3a')][_0x0445('0x3b')]({'where':{'type':_0x40e866,'resourceId':_0x1ad78f['id']}})['then'](function(){return _0x4a7b23;});})[_0x0445('0x2a')](function(){_0x4c5e70[_0x0445('0x22')](0xcc)[_0x0445('0x3c')]();});}};}function handleEntityNotFound(_0x5fd06b){return function(_0x14b6a6){if(!_0x14b6a6){_0x5fd06b[_0x0445('0x21')](0x194);}return _0x14b6a6;};}function handleError(_0x4cbf9e,_0x1abe55){_0x1abe55=_0x1abe55||0x1f4;return function(_0x102f13){logger[_0x0445('0x1c')](_0x102f13[_0x0445('0x3d')]);if(_0x102f13[_0x0445('0x39')]){delete _0x102f13[_0x0445('0x39')];}_0x4cbf9e[_0x0445('0x22')](_0x1abe55)['send'](_0x102f13);};}exports[_0x0445('0x3e')]=function(_0x335866,_0x211222){var _0x5afa17={},_0x4cf860={'count':0x0,'rows':[]};var _0x3a9068=_(db[_0x0445('0x3f')][_0x0445('0x40')])['map'](function(_0x5ad5c5){return{'name':_0x5ad5c5[_0x0445('0x41')],'type':_0x5ad5c5[_0x0445('0x42')][_0x0445('0x43')]};})[_0x0445('0x35')](function(_0x45629f){return!_[_0x0445('0x44')]([_0x0445('0x45'),_0x0445('0x46')],_0x45629f['name']);})[_0x0445('0x37')]();_0x5afa17=qs['getOptions'](_0x3a9068,_0x335866);var _0x4a96fe={'where':_0x5afa17['where']};return db[_0x0445('0x3f')][_0x0445('0x26')](_0x4a96fe)[_0x0445('0x2a')](function(_0x54470a){_0x4cf860[_0x0445('0x26')]=_0x54470a;if(_0x335866['query'][_0x0445('0x47')]){_0x5afa17[_0x0445('0x48')]=[{'all':!![]}];}if(_0x335866[_0x0445('0x49')][_0x0445('0x4a')]===_0x0445('0x4b')){_0x5afa17[_0x0445('0x48')]=[{'model':db[_0x0445('0x4c')],'as':_0x0445('0x4a')}];}if(!_[_0x0445('0x44')](_0x5afa17[_0x0445('0x4d')],'id')){_0x5afa17[_0x0445('0x4d')][_0x0445('0x4e')]('id');}return db[_0x0445('0x3f')][_0x0445('0x4f')](_0x5afa17);})[_0x0445('0x2a')](function(_0x24b8cf){_0x4cf860['rows']=_0x24b8cf;if(_0x335866[_0x0445('0x49')][_0x0445('0x50')]==='true'){var _0x6564d8=[];for(var _0x5438ec=0x0;_0x5438ec<_0x4cf860['rows'][_0x0445('0x51')];_0x5438ec++){_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8['push'](get_open_tabs('sms',_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8['push'](get_open_tabs(_0x0445('0x55'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x4cf860[_0x0445('0x53')][_0x5438ec]['dataValues']));_0x6564d8['push'](get_open_tabs(_0x0445('0x57'),_0x4cf860['rows'][_0x5438ec][_0x0445('0x54')]));_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x58'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));}return BPromise[_0x0445('0x59')](_0x6564d8)[_0x0445('0x2a')](function(){return _0x4cf860;});}else{return _0x4cf860;}})[_0x0445('0x2a')](respondWithFilteredResult(_0x211222,_0x5afa17))[_0x0445('0x20')](handleError(_0x211222,null));};exports[_0x0445('0x5a')]=function(_0x468bea,_0x140168){var _0x504f52={'raw':![],'where':{'id':_0x468bea[_0x0445('0x5b')]['id']}},_0x5a7f42={};_0x5a7f42[_0x0445('0x5c')]=_['differenceBy'](_[_0x0445('0x5d')](db[_0x0445('0x3f')][_0x0445('0x40')]),['password',_0x0445('0x46')]);_0x5a7f42[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x468bea['query']);_0x5a7f42[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x5a7f42['model'],_0x5a7f42[_0x0445('0x49')]);_0x504f52[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x5a7f42[_0x0445('0x5c')],qs['fields'](_0x468bea[_0x0445('0x49')][_0x0445('0x60')]));_0x504f52[_0x0445('0x4d')]=_0x504f52[_0x0445('0x4d')]['length']?_0x504f52[_0x0445('0x4d')]:_0x5a7f42['model'];if(_0x468bea[_0x0445('0x49')]['includeAll']){_0x504f52[_0x0445('0x48')]=[{'all':!![]}];}if(_0x468bea[_0x0445('0x49')][_0x0445('0x4a')]===_0x0445('0x4b')){_0x504f52['include']=[{'model':db[_0x0445('0x4c')],'as':_0x0445('0x4a')}];}_0x504f52=_['merge']({},_0x504f52,_0x468bea[_0x0445('0x61')]);if(!_[_0x0445('0x44')](_0x504f52['attributes'],'id')){_0x504f52[_0x0445('0x4d')][_0x0445('0x4e')]('id');}return db[_0x0445('0x3f')][_0x0445('0x38')](_0x504f52)['then'](handleEntityNotFound(_0x140168,null))[_0x0445('0x2a')](function(_0x1e06f2){var _0x30477f=[];values=_0x1e06f2;if(_0x468bea['query'][_0x0445('0x50')]===_0x0445('0x4b')){_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x1e06f2['dataValues']));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x62'),_0x1e06f2[_0x0445('0x54')]));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x57'),_0x1e06f2[_0x0445('0x54')]));_0x30477f['push'](get_open_tabs(_0x0445('0x58'),_0x1e06f2[_0x0445('0x54')]));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x55'),_0x1e06f2['dataValues']));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x1e06f2[_0x0445('0x54')]));return BPromise['all'](_0x30477f);}else{return values;}})[_0x0445('0x2a')](function(){return values;})[_0x0445('0x2a')](respondWithResult(_0x140168,null))[_0x0445('0x20')](handleError(_0x140168,null));};exports[_0x0445('0x29')]=function(_0x3db4a3,_0x5436ec){if(_0x3db4a3['body']['id']){delete _0x3db4a3[_0x0445('0x63')]['id'];}delete _0x3db4a3[_0x0445('0x63')][_0x0445('0x2d')];return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3db4a3[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x5436ec,null))[_0x0445('0x2a')](saveUpdates(_0x3db4a3[_0x0445('0x63')],null))[_0x0445('0x2a')](respondWithResult(_0x5436ec,null))[_0x0445('0x20')](handleError(_0x5436ec,null));};exports['describe']=function(_0x57eec5,_0x533037){return db[_0x0445('0x3f')][_0x0445('0x64')]()[_0x0445('0x2a')](respondWithResult(_0x533037,null))['catch'](handleError(_0x533037,null));};exports[_0x0445('0x65')]=function(_0x203b66,_0x8ff745){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x203b66['params']['id']}})['then'](handleEntityNotFound(_0x8ff745,null))[_0x0445('0x2a')](function(_0xf8837c){if(_0xf8837c){return _0xf8837c[_0x0445('0x65')](_0x203b66[_0x0445('0x63')][_0x0445('0x66')],_['omit'](_0x203b66[_0x0445('0x63')],[_0x0445('0x66'),'id'])||{});}})['then'](respondWithResult(_0x8ff745,null))[_0x0445('0x20')](handleError(_0x8ff745,null));};function validateUser(_0x40fcaf){return new BPromise(function(_0x2d1575,_0x1f416b){if(_0x40fcaf[_0x0445('0x67')])return _0x2d1575(_0x40fcaf);return db['Setting'][_0x0445('0x68')](0x1)['then'](function(_0x156478){if(_0x156478[_0x0445('0x69')])authService['validatePasswordPattern'](_0x40fcaf[_0x0445('0x45')]);db[_0x0445('0x3f')][_0x0445('0x6a')](_0x0445('0x67'))[_0x0445('0x2a')](function(_0x1d7fb7){if(_[_0x0445('0x6b')](_0x1d7fb7)){_0x40fcaf['internal']=_0x156478[_0x0445('0x6c')]||0x1;return;}if(_['isNil'](_0x156478[_0x0445('0x6c')])||_0x156478[_0x0445('0x6c')]===_0x1d7fb7){_0x40fcaf['internal']=_0x1d7fb7+0x1;return;}if(_0x156478['min_internal']>_0x1d7fb7){_0x40fcaf[_0x0445('0x67')]=_0x156478[_0x0445('0x6c')];return;}return db[_0x0445('0x6d')]['query'](_0x0445('0x6e'),{'type':db['sequelize']['QueryTypes'][_0x0445('0x6f')]})[_0x0445('0x2a')](function(_0x141459){if(_0x141459&&_0x141459['length']){for(var _0x64bafa=0x0,_0x8c05d5=_0x141459['length'];_0x64bafa<_0x8c05d5&&_['isNil'](_0x40fcaf[_0x0445('0x67')]);_0x64bafa++){if(_0x156478[_0x0445('0x6c')]<=_0x141459[_0x64bafa][_0x0445('0x70')]){_0x40fcaf[_0x0445('0x67')]=_0x141459[_0x64bafa]['from'];}else if(_0x156478[_0x0445('0x6c')]>_0x141459[_0x64bafa][_0x0445('0x70')]&&_0x156478[_0x0445('0x6c')]<=_0x141459[_0x64bafa]['to']){_0x40fcaf['internal']=_0x156478[_0x0445('0x6c')];}}}if(_['isNil'](_0x40fcaf[_0x0445('0x67')])){_0x40fcaf[_0x0445('0x67')]=_0x1d7fb7+0x1;}return _0x2d1575(_0x40fcaf);});});})[_0x0445('0x20')](function(_0x537767){_0x1f416b(_0x537767);});});}function updateUser(_0xfa63d){return new BPromise(function(_0x358822,_0x14bc90){try{if(_0xfa63d[_0x0445('0x71')]){_0xfa63d[_0x0445('0x72')]=_0xfa63d['internal'];_0xfa63d[_0x0445('0x73')]={'mailbox':_0xfa63d['internal'],'password':_0xfa63d[_0x0445('0x45')],'fullname':_0xfa63d[_0x0445('0x74')],'email':_0xfa63d[_0x0445('0x75')]};}if(_0xfa63d['role']===_0x0445('0x32')){if(!_0xfa63d[_0x0445('0x76')])_0xfa63d[_0x0445('0x76')]=[_0x0445('0x77'),_0x0445('0x78'),'103','113',_0x0445('0x79'),'104',_0x0445('0x7a'),_0x0445('0x7b'),_0x0445('0x7c'),_0x0445('0x7d'),_0x0445('0x7e'),'100',_0x0445('0x7f'),_0x0445('0x80'),_0x0445('0x81')];}_0x358822(_0xfa63d);}catch(_0x527af3){_0x14bc90(_0x527af3);}});}exports[_0x0445('0x82')]=function(_0x32af1c,_0x283686){if(_0x32af1c['user'][_0x0445('0x2d')]==='agent')throw new Error('Unauthorized');if(_0x32af1c['body']['role']==='user'&&_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!==_0x0445('0x2e')){throw new Error(_0x0445('0x83'));}if(_0x32af1c['body'][_0x0445('0x2d')]==='admin'&&_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!=='admin'){throw new Error(_0x0445('0x84'));}return licenseUtil[_0x0445('0x85')]([_0x32af1c[_0x0445('0x63')]])[_0x0445('0x2a')](function(){return validateUser(_0x32af1c[_0x0445('0x63')]);})['then'](function(_0x51eeea){return updateUser(_0x51eeea)[_0x0445('0x2a')](function(_0x3960a9){if(_0x3960a9[_0x0445('0x2d')]==='admin'){_0x3960a9[_0x0445('0x86')]=_0x32af1c['user'][_0x0445('0x86')];delete _0x3960a9[_0x0445('0x87')];}return _0x3960a9;});})['then'](function(_0x5513f4){return db[_0x0445('0x3f')][_0x0445('0x82')](_0x5513f4,{'include':[{'model':db[_0x0445('0x73')],'as':'VoiceMail'}]});})[_0x0445('0x2a')](function(_0x17a094){if(_0x32af1c[_0x0445('0x63')]['role']===_0x0445('0x30'))return _0x17a094;if(_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!==_0x0445('0x30'))return _0x17a094;return db[_0x0445('0x88')]['find']({'where':{'name':_0x17a094[_0x0445('0x2d')]===_0x0445('0x32')?_0x0445('0x31'):_0x0445('0x33'),'userProfileId':_0x32af1c[_0x0445('0x30')]['userProfileId']},'raw':!![]})[_0x0445('0x2a')](function(_0x5ad0f9){if(!_0x5ad0f9||_0x5ad0f9['autoAssociation']!=0x0)return _0x17a094;return db['UserProfileResource'][_0x0445('0x82')]({'name':_0x17a094['name'],'resourceId':_0x17a094['id'],'type':_0x5ad0f9[_0x0445('0x39')],'sectionId':_0x5ad0f9['id']},{})[_0x0445('0x2a')](function(){return _0x17a094;});})[_0x0445('0x20')](function(_0x10e81c){logger[_0x0445('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10e81c);throw _0x10e81c;});})[_0x0445('0x2a')](respondWithResult(_0x283686,0xc9))['catch'](handleError(_0x283686,null));};exports[_0x0445('0x89')]=function(_0x69dc37,_0x54d904){var _0x3cc4b1=_0x69dc37[_0x0445('0x63')];var _0x3fa221=[];if(_0x69dc37[_0x0445('0x30')]['role']===_0x0445('0x32'))throw new Error(_0x0445('0x8a'));if(_['some'](_0x3cc4b1,[_0x0445('0x2d'),_0x0445('0x30')])&&_0x69dc37['user'][_0x0445('0x2d')]!=='admin'){throw new Error(_0x0445('0x83'));}if(_[_0x0445('0x8b')](_0x3cc4b1,['role',_0x0445('0x2e')])&&_0x69dc37[_0x0445('0x30')]['role']!==_0x0445('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x0445('0x85')](_0x3cc4b1)[_0x0445('0x2a')](function(){return validateUser(_0x3cc4b1[0x0]);})[_0x0445('0x2a')](function(){for(var _0x57f7fc=0x1;_0x57f7fc<_0x3cc4b1[_0x0445('0x51')];_0x57f7fc++){var _0x35ffad=_0x3cc4b1[_0x57f7fc-0x1][_0x0445('0x67')];if(!_0x3cc4b1[_0x57f7fc][_0x0445('0x67')])_0x3cc4b1[_0x57f7fc][_0x0445('0x67')]=_0x35ffad+0x1;_0x3fa221[_0x0445('0x4e')](validateUser(_0x3cc4b1[_0x57f7fc]));}return BPromise[_0x0445('0x59')](_0x3fa221);})[_0x0445('0x2a')](function(){_0x3fa221=[];for(var _0x9bf9ff=0x0;_0x9bf9ff<_0x3cc4b1[_0x0445('0x51')];_0x9bf9ff++){_0x3fa221[_0x0445('0x4e')](updateUser(_0x3cc4b1[_0x9bf9ff]));}return BPromise[_0x0445('0x59')](_0x3fa221);})['then'](function(){return BPromise[_0x0445('0x8c')](_0x3cc4b1,function(_0x1a1cc1){return db[_0x0445('0x3f')][_0x0445('0x82')](_0x1a1cc1,{'include':[{'model':db['VoiceMail'],'as':_0x0445('0x73')}]})[_0x0445('0x2a')](function(_0x387cba){_0x1a1cc1['id']=_0x387cba['id'];return _0x1a1cc1;});});})[_0x0445('0x2a')](function(_0x37b2c9){if(_0x69dc37['body'][_0x0445('0x2d')]===_0x0445('0x30'))return _0x37b2c9;if(_0x69dc37[_0x0445('0x30')]['role']!==_0x0445('0x30'))return _0x37b2c9;var _0xaf0804=_[_0x0445('0x8b')](_0x37b2c9,function(_0xeba198){return _0xeba198[_0x0445('0x2d')]==='agent'||_0xeba198[_0x0445('0x2d')]==='telephone';});if(!_0xaf0804)return _0x37b2c9;return db['UserProfileSection'][_0x0445('0x4f')]({'where':{'name':{'$or':[_0x0445('0x31'),'Telephones']},'userProfileId':_0x69dc37['user']['userProfileId']},'raw':!![]})[_0x0445('0x2a')](function(_0x396261){if(_[_0x0445('0x8d')](_0x396261)||!_['some'](_0x396261,[_0x0445('0x8e'),0x0]))return _0x37b2c9;_0x3fa221=[];var _0x359e60=_(_0x396261)[_0x0445('0x8f')](function(_0x4d89e2){if(_0x4d89e2[_0x0445('0x8e')]===0x1)return;return _0x4d89e2[_0x0445('0x39')]===_0x0445('0x31')?_0x0445('0x32'):_0x0445('0x34');})['compact']()[_0x0445('0x37')]();for(var _0x472221=0x0;_0x472221<_0x37b2c9['length'];_0x472221++){if(!_[_0x0445('0x44')](_0x359e60,_0x37b2c9[_0x472221][_0x0445('0x2d')]))return;var _0x29767d=_0x37b2c9[_0x472221][_0x0445('0x2d')]===_0x0445('0x32')?'Agents':_0x0445('0x33');_0x3fa221[_0x0445('0x4e')](db['UserProfileResource'][_0x0445('0x82')]({'name':_0x37b2c9[_0x472221]['name'],'resourceId':_0x37b2c9[_0x472221]['id'],'type':_0x29767d,'sectionId':_[_0x0445('0x38')](_0x396261,['name',_0x29767d])['id']},{}));}return BPromise[_0x0445('0x59')](_0x3fa221);});})[_0x0445('0x2a')](respondWithResult(_0x54d904,0xc9))[_0x0445('0x20')](handleError(_0x54d904,null));};exports[_0x0445('0x90')]=function(_0x33e08e,_0x589a72){if(_0x33e08e[_0x0445('0x63')]['id']){delete _0x33e08e[_0x0445('0x63')]['id'];}return db['User'][_0x0445('0x38')]({'where':{'id':_0x33e08e[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](function(_0x2d1852){if(!_0x2d1852)return null;if(_0x2d1852['id']===_0x33e08e[_0x0445('0x30')]['id']){if(!_0x33e08e[_0x0445('0x63')][_0x0445('0x91')]||!_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x95'));}if(!_0x2d1852['authenticate'](_0x33e08e[_0x0445('0x63')][_0x0445('0x91')])){throw new db[(_0x0445('0x93'))]['ValidationError'](_0x0445('0x96'));}if(_0x33e08e['body'][_0x0445('0x91')]===_0x33e08e[_0x0445('0x63')]['newPassword']){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x97'));}}else if(_0x33e08e[_0x0445('0x30')][_0x0445('0x2d')]==='admin'){if(!_0x33e08e['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0x0445('0x98'));}}else if(_0x33e08e[_0x0445('0x30')][_0x0445('0x2d')]===_0x0445('0x30')){if(!_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]){throw new db[(_0x0445('0x93'))]['ValidationError'](_0x0445('0x98'));}if(_0x2d1852[_0x0445('0x2d')]!==_0x0445('0x32')){throw new db['Sequelize'][(_0x0445('0x94'))]('Unauthorized');}}else{throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x8a'));}return _0x2d1852;})[_0x0445('0x2a')](handleEntityNotFound(_0x589a72,null))[_0x0445('0x2a')](function(_0x43b88f){return db[_0x0445('0x99')][_0x0445('0x9a')]({'attributes':['id','securePassword',_0x0445('0x9b'),_0x0445('0x9c')]})[_0x0445('0x2a')](function(_0x1150e7){if(_0x1150e7['securePassword'])authService[_0x0445('0x9d')](_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]);if(!_0x1150e7['enforcePasswordHistory']||!_0x43b88f[_0x0445('0x9e')])return _0x43b88f;authService[_0x0445('0x9f')](_0x33e08e[_0x0445('0x63')][_0x0445('0x92')],_0x43b88f['previousPasswords'],_0x1150e7[_0x0445('0x9c')]);return _0x43b88f;})['then'](saveUpdates({'password':_0x33e08e[_0x0445('0x63')][_0x0445('0x92')],'passwordResetAt':_0x33e08e[_0x0445('0x30')]['id']==_0x33e08e[_0x0445('0x5b')]['id']?moment():null,'previousPasswords':authService[_0x0445('0xa0')](_0x33e08e[_0x0445('0x63')]['newPassword'],_0x43b88f['previousPasswords'])},null));})[_0x0445('0x2a')](respondWithResult(_0x589a72,null))[_0x0445('0x20')](handleError(_0x589a72,null));};exports[_0x0445('0xa1')]=function(_0x3a20e9,_0x13ac6d){var _0x4e8f1d=_0x3a20e9[_0x0445('0x63')][_0x0445('0xa2')];return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3a20e9[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),_0x0445('0xa3'),_0x0445('0xa4'),_0x0445('0xa5'),_0x0445('0xa6')]})['then'](handleEntityNotFound(_0x13ac6d,null))[_0x0445('0x2a')](function(_0x250a31){if(_0x250a31){if(!utils[_0x0445('0xa7')](_0x4e8f1d)){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}return _0x250a31[_0x0445('0xa9')+_[_0x0445('0xaa')](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xac')](_0x3a20e9[_0x0445('0x63')]['ids'],{'penalty':_0x3a20e9[_0x0445('0x63')][_0x0445('0xad')]||0x0})[_0x0445('0xae')](function(_0x109921){for(var _0xa731a1=0x0;_0xa731a1<_0x3a20e9[_0x0445('0x63')][_0x0445('0x66')][_0x0445('0x51')];_0xa731a1+=0x1){var _0x3717f0={'UserId':Number(_0x3a20e9['params']['id'])};_0x3717f0[_['capitalize'](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xaf')]=Number(_0x3a20e9[_0x0445('0x63')][_0x0445('0x66')][_0xa731a1]);socket['emit'](_0x0445('0x30')+_[_0x0445('0xaa')](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xb0'),_0x3717f0);}return _0x109921;})[_0x0445('0x2a')](function(){if(_0x4e8f1d===_0x0445('0xb1')){return db['VoiceQueue'][_0x0445('0x4f')]({'where':{'id':_0x3a20e9['body'][_0x0445('0x66')]||[]},'raw':!![],'attributes':['id',_0x0445('0x39')]});}})[_0x0445('0x2a')](function(_0x202afe){var _0x4d0f08=_0x250a31[_0x0445('0xb2')]({'plain':!![]});var _0x293eee=[];if(_0x4e8f1d==='voice'&&_0x4d0f08['role']==='agent'&&_0x4d0f08['online']){for(var _0x26268d=0x0;_0x26268d<_0x202afe['length'];_0x26268d+=0x1){_0x293eee['push']({'membername':_0x4d0f08[_0x0445('0x39')],'UserId':_0x4d0f08['id'],'queue_name':_0x202afe[_0x26268d][_0x0445('0x39')],'VoiceQueueId':_0x202afe[_0x26268d]['id'],'interface':_['isNil'](_0x4d0f08['interface'])?util['format'](_0x0445('0xb3'),_0x4d0f08[_0x0445('0x39')]):_0x4d0f08[_0x0445('0xa6')],'paused':_0x4d0f08[_0x0445('0xa5')]||![],'penalty':_0x3a20e9[_0x0445('0x63')][_0x0445('0xad')]||0x0});}return BPromise[_0x0445('0x8c')](_0x293eee,function(_0x44fe37){return db[_0x0445('0xb4')]['upsert'](_0x44fe37);});}return _0x250a31;});}})[_0x0445('0x2a')](respondWithStatusCode(_0x13ac6d,null))[_0x0445('0x20')](handleError(_0x13ac6d,null));};exports['removeQueues']=function(_0xf79cd3,_0x175944){var _0x4d470a,_0x531b98;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0xf79cd3['params']['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x175944,null))['then'](function(_0xbff0db){if(_0xbff0db){_0x4d470a=_0xbff0db;if(!_0xf79cd3['query'][_0x0445('0xa2')]||!utils[_0x0445('0xa7')](_0xf79cd3[_0x0445('0x49')]['channel'])){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}return _0xbff0db['remove'+_['capitalize'](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')][_0x0445('0xab')]())+_0x0445('0xac')](_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')]);}})['then'](function(_0x46b6f8){if(_[_0x0445('0xb5')](_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')])){for(var _0x507627=0x0;_0x507627<_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')][_0x0445('0x51')];_0x507627+=0x1){_0x531b98={'UserId':Number(_0xf79cd3[_0x0445('0x5b')]['id'])};_0x531b98[_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')]['channel']['toLowerCase']())+'QueueId']=Number(_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')][_0x507627]);socket['emit'](_0x0445('0x30')+_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')][_0x0445('0xab')]())+_0x0445('0xb6'),_0x531b98);}}else{_0x531b98={'UserId':Number(_0xf79cd3[_0x0445('0x5b')]['id'])};_0x531b98[_['capitalize'](_0xf79cd3[_0x0445('0x49')]['channel'][_0x0445('0xab')]())+'QueueId']=Number(_0xf79cd3['query'][_0x0445('0x66')]);socket[_0x0445('0x2b')](_0x0445('0x30')+_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')]['toLowerCase']())+'Queue:remove',_0x531b98);}return _0x46b6f8;})['then'](function(){if(_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')]===_0x0445('0xb1')){return db[_0x0445('0xb4')]['destroy']({'where':{'UserId':_0xf79cd3[_0x0445('0x5b')]['id'],'VoiceQueueId':_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')]},'individualHooks':!![]})[_0x0445('0x2a')](function(){return _0x4d470a;});}return _0x4d470a;})['then'](respondWithStatusCode(_0x175944,null))[_0x0445('0x20')](handleError(_0x175944,null));};exports['addAvatar']=function(_0x4a3cc9,_0x2a7637){_0x4a3cc9[_0x0445('0x63')][_0x0445('0xb7')]=_0x4a3cc9[_0x0445('0xb8')]['filename'];return db[_0x0445('0x3f')]['find']({'where':{'id':_0x4a3cc9[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2a7637,null))[_0x0445('0x2a')](saveUpdates(_0x4a3cc9['body'],null))[_0x0445('0x2a')](respondWithResult(_0x2a7637,null))[_0x0445('0x20')](handleError(_0x2a7637,null));};exports[_0x0445('0xb9')]=function(_0x3fa55e,_0x56a732){var _0x39e521=path['join'](config[_0x0445('0xba')],_0x0445('0xbb'));return db[_0x0445('0x3f')]['find']({'where':{'id':_0x3fa55e[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0xb7')],'raw':!![]})[_0x0445('0x2a')](handleEntityNotFound(_0x56a732,null))[_0x0445('0x2a')](function(_0x4f20d6){if(_0x4f20d6){if(_[_0x0445('0x6b')](_0x4f20d6[_0x0445('0xb7')])){return _0x56a732['download'](_0x39e521);}else{if(!fs[_0x0445('0xbc')](path['join'](config[_0x0445('0xba')],_0x0445('0xbd'),_0x4f20d6[_0x0445('0xb7')]))){return _0x56a732[_0x0445('0xbe')](_0x39e521);}return _0x56a732['download'](path[_0x0445('0xbf')](config[_0x0445('0xba')],_0x0445('0xbd'),_0x4f20d6[_0x0445('0xb7')]));}}})['catch'](handleError(_0x56a732,null));};exports['getOpenTabs']=function(_0x3a9249,_0x599f99){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3a9249[_0x0445('0x5b')]['id']},'attributes':['id']})[_0x0445('0x2a')](handleEntityNotFound(_0x599f99,null))['then'](function(_0x41db05){var _0x263f4b=[];values=_0x41db05[_0x0445('0x54')];_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x41db05['dataValues']));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x62'),_0x41db05[_0x0445('0x54')]));_0x263f4b['push'](get_open_tabs('openchannel',_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x58'),_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x55'),_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x41db05[_0x0445('0x54')]));return BPromise[_0x0445('0x59')](_0x263f4b);})['then'](function(_0x1cde52){if(_0x1cde52){var _0x2f2f1f=_[_0x0445('0x8f')](values[_0x0445('0xc0')],function(_0x473026){return{'channel':_0x0445('0xc1'),'id':_0x473026['id'],'createdAt':_0x473026[_0x0445('0xc2')]};});var _0x1939d2=_[_0x0445('0x8f')](values[_0x0445('0xc3')],function(_0x4e3fb8){return{'channel':_0x0445('0xc4'),'id':_0x4e3fb8['id'],'createdAt':_0x4e3fb8[_0x0445('0xc2')]};});var _0x195ad9=_[_0x0445('0x8f')](values[_0x0445('0xc5')],function(_0x47de4e){return{'channel':'OPENCHANNEL','id':_0x47de4e['id'],'createdAt':_0x47de4e[_0x0445('0xc2')]};});var _0x118512=_[_0x0445('0x8f')](values[_0x0445('0xc6')],function(_0x23a1c0){return{'channel':_0x0445('0xc7'),'id':_0x23a1c0['id'],'createdAt':_0x23a1c0['createdAt']};});var _0x1dab85=_['map'](values[_0x0445('0xc8')],function(_0x1dde2b){return{'channel':_0x0445('0xc9'),'id':_0x1dde2b['id'],'createdAt':_0x1dde2b[_0x0445('0xc2')]};});var _0x289e17=_[_0x0445('0x8f')](values[_0x0445('0xca')],function(_0x305560){return{'channel':_0x0445('0xcb'),'id':_0x305560['id'],'createdAt':_0x305560['createdAt']};});var _0x53ea7f=_[_0x0445('0xcc')](_0x2f2f1f,_0x1939d2,_0x195ad9,_0x118512,_0x1dab85,_0x289e17);var _0x6b190d={'count':_0x53ea7f[_0x0445('0x51')],'rows':_0x53ea7f};return _0x6b190d;}else return null;})[_0x0445('0x2a')](respondWithResult(_0x599f99,null))['catch'](handleError(_0x599f99,null));};exports[_0x0445('0xcd')]=function(_0x3668c5,_0x2c4ed6){var _0x4fa63a={};var _0x29aa64={};var _0x24dd39;var _0x1872b3;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x3668c5[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2c4ed6,null))[_0x0445('0x2a')](function(_0x76d6ef){if(_0x76d6ef){_0x24dd39=_0x76d6ef;_0x29aa64[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xce')]['rawAttributes']);_0x29aa64[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x3668c5['query']);_0x29aa64[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x29aa64['model'],_0x29aa64[_0x0445('0x49')]);_0x4fa63a['attributes']=_[_0x0445('0x5f')](_0x29aa64[_0x0445('0x5c')],qs['fields'](_0x3668c5['query']['fields']));_0x4fa63a['attributes']=_0x4fa63a['attributes'][_0x0445('0x51')]?_0x4fa63a[_0x0445('0x4d')]:_0x29aa64['model'];_0x4fa63a[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x3668c5[_0x0445('0x49')][_0x0445('0xd0')]);_0x4fa63a[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x3668c5['query'],_0x29aa64[_0x0445('0x5e')]));if(_0x3668c5[_0x0445('0x49')][_0x0445('0x35')]){_0x4fa63a[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x4fa63a[_0x0445('0xd1')],{'$or':_['map'](_0x4fa63a[_0x0445('0x4d')],function(_0xe12ffe){var _0x2483eb={};_0x2483eb[_0xe12ffe]={'$like':'%'+_0x3668c5[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x2483eb;})});}_0x4fa63a=_[_0x0445('0xd2')]({},_0x4fa63a,_0x3668c5[_0x0445('0x61')]);return _0x24dd39[_0x0445('0xcd')](_0x4fa63a);}})['then'](function(_0x589d30){if(_0x589d30){_0x1872b3=_0x589d30[_0x0445('0x51')];if(_0x3668c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0x47'))){_0x4fa63a[_0x0445('0x48')]=[{'model':db['CmList'],'as':_0x0445('0xd4'),'required':![]},{'model':db['Tag'],'as':_0x0445('0xd5'),'attributes':['id','name',_0x0445('0xd6')],'where':_0x3668c5[_0x0445('0x49')][_0x0445('0xd7')]?{'id':_0x3668c5['query'][_0x0445('0xd7')]}:undefined,'required':_0x3668c5['query']['tag']?!![]:![]}];}if(!_0x3668c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x4fa63a[_0x0445('0x24')]=qs['limit'](_0x3668c5[_0x0445('0x49')][_0x0445('0x24')]);_0x4fa63a[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x3668c5[_0x0445('0x49')]['offset']);}return _0x24dd39['getContacts'](_0x4fa63a);}})['then'](function(_0x3f3bcf){if(_0x3f3bcf){return _0x3f3bcf?{'count':_0x1872b3,'rows':_0x3f3bcf}:null;}})[_0x0445('0x2a')](respondWithResult(_0x2c4ed6,null))[_0x0445('0x20')](handleError(_0x2c4ed6,null));};exports[_0x0445('0xd9')]=function(_0x12a9c5,_0x5dbd7a){var _0x12931e;var _0x121801={};var _0x2964bd;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x12a9c5[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x5dbd7a,null))['then'](function(_0x473378){if(!utils[_0x0445('0xa7')](_0x12a9c5['query'][_0x0445('0xa2')])){throw new db[(_0x0445('0x93'))]['ValidationError']('Unknown\x20channel');}_0x12931e=_0x473378;var _0xe35c93={};_0xe35c93[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')]['channel'])+_0x0445('0xda')][_0x0445('0x40')]);_0xe35c93[_0x0445('0x49')]=_['keys'](_0x12a9c5['query']);_0xe35c93[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0xe35c93[_0x0445('0x5c')],_0xe35c93[_0x0445('0x49')]);_0x121801[_0x0445('0x4d')]=_['intersection'](_0xe35c93[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x12a9c5[_0x0445('0x49')][_0x0445('0x60')]));_0x121801[_0x0445('0x4d')]=_0x121801[_0x0445('0x4d')][_0x0445('0x51')]?_0x121801[_0x0445('0x4d')]:_0xe35c93['model'];_0x121801[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x12a9c5['query']['sort']);_0x121801[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x12a9c5['query'],_0xe35c93['filters']));if(_0x12a9c5[_0x0445('0x49')][_0x0445('0x35')]){_0x121801[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x121801['where'],{'$or':_['map'](_0x121801['attributes'],function(_0x2aeb0d){var _0x2b6d06={};_0x2b6d06[_0x2aeb0d]={'$like':'%'+_0x12a9c5['query']['filter']+'%'};return _0x2b6d06;})});}_0x121801=_[_0x0445('0xd2')]({},_0x121801,_0x12a9c5[_0x0445('0x61')]);switch(_0x12931e[_0x0445('0x2d')]){case'admin':return db[_['capitalize'](_0x12a9c5['query']['channel'])+_0x0445('0xda')][_0x0445('0x4f')](_0x121801);case _0x0445('0x30'):case _0x0445('0x32'):return _0x12931e[_0x0445('0xb2')+_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')][_0x0445('0xa2')])+_0x0445('0xac')](_0x121801);default:throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))]('Unknown\x20role');}})[_0x0445('0x2a')](function(_0x568aa1){_0x2964bd=_0x568aa1[_0x0445('0x51')];if(!_0x12a9c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x121801[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x12a9c5['query'][_0x0445('0x24')]);_0x121801[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x12a9c5['query'][_0x0445('0x23')]);}switch(_0x12931e['role']){case _0x0445('0x2e'):return db[_[_0x0445('0xaa')](_0x12a9c5['query'][_0x0445('0xa2')])+_0x0445('0xda')]['findAll'](_0x121801);case'user':case _0x0445('0x32'):return _0x12931e[_0x0445('0xb2')+_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')][_0x0445('0xa2')])+_0x0445('0xac')](_0x121801);}})['then'](function(_0x375f46){return{'count':_0x2964bd,'rows':_0x375f46};})[_0x0445('0x2a')](respondWithResult(_0x5dbd7a,null))[_0x0445('0x20')](handleError(_0x5dbd7a,null));};exports[_0x0445('0xdc')]=function(_0x2f30cf,_0x29037e){var _0x3e0ed4={};var _0x38617={};var _0xa5f950;var _0x32bcf8;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x2f30cf[_0x0445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x29037e,null))[_0x0445('0x2a')](function(_0x2685ab){if(_0x2685ab){_0xa5f950=_0x2685ab;_0x38617['model']=_[_0x0445('0x5d')](db[_0x0445('0xb4')][_0x0445('0x40')]);_0x38617['query']=_[_0x0445('0x5d')](_0x2f30cf['query']);_0x38617['filters']=_[_0x0445('0x5f')](_0x38617[_0x0445('0x5c')],_0x38617['query']);_0x3e0ed4[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x38617[_0x0445('0x5c')],qs['fields'](_0x2f30cf[_0x0445('0x49')][_0x0445('0x60')]));_0x3e0ed4[_0x0445('0x4d')]=_0x3e0ed4['attributes'][_0x0445('0x51')]?_0x3e0ed4[_0x0445('0x4d')]:_0x38617[_0x0445('0x5c')];_0x3e0ed4[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x2f30cf[_0x0445('0x49')][_0x0445('0xd0')]);_0x3e0ed4[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x2f30cf['query'],_0x38617[_0x0445('0x5e')]));if(_0x2f30cf[_0x0445('0x49')][_0x0445('0x35')]){_0x3e0ed4[_0x0445('0xd1')]=_['merge'](_0x3e0ed4['where'],{'$or':_['map'](_0x3e0ed4[_0x0445('0x4d')],function(_0x7202e8){var _0x58770b={};_0x58770b[_0x7202e8]={'$like':'%'+_0x2f30cf[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x58770b;})});}_0x3e0ed4=_[_0x0445('0xd2')]({},_0x3e0ed4,_0x2f30cf['options']);return _0xa5f950[_0x0445('0xdc')](_0x3e0ed4);}})['then'](function(_0x551835){if(_0x551835){_0x32bcf8=_0x551835['length'];if(!_0x2f30cf[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x3e0ed4['limit']=qs[_0x0445('0x24')](_0x2f30cf['query'][_0x0445('0x24')]);_0x3e0ed4[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x2f30cf[_0x0445('0x49')][_0x0445('0x23')]);}return _0xa5f950[_0x0445('0xdc')](_0x3e0ed4);}})['then'](function(_0x3e3ba7){if(_0x3e3ba7){return _0x3e3ba7?{'count':_0x32bcf8,'rows':_0x3e3ba7}:null;}})[_0x0445('0x2a')](respondWithResult(_0x29037e,null))[_0x0445('0x20')](handleError(_0x29037e,null));};exports[_0x0445('0xdd')]=function(_0x580bbd,_0x1a1152){var _0x4b0fa9={};var _0x469afc={};var _0x56d16d;var _0x480f44;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x580bbd[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x1a1152,null))[_0x0445('0x2a')](function(_0x4e186e){if(_0x4e186e){_0x56d16d=_0x4e186e;_0x469afc[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xde')][_0x0445('0x40')]);_0x469afc[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x580bbd[_0x0445('0x49')]);_0x469afc['filters']=_[_0x0445('0x5f')](_0x469afc[_0x0445('0x5c')],_0x469afc[_0x0445('0x49')]);_0x4b0fa9['attributes']=_[_0x0445('0x5f')](_0x469afc['model'],qs[_0x0445('0x60')](_0x580bbd['query']['fields']));_0x4b0fa9[_0x0445('0x4d')]=_0x4b0fa9['attributes'][_0x0445('0x51')]?_0x4b0fa9['attributes']:_0x469afc['model'];_0x4b0fa9[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x580bbd[_0x0445('0x49')][_0x0445('0xd0')]);_0x4b0fa9[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x580bbd[_0x0445('0x49')],_0x469afc['filters']));if(_0x580bbd['query'][_0x0445('0x35')]){_0x4b0fa9['where']=_[_0x0445('0xd2')](_0x4b0fa9[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x4b0fa9[_0x0445('0x4d')],function(_0x5aa166){var _0x52dd35={};_0x52dd35[_0x5aa166]={'$like':'%'+_0x580bbd['query'][_0x0445('0x35')]+'%'};return _0x52dd35;})});}_0x4b0fa9=_[_0x0445('0xd2')]({},_0x4b0fa9,_0x580bbd[_0x0445('0x61')]);return _0x56d16d['getGroups'](_0x4b0fa9);}})['then'](function(_0x54cea6){if(_0x54cea6){_0x480f44=_0x54cea6['length'];if(!_0x580bbd[_0x0445('0x49')][_0x0445('0xd3')]('nolimit')){_0x4b0fa9[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x580bbd[_0x0445('0x49')]['limit']);_0x4b0fa9[_0x0445('0x23')]=qs['offset'](_0x580bbd['query']['offset']);}return _0x56d16d[_0x0445('0xdd')](_0x4b0fa9);}})[_0x0445('0x2a')](function(_0x1f6519){if(_0x1f6519){return _0x1f6519?{'count':_0x480f44,'rows':_0x1f6519}:null;}})['then'](respondWithResult(_0x1a1152,null))[_0x0445('0x20')](handleError(_0x1a1152,null));};exports[_0x0445('0xdf')]=function(_0x4aaed9,_0x33a30c){var _0x1d7540={'raw':!![],'where':{}};var _0x3088e5={};var _0x6a473e={'count':0x0,'rows':[]};return db['User'][_0x0445('0x9a')]({'where':{'id':_0x4aaed9['params']['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x33a30c,null))['then'](function(_0xe22f96){if(_0xe22f96){_0x3088e5[_0x0445('0x5c')]=_['keys'](db['VoiceRecording'][_0x0445('0x40')]);_0x3088e5[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x4aaed9['query']);_0x3088e5[_0x0445('0x5e')]=_['intersection'](_0x3088e5[_0x0445('0x5c')],_0x3088e5[_0x0445('0x49')]);_0x1d7540['attributes']=_[_0x0445('0x5f')](_0x3088e5[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x4aaed9[_0x0445('0x49')][_0x0445('0x60')]));_0x1d7540['attributes']=_0x1d7540[_0x0445('0x4d')][_0x0445('0x51')]?_0x1d7540[_0x0445('0x4d')]:_0x3088e5[_0x0445('0x5c')];if(!_0x4aaed9[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x1d7540[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x4aaed9[_0x0445('0x49')]['limit']);_0x1d7540[_0x0445('0x23')]=qs['offset'](_0x4aaed9['query'][_0x0445('0x23')]);}_0x1d7540['order']=qs[_0x0445('0xd0')](_0x4aaed9[_0x0445('0x49')][_0x0445('0xd0')]);_0x1d7540[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x4aaed9[_0x0445('0x49')],_0x3088e5['filters']));_0x1d7540['where'][_0x0445('0xe0')]=_0xe22f96['id'];if(_0x4aaed9[_0x0445('0x49')]['filter']){_0x1d7540[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x1d7540[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x1d7540['attributes'],function(_0x58236a){var _0x4929a9={};_0x4929a9[_0x58236a]={'$like':'%'+_0x4aaed9['query'][_0x0445('0x35')]+'%'};return _0x4929a9;})});}_0x1d7540=_[_0x0445('0xd2')]({},_0x1d7540,_0x4aaed9[_0x0445('0x61')]);return db[_0x0445('0xe1')]['count']({'where':_0x1d7540['where']})[_0x0445('0x2a')](function(_0x5653be){_0x6a473e[_0x0445('0x26')]=_0x5653be;if(_0x4aaed9['query'][_0x0445('0x47')]){_0x1d7540['include']=[{'all':!![]}];}return db[_0x0445('0xe1')][_0x0445('0x4f')](_0x1d7540);})[_0x0445('0x2a')](function(_0x3a0aeb){_0x6a473e[_0x0445('0x53')]=_0x3a0aeb;return _0x6a473e;});}})['then'](respondWithFilteredResult(_0x33a30c,_0x1d7540))[_0x0445('0x20')](handleError(_0x33a30c,null));};exports[_0x0445('0xe2')]=function(_0x1e499d,_0x56c3e7){var _0x54dd86={'raw':!![],'where':{}};var _0x54ae54={};var _0x3ffe4d={'count':0x0,'rows':[]};return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x1e499d[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x56c3e7,null))['then'](function(_0x5f41cf){if(_0x5f41cf){_0x54ae54[_0x0445('0x5c')]=_[_0x0445('0x5d')](db['ScreenRecording']['rawAttributes']);_0x54ae54[_0x0445('0x49')]=_['keys'](_0x1e499d[_0x0445('0x49')]);_0x54ae54[_0x0445('0x5e')]=_['intersection'](_0x54ae54[_0x0445('0x5c')],_0x54ae54[_0x0445('0x49')]);_0x54dd86['attributes']=_[_0x0445('0x5f')](_0x54ae54[_0x0445('0x5c')],qs['fields'](_0x1e499d[_0x0445('0x49')][_0x0445('0x60')]));_0x54dd86['attributes']=_0x54dd86[_0x0445('0x4d')][_0x0445('0x51')]?_0x54dd86['attributes']:_0x54ae54[_0x0445('0x5c')];if(!_0x1e499d['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0x54dd86[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x1e499d['query'][_0x0445('0x24')]);_0x54dd86[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x1e499d[_0x0445('0x49')]['offset']);}_0x54dd86[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x1e499d[_0x0445('0x49')][_0x0445('0xd0')]);_0x54dd86[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x1e499d['query'],_0x54ae54[_0x0445('0x5e')]));_0x54dd86[_0x0445('0xd1')][_0x0445('0xe0')]=_0x5f41cf['id'];if(_0x1e499d[_0x0445('0x49')]['filter']){_0x54dd86[_0x0445('0xd1')]=_['merge'](_0x54dd86[_0x0445('0xd1')],{'$or':_['map'](_0x54dd86['attributes'],function(_0x5d7025){var _0x1fb06a={};_0x1fb06a[_0x5d7025]={'$like':'%'+_0x1e499d[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x1fb06a;})});}_0x54dd86=_[_0x0445('0xd2')]({},_0x54dd86,_0x1e499d[_0x0445('0x61')]);return db[_0x0445('0xe3')]['count']({'where':_0x54dd86[_0x0445('0xd1')]})[_0x0445('0x2a')](function(_0x57b7c6){_0x3ffe4d[_0x0445('0x26')]=_0x57b7c6;if(_0x1e499d['query'][_0x0445('0x47')]){_0x54dd86[_0x0445('0x48')]=[{'all':!![]}];}return db[_0x0445('0xe3')][_0x0445('0x4f')](_0x54dd86);})['then'](function(_0x4ee4bf){_0x3ffe4d[_0x0445('0x53')]=_0x4ee4bf;return _0x3ffe4d;});}})['then'](respondWithFilteredResult(_0x56c3e7,_0x54dd86))['catch'](handleError(_0x56c3e7,null));};exports['getChatInteractions']=function(_0x5594b5,_0x30b5fc){var _0x3de9f6={};var _0x3cf29b={};var _0x121416;var _0x4bfea6;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x5594b5[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x30b5fc,null))['then'](function(_0x2ab7df){if(_0x2ab7df){_0x121416=_0x2ab7df;_0x3cf29b[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xe4')][_0x0445('0x40')]);_0x3cf29b[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x5594b5[_0x0445('0x49')]);_0x3cf29b[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x3cf29b[_0x0445('0x5c')],_0x3cf29b[_0x0445('0x49')]);_0x3de9f6[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x3cf29b[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x5594b5['query'][_0x0445('0x60')]));_0x3de9f6[_0x0445('0x4d')]=_0x3de9f6[_0x0445('0x4d')][_0x0445('0x51')]?_0x3de9f6[_0x0445('0x4d')]:_0x3cf29b[_0x0445('0x5c')];_0x3de9f6[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x5594b5[_0x0445('0x49')][_0x0445('0xd0')]);_0x3de9f6[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x5594b5['query'],_0x3cf29b['filters']));if(_0x5594b5[_0x0445('0x49')][_0x0445('0x35')]){_0x3de9f6[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x3de9f6[_0x0445('0xd1')],{'$or':_['map'](_0x3de9f6[_0x0445('0x4d')],function(_0x36a5ad){var _0xdf435a={};_0xdf435a[_0x36a5ad]={'$like':'%'+_0x5594b5[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0xdf435a;})});}_0x3de9f6=_['merge']({},_0x3de9f6,_0x5594b5[_0x0445('0x61')]);return _0x121416[_0x0445('0xe5')](_0x3de9f6);}})[_0x0445('0x2a')](function(_0x543c6c){if(_0x543c6c){_0x4bfea6=_0x543c6c[_0x0445('0x51')];if(!_0x5594b5[_0x0445('0x49')]['hasOwnProperty'](_0x0445('0xd8'))){_0x3de9f6['limit']=qs[_0x0445('0x24')](_0x5594b5[_0x0445('0x49')][_0x0445('0x24')]);_0x3de9f6[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x5594b5[_0x0445('0x49')][_0x0445('0x23')]);}return _0x121416[_0x0445('0xe5')](_0x3de9f6);}})[_0x0445('0x2a')](function(_0x36fb99){if(_0x36fb99){return _0x36fb99?{'count':_0x4bfea6,'rows':_0x36fb99}:null;}})[_0x0445('0x2a')](respondWithResult(_0x30b5fc,null))[_0x0445('0x20')](handleError(_0x30b5fc,null));};exports[_0x0445('0xe6')]=function(_0x20bd52,_0xb53dab){var _0x9639a6={};var _0x44dce7={};var _0x33264a;var _0x2926be;return db['User']['findOne']({'where':{'id':_0x20bd52[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0xb53dab,null))['then'](function(_0x1e6362){if(_0x1e6362){_0x33264a=_0x1e6362;_0x44dce7[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xe7')]['rawAttributes']);_0x44dce7[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x20bd52[_0x0445('0x49')]);_0x44dce7[_0x0445('0x5e')]=_['intersection'](_0x44dce7[_0x0445('0x5c')],_0x44dce7[_0x0445('0x49')]);_0x9639a6[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x44dce7[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x20bd52[_0x0445('0x49')]['fields']));_0x9639a6[_0x0445('0x4d')]=_0x9639a6['attributes']['length']?_0x9639a6[_0x0445('0x4d')]:_0x44dce7[_0x0445('0x5c')];_0x9639a6[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x20bd52['query'][_0x0445('0xd0')]);_0x9639a6['where']=qs[_0x0445('0x5e')](_['pick'](_0x20bd52[_0x0445('0x49')],_0x44dce7[_0x0445('0x5e')]));if(_0x20bd52['query'][_0x0445('0x35')]){_0x9639a6[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x9639a6[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x9639a6[_0x0445('0x4d')],function(_0x5c76ab){var _0x281f10={};_0x281f10[_0x5c76ab]={'$like':'%'+_0x20bd52[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x281f10;})});}_0x9639a6=_[_0x0445('0xd2')]({},_0x9639a6,_0x20bd52[_0x0445('0x61')]);return _0x33264a[_0x0445('0xe6')](_0x9639a6);}})[_0x0445('0x2a')](function(_0x483180){if(_0x483180){_0x2926be=_0x483180['length'];if(!_0x20bd52['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0x9639a6[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x20bd52['query']['limit']);_0x9639a6[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x20bd52[_0x0445('0x49')][_0x0445('0x23')]);}return _0x33264a['getOpenchannelInteractions'](_0x9639a6);}})[_0x0445('0x2a')](function(_0x15253a){if(_0x15253a){return _0x15253a?{'count':_0x2926be,'rows':_0x15253a}:null;}})[_0x0445('0x2a')](respondWithResult(_0xb53dab,null))[_0x0445('0x20')](handleError(_0xb53dab,null));};exports[_0x0445('0xe8')]=function(_0x56ec4d,_0x1949a6){var _0xb2b697={'raw':!![],'where':{}};var _0x535a8c={};var _0x388395={'count':0x0,'rows':[]};return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x56ec4d[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x1949a6,null))[_0x0445('0x2a')](function(_0x820e31){if(_0x820e31){_0x535a8c[_0x0445('0x5c')]=_['keys'](db[_0x0445('0xe9')][_0x0445('0x40')]);_0x535a8c[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x56ec4d[_0x0445('0x49')]);_0x535a8c['filters']=_[_0x0445('0x5f')](_0x535a8c['model'],_0x535a8c[_0x0445('0x49')]);_0xb2b697[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x535a8c[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x56ec4d[_0x0445('0x49')]['fields']));_0xb2b697[_0x0445('0x4d')]=_0xb2b697[_0x0445('0x4d')][_0x0445('0x51')]?_0xb2b697[_0x0445('0x4d')]:_0x535a8c[_0x0445('0x5c')];if(!_0x56ec4d['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0xb2b697['limit']=qs['limit'](_0x56ec4d[_0x0445('0x49')][_0x0445('0x24')]);_0xb2b697[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x56ec4d[_0x0445('0x49')][_0x0445('0x23')]);}_0xb2b697[_0x0445('0xcf')]=qs['sort'](_0x56ec4d[_0x0445('0x49')][_0x0445('0xd0')]);_0xb2b697[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x56ec4d[_0x0445('0x49')],_0x535a8c[_0x0445('0x5e')]));_0xb2b697[_0x0445('0xd1')][_0x0445('0xe0')]=_0x820e31['id'];if(_0x56ec4d[_0x0445('0x49')][_0x0445('0x35')]){_0xb2b697[_0x0445('0xd1')]=_['merge'](_0xb2b697['where'],{'$or':_['map'](_0xb2b697['attributes'],function(_0x56085d){var _0x2723ac={};_0x2723ac[_0x56085d]={'$like':'%'+_0x56ec4d[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x2723ac;})});}_0xb2b697=_[_0x0445('0xd2')]({},_0xb2b697,_0x56ec4d[_0x0445('0x61')]);return db[_0x0445('0xe9')][_0x0445('0x26')]({'where':_0xb2b697['where']})[_0x0445('0x2a')](function(_0x44e611){_0x388395[_0x0445('0x26')]=_0x44e611;if(_0x56ec4d[_0x0445('0x49')][_0x0445('0x47')]){_0xb2b697[_0x0445('0x48')]=[{'all':!![]}];}return db[_0x0445('0xe9')][_0x0445('0x4f')](_0xb2b697);})[_0x0445('0x2a')](function(_0x15cf79){_0x388395[_0x0445('0x53')]=_0x15cf79;return _0x388395;});}})[_0x0445('0x2a')](respondWithFilteredResult(_0x1949a6,_0xb2b697))['catch'](handleError(_0x1949a6,null));};exports[_0x0445('0xea')]=function(_0x27e81a,_0x355ebd){var _0x10b1e7={};var _0x1c61d7={};var _0xc7fc81;var _0x47bb3f;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x27e81a[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x355ebd,null))[_0x0445('0x2a')](function(_0x5dc31a){if(_0x5dc31a){_0xc7fc81=_0x5dc31a;_0x1c61d7[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xeb')][_0x0445('0x40')]);_0x1c61d7[_0x0445('0x49')]=_['keys'](_0x27e81a[_0x0445('0x49')]);_0x1c61d7[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x1c61d7[_0x0445('0x5c')],_0x1c61d7[_0x0445('0x49')]);_0x10b1e7[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x1c61d7[_0x0445('0x5c')],qs['fields'](_0x27e81a[_0x0445('0x49')][_0x0445('0x60')]));_0x10b1e7['attributes']=_0x10b1e7[_0x0445('0x4d')]['length']?_0x10b1e7[_0x0445('0x4d')]:_0x1c61d7[_0x0445('0x5c')];_0x10b1e7[_0x0445('0xcf')]=qs['sort'](_0x27e81a['query'][_0x0445('0xd0')]);_0x10b1e7[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x27e81a[_0x0445('0x49')],_0x1c61d7['filters']));if(_0x27e81a[_0x0445('0x49')][_0x0445('0x35')]){_0x10b1e7[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x10b1e7[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x10b1e7[_0x0445('0x4d')],function(_0x199d95){var _0x4b0773={};_0x4b0773[_0x199d95]={'$like':'%'+_0x27e81a[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x4b0773;})});}_0x10b1e7=_[_0x0445('0xd2')]({},_0x10b1e7,_0x27e81a[_0x0445('0x61')]);return _0xc7fc81[_0x0445('0xea')](_0x10b1e7);}})['then'](function(_0x1ec14f){if(_0x1ec14f){_0x47bb3f=_0x1ec14f[_0x0445('0x51')];if(!_0x27e81a[_0x0445('0x49')][_0x0445('0xd3')]('nolimit')){_0x10b1e7[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x27e81a['query'][_0x0445('0x24')]);_0x10b1e7[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x27e81a[_0x0445('0x49')][_0x0445('0x23')]);}return _0xc7fc81[_0x0445('0xea')](_0x10b1e7);}})[_0x0445('0x2a')](function(_0x1a73d2){if(_0x1a73d2){return _0x1a73d2?{'count':_0x47bb3f,'rows':_0x1a73d2}:null;}})[_0x0445('0x2a')](respondWithResult(_0x355ebd,null))[_0x0445('0x20')](handleError(_0x355ebd,null));};exports[_0x0445('0xec')]=function(_0x998a86,_0x134583){var _0x530618={};var _0x533cee={};var _0x10bd19;var _0x590a15;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x998a86[_0x0445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x134583,null))['then'](function(_0x5af57d){if(_0x5af57d){_0x10bd19=_0x5af57d;_0x533cee[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xed')][_0x0445('0x40')]);_0x533cee[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x998a86[_0x0445('0x49')]);_0x533cee[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x533cee[_0x0445('0x5c')],_0x533cee[_0x0445('0x49')]);_0x530618['attributes']=_[_0x0445('0x5f')](_0x533cee['model'],qs[_0x0445('0x60')](_0x998a86[_0x0445('0x49')]['fields']));_0x530618[_0x0445('0x4d')]=_0x530618[_0x0445('0x4d')][_0x0445('0x51')]?_0x530618[_0x0445('0x4d')]:_0x533cee[_0x0445('0x5c')];_0x530618['order']=qs[_0x0445('0xd0')](_0x998a86['query'][_0x0445('0xd0')]);_0x530618[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x998a86[_0x0445('0x49')],_0x533cee[_0x0445('0x5e')]));if(_0x998a86['query'][_0x0445('0x35')]){_0x530618[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x530618[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x530618[_0x0445('0x4d')],function(_0x3a1c71){var _0x44c788={};_0x44c788[_0x3a1c71]={'$like':'%'+_0x998a86[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x44c788;})});}_0x530618=_[_0x0445('0xd2')]({},_0x530618,_0x998a86[_0x0445('0x61')]);return _0x10bd19[_0x0445('0xec')](_0x530618);}})[_0x0445('0x2a')](function(_0x4a484b){if(_0x4a484b){_0x590a15=_0x4a484b['length'];if(!_0x998a86[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x530618[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x998a86[_0x0445('0x49')]['limit']);_0x530618[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x998a86[_0x0445('0x49')][_0x0445('0x23')]);}return _0x10bd19['getFaxInteractions'](_0x530618);}})[_0x0445('0x2a')](function(_0x486755){if(_0x486755){return _0x486755?{'count':_0x590a15,'rows':_0x486755}:null;}})[_0x0445('0x2a')](respondWithResult(_0x134583,null))['catch'](handleError(_0x134583,null));};exports[_0x0445('0xee')]=function(_0x52e21b,_0x5db167){var _0x4489f1={};var _0x42d97c={};var _0x1761fd;var _0xaf8937;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x52e21b['params']['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x5db167,null))['then'](function(_0x35bf0c){if(_0x35bf0c){_0x1761fd=_0x35bf0c;_0x42d97c['model']=_[_0x0445('0x5d')](db[_0x0445('0xef')][_0x0445('0x40')]);_0x42d97c[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x52e21b['query']);_0x42d97c[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x42d97c[_0x0445('0x5c')],_0x42d97c[_0x0445('0x49')]);_0x4489f1[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x42d97c[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x52e21b['query'][_0x0445('0x60')]));_0x4489f1['attributes']=_0x4489f1[_0x0445('0x4d')][_0x0445('0x51')]?_0x4489f1[_0x0445('0x4d')]:_0x42d97c[_0x0445('0x5c')];_0x4489f1[_0x0445('0xcf')]=qs['sort'](_0x52e21b[_0x0445('0x49')][_0x0445('0xd0')]);_0x4489f1['where']=qs['filters'](_[_0x0445('0xdb')](_0x52e21b[_0x0445('0x49')],_0x42d97c[_0x0445('0x5e')]));if(_0x52e21b[_0x0445('0x49')][_0x0445('0x35')]){_0x4489f1['where']=_['merge'](_0x4489f1[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x4489f1[_0x0445('0x4d')],function(_0x181476){var _0x266517={};_0x266517[_0x181476]={'$like':'%'+_0x52e21b[_0x0445('0x49')]['filter']+'%'};return _0x266517;})});}_0x4489f1=_[_0x0445('0xd2')]({},_0x4489f1,_0x52e21b['options']);return _0x1761fd[_0x0445('0xee')](_0x4489f1);}})[_0x0445('0x2a')](function(_0x28a752){if(_0x28a752){_0xaf8937=_0x28a752[_0x0445('0x51')];if(!_0x52e21b[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x4489f1[_0x0445('0x24')]=qs['limit'](_0x52e21b[_0x0445('0x49')][_0x0445('0x24')]);_0x4489f1['offset']=qs[_0x0445('0x23')](_0x52e21b[_0x0445('0x49')][_0x0445('0x23')]);}return _0x1761fd[_0x0445('0xee')](_0x4489f1);}})[_0x0445('0x2a')](function(_0x24fb74){if(_0x24fb74){return _0x24fb74?{'count':_0xaf8937,'rows':_0x24fb74}:null;}})[_0x0445('0x2a')](respondWithResult(_0x5db167,null))[_0x0445('0x20')](handleError(_0x5db167,null));};exports[_0x0445('0xf0')]=function(_0x1f5ba4,_0x32fde7,_0x52b834){var _0x14ed87;var _0x349932;var _0x3f6767;var _0x1908c6=!_[_0x0445('0x6b')](_0x1f5ba4['params']['id'])?_0x1f5ba4[_0x0445('0x5b')]['id']:!_['isNil'](_0x1f5ba4['user']['id'])?_0x1f5ba4[_0x0445('0x30')]['id']:null;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x1908c6,'role':{'$or':[_0x0445('0x2e'),'user',_0x0445('0x32')]}},'attributes':['id',_0x0445('0x39'),'phone',_0x0445('0xf1'),_0x0445('0x2d'),'internal',_0x0445('0xa4')]})[_0x0445('0x2a')](function(_0x318669){if(_0x318669){if(_0x318669[_0x0445('0x2d')]==='agent'){_0x14ed87=_0x318669;if(_0x1f5ba4['body'][_0x0445('0xa6')]){_0x3f6767=util[_0x0445('0xf2')](_0x0445('0xf3'),_0x14ed87[_0x1f5ba4[_0x0445('0x63')][_0x0445('0xa6')]]);}else if(_0x1f5ba4[_0x0445('0x63')][_0x0445('0xf4')]){_0x3f6767=util[_0x0445('0xf2')](_0x0445('0xb3'),_0x1f5ba4['body'][_0x0445('0xf4')]);}else{_0x3f6767=util[_0x0445('0xf2')]('SIP/%s',_0x14ed87[_0x0445('0x39')]);}socket['to'](util[_0x0445('0xf2')](_0x0445('0xf5'),_0x14ed87[_0x0445('0x39')]))[_0x0445('0x2b')](_0x0445('0xf6'),{'user':{'id':_0x14ed87['id'],'name':_0x14ed87['name']},'ip':_0x1f5ba4['headers'][_0x0445('0xf7')]||_0x1f5ba4[_0x0445('0xf8')][_0x0445('0xf9')]||_0x1f5ba4['socket'][_0x0445('0xf9')]||_0x1f5ba4[_0x0445('0xf8')][_0x0445('0xfa')][_0x0445('0xf9')]});return db[_0x0445('0xb4')][_0x0445('0x3b')]({'where':{'membername':_0x14ed87[_0x0445('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xfb'));}})[_0x0445('0x2a')](function(){if(_0x14ed87){return _0x14ed87['getVoiceQueues']({'raw':!![]});}})[_0x0445('0x2a')](function(_0x2fe744){if(_0x14ed87){var _0x8743=[];if(_0x2fe744){_0x349932=_0x2fe744;if(_0x349932[_0x0445('0x51')]){for(var _0x1a2f27=0x0;_0x1a2f27<_0x349932[_0x0445('0x51')];_0x1a2f27++){_0x8743[_0x0445('0x4e')]({'membername':_0x14ed87[_0x0445('0x39')],'UserId':_0x14ed87['id'],'queue_name':_0x349932[_0x1a2f27][_0x0445('0x39')],'VoiceQueueId':_0x349932[_0x1a2f27]['id'],'interface':_0x3f6767,'paused':_0x14ed87[_0x0445('0xa4')]||![],'penalty':_0x349932[_0x1a2f27]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x8743,function(_0x302af3){return db[_0x0445('0xb4')][_0x0445('0xfc')](_0x302af3);});}}}})[_0x0445('0x2a')](function(){if(_0x14ed87){return db[_0x0445('0xfd')]['findAll']({'where':{'membername':_0x14ed87[_0x0445('0x39')],'exitAt':null}});}})[_0x0445('0x2a')](function(_0x197cf6){if(_0x14ed87){var _0x4e770e=[];_0x197cf6['forEach'](function(_0x10a399){_0x4e770e[_0x0445('0x4e')](_0x10a399[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))}));});return BPromise[_0x0445('0x59')](_0x4e770e);}})[_0x0445('0x2a')](function(){if(_0x14ed87){var _0x18b396=[];var _0x333adf=[];var _0x5f05be=utils[_0x0445('0xff')]();var _0x28cdb4={'membername':_0x14ed87['name'],'interface':_0x3f6767,'enterAt':moment()['format'](_0x0445('0xfe')),'role':_0x14ed87[_0x0445('0x2d')],'internal':_0x14ed87[_0x0445('0x67')]};_0x5f05be[_0x0445('0x100')](function(_0x8c9907){_0x18b396['push'](_[_0x0445('0xd2')]({'channel':_0x8c9907,'type':_0x0445('0x101'),'data1':_0x1f5ba4[_0x0445('0x63')]['device'],'data2':_0x3f6767},_0x28cdb4));if(_0x14ed87[_0x0445('0xa4')]){_0x333adf['push'](_['merge']({'channel':_0x8c9907,'type':_0x0445('0x102'),'data1':_0x0445('0x103')},_0x28cdb4));}});return db['MemberReport'][_0x0445('0x89')](_0x18b396[_0x0445('0xcc')](_0x333adf),{'individualHooks':!![]});}})['then'](function(){if(_0x14ed87){return _0x14ed87['update']({'online':!![],'lastLoginAt':moment()[_0x0445('0xf2')](_0x0445('0xfe')),'voicePause':_0x14ed87[_0x0445('0xa4')]||![],'mailPause':_0x14ed87['loginInPause']||![],'chatPause':_0x14ed87['loginInPause']||![],'faxPause':_0x14ed87['loginInPause']||![],'smsPause':_0x14ed87['loginInPause']||![],'openchannelPause':_0x14ed87[_0x0445('0xa4')]||![],'whatsappPause':_0x14ed87[_0x0445('0xa4')]||![],'pauseType':_0x14ed87['loginInPause']?_0x0445('0x103'):null,'interface':_0x3f6767,'lastPauseAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))});}})['then'](function(_0x42504e){if(_0x1f5ba4[_0x0445('0x104')]){return _0x52b834();}else{return BPromise[_0x0445('0x105')](_0x42504e)[_0x0445('0x2a')](respondWithResult(_0x32fde7,null));}})['catch'](handleError(_0x32fde7,null));};exports[_0x0445('0x106')]=function(_0x3b776a,_0x25c3c8){var _0x1e779f;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3b776a[_0x0445('0x5b')]['id'],'role':_0x0445('0x32')},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x25c3c8,null))['then'](function(_0x5d657a){if(_0x5d657a){_0x1e779f=_0x5d657a;return db[_0x0445('0xb4')][_0x0445('0x3b')]({'where':{'membername':_0x1e779f[_0x0445('0x39')]},'individualHooks':!![]});}})[_0x0445('0x2a')](function(){return db[_0x0445('0xfd')][_0x0445('0x4f')]({'where':{'membername':_0x1e779f[_0x0445('0x39')],'exitAt':null}});})['then'](function(_0x4af0d7){var _0x452d99=[];_0x4af0d7[_0x0445('0x100')](function(_0x196479){_0x452d99[_0x0445('0x4e')](_0x196479[_0x0445('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0445('0x59')](_0x452d99);})[_0x0445('0x2a')](function(){return _0x1e779f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0445('0x2a')](respondWithResult(_0x25c3c8,null))[_0x0445('0x20')](handleError(_0x25c3c8,null));};exports[_0x0445('0x107')]=function(_0x16cb8c,_0x1a0361){var _0x4418c1;return db[_0x0445('0xb4')][_0x0445('0x29')]({'paused':0x1},{'where':{'UserId':_0x16cb8c[_0x0445('0x5b')]['id']},'individualHooks':!![]})[_0x0445('0x2a')](function(){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x16cb8c[_0x0445('0x5b')]['id'],'role':_0x0445('0x32')},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),_0x0445('0x67'),_0x0445('0xa6')]});})[_0x0445('0x2a')](handleEntityNotFound(_0x1a0361,null))[_0x0445('0x2a')](function(_0x224141){if(_0x224141){_0x4418c1=_0x224141;return respondWithRpcPromise(_0x0445('0x108'),_0x0445('0x107'),{'id':_0x4418c1['id'],'name':_0x4418c1[_0x0445('0x39')],'pause':!![]});}})['then'](function(){if(_0x4418c1){return db[_0x0445('0xfd')][_0x0445('0x4f')]({'where':{'membername':_0x4418c1[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});}})[_0x0445('0x2a')](function(_0x2de928){if(_0x2de928[_0x0445('0x51')]){var _0x1a1ca0=moment()[_0x0445('0xf2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x45893b=0x0,_0x405194=_0x2de928[_0x0445('0x51')];_0x45893b<_0x405194;_0x45893b++){_0x2de928[_0x45893b][_0x0445('0x109')]({'exitAt':_0x1a1ca0});}}})['then'](function(){var _0x40a569=[];var _0x2e7cae=utils[_0x0445('0xff')]();_0x2e7cae['forEach'](function(_0xf4042c){_0x40a569[_0x0445('0x4e')]({'channel':_0xf4042c,'membername':_0x4418c1[_0x0445('0x39')],'interface':_[_0x0445('0x6b')](_0x4418c1['interface'])?util[_0x0445('0xf2')](_0x0445('0xb3'),_0x4418c1[_0x0445('0x39')]):_0x4418c1[_0x0445('0xa6')],'type':_0x0445('0x102'),'enterAt':moment()['format'](_0x0445('0xfe')),'data1':_0x16cb8c[_0x0445('0x63')][_0x0445('0x42')]||_0x0445('0x10a'),'role':_0x4418c1[_0x0445('0x2d')],'internal':_0x4418c1['internal']});});return db[_0x0445('0xfd')][_0x0445('0x89')](_0x40a569,{'individualHooks':!![]});})[_0x0445('0x2a')](function(){return _0x4418c1['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x16cb8c['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))});})[_0x0445('0x2a')](respondWithResult(_0x1a0361,null))[_0x0445('0x20')](handleError(_0x1a0361,null));};exports[_0x0445('0x10b')]=function(_0x44ac15,_0x54be0){var _0x544718;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x44ac15[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),'voicePause',_0x0445('0x10c'),_0x0445('0x10d'),_0x0445('0x10e'),_0x0445('0x10f'),_0x0445('0x110'),_0x0445('0x111'),_0x0445('0x112'),_0x0445('0x113')]})[_0x0445('0x2a')](handleEntityNotFound(_0x54be0,null))[_0x0445('0x2a')](function(_0x13abe0){if(_0x13abe0){_0x544718=_0x13abe0;if(_0x44ac15['body'][_0x0445('0xa2')]&&!utils[_0x0445('0xa7')](_0x44ac15[_0x0445('0x63')]['channel'])){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}switch(_0x44ac15[_0x0445('0x63')][_0x0445('0xa2')]){case _0x0445('0xb1'):return respondWithRpcPromise('QueuePause',_0x0445('0x10b'),{'id':_0x544718['id'],'name':_0x544718[_0x0445('0x39')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x544718['id']},'individualHooks':!![]});})[_0x0445('0x2a')](function(){return db['MemberReport'][_0x0445('0x38')]({'where':{'channel':_0x44ac15[_0x0445('0x63')]['channel'],'membername':_0x544718[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});})['then'](function(_0x11ee4f){if(_0x11ee4f){return _0x11ee4f[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0445('0x114')},{'individualHooks':!![]});}return null;})[_0x0445('0x2a')](function(){return _0x544718['update']({'voicePause':![]});});case _0x0445('0x56'):case _0x0445('0x52'):case _0x0445('0x55'):case _0x0445('0x62'):case _0x0445('0x58'):case _0x0445('0x57'):return db[_0x0445('0xfd')]['find']({'where':{'channel':_0x44ac15[_0x0445('0x63')]['channel'],'membername':_0x544718['name'],'type':'PAUSE','exitAt':null}})[_0x0445('0x2a')](function(_0xfa12b2){if(_0xfa12b2){return _0xfa12b2[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')](_0x0445('0xfe')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0445('0x2a')](function(){var _0xc487b5={};_[_0x0445('0x115')](_0xc487b5,util[_0x0445('0xf2')](_0x0445('0x116'),_0x44ac15['body'][_0x0445('0xa2')],_0x0445('0x117')),![]);return _0x544718[_0x0445('0x29')](_0xc487b5);});default:return respondWithRpcPromise(_0x0445('0x108'),_0x0445('0x10b'),{'id':_0x544718['id'],'name':_0x544718[_0x0445('0x39')],'pause':![]})[_0x0445('0x2a')](function(){return db[_0x0445('0xb4')][_0x0445('0x29')]({'paused':0x0},{'where':{'UserId':_0x544718['id']}});})[_0x0445('0x2a')](function(){return db['MemberReport'][_0x0445('0x4f')]({'where':{'membername':_0x544718[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});})[_0x0445('0x2a')](function(_0xe8fcba){var _0x5f3d6b=[];_0xe8fcba[_0x0445('0x100')](function(_0x111bde){_0x5f3d6b['push'](_0x111bde[_0x0445('0x29')]({'exitAt':moment()['format'](_0x0445('0xfe')),'data2':_0x0445('0x114')}));});return BPromise['all'](_0x5f3d6b);})[_0x0445('0x2a')](function(){return _0x544718[_0x0445('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0445('0x2a')](respondWithResult(_0x54be0,null))[_0x0445('0x20')](handleError(_0x54be0,null));};exports[_0x0445('0x118')]=function(_0x522927,_0x2b0210){var _0x25ba88={};var _0x4acd44={};var _0xf03edd;var _0x7be9b0;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x522927[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2b0210,null))[_0x0445('0x2a')](function(_0x17994f){if(_0x17994f){_0xf03edd=_0x17994f;_0x4acd44[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x119')][_0x0445('0x40')]);_0x4acd44['query']=_[_0x0445('0x5d')](_0x522927[_0x0445('0x49')]);_0x4acd44['filters']=_['intersection'](_0x4acd44['model'],_0x4acd44[_0x0445('0x49')]);_0x25ba88[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x4acd44[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x522927['query'][_0x0445('0x60')]));_0x25ba88[_0x0445('0x4d')]=_0x25ba88[_0x0445('0x4d')][_0x0445('0x51')]?_0x25ba88['attributes']:_0x4acd44[_0x0445('0x5c')];_0x25ba88[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x522927[_0x0445('0x49')][_0x0445('0xd0')]);_0x25ba88[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x522927[_0x0445('0x49')],_0x4acd44[_0x0445('0x5e')]));if(_0x522927[_0x0445('0x49')][_0x0445('0x35')]){_0x25ba88[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x25ba88[_0x0445('0xd1')],{'$or':_['map'](_0x25ba88['attributes'],function(_0x68bb3c){var _0x133a54={};_0x133a54[_0x68bb3c]={'$like':'%'+_0x522927[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x133a54;})});}_0x25ba88=_[_0x0445('0xd2')]({},_0x25ba88,_0x522927[_0x0445('0x61')]);return _0xf03edd['getTeams'](_0x25ba88);}})[_0x0445('0x2a')](function(_0x28e8b2){if(_0x28e8b2){_0x7be9b0=_0x28e8b2['length'];if(!_0x522927['query']['hasOwnProperty'](_0x0445('0xd8'))){_0x25ba88[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x522927[_0x0445('0x49')][_0x0445('0x24')]);_0x25ba88[_0x0445('0x23')]=qs['offset'](_0x522927[_0x0445('0x49')][_0x0445('0x23')]);}return _0xf03edd['getTeams'](_0x25ba88);}})[_0x0445('0x2a')](function(_0x4833b0){if(_0x4833b0){return _0x4833b0?{'count':_0x7be9b0,'rows':_0x4833b0}:null;}})[_0x0445('0x2a')](respondWithResult(_0x2b0210,null))[_0x0445('0x20')](handleError(_0x2b0210,null));};exports[_0x0445('0x11a')]=function(_0x159d2d,_0x55452d){var _0x1dac44=_0x159d2d['params']['id'];var _0x390a12=_0x159d2d[_0x0445('0x63')]?_0x159d2d[_0x0445('0x63')][_0x0445('0x66')]:null;var _0x3f53a7=[];return Promise[_0x0445('0x105')]()['then'](function(){if(!_0x390a12)throw new APIBadRequestError(_0x0445('0x11b'));})[_0x0445('0x2a')](function(){return db['User'][_0x0445('0x9a')]({'where':{'id':_0x1dac44}});})[_0x0445('0x2a')](function(_0x59f47d){if(!_0x59f47d)throw new APINotFoundError(util[_0x0445('0xf2')](_0x0445('0x11c'),_0x159d2d[_0x0445('0x5b')]['id']));return db['sequelize'][_0x0445('0x11d')](function(_0x260a8a){return _0x59f47d[_0x0445('0x11a')](_0x390a12,{'transaction':_0x260a8a})[_0x0445('0x2a')](function(){return db[_0x0445('0x119')][_0x0445('0x4f')]({'where':{'id':{'$in':_0x390a12}}});})[_0x0445('0x2a')](function(_0x411982){var _0x114eb3=_[_0x0445('0x8f')](_0x411982,function(_0x1ff63c){return _0x1ff63c[_0x0445('0x11e')]();});return Promise['all'](_0x114eb3);})[_0x0445('0x2a')](function(_0x1c7314){_0x3f53a7=_[_0x0445('0x11f')](_0x1c7314);var _0x569a6f=_[_0x0445('0x8f')](_0x3f53a7,function(_0xc9adab){return _0xc9adab[_0x0445('0x120')](_0x59f47d['id'],{'transaction':_0x260a8a});});return Promise[_0x0445('0x59')](_0x569a6f);})[_0x0445('0x2a')](function(){if(!_0x59f47d[_0x0445('0xa3')])return;var _0x1875b1=_[_0x0445('0x35')](_0x3f53a7,function(_0x546e93){return _0x546e93[_0x0445('0x121')]('channel')==='Voice';});var _0x3dbd23=_['map'](_0x1875b1,function(_0x242af5){return db[_0x0445('0xb4')][_0x0445('0xfc')]({'membername':_0x59f47d['name'],'UserId':_0x59f47d['id'],'queue_name':_0x242af5['name'],'VoiceQueueId':_0x242af5['id'],'interface':_[_0x0445('0x6b')](_0x59f47d['interface'])?util['format'](_0x0445('0xb3'),_0x59f47d['name']):_0x59f47d[_0x0445('0xa6')],'paused':_0x59f47d['voicePause']||![],'penalty':_0x59f47d[_0x0445('0xad')]},{'transaction':_0x260a8a});});return Promise['all'](_0x3dbd23);})[_0x0445('0x2a')](function(){return db[_0x0445('0x122')][_0x0445('0x4f')]({'where':{'teamId':{'$in':_0x390a12}}});})[_0x0445('0x2a')](function(_0x6b84e7){var _0x193329=_[_0x0445('0x8f')](_0x6b84e7,function(_0x12e7b8){return db[_0x0445('0x123')][_0x0445('0x82')]({'UserId':_0x59f47d['id'],'VoicePrefixId':_0x12e7b8[_0x0445('0x124')]},{'transaction':_0x260a8a});});return Promise[_0x0445('0x59')](_0x193329);});});})[_0x0445('0x2a')](function(){for(var _0x40511b=0x0;_0x40511b<_0x3f53a7['length'];_0x40511b++){var _0x64e70a=_0x3f53a7[_0x40511b]['getDataValue'](_0x0445('0xa2'));var _0x1c0e76=_0x64e70a+'QueueId';socket['emit']('user'+_0x64e70a+_0x0445('0xb0'),{'UserId':_0x1dac44,['queueField']:_0x3f53a7[_0x40511b]['id']});}})[_0x0445('0x2a')](respondWithStatusCode(_0x55452d,null))[_0x0445('0x20')](APIHandleError(_0x55452d));};exports[_0x0445('0x125')]=function(_0x4767b4,_0xaf8f3a){var _0x2d58f3=_0x4767b4[_0x0445('0x5b')]['id'];var _0x382cc9=null;if(_0x4767b4[_0x0445('0x49')]['ids']){_0x382cc9=_[_0x0445('0xb5')](_0x4767b4[_0x0445('0x49')][_0x0445('0x66')])?_0x4767b4[_0x0445('0x49')]['ids']:[_0x4767b4[_0x0445('0x49')][_0x0445('0x66')]];}var _0x143faa=[];return Promise[_0x0445('0x105')]()[_0x0445('0x2a')](function(){if(!_0x382cc9)throw new APIBadRequestError(_0x0445('0x126'));})[_0x0445('0x2a')](function(){return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x2d58f3}});})[_0x0445('0x2a')](function(_0xe1a678){if(!_0xe1a678)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4767b4[_0x0445('0x5b')]['id']));return db[_0x0445('0x6d')][_0x0445('0x11d')](function(_0x2bf923){return _0xe1a678[_0x0445('0x125')](_0x382cc9,{'transaction':_0x2bf923})['then'](function(){return db[_0x0445('0x119')][_0x0445('0x4f')]({'where':{'id':{'$in':_0x382cc9}}});})[_0x0445('0x2a')](function(_0x5b17a1){var _0x365570=_[_0x0445('0x8f')](_0x5b17a1,function(_0x1a1b58){return _0x1a1b58[_0x0445('0x11e')]();});return Promise['all'](_0x365570);})[_0x0445('0x2a')](function(_0x2e4338){_0x143faa=_['flattenDeep'](_0x2e4338);var _0x494986=_[_0x0445('0x8f')](_0x143faa,function(_0x3bdf8c){return _0x3bdf8c[_0x0445('0x127')](_0xe1a678['id'],{'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x494986);})[_0x0445('0x2a')](function(){if(!_0xe1a678[_0x0445('0xa3')])return;var _0x3fd924=_['filter'](_0x143faa,function(_0x2318d0){return _0x2318d0[_0x0445('0x121')](_0x0445('0xa2'))===_0x0445('0x128');});var _0x293e70=_['map'](_0x3fd924,function(_0x1fda5c){return db[_0x0445('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x1fda5c['id'],'UserId':_0xe1a678['id']},'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x293e70);})[_0x0445('0x2a')](function(){return db['TeamVoicePrefix'][_0x0445('0x4f')]({'where':{'teamId':{'$in':_0x382cc9}}});})[_0x0445('0x2a')](function(_0x1f18a1){var _0x2a8ccb=_['map'](_0x1f18a1,function(_0x45537a){return db[_0x0445('0x123')][_0x0445('0x3b')]({'where':{'UserId':_0xe1a678['id'],'VoicePrefixId':_0x45537a['VoicePrefixId']}},{'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x2a8ccb);});});})['then'](function(){for(var _0x87ba95=0x0;_0x87ba95<_0x143faa['length'];_0x87ba95++){var _0x137229=_0x143faa[_0x87ba95]['getDataValue'](_0x0445('0xa2'));var _0x59579f=_0x137229+_0x0445('0xaf');socket[_0x0445('0x2b')]('user'+_0x137229+_0x0445('0xb6'),{'UserId':_0x2d58f3,['queueField']:_0x143faa[_0x87ba95]['id']});}})['then'](respondWithStatusCode(_0xaf8f3a,null))[_0x0445('0x20')](APIHandleError(_0xaf8f3a));};exports[_0x0445('0x129')]=function(_0x333999,_0x4287e6){var _0x2d590b={};var _0x5c6de3={};var _0x59fd23;var _0x21f75a;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x333999[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x4287e6,null))[_0x0445('0x2a')](function(_0x532cad){if(_0x532cad){_0x59fd23=_0x532cad;_0x5c6de3[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x12a')][_0x0445('0x40')]);_0x5c6de3[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x333999[_0x0445('0x49')]);_0x5c6de3['filters']=_[_0x0445('0x5f')](_0x5c6de3[_0x0445('0x5c')],_0x5c6de3[_0x0445('0x49')]);_0x2d590b['attributes']=_[_0x0445('0x5f')](_0x5c6de3[_0x0445('0x5c')],qs['fields'](_0x333999[_0x0445('0x49')]['fields']));_0x2d590b[_0x0445('0x4d')]=_0x2d590b[_0x0445('0x4d')]['length']?_0x2d590b['attributes']:_0x5c6de3[_0x0445('0x5c')];_0x2d590b[_0x0445('0xcf')]=qs['sort'](_0x333999['query'][_0x0445('0xd0')]);_0x2d590b[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x333999[_0x0445('0x49')],_0x5c6de3[_0x0445('0x5e')]));if(_0x333999[_0x0445('0x49')][_0x0445('0x35')]){_0x2d590b[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x2d590b[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x2d590b[_0x0445('0x4d')],function(_0xf1e288){var _0x358cc1={};_0x358cc1[_0xf1e288]={'$like':'%'+_0x333999['query'][_0x0445('0x35')]+'%'};return _0x358cc1;})});}_0x2d590b=_[_0x0445('0xd2')]({},_0x2d590b,_0x333999['options']);return _0x59fd23['getLists'](_0x2d590b);}})[_0x0445('0x2a')](function(_0x416389){if(_0x416389){_0x21f75a=_0x416389[_0x0445('0x51')];if(!_0x333999[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x2d590b[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x333999['query']['limit']);_0x2d590b[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x333999[_0x0445('0x49')][_0x0445('0x23')]);}return _0x59fd23[_0x0445('0x129')](_0x2d590b);}})[_0x0445('0x2a')](function(_0x234656){if(_0x234656){return _0x234656?{'count':_0x21f75a,'rows':_0x234656}:null;}})[_0x0445('0x2a')](respondWithResult(_0x4287e6,null))[_0x0445('0x20')](handleError(_0x4287e6,null));};exports[_0x0445('0x12b')]=function(_0x30a868,_0x416106){var _0xe38a93={};var _0x1ce433={};var _0x54ba9f;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x30a868[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x416106,null))[_0x0445('0x2a')](function(_0x59ec02){if(_0x59ec02){_0x54ba9f=_0x59ec02;_0x1ce433[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x3f')][_0x0445('0x40')]);_0x1ce433[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x30a868[_0x0445('0x49')]);_0x1ce433[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x1ce433[_0x0445('0x5c')],_0x1ce433[_0x0445('0x49')]);_0xe38a93[_0x0445('0x4d')]=_['intersection'](_0x1ce433[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x30a868[_0x0445('0x49')][_0x0445('0x60')]));_0xe38a93[_0x0445('0x4d')]=_0xe38a93['attributes'][_0x0445('0x51')]?_0xe38a93['attributes']:_0x1ce433['model'];_0xe38a93[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x30a868[_0x0445('0x49')][_0x0445('0xd0')]);_0xe38a93[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x30a868[_0x0445('0x49')],_0x1ce433[_0x0445('0x5e')]));if(_0x30a868['query'][_0x0445('0x35')]){_0xe38a93['where']=_[_0x0445('0xd2')](_0xe38a93[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0xe38a93[_0x0445('0x4d')],function(_0x4d7f8a){var _0x4202f9={};_0x4202f9[_0x4d7f8a]={'$like':'%'+_0x30a868['query'][_0x0445('0x35')]+'%'};return _0x4202f9;})});}_0xe38a93['model']=db[_0x0445('0x3f')];_0xe38a93['as']=_0x0445('0x31');_0xe38a93=_['merge']({},_0xe38a93,_0x30a868[_0x0445('0x61')]);return _0x54ba9f[_0x0445('0x12c')]({'include':[_0xe38a93]});}})['then'](function(_0x5e0cb2){if(_0x5e0cb2){var _0x1828e7={},_0x3df9e2=[];for(var _0x34e80c=0x0;_0x34e80c<_0x5e0cb2[_0x0445('0x51')];_0x34e80c+=0x1){for(var _0x4686c7=0x0,_0x2f4988;_0x4686c7<_0x5e0cb2[_0x34e80c][_0x0445('0x31')][_0x0445('0x51')];_0x4686c7+=0x1){_0x2f4988=_0x5e0cb2[_0x34e80c]['Agents'][_0x4686c7]['get']({'plain':!![]});_0x1828e7[_0x2f4988['id']]=_0x2f4988;}}_0x1828e7=_['values'](_0x1828e7);for(var _0x4bec2d=qs[_0x0445('0x23')](_0x30a868[_0x0445('0x49')][_0x0445('0x23')]);_0x4bec2d<_0x1828e7[_0x0445('0x51')]&&_0x3df9e2[_0x0445('0x51')]=_0x4cbb72[_0x5820('0x57')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5820('0x12')](function(){if(_0x32cda7){return db[_0x5820('0x2e')][_0x5820('0x4e')]({'where':{'membername':_0x32cda7['name']},'individualHooks':!![]});}})[_0x5820('0x12')](function(){if(_0x32cda7){return _0x32cda7['getVoiceQueues']({'raw':!![]});}})[_0x5820('0x12')](function(_0x6aed34){if(_0x32cda7){if(_0x6aed34){var _0x3a02bb=[];_0xfc91a3=_0x6aed34;if(_0xfc91a3['length']){for(var _0x1f8d5c=0x0;_0x1f8d5c<_0xfc91a3['length'];_0x1f8d5c++){_0x3a02bb[_0x5820('0x36')](db[_0x5820('0x2e')][_0x5820('0x58')]({'membername':_0x32cda7['name'],'UserId':_0x32cda7['id'],'queue_name':_0xfc91a3[_0x1f8d5c][_0x5820('0x30')],'VoiceQueueId':_0xfc91a3[_0x1f8d5c]['id'],'interface':_0xa6c499,'paused':_0x32cda7[_0x5820('0x53')]||![],'penalty':_0xfc91a3[_0x1f8d5c][_0x5820('0x59')]||0x0}));}return BPromise[_0x5820('0x4c')](_0x3a02bb);}}}})[_0x5820('0x12')](function(){if(_0x32cda7){return db[_0x5820('0x2f')][_0x5820('0x1f')]({'where':{'membername':_0x32cda7['name'],'exitAt':null}});}})[_0x5820('0x12')](function(_0x24e69c){if(_0x32cda7){if(_0x24e69c&&_0x24e69c[_0x5820('0x33')]){var _0x280e29=[];_0x24e69c[_0x5820('0x4f')](function(_0x9419cc){_0x280e29['push'](_0x9419cc[_0x5820('0x3f')]({'exitAt':moment()[_0x5820('0x32')](_0x5820('0x39'))}));});return BPromise[_0x5820('0x4c')](_0x280e29);}}})[_0x5820('0x12')](function(_0x32d783){if(_0x32cda7){var _0x2fb492=[];var _0x18b60e=[];var _0x6204b=utils['getChannels']();var _0x48222b={'membername':_0x32cda7[_0x5820('0x30')],'interface':_0xa6c499,'enterAt':moment()['format'](_0x5820('0x39')),'role':_0x32cda7['role'],'internal':_0x32cda7['internal']};_0x6204b[_0x5820('0x4f')](function(_0x9d4074){_0x2fb492[_0x5820('0x36')](_['merge']({'channel':_0x9d4074,'type':_0x5820('0x5a'),'data1':_0x5820('0x5b'),'data2':_0xa6c499},_0x48222b));if(_0x32cda7['loginInPause']){_0x18b60e[_0x5820('0x36')](_[_0x5820('0x5c')]({'channel':_0x9d4074,'type':'PAUSE','data1':'LOGININPAUSE'},_0x48222b));}});return db[_0x5820('0x2f')][_0x5820('0x3e')](_0x2fb492[_0x5820('0x5d')](_0x18b60e),{'individualHooks':!![]});}})['then'](function(){if(_0x32cda7){return _0x32cda7[_0x5820('0x3f')]({'online':!![],'lastLoginAt':moment()[_0x5820('0x32')](_0x5820('0x39')),'voicePause':_0x32cda7[_0x5820('0x53')]||![],'mailPause':_0x32cda7[_0x5820('0x53')]||![],'chatPause':_0x32cda7[_0x5820('0x53')]||![],'faxPause':_0x32cda7['loginInPause']||![],'smsPause':_0x32cda7[_0x5820('0x53')]||![],'openchannelPause':_0x32cda7[_0x5820('0x53')]||![],'pauseType':_0x32cda7['loginInPause']?_0x5820('0x5e'):null,'lastPauseAt':moment()[_0x5820('0x32')](_0x5820('0x39')),'interface':_0xa6c499});}})[_0x5820('0x12')](function(_0x1d7f20){_0x5cf2b2(_0x1d7f20);})[_0x5820('0x1c')](function(_0x54a64a){_0x2bc6b3(_0x4fb594[_0x5820('0x18')](0x1f4,_0x54a64a['message']));});});}; \ No newline at end of file +var _0x888b=['updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','uniqueid','bulkCreate','update','body','type','DEFAULT\x20PAUSE','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','PAUSE','system','mail','chat','fax','sms','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','lodash','util','moment','bluebird','randomstring','ioredis','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','User','findAll','options','raw','where','attributes','limit','include','map','model','then','GetUser','ShowUser','find','name','role','internal','interface','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x186873,_0x8b4d60){var _0x1b01e1=function(_0x1f244c){while(--_0x1f244c){_0x186873['push'](_0x186873['shift']());}};_0x1b01e1(++_0x8b4d60);}(_0x888b,0xeb));var _0xb888=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x888b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb888('0x0'));var util=require(_0xb888('0x1'));var moment=require(_0xb888('0x2'));var BPromise=require(_0xb888('0x3'));var rs=require(_0xb888('0x4'));var fs=require('fs');var Redis=require(_0xb888('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb888('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb888('0x7')][_0xb888('0x8')]({'port':0x232a});config[_0xb888('0x9')]=_[_0xb888('0xa')](config[_0xb888('0x9')],{'host':_0xb888('0xb'),'port':0x18eb});var socket=require(_0xb888('0xc'))(new Redis(config['redis']));require(_0xb888('0xd'))[_0xb888('0xe')](socket);function respondWithRpcPromise(_0x3f6513,_0x3952dc,_0x2aff35){return new BPromise(function(_0x57e214,_0x4a949c){return client['request'](_0x3f6513,_0x2aff35)['then'](function(_0x2e7f7b){logger['info'](_0xb888('0xf'),_0x3952dc,'request\x20sent');logger[_0xb888('0x10')](_0xb888('0x11'),_0x3952dc,_0xb888('0x12'),JSON[_0xb888('0x13')](_0x2e7f7b));if(_0x2e7f7b['error']){if(_0x2e7f7b[_0xb888('0x14')][_0xb888('0x15')]===0x1f4){logger[_0xb888('0x14')](_0xb888('0xf'),_0x3952dc,_0x2e7f7b[_0xb888('0x14')][_0xb888('0x16')]);return _0x4a949c(_0x2e7f7b[_0xb888('0x14')][_0xb888('0x16')]);}logger[_0xb888('0x14')](_0xb888('0xf'),_0x3952dc,_0x2e7f7b[_0xb888('0x14')]['message']);return _0x57e214(_0x2e7f7b[_0xb888('0x14')][_0xb888('0x16')]);}else{logger[_0xb888('0x17')](_0xb888('0xf'),_0x3952dc,_0xb888('0x12'));_0x57e214(_0x2e7f7b[_0xb888('0x18')][_0xb888('0x16')]);}})[_0xb888('0x19')](function(_0x1f8bb2){logger[_0xb888('0x14')](_0xb888('0xf'),_0x3952dc,_0x1f8bb2);_0x4a949c(_0x1f8bb2);});});}exports['GetUser']=function(_0x39be55){var _0x491bc9=this;return new Promise(function(_0x38effa,_0x4f45ba){return db[_0xb888('0x1a')][_0xb888('0x1b')]({'raw':_0x39be55[_0xb888('0x1c')]?_0x39be55['options'][_0xb888('0x1d')]===undefined?!![]:![]:!![],'where':_0x39be55['options']?_0x39be55[_0xb888('0x1c')][_0xb888('0x1e')]||null:null,'attributes':_0x39be55[_0xb888('0x1c')]?_0x39be55['options'][_0xb888('0x1f')]||null:null,'limit':_0x39be55[_0xb888('0x1c')]?_0x39be55[_0xb888('0x1c')][_0xb888('0x20')]||null:null,'include':_0x39be55['options']?_0x39be55[_0xb888('0x1c')][_0xb888('0x21')]?_[_0xb888('0x22')](_0x39be55[_0xb888('0x1c')][_0xb888('0x21')],function(_0x3c1f7d){return{'model':db[_0x3c1f7d['model']],'as':_0x3c1f7d['as'],'attributes':_0x3c1f7d[_0xb888('0x1f')],'include':_0x3c1f7d[_0xb888('0x21')]?_['map'](_0x3c1f7d[_0xb888('0x21')],function(_0x5d5cd7){return{'model':db[_0x5d5cd7[_0xb888('0x23')]],'as':_0x5d5cd7['as'],'attributes':_0x5d5cd7[_0xb888('0x1f')],'include':_0x5d5cd7[_0xb888('0x21')]?_['map'](_0x5d5cd7[_0xb888('0x21')],function(_0x5b553c){return{'model':db[_0x5b553c['model']],'as':_0x5b553c['as'],'attributes':_0x5b553c[_0xb888('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb888('0x24')](function(_0x5080a3){logger[_0xb888('0x17')](_0xb888('0x25'),_0x39be55);logger[_0xb888('0x10')](_0xb888('0x25'),_0x39be55,JSON[_0xb888('0x13')](_0x5080a3));_0x38effa(_0x5080a3);})[_0xb888('0x19')](function(_0x2fcc76){logger['error'](_0xb888('0x25'),_0x2fcc76[_0xb888('0x16')],_0x39be55);_0x4f45ba(_0x491bc9[_0xb888('0x14')](0x1f4,_0x2fcc76[_0xb888('0x16')]));});});};exports[_0xb888('0x26')]=function(_0x554e85){var _0x1125b5=this;return new Promise(function(_0x240ec2,_0x2e9337){return db[_0xb888('0x1a')][_0xb888('0x27')]({'raw':_0x554e85['options']?_0x554e85[_0xb888('0x1c')][_0xb888('0x1d')]===undefined?!![]:![]:!![],'where':_0x554e85[_0xb888('0x1c')]?_0x554e85[_0xb888('0x1c')][_0xb888('0x1e')]||null:null,'attributes':_0x554e85[_0xb888('0x1c')]?_0x554e85[_0xb888('0x1c')][_0xb888('0x1f')]||null:null,'include':_0x554e85[_0xb888('0x1c')]?_0x554e85[_0xb888('0x1c')][_0xb888('0x21')]?_[_0xb888('0x22')](_0x554e85[_0xb888('0x1c')][_0xb888('0x21')],function(_0x1763d9){return{'model':db[_0x1763d9[_0xb888('0x23')]],'as':_0x1763d9['as'],'attributes':_0x1763d9[_0xb888('0x1f')],'include':_0x1763d9['include']?_['map'](_0x1763d9['include'],function(_0x57d3c2){return{'model':db[_0x57d3c2[_0xb888('0x23')]],'as':_0x57d3c2['as'],'attributes':_0x57d3c2[_0xb888('0x1f')],'include':_0x57d3c2['include']?_['map'](_0x57d3c2[_0xb888('0x21')],function(_0x2fc56a){return{'model':db[_0x2fc56a[_0xb888('0x23')]],'as':_0x2fc56a['as'],'attributes':_0x2fc56a[_0xb888('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb888('0x24')](function(_0x395010){logger['info'](_0xb888('0x26'),_0x554e85);logger['debug'](_0xb888('0x26'),_0x554e85,JSON[_0xb888('0x13')](_0x395010));_0x240ec2(_0x395010);})[_0xb888('0x19')](function(_0x3d265e){logger[_0xb888('0x14')](_0xb888('0x26'),_0x3d265e[_0xb888('0x16')],_0x554e85);_0x2e9337(_0x1125b5[_0xb888('0x14')](0x1f4,_0x3d265e[_0xb888('0x16')]));});});};exports['PauseUser']=function(_0x5d5ef8){var _0x58b135=this;return new Promise(function(_0x4ac28a,_0x3ff30c){var _0x646a4e;return db['User']['find']({'where':_0x5d5ef8['options'][_0xb888('0x1e')]||{},'attributes':['id',_0xb888('0x28'),_0xb888('0x29'),_0xb888('0x2a'),_0xb888('0x2b')]})[_0xb888('0x24')](function(_0xfa3b11){if(_0xfa3b11){_0x646a4e=_0xfa3b11;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x646a4e['id']},'individualHooks':!![]});}})[_0xb888('0x24')](function(){if(_0x646a4e){return db[_0xb888('0x2c')]['findAll']({'where':{'membername':_0x646a4e[_0xb888('0x28')],'type':'PAUSE','exitAt':null}});}})[_0xb888('0x24')](function(_0x3e992f){if(_0x646a4e){if(_0x3e992f&&_0x3e992f[_0xb888('0x2d')]){var _0x4f0d15=moment()['format'](_0xb888('0x2e'));for(var _0x282e63=0x0,_0x389d4a=_0x3e992f['length'];_0x282e63<_0x389d4a;_0x282e63++){_0x3e992f[_0x282e63][_0xb888('0x2f')]({'exitAt':_0x4f0d15});}}}})[_0xb888('0x24')](function(){if(_0x646a4e){var _0x1918fd=[];var _0x3db5eb=utils[_0xb888('0x30')]();_0x3db5eb[_0xb888('0x31')](function(_0x20264c){_0x1918fd[_0xb888('0x32')]({'channel':_0x20264c,'membername':_0x646a4e[_0xb888('0x28')],'interface':_[_0xb888('0x33')](_0x646a4e['interface'])?util[_0xb888('0x34')](_0xb888('0x35'),_0x646a4e[_0xb888('0x28')]):_0x646a4e[_0xb888('0x2b')],'type':'PAUSE','enterAt':moment()['format'](_0xb888('0x2e')),'data1':_0x5d5ef8['body']['type']||'DEFAULT\x20PAUSE','role':_0x646a4e['role'],'internal':_0x646a4e[_0xb888('0x2a')],'uniqueid':_0x5d5ef8['body'][_0xb888('0x36')]||null});});return db[_0xb888('0x2c')][_0xb888('0x37')](_0x1918fd,{'individualHooks':!![]});}})[_0xb888('0x24')](function(){if(_0x646a4e){return _0x646a4e[_0xb888('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5d5ef8[_0xb888('0x39')][_0xb888('0x3a')]||_0xb888('0x3b'),'lastPauseAt':moment()[_0xb888('0x34')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb888('0x24')](function(_0x46ea0f){_0x4ac28a(_0x46ea0f);})[_0xb888('0x19')](function(_0x4f063a){_0x3ff30c(_0x58b135['error'](0x1f4,_0x4f063a[_0xb888('0x16')]));});});};exports['UnpauseUser']=function(_0x2dfc34){var _0x1699ba=this;return new Promise(function(_0x29ab86,_0x528687){var _0x34230f;return db['User'][_0xb888('0x3c')]({'where':_0x2dfc34[_0xb888('0x1c')][_0xb888('0x1e')]||{},'attributes':['id',_0xb888('0x28')]})[_0xb888('0x24')](function(_0x3b7471){if(_0x3b7471){_0x34230f=_0x3b7471;if(_0x2dfc34[_0xb888('0x39')][_0xb888('0x3d')]&&!utils[_0xb888('0x3e')](_0x2dfc34['body'][_0xb888('0x3d')])){throw new Error(_0xb888('0x3f'));}switch(_0x2dfc34[_0xb888('0x39')]['channel']){case _0xb888('0x40'):return db[_0xb888('0x41')][_0xb888('0x38')]({'paused':0x0},{'where':{'UserId':_0x34230f['id']}})['then'](function(){return db[_0xb888('0x2c')][_0xb888('0x27')]({'where':{'channel':_0x2dfc34[_0xb888('0x39')][_0xb888('0x3d')],'membername':_0x34230f[_0xb888('0x28')],'type':_0xb888('0x42'),'exitAt':null}});})['then'](function(_0xfe24cc){if(_0xfe24cc){return _0xfe24cc['update']({'exitAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'data2':_0xb888('0x43')},{'individualHooks':!![]});}return null;})[_0xb888('0x24')](function(){return _0x34230f[_0xb888('0x38')]({'voicePause':![]});});case _0xb888('0x44'):case _0xb888('0x45'):case _0xb888('0x46'):case _0xb888('0x47'):case'openchannel':case'whatsapp':return db['MemberReport'][_0xb888('0x27')]({'where':{'channel':_0x2dfc34[_0xb888('0x39')]['channel'],'membername':_0x34230f[_0xb888('0x28')],'type':'PAUSE','exitAt':null}})[_0xb888('0x24')](function(_0x4a27b0){return _0x4a27b0['update']({'exitAt':moment()['format'](_0xb888('0x2e')),'data2':'system'},{'individualHooks':!![]});})[_0xb888('0x24')](function(){var _0x1c32ec={};_[_0xb888('0x48')](_0x1c32ec,util[_0xb888('0x34')](_0xb888('0x49'),_0x2dfc34[_0xb888('0x39')][_0xb888('0x3d')],_0xb888('0x4a')),![]);return _0x34230f[_0xb888('0x38')](_0x1c32ec);});default:return db[_0xb888('0x41')][_0xb888('0x38')]({'paused':0x0},{'where':{'UserId':_0x34230f['id']}})[_0xb888('0x24')](function(){return db[_0xb888('0x2c')][_0xb888('0x1b')]({'where':{'membername':_0x34230f[_0xb888('0x28')],'type':_0xb888('0x42'),'exitAt':null}});})[_0xb888('0x24')](function(_0x3a7aee){var _0xa6345b=[];_0x3a7aee[_0xb888('0x31')](function(_0x1d2bfc){_0xa6345b[_0xb888('0x32')](_0x1d2bfc[_0xb888('0x38')]({'exitAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'data2':_0xb888('0x43')}));});return BPromise[_0xb888('0x4b')](_0xa6345b);})[_0xb888('0x24')](function(){return _0x34230f[_0xb888('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xb888('0x24')](function(_0x32f512){_0x29ab86(_0x32f512);})[_0xb888('0x19')](function(_0x2563d6){_0x528687(_0x1699ba[_0xb888('0x14')](0x1f4,_0x2563d6[_0xb888('0x16')]));});});};exports[_0xb888('0x4c')]=function(_0x3371ca){var _0x53794d=this;return new Promise(function(_0x1df27f,_0x343f72){var _0x1e7fc4;return db[_0xb888('0x1a')]['findOne']({'where':_0x3371ca[_0xb888('0x1c')][_0xb888('0x1e')]||{},'attributes':['id',_0xb888('0x28')]})[_0xb888('0x24')](function(_0x2ab614){if(_0x2ab614){_0x1e7fc4=_0x2ab614;return db[_0xb888('0x41')][_0xb888('0x4d')]({'where':{'membername':_0x1e7fc4[_0xb888('0x28')]},'individualHooks':!![]});}})[_0xb888('0x24')](function(){if(_0x1e7fc4){return db['MemberReport'][_0xb888('0x1b')]({'where':{'membername':_0x1e7fc4[_0xb888('0x28')],'exitAt':null}});}})[_0xb888('0x24')](function(_0x550515){if(_0x1e7fc4){if(_0x550515&&_0x550515['length']){var _0x53c8d9=[];_0x550515[_0xb888('0x31')](function(_0x464910){_0x53c8d9[_0xb888('0x32')](_0x464910[_0xb888('0x38')]({'exitAt':moment()[_0xb888('0x34')](_0xb888('0x2e'))}));});return BPromise[_0xb888('0x4b')](_0x53c8d9);}}})[_0xb888('0x24')](function(){if(_0x1e7fc4){return _0x1e7fc4[_0xb888('0x38')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xb888('0x24')](function(_0x3efbab){_0x1df27f(_0x3efbab);})[_0xb888('0x19')](function(_0x2cd823){_0x343f72(_0x53794d[_0xb888('0x14')](0x1f4,_0x2cd823[_0xb888('0x16')]));});});};exports[_0xb888('0x4e')]=function(_0x21b77b){var _0xe5c5a9=this;return new Promise(function(_0x21dce4,_0x4dd2f7){var _0x23b149;var _0x5c3ff9;var _0x329016;var _0xf0fc2e;return db[_0xb888('0x1a')][_0xb888('0x3c')]({'where':_0x21b77b[_0xb888('0x1c')][_0xb888('0x1e')]||{},'attributes':['id',_0xb888('0x28'),_0xb888('0x29'),_0xb888('0x4f'),_0xb888('0x50'),_0xb888('0x2a'),_0xb888('0x51'),_0xb888('0x2b')]})[_0xb888('0x24')](function(_0x2aa55e){if(_0x2aa55e){_0x23b149=_0x2aa55e;_0xf0fc2e=_0x21b77b[_0xb888('0x39')][_0xb888('0x2b')]?_0x21b77b[_0xb888('0x39')][_0xb888('0x2b')]:util[_0xb888('0x34')](_0xb888('0x35'),_0x23b149[_0xb888('0x28')]);return db[_0xb888('0x1a')][_0xb888('0x52')]({'where':{'role':_0xb888('0x53'),'online':!![],'id':{'$ne':_0x23b149['id']}}});}})[_0xb888('0x24')](function(_0x4d5380){if(_0x4d5380){_0x329016=_0x4d5380;return require(_0xb888('0x54'))[_0xb888('0x55')]();}})[_0xb888('0x24')](function(_0x530be8){if(_0x530be8&&_0x530be8[_0xb888('0x56')]&&_0x329016>=_0x530be8[_0xb888('0x56')]){throw new Error(_0xb888('0x57'));}})[_0xb888('0x24')](function(){if(_0x23b149){return db[_0xb888('0x41')][_0xb888('0x4d')]({'where':{'membername':_0x23b149[_0xb888('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x23b149){return _0x23b149[_0xb888('0x58')]({'raw':!![]});}})[_0xb888('0x24')](function(_0x5d770c){if(_0x23b149){if(_0x5d770c){var _0x414351=[];_0x5c3ff9=_0x5d770c;if(_0x5c3ff9[_0xb888('0x2d')]){for(var _0x1a92e4=0x0;_0x1a92e4<_0x5c3ff9[_0xb888('0x2d')];_0x1a92e4++){_0x414351['push'](db[_0xb888('0x41')][_0xb888('0x59')]({'membername':_0x23b149['name'],'UserId':_0x23b149['id'],'queue_name':_0x5c3ff9[_0x1a92e4][_0xb888('0x28')],'VoiceQueueId':_0x5c3ff9[_0x1a92e4]['id'],'interface':_0xf0fc2e,'paused':_0x23b149[_0xb888('0x51')]||![],'penalty':_0x5c3ff9[_0x1a92e4][_0xb888('0x5a')]||0x0}));}return BPromise[_0xb888('0x4b')](_0x414351);}}}})[_0xb888('0x24')](function(){if(_0x23b149){return db[_0xb888('0x2c')][_0xb888('0x1b')]({'where':{'membername':_0x23b149[_0xb888('0x28')],'exitAt':null}});}})[_0xb888('0x24')](function(_0x14b87d){if(_0x23b149){if(_0x14b87d&&_0x14b87d[_0xb888('0x2d')]){var _0x5d3193=[];_0x14b87d[_0xb888('0x31')](function(_0x17a24d){_0x5d3193[_0xb888('0x32')](_0x17a24d[_0xb888('0x38')]({'exitAt':moment()[_0xb888('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb888('0x4b')](_0x5d3193);}}})[_0xb888('0x24')](function(_0x738aa9){if(_0x23b149){var _0x32a4d2=[];var _0x3f09ab=[];var _0x5abded=utils[_0xb888('0x30')]();var _0x4d6428={'membername':_0x23b149[_0xb888('0x28')],'interface':_0xf0fc2e,'enterAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'role':_0x23b149[_0xb888('0x29')],'internal':_0x23b149[_0xb888('0x2a')]};_0x5abded[_0xb888('0x31')](function(_0x41b5e6){_0x32a4d2[_0xb888('0x32')](_[_0xb888('0x5b')]({'channel':_0x41b5e6,'type':'LOGIN','data1':_0xb888('0x5c'),'data2':_0xf0fc2e},_0x4d6428));if(_0x23b149[_0xb888('0x51')]){_0x3f09ab[_0xb888('0x32')](_[_0xb888('0x5b')]({'channel':_0x41b5e6,'type':'PAUSE','data1':'LOGININPAUSE'},_0x4d6428));}});return db[_0xb888('0x2c')][_0xb888('0x37')](_0x32a4d2[_0xb888('0x5d')](_0x3f09ab),{'individualHooks':!![]});}})['then'](function(){if(_0x23b149){return _0x23b149['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb888('0x2e')),'voicePause':_0x23b149['loginInPause']||![],'mailPause':_0x23b149[_0xb888('0x51')]||![],'chatPause':_0x23b149['loginInPause']||![],'faxPause':_0x23b149['loginInPause']||![],'smsPause':_0x23b149[_0xb888('0x51')]||![],'openchannelPause':_0x23b149['loginInPause']||![],'pauseType':_0x23b149[_0xb888('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'interface':_0xf0fc2e});}})['then'](function(_0xe7e8f6){_0x21dce4(_0xe7e8f6);})[_0xb888('0x19')](function(_0xa78126){_0x4dd2f7(_0xe5c5a9[_0xb888('0x14')](0x1f4,_0xa78126['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1493987..bed555e 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 _0xa87f=['user:','./user.events','update','emit','length'];(function(_0x4fcea7,_0x575432){var _0x247b9f=function(_0x1a6249){while(--_0x1a6249){_0x4fcea7['push'](_0x4fcea7['shift']());}};_0x247b9f(++_0x575432);}(_0xa87f,0x169));var _0xfa87=function(_0x13b8f7,_0x44d129){_0x13b8f7=_0x13b8f7-0x0;var _0x2c5c95=_0xa87f[_0x13b8f7];return _0x2c5c95;};'use strict';var UserEvents=require(_0xfa87('0x0'));var events=['save','remove',_0xfa87('0x1')];function createListener(_0x1d29e5,_0x594b48){return function(_0x33ec11){_0x594b48[_0xfa87('0x2')](_0x1d29e5,_0x33ec11);};}function removeListener(_0x3858fe,_0x270c3e){return function(){UserEvents['removeListener'](_0x3858fe,_0x270c3e);};}exports['register']=function(_0x436f45){for(var _0x53c949=0x0,_0x27bbed=events[_0xfa87('0x3')];_0x53c949<_0x27bbed;_0x53c949++){var _0xb45911=events[_0x53c949];var _0x554384=createListener(_0xfa87('0x4')+_0xb45911,_0x436f45);UserEvents['on'](_0xb45911,_0x554384);}}; \ No newline at end of file +var _0xf2fd=['emit','register','length','user:','./user.events','update'];(function(_0x3eb8a1,_0x5b5f08){var _0x45938e=function(_0xea3246){while(--_0xea3246){_0x3eb8a1['push'](_0x3eb8a1['shift']());}};_0x45938e(++_0x5b5f08);}(_0xf2fd,0x9a));var _0xdf2f=function(_0x3df56d,_0x4297d1){_0x3df56d=_0x3df56d-0x0;var _0x2a7a69=_0xf2fd[_0x3df56d];return _0x2a7a69;};'use strict';var UserEvents=require(_0xdf2f('0x0'));var events=['save','remove',_0xdf2f('0x1')];function createListener(_0x1d3925,_0x31ce93){return function(_0xc46915){_0x31ce93[_0xdf2f('0x2')](_0x1d3925,_0xc46915);};}function removeListener(_0x4287b4,_0x14bb3c){return function(){UserEvents['removeListener'](_0x4287b4,_0x14bb3c);};}exports[_0xdf2f('0x3')]=function(_0x3d36b7){for(var _0xbd4fa1=0x0,_0xb7b584=events[_0xdf2f('0x4')];_0xbd4fa1<_0xb7b584;_0xbd4fa1++){var _0xa89077=events[_0xbd4fa1];var _0x5d9c08=createListener(_0xdf2f('0x5')+_0xa89077,_0x3d36b7);UserEvents['on'](_0xa89077,_0x5d9c08);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a8aa6c0..68c5d52 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x58d446,_0x16d502){var _0x55dc47=function(_0x8202d){while(--_0x8202d){_0x58d446['push'](_0x58d446['shift']());}};_0x55dc47(++_0x16d502);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x41a5cc,_0x3b0082){var _0x25f138=function(_0x1e432d){while(--_0x1e432d){_0x41a5cc['push'](_0x41a5cc['shift']());}};_0x25f138(++_0x3b0082);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0xcb91[_0x593d89];return _0x4aa403;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index cf5c23d..9006424 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 _0x8f3a=['INTEGER','sequelize','exports'];(function(_0x5031c3,_0x4c5c5f){var _0x32f74d=function(_0x3470bb){while(--_0x3470bb){_0x5031c3['push'](_0x5031c3['shift']());}};_0x32f74d(++_0x4c5c5f);}(_0x8f3a,0xa9));var _0xa8f3=function(_0x22cdb5,_0x3a0f92){_0x22cdb5=_0x22cdb5-0x0;var _0x143dfc=_0x8f3a[_0x22cdb5];return _0x143dfc;};'use strict';var Sequelize=require(_0xa8f3('0x0'));module[_0xa8f3('0x1')]={'penalty':{'type':Sequelize[_0xa8f3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 2e076c7..db1d09c 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 _0x5658=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','util','../../config/logger','api','bluebird'];(function(_0x45cfb1,_0x5b67b0){var _0x1a7dd4=function(_0xd71289){while(--_0xd71289){_0x45cfb1['push'](_0x45cfb1['shift']());}};_0x1a7dd4(++_0x5b67b0);}(_0x5658,0xcd));var _0x8565=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5658[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x8565('0x0'));var logger=require(_0x8565('0x1'))(_0x8565('0x2'));var moment=require('moment');var BPromise=require(_0x8565('0x3'));var rp=require(_0x8565('0x4'));var fs=require('fs');var path=require(_0x8565('0x5'));var rimraf=require(_0x8565('0x6'));var config=require(_0x8565('0x7'));var attributes=require(_0x8565('0x8'));module[_0x8565('0x9')]=function(_0x260092,_0x25ed2c){return _0x260092[_0x8565('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c46=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','request-promise'];(function(_0x665328,_0x196657){var _0xfdaf67=function(_0x4ea406){while(--_0x4ea406){_0x665328['push'](_0x665328['shift']());}};_0xfdaf67(++_0x196657);}(_0x9c46,0x19f));var _0x69c4=function(_0x3c7ed0,_0x25a399){_0x3c7ed0=_0x3c7ed0-0x0;var _0x3a7307=_0x9c46[_0x3c7ed0];return _0x3a7307;};'use strict';var _=require(_0x69c4('0x0'));var util=require(_0x69c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x69c4('0x2'));var BPromise=require(_0x69c4('0x3'));var rp=require(_0x69c4('0x4'));var fs=require('fs');var path=require(_0x69c4('0x5'));var rimraf=require(_0x69c4('0x6'));var config=require(_0x69c4('0x7'));var attributes=require(_0x69c4('0x8'));module[_0x69c4('0x9')]=function(_0x32c492,_0x813af){return _0x32c492['define'](_0x69c4('0xa'),attributes,{'tableName':_0x69c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index e910935..ab03779 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 _0x64ac=['UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x539228,_0x2168c9){var _0x59aa15=function(_0x3bc165){while(--_0x3bc165){_0x539228['push'](_0x539228['shift']());}};_0x59aa15(++_0x2168c9);}(_0x64ac,0x129));var _0xc64a=function(_0xfaa28f,_0x2512b5){_0xfaa28f=_0xfaa28f-0x0;var _0x4b1006=_0x64ac[_0xfaa28f];return _0x4b1006;};'use strict';var _=require(_0xc64a('0x0'));var util=require('util');var moment=require(_0xc64a('0x1'));var BPromise=require(_0xc64a('0x2'));var rs=require(_0xc64a('0x3'));var fs=require('fs');var Redis=require(_0xc64a('0x4'));var db=require(_0xc64a('0x5'))['db'];var utils=require(_0xc64a('0x6'));var logger=require(_0xc64a('0x7'))(_0xc64a('0x8'));var config=require(_0xc64a('0x9'));var jayson=require(_0xc64a('0xa'));var client=jayson['client'][_0xc64a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d1b20,_0x23081a,_0x3afea6){return new BPromise(function(_0x2601a2,_0x4a910d){return client[_0xc64a('0xc')](_0x2d1b20,_0x3afea6)[_0xc64a('0xd')](function(_0x38f777){logger[_0xc64a('0xe')](_0xc64a('0xf'),_0x23081a,'request\x20sent');logger[_0xc64a('0x10')](_0xc64a('0x11'),_0x23081a,_0xc64a('0x12'),JSON[_0xc64a('0x13')](_0x38f777));if(_0x38f777[_0xc64a('0x14')]){if(_0x38f777['error'][_0xc64a('0x15')]===0x1f4){logger['error'](_0xc64a('0xf'),_0x23081a,_0x38f777['error'][_0xc64a('0x16')]);return _0x4a910d(_0x38f777[_0xc64a('0x14')][_0xc64a('0x16')]);}logger[_0xc64a('0x14')](_0xc64a('0xf'),_0x23081a,_0x38f777['error'][_0xc64a('0x16')]);return _0x2601a2(_0x38f777[_0xc64a('0x14')][_0xc64a('0x16')]);}else{logger[_0xc64a('0xe')](_0xc64a('0xf'),_0x23081a,_0xc64a('0x12'));_0x2601a2(_0x38f777[_0xc64a('0x17')]['message']);}})['catch'](function(_0x222a8b){logger['error'](_0xc64a('0xf'),_0x23081a,_0x222a8b);_0x4a910d(_0x222a8b);});});} \ No newline at end of file +var _0xa899=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x42f314,_0x88895f){var _0xc57a42=function(_0x16c690){while(--_0x16c690){_0x42f314['push'](_0x42f314['shift']());}};_0xc57a42(++_0x88895f);}(_0xa899,0x67));var _0x9a89=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xa899[_0x24618a];return _0x2e3d64;};'use strict';var _=require(_0x9a89('0x0'));var util=require('util');var moment=require(_0x9a89('0x1'));var BPromise=require(_0x9a89('0x2'));var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))('rpc');var config=require(_0x9a89('0x8'));var jayson=require(_0x9a89('0x9'));var client=jayson[_0x9a89('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cdf74,_0x151332,_0x39686a){return new BPromise(function(_0x1f7bb5,_0x2d888b){return client['request'](_0x3cdf74,_0x39686a)['then'](function(_0x8ec9a2){logger[_0x9a89('0xb')](_0x9a89('0xc'),_0x151332,_0x9a89('0xd'));logger[_0x9a89('0xe')](_0x9a89('0xf'),_0x151332,_0x9a89('0xd'),JSON[_0x9a89('0x10')](_0x8ec9a2));if(_0x8ec9a2[_0x9a89('0x11')]){if(_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x12')]===0x1f4){logger['error'](_0x9a89('0xc'),_0x151332,_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);return _0x2d888b(_0x8ec9a2[_0x9a89('0x11')]['message']);}logger['error'](_0x9a89('0xc'),_0x151332,_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);return _0x1f7bb5(_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);}else{logger[_0x9a89('0xb')](_0x9a89('0xc'),_0x151332,'request\x20sent');_0x1f7bb5(_0x8ec9a2['result'][_0x9a89('0x13')]);}})[_0x9a89('0x14')](function(_0x83df58){logger[_0x9a89('0x11')](_0x9a89('0xc'),_0x151332,_0x83df58);_0x2d888b(_0x83df58);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 82de890..c207192 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x301566,_0x4a8dab){var _0x2c80fd=function(_0x4896af){while(--_0x4896af){_0x301566['push'](_0x301566['shift']());}};_0x2c80fd(++_0x4a8dab);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 5a4a437..9073dda 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 _0xf426=['exports','INTEGER'];(function(_0x342e40,_0x29046b){var _0x2a3377=function(_0x4f7fd8){while(--_0x4f7fd8){_0x342e40['push'](_0x342e40['shift']());}};_0x2a3377(++_0x29046b);}(_0xf426,0x7c));var _0x6f42=function(_0x2673c1,_0x489c00){_0x2673c1=_0x2673c1-0x0;var _0x46bde=_0xf426[_0x2673c1];return _0x46bde;};'use strict';var Sequelize=require('sequelize');module[_0x6f42('0x0')]={'penalty':{'type':Sequelize[_0x6f42('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6f42('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecf8=['INTEGER','STRING','exports'];(function(_0x5a3db4,_0x5ea07e){var _0x3211c3=function(_0x45da4f){while(--_0x45da4f){_0x5a3db4['push'](_0x5a3db4['shift']());}};_0x3211c3(++_0x5ea07e);}(_0xecf8,0x14c));var _0x8ecf=function(_0x516bc0,_0x577539){_0x516bc0=_0x516bc0-0x0;var _0x25ba14=_0xecf8[_0x516bc0];return _0x25ba14;};'use strict';var Sequelize=require('sequelize');module[_0x8ecf('0x0')]={'penalty':{'type':Sequelize[_0x8ecf('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8ecf('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8ecf('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bdd394e..c5614bf 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 _0xb670=['../../config/environment','./userFaxQueue.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb670,0xeb));var _0x0b67=function(_0x7beb1e,_0x112d19){_0x7beb1e=_0x7beb1e-0x0;var _0xfb137b=_0xb670[_0x7beb1e];return _0xfb137b;};'use strict';var _=require(_0x0b67('0x0'));var util=require('util');var logger=require(_0x0b67('0x1'))(_0x0b67('0x2'));var moment=require(_0x0b67('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b67('0x4'));var fs=require('fs');var path=require(_0x0b67('0x5'));var rimraf=require(_0x0b67('0x6'));var config=require(_0x0b67('0x7'));var attributes=require(_0x0b67('0x8'));module[_0x0b67('0x9')]=function(_0x5891ab,_0x918e38){return _0x5891ab[_0x0b67('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2115=['../../config/logger','api','bluebird','path','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x26d4f4,_0x4b9b22){var _0x50fc2d=function(_0x9a1fe2){while(--_0x9a1fe2){_0x26d4f4['push'](_0x26d4f4['shift']());}};_0x50fc2d(++_0x4b9b22);}(_0x2115,0x8b));var _0x5211=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x2115[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x5211('0x0'));var util=require('util');var logger=require(_0x5211('0x1'))(_0x5211('0x2'));var moment=require('moment');var BPromise=require(_0x5211('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5211('0x4'));var rimraf=require('rimraf');var config=require(_0x5211('0x5'));var attributes=require(_0x5211('0x6'));module['exports']=function(_0xa0f528,_0x1afa05){return _0xa0f528[_0x5211('0x7')](_0x5211('0x8'),attributes,{'tableName':_0x5211('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 40871a2..8911400 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 _0x0419=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x1ccc9a,_0x3065fd){var _0x430d34=function(_0x35e9fe){while(--_0x35e9fe){_0x1ccc9a['push'](_0x1ccc9a['shift']());}};_0x430d34(++_0x3065fd);}(_0x0419,0x153));var _0x9041=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0x0419[_0x3cb152];return _0x4f54c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9041('0x0'));var BPromise=require(_0x9041('0x1'));var rs=require(_0x9041('0x2'));var fs=require('fs');var Redis=require(_0x9041('0x3'));var db=require(_0x9041('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9041('0x5'));var config=require(_0x9041('0x6'));var jayson=require(_0x9041('0x7'));var client=jayson[_0x9041('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x118c44,_0x11a488,_0x5457be){return new BPromise(function(_0x48ac45,_0x39296c){return client[_0x9041('0x9')](_0x118c44,_0x5457be)[_0x9041('0xa')](function(_0x5afe95){logger[_0x9041('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x11a488,_0x9041('0xc'));logger[_0x9041('0xd')](_0x9041('0xe'),_0x11a488,'request\x20sent',JSON['stringify'](_0x5afe95));if(_0x5afe95[_0x9041('0xf')]){if(_0x5afe95[_0x9041('0xf')]['code']===0x1f4){logger['error'](_0x9041('0x10'),_0x11a488,_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);return _0x39296c(_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);}logger[_0x9041('0xf')](_0x9041('0x10'),_0x11a488,_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);return _0x48ac45(_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x11a488,'request\x20sent');_0x48ac45(_0x5afe95[_0x9041('0x12')][_0x9041('0x11')]);}})[_0x9041('0x13')](function(_0x54c323){logger[_0x9041('0xf')](_0x9041('0x10'),_0x11a488,_0x54c323);_0x39296c(_0x54c323);});});} \ No newline at end of file +var _0xbdb6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x798848,_0x324311){var _0x2501b6=function(_0x31e392){while(--_0x31e392){_0x798848['push'](_0x798848['shift']());}};_0x2501b6(++_0x324311);}(_0xbdb6,0x164));var _0x6bdb=function(_0x5e0ca0,_0x3f3560){_0x5e0ca0=_0x5e0ca0-0x0;var _0x3dd119=_0xbdb6[_0x5e0ca0];return _0x3dd119;};'use strict';var _=require(_0x6bdb('0x0'));var util=require(_0x6bdb('0x1'));var moment=require(_0x6bdb('0x2'));var BPromise=require(_0x6bdb('0x3'));var rs=require(_0x6bdb('0x4'));var fs=require('fs');var Redis=require(_0x6bdb('0x5'));var db=require(_0x6bdb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6bdb('0x7'));var config=require(_0x6bdb('0x8'));var jayson=require(_0x6bdb('0x9'));var client=jayson[_0x6bdb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x521adf,_0x2647db,_0x27c32a){return new BPromise(function(_0x463ef3,_0x8c9399){return client['request'](_0x521adf,_0x27c32a)[_0x6bdb('0xb')](function(_0x4badaf){logger[_0x6bdb('0xc')](_0x6bdb('0xd'),_0x2647db,_0x6bdb('0xe'));logger['debug'](_0x6bdb('0xf'),_0x2647db,_0x6bdb('0xe'),JSON['stringify'](_0x4badaf));if(_0x4badaf[_0x6bdb('0x10')]){if(_0x4badaf['error'][_0x6bdb('0x11')]===0x1f4){logger[_0x6bdb('0x10')](_0x6bdb('0xd'),_0x2647db,_0x4badaf[_0x6bdb('0x10')][_0x6bdb('0x12')]);return _0x8c9399(_0x4badaf['error'][_0x6bdb('0x12')]);}logger['error'](_0x6bdb('0xd'),_0x2647db,_0x4badaf['error'][_0x6bdb('0x12')]);return _0x463ef3(_0x4badaf[_0x6bdb('0x10')][_0x6bdb('0x12')]);}else{logger['info'](_0x6bdb('0xd'),_0x2647db,_0x6bdb('0xe'));_0x463ef3(_0x4badaf[_0x6bdb('0x13')][_0x6bdb('0x12')]);}})[_0x6bdb('0x14')](function(_0x3ecf52){logger[_0x6bdb('0x10')](_0x6bdb('0xd'),_0x2647db,_0x3ecf52);_0x8c9399(_0x3ecf52);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a2c8136..6e09205 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(_0x1d5fcd,_0x42d39e){var _0x12a3ce=function(_0xa042ea){while(--_0xa042ea){_0x1d5fcd['push'](_0x1d5fcd['shift']());}};_0x12a3ce(++_0x42d39e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xcb91[_0x4b7b69];return _0x173b4c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b47ba,_0x2aeb85){var _0x3d5034=function(_0x4c4f05){while(--_0x4c4f05){_0x4b47ba['push'](_0x4b47ba['shift']());}};_0x3d5034(++_0x2aeb85);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ac82bf1..acbe914 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 _0x7b06=['exports','INTEGER','sequelize'];(function(_0x2d73da,_0x4e9643){var _0x2d06af=function(_0x2f5810){while(--_0x2f5810){_0x2d73da['push'](_0x2d73da['shift']());}};_0x2d06af(++_0x4e9643);}(_0x7b06,0x173));var _0x67b0=function(_0xb91507,_0x1a4296){_0xb91507=_0xb91507-0x0;var _0x1f1136=_0x7b06[_0xb91507];return _0x1f1136;};'use strict';var Sequelize=require(_0x67b0('0x0'));module[_0x67b0('0x1')]={'penalty':{'type':Sequelize[_0x67b0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa925=['INTEGER'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa925,0x1b2));var _0x5a92=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa925[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5a92('0x0')],'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 654d12f..066f7fe 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 _0xb537=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','define','UserMailQueue','user_has_mail_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb537,0x1a2));var _0x7b53=function(_0x22f6c3,_0x2d3f84){_0x22f6c3=_0x22f6c3-0x0;var _0x5f398b=_0xb537[_0x22f6c3];return _0x5f398b;};'use strict';var _=require(_0x7b53('0x0'));var util=require(_0x7b53('0x1'));var logger=require(_0x7b53('0x2'))(_0x7b53('0x3'));var moment=require(_0x7b53('0x4'));var BPromise=require(_0x7b53('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b53('0x6'));var rimraf=require(_0x7b53('0x7'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x5ae932,_0x1b7b6f){return _0x5ae932[_0x7b53('0x8')](_0x7b53('0x9'),attributes,{'tableName':_0x7b53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7328=['define','UserMailQueue','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7328,0xa2));var _0x8732=function(_0x277ced,_0x44d15f){_0x277ced=_0x277ced-0x0;var _0x29b3fb=_0x7328[_0x277ced];return _0x29b3fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8732('0x0'))(_0x8732('0x1'));var moment=require(_0x8732('0x2'));var BPromise=require(_0x8732('0x3'));var rp=require(_0x8732('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8732('0x5'));var config=require(_0x8732('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x8732('0x7')]=function(_0x5a44a8,_0x1945e9){return _0x5a44a8[_0x8732('0x8')](_0x8732('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 914f3e5..5d517cf 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34c5f1,_0x54a8d7){var _0x4dfb2e=function(_0x50cc9e){while(--_0x50cc9e){_0x34c5f1['push'](_0x34c5f1['shift']());}};_0x4dfb2e(++_0x54a8d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2e0854,_0x52544a){_0x2e0854=_0x2e0854-0x0;var _0x4d0ff9=_0x7fbe[_0x2e0854];return _0x4d0ff9;};'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);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x64df79,_0x27d446){var _0x506e45=function(_0x102ccf){while(--_0x102ccf){_0x64df79['push'](_0x64df79['shift']());}};_0x506e45(++_0x27d446);}(_0x4b84,0x1cc));var _0x44b8=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4b84[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 936a616..75e0aae 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 _0x4f1f=['./userNotification.controller','post','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x552953,_0x32a66c){var _0x5f5a60=function(_0x1e679d){while(--_0x1e679d){_0x552953['push'](_0x552953['shift']());}};_0x5f5a60(++_0x32a66c);}(_0x4f1f,0x159));var _0xf4f1=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x4f1f[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0xf4f1('0x0'));var util=require(_0xf4f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf4f1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf4f1('0x3'));var interaction=require(_0xf4f1('0x4'));var config=require(_0xf4f1('0x5'));var controller=require(_0xf4f1('0x6'));router[_0xf4f1('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xf4f1('0x8')]=router; \ No newline at end of file +var _0xd59c=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e3398,_0x2b4b4d){var _0x18b770=function(_0x41bf07){while(--_0x41bf07){_0x4e3398['push'](_0x4e3398['shift']());}};_0x18b770(++_0x2b4b4d);}(_0xd59c,0x94));var _0xcd59=function(_0x4cbbde,_0x409fa9){_0x4cbbde=_0x4cbbde-0x0;var _0x33e8cd=_0xd59c[_0x4cbbde];return _0x33e8cd;};'use strict';var multer=require(_0xcd59('0x0'));var util=require(_0xcd59('0x1'));var path=require(_0xcd59('0x2'));var timeout=require(_0xcd59('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd59('0x4'));var auth=require(_0xcd59('0x5'));var interaction=require(_0xcd59('0x6'));var config=require(_0xcd59('0x7'));var controller=require('./userNotification.controller');router[_0xcd59('0x8')]('/',auth[_0xcd59('0x9')](),controller[_0xcd59('0xa')]);module[_0xcd59('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f62e6c2..5ba5b8b 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 _0xafc0=['sequelize','exports','TEXT','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xafc0,0x178));var _0x0afc=function(_0x4c7326,_0x18bf8d){_0x4c7326=_0x4c7326-0x0;var _0x447f07=_0xafc0[_0x4c7326];return _0x447f07;};'use strict';var Sequelize=require(_0x0afc('0x0'));module[_0x0afc('0x1')]={'body':{'type':Sequelize[_0x0afc('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0afc('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0afc('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xc7e7=['STRING','sequelize','exports','TEXT'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xc7e7,0xa1));var _0x7c7e=function(_0x1b3183,_0x3cfee8){_0x1b3183=_0x1b3183-0x0;var _0xe526a7=_0xc7e7[_0x1b3183];return _0xe526a7;};'use strict';var Sequelize=require(_0x7c7e('0x0'));module[_0x7c7e('0x1')]={'body':{'type':Sequelize[_0x7c7e('0x2')]},'senderName':{'type':Sequelize[_0x7c7e('0x3')]},'recipientsId':{'type':Sequelize[_0x7c7e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7c7e('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0027d7d..3656a44 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 _0x86b3=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userNotification.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','destroy','then','end','stack','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sequelize','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','ids','includes','replace','queue','push','flatten','getAgents','map','eml-format'];(function(_0x2313c5,_0x4cffa7){var _0x32e21f=function(_0x1d67b1){while(--_0x1d67b1){_0x2313c5['push'](_0x2313c5['shift']());}};_0x32e21f(++_0x4cffa7);}(_0x86b3,0xc3));var _0x386b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x86b3[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x386b('0x0'));var rimraf=require(_0x386b('0x1'));var zipdir=require(_0x386b('0x2'));var jsonpatch=require(_0x386b('0x3'));var rp=require(_0x386b('0x4'));var moment=require(_0x386b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x386b('0x6'));var util=require(_0x386b('0x7'));var path=require(_0x386b('0x8'));var sox=require('sox');var csv=require(_0x386b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x386b('0xa'));var squel=require('squel');var crypto=require(_0x386b('0xb'));var jsforce=require(_0x386b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x386b('0x9'));var querystring=require('querystring');var Papa=require(_0x386b('0xd'));var Redis=require(_0x386b('0xe'));var authService=require(_0x386b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x386b('0x10'));var hardwareService=require(_0x386b('0x11'));var logger=require(_0x386b('0x12'))(_0x386b('0x13'));var utils=require(_0x386b('0x14'));var config=require(_0x386b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x386b('0x16'))['db'];config[_0x386b('0x17')]=_['defaults'](config[_0x386b('0x17')],{'host':_0x386b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x386b('0x19'))[_0x386b('0x1a')](socket);function respondWithStatusCode(_0x565b61,_0x299306){_0x299306=_0x299306||0xcc;return function(_0x2d7680){if(_0x2d7680){return _0x565b61[_0x386b('0x1b')](_0x299306);}return _0x565b61[_0x386b('0x1c')](_0x299306)['end']();};}function respondWithResult(_0x258ec3,_0x4e8750){_0x4e8750=_0x4e8750||0xc8;return function(_0x19619a){if(_0x19619a){return _0x258ec3[_0x386b('0x1c')](_0x4e8750)[_0x386b('0x1d')](_0x19619a);}};}function respondWithFilteredResult(_0x394f1d,_0x361cb8){return function(_0x544401){if(_0x544401){var _0x425c61=typeof _0x361cb8[_0x386b('0x1e')]==='undefined'&&typeof _0x361cb8[_0x386b('0x1f')]===_0x386b('0x20');var _0x35d039=_0x544401['count'];var _0x4a4bdb=_0x425c61?0x0:_0x361cb8[_0x386b('0x1e')];var _0x10ea40=_0x425c61?_0x544401[_0x386b('0x21')]:_0x361cb8[_0x386b('0x1e')]+_0x361cb8[_0x386b('0x1f')];var _0x1a4684;if(_0x10ea40>=_0x35d039){_0x10ea40=_0x35d039;_0x1a4684=0xc8;}else{_0x1a4684=0xce;}_0x394f1d['status'](_0x1a4684);return _0x394f1d['set'](_0x386b('0x22'),_0x4a4bdb+'-'+_0x10ea40+'/'+_0x35d039)[_0x386b('0x1d')](_0x544401);}return null;};}function patchUpdates(_0x1aba5b){return function(_0x1f54a4){try{jsonpatch['apply'](_0x1f54a4,_0x1aba5b,!![]);}catch(_0x4a7c22){return BPromise[_0x386b('0x23')](_0x4a7c22);}return _0x1f54a4[_0x386b('0x24')]();};}function saveUpdates(_0x1375e7,_0x44ca48){return function(_0x4c20ae){if(_0x4c20ae){return _0x4c20ae[_0x386b('0x25')](_0x1375e7)['then'](function(_0x54e784){return _0x54e784;});}return null;};}function removeEntity(_0x531560,_0x42b915){return function(_0x52d917){if(_0x52d917){return _0x52d917[_0x386b('0x26')]()[_0x386b('0x27')](function(){_0x531560[_0x386b('0x1c')](0xcc)[_0x386b('0x28')]();});}};}function handleEntityNotFound(_0xf6065a,_0x2e4936){return function(_0x441863){if(!_0x441863){_0xf6065a['sendStatus'](0x194);}return _0x441863;};}function handleError(_0x1830c0,_0x31d3bb){_0x31d3bb=_0x31d3bb||0x1f4;return function(_0x1c7786){logger['error'](_0x1c7786[_0x386b('0x29')]);if(_0x1c7786['name']){delete _0x1c7786['name'];}_0x1830c0[_0x386b('0x1c')](_0x31d3bb)[_0x386b('0x2a')](_0x1c7786);};}exports[_0x386b('0x2b')]=function(_0x4f9162,_0x512d27,_0x5c420a){if(!_0x4f9162[_0x386b('0x2c')][_0x386b('0x2d')]('text')&&!_0x4f9162['body'][_0x386b('0x2d')](_0x386b('0x2e'))){throw new db[(_0x386b('0x2f'))][(_0x386b('0x30'))](_0x386b('0x31'));}else{if(_0x4f9162[_0x386b('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x4f9162['body'][_0x386b('0x2d')](_0x386b('0x32'))){throw new db[(_0x386b('0x2f'))][(_0x386b('0x30'))](_0x386b('0x33'));}if(!_0x4f9162[_0x386b('0x2c')][_0x386b('0x2d')](_0x386b('0x34'))){throw new db[(_0x386b('0x2f'))][(_0x386b('0x30'))](_0x386b('0x35'));}else{try{var _0x472797=JSON[_0x386b('0x36')](_0x4f9162[_0x386b('0x2c')][_0x386b('0x34')]);}catch(_0x2aa438){logger['error'](_0x2aa438);throw new db['Sequelize'][(_0x386b('0x30'))](_0x386b('0x37'));}var _0x32ae7d=[_0x386b('0x38'),_0x386b('0x39'),_0x386b('0x3a'),_0x386b('0x3b'),_0x386b('0x3c'),_0x386b('0x3d'),_0x386b('0x3e'),_0x386b('0x3f'),_0x386b('0x40')];if(_[_0x386b('0x41')](_0x472797,function(_0x1e0a21){return!_['includes'](_0x32ae7d,_0x1e0a21['model'][_0x386b('0x42')]());})){throw new db['Sequelize'][(_0x386b('0x30'))](_0x386b('0x43'));}}}var _0x23c300={};_0x23c300[_0x386b('0x44')]=_0x4f9162[_0x386b('0x2c')][_0x386b('0x2d')](_0x386b('0x44'))?_0x4f9162[_0x386b('0x2c')][_0x386b('0x44')]:_0x4f9162['user'][_0x386b('0x45')];_0x23c300['recipientsDescription']=_[_0x386b('0x46')](_0x4f9162[_0x386b('0x2c')][_0x386b('0x47')])?null:_0x4f9162['body'][_0x386b('0x47')];_0x23c300[_0x386b('0x48')]=_0x4f9162[_0x386b('0x2c')][_0x386b('0x48')]||![];_0x23c300[_0x386b('0x49')]=_0x4f9162[_0x386b('0x40')]['id'];return getContent(_0x4f9162[_0x386b('0x2c')])['then'](function(_0x4f1665){_0x23c300[_0x386b('0x2c')]=_0x4f1665;return getRecipients(_0x472797);})['then'](function(_0x4e330d){_0x23c300['recipientsId']=_['sortBy'](_0x4e330d)['join'](',');return db[_0x386b('0x4a')]['transaction'](function(_0x42214d){return db['UserNotification'][_0x386b('0x4b')](_0x23c300,{'raw':!![],'transaction':_0x42214d})['then'](function(_0x14d334){var _0x4814af={'sender':_0x23c300[_0x386b('0x44')],'description':_0x23c300[_0x386b('0x47')],'content':_0x23c300['body'],'beep':_0x23c300[_0x386b('0x48')]};_0x4e330d[_0x386b('0x4c')](function(_0x530446){_0x4814af[_0x386b('0x4d')]=_0x530446;socket[_0x386b('0x4e')](_0x386b('0x4f'),_0x4814af);});return _0x14d334;});});})['then'](respondWithResult(_0x512d27,0xc9))[_0x386b('0x50')](handleError(_0x512d27,null));};function getContent(_0x2c3aa1){return new BPromise(function(_0x1ac319,_0xc67e02){if(_0x2c3aa1['text']){_0x1ac319(_0x2c3aa1['text']);return;}return db[_0x386b('0x51')][_0x386b('0x52')]({'attributes':[_0x386b('0x53')],'where':{'id':_0x2c3aa1[_0x386b('0x2e')]},'raw':!![]})[_0x386b('0x27')](function(_0x3de946){if(!_0x3de946)throw new db[(_0x386b('0x2f'))][(_0x386b('0x30'))](_0x386b('0x54'));var _0x18f93f=Mustache[_0x386b('0x55')](_0x3de946[_0x386b('0x53')],_0x2c3aa1[_0x386b('0x32')]);_0x1ac319(_0x18f93f);})['catch'](function(_0x443eb1){_0xc67e02(_0x443eb1);});});}function getRecipients(_0x321a4c){return new BPromise(function(_0x4f88de,_0x4ad775){var _0x5cce7c=[];var _0x5100dc=[];_0x321a4c['forEach'](function(_0x361925){var _0x278cb3=_[_0x386b('0x56')](_0x361925[_0x386b('0x57')][_0x386b('0x42')]());if(_0x278cb3===_0x386b('0x58')){_0x5cce7c=_[_0x386b('0x59')](_0x5cce7c,_0x361925[_0x386b('0x5a')]);}else{if(_[_0x386b('0x5b')](_0x278cb3,'queue'))_0x278cb3=_0x278cb3[_0x386b('0x5c')](_0x386b('0x5d'),'Queue');_0x361925[_0x386b('0x5a')][_0x386b('0x4c')](function(_0x3e0aba){_0x5100dc[_0x386b('0x5e')](getAgents(_0x278cb3,_0x3e0aba));});}});return BPromise['all'](_0x5100dc)[_0x386b('0x27')](function(_0x97728c){_0x5cce7c=_[_0x386b('0x59')](_0x5cce7c,_[_0x386b('0x5f')](_0x97728c));_0x4f88de(_0x5cce7c);})[_0x386b('0x50')](function(_0x28fd67){_0x4ad775(_0x28fd67);});});}function getAgents(_0x50c645,_0x3456c4){return new BPromise(function(_0x337d8a,_0x4dc959){return db[_0x50c645][_0x386b('0x52')]({'where':{'id':_0x3456c4}})[_0x386b('0x27')](function(_0x451c8e){return _0x451c8e[_0x386b('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5843d2){var _0x2fdff9=_[_0x386b('0x61')](_0x5843d2,'id');_0x337d8a(_0x2fdff9);});})[_0x386b('0x50')](function(_0x28b7c3){_0x4dc959(_0x28b7c3);});});} \ No newline at end of file +var _0xb675=['send','sendUserNotification','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','Missing\x20\x27view\x27\x20parameter','body','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','recipientsId','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','html','render','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','error','stack','name'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb675,0x94));var _0x5b67=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xb675[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0x5b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b67('0x1'));var jsonpatch=require(_0x5b67('0x2'));var rp=require('request-promise');var moment=require(_0x5b67('0x3'));var BPromise=require(_0x5b67('0x4'));var Mustache=require('mustache');var util=require(_0x5b67('0x5'));var path=require(_0x5b67('0x6'));var sox=require(_0x5b67('0x7'));var csv=require(_0x5b67('0x8'));var ejs=require(_0x5b67('0x9'));var fs=require('fs');var fs_extra=require(_0x5b67('0xa'));var _=require(_0x5b67('0xb'));var squel=require(_0x5b67('0xc'));var crypto=require(_0x5b67('0xd'));var jsforce=require(_0x5b67('0xe'));var deskjs=require(_0x5b67('0xf'));var toCsv=require(_0x5b67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b67('0x10'));var authService=require(_0x5b67('0x11'));var qs=require(_0x5b67('0x12'));var as=require(_0x5b67('0x13'));var hardwareService=require(_0x5b67('0x14'));var logger=require(_0x5b67('0x15'))(_0x5b67('0x16'));var utils=require(_0x5b67('0x17'));var config=require(_0x5b67('0x18'));var licenseUtil=require(_0x5b67('0x19'));var db=require(_0x5b67('0x1a'))['db'];config['redis']=_[_0x5b67('0x1b')](config[_0x5b67('0x1c')],{'host':_0x5b67('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5b67('0x1e'))[_0x5b67('0x1f')](socket);function respondWithStatusCode(_0x26f30c,_0x4c71bc){_0x4c71bc=_0x4c71bc||0xcc;return function(_0xb6b79f){if(_0xb6b79f){return _0x26f30c[_0x5b67('0x20')](_0x4c71bc);}return _0x26f30c['status'](_0x4c71bc)['end']();};}function respondWithResult(_0x2c325a,_0x4ef7d6){_0x4ef7d6=_0x4ef7d6||0xc8;return function(_0x3024c2){if(_0x3024c2){return _0x2c325a[_0x5b67('0x21')](_0x4ef7d6)[_0x5b67('0x22')](_0x3024c2);}};}function respondWithFilteredResult(_0x32dc88,_0x4e9d0d){return function(_0xfa824a){if(_0xfa824a){var _0x27f53c=typeof _0x4e9d0d[_0x5b67('0x23')]==='undefined'&&typeof _0x4e9d0d[_0x5b67('0x24')]===_0x5b67('0x25');var _0x2396ae=_0xfa824a[_0x5b67('0x26')];var _0x2186d4=_0x27f53c?0x0:_0x4e9d0d['offset'];var _0x461671=_0x27f53c?_0xfa824a[_0x5b67('0x26')]:_0x4e9d0d[_0x5b67('0x23')]+_0x4e9d0d['limit'];var _0x1238f3;if(_0x461671>=_0x2396ae){_0x461671=_0x2396ae;_0x1238f3=0xc8;}else{_0x1238f3=0xce;}_0x32dc88[_0x5b67('0x21')](_0x1238f3);return _0x32dc88[_0x5b67('0x27')]('Content-Range',_0x2186d4+'-'+_0x461671+'/'+_0x2396ae)['json'](_0xfa824a);}return null;};}function patchUpdates(_0x1232be){return function(_0x5a2b07){try{jsonpatch['apply'](_0x5a2b07,_0x1232be,!![]);}catch(_0x47a4be){return BPromise[_0x5b67('0x28')](_0x47a4be);}return _0x5a2b07[_0x5b67('0x29')]();};}function saveUpdates(_0x4db883,_0x361cf4){return function(_0xf67192){if(_0xf67192){return _0xf67192['update'](_0x4db883)[_0x5b67('0x2a')](function(_0x4eb8ac){return _0x4eb8ac;});}return null;};}function removeEntity(_0x7b68ce,_0x2bd209){return function(_0x22d45c){if(_0x22d45c){return _0x22d45c[_0x5b67('0x2b')]()[_0x5b67('0x2a')](function(){_0x7b68ce['status'](0xcc)[_0x5b67('0x2c')]();});}};}function handleEntityNotFound(_0x186b2c,_0x5a11ba){return function(_0x312ab9){if(!_0x312ab9){_0x186b2c['sendStatus'](0x194);}return _0x312ab9;};}function handleError(_0x1798df,_0x3d35ef){_0x3d35ef=_0x3d35ef||0x1f4;return function(_0xbc4a8a){logger[_0x5b67('0x2d')](_0xbc4a8a[_0x5b67('0x2e')]);if(_0xbc4a8a[_0x5b67('0x2f')]){delete _0xbc4a8a[_0x5b67('0x2f')];}_0x1798df[_0x5b67('0x21')](_0x3d35ef)[_0x5b67('0x30')](_0xbc4a8a);};}exports[_0x5b67('0x31')]=function(_0x3c8e3c,_0x51296e,_0x9d4a99){if(!_0x3c8e3c['body']['hasOwnProperty'](_0x5b67('0x32'))&&!_0x3c8e3c['body']['hasOwnProperty'](_0x5b67('0x33'))){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x36'));}else{if(_0x3c8e3c['body'][_0x5b67('0x37')](_0x5b67('0x33'))&&!_0x3c8e3c['body'][_0x5b67('0x37')]('view')){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x38'));}if(!_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x37')]('recipients')){throw new db['Sequelize'][(_0x5b67('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x237a2f=JSON[_0x5b67('0x3a')](_0x3c8e3c['body'][_0x5b67('0x3b')]);}catch(_0x1a3db5){logger['error'](_0x1a3db5);throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x3c'));}var _0x17cbd4=[_0x5b67('0x3d'),'faxqueue',_0x5b67('0x3e'),_0x5b67('0x3f'),'smsqueue','voicequeue',_0x5b67('0x40'),_0x5b67('0x41'),_0x5b67('0x42')];if(_[_0x5b67('0x43')](_0x237a2f,function(_0x425694){return!_[_0x5b67('0x44')](_0x17cbd4,_0x425694[_0x5b67('0x45')]['toLowerCase']());})){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x46'));}}}var _0x58f0a5={};_0x58f0a5[_0x5b67('0x47')]=_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x37')](_0x5b67('0x47'))?_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x47')]:_0x3c8e3c[_0x5b67('0x42')]['fullname'];_0x58f0a5[_0x5b67('0x48')]=_['isEmpty'](_0x3c8e3c['body'][_0x5b67('0x48')])?null:_0x3c8e3c['body'][_0x5b67('0x48')];_0x58f0a5[_0x5b67('0x49')]=_0x3c8e3c['body'][_0x5b67('0x49')]||![];_0x58f0a5['SenderId']=_0x3c8e3c[_0x5b67('0x42')]['id'];return getContent(_0x3c8e3c[_0x5b67('0x39')])[_0x5b67('0x2a')](function(_0x197997){_0x58f0a5[_0x5b67('0x39')]=_0x197997;return getRecipients(_0x237a2f);})[_0x5b67('0x2a')](function(_0x3534af){_0x58f0a5[_0x5b67('0x4a')]=_['sortBy'](_0x3534af)['join'](',');return db[_0x5b67('0x4b')][_0x5b67('0x4c')](function(_0x4fe027){return db['UserNotification']['create'](_0x58f0a5,{'raw':!![],'transaction':_0x4fe027})['then'](function(_0x1a430c){var _0x3a9dc0={'sender':_0x58f0a5[_0x5b67('0x47')],'description':_0x58f0a5[_0x5b67('0x48')],'content':_0x58f0a5['body'],'beep':_0x58f0a5[_0x5b67('0x49')]};_0x3534af[_0x5b67('0x4d')](function(_0x1d28b2){_0x3a9dc0[_0x5b67('0x4e')]=_0x1d28b2;socket[_0x5b67('0x4f')](_0x5b67('0x50'),_0x3a9dc0);});return _0x1a430c;});});})[_0x5b67('0x2a')](respondWithResult(_0x51296e,0xc9))[_0x5b67('0x51')](handleError(_0x51296e,null));};function getContent(_0x334d8d){return new BPromise(function(_0x476951,_0x5484b9){if(_0x334d8d['text']){_0x476951(_0x334d8d[_0x5b67('0x32')]);return;}return db[_0x5b67('0x52')]['findOne']({'attributes':[_0x5b67('0x53')],'where':{'id':_0x334d8d[_0x5b67('0x33')]},'raw':!![]})[_0x5b67('0x2a')](function(_0x30b048){if(!_0x30b048)throw new db[(_0x5b67('0x34'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4aec29=Mustache[_0x5b67('0x54')](_0x30b048[_0x5b67('0x53')],_0x334d8d['view']);_0x476951(_0x4aec29);})[_0x5b67('0x51')](function(_0x2306b1){_0x5484b9(_0x2306b1);});});}function getRecipients(_0xccab70){return new BPromise(function(_0x479360,_0x2dcfc7){var _0x5bd813=[];var _0x3d4865=[];_0xccab70[_0x5b67('0x4d')](function(_0x43fcb1){var _0x167639=_[_0x5b67('0x55')](_0x43fcb1['model']['toLowerCase']());if(_0x167639===_0x5b67('0x56')){_0x5bd813=_[_0x5b67('0x57')](_0x5bd813,_0x43fcb1[_0x5b67('0x58')]);}else{if(_['includes'](_0x167639,_0x5b67('0x59')))_0x167639=_0x167639[_0x5b67('0x5a')](_0x5b67('0x59'),_0x5b67('0x5b'));_0x43fcb1['ids'][_0x5b67('0x4d')](function(_0x39908d){_0x3d4865[_0x5b67('0x5c')](getAgents(_0x167639,_0x39908d));});}});return BPromise[_0x5b67('0x5d')](_0x3d4865)[_0x5b67('0x2a')](function(_0x58d1c8){_0x5bd813=_['union'](_0x5bd813,_[_0x5b67('0x5e')](_0x58d1c8));_0x479360(_0x5bd813);})[_0x5b67('0x51')](function(_0x601a7f){_0x2dcfc7(_0x601a7f);});});}function getAgents(_0x553248,_0x2ef2b1){return new BPromise(function(_0x38e2d8,_0x2d68d4){return db[_0x553248][_0x5b67('0x5f')]({'where':{'id':_0x2ef2b1}})['then'](function(_0x1fb738){return _0x1fb738[_0x5b67('0x60')]({'attributes':['id'],'raw':!![]})[_0x5b67('0x2a')](function(_0x535ab3){var _0x5c1766=_[_0x5b67('0x61')](_0x535ab3,'id');_0x38e2d8(_0x5c1766);});})['catch'](function(_0x4560e1){_0x2d68d4(_0x4560e1);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0f16739..18b912e 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 _0xb390=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x45d27f,_0x44edaf){var _0x79729d=function(_0x4b02e3){while(--_0x4b02e3){_0x45d27f['push'](_0x45d27f['shift']());}};_0x79729d(++_0x44edaf);}(_0xb390,0x1ed));var _0x0b39=function(_0x5742b0,_0x1b0f77){_0x5742b0=_0x5742b0-0x0;var _0x3c4ffa=_0xb390[_0x5742b0];return _0x3c4ffa;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x0b39('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0b39('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b39('0x2')};function emitEvent(_0x36f48c){return function(_0x2575ac,_0x91b7a6,_0x349b00){UserNotificationEvents[_0x0b39('0x3')](_0x36f48c+':'+_0x2575ac['id'],_0x2575ac);UserNotificationEvents[_0x0b39('0x3')](_0x36f48c,_0x2575ac);_0x349b00(null);};}for(var e in events){if(events[_0x0b39('0x4')](e)){var event=events[e];UserNotification[_0x0b39('0x5')](e,emitEvent(event));}}module[_0x0b39('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xc039=['hook','exports','events','UserNotification','remove','emit','hasOwnProperty'];(function(_0x5a4ac1,_0xb9eb0b){var _0x11dc18=function(_0x49d481){while(--_0x49d481){_0x5a4ac1['push'](_0x5a4ac1['shift']());}};_0x11dc18(++_0xb9eb0b);}(_0xc039,0xe2));var _0x9c03=function(_0x17c3de,_0x1a4494){_0x17c3de=_0x17c3de-0x0;var _0x1044c6=_0xc039[_0x17c3de];return _0x1044c6;};'use strict';var EventEmitter=require(_0x9c03('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x9c03('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c03('0x2')};function emitEvent(_0x3b85eb){return function(_0x4177cd,_0x347692,_0x3bd965){UserNotificationEvents[_0x9c03('0x3')](_0x3b85eb+':'+_0x4177cd['id'],_0x4177cd);UserNotificationEvents[_0x9c03('0x3')](_0x3b85eb,_0x4177cd);_0x3bd965(null);};}for(var e in events){if(events[_0x9c03('0x4')](e)){var event=events[e];UserNotification[_0x9c03('0x5')](e,emitEvent(event));}}module[_0x9c03('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f713b42..87927bc 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 _0x1de2=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1de2,0x86));var _0x21de=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x1de2[_0x10dfdf];return _0x4d857d;};'use strict';var _=require(_0x21de('0x0'));var util=require(_0x21de('0x1'));var logger=require(_0x21de('0x2'))(_0x21de('0x3'));var moment=require(_0x21de('0x4'));var BPromise=require(_0x21de('0x5'));var rp=require(_0x21de('0x6'));var fs=require('fs');var path=require(_0x21de('0x7'));var rimraf=require(_0x21de('0x8'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x21de('0x9')]=function(_0x9261f4,_0x5bdffb){return _0x9261f4[_0x21de('0xa')](_0x21de('0xb'),attributes,{'tableName':_0x21de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21de('0xd'),'collate':_0x21de('0xe')});}; \ No newline at end of file +var _0x335a=['request-promise','path','rimraf','define','UserNotification','userNotifications','../../config/logger','api','moment','bluebird'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x335a,0x150));var _0xa335=function(_0x5f110c,_0x1ce402){_0x5f110c=_0x5f110c-0x0;var _0x1f0234=_0x335a[_0x5f110c];return _0x1f0234;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa335('0x0'))(_0xa335('0x1'));var moment=require(_0xa335('0x2'));var BPromise=require(_0xa335('0x3'));var rp=require(_0xa335('0x4'));var fs=require('fs');var path=require(_0xa335('0x5'));var rimraf=require(_0xa335('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x24c1e5,_0x48701c){return _0x24c1e5[_0xa335('0x7')](_0xa335('0x8'),attributes,{'tableName':_0xa335('0x9'),'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 99b4965..0bb4b6f 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 _0xf641=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x53c246,_0x3196f0){var _0x460505=function(_0x139e87){while(--_0x139e87){_0x53c246['push'](_0x53c246['shift']());}};_0x460505(++_0x3196f0);}(_0xf641,0x6f));var _0x1f64=function(_0x2d33d5,_0x373405){_0x2d33d5=_0x2d33d5-0x0;var _0x2bb1ed=_0xf641[_0x2d33d5];return _0x2bb1ed;};'use strict';var _=require(_0x1f64('0x0'));var util=require('util');var moment=require(_0x1f64('0x1'));var BPromise=require(_0x1f64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f64('0x3'));var db=require(_0x1f64('0x4'))['db'];var utils=require(_0x1f64('0x5'));var logger=require(_0x1f64('0x6'))(_0x1f64('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f64('0x8'));var client=jayson[_0x1f64('0x9')][_0x1f64('0xa')]({'port':0x232a});config[_0x1f64('0xb')]=_[_0x1f64('0xc')](config[_0x1f64('0xb')],{'host':_0x1f64('0xd'),'port':0x18eb});var socket=require(_0x1f64('0xe'))(new Redis(config[_0x1f64('0xb')]));require('./userNotification.socket')[_0x1f64('0xf')](socket);function respondWithRpcPromise(_0x4b9633,_0x196ad0,_0x2b4bf3){return new BPromise(function(_0x23891b,_0x527d0d){return client[_0x1f64('0x10')](_0x4b9633,_0x2b4bf3)[_0x1f64('0x11')](function(_0x569d29){logger[_0x1f64('0x12')](_0x1f64('0x13'),_0x196ad0,_0x1f64('0x14'));logger['debug'](_0x1f64('0x15'),_0x196ad0,_0x1f64('0x14'),JSON[_0x1f64('0x16')](_0x569d29));if(_0x569d29[_0x1f64('0x17')]){if(_0x569d29[_0x1f64('0x17')][_0x1f64('0x18')]===0x1f4){logger[_0x1f64('0x17')](_0x1f64('0x13'),_0x196ad0,_0x569d29[_0x1f64('0x17')]['message']);return _0x527d0d(_0x569d29[_0x1f64('0x17')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x196ad0,_0x569d29[_0x1f64('0x17')][_0x1f64('0x19')]);return _0x23891b(_0x569d29['error'][_0x1f64('0x19')]);}else{logger[_0x1f64('0x12')](_0x1f64('0x13'),_0x196ad0,_0x1f64('0x14'));_0x23891b(_0x569d29[_0x1f64('0x1a')][_0x1f64('0x19')]);}})[_0x1f64('0x1b')](function(_0x12ece9){logger[_0x1f64('0x17')](_0x1f64('0x13'),_0x196ad0,_0x12ece9);_0x527d0d(_0x12ece9);});});} \ No newline at end of file +var _0x5825=['UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5825,0xaa));var _0x5582=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5825[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x5582('0x0'));var moment=require(_0x5582('0x1'));var BPromise=require(_0x5582('0x2'));var rs=require(_0x5582('0x3'));var fs=require('fs');var Redis=require(_0x5582('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5582('0x5'));var logger=require('../../config/logger')(_0x5582('0x6'));var config=require(_0x5582('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5582('0x8')][_0x5582('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5582('0xa'),'port':0x18eb});var socket=require(_0x5582('0xb'))(new Redis(config[_0x5582('0xc')]));require(_0x5582('0xd'))[_0x5582('0xe')](socket);function respondWithRpcPromise(_0x423ca1,_0x341a29,_0x155742){return new BPromise(function(_0x15851e,_0x222a28){return client[_0x5582('0xf')](_0x423ca1,_0x155742)['then'](function(_0x3bd2ca){logger[_0x5582('0x10')](_0x5582('0x11'),_0x341a29,'request\x20sent');logger[_0x5582('0x12')](_0x5582('0x13'),_0x341a29,_0x5582('0x14'),JSON[_0x5582('0x15')](_0x3bd2ca));if(_0x3bd2ca[_0x5582('0x16')]){if(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x17')]===0x1f4){logger[_0x5582('0x16')](_0x5582('0x11'),_0x341a29,_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);return _0x222a28(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);}logger[_0x5582('0x16')]('UserNotification,\x20%s,\x20%s',_0x341a29,_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);return _0x15851e(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);}else{logger[_0x5582('0x10')]('UserNotification,\x20%s,\x20%s',_0x341a29,_0x5582('0x14'));_0x15851e(_0x3bd2ca[_0x5582('0x19')][_0x5582('0x18')]);}})[_0x5582('0x1a')](function(_0x4b92d7){logger[_0x5582('0x16')](_0x5582('0x11'),_0x341a29,_0x4b92d7);_0x222a28(_0x4b92d7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8fffdcc..682ecdd 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 _0xf861=['length','userNotification:','./userNotification.events','save','update','emit','register'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0xf861,0x198));var _0x1f86=function(_0x23269e,_0x3c059f){_0x23269e=_0x23269e-0x0;var _0x4871d1=_0xf861[_0x23269e];return _0x4871d1;};'use strict';var UserNotificationEvents=require(_0x1f86('0x0'));var events=[_0x1f86('0x1'),'remove',_0x1f86('0x2')];function createListener(_0x4227c9,_0x195582){return function(_0x14dcb9){_0x195582[_0x1f86('0x3')](_0x4227c9,_0x14dcb9);};}function removeListener(_0x2863be,_0x2a0fd5){return function(){UserNotificationEvents['removeListener'](_0x2863be,_0x2a0fd5);};}exports[_0x1f86('0x4')]=function(_0x28cc5e){for(var _0x4fbdb2=0x0,_0x30b657=events[_0x1f86('0x5')];_0x4fbdb2<_0x30b657;_0x4fbdb2++){var _0x277df7=events[_0x4fbdb2];var _0xd43506=createListener(_0x1f86('0x6')+_0x277df7,_0x28cc5e);UserNotificationEvents['on'](_0x277df7,_0xd43506);}}; \ No newline at end of file +var _0x27f0=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x36fa4b,_0x8e293){var _0x5e56bc=function(_0x1f1b65){while(--_0x1f1b65){_0x36fa4b['push'](_0x36fa4b['shift']());}};_0x5e56bc(++_0x8e293);}(_0x27f0,0x129));var _0x027f=function(_0x26a2f1,_0x530684){_0x26a2f1=_0x26a2f1-0x0;var _0x3be229=_0x27f0[_0x26a2f1];return _0x3be229;};'use strict';var UserNotificationEvents=require(_0x027f('0x0'));var events=[_0x027f('0x1'),_0x027f('0x2'),_0x027f('0x3')];function createListener(_0x1f437a,_0x47d76f){return function(_0x43347d){_0x47d76f[_0x027f('0x4')](_0x1f437a,_0x43347d);};}function removeListener(_0x24565c,_0x58bf8e){return function(){UserNotificationEvents[_0x027f('0x5')](_0x24565c,_0x58bf8e);};}exports[_0x027f('0x6')]=function(_0xec6191){for(var _0x276487=0x0,_0x2d7cb7=events[_0x027f('0x7')];_0x276487<_0x2d7cb7;_0x276487++){var _0x359047=events[_0x276487];var _0x5135d6=createListener(_0x027f('0x8')+_0x359047,_0xec6191);UserNotificationEvents['on'](_0x359047,_0x5135d6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9f52bfa..7f2ae89 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x160ab5,_0x1b38d1){var _0x5321c8=function(_0x13ffc5){while(--_0x13ffc5){_0x160ab5['push'](_0x160ab5['shift']());}};_0x5321c8(++_0x1b38d1);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2752d2,_0x6e18ef){var _0x113b40=function(_0x3ae9a5){while(--_0x3ae9a5){_0x2752d2['push'](_0x2752d2['shift']());}};_0x113b40(++_0x6e18ef);}(_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 42d65af..71afd75 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 _0xe0af=['INTEGER','sequelize','exports'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xe0af,0x1e4));var _0xfe0a=function(_0xf7bf02,_0x13da13){_0xf7bf02=_0xf7bf02-0x0;var _0x4f263f=_0xe0af[_0xf7bf02];return _0x4f263f;};'use strict';var Sequelize=require(_0xfe0a('0x0'));module[_0xfe0a('0x1')]={'penalty':{'type':Sequelize[_0xfe0a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d23=['exports','INTEGER'];(function(_0x55f3d1,_0x524d87){var _0x2d9606=function(_0x5462d9){while(--_0x5462d9){_0x55f3d1['push'](_0x55f3d1['shift']());}};_0x2d9606(++_0x524d87);}(_0x4d23,0x82));var _0x34d2=function(_0x27acf4,_0x68c4ff){_0x27acf4=_0x27acf4-0x0;var _0x5a6a53=_0x4d23[_0x27acf4];return _0x5a6a53;};'use strict';var Sequelize=require('sequelize');module[_0x34d2('0x0')]={'penalty':{'type':Sequelize[_0x34d2('0x1')],'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 19ea94f..40c72cc 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 _0xd7f8=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define'];(function(_0x216134,_0x1a82d6){var _0x64ee78=function(_0x4204dc){while(--_0x4204dc){_0x216134['push'](_0x216134['shift']());}};_0x64ee78(++_0x1a82d6);}(_0xd7f8,0xc2));var _0x8d7f=function(_0x5584d8,_0x30707e){_0x5584d8=_0x5584d8-0x0;var _0xee9357=_0xd7f8[_0x5584d8];return _0xee9357;};'use strict';var _=require(_0x8d7f('0x0'));var util=require('util');var logger=require(_0x8d7f('0x1'))(_0x8d7f('0x2'));var moment=require(_0x8d7f('0x3'));var BPromise=require(_0x8d7f('0x4'));var rp=require(_0x8d7f('0x5'));var fs=require('fs');var path=require(_0x8d7f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d7f('0x7'));module[_0x8d7f('0x8')]=function(_0x4475e6,_0x5593a5){return _0x4475e6[_0x8d7f('0x9')](_0x8d7f('0xa'),attributes,{'tableName':_0x8d7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68ea=['exports','define','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x508632,_0x44bfac){var _0x2e517a=function(_0x1cbe5c){while(--_0x1cbe5c){_0x508632['push'](_0x508632['shift']());}};_0x2e517a(++_0x44bfac);}(_0x68ea,0x173));var _0xa68e=function(_0x26489e,_0x17fca8){_0x26489e=_0x26489e-0x0;var _0x41b00d=_0x68ea[_0x26489e];return _0x41b00d;};'use strict';var _=require(_0xa68e('0x0'));var util=require(_0xa68e('0x1'));var logger=require(_0xa68e('0x2'))(_0xa68e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa68e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa68e('0x5'));var config=require(_0xa68e('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xa68e('0x7')]=function(_0xd27746,_0x277e45){return _0xd27746[_0xa68e('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 ab359ac..8f740b5 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 _0x8285=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20663d,_0x3e032f){var _0x1ecf96=function(_0x306a8a){while(--_0x306a8a){_0x20663d['push'](_0x20663d['shift']());}};_0x1ecf96(++_0x3e032f);}(_0x8285,0x158));var _0x5828=function(_0x33a959,_0x466629){_0x33a959=_0x33a959-0x0;var _0x136245=_0x8285[_0x33a959];return _0x136245;};'use strict';var _=require(_0x5828('0x0'));var util=require(_0x5828('0x1'));var moment=require(_0x5828('0x2'));var BPromise=require(_0x5828('0x3'));var rs=require(_0x5828('0x4'));var fs=require('fs');var Redis=require(_0x5828('0x5'));var db=require(_0x5828('0x6'))['db'];var utils=require(_0x5828('0x7'));var logger=require(_0x5828('0x8'))(_0x5828('0x9'));var config=require(_0x5828('0xa'));var jayson=require(_0x5828('0xb'));var client=jayson[_0x5828('0xc')][_0x5828('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x511661,_0x37e69a,_0x40ff2d){return new BPromise(function(_0x3f30cb,_0x48e405){return client[_0x5828('0xe')](_0x511661,_0x40ff2d)[_0x5828('0xf')](function(_0x213db5){logger['info'](_0x5828('0x10'),_0x37e69a,_0x5828('0x11'));logger[_0x5828('0x12')](_0x5828('0x13'),_0x37e69a,'request\x20sent',JSON[_0x5828('0x14')](_0x213db5));if(_0x213db5[_0x5828('0x15')]){if(_0x213db5[_0x5828('0x15')][_0x5828('0x16')]===0x1f4){logger['error'](_0x5828('0x10'),_0x37e69a,_0x213db5[_0x5828('0x15')]['message']);return _0x48e405(_0x213db5['error'][_0x5828('0x17')]);}logger['error'](_0x5828('0x10'),_0x37e69a,_0x213db5['error'][_0x5828('0x17')]);return _0x3f30cb(_0x213db5['error'][_0x5828('0x17')]);}else{logger[_0x5828('0x18')](_0x5828('0x10'),_0x37e69a,_0x5828('0x11'));_0x3f30cb(_0x213db5[_0x5828('0x19')]['message']);}})[_0x5828('0x1a')](function(_0x51f5ff){logger[_0x5828('0x15')](_0x5828('0x10'),_0x37e69a,_0x51f5ff);_0x48e405(_0x51f5ff);});});} \ No newline at end of file +var _0xe937=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4491ef,_0x5153d9){var _0x3c72dc=function(_0x4c467d){while(--_0x4c467d){_0x4491ef['push'](_0x4491ef['shift']());}};_0x3c72dc(++_0x5153d9);}(_0xe937,0xc9));var _0x7e93=function(_0x30ecfd,_0x30132a){_0x30ecfd=_0x30ecfd-0x0;var _0x5e0553=_0xe937[_0x30ecfd];return _0x5e0553;};'use strict';var _=require(_0x7e93('0x0'));var util=require(_0x7e93('0x1'));var moment=require('moment');var BPromise=require(_0x7e93('0x2'));var rs=require(_0x7e93('0x3'));var fs=require('fs');var Redis=require(_0x7e93('0x4'));var db=require(_0x7e93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e93('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e93('0x7'));var client=jayson[_0x7e93('0x8')][_0x7e93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x378708,_0x40e4fc,_0x9c1615){return new BPromise(function(_0x4707b7,_0xd1fdc4){return client[_0x7e93('0xa')](_0x378708,_0x9c1615)[_0x7e93('0xb')](function(_0x2f2228){logger['info'](_0x7e93('0xc'),_0x40e4fc,_0x7e93('0xd'));logger[_0x7e93('0xe')](_0x7e93('0xf'),_0x40e4fc,_0x7e93('0xd'),JSON[_0x7e93('0x10')](_0x2f2228));if(_0x2f2228[_0x7e93('0x11')]){if(_0x2f2228['error']['code']===0x1f4){logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);return _0xd1fdc4(_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);}logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);return _0x4707b7(_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);}else{logger[_0x7e93('0x13')](_0x7e93('0xc'),_0x40e4fc,'request\x20sent');_0x4707b7(_0x2f2228[_0x7e93('0x14')]['message']);}})[_0x7e93('0x15')](function(_0x51290b){logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x51290b);_0xd1fdc4(_0x51290b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 78e4fb7..4c70e5d 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 _0xd88c=['removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','clone','addSections','update','delete','destroy'];(function(_0x410c02,_0x191c27){var _0x5411e2=function(_0x565194){while(--_0x565194){_0x410c02['push'](_0x410c02['shift']());}};_0x5411e2(++_0x191c27);}(_0xd88c,0x162));var _0xcd88=function(_0x15ac09,_0x43685b){_0x15ac09=_0x15ac09-0x0;var _0x128429=_0xd88c[_0x15ac09];return _0x128429;};'use strict';var multer=require(_0xcd88('0x0'));var util=require(_0xcd88('0x1'));var path=require(_0xcd88('0x2'));var timeout=require(_0xcd88('0x3'));var express=require('express');var router=express[_0xcd88('0x4')]();var fs_extra=require(_0xcd88('0x5'));var auth=require(_0xcd88('0x6'));var interaction=require(_0xcd88('0x7'));var config=require(_0xcd88('0x8'));var controller=require('./userProfile.controller');router[_0xcd88('0x9')]('/',auth[_0xcd88('0xa')](),controller['index']);router[_0xcd88('0x9')](_0xcd88('0xb'),auth[_0xcd88('0xa')](),controller['describe']);router[_0xcd88('0x9')](_0xcd88('0xc'),auth['isAuthenticated'](),controller[_0xcd88('0xd')]);router['get'](_0xcd88('0xe'),auth[_0xcd88('0xa')](),controller['getSections']);router[_0xcd88('0x9')](_0xcd88('0xf'),auth[_0xcd88('0xa')](),controller[_0xcd88('0x10')]);router[_0xcd88('0x11')]('/',auth['isAuthenticated'](),controller[_0xcd88('0x12')]);router[_0xcd88('0x11')]('/:id/clone',auth[_0xcd88('0xa')](),controller[_0xcd88('0x13')]);router[_0xcd88('0x11')](_0xcd88('0xe'),auth[_0xcd88('0xa')](),controller[_0xcd88('0x14')]);router[_0xcd88('0x11')](_0xcd88('0xf'),auth[_0xcd88('0xa')](),controller['addResources']);router['put']('/:id',auth[_0xcd88('0xa')](),controller[_0xcd88('0x15')]);router[_0xcd88('0x16')](_0xcd88('0xc'),auth['isAuthenticated'](),controller[_0xcd88('0x17')]);router['delete'](_0xcd88('0xe'),auth[_0xcd88('0xa')](),controller[_0xcd88('0x18')]);router[_0xcd88('0x16')](_0xcd88('0xf'),auth[_0xcd88('0xa')](),controller[_0xcd88('0x19')]);module[_0xcd88('0x1a')]=router; \ No newline at end of file +var _0x42ba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getResources','post','clone','/:id/sections','addSections','/:id/resources','addResources','put','update','delete','destroy','multer','util'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x42ba,0x1da));var _0xa42b=function(_0x2cd04f,_0x5ce2ae){_0x2cd04f=_0x2cd04f-0x0;var _0x5839ab=_0x42ba[_0x2cd04f];return _0x5839ab;};'use strict';var multer=require(_0xa42b('0x0'));var util=require(_0xa42b('0x1'));var path=require(_0xa42b('0x2'));var timeout=require(_0xa42b('0x3'));var express=require(_0xa42b('0x4'));var router=express[_0xa42b('0x5')]();var fs_extra=require(_0xa42b('0x6'));var auth=require(_0xa42b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa42b('0x8'));var controller=require(_0xa42b('0x9'));router[_0xa42b('0xa')]('/',auth[_0xa42b('0xb')](),controller[_0xa42b('0xc')]);router[_0xa42b('0xa')](_0xa42b('0xd'),auth[_0xa42b('0xb')](),controller[_0xa42b('0xe')]);router[_0xa42b('0xa')](_0xa42b('0xf'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x10')]);router[_0xa42b('0xa')]('/:id/sections',auth[_0xa42b('0xb')](),controller['getSections']);router['get']('/:id/resources',auth[_0xa42b('0xb')](),controller[_0xa42b('0x11')]);router[_0xa42b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa42b('0x12')]('/:id/clone',auth[_0xa42b('0xb')](),controller[_0xa42b('0x13')]);router['post'](_0xa42b('0x14'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x15')]);router[_0xa42b('0x12')](_0xa42b('0x16'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x17')]);router[_0xa42b('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xa42b('0x19')]);router[_0xa42b('0x1a')](_0xa42b('0xf'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x1b')]);router[_0xa42b('0x1a')]('/:id/sections',auth[_0xa42b('0xb')](),controller['removeSections']);router[_0xa42b('0x1a')](_0xa42b('0x16'),auth[_0xa42b('0xb')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 26b8e80..6cced58 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 _0x6012=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x4f0461,_0x25b3f0){var _0x2d6f4e=function(_0x39fa2e){while(--_0x39fa2e){_0x4f0461['push'](_0x4f0461['shift']());}};_0x2d6f4e(++_0x25b3f0);}(_0x6012,0x8d));var _0x2601=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x6012[_0x1b1e76];return _0x3d743a;};'use strict';var Sequelize=require(_0x2601('0x0'));module[_0x2601('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2601('0x2')],'set':function(_0x22a8f7){this[_0x2601('0x3')](_0x2601('0x4'),_0x22a8f7?_0x22a8f7[_0x2601('0x5')](''):[]);},'get':function(){return this[_0x2601('0x6')]('crudPermissions')?this['getDataValue'](_0x2601('0x4'))[_0x2601('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2601('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2601('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5d67=['BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x410612,_0x9a7bd0){var _0x56155e=function(_0x1d4fc1){while(--_0x1d4fc1){_0x410612['push'](_0x410612['shift']());}};_0x56155e(++_0x9a7bd0);}(_0x5d67,0x121));var _0x75d6=function(_0x32442f,_0x31f094){_0x32442f=_0x32442f-0x0;var _0x4147be=_0x5d67[_0x32442f];return _0x4147be;};'use strict';var Sequelize=require(_0x75d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x75d6('0x1')],'allowNull':![],'unique':_0x75d6('0x2')},'crudPermissions':{'type':Sequelize[_0x75d6('0x1')],'set':function(_0x1ede15){this[_0x75d6('0x3')](_0x75d6('0x4'),_0x1ede15?_0x1ede15['join'](''):[]);},'get':function(){return this[_0x75d6('0x5')](_0x75d6('0x4'))?this[_0x75d6('0x5')](_0x75d6('0x4'))[_0x75d6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x75d6('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x75d6('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 4817cf8..edc80ac 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 _0x09df=['removeSections','ids','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','bluebird','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','UserProfile','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','keys','get','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','addSections','push'];(function(_0x39aa81,_0xa27032){var _0x58cddd=function(_0x3a1509){while(--_0x3a1509){_0x39aa81['push'](_0x39aa81['shift']());}};_0x58cddd(++_0xa27032);}(_0x09df,0x164));var _0xf09d=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x09df[_0x171fdc];return _0x3782ea;};'use strict';var emlformat=require(_0xf09d('0x0'));var rimraf=require(_0xf09d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf09d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf09d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf09d('0x4'));var sox=require(_0xf09d('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf09d('0x6'));var squel=require('squel');var crypto=require(_0xf09d('0x7'));var jsforce=require(_0xf09d('0x8'));var deskjs=require(_0xf09d('0x9'));var toCsv=require(_0xf09d('0xa'));var querystring=require(_0xf09d('0xb'));var Papa=require(_0xf09d('0xc'));var Redis=require(_0xf09d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf09d('0xe'));var as=require(_0xf09d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf09d('0x10'))('api');var utils=require(_0xf09d('0x11'));var config=require(_0xf09d('0x12'));var licenseUtil=require(_0xf09d('0x13'));var db=require(_0xf09d('0x14'))['db'];config[_0xf09d('0x15')]=_[_0xf09d('0x16')](config[_0xf09d('0x15')],{'host':_0xf09d('0x17'),'port':0x18eb});var socket=require(_0xf09d('0x18'))(new Redis(config['redis']));require(_0xf09d('0x19'))[_0xf09d('0x1a')](socket);function respondWithStatusCode(_0x6bb95b,_0x486d20){_0x486d20=_0x486d20||0xcc;return function(_0x5572b4){if(_0x5572b4){return _0x6bb95b[_0xf09d('0x1b')](_0x486d20);}return _0x6bb95b[_0xf09d('0x1c')](_0x486d20)[_0xf09d('0x1d')]();};}function respondWithResult(_0x58ae3c,_0x12bdec){_0x12bdec=_0x12bdec||0xc8;return function(_0x5a03b9){if(_0x5a03b9){return _0x58ae3c[_0xf09d('0x1c')](_0x12bdec)[_0xf09d('0x1e')](_0x5a03b9);}};}function respondWithFilteredResult(_0x44d331,_0x33202b){return function(_0x57e3f8){if(_0x57e3f8){var _0x38083e=typeof _0x33202b[_0xf09d('0x1f')]===_0xf09d('0x20')&&typeof _0x33202b[_0xf09d('0x21')]===_0xf09d('0x20');var _0x2b486f=_0x57e3f8['count'];var _0x2f341d=_0x38083e?0x0:_0x33202b['offset'];var _0x380b14=_0x38083e?_0x57e3f8[_0xf09d('0x22')]:_0x33202b[_0xf09d('0x1f')]+_0x33202b[_0xf09d('0x21')];var _0x11eadd;if(_0x380b14>=_0x2b486f){_0x380b14=_0x2b486f;_0x11eadd=0xc8;}else{_0x11eadd=0xce;}_0x44d331[_0xf09d('0x1c')](_0x11eadd);return _0x44d331['set'](_0xf09d('0x23'),_0x2f341d+'-'+_0x380b14+'/'+_0x2b486f)[_0xf09d('0x1e')](_0x57e3f8);}return null;};}function patchUpdates(_0x2ab38c){return function(_0x1012dd){try{jsonpatch[_0xf09d('0x24')](_0x1012dd,_0x2ab38c,!![]);}catch(_0x3e6d44){return BPromise[_0xf09d('0x25')](_0x3e6d44);}return _0x1012dd[_0xf09d('0x26')]();};}function saveUpdates(_0x507484,_0x394934){return function(_0x59f232){if(_0x59f232){return _0x59f232[_0xf09d('0x27')](_0x507484)['then'](function(_0x3bbfae){return _0x3bbfae;});}return null;};}function removeEntity(_0x1e4c35,_0x369700){return function(_0x3363ae){if(_0x3363ae){return _0x3363ae[_0xf09d('0x28')]()[_0xf09d('0x29')](function(){_0x1e4c35['status'](0xcc)[_0xf09d('0x1d')]();});}};}function handleEntityNotFound(_0x35957d,_0x30041c){return function(_0x5818d4){if(!_0x5818d4){_0x35957d['sendStatus'](0x194);}return _0x5818d4;};}function handleError(_0x587125,_0x2f3803){_0x2f3803=_0x2f3803||0x1f4;return function(_0x2d1da5){logger[_0xf09d('0x2a')](_0x2d1da5[_0xf09d('0x2b')]);if(_0x2d1da5[_0xf09d('0x2c')]){delete _0x2d1da5[_0xf09d('0x2c')];}_0x587125[_0xf09d('0x1c')](_0x2f3803)['send'](_0x2d1da5);};}exports[_0xf09d('0x2d')]=function(_0x4b20f5,_0x4b7eed){var _0x1c4b5={},_0x252cef={},_0x5a7cbe={'count':0x0,'rows':[]};var _0x460f76=_[_0xf09d('0x2e')](db[_0xf09d('0x2f')]['rawAttributes'],function(_0x82d5be){return{'name':_0x82d5be[_0xf09d('0x30')],'type':_0x82d5be['type'][_0xf09d('0x31')]};});_0x252cef[_0xf09d('0x32')]=_['map'](_0x460f76,'name');_0x252cef[_0xf09d('0x33')]=_['keys'](_0x4b20f5['query']);_0x252cef[_0xf09d('0x34')]=_[_0xf09d('0x35')](_0x252cef['model'],_0x252cef[_0xf09d('0x33')]);_0x1c4b5['attributes']=_['intersection'](_0x252cef['model'],qs[_0xf09d('0x36')](_0x4b20f5[_0xf09d('0x33')]['fields']));_0x1c4b5[_0xf09d('0x37')]=_0x1c4b5[_0xf09d('0x37')][_0xf09d('0x38')]?_0x1c4b5['attributes']:_0x252cef['model'];if(!_0x4b20f5[_0xf09d('0x33')][_0xf09d('0x39')](_0xf09d('0x3a'))){_0x1c4b5[_0xf09d('0x21')]=qs[_0xf09d('0x21')](_0x4b20f5['query']['limit']);_0x1c4b5[_0xf09d('0x1f')]=qs[_0xf09d('0x1f')](_0x4b20f5[_0xf09d('0x33')][_0xf09d('0x1f')]);}_0x1c4b5[_0xf09d('0x3b')]=qs[_0xf09d('0x3c')](_0x4b20f5[_0xf09d('0x33')][_0xf09d('0x3c')]);_0x1c4b5[_0xf09d('0x3d')]=qs[_0xf09d('0x34')](_[_0xf09d('0x3e')](_0x4b20f5[_0xf09d('0x33')],_0x252cef['filters']),_0x460f76);if(_0x4b20f5[_0xf09d('0x33')]['filter']){_0x1c4b5[_0xf09d('0x3d')]=_['merge'](_0x1c4b5[_0xf09d('0x3d')],{'$or':_[_0xf09d('0x2e')](_0x460f76,function(_0x3e9ccf){if(_0x3e9ccf[_0xf09d('0x3f')]!==_0xf09d('0x40')){var _0xbc2fdb={};_0xbc2fdb[_0x3e9ccf[_0xf09d('0x2c')]]={'$like':'%'+_0x4b20f5[_0xf09d('0x33')][_0xf09d('0x41')]+'%'};return _0xbc2fdb;}})});}_0x1c4b5=_[_0xf09d('0x42')]({},_0x1c4b5,_0x4b20f5[_0xf09d('0x43')]);var _0x2086a5={'where':_0x1c4b5[_0xf09d('0x3d')]};return db[_0xf09d('0x2f')][_0xf09d('0x22')](_0x2086a5)[_0xf09d('0x29')](function(_0x65227b){_0x5a7cbe[_0xf09d('0x22')]=_0x65227b;if(_0x4b20f5[_0xf09d('0x33')][_0xf09d('0x44')]){_0x1c4b5['include']=[{'all':!![]}];}return db[_0xf09d('0x2f')][_0xf09d('0x45')](_0x1c4b5);})[_0xf09d('0x29')](function(_0x28fc44){_0x5a7cbe[_0xf09d('0x46')]=_0x28fc44;return _0x5a7cbe;})[_0xf09d('0x29')](respondWithFilteredResult(_0x4b7eed,_0x1c4b5))[_0xf09d('0x47')](handleError(_0x4b7eed,null));};exports['show']=function(_0x52ee42,_0x4c2021){var _0x245cc9={'raw':![],'where':{'id':_0x52ee42[_0xf09d('0x48')]['id']}},_0x3ff192={};_0x3ff192[_0xf09d('0x32')]=_['keys'](db['UserProfile'][_0xf09d('0x49')]);_0x3ff192[_0xf09d('0x33')]=_['keys'](_0x52ee42[_0xf09d('0x33')]);_0x3ff192[_0xf09d('0x34')]=_[_0xf09d('0x35')](_0x3ff192[_0xf09d('0x32')],_0x3ff192[_0xf09d('0x33')]);_0x245cc9[_0xf09d('0x37')]=_['intersection'](_0x3ff192['model'],qs['fields'](_0x52ee42['query'][_0xf09d('0x36')]));_0x245cc9[_0xf09d('0x37')]=_0x245cc9[_0xf09d('0x37')]['length']?_0x245cc9['attributes']:_0x3ff192[_0xf09d('0x32')];if(_0x52ee42[_0xf09d('0x33')][_0xf09d('0x44')]){_0x245cc9[_0xf09d('0x4a')]=[{'all':!![]}];}_0x245cc9=_[_0xf09d('0x42')]({},_0x245cc9,_0x52ee42[_0xf09d('0x43')]);return db['UserProfile'][_0xf09d('0x4b')](_0x245cc9)['then'](handleEntityNotFound(_0x4c2021,null))['then'](respondWithResult(_0x4c2021,null))[_0xf09d('0x47')](handleError(_0x4c2021,null));};exports[_0xf09d('0x4c')]=function(_0x7e9efc,_0x576f26){return db['UserProfile'][_0xf09d('0x4c')](_0x7e9efc[_0xf09d('0x4d')],{})[_0xf09d('0x29')](respondWithResult(_0x576f26,0xc9))[_0xf09d('0x47')](handleError(_0x576f26,null));};exports['clone']=function(_0x48a411,_0x29e687){var _0x31f5c1={'where':{'id':_0x48a411[_0xf09d('0x48')]['id']}},_0x4cdbff={};_0x4cdbff[_0xf09d('0x32')]=_[_0xf09d('0x4e')](db[_0xf09d('0x2f')][_0xf09d('0x49')]);_0x31f5c1['attributes']=_[_0xf09d('0x35')](_0x4cdbff[_0xf09d('0x32')],qs[_0xf09d('0x36')](_0x48a411[_0xf09d('0x33')][_0xf09d('0x36')]));_0x31f5c1['attributes']=_0x31f5c1['attributes'][_0xf09d('0x38')]?_0x31f5c1['attributes']:_0x4cdbff[_0xf09d('0x32')];if(_0x48a411[_0xf09d('0x33')][_0xf09d('0x44')]){_0x31f5c1[_0xf09d('0x4a')]=[{'all':!![]}];}_0x31f5c1=_[_0xf09d('0x42')]({},_0x31f5c1,_0x48a411[_0xf09d('0x43')]);return db[_0xf09d('0x2f')]['find'](_0x31f5c1)['then'](handleEntityNotFound(_0x29e687,null))[_0xf09d('0x29')](function(_0x18c94a){if(_0x18c94a){var _0x4c4c7e=_0x18c94a[_0xf09d('0x4f')]({'plain':!![]});_0x4c4c7e=qs['omit'](_0x4c4c7e,['id','createdAt',_0xf09d('0x50'),_0xf09d('0x51')]);_0x48a411[_0xf09d('0x4d')]=_['omit'](_0x48a411[_0xf09d('0x4d')],['id',_0xf09d('0x52'),'updatedAt']);return db[_0xf09d('0x53')][_0xf09d('0x54')](function(_0x4cc8d3){return db['UserProfile'][_0xf09d('0x4c')](_[_0xf09d('0x42')](_0x4c4c7e,_0x48a411[_0xf09d('0x4d')]),{'include':_0x48a411[_0xf09d('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4cc8d3})[_0xf09d('0x29')](function(_0x59117c){var _0x47b26f=_0x59117c[_0xf09d('0x4f')]({'plain':!![]});return db[_0xf09d('0x55')][_0xf09d('0x45')]({'where':{'userProfileId':_0x48a411[_0xf09d('0x48')]['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x1d1b01){if(_0x1d1b01){return BPromise[_0xf09d('0x56')](_0x1d1b01,function(_0x24974c){return new BPromise(function(_0x3f129d,_0x402458){if(_0x24974c[_0xf09d('0x57')]===null||_0x24974c[_0xf09d('0x57')]===0x1)_0x3f129d(null);return db[_0xf09d('0x58')][_0xf09d('0x45')]({'where':{'sectionId':_0x24974c['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x4891ae){var _0x5b9e6f=_['map'](_0x4891ae,function(_0x39c5e1){return qs[_0xf09d('0x59')](_0x39c5e1,['id',_0xf09d('0x52'),'updatedAt',_0xf09d('0x5a')]);});_0x3f129d(_0x5b9e6f);})[_0xf09d('0x47')](function(_0x4b7f45){_0x402458(_0x4b7f45);});})['then'](function(_0x3e7362){var _0x2c6852=qs[_0xf09d('0x59')](_0x24974c,['id','createdAt',_0xf09d('0x50')]);_0x2c6852[_0xf09d('0x5b')]=_0x47b26f['id'];if(_0x3e7362)_0x2c6852['Resources']=_0x3e7362;return _0x2c6852;})[_0xf09d('0x29')](function(_0x4c32ff){return db[_0xf09d('0x55')][_0xf09d('0x4c')](_0x4c32ff,{'include':[{'model':db[_0xf09d('0x58')],'as':_0xf09d('0x5c')}],'raw':!![],'transaction':_0x4cc8d3});});})[_0xf09d('0x29')](function(){return _0x47b26f;});}});});});}})['then'](respondWithResult(_0x29e687,0xc9))[_0xf09d('0x47')](handleError(_0x29e687,null));};exports['update']=function(_0x23844c,_0x4fdb0f){if(_0x23844c[_0xf09d('0x4d')]['id']){delete _0x23844c['body']['id'];}return db[_0xf09d('0x2f')][_0xf09d('0x4b')]({'where':{'id':_0x23844c[_0xf09d('0x48')]['id']}})[_0xf09d('0x29')](handleEntityNotFound(_0x4fdb0f,null))[_0xf09d('0x29')](saveUpdates(_0x23844c[_0xf09d('0x4d')],null))[_0xf09d('0x29')](respondWithResult(_0x4fdb0f,null))[_0xf09d('0x47')](handleError(_0x4fdb0f,null));};exports[_0xf09d('0x28')]=function(_0x55f5a9,_0x1c247c){return db[_0xf09d('0x2f')][_0xf09d('0x4b')]({'where':{'id':_0x55f5a9[_0xf09d('0x48')]['id']}})[_0xf09d('0x29')](handleEntityNotFound(_0x1c247c,null))[_0xf09d('0x29')](removeEntity(_0x1c247c,null))[_0xf09d('0x47')](handleError(_0x1c247c,null));};exports[_0xf09d('0x5d')]=function(_0x25efeb,_0x556b87){return db[_0xf09d('0x2f')][_0xf09d('0x5d')]()[_0xf09d('0x29')](respondWithResult(_0x556b87,null))[_0xf09d('0x47')](handleError(_0x556b87,null));};exports[_0xf09d('0x5e')]=function(_0x183fce,_0x111e96){var _0x45850c=_0x183fce['body'];return db[_0xf09d('0x2f')][_0xf09d('0x4b')]({'where':{'id':_0x183fce[_0xf09d('0x48')]['id']}})[_0xf09d('0x29')](handleEntityNotFound(_0x111e96,null))[_0xf09d('0x29')](function(_0x2ed2b7){if(_0x2ed2b7){return db['sequelize'][_0xf09d('0x54')](function(_0x49cb70){return db[_0xf09d('0x55')][_0xf09d('0x28')]({'where':{'userProfileId':_0x183fce[_0xf09d('0x48')]['id'],'sectionId':_[_0xf09d('0x2e')](_0x45850c,function(_0x55316c){return _0x55316c['sectionId'];})},'transaction':_0x49cb70})[_0xf09d('0x29')](function(){var _0x53392e=_[_0xf09d('0x2e')](_0x45850c,function(_0x228986){_0x228986[_0xf09d('0x5b')]=_0x183fce[_0xf09d('0x48')]['id'];return _0x228986;});var _0x2a6cbf=[];return BPromise['each'](_0x53392e,function(_0x3f5808){return db[_0xf09d('0x55')][_0xf09d('0x4c')](_0x3f5808,{'include':[{'model':db[_0xf09d('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x49cb70})[_0xf09d('0x29')](function(_0x276a67){_0x2a6cbf[_0xf09d('0x5f')](_0x276a67[_0xf09d('0x4f')]({'plain':!![]}));});})[_0xf09d('0x29')](function(){return _0x2a6cbf;});});});}})[_0xf09d('0x29')](function(_0x107e84){return _0x107e84;})[_0xf09d('0x29')](respondWithResult(_0x111e96,null))[_0xf09d('0x47')](handleError(_0x111e96,null));};exports[_0xf09d('0x60')]=function(_0x408eef,_0x4911c6){var _0x32f239;return db['UserProfile'][_0xf09d('0x4b')]({'where':{'id':_0x408eef['params']['id']},'attributes':['id',_0xf09d('0x2c')]})[_0xf09d('0x29')](handleEntityNotFound(_0x4911c6,null))[_0xf09d('0x29')](function(_0x5c7711){if(_0x5c7711){_0x32f239=_0x5c7711;return db[_0xf09d('0x55')]['destroy']({'where':{'userProfileId':_0x408eef[_0xf09d('0x48')]['id'],'sectionId':_0x408eef[_0xf09d('0x33')][_0xf09d('0x61')]}});}})[_0xf09d('0x29')](function(){return _0x32f239;})['then'](respondWithStatusCode(_0x4911c6,null))[_0xf09d('0x47')](handleError(_0x4911c6,null));};exports['getSections']=function(_0x13469b,_0x34569b){var _0x20e5bb=[];var _0xda20f2=[];return db[_0xf09d('0x55')][_0xf09d('0x45')]({'where':{'userProfileId':_0x13469b['params']['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x56f30c){_0x20e5bb=_[_0xf09d('0x41')](_0x56f30c,function(_0x28b69b){return _0x28b69b[_0xf09d('0x62')]===0x1||_[_0xf09d('0x63')]([0x3eb,0x709],_0x28b69b['sectionId']);});if(!_[_0xf09d('0x64')](_0x20e5bb)){return _['map'](_0x20e5bb,function(_0x1371a1){return _0x1371a1[_0xf09d('0x5a')];});}else{return;}})[_0xf09d('0x29')](function(_0x3a9a96){if(_0x3a9a96)_0xda20f2=_0x3a9a96;if(_[_0xf09d('0x63')](_0xda20f2,0x64)){var _0x3e8d1d=_[_0xf09d('0x4b')](_0x20e5bb,{'sectionId':0x64});return hasDefaultDashboard(_0x3e8d1d)[_0xf09d('0x29')](function(_0x1c29b7){return _[_0xf09d('0x2e')](_0x20e5bb,function(_0x4bc6b4){if(_0x4bc6b4[_0xf09d('0x5a')]===0x64){_0x4bc6b4[_0xf09d('0x65')]=_0x1c29b7;}return _0x4bc6b4;});});}else{return;}})[_0xf09d('0x29')](function(_0x2e63f2){if(_0x2e63f2)_0x20e5bb=_0x2e63f2;if(_[_0xf09d('0x63')](_0xda20f2,0x3eb)){var _0x8c7171=_[_0xf09d('0x4b')](_0x20e5bb,{'sectionId':0x3eb});return getCustomDashboards(_0x8c7171)['then'](function(_0x4148f1){return _['map'](_0x20e5bb,function(_0x3a2834){if(_0x8c7171[_0xf09d('0x62')]){if(_0x3a2834[_0xf09d('0x5a')]===0x3eb){_0x3a2834[_0xf09d('0x65')]=_0x4148f1;}}else{if(_0x3a2834[_0xf09d('0x5a')]===0x64){_0x3a2834['subsections']=_0x4148f1;}}return _0x3a2834;});});}else{return;}})['then'](function(_0x550130){if(_0x550130)_0x20e5bb=_0x550130;if(_[_0xf09d('0x63')](_0xda20f2,0x709)){var _0x6673db=_[_0xf09d('0x4b')](_0x20e5bb,{'sectionId':0x709});return getPlugins(_0x6673db)[_0xf09d('0x29')](function(_0x52dec5){if(_0x6673db[_0xf09d('0x62')]){return _['map'](_0x20e5bb,function(_0x3c7590){if(_0x3c7590['sectionId']===0x709){_0x3c7590[_0xf09d('0x65')]=_0x52dec5;}return _0x3c7590;});}else{var _0x3bbfe2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x52dec5};var _0x55dfb8=_['map'](_0x20e5bb);_0x55dfb8[_0xf09d('0x5f')](_0x3bbfe2);return _0x55dfb8;}});}else{return;}})[_0xf09d('0x29')](function(_0x26bd8e){if(_0x26bd8e)_0x20e5bb=_0x26bd8e;return _[_0xf09d('0x41')](_0x20e5bb,[_0xf09d('0x62'),0x1]);})[_0xf09d('0x29')](respondWithResult(_0x34569b,null))[_0xf09d('0x47')](handleError(_0x34569b,null));};function hasDefaultDashboard(_0x1a6c86){var _0x255a6a=[0x65];return new BPromise(function(_0x603a35,_0x1b59d2){try{if(_0x1a6c86['autoAssociation']){_0x603a35(_0x255a6a);}else{return db[_0xf09d('0x58')]['findOne']({'where':{'sectionId':_0x1a6c86['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x13242e){_0x13242e?_0x603a35(_0x255a6a):_0x603a35();});}}catch(_0x2235a7){_0x1b59d2(_0x2235a7);}});}function getCustomDashboards(_0x16da1b){var _0x4e6f95=[];return new BPromise(function(_0x5cc4d6,_0x2a6c15){try{if(_0x16da1b['autoAssociation']){return db[_0xf09d('0x66')][_0xf09d('0x45')]({'raw':!![]})[_0xf09d('0x29')](function(_0x1b68b9){_0x1b68b9[_0xf09d('0x67')](function(_0x5afcb7){_0x4e6f95[_0xf09d('0x5f')](_0x5afcb7['id']+0x1869f);});_0x5cc4d6(_0x4e6f95);});}else{return db['UserProfileResource'][_0xf09d('0x45')]({'where':{'sectionId':_0x16da1b['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x4b64e0){_0x4b64e0['forEach'](function(_0x5d3c21){_0x4e6f95[_0xf09d('0x5f')](_0x5d3c21[_0xf09d('0x68')]+0x1869f);});_0x5cc4d6(_0x4e6f95);});}}catch(_0x357692){_0x2a6c15(_0x357692);}});}function getPlugins(_0x1fc8c9){var _0x2ae7e6=[];return new BPromise(function(_0x2c9048,_0x4df104){try{if(_0x1fc8c9['autoAssociation']){return db[_0xf09d('0x69')]['findAll']({'raw':!![]})[_0xf09d('0x29')](function(_0x1c4d02){_0x1c4d02['forEach'](function(_0x3b9739){_0x2ae7e6['push'](_0x3b9739['id']+0x15b38);});_0x2c9048(_0x2ae7e6);});}else{return db[_0xf09d('0x58')][_0xf09d('0x45')]({'where':{'sectionId':_0x1fc8c9['id']},'raw':!![]})[_0xf09d('0x29')](function(_0x2c2539){_0x2c2539[_0xf09d('0x67')](function(_0x86aad0){_0x2ae7e6[_0xf09d('0x5f')](_0x86aad0['resourceId']+0x15b38);});_0x2c9048(_0x2ae7e6);});}}catch(_0x5990a9){_0x4df104(_0x5990a9);}});}exports[_0xf09d('0x6a')]=function(_0x1c3d0,_0x502142){return db[_0xf09d('0x2f')]['find']({'where':{'id':_0x1c3d0[_0xf09d('0x48')]['id']}})[_0xf09d('0x29')](handleEntityNotFound(_0x502142,null))[_0xf09d('0x29')](function(_0x3cc91c){if(_0x3cc91c){return db['sequelize'][_0xf09d('0x54')](function(_0x464665){return db['UserProfileSection'][_0xf09d('0x45')]({'where':{'userProfileId':_0x1c3d0[_0xf09d('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2b8422){if(_0x2b8422){return db[_0xf09d('0x55')][_0xf09d('0x28')]({'where':{'userProfileId':_0x1c3d0[_0xf09d('0x48')]['id'],'id':_[_0xf09d('0x2e')](_0x2b8422,function(_0x410550){return _0x410550['id'];})},'transaction':_0x464665});}})[_0xf09d('0x29')](function(_0x5eed00){var _0x456279=_[_0xf09d('0x2e')](_0x1c3d0['body'],function(_0x3ea15b){_0x3ea15b[_0xf09d('0x5b')]=_0x1c3d0[_0xf09d('0x48')]['id'];return _0x3ea15b;});return db[_0xf09d('0x55')][_0xf09d('0x6b')](_0x456279,{'raw':!![],'transaction':_0x464665});})['then'](function(_0x3840fa){var _0x492c5f=_['filter'](_[_0xf09d('0x2e')](_0x3840fa,function(_0x27f2a3){return _0x27f2a3[_0xf09d('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x492c5f){return db[_0xf09d('0x55')][_0xf09d('0x45')]({'where':{'userProfileId':_0x1c3d0[_0xf09d('0x48')]['id'],'sectionId':_['map'](_0x492c5f,function(_0x3c5654){return _0x3c5654['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xf09d('0x29')](function(_0x1af09b){var _0x1f86f4=_[_0xf09d('0x2e')](_0x1c3d0[_0xf09d('0x4d')],function(_0x107c67){_0x107c67[_0xf09d('0x5b')]=_0x1c3d0[_0xf09d('0x48')]['id'];return _0x107c67;});return db[_0xf09d('0x58')][_0xf09d('0x6b')](_0x1f86f4,{'raw':!![],'transaction':_0x464665});});}})[_0xf09d('0x47')](handleError(_0x502142,null));});}})[_0xf09d('0x29')](function(_0x472f33){var _0x14ccd6=_[_0xf09d('0x2e')](_0x472f33,function(_0x2aed80){return _0x2aed80['get']({'plain':!![]});});})['then'](respondWithResult(_0x502142,null))[_0xf09d('0x47')](handleError(_0x502142,null));};exports[_0xf09d('0x6c')]=function(_0x23b2fd,_0x11ce4e,_0x384a61){return db[_0xf09d('0x2f')][_0xf09d('0x4b')]({'where':{'id':_0x23b2fd[_0xf09d('0x48')]['id']}})[_0xf09d('0x29')](handleEntityNotFound(_0x11ce4e,null))['then'](function(_0x133fbf){if(_0x133fbf){return _0x133fbf[_0xf09d('0x6c')](_0x23b2fd[_0xf09d('0x33')][_0xf09d('0x61')]);}})['then'](respondWithStatusCode(_0x11ce4e,null))[_0xf09d('0x47')](handleError(_0x11ce4e,null));};exports[_0xf09d('0x6d')]=function(_0xdf8602,_0x5c32cf){var _0x3e1858={};if(!_0xdf8602['query'][_0xf09d('0x6e')])throw new Error(_0xf09d('0x6f'));if(!_0xdf8602['query'][_0xf09d('0x39')](_0xf09d('0x3a'))){_0x3e1858['limit']=qs[_0xf09d('0x21')](_0xdf8602[_0xf09d('0x33')][_0xf09d('0x21')]);_0x3e1858[_0xf09d('0x1f')]=qs['offset'](_0xdf8602[_0xf09d('0x33')][_0xf09d('0x1f')]);}return db[_0xf09d('0x2f')][_0xf09d('0x4b')]({'where':{'id':_0xdf8602['params']['id']}})['then'](function(_0x1b00d5){if(!_0x1b00d5)throw new Error(_0xf09d('0x70')+_0xdf8602[_0xf09d('0x48')]['id']);return db['UserProfile'][_0xf09d('0x6d')](_0xdf8602);})['then'](respondWithFilteredResult(_0x5c32cf,_0x3e1858))[_0xf09d('0x47')](handleError(_0x5c32cf,null));}; \ No newline at end of file +var _0x0137=['resourceId','Plugin','bulkCreate','removeResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','UserProfile','fieldName','type','model','query','keys','attributes','intersection','nolimit','order','sort','pick','filters','VIRTUAL','merge','options','where','count','findAll','rows','show','params','fields','include','find','catch','create','clone','rawAttributes','length','includeAll','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','includes','sectionId','subsections','enabled','filter','Dashboard','forEach'];(function(_0x520a1b,_0x446485){var _0x11bea9=function(_0x2241cc){while(--_0x2241cc){_0x520a1b['push'](_0x520a1b['shift']());}};_0x11bea9(++_0x446485);}(_0x0137,0x1d8));var _0x7013=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0x0137[_0x962fc5];return _0x43667c;};'use strict';var emlformat=require(_0x7013('0x0'));var rimraf=require(_0x7013('0x1'));var zipdir=require(_0x7013('0x2'));var jsonpatch=require(_0x7013('0x3'));var rp=require(_0x7013('0x4'));var moment=require('moment');var BPromise=require(_0x7013('0x5'));var Mustache=require(_0x7013('0x6'));var util=require(_0x7013('0x7'));var path=require(_0x7013('0x8'));var sox=require(_0x7013('0x9'));var csv=require(_0x7013('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7013('0xb'));var _=require(_0x7013('0xc'));var squel=require('squel');var crypto=require(_0x7013('0xd'));var jsforce=require(_0x7013('0xe'));var deskjs=require(_0x7013('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7013('0x10'));var Papa=require(_0x7013('0x11'));var Redis=require(_0x7013('0x12'));var authService=require(_0x7013('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7013('0x14'));var hardwareService=require(_0x7013('0x15'));var logger=require(_0x7013('0x16'))(_0x7013('0x17'));var utils=require(_0x7013('0x18'));var config=require(_0x7013('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7013('0x1a'))['db'];config[_0x7013('0x1b')]=_[_0x7013('0x1c')](config[_0x7013('0x1b')],{'host':_0x7013('0x1d'),'port':0x18eb});var socket=require(_0x7013('0x1e'))(new Redis(config[_0x7013('0x1b')]));require(_0x7013('0x1f'))[_0x7013('0x20')](socket);function respondWithStatusCode(_0x710f8a,_0x1c579f){_0x1c579f=_0x1c579f||0xcc;return function(_0x4af565){if(_0x4af565){return _0x710f8a['sendStatus'](_0x1c579f);}return _0x710f8a[_0x7013('0x21')](_0x1c579f)[_0x7013('0x22')]();};}function respondWithResult(_0x3e1a30,_0x4651a6){_0x4651a6=_0x4651a6||0xc8;return function(_0x36beb8){if(_0x36beb8){return _0x3e1a30['status'](_0x4651a6)['json'](_0x36beb8);}};}function respondWithFilteredResult(_0x13590e,_0x159a59){return function(_0x161a19){if(_0x161a19){var _0x1b68b0=typeof _0x159a59[_0x7013('0x23')]==='undefined'&&typeof _0x159a59[_0x7013('0x24')]===_0x7013('0x25');var _0x5da44b=_0x161a19['count'];var _0xdedff=_0x1b68b0?0x0:_0x159a59[_0x7013('0x23')];var _0x1e6e54=_0x1b68b0?_0x161a19['count']:_0x159a59[_0x7013('0x23')]+_0x159a59['limit'];var _0x2e4177;if(_0x1e6e54>=_0x5da44b){_0x1e6e54=_0x5da44b;_0x2e4177=0xc8;}else{_0x2e4177=0xce;}_0x13590e[_0x7013('0x21')](_0x2e4177);return _0x13590e[_0x7013('0x26')](_0x7013('0x27'),_0xdedff+'-'+_0x1e6e54+'/'+_0x5da44b)[_0x7013('0x28')](_0x161a19);}return null;};}function patchUpdates(_0x44c93a){return function(_0x2f261d){try{jsonpatch[_0x7013('0x29')](_0x2f261d,_0x44c93a,!![]);}catch(_0x1ba140){return BPromise[_0x7013('0x2a')](_0x1ba140);}return _0x2f261d[_0x7013('0x2b')]();};}function saveUpdates(_0x99f13d,_0x34811e){return function(_0x18a137){if(_0x18a137){return _0x18a137[_0x7013('0x2c')](_0x99f13d)[_0x7013('0x2d')](function(_0x1c11bf){return _0x1c11bf;});}return null;};}function removeEntity(_0x39c5f0,_0x15eda3){return function(_0x2e591b){if(_0x2e591b){return _0x2e591b[_0x7013('0x2e')]()['then'](function(){_0x39c5f0[_0x7013('0x21')](0xcc)[_0x7013('0x22')]();});}};}function handleEntityNotFound(_0x35d23f,_0x5b4562){return function(_0x15c3eb){if(!_0x15c3eb){_0x35d23f['sendStatus'](0x194);}return _0x15c3eb;};}function handleError(_0xedca92,_0x2c9daa){_0x2c9daa=_0x2c9daa||0x1f4;return function(_0x58a254){logger[_0x7013('0x2f')](_0x58a254['stack']);if(_0x58a254[_0x7013('0x30')]){delete _0x58a254[_0x7013('0x30')];}_0xedca92[_0x7013('0x21')](_0x2c9daa)['send'](_0x58a254);};}exports[_0x7013('0x31')]=function(_0x182958,_0x406322){var _0xe8090={},_0x5ef79c={},_0x44ab0b={'count':0x0,'rows':[]};var _0x4764df=_[_0x7013('0x32')](db[_0x7013('0x33')]['rawAttributes'],function(_0x520525){return{'name':_0x520525[_0x7013('0x34')],'type':_0x520525[_0x7013('0x35')]['key']};});_0x5ef79c[_0x7013('0x36')]=_[_0x7013('0x32')](_0x4764df,_0x7013('0x30'));_0x5ef79c[_0x7013('0x37')]=_[_0x7013('0x38')](_0x182958[_0x7013('0x37')]);_0x5ef79c['filters']=_['intersection'](_0x5ef79c[_0x7013('0x36')],_0x5ef79c[_0x7013('0x37')]);_0xe8090[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x5ef79c[_0x7013('0x36')],qs['fields'](_0x182958[_0x7013('0x37')]['fields']));_0xe8090['attributes']=_0xe8090['attributes']['length']?_0xe8090[_0x7013('0x39')]:_0x5ef79c['model'];if(!_0x182958[_0x7013('0x37')]['hasOwnProperty'](_0x7013('0x3b'))){_0xe8090[_0x7013('0x24')]=qs[_0x7013('0x24')](_0x182958['query'][_0x7013('0x24')]);_0xe8090[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x182958[_0x7013('0x37')][_0x7013('0x23')]);}_0xe8090[_0x7013('0x3c')]=qs[_0x7013('0x3d')](_0x182958[_0x7013('0x37')][_0x7013('0x3d')]);_0xe8090['where']=qs['filters'](_[_0x7013('0x3e')](_0x182958[_0x7013('0x37')],_0x5ef79c[_0x7013('0x3f')]),_0x4764df);if(_0x182958[_0x7013('0x37')]['filter']){_0xe8090['where']=_['merge'](_0xe8090['where'],{'$or':_['map'](_0x4764df,function(_0x28e17b){if(_0x28e17b['type']!==_0x7013('0x40')){var _0x56a178={};_0x56a178[_0x28e17b[_0x7013('0x30')]]={'$like':'%'+_0x182958[_0x7013('0x37')]['filter']+'%'};return _0x56a178;}})});}_0xe8090=_[_0x7013('0x41')]({},_0xe8090,_0x182958[_0x7013('0x42')]);var _0x2627a0={'where':_0xe8090[_0x7013('0x43')]};return db[_0x7013('0x33')][_0x7013('0x44')](_0x2627a0)[_0x7013('0x2d')](function(_0x3afd4a){_0x44ab0b[_0x7013('0x44')]=_0x3afd4a;if(_0x182958[_0x7013('0x37')]['includeAll']){_0xe8090['include']=[{'all':!![]}];}return db[_0x7013('0x33')][_0x7013('0x45')](_0xe8090);})[_0x7013('0x2d')](function(_0x3a9fec){_0x44ab0b[_0x7013('0x46')]=_0x3a9fec;return _0x44ab0b;})['then'](respondWithFilteredResult(_0x406322,_0xe8090))['catch'](handleError(_0x406322,null));};exports[_0x7013('0x47')]=function(_0x25f45a,_0xda2d3a){var _0x4a0e7a={'raw':![],'where':{'id':_0x25f45a[_0x7013('0x48')]['id']}},_0x327cc2={};_0x327cc2['model']=_[_0x7013('0x38')](db[_0x7013('0x33')]['rawAttributes']);_0x327cc2[_0x7013('0x37')]=_['keys'](_0x25f45a[_0x7013('0x37')]);_0x327cc2['filters']=_['intersection'](_0x327cc2[_0x7013('0x36')],_0x327cc2[_0x7013('0x37')]);_0x4a0e7a[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x327cc2[_0x7013('0x36')],qs[_0x7013('0x49')](_0x25f45a[_0x7013('0x37')][_0x7013('0x49')]));_0x4a0e7a[_0x7013('0x39')]=_0x4a0e7a['attributes']['length']?_0x4a0e7a[_0x7013('0x39')]:_0x327cc2[_0x7013('0x36')];if(_0x25f45a['query']['includeAll']){_0x4a0e7a[_0x7013('0x4a')]=[{'all':!![]}];}_0x4a0e7a=_['merge']({},_0x4a0e7a,_0x25f45a[_0x7013('0x42')]);return db['UserProfile'][_0x7013('0x4b')](_0x4a0e7a)[_0x7013('0x2d')](handleEntityNotFound(_0xda2d3a,null))[_0x7013('0x2d')](respondWithResult(_0xda2d3a,null))[_0x7013('0x4c')](handleError(_0xda2d3a,null));};exports[_0x7013('0x4d')]=function(_0x28f10c,_0x3c71fa){return db[_0x7013('0x33')][_0x7013('0x4d')](_0x28f10c['body'],{})['then'](respondWithResult(_0x3c71fa,0xc9))[_0x7013('0x4c')](handleError(_0x3c71fa,null));};exports[_0x7013('0x4e')]=function(_0xa1881a,_0x10cc12){var _0x128009={'where':{'id':_0xa1881a[_0x7013('0x48')]['id']}},_0x461a40={};_0x461a40[_0x7013('0x36')]=_['keys'](db[_0x7013('0x33')][_0x7013('0x4f')]);_0x128009['attributes']=_[_0x7013('0x3a')](_0x461a40[_0x7013('0x36')],qs[_0x7013('0x49')](_0xa1881a[_0x7013('0x37')][_0x7013('0x49')]));_0x128009['attributes']=_0x128009[_0x7013('0x39')][_0x7013('0x50')]?_0x128009['attributes']:_0x461a40[_0x7013('0x36')];if(_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]){_0x128009[_0x7013('0x4a')]=[{'all':!![]}];}_0x128009=_['merge']({},_0x128009,_0xa1881a[_0x7013('0x42')]);return db[_0x7013('0x33')]['find'](_0x128009)[_0x7013('0x2d')](handleEntityNotFound(_0x10cc12,null))['then'](function(_0x5195ae){if(_0x5195ae){var _0x425b06=_0x5195ae[_0x7013('0x52')]({'plain':!![]});_0x425b06=qs[_0x7013('0x53')](_0x425b06,['id',_0x7013('0x54'),_0x7013('0x55'),_0x7013('0x56')]);_0xa1881a[_0x7013('0x57')]=_[_0x7013('0x53')](_0xa1881a[_0x7013('0x57')],['id',_0x7013('0x54'),_0x7013('0x55')]);return db[_0x7013('0x58')][_0x7013('0x59')](function(_0x42cd12){return db[_0x7013('0x33')]['create'](_['merge'](_0x425b06,_0xa1881a['body']),{'include':_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]?[{'all':!![]}]:undefined,'transaction':_0x42cd12})[_0x7013('0x2d')](function(_0x44b678){var _0x2836a3=_0x44b678[_0x7013('0x52')]({'plain':!![]});return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0xa1881a[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x2ae1ea){if(_0x2ae1ea){return BPromise['each'](_0x2ae1ea,function(_0x5e7e43){return new BPromise(function(_0xe83ce9,_0x888890){if(_0x5e7e43[_0x7013('0x5b')]===null||_0x5e7e43[_0x7013('0x5b')]===0x1)_0xe83ce9(null);return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x5e7e43['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x31df3d){var _0x4a2239=_[_0x7013('0x32')](_0x31df3d,function(_0x395840){return qs[_0x7013('0x53')](_0x395840,['id',_0x7013('0x54'),_0x7013('0x55'),'sectionId']);});_0xe83ce9(_0x4a2239);})[_0x7013('0x4c')](function(_0x5498f7){_0x888890(_0x5498f7);});})[_0x7013('0x2d')](function(_0x3e08b3){var _0x394729=qs['omit'](_0x5e7e43,['id',_0x7013('0x54'),_0x7013('0x55')]);_0x394729[_0x7013('0x5d')]=_0x2836a3['id'];if(_0x3e08b3)_0x394729[_0x7013('0x5e')]=_0x3e08b3;return _0x394729;})[_0x7013('0x2d')](function(_0x42fa64){return db[_0x7013('0x5a')]['create'](_0x42fa64,{'include':[{'model':db[_0x7013('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x42cd12});});})[_0x7013('0x2d')](function(){return _0x2836a3;});}});});});}})[_0x7013('0x2d')](respondWithResult(_0x10cc12,0xc9))[_0x7013('0x4c')](handleError(_0x10cc12,null));};exports[_0x7013('0x2c')]=function(_0x57fb5b,_0x3ea42c){if(_0x57fb5b['body']['id']){delete _0x57fb5b['body']['id'];}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x57fb5b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ea42c,null))['then'](saveUpdates(_0x57fb5b[_0x7013('0x57')],null))['then'](respondWithResult(_0x3ea42c,null))['catch'](handleError(_0x3ea42c,null));};exports['destroy']=function(_0x4d0665,_0x4caa98){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4d0665[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x4caa98,null))[_0x7013('0x2d')](removeEntity(_0x4caa98,null))[_0x7013('0x4c')](handleError(_0x4caa98,null));};exports[_0x7013('0x5f')]=function(_0xcff2c7,_0x488caa){return db['UserProfile'][_0x7013('0x5f')]()[_0x7013('0x2d')](respondWithResult(_0x488caa,null))['catch'](handleError(_0x488caa,null));};exports[_0x7013('0x60')]=function(_0x4f85e8,_0x3ad0da){var _0x2dc245=_0x4f85e8[_0x7013('0x57')];return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4f85e8[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](handleEntityNotFound(_0x3ad0da,null))['then'](function(_0x312d71){if(_0x312d71){return db['sequelize'][_0x7013('0x59')](function(_0x20151d){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x4f85e8[_0x7013('0x48')]['id'],'sectionId':_['map'](_0x2dc245,function(_0x4056f4){return _0x4056f4['sectionId'];})},'transaction':_0x20151d})[_0x7013('0x2d')](function(){var _0x3a7eb6=_[_0x7013('0x32')](_0x2dc245,function(_0x27a034){_0x27a034[_0x7013('0x5d')]=_0x4f85e8['params']['id'];return _0x27a034;});var _0x53ec35=[];return BPromise['each'](_0x3a7eb6,function(_0x567a18){return db[_0x7013('0x5a')]['create'](_0x567a18,{'include':[{'model':db['UserProfileResource'],'as':_0x7013('0x5e')}],'raw':!![],'transaction':_0x20151d})['then'](function(_0x16fdc6){_0x53ec35[_0x7013('0x61')](_0x16fdc6[_0x7013('0x52')]({'plain':!![]}));});})['then'](function(){return _0x53ec35;});});});}})[_0x7013('0x2d')](function(_0x3b991d){return _0x3b991d;})[_0x7013('0x2d')](respondWithResult(_0x3ad0da,null))[_0x7013('0x4c')](handleError(_0x3ad0da,null));};exports[_0x7013('0x62')]=function(_0x36d4f8,_0x3a58d1){var _0x51df7c;return db[_0x7013('0x33')]['find']({'where':{'id':_0x36d4f8[_0x7013('0x48')]['id']},'attributes':['id',_0x7013('0x30')]})['then'](handleEntityNotFound(_0x3a58d1,null))['then'](function(_0x10184a){if(_0x10184a){_0x51df7c=_0x10184a;return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x36d4f8[_0x7013('0x48')]['id'],'sectionId':_0x36d4f8[_0x7013('0x37')][_0x7013('0x63')]}});}})[_0x7013('0x2d')](function(){return _0x51df7c;})[_0x7013('0x2d')](respondWithStatusCode(_0x3a58d1,null))['catch'](handleError(_0x3a58d1,null));};exports[_0x7013('0x64')]=function(_0x3b483b,_0xb89bf3){var _0x1d7aa6=[];var _0x3d01e7=[];return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x3b483b[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x413c9e){_0x1d7aa6=_['filter'](_0x413c9e,function(_0x29804e){return _0x29804e['enabled']===0x1||_[_0x7013('0x65')]([0x3eb,0x709],_0x29804e[_0x7013('0x66')]);});if(!_['isEmpty'](_0x1d7aa6)){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x36ec07){return _0x36ec07[_0x7013('0x66')];});}else{return;}})['then'](function(_0x582931){if(_0x582931)_0x3d01e7=_0x582931;if(_[_0x7013('0x65')](_0x3d01e7,0x64)){var _0x17c13b=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x64});return hasDefaultDashboard(_0x17c13b)[_0x7013('0x2d')](function(_0x30b0d9){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x20f13d){if(_0x20f13d[_0x7013('0x66')]===0x64){_0x20f13d[_0x7013('0x67')]=_0x30b0d9;}return _0x20f13d;});});}else{return;}})[_0x7013('0x2d')](function(_0x335e62){if(_0x335e62)_0x1d7aa6=_0x335e62;if(_[_0x7013('0x65')](_0x3d01e7,0x3eb)){var _0x3624ed=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x3eb});return getCustomDashboards(_0x3624ed)[_0x7013('0x2d')](function(_0x542aff){return _[_0x7013('0x32')](_0x1d7aa6,function(_0xcd460d){if(_0x3624ed[_0x7013('0x68')]){if(_0xcd460d[_0x7013('0x66')]===0x3eb){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}else{if(_0xcd460d[_0x7013('0x66')]===0x64){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}return _0xcd460d;});});}else{return;}})[_0x7013('0x2d')](function(_0x33e064){if(_0x33e064)_0x1d7aa6=_0x33e064;if(_['includes'](_0x3d01e7,0x709)){var _0x5c5715=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x709});return getPlugins(_0x5c5715)[_0x7013('0x2d')](function(_0x2d67b6){if(_0x5c5715['enabled']){return _['map'](_0x1d7aa6,function(_0x9887c2){if(_0x9887c2['sectionId']===0x709){_0x9887c2[_0x7013('0x67')]=_0x2d67b6;}return _0x9887c2;});}else{var _0x5ca440={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d67b6};var _0x351642=_[_0x7013('0x32')](_0x1d7aa6);_0x351642['push'](_0x5ca440);return _0x351642;}});}else{return;}})[_0x7013('0x2d')](function(_0xfb256){if(_0xfb256)_0x1d7aa6=_0xfb256;return _[_0x7013('0x69')](_0x1d7aa6,[_0x7013('0x68'),0x1]);})['then'](respondWithResult(_0xb89bf3,null))['catch'](handleError(_0xb89bf3,null));};function hasDefaultDashboard(_0x23566f){var _0x2e68a9=[0x65];return new BPromise(function(_0x12e071,_0x504860){try{if(_0x23566f[_0x7013('0x5b')]){_0x12e071(_0x2e68a9);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x23566f['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x36c309){_0x36c309?_0x12e071(_0x2e68a9):_0x12e071();});}}catch(_0x324335){_0x504860(_0x324335);}});}function getCustomDashboards(_0x124b7a){var _0x2f8790=[];return new BPromise(function(_0x5ae9da,_0x1ceb47){try{if(_0x124b7a[_0x7013('0x5b')]){return db[_0x7013('0x6a')][_0x7013('0x45')]({'raw':!![]})[_0x7013('0x2d')](function(_0x94f539){_0x94f539[_0x7013('0x6b')](function(_0x3b5c70){_0x2f8790['push'](_0x3b5c70['id']+0x1869f);});_0x5ae9da(_0x2f8790);});}else{return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x124b7a['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x8ce268){_0x8ce268['forEach'](function(_0x2fdba1){_0x2f8790[_0x7013('0x61')](_0x2fdba1[_0x7013('0x6c')]+0x1869f);});_0x5ae9da(_0x2f8790);});}}catch(_0x17dac2){_0x1ceb47(_0x17dac2);}});}function getPlugins(_0x150d07){var _0x159111=[];return new BPromise(function(_0x4ee653,_0x39f649){try{if(_0x150d07['autoAssociation']){return db[_0x7013('0x6d')][_0x7013('0x45')]({'raw':!![]})['then'](function(_0xbf39c8){_0xbf39c8['forEach'](function(_0x20676d){_0x159111[_0x7013('0x61')](_0x20676d['id']+0x15b38);});_0x4ee653(_0x159111);});}else{return db['UserProfileResource'][_0x7013('0x45')]({'where':{'sectionId':_0x150d07['id']},'raw':!![]})['then'](function(_0x310b53){_0x310b53['forEach'](function(_0x3a3aa6){_0x159111[_0x7013('0x61')](_0x3a3aa6[_0x7013('0x6c')]+0x15b38);});_0x4ee653(_0x159111);});}}catch(_0x14d179){_0x39f649(_0x14d179);}});}exports['addResources']=function(_0x126f5a,_0x152605){return db['UserProfile'][_0x7013('0x4b')]({'where':{'id':_0x126f5a[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x152605,null))[_0x7013('0x2d')](function(_0x31b468){if(_0x31b468){return db[_0x7013('0x58')][_0x7013('0x59')](function(_0xae7b6b){return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x216eab){if(_0x216eab){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'id':_['map'](_0x216eab,function(_0x3ded8e){return _0x3ded8e['id'];})},'transaction':_0xae7b6b});}})['then'](function(_0x279c64){var _0x43c155=_[_0x7013('0x32')](_0x126f5a['body'],function(_0x181c31){_0x181c31[_0x7013('0x5d')]=_0x126f5a['params']['id'];return _0x181c31;});return db[_0x7013('0x5a')][_0x7013('0x6e')](_0x43c155,{'raw':!![],'transaction':_0xae7b6b});})[_0x7013('0x2d')](function(_0x3ad702){var _0x3dd4db=_[_0x7013('0x69')](_[_0x7013('0x32')](_0x3ad702,function(_0x4a1002){return _0x4a1002[_0x7013('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3dd4db){return db['UserProfileSection'][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'sectionId':_[_0x7013('0x32')](_0x3dd4db,function(_0x54b03f){return _0x54b03f['sectionId'];})},'attributes':['id',_0x7013('0x66')],'raw':!![]})['then'](function(_0x20aa2c){var _0x3069ff=_[_0x7013('0x32')](_0x126f5a[_0x7013('0x57')],function(_0x4e33b2){_0x4e33b2['userProfileId']=_0x126f5a[_0x7013('0x48')]['id'];return _0x4e33b2;});return db[_0x7013('0x5c')]['bulkCreate'](_0x3069ff,{'raw':!![],'transaction':_0xae7b6b});});}})['catch'](handleError(_0x152605,null));});}})[_0x7013('0x2d')](function(_0x1af5ea){var _0x1dd404=_[_0x7013('0x32')](_0x1af5ea,function(_0x1ee9f4){return _0x1ee9f4[_0x7013('0x52')]({'plain':!![]});});})[_0x7013('0x2d')](respondWithResult(_0x152605,null))['catch'](handleError(_0x152605,null));};exports[_0x7013('0x6f')]=function(_0x4db20b,_0x98dc40,_0x1ef916){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4db20b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x98dc40,null))['then'](function(_0x35f41b){if(_0x35f41b){return _0x35f41b[_0x7013('0x6f')](_0x4db20b[_0x7013('0x37')][_0x7013('0x63')]);}})[_0x7013('0x2d')](respondWithStatusCode(_0x98dc40,null))[_0x7013('0x4c')](handleError(_0x98dc40,null));};exports['getResources']=function(_0x5e35b4,_0x47aab0){var _0x4042d5={};if(!_0x5e35b4['query']['section'])throw new Error(_0x7013('0x70'));if(!_0x5e35b4[_0x7013('0x37')][_0x7013('0x71')]('nolimit')){_0x4042d5[_0x7013('0x24')]=qs['limit'](_0x5e35b4['query']['limit']);_0x4042d5[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x5e35b4['query']['offset']);}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x5e35b4[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](function(_0x100644){if(!_0x100644)throw new Error(_0x7013('0x72')+_0x5e35b4[_0x7013('0x48')]['id']);return db[_0x7013('0x33')][_0x7013('0x73')](_0x5e35b4);})['then'](respondWithFilteredResult(_0x47aab0,_0x4042d5))['catch'](handleError(_0x47aab0,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index cb048fb..eb44e82 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 _0xf61e=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4a8b37,_0x529545){var _0x5710e3=function(_0x263d60){while(--_0x263d60){_0x4a8b37['push'](_0x4a8b37['shift']());}};_0x5710e3(++_0x529545);}(_0xf61e,0x191));var _0xef61=function(_0x3e613e,_0x4e2d14){_0x3e613e=_0x3e613e-0x0;var _0x5da465=_0xf61e[_0x3e613e];return _0x5da465;};'use strict';var EventEmitter=require(_0xef61('0x0'));var UserProfile=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xef61('0x3')](0x0);var events={'afterCreate':_0xef61('0x4'),'afterUpdate':_0xef61('0x5'),'afterDestroy':_0xef61('0x6')};function emitEvent(_0x40509e){return function(_0x2bd1d0,_0x14122a,_0x239fa9){UserProfileEvents[_0xef61('0x7')](_0x40509e+':'+_0x2bd1d0['id'],_0x2bd1d0);UserProfileEvents['emit'](_0x40509e,_0x2bd1d0);_0x239fa9(null);};}for(var e in events){if(events[_0xef61('0x8')](e)){var event=events[e];UserProfile[_0xef61('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x6f83=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','save'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x6f83,0x72));var _0x36f8=function(_0x18539a,_0x23ebea){_0x18539a=_0x18539a-0x0;var _0x4b8e37=_0x6f83[_0x18539a];return _0x4b8e37;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x36f8('0x0'))['db'][_0x36f8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36f8('0x2'),'afterUpdate':_0x36f8('0x3'),'afterDestroy':_0x36f8('0x4')};function emitEvent(_0x442b8b){return function(_0x456795,_0xf53947,_0x9ed336){UserProfileEvents[_0x36f8('0x5')](_0x442b8b+':'+_0x456795['id'],_0x456795);UserProfileEvents[_0x36f8('0x5')](_0x442b8b,_0x456795);_0x9ed336(null);};}for(var e in events){if(events[_0x36f8('0x6')](e)){var event=events[e];UserProfile[_0x36f8('0x7')](e,emitEvent(event));}}module[_0x36f8('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fae4a9b..73e1ada 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 _0xf61e=['rows','ids','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','associatedResources','map','catch','findAll','then','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','VoiceQueues','queue','QueueCampaigns','VoiceQueue','type','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','agents','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Dashboard','pauses','Pause','scheduler','Schedule','Sound','Tag','Template','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','all','ignore','union','length','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','autoAssociation','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xf61e,0x191));var _0xef61=function(_0x5a83d5,_0x5eeb12){_0x5a83d5=_0x5a83d5-0x0;var _0x18ec0f=_0xf61e[_0x5a83d5];return _0x18ec0f;};'use strict';var _=require(_0xef61('0x0'));var attributes=require(_0xef61('0x1'));var qs=require(_0xef61('0x2'));var squel=require(_0xef61('0x3'));module[_0xef61('0x4')]=function(_0xeccd26){var _0x3613e6=_0xeccd26[_0xef61('0x5')];function _0x2bd1d0(_0x14122a,_0x239fa9){return new Promise(function(_0x45a18d,_0x5b00b2){if(!_0x239fa9)return _0x45a18d(null);var _0x9e17f4=_0x239fa9[_0xef61('0x6')]?{[_0x239fa9['filter'][_0xef61('0x7')]]:_0x239fa9[_0xef61('0x6')][_0xef61('0x8')]}:undefined;return _0x3613e6[_0x14122a]['findAll']({'where':_0x9e17f4,'raw':!![]})['then'](function(_0x188894){_0x239fa9[_0xef61('0x9')]=_[_0xef61('0xa')](_0x188894,'id');_0x45a18d(_0x239fa9);})[_0xef61('0xb')](function(_0x2af74c){_0x5b00b2(_0x2af74c);});});}function _0xdcd707(_0x1394af,_0x129874){return new Promise(function(_0x237f43,_0x66e7b2){var _0x28d4f7=_0x1394af[_0xef61('0x6')]?{[_0x1394af[_0xef61('0x6')][_0xef61('0x7')]]:_0x1394af['filter'][_0xef61('0x8')]}:undefined;return _0x3613e6[_0x1394af['model']][_0xef61('0xc')]({'where':_0x28d4f7,'raw':!![]})[_0xef61('0xd')](function(_0x370ee0){_0x129874[_0xef61('0x9')]=_['map'](_0x370ee0,function(_0x2ac1b2){return _0x2ac1b2[_0xef61('0xe')];});_0x237f43(_0x129874);})[_0xef61('0xb')](function(_0x78ff22){_0x66e7b2(_0x78ff22);});});}function _0x588a61(_0x66fa62,_0xbe23a7,_0x4f7a62){if(!_0xbe23a7)return Promise[_0xef61('0xf')](null);return new Promise(function(_0x408541,_0x36f558){return _0x3613e6[_0xef61('0x10')][_0xef61('0xc')]({'where':{'sectionId':_0xbe23a7['id']},'raw':!![]})[_0xef61('0xd')](function(_0xdd5e38){if(_0x66fa62['field']&&_0x66fa62[_0xef61('0x7')]!=='id'){_0xbe23a7[_0xef61('0x9')]=_['map'](_0xdd5e38,function(_0xb7ba69){return _0xb7ba69[_0x66fa62[_0xef61('0x7')]];});}else{if(_0x4f7a62===_0xef61('0x11')){_0xbe23a7[_0xef61('0x9')]=_[_0xef61('0xa')](_0xdd5e38,function(_0x2ed61e){return{'id':_0x2ed61e[_0xef61('0x12')],'type':_0x2ed61e['type']};});}else{_0xbe23a7['associatedResources']=_[_0xef61('0xa')](_0xdd5e38,function(_0x58bd7d){return _0x58bd7d[_0xef61('0x12')];});}}_0x408541(_0xbe23a7);})['catch'](function(_0x488b47){_0x36f558(_0x488b47);});});}function _0x2f0569(_0x5ce99d,_0x53181b){var _0xfbee94={'parentSections':[]};switch(_0x5ce99d[_0xef61('0x13')]()){case _0xef61('0x14'):_0xfbee94[_0xef61('0x15')]='SquareProject';break;case _0xef61('0x16'):_0xfbee94['childModel']=_0xef61('0x17');break;case _0xef61('0x18'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x19');_0xfbee94[_0xef61('0x1a')]=[{'name':_0xef61('0x1b'),'field':_0xef61('0xe'),'foreignKey':_0xef61('0x1c')}];break;case _0xef61('0x1d'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x1e');break;case _0xef61('0x1f'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x20');_0xfbee94[_0xef61('0x1a')]=[{'name':_0xef61('0x21'),'field':'id','foreignKey':_0xef61('0x22')}];break;case _0xef61('0x23'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x24');break;case _0xef61('0x25'):_0xfbee94[_0xef61('0x15')]='CmCompany';break;case'globalcustomfields':_0xfbee94[_0xef61('0x15')]=_0xef61('0x26');break;case _0xef61('0x27'):_0xfbee94['childModel']=_0xef61('0x28');break;case _0xef61('0x29'):_0xfbee94['childModel']=_0xef61('0x2a');break;case'faxqueues':_0xfbee94['childModel']=_0xef61('0x2b');break;case'faxaccounts':_0xfbee94[_0xef61('0x15')]='FaxAccount';break;case _0xef61('0x2c'):case _0xef61('0x2d'):case _0xef61('0x2e'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x2f');break;case _0xef61('0x30'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x31');break;case _0xef61('0x32'):_0xfbee94[_0xef61('0x15')]='VoiceMail';break;case _0xef61('0x33'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x34');_0xfbee94[_0xef61('0x1a')]=[{'name':_0xef61('0x35'),'field':'name','foreignKey':_0xef61('0x36'),'model':_0xef61('0x37'),'filter':{'field':_0xef61('0x38'),'value':['agent']}},{'name':'Telephones','field':'name','foreignKey':_0xef61('0x36'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':_0xef61('0x39'),'field':_0xef61('0xe'),'foreignKey':_0xef61('0x3a'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0xef61('0x3b'),'field':_0xef61('0xe'),'foreignKey':'queue','model':_0xef61('0x3c'),'filter':{'field':_0xef61('0x3d'),'value':[_0xef61('0x3e')]}}];break;case _0xef61('0x3f'):_0xfbee94['childModel']=_0xef61('0x40');break;case _0xef61('0x41'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x42');break;case'voiceprefixes':_0xfbee94['childModel']=_0xef61('0x43');break;case _0xef61('0x44'):_0xfbee94[_0xef61('0x15')]='Campaign';break;case _0xef61('0x45'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x46');break;case _0xef61('0x47'):_0xfbee94['childModel']='MailAccount';break;case'mailsubstatuses':_0xfbee94[_0xef61('0x15')]=_0xef61('0x48');break;case _0xef61('0x49'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x4a');break;case _0xef61('0x4b'):_0xfbee94[_0xef61('0x15')]='OpenchannelAccount';break;case _0xef61('0x4c'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x4d');break;case _0xef61('0x4e'):_0xfbee94['childModel']=_0xef61('0x4f');break;case _0xef61('0x50'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x51');break;case _0xef61('0x52'):_0xfbee94[_0xef61('0x15')]='WhatsappAccount';break;case _0xef61('0x53'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x54');break;case'voicequeues':case _0xef61('0x55'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x3c');if(_0x53181b){_0xfbee94[_0xef61('0x1a')]=[{'name':_0xef61('0x39')},{'name':_0xef61('0x3b')}];}break;case'users':case _0xef61('0x56'):case _0xef61('0x57'):_0xfbee94['childModel']=_0xef61('0x37');if(_0x53181b){_0xfbee94[_0xef61('0x1a')]=[{'name':_0xef61('0x58'),'filter':{'field':_0xef61('0x38'),'value':['admin',_0xef61('0x59')]},'ignore':!![]},{'name':_0xef61('0x35')},{'name':_0xef61('0x5a')}];}break;case'zendeskaccounts':_0xfbee94[_0xef61('0x15')]=_0xef61('0x5b');break;case'salesforceaccounts':_0xfbee94[_0xef61('0x15')]=_0xef61('0x5c');break;case _0xef61('0x5d'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x5e');break;case _0xef61('0x5f'):_0xfbee94[_0xef61('0x15')]='SugarcrmAccount';break;case _0xef61('0x60'):_0xfbee94['childModel']=_0xef61('0x61');break;case _0xef61('0x62'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x63');break;case _0xef61('0x64'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x37');break;case _0xef61('0x65'):_0xfbee94[_0xef61('0x15')]='CannedAnswer';break;case _0xef61('0x66'):_0xfbee94[_0xef61('0x15')]='Disposition';break;case'customdashboards':_0xfbee94[_0xef61('0x15')]=_0xef61('0x67');break;case'intervals':_0xfbee94[_0xef61('0x15')]='Interval';break;case _0xef61('0x68'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x69');break;case _0xef61('0x6a'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x6b');break;case'sounds':_0xfbee94[_0xef61('0x15')]=_0xef61('0x6c');break;case'tags':_0xfbee94[_0xef61('0x15')]=_0xef61('0x6d');break;case'templates':_0xfbee94['childModel']=_0xef61('0x6e');break;case'triggers':_0xfbee94['childModel']='Trigger';break;case _0xef61('0x6f'):_0xfbee94[_0xef61('0x15')]='Trunk';break;case _0xef61('0x70'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x71');break;case _0xef61('0x72'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x73');break;case _0xef61('0x74'):_0xfbee94[_0xef61('0x15')]='AnalyticExtractedReport';_0xfbee94['parentSections']=[{'name':_0xef61('0x75'),'field':'id','foreignKey':_0xef61('0x76')}];break;case _0xef61('0x77'):_0xfbee94[_0xef61('0x15')]=_0xef61('0x78');break;}return _0xfbee94;}function _0x5a6d4b(_0x258d9d,_0x572d5f){var _0x5f3b97=_0x258d9d[_0xef61('0x79')](0x0)[_0xef61('0x7a')]()+_0x258d9d[_0xef61('0x7b')](0x1);var _0x525a5e={'type':_0x3613e6[_0xef61('0x7c')][_0xef61('0x7d')][_0xef61('0x7e')],'raw':!![]};return new Promise(function(_0x824157,_0x156888){var _0x2946c6=squel[_0xef61('0x7f')]()[_0xef61('0x7')](_0xef61('0x80')+_0x5f3b97+_0xef61('0x81'),'id')['field'](_0xef61('0x82'))['from']('user_has_'+_0x258d9d+_0xef61('0x83'),'ui')[_0xef61('0x84')](_0xef61('0x85'),_0x572d5f['id']);return _0x3613e6[_0xef61('0x86')][_0xef61('0x87')](_0x2946c6[_0xef61('0x88')](),_0x525a5e)['then'](function(_0x4c7a9a){_0x572d5f[_0x5f3b97+_0xef61('0x89')]=_0x4c7a9a;_0x824157(_0x4c7a9a);})[_0xef61('0xb')](function(_0x362c13){_0x156888(_0x362c13);});});}return _0xeccd26[_0xef61('0x8a')](_0xef61('0x8b'),attributes,{'tableName':_0xef61('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x7f4a77){var _0x33f585={'raw':_0x7f4a77[_0xef61('0x87')][_0xef61('0x8d')],'where':{}};var _0x4433ed={};var _0x4914ed={'count':0x0,'rows':[]};var _0x18d0e8=_0x7f4a77[_0xef61('0x87')]['section'];var _0x4559a6=_0x7f4a77[_0xef61('0x87')][_0xef61('0x8e')]||![];var _0xaeaee6=_0x2f0569(_0x18d0e8,_0x4559a6);if(!_0xaeaee6[_0xef61('0x15')])throw new Error(_0xef61('0x8f')+_0x18d0e8+'\x27');var _0x3e4678=[{'name':_0x18d0e8}];if(!_[_0xef61('0x90')](_0xaeaee6['parentSections']))_0x3e4678=_0xaeaee6[_0xef61('0x1a')];var _0x59b02b=[];for(var _0x58a059=0x0;_0x58a059<_0x3e4678['length'];_0x58a059++){_0x59b02b[_0xef61('0x91')](_0x3613e6[_0xef61('0x92')][_0xef61('0x93')]({'where':{'userProfileId':_0x7f4a77['params']['id'],'name':_0x3e4678[_0x58a059][_0xef61('0xe')]},'raw':!![]}));}return Promise[_0xef61('0x94')](_0x59b02b)[_0xef61('0xd')](function(_0x3a0e72){var _0x2cdac9=_[_0xef61('0x6')](_0x3a0e72,function(_0xa7a17f){return _0xa7a17f?_0xa7a17f:undefined;});var _0x1181d7=_[_0xef61('0x6')](_0x3e4678,[_0xef61('0x95'),!![]]);var _0x128a95=_[_0xef61('0x90')](_0x2cdac9)&&_[_0xef61('0x90')](_0x1181d7)?null:_[_0xef61('0x96')](_0x1181d7,_0x2cdac9);if(!_0x128a95)return null;var _0x477e14=[];for(var _0x5931a4=0x0;_0x5931a4<_0x128a95[_0xef61('0x97')];_0x5931a4++){var _0x117d37=_['find'](_0x3e4678,function(_0xb0ab6d){return _0x128a95[_0x5931a4]?_0xb0ab6d[_0xef61('0xe')]===_0x128a95[_0x5931a4][_0xef61('0xe')]:null;});if(_0x117d37){if(_0x128a95[_0x5931a4][_0xef61('0x95')]){_0x477e14[_0xef61('0x91')](_0x2bd1d0(_0xaeaee6[_0xef61('0x15')],_0x128a95[_0x5931a4]));}else{if(!_0x128a95[_0x5931a4]['autoAssociation']){_0x477e14[_0xef61('0x91')](_0x588a61(_0x117d37,_0x128a95[_0x5931a4],_0xaeaee6[_0xef61('0x15')]));}else{if(_0x117d37['model']){_0x477e14[_0xef61('0x91')](_0xdcd707(_0x117d37,_0x128a95[_0x5931a4]));}}}}}return Promise['all'](_0x477e14);})[_0xef61('0xd')](function(_0x381336){var _0x5c4000=_0x381336;var _0x22575e=null;if(_0x5c4000){_0x22575e=_0x5c4000['length']===0x1?_0x5c4000[0x0]:null;}if(!_0x22575e&&!_0x5c4000)return _0x4914ed;var _0x3cba7f=_0x3613e6[_0xaeaee6[_0xef61('0x15')]]['rawAttributes'];_0x4433ed['model']=_[_0xef61('0x98')](_0x3cba7f);_0x4433ed[_0xef61('0x87')]=_[_0xef61('0x98')](_0x7f4a77[_0xef61('0x87')]);_0x4433ed[_0xef61('0x99')]=_['intersection'](_0x4433ed[_0xef61('0x9a')],_0x4433ed[_0xef61('0x87')]);_0x33f585[_0xef61('0x9b')]=_[_0xef61('0x9c')](_0x4433ed[_0xef61('0x9a')],qs[_0xef61('0x9d')](_0x7f4a77['query'][_0xef61('0x9d')]));_0x33f585['attributes']=_0x33f585[_0xef61('0x9b')][_0xef61('0x97')]?_0x33f585[_0xef61('0x9b')]:_0x4433ed[_0xef61('0x9a')];if(!_0x7f4a77[_0xef61('0x87')][_0xef61('0x9e')](_0xef61('0x9f'))){_0x33f585[_0xef61('0xa0')]=qs[_0xef61('0xa0')](_0x7f4a77[_0xef61('0x87')][_0xef61('0xa0')]);_0x33f585[_0xef61('0xa1')]=qs[_0xef61('0xa1')](_0x7f4a77['query'][_0xef61('0xa1')]);}_0x33f585[_0xef61('0xa2')]=qs[_0xef61('0xa3')](_0x7f4a77[_0xef61('0x87')]['sort']);_0x33f585[_0xef61('0x84')]=qs['filters'](_['pick'](_0x7f4a77[_0xef61('0x87')],_0x4433ed['filters']));if(_0x7f4a77[_0xef61('0x87')]['filter']){_0x33f585['where']=_[_0xef61('0xa4')](_0x33f585[_0xef61('0x84')],{'$or':_['map'](_0x3cba7f,function(_0x13cb62){if(_0x13cb62['type'][_0xef61('0xa5')]!==_0xef61('0xa6')){var _0x1f1e8c={};_0x1f1e8c[_0x13cb62[_0xef61('0x7')]]={'$like':'%'+_0x7f4a77['query'][_0xef61('0x6')]+'%'};return _0x1f1e8c;}})});}var _0x59813e=[];var _0x2e91b2=null;var _0x2ddf83={};if(_0x22575e){_0x2e91b2=_[_0xef61('0x93')](_0x3e4678,[_0xef61('0xe'),_0x22575e[_0xef61('0xe')]]);if(_0x2e91b2[_0xef61('0x7')]){_0x2ddf83={};if(_0xaeaee6[_0xef61('0x15')]===_0xef61('0x11')){_0x2ddf83[_0x2e91b2[_0xef61('0xa7')]]=_['map'](_0x22575e[_0xef61('0x9')],'id');}else{_0x2ddf83[_0x2e91b2['foreignKey']]=_0x22575e[_0xef61('0x9')];}_0x59813e[_0xef61('0x91')](_0x2ddf83);}else{_0x33f585['where']['id']=_0x22575e[_0xef61('0x9')];}}else{for(var _0x5b86e4=0x0;_0x5b86e4<_0x5c4000['length'];_0x5b86e4++){_0x2e91b2=_[_0xef61('0x93')](_0x3e4678,[_0xef61('0xe'),_0x5c4000[_0x5b86e4]['name']]);if(_0x2e91b2[_0xef61('0x7')]){_0x2ddf83={};_0x2ddf83[_0x2e91b2[_0xef61('0xa7')]]=_0x5c4000[_0x5b86e4]['associatedResources'];_0x59813e[_0xef61('0x91')](_0x2ddf83);}else{if(!_0x33f585[_0xef61('0x84')]['id'])_0x33f585['where']['id']=[];_0x5c4000[_0x5b86e4][_0xef61('0x9')]['forEach'](function(_0xa45c6e){_0x33f585[_0xef61('0x84')]['id'][_0xef61('0x91')](_0xa45c6e);});}}}if(!_[_0xef61('0x90')](_0x59813e)){_0x33f585['where']=_[_0xef61('0xa4')](_0x33f585[_0xef61('0x84')],{'$and':{'$or':_0x59813e}});}_0x33f585=_[_0xef61('0xa4')]({},_0x33f585,_0x7f4a77['options']);if(_0x22575e&&!_0x22575e[_0xef61('0xa8')]&&_0xaeaee6[_0xef61('0x15')]==='AnalyticExtractedReport'){if(_0x7f4a77['query'][_0xef61('0xa9')]){_0x33f585[_0xef61('0xaa')]=[{'all':!![]}];}return _0x3613e6[_0xaeaee6[_0xef61('0x15')]][_0xef61('0xc')](_0x33f585)[_0xef61('0xd')](function(_0x1b3b78){var _0x1b669a=[];_0x1b3b78[_0xef61('0xab')](function(_0x16b0cb){var _0x12a8e;switch(_0x16b0cb[_0xef61('0xac')]){case _0xef61('0xad'):_0x12a8e=_[_0xef61('0x93')](_0x22575e[_0xef61('0x9')],function(_0x437b81){return _0x437b81['id']===_0x16b0cb[_0xef61('0x76')]&&_0x437b81['type']===_0xef61('0xae');});break;case _0xef61('0xaf'):_0x12a8e=_[_0xef61('0x93')](_0x22575e[_0xef61('0x9')],function(_0x3d0f55){return _0x3d0f55['id']===_0x16b0cb[_0xef61('0x76')]&&_0x3d0f55[_0xef61('0x3d')]===_0xef61('0xb0');});break;}if(_0x12a8e)_0x1b669a[_0xef61('0x91')](_0x16b0cb);});_0x4914ed[_0xef61('0xb1')]=_0x1b669a[_0xef61('0x97')];_0x4914ed[_0xef61('0xb2')]=_0x1b669a;return _0x4914ed;});}else{if(!_['isEmpty'](_0x7f4a77[_0xef61('0x87')][_0xef61('0xb3')])){_0x33f585['where']['id']=_0x33f585[_0xef61('0x84')]['id']?_[_0xef61('0x9c')](_0x33f585[_0xef61('0x84')]['id'],_0x7f4a77[_0xef61('0x87')][_0xef61('0xb3')]):_0x7f4a77['query'][_0xef61('0xb3')];}return _0x3613e6[_0xaeaee6['childModel']][_0xef61('0xb1')]({'where':_0x33f585[_0xef61('0x84')]})[_0xef61('0xd')](function(_0x19b1a0){_0x4914ed[_0xef61('0xb1')]=_0x19b1a0;if(_0x7f4a77[_0xef61('0x87')][_0xef61('0xa9')]){if(_0xaeaee6[_0xef61('0x15')]==='CmContact'){_0x33f585[_0xef61('0xaa')]=[{'model':_0x3613e6[_0xef61('0x6d')],'as':_0xef61('0xb4'),'attributes':['id',_0xef61('0xe'),_0xef61('0xb5')],'required':_0x7f4a77[_0xef61('0x87')][_0xef61('0xb6')]?!![]:![]},{'model':_0x3613e6[_0xef61('0x6d')],'as':_0xef61('0xb7'),'attributes':['id','name',_0xef61('0xb5')],'through':_0x7f4a77[_0xef61('0x87')][_0xef61('0xb6')]?{'attributes':[],'where':{'TagId':_0x7f4a77[_0xef61('0x87')]['tag']||undefined}}:{},'required':_0x7f4a77['query'][_0xef61('0xb6')]?!![]:![]}];}else{_0x33f585[_0xef61('0xaa')]=[{'all':!![]}];}}return _0x3613e6[_0xaeaee6[_0xef61('0x15')]][_0xef61('0xc')](_0x33f585);})[_0xef61('0xd')](function(_0x4680a6){_0x4914ed[_0xef61('0xb2')]=_0x4680a6;if(_0x18d0e8==='Agents'&&_0x7f4a77[_0xef61('0x87')][_0xef61('0xb8')]===_0xef61('0xb9')){var _0x22e342=[];for(var _0xeda2da=0x0;_0xeda2da<_0x4914ed['rows'][_0xef61('0x97')];_0xeda2da++){_0x22e342['push'](_0x5a6d4b(_0xef61('0xba'),_0x4914ed[_0xef61('0xb2')][_0xeda2da][_0xef61('0xbb')]));_0x22e342[_0xef61('0x91')](_0x5a6d4b(_0xef61('0xbc'),_0x4914ed[_0xef61('0xb2')][_0xeda2da]['dataValues']));_0x22e342[_0xef61('0x91')](_0x5a6d4b(_0xef61('0xbd'),_0x4914ed[_0xef61('0xb2')][_0xeda2da][_0xef61('0xbb')]));_0x22e342[_0xef61('0x91')](_0x5a6d4b(_0xef61('0xbe'),_0x4914ed[_0xef61('0xb2')][_0xeda2da]['dataValues']));_0x22e342[_0xef61('0x91')](_0x5a6d4b(_0xef61('0xbf'),_0x4914ed[_0xef61('0xb2')][_0xeda2da]['dataValues']));_0x22e342['push'](_0x5a6d4b(_0xef61('0xc0'),_0x4914ed[_0xef61('0xb2')][_0xeda2da]['dataValues']));}return Promise[_0xef61('0x94')](_0x22e342)[_0xef61('0xd')](function(){return _0x4914ed;});}return _0x4914ed;});}});}}});}; \ No newline at end of file +var _0x1967=['CustomReports','count','rows','ids','include','Tags','color','tag','ThroughTags','true','chat','dataValues','sms','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','catch','resolve','UserProfileResource','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','name','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','user','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','foreignKey','includeAll','forEach','reportType','default','reportId','custom'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x1967,0x173));var _0x7196=function(_0x2c1271,_0x4ecb54){_0x2c1271=_0x2c1271-0x0;var _0x47ae44=_0x1967[_0x2c1271];return _0x47ae44;};'use strict';var _=require('lodash');var attributes=require(_0x7196('0x0'));var qs=require(_0x7196('0x1'));var squel=require(_0x7196('0x2'));module[_0x7196('0x3')]=function(_0x3319fa){var _0xa80a3f=_0x3319fa[_0x7196('0x4')];function _0x1aaddd(_0x458ae8,_0x3ae43f){return new Promise(function(_0x5c128f,_0x36b01e){if(!_0x3ae43f)return _0x5c128f(null);var _0x186175=_0x3ae43f[_0x7196('0x5')]?{[_0x3ae43f[_0x7196('0x5')][_0x7196('0x6')]]:_0x3ae43f[_0x7196('0x5')]['value']}:undefined;return _0xa80a3f[_0x458ae8][_0x7196('0x7')]({'where':_0x186175,'raw':!![]})[_0x7196('0x8')](function(_0x3f846e){_0x3ae43f[_0x7196('0x9')]=_[_0x7196('0xa')](_0x3f846e,'id');_0x5c128f(_0x3ae43f);})['catch'](function(_0x49e5fb){_0x36b01e(_0x49e5fb);});});}function _0x2028dd(_0x10459b,_0x97bbff){return new Promise(function(_0x107759,_0x25b780){var _0x46f26c=_0x10459b[_0x7196('0x5')]?{[_0x10459b[_0x7196('0x5')][_0x7196('0x6')]]:_0x10459b[_0x7196('0x5')][_0x7196('0xb')]}:undefined;return _0xa80a3f[_0x10459b['model']][_0x7196('0x7')]({'where':_0x46f26c,'raw':!![]})[_0x7196('0x8')](function(_0x3545aa){_0x97bbff[_0x7196('0x9')]=_['map'](_0x3545aa,function(_0x31c778){return _0x31c778['name'];});_0x107759(_0x97bbff);})[_0x7196('0xc')](function(_0x2590a6){_0x25b780(_0x2590a6);});});}function _0xf7e97(_0x3ed1ad,_0x12dce7,_0x2e3e0e){if(!_0x12dce7)return Promise[_0x7196('0xd')](null);return new Promise(function(_0x1ed296,_0x3e4e69){return _0xa80a3f[_0x7196('0xe')][_0x7196('0x7')]({'where':{'sectionId':_0x12dce7['id']},'raw':!![]})['then'](function(_0x4c4f91){if(_0x3ed1ad[_0x7196('0x6')]&&_0x3ed1ad[_0x7196('0x6')]!=='id'){_0x12dce7[_0x7196('0x9')]=_['map'](_0x4c4f91,function(_0x39b944){return _0x39b944[_0x3ed1ad['field']];});}else{if(_0x2e3e0e==='AnalyticExtractedReport'){_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x8dee9d){return{'id':_0x8dee9d['resourceId'],'type':_0x8dee9d['type']};});}else{_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x598a26){return _0x598a26[_0x7196('0xf')];});}}_0x1ed296(_0x12dce7);})[_0x7196('0xc')](function(_0x6e22e5){_0x3e4e69(_0x6e22e5);});});}function _0x18d389(_0x38b3d6,_0x549f34){var _0x3f8178={'parentSections':[]};switch(_0x38b3d6['toLowerCase']()){case _0x7196('0x10'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x12');break;case _0x7196('0x13'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x14');break;case'squarerecordings':_0x3f8178['childModel']=_0x7196('0x15');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x7196('0x18'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x19');break;case'contacts':_0x3f8178[_0x7196('0x11')]='CmContact';_0x3f8178[_0x7196('0x16')]=[{'name':'Lists','field':'id','foreignKey':_0x7196('0x1a')}];break;case _0x7196('0x1b'):_0x3f8178[_0x7196('0x11')]='CmList';break;case _0x7196('0x1c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x1d');break;case _0x7196('0x1e'):_0x3f8178['childModel']=_0x7196('0x1f');break;case _0x7196('0x20'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x21');break;case _0x7196('0x22'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x23');break;case _0x7196('0x24'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x25');break;case _0x7196('0x26'):_0x3f8178['childModel']=_0x7196('0x27');break;case'inboundroutes':case _0x7196('0x28'):case'outboundroutes':_0x3f8178[_0x7196('0x11')]=_0x7196('0x29');break;case'contexts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2a');break;case _0x7196('0x2b'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x2c');break;case'voicerecordings':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2d');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x2e'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x30'),'model':'User','filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x32')]}},{'name':_0x7196('0x33'),'field':'name','foreignKey':_0x7196('0x30'),'model':_0x7196('0x34'),'filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x35')]}},{'name':_0x7196('0x36'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':_0x7196('0x38'),'filter':{'field':_0x7196('0x39'),'value':[_0x7196('0x3a')]}},{'name':'QueueCampaigns','field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':'VoiceQueue','filter':{'field':_0x7196('0x39'),'value':['outbound']}}];break;case'musiconholds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x3b');break;case'chanspies':_0x3f8178['childModel']=_0x7196('0x3c');break;case _0x7196('0x3d'):_0x3f8178[_0x7196('0x11')]='VoicePrefix';break;case _0x7196('0x3e'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x3f');break;case _0x7196('0x40'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x41');break;case _0x7196('0x42'):_0x3f8178[_0x7196('0x11')]='MailAccount';break;case _0x7196('0x43'):_0x3f8178[_0x7196('0x11')]='MailSubstatus';break;case _0x7196('0x44'):_0x3f8178[_0x7196('0x11')]='OpenchannelQueue';break;case _0x7196('0x45'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x46');break;case'smsqueues':_0x3f8178[_0x7196('0x11')]=_0x7196('0x47');break;case'smsaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x48');break;case'whatsappqueues':_0x3f8178[_0x7196('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x3f8178['childModel']='WhatsappAccount';break;case'teams':_0x3f8178[_0x7196('0x11')]='Team';break;case _0x7196('0x49'):case _0x7196('0x4a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x38');if(_0x549f34){_0x3f8178['parentSections']=[{'name':_0x7196('0x36')},{'name':'QueueCampaigns'}];}break;case _0x7196('0x4b'):case _0x7196('0x4c'):case _0x7196('0x4d'):_0x3f8178['childModel']=_0x7196('0x34');if(_0x549f34){_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x4e'),'filter':{'field':'role','value':['admin',_0x7196('0x4f')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7196('0x33')}];}break;case'zendeskaccounts':_0x3f8178['childModel']=_0x7196('0x50');break;case'salesforceaccounts':_0x3f8178['childModel']='SalesforceAccount';break;case _0x7196('0x51'):_0x3f8178['childModel']='FreshdeskAccount';break;case _0x7196('0x52'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x53');break;case _0x7196('0x54'):_0x3f8178['childModel']=_0x7196('0x55');break;case'zohoaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x56');break;case'vtigeraccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x34');break;case _0x7196('0x57'):_0x3f8178['childModel']=_0x7196('0x58');break;case'dispositions':_0x3f8178[_0x7196('0x11')]=_0x7196('0x59');break;case _0x7196('0x5a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5b');break;case _0x7196('0x5c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5d');break;case'pauses':_0x3f8178['childModel']=_0x7196('0x5e');break;case _0x7196('0x5f'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x60');break;case'sounds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x61');break;case _0x7196('0x62'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x63');break;case _0x7196('0x64'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x65');break;case _0x7196('0x66'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x67');break;case'trunks':_0x3f8178[_0x7196('0x11')]=_0x7196('0x68');break;case _0x7196('0x69'):_0x3f8178['childModel']=_0x7196('0x6a');break;case'plugins':_0x3f8178[_0x7196('0x11')]=_0x7196('0x6b');break;case _0x7196('0x6c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x6d');_0x3f8178['parentSections']=[{'name':_0x7196('0x6e'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x3f8178['childModel']=_0x7196('0x6f');break;}return _0x3f8178;}function _0x3be180(_0x20d306,_0x35f342){var _0x105a3f=_0x20d306[_0x7196('0x70')](0x0)[_0x7196('0x71')]()+_0x20d306['slice'](0x1);var _0x293467={'type':_0xa80a3f[_0x7196('0x72')][_0x7196('0x73')][_0x7196('0x74')],'raw':!![]};return new Promise(function(_0x196f12,_0x5ef1eb){var _0x49282d=squel[_0x7196('0x75')]()[_0x7196('0x6')](_0x7196('0x76')+_0x105a3f+_0x7196('0x77'),'id')[_0x7196('0x6')](_0x7196('0x78'))[_0x7196('0x79')](_0x7196('0x7a')+_0x20d306+_0x7196('0x7b'),'ui')[_0x7196('0x7c')](_0x7196('0x7d'),_0x35f342['id']);return _0xa80a3f['sequelize'][_0x7196('0x7e')](_0x49282d[_0x7196('0x7f')](),_0x293467)[_0x7196('0x8')](function(_0x33f43b){_0x35f342[_0x105a3f+'OpenTabs']=_0x33f43b;_0x196f12(_0x33f43b);})[_0x7196('0xc')](function(_0x204c3a){_0x5ef1eb(_0x204c3a);});});}return _0x3319fa[_0x7196('0x80')](_0x7196('0x81'),attributes,{'tableName':_0x7196('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3c3d64){var _0x1d9e75={'raw':_0x3c3d64['query'][_0x7196('0x83')],'where':{}};var _0x2c5cba={};var _0x40df9b={'count':0x0,'rows':[]};var _0x3fb671=_0x3c3d64['query'][_0x7196('0x84')];var _0x3809c4=_0x3c3d64[_0x7196('0x7e')][_0x7196('0x85')]||![];var _0x4673e9=_0x18d389(_0x3fb671,_0x3809c4);if(!_0x4673e9[_0x7196('0x11')])throw new Error(_0x7196('0x86')+_0x3fb671+'\x27');var _0x517dfb=[{'name':_0x3fb671}];if(!_['isEmpty'](_0x4673e9['parentSections']))_0x517dfb=_0x4673e9[_0x7196('0x16')];var _0x49183a=[];for(var _0xd94bd1=0x0;_0xd94bd1<_0x517dfb[_0x7196('0x87')];_0xd94bd1++){_0x49183a[_0x7196('0x88')](_0xa80a3f[_0x7196('0x89')][_0x7196('0x8a')]({'where':{'userProfileId':_0x3c3d64[_0x7196('0x8b')]['id'],'name':_0x517dfb[_0xd94bd1][_0x7196('0x2f')]},'raw':!![]}));}return Promise[_0x7196('0x8c')](_0x49183a)[_0x7196('0x8')](function(_0x52ab69){var _0x5c001a=_[_0x7196('0x5')](_0x52ab69,function(_0x3f939a){return _0x3f939a?_0x3f939a:undefined;});var _0x13e53b=_[_0x7196('0x5')](_0x517dfb,[_0x7196('0x8d'),!![]]);var _0x45e21f=_[_0x7196('0x8e')](_0x5c001a)&&_[_0x7196('0x8e')](_0x13e53b)?null:_['union'](_0x13e53b,_0x5c001a);if(!_0x45e21f)return null;var _0x4cb99d=[];for(var _0x1a736a=0x0;_0x1a736a<_0x45e21f['length'];_0x1a736a++){var _0x30d114=_['find'](_0x517dfb,function(_0x18efc7){return _0x45e21f[_0x1a736a]?_0x18efc7[_0x7196('0x2f')]===_0x45e21f[_0x1a736a][_0x7196('0x2f')]:null;});if(_0x30d114){if(_0x45e21f[_0x1a736a][_0x7196('0x8d')]){_0x4cb99d['push'](_0x1aaddd(_0x4673e9['childModel'],_0x45e21f[_0x1a736a]));}else{if(!_0x45e21f[_0x1a736a][_0x7196('0x8f')]){_0x4cb99d['push'](_0xf7e97(_0x30d114,_0x45e21f[_0x1a736a],_0x4673e9[_0x7196('0x11')]));}else{if(_0x30d114[_0x7196('0x90')]){_0x4cb99d[_0x7196('0x88')](_0x2028dd(_0x30d114,_0x45e21f[_0x1a736a]));}}}}}return Promise[_0x7196('0x8c')](_0x4cb99d);})[_0x7196('0x8')](function(_0x1af971){var _0x4bb3e1=_0x1af971;var _0x3128e6=null;if(_0x4bb3e1){_0x3128e6=_0x4bb3e1[_0x7196('0x87')]===0x1?_0x4bb3e1[0x0]:null;}if(!_0x3128e6&&!_0x4bb3e1)return _0x40df9b;var _0x41208b=_0xa80a3f[_0x4673e9[_0x7196('0x11')]][_0x7196('0x91')];_0x2c5cba[_0x7196('0x90')]=_[_0x7196('0x92')](_0x41208b);_0x2c5cba[_0x7196('0x7e')]=_[_0x7196('0x92')](_0x3c3d64[_0x7196('0x7e')]);_0x2c5cba[_0x7196('0x93')]=_[_0x7196('0x94')](_0x2c5cba['model'],_0x2c5cba[_0x7196('0x7e')]);_0x1d9e75[_0x7196('0x95')]=_['intersection'](_0x2c5cba['model'],qs[_0x7196('0x96')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x96')]));_0x1d9e75['attributes']=_0x1d9e75[_0x7196('0x95')]['length']?_0x1d9e75[_0x7196('0x95')]:_0x2c5cba[_0x7196('0x90')];if(!_0x3c3d64['query'][_0x7196('0x97')]('nolimit')){_0x1d9e75['limit']=qs[_0x7196('0x98')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x98')]);_0x1d9e75['offset']=qs[_0x7196('0x99')](_0x3c3d64['query'][_0x7196('0x99')]);}_0x1d9e75[_0x7196('0x9a')]=qs[_0x7196('0x9b')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x9b')]);_0x1d9e75['where']=qs[_0x7196('0x93')](_[_0x7196('0x9c')](_0x3c3d64[_0x7196('0x7e')],_0x2c5cba[_0x7196('0x93')]));if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0x5')]){_0x1d9e75[_0x7196('0x7c')]=_[_0x7196('0x9d')](_0x1d9e75['where'],{'$or':_[_0x7196('0xa')](_0x41208b,function(_0x1919d8){if(_0x1919d8[_0x7196('0x39')][_0x7196('0x9e')]!=='VIRTUAL'){var _0x1364f5={};_0x1364f5[_0x1919d8[_0x7196('0x6')]]={'$like':'%'+_0x3c3d64['query'][_0x7196('0x5')]+'%'};return _0x1364f5;}})});}var _0x53d470=[];var _0xd6d8cf=null;var _0x5318c1={};if(_0x3128e6){_0xd6d8cf=_[_0x7196('0x8a')](_0x517dfb,[_0x7196('0x2f'),_0x3128e6['name']]);if(_0xd6d8cf[_0x7196('0x6')]){_0x5318c1={};if(_0x4673e9[_0x7196('0x11')]===_0x7196('0x6d')){_0x5318c1[_0xd6d8cf['foreignKey']]=_['map'](_0x3128e6[_0x7196('0x9')],'id');}else{_0x5318c1[_0xd6d8cf['foreignKey']]=_0x3128e6['associatedResources'];}_0x53d470[_0x7196('0x88')](_0x5318c1);}else{_0x1d9e75[_0x7196('0x7c')]['id']=_0x3128e6[_0x7196('0x9')];}}else{for(var _0x509c4a=0x0;_0x509c4a<_0x4bb3e1[_0x7196('0x87')];_0x509c4a++){_0xd6d8cf=_[_0x7196('0x8a')](_0x517dfb,[_0x7196('0x2f'),_0x4bb3e1[_0x509c4a][_0x7196('0x2f')]]);if(_0xd6d8cf[_0x7196('0x6')]){_0x5318c1={};_0x5318c1[_0xd6d8cf[_0x7196('0x9f')]]=_0x4bb3e1[_0x509c4a][_0x7196('0x9')];_0x53d470[_0x7196('0x88')](_0x5318c1);}else{if(!_0x1d9e75[_0x7196('0x7c')]['id'])_0x1d9e75[_0x7196('0x7c')]['id']=[];_0x4bb3e1[_0x509c4a][_0x7196('0x9')]['forEach'](function(_0x5acff1){_0x1d9e75[_0x7196('0x7c')]['id']['push'](_0x5acff1);});}}}if(!_['isEmpty'](_0x53d470)){_0x1d9e75[_0x7196('0x7c')]=_[_0x7196('0x9d')](_0x1d9e75[_0x7196('0x7c')],{'$and':{'$or':_0x53d470}});}_0x1d9e75=_[_0x7196('0x9d')]({},_0x1d9e75,_0x3c3d64['options']);if(_0x3128e6&&!_0x3128e6['autoAssociation']&&_0x4673e9[_0x7196('0x11')]===_0x7196('0x6d')){if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0xa0')]){_0x1d9e75['include']=[{'all':!![]}];}return _0xa80a3f[_0x4673e9[_0x7196('0x11')]]['findAll'](_0x1d9e75)['then'](function(_0x2820ef){var _0x884d80=[];_0x2820ef[_0x7196('0xa1')](function(_0x494418){var _0x400aa5;switch(_0x494418[_0x7196('0xa2')]){case _0x7196('0xa3'):_0x400aa5=_[_0x7196('0x8a')](_0x3128e6[_0x7196('0x9')],function(_0x3e06c4){return _0x3e06c4['id']===_0x494418[_0x7196('0xa4')]&&_0x3e06c4[_0x7196('0x39')]==='DefaultReports';});break;case _0x7196('0xa5'):_0x400aa5=_[_0x7196('0x8a')](_0x3128e6[_0x7196('0x9')],function(_0x408760){return _0x408760['id']===_0x494418[_0x7196('0xa4')]&&_0x408760['type']===_0x7196('0xa6');});break;}if(_0x400aa5)_0x884d80[_0x7196('0x88')](_0x494418);});_0x40df9b[_0x7196('0xa7')]=_0x884d80['length'];_0x40df9b[_0x7196('0xa8')]=_0x884d80;return _0x40df9b;});}else{if(!_['isEmpty'](_0x3c3d64['query'][_0x7196('0xa9')])){_0x1d9e75[_0x7196('0x7c')]['id']=_0x1d9e75['where']['id']?_[_0x7196('0x94')](_0x1d9e75[_0x7196('0x7c')]['id'],_0x3c3d64['query'][_0x7196('0xa9')]):_0x3c3d64[_0x7196('0x7e')][_0x7196('0xa9')];}return _0xa80a3f[_0x4673e9[_0x7196('0x11')]][_0x7196('0xa7')]({'where':_0x1d9e75[_0x7196('0x7c')]})['then'](function(_0x3639be){_0x40df9b[_0x7196('0xa7')]=_0x3639be;if(_0x3c3d64[_0x7196('0x7e')]['includeAll']){if(_0x4673e9['childModel']==='CmContact'){_0x1d9e75[_0x7196('0xaa')]=[{'model':_0xa80a3f[_0x7196('0x63')],'as':_0x7196('0xab'),'attributes':['id','name',_0x7196('0xac')],'required':_0x3c3d64['query'][_0x7196('0xad')]?!![]:![]},{'model':_0xa80a3f['Tag'],'as':_0x7196('0xae'),'attributes':['id',_0x7196('0x2f'),_0x7196('0xac')],'through':_0x3c3d64[_0x7196('0x7e')][_0x7196('0xad')]?{'attributes':[],'where':{'TagId':_0x3c3d64[_0x7196('0x7e')][_0x7196('0xad')]||undefined}}:{},'required':_0x3c3d64['query'][_0x7196('0xad')]?!![]:![]}];}else{_0x1d9e75['include']=[{'all':!![]}];}}return _0xa80a3f[_0x4673e9['childModel']]['findAll'](_0x1d9e75);})['then'](function(_0x4cf635){_0x40df9b[_0x7196('0xa8')]=_0x4cf635;if(_0x3fb671===_0x7196('0x2e')&&_0x3c3d64[_0x7196('0x7e')]['openTabs']===_0x7196('0xaf')){var _0x49bf7e=[];for(var _0x5080fd=0x0;_0x5080fd<_0x40df9b['rows'][_0x7196('0x87')];_0x5080fd++){_0x49bf7e['push'](_0x3be180(_0x7196('0xb0'),_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180(_0x7196('0xb2'),_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('fax',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('mail',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('openchannel',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('whatsapp',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));}return Promise['all'](_0x49bf7e)[_0x7196('0x8')](function(){return _0x40df9b;});}return _0x40df9b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e0638ac..7511fdd 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 _0xfc65=['redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x28cd49,_0x22bd28){_0x28cd49=_0x28cd49-0x0;var _0xb50e5=_0xfc65[_0x28cd49];return _0xb50e5;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});config[_0x5fc6('0xc')]=_[_0x5fc6('0xd')](config['redis'],{'host':_0x5fc6('0xe'),'port':0x18eb});var socket=require(_0x5fc6('0xf'))(new Redis(config[_0x5fc6('0xc')]));require(_0x5fc6('0x10'))[_0x5fc6('0x11')](socket);function respondWithRpcPromise(_0xbc3db9,_0x23c4e2,_0x27cad8){return new BPromise(function(_0x3d8781,_0x29781f){return client['request'](_0xbc3db9,_0x27cad8)[_0x5fc6('0x12')](function(_0x51ad7e){logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x23c4e2,_0x5fc6('0x15'));logger[_0x5fc6('0x16')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x23c4e2,_0x5fc6('0x15'),JSON[_0x5fc6('0x17')](_0x51ad7e));if(_0x51ad7e[_0x5fc6('0x18')]){if(_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x19')]===0x1f4){logger[_0x5fc6('0x18')](_0x5fc6('0x14'),_0x23c4e2,_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x1a')]);return _0x29781f(_0x51ad7e[_0x5fc6('0x18')]['message']);}logger['error'](_0x5fc6('0x14'),_0x23c4e2,_0x51ad7e[_0x5fc6('0x18')]['message']);return _0x3d8781(_0x51ad7e[_0x5fc6('0x18')][_0x5fc6('0x1a')]);}else{logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x23c4e2,_0x5fc6('0x15'));_0x3d8781(_0x51ad7e[_0x5fc6('0x1b')]['message']);}})[_0x5fc6('0x1c')](function(_0x4363c1){logger[_0x5fc6('0x18')](_0x5fc6('0x14'),_0x23c4e2,_0x4363c1);_0x29781f(_0x4363c1);});});} \ No newline at end of file +var _0x4a03=['http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x15526e,_0x223176){var _0x2c2005=function(_0x236bb2){while(--_0x236bb2){_0x15526e['push'](_0x15526e['shift']());}};_0x2c2005(++_0x223176);}(_0x4a03,0x16e));var _0x34a0=function(_0x17c193,_0x57560d){_0x17c193=_0x17c193-0x0;var _0x153d76=_0x4a03[_0x17c193];return _0x153d76;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});config['redis']=_[_0x34a0('0xa')](config[_0x34a0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x34a0('0xc'))(new Redis(config[_0x34a0('0xb')]));require(_0x34a0('0xd'))[_0x34a0('0xe')](socket);function respondWithRpcPromise(_0x761a80,_0x4faf06,_0x40d73d){return new BPromise(function(_0x2c39bf,_0x21e702){return client[_0x34a0('0xf')](_0x761a80,_0x40d73d)[_0x34a0('0x10')](function(_0x343d24){logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,'request\x20sent');logger['debug'](_0x34a0('0x13'),_0x4faf06,_0x34a0('0x14'),JSON['stringify'](_0x343d24));if(_0x343d24[_0x34a0('0x15')]){if(_0x343d24[_0x34a0('0x15')][_0x34a0('0x16')]===0x1f4){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x21e702(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x2c39bf(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}else{logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,_0x34a0('0x14'));_0x2c39bf(_0x343d24[_0x34a0('0x18')][_0x34a0('0x17')]);}})['catch'](function(_0x466525){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x466525);_0x21e702(_0x466525);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ae95d4e..328a218 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 _0xe6d3=['remove','update','emit','register','userProfile:','./userProfile.events','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe6d3,0x1e1));var _0x3e6d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe6d3[_0x56482c];return _0x5aae7a;};'use strict';var UserProfileEvents=require(_0x3e6d('0x0'));var events=[_0x3e6d('0x1'),_0x3e6d('0x2'),_0x3e6d('0x3')];function createListener(_0xb43202,_0x38927c){return function(_0x3ff65b){_0x38927c[_0x3e6d('0x4')](_0xb43202,_0x3ff65b);};}function removeListener(_0x3aa520,_0x468669){return function(){UserProfileEvents['removeListener'](_0x3aa520,_0x468669);};}exports[_0x3e6d('0x5')]=function(_0x26daa8){for(var _0x15c285=0x0,_0x2c1ec9=events['length'];_0x15c285<_0x2c1ec9;_0x15c285++){var _0x13b76d=events[_0x15c285];var _0x5b2692=createListener(_0x3e6d('0x6')+_0x13b76d,_0x26daa8);UserProfileEvents['on'](_0x13b76d,_0x5b2692);}}; \ No newline at end of file +var _0x036d=['./userProfile.events','save','remove','update','emit','register','length','userProfile:'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x036d,0x1d8));var _0xd036=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x036d[_0x465a0c];return _0x1e202e;};'use strict';var UserProfileEvents=require(_0xd036('0x0'));var events=[_0xd036('0x1'),_0xd036('0x2'),_0xd036('0x3')];function createListener(_0x598f7d,_0x2a1bc5){return function(_0x273624){_0x2a1bc5[_0xd036('0x4')](_0x598f7d,_0x273624);};}function removeListener(_0x3cdb73,_0x232e46){return function(){UserProfileEvents['removeListener'](_0x3cdb73,_0x232e46);};}exports[_0xd036('0x5')]=function(_0x31dc91){for(var _0x376b75=0x0,_0x48b2f7=events[_0xd036('0x6')];_0x376b75<_0x48b2f7;_0x376b75++){var _0x2b1d14=events[_0x376b75];var _0x3fe7c0=createListener(_0xd036('0x7')+_0x2b1d14,_0x31dc91);UserProfileEvents['on'](_0x2b1d14,_0x3fe7c0);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d88c8db..447c8f4 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 _0x39a2=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x39a2,0x171));var _0x239a=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x39a2[_0x56e0e8];return _0x2dab50;};'use strict';var multer=require(_0x239a('0x0'));var util=require(_0x239a('0x1'));var path=require('path');var timeout=require(_0x239a('0x2'));var express=require('express');var router=express[_0x239a('0x3')]();var fs_extra=require(_0x239a('0x4'));var auth=require(_0x239a('0x5'));var interaction=require(_0x239a('0x6'));var config=require(_0x239a('0x7'));var controller=require(_0x239a('0x8'));router[_0x239a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x239a('0xa')](),controller[_0x239a('0xb')]);router[_0x239a('0x9')](_0x239a('0xc'),auth[_0x239a('0xa')](),controller[_0x239a('0xd')]);router[_0x239a('0xe')]('/',auth['isAuthenticated'](),controller[_0x239a('0xf')]);router[_0x239a('0x10')](_0x239a('0xc'),auth['isAuthenticated'](),controller[_0x239a('0x11')]);router['delete'](_0x239a('0xc'),auth[_0x239a('0xa')](),controller[_0x239a('0x12')]);module[_0x239a('0x13')]=router; \ No newline at end of file +var _0xc4a1=['./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4a1,0xa1));var _0x1c4a=function(_0xd03201,_0x1644c9){_0xd03201=_0xd03201-0x0;var _0x383be4=_0xc4a1[_0xd03201];return _0x383be4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c4a('0x0'));var timeout=require(_0x1c4a('0x1'));var express=require(_0x1c4a('0x2'));var router=express[_0x1c4a('0x3')]();var fs_extra=require(_0x1c4a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1c4a('0x5'));var config=require(_0x1c4a('0x6'));var controller=require(_0x1c4a('0x7'));router['get']('/',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x9')]);router[_0x1c4a('0xa')](_0x1c4a('0xb'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0xc')]);router['get'](_0x1c4a('0xd'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0xe')]);router[_0x1c4a('0xf')]('/',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x10')]);router[_0x1c4a('0x11')](_0x1c4a('0xd'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x12')]);router['delete']('/:id',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x13')]);module[_0x1c4a('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 523f666..21b6bcb 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 _0x83a8=['exports','STRING','INTEGER','sequelize'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x83a8,0x17b));var _0x883a=function(_0x403f3e,_0x23ba55){_0x403f3e=_0x403f3e-0x0;var _0x369ef6=_0x83a8[_0x403f3e];return _0x369ef6;};'use strict';var Sequelize=require(_0x883a('0x0'));module[_0x883a('0x1')]={'name':{'type':Sequelize[_0x883a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x883a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x883a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1d07=['sequelize','INTEGER','STRING'];(function(_0x25dfa5,_0x481524){var _0x2cb0a3=function(_0x1d9901){while(--_0x1d9901){_0x25dfa5['push'](_0x25dfa5['shift']());}};_0x2cb0a3(++_0x481524);}(_0x1d07,0xd5));var _0x71d0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1d07[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x71d0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x71d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x71d0('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 d63867f..2212cff 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 _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfileResource'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['UserProfileResource'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['UserProfileResource'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file +var _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x1167ac,_0x2793e0){var _0x272913=function(_0x1f6fd3){while(--_0x1f6fd3){_0x1167ac['push'](_0x1167ac['shift']());}};_0x272913(++_0x2793e0);}(_0x5496,0x175));var _0x6549=function(_0x1fd0a2,_0x1b896a){_0x1fd0a2=_0x1fd0a2-0x0;var _0x6ba97f=_0x5496[_0x1fd0a2];return _0x6ba97f;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['UserProfileResource'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7bd1e15..d271afd 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 _0x0133=['moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api'];(function(_0x255036,_0xf94145){var _0x3c4c56=function(_0x50a35c){while(--_0x50a35c){_0x255036['push'](_0x255036['shift']());}};_0x3c4c56(++_0xf94145);}(_0x0133,0x192));var _0x3013=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x0133[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x3013('0x0'));var util=require('util');var logger=require(_0x3013('0x1'))(_0x3013('0x2'));var moment=require(_0x3013('0x3'));var BPromise=require(_0x3013('0x4'));var rp=require(_0x3013('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3013('0x6'));var attributes=require(_0x3013('0x7'));module[_0x3013('0x8')]=function(_0x46c568,_0x33980d){return _0x46c568[_0x3013('0x9')](_0x3013('0xa'),attributes,{'tableName':_0x3013('0xb'),'paranoid':![],'indexes':[{'name':_0x3013('0xc'),'fields':[_0x3013('0xd'),_0x3013('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8166=['moment','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','util','../../config/logger','api'];(function(_0x2a0030,_0x49e6ac){var _0x59e0e0=function(_0xb519fe){while(--_0xb519fe){_0x2a0030['push'](_0x2a0030['shift']());}};_0x59e0e0(++_0x49e6ac);}(_0x8166,0xf4));var _0x6816=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x8166[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require('lodash');var util=require(_0x6816('0x0'));var logger=require(_0x6816('0x1'))(_0x6816('0x2'));var moment=require(_0x6816('0x3'));var BPromise=require('bluebird');var rp=require(_0x6816('0x4'));var fs=require('fs');var path=require(_0x6816('0x5'));var rimraf=require(_0x6816('0x6'));var config=require('../../config/environment');var attributes=require(_0x6816('0x7'));module[_0x6816('0x8')]=function(_0x1858d4,_0x13ea18){return _0x1858d4[_0x6816('0x9')](_0x6816('0xa'),attributes,{'tableName':_0x6816('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x6816('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 132fd61..2b89ddb 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 _0x3373=['error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../config/logger','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a34be,_0x43cc18){var _0x478b0e=function(_0x374709){while(--_0x374709){_0x3a34be['push'](_0x3a34be['shift']());}};_0x478b0e(++_0x43cc18);}(_0x3373,0xd7));var _0x3337=function(_0x4ad81c,_0x46cf6f){_0x4ad81c=_0x4ad81c-0x0;var _0x3c0c00=_0x3373[_0x4ad81c];return _0x3c0c00;};'use strict';var _=require(_0x3337('0x0'));var util=require(_0x3337('0x1'));var moment=require('moment');var BPromise=require(_0x3337('0x2'));var rs=require(_0x3337('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3337('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3337('0x5'));var client=jayson['client'][_0x3337('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xe159d0,_0x1af938,_0x19ad45){return new BPromise(function(_0x41e8aa,_0xf7206c){return client['request'](_0xe159d0,_0x19ad45)[_0x3337('0x7')](function(_0x57ca56){logger[_0x3337('0x8')](_0x3337('0x9'),_0x1af938,'request\x20sent');logger[_0x3337('0xa')](_0x3337('0xb'),_0x1af938,'request\x20sent',JSON[_0x3337('0xc')](_0x57ca56));if(_0x57ca56[_0x3337('0xd')]){if(_0x57ca56[_0x3337('0xd')][_0x3337('0xe')]===0x1f4){logger[_0x3337('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x1af938,_0x57ca56[_0x3337('0xd')][_0x3337('0xf')]);return _0xf7206c(_0x57ca56['error'][_0x3337('0xf')]);}logger[_0x3337('0xd')](_0x3337('0x9'),_0x1af938,_0x57ca56[_0x3337('0xd')][_0x3337('0xf')]);return _0x41e8aa(_0x57ca56[_0x3337('0xd')]['message']);}else{logger[_0x3337('0x8')](_0x3337('0x9'),_0x1af938,_0x3337('0x10'));_0x41e8aa(_0x57ca56[_0x3337('0x11')][_0x3337('0xf')]);}})[_0x3337('0x12')](function(_0x24b3c7){logger['error'](_0x3337('0x9'),_0x1af938,_0x24b3c7);_0xf7206c(_0x24b3c7);});});} \ No newline at end of file +var _0x005c=['then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x005c,0x173));var _0xc005=function(_0x578f07,_0x7fb8d5){_0x578f07=_0x578f07-0x0;var _0x5cdd72=_0x005c[_0x578f07];return _0x5cdd72;};'use strict';var _=require(_0xc005('0x0'));var util=require(_0xc005('0x1'));var moment=require('moment');var BPromise=require(_0xc005('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc005('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc005('0x4'))(_0xc005('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc005('0x6')][_0xc005('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x140afb,_0x43b25d,_0xdfffdf){return new BPromise(function(_0x3c69b0,_0xe19bc2){return client[_0xc005('0x8')](_0x140afb,_0xdfffdf)[_0xc005('0x9')](function(_0x528c1b){logger[_0xc005('0xa')](_0xc005('0xb'),_0x43b25d,'request\x20sent');logger['debug'](_0xc005('0xc'),_0x43b25d,_0xc005('0xd'),JSON['stringify'](_0x528c1b));if(_0x528c1b['error']){if(_0x528c1b[_0xc005('0xe')][_0xc005('0xf')]===0x1f4){logger[_0xc005('0xe')](_0xc005('0xb'),_0x43b25d,_0x528c1b[_0xc005('0xe')][_0xc005('0x10')]);return _0xe19bc2(_0x528c1b['error'][_0xc005('0x10')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43b25d,_0x528c1b[_0xc005('0xe')]['message']);return _0x3c69b0(_0x528c1b[_0xc005('0xe')][_0xc005('0x10')]);}else{logger[_0xc005('0xa')](_0xc005('0xb'),_0x43b25d,'request\x20sent');_0x3c69b0(_0x528c1b[_0xc005('0x11')][_0xc005('0x10')]);}})[_0xc005('0x12')](function(_0x5c5ffe){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43b25d,_0x5c5ffe);_0xe19bc2(_0x5c5ffe);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 48ecf7e..98c1b41 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 _0x6408=['/describe','describe','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x22e05d,_0x149d01){var _0x4121ea=function(_0x20d485){while(--_0x20d485){_0x22e05d['push'](_0x22e05d['shift']());}};_0x4121ea(++_0x149d01);}(_0x6408,0x13a));var _0x8640=function(_0x180d3e,_0x18905c){_0x180d3e=_0x180d3e-0x0;var _0x15570d=_0x6408[_0x180d3e];return _0x15570d;};'use strict';var multer=require(_0x8640('0x0'));var util=require(_0x8640('0x1'));var path=require(_0x8640('0x2'));var timeout=require(_0x8640('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8640('0x4'));var interaction=require(_0x8640('0x5'));var config=require(_0x8640('0x6'));var controller=require(_0x8640('0x7'));router[_0x8640('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8640('0x8')](_0x8640('0x9'),auth['isAuthenticated'](),controller[_0x8640('0xa')]);router[_0x8640('0x8')]('/:id',auth[_0x8640('0xb')](),controller[_0x8640('0xc')]);router[_0x8640('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8640('0xe'),auth[_0x8640('0xb')](),controller[_0x8640('0xf')]);router[_0x8640('0x10')](_0x8640('0xe'),auth['isAuthenticated'](),controller[_0x8640('0x11')]);module[_0x8640('0x12')]=router; \ No newline at end of file +var _0x7173=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x4ef870,_0x2f480a){var _0x1ebe09=function(_0x1f98a1){while(--_0x1f98a1){_0x4ef870['push'](_0x4ef870['shift']());}};_0x1ebe09(++_0x2f480a);}(_0x7173,0xb1));var _0x3717=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7173[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x3717('0x0'));var util=require(_0x3717('0x1'));var path=require(_0x3717('0x2'));var timeout=require(_0x3717('0x3'));var express=require(_0x3717('0x4'));var router=express[_0x3717('0x5')]();var fs_extra=require(_0x3717('0x6'));var auth=require(_0x3717('0x7'));var interaction=require(_0x3717('0x8'));var config=require('../../config/environment');var controller=require(_0x3717('0x9'));router[_0x3717('0xa')]('/',auth['isAuthenticated'](),controller[_0x3717('0xb')]);router[_0x3717('0xa')]('/describe',auth[_0x3717('0xc')](),controller[_0x3717('0xd')]);router[_0x3717('0xa')]('/:id',auth[_0x3717('0xc')](),controller['show']);router[_0x3717('0xe')]('/',auth[_0x3717('0xc')](),controller[_0x3717('0xf')]);router[_0x3717('0x10')](_0x3717('0x11'),auth[_0x3717('0xc')](),controller[_0x3717('0x12')]);router[_0x3717('0x13')](_0x3717('0x11'),auth[_0x3717('0xc')](),controller[_0x3717('0x14')]);module[_0x3717('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6bc823f..f7bddc8 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 _0x4cf8=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x35888f,_0x548d6a){var _0x5ab73f=function(_0x359483){while(--_0x359483){_0x35888f['push'](_0x35888f['shift']());}};_0x5ab73f(++_0x548d6a);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x54a8d3,_0x12b8b7){_0x54a8d3=_0x54a8d3-0x0;var _0x5eec0e=_0x4cf8[_0x54a8d3];return _0x5eec0e;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'name':{'type':Sequelize[_0x84cf('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x84cf('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x84cf('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x84cf('0x2')],'set':function(_0x3bbbc3){this[_0x84cf('0x5')](_0x84cf('0x6'),_0x3bbbc3?_0x3bbbc3[_0x84cf('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x84cf('0x8')]('crudPermissions')[_0x84cf('0x9')](''):[];}}}; \ No newline at end of file +var _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x143539,_0x110d02){var _0x21d039=function(_0x287a1e){while(--_0x287a1e){_0x143539['push'](_0x143539['shift']());}};_0x21d039(++_0x110d02);}(_0xefda,0x96));var _0xaefd=function(_0xc74b1b,_0x2d57e1){_0xc74b1b=_0xc74b1b-0x0;var _0x93ada=_0xefda[_0xc74b1b];return _0x93ada;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index aaa5d61..3a218ee 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 _0x1417=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x1417,0x115));var _0x7141=function(_0x5c74c6,_0x53a8f7){_0x5c74c6=_0x5c74c6-0x0;var _0x1f474c=_0x1417[_0x5c74c6];return _0x1f474c;};'use strict';var emlformat=require(_0x7141('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7141('0x1'));var jsonpatch=require(_0x7141('0x2'));var rp=require(_0x7141('0x3'));var moment=require(_0x7141('0x4'));var BPromise=require(_0x7141('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7141('0x6'));var sox=require(_0x7141('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7141('0x8'));var _=require(_0x7141('0x9'));var squel=require(_0x7141('0xa'));var crypto=require(_0x7141('0xb'));var jsforce=require(_0x7141('0xc'));var deskjs=require(_0x7141('0xd'));var toCsv=require(_0x7141('0xe'));var querystring=require(_0x7141('0xf'));var Papa=require(_0x7141('0x10'));var Redis=require(_0x7141('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7141('0x12'));var hardwareService=require(_0x7141('0x13'));var logger=require('../../config/logger')(_0x7141('0x14'));var utils=require(_0x7141('0x15'));var config=require(_0x7141('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7141('0x17'))['db'];function respondWithStatusCode(_0x1ba2c5,_0xa1cbe7){_0xa1cbe7=_0xa1cbe7||0xcc;return function(_0x59cfc6){if(_0x59cfc6){return _0x1ba2c5[_0x7141('0x18')](_0xa1cbe7);}return _0x1ba2c5[_0x7141('0x19')](_0xa1cbe7)[_0x7141('0x1a')]();};}function respondWithResult(_0xa924,_0x1f8fe4){_0x1f8fe4=_0x1f8fe4||0xc8;return function(_0x5cf75d){if(_0x5cf75d){return _0xa924[_0x7141('0x19')](_0x1f8fe4)[_0x7141('0x1b')](_0x5cf75d);}};}function respondWithFilteredResult(_0x406f72,_0x2d0c32){return function(_0x5defb0){if(_0x5defb0){var _0x152064=typeof _0x2d0c32[_0x7141('0x1c')]===_0x7141('0x1d')&&typeof _0x2d0c32[_0x7141('0x1e')]==='undefined';var _0x2bd678=_0x5defb0['count'];var _0x379ddb=_0x152064?0x0:_0x2d0c32[_0x7141('0x1c')];var _0x155bec=_0x152064?_0x5defb0[_0x7141('0x1f')]:_0x2d0c32['offset']+_0x2d0c32[_0x7141('0x1e')];var _0x330b80;if(_0x155bec>=_0x2bd678){_0x155bec=_0x2bd678;_0x330b80=0xc8;}else{_0x330b80=0xce;}_0x406f72['status'](_0x330b80);return _0x406f72[_0x7141('0x20')](_0x7141('0x21'),_0x379ddb+'-'+_0x155bec+'/'+_0x2bd678)[_0x7141('0x1b')](_0x5defb0);}return null;};}function patchUpdates(_0x15027b){return function(_0x77cd68){try{jsonpatch[_0x7141('0x22')](_0x77cd68,_0x15027b,!![]);}catch(_0x5bd49f){return BPromise[_0x7141('0x23')](_0x5bd49f);}return _0x77cd68[_0x7141('0x24')]();};}function saveUpdates(_0x43deca,_0x1ac3c8){return function(_0x5e2b35){if(_0x5e2b35){return _0x5e2b35[_0x7141('0x25')](_0x43deca)[_0x7141('0x26')](function(_0x2e658a){return _0x2e658a;});}return null;};}function removeEntity(_0xb8745f,_0x5f3d07){return function(_0x2d73c1){if(_0x2d73c1){return _0x2d73c1[_0x7141('0x27')]()[_0x7141('0x26')](function(){_0xb8745f[_0x7141('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x851d0b,_0x4cf9c0){return function(_0x244493){if(!_0x244493){_0x851d0b[_0x7141('0x18')](0x194);}return _0x244493;};}function handleError(_0x5285c7,_0x14b1e6){_0x14b1e6=_0x14b1e6||0x1f4;return function(_0x7b3fed){logger[_0x7141('0x28')](_0x7b3fed['stack']);if(_0x7b3fed[_0x7141('0x29')]){delete _0x7b3fed[_0x7141('0x29')];}_0x5285c7[_0x7141('0x19')](_0x14b1e6)[_0x7141('0x2a')](_0x7b3fed);};}exports['index']=function(_0x4ede08,_0x5790b2){var _0x4eb18b={},_0x3e39ab={},_0x1ebb85={'count':0x0,'rows':[]};var _0x3acc4f=_[_0x7141('0x2b')](db[_0x7141('0x2c')][_0x7141('0x2d')],function(_0x4f13af){return{'name':_0x4f13af[_0x7141('0x2e')],'type':_0x4f13af[_0x7141('0x2f')][_0x7141('0x30')]};});_0x3e39ab[_0x7141('0x31')]=_[_0x7141('0x2b')](_0x3acc4f,_0x7141('0x29'));_0x3e39ab[_0x7141('0x32')]=_[_0x7141('0x33')](_0x4ede08[_0x7141('0x32')]);_0x3e39ab['filters']=_[_0x7141('0x34')](_0x3e39ab[_0x7141('0x31')],_0x3e39ab['query']);_0x4eb18b['attributes']=_[_0x7141('0x34')](_0x3e39ab[_0x7141('0x31')],qs[_0x7141('0x35')](_0x4ede08[_0x7141('0x32')][_0x7141('0x35')]));_0x4eb18b[_0x7141('0x36')]=_0x4eb18b[_0x7141('0x36')][_0x7141('0x37')]?_0x4eb18b[_0x7141('0x36')]:_0x3e39ab[_0x7141('0x31')];if(!_0x4ede08[_0x7141('0x32')][_0x7141('0x38')](_0x7141('0x39'))){_0x4eb18b[_0x7141('0x1e')]=qs['limit'](_0x4ede08['query'][_0x7141('0x1e')]);_0x4eb18b[_0x7141('0x1c')]=qs[_0x7141('0x1c')](_0x4ede08[_0x7141('0x32')][_0x7141('0x1c')]);}_0x4eb18b[_0x7141('0x3a')]=qs[_0x7141('0x3b')](_0x4ede08[_0x7141('0x32')][_0x7141('0x3b')]);_0x4eb18b[_0x7141('0x3c')]=qs[_0x7141('0x3d')](_[_0x7141('0x3e')](_0x4ede08['query'],_0x3e39ab[_0x7141('0x3d')]),_0x3acc4f);if(_0x4ede08['query']['filter']){_0x4eb18b[_0x7141('0x3c')]=_[_0x7141('0x3f')](_0x4eb18b[_0x7141('0x3c')],{'$or':_[_0x7141('0x2b')](_0x3acc4f,function(_0x2403e3){if(_0x2403e3['type']!=='VIRTUAL'){var _0x2cfcc0={};_0x2cfcc0[_0x2403e3[_0x7141('0x29')]]={'$like':'%'+_0x4ede08[_0x7141('0x32')]['filter']+'%'};return _0x2cfcc0;}})});}_0x4eb18b=_[_0x7141('0x3f')]({},_0x4eb18b,_0x4ede08[_0x7141('0x40')]);var _0x4d81e3={'where':_0x4eb18b[_0x7141('0x3c')]};return db[_0x7141('0x2c')]['count'](_0x4d81e3)['then'](function(_0x4f396b){_0x1ebb85[_0x7141('0x1f')]=_0x4f396b;if(_0x4ede08[_0x7141('0x32')]['includeAll']){_0x4eb18b[_0x7141('0x41')]=[{'all':!![]}];}return db[_0x7141('0x2c')][_0x7141('0x42')](_0x4eb18b);})[_0x7141('0x26')](function(_0x4da346){_0x1ebb85[_0x7141('0x43')]=_0x4da346;return _0x1ebb85;})[_0x7141('0x26')](respondWithFilteredResult(_0x5790b2,_0x4eb18b))[_0x7141('0x44')](handleError(_0x5790b2,null));};exports[_0x7141('0x45')]=function(_0x227cd6,_0x5a2a07){var _0x202802={'raw':![],'where':{'id':_0x227cd6['params']['id']}},_0x35065c={};_0x35065c[_0x7141('0x31')]=_[_0x7141('0x33')](db[_0x7141('0x2c')][_0x7141('0x2d')]);_0x35065c[_0x7141('0x32')]=_['keys'](_0x227cd6[_0x7141('0x32')]);_0x35065c[_0x7141('0x3d')]=_[_0x7141('0x34')](_0x35065c[_0x7141('0x31')],_0x35065c['query']);_0x202802[_0x7141('0x36')]=_[_0x7141('0x34')](_0x35065c['model'],qs[_0x7141('0x35')](_0x227cd6[_0x7141('0x32')][_0x7141('0x35')]));_0x202802[_0x7141('0x36')]=_0x202802[_0x7141('0x36')][_0x7141('0x37')]?_0x202802['attributes']:_0x35065c[_0x7141('0x31')];if(_0x227cd6[_0x7141('0x32')][_0x7141('0x46')]){_0x202802[_0x7141('0x41')]=[{'all':!![]}];}_0x202802=_['merge']({},_0x202802,_0x227cd6['options']);return db['UserProfileSection']['find'](_0x202802)[_0x7141('0x26')](handleEntityNotFound(_0x5a2a07,null))[_0x7141('0x26')](respondWithResult(_0x5a2a07,null))[_0x7141('0x44')](handleError(_0x5a2a07,null));};exports[_0x7141('0x47')]=function(_0x5f1b8c,_0x10b81d){return db['UserProfileSection'][_0x7141('0x47')](_0x5f1b8c['body'],{})[_0x7141('0x26')](respondWithResult(_0x10b81d,0xc9))['catch'](handleError(_0x10b81d,null));};exports[_0x7141('0x25')]=function(_0x5f4a38,_0x5986dd){if(_0x5f4a38['body']['id']){delete _0x5f4a38[_0x7141('0x48')]['id'];}return db[_0x7141('0x2c')][_0x7141('0x49')]({'where':{'id':_0x5f4a38[_0x7141('0x4a')]['id']}})[_0x7141('0x26')](handleEntityNotFound(_0x5986dd,null))[_0x7141('0x26')](saveUpdates(_0x5f4a38[_0x7141('0x48')],null))[_0x7141('0x26')](respondWithResult(_0x5986dd,null))[_0x7141('0x44')](handleError(_0x5986dd,null));};exports[_0x7141('0x27')]=function(_0x23b977,_0x85cd4f){return db[_0x7141('0x2c')]['find']({'where':{'id':_0x23b977['params']['id']}})[_0x7141('0x26')](handleEntityNotFound(_0x85cd4f,null))[_0x7141('0x26')](removeEntity(_0x85cd4f,null))[_0x7141('0x44')](handleError(_0x85cd4f,null));};exports['describe']=function(_0x251109,_0x4d4e0e){return db[_0x7141('0x2c')][_0x7141('0x4b')]()[_0x7141('0x26')](respondWithResult(_0x4d4e0e,null))[_0x7141('0x44')](handleError(_0x4d4e0e,null));}; \ No newline at end of file +var _0xbfb7=['sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','UserProfileSection','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','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xbfb7,0x1d3));var _0x7bfb=function(_0x53273a,_0x5ed978){_0x53273a=_0x53273a-0x0;var _0x3c41db=_0xbfb7[_0x53273a];return _0x3c41db;};'use strict';var emlformat=require(_0x7bfb('0x0'));var rimraf=require(_0x7bfb('0x1'));var zipdir=require(_0x7bfb('0x2'));var jsonpatch=require(_0x7bfb('0x3'));var rp=require(_0x7bfb('0x4'));var moment=require(_0x7bfb('0x5'));var BPromise=require(_0x7bfb('0x6'));var Mustache=require(_0x7bfb('0x7'));var util=require(_0x7bfb('0x8'));var path=require(_0x7bfb('0x9'));var sox=require(_0x7bfb('0xa'));var csv=require(_0x7bfb('0xb'));var ejs=require(_0x7bfb('0xc'));var fs=require('fs');var fs_extra=require(_0x7bfb('0xd'));var _=require(_0x7bfb('0xe'));var squel=require('squel');var crypto=require(_0x7bfb('0xf'));var jsforce=require(_0x7bfb('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7bfb('0xb'));var querystring=require(_0x7bfb('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bfb('0x12'));var qs=require(_0x7bfb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bfb('0x14'));var logger=require('../../config/logger')(_0x7bfb('0x15'));var utils=require(_0x7bfb('0x16'));var config=require(_0x7bfb('0x17'));var licenseUtil=require(_0x7bfb('0x18'));var db=require(_0x7bfb('0x19'))['db'];function respondWithStatusCode(_0xd795f7,_0x2c4c98){_0x2c4c98=_0x2c4c98||0xcc;return function(_0x563502){if(_0x563502){return _0xd795f7[_0x7bfb('0x1a')](_0x2c4c98);}return _0xd795f7[_0x7bfb('0x1b')](_0x2c4c98)[_0x7bfb('0x1c')]();};}function respondWithResult(_0x5f4315,_0x4506a6){_0x4506a6=_0x4506a6||0xc8;return function(_0x5e964d){if(_0x5e964d){return _0x5f4315[_0x7bfb('0x1b')](_0x4506a6)[_0x7bfb('0x1d')](_0x5e964d);}};}function respondWithFilteredResult(_0x40f75c,_0x842fd8){return function(_0x40b45b){if(_0x40b45b){var _0x4f44b7=typeof _0x842fd8[_0x7bfb('0x1e')]===_0x7bfb('0x1f')&&typeof _0x842fd8[_0x7bfb('0x20')]==='undefined';var _0x5ba8dd=_0x40b45b[_0x7bfb('0x21')];var _0x23d45f=_0x4f44b7?0x0:_0x842fd8['offset'];var _0x168355=_0x4f44b7?_0x40b45b['count']:_0x842fd8['offset']+_0x842fd8[_0x7bfb('0x20')];var _0x45b4db;if(_0x168355>=_0x5ba8dd){_0x168355=_0x5ba8dd;_0x45b4db=0xc8;}else{_0x45b4db=0xce;}_0x40f75c[_0x7bfb('0x1b')](_0x45b4db);return _0x40f75c['set'](_0x7bfb('0x22'),_0x23d45f+'-'+_0x168355+'/'+_0x5ba8dd)[_0x7bfb('0x1d')](_0x40b45b);}return null;};}function patchUpdates(_0x2fb53d){return function(_0x16389e){try{jsonpatch[_0x7bfb('0x23')](_0x16389e,_0x2fb53d,!![]);}catch(_0x11178b){return BPromise['reject'](_0x11178b);}return _0x16389e['save']();};}function saveUpdates(_0x2ced16,_0x421d8c){return function(_0x1c1311){if(_0x1c1311){return _0x1c1311[_0x7bfb('0x24')](_0x2ced16)[_0x7bfb('0x25')](function(_0x39a790){return _0x39a790;});}return null;};}function removeEntity(_0x23d7c4,_0x1e31ee){return function(_0x5a2757){if(_0x5a2757){return _0x5a2757[_0x7bfb('0x26')]()[_0x7bfb('0x25')](function(){_0x23d7c4[_0x7bfb('0x1b')](0xcc)[_0x7bfb('0x1c')]();});}};}function handleEntityNotFound(_0x16cbcd,_0x2fd002){return function(_0x2c9dfc){if(!_0x2c9dfc){_0x16cbcd['sendStatus'](0x194);}return _0x2c9dfc;};}function handleError(_0x5a0ccd,_0x2a7837){_0x2a7837=_0x2a7837||0x1f4;return function(_0xcbbfeb){logger[_0x7bfb('0x27')](_0xcbbfeb[_0x7bfb('0x28')]);if(_0xcbbfeb[_0x7bfb('0x29')]){delete _0xcbbfeb['name'];}_0x5a0ccd[_0x7bfb('0x1b')](_0x2a7837)['send'](_0xcbbfeb);};}exports[_0x7bfb('0x2a')]=function(_0x311421,_0x4b4f1d){var _0x37587c={},_0x2ef855={},_0x5c1113={'count':0x0,'rows':[]};var _0x1a1bb8=_[_0x7bfb('0x2b')](db['UserProfileSection'][_0x7bfb('0x2c')],function(_0x332475){return{'name':_0x332475[_0x7bfb('0x2d')],'type':_0x332475[_0x7bfb('0x2e')][_0x7bfb('0x2f')]};});_0x2ef855['model']=_[_0x7bfb('0x2b')](_0x1a1bb8,_0x7bfb('0x29'));_0x2ef855[_0x7bfb('0x30')]=_[_0x7bfb('0x31')](_0x311421['query']);_0x2ef855[_0x7bfb('0x32')]=_[_0x7bfb('0x33')](_0x2ef855[_0x7bfb('0x34')],_0x2ef855['query']);_0x37587c['attributes']=_[_0x7bfb('0x33')](_0x2ef855['model'],qs[_0x7bfb('0x35')](_0x311421[_0x7bfb('0x30')][_0x7bfb('0x35')]));_0x37587c['attributes']=_0x37587c[_0x7bfb('0x36')][_0x7bfb('0x37')]?_0x37587c[_0x7bfb('0x36')]:_0x2ef855[_0x7bfb('0x34')];if(!_0x311421['query']['hasOwnProperty'](_0x7bfb('0x38'))){_0x37587c[_0x7bfb('0x20')]=qs[_0x7bfb('0x20')](_0x311421[_0x7bfb('0x30')]['limit']);_0x37587c[_0x7bfb('0x1e')]=qs[_0x7bfb('0x1e')](_0x311421[_0x7bfb('0x30')][_0x7bfb('0x1e')]);}_0x37587c[_0x7bfb('0x39')]=qs[_0x7bfb('0x3a')](_0x311421[_0x7bfb('0x30')]['sort']);_0x37587c[_0x7bfb('0x3b')]=qs[_0x7bfb('0x32')](_[_0x7bfb('0x3c')](_0x311421[_0x7bfb('0x30')],_0x2ef855[_0x7bfb('0x32')]),_0x1a1bb8);if(_0x311421[_0x7bfb('0x30')]['filter']){_0x37587c['where']=_[_0x7bfb('0x3d')](_0x37587c[_0x7bfb('0x3b')],{'$or':_[_0x7bfb('0x2b')](_0x1a1bb8,function(_0x5c1566){if(_0x5c1566[_0x7bfb('0x2e')]!==_0x7bfb('0x3e')){var _0x3cf13a={};_0x3cf13a[_0x5c1566[_0x7bfb('0x29')]]={'$like':'%'+_0x311421['query'][_0x7bfb('0x3f')]+'%'};return _0x3cf13a;}})});}_0x37587c=_['merge']({},_0x37587c,_0x311421[_0x7bfb('0x40')]);var _0x587305={'where':_0x37587c['where']};return db['UserProfileSection'][_0x7bfb('0x21')](_0x587305)[_0x7bfb('0x25')](function(_0x500605){_0x5c1113[_0x7bfb('0x21')]=_0x500605;if(_0x311421['query']['includeAll']){_0x37587c[_0x7bfb('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x7bfb('0x42')](_0x37587c);})[_0x7bfb('0x25')](function(_0x1e5623){_0x5c1113['rows']=_0x1e5623;return _0x5c1113;})[_0x7bfb('0x25')](respondWithFilteredResult(_0x4b4f1d,_0x37587c))[_0x7bfb('0x43')](handleError(_0x4b4f1d,null));};exports[_0x7bfb('0x44')]=function(_0x54f3d2,_0x23b7dc){var _0x3e320f={'raw':![],'where':{'id':_0x54f3d2['params']['id']}},_0x5c7f3c={};_0x5c7f3c['model']=_[_0x7bfb('0x31')](db[_0x7bfb('0x45')]['rawAttributes']);_0x5c7f3c[_0x7bfb('0x30')]=_[_0x7bfb('0x31')](_0x54f3d2[_0x7bfb('0x30')]);_0x5c7f3c[_0x7bfb('0x32')]=_[_0x7bfb('0x33')](_0x5c7f3c[_0x7bfb('0x34')],_0x5c7f3c[_0x7bfb('0x30')]);_0x3e320f[_0x7bfb('0x36')]=_[_0x7bfb('0x33')](_0x5c7f3c[_0x7bfb('0x34')],qs[_0x7bfb('0x35')](_0x54f3d2[_0x7bfb('0x30')][_0x7bfb('0x35')]));_0x3e320f[_0x7bfb('0x36')]=_0x3e320f['attributes'][_0x7bfb('0x37')]?_0x3e320f[_0x7bfb('0x36')]:_0x5c7f3c['model'];if(_0x54f3d2[_0x7bfb('0x30')][_0x7bfb('0x46')]){_0x3e320f[_0x7bfb('0x41')]=[{'all':!![]}];}_0x3e320f=_['merge']({},_0x3e320f,_0x54f3d2[_0x7bfb('0x40')]);return db[_0x7bfb('0x45')][_0x7bfb('0x47')](_0x3e320f)[_0x7bfb('0x25')](handleEntityNotFound(_0x23b7dc,null))[_0x7bfb('0x25')](respondWithResult(_0x23b7dc,null))['catch'](handleError(_0x23b7dc,null));};exports['create']=function(_0xc322fe,_0x411451){return db[_0x7bfb('0x45')][_0x7bfb('0x48')](_0xc322fe[_0x7bfb('0x49')],{})[_0x7bfb('0x25')](respondWithResult(_0x411451,0xc9))['catch'](handleError(_0x411451,null));};exports[_0x7bfb('0x24')]=function(_0x1f113e,_0x307f1f){if(_0x1f113e[_0x7bfb('0x49')]['id']){delete _0x1f113e[_0x7bfb('0x49')]['id'];}return db[_0x7bfb('0x45')]['find']({'where':{'id':_0x1f113e['params']['id']}})[_0x7bfb('0x25')](handleEntityNotFound(_0x307f1f,null))[_0x7bfb('0x25')](saveUpdates(_0x1f113e['body'],null))[_0x7bfb('0x25')](respondWithResult(_0x307f1f,null))[_0x7bfb('0x43')](handleError(_0x307f1f,null));};exports[_0x7bfb('0x26')]=function(_0x5c49f4,_0x517cd6){return db['UserProfileSection'][_0x7bfb('0x47')]({'where':{'id':_0x5c49f4['params']['id']}})['then'](handleEntityNotFound(_0x517cd6,null))[_0x7bfb('0x25')](removeEntity(_0x517cd6,null))[_0x7bfb('0x43')](handleError(_0x517cd6,null));};exports[_0x7bfb('0x4a')]=function(_0x479384,_0x506b82){return db[_0x7bfb('0x45')][_0x7bfb('0x4a')]()[_0x7bfb('0x25')](respondWithResult(_0x506b82,null))[_0x7bfb('0x43')](handleError(_0x506b82,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3b41162..bb8ff43 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 _0xf85c=['./userProfileSection.attributes','exports','define','UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x502e4d,_0x4aa361){var _0x305427=function(_0x2e38ac){while(--_0x2e38ac){_0x502e4d['push'](_0x502e4d['shift']());}};_0x305427(++_0x4aa361);}(_0xf85c,0x11e));var _0xcf85=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf85c[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var logger=require(_0xcf85('0x2'))(_0xcf85('0x3'));var moment=require(_0xcf85('0x4'));var BPromise=require(_0xcf85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf85('0x6'));var rimraf=require('rimraf');var config=require(_0xcf85('0x7'));var attributes=require(_0xcf85('0x8'));module[_0xcf85('0x9')]=function(_0x59a73b,_0x33024e){return _0x59a73b[_0xcf85('0xa')](_0xcf85('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xcf85('0xc'),_0xcf85('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd2=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','UserProfileSection'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8cd2,0x12a));var _0x28cd=function(_0x194d23,_0x35b80e){_0x194d23=_0x194d23-0x0;var _0x159102=_0x8cd2[_0x194d23];return _0x159102;};'use strict';var _=require('lodash');var util=require(_0x28cd('0x0'));var logger=require(_0x28cd('0x1'))(_0x28cd('0x2'));var moment=require(_0x28cd('0x3'));var BPromise=require(_0x28cd('0x4'));var rp=require(_0x28cd('0x5'));var fs=require('fs');var path=require(_0x28cd('0x6'));var rimraf=require(_0x28cd('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x545b25,_0x3e782a){return _0x545b25[_0x28cd('0x8')](_0x28cd('0x9'),attributes,{'tableName':_0x28cd('0xa'),'paranoid':![],'indexes':[{'name':_0x28cd('0xb'),'fields':[_0x28cd('0xc'),_0x28cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 7c2d7b2..a3d8c2f 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 _0x671a=['request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x4b4dda,_0x178789){var _0x3de774=function(_0x38cd06){while(--_0x38cd06){_0x4b4dda['push'](_0x4b4dda['shift']());}};_0x3de774(++_0x178789);}(_0x671a,0x7a));var _0xa671=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0x671a[_0x475191];return _0x189e96;};'use strict';var _=require(_0xa671('0x0'));var util=require(_0xa671('0x1'));var moment=require(_0xa671('0x2'));var BPromise=require(_0xa671('0x3'));var rs=require(_0xa671('0x4'));var fs=require('fs');var Redis=require(_0xa671('0x5'));var db=require(_0xa671('0x6'))['db'];var utils=require(_0xa671('0x7'));var logger=require(_0xa671('0x8'))(_0xa671('0x9'));var config=require(_0xa671('0xa'));var jayson=require(_0xa671('0xb'));var client=jayson[_0xa671('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cf2a6,_0x2ac97e,_0x4ea22f){return new BPromise(function(_0x26bce6,_0x6b3378){return client[_0xa671('0xd')](_0x4cf2a6,_0x4ea22f)[_0xa671('0xe')](function(_0x446718){logger[_0xa671('0xf')](_0xa671('0x10'),_0x2ac97e,'request\x20sent');logger[_0xa671('0x11')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2ac97e,'request\x20sent',JSON[_0xa671('0x12')](_0x446718));if(_0x446718['error']){if(_0x446718[_0xa671('0x13')][_0xa671('0x14')]===0x1f4){logger['error'](_0xa671('0x10'),_0x2ac97e,_0x446718[_0xa671('0x13')][_0xa671('0x15')]);return _0x6b3378(_0x446718[_0xa671('0x13')]['message']);}logger['error'](_0xa671('0x10'),_0x2ac97e,_0x446718['error'][_0xa671('0x15')]);return _0x26bce6(_0x446718[_0xa671('0x13')]['message']);}else{logger[_0xa671('0xf')](_0xa671('0x10'),_0x2ac97e,_0xa671('0x16'));_0x26bce6(_0x446718[_0xa671('0x17')][_0xa671('0x15')]);}})['catch'](function(_0x3561da){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2ac97e,_0x3561da);_0x6b3378(_0x3561da);});});} \ No newline at end of file +var _0x4b8b=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x4b8b,0x16a));var _0xb4b8=function(_0xc65834,_0x5df6fb){_0xc65834=_0xc65834-0x0;var _0x5da298=_0x4b8b[_0xc65834];return _0x5da298;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require(_0xb4b8('0x2'));var BPromise=require(_0xb4b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b8('0x4'))['db'];var utils=require(_0xb4b8('0x5'));var logger=require('../../config/logger')(_0xb4b8('0x6'));var config=require(_0xb4b8('0x7'));var jayson=require(_0xb4b8('0x8'));var client=jayson[_0xb4b8('0x9')][_0xb4b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101b8f,_0x33d218,_0x1f607b){return new BPromise(function(_0x2e0e26,_0x8dff27){return client[_0xb4b8('0xb')](_0x101b8f,_0x1f607b)[_0xb4b8('0xc')](function(_0x34d86e){logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));logger['debug'](_0xb4b8('0x10'),_0x33d218,'request\x20sent',JSON[_0xb4b8('0x11')](_0x34d86e));if(_0x34d86e['error']){if(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x13')]===0x1f4){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')]['message']);return _0x8dff27(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);return _0x2e0e26(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}else{logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));_0x2e0e26(_0x34d86e[_0xb4b8('0x15')][_0xb4b8('0x14')]);}})['catch'](function(_0x10c7b9){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x10c7b9);_0x8dff27(_0x10c7b9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ba6d095..07a0538 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4bc1db,_0x5e024f){var _0x44178a=function(_0x7edc1b){while(--_0x7edc1b){_0x4bc1db['push'](_0x4bc1db['shift']());}};_0x44178a(++_0x5e024f);}(_0xe706,0xa3));var _0x6e70=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0xe706[_0x23ac30];return _0x208fec;};'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(_0x23e346,_0x2ffc96){var _0x58fd5a=function(_0x47052e){while(--_0x47052e){_0x23e346['push'](_0x23e346['shift']());}};_0x58fd5a(++_0x2ffc96);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4e66164..4da9bab 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 _0x503c=['exports'];(function(_0x5d443c,_0x3c25e2){var _0x230e04=function(_0x39e193){while(--_0x39e193){_0x5d443c['push'](_0x5d443c['shift']());}};_0x230e04(++_0x3c25e2);}(_0x503c,0x146));var _0xc503=function(_0xeb30b5,_0x4d4612){_0xeb30b5=_0xeb30b5-0x0;var _0x304239=_0x503c[_0xeb30b5];return _0x304239;};'use strict';var Sequelize=require('sequelize');module[_0xc503('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5da0=['sequelize','INTEGER'];(function(_0x9fdfc5,_0x5ae737){var _0x206a78=function(_0x4d0a5d){while(--_0x4d0a5d){_0x9fdfc5['push'](_0x9fdfc5['shift']());}};_0x206a78(++_0x5ae737);}(_0x5da0,0x1be));var _0x05da=function(_0x2762fc,_0x4d21a6){_0x2762fc=_0x2762fc-0x0;var _0x1ae50b=_0x5da0[_0x2762fc];return _0x1ae50b;};'use strict';var Sequelize=require(_0x05da('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x05da('0x1')],'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 1de502e..0bb274f 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 _0xa751=['user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','UserSmsQueue'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0xa751,0x175));var _0x1a75=function(_0x141172,_0x55d4bc){_0x141172=_0x141172-0x0;var _0x5a8e82=_0xa751[_0x141172];return _0x5a8e82;};'use strict';var _=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var logger=require(_0x1a75('0x2'))(_0x1a75('0x3'));var moment=require('moment');var BPromise=require(_0x1a75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x5'));var rimraf=require(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x1a75('0x8')]=function(_0x220b14,_0x1719c1){return _0x220b14[_0x1a75('0x9')](_0x1a75('0xa'),attributes,{'tableName':_0x1a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdec3=['../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1c75ec,_0x26f5d8){var _0x1a8443=function(_0x5e88b8){while(--_0x5e88b8){_0x1c75ec['push'](_0x1c75ec['shift']());}};_0x1a8443(++_0x26f5d8);}(_0xdec3,0x89));var _0x3dec=function(_0x28f459,_0x1d0c6c){_0x28f459=_0x28f459-0x0;var _0x54fb2e=_0xdec3[_0x28f459];return _0x54fb2e;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var logger=require(_0x3dec('0x1'))(_0x3dec('0x2'));var moment=require(_0x3dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dec('0x4'));var fs=require('fs');var path=require(_0x3dec('0x5'));var rimraf=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x3dec('0x8')]=function(_0x2894eb,_0x347c06){return _0x2894eb[_0x3dec('0x9')](_0x3dec('0xa'),attributes,{'tableName':_0x3dec('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 8d204ec..62c0382 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 _0x03b6=['../../config/logger','rpc','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x196205,_0x5d364d){var _0x4882de=function(_0x31507f){while(--_0x31507f){_0x196205['push'](_0x196205['shift']());}};_0x4882de(++_0x5d364d);}(_0x03b6,0x1c8));var _0x603b=function(_0x37e757,_0x3ee566){_0x37e757=_0x37e757-0x0;var _0x2bd486=_0x03b6[_0x37e757];return _0x2bd486;};'use strict';var _=require(_0x603b('0x0'));var util=require(_0x603b('0x1'));var moment=require(_0x603b('0x2'));var BPromise=require(_0x603b('0x3'));var rs=require(_0x603b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x603b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x603b('0x6'))(_0x603b('0x7'));var config=require('../../config/environment');var jayson=require(_0x603b('0x8'));var client=jayson[_0x603b('0x9')][_0x603b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xff0946,_0x140eea,_0xbd8ea0){return new BPromise(function(_0x2e9368,_0x417851){return client[_0x603b('0xb')](_0xff0946,_0xbd8ea0)[_0x603b('0xc')](function(_0x4ee054){logger['info'](_0x603b('0xd'),_0x140eea,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x140eea,_0x603b('0xe'),JSON[_0x603b('0xf')](_0x4ee054));if(_0x4ee054[_0x603b('0x10')]){if(_0x4ee054['error'][_0x603b('0x11')]===0x1f4){logger[_0x603b('0x10')](_0x603b('0xd'),_0x140eea,_0x4ee054[_0x603b('0x10')]['message']);return _0x417851(_0x4ee054[_0x603b('0x10')][_0x603b('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x140eea,_0x4ee054[_0x603b('0x10')][_0x603b('0x12')]);return _0x2e9368(_0x4ee054[_0x603b('0x10')][_0x603b('0x12')]);}else{logger[_0x603b('0x13')](_0x603b('0xd'),_0x140eea,_0x603b('0xe'));_0x2e9368(_0x4ee054[_0x603b('0x14')][_0x603b('0x12')]);}})[_0x603b('0x15')](function(_0x48e517){logger[_0x603b('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x140eea,_0x48e517);_0x417851(_0x48e517);});});} \ No newline at end of file +var _0xc3bb=['error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code'];(function(_0x14e442,_0x36b1bd){var _0x1385e2=function(_0x2535b5){while(--_0x2535b5){_0x14e442['push'](_0x14e442['shift']());}};_0x1385e2(++_0x36b1bd);}(_0xc3bb,0x129));var _0xbc3b=function(_0x1a065f,_0x4e5dde){_0x1a065f=_0x1a065f-0x0;var _0x55509a=_0xc3bb[_0x1a065f];return _0x55509a;};'use strict';var _=require('lodash');var util=require(_0xbc3b('0x0'));var moment=require(_0xbc3b('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc3b('0x2'));var fs=require('fs');var Redis=require(_0xbc3b('0x3'));var db=require(_0xbc3b('0x4'))['db'];var utils=require(_0xbc3b('0x5'));var logger=require('../../config/logger')(_0xbc3b('0x6'));var config=require(_0xbc3b('0x7'));var jayson=require(_0xbc3b('0x8'));var client=jayson['client'][_0xbc3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed2d6d,_0x53bfc7,_0x1d5b8a){return new BPromise(function(_0x10b92c,_0x13d266){return client[_0xbc3b('0xa')](_0xed2d6d,_0x1d5b8a)[_0xbc3b('0xb')](function(_0x14a180){logger[_0xbc3b('0xc')](_0xbc3b('0xd'),_0x53bfc7,'request\x20sent');logger[_0xbc3b('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x53bfc7,_0xbc3b('0xf'),JSON[_0xbc3b('0x10')](_0x14a180));if(_0x14a180['error']){if(_0x14a180['error'][_0xbc3b('0x11')]===0x1f4){logger[_0xbc3b('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x53bfc7,_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);return _0x13d266(_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);}logger[_0xbc3b('0x12')](_0xbc3b('0xd'),_0x53bfc7,_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);return _0x10b92c(_0x14a180['error'][_0xbc3b('0x13')]);}else{logger[_0xbc3b('0xc')](_0xbc3b('0xd'),_0x53bfc7,_0xbc3b('0xf'));_0x10b92c(_0x14a180['result'][_0xbc3b('0x13')]);}})[_0xbc3b('0x14')](function(_0x36fb3e){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x53bfc7,_0x36fb3e);_0x13d266(_0x36fb3e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b675999..fc90637 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 _0xc261=['exports','INTEGER'];(function(_0x1137a3,_0x22fe0b){var _0x9d6ddb=function(_0x55793e){while(--_0x55793e){_0x1137a3['push'](_0x1137a3['shift']());}};_0x9d6ddb(++_0x22fe0b);}(_0xc261,0xa6));var _0x1c26=function(_0x4ecd96,_0x172d60){_0x4ecd96=_0x4ecd96-0x0;var _0x267364=_0xc261[_0x4ecd96];return _0x267364;};'use strict';var Sequelize=require('sequelize');module[_0x1c26('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x1c26('0x1')]}}; \ No newline at end of file +var _0x8e5d=['INTEGER','exports'];(function(_0x353a43,_0x515ac6){var _0x289eb8=function(_0x5bcbc4){while(--_0x5bcbc4){_0x353a43['push'](_0x353a43['shift']());}};_0x289eb8(++_0x515ac6);}(_0x8e5d,0x139));var _0xd8e5=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x8e5d[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require('sequelize');module[_0xd8e5('0x0')]={'UserId':{'type':Sequelize[_0xd8e5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd8e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e790b72..13d5d3d 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(_0x1935ad,_0x4980e2){var _0x19ede6=function(_0x8a39e8){while(--_0x8a39e8){_0x1935ad['push'](_0x1935ad['shift']());}};_0x19ede6(++_0x4980e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5df421,_0x2c2618){var _0x2b68f1=function(_0x47ddc5){while(--_0x47ddc5){_0x5df421['push'](_0x5df421['shift']());}};_0x2b68f1(++_0x2c2618);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 20fe9bd..be1a351 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4f8728,_0x5e9064){var _0x1e8371=function(_0x379406){while(--_0x379406){_0x4f8728['push'](_0x4f8728['shift']());}};_0x1e8371(++_0x5e9064);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15db7e,_0x1333e4){var _0x3ef26d=function(_0x40a448){while(--_0x40a448){_0x15db7e['push'](_0x15db7e['shift']());}};_0x3ef26d(++_0x1333e4);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 843b1a3..cd68ca2 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 _0x83f7=['sequelize','exports','INTEGER'];(function(_0x2358f5,_0x2764b5){var _0x41831c=function(_0x16ee70){while(--_0x16ee70){_0x2358f5['push'](_0x2358f5['shift']());}};_0x41831c(++_0x2764b5);}(_0x83f7,0x84));var _0x783f=function(_0x16f827,_0x542be1){_0x16f827=_0x16f827-0x0;var _0x7e5e5b=_0x83f7[_0x16f827];return _0x7e5e5b;};'use strict';var Sequelize=require(_0x783f('0x0'));module[_0x783f('0x1')]={'penalty':{'type':Sequelize[_0x783f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7a0=['exports','INTEGER','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf7a0,0x80));var _0x0f7a=function(_0x582a95,_0x491418){_0x582a95=_0x582a95-0x0;var _0x35aa2b=_0xf7a0[_0x582a95];return _0x35aa2b;};'use strict';var Sequelize=require(_0x0f7a('0x0'));module[_0x0f7a('0x1')]={'penalty':{'type':Sequelize[_0x0f7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e11834d..51be3e9 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 _0xa515=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','../../config/logger','api'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa515,0x6c));var _0x5a51=function(_0x41d0df,_0xc2ff0d){_0x41d0df=_0x41d0df-0x0;var _0x374c2e=_0xa515[_0x41d0df];return _0x374c2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a51('0x0'))(_0x5a51('0x1'));var moment=require('moment');var BPromise=require(_0x5a51('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a51('0x3'));var rimraf=require(_0x5a51('0x4'));var config=require(_0x5a51('0x5'));var attributes=require(_0x5a51('0x6'));module[_0x5a51('0x7')]=function(_0x3d5977,_0x33c1f1){return _0x3d5977['define'](_0x5a51('0x8'),attributes,{'tableName':_0x5a51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79b4=['api','moment','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0x3bcc22,_0xd8b8f8){var _0x1eaad3=function(_0xc57d06){while(--_0xc57d06){_0x3bcc22['push'](_0x3bcc22['shift']());}};_0x1eaad3(++_0xd8b8f8);}(_0x79b4,0xf8));var _0x479b=function(_0x269133,_0x51004c){_0x269133=_0x269133-0x0;var _0x400de2=_0x79b4[_0x269133];return _0x400de2;};'use strict';var _=require('lodash');var util=require(_0x479b('0x0'));var logger=require(_0x479b('0x1'))(_0x479b('0x2'));var moment=require(_0x479b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x479b('0x4'));var rimraf=require('rimraf');var config=require(_0x479b('0x5'));var attributes=require(_0x479b('0x6'));module[_0x479b('0x7')]=function(_0x1a9cf4,_0x1ccc26){return _0x1a9cf4['define'](_0x479b('0x8'),attributes,{'tableName':_0x479b('0x9'),'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 373b3c4..66b5eed 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 _0x764f=['UserVoiceQueue,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3ec751,_0x3009cd){var _0x252150=function(_0x5091e8){while(--_0x5091e8){_0x3ec751['push'](_0x3ec751['shift']());}};_0x252150(++_0x3009cd);}(_0x764f,0xf3));var _0xf764=function(_0x5d4ed5,_0x42ea58){_0x5d4ed5=_0x5d4ed5-0x0;var _0x4c7b4b=_0x764f[_0x5d4ed5];return _0x4c7b4b;};'use strict';var _=require('lodash');var util=require(_0xf764('0x0'));var moment=require(_0xf764('0x1'));var BPromise=require('bluebird');var rs=require(_0xf764('0x2'));var fs=require('fs');var Redis=require(_0xf764('0x3'));var db=require(_0xf764('0x4'))['db'];var utils=require(_0xf764('0x5'));var logger=require(_0xf764('0x6'))(_0xf764('0x7'));var config=require(_0xf764('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf764('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f16ec,_0x49aa65,_0x1eae48){return new BPromise(function(_0x3738d0,_0x314cf3){return client[_0xf764('0xa')](_0x3f16ec,_0x1eae48)[_0xf764('0xb')](function(_0x1ded03){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x49aa65,'request\x20sent');logger[_0xf764('0xc')](_0xf764('0xd'),_0x49aa65,'request\x20sent',JSON[_0xf764('0xe')](_0x1ded03));if(_0x1ded03[_0xf764('0xf')]){if(_0x1ded03[_0xf764('0xf')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x49aa65,_0x1ded03[_0xf764('0xf')][_0xf764('0x10')]);return _0x314cf3(_0x1ded03[_0xf764('0xf')][_0xf764('0x10')]);}logger[_0xf764('0xf')](_0xf764('0x11'),_0x49aa65,_0x1ded03[_0xf764('0xf')][_0xf764('0x10')]);return _0x3738d0(_0x1ded03['error'][_0xf764('0x10')]);}else{logger['info'](_0xf764('0x11'),_0x49aa65,'request\x20sent');_0x3738d0(_0x1ded03[_0xf764('0x12')][_0xf764('0x10')]);}})[_0xf764('0x13')](function(_0x53b38b){logger[_0xf764('0xf')](_0xf764('0x11'),_0x49aa65,_0x53b38b);_0x314cf3(_0x53b38b);});});} \ No newline at end of file +var _0xc58b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x20d8d3,_0x118ad0){var _0x7c229e=function(_0x1a639b){while(--_0x1a639b){_0x20d8d3['push'](_0x20d8d3['shift']());}};_0x7c229e(++_0x118ad0);}(_0xc58b,0x1df));var _0xbc58=function(_0x3391ad,_0x25691b){_0x3391ad=_0x3391ad-0x0;var _0x4b7925=_0xc58b[_0x3391ad];return _0x4b7925;};'use strict';var _=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc58('0x2'));var fs=require('fs');var Redis=require(_0xbc58('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc58('0x4'))(_0xbc58('0x5'));var config=require(_0xbc58('0x6'));var jayson=require(_0xbc58('0x7'));var client=jayson[_0xbc58('0x8')][_0xbc58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d87c4,_0x51556a,_0x4b0a65){return new BPromise(function(_0x64dfc7,_0x3ce8be){return client[_0xbc58('0xa')](_0x5d87c4,_0x4b0a65)[_0xbc58('0xb')](function(_0x30487f){logger[_0xbc58('0xc')](_0xbc58('0xd'),_0x51556a,_0xbc58('0xe'));logger[_0xbc58('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x51556a,'request\x20sent',JSON['stringify'](_0x30487f));if(_0x30487f['error']){if(_0x30487f['error'][_0xbc58('0x10')]===0x1f4){logger[_0xbc58('0x11')](_0xbc58('0xd'),_0x51556a,_0x30487f[_0xbc58('0x11')]['message']);return _0x3ce8be(_0x30487f[_0xbc58('0x11')][_0xbc58('0x12')]);}logger['error'](_0xbc58('0xd'),_0x51556a,_0x30487f['error'][_0xbc58('0x12')]);return _0x64dfc7(_0x30487f[_0xbc58('0x11')]['message']);}else{logger[_0xbc58('0xc')](_0xbc58('0xd'),_0x51556a,_0xbc58('0xe'));_0x64dfc7(_0x30487f[_0xbc58('0x13')]['message']);}})[_0xbc58('0x14')](function(_0xdb0f02){logger[_0xbc58('0x11')](_0xbc58('0xd'),_0x51556a,_0xdb0f02);_0x3ce8be(_0xdb0f02);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d7b7b12..70087cd 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(_0x16b156,_0x50304a){var _0x4e65ef=function(_0x5e740c){while(--_0x5e740c){_0x16b156['push'](_0x16b156['shift']());}};_0x4e65ef(++_0x50304a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1b6e8d,_0x57ef1e){var _0x55f0bb=function(_0x4b5a71){while(--_0x4b5a71){_0x1b6e8d['push'](_0x1b6e8d['shift']());}};_0x55f0bb(++_0x57ef1e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4222ec2..15339f4 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 _0x6b8a=['queue_interface','sequelize','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x46a449,_0x15f6fc){var _0xe61f5c=function(_0x349aa4){while(--_0x349aa4){_0x46a449['push'](_0x46a449['shift']());}};_0xe61f5c(++_0x15f6fc);}(_0x6b8a,0xeb));var _0xa6b8=function(_0x106ad7,_0x4aca91){_0x106ad7=_0x106ad7-0x0;var _0x14245c=_0x6b8a[_0x106ad7];return _0x14245c;};'use strict';var Sequelize=require(_0xa6b8('0x0'));module[_0xa6b8('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xa6b8('0x2')],'allowNull':![],'comment':_0xa6b8('0x3')},'UserId':{'type':Sequelize[_0xa6b8('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa6b8('0x2')],'allowNull':![],'unique':_0xa6b8('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa6b8('0x2')],'allowNull':![],'unique':_0xa6b8('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa6b8('0x3')},'paused':{'type':Sequelize[_0xa6b8('0x4')](0xb),'defaultValue':0x0,'comment':_0xa6b8('0x3')}}; \ No newline at end of file +var _0x2408=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3f1151,_0x173f43){var _0x3abe96=function(_0x20e1e5){while(--_0x20e1e5){_0x3f1151['push'](_0x3f1151['shift']());}};_0x3abe96(++_0x173f43);}(_0x2408,0x97));var _0x8240=function(_0x167dfe,_0x4e5971){_0x167dfe=_0x167dfe-0x0;var _0x2a17ea=_0x2408[_0x167dfe];return _0x2a17ea;};'use strict';var Sequelize=require(_0x8240('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8240('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8240('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x8240('0x2')},'UserId':{'type':Sequelize[_0x8240('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8240('0x3')],'allowNull':![],'unique':_0x8240('0x4'),'comment':_0x8240('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8240('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8240('0x3')],'allowNull':![],'unique':_0x8240('0x4'),'comment':_0x8240('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8240('0x2')},'paused':{'type':Sequelize['INTEGER'](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 0064eab..f4c8f77 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 _0x207b=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x570297,_0x19e0ae){var _0x3913d0=function(_0x5e863a){while(--_0x5e863a){_0x570297['push'](_0x570297['shift']());}};_0x3913d0(++_0x19e0ae);}(_0x207b,0x8d));var _0xb207=function(_0x30e977,_0x5edc12){_0x30e977=_0x30e977-0x0;var _0x536cb5=_0x207b[_0x30e977];return _0x536cb5;};'use strict';var EventEmitter=require(_0xb207('0x0'));var UserVoiceQueueRt=require(_0xb207('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb207('0x2')](0x0);var events={'afterCreate':_0xb207('0x3'),'afterUpdate':_0xb207('0x4'),'afterDestroy':_0xb207('0x5')};function emitEvent(_0x1b5337){return function(_0x1bc1d6,_0x565874,_0x389db5){UserVoiceQueueRtEvents[_0xb207('0x6')](_0x1b5337+':'+_0x1bc1d6['id'],_0x1bc1d6);UserVoiceQueueRtEvents['emit'](_0x1b5337,_0x1bc1d6);_0x389db5(null);};}for(var e in events){if(events[_0xb207('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xb207('0x8')](e,emitEvent(event));}}module[_0xb207('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x70a3=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove'];(function(_0x135cbc,_0x633cb7){var _0x1df236=function(_0x1e0864){while(--_0x1e0864){_0x135cbc['push'](_0x135cbc['shift']());}};_0x1df236(++_0x633cb7);}(_0x70a3,0x8b));var _0x370a=function(_0x2d4791,_0x54a483){_0x2d4791=_0x2d4791-0x0;var _0x2099e1=_0x70a3[_0x2d4791];return _0x2099e1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x370a('0x0'))['db'][_0x370a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x370a('0x2')](0x0);var events={'afterCreate':_0x370a('0x3'),'afterUpdate':'update','afterDestroy':_0x370a('0x4')};function emitEvent(_0x109a6c){return function(_0x21f638,_0x50b1de,_0x549a0d){UserVoiceQueueRtEvents[_0x370a('0x5')](_0x109a6c+':'+_0x21f638['id'],_0x21f638);UserVoiceQueueRtEvents[_0x370a('0x5')](_0x109a6c,_0x21f638);_0x549a0d(null);};}for(var e in events){if(events[_0x370a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x370a('0x7')](e,emitEvent(event));}}module[_0x370a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9da4e6e..980164d 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 _0x2c95=['path','rimraf','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1e718c,_0x5e9904){var _0x2d75e8=function(_0x1a4a21){while(--_0x1a4a21){_0x1e718c['push'](_0x1e718c['shift']());}};_0x2d75e8(++_0x5e9904);}(_0x2c95,0x8a));var _0x52c9=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x2c95[_0x412dd8];return _0x47b96;};'use strict';var _=require(_0x52c9('0x0'));var util=require(_0x52c9('0x1'));var logger=require(_0x52c9('0x2'))(_0x52c9('0x3'));var moment=require(_0x52c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x52c9('0x5'));var fs=require('fs');var path=require(_0x52c9('0x6'));var rimraf=require(_0x52c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x52c9('0x8'));module[_0x52c9('0x9')]=function(_0x3acc13,_0x598dc7){return _0x3acc13[_0x52c9('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x52c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d7=['define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x16d7,0x70));var _0x716d=function(_0x2a5486,_0x9996a1){_0x2a5486=_0x2a5486-0x0;var _0x323da9=_0x16d7[_0x2a5486];return _0x323da9;};'use strict';var _=require(_0x716d('0x0'));var util=require(_0x716d('0x1'));var logger=require('../../config/logger')(_0x716d('0x2'));var moment=require(_0x716d('0x3'));var BPromise=require(_0x716d('0x4'));var rp=require(_0x716d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x716d('0x6'));var attributes=require(_0x716d('0x7'));module[_0x716d('0x8')]=function(_0x2af418,_0x40f10b){return _0x2af418[_0x716d('0x9')](_0x716d('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','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 56f386b..179ffdd 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 _0xa898=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserVoiceQueueRt','raw','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x11fadc,_0x58d876){var _0xd81fd1=function(_0x45ac34){while(--_0x45ac34){_0x11fadc['push'](_0x11fadc['shift']());}};_0xd81fd1(++_0x58d876);}(_0xa898,0x1b5));var _0x8a89=function(_0x1fab3c,_0x261927){_0x1fab3c=_0x1fab3c-0x0;var _0x471004=_0xa898[_0x1fab3c];return _0x471004;};'use strict';var _=require(_0x8a89('0x0'));var util=require(_0x8a89('0x1'));var moment=require(_0x8a89('0x2'));var BPromise=require(_0x8a89('0x3'));var rs=require(_0x8a89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a89('0x5'))['db'];var utils=require(_0x8a89('0x6'));var logger=require(_0x8a89('0x7'))(_0x8a89('0x8'));var config=require(_0x8a89('0x9'));var jayson=require(_0x8a89('0xa'));var client=jayson[_0x8a89('0xb')][_0x8a89('0xc')]({'port':0x232a});config[_0x8a89('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8a89('0xe'))(new Redis(config[_0x8a89('0xd')]));require('./userVoiceQueueRt.socket')[_0x8a89('0xf')](socket);function respondWithRpcPromise(_0x2b9bd4,_0xf556bf,_0x5a799b){return new BPromise(function(_0xe15488,_0x37c53e){return client[_0x8a89('0x10')](_0x2b9bd4,_0x5a799b)[_0x8a89('0x11')](function(_0x3ab832){logger[_0x8a89('0x12')](_0x8a89('0x13'),_0xf556bf,'request\x20sent');logger['debug'](_0x8a89('0x14'),_0xf556bf,_0x8a89('0x15'),JSON[_0x8a89('0x16')](_0x3ab832));if(_0x3ab832[_0x8a89('0x17')]){if(_0x3ab832[_0x8a89('0x17')]['code']===0x1f4){logger[_0x8a89('0x17')](_0x8a89('0x13'),_0xf556bf,_0x3ab832['error'][_0x8a89('0x18')]);return _0x37c53e(_0x3ab832[_0x8a89('0x17')]['message']);}logger[_0x8a89('0x17')](_0x8a89('0x13'),_0xf556bf,_0x3ab832[_0x8a89('0x17')]['message']);return _0xe15488(_0x3ab832[_0x8a89('0x17')]['message']);}else{logger[_0x8a89('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xf556bf,'request\x20sent');_0xe15488(_0x3ab832['result'][_0x8a89('0x18')]);}})['catch'](function(_0x227597){logger[_0x8a89('0x17')](_0x8a89('0x13'),_0xf556bf,_0x227597);_0x37c53e(_0x227597);});});}exports['GetVoiceQueueRtPauses']=function(_0x1ea9f7){var _0x1545b9=this;return new Promise(function(_0xc2e10e,_0x4621ac){return db[_0x8a89('0x19')]['findAll']({'raw':_0x1ea9f7['options']?_0x1ea9f7['options'][_0x8a89('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ea9f7[_0x8a89('0x1b')]?_0x1ea9f7[_0x8a89('0x1b')][_0x8a89('0x1c')]||null:null,'attributes':[[db[_0x8a89('0x1d')]['fn'](_0x8a89('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8a89('0x1f')](_0x8a89('0x20')))),_0x8a89('0x21')]]})[_0x8a89('0x11')](function(_0x5771b8){logger[_0x8a89('0x12')](_0x8a89('0x22'),_0x1ea9f7);logger[_0x8a89('0x23')](_0x8a89('0x22'),_0x1ea9f7,JSON[_0x8a89('0x16')](_0x5771b8));_0xc2e10e(_0x5771b8);})[_0x8a89('0x24')](function(_0x2bf76e){logger['error'](_0x8a89('0x22'),_0x2bf76e[_0x8a89('0x18')],_0x1ea9f7);_0x4621ac(_0x1545b9['error'](0x1f4,_0x2bf76e[_0x8a89('0x18')]));});});}; \ No newline at end of file +var _0x3395=['bluebird','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','util','moment'];(function(_0x1ea809,_0x4fa8bb){var _0x54be42=function(_0xe51094){while(--_0xe51094){_0x1ea809['push'](_0x1ea809['shift']());}};_0x54be42(++_0x4fa8bb);}(_0x3395,0x173));var _0x5339=function(_0x42af67,_0x1007d8){_0x42af67=_0x42af67-0x0;var _0x2ce8cd=_0x3395[_0x42af67];return _0x2ce8cd;};'use strict';var _=require(_0x5339('0x0'));var util=require(_0x5339('0x1'));var moment=require(_0x5339('0x2'));var BPromise=require(_0x5339('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5339('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5339('0x5'));var jayson=require(_0x5339('0x6'));var client=jayson[_0x5339('0x7')]['http']({'port':0x232a});config[_0x5339('0x8')]=_[_0x5339('0x9')](config[_0x5339('0x8')],{'host':_0x5339('0xa'),'port':0x18eb});var socket=require(_0x5339('0xb'))(new Redis(config[_0x5339('0x8')]));require(_0x5339('0xc'))['register'](socket);function respondWithRpcPromise(_0x402a57,_0x18a34b,_0x315d8e){return new BPromise(function(_0x790680,_0x101a29){return client[_0x5339('0xd')](_0x402a57,_0x315d8e)[_0x5339('0xe')](function(_0x2517c3){logger[_0x5339('0xf')](_0x5339('0x10'),_0x18a34b,_0x5339('0x11'));logger[_0x5339('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x18a34b,'request\x20sent',JSON[_0x5339('0x13')](_0x2517c3));if(_0x2517c3['error']){if(_0x2517c3['error'][_0x5339('0x14')]===0x1f4){logger['error'](_0x5339('0x10'),_0x18a34b,_0x2517c3[_0x5339('0x15')]['message']);return _0x101a29(_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);}logger[_0x5339('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x18a34b,_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);return _0x790680(_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);}else{logger[_0x5339('0xf')](_0x5339('0x10'),_0x18a34b,_0x5339('0x11'));_0x790680(_0x2517c3[_0x5339('0x17')]['message']);}})['catch'](function(_0x3231c3){logger[_0x5339('0x15')](_0x5339('0x10'),_0x18a34b,_0x3231c3);_0x101a29(_0x3231c3);});});}exports[_0x5339('0x18')]=function(_0x3870ca){var _0x243b13=this;return new Promise(function(_0xc3e91a,_0x4502c6){return db['UserVoiceQueueRt'][_0x5339('0x19')]({'raw':_0x3870ca[_0x5339('0x1a')]?_0x3870ca[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'where':_0x3870ca['options']?_0x3870ca['options'][_0x5339('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5339('0x1d'),db[_0x5339('0x1e')]['fn']('IF',db[_0x5339('0x1e')][_0x5339('0x1f')](_0x5339('0x20')))),'outboundQueuePauses']]})[_0x5339('0xe')](function(_0x27283d){logger['info'](_0x5339('0x18'),_0x3870ca);logger[_0x5339('0x12')](_0x5339('0x18'),_0x3870ca,JSON[_0x5339('0x13')](_0x27283d));_0xc3e91a(_0x27283d);})[_0x5339('0x21')](function(_0x37b6a2){logger['error']('GetVoiceQueueRtPauses',_0x37b6a2[_0x5339('0x16')],_0x3870ca);_0x4502c6(_0x243b13[_0x5339('0x15')](0x1f4,_0x37b6a2[_0x5339('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c1b6278..9b974a1 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 _0x7b27=['update','emit','removeListener','register','length','./userVoiceQueueRt.events','remove'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7b27,0x186));var _0x77b2=function(_0x3d1fdf,_0x29721e){_0x3d1fdf=_0x3d1fdf-0x0;var _0x4b1095=_0x7b27[_0x3d1fdf];return _0x4b1095;};'use strict';var UserVoiceQueueRtEvents=require(_0x77b2('0x0'));var events=['save',_0x77b2('0x1'),_0x77b2('0x2')];function createListener(_0x4000dd,_0x2f5a3a){return function(_0x511dfe){_0x2f5a3a[_0x77b2('0x3')](_0x4000dd,_0x511dfe);};}function removeListener(_0x47075b,_0x5e5289){return function(){UserVoiceQueueRtEvents[_0x77b2('0x4')](_0x47075b,_0x5e5289);};}exports[_0x77b2('0x5')]=function(_0x243b61){for(var _0x569bce=0x0,_0x22bdcf=events[_0x77b2('0x6')];_0x569bce<_0x22bdcf;_0x569bce++){var _0x2f01a2=events[_0x569bce];var _0x1308f7=createListener('userVoiceQueueRt:'+_0x2f01a2,_0x243b61);UserVoiceQueueRtEvents['on'](_0x2f01a2,_0x1308f7);}}; \ No newline at end of file +var _0x282a=['userVoiceQueueRt:','save','remove','update','emit','removeListener','length'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x282a,0xa2));var _0xa282=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x282a[_0x413feb];return _0x40ee88;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa282('0x0'),_0xa282('0x1'),_0xa282('0x2')];function createListener(_0x1b46a8,_0x1f74da){return function(_0x4f7a2b){_0x1f74da[_0xa282('0x3')](_0x1b46a8,_0x4f7a2b);};}function removeListener(_0x3344f0,_0x5af988){return function(){UserVoiceQueueRtEvents[_0xa282('0x4')](_0x3344f0,_0x5af988);};}exports['register']=function(_0x2076ee){for(var _0x54caed=0x0,_0x1a2c3d=events[_0xa282('0x5')];_0x54caed<_0x1a2c3d;_0x54caed++){var _0x1d1e7a=events[_0x54caed];var _0x5e41ef=createListener(_0xa282('0x6')+_0x1d1e7a,_0x2076ee);UserVoiceQueueRtEvents['on'](_0x1d1e7a,_0x5e41ef);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d68d6cb..637c206 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e9361,_0x4d5267){var _0x559d22=function(_0x5e82f1){while(--_0x5e82f1){_0x4e9361['push'](_0x4e9361['shift']());}};_0x559d22(++_0x4d5267);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2a7ed2,_0x1548f3){var _0x526e23=function(_0x243811){while(--_0x243811){_0x2a7ed2['push'](_0x2a7ed2['shift']());}};_0x526e23(++_0x1548f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xcb91[_0x3f94f9];return _0x46f84f;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e715fd9..413d9f8 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 _0x0453=['INTEGER','exports'];(function(_0x589c33,_0x13ec38){var _0x37c3e7=function(_0xc7856f){while(--_0xc7856f){_0x589c33['push'](_0x589c33['shift']());}};_0x37c3e7(++_0x13ec38);}(_0x0453,0x155));var _0x3045=function(_0x2d1fa7,_0x53bccb){_0x2d1fa7=_0x2d1fa7-0x0;var _0x494189=_0x0453[_0x2d1fa7];return _0x494189;};'use strict';var Sequelize=require('sequelize');module[_0x3045('0x0')]={'penalty':{'type':Sequelize[_0x3045('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b14=['exports','INTEGER'];(function(_0x491d08,_0x19fad0){var _0x4a3b0=function(_0x264d24){while(--_0x264d24){_0x491d08['push'](_0x491d08['shift']());}};_0x4a3b0(++_0x19fad0);}(_0x6b14,0x102));var _0x46b1=function(_0x50c400,_0x264be1){_0x50c400=_0x50c400-0x0;var _0x184e8e=_0x6b14[_0x50c400];return _0x184e8e;};'use strict';var Sequelize=require('sequelize');module[_0x46b1('0x0')]={'penalty':{'type':Sequelize[_0x46b1('0x1')],'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 7c39ca0..dbf0c52 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 _0x7332=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x7332,0x17a));var _0x2733=function(_0x33a7ba,_0x5820e3){_0x33a7ba=_0x33a7ba-0x0;var _0x41936f=_0x7332[_0x33a7ba];return _0x41936f;};'use strict';var _=require(_0x2733('0x0'));var util=require('util');var logger=require(_0x2733('0x1'))(_0x2733('0x2'));var moment=require(_0x2733('0x3'));var BPromise=require(_0x2733('0x4'));var rp=require(_0x2733('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2733('0x6'));var config=require(_0x2733('0x7'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x102b94,_0x254366){return _0x102b94[_0x2733('0x8')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x718c=['exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes'];(function(_0x224d0e,_0x2119d8){var _0x148098=function(_0x47cf6d){while(--_0x47cf6d){_0x224d0e['push'](_0x224d0e['shift']());}};_0x148098(++_0x2119d8);}(_0x718c,0xd3));var _0xc718=function(_0x468b46,_0xddc4ab){_0x468b46=_0x468b46-0x0;var _0x451417=_0x718c[_0x468b46];return _0x451417;};'use strict';var _=require(_0xc718('0x0'));var util=require(_0xc718('0x1'));var logger=require(_0xc718('0x2'))(_0xc718('0x3'));var moment=require(_0xc718('0x4'));var BPromise=require(_0xc718('0x5'));var rp=require(_0xc718('0x6'));var fs=require('fs');var path=require(_0xc718('0x7'));var rimraf=require(_0xc718('0x8'));var config=require('../../config/environment');var attributes=require(_0xc718('0x9'));module[_0xc718('0xa')]=function(_0x360a44,_0x4f233c){return _0x360a44['define'](_0xc718('0xb'),attributes,{'tableName':_0xc718('0xc'),'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 625a4c6..03b8130 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 _0xd08a=['message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4c075b,_0x56c2e7){var _0x228448=function(_0x37c25c){while(--_0x37c25c){_0x4c075b['push'](_0x4c075b['shift']());}};_0x228448(++_0x56c2e7);}(_0xd08a,0x17e));var _0xad08=function(_0x31ae32,_0x92b5fe){_0x31ae32=_0x31ae32-0x0;var _0xf822d6=_0xd08a[_0x31ae32];return _0xf822d6;};'use strict';var _=require(_0xad08('0x0'));var util=require(_0xad08('0x1'));var moment=require('moment');var BPromise=require(_0xad08('0x2'));var rs=require(_0xad08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad08('0x4'))['db'];var utils=require(_0xad08('0x5'));var logger=require('../../config/logger')(_0xad08('0x6'));var config=require(_0xad08('0x7'));var jayson=require(_0xad08('0x8'));var client=jayson[_0xad08('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x428fdc,_0x16901f,_0x4e1d27){return new BPromise(function(_0x31380a,_0x45dbb3){return client[_0xad08('0xa')](_0x428fdc,_0x4e1d27)[_0xad08('0xb')](function(_0x22f605){logger['info'](_0xad08('0xc'),_0x16901f,'request\x20sent');logger['debug'](_0xad08('0xd'),_0x16901f,_0xad08('0xe'),JSON[_0xad08('0xf')](_0x22f605));if(_0x22f605[_0xad08('0x10')]){if(_0x22f605['error'][_0xad08('0x11')]===0x1f4){logger[_0xad08('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x16901f,_0x22f605['error'][_0xad08('0x12')]);return _0x45dbb3(_0x22f605[_0xad08('0x10')][_0xad08('0x12')]);}logger[_0xad08('0x10')](_0xad08('0xc'),_0x16901f,_0x22f605['error'][_0xad08('0x12')]);return _0x31380a(_0x22f605[_0xad08('0x10')][_0xad08('0x12')]);}else{logger['info'](_0xad08('0xc'),_0x16901f,_0xad08('0xe'));_0x31380a(_0x22f605['result'][_0xad08('0x12')]);}})[_0xad08('0x13')](function(_0x11d663){logger['error'](_0xad08('0xc'),_0x16901f,_0x11d663);_0x45dbb3(_0x11d663);});});} \ No newline at end of file +var _0xeeae=['../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xe3c242,_0x5be66b){var _0x2a3b71=function(_0x57d236){while(--_0x57d236){_0xe3c242['push'](_0xe3c242['shift']());}};_0x2a3b71(++_0x5be66b);}(_0xeeae,0xf7));var _0xeeea=function(_0x50f0e9,_0x2f9300){_0x50f0e9=_0x50f0e9-0x0;var _0x12dae4=_0xeeae[_0x50f0e9];return _0x12dae4;};'use strict';var _=require(_0xeeea('0x0'));var util=require(_0xeeea('0x1'));var moment=require(_0xeeea('0x2'));var BPromise=require(_0xeeea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeea('0x4'));var db=require(_0xeeea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeeea('0x6'))(_0xeeea('0x7'));var config=require(_0xeeea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeeea('0x9')][_0xeeea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a1dfe,_0x3898c3,_0x62136a){return new BPromise(function(_0x52dd8d,_0x9533ba){return client[_0xeeea('0xb')](_0x4a1dfe,_0x62136a)[_0xeeea('0xc')](function(_0x1d7a98){logger['info'](_0xeeea('0xd'),_0x3898c3,_0xeeea('0xe'));logger[_0xeeea('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3898c3,_0xeeea('0xe'),JSON[_0xeeea('0x10')](_0x1d7a98));if(_0x1d7a98[_0xeeea('0x11')]){if(_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x12')]===0x1f4){logger[_0xeeea('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3898c3,_0x1d7a98['error']['message']);return _0x9533ba(_0x1d7a98['error'][_0xeeea('0x13')]);}logger['error'](_0xeeea('0xd'),_0x3898c3,_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x13')]);return _0x52dd8d(_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x13')]);}else{logger[_0xeeea('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3898c3,_0xeeea('0xe'));_0x52dd8d(_0x1d7a98[_0xeeea('0x15')]['message']);}})[_0xeeea('0x16')](function(_0x3dab28){logger[_0xeeea('0x11')](_0xeeea('0xd'),_0x3898c3,_0x3dab28);_0x9533ba(_0x3dab28);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6fc8481..435fc58 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 _0x47c7=['../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','update','destroy','multer','path','connect-timeout','Router','fs-extra'];(function(_0x294385,_0x5d2a11){var _0x2ef86b=function(_0x4d7abd){while(--_0x4d7abd){_0x294385['push'](_0x294385['shift']());}};_0x2ef86b(++_0x5d2a11);}(_0x47c7,0x1ab));var _0x747c=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x47c7[_0x2abc3d];return _0x252745;};'use strict';var multer=require(_0x747c('0x0'));var util=require('util');var path=require(_0x747c('0x1'));var timeout=require(_0x747c('0x2'));var express=require('express');var router=express[_0x747c('0x3')]();var fs_extra=require(_0x747c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x747c('0x5'));var config=require(_0x747c('0x6'));var controller=require(_0x747c('0x7'));router[_0x747c('0x8')]('/',auth['isAuthenticated'](),controller[_0x747c('0x9')]);router['get'](_0x747c('0xa'),auth[_0x747c('0xb')](),controller[_0x747c('0xc')]);router[_0x747c('0xd')]('/',auth[_0x747c('0xb')](),controller['create']);router['put'](_0x747c('0xa'),auth[_0x747c('0xb')](),controller[_0x747c('0xe')]);router['delete'](_0x747c('0xa'),auth[_0x747c('0xb')](),controller[_0x747c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5712=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x438eb3,_0x164c2b){var _0x4e62ba=function(_0x549ae4){while(--_0x549ae4){_0x438eb3['push'](_0x438eb3['shift']());}};_0x4e62ba(++_0x164c2b);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var path=require(_0x2571('0x2'));var timeout=require(_0x2571('0x3'));var express=require(_0x2571('0x4'));var router=express[_0x2571('0x5')]();var fs_extra=require(_0x2571('0x6'));var auth=require(_0x2571('0x7'));var interaction=require(_0x2571('0x8'));var config=require(_0x2571('0x9'));var controller=require('./variable.controller');router['get']('/',auth[_0x2571('0xa')](),controller['index']);router[_0x2571('0xb')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0xd')]);router[_0x2571('0xe')]('/',auth[_0x2571('0xa')](),controller['create']);router[_0x2571('0xf')]('/:id',auth[_0x2571('0xa')](),controller[_0x2571('0x10')]);router[_0x2571('0x11')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0x12')]);module[_0x2571('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0b3e572..4731443 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 _0x14e4=['STRING','name','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x14e4,0x8c));var _0x414e=function(_0xbc3938,_0x16d665){_0xbc3938=_0xbc3938-0x0;var _0x4b3aa0=_0x14e4[_0xbc3938];return _0x4b3aa0;};'use strict';var Sequelize=require('sequelize');module[_0x414e('0x0')]={'name':{'type':Sequelize[_0x414e('0x1')],'unique':_0x414e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcdc2=['sequelize','STRING'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xcdc2,0xae));var _0x2cdc=function(_0x39e3a,_0x2231a6){_0x39e3a=_0x39e3a-0x0;var _0x2294d8=_0xcdc2[_0x39e3a];return _0x2294d8;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'name':{'type':Sequelize[_0x2cdc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2cdc('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 89c8ba7..301d597 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 _0xabb2=['UserProfileResource','sendStatus','stack','name','send','map','Variable','rawAttributes','type','key','keys','query','model','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','get','Variables'];(function(_0x41e84f,_0x40754f){var _0x39b7ac=function(_0x3d05f9){while(--_0x3d05f9){_0x41e84f['push'](_0x41e84f['shift']());}};_0x39b7ac(++_0x40754f);}(_0xabb2,0x16d));var _0x2abb=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xabb2[_0x279368];return _0x40b6d0;};'use strict';var emlformat=require(_0x2abb('0x0'));var rimraf=require(_0x2abb('0x1'));var zipdir=require(_0x2abb('0x2'));var jsonpatch=require(_0x2abb('0x3'));var rp=require(_0x2abb('0x4'));var moment=require(_0x2abb('0x5'));var BPromise=require(_0x2abb('0x6'));var Mustache=require('mustache');var util=require(_0x2abb('0x7'));var path=require('path');var sox=require(_0x2abb('0x8'));var csv=require('to-csv');var ejs=require(_0x2abb('0x9'));var fs=require('fs');var fs_extra=require(_0x2abb('0xa'));var _=require(_0x2abb('0xb'));var squel=require(_0x2abb('0xc'));var crypto=require(_0x2abb('0xd'));var jsforce=require(_0x2abb('0xe'));var deskjs=require(_0x2abb('0xf'));var toCsv=require(_0x2abb('0x10'));var querystring=require('querystring');var Papa=require(_0x2abb('0x11'));var Redis=require(_0x2abb('0x12'));var authService=require(_0x2abb('0x13'));var qs=require(_0x2abb('0x14'));var as=require(_0x2abb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2abb('0x16'))(_0x2abb('0x17'));var utils=require(_0x2abb('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2abb('0x19'))['db'];function respondWithStatusCode(_0x222999,_0x29befa){_0x29befa=_0x29befa||0xcc;return function(_0xe674d4){if(_0xe674d4){return _0x222999['sendStatus'](_0x29befa);}return _0x222999[_0x2abb('0x1a')](_0x29befa)[_0x2abb('0x1b')]();};}function respondWithResult(_0x48d7ce,_0x54cac6){_0x54cac6=_0x54cac6||0xc8;return function(_0x1e60ad){if(_0x1e60ad){return _0x48d7ce[_0x2abb('0x1a')](_0x54cac6)[_0x2abb('0x1c')](_0x1e60ad);}};}function respondWithFilteredResult(_0x44a813,_0x2313f5){return function(_0x1e43a0){if(_0x1e43a0){var _0x47cefc=typeof _0x2313f5[_0x2abb('0x1d')]==='undefined'&&typeof _0x2313f5[_0x2abb('0x1e')]===_0x2abb('0x1f');var _0x49e86f=_0x1e43a0[_0x2abb('0x20')];var _0x221ff5=_0x47cefc?0x0:_0x2313f5[_0x2abb('0x1d')];var _0x29a045=_0x47cefc?_0x1e43a0[_0x2abb('0x20')]:_0x2313f5[_0x2abb('0x1d')]+_0x2313f5[_0x2abb('0x1e')];var _0x435a85;if(_0x29a045>=_0x49e86f){_0x29a045=_0x49e86f;_0x435a85=0xc8;}else{_0x435a85=0xce;}_0x44a813['status'](_0x435a85);return _0x44a813['set'](_0x2abb('0x21'),_0x221ff5+'-'+_0x29a045+'/'+_0x49e86f)[_0x2abb('0x1c')](_0x1e43a0);}return null;};}function patchUpdates(_0x1a4735){return function(_0x34d434){try{jsonpatch['apply'](_0x34d434,_0x1a4735,!![]);}catch(_0x57b87f){return BPromise[_0x2abb('0x22')](_0x57b87f);}return _0x34d434[_0x2abb('0x23')]();};}function saveUpdates(_0x340d33,_0x99e764){return function(_0x21f49){if(_0x21f49){return _0x21f49['update'](_0x340d33)[_0x2abb('0x24')](function(_0x42c470){return _0x42c470;});}return null;};}function removeEntity(_0x1524e9,_0x298886){return function(_0xff4081){if(_0xff4081){return _0xff4081[_0x2abb('0x25')]()['then'](function(){var _0x39f305=_0xff4081[_0x2abb('0x26')]({'plain':!![]});var _0x4a3cee=_0x2abb('0x27');return db[_0x2abb('0x28')]['destroy']({'where':{'type':_0x4a3cee,'resourceId':_0x39f305['id']}})[_0x2abb('0x24')](function(){return _0xff4081;});})[_0x2abb('0x24')](function(){_0x1524e9[_0x2abb('0x1a')](0xcc)[_0x2abb('0x1b')]();});}};}function handleEntityNotFound(_0x5b31b5,_0x5094e5){return function(_0x32db4c){if(!_0x32db4c){_0x5b31b5[_0x2abb('0x29')](0x194);}return _0x32db4c;};}function handleError(_0x4ee5d8,_0x447832){_0x447832=_0x447832||0x1f4;return function(_0x526075){logger['error'](_0x526075[_0x2abb('0x2a')]);if(_0x526075[_0x2abb('0x2b')]){delete _0x526075[_0x2abb('0x2b')];}_0x4ee5d8[_0x2abb('0x1a')](_0x447832)[_0x2abb('0x2c')](_0x526075);};}exports['index']=function(_0xcf5c79,_0x3bc55e){var _0x5ebba5={},_0x37d454={},_0xcf82e5={'count':0x0,'rows':[]};var _0x584fc5=_[_0x2abb('0x2d')](db[_0x2abb('0x2e')][_0x2abb('0x2f')],function(_0x260089){return{'name':_0x260089['fieldName'],'type':_0x260089[_0x2abb('0x30')][_0x2abb('0x31')]};});_0x37d454['model']=_[_0x2abb('0x2d')](_0x584fc5,_0x2abb('0x2b'));_0x37d454['query']=_[_0x2abb('0x32')](_0xcf5c79[_0x2abb('0x33')]);_0x37d454['filters']=_['intersection'](_0x37d454[_0x2abb('0x34')],_0x37d454[_0x2abb('0x33')]);_0x5ebba5['attributes']=_[_0x2abb('0x35')](_0x37d454[_0x2abb('0x34')],qs[_0x2abb('0x36')](_0xcf5c79[_0x2abb('0x33')][_0x2abb('0x36')]));_0x5ebba5[_0x2abb('0x37')]=_0x5ebba5[_0x2abb('0x37')][_0x2abb('0x38')]?_0x5ebba5[_0x2abb('0x37')]:_0x37d454[_0x2abb('0x34')];if(!_0xcf5c79[_0x2abb('0x33')]['hasOwnProperty'](_0x2abb('0x39'))){_0x5ebba5['limit']=qs['limit'](_0xcf5c79[_0x2abb('0x33')]['limit']);_0x5ebba5[_0x2abb('0x1d')]=qs['offset'](_0xcf5c79[_0x2abb('0x33')][_0x2abb('0x1d')]);}_0x5ebba5['order']=qs[_0x2abb('0x3a')](_0xcf5c79[_0x2abb('0x33')]['sort']);_0x5ebba5[_0x2abb('0x3b')]=qs[_0x2abb('0x3c')](_[_0x2abb('0x3d')](_0xcf5c79[_0x2abb('0x33')],_0x37d454['filters']),_0x584fc5);if(_0xcf5c79[_0x2abb('0x33')][_0x2abb('0x3e')]){_0x5ebba5['where']=_[_0x2abb('0x3f')](_0x5ebba5['where'],{'$or':_['map'](_0x584fc5,function(_0x504151){if(_0x504151['type']!==_0x2abb('0x40')){var _0x5ef03={};_0x5ef03[_0x504151[_0x2abb('0x2b')]]={'$like':'%'+_0xcf5c79['query'][_0x2abb('0x3e')]+'%'};return _0x5ef03;}})});}_0x5ebba5=_[_0x2abb('0x3f')]({},_0x5ebba5,_0xcf5c79[_0x2abb('0x41')]);var _0x1e762c={'where':_0x5ebba5['where']};return db['Variable']['count'](_0x1e762c)['then'](function(_0x305727){_0xcf82e5[_0x2abb('0x20')]=_0x305727;if(_0xcf5c79[_0x2abb('0x33')][_0x2abb('0x42')]){_0x5ebba5['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x5ebba5);})[_0x2abb('0x24')](function(_0x41bb9a){_0xcf82e5[_0x2abb('0x43')]=_0x41bb9a;return _0xcf82e5;})[_0x2abb('0x24')](respondWithFilteredResult(_0x3bc55e,_0x5ebba5))[_0x2abb('0x44')](handleError(_0x3bc55e,null));};exports[_0x2abb('0x45')]=function(_0x276ed3,_0xef0b76){var _0x48558c={'raw':!![],'where':{'id':_0x276ed3['params']['id']}},_0x14e162={};_0x14e162['model']=_[_0x2abb('0x32')](db[_0x2abb('0x2e')][_0x2abb('0x2f')]);_0x14e162[_0x2abb('0x33')]=_[_0x2abb('0x32')](_0x276ed3[_0x2abb('0x33')]);_0x14e162[_0x2abb('0x3c')]=_[_0x2abb('0x35')](_0x14e162['model'],_0x14e162[_0x2abb('0x33')]);_0x48558c[_0x2abb('0x37')]=_[_0x2abb('0x35')](_0x14e162[_0x2abb('0x34')],qs[_0x2abb('0x36')](_0x276ed3[_0x2abb('0x33')][_0x2abb('0x36')]));_0x48558c[_0x2abb('0x37')]=_0x48558c[_0x2abb('0x37')][_0x2abb('0x38')]?_0x48558c[_0x2abb('0x37')]:_0x14e162['model'];if(_0x276ed3[_0x2abb('0x33')][_0x2abb('0x42')]){_0x48558c[_0x2abb('0x46')]=[{'all':!![]}];}_0x48558c=_['merge']({},_0x48558c,_0x276ed3[_0x2abb('0x41')]);return db['Variable'][_0x2abb('0x47')](_0x48558c)[_0x2abb('0x24')](handleEntityNotFound(_0xef0b76,null))['then'](respondWithResult(_0xef0b76,null))[_0x2abb('0x44')](handleError(_0xef0b76,null));};exports[_0x2abb('0x48')]=function(_0x41ec9c,_0x61ed2d){return db['Variable'][_0x2abb('0x48')](_0x41ec9c[_0x2abb('0x49')],{})[_0x2abb('0x24')](function(_0x591c7f){var _0x4f7d88=_0x41ec9c[_0x2abb('0x4a')][_0x2abb('0x26')]({'plain':!![]});if(!_0x4f7d88)throw new Error(_0x2abb('0x4b'));if(_0x4f7d88['role']===_0x2abb('0x4a')){var _0x40af5e=_0x591c7f[_0x2abb('0x26')]({'plain':!![]});var _0x208bd3=_0x2abb('0x27');return db[_0x2abb('0x4c')][_0x2abb('0x47')]({'where':{'name':_0x208bd3,'userProfileId':_0x4f7d88[_0x2abb('0x4d')]},'raw':!![]})[_0x2abb('0x24')](function(_0x53726a){if(_0x53726a&&_0x53726a['autoAssociation']===0x0){return db[_0x2abb('0x28')][_0x2abb('0x48')]({'name':_0x40af5e[_0x2abb('0x2b')],'resourceId':_0x40af5e['id'],'type':_0x53726a[_0x2abb('0x2b')],'sectionId':_0x53726a['id']},{})[_0x2abb('0x24')](function(){return _0x591c7f;});}else{return _0x591c7f;}})[_0x2abb('0x44')](function(_0x1effa5){logger[_0x2abb('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1effa5);throw _0x1effa5;});}return _0x591c7f;})[_0x2abb('0x24')](respondWithResult(_0x61ed2d,0xc9))[_0x2abb('0x44')](handleError(_0x61ed2d,null));};exports[_0x2abb('0x4f')]=function(_0x349d14,_0x23bbd2){if(_0x349d14[_0x2abb('0x49')]['id']){delete _0x349d14[_0x2abb('0x49')]['id'];}return db[_0x2abb('0x2e')][_0x2abb('0x47')]({'where':{'id':_0x349d14[_0x2abb('0x50')]['id']}})[_0x2abb('0x24')](handleEntityNotFound(_0x23bbd2,null))[_0x2abb('0x24')](saveUpdates(_0x349d14[_0x2abb('0x49')],null))[_0x2abb('0x24')](respondWithResult(_0x23bbd2,null))[_0x2abb('0x44')](handleError(_0x23bbd2,null));};exports['destroy']=function(_0x8a6af8,_0x57fb06){return db[_0x2abb('0x2e')]['find']({'where':{'id':_0x8a6af8[_0x2abb('0x50')]['id']}})['then'](handleEntityNotFound(_0x57fb06,null))['then'](removeEntity(_0x57fb06,null))[_0x2abb('0x44')](handleError(_0x57fb06,null));}; \ No newline at end of file +var _0x105c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','Variable','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x105c,0xed));var _0xc105=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x105c[_0x5a1a51];return _0x47edd7;};'use strict';var emlformat=require(_0xc105('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc105('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc105('0x2'));var moment=require(_0xc105('0x3'));var BPromise=require(_0xc105('0x4'));var Mustache=require(_0xc105('0x5'));var util=require('util');var path=require(_0xc105('0x6'));var sox=require(_0xc105('0x7'));var csv=require(_0xc105('0x8'));var ejs=require(_0xc105('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc105('0xa'));var squel=require(_0xc105('0xb'));var crypto=require(_0xc105('0xc'));var jsforce=require(_0xc105('0xd'));var deskjs=require(_0xc105('0xe'));var toCsv=require(_0xc105('0x8'));var querystring=require(_0xc105('0xf'));var Papa=require(_0xc105('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc105('0x11'));var hardwareService=require(_0xc105('0x12'));var logger=require(_0xc105('0x13'))(_0xc105('0x14'));var utils=require(_0xc105('0x15'));var config=require(_0xc105('0x16'));var licenseUtil=require(_0xc105('0x17'));var db=require(_0xc105('0x18'))['db'];function respondWithStatusCode(_0x463785,_0xf10776){_0xf10776=_0xf10776||0xcc;return function(_0x5de634){if(_0x5de634){return _0x463785[_0xc105('0x19')](_0xf10776);}return _0x463785['status'](_0xf10776)[_0xc105('0x1a')]();};}function respondWithResult(_0x3f28a0,_0x2f68a4){_0x2f68a4=_0x2f68a4||0xc8;return function(_0x2c2e3a){if(_0x2c2e3a){return _0x3f28a0[_0xc105('0x1b')](_0x2f68a4)[_0xc105('0x1c')](_0x2c2e3a);}};}function respondWithFilteredResult(_0x813ed0,_0x1ec3df){return function(_0x3aa839){if(_0x3aa839){var _0x14bfcc=typeof _0x1ec3df[_0xc105('0x1d')]==='undefined'&&typeof _0x1ec3df['limit']===_0xc105('0x1e');var _0x2ba40e=_0x3aa839[_0xc105('0x1f')];var _0x193530=_0x14bfcc?0x0:_0x1ec3df[_0xc105('0x1d')];var _0x4fcf2f=_0x14bfcc?_0x3aa839['count']:_0x1ec3df[_0xc105('0x1d')]+_0x1ec3df[_0xc105('0x20')];var _0x454e5f;if(_0x4fcf2f>=_0x2ba40e){_0x4fcf2f=_0x2ba40e;_0x454e5f=0xc8;}else{_0x454e5f=0xce;}_0x813ed0[_0xc105('0x1b')](_0x454e5f);return _0x813ed0[_0xc105('0x21')](_0xc105('0x22'),_0x193530+'-'+_0x4fcf2f+'/'+_0x2ba40e)[_0xc105('0x1c')](_0x3aa839);}return null;};}function patchUpdates(_0x161377){return function(_0x70215){try{jsonpatch[_0xc105('0x23')](_0x70215,_0x161377,!![]);}catch(_0x35faa7){return BPromise[_0xc105('0x24')](_0x35faa7);}return _0x70215[_0xc105('0x25')]();};}function saveUpdates(_0x2eddf9,_0x2bb349){return function(_0x263a30){if(_0x263a30){return _0x263a30[_0xc105('0x26')](_0x2eddf9)[_0xc105('0x27')](function(_0x5cc371){return _0x5cc371;});}return null;};}function removeEntity(_0x22cd0c,_0x4385b4){return function(_0x593b45){if(_0x593b45){return _0x593b45[_0xc105('0x28')]()[_0xc105('0x27')](function(){var _0x55d5f3=_0x593b45[_0xc105('0x29')]({'plain':!![]});var _0x44fe54='Variables';return db[_0xc105('0x2a')][_0xc105('0x28')]({'where':{'type':_0x44fe54,'resourceId':_0x55d5f3['id']}})[_0xc105('0x27')](function(){return _0x593b45;});})[_0xc105('0x27')](function(){_0x22cd0c[_0xc105('0x1b')](0xcc)[_0xc105('0x1a')]();});}};}function handleEntityNotFound(_0x59a624,_0x52a1a5){return function(_0x109cee){if(!_0x109cee){_0x59a624[_0xc105('0x19')](0x194);}return _0x109cee;};}function handleError(_0x333981,_0x17bffc){_0x17bffc=_0x17bffc||0x1f4;return function(_0x2bf8ff){logger[_0xc105('0x2b')](_0x2bf8ff[_0xc105('0x2c')]);if(_0x2bf8ff[_0xc105('0x2d')]){delete _0x2bf8ff[_0xc105('0x2d')];}_0x333981[_0xc105('0x1b')](_0x17bffc)[_0xc105('0x2e')](_0x2bf8ff);};}exports[_0xc105('0x2f')]=function(_0x1c4ed2,_0x3bd94b){var _0x56ac8e={},_0x2f66d6={},_0xd7aca4={'count':0x0,'rows':[]};var _0xca60b1=_[_0xc105('0x30')](db['Variable'][_0xc105('0x31')],function(_0x1f0220){return{'name':_0x1f0220[_0xc105('0x32')],'type':_0x1f0220['type'][_0xc105('0x33')]};});_0x2f66d6[_0xc105('0x34')]=_[_0xc105('0x30')](_0xca60b1,_0xc105('0x2d'));_0x2f66d6['query']=_['keys'](_0x1c4ed2[_0xc105('0x35')]);_0x2f66d6['filters']=_[_0xc105('0x36')](_0x2f66d6[_0xc105('0x34')],_0x2f66d6[_0xc105('0x35')]);_0x56ac8e['attributes']=_['intersection'](_0x2f66d6[_0xc105('0x34')],qs[_0xc105('0x37')](_0x1c4ed2[_0xc105('0x35')]['fields']));_0x56ac8e[_0xc105('0x38')]=_0x56ac8e[_0xc105('0x38')]['length']?_0x56ac8e[_0xc105('0x38')]:_0x2f66d6['model'];if(!_0x1c4ed2[_0xc105('0x35')][_0xc105('0x39')]('nolimit')){_0x56ac8e[_0xc105('0x20')]=qs[_0xc105('0x20')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x20')]);_0x56ac8e[_0xc105('0x1d')]=qs[_0xc105('0x1d')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x1d')]);}_0x56ac8e['order']=qs[_0xc105('0x3a')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x3a')]);_0x56ac8e[_0xc105('0x3b')]=qs['filters'](_[_0xc105('0x3c')](_0x1c4ed2[_0xc105('0x35')],_0x2f66d6[_0xc105('0x3d')]),_0xca60b1);if(_0x1c4ed2[_0xc105('0x35')]['filter']){_0x56ac8e['where']=_[_0xc105('0x3e')](_0x56ac8e[_0xc105('0x3b')],{'$or':_[_0xc105('0x30')](_0xca60b1,function(_0x44e8ab){if(_0x44e8ab[_0xc105('0x3f')]!==_0xc105('0x40')){var _0x4de248={};_0x4de248[_0x44e8ab[_0xc105('0x2d')]]={'$like':'%'+_0x1c4ed2['query'][_0xc105('0x41')]+'%'};return _0x4de248;}})});}_0x56ac8e=_[_0xc105('0x3e')]({},_0x56ac8e,_0x1c4ed2[_0xc105('0x42')]);var _0x4f4538={'where':_0x56ac8e[_0xc105('0x3b')]};return db['Variable']['count'](_0x4f4538)[_0xc105('0x27')](function(_0x2df467){_0xd7aca4[_0xc105('0x1f')]=_0x2df467;if(_0x1c4ed2[_0xc105('0x35')][_0xc105('0x43')]){_0x56ac8e[_0xc105('0x44')]=[{'all':!![]}];}return db[_0xc105('0x45')][_0xc105('0x46')](_0x56ac8e);})['then'](function(_0x5c3988){_0xd7aca4[_0xc105('0x47')]=_0x5c3988;return _0xd7aca4;})['then'](respondWithFilteredResult(_0x3bd94b,_0x56ac8e))[_0xc105('0x48')](handleError(_0x3bd94b,null));};exports[_0xc105('0x49')]=function(_0x8b20c8,_0x43fde1){var _0x26a20a={'raw':!![],'where':{'id':_0x8b20c8[_0xc105('0x4a')]['id']}},_0x1b4f34={};_0x1b4f34['model']=_[_0xc105('0x4b')](db[_0xc105('0x45')][_0xc105('0x31')]);_0x1b4f34[_0xc105('0x35')]=_[_0xc105('0x4b')](_0x8b20c8[_0xc105('0x35')]);_0x1b4f34[_0xc105('0x3d')]=_[_0xc105('0x36')](_0x1b4f34[_0xc105('0x34')],_0x1b4f34[_0xc105('0x35')]);_0x26a20a[_0xc105('0x38')]=_[_0xc105('0x36')](_0x1b4f34[_0xc105('0x34')],qs[_0xc105('0x37')](_0x8b20c8[_0xc105('0x35')][_0xc105('0x37')]));_0x26a20a[_0xc105('0x38')]=_0x26a20a[_0xc105('0x38')][_0xc105('0x4c')]?_0x26a20a['attributes']:_0x1b4f34[_0xc105('0x34')];if(_0x8b20c8[_0xc105('0x35')]['includeAll']){_0x26a20a[_0xc105('0x44')]=[{'all':!![]}];}_0x26a20a=_[_0xc105('0x3e')]({},_0x26a20a,_0x8b20c8[_0xc105('0x42')]);return db[_0xc105('0x45')][_0xc105('0x4d')](_0x26a20a)[_0xc105('0x27')](handleEntityNotFound(_0x43fde1,null))[_0xc105('0x27')](respondWithResult(_0x43fde1,null))['catch'](handleError(_0x43fde1,null));};exports['create']=function(_0xac50a4,_0x4b3885){return db['Variable'][_0xc105('0x4e')](_0xac50a4[_0xc105('0x4f')],{})['then'](function(_0x1dc5da){var _0x31167d=_0xac50a4[_0xc105('0x50')][_0xc105('0x29')]({'plain':!![]});if(!_0x31167d)throw new Error(_0xc105('0x51'));if(_0x31167d[_0xc105('0x52')]===_0xc105('0x50')){var _0x8cc4b6=_0x1dc5da[_0xc105('0x29')]({'plain':!![]});var _0xb39969='Variables';return db[_0xc105('0x53')][_0xc105('0x4d')]({'where':{'name':_0xb39969,'userProfileId':_0x31167d[_0xc105('0x54')]},'raw':!![]})[_0xc105('0x27')](function(_0x598d3e){if(_0x598d3e&&_0x598d3e['autoAssociation']===0x0){return db['UserProfileResource'][_0xc105('0x4e')]({'name':_0x8cc4b6[_0xc105('0x2d')],'resourceId':_0x8cc4b6['id'],'type':_0x598d3e[_0xc105('0x2d')],'sectionId':_0x598d3e['id']},{})[_0xc105('0x27')](function(){return _0x1dc5da;});}else{return _0x1dc5da;}})[_0xc105('0x48')](function(_0x56a4b3){logger[_0xc105('0x2b')](_0xc105('0x55'),_0x56a4b3);throw _0x56a4b3;});}return _0x1dc5da;})[_0xc105('0x27')](respondWithResult(_0x4b3885,0xc9))[_0xc105('0x48')](handleError(_0x4b3885,null));};exports[_0xc105('0x26')]=function(_0x2967cd,_0x1d6d0c){if(_0x2967cd['body']['id']){delete _0x2967cd[_0xc105('0x4f')]['id'];}return db[_0xc105('0x45')][_0xc105('0x4d')]({'where':{'id':_0x2967cd['params']['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x1d6d0c,null))[_0xc105('0x27')](saveUpdates(_0x2967cd[_0xc105('0x4f')],null))[_0xc105('0x27')](respondWithResult(_0x1d6d0c,null))[_0xc105('0x48')](handleError(_0x1d6d0c,null));};exports[_0xc105('0x28')]=function(_0x196aaa,_0x1d2a7e){return db['Variable'][_0xc105('0x4d')]({'where':{'id':_0x196aaa[_0xc105('0x4a')]['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x1d2a7e,null))['then'](removeEntity(_0x1d2a7e,null))[_0xc105('0x48')](handleError(_0x1d2a7e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index fd7382b..7a197a1 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 _0x264a=['../../config/logger','api','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','lodash','util'];(function(_0x29b1a7,_0x1ed6b6){var _0x4a69af=function(_0x174bff){while(--_0x174bff){_0x29b1a7['push'](_0x29b1a7['shift']());}};_0x4a69af(++_0x1ed6b6);}(_0x264a,0x112));var _0xa264=function(_0x45a328,_0x547a76){_0x45a328=_0x45a328-0x0;var _0x52c01f=_0x264a[_0x45a328];return _0x52c01f;};'use strict';var _=require(_0xa264('0x0'));var util=require(_0xa264('0x1'));var logger=require(_0xa264('0x2'))(_0xa264('0x3'));var moment=require('moment');var BPromise=require(_0xa264('0x4'));var rp=require(_0xa264('0x5'));var fs=require('fs');var path=require(_0xa264('0x6'));var rimraf=require(_0xa264('0x7'));var config=require('../../config/environment');var attributes=require(_0xa264('0x8'));module[_0xa264('0x9')]=function(_0x1ab6bd,_0x1bac50){return _0x1ab6bd[_0xa264('0xa')](_0xa264('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb277=['path','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird'];(function(_0x382d8e,_0x2a5761){var _0x23993d=function(_0x1f491c){while(--_0x1f491c){_0x382d8e['push'](_0x382d8e['shift']());}};_0x23993d(++_0x2a5761);}(_0xb277,0x7b));var _0x7b27=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb277[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x7b27('0x0'));var util=require(_0x7b27('0x1'));var logger=require(_0x7b27('0x2'))('api');var moment=require(_0x7b27('0x3'));var BPromise=require(_0x7b27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b27('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0x46ee41,_0x15301a){return _0x46ee41['define'](_0x7b27('0x6'),attributes,{'tableName':_0x7b27('0x7'),'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 46123c0..94759ee 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x3119e0,_0x26865c){var _0x408fa4=function(_0xe008e2){while(--_0xe008e2){_0x3119e0['push'](_0x3119e0['shift']());}};_0x408fa4(++_0x26865c);}(_0x814b,0x1a2));var _0xb814=function(_0x2688d5,_0x45db72){_0x2688d5=_0x2688d5-0x0;var _0x372637=_0x814b[_0x2688d5];return _0x372637;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x288e77,_0x5a48b8){_0x288e77=_0x288e77-0x0;var _0xc5262=_0x1cb9[_0x288e77];return _0xc5262;};'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')]('Variable,\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);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5e12341..05e4299 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 _0x6d0e=['/restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x3e7d6,_0x758186){var _0xba31a=function(_0x41ab22){while(--_0x41ab22){_0x3e7d6['push'](_0x3e7d6['shift']());}};_0xba31a(++_0x758186);}(_0x6d0e,0x69));var _0xe6d0=function(_0x1a7927,_0x50191b){_0x1a7927=_0x1a7927-0x0;var _0x393ee6=_0x6d0e[_0x1a7927];return _0x393ee6;};'use strict';var express=require(_0xe6d0('0x0'));var router=express[_0xe6d0('0x1')]();var auth=require(_0xe6d0('0x2'));var controller=require(_0xe6d0('0x3'));router[_0xe6d0('0x4')]('/',controller[_0xe6d0('0x5')]);router[_0xe6d0('0x4')](_0xe6d0('0x6'),auth[_0xe6d0('0x7')](),auth[_0xe6d0('0x8')](),controller[_0xe6d0('0x9')]);router[_0xe6d0('0x4')](_0xe6d0('0xa'),auth[_0xe6d0('0x7')](),auth['canUpdate'](),controller[_0xe6d0('0xb')]);router[_0xe6d0('0x4')](_0xe6d0('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe6d0('0xd')]);router[_0xe6d0('0x4')](_0xe6d0('0xe'),auth['isAuthenticated'](),controller['restart']);router[_0xe6d0('0x4')](_0xe6d0('0xf'),controller['migrations']);module[_0xe6d0('0x10')]=router; \ No newline at end of file +var _0x1c6d=['index','get','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','exports','Router','../../components/auth/service'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1c6d,0x136));var _0xd1c6=function(_0x3e83f1,_0x1b09ae){_0x3e83f1=_0x3e83f1-0x0;var _0x28cd96=_0x1c6d[_0x3e83f1];return _0x28cd96;};'use strict';var express=require('express');var router=express[_0xd1c6('0x0')]();var auth=require(_0xd1c6('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0xd1c6('0x2')]);router[_0xd1c6('0x3')]('/fetch',auth[_0xd1c6('0x4')](),auth[_0xd1c6('0x5')](),controller['fetch']);router[_0xd1c6('0x3')](_0xd1c6('0x6'),auth['isAuthenticated'](),auth[_0xd1c6('0x5')](),controller[_0xd1c6('0x7')]);router[_0xd1c6('0x3')](_0xd1c6('0x8'),auth['isAuthenticated'](),auth[_0xd1c6('0x5')](),controller[_0xd1c6('0x9')]);router[_0xd1c6('0x3')](_0xd1c6('0xa'),auth[_0xd1c6('0x4')](),controller[_0xd1c6('0xb')]);router['get']('/migrations',controller['migrations']);module[_0xd1c6('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 232fb7b..29d0225 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 _0x58b1=['\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','push','sort','getQueryInterface','sequelize','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0x58b1,0x1bc));var _0x158b=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x58b1[_0x1ac120];return _0x19b703;};'use strict';var Umzug=require(_0x158b('0x0'));var path=require(_0x158b('0x1'));var fs=require('fs');var _=require(_0x158b('0x2'));var pkginfo=require(_0x158b('0x3'))(module,_0x158b('0x4'));var compareVersions=require(_0x158b('0x5'));var exec=require(_0x158b('0x6'))[_0x158b('0x7')];var db=require(_0x158b('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x158b('0x9'));var logger=require(_0x158b('0xa'))(_0x158b('0xb'));var git=require('simple-git')(config[_0x158b('0xc')]);exports[_0x158b('0xd')]=function(_0x3af31f,_0x58698a){var _0x355cb3={'current':module['exports']['version'],'phonebar':0x2};if(_0x3af31f[_0x158b('0xe')]&&_0x3af31f[_0x158b('0xe')][_0x158b('0xf')]){return git[_0x158b('0x10')]()[_0x158b('0x11')](function(_0x3d139a,_0x4e3387){_0x355cb3[_0x158b('0xf')]=(_0x3d139a?module[_0x158b('0x12')][_0x158b('0x4')]:_0x4e3387[_0x158b('0xf')])||_0x158b('0x13');return _0x58698a[_0x158b('0x14')](0xc8)[_0x158b('0x15')](_0x355cb3);});}else{return _0x58698a[_0x158b('0x14')](0xc8)['json'](_0x355cb3);}};exports[_0x158b('0x10')]=function(_0x195cae,_0x22a538){return git[_0x158b('0x10')]([_0x158b('0x16'),_0x158b('0x17')],function(_0x2fb67b){if(_0x2fb67b){logger[_0x158b('0x18')](_0x2fb67b);return _0x22a538['status'](0x1f4)['json'](_0x2fb67b);}logger['info'](_0x158b('0x19'));return _0x22a538[_0x158b('0x14')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x158b('0x1a')]=function(_0x59a35d,_0x4cf6fd){return git[_0x158b('0x1a')]([_0x158b('0x1b'),_0x158b('0x1c')],function(_0x3dc992){if(_0x3dc992){logger[_0x158b('0x18')](_0x3dc992);return _0x4cf6fd[_0x158b('0x14')](0x1f4)['json'](_0x3dc992);}logger[_0x158b('0x1d')](_0x158b('0x1e'));return _0x4cf6fd[_0x158b('0x14')](0xc8)['json']({'output':_0x158b('0x1f')});});};exports[_0x158b('0x20')]=function(_0x460d16,_0x3c88e6){exec(_0x158b('0x21'),function(_0x33542e,_0xe68f11,_0x2503c2){logger['info'](_0xe68f11);logger['info'](_0x2503c2);if(_0x33542e){logger[_0x158b('0x18')](_0x33542e);return _0x3c88e6[_0x158b('0x14')](0x1f4)['json'](_0x33542e);}return _0x3c88e6[_0x158b('0x14')](0xc8)[_0x158b('0x15')]({'output':_0xe68f11});});};exports[_0x158b('0x22')]=function(_0x1c15e7,_0x2773cd){return pm2['restart'](_0x158b('0x23'))[_0x158b('0x24')](function(_0x44935a){logger[_0x158b('0x1d')]('pm2\x20restart\x20motion\x20%s',_0x44935a);return _0x2773cd[_0x158b('0x14')](0xc8)['json']({'output':_0x158b('0x25')});})[_0x158b('0x26')](function(_0x482fd7){logger[_0x158b('0x18')](_0x482fd7);return _0x2773cd['status'](0x1f4)[_0x158b('0x15')](_0x482fd7);});};exports['migrations']=function(_0x12b931,_0x3bc832){var _0xfbc9f=fs[_0x158b('0x27')](path[_0x158b('0x28')](config[_0x158b('0xc')],_0x158b('0x29'),_0x158b('0x2a')));var _0x18993e=[];for(var _0x59b22b=0x0;_0x59b22b<_0xfbc9f[_0x158b('0x2b')];_0x59b22b++){var _0x1258d5=_0xfbc9f[_0x59b22b][_0x158b('0x2c')](_0x158b('0x2d'),'');if(compareVersions(module['exports'][_0x158b('0x4')],_0x1258d5)===-0x1){_0x18993e[_0x158b('0x2e')](_0x1258d5);}}if(_0x18993e['length']){var _0x5a83e6=_0x18993e[_0x158b('0x2f')](compareVersions);var _0x46a660=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x158b('0x4')},'migrations':{'params':[db['sequelize'][_0x158b('0x30')](),db[_0x158b('0x31')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x158b('0x28')](config[_0x158b('0xc')],_0x158b('0x29'),_0x158b('0x2a')),'pattern':/\.js$/}});_0x46a660['up']({'migrations':_['map'](_0x5a83e6,function(_0x49f3c0){return _0x49f3c0+_0x158b('0x2d');})})['then'](function(){return _0x3bc832['status'](0xc8)['json']({'output':_0x158b('0x32')+module[_0x158b('0x12')]['version']+_0x158b('0x33')+_[_0x158b('0x34')](_0x5a83e6),'migrations':_[_0x158b('0x28')](_0x5a83e6)});})[_0x158b('0x26')](function(_0x3f9985){if(_0x3f9985 instanceof db[_0x158b('0x31')][_0x158b('0x35')]){return _0x3bc832[_0x158b('0x14')](0xc8)[_0x158b('0x15')]({'output':_0x158b('0x36')});}else{return _0x3bc832[_0x158b('0x14')](0x1f4)[_0x158b('0x15')](_0x3f9985);}});}else{return _0x3bc832[_0x158b('0x14')](0xc8)[_0x158b('0x15')]({'output':_0x158b('0x36')});}}; \ No newline at end of file +var _0x3acf=['latest','fetch','tags','version','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','server','length','replace','.js','exports','push','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','join','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','query'];(function(_0x4c1bf9,_0x1e4f68){var _0x3bde0d=function(_0x5b7fb1){while(--_0x5b7fb1){_0x4c1bf9['push'](_0x4c1bf9['shift']());}};_0x3bde0d(++_0x1e4f68);}(_0x3acf,0x16d));var _0xf3ac=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x3acf[_0x3048ea];return _0x1a13c4;};'use strict';var Umzug=require(_0xf3ac('0x0'));var path=require(_0xf3ac('0x1'));var fs=require('fs');var _=require(_0xf3ac('0x2'));var pkginfo=require(_0xf3ac('0x3'))(module,'version');var compareVersions=require(_0xf3ac('0x4'));var exec=require(_0xf3ac('0x5'))[_0xf3ac('0x6')];var db=require(_0xf3ac('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xf3ac('0x8'));var logger=require(_0xf3ac('0x9'))(_0xf3ac('0xa'));var git=require('simple-git')(config[_0xf3ac('0xb')]);exports['index']=function(_0x16d029,_0x2e736f){var _0x166d78={'current':module['exports']['version'],'phonebar':0x2};if(_0x16d029[_0xf3ac('0xc')]&&_0x16d029['query'][_0xf3ac('0xd')]){return git[_0xf3ac('0xe')]()[_0xf3ac('0xf')](function(_0x1acb86,_0x1d6c47){_0x166d78[_0xf3ac('0xd')]=(_0x1acb86?module['exports'][_0xf3ac('0x10')]:_0x1d6c47['latest'])||_0xf3ac('0x11');return _0x2e736f[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')](_0x166d78);});}else{return _0x2e736f[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')](_0x166d78);}};exports[_0xf3ac('0xe')]=function(_0x77c2d4,_0x30e875){return git[_0xf3ac('0xe')]([_0xf3ac('0x14'),_0xf3ac('0x15')],function(_0x401738){if(_0x401738){logger['error'](_0x401738);return _0x30e875[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x401738);}logger[_0xf3ac('0x16')](_0xf3ac('0x17'));return _0x30e875[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x18')});});};exports[_0xf3ac('0x19')]=function(_0x1aa62f,_0x19201b){return git['reset']([_0xf3ac('0x1a'),_0xf3ac('0x1b')],function(_0x4d78f3){if(_0x4d78f3){logger[_0xf3ac('0x1c')](_0x4d78f3);return _0x19201b[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x4d78f3);}logger[_0xf3ac('0x16')](_0xf3ac('0x1d'));return _0x19201b[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x1e')});});};exports[_0xf3ac('0x1f')]=function(_0x1575ac,_0x8fed87){exec('npm\x20install\x20--production',function(_0x77045f,_0x39d199,_0xd1b33f){logger[_0xf3ac('0x16')](_0x39d199);logger['info'](_0xd1b33f);if(_0x77045f){logger['error'](_0x77045f);return _0x8fed87['status'](0x1f4)['json'](_0x77045f);}return _0x8fed87['status'](0xc8)['json']({'output':_0x39d199});});};exports[_0xf3ac('0x20')]=function(_0x1dfc51,_0x49d3f1){return pm2['restart'](_0xf3ac('0x21'))[_0xf3ac('0x22')](function(_0x5b4c5d){logger[_0xf3ac('0x16')](_0xf3ac('0x23'),_0x5b4c5d);return _0x49d3f1[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x8227ee){logger[_0xf3ac('0x1c')](_0x8227ee);return _0x49d3f1[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x8227ee);});};exports[_0xf3ac('0x24')]=function(_0x553802,_0x43d265){var _0x4f5b99=fs['readdirSync'](path['join'](config[_0xf3ac('0xb')],_0xf3ac('0x25'),_0xf3ac('0x24')));var _0x5d25c7=[];for(var _0x5623fa=0x0;_0x5623fa<_0x4f5b99[_0xf3ac('0x26')];_0x5623fa++){var _0x4f9de2=_0x4f5b99[_0x5623fa][_0xf3ac('0x27')](_0xf3ac('0x28'),'');if(compareVersions(module[_0xf3ac('0x29')]['version'],_0x4f9de2)===-0x1){_0x5d25c7[_0xf3ac('0x2a')](_0x4f9de2);}}if(_0x5d25c7[_0xf3ac('0x26')]){var _0x4a005d=_0x5d25c7[_0xf3ac('0x2b')](compareVersions);var _0x172a19=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf3ac('0x2c')],'modelName':_0xf3ac('0x2c'),'columnName':_0xf3ac('0x10')},'migrations':{'params':[db[_0xf3ac('0x2d')]['getQueryInterface'](),db[_0xf3ac('0x2d')]['constructor'],function(){throw new Error(_0xf3ac('0x2e'));}],'path':path['join'](config[_0xf3ac('0xb')],_0xf3ac('0x25'),_0xf3ac('0x24')),'pattern':/\.js$/}});_0x172a19['up']({'migrations':_[_0xf3ac('0x2f')](_0x4a005d,function(_0x44b76b){return _0x44b76b+_0xf3ac('0x28');})})[_0xf3ac('0x22')](function(){return _0x43d265[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xf3ac('0x29')]['version']+_0xf3ac('0x30')+_[_0xf3ac('0x31')](_0x4a005d),'migrations':_[_0xf3ac('0x32')](_0x4a005d)});})[_0xf3ac('0x33')](function(_0x2a454d){if(_0x2a454d instanceof db[_0xf3ac('0x2d')][_0xf3ac('0x34')]){return _0x43d265['status'](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x35')});}else{return _0x43d265['status'](0x1f4)[_0xf3ac('0x13')](_0x2a454d);}});}else{return _0x43d265[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4fab181..19e4297 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 _0xe4e9=['get','/:id','show','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','/describe'];(function(_0x465253,_0x4cdd56){var _0x284de0=function(_0x456689){while(--_0x456689){_0x465253['push'](_0x465253['shift']());}};_0x284de0(++_0x4cdd56);}(_0xe4e9,0x16e));var _0x9e4e=function(_0x49b86e,_0x579b27){_0x49b86e=_0x49b86e-0x0;var _0x18d363=_0xe4e9[_0x49b86e];return _0x18d363;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e4e('0x0'));var timeout=require(_0x9e4e('0x1'));var express=require(_0x9e4e('0x2'));var router=express[_0x9e4e('0x3')]();var fs_extra=require(_0x9e4e('0x4'));var auth=require(_0x9e4e('0x5'));var interaction=require(_0x9e4e('0x6'));var config=require(_0x9e4e('0x7'));var controller=require(_0x9e4e('0x8'));router['get']('/',auth[_0x9e4e('0x9')](),controller[_0x9e4e('0xa')]);router['get'](_0x9e4e('0xb'),auth[_0x9e4e('0x9')](),controller['describe']);router[_0x9e4e('0xc')](_0x9e4e('0xd'),auth[_0x9e4e('0x9')](),controller[_0x9e4e('0xe')]);router['post']('/',auth[_0x9e4e('0x9')](),controller['create']);router['put'](_0x9e4e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9e4e('0xf')]('/:id',auth[_0x9e4e('0x9')](),controller[_0x9e4e('0x10')]);module[_0x9e4e('0x11')]=router; \ No newline at end of file +var _0x44df=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x2978c1,_0x428ef3){var _0x244298=function(_0x12e8ac){while(--_0x12e8ac){_0x2978c1['push'](_0x2978c1['shift']());}};_0x244298(++_0x428ef3);}(_0x44df,0x16a));var _0xf44d=function(_0x55305a,_0x387c32){_0x55305a=_0x55305a-0x0;var _0x24db5d=_0x44df[_0x55305a];return _0x24db5d;};'use strict';var multer=require(_0xf44d('0x0'));var util=require('util');var path=require(_0xf44d('0x1'));var timeout=require(_0xf44d('0x2'));var express=require(_0xf44d('0x3'));var router=express[_0xf44d('0x4')]();var fs_extra=require(_0xf44d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf44d('0x6'));var config=require(_0xf44d('0x7'));var controller=require(_0xf44d('0x8'));router[_0xf44d('0x9')]('/',auth[_0xf44d('0xa')](),controller['index']);router['get'](_0xf44d('0xb'),auth['isAuthenticated'](),controller[_0xf44d('0xc')]);router[_0xf44d('0x9')](_0xf44d('0xd'),auth[_0xf44d('0xa')](),controller[_0xf44d('0xe')]);router[_0xf44d('0xf')]('/',auth[_0xf44d('0xa')](),controller[_0xf44d('0x10')]);router[_0xf44d('0x11')](_0xf44d('0xd'),auth[_0xf44d('0xa')](),controller['update']);router[_0xf44d('0x12')]('/:id',auth[_0xf44d('0xa')](),controller['destroy']);module[_0xf44d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9b835fc..94df0bb 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 _0x777d=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x46c415,_0x442b74){var _0x2d854d=function(_0x568b01){while(--_0x568b01){_0x46c415['push'](_0x46c415['shift']());}};_0x2d854d(++_0x442b74);}(_0x777d,0xe9));var _0xd777=function(_0xc2c0c3,_0x2bf8a9){_0xc2c0c3=_0xc2c0c3-0x0;var _0x292acf=_0x777d[_0xc2c0c3];return _0x292acf;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'type':{'type':Sequelize[_0xd777('0x1')]},'uniqueid':{'type':Sequelize[_0xd777('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd777('0x1')]},'queue':{'type':Sequelize[_0xd777('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd777('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd777('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd777('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd777('0x3')]},'agentacw':{'type':Sequelize[_0xd777('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd777('0x3')]},'reason':{'type':Sequelize[_0xd777('0x1')]},'lastevent':{'type':Sequelize[_0xd777('0x1')]},'channel':{'type':Sequelize[_0xd777('0x1')]},'channelstate':{'type':Sequelize[_0xd777('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd777('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd777('0x1')]},'connectedlinename':{'type':Sequelize[_0xd777('0x1')]},'language':{'type':Sequelize[_0xd777('0x1')]},'accountcode':{'type':Sequelize[_0xd777('0x1')]},'context':{'type':Sequelize[_0xd777('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd777('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd777('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd777('0x1')]},'destcalleridname':{'type':Sequelize[_0xd777('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd777('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd777('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd777('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd777('0x1')]},'destpriority':{'type':Sequelize[_0xd777('0x1')]},'destuniqueid':{'type':Sequelize[_0xd777('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd777('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd777('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd777('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd777('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd777('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2da=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x3c974f,_0x33a7db){var _0x157515=function(_0x504eb8){while(--_0x504eb8){_0x3c974f['push'](_0x3c974f['shift']());}};_0x157515(++_0x33a7db);}(_0xc2da,0x124));var _0xac2d=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xc2da[_0x25f3e3];return _0xa89b6d;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'type':{'type':Sequelize[_0xac2d('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac2d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xac2d('0x1')]},'interface':{'type':Sequelize[_0xac2d('0x1')]},'membername':{'type':Sequelize[_0xac2d('0x1')]},'agentcalledAt':{'type':Sequelize[_0xac2d('0x2')]},'agentconnectAt':{'type':Sequelize[_0xac2d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xac2d('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xac2d('0x2')]},'agentdumpAt':{'type':Sequelize[_0xac2d('0x2')]},'holdtime':{'type':Sequelize[_0xac2d('0x3')]},'agentcomplete':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xac2d('0x1')]},'lastevent':{'type':Sequelize[_0xac2d('0x1')]},'channel':{'type':Sequelize[_0xac2d('0x1')]},'channelstate':{'type':Sequelize[_0xac2d('0x3')]},'channelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac2d('0x1')]},'context':{'type':Sequelize[_0xac2d('0x1')]},'exten':{'type':Sequelize[_0xac2d('0x1')]},'priority':{'type':Sequelize[_0xac2d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xac2d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridname':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xac2d('0x1')]},'destlanguage':{'type':Sequelize[_0xac2d('0x1')]},'destaccountcode':{'type':Sequelize[_0xac2d('0x1')]},'destcontext':{'type':Sequelize[_0xac2d('0x1')]},'destexten':{'type':Sequelize[_0xac2d('0x1')]},'destpriority':{'type':Sequelize[_0xac2d('0x1')]},'destuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xac2d('0x1')]},'transfer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xac2d('0x5')},'transferexten':{'type':Sequelize[_0xac2d('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac2d('0x3')],'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 c93a132..d9657c7 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 ba54a7f..b9c20ae 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 _0x938d=['report_agent','uniqueid','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x435f5c,_0x2826d5){var _0x3e2360=function(_0x4d2630){while(--_0x4d2630){_0x435f5c['push'](_0x435f5c['shift']());}};_0x3e2360(++_0x2826d5);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var logger=require('../../config/logger')(_0xd938('0x2'));var moment=require(_0xd938('0x3'));var BPromise=require(_0xd938('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd938('0x5'));var config=require(_0xd938('0x6'));var attributes=require(_0xd938('0x7'));module['exports']=function(_0x3a81d2,_0xb5e113){return _0x3a81d2[_0xd938('0x8')](_0xd938('0x9'),attributes,{'tableName':_0xd938('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd938('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc59=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e5b6d,_0x4ffca4){var _0x18e719=function(_0x1dd192){while(--_0x1dd192){_0x1e5b6d['push'](_0x1e5b6d['shift']());}};_0x18e719(++_0x4ffca4);}(_0xdc59,0x12c));var _0x9dc5=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdc59[_0x2261ce];return _0x524640;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9dc5('0x3'));var rp=require(_0x9dc5('0x4'));var fs=require('fs');var path=require(_0x9dc5('0x5'));var rimraf=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var attributes=require(_0x9dc5('0x8'));module[_0x9dc5('0x9')]=function(_0xf17598,_0x13e31c){return _0xf17598['define'](_0x9dc5('0xa'),attributes,{'tableName':_0x9dc5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9dc5('0xc'),_0x9dc5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cc7f48a..9c50db5 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 _0x7a08=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a08,0x14c));var _0x87a0=function(_0x4be6f4,_0x385b23){_0x4be6f4=_0x4be6f4-0x0;var _0x3e9098=_0x7a08[_0x4be6f4];return _0x3e9098;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var moment=require(_0x87a0('0x2'));var BPromise=require(_0x87a0('0x3'));var rs=require(_0x87a0('0x4'));var fs=require('fs');var Redis=require(_0x87a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x87a0('0x6'));var logger=require(_0x87a0('0x7'))(_0x87a0('0x8'));var config=require(_0x87a0('0x9'));var jayson=require(_0x87a0('0xa'));var client=jayson['client'][_0x87a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4296ed,_0x54fc18,_0x268a9a){return new BPromise(function(_0x4394c9,_0x3359b8){return client[_0x87a0('0xc')](_0x4296ed,_0x268a9a)[_0x87a0('0xd')](function(_0x543bb6){logger[_0x87a0('0xe')](_0x87a0('0xf'),_0x54fc18,_0x87a0('0x10'));logger[_0x87a0('0x11')](_0x87a0('0x12'),_0x54fc18,_0x87a0('0x10'),JSON[_0x87a0('0x13')](_0x543bb6));if(_0x543bb6[_0x87a0('0x14')]){if(_0x543bb6[_0x87a0('0x14')][_0x87a0('0x15')]===0x1f4){logger[_0x87a0('0x14')](_0x87a0('0xf'),_0x54fc18,_0x543bb6[_0x87a0('0x14')][_0x87a0('0x16')]);return _0x3359b8(_0x543bb6['error'][_0x87a0('0x16')]);}logger[_0x87a0('0x14')](_0x87a0('0xf'),_0x54fc18,_0x543bb6[_0x87a0('0x14')][_0x87a0('0x16')]);return _0x4394c9(_0x543bb6[_0x87a0('0x14')][_0x87a0('0x16')]);}else{logger['info'](_0x87a0('0xf'),_0x54fc18,_0x87a0('0x10'));_0x4394c9(_0x543bb6['result'][_0x87a0('0x16')]);}})[_0x87a0('0x17')](function(_0x42f9b5){logger['error'](_0x87a0('0xf'),_0x54fc18,_0x42f9b5);_0x3359b8(_0x42f9b5);});});}exports['CreateVoiceAgentReport']=function(_0x420e1a){var _0x2f1d62=this;return new Promise(function(_0xcd179,_0x2f2350){return db['VoiceAgentReport'][_0x87a0('0x18')](_0x420e1a[_0x87a0('0x19')],{'raw':_0x420e1a[_0x87a0('0x1a')]?_0x420e1a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d03f9){logger['info'](_0x87a0('0x1b'),_0x420e1a);logger[_0x87a0('0x11')](_0x87a0('0x1b'),_0x420e1a,JSON[_0x87a0('0x13')](_0x5d03f9));_0xcd179(_0x5d03f9);})[_0x87a0('0x17')](function(_0xe31053){logger['error'](_0x87a0('0x1b'),_0xe31053[_0x87a0('0x16')],_0x420e1a);_0x2f2350(_0x2f1d62['error'](0x1f4,_0xe31053['message']));});});};exports[_0x87a0('0x1c')]=function(_0x4819dd){var _0x2b1af3=this;return new Promise(function(_0x52b9a2,_0xf4227b){return db['VoiceAgentReport'][_0x87a0('0x1d')](_0x4819dd[_0x87a0('0x19')],{'raw':_0x4819dd[_0x87a0('0x1a')]?_0x4819dd[_0x87a0('0x1a')][_0x87a0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4819dd['options']?_0x4819dd[_0x87a0('0x1a')][_0x87a0('0x1f')]||null:null,'attributes':_0x4819dd[_0x87a0('0x1a')]?_0x4819dd['options']['attributes']||null:null,'limit':_0x4819dd[_0x87a0('0x1a')]?_0x4819dd[_0x87a0('0x1a')][_0x87a0('0x20')]||null:null})[_0x87a0('0xd')](function(_0x519ec1){logger[_0x87a0('0xe')](_0x87a0('0x1c'),_0x4819dd);logger[_0x87a0('0x11')](_0x87a0('0x1c'),_0x4819dd,JSON['stringify'](_0x519ec1));_0x52b9a2(_0x519ec1);})['catch'](function(_0x4f8f1e){logger[_0x87a0('0x14')](_0x87a0('0x1c'),_0x4f8f1e['message'],_0x4819dd);_0xf4227b(_0x2b1af3[_0x87a0('0x14')](0x1f4,_0x4f8f1e['message']));});});}; \ No newline at end of file +var _0x5d80=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','then','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0x5d80,0x1c1));var _0x05d8=function(_0x3d0ae6,_0x4ced2c){_0x3d0ae6=_0x3d0ae6-0x0;var _0x16a82b=_0x5d80[_0x3d0ae6];return _0x16a82b;};'use strict';var _=require(_0x05d8('0x0'));var util=require(_0x05d8('0x1'));var moment=require(_0x05d8('0x2'));var BPromise=require(_0x05d8('0x3'));var rs=require(_0x05d8('0x4'));var fs=require('fs');var Redis=require(_0x05d8('0x5'));var db=require(_0x05d8('0x6'))['db'];var utils=require(_0x05d8('0x7'));var logger=require(_0x05d8('0x8'))(_0x05d8('0x9'));var config=require(_0x05d8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05d8('0xb')][_0x05d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2de0cc,_0x12e11b,_0x5b29dd){return new BPromise(function(_0x44f643,_0x73b892){return client[_0x05d8('0xd')](_0x2de0cc,_0x5b29dd)['then'](function(_0x52d57f){logger[_0x05d8('0xe')](_0x05d8('0xf'),_0x12e11b,'request\x20sent');logger[_0x05d8('0x10')](_0x05d8('0x11'),_0x12e11b,_0x05d8('0x12'),JSON[_0x05d8('0x13')](_0x52d57f));if(_0x52d57f['error']){if(_0x52d57f[_0x05d8('0x14')][_0x05d8('0x15')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x12e11b,_0x52d57f['error'][_0x05d8('0x16')]);return _0x73b892(_0x52d57f[_0x05d8('0x14')]['message']);}logger[_0x05d8('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x12e11b,_0x52d57f['error'][_0x05d8('0x16')]);return _0x44f643(_0x52d57f[_0x05d8('0x14')][_0x05d8('0x16')]);}else{logger[_0x05d8('0xe')](_0x05d8('0xf'),_0x12e11b,_0x05d8('0x12'));_0x44f643(_0x52d57f[_0x05d8('0x17')][_0x05d8('0x16')]);}})[_0x05d8('0x18')](function(_0x3dcb72){logger[_0x05d8('0x14')](_0x05d8('0xf'),_0x12e11b,_0x3dcb72);_0x73b892(_0x3dcb72);});});}exports[_0x05d8('0x19')]=function(_0x21a3c8){var _0x1c8fd0=this;return new Promise(function(_0x4f8196,_0x42413c){return db[_0x05d8('0x1a')][_0x05d8('0x1b')](_0x21a3c8['body'],{'raw':_0x21a3c8[_0x05d8('0x1c')]?_0x21a3c8[_0x05d8('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x05d8('0x1d')](function(_0x30dab4){logger[_0x05d8('0xe')]('CreateVoiceAgentReport',_0x21a3c8);logger['debug'](_0x05d8('0x19'),_0x21a3c8,JSON['stringify'](_0x30dab4));_0x4f8196(_0x30dab4);})[_0x05d8('0x18')](function(_0x284f9d){logger[_0x05d8('0x14')]('CreateVoiceAgentReport',_0x284f9d[_0x05d8('0x16')],_0x21a3c8);_0x42413c(_0x1c8fd0[_0x05d8('0x14')](0x1f4,_0x284f9d[_0x05d8('0x16')]));});});};exports['UpdateVoiceAgentReport']=function(_0x309149){var _0x53782c=this;return new Promise(function(_0x9e09e2,_0x457db2){return db[_0x05d8('0x1a')][_0x05d8('0x1e')](_0x309149['body'],{'raw':_0x309149[_0x05d8('0x1c')]?_0x309149['options'][_0x05d8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309149[_0x05d8('0x1c')]?_0x309149['options'][_0x05d8('0x20')]||null:null,'attributes':_0x309149['options']?_0x309149['options'][_0x05d8('0x21')]||null:null,'limit':_0x309149[_0x05d8('0x1c')]?_0x309149[_0x05d8('0x1c')][_0x05d8('0x22')]||null:null})[_0x05d8('0x1d')](function(_0x58be49){logger['info'](_0x05d8('0x23'),_0x309149);logger[_0x05d8('0x10')](_0x05d8('0x23'),_0x309149,JSON[_0x05d8('0x13')](_0x58be49));_0x9e09e2(_0x58be49);})[_0x05d8('0x18')](function(_0x20d025){logger['error'](_0x05d8('0x23'),_0x20d025[_0x05d8('0x16')],_0x309149);_0x457db2(_0x53782c[_0x05d8('0x14')](0x1f4,_0x20d025['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 34a7a72..4d07d13 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 _0x81bd=['../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56f84a,_0x177f5c){var _0x1787b2=function(_0x25d335){while(--_0x25d335){_0x56f84a['push'](_0x56f84a['shift']());}};_0x1787b2(++_0x177f5c);}(_0x81bd,0x7c));var _0xd81b=function(_0x8cfd08,_0x656b39){_0x8cfd08=_0x8cfd08-0x0;var _0x1c6452=_0x81bd[_0x8cfd08];return _0x1c6452;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['get'](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);router[_0xd81b('0x14')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller['destroy']);module[_0xd81b('0x15')]=router; \ No newline at end of file +var _0x25fa=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceCallReport.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x25fa,0x109));var _0xa25f=function(_0x22e5c3,_0x408ba4){_0x22e5c3=_0x22e5c3-0x0;var _0x5c6c76=_0x25fa[_0x22e5c3];return _0x5c6c76;};'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('0xd')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0xe')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xf')]);router['delete'](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['destroy']);module[_0xa25f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4b6a937..7133a3d 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 _0xef0b=['DATE','INTEGER','sequelize','STRING','inbound','internal','inbound-fax'];(function(_0x33c266,_0x341fc0){var _0x2ac2ff=function(_0x6aa9fc){while(--_0x6aa9fc){_0x33c266['push'](_0x33c266['shift']());}};_0x2ac2ff(++_0x341fc0);}(_0xef0b,0x1d7));var _0xbef0=function(_0x530255,_0x435e1b){_0x530255=_0x530255-0x0;var _0x2bacfc=_0xef0b[_0x530255];return _0x2bacfc;};'use strict';var Sequelize=require(_0xbef0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbef0('0x1')]},'type':{'type':Sequelize['ENUM'](_0xbef0('0x2'),_0xbef0('0x3'),'outbound',_0xbef0('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xbef0('0x1')]},'accountcode':{'type':Sequelize[_0xbef0('0x1')]},'source':{'type':Sequelize[_0xbef0('0x1')]},'destination':{'type':Sequelize[_0xbef0('0x1')]},'destinationcontext':{'type':Sequelize[_0xbef0('0x1')]},'callerid':{'type':Sequelize[_0xbef0('0x1')]},'channel':{'type':Sequelize[_0xbef0('0x1')]},'destinationchannel':{'type':Sequelize[_0xbef0('0x1')]},'lastapplication':{'type':Sequelize[_0xbef0('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbef0('0x5')]},'systemanswertime':{'type':Sequelize[_0xbef0('0x5')]},'answertime':{'type':Sequelize[_0xbef0('0x5')]},'endtime':{'type':Sequelize[_0xbef0('0x5')]},'duration':{'type':Sequelize[_0xbef0('0x6')]},'billableseconds':{'type':Sequelize[_0xbef0('0x6')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xbef0('0x1')]},'userfield':{'type':Sequelize[_0xbef0('0x1')]},'userDisposition':{'type':Sequelize[_0xbef0('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xbef0('0x1')]},'note':{'type':Sequelize[_0xbef0('0x1')]},'prefix':{'type':Sequelize[_0xbef0('0x1')]},'routeid':{'type':Sequelize[_0xbef0('0x6')]},'sipcallid':{'type':Sequelize[_0xbef0('0x1')]}}; \ No newline at end of file +var _0x2b84=['ENUM','inbound','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2b84,0x1ed));var _0x42b8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2b84[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x42b8('0x0'));module[_0x42b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x42b8('0x2')](_0x42b8('0x3'),_0x42b8('0x4'),'outbound',_0x42b8('0x5'),'outbound-fax',_0x42b8('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x42b8('0x7')]},'source':{'type':Sequelize[_0x42b8('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x42b8('0x7')]},'channel':{'type':Sequelize[_0x42b8('0x7')]},'destinationchannel':{'type':Sequelize[_0x42b8('0x7')]},'lastapplication':{'type':Sequelize[_0x42b8('0x7')]},'lastdata':{'type':Sequelize[_0x42b8('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x42b8('0x9')]},'answertime':{'type':Sequelize[_0x42b8('0x9')]},'endtime':{'type':Sequelize[_0x42b8('0x9')]},'duration':{'type':Sequelize[_0x42b8('0xa')]},'billableseconds':{'type':Sequelize[_0x42b8('0xa')]},'mohtime':{'type':Sequelize[_0x42b8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x42b8('0x7')]},'amaflags':{'type':Sequelize[_0x42b8('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x42b8('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x42b8('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x42b8('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7c513c9..cf854b9 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','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','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x2ef3,0xba));var _0x32ef=function(_0xdf0ad1,_0x572a33){_0xdf0ad1=_0xdf0ad1-0x0;var _0x55a740=_0x2ef3[_0xdf0ad1];return _0x55a740;};'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);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,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(_0x1dc249,_0x2932fe){var _0x14ef44=function(_0x6138cc){while(--_0x6138cc){_0x1dc249['push'](_0x1dc249['shift']());}};_0x14ef44(++_0x2932fe);}(_0x0b0e,0x187));var _0xe0b0=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x0b0e[_0x522ae8];return _0x3189b9;};'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 f5b4b9c..9178b1e 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 _0x374b=['report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x39e5b4,_0x2490c0){var _0x868736=function(_0x282159){while(--_0x282159){_0x39e5b4['push'](_0x39e5b4['shift']());}};_0x868736(++_0x2490c0);}(_0x374b,0x1ec));var _0xb374=function(_0x166efa,_0x28935b){_0x166efa=_0x166efa-0x0;var _0x5c1679=_0x374b[_0x166efa];return _0x5c1679;};'use strict';var _=require(_0xb374('0x0'));var util=require(_0xb374('0x1'));var logger=require(_0xb374('0x2'))(_0xb374('0x3'));var moment=require(_0xb374('0x4'));var BPromise=require(_0xb374('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb374('0x6'));var rimraf=require(_0xb374('0x7'));var config=require('../../config/environment');var attributes=require(_0xb374('0x8'));module[_0xb374('0x9')]=function(_0x54110b,_0x1f4bba){return _0x54110b[_0xb374('0xa')](_0xb374('0xb'),attributes,{'tableName':_0xb374('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb374('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf71b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x55a4ca,_0x59f293){var _0x4bc165=function(_0x22eac9){while(--_0x22eac9){_0x55a4ca['push'](_0x55a4ca['shift']());}};_0x4bc165(++_0x59f293);}(_0xf71b,0x8e));var _0xbf71=function(_0x3bff3a,_0x43d4af){_0x3bff3a=_0x3bff3a-0x0;var _0x2e9271=_0xf71b[_0x3bff3a];return _0x2e9271;};'use strict';var _=require(_0xbf71('0x0'));var util=require(_0xbf71('0x1'));var logger=require(_0xbf71('0x2'))(_0xbf71('0x3'));var moment=require(_0xbf71('0x4'));var BPromise=require(_0xbf71('0x5'));var rp=require(_0xbf71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf71('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf71('0x8'));module[_0xbf71('0x9')]=function(_0x1db098,_0x5e7bd8){return _0x1db098[_0xbf71('0xa')](_0xbf71('0xb'),attributes,{'tableName':_0xbf71('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6feeb36..15b4891 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 _0x2c4c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceCallReport','options','where','attributes','limit','include','map','model','then','info','catch','CreateVoiceCallReport','VoiceCallReport','create','raw','update','UpdateVoiceCallReport','util','moment','bluebird','randomstring'];(function(_0x2b373c,_0x335e5b){var _0x39d4fd=function(_0x21fa45){while(--_0x21fa45){_0x2b373c['push'](_0x2b373c['shift']());}};_0x39d4fd(++_0x335e5b);}(_0x2c4c,0x193));var _0xc2c4=function(_0x1e440c,_0x3b2ca5){_0x1e440c=_0x1e440c-0x0;var _0x3cfab5=_0x2c4c[_0x1e440c];return _0x3cfab5;};'use strict';var _=require('lodash');var util=require(_0xc2c4('0x0'));var moment=require(_0xc2c4('0x1'));var BPromise=require(_0xc2c4('0x2'));var rs=require(_0xc2c4('0x3'));var fs=require('fs');var Redis=require(_0xc2c4('0x4'));var db=require(_0xc2c4('0x5'))['db'];var utils=require(_0xc2c4('0x6'));var logger=require(_0xc2c4('0x7'))(_0xc2c4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2c4('0x9'));var client=jayson['client'][_0xc2c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x186ea5,_0x37b4c1,_0x2995e1){return new BPromise(function(_0x50e3d1,_0x78da07){return client[_0xc2c4('0xb')](_0x186ea5,_0x2995e1)['then'](function(_0x4f0f96){logger['info'](_0xc2c4('0xc'),_0x37b4c1,_0xc2c4('0xd'));logger[_0xc2c4('0xe')](_0xc2c4('0xf'),_0x37b4c1,_0xc2c4('0xd'),JSON[_0xc2c4('0x10')](_0x4f0f96));if(_0x4f0f96[_0xc2c4('0x11')]){if(_0x4f0f96[_0xc2c4('0x11')][_0xc2c4('0x12')]===0x1f4){logger[_0xc2c4('0x11')](_0xc2c4('0xc'),_0x37b4c1,_0x4f0f96[_0xc2c4('0x11')][_0xc2c4('0x13')]);return _0x78da07(_0x4f0f96[_0xc2c4('0x11')]['message']);}logger[_0xc2c4('0x11')](_0xc2c4('0xc'),_0x37b4c1,_0x4f0f96[_0xc2c4('0x11')]['message']);return _0x50e3d1(_0x4f0f96[_0xc2c4('0x11')]['message']);}else{logger['info'](_0xc2c4('0xc'),_0x37b4c1,_0xc2c4('0xd'));_0x50e3d1(_0x4f0f96['result'][_0xc2c4('0x13')]);}})['catch'](function(_0x26ea4d){logger[_0xc2c4('0x11')](_0xc2c4('0xc'),_0x37b4c1,_0x26ea4d);_0x78da07(_0x26ea4d);});});}exports[_0xc2c4('0x14')]=function(_0x13acb4){var _0xeb38c2=this;return new Promise(function(_0x110190,_0x14466a){return db['VoiceCallReport']['findAll']({'raw':_0x13acb4[_0xc2c4('0x15')]?_0x13acb4[_0xc2c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x13acb4['options']?_0x13acb4[_0xc2c4('0x15')][_0xc2c4('0x16')]||null:null,'attributes':_0x13acb4[_0xc2c4('0x15')]?_0x13acb4[_0xc2c4('0x15')][_0xc2c4('0x17')]||null:null,'limit':_0x13acb4[_0xc2c4('0x15')]?_0x13acb4[_0xc2c4('0x15')][_0xc2c4('0x18')]||null:null,'include':_0x13acb4[_0xc2c4('0x15')]?_0x13acb4[_0xc2c4('0x15')][_0xc2c4('0x19')]?_[_0xc2c4('0x1a')](_0x13acb4[_0xc2c4('0x15')][_0xc2c4('0x19')],function(_0x4831cc){return{'model':db[_0x4831cc[_0xc2c4('0x1b')]],'as':_0x4831cc['as'],'attributes':_0x4831cc[_0xc2c4('0x17')],'include':_0x4831cc['include']?_[_0xc2c4('0x1a')](_0x4831cc[_0xc2c4('0x19')],function(_0x2359da){return{'model':db[_0x2359da[_0xc2c4('0x1b')]],'as':_0x2359da['as'],'attributes':_0x2359da['attributes'],'include':_0x2359da[_0xc2c4('0x19')]?_[_0xc2c4('0x1a')](_0x2359da[_0xc2c4('0x19')],function(_0x31742f){return{'model':db[_0x31742f[_0xc2c4('0x1b')]],'as':_0x31742f['as'],'attributes':_0x31742f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2c4('0x1c')](function(_0x120f58){logger[_0xc2c4('0x1d')](_0xc2c4('0x14'),_0x13acb4);logger[_0xc2c4('0xe')](_0xc2c4('0x14'),_0x13acb4,JSON[_0xc2c4('0x10')](_0x120f58));_0x110190(_0x120f58);})[_0xc2c4('0x1e')](function(_0x3d640f){logger['error'](_0xc2c4('0x14'),_0x3d640f[_0xc2c4('0x13')],_0x13acb4);_0x14466a(_0xeb38c2[_0xc2c4('0x11')](0x1f4,_0x3d640f['message']));});});};exports[_0xc2c4('0x1f')]=function(_0x301e21){var _0x5453e0=this;return new Promise(function(_0x53f83d,_0x444111){return db[_0xc2c4('0x20')][_0xc2c4('0x21')](_0x301e21['body'],{'raw':_0x301e21[_0xc2c4('0x15')]?_0x301e21[_0xc2c4('0x15')][_0xc2c4('0x22')]===undefined?!![]:![]:!![]})[_0xc2c4('0x1c')](function(_0x4b7df3){logger[_0xc2c4('0x1d')]('CreateVoiceCallReport',_0x301e21);logger[_0xc2c4('0xe')]('CreateVoiceCallReport',_0x301e21,JSON[_0xc2c4('0x10')](_0x4b7df3));_0x53f83d(_0x4b7df3);})[_0xc2c4('0x1e')](function(_0x4d9e4a){logger[_0xc2c4('0x11')](_0xc2c4('0x1f'),_0x4d9e4a['message'],_0x301e21);_0x444111(_0x5453e0[_0xc2c4('0x11')](0x1f4,_0x4d9e4a[_0xc2c4('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x196789){var _0x4bfba7=this;return new Promise(function(_0x505212,_0x1bbd40){return db[_0xc2c4('0x20')][_0xc2c4('0x23')](_0x196789['body'],{'raw':_0x196789['options']?_0x196789[_0xc2c4('0x15')][_0xc2c4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196789[_0xc2c4('0x15')]?_0x196789[_0xc2c4('0x15')][_0xc2c4('0x16')]||null:null,'attributes':_0x196789['options']?_0x196789[_0xc2c4('0x15')][_0xc2c4('0x17')]||null:null,'limit':_0x196789[_0xc2c4('0x15')]?_0x196789[_0xc2c4('0x15')][_0xc2c4('0x18')]||null:null})[_0xc2c4('0x1c')](function(_0x39cacf){logger[_0xc2c4('0x1d')](_0xc2c4('0x24'),_0x196789);logger[_0xc2c4('0xe')](_0xc2c4('0x24'),_0x196789,JSON[_0xc2c4('0x10')](_0x39cacf));_0x505212(_0x39cacf);})[_0xc2c4('0x1e')](function(_0x314714){logger[_0xc2c4('0x11')](_0xc2c4('0x24'),_0x314714['message'],_0x196789);_0x1bbd40(_0x4bfba7[_0xc2c4('0x11')](0x1f4,_0x314714[_0xc2c4('0x13')]));});});}; \ No newline at end of file +var _0x4841=['catch','GetVoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0xc905e2,_0x3202e4){var _0x3c7028=function(_0x56b5cf){while(--_0x56b5cf){_0xc905e2['push'](_0xc905e2['shift']());}};_0x3c7028(++_0x3202e4);}(_0x4841,0x1e4));var _0x1484=function(_0x4d15ff,_0x219f04){_0x4d15ff=_0x4d15ff-0x0;var _0x4bfacc=_0x4841[_0x4d15ff];return _0x4bfacc;};'use strict';var _=require('lodash');var util=require(_0x1484('0x0'));var moment=require('moment');var BPromise=require(_0x1484('0x1'));var rs=require(_0x1484('0x2'));var fs=require('fs');var Redis=require(_0x1484('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1484('0x4'));var logger=require(_0x1484('0x5'))(_0x1484('0x6'));var config=require(_0x1484('0x7'));var jayson=require(_0x1484('0x8'));var client=jayson[_0x1484('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8ec2,_0x5d218d,_0x2ebf54){return new BPromise(function(_0x4b94cc,_0x470028){return client['request'](_0x2c8ec2,_0x2ebf54)[_0x1484('0xa')](function(_0x56f811){logger[_0x1484('0xb')](_0x1484('0xc'),_0x5d218d,'request\x20sent');logger[_0x1484('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5d218d,_0x1484('0xe'),JSON[_0x1484('0xf')](_0x56f811));if(_0x56f811[_0x1484('0x10')]){if(_0x56f811['error'][_0x1484('0x11')]===0x1f4){logger['error'](_0x1484('0xc'),_0x5d218d,_0x56f811[_0x1484('0x10')][_0x1484('0x12')]);return _0x470028(_0x56f811['error']['message']);}logger[_0x1484('0x10')](_0x1484('0xc'),_0x5d218d,_0x56f811[_0x1484('0x10')][_0x1484('0x12')]);return _0x4b94cc(_0x56f811['error']['message']);}else{logger[_0x1484('0xb')](_0x1484('0xc'),_0x5d218d,_0x1484('0xe'));_0x4b94cc(_0x56f811[_0x1484('0x13')][_0x1484('0x12')]);}})[_0x1484('0x14')](function(_0x1387a5){logger[_0x1484('0x10')](_0x1484('0xc'),_0x5d218d,_0x1387a5);_0x470028(_0x1387a5);});});}exports[_0x1484('0x15')]=function(_0x23a93b){var _0x5e79b5=this;return new Promise(function(_0x25e0b9,_0x2afb3b){return db['VoiceCallReport'][_0x1484('0x16')]({'raw':_0x23a93b[_0x1484('0x17')]?_0x23a93b[_0x1484('0x17')][_0x1484('0x18')]===undefined?!![]:![]:!![],'where':_0x23a93b[_0x1484('0x17')]?_0x23a93b[_0x1484('0x17')][_0x1484('0x19')]||null:null,'attributes':_0x23a93b['options']?_0x23a93b['options'][_0x1484('0x1a')]||null:null,'limit':_0x23a93b[_0x1484('0x17')]?_0x23a93b['options']['limit']||null:null,'include':_0x23a93b['options']?_0x23a93b['options'][_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x23a93b[_0x1484('0x17')][_0x1484('0x1b')],function(_0x639577){return{'model':db[_0x639577[_0x1484('0x1d')]],'as':_0x639577['as'],'attributes':_0x639577[_0x1484('0x1a')],'include':_0x639577[_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x639577[_0x1484('0x1b')],function(_0x3bb6a6){return{'model':db[_0x3bb6a6[_0x1484('0x1d')]],'as':_0x3bb6a6['as'],'attributes':_0x3bb6a6[_0x1484('0x1a')],'include':_0x3bb6a6[_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x3bb6a6[_0x1484('0x1b')],function(_0x2053bd){return{'model':db[_0x2053bd['model']],'as':_0x2053bd['as'],'attributes':_0x2053bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1484('0xa')](function(_0x51e7e7){logger[_0x1484('0xb')](_0x1484('0x15'),_0x23a93b);logger[_0x1484('0xd')](_0x1484('0x15'),_0x23a93b,JSON[_0x1484('0xf')](_0x51e7e7));_0x25e0b9(_0x51e7e7);})[_0x1484('0x14')](function(_0x372045){logger[_0x1484('0x10')](_0x1484('0x15'),_0x372045['message'],_0x23a93b);_0x2afb3b(_0x5e79b5[_0x1484('0x10')](0x1f4,_0x372045[_0x1484('0x12')]));});});};exports[_0x1484('0x1e')]=function(_0x361833){var _0x38334f=this;return new Promise(function(_0x5d6ba9,_0x387a9d){return db[_0x1484('0x1f')][_0x1484('0x20')](_0x361833[_0x1484('0x21')],{'raw':_0x361833['options']?_0x361833[_0x1484('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b3520){logger[_0x1484('0xb')](_0x1484('0x1e'),_0x361833);logger[_0x1484('0xd')]('CreateVoiceCallReport',_0x361833,JSON[_0x1484('0xf')](_0x4b3520));_0x5d6ba9(_0x4b3520);})[_0x1484('0x14')](function(_0x15e1e4){logger['error'](_0x1484('0x1e'),_0x15e1e4[_0x1484('0x12')],_0x361833);_0x387a9d(_0x38334f[_0x1484('0x10')](0x1f4,_0x15e1e4[_0x1484('0x12')]));});});};exports[_0x1484('0x22')]=function(_0x33ef0b){var _0x24ca6f=this;return new Promise(function(_0x3c1377,_0x3f535a){return db[_0x1484('0x1f')][_0x1484('0x23')](_0x33ef0b[_0x1484('0x21')],{'raw':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ef0b['options']?_0x33ef0b[_0x1484('0x17')][_0x1484('0x19')]||null:null,'attributes':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')][_0x1484('0x1a')]||null:null,'limit':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')]['limit']||null:null})[_0x1484('0xa')](function(_0x36a6af){logger[_0x1484('0xb')](_0x1484('0x22'),_0x33ef0b);logger[_0x1484('0xd')](_0x1484('0x22'),_0x33ef0b,JSON[_0x1484('0xf')](_0x36a6af));_0x3c1377(_0x36a6af);})[_0x1484('0x14')](function(_0xba20ca){logger[_0x1484('0x10')]('UpdateVoiceCallReport',_0xba20ca[_0x1484('0x12')],_0x33ef0b);_0x3f535a(_0x24ca6f[_0x1484('0x10')](0x1f4,_0xba20ca[_0x1484('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 83f01f8..13a7f23 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 _0x1e0c=['../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','post','create','put','isAuthenticated','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x31772c,_0x37ac9b){var _0x176f7a=function(_0x37d83b){while(--_0x37d83b){_0x31772c['push'](_0x31772c['shift']());}};_0x176f7a(++_0x37ac9b);}(_0x1e0c,0x16a));var _0xc1e0=function(_0x9b28f3,_0x437bb5){_0x9b28f3=_0x9b28f3-0x0;var _0x160b10=_0x1e0c[_0x9b28f3];return _0x160b10;};'use strict';var multer=require(_0xc1e0('0x0'));var util=require('util');var path=require(_0xc1e0('0x1'));var timeout=require(_0xc1e0('0x2'));var express=require(_0xc1e0('0x3'));var router=express[_0xc1e0('0x4')]();var fs_extra=require(_0xc1e0('0x5'));var auth=require(_0xc1e0('0x6'));var interaction=require(_0xc1e0('0x7'));var config=require('../../config/environment');var controller=require(_0xc1e0('0x8'));router[_0xc1e0('0x9')]('/',auth['isAuthenticated'](),controller[_0xc1e0('0xa')]);router[_0xc1e0('0x9')](_0xc1e0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc1e0('0xc')]('/',auth['isAuthenticated'](),controller[_0xc1e0('0xd')]);router[_0xc1e0('0xe')](_0xc1e0('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc1e0('0xb'),auth[_0xc1e0('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf6e5=['create','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post'];(function(_0x41432b,_0x2b26da){var _0x401932=function(_0x3ed256){while(--_0x3ed256){_0x41432b['push'](_0x41432b['shift']());}};_0x401932(++_0x2b26da);}(_0xf6e5,0x112));var _0x5f6e=function(_0x1f179a,_0x92185c){_0x1f179a=_0x1f179a-0x0;var _0x3fc700=_0xf6e5[_0x1f179a];return _0x3fc700;};'use strict';var multer=require('multer');var util=require(_0x5f6e('0x0'));var path=require(_0x5f6e('0x1'));var timeout=require(_0x5f6e('0x2'));var express=require(_0x5f6e('0x3'));var router=express[_0x5f6e('0x4')]();var fs_extra=require(_0x5f6e('0x5'));var auth=require(_0x5f6e('0x6'));var interaction=require(_0x5f6e('0x7'));var config=require(_0x5f6e('0x8'));var controller=require(_0x5f6e('0x9'));router[_0x5f6e('0xa')]('/',auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xc')]);router[_0x5f6e('0xa')](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller['show']);router[_0x5f6e('0xe')]('/',auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xf')]);router['put'](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller['update']);router['delete'](_0x5f6e('0xd'),auth['isAuthenticated'](),controller[_0x5f6e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 279d568..947aa2e 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 _0xacfe=['getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options','join'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xacfe,0xc0));var _0xeacf=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xacfe[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require('sequelize');module[_0xeacf('0x0')]={'name':{'type':Sequelize[_0xeacf('0x1')]},'prefix':{'type':Sequelize[_0xeacf('0x1')],'unique':_0xeacf('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xeacf('0x1')],'set':function(_0x1d7c39){this[_0xeacf('0x3')](_0xeacf('0x4'),_0x1d7c39?_0x1d7c39[_0xeacf('0x5')](''):[]);},'get':function(){return this[_0xeacf('0x6')](_0xeacf('0x4'))?this[_0xeacf('0x6')](_0xeacf('0x4'))[_0xeacf('0x7')](''):[];}},'auth':{'type':Sequelize[_0xeacf('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xeacf('0x1')]},'record':{'type':Sequelize[_0xeacf('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeacf('0x1')]}}; \ No newline at end of file +var _0x112f=['join','getDataValue','split','BOOLEAN','sequelize','STRING','setDataValue','options'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x112f,0x7c));var _0xf112=function(_0x17fdde,_0x4b3717){_0x17fdde=_0x17fdde-0x0;var _0x4fd885=_0x112f[_0x17fdde];return _0x4fd885;};'use strict';var Sequelize=require(_0xf112('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xf112('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xf112('0x1')],'set':function(_0x4c243f){this[_0xf112('0x2')](_0xf112('0x3'),_0x4c243f?_0x4c243f[_0xf112('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xf112('0x3'))?this[_0xf112('0x5')](_0xf112('0x3'))[_0xf112('0x6')](''):[];}},'auth':{'type':Sequelize[_0xf112('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a92a8ad..1558bf1 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 _0xb6b8=['send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','VoiceChanSpy','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','then','get','ChanSpies','end','error','stack','name'];(function(_0x43f585,_0x3f8ba8){var _0x399005=function(_0x1e0027){while(--_0x1e0027){_0x43f585['push'](_0x43f585['shift']());}};_0x399005(++_0x3f8ba8);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x1291f6,_0x181881){_0x1291f6=_0x1291f6-0x0;var _0x19ce1c=_0xb6b8[_0x1291f6];return _0x19ce1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b6b('0x0'));var zipdir=require(_0x8b6b('0x1'));var jsonpatch=require(_0x8b6b('0x2'));var rp=require(_0x8b6b('0x3'));var moment=require(_0x8b6b('0x4'));var BPromise=require(_0x8b6b('0x5'));var Mustache=require('mustache');var util=require(_0x8b6b('0x6'));var path=require(_0x8b6b('0x7'));var sox=require(_0x8b6b('0x8'));var csv=require('to-csv');var ejs=require(_0x8b6b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8b6b('0xa'));var crypto=require(_0x8b6b('0xb'));var jsforce=require(_0x8b6b('0xc'));var deskjs=require(_0x8b6b('0xd'));var toCsv=require(_0x8b6b('0xe'));var querystring=require(_0x8b6b('0xf'));var Papa=require(_0x8b6b('0x10'));var Redis=require(_0x8b6b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b6b('0x12'));var logger=require(_0x8b6b('0x13'))(_0x8b6b('0x14'));var utils=require('../../config/utils');var config=require(_0x8b6b('0x15'));var licenseUtil=require(_0x8b6b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e21f7,_0x577d97){_0x577d97=_0x577d97||0xcc;return function(_0x2674e3){if(_0x2674e3){return _0x2e21f7[_0x8b6b('0x17')](_0x577d97);}return _0x2e21f7['status'](_0x577d97)['end']();};}function respondWithResult(_0x2ad72d,_0x4ba205){_0x4ba205=_0x4ba205||0xc8;return function(_0x352c14){if(_0x352c14){return _0x2ad72d[_0x8b6b('0x18')](_0x4ba205)[_0x8b6b('0x19')](_0x352c14);}};}function respondWithFilteredResult(_0x1dba91,_0x25f8a2){return function(_0x532da5){if(_0x532da5){var _0x3ffecc=typeof _0x25f8a2[_0x8b6b('0x1a')]===_0x8b6b('0x1b')&&typeof _0x25f8a2[_0x8b6b('0x1c')]===_0x8b6b('0x1b');var _0x23d56b=_0x532da5[_0x8b6b('0x1d')];var _0x4ab006=_0x3ffecc?0x0:_0x25f8a2[_0x8b6b('0x1a')];var _0x106b3f=_0x3ffecc?_0x532da5[_0x8b6b('0x1d')]:_0x25f8a2[_0x8b6b('0x1a')]+_0x25f8a2['limit'];var _0x3e40ef;if(_0x106b3f>=_0x23d56b){_0x106b3f=_0x23d56b;_0x3e40ef=0xc8;}else{_0x3e40ef=0xce;}_0x1dba91[_0x8b6b('0x18')](_0x3e40ef);return _0x1dba91['set']('Content-Range',_0x4ab006+'-'+_0x106b3f+'/'+_0x23d56b)[_0x8b6b('0x19')](_0x532da5);}return null;};}function patchUpdates(_0x1491a4){return function(_0x3ef39b){try{jsonpatch['apply'](_0x3ef39b,_0x1491a4,!![]);}catch(_0x1f0044){return BPromise[_0x8b6b('0x1e')](_0x1f0044);}return _0x3ef39b[_0x8b6b('0x1f')]();};}function saveUpdates(_0x47aaee,_0x2c10b9){return function(_0x153bc0){if(_0x153bc0){return _0x153bc0[_0x8b6b('0x20')](_0x47aaee)['then'](function(_0x5a0436){return _0x5a0436;});}return null;};}function removeEntity(_0x24221b,_0x47df9e){return function(_0x370318){if(_0x370318){return _0x370318['destroy']()[_0x8b6b('0x21')](function(){var _0x37ad03=_0x370318[_0x8b6b('0x22')]({'plain':!![]});var _0x2753fc=_0x8b6b('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2753fc,'resourceId':_0x37ad03['id']}})[_0x8b6b('0x21')](function(){return _0x370318;});})[_0x8b6b('0x21')](function(){_0x24221b[_0x8b6b('0x18')](0xcc)[_0x8b6b('0x24')]();});}};}function handleEntityNotFound(_0x2d3548,_0x37bbb4){return function(_0x4a6dae){if(!_0x4a6dae){_0x2d3548['sendStatus'](0x194);}return _0x4a6dae;};}function handleError(_0x43cdd4,_0x3798d1){_0x3798d1=_0x3798d1||0x1f4;return function(_0x211d4f){logger[_0x8b6b('0x25')](_0x211d4f[_0x8b6b('0x26')]);if(_0x211d4f[_0x8b6b('0x27')]){delete _0x211d4f[_0x8b6b('0x27')];}_0x43cdd4[_0x8b6b('0x18')](_0x3798d1)[_0x8b6b('0x28')](_0x211d4f);};}exports['index']=function(_0xaf735f,_0x3fe3ac){var _0x4b795d={},_0x453f81={},_0x39ee1b={'count':0x0,'rows':[]};var _0x365bf0=_[_0x8b6b('0x29')](db['VoiceChanSpy'][_0x8b6b('0x2a')],function(_0xf846ae){return{'name':_0xf846ae[_0x8b6b('0x2b')],'type':_0xf846ae[_0x8b6b('0x2c')][_0x8b6b('0x2d')]};});_0x453f81[_0x8b6b('0x2e')]=_[_0x8b6b('0x29')](_0x365bf0,_0x8b6b('0x27'));_0x453f81['query']=_[_0x8b6b('0x2f')](_0xaf735f[_0x8b6b('0x30')]);_0x453f81[_0x8b6b('0x31')]=_['intersection'](_0x453f81[_0x8b6b('0x2e')],_0x453f81[_0x8b6b('0x30')]);_0x4b795d[_0x8b6b('0x32')]=_[_0x8b6b('0x33')](_0x453f81['model'],qs[_0x8b6b('0x34')](_0xaf735f['query'][_0x8b6b('0x34')]));_0x4b795d[_0x8b6b('0x32')]=_0x4b795d[_0x8b6b('0x32')][_0x8b6b('0x35')]?_0x4b795d[_0x8b6b('0x32')]:_0x453f81[_0x8b6b('0x2e')];if(!_0xaf735f[_0x8b6b('0x30')][_0x8b6b('0x36')](_0x8b6b('0x37'))){_0x4b795d[_0x8b6b('0x1c')]=qs[_0x8b6b('0x1c')](_0xaf735f['query']['limit']);_0x4b795d[_0x8b6b('0x1a')]=qs[_0x8b6b('0x1a')](_0xaf735f[_0x8b6b('0x30')]['offset']);}_0x4b795d[_0x8b6b('0x38')]=qs['sort'](_0xaf735f[_0x8b6b('0x30')][_0x8b6b('0x39')]);_0x4b795d[_0x8b6b('0x3a')]=qs[_0x8b6b('0x31')](_['pick'](_0xaf735f[_0x8b6b('0x30')],_0x453f81[_0x8b6b('0x31')]),_0x365bf0);if(_0xaf735f[_0x8b6b('0x30')][_0x8b6b('0x3b')]){_0x4b795d[_0x8b6b('0x3a')]=_['merge'](_0x4b795d[_0x8b6b('0x3a')],{'$or':_[_0x8b6b('0x29')](_0x365bf0,function(_0x7154cc){if(_0x7154cc[_0x8b6b('0x2c')]!==_0x8b6b('0x3c')){var _0x5716d8={};_0x5716d8[_0x7154cc[_0x8b6b('0x27')]]={'$like':'%'+_0xaf735f[_0x8b6b('0x30')]['filter']+'%'};return _0x5716d8;}})});}_0x4b795d=_['merge']({},_0x4b795d,_0xaf735f['options']);var _0x24d5a2={'where':_0x4b795d['where']};return db[_0x8b6b('0x3d')]['count'](_0x24d5a2)[_0x8b6b('0x21')](function(_0x45a750){_0x39ee1b[_0x8b6b('0x1d')]=_0x45a750;if(_0xaf735f['query'][_0x8b6b('0x3e')]){_0x4b795d[_0x8b6b('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x4b795d);})['then'](function(_0x3e3b99){_0x39ee1b[_0x8b6b('0x40')]=_0x3e3b99;return _0x39ee1b;})['then'](respondWithFilteredResult(_0x3fe3ac,_0x4b795d))[_0x8b6b('0x41')](handleError(_0x3fe3ac,null));};exports[_0x8b6b('0x42')]=function(_0xce447d,_0x58ecc9){var _0x2a6213={'raw':![],'where':{'id':_0xce447d[_0x8b6b('0x43')]['id']}},_0x527f6a={};_0x527f6a['model']=_[_0x8b6b('0x2f')](db[_0x8b6b('0x3d')][_0x8b6b('0x2a')]);_0x527f6a[_0x8b6b('0x30')]=_[_0x8b6b('0x2f')](_0xce447d[_0x8b6b('0x30')]);_0x527f6a[_0x8b6b('0x31')]=_['intersection'](_0x527f6a[_0x8b6b('0x2e')],_0x527f6a['query']);_0x2a6213[_0x8b6b('0x32')]=_[_0x8b6b('0x33')](_0x527f6a[_0x8b6b('0x2e')],qs[_0x8b6b('0x34')](_0xce447d[_0x8b6b('0x30')][_0x8b6b('0x34')]));_0x2a6213[_0x8b6b('0x32')]=_0x2a6213[_0x8b6b('0x32')][_0x8b6b('0x35')]?_0x2a6213['attributes']:_0x527f6a[_0x8b6b('0x2e')];if(_0xce447d[_0x8b6b('0x30')][_0x8b6b('0x3e')]){_0x2a6213[_0x8b6b('0x3f')]=[{'all':!![]}];}_0x2a6213=_['merge']({},_0x2a6213,_0xce447d[_0x8b6b('0x44')]);return db[_0x8b6b('0x3d')][_0x8b6b('0x45')](_0x2a6213)[_0x8b6b('0x21')](handleEntityNotFound(_0x58ecc9,null))['then'](respondWithResult(_0x58ecc9,null))[_0x8b6b('0x41')](handleError(_0x58ecc9,null));};exports[_0x8b6b('0x46')]=function(_0x565c35,_0x4f4855){return db['VoiceChanSpy']['create'](_0x565c35[_0x8b6b('0x47')],{})[_0x8b6b('0x21')](function(_0x3b4235){var _0x58e9b6=_0x565c35[_0x8b6b('0x48')][_0x8b6b('0x22')]({'plain':!![]});if(!_0x58e9b6)throw new Error(_0x8b6b('0x49'));if(_0x58e9b6['role']===_0x8b6b('0x48')){var _0x1ceccd=_0x3b4235[_0x8b6b('0x22')]({'plain':!![]});var _0x478ac2=_0x8b6b('0x23');return db['UserProfileSection'][_0x8b6b('0x45')]({'where':{'name':_0x478ac2,'userProfileId':_0x58e9b6[_0x8b6b('0x4a')]},'raw':!![]})[_0x8b6b('0x21')](function(_0x5a6c68){if(_0x5a6c68&&_0x5a6c68[_0x8b6b('0x4b')]===0x0){return db[_0x8b6b('0x4c')][_0x8b6b('0x46')]({'name':_0x1ceccd[_0x8b6b('0x27')],'resourceId':_0x1ceccd['id'],'type':_0x5a6c68['name'],'sectionId':_0x5a6c68['id']},{})[_0x8b6b('0x21')](function(){return _0x3b4235;});}else{return _0x3b4235;}})[_0x8b6b('0x41')](function(_0x528a24){logger[_0x8b6b('0x25')](_0x8b6b('0x4d'),_0x528a24);throw _0x528a24;});}return _0x3b4235;})[_0x8b6b('0x21')](respondWithResult(_0x4f4855,0xc9))[_0x8b6b('0x41')](handleError(_0x4f4855,null));};exports[_0x8b6b('0x20')]=function(_0x4b492b,_0x49aab5){if(_0x4b492b['body']['id']){delete _0x4b492b[_0x8b6b('0x47')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x4b492b[_0x8b6b('0x43')]['id']}})[_0x8b6b('0x21')](handleEntityNotFound(_0x49aab5,null))[_0x8b6b('0x21')](saveUpdates(_0x4b492b[_0x8b6b('0x47')],null))[_0x8b6b('0x21')](respondWithResult(_0x49aab5,null))['catch'](handleError(_0x49aab5,null));};exports[_0x8b6b('0x4e')]=function(_0x42ad7a,_0x36a7ff){return db[_0x8b6b('0x3d')][_0x8b6b('0x45')]({'where':{'id':_0x42ad7a['params']['id']}})['then'](handleEntityNotFound(_0x36a7ff,null))[_0x8b6b('0x21')](removeEntity(_0x36a7ff,null))[_0x8b6b('0x41')](handleError(_0x36a7ff,null));}; \ No newline at end of file +var _0x53d5=['undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0x27b300,_0x30d773){var _0xe62f0b=function(_0x26d769){while(--_0x26d769){_0x27b300['push'](_0x27b300['shift']());}};_0xe62f0b(++_0x30d773);}(_0x53d5,0x1cc));var _0x553d=function(_0x4cc593,_0x82927){_0x4cc593=_0x4cc593-0x0;var _0x1ac9e7=_0x53d5[_0x4cc593];return _0x1ac9e7;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){var _0x5bc7f0=_0x2e4f1b['get']({'plain':!![]});var _0x2caed9='ChanSpies';return db[_0x553d('0x2a')][_0x553d('0x29')]({'where':{'type':_0x2caed9,'resourceId':_0x5bc7f0['id']}})['then'](function(){return _0x2e4f1b;});})[_0x553d('0x28')](function(){_0x82dd3a[_0x553d('0x1c')](0xcc)[_0x553d('0x1d')]();});}};}function handleEntityNotFound(_0x5cda9e,_0x1f3f5c){return function(_0x349b3f){if(!_0x349b3f){_0x5cda9e[_0x553d('0x1b')](0x194);}return _0x349b3f;};}function handleError(_0x54f0ed,_0x24ff8b){_0x24ff8b=_0x24ff8b||0x1f4;return function(_0x39943d){logger[_0x553d('0x2b')](_0x39943d['stack']);if(_0x39943d[_0x553d('0x2c')]){delete _0x39943d[_0x553d('0x2c')];}_0x54f0ed[_0x553d('0x1c')](_0x24ff8b)['send'](_0x39943d);};}exports[_0x553d('0x2d')]=function(_0x4b70b3,_0x174fea){var _0x35a77d={},_0xe1a5b5={},_0x615816={'count':0x0,'rows':[]};var _0x8e6605=_[_0x553d('0x2e')](db[_0x553d('0x2f')][_0x553d('0x30')],function(_0x5acfce){return{'name':_0x5acfce[_0x553d('0x31')],'type':_0x5acfce[_0x553d('0x32')][_0x553d('0x33')]};});_0xe1a5b5[_0x553d('0x34')]=_[_0x553d('0x2e')](_0x8e6605,_0x553d('0x2c'));_0xe1a5b5[_0x553d('0x35')]=_[_0x553d('0x36')](_0x4b70b3['query']);_0xe1a5b5[_0x553d('0x37')]=_[_0x553d('0x38')](_0xe1a5b5[_0x553d('0x34')],_0xe1a5b5['query']);_0x35a77d[_0x553d('0x39')]=_[_0x553d('0x38')](_0xe1a5b5[_0x553d('0x34')],qs[_0x553d('0x3a')](_0x4b70b3[_0x553d('0x35')][_0x553d('0x3a')]));_0x35a77d[_0x553d('0x39')]=_0x35a77d[_0x553d('0x39')]['length']?_0x35a77d['attributes']:_0xe1a5b5[_0x553d('0x34')];if(!_0x4b70b3[_0x553d('0x35')]['hasOwnProperty'](_0x553d('0x3b'))){_0x35a77d['limit']=qs['limit'](_0x4b70b3[_0x553d('0x35')]['limit']);_0x35a77d[_0x553d('0x21')]=qs['offset'](_0x4b70b3[_0x553d('0x35')][_0x553d('0x21')]);}_0x35a77d['order']=qs['sort'](_0x4b70b3[_0x553d('0x35')][_0x553d('0x3c')]);_0x35a77d[_0x553d('0x3d')]=qs[_0x553d('0x37')](_['pick'](_0x4b70b3[_0x553d('0x35')],_0xe1a5b5[_0x553d('0x37')]),_0x8e6605);if(_0x4b70b3['query'][_0x553d('0x3e')]){_0x35a77d['where']=_[_0x553d('0x3f')](_0x35a77d[_0x553d('0x3d')],{'$or':_[_0x553d('0x2e')](_0x8e6605,function(_0xcd967f){if(_0xcd967f['type']!=='VIRTUAL'){var _0x299a45={};_0x299a45[_0xcd967f[_0x553d('0x2c')]]={'$like':'%'+_0x4b70b3[_0x553d('0x35')][_0x553d('0x3e')]+'%'};return _0x299a45;}})});}_0x35a77d=_[_0x553d('0x3f')]({},_0x35a77d,_0x4b70b3[_0x553d('0x40')]);var _0x403f4a={'where':_0x35a77d[_0x553d('0x3d')]};return db[_0x553d('0x2f')][_0x553d('0x22')](_0x403f4a)['then'](function(_0x431fdb){_0x615816[_0x553d('0x22')]=_0x431fdb;if(_0x4b70b3['query'][_0x553d('0x41')]){_0x35a77d[_0x553d('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x553d('0x43')](_0x35a77d);})[_0x553d('0x28')](function(_0x40bc7a){_0x615816[_0x553d('0x44')]=_0x40bc7a;return _0x615816;})[_0x553d('0x28')](respondWithFilteredResult(_0x174fea,_0x35a77d))[_0x553d('0x45')](handleError(_0x174fea,null));};exports['show']=function(_0xb0f66e,_0x15426f){var _0x13d2e9={'raw':![],'where':{'id':_0xb0f66e[_0x553d('0x46')]['id']}},_0x5d300e={};_0x5d300e[_0x553d('0x34')]=_['keys'](db[_0x553d('0x2f')][_0x553d('0x30')]);_0x5d300e[_0x553d('0x35')]=_[_0x553d('0x36')](_0xb0f66e[_0x553d('0x35')]);_0x5d300e[_0x553d('0x37')]=_[_0x553d('0x38')](_0x5d300e[_0x553d('0x34')],_0x5d300e[_0x553d('0x35')]);_0x13d2e9['attributes']=_[_0x553d('0x38')](_0x5d300e['model'],qs[_0x553d('0x3a')](_0xb0f66e['query'][_0x553d('0x3a')]));_0x13d2e9[_0x553d('0x39')]=_0x13d2e9['attributes'][_0x553d('0x47')]?_0x13d2e9[_0x553d('0x39')]:_0x5d300e[_0x553d('0x34')];if(_0xb0f66e[_0x553d('0x35')][_0x553d('0x41')]){_0x13d2e9['include']=[{'all':!![]}];}_0x13d2e9=_[_0x553d('0x3f')]({},_0x13d2e9,_0xb0f66e['options']);return db[_0x553d('0x2f')][_0x553d('0x48')](_0x13d2e9)[_0x553d('0x28')](handleEntityNotFound(_0x15426f,null))[_0x553d('0x28')](respondWithResult(_0x15426f,null))[_0x553d('0x45')](handleError(_0x15426f,null));};exports[_0x553d('0x49')]=function(_0xb6b182,_0x29259a){return db[_0x553d('0x2f')][_0x553d('0x49')](_0xb6b182[_0x553d('0x4a')],{})[_0x553d('0x28')](function(_0x1c176f){var _0x300f0f=_0xb6b182[_0x553d('0x4b')][_0x553d('0x4c')]({'plain':!![]});if(!_0x300f0f)throw new Error(_0x553d('0x4d'));if(_0x300f0f['role']===_0x553d('0x4b')){var _0x1ed718=_0x1c176f[_0x553d('0x4c')]({'plain':!![]});var _0x2e63cd='ChanSpies';return db['UserProfileSection'][_0x553d('0x48')]({'where':{'name':_0x2e63cd,'userProfileId':_0x300f0f[_0x553d('0x4e')]},'raw':!![]})[_0x553d('0x28')](function(_0x30cb25){if(_0x30cb25&&_0x30cb25[_0x553d('0x4f')]===0x0){return db[_0x553d('0x2a')][_0x553d('0x49')]({'name':_0x1ed718[_0x553d('0x2c')],'resourceId':_0x1ed718['id'],'type':_0x30cb25[_0x553d('0x2c')],'sectionId':_0x30cb25['id']},{})['then'](function(){return _0x1c176f;});}else{return _0x1c176f;}})[_0x553d('0x45')](function(_0xec2dff){logger[_0x553d('0x2b')](_0x553d('0x50'),_0xec2dff);throw _0xec2dff;});}return _0x1c176f;})['then'](respondWithResult(_0x29259a,0xc9))['catch'](handleError(_0x29259a,null));};exports[_0x553d('0x51')]=function(_0x433c1e,_0x3d04e8){if(_0x433c1e[_0x553d('0x4a')]['id']){delete _0x433c1e[_0x553d('0x4a')]['id'];}return db[_0x553d('0x2f')][_0x553d('0x48')]({'where':{'id':_0x433c1e[_0x553d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d04e8,null))[_0x553d('0x28')](saveUpdates(_0x433c1e['body'],null))[_0x553d('0x28')](respondWithResult(_0x3d04e8,null))['catch'](handleError(_0x3d04e8,null));};exports[_0x553d('0x29')]=function(_0x50489f,_0x543103){return db[_0x553d('0x2f')][_0x553d('0x48')]({'where':{'id':_0x50489f['params']['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x543103,null))[_0x553d('0x28')](removeEntity(_0x543103,null))[_0x553d('0x45')](handleError(_0x543103,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index cd56b89..a71681e 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 _0x9de0=['lodash','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record','MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','concat','internal','User','agent','then','models','voice_chanspy','length','VoiceExtension','bulkCreate','destroy'];(function(_0x2f7ba2,_0x53d8d6){var _0x310a9e=function(_0x12a18e){while(--_0x12a18e){_0x2f7ba2['push'](_0x2f7ba2['shift']());}};_0x310a9e(++_0x53d8d6);}(_0x9de0,0x180));var _0x09de=function(_0x2d296f,_0x38d69e){_0x2d296f=_0x2d296f-0x0;var _0x2ef035=_0x9de0[_0x2d296f];return _0x2ef035;};'use strict';var _=require(_0x09de('0x0'));var util=require(_0x09de('0x1'));var BPromise=require('bluebird');var attributes=require(_0x09de('0x2'));var getUserApplications=function(_0x1ce55d,_0x58725f,_0x4eac59){var _0x4a1f7f=0x1;var _0x1ebd6d=[];var _0x4eb7ad={'context':_0x58725f['context']||_0x09de('0x3'),'exten':util[_0x09de('0x4')](_0x09de('0x5'),_0x1ce55d[_0x09de('0x6')],_0x4eac59),'type':_0x09de('0x7'),'isApp':![],'ChanSpyId':_0x1ce55d['id'],'UserId':_0x58725f['id']};_0x1ebd6d[_0x09de('0x8')](_[_0x09de('0x9')]({'app':_0x09de('0xa'),'appdata':util[_0x09de('0x4')]('CDR(type)=%s',_0x09de('0xb')),'priority':_0x4a1f7f++},_0x4eb7ad));if(_0x1ce55d[_0x09de('0xc')]){_0x1ebd6d[_0x09de('0x8')](_[_0x09de('0x9')]({'app':_0x09de('0xd'),'appdata':util[_0x09de('0x4')]('${UNIQUEID}.%s,a',_0x1ce55d[_0x09de('0xe')]),'priority':_0x4a1f7f++},_0x4eb7ad));}if(_0x1ce55d[_0x09de('0xf')]){_0x1ebd6d['push'](_[_0x09de('0x9')]({'app':'Authenticate','appdata':_0x1ce55d[_0x09de('0x10')],'priority':_0x4a1f7f++},_0x4eb7ad));}_0x1ebd6d[_0x09de('0x8')](_['merge']({'app':_0x09de('0x11'),'appdata':util[_0x09de('0x4')](_0x09de('0x12'),_0x58725f[_0x09de('0x13')],_0x1ce55d[_0x09de('0x14')]?_0x1ce55d[_0x09de('0x14')]['join'](''):''),'priority':_0x4a1f7f++},_0x4eb7ad));if(_0x1ce55d['record']){_0x1ebd6d[_0x09de('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x4a1f7f++},_0x4eb7ad));}return _0x1ebd6d;};var getChanSpyApplications=function(_0x526d5b,_0x577c74){var _0x5df7ae=[];for(var _0x36063b=0x0,_0x345a03=0x1;_0x36063b<_0x577c74['length'];_0x36063b++,_0x345a03=0x1){_0x5df7ae=_0x5df7ae[_0x09de('0x15')](getUserApplications(_0x526d5b,_0x577c74[_0x36063b],_0x577c74[_0x36063b][_0x09de('0x16')]));if(_0x577c74[_0x36063b][_0x09de('0x16')]!=_0x577c74[_0x36063b][_0x09de('0x13')]){_0x5df7ae=_0x5df7ae[_0x09de('0x15')](getUserApplications(_0x526d5b,_0x577c74[_0x36063b],_0x577c74[_0x36063b][_0x09de('0x13')]));}}return _0x5df7ae;};var getChanSpyPromise=function(_0x57f064,_0x314930){return new BPromise(function(_0x569d4c,_0x264d12){return _0x57f064[_0x09de('0x17')]['findAll']({'attributes':['id',_0x09de('0x13'),_0x09de('0x16')],'where':{'role':_0x09de('0x18'),'chanspy':!![]},'raw':!![]})[_0x09de('0x19')](function(_0x451ca4){if(_0x451ca4){return _0x569d4c(getChanSpyApplications(_0x314930,_0x451ca4));}return _0x569d4c([]);})['catch'](function(_0x4d5cae){_0x264d12(_0x4d5cae);});});};module['exports']=function(_0x5080d4,_0x3e13ea){var _0x3aefe2=_0x5080d4[_0x09de('0x1a')];return _0x5080d4['define']('VoiceChanSpy',attributes,{'tableName':_0x09de('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f6ed7,_0x576cfa,_0xc9534){return getChanSpyPromise(_0x3aefe2,_0x1f6ed7)[_0x09de('0x19')](function(_0x5c266d){if(_0x5c266d&&_0x5c266d[_0x09de('0x1c')]){return _0x3aefe2[_0x09de('0x1d')][_0x09de('0x1e')](_0x5c266d);}})['then'](function(){_0xc9534();})['catch'](function(_0x19998d){_0xc9534(_0x19998d);});},'afterUpdate':function(_0x1cc8be,_0x240da2,_0x540715){return _0x3aefe2['VoiceExtension'][_0x09de('0x1f')]({'where':{'ChanSpyId':_0x1cc8be['id']}})[_0x09de('0x19')](function(){return getChanSpyPromise(_0x3aefe2,_0x1cc8be);})['then'](function(_0x5a20c6){if(_0x5a20c6&&_0x5a20c6[_0x09de('0x1c')]){return _0x3aefe2[_0x09de('0x1d')][_0x09de('0x1e')](_0x5a20c6);}})[_0x09de('0x19')](function(){_0x540715();})['catch'](function(_0x1c5118){_0x540715(_0x1c5118);});},'afterDestroy':function(_0x3e7b90,_0x345f04,_0x9fcf3e){return _0x3aefe2['VoiceExtension'][_0x09de('0x1f')]({'where':{'ChanSpyId':_0x3e7b90['id']}})['then'](function(){_0x9fcf3e();})['catch'](function(_0x11e92d){_0x9fcf3e(_0x11e92d);});}}});}; \ No newline at end of file +var _0xd7fa=['MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','bluebird','context','from-sip','format','prefix','system','merge','Set','chanspy','push'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0xd7fa,0x1b0));var _0xad7f=function(_0x2aa161,_0xa7a83d){_0x2aa161=_0x2aa161-0x0;var _0x2831ae=_0xd7fa[_0x2aa161];return _0x2831ae;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xad7f('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x43a4fe,_0x10e162,_0x387865){var _0xc4aedb=0x1;var _0x3c1318=[];var _0x4f3791={'context':_0x10e162[_0xad7f('0x1')]||_0xad7f('0x2'),'exten':util[_0xad7f('0x3')]('%s%s',_0x43a4fe[_0xad7f('0x4')],_0x387865),'type':_0xad7f('0x5'),'isApp':![],'ChanSpyId':_0x43a4fe['id'],'UserId':_0x10e162['id']};_0x3c1318['push'](_[_0xad7f('0x6')]({'app':_0xad7f('0x7'),'appdata':util[_0xad7f('0x3')]('CDR(type)=%s',_0xad7f('0x8')),'priority':_0xc4aedb++},_0x4f3791));if(_0x43a4fe['record']){_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':_0xad7f('0xa'),'appdata':util[_0xad7f('0x3')](_0xad7f('0xb'),_0x43a4fe['recordingFormat']),'priority':_0xc4aedb++},_0x4f3791));}if(_0x43a4fe[_0xad7f('0xc')]){_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':'Authenticate','appdata':_0x43a4fe[_0xad7f('0xd')],'priority':_0xc4aedb++},_0x4f3791));}_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':_0xad7f('0xe'),'appdata':util['format'](_0xad7f('0xf'),_0x10e162[_0xad7f('0x10')],_0x43a4fe[_0xad7f('0x11')]?_0x43a4fe[_0xad7f('0x11')][_0xad7f('0x12')](''):''),'priority':_0xc4aedb++},_0x4f3791));if(_0x43a4fe['record']){_0x3c1318['push'](_['merge']({'app':'StopMixMonitor','priority':_0xc4aedb++},_0x4f3791));}return _0x3c1318;};var getChanSpyApplications=function(_0x57fee5,_0x43970c){var _0xe68834=[];for(var _0x348a6d=0x0,_0x1ba911=0x1;_0x348a6d<_0x43970c[_0xad7f('0x13')];_0x348a6d++,_0x1ba911=0x1){_0xe68834=_0xe68834[_0xad7f('0x14')](getUserApplications(_0x57fee5,_0x43970c[_0x348a6d],_0x43970c[_0x348a6d][_0xad7f('0x15')]));if(_0x43970c[_0x348a6d][_0xad7f('0x15')]!=_0x43970c[_0x348a6d]['name']){_0xe68834=_0xe68834[_0xad7f('0x14')](getUserApplications(_0x57fee5,_0x43970c[_0x348a6d],_0x43970c[_0x348a6d][_0xad7f('0x10')]));}}return _0xe68834;};var getChanSpyPromise=function(_0x1a48cc,_0xf14ec0){return new BPromise(function(_0x16b601,_0x2fbcd9){return _0x1a48cc['User'][_0xad7f('0x16')]({'attributes':['id',_0xad7f('0x10'),_0xad7f('0x15')],'where':{'role':_0xad7f('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31d679){if(_0x31d679){return _0x16b601(getChanSpyApplications(_0xf14ec0,_0x31d679));}return _0x16b601([]);})[_0xad7f('0x18')](function(_0x35f2f1){_0x2fbcd9(_0x35f2f1);});});};module[_0xad7f('0x19')]=function(_0x55f766,_0x3de82f){var _0x155327=_0x55f766[_0xad7f('0x1a')];return _0x55f766[_0xad7f('0x1b')](_0xad7f('0x1c'),attributes,{'tableName':_0xad7f('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f1f0d,_0xdf715c,_0x4abe73){return getChanSpyPromise(_0x155327,_0x3f1f0d)[_0xad7f('0x1e')](function(_0x10325c){if(_0x10325c&&_0x10325c[_0xad7f('0x13')]){return _0x155327[_0xad7f('0x1f')]['bulkCreate'](_0x10325c);}})[_0xad7f('0x1e')](function(){_0x4abe73();})[_0xad7f('0x18')](function(_0x1df92c){_0x4abe73(_0x1df92c);});},'afterUpdate':function(_0x1a6680,_0x3e3f4e,_0x36820b){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x20')]({'where':{'ChanSpyId':_0x1a6680['id']}})[_0xad7f('0x1e')](function(){return getChanSpyPromise(_0x155327,_0x1a6680);})[_0xad7f('0x1e')](function(_0x3004cb){if(_0x3004cb&&_0x3004cb[_0xad7f('0x13')]){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x21')](_0x3004cb);}})[_0xad7f('0x1e')](function(){_0x36820b();})[_0xad7f('0x18')](function(_0x3b1037){_0x36820b(_0x3b1037);});},'afterDestroy':function(_0x535f5d,_0x4f9386,_0x2c96ae){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x20')]({'where':{'ChanSpyId':_0x535f5d['id']}})['then'](function(){_0x2c96ae();})[_0xad7f('0x18')](function(_0x3379f0){_0x2c96ae(_0x3379f0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8bcd73d..6de54b1 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 _0x5db8=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5db8,0xbb));var _0x85db=function(_0x3543e7,_0x501fcf){_0x3543e7=_0x3543e7-0x0;var _0x42df23=_0x5db8[_0x3543e7];return _0x42df23;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file +var _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0x3b97a2,_0x377d68){_0x3b97a2=_0x3b97a2-0x0;var _0x4a297e=_0x4058[_0x3b97a2];return _0x4a297e;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index bba3921..09eea43 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 _0x9634=['create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','/:id','show'];(function(_0x5edd22,_0x48597f){var _0x26e685=function(_0x46bf7a){while(--_0x46bf7a){_0x5edd22['push'](_0x5edd22['shift']());}};_0x26e685(++_0x48597f);}(_0x9634,0x1d4));var _0x4963=function(_0x454f4a,_0xf9d348){_0x454f4a=_0x454f4a-0x0;var _0x4e965b=_0x9634[_0x454f4a];return _0x4e965b;};'use strict';var multer=require(_0x4963('0x0'));var util=require('util');var path=require(_0x4963('0x1'));var timeout=require(_0x4963('0x2'));var express=require(_0x4963('0x3'));var router=express[_0x4963('0x4')]();var fs_extra=require(_0x4963('0x5'));var auth=require(_0x4963('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4963('0x7'));var controller=require(_0x4963('0x8'));router['get']('/',auth[_0x4963('0x9')](),controller['index']);router['get'](_0x4963('0xa'),auth[_0x4963('0x9')](),controller[_0x4963('0xb')]);router['post']('/',auth[_0x4963('0x9')](),controller[_0x4963('0xc')]);router['put']('/:id',auth[_0x4963('0x9')](),controller[_0x4963('0xd')]);router[_0x4963('0xe')](_0x4963('0xa'),auth['isAuthenticated'](),controller[_0x4963('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe692=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','express','fs-extra','../../components/auth/service'];(function(_0x599d71,_0xc4507a){var _0x22b097=function(_0x1666a6){while(--_0x1666a6){_0x599d71['push'](_0x599d71['shift']());}};_0x22b097(++_0xc4507a);}(_0xe692,0x1ac));var _0x2e69=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xe692[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e69('0x0'));var timeout=require('connect-timeout');var express=require(_0x2e69('0x1'));var router=express['Router']();var fs_extra=require(_0x2e69('0x2'));var auth=require(_0x2e69('0x3'));var interaction=require(_0x2e69('0x4'));var config=require(_0x2e69('0x5'));var controller=require(_0x2e69('0x6'));router[_0x2e69('0x7')]('/',auth[_0x2e69('0x8')](),controller[_0x2e69('0x9')]);router[_0x2e69('0x7')](_0x2e69('0xa'),auth['isAuthenticated'](),controller[_0x2e69('0xb')]);router[_0x2e69('0xc')]('/',auth[_0x2e69('0x8')](),controller[_0x2e69('0xd')]);router[_0x2e69('0xe')](_0x2e69('0xa'),auth[_0x2e69('0x8')](),controller[_0x2e69('0xf')]);router['delete'](_0x2e69('0xa'),auth[_0x2e69('0x8')](),controller[_0x2e69('0x10')]);module[_0x2e69('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 83b7a46..ea09d68 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 _0x6900=['STRING','name','sequelize','exports'];(function(_0x1ae3c4,_0x3f4288){var _0x59c6fb=function(_0x5c7f45){while(--_0x5c7f45){_0x1ae3c4['push'](_0x1ae3c4['shift']());}};_0x59c6fb(++_0x3f4288);}(_0x6900,0x1e6));var _0x0690=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x6900[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x0690('0x0'));module[_0x0690('0x1')]={'name':{'type':Sequelize[_0x0690('0x2')],'unique':_0x0690('0x3')},'description':{'type':Sequelize[_0x0690('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa23=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x456a54,_0xb1bf9e){var _0x50f3db=function(_0x3aa4c7){while(--_0x3aa4c7){_0x456a54['push'](_0x456a54['shift']());}};_0x50f3db(++_0xb1bf9e);}(_0xaa23,0xbb));var _0x3aa2=function(_0x56d550,_0x1c3fd0){_0x56d550=_0x56d550-0x0;var _0x5e6a91=_0xaa23[_0x56d550];return _0x5e6a91;};'use strict';var Sequelize=require(_0x3aa2('0x0'));module[_0x3aa2('0x1')]={'name':{'type':Sequelize[_0x3aa2('0x2')],'unique':_0x3aa2('0x3')},'description':{'type':Sequelize[_0x3aa2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3aa2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 7643302..27eb240 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 _0xed4c=['code','message','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','include','rows','show','params','includeAll','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','body','Reload','eml-format','rimraf','zip-dir','request-promise','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','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0xed4c,0x17e));var _0xced4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xced4('0x0'));var rimraf=require(_0xced4('0x1'));var zipdir=require(_0xced4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xced4('0x4'));var util=require(_0xced4('0x5'));var path=require(_0xced4('0x6'));var sox=require(_0xced4('0x7'));var csv=require(_0xced4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xced4('0x9'));var _=require(_0xced4('0xa'));var squel=require('squel');var crypto=require(_0xced4('0xb'));var jsforce=require(_0xced4('0xc'));var deskjs=require(_0xced4('0xd'));var toCsv=require(_0xced4('0x8'));var querystring=require(_0xced4('0xe'));var Papa=require(_0xced4('0xf'));var Redis=require(_0xced4('0x10'));var authService=require(_0xced4('0x11'));var qs=require(_0xced4('0x12'));var as=require(_0xced4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xced4('0x14'));var utils=require(_0xced4('0x15'));var config=require(_0xced4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xced4('0x17'));var client=jayson[_0xced4('0x18')][_0xced4('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2c9eec,_0x36ac79,_0x485120,_0x2f7405){return new BPromise(function(_0x4e6979,_0x5d90a2){var _0x2203b3=_0x2f7405||client;return _0x2203b3[_0xced4('0x1a')](_0x2c9eec,_0x485120)[_0xced4('0x1b')](function(_0x35c61b){logger['info'](_0xced4('0x1c'),_0x36ac79,'request\x20sent');logger[_0xced4('0x1d')](_0xced4('0x1e'),_0x36ac79,_0xced4('0x1f'),JSON[_0xced4('0x20')](_0x35c61b));if(_0x35c61b[_0xced4('0x21')]){if(_0x35c61b[_0xced4('0x21')][_0xced4('0x22')]===0x1f4){logger['error'](_0xced4('0x1c'),_0x36ac79,_0x35c61b['error'][_0xced4('0x23')]);return _0x5d90a2(_0x35c61b['error'][_0xced4('0x23')]);}logger[_0xced4('0x21')](_0xced4('0x1c'),_0x36ac79,_0x35c61b[_0xced4('0x21')][_0xced4('0x23')]);return _0x4e6979(_0x35c61b['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x36ac79,_0xced4('0x1f'));_0x4e6979(_0x35c61b['result'][_0xced4('0x23')]);}})[_0xced4('0x24')](function(_0x3281b3){logger[_0xced4('0x21')](_0xced4('0x1c'),_0x36ac79,_0x3281b3);_0x5d90a2(_0x3281b3);});});}function respondWithStatusCode(_0x36ebf8,_0x4a3338){_0x4a3338=_0x4a3338||0xcc;return function(_0x225eaa){if(_0x225eaa){return _0x36ebf8[_0xced4('0x25')](_0x4a3338);}return _0x36ebf8[_0xced4('0x26')](_0x4a3338)[_0xced4('0x27')]();};}function respondWithResult(_0x5302e8,_0x192f63){_0x192f63=_0x192f63||0xc8;return function(_0x265feb){if(_0x265feb){return _0x5302e8[_0xced4('0x26')](_0x192f63)[_0xced4('0x28')](_0x265feb);}};}function respondWithFilteredResult(_0x5c7de2,_0x5c7345){return function(_0x4838f4){if(_0x4838f4){var _0x2077c0=typeof _0x5c7345[_0xced4('0x29')]===_0xced4('0x2a')&&typeof _0x5c7345['limit']===_0xced4('0x2a');var _0x2c1b69=_0x4838f4['count'];var _0x465d19=_0x2077c0?0x0:_0x5c7345['offset'];var _0x2930f5=_0x2077c0?_0x4838f4[_0xced4('0x2b')]:_0x5c7345[_0xced4('0x29')]+_0x5c7345['limit'];var _0x21b0a4;if(_0x2930f5>=_0x2c1b69){_0x2930f5=_0x2c1b69;_0x21b0a4=0xc8;}else{_0x21b0a4=0xce;}_0x5c7de2[_0xced4('0x26')](_0x21b0a4);return _0x5c7de2[_0xced4('0x2c')](_0xced4('0x2d'),_0x465d19+'-'+_0x2930f5+'/'+_0x2c1b69)[_0xced4('0x28')](_0x4838f4);}return null;};}function patchUpdates(_0x3458c5){return function(_0x4ab01d){try{jsonpatch[_0xced4('0x2e')](_0x4ab01d,_0x3458c5,!![]);}catch(_0x3d0811){return BPromise[_0xced4('0x2f')](_0x3d0811);}return _0x4ab01d[_0xced4('0x30')]();};}function saveUpdates(_0x2a2104,_0x33112a){return function(_0x238f7d){if(_0x238f7d){return _0x238f7d['update'](_0x2a2104)[_0xced4('0x1b')](function(_0x10b123){return _0x10b123;});}return null;};}function removeEntity(_0x557f21,_0x2f9dfb){return function(_0x17713c){if(_0x17713c){return _0x17713c[_0xced4('0x31')]()[_0xced4('0x1b')](function(){var _0x1d1c32=_0x17713c[_0xced4('0x32')]({'plain':!![]});var _0x2826e2=_0xced4('0x33');return db[_0xced4('0x34')][_0xced4('0x31')]({'where':{'type':_0x2826e2,'resourceId':_0x1d1c32['id']}})[_0xced4('0x1b')](function(){return _0x17713c;});})[_0xced4('0x1b')](function(){_0x557f21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x149671,_0x5705d1){return function(_0x1eb302){if(!_0x1eb302){_0x149671[_0xced4('0x25')](0x194);}return _0x1eb302;};}function handleError(_0x3ce394,_0xe94d8a){_0xe94d8a=_0xe94d8a||0x1f4;return function(_0x2694a1){logger[_0xced4('0x21')](_0x2694a1['stack']);if(_0x2694a1[_0xced4('0x35')]){delete _0x2694a1['name'];}_0x3ce394[_0xced4('0x26')](_0xe94d8a)[_0xced4('0x36')](_0x2694a1);};}exports[_0xced4('0x37')]=function(_0x278bac,_0x50cbc1){var _0x4bec96={},_0x10ee3d={},_0x5b53c3={'count':0x0,'rows':[]};var _0x588d57=_[_0xced4('0x38')](db[_0xced4('0x39')][_0xced4('0x3a')],function(_0x35464b){return{'name':_0x35464b[_0xced4('0x3b')],'type':_0x35464b[_0xced4('0x3c')][_0xced4('0x3d')]};});_0x10ee3d[_0xced4('0x3e')]=_['map'](_0x588d57,_0xced4('0x35'));_0x10ee3d[_0xced4('0x3f')]=_[_0xced4('0x40')](_0x278bac['query']);_0x10ee3d[_0xced4('0x41')]=_[_0xced4('0x42')](_0x10ee3d[_0xced4('0x3e')],_0x10ee3d[_0xced4('0x3f')]);_0x4bec96[_0xced4('0x43')]=_[_0xced4('0x42')](_0x10ee3d[_0xced4('0x3e')],qs['fields'](_0x278bac[_0xced4('0x3f')][_0xced4('0x44')]));_0x4bec96[_0xced4('0x43')]=_0x4bec96['attributes'][_0xced4('0x45')]?_0x4bec96[_0xced4('0x43')]:_0x10ee3d['model'];if(!_0x278bac[_0xced4('0x3f')][_0xced4('0x46')]('nolimit')){_0x4bec96[_0xced4('0x47')]=qs[_0xced4('0x47')](_0x278bac['query'][_0xced4('0x47')]);_0x4bec96['offset']=qs[_0xced4('0x29')](_0x278bac['query'][_0xced4('0x29')]);}_0x4bec96[_0xced4('0x48')]=qs[_0xced4('0x49')](_0x278bac[_0xced4('0x3f')][_0xced4('0x49')]);_0x4bec96[_0xced4('0x4a')]=qs[_0xced4('0x41')](_['pick'](_0x278bac['query'],_0x10ee3d['filters']),_0x588d57);if(_0x278bac['query'][_0xced4('0x4b')]){_0x4bec96[_0xced4('0x4a')]=_['merge'](_0x4bec96[_0xced4('0x4a')],{'$or':_['map'](_0x588d57,function(_0x4f085a){if(_0x4f085a[_0xced4('0x3c')]!==_0xced4('0x4c')){var _0x2ebce8={};_0x2ebce8[_0x4f085a[_0xced4('0x35')]]={'$like':'%'+_0x278bac[_0xced4('0x3f')][_0xced4('0x4b')]+'%'};return _0x2ebce8;}})});}_0x4bec96=_[_0xced4('0x4d')]({},_0x4bec96,_0x278bac['options']);var _0x15fab0={'where':_0x4bec96[_0xced4('0x4a')]};return db[_0xced4('0x39')]['count'](_0x15fab0)['then'](function(_0x195478){_0x5b53c3[_0xced4('0x2b')]=_0x195478;if(_0x278bac['query']['includeAll']){_0x4bec96[_0xced4('0x4e')]=[{'all':!![]}];}return db[_0xced4('0x39')]['findAll'](_0x4bec96);})[_0xced4('0x1b')](function(_0x56332f){_0x5b53c3[_0xced4('0x4f')]=_0x56332f;return _0x5b53c3;})['then'](respondWithFilteredResult(_0x50cbc1,_0x4bec96))[_0xced4('0x24')](handleError(_0x50cbc1,null));};exports[_0xced4('0x50')]=function(_0xcef803,_0x47e190){var _0xb750d2={'raw':![],'where':{'id':_0xcef803[_0xced4('0x51')]['id']}},_0x232975={};_0x232975['model']=_['keys'](db[_0xced4('0x39')][_0xced4('0x3a')]);_0x232975[_0xced4('0x3f')]=_[_0xced4('0x40')](_0xcef803['query']);_0x232975['filters']=_['intersection'](_0x232975[_0xced4('0x3e')],_0x232975[_0xced4('0x3f')]);_0xb750d2[_0xced4('0x43')]=_['intersection'](_0x232975[_0xced4('0x3e')],qs[_0xced4('0x44')](_0xcef803[_0xced4('0x3f')][_0xced4('0x44')]));_0xb750d2[_0xced4('0x43')]=_0xb750d2['attributes'][_0xced4('0x45')]?_0xb750d2['attributes']:_0x232975['model'];if(_0xcef803[_0xced4('0x3f')][_0xced4('0x52')]){_0xb750d2[_0xced4('0x4e')]=[{'all':!![]}];}_0xb750d2=_['merge']({},_0xb750d2,_0xcef803['options']);return db[_0xced4('0x39')]['find'](_0xb750d2)['then'](handleEntityNotFound(_0x47e190,null))[_0xced4('0x1b')](respondWithResult(_0x47e190,null))[_0xced4('0x24')](handleError(_0x47e190,null));};exports['create']=function(_0x1f6a05,_0x5f51dd,_0x148581){var _0x3a08a6;return db[_0xced4('0x39')][_0xced4('0x53')](_0x1f6a05['body'],{'raw':!![]})[_0xced4('0x1b')](function(_0x1d4b74){_0x3a08a6=_0x1d4b74;return db[_0xced4('0x39')][_0xced4('0x54')]({'raw':!![]});})[_0xced4('0x1b')](function(_0x4aeae8){var _0xa58283=fs[_0xced4('0x55')](path[_0xced4('0x56')](config[_0xced4('0x57')],_0xced4('0x58')),_0xced4('0x59'));var _0x453ab4=ejs[_0xced4('0x5a')](_0xa58283,{'contexts':_0x4aeae8||[]});fs[_0xced4('0x5b')](_0xced4('0x5c'),_0x453ab4);})[_0xced4('0x1b')](function(){return respondWithRpcPromise('Reload',_0xced4('0x53'),{'module':_0xced4('0x5d')});})['then'](function(){var _0x385e87=_0x1f6a05[_0xced4('0x5e')][_0xced4('0x32')]({'plain':!![]});if(!_0x385e87)throw new Error(_0xced4('0x5f'));if(_0x385e87[_0xced4('0x60')]===_0xced4('0x5e')){var _0x122ac0=_0x3a08a6[_0xced4('0x32')]({'plain':!![]});return db[_0xced4('0x61')]['find']({'where':{'name':'Contexts','userProfileId':_0x385e87['userProfileId']},'raw':!![]})[_0xced4('0x1b')](function(_0x3ad111){if(_0x3ad111&&_0x3ad111[_0xced4('0x62')]===0x0){return db[_0xced4('0x34')][_0xced4('0x53')]({'name':_0x122ac0[_0xced4('0x35')],'resourceId':_0x122ac0['id'],'type':_0x3ad111[_0xced4('0x35')],'sectionId':_0x3ad111['id']},{})[_0xced4('0x1b')](function(){return _0x3a08a6;});}else{return _0x3a08a6;}})['catch'](function(_0x3a5c10){logger[_0xced4('0x21')](_0xced4('0x63'),_0x3a5c10);throw _0x3a5c10;});}return _0x3a08a6;})[_0xced4('0x1b')](respondWithResult(_0x5f51dd,0xc9))['catch'](handleError(_0x5f51dd,null));};exports[_0xced4('0x64')]=function(_0x1ae24a,_0x57900c,_0x113e47){var _0x3038e9;return db[_0xced4('0x39')][_0xced4('0x65')]({'where':{'id':_0x1ae24a['params']['id']}})[_0xced4('0x1b')](handleEntityNotFound(_0x57900c,null))['then'](saveUpdates(_0x1ae24a[_0xced4('0x66')],null))[_0xced4('0x1b')](function(_0x276685){if(_0x276685){_0x3038e9=_0x276685;return db[_0xced4('0x39')]['findAll']({'raw':!![]});}})[_0xced4('0x1b')](function(_0xeedd6c){var _0x306207=fs['readFileSync'](path[_0xced4('0x56')](config[_0xced4('0x57')],_0xced4('0x58')),'utf8');var _0x1406f9=ejs[_0xced4('0x5a')](_0x306207,{'contexts':_0xeedd6c||[]});fs['writeFileSync'](_0xced4('0x5c'),_0x1406f9);})[_0xced4('0x1b')](function(){return respondWithRpcPromise(_0xced4('0x67'),_0xced4('0x64'),{'module':_0xced4('0x5d')});})[_0xced4('0x1b')](function(){return _0x3038e9;})[_0xced4('0x1b')](respondWithResult(_0x57900c,null))[_0xced4('0x24')](handleError(_0x57900c,null));};exports[_0xced4('0x31')]=function(_0x390b2a,_0x173904,_0x279b8a){var _0x34faad;return db[_0xced4('0x39')][_0xced4('0x65')]({'where':{'id':_0x390b2a[_0xced4('0x51')]['id']}})[_0xced4('0x1b')](handleEntityNotFound(_0x173904,null))[_0xced4('0x1b')](removeEntity(_0x173904,null))[_0xced4('0x1b')](function(){return db[_0xced4('0x39')][_0xced4('0x54')]({'raw':!![]});})[_0xced4('0x1b')](function(_0x3b760b){var _0x161482=fs[_0xced4('0x55')](path[_0xced4('0x56')](config[_0xced4('0x57')],_0xced4('0x58')),_0xced4('0x59'));var _0x383cda=ejs[_0xced4('0x5a')](_0x161482,{'contexts':_0x3b760b});fs['writeFileSync'](_0xced4('0x5c'),_0x383cda);return respondWithRpcPromise(_0xced4('0x67'),_0xced4('0x31'),{'module':_0xced4('0x5d')});})['catch'](handleError(_0x173904,null));}; \ No newline at end of file +var _0xc1ab=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','get','Contexts','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','findAll','rows','show','params','keys','find','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','Reload','join','utf8','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs'];(function(_0x4841d0,_0x43ff8b){var _0x3b4ffc=function(_0x4e4a50){while(--_0x4e4a50){_0x4841d0['push'](_0x4841d0['shift']());}};_0x3b4ffc(++_0x43ff8b);}(_0xc1ab,0x12b));var _0xbc1a=function(_0x322530,_0x37f4e9){_0x322530=_0x322530-0x0;var _0x1d9e8e=_0xc1ab[_0x322530];return _0x1d9e8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc1a('0x0'));var zipdir=require(_0xbc1a('0x1'));var jsonpatch=require(_0xbc1a('0x2'));var rp=require(_0xbc1a('0x3'));var moment=require(_0xbc1a('0x4'));var BPromise=require(_0xbc1a('0x5'));var Mustache=require(_0xbc1a('0x6'));var util=require('util');var path=require(_0xbc1a('0x7'));var sox=require('sox');var csv=require(_0xbc1a('0x8'));var ejs=require(_0xbc1a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc1a('0xa'));var squel=require(_0xbc1a('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc1a('0xc'));var deskjs=require(_0xbc1a('0xd'));var toCsv=require(_0xbc1a('0x8'));var querystring=require('querystring');var Papa=require(_0xbc1a('0xe'));var Redis=require(_0xbc1a('0xf'));var authService=require(_0xbc1a('0x10'));var qs=require(_0xbc1a('0x11'));var as=require(_0xbc1a('0x12'));var hardwareService=require(_0xbc1a('0x13'));var logger=require(_0xbc1a('0x14'))(_0xbc1a('0x15'));var utils=require(_0xbc1a('0x16'));var config=require(_0xbc1a('0x17'));var licenseUtil=require(_0xbc1a('0x18'));var db=require(_0xbc1a('0x19'))['db'];var jayson=require(_0xbc1a('0x1a'));var client=jayson[_0xbc1a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28c0ae,_0x242312,_0x59243f,_0x1e55fb){return new BPromise(function(_0x243302,_0xfa1387){var _0x1c981d=_0x1e55fb||client;return _0x1c981d[_0xbc1a('0x1c')](_0x28c0ae,_0x59243f)[_0xbc1a('0x1d')](function(_0x1510f9){logger[_0xbc1a('0x1e')](_0xbc1a('0x1f'),_0x242312,_0xbc1a('0x20'));logger[_0xbc1a('0x21')](_0xbc1a('0x22'),_0x242312,'request\x20sent',JSON['stringify'](_0x1510f9));if(_0x1510f9[_0xbc1a('0x23')]){if(_0x1510f9[_0xbc1a('0x23')][_0xbc1a('0x24')]===0x1f4){logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x1510f9[_0xbc1a('0x23')]['message']);return _0xfa1387(_0x1510f9['error']['message']);}logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x1510f9[_0xbc1a('0x23')][_0xbc1a('0x25')]);return _0x243302(_0x1510f9['error']['message']);}else{logger[_0xbc1a('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x242312,_0xbc1a('0x20'));_0x243302(_0x1510f9[_0xbc1a('0x26')][_0xbc1a('0x25')]);}})[_0xbc1a('0x27')](function(_0x58e427){logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x58e427);_0xfa1387(_0x58e427);});});}function respondWithStatusCode(_0x14ab1f,_0x3034bc){_0x3034bc=_0x3034bc||0xcc;return function(_0x56bccb){if(_0x56bccb){return _0x14ab1f[_0xbc1a('0x28')](_0x3034bc);}return _0x14ab1f[_0xbc1a('0x29')](_0x3034bc)[_0xbc1a('0x2a')]();};}function respondWithResult(_0xfaaa5b,_0x2e6293){_0x2e6293=_0x2e6293||0xc8;return function(_0x775566){if(_0x775566){return _0xfaaa5b['status'](_0x2e6293)[_0xbc1a('0x2b')](_0x775566);}};}function respondWithFilteredResult(_0x34b085,_0x3cd6b7){return function(_0x5d1e94){if(_0x5d1e94){var _0x4743e8=typeof _0x3cd6b7[_0xbc1a('0x2c')]==='undefined'&&typeof _0x3cd6b7['limit']===_0xbc1a('0x2d');var _0x36a161=_0x5d1e94[_0xbc1a('0x2e')];var _0x39368f=_0x4743e8?0x0:_0x3cd6b7[_0xbc1a('0x2c')];var _0x1aa3e7=_0x4743e8?_0x5d1e94[_0xbc1a('0x2e')]:_0x3cd6b7[_0xbc1a('0x2c')]+_0x3cd6b7[_0xbc1a('0x2f')];var _0x44bb7d;if(_0x1aa3e7>=_0x36a161){_0x1aa3e7=_0x36a161;_0x44bb7d=0xc8;}else{_0x44bb7d=0xce;}_0x34b085[_0xbc1a('0x29')](_0x44bb7d);return _0x34b085['set'](_0xbc1a('0x30'),_0x39368f+'-'+_0x1aa3e7+'/'+_0x36a161)['json'](_0x5d1e94);}return null;};}function patchUpdates(_0x1193c3){return function(_0x1d4bde){try{jsonpatch['apply'](_0x1d4bde,_0x1193c3,!![]);}catch(_0x495adb){return BPromise[_0xbc1a('0x31')](_0x495adb);}return _0x1d4bde[_0xbc1a('0x32')]();};}function saveUpdates(_0x5e9f02,_0x450321){return function(_0x506237){if(_0x506237){return _0x506237['update'](_0x5e9f02)[_0xbc1a('0x1d')](function(_0x3ae5e0){return _0x3ae5e0;});}return null;};}function removeEntity(_0x34d0bd,_0x59f936){return function(_0x33a3ab){if(_0x33a3ab){return _0x33a3ab[_0xbc1a('0x33')]()[_0xbc1a('0x1d')](function(){var _0x5a1793=_0x33a3ab[_0xbc1a('0x34')]({'plain':!![]});var _0x226a21=_0xbc1a('0x35');return db['UserProfileResource'][_0xbc1a('0x33')]({'where':{'type':_0x226a21,'resourceId':_0x5a1793['id']}})['then'](function(){return _0x33a3ab;});})[_0xbc1a('0x1d')](function(){_0x34d0bd['status'](0xcc)[_0xbc1a('0x2a')]();});}};}function handleEntityNotFound(_0x43b55f,_0x567855){return function(_0x1b8db3){if(!_0x1b8db3){_0x43b55f['sendStatus'](0x194);}return _0x1b8db3;};}function handleError(_0x425241,_0x249df6){_0x249df6=_0x249df6||0x1f4;return function(_0x309b37){logger[_0xbc1a('0x23')](_0x309b37[_0xbc1a('0x36')]);if(_0x309b37[_0xbc1a('0x37')]){delete _0x309b37[_0xbc1a('0x37')];}_0x425241[_0xbc1a('0x29')](_0x249df6)['send'](_0x309b37);};}exports[_0xbc1a('0x38')]=function(_0x4205b3,_0x19e708){var _0x2d5d60={},_0x3fd93f={},_0x9bd3fc={'count':0x0,'rows':[]};var _0xca7fbd=_[_0xbc1a('0x39')](db['VoiceContext'][_0xbc1a('0x3a')],function(_0xda55a5){return{'name':_0xda55a5[_0xbc1a('0x3b')],'type':_0xda55a5[_0xbc1a('0x3c')]['key']};});_0x3fd93f[_0xbc1a('0x3d')]=_[_0xbc1a('0x39')](_0xca7fbd,_0xbc1a('0x37'));_0x3fd93f[_0xbc1a('0x3e')]=_['keys'](_0x4205b3[_0xbc1a('0x3e')]);_0x3fd93f[_0xbc1a('0x3f')]=_[_0xbc1a('0x40')](_0x3fd93f[_0xbc1a('0x3d')],_0x3fd93f['query']);_0x2d5d60[_0xbc1a('0x41')]=_[_0xbc1a('0x40')](_0x3fd93f[_0xbc1a('0x3d')],qs[_0xbc1a('0x42')](_0x4205b3['query']['fields']));_0x2d5d60[_0xbc1a('0x41')]=_0x2d5d60['attributes'][_0xbc1a('0x43')]?_0x2d5d60[_0xbc1a('0x41')]:_0x3fd93f[_0xbc1a('0x3d')];if(!_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x44')](_0xbc1a('0x45'))){_0x2d5d60['limit']=qs['limit'](_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x2f')]);_0x2d5d60[_0xbc1a('0x2c')]=qs[_0xbc1a('0x2c')](_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x2c')]);}_0x2d5d60['order']=qs[_0xbc1a('0x46')](_0x4205b3['query'][_0xbc1a('0x46')]);_0x2d5d60[_0xbc1a('0x47')]=qs['filters'](_[_0xbc1a('0x48')](_0x4205b3[_0xbc1a('0x3e')],_0x3fd93f['filters']),_0xca7fbd);if(_0x4205b3[_0xbc1a('0x3e')]['filter']){_0x2d5d60[_0xbc1a('0x47')]=_['merge'](_0x2d5d60[_0xbc1a('0x47')],{'$or':_[_0xbc1a('0x39')](_0xca7fbd,function(_0x22b348){if(_0x22b348[_0xbc1a('0x3c')]!=='VIRTUAL'){var _0x18aa44={};_0x18aa44[_0x22b348[_0xbc1a('0x37')]]={'$like':'%'+_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x49')]+'%'};return _0x18aa44;}})});}_0x2d5d60=_[_0xbc1a('0x4a')]({},_0x2d5d60,_0x4205b3[_0xbc1a('0x4b')]);var _0x7a5877={'where':_0x2d5d60['where']};return db[_0xbc1a('0x4c')][_0xbc1a('0x2e')](_0x7a5877)[_0xbc1a('0x1d')](function(_0x26b19f){_0x9bd3fc[_0xbc1a('0x2e')]=_0x26b19f;if(_0x4205b3[_0xbc1a('0x3e')]['includeAll']){_0x2d5d60['include']=[{'all':!![]}];}return db[_0xbc1a('0x4c')][_0xbc1a('0x4d')](_0x2d5d60);})[_0xbc1a('0x1d')](function(_0x7921e7){_0x9bd3fc[_0xbc1a('0x4e')]=_0x7921e7;return _0x9bd3fc;})[_0xbc1a('0x1d')](respondWithFilteredResult(_0x19e708,_0x2d5d60))[_0xbc1a('0x27')](handleError(_0x19e708,null));};exports[_0xbc1a('0x4f')]=function(_0x165ac5,_0x4eac42){var _0x1c0413={'raw':![],'where':{'id':_0x165ac5[_0xbc1a('0x50')]['id']}},_0x890106={};_0x890106[_0xbc1a('0x3d')]=_[_0xbc1a('0x51')](db[_0xbc1a('0x4c')]['rawAttributes']);_0x890106[_0xbc1a('0x3e')]=_['keys'](_0x165ac5[_0xbc1a('0x3e')]);_0x890106['filters']=_[_0xbc1a('0x40')](_0x890106[_0xbc1a('0x3d')],_0x890106['query']);_0x1c0413[_0xbc1a('0x41')]=_[_0xbc1a('0x40')](_0x890106['model'],qs[_0xbc1a('0x42')](_0x165ac5[_0xbc1a('0x3e')][_0xbc1a('0x42')]));_0x1c0413['attributes']=_0x1c0413['attributes'][_0xbc1a('0x43')]?_0x1c0413[_0xbc1a('0x41')]:_0x890106[_0xbc1a('0x3d')];if(_0x165ac5[_0xbc1a('0x3e')]['includeAll']){_0x1c0413['include']=[{'all':!![]}];}_0x1c0413=_[_0xbc1a('0x4a')]({},_0x1c0413,_0x165ac5[_0xbc1a('0x4b')]);return db[_0xbc1a('0x4c')][_0xbc1a('0x52')](_0x1c0413)[_0xbc1a('0x1d')](handleEntityNotFound(_0x4eac42,null))[_0xbc1a('0x1d')](respondWithResult(_0x4eac42,null))[_0xbc1a('0x27')](handleError(_0x4eac42,null));};exports[_0xbc1a('0x53')]=function(_0x52aae8,_0x5dcb95,_0x98bfe7){var _0x9c0897;return db[_0xbc1a('0x4c')][_0xbc1a('0x53')](_0x52aae8[_0xbc1a('0x54')],{'raw':!![]})['then'](function(_0x2e0292){_0x9c0897=_0x2e0292;return db['VoiceContext'][_0xbc1a('0x4d')]({'raw':!![]});})[_0xbc1a('0x1d')](function(_0x1c9daa){var _0x33cae0=fs[_0xbc1a('0x55')](path['join'](config['root'],_0xbc1a('0x56')),'utf8');var _0x5a4c05=ejs[_0xbc1a('0x57')](_0x33cae0,{'contexts':_0x1c9daa||[]});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x5a4c05);})[_0xbc1a('0x1d')](function(){return respondWithRpcPromise('Reload',_0xbc1a('0x53'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x1d')](function(){var _0x161235=_0x52aae8[_0xbc1a('0x5b')][_0xbc1a('0x34')]({'plain':!![]});if(!_0x161235)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x161235[_0xbc1a('0x5c')]==='user'){var _0x5842b0=_0x9c0897[_0xbc1a('0x34')]({'plain':!![]});return db[_0xbc1a('0x5d')]['find']({'where':{'name':_0xbc1a('0x35'),'userProfileId':_0x161235[_0xbc1a('0x5e')]},'raw':!![]})[_0xbc1a('0x1d')](function(_0x2005bb){if(_0x2005bb&&_0x2005bb[_0xbc1a('0x5f')]===0x0){return db[_0xbc1a('0x60')][_0xbc1a('0x53')]({'name':_0x5842b0[_0xbc1a('0x37')],'resourceId':_0x5842b0['id'],'type':_0x2005bb[_0xbc1a('0x37')],'sectionId':_0x2005bb['id']},{})[_0xbc1a('0x1d')](function(){return _0x9c0897;});}else{return _0x9c0897;}})[_0xbc1a('0x27')](function(_0x1064e4){logger[_0xbc1a('0x23')](_0xbc1a('0x61'),_0x1064e4);throw _0x1064e4;});}return _0x9c0897;})['then'](respondWithResult(_0x5dcb95,0xc9))[_0xbc1a('0x27')](handleError(_0x5dcb95,null));};exports[_0xbc1a('0x62')]=function(_0x469171,_0xd38beb,_0x4035be){var _0x2f9fe8;return db[_0xbc1a('0x4c')]['find']({'where':{'id':_0x469171[_0xbc1a('0x50')]['id']}})[_0xbc1a('0x1d')](handleEntityNotFound(_0xd38beb,null))['then'](saveUpdates(_0x469171[_0xbc1a('0x54')],null))[_0xbc1a('0x1d')](function(_0x3464cd){if(_0x3464cd){_0x2f9fe8=_0x3464cd;return db[_0xbc1a('0x4c')][_0xbc1a('0x4d')]({'raw':!![]});}})[_0xbc1a('0x1d')](function(_0x2ac4b8){var _0x5ab5dc=fs[_0xbc1a('0x55')](path['join'](config[_0xbc1a('0x63')],_0xbc1a('0x56')),'utf8');var _0x43fcaf=ejs[_0xbc1a('0x57')](_0x5ab5dc,{'contexts':_0x2ac4b8||[]});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x43fcaf);})['then'](function(){return respondWithRpcPromise(_0xbc1a('0x64'),_0xbc1a('0x62'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x1d')](function(){return _0x2f9fe8;})[_0xbc1a('0x1d')](respondWithResult(_0xd38beb,null))['catch'](handleError(_0xd38beb,null));};exports[_0xbc1a('0x33')]=function(_0x1fa942,_0x4c4b86,_0x48c379){var _0x5b3d02;return db['VoiceContext'][_0xbc1a('0x52')]({'where':{'id':_0x1fa942[_0xbc1a('0x50')]['id']}})[_0xbc1a('0x1d')](handleEntityNotFound(_0x4c4b86,null))[_0xbc1a('0x1d')](removeEntity(_0x4c4b86,null))['then'](function(){return db[_0xbc1a('0x4c')]['findAll']({'raw':!![]});})['then'](function(_0x249bb0){var _0x288da9=fs['readFileSync'](path[_0xbc1a('0x65')](config[_0xbc1a('0x63')],_0xbc1a('0x56')),_0xbc1a('0x66'));var _0x2c82b9=ejs['render'](_0x288da9,{'contexts':_0x249bb0});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x2c82b9);return respondWithRpcPromise('Reload',_0xbc1a('0x33'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x27')](handleError(_0x4c4b86,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index bb79bfc..1a4cda7 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 _0x0c2a=['bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','../../config/logger','api','moment'];(function(_0x249a5d,_0x19fd4e){var _0x124a93=function(_0x3a336f){while(--_0x3a336f){_0x249a5d['push'](_0x249a5d['shift']());}};_0x124a93(++_0x19fd4e);}(_0x0c2a,0x1d5));var _0xa0c2=function(_0x4028d1,_0x1cc1c5){_0x4028d1=_0x4028d1-0x0;var _0x4560ad=_0x0c2a[_0x4028d1];return _0x4560ad;};'use strict';var _=require(_0xa0c2('0x0'));var util=require('util');var logger=require(_0xa0c2('0x1'))(_0xa0c2('0x2'));var moment=require(_0xa0c2('0x3'));var BPromise=require(_0xa0c2('0x4'));var rp=require(_0xa0c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa0c2('0x6'));var attributes=require(_0xa0c2('0x7'));module[_0xa0c2('0x8')]=function(_0x5616ff,_0x520293){return _0x5616ff[_0xa0c2('0x9')](_0xa0c2('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0630=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x5aaac4,_0x116cc2){var _0x1a32cc=function(_0x2137f0){while(--_0x2137f0){_0x5aaac4['push'](_0x5aaac4['shift']());}};_0x1a32cc(++_0x116cc2);}(_0x0630,0x9d));var _0x0063=function(_0x56d0f5,_0x5c0b73){_0x56d0f5=_0x56d0f5-0x0;var _0x249d96=_0x0630[_0x56d0f5];return _0x249d96;};'use strict';var _=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var logger=require(_0x0063('0x2'))(_0x0063('0x3'));var moment=require(_0x0063('0x4'));var BPromise=require(_0x0063('0x5'));var rp=require(_0x0063('0x6'));var fs=require('fs');var path=require(_0x0063('0x7'));var rimraf=require(_0x0063('0x8'));var config=require('../../config/environment');var attributes=require(_0x0063('0x9'));module[_0x0063('0xa')]=function(_0x1f16ba,_0x1237ed){return _0x1f16ba[_0x0063('0xb')]('VoiceContext',attributes,{'tableName':_0x0063('0xc'),'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 63f67e8..2ed46e0 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 _0xfbe6=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x3c71be,_0x2dd11c){_0x3c71be=_0x3c71be-0x0;var _0x16c630=_0xfbe6[_0x3c71be];return _0x16c630;};'use strict';var _=require(_0x6fbe('0x0'));var util=require(_0x6fbe('0x1'));var moment=require(_0x6fbe('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fbe('0x3'));var fs=require('fs');var Redis=require(_0x6fbe('0x4'));var db=require(_0x6fbe('0x5'))['db'];var utils=require(_0x6fbe('0x6'));var logger=require(_0x6fbe('0x7'))(_0x6fbe('0x8'));var config=require(_0x6fbe('0x9'));var jayson=require(_0x6fbe('0xa'));var client=jayson[_0x6fbe('0xb')][_0x6fbe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x533992,_0x1b4712,_0x1be794){return new BPromise(function(_0x439feb,_0x5532b3){return client[_0x6fbe('0xd')](_0x533992,_0x1be794)[_0x6fbe('0xe')](function(_0x348ba5){logger[_0x6fbe('0xf')](_0x6fbe('0x10'),_0x1b4712,_0x6fbe('0x11'));logger[_0x6fbe('0x12')](_0x6fbe('0x13'),_0x1b4712,_0x6fbe('0x11'),JSON[_0x6fbe('0x14')](_0x348ba5));if(_0x348ba5['error']){if(_0x348ba5[_0x6fbe('0x15')][_0x6fbe('0x16')]===0x1f4){logger[_0x6fbe('0x15')](_0x6fbe('0x10'),_0x1b4712,_0x348ba5[_0x6fbe('0x15')][_0x6fbe('0x17')]);return _0x5532b3(_0x348ba5[_0x6fbe('0x15')][_0x6fbe('0x17')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b4712,_0x348ba5[_0x6fbe('0x15')][_0x6fbe('0x17')]);return _0x439feb(_0x348ba5[_0x6fbe('0x15')]['message']);}else{logger[_0x6fbe('0xf')](_0x6fbe('0x10'),_0x1b4712,_0x6fbe('0x11'));_0x439feb(_0x348ba5[_0x6fbe('0x18')][_0x6fbe('0x17')]);}})[_0x6fbe('0x19')](function(_0x3b9bc0){logger[_0x6fbe('0x15')]('VoiceContext,\x20%s,\x20%s',_0x1b4712,_0x3b9bc0);_0x5532b3(_0x3b9bc0);});});} \ No newline at end of file +var _0x21c9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util'];(function(_0xc66bab,_0x5f1dd2){var _0x16421f=function(_0xccf38d){while(--_0xccf38d){_0xc66bab['push'](_0xc66bab['shift']());}};_0x16421f(++_0x5f1dd2);}(_0x21c9,0x19e));var _0x921c=function(_0x40ea0f,_0x33644d){_0x40ea0f=_0x40ea0f-0x0;var _0x1ae737=_0x21c9[_0x40ea0f];return _0x1ae737;};'use strict';var _=require(_0x921c('0x0'));var util=require(_0x921c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x921c('0x2'))['db'];var utils=require(_0x921c('0x3'));var logger=require('../../config/logger')(_0x921c('0x4'));var config=require(_0x921c('0x5'));var jayson=require(_0x921c('0x6'));var client=jayson[_0x921c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0c84,_0x1ab777,_0x496501){return new BPromise(function(_0x3c0630,_0x382544){return client[_0x921c('0x8')](_0x1b0c84,_0x496501)['then'](function(_0xeb39a7){logger['info'](_0x921c('0x9'),_0x1ab777,_0x921c('0xa'));logger[_0x921c('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1ab777,'request\x20sent',JSON[_0x921c('0xc')](_0xeb39a7));if(_0xeb39a7[_0x921c('0xd')]){if(_0xeb39a7[_0x921c('0xd')][_0x921c('0xe')]===0x1f4){logger[_0x921c('0xd')](_0x921c('0x9'),_0x1ab777,_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);return _0x382544(_0xeb39a7[_0x921c('0xd')]['message']);}logger['error'](_0x921c('0x9'),_0x1ab777,_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);return _0x3c0630(_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);}else{logger['info'](_0x921c('0x9'),_0x1ab777,_0x921c('0xa'));_0x3c0630(_0xeb39a7['result'][_0x921c('0xf')]);}})['catch'](function(_0x318640){logger[_0x921c('0xd')](_0x921c('0x9'),_0x1ab777,_0x318640);_0x382544(_0x318640);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index adae2f6..2deebd9 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 _0x1374=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete'];(function(_0x32c9da,_0x51a9e2){var _0x65d4a9=function(_0x120d6a){while(--_0x120d6a){_0x32c9da['push'](_0x32c9da['shift']());}};_0x65d4a9(++_0x51a9e2);}(_0x1374,0xba));var _0x4137=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x1374[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x4137('0x0'));var util=require(_0x4137('0x1'));var path=require(_0x4137('0x2'));var timeout=require(_0x4137('0x3'));var express=require('express');var router=express[_0x4137('0x4')]();var fs_extra=require(_0x4137('0x5'));var auth=require(_0x4137('0x6'));var interaction=require(_0x4137('0x7'));var config=require(_0x4137('0x8'));var controller=require(_0x4137('0x9'));router[_0x4137('0xa')]('/',auth['isAuthenticated'](),controller[_0x4137('0xb')]);router[_0x4137('0xa')](_0x4137('0xc'),auth[_0x4137('0xd')](),controller[_0x4137('0xe')]);router[_0x4137('0xa')](_0x4137('0xf'),auth[_0x4137('0xd')](),controller[_0x4137('0x10')]);router[_0x4137('0x11')]('/',auth[_0x4137('0xd')](),controller[_0x4137('0x12')]);router[_0x4137('0x13')](_0x4137('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4137('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4137('0x15')]);module[_0x4137('0x16')]=router; \ No newline at end of file +var _0xa216=['../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xa216,0xf4));var _0x6a21=function(_0x4c30d2,_0x1705cb){_0x4c30d2=_0x4c30d2-0x0;var _0x3764f1=_0xa216[_0x4c30d2];return _0x3764f1;};'use strict';var multer=require('multer');var util=require(_0x6a21('0x0'));var path=require(_0x6a21('0x1'));var timeout=require(_0x6a21('0x2'));var express=require(_0x6a21('0x3'));var router=express[_0x6a21('0x4')]();var fs_extra=require(_0x6a21('0x5'));var auth=require(_0x6a21('0x6'));var interaction=require(_0x6a21('0x7'));var config=require(_0x6a21('0x8'));var controller=require('./voiceDialReport.controller');router[_0x6a21('0x9')]('/',auth[_0x6a21('0xa')](),controller['index']);router['get']('/describe',auth[_0x6a21('0xa')](),controller['describe']);router['get'](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller[_0x6a21('0xc')]);router[_0x6a21('0xd')]('/',auth[_0x6a21('0xa')](),controller[_0x6a21('0xe')]);router['put'](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller[_0x6a21('0xf')]);router[_0x6a21('0x10')](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller['destroy']);module[_0x6a21('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 062985a..ef64c00 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x270b7c,_0x2e598c){var _0x271d5e=function(_0x2051e7){while(--_0x2051e7){_0x270b7c['push'](_0x270b7c['shift']());}};_0x271d5e(++_0x2e598c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x4b84[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xaea8f6,_0x379ca9){var _0x220c24=function(_0x14e439){while(--_0x14e439){_0xaea8f6['push'](_0xaea8f6['shift']());}};_0x220c24(++_0x379ca9);}(_0x9bde,0xe1));var _0xe9bd=function(_0xd199cb,_0x4e4fc2){_0xd199cb=_0xd199cb-0x0;var _0x4d0ae8=_0x9bde[_0xd199cb];return _0x4d0ae8;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 04045e1..5afc1f0 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 _0xfb33=['options','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceDialReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL'];(function(_0x5b4861,_0x453de9){var _0x3c14dd=function(_0x38da35){while(--_0x38da35){_0x5b4861['push'](_0x5b4861['shift']());}};_0x3c14dd(++_0x453de9);}(_0xfb33,0xa8));var _0x3fb3=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xfb33[_0x81dcac];return _0xc7803b;};'use strict';var emlformat=require(_0x3fb3('0x0'));var rimraf=require(_0x3fb3('0x1'));var zipdir=require(_0x3fb3('0x2'));var jsonpatch=require(_0x3fb3('0x3'));var rp=require(_0x3fb3('0x4'));var moment=require(_0x3fb3('0x5'));var BPromise=require(_0x3fb3('0x6'));var Mustache=require(_0x3fb3('0x7'));var util=require(_0x3fb3('0x8'));var path=require(_0x3fb3('0x9'));var sox=require(_0x3fb3('0xa'));var csv=require(_0x3fb3('0xb'));var ejs=require(_0x3fb3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fb3('0xd'));var squel=require(_0x3fb3('0xe'));var crypto=require('crypto');var jsforce=require(_0x3fb3('0xf'));var deskjs=require(_0x3fb3('0x10'));var toCsv=require(_0x3fb3('0xb'));var querystring=require(_0x3fb3('0x11'));var Papa=require(_0x3fb3('0x12'));var Redis=require(_0x3fb3('0x13'));var authService=require(_0x3fb3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3fb3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fb3('0x16'))(_0x3fb3('0x17'));var utils=require(_0x3fb3('0x18'));var config=require(_0x3fb3('0x19'));var licenseUtil=require(_0x3fb3('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2441f8,_0x9e7ea8){_0x9e7ea8=_0x9e7ea8||0xcc;return function(_0xffb84b){if(_0xffb84b){return _0x2441f8[_0x3fb3('0x1b')](_0x9e7ea8);}return _0x2441f8['status'](_0x9e7ea8)['end']();};}function respondWithResult(_0x3738f7,_0x2e165e){_0x2e165e=_0x2e165e||0xc8;return function(_0x3c0cf2){if(_0x3c0cf2){return _0x3738f7['status'](_0x2e165e)['json'](_0x3c0cf2);}};}function respondWithFilteredResult(_0x4788f3,_0x34112c){return function(_0x10a212){if(_0x10a212){var _0x49a4f4=typeof _0x34112c[_0x3fb3('0x1c')]===_0x3fb3('0x1d')&&typeof _0x34112c[_0x3fb3('0x1e')]===_0x3fb3('0x1d');var _0x242d61=_0x10a212[_0x3fb3('0x1f')];var _0xd7285=_0x49a4f4?0x0:_0x34112c[_0x3fb3('0x1c')];var _0x408c82=_0x49a4f4?_0x10a212[_0x3fb3('0x1f')]:_0x34112c[_0x3fb3('0x1c')]+_0x34112c[_0x3fb3('0x1e')];var _0x5eeb75;if(_0x408c82>=_0x242d61){_0x408c82=_0x242d61;_0x5eeb75=0xc8;}else{_0x5eeb75=0xce;}_0x4788f3[_0x3fb3('0x20')](_0x5eeb75);return _0x4788f3[_0x3fb3('0x21')](_0x3fb3('0x22'),_0xd7285+'-'+_0x408c82+'/'+_0x242d61)['json'](_0x10a212);}return null;};}function patchUpdates(_0xfd7d7e){return function(_0x42af94){try{jsonpatch[_0x3fb3('0x23')](_0x42af94,_0xfd7d7e,!![]);}catch(_0x1d120d){return BPromise[_0x3fb3('0x24')](_0x1d120d);}return _0x42af94[_0x3fb3('0x25')]();};}function saveUpdates(_0x4ba4d4,_0x11152f){return function(_0x5af439){if(_0x5af439){return _0x5af439[_0x3fb3('0x26')](_0x4ba4d4)[_0x3fb3('0x27')](function(_0x50e46d){return _0x50e46d;});}return null;};}function removeEntity(_0x5d535d,_0x5cb04a){return function(_0x439f98){if(_0x439f98){return _0x439f98[_0x3fb3('0x28')]()[_0x3fb3('0x27')](function(){_0x5d535d[_0x3fb3('0x20')](0xcc)[_0x3fb3('0x29')]();});}};}function handleEntityNotFound(_0x1e09e1,_0x363658){return function(_0x5947c8){if(!_0x5947c8){_0x1e09e1['sendStatus'](0x194);}return _0x5947c8;};}function handleError(_0x3f908e,_0x57f097){_0x57f097=_0x57f097||0x1f4;return function(_0x3f9c71){logger['error'](_0x3f9c71[_0x3fb3('0x2a')]);if(_0x3f9c71['name']){delete _0x3f9c71[_0x3fb3('0x2b')];}_0x3f908e['status'](_0x57f097)[_0x3fb3('0x2c')](_0x3f9c71);};}exports[_0x3fb3('0x2d')]=function(_0x4e5555,_0x55d200){var _0x2baf58={},_0x5997a0={},_0x3d6c97={'count':0x0,'rows':[]};var _0x56cd6d=_[_0x3fb3('0x2e')](db[_0x3fb3('0x2f')]['rawAttributes'],function(_0x5735e7){return{'name':_0x5735e7['fieldName'],'type':_0x5735e7[_0x3fb3('0x30')][_0x3fb3('0x31')]};});_0x5997a0[_0x3fb3('0x32')]=_[_0x3fb3('0x2e')](_0x56cd6d,_0x3fb3('0x2b'));_0x5997a0[_0x3fb3('0x33')]=_[_0x3fb3('0x34')](_0x4e5555['query']);_0x5997a0[_0x3fb3('0x35')]=_[_0x3fb3('0x36')](_0x5997a0['model'],_0x5997a0[_0x3fb3('0x33')]);_0x2baf58['attributes']=_[_0x3fb3('0x36')](_0x5997a0[_0x3fb3('0x32')],qs[_0x3fb3('0x37')](_0x4e5555[_0x3fb3('0x33')][_0x3fb3('0x37')]));_0x2baf58[_0x3fb3('0x38')]=_0x2baf58[_0x3fb3('0x38')][_0x3fb3('0x39')]?_0x2baf58[_0x3fb3('0x38')]:_0x5997a0['model'];if(!_0x4e5555['query'][_0x3fb3('0x3a')](_0x3fb3('0x3b'))){_0x2baf58['limit']=qs[_0x3fb3('0x1e')](_0x4e5555[_0x3fb3('0x33')][_0x3fb3('0x1e')]);_0x2baf58[_0x3fb3('0x1c')]=qs[_0x3fb3('0x1c')](_0x4e5555[_0x3fb3('0x33')][_0x3fb3('0x1c')]);}_0x2baf58[_0x3fb3('0x3c')]=qs[_0x3fb3('0x3d')](_0x4e5555[_0x3fb3('0x33')]['sort']);_0x2baf58['where']=qs[_0x3fb3('0x35')](_['pick'](_0x4e5555['query'],_0x5997a0[_0x3fb3('0x35')]),_0x56cd6d);if(_0x4e5555[_0x3fb3('0x33')][_0x3fb3('0x3e')]){_0x2baf58[_0x3fb3('0x3f')]=_[_0x3fb3('0x40')](_0x2baf58[_0x3fb3('0x3f')],{'$or':_[_0x3fb3('0x2e')](_0x56cd6d,function(_0x54bd8f){if(_0x54bd8f['type']!==_0x3fb3('0x41')){var _0x3afdde={};_0x3afdde[_0x54bd8f[_0x3fb3('0x2b')]]={'$like':'%'+_0x4e5555[_0x3fb3('0x33')]['filter']+'%'};return _0x3afdde;}})});}_0x2baf58=_['merge']({},_0x2baf58,_0x4e5555[_0x3fb3('0x42')]);var _0x391f15={'where':_0x2baf58[_0x3fb3('0x3f')]};return db[_0x3fb3('0x2f')][_0x3fb3('0x1f')](_0x391f15)['then'](function(_0x2a0730){_0x3d6c97['count']=_0x2a0730;if(_0x4e5555[_0x3fb3('0x33')]['includeAll']){_0x2baf58[_0x3fb3('0x43')]=[{'all':!![]}];}return db[_0x3fb3('0x2f')][_0x3fb3('0x44')](_0x2baf58);})['then'](function(_0x73da7c){_0x3d6c97[_0x3fb3('0x45')]=_0x73da7c;return _0x3d6c97;})['then'](respondWithFilteredResult(_0x55d200,_0x2baf58))['catch'](handleError(_0x55d200,null));};exports[_0x3fb3('0x46')]=function(_0x41d730,_0x628d40){var _0x59d5ce={'raw':!![],'where':{'id':_0x41d730[_0x3fb3('0x47')]['id']}},_0x3e9e39={};_0x3e9e39[_0x3fb3('0x32')]=_[_0x3fb3('0x34')](db[_0x3fb3('0x2f')][_0x3fb3('0x48')]);_0x3e9e39[_0x3fb3('0x33')]=_[_0x3fb3('0x34')](_0x41d730[_0x3fb3('0x33')]);_0x3e9e39['filters']=_[_0x3fb3('0x36')](_0x3e9e39[_0x3fb3('0x32')],_0x3e9e39[_0x3fb3('0x33')]);_0x59d5ce[_0x3fb3('0x38')]=_[_0x3fb3('0x36')](_0x3e9e39[_0x3fb3('0x32')],qs[_0x3fb3('0x37')](_0x41d730['query'][_0x3fb3('0x37')]));_0x59d5ce[_0x3fb3('0x38')]=_0x59d5ce[_0x3fb3('0x38')][_0x3fb3('0x39')]?_0x59d5ce[_0x3fb3('0x38')]:_0x3e9e39[_0x3fb3('0x32')];if(_0x41d730['query']['includeAll']){_0x59d5ce[_0x3fb3('0x43')]=[{'all':!![]}];}_0x59d5ce=_[_0x3fb3('0x40')]({},_0x59d5ce,_0x41d730['options']);return db['VoiceDialReport'][_0x3fb3('0x49')](_0x59d5ce)[_0x3fb3('0x27')](handleEntityNotFound(_0x628d40,null))[_0x3fb3('0x27')](respondWithResult(_0x628d40,null))['catch'](handleError(_0x628d40,null));};exports[_0x3fb3('0x4a')]=function(_0x3dafb9,_0xee7433){return db[_0x3fb3('0x2f')]['create'](_0x3dafb9[_0x3fb3('0x4b')],{})[_0x3fb3('0x27')](respondWithResult(_0xee7433,0xc9))['catch'](handleError(_0xee7433,null));};exports[_0x3fb3('0x26')]=function(_0x22fb75,_0x35b541){if(_0x22fb75[_0x3fb3('0x4b')]['id']){delete _0x22fb75['body']['id'];}return db['VoiceDialReport'][_0x3fb3('0x49')]({'where':{'id':_0x22fb75[_0x3fb3('0x47')]['id']}})[_0x3fb3('0x27')](handleEntityNotFound(_0x35b541,null))[_0x3fb3('0x27')](saveUpdates(_0x22fb75[_0x3fb3('0x4b')],null))[_0x3fb3('0x27')](respondWithResult(_0x35b541,null))[_0x3fb3('0x4c')](handleError(_0x35b541,null));};exports['destroy']=function(_0x33d76a,_0x2b59df){return db[_0x3fb3('0x2f')]['find']({'where':{'id':_0x33d76a[_0x3fb3('0x47')]['id']}})[_0x3fb3('0x27')](handleEntityNotFound(_0x2b59df,null))[_0x3fb3('0x27')](removeEntity(_0x2b59df,null))[_0x3fb3('0x4c')](handleError(_0x2b59df,null));};exports['describe']=function(_0x33c63c,_0x41e3b3){return db[_0x3fb3('0x2f')][_0x3fb3('0x4d')]()[_0x3fb3('0x27')](respondWithResult(_0x41e3b3,null))[_0x3fb3('0x4c')](handleError(_0x41e3b3,null));}; \ No newline at end of file +var _0xb15e=['show','params','options','create','body','find','describe','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb15e,0xeb));var _0xeb15=function(_0x26f189,_0x1bebf5){_0x26f189=_0x26f189-0x0;var _0x4aa106=_0xb15e[_0x26f189];return _0x4aa106;};'use strict';var emlformat=require(_0xeb15('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb15('0x2'));var util=require(_0xeb15('0x3'));var path=require(_0xeb15('0x4'));var sox=require(_0xeb15('0x5'));var csv=require(_0xeb15('0x6'));var ejs=require(_0xeb15('0x7'));var fs=require('fs');var fs_extra=require(_0xeb15('0x8'));var _=require(_0xeb15('0x9'));var squel=require('squel');var crypto=require(_0xeb15('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb15('0x6'));var querystring=require(_0xeb15('0xb'));var Papa=require(_0xeb15('0xc'));var Redis=require(_0xeb15('0xd'));var authService=require(_0xeb15('0xe'));var qs=require(_0xeb15('0xf'));var as=require(_0xeb15('0x10'));var hardwareService=require(_0xeb15('0x11'));var logger=require(_0xeb15('0x12'))(_0xeb15('0x13'));var utils=require('../../config/utils');var config=require(_0xeb15('0x14'));var licenseUtil=require(_0xeb15('0x15'));var db=require(_0xeb15('0x16'))['db'];function respondWithStatusCode(_0x3ffdeb,_0x2bdfe0){_0x2bdfe0=_0x2bdfe0||0xcc;return function(_0x4b880f){if(_0x4b880f){return _0x3ffdeb[_0xeb15('0x17')](_0x2bdfe0);}return _0x3ffdeb[_0xeb15('0x18')](_0x2bdfe0)[_0xeb15('0x19')]();};}function respondWithResult(_0x46d9d8,_0x47120f){_0x47120f=_0x47120f||0xc8;return function(_0x2d9c05){if(_0x2d9c05){return _0x46d9d8[_0xeb15('0x18')](_0x47120f)[_0xeb15('0x1a')](_0x2d9c05);}};}function respondWithFilteredResult(_0x13e5cd,_0x1e3eab){return function(_0x2a6dec){if(_0x2a6dec){var _0x388ac8=typeof _0x1e3eab['offset']==='undefined'&&typeof _0x1e3eab['limit']===_0xeb15('0x1b');var _0x20a31b=_0x2a6dec[_0xeb15('0x1c')];var _0x4b4106=_0x388ac8?0x0:_0x1e3eab[_0xeb15('0x1d')];var _0x560208=_0x388ac8?_0x2a6dec[_0xeb15('0x1c')]:_0x1e3eab[_0xeb15('0x1d')]+_0x1e3eab[_0xeb15('0x1e')];var _0x2a2a02;if(_0x560208>=_0x20a31b){_0x560208=_0x20a31b;_0x2a2a02=0xc8;}else{_0x2a2a02=0xce;}_0x13e5cd[_0xeb15('0x18')](_0x2a2a02);return _0x13e5cd[_0xeb15('0x1f')]('Content-Range',_0x4b4106+'-'+_0x560208+'/'+_0x20a31b)[_0xeb15('0x1a')](_0x2a6dec);}return null;};}function patchUpdates(_0x1cda99){return function(_0x50ee75){try{jsonpatch[_0xeb15('0x20')](_0x50ee75,_0x1cda99,!![]);}catch(_0xc8a3f3){return BPromise[_0xeb15('0x21')](_0xc8a3f3);}return _0x50ee75[_0xeb15('0x22')]();};}function saveUpdates(_0x199b6c,_0x2664b0){return function(_0x1bba7f){if(_0x1bba7f){return _0x1bba7f[_0xeb15('0x23')](_0x199b6c)[_0xeb15('0x24')](function(_0x3a1a7d){return _0x3a1a7d;});}return null;};}function removeEntity(_0x45ddb3,_0x2d6b5d){return function(_0x2e01a3){if(_0x2e01a3){return _0x2e01a3[_0xeb15('0x25')]()[_0xeb15('0x24')](function(){_0x45ddb3[_0xeb15('0x18')](0xcc)[_0xeb15('0x19')]();});}};}function handleEntityNotFound(_0x149b18,_0x9a8c0a){return function(_0x13ef76){if(!_0x13ef76){_0x149b18[_0xeb15('0x17')](0x194);}return _0x13ef76;};}function handleError(_0x24540d,_0xd53d30){_0xd53d30=_0xd53d30||0x1f4;return function(_0x21f805){logger['error'](_0x21f805[_0xeb15('0x26')]);if(_0x21f805[_0xeb15('0x27')]){delete _0x21f805[_0xeb15('0x27')];}_0x24540d['status'](_0xd53d30)[_0xeb15('0x28')](_0x21f805);};}exports[_0xeb15('0x29')]=function(_0x528594,_0x399c30){var _0x426df2={},_0x613e69={},_0x277fd7={'count':0x0,'rows':[]};var _0x5bc4c1=_['map'](db[_0xeb15('0x2a')][_0xeb15('0x2b')],function(_0x5041ad){return{'name':_0x5041ad[_0xeb15('0x2c')],'type':_0x5041ad[_0xeb15('0x2d')][_0xeb15('0x2e')]};});_0x613e69[_0xeb15('0x2f')]=_[_0xeb15('0x30')](_0x5bc4c1,_0xeb15('0x27'));_0x613e69[_0xeb15('0x31')]=_[_0xeb15('0x32')](_0x528594['query']);_0x613e69[_0xeb15('0x33')]=_[_0xeb15('0x34')](_0x613e69[_0xeb15('0x2f')],_0x613e69[_0xeb15('0x31')]);_0x426df2['attributes']=_['intersection'](_0x613e69[_0xeb15('0x2f')],qs[_0xeb15('0x35')](_0x528594['query']['fields']));_0x426df2['attributes']=_0x426df2['attributes'][_0xeb15('0x36')]?_0x426df2[_0xeb15('0x37')]:_0x613e69[_0xeb15('0x2f')];if(!_0x528594[_0xeb15('0x31')]['hasOwnProperty'](_0xeb15('0x38'))){_0x426df2[_0xeb15('0x1e')]=qs[_0xeb15('0x1e')](_0x528594[_0xeb15('0x31')][_0xeb15('0x1e')]);_0x426df2[_0xeb15('0x1d')]=qs['offset'](_0x528594[_0xeb15('0x31')][_0xeb15('0x1d')]);}_0x426df2[_0xeb15('0x39')]=qs[_0xeb15('0x3a')](_0x528594['query'][_0xeb15('0x3a')]);_0x426df2[_0xeb15('0x3b')]=qs[_0xeb15('0x33')](_[_0xeb15('0x3c')](_0x528594['query'],_0x613e69[_0xeb15('0x33')]),_0x5bc4c1);if(_0x528594[_0xeb15('0x31')][_0xeb15('0x3d')]){_0x426df2['where']=_[_0xeb15('0x3e')](_0x426df2[_0xeb15('0x3b')],{'$or':_[_0xeb15('0x30')](_0x5bc4c1,function(_0x427051){if(_0x427051[_0xeb15('0x2d')]!==_0xeb15('0x3f')){var _0x4b77e4={};_0x4b77e4[_0x427051[_0xeb15('0x27')]]={'$like':'%'+_0x528594['query'][_0xeb15('0x3d')]+'%'};return _0x4b77e4;}})});}_0x426df2=_[_0xeb15('0x3e')]({},_0x426df2,_0x528594['options']);var _0x39aa18={'where':_0x426df2[_0xeb15('0x3b')]};return db[_0xeb15('0x2a')][_0xeb15('0x1c')](_0x39aa18)['then'](function(_0x3ba3be){_0x277fd7['count']=_0x3ba3be;if(_0x528594[_0xeb15('0x31')][_0xeb15('0x40')]){_0x426df2[_0xeb15('0x41')]=[{'all':!![]}];}return db[_0xeb15('0x2a')][_0xeb15('0x42')](_0x426df2);})[_0xeb15('0x24')](function(_0x5dbbd4){_0x277fd7[_0xeb15('0x43')]=_0x5dbbd4;return _0x277fd7;})[_0xeb15('0x24')](respondWithFilteredResult(_0x399c30,_0x426df2))[_0xeb15('0x44')](handleError(_0x399c30,null));};exports[_0xeb15('0x45')]=function(_0x3d2a28,_0x220410){var _0x33a2aa={'raw':!![],'where':{'id':_0x3d2a28[_0xeb15('0x46')]['id']}},_0x480793={};_0x480793[_0xeb15('0x2f')]=_['keys'](db[_0xeb15('0x2a')]['rawAttributes']);_0x480793['query']=_[_0xeb15('0x32')](_0x3d2a28[_0xeb15('0x31')]);_0x480793[_0xeb15('0x33')]=_[_0xeb15('0x34')](_0x480793[_0xeb15('0x2f')],_0x480793['query']);_0x33a2aa[_0xeb15('0x37')]=_['intersection'](_0x480793[_0xeb15('0x2f')],qs[_0xeb15('0x35')](_0x3d2a28['query']['fields']));_0x33a2aa[_0xeb15('0x37')]=_0x33a2aa['attributes'][_0xeb15('0x36')]?_0x33a2aa[_0xeb15('0x37')]:_0x480793['model'];if(_0x3d2a28[_0xeb15('0x31')][_0xeb15('0x40')]){_0x33a2aa['include']=[{'all':!![]}];}_0x33a2aa=_[_0xeb15('0x3e')]({},_0x33a2aa,_0x3d2a28[_0xeb15('0x47')]);return db['VoiceDialReport']['find'](_0x33a2aa)[_0xeb15('0x24')](handleEntityNotFound(_0x220410,null))['then'](respondWithResult(_0x220410,null))[_0xeb15('0x44')](handleError(_0x220410,null));};exports[_0xeb15('0x48')]=function(_0x366404,_0x2d9756){return db[_0xeb15('0x2a')][_0xeb15('0x48')](_0x366404[_0xeb15('0x49')],{})[_0xeb15('0x24')](respondWithResult(_0x2d9756,0xc9))['catch'](handleError(_0x2d9756,null));};exports[_0xeb15('0x23')]=function(_0x5d3b2c,_0x5e5836){if(_0x5d3b2c['body']['id']){delete _0x5d3b2c[_0xeb15('0x49')]['id'];}return db[_0xeb15('0x2a')][_0xeb15('0x4a')]({'where':{'id':_0x5d3b2c[_0xeb15('0x46')]['id']}})[_0xeb15('0x24')](handleEntityNotFound(_0x5e5836,null))[_0xeb15('0x24')](saveUpdates(_0x5d3b2c['body'],null))['then'](respondWithResult(_0x5e5836,null))['catch'](handleError(_0x5e5836,null));};exports[_0xeb15('0x25')]=function(_0x3f22cf,_0x16bcfb){return db[_0xeb15('0x2a')]['find']({'where':{'id':_0x3f22cf['params']['id']}})[_0xeb15('0x24')](handleEntityNotFound(_0x16bcfb,null))['then'](removeEntity(_0x16bcfb,null))[_0xeb15('0x44')](handleError(_0x16bcfb,null));};exports[_0xeb15('0x4b')]=function(_0x2eb7eb,_0x50060c){return db['VoiceDialReport'][_0xeb15('0x4b')]()[_0xeb15('0x24')](respondWithResult(_0x50060c,null))[_0xeb15('0x44')](handleError(_0x50060c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index b2d1fe9..845b5e1 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 _0x87cb=['report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x3df2c6,_0x1c3d92){var _0x21526a=function(_0x460368){while(--_0x460368){_0x3df2c6['push'](_0x3df2c6['shift']());}};_0x21526a(++_0x1c3d92);}(_0x87cb,0xaa));var _0xb87c=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x87cb[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var logger=require(_0xb87c('0x2'))(_0xb87c('0x3'));var moment=require(_0xb87c('0x4'));var BPromise=require(_0xb87c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb87c('0x6'));var config=require(_0xb87c('0x7'));var attributes=require(_0xb87c('0x8'));module[_0xb87c('0x9')]=function(_0x46377b,_0x211d93){return _0x46377b['define']('VoiceDialReport',attributes,{'tableName':_0xb87c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb87c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d07=['VoiceDialReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x0d07,0x9c));var _0x70d0=function(_0x3c6b9f,_0x25f01f){_0x3c6b9f=_0x3c6b9f-0x0;var _0x190cff=_0x0d07[_0x3c6b9f];return _0x190cff;};'use strict';var _=require('lodash');var util=require(_0x70d0('0x0'));var logger=require(_0x70d0('0x1'))(_0x70d0('0x2'));var moment=require(_0x70d0('0x3'));var BPromise=require(_0x70d0('0x4'));var rp=require(_0x70d0('0x5'));var fs=require('fs');var path=require(_0x70d0('0x6'));var rimraf=require(_0x70d0('0x7'));var config=require(_0x70d0('0x8'));var attributes=require(_0x70d0('0x9'));module[_0x70d0('0xa')]=function(_0x13c906,_0xc2bda6){return _0x13c906[_0x70d0('0xb')](_0x70d0('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x70d0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 479d31d..19aa82d 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 _0x0a98=['UpdateVoiceDialReport','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','body','raw','where','attributes'];(function(_0x515ed9,_0x8ab724){var _0x4b3735=function(_0x41f064){while(--_0x41f064){_0x515ed9['push'](_0x515ed9['shift']());}};_0x4b3735(++_0x8ab724);}(_0x0a98,0x1d1));var _0x80a9=function(_0x3792f8,_0x119349){_0x3792f8=_0x3792f8-0x0;var _0x4ebd3f=_0x0a98[_0x3792f8];return _0x4ebd3f;};'use strict';var _=require('lodash');var util=require(_0x80a9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80a9('0x1'));var fs=require('fs');var Redis=require(_0x80a9('0x2'));var db=require(_0x80a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80a9('0x4'))('rpc');var config=require(_0x80a9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x80a9('0x6')][_0x80a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x155df8,_0x59aef2,_0x39c9c1){return new BPromise(function(_0x4ac85c,_0x371bab){return client[_0x80a9('0x8')](_0x155df8,_0x39c9c1)[_0x80a9('0x9')](function(_0x51c04e){logger[_0x80a9('0xa')](_0x80a9('0xb'),_0x59aef2,_0x80a9('0xc'));logger[_0x80a9('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x59aef2,_0x80a9('0xc'),JSON[_0x80a9('0xe')](_0x51c04e));if(_0x51c04e[_0x80a9('0xf')]){if(_0x51c04e[_0x80a9('0xf')][_0x80a9('0x10')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x59aef2,_0x51c04e[_0x80a9('0xf')][_0x80a9('0x11')]);return _0x371bab(_0x51c04e['error'][_0x80a9('0x11')]);}logger['error'](_0x80a9('0xb'),_0x59aef2,_0x51c04e[_0x80a9('0xf')][_0x80a9('0x11')]);return _0x4ac85c(_0x51c04e[_0x80a9('0xf')][_0x80a9('0x11')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x59aef2,'request\x20sent');_0x4ac85c(_0x51c04e[_0x80a9('0x12')][_0x80a9('0x11')]);}})[_0x80a9('0x13')](function(_0x23b752){logger['error'](_0x80a9('0xb'),_0x59aef2,_0x23b752);_0x371bab(_0x23b752);});});}exports[_0x80a9('0x14')]=function(_0x1bd634){var _0x10ddf=this;return new Promise(function(_0x1df5c0,_0x1704bf){return db[_0x80a9('0x15')][_0x80a9('0x16')](_0x1bd634['body'],{'raw':_0x1bd634[_0x80a9('0x17')]?_0x1bd634[_0x80a9('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x80a9('0x9')](function(_0x19be12){logger['info'](_0x80a9('0x14'),_0x1bd634);logger[_0x80a9('0xd')](_0x80a9('0x14'),_0x1bd634,JSON['stringify'](_0x19be12));_0x1df5c0(_0x19be12);})[_0x80a9('0x13')](function(_0x22155f){logger[_0x80a9('0xf')](_0x80a9('0x14'),_0x22155f[_0x80a9('0x11')],_0x1bd634);_0x1704bf(_0x10ddf[_0x80a9('0xf')](0x1f4,_0x22155f['message']));});});};exports['UpdateVoiceDialReport']=function(_0x4b2f70){var _0x9aab4d=this;return new Promise(function(_0xadf42c,_0x464ce3){return db[_0x80a9('0x15')]['update'](_0x4b2f70[_0x80a9('0x18')],{'raw':_0x4b2f70[_0x80a9('0x17')]?_0x4b2f70[_0x80a9('0x17')][_0x80a9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2f70[_0x80a9('0x17')]?_0x4b2f70[_0x80a9('0x17')][_0x80a9('0x1a')]||null:null,'attributes':_0x4b2f70['options']?_0x4b2f70[_0x80a9('0x17')][_0x80a9('0x1b')]||null:null,'limit':_0x4b2f70[_0x80a9('0x17')]?_0x4b2f70['options']['limit']||null:null})[_0x80a9('0x9')](function(_0x1edc20){logger[_0x80a9('0xa')](_0x80a9('0x1c'),_0x4b2f70);logger[_0x80a9('0xd')]('UpdateVoiceDialReport',_0x4b2f70,JSON[_0x80a9('0xe')](_0x1edc20));_0xadf42c(_0x1edc20);})[_0x80a9('0x13')](function(_0x3284c2){logger[_0x80a9('0xf')](_0x80a9('0x1c'),_0x3284c2['message'],_0x4b2f70);_0x464ce3(_0x9aab4d[_0x80a9('0xf')](0x1f4,_0x3284c2[_0x80a9('0x11')]));});});}; \ No newline at end of file +var _0x3fc8=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','where'];(function(_0x3e9b38,_0x44e525){var _0x41b0a2=function(_0x33d9f3){while(--_0x33d9f3){_0x3e9b38['push'](_0x3e9b38['shift']());}};_0x41b0a2(++_0x44e525);}(_0x3fc8,0x19a));var _0x83fc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3fc8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x83fc('0x0'));var util=require(_0x83fc('0x1'));var moment=require(_0x83fc('0x2'));var BPromise=require(_0x83fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83fc('0x4'));var db=require(_0x83fc('0x5'))['db'];var utils=require(_0x83fc('0x6'));var logger=require(_0x83fc('0x7'))(_0x83fc('0x8'));var config=require(_0x83fc('0x9'));var jayson=require(_0x83fc('0xa'));var client=jayson[_0x83fc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe1e7,_0x5ed706,_0x36c9fe){return new BPromise(function(_0x24daf2,_0x1c30cb){return client[_0x83fc('0xc')](_0x4fe1e7,_0x36c9fe)[_0x83fc('0xd')](function(_0x31d041){logger[_0x83fc('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x5ed706,_0x83fc('0xf'));logger[_0x83fc('0x10')](_0x83fc('0x11'),_0x5ed706,_0x83fc('0xf'),JSON[_0x83fc('0x12')](_0x31d041));if(_0x31d041[_0x83fc('0x13')]){if(_0x31d041[_0x83fc('0x13')][_0x83fc('0x14')]===0x1f4){logger[_0x83fc('0x13')](_0x83fc('0x15'),_0x5ed706,_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);return _0x1c30cb(_0x31d041['error'][_0x83fc('0x16')]);}logger[_0x83fc('0x13')](_0x83fc('0x15'),_0x5ed706,_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);return _0x24daf2(_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);}else{logger[_0x83fc('0xe')](_0x83fc('0x15'),_0x5ed706,'request\x20sent');_0x24daf2(_0x31d041['result']['message']);}})[_0x83fc('0x17')](function(_0x5360b4){logger['error'](_0x83fc('0x15'),_0x5ed706,_0x5360b4);_0x1c30cb(_0x5360b4);});});}exports[_0x83fc('0x18')]=function(_0x140d5c){var _0x1bb45a=this;return new Promise(function(_0xc06c3d,_0x45c7b0){return db[_0x83fc('0x19')][_0x83fc('0x1a')](_0x140d5c[_0x83fc('0x1b')],{'raw':_0x140d5c['options']?_0x140d5c[_0x83fc('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x83fc('0xd')](function(_0x4d2780){logger['info'](_0x83fc('0x18'),_0x140d5c);logger[_0x83fc('0x10')]('CreateVoiceDialReport',_0x140d5c,JSON[_0x83fc('0x12')](_0x4d2780));_0xc06c3d(_0x4d2780);})[_0x83fc('0x17')](function(_0x18c963){logger[_0x83fc('0x13')]('CreateVoiceDialReport',_0x18c963[_0x83fc('0x16')],_0x140d5c);_0x45c7b0(_0x1bb45a[_0x83fc('0x13')](0x1f4,_0x18c963[_0x83fc('0x16')]));});});};exports[_0x83fc('0x1d')]=function(_0x35ee8e){var _0x8c30f8=this;return new Promise(function(_0x58844d,_0x1e0828){return db[_0x83fc('0x19')][_0x83fc('0x1e')](_0x35ee8e['body'],{'raw':_0x35ee8e['options']?_0x35ee8e[_0x83fc('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e['options'][_0x83fc('0x1f')]||null:null,'attributes':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e[_0x83fc('0x1c')][_0x83fc('0x20')]||null:null,'limit':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e[_0x83fc('0x1c')][_0x83fc('0x21')]||null:null})['then'](function(_0x32fc83){logger[_0x83fc('0xe')](_0x83fc('0x1d'),_0x35ee8e);logger[_0x83fc('0x10')]('UpdateVoiceDialReport',_0x35ee8e,JSON[_0x83fc('0x12')](_0x32fc83));_0x58844d(_0x32fc83);})['catch'](function(_0x582f67){logger[_0x83fc('0x13')](_0x83fc('0x1d'),_0x582f67[_0x83fc('0x16')],_0x35ee8e);_0x1e0828(_0x8c30f8[_0x83fc('0x13')](0x1f4,_0x582f67[_0x83fc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f192ca1..a780839 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 _0x54e5=['addApplications','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index','get','/:id','isAuthenticated','show','post','create','/:id/applications'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x54e5,0x130));var _0x554e=function(_0x3480f2,_0x4947fa){_0x3480f2=_0x3480f2-0x0;var _0x1e4899=_0x54e5[_0x3480f2];return _0x1e4899;};'use strict';var multer=require(_0x554e('0x0'));var util=require(_0x554e('0x1'));var path=require(_0x554e('0x2'));var timeout=require(_0x554e('0x3'));var express=require(_0x554e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x554e('0x5'));var config=require(_0x554e('0x6'));var controller=require(_0x554e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x554e('0x8')]);router[_0x554e('0x9')](_0x554e('0xa'),auth[_0x554e('0xb')](),controller[_0x554e('0xc')]);router[_0x554e('0xd')]('/',auth[_0x554e('0xb')](),controller[_0x554e('0xe')]);router['post'](_0x554e('0xf'),auth['isAuthenticated'](),controller[_0x554e('0x10')]);router[_0x554e('0x11')](_0x554e('0xa'),auth[_0x554e('0xb')](),controller['update']);router[_0x554e('0x12')](_0x554e('0xa'),auth['isAuthenticated'](),controller[_0x554e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf507=['index','isAuthenticated','show','create','/:id/applications','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0xf507,0x1af));var _0x7f50=function(_0x1b8139,_0x515e63){_0x1b8139=_0x1b8139-0x0;var _0x378143=_0xf507[_0x1b8139];return _0x378143;};'use strict';var multer=require('multer');var util=require(_0x7f50('0x0'));var path=require('path');var timeout=require(_0x7f50('0x1'));var express=require(_0x7f50('0x2'));var router=express[_0x7f50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f50('0x4'));var interaction=require(_0x7f50('0x5'));var config=require(_0x7f50('0x6'));var controller=require(_0x7f50('0x7'));router[_0x7f50('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f50('0x9')]);router[_0x7f50('0x8')]('/:id',auth[_0x7f50('0xa')](),controller[_0x7f50('0xb')]);router['post']('/',auth[_0x7f50('0xa')](),controller[_0x7f50('0xc')]);router['post'](_0x7f50('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x7f50('0xe')](_0x7f50('0xf'),auth[_0x7f50('0xa')](),controller[_0x7f50('0x10')]);router[_0x7f50('0x11')](_0x7f50('0xf'),auth['isAuthenticated'](),controller[_0x7f50('0x12')]);module[_0x7f50('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2ed4dee..7e60b80 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 _0xbfa0=['wav','getDataValue','exten','sequelize','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','outbound-fax','*,*,*,*','INTEGER','BOOLEAN'];(function(_0xd857ef,_0x2e445f){var _0x4b96a9=function(_0x2bb623){while(--_0x2bb623){_0xd857ef['push'](_0xd857ef['shift']());}};_0x4b96a9(++_0x2e445f);}(_0xbfa0,0x153));var _0x0bfa=function(_0x7aeb0e,_0x3de390){_0x7aeb0e=_0x7aeb0e-0x0;var _0x4e5ba1=_0xbfa0[_0x7aeb0e];return _0x4e5ba1;};'use strict';var Sequelize=require(_0x0bfa('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0bfa('0x1')},'priority':{'type':Sequelize[_0x0bfa('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x0bfa('0x1')},'tag':{'type':Sequelize[_0x0bfa('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0bfa('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0bfa('0x4')](_0x0bfa('0x5'),_0x0bfa('0x6'),'internal','inbound-fax',_0x0bfa('0x7'),'system','any'),'allowNull':![]},'description':{'type':Sequelize[_0x0bfa('0x2')]},'interval':{'type':Sequelize[_0x0bfa('0x2')],'allowNull':![],'defaultValue':_0x0bfa('0x8')},'IntervalId':{'type':Sequelize[_0x0bfa('0x9')]},'isApp':{'type':Sequelize[_0x0bfa('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x0bfa('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0bfa('0x9')]},'recordingFormat':{'type':Sequelize[_0x0bfa('0x2')],'defaultValue':_0x0bfa('0xb')},'answer':{'type':Sequelize[_0x0bfa('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d4a6b){return this[_0x0bfa('0xc')](_0x0bfa('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xeae1=['system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal'];(function(_0xd18b28,_0x2ccc4c){var _0x12df2c=function(_0x2717b2){while(--_0x2717b2){_0xd18b28['push'](_0xd18b28['shift']());}};_0x12df2c(++_0x2ccc4c);}(_0xeae1,0x98));var _0x1eae=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0xeae1[_0x3e618a];return _0x1f3d61;};'use strict';var Sequelize=require(_0x1eae('0x0'));module[_0x1eae('0x1')]={'context':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'unique':_0x1eae('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x1eae('0x3')},'tag':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':_0x1eae('0x4')},'appdata':{'type':Sequelize[_0x1eae('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1eae('0x5')](_0x1eae('0x6'),'outbound',_0x1eae('0x7'),'inbound-fax','outbound-fax',_0x1eae('0x8'),_0x1eae('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x1eae('0xa')]},'isApp':{'type':Sequelize[_0x1eae('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1eae('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x1eae('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1eae('0xa')]},'recordingFormat':{'type':Sequelize[_0x1eae('0x2')],'defaultValue':_0x1eae('0xc')},'answer':{'type':Sequelize[_0x1eae('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1eae('0xd')],'get':function(_0x4df77b){return this[_0x1eae('0xe')](_0x1eae('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 03e8616..22acc4a 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 _0x2cf6=['includes','type','find','name','UserProfileResource','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','keys','catch','params','body','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','map','value'];(function(_0x5f2368,_0x29c539){var _0x11d9a3=function(_0x2c5363){while(--_0x2c5363){_0x5f2368['push'](_0x5f2368['shift']());}};_0x11d9a3(++_0x29c539);}(_0x2cf6,0x1f3));var _0x62cf=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x2cf6[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x62cf('0x0'));var Redis=require(_0x62cf('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x62cf('0x2'))(_0x62cf('0x3'));var config=require(_0x62cf('0x4'));var db=require('../../mysqldb')['db'];config[_0x62cf('0x5')]=_[_0x62cf('0x6')](config[_0x62cf('0x5')],{'host':_0x62cf('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62cf('0x5')]));require(_0x62cf('0x8'))[_0x62cf('0x9')](socket);function respondWithStatusCode(_0x5ccc1e,_0x5e98a4){_0x5e98a4=_0x5e98a4||0xcc;return function(_0x1f8984){if(_0x1f8984){return _0x5ccc1e[_0x62cf('0xa')](_0x5e98a4);}return _0x5ccc1e[_0x62cf('0xb')](_0x5e98a4)[_0x62cf('0xc')]();};}function respondWithResult(_0x201908,_0x2cae6b){_0x2cae6b=_0x2cae6b||0xc8;return function(_0x34edeb){if(_0x34edeb){return _0x201908['status'](_0x2cae6b)['json'](_0x34edeb);}};}function respondWithFilteredResult(_0x2fe4ec,_0x2b9757){return function(_0x230ee2){if(_0x230ee2){var _0x2c784f=typeof _0x2b9757[_0x62cf('0xd')]===_0x62cf('0xe')&&typeof _0x2b9757['limit']==='undefined';var _0x3cfdbb=_0x230ee2[_0x62cf('0xf')];var _0x1e4ac7=_0x2c784f?0x0:_0x2b9757[_0x62cf('0xd')];var _0x4772f6=_0x2c784f?_0x230ee2[_0x62cf('0xf')]:_0x2b9757['offset']+_0x2b9757[_0x62cf('0x10')];var _0x46e0d8;if(_0x4772f6>=_0x3cfdbb){_0x4772f6=_0x3cfdbb;_0x46e0d8=0xc8;}else{_0x46e0d8=0xce;}_0x2fe4ec[_0x62cf('0xb')](_0x46e0d8);return _0x2fe4ec[_0x62cf('0x11')](_0x62cf('0x12'),_0x1e4ac7+'-'+_0x4772f6+'/'+_0x3cfdbb)[_0x62cf('0x13')](_0x230ee2);}return null;};}function removeEntity(_0x4aab2a){return function(_0xe20794){if(_0xe20794){return _0xe20794[_0x62cf('0x14')]()[_0x62cf('0x15')](function(){var _0x45ccac=_0xe20794[_0x62cf('0x16')]({'plain':!![]});var _0x3f291f=[{'name':_0x62cf('0x17'),'value':_0x62cf('0x18'),'ignore':![]},{'name':_0x62cf('0x19'),'value':_0x62cf('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x585b12=_(_0x3f291f)['filter']('ignore')[_0x62cf('0x1b')](_0x62cf('0x1c'))['value']();if(_[_0x62cf('0x1d')](_0x585b12,_0x45ccac[_0x62cf('0x1e')])){return;}var _0xaf8b85=_[_0x62cf('0x1f')](_0x3f291f,[_0x62cf('0x1c'),_0x45ccac['type']])[_0x62cf('0x20')];return db[_0x62cf('0x21')][_0x62cf('0x14')]({'where':{'type':_0xaf8b85,'resourceId':_0x45ccac['id']}})[_0x62cf('0x15')](function(){return _0xe20794;});})[_0x62cf('0x15')](function(){_0x4aab2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa876){return function(_0x1fdfdd){if(!_0x1fdfdd){_0x3fa876['sendStatus'](0x194);}return _0x1fdfdd;};}function handleError(_0x2d8faf,_0x99dc5b){_0x99dc5b=_0x99dc5b||0x1f4;return function(_0x1dbb41){logger['error'](_0x1dbb41['stack']);if(_0x1dbb41[_0x62cf('0x20')]){delete _0x1dbb41[_0x62cf('0x20')];}_0x2d8faf[_0x62cf('0xb')](_0x99dc5b)[_0x62cf('0x22')](_0x1dbb41);};}exports[_0x62cf('0x23')]=function(_0x3265e5,_0x883bb0){var _0x388904={},_0x41afbd={},_0x405bd1={'count':0x0,'rows':[]};var _0x3f9ad3=_[_0x62cf('0x1b')](db[_0x62cf('0x24')][_0x62cf('0x25')],function(_0x35b973){return{'name':_0x35b973[_0x62cf('0x26')],'type':_0x35b973['type'][_0x62cf('0x27')]};});_0x41afbd[_0x62cf('0x28')]=_['map'](_0x3f9ad3,_0x62cf('0x20'));_0x41afbd[_0x62cf('0x29')]=_['keys'](_0x3265e5['query']);_0x41afbd[_0x62cf('0x2a')]=_[_0x62cf('0x2b')](_0x41afbd['model'],_0x41afbd[_0x62cf('0x29')]);_0x388904['attributes']=_['intersection'](_0x41afbd['model'],qs[_0x62cf('0x2c')](_0x3265e5[_0x62cf('0x29')][_0x62cf('0x2c')]));_0x388904['attributes']=_0x388904[_0x62cf('0x2d')]['length']?_0x388904[_0x62cf('0x2d')]:_0x41afbd[_0x62cf('0x28')];if(!_0x3265e5['query'][_0x62cf('0x2e')]('nolimit')){_0x388904[_0x62cf('0x10')]=qs['limit'](_0x3265e5['query'][_0x62cf('0x10')]);_0x388904[_0x62cf('0xd')]=qs[_0x62cf('0xd')](_0x3265e5[_0x62cf('0x29')]['offset']);}_0x388904[_0x62cf('0x2f')]=qs['sort'](_0x3265e5[_0x62cf('0x29')][_0x62cf('0x30')]);_0x388904[_0x62cf('0x31')]=qs[_0x62cf('0x2a')](_[_0x62cf('0x32')](_0x3265e5[_0x62cf('0x29')],_0x41afbd['filters']),_0x3f9ad3);if(_0x3265e5[_0x62cf('0x29')][_0x62cf('0x33')]){_0x388904[_0x62cf('0x31')]=_[_0x62cf('0x34')](_0x388904['where'],{'$or':_[_0x62cf('0x1b')](_0x3f9ad3,function(_0x49affd){if(_0x49affd[_0x62cf('0x1e')]!==_0x62cf('0x35')){var _0x456a24={};_0x456a24[_0x49affd['name']]={'$like':'%'+_0x3265e5[_0x62cf('0x29')][_0x62cf('0x33')]+'%'};return _0x456a24;}})});}_0x388904=_[_0x62cf('0x34')]({},_0x388904,_0x3265e5['options']);var _0x479373={'where':_0x388904[_0x62cf('0x31')]};return db[_0x62cf('0x24')][_0x62cf('0xf')](_0x479373)['then'](function(_0x445d4c){_0x405bd1['count']=_0x445d4c;if(_0x3265e5['query']['includeAll']){_0x388904[_0x62cf('0x36')]=[{'all':!![]}];}return db[_0x62cf('0x24')][_0x62cf('0x37')](_0x388904);})[_0x62cf('0x15')](function(_0x57ba94){_0x405bd1[_0x62cf('0x38')]=_0x57ba94;return _0x405bd1;})['then'](respondWithFilteredResult(_0x883bb0,_0x388904))['catch'](handleError(_0x883bb0,null));};exports[_0x62cf('0x39')]=function(_0x5b7411,_0x2fed20){var _0x36fea9={'raw':![],'where':{'id':_0x5b7411['params']['id']}},_0x3e1128={};_0x3e1128[_0x62cf('0x28')]=_[_0x62cf('0x3a')](db[_0x62cf('0x24')]['rawAttributes']);_0x3e1128[_0x62cf('0x29')]=_['keys'](_0x5b7411[_0x62cf('0x29')]);_0x3e1128[_0x62cf('0x2a')]=_[_0x62cf('0x2b')](_0x3e1128[_0x62cf('0x28')],_0x3e1128[_0x62cf('0x29')]);_0x36fea9[_0x62cf('0x2d')]=_[_0x62cf('0x2b')](_0x3e1128[_0x62cf('0x28')],qs[_0x62cf('0x2c')](_0x5b7411['query'][_0x62cf('0x2c')]));_0x36fea9[_0x62cf('0x2d')]=_0x36fea9[_0x62cf('0x2d')]['length']?_0x36fea9[_0x62cf('0x2d')]:_0x3e1128[_0x62cf('0x28')];if(_0x5b7411['query']['includeAll']){_0x36fea9[_0x62cf('0x36')]=[{'all':!![]}];}_0x36fea9=_[_0x62cf('0x34')]({},_0x36fea9,_0x5b7411['options']);return db[_0x62cf('0x24')][_0x62cf('0x1f')](_0x36fea9)[_0x62cf('0x15')](handleEntityNotFound(_0x2fed20,null))[_0x62cf('0x15')](respondWithResult(_0x2fed20,null))[_0x62cf('0x3b')](handleError(_0x2fed20,null));};exports['destroy']=function(_0xdcc4a1,_0x138019){return db[_0x62cf('0x24')]['find']({'where':{'id':_0xdcc4a1[_0x62cf('0x3c')]['id']}})[_0x62cf('0x15')](handleEntityNotFound(_0x138019,null))['then'](removeEntity(_0x138019,null))[_0x62cf('0x3b')](handleError(_0x138019,null));};exports['create']=function(_0x1f42de,_0x3221dd){if(_0x1f42de[_0x62cf('0x3d')][_0x62cf('0x1e')]===_0x62cf('0x1a')&&!_[_0x62cf('0x3e')](_0x1f42de['body'][_0x62cf('0x3f')],'_')){_0x1f42de[_0x62cf('0x3d')]['exten']='_'[_0x62cf('0x40')](_0x1f42de['body']['exten']);}return db[_0x62cf('0x24')][_0x62cf('0x41')](_0x1f42de[_0x62cf('0x3d')],{'raw':![]})['then'](function(_0x5ca921){var _0x5ad999=_0x1f42de['user'][_0x62cf('0x16')]({'plain':!![]});if(!_0x5ad999)throw new Error(_0x62cf('0x42'));if(_0x5ad999[_0x62cf('0x43')]===_0x62cf('0x44')){var _0x2b57ab=_0x5ca921[_0x62cf('0x16')]({'plain':!![]});var _0x2512e1=[{'name':_0x62cf('0x17'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x62cf('0x1a')},{'name':'InternalRoutes','value':_0x62cf('0x45')}];var _0x240245=_[_0x62cf('0x1f')](_0x2512e1,[_0x62cf('0x1c'),_0x2b57ab[_0x62cf('0x1e')]])[_0x62cf('0x20')];return db[_0x62cf('0x46')]['find']({'where':{'name':_0x240245,'userProfileId':_0x5ad999['userProfileId']},'raw':!![]})[_0x62cf('0x15')](function(_0x171ec0){if(_0x171ec0&&_0x171ec0['autoAssociation']===0x0){return db[_0x62cf('0x21')][_0x62cf('0x41')]({'name':_0x2b57ab['name'],'resourceId':_0x2b57ab['id'],'type':_0x171ec0[_0x62cf('0x20')],'sectionId':_0x171ec0['id']},{})[_0x62cf('0x15')](function(){return _0x5ca921;});}else{return _0x5ca921;}})[_0x62cf('0x3b')](function(_0x3f1322){logger['error'](_0x62cf('0x47'),_0x3f1322);throw _0x3f1322;});}return _0x5ca921;})[_0x62cf('0x15')](respondWithResult(_0x3221dd,0xc9))[_0x62cf('0x3b')](handleError(_0x3221dd,null));};exports[_0x62cf('0x48')]=function(_0x2e727e,_0x136b0b){if(_0x2e727e[_0x62cf('0x3d')]['id']){delete _0x2e727e['body']['id'];}return db[_0x62cf('0x24')][_0x62cf('0x1f')]({'where':{'id':_0x2e727e[_0x62cf('0x3c')]['id']}})['then'](handleEntityNotFound(_0x136b0b,null))['then'](function(_0x3c5a18){if(_0x3c5a18){return db[_0x62cf('0x24')]['update'](_[_0x62cf('0x32')](_0x2e727e['body'],[_0x62cf('0x3f'),_0x62cf('0x49'),'description',_0x62cf('0x4a'),'cutdigits',_0x62cf('0x4b'),_0x62cf('0x4c')]),{'where':{'context':_0x3c5a18['context'],'exten':_0x3c5a18['exten']},'individualHooks':!![]})[_0x62cf('0x15')](function(_0x43b054){return _0x43b054;});}return null;})[_0x62cf('0x15')](respondWithStatusCode(_0x136b0b,null))[_0x62cf('0x3b')](handleError(_0x136b0b,null));};exports[_0x62cf('0x4d')]=function(_0x1f63d2,_0x2c8200){var _0x488cd0=_0x1f63d2[_0x62cf('0x3c')]['id'];var _0x2e8a2e=_0x1f63d2[_0x62cf('0x3d')];var _0x2837ed=0xc8;var _0x261c6e=null;return db[_0x62cf('0x4e')]['transaction']({'isolationLevel':db['sequelize'][_0x62cf('0x4f')][_0x62cf('0x50')]['READ_COMMITTED']},function(_0x176c60){return db[_0x62cf('0x24')][_0x62cf('0x51')]({'where':{'id':_0x488cd0},'transaction':_0x176c60})[_0x62cf('0x15')](function(_0x3af5d7){if(_0x3af5d7){return db['VoiceExtension'][_0x62cf('0x14')]({'where':{'VoiceExtensionId':_0x488cd0},'transaction':_0x176c60})['then'](function(){var _0x176d52=_['map'](_0x2e8a2e,function(_0x1cfaa4){_0x1cfaa4[_0x62cf('0x52')]=_0x488cd0;_0x1cfaa4['isApp']=!![];return _0x1cfaa4;});return _0x3af5d7[_0x62cf('0x53')](_0x176d52);})[_0x62cf('0x15')](function(_0x2a54ac){return db['VoiceExtension'][_0x62cf('0x54')](_0x2a54ac,{'transaction':_0x176c60});});}else{_0x2837ed=0x194;_0x261c6e=[];}});})[_0x62cf('0x15')](function(){if(_0x2837ed!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x488cd0},'order':_0x62cf('0x55')})[_0x62cf('0x15')](function(_0x1f5f18){_0x261c6e=_0x1f5f18;});}})[_0x62cf('0x3b')](function(_0x1aeaf5){_0x2837ed=0x1f4;logger['error'](_0x1aeaf5[_0x62cf('0x56')]);if(_0x1aeaf5[_0x62cf('0x20')]){delete _0x1aeaf5[_0x62cf('0x20')];}_0x261c6e=_0x1aeaf5;})[_0x62cf('0x57')](function(){if(_0x261c6e===null){_0x2c8200[_0x62cf('0xa')](_0x2837ed);}else{if(_0x2837ed===0x1f4){_0x2c8200[_0x62cf('0xb')](_0x2837ed)[_0x62cf('0x22')](_0x261c6e);}else{_0x2c8200[_0x62cf('0xb')](_0x2837ed)[_0x62cf('0x13')](_0x261c6e);}}});}; \ No newline at end of file +var _0x2d34=['error','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','VoiceExtension','include','params','create','body','exten','role','user','inbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','type','find','value','name','UserProfileResource','end'];(function(_0x587784,_0x5cd472){var _0x371dd2=function(_0x73c1b5){while(--_0x73c1b5){_0x587784['push'](_0x587784['shift']());}};_0x371dd2(++_0x5cd472);}(_0x2d34,0xe9));var _0x42d3=function(_0xa32acd,_0x2c79cc){_0xa32acd=_0xa32acd-0x0;var _0x5a6ac6=_0x2d34[_0xa32acd];return _0x5a6ac6;};'use strict';var _=require('lodash');var Redis=require(_0x42d3('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x42d3('0x1'))(_0x42d3('0x2'));var config=require(_0x42d3('0x3'));var db=require(_0x42d3('0x4'))['db'];config[_0x42d3('0x5')]=_['defaults'](config[_0x42d3('0x5')],{'host':_0x42d3('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42d3('0x5')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x249f3a,_0x5d0610){_0x5d0610=_0x5d0610||0xcc;return function(_0x315bd3){if(_0x315bd3){return _0x249f3a[_0x42d3('0x7')](_0x5d0610);}return _0x249f3a[_0x42d3('0x8')](_0x5d0610)['end']();};}function respondWithResult(_0x26649f,_0x976078){_0x976078=_0x976078||0xc8;return function(_0xe8e8fe){if(_0xe8e8fe){return _0x26649f['status'](_0x976078)['json'](_0xe8e8fe);}};}function respondWithFilteredResult(_0x56100d,_0x450ccd){return function(_0x485b35){if(_0x485b35){var _0x2ce3f9=typeof _0x450ccd[_0x42d3('0x9')]===_0x42d3('0xa')&&typeof _0x450ccd[_0x42d3('0xb')]===_0x42d3('0xa');var _0x1a63e2=_0x485b35['count'];var _0x34db2f=_0x2ce3f9?0x0:_0x450ccd[_0x42d3('0x9')];var _0x16caad=_0x2ce3f9?_0x485b35[_0x42d3('0xc')]:_0x450ccd[_0x42d3('0x9')]+_0x450ccd[_0x42d3('0xb')];var _0xed8441;if(_0x16caad>=_0x1a63e2){_0x16caad=_0x1a63e2;_0xed8441=0xc8;}else{_0xed8441=0xce;}_0x56100d[_0x42d3('0x8')](_0xed8441);return _0x56100d[_0x42d3('0xd')](_0x42d3('0xe'),_0x34db2f+'-'+_0x16caad+'/'+_0x1a63e2)[_0x42d3('0xf')](_0x485b35);}return null;};}function removeEntity(_0xeec58){return function(_0x56f600){if(_0x56f600){return _0x56f600[_0x42d3('0x10')]()[_0x42d3('0x11')](function(){var _0x2eb951=_0x56f600[_0x42d3('0x12')]({'plain':!![]});var _0x3a7d8c=[{'name':_0x42d3('0x13'),'value':'inbound','ignore':![]},{'name':_0x42d3('0x14'),'value':_0x42d3('0x15'),'ignore':![]},{'name':_0x42d3('0x16'),'value':_0x42d3('0x17'),'ignore':![]}];var _0x167fd7=_(_0x3a7d8c)[_0x42d3('0x18')](_0x42d3('0x19'))[_0x42d3('0x1a')]('value')['value']();if(_[_0x42d3('0x1b')](_0x167fd7,_0x2eb951[_0x42d3('0x1c')])){return;}var _0x5988ef=_[_0x42d3('0x1d')](_0x3a7d8c,[_0x42d3('0x1e'),_0x2eb951[_0x42d3('0x1c')]])[_0x42d3('0x1f')];return db[_0x42d3('0x20')][_0x42d3('0x10')]({'where':{'type':_0x5988ef,'resourceId':_0x2eb951['id']}})[_0x42d3('0x11')](function(){return _0x56f600;});})['then'](function(){_0xeec58[_0x42d3('0x8')](0xcc)[_0x42d3('0x21')]();});}};}function handleEntityNotFound(_0x3290e5){return function(_0xfc749a){if(!_0xfc749a){_0x3290e5[_0x42d3('0x7')](0x194);}return _0xfc749a;};}function handleError(_0x4fc8af,_0x5bc65a){_0x5bc65a=_0x5bc65a||0x1f4;return function(_0x454885){logger[_0x42d3('0x22')](_0x454885['stack']);if(_0x454885[_0x42d3('0x1f')]){delete _0x454885[_0x42d3('0x1f')];}_0x4fc8af['status'](_0x5bc65a)[_0x42d3('0x23')](_0x454885);};}exports[_0x42d3('0x24')]=function(_0x59b327,_0x26eb6a){var _0x3dbacd={},_0x2eea8a={},_0x1190c2={'count':0x0,'rows':[]};var _0x39a6c0=_[_0x42d3('0x1a')](db['VoiceExtension'][_0x42d3('0x25')],function(_0x3c161f){return{'name':_0x3c161f[_0x42d3('0x26')],'type':_0x3c161f[_0x42d3('0x1c')][_0x42d3('0x27')]};});_0x2eea8a[_0x42d3('0x28')]=_[_0x42d3('0x1a')](_0x39a6c0,'name');_0x2eea8a[_0x42d3('0x29')]=_[_0x42d3('0x2a')](_0x59b327[_0x42d3('0x29')]);_0x2eea8a[_0x42d3('0x2b')]=_[_0x42d3('0x2c')](_0x2eea8a[_0x42d3('0x28')],_0x2eea8a[_0x42d3('0x29')]);_0x3dbacd[_0x42d3('0x2d')]=_['intersection'](_0x2eea8a['model'],qs[_0x42d3('0x2e')](_0x59b327[_0x42d3('0x29')][_0x42d3('0x2e')]));_0x3dbacd['attributes']=_0x3dbacd[_0x42d3('0x2d')][_0x42d3('0x2f')]?_0x3dbacd[_0x42d3('0x2d')]:_0x2eea8a['model'];if(!_0x59b327[_0x42d3('0x29')][_0x42d3('0x30')](_0x42d3('0x31'))){_0x3dbacd['limit']=qs[_0x42d3('0xb')](_0x59b327[_0x42d3('0x29')]['limit']);_0x3dbacd[_0x42d3('0x9')]=qs[_0x42d3('0x9')](_0x59b327[_0x42d3('0x29')][_0x42d3('0x9')]);}_0x3dbacd['order']=qs['sort'](_0x59b327[_0x42d3('0x29')]['sort']);_0x3dbacd['where']=qs[_0x42d3('0x2b')](_[_0x42d3('0x32')](_0x59b327[_0x42d3('0x29')],_0x2eea8a[_0x42d3('0x2b')]),_0x39a6c0);if(_0x59b327['query'][_0x42d3('0x18')]){_0x3dbacd[_0x42d3('0x33')]=_[_0x42d3('0x34')](_0x3dbacd['where'],{'$or':_[_0x42d3('0x1a')](_0x39a6c0,function(_0x5a516a){if(_0x5a516a[_0x42d3('0x1c')]!==_0x42d3('0x35')){var _0x5e321f={};_0x5e321f[_0x5a516a[_0x42d3('0x1f')]]={'$like':'%'+_0x59b327[_0x42d3('0x29')][_0x42d3('0x18')]+'%'};return _0x5e321f;}})});}_0x3dbacd=_[_0x42d3('0x34')]({},_0x3dbacd,_0x59b327[_0x42d3('0x36')]);var _0x211252={'where':_0x3dbacd[_0x42d3('0x33')]};return db['VoiceExtension'][_0x42d3('0xc')](_0x211252)[_0x42d3('0x11')](function(_0x3d2a40){_0x1190c2[_0x42d3('0xc')]=_0x3d2a40;if(_0x59b327[_0x42d3('0x29')][_0x42d3('0x37')]){_0x3dbacd['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x42d3('0x38')](_0x3dbacd);})[_0x42d3('0x11')](function(_0x59efa1){_0x1190c2['rows']=_0x59efa1;return _0x1190c2;})['then'](respondWithFilteredResult(_0x26eb6a,_0x3dbacd))[_0x42d3('0x39')](handleError(_0x26eb6a,null));};exports[_0x42d3('0x3a')]=function(_0x433716,_0x2485f5){var _0xa75f5={'raw':![],'where':{'id':_0x433716['params']['id']}},_0x365b49={};_0x365b49['model']=_[_0x42d3('0x2a')](db[_0x42d3('0x3b')][_0x42d3('0x25')]);_0x365b49[_0x42d3('0x29')]=_[_0x42d3('0x2a')](_0x433716['query']);_0x365b49[_0x42d3('0x2b')]=_[_0x42d3('0x2c')](_0x365b49['model'],_0x365b49[_0x42d3('0x29')]);_0xa75f5[_0x42d3('0x2d')]=_['intersection'](_0x365b49[_0x42d3('0x28')],qs[_0x42d3('0x2e')](_0x433716[_0x42d3('0x29')][_0x42d3('0x2e')]));_0xa75f5['attributes']=_0xa75f5[_0x42d3('0x2d')][_0x42d3('0x2f')]?_0xa75f5[_0x42d3('0x2d')]:_0x365b49[_0x42d3('0x28')];if(_0x433716[_0x42d3('0x29')]['includeAll']){_0xa75f5[_0x42d3('0x3c')]=[{'all':!![]}];}_0xa75f5=_[_0x42d3('0x34')]({},_0xa75f5,_0x433716[_0x42d3('0x36')]);return db[_0x42d3('0x3b')][_0x42d3('0x1d')](_0xa75f5)[_0x42d3('0x11')](handleEntityNotFound(_0x2485f5,null))[_0x42d3('0x11')](respondWithResult(_0x2485f5,null))[_0x42d3('0x39')](handleError(_0x2485f5,null));};exports['destroy']=function(_0x186c0f,_0x61614b){return db['VoiceExtension'][_0x42d3('0x1d')]({'where':{'id':_0x186c0f[_0x42d3('0x3d')]['id']}})[_0x42d3('0x11')](handleEntityNotFound(_0x61614b,null))[_0x42d3('0x11')](removeEntity(_0x61614b,null))[_0x42d3('0x39')](handleError(_0x61614b,null));};exports[_0x42d3('0x3e')]=function(_0x19163f,_0x516565){if(_0x19163f[_0x42d3('0x3f')][_0x42d3('0x1c')]===_0x42d3('0x15')&&!_['startsWith'](_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')],'_')){_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')]='_'['concat'](_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')]);}return db[_0x42d3('0x3b')][_0x42d3('0x3e')](_0x19163f[_0x42d3('0x3f')],{'raw':![]})['then'](function(_0x292a30){var _0x439e32=_0x19163f['user']['get']({'plain':!![]});if(!_0x439e32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x439e32[_0x42d3('0x41')]===_0x42d3('0x42')){var _0xe11a17=_0x292a30[_0x42d3('0x12')]({'plain':!![]});var _0x17d3af=[{'name':_0x42d3('0x13'),'value':_0x42d3('0x43')},{'name':_0x42d3('0x14'),'value':_0x42d3('0x15')},{'name':_0x42d3('0x16'),'value':_0x42d3('0x17')}];var _0xb0f806=_['find'](_0x17d3af,[_0x42d3('0x1e'),_0xe11a17[_0x42d3('0x1c')]])[_0x42d3('0x1f')];return db[_0x42d3('0x44')][_0x42d3('0x1d')]({'where':{'name':_0xb0f806,'userProfileId':_0x439e32['userProfileId']},'raw':!![]})[_0x42d3('0x11')](function(_0x5ec6be){if(_0x5ec6be&&_0x5ec6be[_0x42d3('0x45')]===0x0){return db['UserProfileResource'][_0x42d3('0x3e')]({'name':_0xe11a17[_0x42d3('0x1f')],'resourceId':_0xe11a17['id'],'type':_0x5ec6be[_0x42d3('0x1f')],'sectionId':_0x5ec6be['id']},{})['then'](function(){return _0x292a30;});}else{return _0x292a30;}})[_0x42d3('0x39')](function(_0x394c3d){logger['error'](_0x42d3('0x46'),_0x394c3d);throw _0x394c3d;});}return _0x292a30;})[_0x42d3('0x11')](respondWithResult(_0x516565,0xc9))[_0x42d3('0x39')](handleError(_0x516565,null));};exports[_0x42d3('0x47')]=function(_0x5097cc,_0x1f39fa){if(_0x5097cc[_0x42d3('0x3f')]['id']){delete _0x5097cc[_0x42d3('0x3f')]['id'];}return db['VoiceExtension'][_0x42d3('0x1d')]({'where':{'id':_0x5097cc[_0x42d3('0x3d')]['id']}})[_0x42d3('0x11')](handleEntityNotFound(_0x1f39fa,null))['then'](function(_0x5273c3){if(_0x5273c3){return db['VoiceExtension'][_0x42d3('0x47')](_[_0x42d3('0x32')](_0x5097cc[_0x42d3('0x3f')],[_0x42d3('0x40'),_0x42d3('0x48'),'description',_0x42d3('0x49'),_0x42d3('0x4a'),_0x42d3('0x4b'),_0x42d3('0x4c')]),{'where':{'context':_0x5273c3[_0x42d3('0x48')],'exten':_0x5273c3['exten']},'individualHooks':!![]})[_0x42d3('0x11')](function(_0x5360ae){return _0x5360ae;});}return null;})[_0x42d3('0x11')](respondWithStatusCode(_0x1f39fa,null))[_0x42d3('0x39')](handleError(_0x1f39fa,null));};exports[_0x42d3('0x4d')]=function(_0xc28b05,_0x23184e){var _0x1f9ec0=_0xc28b05[_0x42d3('0x3d')]['id'];var _0x107504=_0xc28b05['body'];var _0x4c897d=0xc8;var _0x28897e=null;return db['sequelize'][_0x42d3('0x4e')]({'isolationLevel':db[_0x42d3('0x4f')][_0x42d3('0x50')]['ISOLATION_LEVELS'][_0x42d3('0x51')]},function(_0xcc07cf){return db[_0x42d3('0x3b')]['findOne']({'where':{'id':_0x1f9ec0},'transaction':_0xcc07cf})[_0x42d3('0x11')](function(_0x5afbf0){if(_0x5afbf0){return db[_0x42d3('0x3b')][_0x42d3('0x10')]({'where':{'VoiceExtensionId':_0x1f9ec0},'transaction':_0xcc07cf})['then'](function(){var _0x5f897b=_[_0x42d3('0x1a')](_0x107504,function(_0x4046b6){_0x4046b6['VoiceExtensionId']=_0x1f9ec0;_0x4046b6[_0x42d3('0x52')]=!![];return _0x4046b6;});return _0x5afbf0[_0x42d3('0x53')](_0x5f897b);})[_0x42d3('0x11')](function(_0x191999){return db['VoiceExtension'][_0x42d3('0x54')](_0x191999,{'transaction':_0xcc07cf});});}else{_0x4c897d=0x194;_0x28897e=[];}});})[_0x42d3('0x11')](function(){if(_0x4c897d!==0x194){return db[_0x42d3('0x3b')][_0x42d3('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f9ec0},'order':_0x42d3('0x56')})['then'](function(_0x1c4f3f){_0x28897e=_0x1c4f3f;});}})[_0x42d3('0x39')](function(_0x5aa873){_0x4c897d=0x1f4;logger[_0x42d3('0x22')](_0x5aa873[_0x42d3('0x57')]);if(_0x5aa873[_0x42d3('0x1f')]){delete _0x5aa873['name'];}_0x28897e=_0x5aa873;})[_0x42d3('0x58')](function(){if(_0x28897e===null){_0x23184e[_0x42d3('0x7')](_0x4c897d);}else{if(_0x4c897d===0x1f4){_0x23184e[_0x42d3('0x8')](_0x4c897d)[_0x42d3('0x23')](_0x28897e);}else{_0x23184e[_0x42d3('0x8')](_0x4c897d)[_0x42d3('0xf')](_0x28897e);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index af1cfb7..dea1729 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 _0xdaa4=['hook','exports','events','VoiceExtension','save','update','remove','emit','hasOwnProperty'];(function(_0x406ac6,_0x55b90c){var _0x390d72=function(_0x17bcf9){while(--_0x17bcf9){_0x406ac6['push'](_0x406ac6['shift']());}};_0x390d72(++_0x55b90c);}(_0xdaa4,0x16a));var _0x4daa=function(_0x3dbb5d,_0x4d5392){_0x3dbb5d=_0x3dbb5d-0x0;var _0x905117=_0xdaa4[_0x3dbb5d];return _0x905117;};'use strict';var EventEmitter=require(_0x4daa('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x4daa('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4daa('0x2'),'afterUpdate':_0x4daa('0x3'),'afterDestroy':_0x4daa('0x4')};function emitEvent(_0x2fdf9a){return function(_0x24a0e2,_0x467bb9,_0x165cf8){VoiceExtensionEvents['emit'](_0x2fdf9a+':'+_0x24a0e2['id'],_0x24a0e2);VoiceExtensionEvents[_0x4daa('0x5')](_0x2fdf9a,_0x24a0e2);_0x165cf8(null);};}for(var e in events){if(events[_0x4daa('0x6')](e)){var event=events[e];VoiceExtension[_0x4daa('0x7')](e,emitEvent(event));}}module[_0x4daa('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x93f9=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x195583,_0x5d5396){var _0x471930=function(_0xba8fea){while(--_0xba8fea){_0x195583['push'](_0x195583['shift']());}};_0x471930(++_0x5d5396);}(_0x93f9,0xdf));var _0x993f=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x93f9[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0x993f('0x0'));var VoiceExtension=require(_0x993f('0x1'))['db'][_0x993f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x993f('0x3')](0x0);var events={'afterCreate':_0x993f('0x4'),'afterUpdate':_0x993f('0x5'),'afterDestroy':_0x993f('0x6')};function emitEvent(_0x4aa9a4){return function(_0x29aec2,_0x551891,_0x1f150c){VoiceExtensionEvents[_0x993f('0x7')](_0x4aa9a4+':'+_0x29aec2['id'],_0x29aec2);VoiceExtensionEvents[_0x993f('0x7')](_0x4aa9a4,_0x29aec2);_0x1f150c(null);};}for(var e in events){if(events[_0x993f('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x993f('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3fc4c4e..7ad1327 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 _0xaa5c=['CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','wav','trunk','timeout','url','split','length','name','param','phone','prefix','${EXTEN:','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','priority','last','concat','catch','voice_extensions','get','lodash','./voiceExtension.attributes','exports','Set','CDR(type)=','type','exten','alias','CDR(routeAlias)=','context','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','NoOp','No\x20alias\x20set','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x432ae7,_0x1298ef){var _0x2e5271=function(_0xfeca49){while(--_0xfeca49){_0x432ae7['push'](_0x432ae7['shift']());}};_0x2e5271(++_0x1298ef);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x569fe1,_0x5415b9){_0x569fe1=_0x569fe1-0x0;var _0x2b25ed=_0xaa5c[_0x569fe1];return _0x2b25ed;};'use strict';var _=require(_0xcaa5('0x0'));var attributes=require(_0xcaa5('0x1'));module[_0xcaa5('0x2')]=function(_0xecb40a){var _0x54ad1c=_0xecb40a['models'];function _0x5c4f66(_0x4fd28b){var _0x2125b9=0x2;var _0x4d1b66=[{'type':_0x4fd28b['type'],'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0x4')+_0x4fd28b[_0xcaa5('0x5')],'context':_0x4fd28b['context'],'exten':_0x4fd28b[_0xcaa5('0x6')],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']},{'type':_0x4fd28b[_0xcaa5('0x5')],'app':_0x4fd28b[_0xcaa5('0x7')]?_0xcaa5('0x3'):'NoOp','appdata':_0x4fd28b[_0xcaa5('0x7')]?_0xcaa5('0x8')+_0x4fd28b['alias']:'No\x20alias\x20set','context':_0x4fd28b[_0xcaa5('0x9')],'exten':_0x4fd28b[_0xcaa5('0x6')],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']}];if(_0x4fd28b[_0xcaa5('0x5')]==='inbound'){_0x4d1b66[_0xcaa5('0xa')]({'type':'inbound','app':_0xcaa5('0x3'),'appdata':_0xcaa5('0xb')+_0x4fd28b['id'],'context':_0x4fd28b[_0xcaa5('0x9')],'exten':_0x4fd28b[_0xcaa5('0x6')],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']});}_0x4d1b66[_0xcaa5('0xa')]({'type':_0x4fd28b[_0xcaa5('0x5')],'app':_0xcaa5('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4fd28b[_0xcaa5('0x9')],'exten':_0x4fd28b[_0xcaa5('0x6')],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']},{'type':_0x4fd28b[_0xcaa5('0x5')],'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0xc'),'context':_0x4fd28b[_0xcaa5('0x9')],'exten':_0x4fd28b[_0xcaa5('0x6')],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']},{'type':_0x4fd28b[_0xcaa5('0x5')],'app':_0xcaa5('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4fd28b[_0xcaa5('0x9')],'exten':_0x4fd28b['exten'],'priority':_0x2125b9++,'VoiceExtensionId':_0x4fd28b['id']});return _0x4d1b66;}function _0x17e3d2(_0x30c8c0){var _0x5ac8e5=0x2;var _0x37ced2=[{'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0xe'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0['exten'],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':_0x30c8c0[_0xcaa5('0x7')]?_0xcaa5('0x3'):_0xcaa5('0xf'),'appdata':_0x30c8c0['alias']?_0xcaa5('0x8')+_0x30c8c0['alias']:_0xcaa5('0x10'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':'CDR(destination)='+(_0x30c8c0['cutdigits']?'${EXTEN:'+_0x30c8c0[_0xcaa5('0x11')]+'}':'${EXTEN}'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0['exten'],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':'Set','appdata':_0xcaa5('0xb')+_0x30c8c0['id'],'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':'ExecIf','appdata':_0xcaa5('0x12')+(_0x5ac8e5+0x2)+'):Goto('+(_0x5ac8e5+0x1)+')','context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0['exten'],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':_0x30c8c0[_0xcaa5('0x11')]?_0xcaa5('0x13')+_0x30c8c0[_0xcaa5('0x11')]+'}':_0xcaa5('0x14'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':'outbound','app':'Set','appdata':_0xcaa5('0x15'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':'outbound','app':'Set','appdata':_0xcaa5('0xc'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0x16'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':'Set','appdata':_0xcaa5('0x17')+_0x30c8c0['id'],'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']}];if(_0x30c8c0[_0xcaa5('0x18')]('recordingFormat')&&_0x30c8c0[_0xcaa5('0x19')]!=='none'){_0x37ced2[_0xcaa5('0xa')]({'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']},{'type':_0xcaa5('0xd'),'app':_0xcaa5('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x30c8c0[_0xcaa5('0x19')]||_0xcaa5('0x1a'),'context':_0x30c8c0[_0xcaa5('0x9')],'exten':_0x30c8c0[_0xcaa5('0x6')],'priority':_0x5ac8e5++,'VoiceExtensionId':_0x30c8c0['id']});}return _0x37ced2;}function _0x172161(_0x51c51d,_0x4993d5){var _0x3f6b54=[{'name':_0xcaa5('0x1b'),'param':0x0},{'name':_0xcaa5('0x1c'),'param':0x1},{'name':'options','param':0x2},{'name':_0xcaa5('0x1d'),'param':0x3}];var _0x544d36={};var _0x3e6e05=_0x4993d5[_0xcaa5('0x1e')](',');var _0x49f340=[];for(var _0x1a008c=0x0;_0x1a008c<_0x3f6b54[_0xcaa5('0x1f')];_0x1a008c++){switch(_0x3f6b54[_0x1a008c][_0xcaa5('0x20')]){case _0xcaa5('0x1b'):_0x544d36['trunk']=_0x3e6e05[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]][_0xcaa5('0x1e')]('/')[0x1];_0x544d36[_0xcaa5('0x22')]=_0x3e6e05[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]][_0xcaa5('0x1e')]('/')[0x2];_0x544d36[_0xcaa5('0x23')]=_0x544d36[_0xcaa5('0x22')]?_0x544d36[_0xcaa5('0x22')]['split']('$')[0x0]:undefined;_0x544d36[_0xcaa5('0x22')]=_0x51c51d[_0xcaa5('0x11')]?(_0x544d36[_0xcaa5('0x23')]||'')+_0xcaa5('0x24')+_0x51c51d['cutdigits']+'}':(_0x544d36[_0xcaa5('0x23')]||'')+'${EXTEN}';_0x49f340[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]]=[_0xcaa5('0x25'),_0x544d36['trunk'],_0x544d36[_0xcaa5('0x22')]][_0xcaa5('0x26')]('/');break;case _0xcaa5('0x27'):_0x544d36[_0xcaa5('0x27')]=_0x3e6e05[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]];if(_0x51c51d[_0xcaa5('0x19')]!=='none'){if(_0x544d36[_0xcaa5('0x27')][_0xcaa5('0x28')](_0xcaa5('0x29'))<0x0){_0x544d36[_0xcaa5('0x27')]+=_0xcaa5('0x29');}}else{_0x544d36[_0xcaa5('0x27')]=_0x544d36[_0xcaa5('0x27')][_0xcaa5('0x2a')](_0xcaa5('0x29'),'');}_0x49f340[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]]=_0x544d36[_0xcaa5('0x27')];break;default:_0x49f340[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]]=_0x3e6e05[_0x3f6b54[_0x1a008c][_0xcaa5('0x21')]];}}return _0x49f340[_0xcaa5('0x26')](',');}function _0x51bc3c(_0x16cb63,_0x5c1e10,_0x39cef5){return new Promise(function(_0x95c93d,_0x998ca9){var _0x3641ac=[];if(_['isEmpty'](_0x5c1e10))return _0x95c93d(_0x3641ac);_0x54ad1c[_0xcaa5('0x2b')][_0xcaa5('0x2c')]({'attributes':['id',_0xcaa5('0x2d'),_0xcaa5('0x2e')],'raw':!![]})[_0xcaa5('0x2f')](function(_0x350a81){for(var _0x45bd55=0x0,_0x11655e=0x0;_0x45bd55<_0x5c1e10['length'];_0x45bd55++,_0x11655e=0x0){var _0x1763e8=_0x5c1e10[_0x45bd55];var _0x57606f=[];var _0x3b1e7f=[];delete _0x1763e8['id'];if(_0x1763e8[_0xcaa5('0x2d')]!==_0xcaa5('0x30')){_0x1763e8[_0xcaa5('0x31')]=[_0x1763e8[_0xcaa5('0x2d')]];}else{_0x1763e8[_0xcaa5('0x31')]=_0x1763e8[_0xcaa5('0x2e')]?_[_0xcaa5('0x32')](_['filter'](_0x350a81,{'IntervalId':_0x1763e8[_0xcaa5('0x2e')]}),_0xcaa5('0x2d')):[];}_0x1763e8[_0xcaa5('0x9')]=_0x16cb63['context'];_0x1763e8[_0xcaa5('0x6')]=_0x16cb63[_0xcaa5('0x6')];if(_0x1763e8[_0xcaa5('0x5')])_0x1763e8['type']=_0x1763e8[_0xcaa5('0x5')][_0xcaa5('0x33')]();if(_0x16cb63[_0xcaa5('0x5')]===_0xcaa5('0xd')){if(_0x1763e8[_0xcaa5('0x18')](_0xcaa5('0x34'))&&_0x1763e8[_0xcaa5('0x34')]&&_0x1763e8['tag']!=='--'){_0x57606f[_0xcaa5('0xa')]({'type':_0x1763e8['type'][_0xcaa5('0x33')](),'app':'Set','appdata':_0xcaa5('0x35')+_0x1763e8[_0xcaa5('0x34')],'context':_0x16cb63[_0xcaa5('0x9')],'exten':_0x16cb63[_0xcaa5('0x6')],'priority':_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});}_0x57606f[_0xcaa5('0xa')]({'type':_0x1763e8[_0xcaa5('0x5')]['toLowerCase'](),'app':_0xcaa5('0x36'),'appdata':_0xcaa5('0x37')+(_0x1763e8[_0xcaa5('0x38')]?_0xcaa5('0x39')+_0x1763e8[_0xcaa5('0x38')]+')':_0xcaa5('0x3a')),'context':_0x16cb63[_0xcaa5('0x9')],'exten':_0x16cb63[_0xcaa5('0x6')],'priority':_0x1763e8['intervals'][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});}else{if(_0x1763e8[_0xcaa5('0x18')](_0xcaa5('0x3b'))){if(['queue','playback']['includes'](_0x1763e8['app']['toLowerCase']())&&_0x1763e8['appType']!==_0xcaa5('0x3c')){if(_0x1763e8[_0xcaa5('0x3b')]){_0x57606f[_0xcaa5('0xa')]({'type':_0x1763e8[_0xcaa5('0x5')][_0xcaa5('0x33')](),'app':_0xcaa5('0x36'),'appdata':_0xcaa5('0x3d'),'context':_0x16cb63[_0xcaa5('0x9')],'exten':_0x16cb63[_0xcaa5('0x6')],'priority':_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});_0x57606f[_0xcaa5('0xa')]({'type':_0x1763e8[_0xcaa5('0x5')][_0xcaa5('0x33')](),'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0x3e'),'context':_0x16cb63[_0xcaa5('0x9')],'exten':_0x16cb63['exten'],'priority':_0x1763e8['intervals'][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});}else{_0x57606f[_0xcaa5('0xa')]({'type':_0x1763e8['type'][_0xcaa5('0x33')](),'app':_0xcaa5('0x36'),'appdata':_0xcaa5('0x3f'),'context':_0x16cb63[_0xcaa5('0x9')],'exten':_0x16cb63[_0xcaa5('0x6')],'priority':_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});_0x57606f['push']({'type':_0x1763e8[_0xcaa5('0x5')]['toLowerCase'](),'app':_0xcaa5('0x3'),'appdata':_0xcaa5('0x40'),'context':_0x16cb63['context'],'exten':_0x16cb63[_0xcaa5('0x6')],'priority':_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')]+_0x39cef5+_0x11655e++,'VoiceExtensionId':_0x16cb63['id']});}}}}for(var _0x9488e6=0x0;_0x9488e6<_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')];_0x9488e6++){var _0x1f5cda=_0x39cef5+_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')];var _0x4f7355=_0x9488e6===_0x1763e8[_0xcaa5('0x31')][_0xcaa5('0x1f')]-0x1?_0x39cef5+_0x57606f['length']+_0x3b1e7f['length']+0x2:_0x39cef5+_0x9488e6+0x1;_0x57606f['splice'](_0x9488e6,0x0,{'type':_0x16cb63['type'],'app':_0xcaa5('0x41'),'appdata':_0x1763e8['intervals'][_0x9488e6]+'?'+_0x16cb63[_0xcaa5('0x9')]+_0xcaa5('0x42')+_0x1f5cda+':'+_0x16cb63[_0xcaa5('0x9')]+_0xcaa5('0x42')+_0x4f7355,'exten':_0x16cb63[_0xcaa5('0x6')],'context':_0x16cb63['context'],'priority':_0x39cef5+_0x9488e6,'VoiceExtensionId':_0x16cb63['id']});}if(_0x1763e8['appType']===_0xcaa5('0x43'))_0x1763e8['appdata']=_0x172161(_0x16cb63,_0x1763e8['appdata']);_0x1763e8[_0xcaa5('0x44')]=_0x57606f[_0xcaa5('0x1f')]?_[_0xcaa5('0x45')](_0x57606f)[_0xcaa5('0x44')]+0x1:_0x39cef5;_0x3641ac=_[_0xcaa5('0x46')](_0x3641ac,_0x57606f,[_0x1763e8],_0x3b1e7f);_0x39cef5=_[_0xcaa5('0x45')](_0x3641ac)[_0xcaa5('0x44')]+0x1;}return _0x95c93d(_0x3641ac);})[_0xcaa5('0x47')](function(_0x404288){_0x998ca9(_0x404288);});});}return _0xecb40a['define']('VoiceExtension',attributes,{'tableName':_0xcaa5('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x49e7ea){var _0x49f7dd=this[_0xcaa5('0x49')]({'plain':!![]});var _0x847994=_0x49f7dd[_0xcaa5('0x5')]==='outbound'?_0x17e3d2(_0x49f7dd):_0x5c4f66(_0x49f7dd);return _0x51bc3c(_0x49f7dd,_0x49e7ea,_[_0xcaa5('0x45')](_0x847994)[_0xcaa5('0x44')]+0x1)[_0xcaa5('0x2f')](function(_0xd4e46e){var _0x8b6969=_[_0xcaa5('0x46')](_0x847994,_0xd4e46e);_0x8b6969[_0xcaa5('0xa')]({'type':_0x49f7dd['type'],'app':'Hangup','exten':_0x49f7dd[_0xcaa5('0x6')],'context':_0x49f7dd[_0xcaa5('0x9')],'priority':_[_0xcaa5('0x45')](_0x8b6969)[_0xcaa5('0x44')]+0x1,'VoiceExtensionId':_0x49f7dd['id']});return _0x8b6969;});}}});}; \ No newline at end of file +var _0x70a1=['GotoIfTime',',${EXTEN},','appType','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','NoOp','alias','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','playback','app','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice'];(function(_0x462b3a,_0x52fa71){var _0xbc5daa=function(_0x10dc88){while(--_0x10dc88){_0x462b3a['push'](_0x462b3a['shift']());}};_0xbc5daa(++_0x52fa71);}(_0x70a1,0x154));var _0x170a=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x70a1[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0x170a('0x0'));var attributes=require(_0x170a('0x1'));module[_0x170a('0x2')]=function(_0x4b3c6e){var _0x4c0f14=_0x4b3c6e['models'];function _0x278333(_0x31a95f){var _0x1dcca8=0x2;var _0x5ed819=[{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':_0x170a('0x5')+_0x31a95f[_0x170a('0x3')],'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f['type'],'app':_0x31a95f['alias']?_0x170a('0x4'):_0x170a('0x8'),'appdata':_0x31a95f[_0x170a('0x9')]?'CDR(routeAlias)='+_0x31a95f['alias']:_0x170a('0xa'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']}];if(_0x31a95f[_0x170a('0x3')]===_0x170a('0xb')){_0x5ed819['push']({'type':_0x170a('0xb'),'app':_0x170a('0x4'),'appdata':_0x170a('0xc')+_0x31a95f['id'],'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']});}_0x5ed819[_0x170a('0xd')]({'type':_0x31a95f[_0x170a('0x3')],'app':'Set','appdata':_0x170a('0xe'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':_0x170a('0xf'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']});return _0x5ed819;}function _0x259daa(_0x48074c){var _0x22ea4e=0x2;var _0x15603d=[{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x11'),'context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x48074c['alias']?_0x170a('0x4'):_0x170a('0x8'),'appdata':_0x48074c[_0x170a('0x9')]?_0x170a('0x12')+_0x48074c[_0x170a('0x9')]:_0x170a('0xa'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x13')+(_0x48074c[_0x170a('0x14')]?_0x170a('0x15')+_0x48074c[_0x170a('0x14')]+'}':_0x170a('0x16')),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0xc')+_0x48074c['id'],'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':'ExecIf','appdata':_0x170a('0x17')+(_0x22ea4e+0x2)+_0x170a('0x18')+(_0x22ea4e+0x1)+')','context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x48074c[_0x170a('0x14')]?_0x170a('0x19')+_0x48074c[_0x170a('0x14')]+'}':_0x170a('0x1a'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0xf'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x1b')+_0x48074c['id'],'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']}];if(_0x48074c[_0x170a('0x1c')](_0x170a('0x1d'))&&_0x48074c[_0x170a('0x1d')]!=='none'){_0x15603d[_0x170a('0xd')]({'type':_0x170a('0x10'),'app':'Set','appdata':_0x170a('0x1e'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x48074c[_0x170a('0x1d')]||_0x170a('0x1f'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']});}return _0x15603d;}function _0xcb33be(_0x7c95c9,_0xe302fb){var _0x4cf6d4=[{'name':_0x170a('0x20'),'param':0x0},{'name':_0x170a('0x21'),'param':0x1},{'name':_0x170a('0x22'),'param':0x2},{'name':_0x170a('0x23'),'param':0x3}];var _0x5a7ef6={};var _0x5c4aed=_0xe302fb[_0x170a('0x24')](',');var _0x209f8e=[];for(var _0x4d436a=0x0;_0x4d436a<_0x4cf6d4[_0x170a('0x25')];_0x4d436a++){switch(_0x4cf6d4[_0x4d436a][_0x170a('0x26')]){case _0x170a('0x20'):_0x5a7ef6[_0x170a('0x20')]=_0x5c4aed[_0x4cf6d4[_0x4d436a]['param']][_0x170a('0x24')]('/')[0x1];_0x5a7ef6[_0x170a('0x27')]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]][_0x170a('0x24')]('/')[0x2];_0x5a7ef6[_0x170a('0x29')]=_0x5a7ef6[_0x170a('0x27')]?_0x5a7ef6[_0x170a('0x27')][_0x170a('0x24')]('$')[0x0]:undefined;_0x5a7ef6[_0x170a('0x27')]=_0x7c95c9[_0x170a('0x14')]?(_0x5a7ef6[_0x170a('0x29')]||'')+'${EXTEN:'+_0x7c95c9['cutdigits']+'}':(_0x5a7ef6[_0x170a('0x29')]||'')+_0x170a('0x16');_0x209f8e[_0x4cf6d4[_0x4d436a]['param']]=[_0x170a('0x2a'),_0x5a7ef6[_0x170a('0x20')],_0x5a7ef6['phone']][_0x170a('0x2b')]('/');break;case _0x170a('0x22'):_0x5a7ef6[_0x170a('0x22')]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]];if(_0x7c95c9['recordingFormat']!=='none'){if(_0x5a7ef6['options'][_0x170a('0x2c')](_0x170a('0x2d'))<0x0){_0x5a7ef6[_0x170a('0x22')]+=_0x170a('0x2d');}}else{_0x5a7ef6[_0x170a('0x22')]=_0x5a7ef6[_0x170a('0x22')][_0x170a('0x2e')](_0x170a('0x2d'),'');}_0x209f8e[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]]=_0x5a7ef6[_0x170a('0x22')];break;default:_0x209f8e[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]];}}return _0x209f8e['join'](',');}function _0x3fdb33(_0x557dbb,_0x2e8375,_0x33d382){return new Promise(function(_0x52e14e,_0x5e9265){var _0x3aa1c5=[];if(_[_0x170a('0x2f')](_0x2e8375))return _0x52e14e(_0x3aa1c5);_0x4c0f14[_0x170a('0x30')][_0x170a('0x31')]({'attributes':['id',_0x170a('0x32'),_0x170a('0x33')],'raw':!![]})[_0x170a('0x34')](function(_0xcc64f4){for(var _0x451a97=0x0,_0xe96db1=0x0;_0x451a97<_0x2e8375[_0x170a('0x25')];_0x451a97++,_0xe96db1=0x0){var _0x381423=_0x2e8375[_0x451a97];var _0x276a6b=[];var _0x443a45=[];delete _0x381423['id'];if(_0x381423['interval']!==_0x170a('0x35')){_0x381423[_0x170a('0x36')]=[_0x381423['interval']];}else{_0x381423[_0x170a('0x36')]=_0x381423[_0x170a('0x33')]?_[_0x170a('0x37')](_['filter'](_0xcc64f4,{'IntervalId':_0x381423[_0x170a('0x33')]}),_0x170a('0x32')):[];}_0x381423[_0x170a('0x6')]=_0x557dbb['context'];_0x381423[_0x170a('0x7')]=_0x557dbb[_0x170a('0x7')];if(_0x381423[_0x170a('0x3')])_0x381423['type']=_0x381423[_0x170a('0x3')]['toLowerCase']();if(_0x557dbb[_0x170a('0x3')]===_0x170a('0x10')){if(_0x381423['hasOwnProperty'](_0x170a('0x38'))&&_0x381423['tag']&&_0x381423['tag']!=='--'){_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':'Set','appdata':_0x170a('0x3a')+_0x381423[_0x170a('0x38')],'context':_0x557dbb['context'],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}_0x276a6b[_0x170a('0xd')]({'type':_0x381423['type'][_0x170a('0x39')](),'app':_0x170a('0x3b'),'appdata':_0x170a('0x3c')+(_0x381423[_0x170a('0x3d')]?'Set(CALLERID(all)='+_0x381423[_0x170a('0x3d')]+')':_0x170a('0x3e')),'context':_0x557dbb['context'],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}else{if(_0x381423['hasOwnProperty'](_0x170a('0x3f'))){if(['queue',_0x170a('0x40')]['includes'](_0x381423[_0x170a('0x41')][_0x170a('0x39')]())&&_0x381423['appType']!=='custom'){if(_0x381423[_0x170a('0x3f')]){_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':_0x170a('0x3b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423[_0x170a('0x36')]['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':'Set','appdata':_0x170a('0x42'),'context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423['intervals']['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}else{_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')]['toLowerCase'](),'app':_0x170a('0x3b'),'appdata':_0x170a('0x43'),'context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')]['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});_0x276a6b['push']({'type':_0x381423[_0x170a('0x3')]['toLowerCase'](),'app':_0x170a('0x4'),'appdata':_0x170a('0x44'),'context':_0x557dbb['context'],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}}}}for(var _0x3a3469=0x0;_0x3a3469<_0x381423[_0x170a('0x36')]['length'];_0x3a3469++){var _0x1988e5=_0x33d382+_0x381423[_0x170a('0x36')][_0x170a('0x25')];var _0x22cfde=_0x3a3469===_0x381423[_0x170a('0x36')][_0x170a('0x25')]-0x1?_0x33d382+_0x276a6b['length']+_0x443a45[_0x170a('0x25')]+0x2:_0x33d382+_0x3a3469+0x1;_0x276a6b[_0x170a('0x45')](_0x3a3469,0x0,{'type':_0x557dbb[_0x170a('0x3')],'app':_0x170a('0x46'),'appdata':_0x381423['intervals'][_0x3a3469]+'?'+_0x557dbb[_0x170a('0x6')]+_0x170a('0x47')+_0x1988e5+':'+_0x557dbb[_0x170a('0x6')]+',${EXTEN},'+_0x22cfde,'exten':_0x557dbb[_0x170a('0x7')],'context':_0x557dbb[_0x170a('0x6')],'priority':_0x33d382+_0x3a3469,'VoiceExtensionId':_0x557dbb['id']});}if(_0x381423[_0x170a('0x48')]==='outboundDial')_0x381423['appdata']=_0xcb33be(_0x557dbb,_0x381423[_0x170a('0x49')]);_0x381423[_0x170a('0x4a')]=_0x276a6b[_0x170a('0x25')]?_[_0x170a('0x4b')](_0x276a6b)['priority']+0x1:_0x33d382;_0x3aa1c5=_[_0x170a('0x4c')](_0x3aa1c5,_0x276a6b,[_0x381423],_0x443a45);_0x33d382=_[_0x170a('0x4b')](_0x3aa1c5)[_0x170a('0x4a')]+0x1;}return _0x52e14e(_0x3aa1c5);})[_0x170a('0x4d')](function(_0x407df0){_0x5e9265(_0x407df0);});});}return _0x4b3c6e[_0x170a('0x4e')]('VoiceExtension',attributes,{'tableName':_0x170a('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f6864){var _0x3bd36d=this[_0x170a('0x50')]({'plain':!![]});var _0x1c7607=_0x3bd36d[_0x170a('0x3')]===_0x170a('0x10')?_0x259daa(_0x3bd36d):_0x278333(_0x3bd36d);return _0x3fdb33(_0x3bd36d,_0x4f6864,_['last'](_0x1c7607)['priority']+0x1)[_0x170a('0x34')](function(_0x97d182){var _0x277475=_[_0x170a('0x4c')](_0x1c7607,_0x97d182);_0x277475[_0x170a('0xd')]({'type':_0x3bd36d[_0x170a('0x3')],'app':_0x170a('0x51'),'exten':_0x3bd36d[_0x170a('0x7')],'context':_0x3bd36d[_0x170a('0x6')],'priority':_[_0x170a('0x4b')](_0x277475)[_0x170a('0x4a')]+0x1,'VoiceExtensionId':_0x3bd36d['id']});return _0x277475;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 970a818..3d27ca7 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 _0xb7a7=['model','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','map'];(function(_0xcba291,_0x10e9d5){var _0x162274=function(_0x38100e){while(--_0x38100e){_0xcba291['push'](_0xcba291['shift']());}};_0x162274(++_0x10e9d5);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x4594de,_0x3e4e2b){_0x4594de=_0x4594de-0x0;var _0x3a1dfe=_0xb7a7[_0x4594de];return _0x3a1dfe;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var moment=require(_0x7b7a('0x2'));var BPromise=require(_0x7b7a('0x3'));var rs=require(_0x7b7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7b7a('0x5'));var logger=require(_0x7b7a('0x6'))(_0x7b7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x7b7a('0x8'));var client=jayson[_0x7b7a('0x9')][_0x7b7a('0xa')]({'port':0x232a});config[_0x7b7a('0xb')]=_[_0x7b7a('0xc')](config[_0x7b7a('0xb')],{'host':_0x7b7a('0xd'),'port':0x18eb});var socket=require(_0x7b7a('0xe'))(new Redis(config[_0x7b7a('0xb')]));require('./voiceExtension.socket')[_0x7b7a('0xf')](socket);function respondWithRpcPromise(_0x53da4d,_0x14ed0e,_0x21c573){return new BPromise(function(_0x3f563e,_0x365e4e){return client[_0x7b7a('0x10')](_0x53da4d,_0x21c573)['then'](function(_0x5207bb){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x14ed0e,_0x7b7a('0x11'));logger[_0x7b7a('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x14ed0e,_0x7b7a('0x11'),JSON[_0x7b7a('0x13')](_0x5207bb));if(_0x5207bb[_0x7b7a('0x14')]){if(_0x5207bb[_0x7b7a('0x14')][_0x7b7a('0x15')]===0x1f4){logger[_0x7b7a('0x14')](_0x7b7a('0x16'),_0x14ed0e,_0x5207bb[_0x7b7a('0x14')][_0x7b7a('0x17')]);return _0x365e4e(_0x5207bb[_0x7b7a('0x14')]['message']);}logger['error'](_0x7b7a('0x16'),_0x14ed0e,_0x5207bb[_0x7b7a('0x14')][_0x7b7a('0x17')]);return _0x3f563e(_0x5207bb[_0x7b7a('0x14')][_0x7b7a('0x17')]);}else{logger['info'](_0x7b7a('0x16'),_0x14ed0e,'request\x20sent');_0x3f563e(_0x5207bb[_0x7b7a('0x18')][_0x7b7a('0x17')]);}})[_0x7b7a('0x19')](function(_0x35e2d4){logger[_0x7b7a('0x14')](_0x7b7a('0x16'),_0x14ed0e,_0x35e2d4);_0x365e4e(_0x35e2d4);});});}exports[_0x7b7a('0x1a')]=function(_0x3dd0ab){var _0x2cb0b4=this;return new Promise(function(_0x1c897d,_0x110d8d){return db[_0x7b7a('0x1b')]['findAll']({'raw':_0x3dd0ab['options']?_0x3dd0ab[_0x7b7a('0x1c')][_0x7b7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x3dd0ab[_0x7b7a('0x1c')]?_0x3dd0ab['options'][_0x7b7a('0x1e')]||null:null,'attributes':_0x3dd0ab[_0x7b7a('0x1c')]?_0x3dd0ab['options'][_0x7b7a('0x1f')]||null:null,'limit':_0x3dd0ab[_0x7b7a('0x1c')]?_0x3dd0ab['options']['limit']||null:null,'include':_0x3dd0ab[_0x7b7a('0x1c')]?_0x3dd0ab[_0x7b7a('0x1c')][_0x7b7a('0x20')]?_[_0x7b7a('0x21')](_0x3dd0ab[_0x7b7a('0x1c')][_0x7b7a('0x20')],function(_0x2d15e5){return{'model':db[_0x2d15e5[_0x7b7a('0x22')]],'as':_0x2d15e5['as'],'attributes':_0x2d15e5[_0x7b7a('0x1f')],'include':_0x2d15e5[_0x7b7a('0x20')]?_[_0x7b7a('0x21')](_0x2d15e5[_0x7b7a('0x20')],function(_0x3322cb){return{'model':db[_0x3322cb['model']],'as':_0x3322cb['as'],'attributes':_0x3322cb[_0x7b7a('0x1f')],'include':_0x3322cb[_0x7b7a('0x20')]?_[_0x7b7a('0x21')](_0x3322cb[_0x7b7a('0x20')],function(_0x5ebead){return{'model':db[_0x5ebead[_0x7b7a('0x22')]],'as':_0x5ebead['as'],'attributes':_0x5ebead[_0x7b7a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b7a('0x23')](function(_0x4769a0){logger['info'](_0x7b7a('0x1a'),_0x3dd0ab);logger[_0x7b7a('0x12')](_0x7b7a('0x1a'),_0x3dd0ab,JSON[_0x7b7a('0x13')](_0x4769a0));_0x1c897d(_0x4769a0);})[_0x7b7a('0x19')](function(_0x303bd4){logger[_0x7b7a('0x14')]('GetVoiceExtension',_0x303bd4[_0x7b7a('0x17')],_0x3dd0ab);_0x110d8d(_0x2cb0b4[_0x7b7a('0x14')](0x1f4,_0x303bd4[_0x7b7a('0x17')]));});});}; \ No newline at end of file +var _0xc9ab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','moment'];(function(_0x4de5bd,_0x3b51b3){var _0x27a717=function(_0x213510){while(--_0x213510){_0x4de5bd['push'](_0x4de5bd['shift']());}};_0x27a717(++_0x3b51b3);}(_0xc9ab,0x125));var _0xbc9a=function(_0x4c3852,_0x16821a){_0x4c3852=_0x4c3852-0x0;var _0x137bd7=_0xc9ab[_0x4c3852];return _0x137bd7;};'use strict';var _=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var moment=require(_0xbc9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9a('0x3'))['db'];var utils=require(_0xbc9a('0x4'));var logger=require(_0xbc9a('0x5'))(_0xbc9a('0x6'));var config=require(_0xbc9a('0x7'));var jayson=require(_0xbc9a('0x8'));var client=jayson[_0xbc9a('0x9')][_0xbc9a('0xa')]({'port':0x232a});config[_0xbc9a('0xb')]=_[_0xbc9a('0xc')](config[_0xbc9a('0xb')],{'host':_0xbc9a('0xd'),'port':0x18eb});var socket=require(_0xbc9a('0xe'))(new Redis(config[_0xbc9a('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x5919c4,_0x2d927f,_0x58f385){return new BPromise(function(_0x3ba3bc,_0x389904){return client['request'](_0x5919c4,_0x58f385)['then'](function(_0x565aa4){logger[_0xbc9a('0xf')](_0xbc9a('0x10'),_0x2d927f,'request\x20sent');logger[_0xbc9a('0x11')](_0xbc9a('0x12'),_0x2d927f,_0xbc9a('0x13'),JSON[_0xbc9a('0x14')](_0x565aa4));if(_0x565aa4[_0xbc9a('0x15')]){if(_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x16')]===0x1f4){logger['error'](_0xbc9a('0x10'),_0x2d927f,_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);return _0x389904(_0x565aa4['error']['message']);}logger[_0xbc9a('0x15')](_0xbc9a('0x10'),_0x2d927f,_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);return _0x3ba3bc(_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2d927f,_0xbc9a('0x13'));_0x3ba3bc(_0x565aa4[_0xbc9a('0x18')]['message']);}})[_0xbc9a('0x19')](function(_0x24d578){logger[_0xbc9a('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x2d927f,_0x24d578);_0x389904(_0x24d578);});});}exports[_0xbc9a('0x1a')]=function(_0x2969ef){var _0x2aeb35=this;return new Promise(function(_0x24032b,_0x44cde0){return db[_0xbc9a('0x1b')][_0xbc9a('0x1c')]({'raw':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x1e')]===undefined?!![]:![]:!![],'where':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef['options']['where']||null:null,'attributes':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x1f')]||null:null,'limit':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x20')]||null:null,'include':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x21')],function(_0x5dd6b2){return{'model':db[_0x5dd6b2[_0xbc9a('0x23')]],'as':_0x5dd6b2['as'],'attributes':_0x5dd6b2[_0xbc9a('0x1f')],'include':_0x5dd6b2[_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x5dd6b2[_0xbc9a('0x21')],function(_0x379256){return{'model':db[_0x379256[_0xbc9a('0x23')]],'as':_0x379256['as'],'attributes':_0x379256['attributes'],'include':_0x379256[_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x379256[_0xbc9a('0x21')],function(_0x47b196){return{'model':db[_0x47b196[_0xbc9a('0x23')]],'as':_0x47b196['as'],'attributes':_0x47b196[_0xbc9a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc9a('0x24')](function(_0x2fdf64){logger[_0xbc9a('0xf')](_0xbc9a('0x1a'),_0x2969ef);logger[_0xbc9a('0x11')](_0xbc9a('0x1a'),_0x2969ef,JSON[_0xbc9a('0x14')](_0x2fdf64));_0x24032b(_0x2fdf64);})['catch'](function(_0x2d3231){logger[_0xbc9a('0x15')]('GetVoiceExtension',_0x2d3231['message'],_0x2969ef);_0x44cde0(_0x2aeb35[_0xbc9a('0x15')](0x1f4,_0x2d3231[_0xbc9a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 24e2ddb..fa6fd01 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 _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x3bcd0f,_0x4aa133){var _0xb355aa=function(_0x419a08){while(--_0x419a08){_0x3bcd0f['push'](_0x3bcd0f['shift']());}};_0xb355aa(++_0x4aa133);}(_0x2ef3,0xba));var _0x32ef=function(_0x51baab,_0x37edd9){_0x51baab=_0x51baab-0x0;var _0x12b29f=_0x2ef3[_0x51baab];return _0x12b29f;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x1607f2,_0x154ae7){var _0x3a5166=function(_0xead263){while(--_0xead263){_0x1607f2['push'](_0x1607f2['shift']());}};_0x3a5166(++_0x154ae7);}(_0x326f,0xd1));var _0xf326=function(_0x5ae5c8,_0x1104b1){_0x5ae5c8=_0x5ae5c8-0x0;var _0x2ea3fe=_0x326f[_0x5ae5c8];return _0x2ea3fe;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a0dfafe..1276dd2 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 _0xd117=['./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4ff685,_0x282dce){var _0x10522f=function(_0x2e977a){while(--_0x2e977a){_0x4ff685['push'](_0x4ff685['shift']());}};_0x10522f(++_0x282dce);}(_0xd117,0x182));var _0x7d11=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xd117[_0x2fbcf6];return _0x3e7265;};'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')]('/',auth[_0x7d11('0xc')](),controller['create']);router[_0x7d11('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x14')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module[_0x7d11('0x15')]=router; \ No newline at end of file +var _0x1623=['/:id','show','get','/:id/messages','getMessages','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','isAuthenticated','index'];(function(_0x60b921,_0x13c29d){var _0x57d238=function(_0x588570){while(--_0x588570){_0x60b921['push'](_0x60b921['shift']());}};_0x57d238(++_0x13c29d);}(_0x1623,0xab));var _0x3162=function(_0x336787,_0x577ce1){_0x336787=_0x336787-0x0;var _0x1474bb=_0x1623[_0x336787];return _0x1474bb;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0xf')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);module[_0x3162('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index be94fd0..15d9148 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 _0xb3c0=['\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x69b7ac,_0x25941a){var _0x4bb67e=function(_0x421966){while(--_0x421966){_0x69b7ac['push'](_0x69b7ac['shift']());}};_0x4bb67e(++_0x25941a);}(_0xb3c0,0xf2));var _0x0b3c=function(_0x3d326b,_0x8a8a1e){_0x3d326b=_0x3d326b-0x0;var _0x119033=_0xb3c0[_0x3d326b];return _0x119033;};'use strict';var Sequelize=require(_0x0b3c('0x0'));module[_0x0b3c('0x1')]={'customer_id':{'type':Sequelize[_0x0b3c('0x2')]},'context':{'type':Sequelize[_0x0b3c('0x2')],'defaultValue':_0x0b3c('0x3'),'unique':_0x0b3c('0x4')},'mailbox':{'type':Sequelize[_0x0b3c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0b3c('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0b3c('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3ef5ad){this[_0x0b3c('0x5')](_0x0b3c('0x6'),typeof _0x3ef5ad===_0x0b3c('0x7')&&_0x3ef5ad[_0x0b3c('0x8')]()?_0x3ef5ad[_0x0b3c('0x8')]():null);}},'pager':{'type':Sequelize[_0x0b3c('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0b3c('0x9')},'attach':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':_0x0b3c('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0b3c('0xa')]('yes','no'),'defaultValue':_0x0b3c('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0b3c('0x2')]},'callback':{'type':Sequelize[_0x0b3c('0x2')]},'review':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0b3c('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':_0x0b3c('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0b3c('0xa')](_0x0b3c('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0b3c('0xd')},'emailsubject':{'type':Sequelize[_0x0b3c('0x2')]},'emailbody':{'type':Sequelize[_0x0b3c('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0b3c('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0b3c('0xf')],'get':function(){return this[_0x0b3c('0x10')](_0x0b3c('0x11'))+_0x0b3c('0x12')+this[_0x0b3c('0x10')](_0x0b3c('0x13'));}}}; \ No newline at end of file +var _0x75ed=['setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox','STRING'];(function(_0x1230e6,_0x1031ce){var _0x4e7cc5=function(_0x2041ed){while(--_0x2041ed){_0x1230e6['push'](_0x1230e6['shift']());}};_0x4e7cc5(++_0x1031ce);}(_0x75ed,0x15b));var _0xd75e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x75ed[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xd75e('0x0'));module[_0xd75e('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xd75e('0x2'),'unique':_0xd75e('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xd75e('0x4')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd75e('0x4')],'validate':{'isEmail':!![]},'set':function(_0x1c51e4){this[_0xd75e('0x5')]('email',typeof _0x1c51e4===_0xd75e('0x6')&&_0x1c51e4[_0xd75e('0x7')]()?_0x1c51e4[_0xd75e('0x7')]():null);}},'pager':{'type':Sequelize[_0xd75e('0x4')]},'tz':{'type':Sequelize[_0xd75e('0x4')],'defaultValue':_0xd75e('0x8')},'attach':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd75e('0x4')]},'callback':{'type':Sequelize[_0xd75e('0x4')]},'review':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'stamp':{'type':_0xd75e('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xd75e('0x4')]},'maxsecs':{'type':Sequelize[_0xd75e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd75e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd75e('0xd')]('fullname')+_0xd75e('0xe')+this[_0xd75e('0xd')](_0xd75e('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 7f148ca..02d8805 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 _0x1d2d=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','catch','update','find','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3d4f22,_0x3e8509){_0x3d4f22=_0x3d4f22-0x0;var _0x2ffbc8=_0x1d2d[_0x3d4f22];return _0x2ffbc8;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){var _0x5df4af=_0x3f229c[_0xd1d2('0x28')]({'plain':!![]});var _0x42da6d=_0xd1d2('0x29');return db[_0xd1d2('0x2a')][_0xd1d2('0x27')]({'where':{'type':_0x42da6d,'resourceId':_0x5df4af['id']}})[_0xd1d2('0x26')](function(){return _0x3f229c;});})[_0xd1d2('0x26')](function(){_0x19d535[_0xd1d2('0x1c')](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x384460,_0x3645e9){return function(_0x4e1bc2){if(!_0x4e1bc2){_0x384460['sendStatus'](0x194);}return _0x4e1bc2;};}function handleError(_0x133c6c,_0x442375){_0x442375=_0x442375||0x1f4;return function(_0x1e6072){logger[_0xd1d2('0x2b')](_0x1e6072[_0xd1d2('0x2c')]);if(_0x1e6072['name']){delete _0x1e6072[_0xd1d2('0x2d')];}_0x133c6c[_0xd1d2('0x1c')](_0x442375)[_0xd1d2('0x2e')](_0x1e6072);};}exports['index']=function(_0x19db00,_0x1db17f){var _0xbd855a={},_0x56557d={},_0x419db7={'count':0x0,'rows':[]};var _0x18528f=_[_0xd1d2('0x2f')](db[_0xd1d2('0x30')][_0xd1d2('0x31')],function(_0x14d661){return{'name':_0x14d661[_0xd1d2('0x32')],'type':_0x14d661[_0xd1d2('0x33')][_0xd1d2('0x34')]};});_0x56557d[_0xd1d2('0x35')]=_[_0xd1d2('0x2f')](_0x18528f,_0xd1d2('0x2d'));_0x56557d[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x19db00[_0xd1d2('0x36')]);_0x56557d[_0xd1d2('0x38')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],_0x56557d['query']);_0xbd855a[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],qs['fields'](_0x19db00[_0xd1d2('0x36')]['fields']));_0xbd855a['attributes']=_0xbd855a[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0xbd855a[_0xd1d2('0x3a')]:_0x56557d[_0xd1d2('0x35')];if(!_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x3c')]('nolimit')){_0xbd855a[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x19db00['query'][_0xd1d2('0x21')]);_0xbd855a[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x19db00[_0xd1d2('0x36')]['offset']);}_0xbd855a['order']=qs[_0xd1d2('0x3d')](_0x19db00['query']['sort']);_0xbd855a['where']=qs[_0xd1d2('0x38')](_['pick'](_0x19db00[_0xd1d2('0x36')],_0x56557d['filters']),_0x18528f);if(_0x19db00['query']['filter']){_0xbd855a[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0xbd855a[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x18528f,function(_0x33ba30){if(_0x33ba30[_0xd1d2('0x33')]!==_0xd1d2('0x40')){var _0x38bf16={};_0x38bf16[_0x33ba30[_0xd1d2('0x2d')]]={'$like':'%'+_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x38bf16;}})});}_0xbd855a=_[_0xd1d2('0x3f')]({},_0xbd855a,_0x19db00[_0xd1d2('0x42')]);var _0x18ff05={'where':_0xbd855a['where']};return db['VoiceMail'][_0xd1d2('0x22')](_0x18ff05)[_0xd1d2('0x26')](function(_0x24fc93){_0x419db7['count']=_0x24fc93;if(_0x19db00['query'][_0xd1d2('0x43')]){_0xbd855a[_0xd1d2('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0xd1d2('0x45')](_0xbd855a);})['then'](function(_0x5a3790){_0x419db7[_0xd1d2('0x46')]=_0x5a3790;return _0x419db7;})['then'](respondWithFilteredResult(_0x1db17f,_0xbd855a))['catch'](handleError(_0x1db17f,null));};exports[_0xd1d2('0x47')]=function(_0x320fa4,_0x2a8961){var _0x49dad2={'raw':!![],'where':{'id':_0x320fa4[_0xd1d2('0x48')]['id']}},_0x2ba87b={};_0x2ba87b[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db['VoiceMail'][_0xd1d2('0x31')]);_0x2ba87b[_0xd1d2('0x36')]=_['keys'](_0x320fa4[_0xd1d2('0x36')]);_0x2ba87b['filters']=_[_0xd1d2('0x39')](_0x2ba87b[_0xd1d2('0x35')],_0x2ba87b[_0xd1d2('0x36')]);_0x49dad2[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x2ba87b['model'],qs['fields'](_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x49dad2['attributes']=_0x49dad2[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x49dad2[_0xd1d2('0x3a')]:_0x2ba87b[_0xd1d2('0x35')];if(_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x43')]){_0x49dad2[_0xd1d2('0x44')]=[{'all':!![]}];}_0x49dad2=_['merge']({},_0x49dad2,_0x320fa4[_0xd1d2('0x42')]);return db[_0xd1d2('0x30')]['find'](_0x49dad2)[_0xd1d2('0x26')](handleEntityNotFound(_0x2a8961,null))[_0xd1d2('0x26')](respondWithResult(_0x2a8961,null))['catch'](handleError(_0x2a8961,null));};exports['create']=function(_0x3d4fe3,_0x182ea8){return db['VoiceMail'][_0xd1d2('0x4a')](_0x3d4fe3[_0xd1d2('0x4b')],{})[_0xd1d2('0x26')](function(_0x23ab46){var _0x404ad2=_0x3d4fe3['user']['get']({'plain':!![]});if(!_0x404ad2)throw new Error(_0xd1d2('0x4c'));if(_0x404ad2['role']===_0xd1d2('0x4d')){var _0xcd4b70=_0x23ab46['get']({'plain':!![]});var _0x389fcb=_0xd1d2('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x389fcb,'userProfileId':_0x404ad2[_0xd1d2('0x4e')]},'raw':!![]})[_0xd1d2('0x26')](function(_0x187de4){if(_0x187de4&&_0x187de4[_0xd1d2('0x4f')]===0x0){return db[_0xd1d2('0x2a')][_0xd1d2('0x4a')]({'name':_0xcd4b70[_0xd1d2('0x2d')],'resourceId':_0xcd4b70['id'],'type':_0x187de4[_0xd1d2('0x2d')],'sectionId':_0x187de4['id']},{})[_0xd1d2('0x26')](function(){return _0x23ab46;});}else{return _0x23ab46;}})['catch'](function(_0x1958f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1958f3);throw _0x1958f3;});}return _0x23ab46;})[_0xd1d2('0x26')](respondWithResult(_0x182ea8,0xc9))[_0xd1d2('0x50')](handleError(_0x182ea8,null));};exports[_0xd1d2('0x51')]=function(_0x47417f,_0x215dea){if(_0x47417f[_0xd1d2('0x4b')]['id']){delete _0x47417f[_0xd1d2('0x4b')]['id'];}return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0x47417f[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x215dea,null))[_0xd1d2('0x26')](saveUpdates(_0x47417f[_0xd1d2('0x4b')],null))['then'](respondWithResult(_0x215dea,null))['catch'](handleError(_0x215dea,null));};exports[_0xd1d2('0x27')]=function(_0xd5323d,_0x1562ad){return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0xd5323d[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x1562ad,null))[_0xd1d2('0x26')](removeEntity(_0x1562ad,null))[_0xd1d2('0x50')](handleError(_0x1562ad,null));};exports[_0xd1d2('0x53')]=function(_0x1788cd,_0x54406e,_0x479471){return db[_0xd1d2('0x30')][_0xd1d2('0x54')]({'where':{'id':_0x1788cd[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x54406e,null))['then'](function(_0x17e149){var _0x27c629;var _0x42961d={},_0xaf2acf={};_0xaf2acf[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db[_0xd1d2('0x55')]['rawAttributes']);_0xaf2acf[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x1788cd[_0xd1d2('0x36')]);_0xaf2acf['filters']=_['intersection'](_0xaf2acf[_0xd1d2('0x35')],_0xaf2acf[_0xd1d2('0x36')]);_0x42961d[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0xaf2acf['model'],qs[_0xd1d2('0x49')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x42961d['attributes']=_0x42961d[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x42961d['attributes']:_0xaf2acf[_0xd1d2('0x35')];if(!_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x3c')](_0xd1d2('0x56'))){_0x42961d['limit']=qs[_0xd1d2('0x21')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x21')]);_0x42961d[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1788cd['query']['offset']);}_0x42961d['order']=qs['sort'](_0x1788cd['query'][_0xd1d2('0x3d')]);_0x42961d[_0xd1d2('0x3e')]=qs[_0xd1d2('0x38')](_['pick'](_0x1788cd[_0xd1d2('0x36')],_0xaf2acf[_0xd1d2('0x38')]));if(_0x1788cd[_0xd1d2('0x36')]['filter']){_0x42961d[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x42961d[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x42961d[_0xd1d2('0x3a')],function(_0x1101a3){var _0x4a83f8={};_0x4a83f8[_0x1101a3]={'$like':'%'+_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x4a83f8;})});}_0x42961d['where']=_['merge'](_0x42961d[_0xd1d2('0x3e')],{'mailboxuser':_0x17e149[_0xd1d2('0x57')]});_0x42961d=_[_0xd1d2('0x3f')]({},_0x42961d,_0x1788cd[_0xd1d2('0x42')]);return db['VoiceMailMessage'][_0xd1d2('0x58')](_0x42961d)[_0xd1d2('0x26')](respondWithFilteredResult(_0x54406e,_0x42961d));})[_0xd1d2('0x50')](handleError(_0x54406e,null));}; \ No newline at end of file +var _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Voicemails','UserProfileResource','destroy','end','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5938a8,_0x47cd96){var _0x4f5ca1=function(_0x3701d6){while(--_0x3701d6){_0x5938a8['push'](_0x5938a8['shift']());}};_0x4f5ca1(++_0x47cd96);}(_0x757a,0xde));var _0xa757=function(_0x7c4d2b,_0x233791){_0x7c4d2b=_0x7c4d2b-0x0;var _0x3804ad=_0x757a[_0x7c4d2b];return _0x3804ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};var _0x3a4a66=_[_0xa757('0x27')](db[_0xa757('0x28')][_0xa757('0x29')],function(_0xcc87c0){return{'name':_0xcc87c0[_0xa757('0x2a')],'type':_0xcc87c0[_0xa757('0x2b')][_0xa757('0x2c')]};});_0x235e54[_0xa757('0x2d')]=_[_0xa757('0x27')](_0x3a4a66,_0xa757('0x25'));_0x235e54[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2e')]);_0x235e54[_0xa757('0x30')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],_0x235e54[_0xa757('0x2e')]);_0x5307c3[_0xa757('0x32')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],qs[_0xa757('0x33')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x33')]));_0x5307c3['attributes']=_0x5307c3[_0xa757('0x32')][_0xa757('0x34')]?_0x5307c3[_0xa757('0x32')]:_0x235e54[_0xa757('0x2d')];if(!_0x2c4823[_0xa757('0x2e')]['hasOwnProperty'](_0xa757('0x35'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x1a')]);_0x5307c3[_0xa757('0x17')]=qs['offset'](_0x2c4823[_0xa757('0x2e')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x36')]=qs[_0xa757('0x37')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x37')]);_0x5307c3[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x2c4823['query'],_0x235e54[_0xa757('0x30')]),_0x3a4a66);if(_0x2c4823[_0xa757('0x2e')][_0xa757('0x3a')]){_0x5307c3[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x5307c3[_0xa757('0x38')],{'$or':_['map'](_0x3a4a66,function(_0x10d3fd){if(_0x10d3fd[_0xa757('0x2b')]!=='VIRTUAL'){var _0x5eae0b={};_0x5eae0b[_0x10d3fd[_0xa757('0x25')]]={'$like':'%'+_0x2c4823[_0xa757('0x2e')]['filter']+'%'};return _0x5eae0b;}})});}_0x5307c3=_['merge']({},_0x5307c3,_0x2c4823[_0xa757('0x3c')]);var _0x1725a2={'where':_0x5307c3[_0xa757('0x38')]};return db['VoiceMail'][_0xa757('0x19')](_0x1725a2)[_0xa757('0x1e')](function(_0x26802c){_0x5ade7b[_0xa757('0x19')]=_0x26802c;if(_0x2c4823[_0xa757('0x2e')]['includeAll']){_0x5307c3[_0xa757('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5307c3);})[_0xa757('0x1e')](function(_0x57298b){_0x5ade7b[_0xa757('0x3e')]=_0x57298b;return _0x5ade7b;})[_0xa757('0x1e')](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3f')](handleError(_0xa6d0f6,null));};exports['show']=function(_0x5d25bb,_0x11e141){var _0x129d77={'raw':!![],'where':{'id':_0x5d25bb[_0xa757('0x40')]['id']}},_0x2b171c={};_0x2b171c[_0xa757('0x2d')]=_[_0xa757('0x2f')](db['VoiceMail'][_0xa757('0x29')]);_0x2b171c[_0xa757('0x2e')]=_['keys'](_0x5d25bb[_0xa757('0x2e')]);_0x2b171c['filters']=_[_0xa757('0x31')](_0x2b171c[_0xa757('0x2d')],_0x2b171c['query']);_0x129d77[_0xa757('0x32')]=_[_0xa757('0x31')](_0x2b171c['model'],qs[_0xa757('0x33')](_0x5d25bb[_0xa757('0x2e')][_0xa757('0x33')]));_0x129d77[_0xa757('0x32')]=_0x129d77['attributes'][_0xa757('0x34')]?_0x129d77[_0xa757('0x32')]:_0x2b171c[_0xa757('0x2d')];if(_0x5d25bb[_0xa757('0x2e')]['includeAll']){_0x129d77[_0xa757('0x3d')]=[{'all':!![]}];}_0x129d77=_['merge']({},_0x129d77,_0x5d25bb['options']);return db[_0xa757('0x28')][_0xa757('0x41')](_0x129d77)[_0xa757('0x1e')](handleEntityNotFound(_0x11e141,null))['then'](respondWithResult(_0x11e141,null))[_0xa757('0x3f')](handleError(_0x11e141,null));};exports['create']=function(_0x2ed63f,_0x151cc3){return db[_0xa757('0x28')][_0xa757('0x42')](_0x2ed63f[_0xa757('0x43')],{})[_0xa757('0x1e')](function(_0x57bf73){var _0x505cd=_0x2ed63f['user'][_0xa757('0x1f')]({'plain':!![]});if(!_0x505cd)throw new Error(_0xa757('0x44'));if(_0x505cd[_0xa757('0x45')]===_0xa757('0x46')){var _0x319988=_0x57bf73[_0xa757('0x1f')]({'plain':!![]});var _0x15bad7=_0xa757('0x20');return db[_0xa757('0x47')][_0xa757('0x41')]({'where':{'name':_0x15bad7,'userProfileId':_0x505cd[_0xa757('0x48')]},'raw':!![]})[_0xa757('0x1e')](function(_0x2367c7){if(_0x2367c7&&_0x2367c7[_0xa757('0x49')]===0x0){return db[_0xa757('0x21')][_0xa757('0x42')]({'name':_0x319988['name'],'resourceId':_0x319988['id'],'type':_0x2367c7[_0xa757('0x25')],'sectionId':_0x2367c7['id']},{})['then'](function(){return _0x57bf73;});}else{return _0x57bf73;}})[_0xa757('0x3f')](function(_0x311c25){logger[_0xa757('0x24')](_0xa757('0x4a'),_0x311c25);throw _0x311c25;});}return _0x57bf73;})['then'](respondWithResult(_0x151cc3,0xc9))[_0xa757('0x3f')](handleError(_0x151cc3,null));};exports[_0xa757('0x1d')]=function(_0x8614f9,_0x980e1){if(_0x8614f9['body']['id']){delete _0x8614f9[_0xa757('0x43')]['id'];}return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x8614f9[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x980e1,null))[_0xa757('0x1e')](saveUpdates(_0x8614f9['body'],null))['then'](respondWithResult(_0x980e1,null))['catch'](handleError(_0x980e1,null));};exports['destroy']=function(_0x1d8742,_0x9b3779){return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x1d8742[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x9b3779,null))['then'](removeEntity(_0x9b3779,null))[_0xa757('0x3f')](handleError(_0x9b3779,null));};exports[_0xa757('0x4b')]=function(_0x34e03f,_0x29b2f5,_0x48b578){return db[_0xa757('0x28')][_0xa757('0x4c')]({'where':{'id':_0x34e03f['params']['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x29b2f5,null))['then'](function(_0x211980){var _0x5d375c;var _0x51be6e={},_0x58633a={};_0x58633a['model']=_[_0xa757('0x2f')](db[_0xa757('0x4d')][_0xa757('0x29')]);_0x58633a[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x34e03f[_0xa757('0x2e')]);_0x58633a['filters']=_['intersection'](_0x58633a[_0xa757('0x2d')],_0x58633a[_0xa757('0x2e')]);_0x51be6e[_0xa757('0x32')]=_['intersection'](_0x58633a['model'],qs[_0xa757('0x33')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x33')]));_0x51be6e[_0xa757('0x32')]=_0x51be6e[_0xa757('0x32')][_0xa757('0x34')]?_0x51be6e['attributes']:_0x58633a[_0xa757('0x2d')];if(!_0x34e03f[_0xa757('0x2e')][_0xa757('0x4e')](_0xa757('0x35'))){_0x51be6e[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x1a')]);_0x51be6e[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x34e03f['query'][_0xa757('0x17')]);}_0x51be6e['order']=qs['sort'](_0x34e03f[_0xa757('0x2e')][_0xa757('0x37')]);_0x51be6e[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x34e03f[_0xa757('0x2e')],_0x58633a[_0xa757('0x30')]));if(_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]){_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e['where'],{'$or':_[_0xa757('0x27')](_0x51be6e[_0xa757('0x32')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]+'%'};return _0x11ebb3;})});}_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x38')],{'mailboxuser':_0x211980['mailbox']});_0x51be6e=_[_0xa757('0x3b')]({},_0x51be6e,_0x34e03f['options']);return db[_0xa757('0x4d')][_0xa757('0x4f')](_0x51be6e)[_0xa757('0x1e')](respondWithFilteredResult(_0x29b2f5,_0x51be6e));})[_0xa757('0x3f')](handleError(_0x29b2f5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8fa3cd4..b24eb6f 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 _0x32c3=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','context','lodash','util','api','moment','request-promise'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x32c3,0x10c));var _0x332c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32c3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x332c('0x0'));var util=require(_0x332c('0x1'));var logger=require('../../config/logger')(_0x332c('0x2'));var moment=require(_0x332c('0x3'));var BPromise=require('bluebird');var rp=require(_0x332c('0x4'));var fs=require('fs');var path=require(_0x332c('0x5'));var rimraf=require(_0x332c('0x6'));var config=require(_0x332c('0x7'));var attributes=require(_0x332c('0x8'));module[_0x332c('0x9')]=function(_0x4fa277,_0x337af1){return _0x4fa277[_0x332c('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x332c('0xb'),'fields':['mailbox',_0x332c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30f5=['exports','define','VoiceMail','voice_voicemail','mailbox','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x30f5,0x1ef));var _0x530f=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0x30f5[_0x377217];return _0x26258d;};'use strict';var _=require('lodash');var util=require(_0x530f('0x0'));var logger=require(_0x530f('0x1'))(_0x530f('0x2'));var moment=require(_0x530f('0x3'));var BPromise=require(_0x530f('0x4'));var rp=require(_0x530f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x530f('0x6'));var config=require(_0x530f('0x7'));var attributes=require(_0x530f('0x8'));module[_0x530f('0x9')]=function(_0x236f8c,_0x79fcac){return _0x236f8c[_0x530f('0xa')](_0x530f('0xb'),attributes,{'tableName':_0x530f('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x530f('0xd'),'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 0597e9f..5488525 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 _0x83fd=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x542278,_0x390b4f){var _0x147b04=function(_0x66b484){while(--_0x66b484){_0x542278['push'](_0x542278['shift']());}};_0x147b04(++_0x390b4f);}(_0x83fd,0x7f));var _0xd83f=function(_0x22e3cc,_0x28f22a){_0x22e3cc=_0x22e3cc-0x0;var _0x4c73ce=_0x83fd[_0x22e3cc];return _0x4c73ce;};'use strict';var _=require(_0xd83f('0x0'));var util=require(_0xd83f('0x1'));var moment=require('moment');var BPromise=require(_0xd83f('0x2'));var rs=require(_0xd83f('0x3'));var fs=require('fs');var Redis=require(_0xd83f('0x4'));var db=require(_0xd83f('0x5'))['db'];var utils=require(_0xd83f('0x6'));var logger=require(_0xd83f('0x7'))(_0xd83f('0x8'));var config=require('../../config/environment');var jayson=require(_0xd83f('0x9'));var client=jayson[_0xd83f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9a9a10,_0x394513,_0x25f928){return new BPromise(function(_0x49ba5f,_0x335fec){return client['request'](_0x9a9a10,_0x25f928)[_0xd83f('0xb')](function(_0x7354f){logger[_0xd83f('0xc')](_0xd83f('0xd'),_0x394513,_0xd83f('0xe'));logger[_0xd83f('0xf')](_0xd83f('0x10'),_0x394513,_0xd83f('0xe'),JSON[_0xd83f('0x11')](_0x7354f));if(_0x7354f[_0xd83f('0x12')]){if(_0x7354f[_0xd83f('0x12')]['code']===0x1f4){logger[_0xd83f('0x12')](_0xd83f('0xd'),_0x394513,_0x7354f[_0xd83f('0x12')][_0xd83f('0x13')]);return _0x335fec(_0x7354f[_0xd83f('0x12')][_0xd83f('0x13')]);}logger[_0xd83f('0x12')](_0xd83f('0xd'),_0x394513,_0x7354f[_0xd83f('0x12')][_0xd83f('0x13')]);return _0x49ba5f(_0x7354f[_0xd83f('0x12')]['message']);}else{logger[_0xd83f('0xc')](_0xd83f('0xd'),_0x394513,'request\x20sent');_0x49ba5f(_0x7354f['result'][_0xd83f('0x13')]);}})[_0xd83f('0x14')](function(_0x646dc9){logger[_0xd83f('0x12')]('VoiceMail,\x20%s,\x20%s',_0x394513,_0x646dc9);_0x335fec(_0x646dc9);});});} \ No newline at end of file +var _0xf962=['stringify','code','VoiceMail,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1ea9ee,_0x16dafa){var _0x48ef4b=function(_0x4d2219){while(--_0x4d2219){_0x1ea9ee['push'](_0x1ea9ee['shift']());}};_0x48ef4b(++_0x16dafa);}(_0xf962,0x96));var _0x2f96=function(_0x17fd0d,_0x4be94d){_0x17fd0d=_0x17fd0d-0x0;var _0x4b10bb=_0xf962[_0x17fd0d];return _0x4b10bb;};'use strict';var _=require(_0x2f96('0x0'));var util=require(_0x2f96('0x1'));var moment=require(_0x2f96('0x2'));var BPromise=require(_0x2f96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f96('0x4'));var db=require(_0x2f96('0x5'))['db'];var utils=require(_0x2f96('0x6'));var logger=require(_0x2f96('0x7'))(_0x2f96('0x8'));var config=require(_0x2f96('0x9'));var jayson=require(_0x2f96('0xa'));var client=jayson[_0x2f96('0xb')][_0x2f96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49e68b,_0x3b51fa,_0x352ffa){return new BPromise(function(_0x51044b,_0x24d03f){return client[_0x2f96('0xd')](_0x49e68b,_0x352ffa)['then'](function(_0x1364ed){logger[_0x2f96('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3b51fa,'request\x20sent');logger[_0x2f96('0xf')](_0x2f96('0x10'),_0x3b51fa,_0x2f96('0x11'),JSON[_0x2f96('0x12')](_0x1364ed));if(_0x1364ed['error']){if(_0x1364ed['error'][_0x2f96('0x13')]===0x1f4){logger['error'](_0x2f96('0x14'),_0x3b51fa,_0x1364ed[_0x2f96('0x15')]['message']);return _0x24d03f(_0x1364ed[_0x2f96('0x15')][_0x2f96('0x16')]);}logger[_0x2f96('0x15')](_0x2f96('0x14'),_0x3b51fa,_0x1364ed[_0x2f96('0x15')]['message']);return _0x51044b(_0x1364ed[_0x2f96('0x15')][_0x2f96('0x16')]);}else{logger['info'](_0x2f96('0x14'),_0x3b51fa,_0x2f96('0x11'));_0x51044b(_0x1364ed['result'][_0x2f96('0x16')]);}})[_0x2f96('0x17')](function(_0x37a9c2){logger[_0x2f96('0x15')]('VoiceMail,\x20%s,\x20%s',_0x3b51fa,_0x37a9c2);_0x24d03f(_0x37a9c2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d6e28e4..59d67fb 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 _0x7c96=['/:id','show','/:id/download','download','post','create','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x7c96,0x157));var _0x67c9=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x7c96[_0x1477ef];return _0x164acd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67c9('0x0'));var timeout=require(_0x67c9('0x1'));var express=require(_0x67c9('0x2'));var router=express[_0x67c9('0x3')]();var fs_extra=require(_0x67c9('0x4'));var auth=require(_0x67c9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x67c9('0x6')](),controller[_0x67c9('0x7')]);router[_0x67c9('0x8')](_0x67c9('0x9'),auth[_0x67c9('0x6')](),controller[_0x67c9('0xa')]);router[_0x67c9('0x8')](_0x67c9('0xb'),auth['isAuthenticated'](),controller[_0x67c9('0xc')]);router[_0x67c9('0xd')]('/',auth[_0x67c9('0x6')](),controller[_0x67c9('0xe')]);router['put'](_0x67c9('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x67c9('0x6')](),controller[_0x67c9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0a33=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x0a33,0x12a));var _0x30a3=function(_0x5ba545,_0x95a648){_0x5ba545=_0x5ba545-0x0;var _0x32d860=_0x0a33[_0x5ba545];return _0x32d860;};'use strict';var multer=require(_0x30a3('0x0'));var util=require(_0x30a3('0x1'));var path=require(_0x30a3('0x2'));var timeout=require(_0x30a3('0x3'));var express=require(_0x30a3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x30a3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30a3('0x6'));var controller=require(_0x30a3('0x7'));router[_0x30a3('0x8')]('/',auth[_0x30a3('0x9')](),controller[_0x30a3('0xa')]);router['get'](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0xc')]);router[_0x30a3('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x30a3('0xd')]);router[_0x30a3('0xe')]('/',auth['isAuthenticated'](),controller[_0x30a3('0xf')]);router[_0x30a3('0x10')](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0x11')]);router[_0x30a3('0x12')](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0x13')]);module[_0x30a3('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 d06685d..cbd861b 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 _0x6e73=['STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER'];(function(_0x5370a1,_0xd689ff){var _0x2097db=function(_0x258f99){while(--_0x258f99){_0x5370a1['push'](_0x5370a1['shift']());}};_0x2097db(++_0xd689ff);}(_0x6e73,0x1d2));var _0x36e7=function(_0x1ae094,_0x1dd64a){_0x1ae094=_0x1ae094-0x0;var _0x5a252c=_0x6e73[_0x1ae094];return _0x5a252c;};'use strict';var Sequelize=require('sequelize');module[_0x36e7('0x0')]={'name':{'type':Sequelize[_0x36e7('0x1')],'get':function(_0x5a6494){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x36e7('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x36e7('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x36e7('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x36e7('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x36e7('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x36e7('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x36e7('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x36e7('0x5')](_0x36e7('0x6'))}}; \ No newline at end of file +var _0x2caf=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x34a30a,_0x2d555c){var _0x2300b8=function(_0x24bc73){while(--_0x24bc73){_0x34a30a['push'](_0x34a30a['shift']());}};_0x2300b8(++_0x2d555c);}(_0x2caf,0x1d3));var _0xf2ca=function(_0x53cfae,_0x44a7c5){_0x53cfae=_0x53cfae-0x0;var _0xc056ac=_0x2caf[_0x53cfae];return _0xc056ac;};'use strict';var Sequelize=require(_0xf2ca('0x0'));module[_0xf2ca('0x1')]={'name':{'type':Sequelize[_0xf2ca('0x2')],'get':function(_0x44b417){return this[_0xf2ca('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf2ca('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf2ca('0x6')](_0xf2ca('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 812a11f..41ab83b 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 _0x2abd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','undefined','count','offset','set','Content-Range','json','update','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','then','findAll','rows','catch','fields','length','includeAll','include','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4008b6,_0x49b3db){var _0x627491=function(_0x2d3b01){while(--_0x2d3b01){_0x4008b6['push'](_0x4008b6['shift']());}};_0x627491(++_0x49b3db);}(_0x2abd,0x148));var _0xd2ab=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x2abd[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xd2ab('0x0'));var rimraf=require(_0xd2ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2ab('0x2'));var rp=require(_0xd2ab('0x3'));var moment=require(_0xd2ab('0x4'));var BPromise=require(_0xd2ab('0x5'));var Mustache=require(_0xd2ab('0x6'));var util=require(_0xd2ab('0x7'));var path=require(_0xd2ab('0x8'));var sox=require(_0xd2ab('0x9'));var csv=require(_0xd2ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2ab('0xb'));var _=require(_0xd2ab('0xc'));var squel=require(_0xd2ab('0xd'));var crypto=require(_0xd2ab('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd2ab('0xf'));var toCsv=require(_0xd2ab('0xa'));var querystring=require(_0xd2ab('0x10'));var Papa=require(_0xd2ab('0x11'));var Redis=require(_0xd2ab('0x12'));var authService=require(_0xd2ab('0x13'));var qs=require(_0xd2ab('0x14'));var as=require(_0xd2ab('0x15'));var hardwareService=require(_0xd2ab('0x16'));var logger=require(_0xd2ab('0x17'))(_0xd2ab('0x18'));var utils=require('../../config/utils');var config=require(_0xd2ab('0x19'));var licenseUtil=require(_0xd2ab('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d755,_0x3d6647){_0x3d6647=_0x3d6647||0xcc;return function(_0x3df6f9){if(_0x3df6f9){return _0x51d755['sendStatus'](_0x3d6647);}return _0x51d755['status'](_0x3d6647)['end']();};}function respondWithResult(_0x4cc631,_0x10418c){_0x10418c=_0x10418c||0xc8;return function(_0x27f095){if(_0x27f095){return _0x4cc631[_0xd2ab('0x1b')](_0x10418c)['json'](_0x27f095);}};}function respondWithFilteredResult(_0x52cbf3,_0x5661f0){return function(_0x40ed63){if(_0x40ed63){var _0x20c95f=typeof _0x5661f0['offset']===_0xd2ab('0x1c')&&typeof _0x5661f0['limit']===_0xd2ab('0x1c');var _0xa16318=_0x40ed63[_0xd2ab('0x1d')];var _0x1d3af5=_0x20c95f?0x0:_0x5661f0[_0xd2ab('0x1e')];var _0x23aee4=_0x20c95f?_0x40ed63[_0xd2ab('0x1d')]:_0x5661f0['offset']+_0x5661f0['limit'];var _0x43c34e;if(_0x23aee4>=_0xa16318){_0x23aee4=_0xa16318;_0x43c34e=0xc8;}else{_0x43c34e=0xce;}_0x52cbf3[_0xd2ab('0x1b')](_0x43c34e);return _0x52cbf3[_0xd2ab('0x1f')](_0xd2ab('0x20'),_0x1d3af5+'-'+_0x23aee4+'/'+_0xa16318)[_0xd2ab('0x21')](_0x40ed63);}return null;};}function patchUpdates(_0x14de3f){return function(_0x5385fd){try{jsonpatch['apply'](_0x5385fd,_0x14de3f,!![]);}catch(_0x4c086a){return BPromise['reject'](_0x4c086a);}return _0x5385fd['save']();};}function saveUpdates(_0x3d0a7c,_0x4e940c){return function(_0x15b1f5){if(_0x15b1f5){return _0x15b1f5[_0xd2ab('0x22')](_0x3d0a7c)['then'](function(_0x38a227){return _0x38a227;});}return null;};}function removeEntity(_0x5f4f7e,_0x1aefa9){return function(_0x46d1f4){if(_0x46d1f4){return _0x46d1f4[_0xd2ab('0x23')]()['then'](function(){_0x5f4f7e[_0xd2ab('0x1b')](0xcc)[_0xd2ab('0x24')]();});}};}function handleEntityNotFound(_0x58fe6a,_0x4d7183){return function(_0x420c87){if(!_0x420c87){_0x58fe6a[_0xd2ab('0x25')](0x194);}return _0x420c87;};}function handleError(_0x1878d8,_0x348202){_0x348202=_0x348202||0x1f4;return function(_0x5ad37a){logger[_0xd2ab('0x26')](_0x5ad37a[_0xd2ab('0x27')]);if(_0x5ad37a[_0xd2ab('0x28')]){delete _0x5ad37a[_0xd2ab('0x28')];}_0x1878d8[_0xd2ab('0x1b')](_0x348202)[_0xd2ab('0x29')](_0x5ad37a);};}exports[_0xd2ab('0x2a')]=function(_0x28d1a4,_0x5888e4){var _0x4c129f={},_0x526b55={},_0x406c57={'count':0x0,'rows':[]};var _0x717413=_[_0xd2ab('0x2b')](db[_0xd2ab('0x2c')][_0xd2ab('0x2d')],function(_0x5261ea){return{'name':_0x5261ea[_0xd2ab('0x2e')],'type':_0x5261ea[_0xd2ab('0x2f')][_0xd2ab('0x30')]};});_0x526b55['model']=_[_0xd2ab('0x31')](_[_0xd2ab('0x2b')](_0x717413,_0xd2ab('0x28')),[_0xd2ab('0x28')]);_0x526b55[_0xd2ab('0x32')]=_['keys'](_0x28d1a4[_0xd2ab('0x32')]);_0x526b55[_0xd2ab('0x33')]=_[_0xd2ab('0x34')](_0x526b55[_0xd2ab('0x35')],_0x526b55[_0xd2ab('0x32')]);_0x4c129f['attributes']=_[_0xd2ab('0x34')](_0x526b55[_0xd2ab('0x35')],qs['fields'](_0x28d1a4[_0xd2ab('0x32')]['fields']));_0x4c129f['attributes']=_0x4c129f[_0xd2ab('0x36')]['length']?_0x4c129f[_0xd2ab('0x36')]:_0x526b55[_0xd2ab('0x35')];if(!_0x28d1a4[_0xd2ab('0x32')][_0xd2ab('0x37')](_0xd2ab('0x38'))){_0x4c129f[_0xd2ab('0x39')]=qs[_0xd2ab('0x39')](_0x28d1a4[_0xd2ab('0x32')][_0xd2ab('0x39')]);_0x4c129f[_0xd2ab('0x1e')]=qs[_0xd2ab('0x1e')](_0x28d1a4['query'][_0xd2ab('0x1e')]);}_0x4c129f['order']=qs[_0xd2ab('0x3a')](_0x28d1a4[_0xd2ab('0x32')]['sort']);_0x4c129f[_0xd2ab('0x3b')]=qs[_0xd2ab('0x33')](_['pick'](_0x28d1a4[_0xd2ab('0x32')],_0x526b55[_0xd2ab('0x33')]),_0x717413);if(_0x28d1a4[_0xd2ab('0x32')][_0xd2ab('0x3c')]){_0x4c129f[_0xd2ab('0x3b')]=_[_0xd2ab('0x3d')](_0x4c129f[_0xd2ab('0x3b')],{'$or':_[_0xd2ab('0x2b')](_0x717413,function(_0xc80ea8){if(_0xc80ea8[_0xd2ab('0x2f')]!==_0xd2ab('0x3e')){var _0x94486d={};_0x94486d[_0xc80ea8['name']]={'$like':'%'+_0x28d1a4[_0xd2ab('0x32')][_0xd2ab('0x3c')]+'%'};return _0x94486d;}})});}_0x4c129f=_['merge']({},_0x4c129f,_0x28d1a4[_0xd2ab('0x3f')]);var _0x459d3b={'where':_0x4c129f[_0xd2ab('0x3b')]};return db[_0xd2ab('0x2c')]['count'](_0x459d3b)[_0xd2ab('0x40')](function(_0x5347fc){_0x406c57['count']=_0x5347fc;if(_0x28d1a4[_0xd2ab('0x32')]['includeAll']){_0x4c129f['include']=[{'all':!![]}];}return db[_0xd2ab('0x2c')][_0xd2ab('0x41')](_0x4c129f);})['then'](function(_0x3f9dc6){_0x406c57[_0xd2ab('0x42')]=_0x3f9dc6;return _0x406c57;})[_0xd2ab('0x40')](respondWithFilteredResult(_0x5888e4,_0x4c129f))[_0xd2ab('0x43')](handleError(_0x5888e4,null));};exports['show']=function(_0x1397a6,_0x537779){var _0x5b0692={'raw':!![],'where':{'id':_0x1397a6['params']['id']}},_0x1383f9={};_0x1383f9[_0xd2ab('0x35')]=_['keys'](db[_0xd2ab('0x2c')][_0xd2ab('0x2d')]);_0x1383f9[_0xd2ab('0x32')]=_['keys'](_0x1397a6['query']);_0x1383f9['filters']=_['intersection'](_0x1383f9['model'],_0x1383f9[_0xd2ab('0x32')]);_0x5b0692['attributes']=_['intersection'](_0x1383f9[_0xd2ab('0x35')],qs[_0xd2ab('0x44')](_0x1397a6['query']['fields']));_0x5b0692[_0xd2ab('0x36')]=_0x5b0692[_0xd2ab('0x36')][_0xd2ab('0x45')]?_0x5b0692['attributes']:_0x1383f9[_0xd2ab('0x35')];if(_0x1397a6['query'][_0xd2ab('0x46')]){_0x5b0692[_0xd2ab('0x47')]=[{'all':!![]}];}_0x5b0692=_[_0xd2ab('0x3d')]({},_0x5b0692,_0x1397a6[_0xd2ab('0x3f')]);return db[_0xd2ab('0x2c')]['find'](_0x5b0692)[_0xd2ab('0x40')](handleEntityNotFound(_0x537779,null))[_0xd2ab('0x40')](respondWithResult(_0x537779,null))[_0xd2ab('0x43')](handleError(_0x537779,null));};exports[_0xd2ab('0x48')]=function(_0x127a6d,_0x526f5e){return db['VoiceMailMessage']['create'](_0x127a6d[_0xd2ab('0x49')],{})[_0xd2ab('0x40')](respondWithResult(_0x526f5e,0xc9))[_0xd2ab('0x43')](handleError(_0x526f5e,null));};exports[_0xd2ab('0x22')]=function(_0x330f8a,_0x21ad2b){if(_0x330f8a[_0xd2ab('0x49')]['id']){delete _0x330f8a['body']['id'];}return db[_0xd2ab('0x2c')][_0xd2ab('0x4a')]({'where':{'id':_0x330f8a[_0xd2ab('0x4b')]['id']}})[_0xd2ab('0x40')](handleEntityNotFound(_0x21ad2b,null))[_0xd2ab('0x40')](saveUpdates(_0x330f8a['body'],null))[_0xd2ab('0x40')](respondWithResult(_0x21ad2b,null))[_0xd2ab('0x43')](handleError(_0x21ad2b,null));};exports[_0xd2ab('0x23')]=function(_0x15afd7,_0xb6aa9){return db[_0xd2ab('0x2c')][_0xd2ab('0x4a')]({'where':{'id':_0x15afd7[_0xd2ab('0x4b')]['id']}})[_0xd2ab('0x40')](handleEntityNotFound(_0xb6aa9,null))[_0xd2ab('0x40')](removeEntity(_0xb6aa9,null))[_0xd2ab('0x43')](handleError(_0xb6aa9,null));};exports[_0xd2ab('0x4c')]=function(_0x2c4f77,_0x54d9ff,_0x1a8c20){return db[_0xd2ab('0x2c')][_0xd2ab('0x4a')]({'where':{'id':_0x2c4f77[_0xd2ab('0x4b')]['id']},'attributes':['id',_0xd2ab('0x4d'),_0xd2ab('0x4e')]})[_0xd2ab('0x40')](handleEntityNotFound(_0x54d9ff,null))[_0xd2ab('0x40')](function(_0x270dd5){if(_0x270dd5){if(!_0x270dd5[_0xd2ab('0x4d')]){throw new db[(_0xd2ab('0x4f'))][(_0xd2ab('0x50'))](_0xd2ab('0x51'));}var _0xd50c2b={'Content-Type':_0xd2ab('0x52'),'Content-Disposition':_0xd2ab('0x53')};if(_0x270dd5[_0xd2ab('0x4e')]){_0xd50c2b[_0xd2ab('0x54')]=_0xd2ab('0x55')+_0x270dd5[_0xd2ab('0x4e')]+_0xd2ab('0x56');}_0x54d9ff['set'](_0xd50c2b);return _0x54d9ff['send'](new Buffer(_0x270dd5[_0xd2ab('0x4d')]));}})[_0xd2ab('0x43')](handleError(_0x54d9ff,null));}; \ No newline at end of file +var _0xb447=['rows','catch','show','body','update','find','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','json','offset','limit','undefined','count','status','set','apply','reject','then','error','stack','name','send','VoiceMailMessage','rawAttributes','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb447,0x158));var _0x7b44=function(_0x24715d,_0x59118f){_0x24715d=_0x24715d-0x0;var _0x1a9681=_0xb447[_0x24715d];return _0x1a9681;};'use strict';var emlformat=require(_0x7b44('0x0'));var rimraf=require(_0x7b44('0x1'));var zipdir=require(_0x7b44('0x2'));var jsonpatch=require(_0x7b44('0x3'));var rp=require(_0x7b44('0x4'));var moment=require(_0x7b44('0x5'));var BPromise=require(_0x7b44('0x6'));var Mustache=require(_0x7b44('0x7'));var util=require(_0x7b44('0x8'));var path=require('path');var sox=require(_0x7b44('0x9'));var csv=require('to-csv');var ejs=require(_0x7b44('0xa'));var fs=require('fs');var fs_extra=require(_0x7b44('0xb'));var _=require('lodash');var squel=require(_0x7b44('0xc'));var crypto=require(_0x7b44('0xd'));var jsforce=require(_0x7b44('0xe'));var deskjs=require(_0x7b44('0xf'));var toCsv=require(_0x7b44('0x10'));var querystring=require(_0x7b44('0x11'));var Papa=require(_0x7b44('0x12'));var Redis=require('ioredis');var authService=require(_0x7b44('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7b44('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b44('0x15'));var utils=require(_0x7b44('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7b44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6324c1,_0x312a14){_0x312a14=_0x312a14||0xcc;return function(_0x5c9d29){if(_0x5c9d29){return _0x6324c1['sendStatus'](_0x312a14);}return _0x6324c1['status'](_0x312a14)[_0x7b44('0x18')]();};}function respondWithResult(_0x5b8b73,_0x52e46d){_0x52e46d=_0x52e46d||0xc8;return function(_0x2f33a6){if(_0x2f33a6){return _0x5b8b73['status'](_0x52e46d)[_0x7b44('0x19')](_0x2f33a6);}};}function respondWithFilteredResult(_0x454f1a,_0x5544ed){return function(_0x4adf31){if(_0x4adf31){var _0x2d89b6=typeof _0x5544ed[_0x7b44('0x1a')]==='undefined'&&typeof _0x5544ed[_0x7b44('0x1b')]===_0x7b44('0x1c');var _0x294905=_0x4adf31[_0x7b44('0x1d')];var _0x3500d9=_0x2d89b6?0x0:_0x5544ed[_0x7b44('0x1a')];var _0x37bbab=_0x2d89b6?_0x4adf31[_0x7b44('0x1d')]:_0x5544ed[_0x7b44('0x1a')]+_0x5544ed[_0x7b44('0x1b')];var _0x8e2b29;if(_0x37bbab>=_0x294905){_0x37bbab=_0x294905;_0x8e2b29=0xc8;}else{_0x8e2b29=0xce;}_0x454f1a[_0x7b44('0x1e')](_0x8e2b29);return _0x454f1a[_0x7b44('0x1f')]('Content-Range',_0x3500d9+'-'+_0x37bbab+'/'+_0x294905)['json'](_0x4adf31);}return null;};}function patchUpdates(_0xea52d0){return function(_0x1a8354){try{jsonpatch[_0x7b44('0x20')](_0x1a8354,_0xea52d0,!![]);}catch(_0x3c0c4f){return BPromise[_0x7b44('0x21')](_0x3c0c4f);}return _0x1a8354['save']();};}function saveUpdates(_0x6e9a36,_0x5d2a2b){return function(_0x482991){if(_0x482991){return _0x482991['update'](_0x6e9a36)[_0x7b44('0x22')](function(_0x527f2a){return _0x527f2a;});}return null;};}function removeEntity(_0x38123d,_0x122237){return function(_0x4d29b1){if(_0x4d29b1){return _0x4d29b1['destroy']()[_0x7b44('0x22')](function(){_0x38123d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3ea2,_0x6fee9c){return function(_0x299595){if(!_0x299595){_0x2e3ea2['sendStatus'](0x194);}return _0x299595;};}function handleError(_0x5d46bd,_0x31122f){_0x31122f=_0x31122f||0x1f4;return function(_0x76265e){logger[_0x7b44('0x23')](_0x76265e[_0x7b44('0x24')]);if(_0x76265e[_0x7b44('0x25')]){delete _0x76265e[_0x7b44('0x25')];}_0x5d46bd[_0x7b44('0x1e')](_0x31122f)[_0x7b44('0x26')](_0x76265e);};}exports['index']=function(_0x2696fc,_0x491277){var _0x4e43f1={},_0x53b153={},_0x2e98ac={'count':0x0,'rows':[]};var _0x1d4390=_['map'](db[_0x7b44('0x27')][_0x7b44('0x28')],function(_0x5bd18d){return{'name':_0x5bd18d['fieldName'],'type':_0x5bd18d[_0x7b44('0x29')][_0x7b44('0x2a')]};});_0x53b153['model']=_[_0x7b44('0x2b')](_[_0x7b44('0x2c')](_0x1d4390,_0x7b44('0x25')),[_0x7b44('0x25')]);_0x53b153[_0x7b44('0x2d')]=_[_0x7b44('0x2e')](_0x2696fc[_0x7b44('0x2d')]);_0x53b153[_0x7b44('0x2f')]=_[_0x7b44('0x30')](_0x53b153[_0x7b44('0x31')],_0x53b153[_0x7b44('0x2d')]);_0x4e43f1[_0x7b44('0x32')]=_[_0x7b44('0x30')](_0x53b153[_0x7b44('0x31')],qs[_0x7b44('0x33')](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x33')]));_0x4e43f1[_0x7b44('0x32')]=_0x4e43f1[_0x7b44('0x32')][_0x7b44('0x34')]?_0x4e43f1[_0x7b44('0x32')]:_0x53b153['model'];if(!_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x35')](_0x7b44('0x36'))){_0x4e43f1['limit']=qs[_0x7b44('0x1b')](_0x2696fc[_0x7b44('0x2d')]['limit']);_0x4e43f1[_0x7b44('0x1a')]=qs[_0x7b44('0x1a')](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x1a')]);}_0x4e43f1[_0x7b44('0x37')]=qs['sort'](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x38')]);_0x4e43f1[_0x7b44('0x39')]=qs['filters'](_[_0x7b44('0x3a')](_0x2696fc[_0x7b44('0x2d')],_0x53b153[_0x7b44('0x2f')]),_0x1d4390);if(_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x3b')]){_0x4e43f1['where']=_[_0x7b44('0x3c')](_0x4e43f1[_0x7b44('0x39')],{'$or':_[_0x7b44('0x2c')](_0x1d4390,function(_0x25a49c){if(_0x25a49c[_0x7b44('0x29')]!==_0x7b44('0x3d')){var _0x2646d7={};_0x2646d7[_0x25a49c[_0x7b44('0x25')]]={'$like':'%'+_0x2696fc['query'][_0x7b44('0x3b')]+'%'};return _0x2646d7;}})});}_0x4e43f1=_[_0x7b44('0x3c')]({},_0x4e43f1,_0x2696fc[_0x7b44('0x3e')]);var _0x166d40={'where':_0x4e43f1[_0x7b44('0x39')]};return db['VoiceMailMessage'][_0x7b44('0x1d')](_0x166d40)[_0x7b44('0x22')](function(_0x5094e9){_0x2e98ac[_0x7b44('0x1d')]=_0x5094e9;if(_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x3f')]){_0x4e43f1[_0x7b44('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x7b44('0x41')](_0x4e43f1);})[_0x7b44('0x22')](function(_0x1f2740){_0x2e98ac[_0x7b44('0x42')]=_0x1f2740;return _0x2e98ac;})[_0x7b44('0x22')](respondWithFilteredResult(_0x491277,_0x4e43f1))[_0x7b44('0x43')](handleError(_0x491277,null));};exports[_0x7b44('0x44')]=function(_0x269406,_0x2a4431){var _0xc5b160={'raw':!![],'where':{'id':_0x269406['params']['id']}},_0x3524ff={};_0x3524ff[_0x7b44('0x31')]=_[_0x7b44('0x2e')](db[_0x7b44('0x27')][_0x7b44('0x28')]);_0x3524ff[_0x7b44('0x2d')]=_['keys'](_0x269406[_0x7b44('0x2d')]);_0x3524ff['filters']=_['intersection'](_0x3524ff['model'],_0x3524ff[_0x7b44('0x2d')]);_0xc5b160[_0x7b44('0x32')]=_['intersection'](_0x3524ff['model'],qs[_0x7b44('0x33')](_0x269406[_0x7b44('0x2d')][_0x7b44('0x33')]));_0xc5b160[_0x7b44('0x32')]=_0xc5b160[_0x7b44('0x32')]['length']?_0xc5b160[_0x7b44('0x32')]:_0x3524ff['model'];if(_0x269406[_0x7b44('0x2d')][_0x7b44('0x3f')]){_0xc5b160[_0x7b44('0x40')]=[{'all':!![]}];}_0xc5b160=_['merge']({},_0xc5b160,_0x269406[_0x7b44('0x3e')]);return db[_0x7b44('0x27')]['find'](_0xc5b160)['then'](handleEntityNotFound(_0x2a4431,null))[_0x7b44('0x22')](respondWithResult(_0x2a4431,null))[_0x7b44('0x43')](handleError(_0x2a4431,null));};exports['create']=function(_0x4273d4,_0x524a93){return db['VoiceMailMessage']['create'](_0x4273d4[_0x7b44('0x45')],{})[_0x7b44('0x22')](respondWithResult(_0x524a93,0xc9))['catch'](handleError(_0x524a93,null));};exports[_0x7b44('0x46')]=function(_0x593928,_0x4f9e9d){if(_0x593928[_0x7b44('0x45')]['id']){delete _0x593928[_0x7b44('0x45')]['id'];}return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x593928['params']['id']}})[_0x7b44('0x22')](handleEntityNotFound(_0x4f9e9d,null))['then'](saveUpdates(_0x593928[_0x7b44('0x45')],null))['then'](respondWithResult(_0x4f9e9d,null))[_0x7b44('0x43')](handleError(_0x4f9e9d,null));};exports['destroy']=function(_0x3dc0d7,_0x1b47bc){return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x3dc0d7['params']['id']}})[_0x7b44('0x22')](handleEntityNotFound(_0x1b47bc,null))[_0x7b44('0x22')](removeEntity(_0x1b47bc,null))[_0x7b44('0x43')](handleError(_0x1b47bc,null));};exports['download']=function(_0x59feaa,_0x4c722c,_0x52e309){return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x59feaa[_0x7b44('0x48')]['id']},'attributes':['id',_0x7b44('0x49'),_0x7b44('0x4a')]})[_0x7b44('0x22')](handleEntityNotFound(_0x4c722c,null))[_0x7b44('0x22')](function(_0x27507e){if(_0x27507e){if(!_0x27507e[_0x7b44('0x49')]){throw new db[(_0x7b44('0x4b'))][(_0x7b44('0x4c'))](_0x7b44('0x4d'));}var _0xc55a7={'Content-Type':_0x7b44('0x4e'),'Content-Disposition':_0x7b44('0x4f')};if(_0x27507e['msg_id']){_0xc55a7['Content-Disposition']=_0x7b44('0x50')+_0x27507e[_0x7b44('0x4a')]+_0x7b44('0x51');}_0x4c722c[_0x7b44('0x1f')](_0xc55a7);return _0x4c722c['send'](new Buffer(_0x27507e[_0x7b44('0x49')]));}})[_0x7b44('0x43')](handleError(_0x4c722c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 542526c..e427220 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 _0xac9a=['moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash','util'];(function(_0x23690e,_0x2d73b3){var _0x4c0355=function(_0x4830a6){while(--_0x4830a6){_0x23690e['push'](_0x23690e['shift']());}};_0x4c0355(++_0x2d73b3);}(_0xac9a,0x1b6));var _0xaac9=function(_0x336a6b,_0x1dfd05){_0x336a6b=_0x336a6b-0x0;var _0x264c56=_0xac9a[_0x336a6b];return _0x264c56;};'use strict';var _=require(_0xaac9('0x0'));var util=require(_0xaac9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaac9('0x2'));var BPromise=require('bluebird');var rp=require(_0xaac9('0x3'));var fs=require('fs');var path=require(_0xaac9('0x4'));var rimraf=require(_0xaac9('0x5'));var config=require(_0xaac9('0x6'));var attributes=require(_0xaac9('0x7'));module[_0xaac9('0x8')]=function(_0x1bf6c0,_0x1217fd){return _0x1bf6c0['define']('VoiceMailMessage',attributes,{'tableName':_0xaac9('0x9'),'paranoid':![],'indexes':[{'name':_0xaac9('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x9065=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','dir','lodash'];(function(_0x2aba7c,_0x515b9d){var _0x3f0982=function(_0x29b77c){while(--_0x29b77c){_0x2aba7c['push'](_0x2aba7c['shift']());}};_0x3f0982(++_0x515b9d);}(_0x9065,0x1d8));var _0x5906=function(_0x16e216,_0x765b5b){_0x16e216=_0x16e216-0x0;var _0x16c48f=_0x9065[_0x16e216];return _0x16c48f;};'use strict';var _=require(_0x5906('0x0'));var util=require(_0x5906('0x1'));var logger=require('../../config/logger')(_0x5906('0x2'));var moment=require(_0x5906('0x3'));var BPromise=require(_0x5906('0x4'));var rp=require(_0x5906('0x5'));var fs=require('fs');var path=require(_0x5906('0x6'));var rimraf=require(_0x5906('0x7'));var config=require(_0x5906('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x5906('0x9')]=function(_0x2dc21e,_0x4b30da){return _0x2dc21e['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5906('0xa'),'fields':[_0x5906('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 fe22580..e4eefde 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 _0x24bf=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x24bf,0x183));var _0xf24b=function(_0x8bb633,_0x49a383){_0x8bb633=_0x8bb633-0x0;var _0x536bfb=_0x24bf[_0x8bb633];return _0x536bfb;};'use strict';var _=require(_0xf24b('0x0'));var util=require('util');var moment=require(_0xf24b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf24b('0x2'));var fs=require('fs');var Redis=require(_0xf24b('0x3'));var db=require(_0xf24b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf24b('0x5'));var config=require(_0xf24b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf24b('0x7')][_0xf24b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x188151,_0x20996d,_0x377564){return new BPromise(function(_0xabff89,_0x55094f){return client[_0xf24b('0x9')](_0x188151,_0x377564)[_0xf24b('0xa')](function(_0x32a602){logger[_0xf24b('0xb')](_0xf24b('0xc'),_0x20996d,_0xf24b('0xd'));logger['debug'](_0xf24b('0xe'),_0x20996d,_0xf24b('0xd'),JSON[_0xf24b('0xf')](_0x32a602));if(_0x32a602[_0xf24b('0x10')]){if(_0x32a602[_0xf24b('0x10')][_0xf24b('0x11')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x20996d,_0x32a602[_0xf24b('0x10')]['message']);return _0x55094f(_0x32a602[_0xf24b('0x10')]['message']);}logger[_0xf24b('0x10')](_0xf24b('0xc'),_0x20996d,_0x32a602['error']['message']);return _0xabff89(_0x32a602[_0xf24b('0x10')]['message']);}else{logger[_0xf24b('0xb')](_0xf24b('0xc'),_0x20996d,_0xf24b('0xd'));_0xabff89(_0x32a602[_0xf24b('0x12')][_0xf24b('0x13')]);}})[_0xf24b('0x14')](function(_0x32cc5f){logger[_0xf24b('0x10')](_0xf24b('0xc'),_0x20996d,_0x32cc5f);_0x55094f(_0x32cc5f);});});} \ No newline at end of file +var _0x231d=['../../config/environment','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c3b1d,_0x3686ef){var _0x168193=function(_0x39bc26){while(--_0x39bc26){_0x3c3b1d['push'](_0x3c3b1d['shift']());}};_0x168193(++_0x3686ef);}(_0x231d,0x6b));var _0xd231=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x231d[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xd231('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd231('0x1'));var fs=require('fs');var Redis=require(_0xd231('0x2'));var db=require(_0xd231('0x3'))['db'];var utils=require(_0xd231('0x4'));var logger=require(_0xd231('0x5'))(_0xd231('0x6'));var config=require(_0xd231('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427f8f,_0x560a08,_0x47de98){return new BPromise(function(_0x31b871,_0x58a867){return client[_0xd231('0x8')](_0x427f8f,_0x47de98)[_0xd231('0x9')](function(_0x31c67a){logger['info'](_0xd231('0xa'),_0x560a08,_0xd231('0xb'));logger[_0xd231('0xc')](_0xd231('0xd'),_0x560a08,_0xd231('0xb'),JSON['stringify'](_0x31c67a));if(_0x31c67a[_0xd231('0xe')]){if(_0x31c67a[_0xd231('0xe')][_0xd231('0xf')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x560a08,_0x31c67a[_0xd231('0xe')]['message']);return _0x58a867(_0x31c67a[_0xd231('0xe')][_0xd231('0x10')]);}logger[_0xd231('0xe')](_0xd231('0xa'),_0x560a08,_0x31c67a[_0xd231('0xe')][_0xd231('0x10')]);return _0x31b871(_0x31c67a[_0xd231('0xe')]['message']);}else{logger['info'](_0xd231('0xa'),_0x560a08,_0xd231('0xb'));_0x31b871(_0x31c67a[_0xd231('0x11')][_0xd231('0x10')]);}})[_0xd231('0x12')](function(_0x408931){logger[_0xd231('0xe')](_0xd231('0xa'),_0x560a08,_0x408931);_0x58a867(_0x408931);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 557d714..f3b6215 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 _0xb9ad=['/:id','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb9ad,0xbc));var _0xdb9a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb9ad[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xdb9a('0x0'));var util=require('util');var path=require(_0xdb9a('0x1'));var timeout=require(_0xdb9a('0x2'));var express=require(_0xdb9a('0x3'));var router=express[_0xdb9a('0x4')]();var fs_extra=require(_0xdb9a('0x5'));var auth=require(_0xdb9a('0x6'));var interaction=require(_0xdb9a('0x7'));var config=require('../../config/environment');var controller=require(_0xdb9a('0x8'));router[_0xdb9a('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb9a('0xa')]);router[_0xdb9a('0x9')]('/:id',auth[_0xdb9a('0xb')](),controller[_0xdb9a('0xc')]);router[_0xdb9a('0x9')](_0xdb9a('0xd'),auth[_0xdb9a('0xb')](),controller[_0xdb9a('0xe')]);router[_0xdb9a('0xf')]('/',auth[_0xdb9a('0xb')](),controller[_0xdb9a('0x10')]);router[_0xdb9a('0xf')]('/:id/sounds',auth[_0xdb9a('0xb')](),controller[_0xdb9a('0x11')]);router[_0xdb9a('0x12')]('/:id',auth[_0xdb9a('0xb')](),controller[_0xdb9a('0x13')]);router['delete'](_0xdb9a('0x14'),auth['isAuthenticated'](),controller[_0xdb9a('0x15')]);router[_0xdb9a('0x16')](_0xdb9a('0x17'),auth['isAuthenticated'](),controller[_0xdb9a('0x18')]);module[_0xdb9a('0x19')]=router; \ No newline at end of file +var _0xec4d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','delete','/:id/sounds/:id2','removeSound','multer','util','path'];(function(_0x5dc72,_0x357970){var _0x2a101c=function(_0x1d8886){while(--_0x1d8886){_0x5dc72['push'](_0x5dc72['shift']());}};_0x2a101c(++_0x357970);}(_0xec4d,0xbb));var _0xdec4=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0xec4d[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0xdec4('0x0'));var util=require(_0xdec4('0x1'));var path=require(_0xdec4('0x2'));var timeout=require(_0xdec4('0x3'));var express=require(_0xdec4('0x4'));var router=express[_0xdec4('0x5')]();var fs_extra=require(_0xdec4('0x6'));var auth=require(_0xdec4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdec4('0x8'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdec4('0x9')](_0xdec4('0xa'),auth['isAuthenticated'](),controller[_0xdec4('0xb')]);router['get'](_0xdec4('0xc'),auth[_0xdec4('0xd')](),controller[_0xdec4('0xe')]);router[_0xdec4('0xf')]('/',auth[_0xdec4('0xd')](),controller['create']);router['post'](_0xdec4('0xc'),auth[_0xdec4('0xd')](),controller['addSound']);router['put'](_0xdec4('0xa'),auth[_0xdec4('0xd')](),controller['update']);router[_0xdec4('0x10')](_0xdec4('0xa'),auth[_0xdec4('0xd')](),controller['destroy']);router[_0xdec4('0x10')](_0xdec4('0x11'),auth[_0xdec4('0xd')](),controller[_0xdec4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 58629b0..ac6eb84 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 _0xbcd8=['quietmp3','mp3','STRING','BOOLEAN','name','custom','files','mp3nb','quietmp3nb'];(function(_0x28f67c,_0xfed775){var _0x2ae105=function(_0x3acaa7){while(--_0x3acaa7){_0x28f67c['push'](_0x28f67c['shift']());}};_0x2ae105(++_0xfed775);}(_0xbcd8,0xb8));var _0x8bcd=function(_0x38d97a,_0x39b4cf){_0x38d97a=_0x38d97a-0x0;var _0x5454d3=_0xbcd8[_0x38d97a];return _0x5454d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8bcd('0x0')},'mode':{'type':Sequelize['ENUM'](_0x8bcd('0x1'),_0x8bcd('0x2'),_0x8bcd('0x3'),_0x8bcd('0x4'),_0x8bcd('0x5'),_0x8bcd('0x6')),'allowNull':!![],'defaultValue':_0x8bcd('0x2')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8bcd('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8bcd('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x8bcd('0x7')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x8bcd('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x81a8=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','sequelize','STRING','name','ENUM'];(function(_0x51ac5d,_0x5eb100){var _0x30ff4b=function(_0x2a9738){while(--_0x2a9738){_0x51ac5d['push'](_0x51ac5d['shift']());}};_0x30ff4b(++_0x5eb100);}(_0x81a8,0x151));var _0x881a=function(_0x3937b6,_0xd53d2b){_0x3937b6=_0x3937b6-0x0;var _0x1ba356=_0x81a8[_0x3937b6];return _0x1ba356;};'use strict';var Sequelize=require(_0x881a('0x0'));module['exports']={'name':{'type':Sequelize[_0x881a('0x1')],'allowNull':![],'unique':_0x881a('0x2')},'mode':{'type':Sequelize[_0x881a('0x3')](_0x881a('0x4'),_0x881a('0x5'),_0x881a('0x6'),_0x881a('0x7'),_0x881a('0x8'),_0x881a('0x9')),'allowNull':!![],'defaultValue':_0x881a('0x5')},'directory':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![],'defaultValue':_0x881a('0xa')},'format':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ae2c8e9..04b5d5c 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 _0x232f=['crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','error','stack','rawAttributes','fieldName','type','key','filters','intersection','model','attributes','fields','query','nolimit','order','sort','where','pick','map','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','params','VoiceMusicOnHold','length','body','sequelize','mode','files','root','server/files/moh','create','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','directory','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','converted_format','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','save_name','symlinkSync','message','findOne','removeSound','id2','getSounds','keys','filter','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x89e7c0,_0x414a7a){var _0x19967f=function(_0x571998){while(--_0x571998){_0x89e7c0['push'](_0x89e7c0['shift']());}};_0x19967f(++_0x414a7a);}(_0x232f,0x64));var _0xf232=function(_0x3a18f3,_0xa6b079){_0x3a18f3=_0x3a18f3-0x0;var _0x431120=_0x232f[_0x3a18f3];return _0x431120;};'use strict';var emlformat=require(_0xf232('0x0'));var rimraf=require(_0xf232('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf232('0x2'));var rp=require(_0xf232('0x3'));var moment=require(_0xf232('0x4'));var BPromise=require(_0xf232('0x5'));var Mustache=require(_0xf232('0x6'));var util=require('util');var path=require(_0xf232('0x7'));var sox=require(_0xf232('0x8'));var csv=require('to-csv');var ejs=require(_0xf232('0x9'));var fs=require('fs');var fs_extra=require(_0xf232('0xa'));var _=require(_0xf232('0xb'));var squel=require(_0xf232('0xc'));var crypto=require(_0xf232('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf232('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf232('0xf'));var Redis=require(_0xf232('0x10'));var authService=require(_0xf232('0x11'));var qs=require(_0xf232('0x12'));var as=require(_0xf232('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf232('0x14'))(_0xf232('0x15'));var utils=require(_0xf232('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9a643,_0x71d3fa){_0x71d3fa=_0x71d3fa||0xcc;return function(_0x4c60fc){if(_0x4c60fc){return _0xd9a643[_0xf232('0x17')](_0x71d3fa);}return _0xd9a643[_0xf232('0x18')](_0x71d3fa)[_0xf232('0x19')]();};}function respondWithResult(_0x24d532,_0x3bd8f7){_0x3bd8f7=_0x3bd8f7||0xc8;return function(_0x1db12b){if(_0x1db12b){return _0x24d532[_0xf232('0x18')](_0x3bd8f7)['json'](_0x1db12b);}};}function respondWithFilteredResult(_0x1aad67,_0x345f0d){return function(_0xd952ac){if(_0xd952ac){var _0x5783ca=typeof _0x345f0d[_0xf232('0x1a')]===_0xf232('0x1b')&&typeof _0x345f0d[_0xf232('0x1c')]===_0xf232('0x1b');var _0x176fdd=_0xd952ac[_0xf232('0x1d')];var _0x450de3=_0x5783ca?0x0:_0x345f0d[_0xf232('0x1a')];var _0x2cdc0c=_0x5783ca?_0xd952ac['count']:_0x345f0d[_0xf232('0x1a')]+_0x345f0d[_0xf232('0x1c')];var _0x1b3931;if(_0x2cdc0c>=_0x176fdd){_0x2cdc0c=_0x176fdd;_0x1b3931=0xc8;}else{_0x1b3931=0xce;}_0x1aad67['status'](_0x1b3931);return _0x1aad67['set'](_0xf232('0x1e'),_0x450de3+'-'+_0x2cdc0c+'/'+_0x176fdd)['json'](_0xd952ac);}return null;};}function patchUpdates(_0x268f5a){return function(_0x51ad6c){try{jsonpatch[_0xf232('0x1f')](_0x51ad6c,_0x268f5a,!![]);}catch(_0x50e0f8){return BPromise[_0xf232('0x20')](_0x50e0f8);}return _0x51ad6c[_0xf232('0x21')]();};}function saveUpdates(_0x399738,_0x47fdb6){return function(_0x3f6ff9){if(_0x3f6ff9){return _0x3f6ff9[_0xf232('0x22')](_0x399738)['then'](function(_0x43d195){return _0x43d195;});}return null;};}function removeEntity(_0x4392e7,_0x35c925){return function(_0x360061){if(_0x360061){return _0x360061[_0xf232('0x23')]()[_0xf232('0x24')](function(){var _0x218985=_0x360061['get']({'plain':!![]});var _0x45ade4=_0xf232('0x25');return db[_0xf232('0x26')]['destroy']({'where':{'type':_0x45ade4,'resourceId':_0x218985['id']}})['then'](function(){return _0x360061;});})['then'](function(){_0x4392e7[_0xf232('0x18')](0xcc)[_0xf232('0x19')]();});}};}function handleEntityNotFound(_0x276c50,_0x57bc0c){return function(_0xbaddf0){if(!_0xbaddf0){_0x276c50['sendStatus'](0x194);}return _0xbaddf0;};}function handleError(_0x23ccd2,_0x477b5e){_0x477b5e=_0x477b5e||0x1f4;return function(_0x5280a7){logger[_0xf232('0x27')](_0x5280a7[_0xf232('0x28')]);if(_0x5280a7['name']){delete _0x5280a7['name'];}_0x23ccd2[_0xf232('0x18')](_0x477b5e)['send'](_0x5280a7);};}exports['index']=function(_0x35dd5e,_0x42fac8){var _0x46bde9={},_0x262e4c={},_0x3af115={'count':0x0,'rows':[]};var _0x47d873=_['map'](db['VoiceMusicOnHold'][_0xf232('0x29')],function(_0x9d0179){return{'name':_0x9d0179[_0xf232('0x2a')],'type':_0x9d0179[_0xf232('0x2b')][_0xf232('0x2c')]};});_0x262e4c['model']=_['map'](_0x47d873,'name');_0x262e4c['query']=_['keys'](_0x35dd5e['query']);_0x262e4c[_0xf232('0x2d')]=_[_0xf232('0x2e')](_0x262e4c[_0xf232('0x2f')],_0x262e4c['query']);_0x46bde9[_0xf232('0x30')]=_['intersection'](_0x262e4c['model'],qs[_0xf232('0x31')](_0x35dd5e[_0xf232('0x32')]['fields']));_0x46bde9[_0xf232('0x30')]=_0x46bde9[_0xf232('0x30')]['length']?_0x46bde9[_0xf232('0x30')]:_0x262e4c[_0xf232('0x2f')];if(!_0x35dd5e[_0xf232('0x32')]['hasOwnProperty'](_0xf232('0x33'))){_0x46bde9[_0xf232('0x1c')]=qs['limit'](_0x35dd5e[_0xf232('0x32')][_0xf232('0x1c')]);_0x46bde9['offset']=qs[_0xf232('0x1a')](_0x35dd5e[_0xf232('0x32')]['offset']);}_0x46bde9[_0xf232('0x34')]=qs['sort'](_0x35dd5e[_0xf232('0x32')][_0xf232('0x35')]);delete _0x35dd5e['query'][_0xf232('0x35')];_0x46bde9[_0xf232('0x36')]=qs[_0xf232('0x2d')](_[_0xf232('0x37')](_0x35dd5e['query'],_0x262e4c[_0xf232('0x2d')]),_0x47d873);if(_0x35dd5e['query']['filter']){_0x46bde9[_0xf232('0x36')]=_['merge'](_0x46bde9[_0xf232('0x36')],{'$or':_[_0xf232('0x38')](_0x47d873,function(_0x46876e){if(_0x46876e[_0xf232('0x2b')]!==_0xf232('0x39')){var _0x411abd={};_0x411abd[_0x46876e[_0xf232('0x3a')]]={'$like':'%'+_0x35dd5e['query']['filter']+'%'};return _0x411abd;}})});}_0x46bde9=_[_0xf232('0x3b')]({},_0x46bde9,_0x35dd5e[_0xf232('0x3c')]);var _0x315a54={'where':_0x46bde9[_0xf232('0x36')]};return db['VoiceMusicOnHold'][_0xf232('0x1d')](_0x315a54)[_0xf232('0x24')](function(_0x26ec5c){_0x3af115[_0xf232('0x1d')]=_0x26ec5c;if(_0x35dd5e['query'][_0xf232('0x3d')]){_0x46bde9[_0xf232('0x3e')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xf232('0x3f')](_0x46bde9);})['then'](function(_0x3a19f1){_0x3af115[_0xf232('0x40')]=_0x3a19f1;return _0x3af115;})[_0xf232('0x24')](respondWithFilteredResult(_0x42fac8,_0x46bde9))[_0xf232('0x41')](handleError(_0x42fac8,null));};exports[_0xf232('0x42')]=function(_0x3561c9,_0x8c7b20){var _0x2200a3={'raw':![],'where':{'id':_0x3561c9[_0xf232('0x43')]['id']}},_0x158092={};_0x158092[_0xf232('0x2f')]=_['keys'](db[_0xf232('0x44')][_0xf232('0x29')]);_0x158092[_0xf232('0x32')]=_['keys'](_0x3561c9[_0xf232('0x32')]);_0x158092['filters']=_[_0xf232('0x2e')](_0x158092[_0xf232('0x2f')],_0x158092['query']);_0x2200a3[_0xf232('0x30')]=_[_0xf232('0x2e')](_0x158092['model'],qs['fields'](_0x3561c9[_0xf232('0x32')][_0xf232('0x31')]));_0x2200a3[_0xf232('0x30')]=_0x2200a3[_0xf232('0x30')][_0xf232('0x45')]?_0x2200a3[_0xf232('0x30')]:_0x158092[_0xf232('0x2f')];if(_0x3561c9[_0xf232('0x32')][_0xf232('0x3d')]){_0x2200a3[_0xf232('0x3e')]=[{'all':!![]}];}_0x2200a3=_[_0xf232('0x3b')]({},_0x2200a3,_0x3561c9['options']);return db['VoiceMusicOnHold']['find'](_0x2200a3)['then'](handleEntityNotFound(_0x8c7b20,null))[_0xf232('0x24')](respondWithResult(_0x8c7b20,null))[_0xf232('0x41')](handleError(_0x8c7b20,null));};exports[_0xf232('0x22')]=function(_0x1774b3,_0x388997){if(_0x1774b3[_0xf232('0x46')]['id']){delete _0x1774b3[_0xf232('0x46')]['id'];}return db[_0xf232('0x44')]['find']({'where':{'id':_0x1774b3[_0xf232('0x43')]['id']}})[_0xf232('0x24')](handleEntityNotFound(_0x388997,null))[_0xf232('0x24')](saveUpdates(_0x1774b3[_0xf232('0x46')],null))['then'](respondWithResult(_0x388997,null))[_0xf232('0x41')](handleError(_0x388997,null));};exports['create']=function(_0x4c8117,_0xd82750,_0x51f1d1){return db[_0xf232('0x47')]['transaction'](function(_0x44408a){if(_0x4c8117[_0xf232('0x46')][_0xf232('0x48')]===_0xf232('0x49')){_0x4c8117[_0xf232('0x46')]['directory']=path['join'](config[_0xf232('0x4a')],_0xf232('0x4b'),_0x4c8117[_0xf232('0x46')]['name']);}return db[_0xf232('0x44')][_0xf232('0x4c')](_0x4c8117[_0xf232('0x46')],{'transaction':_0x44408a})[_0xf232('0x24')](function(_0x30250e){if(_0x4c8117[_0xf232('0x46')]['mode']===_0xf232('0x49')){fs[_0xf232('0x4d')](_0x30250e['directory'],parseInt(_0xf232('0x4e'),0x8));}var _0xeb72af=_0x4c8117[_0xf232('0x4f')][_0xf232('0x50')]({'plain':!![]});if(!_0xeb72af)throw new Error(_0xf232('0x51'));if(_0xeb72af['role']===_0xf232('0x4f')){var _0x276077=_0x30250e[_0xf232('0x50')]({'plain':!![]});return db[_0xf232('0x52')][_0xf232('0x53')]({'where':{'name':'MusicOnHolds','userProfileId':_0xeb72af[_0xf232('0x54')]},'raw':!![]})[_0xf232('0x24')](function(_0x3a15fb){if(_0x3a15fb&&_0x3a15fb[_0xf232('0x55')]===0x0){return db['UserProfileResource'][_0xf232('0x4c')]({'name':_0x276077[_0xf232('0x3a')],'resourceId':_0x276077['id'],'type':_0x3a15fb[_0xf232('0x3a')],'sectionId':_0x3a15fb['id']},{})['then'](function(){return _0x30250e;});}else{return _0x30250e;}})['catch'](function(_0x59e1a2){logger[_0xf232('0x27')](_0xf232('0x56'),_0x59e1a2);});}return _0x30250e;});})[_0xf232('0x24')](respondWithResult(_0xd82750,0xc9))[_0xf232('0x41')](handleError(_0xd82750,null));};exports[_0xf232('0x23')]=function(_0x2482e4,_0x457d59,_0x1e944b){var _0x4454f3;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2482e4[_0xf232('0x43')]['id']}})[_0xf232('0x24')](function(_0x292620){if(_0x292620){return db[_0xf232('0x47')][_0xf232('0x57')](function(_0x57362c){return _0x292620[_0xf232('0x23')]({'transaction':_0x57362c,'raw':!![]})[_0xf232('0x24')](function(_0x3c3593){if(_0x3c3593[_0xf232('0x58')]){fs[_0xf232('0x59')](_0x3c3593[_0xf232('0x58')])['forEach'](function(_0x2f1e7f){fs[_0xf232('0x5a')](path['join'](_0x3c3593[_0xf232('0x58')],_0x2f1e7f));});fs[_0xf232('0x5b')](_0x3c3593[_0xf232('0x58')]);}return _0x3c3593;});})[_0xf232('0x41')](function(_0xf66f01){throw new db[(_0xf232('0x5c'))][(_0xf232('0x5d'))](_0xf66f01['message']);});}})['then'](handleEntityNotFound(_0x457d59,null))[_0xf232('0x24')](removeEntity(_0x457d59,null))[_0xf232('0x41')](handleError(_0x457d59,null));};exports[_0xf232('0x5e')]=function(_0x15c1f4,_0x3b70cf,_0x3546ec){return db[_0xf232('0x47')][_0xf232('0x57')](function(_0x55bbf6){var _0x26ed6d;return db[_0xf232('0x44')][_0xf232('0x53')]({'where':{'id':_0x15c1f4[_0xf232('0x43')]['id']}})[_0xf232('0x24')](function(_0x3a237d){if(_0x3a237d){_0x26ed6d=_0x3a237d;return _0x3a237d[_0xf232('0x5e')](_0x15c1f4[_0xf232('0x46')]['id'],{'transaction':_0x55bbf6});}})[_0xf232('0x24')](function(_0xdb40a7){if(_0xdb40a7){return db[_0xf232('0x5f')]['findOne']({'where':{'id':_0x15c1f4[_0xf232('0x46')]['id']},'attributes':['id',_0xf232('0x3a'),'save_name',_0xf232('0x60'),_0xf232('0x61')],'raw':!![]});}})[_0xf232('0x24')](function(_0x320956){if(_0x320956){var _0x1dc8f4=path[_0xf232('0x62')](config[_0xf232('0x4a')],_0xf232('0x63'),util[_0xf232('0x64')](_0xf232('0x65'),path[_0xf232('0x66')](_0x320956[_0xf232('0x67')],path['extname'](_0x320956['save_name'])),_0x320956[_0xf232('0x60')]));var _0x1dc1c3=path[_0xf232('0x62')](config[_0xf232('0x4a')],'server/files/moh',_0x26ed6d[_0xf232('0x3a')],util[_0xf232('0x64')](_0xf232('0x65'),_0x320956[_0xf232('0x3a')],_0x320956[_0xf232('0x60')]));fs[_0xf232('0x68')](_0x1dc8f4,_0x1dc1c3);return _0x320956;}})['catch'](function(_0x3abfe9){throw new db[(_0xf232('0x5c'))][(_0xf232('0x5d'))](_0x3abfe9[_0xf232('0x69')]);});})['then'](handleEntityNotFound(_0x3b70cf,null))[_0xf232('0x24')](respondWithResult(_0x3b70cf,0xc9))['catch'](handleError(_0x3b70cf,null));};exports['removeSound']=function(_0x5f4257,_0x2b5e7d,_0x2cd817){return db[_0xf232('0x47')][_0xf232('0x57')](function(_0x2a8375){var _0x45d804;return db[_0xf232('0x44')][_0xf232('0x6a')]({'where':{'id':_0x5f4257[_0xf232('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b5e7d,null))[_0xf232('0x24')](function(_0x3cabe4){if(_0x3cabe4){_0x45d804=_0x3cabe4;return _0x3cabe4[_0xf232('0x6b')](_0x5f4257[_0xf232('0x43')][_0xf232('0x6c')]);}})[_0xf232('0x24')](function(_0x2faf63){if(_0x2faf63){return db[_0xf232('0x5f')][_0xf232('0x6a')]({'where':{'id':_0x5f4257['params']['id2']},'attributes':['id',_0xf232('0x3a'),'save_name','converted_format',_0xf232('0x61')],'raw':!![]});}})[_0xf232('0x24')](function(_0x53390c){if(_0x53390c){fs[_0xf232('0x5a')](path[_0xf232('0x62')](_0x45d804['directory'],util[_0xf232('0x64')]('%s.%s',_0x53390c[_0xf232('0x3a')],_0x53390c['converted_format'])));return _0x53390c;}})[_0xf232('0x41')](function(_0x111135){throw new db[(_0xf232('0x5c'))]['ValidationError'](_0x111135['message']);});})[_0xf232('0x24')](handleEntityNotFound(_0x2b5e7d,null))['then'](respondWithStatusCode(_0x2b5e7d,0xcc))['catch'](handleError(_0x2b5e7d,null));};exports[_0xf232('0x6d')]=function(_0x222b6b,_0x2df904,_0x1ed405){var _0x1910b8={};var _0x19ed39={};var _0x293bde;var _0x282333;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x222b6b[_0xf232('0x43')]['id']}})[_0xf232('0x24')](handleEntityNotFound(_0x2df904,null))['then'](function(_0x21a199){if(_0x21a199){_0x293bde=_0x21a199;_0x19ed39['model']=_[_0xf232('0x6e')](db[_0xf232('0x5f')][_0xf232('0x29')]);_0x19ed39[_0xf232('0x32')]=_[_0xf232('0x6e')](_0x222b6b[_0xf232('0x32')]);_0x19ed39['filters']=_[_0xf232('0x2e')](_0x19ed39[_0xf232('0x2f')],_0x19ed39[_0xf232('0x32')]);_0x1910b8['attributes']=_['intersection'](_0x19ed39['model'],qs['fields'](_0x222b6b['query']['fields']));_0x1910b8['attributes']=_0x1910b8[_0xf232('0x30')][_0xf232('0x45')]?_0x1910b8[_0xf232('0x30')]:_0x19ed39[_0xf232('0x2f')];_0x1910b8[_0xf232('0x34')]=qs['sort'](_0x222b6b[_0xf232('0x32')][_0xf232('0x35')]);_0x1910b8[_0xf232('0x36')]=qs[_0xf232('0x2d')](_[_0xf232('0x37')](_0x222b6b[_0xf232('0x32')],_0x19ed39[_0xf232('0x2d')]));if(_0x222b6b[_0xf232('0x32')][_0xf232('0x6f')]){_0x1910b8[_0xf232('0x36')]=_[_0xf232('0x3b')](_0x1910b8[_0xf232('0x36')],{'$or':_[_0xf232('0x38')](_0x1910b8['attributes'],function(_0x38e99d){var _0x313c7c={};_0x313c7c[_0x38e99d]={'$like':'%'+_0x222b6b[_0xf232('0x32')][_0xf232('0x6f')]+'%'};return _0x313c7c;})});}_0x1910b8=_[_0xf232('0x3b')]({},_0x1910b8,_0x222b6b[_0xf232('0x3c')]);return _0x293bde['getSounds'](_0x1910b8);}})[_0xf232('0x24')](function(_0x3fa57e){if(_0x3fa57e){_0x282333=_0x3fa57e['length'];if(!_0x222b6b[_0xf232('0x32')][_0xf232('0x70')](_0xf232('0x33'))){_0x1910b8[_0xf232('0x1c')]=qs[_0xf232('0x1c')](_0x222b6b[_0xf232('0x32')][_0xf232('0x1c')]);_0x1910b8['offset']=qs['offset'](_0x222b6b['query'][_0xf232('0x1a')]);}return _0x293bde[_0xf232('0x6d')](_0x1910b8);}})[_0xf232('0x24')](function(_0x460329){if(_0x460329){return _0x460329?{'count':_0x282333,'rows':_0x460329}:null;}})['then'](respondWithResult(_0x2df904,null))[_0xf232('0x41')](handleError(_0x2df904,null));}; \ No newline at end of file +var _0x1f41=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','ValidationError','removeSound','Sound','getSounds','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x235b95,_0x43b276){var _0x323f8f=function(_0x5cbe23){while(--_0x5cbe23){_0x235b95['push'](_0x235b95['shift']());}};_0x323f8f(++_0x43b276);}(_0x1f41,0xd5));var _0x11f4=function(_0x885082,_0x13f7e7){_0x885082=_0x885082-0x0;var _0x3b3a5e=_0x1f41[_0x885082];return _0x3b3a5e;};'use strict';var emlformat=require(_0x11f4('0x0'));var rimraf=require(_0x11f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x11f4('0x3'));var Mustache=require(_0x11f4('0x4'));var util=require('util');var path=require(_0x11f4('0x5'));var sox=require(_0x11f4('0x6'));var csv=require(_0x11f4('0x7'));var ejs=require(_0x11f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11f4('0x9'));var squel=require(_0x11f4('0xa'));var crypto=require(_0x11f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x11f4('0xc'));var toCsv=require(_0x11f4('0x7'));var querystring=require(_0x11f4('0xd'));var Papa=require('papaparse');var Redis=require(_0x11f4('0xe'));var authService=require(_0x11f4('0xf'));var qs=require(_0x11f4('0x10'));var as=require(_0x11f4('0x11'));var hardwareService=require(_0x11f4('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x11f4('0x13'));var db=require(_0x11f4('0x14'))['db'];function respondWithStatusCode(_0x1ae73f,_0x3e424c){_0x3e424c=_0x3e424c||0xcc;return function(_0x40625e){if(_0x40625e){return _0x1ae73f[_0x11f4('0x15')](_0x3e424c);}return _0x1ae73f['status'](_0x3e424c)[_0x11f4('0x16')]();};}function respondWithResult(_0x2f0140,_0x258a8d){_0x258a8d=_0x258a8d||0xc8;return function(_0x15f8e3){if(_0x15f8e3){return _0x2f0140[_0x11f4('0x17')](_0x258a8d)[_0x11f4('0x18')](_0x15f8e3);}};}function respondWithFilteredResult(_0x40d9ef,_0x4ec18e){return function(_0xff3591){if(_0xff3591){var _0x26b9d0=typeof _0x4ec18e[_0x11f4('0x19')]===_0x11f4('0x1a')&&typeof _0x4ec18e[_0x11f4('0x1b')]===_0x11f4('0x1a');var _0x5e4541=_0xff3591[_0x11f4('0x1c')];var _0x2fc6c1=_0x26b9d0?0x0:_0x4ec18e[_0x11f4('0x19')];var _0x25f74a=_0x26b9d0?_0xff3591[_0x11f4('0x1c')]:_0x4ec18e[_0x11f4('0x19')]+_0x4ec18e['limit'];var _0x35e621;if(_0x25f74a>=_0x5e4541){_0x25f74a=_0x5e4541;_0x35e621=0xc8;}else{_0x35e621=0xce;}_0x40d9ef['status'](_0x35e621);return _0x40d9ef[_0x11f4('0x1d')]('Content-Range',_0x2fc6c1+'-'+_0x25f74a+'/'+_0x5e4541)[_0x11f4('0x18')](_0xff3591);}return null;};}function patchUpdates(_0x2ef57b){return function(_0x4f1280){try{jsonpatch[_0x11f4('0x1e')](_0x4f1280,_0x2ef57b,!![]);}catch(_0x3af72d){return BPromise['reject'](_0x3af72d);}return _0x4f1280[_0x11f4('0x1f')]();};}function saveUpdates(_0x36ba91,_0x5b0010){return function(_0x53e431){if(_0x53e431){return _0x53e431[_0x11f4('0x20')](_0x36ba91)[_0x11f4('0x21')](function(_0x1a0498){return _0x1a0498;});}return null;};}function removeEntity(_0x4cb402,_0x92c8ce){return function(_0x566186){if(_0x566186){return _0x566186[_0x11f4('0x22')]()[_0x11f4('0x21')](function(){var _0x44de68=_0x566186[_0x11f4('0x23')]({'plain':!![]});var _0x21df77=_0x11f4('0x24');return db[_0x11f4('0x25')][_0x11f4('0x22')]({'where':{'type':_0x21df77,'resourceId':_0x44de68['id']}})[_0x11f4('0x21')](function(){return _0x566186;});})[_0x11f4('0x21')](function(){_0x4cb402[_0x11f4('0x17')](0xcc)[_0x11f4('0x16')]();});}};}function handleEntityNotFound(_0x5b1593,_0x317efb){return function(_0x2e1977){if(!_0x2e1977){_0x5b1593[_0x11f4('0x15')](0x194);}return _0x2e1977;};}function handleError(_0x3bf34c,_0x1bc09f){_0x1bc09f=_0x1bc09f||0x1f4;return function(_0x4e9e2c){logger[_0x11f4('0x26')](_0x4e9e2c[_0x11f4('0x27')]);if(_0x4e9e2c[_0x11f4('0x28')]){delete _0x4e9e2c[_0x11f4('0x28')];}_0x3bf34c[_0x11f4('0x17')](_0x1bc09f)[_0x11f4('0x29')](_0x4e9e2c);};}exports['index']=function(_0x37523f,_0x294bc7){var _0x3c9b23={},_0x2eb913={},_0x4c0e98={'count':0x0,'rows':[]};var _0x4be07b=_['map'](db[_0x11f4('0x2a')][_0x11f4('0x2b')],function(_0xde376){return{'name':_0xde376[_0x11f4('0x2c')],'type':_0xde376['type'][_0x11f4('0x2d')]};});_0x2eb913[_0x11f4('0x2e')]=_['map'](_0x4be07b,_0x11f4('0x28'));_0x2eb913['query']=_['keys'](_0x37523f[_0x11f4('0x2f')]);_0x2eb913[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x2eb913[_0x11f4('0x2e')],_0x2eb913[_0x11f4('0x2f')]);_0x3c9b23[_0x11f4('0x32')]=_[_0x11f4('0x31')](_0x2eb913[_0x11f4('0x2e')],qs['fields'](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x3c9b23['attributes']=_0x3c9b23[_0x11f4('0x32')][_0x11f4('0x34')]?_0x3c9b23[_0x11f4('0x32')]:_0x2eb913[_0x11f4('0x2e')];if(!_0x37523f[_0x11f4('0x2f')][_0x11f4('0x35')](_0x11f4('0x36'))){_0x3c9b23['limit']=qs[_0x11f4('0x1b')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x1b')]);_0x3c9b23[_0x11f4('0x19')]=qs[_0x11f4('0x19')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x19')]);}_0x3c9b23[_0x11f4('0x37')]=qs[_0x11f4('0x38')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x38')]);delete _0x37523f['query'][_0x11f4('0x38')];_0x3c9b23[_0x11f4('0x39')]=qs[_0x11f4('0x30')](_[_0x11f4('0x3a')](_0x37523f[_0x11f4('0x2f')],_0x2eb913[_0x11f4('0x30')]),_0x4be07b);if(_0x37523f[_0x11f4('0x2f')][_0x11f4('0x3b')]){_0x3c9b23[_0x11f4('0x39')]=_['merge'](_0x3c9b23[_0x11f4('0x39')],{'$or':_[_0x11f4('0x3c')](_0x4be07b,function(_0x464983){if(_0x464983[_0x11f4('0x3d')]!==_0x11f4('0x3e')){var _0x24054f={};_0x24054f[_0x464983[_0x11f4('0x28')]]={'$like':'%'+_0x37523f[_0x11f4('0x2f')][_0x11f4('0x3b')]+'%'};return _0x24054f;}})});}_0x3c9b23=_[_0x11f4('0x3f')]({},_0x3c9b23,_0x37523f[_0x11f4('0x40')]);var _0x3267c1={'where':_0x3c9b23[_0x11f4('0x39')]};return db[_0x11f4('0x2a')][_0x11f4('0x1c')](_0x3267c1)[_0x11f4('0x21')](function(_0x31de99){_0x4c0e98['count']=_0x31de99;if(_0x37523f[_0x11f4('0x2f')][_0x11f4('0x41')]){_0x3c9b23[_0x11f4('0x42')]=[{'all':!![]}];}return db[_0x11f4('0x2a')][_0x11f4('0x43')](_0x3c9b23);})[_0x11f4('0x21')](function(_0x5ef2d2){_0x4c0e98[_0x11f4('0x44')]=_0x5ef2d2;return _0x4c0e98;})[_0x11f4('0x21')](respondWithFilteredResult(_0x294bc7,_0x3c9b23))[_0x11f4('0x45')](handleError(_0x294bc7,null));};exports[_0x11f4('0x46')]=function(_0xddcc25,_0x407861){var _0x1de998={'raw':![],'where':{'id':_0xddcc25[_0x11f4('0x47')]['id']}},_0x3e9be4={};_0x3e9be4['model']=_[_0x11f4('0x48')](db[_0x11f4('0x2a')]['rawAttributes']);_0x3e9be4['query']=_[_0x11f4('0x48')](_0xddcc25[_0x11f4('0x2f')]);_0x3e9be4[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x3e9be4[_0x11f4('0x2e')],_0x3e9be4[_0x11f4('0x2f')]);_0x1de998[_0x11f4('0x32')]=_[_0x11f4('0x31')](_0x3e9be4[_0x11f4('0x2e')],qs[_0x11f4('0x33')](_0xddcc25[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x1de998[_0x11f4('0x32')]=_0x1de998[_0x11f4('0x32')][_0x11f4('0x34')]?_0x1de998['attributes']:_0x3e9be4[_0x11f4('0x2e')];if(_0xddcc25[_0x11f4('0x2f')][_0x11f4('0x41')]){_0x1de998['include']=[{'all':!![]}];}_0x1de998=_[_0x11f4('0x3f')]({},_0x1de998,_0xddcc25[_0x11f4('0x40')]);return db[_0x11f4('0x2a')][_0x11f4('0x49')](_0x1de998)[_0x11f4('0x21')](handleEntityNotFound(_0x407861,null))['then'](respondWithResult(_0x407861,null))['catch'](handleError(_0x407861,null));};exports['update']=function(_0x36da2e,_0x325839){if(_0x36da2e[_0x11f4('0x4a')]['id']){delete _0x36da2e[_0x11f4('0x4a')]['id'];}return db[_0x11f4('0x2a')][_0x11f4('0x49')]({'where':{'id':_0x36da2e[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x325839,null))['then'](saveUpdates(_0x36da2e['body'],null))[_0x11f4('0x21')](respondWithResult(_0x325839,null))[_0x11f4('0x45')](handleError(_0x325839,null));};exports[_0x11f4('0x4b')]=function(_0x450b64,_0x165480,_0x1f9e8e){return db[_0x11f4('0x4c')]['transaction'](function(_0x181cb3){if(_0x450b64['body'][_0x11f4('0x4d')]===_0x11f4('0x4e')){_0x450b64['body'][_0x11f4('0x4f')]=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x52'),_0x450b64['body']['name']);}return db[_0x11f4('0x2a')][_0x11f4('0x4b')](_0x450b64[_0x11f4('0x4a')],{'transaction':_0x181cb3})[_0x11f4('0x21')](function(_0x2ebbdb){if(_0x450b64[_0x11f4('0x4a')]['mode']===_0x11f4('0x4e')){fs[_0x11f4('0x53')](_0x2ebbdb[_0x11f4('0x4f')],parseInt(_0x11f4('0x54'),0x8));}var _0x1f5228=_0x450b64['user'][_0x11f4('0x23')]({'plain':!![]});if(!_0x1f5228)throw new Error(_0x11f4('0x55'));if(_0x1f5228[_0x11f4('0x56')]===_0x11f4('0x57')){var _0x58bc96=_0x2ebbdb[_0x11f4('0x23')]({'plain':!![]});return db[_0x11f4('0x58')][_0x11f4('0x49')]({'where':{'name':_0x11f4('0x24'),'userProfileId':_0x1f5228[_0x11f4('0x59')]},'raw':!![]})['then'](function(_0x4deb84){if(_0x4deb84&&_0x4deb84[_0x11f4('0x5a')]===0x0){return db[_0x11f4('0x25')]['create']({'name':_0x58bc96[_0x11f4('0x28')],'resourceId':_0x58bc96['id'],'type':_0x4deb84[_0x11f4('0x28')],'sectionId':_0x4deb84['id']},{})[_0x11f4('0x21')](function(){return _0x2ebbdb;});}else{return _0x2ebbdb;}})[_0x11f4('0x45')](function(_0x213b6b){logger['error'](_0x11f4('0x5b'),_0x213b6b);});}return _0x2ebbdb;});})['then'](respondWithResult(_0x165480,0xc9))[_0x11f4('0x45')](handleError(_0x165480,null));};exports['destroy']=function(_0x1ed99a,_0x16de4f,_0x371aa6){var _0x2cafe8;return db[_0x11f4('0x2a')]['find']({'where':{'id':_0x1ed99a[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](function(_0x4dcbc7){if(_0x4dcbc7){return db['sequelize'][_0x11f4('0x5c')](function(_0x1b2736){return _0x4dcbc7[_0x11f4('0x22')]({'transaction':_0x1b2736,'raw':!![]})['then'](function(_0x1e32df){if(_0x1e32df[_0x11f4('0x4f')]){fs[_0x11f4('0x5d')](_0x1e32df['directory'])[_0x11f4('0x5e')](function(_0x280ce7){fs[_0x11f4('0x5f')](path[_0x11f4('0x50')](_0x1e32df['directory'],_0x280ce7));});fs[_0x11f4('0x60')](_0x1e32df['directory']);}return _0x1e32df;});})['catch'](function(_0x1f92d3){throw new db[(_0x11f4('0x61'))]['ValidationError'](_0x1f92d3[_0x11f4('0x62')]);});}})[_0x11f4('0x21')](handleEntityNotFound(_0x16de4f,null))['then'](removeEntity(_0x16de4f,null))['catch'](handleError(_0x16de4f,null));};exports[_0x11f4('0x63')]=function(_0x3daf18,_0x2b8d56,_0x34d3f0){return db[_0x11f4('0x4c')][_0x11f4('0x5c')](function(_0x3b80e4){var _0x19a0d2;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3daf18['params']['id']}})[_0x11f4('0x21')](function(_0x5ba488){if(_0x5ba488){_0x19a0d2=_0x5ba488;return _0x5ba488[_0x11f4('0x63')](_0x3daf18[_0x11f4('0x4a')]['id'],{'transaction':_0x3b80e4});}})[_0x11f4('0x21')](function(_0x6ea9df){if(_0x6ea9df){return db['Sound'][_0x11f4('0x64')]({'where':{'id':_0x3daf18[_0x11f4('0x4a')]['id']},'attributes':['id',_0x11f4('0x28'),_0x11f4('0x65'),_0x11f4('0x66'),_0x11f4('0x67')],'raw':!![]});}})[_0x11f4('0x21')](function(_0x1939f8){if(_0x1939f8){var _0x4cb06b=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x68'),util[_0x11f4('0x69')](_0x11f4('0x6a'),path[_0x11f4('0x6b')](_0x1939f8['save_name'],path[_0x11f4('0x6c')](_0x1939f8[_0x11f4('0x65')])),_0x1939f8['converted_format']));var _0x1bd90e=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x52'),_0x19a0d2[_0x11f4('0x28')],util[_0x11f4('0x69')]('%s.%s',_0x1939f8[_0x11f4('0x28')],_0x1939f8[_0x11f4('0x66')]));fs[_0x11f4('0x6d')](_0x4cb06b,_0x1bd90e);return _0x1939f8;}})[_0x11f4('0x45')](function(_0x2c15a3){throw new db[(_0x11f4('0x61'))][(_0x11f4('0x6e'))](_0x2c15a3[_0x11f4('0x62')]);});})[_0x11f4('0x21')](handleEntityNotFound(_0x2b8d56,null))['then'](respondWithResult(_0x2b8d56,0xc9))[_0x11f4('0x45')](handleError(_0x2b8d56,null));};exports[_0x11f4('0x6f')]=function(_0x5214fb,_0x2db4fd,_0x1b0d68){return db[_0x11f4('0x4c')]['transaction'](function(_0x470a45){var _0x42024a;return db['VoiceMusicOnHold'][_0x11f4('0x64')]({'where':{'id':_0x5214fb[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x2db4fd,null))['then'](function(_0x344c88){if(_0x344c88){_0x42024a=_0x344c88;return _0x344c88[_0x11f4('0x6f')](_0x5214fb[_0x11f4('0x47')]['id2']);}})[_0x11f4('0x21')](function(_0x5b3e94){if(_0x5b3e94){return db[_0x11f4('0x70')]['findOne']({'where':{'id':_0x5214fb[_0x11f4('0x47')]['id2']},'attributes':['id','name','save_name',_0x11f4('0x66'),_0x11f4('0x67')],'raw':!![]});}})[_0x11f4('0x21')](function(_0x28a526){if(_0x28a526){fs[_0x11f4('0x5f')](path[_0x11f4('0x50')](_0x42024a[_0x11f4('0x4f')],util[_0x11f4('0x69')](_0x11f4('0x6a'),_0x28a526[_0x11f4('0x28')],_0x28a526[_0x11f4('0x66')])));return _0x28a526;}})[_0x11f4('0x45')](function(_0x54695b){throw new db[(_0x11f4('0x61'))][(_0x11f4('0x6e'))](_0x54695b['message']);});})[_0x11f4('0x21')](handleEntityNotFound(_0x2db4fd,null))[_0x11f4('0x21')](respondWithStatusCode(_0x2db4fd,0xcc))['catch'](handleError(_0x2db4fd,null));};exports[_0x11f4('0x71')]=function(_0x5c8391,_0x2d8a00,_0x44510f){var _0x3acc39={};var _0x4e2256={};var _0x156829;var _0x504fc2;return db[_0x11f4('0x2a')][_0x11f4('0x64')]({'where':{'id':_0x5c8391['params']['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x2d8a00,null))[_0x11f4('0x21')](function(_0x57726e){if(_0x57726e){_0x156829=_0x57726e;_0x4e2256[_0x11f4('0x2e')]=_[_0x11f4('0x48')](db[_0x11f4('0x70')][_0x11f4('0x2b')]);_0x4e2256[_0x11f4('0x2f')]=_[_0x11f4('0x48')](_0x5c8391[_0x11f4('0x2f')]);_0x4e2256[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x4e2256[_0x11f4('0x2e')],_0x4e2256['query']);_0x3acc39[_0x11f4('0x32')]=_['intersection'](_0x4e2256['model'],qs[_0x11f4('0x33')](_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x3acc39[_0x11f4('0x32')]=_0x3acc39[_0x11f4('0x32')][_0x11f4('0x34')]?_0x3acc39[_0x11f4('0x32')]:_0x4e2256[_0x11f4('0x2e')];_0x3acc39[_0x11f4('0x37')]=qs[_0x11f4('0x38')](_0x5c8391[_0x11f4('0x2f')]['sort']);_0x3acc39[_0x11f4('0x39')]=qs[_0x11f4('0x30')](_[_0x11f4('0x3a')](_0x5c8391[_0x11f4('0x2f')],_0x4e2256[_0x11f4('0x30')]));if(_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x3b')]){_0x3acc39[_0x11f4('0x39')]=_[_0x11f4('0x3f')](_0x3acc39[_0x11f4('0x39')],{'$or':_[_0x11f4('0x3c')](_0x3acc39[_0x11f4('0x32')],function(_0x531c23){var _0x598096={};_0x598096[_0x531c23]={'$like':'%'+_0x5c8391['query'][_0x11f4('0x3b')]+'%'};return _0x598096;})});}_0x3acc39=_['merge']({},_0x3acc39,_0x5c8391[_0x11f4('0x40')]);return _0x156829[_0x11f4('0x71')](_0x3acc39);}})[_0x11f4('0x21')](function(_0x56fadd){if(_0x56fadd){_0x504fc2=_0x56fadd[_0x11f4('0x34')];if(!_0x5c8391['query'][_0x11f4('0x35')]('nolimit')){_0x3acc39[_0x11f4('0x1b')]=qs[_0x11f4('0x1b')](_0x5c8391['query']['limit']);_0x3acc39['offset']=qs[_0x11f4('0x19')](_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x19')]);}return _0x156829[_0x11f4('0x71')](_0x3acc39);}})['then'](function(_0x4770cc){if(_0x4770cc){return _0x4770cc?{'count':_0x504fc2,'rows':_0x4770cc}:null;}})[_0x11f4('0x21')](respondWithResult(_0x2d8a00,null))['catch'](handleError(_0x2d8a00,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fcd5ec9..7fd4a6c 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 _0xd183=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x4f7e81,_0xffe402){var _0x16fbb7=function(_0x539e3f){while(--_0x539e3f){_0x4f7e81['push'](_0x4f7e81['shift']());}};_0x16fbb7(++_0xffe402);}(_0xd183,0xb7));var _0x3d18=function(_0x5ca9de,_0x518185){_0x5ca9de=_0x5ca9de-0x0;var _0x2b7db1=_0xd183[_0x5ca9de];return _0x2b7db1;};'use strict';var _=require(_0x3d18('0x0'));var util=require(_0x3d18('0x1'));var logger=require(_0x3d18('0x2'))(_0x3d18('0x3'));var moment=require('moment');var BPromise=require(_0x3d18('0x4'));var rp=require(_0x3d18('0x5'));var fs=require('fs');var path=require(_0x3d18('0x6'));var rimraf=require(_0x3d18('0x7'));var config=require(_0x3d18('0x8'));var attributes=require(_0x3d18('0x9'));module['exports']=function(_0x13054d,_0x42e6de){return _0x13054d['define']('VoiceMusicOnHold',attributes,{'tableName':_0x3d18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1b6=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment'];(function(_0x2dbd35,_0x16a0ea){var _0x54be26=function(_0x2c3727){while(--_0x2c3727){_0x2dbd35['push'](_0x2dbd35['shift']());}};_0x54be26(++_0x16a0ea);}(_0xc1b6,0x165));var _0x6c1b=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0xc1b6[_0x16f77c];return _0x78986e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c1b('0x0'))(_0x6c1b('0x1'));var moment=require(_0x6c1b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c1b('0x3'));var rimraf=require(_0x6c1b('0x4'));var config=require(_0x6c1b('0x5'));var attributes=require(_0x6c1b('0x6'));module['exports']=function(_0x1d55f0,_0x45eb9c){return _0x1d55f0['define'](_0x6c1b('0x7'),attributes,{'tableName':_0x6c1b('0x8'),'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 c8e4178..2ccd807 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1381a8,_0x1e0a08){var _0x2d3a17=function(_0x4514ea){while(--_0x4514ea){_0x1381a8['push'](_0x1381a8['shift']());}};_0x2d3a17(++_0x1e0a08);}(_0xe706,0xa3));var _0x6e70=function(_0x32017c,_0x3991d4){_0x32017c=_0x32017c-0x0;var _0xca9140=_0xe706[_0x32017c];return _0xca9140;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +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(_0x6b2b9f,_0x573f4f){var _0x1933a5=function(_0x32e2b5){while(--_0x32e2b5){_0x6b2b9f['push'](_0x6b2b9f['shift']());}};_0x1933a5(++_0x573f4f);}(_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 685e3dc..4613e6a 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 _0x8a9c=['getTeams','post','create','/:id/users','addAgents','put','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getAgents','/:id/teams'];(function(_0x155341,_0x4c9b9e){var _0x297a60=function(_0x5f4c09){while(--_0x5f4c09){_0x155341['push'](_0x155341['shift']());}};_0x297a60(++_0x4c9b9e);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var path=require(_0xc8a9('0x2'));var timeout=require(_0xc8a9('0x3'));var express=require(_0xc8a9('0x4'));var router=express['Router']();var fs_extra=require(_0xc8a9('0x5'));var auth=require(_0xc8a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8a9('0x7'));var controller=require(_0xc8a9('0x8'));router[_0xc8a9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8a9('0xa')]);router[_0xc8a9('0x9')](_0xc8a9('0xb'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xd')]);router[_0xc8a9('0x9')](_0xc8a9('0xe'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xf')]);router['get']('/:id/users',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x10')]);router['get'](_0xc8a9('0x11'),auth['isAuthenticated'](),controller[_0xc8a9('0x12')]);router[_0xc8a9('0x13')]('/',auth['isAuthenticated'](),controller[_0xc8a9('0x14')]);router['post'](_0xc8a9('0x15'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x16')]);router[_0xc8a9('0x13')](_0xc8a9('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc8a9('0x17')]('/:id',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x18')]);router[_0xc8a9('0x19')](_0xc8a9('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/users',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x1a')]);router['delete'](_0xc8a9('0x11'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0x1b')]);module[_0xc8a9('0x1c')]=router; \ No newline at end of file +var _0x34f8=['getTeams','post','/:id/users','addAgents','addTeams','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','getAgents','/:id/teams'];(function(_0x4c4d9c,_0x5bd0eb){var _0x5063fb=function(_0x46cb30){while(--_0x46cb30){_0x4c4d9c['push'](_0x4c4d9c['shift']());}};_0x5063fb(++_0x5bd0eb);}(_0x34f8,0x80));var _0x834f=function(_0x3c9b8d,_0x435d7f){_0x3c9b8d=_0x3c9b8d-0x0;var _0x44314f=_0x34f8[_0x3c9b8d];return _0x44314f;};'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']('/describe',auth[_0x834f('0x9')](),controller[_0x834f('0xb')]);router[_0x834f('0x8')](_0x834f('0xc'),auth['isAuthenticated'](),controller[_0x834f('0xd')]);router[_0x834f('0x8')]('/:id/users',auth[_0x834f('0x9')](),controller[_0x834f('0xe')]);router[_0x834f('0x8')](_0x834f('0xf'),auth[_0x834f('0x9')](),controller[_0x834f('0x10')]);router[_0x834f('0x11')]('/',auth[_0x834f('0x9')](),controller['create']);router[_0x834f('0x11')](_0x834f('0x12'),auth[_0x834f('0x9')](),controller[_0x834f('0x13')]);router[_0x834f('0x11')]('/:id/teams',auth[_0x834f('0x9')](),controller[_0x834f('0x14')]);router['put'](_0x834f('0xc'),auth[_0x834f('0x9')](),controller['update']);router[_0x834f('0x15')]('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0x16')]);router[_0x834f('0x15')](_0x834f('0x12'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x834f('0x15')](_0x834f('0xf'),auth[_0x834f('0x9')](),controller[_0x834f('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 16f0146..9d3632f 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 _0x1868=['exports','STRING','name','VIRTUAL','system-','INTEGER'];(function(_0x198e15,_0x5e4190){var _0x2e4c02=function(_0x12c073){while(--_0x12c073){_0x198e15['push'](_0x198e15['shift']());}};_0x2e4c02(++_0x5e4190);}(_0x1868,0x1da));var _0x8186=function(_0x5974cc,_0x5cb332){_0x5974cc=_0x5974cc-0x0;var _0x2ddb13=_0x1868[_0x5974cc];return _0x2ddb13;};'use strict';var Sequelize=require('sequelize');module[_0x8186('0x0')]={'name':{'type':Sequelize[_0x8186('0x1')],'allowNull':![],'unique':_0x8186('0x2')},'prefix':{'type':Sequelize[_0x8186('0x3')],'get':function(_0x5c8153){return _0x8186('0x4')+this['getDataValue'](_0x8186('0x2'))+'-';}},'description':{'type':Sequelize[_0x8186('0x1')]},'callerIdAll':{'type':Sequelize[_0x8186('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x8186('0x5')]}}; \ No newline at end of file +var _0x0aec=['VIRTUAL','STRING','name'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x0aec,0xbb));var _0xc0ae=function(_0x2bfa34,_0x2ad8c0){_0x2bfa34=_0x2bfa34-0x0;var _0x411a60=_0x0aec[_0x2bfa34];return _0x411a60;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc0ae('0x0')],'allowNull':![],'unique':_0xc0ae('0x1')},'prefix':{'type':Sequelize[_0xc0ae('0x2')],'get':function(_0xbc6b18){return'system-'+this['getDataValue'](_0xc0ae('0x1'))+'-';}},'description':{'type':Sequelize[_0xc0ae('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 987a601..e8631ff 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x065e=['localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','VoicePrefixes','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoicePrefix','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','callerIdAll','push','Set','PREFIX-CALLERIDALL=','NoOp','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','findAll','Agents','voicePause','interface','each','upsert','UserVoicePrefix','forEach','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','every','TeamId','includes','all','union','compact','isEmpty','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x2f3570,_0x4d7940){var _0x5bbab8=function(_0xf7e8e1){while(--_0xf7e8e1){_0x2f3570['push'](_0x2f3570['shift']());}};_0x5bbab8(++_0x4d7940);}(_0x065e,0x1a7));var _0xe065=function(_0x3093fd,_0x22a601){_0x3093fd=_0x3093fd-0x0;var _0x490262=_0x065e[_0x3093fd];return _0x490262;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];config[_0xe065('0x16')]=_[_0xe065('0x17')](config['redis'],{'host':_0xe065('0x18'),'port':0x18eb});var socket=require(_0xe065('0x19'))(new Redis(config[_0xe065('0x16')]));require(_0xe065('0x1a'))[_0xe065('0x1b')](socket);function respondWithStatusCode(_0x541985,_0x3d3557){_0x3d3557=_0x3d3557||0xcc;return function(_0x2b4789){if(_0x2b4789){return _0x541985[_0xe065('0x1c')](_0x3d3557);}return _0x541985[_0xe065('0x1d')](_0x3d3557)[_0xe065('0x1e')]();};}function respondWithResult(_0x352206,_0x2e5feb){_0x2e5feb=_0x2e5feb||0xc8;return function(_0x545100){if(_0x545100){return _0x352206[_0xe065('0x1d')](_0x2e5feb)[_0xe065('0x1f')](_0x545100);}};}function respondWithFilteredResult(_0x54d260,_0x2bfec0){return function(_0x1d2f7a){if(_0x1d2f7a){var _0x397f05=typeof _0x2bfec0[_0xe065('0x20')]===_0xe065('0x21')&&typeof _0x2bfec0[_0xe065('0x22')]===_0xe065('0x21');var _0x5000e1=_0x1d2f7a[_0xe065('0x23')];var _0x52e9b2=_0x397f05?0x0:_0x2bfec0[_0xe065('0x20')];var _0x23233d=_0x397f05?_0x1d2f7a['count']:_0x2bfec0[_0xe065('0x20')]+_0x2bfec0['limit'];var _0xe26e9b;if(_0x23233d>=_0x5000e1){_0x23233d=_0x5000e1;_0xe26e9b=0xc8;}else{_0xe26e9b=0xce;}_0x54d260[_0xe065('0x1d')](_0xe26e9b);return _0x54d260[_0xe065('0x24')](_0xe065('0x25'),_0x52e9b2+'-'+_0x23233d+'/'+_0x5000e1)[_0xe065('0x1f')](_0x1d2f7a);}return null;};}function patchUpdates(_0x105cb2){return function(_0x22a0cb){try{jsonpatch[_0xe065('0x26')](_0x22a0cb,_0x105cb2,!![]);}catch(_0x1c5dd9){return BPromise['reject'](_0x1c5dd9);}return _0x22a0cb[_0xe065('0x27')]();};}function saveUpdates(_0x43b712,_0x44ec95){return function(_0x13f6e5){if(_0x13f6e5){return _0x13f6e5['update'](_0x43b712)['then'](function(_0x164965){return _0x164965;});}return null;};}function removeEntity(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(_0x27e669){return _0x27e669[_0xe065('0x28')]()[_0xe065('0x29')](function(){var _0x418731=_0x27e669[_0xe065('0x2a')]({'plain':!![]});var _0x3b1caf=_0xe065('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1caf,'resourceId':_0x418731['id']}})[_0xe065('0x29')](function(){return _0x27e669;});})[_0xe065('0x29')](function(){_0x530dc0[_0xe065('0x1d')](0xcc)[_0xe065('0x1e')]();});}};}function handleEntityNotFound(_0x5b1220,_0x23f573){return function(_0x55ecaa){if(!_0x55ecaa){_0x5b1220['sendStatus'](0x194);}return _0x55ecaa;};}function handleError(_0x182743,_0x2659e6){_0x2659e6=_0x2659e6||0x1f4;return function(_0x2aa766){logger['error'](_0x2aa766[_0xe065('0x2c')]);if(_0x2aa766['name']){delete _0x2aa766[_0xe065('0x2d')];}_0x182743[_0xe065('0x1d')](_0x2659e6)[_0xe065('0x2e')](_0x2aa766);};}exports[_0xe065('0x2f')]=function(_0x58c49b,_0x3f02b2){var _0x4940cf={},_0x3fa56f={},_0x2e4e4a={'count':0x0,'rows':[]};var _0x5d0864=_[_0xe065('0x30')](db['VoicePrefix'][_0xe065('0x31')],function(_0x4999b0){return{'name':_0x4999b0[_0xe065('0x32')],'type':_0x4999b0[_0xe065('0x33')][_0xe065('0x34')]};});_0x3fa56f[_0xe065('0x35')]=_['map'](_0x5d0864,_0xe065('0x2d'));_0x3fa56f[_0xe065('0x36')]=_[_0xe065('0x37')](_0x58c49b[_0xe065('0x36')]);_0x3fa56f[_0xe065('0x38')]=_[_0xe065('0x39')](_0x3fa56f['model'],_0x3fa56f[_0xe065('0x36')]);_0x4940cf[_0xe065('0x3a')]=_['intersection'](_0x3fa56f[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3b')]));_0x4940cf[_0xe065('0x3a')]=_0x4940cf[_0xe065('0x3a')][_0xe065('0x3c')]?_0x4940cf['attributes']:_0x3fa56f[_0xe065('0x35')];if(!_0x58c49b['query'][_0xe065('0x3d')](_0xe065('0x3e'))){_0x4940cf[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x58c49b[_0xe065('0x36')][_0xe065('0x22')]);_0x4940cf['offset']=qs[_0xe065('0x20')](_0x58c49b[_0xe065('0x36')][_0xe065('0x20')]);}_0x4940cf['order']=qs[_0xe065('0x3f')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3f')]);_0x4940cf[_0xe065('0x40')]=qs[_0xe065('0x38')](_['pick'](_0x58c49b[_0xe065('0x36')],_0x3fa56f[_0xe065('0x38')]),_0x5d0864);if(_0x58c49b['query'][_0xe065('0x41')]){_0x4940cf['where']=_[_0xe065('0x42')](_0x4940cf[_0xe065('0x40')],{'$or':_['map'](_0x5d0864,function(_0x3c7e70){if(_0x3c7e70[_0xe065('0x33')]!=='VIRTUAL'){var _0x16b5da={};_0x16b5da[_0x3c7e70[_0xe065('0x2d')]]={'$like':'%'+_0x58c49b[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x16b5da;}})});}_0x4940cf=_[_0xe065('0x42')]({},_0x4940cf,_0x58c49b[_0xe065('0x43')]);var _0x395cc2={'where':_0x4940cf[_0xe065('0x40')]};return db[_0xe065('0x44')][_0xe065('0x23')](_0x395cc2)[_0xe065('0x29')](function(_0x4364c3){_0x2e4e4a[_0xe065('0x23')]=_0x4364c3;if(_0x58c49b['query']['includeAll']){_0x4940cf[_0xe065('0x45')]=[{'all':!![]}];}return db[_0xe065('0x44')]['findAll'](_0x4940cf);})[_0xe065('0x29')](function(_0x448044){_0x2e4e4a[_0xe065('0x46')]=_0x448044;return _0x2e4e4a;})[_0xe065('0x29')](respondWithFilteredResult(_0x3f02b2,_0x4940cf))[_0xe065('0x47')](handleError(_0x3f02b2,null));};exports[_0xe065('0x48')]=function(_0x39440c,_0x11e82d){var _0x1f93e9={'raw':![],'where':{'id':_0x39440c[_0xe065('0x49')]['id']}},_0x52073d={};_0x52073d[_0xe065('0x35')]=_[_0xe065('0x37')](db['VoicePrefix'][_0xe065('0x31')]);_0x52073d[_0xe065('0x36')]=_[_0xe065('0x37')](_0x39440c[_0xe065('0x36')]);_0x52073d['filters']=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],_0x52073d[_0xe065('0x36')]);_0x1f93e9[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x39440c['query'][_0xe065('0x3b')]));_0x1f93e9[_0xe065('0x3a')]=_0x1f93e9[_0xe065('0x3a')][_0xe065('0x3c')]?_0x1f93e9[_0xe065('0x3a')]:_0x52073d[_0xe065('0x35')];if(_0x39440c[_0xe065('0x36')]['includeAll']){_0x1f93e9[_0xe065('0x45')]=[{'all':!![]}];}_0x1f93e9=_['merge']({},_0x1f93e9,_0x39440c[_0xe065('0x43')]);return db[_0xe065('0x44')][_0xe065('0x4a')](_0x1f93e9)['then'](handleEntityNotFound(_0x11e82d,null))[_0xe065('0x29')](respondWithResult(_0x11e82d,null))[_0xe065('0x47')](handleError(_0x11e82d,null));};exports[_0xe065('0x28')]=function(_0x162d11,_0x3c6880){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x162d11[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x3c6880,null))[_0xe065('0x29')](removeEntity(_0x3c6880,null))[_0xe065('0x47')](handleError(_0x3c6880,null));};exports[_0xe065('0x4b')]=function(_0x14327f,_0x490498){return db['VoicePrefix']['describe']()[_0xe065('0x29')](respondWithResult(_0x490498,null))['catch'](handleError(_0x490498,null));};exports[_0xe065('0x4c')]=function(_0x2c5e42,_0x5a7a98){var _0x480aec;return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5cce78){return db[_0xe065('0x44')][_0xe065('0x4c')](_0x2c5e42[_0xe065('0x4f')],{'transaction':_0x5cce78})[_0xe065('0x29')](function(_0x12df39){_0x480aec=_0x12df39[_0xe065('0x2a')]({'plain':!![]});return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0x480aec[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0x49a367){return createVoicePrefixExtensions(_0x480aec,_0x49a367,_0x5cce78);});});})[_0xe065('0x29')](function(){var _0x18eb92=_0x2c5e42[_0xe065('0x52')][_0xe065('0x2a')]({'plain':!![]});if(!_0x18eb92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18eb92[_0xe065('0x53')]===_0xe065('0x52')){var _0x21884d=_0x480aec;return db[_0xe065('0x54')]['find']({'where':{'name':_0xe065('0x2b'),'userProfileId':_0x18eb92[_0xe065('0x55')]},'raw':!![]})[_0xe065('0x29')](function(_0x5320c6){if(_0x5320c6&&_0x5320c6[_0xe065('0x56')]===0x0){return db[_0xe065('0x57')][_0xe065('0x4c')]({'name':_0x21884d[_0xe065('0x2d')],'resourceId':_0x21884d['id'],'type':_0x5320c6[_0xe065('0x2d')],'sectionId':_0x5320c6['id']},{})[_0xe065('0x29')](function(){return _0x480aec;});}else{return _0x480aec;}})[_0xe065('0x47')](function(_0x464ef7){logger[_0xe065('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464ef7);throw _0x464ef7;});}return _0x480aec;})[_0xe065('0x29')](respondWithResult(_0x5a7a98,null))['catch'](handleError(_0x5a7a98,null));};function Extension(_0x44edf0,_0x24fc1c,_0x3c1229,_0x4e9e85){this['context']='from-sip';this[_0xe065('0x59')]=_0x44edf0;this[_0xe065('0x5a')]=_0x3c1229;this[_0xe065('0x33')]=_0xe065('0x5b');this[_0xe065('0x5c')]=_0xe065('0x5d');this[_0xe065('0x5e')]=_0x24fc1c;this[_0xe065('0x5f')]=_0x4e9e85;}function createVoicePrefixExtensions(_0x20abe0,_0x3169fa,_0x25ec8a){return new BPromise(function(_0x590429,_0x544bff){var _0x2fe0ac=new Extension(formatPrefixName(_0x20abe0[_0xe065('0x60')]),0x1,'NoOp',_0xe065('0x61'));_0x2fe0ac['VoicePrefixId']=_0x20abe0['id'];return db['VoiceExtension'][_0xe065('0x4c')](_0x2fe0ac,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4e7275){var _0x96355e=_0x4e7275[_0xe065('0x2a')]({'plain':!![]});var _0x817baf=_[_0xe065('0x30')](addVoicePrefixExtensions(_0x20abe0,_0x3169fa),function(_0x5edc0f){_0x5edc0f[_0xe065('0x51')]=_0x96355e['id'];_0x5edc0f[_0xe065('0x62')]=_0x20abe0['id'];return _0x5edc0f;});return db[_0xe065('0x50')][_0xe065('0x63')](_0x817baf,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4f35a6){if(!_0x4f35a6){return _0x544bff(_0xe065('0x64'));}else{return _0x590429(_0x4f35a6);}})[_0xe065('0x47')](function(_0x29b3f0){return _0x544bff(_0x29b3f0);});});;});};function addVoicePrefixExtensions(_0x155133,_0x2968c5){var _0xfce2e=[];var _0x5af9d5=formatPrefixName(_0x155133['prefix']);_0xfce2e['push'](new Extension(_0x5af9d5,0x2,'Set','CDR(prefix)='+_0x155133[_0xe065('0x2d')]));if(_0x155133[_0xe065('0x65')]){_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x67'),_0xe065('0x68')+_0x155133[_0xe065('0x65')]));}else{_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x69'),'No\x20callerid\x20available'));}_0xfce2e['push'](new Extension(_0x5af9d5,0x4,_0xe065('0x6a'),_0x2968c5[_0xe065('0x6b')]+','+_0xe065('0x6c')+(0x8+_0x155133['name'][_0xe065('0x3c')])+'}'+','+0x1));return _0xfce2e;}function formatPrefixName(_0x268428){var _0x113a0f='_';for(var _0x4765a0=0x0;_0x4765a0<_0x268428[_0xe065('0x3c')];_0x4765a0++){if(_0x268428[_0xe065('0x6d')](_0x4765a0)=='-'){_0x113a0f+=_0x268428[_0xe065('0x6d')](_0x4765a0);}else{_0x113a0f+='['+_0x268428[_0xe065('0x6d')](_0x4765a0)+']';}}_0x113a0f+='.';return _0x113a0f;}exports[_0xe065('0x6e')]=function(_0xecef2,_0x213feb,_0x4493db){var _0xa5310c=_0xecef2[_0xe065('0x4f')];_0xa5310c[_0xe065('0x60')]=_0xe065('0x6f')+_0xa5310c[_0xe065('0x2d')]+'-';return db[_0xe065('0x4d')]['transaction'](function(_0x31d6cb){return db[_0xe065('0x44')][_0xe065('0x6e')](_0xa5310c,{'where':{'id':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x28')]({'where':{'VoicePrefixId':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0xa5310c[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0xa08631){return createVoicePrefixExtensions(_0xa5310c,_0xa08631,_0x31d6cb);});});});})[_0xe065('0x29')](function(){return db[_0xe065('0x44')][_0xe065('0x70')](_0xa5310c['id']);})[_0xe065('0x29')](respondWithResult(_0x213feb,null))[_0xe065('0x47')](handleError(_0x213feb,null));};exports['addAgents']=function(_0x256eef,_0x185b5b,_0x3e2241){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x256eef[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x185b5b,null))[_0xe065('0x29')](function(_0x54b1f2){if(_0x54b1f2){return _0x54b1f2[_0xe065('0x71')](_0x256eef['body']['ids'],_[_0xe065('0x72')](_0x256eef['body'],[_0xe065('0x73'),'id'])||{})['spread'](function(_0x1df721){for(var _0x162482=0x0;_0x162482<_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0xe065('0x3c')];_0x162482+=0x1){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':Number(_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0x162482]),'VoicePrefixId':Number(_0x256eef['params']['id'])});}return _0x1df721;});}})[_0xe065('0x29')](respondWithResult(_0x185b5b,null))[_0xe065('0x47')](handleError(_0x185b5b,null));};exports[_0xe065('0x76')]=function(_0x3f8e32,_0x5858d9,_0x26c427){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3f8e32['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x5858d9,null))[_0xe065('0x29')](function(_0x3c024b){if(_0x3c024b){return _0x3c024b['removeAgents'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])['then'](function(){if(_['isArray'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])){for(var _0x1b8c33=0x0;_0x1b8c33<_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]['length'];_0x1b8c33+=0x1){socket['emit'](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')]['ids'][_0x1b8c33]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}}else{socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}});}})[_0xe065('0x29')](respondWithStatusCode(_0x5858d9,null))[_0xe065('0x47')](handleError(_0x5858d9,null));};exports[_0xe065('0x78')]=function(_0x1ec81f,_0x4d25b9,_0x5d940d){var _0x34174f={};var _0x5336e3={};var _0x2451ec;var _0x45b479;return db[_0xe065('0x44')]['findOne']({'where':{'id':_0x1ec81f[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x4d25b9,null))[_0xe065('0x29')](function(_0x124054){if(_0x124054){_0x2451ec=_0x124054;_0x5336e3[_0xe065('0x35')]=_[_0xe065('0x37')](db[_0xe065('0x79')][_0xe065('0x31')]);_0x5336e3[_0xe065('0x36')]=_[_0xe065('0x37')](_0x1ec81f[_0xe065('0x36')]);_0x5336e3['filters']=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],_0x5336e3[_0xe065('0x36')]);_0x34174f[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3b')]));_0x34174f[_0xe065('0x3a')]=_0x34174f[_0xe065('0x3a')][_0xe065('0x3c')]?_0x34174f['attributes']:_0x5336e3[_0xe065('0x35')];_0x34174f[_0xe065('0x7a')]=qs[_0xe065('0x3f')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3f')]);_0x34174f[_0xe065('0x40')]=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0x1ec81f[_0xe065('0x36')],_0x5336e3[_0xe065('0x38')]));if(_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]){_0x34174f[_0xe065('0x40')]=_[_0xe065('0x42')](_0x34174f[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x34174f[_0xe065('0x3a')],function(_0x47792d){var _0x105eaa={};_0x105eaa[_0x47792d]={'$like':'%'+_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x105eaa;})});}_0x34174f=_[_0xe065('0x42')]({},_0x34174f,_0x1ec81f[_0xe065('0x43')]);return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x428745){if(_0x428745){_0x45b479=_0x428745[_0xe065('0x3c')];if(!_0x1ec81f[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x34174f[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x22')]);_0x34174f[_0xe065('0x20')]=qs[_0xe065('0x20')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x20')]);}return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x4da03f){if(_0x4da03f){return _0x4da03f?{'count':_0x45b479,'rows':_0x4da03f}:null;}})[_0xe065('0x29')](respondWithResult(_0x4d25b9,null))[_0xe065('0x47')](handleError(_0x4d25b9,null));};exports[_0xe065('0x7c')]=function(_0xe199d7,_0x40231d,_0x34b37c){var _0x24ebbd={};var _0x22bc5c={};var _0x5d6761;var _0x2f2f53;return db['VoicePrefix'][_0xe065('0x7d')]({'where':{'id':_0xe199d7['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x40231d,null))[_0xe065('0x29')](function(_0x19e3cf){if(_0x19e3cf){_0x5d6761=_0x19e3cf;_0x22bc5c[_0xe065('0x35')]=_['keys'](db['Team'][_0xe065('0x31')]);_0x22bc5c[_0xe065('0x36')]=_[_0xe065('0x37')](_0xe199d7['query']);_0x22bc5c[_0xe065('0x38')]=_[_0xe065('0x39')](_0x22bc5c[_0xe065('0x35')],_0x22bc5c['query']);_0x24ebbd['attributes']=_['intersection'](_0x22bc5c['model'],qs[_0xe065('0x3b')](_0xe199d7[_0xe065('0x36')][_0xe065('0x3b')]));_0x24ebbd[_0xe065('0x3a')]=_0x24ebbd[_0xe065('0x3a')]['length']?_0x24ebbd[_0xe065('0x3a')]:_0x22bc5c[_0xe065('0x35')];_0x24ebbd['order']=qs[_0xe065('0x3f')](_0xe199d7['query'][_0xe065('0x3f')]);_0x24ebbd['where']=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0xe199d7[_0xe065('0x36')],_0x22bc5c[_0xe065('0x38')]));if(_0xe199d7[_0xe065('0x36')][_0xe065('0x41')]){_0x24ebbd[_0xe065('0x40')]=_[_0xe065('0x42')](_0x24ebbd[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x24ebbd[_0xe065('0x3a')],function(_0x242712){var _0xa89a0e={};_0xa89a0e[_0x242712]={'$like':'%'+_0xe199d7[_0xe065('0x36')]['filter']+'%'};return _0xa89a0e;})});}_0x24ebbd=_['merge']({},_0x24ebbd,_0xe199d7[_0xe065('0x43')]);return _0x5d6761[_0xe065('0x7c')](_0x24ebbd);}})['then'](function(_0x33a5b9){if(_0x33a5b9){_0x2f2f53=_0x33a5b9[_0xe065('0x3c')];if(!_0xe199d7[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x24ebbd[_0xe065('0x22')]=qs[_0xe065('0x22')](_0xe199d7['query']['limit']);_0x24ebbd[_0xe065('0x20')]=qs[_0xe065('0x20')](_0xe199d7[_0xe065('0x36')][_0xe065('0x20')]);}return _0x5d6761['getTeams'](_0x24ebbd);}})[_0xe065('0x29')](function(_0x33f41c){if(_0x33f41c){return _0x33f41c?{'count':_0x2f2f53,'rows':_0x33f41c}:null;}})[_0xe065('0x29')](respondWithResult(_0x40231d,null))[_0xe065('0x47')](handleError(_0x40231d,null));};exports[_0xe065('0x7e')]=function(_0x123188,_0x490961,_0x3cd1c8){var _0x4a63da=_0x123188['body'][_0xe065('0x73')];var _0x14440a;return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x4a63da},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe065('0x81'),'attributes':['id',_0xe065('0x2d'),'online',_0xe065('0x82'),_0xe065('0x83')],'raw':!![]}]})[_0xe065('0x29')](function(_0x29ecc6){if(_0x29ecc6){_0x14440a=_0x29ecc6;var _0x2aab25=_['flatMap'](_0x29ecc6,function(_0x1998ee){var _0x5df1f5=_0x1998ee[_0xe065('0x2a')]({'plain':!![]});return _0x5df1f5['Agents'];});return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x123188[_0xe065('0x49')]['id']}})['then'](function(_0x4d68c2){return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5c61df){return _0x4d68c2[_0xe065('0x7e')](_0x4a63da,{'transaction':_0x5c61df})['then'](function(){return BPromise[_0xe065('0x84')](_0x14440a,function(_0x41c62a){return db['TeamVoicePrefix'][_0xe065('0x85')]({'TeamId':_0x41c62a['id'],'VoicePrefixId':_0x123188[_0xe065('0x49')]['id']},{'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){return BPromise[_0xe065('0x84')](_0x2aab25,function(_0xd8b280){return db[_0xe065('0x86')]['findOrCreate']({'where':{'UserId':_0xd8b280['id'],'VoicePrefixId':_0x123188['params']['id']},'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){_0x2aab25[_0xe065('0x87')](function(_0x41d5b5){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':_0x41d5b5['id'],'VoicePrefixId':_0x4d68c2['id']});});});});});}})['then'](respondWithStatusCode(_0x490961,null))['catch'](handleError(_0x490961,null));};exports['removeTeams']=function(_0x3e51b4,_0xab9cb,_0x5d64af){return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x3e51b4[_0xe065('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe065('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xab9cb,null))[_0xe065('0x29')](function(_0x42afb3){var _0x38119f=_[_0xe065('0x30')](_0x42afb3,'id');var _0x5b7ce9=[];var _0xa80c6d=[];var _0x3a46d3=squel['select']();_0x3a46d3[_0xe065('0x88')](_0xe065('0x89'))[_0xe065('0x8a')]('team_has_voice_prefixes','tq')[_0xe065('0x8b')]('user_has_teams','ut',_0xe065('0x8c'))[_0xe065('0x40')]('VoicePrefixId\x20=\x20?',_0x3e51b4['params']['id']);for(var _0x451186=0x0;_0x451186<_0x42afb3[_0xe065('0x3c')];_0x451186+=0x1){let _0x16e82a=_0x42afb3[_0x451186];for(var _0x243415=0x0;_0x243415<_0x16e82a[_0xe065('0x81')][_0xe065('0x3c')];_0x243415+=0x1){let _0x2b8d04=_0x16e82a['Agents'][_0x243415];var _0x572836=_0x3a46d3['clone']();_0x572836[_0xe065('0x40')](_0xe065('0x8d'),_0x2b8d04['id']);_0xa80c6d['push'](db[_0xe065('0x4d')][_0xe065('0x36')](_0x572836['toString'](),{'type':db[_0xe065('0x4d')]['QueryTypes']['SELECT']})[_0xe065('0x29')](function(_0x1a21c0){if(_0x1a21c0[_0xe065('0x3c')]===0x1){return _0x2b8d04['id'];}else{var _0x5c7e10=_[_0xe065('0x8e')](_[_0xe065('0x30')](_0x1a21c0,_0xe065('0x8f')),function(_0x10a15e){return _[_0xe065('0x90')](_0x38119f,_0x10a15e);});if(_0x5c7e10){return _0x2b8d04['id'];}}}));}}return BPromise[_0xe065('0x91')](_0xa80c6d)[_0xe065('0x29')](function(_0x20c16c){_0x5b7ce9=_(_0x5b7ce9)[_0xe065('0x92')](_0x20c16c)[_0xe065('0x93')]()['value']();return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3e51b4[_0xe065('0x49')]['id']}})[_0xe065('0x29')](function(_0x97b140){return db['sequelize'][_0xe065('0x4e')](function(_0x257ea2){return _0x97b140['removeTeams'](_0x3e51b4['query'][_0xe065('0x73')],{'transaction':_0x257ea2})[_0xe065('0x29')](function(){if(!_[_0xe065('0x94')](_0x5b7ce9)){return _0x97b140[_0xe065('0x76')](_0x5b7ce9,{'transaction':_0x257ea2});}})['then'](function(){_0x5b7ce9[_0xe065('0x87')](function(_0x1113fa){socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':_0x1113fa,'VoicePrefixId':_0x97b140['id']});});});});});});})['then'](respondWithStatusCode(_0xab9cb,null))[_0xe065('0x47')](handleError(_0xab9cb,null));}; \ No newline at end of file +var _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x57f7ea,_0x54da6b){var _0x54a7e4=function(_0x2c9d4f){while(--_0x2c9d4f){_0x57f7ea['push'](_0x57f7ea['shift']());}};_0x54a7e4(++_0x54da6b);}(_0x4991,0xf7));var _0x1499=function(_0x1fd344,_0x572281){_0x1fd344=_0x1fd344-0x0;var _0x397c9f=_0x4991[_0x1fd344];return _0x397c9f;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ce80509..030255d 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 _0x80c8=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80c8,0x13f));var _0x880c=function(_0x255c7b,_0x572866){_0x255c7b=_0x255c7b-0x0;var _0x1f1f62=_0x80c8[_0x255c7b];return _0x1f1f62;};'use strict';var EventEmitter=require(_0x880c('0x0'));var VoicePrefix=require(_0x880c('0x1'))['db'][_0x880c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x880c('0x3')](0x0);var events={'afterCreate':_0x880c('0x4'),'afterUpdate':_0x880c('0x5'),'afterDestroy':_0x880c('0x6')};function emitEvent(_0x38812d){return function(_0xaca80b,_0x2c5887,_0x5f0744){VoicePrefixEvents[_0x880c('0x7')](_0x38812d+':'+_0xaca80b['id'],_0xaca80b);VoicePrefixEvents[_0x880c('0x7')](_0x38812d,_0xaca80b);_0x5f0744(null);};}for(var e in events){if(events[_0x880c('0x8')](e)){var event=events[e];VoicePrefix[_0x880c('0x9')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x962e=['events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x19b604,_0x225957){var _0x540421=function(_0xebfd36){while(--_0xebfd36){_0x19b604['push'](_0x19b604['shift']());}};_0x540421(++_0x225957);}(_0x962e,0x75));var _0xe962=function(_0x5cf94d,_0x3e9b52){_0x5cf94d=_0x5cf94d-0x0;var _0x3242a6=_0x962e[_0x5cf94d];return _0x3242a6;};'use strict';var EventEmitter=require(_0xe962('0x0'));var VoicePrefix=require(_0xe962('0x1'))['db'][_0xe962('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe962('0x3'),'afterUpdate':_0xe962('0x4'),'afterDestroy':_0xe962('0x5')};function emitEvent(_0x5bcb41){return function(_0x151fc3,_0x28642e,_0x5beea0){VoicePrefixEvents[_0xe962('0x6')](_0x5bcb41+':'+_0x151fc3['id'],_0x151fc3);VoicePrefixEvents[_0xe962('0x6')](_0x5bcb41,_0x151fc3);_0x5beea0(null);};}for(var e in events){if(events[_0xe962('0x7')](e)){var event=events[e];VoicePrefix[_0xe962('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 fe35d21..9bfd20b 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 _0x10a0=['bluebird','path','../../config/environment','exports','VoicePrefix','voice_prefixes','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10a0,0x156));var _0x010a=function(_0x443c1a,_0x22a444){_0x443c1a=_0x443c1a-0x0;var _0x9a0e6=_0x10a0[_0x443c1a];return _0x9a0e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x010a('0x0'))(_0x010a('0x1'));var moment=require('moment');var BPromise=require(_0x010a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x010a('0x3'));var rimraf=require('rimraf');var config=require(_0x010a('0x4'));var attributes=require('./voicePrefix.attributes');module[_0x010a('0x5')]=function(_0x22f0c5,_0x474279){return _0x22f0c5['define'](_0x010a('0x6'),attributes,{'tableName':_0x010a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71c8=['../../config/environment','exports','VoicePrefix','voice_prefixes','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x501b49,_0x4465ee){var _0x1ffd9e=function(_0x14eb1c){while(--_0x14eb1c){_0x501b49['push'](_0x501b49['shift']());}};_0x1ffd9e(++_0x4465ee);}(_0x71c8,0xb4));var _0x871c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x71c8[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x871c('0x0'))(_0x871c('0x1'));var moment=require(_0x871c('0x2'));var BPromise=require(_0x871c('0x3'));var rp=require(_0x871c('0x4'));var fs=require('fs');var path=require(_0x871c('0x5'));var rimraf=require(_0x871c('0x6'));var config=require(_0x871c('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x871c('0x8')]=function(_0x4fa6cb,_0xfb2220){return _0x4fa6cb['define'](_0x871c('0x9'),attributes,{'tableName':_0x871c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3b7bfb9..410f59c 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 _0x7046=['defaults','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x78e3d1,_0x40d3f8){var _0x199831=function(_0x54093b){while(--_0x54093b){_0x78e3d1['push'](_0x78e3d1['shift']());}};_0x199831(++_0x40d3f8);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});config['redis']=_[_0x6704('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6704('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6704('0xe')](socket);function respondWithRpcPromise(_0x394ef4,_0x37a1ad,_0x454bd5){return new BPromise(function(_0x356687,_0x40d57d){return client[_0x6704('0xf')](_0x394ef4,_0x454bd5)[_0x6704('0x10')](function(_0x58cc09){logger[_0x6704('0x11')](_0x6704('0x12'),_0x37a1ad,'request\x20sent');logger[_0x6704('0x13')](_0x6704('0x14'),_0x37a1ad,_0x6704('0x15'),JSON[_0x6704('0x16')](_0x58cc09));if(_0x58cc09[_0x6704('0x17')]){if(_0x58cc09[_0x6704('0x17')][_0x6704('0x18')]===0x1f4){logger[_0x6704('0x17')](_0x6704('0x12'),_0x37a1ad,_0x58cc09['error'][_0x6704('0x19')]);return _0x40d57d(_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);}logger['error'](_0x6704('0x12'),_0x37a1ad,_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);return _0x356687(_0x58cc09[_0x6704('0x17')][_0x6704('0x19')]);}else{logger['info'](_0x6704('0x12'),_0x37a1ad,_0x6704('0x15'));_0x356687(_0x58cc09[_0x6704('0x1a')][_0x6704('0x19')]);}})[_0x6704('0x1b')](function(_0x5df2df){logger[_0x6704('0x17')](_0x6704('0x12'),_0x37a1ad,_0x5df2df);_0x40d57d(_0x5df2df);});});} \ No newline at end of file +var _0x853e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x853e,0x1ea));var _0xe853=function(_0xbdea18,_0x205eac){_0xbdea18=_0xbdea18-0x0;var _0xbc6600=_0x853e[_0xbdea18];return _0xbc6600;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var moment=require('moment');var BPromise=require(_0xe853('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe853('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe853('0x3'));var logger=require(_0xe853('0x4'))(_0xe853('0x5'));var config=require(_0xe853('0x6'));var jayson=require(_0xe853('0x7'));var client=jayson['client'][_0xe853('0x8')]({'port':0x232a});config[_0xe853('0x9')]=_[_0xe853('0xa')](config[_0xe853('0x9')],{'host':_0xe853('0xb'),'port':0x18eb});var socket=require(_0xe853('0xc'))(new Redis(config[_0xe853('0x9')]));require(_0xe853('0xd'))[_0xe853('0xe')](socket);function respondWithRpcPromise(_0x15bfe2,_0x478b19,_0x581135){return new BPromise(function(_0x54da09,_0xd985c6){return client['request'](_0x15bfe2,_0x581135)['then'](function(_0x1c6224){logger[_0xe853('0xf')](_0xe853('0x10'),_0x478b19,'request\x20sent');logger[_0xe853('0x11')](_0xe853('0x12'),_0x478b19,_0xe853('0x13'),JSON[_0xe853('0x14')](_0x1c6224));if(_0x1c6224[_0xe853('0x15')]){if(_0x1c6224[_0xe853('0x15')][_0xe853('0x16')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x478b19,_0x1c6224['error']['message']);return _0xd985c6(_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);}logger[_0xe853('0x15')](_0xe853('0x10'),_0x478b19,_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);return _0x54da09(_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);}else{logger[_0xe853('0xf')](_0xe853('0x10'),_0x478b19,_0xe853('0x13'));_0x54da09(_0x1c6224[_0xe853('0x18')][_0xe853('0x17')]);}})[_0xe853('0x19')](function(_0x25a5e2){logger[_0xe853('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x478b19,_0x25a5e2);_0xd985c6(_0x25a5e2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 818c2a0..8441887 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 _0x40b5=['register','length','./voicePrefix.events','save','remove','update','removeListener'];(function(_0x682780,_0x502a83){var _0x45b9d3=function(_0x3ad17e){while(--_0x3ad17e){_0x682780['push'](_0x682780['shift']());}};_0x45b9d3(++_0x502a83);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x540b('0x0'));var events=[_0x540b('0x1'),_0x540b('0x2'),_0x540b('0x3')];function createListener(_0x29c7ba,_0x273ac6){return function(_0x424c68){_0x273ac6['emit'](_0x29c7ba,_0x424c68);};}function removeListener(_0x39da2c,_0x10e2b8){return function(){VoicePrefixEvents[_0x540b('0x4')](_0x39da2c,_0x10e2b8);};}exports[_0x540b('0x5')]=function(_0x5b75dc){for(var _0x4e0a29=0x0,_0x22e1da=events[_0x540b('0x6')];_0x4e0a29<_0x22e1da;_0x4e0a29++){var _0x316ab7=events[_0x4e0a29];var _0x5aeb5f=createListener('voicePrefix:'+_0x316ab7,_0x5b75dc);VoicePrefixEvents['on'](_0x316ab7,_0x5aeb5f);}}; \ No newline at end of file +var _0x09dd=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09dd,0x81));var _0xd09d=function(_0x44c79f,_0x21f727){_0x44c79f=_0x44c79f-0x0;var _0x4089ef=_0x09dd[_0x44c79f];return _0x4089ef;};'use strict';var VoicePrefixEvents=require(_0xd09d('0x0'));var events=[_0xd09d('0x1'),_0xd09d('0x2'),_0xd09d('0x3')];function createListener(_0x45dad5,_0x2a77ce){return function(_0x28a63a){_0x2a77ce[_0xd09d('0x4')](_0x45dad5,_0x28a63a);};}function removeListener(_0x44faf7,_0x3e1b57){return function(){VoicePrefixEvents[_0xd09d('0x5')](_0x44faf7,_0x3e1b57);};}exports[_0xd09d('0x6')]=function(_0x3410c4){for(var _0x2034af=0x0,_0x5621cf=events[_0xd09d('0x7')];_0x2034af<_0x5621cf;_0x2034af++){var _0x1fce72=events[_0x2034af];var _0x3e062b=createListener(_0xd09d('0x8')+_0x1fce72,_0x3410c4);VoicePrefixEvents['on'](_0x1fce72,_0x3e062b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ff47d46..05b0b76 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xb10b,0x12a));var _0xbb10=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0xb10b[_0x404f13];return _0x1f9dbb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 6d2733e..11a9ef5 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 _0xeb4f=['UNSIGNED','FLOAT','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#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)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','linear','wrandom','setDataValue','strategy','rrmemory','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','Dial\x20Method.'];(function(_0x38bf79,_0x3c9998){var _0x1bfde5=function(_0x383ca2){while(--_0x383ca2){_0x38bf79['push'](_0x38bf79['shift']());}};_0x1bfde5(++_0x3c9998);}(_0xeb4f,0x161));var _0xfeb4=function(_0x4a9f70,_0x5e6cdd){_0x4a9f70=_0x4a9f70-0x0;var _0x574b7e=_0xeb4f[_0x4a9f70];return _0x574b7e;};'use strict';var Sequelize=require(_0xfeb4('0x0'));module[_0xfeb4('0x1')]={'name':{'type':Sequelize[_0xfeb4('0x2')],'allowNull':![],'unique':_0xfeb4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x5'),_0xfeb4('0x6')),'allowNull':![],'defaultValue':_0xfeb4('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xfeb4('0x4')]('rr',_0xfeb4('0x7'),_0xfeb4('0x8'),_0xfeb4('0x9'),_0xfeb4('0xa'),'rrmemory',_0xfeb4('0xb'),_0xfeb4('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0xfeb4('0x7'),'set':function(_0x1fba0a){this[_0xfeb4('0xd')](_0xfeb4('0xe'),_0x1fba0a?_0x1fba0a:_0xfeb4('0xf'));},'get':function(){var _0xb5157f=this[_0xfeb4('0x10')](_0xfeb4('0x11'));var _0xf555ac=this[_0xfeb4('0x10')]('dialMethod');var _0xcb6e7c=this[_0xfeb4('0x10')]('strategy');if(_0xb5157f===_0xfeb4('0x5')){return _0xcb6e7c;}if(_0xf555ac==='booked'&&_0xcb6e7c===_0xfeb4('0xf')||_0xf555ac===_0xfeb4('0x12')&&_0xcb6e7c===_0xfeb4('0x13')){return _0xcb6e7c;}if(_0xf555ac===_0xfeb4('0x14')||_0xf555ac===_0xfeb4('0x15')||_0xf555ac===_0xfeb4('0x16')){return _0xcb6e7c;}return null;}},'servicelevel':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfeb4('0x17')](0xb)},'timeout':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfeb4('0x2')]},'weight':{'type':Sequelize[_0xfeb4('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no',_0xfeb4('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfeb4('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xfeb4('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xfeb4('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfeb4('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfeb4('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':_0xfeb4('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xfeb4('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xfeb4('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfeb4('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfeb4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfeb4('0x2')]},'queue_quantity1':{'type':Sequelize[_0xfeb4('0x2')]},'queue_quantity2':{'type':Sequelize[_0xfeb4('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xfeb4('0x2')]},'periodic_announce':{'type':Sequelize[_0xfeb4('0x1b')],'set':function(_0x1c4597){this[_0xfeb4('0xd')](_0xfeb4('0x1c'),_0x1c4597?_0x1c4597['join'](','):[]);},'get':function(){return this[_0xfeb4('0x10')](_0xfeb4('0x1c'))?this[_0xfeb4('0x10')](_0xfeb4('0x1c'))[_0xfeb4('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':_0xfeb4('0x18'),'set':function(_0x466a60){this[_0xfeb4('0xd')]('joinempty',_0x466a60?_0x466a60[_0xfeb4('0x1e')](','):undefined);},'get':function(){return this[_0xfeb4('0x10')](_0xfeb4('0x1f'))?this[_0xfeb4('0x10')](_0xfeb4('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':'no','set':function(_0x85ce47){this[_0xfeb4('0xd')](_0xfeb4('0x20'),_0x85ce47?_0x85ce47['join'](','):undefined);},'get':function(){return this[_0xfeb4('0x10')](_0xfeb4('0x20'))?this['getDataValue'](_0xfeb4('0x20'))[_0xfeb4('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfeb4('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfeb4('0x2')]},'description':{'type':Sequelize[_0xfeb4('0x2')]},'acw':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':0x0,'set':function(_0x213569){this[_0xfeb4('0xd')]('acw',_0x213569);if(_0x213569){if(this[_0xfeb4('0x10')]('wrapuptime')<0x2){this[_0xfeb4('0xd')](_0xfeb4('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfeb4('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x23'),_0xfeb4('0x14'),'power','predictive',_0xfeb4('0x12')),'defaultValue':_0xfeb4('0x14'),'comment':_0xfeb4('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfeb4('0x17')](0x4)[_0xfeb4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xfeb4('0x17')](0x4)[_0xfeb4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xfeb4('0x26')](0x2)[_0xfeb4('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x27'),_0xfeb4('0x28')),'defaultValue':_0xfeb4('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfeb4('0x26')](0x2)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfeb4('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfeb4('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfeb4('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':_0xfeb4('0x2b'),'comment':_0xfeb4('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x2d')},'dialQueueProject':{'type':Sequelize[_0xfeb4('0x2')],'comment':_0xfeb4('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfeb4('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfeb4('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'comment':_0xfeb4('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfeb4('0x17')](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfeb4('0x33')},'dialTimezone':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfeb4('0x34')},'dialPrefix':{'type':Sequelize[_0xfeb4('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x35'),_0xfeb4('0x36'),_0xfeb4('0x37')),'defaultValue':_0xfeb4('0x35')},'dialAMDActive':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':0x0,'comment':_0xfeb4('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xfeb4('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfeb4('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xfeb4('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfeb4('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfeb4('0x17')](0x9)[_0xfeb4('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfeb4('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfeb4('0x17')](0x9)[_0xfeb4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfeb4('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xfeb4('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfeb4('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfeb4('0x17')](0x9)[_0xfeb4('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfeb4('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfeb4('0x17')](0x9)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfeb4('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfeb4('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfeb4('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfeb4('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfeb4('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xfeb4('0x17')](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfeb4('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':0x0,'comment':_0xfeb4('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfeb4('0x4')](_0xfeb4('0x44'),_0xfeb4('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xfeb4('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfeb4('0x46')},'dialCutDigit':{'type':Sequelize[_0xfeb4('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)['UNSIGNED'],'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['INTEGER'](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x47')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfeb4('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xfeb4('0x17')](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfeb4('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfeb4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfeb4('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfeb4('0x17')](0x5)[_0xfeb4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfeb4('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':![],'comment':_0xfeb4('0x4c'),'set':function(_0x2426e2){if(!_0x2426e2)this[_0xfeb4('0xd')](_0xfeb4('0x4d'),null);this['setDataValue']('mandatoryDisposition',_0x2426e2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfeb4('0x17')](0x3)[_0xfeb4('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xfeb4('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xfeb4('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfeb4('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0xd7cb=['name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','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)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0xd7cb,0x9d));var _0xbd7c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd7cb[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xbd7c('0x0'));module[_0xbd7c('0x1')]={'name':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':![],'unique':_0xbd7c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x5'),_0xbd7c('0x6')),'allowNull':![],'defaultValue':_0xbd7c('0x5')},'musiconhold':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':_0xbd7c('0x7')},'announce':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbd7c('0x4')]('rr',_0xbd7c('0x8'),_0xbd7c('0x9'),_0xbd7c('0xa'),_0xbd7c('0xb'),_0xbd7c('0xc'),'linear','wrandom',_0xbd7c('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x279811){this[_0xbd7c('0xe')](_0xbd7c('0xf'),_0x279811?_0x279811:_0xbd7c('0xc'));},'get':function(){var _0x3dfb92=this[_0xbd7c('0x10')]('type');var _0x56acf9=this[_0xbd7c('0x10')]('dialMethod');var _0x50da95=this['getDataValue']('strategy');if(_0x3dfb92===_0xbd7c('0x5')){return _0x50da95;}if(_0x56acf9===_0xbd7c('0x11')&&_0x50da95===_0xbd7c('0xc')||_0x56acf9===_0xbd7c('0x11')&&_0x50da95===_0xbd7c('0x12')){return _0x50da95;}if(_0x56acf9===_0xbd7c('0x13')||_0x56acf9===_0xbd7c('0x14')||_0x56acf9==='power'){return _0x50da95;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbd7c('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbd7c('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no',_0xbd7c('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xbd7c('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no',_0xbd7c('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbd7c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbd7c('0x2')]},'queue_youarenext':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbd7c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xbd7c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xbd7c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xbd7c('0x2')]},'queue_less_than':{'type':Sequelize[_0xbd7c('0x2')]},'periodic_announce':{'type':Sequelize[_0xbd7c('0x19')],'set':function(_0x25f5fa){this['setDataValue'](_0xbd7c('0x1a'),_0x25f5fa?_0x25f5fa[_0xbd7c('0x1b')](','):[]);},'get':function(){return this[_0xbd7c('0x10')]('periodic_announce')?this['getDataValue'](_0xbd7c('0x1a'))[_0xbd7c('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'yes','set':function(_0x33e5c5){this[_0xbd7c('0xe')](_0xbd7c('0x1d'),_0x33e5c5?_0x33e5c5[_0xbd7c('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xbd7c('0x10')](_0xbd7c('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'no','set':function(_0x2a61a1){this[_0xbd7c('0xe')]('leavewhenempty',_0x2a61a1?_0x2a61a1[_0xbd7c('0x1b')](','):undefined);},'get':function(){return this[_0xbd7c('0x10')](_0xbd7c('0x1e'))?this[_0xbd7c('0x10')](_0xbd7c('0x1e'))[_0xbd7c('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'set':function(_0x5ef4a2){this[_0xbd7c('0xe')](_0xbd7c('0x20'),_0x5ef4a2);if(_0x5ef4a2){if(this['getDataValue'](_0xbd7c('0x21'))<0x2){this['setDataValue'](_0xbd7c('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbd7c('0x22')},'dialMethod':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x23'),'progressive','power',_0xbd7c('0x14'),_0xbd7c('0x11')),'defaultValue':'progressive','comment':_0xbd7c('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbd7c('0x15')](0x4)[_0xbd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xbd7c('0x15')](0x4)[_0xbd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd7c('0x26')},'dialPowerLevel':{'type':Sequelize[_0xbd7c('0x27')](0x2)[_0xbd7c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbd7c('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x29'),_0xbd7c('0x2a')),'defaultValue':_0xbd7c('0x2a'),'comment':_0xbd7c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbd7c('0x27')](0x2)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbd7c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbd7c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbd7c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':_0xbd7c('0x2e'),'comment':_0xbd7c('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x30')},'dialQueueProject':{'type':Sequelize[_0xbd7c('0x2')],'comment':_0xbd7c('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbd7c('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbd7c('0x37')},'dialTimezone':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbd7c('0x38')},'dialPrefix':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x39'),_0xbd7c('0x3a'),'onlyIfOpen'),'defaultValue':_0xbd7c('0x39')},'dialAMDActive':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'comment':_0xbd7c('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbd7c('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbd7c('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbd7c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbd7c('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbd7c('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbd7c('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xbd7c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbd7c('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbd7c('0x42'),_0xbd7c('0x43')),'defaultValue':_0xbd7c('0x42')},'dialQueueProject2':{'type':Sequelize[_0xbd7c('0x2')],'comment':_0xbd7c('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xbd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd7c('0x44')},'dialCutDigit':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd7c('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd7c('0x15')],'allowNull':!![],'comment':_0xbd7c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![],'comment':_0xbd7c('0x4d'),'set':function(_0x1df115){if(!_0x1df115)this[_0xbd7c('0xe')](_0xbd7c('0x4e'),null);this[_0xbd7c('0xe')](_0xbd7c('0x4f'),_0x1df115);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 22d1771..88d8513 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 _0x535d=['isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','fromQuery','ContactId','phone','scheduledAt','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','into','insert','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','find','type','name','stack','send','index','VoiceQueue','rawAttributes','fieldName','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','error','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','penalty','sequelize','transaction','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','forEach','emit','userVoiceQueue:save','ids','select','field','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','spread','isNil'];(function(_0x5b0b0f,_0x522c30){var _0x42ea47=function(_0x4ac3a4){while(--_0x4ac3a4){_0x5b0b0f['push'](_0x5b0b0f['shift']());}};_0x42ea47(++_0x522c30);}(_0x535d,0xe8));var _0xd535=function(_0x8ab643,_0x1876fd){_0x8ab643=_0x8ab643-0x0;var _0x208493=_0x535d[_0x8ab643];return _0x208493;};'use strict';var emlformat=require(_0xd535('0x0'));var rimraf=require(_0xd535('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd535('0x2'));var rp=require(_0xd535('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd535('0x4'));var util=require(_0xd535('0x5'));var path=require(_0xd535('0x6'));var sox=require(_0xd535('0x7'));var csv=require(_0xd535('0x8'));var ejs=require(_0xd535('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd535('0xa'));var crypto=require(_0xd535('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd535('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd535('0xd'));var Papa=require(_0xd535('0xe'));var Redis=require(_0xd535('0xf'));var authService=require(_0xd535('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd535('0x11'));var hardwareService=require(_0xd535('0x12'));var logger=require(_0xd535('0x13'))(_0xd535('0x14'));var utils=require('../../config/utils');var config=require(_0xd535('0x15'));var licenseUtil=require(_0xd535('0x16'));var db=require(_0xd535('0x17'))['db'];config[_0xd535('0x18')]=_[_0xd535('0x19')](config[_0xd535('0x18')],{'host':_0xd535('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd535('0x18')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x2b3e1b,_0x2bf442){_0x2bf442=_0x2bf442||0xcc;return function(_0x578e07){if(_0x578e07){return _0x2b3e1b[_0xd535('0x1b')](_0x2bf442);}return _0x2b3e1b[_0xd535('0x1c')](_0x2bf442)[_0xd535('0x1d')]();};}function respondWithResult(_0x500675,_0x4bf825){_0x4bf825=_0x4bf825||0xc8;return function(_0x1ca506){if(_0x1ca506){return _0x500675[_0xd535('0x1c')](_0x4bf825)[_0xd535('0x1e')](_0x1ca506);}};}function respondWithFilteredResult(_0xb3cc32,_0x49513d){return function(_0x921b2e){if(_0x921b2e){var _0x54ff85=typeof _0x49513d[_0xd535('0x1f')]==='undefined'&&typeof _0x49513d[_0xd535('0x20')]==='undefined';var _0x2d7338=_0x921b2e[_0xd535('0x21')];var _0x31eda3=_0x54ff85?0x0:_0x49513d[_0xd535('0x1f')];var _0x5749fa=_0x54ff85?_0x921b2e['count']:_0x49513d[_0xd535('0x1f')]+_0x49513d['limit'];var _0x5c4afa;if(_0x5749fa>=_0x2d7338){_0x5749fa=_0x2d7338;_0x5c4afa=0xc8;}else{_0x5c4afa=0xce;}_0xb3cc32[_0xd535('0x1c')](_0x5c4afa);return _0xb3cc32[_0xd535('0x22')](_0xd535('0x23'),_0x31eda3+'-'+_0x5749fa+'/'+_0x2d7338)[_0xd535('0x1e')](_0x921b2e);}return null;};}function patchUpdates(_0x3cad49){return function(_0x2afcd3){try{jsonpatch['apply'](_0x2afcd3,_0x3cad49,!![]);}catch(_0x8e32ee){return BPromise[_0xd535('0x24')](_0x8e32ee);}return _0x2afcd3[_0xd535('0x25')]();};}function saveUpdates(_0x7cc1ef,_0x544781){return function(_0x55302e){if(_0x55302e){return _0x55302e['update'](_0x7cc1ef)[_0xd535('0x26')](function(_0x1abfec){return _0x1abfec;});}return null;};}function removeEntity(_0x482d00,_0x4aa746){return function(_0x4725d2){if(_0x4725d2){return _0x4725d2[_0xd535('0x27')]()[_0xd535('0x26')](function(){var _0x551a99=_0x4725d2['get']({'plain':!![]});var _0x3797c9=[{'name':_0xd535('0x28'),'value':_0xd535('0x29'),'ignore':![]},{'name':_0xd535('0x2a'),'value':_0xd535('0x2b'),'ignore':![]}];var _0x33fcb1=_(_0x3797c9)[_0xd535('0x2c')]('ignore')[_0xd535('0x2d')](_0xd535('0x2e'))['value']();if(_['includes'](_0x33fcb1,_0x551a99['type'])){return;}var _0x30bb88=_[_0xd535('0x2f')](_0x3797c9,[_0xd535('0x2e'),_0x551a99[_0xd535('0x30')]])[_0xd535('0x31')];return db['UserProfileResource']['destroy']({'where':{'type':_0x30bb88,'resourceId':_0x551a99['id']}})[_0xd535('0x26')](function(){return _0x4725d2;});})[_0xd535('0x26')](function(){_0x482d00[_0xd535('0x1c')](0xcc)[_0xd535('0x1d')]();});}};}function handleEntityNotFound(_0x57123e,_0x379493){return function(_0x230db8){if(!_0x230db8){_0x57123e[_0xd535('0x1b')](0x194);}return _0x230db8;};}function handleError(_0x27f53,_0x3a1d78){_0x3a1d78=_0x3a1d78||0x1f4;return function(_0x308e33){logger['error'](_0x308e33[_0xd535('0x32')]);if(_0x308e33[_0xd535('0x31')]){delete _0x308e33[_0xd535('0x31')];}_0x27f53['status'](_0x3a1d78)[_0xd535('0x33')](_0x308e33);};}exports[_0xd535('0x34')]=function(_0x3babd8,_0x3b0c8d){var _0x420992={},_0x53d6c7={},_0x5204aa={'count':0x0,'rows':[]};var _0x4effab=_[_0xd535('0x2d')](db[_0xd535('0x35')][_0xd535('0x36')],function(_0xd3f55d){return{'name':_0xd3f55d[_0xd535('0x37')],'type':_0xd3f55d[_0xd535('0x30')]['key']};});_0x53d6c7['model']=_[_0xd535('0x2d')](_0x4effab,'name');_0x53d6c7[_0xd535('0x38')]=_['keys'](_0x3babd8[_0xd535('0x38')]);_0x53d6c7['filters']=_[_0xd535('0x39')](_0x53d6c7['model'],_0x53d6c7[_0xd535('0x38')]);_0x420992[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x53d6c7[_0xd535('0x3b')],qs['fields'](_0x3babd8[_0xd535('0x38')][_0xd535('0x3c')]));_0x420992['attributes']=_0x420992[_0xd535('0x3a')][_0xd535('0x3d')]?_0x420992[_0xd535('0x3a')]:_0x53d6c7[_0xd535('0x3b')];if(!_0x3babd8[_0xd535('0x38')][_0xd535('0x3e')](_0xd535('0x3f'))){_0x420992[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x3babd8[_0xd535('0x38')]['limit']);_0x420992[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x3babd8[_0xd535('0x38')]['offset']);}_0x420992[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x3babd8[_0xd535('0x38')]['sort']);_0x420992[_0xd535('0x42')]=qs[_0xd535('0x43')](_['pick'](_0x3babd8[_0xd535('0x38')],_0x53d6c7['filters']),_0x4effab);if(_0x3babd8[_0xd535('0x38')][_0xd535('0x2c')]){_0x420992[_0xd535('0x42')]=_[_0xd535('0x44')](_0x420992['where'],{'$or':_['map'](_0x4effab,function(_0x5629d8){if(_0x5629d8['type']!==_0xd535('0x45')){var _0x383c64={};_0x383c64[_0x5629d8['name']]={'$like':'%'+_0x3babd8[_0xd535('0x38')]['filter']+'%'};return _0x383c64;}})});}_0x420992=_[_0xd535('0x44')]({},_0x420992,_0x3babd8[_0xd535('0x46')]);var _0x4cac9e={'where':_0x420992['where']};return db[_0xd535('0x35')][_0xd535('0x21')](_0x4cac9e)[_0xd535('0x26')](function(_0x58d991){_0x5204aa[_0xd535('0x21')]=_0x58d991;if(_0x3babd8['query'][_0xd535('0x47')]){_0x420992[_0xd535('0x48')]=[{'all':!![]}];}return db[_0xd535('0x35')][_0xd535('0x49')](_0x420992);})[_0xd535('0x26')](function(_0x1caefe){_0x5204aa[_0xd535('0x4a')]=_0x1caefe;return _0x5204aa;})['then'](respondWithFilteredResult(_0x3b0c8d,_0x420992))['catch'](handleError(_0x3b0c8d,null));};exports[_0xd535('0x4b')]=function(_0x27a23f,_0x346038){var _0x520fd5={'raw':![],'where':{'id':_0x27a23f['params']['id']}},_0xa8404a={};_0xa8404a[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0x35')][_0xd535('0x36')]);_0xa8404a['query']=_[_0xd535('0x4c')](_0x27a23f[_0xd535('0x38')]);_0xa8404a[_0xd535('0x43')]=_[_0xd535('0x39')](_0xa8404a[_0xd535('0x3b')],_0xa8404a[_0xd535('0x38')]);_0x520fd5[_0xd535('0x3a')]=_[_0xd535('0x39')](_0xa8404a[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x27a23f['query'][_0xd535('0x3c')]));_0x520fd5[_0xd535('0x3a')]=_0x520fd5['attributes'][_0xd535('0x3d')]?_0x520fd5[_0xd535('0x3a')]:_0xa8404a[_0xd535('0x3b')];if(_0x27a23f[_0xd535('0x38')][_0xd535('0x47')]){_0x520fd5['include']=[{'all':!![]}];}_0x520fd5=_[_0xd535('0x44')]({},_0x520fd5,_0x27a23f[_0xd535('0x46')]);return db[_0xd535('0x35')][_0xd535('0x2f')](_0x520fd5)[_0xd535('0x26')](handleEntityNotFound(_0x346038,null))[_0xd535('0x26')](respondWithResult(_0x346038,null))[_0xd535('0x4d')](handleError(_0x346038,null));};exports[_0xd535('0x4e')]=function(_0x4d83a0,_0x82f2cc){return db[_0xd535('0x35')][_0xd535('0x4e')](_0x4d83a0[_0xd535('0x4f')],{})['then'](function(_0x16338f){var _0xc28e20=_0x4d83a0[_0xd535('0x50')]['get']({'plain':!![]});if(!_0xc28e20)throw new Error(_0xd535('0x51'));if(_0xc28e20[_0xd535('0x52')]===_0xd535('0x50')){var _0x5a39a6=_0x16338f[_0xd535('0x53')]({'plain':!![]});var _0x9b6397=[{'name':_0xd535('0x28'),'value':_0xd535('0x29')},{'name':_0xd535('0x2a'),'value':_0xd535('0x2b')}];var _0xe60058=_[_0xd535('0x2f')](_0x9b6397,[_0xd535('0x2e'),_0x5a39a6[_0xd535('0x30')]])[_0xd535('0x31')];return db[_0xd535('0x54')][_0xd535('0x2f')]({'where':{'name':_0xe60058,'userProfileId':_0xc28e20['userProfileId']},'raw':!![]})['then'](function(_0x51ad02){if(_0x51ad02&&_0x51ad02[_0xd535('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a39a6['name'],'resourceId':_0x5a39a6['id'],'type':_0x51ad02[_0xd535('0x31')],'sectionId':_0x51ad02['id']},{})['then'](function(){return _0x16338f;});}else{return _0x16338f;}})[_0xd535('0x4d')](function(_0x40475d){logger[_0xd535('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40475d);throw _0x40475d;});}return _0x16338f;})[_0xd535('0x26')](respondWithResult(_0x82f2cc,0xc9))['catch'](handleError(_0x82f2cc,null));};exports[_0xd535('0x57')]=function(_0x57cea1,_0x344d81){var _0x3dc2d1={'where':{'id':_0x57cea1[_0xd535('0x58')]['id']}},_0x741532={};_0x741532[_0xd535('0x3b')]=_['keys'](db[_0xd535('0x35')]['rawAttributes']);_0x3dc2d1[_0xd535('0x3a')]=_['intersection'](_0x741532[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x57cea1[_0xd535('0x38')][_0xd535('0x3c')]));_0x3dc2d1[_0xd535('0x3a')]=_0x3dc2d1[_0xd535('0x3a')][_0xd535('0x3d')]?_0x3dc2d1[_0xd535('0x3a')]:_0x741532[_0xd535('0x3b')];if(_0x57cea1[_0xd535('0x38')]['includeAll']){_0x3dc2d1[_0xd535('0x48')]=[{'all':!![]}];}_0x3dc2d1=_[_0xd535('0x44')]({},_0x3dc2d1,_0x57cea1['options']);return db[_0xd535('0x35')]['find'](_0x3dc2d1)[_0xd535('0x26')](handleEntityNotFound(_0x344d81,null))[_0xd535('0x26')](function(_0x42aaa3){if(_0x42aaa3){var _0x1a6ce6=_0x42aaa3['get']({'plain':!![]});_0x1a6ce6=qs[_0xd535('0x59')](_0x1a6ce6,['id','createdAt',_0xd535('0x5a')]);_0x57cea1['body']=_[_0xd535('0x59')](_0x57cea1[_0xd535('0x4f')],['id',_0xd535('0x5b'),_0xd535('0x5a')]);return db['VoiceQueue']['create'](_[_0xd535('0x44')](_0x1a6ce6,_0x57cea1['body']),{'include':_0x57cea1[_0xd535('0x38')][_0xd535('0x47')]?[{'all':!![]}]:undefined})[_0xd535('0x26')](function(_0x24bf8d){var _0x347078=_0x57cea1[_0xd535('0x50')][_0xd535('0x53')]({'plain':!![]});if(!_0x347078)throw new Error(_0xd535('0x51'));if(_0x347078[_0xd535('0x52')]===_0xd535('0x50')){var _0x28c562=_0x24bf8d['get']({'plain':!![]});var _0x2ca464=[{'name':_0xd535('0x28'),'value':_0xd535('0x29')},{'name':_0xd535('0x2a'),'value':_0xd535('0x2b')}];var _0x5c66d2=_[_0xd535('0x2f')](_0x2ca464,['value',_0x28c562[_0xd535('0x30')]])[_0xd535('0x31')];return db[_0xd535('0x54')]['find']({'where':{'name':_0x5c66d2,'userProfileId':_0x347078['userProfileId']},'raw':!![]})[_0xd535('0x26')](function(_0x5824d5){if(_0x5824d5&&_0x5824d5[_0xd535('0x55')]===0x0){return db['UserProfileResource'][_0xd535('0x4e')]({'name':_0x28c562['name'],'resourceId':_0x28c562['id'],'type':_0x5824d5[_0xd535('0x31')],'sectionId':_0x5824d5['id']},{})[_0xd535('0x26')](function(){return _0x24bf8d;});}else{return _0x24bf8d;}})[_0xd535('0x4d')](function(_0x3aa87c){logger[_0xd535('0x56')](_0xd535('0x5c'),_0x3aa87c);throw _0x3aa87c;});}return _0x24bf8d;});}})[_0xd535('0x26')](respondWithResult(_0x344d81,0xc9))[_0xd535('0x4d')](handleError(_0x344d81,null));};exports[_0xd535('0x5d')]=function(_0x5cc12f,_0x158286){if(_0x5cc12f[_0xd535('0x4f')]['id']){delete _0x5cc12f[_0xd535('0x4f')]['id'];}return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x5cc12f[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x158286,null))['then'](saveUpdates(_0x5cc12f[_0xd535('0x4f')],null))['then'](respondWithResult(_0x158286,null))[_0xd535('0x4d')](handleError(_0x158286,null));};exports[_0xd535('0x27')]=function(_0x580063,_0x1f8d5e){return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x580063[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x1f8d5e,null))[_0xd535('0x26')](removeEntity(_0x1f8d5e,null))[_0xd535('0x4d')](handleError(_0x1f8d5e,null));};exports['getHoppers']=function(_0x41001d,_0x2ad0b5,_0x2dfdcc){var _0x1996f8={'raw':![],'where':{}};var _0x57a6d6={};var _0xedfa00={'count':0x0,'rows':[]};return db[_0xd535('0x35')][_0xd535('0x5e')]({'where':{'id':_0x41001d['params']['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x2ad0b5,null))[_0xd535('0x26')](function(_0x1f462c){if(_0x1f462c){_0x57a6d6[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0x5f')][_0xd535('0x36')]);_0x57a6d6[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x41001d[_0xd535('0x38')]);_0x57a6d6['filters']=_['intersection'](_0x57a6d6[_0xd535('0x3b')],_0x57a6d6[_0xd535('0x38')]);_0x1996f8[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x57a6d6[_0xd535('0x3b')],qs['fields'](_0x41001d[_0xd535('0x38')][_0xd535('0x3c')]));_0x1996f8[_0xd535('0x3a')]=_0x1996f8[_0xd535('0x3a')]['length']?_0x1996f8[_0xd535('0x3a')]:_0x57a6d6['model'];if(!_0x41001d[_0xd535('0x38')][_0xd535('0x3e')](_0xd535('0x3f'))){_0x1996f8[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x41001d[_0xd535('0x38')][_0xd535('0x20')]);_0x1996f8[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x41001d[_0xd535('0x38')][_0xd535('0x1f')]);}_0x1996f8[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x41001d[_0xd535('0x38')][_0xd535('0x41')]);_0x1996f8['where']=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x41001d[_0xd535('0x38')],_0x57a6d6['filters']));_0x1996f8[_0xd535('0x42')][_0xd535('0x61')]=_0x1f462c['id'];if(_0x41001d['query']['filter']){_0x1996f8[_0xd535('0x42')]=_[_0xd535('0x44')](_0x1996f8[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x1996f8[_0xd535('0x3a')],function(_0x18b026){var _0x5e3736={};_0x5e3736[_0x18b026]={'$like':'%'+_0x41001d[_0xd535('0x38')][_0xd535('0x2c')]+'%'};return _0x5e3736;})});}_0x1996f8=_['merge']({},_0x1996f8,_0x41001d[_0xd535('0x46')]);return db[_0xd535('0x5f')][_0xd535('0x21')]({'where':_0x1996f8['where']})[_0xd535('0x26')](function(_0x582b56){_0xedfa00[_0xd535('0x21')]=_0x582b56;if(_0x41001d[_0xd535('0x38')][_0xd535('0x47')]){_0x1996f8[_0xd535('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0xd535('0x49')](_0x1996f8);})[_0xd535('0x26')](function(_0x378ffe){_0xedfa00[_0xd535('0x4a')]=_0x378ffe;return _0xedfa00;});}})['then'](respondWithFilteredResult(_0x2ad0b5,_0x1996f8))[_0xd535('0x4d')](handleError(_0x2ad0b5,null));};exports[_0xd535('0x62')]=function(_0x5b98e0,_0x557d88,_0x54c84d){var _0x1ac80d={'raw':!![],'where':{}};var _0x43ed36={};var _0x1dee7b={'count':0x0,'rows':[]};return db[_0xd535('0x35')][_0xd535('0x5e')]({'where':{'id':_0x5b98e0['params']['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x557d88,null))[_0xd535('0x26')](function(_0x153081){if(_0x153081){_0x43ed36[_0xd535('0x3b')]=_[_0xd535('0x4c')](db['CmHopperHistory'][_0xd535('0x36')]);_0x43ed36[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x5b98e0[_0xd535('0x38')]);_0x43ed36[_0xd535('0x43')]=_[_0xd535('0x39')](_0x43ed36[_0xd535('0x3b')],_0x43ed36['query']);_0x1ac80d[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x43ed36[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x5b98e0['query']['fields']));_0x1ac80d[_0xd535('0x3a')]=_0x1ac80d[_0xd535('0x3a')]['length']?_0x1ac80d['attributes']:_0x43ed36['model'];if(!_0x5b98e0[_0xd535('0x38')][_0xd535('0x3e')](_0xd535('0x3f'))){_0x1ac80d[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x5b98e0[_0xd535('0x38')]['limit']);_0x1ac80d[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x5b98e0['query'][_0xd535('0x1f')]);}_0x1ac80d[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x5b98e0['query']['sort']);_0x1ac80d['where']=qs[_0xd535('0x43')](_['pick'](_0x5b98e0[_0xd535('0x38')],_0x43ed36[_0xd535('0x43')]));_0x1ac80d['where'][_0xd535('0x61')]=_0x153081['id'];if(_0x5b98e0['query']['filter']){_0x1ac80d[_0xd535('0x42')]=_[_0xd535('0x44')](_0x1ac80d['where'],{'$or':_[_0xd535('0x2d')](_0x1ac80d['attributes'],function(_0x953584){var _0x114027={};_0x114027[_0x953584]={'$like':'%'+_0x5b98e0[_0xd535('0x38')][_0xd535('0x2c')]+'%'};return _0x114027;})});}_0x1ac80d=_[_0xd535('0x44')]({},_0x1ac80d,_0x5b98e0['options']);return db['CmHopperHistory']['count']({'where':_0x1ac80d[_0xd535('0x42')]})[_0xd535('0x26')](function(_0x68ba96){_0x1dee7b[_0xd535('0x21')]=_0x68ba96;if(_0x5b98e0[_0xd535('0x38')][_0xd535('0x47')]){_0x1ac80d['include']=[{'all':!![]}];}return db[_0xd535('0x63')][_0xd535('0x49')](_0x1ac80d);})[_0xd535('0x26')](function(_0x2bf18f){_0x1dee7b[_0xd535('0x4a')]=_0x2bf18f;return _0x1dee7b;});}})['then'](respondWithFilteredResult(_0x557d88,_0x1ac80d))['catch'](handleError(_0x557d88,null));};exports['getHopperFinals']=function(_0x192b19,_0x3473ec,_0x576aef){var _0x12f5f4={'raw':!![],'where':{}};var _0x4f7cdf={};var _0xfc5fb5={'count':0x0,'rows':[]};return db[_0xd535('0x35')][_0xd535('0x5e')]({'where':{'id':_0x192b19[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x3473ec,null))[_0xd535('0x26')](function(_0x299495){if(_0x299495){_0x4f7cdf[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0x64')][_0xd535('0x36')]);_0x4f7cdf[_0xd535('0x38')]=_['keys'](_0x192b19[_0xd535('0x38')]);_0x4f7cdf[_0xd535('0x43')]=_[_0xd535('0x39')](_0x4f7cdf[_0xd535('0x3b')],_0x4f7cdf[_0xd535('0x38')]);_0x12f5f4[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x4f7cdf[_0xd535('0x3b')],qs['fields'](_0x192b19['query']['fields']));_0x12f5f4[_0xd535('0x3a')]=_0x12f5f4[_0xd535('0x3a')][_0xd535('0x3d')]?_0x12f5f4['attributes']:_0x4f7cdf[_0xd535('0x3b')];if(!_0x192b19['query'][_0xd535('0x3e')](_0xd535('0x3f'))){_0x12f5f4[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x192b19[_0xd535('0x38')]['limit']);_0x12f5f4['offset']=qs[_0xd535('0x1f')](_0x192b19[_0xd535('0x38')][_0xd535('0x1f')]);}_0x12f5f4[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x192b19[_0xd535('0x38')]['sort']);_0x12f5f4[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x192b19[_0xd535('0x38')],_0x4f7cdf[_0xd535('0x43')]));_0x12f5f4[_0xd535('0x42')][_0xd535('0x61')]=_0x299495['id'];if(_0x192b19[_0xd535('0x38')][_0xd535('0x2c')]){_0x12f5f4[_0xd535('0x42')]=_[_0xd535('0x44')](_0x12f5f4[_0xd535('0x42')],{'$or':_['map'](_0x12f5f4['attributes'],function(_0x29e70d){var _0x579e5b={};_0x579e5b[_0x29e70d]={'$like':'%'+_0x192b19[_0xd535('0x38')]['filter']+'%'};return _0x579e5b;})});}_0x12f5f4=_[_0xd535('0x44')]({},_0x12f5f4,_0x192b19[_0xd535('0x46')]);return db[_0xd535('0x64')][_0xd535('0x21')]({'where':_0x12f5f4[_0xd535('0x42')]})[_0xd535('0x26')](function(_0x3b37a2){_0xfc5fb5[_0xd535('0x21')]=_0x3b37a2;if(_0x192b19[_0xd535('0x38')][_0xd535('0x47')]){_0x12f5f4[_0xd535('0x48')]=[{'all':!![]}];}return db[_0xd535('0x64')]['findAll'](_0x12f5f4);})[_0xd535('0x26')](function(_0x397c75){_0xfc5fb5[_0xd535('0x4a')]=_0x397c75;return _0xfc5fb5;});}})[_0xd535('0x26')](respondWithFilteredResult(_0x3473ec,_0x12f5f4))['catch'](handleError(_0x3473ec,null));};exports[_0xd535('0x65')]=function(_0x2f3756,_0x2807d5,_0x38f675){var _0x450040={'raw':!![],'where':{}};var _0x1897b4={};var _0x40fcde={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd535('0x5e')]({'where':{'id':_0x2f3756[_0xd535('0x58')]['id']}})['then'](handleEntityNotFound(_0x2807d5,null))[_0xd535('0x26')](function(_0x49ea4a){if(_0x49ea4a){_0x1897b4[_0xd535('0x3b')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x1897b4[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x2f3756[_0xd535('0x38')]);_0x1897b4[_0xd535('0x43')]=_[_0xd535('0x39')](_0x1897b4['model'],_0x1897b4[_0xd535('0x38')]);_0x450040[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x1897b4[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x2f3756[_0xd535('0x38')][_0xd535('0x3c')]));_0x450040[_0xd535('0x3a')]=_0x450040['attributes'][_0xd535('0x3d')]?_0x450040[_0xd535('0x3a')]:_0x1897b4[_0xd535('0x3b')];if(!_0x2f3756[_0xd535('0x38')]['hasOwnProperty'](_0xd535('0x3f'))){_0x450040[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x2f3756[_0xd535('0x38')]['limit']);_0x450040['offset']=qs[_0xd535('0x1f')](_0x2f3756[_0xd535('0x38')][_0xd535('0x1f')]);}_0x450040[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x2f3756[_0xd535('0x38')][_0xd535('0x41')]);_0x450040[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x2f3756[_0xd535('0x38')],_0x1897b4[_0xd535('0x43')]));_0x450040[_0xd535('0x42')][_0xd535('0x61')]=_0x49ea4a['id'];if(_0x2f3756[_0xd535('0x38')]['filter']){_0x450040['where']=_[_0xd535('0x44')](_0x450040[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x450040[_0xd535('0x3a')],function(_0x3b6d1e){var _0x3fd51c={};_0x3fd51c[_0x3b6d1e]={'$like':'%'+_0x2f3756[_0xd535('0x38')][_0xd535('0x2c')]+'%'};return _0x3fd51c;})});}_0x450040=_[_0xd535('0x44')]({},_0x450040,_0x2f3756[_0xd535('0x46')]);return db[_0xd535('0x66')][_0xd535('0x21')]({'where':_0x450040[_0xd535('0x42')]})[_0xd535('0x26')](function(_0x1318d9){_0x40fcde[_0xd535('0x21')]=_0x1318d9;if(_0x2f3756['query'][_0xd535('0x47')]){_0x450040[_0xd535('0x48')]=[{'all':!![]}];}return db[_0xd535('0x66')][_0xd535('0x49')](_0x450040);})[_0xd535('0x26')](function(_0xa8836){_0x40fcde[_0xd535('0x4a')]=_0xa8836;return _0x40fcde;});}})[_0xd535('0x26')](respondWithFilteredResult(_0x2807d5,_0x450040))['catch'](handleError(_0x2807d5,null));};exports[_0xd535('0x67')]=function(_0x462a8b,_0x5cdc46,_0x10d765){var _0x224a04={};var _0x2ca82e={};var _0x5066cd;var _0x25faba;return db[_0xd535('0x35')][_0xd535('0x5e')]({'where':{'id':_0x462a8b[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x5cdc46,null))[_0xd535('0x26')](function(_0x415320){if(_0x415320){_0x5066cd=_0x415320;_0x2ca82e[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0x68')][_0xd535('0x36')]);_0x2ca82e[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x462a8b[_0xd535('0x38')]);_0x2ca82e[_0xd535('0x43')]=_[_0xd535('0x39')](_0x2ca82e[_0xd535('0x3b')],_0x2ca82e['query']);_0x224a04['attributes']=_['intersection'](_0x2ca82e[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x462a8b[_0xd535('0x38')][_0xd535('0x3c')]));_0x224a04['attributes']=_0x224a04['attributes'][_0xd535('0x3d')]?_0x224a04[_0xd535('0x3a')]:_0x2ca82e[_0xd535('0x3b')];_0x224a04[_0xd535('0x40')]=qs['sort'](_0x462a8b['query'][_0xd535('0x41')]);_0x224a04[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x462a8b[_0xd535('0x38')],_0x2ca82e[_0xd535('0x43')]));if(_0x462a8b[_0xd535('0x38')]['filter']){_0x224a04[_0xd535('0x42')]=_['merge'](_0x224a04[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x224a04[_0xd535('0x3a')],function(_0x451564){var _0x4f6e72={};_0x4f6e72[_0x451564]={'$like':'%'+_0x462a8b[_0xd535('0x38')][_0xd535('0x2c')]+'%'};return _0x4f6e72;})});}_0x224a04=_[_0xd535('0x44')]({},_0x224a04,_0x462a8b[_0xd535('0x46')]);return _0x5066cd[_0xd535('0x67')](_0x224a04);}})[_0xd535('0x26')](function(_0x1e11fe){if(_0x1e11fe){_0x25faba=_0x1e11fe[_0xd535('0x3d')];if(!_0x462a8b[_0xd535('0x38')][_0xd535('0x3e')]('nolimit')){_0x224a04[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x462a8b['query'][_0xd535('0x20')]);_0x224a04[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x462a8b['query'][_0xd535('0x1f')]);}return _0x5066cd[_0xd535('0x67')](_0x224a04);}})[_0xd535('0x26')](function(_0x18ff7e){if(_0x18ff7e){return _0x18ff7e?{'count':_0x25faba,'rows':_0x18ff7e}:null;}})[_0xd535('0x26')](respondWithResult(_0x5cdc46,null))[_0xd535('0x4d')](handleError(_0x5cdc46,null));};exports[_0xd535('0x69')]=function(_0x231c83,_0x54b32e,_0x530dab){var _0x34e3cb=_0x231c83[_0xd535('0x4f')]['teams'];var _0x2e7528=_[_0xd535('0x2d')](_0x34e3cb,'id');return db[_0xd535('0x68')][_0xd535('0x49')]({'where':{'id':_0x2e7528},'attributes':['id'],'include':[{'model':db[_0xd535('0x6a')],'as':_0xd535('0x6b'),'attributes':['id',_0xd535('0x31'),_0xd535('0x6c'),_0xd535('0x6d'),_0xd535('0x6e')],'raw':!![]}]})[_0xd535('0x26')](function(_0x41379d){if(_0x41379d){var _0x1b5767=_['flatMap'](_0x41379d,function(_0x1a7043){var _0x32f880=_0x1a7043[_0xd535('0x53')]({'plain':!![]});_0x32f880[_0xd535('0x6b')]['forEach'](function(_0x526b9a){_0x526b9a[_0xd535('0x6f')]=_['find'](_0x34e3cb,{'id':_0x32f880['id']})[_0xd535('0x6f')];});return _0x32f880[_0xd535('0x6b')];});return db['VoiceQueue'][_0xd535('0x2f')]({'where':{'id':_0x231c83[_0xd535('0x58')]['id']}})['then'](function(_0x2a1424){return db[_0xd535('0x70')][_0xd535('0x71')](function(_0x2895fd){return _0x2a1424[_0xd535('0x69')](_0x2e7528,{'transaction':_0x2895fd})[_0xd535('0x26')](function(){return BPromise['each'](_0x34e3cb,function(_0x189093){return db['TeamVoiceQueue'][_0xd535('0x72')]({'TeamId':_0x189093['id'],'VoiceQueueId':_0x231c83[_0xd535('0x58')]['id'],'penalty':_0x189093['penalty']},{'transaction':_0x2895fd});});})['then'](function(){return BPromise[_0xd535('0x73')](_0x1b5767,function(_0x47c8ed){return db[_0xd535('0x74')][_0xd535('0x75')]({'where':{'UserId':_0x47c8ed['id'],'VoiceQueueId':_0x231c83[_0xd535('0x58')]['id']},'defaults':{'penalty':_0x47c8ed[_0xd535('0x6f')]},'transaction':_0x2895fd});});})[_0xd535('0x26')](function(){return BPromise[_0xd535('0x73')](_[_0xd535('0x2c')](_0x1b5767,{'online':!![]}),function(_0x4e001e){return db[_0xd535('0x76')][_0xd535('0x72')]({'membername':_0x4e001e[_0xd535('0x31')],'UserId':_0x4e001e['id'],'queue_name':_0x2a1424[_0xd535('0x31')],'VoiceQueueId':_0x2a1424['id'],'interface':_['isNil'](_0x4e001e[_0xd535('0x6e')])?util[_0xd535('0x77')](_0xd535('0x78'),_0x4e001e['name']):_0x4e001e[_0xd535('0x6e')],'paused':_0x4e001e['voicePause']||![],'penalty':_0x4e001e[_0xd535('0x6f')]},{'transaction':_0x2895fd});});})['then'](function(){_0x1b5767[_0xd535('0x79')](function(_0x47b8f3){socket[_0xd535('0x7a')](_0xd535('0x7b'),{'UserId':_0x47b8f3['id'],'VoiceQueueId':_0x2a1424['id']});});});});});}})[_0xd535('0x26')](respondWithStatusCode(_0x54b32e,null))['catch'](handleError(_0x54b32e,null));};exports['removeTeams']=function(_0x27186c,_0x7d1c82,_0x2d1ef6){return db[_0xd535('0x68')]['findAll']({'where':{'id':_0x27186c['query'][_0xd535('0x7c')]},'attributes':['id'],'include':[{'model':db[_0xd535('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd535('0x26')](handleEntityNotFound(_0x7d1c82,null))[_0xd535('0x26')](function(_0x5f5107){var _0x157cdf=_['map'](_0x5f5107,'id');var _0x3ab274=[];var _0x5a01ed=[];var _0x282416=squel[_0xd535('0x7d')]();_0x282416[_0xd535('0x7e')]('tq.TeamId')['from']('team_has_voice_queues','tq')['join']('user_has_teams','ut',_0xd535('0x7f'))[_0xd535('0x42')](_0xd535('0x80'),_0x27186c[_0xd535('0x58')]['id']);for(var _0x15f20c=0x0;_0x15f20c<_0x5f5107[_0xd535('0x3d')];_0x15f20c+=0x1){let _0x2bc0d1=_0x5f5107[_0x15f20c];for(var _0x484493=0x0;_0x484493<_0x2bc0d1['Agents'][_0xd535('0x3d')];_0x484493+=0x1){let _0x467390=_0x2bc0d1[_0xd535('0x6b')][_0x484493];var _0x55038b=_0x282416['clone']();_0x55038b[_0xd535('0x42')]('ut.UserId\x20=\x20?',_0x467390['id']);_0x5a01ed[_0xd535('0x81')](db[_0xd535('0x70')][_0xd535('0x38')](_0x55038b[_0xd535('0x82')](),{'type':db[_0xd535('0x70')][_0xd535('0x83')][_0xd535('0x84')]})['then'](function(_0x2f0f3f){if(_0x2f0f3f['length']===0x1){return _0x467390['id'];}else{var _0x53095a=_[_0xd535('0x85')](_[_0xd535('0x2d')](_0x2f0f3f,_0xd535('0x86')),function(_0x2d804a){return _[_0xd535('0x87')](_0x157cdf,_0x2d804a);});if(_0x53095a){return _0x467390['id'];}}}));}}return BPromise[_0xd535('0x88')](_0x5a01ed)['then'](function(_0x40319b){_0x3ab274=_(_0x3ab274)[_0xd535('0x89')](_0x40319b)[_0xd535('0x8a')]()[_0xd535('0x2e')]();return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x27186c[_0xd535('0x58')]['id']}})[_0xd535('0x26')](function(_0x346248){return db[_0xd535('0x70')][_0xd535('0x71')](function(_0x177d14){return _0x346248['removeTeams'](_0x27186c[_0xd535('0x38')][_0xd535('0x7c')],{'transaction':_0x177d14})[_0xd535('0x26')](function(){if(!_[_0xd535('0x8b')](_0x3ab274)){return _0x346248[_0xd535('0x8c')](_0x3ab274,{'transaction':_0x177d14})[_0xd535('0x26')](function(){return db[_0xd535('0x76')][_0xd535('0x27')]({'where':{'VoiceQueueId':_0x27186c[_0xd535('0x58')]['id'],'UserId':_0x3ab274},'transaction':_0x177d14});});}})[_0xd535('0x26')](function(){_0x3ab274[_0xd535('0x79')](function(_0x3b65b6){socket['emit']('userVoiceQueue:remove',{'UserId':_0x3b65b6,'VoiceQueueId':_0x346248['id']});});});});});});})[_0xd535('0x26')](respondWithStatusCode(_0x7d1c82,null))['catch'](handleError(_0x7d1c82,null));};exports[_0xd535('0x8d')]=function(_0x1763cd,_0x467b08,_0x5c86d4){var _0x214522,_0x5d5d61;return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x1763cd[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x467b08,null))[_0xd535('0x26')](function(_0x1a1416){if(_0x1a1416){_0x5d5d61=_0x1a1416;return _0x1a1416[_0xd535('0x8d')](_0x1763cd[_0xd535('0x4f')][_0xd535('0x7c')],_['omit'](_0x1763cd[_0xd535('0x4f')],['ids','id'])||{})[_0xd535('0x8e')](function(_0x1d7207){for(var _0x3281da=0x0;_0x3281da<_0x1763cd['body'][_0xd535('0x7c')][_0xd535('0x3d')];_0x3281da+=0x1){socket[_0xd535('0x7a')](_0xd535('0x7b'),{'UserId':Number(_0x1763cd['body'][_0xd535('0x7c')][_0x3281da]),'VoiceQueueId':Number(_0x1763cd[_0xd535('0x58')]['id'])});}return _0x1d7207;});}})[_0xd535('0x26')](function(_0x47c367){_0x214522=_0x47c367||[];if(_0x5d5d61){return db[_0xd535('0x6a')][_0xd535('0x49')]({'where':{'id':_0x1763cd['body'][_0xd535('0x7c')]},'attributes':['id',_0xd535('0x31'),_0xd535('0x6c'),_0xd535('0x6d'),_0xd535('0x6e')],'raw':!![]});}})[_0xd535('0x26')](function(_0x23bb15){if(!_[_0xd535('0x8b')](_0x23bb15)){var _0x26158e=[];for(var _0x1e2e24=0x0;_0x1e2e24<_0x23bb15['length'];_0x1e2e24++){if(_0x23bb15[_0x1e2e24][_0xd535('0x6c')]){_0x26158e['push'](db[_0xd535('0x76')][_0xd535('0x72')]({'membername':_0x23bb15[_0x1e2e24][_0xd535('0x31')],'UserId':_0x23bb15[_0x1e2e24]['id'],'queue_name':_0x5d5d61[_0xd535('0x31')],'VoiceQueueId':_0x5d5d61['id'],'interface':_[_0xd535('0x8f')](_0x23bb15[_0x1e2e24]['interface'])?util[_0xd535('0x77')](_0xd535('0x78'),_0x23bb15[_0x1e2e24][_0xd535('0x31')]):_0x23bb15[_0x1e2e24][_0xd535('0x6e')],'paused':_0x23bb15[_0x1e2e24]['voicePause']||![],'penalty':_0x1763cd[_0xd535('0x4f')][_0xd535('0x6f')]||0x0}));}}return BPromise[_0xd535('0x88')](_0x26158e);}})[_0xd535('0x26')](function(){return _0x214522;})['then'](respondWithResult(_0x467b08,null))[_0xd535('0x4d')](handleError(_0x467b08,null));};exports['removeAgents']=function(_0x55bb3f,_0x40b4a2,_0x1e6ce3){return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x55bb3f[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x40b4a2,null))[_0xd535('0x26')](function(_0x109cc1){if(_0x109cc1){return _0x109cc1[_0xd535('0x8c')](_0x55bb3f[_0xd535('0x38')][_0xd535('0x7c')])['then'](function(){if(_[_0xd535('0x90')](_0x55bb3f[_0xd535('0x38')]['ids'])){for(var _0x313973=0x0;_0x313973<_0x55bb3f[_0xd535('0x38')][_0xd535('0x7c')]['length'];_0x313973+=0x1){socket[_0xd535('0x7a')](_0xd535('0x91'),{'UserId':Number(_0x55bb3f[_0xd535('0x38')]['ids'][_0x313973]),'VoiceQueueId':Number(_0x55bb3f['params']['id'])});}}else{socket[_0xd535('0x7a')](_0xd535('0x91'),{'UserId':Number(_0x55bb3f[_0xd535('0x38')][_0xd535('0x7c')]),'VoiceQueueId':Number(_0x55bb3f['params']['id'])});}});}})[_0xd535('0x26')](function(_0xe28fdf){return db[_0xd535('0x76')]['destroy']({'where':{'VoiceQueueId':_0x55bb3f['params']['id'],'UserId':_0x55bb3f['query'][_0xd535('0x7c')]}})[_0xd535('0x26')](function(){return _0xe28fdf;});})['then'](respondWithStatusCode(_0x40b4a2,null))[_0xd535('0x4d')](handleError(_0x40b4a2,null));};exports[_0xd535('0x92')]=function(_0x36dc0c,_0x3f99c8,_0xf92b1f){var _0x5f2d44={};var _0x2840ef={};var _0x373443;var _0x560513;return db['VoiceQueue'][_0xd535('0x5e')]({'where':{'id':_0x36dc0c['params']['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x3f99c8,null))[_0xd535('0x26')](function(_0x3c8249){if(_0x3c8249){_0x373443=_0x3c8249;_0x2840ef[_0xd535('0x3b')]=_[_0xd535('0x4c')](db['User'][_0xd535('0x36')]);_0x2840ef[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x36dc0c['query']);_0x2840ef[_0xd535('0x43')]=_['intersection'](_0x2840ef['model'],_0x2840ef[_0xd535('0x38')]);_0x5f2d44[_0xd535('0x3a')]=_['intersection'](_0x2840ef[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x36dc0c['query'][_0xd535('0x3c')]));_0x5f2d44[_0xd535('0x3a')]=_0x5f2d44[_0xd535('0x3a')][_0xd535('0x3d')]?_0x5f2d44[_0xd535('0x3a')]:_0x2840ef['model'];_0x5f2d44[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x36dc0c[_0xd535('0x38')][_0xd535('0x41')]);_0x5f2d44['where']=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x36dc0c['query'],_0x2840ef['filters']));if(_0x36dc0c['query'][_0xd535('0x2c')]){_0x5f2d44[_0xd535('0x42')]=_[_0xd535('0x44')](_0x5f2d44[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x5f2d44['attributes'],function(_0x2ba544){var _0x347049={};_0x347049[_0x2ba544]={'$like':'%'+_0x36dc0c['query']['filter']+'%'};return _0x347049;})});}_0x5f2d44=_[_0xd535('0x44')]({},_0x5f2d44,_0x36dc0c[_0xd535('0x46')]);return _0x373443[_0xd535('0x92')](_0x5f2d44);}})[_0xd535('0x26')](function(_0x391e0e){if(_0x391e0e){_0x560513=_0x391e0e[_0xd535('0x3d')];if(!_0x36dc0c[_0xd535('0x38')]['hasOwnProperty']('nolimit')){_0x5f2d44[_0xd535('0x20')]=qs['limit'](_0x36dc0c['query'][_0xd535('0x20')]);_0x5f2d44[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x36dc0c['query'][_0xd535('0x1f')]);}return _0x373443[_0xd535('0x92')](_0x5f2d44);}})[_0xd535('0x26')](function(_0x40f381){if(_0x40f381){return _0x40f381?{'count':_0x560513,'rows':_0x40f381}:null;}})[_0xd535('0x26')](respondWithResult(_0x3f99c8,null))[_0xd535('0x4d')](handleError(_0x3f99c8,null));};exports[_0xd535('0x93')]=function(_0x46d21d,_0x39e49b,_0x4d15d7){var _0x175486={};var _0x5e7150={};var _0x3d8b6f;var _0x316e9e;return db[_0xd535('0x35')]['findOne']({'where':{'id':_0x46d21d[_0xd535('0x58')]['id']}})['then'](handleEntityNotFound(_0x39e49b,null))['then'](function(_0x6d38fa){if(_0x6d38fa){_0x3d8b6f=_0x6d38fa;_0x5e7150[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0x76')][_0xd535('0x36')]);_0x5e7150[_0xd535('0x38')]=_['keys'](_0x46d21d[_0xd535('0x38')]);_0x5e7150[_0xd535('0x43')]=_[_0xd535('0x39')](_0x5e7150[_0xd535('0x3b')],_0x5e7150[_0xd535('0x38')]);_0x175486[_0xd535('0x3a')]=_['intersection'](_0x5e7150[_0xd535('0x3b')],qs['fields'](_0x46d21d[_0xd535('0x38')][_0xd535('0x3c')]));_0x175486[_0xd535('0x3a')]=_0x175486[_0xd535('0x3a')]['length']?_0x175486[_0xd535('0x3a')]:_0x5e7150[_0xd535('0x3b')];_0x175486[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x46d21d[_0xd535('0x38')][_0xd535('0x41')]);_0x175486[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x46d21d['query'],_0x5e7150[_0xd535('0x43')]));if(_0x46d21d[_0xd535('0x38')][_0xd535('0x2c')]){_0x175486[_0xd535('0x42')]=_[_0xd535('0x44')](_0x175486[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x175486['attributes'],function(_0x127b1c){var _0x2b7a30={};_0x2b7a30[_0x127b1c]={'$like':'%'+_0x46d21d[_0xd535('0x38')]['filter']+'%'};return _0x2b7a30;})});}_0x175486=_[_0xd535('0x44')]({},_0x175486,_0x46d21d[_0xd535('0x46')]);return _0x3d8b6f[_0xd535('0x93')](_0x175486);}})[_0xd535('0x26')](function(_0xe92257){if(_0xe92257){_0x316e9e=_0xe92257[_0xd535('0x3d')];if(!_0x46d21d[_0xd535('0x38')]['hasOwnProperty'](_0xd535('0x3f'))){_0x175486[_0xd535('0x20')]=qs[_0xd535('0x20')](_0x46d21d[_0xd535('0x38')][_0xd535('0x20')]);_0x175486[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x46d21d[_0xd535('0x38')]['offset']);}return _0x3d8b6f[_0xd535('0x93')](_0x175486);}})[_0xd535('0x26')](function(_0x1b5cbe){return _0x1b5cbe?{'count':_0x316e9e,'rows':_0x1b5cbe}:null;})[_0xd535('0x26')](respondWithResult(_0x39e49b,null))[_0xd535('0x4d')](handleError(_0x39e49b,null));};exports['getLists']=function(_0x53eb74,_0x28bbb7,_0x5d87f3){var _0x54cf55={};var _0x506c96={};var _0x10af37;var _0x5be259;return db[_0xd535('0x35')]['findOne']({'where':{'id':_0x53eb74[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x28bbb7,null))[_0xd535('0x26')](function(_0x46bb03){if(_0x46bb03){_0x10af37=_0x46bb03;_0x506c96['model']=_[_0xd535('0x4c')](db['CmList'][_0xd535('0x36')]);_0x506c96[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x53eb74['query']);_0x506c96[_0xd535('0x43')]=_[_0xd535('0x39')](_0x506c96[_0xd535('0x3b')],_0x506c96[_0xd535('0x38')]);_0x54cf55[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x506c96[_0xd535('0x3b')],qs[_0xd535('0x3c')](_0x53eb74[_0xd535('0x38')][_0xd535('0x3c')]));_0x54cf55[_0xd535('0x3a')]=_0x54cf55[_0xd535('0x3a')]['length']?_0x54cf55[_0xd535('0x3a')]:_0x506c96[_0xd535('0x3b')];_0x54cf55[_0xd535('0x40')]=qs[_0xd535('0x41')](_0x53eb74['query'][_0xd535('0x41')]);_0x54cf55[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x53eb74['query'],_0x506c96['filters']));if(_0x53eb74[_0xd535('0x38')]['filter']){_0x54cf55['where']=_['merge'](_0x54cf55[_0xd535('0x42')],{'$or':_[_0xd535('0x2d')](_0x54cf55[_0xd535('0x3a')],function(_0x4ab745){var _0xd87604={};_0xd87604[_0x4ab745]={'$like':'%'+_0x53eb74[_0xd535('0x38')]['filter']+'%'};return _0xd87604;})});}_0x54cf55=_[_0xd535('0x44')]({},_0x54cf55,_0x53eb74[_0xd535('0x46')]);return _0x10af37[_0xd535('0x94')](_0x54cf55);}})[_0xd535('0x26')](function(_0x5ecbcc){if(_0x5ecbcc){_0x5be259=_0x5ecbcc[_0xd535('0x3d')];if(!_0x53eb74[_0xd535('0x38')][_0xd535('0x3e')](_0xd535('0x3f'))){_0x54cf55['limit']=qs[_0xd535('0x20')](_0x53eb74[_0xd535('0x38')][_0xd535('0x20')]);_0x54cf55[_0xd535('0x1f')]=qs[_0xd535('0x1f')](_0x53eb74[_0xd535('0x38')][_0xd535('0x1f')]);}return _0x10af37['getLists'](_0x54cf55);}})[_0xd535('0x26')](function(_0x5d3d55){if(_0x5d3d55){return _0x5d3d55?{'count':_0x5be259,'rows':_0x5d3d55}:null;}})[_0xd535('0x26')](respondWithResult(_0x28bbb7,null))[_0xd535('0x4d')](handleError(_0x28bbb7,null));};exports[_0xd535('0x95')]=function(_0x38d013,_0x55811e,_0x59f71e){var _0x342591=moment()['format'](_0xd535('0x96'));var _0x10a375,_0x2bf208;return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x38d013[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x55811e,null))[_0xd535('0x26')](function(_0x50d214){if(_0x50d214){_0x2bf208=_0x50d214;return _0x50d214[_0xd535('0x95')](_0x38d013[_0xd535('0x4f')][_0xd535('0x7c')],_[_0xd535('0x59')](_0x38d013[_0xd535('0x4f')],['ids','id'])||{});}return null;})[_0xd535('0x8e')](function(_0x3f9917){var _0x4295f3;_0x10a375=_0x3f9917||[];var _0x556765=[];if(_0x3f9917){for(var _0x18b0e3=0x0;_0x18b0e3<_0x3f9917['length'];_0x18b0e3+=0x1){var _0x511816=_0x3f9917[_0x18b0e3][_0xd535('0x53')]({'plain':!![]});_0x2bf208[_0xd535('0x97')]=_0x38d013[_0xd535('0x4f')][_0xd535('0x97')]?_0x38d013[_0xd535('0x4f')][_0xd535('0x97')]:_0x2bf208['dialCheckDuplicateType'];switch(_0x2bf208['dialCheckDuplicateType']){case _0xd535('0x98'):_0x4295f3=squel['insert']()['into']('cm_hopper')[_0xd535('0x99')](['phone','scheduledAt',_0xd535('0x9a'),'ListId',_0xd535('0x61'),'createdAt',_0xd535('0x5a')],squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0x9b'),_0xd535('0x9b'))['field']('\x27'+_0x342591+'\x27',_0xd535('0x9c'))[_0xd535('0x7e')]('id','ContactId')[_0xd535('0x7e')](_0x511816['CmListId'][_0xd535('0x82')](),_0xd535('0x9d'))['field'](_0x38d013['params']['id']['toString'](),_0xd535('0x61'))['field']('\x27'+_0x342591+'\x27',_0xd535('0x5b'))[_0xd535('0x7e')]('\x27'+_0x342591+'\x27',_0xd535('0x5a'))[_0xd535('0x9e')](_0xd535('0x9f'))['where'](_0xd535('0xa0'))[_0xd535('0x42')]('ListId\x20=\x20?',_0x511816[_0xd535('0xa1')][_0xd535('0x82')]())['where'](_0xd535('0xa2'))[_0xd535('0x42')](_0xd535('0xa3'),squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0xa4'))[_0xd535('0x9e')](_0xd535('0xa5'))['where'](_0xd535('0x80'),_0x38d013[_0xd535('0x58')]['id'][_0xd535('0x82')]()))[_0xd535('0x42')](_0xd535('0xa3'),squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0xa6'))[_0xd535('0x9e')](_0xd535('0xa7'))[_0xd535('0x42')](_0xd535('0x80'),_0x38d013[_0xd535('0x58')]['id'][_0xd535('0x82')]())))[_0xd535('0x82')]();break;case'onlyIfOpen':_0x4295f3=squel['insert']()[_0xd535('0xa8')](_0xd535('0xa7'))[_0xd535('0x99')]([_0xd535('0x9b'),_0xd535('0x9c'),_0xd535('0x9a'),'ListId','VoiceQueueId',_0xd535('0x5b'),_0xd535('0x5a')],squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0x9b'),_0xd535('0x9b'))[_0xd535('0x7e')]('\x27'+_0x342591+'\x27','scheduledAt')[_0xd535('0x7e')]('id',_0xd535('0x9a'))[_0xd535('0x7e')](_0x511816[_0xd535('0xa1')][_0xd535('0x82')](),'ListId')[_0xd535('0x7e')](_0x38d013['params']['id'][_0xd535('0x82')](),_0xd535('0x61'))[_0xd535('0x7e')]('\x27'+_0x342591+'\x27','createdAt')[_0xd535('0x7e')]('\x27'+_0x342591+'\x27',_0xd535('0x5a'))['from'](_0xd535('0x9f'))[_0xd535('0x42')](_0xd535('0xa0'))[_0xd535('0x42')]('ListId\x20=\x20?',_0x511816[_0xd535('0xa1')][_0xd535('0x82')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xd535('0xa3'),squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0xa6'))[_0xd535('0x9e')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x38d013['params']['id'][_0xd535('0x82')]())))['toString']();break;default:_0x4295f3=squel[_0xd535('0xa9')]()[_0xd535('0xa8')](_0xd535('0xa7'))[_0xd535('0x99')](['phone','scheduledAt',_0xd535('0x9a'),_0xd535('0x9d'),_0xd535('0x61'),'createdAt',_0xd535('0x5a')],squel['select']()[_0xd535('0x7e')]('phone',_0xd535('0x9b'))[_0xd535('0x7e')]('\x27'+_0x342591+'\x27',_0xd535('0x9c'))[_0xd535('0x7e')]('id',_0xd535('0x9a'))[_0xd535('0x7e')](_0x511816[_0xd535('0xa1')]['toString'](),_0xd535('0x9d'))[_0xd535('0x7e')](_0x38d013['params']['id'][_0xd535('0x82')](),_0xd535('0x61'))['field']('\x27'+_0x342591+'\x27',_0xd535('0x5b'))['field']('\x27'+_0x342591+'\x27',_0xd535('0x5a'))[_0xd535('0x9e')](_0xd535('0x9f'))[_0xd535('0x42')]('deletedAt\x20IS\x20NULL')[_0xd535('0x42')](_0xd535('0xaa'),_0x511816['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xd535('0x82')]();}_0x556765[_0xd535('0x81')](db[_0xd535('0x70')]['query'](_0x4295f3));}return BPromise['all'](_0x556765);}})[_0xd535('0x26')](function(){var _0x17f53b=[];var _0x5cba5f=squel[_0xd535('0xa9')]()[_0xd535('0xa8')](_0xd535('0xab'))[_0xd535('0x99')]([_0xd535('0xac'),_0xd535('0x9b'),_0xd535('0xad'),_0xd535('0x5b'),_0xd535('0x5a')],squel[_0xd535('0x7d')]()[_0xd535('0x7e')](_0xd535('0xae'))[_0xd535('0x7e')](_0xd535('0xaf'))[_0xd535('0x7e')](_0xd535('0xb0'))[_0xd535('0x7e')]('\x27'+_0x342591+'\x27',_0xd535('0x5b'))['field']('\x27'+_0x342591+'\x27',_0xd535('0x5a'))[_0xd535('0x9e')](_0xd535('0xb1'),'ci')['join'](_0xd535('0xa7'),'h','h.ContactId=ci.CmContactId')['where'](_0xd535('0xb2'),_0x342591)['where'](_0xd535('0xb3'),_0xd535('0xb4')))[_0xd535('0x82')]();_0x17f53b[_0xd535('0x81')](db[_0xd535('0x70')][_0xd535('0x38')](_0x5cba5f));return BPromise[_0xd535('0x88')](_0x17f53b);})[_0xd535('0x26')](function(){return _0x10a375;})[_0xd535('0x26')](respondWithResult(_0x55811e,null))[_0xd535('0x4d')](handleError(_0x55811e,null));};exports[_0xd535('0xb5')]=function(_0x202162,_0x1447e9,_0x31bf87){return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x202162[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x1447e9,null))[_0xd535('0x26')](function(_0x467ab6){if(_0x467ab6){return _0x467ab6['removeLists'](_0x202162[_0xd535('0x38')][_0xd535('0x7c')]);}})[_0xd535('0x26')](function(_0x45f74f){if(_0x45f74f){return db[_0xd535('0x5f')][_0xd535('0x27')]({'where':{'ListId':_0x202162['query'][_0xd535('0x7c')],'VoiceQueueId':_0x202162['params']['id']}})['then'](function(){return _0x45f74f;});}})[_0xd535('0x26')](respondWithStatusCode(_0x1447e9,null))['catch'](handleError(_0x1447e9,null));};exports[_0xd535('0xb6')]=function(_0x709515,_0xb180af,_0x40d341){var _0x57361a={};var _0x48e734={};var _0x502da8;var _0x414944;return db[_0xd535('0x35')]['findOne']({'where':{'id':_0x709515['params']['id']}})[_0xd535('0x26')](handleEntityNotFound(_0xb180af,null))[_0xd535('0x26')](function(_0x3d8403){if(_0x3d8403){_0x502da8=_0x3d8403;_0x48e734[_0xd535('0x3b')]=_[_0xd535('0x4c')](db[_0xd535('0xb7')]['rawAttributes']);_0x48e734[_0xd535('0x38')]=_[_0xd535('0x4c')](_0x709515['query']);_0x48e734['filters']=_['intersection'](_0x48e734['model'],_0x48e734[_0xd535('0x38')]);_0x57361a[_0xd535('0x3a')]=_[_0xd535('0x39')](_0x48e734[_0xd535('0x3b')],qs['fields'](_0x709515[_0xd535('0x38')]['fields']));_0x57361a[_0xd535('0x3a')]=_0x57361a[_0xd535('0x3a')][_0xd535('0x3d')]?_0x57361a[_0xd535('0x3a')]:_0x48e734[_0xd535('0x3b')];_0x57361a['order']=qs['sort'](_0x709515[_0xd535('0x38')][_0xd535('0x41')]);_0x57361a[_0xd535('0x42')]=qs[_0xd535('0x43')](_[_0xd535('0x60')](_0x709515[_0xd535('0x38')],_0x48e734[_0xd535('0x43')]));if(_0x709515[_0xd535('0x38')][_0xd535('0x2c')]){_0x57361a[_0xd535('0x42')]=_[_0xd535('0x44')](_0x57361a['where'],{'$or':_[_0xd535('0x2d')](_0x57361a[_0xd535('0x3a')],function(_0x18800e){var _0x4534b0={};_0x4534b0[_0x18800e]={'$like':'%'+_0x709515[_0xd535('0x38')][_0xd535('0x2c')]+'%'};return _0x4534b0;})});}_0x57361a=_[_0xd535('0x44')]({},_0x57361a,_0x709515[_0xd535('0x46')]);return _0x502da8[_0xd535('0xb6')](_0x57361a);}})[_0xd535('0x26')](function(_0x1ebded){if(_0x1ebded){_0x414944=_0x1ebded[_0xd535('0x3d')];if(!_0x709515[_0xd535('0x38')][_0xd535('0x3e')](_0xd535('0x3f'))){_0x57361a['limit']=qs[_0xd535('0x20')](_0x709515['query'][_0xd535('0x20')]);_0x57361a[_0xd535('0x1f')]=qs['offset'](_0x709515[_0xd535('0x38')][_0xd535('0x1f')]);}return _0x502da8[_0xd535('0xb6')](_0x57361a);}})[_0xd535('0x26')](function(_0x31b09f){if(_0x31b09f){return _0x31b09f?{'count':_0x414944,'rows':_0x31b09f}:null;}})[_0xd535('0x26')](respondWithResult(_0xb180af,null))[_0xd535('0x4d')](handleError(_0xb180af,null));};exports[_0xd535('0xb8')]=function(_0x1962a7,_0x3c920a,_0x168492){var _0x518270,_0x4da434;return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x1962a7[_0xd535('0x58')]['id']}})[_0xd535('0x26')](handleEntityNotFound(_0x3c920a,null))[_0xd535('0x26')](function(_0x2547f6){if(_0x2547f6){_0x4da434=_0x2547f6;return _0x2547f6[_0xd535('0xb8')](_0x1962a7['body'][_0xd535('0x7c')],_[_0xd535('0x59')](_0x1962a7[_0xd535('0x4f')],[_0xd535('0x7c'),'id'])||{});}return null;})[_0xd535('0x8e')](function(_0x340b0f){var _0x34084f;_0x518270=_0x340b0f||[];var _0x4d5528=[];if(_0x340b0f){for(var _0x417291=0x0;_0x417291<_0x340b0f[_0xd535('0x3d')];_0x417291+=0x1){var _0x12d4f7=_0x340b0f[_0x417291]['get']({'plain':!![]});_0x34084f=squel['insert']()['into'](_0xd535('0xb9'))[_0xd535('0x99')]([_0xd535('0x9b'),'ContactId',_0xd535('0x9d'),_0xd535('0x61'),'createdAt',_0xd535('0x5a')],squel[_0xd535('0x7d')]()['field'](_0xd535('0x9b'),_0xd535('0x9b'))[_0xd535('0x7e')]('id',_0xd535('0x9a'))[_0xd535('0x7e')](_0x12d4f7[_0xd535('0xa1')][_0xd535('0x82')](),_0xd535('0x9d'))[_0xd535('0x7e')](_0x1962a7['params']['id'][_0xd535('0x82')](),_0xd535('0x61'))[_0xd535('0x7e')]('NOW()',_0xd535('0x5b'))['field'](_0xd535('0xba'),_0xd535('0x5a'))[_0xd535('0x9e')]('cm_contacts')[_0xd535('0x42')](_0xd535('0xa0'))[_0xd535('0x42')](_0xd535('0xaa'),_0x12d4f7['CmListId'][_0xd535('0x82')]())[_0xd535('0x42')](_0xd535('0xa2')))[_0xd535('0x82')]();_0x4d5528[_0xd535('0x81')](db[_0xd535('0x70')][_0xd535('0x38')](_0x34084f));}return BPromise['all'](_0x4d5528);}})['then'](function(){return _0x518270;})[_0xd535('0x26')](respondWithResult(_0x3c920a,null))[_0xd535('0x4d')](handleError(_0x3c920a,null));};exports[_0xd535('0xbb')]=function(_0x392c2c,_0x3226d1,_0x262ec6){return db[_0xd535('0x35')][_0xd535('0x2f')]({'where':{'id':_0x392c2c['params']['id']}})['then'](handleEntityNotFound(_0x3226d1,null))[_0xd535('0x26')](function(_0x337f27){if(_0x337f27){return _0x337f27[_0xd535('0xbb')](_0x392c2c[_0xd535('0x38')][_0xd535('0x7c')]);}})[_0xd535('0x26')](function(_0x4e6986){if(_0x4e6986){return db[_0xd535('0x66')]['destroy']({'where':{'ListId':_0x392c2c[_0xd535('0x38')][_0xd535('0x7c')],'VoiceQueueId':_0x392c2c[_0xd535('0x58')]['id']}})[_0xd535('0x26')](function(){return _0x4e6986;});}})['then'](respondWithStatusCode(_0x3226d1,null))[_0xd535('0x4d')](handleError(_0x3226d1,null));}; \ No newline at end of file +var _0x62f1=['upsert','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','isNil','format','SIP/%s','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','isArray','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','phone','ContactId','ListId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','fromQuery','scheduledAt','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','value','find','type','name','sendStatus','stack','index','map','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','create','user','get','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','VoiceQueueId','CmHopper','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','forEach','each'];(function(_0x17e8cb,_0x1bd556){var _0x27c0d6=function(_0x45e939){while(--_0x45e939){_0x17e8cb['push'](_0x17e8cb['shift']());}};_0x27c0d6(++_0x1bd556);}(_0x62f1,0x112));var _0x162f=function(_0x1fd3e7,_0x133500){_0x1fd3e7=_0x1fd3e7-0x0;var _0x2a17ad=_0x62f1[_0x1fd3e7];return _0x2a17ad;};'use strict';var emlformat=require(_0x162f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x162f('0x1'));var jsonpatch=require(_0x162f('0x2'));var rp=require(_0x162f('0x3'));var moment=require(_0x162f('0x4'));var BPromise=require(_0x162f('0x5'));var Mustache=require(_0x162f('0x6'));var util=require(_0x162f('0x7'));var path=require(_0x162f('0x8'));var sox=require(_0x162f('0x9'));var csv=require(_0x162f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x162f('0xb'));var _=require(_0x162f('0xc'));var squel=require('squel');var crypto=require(_0x162f('0xd'));var jsforce=require(_0x162f('0xe'));var deskjs=require(_0x162f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x162f('0x10'));var Papa=require(_0x162f('0x11'));var Redis=require(_0x162f('0x12'));var authService=require(_0x162f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x162f('0x14'));var hardwareService=require(_0x162f('0x15'));var logger=require(_0x162f('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x162f('0x17'));var db=require('../../mysqldb')['db'];config[_0x162f('0x18')]=_[_0x162f('0x19')](config[_0x162f('0x18')],{'host':_0x162f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x162f('0x18')]));require(_0x162f('0x1b'))[_0x162f('0x1c')](socket);function respondWithStatusCode(_0x130db8,_0x567f37){_0x567f37=_0x567f37||0xcc;return function(_0x195085){if(_0x195085){return _0x130db8['sendStatus'](_0x567f37);}return _0x130db8[_0x162f('0x1d')](_0x567f37)[_0x162f('0x1e')]();};}function respondWithResult(_0x40a284,_0x8990f3){_0x8990f3=_0x8990f3||0xc8;return function(_0x55026b){if(_0x55026b){return _0x40a284['status'](_0x8990f3)[_0x162f('0x1f')](_0x55026b);}};}function respondWithFilteredResult(_0xa03e71,_0x413c63){return function(_0x1ee433){if(_0x1ee433){var _0x45f7ef=typeof _0x413c63[_0x162f('0x20')]===_0x162f('0x21')&&typeof _0x413c63['limit']===_0x162f('0x21');var _0x53ac47=_0x1ee433[_0x162f('0x22')];var _0x46df5e=_0x45f7ef?0x0:_0x413c63['offset'];var _0x26c05b=_0x45f7ef?_0x1ee433[_0x162f('0x22')]:_0x413c63['offset']+_0x413c63[_0x162f('0x23')];var _0x436a5a;if(_0x26c05b>=_0x53ac47){_0x26c05b=_0x53ac47;_0x436a5a=0xc8;}else{_0x436a5a=0xce;}_0xa03e71[_0x162f('0x1d')](_0x436a5a);return _0xa03e71[_0x162f('0x24')]('Content-Range',_0x46df5e+'-'+_0x26c05b+'/'+_0x53ac47)[_0x162f('0x1f')](_0x1ee433);}return null;};}function patchUpdates(_0x246aff){return function(_0x9e3f3c){try{jsonpatch[_0x162f('0x25')](_0x9e3f3c,_0x246aff,!![]);}catch(_0x422241){return BPromise[_0x162f('0x26')](_0x422241);}return _0x9e3f3c[_0x162f('0x27')]();};}function saveUpdates(_0x331d0d,_0x56fdda){return function(_0x352547){if(_0x352547){return _0x352547[_0x162f('0x28')](_0x331d0d)[_0x162f('0x29')](function(_0x16f5e2){return _0x16f5e2;});}return null;};}function removeEntity(_0x59482e,_0x2fc293){return function(_0x58af8a){if(_0x58af8a){return _0x58af8a[_0x162f('0x2a')]()['then'](function(){var _0x2cd181=_0x58af8a['get']({'plain':!![]});var _0x1414dd=[{'name':'VoiceQueues','value':_0x162f('0x2b'),'ignore':![]},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d'),'ignore':![]}];var _0x50fb25=_(_0x1414dd)['filter']('ignore')['map'](_0x162f('0x2e'))[_0x162f('0x2e')]();if(_['includes'](_0x50fb25,_0x2cd181['type'])){return;}var _0x59ccf0=_[_0x162f('0x2f')](_0x1414dd,['value',_0x2cd181[_0x162f('0x30')]])[_0x162f('0x31')];return db['UserProfileResource']['destroy']({'where':{'type':_0x59ccf0,'resourceId':_0x2cd181['id']}})[_0x162f('0x29')](function(){return _0x58af8a;});})[_0x162f('0x29')](function(){_0x59482e[_0x162f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313692,_0x37ffee){return function(_0x1dae7c){if(!_0x1dae7c){_0x313692[_0x162f('0x32')](0x194);}return _0x1dae7c;};}function handleError(_0x5a332a,_0x583302){_0x583302=_0x583302||0x1f4;return function(_0x2f5e77){logger['error'](_0x2f5e77[_0x162f('0x33')]);if(_0x2f5e77['name']){delete _0x2f5e77['name'];}_0x5a332a['status'](_0x583302)['send'](_0x2f5e77);};}exports[_0x162f('0x34')]=function(_0x39284d,_0x9d87a1){var _0x49444e={},_0x2f98aa={},_0x36b094={'count':0x0,'rows':[]};var _0x4e482e=_[_0x162f('0x35')](db[_0x162f('0x36')][_0x162f('0x37')],function(_0x47cb10){return{'name':_0x47cb10[_0x162f('0x38')],'type':_0x47cb10['type'][_0x162f('0x39')]};});_0x2f98aa['model']=_[_0x162f('0x35')](_0x4e482e,'name');_0x2f98aa[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x39284d['query']);_0x2f98aa[_0x162f('0x3c')]=_['intersection'](_0x2f98aa[_0x162f('0x3d')],_0x2f98aa[_0x162f('0x3a')]);_0x49444e['attributes']=_[_0x162f('0x3e')](_0x2f98aa['model'],qs[_0x162f('0x3f')](_0x39284d['query']['fields']));_0x49444e[_0x162f('0x40')]=_0x49444e[_0x162f('0x40')]['length']?_0x49444e[_0x162f('0x40')]:_0x2f98aa['model'];if(!_0x39284d['query'][_0x162f('0x41')](_0x162f('0x42'))){_0x49444e['limit']=qs[_0x162f('0x23')](_0x39284d[_0x162f('0x3a')][_0x162f('0x23')]);_0x49444e[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x39284d['query'][_0x162f('0x20')]);}_0x49444e[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x39284d[_0x162f('0x3a')]['sort']);_0x49444e[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x39284d[_0x162f('0x3a')],_0x2f98aa['filters']),_0x4e482e);if(_0x39284d[_0x162f('0x3a')][_0x162f('0x47')]){_0x49444e['where']=_[_0x162f('0x48')](_0x49444e[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x4e482e,function(_0xdc4eaa){if(_0xdc4eaa[_0x162f('0x30')]!==_0x162f('0x49')){var _0x3110be={};_0x3110be[_0xdc4eaa['name']]={'$like':'%'+_0x39284d[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x3110be;}})});}_0x49444e=_['merge']({},_0x49444e,_0x39284d[_0x162f('0x4a')]);var _0x250f08={'where':_0x49444e['where']};return db[_0x162f('0x36')][_0x162f('0x22')](_0x250f08)[_0x162f('0x29')](function(_0x1f8816){_0x36b094[_0x162f('0x22')]=_0x1f8816;if(_0x39284d[_0x162f('0x3a')][_0x162f('0x4b')]){_0x49444e[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x36')][_0x162f('0x4d')](_0x49444e);})[_0x162f('0x29')](function(_0x18900b){_0x36b094[_0x162f('0x4e')]=_0x18900b;return _0x36b094;})[_0x162f('0x29')](respondWithFilteredResult(_0x9d87a1,_0x49444e))['catch'](handleError(_0x9d87a1,null));};exports[_0x162f('0x4f')]=function(_0x1c90dd,_0x5d23cb){var _0x518fa6={'raw':![],'where':{'id':_0x1c90dd['params']['id']}},_0x428282={};_0x428282[_0x162f('0x3d')]=_['keys'](db[_0x162f('0x36')]['rawAttributes']);_0x428282[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x1c90dd[_0x162f('0x3a')]);_0x428282[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x428282[_0x162f('0x3d')],_0x428282[_0x162f('0x3a')]);_0x518fa6[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x428282['model'],qs[_0x162f('0x3f')](_0x1c90dd[_0x162f('0x3a')]['fields']));_0x518fa6[_0x162f('0x40')]=_0x518fa6[_0x162f('0x40')][_0x162f('0x50')]?_0x518fa6[_0x162f('0x40')]:_0x428282[_0x162f('0x3d')];if(_0x1c90dd['query'][_0x162f('0x4b')]){_0x518fa6[_0x162f('0x4c')]=[{'all':!![]}];}_0x518fa6=_[_0x162f('0x48')]({},_0x518fa6,_0x1c90dd[_0x162f('0x4a')]);return db[_0x162f('0x36')]['find'](_0x518fa6)['then'](handleEntityNotFound(_0x5d23cb,null))[_0x162f('0x29')](respondWithResult(_0x5d23cb,null))['catch'](handleError(_0x5d23cb,null));};exports[_0x162f('0x51')]=function(_0xefabbd,_0x481f57){return db[_0x162f('0x36')][_0x162f('0x51')](_0xefabbd['body'],{})[_0x162f('0x29')](function(_0x289306){var _0x6ac709=_0xefabbd[_0x162f('0x52')][_0x162f('0x53')]({'plain':!![]});if(!_0x6ac709)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6ac709[_0x162f('0x54')]==='user'){var _0x304788=_0x289306['get']({'plain':!![]});var _0x52877c=[{'name':_0x162f('0x55'),'value':_0x162f('0x2b')},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d')}];var _0x58e1a6=_['find'](_0x52877c,[_0x162f('0x2e'),_0x304788[_0x162f('0x30')]])[_0x162f('0x31')];return db[_0x162f('0x56')][_0x162f('0x2f')]({'where':{'name':_0x58e1a6,'userProfileId':_0x6ac709[_0x162f('0x57')]},'raw':!![]})[_0x162f('0x29')](function(_0x3755d7){if(_0x3755d7&&_0x3755d7[_0x162f('0x58')]===0x0){return db[_0x162f('0x59')][_0x162f('0x51')]({'name':_0x304788[_0x162f('0x31')],'resourceId':_0x304788['id'],'type':_0x3755d7['name'],'sectionId':_0x3755d7['id']},{})[_0x162f('0x29')](function(){return _0x289306;});}else{return _0x289306;}})[_0x162f('0x5a')](function(_0x25d903){logger[_0x162f('0x5b')](_0x162f('0x5c'),_0x25d903);throw _0x25d903;});}return _0x289306;})['then'](respondWithResult(_0x481f57,0xc9))[_0x162f('0x5a')](handleError(_0x481f57,null));};exports[_0x162f('0x5d')]=function(_0x587e68,_0x3aa7a9){var _0x2ff24c={'where':{'id':_0x587e68[_0x162f('0x5e')]['id']}},_0x147561={};_0x147561[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x36')][_0x162f('0x37')]);_0x2ff24c['attributes']=_['intersection'](_0x147561[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x587e68['query'][_0x162f('0x3f')]));_0x2ff24c[_0x162f('0x40')]=_0x2ff24c['attributes'][_0x162f('0x50')]?_0x2ff24c['attributes']:_0x147561[_0x162f('0x3d')];if(_0x587e68[_0x162f('0x3a')][_0x162f('0x4b')]){_0x2ff24c[_0x162f('0x4c')]=[{'all':!![]}];}_0x2ff24c=_[_0x162f('0x48')]({},_0x2ff24c,_0x587e68[_0x162f('0x4a')]);return db['VoiceQueue']['find'](_0x2ff24c)[_0x162f('0x29')](handleEntityNotFound(_0x3aa7a9,null))[_0x162f('0x29')](function(_0x16b9f0){if(_0x16b9f0){var _0x3118ff=_0x16b9f0[_0x162f('0x53')]({'plain':!![]});_0x3118ff=qs[_0x162f('0x5f')](_0x3118ff,['id',_0x162f('0x60'),'updatedAt']);_0x587e68[_0x162f('0x61')]=_[_0x162f('0x5f')](_0x587e68[_0x162f('0x61')],['id','createdAt',_0x162f('0x62')]);return db[_0x162f('0x36')][_0x162f('0x51')](_[_0x162f('0x48')](_0x3118ff,_0x587e68[_0x162f('0x61')]),{'include':_0x587e68[_0x162f('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x162f('0x29')](function(_0x3cea4a){var _0xfffd7a=_0x587e68[_0x162f('0x52')][_0x162f('0x53')]({'plain':!![]});if(!_0xfffd7a)throw new Error(_0x162f('0x63'));if(_0xfffd7a[_0x162f('0x54')]==='user'){var _0x34bb82=_0x3cea4a[_0x162f('0x53')]({'plain':!![]});var _0xf238e1=[{'name':_0x162f('0x55'),'value':'inbound'},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d')}];var _0x363cf2=_[_0x162f('0x2f')](_0xf238e1,[_0x162f('0x2e'),_0x34bb82[_0x162f('0x30')]])['name'];return db[_0x162f('0x56')]['find']({'where':{'name':_0x363cf2,'userProfileId':_0xfffd7a[_0x162f('0x57')]},'raw':!![]})[_0x162f('0x29')](function(_0x281d0d){if(_0x281d0d&&_0x281d0d['autoAssociation']===0x0){return db[_0x162f('0x59')][_0x162f('0x51')]({'name':_0x34bb82['name'],'resourceId':_0x34bb82['id'],'type':_0x281d0d[_0x162f('0x31')],'sectionId':_0x281d0d['id']},{})[_0x162f('0x29')](function(){return _0x3cea4a;});}else{return _0x3cea4a;}})[_0x162f('0x5a')](function(_0x5e4538){logger[_0x162f('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e4538);throw _0x5e4538;});}return _0x3cea4a;});}})[_0x162f('0x29')](respondWithResult(_0x3aa7a9,0xc9))[_0x162f('0x5a')](handleError(_0x3aa7a9,null));};exports[_0x162f('0x28')]=function(_0x40cf13,_0xb2c3b3){if(_0x40cf13['body']['id']){delete _0x40cf13[_0x162f('0x61')]['id'];}return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x40cf13['params']['id']}})['then'](handleEntityNotFound(_0xb2c3b3,null))[_0x162f('0x29')](saveUpdates(_0x40cf13[_0x162f('0x61')],null))[_0x162f('0x29')](respondWithResult(_0xb2c3b3,null))['catch'](handleError(_0xb2c3b3,null));};exports[_0x162f('0x2a')]=function(_0x216064,_0x315c5f){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x216064[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x315c5f,null))[_0x162f('0x29')](removeEntity(_0x315c5f,null))['catch'](handleError(_0x315c5f,null));};exports[_0x162f('0x64')]=function(_0x4a1351,_0x403bd5,_0x2be358){var _0x1cd6cb={'raw':![],'where':{}};var _0x33c3fd={};var _0xab20f8={'count':0x0,'rows':[]};return db[_0x162f('0x36')]['findOne']({'where':{'id':_0x4a1351[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x403bd5,null))[_0x162f('0x29')](function(_0x50ae48){if(_0x50ae48){_0x33c3fd[_0x162f('0x3d')]=_['keys'](db['CmHopper']['rawAttributes']);_0x33c3fd[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x4a1351[_0x162f('0x3a')]);_0x33c3fd['filters']=_[_0x162f('0x3e')](_0x33c3fd[_0x162f('0x3d')],_0x33c3fd['query']);_0x1cd6cb[_0x162f('0x40')]=_['intersection'](_0x33c3fd[_0x162f('0x3d')],qs['fields'](_0x4a1351[_0x162f('0x3a')]['fields']));_0x1cd6cb['attributes']=_0x1cd6cb[_0x162f('0x40')][_0x162f('0x50')]?_0x1cd6cb[_0x162f('0x40')]:_0x33c3fd['model'];if(!_0x4a1351[_0x162f('0x3a')][_0x162f('0x41')]('nolimit')){_0x1cd6cb[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x4a1351['query'][_0x162f('0x23')]);_0x1cd6cb[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x4a1351[_0x162f('0x3a')][_0x162f('0x20')]);}_0x1cd6cb[_0x162f('0x43')]=qs['sort'](_0x4a1351[_0x162f('0x3a')][_0x162f('0x44')]);_0x1cd6cb[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x4a1351[_0x162f('0x3a')],_0x33c3fd[_0x162f('0x3c')]));_0x1cd6cb[_0x162f('0x45')][_0x162f('0x65')]=_0x50ae48['id'];if(_0x4a1351[_0x162f('0x3a')][_0x162f('0x47')]){_0x1cd6cb[_0x162f('0x45')]=_[_0x162f('0x48')](_0x1cd6cb[_0x162f('0x45')],{'$or':_['map'](_0x1cd6cb[_0x162f('0x40')],function(_0x8bae9d){var _0x555546={};_0x555546[_0x8bae9d]={'$like':'%'+_0x4a1351[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x555546;})});}_0x1cd6cb=_[_0x162f('0x48')]({},_0x1cd6cb,_0x4a1351[_0x162f('0x4a')]);return db[_0x162f('0x66')][_0x162f('0x22')]({'where':_0x1cd6cb[_0x162f('0x45')]})[_0x162f('0x29')](function(_0x13017c){_0xab20f8['count']=_0x13017c;if(_0x4a1351['query'][_0x162f('0x4b')]){_0x1cd6cb[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x66')][_0x162f('0x4d')](_0x1cd6cb);})['then'](function(_0x4bd0fd){_0xab20f8['rows']=_0x4bd0fd;return _0xab20f8;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x403bd5,_0x1cd6cb))[_0x162f('0x5a')](handleError(_0x403bd5,null));};exports['getHopperHistories']=function(_0x1d5cc5,_0x1b7107,_0x319282){var _0x3ce0be={'raw':!![],'where':{}};var _0x161fc8={};var _0x235d3c={'count':0x0,'rows':[]};return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x1d5cc5['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x1b7107,null))['then'](function(_0x41e3d8){if(_0x41e3d8){_0x161fc8[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x68')][_0x162f('0x37')]);_0x161fc8[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x1d5cc5[_0x162f('0x3a')]);_0x161fc8[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x161fc8['model'],_0x161fc8[_0x162f('0x3a')]);_0x3ce0be['attributes']=_['intersection'](_0x161fc8['model'],qs[_0x162f('0x3f')](_0x1d5cc5['query'][_0x162f('0x3f')]));_0x3ce0be[_0x162f('0x40')]=_0x3ce0be[_0x162f('0x40')][_0x162f('0x50')]?_0x3ce0be[_0x162f('0x40')]:_0x161fc8[_0x162f('0x3d')];if(!_0x1d5cc5[_0x162f('0x3a')]['hasOwnProperty'](_0x162f('0x42'))){_0x3ce0be[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x1d5cc5[_0x162f('0x3a')]['limit']);_0x3ce0be[_0x162f('0x20')]=qs['offset'](_0x1d5cc5[_0x162f('0x3a')][_0x162f('0x20')]);}_0x3ce0be[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x1d5cc5['query'][_0x162f('0x44')]);_0x3ce0be[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x1d5cc5[_0x162f('0x3a')],_0x161fc8[_0x162f('0x3c')]));_0x3ce0be[_0x162f('0x45')][_0x162f('0x65')]=_0x41e3d8['id'];if(_0x1d5cc5['query'][_0x162f('0x47')]){_0x3ce0be[_0x162f('0x45')]=_['merge'](_0x3ce0be['where'],{'$or':_['map'](_0x3ce0be[_0x162f('0x40')],function(_0x53fa1e){var _0x45ce5e={};_0x45ce5e[_0x53fa1e]={'$like':'%'+_0x1d5cc5['query']['filter']+'%'};return _0x45ce5e;})});}_0x3ce0be=_['merge']({},_0x3ce0be,_0x1d5cc5['options']);return db[_0x162f('0x68')][_0x162f('0x22')]({'where':_0x3ce0be[_0x162f('0x45')]})['then'](function(_0x47200d){_0x235d3c[_0x162f('0x22')]=_0x47200d;if(_0x1d5cc5[_0x162f('0x3a')][_0x162f('0x4b')]){_0x3ce0be['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x162f('0x4d')](_0x3ce0be);})[_0x162f('0x29')](function(_0x56699b){_0x235d3c['rows']=_0x56699b;return _0x235d3c;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x1b7107,_0x3ce0be))[_0x162f('0x5a')](handleError(_0x1b7107,null));};exports[_0x162f('0x69')]=function(_0x9d5a42,_0x3b58f3,_0x5abf0f){var _0x3bf73b={'raw':!![],'where':{}};var _0x39d952={};var _0x273554={'count':0x0,'rows':[]};return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x9d5a42[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3b58f3,null))[_0x162f('0x29')](function(_0x3ed8d2){if(_0x3ed8d2){_0x39d952['model']=_[_0x162f('0x3b')](db[_0x162f('0x6a')]['rawAttributes']);_0x39d952['query']=_[_0x162f('0x3b')](_0x9d5a42['query']);_0x39d952[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x39d952[_0x162f('0x3d')],_0x39d952[_0x162f('0x3a')]);_0x3bf73b[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x39d952[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x9d5a42[_0x162f('0x3a')]['fields']));_0x3bf73b[_0x162f('0x40')]=_0x3bf73b['attributes'][_0x162f('0x50')]?_0x3bf73b[_0x162f('0x40')]:_0x39d952['model'];if(!_0x9d5a42[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0x3bf73b[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x23')]);_0x3bf73b[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x20')]);}_0x3bf73b['order']=qs[_0x162f('0x44')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x44')]);_0x3bf73b[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x9d5a42[_0x162f('0x3a')],_0x39d952[_0x162f('0x3c')]));_0x3bf73b[_0x162f('0x45')][_0x162f('0x65')]=_0x3ed8d2['id'];if(_0x9d5a42[_0x162f('0x3a')][_0x162f('0x47')]){_0x3bf73b['where']=_[_0x162f('0x48')](_0x3bf73b[_0x162f('0x45')],{'$or':_['map'](_0x3bf73b[_0x162f('0x40')],function(_0x394f2b){var _0x271ad3={};_0x271ad3[_0x394f2b]={'$like':'%'+_0x9d5a42[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x271ad3;})});}_0x3bf73b=_[_0x162f('0x48')]({},_0x3bf73b,_0x9d5a42[_0x162f('0x4a')]);return db[_0x162f('0x6a')][_0x162f('0x22')]({'where':_0x3bf73b[_0x162f('0x45')]})[_0x162f('0x29')](function(_0x3308aa){_0x273554[_0x162f('0x22')]=_0x3308aa;if(_0x9d5a42[_0x162f('0x3a')][_0x162f('0x4b')]){_0x3bf73b['include']=[{'all':!![]}];}return db[_0x162f('0x6a')][_0x162f('0x4d')](_0x3bf73b);})[_0x162f('0x29')](function(_0x482b10){_0x273554['rows']=_0x482b10;return _0x273554;});}})['then'](respondWithFilteredResult(_0x3b58f3,_0x3bf73b))[_0x162f('0x5a')](handleError(_0x3b58f3,null));};exports[_0x162f('0x6b')]=function(_0x167605,_0x38eabc,_0x273112){var _0xa426dd={'raw':!![],'where':{}};var _0xa88e8={};var _0x3f01b9={'count':0x0,'rows':[]};return db[_0x162f('0x36')]['findOne']({'where':{'id':_0x167605[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x38eabc,null))[_0x162f('0x29')](function(_0x6d6f3b){if(_0x6d6f3b){_0xa88e8['model']=_[_0x162f('0x3b')](db[_0x162f('0x6c')][_0x162f('0x37')]);_0xa88e8[_0x162f('0x3a')]=_['keys'](_0x167605[_0x162f('0x3a')]);_0xa88e8['filters']=_['intersection'](_0xa88e8['model'],_0xa88e8[_0x162f('0x3a')]);_0xa426dd[_0x162f('0x40')]=_[_0x162f('0x3e')](_0xa88e8[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x167605[_0x162f('0x3a')][_0x162f('0x3f')]));_0xa426dd[_0x162f('0x40')]=_0xa426dd['attributes']['length']?_0xa426dd[_0x162f('0x40')]:_0xa88e8['model'];if(!_0x167605[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0xa426dd[_0x162f('0x23')]=qs['limit'](_0x167605[_0x162f('0x3a')][_0x162f('0x23')]);_0xa426dd[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x167605[_0x162f('0x3a')][_0x162f('0x20')]);}_0xa426dd[_0x162f('0x43')]=qs['sort'](_0x167605[_0x162f('0x3a')][_0x162f('0x44')]);_0xa426dd['where']=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x167605[_0x162f('0x3a')],_0xa88e8[_0x162f('0x3c')]));_0xa426dd[_0x162f('0x45')][_0x162f('0x65')]=_0x6d6f3b['id'];if(_0x167605[_0x162f('0x3a')][_0x162f('0x47')]){_0xa426dd[_0x162f('0x45')]=_[_0x162f('0x48')](_0xa426dd[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0xa426dd[_0x162f('0x40')],function(_0x475547){var _0x1057ca={};_0x1057ca[_0x475547]={'$like':'%'+_0x167605['query']['filter']+'%'};return _0x1057ca;})});}_0xa426dd=_[_0x162f('0x48')]({},_0xa426dd,_0x167605[_0x162f('0x4a')]);return db[_0x162f('0x6c')][_0x162f('0x22')]({'where':_0xa426dd['where']})['then'](function(_0x35dc2d){_0x3f01b9[_0x162f('0x22')]=_0x35dc2d;if(_0x167605[_0x162f('0x3a')][_0x162f('0x4b')]){_0xa426dd[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x6c')]['findAll'](_0xa426dd);})[_0x162f('0x29')](function(_0x4b4e49){_0x3f01b9[_0x162f('0x4e')]=_0x4b4e49;return _0x3f01b9;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x38eabc,_0xa426dd))[_0x162f('0x5a')](handleError(_0x38eabc,null));};exports[_0x162f('0x6d')]=function(_0x50d1c0,_0x307357,_0x4160d4){var _0x11b134={};var _0x317692={};var _0x2b44fb;var _0x3ea2b0;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x50d1c0[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x307357,null))[_0x162f('0x29')](function(_0x276b20){if(_0x276b20){_0x2b44fb=_0x276b20;_0x317692[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x6e')][_0x162f('0x37')]);_0x317692[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x50d1c0[_0x162f('0x3a')]);_0x317692[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x317692[_0x162f('0x3d')],_0x317692[_0x162f('0x3a')]);_0x11b134[_0x162f('0x40')]=_['intersection'](_0x317692[_0x162f('0x3d')],qs['fields'](_0x50d1c0[_0x162f('0x3a')][_0x162f('0x3f')]));_0x11b134['attributes']=_0x11b134[_0x162f('0x40')][_0x162f('0x50')]?_0x11b134[_0x162f('0x40')]:_0x317692[_0x162f('0x3d')];_0x11b134['order']=qs[_0x162f('0x44')](_0x50d1c0['query']['sort']);_0x11b134[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x50d1c0[_0x162f('0x3a')],_0x317692[_0x162f('0x3c')]));if(_0x50d1c0[_0x162f('0x3a')][_0x162f('0x47')]){_0x11b134[_0x162f('0x45')]=_['merge'](_0x11b134['where'],{'$or':_[_0x162f('0x35')](_0x11b134[_0x162f('0x40')],function(_0xa5ed85){var _0x130764={};_0x130764[_0xa5ed85]={'$like':'%'+_0x50d1c0[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x130764;})});}_0x11b134=_[_0x162f('0x48')]({},_0x11b134,_0x50d1c0['options']);return _0x2b44fb[_0x162f('0x6d')](_0x11b134);}})['then'](function(_0x24af06){if(_0x24af06){_0x3ea2b0=_0x24af06[_0x162f('0x50')];if(!_0x50d1c0['query'][_0x162f('0x41')]('nolimit')){_0x11b134['limit']=qs[_0x162f('0x23')](_0x50d1c0[_0x162f('0x3a')]['limit']);_0x11b134[_0x162f('0x20')]=qs['offset'](_0x50d1c0[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x2b44fb[_0x162f('0x6d')](_0x11b134);}})[_0x162f('0x29')](function(_0x419564){if(_0x419564){return _0x419564?{'count':_0x3ea2b0,'rows':_0x419564}:null;}})[_0x162f('0x29')](respondWithResult(_0x307357,null))[_0x162f('0x5a')](handleError(_0x307357,null));};exports[_0x162f('0x6f')]=function(_0xf90dd4,_0x3ee636,_0x86a39b){var _0x23ccc4=_0xf90dd4[_0x162f('0x61')][_0x162f('0x70')];var _0x7f992=_[_0x162f('0x35')](_0x23ccc4,'id');return db[_0x162f('0x6e')]['findAll']({'where':{'id':_0x7f992},'attributes':['id'],'include':[{'model':db[_0x162f('0x71')],'as':_0x162f('0x72'),'attributes':['id',_0x162f('0x31'),_0x162f('0x73'),_0x162f('0x74'),_0x162f('0x75')],'raw':!![]}]})[_0x162f('0x29')](function(_0x43d7fb){if(_0x43d7fb){var _0x3240c7=_['flatMap'](_0x43d7fb,function(_0x4ce7d4){var _0x2191e4=_0x4ce7d4[_0x162f('0x53')]({'plain':!![]});_0x2191e4[_0x162f('0x72')][_0x162f('0x76')](function(_0x521087){_0x521087['penalty']=_['find'](_0x23ccc4,{'id':_0x2191e4['id']})['penalty'];});return _0x2191e4['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0xf90dd4[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(_0xfe352b){return db['sequelize']['transaction'](function(_0x2a6e42){return _0xfe352b[_0x162f('0x6f')](_0x7f992,{'transaction':_0x2a6e42})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_0x23ccc4,function(_0x12c46a){return db['TeamVoiceQueue'][_0x162f('0x78')]({'TeamId':_0x12c46a['id'],'VoiceQueueId':_0xf90dd4[_0x162f('0x5e')]['id'],'penalty':_0x12c46a['penalty']},{'transaction':_0x2a6e42});});})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_0x3240c7,function(_0x4a1aff){return db[_0x162f('0x79')][_0x162f('0x7a')]({'where':{'UserId':_0x4a1aff['id'],'VoiceQueueId':_0xf90dd4[_0x162f('0x5e')]['id']},'defaults':{'penalty':_0x4a1aff[_0x162f('0x7b')]},'transaction':_0x2a6e42});});})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_[_0x162f('0x47')](_0x3240c7,{'online':!![]}),function(_0xdc6e46){return db[_0x162f('0x7c')][_0x162f('0x78')]({'membername':_0xdc6e46['name'],'UserId':_0xdc6e46['id'],'queue_name':_0xfe352b[_0x162f('0x31')],'VoiceQueueId':_0xfe352b['id'],'interface':_[_0x162f('0x7d')](_0xdc6e46[_0x162f('0x75')])?util[_0x162f('0x7e')](_0x162f('0x7f'),_0xdc6e46[_0x162f('0x31')]):_0xdc6e46[_0x162f('0x75')],'paused':_0xdc6e46[_0x162f('0x74')]||![],'penalty':_0xdc6e46[_0x162f('0x7b')]},{'transaction':_0x2a6e42});});})['then'](function(){_0x3240c7[_0x162f('0x76')](function(_0x3cf46e){socket['emit']('userVoiceQueue:save',{'UserId':_0x3cf46e['id'],'VoiceQueueId':_0xfe352b['id']});});});});});}})[_0x162f('0x29')](respondWithStatusCode(_0x3ee636,null))[_0x162f('0x5a')](handleError(_0x3ee636,null));};exports['removeTeams']=function(_0x1f7f8f,_0xf1374a,_0x424fd5){return db['Team'][_0x162f('0x4d')]({'where':{'id':_0x1f7f8f[_0x162f('0x3a')][_0x162f('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x162f('0x72'),'attributes':['id'],'raw':!![]}]})[_0x162f('0x29')](handleEntityNotFound(_0xf1374a,null))[_0x162f('0x29')](function(_0x285023){var _0x3f69e2=_['map'](_0x285023,'id');var _0x4358c9=[];var _0xaa28ed=[];var _0x252c97=squel[_0x162f('0x81')]();_0x252c97[_0x162f('0x82')]('tq.TeamId')[_0x162f('0x83')](_0x162f('0x84'),'tq')[_0x162f('0x85')](_0x162f('0x86'),'ut',_0x162f('0x87'))[_0x162f('0x45')]('VoiceQueueId\x20=\x20?',_0x1f7f8f['params']['id']);for(var _0xeebb4e=0x0;_0xeebb4e<_0x285023['length'];_0xeebb4e+=0x1){let _0x57766f=_0x285023[_0xeebb4e];for(var _0x121091=0x0;_0x121091<_0x57766f[_0x162f('0x72')][_0x162f('0x50')];_0x121091+=0x1){let _0x4c1ef1=_0x57766f[_0x162f('0x72')][_0x121091];var _0x51e4e3=_0x252c97[_0x162f('0x5d')]();_0x51e4e3[_0x162f('0x45')](_0x162f('0x88'),_0x4c1ef1['id']);_0xaa28ed[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x51e4e3['toString'](),{'type':db[_0x162f('0x8a')]['QueryTypes'][_0x162f('0x8b')]})[_0x162f('0x29')](function(_0x1e05a5){if(_0x1e05a5['length']===0x1){return _0x4c1ef1['id'];}else{var _0x1f98ad=_[_0x162f('0x8c')](_[_0x162f('0x35')](_0x1e05a5,_0x162f('0x8d')),function(_0x5bc32c){return _[_0x162f('0x8e')](_0x3f69e2,_0x5bc32c);});if(_0x1f98ad){return _0x4c1ef1['id'];}}}));}}return BPromise[_0x162f('0x8f')](_0xaa28ed)[_0x162f('0x29')](function(_0x21766b){_0x4358c9=_(_0x4358c9)[_0x162f('0x90')](_0x21766b)[_0x162f('0x91')]()[_0x162f('0x2e')]();return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x1f7f8f['params']['id']}})['then'](function(_0x46a768){return db[_0x162f('0x8a')][_0x162f('0x92')](function(_0x509940){return _0x46a768[_0x162f('0x93')](_0x1f7f8f[_0x162f('0x3a')]['ids'],{'transaction':_0x509940})['then'](function(){if(!_[_0x162f('0x94')](_0x4358c9)){return _0x46a768[_0x162f('0x95')](_0x4358c9,{'transaction':_0x509940})[_0x162f('0x29')](function(){return db[_0x162f('0x7c')][_0x162f('0x2a')]({'where':{'VoiceQueueId':_0x1f7f8f[_0x162f('0x5e')]['id'],'UserId':_0x4358c9},'transaction':_0x509940});});}})[_0x162f('0x29')](function(){_0x4358c9[_0x162f('0x76')](function(_0x277345){socket['emit'](_0x162f('0x96'),{'UserId':_0x277345,'VoiceQueueId':_0x46a768['id']});});});});});});})[_0x162f('0x29')](respondWithStatusCode(_0xf1374a,null))['catch'](handleError(_0xf1374a,null));};exports[_0x162f('0x97')]=function(_0x56ec2d,_0x36b49f,_0x5ecf68){var _0x305df8,_0x2b3408;return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x56ec2d[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x36b49f,null))[_0x162f('0x29')](function(_0x25161a){if(_0x25161a){_0x2b3408=_0x25161a;return _0x25161a['addAgents'](_0x56ec2d[_0x162f('0x61')]['ids'],_[_0x162f('0x5f')](_0x56ec2d[_0x162f('0x61')],[_0x162f('0x80'),'id'])||{})[_0x162f('0x98')](function(_0x3bd2d3){for(var _0x35fe73=0x0;_0x35fe73<_0x56ec2d['body'][_0x162f('0x80')]['length'];_0x35fe73+=0x1){socket[_0x162f('0x99')](_0x162f('0x9a'),{'UserId':Number(_0x56ec2d[_0x162f('0x61')][_0x162f('0x80')][_0x35fe73]),'VoiceQueueId':Number(_0x56ec2d[_0x162f('0x5e')]['id'])});}return _0x3bd2d3;});}})[_0x162f('0x29')](function(_0x430e1b){_0x305df8=_0x430e1b||[];if(_0x2b3408){return db[_0x162f('0x71')][_0x162f('0x4d')]({'where':{'id':_0x56ec2d[_0x162f('0x61')]['ids']},'attributes':['id','name',_0x162f('0x73'),'voicePause',_0x162f('0x75')],'raw':!![]});}})['then'](function(_0x4428a6){if(!_[_0x162f('0x94')](_0x4428a6)){var _0x2f0610=[];for(var _0x4fb266=0x0;_0x4fb266<_0x4428a6[_0x162f('0x50')];_0x4fb266++){if(_0x4428a6[_0x4fb266][_0x162f('0x73')]){_0x2f0610[_0x162f('0x89')](db[_0x162f('0x7c')]['upsert']({'membername':_0x4428a6[_0x4fb266]['name'],'UserId':_0x4428a6[_0x4fb266]['id'],'queue_name':_0x2b3408[_0x162f('0x31')],'VoiceQueueId':_0x2b3408['id'],'interface':_[_0x162f('0x7d')](_0x4428a6[_0x4fb266][_0x162f('0x75')])?util[_0x162f('0x7e')](_0x162f('0x7f'),_0x4428a6[_0x4fb266][_0x162f('0x31')]):_0x4428a6[_0x4fb266][_0x162f('0x75')],'paused':_0x4428a6[_0x4fb266][_0x162f('0x74')]||![],'penalty':_0x56ec2d[_0x162f('0x61')][_0x162f('0x7b')]||0x0}));}}return BPromise[_0x162f('0x8f')](_0x2f0610);}})['then'](function(){return _0x305df8;})[_0x162f('0x29')](respondWithResult(_0x36b49f,null))['catch'](handleError(_0x36b49f,null));};exports['removeAgents']=function(_0x4a7d99,_0x5c26f2,_0x414b8f){return db[_0x162f('0x36')]['find']({'where':{'id':_0x4a7d99[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x5c26f2,null))[_0x162f('0x29')](function(_0x1f6c41){if(_0x1f6c41){return _0x1f6c41[_0x162f('0x95')](_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')])['then'](function(){if(_[_0x162f('0x9b')](_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')])){for(var _0x5552ff=0x0;_0x5552ff<_0x4a7d99['query'][_0x162f('0x80')][_0x162f('0x50')];_0x5552ff+=0x1){socket[_0x162f('0x99')](_0x162f('0x96'),{'UserId':Number(_0x4a7d99[_0x162f('0x3a')]['ids'][_0x5552ff]),'VoiceQueueId':Number(_0x4a7d99[_0x162f('0x5e')]['id'])});}}else{socket[_0x162f('0x99')](_0x162f('0x96'),{'UserId':Number(_0x4a7d99['query']['ids']),'VoiceQueueId':Number(_0x4a7d99['params']['id'])});}});}})[_0x162f('0x29')](function(_0x544ed8){return db[_0x162f('0x7c')][_0x162f('0x2a')]({'where':{'VoiceQueueId':_0x4a7d99[_0x162f('0x5e')]['id'],'UserId':_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')]}})[_0x162f('0x29')](function(){return _0x544ed8;});})[_0x162f('0x29')](respondWithStatusCode(_0x5c26f2,null))[_0x162f('0x5a')](handleError(_0x5c26f2,null));};exports[_0x162f('0x9c')]=function(_0x1e2053,_0x4e6db9,_0x3e6590){var _0x28fd51={};var _0x39308a={};var _0x4c9db0;var _0x3fc387;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x1e2053[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4e6db9,null))['then'](function(_0x6c166){if(_0x6c166){_0x4c9db0=_0x6c166;_0x39308a['model']=_['keys'](db[_0x162f('0x71')][_0x162f('0x37')]);_0x39308a['query']=_[_0x162f('0x3b')](_0x1e2053[_0x162f('0x3a')]);_0x39308a['filters']=_[_0x162f('0x3e')](_0x39308a[_0x162f('0x3d')],_0x39308a[_0x162f('0x3a')]);_0x28fd51['attributes']=_['intersection'](_0x39308a[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x1e2053[_0x162f('0x3a')][_0x162f('0x3f')]));_0x28fd51[_0x162f('0x40')]=_0x28fd51[_0x162f('0x40')][_0x162f('0x50')]?_0x28fd51[_0x162f('0x40')]:_0x39308a['model'];_0x28fd51[_0x162f('0x43')]=qs['sort'](_0x1e2053[_0x162f('0x3a')][_0x162f('0x44')]);_0x28fd51[_0x162f('0x45')]=qs['filters'](_[_0x162f('0x46')](_0x1e2053[_0x162f('0x3a')],_0x39308a['filters']));if(_0x1e2053['query'][_0x162f('0x47')]){_0x28fd51[_0x162f('0x45')]=_[_0x162f('0x48')](_0x28fd51[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x28fd51[_0x162f('0x40')],function(_0xe3b537){var _0x5ae33d={};_0x5ae33d[_0xe3b537]={'$like':'%'+_0x1e2053[_0x162f('0x3a')]['filter']+'%'};return _0x5ae33d;})});}_0x28fd51=_[_0x162f('0x48')]({},_0x28fd51,_0x1e2053[_0x162f('0x4a')]);return _0x4c9db0[_0x162f('0x9c')](_0x28fd51);}})['then'](function(_0x4641a5){if(_0x4641a5){_0x3fc387=_0x4641a5[_0x162f('0x50')];if(!_0x1e2053[_0x162f('0x3a')][_0x162f('0x41')]('nolimit')){_0x28fd51[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x1e2053[_0x162f('0x3a')][_0x162f('0x23')]);_0x28fd51[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x1e2053['query'][_0x162f('0x20')]);}return _0x4c9db0['getAgents'](_0x28fd51);}})[_0x162f('0x29')](function(_0x558cdf){if(_0x558cdf){return _0x558cdf?{'count':_0x3fc387,'rows':_0x558cdf}:null;}})[_0x162f('0x29')](respondWithResult(_0x4e6db9,null))['catch'](handleError(_0x4e6db9,null));};exports[_0x162f('0x9d')]=function(_0x32eb18,_0x5788b3,_0x51664f){var _0x258ff5={};var _0xa1ff32={};var _0x5ce9b0;var _0x11be64;return db['VoiceQueue']['findOne']({'where':{'id':_0x32eb18[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x5788b3,null))[_0x162f('0x29')](function(_0x446eb9){if(_0x446eb9){_0x5ce9b0=_0x446eb9;_0xa1ff32[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x7c')][_0x162f('0x37')]);_0xa1ff32['query']=_['keys'](_0x32eb18[_0x162f('0x3a')]);_0xa1ff32[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0xa1ff32[_0x162f('0x3d')],_0xa1ff32[_0x162f('0x3a')]);_0x258ff5['attributes']=_[_0x162f('0x3e')](_0xa1ff32[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x32eb18[_0x162f('0x3a')][_0x162f('0x3f')]));_0x258ff5[_0x162f('0x40')]=_0x258ff5['attributes'][_0x162f('0x50')]?_0x258ff5[_0x162f('0x40')]:_0xa1ff32[_0x162f('0x3d')];_0x258ff5[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x32eb18['query']['sort']);_0x258ff5[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x32eb18[_0x162f('0x3a')],_0xa1ff32['filters']));if(_0x32eb18['query']['filter']){_0x258ff5[_0x162f('0x45')]=_[_0x162f('0x48')](_0x258ff5['where'],{'$or':_['map'](_0x258ff5[_0x162f('0x40')],function(_0x1236f5){var _0x1d43f3={};_0x1d43f3[_0x1236f5]={'$like':'%'+_0x32eb18[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x1d43f3;})});}_0x258ff5=_[_0x162f('0x48')]({},_0x258ff5,_0x32eb18[_0x162f('0x4a')]);return _0x5ce9b0[_0x162f('0x9d')](_0x258ff5);}})[_0x162f('0x29')](function(_0x319876){if(_0x319876){_0x11be64=_0x319876[_0x162f('0x50')];if(!_0x32eb18[_0x162f('0x3a')]['hasOwnProperty'](_0x162f('0x42'))){_0x258ff5[_0x162f('0x23')]=qs['limit'](_0x32eb18['query'][_0x162f('0x23')]);_0x258ff5[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x32eb18[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x5ce9b0['getMembers'](_0x258ff5);}})[_0x162f('0x29')](function(_0x4d7722){return _0x4d7722?{'count':_0x11be64,'rows':_0x4d7722}:null;})[_0x162f('0x29')](respondWithResult(_0x5788b3,null))[_0x162f('0x5a')](handleError(_0x5788b3,null));};exports[_0x162f('0x9e')]=function(_0x2fa4b0,_0xb12f49,_0x1a30b1){var _0x6f1c49={};var _0x3ce9c2={};var _0x389580;var _0xd84c50;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x2fa4b0['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0xb12f49,null))['then'](function(_0x4206a2){if(_0x4206a2){_0x389580=_0x4206a2;_0x3ce9c2[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x9f')][_0x162f('0x37')]);_0x3ce9c2['query']=_[_0x162f('0x3b')](_0x2fa4b0[_0x162f('0x3a')]);_0x3ce9c2['filters']=_[_0x162f('0x3e')](_0x3ce9c2[_0x162f('0x3d')],_0x3ce9c2['query']);_0x6f1c49[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x3ce9c2[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x3f')]));_0x6f1c49[_0x162f('0x40')]=_0x6f1c49[_0x162f('0x40')][_0x162f('0x50')]?_0x6f1c49[_0x162f('0x40')]:_0x3ce9c2[_0x162f('0x3d')];_0x6f1c49['order']=qs[_0x162f('0x44')](_0x2fa4b0['query'][_0x162f('0x44')]);_0x6f1c49['where']=qs['filters'](_[_0x162f('0x46')](_0x2fa4b0[_0x162f('0x3a')],_0x3ce9c2[_0x162f('0x3c')]));if(_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x47')]){_0x6f1c49[_0x162f('0x45')]=_['merge'](_0x6f1c49[_0x162f('0x45')],{'$or':_['map'](_0x6f1c49[_0x162f('0x40')],function(_0x4e0ec6){var _0x270d2d={};_0x270d2d[_0x4e0ec6]={'$like':'%'+_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x270d2d;})});}_0x6f1c49=_[_0x162f('0x48')]({},_0x6f1c49,_0x2fa4b0['options']);return _0x389580[_0x162f('0x9e')](_0x6f1c49);}})[_0x162f('0x29')](function(_0x26a35e){if(_0x26a35e){_0xd84c50=_0x26a35e['length'];if(!_0x2fa4b0[_0x162f('0x3a')]['hasOwnProperty']('nolimit')){_0x6f1c49['limit']=qs[_0x162f('0x23')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x23')]);_0x6f1c49['offset']=qs[_0x162f('0x20')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x389580[_0x162f('0x9e')](_0x6f1c49);}})['then'](function(_0x16b312){if(_0x16b312){return _0x16b312?{'count':_0xd84c50,'rows':_0x16b312}:null;}})[_0x162f('0x29')](respondWithResult(_0xb12f49,null))['catch'](handleError(_0xb12f49,null));};exports['addLists']=function(_0x570578,_0x286b17,_0x4c27a0){var _0x49a977=moment()[_0x162f('0x7e')](_0x162f('0xa0'));var _0x4746b0,_0x187d50;return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x570578[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x286b17,null))[_0x162f('0x29')](function(_0x263beb){if(_0x263beb){_0x187d50=_0x263beb;return _0x263beb[_0x162f('0xa1')](_0x570578[_0x162f('0x61')]['ids'],_[_0x162f('0x5f')](_0x570578['body'],['ids','id'])||{});}return null;})[_0x162f('0x98')](function(_0x2e18ad){var _0x384ebe;_0x4746b0=_0x2e18ad||[];var _0x17b7db=[];if(_0x2e18ad){for(var _0x2c36b9=0x0;_0x2c36b9<_0x2e18ad['length'];_0x2c36b9+=0x1){var _0x2e27fb=_0x2e18ad[_0x2c36b9][_0x162f('0x53')]({'plain':!![]});_0x187d50[_0x162f('0xa2')]=_0x570578['body']['dialCheckDuplicateType']?_0x570578[_0x162f('0x61')][_0x162f('0xa2')]:_0x187d50[_0x162f('0xa2')];switch(_0x187d50[_0x162f('0xa2')]){case _0x162f('0xa3'):_0x384ebe=squel[_0x162f('0xa4')]()['into']('cm_hopper')['fromQuery']([_0x162f('0xa5'),'scheduledAt',_0x162f('0xa6'),_0x162f('0xa7'),_0x162f('0x65'),_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')](_0x162f('0xa5'),_0x162f('0xa5'))['field']('\x27'+_0x49a977+'\x27','scheduledAt')[_0x162f('0x82')]('id','ContactId')[_0x162f('0x82')](_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x162f('0xad'),squel[_0x162f('0x81')]()[_0x162f('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0x162f('0x83')]('cm_hopper_final')[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]()))[_0x162f('0x45')](_0x162f('0xad'),squel[_0x162f('0x81')]()['field'](_0x162f('0xaf'))['from'](_0x162f('0xb0'))[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]())))[_0x162f('0xa9')]();break;case _0x162f('0xb1'):_0x384ebe=squel['insert']()[_0x162f('0xb2')](_0x162f('0xb0'))[_0x162f('0xb3')]([_0x162f('0xa5'),_0x162f('0xb4'),_0x162f('0xa6'),'ListId','VoiceQueueId',_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')]('phone',_0x162f('0xa5'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','scheduledAt')[_0x162f('0x82')]('id',_0x162f('0xa6'))['field'](_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id']['toString'](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','updatedAt')[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x2e27fb['CmListId'][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x162f('0xad'),squel[_0x162f('0x81')]()[_0x162f('0x82')]('COALESCE(phone,\x27\x27)')[_0x162f('0x83')](_0x162f('0xb0'))[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]())))[_0x162f('0xa9')]();break;default:_0x384ebe=squel[_0x162f('0xa4')]()[_0x162f('0xb2')](_0x162f('0xb0'))['fromQuery'](['phone',_0x162f('0xb4'),_0x162f('0xa6'),_0x162f('0xa7'),_0x162f('0x65'),'createdAt','updatedAt'],squel['select']()[_0x162f('0x82')]('phone',_0x162f('0xa5'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0xb4'))['field']('id',_0x162f('0xa6'))[_0x162f('0x82')](_0x2e27fb['CmListId']['toString'](),'ListId')[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))['where'](_0x162f('0xac'),_0x2e27fb[_0x162f('0xa8')]['toString']())[_0x162f('0x45')](_0x162f('0xb5')))[_0x162f('0xa9')]();}_0x17b7db[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x384ebe));}return BPromise[_0x162f('0x8f')](_0x17b7db);}})[_0x162f('0x29')](function(){var _0xcb9973=[];var _0x35f2f0=squel[_0x162f('0xa4')]()['into'](_0x162f('0xb6'))[_0x162f('0xb3')](['CmHopperId',_0x162f('0xa5'),_0x162f('0xb7'),_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')](_0x162f('0xb8'))[_0x162f('0x82')](_0x162f('0xb9'))[_0x162f('0x82')](_0x162f('0xba'))['field']('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','updatedAt')[_0x162f('0x83')](_0x162f('0xbb'),'ci')[_0x162f('0x85')]('cm_hopper','h',_0x162f('0xbc'))['where'](_0x162f('0xbd'),_0x49a977)[_0x162f('0x45')](_0x162f('0xbe'),'PHONE'))[_0x162f('0xa9')]();_0xcb9973[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x35f2f0));return BPromise[_0x162f('0x8f')](_0xcb9973);})[_0x162f('0x29')](function(){return _0x4746b0;})[_0x162f('0x29')](respondWithResult(_0x286b17,null))[_0x162f('0x5a')](handleError(_0x286b17,null));};exports[_0x162f('0xbf')]=function(_0x5c5999,_0x3d570a,_0x15feab){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x5c5999['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3d570a,null))[_0x162f('0x29')](function(_0x31cf99){if(_0x31cf99){return _0x31cf99[_0x162f('0xbf')](_0x5c5999[_0x162f('0x3a')][_0x162f('0x80')]);}})[_0x162f('0x29')](function(_0x2c913f){if(_0x2c913f){return db['CmHopper'][_0x162f('0x2a')]({'where':{'ListId':_0x5c5999[_0x162f('0x3a')][_0x162f('0x80')],'VoiceQueueId':_0x5c5999[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(){return _0x2c913f;});}})[_0x162f('0x29')](respondWithStatusCode(_0x3d570a,null))[_0x162f('0x5a')](handleError(_0x3d570a,null));};exports[_0x162f('0xc0')]=function(_0x46162a,_0x184945,_0x48c7b8){var _0x1655e3={};var _0x190988={};var _0x263b80;var _0x5e01b8;return db['VoiceQueue'][_0x162f('0x67')]({'where':{'id':_0x46162a[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x184945,null))[_0x162f('0x29')](function(_0xec07df){if(_0xec07df){_0x263b80=_0xec07df;_0x190988['model']=_['keys'](db[_0x162f('0x9f')][_0x162f('0x37')]);_0x190988[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x46162a[_0x162f('0x3a')]);_0x190988[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x190988[_0x162f('0x3d')],_0x190988[_0x162f('0x3a')]);_0x1655e3[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x190988[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x46162a[_0x162f('0x3a')]['fields']));_0x1655e3[_0x162f('0x40')]=_0x1655e3[_0x162f('0x40')][_0x162f('0x50')]?_0x1655e3[_0x162f('0x40')]:_0x190988[_0x162f('0x3d')];_0x1655e3[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x46162a[_0x162f('0x3a')]['sort']);_0x1655e3[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x46162a[_0x162f('0x3a')],_0x190988['filters']));if(_0x46162a['query'][_0x162f('0x47')]){_0x1655e3[_0x162f('0x45')]=_[_0x162f('0x48')](_0x1655e3[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x1655e3[_0x162f('0x40')],function(_0x487396){var _0x157ecd={};_0x157ecd[_0x487396]={'$like':'%'+_0x46162a[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x157ecd;})});}_0x1655e3=_[_0x162f('0x48')]({},_0x1655e3,_0x46162a['options']);return _0x263b80['getBlackLists'](_0x1655e3);}})[_0x162f('0x29')](function(_0x476d2a){if(_0x476d2a){_0x5e01b8=_0x476d2a['length'];if(!_0x46162a[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0x1655e3[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x46162a[_0x162f('0x3a')]['limit']);_0x1655e3[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x46162a['query'][_0x162f('0x20')]);}return _0x263b80[_0x162f('0xc0')](_0x1655e3);}})[_0x162f('0x29')](function(_0x39b5a2){if(_0x39b5a2){return _0x39b5a2?{'count':_0x5e01b8,'rows':_0x39b5a2}:null;}})['then'](respondWithResult(_0x184945,null))[_0x162f('0x5a')](handleError(_0x184945,null));};exports[_0x162f('0xc1')]=function(_0x1d69d9,_0x2c75de,_0x5708fb){var _0x2cf913,_0x48ce62;return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x1d69d9['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x2c75de,null))[_0x162f('0x29')](function(_0x5dbcbc){if(_0x5dbcbc){_0x48ce62=_0x5dbcbc;return _0x5dbcbc[_0x162f('0xc1')](_0x1d69d9['body'][_0x162f('0x80')],_['omit'](_0x1d69d9['body'],[_0x162f('0x80'),'id'])||{});}return null;})[_0x162f('0x98')](function(_0x41e555){var _0x59d28e;_0x2cf913=_0x41e555||[];var _0x116009=[];if(_0x41e555){for(var _0x6aade7=0x0;_0x6aade7<_0x41e555[_0x162f('0x50')];_0x6aade7+=0x1){var _0x1d1653=_0x41e555[_0x6aade7][_0x162f('0x53')]({'plain':!![]});_0x59d28e=squel['insert']()[_0x162f('0xb2')](_0x162f('0xc2'))[_0x162f('0xb3')]([_0x162f('0xa5'),_0x162f('0xa6'),_0x162f('0xa7'),'VoiceQueueId',_0x162f('0x60'),_0x162f('0x62')],squel['select']()[_0x162f('0x82')]('phone',_0x162f('0xa5'))['field']('id','ContactId')[_0x162f('0x82')](_0x1d1653['CmListId'][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x1d69d9[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')](_0x162f('0xc3'),_0x162f('0x60'))[_0x162f('0x82')](_0x162f('0xc3'),_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x1d1653[_0x162f('0xa8')][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x162f('0xa9')]();_0x116009[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x59d28e));}return BPromise[_0x162f('0x8f')](_0x116009);}})['then'](function(){return _0x2cf913;})['then'](respondWithResult(_0x2c75de,null))['catch'](handleError(_0x2c75de,null));};exports[_0x162f('0xc4')]=function(_0x303ead,_0x3b7757,_0x566f8c){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x303ead[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3b7757,null))[_0x162f('0x29')](function(_0x31f83f){if(_0x31f83f){return _0x31f83f[_0x162f('0xc4')](_0x303ead[_0x162f('0x3a')][_0x162f('0x80')]);}})[_0x162f('0x29')](function(_0x98eeea){if(_0x98eeea){return db[_0x162f('0x6c')]['destroy']({'where':{'ListId':_0x303ead['query'][_0x162f('0x80')],'VoiceQueueId':_0x303ead[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(){return _0x98eeea;});}})['then'](respondWithStatusCode(_0x3b7757,null))[_0x162f('0x5a')](handleError(_0x3b7757,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 98a1928..c135b72 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 _0xd7ee=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4cea62,_0x2f64a3){var _0x3160da=function(_0x475c31){while(--_0x475c31){_0x4cea62['push'](_0x4cea62['shift']());}};_0x3160da(++_0x2f64a3);}(_0xd7ee,0x17a));var _0xed7e=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0xd7ee[_0x4801a0];return _0x338e26;};'use strict';var EventEmitter=require(_0xed7e('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xed7e('0x1')](0x0);var events={'afterCreate':_0xed7e('0x2'),'afterUpdate':_0xed7e('0x3'),'afterDestroy':_0xed7e('0x4')};function emitEvent(_0x25e0b8){return function(_0x5ecf6f,_0x148cff,_0x2c36fe){VoiceQueueEvents[_0xed7e('0x5')](_0x25e0b8+':'+_0x5ecf6f['id'],_0x5ecf6f);VoiceQueueEvents['emit'](_0x25e0b8,_0x5ecf6f);_0x2c36fe(null);};}for(var e in events){if(events[_0xed7e('0x6')](e)){var event=events[e];VoiceQueue[_0xed7e('0x7')](e,emitEvent(event));}}module[_0xed7e('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x8a88=['remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save','update'];(function(_0x4f0456,_0x5ea744){var _0x2b8699=function(_0x3a4cf5){while(--_0x3a4cf5){_0x4f0456['push'](_0x4f0456['shift']());}};_0x2b8699(++_0x5ea744);}(_0x8a88,0x87));var _0x88a8=function(_0x4497cd,_0x4a2208){_0x4497cd=_0x4497cd-0x0;var _0x3c6c43=_0x8a88[_0x4497cd];return _0x3c6c43;};'use strict';var EventEmitter=require(_0x88a8('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x88a8('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x88a8('0x2')](0x0);var events={'afterCreate':_0x88a8('0x3'),'afterUpdate':_0x88a8('0x4'),'afterDestroy':_0x88a8('0x5')};function emitEvent(_0x108469){return function(_0x518eec,_0x44f4ac,_0x14d74b){VoiceQueueEvents[_0x88a8('0x6')](_0x108469+':'+_0x518eec['id'],_0x518eec);VoiceQueueEvents[_0x88a8('0x6')](_0x108469,_0x518eec);_0x14d74b(null);};}for(var e in events){if(events[_0x88a8('0x7')](e)){var event=events[e];VoiceQueue[_0x88a8('0x8')](e,emitEvent(event));}}module[_0x88a8('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fd84572..857dde0 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x426c5e,_0xb68088){var _0x4a416a=function(_0x42892b){while(--_0x42892b){_0x426c5e['push'](_0x426c5e['shift']());}};_0x4a416a(++_0xb68088);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x533663,_0x285a8b){var _0x1d1602=function(_0x217b82){while(--_0x217b82){_0x533663['push'](_0x533663['shift']());}};_0x1d1602(++_0x285a8b);}(_0x70e0,0x17b));var _0x070e=function(_0x4d6319,_0x3d9ca2){_0x4d6319=_0x4d6319-0x0;var _0x4a7d38=_0x70e0[_0x4d6319];return _0x4a7d38;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 6f3bc79..9604e54 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 _0x7eab=['where','attributes','limit','include','map','model','info','GetVoiceQueue','then','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','register','request','request\x20sent','debug','stringify','error','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','findAll','options','raw'];(function(_0x4c55e4,_0x18122e){var _0xd6b385=function(_0x545b10){while(--_0x545b10){_0x4c55e4['push'](_0x4c55e4['shift']());}};_0xd6b385(++_0x18122e);}(_0x7eab,0xc8));var _0xb7ea=function(_0x5ca761,_0x259bfb){_0x5ca761=_0x5ca761-0x0;var _0x2d3b06=_0x7eab[_0x5ca761];return _0x2d3b06;};'use strict';var _=require(_0xb7ea('0x0'));var util=require(_0xb7ea('0x1'));var moment=require(_0xb7ea('0x2'));var BPromise=require(_0xb7ea('0x3'));var rs=require(_0xb7ea('0x4'));var fs=require('fs');var Redis=require(_0xb7ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb7ea('0x6'))(_0xb7ea('0x7'));var config=require('../../config/environment');var jayson=require(_0xb7ea('0x8'));var client=jayson[_0xb7ea('0x9')][_0xb7ea('0xa')]({'port':0x232a});config[_0xb7ea('0xb')]=_['defaults'](config[_0xb7ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7ea('0xc'))(new Redis(config[_0xb7ea('0xb')]));require(_0xb7ea('0xd'))[_0xb7ea('0xe')](socket);function respondWithRpcPromise(_0x5e2b93,_0x459a47,_0x542908){return new BPromise(function(_0x434dd6,_0x350ca6){return client[_0xb7ea('0xf')](_0x5e2b93,_0x542908)['then'](function(_0x4837f1){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x459a47,_0xb7ea('0x10'));logger[_0xb7ea('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x459a47,'request\x20sent',JSON[_0xb7ea('0x12')](_0x4837f1));if(_0x4837f1[_0xb7ea('0x13')]){if(_0x4837f1[_0xb7ea('0x13')]['code']===0x1f4){logger[_0xb7ea('0x13')](_0xb7ea('0x14'),_0x459a47,_0x4837f1[_0xb7ea('0x13')][_0xb7ea('0x15')]);return _0x350ca6(_0x4837f1['error'][_0xb7ea('0x15')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x459a47,_0x4837f1['error']['message']);return _0x434dd6(_0x4837f1[_0xb7ea('0x13')][_0xb7ea('0x15')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x459a47,_0xb7ea('0x10'));_0x434dd6(_0x4837f1[_0xb7ea('0x16')][_0xb7ea('0x15')]);}})[_0xb7ea('0x17')](function(_0x161dd5){logger[_0xb7ea('0x13')](_0xb7ea('0x14'),_0x459a47,_0x161dd5);_0x350ca6(_0x161dd5);});});}exports['GetVoiceQueue']=function(_0x4fcfde){var _0x5e0af4=this;return new Promise(function(_0x136d96,_0x1b5a9c){return db[_0xb7ea('0x18')][_0xb7ea('0x19')]({'raw':_0x4fcfde[_0xb7ea('0x1a')]?_0x4fcfde['options'][_0xb7ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fcfde['options']?_0x4fcfde[_0xb7ea('0x1a')][_0xb7ea('0x1c')]||null:null,'attributes':_0x4fcfde[_0xb7ea('0x1a')]?_0x4fcfde[_0xb7ea('0x1a')][_0xb7ea('0x1d')]||null:null,'limit':_0x4fcfde[_0xb7ea('0x1a')]?_0x4fcfde['options'][_0xb7ea('0x1e')]||null:null,'include':_0x4fcfde[_0xb7ea('0x1a')]?_0x4fcfde[_0xb7ea('0x1a')][_0xb7ea('0x1f')]?_[_0xb7ea('0x20')](_0x4fcfde[_0xb7ea('0x1a')][_0xb7ea('0x1f')],function(_0xdaf14e){return{'model':db[_0xdaf14e[_0xb7ea('0x21')]],'as':_0xdaf14e['as'],'attributes':_0xdaf14e['attributes'],'include':_0xdaf14e[_0xb7ea('0x1f')]?_['map'](_0xdaf14e[_0xb7ea('0x1f')],function(_0x2ee2f3){return{'model':db[_0x2ee2f3['model']],'as':_0x2ee2f3['as'],'attributes':_0x2ee2f3[_0xb7ea('0x1d')],'include':_0x2ee2f3['include']?_['map'](_0x2ee2f3[_0xb7ea('0x1f')],function(_0x3e9cd4){return{'model':db[_0x3e9cd4[_0xb7ea('0x21')]],'as':_0x3e9cd4['as'],'attributes':_0x3e9cd4[_0xb7ea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f2219){logger[_0xb7ea('0x22')](_0xb7ea('0x23'),_0x4fcfde);logger['debug'](_0xb7ea('0x23'),_0x4fcfde,JSON[_0xb7ea('0x12')](_0x2f2219));_0x136d96(_0x2f2219);})[_0xb7ea('0x17')](function(_0x5e9bfd){logger[_0xb7ea('0x13')](_0xb7ea('0x23'),_0x5e9bfd[_0xb7ea('0x15')],_0x4fcfde);_0x1b5a9c(_0x5e0af4[_0xb7ea('0x13')](0x1f4,_0x5e9bfd[_0xb7ea('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x4f8725){var _0x12ddab=this;return new Promise(function(_0xde9bfe,_0x30fa69){return db['VoiceQueue']['find']({'raw':_0x4f8725[_0xb7ea('0x1a')]?_0x4f8725[_0xb7ea('0x1a')][_0xb7ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f8725[_0xb7ea('0x1a')]?_0x4f8725['options']['where']||null:null,'attributes':_0x4f8725[_0xb7ea('0x1a')]?_0x4f8725[_0xb7ea('0x1a')][_0xb7ea('0x1d')]||null:null,'include':_0x4f8725['options']?_0x4f8725[_0xb7ea('0x1a')]['include']?_['map'](_0x4f8725[_0xb7ea('0x1a')][_0xb7ea('0x1f')],function(_0x2f519e){return{'model':db[_0x2f519e[_0xb7ea('0x21')]],'as':_0x2f519e['as'],'attributes':_0x2f519e[_0xb7ea('0x1d')],'include':_0x2f519e[_0xb7ea('0x1f')]?_[_0xb7ea('0x20')](_0x2f519e[_0xb7ea('0x1f')],function(_0x1fd88f){return{'model':db[_0x1fd88f['model']],'as':_0x1fd88f['as'],'attributes':_0x1fd88f[_0xb7ea('0x1d')],'include':_0x1fd88f[_0xb7ea('0x1f')]?_[_0xb7ea('0x20')](_0x1fd88f[_0xb7ea('0x1f')],function(_0x31d4bb){return{'model':db[_0x31d4bb[_0xb7ea('0x21')]],'as':_0x31d4bb['as'],'attributes':_0x31d4bb[_0xb7ea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7ea('0x24')](function(_0x591066){logger[_0xb7ea('0x22')](_0xb7ea('0x25'),_0x4f8725);logger[_0xb7ea('0x11')](_0xb7ea('0x25'),_0x4f8725,JSON[_0xb7ea('0x12')](_0x591066));_0xde9bfe(_0x591066);})[_0xb7ea('0x17')](function(_0x136ab4){logger[_0xb7ea('0x13')](_0xb7ea('0x25'),_0x136ab4[_0xb7ea('0x15')],_0x4f8725);_0x30fa69(_0x12ddab[_0xb7ea('0x13')](0x1f4,_0x136ab4[_0xb7ea('0x15')]));});});}; \ No newline at end of file +var _0x5efa=['info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','where','attributes','limit','map','model','include','ShowVoiceQueue','find','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x245384,_0x4cafd9){var _0x2f541d=function(_0x5e3135){while(--_0x5e3135){_0x245384['push'](_0x245384['shift']());}};_0x2f541d(++_0x4cafd9);}(_0x5efa,0x119));var _0xa5ef=function(_0x110bf0,_0x3d8b80){_0x110bf0=_0x110bf0-0x0;var _0x5b4dd7=_0x5efa[_0x110bf0];return _0x5b4dd7;};'use strict';var _=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var moment=require(_0xa5ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xa5ef('0x3'));var fs=require('fs');var Redis=require(_0xa5ef('0x4'));var db=require(_0xa5ef('0x5'))['db'];var utils=require(_0xa5ef('0x6'));var logger=require(_0xa5ef('0x7'))(_0xa5ef('0x8'));var config=require(_0xa5ef('0x9'));var jayson=require(_0xa5ef('0xa'));var client=jayson[_0xa5ef('0xb')][_0xa5ef('0xc')]({'port':0x232a});config[_0xa5ef('0xd')]=_[_0xa5ef('0xe')](config[_0xa5ef('0xd')],{'host':_0xa5ef('0xf'),'port':0x18eb});var socket=require(_0xa5ef('0x10'))(new Redis(config[_0xa5ef('0xd')]));require('./voiceQueue.socket')[_0xa5ef('0x11')](socket);function respondWithRpcPromise(_0xd4862f,_0x4abb8b,_0x2fcab4){return new BPromise(function(_0x5902af,_0x5ed2e5){return client[_0xa5ef('0x12')](_0xd4862f,_0x2fcab4)[_0xa5ef('0x13')](function(_0x2e627e){logger[_0xa5ef('0x14')](_0xa5ef('0x15'),_0x4abb8b,'request\x20sent');logger[_0xa5ef('0x16')](_0xa5ef('0x17'),_0x4abb8b,_0xa5ef('0x18'),JSON['stringify'](_0x2e627e));if(_0x2e627e[_0xa5ef('0x19')]){if(_0x2e627e[_0xa5ef('0x19')][_0xa5ef('0x1a')]===0x1f4){logger[_0xa5ef('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0x2e627e['error'][_0xa5ef('0x1b')]);return _0x5ed2e5(_0x2e627e['error']['message']);}logger[_0xa5ef('0x19')](_0xa5ef('0x15'),_0x4abb8b,_0x2e627e[_0xa5ef('0x19')]['message']);return _0x5902af(_0x2e627e['error'][_0xa5ef('0x1b')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0xa5ef('0x18'));_0x5902af(_0x2e627e[_0xa5ef('0x1c')][_0xa5ef('0x1b')]);}})[_0xa5ef('0x1d')](function(_0x36d2b9){logger[_0xa5ef('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0x36d2b9);_0x5ed2e5(_0x36d2b9);});});}exports[_0xa5ef('0x1e')]=function(_0x22716d){var _0x3fbd23=this;return new Promise(function(_0x2a895c,_0x592f34){return db['VoiceQueue'][_0xa5ef('0x1f')]({'raw':_0x22716d[_0xa5ef('0x20')]?_0x22716d[_0xa5ef('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')][_0xa5ef('0x21')]||null:null,'attributes':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')][_0xa5ef('0x22')]||null:null,'limit':_0x22716d['options']?_0x22716d['options'][_0xa5ef('0x23')]||null:null,'include':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')]['include']?_[_0xa5ef('0x24')](_0x22716d['options']['include'],function(_0x489dfe){return{'model':db[_0x489dfe[_0xa5ef('0x25')]],'as':_0x489dfe['as'],'attributes':_0x489dfe['attributes'],'include':_0x489dfe[_0xa5ef('0x26')]?_['map'](_0x489dfe[_0xa5ef('0x26')],function(_0x4a99fd){return{'model':db[_0x4a99fd['model']],'as':_0x4a99fd['as'],'attributes':_0x4a99fd['attributes'],'include':_0x4a99fd[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x4a99fd[_0xa5ef('0x26')],function(_0x18ae81){return{'model':db[_0x18ae81[_0xa5ef('0x25')]],'as':_0x18ae81['as'],'attributes':_0x18ae81[_0xa5ef('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b926b){logger['info'](_0xa5ef('0x1e'),_0x22716d);logger[_0xa5ef('0x16')](_0xa5ef('0x1e'),_0x22716d,JSON['stringify'](_0x2b926b));_0x2a895c(_0x2b926b);})[_0xa5ef('0x1d')](function(_0x36540f){logger[_0xa5ef('0x19')](_0xa5ef('0x1e'),_0x36540f[_0xa5ef('0x1b')],_0x22716d);_0x592f34(_0x3fbd23[_0xa5ef('0x19')](0x1f4,_0x36540f[_0xa5ef('0x1b')]));});});};exports[_0xa5ef('0x27')]=function(_0x12b118){var _0x52d83e=this;return new Promise(function(_0x521283,_0x28b2ff){return db['VoiceQueue'][_0xa5ef('0x28')]({'raw':_0x12b118['options']?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x29')]===undefined?!![]:![]:!![],'where':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x21')]||null:null,'attributes':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x22')]||null:null,'include':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x12b118['options']['include'],function(_0x2da1fa){return{'model':db[_0x2da1fa['model']],'as':_0x2da1fa['as'],'attributes':_0x2da1fa[_0xa5ef('0x22')],'include':_0x2da1fa[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x2da1fa[_0xa5ef('0x26')],function(_0x31cc0f){return{'model':db[_0x31cc0f[_0xa5ef('0x25')]],'as':_0x31cc0f['as'],'attributes':_0x31cc0f[_0xa5ef('0x22')],'include':_0x31cc0f[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x31cc0f[_0xa5ef('0x26')],function(_0x36bc19){return{'model':db[_0x36bc19[_0xa5ef('0x25')]],'as':_0x36bc19['as'],'attributes':_0x36bc19[_0xa5ef('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa5ef('0x13')](function(_0x2c159c){logger[_0xa5ef('0x14')](_0xa5ef('0x27'),_0x12b118);logger[_0xa5ef('0x16')](_0xa5ef('0x27'),_0x12b118,JSON[_0xa5ef('0x2a')](_0x2c159c));_0x521283(_0x2c159c);})[_0xa5ef('0x1d')](function(_0x240349){logger['error'](_0xa5ef('0x27'),_0x240349['message'],_0x12b118);_0x28b2ff(_0x52d83e[_0xa5ef('0x19')](0x1f4,_0x240349[_0xa5ef('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 10f9208..6d10fdb 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 _0xcfb7=['removeListener','register','./voiceQueue.events','remove','update','emit'];(function(_0xfe9365,_0x4f9b01){var _0x419138=function(_0xf916b6){while(--_0xf916b6){_0xfe9365['push'](_0xfe9365['shift']());}};_0x419138(++_0x4f9b01);}(_0xcfb7,0x14c));var _0x7cfb=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xcfb7[_0x1fafa5];return _0xcf08c9;};'use strict';var VoiceQueueEvents=require(_0x7cfb('0x0'));var events=['save',_0x7cfb('0x1'),_0x7cfb('0x2')];function createListener(_0x39a397,_0x5ea049){return function(_0x55d129){_0x5ea049[_0x7cfb('0x3')](_0x39a397,_0x55d129);};}function removeListener(_0x4fdf43,_0x568e72){return function(){VoiceQueueEvents[_0x7cfb('0x4')](_0x4fdf43,_0x568e72);};}exports[_0x7cfb('0x5')]=function(_0x13e646){for(var _0x4634de=0x0,_0x3dd026=events['length'];_0x4634de<_0x3dd026;_0x4634de++){var _0x48cab2=events[_0x4634de];var _0x55270a=createListener('voiceQueue:'+_0x48cab2,_0x13e646);VoiceQueueEvents['on'](_0x48cab2,_0x55270a);}}; \ No newline at end of file +var _0x5727=['./voiceQueue.events','remove','register','voiceQueue:'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x5727,0x1d0));var _0x7572=function(_0x48a97d,_0x5b3fbd){_0x48a97d=_0x48a97d-0x0;var _0x4296a8=_0x5727[_0x48a97d];return _0x4296a8;};'use strict';var VoiceQueueEvents=require(_0x7572('0x0'));var events=['save',_0x7572('0x1'),'update'];function createListener(_0x5ce06d,_0x26c8ce){return function(_0x5dd8b2){_0x26c8ce['emit'](_0x5ce06d,_0x5dd8b2);};}function removeListener(_0x3e50b5,_0x397db7){return function(){VoiceQueueEvents['removeListener'](_0x3e50b5,_0x397db7);};}exports[_0x7572('0x2')]=function(_0x24a45e){for(var _0x2de05b=0x0,_0x58e680=events['length'];_0x2de05b<_0x58e680;_0x2de05b++){var _0x21022d=events[_0x2de05b];var _0x326e23=createListener(_0x7572('0x3')+_0x21022d,_0x24a45e);VoiceQueueEvents['on'](_0x21022d,_0x326e23);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 107e1ec..50ff0b6 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 _0xa4c1=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','get','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x32cf02,_0x3d8ab6){var _0x41f0e6=function(_0x5aadad){while(--_0x5aadad){_0x32cf02['push'](_0x32cf02['shift']());}};_0x41f0e6(++_0x3d8ab6);}(_0xa4c1,0xa2));var _0x1a4c=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xa4c1[_0x4cf0b7];return _0x545f10;};'use strict';var multer=require('multer');var util=require(_0x1a4c('0x0'));var path=require('path');var timeout=require(_0x1a4c('0x1'));var express=require(_0x1a4c('0x2'));var router=express[_0x1a4c('0x3')]();var fs_extra=require(_0x1a4c('0x4'));var auth=require(_0x1a4c('0x5'));var interaction=require(_0x1a4c('0x6'));var config=require(_0x1a4c('0x7'));var controller=require(_0x1a4c('0x8'));router['get']('/',auth[_0x1a4c('0x9')](),controller[_0x1a4c('0xa')]);router['get'](_0x1a4c('0xb'),auth['isAuthenticated'](),controller[_0x1a4c('0xc')]);router['get'](_0x1a4c('0xd'),auth[_0x1a4c('0x9')](),controller[_0x1a4c('0xe')]);router[_0x1a4c('0xf')]('/:id',auth[_0x1a4c('0x9')](),controller['show']);router[_0x1a4c('0x10')]('/',auth[_0x1a4c('0x9')](),controller[_0x1a4c('0x11')]);router[_0x1a4c('0x12')](_0x1a4c('0x13'),auth['isAuthenticated'](),controller[_0x1a4c('0x14')]);router[_0x1a4c('0x15')](_0x1a4c('0x13'),auth[_0x1a4c('0x9')](),controller[_0x1a4c('0x16')]);module[_0x1a4c('0x17')]=router; \ No newline at end of file +var _0x9513=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update'];(function(_0x537028,_0x65e5ac){var _0x1d725b=function(_0x39b153){while(--_0x39b153){_0x537028['push'](_0x537028['shift']());}};_0x1d725b(++_0x65e5ac);}(_0x9513,0x1ba));var _0x3951=function(_0x58ecee,_0x507d7f){_0x58ecee=_0x58ecee-0x0;var _0x133866=_0x9513[_0x58ecee];return _0x133866;};'use strict';var multer=require('multer');var util=require(_0x3951('0x0'));var path=require(_0x3951('0x1'));var timeout=require(_0x3951('0x2'));var express=require(_0x3951('0x3'));var router=express['Router']();var fs_extra=require(_0x3951('0x4'));var auth=require(_0x3951('0x5'));var interaction=require(_0x3951('0x6'));var config=require('../../config/environment');var controller=require(_0x3951('0x7'));router[_0x3951('0x8')]('/',auth[_0x3951('0x9')](),controller[_0x3951('0xa')]);router[_0x3951('0x8')](_0x3951('0xb'),auth[_0x3951('0x9')](),controller[_0x3951('0xc')]);router['get'](_0x3951('0xd'),auth['isAuthenticated'](),controller[_0x3951('0xe')]);router[_0x3951('0x8')](_0x3951('0xf'),auth[_0x3951('0x9')](),controller[_0x3951('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3951('0x11')]);router[_0x3951('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3951('0x13')]);router['delete'](_0x3951('0xf'),auth[_0x3951('0x9')](),controller['destroy']);module[_0x3951('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 95b4c33..b78a9a8 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 _0x091f=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x4554c1,_0x589649){var _0x1dfa5c=function(_0x10c269){while(--_0x10c269){_0x4554c1['push'](_0x4554c1['shift']());}};_0x1dfa5c(++_0x589649);}(_0x091f,0x72));var _0xf091=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0x091f[_0x497948];return _0x39bb36;};'use strict';var Sequelize=require(_0xf091('0x0'));var moment=require(_0xf091('0x1'));module[_0xf091('0x2')]={'type':{'type':Sequelize[_0xf091('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf091('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf091('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xf091('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf091('0x4')],'set':function(_0x5920c5){var _0xc3ebf2=moment(_0x5920c5);var _0xb1c78d=moment(this[_0xf091('0x5')](_0xf091('0x6')))[_0xf091('0x7')](_0xf091('0x8'));var _0x3666ad=_0xc3ebf2[_0xf091('0x9')](_0xb1c78d,'seconds');this['setDataValue'](_0xf091('0xa'),_0x5920c5);this[_0xf091('0xb')](_0xf091('0xc'),_0x3666ad||null);}},'position':{'type':Sequelize[_0xf091('0xd')]},'count':{'type':Sequelize[_0xf091('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf091('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xf091('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf091('0x4')]},'queuecallerexit':{'type':Sequelize[_0xf091('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf091('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xf091('0x3')],'comment':_0xf091('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xf091('0x3')]},'connectedlinenum':{'type':Sequelize[_0xf091('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf091('0x3')]},'context':{'type':Sequelize[_0xf091('0x3')]},'exten':{'type':Sequelize[_0xf091('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf091('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf091('0x3')]},'transfer':{'type':Sequelize[_0xf091('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf091('0x10')},'transferexten':{'type':Sequelize[_0xf091('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xf091('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b08=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x9b08,0x1ea));var _0x89b0=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x9b08[_0x1a7550];return _0x426e22;};'use strict';var Sequelize=require(_0x89b0('0x0'));var moment=require(_0x89b0('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x89b0('0x2')]},'calleridnum':{'type':Sequelize[_0x89b0('0x2')]},'calleridname':{'type':Sequelize[_0x89b0('0x2')]},'queue':{'type':Sequelize[_0x89b0('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x89b0('0x3')],'set':function(_0x195f4a){var _0x40385d=moment(_0x195f4a);var _0x560b5a=moment(this[_0x89b0('0x4')](_0x89b0('0x5')))[_0x89b0('0x6')](_0x89b0('0x7'));var _0x50ec21=_0x40385d[_0x89b0('0x8')](_0x560b5a,_0x89b0('0x9'));this[_0x89b0('0xa')](_0x89b0('0xb'),_0x195f4a);this[_0x89b0('0xa')](_0x89b0('0xc'),_0x50ec21||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x89b0('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerexit':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x89b0('0x2')],'comment':_0x89b0('0xf')},'originalposition':{'type':Sequelize[_0x89b0('0xd')]},'channel':{'type':Sequelize[_0x89b0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x89b0('0x2')]},'connectedlinename':{'type':Sequelize[_0x89b0('0x2')]},'accountcode':{'type':Sequelize[_0x89b0('0x2')]},'context':{'type':Sequelize[_0x89b0('0x2')]},'exten':{'type':Sequelize[_0x89b0('0x2')]},'priority':{'type':Sequelize[_0x89b0('0x2')]},'holdtime':{'type':Sequelize[_0x89b0('0xd')]},'mohtime':{'type':Sequelize[_0x89b0('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x89b0('0x2')],'comment':_0x89b0('0x10')},'transferexten':{'type':Sequelize[_0x89b0('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x89b0('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x89b0('0xd')],'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 fc0143b..b2b16ed 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 _0xd68e=['VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./voiceQueueReport.socket','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x4f66e8,_0x248e57){var _0x143032=function(_0x52034b){while(--_0x52034b){_0x4f66e8['push'](_0x4f66e8['shift']());}};_0x143032(++_0x248e57);}(_0xd68e,0x1d2));var _0xed68=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0xd68e[_0x1de641];return _0xccacbc;};'use strict';var emlformat=require(_0xed68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed68('0x1'));var jsonpatch=require(_0xed68('0x2'));var rp=require(_0xed68('0x3'));var moment=require('moment');var BPromise=require(_0xed68('0x4'));var Mustache=require(_0xed68('0x5'));var util=require(_0xed68('0x6'));var path=require('path');var sox=require(_0xed68('0x7'));var csv=require(_0xed68('0x8'));var ejs=require(_0xed68('0x9'));var fs=require('fs');var fs_extra=require(_0xed68('0xa'));var _=require(_0xed68('0xb'));var squel=require('squel');var crypto=require(_0xed68('0xc'));var jsforce=require(_0xed68('0xd'));var deskjs=require(_0xed68('0xe'));var toCsv=require('to-csv');var querystring=require(_0xed68('0xf'));var Papa=require(_0xed68('0x10'));var Redis=require(_0xed68('0x11'));var authService=require(_0xed68('0x12'));var qs=require(_0xed68('0x13'));var as=require(_0xed68('0x14'));var hardwareService=require(_0xed68('0x15'));var logger=require(_0xed68('0x16'))(_0xed68('0x17'));var utils=require(_0xed68('0x18'));var config=require(_0xed68('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xed68('0x1a'))['db'];config['redis']=_[_0xed68('0x1b')](config['redis'],{'host':_0xed68('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed68('0x1d')]));require(_0xed68('0x1e'))[_0xed68('0x1f')](socket);function respondWithStatusCode(_0x3f0f47,_0x4cea5a){_0x4cea5a=_0x4cea5a||0xcc;return function(_0x396ce3){if(_0x396ce3){return _0x3f0f47['sendStatus'](_0x4cea5a);}return _0x3f0f47[_0xed68('0x20')](_0x4cea5a)[_0xed68('0x21')]();};}function respondWithResult(_0xec8a6f,_0x978e6e){_0x978e6e=_0x978e6e||0xc8;return function(_0x48b42e){if(_0x48b42e){return _0xec8a6f[_0xed68('0x20')](_0x978e6e)[_0xed68('0x22')](_0x48b42e);}};}function respondWithFilteredResult(_0x58f302,_0x59730f){return function(_0x2ec806){if(_0x2ec806){var _0x1e233b=typeof _0x59730f[_0xed68('0x23')]===_0xed68('0x24')&&typeof _0x59730f['limit']===_0xed68('0x24');var _0xdbd616=_0x2ec806[_0xed68('0x25')];var _0x2c11bd=_0x1e233b?0x0:_0x59730f[_0xed68('0x23')];var _0x1c4419=_0x1e233b?_0x2ec806[_0xed68('0x25')]:_0x59730f[_0xed68('0x23')]+_0x59730f[_0xed68('0x26')];var _0x5dbf27;if(_0x1c4419>=_0xdbd616){_0x1c4419=_0xdbd616;_0x5dbf27=0xc8;}else{_0x5dbf27=0xce;}_0x58f302['status'](_0x5dbf27);return _0x58f302[_0xed68('0x27')]('Content-Range',_0x2c11bd+'-'+_0x1c4419+'/'+_0xdbd616)['json'](_0x2ec806);}return null;};}function patchUpdates(_0x15406d){return function(_0x26c13a){try{jsonpatch[_0xed68('0x28')](_0x26c13a,_0x15406d,!![]);}catch(_0x3e7141){return BPromise['reject'](_0x3e7141);}return _0x26c13a[_0xed68('0x29')]();};}function saveUpdates(_0x3e27f9,_0x44c892){return function(_0x31cab6){if(_0x31cab6){return _0x31cab6[_0xed68('0x2a')](_0x3e27f9)[_0xed68('0x2b')](function(_0x37bc41){return _0x37bc41;});}return null;};}function removeEntity(_0x38729e,_0x569b55){return function(_0x3144d3){if(_0x3144d3){return _0x3144d3[_0xed68('0x2c')]()['then'](function(){_0x38729e[_0xed68('0x20')](0xcc)[_0xed68('0x21')]();});}};}function handleEntityNotFound(_0x3a2474,_0x18eb4e){return function(_0x1617fd){if(!_0x1617fd){_0x3a2474['sendStatus'](0x194);}return _0x1617fd;};}function handleError(_0x527b7e,_0x27210e){_0x27210e=_0x27210e||0x1f4;return function(_0x1f2ec0){logger[_0xed68('0x2d')](_0x1f2ec0[_0xed68('0x2e')]);if(_0x1f2ec0[_0xed68('0x2f')]){delete _0x1f2ec0['name'];}_0x527b7e[_0xed68('0x20')](_0x27210e)[_0xed68('0x30')](_0x1f2ec0);};}exports[_0xed68('0x31')]=function(_0x1c91e4,_0x21c9a3){var _0x4ebe29={},_0x378035={},_0x5ad774={'count':0x0,'rows':[]};var _0x36e699=_['map'](db[_0xed68('0x32')][_0xed68('0x33')],function(_0x289de1){return{'name':_0x289de1[_0xed68('0x34')],'type':_0x289de1[_0xed68('0x35')][_0xed68('0x36')]};});_0x378035[_0xed68('0x37')]=_[_0xed68('0x38')](_0x36e699,_0xed68('0x2f'));_0x378035[_0xed68('0x39')]=_[_0xed68('0x3a')](_0x1c91e4[_0xed68('0x39')]);_0x378035[_0xed68('0x3b')]=_[_0xed68('0x3c')](_0x378035[_0xed68('0x37')],_0x378035[_0xed68('0x39')]);_0x4ebe29[_0xed68('0x3d')]=_[_0xed68('0x3c')](_0x378035[_0xed68('0x37')],qs[_0xed68('0x3e')](_0x1c91e4[_0xed68('0x39')][_0xed68('0x3e')]));_0x4ebe29[_0xed68('0x3d')]=_0x4ebe29['attributes'][_0xed68('0x3f')]?_0x4ebe29['attributes']:_0x378035[_0xed68('0x37')];if(!_0x1c91e4[_0xed68('0x39')][_0xed68('0x40')](_0xed68('0x41'))){_0x4ebe29[_0xed68('0x26')]=qs['limit'](_0x1c91e4[_0xed68('0x39')][_0xed68('0x26')]);_0x4ebe29[_0xed68('0x23')]=qs['offset'](_0x1c91e4[_0xed68('0x39')][_0xed68('0x23')]);}_0x4ebe29[_0xed68('0x42')]=qs[_0xed68('0x43')](_0x1c91e4[_0xed68('0x39')][_0xed68('0x43')]);_0x4ebe29[_0xed68('0x44')]=qs[_0xed68('0x3b')](_[_0xed68('0x45')](_0x1c91e4[_0xed68('0x39')],_0x378035['filters']),_0x36e699);if(_0x1c91e4[_0xed68('0x39')][_0xed68('0x46')]){_0x4ebe29[_0xed68('0x44')]=_[_0xed68('0x47')](_0x4ebe29['where'],{'$or':_[_0xed68('0x38')](_0x36e699,function(_0x2982ca){if(_0x2982ca[_0xed68('0x35')]!==_0xed68('0x48')){var _0x1dd2af={};_0x1dd2af[_0x2982ca[_0xed68('0x2f')]]={'$like':'%'+_0x1c91e4[_0xed68('0x39')]['filter']+'%'};return _0x1dd2af;}})});}_0x4ebe29=_[_0xed68('0x47')]({},_0x4ebe29,_0x1c91e4[_0xed68('0x49')]);var _0x56fa50={'where':_0x4ebe29[_0xed68('0x44')]};return db[_0xed68('0x32')]['count'](_0x56fa50)['then'](function(_0x34ecc5){_0x5ad774[_0xed68('0x25')]=_0x34ecc5;if(_0x1c91e4['query'][_0xed68('0x4a')]){_0x4ebe29['include']=[{'all':!![]}];}return db[_0xed68('0x32')][_0xed68('0x4b')](_0x4ebe29);})[_0xed68('0x2b')](function(_0x1483f8){_0x5ad774[_0xed68('0x4c')]=_0x1483f8;return _0x5ad774;})[_0xed68('0x2b')](respondWithFilteredResult(_0x21c9a3,_0x4ebe29))['catch'](handleError(_0x21c9a3,null));};exports[_0xed68('0x4d')]=function(_0x3edc17,_0x4d5d7a){var _0xe83c18={'raw':![],'where':{'id':_0x3edc17[_0xed68('0x4e')]['id']}},_0x531600={};_0x531600[_0xed68('0x37')]=_[_0xed68('0x3a')](db[_0xed68('0x32')]['rawAttributes']);_0x531600[_0xed68('0x39')]=_[_0xed68('0x3a')](_0x3edc17[_0xed68('0x39')]);_0x531600[_0xed68('0x3b')]=_[_0xed68('0x3c')](_0x531600[_0xed68('0x37')],_0x531600[_0xed68('0x39')]);_0xe83c18[_0xed68('0x3d')]=_[_0xed68('0x3c')](_0x531600[_0xed68('0x37')],qs[_0xed68('0x3e')](_0x3edc17[_0xed68('0x39')][_0xed68('0x3e')]));_0xe83c18[_0xed68('0x3d')]=_0xe83c18['attributes'][_0xed68('0x3f')]?_0xe83c18[_0xed68('0x3d')]:_0x531600[_0xed68('0x37')];if(_0x3edc17['query'][_0xed68('0x4a')]){_0xe83c18[_0xed68('0x4f')]=[{'all':!![]}];}_0xe83c18=_[_0xed68('0x47')]({},_0xe83c18,_0x3edc17[_0xed68('0x49')]);return db['VoiceQueueReport'][_0xed68('0x50')](_0xe83c18)[_0xed68('0x2b')](handleEntityNotFound(_0x4d5d7a,null))[_0xed68('0x2b')](respondWithResult(_0x4d5d7a,null))[_0xed68('0x51')](handleError(_0x4d5d7a,null));};exports[_0xed68('0x52')]=function(_0x1839ad,_0xef2962){return db[_0xed68('0x32')][_0xed68('0x52')](_0x1839ad[_0xed68('0x53')],{})[_0xed68('0x2b')](respondWithResult(_0xef2962,0xc9))[_0xed68('0x51')](handleError(_0xef2962,null));};exports[_0xed68('0x2a')]=function(_0x35d661,_0x256db6){if(_0x35d661[_0xed68('0x53')]['id']){delete _0x35d661[_0xed68('0x53')]['id'];}return db['VoiceQueueReport'][_0xed68('0x50')]({'where':{'id':_0x35d661['params']['id']}})[_0xed68('0x2b')](handleEntityNotFound(_0x256db6,null))[_0xed68('0x2b')](saveUpdates(_0x35d661[_0xed68('0x53')],null))[_0xed68('0x2b')](respondWithResult(_0x256db6,null))[_0xed68('0x51')](handleError(_0x256db6,null));};exports[_0xed68('0x2c')]=function(_0x211bd4,_0x17ff76){return db[_0xed68('0x32')][_0xed68('0x50')]({'where':{'id':_0x211bd4[_0xed68('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17ff76,null))[_0xed68('0x2b')](removeEntity(_0x17ff76,null))[_0xed68('0x51')](handleError(_0x17ff76,null));};exports[_0xed68('0x54')]=function(_0x3c38ce,_0x661333){return db[_0xed68('0x32')][_0xed68('0x54')]()[_0xed68('0x2b')](respondWithResult(_0x661333,null))[_0xed68('0x51')](handleError(_0x661333,null));};exports[_0xed68('0x55')]=function(_0x4278ac,_0x4ca867){var _0x316279={},_0x1bccab={},_0x358458={'count':0x0,'rows':[]};_0x1bccab[_0xed68('0x37')]=_[_0xed68('0x3a')](db[_0xed68('0x32')][_0xed68('0x33')]);_0x1bccab[_0xed68('0x39')]=_[_0xed68('0x3a')](_0x4278ac['query']);_0x1bccab[_0xed68('0x3b')]=_[_0xed68('0x3c')](_0x1bccab[_0xed68('0x37')],_0x1bccab['query']);_0x316279[_0xed68('0x3d')]=_[_0xed68('0x3c')](_0x1bccab[_0xed68('0x37')],qs[_0xed68('0x3e')](_0x4278ac[_0xed68('0x39')][_0xed68('0x3e')]));_0x316279[_0xed68('0x3d')]=_0x316279['attributes'][_0xed68('0x3f')]?_0x316279[_0xed68('0x3d')]:_0x1bccab['model'];if(!_0x4278ac['query']['hasOwnProperty']('nolimit')){_0x316279[_0xed68('0x26')]=qs['limit'](_0x4278ac[_0xed68('0x39')][_0xed68('0x26')]);_0x316279['offset']=qs['offset'](_0x4278ac[_0xed68('0x39')][_0xed68('0x23')]);}_0x316279[_0xed68('0x42')]=qs[_0xed68('0x43')](_0x4278ac[_0xed68('0x39')][_0xed68('0x43')]);_0x316279['where']=qs[_0xed68('0x3b')](_[_0xed68('0x45')](_0x4278ac['query'],_0x1bccab[_0xed68('0x3b')]));if(_0x4278ac[_0xed68('0x39')]['filter']){_0x316279[_0xed68('0x44')]=_[_0xed68('0x47')](_0x316279['where'],{'$or':_[_0xed68('0x38')](_0x316279['attributes'],function(_0x5f5b14){var _0x298983={};_0x298983[_0x5f5b14]={'$like':'%'+_0x4278ac['query'][_0xed68('0x46')]+'%'};return _0x298983;})});}_0x316279=_['merge']({},_0x316279,_0x4278ac[_0xed68('0x49')]);var _0x3d0d54={'where':_0x316279[_0xed68('0x44')]};return db['VoiceQueueReport'][_0xed68('0x25')](_0x3d0d54)['then'](function(_0x1dbfe1){_0x358458[_0xed68('0x25')]=_0x1dbfe1;if(_0x4278ac[_0xed68('0x39')][_0xed68('0x4a')]){_0x316279['include']=[{'all':!![]}];}return db[_0xed68('0x32')][_0xed68('0x4b')](_0x316279);})[_0xed68('0x2b')](function(_0x217b1e){_0x358458['rows']=_0x217b1e;return _0x358458;})[_0xed68('0x2b')](respondWithFilteredResult(_0x4ca867,_0x316279,_0xed68('0x55')))[_0xed68('0x51')](handleError(_0x4ca867,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x3e45=['rimraf','zip-dir','request-promise','moment','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','describe','findAll','getVoiceQueuesReport','eml-format'];(function(_0x3a7496,_0x2b0dc1){var _0xdf3c20=function(_0x2b0cb0){while(--_0x2b0cb0){_0x3a7496['push'](_0x3a7496['shift']());}};_0xdf3c20(++_0x2b0dc1);}(_0x3e45,0x104));var _0x53e4=function(_0x2bfab4,_0xa044e4){_0x2bfab4=_0x2bfab4-0x0;var _0x26b2f3=_0x3e45[_0x2bfab4];return _0x26b2f3;};'use strict';var emlformat=require(_0x53e4('0x0'));var rimraf=require(_0x53e4('0x1'));var zipdir=require(_0x53e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53e4('0x3'));var moment=require(_0x53e4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53e4('0x5'));var path=require(_0x53e4('0x6'));var sox=require(_0x53e4('0x7'));var csv=require(_0x53e4('0x8'));var ejs=require(_0x53e4('0x9'));var fs=require('fs');var fs_extra=require(_0x53e4('0xa'));var _=require('lodash');var squel=require(_0x53e4('0xb'));var crypto=require(_0x53e4('0xc'));var jsforce=require(_0x53e4('0xd'));var deskjs=require(_0x53e4('0xe'));var toCsv=require(_0x53e4('0x8'));var querystring=require(_0x53e4('0xf'));var Papa=require(_0x53e4('0x10'));var Redis=require(_0x53e4('0x11'));var authService=require(_0x53e4('0x12'));var qs=require(_0x53e4('0x13'));var as=require(_0x53e4('0x14'));var hardwareService=require(_0x53e4('0x15'));var logger=require(_0x53e4('0x16'))(_0x53e4('0x17'));var utils=require(_0x53e4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x53e4('0x19'));var db=require(_0x53e4('0x1a'))['db'];config[_0x53e4('0x1b')]=_[_0x53e4('0x1c')](config[_0x53e4('0x1b')],{'host':_0x53e4('0x1d'),'port':0x18eb});var socket=require(_0x53e4('0x1e'))(new Redis(config[_0x53e4('0x1b')]));require(_0x53e4('0x1f'))[_0x53e4('0x20')](socket);function respondWithStatusCode(_0x398a45,_0x57536f){_0x57536f=_0x57536f||0xcc;return function(_0x1ce99a){if(_0x1ce99a){return _0x398a45[_0x53e4('0x21')](_0x57536f);}return _0x398a45[_0x53e4('0x22')](_0x57536f)[_0x53e4('0x23')]();};}function respondWithResult(_0x4bf823,_0x3820ff){_0x3820ff=_0x3820ff||0xc8;return function(_0x9a731a){if(_0x9a731a){return _0x4bf823[_0x53e4('0x22')](_0x3820ff)[_0x53e4('0x24')](_0x9a731a);}};}function respondWithFilteredResult(_0x4731b5,_0xd1d901){return function(_0x4ed146){if(_0x4ed146){var _0x3d5009=typeof _0xd1d901[_0x53e4('0x25')]===_0x53e4('0x26')&&typeof _0xd1d901[_0x53e4('0x27')]==='undefined';var _0x5dc1b1=_0x4ed146[_0x53e4('0x28')];var _0xf37fe2=_0x3d5009?0x0:_0xd1d901[_0x53e4('0x25')];var _0x553342=_0x3d5009?_0x4ed146[_0x53e4('0x28')]:_0xd1d901[_0x53e4('0x25')]+_0xd1d901[_0x53e4('0x27')];var _0x7bdf75;if(_0x553342>=_0x5dc1b1){_0x553342=_0x5dc1b1;_0x7bdf75=0xc8;}else{_0x7bdf75=0xce;}_0x4731b5[_0x53e4('0x22')](_0x7bdf75);return _0x4731b5['set'](_0x53e4('0x29'),_0xf37fe2+'-'+_0x553342+'/'+_0x5dc1b1)[_0x53e4('0x24')](_0x4ed146);}return null;};}function patchUpdates(_0x4aab1c){return function(_0x430d76){try{jsonpatch['apply'](_0x430d76,_0x4aab1c,!![]);}catch(_0x2db7fa){return BPromise[_0x53e4('0x2a')](_0x2db7fa);}return _0x430d76[_0x53e4('0x2b')]();};}function saveUpdates(_0x2b4706,_0x331d62){return function(_0x5e7470){if(_0x5e7470){return _0x5e7470[_0x53e4('0x2c')](_0x2b4706)['then'](function(_0x57baf4){return _0x57baf4;});}return null;};}function removeEntity(_0x2e8b0e,_0x212664){return function(_0x414d7c){if(_0x414d7c){return _0x414d7c[_0x53e4('0x2d')]()[_0x53e4('0x2e')](function(){_0x2e8b0e[_0x53e4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d6ef,_0x20eb05){return function(_0x16eea5){if(!_0x16eea5){_0x26d6ef[_0x53e4('0x21')](0x194);}return _0x16eea5;};}function handleError(_0x233ada,_0x526727){_0x526727=_0x526727||0x1f4;return function(_0x492e8c){logger['error'](_0x492e8c[_0x53e4('0x2f')]);if(_0x492e8c[_0x53e4('0x30')]){delete _0x492e8c[_0x53e4('0x30')];}_0x233ada[_0x53e4('0x22')](_0x526727)[_0x53e4('0x31')](_0x492e8c);};}exports[_0x53e4('0x32')]=function(_0x21e62e,_0x254979){var _0x3eebfb={},_0x4e71af={},_0x392003={'count':0x0,'rows':[]};var _0x473d0a=_['map'](db[_0x53e4('0x33')][_0x53e4('0x34')],function(_0x358c90){return{'name':_0x358c90[_0x53e4('0x35')],'type':_0x358c90[_0x53e4('0x36')][_0x53e4('0x37')]};});_0x4e71af[_0x53e4('0x38')]=_[_0x53e4('0x39')](_0x473d0a,_0x53e4('0x30'));_0x4e71af[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x21e62e[_0x53e4('0x3a')]);_0x4e71af[_0x53e4('0x3c')]=_[_0x53e4('0x3d')](_0x4e71af[_0x53e4('0x38')],_0x4e71af[_0x53e4('0x3a')]);_0x3eebfb[_0x53e4('0x3e')]=_[_0x53e4('0x3d')](_0x4e71af[_0x53e4('0x38')],qs['fields'](_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x3eebfb['attributes']=_0x3eebfb[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x3eebfb['attributes']:_0x4e71af[_0x53e4('0x38')];if(!_0x21e62e['query'][_0x53e4('0x41')](_0x53e4('0x42'))){_0x3eebfb[_0x53e4('0x27')]=qs[_0x53e4('0x27')](_0x21e62e['query']['limit']);_0x3eebfb['offset']=qs[_0x53e4('0x25')](_0x21e62e['query'][_0x53e4('0x25')]);}_0x3eebfb[_0x53e4('0x43')]=qs[_0x53e4('0x44')](_0x21e62e[_0x53e4('0x3a')]['sort']);_0x3eebfb[_0x53e4('0x45')]=qs[_0x53e4('0x3c')](_[_0x53e4('0x46')](_0x21e62e[_0x53e4('0x3a')],_0x4e71af[_0x53e4('0x3c')]),_0x473d0a);if(_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x47')]){_0x3eebfb[_0x53e4('0x45')]=_['merge'](_0x3eebfb[_0x53e4('0x45')],{'$or':_[_0x53e4('0x39')](_0x473d0a,function(_0x356753){if(_0x356753[_0x53e4('0x36')]!==_0x53e4('0x48')){var _0x46addd={};_0x46addd[_0x356753['name']]={'$like':'%'+_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x47')]+'%'};return _0x46addd;}})});}_0x3eebfb=_[_0x53e4('0x49')]({},_0x3eebfb,_0x21e62e[_0x53e4('0x4a')]);var _0x473722={'where':_0x3eebfb[_0x53e4('0x45')]};return db[_0x53e4('0x33')]['count'](_0x473722)[_0x53e4('0x2e')](function(_0x292bac){_0x392003[_0x53e4('0x28')]=_0x292bac;if(_0x21e62e['query']['includeAll']){_0x3eebfb[_0x53e4('0x4b')]=[{'all':!![]}];}return db[_0x53e4('0x33')]['findAll'](_0x3eebfb);})[_0x53e4('0x2e')](function(_0x44c74e){_0x392003[_0x53e4('0x4c')]=_0x44c74e;return _0x392003;})[_0x53e4('0x2e')](respondWithFilteredResult(_0x254979,_0x3eebfb))[_0x53e4('0x4d')](handleError(_0x254979,null));};exports[_0x53e4('0x4e')]=function(_0x196133,_0x50496f){var _0x59c86a={'raw':![],'where':{'id':_0x196133[_0x53e4('0x4f')]['id']}},_0x1c9c86={};_0x1c9c86[_0x53e4('0x38')]=_['keys'](db[_0x53e4('0x33')]['rawAttributes']);_0x1c9c86[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x196133[_0x53e4('0x3a')]);_0x1c9c86[_0x53e4('0x3c')]=_[_0x53e4('0x3d')](_0x1c9c86[_0x53e4('0x38')],_0x1c9c86['query']);_0x59c86a['attributes']=_[_0x53e4('0x3d')](_0x1c9c86[_0x53e4('0x38')],qs['fields'](_0x196133[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x59c86a[_0x53e4('0x3e')]=_0x59c86a[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x59c86a[_0x53e4('0x3e')]:_0x1c9c86[_0x53e4('0x38')];if(_0x196133[_0x53e4('0x3a')][_0x53e4('0x50')]){_0x59c86a['include']=[{'all':!![]}];}_0x59c86a=_[_0x53e4('0x49')]({},_0x59c86a,_0x196133['options']);return db[_0x53e4('0x33')][_0x53e4('0x51')](_0x59c86a)[_0x53e4('0x2e')](handleEntityNotFound(_0x50496f,null))[_0x53e4('0x2e')](respondWithResult(_0x50496f,null))['catch'](handleError(_0x50496f,null));};exports[_0x53e4('0x52')]=function(_0x2230ee,_0xf193b1){return db[_0x53e4('0x33')][_0x53e4('0x52')](_0x2230ee[_0x53e4('0x53')],{})['then'](respondWithResult(_0xf193b1,0xc9))[_0x53e4('0x4d')](handleError(_0xf193b1,null));};exports[_0x53e4('0x2c')]=function(_0x5c4ec1,_0x2d7e92){if(_0x5c4ec1['body']['id']){delete _0x5c4ec1[_0x53e4('0x53')]['id'];}return db[_0x53e4('0x33')][_0x53e4('0x51')]({'where':{'id':_0x5c4ec1[_0x53e4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d7e92,null))[_0x53e4('0x2e')](saveUpdates(_0x5c4ec1[_0x53e4('0x53')],null))[_0x53e4('0x2e')](respondWithResult(_0x2d7e92,null))[_0x53e4('0x4d')](handleError(_0x2d7e92,null));};exports[_0x53e4('0x2d')]=function(_0x276c2d,_0x4b47a0){return db[_0x53e4('0x33')][_0x53e4('0x51')]({'where':{'id':_0x276c2d[_0x53e4('0x4f')]['id']}})[_0x53e4('0x2e')](handleEntityNotFound(_0x4b47a0,null))[_0x53e4('0x2e')](removeEntity(_0x4b47a0,null))[_0x53e4('0x4d')](handleError(_0x4b47a0,null));};exports[_0x53e4('0x54')]=function(_0x22e89e,_0x5a91fc){return db[_0x53e4('0x33')][_0x53e4('0x54')]()['then'](respondWithResult(_0x5a91fc,null))[_0x53e4('0x4d')](handleError(_0x5a91fc,null));};exports['getVoiceQueuesReport']=function(_0x5ce7e9,_0x4b8f7e){var _0x2952e6={},_0x13bd89={},_0x3fd2bf={'count':0x0,'rows':[]};_0x13bd89['model']=_[_0x53e4('0x3b')](db[_0x53e4('0x33')][_0x53e4('0x34')]);_0x13bd89[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x5ce7e9[_0x53e4('0x3a')]);_0x13bd89[_0x53e4('0x3c')]=_['intersection'](_0x13bd89[_0x53e4('0x38')],_0x13bd89[_0x53e4('0x3a')]);_0x2952e6[_0x53e4('0x3e')]=_[_0x53e4('0x3d')](_0x13bd89[_0x53e4('0x38')],qs[_0x53e4('0x3f')](_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x2952e6[_0x53e4('0x3e')]=_0x2952e6[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x2952e6[_0x53e4('0x3e')]:_0x13bd89[_0x53e4('0x38')];if(!_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x41')]('nolimit')){_0x2952e6[_0x53e4('0x27')]=qs[_0x53e4('0x27')](_0x5ce7e9[_0x53e4('0x3a')]['limit']);_0x2952e6[_0x53e4('0x25')]=qs[_0x53e4('0x25')](_0x5ce7e9[_0x53e4('0x3a')]['offset']);}_0x2952e6[_0x53e4('0x43')]=qs[_0x53e4('0x44')](_0x5ce7e9['query'][_0x53e4('0x44')]);_0x2952e6['where']=qs[_0x53e4('0x3c')](_[_0x53e4('0x46')](_0x5ce7e9['query'],_0x13bd89[_0x53e4('0x3c')]));if(_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x47')]){_0x2952e6[_0x53e4('0x45')]=_[_0x53e4('0x49')](_0x2952e6['where'],{'$or':_[_0x53e4('0x39')](_0x2952e6[_0x53e4('0x3e')],function(_0x1148b8){var _0x198acd={};_0x198acd[_0x1148b8]={'$like':'%'+_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x47')]+'%'};return _0x198acd;})});}_0x2952e6=_[_0x53e4('0x49')]({},_0x2952e6,_0x5ce7e9[_0x53e4('0x4a')]);var _0x15940c={'where':_0x2952e6['where']};return db['VoiceQueueReport']['count'](_0x15940c)[_0x53e4('0x2e')](function(_0x24432a){_0x3fd2bf[_0x53e4('0x28')]=_0x24432a;if(_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x50')]){_0x2952e6[_0x53e4('0x4b')]=[{'all':!![]}];}return db[_0x53e4('0x33')][_0x53e4('0x55')](_0x2952e6);})[_0x53e4('0x2e')](function(_0xb70e7e){_0x3fd2bf[_0x53e4('0x4c')]=_0xb70e7e;return _0x3fd2bf;})['then'](respondWithFilteredResult(_0x4b8f7e,_0x2952e6,_0x53e4('0x56')))[_0x53e4('0x4d')](handleError(_0x4b8f7e,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 715ba37..9f82c93 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 _0x2ff4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0xc80d54,_0x39a6a7){var _0x308fc6=function(_0x23cb71){while(--_0x23cb71){_0xc80d54['push'](_0xc80d54['shift']());}};_0x308fc6(++_0x39a6a7);}(_0x2ff4,0x1ac));var _0x42ff=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x2ff4[_0x5be7aa];return _0x215408;};'use strict';var EventEmitter=require(_0x42ff('0x0'));var VoiceQueueReport=require(_0x42ff('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x42ff('0x2'),'afterUpdate':_0x42ff('0x3'),'afterDestroy':_0x42ff('0x4')};function emitEvent(_0x4d0f95){return function(_0x4cdfdd,_0x5b308b,_0x33f312){VoiceQueueReportEvents[_0x42ff('0x5')](_0x4d0f95+':'+_0x4cdfdd['id'],_0x4cdfdd);VoiceQueueReportEvents[_0x42ff('0x5')](_0x4d0f95,_0x4cdfdd);_0x33f312(null);};}for(var e in events){if(events[_0x42ff('0x6')](e)){var event=events[e];VoiceQueueReport[_0x42ff('0x7')](e,emitEvent(event));}}module[_0x42ff('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4958=['update','emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','save'];(function(_0xb267b0,_0x42b85c){var _0x31338f=function(_0x245c05){while(--_0x245c05){_0xb267b0['push'](_0xb267b0['shift']());}};_0x31338f(++_0x42b85c);}(_0x4958,0x1f4));var _0x8495=function(_0x3219a5,_0x2f68bc){_0x3219a5=_0x3219a5-0x0;var _0x24f1f9=_0x4958[_0x3219a5];return _0x24f1f9;};'use strict';var EventEmitter=require(_0x8495('0x0'));var VoiceQueueReport=require(_0x8495('0x1'))['db'][_0x8495('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8495('0x3'),'afterUpdate':_0x8495('0x4'),'afterDestroy':'remove'};function emitEvent(_0x505a1f){return function(_0x4eb815,_0x5cee61,_0x72fe22){VoiceQueueReportEvents[_0x8495('0x5')](_0x505a1f+':'+_0x4eb815['id'],_0x4eb815);VoiceQueueReportEvents[_0x8495('0x5')](_0x505a1f,_0x4eb815);_0x72fe22(null);};}for(var e in events){if(events[_0x8495('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 67505a8..4eecf84 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 _0x9541=['define','VoiceQueueReport','report_queue','uniqueid','util','api','moment','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x58e561,_0x1a5c8c){var _0x21aa40=function(_0xe5d01a){while(--_0xe5d01a){_0x58e561['push'](_0x58e561['shift']());}};_0x21aa40(++_0x1a5c8c);}(_0x9541,0x7d));var _0x1954=function(_0x2de68c,_0x4246e4){_0x2de68c=_0x2de68c-0x0;var _0x4b943a=_0x9541[_0x2de68c];return _0x4b943a;};'use strict';var _=require('lodash');var util=require(_0x1954('0x0'));var logger=require('../../config/logger')(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1954('0x3'));var config=require(_0x1954('0x4'));var attributes=require(_0x1954('0x5'));module[_0x1954('0x6')]=function(_0x3f06ae,_0x746cdf){return _0x3f06ae[_0x1954('0x7')](_0x1954('0x8'),attributes,{'tableName':_0x1954('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1954('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0677=['api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0677,0xed));var _0x7067=function(_0x263a16,_0x489c01){_0x263a16=_0x263a16-0x0;var _0x251824=_0x0677[_0x263a16];return _0x251824;};'use strict';var _=require(_0x7067('0x0'));var util=require(_0x7067('0x1'));var logger=require(_0x7067('0x2'))(_0x7067('0x3'));var moment=require(_0x7067('0x4'));var BPromise=require(_0x7067('0x5'));var rp=require(_0x7067('0x6'));var fs=require('fs');var path=require(_0x7067('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7067('0x8'));module[_0x7067('0x9')]=function(_0x5977d2,_0x5e47c5){return _0x5977d2[_0x7067('0xa')](_0x7067('0xb'),attributes,{'tableName':_0x7067('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7067('0xd')]},{'fields':[_0x7067('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 901c660..652d1bd 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 _0xf08a=['CreateVoiceQueueReport','create','body','then','UpdateVoiceQueueReport','update','limit','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','map','model','attributes','include'];(function(_0x4424ec,_0x37ca08){var _0x2d1c5c=function(_0x3824be){while(--_0x3824be){_0x4424ec['push'](_0x4424ec['shift']());}};_0x2d1c5c(++_0x37ca08);}(_0xf08a,0x1f3));var _0xaf08=function(_0x1144e2,_0x5b034f){_0x1144e2=_0x1144e2-0x0;var _0x29d5b3=_0xf08a[_0x1144e2];return _0x29d5b3;};'use strict';var _=require('lodash');var util=require(_0xaf08('0x0'));var moment=require(_0xaf08('0x1'));var BPromise=require('bluebird');var rs=require(_0xaf08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf08('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf08('0x4'));var config=require(_0xaf08('0x5'));var jayson=require(_0xaf08('0x6'));var client=jayson[_0xaf08('0x7')]['http']({'port':0x232a});config[_0xaf08('0x8')]=_[_0xaf08('0x9')](config[_0xaf08('0x8')],{'host':_0xaf08('0xa'),'port':0x18eb});var socket=require(_0xaf08('0xb'))(new Redis(config[_0xaf08('0x8')]));require(_0xaf08('0xc'))[_0xaf08('0xd')](socket);function respondWithRpcPromise(_0x4bae96,_0x576fd4,_0x4aabcb){return new BPromise(function(_0x5c160d,_0x24f0fc){return client[_0xaf08('0xe')](_0x4bae96,_0x4aabcb)['then'](function(_0x546408){logger[_0xaf08('0xf')](_0xaf08('0x10'),_0x576fd4,'request\x20sent');logger[_0xaf08('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x576fd4,_0xaf08('0x12'),JSON[_0xaf08('0x13')](_0x546408));if(_0x546408['error']){if(_0x546408[_0xaf08('0x14')]['code']===0x1f4){logger[_0xaf08('0x14')](_0xaf08('0x10'),_0x576fd4,_0x546408[_0xaf08('0x14')]['message']);return _0x24f0fc(_0x546408[_0xaf08('0x14')][_0xaf08('0x15')]);}logger['error'](_0xaf08('0x10'),_0x576fd4,_0x546408[_0xaf08('0x14')][_0xaf08('0x15')]);return _0x5c160d(_0x546408['error'][_0xaf08('0x15')]);}else{logger[_0xaf08('0xf')](_0xaf08('0x10'),_0x576fd4,_0xaf08('0x12'));_0x5c160d(_0x546408[_0xaf08('0x16')][_0xaf08('0x15')]);}})[_0xaf08('0x17')](function(_0x4f765){logger[_0xaf08('0x14')](_0xaf08('0x10'),_0x576fd4,_0x4f765);_0x24f0fc(_0x4f765);});});}exports[_0xaf08('0x18')]=function(_0x238d26){var _0x501be6=this;return new Promise(function(_0x29fc63,_0x1dc622){return db[_0xaf08('0x19')][_0xaf08('0x1a')]({'raw':_0x238d26[_0xaf08('0x1b')]?_0x238d26['options'][_0xaf08('0x1c')]===undefined?!![]:![]:!![],'where':_0x238d26['options']?_0x238d26['options'][_0xaf08('0x1d')]||null:null,'attributes':_0x238d26['options']?_0x238d26[_0xaf08('0x1b')]['attributes']||null:null,'limit':_0x238d26[_0xaf08('0x1b')]?_0x238d26[_0xaf08('0x1b')]['limit']||null:null,'include':_0x238d26[_0xaf08('0x1b')]?_0x238d26['options']['include']?_[_0xaf08('0x1e')](_0x238d26[_0xaf08('0x1b')]['include'],function(_0x301bab){return{'model':db[_0x301bab[_0xaf08('0x1f')]],'as':_0x301bab['as'],'attributes':_0x301bab[_0xaf08('0x20')],'include':_0x301bab['include']?_[_0xaf08('0x1e')](_0x301bab[_0xaf08('0x21')],function(_0x241e06){return{'model':db[_0x241e06['model']],'as':_0x241e06['as'],'attributes':_0x241e06[_0xaf08('0x20')],'include':_0x241e06[_0xaf08('0x21')]?_[_0xaf08('0x1e')](_0x241e06[_0xaf08('0x21')],function(_0x51e582){return{'model':db[_0x51e582[_0xaf08('0x1f')]],'as':_0x51e582['as'],'attributes':_0x51e582[_0xaf08('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x439f04){logger[_0xaf08('0xf')]('GetVoiceQueueReport',_0x238d26);logger[_0xaf08('0x11')](_0xaf08('0x18'),_0x238d26,JSON[_0xaf08('0x13')](_0x439f04));_0x29fc63(_0x439f04);})['catch'](function(_0x2400dc){logger[_0xaf08('0x14')](_0xaf08('0x18'),_0x2400dc['message'],_0x238d26);_0x1dc622(_0x501be6['error'](0x1f4,_0x2400dc[_0xaf08('0x15')]));});});};exports[_0xaf08('0x22')]=function(_0xa9fbee){var _0x3e65b0=this;return new Promise(function(_0x8539c6,_0x1d0d8b){return db['VoiceQueueReport'][_0xaf08('0x23')](_0xa9fbee[_0xaf08('0x24')],{'raw':_0xa9fbee['options']?_0xa9fbee[_0xaf08('0x1b')][_0xaf08('0x1c')]===undefined?!![]:![]:!![]})[_0xaf08('0x25')](function(_0x3aafac){logger[_0xaf08('0xf')](_0xaf08('0x22'),_0xa9fbee);logger[_0xaf08('0x11')]('CreateVoiceQueueReport',_0xa9fbee,JSON['stringify'](_0x3aafac));_0x8539c6(_0x3aafac);})[_0xaf08('0x17')](function(_0x2aa1de){logger['error'](_0xaf08('0x22'),_0x2aa1de[_0xaf08('0x15')],_0xa9fbee);_0x1d0d8b(_0x3e65b0[_0xaf08('0x14')](0x1f4,_0x2aa1de['message']));});});};exports[_0xaf08('0x26')]=function(_0x2f885b){var _0x2c3666=this;return new Promise(function(_0x40ac38,_0x420561){return db[_0xaf08('0x19')][_0xaf08('0x27')](_0x2f885b[_0xaf08('0x24')],{'raw':_0x2f885b[_0xaf08('0x1b')]?_0x2f885b[_0xaf08('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f885b['options']?_0x2f885b['options']['where']||null:null,'attributes':_0x2f885b['options']?_0x2f885b[_0xaf08('0x1b')][_0xaf08('0x20')]||null:null,'limit':_0x2f885b[_0xaf08('0x1b')]?_0x2f885b[_0xaf08('0x1b')][_0xaf08('0x28')]||null:null})[_0xaf08('0x25')](function(_0x56e5c2){logger[_0xaf08('0xf')](_0xaf08('0x26'),_0x2f885b);logger[_0xaf08('0x11')](_0xaf08('0x26'),_0x2f885b,JSON[_0xaf08('0x13')](_0x56e5c2));_0x40ac38(_0x56e5c2);})[_0xaf08('0x17')](function(_0x50453c){logger[_0xaf08('0x14')]('UpdateVoiceQueueReport',_0x50453c['message'],_0x2f885b);_0x420561(_0x2c3666['error'](0x1f4,_0x50453c[_0xaf08('0x15')]));});});}; \ No newline at end of file +var _0x625f=['register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x2cb0e8,_0x5a59bf){var _0x39aa03=function(_0x3e6751){while(--_0x3e6751){_0x2cb0e8['push'](_0x2cb0e8['shift']());}};_0x39aa03(++_0x5a59bf);}(_0x625f,0x1cb));var _0xf625=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x625f[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xf625('0x0'));var util=require('util');var moment=require(_0xf625('0x1'));var BPromise=require(_0xf625('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf625('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf625('0x4'));var logger=require('../../config/logger')(_0xf625('0x5'));var config=require(_0xf625('0x6'));var jayson=require(_0xf625('0x7'));var client=jayson[_0xf625('0x8')][_0xf625('0x9')]({'port':0x232a});config[_0xf625('0xa')]=_['defaults'](config[_0xf625('0xa')],{'host':_0xf625('0xb'),'port':0x18eb});var socket=require(_0xf625('0xc'))(new Redis(config[_0xf625('0xa')]));require(_0xf625('0xd'))[_0xf625('0xe')](socket);function respondWithRpcPromise(_0x53dbfd,_0x2d958c,_0x4e80cb){return new BPromise(function(_0x5567ff,_0x5d8a60){return client['request'](_0x53dbfd,_0x4e80cb)[_0xf625('0xf')](function(_0x242007){logger['info'](_0xf625('0x10'),_0x2d958c,_0xf625('0x11'));logger[_0xf625('0x12')](_0xf625('0x13'),_0x2d958c,_0xf625('0x11'),JSON[_0xf625('0x14')](_0x242007));if(_0x242007[_0xf625('0x15')]){if(_0x242007[_0xf625('0x15')][_0xf625('0x16')]===0x1f4){logger[_0xf625('0x15')](_0xf625('0x10'),_0x2d958c,_0x242007[_0xf625('0x15')][_0xf625('0x17')]);return _0x5d8a60(_0x242007[_0xf625('0x15')][_0xf625('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2d958c,_0x242007[_0xf625('0x15')][_0xf625('0x17')]);return _0x5567ff(_0x242007['error'][_0xf625('0x17')]);}else{logger[_0xf625('0x18')](_0xf625('0x10'),_0x2d958c,_0xf625('0x11'));_0x5567ff(_0x242007[_0xf625('0x19')]['message']);}})['catch'](function(_0x44ce5d){logger[_0xf625('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2d958c,_0x44ce5d);_0x5d8a60(_0x44ce5d);});});}exports[_0xf625('0x1a')]=function(_0x35fbdf){var _0x17865c=this;return new Promise(function(_0x31b043,_0x20cf91){return db[_0xf625('0x1b')][_0xf625('0x1c')]({'raw':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![],'where':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x1f')]||null:null,'attributes':_0x35fbdf['options']?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x20')]||null:null,'limit':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x21')]||null:null,'include':_0x35fbdf['options']?_0x35fbdf['options'][_0xf625('0x22')]?_[_0xf625('0x23')](_0x35fbdf['options'][_0xf625('0x22')],function(_0x646fae){return{'model':db[_0x646fae['model']],'as':_0x646fae['as'],'attributes':_0x646fae[_0xf625('0x20')],'include':_0x646fae[_0xf625('0x22')]?_[_0xf625('0x23')](_0x646fae['include'],function(_0x44841e){return{'model':db[_0x44841e[_0xf625('0x24')]],'as':_0x44841e['as'],'attributes':_0x44841e['attributes'],'include':_0x44841e[_0xf625('0x22')]?_[_0xf625('0x23')](_0x44841e[_0xf625('0x22')],function(_0x1bbcf4){return{'model':db[_0x1bbcf4[_0xf625('0x24')]],'as':_0x1bbcf4['as'],'attributes':_0x1bbcf4[_0xf625('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf625('0xf')](function(_0x458711){logger[_0xf625('0x18')](_0xf625('0x1a'),_0x35fbdf);logger[_0xf625('0x12')]('GetVoiceQueueReport',_0x35fbdf,JSON[_0xf625('0x14')](_0x458711));_0x31b043(_0x458711);})[_0xf625('0x25')](function(_0x13e5e7){logger[_0xf625('0x15')]('GetVoiceQueueReport',_0x13e5e7[_0xf625('0x17')],_0x35fbdf);_0x20cf91(_0x17865c[_0xf625('0x15')](0x1f4,_0x13e5e7[_0xf625('0x17')]));});});};exports[_0xf625('0x26')]=function(_0x584baf){var _0x4faac6=this;return new Promise(function(_0x51dfb9,_0xae407c){return db['VoiceQueueReport'][_0xf625('0x27')](_0x584baf[_0xf625('0x28')],{'raw':_0x584baf[_0xf625('0x1d')]?_0x584baf[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4ebb93){logger[_0xf625('0x18')]('CreateVoiceQueueReport',_0x584baf);logger[_0xf625('0x12')](_0xf625('0x26'),_0x584baf,JSON['stringify'](_0x4ebb93));_0x51dfb9(_0x4ebb93);})[_0xf625('0x25')](function(_0x378e62){logger[_0xf625('0x15')](_0xf625('0x26'),_0x378e62[_0xf625('0x17')],_0x584baf);_0xae407c(_0x4faac6[_0xf625('0x15')](0x1f4,_0x378e62[_0xf625('0x17')]));});});};exports[_0xf625('0x29')]=function(_0x21df1d){var _0x123a23=this;return new Promise(function(_0x5877c9,_0x36a6){return db[_0xf625('0x1b')][_0xf625('0x2a')](_0x21df1d[_0xf625('0x28')],{'raw':_0x21df1d['options']?_0x21df1d[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21df1d[_0xf625('0x1d')]?_0x21df1d['options'][_0xf625('0x1f')]||null:null,'attributes':_0x21df1d['options']?_0x21df1d[_0xf625('0x1d')]['attributes']||null:null,'limit':_0x21df1d[_0xf625('0x1d')]?_0x21df1d[_0xf625('0x1d')][_0xf625('0x21')]||null:null})['then'](function(_0x1c10b5){logger['info'](_0xf625('0x29'),_0x21df1d);logger[_0xf625('0x12')](_0xf625('0x29'),_0x21df1d,JSON[_0xf625('0x14')](_0x1c10b5));_0x5877c9(_0x1c10b5);})[_0xf625('0x25')](function(_0x245faa){logger[_0xf625('0x15')](_0xf625('0x29'),_0x245faa[_0xf625('0x17')],_0x21df1d);_0x36a6(_0x123a23['error'](0x1f4,_0x245faa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 52b8dd9..837ca0b 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 _0x1247=['register','length','./voiceQueueReport.events','save','removeListener'];(function(_0x2d52aa,_0x4179e9){var _0xde20c5=function(_0x417d46){while(--_0x417d46){_0x2d52aa['push'](_0x2d52aa['shift']());}};_0xde20c5(++_0x4179e9);}(_0x1247,0xb6));var _0x7124=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x1247[_0x16e57d];return _0x40239c;};'use strict';var VoiceQueueReportEvents=require(_0x7124('0x0'));var events=[_0x7124('0x1'),'remove','update'];function createListener(_0xb217bf,_0x461882){return function(_0x37ccf8){_0x461882['emit'](_0xb217bf,_0x37ccf8);};}function removeListener(_0x3bdce3,_0x3ab32e){return function(){VoiceQueueReportEvents[_0x7124('0x2')](_0x3bdce3,_0x3ab32e);};}exports[_0x7124('0x3')]=function(_0x15ba0c){for(var _0x33f61b=0x0,_0x396f11=events[_0x7124('0x4')];_0x33f61b<_0x396f11;_0x33f61b++){var _0x29d7b2=events[_0x33f61b];var _0x3b5a48=createListener('voiceQueueReport:'+_0x29d7b2,_0x15ba0c);VoiceQueueReportEvents['on'](_0x29d7b2,_0x3b5a48);}}; \ No newline at end of file +var _0xe77f=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe77f,0xba));var _0xfe77=function(_0x4a9526,_0x2af39f){_0x4a9526=_0x4a9526-0x0;var _0x1d1220=_0xe77f[_0x4a9526];return _0x1d1220;};'use strict';var VoiceQueueReportEvents=require(_0xfe77('0x0'));var events=[_0xfe77('0x1'),'remove',_0xfe77('0x2')];function createListener(_0x3aee7f,_0x5eef38){return function(_0x1167e5){_0x5eef38[_0xfe77('0x3')](_0x3aee7f,_0x1167e5);};}function removeListener(_0x55a414,_0x150fc9){return function(){VoiceQueueReportEvents[_0xfe77('0x4')](_0x55a414,_0x150fc9);};}exports[_0xfe77('0x5')]=function(_0x1ce970){for(var _0x130b85=0x0,_0x51d137=events['length'];_0x130b85<_0x51d137;_0x130b85++){var _0x1a65af=events[_0x130b85];var _0xc2b8f4=createListener(_0xfe77('0x6')+_0x1a65af,_0x1ce970);VoiceQueueReportEvents['on'](_0x1a65af,_0xc2b8f4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f740cac..1523fa6 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 _0x6ac8=['../../config/environment','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x1b5bba,_0x23766f){var _0x54e586=function(_0x1a29da){while(--_0x1a29da){_0x1b5bba['push'](_0x1b5bba['shift']());}};_0x54e586(++_0x23766f);}(_0x6ac8,0x83));var _0x86ac=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6ac8[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require('multer');var util=require(_0x86ac('0x0'));var path=require('path');var timeout=require(_0x86ac('0x1'));var express=require('express');var router=express[_0x86ac('0x2')]();var fs_extra=require(_0x86ac('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86ac('0x4'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x86ac('0x5')](),controller['index']);router[_0x86ac('0x6')](_0x86ac('0x7'),auth[_0x86ac('0x5')](),controller[_0x86ac('0x8')]);router['post']('/',auth[_0x86ac('0x5')](),controller[_0x86ac('0x9')]);router[_0x86ac('0xa')]('/:id',auth[_0x86ac('0x5')](),controller[_0x86ac('0xb')]);router[_0x86ac('0xc')](_0x86ac('0x7'),auth[_0x86ac('0x5')](),controller[_0x86ac('0xd')]);module[_0x86ac('0xe')]=router; \ No newline at end of file +var _0xc0d2=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','destroy','exports','util','path'];(function(_0x246e29,_0x5f2ca6){var _0x4b73e8=function(_0x386abf){while(--_0x386abf){_0x246e29['push'](_0x246e29['shift']());}};_0x4b73e8(++_0x5f2ca6);}(_0xc0d2,0x98));var _0x2c0d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc0d2[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x2c0d('0x0'));var path=require(_0x2c0d('0x1'));var timeout=require(_0x2c0d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2c0d('0x3'));var auth=require(_0x2c0d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c0d('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x2c0d('0x6')]('/',auth[_0x2c0d('0x7')](),controller[_0x2c0d('0x8')]);router[_0x2c0d('0x6')](_0x2c0d('0x9'),auth[_0x2c0d('0x7')](),controller[_0x2c0d('0xa')]);router['post']('/',auth[_0x2c0d('0x7')](),controller['create']);router[_0x2c0d('0xb')](_0x2c0d('0x9'),auth[_0x2c0d('0x7')](),controller['update']);router['delete'](_0x2c0d('0x9'),auth['isAuthenticated'](),controller[_0x2c0d('0xc')]);module[_0x2c0d('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a948560..a9702d6 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 _0xd2fd=['sequelize','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xd2fd,0x145));var _0xdd2f=function(_0x1cb1f7,_0x3b1212){_0x1cb1f7=_0x1cb1f7-0x0;var _0x1c1df6=_0xd2fd[_0x1cb1f7];return _0x1c1df6;};'use strict';var Sequelize=require(_0xdd2f('0x0'));var moment=require('moment');module[_0xdd2f('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xdd2f('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xdd2f('0x3')](_0xdd2f('0x4'))}}; \ No newline at end of file +var _0x46bc=['moment','STRING','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57aa35,_0x57b75f){var _0x262f15=function(_0x567eb0){while(--_0x567eb0){_0x57aa35['push'](_0x57aa35['shift']());}};_0x262f15(++_0x57b75f);}(_0x46bc,0x1b3));var _0xc46b=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x46bc[_0x1a7550];return _0x426e22;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc46b('0x0'));module['exports']={'time':{'type':Sequelize[_0xc46b('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xc46b('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 16b4a12..1e2ad7f 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 _0x5948=['status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus'];(function(_0x1cd05f,_0x159594){var _0x38418f=function(_0x2b1bce){while(--_0x2b1bce){_0x1cd05f['push'](_0x1cd05f['shift']());}};_0x38418f(++_0x159594);}(_0x5948,0xba));var _0x8594=function(_0x56e2a8,_0x2cf877){_0x56e2a8=_0x56e2a8-0x0;var _0x232412=_0x5948[_0x56e2a8];return _0x232412;};'use strict';var emlformat=require(_0x8594('0x0'));var rimraf=require(_0x8594('0x1'));var zipdir=require(_0x8594('0x2'));var jsonpatch=require(_0x8594('0x3'));var rp=require(_0x8594('0x4'));var moment=require(_0x8594('0x5'));var BPromise=require(_0x8594('0x6'));var Mustache=require('mustache');var util=require(_0x8594('0x7'));var path=require(_0x8594('0x8'));var sox=require(_0x8594('0x9'));var csv=require(_0x8594('0xa'));var ejs=require(_0x8594('0xb'));var fs=require('fs');var fs_extra=require(_0x8594('0xc'));var _=require(_0x8594('0xd'));var squel=require(_0x8594('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8594('0xf'));var toCsv=require(_0x8594('0xa'));var querystring=require('querystring');var Papa=require(_0x8594('0x10'));var Redis=require(_0x8594('0x11'));var authService=require(_0x8594('0x12'));var qs=require(_0x8594('0x13'));var as=require(_0x8594('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8594('0x15'));var utils=require('../../config/utils');var config=require(_0x8594('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132555,_0x22161e){_0x22161e=_0x22161e||0xcc;return function(_0x23c0a0){if(_0x23c0a0){return _0x132555[_0x8594('0x17')](_0x22161e);}return _0x132555[_0x8594('0x18')](_0x22161e)[_0x8594('0x19')]();};}function respondWithResult(_0x155265,_0x489135){_0x489135=_0x489135||0xc8;return function(_0x5720bc){if(_0x5720bc){return _0x155265[_0x8594('0x18')](_0x489135)[_0x8594('0x1a')](_0x5720bc);}};}function respondWithFilteredResult(_0x2924f6,_0x466106){return function(_0x58d052){if(_0x58d052){var _0x114340=typeof _0x466106['offset']===_0x8594('0x1b')&&typeof _0x466106['limit']===_0x8594('0x1b');var _0x298f93=_0x58d052[_0x8594('0x1c')];var _0x2c67ed=_0x114340?0x0:_0x466106['offset'];var _0x2948f2=_0x114340?_0x58d052[_0x8594('0x1c')]:_0x466106[_0x8594('0x1d')]+_0x466106[_0x8594('0x1e')];var _0x28e447;if(_0x2948f2>=_0x298f93){_0x2948f2=_0x298f93;_0x28e447=0xc8;}else{_0x28e447=0xce;}_0x2924f6[_0x8594('0x18')](_0x28e447);return _0x2924f6[_0x8594('0x1f')](_0x8594('0x20'),_0x2c67ed+'-'+_0x2948f2+'/'+_0x298f93)[_0x8594('0x1a')](_0x58d052);}return null;};}function patchUpdates(_0x1896a7){return function(_0x4702f){try{jsonpatch['apply'](_0x4702f,_0x1896a7,!![]);}catch(_0x200c0a){return BPromise[_0x8594('0x21')](_0x200c0a);}return _0x4702f[_0x8594('0x22')]();};}function saveUpdates(_0x3d9bb3,_0xf3cb35){return function(_0x1e086d){if(_0x1e086d){return _0x1e086d[_0x8594('0x23')](_0x3d9bb3)[_0x8594('0x24')](function(_0x573cfb){return _0x573cfb;});}return null;};}function removeEntity(_0x4bfa91,_0x382721){return function(_0xf57cd7){if(_0xf57cd7){return _0xf57cd7[_0x8594('0x25')]()[_0x8594('0x24')](function(){_0x4bfa91[_0x8594('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fcd1,_0x3b7c16){return function(_0x11ea69){if(!_0x11ea69){_0x9fcd1['sendStatus'](0x194);}return _0x11ea69;};}function handleError(_0x1a882a,_0x3e91b2){_0x3e91b2=_0x3e91b2||0x1f4;return function(_0x1da652){logger[_0x8594('0x26')](_0x1da652['stack']);if(_0x1da652['name']){delete _0x1da652[_0x8594('0x27')];}_0x1a882a[_0x8594('0x18')](_0x3e91b2)[_0x8594('0x28')](_0x1da652);};}exports[_0x8594('0x29')]=function(_0x242596,_0x157bce){var _0x5113bd={},_0x11243e={},_0x182bcf={'count':0x0,'rows':[]};var _0x37ffe9=_['map'](db[_0x8594('0x2a')][_0x8594('0x2b')],function(_0x150176){return{'name':_0x150176[_0x8594('0x2c')],'type':_0x150176[_0x8594('0x2d')][_0x8594('0x2e')]};});_0x11243e['model']=_[_0x8594('0x2f')](_0x37ffe9,_0x8594('0x27'));_0x11243e[_0x8594('0x30')]=_['keys'](_0x242596[_0x8594('0x30')]);_0x11243e[_0x8594('0x31')]=_[_0x8594('0x32')](_0x11243e['model'],_0x11243e[_0x8594('0x30')]);_0x5113bd[_0x8594('0x33')]=_[_0x8594('0x32')](_0x11243e[_0x8594('0x34')],qs[_0x8594('0x35')](_0x242596['query'][_0x8594('0x35')]));_0x5113bd['attributes']=_0x5113bd[_0x8594('0x33')]['length']?_0x5113bd[_0x8594('0x33')]:_0x11243e[_0x8594('0x34')];if(!_0x242596[_0x8594('0x30')][_0x8594('0x36')](_0x8594('0x37'))){_0x5113bd[_0x8594('0x1e')]=qs[_0x8594('0x1e')](_0x242596['query'][_0x8594('0x1e')]);_0x5113bd[_0x8594('0x1d')]=qs[_0x8594('0x1d')](_0x242596[_0x8594('0x30')][_0x8594('0x1d')]);}_0x5113bd[_0x8594('0x38')]=qs[_0x8594('0x39')](_0x242596[_0x8594('0x30')][_0x8594('0x39')]);_0x5113bd['where']=qs[_0x8594('0x31')](_['pick'](_0x242596[_0x8594('0x30')],_0x11243e[_0x8594('0x31')]),_0x37ffe9);if(_0x242596[_0x8594('0x30')][_0x8594('0x3a')]){_0x5113bd[_0x8594('0x3b')]=_[_0x8594('0x3c')](_0x5113bd['where'],{'$or':_[_0x8594('0x2f')](_0x37ffe9,function(_0xbdb508){if(_0xbdb508['type']!=='VIRTUAL'){var _0xa6cd7e={};_0xa6cd7e[_0xbdb508[_0x8594('0x27')]]={'$like':'%'+_0x242596[_0x8594('0x30')]['filter']+'%'};return _0xa6cd7e;}})});}_0x5113bd=_[_0x8594('0x3c')]({},_0x5113bd,_0x242596[_0x8594('0x3d')]);var _0x5098b0={'where':_0x5113bd[_0x8594('0x3b')]};return db[_0x8594('0x2a')][_0x8594('0x1c')](_0x5098b0)[_0x8594('0x24')](function(_0x4de512){_0x182bcf[_0x8594('0x1c')]=_0x4de512;if(_0x242596[_0x8594('0x30')][_0x8594('0x3e')]){_0x5113bd[_0x8594('0x3f')]=[{'all':!![]}];}return db[_0x8594('0x2a')]['findAll'](_0x5113bd);})[_0x8594('0x24')](function(_0x2b1eaf){_0x182bcf['rows']=_0x2b1eaf;return _0x182bcf;})[_0x8594('0x24')](respondWithFilteredResult(_0x157bce,_0x5113bd))['catch'](handleError(_0x157bce,null));};exports['show']=function(_0x283629,_0x5de154){var _0x1617eb={'raw':!![],'where':{'id':_0x283629[_0x8594('0x40')]['id']}},_0x2fdbb4={};_0x2fdbb4['model']=_[_0x8594('0x41')](db[_0x8594('0x2a')][_0x8594('0x2b')]);_0x2fdbb4[_0x8594('0x30')]=_[_0x8594('0x41')](_0x283629[_0x8594('0x30')]);_0x2fdbb4[_0x8594('0x31')]=_[_0x8594('0x32')](_0x2fdbb4['model'],_0x2fdbb4[_0x8594('0x30')]);_0x1617eb[_0x8594('0x33')]=_[_0x8594('0x32')](_0x2fdbb4[_0x8594('0x34')],qs[_0x8594('0x35')](_0x283629[_0x8594('0x30')]['fields']));_0x1617eb[_0x8594('0x33')]=_0x1617eb['attributes']['length']?_0x1617eb[_0x8594('0x33')]:_0x2fdbb4[_0x8594('0x34')];if(_0x283629[_0x8594('0x30')][_0x8594('0x3e')]){_0x1617eb[_0x8594('0x3f')]=[{'all':!![]}];}_0x1617eb=_[_0x8594('0x3c')]({},_0x1617eb,_0x283629[_0x8594('0x3d')]);return db['VoiceQueuesLog'][_0x8594('0x42')](_0x1617eb)[_0x8594('0x24')](handleEntityNotFound(_0x5de154,null))[_0x8594('0x24')](respondWithResult(_0x5de154,null))[_0x8594('0x43')](handleError(_0x5de154,null));};exports['create']=function(_0x5148b3,_0x3d48e5){return db[_0x8594('0x2a')][_0x8594('0x44')](_0x5148b3[_0x8594('0x45')],{})[_0x8594('0x24')](respondWithResult(_0x3d48e5,0xc9))[_0x8594('0x43')](handleError(_0x3d48e5,null));};exports[_0x8594('0x23')]=function(_0x546ebd,_0x463b2d){if(_0x546ebd[_0x8594('0x45')]['id']){delete _0x546ebd[_0x8594('0x45')]['id'];}return db[_0x8594('0x2a')][_0x8594('0x42')]({'where':{'id':_0x546ebd[_0x8594('0x40')]['id']}})['then'](handleEntityNotFound(_0x463b2d,null))[_0x8594('0x24')](saveUpdates(_0x546ebd[_0x8594('0x45')],null))[_0x8594('0x24')](respondWithResult(_0x463b2d,null))[_0x8594('0x43')](handleError(_0x463b2d,null));};exports[_0x8594('0x25')]=function(_0x489d11,_0x215a4a){return db['VoiceQueuesLog'][_0x8594('0x42')]({'where':{'id':_0x489d11[_0x8594('0x40')]['id']}})[_0x8594('0x24')](handleEntityNotFound(_0x215a4a,null))['then'](removeEntity(_0x215a4a,null))['catch'](handleError(_0x215a4a,null));}; \ No newline at end of file +var _0xa9f8=['ejs','fs-extra','lodash','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','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','VoiceQueuesLog','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv'];(function(_0x8c06f7,_0x28822c){var _0x4705c3=function(_0x5edd0e){while(--_0x5edd0e){_0x8c06f7['push'](_0x8c06f7['shift']());}};_0x4705c3(++_0x28822c);}(_0xa9f8,0x1a9));var _0x8a9f=function(_0x9165ab,_0x36d81b){_0x9165ab=_0x9165ab-0x0;var _0x31082a=_0xa9f8[_0x9165ab];return _0x31082a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a9f('0x0'));var zipdir=require(_0x8a9f('0x1'));var jsonpatch=require(_0x8a9f('0x2'));var rp=require(_0x8a9f('0x3'));var moment=require(_0x8a9f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8a9f('0x5'));var sox=require('sox');var csv=require(_0x8a9f('0x6'));var ejs=require(_0x8a9f('0x7'));var fs=require('fs');var fs_extra=require(_0x8a9f('0x8'));var _=require(_0x8a9f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a9f('0xa'));var deskjs=require(_0x8a9f('0xb'));var toCsv=require(_0x8a9f('0x6'));var querystring=require(_0x8a9f('0xc'));var Papa=require(_0x8a9f('0xd'));var Redis=require(_0x8a9f('0xe'));var authService=require(_0x8a9f('0xf'));var qs=require(_0x8a9f('0x10'));var as=require(_0x8a9f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a9f('0x12'))(_0x8a9f('0x13'));var utils=require(_0x8a9f('0x14'));var config=require(_0x8a9f('0x15'));var licenseUtil=require(_0x8a9f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c117,_0x44a6dc){_0x44a6dc=_0x44a6dc||0xcc;return function(_0x1948f1){if(_0x1948f1){return _0x30c117[_0x8a9f('0x17')](_0x44a6dc);}return _0x30c117[_0x8a9f('0x18')](_0x44a6dc)[_0x8a9f('0x19')]();};}function respondWithResult(_0x24e399,_0x39633a){_0x39633a=_0x39633a||0xc8;return function(_0x5dc430){if(_0x5dc430){return _0x24e399[_0x8a9f('0x18')](_0x39633a)['json'](_0x5dc430);}};}function respondWithFilteredResult(_0x15519c,_0x1b951a){return function(_0x26ad16){if(_0x26ad16){var _0x4c07e0=typeof _0x1b951a[_0x8a9f('0x1a')]===_0x8a9f('0x1b')&&typeof _0x1b951a['limit']===_0x8a9f('0x1b');var _0x5076a1=_0x26ad16[_0x8a9f('0x1c')];var _0x275b71=_0x4c07e0?0x0:_0x1b951a['offset'];var _0x3311fc=_0x4c07e0?_0x26ad16[_0x8a9f('0x1c')]:_0x1b951a[_0x8a9f('0x1a')]+_0x1b951a[_0x8a9f('0x1d')];var _0x59934d;if(_0x3311fc>=_0x5076a1){_0x3311fc=_0x5076a1;_0x59934d=0xc8;}else{_0x59934d=0xce;}_0x15519c['status'](_0x59934d);return _0x15519c[_0x8a9f('0x1e')](_0x8a9f('0x1f'),_0x275b71+'-'+_0x3311fc+'/'+_0x5076a1)['json'](_0x26ad16);}return null;};}function patchUpdates(_0xed7dec){return function(_0x33c3d4){try{jsonpatch[_0x8a9f('0x20')](_0x33c3d4,_0xed7dec,!![]);}catch(_0x49bd29){return BPromise[_0x8a9f('0x21')](_0x49bd29);}return _0x33c3d4[_0x8a9f('0x22')]();};}function saveUpdates(_0x1db9f2,_0x5c0ef9){return function(_0x5dd36f){if(_0x5dd36f){return _0x5dd36f[_0x8a9f('0x23')](_0x1db9f2)[_0x8a9f('0x24')](function(_0x41ecae){return _0x41ecae;});}return null;};}function removeEntity(_0x1e3307,_0x2543a9){return function(_0x7b626c){if(_0x7b626c){return _0x7b626c[_0x8a9f('0x25')]()['then'](function(){_0x1e3307[_0x8a9f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491cd2,_0xc97e1f){return function(_0x50f01f){if(!_0x50f01f){_0x491cd2[_0x8a9f('0x17')](0x194);}return _0x50f01f;};}function handleError(_0x2fa729,_0x2c00f8){_0x2c00f8=_0x2c00f8||0x1f4;return function(_0x5be32d){logger[_0x8a9f('0x26')](_0x5be32d['stack']);if(_0x5be32d[_0x8a9f('0x27')]){delete _0x5be32d[_0x8a9f('0x27')];}_0x2fa729[_0x8a9f('0x18')](_0x2c00f8)[_0x8a9f('0x28')](_0x5be32d);};}exports['index']=function(_0x589aeb,_0x14d99d){var _0x4f8689={},_0x24d74e={},_0x404ea7={'count':0x0,'rows':[]};var _0x53e5a4=_[_0x8a9f('0x29')](db['VoiceQueuesLog']['rawAttributes'],function(_0x471cbf){return{'name':_0x471cbf[_0x8a9f('0x2a')],'type':_0x471cbf['type'][_0x8a9f('0x2b')]};});_0x24d74e[_0x8a9f('0x2c')]=_['map'](_0x53e5a4,'name');_0x24d74e[_0x8a9f('0x2d')]=_['keys'](_0x589aeb[_0x8a9f('0x2d')]);_0x24d74e[_0x8a9f('0x2e')]=_[_0x8a9f('0x2f')](_0x24d74e[_0x8a9f('0x2c')],_0x24d74e[_0x8a9f('0x2d')]);_0x4f8689[_0x8a9f('0x30')]=_[_0x8a9f('0x2f')](_0x24d74e['model'],qs[_0x8a9f('0x31')](_0x589aeb['query']['fields']));_0x4f8689['attributes']=_0x4f8689['attributes'][_0x8a9f('0x32')]?_0x4f8689[_0x8a9f('0x30')]:_0x24d74e[_0x8a9f('0x2c')];if(!_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x33')](_0x8a9f('0x34'))){_0x4f8689[_0x8a9f('0x1d')]=qs[_0x8a9f('0x1d')](_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x1d')]);_0x4f8689[_0x8a9f('0x1a')]=qs[_0x8a9f('0x1a')](_0x589aeb['query']['offset']);}_0x4f8689[_0x8a9f('0x35')]=qs['sort'](_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x36')]);_0x4f8689['where']=qs[_0x8a9f('0x2e')](_['pick'](_0x589aeb[_0x8a9f('0x2d')],_0x24d74e['filters']),_0x53e5a4);if(_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x37')]){_0x4f8689[_0x8a9f('0x38')]=_[_0x8a9f('0x39')](_0x4f8689['where'],{'$or':_[_0x8a9f('0x29')](_0x53e5a4,function(_0x447727){if(_0x447727[_0x8a9f('0x3a')]!=='VIRTUAL'){var _0x2a3a54={};_0x2a3a54[_0x447727['name']]={'$like':'%'+_0x589aeb[_0x8a9f('0x2d')]['filter']+'%'};return _0x2a3a54;}})});}_0x4f8689=_['merge']({},_0x4f8689,_0x589aeb[_0x8a9f('0x3b')]);var _0x5c9833={'where':_0x4f8689['where']};return db[_0x8a9f('0x3c')]['count'](_0x5c9833)[_0x8a9f('0x24')](function(_0x3e5182){_0x404ea7[_0x8a9f('0x1c')]=_0x3e5182;if(_0x589aeb[_0x8a9f('0x2d')]['includeAll']){_0x4f8689['include']=[{'all':!![]}];}return db[_0x8a9f('0x3c')][_0x8a9f('0x3d')](_0x4f8689);})['then'](function(_0x25d81e){_0x404ea7[_0x8a9f('0x3e')]=_0x25d81e;return _0x404ea7;})[_0x8a9f('0x24')](respondWithFilteredResult(_0x14d99d,_0x4f8689))[_0x8a9f('0x3f')](handleError(_0x14d99d,null));};exports[_0x8a9f('0x40')]=function(_0x4ca48d,_0x278ae0){var _0x4007ea={'raw':!![],'where':{'id':_0x4ca48d['params']['id']}},_0x3b0e2c={};_0x3b0e2c[_0x8a9f('0x2c')]=_[_0x8a9f('0x41')](db[_0x8a9f('0x3c')][_0x8a9f('0x42')]);_0x3b0e2c[_0x8a9f('0x2d')]=_[_0x8a9f('0x41')](_0x4ca48d['query']);_0x3b0e2c[_0x8a9f('0x2e')]=_[_0x8a9f('0x2f')](_0x3b0e2c[_0x8a9f('0x2c')],_0x3b0e2c['query']);_0x4007ea[_0x8a9f('0x30')]=_[_0x8a9f('0x2f')](_0x3b0e2c[_0x8a9f('0x2c')],qs['fields'](_0x4ca48d[_0x8a9f('0x2d')][_0x8a9f('0x31')]));_0x4007ea[_0x8a9f('0x30')]=_0x4007ea[_0x8a9f('0x30')][_0x8a9f('0x32')]?_0x4007ea[_0x8a9f('0x30')]:_0x3b0e2c[_0x8a9f('0x2c')];if(_0x4ca48d[_0x8a9f('0x2d')]['includeAll']){_0x4007ea[_0x8a9f('0x43')]=[{'all':!![]}];}_0x4007ea=_[_0x8a9f('0x39')]({},_0x4007ea,_0x4ca48d['options']);return db[_0x8a9f('0x3c')][_0x8a9f('0x44')](_0x4007ea)[_0x8a9f('0x24')](handleEntityNotFound(_0x278ae0,null))['then'](respondWithResult(_0x278ae0,null))[_0x8a9f('0x3f')](handleError(_0x278ae0,null));};exports[_0x8a9f('0x45')]=function(_0x42355b,_0x52a953){return db[_0x8a9f('0x3c')][_0x8a9f('0x45')](_0x42355b['body'],{})[_0x8a9f('0x24')](respondWithResult(_0x52a953,0xc9))[_0x8a9f('0x3f')](handleError(_0x52a953,null));};exports[_0x8a9f('0x23')]=function(_0x1bc5bc,_0x49c9c3){if(_0x1bc5bc[_0x8a9f('0x46')]['id']){delete _0x1bc5bc[_0x8a9f('0x46')]['id'];}return db['VoiceQueuesLog'][_0x8a9f('0x44')]({'where':{'id':_0x1bc5bc[_0x8a9f('0x47')]['id']}})[_0x8a9f('0x24')](handleEntityNotFound(_0x49c9c3,null))['then'](saveUpdates(_0x1bc5bc['body'],null))[_0x8a9f('0x24')](respondWithResult(_0x49c9c3,null))[_0x8a9f('0x3f')](handleError(_0x49c9c3,null));};exports[_0x8a9f('0x25')]=function(_0x1357e1,_0x4f79d3){return db[_0x8a9f('0x3c')][_0x8a9f('0x44')]({'where':{'id':_0x1357e1[_0x8a9f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f79d3,null))[_0x8a9f('0x24')](removeEntity(_0x4f79d3,null))[_0x8a9f('0x3f')](handleError(_0x4f79d3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e1659ad..08e0ebe 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 _0x0b13=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api'];(function(_0x13a451,_0x1c8a50){var _0x1714b3=function(_0x37ae25){while(--_0x37ae25){_0x13a451['push'](_0x13a451['shift']());}};_0x1714b3(++_0x1c8a50);}(_0x0b13,0x150));var _0x30b1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0b13[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x30b1('0x0'));var util=require(_0x30b1('0x1'));var logger=require(_0x30b1('0x2'))(_0x30b1('0x3'));var moment=require(_0x30b1('0x4'));var BPromise=require(_0x30b1('0x5'));var rp=require(_0x30b1('0x6'));var fs=require('fs');var path=require(_0x30b1('0x7'));var rimraf=require(_0x30b1('0x8'));var config=require(_0x30b1('0x9'));var attributes=require(_0x30b1('0xa'));module[_0x30b1('0xb')]=function(_0x2ec728,_0x17504d){return _0x2ec728[_0x30b1('0xc')](_0x30b1('0xd'),attributes,{'tableName':_0x30b1('0xe'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x30b1('0xf'),_0x30b1('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2c54=['rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xcf8aeb,_0x5b7b2e){var _0x23156c=function(_0x66974){while(--_0x66974){_0xcf8aeb['push'](_0xcf8aeb['shift']());}};_0x23156c(++_0x5b7b2e);}(_0x2c54,0x181));var _0x42c5=function(_0x5b3f45,_0x22182a){_0x5b3f45=_0x5b3f45-0x0;var _0x2ac860=_0x2c54[_0x5b3f45];return _0x2ac860;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42c5('0x0'))('api');var moment=require(_0x42c5('0x1'));var BPromise=require(_0x42c5('0x2'));var rp=require(_0x42c5('0x3'));var fs=require('fs');var path=require(_0x42c5('0x4'));var rimraf=require(_0x42c5('0x5'));var config=require('../../config/environment');var attributes=require(_0x42c5('0x6'));module[_0x42c5('0x7')]=function(_0x1fb089,_0x391ca9){return _0x1fb089['define'](_0x42c5('0x8'),attributes,{'tableName':_0x42c5('0x9'),'paranoid':![],'indexes':[{'name':_0x42c5('0xa'),'fields':[_0x42c5('0xb'),_0x42c5('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 32aae7b..cca1859 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 _0x5dd5=['request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x5dd5,0x1a0));var _0x55dd=function(_0xff7eb7,_0x5b485a){_0xff7eb7=_0xff7eb7-0x0;var _0x36f60c=_0x5dd5[_0xff7eb7];return _0x36f60c;};'use strict';var _=require('lodash');var util=require(_0x55dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55dd('0x1'));var fs=require('fs');var Redis=require(_0x55dd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x55dd('0x3'));var logger=require(_0x55dd('0x4'))('rpc');var config=require(_0x55dd('0x5'));var jayson=require(_0x55dd('0x6'));var client=jayson[_0x55dd('0x7')][_0x55dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b79fc,_0x2c7512,_0x2a7640){return new BPromise(function(_0x56ea69,_0x247282){return client[_0x55dd('0x9')](_0x2b79fc,_0x2a7640)['then'](function(_0x47c921){logger['info'](_0x55dd('0xa'),_0x2c7512,_0x55dd('0xb'));logger[_0x55dd('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c7512,_0x55dd('0xb'),JSON['stringify'](_0x47c921));if(_0x47c921['error']){if(_0x47c921['error']['code']===0x1f4){logger[_0x55dd('0xd')](_0x55dd('0xa'),_0x2c7512,_0x47c921[_0x55dd('0xd')]['message']);return _0x247282(_0x47c921['error'][_0x55dd('0xe')]);}logger[_0x55dd('0xd')](_0x55dd('0xa'),_0x2c7512,_0x47c921[_0x55dd('0xd')][_0x55dd('0xe')]);return _0x56ea69(_0x47c921['error']['message']);}else{logger[_0x55dd('0xf')](_0x55dd('0xa'),_0x2c7512,_0x55dd('0xb'));_0x56ea69(_0x47c921['result']['message']);}})[_0x55dd('0x10')](function(_0x96aa2a){logger[_0x55dd('0xd')](_0x55dd('0xa'),_0x2c7512,_0x96aa2a);_0x247282(_0x96aa2a);});});} \ No newline at end of file +var _0xe8f2=['../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xe8f2,0x133));var _0x2e8f=function(_0x448188,_0x150fd1){_0x448188=_0x448188-0x0;var _0x2f19c0=_0xe8f2[_0x448188];return _0x2f19c0;};'use strict';var _=require(_0x2e8f('0x0'));var util=require(_0x2e8f('0x1'));var moment=require(_0x2e8f('0x2'));var BPromise=require(_0x2e8f('0x3'));var rs=require(_0x2e8f('0x4'));var fs=require('fs');var Redis=require(_0x2e8f('0x5'));var db=require(_0x2e8f('0x6'))['db'];var utils=require(_0x2e8f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e8f('0x8'));var jayson=require(_0x2e8f('0x9'));var client=jayson[_0x2e8f('0xa')][_0x2e8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2349f0,_0x87fc13,_0x284c13){return new BPromise(function(_0x29e149,_0x1113ba){return client['request'](_0x2349f0,_0x284c13)[_0x2e8f('0xc')](function(_0x44b85d){logger[_0x2e8f('0xd')](_0x2e8f('0xe'),_0x87fc13,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x87fc13,'request\x20sent',JSON[_0x2e8f('0xf')](_0x44b85d));if(_0x44b85d[_0x2e8f('0x10')]){if(_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x11')]===0x1f4){logger[_0x2e8f('0x10')](_0x2e8f('0xe'),_0x87fc13,_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);return _0x1113ba(_0x44b85d['error'][_0x2e8f('0x12')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x87fc13,_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);return _0x29e149(_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);}else{logger[_0x2e8f('0xd')](_0x2e8f('0xe'),_0x87fc13,_0x2e8f('0x13'));_0x29e149(_0x44b85d['result'][_0x2e8f('0x12')]);}})[_0x2e8f('0x14')](function(_0x8edd){logger[_0x2e8f('0x10')](_0x2e8f('0xe'),_0x87fc13,_0x8edd);_0x1113ba(_0x8edd);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 47ed87e..14391d5 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 _0xfd64=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','create','put','update','delete','destroy'];(function(_0x15e430,_0xd15495){var _0x4aaf8a=function(_0x3a184c){while(--_0x3a184c){_0x15e430['push'](_0x15e430['shift']());}};_0x4aaf8a(++_0xd15495);}(_0xfd64,0x189));var _0x4fd6=function(_0x4d2914,_0x41657e){_0x4d2914=_0x4d2914-0x0;var _0x5b7e22=_0xfd64[_0x4d2914];return _0x5b7e22;};'use strict';var multer=require(_0x4fd6('0x0'));var util=require(_0x4fd6('0x1'));var path=require(_0x4fd6('0x2'));var timeout=require(_0x4fd6('0x3'));var express=require('express');var router=express[_0x4fd6('0x4')]();var fs_extra=require(_0x4fd6('0x5'));var auth=require(_0x4fd6('0x6'));var interaction=require(_0x4fd6('0x7'));var config=require(_0x4fd6('0x8'));var controller=require(_0x4fd6('0x9'));router['get']('/',auth[_0x4fd6('0xa')](),controller[_0x4fd6('0xb')]);router[_0x4fd6('0xc')](_0x4fd6('0xd'),auth['isAuthenticated'](),controller[_0x4fd6('0xe')]);router[_0x4fd6('0xc')](_0x4fd6('0xf'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x10')]);router[_0x4fd6('0xc')](_0x4fd6('0x11'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x12')]);router[_0x4fd6('0xc')](_0x4fd6('0x13'),controller[_0x4fd6('0x14')]);router[_0x4fd6('0xc')](_0x4fd6('0x15'),auth[_0x4fd6('0xa')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0x4fd6('0x16')]);router['post'](_0x4fd6('0x15'),auth[_0x4fd6('0xa')](),controller['runTranscribe']);router[_0x4fd6('0x17')](_0x4fd6('0xf'),auth['isAuthenticated'](),controller[_0x4fd6('0x18')]);router[_0x4fd6('0x19')](_0x4fd6('0xf'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x1a')]);module[_0x4fd6('0x1b')]=router; \ No newline at end of file +var _0x476d=['post','create','/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','/:id/download','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x476d,0x167));var _0xd476=function(_0x229f58,_0x2fc35a){_0x229f58=_0x229f58-0x0;var _0xb7e54a=_0x476d[_0x229f58];return _0xb7e54a;};'use strict';var multer=require(_0xd476('0x0'));var util=require('util');var path=require(_0xd476('0x1'));var timeout=require(_0xd476('0x2'));var express=require('express');var router=express[_0xd476('0x3')]();var fs_extra=require(_0xd476('0x4'));var auth=require(_0xd476('0x5'));var interaction=require(_0xd476('0x6'));var config=require(_0xd476('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd476('0x8')]);router['get'](_0xd476('0x9'),auth[_0xd476('0xa')](),controller[_0xd476('0xb')]);router[_0xd476('0xc')]('/:id',auth[_0xd476('0xa')](),controller[_0xd476('0xd')]);router[_0xd476('0xc')](_0xd476('0xe'),auth['isAuthenticated'](),controller[_0xd476('0xf')]);router[_0xd476('0xc')]('/:id/downloads',controller['downloads']);router[_0xd476('0xc')]('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xd476('0x10')]('/',auth[_0xd476('0xa')](),controller[_0xd476('0x11')]);router[_0xd476('0x10')](_0xd476('0x12'),auth[_0xd476('0xa')](),controller[_0xd476('0x13')]);router[_0xd476('0x14')](_0xd476('0x15'),auth['isAuthenticated'](),controller[_0xd476('0x16')]);router[_0xd476('0x17')]('/:id',auth[_0xd476('0xa')](),controller[_0xd476('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e1e8c4c..031fc9d 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 cc16f07..38768a3 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 _0xc84c=['Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','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','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','push','existsSync','ValidationError','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Sequelize'];(function(_0x2cdb22,_0xb07835){var _0x14032a=function(_0x8cd278){while(--_0x8cd278){_0x2cdb22['push'](_0x2cdb22['shift']());}};_0x14032a(++_0xb07835);}(_0xc84c,0x146));var _0xcc84=function(_0x45c5f9,_0x1ad8c9){_0x45c5f9=_0x45c5f9-0x0;var _0x22cc60=_0xc84c[_0x45c5f9];return _0x22cc60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc84('0x0'));var zipdir=require(_0xcc84('0x1'));var jsonpatch=require(_0xcc84('0x2'));var rp=require(_0xcc84('0x3'));var moment=require(_0xcc84('0x4'));var BPromise=require(_0xcc84('0x5'));var Mustache=require(_0xcc84('0x6'));var util=require(_0xcc84('0x7'));var path=require('path');var sox=require(_0xcc84('0x8'));var csv=require(_0xcc84('0x9'));var ejs=require(_0xcc84('0xa'));var fs=require('fs');var fs_extra=require(_0xcc84('0xb'));var _=require(_0xcc84('0xc'));var squel=require(_0xcc84('0xd'));var crypto=require(_0xcc84('0xe'));var jsforce=require(_0xcc84('0xf'));var deskjs=require(_0xcc84('0x10'));var toCsv=require(_0xcc84('0x9'));var querystring=require(_0xcc84('0x11'));var Papa=require('papaparse');var AWS=require(_0xcc84('0x12'));var uuidv4=require(_0xcc84('0x13'));var Redis=require(_0xcc84('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xcc84('0x15'));var as=require(_0xcc84('0x16'));var hardwareService=require(_0xcc84('0x17'));var logger=require(_0xcc84('0x18'))('api');var utils=require(_0xcc84('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc84('0x1a'))['db'];function respondWithStatusCode(_0xef794,_0x2a4f6b){_0x2a4f6b=_0x2a4f6b||0xcc;return function(_0x86c33){if(_0x86c33){return _0xef794[_0xcc84('0x1b')](_0x2a4f6b);}return _0xef794['status'](_0x2a4f6b)['end']();};}function respondWithResult(_0x46934a,_0x16946b){_0x16946b=_0x16946b||0xc8;return function(_0x2670a0){if(_0x2670a0){return _0x46934a[_0xcc84('0x1c')](_0x16946b)[_0xcc84('0x1d')](_0x2670a0);}};}function respondWithFilteredResult(_0x564a2f,_0x17377e){return function(_0xbb3bf9){if(_0xbb3bf9){var _0x52e95c=typeof _0x17377e[_0xcc84('0x1e')]===_0xcc84('0x1f')&&typeof _0x17377e['limit']===_0xcc84('0x1f');var _0x4d7930=_0xbb3bf9['count'];var _0x5bca00=_0x52e95c?0x0:_0x17377e[_0xcc84('0x1e')];var _0x10cc45=_0x52e95c?_0xbb3bf9[_0xcc84('0x20')]:_0x17377e[_0xcc84('0x1e')]+_0x17377e[_0xcc84('0x21')];var _0x538e0e;if(_0x10cc45>=_0x4d7930){_0x10cc45=_0x4d7930;_0x538e0e=0xc8;}else{_0x538e0e=0xce;}_0x564a2f[_0xcc84('0x1c')](_0x538e0e);return _0x564a2f[_0xcc84('0x22')](_0xcc84('0x23'),_0x5bca00+'-'+_0x10cc45+'/'+_0x4d7930)[_0xcc84('0x1d')](_0xbb3bf9);}return null;};}function patchUpdates(_0x3ffde6){return function(_0x5b9625){try{jsonpatch[_0xcc84('0x24')](_0x5b9625,_0x3ffde6,!![]);}catch(_0x14c24c){return BPromise[_0xcc84('0x25')](_0x14c24c);}return _0x5b9625[_0xcc84('0x26')]();};}function saveUpdates(_0x5f0f2b,_0x2817f7){return function(_0x51acec){if(_0x51acec){return _0x51acec['update'](_0x5f0f2b)[_0xcc84('0x27')](function(_0x2a6f4f){return _0x2a6f4f;});}return null;};}function removeEntity(_0x482dee,_0x428d39){return function(_0x91de4){if(_0x91de4){return _0x91de4[_0xcc84('0x28')]()['then'](function(){_0x482dee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc17c,_0x3b5266){return function(_0x17289c){if(!_0x17289c){_0x3fc17c[_0xcc84('0x1b')](0x194);}return _0x17289c;};}function handleError(_0x5c1433,_0x2676da){_0x2676da=_0x2676da||0x1f4;return function(_0x33fea3){logger[_0xcc84('0x29')](_0x33fea3['stack']);if(_0x33fea3['name']){delete _0x33fea3[_0xcc84('0x2a')];}_0x5c1433['status'](_0x2676da)[_0xcc84('0x2b')](_0x33fea3);};}exports[_0xcc84('0x2c')]=function(_0x580368,_0x137ca5){var _0x181747={},_0x18da99={},_0x4c7219={'count':0x0,'rows':[]};var _0x3b2576=_['map'](db[_0xcc84('0x2d')][_0xcc84('0x2e')],function(_0x5d15da){return{'name':_0x5d15da[_0xcc84('0x2f')],'type':_0x5d15da['type'][_0xcc84('0x30')]};});_0x18da99[_0xcc84('0x31')]=_[_0xcc84('0x32')](_[_0xcc84('0x33')](_0x3b2576,_0xcc84('0x2a')),[_0xcc84('0x34')]);_0x18da99[_0xcc84('0x35')]=_[_0xcc84('0x36')](_0x580368[_0xcc84('0x35')]);_0x18da99[_0xcc84('0x37')]=_[_0xcc84('0x38')](_0x18da99[_0xcc84('0x31')],_0x18da99[_0xcc84('0x35')]);_0x181747['attributes']=_['intersection'](_0x18da99[_0xcc84('0x31')],qs[_0xcc84('0x39')](_0x580368[_0xcc84('0x35')][_0xcc84('0x39')]));_0x181747['attributes']=_0x181747[_0xcc84('0x3a')][_0xcc84('0x3b')]?_0x181747[_0xcc84('0x3a')]:_0x18da99[_0xcc84('0x31')];if(!_0x580368[_0xcc84('0x35')]['hasOwnProperty'](_0xcc84('0x3c'))){_0x181747[_0xcc84('0x21')]=qs[_0xcc84('0x21')](_0x580368[_0xcc84('0x35')][_0xcc84('0x21')]);_0x181747[_0xcc84('0x1e')]=qs[_0xcc84('0x1e')](_0x580368[_0xcc84('0x35')][_0xcc84('0x1e')]);}_0x181747[_0xcc84('0x3d')]=qs[_0xcc84('0x3e')](_0x580368[_0xcc84('0x35')][_0xcc84('0x3e')]);_0x181747[_0xcc84('0x3f')]=qs[_0xcc84('0x37')](_['pick'](_0x580368[_0xcc84('0x35')],_0x18da99[_0xcc84('0x37')]),_0x3b2576);if(_0x580368[_0xcc84('0x35')]['filter']){_0x181747['where']=_[_0xcc84('0x40')](_0x181747['where'],{'$or':_['map'](_0x3b2576,function(_0x2ce3f5){if(_0x2ce3f5[_0xcc84('0x41')]!==_0xcc84('0x42')){var _0x5d239d={};_0x5d239d[_0x2ce3f5[_0xcc84('0x2a')]]={'$like':'%'+_0x580368[_0xcc84('0x35')][_0xcc84('0x43')]+'%'};return _0x5d239d;}})});}_0x181747=_[_0xcc84('0x40')]({},_0x181747,_0x580368[_0xcc84('0x44')]);var _0x75ac0d={'where':_0x181747[_0xcc84('0x3f')]};return db['VoiceRecording'][_0xcc84('0x20')](_0x75ac0d)[_0xcc84('0x27')](function(_0x2066a3){_0x4c7219[_0xcc84('0x20')]=_0x2066a3;if(_0x580368[_0xcc84('0x35')][_0xcc84('0x45')]){_0x181747[_0xcc84('0x46')]=[{'all':!![]}];}return db[_0xcc84('0x2d')][_0xcc84('0x47')](_0x181747);})[_0xcc84('0x27')](function(_0x5e743b){_0x4c7219['rows']=_0x5e743b;return _0x4c7219;})[_0xcc84('0x27')](respondWithFilteredResult(_0x137ca5,_0x181747))[_0xcc84('0x48')](handleError(_0x137ca5,null));};exports['show']=function(_0x47c134,_0x3ef7f6){var _0x5a5ce4={'raw':![],'where':{'id':_0x47c134[_0xcc84('0x49')]['id']}},_0x347b65={};_0x347b65[_0xcc84('0x31')]=_[_0xcc84('0x36')](db['VoiceRecording'][_0xcc84('0x2e')]);_0x347b65[_0xcc84('0x35')]=_[_0xcc84('0x36')](_0x47c134[_0xcc84('0x35')]);_0x347b65[_0xcc84('0x37')]=_[_0xcc84('0x38')](_0x347b65[_0xcc84('0x31')],_0x347b65[_0xcc84('0x35')]);_0x5a5ce4[_0xcc84('0x3a')]=_[_0xcc84('0x38')](_0x347b65['model'],qs[_0xcc84('0x39')](_0x47c134[_0xcc84('0x35')]['fields']));_0x5a5ce4[_0xcc84('0x3a')]=_0x5a5ce4['attributes'][_0xcc84('0x3b')]?_0x5a5ce4['attributes']:_0x347b65['model'];if(_0x47c134[_0xcc84('0x35')][_0xcc84('0x45')]){_0x5a5ce4[_0xcc84('0x46')]=[{'all':!![]}];}_0x5a5ce4=_['merge']({},_0x5a5ce4,_0x47c134[_0xcc84('0x44')]);return db[_0xcc84('0x2d')][_0xcc84('0x4a')](_0x5a5ce4)[_0xcc84('0x27')](handleEntityNotFound(_0x3ef7f6,null))['then'](respondWithResult(_0x3ef7f6,null))[_0xcc84('0x48')](handleError(_0x3ef7f6,null));};exports[_0xcc84('0x4b')]=function(_0x40d410,_0x47c4b9){return db[_0xcc84('0x2d')][_0xcc84('0x4b')](_0x40d410[_0xcc84('0x4c')],{})['then'](respondWithResult(_0x47c4b9,0xc9))[_0xcc84('0x48')](handleError(_0x47c4b9,null));};exports['update']=function(_0x38a06d,_0x772f9){if(_0x38a06d[_0xcc84('0x4c')]['id']){delete _0x38a06d['body']['id'];}return db['VoiceRecording'][_0xcc84('0x4a')]({'where':{'id':_0x38a06d[_0xcc84('0x49')]['id']}})['then'](handleEntityNotFound(_0x772f9,null))['then'](saveUpdates(_0x38a06d[_0xcc84('0x4c')],null))[_0xcc84('0x27')](respondWithResult(_0x772f9,null))[_0xcc84('0x48')](handleError(_0x772f9,null));};exports[_0xcc84('0x4d')]=function(_0xf01462,_0x41cb1c){return db[_0xcc84('0x2d')][_0xcc84('0x4d')]()[_0xcc84('0x27')](respondWithResult(_0x41cb1c,null))[_0xcc84('0x48')](handleError(_0x41cb1c,null));};exports[_0xcc84('0x4e')]=function(_0x5295e0,_0x321580,_0x3c08ad){var _0x432366=require(_0xcc84('0x4f'));var _0x5ef868=![];var _0x36615b={};if(_0x5295e0[_0xcc84('0x35')][_0xcc84('0x41')]&&_0x5295e0[_0xcc84('0x35')][_0xcc84('0x41')]===_0xcc84('0x50')){_0x36615b[_0xcc84('0x50')]=_0x5295e0[_0xcc84('0x49')]['id'];}else{_0x36615b['id']=_0x5295e0[_0xcc84('0x49')]['id'];}return db['VoiceRecording'][_0xcc84('0x4a')]({'where':_0x36615b,'attributes':['id',_0xcc84('0x51')],'raw':!![]})[_0xcc84('0x27')](handleEntityNotFound(_0x321580,null))[_0xcc84('0x27')](function(_0x239a8e){if(_0x239a8e){var _0x46e459=_0x239a8e[_0xcc84('0x51')];var _0x2e439f=util[_0xcc84('0x34')](_0xcc84('0x52'),_0x46e459);if(fs['existsSync'](_0x2e439f)){_0x5ef868=!![];return _0x432366[_0xcc84('0x53')](_0x2e439f,_0x46e459,config[_0xcc84('0x54')][_0xcc84('0x55')])[_0xcc84('0x27')](function(){return _0x239a8e;});}return _0x239a8e;}})[_0xcc84('0x27')](function(_0x311dc3){if(_0x311dc3){var _0xc64278=_0x311dc3['value'];if(!fs['existsSync'](_0xc64278)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x311dc3['filename']){return _0x321580['download'](_0xc64278,_0x311dc3[_0xcc84('0x56')]+path[_0xcc84('0x57')](_0xc64278),function(){if(_0x5ef868){fs[_0xcc84('0x58')](_0xc64278);}});}else{return _0x321580[_0xcc84('0x4e')](_0xc64278,function(_0x2c5aa0){if(_0x5ef868){fs[_0xcc84('0x58')](_0xc64278);}});}}})['catch'](function(_0x12aed5){if(_0x12aed5['message']===_0xcc84('0x59')){_0x321580[_0xcc84('0x1c')](0x194)[_0xcc84('0x2b')](_0xcc84('0x5a'));}else{return handleError(_0x321580,null);}});};exports[_0xcc84('0x5b')]=function(_0x4faea5,_0x2e35cc,_0xdd6089){var _0x5f0106=require(_0xcc84('0x4f'));var _0x531c5e=![];var _0x35b657={'$and':[db[_0xcc84('0x5c')]['where'](db[_0xcc84('0x5c')]['fn'](_0xcc84('0x5d'),db['sequelize'][_0xcc84('0x5e')](_0xcc84('0x50'))),_0x4faea5[_0xcc84('0x35')][_0xcc84('0x5f')])]};if(_0x4faea5[_0xcc84('0x35')][_0xcc84('0x41')]&&_0x4faea5[_0xcc84('0x35')][_0xcc84('0x41')]===_0xcc84('0x50')){_0x35b657['$and'][_0xcc84('0x60')]({'uniqueid':_0x4faea5[_0xcc84('0x49')]['id']});}else{_0x35b657['$and'][_0xcc84('0x60')]({'id':_0x4faea5[_0xcc84('0x49')]['id']});}return db[_0xcc84('0x2d')][_0xcc84('0x4a')]({'where':_0x35b657,'attributes':['id',_0xcc84('0x51')],'raw':!![]})[_0xcc84('0x27')](handleEntityNotFound(_0x2e35cc,null))[_0xcc84('0x27')](function(_0x142024){if(_0x142024){var _0x583ab9=util['format']('%s.cypher',_0x142024['value']);if(fs[_0xcc84('0x61')](_0x583ab9)){_0x531c5e=!![];return _0x5f0106[_0xcc84('0x53')](_0x583ab9,_0x142024[_0xcc84('0x51')],config[_0xcc84('0x54')][_0xcc84('0x55')])[_0xcc84('0x27')](function(){return _0x142024;});}return _0x142024;}})['then'](function(_0x5603b5){if(_0x5603b5){if(!fs['existsSync'](_0x5603b5[_0xcc84('0x51')])){throw new db['Sequelize'][(_0xcc84('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x5603b5['filename']){return _0x2e35cc[_0xcc84('0x4e')](_0x5603b5[_0xcc84('0x51')],_0x5603b5['filename']+path[_0xcc84('0x57')](_0x5603b5[_0xcc84('0x51')]),function(){if(_0x531c5e){fs[_0xcc84('0x58')](_0x5603b5[_0xcc84('0x51')]);}});}else{return _0x2e35cc[_0xcc84('0x4e')](_0x5603b5[_0xcc84('0x51')],function(_0x45aec8){if(_0x531c5e){fs[_0xcc84('0x58')](_0x5603b5[_0xcc84('0x51')]);}});}}})['catch'](handleError(_0x2e35cc,null));};exports[_0xcc84('0x28')]=function(_0x68319c,_0x39a7b8){return db[_0xcc84('0x2d')]['find']({'where':{'id':_0x68319c['params']['id']}})[_0xcc84('0x27')](function(_0x52f2d6){if(_['isNil'](_0x52f2d6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x52f2d6;})[_0xcc84('0x27')](function(_0x5ccd8e){var _0x1fa995=_0x5ccd8e[_0xcc84('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1fa995);if(!_['isNil'](_0x5ccd8e[_0xcc84('0x51')])&&fs[_0xcc84('0x61')](_0x1fa995)){logger[_0xcc84('0x63')](_0xcc84('0x64')+_0x1fa995+_0xcc84('0x65'));fs[_0xcc84('0x66')](_0x1fa995);}_0x1fa995=_0x1fa995+_0xcc84('0x67');if(!_[_0xcc84('0x68')](_0x5ccd8e[_0xcc84('0x51')])&&fs[_0xcc84('0x61')](_0x1fa995)){logger[_0xcc84('0x63')](_0xcc84('0x64')+_0x1fa995+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcc84('0x66')](_0x1fa995);}return _0x5ccd8e;})[_0xcc84('0x27')](function(_0x31f772){if(!_0x31f772)throw new InternalError();return _0x31f772[_0xcc84('0x28')]();})[_0xcc84('0x27')](function(){_0x39a7b8[_0xcc84('0x1c')](0xcc)['end']();})[_0xcc84('0x48')](handleError(_0x39a7b8,null));};function getBucketslist(_0x3be29d,_0x48ca02,_0x20496b){return new Promise(function(_0x3d9d08,_0x4b82c6){var _0x1d4b4b=new AWS['S3']({'accessKeyId':_0x48ca02,'secretAccessKey':_0x3be29d,'region':_0x20496b});_0x1d4b4b[_0xcc84('0x69')]({},function(_0x4548e7,_0x10e5b7){if(_0x4548e7){return _0x4b82c6(_0x4548e7);}else{return _0x3d9d08(_0x10e5b7);}});});}function createBucket(_0x41e2a0,_0x45da4a,_0x527187,_0x827c44){return new Promise(function(_0x56174a,_0x2c2ec6){var _0x3ec6ba=new AWS['S3']({'accessKeyId':_0x45da4a,'secretAccessKey':_0x41e2a0,'region':_0x527187});_0x3ec6ba[_0xcc84('0x6a')]({'Bucket':_0x827c44},function(_0x55ac10,_0x632abd){if(_0x55ac10){return _0x2c2ec6(_0x55ac10);}else{return _0x56174a(_0x632abd);}});});}function uploadFile(_0x496353,_0xba976d,_0x2ddc18,_0x1d17cc,_0x51427f,_0x2ad0fc){return new Promise(function(_0x41e584,_0x5a234a){var _0xbdd60e=new AWS['S3']({'accessKeyId':_0xba976d,'secretAccessKey':_0x496353,'region':_0x2ddc18});_0xbdd60e[_0xcc84('0x6b')]({'Bucket':_0x1d17cc,'Key':_0x51427f,'Body':_0x2ad0fc},function(_0x13716a,_0x205343){if(_0x13716a){return _0x5a234a(_0x13716a);}else{return _0x41e584(_0x205343);}});});}function startTranscribe(_0x5d5ce6,_0x346b67,_0x850278,_0x4c520c,_0x2b7641,_0x1d6737){return new Promise(function(_0x20d2d3,_0x1bafa5){var _0x13b0bd=new AWS['TranscribeService']({'accessKeyId':_0x346b67,'secretAccessKey':_0x5d5ce6,'region':_0x850278});_0x13b0bd[_0xcc84('0x6c')]({'TranscriptionJobName':_0x4c520c,'LanguageCode':_0x2b7641,'Media':{'MediaFileUri':_0x1d6737}},function(_0x271eed,_0x41bba8){if(_0x271eed){return _0x1bafa5(_0x271eed);}else{return _0x20d2d3(_0x41bba8);}});});}function transcribe(_0x58b97d,_0x21193d,_0x23b0c2,_0x55f444,_0x47175e,_0x2e05a0,_0x393083){return new Promise(function(_0x55a2ff,_0x4e7f95){var _0x42712e={};logger['info'](util[_0xcc84('0x34')](_0xcc84('0x6d'),_0x58b97d,_0x47175e));return uploadFile(_0x21193d,_0x23b0c2,_0x55f444,_0x47175e,path['basename'](_0x2e05a0),fs[_0xcc84('0x6e')](_0x2e05a0))[_0xcc84('0x27')](function(_0x3fbaa4){logger[_0xcc84('0x63')](util[_0xcc84('0x34')](_0xcc84('0x6f'),_0x58b97d,_0x47175e,_0x3fbaa4[_0xcc84('0x70')]));_0x42712e[_0xcc84('0x71')]=_0x3fbaa4[_0xcc84('0x72')];_0x42712e[_0xcc84('0x73')]=_0x3fbaa4[_0xcc84('0x70')];logger['info'](util[_0xcc84('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x58b97d));return startTranscribe(_0x21193d,_0x23b0c2,_0x55f444,uuidv4(),_0x393083,_0x3fbaa4[_0xcc84('0x70')]);})[_0xcc84('0x27')](function(_0x784c4b){logger[_0xcc84('0x63')](util[_0xcc84('0x34')](_0xcc84('0x74'),_0x58b97d,_0x784c4b['TranscriptionJob']['TranscriptionJobName']));_0x42712e[_0xcc84('0x75')]=_0x784c4b[_0xcc84('0x76')][_0xcc84('0x77')];_0x42712e['transcribeStatus']=_0x784c4b['TranscriptionJob'][_0xcc84('0x78')];return _0x55a2ff(_0x42712e);})['catch'](function(_0x42f881){return _0x4e7f95(_0x42f881);});});}exports[_0xcc84('0x79')]=function(_0xd35856,_0x3c3ec1,_0x17208d){var _0x31522c;var _0x54de2f;var _0x31d24d;var _0x533fa5=require(_0xcc84('0x4f'));return db[_0xcc84('0x2d')][_0xcc84('0x7a')]({'where':{'id':_0xd35856[_0xcc84('0x49')]['id']}})[_0xcc84('0x27')](function(_0x33fbb9){if(_0x33fbb9){var _0x1c5cce=util[_0xcc84('0x34')](_0xcc84('0x52'),_0x33fbb9['value']);if(fs[_0xcc84('0x61')](_0x1c5cce)){cypher=!![];return _0x533fa5[_0xcc84('0x53')](_0x1c5cce,_0x33fbb9['value'],config['secrets'][_0xcc84('0x55')])['then'](function(){return _0x33fbb9;});}return _0x33fbb9;}})[_0xcc84('0x27')](function(_0x415c23){if(!_0x415c23){throw new db[(_0xcc84('0x7b'))]['ValidationError'](_0xcc84('0x7c'));}_0x54de2f=_0x415c23;return db[_0xcc84('0x7d')][_0xcc84('0x7a')]({'where':{'id':0x1}});})[_0xcc84('0x27')](handleEntityNotFound(_0x3c3ec1,null))[_0xcc84('0x27')](function(_0xf398bc){if(_0xf398bc){_0x31522c=_0xf398bc;if(!_0x31522c['transcribe']||!_0x31522c[_0xcc84('0x7e')]||!_0x31522c[_0xcc84('0x7f')]||!_0x31522c[_0xcc84('0x80')]||!_0x31522c[_0xcc84('0x71')]){throw new db[(_0xcc84('0x7b'))][(_0xcc84('0x62'))](_0xcc84('0x81'));}if(_0xd35856[_0xcc84('0x4c')][_0xcc84('0x82')]&&(!_0x31522c['sentiment']||!_0x31522c[_0xcc84('0x83')]||!_0x31522c['sentimentRegion']||!_0x31522c[_0xcc84('0x80')]||!_0x31522c[_0xcc84('0x71')])){throw new db[(_0xcc84('0x7b'))][(_0xcc84('0x62'))](_0xcc84('0x84'));}return db[_0xcc84('0x85')][_0xcc84('0x7a')]({'where':{'id':_0x31522c['transcribeAccountId']}});}})[_0xcc84('0x27')](function(_0x2d1772){if(!_0x2d1772){throw new db[(_0xcc84('0x7b'))][(_0xcc84('0x62'))](_0xcc84('0x86'));}if(!_0x2d1772['data1']||!_0x2d1772[_0xcc84('0x87')]){throw new db[(_0xcc84('0x7b'))][(_0xcc84('0x62'))](_0xcc84('0x88'));}_0x31d24d=_0x2d1772;return getBucketslist(_0x31d24d[_0xcc84('0x89')],_0x31d24d['data2'],_0x31522c[_0xcc84('0x7f')]);})[_0xcc84('0x27')](function(_0x3fe1fc){if(_0x3fe1fc&&_0x3fe1fc[_0xcc84('0x8a')]){var _0x1e9a2e=_[_0xcc84('0x4a')](_0x3fe1fc[_0xcc84('0x8a')],function(_0x38b773){return _0x38b773[_0xcc84('0x8b')]===_0x31522c['bucket'];});if(!_0x1e9a2e){logger[_0xcc84('0x63')](util[_0xcc84('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xd35856[_0xcc84('0x49')]['id'],_0x31522c['bucket']));return createBucket(_0x31d24d[_0xcc84('0x89')],_0x31d24d[_0xcc84('0x87')],_0x31522c['transcribeRegion'],_0x31522c[_0xcc84('0x71')]);}logger[_0xcc84('0x63')](util[_0xcc84('0x34')](_0xcc84('0x8c'),_0xd35856['params']['id'],_0x31522c[_0xcc84('0x71')]));return;}})['then'](function(_0x4a6c35){if(_0x54de2f[_0xcc84('0x8d')]===_0xcc84('0x8e')){return transcribe(_0xd35856[_0xcc84('0x49')]['id'],_0x31d24d[_0xcc84('0x89')],_0x31d24d[_0xcc84('0x87')],_0x31522c['transcribeRegion'],_0x31522c[_0xcc84('0x71')],_0x54de2f[_0xcc84('0x51')],_0x31522c[_0xcc84('0x80')]);}else{logger[_0xcc84('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xd35856[_0xcc84('0x49')]['id']));return{'transcribeStatus':_0xcc84('0x8f')};}})[_0xcc84('0x27')](function(_0x50b265){if(_0x50b265){_0x50b265[_0xcc84('0x90')]=_0xd35856['body'][_0xcc84('0x82')];return _0x54de2f[_0xcc84('0x91')](_0x50b265);}})[_0xcc84('0x27')](respondWithResult(_0x3c3ec1,null))[_0xcc84('0x48')](handleError(_0x3c3ec1,null));};function writeFile(_0x1fa64b,_0x247143){return new Promise(function(_0x43c273,_0x44182f){fs['writeFile'](_0x247143,_0x1fa64b,function(_0x17424a,_0x13b252){if(_0x17424a){return _0x44182f(_0x17424a);}else{return _0x43c273(_0x13b252);}});});}exports[_0xcc84('0x92')]=function(_0x787d26,_0x5252d4,_0x2557f0){return db['VoiceRecording'][_0xcc84('0x7a')]({'where':{'id':_0x787d26[_0xcc84('0x49')]['id']}})['then'](handleEntityNotFound(_0x5252d4))[_0xcc84('0x27')](function(_0x501720){if(_0x501720&&_0x501720[_0xcc84('0x93')]){var _0xce03f3=_0x501720[_0xcc84('0x93')];var _0x38b5af=config[_0xcc84('0x94')]+_0xcc84('0x95')+_0x501720['id']+'.txt';if(fs[_0xcc84('0x61')](_0x38b5af)){return _0x38b5af;}return writeFile(_0xce03f3,_0x38b5af)[_0xcc84('0x27')](function(){return _0x38b5af;});}else{throw new db[(_0xcc84('0x7b'))][(_0xcc84('0x62'))]('Transcript\x20not\x20available');}})[_0xcc84('0x27')](function(_0x42b978){return _0x5252d4['download'](_0x42b978);})['catch'](handleError(_0x5252d4));}; \ No newline at end of file +var _0x562e=['map','VoiceRecording','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','send','Not\x20found','downloads','sequelize','col','token','$and','push','%s.cypher','secrets','VoiceRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','then','error','stack','name','index'];(function(_0x398fbb,_0x43220d){var _0x132e5c=function(_0x54ca84){while(--_0x54ca84){_0x398fbb['push'](_0x398fbb['shift']());}};_0x132e5c(++_0x43220d);}(_0x562e,0x6e));var _0xe562=function(_0x1f8f63,_0x3c1f9f){_0x1f8f63=_0x1f8f63-0x0;var _0x1924a5=_0x562e[_0x1f8f63];return _0x1924a5;};'use strict';var emlformat=require(_0xe562('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe562('0x1'));var BPromise=require(_0xe562('0x2'));var Mustache=require(_0xe562('0x3'));var util=require('util');var path=require(_0xe562('0x4'));var sox=require(_0xe562('0x5'));var csv=require(_0xe562('0x6'));var ejs=require(_0xe562('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe562('0x8'));var crypto=require(_0xe562('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe562('0xa'));var toCsv=require(_0xe562('0x6'));var querystring=require(_0xe562('0xb'));var Papa=require(_0xe562('0xc'));var AWS=require(_0xe562('0xd'));var uuidv4=require(_0xe562('0xe'));var Redis=require(_0xe562('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe562('0x10'));var as=require(_0xe562('0x11'));var hardwareService=require(_0xe562('0x12'));var logger=require(_0xe562('0x13'))(_0xe562('0x14'));var utils=require(_0xe562('0x15'));var config=require(_0xe562('0x16'));var licenseUtil=require(_0xe562('0x17'));var db=require(_0xe562('0x18'))['db'];function respondWithStatusCode(_0x37de2b,_0xe15ec3){_0xe15ec3=_0xe15ec3||0xcc;return function(_0x357339){if(_0x357339){return _0x37de2b[_0xe562('0x19')](_0xe15ec3);}return _0x37de2b[_0xe562('0x1a')](_0xe15ec3)[_0xe562('0x1b')]();};}function respondWithResult(_0x37d942,_0x3e2342){_0x3e2342=_0x3e2342||0xc8;return function(_0x474760){if(_0x474760){return _0x37d942['status'](_0x3e2342)['json'](_0x474760);}};}function respondWithFilteredResult(_0x4283b6,_0x40aaa4){return function(_0x40502d){if(_0x40502d){var _0x569fc8=typeof _0x40aaa4['offset']==='undefined'&&typeof _0x40aaa4[_0xe562('0x1c')]===_0xe562('0x1d');var _0x2caeaa=_0x40502d[_0xe562('0x1e')];var _0xe08ff1=_0x569fc8?0x0:_0x40aaa4[_0xe562('0x1f')];var _0x4cc9b1=_0x569fc8?_0x40502d[_0xe562('0x1e')]:_0x40aaa4['offset']+_0x40aaa4['limit'];var _0x51c357;if(_0x4cc9b1>=_0x2caeaa){_0x4cc9b1=_0x2caeaa;_0x51c357=0xc8;}else{_0x51c357=0xce;}_0x4283b6[_0xe562('0x1a')](_0x51c357);return _0x4283b6[_0xe562('0x20')](_0xe562('0x21'),_0xe08ff1+'-'+_0x4cc9b1+'/'+_0x2caeaa)[_0xe562('0x22')](_0x40502d);}return null;};}function patchUpdates(_0x5d8e1b){return function(_0x241cfb){try{jsonpatch['apply'](_0x241cfb,_0x5d8e1b,!![]);}catch(_0x4839be){return BPromise[_0xe562('0x23')](_0x4839be);}return _0x241cfb['save']();};}function saveUpdates(_0x3b47ed,_0x2d7e70){return function(_0x4c8236){if(_0x4c8236){return _0x4c8236['update'](_0x3b47ed)[_0xe562('0x24')](function(_0x4048a0){return _0x4048a0;});}return null;};}function removeEntity(_0x5159df,_0x40c063){return function(_0xa46ecd){if(_0xa46ecd){return _0xa46ecd['destroy']()[_0xe562('0x24')](function(){_0x5159df['status'](0xcc)[_0xe562('0x1b')]();});}};}function handleEntityNotFound(_0x209a57,_0x1318ac){return function(_0x35f15f){if(!_0x35f15f){_0x209a57['sendStatus'](0x194);}return _0x35f15f;};}function handleError(_0x44ed4d,_0x44255f){_0x44255f=_0x44255f||0x1f4;return function(_0x1c2043){logger[_0xe562('0x25')](_0x1c2043[_0xe562('0x26')]);if(_0x1c2043[_0xe562('0x27')]){delete _0x1c2043[_0xe562('0x27')];}_0x44ed4d[_0xe562('0x1a')](_0x44255f)['send'](_0x1c2043);};}exports[_0xe562('0x28')]=function(_0x53f9b6,_0x178191){var _0x3c9793={},_0x2e44da={},_0x310885={'count':0x0,'rows':[]};var _0x4858a9=_[_0xe562('0x29')](db[_0xe562('0x2a')]['rawAttributes'],function(_0x5ddfa0){return{'name':_0x5ddfa0[_0xe562('0x2b')],'type':_0x5ddfa0[_0xe562('0x2c')][_0xe562('0x2d')]};});_0x2e44da['model']=_['differenceBy'](_[_0xe562('0x29')](_0x4858a9,_0xe562('0x27')),['format']);_0x2e44da['query']=_[_0xe562('0x2e')](_0x53f9b6[_0xe562('0x2f')]);_0x2e44da[_0xe562('0x30')]=_[_0xe562('0x31')](_0x2e44da['model'],_0x2e44da[_0xe562('0x2f')]);_0x3c9793[_0xe562('0x32')]=_['intersection'](_0x2e44da['model'],qs[_0xe562('0x33')](_0x53f9b6[_0xe562('0x2f')]['fields']));_0x3c9793[_0xe562('0x32')]=_0x3c9793[_0xe562('0x32')][_0xe562('0x34')]?_0x3c9793[_0xe562('0x32')]:_0x2e44da[_0xe562('0x35')];if(!_0x53f9b6['query']['hasOwnProperty'](_0xe562('0x36'))){_0x3c9793[_0xe562('0x1c')]=qs[_0xe562('0x1c')](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x1c')]);_0x3c9793['offset']=qs[_0xe562('0x1f')](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x1f')]);}_0x3c9793[_0xe562('0x37')]=qs['sort'](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x38')]);_0x3c9793[_0xe562('0x39')]=qs[_0xe562('0x30')](_[_0xe562('0x3a')](_0x53f9b6[_0xe562('0x2f')],_0x2e44da['filters']),_0x4858a9);if(_0x53f9b6[_0xe562('0x2f')][_0xe562('0x3b')]){_0x3c9793[_0xe562('0x39')]=_[_0xe562('0x3c')](_0x3c9793[_0xe562('0x39')],{'$or':_[_0xe562('0x29')](_0x4858a9,function(_0x23dd0e){if(_0x23dd0e['type']!==_0xe562('0x3d')){var _0x14d524={};_0x14d524[_0x23dd0e[_0xe562('0x27')]]={'$like':'%'+_0x53f9b6[_0xe562('0x2f')]['filter']+'%'};return _0x14d524;}})});}_0x3c9793=_['merge']({},_0x3c9793,_0x53f9b6[_0xe562('0x3e')]);var _0x1871d7={'where':_0x3c9793[_0xe562('0x39')]};return db['VoiceRecording']['count'](_0x1871d7)['then'](function(_0x458258){_0x310885[_0xe562('0x1e')]=_0x458258;if(_0x53f9b6[_0xe562('0x2f')][_0xe562('0x3f')]){_0x3c9793[_0xe562('0x40')]=[{'all':!![]}];}return db[_0xe562('0x2a')][_0xe562('0x41')](_0x3c9793);})['then'](function(_0x52bd42){_0x310885[_0xe562('0x42')]=_0x52bd42;return _0x310885;})[_0xe562('0x24')](respondWithFilteredResult(_0x178191,_0x3c9793))[_0xe562('0x43')](handleError(_0x178191,null));};exports['show']=function(_0x54d94f,_0x3f1fe0){var _0x12cacc={'raw':![],'where':{'id':_0x54d94f['params']['id']}},_0x4e5e57={};_0x4e5e57['model']=_[_0xe562('0x2e')](db[_0xe562('0x2a')]['rawAttributes']);_0x4e5e57[_0xe562('0x2f')]=_['keys'](_0x54d94f[_0xe562('0x2f')]);_0x4e5e57['filters']=_[_0xe562('0x31')](_0x4e5e57[_0xe562('0x35')],_0x4e5e57[_0xe562('0x2f')]);_0x12cacc['attributes']=_['intersection'](_0x4e5e57['model'],qs[_0xe562('0x33')](_0x54d94f[_0xe562('0x2f')][_0xe562('0x33')]));_0x12cacc[_0xe562('0x32')]=_0x12cacc[_0xe562('0x32')][_0xe562('0x34')]?_0x12cacc[_0xe562('0x32')]:_0x4e5e57[_0xe562('0x35')];if(_0x54d94f[_0xe562('0x2f')][_0xe562('0x3f')]){_0x12cacc['include']=[{'all':!![]}];}_0x12cacc=_[_0xe562('0x3c')]({},_0x12cacc,_0x54d94f[_0xe562('0x3e')]);return db[_0xe562('0x2a')][_0xe562('0x44')](_0x12cacc)[_0xe562('0x24')](handleEntityNotFound(_0x3f1fe0,null))[_0xe562('0x24')](respondWithResult(_0x3f1fe0,null))['catch'](handleError(_0x3f1fe0,null));};exports[_0xe562('0x45')]=function(_0x4d3830,_0x4c1b9a){return db[_0xe562('0x2a')]['create'](_0x4d3830[_0xe562('0x46')],{})[_0xe562('0x24')](respondWithResult(_0x4c1b9a,0xc9))['catch'](handleError(_0x4c1b9a,null));};exports[_0xe562('0x47')]=function(_0x301854,_0x26b5df){if(_0x301854[_0xe562('0x46')]['id']){delete _0x301854[_0xe562('0x46')]['id'];}return db[_0xe562('0x2a')]['find']({'where':{'id':_0x301854[_0xe562('0x48')]['id']}})[_0xe562('0x24')](handleEntityNotFound(_0x26b5df,null))[_0xe562('0x24')](saveUpdates(_0x301854['body'],null))[_0xe562('0x24')](respondWithResult(_0x26b5df,null))[_0xe562('0x43')](handleError(_0x26b5df,null));};exports['describe']=function(_0x1a272f,_0x5dd511){return db[_0xe562('0x2a')][_0xe562('0x49')]()[_0xe562('0x24')](respondWithResult(_0x5dd511,null))['catch'](handleError(_0x5dd511,null));};exports[_0xe562('0x4a')]=function(_0x3c8dc3,_0x1e3979,_0x302da4){var _0x17a457=require(_0xe562('0x4b'));var _0x3aec97=![];var _0x4b5e49={};if(_0x3c8dc3['query']['type']&&_0x3c8dc3['query']['type']===_0xe562('0x4c')){_0x4b5e49[_0xe562('0x4c')]=_0x3c8dc3['params']['id'];}else{_0x4b5e49['id']=_0x3c8dc3[_0xe562('0x48')]['id'];}return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':_0x4b5e49,'attributes':['id',_0xe562('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1e3979,null))[_0xe562('0x24')](function(_0x388ca1){if(_0x388ca1){var _0x1dbc9f=_0x388ca1[_0xe562('0x4d')];var _0x3b63a5=util[_0xe562('0x4e')]('%s.cypher',_0x1dbc9f);if(fs[_0xe562('0x4f')](_0x3b63a5)){_0x3aec97=!![];return _0x17a457[_0xe562('0x50')](_0x3b63a5,_0x1dbc9f,config['secrets'][_0xe562('0x51')])['then'](function(){return _0x388ca1;});}return _0x388ca1;}})[_0xe562('0x24')](function(_0x1a036c){if(_0x1a036c){var _0x26dc58=_0x1a036c[_0xe562('0x4d')];if(!fs[_0xe562('0x4f')](_0x26dc58)){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x1a036c[_0xe562('0x54')]){return _0x1e3979[_0xe562('0x4a')](_0x26dc58,_0x1a036c[_0xe562('0x54')]+path[_0xe562('0x55')](_0x26dc58),function(){if(_0x3aec97){fs[_0xe562('0x56')](_0x26dc58);}});}else{return _0x1e3979['download'](_0x26dc58,function(_0x4612b0){if(_0x3aec97){fs[_0xe562('0x56')](_0x26dc58);}});}}})[_0xe562('0x43')](function(_0x213313){if(_0x213313['message']==='VoiceRecording\x20not\x20found'){_0x1e3979[_0xe562('0x1a')](0x194)[_0xe562('0x57')](_0xe562('0x58'));}else{return handleError(_0x1e3979,null);}});};exports[_0xe562('0x59')]=function(_0xe96e7d,_0x32978a,_0x35a0ff){var _0xdb2efc=require(_0xe562('0x4b'));var _0x549ed7=![];var _0x58b205={'$and':[db[_0xe562('0x5a')][_0xe562('0x39')](db[_0xe562('0x5a')]['fn']('MD5',db[_0xe562('0x5a')][_0xe562('0x5b')](_0xe562('0x4c'))),_0xe96e7d['query'][_0xe562('0x5c')])]};if(_0xe96e7d[_0xe562('0x2f')][_0xe562('0x2c')]&&_0xe96e7d['query'][_0xe562('0x2c')]===_0xe562('0x4c')){_0x58b205[_0xe562('0x5d')][_0xe562('0x5e')]({'uniqueid':_0xe96e7d[_0xe562('0x48')]['id']});}else{_0x58b205[_0xe562('0x5d')][_0xe562('0x5e')]({'id':_0xe96e7d['params']['id']});}return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':_0x58b205,'attributes':['id','value'],'raw':!![]})[_0xe562('0x24')](handleEntityNotFound(_0x32978a,null))['then'](function(_0x14facd){if(_0x14facd){var _0x350f6c=util[_0xe562('0x4e')](_0xe562('0x5f'),_0x14facd[_0xe562('0x4d')]);if(fs['existsSync'](_0x350f6c)){_0x549ed7=!![];return _0xdb2efc['decryptFile'](_0x350f6c,_0x14facd[_0xe562('0x4d')],config[_0xe562('0x60')][_0xe562('0x51')])['then'](function(){return _0x14facd;});}return _0x14facd;}})['then'](function(_0xecc703){if(_0xecc703){if(!fs[_0xe562('0x4f')](_0xecc703[_0xe562('0x4d')])){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))](_0xe562('0x61'));}if(_0xecc703[_0xe562('0x54')]){return _0x32978a[_0xe562('0x4a')](_0xecc703[_0xe562('0x4d')],_0xecc703[_0xe562('0x54')]+path[_0xe562('0x55')](_0xecc703[_0xe562('0x4d')]),function(){if(_0x549ed7){fs[_0xe562('0x56')](_0xecc703[_0xe562('0x4d')]);}});}else{return _0x32978a[_0xe562('0x4a')](_0xecc703['value'],function(_0x440dd4){if(_0x549ed7){fs[_0xe562('0x56')](_0xecc703[_0xe562('0x4d')]);}});}}})[_0xe562('0x43')](handleError(_0x32978a,null));};exports[_0xe562('0x62')]=function(_0x1079f7,_0x1f079f){return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':{'id':_0x1079f7['params']['id']}})['then'](function(_0x30a88b){if(_[_0xe562('0x63')](_0x30a88b)){throw new ReferenceError(_0xe562('0x64'));}return _0x30a88b;})[_0xe562('0x24')](function(_0x2c5216){var _0x2fa7b5=_0x2c5216[_0xe562('0x4d')];logger['info'](_0xe562('0x65'),_0x2fa7b5);if(!_[_0xe562('0x63')](_0x2c5216[_0xe562('0x4d')])&&fs['existsSync'](_0x2fa7b5)){logger['info'](_0xe562('0x66')+_0x2fa7b5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe562('0x67')](_0x2fa7b5);}_0x2fa7b5=_0x2fa7b5+_0xe562('0x68');if(!_[_0xe562('0x63')](_0x2c5216['value'])&&fs[_0xe562('0x4f')](_0x2fa7b5)){logger[_0xe562('0x69')](_0xe562('0x66')+_0x2fa7b5+_0xe562('0x6a'));fs[_0xe562('0x67')](_0x2fa7b5);}return _0x2c5216;})[_0xe562('0x24')](function(_0x524081){if(!_0x524081)throw new InternalError();return _0x524081[_0xe562('0x62')]();})[_0xe562('0x24')](function(){_0x1f079f[_0xe562('0x1a')](0xcc)[_0xe562('0x1b')]();})[_0xe562('0x43')](handleError(_0x1f079f,null));};function getBucketslist(_0x540652,_0x327211,_0xe5fc5e){return new Promise(function(_0xa729cb,_0x40b674){var _0x2eaaef=new AWS['S3']({'accessKeyId':_0x327211,'secretAccessKey':_0x540652,'region':_0xe5fc5e});_0x2eaaef[_0xe562('0x6b')]({},function(_0x5b46c8,_0x4da312){if(_0x5b46c8){return _0x40b674(_0x5b46c8);}else{return _0xa729cb(_0x4da312);}});});}function createBucket(_0x1064fd,_0x19f03b,_0x513810,_0x23a285){return new Promise(function(_0x4d3142,_0x215d63){var _0x350a8d=new AWS['S3']({'accessKeyId':_0x19f03b,'secretAccessKey':_0x1064fd,'region':_0x513810});_0x350a8d[_0xe562('0x6c')]({'Bucket':_0x23a285},function(_0x5e1f98,_0x4243d9){if(_0x5e1f98){return _0x215d63(_0x5e1f98);}else{return _0x4d3142(_0x4243d9);}});});}function uploadFile(_0x167d88,_0x2545c7,_0x297849,_0x1d01d0,_0x115648,_0x2d6900){return new Promise(function(_0x3dcabb,_0x4458ff){var _0xf2621=new AWS['S3']({'accessKeyId':_0x2545c7,'secretAccessKey':_0x167d88,'region':_0x297849});_0xf2621[_0xe562('0x6d')]({'Bucket':_0x1d01d0,'Key':_0x115648,'Body':_0x2d6900},function(_0x356d42,_0x476c82){if(_0x356d42){return _0x4458ff(_0x356d42);}else{return _0x3dcabb(_0x476c82);}});});}function startTranscribe(_0x451fcf,_0x287cda,_0x1c901c,_0x4cf2f0,_0x438610,_0x4f2140){return new Promise(function(_0x423667,_0x56db79){var _0x57cb05=new AWS[(_0xe562('0x6e'))]({'accessKeyId':_0x287cda,'secretAccessKey':_0x451fcf,'region':_0x1c901c});_0x57cb05[_0xe562('0x6f')]({'TranscriptionJobName':_0x4cf2f0,'LanguageCode':_0x438610,'Media':{'MediaFileUri':_0x4f2140}},function(_0x1e8f5e,_0x14d232){if(_0x1e8f5e){return _0x56db79(_0x1e8f5e);}else{return _0x423667(_0x14d232);}});});}function transcribe(_0x2dfeef,_0x12466d,_0x37f886,_0x1e3111,_0x483cd8,_0xb8c4f4,_0x40a39d){return new Promise(function(_0x5209fc,_0x19d3e3){var _0x4e2415={};logger[_0xe562('0x69')](util['format'](_0xe562('0x70'),_0x2dfeef,_0x483cd8));return uploadFile(_0x12466d,_0x37f886,_0x1e3111,_0x483cd8,path['basename'](_0xb8c4f4),fs[_0xe562('0x71')](_0xb8c4f4))[_0xe562('0x24')](function(_0x366d9c){logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x72'),_0x2dfeef,_0x483cd8,_0x366d9c[_0xe562('0x73')]));_0x4e2415[_0xe562('0x74')]=_0x366d9c[_0xe562('0x75')];_0x4e2415[_0xe562('0x76')]=_0x366d9c[_0xe562('0x73')];logger['info'](util[_0xe562('0x4e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2dfeef));return startTranscribe(_0x12466d,_0x37f886,_0x1e3111,uuidv4(),_0x40a39d,_0x366d9c[_0xe562('0x73')]);})[_0xe562('0x24')](function(_0x2e8007){logger[_0xe562('0x69')](util['format'](_0xe562('0x77'),_0x2dfeef,_0x2e8007[_0xe562('0x78')][_0xe562('0x79')]));_0x4e2415[_0xe562('0x7a')]=_0x2e8007[_0xe562('0x78')]['TranscriptionJobName'];_0x4e2415[_0xe562('0x7b')]=_0x2e8007[_0xe562('0x78')][_0xe562('0x7c')];return _0x5209fc(_0x4e2415);})['catch'](function(_0x549c52){return _0x19d3e3(_0x549c52);});});}exports['runTranscribe']=function(_0x4b5683,_0x185d66,_0x536538){var _0x3d71d8;var _0xdcd780;var _0x3820c1;var _0x15ad9d=require(_0xe562('0x4b'));return db[_0xe562('0x2a')][_0xe562('0x7d')]({'where':{'id':_0x4b5683[_0xe562('0x48')]['id']}})[_0xe562('0x24')](function(_0x34e587){if(_0x34e587){var _0x8853ca=util[_0xe562('0x4e')]('%s.cypher',_0x34e587[_0xe562('0x4d')]);if(fs[_0xe562('0x4f')](_0x8853ca)){cypher=!![];return _0x15ad9d['decryptFile'](_0x8853ca,_0x34e587['value'],config[_0xe562('0x60')]['recording'])[_0xe562('0x24')](function(){return _0x34e587;});}return _0x34e587;}})[_0xe562('0x24')](function(_0x78f314){if(!_0x78f314){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Voice\x20Recording\x20not\x20found');}_0xdcd780=_0x78f314;return db[_0xe562('0x7e')][_0xe562('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x185d66,null))[_0xe562('0x24')](function(_0x2229fd){if(_0x2229fd){_0x3d71d8=_0x2229fd;if(!_0x3d71d8[_0xe562('0x7f')]||!_0x3d71d8['transcribeAccountId']||!_0x3d71d8[_0xe562('0x80')]||!_0x3d71d8[_0xe562('0x81')]||!_0x3d71d8[_0xe562('0x74')]){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Transcribe\x20not\x20configured');}if(_0x4b5683['body']['runSentiment']&&(!_0x3d71d8['sentiment']||!_0x3d71d8[_0xe562('0x82')]||!_0x3d71d8[_0xe562('0x83')]||!_0x3d71d8[_0xe562('0x81')]||!_0x3d71d8['bucket'])){throw new db['Sequelize'][(_0xe562('0x53'))](_0xe562('0x84'));}return db[_0xe562('0x85')][_0xe562('0x7d')]({'where':{'id':_0x3d71d8[_0xe562('0x86')]}});}})['then'](function(_0x23db46){if(!_0x23db46){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x23db46['data1']||!_0x23db46[_0xe562('0x87')]){throw new db['Sequelize'][(_0xe562('0x53'))](_0xe562('0x88'));}_0x3820c1=_0x23db46;return getBucketslist(_0x3820c1['data1'],_0x3820c1[_0xe562('0x87')],_0x3d71d8['transcribeRegion']);})['then'](function(_0x4b2352){if(_0x4b2352&&_0x4b2352[_0xe562('0x89')]){var _0x2e0d7f=_[_0xe562('0x44')](_0x4b2352['Buckets'],function(_0x5b3c36){return _0x5b3c36['Name']===_0x3d71d8[_0xe562('0x74')];});if(!_0x2e0d7f){logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x8a'),_0x4b5683[_0xe562('0x48')]['id'],_0x3d71d8[_0xe562('0x74')]));return createBucket(_0x3820c1['data1'],_0x3820c1[_0xe562('0x87')],_0x3d71d8[_0xe562('0x80')],_0x3d71d8[_0xe562('0x74')]);}logger[_0xe562('0x69')](util[_0xe562('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4b5683[_0xe562('0x48')]['id'],_0x3d71d8[_0xe562('0x74')]));return;}})['then'](function(_0x666a12){if(_0xdcd780[_0xe562('0x7b')]===_0xe562('0x8b')){return transcribe(_0x4b5683[_0xe562('0x48')]['id'],_0x3820c1[_0xe562('0x8c')],_0x3820c1[_0xe562('0x87')],_0x3d71d8['transcribeRegion'],_0x3d71d8[_0xe562('0x74')],_0xdcd780['value'],_0x3d71d8[_0xe562('0x81')]);}else{logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x8d'),_0x4b5683[_0xe562('0x48')]['id']));return{'transcribeStatus':_0xe562('0x8e')};}})[_0xe562('0x24')](function(_0x105482){if(_0x105482){_0x105482[_0xe562('0x8f')]=_0x4b5683[_0xe562('0x46')]['runSentiment'];return _0xdcd780[_0xe562('0x90')](_0x105482);}})[_0xe562('0x24')](respondWithResult(_0x185d66,null))[_0xe562('0x43')](handleError(_0x185d66,null));};function writeFile(_0x376fe6,_0x1f1ab5){return new Promise(function(_0x4447ed,_0x132863){fs['writeFile'](_0x1f1ab5,_0x376fe6,function(_0x321793,_0x3181e9){if(_0x321793){return _0x132863(_0x321793);}else{return _0x4447ed(_0x3181e9);}});});}exports[_0xe562('0x91')]=function(_0x12c3a3,_0x53f2dd,_0x343113){return db[_0xe562('0x2a')][_0xe562('0x7d')]({'where':{'id':_0x12c3a3[_0xe562('0x48')]['id']}})[_0xe562('0x24')](handleEntityNotFound(_0x53f2dd))[_0xe562('0x24')](function(_0x50e7fb){if(_0x50e7fb&&_0x50e7fb['fileText']){var _0x561de2=_0x50e7fb[_0xe562('0x92')];var _0x1c159b=config[_0xe562('0x93')]+_0xe562('0x94')+_0x50e7fb['id']+_0xe562('0x95');if(fs[_0xe562('0x4f')](_0x1c159b)){return _0x1c159b;}return writeFile(_0x561de2,_0x1c159b)[_0xe562('0x24')](function(){return _0x1c159b;});}else{throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))](_0xe562('0x96'));}})[_0xe562('0x24')](function(_0x354dbf){return _0x53f2dd[_0xe562('0x4a')](_0x354dbf);})[_0xe562('0x43')](handleError(_0x53f2dd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d61e8b1..e055933 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 _0xdd10=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','VoiceRecording','voice_recordings','uniqueid'];(function(_0x12a6d6,_0x5d303e){var _0x114b61=function(_0x289a0e){while(--_0x289a0e){_0x12a6d6['push'](_0x12a6d6['shift']());}};_0x114b61(++_0x5d303e);}(_0xdd10,0x7e));var _0x0dd1=function(_0x2bb18c,_0x3ce844){_0x2bb18c=_0x2bb18c-0x0;var _0x10d918=_0xdd10[_0x2bb18c];return _0x10d918;};'use strict';var _=require(_0x0dd1('0x0'));var util=require(_0x0dd1('0x1'));var logger=require(_0x0dd1('0x2'))(_0x0dd1('0x3'));var moment=require(_0x0dd1('0x4'));var BPromise=require(_0x0dd1('0x5'));var rp=require(_0x0dd1('0x6'));var fs=require('fs');var path=require(_0x0dd1('0x7'));var rimraf=require(_0x0dd1('0x8'));var config=require(_0x0dd1('0x9'));var attributes=require(_0x0dd1('0xa'));module['exports']=function(_0xde6241,_0x359e71){return _0xde6241['define'](_0x0dd1('0xb'),attributes,{'tableName':_0x0dd1('0xc'),'paranoid':![],'indexes':[{'name':_0x0dd1('0xd'),'fields':[_0x0dd1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97dd=['util','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash'];(function(_0x18a1b0,_0x180021){var _0x7315b2=function(_0x3d5c04){while(--_0x3d5c04){_0x18a1b0['push'](_0x18a1b0['shift']());}};_0x7315b2(++_0x180021);}(_0x97dd,0xef));var _0xd97d=function(_0x6b1b97,_0x5a34b7){_0x6b1b97=_0x6b1b97-0x0;var _0x156c7f=_0x97dd[_0x6b1b97];return _0x156c7f;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require('../../config/logger')(_0xd97d('0x2'));var moment=require(_0xd97d('0x3'));var BPromise=require(_0xd97d('0x4'));var rp=require(_0xd97d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd97d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd97d('0x7'));module[_0xd97d('0x8')]=function(_0x572c87,_0x2f1347){return _0x572c87[_0xd97d('0x9')](_0xd97d('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd97d('0xb'),'fields':[_0xd97d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9bf87ce..503a332 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 _0x1967=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','debug','Setting','findOne','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x1967,0x173));var _0x7196=function(_0x395d60,_0x1fbe43){_0x395d60=_0x395d60-0x0;var _0x58bbd7=_0x1967[_0x395d60];return _0x58bbd7;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')](_0x32fe2b[_0x7196('0x1b')],{'raw':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b['options']['attributes']||null:null,'limit':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b[_0x7196('0x1c')]['limit']||null:null})[_0x7196('0xd')](function(_0x27ff84){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger[_0x7196('0x1e')]('UpdateVoiceRecording',_0x32fe2b,JSON[_0x7196('0x12')](_0x27ff84));_0x5b716a(_0x27ff84);})['catch'](function(_0x3ce9a0){logger[_0x7196('0x13')](_0x7196('0x18'),_0x3ce9a0[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d[_0x7196('0x13')](0x1f4,_0x3ce9a0[_0x7196('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x57c404){var _0x1482e5=this;return new Promise(function(_0x2d284f,_0x184c09){var _0x4e878f=require('../../components/encryptor');var _0x41cfd2;return db[_0x7196('0x1f')][_0x7196('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7196('0xd')](function(_0x4ecea1){_0x41cfd2=_0x4ecea1;return db[_0x7196('0x19')]['create'](_0x57c404[_0x7196('0x1b')]);})[_0x7196('0xd')](function(_0x1257ad){if(_0x41cfd2['callRecordingEncryption']&&fs[_0x7196('0x21')](_0x1257ad[_0x7196('0x22')])){var _0x2f9583=util[_0x7196('0x23')]('%s.cypher',_0x1257ad[_0x7196('0x22')]);return _0x4e878f[_0x7196('0x24')](_0x1257ad[_0x7196('0x22')],_0x2f9583,config[_0x7196('0x25')][_0x7196('0x26')])[_0x7196('0xd')](function(){fs[_0x7196('0x27')](_0x1257ad[_0x7196('0x22')]);logger[_0x7196('0xe')](_0x7196('0x28'));return _0x1257ad;});}return _0x1257ad;})[_0x7196('0xd')](function(_0x54e46b){logger[_0x7196('0xe')]('CreateVoiceRecording',_0x57c404);logger[_0x7196('0x1e')]('CreateVoiceRecording',_0x57c404,JSON[_0x7196('0x12')](_0x54e46b));_0x2d284f(_0x54e46b);})[_0x7196('0x17')](function(_0x5616ed){logger[_0x7196('0x13')](_0x7196('0x29'),_0x5616ed[_0x7196('0x15')],_0x57c404);_0x184c09(_0x1482e5[_0x7196('0x13')](0x1f4,_0x5616ed[_0x7196('0x15')]));});});}; \ No newline at end of file +var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x5940c4,_0x11b2c3){var _0x2f8337=function(_0x11c06b){while(--_0x11c06b){_0x5940c4['push'](_0x5940c4['shift']());}};_0x2f8337(++_0x11b2c3);}(_0x66fa,0x117));var _0xa66f=function(_0x5239bf,_0x4aa2f1){_0x5239bf=_0x5239bf-0x0;var _0x20b106=_0x66fa[_0x5239bf];return _0x20b106;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index bb89815..b2f649b 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 _0x33b0=['path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x20ae69,_0x4a02c4){var _0xf71b16=function(_0x30d3f8){while(--_0x30d3f8){_0x20ae69['push'](_0x20ae69['shift']());}};_0xf71b16(++_0x4a02c4);}(_0x33b0,0x1af));var _0x033b=function(_0x5fb1fc,_0x1ffd5f){_0x5fb1fc=_0x5fb1fc-0x0;var _0x41391d=_0x33b0[_0x5fb1fc];return _0x41391d;};'use strict';var multer=require(_0x033b('0x0'));var util=require('util');var path=require(_0x033b('0x1'));var timeout=require(_0x033b('0x2'));var express=require(_0x033b('0x3'));var router=express['Router']();var fs_extra=require(_0x033b('0x4'));var auth=require(_0x033b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x033b('0x6'));router['get']('/',auth[_0x033b('0x7')](),controller[_0x033b('0x8')]);router[_0x033b('0x9')](_0x033b('0xa'),auth[_0x033b('0x7')](),controller['describe']);router['get'](_0x033b('0xb'),auth[_0x033b('0x7')](),controller[_0x033b('0xc')]);router[_0x033b('0xd')]('/',auth[_0x033b('0x7')](),controller[_0x033b('0xe')]);router['put'](_0x033b('0xb'),auth[_0x033b('0x7')](),controller['update']);router[_0x033b('0xf')]('/:id',auth[_0x033b('0x7')](),controller[_0x033b('0x10')]);module[_0x033b('0x11')]=router; \ No newline at end of file +var _0x0f63=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48296c,_0xc556f1){var _0x514a35=function(_0x59e1de){while(--_0x59e1de){_0x48296c['push'](_0x48296c['shift']());}};_0x514a35(++_0xc556f1);}(_0x0f63,0x14c));var _0x30f6=function(_0xc8778e,_0x42280e){_0xc8778e=_0xc8778e-0x0;var _0x1134ab=_0x0f63[_0xc8778e];return _0x1134ab;};'use strict';var multer=require(_0x30f6('0x0'));var util=require(_0x30f6('0x1'));var path=require(_0x30f6('0x2'));var timeout=require(_0x30f6('0x3'));var express=require(_0x30f6('0x4'));var router=express[_0x30f6('0x5')]();var fs_extra=require(_0x30f6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30f6('0x7'));var config=require(_0x30f6('0x8'));var controller=require(_0x30f6('0x9'));router[_0x30f6('0xa')]('/',auth[_0x30f6('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x30f6('0xc')]);router[_0x30f6('0xa')](_0x30f6('0xd'),auth[_0x30f6('0xb')](),controller[_0x30f6('0xe')]);router[_0x30f6('0xf')]('/',auth['isAuthenticated'](),controller[_0x30f6('0x10')]);router[_0x30f6('0x11')](_0x30f6('0xd'),auth[_0x30f6('0xb')](),controller[_0x30f6('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x30f6('0x13')]);module[_0x30f6('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0764362..be64fd4 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 _0x3178=['STRING','Yes','sequelize','exports','ENUM','attended'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3178,0x1e8));var _0x8317=function(_0x59b8d7,_0x47a6a1){_0x59b8d7=_0x59b8d7-0x0;var _0x16c2ca=_0x3178[_0x59b8d7];return _0x16c2ca;};'use strict';var Sequelize=require(_0x8317('0x0'));var moment=require('moment');module[_0x8317('0x1')]={'type':{'type':Sequelize[_0x8317('0x2')]('blind',_0x8317('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8317('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x8317('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x8317('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8317('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x8317('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8317('0x4')]},'transfereechannel':{'type':Sequelize[_0x8317('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x8317('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x8317('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8317('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8317('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x8317('0x4')]},'transfereecontext':{'type':Sequelize[_0x8317('0x4')]},'transfereeexten':{'type':Sequelize[_0x8317('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x8317('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x8317('0x5'),'No')},'context':{'type':Sequelize[_0x8317('0x4')]},'extension':{'type':Sequelize[_0x8317('0x4')]}}; \ No newline at end of file +var _0xef8f=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x4b487e,_0x38ad8c){var _0x3f538d=function(_0x35a858){while(--_0x35a858){_0x4b487e['push'](_0x4b487e['shift']());}};_0x3f538d(++_0x38ad8c);}(_0xef8f,0x7e));var _0xfef8=function(_0x7b9ca4,_0x3b9479){_0x7b9ca4=_0x7b9ca4-0x0;var _0x34ba14=_0xef8f[_0x7b9ca4];return _0x34ba14;};'use strict';var Sequelize=require(_0xfef8('0x0'));var moment=require(_0xfef8('0x1'));module[_0xfef8('0x2')]={'type':{'type':Sequelize[_0xfef8('0x3')](_0xfef8('0x4'),_0xfef8('0x5'))},'result':{'type':Sequelize[_0xfef8('0x6')]},'transfererchannel':{'type':Sequelize[_0xfef8('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xfef8('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xfef8('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xfef8('0x6')]},'transferercontext':{'type':Sequelize[_0xfef8('0x6')]},'transfererexten':{'type':Sequelize[_0xfef8('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xfef8('0x6')]},'transfereechannel':{'type':Sequelize[_0xfef8('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xfef8('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xfef8('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xfef8('0x6')]},'isexternal':{'type':Sequelize[_0xfef8('0x3')](_0xfef8('0x7'),'No')},'context':{'type':Sequelize[_0xfef8('0x6')]},'extension':{'type':Sequelize[_0xfef8('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8a1cf8a..f6c18f4 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 _0xafae=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xafae,0xd8));var _0xeafa=function(_0x5b6353,_0x17c692){_0x5b6353=_0x5b6353-0x0;var _0x5e940b=_0xafae[_0x5b6353];return _0x5e940b;};'use strict';var emlformat=require(_0xeafa('0x0'));var rimraf=require(_0xeafa('0x1'));var zipdir=require(_0xeafa('0x2'));var jsonpatch=require(_0xeafa('0x3'));var rp=require('request-promise');var moment=require(_0xeafa('0x4'));var BPromise=require(_0xeafa('0x5'));var Mustache=require(_0xeafa('0x6'));var util=require(_0xeafa('0x7'));var path=require(_0xeafa('0x8'));var sox=require(_0xeafa('0x9'));var csv=require(_0xeafa('0xa'));var ejs=require(_0xeafa('0xb'));var fs=require('fs');var fs_extra=require(_0xeafa('0xc'));var _=require(_0xeafa('0xd'));var squel=require(_0xeafa('0xe'));var crypto=require(_0xeafa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xeafa('0x10'));var toCsv=require(_0xeafa('0xa'));var querystring=require(_0xeafa('0x11'));var Papa=require(_0xeafa('0x12'));var Redis=require(_0xeafa('0x13'));var authService=require(_0xeafa('0x14'));var qs=require(_0xeafa('0x15'));var as=require(_0xeafa('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeafa('0x17'));var utils=require(_0xeafa('0x18'));var config=require(_0xeafa('0x19'));var licenseUtil=require(_0xeafa('0x1a'));var db=require(_0xeafa('0x1b'))['db'];function respondWithStatusCode(_0x4dacf4,_0x18ad77){_0x18ad77=_0x18ad77||0xcc;return function(_0x50a513){if(_0x50a513){return _0x4dacf4[_0xeafa('0x1c')](_0x18ad77);}return _0x4dacf4[_0xeafa('0x1d')](_0x18ad77)[_0xeafa('0x1e')]();};}function respondWithResult(_0x49cd9e,_0x136aff){_0x136aff=_0x136aff||0xc8;return function(_0x180805){if(_0x180805){return _0x49cd9e[_0xeafa('0x1d')](_0x136aff)[_0xeafa('0x1f')](_0x180805);}};}function respondWithFilteredResult(_0x36c6aa,_0x328287){return function(_0x24581c){if(_0x24581c){var _0x2fad55=typeof _0x328287['offset']==='undefined'&&typeof _0x328287[_0xeafa('0x20')]===_0xeafa('0x21');var _0x1bc9fb=_0x24581c[_0xeafa('0x22')];var _0x510ae9=_0x2fad55?0x0:_0x328287[_0xeafa('0x23')];var _0xd3843d=_0x2fad55?_0x24581c[_0xeafa('0x22')]:_0x328287['offset']+_0x328287[_0xeafa('0x20')];var _0x537177;if(_0xd3843d>=_0x1bc9fb){_0xd3843d=_0x1bc9fb;_0x537177=0xc8;}else{_0x537177=0xce;}_0x36c6aa[_0xeafa('0x1d')](_0x537177);return _0x36c6aa[_0xeafa('0x24')]('Content-Range',_0x510ae9+'-'+_0xd3843d+'/'+_0x1bc9fb)[_0xeafa('0x1f')](_0x24581c);}return null;};}function patchUpdates(_0x10f946){return function(_0x4587b5){try{jsonpatch[_0xeafa('0x25')](_0x4587b5,_0x10f946,!![]);}catch(_0x305e2f){return BPromise['reject'](_0x305e2f);}return _0x4587b5[_0xeafa('0x26')]();};}function saveUpdates(_0x31e10e,_0x48be99){return function(_0x119dee){if(_0x119dee){return _0x119dee[_0xeafa('0x27')](_0x31e10e)[_0xeafa('0x28')](function(_0x141917){return _0x141917;});}return null;};}function removeEntity(_0x5ca40e,_0x1e4fd1){return function(_0x40c982){if(_0x40c982){return _0x40c982[_0xeafa('0x29')]()['then'](function(){_0x5ca40e[_0xeafa('0x1d')](0xcc)[_0xeafa('0x1e')]();});}};}function handleEntityNotFound(_0x4603b6,_0x23e34e){return function(_0xaa6922){if(!_0xaa6922){_0x4603b6[_0xeafa('0x1c')](0x194);}return _0xaa6922;};}function handleError(_0x4e2809,_0x4c6a51){_0x4c6a51=_0x4c6a51||0x1f4;return function(_0x37576e){logger[_0xeafa('0x2a')](_0x37576e[_0xeafa('0x2b')]);if(_0x37576e[_0xeafa('0x2c')]){delete _0x37576e[_0xeafa('0x2c')];}_0x4e2809[_0xeafa('0x1d')](_0x4c6a51)[_0xeafa('0x2d')](_0x37576e);};}exports[_0xeafa('0x2e')]=function(_0x583000,_0x35c8cd){var _0x4c7082={},_0x2321b1={},_0x379caf={'count':0x0,'rows':[]};var _0x1241f1=_[_0xeafa('0x2f')](db['VoiceTransferReport']['rawAttributes'],function(_0x4ed667){return{'name':_0x4ed667[_0xeafa('0x30')],'type':_0x4ed667[_0xeafa('0x31')][_0xeafa('0x32')]};});_0x2321b1[_0xeafa('0x33')]=_[_0xeafa('0x2f')](_0x1241f1,_0xeafa('0x2c'));_0x2321b1[_0xeafa('0x34')]=_['keys'](_0x583000[_0xeafa('0x34')]);_0x2321b1['filters']=_[_0xeafa('0x35')](_0x2321b1[_0xeafa('0x33')],_0x2321b1['query']);_0x4c7082[_0xeafa('0x36')]=_[_0xeafa('0x35')](_0x2321b1[_0xeafa('0x33')],qs[_0xeafa('0x37')](_0x583000[_0xeafa('0x34')][_0xeafa('0x37')]));_0x4c7082[_0xeafa('0x36')]=_0x4c7082['attributes'][_0xeafa('0x38')]?_0x4c7082['attributes']:_0x2321b1['model'];if(!_0x583000[_0xeafa('0x34')][_0xeafa('0x39')](_0xeafa('0x3a'))){_0x4c7082[_0xeafa('0x20')]=qs[_0xeafa('0x20')](_0x583000['query'][_0xeafa('0x20')]);_0x4c7082[_0xeafa('0x23')]=qs['offset'](_0x583000[_0xeafa('0x34')]['offset']);}_0x4c7082[_0xeafa('0x3b')]=qs[_0xeafa('0x3c')](_0x583000[_0xeafa('0x34')][_0xeafa('0x3c')]);_0x4c7082[_0xeafa('0x3d')]=qs[_0xeafa('0x3e')](_[_0xeafa('0x3f')](_0x583000[_0xeafa('0x34')],_0x2321b1['filters']),_0x1241f1);if(_0x583000[_0xeafa('0x34')][_0xeafa('0x40')]){_0x4c7082[_0xeafa('0x3d')]=_[_0xeafa('0x41')](_0x4c7082[_0xeafa('0x3d')],{'$or':_['map'](_0x1241f1,function(_0x41d82e){if(_0x41d82e[_0xeafa('0x31')]!==_0xeafa('0x42')){var _0x396098={};_0x396098[_0x41d82e[_0xeafa('0x2c')]]={'$like':'%'+_0x583000['query'][_0xeafa('0x40')]+'%'};return _0x396098;}})});}_0x4c7082=_[_0xeafa('0x41')]({},_0x4c7082,_0x583000[_0xeafa('0x43')]);var _0xbde9bf={'where':_0x4c7082[_0xeafa('0x3d')]};return db[_0xeafa('0x44')]['count'](_0xbde9bf)[_0xeafa('0x28')](function(_0x52a642){_0x379caf[_0xeafa('0x22')]=_0x52a642;if(_0x583000[_0xeafa('0x34')][_0xeafa('0x45')]){_0x4c7082[_0xeafa('0x46')]=[{'all':!![]}];}return db[_0xeafa('0x44')][_0xeafa('0x47')](_0x4c7082);})[_0xeafa('0x28')](function(_0x20035a){_0x379caf[_0xeafa('0x48')]=_0x20035a;return _0x379caf;})['then'](respondWithFilteredResult(_0x35c8cd,_0x4c7082))[_0xeafa('0x49')](handleError(_0x35c8cd,null));};exports['show']=function(_0x2a5448,_0x3c15ea){var _0x189d17={'raw':!![],'where':{'id':_0x2a5448[_0xeafa('0x4a')]['id']}},_0x45f65c={};_0x45f65c[_0xeafa('0x33')]=_[_0xeafa('0x4b')](db[_0xeafa('0x44')][_0xeafa('0x4c')]);_0x45f65c[_0xeafa('0x34')]=_['keys'](_0x2a5448[_0xeafa('0x34')]);_0x45f65c[_0xeafa('0x3e')]=_[_0xeafa('0x35')](_0x45f65c[_0xeafa('0x33')],_0x45f65c[_0xeafa('0x34')]);_0x189d17[_0xeafa('0x36')]=_[_0xeafa('0x35')](_0x45f65c[_0xeafa('0x33')],qs[_0xeafa('0x37')](_0x2a5448[_0xeafa('0x34')][_0xeafa('0x37')]));_0x189d17['attributes']=_0x189d17[_0xeafa('0x36')]['length']?_0x189d17[_0xeafa('0x36')]:_0x45f65c[_0xeafa('0x33')];if(_0x2a5448[_0xeafa('0x34')][_0xeafa('0x45')]){_0x189d17['include']=[{'all':!![]}];}_0x189d17=_[_0xeafa('0x41')]({},_0x189d17,_0x2a5448[_0xeafa('0x43')]);return db[_0xeafa('0x44')]['find'](_0x189d17)[_0xeafa('0x28')](handleEntityNotFound(_0x3c15ea,null))[_0xeafa('0x28')](respondWithResult(_0x3c15ea,null))[_0xeafa('0x49')](handleError(_0x3c15ea,null));};exports['create']=function(_0x4cdfeb,_0x4aafe9){return db[_0xeafa('0x44')][_0xeafa('0x4d')](_0x4cdfeb[_0xeafa('0x4e')],{})[_0xeafa('0x28')](respondWithResult(_0x4aafe9,0xc9))[_0xeafa('0x49')](handleError(_0x4aafe9,null));};exports[_0xeafa('0x27')]=function(_0x1722b1,_0x1f0932){if(_0x1722b1[_0xeafa('0x4e')]['id']){delete _0x1722b1[_0xeafa('0x4e')]['id'];}return db['VoiceTransferReport'][_0xeafa('0x4f')]({'where':{'id':_0x1722b1[_0xeafa('0x4a')]['id']}})[_0xeafa('0x28')](handleEntityNotFound(_0x1f0932,null))[_0xeafa('0x28')](saveUpdates(_0x1722b1['body'],null))[_0xeafa('0x28')](respondWithResult(_0x1f0932,null))['catch'](handleError(_0x1f0932,null));};exports[_0xeafa('0x29')]=function(_0x3282c2,_0xfca91d){return db['VoiceTransferReport'][_0xeafa('0x4f')]({'where':{'id':_0x3282c2['params']['id']}})[_0xeafa('0x28')](handleEntityNotFound(_0xfca91d,null))[_0xeafa('0x28')](removeEntity(_0xfca91d,null))[_0xeafa('0x49')](handleError(_0xfca91d,null));};exports['describe']=function(_0x34f594,_0x4c09ff){return db['VoiceTransferReport'][_0xeafa('0x50')]()['then'](respondWithResult(_0x4c09ff,null))[_0xeafa('0x49')](handleError(_0x4c09ff,null));}; \ No newline at end of file +var _0xb5dd=['end','json','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0xb5dd,0x7b));var _0xdb5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5dd[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xdb5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb5d('0x1'));var rp=require(_0xdb5d('0x2'));var moment=require('moment');var BPromise=require(_0xdb5d('0x3'));var Mustache=require(_0xdb5d('0x4'));var util=require(_0xdb5d('0x5'));var path=require(_0xdb5d('0x6'));var sox=require(_0xdb5d('0x7'));var csv=require('to-csv');var ejs=require(_0xdb5d('0x8'));var fs=require('fs');var fs_extra=require(_0xdb5d('0x9'));var _=require(_0xdb5d('0xa'));var squel=require(_0xdb5d('0xb'));var crypto=require(_0xdb5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb5d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdb5d('0xe'));var Papa=require(_0xdb5d('0xf'));var Redis=require(_0xdb5d('0x10'));var authService=require(_0xdb5d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb5d('0x12'));var hardwareService=require(_0xdb5d('0x13'));var logger=require('../../config/logger')(_0xdb5d('0x14'));var utils=require(_0xdb5d('0x15'));var config=require(_0xdb5d('0x16'));var licenseUtil=require(_0xdb5d('0x17'));var db=require(_0xdb5d('0x18'))['db'];function respondWithStatusCode(_0x541928,_0x42d2f9){_0x42d2f9=_0x42d2f9||0xcc;return function(_0x4fd7e9){if(_0x4fd7e9){return _0x541928[_0xdb5d('0x19')](_0x42d2f9);}return _0x541928[_0xdb5d('0x1a')](_0x42d2f9)[_0xdb5d('0x1b')]();};}function respondWithResult(_0x13edcc,_0x12ead0){_0x12ead0=_0x12ead0||0xc8;return function(_0x180cd8){if(_0x180cd8){return _0x13edcc[_0xdb5d('0x1a')](_0x12ead0)[_0xdb5d('0x1c')](_0x180cd8);}};}function respondWithFilteredResult(_0x5afdd6,_0xd795c5){return function(_0x349867){if(_0x349867){var _0x5c7b4f=typeof _0xd795c5['offset']===_0xdb5d('0x1d')&&typeof _0xd795c5[_0xdb5d('0x1e')]===_0xdb5d('0x1d');var _0x1ee3cc=_0x349867[_0xdb5d('0x1f')];var _0x295ad3=_0x5c7b4f?0x0:_0xd795c5['offset'];var _0x11bb4c=_0x5c7b4f?_0x349867[_0xdb5d('0x1f')]:_0xd795c5['offset']+_0xd795c5[_0xdb5d('0x1e')];var _0x36c930;if(_0x11bb4c>=_0x1ee3cc){_0x11bb4c=_0x1ee3cc;_0x36c930=0xc8;}else{_0x36c930=0xce;}_0x5afdd6[_0xdb5d('0x1a')](_0x36c930);return _0x5afdd6['set'](_0xdb5d('0x20'),_0x295ad3+'-'+_0x11bb4c+'/'+_0x1ee3cc)['json'](_0x349867);}return null;};}function patchUpdates(_0x1199ea){return function(_0x26ccab){try{jsonpatch[_0xdb5d('0x21')](_0x26ccab,_0x1199ea,!![]);}catch(_0x313a78){return BPromise['reject'](_0x313a78);}return _0x26ccab['save']();};}function saveUpdates(_0x19b813,_0x268352){return function(_0x2a213a){if(_0x2a213a){return _0x2a213a[_0xdb5d('0x22')](_0x19b813)[_0xdb5d('0x23')](function(_0x127028){return _0x127028;});}return null;};}function removeEntity(_0x299358,_0x5a0f12){return function(_0x2c8170){if(_0x2c8170){return _0x2c8170[_0xdb5d('0x24')]()['then'](function(){_0x299358['status'](0xcc)[_0xdb5d('0x1b')]();});}};}function handleEntityNotFound(_0x2d0f0b,_0x5ae360){return function(_0x3911b4){if(!_0x3911b4){_0x2d0f0b[_0xdb5d('0x19')](0x194);}return _0x3911b4;};}function handleError(_0x49c45d,_0xd066f5){_0xd066f5=_0xd066f5||0x1f4;return function(_0x55da52){logger[_0xdb5d('0x25')](_0x55da52[_0xdb5d('0x26')]);if(_0x55da52[_0xdb5d('0x27')]){delete _0x55da52[_0xdb5d('0x27')];}_0x49c45d['status'](_0xd066f5)['send'](_0x55da52);};}exports[_0xdb5d('0x28')]=function(_0x408c9b,_0x10b716){var _0x27ba12={},_0x42a606={},_0x279e6e={'count':0x0,'rows':[]};var _0x1b8d17=_[_0xdb5d('0x29')](db[_0xdb5d('0x2a')][_0xdb5d('0x2b')],function(_0x6cce1){return{'name':_0x6cce1[_0xdb5d('0x2c')],'type':_0x6cce1[_0xdb5d('0x2d')][_0xdb5d('0x2e')]};});_0x42a606['model']=_[_0xdb5d('0x29')](_0x1b8d17,_0xdb5d('0x27'));_0x42a606[_0xdb5d('0x2f')]=_[_0xdb5d('0x30')](_0x408c9b['query']);_0x42a606[_0xdb5d('0x31')]=_[_0xdb5d('0x32')](_0x42a606[_0xdb5d('0x33')],_0x42a606['query']);_0x27ba12[_0xdb5d('0x34')]=_[_0xdb5d('0x32')](_0x42a606[_0xdb5d('0x33')],qs[_0xdb5d('0x35')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x35')]));_0x27ba12['attributes']=_0x27ba12[_0xdb5d('0x34')][_0xdb5d('0x36')]?_0x27ba12[_0xdb5d('0x34')]:_0x42a606['model'];if(!_0x408c9b[_0xdb5d('0x2f')]['hasOwnProperty'](_0xdb5d('0x37'))){_0x27ba12[_0xdb5d('0x1e')]=qs['limit'](_0x408c9b['query'][_0xdb5d('0x1e')]);_0x27ba12[_0xdb5d('0x38')]=qs[_0xdb5d('0x38')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x38')]);}_0x27ba12[_0xdb5d('0x39')]=qs[_0xdb5d('0x3a')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x3a')]);_0x27ba12[_0xdb5d('0x3b')]=qs['filters'](_[_0xdb5d('0x3c')](_0x408c9b[_0xdb5d('0x2f')],_0x42a606['filters']),_0x1b8d17);if(_0x408c9b['query'][_0xdb5d('0x3d')]){_0x27ba12[_0xdb5d('0x3b')]=_[_0xdb5d('0x3e')](_0x27ba12[_0xdb5d('0x3b')],{'$or':_[_0xdb5d('0x29')](_0x1b8d17,function(_0x1fd7ee){if(_0x1fd7ee[_0xdb5d('0x2d')]!==_0xdb5d('0x3f')){var _0x4520bb={};_0x4520bb[_0x1fd7ee[_0xdb5d('0x27')]]={'$like':'%'+_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x3d')]+'%'};return _0x4520bb;}})});}_0x27ba12=_[_0xdb5d('0x3e')]({},_0x27ba12,_0x408c9b[_0xdb5d('0x40')]);var _0x4ee4aa={'where':_0x27ba12[_0xdb5d('0x3b')]};return db[_0xdb5d('0x2a')][_0xdb5d('0x1f')](_0x4ee4aa)[_0xdb5d('0x23')](function(_0x2059bc){_0x279e6e['count']=_0x2059bc;if(_0x408c9b['query'][_0xdb5d('0x41')]){_0x27ba12['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xdb5d('0x42')](_0x27ba12);})[_0xdb5d('0x23')](function(_0x11117e){_0x279e6e[_0xdb5d('0x43')]=_0x11117e;return _0x279e6e;})[_0xdb5d('0x23')](respondWithFilteredResult(_0x10b716,_0x27ba12))[_0xdb5d('0x44')](handleError(_0x10b716,null));};exports['show']=function(_0x40a687,_0xc33c88){var _0x2e5639={'raw':!![],'where':{'id':_0x40a687[_0xdb5d('0x45')]['id']}},_0x25a0d1={};_0x25a0d1[_0xdb5d('0x33')]=_['keys'](db[_0xdb5d('0x2a')][_0xdb5d('0x2b')]);_0x25a0d1[_0xdb5d('0x2f')]=_[_0xdb5d('0x30')](_0x40a687[_0xdb5d('0x2f')]);_0x25a0d1[_0xdb5d('0x31')]=_[_0xdb5d('0x32')](_0x25a0d1[_0xdb5d('0x33')],_0x25a0d1[_0xdb5d('0x2f')]);_0x2e5639[_0xdb5d('0x34')]=_[_0xdb5d('0x32')](_0x25a0d1[_0xdb5d('0x33')],qs[_0xdb5d('0x35')](_0x40a687[_0xdb5d('0x2f')][_0xdb5d('0x35')]));_0x2e5639[_0xdb5d('0x34')]=_0x2e5639[_0xdb5d('0x34')][_0xdb5d('0x36')]?_0x2e5639[_0xdb5d('0x34')]:_0x25a0d1[_0xdb5d('0x33')];if(_0x40a687['query']['includeAll']){_0x2e5639[_0xdb5d('0x46')]=[{'all':!![]}];}_0x2e5639=_[_0xdb5d('0x3e')]({},_0x2e5639,_0x40a687[_0xdb5d('0x40')]);return db['VoiceTransferReport'][_0xdb5d('0x47')](_0x2e5639)[_0xdb5d('0x23')](handleEntityNotFound(_0xc33c88,null))[_0xdb5d('0x23')](respondWithResult(_0xc33c88,null))[_0xdb5d('0x44')](handleError(_0xc33c88,null));};exports['create']=function(_0x319d61,_0xe21e05){return db[_0xdb5d('0x2a')][_0xdb5d('0x48')](_0x319d61[_0xdb5d('0x49')],{})[_0xdb5d('0x23')](respondWithResult(_0xe21e05,0xc9))[_0xdb5d('0x44')](handleError(_0xe21e05,null));};exports[_0xdb5d('0x22')]=function(_0x14a07c,_0x2b8713){if(_0x14a07c['body']['id']){delete _0x14a07c[_0xdb5d('0x49')]['id'];}return db[_0xdb5d('0x2a')][_0xdb5d('0x47')]({'where':{'id':_0x14a07c[_0xdb5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b8713,null))[_0xdb5d('0x23')](saveUpdates(_0x14a07c['body'],null))[_0xdb5d('0x23')](respondWithResult(_0x2b8713,null))['catch'](handleError(_0x2b8713,null));};exports[_0xdb5d('0x24')]=function(_0x1042f4,_0x3f2d11){return db[_0xdb5d('0x2a')][_0xdb5d('0x47')]({'where':{'id':_0x1042f4[_0xdb5d('0x45')]['id']}})[_0xdb5d('0x23')](handleEntityNotFound(_0x3f2d11,null))['then'](removeEntity(_0x3f2d11,null))['catch'](handleError(_0x3f2d11,null));};exports['describe']=function(_0x3d6242,_0x4465f8){return db[_0xdb5d('0x2a')][_0xdb5d('0x4a')]()['then'](respondWithResult(_0x4465f8,null))[_0xdb5d('0x44')](handleError(_0x4465f8,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5398741..d35930c 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 _0xe515=['request-promise','path','rimraf','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe515,0x137));var _0x5e51=function(_0x3fcbeb,_0x343084){_0x3fcbeb=_0x3fcbeb-0x0;var _0x4ae2a5=_0xe515[_0x3fcbeb];return _0x4ae2a5;};'use strict';var _=require(_0x5e51('0x0'));var util=require(_0x5e51('0x1'));var logger=require(_0x5e51('0x2'))(_0x5e51('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e51('0x4'));var fs=require('fs');var path=require(_0x5e51('0x5'));var rimraf=require(_0x5e51('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e51('0x7'));module['exports']=function(_0x447de5,_0x4c919b){return _0x447de5['define'](_0x5e51('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd6b=['path','rimraf','./voiceTransferReport.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd6b,0x1b2));var _0xbbd6=function(_0x4f8b73,_0x499742){_0x4f8b73=_0x4f8b73-0x0;var _0x4ae551=_0xbd6b[_0x4f8b73];return _0x4ae551;};'use strict';var _=require(_0xbbd6('0x0'));var util=require(_0xbbd6('0x1'));var logger=require('../../config/logger')(_0xbbd6('0x2'));var moment=require(_0xbbd6('0x3'));var BPromise=require(_0xbbd6('0x4'));var rp=require(_0xbbd6('0x5'));var fs=require('fs');var path=require(_0xbbd6('0x6'));var rimraf=require(_0xbbd6('0x7'));var config=require('../../config/environment');var attributes=require(_0xbbd6('0x8'));module[_0xbbd6('0x9')]=function(_0x41a849,_0x14d34e){return _0x41a849[_0xbbd6('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','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 fa5949a..c38ad4f 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 _0x9bd9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','then','info','moment','bluebird'];(function(_0x131fc0,_0x1f38ba){var _0x388455=function(_0x3439c4){while(--_0x3439c4){_0x131fc0['push'](_0x131fc0['shift']());}};_0x388455(++_0x1f38ba);}(_0x9bd9,0x178));var _0x99bd=function(_0x250f95,_0x5a5728){_0x250f95=_0x250f95-0x0;var _0x4ada97=_0x9bd9[_0x250f95];return _0x4ada97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x99bd('0x0'));var BPromise=require(_0x99bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99bd('0x2'))['db'];var utils=require(_0x99bd('0x3'));var logger=require(_0x99bd('0x4'))('rpc');var config=require(_0x99bd('0x5'));var jayson=require(_0x99bd('0x6'));var client=jayson[_0x99bd('0x7')][_0x99bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43ef9c,_0xae1707,_0x4e2e4e){return new BPromise(function(_0x2a1f7f,_0xaf3b6c){return client[_0x99bd('0x9')](_0x43ef9c,_0x4e2e4e)['then'](function(_0x1f618a){logger['info'](_0x99bd('0xa'),_0xae1707,_0x99bd('0xb'));logger[_0x99bd('0xc')](_0x99bd('0xd'),_0xae1707,'request\x20sent',JSON[_0x99bd('0xe')](_0x1f618a));if(_0x1f618a['error']){if(_0x1f618a['error'][_0x99bd('0xf')]===0x1f4){logger[_0x99bd('0x10')](_0x99bd('0xa'),_0xae1707,_0x1f618a[_0x99bd('0x10')]['message']);return _0xaf3b6c(_0x1f618a[_0x99bd('0x10')][_0x99bd('0x11')]);}logger[_0x99bd('0x10')](_0x99bd('0xa'),_0xae1707,_0x1f618a['error'][_0x99bd('0x11')]);return _0x2a1f7f(_0x1f618a[_0x99bd('0x10')][_0x99bd('0x11')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0xae1707,_0x99bd('0xb'));_0x2a1f7f(_0x1f618a[_0x99bd('0x12')][_0x99bd('0x11')]);}})[_0x99bd('0x13')](function(_0xf1fdb0){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xae1707,_0xf1fdb0);_0xaf3b6c(_0xf1fdb0);});});}exports[_0x99bd('0x14')]=function(_0x1382ec){var _0x78a03c=this;return new Promise(function(_0x680318,_0x38e775){return db['VoiceTransferReport'][_0x99bd('0x15')](_0x1382ec[_0x99bd('0x16')],{'raw':_0x1382ec[_0x99bd('0x17')]?_0x1382ec[_0x99bd('0x17')][_0x99bd('0x18')]===undefined?!![]:![]:!![]})[_0x99bd('0x19')](function(_0x406249){logger[_0x99bd('0x1a')]('CreateVoiceTransferReport',_0x1382ec);logger[_0x99bd('0xc')](_0x99bd('0x14'),_0x1382ec,JSON[_0x99bd('0xe')](_0x406249));_0x680318(_0x406249);})[_0x99bd('0x13')](function(_0x348c00){logger['error'](_0x99bd('0x14'),_0x348c00[_0x99bd('0x11')],_0x1382ec);_0x38e775(_0x78a03c[_0x99bd('0x10')](0x1f4,_0x348c00['message']));});});}; \ No newline at end of file +var _0x3cde=['../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','create','options','raw','debug','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xce8299,_0x55ec18){var _0xa39773=function(_0x42682){while(--_0x42682){_0xce8299['push'](_0xce8299['shift']());}};_0xa39773(++_0x55ec18);}(_0x3cde,0x12c));var _0xe3cd=function(_0x144b94,_0x5e984f){_0x144b94=_0x144b94-0x0;var _0x33cc48=_0x3cde[_0x144b94];return _0x33cc48;};'use strict';var _=require(_0xe3cd('0x0'));var util=require(_0xe3cd('0x1'));var moment=require(_0xe3cd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3cd('0x3'));var db=require(_0xe3cd('0x4'))['db'];var utils=require(_0xe3cd('0x5'));var logger=require(_0xe3cd('0x6'))(_0xe3cd('0x7'));var config=require(_0xe3cd('0x8'));var jayson=require(_0xe3cd('0x9'));var client=jayson[_0xe3cd('0xa')][_0xe3cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x198a99,_0x5d6da0,_0x4ab99e){return new BPromise(function(_0x541882,_0x3d9dad){return client['request'](_0x198a99,_0x4ab99e)[_0xe3cd('0xc')](function(_0x107d19){logger[_0xe3cd('0xd')](_0xe3cd('0xe'),_0x5d6da0,_0xe3cd('0xf'));logger['debug'](_0xe3cd('0x10'),_0x5d6da0,_0xe3cd('0xf'),JSON[_0xe3cd('0x11')](_0x107d19));if(_0x107d19[_0xe3cd('0x12')]){if(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x13')]===0x1f4){logger[_0xe3cd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d6da0,_0x107d19['error'][_0xe3cd('0x14')]);return _0x3d9dad(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);}logger[_0xe3cd('0x12')](_0xe3cd('0xe'),_0x5d6da0,_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);return _0x541882(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5d6da0,_0xe3cd('0xf'));_0x541882(_0x107d19[_0xe3cd('0x15')][_0xe3cd('0x14')]);}})['catch'](function(_0x205ac9){logger[_0xe3cd('0x12')](_0xe3cd('0xe'),_0x5d6da0,_0x205ac9);_0x3d9dad(_0x205ac9);});});}exports[_0xe3cd('0x16')]=function(_0x497889){var _0x3a720a=this;return new Promise(function(_0x364af3,_0x1fe181){return db['VoiceTransferReport'][_0xe3cd('0x17')](_0x497889['body'],{'raw':_0x497889[_0xe3cd('0x18')]?_0x497889['options'][_0xe3cd('0x19')]===undefined?!![]:![]:!![]})[_0xe3cd('0xc')](function(_0x2d5cc0){logger[_0xe3cd('0xd')](_0xe3cd('0x16'),_0x497889);logger[_0xe3cd('0x1a')](_0xe3cd('0x16'),_0x497889,JSON[_0xe3cd('0x11')](_0x2d5cc0));_0x364af3(_0x2d5cc0);})[_0xe3cd('0x1b')](function(_0x2486c8){logger[_0xe3cd('0x12')](_0xe3cd('0x16'),_0x2486c8[_0xe3cd('0x14')],_0x497889);_0x1fe181(_0x3a720a[_0xe3cd('0x12')](0x1f4,_0x2486c8[_0xe3cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fc5af2f..998a8e9 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x35d58a,_0x2b7322){var _0x1c09c9=function(_0x4e60e2){while(--_0x4e60e2){_0x35d58a['push'](_0x35d58a['shift']());}};_0x1c09c9(++_0x2b7322);}(_0x9f62,0x154));var _0x29f6=function(_0x470708,_0x1b850f){_0x470708=_0x470708-0x0;var _0x5f16ec=_0x9f62[_0x470708];return _0x5f16ec;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x70e0,0x17b));var _0x070e=function(_0x4b0f47,_0x2afa59){_0x4b0f47=_0x4b0f47-0x0;var _0x317313=_0x70e0[_0x4b0f47];return _0x317313;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);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 b2103f2..9554520 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 _0xb821=['hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','bluebird','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','then','code','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callerId','callbackUrl','format','user:%s','originate\x20executed!','catch'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xb821,0xa7));var _0x1b82=function(_0x29fd3b,_0x59019e){_0x29fd3b=_0x29fd3b-0x0;var _0x61f2a5=_0xb821[_0x29fd3b];return _0x61f2a5;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x1b82('0x0'));var db=require(_0x1b82('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x1b82('0x2'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x1b82('0x3')]({'port':0x232a});var logger=require(_0x1b82('0x4'))(_0x1b82('0x5'));var Redis=require(_0x1b82('0x6'));config['redis']=_[_0x1b82('0x7')](config[_0x1b82('0x8')],{'host':_0x1b82('0x9'),'port':0x18eb});var io=require(_0x1b82('0xa'))(new Redis(config[_0x1b82('0x8')]));var Schema=require(_0x1b82('0xb'));var originateValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],_0x1b82('0xd')]},'callNumber':{'type':_0x1b82('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x1b82('0xe')},'callbackUrl':{'type':_0x1b82('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],_0x1b82('0xd')]},'sessionId':{'type':_0x1b82('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],_0x1b82('0xd')]},'sessionId':{'type':_0x1b82('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1b82('0xd')]},'sessionId':{'type':_0x1b82('0xe'),'required':[!![],_0x1b82('0xf')]},'transferNumber':{'type':_0x1b82('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1b82('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x1b82('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x563261,_0x1b115b,_0x5eb8ed){logger[_0x1b82('0x10')](_0x563261,_0x1b115b,JSON[_0x1b82('0x11')](_0x5eb8ed));io['to'](_0x563261)[_0x1b82('0x12')](_0x1b115b,_0x5eb8ed);}function handleError(_0x4a09a2){return function(_0x514082){console[_0x1b82('0x13')]('handleError:',_0x514082,_0x514082 instanceof RangeError);logger[_0x1b82('0x14')](_0x514082[_0x1b82('0x15')]);if(_0x514082 instanceof RangeError){if(_0x514082[_0x1b82('0x16')]){delete _0x514082['name'];}_0x4a09a2[_0x1b82('0x17')](0x194)[_0x1b82('0x18')](_0x514082);}else{if(_0x514082[_0x1b82('0x16')]){delete _0x514082[_0x1b82('0x16')];}_0x4a09a2[_0x1b82('0x17')](0x1f4)['send'](_0x514082);}};}function checkError(){return function(_0x35a2c8){if(!_0x35a2c8){throw new RangeError(_0x1b82('0x19'));}return _0x35a2c8;};}function respondWithRpcPromise(_0x39e668,_0x1d50b6){return new BPromise(function(_0x26e481,_0x31fd64){var _0x2d07f4=amiClient;return _0x2d07f4['request'](_0x39e668,_0x1d50b6)[_0x1b82('0x1a')](function(_0x233740){if(_0x233740['error']){if(_0x233740[_0x1b82('0x14')][_0x1b82('0x1b')]===0x1f4){return _0x31fd64(_0x233740[_0x1b82('0x14')]['message']);}return _0x26e481(_0x233740[_0x1b82('0x14')]['message']);}else{_0x26e481(_0x233740['result']);}})['catch'](function(_0xf2e556){_0x31fd64(_0xf2e556);});});}function getAgent(_0x149d0f){return db[_0x1b82('0x1c')][_0x1b82('0x1d')]({'where':{'id':_0x149d0f,'role':'agent'}})[_0x1b82('0x1a')](checkError());}function getAgentCheckSession(_0x165b45,_0x1b5260){return new BPromise(function(_0x7455e8,_0x2d78b5){var _0x1b8b6f=respondWithRpcPromise(_0x1b82('0x1e'));var _0x21ea34=getAgent(_0x165b45);Promise[_0x1b82('0x1f')]([_0x1b8b6f,_0x21ea34])[_0x1b82('0x1a')](function(_0x2fe45d){var _0x37275f=_0x2fe45d[0x0];var _0x466441=_0x2fe45d[0x1];var _0x5ea890=_[_0x1b82('0x20')](_0x37275f[_0x1b82('0x21')],function(_0x155a34){return _0x155a34[_0x1b82('0x22')]==_0x466441['id']&&_0x155a34[_0x1b82('0x23')]==_0x1b5260;});if(_0x5ea890[_0x1b82('0x24')]==0x1){_0x7455e8(_0x466441);}else{_0x2d78b5(new RangeError(_0x1b82('0x25')+_0x1b5260+_0x1b82('0x26')));}});});}exports[_0x1b82('0x27')]=function(_0x362657,_0x501ab0){logger[_0x1b82('0x10')](_0x1b82('0x28'),_0x362657[_0x1b82('0x29')]);var _0xc98ee2=originateValidation['validate'](_0x362657[_0x1b82('0x29')]);if(_0xc98ee2[_0x1b82('0x24')]>0x0){return _0x501ab0['status'](0x190)[_0x1b82('0x2a')](_0xc98ee2);}var _0x27b8f1=_0x362657[_0x1b82('0x29')]['userId'];var _0x5efb8e=_0x362657[_0x1b82('0x29')]['callNumber'];var _0x5df802=_0x362657[_0x1b82('0x29')][_0x1b82('0x2b')];var _0x7fd793=_0x362657['body'][_0x1b82('0x2c')];return getAgent(_0x27b8f1)[_0x1b82('0x1a')](function(_0xea774a){logger[_0x1b82('0x10')]('entityFound:',_0xea774a[_0x1b82('0x16')]);emit(util[_0x1b82('0x2d')](_0x1b82('0x2e'),_0xea774a['name']),'webbar:originate',{'callNumber':_0x5efb8e,'callerId':_0x5df802,'callbackUrl':_0x7fd793});return _0x501ab0[_0x1b82('0x17')](0xc8)['json']({'error':![],'message':_0x1b82('0x2f')});})[_0x1b82('0x30')](handleError(_0x501ab0));};exports[_0x1b82('0x31')]=function(_0x348880,_0x1255db){logger[_0x1b82('0x10')](_0x1b82('0x32'),_0x348880[_0x1b82('0x29')]);var _0x47cd9f=hangupValidation['validate'](_0x348880[_0x1b82('0x29')]);if(_0x47cd9f['length']>0x0){return _0x1255db[_0x1b82('0x17')](0x190)['json'](_0x47cd9f);}var _0x1c5bc1=_0x348880[_0x1b82('0x29')][_0x1b82('0x33')];var _0x2c1cd0=_0x348880[_0x1b82('0x29')][_0x1b82('0x23')];return getAgent(_0x1c5bc1)['then'](function(_0x17d214){logger['info'](_0x1b82('0x34'),_0x17d214['name']);emit(util[_0x1b82('0x2d')]('user:%s',_0x17d214['name']),_0x1b82('0x35'),{'sessionId':_0x2c1cd0});return _0x1255db[_0x1b82('0x17')](0xc8)[_0x1b82('0x2a')]({'error':![],'message':_0x1b82('0x36')});})[_0x1b82('0x30')](handleError(_0x1255db));};exports['answer']=function(_0x16f26d,_0x4ffa9e){logger[_0x1b82('0x10')](_0x1b82('0x37'),_0x16f26d[_0x1b82('0x29')]);var _0x3adf9c=answerValidation[_0x1b82('0xb')](_0x16f26d['body']);if(_0x3adf9c[_0x1b82('0x24')]>0x0){return _0x4ffa9e['status'](0x190)[_0x1b82('0x2a')](_0x3adf9c);}var _0x14b3ab=_0x16f26d['body'][_0x1b82('0x33')];var _0x225f6b=_0x16f26d[_0x1b82('0x29')][_0x1b82('0x23')];return getAgent(_0x14b3ab)[_0x1b82('0x1a')](function(_0x199213){logger[_0x1b82('0x10')]('entityFound:',_0x199213[_0x1b82('0x16')]);emit(util['format'](_0x1b82('0x2e'),_0x199213[_0x1b82('0x16')]),_0x1b82('0x38'),{'sessionId':_0x225f6b});return _0x4ffa9e[_0x1b82('0x17')](0xc8)[_0x1b82('0x2a')]({'error':![],'message':_0x1b82('0x39')});})[_0x1b82('0x30')](handleError(_0x4ffa9e));};exports[_0x1b82('0x3a')]=function(_0x192ce3,_0x120b35){logger[_0x1b82('0x10')](_0x1b82('0x3b'),_0x192ce3[_0x1b82('0x29')]);var _0x432e84=holdValidation['validate'](_0x192ce3['body']);if(_0x432e84[_0x1b82('0x24')]>0x0){return _0x120b35['status'](0x190)[_0x1b82('0x2a')](_0x432e84);}var _0x3df0af=_0x192ce3[_0x1b82('0x29')]['userId'];var _0x409a41=_0x192ce3['body']['sessionId'];return getAgent(_0x3df0af)[_0x1b82('0x1a')](function(_0x2aadf7){logger[_0x1b82('0x10')]('entityFound:',_0x2aadf7[_0x1b82('0x16')]);emit(util[_0x1b82('0x2d')]('user:%s',_0x2aadf7['name']),_0x1b82('0x3c'),{'sessionId':_0x409a41});return _0x120b35[_0x1b82('0x17')](0xc8)[_0x1b82('0x2a')]({'error':![],'message':'hold\x20executed!'});})[_0x1b82('0x30')](handleError(_0x120b35));};exports[_0x1b82('0x3d')]=function(_0x31fb5d,_0x29f9ae){logger[_0x1b82('0x10')](_0x1b82('0x3e'),_0x31fb5d['body']);var _0x3914aa=unholdValidation['validate'](_0x31fb5d[_0x1b82('0x29')]);if(_0x3914aa[_0x1b82('0x24')]>0x0){return _0x29f9ae['status'](0x190)[_0x1b82('0x2a')](_0x3914aa);}var _0x5de11b=_0x31fb5d[_0x1b82('0x29')][_0x1b82('0x33')];var _0x26051f=_0x31fb5d[_0x1b82('0x29')][_0x1b82('0x23')];return getAgent(_0x5de11b)[_0x1b82('0x1a')](function(_0x493491){logger['info'](_0x1b82('0x34'),_0x493491[_0x1b82('0x16')]);emit(util[_0x1b82('0x2d')](_0x1b82('0x2e'),_0x493491[_0x1b82('0x16')]),_0x1b82('0x3f'),{'sessionId':_0x26051f});return _0x29f9ae[_0x1b82('0x17')](0xc8)[_0x1b82('0x2a')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x29f9ae));};exports['calls']=function(_0x2658b5,_0x2a95d2){logger[_0x1b82('0x10')](_0x1b82('0x40'),_0x2a95d2[_0x1b82('0x29')]);var _0x15b0d3=callsValidation[_0x1b82('0xb')](_0x2658b5['body']);if(_0x15b0d3[_0x1b82('0x24')]>0x0){return _0x2a95d2[_0x1b82('0x17')](0x190)[_0x1b82('0x2a')](_0x15b0d3);}var _0x42d3e1=_0x2658b5[_0x1b82('0x29')][_0x1b82('0x33')];var _0x25ee4e=respondWithRpcPromise(_0x1b82('0x1e'));var _0x52d4c5=getAgent(_0x42d3e1);return Promise[_0x1b82('0x1f')]([_0x25ee4e,_0x52d4c5])[_0x1b82('0x1a')](function(_0x39be28){var _0x22c6c8=_0x39be28[0x0];var _0x2bce47=_0x39be28[0x1];var _0x4b5dbc=_['filter'](_0x22c6c8[_0x1b82('0x21')],function(_0x326cda){return _0x326cda[_0x1b82('0x22')]==_0x2bce47['id'];});return _0x2a95d2[_0x1b82('0x17')](0xc8)['json']({'count':_0x4b5dbc[_0x1b82('0x24')],'rows':_0x4b5dbc});})[_0x1b82('0x30')](handleError(_0x2a95d2));};exports[_0x1b82('0x41')]=function(_0x26ad1c,_0x152f84){logger[_0x1b82('0x10')](_0x1b82('0x42'),_0x26ad1c[_0x1b82('0x29')]);var _0x181091=conferenceValidation[_0x1b82('0xb')](_0x26ad1c['body']);if(_0x181091[_0x1b82('0x24')]>0x0){return _0x152f84[_0x1b82('0x17')](0x190)['json'](_0x181091);}var _0x333c5e=_0x26ad1c[_0x1b82('0x29')][_0x1b82('0x33')];return getAgent(_0x333c5e)[_0x1b82('0x1a')](function(_0x4b26c4){logger[_0x1b82('0x10')](_0x1b82('0x34'),_0x4b26c4[_0x1b82('0x16')]);emit(util[_0x1b82('0x2d')](_0x1b82('0x2e'),_0x4b26c4[_0x1b82('0x16')]),'webbar:conference');return _0x152f84[_0x1b82('0x17')](0xc8)['json']({'error':![],'message':_0x1b82('0x43')});})['catch'](handleError(_0x152f84));};exports[_0x1b82('0x44')]=function(_0x2adf0e,_0x3e22ae){logger[_0x1b82('0x10')](_0x1b82('0x45'),_0x2adf0e[_0x1b82('0x29')]);var _0x245f20=transferValidation['validate'](_0x2adf0e[_0x1b82('0x29')]);if(_0x245f20[_0x1b82('0x24')]>0x0){return _0x3e22ae[_0x1b82('0x17')](0x190)[_0x1b82('0x2a')](_0x245f20);}var _0x567b9a=_0x2adf0e[_0x1b82('0x29')][_0x1b82('0x33')];var _0xa763a3=_0x2adf0e[_0x1b82('0x29')][_0x1b82('0x23')];var _0x1873de=_0x2adf0e[_0x1b82('0x29')][_0x1b82('0x46')];return getAgent(_0x567b9a)['then'](function(_0x1cf6b5){logger[_0x1b82('0x10')](_0x1b82('0x34'),_0x1cf6b5['name']);emit(util[_0x1b82('0x2d')](_0x1b82('0x2e'),_0x1cf6b5['name']),_0x1b82('0x47'),{'sessionId':_0xa763a3,'transferNumber':_0x1873de});return _0x3e22ae[_0x1b82('0x17')](0xc8)[_0x1b82('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x3e22ae));}; \ No newline at end of file +var _0x202c=['conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','path','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','status','send','name','NotFound','request','code','message','result','catch','User','then','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','sessionId','user:%s','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all'];(function(_0x4622f2,_0x53d8fc){var _0x5adcb2=function(_0x1aa8c7){while(--_0x1aa8c7){_0x4622f2['push'](_0x4622f2['shift']());}};_0x5adcb2(++_0x53d8fc);}(_0x202c,0x178));var _0xc202=function(_0x38ee8c,_0x41ae11){_0x38ee8c=_0x38ee8c-0x0;var _0x95d48c=_0x202c[_0x38ee8c];return _0x95d48c;};'use strict';var path=require(_0xc202('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xc202('0x1'));var util=require(_0xc202('0x2'));var BPromise=require(_0xc202('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xc202('0x4')][_0xc202('0x5')]({'port':0x232a});var logger=require(_0xc202('0x6'))(_0xc202('0x7'));var Redis=require('ioredis');config[_0xc202('0x8')]=_[_0xc202('0x9')](config['redis'],{'host':_0xc202('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc202('0x8')]));var Schema=require(_0xc202('0xb'));var originateValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'callNumber':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0xf')]},'callerId':{'type':_0xc202('0xe')},'callbackUrl':{'type':_0xc202('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':_0xc202('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0x10')]},'transferNumber':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc202('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc202('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc202('0xd')]}});function emit(_0x5971a6,_0x19af73,_0x1d580c){logger[_0xc202('0x12')](_0x5971a6,_0x19af73,JSON[_0xc202('0x13')](_0x1d580c));io['to'](_0x5971a6)[_0xc202('0x14')](_0x19af73,_0x1d580c);}function handleError(_0x2419c5){return function(_0x9620a0){console['log'](_0xc202('0x15'),_0x9620a0,_0x9620a0 instanceof RangeError);logger[_0xc202('0x16')](_0x9620a0[_0xc202('0x17')]);if(_0x9620a0 instanceof RangeError){if(_0x9620a0['name']){delete _0x9620a0['name'];}_0x2419c5[_0xc202('0x18')](0x194)[_0xc202('0x19')](_0x9620a0);}else{if(_0x9620a0[_0xc202('0x1a')]){delete _0x9620a0[_0xc202('0x1a')];}_0x2419c5[_0xc202('0x18')](0x1f4)['send'](_0x9620a0);}};}function checkError(){return function(_0x50a32f){if(!_0x50a32f){throw new RangeError(_0xc202('0x1b'));}return _0x50a32f;};}function respondWithRpcPromise(_0x5a6526,_0x3058d3){return new BPromise(function(_0x372b31,_0x56e979){var _0x50f917=amiClient;return _0x50f917[_0xc202('0x1c')](_0x5a6526,_0x3058d3)['then'](function(_0x23e1a0){if(_0x23e1a0[_0xc202('0x16')]){if(_0x23e1a0[_0xc202('0x16')][_0xc202('0x1d')]===0x1f4){return _0x56e979(_0x23e1a0[_0xc202('0x16')]['message']);}return _0x372b31(_0x23e1a0['error'][_0xc202('0x1e')]);}else{_0x372b31(_0x23e1a0[_0xc202('0x1f')]);}})[_0xc202('0x20')](function(_0x4ff3e3){_0x56e979(_0x4ff3e3);});});}function getAgent(_0xdd5798){return db[_0xc202('0x21')]['findOne']({'where':{'id':_0xdd5798,'role':'agent'}})[_0xc202('0x22')](checkError());}function getAgentCheckSession(_0x2f8011,_0xd88a43){return new BPromise(function(_0x6b291c,_0x2a401b){var _0x483357=respondWithRpcPromise(_0xc202('0x23'));var _0x32f56c=getAgent(_0x2f8011);Promise['all']([_0x483357,_0x32f56c])['then'](function(_0x25a954){var _0x278ef5=_0x25a954[0x0];var _0x130e51=_0x25a954[0x1];var _0x189211=_['filter'](_0x278ef5[_0xc202('0x24')],function(_0x2c8fec){return _0x2c8fec[_0xc202('0x25')]==_0x130e51['id']&&_0x2c8fec['sessionId']==_0xd88a43;});if(_0x189211[_0xc202('0x26')]==0x1){_0x6b291c(_0x130e51);}else{_0x2a401b(new RangeError(_0xc202('0x27')+_0xd88a43+_0xc202('0x28')));}});});}exports[_0xc202('0x29')]=function(_0x464ab8,_0x196394){logger[_0xc202('0x12')](_0xc202('0x2a'),_0x464ab8[_0xc202('0x2b')]);var _0x1b4e71=originateValidation[_0xc202('0xb')](_0x464ab8[_0xc202('0x2b')]);if(_0x1b4e71['length']>0x0){return _0x196394[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x1b4e71);}var _0x12e11a=_0x464ab8['body'][_0xc202('0x2d')];var _0x501db2=_0x464ab8[_0xc202('0x2b')][_0xc202('0x2e')];var _0x12bf23=_0x464ab8[_0xc202('0x2b')][_0xc202('0x2f')];var _0x77419a=_0x464ab8['body'][_0xc202('0x30')];return getAgent(_0x12e11a)['then'](function(_0x3ac7e8){logger['info'](_0xc202('0x31'),_0x3ac7e8[_0xc202('0x1a')]);emit(util[_0xc202('0x32')]('user:%s',_0x3ac7e8[_0xc202('0x1a')]),_0xc202('0x33'),{'callNumber':_0x501db2,'callerId':_0x12bf23,'callbackUrl':_0x77419a});return _0x196394[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x34')});})[_0xc202('0x20')](handleError(_0x196394));};exports['hangup']=function(_0x16608b,_0x1e57c3){logger[_0xc202('0x12')]('hangup\x20fired:',_0x16608b[_0xc202('0x2b')]);var _0x1741b7=hangupValidation[_0xc202('0xb')](_0x16608b[_0xc202('0x2b')]);if(_0x1741b7['length']>0x0){return _0x1e57c3['status'](0x190)[_0xc202('0x2c')](_0x1741b7);}var _0x4caf1b=_0x16608b[_0xc202('0x2b')][_0xc202('0x2d')];var _0x25fdd8=_0x16608b[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x4caf1b)[_0xc202('0x22')](function(_0x52d9d2){logger[_0xc202('0x12')](_0xc202('0x31'),_0x52d9d2[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x52d9d2['name']),_0xc202('0x37'),{'sessionId':_0x25fdd8});return _0x1e57c3[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x38')});})[_0xc202('0x20')](handleError(_0x1e57c3));};exports['answer']=function(_0x25d75f,_0x5d89b3){logger[_0xc202('0x12')]('answer\x20fired:',_0x25d75f[_0xc202('0x2b')]);var _0x4393f3=answerValidation[_0xc202('0xb')](_0x25d75f[_0xc202('0x2b')]);if(_0x4393f3['length']>0x0){return _0x5d89b3[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x4393f3);}var _0x865cd1=_0x25d75f[_0xc202('0x2b')][_0xc202('0x2d')];var _0x91785a=_0x25d75f[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x865cd1)[_0xc202('0x22')](function(_0x6cad30){logger[_0xc202('0x12')](_0xc202('0x31'),_0x6cad30[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x6cad30[_0xc202('0x1a')]),_0xc202('0x39'),{'sessionId':_0x91785a});return _0x5d89b3[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x3a')});})['catch'](handleError(_0x5d89b3));};exports[_0xc202('0x3b')]=function(_0x187934,_0x291a6b){logger['info']('hold\x20fired:',_0x187934['body']);var _0x113db6=holdValidation[_0xc202('0xb')](_0x187934[_0xc202('0x2b')]);if(_0x113db6[_0xc202('0x26')]>0x0){return _0x291a6b[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x113db6);}var _0x157d89=_0x187934[_0xc202('0x2b')][_0xc202('0x2d')];var _0x6d6b02=_0x187934[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x157d89)[_0xc202('0x22')](function(_0x5220a2){logger[_0xc202('0x12')](_0xc202('0x31'),_0x5220a2['name']);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x5220a2[_0xc202('0x1a')]),_0xc202('0x3c'),{'sessionId':_0x6d6b02});return _0x291a6b[_0xc202('0x18')](0xc8)['json']({'error':![],'message':_0xc202('0x3d')});})['catch'](handleError(_0x291a6b));};exports[_0xc202('0x3e')]=function(_0x5f1b99,_0x305793){logger[_0xc202('0x12')]('unhold\x20fired:',_0x5f1b99[_0xc202('0x2b')]);var _0x239cd=unholdValidation['validate'](_0x5f1b99['body']);if(_0x239cd['length']>0x0){return _0x305793[_0xc202('0x18')](0x190)['json'](_0x239cd);}var _0x1ac5c5=_0x5f1b99[_0xc202('0x2b')][_0xc202('0x2d')];var _0x1f6233=_0x5f1b99[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x1ac5c5)[_0xc202('0x22')](function(_0x3469e0){logger[_0xc202('0x12')](_0xc202('0x31'),_0x3469e0[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x3469e0['name']),_0xc202('0x3f'),{'sessionId':_0x1f6233});return _0x305793['status'](0xc8)['json']({'error':![],'message':_0xc202('0x40')});})[_0xc202('0x20')](handleError(_0x305793));};exports[_0xc202('0x41')]=function(_0x52fcbd,_0x1fcc19){logger['info'](_0xc202('0x42'),_0x1fcc19[_0xc202('0x2b')]);var _0x5464ea=callsValidation[_0xc202('0xb')](_0x52fcbd[_0xc202('0x2b')]);if(_0x5464ea['length']>0x0){return _0x1fcc19[_0xc202('0x18')](0x190)['json'](_0x5464ea);}var _0x3c765d=_0x52fcbd[_0xc202('0x2b')][_0xc202('0x2d')];var _0x1a06c5=respondWithRpcPromise(_0xc202('0x23'));var _0x2d475a=getAgent(_0x3c765d);return Promise[_0xc202('0x43')]([_0x1a06c5,_0x2d475a])['then'](function(_0xb98cd7){var _0x3beb0a=_0xb98cd7[0x0];var _0x4e2e04=_0xb98cd7[0x1];var _0x2b3238=_['filter'](_0x3beb0a[_0xc202('0x24')],function(_0x4a2a48){return _0x4a2a48[_0xc202('0x25')]==_0x4e2e04['id'];});return _0x1fcc19['status'](0xc8)[_0xc202('0x2c')]({'count':_0x2b3238['length'],'rows':_0x2b3238});})['catch'](handleError(_0x1fcc19));};exports[_0xc202('0x44')]=function(_0x1dc674,_0x31bc10){logger[_0xc202('0x12')](_0xc202('0x45'),_0x1dc674[_0xc202('0x2b')]);var _0x42c898=conferenceValidation[_0xc202('0xb')](_0x1dc674[_0xc202('0x2b')]);if(_0x42c898[_0xc202('0x26')]>0x0){return _0x31bc10['status'](0x190)[_0xc202('0x2c')](_0x42c898);}var _0xc899bd=_0x1dc674['body'][_0xc202('0x2d')];return getAgent(_0xc899bd)[_0xc202('0x22')](function(_0x43fe84){logger[_0xc202('0x12')](_0xc202('0x31'),_0x43fe84[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x43fe84['name']),_0xc202('0x46'));return _0x31bc10[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x47')});})[_0xc202('0x20')](handleError(_0x31bc10));};exports['transfer']=function(_0x4149fe,_0x39e986){logger[_0xc202('0x12')]('transfer\x20fired:',_0x4149fe[_0xc202('0x2b')]);var _0x4dfb2f=transferValidation['validate'](_0x4149fe['body']);if(_0x4dfb2f[_0xc202('0x26')]>0x0){return _0x39e986[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x4dfb2f);}var _0xe05654=_0x4149fe['body'][_0xc202('0x2d')];var _0x5957e8=_0x4149fe[_0xc202('0x2b')][_0xc202('0x35')];var _0x5bb7f8=_0x4149fe[_0xc202('0x2b')][_0xc202('0x48')];return getAgent(_0xe05654)[_0xc202('0x22')](function(_0x4d9423){logger['info']('entityFound:',_0x4d9423[_0xc202('0x1a')]);emit(util[_0xc202('0x32')]('user:%s',_0x4d9423[_0xc202('0x1a')]),_0xc202('0x49'),{'sessionId':_0x5957e8,'transferNumber':_0x5bb7f8});return _0x39e986['status'](0xc8)[_0xc202('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0xc202('0x20')](handleError(_0x39e986));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 86d60cf..887505b 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 _0x7880=['/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','notify','put','update','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x7880,0x1f4));var _0x0788=function(_0x3f0cb4,_0x49ec71){_0x3f0cb4=_0x3f0cb4-0x0;var _0x5f33b0=_0x7880[_0x3f0cb4];return _0x5f33b0;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x9')](_0x0788('0x16'),auth['isAuthenticated'](),controller[_0x0788('0x17')]);router[_0x0788('0x18')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0x19')]);router['post'](_0x0788('0x10'),auth['isAuthenticated'](),controller[_0x0788('0x1a')]);router[_0x0788('0x18')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x1b')]);router[_0x0788('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x18')]('/:id/applications',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x18')]('/:id/notify',controller[_0x0788('0x1e')]);router[_0x0788('0x18')]('/:id/send',auth[_0x0788('0xa')](),controller['send']);router[_0x0788('0x1f')]('/:id',auth[_0x0788('0xa')](),controller[_0x0788('0x20')]);router[_0x0788('0x21')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['destroy']);router['delete'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x22')]);router[_0x0788('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0788('0x23')]);router[_0x0788('0x21')](_0x0788('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0788('0x24')]=router; \ No newline at end of file +var _0xc6ac=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','create','post','addDisposition','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated'];(function(_0x15f603,_0x19466a){var _0x26fd2e=function(_0x57f840){while(--_0x57f840){_0x15f603['push'](_0x15f603['shift']());}};_0x26fd2e(++_0x19466a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1f2cac,_0x51a59e){_0x1f2cac=_0x1f2cac-0x0;var _0x207a52=_0xc6ac[_0x1f2cac];return _0x207a52;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0xb')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0xb')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);router[_0xcc6a('0xb')](_0xcc6a('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcc6a('0xb')](_0xcc6a('0x17'),auth[_0xcc6a('0xc')](),controller['getApplications']);router['post']('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x18')]);router[_0xcc6a('0x19')](_0xcc6a('0x12'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1a')]);router[_0xcc6a('0x19')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1b')]);router[_0xcc6a('0x19')](_0xcc6a('0x17'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1c')]);router[_0xcc6a('0x19')](_0xcc6a('0x1d'),controller[_0xcc6a('0x1e')]);router[_0xcc6a('0x19')]('/:id/send',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1f')]);router[_0xcc6a('0x20')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x21')]);router[_0xcc6a('0x22')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x23')]);router[_0xcc6a('0x22')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x24')]);router[_0xcc6a('0x22')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x25')]);router[_0xcc6a('0x22')](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x26')]);module[_0xcc6a('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 746fab7..34f8c5c 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 _0x2296=['sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x4cfdb0,_0x2dd36c){var _0x1d17b5=function(_0x24cb1a){while(--_0x24cb1a){_0x4cfdb0['push'](_0x4cfdb0['shift']());}};_0x1d17b5(++_0x2dd36c);}(_0x2296,0xdd));var _0x6229=function(_0x165801,_0x1a2ac7){_0x165801=_0x165801-0x0;var _0x492ce9=_0x2296[_0x165801];return _0x492ce9;};'use strict';var Sequelize=require(_0x6229('0x0'));var rs=require(_0x6229('0x1'));module[_0x6229('0x2')]={'name':{'type':Sequelize[_0x6229('0x3')],'unique':_0x6229('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6229('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6229('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6229('0x3')],'defaultValue':function(){return rs[_0x6229('0x5')]();}},'phone':{'type':Sequelize[_0x6229('0x3')]},'type':{'type':Sequelize[_0x6229('0x6')](_0x6229('0x7'),_0x6229('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x6229('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6229('0x9')],'defaultValue':function(){return _0x6229('0xa');}},'notificationSound':{'type':Sequelize[_0x6229('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6229('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6229('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6229('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6229('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6229('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6229('0xd'),'set':function(_0x26e3a6){if(!_0x26e3a6){this['setDataValue'](_0x6229('0xe'),null);}this[_0x6229('0xf')](_0x6229('0x10'),_0x26e3a6);}},'description':{'type':Sequelize[_0x6229('0x3')]}}; \ No newline at end of file +var _0xd154=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xd154,0x75));var _0x4d15=function(_0x44528b,_0x432e95){_0x44528b=_0x44528b-0x0;var _0x5adfba=_0xd154[_0x44528b];return _0x5adfba;};'use strict';var Sequelize=require(_0x4d15('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4d15('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x4d15('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4d15('0x2')],'defaultValue':function(){return rs[_0x4d15('0x3')]();}},'phone':{'type':Sequelize[_0x4d15('0x2')]},'type':{'type':Sequelize[_0x4d15('0x4')](_0x4d15('0x5'),_0x4d15('0x6'))},'accountSid':{'type':Sequelize[_0x4d15('0x2')]},'baseUrl':{'type':Sequelize[_0x4d15('0x2')]},'authToken':{'type':Sequelize[_0x4d15('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4d15('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4d15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4d15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4d15('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![],'comment':_0x4d15('0xa'),'set':function(_0x487881){if(!_0x487881){this[_0x4d15('0xb')](_0x4d15('0xc'),null);}this[_0x4d15('0xb')](_0x4d15('0xd'),_0x487881);}},'description':{'type':Sequelize[_0x4d15('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 40c2815..78a4df8 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 _0x7f4c=['account','statuses','state','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','from','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','entity\x20found','debug','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','type','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','WhatsappAccount','includeAll','include','show','params','mandatoryDispositionPause','keys','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','order','pick','findAll','rows','removeDispositions','ids','WhatsappAccountId','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','options','addApplications','sequelize','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications'];(function(_0x11a320,_0x52a27c){var _0xc40c69=function(_0x37541b){while(--_0x37541b){_0x11a320['push'](_0x11a320['shift']());}};_0xc40c69(++_0x52a27c);}(_0x7f4c,0x1be));var _0xc7f4=function(_0x2ee92e,_0x12e1d6){_0x2ee92e=_0x2ee92e-0x0;var _0x5d8de7=_0x7f4c[_0x2ee92e];return _0x5d8de7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7f4('0x0'));var zipdir=require(_0xc7f4('0x1'));var jsonpatch=require(_0xc7f4('0x2'));var rp=require(_0xc7f4('0x3'));var moment=require(_0xc7f4('0x4'));var BPromise=require(_0xc7f4('0x5'));var Mustache=require('mustache');var util=require(_0xc7f4('0x6'));var path=require(_0xc7f4('0x7'));var sox=require(_0xc7f4('0x8'));var csv=require(_0xc7f4('0x9'));var ejs=require(_0xc7f4('0xa'));var fs=require('fs');var fs_extra=require(_0xc7f4('0xb'));var _=require(_0xc7f4('0xc'));var squel=require(_0xc7f4('0xd'));var crypto=require(_0xc7f4('0xe'));var jsforce=require(_0xc7f4('0xf'));var deskjs=require(_0xc7f4('0x10'));var toCsv=require(_0xc7f4('0x9'));var querystring=require(_0xc7f4('0x11'));var Papa=require(_0xc7f4('0x12'));var Redis=require(_0xc7f4('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc7f4('0x14'));var hardwareService=require(_0xc7f4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc7f4('0x16'));var config=require(_0xc7f4('0x17'));var licenseUtil=require(_0xc7f4('0x18'));var db=require(_0xc7f4('0x19'))['db'];config['redis']=_[_0xc7f4('0x1a')](config[_0xc7f4('0x1b')],{'host':_0xc7f4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc7f4('0x1d'))['register'](socket);var jayson=require(_0xc7f4('0x1e'));var client=jayson[_0xc7f4('0x1f')][_0xc7f4('0x20')]({'port':0x232c});function respondWithRpcPromise(_0xee00b6,_0x4b5bdc,_0x43b972,_0x2febd5){return new BPromise(function(_0x253563,_0x24d162){var _0x52a017=_0x2febd5||client;return _0x52a017[_0xc7f4('0x21')](_0xee00b6,_0x43b972)[_0xc7f4('0x22')](function(_0x1dd264){logger['info'](_0xc7f4('0x23'),_0x4b5bdc,_0xc7f4('0x24'));logger['debug'](_0xc7f4('0x25'),_0x4b5bdc,_0xc7f4('0x24'),JSON[_0xc7f4('0x26')](_0x1dd264));if(_0x1dd264['error']){if(_0x1dd264[_0xc7f4('0x27')]['code']===0x1f4){logger['error'](_0xc7f4('0x23'),_0x4b5bdc,_0x1dd264['error'][_0xc7f4('0x28')]);return _0x24d162(_0x1dd264['error'][_0xc7f4('0x28')]);}logger[_0xc7f4('0x27')](_0xc7f4('0x23'),_0x4b5bdc,_0x1dd264[_0xc7f4('0x27')]['message']);return _0x253563(_0x1dd264['error'][_0xc7f4('0x28')]);}else{logger[_0xc7f4('0x29')](_0xc7f4('0x23'),_0x4b5bdc,_0xc7f4('0x24'));_0x253563(_0x1dd264[_0xc7f4('0x2a')][_0xc7f4('0x28')]);}})[_0xc7f4('0x2b')](function(_0x26a039){logger[_0xc7f4('0x27')](_0xc7f4('0x23'),_0x4b5bdc,_0x26a039);_0x24d162(_0x26a039);});});}function respondWithStatusCode(_0x156431,_0xbde383){_0xbde383=_0xbde383||0xcc;return function(_0x5699bf){if(_0x5699bf){return _0x156431[_0xc7f4('0x2c')](_0xbde383);}return _0x156431[_0xc7f4('0x2d')](_0xbde383)[_0xc7f4('0x2e')]();};}function respondWithResult(_0x51f07d,_0xad0169){_0xad0169=_0xad0169||0xc8;return function(_0x5a29b2){if(_0x5a29b2){return _0x51f07d[_0xc7f4('0x2d')](_0xad0169)[_0xc7f4('0x2f')](_0x5a29b2);}};}function respondWithFilteredResult(_0x3ce8c5,_0x922bb4){return function(_0xb2664){if(_0xb2664){var _0x33236e=typeof _0x922bb4[_0xc7f4('0x30')]===_0xc7f4('0x31')&&typeof _0x922bb4[_0xc7f4('0x32')]===_0xc7f4('0x31');var _0x4245c1=_0xb2664[_0xc7f4('0x33')];var _0xeb7397=_0x33236e?0x0:_0x922bb4[_0xc7f4('0x30')];var _0x2392bb=_0x33236e?_0xb2664[_0xc7f4('0x33')]:_0x922bb4[_0xc7f4('0x30')]+_0x922bb4['limit'];var _0x46039d;if(_0x2392bb>=_0x4245c1){_0x2392bb=_0x4245c1;_0x46039d=0xc8;}else{_0x46039d=0xce;}_0x3ce8c5['status'](_0x46039d);return _0x3ce8c5[_0xc7f4('0x34')](_0xc7f4('0x35'),_0xeb7397+'-'+_0x2392bb+'/'+_0x4245c1)['json'](_0xb2664);}return null;};}function patchUpdates(_0x5e4e1f){return function(_0x44023e){try{jsonpatch[_0xc7f4('0x36')](_0x44023e,_0x5e4e1f,!![]);}catch(_0x57d781){return BPromise['reject'](_0x57d781);}return _0x44023e[_0xc7f4('0x37')]();};}function saveUpdates(_0x1a5cf1,_0x58e9f3){return function(_0x4ea610){if(_0x4ea610){return _0x4ea610[_0xc7f4('0x38')](_0x1a5cf1)[_0xc7f4('0x22')](function(_0x4a736d){return _0x4a736d;});}return null;};}function removeEntity(_0x349c95,_0x24dbef){return function(_0x26990b){if(_0x26990b){return _0x26990b[_0xc7f4('0x39')]()[_0xc7f4('0x22')](function(){var _0x56cb7f=_0x26990b[_0xc7f4('0x3a')]({'plain':!![]});var _0x4d75f5=_0xc7f4('0x3b');return db[_0xc7f4('0x3c')][_0xc7f4('0x39')]({'where':{'type':_0x4d75f5,'resourceId':_0x56cb7f['id']}})[_0xc7f4('0x22')](function(){return _0x26990b;});})[_0xc7f4('0x22')](function(){_0x349c95[_0xc7f4('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462b5a,_0xc6dde1){return function(_0x41c974){if(!_0x41c974){_0x462b5a[_0xc7f4('0x2c')](0x194);}return _0x41c974;};}function handleError(_0x30a2fb,_0x321c14){_0x321c14=_0x321c14||0x1f4;return function(_0xf52b59){logger['error'](_0xf52b59[_0xc7f4('0x3d')]);if(_0xf52b59[_0xc7f4('0x3e')]){delete _0xf52b59[_0xc7f4('0x3e')];}_0x30a2fb[_0xc7f4('0x2d')](_0x321c14)[_0xc7f4('0x3f')](_0xf52b59);};}exports[_0xc7f4('0x40')]=function(_0x19e442,_0x51e0dc){var _0x1c87f5={'include':[{'model':db[_0xc7f4('0x41')],'as':'mandatoryDispositionPause'}]},_0x548bba={},_0xdfa249={'count':0x0,'rows':[]};var _0x551e42=_[_0xc7f4('0x42')](db['WhatsappAccount'][_0xc7f4('0x43')],function(_0x40bf9f){return{'name':_0x40bf9f['fieldName'],'type':_0x40bf9f[_0xc7f4('0x44')]['key']};});_0x548bba[_0xc7f4('0x45')]=_[_0xc7f4('0x42')](_0x551e42,_0xc7f4('0x3e'));_0x548bba['query']=_['keys'](_0x19e442[_0xc7f4('0x46')]);_0x548bba['filters']=_[_0xc7f4('0x47')](_0x548bba[_0xc7f4('0x45')],_0x548bba[_0xc7f4('0x46')]);_0x1c87f5['attributes']=_[_0xc7f4('0x47')](_0x548bba[_0xc7f4('0x45')],qs[_0xc7f4('0x48')](_0x19e442[_0xc7f4('0x46')][_0xc7f4('0x48')]));_0x1c87f5[_0xc7f4('0x49')]=_0x1c87f5[_0xc7f4('0x49')][_0xc7f4('0x4a')]?_0x1c87f5[_0xc7f4('0x49')]:_0x548bba[_0xc7f4('0x45')];if(!_0x19e442[_0xc7f4('0x46')]['hasOwnProperty'](_0xc7f4('0x4b'))){_0x1c87f5[_0xc7f4('0x32')]=qs[_0xc7f4('0x32')](_0x19e442[_0xc7f4('0x46')][_0xc7f4('0x32')]);_0x1c87f5[_0xc7f4('0x30')]=qs['offset'](_0x19e442[_0xc7f4('0x46')][_0xc7f4('0x30')]);}_0x1c87f5['order']=qs[_0xc7f4('0x4c')](_0x19e442[_0xc7f4('0x46')]['sort']);_0x1c87f5[_0xc7f4('0x4d')]=qs[_0xc7f4('0x4e')](_['pick'](_0x19e442[_0xc7f4('0x46')],_0x548bba[_0xc7f4('0x4e')]),_0x551e42);if(_0x19e442[_0xc7f4('0x46')][_0xc7f4('0x4f')]){_0x1c87f5[_0xc7f4('0x4d')]=_['merge'](_0x1c87f5['where'],{'$or':_[_0xc7f4('0x42')](_0x551e42,function(_0x501b8a){if(_0x501b8a[_0xc7f4('0x44')]!==_0xc7f4('0x50')){var _0x4b787f={};_0x4b787f[_0x501b8a[_0xc7f4('0x3e')]]={'$like':'%'+_0x19e442[_0xc7f4('0x46')]['filter']+'%'};return _0x4b787f;}})});}_0x1c87f5=_[_0xc7f4('0x51')]({},_0x1c87f5,_0x19e442['options']);var _0x2d3dbf={'where':_0x1c87f5[_0xc7f4('0x4d')]};return db[_0xc7f4('0x52')]['count'](_0x2d3dbf)[_0xc7f4('0x22')](function(_0x1ac503){_0xdfa249[_0xc7f4('0x33')]=_0x1ac503;if(_0x19e442[_0xc7f4('0x46')][_0xc7f4('0x53')]){_0x1c87f5[_0xc7f4('0x54')]=[{'all':!![]}];}return db[_0xc7f4('0x52')]['findAll'](_0x1c87f5);})[_0xc7f4('0x22')](function(_0x15d7d7){_0xdfa249['rows']=_0x15d7d7;return _0xdfa249;})[_0xc7f4('0x22')](respondWithFilteredResult(_0x51e0dc,_0x1c87f5))[_0xc7f4('0x2b')](handleError(_0x51e0dc,null));};exports[_0xc7f4('0x55')]=function(_0x136057,_0x331b63){var _0x26858f={'raw':![],'where':{'id':_0x136057[_0xc7f4('0x56')]['id']},'include':[{'model':db[_0xc7f4('0x41')],'as':_0xc7f4('0x57')}]},_0x4e1112={};_0x4e1112[_0xc7f4('0x45')]=_[_0xc7f4('0x58')](db[_0xc7f4('0x52')][_0xc7f4('0x43')]);_0x4e1112[_0xc7f4('0x46')]=_[_0xc7f4('0x58')](_0x136057[_0xc7f4('0x46')]);_0x4e1112[_0xc7f4('0x4e')]=_[_0xc7f4('0x47')](_0x4e1112[_0xc7f4('0x45')],_0x4e1112[_0xc7f4('0x46')]);_0x26858f[_0xc7f4('0x49')]=_[_0xc7f4('0x47')](_0x4e1112['model'],qs['fields'](_0x136057[_0xc7f4('0x46')][_0xc7f4('0x48')]));_0x26858f[_0xc7f4('0x49')]=_0x26858f['attributes'][_0xc7f4('0x4a')]?_0x26858f[_0xc7f4('0x49')]:_0x4e1112[_0xc7f4('0x45')];if(_0x136057[_0xc7f4('0x46')][_0xc7f4('0x53')]){_0x26858f[_0xc7f4('0x54')]=[{'all':!![]}];}_0x26858f=_[_0xc7f4('0x51')]({},_0x26858f,_0x136057['options']);return db['WhatsappAccount'][_0xc7f4('0x59')](_0x26858f)['then'](handleEntityNotFound(_0x331b63,null))[_0xc7f4('0x22')](respondWithResult(_0x331b63,null))['catch'](handleError(_0x331b63,null));};exports[_0xc7f4('0x5a')]=function(_0x215655,_0x31aef5){return db['WhatsappAccount'][_0xc7f4('0x5a')](_0x215655[_0xc7f4('0x5b')],{})[_0xc7f4('0x22')](function(_0x33211c){var _0x41066d=_0x215655['user'][_0xc7f4('0x3a')]({'plain':!![]});if(!_0x41066d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41066d[_0xc7f4('0x5c')]===_0xc7f4('0x5d')){var _0x457eed=_0x33211c[_0xc7f4('0x3a')]({'plain':!![]});var _0x388922=_0xc7f4('0x3b');return db[_0xc7f4('0x5e')]['find']({'where':{'name':_0x388922,'userProfileId':_0x41066d['userProfileId']},'raw':!![]})[_0xc7f4('0x22')](function(_0x42f144){if(_0x42f144&&_0x42f144[_0xc7f4('0x5f')]===0x0){return db[_0xc7f4('0x3c')][_0xc7f4('0x5a')]({'name':_0x457eed[_0xc7f4('0x3e')],'resourceId':_0x457eed['id'],'type':_0x42f144[_0xc7f4('0x3e')],'sectionId':_0x42f144['id']},{})['then'](function(){return _0x33211c;});}else{return _0x33211c;}})['catch'](function(_0x1f9158){logger[_0xc7f4('0x27')](_0xc7f4('0x60'),_0x1f9158);throw _0x1f9158;});}return _0x33211c;})[_0xc7f4('0x22')](respondWithResult(_0x31aef5,0xc9))['catch'](handleError(_0x31aef5,null));};exports['update']=function(_0x107118,_0x4eb565){if(_0x107118['body']['id']){delete _0x107118[_0xc7f4('0x5b')]['id'];}return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x107118[_0xc7f4('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xc7f4('0x57')}]})['then'](handleEntityNotFound(_0x4eb565,null))[_0xc7f4('0x22')](saveUpdates(_0x107118[_0xc7f4('0x5b')],null))[_0xc7f4('0x22')](respondWithResult(_0x4eb565,null))[_0xc7f4('0x2b')](handleError(_0x4eb565,null));};exports[_0xc7f4('0x39')]=function(_0x57d6bd,_0xc9fc05){return db[_0xc7f4('0x52')]['find']({'where':{'id':_0x57d6bd[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0xc9fc05,null))[_0xc7f4('0x22')](removeEntity(_0xc9fc05,null))['catch'](handleError(_0xc9fc05,null));};exports['describe']=function(_0x2e96c6,_0xe4d44e){return db[_0xc7f4('0x52')][_0xc7f4('0x61')]()['then'](respondWithResult(_0xe4d44e,null))[_0xc7f4('0x2b')](handleError(_0xe4d44e,null));};exports[_0xc7f4('0x62')]=function(_0x41f6b6,_0xa5ec3a,_0x422bb6){if(_0x41f6b6[_0xc7f4('0x5b')]['id']){delete _0x41f6b6[_0xc7f4('0x5b')]['id'];}return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x41f6b6['params']['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0xa5ec3a,null))[_0xc7f4('0x22')](function(_0x183e2e){if(_0x183e2e){_0x41f6b6[_0xc7f4('0x5b')]['WhatsappAccountId']=_0x183e2e['id'];return db[_0xc7f4('0x63')][_0xc7f4('0x5a')](_0x41f6b6[_0xc7f4('0x5b')]);}})[_0xc7f4('0x22')](respondWithResult(_0xa5ec3a,null))[_0xc7f4('0x2b')](handleError(_0xa5ec3a,null));};exports[_0xc7f4('0x64')]=function(_0x8d7135,_0x9e78f5,_0x3cdf2f){var _0x196fa4={'raw':![],'where':{}};var _0x308056={};var _0x251469={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc7f4('0x65')]({'where':{'id':_0x8d7135[_0xc7f4('0x56')]['id']}})['then'](handleEntityNotFound(_0x9e78f5,null))[_0xc7f4('0x22')](function(_0x20137b){if(_0x20137b){_0x308056[_0xc7f4('0x45')]=_[_0xc7f4('0x58')](db[_0xc7f4('0x63')][_0xc7f4('0x43')]);_0x308056['query']=_['keys'](_0x8d7135[_0xc7f4('0x46')]);_0x308056[_0xc7f4('0x4e')]=_[_0xc7f4('0x47')](_0x308056[_0xc7f4('0x45')],_0x308056[_0xc7f4('0x46')]);_0x196fa4['attributes']=_[_0xc7f4('0x47')](_0x308056[_0xc7f4('0x45')],qs[_0xc7f4('0x48')](_0x8d7135[_0xc7f4('0x46')][_0xc7f4('0x48')]));_0x196fa4[_0xc7f4('0x49')]=_0x196fa4[_0xc7f4('0x49')][_0xc7f4('0x4a')]?_0x196fa4[_0xc7f4('0x49')]:_0x308056[_0xc7f4('0x45')];if(!_0x8d7135[_0xc7f4('0x46')][_0xc7f4('0x66')](_0xc7f4('0x4b'))){_0x196fa4[_0xc7f4('0x32')]=qs[_0xc7f4('0x32')](_0x8d7135[_0xc7f4('0x46')][_0xc7f4('0x32')]);_0x196fa4[_0xc7f4('0x30')]=qs[_0xc7f4('0x30')](_0x8d7135[_0xc7f4('0x46')][_0xc7f4('0x30')]);}_0x196fa4[_0xc7f4('0x67')]=qs[_0xc7f4('0x4c')](_0x8d7135[_0xc7f4('0x46')]['sort']);_0x196fa4[_0xc7f4('0x4d')]=qs[_0xc7f4('0x4e')](_[_0xc7f4('0x68')](_0x8d7135['query'],_0x308056[_0xc7f4('0x4e')]));_0x196fa4[_0xc7f4('0x4d')]['WhatsappAccountId']=_0x20137b['id'];if(_0x8d7135[_0xc7f4('0x46')]['filter']){_0x196fa4['where']=_[_0xc7f4('0x51')](_0x196fa4[_0xc7f4('0x4d')],{'$or':_['map'](_0x196fa4['attributes'],function(_0x3faf9e){var _0x2f7ded={};_0x2f7ded[_0x3faf9e]={'$like':'%'+_0x8d7135[_0xc7f4('0x46')]['filter']+'%'};return _0x2f7ded;})});}_0x196fa4=_[_0xc7f4('0x51')]({},_0x196fa4,_0x8d7135['options']);return db['Disposition'][_0xc7f4('0x33')]({'where':_0x196fa4[_0xc7f4('0x4d')]})['then'](function(_0x4f067f){_0x251469[_0xc7f4('0x33')]=_0x4f067f;if(_0x8d7135[_0xc7f4('0x46')][_0xc7f4('0x53')]){_0x196fa4['include']=[{'all':!![]}];}return db['Disposition'][_0xc7f4('0x69')](_0x196fa4);})[_0xc7f4('0x22')](function(_0xab2cfb){_0x251469[_0xc7f4('0x6a')]=_0xab2cfb;return _0x251469;});}})[_0xc7f4('0x22')](respondWithFilteredResult(_0x9e78f5,_0x196fa4))[_0xc7f4('0x2b')](handleError(_0x9e78f5,null));};exports[_0xc7f4('0x6b')]=function(_0x65bf3f,_0x440aa5,_0x58c6f9){return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x65bf3f['params']['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x440aa5,null))[_0xc7f4('0x22')](function(_0x181e98){if(_0x181e98){return _0x181e98['removeDispositions'](_0x65bf3f[_0xc7f4('0x46')][_0xc7f4('0x6c')]);}})['then'](respondWithStatusCode(_0x440aa5,null))[_0xc7f4('0x2b')](handleError(_0x440aa5,null));};exports['addAnswer']=function(_0x3183c5,_0xe5bba,_0x1f5a07){if(_0x3183c5[_0xc7f4('0x5b')]['id']){delete _0x3183c5[_0xc7f4('0x5b')]['id'];}return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x3183c5[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0xe5bba,null))[_0xc7f4('0x22')](function(_0x4fc36c){if(_0x4fc36c){_0x3183c5[_0xc7f4('0x5b')][_0xc7f4('0x6d')]=_0x4fc36c['id'];return db[_0xc7f4('0x6e')][_0xc7f4('0x5a')](_0x3183c5['body']);}})['then'](respondWithResult(_0xe5bba,null))['catch'](handleError(_0xe5bba,null));};exports[_0xc7f4('0x6f')]=function(_0xa4b9de,_0x3daef8,_0x5518f7){var _0x472832={'raw':![],'where':{}};var _0xf0bc7c={};var _0x37d13e={'count':0x0,'rows':[]};return db[_0xc7f4('0x52')]['findOne']({'where':{'id':_0xa4b9de[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x3daef8,null))['then'](function(_0x4c4c2d){if(_0x4c4c2d){_0xf0bc7c[_0xc7f4('0x45')]=_[_0xc7f4('0x58')](db[_0xc7f4('0x6e')]['rawAttributes']);_0xf0bc7c[_0xc7f4('0x46')]=_[_0xc7f4('0x58')](_0xa4b9de['query']);_0xf0bc7c['filters']=_[_0xc7f4('0x47')](_0xf0bc7c['model'],_0xf0bc7c['query']);_0x472832[_0xc7f4('0x49')]=_[_0xc7f4('0x47')](_0xf0bc7c[_0xc7f4('0x45')],qs[_0xc7f4('0x48')](_0xa4b9de['query'][_0xc7f4('0x48')]));_0x472832[_0xc7f4('0x49')]=_0x472832[_0xc7f4('0x49')][_0xc7f4('0x4a')]?_0x472832[_0xc7f4('0x49')]:_0xf0bc7c[_0xc7f4('0x45')];if(!_0xa4b9de[_0xc7f4('0x46')]['hasOwnProperty']('nolimit')){_0x472832[_0xc7f4('0x32')]=qs[_0xc7f4('0x32')](_0xa4b9de['query'][_0xc7f4('0x32')]);_0x472832[_0xc7f4('0x30')]=qs[_0xc7f4('0x30')](_0xa4b9de[_0xc7f4('0x46')][_0xc7f4('0x30')]);}_0x472832[_0xc7f4('0x67')]=qs[_0xc7f4('0x4c')](_0xa4b9de[_0xc7f4('0x46')][_0xc7f4('0x4c')]);_0x472832[_0xc7f4('0x4d')]=qs['filters'](_['pick'](_0xa4b9de[_0xc7f4('0x46')],_0xf0bc7c['filters']));_0x472832[_0xc7f4('0x4d')][_0xc7f4('0x6d')]=_0x4c4c2d['id'];if(_0xa4b9de[_0xc7f4('0x46')][_0xc7f4('0x4f')]){_0x472832[_0xc7f4('0x4d')]=_['merge'](_0x472832[_0xc7f4('0x4d')],{'$or':_['map'](_0x472832[_0xc7f4('0x49')],function(_0x4a8896){var _0x4e1e3b={};_0x4e1e3b[_0x4a8896]={'$like':'%'+_0xa4b9de[_0xc7f4('0x46')][_0xc7f4('0x4f')]+'%'};return _0x4e1e3b;})});}_0x472832=_['merge']({},_0x472832,_0xa4b9de['options']);return db[_0xc7f4('0x6e')][_0xc7f4('0x33')]({'where':_0x472832[_0xc7f4('0x4d')]})[_0xc7f4('0x22')](function(_0x29fa40){_0x37d13e[_0xc7f4('0x33')]=_0x29fa40;if(_0xa4b9de[_0xc7f4('0x46')][_0xc7f4('0x53')]){_0x472832[_0xc7f4('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc7f4('0x69')](_0x472832);})['then'](function(_0x39026a){_0x37d13e[_0xc7f4('0x6a')]=_0x39026a;return _0x37d13e;});}})[_0xc7f4('0x22')](respondWithFilteredResult(_0x3daef8,_0x472832))[_0xc7f4('0x2b')](handleError(_0x3daef8,null));};exports[_0xc7f4('0x70')]=function(_0x57c560,_0x565d4f,_0x556903){return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x57c560[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x565d4f,null))['then'](function(_0x2904b2){if(_0x2904b2){return _0x2904b2[_0xc7f4('0x70')](_0x57c560[_0xc7f4('0x46')]['ids']);}})[_0xc7f4('0x22')](respondWithStatusCode(_0x565d4f,null))['catch'](handleError(_0x565d4f,null));};exports[_0xc7f4('0x71')]=function(_0x1ea3e6,_0x3b125e,_0x232e68){return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x1ea3e6[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x3b125e,null))[_0xc7f4('0x22')](function(_0x58235d){if(_0x58235d){return _0x58235d['addAgents'](_0x1ea3e6[_0xc7f4('0x5b')]['ids'],_[_0xc7f4('0x72')](_0x1ea3e6['body'],[_0xc7f4('0x6c'),'id'])||{})[_0xc7f4('0x73')](function(_0x47fb2a){for(var _0x35bd8f=0x0;_0x35bd8f<_0x1ea3e6[_0xc7f4('0x5b')][_0xc7f4('0x6c')]['length'];_0x35bd8f+=0x1){socket['emit'](_0xc7f4('0x74'),{'UserId':Number(_0x1ea3e6[_0xc7f4('0x5b')][_0xc7f4('0x6c')][_0x35bd8f]),'WhatsappAccountId':Number(_0x1ea3e6[_0xc7f4('0x56')]['id'])});}return _0x47fb2a;});}})['then'](respondWithResult(_0x3b125e,null))[_0xc7f4('0x2b')](handleError(_0x3b125e,null));};exports[_0xc7f4('0x75')]=function(_0x9bf247,_0xe129ce,_0x650d8e){return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x9bf247['params']['id']}})['then'](handleEntityNotFound(_0xe129ce,null))[_0xc7f4('0x22')](function(_0x3eaaf3){if(_0x3eaaf3){return _0x3eaaf3[_0xc7f4('0x75')](_0x9bf247[_0xc7f4('0x46')][_0xc7f4('0x6c')])['then'](function(){if(_[_0xc7f4('0x76')](_0x9bf247[_0xc7f4('0x46')][_0xc7f4('0x6c')])){for(var _0x42823b=0x0;_0x42823b<_0x9bf247[_0xc7f4('0x46')][_0xc7f4('0x6c')][_0xc7f4('0x4a')];_0x42823b+=0x1){socket['emit'](_0xc7f4('0x77'),{'UserId':Number(_0x9bf247[_0xc7f4('0x46')][_0xc7f4('0x6c')][_0x42823b]),'WhatsappAccountId':Number(_0x9bf247[_0xc7f4('0x56')]['id'])});}}else{socket[_0xc7f4('0x78')](_0xc7f4('0x77'),{'UserId':Number(_0x9bf247['query'][_0xc7f4('0x6c')]),'WhatsappAccountId':Number(_0x9bf247['params']['id'])});}});}})[_0xc7f4('0x22')](respondWithStatusCode(_0xe129ce,null))[_0xc7f4('0x2b')](handleError(_0xe129ce,null));};exports[_0xc7f4('0x79')]=function(_0x2523ba,_0x5eb82c,_0x351064){var _0x2e8b51={};var _0x35fc4e={};var _0x28eb77;var _0x491d9b;return db[_0xc7f4('0x52')]['findOne']({'where':{'id':_0x2523ba[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x5eb82c,null))[_0xc7f4('0x22')](function(_0xa9363a){if(_0xa9363a){_0x28eb77=_0xa9363a;_0x35fc4e[_0xc7f4('0x45')]=_[_0xc7f4('0x58')](db['User'][_0xc7f4('0x43')]);_0x35fc4e[_0xc7f4('0x46')]=_[_0xc7f4('0x58')](_0x2523ba[_0xc7f4('0x46')]);_0x35fc4e[_0xc7f4('0x4e')]=_[_0xc7f4('0x47')](_0x35fc4e[_0xc7f4('0x45')],_0x35fc4e[_0xc7f4('0x46')]);_0x2e8b51[_0xc7f4('0x49')]=_['intersection'](_0x35fc4e[_0xc7f4('0x45')],qs['fields'](_0x2523ba[_0xc7f4('0x46')][_0xc7f4('0x48')]));_0x2e8b51['attributes']=_0x2e8b51[_0xc7f4('0x49')][_0xc7f4('0x4a')]?_0x2e8b51[_0xc7f4('0x49')]:_0x35fc4e[_0xc7f4('0x45')];_0x2e8b51[_0xc7f4('0x67')]=qs[_0xc7f4('0x4c')](_0x2523ba['query']['sort']);_0x2e8b51[_0xc7f4('0x4d')]=qs['filters'](_[_0xc7f4('0x68')](_0x2523ba['query'],_0x35fc4e[_0xc7f4('0x4e')]));if(_0x2523ba['query'][_0xc7f4('0x4f')]){_0x2e8b51['where']=_[_0xc7f4('0x51')](_0x2e8b51['where'],{'$or':_[_0xc7f4('0x42')](_0x2e8b51['attributes'],function(_0x214e43){var _0x5965f5={};_0x5965f5[_0x214e43]={'$like':'%'+_0x2523ba[_0xc7f4('0x46')]['filter']+'%'};return _0x5965f5;})});}_0x2e8b51=_[_0xc7f4('0x51')]({},_0x2e8b51,_0x2523ba[_0xc7f4('0x7a')]);return _0x28eb77[_0xc7f4('0x79')](_0x2e8b51);}})[_0xc7f4('0x22')](function(_0x5cfd3b){if(_0x5cfd3b){_0x491d9b=_0x5cfd3b['length'];if(!_0x2523ba[_0xc7f4('0x46')][_0xc7f4('0x66')](_0xc7f4('0x4b'))){_0x2e8b51[_0xc7f4('0x32')]=qs[_0xc7f4('0x32')](_0x2523ba[_0xc7f4('0x46')]['limit']);_0x2e8b51[_0xc7f4('0x30')]=qs[_0xc7f4('0x30')](_0x2523ba[_0xc7f4('0x46')][_0xc7f4('0x30')]);}return _0x28eb77[_0xc7f4('0x79')](_0x2e8b51);}})[_0xc7f4('0x22')](function(_0x1d3e84){if(_0x1d3e84){return _0x1d3e84?{'count':_0x491d9b,'rows':_0x1d3e84}:null;}})[_0xc7f4('0x22')](respondWithResult(_0x5eb82c,null))[_0xc7f4('0x2b')](handleError(_0x5eb82c,null));};exports[_0xc7f4('0x7b')]=function(_0x585766,_0x21c7ee){var _0xc6b7ac=_0x585766[_0xc7f4('0x56')]['id'];var _0x1b023e=_0x585766['body'];var _0xb3190d=0xc8;var _0x457d7e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xc7f4('0x7c')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x56f960){return db['WhatsappAccount'][_0xc7f4('0x65')]({'where':{'id':_0xc6b7ac},'transaction':_0x56f960})[_0xc7f4('0x22')](function(_0x3ec65c){if(_0x3ec65c){return db[_0xc7f4('0x7d')][_0xc7f4('0x39')]({'where':{'WhatsappAccountId':_0xc6b7ac},'transaction':_0x56f960})[_0xc7f4('0x22')](function(){var _0x471e3c=_['map'](_0x1b023e,function(_0x578c66){_0x578c66[_0xc7f4('0x6d')]=_0xc6b7ac;return _0x578c66;});return db[_0xc7f4('0x7d')]['bulkCreate'](_0x471e3c,{'transaction':_0x56f960});});}else{_0xb3190d=0x194;_0x457d7e=[];}});})['then'](function(){if(_0xb3190d!==0x194){return db['WhatsappApplication'][_0xc7f4('0x7e')]({'where':{'WhatsappAccountId':_0xc6b7ac},'order':_0xc7f4('0x7f')})[_0xc7f4('0x22')](function(_0x2791f5){_0x457d7e=_0x2791f5;});}})[_0xc7f4('0x2b')](function(_0xe040c1){_0xb3190d=0x1f4;logger[_0xc7f4('0x27')](_0xe040c1[_0xc7f4('0x3d')]);if(_0xe040c1[_0xc7f4('0x3e')]){delete _0xe040c1[_0xc7f4('0x3e')];}_0x457d7e=_0xe040c1;})[_0xc7f4('0x80')](function(){if(_0x457d7e===null){_0x21c7ee[_0xc7f4('0x2c')](_0xb3190d);}else{if(_0xb3190d===0x1f4){_0x21c7ee['status'](_0xb3190d)['send'](_0x457d7e);}else{_0x21c7ee[_0xc7f4('0x2d')](_0xb3190d)['json'](_0x457d7e);}}});};exports[_0xc7f4('0x81')]=function(_0x5babf0,_0x218b2a,_0x2fa046){var _0x5461a9={};var _0x2ea4ef={};var _0x4942a3;var _0x4f1bd2;return db['WhatsappAccount']['findOne']({'where':{'id':_0x5babf0[_0xc7f4('0x56')]['id']}})[_0xc7f4('0x22')](handleEntityNotFound(_0x218b2a,null))['then'](function(_0x9ae9d1){if(_0x9ae9d1){_0x4942a3=_0x9ae9d1;_0x2ea4ef[_0xc7f4('0x45')]=_[_0xc7f4('0x58')](db[_0xc7f4('0x7d')][_0xc7f4('0x43')]);_0x2ea4ef[_0xc7f4('0x46')]=_['keys'](_0x5babf0[_0xc7f4('0x46')]);_0x2ea4ef['filters']=_[_0xc7f4('0x47')](_0x2ea4ef[_0xc7f4('0x45')],_0x2ea4ef[_0xc7f4('0x46')]);_0x5461a9['attributes']=_[_0xc7f4('0x47')](_0x2ea4ef[_0xc7f4('0x45')],qs['fields'](_0x5babf0[_0xc7f4('0x46')][_0xc7f4('0x48')]));_0x5461a9[_0xc7f4('0x49')]=_0x5461a9[_0xc7f4('0x49')][_0xc7f4('0x4a')]?_0x5461a9[_0xc7f4('0x49')]:_0x2ea4ef['model'];_0x5461a9['order']=qs[_0xc7f4('0x4c')](_0x5babf0[_0xc7f4('0x46')]['sort']);_0x5461a9[_0xc7f4('0x4d')]=qs[_0xc7f4('0x4e')](_[_0xc7f4('0x68')](_0x5babf0['query'],_0x2ea4ef[_0xc7f4('0x4e')]));if(_0x5babf0['query'][_0xc7f4('0x4f')]){_0x5461a9['where']=_[_0xc7f4('0x51')](_0x5461a9['where'],{'$or':_[_0xc7f4('0x42')](_0x5461a9[_0xc7f4('0x49')],function(_0x1eb530){var _0x4ce7de={};_0x4ce7de[_0x1eb530]={'$like':'%'+_0x5babf0['query'][_0xc7f4('0x4f')]+'%'};return _0x4ce7de;})});}_0x5461a9=_[_0xc7f4('0x51')]({},_0x5461a9,_0x5babf0[_0xc7f4('0x7a')]);return _0x4942a3[_0xc7f4('0x81')](_0x5461a9);}})['then'](function(_0x35e0cf){if(_0x35e0cf){_0x4f1bd2=_0x35e0cf[_0xc7f4('0x4a')];if(!_0x5babf0[_0xc7f4('0x46')][_0xc7f4('0x66')](_0xc7f4('0x4b'))){_0x5461a9[_0xc7f4('0x32')]=qs[_0xc7f4('0x32')](_0x5babf0['query'][_0xc7f4('0x32')]);_0x5461a9['offset']=qs[_0xc7f4('0x30')](_0x5babf0[_0xc7f4('0x46')][_0xc7f4('0x30')]);}return _0x4942a3[_0xc7f4('0x81')](_0x5461a9);}})[_0xc7f4('0x22')](function(_0xb31f20){if(_0xb31f20){return _0xb31f20?{'count':_0x4f1bd2,'rows':_0xb31f20}:null;}})[_0xc7f4('0x22')](respondWithResult(_0x218b2a,null))[_0xc7f4('0x2b')](handleError(_0x218b2a,null));};exports[_0xc7f4('0x82')]=function(_0x352cf4,_0x3b211d,_0x57f9b4){var _0x395981={'channel':_0xc7f4('0x83')};var _0x542c8b=[];var _0x89228=[];var _0x15c945={};return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x352cf4[_0xc7f4('0x56')]['id']},'include':[{'model':db[_0xc7f4('0x7d')],'as':_0xc7f4('0x84')}]})[_0xc7f4('0x22')](handleEntityNotFound(_0x3b211d,null))[_0xc7f4('0x22')](function(_0x186f09){_0x395981[_0xc7f4('0x85')]=_0x186f09;if(_0x395981[_0xc7f4('0x85')]&&_0x395981[_0xc7f4('0x85')]['type']==='sinch'&&_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x86')]){if(_0x352cf4['body']['statuses'][_0xc7f4('0x4a')]===0x0)return;if(_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x86')][0x0][_0xc7f4('0x87')]!=='read')return;return db['WhatsappMessage'][_0xc7f4('0x38')]({'read':!![],'readAt':_0x352cf4['body'][_0xc7f4('0x86')][0x0]['timestamp']},{'where':{'messageId':_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x86')][0x0][_0xc7f4('0x88')]},'individualHooks':!![]})[_0xc7f4('0x22')](function(_0x39e767){return _0x3b211d[_0xc7f4('0x2d')](0xc8)[_0xc7f4('0x2f')](_0x39e767);});}_0x395981[_0xc7f4('0x89')]=_['orderBy'](_0x186f09[_0xc7f4('0x84')],[_0xc7f4('0x7f')],[_0xc7f4('0x8a')]);if(_0x395981[_0xc7f4('0x85')][_0xc7f4('0x84')]){delete _0x395981[_0xc7f4('0x85')][_0xc7f4('0x84')];}return db[_0xc7f4('0x8b')]['describe']()[_0xc7f4('0x22')](function(_0x29c6b6){if(!_0x29c6b6){throw new db[(_0xc7f4('0x8c'))][(_0xc7f4('0x8d'))](_0xc7f4('0x8e'));}_0x542c8b=_['difference'](_[_0xc7f4('0x58')](_0x29c6b6),[_0xc7f4('0x8f'),_0xc7f4('0x90')]);_0x89228=_[_0xc7f4('0x91')](_[_0xc7f4('0x58')](_0x29c6b6),[_0xc7f4('0x8f'),'updatedAt',_0xc7f4('0x92'),_0xc7f4('0x93')]);_0x395981['body']={'mapKey':_0xc7f4('0x94')};if(_0x395981['account']&&_0x395981[_0xc7f4('0x85')][_0xc7f4('0x44')]==='twilio'){_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x95')]=_0x352cf4['body']['From'][_0xc7f4('0x96')](_0xc7f4('0x97'),'');_0x395981['body'][_0xc7f4('0x5b')]=_0x352cf4[_0xc7f4('0x5b')]['Body'];_0x395981['body'][_0xc7f4('0x98')]=_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x99')];}if(_0x395981[_0xc7f4('0x85')]&&_0x395981[_0xc7f4('0x85')][_0xc7f4('0x44')]==='sinch'){_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x95')]=_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x9a')][0x0][_0xc7f4('0x95')];_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x5b')]=_0x352cf4[_0xc7f4('0x5b')][_0xc7f4('0x9a')][0x0][_0xc7f4('0x28')][_0xc7f4('0x5b')];_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x98')]=_0x352cf4[_0xc7f4('0x5b')]['notifications'][0x0][_0xc7f4('0x88')];}if(_0x395981[_0xc7f4('0x5b')]['id']){delete _0x395981['body']['id'];}if(_[_0xc7f4('0x9b')](_0x395981['body']['from'])){throw new db['Sequelize'][(_0xc7f4('0x8d'))](_0xc7f4('0x9c'));}if(_[_0xc7f4('0x9b')](_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x5b')])||_0x395981['body'][_0xc7f4('0x5b')]===''){throw new db[(_0xc7f4('0x8c'))][(_0xc7f4('0x8d'))](_0xc7f4('0x9d'));}if(_[_0xc7f4('0x9b')](_0x395981['body'][_0xc7f4('0x9e')])){throw new db[(_0xc7f4('0x8c'))][(_0xc7f4('0x8d'))](_0xc7f4('0x9f')+_0x89228);}if(!_[_0xc7f4('0xa0')](_0x89228,_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x9e')])){throw new db[(_0xc7f4('0x8c'))][(_0xc7f4('0x8d'))](_0xc7f4('0xa1')+_0x89228);}_0x15c945[_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x9e')]]=_0x395981[_0xc7f4('0x5b')]['from'];return db[_0xc7f4('0xa2')][_0xc7f4('0x59')]({'where':{'id':_0x395981['account']['ListId']},'include':[{'model':db[_0xc7f4('0x8b')],'as':_0xc7f4('0xa3'),'where':_0x15c945,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xc7f4('0x22')](handleEntityNotFound(_0x3b211d,null))[_0xc7f4('0x22')](function(_0x54244e){if(_0x54244e){_0x395981[_0xc7f4('0xa4')]=_[_0xc7f4('0x72')](_0x54244e,[_0xc7f4('0xa3')]);if(_0x54244e['Contacts'][_0xc7f4('0x4a')]){return _0x54244e[_0xc7f4('0xa3')][0x0];}var _0x30bb2b=_[_0xc7f4('0x1a')](_0x395981[_0xc7f4('0x5b')],{'firstName':_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x95')],'ListId':_0x54244e['id']});_0x30bb2b[_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x9e')]]=_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x95')];return db[_0xc7f4('0x8b')][_0xc7f4('0x5a')](_0x30bb2b,{'fields':_0x542c8b,'raw':!![]});}})[_0xc7f4('0x22')](handleEntityNotFound(_0x3b211d,null))[_0xc7f4('0x22')](function(_0x1e64b1){if(_0x1e64b1){_0x395981[_0xc7f4('0xa5')]=_0x1e64b1;var _0x33db9c={'ContactId':_0x1e64b1['id'],'phone':_0x395981[_0xc7f4('0x5b')][_0xc7f4('0x95')],'WhatsappAccountId':_0x352cf4[_0xc7f4('0x56')]['id']};var _0xe1f132={'ContactId':_0x1e64b1['id'],'WhatsappAccountId':_0x352cf4[_0xc7f4('0x56')]['id'],'closed':![]};return db[_0xc7f4('0xa6')][_0xc7f4('0x59')]({'where':_0xe1f132})[_0xc7f4('0x22')](function(_0x1eca34){if(_0x1eca34){return[_0x1eca34,![]];}return db[_0xc7f4('0xa6')][_0xc7f4('0x5a')](_0x33db9c)[_0xc7f4('0x22')](function(_0x328adb){return[_0x328adb,!![]];});});}})[_0xc7f4('0x73')](function(_0x16084c,_0x4566a3){_0x395981[_0xc7f4('0xa7')]=_0x16084c[_0xc7f4('0x3a')]({'plain':!![]});_0x395981[_0xc7f4('0xa7')]['created']=![];if(_0x4566a3){if(_0x395981[_0xc7f4('0x85')][_0xc7f4('0xa8')]){_0x395981[_0xc7f4('0x89')][_0xc7f4('0xa9')]({'id':0x0,'priority':_0x395981[_0xc7f4('0x89')][_0xc7f4('0x4a')]+0x1,'app':_0xc7f4('0xaa'),'appdata':_0xc7f4('0xab'),'interval':_0xc7f4('0xac')});}_0x395981[_0xc7f4('0xa7')][_0xc7f4('0xad')]=!![];}return db[_0xc7f4('0xae')][_0xc7f4('0x5a')]({'phone':_0x395981['body']['from'],'messageId':_0x395981['body'][_0xc7f4('0x98')],'body':_0x395981['body'][_0xc7f4('0x5b')],'WhatsappAccountId':_0x352cf4[_0xc7f4('0x56')]['id'],'WhatsappInteractionId':_0x16084c['id'],'direction':'in','ContactId':_0x16084c['ContactId'],'AttachmentId':_0x395981[_0xc7f4('0x5b')][_0xc7f4('0xaf')]});})[_0xc7f4('0x22')](function(_0x551e19){_0x395981[_0xc7f4('0x28')]=_0x551e19;if(_0x395981[_0xc7f4('0xa7')][_0xc7f4('0xb0')]){return db[_0xc7f4('0xb1')]['find']({'attributes':['id','name'],'where':{'id':_0x395981[_0xc7f4('0xa7')][_0xc7f4('0xb0')]}})[_0xc7f4('0x22')](function(_0x4d7d61){if(_0x4d7d61){_0x395981['applications'][_0xc7f4('0xb2')]({'id':0x0,'priority':0x0,'app':_0xc7f4('0xb3'),'appdata':_0x4d7d61[_0xc7f4('0x3e')]+','+(_0x395981[_0xc7f4('0x85')][_0xc7f4('0xb4')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x395981);});}return respondWithRpcPromise('Start','startRouting',_0x395981);})[_0xc7f4('0x22')](function(_0x3bd5d5){if(_0x3bd5d5){var _0x2d15ed=0xc8;var _0x4e2a80='receiveMessage';logger[_0xc7f4('0x29')](_0xc7f4('0x25'),_0x4e2a80,_0x2d15ed,_0xc7f4('0xb5'));logger[_0xc7f4('0xb6')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4e2a80,_0x2d15ed,_0xc7f4('0xb5'),JSON['stringify'](_0x3bd5d5));if(_0x395981['account'][_0xc7f4('0x44')]===_0xc7f4('0xb7')){return _0x3b211d[_0xc7f4('0x2d')](_0x2d15ed)[_0xc7f4('0x34')](_0xc7f4('0xb8'),_0xc7f4('0xb9'))[_0xc7f4('0x3f')](_0xc7f4('0xba'));}else{return _0x3b211d[_0xc7f4('0x2d')](_0x2d15ed)[_0xc7f4('0x2f')](_0x3bd5d5);}}});})[_0xc7f4('0x2b')](handleError(_0x3b211d,null));};exports[_0xc7f4('0x3f')]=function(_0x2f7186,_0x2387e9,_0x2dda34){var _0x2f4f12,_0x342a65,_0x5660ba;if(_[_0xc7f4('0x9b')](_0x2f7186[_0xc7f4('0x5b')][_0xc7f4('0x5b')])||_0x2f7186[_0xc7f4('0x5b')]['body']===''){throw new db[(_0xc7f4('0x8c'))]['ValidationError'](_0xc7f4('0x9d'));}if(_[_0xc7f4('0x9b')](_0x2f7186[_0xc7f4('0x5b')]['to'])){throw new db['Sequelize'][(_0xc7f4('0x8d'))](_0xc7f4('0xbb'));}_0x2f4f12=_0x2f7186[_0xc7f4('0x5b')]['to'];return db[_0xc7f4('0x52')][_0xc7f4('0x59')]({'where':{'id':_0x2f7186[_0xc7f4('0x56')]['id']},'include':[{'model':db[_0xc7f4('0xa2')],'as':'List','include':[{'model':db[_0xc7f4('0x8b')],'as':_0xc7f4('0xa3'),'where':{'mobile':_0x2f4f12},'limit':0x1,'order':[[_0xc7f4('0x90'),_0xc7f4('0xbc')]]}]}]})[_0xc7f4('0x22')](handleEntityNotFound(_0x2387e9,null))[_0xc7f4('0x22')](function(_0x351478){if(_0x351478&&_0x351478[_0xc7f4('0xbd')]){_0x342a65=_0x351478[_0xc7f4('0x3a')]({'plain':!![]});if(_0x342a65[_0xc7f4('0xbd')]&&_0x342a65[_0xc7f4('0xbd')]['Contacts'][_0xc7f4('0x4a')]){return _0x342a65['List'][_0xc7f4('0xa3')][0x0];}return db['CmContact']['create'](_['defaults'](_0x2f7186[_0xc7f4('0x5b')],{'firstName':_0x2f4f12,'mobile':_0x2f4f12,'phone':_0x2f4f12,'ListId':_0x342a65[_0xc7f4('0x93')]}));}})[_0xc7f4('0x22')](handleEntityNotFound(_0x2387e9,null))['then'](function(_0x17270b){if(_0x17270b){_0x5660ba=_0x17270b;return db[_0xc7f4('0xa6')][_0xc7f4('0x59')]({'where':{'ContactId':_0x5660ba['id'],'closed':![],'WhatsappAccountId':_0x342a65['id']}})['then'](function(_0x535e55){if(_0x535e55){return[_0x535e55,![]];}return db['WhatsappInteraction'][_0xc7f4('0x5a')]({'UserId':_0x2f7186[_0xc7f4('0x5d')]['id'],'ContactId':_0x5660ba['id'],'WhatsappAccountId':_0x342a65['id'],'phone':_0x2f4f12,'firstMsgDirection':_0xc7f4('0xbe'),'Messages':[_[_0xc7f4('0x51')](_0x2f7186[_0xc7f4('0x5b')],{'read':![],'body':_0x2f7186['body'][_0xc7f4('0x5b')],'phone':_0x2f4f12,'WhatsappAccountId':_0x342a65['id'],'UserId':_0x2f7186['user']['id'],'ContactId':_0x5660ba['id']})]},{'include':[{'model':db[_0xc7f4('0xae')],'as':_0xc7f4('0xbf')}]})[_0xc7f4('0x22')](function(_0x4223a1){return[_0x4223a1,!![]];});});}})[_0xc7f4('0x73')](function(_0x28b82f,_0x58c01f){if(_0x58c01f){return _0x28b82f;}return db[_0xc7f4('0xae')]['create'](_[_0xc7f4('0x51')](_0x2f7186[_0xc7f4('0x5b')],{'read':![],'body':_0x2f7186[_0xc7f4('0x5b')]['body'],'phone':_0x2f4f12,'WhatsappAccountId':_0x342a65['id'],'WhatsappInteractionId':_0x28b82f['id'],'UserId':_0x2f7186[_0xc7f4('0x5d')]['id'],'ContactId':_0x5660ba['id']}))['then'](function(_0x180986){_0x28b82f[_0xc7f4('0xc0')][_0xc7f4('0xbf')]=[];_0x28b82f['dataValues'][_0xc7f4('0xbf')][_0xc7f4('0xa9')](_0x180986[_0xc7f4('0xc0')]);return _0x28b82f;});})[_0xc7f4('0x22')](respondWithResult(_0x2387e9,null))['catch'](handleError(_0x2387e9,null));}; \ No newline at end of file +var _0x9255=['to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','status','end','sendStatus','stack','name','send','index','WhatsappAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','Pause','mandatoryDispositionPause','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','Disposition','hasOwnProperty','WhatsappAccountId','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','defaults','WhatsappInteraction','spread','interaction','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','List','DESC','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x5f2346,_0x54cd31){var _0x2e0d57=function(_0x4ad842){while(--_0x4ad842){_0x5f2346['push'](_0x5f2346['shift']());}};_0x2e0d57(++_0x54cd31);}(_0x9255,0x17d));var _0x5925=function(_0x46275a,_0x157c56){_0x46275a=_0x46275a-0x0;var _0x1b6b39=_0x9255[_0x46275a];return _0x1b6b39;};'use strict';var emlformat=require(_0x5925('0x0'));var rimraf=require(_0x5925('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5925('0x2'));var rp=require(_0x5925('0x3'));var moment=require('moment');var BPromise=require(_0x5925('0x4'));var Mustache=require(_0x5925('0x5'));var util=require('util');var path=require(_0x5925('0x6'));var sox=require('sox');var csv=require(_0x5925('0x7'));var ejs=require(_0x5925('0x8'));var fs=require('fs');var fs_extra=require(_0x5925('0x9'));var _=require('lodash');var squel=require(_0x5925('0xa'));var crypto=require(_0x5925('0xb'));var jsforce=require(_0x5925('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5925('0x7'));var querystring=require(_0x5925('0xd'));var Papa=require(_0x5925('0xe'));var Redis=require(_0x5925('0xf'));var authService=require(_0x5925('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5925('0x11'));var logger=require('../../config/logger')(_0x5925('0x12'));var utils=require(_0x5925('0x13'));var config=require(_0x5925('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5925('0x15'))['db'];config[_0x5925('0x16')]=_['defaults'](config[_0x5925('0x16')],{'host':_0x5925('0x17'),'port':0x18eb});var socket=require(_0x5925('0x18'))(new Redis(config[_0x5925('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x5925('0x19'));var client=jayson[_0x5925('0x1a')][_0x5925('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2cca22,_0x2f848f,_0x2ecbbc,_0x39132b){return new BPromise(function(_0x1c488d,_0x583a25){var _0x36b04f=_0x39132b||client;return _0x36b04f[_0x5925('0x1c')](_0x2cca22,_0x2ecbbc)[_0x5925('0x1d')](function(_0x5c8ecb){logger[_0x5925('0x1e')](_0x5925('0x1f'),_0x2f848f,_0x5925('0x20'));logger['debug'](_0x5925('0x21'),_0x2f848f,_0x5925('0x20'),JSON[_0x5925('0x22')](_0x5c8ecb));if(_0x5c8ecb[_0x5925('0x23')]){if(_0x5c8ecb[_0x5925('0x23')][_0x5925('0x24')]===0x1f4){logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x5c8ecb['error'][_0x5925('0x25')]);return _0x583a25(_0x5c8ecb['error'][_0x5925('0x25')]);}logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x5c8ecb[_0x5925('0x23')][_0x5925('0x25')]);return _0x1c488d(_0x5c8ecb[_0x5925('0x23')][_0x5925('0x25')]);}else{logger['info'](_0x5925('0x1f'),_0x2f848f,_0x5925('0x20'));_0x1c488d(_0x5c8ecb[_0x5925('0x26')]['message']);}})['catch'](function(_0x3a1616){logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x3a1616);_0x583a25(_0x3a1616);});});}function respondWithStatusCode(_0xf19357,_0x3e2b71){_0x3e2b71=_0x3e2b71||0xcc;return function(_0x144b68){if(_0x144b68){return _0xf19357['sendStatus'](_0x3e2b71);}return _0xf19357['status'](_0x3e2b71)['end']();};}function respondWithResult(_0x544c34,_0x1c7ea9){_0x1c7ea9=_0x1c7ea9||0xc8;return function(_0x3ce7af){if(_0x3ce7af){return _0x544c34['status'](_0x1c7ea9)[_0x5925('0x27')](_0x3ce7af);}};}function respondWithFilteredResult(_0x2901a9,_0x2274e5){return function(_0x15b2ac){if(_0x15b2ac){var _0x36b8cd=typeof _0x2274e5[_0x5925('0x28')]===_0x5925('0x29')&&typeof _0x2274e5[_0x5925('0x2a')]===_0x5925('0x29');var _0x5bdb61=_0x15b2ac[_0x5925('0x2b')];var _0x15f805=_0x36b8cd?0x0:_0x2274e5[_0x5925('0x28')];var _0x2ad6d2=_0x36b8cd?_0x15b2ac[_0x5925('0x2b')]:_0x2274e5['offset']+_0x2274e5[_0x5925('0x2a')];var _0x353c05;if(_0x2ad6d2>=_0x5bdb61){_0x2ad6d2=_0x5bdb61;_0x353c05=0xc8;}else{_0x353c05=0xce;}_0x2901a9['status'](_0x353c05);return _0x2901a9[_0x5925('0x2c')](_0x5925('0x2d'),_0x15f805+'-'+_0x2ad6d2+'/'+_0x5bdb61)[_0x5925('0x27')](_0x15b2ac);}return null;};}function patchUpdates(_0xaea95){return function(_0x32aee6){try{jsonpatch[_0x5925('0x2e')](_0x32aee6,_0xaea95,!![]);}catch(_0x3f4bc1){return BPromise[_0x5925('0x2f')](_0x3f4bc1);}return _0x32aee6[_0x5925('0x30')]();};}function saveUpdates(_0x123fae,_0x5cbb6b){return function(_0x2b0f9d){if(_0x2b0f9d){return _0x2b0f9d['update'](_0x123fae)[_0x5925('0x1d')](function(_0x45e4d0){return _0x45e4d0;});}return null;};}function removeEntity(_0x118615,_0x126b30){return function(_0x1c8479){if(_0x1c8479){return _0x1c8479[_0x5925('0x31')]()[_0x5925('0x1d')](function(){var _0x29b3d6=_0x1c8479[_0x5925('0x32')]({'plain':!![]});var _0x21968a=_0x5925('0x33');return db[_0x5925('0x34')][_0x5925('0x31')]({'where':{'type':_0x21968a,'resourceId':_0x29b3d6['id']}})['then'](function(){return _0x1c8479;});})['then'](function(){_0x118615[_0x5925('0x35')](0xcc)[_0x5925('0x36')]();});}};}function handleEntityNotFound(_0x3b3c71,_0x5f3e63){return function(_0x6c671a){if(!_0x6c671a){_0x3b3c71[_0x5925('0x37')](0x194);}return _0x6c671a;};}function handleError(_0xdef586,_0x236ddf){_0x236ddf=_0x236ddf||0x1f4;return function(_0xd2d5ff){logger[_0x5925('0x23')](_0xd2d5ff[_0x5925('0x38')]);if(_0xd2d5ff[_0x5925('0x39')]){delete _0xd2d5ff['name'];}_0xdef586['status'](_0x236ddf)[_0x5925('0x3a')](_0xd2d5ff);};}exports[_0x5925('0x3b')]=function(_0x5e3008,_0x4e8369){var _0x1e6249={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1ee075={},_0x1c48fe={'count':0x0,'rows':[]};var _0x2fb90a=_['map'](db[_0x5925('0x3c')][_0x5925('0x3d')],function(_0x344518){return{'name':_0x344518['fieldName'],'type':_0x344518[_0x5925('0x3e')][_0x5925('0x3f')]};});_0x1ee075[_0x5925('0x40')]=_[_0x5925('0x41')](_0x2fb90a,'name');_0x1ee075[_0x5925('0x42')]=_[_0x5925('0x43')](_0x5e3008['query']);_0x1ee075[_0x5925('0x44')]=_[_0x5925('0x45')](_0x1ee075[_0x5925('0x40')],_0x1ee075['query']);_0x1e6249[_0x5925('0x46')]=_[_0x5925('0x45')](_0x1ee075[_0x5925('0x40')],qs['fields'](_0x5e3008[_0x5925('0x42')]['fields']));_0x1e6249[_0x5925('0x46')]=_0x1e6249[_0x5925('0x46')][_0x5925('0x47')]?_0x1e6249[_0x5925('0x46')]:_0x1ee075[_0x5925('0x40')];if(!_0x5e3008['query']['hasOwnProperty'](_0x5925('0x48'))){_0x1e6249[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x5e3008[_0x5925('0x42')][_0x5925('0x2a')]);_0x1e6249[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x5e3008['query'][_0x5925('0x28')]);}_0x1e6249[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x5e3008[_0x5925('0x42')][_0x5925('0x4a')]);_0x1e6249[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x5e3008[_0x5925('0x42')],_0x1ee075['filters']),_0x2fb90a);if(_0x5e3008['query'][_0x5925('0x4d')]){_0x1e6249[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x1e6249['where'],{'$or':_['map'](_0x2fb90a,function(_0x41b909){if(_0x41b909[_0x5925('0x3e')]!==_0x5925('0x4f')){var _0x2bb35a={};_0x2bb35a[_0x41b909['name']]={'$like':'%'+_0x5e3008[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x2bb35a;}})});}_0x1e6249=_['merge']({},_0x1e6249,_0x5e3008[_0x5925('0x50')]);var _0x118a7f={'where':_0x1e6249[_0x5925('0x4b')]};return db[_0x5925('0x3c')][_0x5925('0x2b')](_0x118a7f)[_0x5925('0x1d')](function(_0x182ec4){_0x1c48fe[_0x5925('0x2b')]=_0x182ec4;if(_0x5e3008[_0x5925('0x42')][_0x5925('0x51')]){_0x1e6249['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x1e6249);})[_0x5925('0x1d')](function(_0x4f7601){_0x1c48fe[_0x5925('0x52')]=_0x4f7601;return _0x1c48fe;})[_0x5925('0x1d')](respondWithFilteredResult(_0x4e8369,_0x1e6249))[_0x5925('0x53')](handleError(_0x4e8369,null));};exports[_0x5925('0x54')]=function(_0x1b2bdb,_0x41cb64){var _0x5cf648={'raw':![],'where':{'id':_0x1b2bdb[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0x56')],'as':_0x5925('0x57')}]},_0x27d323={};_0x27d323['model']=_['keys'](db[_0x5925('0x3c')]['rawAttributes']);_0x27d323[_0x5925('0x42')]=_['keys'](_0x1b2bdb[_0x5925('0x42')]);_0x27d323['filters']=_[_0x5925('0x45')](_0x27d323['model'],_0x27d323[_0x5925('0x42')]);_0x5cf648[_0x5925('0x46')]=_[_0x5925('0x45')](_0x27d323[_0x5925('0x40')],qs[_0x5925('0x58')](_0x1b2bdb[_0x5925('0x42')][_0x5925('0x58')]));_0x5cf648[_0x5925('0x46')]=_0x5cf648[_0x5925('0x46')]['length']?_0x5cf648['attributes']:_0x27d323['model'];if(_0x1b2bdb[_0x5925('0x42')]['includeAll']){_0x5cf648['include']=[{'all':!![]}];}_0x5cf648=_[_0x5925('0x4e')]({},_0x5cf648,_0x1b2bdb[_0x5925('0x50')]);return db[_0x5925('0x3c')]['find'](_0x5cf648)[_0x5925('0x1d')](handleEntityNotFound(_0x41cb64,null))[_0x5925('0x1d')](respondWithResult(_0x41cb64,null))['catch'](handleError(_0x41cb64,null));};exports[_0x5925('0x59')]=function(_0x5c1a76,_0x562d52){return db[_0x5925('0x3c')][_0x5925('0x59')](_0x5c1a76[_0x5925('0x5a')],{})[_0x5925('0x1d')](function(_0x2c1871){var _0x53c523=_0x5c1a76[_0x5925('0x5b')][_0x5925('0x32')]({'plain':!![]});if(!_0x53c523)throw new Error(_0x5925('0x5c'));if(_0x53c523[_0x5925('0x5d')]===_0x5925('0x5b')){var _0x56da6=_0x2c1871['get']({'plain':!![]});var _0x33edcc=_0x5925('0x33');return db['UserProfileSection'][_0x5925('0x5e')]({'where':{'name':_0x33edcc,'userProfileId':_0x53c523['userProfileId']},'raw':!![]})['then'](function(_0x1767d0){if(_0x1767d0&&_0x1767d0[_0x5925('0x5f')]===0x0){return db[_0x5925('0x34')]['create']({'name':_0x56da6[_0x5925('0x39')],'resourceId':_0x56da6['id'],'type':_0x1767d0[_0x5925('0x39')],'sectionId':_0x1767d0['id']},{})[_0x5925('0x1d')](function(){return _0x2c1871;});}else{return _0x2c1871;}})[_0x5925('0x53')](function(_0x526656){logger[_0x5925('0x23')](_0x5925('0x60'),_0x526656);throw _0x526656;});}return _0x2c1871;})[_0x5925('0x1d')](respondWithResult(_0x562d52,0xc9))[_0x5925('0x53')](handleError(_0x562d52,null));};exports[_0x5925('0x61')]=function(_0x278433,_0x21c136){if(_0x278433['body']['id']){delete _0x278433[_0x5925('0x5a')]['id'];}return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x278433['params']['id']},'include':[{'model':db['Pause'],'as':_0x5925('0x57')}]})[_0x5925('0x1d')](handleEntityNotFound(_0x21c136,null))[_0x5925('0x1d')](saveUpdates(_0x278433[_0x5925('0x5a')],null))[_0x5925('0x1d')](respondWithResult(_0x21c136,null))[_0x5925('0x53')](handleError(_0x21c136,null));};exports[_0x5925('0x31')]=function(_0x3cfbb9,_0x2548f1){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x3cfbb9[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x2548f1,null))[_0x5925('0x1d')](removeEntity(_0x2548f1,null))[_0x5925('0x53')](handleError(_0x2548f1,null));};exports[_0x5925('0x62')]=function(_0x353ed9,_0x2b4827){return db['WhatsappAccount'][_0x5925('0x62')]()['then'](respondWithResult(_0x2b4827,null))[_0x5925('0x53')](handleError(_0x2b4827,null));};exports[_0x5925('0x63')]=function(_0x34aecd,_0x51c9b1,_0x462388){if(_0x34aecd['body']['id']){delete _0x34aecd[_0x5925('0x5a')]['id'];}return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x34aecd[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x51c9b1,null))['then'](function(_0x1fc164){if(_0x1fc164){_0x34aecd[_0x5925('0x5a')]['WhatsappAccountId']=_0x1fc164['id'];return db['Disposition'][_0x5925('0x59')](_0x34aecd[_0x5925('0x5a')]);}})[_0x5925('0x1d')](respondWithResult(_0x51c9b1,null))[_0x5925('0x53')](handleError(_0x51c9b1,null));};exports[_0x5925('0x64')]=function(_0x58f3b6,_0x258bd4,_0x3ffb1a){var _0x417100={'raw':![],'where':{}};var _0x19d004={};var _0x125b7f={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x58f3b6['params']['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x258bd4,null))['then'](function(_0x541663){if(_0x541663){_0x19d004[_0x5925('0x40')]=_[_0x5925('0x43')](db[_0x5925('0x65')][_0x5925('0x3d')]);_0x19d004[_0x5925('0x42')]=_[_0x5925('0x43')](_0x58f3b6['query']);_0x19d004[_0x5925('0x44')]=_[_0x5925('0x45')](_0x19d004[_0x5925('0x40')],_0x19d004[_0x5925('0x42')]);_0x417100[_0x5925('0x46')]=_[_0x5925('0x45')](_0x19d004[_0x5925('0x40')],qs[_0x5925('0x58')](_0x58f3b6[_0x5925('0x42')][_0x5925('0x58')]));_0x417100['attributes']=_0x417100['attributes'][_0x5925('0x47')]?_0x417100[_0x5925('0x46')]:_0x19d004[_0x5925('0x40')];if(!_0x58f3b6['query'][_0x5925('0x66')](_0x5925('0x48'))){_0x417100[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x58f3b6['query'][_0x5925('0x2a')]);_0x417100[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x58f3b6[_0x5925('0x42')]['offset']);}_0x417100[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x58f3b6[_0x5925('0x42')][_0x5925('0x4a')]);_0x417100[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x58f3b6[_0x5925('0x42')],_0x19d004[_0x5925('0x44')]));_0x417100[_0x5925('0x4b')][_0x5925('0x67')]=_0x541663['id'];if(_0x58f3b6['query']['filter']){_0x417100[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x417100['where'],{'$or':_[_0x5925('0x41')](_0x417100[_0x5925('0x46')],function(_0x2f1236){var _0x3a2db4={};_0x3a2db4[_0x2f1236]={'$like':'%'+_0x58f3b6[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x3a2db4;})});}_0x417100=_[_0x5925('0x4e')]({},_0x417100,_0x58f3b6[_0x5925('0x50')]);return db[_0x5925('0x65')][_0x5925('0x2b')]({'where':_0x417100[_0x5925('0x4b')]})[_0x5925('0x1d')](function(_0x281e82){_0x125b7f[_0x5925('0x2b')]=_0x281e82;if(_0x58f3b6[_0x5925('0x42')][_0x5925('0x51')]){_0x417100[_0x5925('0x68')]=[{'all':!![]}];}return db['Disposition'][_0x5925('0x69')](_0x417100);})['then'](function(_0x499d82){_0x125b7f[_0x5925('0x52')]=_0x499d82;return _0x125b7f;});}})['then'](respondWithFilteredResult(_0x258bd4,_0x417100))[_0x5925('0x53')](handleError(_0x258bd4,null));};exports[_0x5925('0x6a')]=function(_0x242e8e,_0x3ea4af,_0x27d2c0){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x242e8e[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ea4af,null))[_0x5925('0x1d')](function(_0x5ed3c0){if(_0x5ed3c0){return _0x5ed3c0[_0x5925('0x6a')](_0x242e8e[_0x5925('0x42')][_0x5925('0x6b')]);}})[_0x5925('0x1d')](respondWithStatusCode(_0x3ea4af,null))[_0x5925('0x53')](handleError(_0x3ea4af,null));};exports[_0x5925('0x6c')]=function(_0x586744,_0x18924c,_0x116784){if(_0x586744['body']['id']){delete _0x586744[_0x5925('0x5a')]['id'];}return db['WhatsappAccount'][_0x5925('0x5e')]({'where':{'id':_0x586744[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x18924c,null))['then'](function(_0x524f17){if(_0x524f17){_0x586744[_0x5925('0x5a')][_0x5925('0x67')]=_0x524f17['id'];return db[_0x5925('0x6d')][_0x5925('0x59')](_0x586744['body']);}})[_0x5925('0x1d')](respondWithResult(_0x18924c,null))[_0x5925('0x53')](handleError(_0x18924c,null));};exports['getAnswers']=function(_0x5d794b,_0x3359dc,_0xfe7181){var _0x5b2635={'raw':![],'where':{}};var _0x4da127={};var _0xe19505={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5925('0x6e')]({'where':{'id':_0x5d794b[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x3359dc,null))[_0x5925('0x1d')](function(_0xb1372e){if(_0xb1372e){_0x4da127['model']=_['keys'](db['CannedAnswer'][_0x5925('0x3d')]);_0x4da127[_0x5925('0x42')]=_['keys'](_0x5d794b[_0x5925('0x42')]);_0x4da127[_0x5925('0x44')]=_[_0x5925('0x45')](_0x4da127[_0x5925('0x40')],_0x4da127[_0x5925('0x42')]);_0x5b2635['attributes']=_['intersection'](_0x4da127[_0x5925('0x40')],qs[_0x5925('0x58')](_0x5d794b[_0x5925('0x42')][_0x5925('0x58')]));_0x5b2635[_0x5925('0x46')]=_0x5b2635[_0x5925('0x46')][_0x5925('0x47')]?_0x5b2635[_0x5925('0x46')]:_0x4da127[_0x5925('0x40')];if(!_0x5d794b[_0x5925('0x42')]['hasOwnProperty']('nolimit')){_0x5b2635[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x5d794b[_0x5925('0x42')]['limit']);_0x5b2635[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x5d794b[_0x5925('0x42')][_0x5925('0x28')]);}_0x5b2635[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x5d794b[_0x5925('0x42')][_0x5925('0x4a')]);_0x5b2635['where']=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x5d794b['query'],_0x4da127['filters']));_0x5b2635[_0x5925('0x4b')]['WhatsappAccountId']=_0xb1372e['id'];if(_0x5d794b[_0x5925('0x42')]['filter']){_0x5b2635[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x5b2635['where'],{'$or':_['map'](_0x5b2635[_0x5925('0x46')],function(_0x747838){var _0x5938da={};_0x5938da[_0x747838]={'$like':'%'+_0x5d794b[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x5938da;})});}_0x5b2635=_[_0x5925('0x4e')]({},_0x5b2635,_0x5d794b[_0x5925('0x50')]);return db[_0x5925('0x6d')][_0x5925('0x2b')]({'where':_0x5b2635[_0x5925('0x4b')]})[_0x5925('0x1d')](function(_0xcd27d9){_0xe19505[_0x5925('0x2b')]=_0xcd27d9;if(_0x5d794b['query'][_0x5925('0x51')]){_0x5b2635['include']=[{'all':!![]}];}return db[_0x5925('0x6d')][_0x5925('0x69')](_0x5b2635);})[_0x5925('0x1d')](function(_0x54352f){_0xe19505[_0x5925('0x52')]=_0x54352f;return _0xe19505;});}})[_0x5925('0x1d')](respondWithFilteredResult(_0x3359dc,_0x5b2635))['catch'](handleError(_0x3359dc,null));};exports[_0x5925('0x6f')]=function(_0x13b183,_0x365c25,_0x24aa60){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x13b183[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x365c25,null))[_0x5925('0x1d')](function(_0x2e5255){if(_0x2e5255){return _0x2e5255['removeAnswers'](_0x13b183[_0x5925('0x42')][_0x5925('0x6b')]);}})[_0x5925('0x1d')](respondWithStatusCode(_0x365c25,null))[_0x5925('0x53')](handleError(_0x365c25,null));};exports[_0x5925('0x70')]=function(_0x4c453b,_0x3602d4,_0x4b54cb){return db['WhatsappAccount'][_0x5925('0x5e')]({'where':{'id':_0x4c453b['params']['id']}})['then'](handleEntityNotFound(_0x3602d4,null))['then'](function(_0x221c3b){if(_0x221c3b){return _0x221c3b[_0x5925('0x70')](_0x4c453b[_0x5925('0x5a')][_0x5925('0x6b')],_['omit'](_0x4c453b[_0x5925('0x5a')],[_0x5925('0x6b'),'id'])||{})['spread'](function(_0x50ba60){for(var _0x426114=0x0;_0x426114<_0x4c453b['body'][_0x5925('0x6b')]['length'];_0x426114+=0x1){socket[_0x5925('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x4c453b[_0x5925('0x5a')][_0x5925('0x6b')][_0x426114]),'WhatsappAccountId':Number(_0x4c453b['params']['id'])});}return _0x50ba60;});}})[_0x5925('0x1d')](respondWithResult(_0x3602d4,null))[_0x5925('0x53')](handleError(_0x3602d4,null));};exports[_0x5925('0x72')]=function(_0x59110f,_0x26f891,_0x574648){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x59110f['params']['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x26f891,null))['then'](function(_0x17d86e){if(_0x17d86e){return _0x17d86e[_0x5925('0x72')](_0x59110f[_0x5925('0x42')][_0x5925('0x6b')])[_0x5925('0x1d')](function(){if(_[_0x5925('0x73')](_0x59110f[_0x5925('0x42')]['ids'])){for(var _0x628c=0x0;_0x628c<_0x59110f['query']['ids'][_0x5925('0x47')];_0x628c+=0x1){socket[_0x5925('0x71')](_0x5925('0x74'),{'UserId':Number(_0x59110f[_0x5925('0x42')][_0x5925('0x6b')][_0x628c]),'WhatsappAccountId':Number(_0x59110f[_0x5925('0x55')]['id'])});}}else{socket['emit'](_0x5925('0x74'),{'UserId':Number(_0x59110f['query'][_0x5925('0x6b')]),'WhatsappAccountId':Number(_0x59110f[_0x5925('0x55')]['id'])});}});}})[_0x5925('0x1d')](respondWithStatusCode(_0x26f891,null))[_0x5925('0x53')](handleError(_0x26f891,null));};exports[_0x5925('0x75')]=function(_0x56ab43,_0x5e4e74,_0x59ed4b){var _0x5e3a6c={};var _0xcc8bc1={};var _0x182701;var _0x299a3b;return db[_0x5925('0x3c')]['findOne']({'where':{'id':_0x56ab43[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x5e4e74,null))['then'](function(_0x59322b){if(_0x59322b){_0x182701=_0x59322b;_0xcc8bc1[_0x5925('0x40')]=_['keys'](db[_0x5925('0x76')]['rawAttributes']);_0xcc8bc1[_0x5925('0x42')]=_[_0x5925('0x43')](_0x56ab43[_0x5925('0x42')]);_0xcc8bc1[_0x5925('0x44')]=_[_0x5925('0x45')](_0xcc8bc1[_0x5925('0x40')],_0xcc8bc1[_0x5925('0x42')]);_0x5e3a6c[_0x5925('0x46')]=_[_0x5925('0x45')](_0xcc8bc1['model'],qs[_0x5925('0x58')](_0x56ab43[_0x5925('0x42')]['fields']));_0x5e3a6c['attributes']=_0x5e3a6c['attributes'][_0x5925('0x47')]?_0x5e3a6c['attributes']:_0xcc8bc1[_0x5925('0x40')];_0x5e3a6c['order']=qs[_0x5925('0x4a')](_0x56ab43['query'][_0x5925('0x4a')]);_0x5e3a6c[_0x5925('0x4b')]=qs[_0x5925('0x44')](_['pick'](_0x56ab43[_0x5925('0x42')],_0xcc8bc1['filters']));if(_0x56ab43['query'][_0x5925('0x4d')]){_0x5e3a6c[_0x5925('0x4b')]=_['merge'](_0x5e3a6c[_0x5925('0x4b')],{'$or':_[_0x5925('0x41')](_0x5e3a6c[_0x5925('0x46')],function(_0x1747dc){var _0x314a80={};_0x314a80[_0x1747dc]={'$like':'%'+_0x56ab43[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x314a80;})});}_0x5e3a6c=_[_0x5925('0x4e')]({},_0x5e3a6c,_0x56ab43[_0x5925('0x50')]);return _0x182701[_0x5925('0x75')](_0x5e3a6c);}})[_0x5925('0x1d')](function(_0x30ab5e){if(_0x30ab5e){_0x299a3b=_0x30ab5e[_0x5925('0x47')];if(!_0x56ab43[_0x5925('0x42')]['hasOwnProperty'](_0x5925('0x48'))){_0x5e3a6c[_0x5925('0x2a')]=qs['limit'](_0x56ab43[_0x5925('0x42')]['limit']);_0x5e3a6c['offset']=qs[_0x5925('0x28')](_0x56ab43[_0x5925('0x42')][_0x5925('0x28')]);}return _0x182701[_0x5925('0x75')](_0x5e3a6c);}})[_0x5925('0x1d')](function(_0xb6d49a){if(_0xb6d49a){return _0xb6d49a?{'count':_0x299a3b,'rows':_0xb6d49a}:null;}})['then'](respondWithResult(_0x5e4e74,null))[_0x5925('0x53')](handleError(_0x5e4e74,null));};exports[_0x5925('0x77')]=function(_0x590ef2,_0x5df5ab){var _0x464e44=_0x590ef2[_0x5925('0x55')]['id'];var _0x56744e=_0x590ef2['body'];var _0x406b9a=0xc8;var _0x372757=null;return db['sequelize'][_0x5925('0x78')]({'isolationLevel':db['sequelize'][_0x5925('0x79')][_0x5925('0x7a')]['READ_COMMITTED']},function(_0x1edf2a){return db[_0x5925('0x3c')][_0x5925('0x6e')]({'where':{'id':_0x464e44},'transaction':_0x1edf2a})[_0x5925('0x1d')](function(_0x437117){if(_0x437117){return db[_0x5925('0x7b')][_0x5925('0x31')]({'where':{'WhatsappAccountId':_0x464e44},'transaction':_0x1edf2a})[_0x5925('0x1d')](function(){var _0x36ca27=_[_0x5925('0x41')](_0x56744e,function(_0x337c5a){_0x337c5a[_0x5925('0x67')]=_0x464e44;return _0x337c5a;});return db[_0x5925('0x7b')][_0x5925('0x7c')](_0x36ca27,{'transaction':_0x1edf2a});});}else{_0x406b9a=0x194;_0x372757=[];}});})[_0x5925('0x1d')](function(){if(_0x406b9a!==0x194){return db[_0x5925('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x464e44},'order':_0x5925('0x7d')})['then'](function(_0x3cfcb2){_0x372757=_0x3cfcb2;});}})[_0x5925('0x53')](function(_0x34b21d){_0x406b9a=0x1f4;logger['error'](_0x34b21d[_0x5925('0x38')]);if(_0x34b21d['name']){delete _0x34b21d[_0x5925('0x39')];}_0x372757=_0x34b21d;})[_0x5925('0x7e')](function(){if(_0x372757===null){_0x5df5ab[_0x5925('0x37')](_0x406b9a);}else{if(_0x406b9a===0x1f4){_0x5df5ab['status'](_0x406b9a)[_0x5925('0x3a')](_0x372757);}else{_0x5df5ab[_0x5925('0x35')](_0x406b9a)[_0x5925('0x27')](_0x372757);}}});};exports[_0x5925('0x7f')]=function(_0x2683bc,_0x49ef7f,_0x3233ab){var _0x1d9948={};var _0x2d704d={};var _0x52a759;var _0x3dbd0d;return db[_0x5925('0x3c')][_0x5925('0x6e')]({'where':{'id':_0x2683bc[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x49ef7f,null))[_0x5925('0x1d')](function(_0x4cc9fa){if(_0x4cc9fa){_0x52a759=_0x4cc9fa;_0x2d704d[_0x5925('0x40')]=_[_0x5925('0x43')](db['WhatsappApplication'][_0x5925('0x3d')]);_0x2d704d['query']=_[_0x5925('0x43')](_0x2683bc[_0x5925('0x42')]);_0x2d704d[_0x5925('0x44')]=_[_0x5925('0x45')](_0x2d704d[_0x5925('0x40')],_0x2d704d[_0x5925('0x42')]);_0x1d9948['attributes']=_[_0x5925('0x45')](_0x2d704d[_0x5925('0x40')],qs[_0x5925('0x58')](_0x2683bc[_0x5925('0x42')][_0x5925('0x58')]));_0x1d9948['attributes']=_0x1d9948['attributes'][_0x5925('0x47')]?_0x1d9948[_0x5925('0x46')]:_0x2d704d[_0x5925('0x40')];_0x1d9948[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x2683bc[_0x5925('0x42')][_0x5925('0x4a')]);_0x1d9948[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x2683bc['query'],_0x2d704d[_0x5925('0x44')]));if(_0x2683bc[_0x5925('0x42')][_0x5925('0x4d')]){_0x1d9948[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x1d9948[_0x5925('0x4b')],{'$or':_[_0x5925('0x41')](_0x1d9948[_0x5925('0x46')],function(_0x5bb172){var _0x2227c3={};_0x2227c3[_0x5bb172]={'$like':'%'+_0x2683bc[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x2227c3;})});}_0x1d9948=_[_0x5925('0x4e')]({},_0x1d9948,_0x2683bc[_0x5925('0x50')]);return _0x52a759[_0x5925('0x7f')](_0x1d9948);}})[_0x5925('0x1d')](function(_0x390844){if(_0x390844){_0x3dbd0d=_0x390844[_0x5925('0x47')];if(!_0x2683bc[_0x5925('0x42')][_0x5925('0x66')](_0x5925('0x48'))){_0x1d9948[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x2683bc[_0x5925('0x42')]['limit']);_0x1d9948[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x2683bc[_0x5925('0x42')][_0x5925('0x28')]);}return _0x52a759[_0x5925('0x7f')](_0x1d9948);}})['then'](function(_0x154a34){if(_0x154a34){return _0x154a34?{'count':_0x3dbd0d,'rows':_0x154a34}:null;}})[_0x5925('0x1d')](respondWithResult(_0x49ef7f,null))[_0x5925('0x53')](handleError(_0x49ef7f,null));};exports['notify']=function(_0x60db3c,_0x186cc3,_0x12433c){var _0x17eff3={'channel':_0x5925('0x80')};var _0x3c2339=[];var _0xfc0d01=[];var _0x4878c1={};return db['WhatsappAccount']['find']({'where':{'id':_0x60db3c[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0x7b')],'as':_0x5925('0x81')}]})[_0x5925('0x1d')](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x5b4ce4){_0x17eff3[_0x5925('0x82')]=_0x5b4ce4;if(_0x17eff3['account']&&_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x83')&&_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')]){if(_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][_0x5925('0x47')]===0x0)return;if(_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][0x0][_0x5925('0x85')]!==_0x5925('0x86'))return;return db[_0x5925('0x87')][_0x5925('0x61')]({'read':!![],'readAt':_0x60db3c['body'][_0x5925('0x84')][0x0][_0x5925('0x88')]},{'where':{'messageId':_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x508211){return _0x186cc3[_0x5925('0x35')](0xc8)['json'](_0x508211);});}_0x17eff3[_0x5925('0x89')]=_[_0x5925('0x8a')](_0x5b4ce4[_0x5925('0x81')],[_0x5925('0x7d')],[_0x5925('0x8b')]);if(_0x17eff3[_0x5925('0x82')][_0x5925('0x81')]){delete _0x17eff3[_0x5925('0x82')][_0x5925('0x81')];}return db['CmContact']['describe']()['then'](function(_0x4ac0f2){if(!_0x4ac0f2){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0x8e'));}_0x3c2339=_['difference'](_[_0x5925('0x43')](_0x4ac0f2),['createdAt',_0x5925('0x8f')]);_0xfc0d01=_[_0x5925('0x90')](_[_0x5925('0x43')](_0x4ac0f2),[_0x5925('0x91'),_0x5925('0x8f'),'CompanyId',_0x5925('0x92')]);_0x17eff3['body']={'mapKey':_0x5925('0x93')};if(_0x17eff3[_0x5925('0x82')]&&_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x94')){_0x17eff3['body'][_0x5925('0x95')]=_0x60db3c[_0x5925('0x5a')]['From'][_0x5925('0x96')](_0x5925('0x97'),'');_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x98')];_0x17eff3[_0x5925('0x5a')][_0x5925('0x99')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x9a')];}if(_0x17eff3['account']&&_0x17eff3[_0x5925('0x82')]['type']==='sinch'){_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')]=_0x60db3c['body'][_0x5925('0x9b')][0x0][_0x5925('0x95')];_0x17eff3['body'][_0x5925('0x5a')]=_0x60db3c['body'][_0x5925('0x9b')][0x0][_0x5925('0x25')][_0x5925('0x5a')];_0x17eff3[_0x5925('0x5a')][_0x5925('0x99')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x9b')][0x0][_0x5925('0x9c')];}if(_0x17eff3[_0x5925('0x5a')]['id']){delete _0x17eff3[_0x5925('0x5a')]['id'];}if(_[_0x5925('0x9d')](_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0x9e'));}if(_[_0x5925('0x9d')](_0x17eff3[_0x5925('0x5a')]['body'])||_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')]===''){throw new db['Sequelize'][(_0x5925('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5925('0x9d')](_0x17eff3['body'][_0x5925('0x9f')])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0xa0')+_0xfc0d01);}if(!_[_0x5925('0xa1')](_0xfc0d01,_0x17eff3[_0x5925('0x5a')]['mapKey'])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0xa2')+_0xfc0d01);}_0x4878c1[_0x17eff3[_0x5925('0x5a')][_0x5925('0x9f')]]=_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')];return db[_0x5925('0xa3')][_0x5925('0x5e')]({'where':{'id':_0x17eff3[_0x5925('0x82')]['ListId']},'include':[{'model':db[_0x5925('0xa4')],'as':_0x5925('0xa5'),'where':_0x4878c1,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x5925('0x1d')](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x37531f){if(_0x37531f){_0x17eff3[_0x5925('0xa6')]=_[_0x5925('0xa7')](_0x37531f,[_0x5925('0xa5')]);if(_0x37531f[_0x5925('0xa5')][_0x5925('0x47')]){return _0x37531f[_0x5925('0xa5')][0x0];}var _0x4bb246=_[_0x5925('0xa8')](_0x17eff3[_0x5925('0x5a')],{'firstName':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'ListId':_0x37531f['id']});_0x4bb246[_0x17eff3[_0x5925('0x5a')][_0x5925('0x9f')]]=_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')];return db[_0x5925('0xa4')]['create'](_0x4bb246,{'fields':_0x3c2339,'raw':!![]});}})['then'](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x44e926){if(_0x44e926){_0x17eff3['contact']=_0x44e926;var _0x3a8c7b={'ContactId':_0x44e926['id'],'phone':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id']};var _0x5ceca5={'ContactId':_0x44e926['id'],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id'],'closed':![]};return db[_0x5925('0xa9')][_0x5925('0x5e')]({'where':_0x5ceca5})['then'](function(_0x1f87d8){if(_0x1f87d8){return[_0x1f87d8,![]];}return db[_0x5925('0xa9')][_0x5925('0x59')](_0x3a8c7b)['then'](function(_0xb3c7bd){return[_0xb3c7bd,!![]];});});}})[_0x5925('0xaa')](function(_0x40e62d,_0x46387e){_0x17eff3[_0x5925('0xab')]=_0x40e62d[_0x5925('0x32')]({'plain':!![]});_0x17eff3[_0x5925('0xab')]['created']=![];if(_0x46387e){if(_0x17eff3[_0x5925('0x82')][_0x5925('0xac')]){_0x17eff3[_0x5925('0x89')][_0x5925('0xad')]({'id':0x0,'priority':_0x17eff3[_0x5925('0x89')]['length']+0x1,'app':_0x5925('0xae'),'appdata':_0x5925('0xaf'),'interval':'*,*,*,*'});}_0x17eff3[_0x5925('0xab')]['created']=!![];}return db[_0x5925('0x87')][_0x5925('0x59')]({'phone':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'messageId':_0x17eff3['body'][_0x5925('0x99')],'body':_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id'],'WhatsappInteractionId':_0x40e62d['id'],'direction':'in','ContactId':_0x40e62d[_0x5925('0xb0')],'AttachmentId':_0x17eff3[_0x5925('0x5a')][_0x5925('0xb1')]});})[_0x5925('0x1d')](function(_0x37078c){_0x17eff3['message']=_0x37078c;if(_0x17eff3['interaction'][_0x5925('0xb2')]){return db[_0x5925('0x76')][_0x5925('0x5e')]({'attributes':['id','name'],'where':{'id':_0x17eff3[_0x5925('0xab')][_0x5925('0xb2')]}})[_0x5925('0x1d')](function(_0x414ede){if(_0x414ede){_0x17eff3[_0x5925('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5925('0xb3'),'appdata':_0x414ede[_0x5925('0x39')]+','+(_0x17eff3[_0x5925('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x5925('0xb4')});}return respondWithRpcPromise(_0x5925('0xb5'),_0x5925('0xb6'),_0x17eff3);});}return respondWithRpcPromise(_0x5925('0xb5'),_0x5925('0xb6'),_0x17eff3);})['then'](function(_0x3fcaad){if(_0x3fcaad){var _0x75587b=0xc8;var _0x59702e=_0x5925('0xb7');logger['info'](_0x5925('0x21'),_0x59702e,_0x75587b,_0x5925('0xb8'));logger[_0x5925('0xb9')](_0x5925('0xba'),_0x59702e,_0x75587b,_0x5925('0xb8'),JSON[_0x5925('0x22')](_0x3fcaad));if(_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x94')){return _0x186cc3['status'](_0x75587b)[_0x5925('0x2c')](_0x5925('0xbb'),'text/xml')[_0x5925('0x3a')](_0x5925('0xbc'));}else{return _0x186cc3[_0x5925('0x35')](_0x75587b)['json'](_0x3fcaad);}}});})['catch'](handleError(_0x186cc3,null));};exports['send']=function(_0x5cf0b7,_0x567c89,_0x29925a){var _0x470b3d,_0x221672,_0x1061c6;if(_['isNil'](_0x5cf0b7[_0x5925('0x5a')][_0x5925('0x5a')])||_0x5cf0b7['body'][_0x5925('0x5a')]===''){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5925('0x9d')](_0x5cf0b7[_0x5925('0x5a')]['to'])){throw new db['Sequelize'][(_0x5925('0x8d'))]('to\x20is\x20mandatory');}_0x470b3d=_0x5cf0b7[_0x5925('0x5a')]['to'];return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x5cf0b7[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0xa3')],'as':_0x5925('0xbd'),'include':[{'model':db[_0x5925('0xa4')],'as':_0x5925('0xa5'),'where':{'mobile':_0x470b3d},'limit':0x1,'order':[[_0x5925('0x8f'),_0x5925('0xbe')]]}]}]})[_0x5925('0x1d')](handleEntityNotFound(_0x567c89,null))[_0x5925('0x1d')](function(_0x22acb0){if(_0x22acb0&&_0x22acb0[_0x5925('0xbd')]){_0x221672=_0x22acb0[_0x5925('0x32')]({'plain':!![]});if(_0x221672['List']&&_0x221672[_0x5925('0xbd')][_0x5925('0xa5')][_0x5925('0x47')]){return _0x221672['List'][_0x5925('0xa5')][0x0];}return db[_0x5925('0xa4')][_0x5925('0x59')](_[_0x5925('0xa8')](_0x5cf0b7['body'],{'firstName':_0x470b3d,'mobile':_0x470b3d,'phone':_0x470b3d,'ListId':_0x221672[_0x5925('0x92')]}));}})['then'](handleEntityNotFound(_0x567c89,null))[_0x5925('0x1d')](function(_0xb07258){if(_0xb07258){_0x1061c6=_0xb07258;return db[_0x5925('0xa9')][_0x5925('0x5e')]({'where':{'ContactId':_0x1061c6['id'],'closed':![],'WhatsappAccountId':_0x221672['id']}})[_0x5925('0x1d')](function(_0x34a132){if(_0x34a132){return[_0x34a132,![]];}return db[_0x5925('0xa9')]['create']({'UserId':_0x5cf0b7[_0x5925('0x5b')]['id'],'ContactId':_0x1061c6['id'],'WhatsappAccountId':_0x221672['id'],'phone':_0x470b3d,'firstMsgDirection':_0x5925('0xbf'),'Messages':[_[_0x5925('0x4e')](_0x5cf0b7[_0x5925('0x5a')],{'read':![],'body':_0x5cf0b7[_0x5925('0x5a')][_0x5925('0x5a')],'phone':_0x470b3d,'WhatsappAccountId':_0x221672['id'],'UserId':_0x5cf0b7['user']['id'],'ContactId':_0x1061c6['id']})]},{'include':[{'model':db[_0x5925('0x87')],'as':_0x5925('0xc0')}]})[_0x5925('0x1d')](function(_0x23dd23){return[_0x23dd23,!![]];});});}})[_0x5925('0xaa')](function(_0x3af367,_0x261c4f){if(_0x261c4f){return _0x3af367;}return db[_0x5925('0x87')]['create'](_[_0x5925('0x4e')](_0x5cf0b7['body'],{'read':![],'body':_0x5cf0b7['body'][_0x5925('0x5a')],'phone':_0x470b3d,'WhatsappAccountId':_0x221672['id'],'WhatsappInteractionId':_0x3af367['id'],'UserId':_0x5cf0b7[_0x5925('0x5b')]['id'],'ContactId':_0x1061c6['id']}))[_0x5925('0x1d')](function(_0x370e90){_0x3af367['dataValues'][_0x5925('0xc0')]=[];_0x3af367[_0x5925('0xc1')][_0x5925('0xc0')]['push'](_0x370e90[_0x5925('0xc1')]);return _0x3af367;});})[_0x5925('0x1d')](respondWithResult(_0x567c89,null))[_0x5925('0x53')](handleError(_0x567c89,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8fc4939..ca1b1a3 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 _0xa5d7=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x24bf35,_0x5558a1){var _0x18cd7a=function(_0x1222da){while(--_0x1222da){_0x24bf35['push'](_0x24bf35['shift']());}};_0x18cd7a(++_0x5558a1);}(_0xa5d7,0x132));var _0x7a5d=function(_0x4355e3,_0x9d53d){_0x4355e3=_0x4355e3-0x0;var _0x5c4b64=_0xa5d7[_0x4355e3];return _0x5c4b64;};'use strict';var EventEmitter=require(_0x7a5d('0x0'));var WhatsappAccount=require(_0x7a5d('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a5d('0x2'),'afterUpdate':_0x7a5d('0x3'),'afterDestroy':_0x7a5d('0x4')};function emitEvent(_0x3cf542){return function(_0xa74061,_0x20168c,_0x295ebe){WhatsappAccountEvents[_0x7a5d('0x5')](_0x3cf542+':'+_0xa74061['id'],_0xa74061);WhatsappAccountEvents[_0x7a5d('0x5')](_0x3cf542,_0xa74061);_0x295ebe(null);};}for(var e in events){if(events[_0x7a5d('0x6')](e)){var event=events[e];WhatsappAccount[_0x7a5d('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xec12=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xec12,0xe0));var _0x2ec1=function(_0xa0c7ce,_0x1d353a){_0xa0c7ce=_0xa0c7ce-0x0;var _0xce382a=_0xec12[_0xa0c7ce];return _0xce382a;};'use strict';var EventEmitter=require(_0x2ec1('0x0'));var WhatsappAccount=require(_0x2ec1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2ec1('0x2')](0x0);var events={'afterCreate':_0x2ec1('0x3'),'afterUpdate':'update','afterDestroy':_0x2ec1('0x4')};function emitEvent(_0xd14b04){return function(_0x535930,_0x28edb7,_0x51e882){WhatsappAccountEvents[_0x2ec1('0x5')](_0xd14b04+':'+_0x535930['id'],_0x535930);WhatsappAccountEvents[_0x2ec1('0x5')](_0xd14b04,_0x535930);_0x51e882(null);};}for(var e in events){if(events[_0x2ec1('0x6')](e)){var event=events[e];WhatsappAccount[_0x2ec1('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c3405ab..d4be0d2 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 _0x43f2=['moment','bluebird','request-promise','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x3d8eb2,_0x5e58a3){var _0x1bb6bb=function(_0x1b540a){while(--_0x1b540a){_0x3d8eb2['push'](_0x3d8eb2['shift']());}};_0x1bb6bb(++_0x5e58a3);}(_0x43f2,0x86));var _0x243f=function(_0x11d07d,_0x58d27b){_0x11d07d=_0x11d07d-0x0;var _0x32aadf=_0x43f2[_0x11d07d];return _0x32aadf;};'use strict';var _=require('lodash');var util=require(_0x243f('0x0'));var logger=require(_0x243f('0x1'))('api');var moment=require(_0x243f('0x2'));var BPromise=require(_0x243f('0x3'));var rp=require(_0x243f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x243f('0x5'));module['exports']=function(_0x519676,_0x32932a){return _0x519676['define'](_0x243f('0x6'),attributes,{'tableName':_0x243f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd78=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x21514d,_0x107eb3){var _0x53d096=function(_0x2dcbae){while(--_0x2dcbae){_0x21514d['push'](_0x21514d['shift']());}};_0x53d096(++_0x107eb3);}(_0xcd78,0x128));var _0x8cd7=function(_0x3b02dd,_0x16847e){_0x3b02dd=_0x3b02dd-0x0;var _0x538563=_0xcd78[_0x3b02dd];return _0x538563;};'use strict';var _=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var logger=require(_0x8cd7('0x2'))(_0x8cd7('0x3'));var moment=require(_0x8cd7('0x4'));var BPromise=require(_0x8cd7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cd7('0x6'));var rimraf=require(_0x8cd7('0x7'));var config=require(_0x8cd7('0x8'));var attributes=require(_0x8cd7('0x9'));module[_0x8cd7('0xa')]=function(_0x1447e5,_0x1ebe76){return _0x1447e5[_0x8cd7('0xb')](_0x8cd7('0xc'),attributes,{'tableName':_0x8cd7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 218e8c9..854902c 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 _0x5525=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf537d5,_0x4a84ca){var _0x3dc3f0=function(_0x32a289){while(--_0x32a289){_0xf537d5['push'](_0xf537d5['shift']());}};_0x3dc3f0(++_0x4a84ca);}(_0x5525,0xd1));var _0x5552=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5525[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var moment=require(_0x5552('0x2'));var BPromise=require(_0x5552('0x3'));var rs=require(_0x5552('0x4'));var fs=require('fs');var Redis=require(_0x5552('0x5'));var db=require(_0x5552('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5552('0x7'))(_0x5552('0x8'));var config=require('../../config/environment');var jayson=require(_0x5552('0x9'));var client=jayson[_0x5552('0xa')][_0x5552('0xb')]({'port':0x232a});config[_0x5552('0xc')]=_[_0x5552('0xd')](config[_0x5552('0xc')],{'host':_0x5552('0xe'),'port':0x18eb});var socket=require(_0x5552('0xf'))(new Redis(config['redis']));require(_0x5552('0x10'))['register'](socket);function respondWithRpcPromise(_0x12880a,_0x4aaf71,_0x364d20){return new BPromise(function(_0x51075e,_0x47d924){return client[_0x5552('0x11')](_0x12880a,_0x364d20)['then'](function(_0x25b363){logger[_0x5552('0x12')](_0x5552('0x13'),_0x4aaf71,_0x5552('0x14'));logger[_0x5552('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4aaf71,_0x5552('0x14'),JSON['stringify'](_0x25b363));if(_0x25b363['error']){if(_0x25b363[_0x5552('0x16')][_0x5552('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4aaf71,_0x25b363[_0x5552('0x16')][_0x5552('0x18')]);return _0x47d924(_0x25b363[_0x5552('0x16')][_0x5552('0x18')]);}logger[_0x5552('0x16')](_0x5552('0x13'),_0x4aaf71,_0x25b363[_0x5552('0x16')][_0x5552('0x18')]);return _0x51075e(_0x25b363[_0x5552('0x16')]['message']);}else{logger[_0x5552('0x12')](_0x5552('0x13'),_0x4aaf71,'request\x20sent');_0x51075e(_0x25b363['result']['message']);}})[_0x5552('0x19')](function(_0x5b1642){logger['error'](_0x5552('0x13'),_0x4aaf71,_0x5b1642);_0x47d924(_0x5b1642);});});}exports[_0x5552('0x1a')]=function(_0x5d2adc){var _0x1210fb=this;return new Promise(function(_0x4d5abd,_0x321472){return db[_0x5552('0x1b')]['find']({'raw':_0x5d2adc['options']?_0x5d2adc[_0x5552('0x1c')][_0x5552('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d2adc[_0x5552('0x1c')]?_0x5d2adc[_0x5552('0x1c')][_0x5552('0x1e')]||null:null,'attributes':_0x5d2adc['options']?_0x5d2adc[_0x5552('0x1c')][_0x5552('0x1f')]||null:null,'include':_0x5d2adc[_0x5552('0x1c')]?_0x5d2adc[_0x5552('0x1c')][_0x5552('0x20')]?_[_0x5552('0x21')](_0x5d2adc[_0x5552('0x1c')][_0x5552('0x20')],function(_0xca52fb){return{'model':db[_0xca52fb[_0x5552('0x22')]],'as':_0xca52fb['as'],'attributes':_0xca52fb[_0x5552('0x1f')],'include':_0xca52fb[_0x5552('0x20')]?_[_0x5552('0x21')](_0xca52fb[_0x5552('0x20')],function(_0x34594e){return{'model':db[_0x34594e[_0x5552('0x22')]],'as':_0x34594e['as'],'attributes':_0x34594e[_0x5552('0x1f')],'include':_0x34594e['include']?_['map'](_0x34594e[_0x5552('0x20')],function(_0x26045b){return{'model':db[_0x26045b[_0x5552('0x22')]],'as':_0x26045b['as'],'attributes':_0x26045b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44c247){logger['info'](_0x5552('0x1a'),_0x5d2adc);logger[_0x5552('0x15')](_0x5552('0x1a'),_0x5d2adc,JSON[_0x5552('0x23')](_0x44c247));_0x4d5abd(_0x44c247);})[_0x5552('0x19')](function(_0xb3fc04){logger[_0x5552('0x16')](_0x5552('0x1a'),_0xb3fc04[_0x5552('0x18')],_0x5d2adc);_0x321472(_0x1210fb[_0x5552('0x16')](0x1f4,_0xb3fc04[_0x5552('0x18')]));});});}; \ No newline at end of file +var _0xccbd=['moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','where','include','map','model','attributes','ShowWhatsappAccount','lodash','util'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xccbd,0xb2));var _0xdccb=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xccbd[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xdccb('0x0'));var util=require(_0xdccb('0x1'));var moment=require(_0xdccb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdccb('0x3'));var db=require(_0xdccb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdccb('0x5'))(_0xdccb('0x6'));var config=require(_0xdccb('0x7'));var jayson=require(_0xdccb('0x8'));var client=jayson[_0xdccb('0x9')][_0xdccb('0xa')]({'port':0x232a});config[_0xdccb('0xb')]=_[_0xdccb('0xc')](config[_0xdccb('0xb')],{'host':_0xdccb('0xd'),'port':0x18eb});var socket=require(_0xdccb('0xe'))(new Redis(config[_0xdccb('0xb')]));require('./whatsappAccount.socket')[_0xdccb('0xf')](socket);function respondWithRpcPromise(_0x30b20b,_0x59d78a,_0x31e812){return new BPromise(function(_0x2fd7b5,_0x232379){return client['request'](_0x30b20b,_0x31e812)[_0xdccb('0x10')](function(_0x15cb8d){logger[_0xdccb('0x11')](_0xdccb('0x12'),_0x59d78a,_0xdccb('0x13'));logger[_0xdccb('0x14')](_0xdccb('0x15'),_0x59d78a,'request\x20sent',JSON[_0xdccb('0x16')](_0x15cb8d));if(_0x15cb8d[_0xdccb('0x17')]){if(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x18')]===0x1f4){logger[_0xdccb('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x59d78a,_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);return _0x232379(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);}logger[_0xdccb('0x17')](_0xdccb('0x12'),_0x59d78a,_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);return _0x2fd7b5(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);}else{logger['info'](_0xdccb('0x12'),_0x59d78a,'request\x20sent');_0x2fd7b5(_0x15cb8d[_0xdccb('0x1a')][_0xdccb('0x19')]);}})[_0xdccb('0x1b')](function(_0x2692b6){logger[_0xdccb('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x59d78a,_0x2692b6);_0x232379(_0x2692b6);});});}exports['ShowWhatsappAccount']=function(_0x59424a){var _0x2df28c=this;return new Promise(function(_0x30c705,_0x318bce){return db['WhatsappAccount'][_0xdccb('0x1c')]({'raw':_0x59424a['options']?_0x59424a['options']['raw']===undefined?!![]:![]:!![],'where':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')][_0xdccb('0x1e')]||null:null,'attributes':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')]['attributes']||null:null,'include':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')][_0xdccb('0x1f')]?_[_0xdccb('0x20')](_0x59424a[_0xdccb('0x1d')]['include'],function(_0x3a251d){return{'model':db[_0x3a251d[_0xdccb('0x21')]],'as':_0x3a251d['as'],'attributes':_0x3a251d[_0xdccb('0x22')],'include':_0x3a251d[_0xdccb('0x1f')]?_['map'](_0x3a251d[_0xdccb('0x1f')],function(_0x25d661){return{'model':db[_0x25d661[_0xdccb('0x21')]],'as':_0x25d661['as'],'attributes':_0x25d661['attributes'],'include':_0x25d661[_0xdccb('0x1f')]?_['map'](_0x25d661[_0xdccb('0x1f')],function(_0x5d22ce){return{'model':db[_0x5d22ce[_0xdccb('0x21')]],'as':_0x5d22ce['as'],'attributes':_0x5d22ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xdccb('0x10')](function(_0x5dd0d3){logger[_0xdccb('0x11')](_0xdccb('0x23'),_0x59424a);logger[_0xdccb('0x14')]('ShowWhatsappAccount',_0x59424a,JSON[_0xdccb('0x16')](_0x5dd0d3));_0x30c705(_0x5dd0d3);})[_0xdccb('0x1b')](function(_0x262532){logger[_0xdccb('0x17')]('ShowWhatsappAccount',_0x262532[_0xdccb('0x19')],_0x59424a);_0x318bce(_0x2df28c[_0xdccb('0x17')](0x1f4,_0x262532[_0xdccb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0c1d9eb..fb67955 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 _0xd76e=['save','remove','update','emit','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x143fa4,_0x1f132f){var _0x8d85da=function(_0x56db93){while(--_0x56db93){_0x143fa4['push'](_0x143fa4['shift']());}};_0x8d85da(++_0x1f132f);}(_0xd76e,0x10f));var _0xed76=function(_0x31b857,_0x111b11){_0x31b857=_0x31b857-0x0;var _0x36e27f=_0xd76e[_0x31b857];return _0x36e27f;};'use strict';var WhatsappAccountEvents=require(_0xed76('0x0'));var events=[_0xed76('0x1'),_0xed76('0x2'),_0xed76('0x3')];function createListener(_0x4d2115,_0x46fea6){return function(_0x62f252){_0x46fea6[_0xed76('0x4')](_0x4d2115,_0x62f252);};}function removeListener(_0xd861b8,_0x4e4578){return function(){WhatsappAccountEvents['removeListener'](_0xd861b8,_0x4e4578);};}exports[_0xed76('0x5')]=function(_0x3f7a01){for(var _0x3f229d=0x0,_0x1c53f7=events[_0xed76('0x6')];_0x3f229d<_0x1c53f7;_0x3f229d++){var _0x1f7863=events[_0x3f229d];var _0x30793e=createListener(_0xed76('0x7')+_0x1f7863,_0x3f7a01);WhatsappAccountEvents['on'](_0x1f7863,_0x30793e);}}; \ No newline at end of file +var _0x73a7=['register','./whatsappAccount.events','save','update','emit','removeListener'];(function(_0x2d978f,_0xc8b202){var _0x6ad24f=function(_0x4e191a){while(--_0x4e191a){_0x2d978f['push'](_0x2d978f['shift']());}};_0x6ad24f(++_0xc8b202);}(_0x73a7,0xa3));var _0x773a=function(_0x1d2e96,_0x158219){_0x1d2e96=_0x1d2e96-0x0;var _0x3d0b52=_0x73a7[_0x1d2e96];return _0x3d0b52;};'use strict';var WhatsappAccountEvents=require(_0x773a('0x0'));var events=[_0x773a('0x1'),'remove',_0x773a('0x2')];function createListener(_0x3414f4,_0xf6b2a1){return function(_0x3e4caa){_0xf6b2a1[_0x773a('0x3')](_0x3414f4,_0x3e4caa);};}function removeListener(_0x2799db,_0x2de5f0){return function(){WhatsappAccountEvents[_0x773a('0x4')](_0x2799db,_0x2de5f0);};}exports[_0x773a('0x5')]=function(_0x57cb66){for(var _0x5c87b3=0x0,_0x1a2969=events['length'];_0x5c87b3<_0x1a2969;_0x5c87b3++){var _0x44c4c0=events[_0x5c87b3];var _0x22b66e=createListener('whatsappAccount:'+_0x44c4c0,_0x57cb66);WhatsappAccountEvents['on'](_0x44c4c0,_0x22b66e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cc1f4a3..35609eb 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 _0xf2e1=['./whatsappApplication.controller','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2e1,0x13c));var _0x1f2e=function(_0x22e9b5,_0x10a2e0){_0x22e9b5=_0x22e9b5-0x0;var _0x4147e2=_0xf2e1[_0x22e9b5];return _0x4147e2;};'use strict';var multer=require(_0x1f2e('0x0'));var util=require(_0x1f2e('0x1'));var path=require('path');var timeout=require(_0x1f2e('0x2'));var express=require(_0x1f2e('0x3'));var router=express[_0x1f2e('0x4')]();var fs_extra=require(_0x1f2e('0x5'));var auth=require(_0x1f2e('0x6'));var interaction=require(_0x1f2e('0x7'));var config=require('../../config/environment');var controller=require(_0x1f2e('0x8'));router['get']('/',auth[_0x1f2e('0x9')](),controller[_0x1f2e('0xa')]);router['get'](_0x1f2e('0xb'),auth[_0x1f2e('0x9')](),controller[_0x1f2e('0xc')]);router[_0x1f2e('0xd')]('/',auth[_0x1f2e('0x9')](),controller['create']);router['put'](_0x1f2e('0xb'),auth[_0x1f2e('0x9')](),controller[_0x1f2e('0xe')]);router[_0x1f2e('0xf')](_0x1f2e('0xb'),auth[_0x1f2e('0x9')](),controller[_0x1f2e('0x10')]);module[_0x1f2e('0x11')]=router; \ No newline at end of file +var _0xbc86=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','post','isAuthenticated','create','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbc86,0x1e8));var _0x6bc8=function(_0x16691e,_0x239876){_0x16691e=_0x16691e-0x0;var _0xd391a5=_0xbc86[_0x16691e];return _0xd391a5;};'use strict';var multer=require('multer');var util=require(_0x6bc8('0x0'));var path=require('path');var timeout=require(_0x6bc8('0x1'));var express=require(_0x6bc8('0x2'));var router=express[_0x6bc8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bc8('0x4'));var interaction=require(_0x6bc8('0x5'));var config=require(_0x6bc8('0x6'));var controller=require(_0x6bc8('0x7'));router[_0x6bc8('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bc8('0x9')]);router[_0x6bc8('0x8')](_0x6bc8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6bc8('0xb')]('/',auth[_0x6bc8('0xc')](),controller[_0x6bc8('0xd')]);router[_0x6bc8('0xe')](_0x6bc8('0xa'),auth[_0x6bc8('0xc')](),controller[_0x6bc8('0xf')]);router[_0x6bc8('0x10')]('/:id',auth[_0x6bc8('0xc')](),controller[_0x6bc8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cebbe52..17b0400 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 _0x3e08=['*,*,*,*','INTEGER','STRING','TEXT'];(function(_0x1e9556,_0x22692e){var _0x3f4ab8=function(_0x2d46bd){while(--_0x2d46bd){_0x1e9556['push'](_0x1e9556['shift']());}};_0x3f4ab8(++_0x22692e);}(_0x3e08,0x13d));var _0x83e0=function(_0x32d330,_0xe907c8){_0x32d330=_0x32d330-0x0;var _0xe81a43=_0x3e08[_0x32d330];return _0xe81a43;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x83e0('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x83e0('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x83e0('0x2')]()},'description':{'type':Sequelize[_0x83e0('0x1')]},'interval':{'type':Sequelize[_0x83e0('0x1')],'defaultValue':_0x83e0('0x3')}}; \ No newline at end of file +var _0xfe52=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x1b0068,_0x320cdb){var _0x302827=function(_0x5137cb){while(--_0x5137cb){_0x1b0068['push'](_0x1b0068['shift']());}};_0x302827(++_0x320cdb);}(_0xfe52,0x93));var _0x2fe5=function(_0x541b3b,_0x2e058f){_0x541b3b=_0x541b3b-0x0;var _0x1d58e8=_0xfe52[_0x541b3b];return _0x1d58e8;};'use strict';var Sequelize=require(_0x2fe5('0x0'));module[_0x2fe5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2fe5('0x2')],'allowNull':![],'defaultValue':_0x2fe5('0x3')},'appdata':{'type':Sequelize[_0x2fe5('0x4')]()},'description':{'type':Sequelize[_0x2fe5('0x2')]},'interval':{'type':Sequelize[_0x2fe5('0x2')],'defaultValue':_0x2fe5('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 320939c..6f25ca1 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 _0xdf4d=['../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','WhatsappApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xdf4d,0xcb));var _0xddf4=function(_0x4d3154,_0x54f7d3){_0x4d3154=_0x4d3154-0x0;var _0x191f60=_0xdf4d[_0x4d3154];return _0x191f60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddf4('0x0'));var zipdir=require(_0xddf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddf4('0x2'));var moment=require(_0xddf4('0x3'));var BPromise=require(_0xddf4('0x4'));var Mustache=require(_0xddf4('0x5'));var util=require(_0xddf4('0x6'));var path=require(_0xddf4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xddf4('0x8'));var fs=require('fs');var fs_extra=require(_0xddf4('0x9'));var _=require(_0xddf4('0xa'));var squel=require(_0xddf4('0xb'));var crypto=require(_0xddf4('0xc'));var jsforce=require(_0xddf4('0xd'));var deskjs=require(_0xddf4('0xe'));var toCsv=require(_0xddf4('0xf'));var querystring=require(_0xddf4('0x10'));var Papa=require(_0xddf4('0x11'));var Redis=require(_0xddf4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xddf4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf4('0x14'));var logger=require(_0xddf4('0x15'))(_0xddf4('0x16'));var utils=require(_0xddf4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xddf4('0x18'));var db=require(_0xddf4('0x19'))['db'];function respondWithStatusCode(_0x4dba63,_0x3cd0ec){_0x3cd0ec=_0x3cd0ec||0xcc;return function(_0x4c4c26){if(_0x4c4c26){return _0x4dba63['sendStatus'](_0x3cd0ec);}return _0x4dba63[_0xddf4('0x1a')](_0x3cd0ec)['end']();};}function respondWithResult(_0x1d3773,_0x46316a){_0x46316a=_0x46316a||0xc8;return function(_0x3754f5){if(_0x3754f5){return _0x1d3773[_0xddf4('0x1a')](_0x46316a)[_0xddf4('0x1b')](_0x3754f5);}};}function respondWithFilteredResult(_0x48412e,_0x151b7b){return function(_0x5a8cba){if(_0x5a8cba){var _0x13c576=typeof _0x151b7b[_0xddf4('0x1c')]===_0xddf4('0x1d')&&typeof _0x151b7b[_0xddf4('0x1e')]===_0xddf4('0x1d');var _0x29ff35=_0x5a8cba[_0xddf4('0x1f')];var _0x4d76b1=_0x13c576?0x0:_0x151b7b['offset'];var _0x136036=_0x13c576?_0x5a8cba[_0xddf4('0x1f')]:_0x151b7b['offset']+_0x151b7b['limit'];var _0x5cb24f;if(_0x136036>=_0x29ff35){_0x136036=_0x29ff35;_0x5cb24f=0xc8;}else{_0x5cb24f=0xce;}_0x48412e[_0xddf4('0x1a')](_0x5cb24f);return _0x48412e[_0xddf4('0x20')](_0xddf4('0x21'),_0x4d76b1+'-'+_0x136036+'/'+_0x29ff35)[_0xddf4('0x1b')](_0x5a8cba);}return null;};}function patchUpdates(_0x39e4c4){return function(_0x56ec8f){try{jsonpatch[_0xddf4('0x22')](_0x56ec8f,_0x39e4c4,!![]);}catch(_0x5b1aee){return BPromise[_0xddf4('0x23')](_0x5b1aee);}return _0x56ec8f[_0xddf4('0x24')]();};}function saveUpdates(_0x3a2e57,_0x52d533){return function(_0x1f7a04){if(_0x1f7a04){return _0x1f7a04[_0xddf4('0x25')](_0x3a2e57)[_0xddf4('0x26')](function(_0x4ccad2){return _0x4ccad2;});}return null;};}function removeEntity(_0x2ee748,_0x2a195d){return function(_0x149a0e){if(_0x149a0e){return _0x149a0e[_0xddf4('0x27')]()[_0xddf4('0x26')](function(){_0x2ee748[_0xddf4('0x1a')](0xcc)[_0xddf4('0x28')]();});}};}function handleEntityNotFound(_0x898311,_0x44bb39){return function(_0x1757f6){if(!_0x1757f6){_0x898311[_0xddf4('0x29')](0x194);}return _0x1757f6;};}function handleError(_0x57474a,_0x2ab29c){_0x2ab29c=_0x2ab29c||0x1f4;return function(_0x4eff51){logger[_0xddf4('0x2a')](_0x4eff51[_0xddf4('0x2b')]);if(_0x4eff51[_0xddf4('0x2c')]){delete _0x4eff51[_0xddf4('0x2c')];}_0x57474a[_0xddf4('0x1a')](_0x2ab29c)[_0xddf4('0x2d')](_0x4eff51);};}exports[_0xddf4('0x2e')]=function(_0x1e8945,_0x2808fe){var _0x1c48bd={},_0x9143e0={},_0x5dca0b={'count':0x0,'rows':[]};var _0x575321=_['map'](db[_0xddf4('0x2f')]['rawAttributes'],function(_0xbcbbaa){return{'name':_0xbcbbaa[_0xddf4('0x30')],'type':_0xbcbbaa[_0xddf4('0x31')][_0xddf4('0x32')]};});_0x9143e0['model']=_['map'](_0x575321,_0xddf4('0x2c'));_0x9143e0[_0xddf4('0x33')]=_[_0xddf4('0x34')](_0x1e8945['query']);_0x9143e0[_0xddf4('0x35')]=_[_0xddf4('0x36')](_0x9143e0[_0xddf4('0x37')],_0x9143e0['query']);_0x1c48bd[_0xddf4('0x38')]=_[_0xddf4('0x36')](_0x9143e0['model'],qs['fields'](_0x1e8945[_0xddf4('0x33')]['fields']));_0x1c48bd[_0xddf4('0x38')]=_0x1c48bd[_0xddf4('0x38')]['length']?_0x1c48bd['attributes']:_0x9143e0[_0xddf4('0x37')];if(!_0x1e8945['query'][_0xddf4('0x39')](_0xddf4('0x3a'))){_0x1c48bd[_0xddf4('0x1e')]=qs[_0xddf4('0x1e')](_0x1e8945[_0xddf4('0x33')][_0xddf4('0x1e')]);_0x1c48bd[_0xddf4('0x1c')]=qs[_0xddf4('0x1c')](_0x1e8945[_0xddf4('0x33')][_0xddf4('0x1c')]);}_0x1c48bd['order']=qs[_0xddf4('0x3b')](_0x1e8945[_0xddf4('0x33')][_0xddf4('0x3b')]);_0x1c48bd[_0xddf4('0x3c')]=qs[_0xddf4('0x35')](_[_0xddf4('0x3d')](_0x1e8945[_0xddf4('0x33')],_0x9143e0[_0xddf4('0x35')]),_0x575321);if(_0x1e8945[_0xddf4('0x33')][_0xddf4('0x3e')]){_0x1c48bd[_0xddf4('0x3c')]=_[_0xddf4('0x3f')](_0x1c48bd[_0xddf4('0x3c')],{'$or':_['map'](_0x575321,function(_0x39107f){if(_0x39107f[_0xddf4('0x31')]!=='VIRTUAL'){var _0x2eb50d={};_0x2eb50d[_0x39107f[_0xddf4('0x2c')]]={'$like':'%'+_0x1e8945[_0xddf4('0x33')][_0xddf4('0x3e')]+'%'};return _0x2eb50d;}})});}_0x1c48bd=_[_0xddf4('0x3f')]({},_0x1c48bd,_0x1e8945[_0xddf4('0x40')]);var _0x1d434f={'where':_0x1c48bd[_0xddf4('0x3c')]};return db['WhatsappApplication'][_0xddf4('0x1f')](_0x1d434f)['then'](function(_0x4b93b2){_0x5dca0b[_0xddf4('0x1f')]=_0x4b93b2;if(_0x1e8945[_0xddf4('0x33')][_0xddf4('0x41')]){_0x1c48bd[_0xddf4('0x42')]=[{'all':!![]}];}return db[_0xddf4('0x2f')]['findAll'](_0x1c48bd);})[_0xddf4('0x26')](function(_0x1195d4){_0x5dca0b[_0xddf4('0x43')]=_0x1195d4;return _0x5dca0b;})[_0xddf4('0x26')](respondWithFilteredResult(_0x2808fe,_0x1c48bd))[_0xddf4('0x44')](handleError(_0x2808fe,null));};exports[_0xddf4('0x45')]=function(_0x286586,_0x41b8f5){var _0x9e8a3a={'raw':!![],'where':{'id':_0x286586[_0xddf4('0x46')]['id']}},_0x2f9588={};_0x2f9588[_0xddf4('0x37')]=_[_0xddf4('0x34')](db['WhatsappApplication'][_0xddf4('0x47')]);_0x2f9588[_0xddf4('0x33')]=_['keys'](_0x286586[_0xddf4('0x33')]);_0x2f9588[_0xddf4('0x35')]=_[_0xddf4('0x36')](_0x2f9588[_0xddf4('0x37')],_0x2f9588[_0xddf4('0x33')]);_0x9e8a3a[_0xddf4('0x38')]=_[_0xddf4('0x36')](_0x2f9588[_0xddf4('0x37')],qs[_0xddf4('0x48')](_0x286586[_0xddf4('0x33')][_0xddf4('0x48')]));_0x9e8a3a[_0xddf4('0x38')]=_0x9e8a3a['attributes']['length']?_0x9e8a3a[_0xddf4('0x38')]:_0x2f9588[_0xddf4('0x37')];if(_0x286586[_0xddf4('0x33')][_0xddf4('0x41')]){_0x9e8a3a[_0xddf4('0x42')]=[{'all':!![]}];}_0x9e8a3a=_[_0xddf4('0x3f')]({},_0x9e8a3a,_0x286586['options']);return db[_0xddf4('0x2f')][_0xddf4('0x49')](_0x9e8a3a)['then'](handleEntityNotFound(_0x41b8f5,null))[_0xddf4('0x26')](respondWithResult(_0x41b8f5,null))[_0xddf4('0x44')](handleError(_0x41b8f5,null));};exports[_0xddf4('0x4a')]=function(_0x5bd40d,_0x4e88a7){return db[_0xddf4('0x2f')][_0xddf4('0x4a')](_0x5bd40d['body'],{})['then'](respondWithResult(_0x4e88a7,0xc9))[_0xddf4('0x44')](handleError(_0x4e88a7,null));};exports['update']=function(_0x288c8a,_0x27b30a){if(_0x288c8a[_0xddf4('0x4b')]['id']){delete _0x288c8a[_0xddf4('0x4b')]['id'];}return db['WhatsappApplication'][_0xddf4('0x49')]({'where':{'id':_0x288c8a[_0xddf4('0x46')]['id']}})['then'](handleEntityNotFound(_0x27b30a,null))[_0xddf4('0x26')](saveUpdates(_0x288c8a['body'],null))[_0xddf4('0x26')](respondWithResult(_0x27b30a,null))[_0xddf4('0x44')](handleError(_0x27b30a,null));};exports[_0xddf4('0x27')]=function(_0x530e84,_0x29b2a8){return db['WhatsappApplication'][_0xddf4('0x49')]({'where':{'id':_0x530e84['params']['id']}})[_0xddf4('0x26')](handleEntityNotFound(_0x29b2a8,null))[_0xddf4('0x26')](removeEntity(_0x29b2a8,null))[_0xddf4('0x44')](handleError(_0x29b2a8,null));}; \ No newline at end of file +var _0x20de=['keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','then','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','key','model','map','query'];(function(_0x418908,_0x25a375){var _0x8db3b4=function(_0x2b2ead){while(--_0x2b2ead){_0x418908['push'](_0x418908['shift']());}};_0x8db3b4(++_0x25a375);}(_0x20de,0x134));var _0xe20d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x20de[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0xe20d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x1'));var jsonpatch=require(_0xe20d('0x2'));var rp=require(_0xe20d('0x3'));var moment=require(_0xe20d('0x4'));var BPromise=require(_0xe20d('0x5'));var Mustache=require(_0xe20d('0x6'));var util=require(_0xe20d('0x7'));var path=require(_0xe20d('0x8'));var sox=require(_0xe20d('0x9'));var csv=require(_0xe20d('0xa'));var ejs=require(_0xe20d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe20d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe20d('0xd'));var toCsv=require(_0xe20d('0xa'));var querystring=require(_0xe20d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe20d('0xf'));var authService=require(_0xe20d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe20d('0x11'));var hardwareService=require(_0xe20d('0x12'));var logger=require('../../config/logger')(_0xe20d('0x13'));var utils=require(_0xe20d('0x14'));var config=require(_0xe20d('0x15'));var licenseUtil=require(_0xe20d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a581,_0x28d9c5){_0x28d9c5=_0x28d9c5||0xcc;return function(_0xdc395e){if(_0xdc395e){return _0x59a581[_0xe20d('0x17')](_0x28d9c5);}return _0x59a581[_0xe20d('0x18')](_0x28d9c5)[_0xe20d('0x19')]();};}function respondWithResult(_0x26f1dd,_0x2e8b2b){_0x2e8b2b=_0x2e8b2b||0xc8;return function(_0x2e0fff){if(_0x2e0fff){return _0x26f1dd[_0xe20d('0x18')](_0x2e8b2b)['json'](_0x2e0fff);}};}function respondWithFilteredResult(_0x2367f7,_0x4a3576){return function(_0x42e8e4){if(_0x42e8e4){var _0x3aa19d=typeof _0x4a3576[_0xe20d('0x1a')]==='undefined'&&typeof _0x4a3576[_0xe20d('0x1b')]==='undefined';var _0x1738d9=_0x42e8e4[_0xe20d('0x1c')];var _0x285916=_0x3aa19d?0x0:_0x4a3576['offset'];var _0x4353cb=_0x3aa19d?_0x42e8e4[_0xe20d('0x1c')]:_0x4a3576[_0xe20d('0x1a')]+_0x4a3576[_0xe20d('0x1b')];var _0x5d93da;if(_0x4353cb>=_0x1738d9){_0x4353cb=_0x1738d9;_0x5d93da=0xc8;}else{_0x5d93da=0xce;}_0x2367f7[_0xe20d('0x18')](_0x5d93da);return _0x2367f7[_0xe20d('0x1d')](_0xe20d('0x1e'),_0x285916+'-'+_0x4353cb+'/'+_0x1738d9)[_0xe20d('0x1f')](_0x42e8e4);}return null;};}function patchUpdates(_0x48577c){return function(_0x1b4151){try{jsonpatch['apply'](_0x1b4151,_0x48577c,!![]);}catch(_0x4ac635){return BPromise[_0xe20d('0x20')](_0x4ac635);}return _0x1b4151[_0xe20d('0x21')]();};}function saveUpdates(_0x4baa28,_0x5e7237){return function(_0x1552d8){if(_0x1552d8){return _0x1552d8[_0xe20d('0x22')](_0x4baa28)['then'](function(_0x20b62b){return _0x20b62b;});}return null;};}function removeEntity(_0x3fc8b0,_0x3f0227){return function(_0x3b962f){if(_0x3b962f){return _0x3b962f[_0xe20d('0x23')]()['then'](function(){_0x3fc8b0[_0xe20d('0x18')](0xcc)[_0xe20d('0x19')]();});}};}function handleEntityNotFound(_0x1a76bc,_0x4504ee){return function(_0x21a53a){if(!_0x21a53a){_0x1a76bc['sendStatus'](0x194);}return _0x21a53a;};}function handleError(_0x5f1626,_0x27b759){_0x27b759=_0x27b759||0x1f4;return function(_0x497726){logger[_0xe20d('0x24')](_0x497726[_0xe20d('0x25')]);if(_0x497726[_0xe20d('0x26')]){delete _0x497726[_0xe20d('0x26')];}_0x5f1626[_0xe20d('0x18')](_0x27b759)[_0xe20d('0x27')](_0x497726);};}exports[_0xe20d('0x28')]=function(_0x59d416,_0x8b7386){var _0x5ecc55={},_0x555eb5={},_0x514891={'count':0x0,'rows':[]};var _0x58cad3=_['map'](db[_0xe20d('0x29')][_0xe20d('0x2a')],function(_0x41e140){return{'name':_0x41e140['fieldName'],'type':_0x41e140['type'][_0xe20d('0x2b')]};});_0x555eb5[_0xe20d('0x2c')]=_[_0xe20d('0x2d')](_0x58cad3,_0xe20d('0x26'));_0x555eb5[_0xe20d('0x2e')]=_[_0xe20d('0x2f')](_0x59d416[_0xe20d('0x2e')]);_0x555eb5[_0xe20d('0x30')]=_['intersection'](_0x555eb5[_0xe20d('0x2c')],_0x555eb5['query']);_0x5ecc55['attributes']=_[_0xe20d('0x31')](_0x555eb5['model'],qs[_0xe20d('0x32')](_0x59d416[_0xe20d('0x2e')]['fields']));_0x5ecc55['attributes']=_0x5ecc55['attributes'][_0xe20d('0x33')]?_0x5ecc55[_0xe20d('0x34')]:_0x555eb5[_0xe20d('0x2c')];if(!_0x59d416[_0xe20d('0x2e')][_0xe20d('0x35')](_0xe20d('0x36'))){_0x5ecc55['limit']=qs[_0xe20d('0x1b')](_0x59d416[_0xe20d('0x2e')][_0xe20d('0x1b')]);_0x5ecc55[_0xe20d('0x1a')]=qs['offset'](_0x59d416[_0xe20d('0x2e')][_0xe20d('0x1a')]);}_0x5ecc55[_0xe20d('0x37')]=qs[_0xe20d('0x38')](_0x59d416['query']['sort']);_0x5ecc55[_0xe20d('0x39')]=qs[_0xe20d('0x30')](_['pick'](_0x59d416[_0xe20d('0x2e')],_0x555eb5[_0xe20d('0x30')]),_0x58cad3);if(_0x59d416[_0xe20d('0x2e')][_0xe20d('0x3a')]){_0x5ecc55[_0xe20d('0x39')]=_[_0xe20d('0x3b')](_0x5ecc55[_0xe20d('0x39')],{'$or':_[_0xe20d('0x2d')](_0x58cad3,function(_0x548301){if(_0x548301['type']!=='VIRTUAL'){var _0x1733e3={};_0x1733e3[_0x548301[_0xe20d('0x26')]]={'$like':'%'+_0x59d416['query'][_0xe20d('0x3a')]+'%'};return _0x1733e3;}})});}_0x5ecc55=_[_0xe20d('0x3b')]({},_0x5ecc55,_0x59d416['options']);var _0x589980={'where':_0x5ecc55[_0xe20d('0x39')]};return db['WhatsappApplication'][_0xe20d('0x1c')](_0x589980)['then'](function(_0x1d5e89){_0x514891[_0xe20d('0x1c')]=_0x1d5e89;if(_0x59d416['query'][_0xe20d('0x3c')]){_0x5ecc55[_0xe20d('0x3d')]=[{'all':!![]}];}return db[_0xe20d('0x29')]['findAll'](_0x5ecc55);})[_0xe20d('0x3e')](function(_0x26958c){_0x514891[_0xe20d('0x3f')]=_0x26958c;return _0x514891;})[_0xe20d('0x3e')](respondWithFilteredResult(_0x8b7386,_0x5ecc55))[_0xe20d('0x40')](handleError(_0x8b7386,null));};exports[_0xe20d('0x41')]=function(_0x201954,_0x340c88){var _0x1770f4={'raw':!![],'where':{'id':_0x201954[_0xe20d('0x42')]['id']}},_0x47b5b5={};_0x47b5b5['model']=_[_0xe20d('0x2f')](db[_0xe20d('0x29')][_0xe20d('0x2a')]);_0x47b5b5[_0xe20d('0x2e')]=_[_0xe20d('0x2f')](_0x201954['query']);_0x47b5b5[_0xe20d('0x30')]=_[_0xe20d('0x31')](_0x47b5b5[_0xe20d('0x2c')],_0x47b5b5[_0xe20d('0x2e')]);_0x1770f4[_0xe20d('0x34')]=_[_0xe20d('0x31')](_0x47b5b5['model'],qs[_0xe20d('0x32')](_0x201954[_0xe20d('0x2e')][_0xe20d('0x32')]));_0x1770f4[_0xe20d('0x34')]=_0x1770f4[_0xe20d('0x34')]['length']?_0x1770f4[_0xe20d('0x34')]:_0x47b5b5[_0xe20d('0x2c')];if(_0x201954[_0xe20d('0x2e')]['includeAll']){_0x1770f4['include']=[{'all':!![]}];}_0x1770f4=_[_0xe20d('0x3b')]({},_0x1770f4,_0x201954[_0xe20d('0x43')]);return db[_0xe20d('0x29')][_0xe20d('0x44')](_0x1770f4)[_0xe20d('0x3e')](handleEntityNotFound(_0x340c88,null))[_0xe20d('0x3e')](respondWithResult(_0x340c88,null))[_0xe20d('0x40')](handleError(_0x340c88,null));};exports[_0xe20d('0x45')]=function(_0x1f37c1,_0x5dc2e1){return db[_0xe20d('0x29')][_0xe20d('0x45')](_0x1f37c1[_0xe20d('0x46')],{})[_0xe20d('0x3e')](respondWithResult(_0x5dc2e1,0xc9))[_0xe20d('0x40')](handleError(_0x5dc2e1,null));};exports[_0xe20d('0x22')]=function(_0x4279b4,_0x510d50){if(_0x4279b4[_0xe20d('0x46')]['id']){delete _0x4279b4[_0xe20d('0x46')]['id'];}return db[_0xe20d('0x29')]['find']({'where':{'id':_0x4279b4[_0xe20d('0x42')]['id']}})[_0xe20d('0x3e')](handleEntityNotFound(_0x510d50,null))['then'](saveUpdates(_0x4279b4[_0xe20d('0x46')],null))[_0xe20d('0x3e')](respondWithResult(_0x510d50,null))[_0xe20d('0x40')](handleError(_0x510d50,null));};exports[_0xe20d('0x23')]=function(_0x23a586,_0x317a0d){return db[_0xe20d('0x29')][_0xe20d('0x44')]({'where':{'id':_0x23a586[_0xe20d('0x42')]['id']}})[_0xe20d('0x3e')](handleEntityNotFound(_0x317a0d,null))['then'](removeEntity(_0x317a0d,null))[_0xe20d('0x40')](handleError(_0x317a0d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a4dc800..2f4502c 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 _0x3e25=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x3e25,0x14f));var _0x53e2=function(_0x1c24a5,_0x48a2c0){_0x1c24a5=_0x1c24a5-0x0;var _0x77fc32=_0x3e25[_0x1c24a5];return _0x77fc32;};'use strict';var _=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var logger=require(_0x53e2('0x2'))('api');var moment=require(_0x53e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x53e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53e2('0x5'));var config=require(_0x53e2('0x6'));var attributes=require(_0x53e2('0x7'));module[_0x53e2('0x8')]=function(_0x11ad7a,_0x14b22c){return _0x11ad7a[_0x53e2('0x9')](_0x53e2('0xa'),attributes,{'tableName':_0x53e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53e2('0xc'),'collate':_0x53e2('0xd')});}; \ No newline at end of file +var _0x57d4=['exports','WhatsappApplication','whatsapp_applications','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x35a4f3,_0x297ce0){var _0x29d8c5=function(_0x45536e){while(--_0x45536e){_0x35a4f3['push'](_0x35a4f3['shift']());}};_0x29d8c5(++_0x297ce0);}(_0x57d4,0x78));var _0x457d=function(_0x19677f,_0x518fe1){_0x19677f=_0x19677f-0x0;var _0x1fe914=_0x57d4[_0x19677f];return _0x1fe914;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'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 b774b5b..ac4f71b 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x396d71,_0x5b97c8){var _0x11615a=function(_0x1f1788){while(--_0x1f1788){_0x396d71['push'](_0x396d71['shift']());}};_0x11615a(++_0x5b97c8);}(_0xe14d,0x1ee));var _0xde14=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xe14d[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a5ac7,_0x519dc0){var _0x58e002=function(_0x545e90){while(--_0x545e90){_0x1a5ac7['push'](_0x1a5ac7['shift']());}};_0x58e002(++_0x519dc0);}(_0x98a8,0x12c));var _0x898a=function(_0x2a1594,_0x399b25){_0x2a1594=_0x2a1594-0x0;var _0xb12ae=_0x98a8[_0x2a1594];return _0xb12ae;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index aa4e9ed..4fb1947 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 _0x1b20=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','update','delete','destroy','removeTags','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages'];(function(_0x589d2f,_0x310ae9){var _0x1a96e8=function(_0x426102){while(--_0x426102){_0x589d2f['push'](_0x589d2f['shift']());}};_0x1a96e8(++_0x310ae9);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['describe']);router[_0x01b2('0x8')]('/:id',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0x8')](_0x01b2('0xd'),auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0x8')](_0x01b2('0xf'),auth['isAuthenticated'](),controller[_0x01b2('0x10')]);router['post']('/',auth[_0x01b2('0x9')](),controller['create']);router[_0x01b2('0x11')](_0x01b2('0xd'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x12')]);router['post'](_0x01b2('0x13'),auth[_0x01b2('0x9')](),interaction[_0x01b2('0x14')](_0x01b2('0x15'),_0x01b2('0x16')),controller['addTags']);router[_0x01b2('0x17')](_0x01b2('0x18'),auth[_0x01b2('0x9')](),interaction[_0x01b2('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x01b2('0x19')]);router[_0x01b2('0x1a')]('/:id',auth[_0x01b2('0x9')](),interaction[_0x01b2('0x14')](_0x01b2('0x15'),'whatsappinteraction:destroy'),controller[_0x01b2('0x1b')]);router[_0x01b2('0x1a')](_0x01b2('0x13'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xda19,0xd5));var _0x9da1=function(_0x16f3df,_0x3ae995){_0x16f3df=_0x16f3df-0x0;var _0x3787c7=_0xda19[_0x16f3df];return _0x3787c7;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c6e6a7b..953c162 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 _0x9206=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9206,0x176));var _0x6920=function(_0x324a2b,_0xfcb1ac){_0x324a2b=_0x324a2b-0x0;var _0x27394f=_0x9206[_0x324a2b];return _0x27394f;};'use strict';var Sequelize=require(_0x6920('0x0'));var moment=require(_0x6920('0x1'));module[_0x6920('0x2')]={'closed':{'type':Sequelize[_0x6920('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6920('0x4')]},'disposition':{'type':Sequelize[_0x6920('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6920('0x5')]},'phone':{'type':Sequelize[_0x6920('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6920('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6920('0x7')]('in',_0x6920('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6920('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8585=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x22ee1a,_0x2fd5c9){var _0x15715d=function(_0x419004){while(--_0x419004){_0x22ee1a['push'](_0x22ee1a['shift']());}};_0x15715d(++_0x2fd5c9);}(_0x8585,0x64));var _0x5858=function(_0x69e19d,_0x25568c){_0x69e19d=_0x69e19d-0x0;var _0x4095e2=_0x8585[_0x69e19d];return _0x4095e2;};'use strict';var Sequelize=require(_0x5858('0x0'));var moment=require(_0x5858('0x1'));module[_0x5858('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5858('0x3')]},'disposition':{'type':Sequelize[_0x5858('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5858('0x4')]},'read1stAt':{'type':Sequelize[_0x5858('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5858('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5858('0x5')]('in',_0x5858('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0463148..33d8c6c 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 _0x430c=['waiting','talking','answered','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','i.id','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','keys','includeAll','options','create','destroy','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closedAt','disposition','createReadStream','pipe','out','basename','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch'];(function(_0x1c75ab,_0x70010c){var _0x1ad75f=function(_0x559dbd){while(--_0x559dbd){_0x1c75ab['push'](_0x1c75ab['shift']());}};_0x1ad75f(++_0x70010c);}(_0x430c,0x1a1));var _0xc430=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x430c[_0x257495];return _0x3849aa;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var pdf=require(_0xc430('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc430('0x11'))('api');var utils=require(_0xc430('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc430('0x13'));var db=require(_0xc430('0x14'))['db'];config[_0xc430('0x15')]=_[_0xc430('0x16')](config[_0xc430('0x15')],{'host':_0xc430('0x17'),'port':0x18eb});var socket=require(_0xc430('0x18'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xc430('0x19')](socket);function respondWithStatusCode(_0x10e6a6,_0x17d5c8){_0x17d5c8=_0x17d5c8||0xcc;return function(_0x2ef538){if(_0x2ef538){return _0x10e6a6[_0xc430('0x1a')](_0x17d5c8);}return _0x10e6a6['status'](_0x17d5c8)[_0xc430('0x1b')]();};}function respondWithResult(_0x4aeb72,_0x4bf91f){_0x4bf91f=_0x4bf91f||0xc8;return function(_0x2e7987){if(_0x2e7987){return _0x4aeb72[_0xc430('0x1c')](_0x4bf91f)[_0xc430('0x1d')](_0x2e7987);}};}function respondWithFilteredResult(_0x5830b0,_0x5d3acc){return function(_0x36d112){if(_0x36d112){var _0x4c1937=typeof _0x5d3acc[_0xc430('0x1e')]==='undefined'&&typeof _0x5d3acc['limit']===_0xc430('0x1f');var _0x59b68f=_0x36d112[_0xc430('0x20')];var _0x1eae3b=_0x4c1937?0x0:_0x5d3acc[_0xc430('0x1e')];var _0x1f90bb=_0x4c1937?_0x36d112[_0xc430('0x20')]:_0x5d3acc['offset']+_0x5d3acc[_0xc430('0x21')];var _0x4d9dbf;if(_0x1f90bb>=_0x59b68f){_0x1f90bb=_0x59b68f;_0x4d9dbf=0xc8;}else{_0x4d9dbf=0xce;}_0x5830b0['status'](_0x4d9dbf);return _0x5830b0[_0xc430('0x22')](_0xc430('0x23'),_0x1eae3b+'-'+_0x1f90bb+'/'+_0x59b68f)[_0xc430('0x1d')](_0x36d112);}return null;};}function patchUpdates(_0x56dd16){return function(_0x3fd56b){try{jsonpatch['apply'](_0x3fd56b,_0x56dd16,!![]);}catch(_0x23425d){return BPromise[_0xc430('0x24')](_0x23425d);}return _0x3fd56b['save']();};}function saveUpdates(_0x31b4f1,_0x3cdbd3){return function(_0x48f67a){if(_0x48f67a){return _0x48f67a[_0xc430('0x25')](_0x31b4f1)['then'](function(_0x3aa85e){return _0x3aa85e;});}return null;};}function removeEntity(_0x4b5280,_0x3db397){return function(_0x21e28a){if(_0x21e28a){return _0x21e28a['destroy']()[_0xc430('0x26')](function(){_0x4b5280[_0xc430('0x1c')](0xcc)[_0xc430('0x1b')]();});}};}function handleEntityNotFound(_0x44833e,_0x285407){return function(_0x57cd72){if(!_0x57cd72){_0x44833e[_0xc430('0x1a')](0x194);}return _0x57cd72;};}function handleError(_0x1a9512,_0x1c1da9){_0x1c1da9=_0x1c1da9||0x1f4;return function(_0x1591e3){logger['error'](_0x1591e3[_0xc430('0x27')]);if(_0x1591e3['name']){delete _0x1591e3[_0xc430('0x28')];}_0x1a9512['status'](_0x1c1da9)[_0xc430('0x29')](_0x1591e3);};}function getInteractionUsers(_0x1045c0,_0xfc8767){return new BPromise(function(_0x3d7ccf,_0x49977b){try{if(_0xfc8767[_0x1045c0['id']]){_0x1045c0[_0xc430('0x2a')]=_[_0xc430('0x2b')](_0xfc8767[_0x1045c0['id']],function(_0x2bdfc4){return{'id':_0x2bdfc4['id'],'fullname':_0x2bdfc4[_0xc430('0x2c')]};});}}catch(_0x49ba65){_0x49977b(_0x49ba65);}_0x3d7ccf(_0x1045c0);});}function getInteractionTags(_0xfcc12c,_0x39c17f){return new BPromise(function(_0x47fe5a,_0x8b71f){try{if(_0xfcc12c['TagIds']){_0xfcc12c['Tags']=[];_0xfcc12c[_0xc430('0x2d')][_0xc430('0x2e')](',')[_0xc430('0x2f')](function(_0x476c12){_0xfcc12c[_0xc430('0x30')][_0xc430('0x31')](_0x39c17f[_0x476c12]);});}delete _0xfcc12c[_0xc430('0x2d')];}catch(_0x25a81d){_0x8b71f(_0x25a81d);}_0x47fe5a(_0xfcc12c);});}function updateWhatsappInteraction(_0x47da0d,_0x442d20,_0x4c7fc8){return new BPromise(function(_0x119bee,_0x43029d){return getInteractionUsers(_0x47da0d,_0x4c7fc8)[_0xc430('0x26')](function(_0x44ca3e){return getInteractionTags(_0x44ca3e,_0x442d20);})['then'](function(_0x2848ae){return getStateInteraction(_0x2848ae);})['then'](function(_0x517d2b){_0x119bee(_0x517d2b);})[_0xc430('0x32')](function(_0x3ebdc0){_0x43029d(_0x3ebdc0);});});}function getStateInteraction(_0x521793){return new BPromise(function(_0x5ff73c){_0x521793[_0xc430('0x33')]=0x0;_0x521793[_0xc430('0x34')]=0x0;_0x521793[_0xc430('0x35')]=0x0;_0x521793[_0xc430('0x36')]=0x0;_0x521793[_0xc430('0x37')]=0x0;if(!_0x521793[_0xc430('0x38')]&&!_0x521793[_0xc430('0x39')]){_0x521793[_0xc430('0x33')]+=0x1;}if(!_0x521793[_0xc430('0x38')]&&_0x521793[_0xc430('0x39')]){_0x521793[_0xc430('0x34')]+=0x1;if(_0x521793[_0xc430('0x33')]){_0x521793[_0xc430('0x33')]-=0x1;}}if(_0x521793[_0xc430('0x38')]&&_0x521793['UserId']){_0x521793[_0xc430('0x35')]+=0x1;if(_0x521793[_0xc430('0x34')]){_0x521793[_0xc430('0x34')]-=0x1;}}if(_0x521793[_0xc430('0x38')]&&!_0x521793['UserId']){_0x521793[_0xc430('0x36')]+=0x1;if(_0x521793[_0xc430('0x33')]){_0x521793[_0xc430('0x33')]-=0x1;}}_0x521793[_0xc430('0x37')]+=0x1;_0x5ff73c(_0x521793);});}exports[_0xc430('0x3a')]=function(_0x393f49,_0x52b1a7){var _0xa93ed0={},_0x348f2f={},_0x131e88={'count':0x0,'rows':[]};var _0x1efaf5=_[_0xc430('0x2b')](db[_0xc430('0x3b')][_0xc430('0x3c')],function(_0x2cde1e){return{'name':_0x2cde1e[_0xc430('0x3d')],'type':_0x2cde1e[_0xc430('0x3e')][_0xc430('0x3f')]};});_0x348f2f[_0xc430('0x40')]=_[_0xc430('0x2b')](_0x1efaf5,_0xc430('0x28'));_0x348f2f['query']=_['keys'](_0x393f49['query']);_0x348f2f[_0xc430('0x41')]=_[_0xc430('0x42')](_0x348f2f[_0xc430('0x40')],_0x348f2f[_0xc430('0x43')]);_0xa93ed0[_0xc430('0x44')]=_[_0xc430('0x42')](_0x348f2f[_0xc430('0x40')],qs[_0xc430('0x45')](_0x393f49[_0xc430('0x43')][_0xc430('0x45')]));_0xa93ed0[_0xc430('0x44')]=_0xa93ed0[_0xc430('0x44')][_0xc430('0x46')]?_0xa93ed0[_0xc430('0x44')]:_0x348f2f[_0xc430('0x40')];if(!_0x393f49[_0xc430('0x43')]['hasOwnProperty'](_0xc430('0x47'))){_0xa93ed0[_0xc430('0x21')]=qs[_0xc430('0x21')](_0x393f49[_0xc430('0x43')][_0xc430('0x21')]);_0xa93ed0[_0xc430('0x1e')]=qs[_0xc430('0x1e')](_0x393f49[_0xc430('0x43')]['offset']);}_0xa93ed0[_0xc430('0x48')]=qs['sort'](_0x393f49[_0xc430('0x43')][_0xc430('0x49')]);_0xa93ed0['where']=qs['filters'](_[_0xc430('0x4a')](_0x393f49['query'],_0x348f2f['filters']),_0x1efaf5);var _0x10db27=[];var _0x4eafae=squel[_0xc430('0x4b')]()[_0xc430('0x4c')]('id')[_0xc430('0x4c')]('name')[_0xc430('0x4c')](_0xc430('0x4d'))[_0xc430('0x4e')]('tools_tags');var _0x34fd8c=squel[_0xc430('0x4b')]()[_0xc430('0x4c')](_0xc430('0x4f'))[_0xc430('0x4c')](_0xc430('0x50'))[_0xc430('0x4c')]('ui.WhatsappInteractionId')[_0xc430('0x4e')](_0xc430('0x51'),'ui')[_0xc430('0x52')]('users','u',_0xc430('0x53'));var _0x4178d7=squel[_0xc430('0x4b')]()[_0xc430('0x4e')]('whatsapp_interactions','i')[_0xc430('0x52')]('cm_contacts','c',_0xc430('0x54'))[_0xc430('0x52')](_0xc430('0x55'),'o',_0xc430('0x56'))[_0xc430('0x52')](_0xc430('0x57'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xc430('0x52')](_0xc430('0x58'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xc430('0x52')](_0xc430('0x59'),'it',_0xc430('0x5a'))[_0xc430('0x52')]('tools_tags','t',_0xc430('0x5b'));var _0x493576=squel[_0xc430('0x5c')]();var _0x322835=[];var _0x2ea527=squel[_0xc430('0x5c')]();var _0x532d98;if(_0x393f49[_0xc430('0x43')][_0xc430('0x5d')]){_0x532d98=as['parseSearch'](_0x393f49['query'][_0xc430('0x5d')]);var _0x274760=_0x532d98[_0xc430('0x5e')];for(var _0x14c427=0x0;_0x14c427<_0x532d98[_0xc430('0x5f')][_0xc430('0x46')];_0x14c427++){var _0x2065d0=_0x532d98['conditions'][_0x14c427];var _0x310aae='i';var _0x4fd2e4=_[_0xc430('0x60')](_0x1efaf5,[_0xc430('0x28'),_0x2065d0[_0xc430('0x4c')]]);if(!_0x4fd2e4){switch(_0x2065d0[_0xc430('0x4c')]){case _0xc430('0x61'):if(_0x2065d0[_0xc430('0x62')]==0x1){_0x4178d7['having']('`'+_0x2065d0[_0xc430('0x4c')]+_0xc430('0x63'));}else{_0x4178d7[_0xc430('0x64')]('`'+_0x2065d0[_0xc430('0x4c')]+_0xc430('0x65'));}break;case _0xc430('0x66'):if(_0x2065d0[_0xc430('0x67')]==='$substring'){if(_0x2065d0[_0xc430('0x62')]['split']('\x20')[_0xc430('0x46')]>0x1){_0x493576[_0x274760]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc430('0x68')](_0x2065d0[_0xc430('0x62')]),null);}else{var _0xac00fb='%'+_0x2065d0[_0xc430('0x62')]+'%';_0x493576[_0x274760](_0xc430('0x69'),_0xac00fb,_0xac00fb,_0xac00fb);}}else{_0x4fd2e4=_[_0xc430('0x60')](_0x1efaf5,['name',_0xc430('0x6a')]);_0x2065d0[_0xc430('0x4c')]='ContactId';_0x2c8840=as['buildExpression'](_0x310aae,_0x4fd2e4[_0xc430('0x3e')],_0x2065d0);_0x493576[_0x274760](_0x2c8840[_0xc430('0x6b')],_0x2c8840[_0xc430('0x62')][_0xc430('0x6c')],_0x2c8840[_0xc430('0x62')][_0xc430('0x1b')]);}break;case _0xc430('0x6d'):var _0x28fa9f=_0x2065d0[_0xc430('0x62')][_0xc430('0x2e')](',')[_0xc430('0x2b')](function(_0x28199b){return Number(_0x28199b);});_0x28fa9f['forEach'](function(_0x52e622){_0x2ea527['or'](_0xc430('0x6e'),'%,'+_0x52e622+',%');});_0x322835=_['union'](_0x322835,_0x28fa9f);break;case _0xc430('0x6f'):if(_0x2065d0[_0xc430('0x67')]==='$substring'){_0x493576[_0x274760](_0xc430('0x70'),'%'+_0x2065d0['value']+'%',null);}else{_0x4fd2e4=_['find'](_0x1efaf5,[_0xc430('0x28'),_0xc430('0x39')]);_0x2065d0['field']=_0xc430('0x39');_0x2c8840=as['buildExpression'](_0x310aae,_0x4fd2e4['type'],_0x2065d0);_0x493576[_0x274760](_0x2c8840[_0xc430('0x6b')],_0x2c8840[_0xc430('0x62')][_0xc430('0x6c')],_0x2c8840[_0xc430('0x62')]['end']);}break;case _0xc430('0x71'):_0x2c8840=as[_0xc430('0x72')]('me',null,_0x2065d0);_0x493576[_0x274760](_0x2c8840[_0xc430('0x6b')],_0x2c8840[_0xc430('0x62')]['start'],_0x2c8840[_0xc430('0x62')][_0xc430('0x1b')]);break;}}else{var _0x2c8840=as[_0xc430('0x72')](_0x310aae,_0x4fd2e4[_0xc430('0x3e')],_0x2065d0);_0x493576[_0x274760](_0x2c8840[_0xc430('0x6b')],_0x2c8840[_0xc430('0x62')][_0xc430('0x6c')],_0x2c8840[_0xc430('0x62')][_0xc430('0x1b')]);}}}else{var _0x45e7d2=_(_0x393f49['query'])['keys']()['map'](function(_0x4000c0){return _[_0xc430('0x73')](_0x1efaf5,[_0xc430('0x28'),_0x4000c0])?_0x4000c0:undefined;})['compact']()['value']();if(!_[_0xc430('0x74')](_0x45e7d2)){_0x45e7d2[_0xc430('0x2f')](function(_0x31ae3c){if(_0x31ae3c===_0xc430('0x75')){_0x4178d7[_0xc430('0x76')](_0xc430('0x77'),[][_0xc430('0x78')](_0x393f49[_0xc430('0x43')][_0x31ae3c]));}else if(_0x31ae3c===_0xc430('0x79')){var _0x52eb67=JSON['parse'](_0x393f49[_0xc430('0x43')][_0x31ae3c])[_0xc430('0x7a')];var _0x1c6390=JSON['parse'](_0x393f49['query'][_0x31ae3c])['$lte'];_0x4178d7[_0xc430('0x76')](_0xc430('0x7b'),_0x52eb67,_0x1c6390);}else{if(_0x393f49[_0xc430('0x43')][_0x31ae3c]===_0xc430('0x7c')){_0x4178d7['where']('i.'+_0x31ae3c+_0xc430('0x7d'));}else{_0x4178d7[_0xc430('0x76')]('i.'+_0x31ae3c+_0xc430('0x7e'),_0x393f49['query'][_0x31ae3c]);}}});}if(_0x393f49[_0xc430('0x43')]['read']){if(_0x393f49[_0xc430('0x43')][_0xc430('0x7f')]==0x1){_0x4178d7[_0xc430('0x64')](_0xc430('0x80'));}else{_0x4178d7[_0xc430('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x393f49[_0xc430('0x43')][_0xc430('0x81')]){_0x322835=_[_0xc430('0x82')](_0x393f49[_0xc430('0x43')]['tag'])?_0x393f49['query'][_0xc430('0x81')]:new Array(_0x393f49['query']['tag']);_0x322835[_0xc430('0x2f')](function(_0x3e0a33){_0x2ea527['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e0a33+',%');});}if(_0x393f49[_0xc430('0x43')][_0xc430('0x83')]){var _0x26cd60=_0x393f49[_0xc430('0x43')][_0xc430('0x83')][_0xc430('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc430('0x85')](_0x26cd60)){_0x493576['or'](_0xc430('0x86'),_0x26cd60+'%')['or'](_0xc430('0x87'),_0x26cd60+'%');}else{_0x493576['or'](_0xc430('0x88'),qs['getFullTextValue'](_0x26cd60))['or'](_0xc430('0x89'),_0x26cd60+'%');}}}_0x4178d7[_0xc430('0x76')](_0x493576);_0x4178d7[_0xc430('0x8a')]('i.id');var _0x156a89={'type':db['Sequelize']['QueryTypes'][_0xc430('0x8b')],'raw':!![]};var _0x547094=_0x4178d7[_0xc430('0x8c')]();_0x547094['field'](_0xc430('0x8d'));_0x547094[_0xc430('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc430('0x61'));if(_0xa93ed0[_0xc430('0x48')]){_0xa93ed0['order'][_0xc430('0x2f')](function(_0x3e053e){var _0x4e3aed=_0x3e053e[0x0]===_0xc430('0x8e')?_0x3e053e[0x0]:'i.'+_0x3e053e[0x0];_0x4178d7[_0xc430('0x48')](_0x4e3aed,_0x3e053e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc430('0x74')](_0x322835)){_0x4178d7[_0xc430('0x64')](_0x2ea527);_0x547094[_0xc430('0x76')](_0xc430('0x8f'),_0x322835);}BPromise[_0xc430('0x90')]()[_0xc430('0x26')](function(){if(!_0x532d98){if(_0x393f49[_0xc430('0x43')][_0xc430('0x75')])return;_0x547094[_0xc430('0x76')](_0xc430('0x91'));_0x4178d7[_0xc430('0x76')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x393f49[_0xc430('0x92')][_0xc430('0x93')]!==_0xc430('0x94'))return;return _0x393f49['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xc430('0x26')](function(_0x4edead){if(_[_0xc430('0x74')](_0x4edead)){_0x547094[_0xc430('0x76')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4178d7['where'](_0xc430('0x95'));}else{_0x547094[_0xc430('0x76')](_0xc430('0x77'),_['map'](_0x4edead,'id'));_0x4178d7[_0xc430('0x76')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x4edead,'id'));}});})[_0xc430('0x26')](function(){if(_0x393f49[_0xc430('0x92')][_0xc430('0x93')]==='agent'&&!_0x532d98&&!_0x393f49[_0xc430('0x43')][_0xc430('0x75')])return[];return db[_0xc430('0x96')][_0xc430('0x43')](_0x547094[_0xc430('0x97')](),_0x156a89);})['then'](function(_0x550472){_0x131e88[_0xc430('0x20')]=_0x550472[_0xc430('0x46')];if(_0x131e88[_0xc430('0x20')]===0x0)return[];return db[_0xc430('0x96')][_0xc430('0x43')](_0x4eafae[_0xc430('0x97')](),_0x156a89)[_0xc430('0x26')](function(_0x11c6b6){_0x10db27=_[_0xc430('0x98')](_0x11c6b6,'id');_0x156a89=_[_0xc430('0x99')](_0x156a89,{'model':db[_0xc430('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x393f49['query'][_0xc430('0x45')]){_0xa93ed0[_0xc430('0x44')][_0xc430('0x2f')](function(_0x1176d6){_0x4178d7['field']('i.'+_0x1176d6);});}else{_0x4178d7['field'](_0xc430('0x9a'),'unreadMessages');_0x4178d7[_0xc430('0x4c')](_0xc430('0x9b'),_0xc430('0x9c'));_0x4178d7[_0xc430('0x4c')](_0xc430('0x9d'),'Account.mandatoryDisposition');_0x4178d7['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');_0x4178d7[_0xc430('0x4c')]('i.*');_0x4178d7['field'](_0xc430('0x9e'),_0xc430('0x9f'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xa0'),_0xc430('0xa1'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xa2'),_0xc430('0xa3'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xa4'),_0xc430('0xa5'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xa6'),'Contact.mobile');_0x4178d7[_0xc430('0x4c')](_0xc430('0xa7'),_0xc430('0xa8'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xa9'),_0xc430('0xaa'));_0x4178d7[_0xc430('0x4c')](_0xc430('0xab'),'Owner.internal');_0x4178d7[_0xc430('0x4c')](_0xc430('0xac'),'TagIds');}if(_0xa93ed0[_0xc430('0x21')])_0x4178d7[_0xc430('0x21')](_0xa93ed0[_0xc430('0x21')]);if(_0xa93ed0[_0xc430('0x1e')])_0x4178d7['offset'](_0xa93ed0[_0xc430('0x1e')]);return db['sequelize']['query'](_0x4178d7[_0xc430('0x97')](),_0x156a89);})[_0xc430('0x26')](function(_0x3a66ee){if(_0x3a66ee[_0xc430('0x46')]>0x0)_0x34fd8c[_0xc430('0x76')](_0xc430('0xad'),_['map'](_0x3a66ee,'id'));return db[_0xc430('0x96')][_0xc430('0x43')](_0x34fd8c[_0xc430('0x97')](),_0x156a89)[_0xc430('0x26')](function(_0x46418e){var _0xbbe0f5=_[_0xc430('0xae')](_0x46418e,_0xc430('0xaf'));var _0x1cd2c7=[];_0x3a66ee[_0xc430('0x2f')](function(_0x4fce45){_0x1cd2c7[_0xc430('0x31')](updateWhatsappInteraction(_0x4fce45,_0x10db27,_0xbbe0f5));});return BPromise[_0xc430('0xb0')](_0x1cd2c7);});});})['then'](function(_0x5659ff){_0x131e88[_0xc430('0xb1')]=_0x5659ff;return _0x131e88;})[_0xc430('0x26')](respondWithFilteredResult(_0x52b1a7,_0xa93ed0))[_0xc430('0x32')](handleError(_0x52b1a7,null));};exports[_0xc430('0xb2')]=function(_0x3583d0,_0x53a038){var _0x14de25={'raw':![],'where':{'id':_0x3583d0[_0xc430('0xb3')]['id']}},_0x11ff22={};_0x11ff22[_0xc430('0x40')]=_['keys'](db[_0xc430('0x3b')]['rawAttributes']);_0x11ff22['query']=_[_0xc430('0xb4')](_0x3583d0[_0xc430('0x43')]);_0x11ff22[_0xc430('0x41')]=_[_0xc430('0x42')](_0x11ff22['model'],_0x11ff22[_0xc430('0x43')]);_0x14de25[_0xc430('0x44')]=_['intersection'](_0x11ff22['model'],qs[_0xc430('0x45')](_0x3583d0[_0xc430('0x43')]['fields']));_0x14de25[_0xc430('0x44')]=_0x14de25[_0xc430('0x44')][_0xc430('0x46')]?_0x14de25[_0xc430('0x44')]:_0x11ff22[_0xc430('0x40')];if(_0x3583d0[_0xc430('0x43')][_0xc430('0xb5')]){_0x14de25['include']=[{'all':!![]}];}_0x14de25=_[_0xc430('0x99')]({},_0x14de25,_0x3583d0[_0xc430('0xb6')]);return db[_0xc430('0x3b')]['find'](_0x14de25)[_0xc430('0x26')](handleEntityNotFound(_0x53a038,null))[_0xc430('0x26')](respondWithResult(_0x53a038,null))['catch'](handleError(_0x53a038,null));};exports['create']=function(_0x419839,_0x58df91){return db[_0xc430('0x3b')][_0xc430('0xb7')](_0x419839[_0xc430('0x71')],{})[_0xc430('0x26')](respondWithResult(_0x58df91,0xc9))['catch'](handleError(_0x58df91,null));};exports[_0xc430('0x25')]=function(_0x4007fe,_0x193666){if(_0x4007fe[_0xc430('0x71')]['id']){delete _0x4007fe[_0xc430('0x71')]['id'];}return db[_0xc430('0x3b')][_0xc430('0x60')]({'where':{'id':_0x4007fe['params']['id']}})[_0xc430('0x26')](handleEntityNotFound(_0x193666,null))[_0xc430('0x26')](saveUpdates(_0x4007fe['body'],null))[_0xc430('0x26')](respondWithResult(_0x193666,null))[_0xc430('0x32')](handleError(_0x193666,null));};exports[_0xc430('0xb8')]=function(_0x47ae9c,_0x222ccc){return db[_0xc430('0x3b')][_0xc430('0x60')]({'where':{'id':_0x47ae9c[_0xc430('0xb3')]['id']}})['then'](handleEntityNotFound(_0x222ccc,null))[_0xc430('0x26')](removeEntity(_0x222ccc,null))[_0xc430('0x32')](handleError(_0x222ccc,null));};exports[_0xc430('0xb9')]=function(_0x30a14f,_0x2fd1f1){return db[_0xc430('0x3b')][_0xc430('0xb9')]()[_0xc430('0x26')](respondWithResult(_0x2fd1f1,null))[_0xc430('0x32')](handleError(_0x2fd1f1,null));};exports[_0xc430('0xba')]=function(_0x56a79a,_0x22bc18,_0xfc1ea2){return db[_0xc430('0xbb')][_0xc430('0x60')]({'where':{'id':_0x56a79a[_0xc430('0xb3')]['id']}})['then'](handleEntityNotFound(_0x22bc18,null))[_0xc430('0x26')](function(_0x5deb37){if(_0x5deb37){return _0x5deb37[_0xc430('0xba')](_0x56a79a['body']['ids'],_[_0xc430('0xbc')](_0x56a79a['body'],[_0xc430('0xbd'),'id'])||{});}})[_0xc430('0x26')](respondWithResult(_0x22bc18,null))[_0xc430('0x32')](handleError(_0x22bc18,null));};exports[_0xc430('0xbe')]=function(_0x3bd27d,_0x474474,_0x2b4381){var _0x2a053f={'raw':![],'where':{}};var _0x142b21={};var _0x47d802={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xc430('0xbf')]({'where':{'id':_0x3bd27d['params']['id']}})[_0xc430('0x26')](handleEntityNotFound(_0x474474,null))[_0xc430('0x26')](function(_0x4a9ac3){if(_0x4a9ac3){_0x142b21[_0xc430('0x40')]=_[_0xc430('0xb4')](db[_0xc430('0xbb')][_0xc430('0x3c')]);_0x142b21[_0xc430('0x43')]=_[_0xc430('0xb4')](_0x3bd27d[_0xc430('0x43')]);_0x142b21[_0xc430('0x41')]=_['intersection'](_0x142b21[_0xc430('0x40')],_0x142b21[_0xc430('0x43')]);_0x2a053f['attributes']=_[_0xc430('0x42')](_0x142b21[_0xc430('0x40')],qs[_0xc430('0x45')](_0x3bd27d[_0xc430('0x43')][_0xc430('0x45')]));_0x2a053f[_0xc430('0x44')]=_0x2a053f[_0xc430('0x44')][_0xc430('0x46')]?_0x2a053f[_0xc430('0x44')]:_0x142b21[_0xc430('0x40')];if(!_0x3bd27d[_0xc430('0x43')]['hasOwnProperty'](_0xc430('0x47'))){_0x2a053f[_0xc430('0x21')]=qs[_0xc430('0x21')](_0x3bd27d[_0xc430('0x43')][_0xc430('0x21')]);_0x2a053f[_0xc430('0x1e')]=qs[_0xc430('0x1e')](_0x3bd27d[_0xc430('0x43')][_0xc430('0x1e')]);}_0x2a053f[_0xc430('0x48')]=qs[_0xc430('0x49')](_0x3bd27d[_0xc430('0x43')][_0xc430('0x49')]);_0x2a053f[_0xc430('0x76')]=qs[_0xc430('0x41')](_[_0xc430('0x4a')](_0x3bd27d[_0xc430('0x43')],_0x142b21[_0xc430('0x41')]));_0x2a053f[_0xc430('0x76')][_0xc430('0xaf')]=_0x4a9ac3['id'];if(_0x3bd27d[_0xc430('0x43')][_0xc430('0x83')]){_0x2a053f[_0xc430('0x76')]=_[_0xc430('0x99')](_0x2a053f['where'],{'$or':_[_0xc430('0x2b')](_0x2a053f[_0xc430('0x44')],function(_0x45c316){var _0xd13346={};_0xd13346[_0x45c316]={'$like':'%'+_0x3bd27d[_0xc430('0x43')][_0xc430('0x83')]+'%'};return _0xd13346;})});}if(_0x3bd27d['query']['$gte']){var _0x2f18c2=_0x3bd27d['query'][_0xc430('0x7a')][_0xc430('0x2e')](',');var _0x568ed0={};_0x568ed0[_0x2f18c2[0x0]]={'$gte':moment(_0x2f18c2[0x1])[_0xc430('0xc0')](_0xc430('0xc1'))};_0x2a053f[_0xc430('0x76')]=_[_0xc430('0x99')](_0x2a053f['where'],_0x568ed0);}_0x2a053f=_[_0xc430('0x99')]({},_0x2a053f,_0x3bd27d['options']);return db[_0xc430('0xbb')][_0xc430('0x20')]({'where':_0x2a053f[_0xc430('0x76')]})[_0xc430('0x26')](function(_0x2d518b){_0x47d802[_0xc430('0x20')]=_0x2d518b;if(_0x3bd27d[_0xc430('0x43')][_0xc430('0xb5')]){_0x2a053f['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x2a053f);})[_0xc430('0x26')](function(_0x33c0b2){_0x47d802[_0xc430('0xb1')]=_0x33c0b2;return _0x47d802;});}})['then'](respondWithFilteredResult(_0x474474,_0x2a053f))[_0xc430('0x32')](handleError(_0x474474,null));};exports['addTags']=function(_0x359f2e,_0x541850,_0x449fba){return db[_0xc430('0x3b')]['find']({'where':{'id':_0x359f2e[_0xc430('0xb3')]['id']}})[_0xc430('0x26')](handleEntityNotFound(_0x541850,null))[_0xc430('0x26')](function(_0x33f284){if(_0x33f284){return _0x33f284[_0xc430('0xc2')](_0x359f2e[_0xc430('0x71')][_0xc430('0xbd')],_[_0xc430('0xbc')](_0x359f2e['body'],[_0xc430('0xbd'),'id'])||{})[_0xc430('0xc3')](function(){return db[_0xc430('0x6d')][_0xc430('0xc4')]({'attributes':['id',_0xc430('0x28'),_0xc430('0x4d')],'where':{'id':_0x359f2e[_0xc430('0x71')]['ids']}});})[_0xc430('0x26')](function(_0x212bbd){socket[_0xc430('0xc5')](_0xc430('0xc6'),{'id':Number(_0x359f2e[_0xc430('0xb3')]['id']),'tags':_0x212bbd||[]});return{'id':Number(_0x359f2e[_0xc430('0xb3')]['id']),'tags':_0x212bbd||[]};});}})[_0xc430('0x26')](respondWithResult(_0x541850,null))[_0xc430('0x32')](handleError(_0x541850,null));};exports[_0xc430('0xc7')]=function(_0x8e92ea,_0x129e41,_0xf4c77e){return db[_0xc430('0x3b')][_0xc430('0x60')]({'where':{'id':_0x8e92ea[_0xc430('0xb3')]['id']}})[_0xc430('0x26')](handleEntityNotFound(_0x129e41,null))[_0xc430('0x26')](function(_0x2068e5){if(_0x2068e5){return _0x2068e5[_0xc430('0xc7')](_0x8e92ea[_0xc430('0x43')]['ids']);}})[_0xc430('0x26')](respondWithStatusCode(_0x129e41,null))['catch'](handleError(_0x129e41,null));};exports[_0xc430('0xc8')]=function(_0x2f348f,_0x459959){var _0x23654b=moment()[_0xc430('0xc9')]()[_0xc430('0x97')]();var _0x26756d=path[_0xc430('0xca')](config[_0xc430('0xcb')],_0xc430('0xcc'),_0xc430('0xcd'),_0xc430('0xce'));var _0x1d5794=path[_0xc430('0xca')](config[_0xc430('0xcb')],_0xc430('0xcc'),_0xc430('0xcd'),_0xc430('0xcf'));var _0x26af3e=path[_0xc430('0xca')](_0x26756d,_0x23654b);var _0x1b84d0=util['format']('transcript-%d-%s.zip',_0x2f348f[_0xc430('0xb3')]['id'],_0x23654b);var _0x44af2e=path['join'](_0x26756d,_0x1b84d0);var _0x1958d4=[];_0x1958d4['push']({'model':db['User'],'as':_0xc430('0x6f'),'attributes':['id',_0xc430('0x2c')],'raw':!![]});_0x1958d4['push']({'model':db['CmContact'],'as':_0xc430('0x66'),'attributes':['id',_0xc430('0xd0'),_0xc430('0xd1')],'raw':!![]});if(_0x2f348f['query'][_0xc430('0xcf')]){_0x1958d4[_0xc430('0x31')]({'model':db[_0xc430('0xd2')],'as':_0xc430('0xd2'),'raw':!![]});}var _0x5e8cf1=[{'model':db[_0xc430('0xbb')],'as':_0xc430('0xd3'),'attributes':['id','body','createdAt',_0xc430('0xd4'),_0xc430('0xd5'),'read'],'include':_0x1958d4}];_0x5e8cf1['push']({'model':db[_0xc430('0xd6')],'as':_0xc430('0xd7'),'attributes':['id',_0xc430('0x28')]});_0x5e8cf1[_0xc430('0x31')]({'model':db[_0xc430('0x6f')],'as':_0xc430('0xd8'),'attributes':['id',_0xc430('0x2c')]});return db['WhatsappInteraction'][_0xc430('0x60')]({'where':{'id':_0x2f348f[_0xc430('0xb3')]['id']},'include':_0x5e8cf1})[_0xc430('0x26')](handleEntityNotFound(_0x459959,null))[_0xc430('0x26')](function(_0x25106f){if(_0x25106f){var _0x39bcd9=_0x25106f[_0xc430('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x26af3e);var _0x48411a={'channel':_0xc430('0xda'),'account':_0x39bcd9[_0xc430('0xd7')][_0xc430('0x28')],'agent':_0x39bcd9[_0xc430('0xd8')]?_0x39bcd9[_0xc430('0xd8')][_0xc430('0x2c')]:_0xc430('0xdb'),'createdAt':moment(_0x39bcd9[_0xc430('0x79')])[_0xc430('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x39bcd9[_0xc430('0x38')]?moment(_0x39bcd9[_0xc430('0xdc')])[_0xc430('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x39bcd9[_0xc430('0xdd')],'messages':_(_0x39bcd9['Messages'])[_0xc430('0x83')]({'secret':![]})[_0xc430('0x2b')](function(_0x2ab6f2){if(_0x2ab6f2[_0xc430('0xd2')]){var _0x5e57d0=path[_0xc430('0xca')](_0x1d5794,_0x2ab6f2['Attachment']['basename']);if(fs['existsSync'](_0x5e57d0)){fs[_0xc430('0xde')](_0x5e57d0)[_0xc430('0xdf')](fs['createWriteStream'](path[_0xc430('0xca')](_0x26af3e,_0x2ab6f2[_0xc430('0xd2')]['basename'])));}}return{'date':moment(_0x2ab6f2['createdAt'])[_0xc430('0xc0')](_0xc430('0xc1'))[_0xc430('0x97')](),'sender':_0x2ab6f2[_0xc430('0xd4')]===_0xc430('0xe0')?_0x2ab6f2[_0xc430('0x6f')]?_0x2ab6f2['User']['fullname']:'System':_0x2ab6f2[_0xc430('0x66')][_0xc430('0xd0')]+(_0x2ab6f2[_0xc430('0x66')][_0xc430('0xd1')]?'\x20'+_0x2ab6f2['Contact'][_0xc430('0xd1')]:''),'body':_0x2ab6f2['Attachment']?_0x2ab6f2[_0xc430('0xd2')][_0xc430('0xe1')]:_0x2ab6f2[_0xc430('0x71')],'direction':_0x2ab6f2[_0xc430('0xd4')]===_0xc430('0xe0')?'A':'C','secret':_0x2ab6f2['secret'],'read':_0x2ab6f2[_0xc430('0x7f')],'attachment':_0x2ab6f2[_0xc430('0xd2')]};})[_0xc430('0x62')]()};return ejs[_0xc430('0xe2')](path[_0xc430('0xca')](config['root'],_0xc430('0xcc'),_0xc430('0xe3'),_0xc430('0xe4')),{'interaction':_0x48411a})['then'](function(_0x28490b){var _0x224d79=path['join'](_0x26af3e,_0xc430('0xe5')+_0x39bcd9['id']+'-'+_0x23654b+_0xc430('0xe6'));var _0x32c981={'path':_0x224d79,'channel':_0xc430('0xda'),'interactionId':_0x39bcd9['id']};return pdf[_0xc430('0xe7')](_0x28490b,_0x32c981);})[_0xc430('0x26')](function(){return new BPromise(function(_0x191eed,_0x36b210){zipdir(_0x26af3e,{'saveTo':_0x44af2e},function(_0x4db4b0,_0x1fcd69){if(_0x4db4b0)return _0x36b210(_0x4db4b0);return _0x191eed(_0x1fcd69);});})['then'](function(){return new BPromise(function(_0x120709,_0x38936a){rimraf(_0x26af3e,function(_0x460899){if(_0x460899)_0x38936a(_0x460899);return _0x120709();});});})[_0xc430('0x26')](function(){return _0x459959[_0xc430('0xc8')](_0x44af2e,_0x1b84d0,function(_0x596569){if(_0x596569){console[_0xc430('0xe8')](_0xc430('0xe9'),_0x596569);}else{fs['unlinkSync'](_0x44af2e);}});});});}else{return _0x459959['sendStatus'](0xc8);}})['catch'](handleError(_0x459959,null));}; \ No newline at end of file +var _0x9e6d=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','limit','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','waiting','talking','answered','unmanaged','total','UserId','closed','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','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','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','Account.key','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','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','all','rows','show','include','options','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','eml-format','zip-dir'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2dee4a,_0x15d24f){_0x2dee4a=_0x2dee4a-0x0;var _0x4ccaa7=_0x9e6d[_0x2dee4a];return _0x4ccaa7;};'use strict';var emlformat=require(_0xd9e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9e6('0x1'));var jsonpatch=require(_0xd9e6('0x2'));var rp=require(_0xd9e6('0x3'));var moment=require('moment');var BPromise=require(_0xd9e6('0x4'));var Mustache=require(_0xd9e6('0x5'));var util=require(_0xd9e6('0x6'));var path=require(_0xd9e6('0x7'));var sox=require('sox');var csv=require(_0xd9e6('0x8'));var ejs=require(_0xd9e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd9e6('0xa'));var crypto=require(_0xd9e6('0xb'));var jsforce=require(_0xd9e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd9e6('0x8'));var querystring=require(_0xd9e6('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9e6('0xe'));var authService=require(_0xd9e6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd9e6('0x10'));var hardwareService=require(_0xd9e6('0x11'));var logger=require(_0xd9e6('0x12'))(_0xd9e6('0x13'));var utils=require(_0xd9e6('0x14'));var config=require(_0xd9e6('0x15'));var licenseUtil=require(_0xd9e6('0x16'));var db=require(_0xd9e6('0x17'))['db'];config[_0xd9e6('0x18')]=_['defaults'](config[_0xd9e6('0x18')],{'host':_0xd9e6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd9e6('0x1a'))['register'](socket);function respondWithStatusCode(_0x3c69bb,_0x1b3e86){_0x1b3e86=_0x1b3e86||0xcc;return function(_0x1404d6){if(_0x1404d6){return _0x3c69bb[_0xd9e6('0x1b')](_0x1b3e86);}return _0x3c69bb[_0xd9e6('0x1c')](_0x1b3e86)['end']();};}function respondWithResult(_0x5ddd5a,_0x10d104){_0x10d104=_0x10d104||0xc8;return function(_0x5dfc4b){if(_0x5dfc4b){return _0x5ddd5a[_0xd9e6('0x1c')](_0x10d104)[_0xd9e6('0x1d')](_0x5dfc4b);}};}function respondWithFilteredResult(_0xbe657c,_0x2db831){return function(_0xe30afc){if(_0xe30afc){var _0xa7fa90=typeof _0x2db831[_0xd9e6('0x1e')]===_0xd9e6('0x1f')&&typeof _0x2db831[_0xd9e6('0x20')]===_0xd9e6('0x1f');var _0x4a95b4=_0xe30afc['count'];var _0x44ae12=_0xa7fa90?0x0:_0x2db831[_0xd9e6('0x1e')];var _0x19dfd7=_0xa7fa90?_0xe30afc['count']:_0x2db831[_0xd9e6('0x1e')]+_0x2db831[_0xd9e6('0x20')];var _0x2f113e;if(_0x19dfd7>=_0x4a95b4){_0x19dfd7=_0x4a95b4;_0x2f113e=0xc8;}else{_0x2f113e=0xce;}_0xbe657c[_0xd9e6('0x1c')](_0x2f113e);return _0xbe657c['set']('Content-Range',_0x44ae12+'-'+_0x19dfd7+'/'+_0x4a95b4)[_0xd9e6('0x1d')](_0xe30afc);}return null;};}function patchUpdates(_0x3ada59){return function(_0x4143c0){try{jsonpatch['apply'](_0x4143c0,_0x3ada59,!![]);}catch(_0x33158e){return BPromise[_0xd9e6('0x21')](_0x33158e);}return _0x4143c0[_0xd9e6('0x22')]();};}function saveUpdates(_0xdfd442,_0x1cebad){return function(_0xdb616f){if(_0xdb616f){return _0xdb616f[_0xd9e6('0x23')](_0xdfd442)['then'](function(_0x3a8c62){return _0x3a8c62;});}return null;};}function removeEntity(_0x3b17f9,_0x33b7af){return function(_0x3ea715){if(_0x3ea715){return _0x3ea715[_0xd9e6('0x24')]()[_0xd9e6('0x25')](function(){_0x3b17f9['status'](0xcc)[_0xd9e6('0x26')]();});}};}function handleEntityNotFound(_0xa32093,_0x38df16){return function(_0x2ae664){if(!_0x2ae664){_0xa32093[_0xd9e6('0x1b')](0x194);}return _0x2ae664;};}function handleError(_0x2f815e,_0x105831){_0x105831=_0x105831||0x1f4;return function(_0x2b2f4b){logger[_0xd9e6('0x27')](_0x2b2f4b[_0xd9e6('0x28')]);if(_0x2b2f4b[_0xd9e6('0x29')]){delete _0x2b2f4b[_0xd9e6('0x29')];}_0x2f815e[_0xd9e6('0x1c')](_0x105831)[_0xd9e6('0x2a')](_0x2b2f4b);};}function getInteractionUsers(_0x5367c9,_0x339d5f){return new BPromise(function(_0x138473,_0x45a52c){try{if(_0x339d5f[_0x5367c9['id']]){_0x5367c9[_0xd9e6('0x2b')]=_[_0xd9e6('0x2c')](_0x339d5f[_0x5367c9['id']],function(_0x19816d){return{'id':_0x19816d['id'],'fullname':_0x19816d[_0xd9e6('0x2d')]};});}}catch(_0x1d988c){_0x45a52c(_0x1d988c);}_0x138473(_0x5367c9);});}function getInteractionTags(_0x53689c,_0x23f993){return new BPromise(function(_0x1a1de4,_0x32bb74){try{if(_0x53689c['TagIds']){_0x53689c[_0xd9e6('0x2e')]=[];_0x53689c['TagIds'][_0xd9e6('0x2f')](',')[_0xd9e6('0x30')](function(_0x543b45){_0x53689c['Tags'][_0xd9e6('0x31')](_0x23f993[_0x543b45]);});}delete _0x53689c[_0xd9e6('0x32')];}catch(_0x5e0fa8){_0x32bb74(_0x5e0fa8);}_0x1a1de4(_0x53689c);});}function updateWhatsappInteraction(_0x466cae,_0x5a5470,_0x3b9dc4){return new BPromise(function(_0x15ff01,_0x213d56){return getInteractionUsers(_0x466cae,_0x3b9dc4)[_0xd9e6('0x25')](function(_0x2c8d4f){return getInteractionTags(_0x2c8d4f,_0x5a5470);})[_0xd9e6('0x25')](function(_0x163521){return getStateInteraction(_0x163521);})[_0xd9e6('0x25')](function(_0x59ee3a){_0x15ff01(_0x59ee3a);})['catch'](function(_0x46c6f8){_0x213d56(_0x46c6f8);});});}function getStateInteraction(_0x1f5790){return new BPromise(function(_0x2b0bc6){_0x1f5790[_0xd9e6('0x33')]=0x0;_0x1f5790[_0xd9e6('0x34')]=0x0;_0x1f5790[_0xd9e6('0x35')]=0x0;_0x1f5790[_0xd9e6('0x36')]=0x0;_0x1f5790[_0xd9e6('0x37')]=0x0;if(!_0x1f5790['closed']&&!_0x1f5790[_0xd9e6('0x38')]){_0x1f5790[_0xd9e6('0x33')]+=0x1;}if(!_0x1f5790[_0xd9e6('0x39')]&&_0x1f5790['UserId']){_0x1f5790[_0xd9e6('0x34')]+=0x1;if(_0x1f5790[_0xd9e6('0x33')]){_0x1f5790[_0xd9e6('0x33')]-=0x1;}}if(_0x1f5790[_0xd9e6('0x39')]&&_0x1f5790[_0xd9e6('0x38')]){_0x1f5790[_0xd9e6('0x35')]+=0x1;if(_0x1f5790[_0xd9e6('0x34')]){_0x1f5790['talking']-=0x1;}}if(_0x1f5790['closed']&&!_0x1f5790['UserId']){_0x1f5790[_0xd9e6('0x36')]+=0x1;if(_0x1f5790['waiting']){_0x1f5790['waiting']-=0x1;}}_0x1f5790[_0xd9e6('0x37')]+=0x1;_0x2b0bc6(_0x1f5790);});}exports[_0xd9e6('0x3a')]=function(_0x44b173,_0x5af9f9){var _0x338dbb={},_0x9d22ea={},_0x296ac2={'count':0x0,'rows':[]};var _0x53fce4=_[_0xd9e6('0x2c')](db[_0xd9e6('0x3b')][_0xd9e6('0x3c')],function(_0x467d89){return{'name':_0x467d89[_0xd9e6('0x3d')],'type':_0x467d89['type'][_0xd9e6('0x3e')]};});_0x9d22ea['model']=_['map'](_0x53fce4,'name');_0x9d22ea[_0xd9e6('0x3f')]=_[_0xd9e6('0x40')](_0x44b173['query']);_0x9d22ea[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x9d22ea[_0xd9e6('0x43')],_0x9d22ea[_0xd9e6('0x3f')]);_0x338dbb[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x9d22ea[_0xd9e6('0x43')],qs[_0xd9e6('0x45')](_0x44b173['query'][_0xd9e6('0x45')]));_0x338dbb[_0xd9e6('0x44')]=_0x338dbb[_0xd9e6('0x44')][_0xd9e6('0x46')]?_0x338dbb[_0xd9e6('0x44')]:_0x9d22ea[_0xd9e6('0x43')];if(!_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x47')](_0xd9e6('0x48'))){_0x338dbb['limit']=qs[_0xd9e6('0x20')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x20')]);_0x338dbb[_0xd9e6('0x1e')]=qs[_0xd9e6('0x1e')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x1e')]);}_0x338dbb[_0xd9e6('0x49')]=qs['sort'](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x4a')]);_0x338dbb[_0xd9e6('0x4b')]=qs[_0xd9e6('0x41')](_[_0xd9e6('0x4c')](_0x44b173[_0xd9e6('0x3f')],_0x9d22ea[_0xd9e6('0x41')]),_0x53fce4);var _0x1f2265=[];var _0x1b9973=squel['select']()[_0xd9e6('0x4d')]('id')[_0xd9e6('0x4d')](_0xd9e6('0x29'))['field'](_0xd9e6('0x4e'))[_0xd9e6('0x4f')](_0xd9e6('0x50'));var _0x22aebe=squel[_0xd9e6('0x51')]()[_0xd9e6('0x4d')](_0xd9e6('0x52'))[_0xd9e6('0x4d')](_0xd9e6('0x53'))[_0xd9e6('0x4d')](_0xd9e6('0x54'))['from']('user_has_whatsapp_interactions','ui')[_0xd9e6('0x55')](_0xd9e6('0x56'),'u',_0xd9e6('0x57'));var _0x3a0135=squel[_0xd9e6('0x51')]()[_0xd9e6('0x4f')]('whatsapp_interactions','i')[_0xd9e6('0x55')]('cm_contacts','c',_0xd9e6('0x58'))[_0xd9e6('0x55')](_0xd9e6('0x56'),'o',_0xd9e6('0x59'))[_0xd9e6('0x55')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0xd9e6('0x55')](_0xd9e6('0x5a'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xd9e6('0x55')](_0xd9e6('0x5b'),'it',_0xd9e6('0x5c'))[_0xd9e6('0x55')]('tools_tags','t',_0xd9e6('0x5d'));var _0x5f16d5=squel[_0xd9e6('0x5e')]();var _0x108042=[];var _0xebeca8=squel[_0xd9e6('0x5e')]();var _0x41efd5;if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x5f')]){_0x41efd5=as[_0xd9e6('0x60')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x5f')]);var _0x3fd167=_0x41efd5[_0xd9e6('0x61')];for(var _0x843af6=0x0;_0x843af6<_0x41efd5['conditions'][_0xd9e6('0x46')];_0x843af6++){var _0x4ca4d3=_0x41efd5['conditions'][_0x843af6];var _0x2fbf24='i';var _0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,['name',_0x4ca4d3[_0xd9e6('0x4d')]]);if(!_0x5f1cbf){switch(_0x4ca4d3['field']){case _0xd9e6('0x63'):if(_0x4ca4d3['value']==0x1){_0x3a0135[_0xd9e6('0x64')]('`'+_0x4ca4d3[_0xd9e6('0x4d')]+_0xd9e6('0x65'));}else{_0x3a0135['having']('`'+_0x4ca4d3['field']+'`\x20>\x200');}break;case'Contact':if(_0x4ca4d3[_0xd9e6('0x66')]===_0xd9e6('0x67')){if(_0x4ca4d3['value']['split']('\x20')[_0xd9e6('0x46')]>0x1){_0x5f16d5[_0x3fd167](_0xd9e6('0x68'),qs[_0xd9e6('0x69')](_0x4ca4d3[_0xd9e6('0x6a')]),null);}else{var _0x2c05db='%'+_0x4ca4d3['value']+'%';_0x5f16d5[_0x3fd167](_0xd9e6('0x6b'),_0x2c05db,_0x2c05db,_0x2c05db);}}else{_0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,[_0xd9e6('0x29'),_0xd9e6('0x6c')]);_0x4ca4d3[_0xd9e6('0x4d')]='ContactId';_0x224c8a=as['buildExpression'](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x26')]);}break;case _0xd9e6('0x70'):var _0x1baecc=_0x4ca4d3[_0xd9e6('0x6a')][_0xd9e6('0x2f')](',')[_0xd9e6('0x2c')](function(_0x997758){return Number(_0x997758);});_0x1baecc['forEach'](function(_0x742c6b){_0xebeca8['or'](_0xd9e6('0x71'),'%,'+_0x742c6b+',%');});_0x108042=_[_0xd9e6('0x72')](_0x108042,_0x1baecc);break;case _0xd9e6('0x73'):if(_0x4ca4d3[_0xd9e6('0x66')]===_0xd9e6('0x67')){_0x5f16d5[_0x3fd167](_0xd9e6('0x74'),'%'+_0x4ca4d3[_0xd9e6('0x6a')]+'%',null);}else{_0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,[_0xd9e6('0x29'),_0xd9e6('0x38')]);_0x4ca4d3[_0xd9e6('0x4d')]=_0xd9e6('0x38');_0x224c8a=as[_0xd9e6('0x75')](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a['value'][_0xd9e6('0x26')]);}break;case _0xd9e6('0x76'):_0x224c8a=as[_0xd9e6('0x75')]('me',null,_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a['value'][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x26')]);break;}}else{var _0x224c8a=as['buildExpression'](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')]['end']);}}}else{var _0x2294e2=_(_0x44b173[_0xd9e6('0x3f')])[_0xd9e6('0x40')]()[_0xd9e6('0x2c')](function(_0x33e81d){return _[_0xd9e6('0x77')](_0x53fce4,[_0xd9e6('0x29'),_0x33e81d])?_0x33e81d:undefined;})[_0xd9e6('0x78')]()[_0xd9e6('0x6a')]();if(!_['isEmpty'](_0x2294e2)){_0x2294e2[_0xd9e6('0x30')](function(_0x1d77ce){if(_0x1d77ce===_0xd9e6('0x79')){_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7a'),[][_0xd9e6('0x7b')](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce]));}else if(_0x1d77ce===_0xd9e6('0x7c')){var _0x5cca00=JSON['parse'](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce])['$gte'];var _0x4af328=JSON[_0xd9e6('0x7d')](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce])[_0xd9e6('0x7e')];_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7f'),_0x5cca00,_0x4af328);}else{if(_0x44b173['query'][_0x1d77ce]===_0xd9e6('0x80')){_0x3a0135['where']('i.'+_0x1d77ce+_0xd9e6('0x81'));}else{_0x3a0135[_0xd9e6('0x4b')]('i.'+_0x1d77ce+_0xd9e6('0x82'),_0x44b173[_0xd9e6('0x3f')][_0x1d77ce]);}}});}if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x83')]){if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x83')]==0x1){_0x3a0135[_0xd9e6('0x64')](_0xd9e6('0x84'));}else{_0x3a0135[_0xd9e6('0x64')](_0xd9e6('0x85'));}}if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]){_0x108042=_['isArray'](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')])?_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]:new Array(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]);_0x108042['forEach'](function(_0x384c26){_0xebeca8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x384c26+',%');});}if(_0x44b173['query'][_0xd9e6('0x87')]){var _0x44e5d7=_0x44b173['query'][_0xd9e6('0x87')]['replace']('\x5c','\x5c\x5c')[_0xd9e6('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44e5d7)){_0x5f16d5['or'](_0xd9e6('0x89'),_0x44e5d7+'%')['or'](_0xd9e6('0x8a'),_0x44e5d7+'%');}else{_0x5f16d5['or'](_0xd9e6('0x8b'),qs[_0xd9e6('0x69')](_0x44e5d7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44e5d7+'%');}}}_0x3a0135['where'](_0x5f16d5);_0x3a0135['group'](_0xd9e6('0x8c'));var _0x327f41={'type':db[_0xd9e6('0x8d')][_0xd9e6('0x8e')]['SELECT'],'raw':!![]};var _0x300a6d=_0x3a0135[_0xd9e6('0x8f')]();_0x300a6d[_0xd9e6('0x4d')]('i.id');_0x300a6d['field'](_0xd9e6('0x90'),_0xd9e6('0x63'));if(_0x338dbb[_0xd9e6('0x49')]){_0x338dbb[_0xd9e6('0x49')][_0xd9e6('0x30')](function(_0x5ed76a){var _0x170dc1=_0x5ed76a[0x0]===_0xd9e6('0x91')?_0x5ed76a[0x0]:'i.'+_0x5ed76a[0x0];_0x3a0135[_0xd9e6('0x49')](_0x170dc1,_0x5ed76a[0x1]===_0xd9e6('0x92')?![]:!![]);});}if(!_[_0xd9e6('0x93')](_0x108042)){_0x3a0135[_0xd9e6('0x64')](_0xebeca8);_0x300a6d[_0xd9e6('0x4b')]('t.id\x20IN\x20?',_0x108042);}BPromise[_0xd9e6('0x94')]()[_0xd9e6('0x25')](function(){if(!_0x41efd5){if(_0x44b173[_0xd9e6('0x3f')]['WhatsappAccountId'])return;_0x300a6d['where'](_0xd9e6('0x95'));_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x95'));return;}if(_0x44b173['user'][_0xd9e6('0x96')]!==_0xd9e6('0x97'))return;return _0x44b173[_0xd9e6('0x98')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x15a136){if(_['isEmpty'](_0x15a136)){_0x300a6d[_0xd9e6('0x4b')](_0xd9e6('0x99'));_0x3a0135['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x300a6d[_0xd9e6('0x4b')](_0xd9e6('0x7a'),_[_0xd9e6('0x2c')](_0x15a136,'id'));_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7a'),_[_0xd9e6('0x2c')](_0x15a136,'id'));}});})['then'](function(){if(_0x44b173['user'][_0xd9e6('0x96')]===_0xd9e6('0x97')&&!_0x41efd5&&!_0x44b173['query'][_0xd9e6('0x79')])return[];return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x300a6d[_0xd9e6('0x9b')](),_0x327f41);})[_0xd9e6('0x25')](function(_0x4f3ab1){_0x296ac2[_0xd9e6('0x9c')]=_0x4f3ab1[_0xd9e6('0x46')];if(_0x296ac2[_0xd9e6('0x9c')]===0x0)return[];return db[_0xd9e6('0x9a')]['query'](_0x1b9973[_0xd9e6('0x9b')](),_0x327f41)['then'](function(_0x491371){_0x1f2265=_[_0xd9e6('0x9d')](_0x491371,'id');_0x327f41=_[_0xd9e6('0x9e')](_0x327f41,{'model':db[_0xd9e6('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x45')]){_0x338dbb['attributes'][_0xd9e6('0x30')](function(_0x5a449f){_0x3a0135[_0xd9e6('0x4d')]('i.'+_0x5a449f);});}else{_0x3a0135['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd9e6('0x63'));_0x3a0135['field']('a.key',_0xd9e6('0x9f'));_0x3a0135[_0xd9e6('0x4d')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa0'),_0xd9e6('0x91'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa1'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa2'),_0xd9e6('0xa3'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa4'),'Contact.lastName');_0x3a0135['field'](_0xd9e6('0xa5'),_0xd9e6('0xa6'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa7'),_0xd9e6('0xa8'));_0x3a0135['field']('c.mobile','Contact.mobile');_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa9'),_0xd9e6('0xaa'));_0x3a0135['field'](_0xd9e6('0xab'),_0xd9e6('0xac'));_0x3a0135[_0xd9e6('0x4d')]('o.internal',_0xd9e6('0xad'));_0x3a0135[_0xd9e6('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x338dbb[_0xd9e6('0x20')])_0x3a0135[_0xd9e6('0x20')](_0x338dbb[_0xd9e6('0x20')]);if(_0x338dbb[_0xd9e6('0x1e')])_0x3a0135[_0xd9e6('0x1e')](_0x338dbb[_0xd9e6('0x1e')]);return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x3a0135[_0xd9e6('0x9b')](),_0x327f41);})[_0xd9e6('0x25')](function(_0x2360d2){if(_0x2360d2[_0xd9e6('0x46')]>0x0)_0x22aebe[_0xd9e6('0x4b')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xd9e6('0x2c')](_0x2360d2,'id'));return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x22aebe[_0xd9e6('0x9b')](),_0x327f41)[_0xd9e6('0x25')](function(_0x1ab2ed){var _0x13382e=_['groupBy'](_0x1ab2ed,'WhatsappInteractionId');var _0x2614d2=[];_0x2360d2[_0xd9e6('0x30')](function(_0x535562){_0x2614d2['push'](updateWhatsappInteraction(_0x535562,_0x1f2265,_0x13382e));});return BPromise[_0xd9e6('0xae')](_0x2614d2);});});})[_0xd9e6('0x25')](function(_0x4b71a3){_0x296ac2[_0xd9e6('0xaf')]=_0x4b71a3;return _0x296ac2;})[_0xd9e6('0x25')](respondWithFilteredResult(_0x5af9f9,_0x338dbb))['catch'](handleError(_0x5af9f9,null));};exports[_0xd9e6('0xb0')]=function(_0x23f04a,_0x9f20c6){var _0x3f8d80={'raw':![],'where':{'id':_0x23f04a['params']['id']}},_0x583acd={};_0x583acd[_0xd9e6('0x43')]=_[_0xd9e6('0x40')](db[_0xd9e6('0x3b')][_0xd9e6('0x3c')]);_0x583acd['query']=_[_0xd9e6('0x40')](_0x23f04a[_0xd9e6('0x3f')]);_0x583acd[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x583acd['model'],_0x583acd[_0xd9e6('0x3f')]);_0x3f8d80[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x583acd[_0xd9e6('0x43')],qs['fields'](_0x23f04a[_0xd9e6('0x3f')][_0xd9e6('0x45')]));_0x3f8d80[_0xd9e6('0x44')]=_0x3f8d80[_0xd9e6('0x44')][_0xd9e6('0x46')]?_0x3f8d80[_0xd9e6('0x44')]:_0x583acd[_0xd9e6('0x43')];if(_0x23f04a[_0xd9e6('0x3f')]['includeAll']){_0x3f8d80[_0xd9e6('0xb1')]=[{'all':!![]}];}_0x3f8d80=_[_0xd9e6('0x9e')]({},_0x3f8d80,_0x23f04a[_0xd9e6('0xb2')]);return db[_0xd9e6('0x3b')][_0xd9e6('0x62')](_0x3f8d80)[_0xd9e6('0x25')](handleEntityNotFound(_0x9f20c6,null))[_0xd9e6('0x25')](respondWithResult(_0x9f20c6,null))[_0xd9e6('0xb3')](handleError(_0x9f20c6,null));};exports[_0xd9e6('0xb4')]=function(_0x38d817,_0xd1568){return db['WhatsappInteraction'][_0xd9e6('0xb4')](_0x38d817['body'],{})[_0xd9e6('0x25')](respondWithResult(_0xd1568,0xc9))[_0xd9e6('0xb3')](handleError(_0xd1568,null));};exports[_0xd9e6('0x23')]=function(_0x4937bb,_0x34e5c1){if(_0x4937bb[_0xd9e6('0x76')]['id']){delete _0x4937bb[_0xd9e6('0x76')]['id'];}return db[_0xd9e6('0x3b')]['find']({'where':{'id':_0x4937bb[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x34e5c1,null))[_0xd9e6('0x25')](saveUpdates(_0x4937bb[_0xd9e6('0x76')],null))[_0xd9e6('0x25')](respondWithResult(_0x34e5c1,null))[_0xd9e6('0xb3')](handleError(_0x34e5c1,null));};exports[_0xd9e6('0x24')]=function(_0x1f3515,_0x35839f){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x1f3515[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x35839f,null))[_0xd9e6('0x25')](removeEntity(_0x35839f,null))[_0xd9e6('0xb3')](handleError(_0x35839f,null));};exports[_0xd9e6('0xb6')]=function(_0x2b3fd0,_0x3d7a3a){return db['WhatsappInteraction'][_0xd9e6('0xb6')]()[_0xd9e6('0x25')](respondWithResult(_0x3d7a3a,null))[_0xd9e6('0xb3')](handleError(_0x3d7a3a,null));};exports[_0xd9e6('0xb7')]=function(_0x5e93de,_0x3881dc,_0x2ddb49){return db[_0xd9e6('0xb8')][_0xd9e6('0x62')]({'where':{'id':_0x5e93de[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x3881dc,null))['then'](function(_0x128dfc){if(_0x128dfc){return _0x128dfc[_0xd9e6('0xb7')](_0x5e93de['body'][_0xd9e6('0xb9')],_[_0xd9e6('0xba')](_0x5e93de[_0xd9e6('0x76')],[_0xd9e6('0xb9'),'id'])||{});}})[_0xd9e6('0x25')](respondWithResult(_0x3881dc,null))[_0xd9e6('0xb3')](handleError(_0x3881dc,null));};exports['getMessages']=function(_0x5f1d5c,_0x3e3c4c,_0x5b9cee){var _0x88143a={'raw':![],'where':{}};var _0x35d57={};var _0x6f317d={'count':0x0,'rows':[]};return db[_0xd9e6('0x3b')][_0xd9e6('0xbb')]({'where':{'id':_0x5f1d5c[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x3e3c4c,null))[_0xd9e6('0x25')](function(_0x31e2b4){if(_0x31e2b4){_0x35d57[_0xd9e6('0x43')]=_[_0xd9e6('0x40')](db[_0xd9e6('0xb8')]['rawAttributes']);_0x35d57['query']=_[_0xd9e6('0x40')](_0x5f1d5c['query']);_0x35d57[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x35d57['model'],_0x35d57[_0xd9e6('0x3f')]);_0x88143a[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x35d57['model'],qs['fields'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x45')]));_0x88143a['attributes']=_0x88143a['attributes'][_0xd9e6('0x46')]?_0x88143a[_0xd9e6('0x44')]:_0x35d57['model'];if(!_0x5f1d5c['query'][_0xd9e6('0x47')](_0xd9e6('0x48'))){_0x88143a[_0xd9e6('0x20')]=qs['limit'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x20')]);_0x88143a[_0xd9e6('0x1e')]=qs['offset'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x1e')]);}_0x88143a[_0xd9e6('0x49')]=qs[_0xd9e6('0x4a')](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x4a')]);_0x88143a[_0xd9e6('0x4b')]=qs[_0xd9e6('0x41')](_[_0xd9e6('0x4c')](_0x5f1d5c[_0xd9e6('0x3f')],_0x35d57[_0xd9e6('0x41')]));_0x88143a[_0xd9e6('0x4b')]['WhatsappInteractionId']=_0x31e2b4['id'];if(_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x87')]){_0x88143a['where']=_['merge'](_0x88143a[_0xd9e6('0x4b')],{'$or':_[_0xd9e6('0x2c')](_0x88143a[_0xd9e6('0x44')],function(_0xad21dd){var _0xf33b0d={};_0xf33b0d[_0xad21dd]={'$like':'%'+_0x5f1d5c['query'][_0xd9e6('0x87')]+'%'};return _0xf33b0d;})});}if(_0x5f1d5c[_0xd9e6('0x3f')]['$gte']){var _0xa3e94b=_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0xbc')][_0xd9e6('0x2f')](',');var _0x294faa={};_0x294faa[_0xa3e94b[0x0]]={'$gte':moment(_0xa3e94b[0x1])[_0xd9e6('0xbd')](_0xd9e6('0xbe'))};_0x88143a['where']=_[_0xd9e6('0x9e')](_0x88143a[_0xd9e6('0x4b')],_0x294faa);}_0x88143a=_['merge']({},_0x88143a,_0x5f1d5c['options']);return db[_0xd9e6('0xb8')]['count']({'where':_0x88143a[_0xd9e6('0x4b')]})[_0xd9e6('0x25')](function(_0x5e480e){_0x6f317d[_0xd9e6('0x9c')]=_0x5e480e;if(_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0xbf')]){_0x88143a[_0xd9e6('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd9e6('0xc0')](_0x88143a);})[_0xd9e6('0x25')](function(_0x17c19d){_0x6f317d[_0xd9e6('0xaf')]=_0x17c19d;return _0x6f317d;});}})[_0xd9e6('0x25')](respondWithFilteredResult(_0x3e3c4c,_0x88143a))[_0xd9e6('0xb3')](handleError(_0x3e3c4c,null));};exports[_0xd9e6('0xc1')]=function(_0x49f2a1,_0xc11c88,_0x23eec1){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x49f2a1[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0xc11c88,null))[_0xd9e6('0x25')](function(_0x57a1ba){if(_0x57a1ba){return _0x57a1ba[_0xd9e6('0xc2')](_0x49f2a1[_0xd9e6('0x76')]['ids'],_[_0xd9e6('0xba')](_0x49f2a1[_0xd9e6('0x76')],['ids','id'])||{})['spread'](function(){return db[_0xd9e6('0x70')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x49f2a1['body'][_0xd9e6('0xb9')]}});})[_0xd9e6('0x25')](function(_0x4c5742){socket[_0xd9e6('0xc3')](_0xd9e6('0xc4'),{'id':Number(_0x49f2a1['params']['id']),'tags':_0x4c5742||[]});return{'id':Number(_0x49f2a1['params']['id']),'tags':_0x4c5742||[]};});}})[_0xd9e6('0x25')](respondWithResult(_0xc11c88,null))[_0xd9e6('0xb3')](handleError(_0xc11c88,null));};exports[_0xd9e6('0xc5')]=function(_0x1d75c2,_0x458227,_0x30fbba){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x1d75c2[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x458227,null))[_0xd9e6('0x25')](function(_0x48d7ac){if(_0x48d7ac){return _0x48d7ac['removeTags'](_0x1d75c2[_0xd9e6('0x3f')][_0xd9e6('0xb9')]);}})[_0xd9e6('0x25')](respondWithStatusCode(_0x458227,null))['catch'](handleError(_0x458227,null));};exports[_0xd9e6('0xc6')]=function(_0x19a357,_0x3e2cd0){var _0x40ea66=moment()['unix']()[_0xd9e6('0x9b')]();var _0x30fa97=path['join'](config[_0xd9e6('0xc7')],_0xd9e6('0xc8'),_0xd9e6('0xc9'),_0xd9e6('0xca'));var _0x58e884=path['join'](config[_0xd9e6('0xc7')],'server',_0xd9e6('0xc9'),'attachments');var _0x18c67b=path[_0xd9e6('0xcb')](_0x30fa97,_0x40ea66);var _0x6fb9b3=util['format'](_0xd9e6('0xcc'),_0x19a357[_0xd9e6('0xb5')]['id'],_0x40ea66);var _0x4111df=path[_0xd9e6('0xcb')](_0x30fa97,_0x6fb9b3);var _0x1daf5c=[];_0x1daf5c['push']({'model':db[_0xd9e6('0x73')],'as':'User','attributes':['id',_0xd9e6('0x2d')],'raw':!![]});_0x1daf5c[_0xd9e6('0x31')]({'model':db[_0xd9e6('0xcd')],'as':'Contact','attributes':['id',_0xd9e6('0xce'),_0xd9e6('0xcf')],'raw':!![]});if(_0x19a357[_0xd9e6('0x3f')][_0xd9e6('0xd0')]){_0x1daf5c[_0xd9e6('0x31')]({'model':db['Attachment'],'as':_0xd9e6('0xd1'),'raw':!![]});}var _0x5aeee6=[{'model':db[_0xd9e6('0xb8')],'as':_0xd9e6('0xd2'),'attributes':['id',_0xd9e6('0x76'),_0xd9e6('0x7c'),_0xd9e6('0xd3'),_0xd9e6('0xd4'),_0xd9e6('0x83')],'include':_0x1daf5c}];_0x5aeee6[_0xd9e6('0x31')]({'model':db[_0xd9e6('0xd5')],'as':_0xd9e6('0xd6'),'attributes':['id',_0xd9e6('0x29')]});_0x5aeee6[_0xd9e6('0x31')]({'model':db[_0xd9e6('0x73')],'as':_0xd9e6('0xd7'),'attributes':['id',_0xd9e6('0x2d')]});return db['WhatsappInteraction'][_0xd9e6('0x62')]({'where':{'id':_0x19a357[_0xd9e6('0xb5')]['id']},'include':_0x5aeee6})['then'](handleEntityNotFound(_0x3e2cd0,null))[_0xd9e6('0x25')](function(_0x2d9625){if(_0x2d9625){var _0x2df41a=_0x2d9625[_0xd9e6('0xd8')]({'plain':!![]});fs[_0xd9e6('0xd9')](_0x18c67b);var _0x2cfbfa={'channel':'Whatsapp','account':_0x2df41a[_0xd9e6('0xd6')][_0xd9e6('0x29')],'agent':_0x2df41a['Owner']?_0x2df41a[_0xd9e6('0xd7')][_0xd9e6('0x2d')]:_0xd9e6('0xda'),'createdAt':moment(_0x2df41a[_0xd9e6('0x7c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9e6('0x9b')](),'closedAt':_0x2df41a[_0xd9e6('0x39')]?moment(_0x2df41a[_0xd9e6('0xdb')])['format'](_0xd9e6('0xbe'))[_0xd9e6('0x9b')]():'','disposition':_0x2df41a[_0xd9e6('0xdc')],'messages':_(_0x2df41a[_0xd9e6('0xd2')])[_0xd9e6('0x87')]({'secret':![]})[_0xd9e6('0x2c')](function(_0x13bd4d){if(_0x13bd4d[_0xd9e6('0xd1')]){var _0x5d8a32=path[_0xd9e6('0xcb')](_0x58e884,_0x13bd4d[_0xd9e6('0xd1')][_0xd9e6('0xdd')]);if(fs[_0xd9e6('0xde')](_0x5d8a32)){fs[_0xd9e6('0xdf')](_0x5d8a32)[_0xd9e6('0xe0')](fs[_0xd9e6('0xe1')](path[_0xd9e6('0xcb')](_0x18c67b,_0x13bd4d['Attachment']['basename'])));}}return{'date':moment(_0x13bd4d[_0xd9e6('0x7c')])[_0xd9e6('0xbd')](_0xd9e6('0xbe'))['toString'](),'sender':_0x13bd4d['direction']===_0xd9e6('0xe2')?_0x13bd4d[_0xd9e6('0x73')]?_0x13bd4d[_0xd9e6('0x73')][_0xd9e6('0x2d')]:_0xd9e6('0xe3'):_0x13bd4d[_0xd9e6('0xe4')][_0xd9e6('0xce')]+(_0x13bd4d['Contact']['lastName']?'\x20'+_0x13bd4d[_0xd9e6('0xe4')]['lastName']:''),'body':_0x13bd4d[_0xd9e6('0xd1')]?_0x13bd4d[_0xd9e6('0xd1')]['basename']:_0x13bd4d[_0xd9e6('0x76')],'direction':_0x13bd4d[_0xd9e6('0xd3')]==='out'?'A':'C','secret':_0x13bd4d[_0xd9e6('0xd4')],'read':_0x13bd4d[_0xd9e6('0x83')],'attachment':_0x13bd4d['Attachment']};})['value']()};return ejs[_0xd9e6('0xe5')](path[_0xd9e6('0xcb')](config[_0xd9e6('0xc7')],'server',_0xd9e6('0xe6'),_0xd9e6('0xe7')),{'interaction':_0x2cfbfa})[_0xd9e6('0x25')](function(_0x1ff304){var _0x286b7e=path['join'](_0x18c67b,'transcript-'+_0x2df41a['id']+'-'+_0x40ea66+'.pdf');var _0x1ae6c5={'path':_0x286b7e,'channel':'Whatsapp','interactionId':_0x2df41a['id']};return pdf[_0xd9e6('0xe8')](_0x1ff304,_0x1ae6c5);})[_0xd9e6('0x25')](function(){return new BPromise(function(_0x142c84,_0x2ef382){zipdir(_0x18c67b,{'saveTo':_0x4111df},function(_0x2d4d26,_0x3fe8eb){if(_0x2d4d26)return _0x2ef382(_0x2d4d26);return _0x142c84(_0x3fe8eb);});})['then'](function(){return new BPromise(function(_0x3fa329,_0x2919f9){rimraf(_0x18c67b,function(_0x23c5bc){if(_0x23c5bc)_0x2919f9(_0x23c5bc);return _0x3fa329();});});})[_0xd9e6('0x25')](function(){return _0x3e2cd0['download'](_0x4111df,_0x6fb9b3,function(_0x2695c9){if(_0x2695c9){console['log']('err',_0x2695c9);}else{fs[_0xd9e6('0xe9')](_0x4111df);}});});});}else{return _0x3e2cd0[_0xd9e6('0x1b')](0xc8);}})[_0xd9e6('0xb3')](handleError(_0x3e2cd0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 26017d8..ee46e28 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 _0x557d=['Users','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','getUsers','then'];(function(_0x2b0f23,_0x2e26f5){var _0x357f54=function(_0x44a8c4){while(--_0x44a8c4){_0x2b0f23['push'](_0x2b0f23['shift']());}};_0x357f54(++_0x2e26f5);}(_0x557d,0xcb));var _0xd557=function(_0x1a4e9f,_0x2760b1){_0x1a4e9f=_0x1a4e9f-0x0;var _0x4a2e65=_0x557d[_0x1a4e9f];return _0x4a2e65;};'use strict';var EventEmitter=require(_0xd557('0x0'));var WhatsappInteraction=require(_0xd557('0x1'))['db'][_0xd557('0x2')];var WhatsappMessage=require(_0xd557('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd557('0x3'),'afterUpdate':_0xd557('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f19d7){return function(_0x479940,_0x7f3f34,_0x598348){_0x479940[_0xd557('0x5')]({'attributes':['id'],'raw':!![]})[_0xd557('0x6')](function(_0x21173d){_0x479940['setDataValue'](_0xd557('0x7'),_0x21173d['map'](function(_0x1379a1){return{'id':_0x1379a1['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x479940['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x68af0d){_0x479940[_0xd557('0x8')](_0xd557('0x9'),_0x68af0d[_0xd557('0xa')]);WhatsappInteractionEvents[_0xd557('0xb')](_0x5f19d7+':'+_0x479940['id'],_0x479940);WhatsappInteractionEvents[_0xd557('0xb')](_0x5f19d7,_0x479940);_0x598348(null);})['catch'](_0x598348(null));};}for(var e in events){if(events[_0xd557('0xc')](e)){var event=events[e];WhatsappInteraction[_0xd557('0xd')](e,emitEvent(event));}}module[_0xd557('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0cfa=['then','setDataValue','map','findAll','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','update'];(function(_0x192ab8,_0x2b761e){var _0x135616=function(_0x3bf01a){while(--_0x3bf01a){_0x192ab8['push'](_0x192ab8['shift']());}};_0x135616(++_0x2b761e);}(_0x0cfa,0x18f));var _0xa0cf=function(_0xda5060,_0x328a73){_0xda5060=_0xda5060-0x0;var _0x5ab625=_0x0cfa[_0xda5060];return _0x5ab625;};'use strict';var EventEmitter=require(_0xa0cf('0x0'));var WhatsappInteraction=require(_0xa0cf('0x1'))['db'][_0xa0cf('0x2')];var WhatsappMessage=require(_0xa0cf('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0cf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x469112){return function(_0x1a6281,_0x19f827,_0x2d61de){_0x1a6281['getUsers']({'attributes':['id'],'raw':!![]})[_0xa0cf('0x4')](function(_0x5d9035){_0x1a6281[_0xa0cf('0x5')]('Users',_0x5d9035[_0xa0cf('0x6')](function(_0x4855d0){return{'id':_0x4855d0['id']};}));return WhatsappMessage[_0xa0cf('0x7')]({'where':{'WhatsappInteractionId':_0x1a6281['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa0cf('0x4')](function(_0x354eab){_0x1a6281['setDataValue'](_0xa0cf('0x8'),_0x354eab[_0xa0cf('0x9')]);WhatsappInteractionEvents['emit'](_0x469112+':'+_0x1a6281['id'],_0x1a6281);WhatsappInteractionEvents['emit'](_0x469112,_0x1a6281);_0x2d61de(null);})[_0xa0cf('0xa')](_0x2d61de(null));};}for(var e in events){if(events[_0xa0cf('0xb')](e)){var event=events[e];WhatsappInteraction[_0xa0cf('0xc')](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 7beb561..1e02273 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 _0x0cf9=['./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41d468,_0x51b397){var _0x3bf7ad=function(_0x1e4219){while(--_0x1e4219){_0x41d468['push'](_0x41d468['shift']());}};_0x3bf7ad(++_0x51b397);}(_0x0cf9,0x125));var _0x90cf=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x0cf9[_0x4b03d3];return _0x58a968;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x90cf('0x0'));var moment=require(_0x90cf('0x1'));var BPromise=require(_0x90cf('0x2'));var rp=require(_0x90cf('0x3'));var fs=require('fs');var path=require(_0x90cf('0x4'));var rimraf=require(_0x90cf('0x5'));var config=require(_0x90cf('0x6'));var attributes=require(_0x90cf('0x7'));module[_0x90cf('0x8')]=function(_0xf56e07,_0x38ba21){return _0xf56e07[_0x90cf('0x9')](_0x90cf('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17ae52,_0x47bd6f,_0x3f6da4){if(_0x17ae52[_0x90cf('0xb')](_0x90cf('0xc'))){_0x17ae52['closedAt']=moment()[_0x90cf('0xd')](_0x90cf('0xe'));}_0x3f6da4(null,_0x17ae52);}}});}; \ No newline at end of file +var _0xb98b=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xb98b,0x144));var _0xbb98=function(_0x491df8,_0x450301){_0x491df8=_0x491df8-0x0;var _0x4a53e7=_0xb98b[_0x491df8];return _0x4a53e7;};'use strict';var _=require(_0xbb98('0x0'));var util=require(_0xbb98('0x1'));var logger=require(_0xbb98('0x2'))(_0xbb98('0x3'));var moment=require('moment');var BPromise=require(_0xbb98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb98('0x5'));var rimraf=require('rimraf');var config=require(_0xbb98('0x6'));var attributes=require(_0xbb98('0x7'));module['exports']=function(_0x42a7e0,_0x1bab20){return _0x42a7e0[_0xbb98('0x8')](_0xbb98('0x9'),attributes,{'tableName':_0xbb98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be77a,_0x1cbe26,_0x5876b8){if(_0x4be77a[_0xbb98('0xb')](_0xbb98('0xc'))){_0x4be77a[_0xbb98('0xd')]=moment()[_0xbb98('0xe')](_0xbb98('0xf'));}_0x5876b8(null,_0x4be77a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 80c95b1..8a1d5eb 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 _0xb9e3=['AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','UpdateWhatsappInteraction','update','body','options','raw','attributes','limit','then','stringify','WhatsappInteraction','find','where','addTags','ids','spread'];(function(_0x5eb5ce,_0xeb9b44){var _0xaa7cf8=function(_0x379535){while(--_0x379535){_0x5eb5ce['push'](_0x5eb5ce['shift']());}};_0xaa7cf8(++_0xeb9b44);}(_0xb9e3,0x1b9));var _0x3b9e=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xb9e3[_0x1ee62e];return _0x27c6c8;};'use strict';var _=require(_0x3b9e('0x0'));var util=require(_0x3b9e('0x1'));var moment=require(_0x3b9e('0x2'));var BPromise=require(_0x3b9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b9e('0x5'));var logger=require('../../config/logger')(_0x3b9e('0x6'));var config=require(_0x3b9e('0x7'));var jayson=require(_0x3b9e('0x8'));var client=jayson[_0x3b9e('0x9')]['http']({'port':0x232a});config[_0x3b9e('0xa')]=_[_0x3b9e('0xb')](config['redis'],{'host':_0x3b9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b9e('0xa')]));require(_0x3b9e('0xd'))[_0x3b9e('0xe')](socket);function respondWithRpcPromise(_0xe76b47,_0x2346ab,_0x4ff0fd){return new BPromise(function(_0x170cd8,_0x2414bb){return client['request'](_0xe76b47,_0x4ff0fd)['then'](function(_0x5c80a2){logger[_0x3b9e('0xf')](_0x3b9e('0x10'),_0x2346ab,'request\x20sent');logger[_0x3b9e('0x11')](_0x3b9e('0x12'),_0x2346ab,_0x3b9e('0x13'),JSON['stringify'](_0x5c80a2));if(_0x5c80a2['error']){if(_0x5c80a2['error'][_0x3b9e('0x14')]===0x1f4){logger[_0x3b9e('0x15')](_0x3b9e('0x10'),_0x2346ab,_0x5c80a2['error'][_0x3b9e('0x16')]);return _0x2414bb(_0x5c80a2[_0x3b9e('0x15')]['message']);}logger['error'](_0x3b9e('0x10'),_0x2346ab,_0x5c80a2[_0x3b9e('0x15')]['message']);return _0x170cd8(_0x5c80a2[_0x3b9e('0x15')][_0x3b9e('0x16')]);}else{logger[_0x3b9e('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x2346ab,_0x3b9e('0x13'));_0x170cd8(_0x5c80a2[_0x3b9e('0x17')][_0x3b9e('0x16')]);}})['catch'](function(_0x2cdeb7){logger[_0x3b9e('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x2346ab,_0x2cdeb7);_0x2414bb(_0x2cdeb7);});});}exports[_0x3b9e('0x18')]=function(_0x1a6198){var _0x2be801=this;return new Promise(function(_0x13e786,_0xca7c1a){return db['WhatsappInteraction'][_0x3b9e('0x19')](_0x1a6198[_0x3b9e('0x1a')],{'raw':_0x1a6198[_0x3b9e('0x1b')]?_0x1a6198['options'][_0x3b9e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a6198['options']?_0x1a6198[_0x3b9e('0x1b')]['where']||null:null,'attributes':_0x1a6198[_0x3b9e('0x1b')]?_0x1a6198[_0x3b9e('0x1b')][_0x3b9e('0x1d')]||null:null,'limit':_0x1a6198[_0x3b9e('0x1b')]?_0x1a6198['options'][_0x3b9e('0x1e')]||null:null})[_0x3b9e('0x1f')](function(_0x12baf7){logger[_0x3b9e('0xf')](_0x3b9e('0x18'),_0x1a6198);logger[_0x3b9e('0x11')](_0x3b9e('0x18'),_0x1a6198,JSON[_0x3b9e('0x20')](_0x12baf7));_0x13e786(_0x12baf7);})['catch'](function(_0x5e5728){logger[_0x3b9e('0x15')](_0x3b9e('0x18'),_0x5e5728[_0x3b9e('0x16')],_0x1a6198);_0xca7c1a(_0x2be801['error'](0x1f4,_0x5e5728[_0x3b9e('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1e7b2a){return new Promise(function(_0x501a8f,_0x461114){return db[_0x3b9e('0x21')][_0x3b9e('0x22')]({'where':_0x1e7b2a[_0x3b9e('0x1b')]?_0x1e7b2a[_0x3b9e('0x1b')][_0x3b9e('0x23')]||null:null})['then'](function(_0xee5b33){if(_0xee5b33){return _0xee5b33[_0x3b9e('0x24')](_0x1e7b2a[_0x3b9e('0x1a')][_0x3b9e('0x25')],_['omit'](_0x1e7b2a[_0x3b9e('0x1a')],[_0x3b9e('0x25'),'id'])||{});}})[_0x3b9e('0x26')](function(_0x337964){logger['info'](_0x3b9e('0x27'),_0x1e7b2a);logger[_0x3b9e('0x11')](_0x3b9e('0x27'),_0x1e7b2a,JSON[_0x3b9e('0x20')](_0x337964));_0x501a8f(_0x337964);})['catch'](function(_0x11150b){logger[_0x3b9e('0x15')](_0x3b9e('0x27'),_0x11150b[_0x3b9e('0x16')],_0x1e7b2a);_0x461114(_this['error'](0x1f4,_0x11150b['message']));});});}; \ No newline at end of file +var _0x148e=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','register','request','then','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToWhatsappInteraction','addTags','ids','omit','spread'];(function(_0x2906cf,_0x4f1d9d){var _0x4aea48=function(_0x9a7d3b){while(--_0x9a7d3b){_0x2906cf['push'](_0x2906cf['shift']());}};_0x4aea48(++_0x4f1d9d);}(_0x148e,0x7f));var _0xe148=function(_0x3f7861,_0x13619b){_0x3f7861=_0x3f7861-0x0;var _0x36fdae=_0x148e[_0x3f7861];return _0x36fdae;};'use strict';var _=require(_0xe148('0x0'));var util=require(_0xe148('0x1'));var moment=require(_0xe148('0x2'));var BPromise=require(_0xe148('0x3'));var rs=require(_0xe148('0x4'));var fs=require('fs');var Redis=require(_0xe148('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe148('0x6'));var logger=require(_0xe148('0x7'))('rpc');var config=require(_0xe148('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe148('0x9')]['http']({'port':0x232a});config[_0xe148('0xa')]=_[_0xe148('0xb')](config[_0xe148('0xa')],{'host':_0xe148('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xe148('0xd')](socket);function respondWithRpcPromise(_0x520b89,_0x44f8d8,_0x23089c){return new BPromise(function(_0x28e247,_0x4a7b40){return client[_0xe148('0xe')](_0x520b89,_0x23089c)[_0xe148('0xf')](function(_0x59b103){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x44f8d8,'request\x20sent');logger[_0xe148('0x10')](_0xe148('0x11'),_0x44f8d8,'request\x20sent',JSON[_0xe148('0x12')](_0x59b103));if(_0x59b103[_0xe148('0x13')]){if(_0x59b103[_0xe148('0x13')][_0xe148('0x14')]===0x1f4){logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x59b103[_0xe148('0x13')]['message']);return _0x4a7b40(_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);}logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);return _0x28e247(_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);}else{logger['info'](_0xe148('0x15'),_0x44f8d8,_0xe148('0x17'));_0x28e247(_0x59b103[_0xe148('0x18')][_0xe148('0x16')]);}})[_0xe148('0x19')](function(_0x174fb5){logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x174fb5);_0x4a7b40(_0x174fb5);});});}exports[_0xe148('0x1a')]=function(_0x45206c){var _0x32857a=this;return new Promise(function(_0x7fd733,_0xda5b7){return db[_0xe148('0x1b')][_0xe148('0x1c')](_0x45206c[_0xe148('0x1d')],{'raw':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x20')]||null:null,'attributes':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x21')]||null:null,'limit':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x22')]||null:null})[_0xe148('0xf')](function(_0x57f113){logger[_0xe148('0x23')]('UpdateWhatsappInteraction',_0x45206c);logger[_0xe148('0x10')](_0xe148('0x1a'),_0x45206c,JSON[_0xe148('0x12')](_0x57f113));_0x7fd733(_0x57f113);})['catch'](function(_0x5ceb87){logger[_0xe148('0x13')](_0xe148('0x1a'),_0x5ceb87[_0xe148('0x16')],_0x45206c);_0xda5b7(_0x32857a[_0xe148('0x13')](0x1f4,_0x5ceb87[_0xe148('0x16')]));});});};exports[_0xe148('0x24')]=function(_0x985d37){return new Promise(function(_0x181a51,_0x3e9b80){return db[_0xe148('0x1b')]['find']({'where':_0x985d37[_0xe148('0x1e')]?_0x985d37['options'][_0xe148('0x20')]||null:null})['then'](function(_0x4de715){if(_0x4de715){return _0x4de715[_0xe148('0x25')](_0x985d37['body'][_0xe148('0x26')],_[_0xe148('0x27')](_0x985d37[_0xe148('0x1d')],[_0xe148('0x26'),'id'])||{});}})[_0xe148('0x28')](function(_0x70e0f0){logger[_0xe148('0x23')](_0xe148('0x29'),_0x985d37);logger[_0xe148('0x10')](_0xe148('0x29'),_0x985d37,JSON['stringify'](_0x70e0f0));_0x181a51(_0x70e0f0);})[_0xe148('0x19')](function(_0x249855){logger['error'](_0xe148('0x29'),_0x249855[_0xe148('0x16')],_0x985d37);_0x3e9b80(_this[_0xe148('0x13')](0x1f4,_0x249855[_0xe148('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index abd0676..4b30675 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 _0x9788=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','emit','removeListener'];(function(_0x410680,_0x450b2d){var _0x49dc01=function(_0x34cd93){while(--_0x34cd93){_0x410680['push'](_0x410680['shift']());}};_0x49dc01(++_0x450b2d);}(_0x9788,0xf1));var _0x8978=function(_0x40f611,_0xb625f0){_0x40f611=_0x40f611-0x0;var _0x1962c2=_0x9788[_0x40f611];return _0x1962c2;};'use strict';var WhatsappInteractionEvents=require(_0x8978('0x0'));var events=[_0x8978('0x1'),'remove','update'];function createListener(_0x852c1a,_0x3f89e3){return function(_0x12990b){_0x3f89e3[_0x8978('0x2')](_0x852c1a,_0x12990b);};}function removeListener(_0x3f08e8,_0x8687b){return function(){WhatsappInteractionEvents[_0x8978('0x3')](_0x3f08e8,_0x8687b);};}exports[_0x8978('0x4')]=function(_0x4289ff){for(var _0x21ddcf=0x0,_0x3cea5b=events[_0x8978('0x5')];_0x21ddcf<_0x3cea5b;_0x21ddcf++){var _0x3b1d91=events[_0x21ddcf];var _0x50ba59=createListener(_0x8978('0x6')+_0x3b1d91,_0x4289ff);WhatsappInteractionEvents['on'](_0x3b1d91,_0x50ba59);}}; \ No newline at end of file +var _0xa340=['removeListener','register','length','./whatsappInteraction.events','save','remove','update'];(function(_0x4120fa,_0x44b9b9){var _0xd21c30=function(_0x24a89f){while(--_0x24a89f){_0x4120fa['push'](_0x4120fa['shift']());}};_0xd21c30(++_0x44b9b9);}(_0xa340,0x145));var _0x0a34=function(_0x346039,_0x4dda34){_0x346039=_0x346039-0x0;var _0x5467ac=_0xa340[_0x346039];return _0x5467ac;};'use strict';var WhatsappInteractionEvents=require(_0x0a34('0x0'));var events=[_0x0a34('0x1'),_0x0a34('0x2'),_0x0a34('0x3')];function createListener(_0x455a54,_0x830c58){return function(_0xd9461d){_0x830c58['emit'](_0x455a54,_0xd9461d);};}function removeListener(_0x10a0ef,_0x79d131){return function(){WhatsappInteractionEvents[_0x0a34('0x4')](_0x10a0ef,_0x79d131);};}exports[_0x0a34('0x5')]=function(_0x235a03){for(var _0x3e134f=0x0,_0x3ba204=events[_0x0a34('0x6')];_0x3e134f<_0x3ba204;_0x3e134f++){var _0x545ce0=events[_0x3e134f];var _0x1bc78b=createListener('whatsappInteraction:'+_0x545ce0,_0x235a03);WhatsappInteractionEvents['on'](_0x545ce0,_0x1bc78b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index dacb7b8..b821fc2 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 _0xa31e=['reject','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa31e,0xb8));var _0xea31=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0xa31e[_0x395667];return _0x5cdb8f;};'use strict';var multer=require(_0xea31('0x0'));var util=require(_0xea31('0x1'));var path=require(_0xea31('0x2'));var timeout=require(_0xea31('0x3'));var express=require(_0xea31('0x4'));var router=express['Router']();var fs_extra=require(_0xea31('0x5'));var auth=require(_0xea31('0x6'));var interaction=require(_0xea31('0x7'));var config=require(_0xea31('0x8'));var controller=require('./whatsappMessage.controller');router[_0xea31('0x9')]('/',auth[_0xea31('0xa')](),controller['index']);router['get'](_0xea31('0xb'),auth[_0xea31('0xa')](),controller[_0xea31('0xc')]);router[_0xea31('0x9')](_0xea31('0xd'),auth[_0xea31('0xa')](),controller['show']);router[_0xea31('0xe')]('/',auth[_0xea31('0xa')](),interaction[_0xea31('0xf')](_0xea31('0x10'),_0xea31('0x11')),controller[_0xea31('0x12')]);router[_0xea31('0xe')]('/:id/status',controller['status']);router['put'](_0xea31('0xd'),auth['isAuthenticated'](),controller[_0xea31('0x13')]);router[_0xea31('0x14')](_0xea31('0x15'),auth[_0xea31('0xa')](),controller[_0xea31('0x16')]);router[_0xea31('0x14')](_0xea31('0x17'),auth['isAuthenticated'](),controller[_0xea31('0x18')]);router[_0xea31('0x19')](_0xea31('0xd'),auth[_0xea31('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ab8=['update','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put'];(function(_0x51562e,_0x112fe1){var _0x3a9faa=function(_0x455b11){while(--_0x455b11){_0x51562e['push'](_0x51562e['shift']());}};_0x3a9faa(++_0x112fe1);}(_0x9ab8,0x1d6));var _0x89ab=function(_0x561697,_0x4950fe){_0x561697=_0x561697-0x0;var _0x227572=_0x9ab8[_0x561697];return _0x227572;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require(_0x89ab('0x2'));var timeout=require(_0x89ab('0x3'));var express=require(_0x89ab('0x4'));var router=express[_0x89ab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x6'));var interaction=require(_0x89ab('0x7'));var config=require(_0x89ab('0x8'));var controller=require('./whatsappMessage.controller');router[_0x89ab('0x9')]('/',auth[_0x89ab('0xa')](),controller[_0x89ab('0xb')]);router[_0x89ab('0x9')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xd')]);router[_0x89ab('0x9')](_0x89ab('0xe'),auth['isAuthenticated'](),controller[_0x89ab('0xf')]);router[_0x89ab('0x10')]('/',auth[_0x89ab('0xa')](),interaction[_0x89ab('0x11')](_0x89ab('0x12'),_0x89ab('0x13')),controller[_0x89ab('0x14')]);router[_0x89ab('0x10')](_0x89ab('0x15'),controller['status']);router[_0x89ab('0x16')]('/:id',auth[_0x89ab('0xa')](),controller[_0x89ab('0x17')]);router['put'](_0x89ab('0x18'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x19')]);router[_0x89ab('0x16')]('/:id/reject',auth['isAuthenticated'](),controller[_0x89ab('0x1a')]);router[_0x89ab('0x1b')](_0x89ab('0xe'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3bd3758..7f8295b 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 _0x567c=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x28deaf,_0x1b06ec){var _0x29809a=function(_0x4b8f00){while(--_0x4b8f00){_0x28deaf['push'](_0x28deaf['shift']());}};_0x29809a(++_0x1b06ec);}(_0x567c,0x8d));var _0xc567=function(_0x39551c,_0x249ec1){_0x39551c=_0x39551c-0x0;var _0x120d02=_0x567c[_0x39551c];return _0x120d02;};'use strict';var Sequelize=require(_0xc567('0x0'));module[_0xc567('0x1')]={'body':{'type':Sequelize[_0xc567('0x2')](_0xc567('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc567('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc567('0x5')]('in',_0xc567('0x6')),'defaultValue':_0xc567('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc567('0x7')](0xbe)},'phone':{'type':Sequelize[_0xc567('0x7')]},'readAt':{'type':Sequelize[_0xc567('0x8')]},'secret':{'type':Sequelize[_0xc567('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc567('0x7')]},'providerResponse':{'type':Sequelize[_0xc567('0x2')]}}; \ No newline at end of file +var _0x7bae=['DATE','BOOLEAN','exports','TEXT','medium','out','STRING'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0x7bae,0xaa));var _0xe7ba=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7bae[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0xe7ba('0x0')]={'body':{'type':Sequelize[_0xe7ba('0x1')](_0xe7ba('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe7ba('0x3')),'defaultValue':_0xe7ba('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe7ba('0x4')]},'readAt':{'type':Sequelize[_0xe7ba('0x5')]},'secret':{'type':Sequelize[_0xe7ba('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe7ba('0x4')]},'providerResponse':{'type':Sequelize[_0xe7ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c66daf0..6a20984 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 _0xbd32=['message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','body','find','params','describe','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteractionId','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','fullname','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1b5f7f,_0x44c200){var _0x26a3db=function(_0x4f547f){while(--_0x4f547f){_0x1b5f7f['push'](_0x1b5f7f['shift']());}};_0x26a3db(++_0x44c200);}(_0xbd32,0xee));var _0x2bd3=function(_0x1cf516,_0x2d2305){_0x1cf516=_0x1cf516-0x0;var _0x188f04=_0xbd32[_0x1cf516];return _0x188f04;};'use strict';var emlformat=require(_0x2bd3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2bd3('0x1'));var rp=require(_0x2bd3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2bd3('0x3'));var util=require(_0x2bd3('0x4'));var path=require(_0x2bd3('0x5'));var sox=require(_0x2bd3('0x6'));var csv=require(_0x2bd3('0x7'));var ejs=require(_0x2bd3('0x8'));var fs=require('fs');var fs_extra=require(_0x2bd3('0x9'));var _=require(_0x2bd3('0xa'));var squel=require(_0x2bd3('0xb'));var crypto=require(_0x2bd3('0xc'));var jsforce=require(_0x2bd3('0xd'));var deskjs=require(_0x2bd3('0xe'));var toCsv=require(_0x2bd3('0x7'));var querystring=require(_0x2bd3('0xf'));var Papa=require(_0x2bd3('0x10'));var Redis=require(_0x2bd3('0x11'));var authService=require(_0x2bd3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bd3('0x13'))(_0x2bd3('0x14'));var utils=require('../../config/utils');var config=require(_0x2bd3('0x15'));var licenseUtil=require(_0x2bd3('0x16'));var db=require(_0x2bd3('0x17'))['db'];config[_0x2bd3('0x18')]=_[_0x2bd3('0x19')](config[_0x2bd3('0x18')],{'host':_0x2bd3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2bd3('0x1b'))[_0x2bd3('0x1c')](socket);var jayson=require(_0x2bd3('0x1d'));var client=jayson['client'][_0x2bd3('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x2bd3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4f2f34,_0x49945a,_0x1099d1,_0x40142c){return new BPromise(function(_0x1842fb,_0x2141e6){var _0x14b1ef=_0x40142c||client;return _0x14b1ef[_0x2bd3('0x1f')](_0x4f2f34,_0x1099d1)[_0x2bd3('0x20')](function(_0xc87a72){logger[_0x2bd3('0x21')](_0x2bd3('0x22'),_0x49945a,_0x2bd3('0x23'));logger[_0x2bd3('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x49945a,_0x2bd3('0x23'),JSON['stringify'](_0xc87a72));if(_0xc87a72[_0x2bd3('0x25')]){if(_0xc87a72[_0x2bd3('0x25')]['code']===0x1f4){logger[_0x2bd3('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x49945a,_0xc87a72['error'][_0x2bd3('0x26')]);return _0x2141e6(_0xc87a72[_0x2bd3('0x25')][_0x2bd3('0x26')]);}logger[_0x2bd3('0x25')](_0x2bd3('0x22'),_0x49945a,_0xc87a72[_0x2bd3('0x25')][_0x2bd3('0x26')]);return _0x1842fb(_0xc87a72[_0x2bd3('0x25')][_0x2bd3('0x26')]);}else{logger[_0x2bd3('0x21')](_0x2bd3('0x22'),_0x49945a,_0x2bd3('0x23'));_0x1842fb(_0xc87a72[_0x2bd3('0x27')][_0x2bd3('0x26')]);}})[_0x2bd3('0x28')](function(_0x261bc2){logger['error'](_0x2bd3('0x22'),_0x49945a,_0x261bc2);_0x2141e6(_0x261bc2);});});}function respondWithStatusCode(_0x1efb77,_0x142814){_0x142814=_0x142814||0xcc;return function(_0x252c52){if(_0x252c52){return _0x1efb77[_0x2bd3('0x29')](_0x142814);}return _0x1efb77[_0x2bd3('0x2a')](_0x142814)[_0x2bd3('0x2b')]();};}function respondWithResult(_0x3e0ce4,_0x56e3e1){_0x56e3e1=_0x56e3e1||0xc8;return function(_0x379767){if(_0x379767){return _0x3e0ce4[_0x2bd3('0x2a')](_0x56e3e1)['json'](_0x379767);}};}function respondWithFilteredResult(_0x5854a3,_0x3818d0){return function(_0x1b054e){if(_0x1b054e){var _0x47c8ae=typeof _0x3818d0[_0x2bd3('0x2c')]===_0x2bd3('0x2d')&&typeof _0x3818d0['limit']===_0x2bd3('0x2d');var _0x19dc9c=_0x1b054e['count'];var _0x278bfe=_0x47c8ae?0x0:_0x3818d0[_0x2bd3('0x2c')];var _0x2b85e9=_0x47c8ae?_0x1b054e[_0x2bd3('0x2e')]:_0x3818d0['offset']+_0x3818d0[_0x2bd3('0x2f')];var _0x373e45;if(_0x2b85e9>=_0x19dc9c){_0x2b85e9=_0x19dc9c;_0x373e45=0xc8;}else{_0x373e45=0xce;}_0x5854a3[_0x2bd3('0x2a')](_0x373e45);return _0x5854a3[_0x2bd3('0x30')](_0x2bd3('0x31'),_0x278bfe+'-'+_0x2b85e9+'/'+_0x19dc9c)['json'](_0x1b054e);}return null;};}function patchUpdates(_0x5c01a6){return function(_0x3da65c){try{jsonpatch[_0x2bd3('0x32')](_0x3da65c,_0x5c01a6,!![]);}catch(_0x15588b){return BPromise[_0x2bd3('0x33')](_0x15588b);}return _0x3da65c[_0x2bd3('0x34')]();};}function saveUpdates(_0x378023,_0x5db66b){return function(_0x339490){if(_0x339490){return _0x339490[_0x2bd3('0x35')](_0x378023)[_0x2bd3('0x20')](function(_0x1ecdf9){return _0x1ecdf9;});}return null;};}function removeEntity(_0x206b95,_0x4174ee){return function(_0x227e91){if(_0x227e91){return _0x227e91['destroy']()[_0x2bd3('0x20')](function(){_0x206b95[_0x2bd3('0x2a')](0xcc)[_0x2bd3('0x2b')]();});}};}function handleEntityNotFound(_0xcc6f4e,_0x44453f){return function(_0x41d9f8){if(!_0x41d9f8){_0xcc6f4e[_0x2bd3('0x29')](0x194);}return _0x41d9f8;};}function handleError(_0x53ddb0,_0x1b8847){_0x1b8847=_0x1b8847||0x1f4;return function(_0x58f1fc){logger['error'](_0x58f1fc[_0x2bd3('0x36')]);if(_0x58f1fc[_0x2bd3('0x37')]){delete _0x58f1fc[_0x2bd3('0x37')];}_0x53ddb0['status'](_0x1b8847)[_0x2bd3('0x38')](_0x58f1fc);};}exports[_0x2bd3('0x39')]=function(_0x3d4b60,_0x587c99){var _0xffa055={},_0x1b218d={},_0x15619f={'count':0x0,'rows':[]};var _0xcfc53=_[_0x2bd3('0x3a')](db[_0x2bd3('0x3b')]['rawAttributes'],function(_0x46aa92){return{'name':_0x46aa92[_0x2bd3('0x3c')],'type':_0x46aa92['type'][_0x2bd3('0x3d')]};});_0x1b218d[_0x2bd3('0x3e')]=_[_0x2bd3('0x3a')](_0xcfc53,_0x2bd3('0x37'));_0x1b218d[_0x2bd3('0x3f')]=_[_0x2bd3('0x40')](_0x3d4b60[_0x2bd3('0x3f')]);_0x1b218d[_0x2bd3('0x41')]=_['intersection'](_0x1b218d[_0x2bd3('0x3e')],_0x1b218d[_0x2bd3('0x3f')]);_0xffa055['attributes']=_[_0x2bd3('0x42')](_0x1b218d[_0x2bd3('0x3e')],qs[_0x2bd3('0x43')](_0x3d4b60[_0x2bd3('0x3f')]['fields']));_0xffa055['attributes']=_0xffa055[_0x2bd3('0x44')][_0x2bd3('0x45')]?_0xffa055['attributes']:_0x1b218d[_0x2bd3('0x3e')];if(!_0x3d4b60[_0x2bd3('0x3f')][_0x2bd3('0x46')](_0x2bd3('0x47'))){_0xffa055[_0x2bd3('0x2f')]=qs['limit'](_0x3d4b60[_0x2bd3('0x3f')]['limit']);_0xffa055[_0x2bd3('0x2c')]=qs[_0x2bd3('0x2c')](_0x3d4b60[_0x2bd3('0x3f')][_0x2bd3('0x2c')]);}_0xffa055[_0x2bd3('0x48')]=qs[_0x2bd3('0x49')](_0x3d4b60[_0x2bd3('0x3f')]['sort']);_0xffa055[_0x2bd3('0x4a')]=qs[_0x2bd3('0x41')](_[_0x2bd3('0x4b')](_0x3d4b60[_0x2bd3('0x3f')],_0x1b218d['filters']),_0xcfc53);if(_0x3d4b60[_0x2bd3('0x3f')][_0x2bd3('0x4c')]){_0xffa055[_0x2bd3('0x4a')]=_[_0x2bd3('0x4d')](_0xffa055[_0x2bd3('0x4a')],{'$or':_[_0x2bd3('0x3a')](_0xcfc53,function(_0x5511a4){if(_0x5511a4['type']!==_0x2bd3('0x4e')){var _0x368036={};_0x368036[_0x5511a4[_0x2bd3('0x37')]]={'$like':'%'+_0x3d4b60['query'][_0x2bd3('0x4c')]+'%'};return _0x368036;}})});}_0xffa055=_['merge']({},_0xffa055,_0x3d4b60[_0x2bd3('0x4f')]);var _0x5cad30={'where':_0xffa055[_0x2bd3('0x4a')]};return db[_0x2bd3('0x3b')]['count'](_0x5cad30)[_0x2bd3('0x20')](function(_0x4eb0ff){_0x15619f[_0x2bd3('0x2e')]=_0x4eb0ff;if(_0x3d4b60['query'][_0x2bd3('0x50')]){_0xffa055[_0x2bd3('0x51')]=[{'all':!![]}];}return db[_0x2bd3('0x3b')]['findAll'](_0xffa055);})['then'](function(_0x9b8020){_0x15619f[_0x2bd3('0x52')]=_0x9b8020;return _0x15619f;})[_0x2bd3('0x20')](respondWithFilteredResult(_0x587c99,_0xffa055))[_0x2bd3('0x28')](handleError(_0x587c99,null));};exports[_0x2bd3('0x53')]=function(_0x4fff16,_0x38c158){var _0x39d2a8={'raw':!![],'where':{'id':_0x4fff16['params']['id']}},_0x3567d3={};_0x3567d3[_0x2bd3('0x3e')]=_[_0x2bd3('0x40')](db[_0x2bd3('0x3b')][_0x2bd3('0x54')]);_0x3567d3[_0x2bd3('0x3f')]=_['keys'](_0x4fff16[_0x2bd3('0x3f')]);_0x3567d3[_0x2bd3('0x41')]=_[_0x2bd3('0x42')](_0x3567d3[_0x2bd3('0x3e')],_0x3567d3[_0x2bd3('0x3f')]);_0x39d2a8[_0x2bd3('0x44')]=_['intersection'](_0x3567d3[_0x2bd3('0x3e')],qs[_0x2bd3('0x43')](_0x4fff16['query'][_0x2bd3('0x43')]));_0x39d2a8[_0x2bd3('0x44')]=_0x39d2a8[_0x2bd3('0x44')][_0x2bd3('0x45')]?_0x39d2a8[_0x2bd3('0x44')]:_0x3567d3[_0x2bd3('0x3e')];if(_0x4fff16[_0x2bd3('0x3f')][_0x2bd3('0x50')]){_0x39d2a8[_0x2bd3('0x51')]=[{'all':!![]}];}_0x39d2a8=_[_0x2bd3('0x4d')]({},_0x39d2a8,_0x4fff16['options']);return db[_0x2bd3('0x3b')]['find'](_0x39d2a8)[_0x2bd3('0x20')](handleEntityNotFound(_0x38c158,null))['then'](respondWithResult(_0x38c158,null))[_0x2bd3('0x28')](handleError(_0x38c158,null));};exports['create']=function(_0x408071,_0x2dc248){return db[_0x2bd3('0x3b')]['create'](_0x408071[_0x2bd3('0x55')],{})[_0x2bd3('0x20')](respondWithResult(_0x2dc248,0xc9))['catch'](handleError(_0x2dc248,null));};exports[_0x2bd3('0x35')]=function(_0x227bd3,_0x29f363){if(_0x227bd3[_0x2bd3('0x55')]['id']){delete _0x227bd3[_0x2bd3('0x55')]['id'];}return db[_0x2bd3('0x3b')][_0x2bd3('0x56')]({'where':{'id':_0x227bd3[_0x2bd3('0x57')]['id']}})[_0x2bd3('0x20')](handleEntityNotFound(_0x29f363,null))[_0x2bd3('0x20')](saveUpdates(_0x227bd3[_0x2bd3('0x55')],null))[_0x2bd3('0x20')](respondWithResult(_0x29f363,null))[_0x2bd3('0x28')](handleError(_0x29f363,null));};exports['destroy']=function(_0x1b4e5f,_0x55ef6e){return db[_0x2bd3('0x3b')]['find']({'where':{'id':_0x1b4e5f[_0x2bd3('0x57')]['id']}})[_0x2bd3('0x20')](handleEntityNotFound(_0x55ef6e,null))['then'](removeEntity(_0x55ef6e,null))[_0x2bd3('0x28')](handleError(_0x55ef6e,null));};exports[_0x2bd3('0x58')]=function(_0x50098c,_0x111cc7){return db[_0x2bd3('0x3b')][_0x2bd3('0x58')]()[_0x2bd3('0x20')](respondWithResult(_0x111cc7,null))[_0x2bd3('0x28')](handleError(_0x111cc7,null));};var interaction_log=require(_0x2bd3('0x13'))(_0x2bd3('0x59'));exports[_0x2bd3('0x5a')]=function(_0x19d603,_0x1b1bc8,_0x340a8a){var _0x149f43={'agent':{},'channel':'whatsapp'};if(_0x19d603[_0x2bd3('0x55')]['id']){delete _0x19d603[_0x2bd3('0x55')]['id'];}_0x19d603['body']['read']=!![];_0x19d603[_0x2bd3('0x55')][_0x2bd3('0x5b')]=moment()[_0x2bd3('0x5c')](_0x2bd3('0x5d'));_0x19d603['body'][_0x2bd3('0x5e')]=_0x19d603['body'][_0x2bd3('0x5e')]||_0x19d603[_0x2bd3('0x5f')]['id'];_0x149f43['agent']['id']=_0x19d603[_0x2bd3('0x55')][_0x2bd3('0x5e')];return db[_0x2bd3('0x3b')][_0x2bd3('0x56')]({'where':{'id':_0x19d603[_0x2bd3('0x57')]['id'],'UserId':null}})[_0x2bd3('0x20')](handleEntityNotFound(_0x1b1bc8,null))[_0x2bd3('0x20')](saveUpdates(_0x19d603['body'],null))[_0x2bd3('0x20')](function(_0x437761){if(_0x437761){_0x149f43['message']=_0x437761['get']({'plain':!![]});return db['WhatsappInteraction'][_0x2bd3('0x56')]({'where':{'id':_0x437761[_0x2bd3('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1b1bc8,null))['then'](function(_0x3ce8ed){if(_0x3ce8ed){return _0x3ce8ed[_0x2bd3('0x35')]({'UserId':_0x19d603['body'][_0x2bd3('0x5e')],'read1stAt':_['isNil'](_0x3ce8ed['read1stAt'])?moment()[_0x2bd3('0x5c')](_0x2bd3('0x5d')):undefined});}return null;})[_0x2bd3('0x20')](function(_0x483325){if(_0x483325){_0x149f43['interaction']=_0x483325[_0x2bd3('0x61')]({'plain':!![]});interaction_log[_0x2bd3('0x21')](_0x2bd3('0x62'),_0x19d603[_0x2bd3('0x5f')]['id'],_0x19d603['user']['name'],_0x19d603['user']['role'],_0x149f43[_0x2bd3('0x63')]['id'],_0x19d603[_0x2bd3('0x55')]?JSON[_0x2bd3('0x64')](_0x19d603['body']):_0x2bd3('0x65'));return respondWithRpcPromise(_0x2bd3('0x66'),'acceptMessage',_0x149f43);}return null;})['then'](function(_0x717213){var _0x20465e=_0x2bd3('0x67')+_0x717213[_0x2bd3('0x26')][_0x2bd3('0x68')];return db[_0x2bd3('0x69')][_0x2bd3('0x3f')](_0x20465e,{'type':db[_0x2bd3('0x6a')]['QueryTypes'][_0x2bd3('0x6b')],'raw':!![]})[_0x2bd3('0x20')](function(_0x52d9e6){return _0x52d9e6;});})[_0x2bd3('0x20')](function(_0x22df93){if(_0x22df93){_0x149f43[_0x2bd3('0x26')]['contact']=_0x22df93[0x0];if(!_0x19d603['body'][_0x2bd3('0x5e')])return;return db[_0x2bd3('0x6c')]['find']({'where':{'id':_0x19d603[_0x2bd3('0x55')][_0x2bd3('0x5e')],'role':_0x2bd3('0x6d')},'attributes':['id',_0x2bd3('0x37'),'fullname',_0x2bd3('0x6e'),_0x2bd3('0x6f')],'raw':!![]});}return null;})['then'](function(_0x524ce2){if(!_0x524ce2)return null;_0x149f43[_0x2bd3('0x26')][_0x2bd3('0x6d')]=_0x524ce2;return _0x149f43;})[_0x2bd3('0x20')](function(_0x3e10d5){if(_0x3e10d5){if(_0x19d603[_0x2bd3('0x55')]['manual']){_0x149f43[_0x2bd3('0x26')][_0x2bd3('0x70')]=util['format'](_0x2bd3('0x71'),_0x19d603[_0x2bd3('0x5f')][_0x2bd3('0x37')]);_0x149f43[_0x2bd3('0x26')][_0x2bd3('0x72')]=_0x149f43[_0x2bd3('0x72')];_0x149f43[_0x2bd3('0x26')][_0x2bd3('0x73')]=_0x149f43[_0x2bd3('0x72')];_0x149f43[_0x2bd3('0x26')]['event']=_0x2bd3('0x5a');return respondWithRpcPromise(_0x2bd3('0x74'),_0x2bd3('0x74'),{'event':_0x2bd3('0x75'),'message':_0x149f43['message']},client9002)[_0x2bd3('0x20')](function(){return _0x149f43;});}return _0x149f43;}return null;})[_0x2bd3('0x20')](respondWithResult(_0x1b1bc8,null))[_0x2bd3('0x28')](handleError(_0x1b1bc8,null));};var interaction_log=require(_0x2bd3('0x13'))('whatsapp-interactions');exports[_0x2bd3('0x33')]=function(_0x1b61ad,_0x5ec3da,_0x331d09){var _0xa7b8ef={'agent':{},'channel':_0x2bd3('0x76')};if(_0x1b61ad[_0x2bd3('0x55')]['id']){delete _0x1b61ad[_0x2bd3('0x55')]['id'];}_0x1b61ad[_0x2bd3('0x55')][_0x2bd3('0x5e')]=_0x1b61ad['body'][_0x2bd3('0x5e')]||_0x1b61ad[_0x2bd3('0x5f')]['id'];_0xa7b8ef['agent']['id']=_0x1b61ad[_0x2bd3('0x55')][_0x2bd3('0x5e')];return db[_0x2bd3('0x3b')][_0x2bd3('0x56')]({'where':{'id':_0x1b61ad[_0x2bd3('0x57')]['id'],'UserId':null}})[_0x2bd3('0x20')](handleEntityNotFound(_0x5ec3da,null))[_0x2bd3('0x20')](function(_0x4e81fa){if(_0x4e81fa){_0xa7b8ef[_0x2bd3('0x26')]=_0x4e81fa[_0x2bd3('0x61')]({'plain':!![]});return db[_0x2bd3('0x77')][_0x2bd3('0x56')]({'where':{'id':_0x4e81fa[_0x2bd3('0x60')]}});}return null;})[_0x2bd3('0x20')](handleEntityNotFound(_0x5ec3da,null))[_0x2bd3('0x20')](function(_0x1da49e){if(_0x1da49e){_0xa7b8ef[_0x2bd3('0x63')]=_0x1da49e[_0x2bd3('0x61')]({'plain':!![]});interaction_log[_0x2bd3('0x21')](_0x2bd3('0x78'),_0x1b61ad[_0x2bd3('0x5f')]['id'],_0x1b61ad[_0x2bd3('0x5f')]['name'],_0x1b61ad[_0x2bd3('0x5f')][_0x2bd3('0x79')],_0xa7b8ef[_0x2bd3('0x63')]['id'],_0x1b61ad[_0x2bd3('0x55')]?JSON['stringify'](_0x1b61ad[_0x2bd3('0x55')]):'null');return respondWithRpcPromise(_0x2bd3('0x7a'),_0x2bd3('0x7b'),_0xa7b8ef);}return null;})['then'](function(_0x492cc7){var _0x24bd24='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x492cc7[_0x2bd3('0x26')][_0x2bd3('0x68')];return db['sequelize'][_0x2bd3('0x3f')](_0x24bd24,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x2bd3('0x20')](function(_0x20544c){return _0x20544c;});})[_0x2bd3('0x20')](function(_0x57c0ab){if(_0x57c0ab){_0xa7b8ef[_0x2bd3('0x26')][_0x2bd3('0x7c')]=_0x57c0ab[0x0];if(!_0x1b61ad['body'][_0x2bd3('0x5e')])return;return db['User'][_0x2bd3('0x56')]({'where':{'id':_0x1b61ad['body']['UserId'],'role':'agent'},'attributes':['id',_0x2bd3('0x37'),_0x2bd3('0x7d'),'email',_0x2bd3('0x6f')],'raw':!![]});}return null;})[_0x2bd3('0x20')](function(_0x65afdd){if(!_0x65afdd)return null;_0xa7b8ef[_0x2bd3('0x26')][_0x2bd3('0x6d')]=_0x65afdd;return _0xa7b8ef;})[_0x2bd3('0x20')](function(_0x20db9d){if(_0x20db9d){_0x20db9d['message'][_0x2bd3('0x70')]=util[_0x2bd3('0x5c')](_0x2bd3('0x71'),_0x1b61ad[_0x2bd3('0x5f')]['name']);_0x20db9d[_0x2bd3('0x26')][_0x2bd3('0x72')]=_0xa7b8ef[_0x2bd3('0x72')];_0x20db9d[_0x2bd3('0x26')][_0x2bd3('0x73')]=_0xa7b8ef[_0x2bd3('0x72')];_0x20db9d[_0x2bd3('0x26')][_0x2bd3('0x7e')]=_0x2bd3('0x33');respondWithRpcPromise('EventManager',_0x2bd3('0x74'),{'event':_0x2bd3('0x7f'),'message':_0x20db9d[_0x2bd3('0x26')]},client9002);return _0xa7b8ef;}return null;})[_0x2bd3('0x20')](respondWithResult(_0x5ec3da,null))[_0x2bd3('0x28')](handleError(_0x5ec3da,null));};exports['status']=function(_0xa139ae,_0x37c974,_0x2ccb4f){if(_0xa139ae['body']['id']){delete _0xa139ae[_0x2bd3('0x55')]['id'];}var _0x2e2945;return db[_0x2bd3('0x3b')][_0x2bd3('0x56')]({'where':{'id':_0xa139ae[_0x2bd3('0x57')]['id']}})[_0x2bd3('0x20')](handleEntityNotFound(_0x37c974,null))['then'](function(_0xb37e4f){if(_0xb37e4f){_0x2e2945=_0xb37e4f;return db[_0x2bd3('0x80')]['find']({'where':{'id':_0xb37e4f['WhatsappAccountId']}});}})[_0x2bd3('0x20')](handleEntityNotFound(_0x37c974,null))['then'](function(_0x3bcf22){if(_0x3bcf22){logger[_0x2bd3('0x24')](_0x2bd3('0x81'),'status',_0x2bd3('0x82'),_0x3bcf22['type'],util['inspect'](_0xa139ae[_0x2bd3('0x55')],{'showHidden':![],'depth':null}));switch(_0x3bcf22[_0x2bd3('0x83')]){case'twilio':if(_0xa139ae[_0x2bd3('0x55')][_0x2bd3('0x84')]&&_0xa139ae[_0x2bd3('0x55')][_0x2bd3('0x84')]===_0x2e2945[_0x2bd3('0x85')]&&_0xa139ae[_0x2bd3('0x55')][_0x2bd3('0x86')]&&_0xa139ae[_0x2bd3('0x55')][_0x2bd3('0x86')]===_0x2bd3('0x87')){return _0x2e2945[_0x2bd3('0x35')]({'read':!![]});}else{logger['error'](_0x2bd3('0x88'),'status','twilio',util[_0x2bd3('0x89')](_0xa139ae[_0x2bd3('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2e2945;}})[_0x2bd3('0x20')](respondWithResult(_0x37c974,null))[_0x2bd3('0x28')](handleError(_0x37c974,null));}; \ No newline at end of file +var _0x510b=['QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','role','rejectMessage','ContactId','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','undefined','limit','offset','count','apply','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','show','params','rawAttributes','length','find','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize'];(function(_0x372e22,_0x8fd190){var _0x34b6e0=function(_0xff78f5){while(--_0xff78f5){_0x372e22['push'](_0x372e22['shift']());}};_0x34b6e0(++_0x8fd190);}(_0x510b,0x1b8));var _0xb510=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x510b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb510('0x0'));var rimraf=require(_0xb510('0x1'));var zipdir=require(_0xb510('0x2'));var jsonpatch=require(_0xb510('0x3'));var rp=require(_0xb510('0x4'));var moment=require('moment');var BPromise=require(_0xb510('0x5'));var Mustache=require(_0xb510('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb510('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb510('0x8'));var _=require(_0xb510('0x9'));var squel=require('squel');var crypto=require(_0xb510('0xa'));var jsforce=require(_0xb510('0xb'));var deskjs=require(_0xb510('0xc'));var toCsv=require(_0xb510('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb510('0xd'));var qs=require(_0xb510('0xe'));var as=require(_0xb510('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb510('0x10'))(_0xb510('0x11'));var utils=require(_0xb510('0x12'));var config=require(_0xb510('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb510('0x14'))['db'];config[_0xb510('0x15')]=_[_0xb510('0x16')](config['redis'],{'host':_0xb510('0x17'),'port':0x18eb});var socket=require(_0xb510('0x18'))(new Redis(config['redis']));require(_0xb510('0x19'))[_0xb510('0x1a')](socket);var jayson=require(_0xb510('0x1b'));var client=jayson[_0xb510('0x1c')][_0xb510('0x1d')]({'port':0x232c});var client9002=jayson[_0xb510('0x1c')][_0xb510('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x248695,_0x512efe,_0x5bc156,_0x206e52){return new BPromise(function(_0x5ad1b7,_0xe88021){var _0x258833=_0x206e52||client;return _0x258833[_0xb510('0x1e')](_0x248695,_0x5bc156)[_0xb510('0x1f')](function(_0x50f683){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x512efe,_0xb510('0x20'));logger[_0xb510('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x512efe,_0xb510('0x20'),JSON['stringify'](_0x50f683));if(_0x50f683[_0xb510('0x22')]){if(_0x50f683[_0xb510('0x22')]['code']===0x1f4){logger['error'](_0xb510('0x23'),_0x512efe,_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);return _0xe88021(_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);}logger['error'](_0xb510('0x23'),_0x512efe,_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);return _0x5ad1b7(_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);}else{logger[_0xb510('0x25')](_0xb510('0x23'),_0x512efe,_0xb510('0x20'));_0x5ad1b7(_0x50f683['result'][_0xb510('0x24')]);}})[_0xb510('0x26')](function(_0x5212de){logger[_0xb510('0x22')](_0xb510('0x23'),_0x512efe,_0x5212de);_0xe88021(_0x5212de);});});}function respondWithStatusCode(_0x472601,_0x1b3802){_0x1b3802=_0x1b3802||0xcc;return function(_0x5c56bd){if(_0x5c56bd){return _0x472601[_0xb510('0x27')](_0x1b3802);}return _0x472601[_0xb510('0x28')](_0x1b3802)[_0xb510('0x29')]();};}function respondWithResult(_0x59069f,_0x2070c3){_0x2070c3=_0x2070c3||0xc8;return function(_0x86905){if(_0x86905){return _0x59069f['status'](_0x2070c3)[_0xb510('0x2a')](_0x86905);}};}function respondWithFilteredResult(_0x5a3ebb,_0x2f97fb){return function(_0x5a5641){if(_0x5a5641){var _0x40a330=typeof _0x2f97fb['offset']===_0xb510('0x2b')&&typeof _0x2f97fb[_0xb510('0x2c')]===_0xb510('0x2b');var _0x246e06=_0x5a5641['count'];var _0x5a753b=_0x40a330?0x0:_0x2f97fb[_0xb510('0x2d')];var _0x3ea8d9=_0x40a330?_0x5a5641[_0xb510('0x2e')]:_0x2f97fb[_0xb510('0x2d')]+_0x2f97fb[_0xb510('0x2c')];var _0x5a87ee;if(_0x3ea8d9>=_0x246e06){_0x3ea8d9=_0x246e06;_0x5a87ee=0xc8;}else{_0x5a87ee=0xce;}_0x5a3ebb[_0xb510('0x28')](_0x5a87ee);return _0x5a3ebb['set']('Content-Range',_0x5a753b+'-'+_0x3ea8d9+'/'+_0x246e06)['json'](_0x5a5641);}return null;};}function patchUpdates(_0xe4585a){return function(_0x3ca158){try{jsonpatch[_0xb510('0x2f')](_0x3ca158,_0xe4585a,!![]);}catch(_0x449a74){return BPromise['reject'](_0x449a74);}return _0x3ca158['save']();};}function saveUpdates(_0x39de11,_0xd08e64){return function(_0x5a38be){if(_0x5a38be){return _0x5a38be['update'](_0x39de11)[_0xb510('0x1f')](function(_0x4d4b0e){return _0x4d4b0e;});}return null;};}function removeEntity(_0x304576,_0x224cca){return function(_0x5d0d40){if(_0x5d0d40){return _0x5d0d40[_0xb510('0x30')]()[_0xb510('0x1f')](function(){_0x304576['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41943d,_0x271b92){return function(_0x4d4fd4){if(!_0x4d4fd4){_0x41943d[_0xb510('0x27')](0x194);}return _0x4d4fd4;};}function handleError(_0x3a70e,_0x48a232){_0x48a232=_0x48a232||0x1f4;return function(_0x4b5da9){logger[_0xb510('0x22')](_0x4b5da9[_0xb510('0x31')]);if(_0x4b5da9[_0xb510('0x32')]){delete _0x4b5da9['name'];}_0x3a70e[_0xb510('0x28')](_0x48a232)[_0xb510('0x33')](_0x4b5da9);};}exports['index']=function(_0x3b14c1,_0x2410df){var _0x521d39={},_0x22d2f2={},_0x384f17={'count':0x0,'rows':[]};var _0x4f1a81=_[_0xb510('0x34')](db['WhatsappMessage']['rawAttributes'],function(_0x3e3676){return{'name':_0x3e3676[_0xb510('0x35')],'type':_0x3e3676[_0xb510('0x36')][_0xb510('0x37')]};});_0x22d2f2[_0xb510('0x38')]=_['map'](_0x4f1a81,'name');_0x22d2f2[_0xb510('0x39')]=_[_0xb510('0x3a')](_0x3b14c1[_0xb510('0x39')]);_0x22d2f2['filters']=_[_0xb510('0x3b')](_0x22d2f2[_0xb510('0x38')],_0x22d2f2[_0xb510('0x39')]);_0x521d39['attributes']=_['intersection'](_0x22d2f2['model'],qs[_0xb510('0x3c')](_0x3b14c1[_0xb510('0x39')]['fields']));_0x521d39[_0xb510('0x3d')]=_0x521d39[_0xb510('0x3d')]['length']?_0x521d39[_0xb510('0x3d')]:_0x22d2f2[_0xb510('0x38')];if(!_0x3b14c1[_0xb510('0x39')][_0xb510('0x3e')](_0xb510('0x3f'))){_0x521d39[_0xb510('0x2c')]=qs['limit'](_0x3b14c1[_0xb510('0x39')][_0xb510('0x2c')]);_0x521d39[_0xb510('0x2d')]=qs[_0xb510('0x2d')](_0x3b14c1[_0xb510('0x39')][_0xb510('0x2d')]);}_0x521d39[_0xb510('0x40')]=qs[_0xb510('0x41')](_0x3b14c1[_0xb510('0x39')]['sort']);_0x521d39[_0xb510('0x42')]=qs['filters'](_[_0xb510('0x43')](_0x3b14c1[_0xb510('0x39')],_0x22d2f2['filters']),_0x4f1a81);if(_0x3b14c1['query'][_0xb510('0x44')]){_0x521d39['where']=_[_0xb510('0x45')](_0x521d39['where'],{'$or':_[_0xb510('0x34')](_0x4f1a81,function(_0x38b751){if(_0x38b751[_0xb510('0x36')]!==_0xb510('0x46')){var _0x4556a9={};_0x4556a9[_0x38b751[_0xb510('0x32')]]={'$like':'%'+_0x3b14c1[_0xb510('0x39')][_0xb510('0x44')]+'%'};return _0x4556a9;}})});}_0x521d39=_['merge']({},_0x521d39,_0x3b14c1[_0xb510('0x47')]);var _0x3811a5={'where':_0x521d39[_0xb510('0x42')]};return db[_0xb510('0x48')][_0xb510('0x2e')](_0x3811a5)['then'](function(_0x289f86){_0x384f17[_0xb510('0x2e')]=_0x289f86;if(_0x3b14c1['query'][_0xb510('0x49')]){_0x521d39[_0xb510('0x4a')]=[{'all':!![]}];}return db[_0xb510('0x48')]['findAll'](_0x521d39);})[_0xb510('0x1f')](function(_0x56930a){_0x384f17[_0xb510('0x4b')]=_0x56930a;return _0x384f17;})['then'](respondWithFilteredResult(_0x2410df,_0x521d39))[_0xb510('0x26')](handleError(_0x2410df,null));};exports[_0xb510('0x4c')]=function(_0x155685,_0x54cb3d){var _0x408830={'raw':!![],'where':{'id':_0x155685[_0xb510('0x4d')]['id']}},_0x2d4da2={};_0x2d4da2[_0xb510('0x38')]=_[_0xb510('0x3a')](db[_0xb510('0x48')][_0xb510('0x4e')]);_0x2d4da2[_0xb510('0x39')]=_[_0xb510('0x3a')](_0x155685[_0xb510('0x39')]);_0x2d4da2['filters']=_[_0xb510('0x3b')](_0x2d4da2['model'],_0x2d4da2[_0xb510('0x39')]);_0x408830[_0xb510('0x3d')]=_[_0xb510('0x3b')](_0x2d4da2[_0xb510('0x38')],qs[_0xb510('0x3c')](_0x155685['query']['fields']));_0x408830[_0xb510('0x3d')]=_0x408830['attributes'][_0xb510('0x4f')]?_0x408830[_0xb510('0x3d')]:_0x2d4da2[_0xb510('0x38')];if(_0x155685['query'][_0xb510('0x49')]){_0x408830['include']=[{'all':!![]}];}_0x408830=_[_0xb510('0x45')]({},_0x408830,_0x155685[_0xb510('0x47')]);return db[_0xb510('0x48')][_0xb510('0x50')](_0x408830)[_0xb510('0x1f')](handleEntityNotFound(_0x54cb3d,null))[_0xb510('0x1f')](respondWithResult(_0x54cb3d,null))[_0xb510('0x26')](handleError(_0x54cb3d,null));};exports['create']=function(_0x27e7e2,_0x487713){return db[_0xb510('0x48')][_0xb510('0x51')](_0x27e7e2[_0xb510('0x52')],{})[_0xb510('0x1f')](respondWithResult(_0x487713,0xc9))['catch'](handleError(_0x487713,null));};exports['update']=function(_0x43c605,_0x15a712){if(_0x43c605['body']['id']){delete _0x43c605['body']['id'];}return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x43c605[_0xb510('0x4d')]['id']}})[_0xb510('0x1f')](handleEntityNotFound(_0x15a712,null))[_0xb510('0x1f')](saveUpdates(_0x43c605[_0xb510('0x52')],null))[_0xb510('0x1f')](respondWithResult(_0x15a712,null))[_0xb510('0x26')](handleError(_0x15a712,null));};exports[_0xb510('0x30')]=function(_0x1a930c,_0x1de7fe){return db['WhatsappMessage'][_0xb510('0x50')]({'where':{'id':_0x1a930c[_0xb510('0x4d')]['id']}})[_0xb510('0x1f')](handleEntityNotFound(_0x1de7fe,null))[_0xb510('0x1f')](removeEntity(_0x1de7fe,null))[_0xb510('0x26')](handleError(_0x1de7fe,null));};exports[_0xb510('0x53')]=function(_0x3a1ab7,_0x164cf3){return db[_0xb510('0x48')][_0xb510('0x53')]()[_0xb510('0x1f')](respondWithResult(_0x164cf3,null))['catch'](handleError(_0x164cf3,null));};var interaction_log=require(_0xb510('0x10'))('whatsapp-interactions');exports[_0xb510('0x54')]=function(_0x170c92,_0x3ca9ca,_0x594690){var _0x5bdf5b={'agent':{},'channel':_0xb510('0x55')};if(_0x170c92[_0xb510('0x52')]['id']){delete _0x170c92[_0xb510('0x52')]['id'];}_0x170c92[_0xb510('0x52')][_0xb510('0x56')]=!![];_0x170c92['body'][_0xb510('0x57')]=moment()[_0xb510('0x58')](_0xb510('0x59'));_0x170c92[_0xb510('0x52')][_0xb510('0x5a')]=_0x170c92[_0xb510('0x52')][_0xb510('0x5a')]||_0x170c92[_0xb510('0x5b')]['id'];_0x5bdf5b[_0xb510('0x5c')]['id']=_0x170c92['body'][_0xb510('0x5a')];return db['WhatsappMessage'][_0xb510('0x50')]({'where':{'id':_0x170c92[_0xb510('0x4d')]['id'],'UserId':null}})[_0xb510('0x1f')](handleEntityNotFound(_0x3ca9ca,null))[_0xb510('0x1f')](saveUpdates(_0x170c92['body'],null))[_0xb510('0x1f')](function(_0x37715e){if(_0x37715e){_0x5bdf5b[_0xb510('0x24')]=_0x37715e[_0xb510('0x5d')]({'plain':!![]});return db[_0xb510('0x5e')][_0xb510('0x50')]({'where':{'id':_0x37715e[_0xb510('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x3ca9ca,null))[_0xb510('0x1f')](function(_0x37708a){if(_0x37708a){return _0x37708a[_0xb510('0x60')]({'UserId':_0x170c92[_0xb510('0x52')][_0xb510('0x5a')],'read1stAt':_[_0xb510('0x61')](_0x37708a[_0xb510('0x62')])?moment()['format'](_0xb510('0x59')):undefined});}return null;})[_0xb510('0x1f')](function(_0x2b1e49){if(_0x2b1e49){_0x5bdf5b[_0xb510('0x63')]=_0x2b1e49['get']({'plain':!![]});interaction_log[_0xb510('0x25')](_0xb510('0x64'),_0x170c92[_0xb510('0x5b')]['id'],_0x170c92['user'][_0xb510('0x32')],_0x170c92['user']['role'],_0x5bdf5b[_0xb510('0x63')]['id'],_0x170c92[_0xb510('0x52')]?JSON[_0xb510('0x65')](_0x170c92[_0xb510('0x52')]):_0xb510('0x66'));return respondWithRpcPromise(_0xb510('0x67'),_0xb510('0x68'),_0x5bdf5b);}return null;})[_0xb510('0x1f')](function(_0x8eb256){var _0x36ac1b=_0xb510('0x69')+_0x8eb256[_0xb510('0x24')]['ContactId'];return db[_0xb510('0x6a')][_0xb510('0x39')](_0x36ac1b,{'type':db[_0xb510('0x6b')][_0xb510('0x6c')][_0xb510('0x6d')],'raw':!![]})[_0xb510('0x1f')](function(_0xdb60b4){return _0xdb60b4;});})[_0xb510('0x1f')](function(_0x39e1bc){if(_0x39e1bc){_0x5bdf5b['message'][_0xb510('0x6e')]=_0x39e1bc[0x0];if(!_0x170c92['body']['UserId'])return;return db[_0xb510('0x6f')][_0xb510('0x50')]({'where':{'id':_0x170c92[_0xb510('0x52')][_0xb510('0x5a')],'role':_0xb510('0x5c')},'attributes':['id',_0xb510('0x32'),_0xb510('0x70'),_0xb510('0x71'),_0xb510('0x72')],'raw':!![]});}return null;})['then'](function(_0x3525b7){if(!_0x3525b7)return null;_0x5bdf5b['message']['agent']=_0x3525b7;return _0x5bdf5b;})['then'](function(_0x257b30){if(_0x257b30){if(_0x170c92[_0xb510('0x52')][_0xb510('0x73')]){_0x5bdf5b[_0xb510('0x24')][_0xb510('0x74')]=util['format'](_0xb510('0x75'),_0x170c92[_0xb510('0x5b')][_0xb510('0x32')]);_0x5bdf5b['message'][_0xb510('0x76')]=_0x5bdf5b[_0xb510('0x76')];_0x5bdf5b['message'][_0xb510('0x77')]=_0x5bdf5b[_0xb510('0x76')];_0x5bdf5b[_0xb510('0x24')][_0xb510('0x78')]=_0xb510('0x54');return respondWithRpcPromise(_0xb510('0x79'),_0xb510('0x79'),{'event':_0xb510('0x7a'),'message':_0x5bdf5b[_0xb510('0x24')]},client9002)[_0xb510('0x1f')](function(){return _0x5bdf5b;});}return _0x5bdf5b;}return null;})[_0xb510('0x1f')](respondWithResult(_0x3ca9ca,null))[_0xb510('0x26')](handleError(_0x3ca9ca,null));};var interaction_log=require(_0xb510('0x10'))(_0xb510('0x7b'));exports['reject']=function(_0x2c5ec0,_0x297825,_0x1333fd){var _0x312c65={'agent':{},'channel':_0xb510('0x55')};if(_0x2c5ec0['body']['id']){delete _0x2c5ec0[_0xb510('0x52')]['id'];}_0x2c5ec0[_0xb510('0x52')][_0xb510('0x5a')]=_0x2c5ec0['body'][_0xb510('0x5a')]||_0x2c5ec0[_0xb510('0x5b')]['id'];_0x312c65[_0xb510('0x5c')]['id']=_0x2c5ec0['body'][_0xb510('0x5a')];return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x2c5ec0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x297825,null))[_0xb510('0x1f')](function(_0x148dc4){if(_0x148dc4){_0x312c65[_0xb510('0x24')]=_0x148dc4[_0xb510('0x5d')]({'plain':!![]});return db[_0xb510('0x5e')][_0xb510('0x50')]({'where':{'id':_0x148dc4['WhatsappInteractionId']}});}return null;})[_0xb510('0x1f')](handleEntityNotFound(_0x297825,null))[_0xb510('0x1f')](function(_0x36749e){if(_0x36749e){_0x312c65[_0xb510('0x63')]=_0x36749e[_0xb510('0x5d')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c5ec0['user']['id'],_0x2c5ec0['user'][_0xb510('0x32')],_0x2c5ec0[_0xb510('0x5b')][_0xb510('0x7c')],_0x312c65[_0xb510('0x63')]['id'],_0x2c5ec0[_0xb510('0x52')]?JSON[_0xb510('0x65')](_0x2c5ec0['body']):'null');return respondWithRpcPromise('RejectMessage',_0xb510('0x7d'),_0x312c65);}return null;})[_0xb510('0x1f')](function(_0x2cfa89){var _0x3b1b52=_0xb510('0x69')+_0x2cfa89[_0xb510('0x24')][_0xb510('0x7e')];return db[_0xb510('0x6a')][_0xb510('0x39')](_0x3b1b52,{'type':db[_0xb510('0x6b')][_0xb510('0x6c')][_0xb510('0x6d')],'raw':!![]})[_0xb510('0x1f')](function(_0x21f4a8){return _0x21f4a8;});})[_0xb510('0x1f')](function(_0x277cb3){if(_0x277cb3){_0x312c65[_0xb510('0x24')]['contact']=_0x277cb3[0x0];if(!_0x2c5ec0[_0xb510('0x52')][_0xb510('0x5a')])return;return db[_0xb510('0x6f')][_0xb510('0x50')]({'where':{'id':_0x2c5ec0[_0xb510('0x52')]['UserId'],'role':_0xb510('0x5c')},'attributes':['id',_0xb510('0x32'),_0xb510('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xb510('0x1f')](function(_0x3a18bf){if(!_0x3a18bf)return null;_0x312c65[_0xb510('0x24')][_0xb510('0x5c')]=_0x3a18bf;return _0x312c65;})['then'](function(_0x161026){if(_0x161026){_0x161026[_0xb510('0x24')][_0xb510('0x74')]=util[_0xb510('0x58')](_0xb510('0x75'),_0x2c5ec0[_0xb510('0x5b')][_0xb510('0x32')]);_0x161026['message']['channel']=_0x312c65[_0xb510('0x76')];_0x161026['message'][_0xb510('0x77')]=_0x312c65['channel'];_0x161026['message'][_0xb510('0x78')]=_0xb510('0x7f');respondWithRpcPromise('EventManager','EventManager',{'event':_0xb510('0x80'),'message':_0x161026[_0xb510('0x24')]},client9002);return _0x312c65;}return null;})[_0xb510('0x1f')](respondWithResult(_0x297825,null))[_0xb510('0x26')](handleError(_0x297825,null));};exports[_0xb510('0x28')]=function(_0x45ffb5,_0xf09dfd,_0x266d17){if(_0x45ffb5['body']['id']){delete _0x45ffb5[_0xb510('0x52')]['id'];}var _0x1b165e;return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x45ffb5[_0xb510('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf09dfd,null))[_0xb510('0x1f')](function(_0x1f92e3){if(_0x1f92e3){_0x1b165e=_0x1f92e3;return db[_0xb510('0x81')][_0xb510('0x50')]({'where':{'id':_0x1f92e3['WhatsappAccountId']}});}})[_0xb510('0x1f')](handleEntityNotFound(_0xf09dfd,null))[_0xb510('0x1f')](function(_0x32fc95){if(_0x32fc95){logger[_0xb510('0x21')](_0xb510('0x82'),_0xb510('0x28'),_0xb510('0x83'),_0x32fc95[_0xb510('0x36')],util['inspect'](_0x45ffb5[_0xb510('0x52')],{'showHidden':![],'depth':null}));switch(_0x32fc95['type']){case'twilio':if(_0x45ffb5['body'][_0xb510('0x84')]&&_0x45ffb5['body'][_0xb510('0x84')]===_0x1b165e['messageId']&&_0x45ffb5[_0xb510('0x52')][_0xb510('0x85')]&&_0x45ffb5[_0xb510('0x52')][_0xb510('0x85')]==='read'){return _0x1b165e[_0xb510('0x60')]({'read':!![]});}else{logger[_0xb510('0x22')](_0xb510('0x86'),_0xb510('0x28'),_0xb510('0x87'),util[_0xb510('0x88')](_0x45ffb5['body'],{'showHidden':![],'depth':null}));}break;}return _0x1b165e;}})[_0xb510('0x1f')](respondWithResult(_0xf09dfd,null))['catch'](handleError(_0xf09dfd,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2733825..45dfce0 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 _0xea28=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0xea28,0x13a));var _0x8ea2=function(_0x1ea509,_0x598ba0){_0x1ea509=_0x1ea509-0x0;var _0x26c420=_0xea28[_0x1ea509];return _0x26c420;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var WhatsappMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8ea2('0x3')](0x0);var events={'afterCreate':_0x8ea2('0x4'),'afterUpdate':_0x8ea2('0x5'),'afterDestroy':_0x8ea2('0x6')};function emitEvent(_0x10f7bb){return function(_0x4b7cda,_0x9b45ab,_0x23aaf1){WhatsappMessageEvents[_0x8ea2('0x7')](_0x10f7bb+':'+_0x4b7cda['id'],_0x4b7cda);WhatsappMessageEvents['emit'](_0x10f7bb,_0x4b7cda);_0x23aaf1(null);};}for(var e in events){if(events[_0x8ea2('0x8')](e)){var event=events[e];WhatsappMessage[_0x8ea2('0x9')](e,emitEvent(event));}}module[_0x8ea2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x1152=['remove','emit','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x34f4d1,_0x28f1be){var _0x28351b=function(_0xac85d5){while(--_0xac85d5){_0x34f4d1['push'](_0x34f4d1['shift']());}};_0x28351b(++_0x28f1be);}(_0x1152,0x182));var _0x2115=function(_0x2df3c1,_0x35b259){_0x2df3c1=_0x2df3c1-0x0;var _0xbfaae3=_0x1152[_0x2df3c1];return _0xbfaae3;};'use strict';var EventEmitter=require(_0x2115('0x0'));var WhatsappMessage=require(_0x2115('0x1'))['db'][_0x2115('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2115('0x3')](0x0);var events={'afterCreate':_0x2115('0x4'),'afterUpdate':_0x2115('0x5'),'afterDestroy':_0x2115('0x6')};function emitEvent(_0x3b8dfa){return function(_0x4d0f31,_0x1e8a26,_0x5c17b3){WhatsappMessageEvents[_0x2115('0x7')](_0x3b8dfa+':'+_0x4d0f31['id'],_0x4d0f31);WhatsappMessageEvents[_0x2115('0x7')](_0x3b8dfa,_0x4d0f31);_0x5c17b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e9a6fa5..d2f8e19 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 _0x8baa=['type','twilio','accountSid','authToken','phone','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','node-fetch','rimraf','../../config/environment','define','WhatsappMessage','messageId','FULLTEXT','get','direction','toLowerCase','secret','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0x8baa,0x12a));var _0xa8ba=function(_0x3e80cd,_0xfd2fd5){_0x3e80cd=_0x3e80cd-0x0;var _0x55c527=_0x8baa[_0x3e80cd];return _0x55c527;};'use strict';var _=require('lodash');var util=require(_0xa8ba('0x0'));var logger=require(_0xa8ba('0x1'))(_0xa8ba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xa8ba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8ba('0x4'));var config=require(_0xa8ba('0x5'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x438796,_0x54d072){return _0x438796[_0xa8ba('0x6')](_0xa8ba('0x7'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xa8ba('0x8'),'fields':[_0xa8ba('0x8')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xa8ba('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40cc02,_0x4f65d2,_0x339218){var _0xcbb6ad=_0x438796['models'];var _0x40a099=_0x40cc02[_0xa8ba('0xa')]({'plain':!![]});if(_0x40a099[_0xa8ba('0xb')][_0xa8ba('0xc')]()==='in'||_0x40a099[_0xa8ba('0xb')][_0xa8ba('0xc')]()==='out'&&!_0x40a099[_0xa8ba('0xd')]&&!_[_0xa8ba('0xe')](_0x40a099['UserId'])){_0xcbb6ad['WhatsappInteraction'][_0xa8ba('0xf')]({'where':{'id':_0x40a099[_0xa8ba('0x10')]}})[_0xa8ba('0x11')](function(_0x4b65b7){if(_0x4b65b7){_0x4b65b7[_0xa8ba('0x12')]({'lastMsgAt':_0x40a099[_0xa8ba('0x13')],'lastMsgDirection':_0x40a099[_0xa8ba('0xb')][_0xa8ba('0xc')]()});}})[_0xa8ba('0x14')](function(_0x27108b){console[_0xa8ba('0x15')](_0x27108b);});}if(_0x40a099[_0xa8ba('0xb')]===_0xa8ba('0x16')&&!_0x40a099[_0xa8ba('0xd')]){var _0x57f2c3;_0xcbb6ad[_0xa8ba('0x17')][_0xa8ba('0x18')]({'where':{'id':_0x40a099[_0xa8ba('0x19')]},'raw':!![]})[_0xa8ba('0x11')](function(_0x45e6f8){_0x57f2c3=_0x45e6f8;if(_0x57f2c3&&_0x57f2c3[_0xa8ba('0x1a')]){switch(_0x57f2c3[_0xa8ba('0x1a')]){case _0xa8ba('0x1b'):var _0x11f878=require(_0xa8ba('0x1b'));if(_0x57f2c3[_0xa8ba('0x1c')]&&_0x57f2c3[_0xa8ba('0x1d')]&&_0x57f2c3[_0xa8ba('0x1e')]){var _0x181248=new _0x11f878(_0x57f2c3[_0xa8ba('0x1c')],_0x57f2c3['authToken']);_0x181248[_0xa8ba('0x1f')]['create']({'body':_0x40a099[_0xa8ba('0x20')],'to':_0xa8ba('0x21')+_0x40a099[_0xa8ba('0x1e')],'from':_0xa8ba('0x21')+_0x57f2c3['phone'],'statusCallback':_0x57f2c3[_0xa8ba('0x22')]+_0xa8ba('0x23')+_0x40a099['id']+_0xa8ba('0x24')+_0x57f2c3[_0xa8ba('0x25')]})[_0xa8ba('0x11')](function(_0x27ed4b){if(_0x27ed4b[_0xa8ba('0x26')]){return _0x40cc02[_0xa8ba('0x12')]({'messageId':_0x27ed4b[_0xa8ba('0x26')]});}})['catch'](function(_0x228214){logger[_0xa8ba('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa8ba('0x1b'),util[_0xa8ba('0x27')](_0x228214,{'showHidden':![],'depth':null}));});}else{logger[_0xa8ba('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa8ba('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa8ba('0x28'):var _0x16e874=_0x57f2c3[_0xa8ba('0x1c')];var _0x5c3265=_0x57f2c3['authToken'];var _0x2928d5=_0x57f2c3[_0xa8ba('0x29')]+_0xa8ba('0x2a')+_0x16e874+_0xa8ba('0x2b');var _0x3226f8={'to':[_0x40a099[_0xa8ba('0x1e')]],'message':{'type':_0xa8ba('0x2c'),'text':_0x40a099[_0xa8ba('0x20')]}};var _0x323a76={'method':_0xa8ba('0x2d'),'uri':_0x2928d5,'headers':{'Authorization':_0xa8ba('0x2e')+_0x5c3265,'Content-Type':_0xa8ba('0x2f')},'body':_0x3226f8,'json':!![]};rp(_0x323a76)[_0xa8ba('0x11')](function(_0x181049){if(_0x181049[_0xa8ba('0x30')][0x0][_0xa8ba('0x31')]){return _0x40cc02[_0xa8ba('0x12')]({'messageId':_0x181049['statuses'][0x0][_0xa8ba('0x31')]});}})[_0xa8ba('0x14')](function(_0x14d768){logger[_0xa8ba('0x32')](_0xa8ba('0x33'),_0x14d768);});break;}}})[_0xa8ba('0x34')](function(){_0x339218();});}else{_0x339218();}}},'charset':_0xa8ba('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7a50=['WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','error'];(function(_0x4669cf,_0x4e47dd){var _0x5e9c4a=function(_0xa05c7){while(--_0xa05c7){_0x4669cf['push'](_0x4669cf['shift']());}};_0x5e9c4a(++_0x4e47dd);}(_0x7a50,0xbf));var _0x07a5=function(_0x4d905c,_0x8d3181){_0x4d905c=_0x4d905c-0x0;var _0x16f577=_0x7a50[_0x4d905c];return _0x16f577;};'use strict';var _=require(_0x07a5('0x0'));var util=require(_0x07a5('0x1'));var logger=require(_0x07a5('0x2'))('api');var moment=require(_0x07a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x07a5('0x4'));var fetch=require(_0x07a5('0x5'));var fs=require('fs');var path=require(_0x07a5('0x6'));var rimraf=require(_0x07a5('0x7'));var config=require(_0x07a5('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x07a5('0x9')]=function(_0x1b78ca,_0x4c72a1){return _0x1b78ca[_0x07a5('0xa')](_0x07a5('0xb'),attributes,{'tableName':_0x07a5('0xc'),'paranoid':![],'indexes':[{'name':_0x07a5('0xd'),'fields':[_0x07a5('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x07a5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40f2f3,_0x1e4b4f,_0x2c0998){var _0x5be67a=_0x1b78ca['models'];var _0x3c4bc7=_0x40f2f3[_0x07a5('0xf')]({'plain':!![]});if(_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()==='in'||_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()===_0x07a5('0x12')&&!_0x3c4bc7[_0x07a5('0x13')]&&!_['isNil'](_0x3c4bc7[_0x07a5('0x14')])){_0x5be67a[_0x07a5('0x15')]['findOne']({'where':{'id':_0x3c4bc7[_0x07a5('0x16')]}})['then'](function(_0x546d00){if(_0x546d00){_0x546d00['update']({'lastMsgAt':_0x3c4bc7[_0x07a5('0x17')],'lastMsgDirection':_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()});}})[_0x07a5('0x18')](function(_0x5b8a88){console['error'](_0x5b8a88);});}if(_0x3c4bc7['direction']===_0x07a5('0x12')&&!_0x3c4bc7[_0x07a5('0x13')]){var _0x5392ff;_0x5be67a[_0x07a5('0x19')][_0x07a5('0x1a')]({'where':{'id':_0x3c4bc7[_0x07a5('0x1b')]},'raw':!![]})[_0x07a5('0x1c')](function(_0x341580){_0x5392ff=_0x341580;if(_0x5392ff&&_0x5392ff['type']){switch(_0x5392ff[_0x07a5('0x1d')]){case _0x07a5('0x1e'):var _0x40daab=require(_0x07a5('0x1e'));if(_0x5392ff[_0x07a5('0x1f')]&&_0x5392ff['authToken']&&_0x5392ff[_0x07a5('0x20')]){var _0x16bff4=new _0x40daab(_0x5392ff['accountSid'],_0x5392ff[_0x07a5('0x21')]);_0x16bff4[_0x07a5('0x22')][_0x07a5('0x23')]({'body':_0x3c4bc7[_0x07a5('0x24')],'to':_0x07a5('0x25')+_0x3c4bc7[_0x07a5('0x20')],'from':'whatsapp:'+_0x5392ff['phone'],'statusCallback':_0x5392ff[_0x07a5('0x26')]+_0x07a5('0x27')+_0x3c4bc7['id']+_0x07a5('0x28')+_0x5392ff[_0x07a5('0x29')]})[_0x07a5('0x1c')](function(_0x1d7c7f){if(_0x1d7c7f[_0x07a5('0x2a')]){return _0x40f2f3[_0x07a5('0x2b')]({'messageId':_0x1d7c7f[_0x07a5('0x2a')]});}})['catch'](function(_0x153f71){logger[_0x07a5('0x2c')](_0x07a5('0x2d'),'afterCreate',_0x07a5('0x1e'),util[_0x07a5('0x2e')](_0x153f71,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x07a5('0x2f'),'twilio',_0x07a5('0x30'));}break;case _0x07a5('0x31'):var _0x437e1c=_0x5392ff[_0x07a5('0x1f')];var _0x49aaeb=_0x5392ff[_0x07a5('0x21')];var _0x293ca0=_0x5392ff[_0x07a5('0x32')]+'/whatsapp/v1/'+_0x437e1c+'/messages/';var _0x634852={'to':[_0x3c4bc7[_0x07a5('0x20')]],'message':{'type':'text','text':_0x3c4bc7['body']}};var _0x531fa8={'method':_0x07a5('0x33'),'uri':_0x293ca0,'headers':{'Authorization':'Bearer\x20'+_0x49aaeb,'Content-Type':_0x07a5('0x34')},'body':_0x634852,'json':!![]};rp(_0x531fa8)[_0x07a5('0x1c')](function(_0x19e84c){if(_0x19e84c[_0x07a5('0x35')][0x0][_0x07a5('0x36')]){return _0x40f2f3[_0x07a5('0x2b')]({'messageId':_0x19e84c[_0x07a5('0x35')][0x0]['message_id']});}})['catch'](function(_0x24843a){logger[_0x07a5('0x37')](_0x07a5('0x38'),_0x24843a);});break;}}})[_0x07a5('0x39')](function(){_0x2c0998();});}else{_0x2c0998();}}},'charset':_0x07a5('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 51a3717..a3fa684 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 _0xb1c9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','CreateWhatsappMessage','WhatsappMessage','body','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb1c9,0x16e));var _0x9b1c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb1c9[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9b1c('0x0'));var util=require('util');var moment=require(_0x9b1c('0x1'));var BPromise=require(_0x9b1c('0x2'));var rs=require(_0x9b1c('0x3'));var fs=require('fs');var Redis=require(_0x9b1c('0x4'));var db=require(_0x9b1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b1c('0x6'))(_0x9b1c('0x7'));var config=require(_0x9b1c('0x8'));var jayson=require(_0x9b1c('0x9'));var client=jayson[_0x9b1c('0xa')][_0x9b1c('0xb')]({'port':0x232a});config[_0x9b1c('0xc')]=_[_0x9b1c('0xd')](config[_0x9b1c('0xc')],{'host':_0x9b1c('0xe'),'port':0x18eb});var socket=require(_0x9b1c('0xf'))(new Redis(config[_0x9b1c('0xc')]));require(_0x9b1c('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cc09e,_0x1657e4,_0x45a77e){return new BPromise(function(_0x1c4f9e,_0x4fa801){return client['request'](_0x1cc09e,_0x45a77e)[_0x9b1c('0x11')](function(_0x40e1e2){logger[_0x9b1c('0x12')](_0x9b1c('0x13'),_0x1657e4,_0x9b1c('0x14'));logger[_0x9b1c('0x15')](_0x9b1c('0x16'),_0x1657e4,_0x9b1c('0x14'),JSON['stringify'](_0x40e1e2));if(_0x40e1e2['error']){if(_0x40e1e2[_0x9b1c('0x17')][_0x9b1c('0x18')]===0x1f4){logger[_0x9b1c('0x17')](_0x9b1c('0x13'),_0x1657e4,_0x40e1e2[_0x9b1c('0x17')][_0x9b1c('0x19')]);return _0x4fa801(_0x40e1e2[_0x9b1c('0x17')][_0x9b1c('0x19')]);}logger[_0x9b1c('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x1657e4,_0x40e1e2[_0x9b1c('0x17')][_0x9b1c('0x19')]);return _0x1c4f9e(_0x40e1e2['error'][_0x9b1c('0x19')]);}else{logger['info'](_0x9b1c('0x13'),_0x1657e4,'request\x20sent');_0x1c4f9e(_0x40e1e2['result'][_0x9b1c('0x19')]);}})['catch'](function(_0x4c66ec){logger[_0x9b1c('0x17')](_0x9b1c('0x13'),_0x1657e4,_0x4c66ec);_0x4fa801(_0x4c66ec);});});}exports[_0x9b1c('0x1a')]=function(_0x4935c6){var _0x4ff88e=this;return new Promise(function(_0x2c8f,_0x57b017){return db[_0x9b1c('0x1b')]['create'](_0x4935c6[_0x9b1c('0x1c')],{'raw':_0x4935c6['options']?_0x4935c6[_0x9b1c('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2850ee){logger[_0x9b1c('0x12')](_0x9b1c('0x1a'),_0x4935c6);logger['debug'](_0x9b1c('0x1a'),_0x4935c6,JSON[_0x9b1c('0x1e')](_0x2850ee));_0x2c8f(_0x2850ee);})['catch'](function(_0x3fd1fb){logger['error']('CreateWhatsappMessage',_0x3fd1fb['message'],_0x4935c6);_0x57b017(_0x4ff88e[_0x9b1c('0x17')](0x1f4,_0x3fd1fb[_0x9b1c('0x19')]));});});}; \ No newline at end of file +var _0x77e8=['result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','debug','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x77e8,0x1d7));var _0x877e=function(_0x3c9864,_0x488a3c){_0x3c9864=_0x3c9864-0x0;var _0x416dcd=_0x77e8[_0x3c9864];return _0x416dcd;};'use strict';var _=require('lodash');var util=require(_0x877e('0x0'));var moment=require(_0x877e('0x1'));var BPromise=require(_0x877e('0x2'));var rs=require(_0x877e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x877e('0x4'));var logger=require(_0x877e('0x5'))(_0x877e('0x6'));var config=require(_0x877e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x877e('0x8')]({'port':0x232a});config[_0x877e('0x9')]=_[_0x877e('0xa')](config['redis'],{'host':_0x877e('0xb'),'port':0x18eb});var socket=require(_0x877e('0xc'))(new Redis(config[_0x877e('0x9')]));require(_0x877e('0xd'))[_0x877e('0xe')](socket);function respondWithRpcPromise(_0x1b6e6d,_0x3ef37d,_0x33feb9){return new BPromise(function(_0x50ae62,_0x26a89a){return client[_0x877e('0xf')](_0x1b6e6d,_0x33feb9)[_0x877e('0x10')](function(_0x57714d){logger[_0x877e('0x11')](_0x877e('0x12'),_0x3ef37d,'request\x20sent');logger['debug'](_0x877e('0x13'),_0x3ef37d,'request\x20sent',JSON['stringify'](_0x57714d));if(_0x57714d[_0x877e('0x14')]){if(_0x57714d[_0x877e('0x14')][_0x877e('0x15')]===0x1f4){logger['error'](_0x877e('0x12'),_0x3ef37d,_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);return _0x26a89a(_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);}logger[_0x877e('0x14')](_0x877e('0x12'),_0x3ef37d,_0x57714d['error']['message']);return _0x50ae62(_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);}else{logger['info'](_0x877e('0x12'),_0x3ef37d,_0x877e('0x17'));_0x50ae62(_0x57714d[_0x877e('0x18')][_0x877e('0x16')]);}})[_0x877e('0x19')](function(_0x173246){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3ef37d,_0x173246);_0x26a89a(_0x173246);});});}exports[_0x877e('0x1a')]=function(_0xaca327){var _0x55b4d6=this;return new Promise(function(_0x5e0d61,_0x1b1347){return db[_0x877e('0x1b')][_0x877e('0x1c')](_0xaca327[_0x877e('0x1d')],{'raw':_0xaca327[_0x877e('0x1e')]?_0xaca327['options']['raw']===undefined?!![]:![]:!![]})[_0x877e('0x10')](function(_0x30151f){logger[_0x877e('0x11')]('CreateWhatsappMessage',_0xaca327);logger[_0x877e('0x1f')]('CreateWhatsappMessage',_0xaca327,JSON[_0x877e('0x20')](_0x30151f));_0x5e0d61(_0x30151f);})[_0x877e('0x19')](function(_0x3ed77f){logger['error'](_0x877e('0x1a'),_0x3ed77f[_0x877e('0x16')],_0xaca327);_0x1b1347(_0x55b4d6[_0x877e('0x14')](0x1f4,_0x3ed77f[_0x877e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5e0ca1d..1df4b37 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 _0x34c6=['save','remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34c6,0x1c7));var _0x634c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x34c6[_0x42cae2];return _0x5f256f;};'use strict';var WhatsappMessageEvents=require(_0x634c('0x0'));var events=[_0x634c('0x1'),_0x634c('0x2'),_0x634c('0x3')];function createListener(_0x34b998,_0x536b26){return function(_0x11cd25){_0x536b26[_0x634c('0x4')](_0x34b998,_0x11cd25);};}function removeListener(_0x54ede7,_0x2932fc){return function(){WhatsappMessageEvents[_0x634c('0x5')](_0x54ede7,_0x2932fc);};}exports[_0x634c('0x6')]=function(_0x9553ac){for(var _0x4222be=0x0,_0x24a9ba=events['length'];_0x4222be<_0x24a9ba;_0x4222be++){var _0x49ffb0=events[_0x4222be];var _0x160dfa=createListener(_0x634c('0x7')+_0x49ffb0,_0x9553ac);WhatsappMessageEvents['on'](_0x49ffb0,_0x160dfa);}}; \ No newline at end of file +var _0xb479=['emit','register','length','whatsappMessage:','save','remove','update'];(function(_0x1be4e9,_0x554e8f){var _0x4d110f=function(_0x1269bc){while(--_0x1269bc){_0x1be4e9['push'](_0x1be4e9['shift']());}};_0x4d110f(++_0x554e8f);}(_0xb479,0x1bd));var _0x9b47=function(_0x2fe260,_0x3d8f2a){_0x2fe260=_0x2fe260-0x0;var _0x4e66bc=_0xb479[_0x2fe260];return _0x4e66bc;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x9b47('0x0'),_0x9b47('0x1'),_0x9b47('0x2')];function createListener(_0x1c6bd4,_0x5cf357){return function(_0xebd628){_0x5cf357[_0x9b47('0x3')](_0x1c6bd4,_0xebd628);};}function removeListener(_0x2119e9,_0x7cca95){return function(){WhatsappMessageEvents['removeListener'](_0x2119e9,_0x7cca95);};}exports[_0x9b47('0x4')]=function(_0x433f69){for(var _0x4e37ac=0x0,_0xf7bc3d=events[_0x9b47('0x5')];_0x4e37ac<_0xf7bc3d;_0x4e37ac++){var _0x4dc6d5=events[_0x4e37ac];var _0x58f888=createListener(_0x9b47('0x6')+_0x4dc6d5,_0x433f69);WhatsappMessageEvents['on'](_0x4dc6d5,_0x58f888);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 760f151..9d8dd99 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 _0xa2df=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','/:id/users','multer','util'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0xa2df,0xf1));var _0xfa2d=function(_0x47e7af,_0x550ed4){_0x47e7af=_0x47e7af-0x0;var _0x4ad7dd=_0xa2df[_0x47e7af];return _0x4ad7dd;};'use strict';var multer=require(_0xfa2d('0x0'));var util=require(_0xfa2d('0x1'));var path=require(_0xfa2d('0x2'));var timeout=require(_0xfa2d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfa2d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfa2d('0x5'));var config=require(_0xfa2d('0x6'));var controller=require(_0xfa2d('0x7'));router[_0xfa2d('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa2d('0x9')]);router[_0xfa2d('0x8')](_0xfa2d('0xa'),auth['isAuthenticated'](),controller[_0xfa2d('0xb')]);router[_0xfa2d('0x8')](_0xfa2d('0xc'),auth[_0xfa2d('0xd')](),controller[_0xfa2d('0xe')]);router[_0xfa2d('0x8')](_0xfa2d('0xf'),auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x10')]);router[_0xfa2d('0x8')](_0xfa2d('0x11'),auth[_0xfa2d('0xd')](),controller['getTeams']);router[_0xfa2d('0x8')]('/:id/users',auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x12')]);router[_0xfa2d('0x13')]('/',auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x14')]);router[_0xfa2d('0x13')](_0xfa2d('0x11'),auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x15')]);router[_0xfa2d('0x13')]('/:id/users',auth[_0xfa2d('0xd')](),controller['addAgents']);router['put'](_0xfa2d('0xc'),auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x16')]);router[_0xfa2d('0x17')](_0xfa2d('0xc'),auth['isAuthenticated'](),controller[_0xfa2d('0x18')]);router[_0xfa2d('0x17')](_0xfa2d('0x11'),auth[_0xfa2d('0xd')](),controller[_0xfa2d('0x19')]);router[_0xfa2d('0x17')](_0xfa2d('0x1a'),auth[_0xfa2d('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd43b=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xcc44e1,_0x520291){var _0x3e4469=function(_0x563d2c){while(--_0x563d2c){_0xcc44e1['push'](_0xcc44e1['shift']());}};_0x3e4469(++_0x520291);}(_0xd43b,0x1c7));var _0xbd43=function(_0x2086e3,_0x17a5b6){_0x2086e3=_0x2086e3-0x0;var _0x4b8b1f=_0xd43b[_0x2086e3];return _0x4b8b1f;};'use strict';var multer=require(_0xbd43('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd43('0x1'));var express=require('express');var router=express[_0xbd43('0x2')]();var fs_extra=require(_0xbd43('0x3'));var auth=require(_0xbd43('0x4'));var interaction=require(_0xbd43('0x5'));var config=require(_0xbd43('0x6'));var controller=require('./whatsappQueue.controller');router[_0xbd43('0x7')]('/',auth[_0xbd43('0x8')](),controller[_0xbd43('0x9')]);router['get'](_0xbd43('0xa'),auth[_0xbd43('0x8')](),controller[_0xbd43('0xb')]);router['get']('/:id',auth[_0xbd43('0x8')](),controller[_0xbd43('0xc')]);router[_0xbd43('0x7')](_0xbd43('0xd'),auth['isAuthenticated'](),controller[_0xbd43('0xe')]);router['get'](_0xbd43('0xf'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x10')]);router[_0xbd43('0x7')]('/:id/users',auth[_0xbd43('0x8')](),controller['getAgents']);router[_0xbd43('0x11')]('/',auth[_0xbd43('0x8')](),controller[_0xbd43('0x12')]);router['post'](_0xbd43('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xbd43('0x13'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x14')]);router[_0xbd43('0x15')](_0xbd43('0x16'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x17')]);router[_0xbd43('0x18')](_0xbd43('0x16'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x19')]);router[_0xbd43('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbd43('0x1a')]);router['delete'](_0xbd43('0x13'),auth['isAuthenticated'](),controller[_0xbd43('0x1b')]);module[_0xbd43('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index e6c37b2..0edbfaf 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 _0xde9d=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xde9d,0x156));var _0xdde9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde9d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xdde9('0x0'));module[_0xdde9('0x1')]={'name':{'type':Sequelize[_0xdde9('0x2')],'unique':_0xdde9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdde9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdde9('0x5'),_0xdde9('0x6'),_0xdde9('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4bd=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd4bd[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xdd4b('0x0'));module[_0xdd4b('0x1')]={'name':{'type':Sequelize[_0xdd4b('0x2')],'unique':_0xdd4b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdd4b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdd4b('0x5'),_0xdd4b('0x6'),_0xdd4b('0x7'))},'description':{'type':Sequelize[_0xdd4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0288c06..614331a 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 _0xfed0=['index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','hasOwnProperty','nolimit','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','rows','format','SIP','createdAt','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','sequelize','each','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','every','TeamId','includes','all','union','value','transaction','removeTeams','isEmpty','forEach','userWhatsappQueue:remove','omit','spread','removeAgents','isArray','getAgents','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xfed0,0x16d));var _0x0fed=function(_0x3180c1,_0x6bd298){_0x3180c1=_0x3180c1-0x0;var _0x3a39e6=_0xfed0[_0x3180c1];return _0x3a39e6;};'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(_0x0fed('0x0'));var moment=require(_0x0fed('0x1'));var BPromise=require(_0x0fed('0x2'));var Mustache=require(_0x0fed('0x3'));var util=require(_0x0fed('0x4'));var path=require(_0x0fed('0x5'));var sox=require(_0x0fed('0x6'));var csv=require(_0x0fed('0x7'));var ejs=require(_0x0fed('0x8'));var fs=require('fs');var fs_extra=require(_0x0fed('0x9'));var _=require(_0x0fed('0xa'));var squel=require('squel');var crypto=require(_0x0fed('0xb'));var jsforce=require(_0x0fed('0xc'));var deskjs=require(_0x0fed('0xd'));var toCsv=require(_0x0fed('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fed('0xe'));var authService=require(_0x0fed('0xf'));var qs=require(_0x0fed('0x10'));var as=require(_0x0fed('0x11'));var hardwareService=require(_0x0fed('0x12'));var logger=require(_0x0fed('0x13'))(_0x0fed('0x14'));var utils=require('../../config/utils');var config=require(_0x0fed('0x15'));var licenseUtil=require(_0x0fed('0x16'));var db=require(_0x0fed('0x17'))['db'];config['redis']=_[_0x0fed('0x18')](config[_0x0fed('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fed('0x1a'))(new Redis(config['redis']));require(_0x0fed('0x1b'))[_0x0fed('0x1c')](socket);function respondWithStatusCode(_0x38502c,_0x1fd1c6){_0x1fd1c6=_0x1fd1c6||0xcc;return function(_0x48d121){if(_0x48d121){return _0x38502c[_0x0fed('0x1d')](_0x1fd1c6);}return _0x38502c[_0x0fed('0x1e')](_0x1fd1c6)[_0x0fed('0x1f')]();};}function respondWithResult(_0x425f90,_0x53136a){_0x53136a=_0x53136a||0xc8;return function(_0x2f6609){if(_0x2f6609){return _0x425f90[_0x0fed('0x1e')](_0x53136a)[_0x0fed('0x20')](_0x2f6609);}};}function respondWithFilteredResult(_0x37d707,_0x226b70){return function(_0x597080){if(_0x597080){var _0x8c3199=typeof _0x226b70['offset']===_0x0fed('0x21')&&typeof _0x226b70['limit']===_0x0fed('0x21');var _0x4701cc=_0x597080[_0x0fed('0x22')];var _0x13ad93=_0x8c3199?0x0:_0x226b70['offset'];var _0x4502ac=_0x8c3199?_0x597080[_0x0fed('0x22')]:_0x226b70['offset']+_0x226b70[_0x0fed('0x23')];var _0x2da0a0;if(_0x4502ac>=_0x4701cc){_0x4502ac=_0x4701cc;_0x2da0a0=0xc8;}else{_0x2da0a0=0xce;}_0x37d707[_0x0fed('0x1e')](_0x2da0a0);return _0x37d707[_0x0fed('0x24')](_0x0fed('0x25'),_0x13ad93+'-'+_0x4502ac+'/'+_0x4701cc)['json'](_0x597080);}return null;};}function patchUpdates(_0xfe1051){return function(_0x5b5457){try{jsonpatch['apply'](_0x5b5457,_0xfe1051,!![]);}catch(_0x449ac1){return BPromise[_0x0fed('0x26')](_0x449ac1);}return _0x5b5457['save']();};}function saveUpdates(_0x36be20,_0x12fa12){return function(_0x65de87){if(_0x65de87){return _0x65de87[_0x0fed('0x27')](_0x36be20)[_0x0fed('0x28')](function(_0x3be5d8){return _0x3be5d8;});}return null;};}function removeEntity(_0x10c1e1,_0x564496){return function(_0xc69faf){if(_0xc69faf){return _0xc69faf[_0x0fed('0x29')]()[_0x0fed('0x28')](function(){var _0x4c8dcd=_0xc69faf[_0x0fed('0x2a')]({'plain':!![]});var _0x1609f7=_0x0fed('0x2b');return db[_0x0fed('0x2c')][_0x0fed('0x29')]({'where':{'type':_0x1609f7,'resourceId':_0x4c8dcd['id']}})[_0x0fed('0x28')](function(){return _0xc69faf;});})[_0x0fed('0x28')](function(){_0x10c1e1[_0x0fed('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250401,_0x7a7c2f){return function(_0x18d272){if(!_0x18d272){_0x250401['sendStatus'](0x194);}return _0x18d272;};}function handleError(_0x48be15,_0x4c6ebe){_0x4c6ebe=_0x4c6ebe||0x1f4;return function(_0x3e6136){logger[_0x0fed('0x2d')](_0x3e6136[_0x0fed('0x2e')]);if(_0x3e6136[_0x0fed('0x2f')]){delete _0x3e6136[_0x0fed('0x2f')];}_0x48be15[_0x0fed('0x1e')](_0x4c6ebe)[_0x0fed('0x30')](_0x3e6136);};}exports[_0x0fed('0x31')]=function(_0x293e8c,_0x51b342){var _0x3b5733={},_0x4f551a={},_0x4574f9={'count':0x0,'rows':[]};var _0x2c30d6=_['map'](db[_0x0fed('0x32')][_0x0fed('0x33')],function(_0x96ae06){return{'name':_0x96ae06[_0x0fed('0x34')],'type':_0x96ae06[_0x0fed('0x35')][_0x0fed('0x36')]};});_0x4f551a[_0x0fed('0x37')]=_[_0x0fed('0x38')](_0x2c30d6,_0x0fed('0x2f'));_0x4f551a['query']=_['keys'](_0x293e8c[_0x0fed('0x39')]);_0x4f551a[_0x0fed('0x3a')]=_[_0x0fed('0x3b')](_0x4f551a[_0x0fed('0x37')],_0x4f551a[_0x0fed('0x39')]);_0x3b5733[_0x0fed('0x3c')]=_[_0x0fed('0x3b')](_0x4f551a[_0x0fed('0x37')],qs[_0x0fed('0x3d')](_0x293e8c[_0x0fed('0x39')][_0x0fed('0x3d')]));_0x3b5733[_0x0fed('0x3c')]=_0x3b5733[_0x0fed('0x3c')][_0x0fed('0x3e')]?_0x3b5733['attributes']:_0x4f551a[_0x0fed('0x37')];if(!_0x293e8c[_0x0fed('0x39')]['hasOwnProperty']('nolimit')){_0x3b5733[_0x0fed('0x23')]=qs[_0x0fed('0x23')](_0x293e8c['query'][_0x0fed('0x23')]);_0x3b5733['offset']=qs[_0x0fed('0x3f')](_0x293e8c[_0x0fed('0x39')][_0x0fed('0x3f')]);}_0x3b5733[_0x0fed('0x40')]=qs[_0x0fed('0x41')](_0x293e8c['query'][_0x0fed('0x41')]);_0x3b5733[_0x0fed('0x42')]=qs[_0x0fed('0x3a')](_['pick'](_0x293e8c[_0x0fed('0x39')],_0x4f551a[_0x0fed('0x3a')]),_0x2c30d6);if(_0x293e8c[_0x0fed('0x39')][_0x0fed('0x43')]){_0x3b5733[_0x0fed('0x42')]=_[_0x0fed('0x44')](_0x3b5733[_0x0fed('0x42')],{'$or':_[_0x0fed('0x38')](_0x2c30d6,function(_0x8ab11a){if(_0x8ab11a['type']!==_0x0fed('0x45')){var _0x5e556e={};_0x5e556e[_0x8ab11a[_0x0fed('0x2f')]]={'$like':'%'+_0x293e8c[_0x0fed('0x39')][_0x0fed('0x43')]+'%'};return _0x5e556e;}})});}_0x3b5733=_[_0x0fed('0x44')]({},_0x3b5733,_0x293e8c[_0x0fed('0x46')]);var _0x35df9e={'where':_0x3b5733[_0x0fed('0x42')]};return db[_0x0fed('0x32')]['count'](_0x35df9e)['then'](function(_0x2b886e){_0x4574f9[_0x0fed('0x22')]=_0x2b886e;if(_0x293e8c[_0x0fed('0x39')][_0x0fed('0x47')]){_0x3b5733['include']=[{'all':!![]}];}return db[_0x0fed('0x32')][_0x0fed('0x48')](_0x3b5733);})[_0x0fed('0x28')](function(_0xf13108){_0x4574f9['rows']=_0xf13108;return _0x4574f9;})['then'](respondWithFilteredResult(_0x51b342,_0x3b5733))[_0x0fed('0x49')](handleError(_0x51b342,null));};exports[_0x0fed('0x4a')]=function(_0x51e214,_0x4cae07){var _0x1860b1={'raw':!![],'where':{'id':_0x51e214[_0x0fed('0x4b')]['id']}},_0x59728a={};_0x59728a['model']=_[_0x0fed('0x4c')](db[_0x0fed('0x32')][_0x0fed('0x33')]);_0x59728a['query']=_[_0x0fed('0x4c')](_0x51e214[_0x0fed('0x39')]);_0x59728a['filters']=_[_0x0fed('0x3b')](_0x59728a[_0x0fed('0x37')],_0x59728a[_0x0fed('0x39')]);_0x1860b1['attributes']=_[_0x0fed('0x3b')](_0x59728a[_0x0fed('0x37')],qs['fields'](_0x51e214['query']['fields']));_0x1860b1[_0x0fed('0x3c')]=_0x1860b1[_0x0fed('0x3c')][_0x0fed('0x3e')]?_0x1860b1[_0x0fed('0x3c')]:_0x59728a[_0x0fed('0x37')];if(_0x51e214['query']['includeAll']){_0x1860b1[_0x0fed('0x4d')]=[{'all':!![]}];}_0x1860b1=_[_0x0fed('0x44')]({},_0x1860b1,_0x51e214[_0x0fed('0x46')]);return db[_0x0fed('0x32')][_0x0fed('0x4e')](_0x1860b1)[_0x0fed('0x28')](handleEntityNotFound(_0x4cae07,null))[_0x0fed('0x28')](respondWithResult(_0x4cae07,null))['catch'](handleError(_0x4cae07,null));};exports[_0x0fed('0x4f')]=function(_0x2ff5ad,_0x4317c3){return db['WhatsappQueue'][_0x0fed('0x4f')](_0x2ff5ad[_0x0fed('0x50')],{})[_0x0fed('0x28')](function(_0x23055c){var _0x2fe030=_0x2ff5ad[_0x0fed('0x51')][_0x0fed('0x2a')]({'plain':!![]});if(!_0x2fe030)throw new Error(_0x0fed('0x52'));if(_0x2fe030[_0x0fed('0x53')]===_0x0fed('0x51')){var _0x456b5b=_0x23055c['get']({'plain':!![]});var _0x57aa95=_0x0fed('0x2b');return db[_0x0fed('0x54')][_0x0fed('0x4e')]({'where':{'name':_0x57aa95,'userProfileId':_0x2fe030[_0x0fed('0x55')]},'raw':!![]})[_0x0fed('0x28')](function(_0x21af72){if(_0x21af72&&_0x21af72['autoAssociation']===0x0){return db[_0x0fed('0x2c')][_0x0fed('0x4f')]({'name':_0x456b5b[_0x0fed('0x2f')],'resourceId':_0x456b5b['id'],'type':_0x21af72[_0x0fed('0x2f')],'sectionId':_0x21af72['id']},{})[_0x0fed('0x28')](function(){return _0x23055c;});}else{return _0x23055c;}})[_0x0fed('0x49')](function(_0x3411a1){logger[_0x0fed('0x2d')](_0x0fed('0x56'),_0x3411a1);throw _0x3411a1;});}return _0x23055c;})[_0x0fed('0x28')](respondWithResult(_0x4317c3,0xc9))['catch'](handleError(_0x4317c3,null));};exports[_0x0fed('0x27')]=function(_0x14f5c5,_0x52081c){if(_0x14f5c5[_0x0fed('0x50')]['id']){delete _0x14f5c5['body']['id'];}return db['WhatsappQueue'][_0x0fed('0x4e')]({'where':{'id':_0x14f5c5[_0x0fed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x52081c,null))[_0x0fed('0x28')](saveUpdates(_0x14f5c5[_0x0fed('0x50')],null))[_0x0fed('0x28')](respondWithResult(_0x52081c,null))['catch'](handleError(_0x52081c,null));};exports[_0x0fed('0x29')]=function(_0x3fad52,_0x17a78a){return db[_0x0fed('0x32')][_0x0fed('0x4e')]({'where':{'id':_0x3fad52[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x17a78a,null))[_0x0fed('0x28')](removeEntity(_0x17a78a,null))['catch'](handleError(_0x17a78a,null));};exports[_0x0fed('0x57')]=function(_0x326622,_0x401a8b){return db['WhatsappQueue']['describe']()[_0x0fed('0x28')](respondWithResult(_0x401a8b,null))[_0x0fed('0x49')](handleError(_0x401a8b,null));};exports['getMembers']=function(_0x37d350,_0x1ffe52,_0x1d8c46){var _0x3f4813={'raw':!![],'where':{}},_0x4bcce8={},_0x4194e1;return db[_0x0fed('0x32')]['findOne']({'where':{'id':_0x37d350[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x1ffe52,null))['then'](function(_0x18d06b){if(_0x18d06b){_0x4194e1=_0x18d06b[_0x0fed('0x2a')]({'plain':!![]});_0x4bcce8[_0x0fed('0x37')]=_[_0x0fed('0x4c')](db[_0x0fed('0x58')][_0x0fed('0x33')]);_0x4bcce8[_0x0fed('0x39')]=_[_0x0fed('0x4c')](_0x37d350[_0x0fed('0x39')]);_0x4bcce8[_0x0fed('0x3a')]=_['intersection'](_0x4bcce8[_0x0fed('0x37')],_0x4bcce8[_0x0fed('0x39')]);_0x3f4813['attributes']=_[_0x0fed('0x3b')](_0x4bcce8[_0x0fed('0x37')],qs[_0x0fed('0x3d')](_0x37d350[_0x0fed('0x39')][_0x0fed('0x3d')]));_0x3f4813[_0x0fed('0x3c')]=_0x3f4813[_0x0fed('0x3c')][_0x0fed('0x3e')]?_0x3f4813[_0x0fed('0x3c')]:_0x4bcce8[_0x0fed('0x37')];if(!_0x37d350['query'][_0x0fed('0x59')](_0x0fed('0x5a'))){_0x3f4813[_0x0fed('0x23')]=qs[_0x0fed('0x23')](_0x37d350[_0x0fed('0x39')]['limit']);_0x3f4813['offset']=qs['offset'](_0x37d350[_0x0fed('0x39')][_0x0fed('0x3f')]);}_0x3f4813[_0x0fed('0x40')]=qs[_0x0fed('0x41')](_0x37d350[_0x0fed('0x39')][_0x0fed('0x41')]);_0x3f4813[_0x0fed('0x42')]=qs['filters'](_[_0x0fed('0x5b')](_0x37d350[_0x0fed('0x39')],_0x4bcce8['filters']));_0x3f4813[_0x0fed('0x42')][_0x0fed('0x5c')]=_0x18d06b['id'];if(_0x37d350['query'][_0x0fed('0x43')]){_0x3f4813[_0x0fed('0x42')]=_['merge'](_0x3f4813[_0x0fed('0x42')],{'$or':_[_0x0fed('0x38')](_0x3f4813['attributes'],function(_0x455a45){var _0x1a9ce2={};_0x1a9ce2[_0x455a45]={'$like':'%'+_0x37d350[_0x0fed('0x39')][_0x0fed('0x43')]+'%'};return _0x1a9ce2;})});}_0x3f4813=_[_0x0fed('0x44')]({},_0x3f4813,_0x37d350[_0x0fed('0x46')]);return db['UserWhatsappQueue'][_0x0fed('0x48')](_0x3f4813);}})['then'](function(_0x4f0c98){if(_0x4f0c98){return db[_0x0fed('0x5d')][_0x0fed('0x5e')]({'where':{'id':_[_0x0fed('0x38')](_0x4f0c98,_0x0fed('0x5f')),'role':_0x0fed('0x60')},'attributes':['id','name',_0x0fed('0x61'),'updatedAt','createdAt']});}})['then'](function(_0x251e90){if(_0x251e90){return{'count':_0x251e90[_0x0fed('0x22')],'rows':_[_0x0fed('0x38')](_0x251e90[_0x0fed('0x62')],function(_0x44caa9){return{'membername':_0x44caa9['name'],'UserId':_0x44caa9['id'],'queue_name':_0x4194e1[_0x0fed('0x2f')],'WhatsappQueueId':_0x4194e1['id'],'interface':util[_0x0fed('0x63')]('%s/%s',_0x0fed('0x64'),_0x44caa9[_0x0fed('0x2f')]),'penalty':0x0,'paused':_0x44caa9[_0x0fed('0x61')],'createdAt':_0x44caa9[_0x0fed('0x65')],'updatedAt':_0x44caa9[_0x0fed('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ffe52,_0x3f4813))[_0x0fed('0x49')](handleError(_0x1ffe52,null));};exports[_0x0fed('0x67')]=function(_0x400c1b,_0x41a294,_0x41b6f3){var _0xc3f37c={};var _0x4a482d={};var _0x175660;var _0xf3d6ce;return db[_0x0fed('0x32')][_0x0fed('0x68')]({'where':{'id':_0x400c1b[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x41a294,null))[_0x0fed('0x28')](function(_0x4098cf){if(_0x4098cf){_0x175660=_0x4098cf;_0x4a482d[_0x0fed('0x37')]=_[_0x0fed('0x4c')](db[_0x0fed('0x69')][_0x0fed('0x33')]);_0x4a482d[_0x0fed('0x39')]=_['keys'](_0x400c1b[_0x0fed('0x39')]);_0x4a482d[_0x0fed('0x3a')]=_['intersection'](_0x4a482d[_0x0fed('0x37')],_0x4a482d['query']);_0xc3f37c[_0x0fed('0x3c')]=_['intersection'](_0x4a482d[_0x0fed('0x37')],qs[_0x0fed('0x3d')](_0x400c1b[_0x0fed('0x39')][_0x0fed('0x3d')]));_0xc3f37c[_0x0fed('0x3c')]=_0xc3f37c[_0x0fed('0x3c')][_0x0fed('0x3e')]?_0xc3f37c[_0x0fed('0x3c')]:_0x4a482d[_0x0fed('0x37')];_0xc3f37c[_0x0fed('0x40')]=qs['sort'](_0x400c1b[_0x0fed('0x39')][_0x0fed('0x41')]);_0xc3f37c[_0x0fed('0x42')]=qs[_0x0fed('0x3a')](_[_0x0fed('0x5b')](_0x400c1b['query'],_0x4a482d[_0x0fed('0x3a')]));if(_0x400c1b[_0x0fed('0x39')]['filter']){_0xc3f37c[_0x0fed('0x42')]=_[_0x0fed('0x44')](_0xc3f37c['where'],{'$or':_[_0x0fed('0x38')](_0xc3f37c[_0x0fed('0x3c')],function(_0x216119){var _0x5e9612={};_0x5e9612[_0x216119]={'$like':'%'+_0x400c1b[_0x0fed('0x39')][_0x0fed('0x43')]+'%'};return _0x5e9612;})});}_0xc3f37c=_[_0x0fed('0x44')]({},_0xc3f37c,_0x400c1b[_0x0fed('0x46')]);return _0x175660['getTeams'](_0xc3f37c);}})[_0x0fed('0x28')](function(_0x454011){if(_0x454011){_0xf3d6ce=_0x454011[_0x0fed('0x3e')];if(!_0x400c1b[_0x0fed('0x39')]['hasOwnProperty'](_0x0fed('0x5a'))){_0xc3f37c[_0x0fed('0x23')]=qs['limit'](_0x400c1b[_0x0fed('0x39')][_0x0fed('0x23')]);_0xc3f37c['offset']=qs[_0x0fed('0x3f')](_0x400c1b[_0x0fed('0x39')][_0x0fed('0x3f')]);}return _0x175660[_0x0fed('0x67')](_0xc3f37c);}})['then'](function(_0x55b7a1){if(_0x55b7a1){return _0x55b7a1?{'count':_0xf3d6ce,'rows':_0x55b7a1}:null;}})[_0x0fed('0x28')](respondWithResult(_0x41a294,null))[_0x0fed('0x49')](handleError(_0x41a294,null));};exports[_0x0fed('0x6a')]=function(_0x82c22f,_0x1cec49,_0x393d1c){var _0x2b6487=_0x82c22f[_0x0fed('0x50')][_0x0fed('0x6b')];return db[_0x0fed('0x69')][_0x0fed('0x48')]({'where':{'id':_0x2b6487},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0fed('0x6c'),'attributes':['id',_0x0fed('0x2f'),_0x0fed('0x6d'),_0x0fed('0x6e'),'interface'],'raw':!![]}]})[_0x0fed('0x28')](function(_0x59f4e9){if(_0x59f4e9){var _0x5ec4aa=_['flatMap'](_0x59f4e9,function(_0x4fe663){var _0x1a7016=_0x4fe663[_0x0fed('0x2a')]({'plain':!![]});return _0x1a7016[_0x0fed('0x6c')];});return db[_0x0fed('0x32')][_0x0fed('0x4e')]({'where':{'id':_0x82c22f[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](function(_0x14dc8e){return db[_0x0fed('0x6f')]['transaction'](function(_0x6bd9ce){return _0x14dc8e[_0x0fed('0x6a')](_0x2b6487,{'transaction':_0x6bd9ce})[_0x0fed('0x28')](function(){return BPromise[_0x0fed('0x70')](_0x5ec4aa,function(_0x130fb1){return db[_0x0fed('0x58')]['findOrCreate']({'where':{'UserId':_0x130fb1['id'],'WhatsappQueueId':_0x82c22f[_0x0fed('0x4b')]['id']},'transaction':_0x6bd9ce});});})[_0x0fed('0x28')](function(){_0x5ec4aa['forEach'](function(_0xdb1439){socket[_0x0fed('0x71')](_0x0fed('0x72'),{'UserId':_0xdb1439['id'],'WhatsappQueueId':_0x14dc8e['id']});});});});});}})[_0x0fed('0x28')](respondWithStatusCode(_0x1cec49,null))[_0x0fed('0x49')](handleError(_0x1cec49,null));};exports['removeTeams']=function(_0x38bb65,_0x58dc84,_0x403911){return db['Team'][_0x0fed('0x48')]({'where':{'id':_0x38bb65[_0x0fed('0x39')][_0x0fed('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x0fed('0x5d')],'as':_0x0fed('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x0fed('0x28')](handleEntityNotFound(_0x58dc84,null))['then'](function(_0x774345){var _0x5e63f1=_[_0x0fed('0x38')](_0x774345,'id');var _0x4cb73f=[];var _0x2a64e8=[];var _0x5534aa=squel['select']();_0x5534aa['field'](_0x0fed('0x73'))[_0x0fed('0x74')](_0x0fed('0x75'),'tq')[_0x0fed('0x76')]('user_has_teams','ut',_0x0fed('0x77'))[_0x0fed('0x42')](_0x0fed('0x78'),_0x38bb65[_0x0fed('0x4b')]['id']);for(var _0x302c74=0x0;_0x302c74<_0x774345[_0x0fed('0x3e')];_0x302c74+=0x1){let _0x50b9ee=_0x774345[_0x302c74];for(var _0x15591d=0x0;_0x15591d<_0x50b9ee[_0x0fed('0x6c')][_0x0fed('0x3e')];_0x15591d+=0x1){let _0x4dd6e7=_0x50b9ee[_0x0fed('0x6c')][_0x15591d];var _0x326806=_0x5534aa['clone']();_0x326806['where'](_0x0fed('0x79'),_0x4dd6e7['id']);_0x2a64e8['push'](db[_0x0fed('0x6f')]['query'](_0x326806['toString'](),{'type':db[_0x0fed('0x6f')]['QueryTypes']['SELECT']})[_0x0fed('0x28')](function(_0x1d7dae){if(_0x1d7dae[_0x0fed('0x3e')]===0x1){return _0x4dd6e7['id'];}else{var _0x128d2d=_[_0x0fed('0x7a')](_[_0x0fed('0x38')](_0x1d7dae,_0x0fed('0x7b')),function(_0x3a1f2a){return _[_0x0fed('0x7c')](_0x5e63f1,_0x3a1f2a);});if(_0x128d2d){return _0x4dd6e7['id'];}}}));}}return BPromise[_0x0fed('0x7d')](_0x2a64e8)['then'](function(_0x439255){_0x4cb73f=_(_0x4cb73f)[_0x0fed('0x7e')](_0x439255)['compact']()[_0x0fed('0x7f')]();return db[_0x0fed('0x32')][_0x0fed('0x4e')]({'where':{'id':_0x38bb65[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](function(_0x56316e){return db['sequelize'][_0x0fed('0x80')](function(_0x4f77e0){return _0x56316e[_0x0fed('0x81')](_0x38bb65[_0x0fed('0x39')]['ids'],{'transaction':_0x4f77e0})['then'](function(){if(!_[_0x0fed('0x82')](_0x4cb73f)){return _0x56316e['removeAgents'](_0x4cb73f,{'transaction':_0x4f77e0});}})[_0x0fed('0x28')](function(){_0x4cb73f[_0x0fed('0x83')](function(_0x559d50){socket[_0x0fed('0x71')](_0x0fed('0x84'),{'UserId':_0x559d50,'WhatsappQueueId':_0x56316e['id']});});});});});});})['then'](respondWithStatusCode(_0x58dc84,null))['catch'](handleError(_0x58dc84,null));};exports['addAgents']=function(_0x56dcc3,_0x3e441a,_0x57e9d8){return db[_0x0fed('0x32')]['find']({'where':{'id':_0x56dcc3[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x3e441a,null))[_0x0fed('0x28')](function(_0x2193e6){if(_0x2193e6){return _0x2193e6['addAgents'](_0x56dcc3[_0x0fed('0x50')][_0x0fed('0x6b')],_[_0x0fed('0x85')](_0x56dcc3[_0x0fed('0x50')],[_0x0fed('0x6b'),'id'])||{})[_0x0fed('0x86')](function(_0x5e0481){for(var _0xc08e3c=0x0;_0xc08e3c<_0x56dcc3[_0x0fed('0x50')][_0x0fed('0x6b')][_0x0fed('0x3e')];_0xc08e3c+=0x1){socket[_0x0fed('0x71')](_0x0fed('0x72'),{'UserId':Number(_0x56dcc3['body'][_0x0fed('0x6b')][_0xc08e3c]),'WhatsappQueueId':Number(_0x56dcc3[_0x0fed('0x4b')]['id'])});}return _0x5e0481;});}})[_0x0fed('0x28')](respondWithResult(_0x3e441a,null))[_0x0fed('0x49')](handleError(_0x3e441a,null));};exports['removeAgents']=function(_0x1448e8,_0x1b05ac,_0x96e85b){return db[_0x0fed('0x32')]['find']({'where':{'id':_0x1448e8[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x1b05ac,null))[_0x0fed('0x28')](function(_0xcf2d5a){if(_0xcf2d5a){return _0xcf2d5a[_0x0fed('0x87')](_0x1448e8['query'][_0x0fed('0x6b')])[_0x0fed('0x28')](function(){if(_[_0x0fed('0x88')](_0x1448e8[_0x0fed('0x39')][_0x0fed('0x6b')])){for(var _0x38ad67=0x0;_0x38ad67<_0x1448e8[_0x0fed('0x39')]['ids'][_0x0fed('0x3e')];_0x38ad67+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1448e8[_0x0fed('0x39')][_0x0fed('0x6b')][_0x38ad67]),'WhatsappQueueId':Number(_0x1448e8[_0x0fed('0x4b')]['id'])});}}else{socket['emit'](_0x0fed('0x84'),{'UserId':Number(_0x1448e8[_0x0fed('0x39')][_0x0fed('0x6b')]),'WhatsappQueueId':Number(_0x1448e8[_0x0fed('0x4b')]['id'])});}});}})[_0x0fed('0x28')](respondWithStatusCode(_0x1b05ac,null))['catch'](handleError(_0x1b05ac,null));};exports[_0x0fed('0x89')]=function(_0x3afac2,_0x257a35,_0x54c3c6){var _0x1e3813={};var _0x2e6d95={};var _0x31f0cc;var _0x2e9dbe;return db[_0x0fed('0x32')][_0x0fed('0x68')]({'where':{'id':_0x3afac2[_0x0fed('0x4b')]['id']}})[_0x0fed('0x28')](handleEntityNotFound(_0x257a35,null))['then'](function(_0x19443c){if(_0x19443c){_0x31f0cc=_0x19443c;_0x2e6d95[_0x0fed('0x37')]=_[_0x0fed('0x4c')](db[_0x0fed('0x5d')][_0x0fed('0x33')]);_0x2e6d95[_0x0fed('0x39')]=_[_0x0fed('0x4c')](_0x3afac2[_0x0fed('0x39')]);_0x2e6d95[_0x0fed('0x3a')]=_[_0x0fed('0x3b')](_0x2e6d95[_0x0fed('0x37')],_0x2e6d95[_0x0fed('0x39')]);_0x1e3813[_0x0fed('0x3c')]=_[_0x0fed('0x3b')](_0x2e6d95['model'],qs[_0x0fed('0x3d')](_0x3afac2[_0x0fed('0x39')][_0x0fed('0x3d')]));_0x1e3813['attributes']=_0x1e3813[_0x0fed('0x3c')]['length']?_0x1e3813[_0x0fed('0x3c')]:_0x2e6d95[_0x0fed('0x37')];_0x1e3813[_0x0fed('0x40')]=qs['sort'](_0x3afac2[_0x0fed('0x39')][_0x0fed('0x41')]);_0x1e3813[_0x0fed('0x42')]=qs[_0x0fed('0x3a')](_['pick'](_0x3afac2[_0x0fed('0x39')],_0x2e6d95[_0x0fed('0x3a')]));if(_0x3afac2[_0x0fed('0x39')]['filter']){_0x1e3813[_0x0fed('0x42')]=_[_0x0fed('0x44')](_0x1e3813[_0x0fed('0x42')],{'$or':_['map'](_0x1e3813['attributes'],function(_0x168eae){var _0x49d84d={};_0x49d84d[_0x168eae]={'$like':'%'+_0x3afac2[_0x0fed('0x39')][_0x0fed('0x43')]+'%'};return _0x49d84d;})});}_0x1e3813=_[_0x0fed('0x44')]({},_0x1e3813,_0x3afac2['options']);return _0x31f0cc[_0x0fed('0x89')](_0x1e3813);}})[_0x0fed('0x28')](function(_0x1f1662){if(_0x1f1662){_0x2e9dbe=_0x1f1662[_0x0fed('0x3e')];if(!_0x3afac2[_0x0fed('0x39')][_0x0fed('0x59')]('nolimit')){_0x1e3813[_0x0fed('0x23')]=qs[_0x0fed('0x23')](_0x3afac2[_0x0fed('0x39')][_0x0fed('0x23')]);_0x1e3813[_0x0fed('0x3f')]=qs[_0x0fed('0x3f')](_0x3afac2[_0x0fed('0x39')][_0x0fed('0x3f')]);}return _0x31f0cc[_0x0fed('0x89')](_0x1e3813);}})['then'](function(_0xd2324e){if(_0xd2324e){return _0xd2324e?{'count':_0x2e9dbe,'rows':_0xd2324e}:null;}})['then'](respondWithResult(_0x257a35,null))[_0x0fed('0x49')](handleError(_0x257a35,null));}; \ No newline at end of file +var _0xa583=['tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','userWhatsappQueue:remove','addAgents','userWhatsappQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','Team','select','field'];(function(_0x31e555,_0x859c76){var _0xd91def=function(_0x49eabb){while(--_0x49eabb){_0x31e555['push'](_0x31e555['shift']());}};_0xd91def(++_0x859c76);}(_0xa583,0x12c));var _0x3a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa583[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3a58('0x0'));var rimraf=require(_0x3a58('0x1'));var zipdir=require(_0x3a58('0x2'));var jsonpatch=require(_0x3a58('0x3'));var rp=require(_0x3a58('0x4'));var moment=require(_0x3a58('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a58('0x6'));var util=require(_0x3a58('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3a58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a58('0x9'));var _=require(_0x3a58('0xa'));var squel=require('squel');var crypto=require(_0x3a58('0xb'));var jsforce=require(_0x3a58('0xc'));var deskjs=require(_0x3a58('0xd'));var toCsv=require(_0x3a58('0x8'));var querystring=require(_0x3a58('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3a58('0xf'));var qs=require(_0x3a58('0x10'));var as=require(_0x3a58('0x11'));var hardwareService=require(_0x3a58('0x12'));var logger=require(_0x3a58('0x13'))(_0x3a58('0x14'));var utils=require(_0x3a58('0x15'));var config=require(_0x3a58('0x16'));var licenseUtil=require(_0x3a58('0x17'));var db=require(_0x3a58('0x18'))['db'];config[_0x3a58('0x19')]=_['defaults'](config[_0x3a58('0x19')],{'host':_0x3a58('0x1a'),'port':0x18eb});var socket=require(_0x3a58('0x1b'))(new Redis(config[_0x3a58('0x19')]));require(_0x3a58('0x1c'))[_0x3a58('0x1d')](socket);function respondWithStatusCode(_0x7c0d2,_0x2907f3){_0x2907f3=_0x2907f3||0xcc;return function(_0x16ef75){if(_0x16ef75){return _0x7c0d2[_0x3a58('0x1e')](_0x2907f3);}return _0x7c0d2['status'](_0x2907f3)[_0x3a58('0x1f')]();};}function respondWithResult(_0x5e8305,_0x46e0be){_0x46e0be=_0x46e0be||0xc8;return function(_0x4fc082){if(_0x4fc082){return _0x5e8305[_0x3a58('0x20')](_0x46e0be)[_0x3a58('0x21')](_0x4fc082);}};}function respondWithFilteredResult(_0x1f96b7,_0x8a377a){return function(_0x366210){if(_0x366210){var _0x51697c=typeof _0x8a377a['offset']===_0x3a58('0x22')&&typeof _0x8a377a[_0x3a58('0x23')]==='undefined';var _0x1258e6=_0x366210[_0x3a58('0x24')];var _0x2eac3d=_0x51697c?0x0:_0x8a377a[_0x3a58('0x25')];var _0x1a1ce4=_0x51697c?_0x366210[_0x3a58('0x24')]:_0x8a377a[_0x3a58('0x25')]+_0x8a377a[_0x3a58('0x23')];var _0x1bc429;if(_0x1a1ce4>=_0x1258e6){_0x1a1ce4=_0x1258e6;_0x1bc429=0xc8;}else{_0x1bc429=0xce;}_0x1f96b7['status'](_0x1bc429);return _0x1f96b7[_0x3a58('0x26')](_0x3a58('0x27'),_0x2eac3d+'-'+_0x1a1ce4+'/'+_0x1258e6)[_0x3a58('0x21')](_0x366210);}return null;};}function patchUpdates(_0x1305ef){return function(_0x373891){try{jsonpatch[_0x3a58('0x28')](_0x373891,_0x1305ef,!![]);}catch(_0x5e2718){return BPromise['reject'](_0x5e2718);}return _0x373891[_0x3a58('0x29')]();};}function saveUpdates(_0xf81894,_0x2324a3){return function(_0x1fda92){if(_0x1fda92){return _0x1fda92[_0x3a58('0x2a')](_0xf81894)[_0x3a58('0x2b')](function(_0x1af087){return _0x1af087;});}return null;};}function removeEntity(_0x557ec5,_0x16c940){return function(_0x262f05){if(_0x262f05){return _0x262f05[_0x3a58('0x2c')]()[_0x3a58('0x2b')](function(){var _0x26def9=_0x262f05[_0x3a58('0x2d')]({'plain':!![]});var _0xe907a3=_0x3a58('0x2e');return db[_0x3a58('0x2f')][_0x3a58('0x2c')]({'where':{'type':_0xe907a3,'resourceId':_0x26def9['id']}})[_0x3a58('0x2b')](function(){return _0x262f05;});})['then'](function(){_0x557ec5[_0x3a58('0x20')](0xcc)[_0x3a58('0x1f')]();});}};}function handleEntityNotFound(_0x468352,_0x1460a5){return function(_0x2d1087){if(!_0x2d1087){_0x468352[_0x3a58('0x1e')](0x194);}return _0x2d1087;};}function handleError(_0x2bfcdf,_0x381c26){_0x381c26=_0x381c26||0x1f4;return function(_0x5bd866){logger[_0x3a58('0x30')](_0x5bd866[_0x3a58('0x31')]);if(_0x5bd866[_0x3a58('0x32')]){delete _0x5bd866[_0x3a58('0x32')];}_0x2bfcdf[_0x3a58('0x20')](_0x381c26)[_0x3a58('0x33')](_0x5bd866);};}exports[_0x3a58('0x34')]=function(_0x291613,_0x358f7b){var _0x18a6b0={},_0x46b7b9={},_0x5733c4={'count':0x0,'rows':[]};var _0x267822=_[_0x3a58('0x35')](db[_0x3a58('0x36')][_0x3a58('0x37')],function(_0x4a25f3){return{'name':_0x4a25f3[_0x3a58('0x38')],'type':_0x4a25f3['type'][_0x3a58('0x39')]};});_0x46b7b9[_0x3a58('0x3a')]=_['map'](_0x267822,'name');_0x46b7b9[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x291613[_0x3a58('0x3b')]);_0x46b7b9['filters']=_[_0x3a58('0x3d')](_0x46b7b9[_0x3a58('0x3a')],_0x46b7b9[_0x3a58('0x3b')]);_0x18a6b0[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x46b7b9[_0x3a58('0x3a')],qs['fields'](_0x291613[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x18a6b0[_0x3a58('0x3e')]=_0x18a6b0['attributes'][_0x3a58('0x40')]?_0x18a6b0[_0x3a58('0x3e')]:_0x46b7b9[_0x3a58('0x3a')];if(!_0x291613[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x18a6b0['limit']=qs[_0x3a58('0x23')](_0x291613[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x18a6b0[_0x3a58('0x25')]=qs['offset'](_0x291613['query'][_0x3a58('0x25')]);}_0x18a6b0[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x291613[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x18a6b0['where']=qs[_0x3a58('0x45')](_[_0x3a58('0x46')](_0x291613['query'],_0x46b7b9[_0x3a58('0x45')]),_0x267822);if(_0x291613[_0x3a58('0x3b')][_0x3a58('0x47')]){_0x18a6b0[_0x3a58('0x48')]=_[_0x3a58('0x49')](_0x18a6b0['where'],{'$or':_[_0x3a58('0x35')](_0x267822,function(_0x1768e8){if(_0x1768e8['type']!==_0x3a58('0x4a')){var _0x3784a4={};_0x3784a4[_0x1768e8['name']]={'$like':'%'+_0x291613[_0x3a58('0x3b')][_0x3a58('0x47')]+'%'};return _0x3784a4;}})});}_0x18a6b0=_[_0x3a58('0x49')]({},_0x18a6b0,_0x291613['options']);var _0x24b819={'where':_0x18a6b0['where']};return db[_0x3a58('0x36')]['count'](_0x24b819)['then'](function(_0x245db2){_0x5733c4[_0x3a58('0x24')]=_0x245db2;if(_0x291613[_0x3a58('0x3b')][_0x3a58('0x4b')]){_0x18a6b0['include']=[{'all':!![]}];}return db[_0x3a58('0x36')][_0x3a58('0x4c')](_0x18a6b0);})[_0x3a58('0x2b')](function(_0x228634){_0x5733c4[_0x3a58('0x4d')]=_0x228634;return _0x5733c4;})[_0x3a58('0x2b')](respondWithFilteredResult(_0x358f7b,_0x18a6b0))[_0x3a58('0x4e')](handleError(_0x358f7b,null));};exports[_0x3a58('0x4f')]=function(_0x4dfce9,_0x1755a9){var _0x202066={'raw':!![],'where':{'id':_0x4dfce9[_0x3a58('0x50')]['id']}},_0x1007d4={};_0x1007d4[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db['WhatsappQueue']['rawAttributes']);_0x1007d4['query']=_[_0x3a58('0x3c')](_0x4dfce9[_0x3a58('0x3b')]);_0x1007d4[_0x3a58('0x45')]=_[_0x3a58('0x3d')](_0x1007d4['model'],_0x1007d4[_0x3a58('0x3b')]);_0x202066[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x1007d4[_0x3a58('0x3a')],qs['fields'](_0x4dfce9[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x202066[_0x3a58('0x3e')]=_0x202066[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x202066[_0x3a58('0x3e')]:_0x1007d4['model'];if(_0x4dfce9[_0x3a58('0x3b')][_0x3a58('0x4b')]){_0x202066[_0x3a58('0x51')]=[{'all':!![]}];}_0x202066=_['merge']({},_0x202066,_0x4dfce9[_0x3a58('0x52')]);return db[_0x3a58('0x36')]['find'](_0x202066)[_0x3a58('0x2b')](handleEntityNotFound(_0x1755a9,null))[_0x3a58('0x2b')](respondWithResult(_0x1755a9,null))['catch'](handleError(_0x1755a9,null));};exports['create']=function(_0x5bce8a,_0x3fa996){return db['WhatsappQueue']['create'](_0x5bce8a[_0x3a58('0x53')],{})[_0x3a58('0x2b')](function(_0x26e1ac){var _0x3d1f05=_0x5bce8a[_0x3a58('0x54')][_0x3a58('0x2d')]({'plain':!![]});if(!_0x3d1f05)throw new Error(_0x3a58('0x55'));if(_0x3d1f05[_0x3a58('0x56')]==='user'){var _0x4e876e=_0x26e1ac[_0x3a58('0x2d')]({'plain':!![]});var _0x565e82=_0x3a58('0x2e');return db['UserProfileSection'][_0x3a58('0x57')]({'where':{'name':_0x565e82,'userProfileId':_0x3d1f05[_0x3a58('0x58')]},'raw':!![]})[_0x3a58('0x2b')](function(_0x206b9d){if(_0x206b9d&&_0x206b9d[_0x3a58('0x59')]===0x0){return db[_0x3a58('0x2f')]['create']({'name':_0x4e876e[_0x3a58('0x32')],'resourceId':_0x4e876e['id'],'type':_0x206b9d[_0x3a58('0x32')],'sectionId':_0x206b9d['id']},{})[_0x3a58('0x2b')](function(){return _0x26e1ac;});}else{return _0x26e1ac;}})['catch'](function(_0x1e488c){logger[_0x3a58('0x30')](_0x3a58('0x5a'),_0x1e488c);throw _0x1e488c;});}return _0x26e1ac;})['then'](respondWithResult(_0x3fa996,0xc9))[_0x3a58('0x4e')](handleError(_0x3fa996,null));};exports[_0x3a58('0x2a')]=function(_0x289e84,_0x39d4ba){if(_0x289e84[_0x3a58('0x53')]['id']){delete _0x289e84['body']['id'];}return db['WhatsappQueue'][_0x3a58('0x57')]({'where':{'id':_0x289e84[_0x3a58('0x50')]['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x39d4ba,null))[_0x3a58('0x2b')](saveUpdates(_0x289e84['body'],null))[_0x3a58('0x2b')](respondWithResult(_0x39d4ba,null))[_0x3a58('0x4e')](handleError(_0x39d4ba,null));};exports[_0x3a58('0x2c')]=function(_0x578799,_0x1cdd81){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x578799[_0x3a58('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cdd81,null))[_0x3a58('0x2b')](removeEntity(_0x1cdd81,null))[_0x3a58('0x4e')](handleError(_0x1cdd81,null));};exports[_0x3a58('0x5b')]=function(_0x4a777d,_0x45f743){return db['WhatsappQueue'][_0x3a58('0x5b')]()[_0x3a58('0x2b')](respondWithResult(_0x45f743,null))[_0x3a58('0x4e')](handleError(_0x45f743,null));};exports[_0x3a58('0x5c')]=function(_0x49a8b0,_0xef2bb,_0x5b7bbc){var _0x5f2989={'raw':!![],'where':{}},_0x39b3fe={},_0x1f9415;return db[_0x3a58('0x36')][_0x3a58('0x5d')]({'where':{'id':_0x49a8b0[_0x3a58('0x50')]['id']}})['then'](handleEntityNotFound(_0xef2bb,null))[_0x3a58('0x2b')](function(_0x13fcfa){if(_0x13fcfa){_0x1f9415=_0x13fcfa['get']({'plain':!![]});_0x39b3fe[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db[_0x3a58('0x5e')][_0x3a58('0x37')]);_0x39b3fe[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x49a8b0['query']);_0x39b3fe[_0x3a58('0x45')]=_['intersection'](_0x39b3fe[_0x3a58('0x3a')],_0x39b3fe[_0x3a58('0x3b')]);_0x5f2989[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x39b3fe['model'],qs[_0x3a58('0x3f')](_0x49a8b0['query']['fields']));_0x5f2989[_0x3a58('0x3e')]=_0x5f2989[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x5f2989['attributes']:_0x39b3fe[_0x3a58('0x3a')];if(!_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x5f2989[_0x3a58('0x23')]=qs['limit'](_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x5f2989[_0x3a58('0x25')]=qs['offset'](_0x49a8b0[_0x3a58('0x3b')]['offset']);}_0x5f2989[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x5f2989[_0x3a58('0x48')]=qs[_0x3a58('0x45')](_['pick'](_0x49a8b0[_0x3a58('0x3b')],_0x39b3fe[_0x3a58('0x45')]));_0x5f2989[_0x3a58('0x48')][_0x3a58('0x5f')]=_0x13fcfa['id'];if(_0x49a8b0[_0x3a58('0x3b')]['filter']){_0x5f2989['where']=_[_0x3a58('0x49')](_0x5f2989[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x5f2989['attributes'],function(_0x516c64){var _0x4a33ca={};_0x4a33ca[_0x516c64]={'$like':'%'+_0x49a8b0['query'][_0x3a58('0x47')]+'%'};return _0x4a33ca;})});}_0x5f2989=_[_0x3a58('0x49')]({},_0x5f2989,_0x49a8b0[_0x3a58('0x52')]);return db[_0x3a58('0x5e')][_0x3a58('0x4c')](_0x5f2989);}})['then'](function(_0xcfc9c9){if(_0xcfc9c9){return db['User'][_0x3a58('0x60')]({'where':{'id':_['map'](_0xcfc9c9,_0x3a58('0x61')),'role':_0x3a58('0x62')},'attributes':['id',_0x3a58('0x32'),_0x3a58('0x63'),_0x3a58('0x64'),_0x3a58('0x65')]});}})[_0x3a58('0x2b')](function(_0x35a25){if(_0x35a25){return{'count':_0x35a25[_0x3a58('0x24')],'rows':_[_0x3a58('0x35')](_0x35a25['rows'],function(_0xf0b01a){return{'membername':_0xf0b01a[_0x3a58('0x32')],'UserId':_0xf0b01a['id'],'queue_name':_0x1f9415[_0x3a58('0x32')],'WhatsappQueueId':_0x1f9415['id'],'interface':util['format']('%s/%s','SIP',_0xf0b01a['name']),'penalty':0x0,'paused':_0xf0b01a[_0x3a58('0x63')],'createdAt':_0xf0b01a[_0x3a58('0x65')],'updatedAt':_0xf0b01a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a58('0x2b')](respondWithFilteredResult(_0xef2bb,_0x5f2989))[_0x3a58('0x4e')](handleError(_0xef2bb,null));};exports['getTeams']=function(_0x1e0d90,_0x26e1de,_0x4de6a1){var _0x309b90={};var _0x2056bf={};var _0x44852e;var _0x4ed258;return db['WhatsappQueue'][_0x3a58('0x5d')]({'where':{'id':_0x1e0d90['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x26e1de,null))['then'](function(_0x35b49a){if(_0x35b49a){_0x44852e=_0x35b49a;_0x2056bf[_0x3a58('0x3a')]=_['keys'](db['Team'][_0x3a58('0x37')]);_0x2056bf[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x1e0d90[_0x3a58('0x3b')]);_0x2056bf[_0x3a58('0x45')]=_['intersection'](_0x2056bf[_0x3a58('0x3a')],_0x2056bf[_0x3a58('0x3b')]);_0x309b90[_0x3a58('0x3e')]=_['intersection'](_0x2056bf[_0x3a58('0x3a')],qs[_0x3a58('0x3f')](_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x309b90[_0x3a58('0x3e')]=_0x309b90[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x309b90[_0x3a58('0x3e')]:_0x2056bf[_0x3a58('0x3a')];_0x309b90[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x309b90[_0x3a58('0x48')]=qs[_0x3a58('0x45')](_[_0x3a58('0x46')](_0x1e0d90[_0x3a58('0x3b')],_0x2056bf[_0x3a58('0x45')]));if(_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x47')]){_0x309b90[_0x3a58('0x48')]=_[_0x3a58('0x49')](_0x309b90[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x309b90['attributes'],function(_0x2d08d4){var _0x2dec50={};_0x2dec50[_0x2d08d4]={'$like':'%'+_0x1e0d90['query']['filter']+'%'};return _0x2dec50;})});}_0x309b90=_[_0x3a58('0x49')]({},_0x309b90,_0x1e0d90[_0x3a58('0x52')]);return _0x44852e[_0x3a58('0x66')](_0x309b90);}})[_0x3a58('0x2b')](function(_0x16cd8a){if(_0x16cd8a){_0x4ed258=_0x16cd8a[_0x3a58('0x40')];if(!_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x309b90[_0x3a58('0x23')]=qs[_0x3a58('0x23')](_0x1e0d90['query']['limit']);_0x309b90[_0x3a58('0x25')]=qs['offset'](_0x1e0d90[_0x3a58('0x3b')]['offset']);}return _0x44852e[_0x3a58('0x66')](_0x309b90);}})[_0x3a58('0x2b')](function(_0xb7f906){if(_0xb7f906){return _0xb7f906?{'count':_0x4ed258,'rows':_0xb7f906}:null;}})[_0x3a58('0x2b')](respondWithResult(_0x26e1de,null))[_0x3a58('0x4e')](handleError(_0x26e1de,null));};exports[_0x3a58('0x67')]=function(_0x187f1c,_0x1d220a,_0x304fb3){var _0x29ced4=_0x187f1c[_0x3a58('0x53')][_0x3a58('0x68')];return db['Team'][_0x3a58('0x4c')]({'where':{'id':_0x29ced4},'attributes':['id'],'include':[{'model':db[_0x3a58('0x69')],'as':'Agents','attributes':['id',_0x3a58('0x32'),_0x3a58('0x6a'),_0x3a58('0x6b'),_0x3a58('0x6c')],'raw':!![]}]})['then'](function(_0x103762){if(_0x103762){var _0x141ae9=_[_0x3a58('0x6d')](_0x103762,function(_0x5e4716){var _0x26ca14=_0x5e4716['get']({'plain':!![]});return _0x26ca14[_0x3a58('0x6e')];});return db['WhatsappQueue'][_0x3a58('0x57')]({'where':{'id':_0x187f1c[_0x3a58('0x50')]['id']}})[_0x3a58('0x2b')](function(_0xb11b3d){return db[_0x3a58('0x6f')][_0x3a58('0x70')](function(_0x59aa69){return _0xb11b3d[_0x3a58('0x67')](_0x29ced4,{'transaction':_0x59aa69})['then'](function(){return BPromise['each'](_0x141ae9,function(_0x3ba6f1){return db['UserWhatsappQueue'][_0x3a58('0x71')]({'where':{'UserId':_0x3ba6f1['id'],'WhatsappQueueId':_0x187f1c[_0x3a58('0x50')]['id']},'transaction':_0x59aa69});});})[_0x3a58('0x2b')](function(){_0x141ae9[_0x3a58('0x72')](function(_0x3af26b){socket[_0x3a58('0x73')]('userWhatsappQueue:save',{'UserId':_0x3af26b['id'],'WhatsappQueueId':_0xb11b3d['id']});});});});});}})[_0x3a58('0x2b')](respondWithStatusCode(_0x1d220a,null))[_0x3a58('0x4e')](handleError(_0x1d220a,null));};exports[_0x3a58('0x74')]=function(_0x48b92e,_0x43d3f1,_0x1075c6){return db[_0x3a58('0x75')][_0x3a58('0x4c')]({'where':{'id':_0x48b92e[_0x3a58('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3a58('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3a58('0x2b')](handleEntityNotFound(_0x43d3f1,null))[_0x3a58('0x2b')](function(_0x486ad1){var _0x34d4f8=_[_0x3a58('0x35')](_0x486ad1,'id');var _0x21d678=[];var _0x3a9bc4=[];var _0x28da3e=squel[_0x3a58('0x76')]();_0x28da3e[_0x3a58('0x77')](_0x3a58('0x78'))[_0x3a58('0x79')]('team_has_whatsapp_queues','tq')['join'](_0x3a58('0x7a'),'ut',_0x3a58('0x7b'))[_0x3a58('0x48')](_0x3a58('0x7c'),_0x48b92e[_0x3a58('0x50')]['id']);for(var _0x335a50=0x0;_0x335a50<_0x486ad1[_0x3a58('0x40')];_0x335a50+=0x1){let _0x35dc6e=_0x486ad1[_0x335a50];for(var _0xe0f4ad=0x0;_0xe0f4ad<_0x35dc6e[_0x3a58('0x6e')][_0x3a58('0x40')];_0xe0f4ad+=0x1){let _0x123058=_0x35dc6e[_0x3a58('0x6e')][_0xe0f4ad];var _0x563b1d=_0x28da3e['clone']();_0x563b1d[_0x3a58('0x48')](_0x3a58('0x7d'),_0x123058['id']);_0x3a9bc4[_0x3a58('0x7e')](db[_0x3a58('0x6f')]['query'](_0x563b1d[_0x3a58('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x3a58('0x80')]})[_0x3a58('0x2b')](function(_0x108fbd){if(_0x108fbd[_0x3a58('0x40')]===0x1){return _0x123058['id'];}else{var _0x348f6d=_[_0x3a58('0x81')](_[_0x3a58('0x35')](_0x108fbd,_0x3a58('0x82')),function(_0x58b1bf){return _[_0x3a58('0x83')](_0x34d4f8,_0x58b1bf);});if(_0x348f6d){return _0x123058['id'];}}}));}}return BPromise[_0x3a58('0x84')](_0x3a9bc4)[_0x3a58('0x2b')](function(_0x1826a1){_0x21d678=_(_0x21d678)[_0x3a58('0x85')](_0x1826a1)['compact']()[_0x3a58('0x86')]();return db[_0x3a58('0x36')]['find']({'where':{'id':_0x48b92e[_0x3a58('0x50')]['id']}})['then'](function(_0x38829a){return db[_0x3a58('0x6f')]['transaction'](function(_0x530f5e){return _0x38829a[_0x3a58('0x74')](_0x48b92e[_0x3a58('0x3b')][_0x3a58('0x68')],{'transaction':_0x530f5e})[_0x3a58('0x2b')](function(){if(!_['isEmpty'](_0x21d678)){return _0x38829a['removeAgents'](_0x21d678,{'transaction':_0x530f5e});}})[_0x3a58('0x2b')](function(){_0x21d678[_0x3a58('0x72')](function(_0x122623){socket['emit'](_0x3a58('0x87'),{'UserId':_0x122623,'WhatsappQueueId':_0x38829a['id']});});});});});});})['then'](respondWithStatusCode(_0x43d3f1,null))['catch'](handleError(_0x43d3f1,null));};exports[_0x3a58('0x88')]=function(_0x4d4490,_0x2d6f60,_0x36feb6){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x4d4490['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x2d6f60,null))[_0x3a58('0x2b')](function(_0x302345){if(_0x302345){return _0x302345[_0x3a58('0x88')](_0x4d4490['body'][_0x3a58('0x68')],_['omit'](_0x4d4490[_0x3a58('0x53')],[_0x3a58('0x68'),'id'])||{})['spread'](function(_0x3e2380){for(var _0x49fd7e=0x0;_0x49fd7e<_0x4d4490['body'][_0x3a58('0x68')][_0x3a58('0x40')];_0x49fd7e+=0x1){socket[_0x3a58('0x73')](_0x3a58('0x89'),{'UserId':Number(_0x4d4490[_0x3a58('0x53')][_0x3a58('0x68')][_0x49fd7e]),'WhatsappQueueId':Number(_0x4d4490['params']['id'])});}return _0x3e2380;});}})[_0x3a58('0x2b')](respondWithResult(_0x2d6f60,null))['catch'](handleError(_0x2d6f60,null));};exports[_0x3a58('0x8a')]=function(_0x1bf1bc,_0x561b0e,_0x1a94db){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x1bf1bc['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x561b0e,null))[_0x3a58('0x2b')](function(_0x2c856f){if(_0x2c856f){return _0x2c856f[_0x3a58('0x8a')](_0x1bf1bc['query']['ids'])[_0x3a58('0x2b')](function(){if(_['isArray'](_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')])){for(var _0x5f2e14=0x0;_0x5f2e14<_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')][_0x3a58('0x40')];_0x5f2e14+=0x1){socket[_0x3a58('0x73')](_0x3a58('0x87'),{'UserId':Number(_0x1bf1bc['query'][_0x3a58('0x68')][_0x5f2e14]),'WhatsappQueueId':Number(_0x1bf1bc[_0x3a58('0x50')]['id'])});}}else{socket[_0x3a58('0x73')](_0x3a58('0x87'),{'UserId':Number(_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')]),'WhatsappQueueId':Number(_0x1bf1bc[_0x3a58('0x50')]['id'])});}});}})[_0x3a58('0x2b')](respondWithStatusCode(_0x561b0e,null))[_0x3a58('0x4e')](handleError(_0x561b0e,null));};exports[_0x3a58('0x8b')]=function(_0x45983a,_0xed0bd2,_0x576750){var _0x5753bd={};var _0x59c248={};var _0xe9f96;var _0x540f05;return db[_0x3a58('0x36')]['findOne']({'where':{'id':_0x45983a['params']['id']}})['then'](handleEntityNotFound(_0xed0bd2,null))[_0x3a58('0x2b')](function(_0x406414){if(_0x406414){_0xe9f96=_0x406414;_0x59c248[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db[_0x3a58('0x69')][_0x3a58('0x37')]);_0x59c248[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x45983a[_0x3a58('0x3b')]);_0x59c248['filters']=_[_0x3a58('0x3d')](_0x59c248[_0x3a58('0x3a')],_0x59c248[_0x3a58('0x3b')]);_0x5753bd[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x59c248[_0x3a58('0x3a')],qs[_0x3a58('0x3f')](_0x45983a['query'][_0x3a58('0x3f')]));_0x5753bd['attributes']=_0x5753bd[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x5753bd[_0x3a58('0x3e')]:_0x59c248[_0x3a58('0x3a')];_0x5753bd[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x45983a[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x5753bd['where']=qs['filters'](_[_0x3a58('0x46')](_0x45983a[_0x3a58('0x3b')],_0x59c248['filters']));if(_0x45983a[_0x3a58('0x3b')]['filter']){_0x5753bd['where']=_[_0x3a58('0x49')](_0x5753bd[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x5753bd['attributes'],function(_0x58f827){var _0x5a0cf6={};_0x5a0cf6[_0x58f827]={'$like':'%'+_0x45983a['query'][_0x3a58('0x47')]+'%'};return _0x5a0cf6;})});}_0x5753bd=_[_0x3a58('0x49')]({},_0x5753bd,_0x45983a[_0x3a58('0x52')]);return _0xe9f96[_0x3a58('0x8b')](_0x5753bd);}})['then'](function(_0x2b89f0){if(_0x2b89f0){_0x540f05=_0x2b89f0[_0x3a58('0x40')];if(!_0x45983a[_0x3a58('0x3b')][_0x3a58('0x41')]('nolimit')){_0x5753bd[_0x3a58('0x23')]=qs[_0x3a58('0x23')](_0x45983a[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x5753bd[_0x3a58('0x25')]=qs['offset'](_0x45983a['query']['offset']);}return _0xe9f96['getAgents'](_0x5753bd);}})[_0x3a58('0x2b')](function(_0x450ade){if(_0x450ade){return _0x450ade?{'count':_0x540f05,'rows':_0x450ade}:null;}})['then'](respondWithResult(_0xed0bd2,null))[_0x3a58('0x4e')](handleError(_0xed0bd2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c4c8b1a..dbca0e8 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 _0x6a89=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x1cccb0,_0x2a6f85){var _0x3617a1=function(_0x10127b){while(--_0x10127b){_0x1cccb0['push'](_0x1cccb0['shift']());}};_0x3617a1(++_0x2a6f85);}(_0x6a89,0x1b4));var _0x96a8=function(_0xb62151,_0x1eef10){_0xb62151=_0xb62151-0x0;var _0x35e9ea=_0x6a89[_0xb62151];return _0x35e9ea;};'use strict';var EventEmitter=require(_0x96a8('0x0'));var WhatsappQueue=require(_0x96a8('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x96a8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96a8('0x3'),'afterDestroy':_0x96a8('0x4')};function emitEvent(_0x1cb3e9){return function(_0x278f69,_0x176b88,_0x539662){WhatsappQueueEvents['emit'](_0x1cb3e9+':'+_0x278f69['id'],_0x278f69);WhatsappQueueEvents[_0x96a8('0x5')](_0x1cb3e9,_0x278f69);_0x539662(null);};}for(var e in events){if(events[_0x96a8('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x96a8('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf8b3=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x7a1ade,_0x413b03){var _0x2293ef=function(_0x110418){while(--_0x110418){_0x7a1ade['push'](_0x7a1ade['shift']());}};_0x2293ef(++_0x413b03);}(_0xf8b3,0x1ce));var _0x3f8b=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xf8b3[_0x4fbb15];return _0x436338;};'use strict';var EventEmitter=require(_0x3f8b('0x0'));var WhatsappQueue=require(_0x3f8b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3f8b('0x2')](0x0);var events={'afterCreate':_0x3f8b('0x3'),'afterUpdate':_0x3f8b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x528264){return function(_0x56863d,_0x51a6c6,_0x9f074){WhatsappQueueEvents[_0x3f8b('0x5')](_0x528264+':'+_0x56863d['id'],_0x56863d);WhatsappQueueEvents[_0x3f8b('0x5')](_0x528264,_0x56863d);_0x9f074(null);};}for(var e in events){if(events[_0x3f8b('0x6')](e)){var event=events[e];WhatsappQueue[_0x3f8b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8ad1d6d..0844abd 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 _0x3726=['define','WhatsappQueue','whatsapp_queues','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x3726,0x177));var _0x6372=function(_0x40f604,_0x44e441){_0x40f604=_0x40f604-0x0;var _0x392289=_0x3726[_0x40f604];return _0x392289;};'use strict';var _=require('lodash');var util=require(_0x6372('0x0'));var logger=require('../../config/logger')(_0x6372('0x1'));var moment=require(_0x6372('0x2'));var BPromise=require(_0x6372('0x3'));var rp=require(_0x6372('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6372('0x5'));var config=require(_0x6372('0x6'));var attributes=require(_0x6372('0x7'));module[_0x6372('0x8')]=function(_0x37a854,_0x310620){return _0x37a854[_0x6372('0x9')](_0x6372('0xa'),attributes,{'tableName':_0x6372('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf675=['WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','define'];(function(_0x3eefc4,_0x13da29){var _0x390870=function(_0x3236fe){while(--_0x3236fe){_0x3eefc4['push'](_0x3eefc4['shift']());}};_0x390870(++_0x13da29);}(_0xf675,0xb5));var _0x5f67=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0xf675[_0x47f4c2];return _0x22c63e;};'use strict';var _=require('lodash');var util=require(_0x5f67('0x0'));var logger=require(_0x5f67('0x1'))(_0x5f67('0x2'));var moment=require(_0x5f67('0x3'));var BPromise=require(_0x5f67('0x4'));var rp=require(_0x5f67('0x5'));var fs=require('fs');var path=require(_0x5f67('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module['exports']=function(_0x443c97,_0x18610d){return _0x443c97[_0x5f67('0x8')](_0x5f67('0x9'),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 0c5147c..3b8c36b 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 _0x7d86=['defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7d86,0x12d));var _0x67d8=function(_0x45cd9c,_0x5329ea){_0x45cd9c=_0x45cd9c-0x0;var _0x36bf95=_0x7d86[_0x45cd9c];return _0x36bf95;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var moment=require(_0x67d8('0x1'));var BPromise=require(_0x67d8('0x2'));var rs=require(_0x67d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d8('0x4'))['db'];var utils=require(_0x67d8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x67d8('0x6'));var jayson=require(_0x67d8('0x7'));var client=jayson[_0x67d8('0x8')][_0x67d8('0x9')]({'port':0x232a});config[_0x67d8('0xa')]=_[_0x67d8('0xb')](config[_0x67d8('0xa')],{'host':_0x67d8('0xc'),'port':0x18eb});var socket=require(_0x67d8('0xd'))(new Redis(config[_0x67d8('0xa')]));require(_0x67d8('0xe'))[_0x67d8('0xf')](socket);function respondWithRpcPromise(_0x2115eb,_0x5f0f40,_0x2f40f6){return new BPromise(function(_0x588e8e,_0x2cb78f){return client[_0x67d8('0x10')](_0x2115eb,_0x2f40f6)['then'](function(_0x4b833a){logger['info'](_0x67d8('0x11'),_0x5f0f40,_0x67d8('0x12'));logger[_0x67d8('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5f0f40,'request\x20sent',JSON['stringify'](_0x4b833a));if(_0x4b833a[_0x67d8('0x14')]){if(_0x4b833a['error']['code']===0x1f4){logger[_0x67d8('0x14')](_0x67d8('0x11'),_0x5f0f40,_0x4b833a['error'][_0x67d8('0x15')]);return _0x2cb78f(_0x4b833a[_0x67d8('0x14')][_0x67d8('0x15')]);}logger[_0x67d8('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x5f0f40,_0x4b833a['error'][_0x67d8('0x15')]);return _0x588e8e(_0x4b833a[_0x67d8('0x14')]['message']);}else{logger[_0x67d8('0x16')](_0x67d8('0x11'),_0x5f0f40,_0x67d8('0x12'));_0x588e8e(_0x4b833a[_0x67d8('0x17')][_0x67d8('0x15')]);}})[_0x67d8('0x18')](function(_0x7d77d7){logger['error'](_0x67d8('0x11'),_0x5f0f40,_0x7d77d7);_0x2cb78f(_0x7d77d7);});});}exports['GetWhatsappQueue']=function(_0x40628f){var _0x551b93=this;return new Promise(function(_0x49e7c1,_0x2c6c0a){return db['WhatsappQueue'][_0x67d8('0x19')]({'raw':_0x40628f[_0x67d8('0x1a')]?_0x40628f['options'][_0x67d8('0x1b')]===undefined?!![]:![]:!![],'where':_0x40628f[_0x67d8('0x1a')]?_0x40628f[_0x67d8('0x1a')][_0x67d8('0x1c')]||null:null,'attributes':_0x40628f[_0x67d8('0x1a')]?_0x40628f[_0x67d8('0x1a')][_0x67d8('0x1d')]||null:null,'limit':_0x40628f[_0x67d8('0x1a')]?_0x40628f['options'][_0x67d8('0x1e')]||null:null,'include':_0x40628f[_0x67d8('0x1a')]?_0x40628f[_0x67d8('0x1a')][_0x67d8('0x1f')]?_[_0x67d8('0x20')](_0x40628f[_0x67d8('0x1a')][_0x67d8('0x1f')],function(_0x39985d){return{'model':db[_0x39985d[_0x67d8('0x21')]],'as':_0x39985d['as'],'attributes':_0x39985d[_0x67d8('0x1d')],'include':_0x39985d[_0x67d8('0x1f')]?_[_0x67d8('0x20')](_0x39985d[_0x67d8('0x1f')],function(_0x2ba361){return{'model':db[_0x2ba361[_0x67d8('0x21')]],'as':_0x2ba361['as'],'attributes':_0x2ba361[_0x67d8('0x1d')],'include':_0x2ba361['include']?_[_0x67d8('0x20')](_0x2ba361[_0x67d8('0x1f')],function(_0x56da59){return{'model':db[_0x56da59[_0x67d8('0x21')]],'as':_0x56da59['as'],'attributes':_0x56da59[_0x67d8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x67d8('0x22')](function(_0x26dde9){logger[_0x67d8('0x16')](_0x67d8('0x23'),_0x40628f);logger[_0x67d8('0x13')](_0x67d8('0x23'),_0x40628f,JSON[_0x67d8('0x24')](_0x26dde9));_0x49e7c1(_0x26dde9);})['catch'](function(_0x71e5ff){logger[_0x67d8('0x14')](_0x67d8('0x23'),_0x71e5ff[_0x67d8('0x15')],_0x40628f);_0x2c6c0a(_0x551b93[_0x67d8('0x14')](0x1f4,_0x71e5ff['message']));});});};exports[_0x67d8('0x25')]=function(_0x11a100){var _0x3275b9=this;return new Promise(function(_0xb95eb9,_0x456231){return db['WhatsappQueue'][_0x67d8('0x26')]({'raw':_0x11a100['options']?_0x11a100['options'][_0x67d8('0x1b')]===undefined?!![]:![]:!![],'where':_0x11a100['options']?_0x11a100[_0x67d8('0x1a')]['where']||null:null,'attributes':_0x11a100[_0x67d8('0x1a')]?_0x11a100[_0x67d8('0x1a')][_0x67d8('0x1d')]||null:null,'include':_0x11a100[_0x67d8('0x1a')]?_0x11a100[_0x67d8('0x1a')][_0x67d8('0x1f')]?_[_0x67d8('0x20')](_0x11a100['options']['include'],function(_0x451373){return{'model':db[_0x451373[_0x67d8('0x21')]],'as':_0x451373['as'],'attributes':_0x451373[_0x67d8('0x1d')],'include':_0x451373['include']?_[_0x67d8('0x20')](_0x451373['include'],function(_0x2ba0c0){return{'model':db[_0x2ba0c0[_0x67d8('0x21')]],'as':_0x2ba0c0['as'],'attributes':_0x2ba0c0['attributes'],'include':_0x2ba0c0['include']?_[_0x67d8('0x20')](_0x2ba0c0['include'],function(_0x285b8f){return{'model':db[_0x285b8f['model']],'as':_0x285b8f['as'],'attributes':_0x285b8f[_0x67d8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x67d8('0x22')](function(_0xf28636){logger[_0x67d8('0x16')]('ShowWhatsappQueue',_0x11a100);logger[_0x67d8('0x13')](_0x67d8('0x25'),_0x11a100,JSON[_0x67d8('0x24')](_0xf28636));_0xb95eb9(_0xf28636);})[_0x67d8('0x18')](function(_0x530d29){logger[_0x67d8('0x14')](_0x67d8('0x25'),_0x530d29['message'],_0x11a100);_0x456231(_0x3275b9[_0x67d8('0x14')](0x1f4,_0x530d29['message']));});});}; \ No newline at end of file +var _0x39f7=['raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x5ceab5,_0x190d14){var _0x59cebf=function(_0x2600ad){while(--_0x2600ad){_0x5ceab5['push'](_0x5ceab5['shift']());}};_0x59cebf(++_0x190d14);}(_0x39f7,0x1b6));var _0x739f=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x39f7[_0x587fb5];return _0x551105;};'use strict';var _=require('lodash');var util=require(_0x739f('0x0'));var moment=require(_0x739f('0x1'));var BPromise=require(_0x739f('0x2'));var rs=require(_0x739f('0x3'));var fs=require('fs');var Redis=require(_0x739f('0x4'));var db=require(_0x739f('0x5'))['db'];var utils=require(_0x739f('0x6'));var logger=require(_0x739f('0x7'))(_0x739f('0x8'));var config=require(_0x739f('0x9'));var jayson=require(_0x739f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x739f('0xb')]=_[_0x739f('0xc')](config[_0x739f('0xb')],{'host':_0x739f('0xd'),'port':0x18eb});var socket=require(_0x739f('0xe'))(new Redis(config[_0x739f('0xb')]));require('./whatsappQueue.socket')[_0x739f('0xf')](socket);function respondWithRpcPromise(_0x26f692,_0x3026c1,_0x79d90d){return new BPromise(function(_0x31319f,_0xd450da){return client['request'](_0x26f692,_0x79d90d)['then'](function(_0x4f7817){logger['info'](_0x739f('0x10'),_0x3026c1,_0x739f('0x11'));logger[_0x739f('0x12')](_0x739f('0x13'),_0x3026c1,'request\x20sent',JSON[_0x739f('0x14')](_0x4f7817));if(_0x4f7817[_0x739f('0x15')]){if(_0x4f7817['error']['code']===0x1f4){logger[_0x739f('0x15')](_0x739f('0x10'),_0x3026c1,_0x4f7817['error'][_0x739f('0x16')]);return _0xd450da(_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);}logger[_0x739f('0x15')](_0x739f('0x10'),_0x3026c1,_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);return _0x31319f(_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);}else{logger[_0x739f('0x17')](_0x739f('0x10'),_0x3026c1,'request\x20sent');_0x31319f(_0x4f7817[_0x739f('0x18')][_0x739f('0x16')]);}})[_0x739f('0x19')](function(_0x75ce93){logger[_0x739f('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3026c1,_0x75ce93);_0xd450da(_0x75ce93);});});}exports[_0x739f('0x1a')]=function(_0x99740a){var _0x21809d=this;return new Promise(function(_0x2b1c6a,_0x1fe19f){return db[_0x739f('0x1b')][_0x739f('0x1c')]({'raw':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x1e')]===undefined?!![]:![]:!![],'where':_0x99740a['options']?_0x99740a[_0x739f('0x1d')][_0x739f('0x1f')]||null:null,'attributes':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')]['attributes']||null:null,'limit':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x20')]||null:null,'include':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x21')]?_[_0x739f('0x22')](_0x99740a[_0x739f('0x1d')]['include'],function(_0xe23881){return{'model':db[_0xe23881[_0x739f('0x23')]],'as':_0xe23881['as'],'attributes':_0xe23881[_0x739f('0x24')],'include':_0xe23881['include']?_[_0x739f('0x22')](_0xe23881[_0x739f('0x21')],function(_0x33a613){return{'model':db[_0x33a613[_0x739f('0x23')]],'as':_0x33a613['as'],'attributes':_0x33a613[_0x739f('0x24')],'include':_0x33a613[_0x739f('0x21')]?_[_0x739f('0x22')](_0x33a613[_0x739f('0x21')],function(_0x4c13be){return{'model':db[_0x4c13be[_0x739f('0x23')]],'as':_0x4c13be['as'],'attributes':_0x4c13be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b003a){logger['info'](_0x739f('0x1a'),_0x99740a);logger[_0x739f('0x12')](_0x739f('0x1a'),_0x99740a,JSON['stringify'](_0x4b003a));_0x2b1c6a(_0x4b003a);})['catch'](function(_0xd0eed2){logger['error']('GetWhatsappQueue',_0xd0eed2[_0x739f('0x16')],_0x99740a);_0x1fe19f(_0x21809d[_0x739f('0x15')](0x1f4,_0xd0eed2['message']));});});};exports[_0x739f('0x25')]=function(_0x2b018e){var _0x513d29=this;return new Promise(function(_0x17eb0e,_0x4a877b){return db[_0x739f('0x1b')][_0x739f('0x26')]({'raw':_0x2b018e['options']?_0x2b018e[_0x739f('0x1d')][_0x739f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b018e[_0x739f('0x1d')]?_0x2b018e['options'][_0x739f('0x1f')]||null:null,'attributes':_0x2b018e[_0x739f('0x1d')]?_0x2b018e[_0x739f('0x1d')][_0x739f('0x24')]||null:null,'include':_0x2b018e['options']?_0x2b018e['options'][_0x739f('0x21')]?_[_0x739f('0x22')](_0x2b018e['options'][_0x739f('0x21')],function(_0x28a447){return{'model':db[_0x28a447[_0x739f('0x23')]],'as':_0x28a447['as'],'attributes':_0x28a447['attributes'],'include':_0x28a447['include']?_['map'](_0x28a447[_0x739f('0x21')],function(_0x1f60c2){return{'model':db[_0x1f60c2[_0x739f('0x23')]],'as':_0x1f60c2['as'],'attributes':_0x1f60c2[_0x739f('0x24')],'include':_0x1f60c2[_0x739f('0x21')]?_[_0x739f('0x22')](_0x1f60c2[_0x739f('0x21')],function(_0x26ad7f){return{'model':db[_0x26ad7f[_0x739f('0x23')]],'as':_0x26ad7f['as'],'attributes':_0x26ad7f[_0x739f('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9ac8){logger['info'](_0x739f('0x25'),_0x2b018e);logger[_0x739f('0x12')](_0x739f('0x25'),_0x2b018e,JSON[_0x739f('0x14')](_0x2e9ac8));_0x17eb0e(_0x2e9ac8);})[_0x739f('0x19')](function(_0x3d386b){logger[_0x739f('0x15')](_0x739f('0x25'),_0x3d386b[_0x739f('0x16')],_0x2b018e);_0x4a877b(_0x513d29['error'](0x1f4,_0x3d386b[_0x739f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b675c1a..6fb768b 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 _0x85cb=['register','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x4536a9,_0x36ecf1){var _0x4f17c1=function(_0x499f60){while(--_0x499f60){_0x4536a9['push'](_0x4536a9['shift']());}};_0x4f17c1(++_0x36ecf1);}(_0x85cb,0x152));var _0xb85c=function(_0x532247,_0x42cd94){_0x532247=_0x532247-0x0;var _0x48390d=_0x85cb[_0x532247];return _0x48390d;};'use strict';var WhatsappQueueEvents=require(_0xb85c('0x0'));var events=['save',_0xb85c('0x1'),_0xb85c('0x2')];function createListener(_0x44d889,_0x13f5fa){return function(_0x51634b){_0x13f5fa[_0xb85c('0x3')](_0x44d889,_0x51634b);};}function removeListener(_0x4717ac,_0x24d95f){return function(){WhatsappQueueEvents[_0xb85c('0x4')](_0x4717ac,_0x24d95f);};}exports[_0xb85c('0x5')]=function(_0x15bd2c){for(var _0x2b94a4=0x0,_0x3f12b6=events['length'];_0x2b94a4<_0x3f12b6;_0x2b94a4++){var _0x5e231b=events[_0x2b94a4];var _0x35aa2a=createListener(_0xb85c('0x6')+_0x5e231b,_0x15bd2c);WhatsappQueueEvents['on'](_0x5e231b,_0x35aa2a);}}; \ No newline at end of file +var _0x7fca=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x27e46f,_0x52bd32){var _0x5d090a=function(_0x55e302){while(--_0x55e302){_0x27e46f['push'](_0x27e46f['shift']());}};_0x5d090a(++_0x52bd32);}(_0x7fca,0x102));var _0xa7fc=function(_0x36ca5e,_0x532649){_0x36ca5e=_0x36ca5e-0x0;var _0x185857=_0x7fca[_0x36ca5e];return _0x185857;};'use strict';var WhatsappQueueEvents=require(_0xa7fc('0x0'));var events=[_0xa7fc('0x1'),_0xa7fc('0x2'),_0xa7fc('0x3')];function createListener(_0x27bfc6,_0x4e7f13){return function(_0x5b13ce){_0x4e7f13[_0xa7fc('0x4')](_0x27bfc6,_0x5b13ce);};}function removeListener(_0x2393c2,_0x433eec){return function(){WhatsappQueueEvents[_0xa7fc('0x5')](_0x2393c2,_0x433eec);};}exports['register']=function(_0x387178){for(var _0x2d5722=0x0,_0x26f534=events[_0xa7fc('0x6')];_0x2d5722<_0x26f534;_0x2d5722++){var _0x727943=events[_0x2d5722];var _0x2f4ecd=createListener(_0xa7fc('0x7')+_0x727943,_0x387178);WhatsappQueueEvents['on'](_0x727943,_0x2f4ecd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9bd1e73..e5948be 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 _0x079a=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','put'];(function(_0x58ee18,_0x2e57e3){var _0x2ee7d4=function(_0x112c2d){while(--_0x112c2d){_0x58ee18['push'](_0x58ee18['shift']());}};_0x2ee7d4(++_0x2e57e3);}(_0x079a,0x1a5));var _0xa079=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x079a[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0xa079('0x0'));var util=require(_0xa079('0x1'));var path=require(_0xa079('0x2'));var timeout=require(_0xa079('0x3'));var express=require(_0xa079('0x4'));var router=express[_0xa079('0x5')]();var fs_extra=require(_0xa079('0x6'));var auth=require(_0xa079('0x7'));var interaction=require(_0xa079('0x8'));var config=require(_0xa079('0x9'));var controller=require('./whatsappQueueReport.controller');router[_0xa079('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa079('0xa')]('/describe',auth[_0xa079('0xb')](),controller[_0xa079('0xc')]);router[_0xa079('0xa')](_0xa079('0xd'),auth[_0xa079('0xb')](),controller[_0xa079('0xe')]);router['post']('/',auth[_0xa079('0xb')](),controller['create']);router[_0xa079('0xf')](_0xa079('0xd'),auth[_0xa079('0xb')](),controller[_0xa079('0x10')]);router[_0xa079('0x11')](_0xa079('0xd'),auth[_0xa079('0xb')](),controller['destroy']);module[_0xa079('0x12')]=router; \ No newline at end of file +var _0x43e7=['connect-timeout','express','Router','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','describe','show','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x89ee74,_0x360343){var _0x2fe465=function(_0x2085bb){while(--_0x2085bb){_0x89ee74['push'](_0x89ee74['shift']());}};_0x2fe465(++_0x360343);}(_0x43e7,0x153));var _0x743e=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x43e7[_0x14a862];return _0x245eb5;};'use strict';var multer=require(_0x743e('0x0'));var util=require(_0x743e('0x1'));var path=require(_0x743e('0x2'));var timeout=require(_0x743e('0x3'));var express=require(_0x743e('0x4'));var router=express[_0x743e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x743e('0x6'));var controller=require(_0x743e('0x7'));router['get']('/',auth[_0x743e('0x8')](),controller[_0x743e('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x743e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x743e('0xb')]);router[_0x743e('0xc')]('/',auth[_0x743e('0x8')](),controller[_0x743e('0xd')]);router[_0x743e('0xe')](_0x743e('0xf'),auth[_0x743e('0x8')](),controller['update']);router[_0x743e('0x10')](_0x743e('0xf'),auth[_0x743e('0x8')](),controller['destroy']);module[_0x743e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0a23443..dcdac83 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1b2714,_0x34c69a){var _0x1886b9=function(_0x50fbf2){while(--_0x50fbf2){_0x1b2714['push'](_0x1b2714['shift']());}};_0x1886b9(++_0x34c69a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x34ff66,_0x4856bd){var _0x13973f=function(_0x5ca67c){while(--_0x5ca67c){_0x34ff66['push'](_0x34ff66['shift']());}};_0x13973f(++_0x4856bd);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 a92a0c7..d3e5b54 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x201824,_0x3874a3){var _0xedfaa4=function(_0x3329e0){while(--_0x3329e0){_0x201824['push'](_0x201824['shift']());}};_0xedfaa4(++_0x3874a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c013d,_0x15a3df){_0x1c013d=_0x1c013d-0x0;var _0xda7764=_0xb10b[_0x1c013d];return _0xda7764;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['WhatsappQueueReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['WhatsappQueueReport'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['WhatsappQueueReport']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file +var _0x3f8c=['end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4e7f4f,_0x1817d5){_0x4e7f4f=_0x4e7f4f-0x0;var _0x55ca67=_0x3f8c[_0x4e7f4f];return _0x55ca67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4569c2,_0x327b2d){return function(_0x2d237e){if(!_0x2d237e){_0x4569c2[_0xc3f8('0x16')](0x194);}return _0x2d237e;};}function handleError(_0x25088f,_0x9d43b4){_0x9d43b4=_0x9d43b4||0x1f4;return function(_0xf1d460){logger[_0xc3f8('0x22')](_0xf1d460[_0xc3f8('0x23')]);if(_0xf1d460[_0xc3f8('0x24')]){delete _0xf1d460[_0xc3f8('0x24')];}_0x25088f[_0xc3f8('0x17')](_0x9d43b4)[_0xc3f8('0x25')](_0xf1d460);};}exports[_0xc3f8('0x26')]=function(_0x59e4dd,_0x58b303){var _0x2909f8={},_0x218029={},_0x5bf6e2={'count':0x0,'rows':[]};var _0x151bba=_['map'](db[_0xc3f8('0x27')][_0xc3f8('0x28')],function(_0x47ab53){return{'name':_0x47ab53['fieldName'],'type':_0x47ab53[_0xc3f8('0x29')][_0xc3f8('0x2a')]};});_0x218029[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x151bba,_0xc3f8('0x24'));_0x218029[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x59e4dd[_0xc3f8('0x2d')]);_0x218029[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x218029['model'],_0x218029[_0xc3f8('0x2d')]);_0x2909f8[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x218029[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x59e4dd['query']['fields']));_0x2909f8[_0xc3f8('0x31')]=_0x2909f8[_0xc3f8('0x31')][_0xc3f8('0x33')]?_0x2909f8[_0xc3f8('0x31')]:_0x218029[_0xc3f8('0x2b')];if(!_0x59e4dd['query'][_0xc3f8('0x34')](_0xc3f8('0x35'))){_0x2909f8[_0xc3f8('0x1b')]=qs['limit'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1b')]);_0x2909f8[_0xc3f8('0x1a')]=qs['offset'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1a')]);}_0x2909f8['order']=qs[_0xc3f8('0x36')](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x36')]);_0x2909f8[_0xc3f8('0x37')]=qs[_0xc3f8('0x2f')](_[_0xc3f8('0x38')](_0x59e4dd['query'],_0x218029[_0xc3f8('0x2f')]),_0x151bba);if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]){_0x2909f8[_0xc3f8('0x37')]=_[_0xc3f8('0x3a')](_0x2909f8['where'],{'$or':_[_0xc3f8('0x2c')](_0x151bba,function(_0x4451a2){if(_0x4451a2[_0xc3f8('0x29')]!=='VIRTUAL'){var _0x316643={};_0x316643[_0x4451a2[_0xc3f8('0x24')]]={'$like':'%'+_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]+'%'};return _0x316643;}})});}_0x2909f8=_['merge']({},_0x2909f8,_0x59e4dd[_0xc3f8('0x3b')]);var _0x45d416={'where':_0x2909f8[_0xc3f8('0x37')]};return db[_0xc3f8('0x27')]['count'](_0x45d416)[_0xc3f8('0x21')](function(_0x5db44d){_0x5bf6e2['count']=_0x5db44d;if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x3c')]){_0x2909f8[_0xc3f8('0x3d')]=[{'all':!![]}];}return db[_0xc3f8('0x27')]['findAll'](_0x2909f8);})['then'](function(_0x361a85){_0x5bf6e2[_0xc3f8('0x3e')]=_0x361a85;return _0x5bf6e2;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x58b303,_0x2909f8))[_0xc3f8('0x3f')](handleError(_0x58b303,null));};exports[_0xc3f8('0x40')]=function(_0x465547,_0x3113b4){var _0x45e6ea={'raw':!![],'where':{'id':_0x465547[_0xc3f8('0x41')]['id']}},_0x13d8dc={};_0x13d8dc[_0xc3f8('0x2b')]=_['keys'](db[_0xc3f8('0x27')][_0xc3f8('0x28')]);_0x13d8dc['query']=_[_0xc3f8('0x2e')](_0x465547[_0xc3f8('0x2d')]);_0x13d8dc['filters']=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],_0x13d8dc[_0xc3f8('0x2d')]);_0x45e6ea[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x465547[_0xc3f8('0x2d')][_0xc3f8('0x32')]));_0x45e6ea[_0xc3f8('0x31')]=_0x45e6ea[_0xc3f8('0x31')]['length']?_0x45e6ea[_0xc3f8('0x31')]:_0x13d8dc[_0xc3f8('0x2b')];if(_0x465547['query'][_0xc3f8('0x3c')]){_0x45e6ea[_0xc3f8('0x3d')]=[{'all':!![]}];}_0x45e6ea=_[_0xc3f8('0x3a')]({},_0x45e6ea,_0x465547[_0xc3f8('0x3b')]);return db['WhatsappQueueReport']['find'](_0x45e6ea)[_0xc3f8('0x21')](handleEntityNotFound(_0x3113b4,null))[_0xc3f8('0x21')](respondWithResult(_0x3113b4,null))[_0xc3f8('0x3f')](handleError(_0x3113b4,null));};exports['create']=function(_0x1b5777,_0x3a665e){return db[_0xc3f8('0x27')][_0xc3f8('0x42')](_0x1b5777[_0xc3f8('0x43')],{})['then'](respondWithResult(_0x3a665e,0xc9))[_0xc3f8('0x3f')](handleError(_0x3a665e,null));};exports[_0xc3f8('0x20')]=function(_0x5961ab,_0x1becae){if(_0x5961ab[_0xc3f8('0x43')]['id']){delete _0x5961ab[_0xc3f8('0x43')]['id'];}return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x5961ab[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1becae,null))['then'](saveUpdates(_0x5961ab[_0xc3f8('0x43')],null))[_0xc3f8('0x21')](respondWithResult(_0x1becae,null))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x45')]=function(_0x2e9f93,_0x2448bf){return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x2e9f93[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x2448bf,null))['then'](removeEntity(_0x2448bf,null))[_0xc3f8('0x3f')](handleError(_0x2448bf,null));};exports[_0xc3f8('0x46')]=function(_0x425fee,_0x267c95){return db[_0xc3f8('0x27')][_0xc3f8('0x46')]()[_0xc3f8('0x21')](respondWithResult(_0x267c95,null))[_0xc3f8('0x3f')](handleError(_0x267c95,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index da49105..4f796cc 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 _0xb273=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','uniqueid','lodash'];(function(_0x5644cf,_0x36dddb){var _0x13a118=function(_0x56bd8e){while(--_0x56bd8e){_0x5644cf['push'](_0x5644cf['shift']());}};_0x13a118(++_0x36dddb);}(_0xb273,0xd7));var _0x3b27=function(_0x1a6993,_0x40883a){_0x1a6993=_0x1a6993-0x0;var _0x284523=_0xb273[_0x1a6993];return _0x284523;};'use strict';var _=require(_0x3b27('0x0'));var util=require(_0x3b27('0x1'));var logger=require(_0x3b27('0x2'))(_0x3b27('0x3'));var moment=require(_0x3b27('0x4'));var BPromise=require(_0x3b27('0x5'));var rp=require(_0x3b27('0x6'));var fs=require('fs');var path=require(_0x3b27('0x7'));var rimraf=require('rimraf');var config=require(_0x3b27('0x8'));var attributes=require(_0x3b27('0x9'));module[_0x3b27('0xa')]=function(_0x4ff62f,_0x456f22){return _0x4ff62f['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3b27('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad20=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0x4d8a09,_0x4c6992){var _0x2378e5=function(_0xd557f4){while(--_0xd557f4){_0x4d8a09['push'](_0x4d8a09['shift']());}};_0x2378e5(++_0x4c6992);}(_0xad20,0x1c3));var _0x0ad2=function(_0x22cb15,_0xd19206){_0x22cb15=_0x22cb15-0x0;var _0x3844b4=_0xad20[_0x22cb15];return _0x3844b4;};'use strict';var _=require(_0x0ad2('0x0'));var util=require('util');var logger=require(_0x0ad2('0x1'))(_0x0ad2('0x2'));var moment=require('moment');var BPromise=require(_0x0ad2('0x3'));var rp=require(_0x0ad2('0x4'));var fs=require('fs');var path=require(_0x0ad2('0x5'));var rimraf=require(_0x0ad2('0x6'));var config=require(_0x0ad2('0x7'));var attributes=require(_0x0ad2('0x8'));module[_0x0ad2('0x9')]=function(_0x30e18f,_0x35eb44){return _0x30e18f[_0x0ad2('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x0ad2('0xb'),'paranoid':![],'indexes':[{'name':_0x0ad2('0xc'),'fields':[_0x0ad2('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 9b56cae..1ae360d 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 _0x220b=['then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x4c9ec8,_0x462177){var _0x31baa3=function(_0x4a2e77){while(--_0x4a2e77){_0x4c9ec8['push'](_0x4c9ec8['shift']());}};_0x31baa3(++_0x462177);}(_0x220b,0x1a2));var _0xb220=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x220b[_0x393d69];return _0x3cee37;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require(_0xb220('0x1'));var BPromise=require(_0xb220('0x2'));var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb220('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb220('0x5'))('rpc');var config=require(_0xb220('0x6'));var jayson=require(_0xb220('0x7'));var client=jayson[_0xb220('0x8')][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d7d19,_0x23631f,_0x7fa0dd){return new BPromise(function(_0x5b83b9,_0x12c68c){return client[_0xb220('0xa')](_0x5d7d19,_0x7fa0dd)[_0xb220('0xb')](function(_0x2821a6){logger[_0xb220('0xc')](_0xb220('0xd'),_0x23631f,_0xb220('0xe'));logger[_0xb220('0xf')](_0xb220('0x10'),_0x23631f,'request\x20sent',JSON[_0xb220('0x11')](_0x2821a6));if(_0x2821a6[_0xb220('0x12')]){if(_0x2821a6['error']['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x23631f,_0x2821a6['error'][_0xb220('0x13')]);return _0x12c68c(_0x2821a6['error'][_0xb220('0x13')]);}logger[_0xb220('0x12')](_0xb220('0xd'),_0x23631f,_0x2821a6[_0xb220('0x12')]['message']);return _0x5b83b9(_0x2821a6['error'][_0xb220('0x13')]);}else{logger[_0xb220('0xc')](_0xb220('0xd'),_0x23631f,_0xb220('0xe'));_0x5b83b9(_0x2821a6[_0xb220('0x14')][_0xb220('0x13')]);}})[_0xb220('0x15')](function(_0x269c52){logger[_0xb220('0x12')](_0xb220('0xd'),_0x23631f,_0x269c52);_0x12c68c(_0x269c52);});});}exports[_0xb220('0x16')]=function(_0x464ceb){var _0x3fe419=this;return new Promise(function(_0x21cf2d,_0x87c879){return db[_0xb220('0x17')][_0xb220('0x18')](_0x464ceb[_0xb220('0x19')],{'raw':_0x464ceb[_0xb220('0x1a')]?_0x464ceb[_0xb220('0x1a')][_0xb220('0x1b')]===undefined?!![]:![]:!![]})[_0xb220('0xb')](function(_0x213736){logger[_0xb220('0xc')]('CreateWhatsappQueueReport',_0x464ceb);logger[_0xb220('0xf')]('CreateWhatsappQueueReport',_0x464ceb,JSON[_0xb220('0x11')](_0x213736));_0x21cf2d(_0x213736);})['catch'](function(_0x3a1ad7){logger['error'](_0xb220('0x16'),_0x3a1ad7[_0xb220('0x13')],_0x464ceb);_0x87c879(_0x3fe419[_0xb220('0x12')](0x1f4,_0x3a1ad7[_0xb220('0x13')]));});});};exports[_0xb220('0x1c')]=function(_0x2975ff){var _0x5bb719=this;return new Promise(function(_0x8a0fc2,_0x108450){return db[_0xb220('0x17')][_0xb220('0x1d')](_0x2975ff[_0xb220('0x19')],{'raw':_0x2975ff['options']?_0x2975ff[_0xb220('0x1a')][_0xb220('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2975ff['options']?_0x2975ff[_0xb220('0x1a')][_0xb220('0x1e')]||null:null,'attributes':_0x2975ff[_0xb220('0x1a')]?_0x2975ff[_0xb220('0x1a')][_0xb220('0x1f')]||null:null,'limit':_0x2975ff[_0xb220('0x1a')]?_0x2975ff['options'][_0xb220('0x20')]||null:null})['then'](function(_0x589e07){logger[_0xb220('0xc')](_0xb220('0x1c'),_0x2975ff);logger[_0xb220('0xf')](_0xb220('0x1c'),_0x2975ff,JSON[_0xb220('0x11')](_0x589e07));_0x8a0fc2(_0x589e07);})[_0xb220('0x15')](function(_0x463e6a){logger[_0xb220('0x12')](_0xb220('0x1c'),_0x463e6a[_0xb220('0x13')],_0x2975ff);_0x108450(_0x5bb719['error'](0x1f4,_0x463e6a[_0xb220('0x13')]));});});}; \ No newline at end of file +var _0x1720=['info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2aac40,_0x32e7b6){var _0x3fadbb=function(_0x33b429){while(--_0x33b429){_0x2aac40['push'](_0x2aac40['shift']());}};_0x3fadbb(++_0x32e7b6);}(_0x1720,0x98));var _0x0172=function(_0x5938a9,_0x222a6c){_0x5938a9=_0x5938a9-0x0;var _0x364324=_0x1720[_0x5938a9];return _0x364324;};'use strict';var _=require(_0x0172('0x0'));var util=require(_0x0172('0x1'));var moment=require('moment');var BPromise=require(_0x0172('0x2'));var rs=require(_0x0172('0x3'));var fs=require('fs');var Redis=require(_0x0172('0x4'));var db=require(_0x0172('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0172('0x6'))(_0x0172('0x7'));var config=require('../../config/environment');var jayson=require(_0x0172('0x8'));var client=jayson[_0x0172('0x9')][_0x0172('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6d3a,_0x47b5c9,_0x4542e8){return new BPromise(function(_0x5bc825,_0x50fcce){return client[_0x0172('0xb')](_0x4f6d3a,_0x4542e8)[_0x0172('0xc')](function(_0x5bd92c){logger[_0x0172('0xd')](_0x0172('0xe'),_0x47b5c9,'request\x20sent');logger['debug'](_0x0172('0xf'),_0x47b5c9,_0x0172('0x10'),JSON[_0x0172('0x11')](_0x5bd92c));if(_0x5bd92c[_0x0172('0x12')]){if(_0x5bd92c[_0x0172('0x12')][_0x0172('0x13')]===0x1f4){logger['error'](_0x0172('0xe'),_0x47b5c9,_0x5bd92c[_0x0172('0x12')][_0x0172('0x14')]);return _0x50fcce(_0x5bd92c['error']['message']);}logger['error'](_0x0172('0xe'),_0x47b5c9,_0x5bd92c[_0x0172('0x12')]['message']);return _0x5bc825(_0x5bd92c[_0x0172('0x12')][_0x0172('0x14')]);}else{logger[_0x0172('0xd')](_0x0172('0xe'),_0x47b5c9,'request\x20sent');_0x5bc825(_0x5bd92c[_0x0172('0x15')][_0x0172('0x14')]);}})[_0x0172('0x16')](function(_0x846793){logger[_0x0172('0x12')](_0x0172('0xe'),_0x47b5c9,_0x846793);_0x50fcce(_0x846793);});});}exports[_0x0172('0x17')]=function(_0x3c17d2){var _0x462dea=this;return new Promise(function(_0x369813,_0x3f6c54){return db[_0x0172('0x18')]['create'](_0x3c17d2[_0x0172('0x19')],{'raw':_0x3c17d2[_0x0172('0x1a')]?_0x3c17d2[_0x0172('0x1a')][_0x0172('0x1b')]===undefined?!![]:![]:!![]})[_0x0172('0xc')](function(_0x18de3e){logger[_0x0172('0xd')](_0x0172('0x17'),_0x3c17d2);logger['debug'](_0x0172('0x17'),_0x3c17d2,JSON['stringify'](_0x18de3e));_0x369813(_0x18de3e);})['catch'](function(_0x60adf9){logger[_0x0172('0x12')](_0x0172('0x17'),_0x60adf9[_0x0172('0x14')],_0x3c17d2);_0x3f6c54(_0x462dea[_0x0172('0x12')](0x1f4,_0x60adf9[_0x0172('0x14')]));});});};exports[_0x0172('0x1c')]=function(_0x923c2b){var _0x350c95=this;return new Promise(function(_0x439c8e,_0x12eae2){return db['WhatsappQueueReport'][_0x0172('0x1d')](_0x923c2b[_0x0172('0x19')],{'raw':_0x923c2b[_0x0172('0x1a')]?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x923c2b['options']?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1e')]||null:null,'attributes':_0x923c2b[_0x0172('0x1a')]?_0x923c2b[_0x0172('0x1a')]['attributes']||null:null,'limit':_0x923c2b['options']?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1f')]||null:null})[_0x0172('0xc')](function(_0x3c3cd3){logger[_0x0172('0xd')](_0x0172('0x1c'),_0x923c2b);logger[_0x0172('0x20')](_0x0172('0x1c'),_0x923c2b,JSON[_0x0172('0x11')](_0x3c3cd3));_0x439c8e(_0x3c3cd3);})[_0x0172('0x16')](function(_0x53cd16){logger[_0x0172('0x12')](_0x0172('0x1c'),_0x53cd16[_0x0172('0x14')],_0x923c2b);_0x12eae2(_0x350c95['error'](0x1f4,_0x53cd16[_0x0172('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e96d3ec..23817a6 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 _0xdc9e=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x10c378,_0x4f871f){var _0x51f860=function(_0x25041a){while(--_0x25041a){_0x10c378['push'](_0x10c378['shift']());}};_0x51f860(++_0x4f871f);}(_0xdc9e,0x1a0));var _0xedc9=function(_0x5b7f17,_0x50792f){_0x5b7f17=_0x5b7f17-0x0;var _0x4cf6aa=_0xdc9e[_0x5b7f17];return _0x4cf6aa;};'use strict';var multer=require(_0xedc9('0x0'));var util=require(_0xedc9('0x1'));var path=require('path');var timeout=require(_0xedc9('0x2'));var express=require(_0xedc9('0x3'));var router=express[_0xedc9('0x4')]();var fs_extra=require(_0xedc9('0x5'));var auth=require(_0xedc9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xedc9('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xedc9('0x8')]('/',auth[_0xedc9('0x9')](),controller[_0xedc9('0xa')]);router[_0xedc9('0x8')](_0xedc9('0xb'),auth[_0xedc9('0x9')](),controller['describe']);router[_0xedc9('0x8')](_0xedc9('0xc'),auth[_0xedc9('0x9')](),controller[_0xedc9('0xd')]);router[_0xedc9('0xe')]('/',auth[_0xedc9('0x9')](),controller[_0xedc9('0xf')]);router[_0xedc9('0x10')]('/:id',auth[_0xedc9('0x9')](),controller[_0xedc9('0x11')]);router[_0xedc9('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xedc9('0x13')]=router; \ No newline at end of file +var _0x69ce=['/describe','describe','/:id','create','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x50fe15,_0xc88085){var _0x54f33e=function(_0x393aec){while(--_0x393aec){_0x50fe15['push'](_0x50fe15['shift']());}};_0x54f33e(++_0xc88085);}(_0x69ce,0x1c1));var _0xe69c=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x69ce[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xe69c('0x0'));var util=require('util');var path=require(_0xe69c('0x1'));var timeout=require('connect-timeout');var express=require(_0xe69c('0x2'));var router=express[_0xe69c('0x3')]();var fs_extra=require(_0xe69c('0x4'));var auth=require(_0xe69c('0x5'));var interaction=require(_0xe69c('0x6'));var config=require(_0xe69c('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xe69c('0x8')]('/',auth[_0xe69c('0x9')](),controller['index']);router[_0xe69c('0x8')](_0xe69c('0xa'),auth[_0xe69c('0x9')](),controller[_0xe69c('0xb')]);router[_0xe69c('0x8')](_0xe69c('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe69c('0x9')](),controller[_0xe69c('0xd')]);router[_0xe69c('0xe')](_0xe69c('0xc'),auth[_0xe69c('0x9')](),controller[_0xe69c('0xf')]);router[_0xe69c('0x10')](_0xe69c('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 893eb64..3d5d92d 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 _0x4e2e=['exports','STRING','ENUM','account','agent','queue'];(function(_0x6a30bd,_0x150498){var _0x13b2b=function(_0x31982b){while(--_0x31982b){_0x6a30bd['push'](_0x6a30bd['shift']());}};_0x13b2b(++_0x150498);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2b845b,_0x293252){_0x2b845b=_0x2b845b-0x0;var _0x589e22=_0x4e2e[_0x2b845b];return _0x589e22;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'uniqueid':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe4e2('0x2')](_0xe4e2('0x3'),_0xe4e2('0x4'),_0xe4e2('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb1fa=['STRING','account'];(function(_0x5a938a,_0x3190c7){var _0xc1e8c1=function(_0xa13f25){while(--_0xa13f25){_0x5a938a['push'](_0x5a938a['shift']());}};_0xc1e8c1(++_0x3190c7);}(_0xb1fa,0x9e));var _0xab1f=function(_0x4cc2fd,_0xb7e6c5){_0x4cc2fd=_0x4cc2fd-0x0;var _0x10de11=_0xb1fa[_0x4cc2fd];return _0x10de11;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xab1f('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xab1f('0x1'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0faeba8..c8661ba 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 _0x287f=['destroy','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','options','WhatsappTransferReport','includeAll','rows','catch','show','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x287f,0x150));var _0xf287=function(_0x5a1afe,_0x203e03){_0x5a1afe=_0x5a1afe-0x0;var _0x25aa75=_0x287f[_0x5a1afe];return _0x25aa75;};'use strict';var emlformat=require(_0xf287('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf287('0x1'));var jsonpatch=require(_0xf287('0x2'));var rp=require(_0xf287('0x3'));var moment=require(_0xf287('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf287('0x5'));var util=require(_0xf287('0x6'));var path=require(_0xf287('0x7'));var sox=require(_0xf287('0x8'));var csv=require(_0xf287('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf287('0xa'));var _=require(_0xf287('0xb'));var squel=require(_0xf287('0xc'));var crypto=require(_0xf287('0xd'));var jsforce=require(_0xf287('0xe'));var deskjs=require(_0xf287('0xf'));var toCsv=require(_0xf287('0x9'));var querystring=require(_0xf287('0x10'));var Papa=require('papaparse');var Redis=require(_0xf287('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf287('0x12'));var hardwareService=require(_0xf287('0x13'));var logger=require(_0xf287('0x14'))(_0xf287('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf287('0x16'))['db'];function respondWithStatusCode(_0x5a0513,_0x121f75){_0x121f75=_0x121f75||0xcc;return function(_0x331860){if(_0x331860){return _0x5a0513['sendStatus'](_0x121f75);}return _0x5a0513[_0xf287('0x17')](_0x121f75)['end']();};}function respondWithResult(_0x336a27,_0x2216d8){_0x2216d8=_0x2216d8||0xc8;return function(_0x3279b5){if(_0x3279b5){return _0x336a27[_0xf287('0x17')](_0x2216d8)[_0xf287('0x18')](_0x3279b5);}};}function respondWithFilteredResult(_0x238be9,_0x5928eb){return function(_0x53ee4b){if(_0x53ee4b){var _0x56ea88=typeof _0x5928eb[_0xf287('0x19')]==='undefined'&&typeof _0x5928eb[_0xf287('0x1a')]===_0xf287('0x1b');var _0x18eb6c=_0x53ee4b[_0xf287('0x1c')];var _0xf63f6e=_0x56ea88?0x0:_0x5928eb['offset'];var _0x454a9f=_0x56ea88?_0x53ee4b[_0xf287('0x1c')]:_0x5928eb[_0xf287('0x19')]+_0x5928eb[_0xf287('0x1a')];var _0x29a2a0;if(_0x454a9f>=_0x18eb6c){_0x454a9f=_0x18eb6c;_0x29a2a0=0xc8;}else{_0x29a2a0=0xce;}_0x238be9[_0xf287('0x17')](_0x29a2a0);return _0x238be9['set'](_0xf287('0x1d'),_0xf63f6e+'-'+_0x454a9f+'/'+_0x18eb6c)[_0xf287('0x18')](_0x53ee4b);}return null;};}function patchUpdates(_0x30cca9){return function(_0x2176aa){try{jsonpatch[_0xf287('0x1e')](_0x2176aa,_0x30cca9,!![]);}catch(_0x4650c3){return BPromise['reject'](_0x4650c3);}return _0x2176aa[_0xf287('0x1f')]();};}function saveUpdates(_0x4e7b7a,_0xc22364){return function(_0x3b5468){if(_0x3b5468){return _0x3b5468[_0xf287('0x20')](_0x4e7b7a)[_0xf287('0x21')](function(_0x17cae2){return _0x17cae2;});}return null;};}function removeEntity(_0x1b0ffb,_0x221b59){return function(_0x5c9b0f){if(_0x5c9b0f){return _0x5c9b0f[_0xf287('0x22')]()[_0xf287('0x21')](function(){_0x1b0ffb[_0xf287('0x17')](0xcc)[_0xf287('0x23')]();});}};}function handleEntityNotFound(_0x53cfe6,_0x2f0a4d){return function(_0x63c281){if(!_0x63c281){_0x53cfe6[_0xf287('0x24')](0x194);}return _0x63c281;};}function handleError(_0x4016b7,_0x43fbb1){_0x43fbb1=_0x43fbb1||0x1f4;return function(_0x2c8c93){logger[_0xf287('0x25')](_0x2c8c93[_0xf287('0x26')]);if(_0x2c8c93[_0xf287('0x27')]){delete _0x2c8c93[_0xf287('0x27')];}_0x4016b7[_0xf287('0x17')](_0x43fbb1)[_0xf287('0x28')](_0x2c8c93);};}exports['index']=function(_0x54df99,_0x5ae9dd){var _0x3a7569={},_0x105da8={},_0x3a51ff={'count':0x0,'rows':[]};var _0x7e642c=_['map'](db['WhatsappTransferReport'][_0xf287('0x29')],function(_0xe95a95){return{'name':_0xe95a95[_0xf287('0x2a')],'type':_0xe95a95['type'][_0xf287('0x2b')]};});_0x105da8['model']=_['map'](_0x7e642c,_0xf287('0x27'));_0x105da8[_0xf287('0x2c')]=_[_0xf287('0x2d')](_0x54df99[_0xf287('0x2c')]);_0x105da8[_0xf287('0x2e')]=_[_0xf287('0x2f')](_0x105da8[_0xf287('0x30')],_0x105da8[_0xf287('0x2c')]);_0x3a7569[_0xf287('0x31')]=_[_0xf287('0x2f')](_0x105da8['model'],qs['fields'](_0x54df99[_0xf287('0x2c')][_0xf287('0x32')]));_0x3a7569[_0xf287('0x31')]=_0x3a7569[_0xf287('0x31')][_0xf287('0x33')]?_0x3a7569[_0xf287('0x31')]:_0x105da8[_0xf287('0x30')];if(!_0x54df99[_0xf287('0x2c')][_0xf287('0x34')](_0xf287('0x35'))){_0x3a7569[_0xf287('0x1a')]=qs['limit'](_0x54df99[_0xf287('0x2c')][_0xf287('0x1a')]);_0x3a7569[_0xf287('0x19')]=qs[_0xf287('0x19')](_0x54df99['query']['offset']);}_0x3a7569['order']=qs[_0xf287('0x36')](_0x54df99[_0xf287('0x2c')][_0xf287('0x36')]);_0x3a7569['where']=qs['filters'](_[_0xf287('0x37')](_0x54df99[_0xf287('0x2c')],_0x105da8[_0xf287('0x2e')]),_0x7e642c);if(_0x54df99[_0xf287('0x2c')][_0xf287('0x38')]){_0x3a7569[_0xf287('0x39')]=_[_0xf287('0x3a')](_0x3a7569[_0xf287('0x39')],{'$or':_[_0xf287('0x3b')](_0x7e642c,function(_0x3f387f){if(_0x3f387f[_0xf287('0x3c')]!==_0xf287('0x3d')){var _0x4278f2={};_0x4278f2[_0x3f387f[_0xf287('0x27')]]={'$like':'%'+_0x54df99[_0xf287('0x2c')][_0xf287('0x38')]+'%'};return _0x4278f2;}})});}_0x3a7569=_['merge']({},_0x3a7569,_0x54df99[_0xf287('0x3e')]);var _0x1488ce={'where':_0x3a7569[_0xf287('0x39')]};return db[_0xf287('0x3f')]['count'](_0x1488ce)[_0xf287('0x21')](function(_0x591cb4){_0x3a51ff['count']=_0x591cb4;if(_0x54df99[_0xf287('0x2c')][_0xf287('0x40')]){_0x3a7569['include']=[{'all':!![]}];}return db[_0xf287('0x3f')]['findAll'](_0x3a7569);})[_0xf287('0x21')](function(_0x533556){_0x3a51ff[_0xf287('0x41')]=_0x533556;return _0x3a51ff;})[_0xf287('0x21')](respondWithFilteredResult(_0x5ae9dd,_0x3a7569))[_0xf287('0x42')](handleError(_0x5ae9dd,null));};exports[_0xf287('0x43')]=function(_0x3e048b,_0x2b9945){var _0x450934={'raw':!![],'where':{'id':_0x3e048b['params']['id']}},_0x445f0a={};_0x445f0a[_0xf287('0x30')]=_['keys'](db['WhatsappTransferReport']['rawAttributes']);_0x445f0a[_0xf287('0x2c')]=_[_0xf287('0x2d')](_0x3e048b[_0xf287('0x2c')]);_0x445f0a[_0xf287('0x2e')]=_[_0xf287('0x2f')](_0x445f0a[_0xf287('0x30')],_0x445f0a['query']);_0x450934[_0xf287('0x31')]=_[_0xf287('0x2f')](_0x445f0a[_0xf287('0x30')],qs[_0xf287('0x32')](_0x3e048b[_0xf287('0x2c')]['fields']));_0x450934[_0xf287('0x31')]=_0x450934['attributes'][_0xf287('0x33')]?_0x450934['attributes']:_0x445f0a[_0xf287('0x30')];if(_0x3e048b[_0xf287('0x2c')][_0xf287('0x40')]){_0x450934[_0xf287('0x44')]=[{'all':!![]}];}_0x450934=_['merge']({},_0x450934,_0x3e048b[_0xf287('0x3e')]);return db[_0xf287('0x3f')]['find'](_0x450934)[_0xf287('0x21')](handleEntityNotFound(_0x2b9945,null))[_0xf287('0x21')](respondWithResult(_0x2b9945,null))[_0xf287('0x42')](handleError(_0x2b9945,null));};exports[_0xf287('0x45')]=function(_0x42dd21,_0x5f5baa){return db[_0xf287('0x3f')][_0xf287('0x45')](_0x42dd21[_0xf287('0x46')],{})[_0xf287('0x21')](respondWithResult(_0x5f5baa,0xc9))[_0xf287('0x42')](handleError(_0x5f5baa,null));};exports[_0xf287('0x20')]=function(_0x6ada58,_0x280ebc){if(_0x6ada58['body']['id']){delete _0x6ada58[_0xf287('0x46')]['id'];}return db[_0xf287('0x3f')][_0xf287('0x47')]({'where':{'id':_0x6ada58[_0xf287('0x48')]['id']}})[_0xf287('0x21')](handleEntityNotFound(_0x280ebc,null))[_0xf287('0x21')](saveUpdates(_0x6ada58[_0xf287('0x46')],null))[_0xf287('0x21')](respondWithResult(_0x280ebc,null))[_0xf287('0x42')](handleError(_0x280ebc,null));};exports[_0xf287('0x22')]=function(_0x38d1f1,_0x3b8dcd){return db[_0xf287('0x3f')][_0xf287('0x47')]({'where':{'id':_0x38d1f1[_0xf287('0x48')]['id']}})[_0xf287('0x21')](handleEntityNotFound(_0x3b8dcd,null))[_0xf287('0x21')](removeEntity(_0x3b8dcd,null))[_0xf287('0x42')](handleError(_0x3b8dcd,null));};exports[_0xf287('0x49')]=function(_0x28d8e8,_0x33c8cc){return db[_0xf287('0x3f')][_0xf287('0x49')]()[_0xf287('0x21')](respondWithResult(_0x33c8cc,null))[_0xf287('0x42')](handleError(_0x33c8cc,null));}; \ No newline at end of file +var _0xe6b0=['send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','catch','show','params','WhatsappTransferReport','intersection','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name'];(function(_0x5ca480,_0x1ddf7b){var _0x168ef3=function(_0x153fdb){while(--_0x153fdb){_0x5ca480['push'](_0x5ca480['shift']());}};_0x168ef3(++_0x1ddf7b);}(_0xe6b0,0x18b));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0e6b('0x0'));var rimraf=require(_0x0e6b('0x1'));var zipdir=require(_0x0e6b('0x2'));var jsonpatch=require(_0x0e6b('0x3'));var rp=require(_0x0e6b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e6b('0x5'));var path=require(_0x0e6b('0x6'));var sox=require('sox');var csv=require(_0x0e6b('0x7'));var ejs=require(_0x0e6b('0x8'));var fs=require('fs');var fs_extra=require(_0x0e6b('0x9'));var _=require(_0x0e6b('0xa'));var squel=require('squel');var crypto=require(_0x0e6b('0xb'));var jsforce=require(_0x0e6b('0xc'));var deskjs=require(_0x0e6b('0xd'));var toCsv=require(_0x0e6b('0x7'));var querystring=require(_0x0e6b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e6b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e6b('0x11'))(_0x0e6b('0x12'));var utils=require(_0x0e6b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0e6b('0x14'));var db=require(_0x0e6b('0x15'))['db'];function respondWithStatusCode(_0x21e4ef,_0x1b6497){_0x1b6497=_0x1b6497||0xcc;return function(_0x108895){if(_0x108895){return _0x21e4ef['sendStatus'](_0x1b6497);}return _0x21e4ef['status'](_0x1b6497)[_0x0e6b('0x16')]();};}function respondWithResult(_0x712bc1,_0x55fa6d){_0x55fa6d=_0x55fa6d||0xc8;return function(_0x58cf9e){if(_0x58cf9e){return _0x712bc1[_0x0e6b('0x17')](_0x55fa6d)['json'](_0x58cf9e);}};}function respondWithFilteredResult(_0x4f1736,_0x4074be){return function(_0x11fd9a){if(_0x11fd9a){var _0x1908e9=typeof _0x4074be[_0x0e6b('0x18')]===_0x0e6b('0x19')&&typeof _0x4074be[_0x0e6b('0x1a')]===_0x0e6b('0x19');var _0x52be15=_0x11fd9a['count'];var _0x2af477=_0x1908e9?0x0:_0x4074be['offset'];var _0x39ebe4=_0x1908e9?_0x11fd9a['count']:_0x4074be['offset']+_0x4074be[_0x0e6b('0x1a')];var _0xf44742;if(_0x39ebe4>=_0x52be15){_0x39ebe4=_0x52be15;_0xf44742=0xc8;}else{_0xf44742=0xce;}_0x4f1736[_0x0e6b('0x17')](_0xf44742);return _0x4f1736['set'](_0x0e6b('0x1b'),_0x2af477+'-'+_0x39ebe4+'/'+_0x52be15)[_0x0e6b('0x1c')](_0x11fd9a);}return null;};}function patchUpdates(_0xf72673){return function(_0x3e66c8){try{jsonpatch[_0x0e6b('0x1d')](_0x3e66c8,_0xf72673,!![]);}catch(_0x4e66f1){return BPromise['reject'](_0x4e66f1);}return _0x3e66c8[_0x0e6b('0x1e')]();};}function saveUpdates(_0x2aa695,_0x6f0662){return function(_0x1487e9){if(_0x1487e9){return _0x1487e9['update'](_0x2aa695)[_0x0e6b('0x1f')](function(_0xc1e09c){return _0xc1e09c;});}return null;};}function removeEntity(_0x455e40,_0x3f17dc){return function(_0x5e3d47){if(_0x5e3d47){return _0x5e3d47[_0x0e6b('0x20')]()[_0x0e6b('0x1f')](function(){_0x455e40[_0x0e6b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8e2a,_0x2e9480){return function(_0x4e43ee){if(!_0x4e43ee){_0x3e8e2a[_0x0e6b('0x21')](0x194);}return _0x4e43ee;};}function handleError(_0x100d27,_0x575b30){_0x575b30=_0x575b30||0x1f4;return function(_0x40e916){logger[_0x0e6b('0x22')](_0x40e916[_0x0e6b('0x23')]);if(_0x40e916['name']){delete _0x40e916[_0x0e6b('0x24')];}_0x100d27['status'](_0x575b30)[_0x0e6b('0x25')](_0x40e916);};}exports[_0x0e6b('0x26')]=function(_0x2d65ae,_0x4a4c7a){var _0x1e2329={},_0x4040fd={},_0x1d678c={'count':0x0,'rows':[]};var _0x41b5f1=_['map'](db['WhatsappTransferReport'][_0x0e6b('0x27')],function(_0x30621a){return{'name':_0x30621a[_0x0e6b('0x28')],'type':_0x30621a[_0x0e6b('0x29')][_0x0e6b('0x2a')]};});_0x4040fd['model']=_[_0x0e6b('0x2b')](_0x41b5f1,'name');_0x4040fd['query']=_[_0x0e6b('0x2c')](_0x2d65ae[_0x0e6b('0x2d')]);_0x4040fd[_0x0e6b('0x2e')]=_['intersection'](_0x4040fd[_0x0e6b('0x2f')],_0x4040fd[_0x0e6b('0x2d')]);_0x1e2329[_0x0e6b('0x30')]=_['intersection'](_0x4040fd[_0x0e6b('0x2f')],qs[_0x0e6b('0x31')](_0x2d65ae[_0x0e6b('0x2d')]['fields']));_0x1e2329[_0x0e6b('0x30')]=_0x1e2329[_0x0e6b('0x30')][_0x0e6b('0x32')]?_0x1e2329[_0x0e6b('0x30')]:_0x4040fd[_0x0e6b('0x2f')];if(!_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x33')]('nolimit')){_0x1e2329[_0x0e6b('0x1a')]=qs['limit'](_0x2d65ae['query'][_0x0e6b('0x1a')]);_0x1e2329[_0x0e6b('0x18')]=qs['offset'](_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x18')]);}_0x1e2329[_0x0e6b('0x34')]=qs[_0x0e6b('0x35')](_0x2d65ae[_0x0e6b('0x2d')]['sort']);_0x1e2329[_0x0e6b('0x36')]=qs['filters'](_[_0x0e6b('0x37')](_0x2d65ae[_0x0e6b('0x2d')],_0x4040fd[_0x0e6b('0x2e')]),_0x41b5f1);if(_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x38')]){_0x1e2329[_0x0e6b('0x36')]=_[_0x0e6b('0x39')](_0x1e2329[_0x0e6b('0x36')],{'$or':_['map'](_0x41b5f1,function(_0x294348){if(_0x294348[_0x0e6b('0x29')]!=='VIRTUAL'){var _0xa599de={};_0xa599de[_0x294348[_0x0e6b('0x24')]]={'$like':'%'+_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x38')]+'%'};return _0xa599de;}})});}_0x1e2329=_[_0x0e6b('0x39')]({},_0x1e2329,_0x2d65ae[_0x0e6b('0x3a')]);var _0x33419d={'where':_0x1e2329['where']};return db['WhatsappTransferReport'][_0x0e6b('0x3b')](_0x33419d)[_0x0e6b('0x1f')](function(_0x456e17){_0x1d678c[_0x0e6b('0x3b')]=_0x456e17;if(_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x3c')]){_0x1e2329['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x1e2329);})[_0x0e6b('0x1f')](function(_0x273c93){_0x1d678c['rows']=_0x273c93;return _0x1d678c;})['then'](respondWithFilteredResult(_0x4a4c7a,_0x1e2329))[_0x0e6b('0x3d')](handleError(_0x4a4c7a,null));};exports[_0x0e6b('0x3e')]=function(_0x434698,_0x3893c8){var _0x208169={'raw':!![],'where':{'id':_0x434698[_0x0e6b('0x3f')]['id']}},_0x1d3190={};_0x1d3190[_0x0e6b('0x2f')]=_[_0x0e6b('0x2c')](db[_0x0e6b('0x40')][_0x0e6b('0x27')]);_0x1d3190[_0x0e6b('0x2d')]=_[_0x0e6b('0x2c')](_0x434698[_0x0e6b('0x2d')]);_0x1d3190[_0x0e6b('0x2e')]=_[_0x0e6b('0x41')](_0x1d3190[_0x0e6b('0x2f')],_0x1d3190[_0x0e6b('0x2d')]);_0x208169[_0x0e6b('0x30')]=_[_0x0e6b('0x41')](_0x1d3190[_0x0e6b('0x2f')],qs[_0x0e6b('0x31')](_0x434698[_0x0e6b('0x2d')]['fields']));_0x208169[_0x0e6b('0x30')]=_0x208169['attributes'][_0x0e6b('0x32')]?_0x208169['attributes']:_0x1d3190[_0x0e6b('0x2f')];if(_0x434698[_0x0e6b('0x2d')][_0x0e6b('0x3c')]){_0x208169[_0x0e6b('0x42')]=[{'all':!![]}];}_0x208169=_[_0x0e6b('0x39')]({},_0x208169,_0x434698[_0x0e6b('0x3a')]);return db[_0x0e6b('0x40')][_0x0e6b('0x43')](_0x208169)[_0x0e6b('0x1f')](handleEntityNotFound(_0x3893c8,null))[_0x0e6b('0x1f')](respondWithResult(_0x3893c8,null))[_0x0e6b('0x3d')](handleError(_0x3893c8,null));};exports[_0x0e6b('0x44')]=function(_0x8aa7cd,_0x2eddca){return db[_0x0e6b('0x40')][_0x0e6b('0x44')](_0x8aa7cd['body'],{})[_0x0e6b('0x1f')](respondWithResult(_0x2eddca,0xc9))['catch'](handleError(_0x2eddca,null));};exports[_0x0e6b('0x45')]=function(_0x28e4e8,_0x26cd2e){if(_0x28e4e8[_0x0e6b('0x46')]['id']){delete _0x28e4e8[_0x0e6b('0x46')]['id'];}return db[_0x0e6b('0x40')][_0x0e6b('0x43')]({'where':{'id':_0x28e4e8[_0x0e6b('0x3f')]['id']}})[_0x0e6b('0x1f')](handleEntityNotFound(_0x26cd2e,null))[_0x0e6b('0x1f')](saveUpdates(_0x28e4e8[_0x0e6b('0x46')],null))[_0x0e6b('0x1f')](respondWithResult(_0x26cd2e,null))[_0x0e6b('0x3d')](handleError(_0x26cd2e,null));};exports[_0x0e6b('0x20')]=function(_0xb381a5,_0x3c5511){return db[_0x0e6b('0x40')][_0x0e6b('0x43')]({'where':{'id':_0xb381a5['params']['id']}})[_0x0e6b('0x1f')](handleEntityNotFound(_0x3c5511,null))[_0x0e6b('0x1f')](removeEntity(_0x3c5511,null))['catch'](handleError(_0x3c5511,null));};exports[_0x0e6b('0x47')]=function(_0x25ca69,_0x1c29aa){return db[_0x0e6b('0x40')][_0x0e6b('0x47')]()[_0x0e6b('0x1f')](respondWithResult(_0x1c29aa,null))[_0x0e6b('0x3d')](handleError(_0x1c29aa,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a9b01c4..3098e11 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 _0x4f81=['report_whatsapp_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x13419c,_0x53d606){var _0x294878=function(_0x3e2748){while(--_0x3e2748){_0x13419c['push'](_0x13419c['shift']());}};_0x294878(++_0x53d606);}(_0x4f81,0x183));var _0x14f8=function(_0x25f44c,_0x304d3b){_0x25f44c=_0x25f44c-0x0;var _0x1790df=_0x4f81[_0x25f44c];return _0x1790df;};'use strict';var _=require('lodash');var util=require(_0x14f8('0x0'));var logger=require(_0x14f8('0x1'))('api');var moment=require(_0x14f8('0x2'));var BPromise=require(_0x14f8('0x3'));var rp=require(_0x14f8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14f8('0x5'));var config=require(_0x14f8('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x14f8('0x7')]=function(_0xab534b,_0x34896e){return _0xab534b[_0x14f8('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0x14f8('0x9'),'paranoid':![],'indexes':[{'name':_0x14f8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x35b1=['./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd7df6d,_0x2e784b){var _0x304544=function(_0x4e6594){while(--_0x4e6594){_0xd7df6d['push'](_0xd7df6d['shift']());}};_0x304544(++_0x2e784b);}(_0x35b1,0x1a9));var _0x135b=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x35b1[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0x135b('0x0'));var util=require(_0x135b('0x1'));var logger=require(_0x135b('0x2'))(_0x135b('0x3'));var moment=require(_0x135b('0x4'));var BPromise=require(_0x135b('0x5'));var rp=require(_0x135b('0x6'));var fs=require('fs');var path=require(_0x135b('0x7'));var rimraf=require(_0x135b('0x8'));var config=require(_0x135b('0x9'));var attributes=require(_0x135b('0xa'));module[_0x135b('0xb')]=function(_0x59ba73,_0x5de7aa){return _0x59ba73[_0x135b('0xc')]('WhatsappTransferReport',attributes,{'tableName':_0x135b('0xd'),'paranoid':![],'indexes':[{'name':_0x135b('0xe'),'fields':[_0x135b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7be3441..670368f 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 _0xa89b=['rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x373eed,_0x347e06){var _0x90e721=function(_0x4cb9da){while(--_0x4cb9da){_0x373eed['push'](_0x373eed['shift']());}};_0x90e721(++_0x347e06);}(_0xa89b,0x75));var _0xba89=function(_0x159b72,_0x183756){_0x159b72=_0x159b72-0x0;var _0x4fa7b7=_0xa89b[_0x159b72];return _0x4fa7b7;};'use strict';var _=require('lodash');var util=require(_0xba89('0x0'));var moment=require(_0xba89('0x1'));var BPromise=require(_0xba89('0x2'));var rs=require(_0xba89('0x3'));var fs=require('fs');var Redis=require(_0xba89('0x4'));var db=require(_0xba89('0x5'))['db'];var utils=require(_0xba89('0x6'));var logger=require(_0xba89('0x7'))(_0xba89('0x8'));var config=require(_0xba89('0x9'));var jayson=require(_0xba89('0xa'));var client=jayson['client'][_0xba89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b34fe,_0x1fb125,_0x5bd7c7){return new BPromise(function(_0x1fe205,_0x2293a0){return client[_0xba89('0xc')](_0x1b34fe,_0x5bd7c7)[_0xba89('0xd')](function(_0x364071){logger[_0xba89('0xe')](_0xba89('0xf'),_0x1fb125,_0xba89('0x10'));logger[_0xba89('0x11')](_0xba89('0x12'),_0x1fb125,_0xba89('0x10'),JSON[_0xba89('0x13')](_0x364071));if(_0x364071['error']){if(_0x364071[_0xba89('0x14')][_0xba89('0x15')]===0x1f4){logger[_0xba89('0x14')](_0xba89('0xf'),_0x1fb125,_0x364071['error']['message']);return _0x2293a0(_0x364071[_0xba89('0x14')][_0xba89('0x16')]);}logger[_0xba89('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fb125,_0x364071[_0xba89('0x14')][_0xba89('0x16')]);return _0x1fe205(_0x364071[_0xba89('0x14')][_0xba89('0x16')]);}else{logger[_0xba89('0xe')](_0xba89('0xf'),_0x1fb125,'request\x20sent');_0x1fe205(_0x364071[_0xba89('0x17')][_0xba89('0x16')]);}})[_0xba89('0x18')](function(_0x3c39a0){logger[_0xba89('0x14')](_0xba89('0xf'),_0x1fb125,_0x3c39a0);_0x2293a0(_0x3c39a0);});});} \ No newline at end of file +var _0xdf83=['info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','error','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0xdf83,0x120));var _0x3df8=function(_0x1291b3,_0x54cc6b){_0x1291b3=_0x1291b3-0x0;var _0x48645f=_0xdf83[_0x1291b3];return _0x48645f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3df8('0x0'));var rs=require(_0x3df8('0x1'));var fs=require('fs');var Redis=require(_0x3df8('0x2'));var db=require(_0x3df8('0x3'))['db'];var utils=require(_0x3df8('0x4'));var logger=require(_0x3df8('0x5'))(_0x3df8('0x6'));var config=require(_0x3df8('0x7'));var jayson=require(_0x3df8('0x8'));var client=jayson[_0x3df8('0x9')][_0x3df8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8572,_0x4f6bcc,_0x44c5fc){return new BPromise(function(_0x2e5d8b,_0x58e408){return client[_0x3df8('0xb')](_0x2d8572,_0x44c5fc)['then'](function(_0x4a1e7c){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x4f6bcc,_0x3df8('0xc'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4f6bcc,'request\x20sent',JSON['stringify'](_0x4a1e7c));if(_0x4a1e7c[_0x3df8('0xd')]){if(_0x4a1e7c[_0x3df8('0xd')]['code']===0x1f4){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x4f6bcc,_0x4a1e7c[_0x3df8('0xd')][_0x3df8('0xf')]);return _0x58e408(_0x4a1e7c[_0x3df8('0xd')][_0x3df8('0xf')]);}logger[_0x3df8('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f6bcc,_0x4a1e7c['error'][_0x3df8('0xf')]);return _0x2e5d8b(_0x4a1e7c[_0x3df8('0xd')]['message']);}else{logger[_0x3df8('0x10')](_0x3df8('0xe'),_0x4f6bcc,_0x3df8('0xc'));_0x2e5d8b(_0x4a1e7c[_0x3df8('0x11')][_0x3df8('0xf')]);}})[_0x3df8('0x12')](function(_0x4665cf){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x4f6bcc,_0x4665cf);_0x58e408(_0x4665cf);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 5e1b7ef..160520c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14f5=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','info','start','filter','number','exitCode','length','map','pm2_env','Online\x20apps:','join','Offline\x20apps:','online','name','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./rpc','./config/environment','app','./config/pm2'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x14f5,0xae));var _0x514f=function(_0x2c88c8,_0x4a71e6){_0x2c88c8=_0x2c88c8-0x0;var _0x320739=_0x14f5[_0x2c88c8];return _0x320739;};'use strict';var _=require('lodash');var db=require(_0x514f('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x514f('0x1'));var rpc=require(_0x514f('0x2'));var config=require(_0x514f('0x3'));var logger=require('./config/logger')(_0x514f('0x4'));var pm2=require(_0x514f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x514f('0x6'));var chat=require(_0x514f('0x7'));var whatsapp=require(_0x514f('0x8'));var transcribe=require(_0x514f('0x9'));var provider=require(_0x514f('0xa'));function main(){return db[_0x514f('0xb')][_0x514f('0xc')]()['then'](function(){if(config[_0x514f('0xd')]){return seedDb['default']();}})[_0x514f('0xe')](function(){return checkLicense[_0x514f('0xf')]();})[_0x514f('0xe')](function(){return rpc[_0x514f('0x10')]();})[_0x514f('0xe')](function(_0x24cb4e){logger[_0x514f('0x11')](_0x24cb4e);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0x514f('0xe')](function(){return schedule[_0x514f('0x12')]();})[_0x514f('0xe')](function(){return transcribe[_0x514f('0x12')]();})[_0x514f('0xe')](function(){return provider[_0x514f('0x12')]();})[_0x514f('0xe')](function(_0x1ddec8){logger[_0x514f('0x11')](_0x1ddec8);return pm2[_0x514f('0x12')](pm2Config);})[_0x514f('0xe')](function(_0x3fc905){var _0x2054fe=_0x3fc905[_0x514f('0x13')](function(_0x1694b3){return typeof _0x1694b3['exitCode']===_0x514f('0x14')&&_0x1694b3[_0x514f('0x15')]>=0x0;});if(_0x2054fe['length']>0x0){throw new Error(_0x2054fe[_0x514f('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x514f('0x17')](_0x2054fe,function(_0x309ce0){return'\x22'+_0x309ce0[_0x514f('0x18')]['name']+'\x22';}));}logger[_0x514f('0x11')](_0x514f('0x19'),_[_0x514f('0x17')](_[_0x514f('0x13')](_0x3fc905,{'status':'online'}),'name')[_0x514f('0x1a')]());logger[_0x514f('0x11')](_0x514f('0x1b'),_['map'](_[_0x514f('0x13')](_0x3fc905,function(_0x7248e8){return _0x7248e8['status']!==_0x514f('0x1c');}),_0x514f('0x1d'))['join']()||_0x514f('0x1e'));console[_0x514f('0x1f')](_0x514f('0x20'));})[_0x514f('0x21')](function(_0x5377ee){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x5377ee);logger['error'](_0x514f('0x22'),_0x5377ee);process[_0x514f('0x23')](0x1);});}main(); \ No newline at end of file +var _0x7266=['\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x365b60,_0x28a380){var _0x196e0b=function(_0x4745c3){while(--_0x4745c3){_0x365b60['push'](_0x365b60['shift']());}};_0x196e0b(++_0x28a380);}(_0x7266,0xec));var _0x6726=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x7266[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x6726('0x0'));var db=require(_0x6726('0x1'))['db'];var seedDb=require(_0x6726('0x2'));var checkLicense=require(_0x6726('0x3'));var rpc=require(_0x6726('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x6726('0x5'));var pm2=require(_0x6726('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x6726('0x7'));var whatsapp=require(_0x6726('0x8'));var transcribe=require(_0x6726('0x9'));var provider=require(_0x6726('0xa'));function main(){return db[_0x6726('0xb')][_0x6726('0xc')]()[_0x6726('0xd')](function(){if(config[_0x6726('0xe')]){return seedDb[_0x6726('0xf')]();}})[_0x6726('0xd')](function(){return checkLicense[_0x6726('0xf')]();})[_0x6726('0xd')](function(){return rpc[_0x6726('0x10')]();})['then'](function(_0x44ff0c){logger[_0x6726('0x11')](_0x44ff0c);return chat[_0x6726('0x12')]();})[_0x6726('0xd')](function(){return whatsapp['start']();})[_0x6726('0xd')](function(){return schedule['start']();})[_0x6726('0xd')](function(){return transcribe[_0x6726('0x12')]();})['then'](function(){return provider[_0x6726('0x12')]();})[_0x6726('0xd')](function(_0x1182b2){logger[_0x6726('0x11')](_0x1182b2);return pm2['start'](pm2Config);})[_0x6726('0xd')](function(_0x2eb2bc){var _0x4dc47d=_0x2eb2bc[_0x6726('0x13')](function(_0x5d3458){return typeof _0x5d3458[_0x6726('0x14')]===_0x6726('0x15')&&_0x5d3458[_0x6726('0x14')]>=0x0;});if(_0x4dc47d[_0x6726('0x16')]>0x0){throw new Error(_0x4dc47d['length']+_0x6726('0x17')+_[_0x6726('0x18')](_0x4dc47d,function(_0x4adb51){return'\x22'+_0x4adb51[_0x6726('0x19')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,{'status':'online'}),_0x6726('0x1a'))[_0x6726('0x1b')]());logger[_0x6726('0x11')](_0x6726('0x1c'),_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,function(_0x4af165){return _0x4af165[_0x6726('0x1d')]!=='online';}),_0x6726('0x1a'))[_0x6726('0x1b')]()||_0x6726('0x1e'));console[_0x6726('0x1f')](_0x6726('0x20'));})[_0x6726('0x21')](function(_0x562058){console[_0x6726('0x1f')](_0x6726('0x22'),_0x562058);logger[_0x6726('0x23')](_0x6726('0x24'),_0x562058);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 d5cbfc4..2a3477a 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 _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x4a00bc,_0x2776b3){var _0x150710=function(_0x9b1c0c){while(--_0x9b1c0c){_0x4a00bc['push'](_0x4a00bc['shift']());}};_0x150710(++_0x2776b3);}(_0xedd9,0xfc));var _0x9edd=function(_0x19ae3c,_0x36ef3a){_0x19ae3c=_0x19ae3c-0x0;var _0x5e155a=_0xedd9[_0x19ae3c];return _0x5e155a;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 788979f..9f80fdd 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 _0x0c1c=['createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','encryptFile','createReadStream'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0c1c,0x15a));var _0xc0c1=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x0c1c[_0x51e79c];return _0x2467be;};'use strict';var crypto=require(_0xc0c1('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xc0c1('0x1'));var config=require(_0xc0c1('0x2'));var logger=require('../../config/logger')(_0xc0c1('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xc0c1('0x4')],'algorithm':_0xc0c1('0x5')};const fileOptions={'algorithm':_0xc0c1('0x6')};if(config['encrypt']&&config[_0xc0c1('0x7')][_0xc0c1('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc0c1('0x7')][_0xc0c1('0x8')]);if(isSupported){fileOptions[_0xc0c1('0x8')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc0c1('0x9')](',\x20');logger[_0xc0c1('0xa')](config[_0xc0c1('0x7')][_0xc0c1('0x8')],_0xc0c1('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1fef17){return AES_SUPPORTED_RX[_0xc0c1('0xc')](_0x1fef17);}function getSupportedCiphers(){return crypto[_0xc0c1('0xd')]()[_0xc0c1('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1fb3eb){return getSupportedCiphers()['indexOf'](_0x1fb3eb)>-0x1;}function combineOptions(_0xe0fdfe){var _0x1cf8c1={};for(var _0x164c74 in fileOptions){if(fileOptions['hasOwnProperty'](_0x164c74)){_0x1cf8c1[_0x164c74]=fileOptions[_0x164c74];}}if(_0xe0fdfe){for(var _0x44d760 in _0xe0fdfe){if(_0xe0fdfe['hasOwnProperty'](_0x44d760)){_0x1cf8c1[_0x44d760]=_0xe0fdfe[_0x44d760];}}}return _0x1cf8c1;}exports[_0xc0c1('0xf')]=function(_0x3aebe7,_0x4d51d2,_0x2aa24b,_0x281553){return new BPromise(function(_0x40d750,_0x4aac3e){_0x281553=combineOptions(_0x281553);var _0x18b16f=new Buffer(_0x2aa24b);var _0x31c66a=fs[_0xc0c1('0x10')](_0x3aebe7);var _0x54b357=fs[_0xc0c1('0x11')](_0x4d51d2);var _0x169c48=crypto[_0xc0c1('0x12')](_0x281553['algorithm'],_0x18b16f);_0x31c66a['on'](_0xc0c1('0x13'),function(_0xeec301){var _0x4a0f80=new Buffer(_0x169c48[_0xc0c1('0x14')](_0xeec301),_0xc0c1('0x15'));_0x54b357[_0xc0c1('0x16')](_0x4a0f80);});_0x31c66a['on'](_0xc0c1('0x17'),function(){try{var _0x4d9bce=new Buffer(_0x169c48[_0xc0c1('0x18')]('binary'),_0xc0c1('0x15'));_0x54b357['write'](_0x4d9bce);_0x54b357[_0xc0c1('0x17')]();_0x54b357['on']('close',function(){return _0x40d750(_0x4d51d2);});}catch(_0x2feb4b){fs[_0xc0c1('0x19')](_0x4d51d2);return _0x4aac3e(_0x2feb4b);}});});};exports[_0xc0c1('0x1a')]=function(_0x1f6485,_0x12ece4,_0x1f4daf,_0x82aa94){return new BPromise(function(_0xcb2254,_0x39600a){_0x82aa94=combineOptions(_0x82aa94);var _0x18dc61=new Buffer(_0x1f4daf);var _0x4f7260=fs[_0xc0c1('0x10')](_0x1f6485);var _0x5d130f=fs[_0xc0c1('0x11')](_0x12ece4);var _0x3cdb5e=crypto[_0xc0c1('0x1b')](_0x82aa94[_0xc0c1('0x8')],_0x18dc61);_0x4f7260['on'](_0xc0c1('0x13'),function(_0x2c5e02){var _0x5a5843=new Buffer(_0x3cdb5e[_0xc0c1('0x14')](_0x2c5e02),_0xc0c1('0x15'));_0x5d130f[_0xc0c1('0x16')](_0x5a5843);});_0x4f7260['on']('end',function(){try{var _0x27815c=new Buffer(_0x3cdb5e['final']('binary'),'binary');_0x5d130f[_0xc0c1('0x16')](_0x27815c);_0x5d130f[_0xc0c1('0x17')]();_0x5d130f['on']('close',function(){return _0xcb2254(_0x12ece4);});}catch(_0x6f1179){fs[_0xc0c1('0x19')](_0x12ece4);return _0x39600a(_0x6f1179);}});});};exports[_0xc0c1('0x1c')]=function(_0x2a8b53,_0x75f2c6,_0x1f52b4){var _0x3d7e81=_0x1f52b4||stringOptions['algorithm'];var _0x4f54cb=_0x75f2c6||stringOptions[_0xc0c1('0x1d')];var _0x5a4a0b=crypto['createCipher'](_0x3d7e81,_0x4f54cb);var _0x3767b6=_0x5a4a0b[_0xc0c1('0x14')](_0x2a8b53,_0xc0c1('0x1e'),'base64');_0x3767b6+=_0x5a4a0b[_0xc0c1('0x18')](_0xc0c1('0x1f'));return _0x3767b6;};exports[_0xc0c1('0x20')]=function(_0x5368f5,_0xc3910b,_0xf12fa9){var _0x14a1e2=_0xf12fa9||stringOptions[_0xc0c1('0x8')];var _0x5c6d09=_0xc3910b||stringOptions['secret'];var _0x218782=crypto['createDecipher'](_0x14a1e2,_0x5c6d09);var _0x3bf2cd=_0x218782['update'](_0x5368f5,_0xc0c1('0x1f'),_0xc0c1('0x1e'));_0x3bf2cd+=_0x218782[_0xc0c1('0x18')](_0xc0c1('0x1e'));return _0x3bf2cd;}; \ No newline at end of file +var _0x2326=['../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','data','encryptString','createCipher','utf8','base64','secret','crypto','bluebird','lodash','../../config/environment'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2326,0x137));var _0x6232=function(_0x88dca,_0x5699df){_0x88dca=_0x88dca-0x0;var _0x2e85d8=_0x2326[_0x88dca];return _0x2e85d8;};'use strict';var crypto=require(_0x6232('0x0'));var fs=require('fs');var BPromise=require(_0x6232('0x1'));var _=require(_0x6232('0x2'));var config=require(_0x6232('0x3'));var logger=require(_0x6232('0x4'))(_0x6232('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6232('0x6')][_0x6232('0x7')],'algorithm':_0x6232('0x8')};const fileOptions={'algorithm':_0x6232('0x9')};if(config[_0x6232('0xa')]&&config[_0x6232('0xa')][_0x6232('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6232('0xb')]);if(isSupported){fileOptions[_0x6232('0xb')]=config[_0x6232('0xa')][_0x6232('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x6232('0xc')](config[_0x6232('0xa')]['algorithm'],_0x6232('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x3540cf){return AES_SUPPORTED_RX['test'](_0x3540cf);}function getSupportedCiphers(){return crypto[_0x6232('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3dafef){return getSupportedCiphers()[_0x6232('0xf')](_0x3dafef)>-0x1;}function combineOptions(_0x2d8aac){var _0x493b71={};for(var _0xbe9fc9 in fileOptions){if(fileOptions[_0x6232('0x10')](_0xbe9fc9)){_0x493b71[_0xbe9fc9]=fileOptions[_0xbe9fc9];}}if(_0x2d8aac){for(var _0x2d593e in _0x2d8aac){if(_0x2d8aac[_0x6232('0x10')](_0x2d593e)){_0x493b71[_0x2d593e]=_0x2d8aac[_0x2d593e];}}}return _0x493b71;}exports[_0x6232('0x11')]=function(_0x37ece6,_0x5d4555,_0x36541c,_0x2cd598){return new BPromise(function(_0x47a4b9,_0x17eed4){_0x2cd598=combineOptions(_0x2cd598);var _0x180259=new Buffer(_0x36541c);var _0x18c75a=fs[_0x6232('0x12')](_0x37ece6);var _0x350a58=fs[_0x6232('0x13')](_0x5d4555);var _0x1c5786=crypto['createCipher'](_0x2cd598['algorithm'],_0x180259);_0x18c75a['on']('data',function(_0x5a121f){var _0x4ce026=new Buffer(_0x1c5786[_0x6232('0x14')](_0x5a121f),_0x6232('0x15'));_0x350a58[_0x6232('0x16')](_0x4ce026);});_0x18c75a['on'](_0x6232('0x17'),function(){try{var _0x515c5e=new Buffer(_0x1c5786[_0x6232('0x18')](_0x6232('0x15')),_0x6232('0x15'));_0x350a58[_0x6232('0x16')](_0x515c5e);_0x350a58[_0x6232('0x17')]();_0x350a58['on'](_0x6232('0x19'),function(){return _0x47a4b9(_0x5d4555);});}catch(_0x184ebf){fs[_0x6232('0x1a')](_0x5d4555);return _0x17eed4(_0x184ebf);}});});};exports[_0x6232('0x1b')]=function(_0x5e3345,_0x3e7152,_0x1c2fec,_0x1d383a){return new BPromise(function(_0xd0d25e,_0x12b5e4){_0x1d383a=combineOptions(_0x1d383a);var _0x3db039=new Buffer(_0x1c2fec);var _0x1df82b=fs[_0x6232('0x12')](_0x5e3345);var _0x52e223=fs[_0x6232('0x13')](_0x3e7152);var _0xc77dc9=crypto[_0x6232('0x1c')](_0x1d383a[_0x6232('0xb')],_0x3db039);_0x1df82b['on'](_0x6232('0x1d'),function(_0x10b0a3){var _0x3ef15c=new Buffer(_0xc77dc9[_0x6232('0x14')](_0x10b0a3),_0x6232('0x15'));_0x52e223[_0x6232('0x16')](_0x3ef15c);});_0x1df82b['on']('end',function(){try{var _0x468c9d=new Buffer(_0xc77dc9['final'](_0x6232('0x15')),'binary');_0x52e223['write'](_0x468c9d);_0x52e223['end']();_0x52e223['on'](_0x6232('0x19'),function(){return _0xd0d25e(_0x3e7152);});}catch(_0x38a479){fs[_0x6232('0x1a')](_0x3e7152);return _0x12b5e4(_0x38a479);}});});};exports[_0x6232('0x1e')]=function(_0x441894,_0x24e8ce,_0x574041){var _0x3d397d=_0x574041||stringOptions[_0x6232('0xb')];var _0x2a5b5e=_0x24e8ce||stringOptions['secret'];var _0x133606=crypto[_0x6232('0x1f')](_0x3d397d,_0x2a5b5e);var _0x23295d=_0x133606['update'](_0x441894,_0x6232('0x20'),'base64');_0x23295d+=_0x133606[_0x6232('0x18')](_0x6232('0x21'));return _0x23295d;};exports['decryptString']=function(_0x52c55b,_0x52e594,_0x4a4938){var _0x556b7c=_0x4a4938||stringOptions[_0x6232('0xb')];var _0x41e2ee=_0x52e594||stringOptions[_0x6232('0x22')];var _0x47cb18=crypto['createDecipher'](_0x556b7c,_0x41e2ee);var _0x208dd0=_0x47cb18[_0x6232('0x14')](_0x52c55b,_0x6232('0x21'),'utf8');_0x208dd0+=_0x47cb18[_0x6232('0x18')](_0x6232('0x20'));return _0x208dd0;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5baa3b0..05ec661 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 _0x4319=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4319,0x138));var _0x9431=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x4319[_0x3d5351];return _0x1db4db;};'use strict';var util=require(_0x9431('0x0'));var path=require(_0x9431('0x1'));var _=require(_0x9431('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9431('0x3'));var zipdir=require(_0x9431('0x4'));var rimraf=require(_0x9431('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9431('0x6'))[_0x9431('0x7')];var logger=require('../../config/logger')(_0x9431('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9431('0x9')][0x3];var PATH=process[_0x9431('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x549809,_0x3876f2){var _0x4c422f={'status':_0x549809};var _0x1c4e0f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3876f2){_0x4c422f['savename']=_0x3876f2;}return db['AnalyticExtractedReport']['update'](_0x4c422f,_0x1c4e0f);}function main(){var _0x1bac7c=0x1388;var _0x19bd4a;logger[_0x9431('0xa')](util[_0x9431('0xb')](_0x9431('0xc'),EXTRACTED_REPORT_ID,_0x9431('0xd')));return db['Setting'][_0x9431('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9431('0xf'),_0x9431('0x10')]})[_0x9431('0x11')](function(_0x2500fe){if(_0x2500fe){_0x19bd4a=_0x2500fe;_0x1bac7c=_0x19bd4a[_0x9431('0x10')]||0x1388;}})[_0x9431('0x11')](function(){return dbH[_0x9431('0x12')][_0x9431('0x13')](util[_0x9431('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9431('0x12')][_0x9431('0x14')][_0x9431('0x15')]});})[_0x9431('0x11')](function(_0x5120c5){if(!_0x5120c5[0x0][_0x9431('0x16')]){return analyticExtractedReport('Empty');}var _0x1f8888=[];var _0x5b4068=0x0;if(_0x19bd4a[_0x9431('0xf')]){if(_0x5120c5&&_0x5120c5['length']){var _0x1300f9=_[_0x9431('0x17')](_0x5120c5[0x0][_0x9431('0x16')]/_0x1bac7c);var _0x73d36a=Number[_0x9431('0x18')](_0x5120c5[0x0][_0x9431('0x16')]/_0x1bac7c)?_0x5120c5[0x0][_0x9431('0x16')]%_0x1bac7c:0x0;_0x1300f9['forEach'](function(_0x548ece){if(_0x548ece>0x0){_0x5b4068+=_0x1bac7c;}_0x1f8888[_0x9431('0x19')](dbH[_0x9431('0x12')][_0x9431('0x13')](util['format'](_0x9431('0x1a'),QUERY,_0x1bac7c,_0x5b4068),{'type':dbH[_0x9431('0x12')][_0x9431('0x14')][_0x9431('0x15')]}));});if(_0x73d36a>0x0){_0x5b4068+=_0x1bac7c;_0x1f8888['push'](dbH['sequelize'][_0x9431('0x13')](util['format'](_0x9431('0x1a'),QUERY,_0x73d36a,_0x5b4068),{'type':dbH[_0x9431('0x12')][_0x9431('0x14')][_0x9431('0x15')]}));}}}else{_0x1f8888[_0x9431('0x19')](dbH[_0x9431('0x12')][_0x9431('0x13')](QUERY,{'type':dbH[_0x9431('0x12')][_0x9431('0x14')][_0x9431('0x15')]}));}var _0x5cb01e=path['dirname'](PATH);var _0x338998=path[_0x9431('0x1b')](PATH,'.csv');var _0x4cae26=_0x19bd4a[_0x9431('0xf')]&&_0x1f8888[_0x9431('0x1c')]>0x1;var _0x570b95=[];if(!fs[_0x9431('0x1d')](path[_0x9431('0x1e')](_0x5cb01e,_0x338998))&&_0x4cae26){fs[_0x9431('0x1f')](path['join'](_0x5cb01e,_0x338998));}return BPromise[_0x9431('0x20')](_0x1f8888,function(_0x745eb1){_0x570b95[_0x9431('0x19')](_0x745eb1);})[_0x9431('0x11')](function(){for(var _0x34b118=0x0;_0x34b118<_0x570b95['length'];_0x34b118+=0x1){var _0x2a6db6;var _0x469b1a=_0x570b95[_0x34b118];if(_0x4cae26){_0x2a6db6=path['join'](_0x5cb01e,_0x338998,util[_0x9431('0xb')](_0x9431('0x21'),_0x338998,_0x34b118,_0x9431('0x22')));}else{_0x2a6db6=path[_0x9431('0x1e')](_0x5cb01e,util[_0x9431('0xb')](_0x9431('0x23'),_0x338998,_0x9431('0x22')));}fs[_0x9431('0x24')](_0x2a6db6,csv(_0x469b1a));}})[_0x9431('0x11')](function(){if(_0x4cae26){return new Promise(function(_0x48a740){zipdir(path[_0x9431('0x1e')](_0x5cb01e,_0x338998),{'saveTo':path[_0x9431('0x1e')](_0x5cb01e,util[_0x9431('0xb')]('%s.%s',_0x338998,_0x9431('0x25')))},function(_0x4efbd5,_0x47a9c5){rimraf(path[_0x9431('0x1e')](_0x5cb01e,_0x338998),function(){});_0x48a740(_0x9431('0x26'));});});}})['then'](function(){logger[_0x9431('0xa')](util['format'](_0x9431('0x27'),EXTRACTED_REPORT_ID,_0x9431('0xd')));return analyticExtractedReport('Completed',_0x4cae26?util[_0x9431('0xb')](_0x9431('0x23'),_0x338998,_0x4cae26?_0x9431('0x25'):'csv'):null);});})[_0x9431('0x28')](function(_0x3cc52b){logger['info'](util[_0x9431('0xb')](_0x9431('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0x9431('0x2a')](_0x3cc52b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x9431('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc01c=['finally','exit','util','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc01c,0x66));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcc01('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xcc01('0x1'));var zipdir=require(_0xcc01('0x2'));var rimraf=require('rimraf');var db=require(_0xcc01('0x3'))['db'];var dbH=require(_0xcc01('0x3'))[_0xcc01('0x4')];var logger=require(_0xcc01('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcc01('0x6')][0x2]);var QUERY=process[_0xcc01('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x9d6f9c,_0x221ba3){var _0x470bda={'status':_0x9d6f9c};var _0x44cbe0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x221ba3){_0x470bda[_0xcc01('0x7')]=_0x221ba3;}return db[_0xcc01('0x8')]['update'](_0x470bda,_0x44cbe0);}function main(){var _0x581672=0x1388;var _0x21ccf8;logger['info'](util[_0xcc01('0x9')](_0xcc01('0xa'),EXTRACTED_REPORT_ID,_0xcc01('0xb')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcc01('0xc')]})[_0xcc01('0xd')](function(_0x5f302f){if(_0x5f302f){_0x21ccf8=_0x5f302f;_0x581672=_0x21ccf8['splitSizeCsv']||0x1388;}})[_0xcc01('0xd')](function(){return dbH['sequelize'][_0xcc01('0xe')](util[_0xcc01('0x9')](_0xcc01('0xf'),QUERY),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]});})[_0xcc01('0xd')](function(_0x553085){if(!_0x553085[0x0][_0xcc01('0x13')]){return analyticExtractedReport(_0xcc01('0x14'));}var _0x1de813=[];var _0x25de9a=0x0;if(_0x21ccf8[_0xcc01('0x15')]){if(_0x553085&&_0x553085[_0xcc01('0x16')]){var _0x2ff017=_[_0xcc01('0x17')](_0x553085[0x0][_0xcc01('0x13')]/_0x581672);var _0x4a134b=Number[_0xcc01('0x18')](_0x553085[0x0][_0xcc01('0x13')]/_0x581672)?_0x553085[0x0][_0xcc01('0x13')]%_0x581672:0x0;_0x2ff017[_0xcc01('0x19')](function(_0x1112f3){if(_0x1112f3>0x0){_0x25de9a+=_0x581672;}_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')]['query'](util[_0xcc01('0x9')](_0xcc01('0x1b'),QUERY,_0x581672,_0x25de9a),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]}));});if(_0x4a134b>0x0){_0x25de9a+=_0x581672;_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')][_0xcc01('0xe')](util[_0xcc01('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4a134b,_0x25de9a),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]}));}}}else{_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xcc01('0x12')]}));}var _0x5f4c45=path[_0xcc01('0x1c')](PATH);var _0x5924e6=path[_0xcc01('0x1d')](PATH,_0xcc01('0x1e'));var _0x262f65=_0x21ccf8[_0xcc01('0x15')]&&_0x1de813[_0xcc01('0x16')]>0x1;var _0x3bdb49=[];if(!fs[_0xcc01('0x1f')](path['join'](_0x5f4c45,_0x5924e6))&&_0x262f65){fs[_0xcc01('0x20')](path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6));}return BPromise[_0xcc01('0x22')](_0x1de813,function(_0x3f3949){_0x3bdb49['push'](_0x3f3949);})[_0xcc01('0xd')](function(){for(var _0x45c1b4=0x0;_0x45c1b4<_0x3bdb49[_0xcc01('0x16')];_0x45c1b4+=0x1){var _0x2767ba;var _0x5104a9=_0x3bdb49[_0x45c1b4];if(_0x262f65){_0x2767ba=path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6,util[_0xcc01('0x9')](_0xcc01('0x23'),_0x5924e6,_0x45c1b4,_0xcc01('0x24')));}else{_0x2767ba=path[_0xcc01('0x21')](_0x5f4c45,util[_0xcc01('0x9')]('%s.%s',_0x5924e6,_0xcc01('0x24')));}fs[_0xcc01('0x25')](_0x2767ba,csv(_0x5104a9));}})['then'](function(){if(_0x262f65){return new Promise(function(_0x3e7164){zipdir(path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6),{'saveTo':path['join'](_0x5f4c45,util[_0xcc01('0x9')](_0xcc01('0x26'),_0x5924e6,_0xcc01('0x27')))},function(_0x2216eb,_0x4020da){rimraf(path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6),function(){});_0x3e7164(_0xcc01('0x28'));});});}})[_0xcc01('0xd')](function(){logger[_0xcc01('0x29')](util[_0xcc01('0x9')](_0xcc01('0x2a'),EXTRACTED_REPORT_ID,_0xcc01('0xb')));return analyticExtractedReport(_0xcc01('0x2b'),_0x262f65?util[_0xcc01('0x9')](_0xcc01('0x26'),_0x5924e6,_0x262f65?_0xcc01('0x27'):'csv'):null);});})[_0xcc01('0x2c')](function(_0x5a4fc5){logger[_0xcc01('0x29')](util[_0xcc01('0x9')](_0xcc01('0x2d'),EXTRACTED_REPORT_ID,_0xcc01('0xb')),util[_0xcc01('0x2e')](_0x5a4fc5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcc01('0x2f'));})[_0xcc01('0x30')](function(){process[_0xcc01('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b110f40..2d38249 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 _0x9eff=['interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','value','fill','length','auto','body','keys','push','format','name','startDate','header','margin','toString','footer','Arial','black','Empty','Setting','find','split','then','splitSizePdf','range','num','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','sequelize','QueryTypes','dirname','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x9eff,0x109));var _0xf9ef=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x9eff[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xf9ef('0x0'));var fs=require('fs');var util=require(_0xf9ef('0x1'));var path=require(_0xf9ef('0x2'));var moment=require(_0xf9ef('0x3'));var htmlToPdfmake=require(_0xf9ef('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xf9ef('0x5'));var JSDOM=require(_0xf9ef('0x6'))[_0xf9ef('0x7')];var window=new JSDOM('')[_0xf9ef('0x8')];var BPromise=require(_0xf9ef('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf9ef('0xa')];var logger=require(_0xf9ef('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf9ef('0xc')][0x4];var NAME=process[_0xf9ef('0xc')][0x5];var FORMAT=_0xf9ef('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x94f3b4,_0x38bfd2){var _0x1e2c2e={'status':_0x94f3b4};var _0x55bc43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38bfd2){_0x1e2c2e['savename']=_0x38bfd2;}return db[_0xf9ef('0xe')][_0xf9ef('0xf')](_0x1e2c2e,_0x55bc43);}function getHeaders(_0x3b9690){return _[_0xf9ef('0x10')](_0x3b9690,function(_0x336b04){return{'text':_0x336b04,'style':'tableHeader'};});}function getRows(_0x163506,_0x30b4e0){return _['map'](_0x30b4e0,function(_0xba3340){return _(_0xba3340)[_0xf9ef('0x11')](_0x163506)[_0xf9ef('0x10')](function(_0x231be6){return _0x231be6?_['toString'](_0x231be6):'';})[_0xf9ef('0x12')]();});}function createTable(_0x22f9b4,_0x18aaa5){var _0x2aaa1f={'widths':_[_0xf9ef('0x13')](Array(_0x22f9b4[_0xf9ef('0x14')]),0x91),'heights':function(_0x19178f){return _0x19178f===0x0?_0xf9ef('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x47587c=getHeaders(_0x22f9b4);_0x2aaa1f[_0xf9ef('0x16')]['push'](_0x47587c);var _0x573a7e=getRows(_0x22f9b4,_0x18aaa5);_0x2aaa1f['body']=_0x2aaa1f[_0xf9ef('0x16')]['concat'](_0x573a7e);return _0x2aaa1f;}function createTables(_0x349380){var _0x14fa8e=[];var _0x4f167=_['chunk'](Object[_0xf9ef('0x17')](_0x349380[0x0]),0x5);_0x4f167['forEach'](function(_0x5b1d92){_0x14fa8e[_0xf9ef('0x18')](createTable(_0x5b1d92,_0x349380));});return _0x14fa8e;}function getPDFDocDefinition(_0xd58044){var _0x426467=util[_0xf9ef('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xf9ef('0x1a')],moment(EXTRACTED_REPORT[_0xf9ef('0x1b')])[_0xf9ef('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xf9ef('0x19')](FORMAT));var _0xa876e6=[];for(var _0x38b969=0x0;_0x38b969<_0xd58044['length'];_0x38b969++){var _0x4bb3e2=[];if(_0x38b969===0x0){_0x4bb3e2[_0xf9ef('0x18')]({'text':_0x426467,'style':_0xf9ef('0x1c')});}var _0xe58629={'table':_0xd58044[_0x38b969]};if(_0x38b969>0x0){_0xe58629['pageBreak']='before';_0xe58629[_0xf9ef('0x1d')]=[0x0,0x46,0x0,0x0];}_0x4bb3e2[_0xf9ef('0x18')](_0xe58629);_0xa876e6[_0xf9ef('0x18')](_0x4bb3e2);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xa876e6,'footer':function(_0x196387,_0x3eb4fa){return{'text':_0x196387[_0xf9ef('0x1e')]()+'\x20/\x20'+_0x3eb4fa,'style':_0xf9ef('0x1f')};},'defaultStyle':{'font':_0xf9ef('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf9ef('0x21')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2a7d6d){var _0x13024e=0x1388;var _0x373b5e;if(!_0x2a7d6d[0x0]['num']){return analyticExtractedReport(_0xf9ef('0x22'));}return db[_0xf9ef('0x23')][_0xf9ef('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf9ef('0x25'),'splitSizePdf']})[_0xf9ef('0x26')](function(_0x1312b1){if(_0x1312b1){_0x373b5e=_0x1312b1;_0x13024e=_0x373b5e[_0xf9ef('0x27')]||0x3e8;}})[_0xf9ef('0x26')](function(){var _0x29be45=[];var _0x16489a=0x0;if(_0x373b5e[_0xf9ef('0x25')]){if(_0x2a7d6d&&_0x2a7d6d[_0xf9ef('0x14')]){var _0x46a360=_[_0xf9ef('0x28')](_0x2a7d6d[0x0][_0xf9ef('0x29')]/_0x13024e);var _0x2eb76d=Number['isInteger'](_0x2a7d6d[0x0][_0xf9ef('0x29')]/_0x13024e)?_0x2a7d6d[0x0]['num']%_0x13024e:0x0;_0x46a360[_0xf9ef('0x2a')](function(_0x3b7799){if(_0x3b7799>0x0){_0x16489a+=_0x13024e;}_0x29be45['push'](dbH['sequelize'][_0xf9ef('0x2b')](util[_0xf9ef('0x19')](_0xf9ef('0x2c'),QUERY,_0x13024e,_0x16489a),{'type':dbH['sequelize']['QueryTypes'][_0xf9ef('0x2d')]}));});if(_0x2eb76d>0x0){_0x16489a+=_0x13024e;_0x29be45[_0xf9ef('0x18')](dbH[_0xf9ef('0x2e')][_0xf9ef('0x2b')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2eb76d,_0x16489a),{'type':dbH[_0xf9ef('0x2e')][_0xf9ef('0x2f')][_0xf9ef('0x2d')]}));}}}else{_0x29be45[_0xf9ef('0x18')](dbH[_0xf9ef('0x2e')]['query'](QUERY,{'type':dbH[_0xf9ef('0x2e')]['QueryTypes']['SELECT']}));}var _0x330b1e=path[_0xf9ef('0x30')](PATH);var _0x34845d=path['basename'](PATH,'.pdf');var _0xceef97=_0x373b5e[_0xf9ef('0x25')]&&_0x29be45['length']>0x1;var _0xaec92e=[];if(!fs[_0xf9ef('0x31')](path[_0xf9ef('0x32')](_0x330b1e,_0x34845d))&&_0xceef97){fs['mkdirSync'](path['join'](_0x330b1e,_0x34845d));}return BPromise[_0xf9ef('0x33')](_0x29be45,function(_0x3f5cbc){_0xaec92e[_0xf9ef('0x18')](_0x3f5cbc);})[_0xf9ef('0x26')](function(){var _0x3c22f4=[];for(var _0x2bacf8=0x0;_0x2bacf8<_0xaec92e[_0xf9ef('0x14')];_0x2bacf8+=0x1){var _0x1c32c0=_0xaec92e[_0x2bacf8];var _0x4d2d51=createTables(_[_0xf9ef('0x34')](_0x1c32c0));var _0x22bd0e;var _0x27b371=getPDFDocDefinition(_0x4d2d51);var _0x14cef5=getPDFPrinter();var _0x51faa3=_0x14cef5[_0xf9ef('0x35')](_0x27b371);if(_0xceef97){_0x22bd0e=path[_0xf9ef('0x32')](_0x330b1e,_0x34845d,util['format'](_0xf9ef('0x36'),_0x34845d,_0x2bacf8,_0xf9ef('0x37')));}else{_0x22bd0e=path[_0xf9ef('0x32')](_0x330b1e,util[_0xf9ef('0x19')](_0xf9ef('0x38'),_0x34845d,_0xf9ef('0x37')));}_0x3c22f4[_0xf9ef('0x18')](writePDFDocument(_0x51faa3,_0x22bd0e));}return Promise['all'](_0x3c22f4);})[_0xf9ef('0x26')](function(){if(_0xceef97){return new Promise(function(_0x18e9d3){zipdir(path[_0xf9ef('0x32')](_0x330b1e,_0x34845d),{'saveTo':path['join'](_0x330b1e,util['format'](_0xf9ef('0x38'),_0x34845d,_0xf9ef('0x39')))},function(){rimraf(path[_0xf9ef('0x32')](_0x330b1e,_0x34845d),function(){});_0x18e9d3(_0xf9ef('0x3a'));});});}})['then'](function(){if(!_0xceef97)return;rimraf(path['join'](_0x330b1e,_0x34845d),function(){});})[_0xf9ef('0x26')](function(){logger[_0xf9ef('0x3b')](util[_0xf9ef('0x19')](_0xf9ef('0x3c'),EXTRACTED_REPORT_ID,_0xf9ef('0x3d')));return analyticExtractedReport(_0xf9ef('0x3e'),_0xceef97?util['format'](_0xf9ef('0x38'),_0x34845d,_0xceef97?_0xf9ef('0x39'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf9ef('0x3b')](util[_0xf9ef('0x19')](_0xf9ef('0x3f'),EXTRACTED_REPORT_ID,_0xf9ef('0x3d')));return db[_0xf9ef('0xe')][_0xf9ef('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x79c2b8){EXTRACTED_REPORT=_0x79c2b8;return dbH[_0xf9ef('0x2e')][_0xf9ef('0x2b')](util[_0xf9ef('0x19')](_0xf9ef('0x41'),QUERY),{'type':dbH[_0xf9ef('0x2e')]['QueryTypes'][_0xf9ef('0x2d')]});})[_0xf9ef('0x26')](extractReport)[_0xf9ef('0x42')](function(_0x586556){logger[_0xf9ef('0x3b')](util[_0xf9ef('0x19')](_0xf9ef('0x43'),EXTRACTED_REPORT_ID,_0xf9ef('0x3d')),util[_0xf9ef('0x44')](_0x586556,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x27cc43=new PdfPrinter({'Arial':{'normal':__dirname+_0xf9ef('0x45'),'bold':__dirname+_0xf9ef('0x46'),'italics':__dirname+_0xf9ef('0x47'),'bolditalics':__dirname+_0xf9ef('0x48')}});return _0x27cc43;}function getPDFDocDefinitionFromHTML(_0x3959fc,_0x560d4a){var _0x411f63=util[_0xf9ef('0x19')](_0xf9ef('0x49'),_0x560d4a[_0xf9ef('0x4a')],_0x560d4a[_0xf9ef('0x4b')]);var _0xd9a0d1=moment()[_0xf9ef('0x19')](_0xf9ef('0x4c'))['toString']();var _0x18fe0c=htmlToPdfmake(_0x3959fc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x18fe0c],'defaultStyle':{'font':_0xf9ef('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf9ef('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf9ef('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf9ef('0x4d')}},'header':function(){return[{'text':_0xf9ef('0x4e'),'style':_0xf9ef('0x1c')}];},'footer':function(_0x9ce2a9,_0x5eaf27){return[{'text':util[_0xf9ef('0x19')](_0xf9ef('0x4f'),_0x411f63,_0x9ce2a9,_0x5eaf27,_0xd9a0d1),'style':'footer'}];}};}function writePDFDocument(_0x1c5c56,_0x2746d0){return new Promise(function(_0xb41def,_0x5969c1){var _0x3e70c2=_0x1c5c56['pipe'](fs[_0xf9ef('0x50')](_0x2746d0));_0x3e70c2['on'](_0xf9ef('0x51'),function(){_0xb41def('finish');});_0x3e70c2['on'](_0xf9ef('0x52'),function(_0x58eceb){_0x5969c1(_0x58eceb);});_0x1c5c56[_0xf9ef('0x53')]();});}exports[_0xf9ef('0x54')]=function(_0x512656,_0x4dab41){var _0x5c0bbb=getPDFPrinter();var _0x1f18c8=getPDFDocDefinitionFromHTML(_0x512656,_0x4dab41);var _0x41f309=_0x5c0bbb[_0xf9ef('0x35')](_0x1f18c8);return writePDFDocument(_0x41f309,_0x4dab41[_0xf9ef('0x2')])['catch'](function(_0x35e1f9){throw _0x35e1f9;});}; \ No newline at end of file +var _0x3b9a=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','util','path','moment','html-to-pdfmake','rimraf','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','toString','value','fill','length','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','split','splitSizePdf','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript'];(function(_0xa47593,_0x37b985){var _0x5cb558=function(_0x4c3fd0){while(--_0x4c3fd0){_0xa47593['push'](_0xa47593['shift']());}};_0x5cb558(++_0x37b985);}(_0x3b9a,0x161));var _0xa3b9=function(_0x2020da,_0x14f147){_0x2020da=_0x2020da-0x0;var _0xae3048=_0x3b9a[_0x2020da];return _0xae3048;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa3b9('0x0'));var path=require(_0xa3b9('0x1'));var moment=require(_0xa3b9('0x2'));var htmlToPdfmake=require(_0xa3b9('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xa3b9('0x4'));var JSDOM=require('jsdom')[_0xa3b9('0x5')];var window=new JSDOM('')[_0xa3b9('0x6')];var BPromise=require(_0xa3b9('0x7'));var db=require(_0xa3b9('0x8'))['db'];var dbH=require(_0xa3b9('0x8'))['dbH'];var logger=require('../../config/logger')(_0xa3b9('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xa3b9('0xa')][0x5];var FORMAT=_0xa3b9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x6f3570,_0x2a9d95){var _0x489aae={'status':_0x6f3570};var _0x34f959={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2a9d95){_0x489aae['savename']=_0x2a9d95;}return db[_0xa3b9('0xc')][_0xa3b9('0xd')](_0x489aae,_0x34f959);}function getHeaders(_0x8ed3f1){return _[_0xa3b9('0xe')](_0x8ed3f1,function(_0x5e4c68){return{'text':_0x5e4c68,'style':'tableHeader'};});}function getRows(_0x5733e0,_0x2479eb){return _[_0xa3b9('0xe')](_0x2479eb,function(_0x51b7ec){return _(_0x51b7ec)['pick'](_0x5733e0)[_0xa3b9('0xe')](function(_0x35c8b7){return _0x35c8b7?_[_0xa3b9('0xf')](_0x35c8b7):'';})[_0xa3b9('0x10')]();});}function createTable(_0x499f5c,_0x5b1168){var _0x5068fb={'widths':_[_0xa3b9('0x11')](Array(_0x499f5c[_0xa3b9('0x12')]),0x91),'heights':function(_0x311516){return _0x311516===0x0?_0xa3b9('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x375e72=getHeaders(_0x499f5c);_0x5068fb[_0xa3b9('0x14')][_0xa3b9('0x15')](_0x375e72);var _0x2e9425=getRows(_0x499f5c,_0x5b1168);_0x5068fb[_0xa3b9('0x14')]=_0x5068fb[_0xa3b9('0x14')][_0xa3b9('0x16')](_0x2e9425);return _0x5068fb;}function createTables(_0xd01078){var _0x4e872f=[];var _0x373e6b=_[_0xa3b9('0x17')](Object[_0xa3b9('0x18')](_0xd01078[0x0]),0x5);_0x373e6b['forEach'](function(_0x410afc){_0x4e872f[_0xa3b9('0x15')](createTable(_0x410afc,_0xd01078));});return _0x4e872f;}function getPDFDocDefinition(_0x403865){var _0x16d7ea=util[_0xa3b9('0x19')](_0xa3b9('0x1a'),NAME,EXTRACTED_REPORT[_0xa3b9('0x1b')],moment(EXTRACTED_REPORT[_0xa3b9('0x1c')])[_0xa3b9('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa3b9('0x19')](FORMAT));var _0x3b96bb=[];for(var _0x1985f9=0x0;_0x1985f9<_0x403865['length'];_0x1985f9++){var _0x1cb6c4=[];if(_0x1985f9===0x0){_0x1cb6c4[_0xa3b9('0x15')]({'text':_0x16d7ea,'style':_0xa3b9('0x1d')});}var _0x4c13db={'table':_0x403865[_0x1985f9]};if(_0x1985f9>0x0){_0x4c13db['pageBreak']=_0xa3b9('0x1e');_0x4c13db[_0xa3b9('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1cb6c4[_0xa3b9('0x15')](_0x4c13db);_0x3b96bb[_0xa3b9('0x15')](_0x1cb6c4);}return{'pageSize':'A4','pageOrientation':_0xa3b9('0x20'),'content':_0x3b96bb,'footer':function(_0x28b795,_0x3d8937){return{'text':_0x28b795[_0xa3b9('0xf')]()+_0xa3b9('0x21')+_0x3d8937,'style':_0xa3b9('0x22')};},'defaultStyle':{'font':_0xa3b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa3b9('0x24')},'footer':{'alignment':_0xa3b9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x35190e){var _0x5b1356=0x1388;var _0x5c9b4a;if(!_0x35190e[0x0][_0xa3b9('0x26')]){return analyticExtractedReport(_0xa3b9('0x27'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa3b9('0x28'),_0xa3b9('0x29')]})[_0xa3b9('0x2a')](function(_0xd4505f){if(_0xd4505f){_0x5c9b4a=_0xd4505f;_0x5b1356=_0x5c9b4a[_0xa3b9('0x29')]||0x3e8;}})[_0xa3b9('0x2a')](function(){var _0x527622=[];var _0x3e7450=0x0;if(_0x5c9b4a[_0xa3b9('0x28')]){if(_0x35190e&&_0x35190e[_0xa3b9('0x12')]){var _0x165ad7=_['range'](_0x35190e[0x0][_0xa3b9('0x26')]/_0x5b1356);var _0xb0a8b5=Number[_0xa3b9('0x2b')](_0x35190e[0x0][_0xa3b9('0x26')]/_0x5b1356)?_0x35190e[0x0][_0xa3b9('0x26')]%_0x5b1356:0x0;_0x165ad7[_0xa3b9('0x2c')](function(_0x53725b){if(_0x53725b>0x0){_0x3e7450+=_0x5b1356;}_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')][_0xa3b9('0x2e')](util[_0xa3b9('0x19')](_0xa3b9('0x2f'),QUERY,_0x5b1356,_0x3e7450),{'type':dbH[_0xa3b9('0x2d')][_0xa3b9('0x30')]['SELECT']}));});if(_0xb0a8b5>0x0){_0x3e7450+=_0x5b1356;_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')]['query'](util[_0xa3b9('0x19')](_0xa3b9('0x2f'),QUERY,_0xb0a8b5,_0x3e7450),{'type':dbH[_0xa3b9('0x2d')][_0xa3b9('0x30')][_0xa3b9('0x31')]}));}}}else{_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')]['query'](QUERY,{'type':dbH[_0xa3b9('0x2d')]['QueryTypes'][_0xa3b9('0x31')]}));}var _0x56a52a=path['dirname'](PATH);var _0x3ed231=path[_0xa3b9('0x32')](PATH,_0xa3b9('0x33'));var _0x4b6ea0=_0x5c9b4a[_0xa3b9('0x28')]&&_0x527622[_0xa3b9('0x12')]>0x1;var _0x4fd5ca=[];if(!fs[_0xa3b9('0x34')](path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231))&&_0x4b6ea0){fs[_0xa3b9('0x36')](path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231));}return BPromise[_0xa3b9('0x37')](_0x527622,function(_0x4404ea){_0x4fd5ca[_0xa3b9('0x15')](_0x4404ea);})[_0xa3b9('0x2a')](function(){var _0x34522a=[];for(var _0x37f9d0=0x0;_0x37f9d0<_0x4fd5ca[_0xa3b9('0x12')];_0x37f9d0+=0x1){var _0x25a13c=_0x4fd5ca[_0x37f9d0];var _0x4c5084=createTables(_[_0xa3b9('0x38')](_0x25a13c));var _0x3714de;var _0x431874=getPDFDocDefinition(_0x4c5084);var _0x494482=getPDFPrinter();var _0x222ae4=_0x494482[_0xa3b9('0x39')](_0x431874);if(_0x4b6ea0){_0x3714de=path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231,util[_0xa3b9('0x19')](_0xa3b9('0x3a'),_0x3ed231,_0x37f9d0,'pdf'));}else{_0x3714de=path[_0xa3b9('0x35')](_0x56a52a,util[_0xa3b9('0x19')](_0xa3b9('0x3b'),_0x3ed231,_0xa3b9('0x3c')));}_0x34522a[_0xa3b9('0x15')](writePDFDocument(_0x222ae4,_0x3714de));}return Promise[_0xa3b9('0x3d')](_0x34522a);})[_0xa3b9('0x2a')](function(){if(_0x4b6ea0){return new Promise(function(_0x53c265){zipdir(path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231),{'saveTo':path[_0xa3b9('0x35')](_0x56a52a,util[_0xa3b9('0x19')](_0xa3b9('0x3b'),_0x3ed231,'zip'))},function(){rimraf(path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231),function(){});_0x53c265(_0xa3b9('0x3e'));});});}})[_0xa3b9('0x2a')](function(){if(!_0x4b6ea0)return;rimraf(path['join'](_0x56a52a,_0x3ed231),function(){});})['then'](function(){logger[_0xa3b9('0x3f')](util[_0xa3b9('0x19')](_0xa3b9('0x40'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')));return analyticExtractedReport(_0xa3b9('0x42'),_0x4b6ea0?util['format'](_0xa3b9('0x3b'),_0x3ed231,_0x4b6ea0?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa3b9('0x3f')](util[_0xa3b9('0x19')](_0xa3b9('0x43'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')));return db[_0xa3b9('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa3b9('0x2a')](function(_0x392c98){EXTRACTED_REPORT=_0x392c98;return dbH['sequelize'][_0xa3b9('0x2e')](util['format'](_0xa3b9('0x44'),QUERY),{'type':dbH[_0xa3b9('0x2d')]['QueryTypes'][_0xa3b9('0x31')]});})[_0xa3b9('0x2a')](extractReport)[_0xa3b9('0x45')](function(_0x459fd5){logger['info'](util['format'](_0xa3b9('0x46'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')),util[_0xa3b9('0x47')](_0x459fd5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xa3b9('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x6e7ecb=new PdfPrinter({'Arial':{'normal':__dirname+_0xa3b9('0x49'),'bold':__dirname+_0xa3b9('0x4a'),'italics':__dirname+_0xa3b9('0x4b'),'bolditalics':__dirname+_0xa3b9('0x4c')}});return _0x6e7ecb;}function getPDFDocDefinitionFromHTML(_0x156168,_0x1b41e8){var _0xb25f78=util[_0xa3b9('0x19')](_0xa3b9('0x4d'),_0x1b41e8[_0xa3b9('0x4e')],_0x1b41e8[_0xa3b9('0x4f')]);var _0x1465a6=moment()[_0xa3b9('0x19')]('YYYY-MM-DD')[_0xa3b9('0xf')]();var _0x5aeefc=htmlToPdfmake(_0x156168,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5aeefc],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa3b9('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa3b9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa3b9('0x50')}},'header':function(){return[{'text':_0xa3b9('0x51'),'style':_0xa3b9('0x1d')}];},'footer':function(_0x533617,_0xfee4d6){return[{'text':util[_0xa3b9('0x19')](_0xa3b9('0x52'),_0xb25f78,_0x533617,_0xfee4d6,_0x1465a6),'style':_0xa3b9('0x22')}];}};}function writePDFDocument(_0x33a014,_0x1e8c9d){return new Promise(function(_0x33cd7c,_0x39e286){var _0x3f07da=_0x33a014[_0xa3b9('0x53')](fs[_0xa3b9('0x54')](_0x1e8c9d));_0x3f07da['on'](_0xa3b9('0x55'),function(){_0x33cd7c(_0xa3b9('0x55'));});_0x3f07da['on'](_0xa3b9('0x56'),function(_0x54f04c){_0x39e286(_0x54f04c);});_0x33a014['end']();});}exports['createPdfFromHTML']=function(_0x3d2dc0,_0x587c1d){var _0x24643c=getPDFPrinter();var _0x4edda2=getPDFDocDefinitionFromHTML(_0x3d2dc0,_0x587c1d);var _0x4f39fd=_0x24643c[_0xa3b9('0x39')](_0x4edda2);return writePDFDocument(_0x4f39fd,_0x587c1d[_0xa3b9('0x1')])[_0xa3b9('0x45')](function(_0x170c52){throw _0x170c52;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2b62568..13648b4 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 _0x1ef8=['each','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','finally','exit','util','path','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','split','length','existsSync','join','mkdirSync'];(function(_0x2170ff,_0x14fc7b){var _0x4f1403=function(_0x13abb2){while(--_0x13abb2){_0x2170ff['push'](_0x2170ff['shift']());}};_0x4f1403(++_0x14fc7b);}(_0x1ef8,0xa2));var _0x81ef=function(_0x1bf50f,_0x1611c0){_0x1bf50f=_0x1bf50f-0x0;var _0x1636a7=_0x1ef8[_0x1bf50f];return _0x1636a7;};'use strict';var util=require(_0x81ef('0x0'));var path=require(_0x81ef('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x81ef('0x2'));var BPromise=require(_0x81ef('0x3'));var zipdir=require(_0x81ef('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x81ef('0x5'))['dbH'];var logger=require(_0x81ef('0x6'))(_0x81ef('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x81ef('0x8')][0x2]);var QUERY=process[_0x81ef('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f7d7f,_0x2842ab){var _0x3f2f5={'status':_0x1f7d7f};var _0x351143={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2842ab){_0x3f2f5[_0x81ef('0x9')]=_0x2842ab;}return db['AnalyticExtractedReport'][_0x81ef('0xa')](_0x3f2f5,_0x351143);}function main(){var _0x3a7401=0x1388;var _0x321b55;logger[_0x81ef('0xb')](util[_0x81ef('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x81ef('0xd')));return db[_0x81ef('0xe')][_0x81ef('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x81ef('0x10')]})[_0x81ef('0x11')](function(_0x4ea45b){if(_0x4ea45b){_0x321b55=_0x4ea45b;_0x3a7401=_0x321b55['splitSizeXlsx']||0x1388;}})[_0x81ef('0x11')](function(){return dbH[_0x81ef('0x12')][_0x81ef('0x13')](util[_0x81ef('0xc')](_0x81ef('0x14'),QUERY),{'type':dbH[_0x81ef('0x12')][_0x81ef('0x15')][_0x81ef('0x16')]});})[_0x81ef('0x11')](function(_0x516a10){if(!_0x516a10[0x0][_0x81ef('0x17')]){return analyticExtractedReport(_0x81ef('0x18'));}var _0xb58e2d=[];var _0x4b8d0e=0x0;if(_0x321b55['split']){if(_0x516a10&&_0x516a10['length']){var _0x4cd852=_[_0x81ef('0x19')](_0x516a10[0x0]['num']/_0x3a7401);var _0x1cf329=Number[_0x81ef('0x1a')](_0x516a10[0x0][_0x81ef('0x17')]/_0x3a7401)?_0x516a10[0x0]['num']%_0x3a7401:0x0;_0x4cd852[_0x81ef('0x1b')](function(_0x395904){if(_0x395904>0x0){_0x4b8d0e+=_0x3a7401;}_0xb58e2d[_0x81ef('0x1c')](dbH[_0x81ef('0x12')][_0x81ef('0x13')](util[_0x81ef('0xc')](_0x81ef('0x1d'),QUERY,_0x3a7401,_0x4b8d0e),{'type':dbH[_0x81ef('0x12')][_0x81ef('0x15')][_0x81ef('0x16')]}));});if(_0x1cf329>0x0){_0x4b8d0e+=_0x3a7401;_0xb58e2d[_0x81ef('0x1c')](dbH[_0x81ef('0x12')][_0x81ef('0x13')](util[_0x81ef('0xc')](_0x81ef('0x1d'),QUERY,_0x1cf329,_0x4b8d0e),{'type':dbH['sequelize']['QueryTypes'][_0x81ef('0x16')]}));}}}else{_0xb58e2d['push'](dbH[_0x81ef('0x12')][_0x81ef('0x13')](QUERY,{'type':dbH[_0x81ef('0x12')][_0x81ef('0x15')]['SELECT']}));}var _0x21cef9=path[_0x81ef('0x1e')](PATH);var _0x227aba=path[_0x81ef('0x1f')](PATH,_0x81ef('0x20'));var _0x131b11=_0x321b55[_0x81ef('0x21')]&&_0xb58e2d[_0x81ef('0x22')]>0x1;var _0x40cd12=[];if(!fs[_0x81ef('0x23')](path[_0x81ef('0x24')](_0x21cef9,_0x227aba))&&_0x131b11){fs[_0x81ef('0x25')](path[_0x81ef('0x24')](_0x21cef9,_0x227aba));}return BPromise[_0x81ef('0x26')](_0xb58e2d,function(_0x2d03c4){_0x40cd12[_0x81ef('0x1c')](_0x2d03c4);})[_0x81ef('0x11')](function(){for(var _0x39f16a=0x0;_0x39f16a<_0x40cd12['length'];_0x39f16a+=0x1){var _0x169d6e;var _0x49d98b=_0x40cd12[_0x39f16a];if(_0x131b11){_0x169d6e=path[_0x81ef('0x24')](_0x21cef9,_0x227aba,util[_0x81ef('0xc')]('%s%d.%s',_0x227aba,_0x39f16a,'xlsx'));}else{_0x169d6e=path['join'](_0x21cef9,util[_0x81ef('0xc')](_0x81ef('0x27'),_0x227aba,_0x81ef('0x28')));}fs[_0x81ef('0x29')](_0x169d6e,json2xls(_0x49d98b),'binary');}})[_0x81ef('0x11')](function(){if(_0x131b11){return new Promise(function(_0x12a90c){zipdir(path[_0x81ef('0x24')](_0x21cef9,_0x227aba),{'saveTo':path[_0x81ef('0x24')](_0x21cef9,util[_0x81ef('0xc')](_0x81ef('0x27'),_0x227aba,_0x81ef('0x2a')))},function(_0x2c961b,_0x20769f){rimraf(path[_0x81ef('0x24')](_0x21cef9,_0x227aba),function(){});_0x12a90c(_0x81ef('0x2b'));});});}})[_0x81ef('0x11')](function(){logger[_0x81ef('0xb')](util[_0x81ef('0xc')](_0x81ef('0x2c'),EXTRACTED_REPORT_ID,_0x81ef('0xd')));return analyticExtractedReport(_0x81ef('0x2d'),_0x131b11?util['format']('%s.%s',_0x227aba,_0x131b11?_0x81ef('0x2a'):'xlsx'):null);});})[_0x81ef('0x2e')](function(_0x3676b4){logger[_0x81ef('0xb')](util[_0x81ef('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x81ef('0xd')),util[_0x81ef('0x2f')](_0x3676b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x81ef('0x30')](function(){process[_0x81ef('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdc91=['savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','range','isInteger','forEach','push','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip\x20finished','XLSX','zip','catch','inspect','Failed','finally','exit','util','path','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x49b4ba,_0x41763f){var _0x1768ac=function(_0x4132e8){while(--_0x4132e8){_0x49b4ba['push'](_0x49b4ba['shift']());}};_0x1768ac(++_0x41763f);}(_0xdc91,0x8b));var _0x1dc9=function(_0x209fd5,_0x2035a8){_0x209fd5=_0x209fd5-0x0;var _0x1f8f75=_0xdc91[_0x209fd5];return _0x1f8f75;};'use strict';var util=require(_0x1dc9('0x0'));var path=require(_0x1dc9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x1dc9('0x2'));var db=require(_0x1dc9('0x3'))['db'];var dbH=require(_0x1dc9('0x3'))[_0x1dc9('0x4')];var logger=require(_0x1dc9('0x5'))(_0x1dc9('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x1dc9('0x7')][0x2]);var QUERY=process[_0x1dc9('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c6e6c,_0x25a752){var _0x316995={'status':_0x2c6e6c};var _0x3d1772={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25a752){_0x316995[_0x1dc9('0x8')]=_0x25a752;}return db[_0x1dc9('0x9')][_0x1dc9('0xa')](_0x316995,_0x3d1772);}function main(){var _0x2e2e69=0x1388;var _0x32a428;logger[_0x1dc9('0xb')](util['format'](_0x1dc9('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1dc9('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1dc9('0xe'),_0x1dc9('0xf')]})[_0x1dc9('0x10')](function(_0x123684){if(_0x123684){_0x32a428=_0x123684;_0x2e2e69=_0x32a428['splitSizeXlsx']||0x1388;}})[_0x1dc9('0x10')](function(){return dbH[_0x1dc9('0x11')]['query'](util[_0x1dc9('0x12')](_0x1dc9('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1dc9('0x14')]});})[_0x1dc9('0x10')](function(_0x38ee59){if(!_0x38ee59[0x0][_0x1dc9('0x15')]){return analyticExtractedReport('Empty');}var _0x4e8c52=[];var _0x2566bb=0x0;if(_0x32a428[_0x1dc9('0xe')]){if(_0x38ee59&&_0x38ee59['length']){var _0x21cf4d=_[_0x1dc9('0x16')](_0x38ee59[0x0][_0x1dc9('0x15')]/_0x2e2e69);var _0x197bcd=Number[_0x1dc9('0x17')](_0x38ee59[0x0][_0x1dc9('0x15')]/_0x2e2e69)?_0x38ee59[0x0][_0x1dc9('0x15')]%_0x2e2e69:0x0;_0x21cf4d[_0x1dc9('0x18')](function(_0x1386c9){if(_0x1386c9>0x0){_0x2566bb+=_0x2e2e69;}_0x4e8c52[_0x1dc9('0x19')](dbH[_0x1dc9('0x11')][_0x1dc9('0x1a')](util[_0x1dc9('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e2e69,_0x2566bb),{'type':dbH['sequelize'][_0x1dc9('0x1b')]['SELECT']}));});if(_0x197bcd>0x0){_0x2566bb+=_0x2e2e69;_0x4e8c52['push'](dbH['sequelize'][_0x1dc9('0x1a')](util[_0x1dc9('0x12')](_0x1dc9('0x1c'),QUERY,_0x197bcd,_0x2566bb),{'type':dbH[_0x1dc9('0x11')][_0x1dc9('0x1b')][_0x1dc9('0x14')]}));}}}else{_0x4e8c52[_0x1dc9('0x19')](dbH['sequelize'][_0x1dc9('0x1a')](QUERY,{'type':dbH[_0x1dc9('0x11')][_0x1dc9('0x1b')]['SELECT']}));}var _0x39f3f7=path[_0x1dc9('0x1d')](PATH);var _0xec8330=path[_0x1dc9('0x1e')](PATH,_0x1dc9('0x1f'));var _0x476111=_0x32a428[_0x1dc9('0xe')]&&_0x4e8c52[_0x1dc9('0x20')]>0x1;var _0x3e70c3=[];if(!fs['existsSync'](path['join'](_0x39f3f7,_0xec8330))&&_0x476111){fs[_0x1dc9('0x21')](path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330));}return BPromise[_0x1dc9('0x23')](_0x4e8c52,function(_0x2e01df){_0x3e70c3[_0x1dc9('0x19')](_0x2e01df);})[_0x1dc9('0x10')](function(){for(var _0x10123d=0x0;_0x10123d<_0x3e70c3[_0x1dc9('0x20')];_0x10123d+=0x1){var _0x16b71d;var _0x5f1403=_0x3e70c3[_0x10123d];if(_0x476111){_0x16b71d=path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330,util[_0x1dc9('0x12')](_0x1dc9('0x24'),_0xec8330,_0x10123d,_0x1dc9('0x25')));}else{_0x16b71d=path[_0x1dc9('0x22')](_0x39f3f7,util[_0x1dc9('0x12')]('%s.%s',_0xec8330,'xlsx'));}fs[_0x1dc9('0x26')](_0x16b71d,json2xls(_0x5f1403),_0x1dc9('0x27'));}})['then'](function(){if(_0x476111){return new Promise(function(_0x14223b){zipdir(path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330),{'saveTo':path[_0x1dc9('0x22')](_0x39f3f7,util['format'](_0x1dc9('0x28'),_0xec8330,'zip'))},function(_0x1cc808,_0x5eece6){rimraf(path['join'](_0x39f3f7,_0xec8330),function(){});_0x14223b(_0x1dc9('0x29'));});});}})[_0x1dc9('0x10')](function(){logger[_0x1dc9('0xb')](util[_0x1dc9('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1dc9('0x2a')));return analyticExtractedReport('Completed',_0x476111?util[_0x1dc9('0x12')](_0x1dc9('0x28'),_0xec8330,_0x476111?_0x1dc9('0x2b'):_0x1dc9('0x25')):null);});})[_0x1dc9('0x2c')](function(_0x2d3b0b){logger[_0x1dc9('0xb')](util[_0x1dc9('0x12')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x1dc9('0x2d')](_0x2d3b0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1dc9('0x2e'));})[_0x1dc9('0x2f')](function(){process[_0x1dc9('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f9876f9..e2165cc 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 _0x308e=['CDR(type)=%s','context','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','priority','extensions','find','push','type','Set'];(function(_0x5e99ea,_0x31f114){var _0xc2ac9a=function(_0x4cf5bf){while(--_0x4cf5bf){_0x5e99ea['push'](_0x5e99ea['shift']());}};_0xc2ac9a(++_0x31f114);}(_0x308e,0xbc));var _0xe308=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x308e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe308('0x0'));var util=require(_0xe308('0x1'));function rewrite(_0x5955e3,_0x5f0a86){var _0x5edef3=this;return _0x5955e3[_0xe308('0x2')][_0xe308('0x3')]['findAll']({'raw':!![]})[_0xe308('0x4')](function(_0x11cd12){_0x5edef3[_0xe308('0x5')]=_0x11cd12;return _0x5955e3[_0xe308('0x2')][_0xe308('0x6')][_0xe308('0x7')]({'where':{'IntervalId':_0x5f0a86[_0xe308('0x8')]},'raw':!![]});})[_0xe308('0x4')](function(_0x1d8999){return _0x5955e3[_0xe308('0x2')][_0xe308('0x6')][_0xe308('0x7')]({'where':{'exten':{'$in':_[_0xe308('0x9')](_[_0xe308('0xa')](_0x1d8999,_0xe308('0xb')))}},'order':[{'raw':_0xe308('0xc')}],'raw':!![]});})['then'](function(_0x226b13){var _0x4bfacd=_['filter'](_0x226b13,{'priority':'1'});var _0x2bf752=_[_0xe308('0xd')](_0x226b13,{'isApp':0x1});var _0x2762f0=_['groupBy'](_0x2bf752,_0xe308('0xb'));var _0x6e8b40=[_0xe308('0xe'),_0xe308('0xf')];var _0x3d0e2d=[];var _0x4720a5=[];for(var _0x53bfcd in _0x2762f0){if(_0x2762f0['hasOwnProperty'](_0x53bfcd)){_0x5edef3[_0xe308('0x10')]=0x2;_0x5edef3[_0xe308('0x11')]=[];_0x5edef3['extension']=_[_0xe308('0x12')](_0x4bfacd,{'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')]});_0x5edef3['extensions'][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':util['format'](_0xe308('0x16'),_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')]),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3['priority']++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});if(_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')]===_0xe308('0x18')){_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0]['type'],'app':_0xe308('0x15'),'appdata':_0xe308('0x19')+_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId'],'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});}else if(_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')]===_0xe308('0x1a')){if(_0x5edef3[_0xe308('0x1b')]){_0x5edef3['extensions'][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':_0xe308('0x1c')+(_0x5edef3['extension'][_0xe308('0x1d')]?_0xe308('0x1e')+_0x5edef3[_0xe308('0x1b')][_0xe308('0x1d')]+'}':_0xe308('0x1f')),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0]['exten'],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});}_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':'Set','appdata':_0xe308('0x19')+_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId'],'context':_0x2762f0[_0x53bfcd][0x0]['context'],'exten':_0x2762f0[_0x53bfcd][0x0]['exten'],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});var _0x3e1e00=_0x5edef3[_0xe308('0x10')]++;_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3e1e00+0x2)+_0xe308('0x21')+(_0x3e1e00+0x1)+')','context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x3e1e00,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});if(_0x5edef3[_0xe308('0x1b')]){_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0]['type'],'app':_0xe308('0x15'),'appdata':_0x5edef3[_0xe308('0x1b')][_0xe308('0x1d')]?_0xe308('0x22')+_0x5edef3[_0xe308('0x1b')][_0xe308('0x1d')]+'}':_0xe308('0x23'),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});}_0x5edef3[_0xe308('0x11')]['push']({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':'outboundrouteid='+_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')],'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});if(_0x5edef3[_0xe308('0x1b')]&&_0x5edef3['extension'][_0xe308('0x24')](_0xe308('0x25'))&&_0x5edef3[_0xe308('0x1b')][_0xe308('0x25')]!==_0xe308('0x26')){_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5edef3['extension']['recordingFormat']||_0xe308('0x27'),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});}}_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':_0xe308('0x28'),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0]['exten'],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':_0xe308('0x29'),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3['priority']++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});_0x5edef3[_0xe308('0x11')][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':_0xe308('0x2a'),'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'exten':_0x2762f0[_0x53bfcd][0x0][_0xe308('0xb')],'priority':_0x5edef3[_0xe308('0x10')]++,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});for(var _0x232492=0x0,_0x503682=0x0;_0x232492<_0x2762f0[_0x53bfcd][_0xe308('0x2b')];_0x232492+=0x1,_0x503682=0x0){var _0xed62b1=_0x2762f0[_0x53bfcd][_0x232492];if(_0xed62b1[_0xe308('0x14')]){_0xed62b1[_0xe308('0x14')]=_0xed62b1[_0xe308('0x14')]['toLowerCase']();}var _0x478c39=[];var _0x514297=[];delete _0xed62b1['id'];delete _0xed62b1[_0xe308('0x2c')];delete _0xed62b1[_0xe308('0x2d')];var _0xa25a9e=_0xed62b1['interval']!==_0xe308('0x2e')?[_0xed62b1['interval']]:_0xed62b1[_0xe308('0x8')]?_[_0xe308('0xa')](_['filter'](_0x5edef3[_0xe308('0x5')],{'IntervalId':_0xed62b1[_0xe308('0x8')]}),'interval'):[];if(_0xed62b1['hasOwnProperty'](_0xe308('0x2f'))){if(_0xed62b1[_0xe308('0x2f')]&&_0xed62b1[_0xe308('0x2f')]!=='--'){_0x478c39['push']({'type':_0xed62b1['type'],'app':_0xe308('0x15'),'appdata':_0xe308('0x30')+_0xed62b1[_0xe308('0x2f')],'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1[_0xe308('0xb')],'priority':_0xa25a9e[_0xe308('0x2b')]+_0x5edef3['priority']+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});}}if(_0xed62b1['type']==='outbound'&&_0xed62b1[_0xe308('0x24')](_0xe308('0x31'))){if(_0xed62b1[_0xe308('0x31')]){_0x478c39[_0xe308('0x13')]({'type':_0xed62b1['type'],'app':_0xe308('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xed62b1['callerID']+')','context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1['exten'],'priority':_0xa25a9e[_0xe308('0x2b')]+_0x5edef3[_0xe308('0x10')]+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});}else{_0x478c39[_0xe308('0x13')]({'type':_0xed62b1[_0xe308('0x14')],'app':'ExecIf','appdata':_0xe308('0x33'),'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1[_0xe308('0xb')],'priority':_0xa25a9e['length']+_0x5edef3['priority']+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});}}if(_0xed62b1['hasOwnProperty'](_0xe308('0x34'))){if(_0x6e8b40[_0xe308('0x35')](_0xed62b1[_0xe308('0x36')][_0xe308('0x37')]())>=0x0&&_0xed62b1[_0xe308('0x38')]!==_0xe308('0x39')){if(_0xed62b1[_0xe308('0x34')]){_0x478c39[_0xe308('0x13')]({'type':_0xed62b1['type'],'app':_0xe308('0x32'),'appdata':_0xe308('0x3a'),'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1[_0xe308('0xb')],'priority':_0xa25a9e['length']+_0x5edef3['priority']+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});_0x478c39['push']({'type':_0xed62b1['type'],'app':_0xe308('0x15'),'appdata':_0xe308('0x3b'),'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1['exten'],'priority':_0xa25a9e['length']+_0x5edef3[_0xe308('0x10')]+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});}else{_0x478c39['push']({'type':_0xed62b1[_0xe308('0x14')],'app':'ExecIf','appdata':_0xe308('0x3c'),'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1['exten'],'priority':_0xa25a9e[_0xe308('0x2b')]+_0x5edef3[_0xe308('0x10')]+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});_0x478c39[_0xe308('0x13')]({'type':_0xed62b1[_0xe308('0x14')],'app':_0xe308('0x15'),'appdata':_0xe308('0x3d'),'context':_0xed62b1[_0xe308('0x17')],'exten':_0xed62b1['exten'],'priority':_0xa25a9e[_0xe308('0x2b')]+_0x5edef3[_0xe308('0x10')]+_0x503682++,'VoiceExtensionId':_0xed62b1[_0xe308('0x20')]});}}}for(var _0xf8af09=0x0;_0xf8af09<_0xa25a9e[_0xe308('0x2b')];_0xf8af09+=0x1){var _0x18ccc3=_0x5edef3[_0xe308('0x10')]+_0xa25a9e[_0xe308('0x2b')];var _0x3df1b8=_0xf8af09===_0xa25a9e[_0xe308('0x2b')]-0x1?_0x5edef3['priority']+_0x478c39[_0xe308('0x2b')]+_0x514297[_0xe308('0x2b')]+0x2:_0x5edef3[_0xe308('0x10')]+_0xf8af09+0x1;_0x478c39['splice'](_0xf8af09,0x0,{'type':_0xed62b1[_0xe308('0x14')],'app':'GotoIfTime','appdata':_0xa25a9e[_0xf8af09]+'?'+_0xed62b1[_0xe308('0x17')]+_0xe308('0x3e')+_0x18ccc3+':'+_0xed62b1['context']+',${EXTEN},'+_0x3df1b8,'exten':_0xed62b1[_0xe308('0xb')],'context':_0xed62b1[_0xe308('0x17')],'priority':_0x5edef3[_0xe308('0x10')]+_0xf8af09,'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x20')]});}_0xed62b1[_0xe308('0x10')]=_0x478c39['length']?_[_0xe308('0x3f')](_0x478c39)[_0xe308('0x10')]+0x1:_0x5edef3[_0xe308('0x10')];_0x5edef3[_0xe308('0x10')]=(_0x514297[_0xe308('0x2b')]?_[_0xe308('0x3f')](_0x514297)[_0xe308('0x10')]:_0xed62b1[_0xe308('0x10')])+0x1;_0x5edef3[_0xe308('0x11')]=_[_0xe308('0x40')](_0x5edef3[_0xe308('0x11')],_0x478c39,[_0xed62b1],_0x514297);}_0x5edef3['extensions'][_0xe308('0x13')]({'type':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x14')],'app':'Hangup','exten':_0x2762f0[_0x53bfcd][0x0]['exten'],'context':_0x2762f0[_0x53bfcd][0x0][_0xe308('0x17')],'priority':_0x5edef3['priority'],'VoiceExtensionId':_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']});_0x3d0e2d[_0xe308('0x13')](_0x2762f0[_0x53bfcd][0x0]['VoiceExtensionId']);_0x4720a5=_[_0xe308('0x40')](_0x4720a5,_0x5edef3[_0xe308('0x11')]);}}return _0x5955e3[_0xe308('0x41')](function(_0x13f992){return _0x5955e3[_0xe308('0x2')][_0xe308('0x6')][_0xe308('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3d0e2d}},'transaction':_0x13f992})[_0xe308('0x4')](function(_0x36951f){return _0x5955e3[_0xe308('0x2')][_0xe308('0x6')]['bulkCreate'](_['sortBy'](_0x4720a5,_0xe308('0x10')),{'transaction':_0x13f992});});});})[_0xe308('0x43')](function(_0x18500a){console[_0xe308('0x44')](_0x18500a);});}exports[_0xe308('0x45')]=rewrite; \ No newline at end of file +var _0xf846=['groupBy','queue','extensions','extension','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','answer','indexOf','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x53a8d3,_0x1a0799){var _0x15e434=function(_0x21f7ac){while(--_0x21f7ac){_0x53a8d3['push'](_0x53a8d3['shift']());}};_0x15e434(++_0x1a0799);}(_0xf846,0x86));var _0x6f84=function(_0x3a444a,_0x2a6ab5){_0x3a444a=_0x3a444a-0x0;var _0x5bde40=_0xf846[_0x3a444a];return _0x5bde40;};'use strict';var _=require(_0x6f84('0x0'));var util=require('util');function rewrite(_0x45489c,_0x1dd4b5){var _0x451d4a=this;return _0x45489c[_0x6f84('0x1')][_0x6f84('0x2')]['findAll']({'raw':!![]})[_0x6f84('0x3')](function(_0x33fc12){_0x451d4a['intervals']=_0x33fc12;return _0x45489c['models'][_0x6f84('0x4')][_0x6f84('0x5')]({'where':{'IntervalId':_0x1dd4b5[_0x6f84('0x6')]},'raw':!![]});})[_0x6f84('0x3')](function(_0x135d51){return _0x45489c[_0x6f84('0x1')][_0x6f84('0x4')][_0x6f84('0x5')]({'where':{'exten':{'$in':_[_0x6f84('0x7')](_[_0x6f84('0x8')](_0x135d51,_0x6f84('0x9')))}},'order':[{'raw':_0x6f84('0xa')}],'raw':!![]});})[_0x6f84('0x3')](function(_0x5ba965){var _0x297815=_[_0x6f84('0xb')](_0x5ba965,{'priority':'1'});var _0x21d3f0=_[_0x6f84('0xb')](_0x5ba965,{'isApp':0x1});var _0x5a0a3b=_[_0x6f84('0xc')](_0x21d3f0,_0x6f84('0x9'));var _0x36db45=[_0x6f84('0xd'),'playback'];var _0x322c28=[];var _0x1d0eb3=[];for(var _0x53a1ef in _0x5a0a3b){if(_0x5a0a3b['hasOwnProperty'](_0x53a1ef)){_0x451d4a['priority']=0x2;_0x451d4a[_0x6f84('0xe')]=[];_0x451d4a[_0x6f84('0xf')]=_['find'](_0x297815,{'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')]});_0x451d4a['extensions'][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':util[_0x6f84('0x13')]('CDR(type)=%s',_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a['priority']++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]===_0x6f84('0x16')){_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x17')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}else if(_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]===_0x6f84('0x19')){if(_0x451d4a['extension']){_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x1a')+(_0x451d4a['extension'][_0x6f84('0x1b')]?_0x6f84('0x1c')+_0x451d4a[_0x6f84('0xf')][_0x6f84('0x1b')]+'}':_0x6f84('0x1d')),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x17')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});var _0x23439e=_0x451d4a[_0x6f84('0x18')]++;_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x1e'),'appdata':_0x6f84('0x1f')+(_0x23439e+0x2)+_0x6f84('0x20')+(_0x23439e+0x1)+')','context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x23439e,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x451d4a[_0x6f84('0xf')]){_0x451d4a['extensions'][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':'Set','appdata':_0x451d4a[_0x6f84('0xf')]['cutdigits']?_0x6f84('0x21')+_0x451d4a['extension'][_0x6f84('0x1b')]+'}':_0x6f84('0x22'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x23')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x451d4a[_0x6f84('0xf')]&&_0x451d4a[_0x6f84('0xf')][_0x6f84('0x24')](_0x6f84('0x25'))&&_0x451d4a[_0x6f84('0xf')][_0x6f84('0x25')]!==_0x6f84('0x26')){_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x27'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x28')+_0x451d4a[_0x6f84('0xf')][_0x6f84('0x25')]||_0x6f84('0x29'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x2a'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':'Set','appdata':_0x6f84('0x2b'),'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});for(var _0x1cfc08=0x0,_0x5bf0c3=0x0;_0x1cfc08<_0x5a0a3b[_0x53a1ef]['length'];_0x1cfc08+=0x1,_0x5bf0c3=0x0){var _0x2220ed=_0x5a0a3b[_0x53a1ef][_0x1cfc08];if(_0x2220ed[_0x6f84('0x11')]){_0x2220ed[_0x6f84('0x11')]=_0x2220ed['type']['toLowerCase']();}var _0x2569e5=[];var _0x5087e3=[];delete _0x2220ed['id'];delete _0x2220ed['createdAt'];delete _0x2220ed[_0x6f84('0x2c')];var _0x4c5b7e=_0x2220ed[_0x6f84('0x2d')]!==_0x6f84('0x2e')?[_0x2220ed[_0x6f84('0x2d')]]:_0x2220ed[_0x6f84('0x6')]?_[_0x6f84('0x8')](_['filter'](_0x451d4a[_0x6f84('0x2f')],{'IntervalId':_0x2220ed[_0x6f84('0x6')]}),'interval'):[];if(_0x2220ed['hasOwnProperty'](_0x6f84('0x30'))){if(_0x2220ed[_0x6f84('0x30')]&&_0x2220ed['tag']!=='--'){_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':'Set','appdata':_0x6f84('0x31')+_0x2220ed[_0x6f84('0x30')],'context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}if(_0x2220ed[_0x6f84('0x11')]===_0x6f84('0x19')&&_0x2220ed['hasOwnProperty']('callerID')){if(_0x2220ed['callerID']){_0x2569e5['push']({'type':_0x2220ed[_0x6f84('0x11')],'app':'ExecIf','appdata':_0x6f84('0x33')+_0x2220ed[_0x6f84('0x34')]+')','context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}else{_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed['type'],'app':_0x6f84('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}if(_0x2220ed['hasOwnProperty'](_0x6f84('0x35'))){if(_0x36db45[_0x6f84('0x36')](_0x2220ed[_0x6f84('0x37')][_0x6f84('0x38')]())>=0x0&&_0x2220ed['appType']!==_0x6f84('0x39')){if(_0x2220ed[_0x6f84('0x35')]){_0x2569e5['push']({'type':_0x2220ed['type'],'app':_0x6f84('0x1e'),'appdata':_0x6f84('0x3a'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x3b'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed['VoiceExtensionId']});}else{_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':_0x6f84('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a['priority']+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed['VoiceExtensionId']});_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x3c'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e['length']+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}}for(var _0x10e197=0x0;_0x10e197<_0x4c5b7e[_0x6f84('0x32')];_0x10e197+=0x1){var _0x5de999=_0x451d4a[_0x6f84('0x18')]+_0x4c5b7e[_0x6f84('0x32')];var _0x5105d8=_0x10e197===_0x4c5b7e[_0x6f84('0x32')]-0x1?_0x451d4a['priority']+_0x2569e5[_0x6f84('0x32')]+_0x5087e3[_0x6f84('0x32')]+0x2:_0x451d4a['priority']+_0x10e197+0x1;_0x2569e5[_0x6f84('0x3d')](_0x10e197,0x0,{'type':_0x2220ed['type'],'app':_0x6f84('0x3e'),'appdata':_0x4c5b7e[_0x10e197]+'?'+_0x2220ed[_0x6f84('0x14')]+_0x6f84('0x3f')+_0x5de999+':'+_0x2220ed[_0x6f84('0x14')]+_0x6f84('0x3f')+_0x5105d8,'exten':_0x2220ed[_0x6f84('0x9')],'context':_0x2220ed[_0x6f84('0x14')],'priority':_0x451d4a['priority']+_0x10e197,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});}_0x2220ed[_0x6f84('0x18')]=_0x2569e5['length']?_[_0x6f84('0x40')](_0x2569e5)[_0x6f84('0x18')]+0x1:_0x451d4a['priority'];_0x451d4a[_0x6f84('0x18')]=(_0x5087e3[_0x6f84('0x32')]?_['last'](_0x5087e3)['priority']:_0x2220ed[_0x6f84('0x18')])+0x1;_0x451d4a[_0x6f84('0xe')]=_['concat'](_0x451d4a[_0x6f84('0xe')],_0x2569e5,[_0x2220ed],_0x5087e3);}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x41'),'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'priority':_0x451d4a[_0x6f84('0x18')],'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});_0x322c28[_0x6f84('0x10')](_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]);_0x1d0eb3=_[_0x6f84('0x42')](_0x1d0eb3,_0x451d4a[_0x6f84('0xe')]);}}return _0x45489c[_0x6f84('0x43')](function(_0xc09179){return _0x45489c[_0x6f84('0x1')][_0x6f84('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x322c28}},'transaction':_0xc09179})[_0x6f84('0x3')](function(_0x462f53){return _0x45489c['models'][_0x6f84('0x4')][_0x6f84('0x44')](_[_0x6f84('0x45')](_0x1d0eb3,_0x6f84('0x18')),{'transaction':_0xc09179});});});})[_0x6f84('0x46')](function(_0x1e6389){console[_0x6f84('0x47')](_0x1e6389);});}exports[_0x6f84('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5b49b45..6cc5d4d 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 _0x2d4c=['localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','CmList','Lists','then','dialCheckDuplicateType','always','sequelize','query','catch','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign','CampaignId','findAll','get','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','unlinkSync','info','createReadStream','parse','duplicate','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults'];(function(_0x231606,_0x37408b){var _0x238ad4=function(_0x2bac59){while(--_0x2bac59){_0x231606['push'](_0x231606['shift']());}};_0x238ad4(++_0x37408b);}(_0x2d4c,0x1a1));var _0xc2d4=function(_0x4a2e49,_0xbf34fb){_0x4a2e49=_0x4a2e49-0x0;var _0x8472b1=_0x2d4c[_0x4a2e49];return _0x8472b1;};'use strict';var BPromise=require(_0xc2d4('0x0'));var util=require(_0xc2d4('0x1'));var _=require(_0xc2d4('0x2'));var fs=require('fs');var squel=require(_0xc2d4('0x3'));var Papa=require(_0xc2d4('0x4'));var Redis=require('ioredis');var db=require(_0xc2d4('0x5'))['db'];var config=require(_0xc2d4('0x6'));var logger=require(_0xc2d4('0x7'))(_0xc2d4('0x8'));config[_0xc2d4('0x9')]=_[_0xc2d4('0xa')](config[_0xc2d4('0x9')],{'host':_0xc2d4('0xb'),'port':0x18eb});var socket=require(_0xc2d4('0xc'))(new Redis(config[_0xc2d4('0x9')]));require(_0xc2d4('0xd'))[_0xc2d4('0xe')](socket);try{if(!process[_0xc2d4('0xf')][0x2]||process[_0xc2d4('0xf')][0x2]===_0xc2d4('0x10')||process[_0xc2d4('0xf')][0x2]===_0xc2d4('0x11')){throw new Error(_0xc2d4('0x12'));}var FILEPATH=process[_0xc2d4('0xf')][0x2];if(!process[_0xc2d4('0xf')][0x3]||process[_0xc2d4('0xf')][0x3]===_0xc2d4('0x10')||process[_0xc2d4('0xf')][0x3]===_0xc2d4('0x11')||!process[_0xc2d4('0xf')][0x4]||process[_0xc2d4('0xf')][0x4]==='undefined'||process[_0xc2d4('0xf')][0x4]===_0xc2d4('0x11')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xc2d4('0x13')](process[_0xc2d4('0xf')][0x3][_0xc2d4('0x14')](','),process['argv'][0x4][_0xc2d4('0x14')](','));if(!process['argv'][0x5]||process[_0xc2d4('0xf')][0x5]===_0xc2d4('0x10')||process['argv'][0x5]===_0xc2d4('0x11')){throw new Error(_0xc2d4('0x15'));}var LISTID=process[_0xc2d4('0xf')][0x5];var COMPANYID=process[_0xc2d4('0xf')][0x6]&&process[_0xc2d4('0xf')][0x6]!==_0xc2d4('0x10')&&process[_0xc2d4('0xf')][0x6]!==_0xc2d4('0x11')?process[_0xc2d4('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xc2d4('0x10')&&process[_0xc2d4('0xf')][0x7]!==_0xc2d4('0x11')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xc2d4('0xf')][0x8]===_0xc2d4('0x10')||process[_0xc2d4('0xf')][0x8]==='null'){throw new Error(_0xc2d4('0x16'));}var SOCKET_TIMESTAMP=process[_0xc2d4('0xf')][0x8];}catch(_0x2092d5){logger[_0xc2d4('0x17')](_0x2092d5);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(_0x376c5f,_0x5a8a15,_0x231c9b,_0x4ae991){var _0x58a95a={'message':_0x5a8a15};_0x58a95a[_0x376c5f]=!![];if(_0x231c9b){_0x58a95a['contact']=_0x231c9b;}if(_0x4ae991){_0x58a95a['index']=_0x4ae991;}return _0x58a95a;}function isEmail(_0x290b1b){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x290b1b);}function checkRow(_0x1cd849,_0x362e6e,_0x1fd8af){return new BPromise(function(_0x26210e,_0x3ae901){if(_[_0xc2d4('0x18')](_0x1cd849)){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),_0xc2d4('0x19'),null,_0x1fd8af));}if(_0x1cd849[_0xc2d4('0x1a')]&&_0x1cd849[_0xc2d4('0x1a')][_0xc2d4('0x1b')]){var _0x45b2fe=_[_0xc2d4('0x1c')](_0x1cd849[_0xc2d4('0x1a')],_0xc2d4('0x1d'))[_0xc2d4('0x1e')](';');return _0x3ae901(handleCheckRowError('error',_0x45b2fe,null,_0x1fd8af));}var _0x48fc93={};for(var _0x52f921 in FIELDS){if(FIELDS['hasOwnProperty'](_0x52f921)&&FIELDS[_0x52f921]){_0x48fc93[_0x52f921]=_0x1cd849[_0xc2d4('0x1f')][0x0][FIELDS[_0x52f921]]||_0x1cd849[_0xc2d4('0x1f')][0x0]['\ufeff'+FIELDS[_0x52f921]];}}if(!_0x48fc93['firstName']){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),'firstName\x20not\x20specified!',null,_0x1fd8af));}if(!_0x48fc93['phone']){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),_0xc2d4('0x20'),null,_0x1fd8af));}if(_0x48fc93[_0xc2d4('0x21')]){var _0x38f9d1=moment(_0x48fc93[_0xc2d4('0x21')],'YYYY-MM-DD');if(!_0x38f9d1[_0xc2d4('0x22')]()){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),_0xc2d4('0x23'),null,_0x1fd8af));}}if(_0x48fc93[_0xc2d4('0x24')]){if(!isEmail(_0x48fc93[_0xc2d4('0x24')])){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x1fd8af));}}_0x48fc93['ListId']=LISTID;_0x48fc93[_0xc2d4('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc2d4('0x1b')]&&_0x362e6e){var _0x555386={};for(var _0x2f7798=0x0,_0x4684fb=DUPLICATES[_0xc2d4('0x1b')];_0x2f7798<_0x4684fb;_0x2f7798+=0x1){_0x555386[DUPLICATES[_0x2f7798]]=_0x48fc93[DUPLICATES[_0x2f7798]];}var _0x1ead96=_[_0xc2d4('0x26')](_0x362e6e,_0x555386);if(_0x1ead96){return _0x3ae901(handleCheckRowError('duplicate',_0xc2d4('0x27'),_0x1ead96,_0x1fd8af));}}return db[_0xc2d4('0x28')][_0xc2d4('0x29')](_0x48fc93,{'raw':!![],'hooks':![],'fields':_[_0xc2d4('0x2a')](_0x48fc93)})['then'](function(_0x5f0e9a){if(DUPLICATES&&DUPLICATES['length']&&_0x362e6e){_0x362e6e[_0xc2d4('0x2b')](_[_0xc2d4('0x2c')](_0x48fc93,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f0e9a['id'];return _0x26210e();})['catch'](function(_0x582c2f){return _0x3ae901(handleCheckRowError(_0xc2d4('0x17'),_0xc2d4('0x2d')+(_0x582c2f[_0xc2d4('0x1d')]||JSON[_0xc2d4('0x2e')](_0x582c2f)),null,_0x1fd8af));});});}function checkHopper(){function _0x4bc500(){return function(_0x380f5c){logger[_0xc2d4('0x17')](_0xc2d4('0x2f'),_0xc2d4('0x30'),util[_0xc2d4('0x31')](_0x380f5c,{'showHidden':![],'depth':null}));};}var _0x700e6a=function(_0x45b937,_0x1d7b7f){var _0x28815e=squel[_0xc2d4('0x32')]()[_0xc2d4('0x33')](_0xc2d4('0x34'))[_0xc2d4('0x35')]([_0xc2d4('0x36'),_0xc2d4('0x37'),_0xc2d4('0x38'),_0xc2d4('0x39'),_0x1d7b7f,_0xc2d4('0x3a'),_0xc2d4('0x3b')],squel['select']()[_0xc2d4('0x3c')](_0xc2d4('0x36'),'phone')[_0xc2d4('0x3c')]('NOW()',_0xc2d4('0x37'))[_0xc2d4('0x3c')]('id',_0xc2d4('0x38'))[_0xc2d4('0x3c')](LISTID['toString'](),_0xc2d4('0x39'))[_0xc2d4('0x3c')](_0x45b937['id'][_0xc2d4('0x3d')](),_0x1d7b7f)[_0xc2d4('0x3c')](_0xc2d4('0x3e'),'createdAt')[_0xc2d4('0x3c')](_0xc2d4('0x3e'),'updatedAt')[_0xc2d4('0x3f')]('cm_contacts')[_0xc2d4('0x40')](_0xc2d4('0x41'))[_0xc2d4('0x40')](_0xc2d4('0x42'),LISTID[_0xc2d4('0x3d')]())[_0xc2d4('0x40')](_0xc2d4('0x43'))[_0xc2d4('0x40')](_0xc2d4('0x44'),squel[_0xc2d4('0x45')]()[_0xc2d4('0x3c')](_0xc2d4('0x36'))['from']('cm_hopper')[_0xc2d4('0x40')](_0x1d7b7f+'\x20=\x20?',_0x45b937['id'][_0xc2d4('0x3d')]())))[_0xc2d4('0x3d')]();return _0x28815e;};var _0x175a33=function(_0x1f9d4f,_0x26b624){var _0xe360f2=squel[_0xc2d4('0x32')]()[_0xc2d4('0x33')](_0xc2d4('0x34'))[_0xc2d4('0x35')]([_0xc2d4('0x36'),'scheduledAt',_0xc2d4('0x38'),'ListId',_0x26b624,_0xc2d4('0x3a'),_0xc2d4('0x3b')],squel['select']()[_0xc2d4('0x3c')]('phone','phone')[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x37'))[_0xc2d4('0x3c')]('id',_0xc2d4('0x38'))[_0xc2d4('0x3c')](LISTID[_0xc2d4('0x3d')](),_0xc2d4('0x39'))[_0xc2d4('0x3c')](_0x1f9d4f['id'][_0xc2d4('0x3d')](),_0x26b624)[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x3a'))[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x3b'))[_0xc2d4('0x3f')](_0xc2d4('0x46'))[_0xc2d4('0x40')]('deletedAt\x20IS\x20NULL')[_0xc2d4('0x40')](_0xc2d4('0x42'),LISTID['toString']())[_0xc2d4('0x40')](_0xc2d4('0x47'),squel[_0xc2d4('0x48')](hopperContacts))[_0xc2d4('0x40')](_0xc2d4('0x43'))[_0xc2d4('0x40')](_0xc2d4('0x44'),squel[_0xc2d4('0x45')]()[_0xc2d4('0x3c')](_0xc2d4('0x49'))['from'](_0xc2d4('0x4a'))[_0xc2d4('0x40')](_0x26b624+'\x20=\x20?',_0x1f9d4f['id'][_0xc2d4('0x3d')]()))[_0xc2d4('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc2d4('0x45')]()['field'](_0xc2d4('0x36'))[_0xc2d4('0x3f')](_0xc2d4('0x34'))[_0xc2d4('0x40')](_0x26b624+_0xc2d4('0x4b'),_0x1f9d4f['id'][_0xc2d4('0x3d')]())))[_0xc2d4('0x3d')]();return _0xe360f2;};function _0x2be112(_0x160d32,_0x1eafc9){var _0x3811f5=squel[_0xc2d4('0x32')]()['into']('cm_hopper')[_0xc2d4('0x35')]([_0xc2d4('0x36'),_0xc2d4('0x37'),_0xc2d4('0x38'),_0xc2d4('0x39'),_0x1eafc9,_0xc2d4('0x3a'),_0xc2d4('0x3b')],squel[_0xc2d4('0x45')]()[_0xc2d4('0x3c')]('phone',_0xc2d4('0x36'))[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x37'))['field']('id',_0xc2d4('0x38'))[_0xc2d4('0x3c')](LISTID[_0xc2d4('0x3d')](),'ListId')['field'](_0x160d32['id']['toString'](),_0x1eafc9)['field'](_0xc2d4('0x3e'),'createdAt')[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x3b'))['from'](_0xc2d4('0x46'))[_0xc2d4('0x40')](_0xc2d4('0x41'))[_0xc2d4('0x40')](_0xc2d4('0x42'),LISTID['toString']())[_0xc2d4('0x40')](_0xc2d4('0x47'),squel[_0xc2d4('0x48')](hopperContacts))[_0xc2d4('0x40')](_0xc2d4('0x43')))[_0xc2d4('0x3d')]();return _0x3811f5;}function _0x7be6f9(_0x4810b4,_0x5cfe3e){var _0x111e75=squel['insert']()[_0xc2d4('0x33')](_0xc2d4('0x4c'))[_0xc2d4('0x35')]([_0xc2d4('0x36'),'ContactId',_0xc2d4('0x39'),_0x5cfe3e,'createdAt',_0xc2d4('0x3b')],squel[_0xc2d4('0x45')]()[_0xc2d4('0x3c')](_0xc2d4('0x36'),_0xc2d4('0x36'))[_0xc2d4('0x3c')]('id','ContactId')[_0xc2d4('0x3c')](LISTID[_0xc2d4('0x3d')](),_0xc2d4('0x39'))['field'](_0x4810b4['id'][_0xc2d4('0x3d')](),_0x5cfe3e)[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x3a'))[_0xc2d4('0x3c')](_0xc2d4('0x3e'),_0xc2d4('0x3b'))[_0xc2d4('0x3f')](_0xc2d4('0x46'))[_0xc2d4('0x40')](_0xc2d4('0x41'))[_0xc2d4('0x40')](_0xc2d4('0x42'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0xc2d4('0x48')](hopperContacts))['where'](_0xc2d4('0x43')))['toString']();return _0x111e75;}return db[_0xc2d4('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc2d4('0x4e')],'as':_0xc2d4('0x4f'),'where':{'id':LISTID}}]})[_0xc2d4('0x50')](function(_0x25e165){var _0x44c504=[];if(_0x25e165){var _0x280b18;for(var _0x19ba2a=0x0,_0x3838e1;_0x19ba2a<_0x25e165[_0xc2d4('0x1b')];_0x19ba2a+=0x1){_0x3838e1=_0x25e165[_0x19ba2a]['get']({'plain':!![]});switch(_0x3838e1[_0xc2d4('0x51')]){case _0xc2d4('0x52'):_0x44c504[_0xc2d4('0x2b')](db[_0xc2d4('0x53')][_0xc2d4('0x54')](_0x175a33(_0x3838e1,'VoiceQueueId'))[_0xc2d4('0x50')](function(){})[_0xc2d4('0x55')](_0x4bc500()));break;case _0xc2d4('0x56'):_0x44c504['push'](db['sequelize']['query'](_0x700e6a(_0x3838e1,_0xc2d4('0x57')))[_0xc2d4('0x50')](function(){})['catch'](_0x4bc500()));break;default:_0x44c504[_0xc2d4('0x2b')](db['sequelize'][_0xc2d4('0x54')](_0x2be112(_0x3838e1,'VoiceQueueId'))[_0xc2d4('0x50')](function(){})[_0xc2d4('0x55')](_0x4bc500()));}}}return _0x44c504;})[_0xc2d4('0x58')]()[_0xc2d4('0x50')](function(){return db[_0xc2d4('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xc2d4('0x4e')],'as':_0xc2d4('0x59'),'where':{'id':LISTID}}]})[_0xc2d4('0x50')](function(_0x398467){var _0x454def=[];if(_0x398467){var _0x15a1aa;for(var _0x4cd8d7=0x0,_0xa9f5d0;_0x4cd8d7<_0x398467[_0xc2d4('0x1b')];_0x4cd8d7+=0x1){_0xa9f5d0=_0x398467[_0x4cd8d7]['get']({'plain':!![]});_0x454def[_0xc2d4('0x2b')](db['sequelize'][_0xc2d4('0x54')](_0x7be6f9(_0xa9f5d0,_0xc2d4('0x57')))[_0xc2d4('0x50')](function(){})['catch'](_0x4bc500()));}}return _0x454def;})['all']();})[_0xc2d4('0x50')](function(){return db[_0xc2d4('0x5a')]['findAll']({'attributes':['id',_0xc2d4('0x51')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xc2d4('0x50')](function(_0x2614c1){var _0xe21cf8=[];if(_0x2614c1){for(var _0x31de16=0x0,_0x502baa;_0x31de16<_0x2614c1[_0xc2d4('0x1b')];_0x31de16+=0x1){_0x502baa=_0x2614c1[_0x31de16]['get']({'plain':!![]});switch(_0x502baa[_0xc2d4('0x51')]){case'always':_0xe21cf8[_0xc2d4('0x2b')](db['sequelize'][_0xc2d4('0x54')](_0x175a33(_0x502baa,'CampaignId'))[_0xc2d4('0x50')](function(){})[_0xc2d4('0x55')](_0x4bc500()));break;case _0xc2d4('0x56'):_0xe21cf8[_0xc2d4('0x2b')](db[_0xc2d4('0x53')][_0xc2d4('0x54')](_0x700e6a(_0x502baa,_0xc2d4('0x5b')))['then'](function(){})[_0xc2d4('0x55')](_0x4bc500()));break;default:_0xe21cf8[_0xc2d4('0x2b')](db[_0xc2d4('0x53')][_0xc2d4('0x54')](_0x2be112(_0x502baa,_0xc2d4('0x5b')))[_0xc2d4('0x50')](function(){})['catch'](_0x4bc500()));}}}return _0xe21cf8;})[_0xc2d4('0x58')]();})['then'](function(){return db[_0xc2d4('0x5a')][_0xc2d4('0x5c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x215932){var _0x17eaf5=[];if(_0x215932){for(var _0x5cbf10=0x0,_0x2ba638;_0x5cbf10<_0x215932[_0xc2d4('0x1b')];_0x5cbf10+=0x1){_0x2ba638=_0x215932[_0x5cbf10][_0xc2d4('0x5d')]({'plain':!![]});_0x17eaf5[_0xc2d4('0x2b')](db[_0xc2d4('0x53')][_0xc2d4('0x54')](_0x7be6f9(_0x2ba638,'CampaignId'))['then'](function(){})[_0xc2d4('0x55')](_0x4bc500()));}}return _0x17eaf5;})[_0xc2d4('0x58')]();})[_0xc2d4('0x55')](function(_0x22bbb2){logger[_0xc2d4('0x17')]('cmContact,\x20%s,\x20%s',_0xc2d4('0x5e'),_0x22bbb2[_0xc2d4('0x1d')]);});}var processPromises=function(_0x1c362a){return BPromise['all'](promises)[_0xc2d4('0x50')](function(_0x41dff4){})[_0xc2d4('0x55')](function(_0x4bd504){logger[_0xc2d4('0x17')](_0xc2d4('0x5f'),JSON[_0xc2d4('0x2e')](_0x4bd504));})[_0xc2d4('0x60')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1c362a){return _0x1c362a[_0xc2d4('0x61')]();}});};var endCsv=function(){return BPromise[_0xc2d4('0x62')]()[_0xc2d4('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0xc2d4('0x50')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc2d4('0x63')](FILEPATH);}catch(_0x145a39){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x145a39));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xc2d4('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xc2d4('0x62')]()[_0xc2d4('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc2d4('0x14')](',');return db[_0xc2d4('0x28')][_0xc2d4('0x5c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc2d4('0x50')](function(_0x1eaf2b){var _0x522123=fs[_0xc2d4('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc2d4('0x66')](_0x522123,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3aaa92,_0x441a08){total+=0x1;var _0x5755fc=total;promises[_0xc2d4('0x2b')](checkRow(_0x3aaa92,_0x1eaf2b,_0x5755fc)[_0xc2d4('0x50')](function(){success+=0x1;})[_0xc2d4('0x55')](function(_0x207488){if(_0x207488[_0xc2d4('0x17')]){errors+=0x1;delete _0x207488[_0xc2d4('0x17')];}else if(_0x207488[_0xc2d4('0x67')]){duplicates+=0x1;delete _0x207488[_0xc2d4('0x67')];}rows['push'](_0x207488);}));if(total%0xc8===0x0){_0x441a08['pause']();return processPromises(_0x441a08);}},'complete':function(){return processPromises()[_0xc2d4('0x50')](function(){logger['info'](_0xc2d4('0x68'));endCsv();});},'error':function(_0x2b05d4,_0x22e615){logger[_0xc2d4('0x64')](_0xc2d4('0x69'),JSON[_0xc2d4('0x2e')](_0x2b05d4));endCsv();}});})[_0xc2d4('0x55')](function(_0x321cbc){logger['error'](_0xc2d4('0x6a'),JSON['stringify'](_0x321cbc));});}main(); \ No newline at end of file +var _0xdb70=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','findAll','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','all','VoiceQueue','outbound','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20filepath\x20parameter!'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0xdb70,0x13b));var _0x0db7=function(_0xf80f15,_0x190209){_0xf80f15=_0xf80f15-0x0;var _0x41c5be=_0xdb70[_0xf80f15];return _0x41c5be;};'use strict';var BPromise=require(_0x0db7('0x0'));var util=require('util');var _=require(_0x0db7('0x1'));var fs=require('fs');var squel=require(_0x0db7('0x2'));var Papa=require(_0x0db7('0x3'));var Redis=require(_0x0db7('0x4'));var db=require(_0x0db7('0x5'))['db'];var config=require(_0x0db7('0x6'));var logger=require(_0x0db7('0x7'))(_0x0db7('0x8'));config[_0x0db7('0x9')]=_[_0x0db7('0xa')](config['redis'],{'host':_0x0db7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0db7('0x9')]));require(_0x0db7('0xc'))[_0x0db7('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x2]===_0x0db7('0x10')){throw new Error(_0x0db7('0x11'));}var FILEPATH=process['argv'][0x2];if(!process[_0x0db7('0xf')][0x3]||process['argv'][0x3]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x3]===_0x0db7('0x10')||!process[_0x0db7('0xf')][0x4]||process[_0x0db7('0xf')][0x4]===_0x0db7('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x0db7('0x12'));}var FIELDS=_[_0x0db7('0x13')](process[_0x0db7('0xf')][0x3]['split'](','),process[_0x0db7('0xf')][0x4][_0x0db7('0x14')](','));if(!process[_0x0db7('0xf')][0x5]||process[_0x0db7('0xf')][0x5]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x5]==='null'){throw new Error(_0x0db7('0x15'));}var LISTID=process[_0x0db7('0xf')][0x5];var COMPANYID=process[_0x0db7('0xf')][0x6]&&process[_0x0db7('0xf')][0x6]!==_0x0db7('0xe')&&process['argv'][0x6]!==_0x0db7('0x10')?process[_0x0db7('0xf')][0x6]:null;var DUPLICATES=process[_0x0db7('0xf')][0x7]&&process[_0x0db7('0xf')][0x7]!==_0x0db7('0xe')&&process[_0x0db7('0xf')][0x7]!==_0x0db7('0x10')?process['argv'][0x7]:null;if(!process[_0x0db7('0xf')][0x8]||process[_0x0db7('0xf')][0x8]===_0x0db7('0xe')||process['argv'][0x8]===_0x0db7('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x0db7('0xf')][0x8];}catch(_0x19e021){logger[_0x0db7('0x16')](_0x19e021);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(_0x364e38,_0xb9f89f,_0x330f71,_0x481b76){var _0x31f03d={'message':_0xb9f89f};_0x31f03d[_0x364e38]=!![];if(_0x330f71){_0x31f03d[_0x0db7('0x17')]=_0x330f71;}if(_0x481b76){_0x31f03d[_0x0db7('0x18')]=_0x481b76;}return _0x31f03d;}function isEmail(_0x1ed496){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))*$/[_0x0db7('0x19')](_0x1ed496);}function checkRow(_0x534820,_0xec3bad,_0x3cc966){return new BPromise(function(_0x3d4552,_0x206b29){if(_['isNil'](_0x534820)){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3cc966));}if(_0x534820['errors']&&_0x534820[_0x0db7('0x1a')][_0x0db7('0x1b')]){var _0x4fe140=_['map'](_0x534820[_0x0db7('0x1a')],_0x0db7('0x1c'))[_0x0db7('0x1d')](';');return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x4fe140,null,_0x3cc966));}var _0x310b3c={};for(var _0x5012a4 in FIELDS){if(FIELDS[_0x0db7('0x1e')](_0x5012a4)&&FIELDS[_0x5012a4]){_0x310b3c[_0x5012a4]=_0x534820[_0x0db7('0x1f')][0x0][FIELDS[_0x5012a4]]||_0x534820[_0x0db7('0x1f')][0x0]['\ufeff'+FIELDS[_0x5012a4]];}}if(!_0x310b3c[_0x0db7('0x20')]){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x0db7('0x21'),null,_0x3cc966));}if(!_0x310b3c[_0x0db7('0x22')]){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x0db7('0x23'),null,_0x3cc966));}if(_0x310b3c[_0x0db7('0x24')]){var _0x527985=moment(_0x310b3c[_0x0db7('0x24')],_0x0db7('0x25'));if(!_0x527985[_0x0db7('0x26')]()){return _0x206b29(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3cc966));}}if(_0x310b3c[_0x0db7('0x27')]){if(!isEmail(_0x310b3c[_0x0db7('0x27')])){return _0x206b29(handleCheckRowError('error',_0x0db7('0x28'),null,_0x3cc966));}}_0x310b3c[_0x0db7('0x29')]=LISTID;_0x310b3c[_0x0db7('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0db7('0x1b')]&&_0xec3bad){var _0x2608c9={};for(var _0x72c33f=0x0,_0x3dfa04=DUPLICATES[_0x0db7('0x1b')];_0x72c33f<_0x3dfa04;_0x72c33f+=0x1){_0x2608c9[DUPLICATES[_0x72c33f]]=_0x310b3c[DUPLICATES[_0x72c33f]];}var _0xdab8a1=_[_0x0db7('0x2b')](_0xec3bad,_0x2608c9);if(_0xdab8a1){return _0x206b29(handleCheckRowError(_0x0db7('0x2c'),_0x0db7('0x2d'),_0xdab8a1,_0x3cc966));}}return db[_0x0db7('0x2e')][_0x0db7('0x2f')](_0x310b3c,{'raw':!![],'hooks':![],'fields':_[_0x0db7('0x30')](_0x310b3c)})[_0x0db7('0x31')](function(_0x4cede5){if(DUPLICATES&&DUPLICATES[_0x0db7('0x1b')]&&_0xec3bad){_0xec3bad[_0x0db7('0x32')](_[_0x0db7('0x33')](_0x310b3c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4cede5['id'];return _0x3d4552();})[_0x0db7('0x34')](function(_0x1ee62c){return _0x206b29(handleCheckRowError('error',_0x0db7('0x35')+(_0x1ee62c[_0x0db7('0x1c')]||JSON['stringify'](_0x1ee62c)),null,_0x3cc966));});});}function checkHopper(){function _0x4decd8(){return function(_0x2b9c61){logger[_0x0db7('0x16')](_0x0db7('0x36'),_0x0db7('0x37'),util[_0x0db7('0x38')](_0x2b9c61,{'showHidden':![],'depth':null}));};}var _0x2c32c9=function(_0x13028b,_0x27c2a6){var _0x588928=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')](_0x0db7('0x3b'))[_0x0db7('0x3c')](['phone',_0x0db7('0x3d'),_0x0db7('0x3e'),'ListId',_0x27c2a6,_0x0db7('0x3f'),_0x0db7('0x40')],squel['select']()[_0x0db7('0x41')](_0x0db7('0x22'),_0x0db7('0x22'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3d'))[_0x0db7('0x41')]('id',_0x0db7('0x3e'))[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))['field'](_0x13028b['id'][_0x0db7('0x43')](),_0x27c2a6)[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3f'))[_0x0db7('0x41')]('NOW()','updatedAt')[_0x0db7('0x44')](_0x0db7('0x45'))[_0x0db7('0x46')](_0x0db7('0x47'))[_0x0db7('0x46')](_0x0db7('0x48'),LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'))[_0x0db7('0x44')](_0x0db7('0x3b'))[_0x0db7('0x46')](_0x27c2a6+'\x20=\x20?',_0x13028b['id'][_0x0db7('0x43')]())))[_0x0db7('0x43')]();return _0x588928;};var _0x2b8dde=function(_0x38bba1,_0x3c26e5){var _0x28fdec=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')]('cm_hopper')[_0x0db7('0x3c')]([_0x0db7('0x22'),_0x0db7('0x3d'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x3c26e5,_0x0db7('0x3f'),_0x0db7('0x40')],squel['select']()[_0x0db7('0x41')]('phone','phone')[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3d'))[_0x0db7('0x41')]('id','ContactId')[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))['field'](_0x38bba1['id']['toString'](),_0x3c26e5)['field'](_0x0db7('0x42'),_0x0db7('0x3f'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x40'))['from'](_0x0db7('0x45'))[_0x0db7('0x46')](_0x0db7('0x47'))[_0x0db7('0x46')]('ListId\x20=\x20?',LISTID['toString']())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))[_0x0db7('0x46')](_0x0db7('0x4c'))['where'](_0x0db7('0x4d'),squel[_0x0db7('0x49')]()[_0x0db7('0x41')]('calleridnum')[_0x0db7('0x44')]('cm_hopper_final')['where'](_0x3c26e5+_0x0db7('0x4e'),_0x38bba1['id'][_0x0db7('0x43')]()))['where'](_0x0db7('0x4d'),squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'))[_0x0db7('0x44')]('cm_hopper')['where'](_0x3c26e5+_0x0db7('0x4e'),_0x38bba1['id']['toString']())))[_0x0db7('0x43')]();return _0x28fdec;};function _0x79f5a3(_0x9b5dcf,_0x4063a2){var _0x32d2bc=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')](_0x0db7('0x3b'))['fromQuery']([_0x0db7('0x22'),_0x0db7('0x3d'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x4063a2,_0x0db7('0x3f'),'updatedAt'],squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'),_0x0db7('0x22'))[_0x0db7('0x41')](_0x0db7('0x42'),'scheduledAt')[_0x0db7('0x41')]('id',_0x0db7('0x3e'))[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))[_0x0db7('0x41')](_0x9b5dcf['id']['toString'](),_0x4063a2)[_0x0db7('0x41')]('NOW()',_0x0db7('0x3f'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x40'))[_0x0db7('0x44')](_0x0db7('0x45'))['where'](_0x0db7('0x47'))[_0x0db7('0x46')]('ListId\x20=\x20?',LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))[_0x0db7('0x46')](_0x0db7('0x4c')))['toString']();return _0x32d2bc;}function _0x29d8d5(_0x3d1983,_0x2982f8){var _0x414a52=squel['insert']()[_0x0db7('0x3a')]('cm_hopper_black')[_0x0db7('0x3c')]([_0x0db7('0x22'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x2982f8,_0x0db7('0x3f'),_0x0db7('0x40')],squel[_0x0db7('0x49')]()['field'](_0x0db7('0x22'),'phone')[_0x0db7('0x41')]('id',_0x0db7('0x3e'))['field'](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))[_0x0db7('0x41')](_0x3d1983['id'][_0x0db7('0x43')](),_0x2982f8)[_0x0db7('0x41')]('NOW()',_0x0db7('0x3f'))[_0x0db7('0x41')]('NOW()',_0x0db7('0x40'))[_0x0db7('0x44')](_0x0db7('0x45'))['where'](_0x0db7('0x47'))[_0x0db7('0x46')](_0x0db7('0x48'),LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x414a52;}return db['VoiceQueue'][_0x0db7('0x4f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x5cfee8){var _0x200655=[];if(_0x5cfee8){var _0x7b21f4;for(var _0x2665a5=0x0,_0x1544b1;_0x2665a5<_0x5cfee8[_0x0db7('0x1b')];_0x2665a5+=0x1){_0x1544b1=_0x5cfee8[_0x2665a5]['get']({'plain':!![]});switch(_0x1544b1[_0x0db7('0x52')]){case _0x0db7('0x53'):_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2b8dde(_0x1544b1,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;case'onlyIfOpen':_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2c32c9(_0x1544b1,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;default:_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x79f5a3(_0x1544b1,_0x0db7('0x56')))['then'](function(){})[_0x0db7('0x34')](_0x4decd8()));}}}return _0x200655;})[_0x0db7('0x57')]()[_0x0db7('0x31')](function(){return db[_0x0db7('0x58')][_0x0db7('0x4f')]({'where':{'type':_0x0db7('0x59')},'attributes':['id'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x5a'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x4e0c39){var _0x36abac=[];if(_0x4e0c39){var _0x37cea7;for(var _0x1b3440=0x0,_0x3a8ed3;_0x1b3440<_0x4e0c39[_0x0db7('0x1b')];_0x1b3440+=0x1){_0x3a8ed3=_0x4e0c39[_0x1b3440][_0x0db7('0x5b')]({'plain':!![]});_0x36abac[_0x0db7('0x32')](db['sequelize'][_0x0db7('0x55')](_0x29d8d5(_0x3a8ed3,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}return _0x36abac;})[_0x0db7('0x57')]();})[_0x0db7('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x0db7('0x52')],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x51'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x410c4d){var _0x1eb71c=[];if(_0x410c4d){for(var _0x4776a7=0x0,_0x3a7397;_0x4776a7<_0x410c4d['length'];_0x4776a7+=0x1){_0x3a7397=_0x410c4d[_0x4776a7][_0x0db7('0x5b')]({'plain':!![]});switch(_0x3a7397[_0x0db7('0x52')]){case _0x0db7('0x53'):_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2b8dde(_0x3a7397,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;case'onlyIfOpen':_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2c32c9(_0x3a7397,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));break;default:_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x79f5a3(_0x3a7397,'CampaignId'))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}}return _0x1eb71c;})[_0x0db7('0x57')]();})[_0x0db7('0x31')](function(){return db[_0x0db7('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x5a'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x22a97b){var _0x1d57a9=[];if(_0x22a97b){for(var _0x58974c=0x0,_0x25a6db;_0x58974c<_0x22a97b['length'];_0x58974c+=0x1){_0x25a6db=_0x22a97b[_0x58974c]['get']({'plain':!![]});_0x1d57a9[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x29d8d5(_0x25a6db,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}return _0x1d57a9;})[_0x0db7('0x57')]();})[_0x0db7('0x34')](function(_0xc0e6bd){logger[_0x0db7('0x16')](_0x0db7('0x5e'),'generalCheckHopper',_0xc0e6bd['message']);});}var processPromises=function(_0x4f9778){return BPromise[_0x0db7('0x57')](promises)[_0x0db7('0x31')](function(_0x571092){})['catch'](function(_0x58c629){logger[_0x0db7('0x16')](_0x0db7('0x5f'),JSON[_0x0db7('0x60')](_0x58c629));})[_0x0db7('0x61')](function(){socket['emit'](_0x0db7('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f9778){return _0x4f9778['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x0db7('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x0db7('0x63')](_0x0db7('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0db7('0x64')](FILEPATH);}catch(_0x32ff8d){logger[_0x0db7('0x16')](_0x0db7('0x65'),JSON['stringify'](_0x32ff8d));}finally{process[_0x0db7('0x66')](0x0);}});};process['on'](_0x0db7('0x67'),function(){logger[_0x0db7('0x68')](_0x0db7('0x69'));endCsv();});function main(){return BPromise[_0x0db7('0x6a')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0db7('0x14')](',');return db[_0x0db7('0x2e')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0db7('0x31')](function(_0x95703e){var _0x2623b7=fs[_0x0db7('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2623b7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4338f4,_0x1b694e){total+=0x1;var _0x5a8731=total;promises['push'](checkRow(_0x4338f4,_0x95703e,_0x5a8731)[_0x0db7('0x31')](function(){success+=0x1;})['catch'](function(_0xc8d039){if(_0xc8d039[_0x0db7('0x16')]){errors+=0x1;delete _0xc8d039[_0x0db7('0x16')];}else if(_0xc8d039[_0x0db7('0x2c')]){duplicates+=0x1;delete _0xc8d039[_0x0db7('0x2c')];}rows[_0x0db7('0x32')](_0xc8d039);}));if(total%0xc8===0x0){_0x1b694e[_0x0db7('0x6c')]();return processPromises(_0x1b694e);}},'complete':function(){return processPromises()[_0x0db7('0x31')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x46bc31,_0x4bb4f4){logger[_0x0db7('0x68')](_0x0db7('0x6d'),JSON[_0x0db7('0x60')](_0x46bc31));endCsv();}});})[_0x0db7('0x34')](function(_0x50f28e){logger[_0x0db7('0x16')](_0x0db7('0x6e'),JSON[_0x0db7('0x60')](_0x50f28e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9842f67..86e588e 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 _0x237b=['_description','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','replace','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','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','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','findOne','update','updated','CmContactHasItem','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','ListId','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','error','message','exit','errors','code','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','spread','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','root','server/files/tmp','.csv','includes','header','ContactItemType','name'];(function(_0x1f96bc,_0x56ddb8){var _0x23e370=function(_0x4e84b7){while(--_0x4e84b7){_0x1f96bc['push'](_0x1f96bc['shift']());}};_0x23e370(++_0x56ddb8);}(_0x237b,0x1a7));var _0xb237=function(_0x1e07df,_0xa3f19f){_0x1e07df=_0x1e07df-0x0;var _0x4e1238=_0x237b[_0x1e07df];return _0x4e1238;};'use strict';var fs=require('fs');var path=require(_0xb237('0x0'));var _=require(_0xb237('0x1'));var Papa=require(_0xb237('0x2'));var util=require(_0xb237('0x3'));var BPromise=require('bluebird');var moment=require(_0xb237('0x4'));var squel=require(_0xb237('0x5'));var Redis=require('ioredis');var db=require(_0xb237('0x6'))['db'];var config=require(_0xb237('0x7'));var shared=require(_0xb237('0x8'));var logger=require(_0xb237('0x9'))('import');config[_0xb237('0xa')]=_[_0xb237('0xb')](config['redis'],{'host':_0xb237('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb237('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb237('0xd')](_0xb237('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb237('0xd')](_0xb237('0xe'));function isEmail(_0x2e1f8f){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))*$/[_0xb237('0xf')](_0x2e1f8f);}function selectNotIn(_0x4c0f08,_0x113697,_0x3db1db,_0x1f2396,_0x1a590c){return squel[_0xb237('0x10')]()[_0xb237('0x11')](_0xb237('0x12'))[_0xb237('0x13')](_0x1f2396)[_0xb237('0x14')](_0x113697,null,_0x113697+_0xb237('0x15')+_0x1f2396+'.'+_0x3db1db)[_0xb237('0x16')](_0x1f2396+'.'+_0x3db1db+_0xb237('0x17')+_0x4c0f08+'.'+_0x3db1db)['where'](_0x113697+_0xb237('0x18')+_0x1a590c[_0xb237('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3da701,_0x159950){promisesAdditionalPhones=[];return db['CmContact'][_0xb237('0x19')]({'raw':!![],'attributes':['id',_0xb237('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb237('0x1b')](function(_0x17a71a){if(_0x17a71a!==null){var _0x465c5c=[];for(var _0x363c74=0x0;_0x363c74<_0x17a71a[_0xb237('0x1c')];_0x363c74++){var _0x3a8a4f=_0x17a71a[_0x363c74];_0x465c5c[_0xb237('0x1d')](insertAdditionalPhones(_0x3a8a4f));}}Promise[_0xb237('0x1e')](_0x465c5c)[_0xb237('0x1b')](function(){_0x3da701({'val':0x1});});});});}function insertAdditionalPhones(_0x52916a){return new Promise(function(_0x408e91,_0x33afdf){var _0x56d117=_0x52916a[_0xb237('0x1a')];var _0x588405=_0x56d117[_0xb237('0x1f')](';');var _0x262ae7=[];orderBy=0x0;for(var _0x160e30=0x0;_0x160e30<_0x588405[_0xb237('0x1c')];_0x160e30++){_0x262ae7[_0xb237('0x1d')](splitAdditionalPhone(_0x52916a['id'],_0x588405[_0x160e30]));}Promise[_0xb237('0x1e')](_0x262ae7)[_0xb237('0x1b')](function(){_0x408e91({'val':_0x588405[_0xb237('0x1c')]});});});}function splitAdditionalPhone(_0x2f57ad,_0x5e380c){return new Promise(function(_0x5e8803,_0x195483){var _0x5d8c75=_0x5e380c['split'](':');var _0x4a9f27=_0x5d8c75[0x0];var _0x160b96=_0x5d8c75[0x1];if(!_[_0xb237('0x20')](_0x160b96)){var _0x40d798=_0x160b96[_0xb237('0x1f')]('|');var _0x4c0bba=[];for(var _0x3e41d6=0x0;_0x3e41d6<_0x40d798['length'];_0x3e41d6++){if(_0x40d798[_0x3e41d6]!==''){var _0x25500d=_['filter'](promisesAdditionalPhones,{'contactId':_0x2f57ad,'phone':_0x40d798[_0x3e41d6]});if(_0x25500d[_0xb237('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xb237('0x1d')]({'contactId':_0x2f57ad,'contactTypeId':_0x4a9f27,'phone':_0x40d798[_0x3e41d6],'orderBy':orderBy});}}}_0x5e8803({'ok':0x1});}else _0x5e8803({'res':0x0});});}function createAdditionalPhone(_0x5349ca,_0xa54cd5,_0x1b0df1,_0x2df6a6){var _0x1ffdae='';var _0x15a902='';var _0x2b2e82=_0x1b0df1[_0xb237('0x1f')]('§');_0x1ffdae=_0x2b2e82[0x0];if(_0x2b2e82['length']==0x2)_0x15a902=_0x2b2e82[0x1];return new Promise(function(_0x22f03d,_0xdd7995){return db['CmContactHasItem'][_0xb237('0x21')]({'where':{'CmContactId':_0x5349ca,'item':_0x1ffdae}})['then'](function(_0x5d5227){if(_0x5d5227){return db['CmContactHasItem'][_0xb237('0x22')]({'ItemTypeId':_0xa54cd5,'description':_0x15a902,'OrderBy':_0x2df6a6},{'where':{'CmContactId':_0x5349ca,'item':_0x1ffdae}})['then'](function(_0x208df1){_0x22f03d({'res':_0xb237('0x23')});});}else{return db[_0xb237('0x24')]['create']({'CmContactId':_0x5349ca,'item':_0x1ffdae,'description':_0x15a902,'ItemTypeId':_0xa54cd5,'OrderBy':_0x2df6a6,'ItemClass':_0xb237('0x25')})[_0xb237('0x1b')](function(_0x28c95b){_0x22f03d({'res':_0xb237('0x26')});});}});});}function insertCmHopper(_0x2c2883,_0x3ec159,_0x2eec30,_0x492868,_0x290bdb){var _0x5fa06d=['cm_contacts.phone',_0xb237('0x27'),_0xb237('0x28'),_0xb237('0x29'),_0x3ec159+'.'+_0x492868,_0xb237('0x2a'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x290bdb+'\x22'];return squel[_0xb237('0x2b')]()[_0xb237('0x2c')](_0xb237('0x2d'))[_0xb237('0x2e')]([_0xb237('0x12'),_0xb237('0x2f'),_0xb237('0x30'),'ListId',_0x492868,_0xb237('0x31'),_0xb237('0x32'),_0xb237('0x33'),_0xb237('0x34'),_0xb237('0x35')],squel[_0xb237('0x10')]()[_0xb237('0x36')](_0x5fa06d)[_0xb237('0x13')](_0x3ec159)[_0xb237('0x14')]('cm_contacts',null,_0xb237('0x37')+_0x3ec159+_0xb237('0x38'))[_0xb237('0x14')](_0x2eec30,null,_0x2eec30+_0xb237('0x15')+_0x3ec159+'.'+_0x492868)[_0xb237('0x16')](_0x3ec159+_0xb237('0x39'),_0x2c2883)[_0xb237('0x16')](_0xb237('0x3a'),NOW)[_0xb237('0x16')](_0xb237('0x3b'),selectNotIn(_0x3ec159,_0x2eec30,_0x492868,_0xb237('0x2d'),[_0xb237('0x3c'),_0xb237('0x3d')]))[_0xb237('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3ec159,_0x2eec30,_0x492868,_0xb237('0x2d'),[_0xb237('0x3c')])))[_0xb237('0x3e')]();}function insertCmHopperBlack(_0x110190,_0x4a3d54,_0x16ff99,_0xc0346c){var _0x30e275=[_0xb237('0x3f'),_0xb237('0x28'),_0xb237('0x29'),_0x4a3d54+'.'+_0xc0346c,_0xb237('0x2a'),_0xb237('0x40')];return squel[_0xb237('0x2b')]()[_0xb237('0x2c')](_0xb237('0x41'))[_0xb237('0x2e')]([_0xb237('0x12'),_0xb237('0x30'),_0xb237('0x42'),_0xc0346c,_0xb237('0x31'),_0xb237('0x32')],squel[_0xb237('0x10')]()['fields'](_0x30e275)['from'](_0x4a3d54)[_0xb237('0x14')](_0xb237('0x43'),null,_0xb237('0x37')+_0x4a3d54+'.CmListId')[_0xb237('0x14')](_0x16ff99,null,_0x16ff99+_0xb237('0x15')+_0x4a3d54+'.'+_0xc0346c)[_0xb237('0x16')](_0x4a3d54+_0xb237('0x39'),_0x110190)[_0xb237('0x16')](_0xb237('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb237('0x10')]()[_0xb237('0x11')](_0xb237('0x12'))[_0xb237('0x13')]('cm_hopper_black')[_0xb237('0x16')](_0xb237('0x44'),_0x110190)[_0xb237('0x16')](_0xc0346c+'\x20=\x20'+_0x4a3d54+'.'+_0xc0346c)))[_0xb237('0x3e')]();}function insertTzCmHopper(_0x38bde7,_0xc4878c,_0xb0dcb,_0x43692a,_0x547d9b,_0x49f480){var _0x4c90e5=[_0xb237('0x3f'),_0xb237('0x45')+_0x49f480+_0xb237('0x46'),_0xb237('0x28'),'cm_contacts.ListId',_0xc4878c+'.'+_0x43692a,_0xb237('0x2a'),_0xb237('0x40'),_0xb237('0x47'),'cm_contacts.UserId','\x22'+_0x547d9b+'\x22'];var _0x4ecd25=squel[_0xb237('0x2b')]()['into'](_0xb237('0x2d'))[_0xb237('0x2e')]([_0xb237('0x12'),_0xb237('0x2f'),'ContactId',_0xb237('0x42'),_0x43692a,'createdAt','updatedAt',_0xb237('0x33'),_0xb237('0x34'),_0xb237('0x35')],squel[_0xb237('0x10')]()[_0xb237('0x36')](_0x4c90e5)[_0xb237('0x13')](_0xc4878c)['join'](_0xb237('0x43'),null,_0xb237('0x37')+_0xc4878c+_0xb237('0x38'))[_0xb237('0x14')](_0xb0dcb,null,_0xb0dcb+_0xb237('0x15')+_0xc4878c+'.'+_0x43692a)[_0xb237('0x14')](_0x49f480,null,_0x49f480+_0xb237('0x15')+_0xc4878c+'.'+_0x43692a)[_0xb237('0x16')](_0xc4878c+_0xb237('0x39'),_0x38bde7)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb237('0x16')](_0xb237('0x3b'),selectNotIn(_0xc4878c,_0xb0dcb,_0x43692a,_0xb237('0x2d'),[_0xb237('0x3c'),_0xb237('0x3d')]))[_0xb237('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xc4878c,_0xb0dcb,_0x43692a,_0xb237('0x2d'),[_0xb237('0x3c')])))[_0xb237('0x3e')]();return _0x4ecd25;}function insertTzCmHopperBlack(_0x529dd5,_0x10dfa3,_0x33b055,_0x55cad0){var _0xc3f295=[_0xb237('0x3f'),_0xb237('0x28'),_0xb237('0x29'),_0x10dfa3+'.'+_0x55cad0,_0xb237('0x2a'),_0xb237('0x40')];return squel['insert']()[_0xb237('0x2c')](_0xb237('0x41'))['fromQuery'](['phone',_0xb237('0x30'),'ListId',_0x55cad0,_0xb237('0x31'),_0xb237('0x32')],squel[_0xb237('0x10')]()[_0xb237('0x36')](_0xc3f295)['from'](_0x10dfa3)[_0xb237('0x14')](_0xb237('0x43'),null,_0xb237('0x37')+_0x10dfa3+_0xb237('0x38'))['join'](_0x33b055,null,_0x33b055+_0xb237('0x15')+_0x10dfa3+'.'+_0x55cad0)[_0xb237('0x16')](_0x10dfa3+_0xb237('0x39'),_0x529dd5)[_0xb237('0x16')](_0xb237('0x3a'),NOW)['where'](_0xb237('0x3b'),squel[_0xb237('0x10')]()[_0xb237('0x11')](_0xb237('0x12'))[_0xb237('0x13')](_0xb237('0x41'))[_0xb237('0x16')](_0xb237('0x44'),_0x529dd5)[_0xb237('0x16')](_0x55cad0+_0xb237('0x17')+_0x10dfa3+'.'+_0x55cad0)))['toString']();}function insertCmHopperAdditionalPhones(_0x2ac91f){var _0x69dc16=[_0xb237('0x48'),'cm_contact_has_items.item',_0xb237('0x49'),_0xb237('0x4a'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xb237('0x4b'))[_0xb237('0x2e')]([_0xb237('0x4c'),_0xb237('0x12'),'OrderBy',_0xb237('0x31'),_0xb237('0x32')],squel[_0xb237('0x10')]()['fields'](_0x69dc16)[_0xb237('0x13')](_0xb237('0x2d'))['join']('cm_contacts',null,_0xb237('0x4d'))[_0xb237('0x14')]('cm_contact_has_items',null,_0xb237('0x4e'))[_0xb237('0x16')]('cm_hopper.ListId\x20=\x20?',_0x2ac91f)[_0xb237('0x16')](_0xb237('0x3a'),NOW))[_0xb237('0x3e')]();}function insertCmContact(_0x235938,_0xf5f703,_0x584907,_0x3113c3){var _0x381d7a=_[_0xb237('0x4f')](_[_0xb237('0x50')](_0x3113c3),[_0xb237('0x42'),_0xb237('0x51'),_0xb237('0x31'),_0xb237('0x32')]);return squel[_0xb237('0x2b')]()[_0xb237('0x2c')](_0xb237('0x43'))[_0xb237('0x2e')](_0x381d7a,squel[_0xb237('0x10')]()[_0xb237('0x36')](_0x381d7a)[_0xb237('0x13')](_0xf5f703)[_0xb237('0x16')]('('+_0x584907[_0xb237('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xb237('0x10')]()[_0xb237('0x36')](_0x584907)['from'](_0xb237('0x43'))[_0xb237('0x16')](_0xb237('0x44'),_0x235938)[_0xb237('0x16')](_0xb237('0x52')))[_0xb237('0x16')](_0xb237('0x53'),squel[_0xb237('0x10')]()['field'](_0xb237('0x54'),'min_id')[_0xb237('0x13')](_0xf5f703)['group'](_0x584907['join'](','))))[_0xb237('0x3e')]();}function handleStop(){logger[_0xb237('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x259954){logger[_0xb237('0x56')](_0x259954[_0xb237('0x57')]);process[_0xb237('0x58')](0x1);}function handleError(_0x1325d0,_0x2f2549){stats[_0xb237('0x59')]['push']({'name':_0x2f2549[_0xb237('0x5a')],'message':_0x2f2549[_0xb237('0x57')],'row':_0x1325d0});}function handleQuery(_0x2a59f4){logger['info'](_0x2a59f4);return db['sequelize'][_0xb237('0x5b')](_0x2a59f4)['spread'](function(_0x132e50){results[_0xb237('0x1d')](_0x132e50);})[_0xb237('0x5c')](function(_0x50811c){logger[_0xb237('0x56')](_0x50811c['message']);});}function updateTzCampaigns(_0x449e92){return new Promise(function(_0x3cec68,_0x4eaca7){var _0x341ab8=squel[_0xb237('0x10')]()[_0xb237('0x36')]([_0xb237('0x5d'),'campaigns.dialTimezone'])[_0xb237('0x13')](_0xb237('0x5e'))[_0xb237('0x14')](_0xb237('0x5f'),null,_0xb237('0x60'))[_0xb237('0x16')](_0xb237('0x61')+_0x449e92);db[_0xb237('0x62')][_0xb237('0x5b')](_0x341ab8[_0xb237('0x3e')]())[_0xb237('0x63')](function(_0x832699){var _0xd9265=[];for(var _0x56d9a6=0x0;_0x56d9a6<_0x832699['length'];_0x56d9a6++){_0xd9265['push'](getTimezoneData(_0x832699[_0x56d9a6],tmp_campaigns));}BPromise[_0xb237('0x1e')](_0xd9265)[_0xb237('0x1b')](function(){_0x3cec68({'val':0x1});});})['catch'](function(_0x92467b){logger[_0xb237('0x56')](_0x92467b[_0xb237('0x57')]);_0x3cec68({'val':0x0});});});}function updateTzVoiceQueues(_0x510dcd){return new Promise(function(_0x38e682,_0x56adb5){var _0x1c6e80=squel[_0xb237('0x10')]()[_0xb237('0x36')](['voice_queues.id',_0xb237('0x64')])[_0xb237('0x13')]('voice_queues')[_0xb237('0x14')](_0xb237('0x65'),null,_0xb237('0x66'))[_0xb237('0x16')]('voice_queues_has_cm_lists.CmListId='+_0x510dcd);db['sequelize'][_0xb237('0x5b')](_0x1c6e80[_0xb237('0x3e')]())['spread'](function(_0x267e60){var _0x3749b0=[];for(var _0x1e86b8=0x0;_0x1e86b8<_0x267e60[_0xb237('0x1c')];_0x1e86b8++){_0x3749b0[_0xb237('0x1d')](getTimezoneData(_0x267e60[_0x1e86b8],tmp_voice_queues));}BPromise['all'](_0x3749b0)['then'](function(){_0x38e682({'val':0x1});});})['catch'](function(_0x163787){logger['error'](_0x163787['message']);_0x38e682({'val':0x0});});});}function getTimezoneData(_0x5db0ad,_0xe9d232){return new Promise(function(_0x59f372,_0xb773ae){var _0x59f837=shared[_0xb237('0x67')];var _0x1f948c=_0x59f837[_0x5db0ad[_0xb237('0x68')]];if(_[_0xb237('0x20')](_0x1f948c)){_0x59f372({'ret':0x1});}else{var _0x53e80e=_0x1f948c[_0xb237('0x69')];var _0x221daa=squel['insert']()[_0xb237('0x2c')](_0xe9d232)[_0xb237('0x6a')]('id',_0x5db0ad['id'])[_0xb237('0x6a')](_0xb237('0x6b'),_0x53e80e)[_0xb237('0x6a')](_0xb237('0x68'),_0x5db0ad[_0xb237('0x68')])[_0xb237('0x3e')]();return db[_0xb237('0x62')][_0xb237('0x5b')](_0x221daa)[_0xb237('0x63')](function(_0x52e3b7){_0x59f372({'ret':0x1});})['catch'](function(_0x4d257d){logger[_0xb237('0x56')](_0x4d257d['message']);_0xb773ae({'ret':0x1});});}});}function handleTZQuery(_0x4a5da2){logger[_0xb237('0x55')](_0x4a5da2);return db[_0xb237('0x62')][_0xb237('0x5b')](_0x4a5da2)['spread'](function(_0x3a4904){})['catch'](function(_0x365a56){logger[_0xb237('0x56')](_0x365a56[_0xb237('0x57')]);});}function main(_0x1ae8a0,_0x54a64f,_0x333f7d,_0x1f9783){logger[_0xb237('0x55')](_0xb237('0x6c'),_0x1ae8a0,JSON['stringify'](_0x54a64f));process[_0xb237('0x6d')](_0xb237('0x6e'));var _0x4f0811=_0x54a64f[_0xb237('0x6f')];var _0x288656=_[_0xb237('0x70')](_0x4f0811);var _0x1f3875=_0x54a64f['socket_timestamp'];var _0x2ba2d6=path[_0xb237('0x14')](config[_0xb237('0x71')],_0xb237('0x72'),_0x1f3875+_0xb237('0x73'));hasTZ=_[_0xb237('0x50')](_0x4f0811)[_0xb237('0x74')](_0xb237('0x68'));var _0x25b7b1=_[_0xb237('0x50')](_0x4f0811)[_0xb237('0x14')]();logger[_0xb237('0x55')](_0xb237('0x75'),_0x25b7b1);db[_0xb237('0x76')][_0xb237('0x19')]({'raw':!![],'attributes':['id',_0xb237('0x77')]})['then'](function(_0x4d8dde){for(var _0x46f475=0x0;_0x46f475<_0x4d8dde['length'];_0x46f475++){if(_0x4d8dde[_0x46f475][_0xb237('0x77')]in _0x4f0811){contactItemTypes['push'](_0x4d8dde[_0x46f475]);delete _0x288656[_0x4d8dde[_0x46f475]['name']];hasAdditionalPhones=!![];}for(var _0x5bad41 in _0x4f0811){if(_0x4d8dde[_0x46f475][_0xb237('0x77')]+_0xb237('0x78')===_0x5bad41){phoneDescriptions['push']({'itemTypeId':_0x4d8dde[_0x46f475]['id'],'description':_0x5bad41});delete _0x288656[_0x5bad41];}}}if(hasAdditionalPhones)_0x288656[_0xb237('0x1a')]='';var _0x4e15c4=_[_0xb237('0x50')](_0x288656)['join']();logger[_0xb237('0x55')](_0xb237('0x75'),_0x4e15c4);fs[_0xb237('0x79')](_0x2ba2d6,_0x4e15c4+'\x0a');Papa['parse'](fs[_0xb237('0x7a')](_0x1ae8a0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a43a9,_0x2dd937){try{for(var _0x4c8da4=0x0,_0x459ffc=[];_0x4c8da4<_0x3a43a9[_0xb237('0x7b')][_0xb237('0x1c')];_0x4c8da4++){stats[_0xb237('0x7c')]+=0x1;if(_0x3a43a9[_0xb237('0x59')][_0x4c8da4]){handleError(_0x3a43a9[_0xb237('0x7b')][_0x4c8da4],_0x3a43a9[_0xb237('0x59')][_0x4c8da4]);}else{var _0x1478b9=[];var _0x1b9fe9=[];var _0x145e72={};for(var _0x11efb6 in _0x4f0811){let _0x2d48ea=contactItemTypes[_0xb237('0x7d')](_0x1b0f5f=>_0x1b0f5f['name']===_0x11efb6);let _0xc36c9a=contactItemTypes['find'](_0x1bb1cd=>_0x1bb1cd['name']+_0xb237('0x78')===_0x11efb6);if(_['isNil'](_0x2d48ea)&&_['isNil'](_0xc36c9a)){if(_0x4f0811[_0xb237('0x7e')](_0x11efb6)){if(_0x3a43a9[_0xb237('0x7b')][_0x4c8da4][_0x4f0811[_0x11efb6]]){var _0x57ee51=_['trim'](_0x3a43a9['data'][_0x4c8da4][_0x4f0811[_0x11efb6]][_0xb237('0x7f')](/"/g,'\x27'));switch(_0x11efb6){case _0xb237('0x2f'):var _0x596652=moment(_0x57ee51,_0xb237('0xe'),!![]);if(_0x596652['isValid']()){_0x459ffc[_0xb237('0x1d')]('\x22'+_0x57ee51+'\x22');}else{_0x1478b9[_0xb237('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x2a0419=parseInt(_0x57ee51);_0x57ee51=_[_0xb237('0x80')](_0x2a0419)||_0x2a0419<0x0||_0x2a0419>0x4?_0x1f9783?0x3:0x2:_0x2a0419;_0x459ffc[_0xb237('0x1d')]('\x22'+_0x57ee51+'\x22');break;case _0xb237('0x34'):var _0x578904=parseInt(_0x57ee51);if(_[_0xb237('0x81')](_0x578904)&&_[_0xb237('0x74')](_0x333f7d,_0x578904)){_0x459ffc[_0xb237('0x1d')]('\x22'+_0x578904+'\x22');}else{_0x1478b9['push'](_0xb237('0x82'));}break;case _0xb237('0x83'):if(isEmail(_0x57ee51)){_0x459ffc[_0xb237('0x1d')]('\x22'+_0x57ee51+'\x22');}else{_0x1478b9[_0xb237('0x1d')](_0xb237('0x84'));}break;case'dateOfBirth':var _0x4b2dc6=moment(_0x57ee51,_0xb237('0x85'),!![]);if(_0x4b2dc6[_0xb237('0x86')]()){_0x459ffc[_0xb237('0x1d')]('\x22'+_0x57ee51+'\x22');}else{_0x1478b9[_0xb237('0x1d')](_0xb237('0x87'));}break;case'dialTimezone':var _0x5cdba3=shared[_0xb237('0x67')];var _0x2e4b5d=_0x5cdba3[_0x57ee51];if(!_['isNil'](_0x2e4b5d)){var _0x3b6639=_0x2e4b5d[_0xb237('0x69')];_0x459ffc['push']('\x22'+_0x57ee51+'\x22');_0x459ffc[_0xb237('0x1d')]('\x22'+_0x3b6639+'\x22');}break;default:_0x459ffc[_0xb237('0x1d')]('\x22'+_0x57ee51+'\x22');}}else{switch(_0x11efb6){case _0xb237('0x88'):case _0xb237('0x12'):_0x1478b9[_0xb237('0x1d')](_0x11efb6+_0xb237('0x89'));break;default:_0x459ffc['push']('\x22\x22');}}}}else{var _0x47cbfa='';if(!_[_0xb237('0x20')](_0x2d48ea)){if(!_0x145e72[_0xb237('0x7e')](_0x2d48ea['id'])){if(!_[_0xb237('0x20')](_0x3a43a9['data'][_0x4c8da4][_0x4f0811[_0x11efb6]])){var _0x57ee51=_[_0xb237('0x8a')](_0x3a43a9['data'][_0x4c8da4][_0x4f0811[_0x11efb6]]['replace'](/"/g,'\x27'));var _0x4df4c8=phoneDescriptions[_0xb237('0x7d')](_0x5ab0fc=>_0x5ab0fc[_0xb237('0x8b')]===_0x2d48ea['id']);if(!_[_0xb237('0x20')](_0x4df4c8)){var _0x3a91d8=_[_0xb237('0x8a')](_0x3a43a9[_0xb237('0x7b')][_0x4c8da4][_0x4f0811[_0x4df4c8[_0xb237('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0xb237('0x20')](_0x3a91d8))_0x57ee51=_0x57ee51+'§'+_0x3a91d8;}if(_0x47cbfa=='')_0x47cbfa=_0x57ee51;else _0x47cbfa+='|'+_0x57ee51;}_0x1b9fe9['push'](_0x2d48ea['id']+':'+_0x47cbfa);_0x145e72[_0x2d48ea['id']]=0x1;}}}}if(hasAdditionalPhones){_0x459ffc['push']('\x22'+_0x1b9fe9[_0xb237('0x14')](';')+'\x22');}if(_0x1478b9['length']){handleError(_0x3a43a9['data'][_0x4c8da4],{'code':_0xb237('0x8d'),'message':_0x1478b9[_0xb237('0x14')]()});}else{fs[_0xb237('0x8e')](_0x2ba2d6,_0x459ffc['join']()+'\x0a');}_0x459ffc=[];}if(!(stats[_0xb237('0x7c')]%0xc8)){socket[_0xb237('0x8f')](_0xb237('0x90')+_0x1f3875,stats);stats[_0xb237('0x59')]=[];}}if(stopped){logger['info'](_0xb237('0x91'));_0x2dd937[_0xb237('0x92')]();}}catch(_0x203457){handleError(_0x3a43a9[_0xb237('0x7b')][_0x4c8da4],{'code':_0xb237('0x93'),'message':_0x203457[_0xb237('0x57')]});logger[_0xb237('0x56')](_0xb237('0x94'),_0x203457[_0xb237('0x57')]);}},'complete':function(){try{var _0x4aeb14=[];var _0x5eede4=[];var _0x218a2a=_0xb237('0x43');if(_0x54a64f[_0xb237('0x95')]&&_0x54a64f[_0xb237('0x95')][_0xb237('0x1c')]){_0x218a2a=_0xb237('0x96')+_0x1f3875;_0x4aeb14['push'](_0xb237('0x97')+_0x218a2a+_0xb237('0x98'));}tmp_campaigns=_0xb237('0x99')+_0x1f3875;tmp_voice_queues=_0xb237('0x9a')+_0x1f3875;_0x5eede4['push'](_0xb237('0x97')+tmp_campaigns+_0xb237('0x9b'));_0x5eede4[_0xb237('0x1d')](_0xb237('0x97')+tmp_voice_queues+_0xb237('0x9b'));BPromise[_0xb237('0x9c')](_0x5eede4,handleTZQuery)[_0xb237('0x1b')](function(_0x30b9bc){updateTzCampaigns(_0x54a64f['ListId'])[_0xb237('0x1b')](function(_0x13b533){updateTzVoiceQueues(_0x54a64f[_0xb237('0x42')])[_0xb237('0x1b')](function(_0x1c84e9){if(hasTZ)_0x4e15c4=_0x4e15c4[_0xb237('0x7f')](_0xb237('0x68'),_0xb237('0x9d'));var _0x1e1ed7=util[_0xb237('0xd')](_0xb237('0x9e'),_0x2ba2d6,_0x218a2a,_0x4e15c4,_0x54a64f['ListId'],_0x54a64f[_0xb237('0x51')]||null,NOW,NOW);if(_[_0xb237('0x20')](_0x4f0811[_0xb237('0x2f')])){_0x1e1ed7+=',\x20scheduledAt\x20=\x20NOW()';}_0x4aeb14[_0xb237('0x1d')](_0x1e1ed7);if(_0x54a64f[_0xb237('0x95')]&&_0x54a64f[_0xb237('0x95')][_0xb237('0x1c')]){_0x4aeb14[_0xb237('0x1d')](insertCmContact(_0x54a64f[_0xb237('0x42')],_0x218a2a,_0x54a64f['duplicates'],_0x4f0811));_0x4aeb14[_0xb237('0x1d')](_0xb237('0x9f')+_0x218a2a+';');}BPromise[_0xb237('0x9c')](_0x4aeb14,handleQuery)['then'](function(_0x3647e9){BPromise['all']([handleAdditionalPhones()])[_0xb237('0x1b')](function(){_0x4aeb14=[];for(var _0x534360=0x0;_0x534360\x20\x20');}var _0x189df6=path[_0xb237('0x14')](config[_0xb237('0x71')],'server/files/tmp',process[_0xb237('0xac')][0x2]);if(!fs['existsSync'](_0x189df6)){throw new Error(_0xb237('0xad'));}var _0x4f6194={};try{_0x4f6194=JSON[_0xb237('0xae')](process[_0xb237('0xac')][0x3]);if(!_0x4f6194[_0xb237('0x6f')]){throw new Error(_0xb237('0xaf'));}if(!_0x4f6194[_0xb237('0x6f')][_0xb237('0x12')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4f6194[_0xb237('0x6f')]['firstName']){throw new Error(_0xb237('0xb0'));}var _0x53ba5e=0x0;if(_0x4f6194[_0xb237('0x6f')][_0xb237('0x34')]){_0x53ba5e=0x1;}if(!_0x4f6194[_0xb237('0x42')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1eb574){throw new Error(_0xb237('0xb1'));}var _0xf0e4ec=[];try{_0xf0e4ec=_[_0xb237('0xb2')](JSON[_0xb237('0xae')](process[_0xb237('0xac')][0x4]),'id');}catch(_0x576a7f){logger[_0xb237('0x55')](_0xb237('0xb3'));}main(_0x189df6,_0x4f6194,_0xf0e4ec,_0x53ba5e);}validate();process['on'](_0xb237('0xb4'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x81d4=['info','Received\x20SIGINT','error','exit','errors','sequelize','spread','catch','message','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','start','binding','clone','socket_timestamp','root','server/files/tmp','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','split','all','isNil','filter','CmContactHasItem','findOne','then','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','ListId','updatedAt','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','into','scheduledat','UserId','\x22onlyIfOpen\x22','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id'];(function(_0x3253bc,_0x5eb640){var _0x391fe1=function(_0x494030){while(--_0x494030){_0x3253bc['push'](_0x3253bc['shift']());}};_0x391fe1(++_0x5eb640);}(_0x81d4,0x1ca));var _0x481d=function(_0xfccd77,_0x496d8a){_0xfccd77=_0xfccd77-0x0;var _0x2e33e9=_0x81d4[_0xfccd77];return _0x2e33e9;};'use strict';var fs=require('fs');var path=require(_0x481d('0x0'));var _=require('lodash');var Papa=require(_0x481d('0x1'));var util=require(_0x481d('0x2'));var BPromise=require(_0x481d('0x3'));var moment=require(_0x481d('0x4'));var squel=require('squel');var Redis=require(_0x481d('0x5'));var db=require(_0x481d('0x6'))['db'];var config=require(_0x481d('0x7'));var shared=require(_0x481d('0x8'));var logger=require('../../../config/logger')(_0x481d('0x9'));config[_0x481d('0xa')]=_[_0x481d('0xb')](config[_0x481d('0xa')],{'host':_0x481d('0xc'),'port':0x18eb});var socket=require(_0x481d('0xd'))(new Redis(config[_0x481d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x481d('0xe')](_0x481d('0xf'));function isEmail(_0x543d51){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))*$/[_0x481d('0x10')](_0x543d51);}function selectNotIn(_0x5eec25,_0x450ff3,_0x225cea,_0x20a038,_0xa452a8){return squel[_0x481d('0x11')]()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x20a038)[_0x481d('0x15')](_0x450ff3,null,_0x450ff3+_0x481d('0x16')+_0x20a038+'.'+_0x225cea)[_0x481d('0x17')](_0x20a038+'.'+_0x225cea+_0x481d('0x18')+_0x5eec25+'.'+_0x225cea)[_0x481d('0x17')](_0x450ff3+_0x481d('0x19')+_0xa452a8[_0x481d('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x531f45,_0x349331){promisesAdditionalPhones=[];return db[_0x481d('0x1a')][_0x481d('0x1b')]({'raw':!![],'attributes':['id',_0x481d('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4e9e98){if(_0x4e9e98!==null){var _0x3c8674=[];for(var _0x31487b=0x0;_0x31487b<_0x4e9e98[_0x481d('0x1d')];_0x31487b++){var _0x1c4361=_0x4e9e98[_0x31487b];_0x3c8674[_0x481d('0x1e')](insertAdditionalPhones(_0x1c4361));}}Promise['all'](_0x3c8674)['then'](function(){_0x531f45({'val':0x1});});});});}function insertAdditionalPhones(_0x1e40a6){return new Promise(function(_0x49ec0a,_0x2549bc){var _0xbe8f46=_0x1e40a6[_0x481d('0x1c')];var _0x2ce432=_0xbe8f46[_0x481d('0x1f')](';');var _0x31b583=[];orderBy=0x0;for(var _0x8108ba=0x0;_0x8108ba<_0x2ce432[_0x481d('0x1d')];_0x8108ba++){_0x31b583['push'](splitAdditionalPhone(_0x1e40a6['id'],_0x2ce432[_0x8108ba]));}Promise[_0x481d('0x20')](_0x31b583)['then'](function(){_0x49ec0a({'val':_0x2ce432[_0x481d('0x1d')]});});});}function splitAdditionalPhone(_0x2d0933,_0x4bc31b){return new Promise(function(_0x1dff91,_0x11ab9d){var _0x109a87=_0x4bc31b[_0x481d('0x1f')](':');var _0x2fe442=_0x109a87[0x0];var _0x3da368=_0x109a87[0x1];if(!_[_0x481d('0x21')](_0x3da368)){var _0x2d3de7=_0x3da368['split']('|');var _0x10a4b7=[];for(var _0x201c83=0x0;_0x201c83<_0x2d3de7[_0x481d('0x1d')];_0x201c83++){if(_0x2d3de7[_0x201c83]!==''){var _0x45391f=_[_0x481d('0x22')](promisesAdditionalPhones,{'contactId':_0x2d0933,'phone':_0x2d3de7[_0x201c83]});if(_0x45391f[_0x481d('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x481d('0x1e')]({'contactId':_0x2d0933,'contactTypeId':_0x2fe442,'phone':_0x2d3de7[_0x201c83],'orderBy':orderBy});}}}_0x1dff91({'ok':0x1});}else _0x1dff91({'res':0x0});});}function createAdditionalPhone(_0x55defd,_0x5387d6,_0x4db983,_0xc81350){var _0x287698='';var _0x240110='';var _0x750881=_0x4db983[_0x481d('0x1f')]('§');_0x287698=_0x750881[0x0];if(_0x750881[_0x481d('0x1d')]==0x2)_0x240110=_0x750881[0x1];return new Promise(function(_0x4eb87c,_0x2ad8ac){return db[_0x481d('0x23')][_0x481d('0x24')]({'where':{'CmContactId':_0x55defd,'item':_0x287698}})[_0x481d('0x25')](function(_0x2ec7dd){if(_0x2ec7dd){return db[_0x481d('0x23')][_0x481d('0x26')]({'ItemTypeId':_0x5387d6,'description':_0x240110,'OrderBy':_0xc81350},{'where':{'CmContactId':_0x55defd,'item':_0x287698}})['then'](function(_0x2bd19c){_0x4eb87c({'res':_0x481d('0x27')});});}else{return db[_0x481d('0x23')][_0x481d('0x28')]({'CmContactId':_0x55defd,'item':_0x287698,'description':_0x240110,'ItemTypeId':_0x5387d6,'OrderBy':_0xc81350,'ItemClass':'PHONE'})[_0x481d('0x25')](function(_0x403a19){_0x4eb87c({'res':'inserted'});});}});});}function insertCmHopper(_0x1bdd79,_0x7e2c8d,_0xef4261,_0x314878,_0x5a68c2){var _0x317121=[_0x481d('0x29'),_0x481d('0x2a'),_0x481d('0x2b'),'cm_contacts.ListId',_0x7e2c8d+'.'+_0x314878,_0x481d('0x2c'),_0x481d('0x2d'),_0x481d('0x2e'),_0x481d('0x2f'),'\x22'+_0x5a68c2+'\x22'];return squel[_0x481d('0x30')]()['into'](_0x481d('0x31'))[_0x481d('0x32')]([_0x481d('0x13'),'scheduledat',_0x481d('0x33'),'ListId',_0x314878,_0x481d('0x34'),'updatedAt',_0x481d('0x35'),'UserId',_0x481d('0x36')],squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x317121)[_0x481d('0x14')](_0x7e2c8d)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x7e2c8d+_0x481d('0x3a'))[_0x481d('0x15')](_0xef4261,null,_0xef4261+_0x481d('0x16')+_0x7e2c8d+'.'+_0x314878)[_0x481d('0x17')](_0x7e2c8d+_0x481d('0x3b'),_0x1bdd79)['where'](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x7e2c8d,_0xef4261,_0x314878,_0x481d('0x31'),[_0x481d('0x3e'),'\x22onlyIfOpen\x22']))[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x7e2c8d,_0xef4261,_0x314878,_0x481d('0x31'),[_0x481d('0x3e')])))[_0x481d('0x3f')]();}function insertCmHopperBlack(_0x414d7c,_0x31d36a,_0x233094,_0x29bc8e){var _0x44f96f=[_0x481d('0x29'),_0x481d('0x2b'),_0x481d('0x40'),_0x31d36a+'.'+_0x29bc8e,_0x481d('0x2c'),_0x481d('0x2d')];return squel[_0x481d('0x30')]()['into'](_0x481d('0x41'))[_0x481d('0x32')]([_0x481d('0x13'),'ContactId',_0x481d('0x42'),_0x29bc8e,'createdAt',_0x481d('0x43')],squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x44f96f)[_0x481d('0x14')](_0x31d36a)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x31d36a+'.CmListId')[_0x481d('0x15')](_0x233094,null,_0x233094+_0x481d('0x16')+_0x31d36a+'.'+_0x29bc8e)[_0x481d('0x17')](_0x31d36a+_0x481d('0x3b'),_0x414d7c)[_0x481d('0x17')](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),squel['select']()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x481d('0x41'))['where'](_0x481d('0x44'),_0x414d7c)['where'](_0x29bc8e+_0x481d('0x18')+_0x31d36a+'.'+_0x29bc8e)))[_0x481d('0x3f')]();}function insertTzCmHopper(_0x52000b,_0x45d575,_0x45f481,_0x5e08a5,_0x497e57,_0x24d227){var _0x520dfe=[_0x481d('0x29'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x24d227+_0x481d('0x45'),_0x481d('0x2b'),_0x481d('0x40'),_0x45d575+'.'+_0x5e08a5,_0x481d('0x2c'),'cm_contacts.updatedAt',_0x481d('0x2e'),'cm_contacts.UserId','\x22'+_0x497e57+'\x22'];var _0x2655a8=squel['insert']()[_0x481d('0x46')](_0x481d('0x31'))[_0x481d('0x32')](['phone',_0x481d('0x47'),_0x481d('0x33'),_0x481d('0x42'),_0x5e08a5,'createdAt',_0x481d('0x43'),'priority',_0x481d('0x48'),'recallme'],squel[_0x481d('0x11')]()['fields'](_0x520dfe)['from'](_0x45d575)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x45d575+'.CmListId')[_0x481d('0x15')](_0x45f481,null,_0x45f481+_0x481d('0x16')+_0x45d575+'.'+_0x5e08a5)['join'](_0x24d227,null,_0x24d227+_0x481d('0x16')+_0x45d575+'.'+_0x5e08a5)[_0x481d('0x17')](_0x45d575+_0x481d('0x3b'),_0x52000b)[_0x481d('0x17')](_0x481d('0x3c'),NOW)['where'](_0x481d('0x3d'),selectNotIn(_0x45d575,_0x45f481,_0x5e08a5,_0x481d('0x31'),[_0x481d('0x3e'),_0x481d('0x49')]))[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x45d575,_0x45f481,_0x5e08a5,_0x481d('0x31'),[_0x481d('0x3e')])))[_0x481d('0x3f')]();return _0x2655a8;}function insertTzCmHopperBlack(_0x10f8b1,_0x21145a,_0x1cc947,_0x4187f8){var _0x7ca2f9=['cm_contacts.phone','cm_contacts.id',_0x481d('0x40'),_0x21145a+'.'+_0x4187f8,_0x481d('0x2c'),_0x481d('0x2d')];return squel[_0x481d('0x30')]()[_0x481d('0x46')]('cm_hopper_black')[_0x481d('0x32')]([_0x481d('0x13'),_0x481d('0x33'),_0x481d('0x42'),_0x4187f8,_0x481d('0x34'),_0x481d('0x43')],squel[_0x481d('0x11')]()['fields'](_0x7ca2f9)[_0x481d('0x14')](_0x21145a)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x21145a+_0x481d('0x3a'))[_0x481d('0x15')](_0x1cc947,null,_0x1cc947+'.id\x20=\x20'+_0x21145a+'.'+_0x4187f8)[_0x481d('0x17')](_0x21145a+_0x481d('0x3b'),_0x10f8b1)[_0x481d('0x17')](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),squel[_0x481d('0x11')]()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x481d('0x41'))['where'](_0x481d('0x44'),_0x10f8b1)[_0x481d('0x17')](_0x4187f8+_0x481d('0x18')+_0x21145a+'.'+_0x4187f8)))[_0x481d('0x3f')]();}function insertCmHopperAdditionalPhones(_0x37918a){var _0x2d3c64=['cm_hopper.id',_0x481d('0x4a'),'cm_contact_has_items.OrderBy',_0x481d('0x4b'),_0x481d('0x4c')];return squel[_0x481d('0x30')]()['into'](_0x481d('0x4d'))[_0x481d('0x32')]([_0x481d('0x4e'),'phone',_0x481d('0x4f'),_0x481d('0x34'),_0x481d('0x43')],squel['select']()[_0x481d('0x37')](_0x2d3c64)['from']('cm_hopper')[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x50'))[_0x481d('0x15')](_0x481d('0x51'),null,_0x481d('0x52'))[_0x481d('0x17')](_0x481d('0x53'),_0x37918a)[_0x481d('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x481d('0x3f')]();}function insertCmContact(_0x3a9939,_0x47f9b9,_0x415d0a,_0x3b7ee3){var _0x419217=_[_0x481d('0x54')](_[_0x481d('0x55')](_0x3b7ee3),['ListId','CompanyId',_0x481d('0x34'),_0x481d('0x43')]);return squel['insert']()[_0x481d('0x46')](_0x481d('0x38'))[_0x481d('0x32')](_0x419217,squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x419217)['from'](_0x47f9b9)[_0x481d('0x17')]('('+_0x415d0a[_0x481d('0x15')](',')+_0x481d('0x56'),squel[_0x481d('0x11')]()['fields'](_0x415d0a)[_0x481d('0x14')](_0x481d('0x38'))[_0x481d('0x17')]('ListId\x20=\x20?',_0x3a9939)['where'](_0x481d('0x57')))[_0x481d('0x17')](_0x481d('0x58'),squel[_0x481d('0x11')]()['field'](_0x481d('0x59'),_0x481d('0x5a'))[_0x481d('0x14')](_0x47f9b9)['group'](_0x415d0a[_0x481d('0x15')](','))))[_0x481d('0x3f')]();}function handleStop(){logger[_0x481d('0x5b')](_0x481d('0x5c'));stopped=!![];}function handleUncaughtException(_0x51b9a9){logger[_0x481d('0x5d')](_0x51b9a9['message']);process[_0x481d('0x5e')](0x1);}function handleError(_0x246c0d,_0x4ccb6f){stats[_0x481d('0x5f')][_0x481d('0x1e')]({'name':_0x4ccb6f['code'],'message':_0x4ccb6f['message'],'row':_0x246c0d});}function handleQuery(_0xead03d){logger[_0x481d('0x5b')](_0xead03d);return db[_0x481d('0x60')]['query'](_0xead03d)[_0x481d('0x61')](function(_0x1118ce){results[_0x481d('0x1e')](_0x1118ce);})[_0x481d('0x62')](function(_0xe34fea){logger[_0x481d('0x5d')](_0xe34fea[_0x481d('0x63')]);});}function updateTzCampaigns(_0x4f28d1){return new Promise(function(_0x315087,_0x4a2e10){var _0x3971a3=squel[_0x481d('0x11')]()[_0x481d('0x37')]([_0x481d('0x64'),'campaigns.dialTimezone'])[_0x481d('0x14')](_0x481d('0x65'))[_0x481d('0x15')](_0x481d('0x66'),null,_0x481d('0x67'))[_0x481d('0x17')](_0x481d('0x68')+_0x4f28d1);db[_0x481d('0x60')][_0x481d('0x69')](_0x3971a3['toString']())[_0x481d('0x61')](function(_0x5a5cdd){var _0x2f56cb=[];for(var _0x57aabb=0x0;_0x57aabb<_0x5a5cdd[_0x481d('0x1d')];_0x57aabb++){_0x2f56cb[_0x481d('0x1e')](getTimezoneData(_0x5a5cdd[_0x57aabb],tmp_campaigns));}BPromise[_0x481d('0x20')](_0x2f56cb)[_0x481d('0x25')](function(){_0x315087({'val':0x1});});})[_0x481d('0x62')](function(_0x379ef3){logger[_0x481d('0x5d')](_0x379ef3['message']);_0x315087({'val':0x0});});});}function updateTzVoiceQueues(_0x570da0){return new Promise(function(_0x2292df,_0x356e6c){var _0x3acc57=squel[_0x481d('0x11')]()[_0x481d('0x37')](['voice_queues.id',_0x481d('0x6a')])[_0x481d('0x14')](_0x481d('0x6b'))[_0x481d('0x15')](_0x481d('0x6c'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x481d('0x17')](_0x481d('0x6d')+_0x570da0);db[_0x481d('0x60')][_0x481d('0x69')](_0x3acc57['toString']())[_0x481d('0x61')](function(_0x3e98e8){var _0x3a580c=[];for(var _0x386d78=0x0;_0x386d78<_0x3e98e8[_0x481d('0x1d')];_0x386d78++){_0x3a580c[_0x481d('0x1e')](getTimezoneData(_0x3e98e8[_0x386d78],tmp_voice_queues));}BPromise[_0x481d('0x20')](_0x3a580c)[_0x481d('0x25')](function(){_0x2292df({'val':0x1});});})[_0x481d('0x62')](function(_0x3ed985){logger['error'](_0x3ed985[_0x481d('0x63')]);_0x2292df({'val':0x0});});});}function getTimezoneData(_0x20b567,_0x56816d){return new Promise(function(_0x31916e,_0x3a9882){var _0x503efa=shared[_0x481d('0x6e')];var _0x158f2a=_0x503efa[_0x20b567['dialTimezone']];if(_[_0x481d('0x21')](_0x158f2a)){_0x31916e({'ret':0x1});}else{var _0x3758da=_0x158f2a[_0x481d('0x6f')];var _0x1bf5ce=squel[_0x481d('0x30')]()[_0x481d('0x46')](_0x56816d)[_0x481d('0x70')]('id',_0x20b567['id'])[_0x481d('0x70')](_0x481d('0x71'),_0x3758da)[_0x481d('0x70')](_0x481d('0x72'),_0x20b567[_0x481d('0x72')])['toString']();return db[_0x481d('0x60')]['query'](_0x1bf5ce)['spread'](function(_0x36cf09){_0x31916e({'ret':0x1});})[_0x481d('0x62')](function(_0x21d471){logger[_0x481d('0x5d')](_0x21d471[_0x481d('0x63')]);_0x3a9882({'ret':0x1});});}});}function handleTZQuery(_0x46b728){logger[_0x481d('0x5b')](_0x46b728);return db[_0x481d('0x60')]['query'](_0x46b728)[_0x481d('0x61')](function(_0x1df11a){})[_0x481d('0x62')](function(_0x2bf210){logger[_0x481d('0x5d')](_0x2bf210[_0x481d('0x63')]);});}function main(_0x14beb6,_0x1b363e,_0x2ab2ad,_0x3ab121){logger[_0x481d('0x5b')](_0x481d('0x73'),_0x14beb6,JSON['stringify'](_0x1b363e));process['send'](_0x481d('0x74'));var _0xa1f3fb=_0x1b363e[_0x481d('0x75')];var _0x487f90=_[_0x481d('0x76')](_0xa1f3fb);var _0x1bbf90=_0x1b363e[_0x481d('0x77')];var _0x141dff=path['join'](config[_0x481d('0x78')],_0x481d('0x79'),_0x1bbf90+'.csv');hasTZ=_[_0x481d('0x55')](_0xa1f3fb)['includes'](_0x481d('0x72'));var _0x9d3406=_[_0x481d('0x55')](_0xa1f3fb)[_0x481d('0x15')]();logger[_0x481d('0x5b')]('header',_0x9d3406);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x481d('0x7a')]})[_0x481d('0x25')](function(_0x53b780){for(var _0x593c77=0x0;_0x593c77<_0x53b780[_0x481d('0x1d')];_0x593c77++){if(_0x53b780[_0x593c77]['name']in _0xa1f3fb){contactItemTypes['push'](_0x53b780[_0x593c77]);delete _0x487f90[_0x53b780[_0x593c77][_0x481d('0x7a')]];hasAdditionalPhones=!![];}for(var _0x55e38d in _0xa1f3fb){if(_0x53b780[_0x593c77]['name']+_0x481d('0x7b')===_0x55e38d){phoneDescriptions[_0x481d('0x1e')]({'itemTypeId':_0x53b780[_0x593c77]['id'],'description':_0x55e38d});delete _0x487f90[_0x55e38d];}}}if(hasAdditionalPhones)_0x487f90[_0x481d('0x1c')]='';var _0x38b2ff=_[_0x481d('0x55')](_0x487f90)['join']();logger[_0x481d('0x5b')]('header',_0x38b2ff);fs[_0x481d('0x7c')](_0x141dff,_0x38b2ff+'\x0a');Papa[_0x481d('0x7d')](fs[_0x481d('0x7e')](_0x14beb6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x393c8b,_0x4f4775){try{for(var _0xdcd8f5=0x0,_0xb4446=[];_0xdcd8f5<_0x393c8b[_0x481d('0x7f')]['length'];_0xdcd8f5++){stats[_0x481d('0x80')]+=0x1;if(_0x393c8b[_0x481d('0x5f')][_0xdcd8f5]){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],_0x393c8b[_0x481d('0x5f')][_0xdcd8f5]);}else{var _0x2dcd4f=[];var _0x46552a=[];var _0x42772b={};for(var _0x3b6260 in _0xa1f3fb){let _0x59c1a3=contactItemTypes['find'](_0x538a11=>_0x538a11['name']===_0x3b6260);let _0x5c1de9=contactItemTypes[_0x481d('0x81')](_0x4957b5=>_0x4957b5[_0x481d('0x7a')]+_0x481d('0x7b')===_0x3b6260);if(_[_0x481d('0x21')](_0x59c1a3)&&_[_0x481d('0x21')](_0x5c1de9)){if(_0xa1f3fb['hasOwnProperty'](_0x3b6260)){if(_0x393c8b['data'][_0xdcd8f5][_0xa1f3fb[_0x3b6260]]){var _0x3585e6=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]][_0x481d('0x83')](/"/g,'\x27'));switch(_0x3b6260){case _0x481d('0x47'):var _0x5cf241=moment(_0x3585e6,_0x481d('0xf'),!![]);if(_0x5cf241[_0x481d('0x84')]()){_0xb4446['push']('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f['push'](_0x481d('0x85'));}break;case _0x481d('0x35'):var _0x795f6e=parseInt(_0x3585e6);_0x3585e6=_[_0x481d('0x86')](_0x795f6e)||_0x795f6e<0x0||_0x795f6e>0x4?_0x3ab121?0x3:0x2:_0x795f6e;_0xb4446['push']('\x22'+_0x3585e6+'\x22');break;case'UserId':var _0x3a41a6=parseInt(_0x3585e6);if(_[_0x481d('0x87')](_0x3a41a6)&&_[_0x481d('0x88')](_0x2ab2ad,_0x3a41a6)){_0xb4446[_0x481d('0x1e')]('\x22'+_0x3a41a6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')](_0x481d('0x89'));}break;case'email':if(isEmail(_0x3585e6)){_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x12d64c=moment(_0x3585e6,_0x481d('0x8a'),!![]);if(_0x12d64c[_0x481d('0x84')]()){_0xb4446['push']('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')](_0x481d('0x8b'));}break;case _0x481d('0x72'):var _0xcd85d8=shared[_0x481d('0x6e')];var _0x1cc039=_0xcd85d8[_0x3585e6];if(!_[_0x481d('0x21')](_0x1cc039)){var _0x1e5724=_0x1cc039[_0x481d('0x6f')];_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');_0xb4446[_0x481d('0x1e')]('\x22'+_0x1e5724+'\x22');}break;default:_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');}}else{switch(_0x3b6260){case _0x481d('0x8c'):case _0x481d('0x13'):_0x2dcd4f[_0x481d('0x1e')](_0x3b6260+_0x481d('0x8d'));break;default:_0xb4446[_0x481d('0x1e')]('\x22\x22');}}}}else{var _0x4dea57='';if(!_[_0x481d('0x21')](_0x59c1a3)){if(!_0x42772b['hasOwnProperty'](_0x59c1a3['id'])){if(!_[_0x481d('0x21')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]])){var _0x3585e6=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]]['replace'](/"/g,'\x27'));var _0x9adc21=phoneDescriptions['find'](_0x1abb35=>_0x1abb35[_0x481d('0x8e')]===_0x59c1a3['id']);if(!_[_0x481d('0x21')](_0x9adc21)){var _0x1b6a4d=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x9adc21[_0x481d('0x8f')]]][_0x481d('0x83')](/"/g,'\x27'));if(!_[_0x481d('0x21')](_0x1b6a4d))_0x3585e6=_0x3585e6+'§'+_0x1b6a4d;}if(_0x4dea57=='')_0x4dea57=_0x3585e6;else _0x4dea57+='|'+_0x3585e6;}_0x46552a[_0x481d('0x1e')](_0x59c1a3['id']+':'+_0x4dea57);_0x42772b[_0x59c1a3['id']]=0x1;}}}}if(hasAdditionalPhones){_0xb4446[_0x481d('0x1e')]('\x22'+_0x46552a[_0x481d('0x15')](';')+'\x22');}if(_0x2dcd4f[_0x481d('0x1d')]){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],{'code':_0x481d('0x90'),'message':_0x2dcd4f[_0x481d('0x15')]()});}else{fs[_0x481d('0x91')](_0x141dff,_0xb4446[_0x481d('0x15')]()+'\x0a');}_0xb4446=[];}if(!(stats['rows']%0xc8)){socket[_0x481d('0x92')](_0x481d('0x93')+_0x1bbf90,stats);stats[_0x481d('0x5f')]=[];}}if(stopped){logger[_0x481d('0x5b')](_0x481d('0x94'));_0x4f4775[_0x481d('0x95')]();}}catch(_0x4b012b){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],{'code':_0x481d('0x96'),'message':_0x4b012b[_0x481d('0x63')]});logger['error']('step',_0x4b012b['message']);}},'complete':function(){try{var _0x2c4d3d=[];var _0x2b198b=[];var _0x6162de=_0x481d('0x38');if(_0x1b363e[_0x481d('0x97')]&&_0x1b363e[_0x481d('0x97')]['length']){_0x6162de=_0x481d('0x98')+_0x1bbf90;_0x2c4d3d['push'](_0x481d('0x99')+_0x6162de+_0x481d('0x9a'));}tmp_campaigns='campaigns_'+_0x1bbf90;tmp_voice_queues=_0x481d('0x9b')+_0x1bbf90;_0x2b198b['push'](_0x481d('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2b198b[_0x481d('0x1e')](_0x481d('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x481d('0x9c')](_0x2b198b,handleTZQuery)[_0x481d('0x25')](function(_0x5b16a9){updateTzCampaigns(_0x1b363e[_0x481d('0x42')])['then'](function(_0x2842ac){updateTzVoiceQueues(_0x1b363e[_0x481d('0x42')])['then'](function(_0x30c4c7){if(hasTZ)_0x38b2ff=_0x38b2ff[_0x481d('0x83')](_0x481d('0x72'),_0x481d('0x9d'));var _0x351658=util[_0x481d('0xe')](_0x481d('0x9e'),_0x141dff,_0x6162de,_0x38b2ff,_0x1b363e[_0x481d('0x42')],_0x1b363e[_0x481d('0x9f')]||null,NOW,NOW);if(_[_0x481d('0x21')](_0xa1f3fb[_0x481d('0x47')])){_0x351658+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c4d3d['push'](_0x351658);if(_0x1b363e['duplicates']&&_0x1b363e[_0x481d('0x97')][_0x481d('0x1d')]){_0x2c4d3d[_0x481d('0x1e')](insertCmContact(_0x1b363e[_0x481d('0x42')],_0x6162de,_0x1b363e[_0x481d('0x97')],_0xa1f3fb));_0x2c4d3d['push'](_0x481d('0xa0')+_0x6162de+';');}BPromise[_0x481d('0x9c')](_0x2c4d3d,handleQuery)[_0x481d('0x25')](function(_0x56049f){BPromise['all']([handleAdditionalPhones()])[_0x481d('0x25')](function(){_0x2c4d3d=[];for(var _0x2db15d=0x0;_0x2db15d\x20\x20','root','existsSync'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xd38f,0xa3));var _0xfd38=function(_0x2591e9,_0x56fd02){_0x2591e9=_0x2591e9-0x0;var _0x443ca6=_0xd38f[_0x2591e9];return _0x443ca6;};'use strict';var fs=require('fs');var path=require(_0xfd38('0x0'));var _=require(_0xfd38('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0xfd38('0x2'));var squel=require(_0xfd38('0x3'));var Redis=require(_0xfd38('0x4'));var db=require(_0xfd38('0x5'))['db'];var config=require(_0xfd38('0x6'));var logger=require(_0xfd38('0x7'))(_0xfd38('0x8'));config[_0xfd38('0x9')]=_['defaults'](config[_0xfd38('0x9')],{'host':_0xfd38('0xa'),'port':0x18eb});var socket=require(_0xfd38('0xb'))(new Redis(config[_0xfd38('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xfd38('0xc')+moment()[_0xfd38('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x15f16a){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))*$/[_0xfd38('0xe')](_0x15f16a);}function selectNotIn(_0x8660a,_0x3d33b4,_0x25f72d,_0x3e2339,_0x3fb767){return squel[_0xfd38('0xf')]()[_0xfd38('0x10')](_0xfd38('0x11'))['from'](_0x3e2339)[_0xfd38('0x12')](_0x3d33b4,null,_0x3d33b4+'.id\x20=\x20'+_0x3e2339+'.'+_0x25f72d)[_0xfd38('0x13')](_0x3e2339+'.'+_0x25f72d+_0xfd38('0x14')+_0x8660a+'.'+_0x25f72d)[_0xfd38('0x13')](_0x3d33b4+_0xfd38('0x15')+_0x3fb767[_0xfd38('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x535593,_0x542ac2){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfd38('0x16')]['query'](_0xfd38('0x17')+tempTableName)[_0xfd38('0x18')](function(_0x5d7f99){if(_0x5d7f99!==null){var _0x338eec=[];for(var _0x2d86fb=0x0;_0x2d86fb<_0x5d7f99[_0xfd38('0x19')];_0x2d86fb++){var _0x1e94d3=_0x5d7f99[_0x2d86fb];if(!_[_0xfd38('0x1a')](_0x1e94d3[_0xfd38('0x11')])){if(!_[_0xfd38('0x1a')](_0x1e94d3['AdditionalPhones']))_0x338eec[_0xfd38('0x1b')](insertAdditionalPhones(_0x1e94d3));promisesContact[_0xfd38('0x1b')]({'contact':_0x1e94d3});}}}Promise[_0xfd38('0x1c')](_0x338eec)[_0xfd38('0x1d')](function(){_0x535593({'val':0x1});});})['catch'](function(_0x3144c1){logger['error'](_0x3144c1[_0xfd38('0x1e')]);});});}function insertAdditionalPhones(_0xbbc7b1){return new Promise(function(_0x49c49e,_0x3d5856){var _0x59be57=_0xbbc7b1['AdditionalPhones'];if(_[_0xfd38('0x1a')](_0x59be57))_0x3d5856({'val':0x0});else{var _0x220b66=_0x59be57[_0xfd38('0x1f')](';');var _0x4505a6=[];orderBy=0x0;for(var _0x30808d=0x0;_0x30808d<_0x220b66[_0xfd38('0x19')];_0x30808d++){_0x4505a6[_0xfd38('0x1b')](splitAdditionalPhone(_0xbbc7b1['id'],_0x220b66[_0x30808d]));}Promise[_0xfd38('0x1c')](_0x4505a6)[_0xfd38('0x1d')](function(){_0x49c49e({'val':_0x220b66[_0xfd38('0x19')]});});}});}function splitAdditionalPhone(_0x16cc13,_0x23246c){return new Promise(function(_0x459cfa,_0x3a562a){var _0x3ec5fa=_0x23246c[_0xfd38('0x1f')](':');var _0x11217e=_0x3ec5fa[0x0];var _0x27ade0=_0x3ec5fa[0x1];if(_0x27ade0!==''){var _0x10ea1f=_0x27ade0[_0xfd38('0x1f')]('|');var _0x5ec697=[];for(var _0x4c831c=0x0;_0x4c831c<_0x10ea1f[_0xfd38('0x19')];_0x4c831c++){if(_0x10ea1f[_0x4c831c]!==''){var _0x2ca70c=_[_0xfd38('0x20')](promisesAdditionalPhones,{'contactId':_0x16cc13,'phone':_0x10ea1f[_0x4c831c]});if(_0x2ca70c[_0xfd38('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x16cc13,'contactTypeId':_0x11217e,'phone':_0x10ea1f[_0x4c831c],'orderBy':orderBy});}}}_0x459cfa({'ok':0x1});}else _0x459cfa({'res':0x0});});}function createAdditionalPhone(_0x57e495,_0x24c7af,_0x4fb4a5,_0x629c44){var _0x2d26d1='';var _0x508f87='';var _0x58d716=_0x4fb4a5['split']('§');_0x2d26d1=_0x58d716[0x0];if(_0x58d716[_0xfd38('0x19')]==0x2)_0x508f87=_0x58d716[0x1];return new Promise(function(_0x176538,_0x299b54){return db[_0xfd38('0x21')]['findOne']({'where':{'CmContactId':_0x57e495,'item':_0x2d26d1}})[_0xfd38('0x1d')](function(_0x21e4fd){if(_0x21e4fd){return db['CmContactHasItem']['update']({'ItemTypeId':_0x24c7af,'description':_0x508f87,'OrderBy':_0x629c44},{'where':{'CmContactId':_0x57e495,'item':_0x2d26d1}})[_0xfd38('0x1d')](function(_0x37ed51){_0x176538({'res':_0xfd38('0x22')});});}else{return db[_0xfd38('0x21')][_0xfd38('0x23')]({'CmContactId':_0x57e495,'item':_0x2d26d1,'ItemTypeId':_0x24c7af,'description':_0x508f87,'OrderBy':_0x629c44,'ItemClass':'PHONE'})[_0xfd38('0x1d')](function(_0x5db4d2){_0x176538({'res':_0xfd38('0x24')});});}});});}function updateContact(_0x498f48){return new Promise(function(_0x1d48ea,_0x4da027){var _0x41a696=_0x498f48['id'];delete _0x498f48['id'];return db[_0xfd38('0x25')][_0xfd38('0x26')](_0x498f48,{'where':{'id':_0x41a696}})[_0xfd38('0x1d')](function(_0x257ec1){updatedRows+=0x1;return db['CmHopper'][_0xfd38('0x26')]({'phone':_0x498f48['phone']},{'where':{'ContactId':_0x41a696}})[_0xfd38('0x1d')](function(_0x4bfb2b){_0x1d48ea({'ret':'OK'});});});});}function insertCmHopper(_0x4d2d0e,_0x2b820a,_0x4f86d5,_0x138ce2,_0x1c8eb0){var _0x47adde=[_0xfd38('0x27'),_0xfd38('0x28'),_0xfd38('0x29'),_0xfd38('0x2a'),_0x2b820a+'.'+_0x138ce2,'cm_contacts.createdAt',_0xfd38('0x2b'),'cm_contacts.priority',_0xfd38('0x2c'),'\x22'+_0x1c8eb0+'\x22'];return squel[_0xfd38('0x2d')]()[_0xfd38('0x2e')](_0xfd38('0x2f'))[_0xfd38('0x30')]([_0xfd38('0x11'),_0xfd38('0x31'),_0xfd38('0x32'),'ListId',_0x138ce2,_0xfd38('0x33'),_0xfd38('0x34'),_0xfd38('0x35'),_0xfd38('0x36'),_0xfd38('0x37')],squel[_0xfd38('0xf')]()['fields'](_0x47adde)[_0xfd38('0x38')](_0x2b820a)[_0xfd38('0x12')](_0xfd38('0x39'),null,_0xfd38('0x3a')+_0x2b820a+_0xfd38('0x3b'))[_0xfd38('0x12')](_0x4f86d5,null,_0x4f86d5+_0xfd38('0x3c')+_0x2b820a+'.'+_0x138ce2)[_0xfd38('0x13')](_0x2b820a+_0xfd38('0x3d'),_0x4d2d0e)[_0xfd38('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfd38('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2b820a,_0x4f86d5,_0x138ce2,'cm_hopper',[_0xfd38('0x3e'),_0xfd38('0x3f')]))[_0xfd38('0x13')](_0xfd38('0x40'),selectNotIn(_0x2b820a,_0x4f86d5,_0x138ce2,_0xfd38('0x2f'),[_0xfd38('0x3e')])))[_0xfd38('0x41')]();}function insertCmHopperBlack(_0x560aae,_0x2707bb,_0x19ca1b,_0xab5c63){var _0x599706=[_0xfd38('0x27'),_0xfd38('0x29'),'cm_contacts.ListId',_0x2707bb+'.'+_0xab5c63,_0xfd38('0x42'),'cm_contacts.updatedAt'];return squel[_0xfd38('0x2d')]()[_0xfd38('0x2e')](_0xfd38('0x43'))[_0xfd38('0x30')]([_0xfd38('0x11'),_0xfd38('0x32'),_0xfd38('0x44'),_0xab5c63,_0xfd38('0x33'),'updatedAt'],squel['select']()[_0xfd38('0x45')](_0x599706)[_0xfd38('0x38')](_0x2707bb)['join'](_0xfd38('0x39'),null,_0xfd38('0x3a')+_0x2707bb+_0xfd38('0x3b'))[_0xfd38('0x12')](_0x19ca1b,null,_0x19ca1b+_0xfd38('0x3c')+_0x2707bb+'.'+_0xab5c63)[_0xfd38('0x13')](_0x2707bb+_0xfd38('0x3d'),_0x560aae)[_0xfd38('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfd38('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfd38('0xf')]()[_0xfd38('0x10')](_0xfd38('0x11'))[_0xfd38('0x38')](_0xfd38('0x43'))[_0xfd38('0x13')](_0xfd38('0x46'),_0x560aae)[_0xfd38('0x13')](_0xab5c63+_0xfd38('0x47'),_0x2707bb+'.'+_0xab5c63)))[_0xfd38('0x41')]();}function insertCmHopperAdditionalPhones(_0xe04426){var _0x2b4ed4=[_0xfd38('0x48'),_0xfd38('0x49'),_0xfd38('0x4a'),_0xfd38('0x4b'),_0xfd38('0x4c')];return squel['insert']()[_0xfd38('0x2e')](_0xfd38('0x4d'))[_0xfd38('0x30')](['CmHopperId',_0xfd38('0x11'),_0xfd38('0x4e'),_0xfd38('0x33'),_0xfd38('0x34')],squel['select']()[_0xfd38('0x45')](_0x2b4ed4)[_0xfd38('0x38')](_0xfd38('0x2f'))[_0xfd38('0x12')](_0xfd38('0x39'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xfd38('0x12')](_0xfd38('0x4f'),null,_0xfd38('0x50'))[_0xfd38('0x13')](_0xfd38('0x51'),_0xe04426)[_0xfd38('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xfd38('0x41')]();}function insertCmContact(_0x5b399d,_0x5b6815,_0x13f636,_0x504459){var _0x41e85a=_[_0xfd38('0x52')](_[_0xfd38('0x53')](_0x504459),[_0xfd38('0x44'),'CompanyId',_0xfd38('0x33'),_0xfd38('0x34')]);return squel[_0xfd38('0x2d')]()[_0xfd38('0x2e')](_0xfd38('0x39'))[_0xfd38('0x30')](_0x41e85a,squel[_0xfd38('0xf')]()['fields'](_0x41e85a)[_0xfd38('0x38')](_0x5b6815)['where']('('+_0x13f636['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xfd38('0xf')]()[_0xfd38('0x45')](_0x13f636)[_0xfd38('0x38')](_0xfd38('0x39'))[_0xfd38('0x13')](_0xfd38('0x46'),_0x5b399d))[_0xfd38('0x13')](_0xfd38('0x54'),squel[_0xfd38('0xf')]()['field']('MIN(id)',_0xfd38('0x55'))[_0xfd38('0x38')](_0x5b6815)['group'](_0x13f636[_0xfd38('0x12')](','))))[_0xfd38('0x41')]();}function handleStop(){logger[_0xfd38('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3f40ef){logger[_0xfd38('0x57')](_0x3f40ef[_0xfd38('0x1e')]);process[_0xfd38('0x58')](0x1);}function handleError(_0x4d67c8,_0x1e2af4){stats[_0xfd38('0x59')][_0xfd38('0x1b')]({'name':_0x1e2af4[_0xfd38('0x5a')],'message':_0x1e2af4[_0xfd38('0x1e')],'row':_0x4d67c8});}function handleQuery(_0x2baacd){logger[_0xfd38('0x56')](_0x2baacd);return db[_0xfd38('0x16')][_0xfd38('0x5b')](_0x2baacd)[_0xfd38('0x18')](function(_0x1fc606){results[_0xfd38('0x1b')](_0x1fc606);})[_0xfd38('0x5c')](function(_0x1283aa){logger[_0xfd38('0x57')](_0x1283aa[_0xfd38('0x1e')]);});}function main(_0x71723e,_0x2bf4e4,_0x148a73,_0x118ace){logger[_0xfd38('0x56')](_0xfd38('0x5d'),_0x71723e,JSON[_0xfd38('0x5e')](_0x2bf4e4));process['send'](_0xfd38('0x5f'));var _0x23668c=_0x2bf4e4[_0xfd38('0x60')];var _0x51c73f=_[_0xfd38('0x61')](_0x23668c);var _0x822583=_0x2bf4e4[_0xfd38('0x62')];var _0x31bd40=path[_0xfd38('0x12')](config['root'],_0xfd38('0x63'),_0x822583+_0xfd38('0x64'));logger[_0xfd38('0x56')]('body',_0x2bf4e4);db[_0xfd38('0x65')]['findAll']({'raw':!![],'attributes':['id',_0xfd38('0x66')]})[_0xfd38('0x1d')](function(_0x4a895b){for(var _0x134014=0x0;_0x134014<_0x4a895b[_0xfd38('0x19')];_0x134014++){if(_0x4a895b[_0x134014][_0xfd38('0x66')]in _0x23668c){contactItemTypes[_0xfd38('0x1b')](_0x4a895b[_0x134014]);delete _0x51c73f[_0x4a895b[_0x134014]['name']];hasAdditionalPhones=!![];}for(var _0x145bc7 in _0x23668c){if(_0x4a895b[_0x134014]['name']+'_description'===_0x145bc7){phoneDescriptions['push']({'itemTypeId':_0x4a895b[_0x134014]['id'],'description':_0x145bc7});delete _0x51c73f[_0x145bc7];}}}if(hasAdditionalPhones)_0x51c73f[_0xfd38('0x67')]='';var _0x2e77b3=_['keys'](_0x51c73f)[_0xfd38('0x12')]();logger[_0xfd38('0x56')]('header',_0x2e77b3);fs['writeFileSync'](_0x31bd40,_0x2e77b3+'\x0a');Papa['parse'](fs[_0xfd38('0x68')](_0x71723e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x15bf9e,_0x5df93b){try{for(var _0x5d504e=0x0,_0x431c64=[];_0x5d504e<_0x15bf9e[_0xfd38('0x69')][_0xfd38('0x19')];_0x5d504e++){stats[_0xfd38('0x6a')]+=0x1;if(_0x15bf9e[_0xfd38('0x59')][_0x5d504e]){handleError(_0x15bf9e[_0xfd38('0x69')][_0x5d504e],_0x15bf9e[_0xfd38('0x59')][_0x5d504e]);}else{var _0x4e8d12=[];var _0x348ecf=[];var _0x59a645={};for(var _0x1cf43c in _0x23668c){let _0xfa2957=contactItemTypes[_0xfd38('0x6b')](_0x263245=>_0x263245[_0xfd38('0x66')]===_0x1cf43c);let _0x26f64e=contactItemTypes[_0xfd38('0x6b')](_0x168f35=>_0x168f35[_0xfd38('0x66')]+_0xfd38('0x6c')===_0x1cf43c);if(_[_0xfd38('0x1a')](_0xfa2957)&&_[_0xfd38('0x1a')](_0x26f64e)){if(_0x23668c['hasOwnProperty'](_0x1cf43c)){if(_0x15bf9e[_0xfd38('0x69')][_0x5d504e][_0x23668c[_0x1cf43c]]){var _0xb2d72d=_[_0xfd38('0x6d')](_0x15bf9e[_0xfd38('0x69')][_0x5d504e][_0x23668c[_0x1cf43c]][_0xfd38('0x6e')](/"/g,'\x27'));switch(_0x1cf43c){case _0xfd38('0x31'):var _0x432853=moment(_0xb2d72d,_0xfd38('0x6f'),!![]);if(_0x432853[_0xfd38('0x70')]()){_0x431c64[_0xfd38('0x1b')]('\x22'+_0xb2d72d+'\x22');}else{_0x4e8d12[_0xfd38('0x1b')](_0xfd38('0x71'));}break;case _0xfd38('0x35'):var _0x3662f3=parseInt(_0xb2d72d);_0xb2d72d=_[_0xfd38('0x72')](_0x3662f3)||_0x3662f3<0x0||_0x3662f3>0x4?_0x118ace?0x3:0x2:_0x3662f3;_0x431c64[_0xfd38('0x1b')]('\x22'+_0xb2d72d+'\x22');break;case _0xfd38('0x36'):var _0x300d9f=parseInt(_0xb2d72d);if(_[_0xfd38('0x73')](_0x300d9f)&&_[_0xfd38('0x74')](_0x148a73,_0x300d9f)){_0x431c64[_0xfd38('0x1b')]('\x22'+_0x300d9f+'\x22');}else{_0x4e8d12['push'](_0xfd38('0x75'));}break;case _0xfd38('0x76'):if(isEmail(_0xb2d72d)){_0x431c64[_0xfd38('0x1b')]('\x22'+_0xb2d72d+'\x22');}else{_0x4e8d12[_0xfd38('0x1b')](_0xfd38('0x77'));}break;case _0xfd38('0x78'):var _0x1723c5=moment(_0xb2d72d,_0xfd38('0x79'),!![]);if(_0x1723c5[_0xfd38('0x70')]()){_0x431c64['push']('\x22'+_0xb2d72d+'\x22');}else{_0x4e8d12['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x431c64[_0xfd38('0x1b')]('\x22'+_0xb2d72d+'\x22');}}else{switch(_0x1cf43c){case _0xfd38('0x7a'):case'phone':_0x4e8d12[_0xfd38('0x1b')](_0x1cf43c+'\x20not\x20specified');break;default:_0x431c64[_0xfd38('0x1b')]('\x22\x22');}}}}else{var _0x303243='';if(!_[_0xfd38('0x1a')](_0xfa2957)){if(!_0x59a645[_0xfd38('0x7b')](_0xfa2957['id'])){for(var _0x2557eb=0x0;_0x2557eb<_0x23668c[_0x1cf43c]['length'];_0x2557eb++){var _0xb2d72d=_[_0xfd38('0x6d')](_0x15bf9e[_0xfd38('0x69')][_0x5d504e][_0x23668c[_0x1cf43c][_0x2557eb]][_0xfd38('0x6e')](/"/g,'\x27'));var _0x32cc09=phoneDescriptions[_0xfd38('0x6b')](_0x2af523=>_0x2af523['itemTypeId']===_0xfa2957['id']);if(!_[_0xfd38('0x1a')](_0x32cc09)){var _0x53b28d=_[_0xfd38('0x6d')](_0x15bf9e[_0xfd38('0x69')][_0x5d504e][_0x23668c[_0x32cc09[_0xfd38('0x7c')]][0x0]][_0xfd38('0x6e')](/"/g,'\x27'));if(!_[_0xfd38('0x1a')](_0x53b28d))_0xb2d72d=_0xb2d72d+'§'+_0x53b28d;}if(_0x303243=='')_0x303243=_0xb2d72d;else _0x303243+='|'+_0xb2d72d;}_0x348ecf[_0xfd38('0x1b')](_0xfa2957['id']+':'+_0x303243);_0x59a645[_0xfa2957['id']]=0x1;}}}}if(hasAdditionalPhones){_0x431c64[_0xfd38('0x1b')]('\x22'+_0x348ecf[_0xfd38('0x12')](';')+'\x22');}if(_0x4e8d12['length']){handleError(_0x15bf9e[_0xfd38('0x69')][_0x5d504e],{'code':_0xfd38('0x7d'),'message':_0x4e8d12[_0xfd38('0x12')]()});}else{fs[_0xfd38('0x7e')](_0x31bd40,_0x431c64[_0xfd38('0x12')]()+'\x0a');}_0x431c64=[];}if(!(stats[_0xfd38('0x6a')]%0xc8)){socket[_0xfd38('0x7f')](_0xfd38('0x80')+_0x822583,stats);stats[_0xfd38('0x59')]=[];}}if(stopped){logger[_0xfd38('0x56')](_0xfd38('0x81'));_0x5df93b['abort']();}}catch(_0xb1be2f){handleError(_0x15bf9e['data'][_0x5d504e],{'code':_0xfd38('0x82'),'message':_0xb1be2f['message']});logger[_0xfd38('0x57')]('step',_0xb1be2f[_0xfd38('0x1e')]);}},'complete':function(){try{var _0x353a08=[];var _0x6e2303=tempTableName;_0x353a08[_0xfd38('0x1b')](_0xfd38('0x83')+_0x6e2303+_0xfd38('0x84'));logger[_0xfd38('0x56')]('CIS\x20len',contactItemTypes[_0xfd38('0x19')]);var _0x32fc81=util['format'](_0xfd38('0x85'),_0x31bd40,_0x6e2303,_0x2e77b3,_0x2bf4e4[_0xfd38('0x44')],_0x2bf4e4[_0xfd38('0x86')]||null,NOW,NOW);if(_[_0xfd38('0x1a')](_0x23668c[_0xfd38('0x31')])){_0x32fc81+=_0xfd38('0x87');}_0x353a08['push'](_0x32fc81);BPromise[_0xfd38('0x88')](_0x353a08,handleQuery)['then'](function(_0x39fc39){BPromise['all']([handleAdditionalPhones()])[_0xfd38('0x1d')](function(){_0x353a08=[];for(var _0x1bedef=0x0;_0x1bedef_0xbeffe5[_0xf419('0x67')]===_0xeda639);let _0x2031bb=contactItemTypes[_0xf419('0x6f')](_0x544b6b=>_0x544b6b[_0xf419('0x67')]+_0xf419('0x70')===_0xeda639);if(_[_0xf419('0x23')](_0x3581d0)&&_[_0xf419('0x23')](_0x2031bb)){if(_0x57a25b[_0xf419('0x71')](_0xeda639)){if(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f][_0x57a25b[_0xeda639]]){var _0x1bf951=_[_0xf419('0x72')](_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f][_0x57a25b[_0xeda639]][_0xf419('0x73')](/"/g,'\x27'));switch(_0xeda639){case _0xf419('0x37'):var _0x27d22f=moment(_0x1bf951,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x27d22f[_0xf419('0x74')]()){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x75'));}break;case _0xf419('0x76'):var _0x31d900=parseInt(_0x1bf951);_0x1bf951=_[_0xf419('0x77')](_0x31d900)||_0x31d900<0x0||_0x31d900>0x4?_0x5b9484?0x3:0x2:_0x31d900;_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');break;case _0xf419('0x78'):var _0x33f561=parseInt(_0x1bf951);if(_[_0xf419('0x79')](_0x33f561)&&_[_0xf419('0x7a')](_0x4c0214,_0x33f561)){_0x23e815[_0xf419('0x1e')]('\x22'+_0x33f561+'\x22');}else{_0x47185d['push'](_0xf419('0x7b'));}break;case _0xf419('0x7c'):if(isEmail(_0x1bf951)){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x7d'));}break;case'dateOfBirth':var _0x4fbf8b=moment(_0x1bf951,_0xf419('0x7e'),!![]);if(_0x4fbf8b['isValid']()){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x7f'));}break;default:_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}}else{switch(_0xeda639){case _0xf419('0x80'):case _0xf419('0x36'):_0x47185d['push'](_0xeda639+_0xf419('0x81'));break;default:_0x23e815['push']('\x22\x22');}}}}else{var _0x393960='';if(!_['isNil'](_0x3581d0)){if(!_0x4b6fbe[_0xf419('0x71')](_0x3581d0['id'])){for(var _0x444796=0x0;_0x444796<_0x57a25b[_0xeda639][_0xf419('0x1c')];_0x444796++){var _0x1bf951=_['trim'](_0x2ebcf5['data'][_0x41cf1f][_0x57a25b[_0xeda639][_0x444796]][_0xf419('0x73')](/"/g,'\x27'));var _0x416568=phoneDescriptions[_0xf419('0x6f')](_0x177bba=>_0x177bba[_0xf419('0x82')]===_0x3581d0['id']);if(!_[_0xf419('0x23')](_0x416568)){var _0xb266db=_[_0xf419('0x72')](_0x2ebcf5['data'][_0x41cf1f][_0x57a25b[_0x416568['description']][0x0]][_0xf419('0x73')](/"/g,'\x27'));if(!_[_0xf419('0x23')](_0xb266db))_0x1bf951=_0x1bf951+'§'+_0xb266db;}if(_0x393960=='')_0x393960=_0x1bf951;else _0x393960+='|'+_0x1bf951;}_0x3455db['push'](_0x3581d0['id']+':'+_0x393960);_0x4b6fbe[_0x3581d0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x23e815[_0xf419('0x1e')]('\x22'+_0x3455db[_0xf419('0x14')](';')+'\x22');}if(_0x47185d[_0xf419('0x1c')]){handleError(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f],{'code':_0xf419('0x83'),'message':_0x47185d[_0xf419('0x14')]()});}else{fs['appendFileSync'](_0x3ae9ee,_0x23e815[_0xf419('0x14')]()+'\x0a');}_0x23e815=[];}if(!(stats[_0xf419('0x6c')]%0xc8)){socket['emit'](_0xf419('0x84')+_0x5255e2,stats);stats[_0xf419('0x6d')]=[];}}if(stopped){logger[_0xf419('0x68')](_0xf419('0x85'));_0x5b9986[_0xf419('0x86')]();}}catch(_0x8aa272){handleError(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f],{'code':_0xf419('0x87'),'message':_0x8aa272[_0xf419('0x5a')]});logger[_0xf419('0x22')](_0xf419('0x88'),_0x8aa272[_0xf419('0x5a')]);}},'complete':function(){try{var _0x5c5820=[];var _0xb65620=tempTableName;_0x5c5820[_0xf419('0x1e')]('CREATE\x20TABLE\x20'+_0xb65620+'\x20LIKE\x20cm_contacts;');logger[_0xf419('0x68')]('CIS\x20len',contactItemTypes['length']);var _0x5a061b=util[_0xf419('0x89')](_0xf419('0x8a'),_0x3ae9ee,_0xb65620,_0x165fc4,_0x66d285[_0xf419('0x39')],_0x66d285[_0xf419('0x53')]||null,NOW,NOW);if(_[_0xf419('0x23')](_0x57a25b[_0xf419('0x37')])){_0x5a061b+=_0xf419('0x8b');}_0x5c5820[_0xf419('0x1e')](_0x5a061b);BPromise[_0xf419('0x8c')](_0x5c5820,handleQuery)[_0xf419('0x20')](function(_0x4ace0d){BPromise[_0xf419('0x1f')]([handleAdditionalPhones()])[_0xf419('0x20')](function(){_0x5c5820=[];for(var _0x30045a=0x0;_0x30045a\x20\x20');}var _0x46ee18=path[_0xf419('0x14')](config[_0xf419('0x63')],_0xf419('0x97'),process['argv'][0x2]);if(!fs['existsSync'](_0x46ee18)){throw new Error(_0xf419('0x98'));}var _0x2a0fb1={};try{_0x2a0fb1=JSON[_0xf419('0x6a')](process[_0xf419('0x96')][0x3]);if(!_0x2a0fb1['binding']){throw new Error(_0xf419('0x99'));}var _0x54abc3=0x0;if(_0x2a0fb1[_0xf419('0x60')]['UserId']){_0x54abc3=0x1;}if(!_0x2a0fb1['ListId']){throw new Error(_0xf419('0x9a'));}}catch(_0x45b6fd){throw new Error('body\x20id\x20mandatory');}var _0x2b7f36=[];try{_0x2b7f36=_[_0xf419('0x9b')](JSON[_0xf419('0x6a')](process[_0xf419('0x96')][0x4]),'id');}catch(_0x5ab876){logger['info'](_0xf419('0x9c'));}main(_0x46ee18,_0x2a0fb1,_0x2b7f36,_0x54abc3);}validate();process['on'](_0xf419('0x9d'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 6a1beb3..30195ba 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 _0xfcb4=['holdtime','Talk\x20Time','talktime','Called\x20Number','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','push','queue','variable','outbound','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time'];(function(_0x9ac91d,_0x434001){var _0x458709=function(_0x995c26){while(--_0x995c26){_0x9ac91d['push'](_0x9ac91d['shift']());}};_0x458709(++_0x434001);}(_0xfcb4,0x167));var _0x4fcb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfcb4[_0xa464c9];return _0x3d73c4;};'use strict';exports[_0x4fcb('0x0')]=function(_0x3558af,_0x461751){var _0x20f58b=[{'type':_0x4fcb('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x3558af[_0x4fcb('0x2')]()){case _0x4fcb('0x3'):switch(_0x461751['toLowerCase']()){case'inbound':_0x20f58b[_0x4fcb('0x4')]({'type':'variable','content':'','variableName':_0x4fcb('0x5')});_0x20f58b[_0x4fcb('0x4')]({'type':_0x4fcb('0x6'),'content':'','variableName':'calleridnum'});break;case _0x4fcb('0x7'):_0x20f58b[_0x4fcb('0x4')]({'type':_0x4fcb('0x1'),'content':'Outbound\x20Call','variableName':null});_0x20f58b[_0x4fcb('0x4')]({'type':'variable','content':'','variableName':_0x4fcb('0x8')});break;}}return _0x20f58b;};exports[_0x4fcb('0x9')]=function(_0x6a44d3,_0x3be8a4){var _0x232964=[];switch(_0x6a44d3[_0x4fcb('0x2')]()){case _0x4fcb('0x3'):switch(_0x3be8a4[_0x4fcb('0x2')]()){case _0x4fcb('0xa'):_0x232964=[{'type':_0x4fcb('0x1'),'content':_0x4fcb('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x4fcb('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x4fcb('0x6'),'variableName':'calleridnum'},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0xd'),'keyType':_0x4fcb('0x6'),'variableName':_0x4fcb('0xe')},{'type':_0x4fcb('0xc'),'content':'','key':'Call\x20To','keyType':_0x4fcb('0x6'),'variableName':_0x4fcb('0xf')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x10'),'keyType':'variable','variableName':_0x4fcb('0x5')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x11'),'keyType':_0x4fcb('0x6'),'variableName':_0x4fcb('0x12')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x13'),'keyType':'variable','variableName':'agentcalledAt'},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x14'),'keyType':'variable','variableName':_0x4fcb('0x15')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x16'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x4fcb('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x17'),'keyType':_0x4fcb('0x6'),'variableName':'agentcalledAt'},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x18'),'keyType':_0x4fcb('0x6'),'variableName':'agentconnectAt'},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x19'),'keyType':'variable','variableName':_0x4fcb('0x1a')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x1b'),'keyType':_0x4fcb('0x6'),'variableName':_0x4fcb('0x1c')},{'type':'keyValue','content':'','key':_0x4fcb('0x1d'),'keyType':_0x4fcb('0x6'),'variableName':_0x4fcb('0x1e')}];break;case _0x4fcb('0x7'):_0x232964=[{'type':_0x4fcb('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0x4fcb('0x1f'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x8')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x4fcb('0x20')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x11'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x12')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x13'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x21')},{'type':_0x4fcb('0x1'),'content':_0x4fcb('0x22')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x23'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x24')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x25'),'keyType':'variable','keyContent':'','variableName':_0x4fcb('0x26')},{'type':_0x4fcb('0xc'),'content':'','key':_0x4fcb('0x27'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x28')},{'type':'keyValue','content':'','key':_0x4fcb('0x29'),'keyType':_0x4fcb('0x6'),'keyContent':'','variableName':_0x4fcb('0x2a')}];break;}}return _0x232964;}; \ No newline at end of file +var _0xa769=['Agent\x20Number','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','Date','starttime','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','uniqueid','agentcalledAt','string','***\x20Agent\x20Info\x20***','destcalleridname'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa769,0x17a));var _0x9a76=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa769[_0x126558];return _0x1f6d14;};'use strict';exports[_0x9a76('0x0')]=function(_0x3fdfa3,_0x19b8c3){var _0x3612b0=[{'type':'string','content':_0x9a76('0x1'),'variableName':null}];switch(_0x3fdfa3[_0x9a76('0x2')]()){case'voice':switch(_0x19b8c3[_0x9a76('0x2')]()){case _0x9a76('0x3'):_0x3612b0[_0x9a76('0x4')]({'type':_0x9a76('0x5'),'content':'','variableName':_0x9a76('0x6')});_0x3612b0[_0x9a76('0x4')]({'type':_0x9a76('0x5'),'content':'','variableName':_0x9a76('0x7')});break;case'outbound':_0x3612b0['push']({'type':'string','content':_0x9a76('0x8'),'variableName':null});_0x3612b0[_0x9a76('0x4')]({'type':_0x9a76('0x5'),'content':'','variableName':_0x9a76('0x9')});break;}}return _0x3612b0;};exports[_0x9a76('0xa')]=function(_0x2c4a5c,_0x91b76e){var _0x1a0aa0=[];switch(_0x2c4a5c['toLowerCase']()){case _0x9a76('0xb'):switch(_0x91b76e[_0x9a76('0x2')]()){case _0x9a76('0x3'):_0x1a0aa0=[{'type':'string','content':_0x9a76('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0xe'),'keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x7')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0xf'),'keyType':'variable','variableName':'calleridname'},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x10')},{'type':_0x9a76('0xd'),'content':'','key':'Queue','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x6')},{'type':_0x9a76('0xd'),'content':'','key':'UniqueId','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x11')},{'type':_0x9a76('0xd'),'content':'','key':'Date','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x12')},{'type':_0x9a76('0x13'),'content':_0x9a76('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x9a76('0xd'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x9a76('0x15')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x16'),'keyType':'variable','variableName':_0x9a76('0x9')},{'type':_0x9a76('0x13'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x17'),'keyType':_0x9a76('0x5'),'variableName':'agentcalledAt'},{'type':_0x9a76('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x18')},{'type':_0x9a76('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x9a76('0x5'),'variableName':_0x9a76('0x19')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x1a'),'keyType':'variable','variableName':_0x9a76('0x1b')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x1c'),'keyType':_0x9a76('0x5'),'variableName':'talktime'}];break;case'outbound':_0x1a0aa0=[{'type':'string','content':_0x9a76('0xc'),'variableName':null},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x1d'),'keyType':_0x9a76('0x5'),'keyContent':'','variableName':_0x9a76('0x9')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x1e'),'keyType':_0x9a76('0x5'),'keyContent':'','variableName':'membername'},{'type':_0x9a76('0xd'),'content':'','key':'UniqueId','keyType':_0x9a76('0x5'),'keyContent':'','variableName':_0x9a76('0x11')},{'type':'keyValue','content':'','key':_0x9a76('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x9a76('0x20')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x9a76('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x9a76('0x21')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x22'),'keyType':'variable','keyContent':'','variableName':_0x9a76('0x23')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x24'),'keyType':'variable','keyContent':'','variableName':_0x9a76('0x25')},{'type':_0x9a76('0xd'),'content':'','key':_0x9a76('0x26'),'keyType':_0x9a76('0x5'),'keyContent':'','variableName':_0x9a76('0x27')}];break;}}return _0x1a0aa0;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 295366f..6c8447b 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 _0xf2a6=['tracked','user','body','html','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','info','catch','error'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xf2a6,0xb4));var _0x6f2a=function(_0x586936,_0x3d3f05){_0x586936=_0x586936-0x0;var _0x12e538=_0xf2a6[_0x586936];return _0x12e538;};'use strict';var _=require(_0x6f2a('0x0'));var db=require(_0x6f2a('0x1'))['db'];var loggers={'openchannel':require(_0x6f2a('0x2'))('openchannel-interactions'),'mail':require(_0x6f2a('0x2'))(_0x6f2a('0x3')),'fax':require(_0x6f2a('0x2'))(_0x6f2a('0x4')),'sms':require(_0x6f2a('0x2'))(_0x6f2a('0x5')),'chat':require(_0x6f2a('0x2'))(_0x6f2a('0x6')),'whatsapp':require('../../config/logger')(_0x6f2a('0x7'))};function getInteractionId(_0x49eca4,_0x4ab5c1,_0x17f2f1){if(_0x49eca4&&_0x49eca4[_['upperFirst'](_0x17f2f1)+_0x6f2a('0x8')]){return _0x49eca4[_[_0x6f2a('0x9')](_0x17f2f1)+'InteractionId'];}else if(_0x49eca4&&_0x49eca4['id']){return _0x49eca4['id'];}else if(_0x4ab5c1&&_0x4ab5c1['id']){return _0x4ab5c1['id'];}else{return'unknown';}}function log(_0x1c34c8,_0x4f6c8f,_0x2b43dc,_0x445023,_0x47dabd,_0xada870){loggers[_0x47dabd[_0x6f2a('0xa')]()][_0x1c34c8](_0x6f2a('0xb'),_0xada870[_0x6f2a('0xc')](),_0x4f6c8f?_0x4f6c8f['id']:null,_0x4f6c8f?_0x4f6c8f[_0x6f2a('0xd')]:null,_0x4f6c8f?_0x4f6c8f[_0x6f2a('0xe')]:null,getInteractionId(_0x2b43dc,_0x445023,_0x47dabd),_0x2b43dc?JSON[_0x6f2a('0xf')](_0x2b43dc):_0x6f2a('0x10'));}function updateUser(_0x469cd9,_0xb4cf93,_0xd81f85,_0x58cb04,_0x3c3ecd){db[_[_0x6f2a('0x9')](_0x58cb04)+'Interaction'][_0x6f2a('0x11')]({'where':{'id':getInteractionId(_0xb4cf93,_0xd81f85,_0x58cb04)}})[_0x6f2a('0x12')](function(_0x575f13){if(_0x575f13){return _0x575f13[_0x6f2a('0x13')]({'UserId':_0x469cd9?_0x469cd9['id']:null});}})[_0x6f2a('0x12')](function(_0x57615f){if(_0x57615f){log(_0x6f2a('0x14'),_0x469cd9,_0xb4cf93,_0xd81f85,_0x58cb04,_0x3c3ecd);}})[_0x6f2a('0x15')](function(){log(_0x6f2a('0x16'),_0x469cd9,_0xb4cf93,_0xd81f85,_0x58cb04,_0x3c3ecd);});}exports[_0x6f2a('0x17')]=function(_0xfc8f6e,_0x1d80c5){return function(_0x1cb0d9,_0x5e64db,_0x4cd43c){var _0x337807=_0x1cb0d9[_0x6f2a('0x18')];var _0x263aff={};var _0x43883c=_0x1cb0d9['query'];if(_0x263aff){_0x263aff=_['clone'](_0x1cb0d9[_0x6f2a('0x19')]);_0x263aff=_['omit'](_0x263aff,[_0x6f2a('0x19'),_0x6f2a('0x1a'),'phone',_0x6f2a('0x1b'),_0x6f2a('0x1c')]);}updateUser(_0x337807,_0x263aff,_0x43883c,_0xfc8f6e,_0x1d80c5);_0x4cd43c(null);};}; \ No newline at end of file +var _0xc1e3=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','body','omit','html','phone','fax','mobile'];(function(_0x169a3c,_0x1a0ebc){var _0x53b380=function(_0x1140b3){while(--_0x1140b3){_0x169a3c['push'](_0x169a3c['shift']());}};_0x53b380(++_0x1a0ebc);}(_0xc1e3,0x1d1));var _0x3c1e=function(_0x1f4916,_0x3f7b8a){_0x1f4916=_0x1f4916-0x0;var _0x3bb951=_0xc1e3[_0x1f4916];return _0x3bb951;};'use strict';var _=require(_0x3c1e('0x0'));var db=require(_0x3c1e('0x1'))['db'];var loggers={'openchannel':require(_0x3c1e('0x2'))(_0x3c1e('0x3')),'mail':require(_0x3c1e('0x2'))(_0x3c1e('0x4')),'fax':require(_0x3c1e('0x2'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x3c1e('0x2'))(_0x3c1e('0x5')),'whatsapp':require(_0x3c1e('0x2'))(_0x3c1e('0x6'))};function getInteractionId(_0x2207ae,_0x2213fd,_0x2913b2){if(_0x2207ae&&_0x2207ae[_[_0x3c1e('0x7')](_0x2913b2)+_0x3c1e('0x8')]){return _0x2207ae[_[_0x3c1e('0x7')](_0x2913b2)+_0x3c1e('0x8')];}else if(_0x2207ae&&_0x2207ae['id']){return _0x2207ae['id'];}else if(_0x2213fd&&_0x2213fd['id']){return _0x2213fd['id'];}else{return _0x3c1e('0x9');}}function log(_0x40bbbe,_0x1b7b95,_0x447581,_0x5038d4,_0x1192f8,_0x4a081a){loggers[_0x1192f8['toLowerCase']()][_0x40bbbe](_0x3c1e('0xa'),_0x4a081a[_0x3c1e('0xb')](),_0x1b7b95?_0x1b7b95['id']:null,_0x1b7b95?_0x1b7b95[_0x3c1e('0xc')]:null,_0x1b7b95?_0x1b7b95[_0x3c1e('0xd')]:null,getInteractionId(_0x447581,_0x5038d4,_0x1192f8),_0x447581?JSON['stringify'](_0x447581):_0x3c1e('0xe'));}function updateUser(_0x557c89,_0x175035,_0x5ec7e6,_0x53b520,_0xc5a3fa){db[_[_0x3c1e('0x7')](_0x53b520)+_0x3c1e('0xf')][_0x3c1e('0x10')]({'where':{'id':getInteractionId(_0x175035,_0x5ec7e6,_0x53b520)}})[_0x3c1e('0x11')](function(_0x1b290a){if(_0x1b290a){return _0x1b290a[_0x3c1e('0x12')]({'UserId':_0x557c89?_0x557c89['id']:null});}})[_0x3c1e('0x11')](function(_0xc375be){if(_0xc375be){log(_0x3c1e('0x13'),_0x557c89,_0x175035,_0x5ec7e6,_0x53b520,_0xc5a3fa);}})[_0x3c1e('0x14')](function(){log(_0x3c1e('0x15'),_0x557c89,_0x175035,_0x5ec7e6,_0x53b520,_0xc5a3fa);});}exports[_0x3c1e('0x16')]=function(_0x1ac5d6,_0x4ead54){return function(_0x428529,_0x1f6f5f,_0x18fe3e){var _0x22a4e5=_0x428529[_0x3c1e('0x17')];var _0x5399da={};var _0xa607fd=_0x428529[_0x3c1e('0x18')];if(_0x5399da){_0x5399da=_['clone'](_0x428529[_0x3c1e('0x19')]);_0x5399da=_[_0x3c1e('0x1a')](_0x5399da,[_0x3c1e('0x19'),_0x3c1e('0x1b'),_0x3c1e('0x1c'),_0x3c1e('0x1d'),_0x3c1e('0x1e')]);}updateUser(_0x22a4e5,_0x5399da,_0xa607fd,_0x1ac5d6,_0x4ead54);_0x18fe3e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index cacdc09..610d61c 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 _0x9f69=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user'];(function(_0x4cd511,_0x5e9aa3){var _0x31bfde=function(_0x5448d6){while(--_0x5448d6){_0x4cd511['push'](_0x4cd511['shift']());}};_0x31bfde(++_0x5e9aa3);}(_0x9f69,0x1a5));var _0x99f6=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0x9f69[_0x4f83ca];return _0x1fbac3;};'use strict';var crypto=require(_0x99f6('0x0'));var util=require(_0x99f6('0x1'));var compose=require(_0x99f6('0x2'));var db=require(_0x99f6('0x3'))['db'];var config=require(_0x99f6('0x4'));function getValueFromLicense(_0x2e44fc,_0x4e4df4){if(_0x2e44fc&&_0x4e4df4){if(_0x4e4df4[_0x99f6('0x5')]&&_0x4e4df4[_0x99f6('0x6')]){var _0x5b74eb=_0x4e4df4[_0x99f6('0x5')];var _0x300460=_0x4e4df4[_0x99f6('0x6')];var _0x4617ab=_0x5b74eb['split']('-')[0x4];var _0x4230fd=_0x5b74eb[_0x99f6('0x7')]('-')[0x0];var _0x300d8e=crypto[_0x99f6('0x8')](_0x99f6('0x9'),util['format'](_0x99f6('0xa'),_0x4617ab,_0x5b74eb,_0x4230fd));var _0x201960=_0x300d8e['update'](_0x300460,_0x99f6('0xb'),_0x99f6('0xc'));_0x201960+=_0x300d8e[_0x99f6('0xd')](_0x99f6('0xc'));var _0xad8b67=JSON[_0x99f6('0xe')](_0x201960);return _0xad8b67[_0x99f6('0xf')](_0x2e44fc)?_0xad8b67[_0x2e44fc]:null;}}return null;}function isLimit(_0x4c6718,_0x421d4c,_0x1efc55,_0x1b3663){var _0x44a486=_0x421d4c;return compose()[_0x99f6('0x10')](function(_0x578bca,_0x1ead09,_0x579382){return db[_0x99f6('0x11')][_0x99f6('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x99f6('0x13')](function(_0x55200b){var _0x459ceb=getValueFromLicense(_0x4c6718,_0x55200b);return _0x459ceb?_0x459ceb:_0x44a486;})[_0x99f6('0x13')](function(_0x56125d){_0x44a486=_0x56125d;return _0x1efc55['count'](_0x1b3663);})['then'](function(_0x5cfcce){if(_0x5cfcce>=_0x44a486){return _0x1ead09[_0x99f6('0x14')](0x193)[_0x99f6('0x15')]({'message':util[_0x99f6('0x16')](_0x99f6('0x17'),_0x4c6718)});}_0x579382();})[_0x99f6('0x18')](function(_0x19cd72){_0x579382(_0x19cd72);});});}function isUserLimit(){return isLimit(_0x99f6('0x19'),0x1,db[_0x99f6('0x1a')],{'where':{'$or':[{'role':_0x99f6('0x1b')},{'role':_0x99f6('0x1c')}]}});}exports[_0x99f6('0x1d')]=isUserLimit; \ No newline at end of file +var _0xd08d=['split','aes-256-ctr','%s:%s:%s','base64','utf8','final','use','License','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license'];(function(_0x5c3787,_0x3d3d10){var _0x4be8a4=function(_0x47557d){while(--_0x47557d){_0x5c3787['push'](_0x5c3787['shift']());}};_0x4be8a4(++_0x3d3d10);}(_0xd08d,0xa9));var _0xdd08=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd08d[_0x4b2863];return _0x567d67;};'use strict';var crypto=require(_0xdd08('0x0'));var util=require(_0xdd08('0x1'));var compose=require(_0xdd08('0x2'));var db=require(_0xdd08('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x8dfd49,_0x427796){if(_0x8dfd49&&_0x427796){if(_0x427796[_0xdd08('0x4')]&&_0x427796['license']){var _0x403a1e=_0x427796[_0xdd08('0x4')];var _0x48ede5=_0x427796[_0xdd08('0x5')];var _0x50494c=_0x403a1e['split']('-')[0x4];var _0x2fedb0=_0x403a1e[_0xdd08('0x6')]('-')[0x0];var _0xed0897=crypto['createDecipher'](_0xdd08('0x7'),util['format'](_0xdd08('0x8'),_0x50494c,_0x403a1e,_0x2fedb0));var _0x3f73ef=_0xed0897['update'](_0x48ede5,_0xdd08('0x9'),_0xdd08('0xa'));_0x3f73ef+=_0xed0897[_0xdd08('0xb')]('utf8');var _0x57394f=JSON['parse'](_0x3f73ef);return _0x57394f['hasOwnProperty'](_0x8dfd49)?_0x57394f[_0x8dfd49]:null;}}return null;}function isLimit(_0x1fd0bb,_0x111b5f,_0xe31322,_0x35c124){var _0x384408=_0x111b5f;return compose()[_0xdd08('0xc')](function(_0x1d6c87,_0x3fb8d8,_0x5f0877){return db[_0xdd08('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdd08('0xe')](function(_0x47c6b1){var _0x17bb74=getValueFromLicense(_0x1fd0bb,_0x47c6b1);return _0x17bb74?_0x17bb74:_0x384408;})[_0xdd08('0xe')](function(_0x5a7a92){_0x384408=_0x5a7a92;return _0xe31322['count'](_0x35c124);})[_0xdd08('0xe')](function(_0xff8b0){if(_0xff8b0>=_0x384408){return _0x3fb8d8[_0xdd08('0xf')](0x193)[_0xdd08('0x10')]({'message':util[_0xdd08('0x11')](_0xdd08('0x12'),_0x1fd0bb)});}_0x5f0877();})[_0xdd08('0x13')](function(_0x40f01f){_0x5f0877(_0x40f01f);});});}function isUserLimit(){return isLimit(_0xdd08('0x14'),0x1,db[_0xdd08('0x15')],{'where':{'$or':[{'role':_0xdd08('0x16')},{'role':_0xdd08('0x17')}]}});}exports[_0xdd08('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0ff7cb4..36077f8 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 _0xb15e=['[$or]','and','replace','[$and]','split','length','slice','shift','forEach','filter','map','conditions','push','DATE','operator','$eq','$between','includes','$gt','$lte','value','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith'];(function(_0x236f2d,_0x2ca71b){var _0x4c62c7=function(_0x5aa1ab){while(--_0x5aa1ab){_0x236f2d['push'](_0x236f2d['shift']());}};_0x4c62c7(++_0x2ca71b);}(_0xb15e,0x192));var _0xeb15=function(_0x5bea99,_0x9af43f){_0x5bea99=_0x5bea99-0x0;var _0x40400=_0xb15e[_0x5bea99];return _0x40400;};'use strict';var _=require('lodash');var moment=require(_0xeb15('0x0'));exports[_0xeb15('0x1')]=function(_0x3a5073){var _0x2fff7e={'conditions':[]};_0x2fff7e[_0xeb15('0x2')]=_[_0xeb15('0x3')](_0x3a5073,_0xeb15('0x4'))?'or':_0xeb15('0x5');var _0x546870=_0x3a5073[_0xeb15('0x6')](_0xeb15('0x7'),'')[_0xeb15('0x6')](_0xeb15('0x4'),'')[_0xeb15('0x8')]('||');for(var _0x367adf=0x0;_0x367adf<_0x546870[_0xeb15('0x9')];_0x367adf++){var _0x5d2382=_0x546870[_0x367adf][_0xeb15('0x8')](':=');var _0xa58d76=_0x5d2382[0x0];var _0x589b9d=_0x5d2382[_0xeb15('0xa')](0x1);_0x589b9d['forEach'](function(_0x13d9e9){var _0x45d911=_0x13d9e9['split']('[')[_0xeb15('0xb')]();var _0x5ca5d5=_0x13d9e9['match'](/\[(.*?)\]/g);_0x5ca5d5[_0xeb15('0xc')](function(_0x4a9d9f){var _0x4a419f=_0x4a9d9f[_0xeb15('0x8')]('[')[_0xeb15('0xd')](function(_0x507137){return _0x507137['indexOf'](']')>-0x1;})[_0xeb15('0xe')](function(_0x4f754a){return _0x4f754a[_0xeb15('0x8')](']')[0x0];})[0x0];_0x2fff7e[_0xeb15('0xf')][_0xeb15('0x10')]({'field':_0xa58d76,'operator':_0x45d911,'value':_0x4a419f});});});}return _0x2fff7e;};exports['buildExpression']=function(_0x1ab2b6,_0x32251c,_0x163298){var _0x388eb9={};if(_0x32251c===_0xeb15('0x11')){if(_0x163298[_0xeb15('0x12')]===_0xeb15('0x13')){_0x163298['operator']=_0xeb15('0x14');_0x163298['value']+=','+_0x163298['value'];}else if(_[_0xeb15('0x15')]([_0xeb15('0x16'),_0xeb15('0x17')],_0x163298[_0xeb15('0x12')])){_0x163298['value']=moment(_0x163298[_0xeb15('0x18')])[_0xeb15('0x19')](0x1,_0xeb15('0x1a'))[_0xeb15('0x1b')]('YYYY-MM-DD');}}if(_0x163298[_0xeb15('0x1c')]){_0x32251c=_0x163298[_0xeb15('0x1c')];_0x388eb9[_0xeb15('0x1d')]=_0xeb15('0x1e')+_0x1ab2b6+'.'+_0x163298[_0xeb15('0x1f')]+_0xeb15('0x20')+_0x163298[_0xeb15('0x1c')]+')\x20'+parseOperator(_0x163298[_0xeb15('0x12')]);}else{_0x388eb9[_0xeb15('0x1d')]=_0x1ab2b6+'.'+_0x163298[_0xeb15('0x1f')]+'\x20'+parseOperator(_0x163298[_0xeb15('0x12')]);}if(_[_0xeb15('0x15')]([_0xeb15('0x21'),'$notIn'],_0x163298[_0xeb15('0x12')]))_0x388eb9[_0xeb15('0x1d')]='('+_0x388eb9[_0xeb15('0x1d')]+_0xeb15('0x22')+_0x1ab2b6+'.'+_0x163298[_0xeb15('0x1f')]+_0xeb15('0x23');_0x388eb9['value']=parseValue(_0x32251c,_0x163298[_0xeb15('0x12')],_0x163298[_0xeb15('0x18')]);return _0x388eb9;};function parseOperator(_0x5bdf6f){var _0x90e887;switch(_0x5bdf6f){case _0xeb15('0x24'):_0x90e887=_0xeb15('0x25');break;case _0xeb15('0x26'):_0x90e887=_0xeb15('0x27');break;case _0xeb15('0x13'):_0x90e887=_0xeb15('0x28');break;case'$ne':_0x90e887=_0xeb15('0x29');break;case'$substring':case _0xeb15('0x2a'):case _0xeb15('0x2b'):_0x90e887=_0xeb15('0x2c');break;case _0xeb15('0x2d'):_0x90e887=_0xeb15('0x2e');break;case _0xeb15('0x16'):_0x90e887=_0xeb15('0x2f');break;case'$lte':_0x90e887='<=\x20?';break;case _0xeb15('0x30'):_0x90e887=_0xeb15('0x31');break;case'$between':_0x90e887=_0xeb15('0x32');break;}return _0x90e887;}function parseValue(_0x339d03,_0x516976,_0x33fca4){var _0x54b486={'start':undefined,'end':undefined};switch(_0x516976){case _0xeb15('0x24'):case _0xeb15('0x26'):_0x54b486[_0xeb15('0x33')]=_0x33fca4[_0xeb15('0x8')](',');break;case _0xeb15('0x34'):_0x54b486[_0xeb15('0x33')]='%'+_0x33fca4+'%';break;case _0xeb15('0x2a'):_0x54b486[_0xeb15('0x33')]=_0x33fca4+'%';break;case _0xeb15('0x2b'):_0x54b486[_0xeb15('0x33')]='%'+_0x33fca4;break;case'$between':var _0x24f752=_0x33fca4[_0xeb15('0x8')](',');var _0x33fca4=_0x24f752['shift']();var _0x40e2cf=_0x24f752[_0xeb15('0x35')]();if(_0x339d03===_0xeb15('0x11')){_0x33fca4=moment(_0x33fca4)[_0xeb15('0x36')](0x0,!![])[_0xeb15('0x1b')]();_0x40e2cf=moment(_0x40e2cf)['utcOffset'](0x0,!![])[_0xeb15('0x19')](0x17,_0xeb15('0x37'))[_0xeb15('0x19')](0x3b,_0xeb15('0x38'))['add'](0x3b,_0xeb15('0x39'))[_0xeb15('0x1b')]();}_0x54b486={'start':_0x33fca4,'end':_0x40e2cf};break;default:_0x54b486[_0xeb15('0x33')]=_0x33fca4;break;}return _0x54b486;} \ No newline at end of file +var _0xc029=['moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','match','forEach','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','shift','pop','add','hours','minutes','lodash'];(function(_0x1a28fa,_0x592379){var _0x16224b=function(_0x23061b){while(--_0x23061b){_0x1a28fa['push'](_0x1a28fa['shift']());}};_0x16224b(++_0x592379);}(_0xc029,0x125));var _0x9c02=function(_0x40bad6,_0x1a5dc8){_0x40bad6=_0x40bad6-0x0;var _0xdfd3f2=_0xc029[_0x40bad6];return _0xdfd3f2;};'use strict';var _=require(_0x9c02('0x0'));var moment=require(_0x9c02('0x1'));exports[_0x9c02('0x2')]=function(_0x245c04){var _0x41b033={'conditions':[]};_0x41b033[_0x9c02('0x3')]=_[_0x9c02('0x4')](_0x245c04,'[$or]')?'or':_0x9c02('0x5');var _0x4a38b1=_0x245c04[_0x9c02('0x6')](_0x9c02('0x7'),'')[_0x9c02('0x6')](_0x9c02('0x8'),'')['split']('||');for(var _0x3b9d5b=0x0;_0x3b9d5b<_0x4a38b1[_0x9c02('0x9')];_0x3b9d5b++){var _0x2edd7a=_0x4a38b1[_0x3b9d5b]['split'](':=');var _0x1aa7a6=_0x2edd7a[0x0];var _0x28adf3=_0x2edd7a['slice'](0x1);_0x28adf3['forEach'](function(_0x113001){var _0x52826b=_0x113001[_0x9c02('0xa')]('[')['shift']();var _0x1ad01c=_0x113001[_0x9c02('0xb')](/\[(.*?)\]/g);_0x1ad01c[_0x9c02('0xc')](function(_0x3db49d){var _0x4b8c6c=_0x3db49d[_0x9c02('0xa')]('[')['filter'](function(_0x5855b6){return _0x5855b6['indexOf'](']')>-0x1;})['map'](function(_0x48c586){return _0x48c586['split'](']')[0x0];})[0x0];_0x41b033[_0x9c02('0xd')][_0x9c02('0xe')]({'field':_0x1aa7a6,'operator':_0x52826b,'value':_0x4b8c6c});});});}return _0x41b033;};exports[_0x9c02('0xf')]=function(_0x5b8fff,_0x190c75,_0x227e34){var _0x115735={};if(_0x190c75===_0x9c02('0x10')){if(_0x227e34[_0x9c02('0x11')]===_0x9c02('0x12')){_0x227e34['operator']=_0x9c02('0x13');_0x227e34[_0x9c02('0x14')]+=','+_0x227e34[_0x9c02('0x14')];}else if(_[_0x9c02('0x15')]([_0x9c02('0x16'),'$lte'],_0x227e34[_0x9c02('0x11')])){_0x227e34[_0x9c02('0x14')]=moment(_0x227e34[_0x9c02('0x14')])['add'](0x1,_0x9c02('0x17'))[_0x9c02('0x18')](_0x9c02('0x19'));}}if(_0x227e34[_0x9c02('0x1a')]){_0x190c75=_0x227e34[_0x9c02('0x1a')];_0x115735[_0x9c02('0x1b')]='CAST('+_0x5b8fff+'.'+_0x227e34[_0x9c02('0x1c')]+_0x9c02('0x1d')+_0x227e34[_0x9c02('0x1a')]+')\x20'+parseOperator(_0x227e34['operator']);}else{_0x115735['text']=_0x5b8fff+'.'+_0x227e34['field']+'\x20'+parseOperator(_0x227e34[_0x9c02('0x11')]);}if(_[_0x9c02('0x15')]([_0x9c02('0x1e'),_0x9c02('0x1f')],_0x227e34[_0x9c02('0x11')]))_0x115735[_0x9c02('0x1b')]='('+_0x115735[_0x9c02('0x1b')]+_0x9c02('0x20')+_0x5b8fff+'.'+_0x227e34['field']+'\x20IS\x20NULL)';_0x115735[_0x9c02('0x14')]=parseValue(_0x190c75,_0x227e34['operator'],_0x227e34['value']);return _0x115735;};function parseOperator(_0x4c47b5){var _0x1c6fed;switch(_0x4c47b5){case _0x9c02('0x21'):_0x1c6fed=_0x9c02('0x22');break;case _0x9c02('0x1f'):_0x1c6fed=_0x9c02('0x23');break;case _0x9c02('0x12'):_0x1c6fed=_0x9c02('0x24');break;case _0x9c02('0x1e'):_0x1c6fed='<>\x20?';break;case _0x9c02('0x25'):case _0x9c02('0x26'):case'$endsWith':_0x1c6fed='LIKE\x20?';break;case'$lt':_0x1c6fed='<\x20?';break;case _0x9c02('0x16'):_0x1c6fed='>\x20?';break;case'$lte':_0x1c6fed='<=\x20?';break;case _0x9c02('0x27'):_0x1c6fed=_0x9c02('0x28');break;case'$between':_0x1c6fed=_0x9c02('0x29');break;}return _0x1c6fed;}function parseValue(_0x506341,_0x4dcb58,_0xf4659){var _0x78a1c7={'start':undefined,'end':undefined};switch(_0x4dcb58){case'$in':case _0x9c02('0x1f'):_0x78a1c7['start']=_0xf4659[_0x9c02('0xa')](',');break;case _0x9c02('0x25'):_0x78a1c7[_0x9c02('0x2a')]='%'+_0xf4659+'%';break;case'$startsWith':_0x78a1c7[_0x9c02('0x2a')]=_0xf4659+'%';break;case _0x9c02('0x2b'):_0x78a1c7[_0x9c02('0x2a')]='%'+_0xf4659;break;case'$between':var _0x2a0657=_0xf4659[_0x9c02('0xa')](',');var _0xf4659=_0x2a0657[_0x9c02('0x2c')]();var _0xd5efee=_0x2a0657[_0x9c02('0x2d')]();if(_0x506341==='DATE'){_0xf4659=moment(_0xf4659)['utcOffset'](0x0,!![])[_0x9c02('0x18')]();_0xd5efee=moment(_0xd5efee)['utcOffset'](0x0,!![])[_0x9c02('0x2e')](0x17,_0x9c02('0x2f'))[_0x9c02('0x2e')](0x3b,_0x9c02('0x30'))[_0x9c02('0x2e')](0x3b,'seconds')[_0x9c02('0x18')]();}_0x78a1c7={'start':_0xf4659,'end':_0xd5efee};break;default:_0x78a1c7['start']=_0xf4659;break;}return _0x78a1c7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e925464..386b930 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 _0xb66c=['isEmpty','length','omit','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','forEach','push','join','getOptions','$id','query','model','intersection','attributes','nolimit','limit','offset','where','pick','object','filter','columns','merge','map','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','fields','split','filters','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','name','uniqueid','isArray','sort','cast','priority','unsigned','substr','DESC','col'];(function(_0xe61e71,_0x4ee5b5){var _0x1b2384=function(_0x4b09e2){while(--_0x4b09e2){_0xe61e71['push'](_0xe61e71['shift']());}};_0x1b2384(++_0x4ee5b5);}(_0xb66c,0x175));var _0xcb66=function(_0x2b9b9,_0x19b0d1){_0x2b9b9=_0x2b9b9-0x0;var _0x104dd9=_0xb66c[_0x2b9b9];return _0x104dd9;};'use strict';var _=require(_0xcb66('0x0'));var sequelize=require('sequelize');var moment=require(_0xcb66('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x55a57b){var _0x2afcb8=['ne'];try{var _0x24ea13=JSON[_0xcb66('0x2')](_0x55a57b);var _0x5f487c=Object[_0xcb66('0x3')](_0x24ea13)[0x0];return _0x2afcb8[_0xcb66('0x4')](_0x5f487c);}catch(_0x3f7cc7){return![];}}function getOperatorValue(_0x21be55){var _0x5d766d=JSON['parse'](_0x21be55);var _0x19adf5=Object[_0xcb66('0x3')](_0x5d766d)[0x0];var _0xa3993=_0x5d766d[_0x19adf5];return{['$'+_0x19adf5]:_0xa3993};}exports[_0xcb66('0x5')]=function(_0xf7bc39){var _0x58582b=null;if(_0xf7bc39){_0x58582b=_0xf7bc39[_0xcb66('0x6')](',');}return _0x58582b;};exports[_0xcb66('0x7')]=function(_0x174969,_0x25b56c){var _0x3c4ce1={};if(!_['isEmpty'](_0x174969)){_[_0xcb66('0x8')](_0x174969,function(_0x2b32ec,_0xf12828){try{if(_0x25b56c){var _0x38c2e6=_['find'](_0x25b56c,{'name':_0xf12828})||{};if(hasSequelizeOperator(_0x2b32ec)){_0x3c4ce1[_0xf12828]=getOperatorValue(_0x2b32ec);}else if(_0x38c2e6[_0xcb66('0x9')]===_0xcb66('0xa')&&_[_0xcb66('0xb')](_0x2b32ec)){var _0x2339bb=JSON['parse'](_0x2b32ec);var _0x4079ae={'$gte':moment(moment(_0x2339bb[_0xcb66('0xc')])[_0xcb66('0xd')](_0xcb66('0xe')))['utc']()[_0xcb66('0xd')](),'$lte':moment(moment(_0x2339bb['$lte'])[_0xcb66('0xd')]('YYYY-MM-DD'))[_0xcb66('0xf')]()['subtract'](0x1,'s')['format']()};_0x3c4ce1[_0xf12828]=_0x4079ae;}else if(_0x38c2e6[_0xcb66('0x10')]===_0xcb66('0x11')){_0x3c4ce1[_0xf12828]=_0x2b32ec;}else{_0x3c4ce1[_0xf12828]=_[_0xcb66('0x12')](_0x2b32ec)?_0x2b32ec:JSON[_0xcb66('0x2')](_0x2b32ec);}}else{_0x3c4ce1[_0xf12828]=_['isArray'](_0x2b32ec)?_0x2b32ec:JSON[_0xcb66('0x2')](_0x2b32ec);}}catch(_0x42ad03){_0x3c4ce1[_0xf12828]=_0x2b32ec[_0xcb66('0x6')](',');}});}return _0x3c4ce1;};exports['limit']=function(_0x2e4126){_0x2e4126=parseInt(_0x2e4126,0xa);if(!_0x2e4126||_0x2e4126<0x0){_0x2e4126=LIMIT_VALUE;}return _0x2e4126;};exports['offset']=function(_0x4165ea){_0x4165ea=parseInt(_0x4165ea,0xa);if(!_0x4165ea||_0x4165ea<0x0){_0x4165ea=0x0;}return _0x4165ea;};exports[_0xcb66('0x13')]=function(_0xdf0ba0){var _0x1ccb71,_0x540782=null;if(_0xdf0ba0){_0x1ccb71=_0xdf0ba0['split'](',');_0x540782=_['map'](_0x1ccb71,function(_0xb39b87){if(_0xb39b87['indexOf']('-')===0x0){return[_0xb39b87==='priority'?sequelize[_0xcb66('0x14')](sequelize['col'](_0xcb66('0x15')),_0xcb66('0x16')):_0xb39b87[_0xcb66('0x17')](0x1),_0xcb66('0x18')];}else{return[_0xb39b87===_0xcb66('0x15')?sequelize[_0xcb66('0x14')](sequelize[_0xcb66('0x19')]('priority'),_0xcb66('0x16')):_0xb39b87,'ASC'];}});}return _0x540782;};exports['omit']=function(_0xf89c0e,_0x37e4c8){if(_[_0xcb66('0x1a')](_0xf89c0e)){return _0xf89c0e;}if(_['isArray'](_0xf89c0e)){for(var _0x341554=0x0;_0x341554<_0xf89c0e[_0xcb66('0x1b')];_0x341554+=0x1){_0xf89c0e[_0x341554]=this[_0xcb66('0x1c')](_0xf89c0e[_0x341554],_0x37e4c8);}return _0xf89c0e;}if(!_[_0xcb66('0x1d')](_0xf89c0e)){return _0xf89c0e;}if(_['isString'](_0x37e4c8)){_0x37e4c8=[_0x37e4c8];}if(!_[_0xcb66('0x12')](_0x37e4c8)){return _0xf89c0e;}for(var _0x31560e=0x0;_0x31560e<_0x37e4c8[_0xcb66('0x1b')];_0x31560e+=0x1){_[_0xcb66('0x1e')](_0xf89c0e,_0x37e4c8[_0x31560e]);}for(var _0x37a676 in _0xf89c0e){if(_0xf89c0e[_0xcb66('0x1f')](_0x37a676)){_0xf89c0e[_0x37a676]=this[_0xcb66('0x1c')](_0xf89c0e[_0x37a676],_0x37e4c8);}}return _0xf89c0e;};exports[_0xcb66('0x20')]=function(_0x28fc0b){return _0x28fc0b[_0xcb66('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xcb66('0x22')]=function(_0x5b7cf2){return _0x5b7cf2['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x31a10a){var _0x4ca8b4=[];_0x31a10a[_0xcb66('0x6')](/[ ,]+/)[_0xcb66('0x23')](function(_0x1b8a79){_0x1b8a79=_0x1b8a79['replace'](/([^:]")"+/g,'$1');_0x1b8a79='+'+_0x1b8a79+'*';var _0x123787=/[ `!@#$%^&*()_\-?~]/;if(_0x1b8a79[_0xcb66('0x21')](_0x123787))_0x1b8a79='\x22'+_0x1b8a79+'\x22';_0x4ca8b4[_0xcb66('0x24')](_0x1b8a79);});return _0x4ca8b4[_0xcb66('0x25')]('\x20');};exports[_0xcb66('0x26')]=function(_0x375636,_0x2a5e56,_0x36dfe3){var _0x2d27f7={},_0x3e4755={};if(_0x2a5e56['query'][_0xcb66('0x27')]){_0x2a5e56[_0xcb66('0x28')]['id']=_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x27')];delete _0x2a5e56[_0xcb66('0x28')][_0xcb66('0x27')];}_0x2d27f7[_0xcb66('0x29')]=_['map'](_0x375636,_0xcb66('0x10'));_0x2d27f7[_0xcb66('0x28')]=_[_0xcb66('0x3')](_0x2a5e56[_0xcb66('0x28')]);_0x2d27f7['filters']=_[_0xcb66('0x2a')](_0x2d27f7[_0xcb66('0x29')],_0x2d27f7[_0xcb66('0x28')]);_0x3e4755[_0xcb66('0x2b')]=_[_0xcb66('0x2a')](_0x2d27f7[_0xcb66('0x29')],this[_0xcb66('0x5')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x5')]));_0x3e4755[_0xcb66('0x2b')]=_0x3e4755[_0xcb66('0x2b')][_0xcb66('0x1b')]?_0x3e4755['attributes']:_0x2d27f7['model'];if(!_0x2a5e56['query'][_0xcb66('0x1f')](_0xcb66('0x2c'))){_0x3e4755[_0xcb66('0x2d')]=this[_0xcb66('0x2d')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x2d')]);_0x3e4755['offset']=this[_0xcb66('0x2e')](_0x2a5e56['query']['offset']);}_0x3e4755['order']=this[_0xcb66('0x13')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x13')]);_0x3e4755[_0xcb66('0x2f')]=this[_0xcb66('0x7')](_[_0xcb66('0x30')](_0x2a5e56[_0xcb66('0x28')],_0x2d27f7[_0xcb66('0x7')]),_0x375636);if(_0x2a5e56[_0xcb66('0x28')]['filter']){var _0xe45331=_0x375636;var _0x3f2781=_0x2a5e56[_0xcb66('0x28')]['filter'];if(typeof _0x3f2781===_0xcb66('0x31')){_0xe45331=_[_0xcb66('0x32')](_0x375636,function(_0x4a5934){return _['includes'](_0x3f2781[_0xcb66('0x33')],_0x4a5934['name']);});_0x3f2781=_0x3f2781['value'];}_0x3e4755[_0xcb66('0x2f')]=_[_0xcb66('0x34')](_0x3e4755[_0xcb66('0x2f')],{'$or':_[_0xcb66('0x35')](_0xe45331,function(_0x99229){if(_0x99229[_0xcb66('0x9')]!==_0xcb66('0x36')){if(_0x36dfe3){return sequelize[_0xcb66('0x2f')](sequelize['fn'](_0xcb66('0x37'),sequelize['col'](_0x99229['name'])),{'$like':sequelize['fn']('lower','%'+_0x2a5e56[_0xcb66('0x28')]['filter']+'%')});}else{var _0x8736aa={};_0x8736aa[_0x99229['name']]={'$like':'%'+_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x32')]+'%'};return _0x8736aa;}}})});}_0x3e4755=_[_0xcb66('0x34')]({},_0x3e4755,_0x2a5e56[_0xcb66('0x38')]);return _0x3e4755;}; \ No newline at end of file +var _0x5292=['VIRTUAL','lower','merge','lodash','sequelize','parse','keys','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','isArray','offset','sort','split','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','attributes','intersection','fields','nolimit','limit','order','where','pick','filter','includes','columns','value'];(function(_0xe24c8a,_0x2f98ff){var _0x46b2be=function(_0x559de8){while(--_0x559de8){_0xe24c8a['push'](_0xe24c8a['shift']());}};_0x46b2be(++_0x2f98ff);}(_0x5292,0xf7));var _0x2529=function(_0x39d38e,_0x3da1f7){_0x39d38e=_0x39d38e-0x0;var _0x18e737=_0x5292[_0x39d38e];return _0x18e737;};'use strict';var _=require(_0x2529('0x0'));var sequelize=require(_0x2529('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2ec817){var _0x522ab4=['ne'];try{var _0x1540a9=JSON[_0x2529('0x2')](_0x2ec817);var _0x29576c=Object[_0x2529('0x3')](_0x1540a9)[0x0];return _0x522ab4['includes'](_0x29576c);}catch(_0x28c08d){return![];}}function getOperatorValue(_0x482dba){var _0x4c9b4c=JSON['parse'](_0x482dba);var _0x407277=Object[_0x2529('0x3')](_0x4c9b4c)[0x0];var _0x5bb8a1=_0x4c9b4c[_0x407277];return{['$'+_0x407277]:_0x5bb8a1};}exports['fields']=function(_0x395ba9){var _0x2a0306=null;if(_0x395ba9){_0x2a0306=_0x395ba9['split'](',');}return _0x2a0306;};exports[_0x2529('0x4')]=function(_0x44c8da,_0x421463){var _0x3c4885={};if(!_[_0x2529('0x5')](_0x44c8da)){_[_0x2529('0x6')](_0x44c8da,function(_0xd53f1e,_0x1e38b8){try{if(_0x421463){var _0x4f3cf9=_[_0x2529('0x7')](_0x421463,{'name':_0x1e38b8})||{};if(hasSequelizeOperator(_0xd53f1e)){_0x3c4885[_0x1e38b8]=getOperatorValue(_0xd53f1e);}else if(_0x4f3cf9[_0x2529('0x8')]==='DATE'&&_[_0x2529('0x9')](_0xd53f1e)){var _0x23bfaf=JSON[_0x2529('0x2')](_0xd53f1e);var _0xfb9ae2={'$gte':moment(moment(_0x23bfaf[_0x2529('0xa')])[_0x2529('0xb')](_0x2529('0xc')))['utc']()[_0x2529('0xb')](),'$lte':moment(moment(_0x23bfaf[_0x2529('0xd')])[_0x2529('0xb')](_0x2529('0xc')))[_0x2529('0xe')]()[_0x2529('0xf')](0x1,'s')[_0x2529('0xb')]()};_0x3c4885[_0x1e38b8]=_0xfb9ae2;}else if(_0x4f3cf9[_0x2529('0x10')]==='uniqueid'){_0x3c4885[_0x1e38b8]=_0xd53f1e;}else{_0x3c4885[_0x1e38b8]=_[_0x2529('0x11')](_0xd53f1e)?_0xd53f1e:JSON['parse'](_0xd53f1e);}}else{_0x3c4885[_0x1e38b8]=_[_0x2529('0x11')](_0xd53f1e)?_0xd53f1e:JSON[_0x2529('0x2')](_0xd53f1e);}}catch(_0x89be58){_0x3c4885[_0x1e38b8]=_0xd53f1e['split'](',');}});}return _0x3c4885;};exports['limit']=function(_0xed24cf){_0xed24cf=parseInt(_0xed24cf,0xa);if(!_0xed24cf||_0xed24cf<0x0){_0xed24cf=LIMIT_VALUE;}return _0xed24cf;};exports[_0x2529('0x12')]=function(_0x41e530){_0x41e530=parseInt(_0x41e530,0xa);if(!_0x41e530||_0x41e530<0x0){_0x41e530=0x0;}return _0x41e530;};exports[_0x2529('0x13')]=function(_0x2a1a94){var _0x556ec1,_0x428727=null;if(_0x2a1a94){_0x556ec1=_0x2a1a94[_0x2529('0x14')](',');_0x428727=_[_0x2529('0x15')](_0x556ec1,function(_0xeff5a6){if(_0xeff5a6['indexOf']('-')===0x0){return[_0xeff5a6===_0x2529('0x16')?sequelize[_0x2529('0x17')](sequelize[_0x2529('0x18')]('priority'),_0x2529('0x19')):_0xeff5a6[_0x2529('0x1a')](0x1),_0x2529('0x1b')];}else{return[_0xeff5a6===_0x2529('0x16')?sequelize['cast'](sequelize[_0x2529('0x18')](_0x2529('0x16')),_0x2529('0x19')):_0xeff5a6,_0x2529('0x1c')];}});}return _0x428727;};exports[_0x2529('0x1d')]=function(_0xbb3c1b,_0x53464a){if(_['isEmpty'](_0xbb3c1b)){return _0xbb3c1b;}if(_[_0x2529('0x11')](_0xbb3c1b)){for(var _0x40f42b=0x0;_0x40f42b<_0xbb3c1b[_0x2529('0x1e')];_0x40f42b+=0x1){_0xbb3c1b[_0x40f42b]=this[_0x2529('0x1d')](_0xbb3c1b[_0x40f42b],_0x53464a);}return _0xbb3c1b;}if(!_[_0x2529('0x1f')](_0xbb3c1b)){return _0xbb3c1b;}if(_[_0x2529('0x20')](_0x53464a)){_0x53464a=[_0x53464a];}if(!_[_0x2529('0x11')](_0x53464a)){return _0xbb3c1b;}for(var _0x2f512c=0x0;_0x2f512c<_0x53464a[_0x2529('0x1e')];_0x2f512c+=0x1){_[_0x2529('0x21')](_0xbb3c1b,_0x53464a[_0x2f512c]);}for(var _0x5852aa in _0xbb3c1b){if(_0xbb3c1b[_0x2529('0x22')](_0x5852aa)){_0xbb3c1b[_0x5852aa]=this[_0x2529('0x1d')](_0xbb3c1b[_0x5852aa],_0x53464a);}}return _0xbb3c1b;};exports['isNumeric']=function(_0x1822ce){return _0x1822ce[_0x2529('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2529('0x24')]=function(_0x1d7e98){return _0x1d7e98['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x2529('0x25')]=function(_0x1f2934){var _0x4a18f6=[];_0x1f2934[_0x2529('0x14')](/[ ,]+/)[_0x2529('0x26')](function(_0x3c2dba){_0x3c2dba=_0x3c2dba[_0x2529('0x27')](/([^:]")"+/g,'$1');_0x3c2dba='+'+_0x3c2dba+'*';var _0x24be5a=/[ `!@#$%^&*()_\-?~]/;if(_0x3c2dba['match'](_0x24be5a))_0x3c2dba='\x22'+_0x3c2dba+'\x22';_0x4a18f6[_0x2529('0x28')](_0x3c2dba);});return _0x4a18f6[_0x2529('0x29')]('\x20');};exports[_0x2529('0x2a')]=function(_0x196106,_0x363cbc,_0x3863b5){var _0x74c5ad={},_0x48cfb3={};if(_0x363cbc['query'][_0x2529('0x2b')]){_0x363cbc['query']['id']=_0x363cbc[_0x2529('0x2c')]['$id'];delete _0x363cbc['query']['$id'];}_0x74c5ad[_0x2529('0x2d')]=_[_0x2529('0x15')](_0x196106,_0x2529('0x10'));_0x74c5ad['query']=_[_0x2529('0x3')](_0x363cbc['query']);_0x74c5ad['filters']=_['intersection'](_0x74c5ad[_0x2529('0x2d')],_0x74c5ad[_0x2529('0x2c')]);_0x48cfb3[_0x2529('0x2e')]=_[_0x2529('0x2f')](_0x74c5ad[_0x2529('0x2d')],this[_0x2529('0x30')](_0x363cbc[_0x2529('0x2c')][_0x2529('0x30')]));_0x48cfb3[_0x2529('0x2e')]=_0x48cfb3[_0x2529('0x2e')][_0x2529('0x1e')]?_0x48cfb3[_0x2529('0x2e')]:_0x74c5ad[_0x2529('0x2d')];if(!_0x363cbc['query']['hasOwnProperty'](_0x2529('0x31'))){_0x48cfb3[_0x2529('0x32')]=this['limit'](_0x363cbc[_0x2529('0x2c')][_0x2529('0x32')]);_0x48cfb3[_0x2529('0x12')]=this[_0x2529('0x12')](_0x363cbc[_0x2529('0x2c')][_0x2529('0x12')]);}_0x48cfb3[_0x2529('0x33')]=this['sort'](_0x363cbc[_0x2529('0x2c')][_0x2529('0x13')]);_0x48cfb3[_0x2529('0x34')]=this['filters'](_[_0x2529('0x35')](_0x363cbc[_0x2529('0x2c')],_0x74c5ad[_0x2529('0x4')]),_0x196106);if(_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')]){var _0x33acbf=_0x196106;var _0x7ff409=_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')];if(typeof _0x7ff409==='object'){_0x33acbf=_[_0x2529('0x36')](_0x196106,function(_0x3dc6ed){return _[_0x2529('0x37')](_0x7ff409[_0x2529('0x38')],_0x3dc6ed[_0x2529('0x10')]);});_0x7ff409=_0x7ff409[_0x2529('0x39')];}_0x48cfb3[_0x2529('0x34')]=_['merge'](_0x48cfb3[_0x2529('0x34')],{'$or':_[_0x2529('0x15')](_0x33acbf,function(_0x3f76e8){if(_0x3f76e8[_0x2529('0x8')]!==_0x2529('0x3a')){if(_0x3863b5){return sequelize['where'](sequelize['fn'](_0x2529('0x3b'),sequelize[_0x2529('0x18')](_0x3f76e8[_0x2529('0x10')])),{'$like':sequelize['fn'](_0x2529('0x3b'),'%'+_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')]+'%')});}else{var _0x58620c={};_0x58620c[_0x3f76e8['name']]={'$like':'%'+_0x363cbc['query']['filter']+'%'};return _0x58620c;}}})});}_0x48cfb3=_[_0x2529('0x3c')]({},_0x48cfb3,_0x363cbc['options']);return _0x48cfb3;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6122755..decf419 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x50cb4b,_0x140d9a){var _0x53b81a=function(_0x5a5d1a){while(--_0x5a5d1a){_0x50cb4b['push'](_0x50cb4b['shift']());}};_0x53b81a(++_0x140d9a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c0da91f..959dded 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 _0x0dd0=['networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x0dd0,0x103));var _0x00dd=function(_0x37ad1b,_0x356141){_0x37ad1b=_0x37ad1b-0x0;var _0x780998=_0x0dd0[_0x37ad1b];return _0x780998;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x00dd('0x0'));var machine=require(_0x00dd('0x1'));var exec=require(_0x00dd('0x2'))[_0x00dd('0x3')];var config=require(_0x00dd('0x4'));function getInterfaces(){var _0x49d4d6=[];var _0x2ff5b0=os[_0x00dd('0x5')]();var _0x16a81f=_[_0x00dd('0x6')](_[_0x00dd('0x7')](_0x2ff5b0));for(var _0x5db410=0x0;_0x5db410<_0x16a81f['length'];_0x5db410++){var _0x1b647b=_0x2ff5b0[_0x16a81f[_0x5db410]][_0x00dd('0x8')](function(_0x8356c1){return _0x8356c1[_0x00dd('0x9')]===_0x00dd('0xa')&&_0x8356c1[_0x00dd('0xb')]===![];});_0x49d4d6=_0x49d4d6[_0x00dd('0xc')](_0x1b647b);}return _0x49d4d6;}function getFirstInterface(){var _0x5f3b4c=_['head'](getInterfaces());return{'macAddress':_0x5f3b4c&&_0x5f3b4c[_0x00dd('0xd')]?_0x5f3b4c['mac']:_0x00dd('0xe'),'ipAddress':_0x5f3b4c&&_0x5f3b4c[_0x00dd('0xf')]?_0x5f3b4c[_0x00dd('0xf')]:_0x00dd('0x10')};}exports[_0x00dd('0x11')]=getFirstInterface;function getCPUhash(){var _0x485411=_[_0x00dd('0x6')](os[_0x00dd('0x12')]()[_0x00dd('0x13')](function(_0x46b6b7){return _0x46b6b7[_0x00dd('0x14')];}))['join'](':');return crypto['createHash'](_0x00dd('0x15'))['update'](_0x485411)[_0x00dd('0x16')](_0x00dd('0x17'));}exports['getUuid']=function(){var _0x368b39=os['platform']();var _0x3ef628=/[0-9a-f-]{36}/;if(config[_0x00dd('0x18')]&&_0x3ef628[_0x00dd('0x19')](config[_0x00dd('0x18')])){return config[_0x00dd('0x18')];}else if(_0x368b39===_0x00dd('0x1a')){return exec(_0x00dd('0x1b'),{'encoding':_0x00dd('0x1c')})[_0x00dd('0x1d')]('\x0d\x0a','');}else{var _0x305bb8=getFirstInterface();var _0x3467db=getCPUhash();var _0x402d74=_0x3467db+'|'+os[_0x00dd('0x1e')]()+'|'+_0x305bb8['macAddress']+'|'+_0x305bb8[_0x00dd('0x1f')];var _0x302d55=crypto['createHash'](_0x00dd('0x15'))['update'](_0x402d74)['digest'](_0x00dd('0x17'));return _0x302d55[_0x00dd('0x20')](0x0,0x8)+'-'+_0x302d55['substring'](0x8,0xc)+'-'+_0x302d55[_0x00dd('0x20')](0xc,0x10)+'-'+_0x302d55['substring'](0x10,0x14)+'-'+_0x302d55['substring'](0x14);}}; \ No newline at end of file +var _0x8d5b=['filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0x457181,_0x1ff0ed){var _0x4e7d88=function(_0x13d143){while(--_0x13d143){_0x457181['push'](_0x457181['shift']());}};_0x4e7d88(++_0x1ff0ed);}(_0x8d5b,0x18e));var _0xb8d5=function(_0x137d2f,_0x3b714c){_0x137d2f=_0x137d2f-0x0;var _0x21664a=_0x8d5b[_0x137d2f];return _0x21664a;};'use strict';var _=require(_0xb8d5('0x0'));var os=require('os');var crypto=require(_0xb8d5('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xb8d5('0x2'))[_0xb8d5('0x3')];var config=require(_0xb8d5('0x4'));function getInterfaces(){var _0x376c69=[];var _0x3865b8=os[_0xb8d5('0x5')]();var _0x2575cc=_[_0xb8d5('0x6')](_[_0xb8d5('0x7')](_0x3865b8));for(var _0x2f618f=0x0;_0x2f618f<_0x2575cc[_0xb8d5('0x8')];_0x2f618f++){var _0xb12342=_0x3865b8[_0x2575cc[_0x2f618f]][_0xb8d5('0x9')](function(_0x503872){return _0x503872['family']===_0xb8d5('0xa')&&_0x503872[_0xb8d5('0xb')]===![];});_0x376c69=_0x376c69[_0xb8d5('0xc')](_0xb12342);}return _0x376c69;}function getFirstInterface(){var _0x5cfbb3=_[_0xb8d5('0xd')](getInterfaces());return{'macAddress':_0x5cfbb3&&_0x5cfbb3[_0xb8d5('0xe')]?_0x5cfbb3[_0xb8d5('0xe')]:_0xb8d5('0xf'),'ipAddress':_0x5cfbb3&&_0x5cfbb3[_0xb8d5('0x10')]?_0x5cfbb3[_0xb8d5('0x10')]:_0xb8d5('0x11')};}exports[_0xb8d5('0x12')]=getFirstInterface;function getCPUhash(){var _0x28c560=_[_0xb8d5('0x6')](os[_0xb8d5('0x13')]()['map'](function(_0x3f3a6a){return _0x3f3a6a[_0xb8d5('0x14')];}))[_0xb8d5('0x15')](':');return crypto[_0xb8d5('0x16')]('md5')[_0xb8d5('0x17')](_0x28c560)[_0xb8d5('0x18')](_0xb8d5('0x19'));}exports[_0xb8d5('0x1a')]=function(){var _0xbefe02=os[_0xb8d5('0x1b')]();var _0x3e9faf=/[0-9a-f-]{36}/;if(config[_0xb8d5('0x1c')]&&_0x3e9faf['test'](config[_0xb8d5('0x1c')])){return config[_0xb8d5('0x1c')];}else if(_0xbefe02===_0xb8d5('0x1d')){return exec(_0xb8d5('0x1e'),{'encoding':_0xb8d5('0x1f')})['replace']('\x0d\x0a','');}else{var _0xd5125e=getFirstInterface();var _0x36e32a=getCPUhash();var _0x21f053=_0x36e32a+'|'+os[_0xb8d5('0x20')]()+'|'+_0xd5125e[_0xb8d5('0x21')]+'|'+_0xd5125e[_0xb8d5('0x22')];var _0x219b4b=crypto[_0xb8d5('0x16')](_0xb8d5('0x23'))[_0xb8d5('0x17')](_0x21f053)[_0xb8d5('0x18')]('hex');return _0x219b4b[_0xb8d5('0x24')](0x0,0x8)+'-'+_0x219b4b[_0xb8d5('0x24')](0x8,0xc)+'-'+_0x219b4b[_0xb8d5('0x24')](0xc,0x10)+'-'+_0x219b4b['substring'](0x10,0x14)+'-'+_0x219b4b[_0xb8d5('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7050baf..bffb687 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 _0xe9dd=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe9dd,0x77));var _0xde9d=function(_0x10ed89,_0x370125){_0x10ed89=_0x10ed89-0x0;var _0x5fa716=_0xe9dd[_0x10ed89];return _0x5fa716;};'use strict';var util=require(_0xde9d('0x0'));var moment=require('moment');var rp=require(_0xde9d('0x1'));var BPromise=require(_0xde9d('0x2'));var pkginfo=require(_0xde9d('0x3'))(module,_0xde9d('0x4'));var db=require(_0xde9d('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xde9d('0x6'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35f856){return new BPromise(function(_0x3b79be,_0x1cb9c7){var _0x4cb2b0=util[_0xde9d('0x7')](_0xde9d('0x8'),HOST,_0x35f856,module[_0xde9d('0x9')][_0xde9d('0x4')]);if(oldToken){_0x4cb2b0=util[_0xde9d('0x7')](_0xde9d('0xa'),HOST,_0x35f856,module[_0xde9d('0x9')][_0xde9d('0x4')],oldToken);}var _0x3017ba={'uri':_0x4cb2b0,'method':_0xde9d('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x3017ba)[_0xde9d('0xc')](function(_0x53d069){_0x3b79be(_0x53d069);})[_0xde9d('0xd')](function(_0x5bcfcc){_0x1cb9c7(_0x5bcfcc);});});}function manageLicense(_0x34f85a,_0x4ad328){var _0x2eba92=_0x4ad328[_0xde9d('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x2eba92[_0xde9d('0xf')]!==_0x34f85a&&!_0x2eba92['data2']){oldToken=_0x2eba92[_0xde9d('0xf')];}httpRequest(_0x34f85a)[_0xde9d('0xc')](function(_0x4790fe){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4790fe[_0xde9d('0x10')]){isOldTokenSent=![];if(!_0x2eba92[_0xde9d('0x11')]&&_0x2eba92[_0xde9d('0x11')]!=_0x4790fe['license']||_0x2eba92[_0xde9d('0x11')]&&_0x2eba92[_0xde9d('0x12')]){logger['info'](_0xde9d('0x13'));}if(_0x2eba92['license']&&!_0x2eba92[_0xde9d('0x12')]&&_0x2eba92[_0xde9d('0x11')]!=_0x4790fe['license']){logger[_0xde9d('0x14')](_0xde9d('0x15'));}if(_0x2eba92[_0xde9d('0x11')]&&!_0x2eba92['data2']&&_0x2eba92['license']==_0x4790fe['license']){return _0x4ad328;}return _0x4ad328[_0xde9d('0x16')]({'data1':_0x34f85a,'data2':null,'license':_0x4790fe[_0xde9d('0x11')]});}else{if(_0x4790fe[_0xde9d('0x11')]||_0x2eba92['license']){if(!_0x2eba92[_0xde9d('0x12')]){if(_0x2eba92[_0xde9d('0xf')]==_0x34f85a){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xde9d('0x14')](_0xde9d('0x17'),_0x2eba92[_0xde9d('0xf')],_0x34f85a);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xde9d('0x18')](),moment()[_0xde9d('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x4ad328[_0xde9d('0x16')]({'data2':encryptor[_0xde9d('0x19')](moment()[_0xde9d('0x7')](_0xde9d('0x1a')))});}else{if(moment()['diff'](encryptor[_0xde9d('0x1b')](_0x2eba92[_0xde9d('0x12')]),_0xde9d('0x1c'))>DAYS){logger[_0xde9d('0x14')](_0xde9d('0x1d'),moment()[_0xde9d('0x7')](_0xde9d('0x1a')));isOldTokenSent=![];return _0x4ad328[_0xde9d('0x16')]({'data1':_0x34f85a,'data2':null,'license':null});}}}else{if(_0x2eba92['data1']!=_0x34f85a){logger[_0xde9d('0x14')](_0xde9d('0x17'),_0x2eba92[_0xde9d('0xf')],_0x34f85a);return _0x4ad328[_0xde9d('0x16')]({'data1':_0x34f85a,'data2':null,'license':null});}}}return _0x4ad328;})[_0xde9d('0xc')](function(_0x4a39a2){_0x4ad328=_0x4a39a2;})[_0xde9d('0xd')](function(_0x5c9231){logger[_0xde9d('0x1e')](_0x5c9231[_0xde9d('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4ad328);},TIME);});}function defaultLicense(){var _0x258ada=hardware['getUuid']();if(_0x258ada){return db[_0xde9d('0x20')][_0xde9d('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x258ada}})['spread'](function(_0x4a47c1,_0x3d0bdd){logger[_0xde9d('0x14')](_0xde9d('0x22'),_0x258ada);manageLicense(_0x258ada,_0x4a47c1);})[_0xde9d('0xd')](function(_0x26ba13){logger[_0xde9d('0x1e')](_0x26ba13[_0xde9d('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x48f8=['../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','version','../../mysqldb'];(function(_0x1a6dff,_0x57a55d){var _0x337ca8=function(_0xac4185){while(--_0xac4185){_0x1a6dff['push'](_0x1a6dff['shift']());}};_0x337ca8(++_0x57a55d);}(_0x48f8,0x182));var _0x848f=function(_0x596828,_0x4a0d72){_0x596828=_0x596828-0x0;var _0x24f8e4=_0x48f8[_0x596828];return _0x24f8e4;};'use strict';var util=require(_0x848f('0x0'));var moment=require('moment');var rp=require(_0x848f('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x848f('0x2'));var db=require(_0x848f('0x3'))['db'];var encryptor=require(_0x848f('0x4'));var hardware=require(_0x848f('0x5'));var logger=require(_0x848f('0x6'))(_0x848f('0x7'));var HOST=_0x848f('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4cb774){return new BPromise(function(_0x2cd92b,_0x23e0ea){var _0x29bb8c=util[_0x848f('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x4cb774,module[_0x848f('0xa')]['version']);if(oldToken){_0x29bb8c=util['format'](_0x848f('0xb'),HOST,_0x4cb774,module[_0x848f('0xa')][_0x848f('0x2')],oldToken);}var _0x142950={'uri':_0x29bb8c,'method':_0x848f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x142950)['then'](function(_0x48e4bc){_0x2cd92b(_0x48e4bc);})['catch'](function(_0x4e8b52){_0x23e0ea(_0x4e8b52);});});}function manageLicense(_0x39baa4,_0x31ec05){var _0x5e98ac=_0x31ec05['get']({'plain':!![]});if(!isOldTokenSent&&_0x5e98ac[_0x848f('0xd')]!==_0x39baa4&&!_0x5e98ac[_0x848f('0xe')]){oldToken=_0x5e98ac[_0x848f('0xd')];}httpRequest(_0x39baa4)[_0x848f('0xf')](function(_0x6b1fa4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6b1fa4[_0x848f('0x10')]){isOldTokenSent=![];if(!_0x5e98ac[_0x848f('0x7')]&&_0x5e98ac[_0x848f('0x7')]!=_0x6b1fa4['license']||_0x5e98ac[_0x848f('0x7')]&&_0x5e98ac[_0x848f('0xe')]){logger[_0x848f('0x11')](_0x848f('0x12'));}if(_0x5e98ac[_0x848f('0x7')]&&!_0x5e98ac[_0x848f('0xe')]&&_0x5e98ac[_0x848f('0x7')]!=_0x6b1fa4[_0x848f('0x7')]){logger['info'](_0x848f('0x13'));}if(_0x5e98ac[_0x848f('0x7')]&&!_0x5e98ac[_0x848f('0xe')]&&_0x5e98ac[_0x848f('0x7')]==_0x6b1fa4['license']){return _0x31ec05;}return _0x31ec05[_0x848f('0x14')]({'data1':_0x39baa4,'data2':null,'license':_0x6b1fa4[_0x848f('0x7')]});}else{if(_0x6b1fa4[_0x848f('0x7')]||_0x5e98ac[_0x848f('0x7')]){if(!_0x5e98ac[_0x848f('0xe')]){if(_0x5e98ac[_0x848f('0xd')]==_0x39baa4){GRAY_PERIOD_REASON=_0x848f('0x15');logger[_0x848f('0x11')](_0x848f('0x16'));}else{GRAY_PERIOD_REASON=_0x848f('0x17');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e98ac[_0x848f('0xd')],_0x39baa4);}logger[_0x848f('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x848f('0x18')](),moment()['format'](_0x848f('0x19')));return _0x31ec05[_0x848f('0x14')]({'data2':encryptor[_0x848f('0x1a')](moment()[_0x848f('0x9')](_0x848f('0x19')))});}else{if(moment()[_0x848f('0x1b')](encryptor[_0x848f('0x1c')](_0x5e98ac['data2']),'days')>DAYS){logger[_0x848f('0x11')](_0x848f('0x1d'),moment()[_0x848f('0x9')](_0x848f('0x19')));isOldTokenSent=![];return _0x31ec05['update']({'data1':_0x39baa4,'data2':null,'license':null});}}}else{if(_0x5e98ac[_0x848f('0xd')]!=_0x39baa4){logger[_0x848f('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e98ac['data1'],_0x39baa4);return _0x31ec05[_0x848f('0x14')]({'data1':_0x39baa4,'data2':null,'license':null});}}}return _0x31ec05;})[_0x848f('0xf')](function(_0x2f9051){_0x31ec05=_0x2f9051;})[_0x848f('0x1e')](function(_0x9932d1){logger[_0x848f('0x1f')](_0x9932d1[_0x848f('0x20')]);})[_0x848f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x848f('0x22')](),_0x31ec05);},TIME);});}function defaultLicense(){var _0x5f03a1=hardware[_0x848f('0x22')]();if(_0x5f03a1){return db['License'][_0x848f('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x5f03a1}})[_0x848f('0x24')](function(_0xaffcef,_0x3cdd29){logger[_0x848f('0x11')](_0x848f('0x25'),_0x5f03a1);manageLicense(_0x5f03a1,_0xaffcef);})['catch'](function(_0x48e9d7){logger['error'](_0x48e9d7[_0x848f('0x20')]);});}}exports[_0x848f('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 76d7380..a920904 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 _0x789f=['license','isEmpty','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','deadline','add','days','grayReason','changed','message','User','role','sequelize','col','count','telephone','users','telephones','admin','user','pick','License\x20limit\x20reached\x20for\x20users','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','then','catch','uuid','data1'];(function(_0x28444a,_0x4287ea){var _0x4797f4=function(_0x53b3af){while(--_0x53b3af){_0x28444a['push'](_0x28444a['shift']());}};_0x4797f4(++_0x4287ea);}(_0x789f,0x1b6));var _0xf789=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x789f[_0xe5b349];return _0x26b0ad;};'use strict';var util=require('util');var _=require(_0xf789('0x0'));var moment=require(_0xf789('0x1'));var BPromise=require(_0xf789('0x2'));var hardware=require(_0xf789('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xf789('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf789('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf789('0x6'),'machineUuid':hardware[_0xf789('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['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x512bfa){return new BPromise(function(_0x23a2ab,_0x147998){return db[_0xf789('0x8')]['find'](_['defaults'](_0x512bfa,{'raw':!![],'where':{'id':0x1}}))[_0xf789('0x9')](function(_0x33aeb2){return checkLicense(_0x33aeb2,null);})[_0xf789('0x9')](function(_0x4303de){_0x23a2ab(_0x4303de);return;})[_0xf789('0xa')](function(_0x337c2b){_0x147998(_0x337c2b);});});}function checkLicense(_0x2bfa33,_0x1d268b){if(!_0x2bfa33){demoLicense[_0xf789('0xb')]=_0x2bfa33[_0xf789('0xc')];return demoLicense;}try{var _0x1810f4=_0x1d268b||_0x2bfa33[_0xf789('0xd')];if(_[_0xf789('0xe')](_0x1810f4)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1f54b8=_0x2bfa33[_0xf789('0xc')];var _0x40b0a8=_0x2bfa33[_0xf789('0xf')];var _0x3e5efb=_0x1f54b8[_0xf789('0x10')]('-')[0x4];var _0x3c3cd1=_0x1f54b8[_0xf789('0x10')]('-')[0x0];var _0x71258f=encryptor['decryptString'](_0x1810f4,util[_0xf789('0x11')](_0xf789('0x12'),_0x3e5efb,_0x1f54b8,_0x3c3cd1));var _0x4c9b5e=JSON[_0xf789('0x13')](_0x71258f);_0x4c9b5e[_0xf789('0x14')]=![];_0x4c9b5e['uuid']=_0x1f54b8;_0x4c9b5e[_0xf789('0x15')]=hardware[_0xf789('0x7')]();if(_0x40b0a8){var _0x62b137=encryptor[_0xf789('0x16')](_0x40b0a8);_0x4c9b5e['gray']=_0x62b137;_0x4c9b5e[_0xf789('0x17')]=moment(_0x62b137)[_0xf789('0x18')](0x7,_0xf789('0x19'))['format']();_0x4c9b5e[_0xf789('0x1a')]=_0x4c9b5e['uuid']!=_0x4c9b5e['machineUuid']?_0xf789('0x1b'):'disabled';}return _0x4c9b5e;}catch(_0x3792ec){breakingLicense['uuid']=_0x2bfa33['data1'];breakingLicense['message']=_0x3792ec[_0xf789('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c734d,_0x3a9b30){getLicense()[_0xf789('0x9')](function(_0x21a34b){return db[_0xf789('0x1d')]['findAll']({'attributes':[_0xf789('0x1e'),[db[_0xf789('0x1f')]['fn']('COUNT',db[_0xf789('0x1f')][_0xf789('0x20')](_0xf789('0x1e'))),_0xf789('0x21')]],'group':_0xf789('0x1e'),'where':{'role':{'$or':['admin','user',_0xf789('0x22')]}},'raw':!![]})[_0xf789('0x9')](function(_0x3c9175){var _0x3cdd87={'user':_0x21a34b[_0xf789('0x23')]||0x0,'telephone':_0x21a34b[_0xf789('0x24')]||0x0};_0x3c9175['forEach'](function(_0x173001){var _0x2f05ed=_0x173001['role']===_0xf789('0x25')?_0xf789('0x26'):_0x173001['role'];_0x3cdd87[_0x2f05ed]-=_0x173001[_0xf789('0x21')];if(_0x3cdd87[_0x2f05ed]<0x0)_0x3cdd87[_0x2f05ed]=0x0;});_0x2c734d(_0x3cdd87);return;});})[_0xf789('0xa')](function(_0x3bd853){_0x3a9b30(_0x3bd853);});});}function checkUserLimits(_0x5c37ee){return new BPromise(function(_0x42a2f6,_0x188626){getLimits()['then'](function(_0x3972ad){var _0x268cac=_[_0xf789('0x27')](_['countBy'](_0x5c37ee,'role'),[_0xf789('0x25'),_0xf789('0x26'),'telephone']);var _0x27a246=(_0x268cac[_0xf789('0x25')]||0x0)+(_0x268cac['user']||0x0);var _0x5a0642=_0x268cac[_0xf789('0x22')]||0x0;if(_0x27a246>_0x3972ad['user'])return _0x188626(_0xf789('0x28'));if(_0x5a0642>_0x3972ad[_0xf789('0x22')])return _0x188626('License\x20limit\x20reached\x20for\x20telephones');return _0x42a2f6();})[_0xf789('0xa')](function(_0x126282){_0x188626(_0x126282);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5d9e=['getUuid','License','find','then','uuid','License\x20key\x20value\x20not\x20found','data2','split','parse','demo','decryptString','deadline','add','days','grayReason','machineUuid','changed','disabled','data1','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x3ee4fe,_0x55166f){var _0x4ae324=function(_0xe33f65){while(--_0xe33f65){_0x3ee4fe['push'](_0x3ee4fe['shift']());}};_0x4ae324(++_0x55166f);}(_0x5d9e,0x1a6));var _0xe5d9=function(_0x5d7698,_0x2f8bcf){_0x5d7698=_0x5d7698-0x0;var _0x4e39af=_0x5d9e[_0x5d7698];return _0x4e39af;};'use strict';var util=require(_0xe5d9('0x0'));var _=require('lodash');var moment=require(_0xe5d9('0x1'));var BPromise=require(_0xe5d9('0x2'));var hardware=require(_0xe5d9('0x3'));var encryptor=require(_0xe5d9('0x4'));var db=require(_0xe5d9('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe5d9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe5d9('0x7'),'machineUuid':hardware[_0xe5d9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe5d9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xe5d9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x478ae4){return new BPromise(function(_0x5231b6,_0x14aa9a){return db[_0xe5d9('0x9')][_0xe5d9('0xa')](_['defaults'](_0x478ae4,{'raw':!![],'where':{'id':0x1}}))[_0xe5d9('0xb')](function(_0x227ad0){return checkLicense(_0x227ad0,null);})[_0xe5d9('0xb')](function(_0x23794d){_0x5231b6(_0x23794d);return;})['catch'](function(_0xc4ea07){_0x14aa9a(_0xc4ea07);});});}function checkLicense(_0x5289fa,_0x20e6b1){if(!_0x5289fa){demoLicense[_0xe5d9('0xc')]=_0x5289fa['data1'];return demoLicense;}try{var _0x7f08=_0x20e6b1||_0x5289fa['license'];if(_['isEmpty'](_0x7f08)){throw new Error(_0xe5d9('0xd'));}var _0x83d323=_0x5289fa['data1'];var _0x1eac98=_0x5289fa[_0xe5d9('0xe')];var _0x35f710=_0x83d323[_0xe5d9('0xf')]('-')[0x4];var _0x533bfb=_0x83d323['split']('-')[0x0];var _0x5c9ce4=encryptor['decryptString'](_0x7f08,util['format']('%s:%s:%s',_0x35f710,_0x83d323,_0x533bfb));var _0x4712b7=JSON[_0xe5d9('0x10')](_0x5c9ce4);_0x4712b7[_0xe5d9('0x11')]=![];_0x4712b7['uuid']=_0x83d323;_0x4712b7['machineUuid']=hardware[_0xe5d9('0x8')]();if(_0x1eac98){var _0x391217=encryptor[_0xe5d9('0x12')](_0x1eac98);_0x4712b7['gray']=_0x391217;_0x4712b7[_0xe5d9('0x13')]=moment(_0x391217)[_0xe5d9('0x14')](0x7,_0xe5d9('0x15'))['format']();_0x4712b7[_0xe5d9('0x16')]=_0x4712b7['uuid']!=_0x4712b7[_0xe5d9('0x17')]?_0xe5d9('0x18'):_0xe5d9('0x19');}return _0x4712b7;}catch(_0x68bd8c){breakingLicense[_0xe5d9('0xc')]=_0x5289fa[_0xe5d9('0x1a')];breakingLicense[_0xe5d9('0x1b')]=_0x68bd8c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x30a0a0,_0x26d6a2){getLicense()[_0xe5d9('0xb')](function(_0x48c703){return db['User'][_0xe5d9('0x1c')]({'attributes':[_0xe5d9('0x1d'),[db[_0xe5d9('0x1e')]['fn'](_0xe5d9('0x1f'),db[_0xe5d9('0x1e')][_0xe5d9('0x20')](_0xe5d9('0x1d'))),_0xe5d9('0x21')]],'group':_0xe5d9('0x1d'),'where':{'role':{'$or':[_0xe5d9('0x22'),_0xe5d9('0x23'),_0xe5d9('0x24')]}},'raw':!![]})[_0xe5d9('0xb')](function(_0x5e006b){var _0x40645e={'user':_0x48c703[_0xe5d9('0x25')]||0x0,'telephone':_0x48c703['telephones']||0x0};_0x5e006b[_0xe5d9('0x26')](function(_0x23f417){var _0x2ad2c5=_0x23f417['role']===_0xe5d9('0x22')?_0xe5d9('0x23'):_0x23f417[_0xe5d9('0x1d')];_0x40645e[_0x2ad2c5]-=_0x23f417['count'];if(_0x40645e[_0x2ad2c5]<0x0)_0x40645e[_0x2ad2c5]=0x0;});_0x30a0a0(_0x40645e);return;});})[_0xe5d9('0x27')](function(_0x7dd3b3){_0x26d6a2(_0x7dd3b3);});});}function checkUserLimits(_0x20fc2b){return new BPromise(function(_0x302cff,_0x233571){getLimits()[_0xe5d9('0xb')](function(_0x402837){var _0xa89423=_[_0xe5d9('0x28')](_[_0xe5d9('0x29')](_0x20fc2b,_0xe5d9('0x1d')),['admin','user',_0xe5d9('0x24')]);var _0x4acb94=(_0xa89423[_0xe5d9('0x22')]||0x0)+(_0xa89423[_0xe5d9('0x23')]||0x0);var _0x27131c=_0xa89423[_0xe5d9('0x24')]||0x0;if(_0x4acb94>_0x402837[_0xe5d9('0x23')])return _0x233571(_0xe5d9('0x2a'));if(_0x27131c>_0x402837['telephone'])return _0x233571('License\x20limit\x20reached\x20for\x20telephones');return _0x302cff();})[_0xe5d9('0x27')](function(_0x2ded52){_0x233571(_0x2ded52);});});}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 8bd80f0..8ab76c8 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 _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0x5c3c,0x132));var _0xc5c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c3c[_0x20a584];return _0x4b41a8;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xd4a2=['app-id','exports'];(function(_0x380d64,_0x2464f2){var _0x4ff7b1=function(_0x6534d0){while(--_0x6534d0){_0x380d64['push'](_0x380d64['shift']());}};_0x4ff7b1(++_0x2464f2);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1e8290,_0x17536d){_0x1e8290=_0x1e8290-0x0;var _0x315554=_0xd4a2[_0x1e8290];return _0x315554;};'use strict';module[_0x2d4a('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2d4a('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a0fd074..d5a6257 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x126b=['fileLogger','exports','../utils/loggers'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x126b,0x1f1));var _0xb126=function(_0x59481b,_0x2d7e8d){_0x59481b=_0x59481b-0x0;var _0x502f98=_0x126b[_0x59481b];return _0x502f98;};'use strict';var fileLogger=require(_0xb126('0x0'))[_0xb126('0x1')];module[_0xb126('0x2')]=fileLogger; \ No newline at end of file +var _0xaccc=['fileLogger','exports'];(function(_0x3bafa7,_0x5067ed){var _0x3ee6d2=function(_0x34bd4e){while(--_0x34bd4e){_0x3bafa7['push'](_0x3bafa7['shift']());}};_0x3ee6d2(++_0x5067ed);}(_0xaccc,0x6a));var _0xcacc=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xaccc[_0x3b150c];return _0x5cd414;};'use strict';var fileLogger=require('../utils/loggers')[_0xcacc('0x0')];module[_0xcacc('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b23ed90..34a3db6 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 _0xe1fd=['../../services/ami/index.js','agi','../../services/agi/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../services/express/index.js','ami','join'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xe1fd,0x80));var _0xde1f=function(_0x1b728d,_0x5ab74c){_0x1b728d=_0x1b728d-0x0;var _0x28f9df=_0xe1fd[_0x1b728d];return _0x28f9df;};'use strict';var path=require(_0xde1f('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0xde1f('0x1'))},{'name':_0xde1f('0x2'),'script':path[_0xde1f('0x3')](__dirname,_0xde1f('0x4'))},{'name':_0xde1f('0x5'),'script':path[_0xde1f('0x3')](__dirname,_0xde1f('0x6'))},{'name':'email','script':path[_0xde1f('0x3')](__dirname,'../../services/email/index.js')},{'name':_0xde1f('0x7'),'script':path['join'](__dirname,_0xde1f('0x8'))},{'name':'xdr','script':path['join'](__dirname,_0xde1f('0x9'))}]};module[_0xde1f('0xa')]=config; \ No newline at end of file +var _0x0bc1=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','xdr','../../services/xdr/index.js','exports'];(function(_0x1452ec,_0x15810e){var _0x42ba0c=function(_0x1bc327){while(--_0x1bc327){_0x1452ec['push'](_0x1452ec['shift']());}};_0x42ba0c(++_0x15810e);}(_0x0bc1,0xfc));var _0x10bc=function(_0x3c79c5,_0x30c6db){_0x3c79c5=_0x3c79c5-0x0;var _0x33ef2c=_0x0bc1[_0x3c79c5];return _0x33ef2c;};'use strict';var path=require(_0x10bc('0x0'));var os=require('os');var config={'apps':[{'name':_0x10bc('0x1'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x3'))},{'name':_0x10bc('0x4'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x5'))},{'name':_0x10bc('0x6'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x7'))},{'name':_0x10bc('0x8'),'script':path[_0x10bc('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x10bc('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x10bc('0x9'),'script':path['join'](__dirname,_0x10bc('0xa'))}]};module[_0x10bc('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index dd454c2..e9dd9fd 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 _0xa3ca=['stop','restart','list','describe','delete','saved','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x4cee82,_0x2bacc2){var _0x22d50b=function(_0x46191c){while(--_0x46191c){_0x4cee82['push'](_0x4cee82['shift']());}};_0x22d50b(++_0x2bacc2);}(_0xa3ca,0x124));var _0xaa3c=function(_0x3de094,_0x5a67da){_0x3de094=_0x3de094-0x0;var _0x45ed26=_0xa3ca[_0x3de094];return _0x45ed26;};'use strict';var pm2=require('pm2');var BPromise=require(_0xaa3c('0x0'));var config=require(_0xaa3c('0x1'));function connect(){return new BPromise(function(_0x42de4e,_0x5a3400){return pm2[_0xaa3c('0x2')](function(_0x43cca7){if(_0x43cca7){return _0x5a3400(_0x43cca7);}return _0x42de4e(_0xaa3c('0x3'));});});};exports[_0xaa3c('0x4')]=function(_0x1e9795){return connect()[_0xaa3c('0x5')](function(){return new BPromise(function(_0x139dba,_0x355149){return pm2[_0xaa3c('0x4')](_0x1e9795,function(_0x915211,_0x175554){if(_0x915211){return _0x355149(_0x915211);}pm2[_0xaa3c('0x6')]();return _0x139dba(_0x175554);});});});};exports[_0xaa3c('0x7')]=function(_0x2b84c9){return connect()['then'](function(){return new BPromise(function(_0x40443c,_0x2b06f8){return pm2['stop'](_0x2b84c9,function(_0xc7c0d1,_0x3ca55a){if(_0xc7c0d1){return _0x2b06f8(_0xc7c0d1);}pm2[_0xaa3c('0x6')]();return _0x40443c(_0x3ca55a);});});});};exports[_0xaa3c('0x8')]=function(_0x1a9780){return connect()[_0xaa3c('0x5')](function(){return new BPromise(function(_0x406778,_0x5650e8){return pm2[_0xaa3c('0x8')](_0x1a9780,function(_0x572658,_0x3a406c){if(_0x572658){return _0x5650e8(_0x572658);}pm2[_0xaa3c('0x6')]();return _0x406778(_0x3a406c);});});});};exports[_0xaa3c('0x9')]=function(){return connect()[_0xaa3c('0x5')](function(){return new BPromise(function(_0x4eab0c,_0x286a3a){return pm2['list'](function(_0x306e44,_0x3e8df9){if(_0x306e44){return _0x286a3a(_0x306e44);}pm2[_0xaa3c('0x6')]();return _0x4eab0c(_0x3e8df9);});});});};exports[_0xaa3c('0xa')]=function(_0xa9af56){return connect()[_0xaa3c('0x5')](function(){return new BPromise(function(_0x35f38a,_0x5e4219){return pm2[_0xaa3c('0xa')](_0xa9af56,function(_0x35a2e7,_0x32574a){if(_0x35a2e7){return _0x5e4219(_0x35a2e7);}pm2[_0xaa3c('0x6')]();return _0x35f38a(_0x32574a);});});});};exports[_0xaa3c('0xb')]=function(_0x2636a3){return connect()[_0xaa3c('0x5')](function(){return new BPromise(function(_0x29db6b,_0x3f13e6){return pm2[_0xaa3c('0xb')](_0x2636a3,function(_0x12f711,_0x2731d7){if(_0x12f711){return _0x3f13e6(_0x12f711);}pm2[_0xaa3c('0x6')]();return _0x29db6b(_0x2731d7);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x3f74f4,_0x4ed342){return pm2['dump'](function(_0x5f38fc){if(_0x5f38fc){return _0x4ed342(_0x5f38fc);}return _0x3f74f4(_0xaa3c('0xc'));});});});}; \ No newline at end of file +var _0x76a3=['connected','start','then','disconnect','stop','restart','list','describe','delete','saved','pm2','connect'];(function(_0x400dab,_0x466833){var _0x4f6c81=function(_0x2c3167){while(--_0x2c3167){_0x400dab['push'](_0x400dab['shift']());}};_0x4f6c81(++_0x466833);}(_0x76a3,0x9a));var _0x376a=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x76a3[_0x1cd47d];return _0x29d52f;};'use strict';var pm2=require(_0x376a('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x2b6b75,_0x38343e){return pm2[_0x376a('0x1')](function(_0x5b20ad){if(_0x5b20ad){return _0x38343e(_0x5b20ad);}return _0x2b6b75(_0x376a('0x2'));});});};exports[_0x376a('0x3')]=function(_0x6efe9c){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x2d4ef9,_0x19b75d){return pm2[_0x376a('0x3')](_0x6efe9c,function(_0x2c166b,_0x474efc){if(_0x2c166b){return _0x19b75d(_0x2c166b);}pm2[_0x376a('0x5')]();return _0x2d4ef9(_0x474efc);});});});};exports[_0x376a('0x6')]=function(_0x143e42){return connect()['then'](function(){return new BPromise(function(_0x35fdac,_0x5cd1c7){return pm2[_0x376a('0x6')](_0x143e42,function(_0x94f48d,_0x12ad43){if(_0x94f48d){return _0x5cd1c7(_0x94f48d);}pm2[_0x376a('0x5')]();return _0x35fdac(_0x12ad43);});});});};exports[_0x376a('0x7')]=function(_0x2d1849){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x223540,_0x584abe){return pm2[_0x376a('0x7')](_0x2d1849,function(_0x2bb5ae,_0x1cb0c3){if(_0x2bb5ae){return _0x584abe(_0x2bb5ae);}pm2[_0x376a('0x5')]();return _0x223540(_0x1cb0c3);});});});};exports['list']=function(){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x5c549a,_0x1e90c3){return pm2[_0x376a('0x8')](function(_0x14715c,_0x4483ab){if(_0x14715c){return _0x1e90c3(_0x14715c);}pm2['disconnect']();return _0x5c549a(_0x4483ab);});});});};exports[_0x376a('0x9')]=function(_0x58042e){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x4312e1,_0x4396e2){return pm2[_0x376a('0x9')](_0x58042e,function(_0x42ccbd,_0x238c74){if(_0x42ccbd){return _0x4396e2(_0x42ccbd);}pm2[_0x376a('0x5')]();return _0x4312e1(_0x238c74);});});});};exports[_0x376a('0xa')]=function(_0x11851a){return connect()['then'](function(){return new BPromise(function(_0x5054e7,_0x240ade){return pm2['delete'](_0x11851a,function(_0x1e60ac,_0x489841){if(_0x1e60ac){return _0x240ade(_0x1e60ac);}pm2[_0x376a('0x5')]();return _0x5054e7(_0x489841);});});});};exports['dump']=function(){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x5e185a,_0x331bd5){return pm2['dump'](function(_0x3a5929){if(_0x3a5929){return _0x331bd5(_0x3a5929);}return _0x5e185a(_0x376a('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 257b89a..1822833 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 _0x9887=['subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','schedule','redis','defaults','localhost','then','chatTimeout','lastMsgAt'];(function(_0x359457,_0x206800){var _0x2f25b0=function(_0x4271a6){while(--_0x4271a6){_0x359457['push'](_0x359457['shift']());}};_0x2f25b0(++_0x206800);}(_0x9887,0x170));var _0x7988=function(_0x156904,_0x34016e){_0x156904=_0x156904-0x0;var _0x443794=_0x9887[_0x156904];return _0x443794;};'use strict';var _=require(_0x7988('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x7988('0x1'));var config=require(_0x7988('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x7988('0x3'));config[_0x7988('0x4')]=_[_0x7988('0x5')](config[_0x7988('0x4')],{'host':_0x7988('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7988('0x4')]));function closeInteractions(){var _0x15fe3a=0x0;var _0x637432=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x7988('0x7')](function(_0x26a9b1){_0x15fe3a=_0x26a9b1[_0x7988('0x8')];if(_0x15fe3a){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x7988('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7988('0xa')](_0x26a9b1[_0x7988('0x8')],_0x7988('0xb'))}}});}else{return[];}})[_0x7988('0x7')](function(_0x3584cd){if(_0x3584cd&&_0x3584cd[_0x7988('0xc')]){_0x637432=_[_0x7988('0xd')](_0x3584cd||[],'id');logger['info'](_0x7988('0xe'),_0x637432['join']());return db['ChatInteraction'][_0x7988('0xf')]({'closeReason':_0x7988('0x10'),'disposition':_0x7988('0x11'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x637432}});}})[_0x7988('0x7')](function(){if(_0x637432&&_0x637432['length']){logger['info'](_0x7988('0x12'),_0x637432[_0x7988('0x13')]());for(var _0x3843d0=0x0;_0x3843d0<_0x637432[_0x7988('0xc')];_0x3843d0++){io[_0x7988('0x14')](_0x7988('0x15'),{'id':_0x637432[_0x3843d0],'closed':!![]});}}})[_0x7988('0x16')](function(_0x3165c5){logger[_0x7988('0x17')](_0x7988('0x18'),_0x3165c5?util[_0x7988('0x19')](_0x3165c5,{'showHidden':![],'depth':null}):'');});}exports[_0x7988('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0028=['../../config/environment','../logger','schedule','defaults','localhost','redis','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','inspect','start','moment','ioredis'];(function(_0x474f1e,_0x448320){var _0x292bd5=function(_0x33800a){while(--_0x33800a){_0x474f1e['push'](_0x474f1e['shift']());}};_0x292bd5(++_0x448320);}(_0x0028,0x85));var _0x8002=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x0028[_0x11ec6c];return _0xb59506;};'use strict';var _=require('lodash');var moment=require(_0x8002('0x0'));var Redis=require(_0x8002('0x1'));var util=require('util');var config=require(_0x8002('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8002('0x3'))(_0x8002('0x4'));config['redis']=_[_0x8002('0x5')](config['redis'],{'host':_0x8002('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8002('0x7')]));function closeInteractions(){var _0x31d5f3=0x0;var _0x3f6e69=[];return db[_0x8002('0x8')]['find']({'raw':!![],'attributes':['id',_0x8002('0x9')],'where':{'id':0x1}})[_0x8002('0xa')](function(_0x72f589){_0x31d5f3=_0x72f589[_0x8002('0x9')];if(_0x31d5f3){return db['ChatInteraction'][_0x8002('0xb')]({'raw':!![],'attributes':['id',_0x8002('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8002('0xd')](_0x72f589['chatTimeout'],_0x8002('0xe'))}}});}else{return[];}})[_0x8002('0xa')](function(_0x46d296){if(_0x46d296&&_0x46d296[_0x8002('0xf')]){_0x3f6e69=_['map'](_0x46d296||[],'id');logger[_0x8002('0x10')](_0x8002('0x11'),_0x3f6e69[_0x8002('0x12')]());return db[_0x8002('0x13')]['update']({'closeReason':'system','disposition':_0x8002('0x14'),'closed':!![],'closedAt':moment()[_0x8002('0x15')](_0x8002('0x16'))},{'where':{'id':_0x3f6e69}});}})[_0x8002('0xa')](function(){if(_0x3f6e69&&_0x3f6e69[_0x8002('0xf')]){logger[_0x8002('0x10')](_0x8002('0x17'),_0x3f6e69[_0x8002('0x12')]());for(var _0x13bd5b=0x0;_0x13bd5b<_0x3f6e69[_0x8002('0xf')];_0x13bd5b++){io['emit']('chatInteraction:update',{'id':_0x3f6e69[_0x13bd5b],'closed':!![]});}}})[_0x8002('0x18')](function(_0x26860c){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x26860c?util[_0x8002('0x19')](_0x26860c,{'showHidden':![],'depth':null}):'');});}exports[_0x8002('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 1b5957d..9435fb6 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ab5=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x5a2135,_0x48083c){var _0x44ceec=function(_0x34caa5){while(--_0x34caa5){_0x5a2135['push'](_0x5a2135['shift']());}};_0x44ceec(++_0x48083c);}(_0x3ab5,0x192));var _0x53ab=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3ab5[_0x502c7d];return _0x30b7ed;};'use strict';function start(){var _0x5b32a9=require(_0x53ab('0x0'));return _0x5b32a9[_0x53ab('0x1')]();}module[_0x53ab('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xdead=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x48a160,_0x5f4053){var _0x2e2fbe=function(_0x57b99d){while(--_0x57b99d){_0x48a160['push'](_0x48a160['shift']());}};_0x2e2fbe(++_0x5f4053);}(_0xdead,0x197));var _0xddea=function(_0x137972,_0x36f5ba){_0x137972=_0x137972-0x0;var _0x12447d=_0xdead[_0x137972];return _0x12447d;};'use strict';function start(){var _0x40e806=require(_0xddea('0x0'));return _0x40e806[_0xddea('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 81f1cbb..42b62b1 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 _0x3b36=['DefaultReportId','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','intersection','length','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','exists','active','update','update\x20cron','run','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x3b36,0x181));var _0x63b3=function(_0x1a3c28,_0x4d892e){_0x1a3c28=_0x1a3c28-0x0;var _0x259952=_0x3b36[_0x1a3c28];return _0x259952;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x63b3('0x0'));var _=require('lodash');var moment=require(_0x63b3('0x1'));var CronJobManager=require(_0x63b3('0x2'));var jayson=require(_0x63b3('0x3'));var BPromise=require(_0x63b3('0x4'));var logger=require(_0x63b3('0x5'))(_0x63b3('0x6'));var db=require(_0x63b3('0x7'))['db'];var analyticCustomReportController=require(_0x63b3('0x8'));var analyticDefaultReportController=require(_0x63b3('0x9'));var client=jayson[_0x63b3('0xa')][_0x63b3('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x25d851,_0x298f48){return function(){logger[_0x63b3('0xc')](_0x63b3('0xd'),_0x25d851[_0x63b3('0xe')]);var _0x446aea=!![];var _0x7c4b88=_0x25d851[_0x63b3('0xf')]['getSmtpOptions']();var _0x255205={'account':_0x7c4b88,'message':{'from':util['format'](_0x63b3('0x10'),_0x25d851[_0x63b3('0xf')][_0x63b3('0x11')],_0x25d851[_0x63b3('0xf')]['email']||_0x25d851['MailAccount'][_0x63b3('0x12')][_0x63b3('0x13')]),'to':_0x25d851['email'],'cc':_0x25d851['cc'],'bcc':_0x25d851[_0x63b3('0x14')],'subject':util[_0x63b3('0x15')](_0x63b3('0x16'),_0x298f48[_0x63b3('0x11')],_0x25d851['subtractNumber'],_0x25d851[_0x63b3('0x17')])}};var _0x566f33=path[_0x63b3('0x18')](__dirname,_0x63b3('0x19'));var _0x7c997=_0x298f48[_0x63b3('0x1a')];var _0x343a54=util[_0x63b3('0x15')]('%s.%s',path['basename'](_0x298f48[_0x63b3('0x1a')],path['extname'](_0x298f48[_0x63b3('0x1a')])),_0x63b3('0x1b'));var _0x5ae3ad=path[_0x63b3('0x18')](_0x566f33,_0x7c997);var _0x346c7c=path[_0x63b3('0x18')](_0x566f33,_0x343a54);if(fs[_0x63b3('0x1c')](_0x5ae3ad)){_0x298f48[_0x63b3('0x1d')]=_0x63b3('0x1e');_0x255205[_0x63b3('0x1f')]['attachments']=[{'filename':_0x7c997,'path':_0x5ae3ad}];_0x255205[_0x63b3('0x1f')][_0x63b3('0x20')]=util['format'](_0x63b3('0x21'),JSON[_0x63b3('0x22')](_0x298f48,null,0x2));}else if(fs[_0x63b3('0x1c')](_0x346c7c)){_0x298f48[_0x63b3('0x1d')]=_0x63b3('0x1e');_0x255205[_0x63b3('0x1f')][_0x63b3('0x23')]=[{'filename':_0x343a54,'path':_0x346c7c}];}else{_0x255205[_0x63b3('0x1f')]['text']=_0x63b3('0x24');if(!_0x25d851[_0x63b3('0x25')]){_0x446aea=![];logger[_0x63b3('0xc')](_0x63b3('0x26'));}}if(_0x446aea){return client[_0x63b3('0x27')](_0x63b3('0x28'),_0x255205)['then'](function(_0xbca5d9){if(_0xbca5d9[_0x63b3('0x29')]){return logger[_0x63b3('0x29')]('error\x20mail',JSON[_0x63b3('0x22')](_0xbca5d9));}return logger['info'](_0x63b3('0x2a'));})[_0x63b3('0x2b')](function(_0xfc946f){return logger[_0x63b3('0x29')](_0x63b3('0x2c'),JSON[_0x63b3('0x22')](_0xfc946f));});}};}function handleError(){return function(_0xf58259){return logger[_0x63b3('0x29')](JSON['stringify'](_0xf58259));};}function handleResult(_0xbcc84a){return function(_0x1e1518){logger[_0x63b3('0xc')](_0x63b3('0x2d'),JSON[_0x63b3('0x22')](_0x1e1518));if(_0xbcc84a[_0x63b3('0xf')]&&_0xbcc84a[_0x63b3('0xf')][_0x63b3('0x12')]&&!_[_0x63b3('0x2e')](_0xbcc84a[_0x63b3('0xe')])){setTimeout(handleSendEmail(_0xbcc84a,_0x1e1518),0x3c*0x3e8);}};}function handleJob(_0x547a99){return function(){try{if(_['isNil'](_0x547a99['subtractNumber'])){return logger[_0x63b3('0xc')](_0x63b3('0x2f'));}if(_[_0x63b3('0x2e')](_0x547a99[_0x63b3('0x17')])){return logger[_0x63b3('0xc')](_0x63b3('0x30'));}var _0xf878c2={'startDate':moment()[_0x63b3('0x31')](_0x547a99[_0x63b3('0x32')],_0x547a99[_0x63b3('0x17')])[_0x63b3('0x15')](_0x63b3('0x33')),'endDate':moment()[_0x63b3('0x15')](_0x63b3('0x33')),'type':_0x63b3('0x34'),'output':_0x547a99[_0x63b3('0x35')],'name':_0x547a99[_0x63b3('0x11')]};if(!_[_0x63b3('0x2e')](_0x547a99['DefaultReportId'])){logger[_0x63b3('0xc')](_0x63b3('0x36'),_0x547a99[_0x63b3('0x37')]);return analyticDefaultReportController[_0x63b3('0x38')]({'id':_0x547a99[_0x63b3('0x37')]},_0xf878c2)[_0x63b3('0x39')](handleResult(_0x547a99))[_0x63b3('0x2b')](handleError());}if(!_[_0x63b3('0x2e')](_0x547a99[_0x63b3('0x3a')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x547a99[_0x63b3('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x547a99[_0x63b3('0x3a')]},_0xf878c2)[_0x63b3('0x39')](handleResult(_0x547a99))[_0x63b3('0x2b')](handleError());}}catch(_0x453626){logger[_0x63b3('0x29')](JSON[_0x63b3('0x22')](_0x453626));}return logger[_0x63b3('0xc')](_0x63b3('0x3b'));};}function getJobs(_0x5e03db){var _0x35c554={};if(_0x5e03db){_0x35c554['id']=_0x5e03db;}return db[_0x63b3('0x3c')][_0x63b3('0x3d')]({'where':_0x35c554,'include':[{'model':db[_0x63b3('0xf')],'attributes':['id','name',_0x63b3('0xe')],'include':[{'model':db[_0x63b3('0x3e')],'as':'Smtp','include':[{'model':db[_0x63b3('0x3f')],'as':_0x63b3('0x3f')}]}]}]})[_0x63b3('0x39')](function(_0x3035c5){var _0x1346b8=_[_0x63b3('0x40')](manager[_0x63b3('0x41')]);var _0x396bf3=_['map'](_0x3035c5,function(_0x29ed23){return _0x29ed23['id'][_0x63b3('0x42')]();});var _0x396a27=_[_0x63b3('0x43')](_0x3035c5,function(_0x2bb2b9){return _0x2bb2b9['id'][_0x63b3('0x42')]();});var _0x34b8a5=_0x5e03db?_0x396bf3:_['difference'](_0x396bf3,_0x1346b8);var _0x38efab=_[_0x63b3('0x44')](_0x396bf3,_0x1346b8);var _0x4c00db=_['difference'](_0x1346b8,_0x396bf3);var _0x12d685;var _0x1749cb;for(_0x12d685=0x0;_0x12d685<_0x4c00db[_0x63b3('0x45')]&&!_0x5e03db;_0x12d685+=0x1){_0x1749cb=_0x4c00db[_0x12d685]['toString']();if(manager['exists'](_0x1749cb)){manager['stop'](_0x1749cb);manager[_0x63b3('0x46')](_0x1749cb);logger[_0x63b3('0xc')](_0x63b3('0x47'),_0x1749cb);}}logger['info'](_0x63b3('0x48'),JSON[_0x63b3('0x22')](_0x34b8a5));for(_0x12d685=0x0;_0x12d685<_0x34b8a5['length'];_0x12d685+=0x1){_0x1749cb=_0x34b8a5[_0x12d685]['toString']();logger['info'](_0x63b3('0x49'),_0x1749cb);if(_0x5e03db){logger['info'](_0x63b3('0x4a'),_0x5e03db);logger[_0x63b3('0xc')](JSON[_0x63b3('0x22')](_0x396a27[_0x1749cb]));BPromise['resolve']()['then'](handleJob(_0x396a27[_0x1749cb]));logger[_0x63b3('0xc')](_0x63b3('0x4b'),_0x396a27[_0x1749cb][_0x63b3('0x11')],_0x396a27[_0x1749cb][_0x63b3('0x4c')]);}else if(_0x396a27[_0x1749cb][_0x63b3('0x4c')]&&_0x396a27[_0x1749cb]['active']&&moment()[_0x63b3('0x4d')](_0x396a27[_0x1749cb][_0x63b3('0x4e')],_0x396a27[_0x1749cb][_0x63b3('0x4f')])){manager[_0x63b3('0x50')](_0x1749cb,_0x396a27[_0x1749cb][_0x63b3('0x4c')],handleJob(_0x396a27[_0x1749cb]));manager[_0x63b3('0x51')](_0x1749cb);logger['info'](_0x63b3('0x52'),_0x396a27[_0x1749cb][_0x63b3('0x11')],_0x396a27[_0x1749cb][_0x63b3('0x4c')]);}else if(manager['exists'](_0x1749cb)){manager['stop'](_0x1749cb);manager[_0x63b3('0x46')](_0x1749cb);logger[_0x63b3('0xc')]('stop\x20cron',_0x396a27[_0x1749cb][_0x63b3('0x11')],_0x396a27[_0x1749cb][_0x63b3('0x4c')]);}}for(_0x12d685=0x0,_0x1749cb;_0x12d685<_0x38efab[_0x63b3('0x45')]&&!_0x5e03db;_0x12d685+=0x1){_0x1749cb=_0x38efab[_0x12d685][_0x63b3('0x42')]();if(manager[_0x63b3('0x53')](_0x1749cb)){if(_0x396a27[_0x1749cb]['cron']&&_0x396a27[_0x1749cb][_0x63b3('0x54')]&&moment()[_0x63b3('0x4d')](_0x396a27[_0x1749cb][_0x63b3('0x4e')],_0x396a27[_0x1749cb][_0x63b3('0x4f')])){manager[_0x63b3('0x55')](_0x1749cb,_0x396a27[_0x1749cb][_0x63b3('0x4c')],handleJob(_0x396a27[_0x1749cb]));logger[_0x63b3('0xc')](_0x63b3('0x56'),_0x396a27[_0x1749cb][_0x63b3('0x11')],_0x396a27[_0x1749cb][_0x63b3('0x4c')]);}else{manager['stop'](_0x1749cb);manager['deleteJob'](_0x1749cb);logger[_0x63b3('0xc')]('stop\x20cron',_0x396a27[_0x1749cb]['name'],_0x396a27[_0x1749cb][_0x63b3('0x4c')]);}}}})[_0x63b3('0x2b')](function(_0x24968f){logger[_0x63b3('0x29')](JSON[_0x63b3('0x22')](_0x24968f));});}exports[_0x63b3('0x57')]=function(_0x102a7f){return getJobs(_0x102a7f);};exports[_0x63b3('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x94d9=['active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','stringify','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x1dfa55,_0x1d2007){var _0x893d0e=function(_0x30cace){while(--_0x30cace){_0x1dfa55['push'](_0x1dfa55['shift']());}};_0x893d0e(++_0x1d2007);}(_0x94d9,0x1cd));var _0x994d=function(_0x365272,_0x4948e0){_0x365272=_0x365272-0x0;var _0x36b2a5=_0x94d9[_0x365272];return _0x36b2a5;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x994d('0x0'));var _=require(_0x994d('0x1'));var moment=require(_0x994d('0x2'));var CronJobManager=require(_0x994d('0x3'));var jayson=require(_0x994d('0x4'));var BPromise=require(_0x994d('0x5'));var logger=require(_0x994d('0x6'))(_0x994d('0x7'));var db=require(_0x994d('0x8'))['db'];var analyticCustomReportController=require(_0x994d('0x9'));var analyticDefaultReportController=require(_0x994d('0xa'));var client=jayson[_0x994d('0xb')][_0x994d('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x118304,_0x2a56ca){return function(){logger[_0x994d('0xd')](_0x994d('0xe'),_0x118304[_0x994d('0xf')]);var _0x1a31f2=!![];var _0x34d9d9=_0x118304['MailAccount'][_0x994d('0x10')]();var _0x4fef9e={'account':_0x34d9d9,'message':{'from':util['format'](_0x994d('0x11'),_0x118304['MailAccount'][_0x994d('0x12')],_0x118304[_0x994d('0x13')][_0x994d('0xf')]||_0x118304[_0x994d('0x13')][_0x994d('0x14')][_0x994d('0x15')]),'to':_0x118304[_0x994d('0xf')],'cc':_0x118304['cc'],'bcc':_0x118304['bcc'],'subject':util[_0x994d('0x16')](_0x994d('0x17'),_0x2a56ca['name'],_0x118304[_0x994d('0x18')],_0x118304['subtractUnit'])}};var _0x50f1fd=path[_0x994d('0x19')](__dirname,_0x994d('0x1a'));var _0x2c4515=_0x2a56ca[_0x994d('0x1b')];var _0x388c1c=util[_0x994d('0x16')]('%s.%s',path[_0x994d('0x1c')](_0x2a56ca[_0x994d('0x1b')],path[_0x994d('0x1d')](_0x2a56ca[_0x994d('0x1b')])),_0x994d('0x1e'));var _0x55a08b=path['join'](_0x50f1fd,_0x2c4515);var _0x45ffca=path[_0x994d('0x19')](_0x50f1fd,_0x388c1c);if(fs[_0x994d('0x1f')](_0x55a08b)){_0x2a56ca['status']=_0x994d('0x20');_0x4fef9e[_0x994d('0x21')][_0x994d('0x22')]=[{'filename':_0x2c4515,'path':_0x55a08b}];_0x4fef9e[_0x994d('0x21')][_0x994d('0x23')]=util[_0x994d('0x16')](_0x994d('0x24'),JSON['stringify'](_0x2a56ca,null,0x2));}else if(fs[_0x994d('0x1f')](_0x45ffca)){_0x2a56ca[_0x994d('0x25')]=_0x994d('0x20');_0x4fef9e[_0x994d('0x21')][_0x994d('0x22')]=[{'filename':_0x388c1c,'path':_0x45ffca}];}else{_0x4fef9e[_0x994d('0x21')][_0x994d('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x118304[_0x994d('0x26')]){_0x1a31f2=![];logger[_0x994d('0xd')](_0x994d('0x27'));}}if(_0x1a31f2){return client[_0x994d('0x28')](_0x994d('0x29'),_0x4fef9e)['then'](function(_0x53de1d){if(_0x53de1d[_0x994d('0x2a')]){return logger[_0x994d('0x2a')]('error\x20mail',JSON[_0x994d('0x2b')](_0x53de1d));}return logger[_0x994d('0xd')](_0x994d('0x2c'));})[_0x994d('0x2d')](function(_0x59289e){return logger[_0x994d('0x2a')](_0x994d('0x2e'),JSON['stringify'](_0x59289e));});}};}function handleError(){return function(_0x14a064){return logger['error'](JSON[_0x994d('0x2b')](_0x14a064));};}function handleResult(_0x4e94a2){return function(_0x90a656){logger[_0x994d('0xd')](_0x994d('0x2f'),JSON['stringify'](_0x90a656));if(_0x4e94a2[_0x994d('0x13')]&&_0x4e94a2[_0x994d('0x13')][_0x994d('0x14')]&&!_[_0x994d('0x30')](_0x4e94a2['email'])){setTimeout(handleSendEmail(_0x4e94a2,_0x90a656),0x3c*0x3e8);}};}function handleJob(_0x4a5ae0){return function(){try{if(_['isNil'](_0x4a5ae0['subtractNumber'])){return logger[_0x994d('0xd')](_0x994d('0x31'));}if(_[_0x994d('0x30')](_0x4a5ae0[_0x994d('0x32')])){return logger[_0x994d('0xd')](_0x994d('0x33'));}var _0x3579b2={'startDate':moment()[_0x994d('0x34')](_0x4a5ae0[_0x994d('0x18')],_0x4a5ae0[_0x994d('0x32')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x994d('0x35')),'type':_0x994d('0x36'),'output':_0x4a5ae0[_0x994d('0x37')],'name':_0x4a5ae0['name']};if(!_[_0x994d('0x30')](_0x4a5ae0[_0x994d('0x38')])){logger[_0x994d('0xd')](_0x994d('0x39'),_0x4a5ae0[_0x994d('0x38')]);return analyticDefaultReportController['runReport']({'id':_0x4a5ae0[_0x994d('0x38')]},_0x3579b2)[_0x994d('0x3a')](handleResult(_0x4a5ae0))['catch'](handleError());}if(!_[_0x994d('0x30')](_0x4a5ae0['CustomReportId'])){logger[_0x994d('0xd')](_0x994d('0x3b'),_0x4a5ae0[_0x994d('0x3c')]);return analyticCustomReportController[_0x994d('0x3d')]({'id':_0x4a5ae0[_0x994d('0x3c')]},_0x3579b2)[_0x994d('0x3a')](handleResult(_0x4a5ae0))[_0x994d('0x2d')](handleError());}}catch(_0x3a9915){logger[_0x994d('0x2a')](JSON[_0x994d('0x2b')](_0x3a9915));}return logger[_0x994d('0xd')](_0x994d('0x3e'));};}function getJobs(_0x4f5e8a){var _0x4f5f43={};if(_0x4f5e8a){_0x4f5f43['id']=_0x4f5e8a;}return db[_0x994d('0x3f')]['findAll']({'where':_0x4f5f43,'include':[{'model':db['MailAccount'],'attributes':['id',_0x994d('0x12'),_0x994d('0xf')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x994d('0x40')],'as':_0x994d('0x40')}]}]}]})[_0x994d('0x3a')](function(_0x4fc6e9){var _0x10a3fb=_['keys'](manager[_0x994d('0x41')]);var _0x4cb5e2=_['map'](_0x4fc6e9,function(_0x354a5e){return _0x354a5e['id']['toString']();});var _0x1525f4=_[_0x994d('0x42')](_0x4fc6e9,function(_0x2b1c3c){return _0x2b1c3c['id'][_0x994d('0x43')]();});var _0x571fc8=_0x4f5e8a?_0x4cb5e2:_[_0x994d('0x44')](_0x4cb5e2,_0x10a3fb);var _0xb8bba8=_[_0x994d('0x45')](_0x4cb5e2,_0x10a3fb);var _0x409754=_[_0x994d('0x44')](_0x10a3fb,_0x4cb5e2);var _0x39751f;var _0x23cd71;for(_0x39751f=0x0;_0x39751f<_0x409754[_0x994d('0x46')]&&!_0x4f5e8a;_0x39751f+=0x1){_0x23cd71=_0x409754[_0x39751f][_0x994d('0x43')]();if(manager[_0x994d('0x47')](_0x23cd71)){manager[_0x994d('0x48')](_0x23cd71);manager['deleteJob'](_0x23cd71);logger[_0x994d('0xd')]('delete\x20cron',_0x23cd71);}}logger[_0x994d('0xd')](_0x994d('0x49'),JSON[_0x994d('0x2b')](_0x571fc8));for(_0x39751f=0x0;_0x39751f<_0x571fc8[_0x994d('0x46')];_0x39751f+=0x1){_0x23cd71=_0x571fc8[_0x39751f]['toString']();logger[_0x994d('0xd')](_0x994d('0x4a'),_0x23cd71);if(_0x4f5e8a){logger[_0x994d('0xd')](_0x994d('0x4b'),_0x4f5e8a);logger[_0x994d('0xd')](JSON[_0x994d('0x2b')](_0x1525f4[_0x23cd71]));BPromise[_0x994d('0x4c')]()[_0x994d('0x3a')](handleJob(_0x1525f4[_0x23cd71]));logger['info'](_0x994d('0x4d'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else if(_0x1525f4[_0x23cd71][_0x994d('0x4e')]&&_0x1525f4[_0x23cd71][_0x994d('0x4f')]&&moment()[_0x994d('0x50')](_0x1525f4[_0x23cd71][_0x994d('0x51')],_0x1525f4[_0x23cd71][_0x994d('0x52')])){manager[_0x994d('0x53')](_0x23cd71,_0x1525f4[_0x23cd71][_0x994d('0x4e')],handleJob(_0x1525f4[_0x23cd71]));manager[_0x994d('0x54')](_0x23cd71);logger['info'](_0x994d('0x55'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else if(manager[_0x994d('0x47')](_0x23cd71)){manager['stop'](_0x23cd71);manager[_0x994d('0x56')](_0x23cd71);logger[_0x994d('0xd')](_0x994d('0x57'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}}for(_0x39751f=0x0,_0x23cd71;_0x39751f<_0xb8bba8[_0x994d('0x46')]&&!_0x4f5e8a;_0x39751f+=0x1){_0x23cd71=_0xb8bba8[_0x39751f][_0x994d('0x43')]();if(manager[_0x994d('0x47')](_0x23cd71)){if(_0x1525f4[_0x23cd71][_0x994d('0x4e')]&&_0x1525f4[_0x23cd71]['active']&&moment()[_0x994d('0x50')](_0x1525f4[_0x23cd71]['startAt'],_0x1525f4[_0x23cd71][_0x994d('0x52')])){manager[_0x994d('0x58')](_0x23cd71,_0x1525f4[_0x23cd71][_0x994d('0x4e')],handleJob(_0x1525f4[_0x23cd71]));logger[_0x994d('0xd')]('update\x20cron',_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else{manager[_0x994d('0x48')](_0x23cd71);manager[_0x994d('0x56')](_0x23cd71);logger[_0x994d('0xd')](_0x994d('0x57'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}}}})[_0x994d('0x2d')](function(_0x5a03b6){logger[_0x994d('0x2a')](JSON['stringify'](_0x5a03b6));});}exports[_0x994d('0x59')]=function(_0x105930){return getJobs(_0x105930);};exports[_0x994d('0x54')]=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 98d0c1f..8d7c8ef 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 _0xa478=['../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','sentiment','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','COMPLETED','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa478,0x136));var _0x8a47=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa478[_0x4ea69d];return _0x5318e0;};var _=require(_0x8a47('0x0'));var AWS=require(_0x8a47('0x1'));var rp=require(_0x8a47('0x2'));var util=require(_0x8a47('0x3'));var BPromise=require(_0x8a47('0x4'));var db=require(_0x8a47('0x5'))['db'];var logger=require(_0x8a47('0x6'))(_0x8a47('0x7'));function getTranscriptionJob(_0x2b3110,_0x256550,_0x6e2ab5,_0x46a4cd){return new Promise(function(_0x50226a,_0x413787){var _0x2d62a6=new AWS[(_0x8a47('0x8'))]({'accessKeyId':_0x256550,'secretAccessKey':_0x2b3110,'region':_0x6e2ab5});_0x2d62a6[_0x8a47('0x9')]({'TranscriptionJobName':_0x46a4cd},function(_0x56884b,_0x384886){if(_0x56884b){return _0x413787(_0x56884b);}else{return _0x50226a(_0x384886);}});});}function sentiment(_0x547fe7,_0x7b6e61,_0x369fc9,_0x3a6cc4,_0x574c96){return new Promise(function(_0xe65646,_0x230a11){var _0x493d7b=new AWS[(_0x8a47('0xa'))]({'accessKeyId':_0x7b6e61,'secretAccessKey':_0x547fe7,'region':_0x369fc9});_0x493d7b['detectSentiment']({'Text':_0x3a6cc4,'LanguageCode':_0x574c96[_0x8a47('0xb')](0x0,0x2)},function(_0x25b1a3,_0x2b7640){if(_0x25b1a3){return _0x230a11(_0x25b1a3);}else{return _0xe65646(_0x2b7640);}});});}function checkTranscribeJob(_0x5c6356,_0x5e3166,_0x59efc7){var _0x36941a;return new BPromise(function(_0x12539c,_0x5b1f15){logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0xe'),_0x5c6356['id'],_0x5c6356[_0x8a47('0xf')]));return getTranscriptionJob(_0x59efc7[_0x8a47('0x10')],_0x59efc7[_0x8a47('0x11')],_0x5e3166[_0x8a47('0x12')],_0x5c6356[_0x8a47('0xf')])[_0x8a47('0x13')](function(_0x18f2be){logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0x14'),_0x5c6356['id'],_0x5c6356['transcribeName'],_0x18f2be[_0x8a47('0x15')][_0x8a47('0x16')]));if(!_0x5c6356[_0x8a47('0x17')]){switch(_0x18f2be['TranscriptionJob'][_0x8a47('0x16')]){case'COMPLETED':var _0x538ed2={'transcribeStatus':_0x18f2be[_0x8a47('0x15')][_0x8a47('0x16')],'fileUri':_0x18f2be[_0x8a47('0x15')][_0x8a47('0x18')][_0x8a47('0x19')]};logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0x1a'),_0x5c6356['id']));return rp({'uri':_0x18f2be[_0x8a47('0x15')][_0x8a47('0x18')]['TranscriptFileUri'],'json':!![]})[_0x8a47('0x13')](function(_0x5923ec){logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0x1b'),_0x5c6356['id']));if(_0x5923ec&&_0x5923ec[_0x8a47('0x1c')]&&_0x5923ec['results'][_0x8a47('0x1d')]&&_0x5923ec['results']['transcripts']['length']){_0x538ed2['fileText']='';for(var _0xf46d2c=0x0;_0xf46d2c<_0x5923ec[_0x8a47('0x1c')]['transcripts'][_0x8a47('0x1e')];_0xf46d2c++){_0x538ed2[_0x8a47('0x17')]+=_0x5923ec[_0x8a47('0x1c')][_0x8a47('0x1d')][_0xf46d2c][_0x8a47('0x1f')]+'';}}return _0x5c6356[_0x8a47('0x20')](_0x538ed2);})[_0x8a47('0x13')](function(){logger['info'](util[_0x8a47('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5c6356['id']));if(!_0x5c6356[_0x8a47('0x21')]){throw new db[(_0x8a47('0x22'))]['ValidationError'](_0x8a47('0x23'));}if(!_0x5e3166['sentiment']||!_0x5e3166['sentimentAccountId']||!_0x5e3166[_0x8a47('0x24')]||!_0x5e3166[_0x8a47('0x25')]||!_0x5e3166[_0x8a47('0x26')]){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x28'));}if(!_0x538ed2['fileText']){throw new Error(_0x8a47('0x29'));}if(_0x5e3166['sentimentAccountId']===_0x59efc7['id']){return _0x59efc7;}else{return db['CloudProvider'][_0x8a47('0x2a')]({'where':{'id':_settings[_0x8a47('0x2b')]}});}})[_0x8a47('0x13')](function(_0x52dc7f){if(!_0x52dc7f){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x2c'));}if(!_0x52dc7f[_0x8a47('0x10')]||!_0x52dc7f[_0x8a47('0x11')]){throw new db[(_0x8a47('0x22'))]['ValidationError'](_0x8a47('0x2d'));}_0x36941a=_0x52dc7f;logger[_0x8a47('0xc')](util[_0x8a47('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5c6356['id']));return sentiment(_0x36941a[_0x8a47('0x10')],_0x36941a[_0x8a47('0x11')],_0x5e3166['sentimentRegion'],_0x538ed2[_0x8a47('0x17')],_0x5e3166[_0x8a47('0x25')]);})[_0x8a47('0x13')](function(_0x20551b){logger['info'](util['format'](_0x8a47('0x2e'),_0x5c6356['id']));return _0x5c6356[_0x8a47('0x20')]({'sentiment':_0x20551b[_0x8a47('0x2f')],'sPositive':_0x20551b[_0x8a47('0x30')][_0x8a47('0x31')],'sNegative':_0x20551b[_0x8a47('0x30')][_0x8a47('0x32')],'sMixed':_0x20551b['SentimentScore']['Mixed'],'sNeutral':_0x20551b[_0x8a47('0x30')][_0x8a47('0x33')]});})[_0x8a47('0x13')](function(){logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0x34'),_0x5c6356['id']));_0x12539c();});case _0x8a47('0x35'):return _0x5c6356[_0x8a47('0x20')]({'transcribeStatus':_0x8a47('0x35'),'failureReason':_0x18f2be[_0x8a47('0x15')][_0x8a47('0x36')]})['then'](function(){logger[_0x8a47('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5c6356['id']));_0x12539c();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5c6356['id']));break;}}else{return BPromise[_0x8a47('0x37')]()[_0x8a47('0x13')](function(){if(!_0x5c6356[_0x8a47('0x21')]){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x23'));}if(!_0x5e3166[_0x8a47('0x38')]||!_0x5e3166[_0x8a47('0x2b')]||!_0x5e3166['sentimentRegion']||!_0x5e3166['language']||!_0x5e3166[_0x8a47('0x26')]){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x28'));}if(!_0x5c6356['fileText']){throw new Error(_0x8a47('0x29'));}if(_0x5e3166[_0x8a47('0x2b')]===_0x59efc7['id']){return _0x59efc7;}else{return db[_0x8a47('0x39')][_0x8a47('0x2a')]({'where':{'id':_settings[_0x8a47('0x2b')]}});}})['then'](function(_0x337007){if(!_0x337007){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x337007[_0x8a47('0x10')]||!_0x337007[_0x8a47('0x11')]){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x36941a=_0x337007;logger[_0x8a47('0xc')](util[_0x8a47('0xd')](_0x8a47('0x3a'),_0x5c6356['id']));return sentiment(_0x36941a[_0x8a47('0x10')],_0x36941a[_0x8a47('0x11')],_0x5e3166[_0x8a47('0x24')],_0x5c6356['fileText'],_0x5e3166['language']);})[_0x8a47('0x13')](function(_0x35ff52){logger[_0x8a47('0xc')](util['format'](_0x8a47('0x2e'),_0x5c6356['id']));return _0x5c6356[_0x8a47('0x20')]({'sentiment':_0x35ff52['Sentiment'],'sPositive':_0x35ff52['SentimentScore'][_0x8a47('0x31')],'sNegative':_0x35ff52['SentimentScore'][_0x8a47('0x32')],'sMixed':_0x35ff52[_0x8a47('0x30')][_0x8a47('0x3b')],'sNeutral':_0x35ff52[_0x8a47('0x30')][_0x8a47('0x33')],'transcribeStatus':_0x8a47('0x3c')});})['then'](function(){logger['info'](util[_0x8a47('0xd')](_0x8a47('0x34'),_0x5c6356['id']));_0x12539c();});}})[_0x8a47('0x3d')](function(_0x33ab13){if(_0x33ab13){if(!_0x33ab13[_0x8a47('0x3e')]||_0x33ab13['name']!=='SequelizeValidationError'){logger[_0x8a47('0x3f')](util['format'](_0x8a47('0x40'),_0x5c6356['id']),util[_0x8a47('0x41')](_0x33ab13,{'showHidden':![],'depth':null}));}}_0x12539c();});});}function checkTranscribe(){var _0x502baa;var _0x1442a8;var _0x237ed1;return db[_0x8a47('0x42')][_0x8a47('0x43')]({'where':{'transcribeStatus':_0x8a47('0x44')}})[_0x8a47('0x13')](function(_0x29eb79){if(!_0x29eb79||!_0x29eb79[_0x8a47('0x1e')]){throw new db['Sequelize'][(_0x8a47('0x27'))](_0x8a47('0x45'));}_0x502baa=_0x29eb79;return db[_0x8a47('0x46')][_0x8a47('0x2a')]({'where':{'id':0x1}});})['then'](function(_0x11db4e){if(!_0x11db4e){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x47'));}_0x1442a8=_0x11db4e;if(!_0x1442a8[_0x8a47('0x7')]||!_0x1442a8[_0x8a47('0x48')]||!_0x1442a8['transcribeRegion']||!_0x1442a8['language']||!_0x1442a8[_0x8a47('0x26')]){throw new db['Sequelize'][(_0x8a47('0x27'))](_0x8a47('0x49'));}return db['CloudProvider'][_0x8a47('0x2a')]({'where':{'id':_0x1442a8['transcribeAccountId']}});})[_0x8a47('0x13')](function(_0x5c5577){if(!_0x5c5577){throw new db[(_0x8a47('0x22'))]['ValidationError'](_0x8a47('0x2c'));}if(!_0x5c5577[_0x8a47('0x10')]||!_0x5c5577[_0x8a47('0x11')]){throw new db[(_0x8a47('0x22'))][(_0x8a47('0x27'))](_0x8a47('0x2d'));}_0x237ed1=_0x5c5577;var _0x3ef9b2=[];_0x502baa[_0x8a47('0x4a')](function(_0x25c9ec){_0x3ef9b2[_0x8a47('0x4b')](checkTranscribeJob(_0x25c9ec,_0x1442a8,_0x237ed1));});return BPromise[_0x8a47('0x4c')](_0x3ef9b2);})['catch'](function(_0xd8a8bc){if(_0xd8a8bc){if(!_0xd8a8bc[_0x8a47('0x3e')]||_0xd8a8bc['name']!==_0x8a47('0x4d')){logger[_0x8a47('0x3f')](util[_0x8a47('0x41')](_0xd8a8bc,{'showHidden':![],'depth':null}));}}});}exports[_0x8a47('0x4e')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9ab9=['transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','ValidationError','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','error','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results'];(function(_0x96c15f,_0x538403){var _0x202a78=function(_0x311a4a){while(--_0x311a4a){_0x96c15f['push'](_0x96c15f['shift']());}};_0x202a78(++_0x538403);}(_0x9ab9,0x19d));var _0x99ab=function(_0x168d40,_0x5b02b7){_0x168d40=_0x168d40-0x0;var _0x32e04a=_0x9ab9[_0x168d40];return _0x32e04a;};var _=require(_0x99ab('0x0'));var AWS=require(_0x99ab('0x1'));var rp=require(_0x99ab('0x2'));var util=require(_0x99ab('0x3'));var BPromise=require(_0x99ab('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x99ab('0x5'))(_0x99ab('0x6'));function getTranscriptionJob(_0x5f28e4,_0x1b1c96,_0x49761a,_0x442e8c){return new Promise(function(_0x1042a3,_0x390d41){var _0x249c1f=new AWS[(_0x99ab('0x7'))]({'accessKeyId':_0x1b1c96,'secretAccessKey':_0x5f28e4,'region':_0x49761a});_0x249c1f['getTranscriptionJob']({'TranscriptionJobName':_0x442e8c},function(_0x5762c1,_0x3f5a2c){if(_0x5762c1){return _0x390d41(_0x5762c1);}else{return _0x1042a3(_0x3f5a2c);}});});}function sentiment(_0x18ca95,_0x4e94f0,_0x14d083,_0xa40f42,_0x1477cc){return new Promise(function(_0xe1660b,_0xe82b20){var _0x23e904=new AWS['Comprehend']({'accessKeyId':_0x4e94f0,'secretAccessKey':_0x18ca95,'region':_0x14d083});_0x23e904[_0x99ab('0x8')]({'Text':_0xa40f42,'LanguageCode':_0x1477cc[_0x99ab('0x9')](0x0,0x2)},function(_0xffdfeb,_0x5bd277){if(_0xffdfeb){return _0xe82b20(_0xffdfeb);}else{return _0xe1660b(_0x5bd277);}});});}function checkTranscribeJob(_0x4e7b4a,_0xed2100,_0x24229c){var _0x3739fb;return new BPromise(function(_0x3b3bba,_0x25f225){logger[_0x99ab('0xa')](util['format'](_0x99ab('0xb'),_0x4e7b4a['id'],_0x4e7b4a[_0x99ab('0xc')]));return getTranscriptionJob(_0x24229c['data1'],_0x24229c[_0x99ab('0xd')],_0xed2100[_0x99ab('0xe')],_0x4e7b4a[_0x99ab('0xc')])['then'](function(_0x4299ae){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x10'),_0x4e7b4a['id'],_0x4e7b4a[_0x99ab('0xc')],_0x4299ae[_0x99ab('0x11')][_0x99ab('0x12')]));if(!_0x4e7b4a[_0x99ab('0x13')]){switch(_0x4299ae['TranscriptionJob'][_0x99ab('0x12')]){case _0x99ab('0x14'):var _0x4193c0={'transcribeStatus':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x12')],'fileUri':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x15')][_0x99ab('0x16')]};logger[_0x99ab('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x4e7b4a['id']));return rp({'uri':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x15')][_0x99ab('0x16')],'json':!![]})['then'](function(_0x2e0464){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x17'),_0x4e7b4a['id']));if(_0x2e0464&&_0x2e0464[_0x99ab('0x18')]&&_0x2e0464[_0x99ab('0x18')][_0x99ab('0x19')]&&_0x2e0464['results'][_0x99ab('0x19')]['length']){_0x4193c0[_0x99ab('0x13')]='';for(var _0x56bdb7=0x0;_0x56bdb7<_0x2e0464['results'][_0x99ab('0x19')][_0x99ab('0x1a')];_0x56bdb7++){_0x4193c0[_0x99ab('0x13')]+=_0x2e0464['results'][_0x99ab('0x19')][_0x56bdb7][_0x99ab('0x1b')]+'';}}return _0x4e7b4a[_0x99ab('0x1c')](_0x4193c0);})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));if(!_0x4e7b4a[_0x99ab('0x1f')]){throw new db[(_0x99ab('0x20'))]['ValidationError'](_0x99ab('0x21'));}if(!_0xed2100[_0x99ab('0x22')]||!_0xed2100['sentimentAccountId']||!_0xed2100[_0x99ab('0x23')]||!_0xed2100[_0x99ab('0x24')]||!_0xed2100[_0x99ab('0x25')]){throw new db['Sequelize']['ValidationError'](_0x99ab('0x26'));}if(!_0x4193c0[_0x99ab('0x13')]){throw new Error(_0x99ab('0x27'));}if(_0xed2100[_0x99ab('0x28')]===_0x24229c['id']){return _0x24229c;}else{return db[_0x99ab('0x29')][_0x99ab('0x2a')]({'where':{'id':_settings[_0x99ab('0x28')]}});}})[_0x99ab('0x1d')](function(_0x5ba1ea){if(!_0x5ba1ea){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ba1ea[_0x99ab('0x2c')]||!_0x5ba1ea[_0x99ab('0xd')]){throw new db['Sequelize']['ValidationError'](_0x99ab('0x2d'));}_0x3739fb=_0x5ba1ea;logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4e7b4a['id']));return sentiment(_0x3739fb['data1'],_0x3739fb['data2'],_0xed2100['sentimentRegion'],_0x4193c0['fileText'],_0xed2100['language']);})[_0x99ab('0x1d')](function(_0x306721){logger[_0x99ab('0xa')](util['format'](_0x99ab('0x2e'),_0x4e7b4a['id']));return _0x4e7b4a[_0x99ab('0x1c')]({'sentiment':_0x306721[_0x99ab('0x2f')],'sPositive':_0x306721['SentimentScore'][_0x99ab('0x30')],'sNegative':_0x306721[_0x99ab('0x31')][_0x99ab('0x32')],'sMixed':_0x306721[_0x99ab('0x31')][_0x99ab('0x33')],'sNeutral':_0x306721[_0x99ab('0x31')][_0x99ab('0x34')]});})['then'](function(){logger['info'](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));_0x3b3bba();});case'FAILED':return _0x4e7b4a[_0x99ab('0x1c')]({'transcribeStatus':_0x99ab('0x35'),'failureReason':_0x4299ae[_0x99ab('0x11')]['FailureReason']})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));_0x3b3bba();});default:logger[_0x99ab('0xa')](util['format'](_0x99ab('0x36'),_0x4e7b4a['id']));break;}}else{return BPromise[_0x99ab('0x37')]()['then'](function(){if(!_0x4e7b4a[_0x99ab('0x1f')]){throw new db['Sequelize'][(_0x99ab('0x2b'))](_0x99ab('0x21'));}if(!_0xed2100[_0x99ab('0x22')]||!_0xed2100[_0x99ab('0x28')]||!_0xed2100[_0x99ab('0x23')]||!_0xed2100[_0x99ab('0x24')]||!_0xed2100[_0x99ab('0x25')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x26'));}if(!_0x4e7b4a['fileText']){throw new Error(_0x99ab('0x27'));}if(_0xed2100[_0x99ab('0x28')]===_0x24229c['id']){return _0x24229c;}else{return db['CloudProvider'][_0x99ab('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x99ab('0x1d')](function(_0x5bee18){if(!_0x5bee18){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x38'));}if(!_0x5bee18[_0x99ab('0x2c')]||!_0x5bee18['data2']){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x2d'));}_0x3739fb=_0x5bee18;logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x39'),_0x4e7b4a['id']));return sentiment(_0x3739fb[_0x99ab('0x2c')],_0x3739fb[_0x99ab('0xd')],_0xed2100[_0x99ab('0x23')],_0x4e7b4a[_0x99ab('0x13')],_0xed2100[_0x99ab('0x24')]);})[_0x99ab('0x1d')](function(_0x48648d){logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4e7b4a['id']));return _0x4e7b4a[_0x99ab('0x1c')]({'sentiment':_0x48648d[_0x99ab('0x2f')],'sPositive':_0x48648d['SentimentScore'][_0x99ab('0x30')],'sNegative':_0x48648d[_0x99ab('0x31')][_0x99ab('0x32')],'sMixed':_0x48648d[_0x99ab('0x31')][_0x99ab('0x33')],'sNeutral':_0x48648d[_0x99ab('0x31')][_0x99ab('0x34')],'transcribeStatus':_0x99ab('0x14')});})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e7b4a['id']));_0x3b3bba();});}})[_0x99ab('0x3a')](function(_0x313cd0){if(_0x313cd0){if(!_0x313cd0[_0x99ab('0x3b')]||_0x313cd0[_0x99ab('0x3b')]!=='SequelizeValidationError'){logger['error'](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4e7b4a['id']),util[_0x99ab('0x3c')](_0x313cd0,{'showHidden':![],'depth':null}));}}_0x3b3bba();});});}function checkTranscribe(){var _0xd44d36;var _0x241345;var _0x3953dc;return db[_0x99ab('0x3d')][_0x99ab('0x3e')]({'where':{'transcribeStatus':_0x99ab('0x3f')}})['then'](function(_0x441d2e){if(!_0x441d2e||!_0x441d2e[_0x99ab('0x1a')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x40'));}_0xd44d36=_0x441d2e;return db[_0x99ab('0x41')][_0x99ab('0x2a')]({'where':{'id':0x1}});})[_0x99ab('0x1d')](function(_0x3b6e32){if(!_0x3b6e32){throw new db[(_0x99ab('0x20'))]['ValidationError'](_0x99ab('0x42'));}_0x241345=_0x3b6e32;if(!_0x241345[_0x99ab('0x6')]||!_0x241345['transcribeAccountId']||!_0x241345[_0x99ab('0xe')]||!_0x241345[_0x99ab('0x24')]||!_0x241345[_0x99ab('0x25')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x43'));}return db[_0x99ab('0x29')]['findOne']({'where':{'id':_0x241345[_0x99ab('0x44')]}});})[_0x99ab('0x1d')](function(_0x46814a){if(!_0x46814a){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x46814a['data1']||!_0x46814a[_0x99ab('0xd')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x2d'));}_0x3953dc=_0x46814a;var _0x5af4a6=[];_0xd44d36[_0x99ab('0x45')](function(_0x498078){_0x5af4a6[_0x99ab('0x46')](checkTranscribeJob(_0x498078,_0x241345,_0x3953dc));});return BPromise[_0x99ab('0x47')](_0x5af4a6);})['catch'](function(_0xd93031){if(_0xd93031){if(!_0xd93031[_0x99ab('0x3b')]||_0xd93031[_0x99ab('0x3b')]!=='SequelizeValidationError'){logger[_0x99ab('0x48')](util[_0x99ab('0x3c')](_0xd93031,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 244f049..10288df 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 _0x88a4=['hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','../../mysqldb','../logger','redis','defaults','WhatsappInteraction','findAll','lastMsgAt'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x88a4,0x12f));var _0x488a=function(_0x1c9530,_0x21cc98){_0x1c9530=_0x1c9530-0x0;var _0x59dba5=_0x88a4[_0x1c9530];return _0x59dba5;};'use strict';var _=require(_0x488a('0x0'));var moment=require(_0x488a('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require(_0x488a('0x2'))['db'];var logger=require(_0x488a('0x3'))('schedule');config[_0x488a('0x4')]=_[_0x488a('0x5')](config[_0x488a('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x488a('0x4')]));function closeInteractions(){var _0x1c5d4a=[];return db[_0x488a('0x6')][_0x488a('0x7')]({'raw':!![],'attributes':['id',_0x488a('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x488a('0x9'))}}})['then'](function(_0xa8ce28){if(_0xa8ce28&&_0xa8ce28[_0x488a('0xa')]){_0x1c5d4a=_[_0x488a('0xb')](_0xa8ce28||[],'id');logger[_0x488a('0xc')](_0x488a('0xd'),_0x1c5d4a[_0x488a('0xe')]());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x488a('0xf')](_0x488a('0x10'))},{'where':{'id':_0x1c5d4a}});}})[_0x488a('0x11')](function(){if(_0x1c5d4a&&_0x1c5d4a[_0x488a('0xa')]){logger[_0x488a('0xc')](_0x488a('0x12'),_0x1c5d4a['join']());for(var _0x3ad14a=0x0;_0x3ad14a<_0x1c5d4a[_0x488a('0xa')];_0x3ad14a++){io['emit'](_0x488a('0x13'),{'id':_0x1c5d4a[_0x3ad14a],'closed':!![]});}}})[_0x488a('0x14')](function(_0x1e1e66){logger[_0x488a('0x15')](_0x488a('0x16'),_0x1e1e66?util['inspect'](_0x1e1e66,{'showHidden':![],'depth':null}):'');});}exports[_0x488a('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3d0d=['redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','join','update','system','timeout','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','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x230ea7,_0x5225da){var _0x123485=function(_0x1979b2){while(--_0x1979b2){_0x230ea7['push'](_0x230ea7['shift']());}};_0x123485(++_0x5225da);}(_0x3d0d,0x144));var _0xd3d0=function(_0x29b551,_0x25b753){_0x29b551=_0x29b551-0x0;var _0x3b6101=_0x3d0d[_0x29b551];return _0x3b6101;};'use strict';var _=require(_0xd3d0('0x0'));var moment=require('moment');var Redis=require(_0xd3d0('0x1'));var util=require('util');var config=require(_0xd3d0('0x2'));var db=require(_0xd3d0('0x3'))['db'];var logger=require(_0xd3d0('0x4'))(_0xd3d0('0x5'));config[_0xd3d0('0x6')]=_[_0xd3d0('0x7')](config[_0xd3d0('0x6')],{'host':_0xd3d0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3d0('0x6')]));function closeInteractions(){var _0x3e2c1d=[];return db[_0xd3d0('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xd3d0('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd3d0('0xb')](0x18,_0xd3d0('0xc'))}}})[_0xd3d0('0xd')](function(_0x468921){if(_0x468921&&_0x468921[_0xd3d0('0xe')]){_0x3e2c1d=_[_0xd3d0('0xf')](_0x468921||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e2c1d[_0xd3d0('0x10')]());return db[_0xd3d0('0x9')][_0xd3d0('0x11')]({'closeReason':_0xd3d0('0x12'),'disposition':_0xd3d0('0x13'),'closed':!![],'closedAt':moment()[_0xd3d0('0x14')](_0xd3d0('0x15'))},{'where':{'id':_0x3e2c1d}});}})[_0xd3d0('0xd')](function(){if(_0x3e2c1d&&_0x3e2c1d['length']){logger['info'](_0xd3d0('0x16'),_0x3e2c1d[_0xd3d0('0x10')]());for(var _0xcea781=0x0;_0xcea781<_0x3e2c1d['length'];_0xcea781++){io[_0xd3d0('0x17')](_0xd3d0('0x18'),{'id':_0x3e2c1d[_0xcea781],'closed':!![]});}}})[_0xd3d0('0x19')](function(_0x484ba0){logger[_0xd3d0('0x1a')](_0xd3d0('0x1b'),_0x484ba0?util[_0xd3d0('0x1c')](_0x484ba0,{'showHidden':![],'depth':null}):'');});}exports[_0xd3d0('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5b6ed4b..6dcd1e8 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe76c=['finished\x20populating','contacts1','CmHopper','hopper1','hopper2','util','../mysqldb','Innocenzo','Biondo','@xcally.com','now','push','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xe76c,0x113));var _0xce76=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xe76c[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0xce76('0x0'));var db=require(_0xce76('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xce76('0x2')+i,'lastName':_0xce76('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xce76('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce76('0x5')](),'updatedAt':Date[_0xce76('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xce76('0x6')]({'id':i,'firstName':_0xce76('0x2')+i,'lastName':_0xce76('0x3')+i,'phone':0xf879fb460+i,'email':_0xce76('0x7')+i+_0xce76('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce76('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xce76('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce76('0x5')](),'updatedAt':Date[_0xce76('0x5')]()});}db[_0xce76('0x8')][_0xce76('0x9')]({'where':{}})[_0xce76('0xa')](function(){return db['CmContact'][_0xce76('0xb')](contacts);})[_0xce76('0xa')](function(){console[_0xce76('0xc')](_0xce76('0xd'),_0xce76('0xe'));return db[_0xce76('0xf')][_0xce76('0x9')]({'where':{}});})[_0xce76('0xa')](function(){return db[_0xce76('0xf')]['bulkCreate'](hopper);})[_0xce76('0xa')](function(){console[_0xce76('0xc')](_0xce76('0xd'),_0xce76('0x10'));return db[_0xce76('0x8')][_0xce76('0xb')](contacts2);})[_0xce76('0xa')](function(){console[_0xce76('0xc')](_0xce76('0xd'),'contacts2');return db[_0xce76('0xf')][_0xce76('0xb')](hopper2);})['then'](function(){console[_0xce76('0xc')](_0xce76('0xd'),_0xce76('0x11'));})['catch'](function(_0x696373){console[_0xce76('0xc')](_0x696373);}); \ No newline at end of file +var _0xcedb=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate'];(function(_0x63de62,_0xe5cc89){var _0x3daddf=function(_0x2a5d79){while(--_0x2a5d79){_0x63de62['push'](_0x63de62['shift']());}};_0x3daddf(++_0xe5cc89);}(_0xcedb,0x116));var _0xbced=function(_0x26287a,_0x12c88b){_0x26287a=_0x26287a-0x0;var _0x4210d4=_0xcedb[_0x26287a];return _0x4210d4;};'use strict';var util=require(_0xbced('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbced('0x1')]({'id':i,'firstName':_0xbced('0x2')+i,'lastName':_0xbced('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbced('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xbced('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xbced('0x2')+i,'lastName':_0xbced('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbced('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbced('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbced('0x4')](),'updatedAt':Date['now']()});}db[_0xbced('0x6')][_0xbced('0x7')]({'where':{}})[_0xbced('0x8')](function(){return db['CmContact'][_0xbced('0x9')](contacts);})[_0xbced('0x8')](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xc'));return db[_0xbced('0xd')][_0xbced('0x7')]({'where':{}});})['then'](function(){return db[_0xbced('0xd')][_0xbced('0x9')](hopper);})['then'](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xe'));return db['CmContact'][_0xbced('0x9')](contacts2);})[_0xbced('0x8')](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xf'));return db[_0xbced('0xd')]['bulkCreate'](hopper2);})[_0xbced('0x8')](function(){console['log']('finished\x20populating',_0xbced('0x10'));})[_0xbced('0x11')](function(_0x3b1c2d){console[_0xbced('0xa')](_0x3b1c2d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ad5ada5..9cf6d09 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc017=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','bulkCreate','then','log','util','format','%s%s','agent','%s%s@xcally.com','friend','udp','all','ulaw'];(function(_0x12b674,_0x8dee8d){var _0x475d11=function(_0x15493c){while(--_0x15493c){_0x12b674['push'](_0x12b674['shift']());}};_0x475d11(++_0x8dee8d);}(_0xc017,0x19b));var _0x7c01=function(_0x567f53,_0x1e0fc4){_0x567f53=_0x567f53-0x0;var _0x589467=_0xc017[_0x567f53];return _0x589467;};'use strict';var util=require(_0x7c01('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x7c01('0x1')](_0x7c01('0x2'),_0x7c01('0x3'),i),'fullname':util[_0x7c01('0x1')](_0x7c01('0x2'),_0x7c01('0x3'),i),'email':util[_0x7c01('0x1')](_0x7c01('0x4'),'agent',i),'role':_0x7c01('0x3'),'password':'password','internal':0xfa0+i,'type':_0x7c01('0x5'),'transport':[_0x7c01('0x6'),'ws','wss'],'disallow':[_0x7c01('0x7')],'allow':[_0x7c01('0x8')],'defaultuser':util['format'](_0x7c01('0x2'),'agent',i),'encryption':_0x7c01('0x9'),'avpf':_0x7c01('0x9'),'force_avp':'yes','icesupport':_0x7c01('0x9'),'dtlsenable':_0x7c01('0x9'),'dtlsverify':'no','dtlscertfile':_0x7c01('0xa'),'dtlsprivatekey':_0x7c01('0xb'),'dtlssetup':'actpass','callerid':util[_0x7c01('0x1')]('\x22%s\x22\x20<%s>',util[_0x7c01('0x1')]('%s%s',_0x7c01('0x3'),i),0xfa0+i)});}db['User'][_0x7c01('0xc')](users)[_0x7c01('0xd')](function(){console[_0x7c01('0xe')]('add\x20user');})['catch'](function(_0x1cd45e){console[_0x7c01('0xe')](_0x1cd45e);}); \ No newline at end of file +var _0xeb65=['password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb65,0xa5));var _0x5eb6=function(_0x8391,_0x276214){_0x8391=_0x8391-0x0;var _0x4d36bd=_0xeb65[_0x8391];return _0x4d36bd;};'use strict';var util=require(_0x5eb6('0x0'));var db=require(_0x5eb6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x5eb6('0x2')](_0x5eb6('0x3'),'agent',i),'fullname':util[_0x5eb6('0x2')](_0x5eb6('0x3'),_0x5eb6('0x4'),i),'email':util[_0x5eb6('0x2')](_0x5eb6('0x5'),'agent',i),'role':'agent','password':_0x5eb6('0x6'),'internal':0xfa0+i,'type':_0x5eb6('0x7'),'transport':[_0x5eb6('0x8'),'ws',_0x5eb6('0x9')],'disallow':['all'],'allow':[_0x5eb6('0xa')],'defaultuser':util[_0x5eb6('0x2')]('%s%s',_0x5eb6('0x4'),i),'encryption':_0x5eb6('0xb'),'avpf':_0x5eb6('0xb'),'force_avp':_0x5eb6('0xb'),'icesupport':_0x5eb6('0xb'),'dtlsenable':_0x5eb6('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x5eb6('0xc'),'dtlssetup':_0x5eb6('0xd'),'callerid':util[_0x5eb6('0x2')](_0x5eb6('0xe'),util[_0x5eb6('0x2')](_0x5eb6('0x3'),_0x5eb6('0x4'),i),0xfa0+i)});}db[_0x5eb6('0xf')][_0x5eb6('0x10')](users)['then'](function(){console[_0x5eb6('0x11')]('add\x20user');})[_0x5eb6('0x12')](function(_0x54b913){console[_0x5eb6('0x11')](_0x54b913);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ef527f5..0dafcfa 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee9c=['User','name','agent','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','role','telephone','Campaign','type','format','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','user','VoiceQueue','SmsQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xee9c,0x1e6));var _0xcee9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xee9c[_0x12ca5f];return _0xfc3ae9;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var BPromise=require(_0xcee9('0x1'));var db=require(_0xcee9('0x2'))['db'];var config=require(_0xcee9('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xcee9('0x4')],'attributes':['id',_0xcee9('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcee9('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xcee9('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xcee9('0x5')],'where':{'role':_0xcee9('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xcee9('0x7')}};function getAssociatedResources(_0x18ebe9,_0x52fcc1,_0x7c80be){return db[_0xcee9('0x8')][_0xcee9('0x9')]({'where':{'name':_0x18ebe9,'userProfileId':_0x52fcc1},'raw':!![]})[_0xcee9('0xa')](function(_0x10f960){if(_0x10f960){if(_0x10f960[_0xcee9('0xb')]){switch(_0x18ebe9){case'VoiceQueues':case _0xcee9('0xc'):case _0xcee9('0xd'):case'SmsQueues':case _0xcee9('0xe'):case _0xcee9('0xf'):case _0xcee9('0x10'):return db[_0x7c80be]['findAll'](queryQueues);case _0xcee9('0x11'):return db[_0x7c80be][_0xcee9('0x12')](queryTelephones);case _0xcee9('0x13'):return db[_0x7c80be][_0xcee9('0x12')](queryTrunks);case _0xcee9('0x14'):return db[_0x7c80be]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xcee9('0x12')]({'attributes':[_0xcee9('0x15')],'where':{'sectionId':_0x10f960['id']},'raw':!![]})[_0xcee9('0xa')](function(_0x1eb62c){if(_0x1eb62c){var _0x3a513f={'where':{'id':_[_0xcee9('0x16')](_0x1eb62c,_0xcee9('0x15'))},'raw':!![]};switch(_0x7c80be){case _0xcee9('0x4'):_0x3a513f[_0xcee9('0x17')][_0xcee9('0x18')]=_0xcee9('0x19');break;case _0xcee9('0x1a'):_0x3a513f['where'][_0xcee9('0x1b')]=_0xcee9('0x7');break;}return db[_0x7c80be][_0xcee9('0x12')](_0x3a513f);}else{return[];}});}}else{return[];}})[_0xcee9('0xa')](function(_0x29f6b2){return _0x29f6b2;});}function joinOrLeaveQueues(_0x492fd6,_0x23c186,_0x16dfd1,_0x3ff421){_0x492fd6[_0x23c186](util[_0xcee9('0x1c')]('%s:queue:%s',_0x16dfd1,_0x3ff421[_0xcee9('0x5')]));if(_0x3ff421[_0xcee9('0x1d')]){for(var _0x4e5a1a=0x0;_0x4e5a1a<_0x3ff421['Agents'][_0xcee9('0x1e')];_0x4e5a1a+=0x1){_0x492fd6[_0x23c186](util[_0xcee9('0x1c')](_0xcee9('0x1f'),_0x3ff421['Agents'][_0x4e5a1a][_0xcee9('0x5')]));}}}function joinOrLeave(_0x3fd3a4,_0x39956f,_0x57b548){var _0x2c219;if(_0x3fd3a4['handshake'][_0xcee9('0x20')]['id']){db[_0xcee9('0x4')][_0xcee9('0x21')]({'attributes':['id',_0xcee9('0x5'),_0xcee9('0x18'),_0xcee9('0x22')],'where':{'id':_0x3fd3a4[_0xcee9('0x23')][_0xcee9('0x20')]['id']},'include':[{'model':db[_0xcee9('0x24')],'as':_0xcee9('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcee9('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcee9('0x27')],'as':_0xcee9('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xcee9('0x29')],'as':_0xcee9('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xcee9('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xcee9('0xa')](function(_0x3e88cd){if(_0x3e88cd){_0x2c219=_0x3e88cd;_0x3fd3a4[_0x39956f](util['format'](_0xcee9('0x1f'),_0x3e88cd[_0xcee9('0x5')]));var _0xbc83b4=[];switch(_0x3e88cd['role']){case _0xcee9('0x2c'):_0x3fd3a4[_0x39956f](_0xcee9('0x2d'));_0x3fd3a4[_0x39956f](_0xcee9('0x2e'));if(queryQueues[_0xcee9('0x2f')]('include')){delete queryQueues[_0xcee9('0x30')];}_0xbc83b4[_0xcee9('0x31')](db['VoiceQueue'][_0xcee9('0x12')](queryQueues));_0xbc83b4[_0xcee9('0x31')](db[_0xcee9('0x32')][_0xcee9('0x12')](queryQueues));_0xbc83b4['push'](db['FaxQueue'][_0xcee9('0x12')](queryQueues));_0xbc83b4[_0xcee9('0x31')](db[_0xcee9('0x33')][_0xcee9('0x12')](queryQueues));_0xbc83b4[_0xcee9('0x31')](db[_0xcee9('0x34')][_0xcee9('0x12')](queryQueues));_0xbc83b4['push'](db[_0xcee9('0x35')][_0xcee9('0x12')](queryQueues));_0xbc83b4[_0xcee9('0x31')](db['WhatsappQueue'][_0xcee9('0x12')](queryQueues));_0xbc83b4[_0xcee9('0x31')](db[_0xcee9('0x4')][_0xcee9('0x12')](queryTelephones));_0xbc83b4[_0xcee9('0x31')](db['Trunk']['findAll'](queryTrunks));_0xbc83b4[_0xcee9('0x31')](db[_0xcee9('0x1a')][_0xcee9('0x12')](queryCampaigns));_0xbc83b4['push'](db[_0xcee9('0x4')][_0xcee9('0x12')](queryAgents));break;case _0xcee9('0x36'):_0x3fd3a4[_0x39956f](_0xcee9('0x2d'));_0x3fd3a4[_0x39956f](_0xcee9('0x2e'));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources('VoiceQueues',_0x3e88cd[_0xcee9('0x22')],_0xcee9('0x37')));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0xc'),_0x3e88cd['userProfileId'],'ChatQueue'));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0xd'),_0x3e88cd['userProfileId'],'FaxQueue'));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0x38'),_0x3e88cd['userProfileId'],_0xcee9('0x33')));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0xe'),_0x3e88cd['userProfileId'],'MailQueue'));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0xf'),_0x3e88cd[_0xcee9('0x22')],_0xcee9('0x35')));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0x10'),_0x3e88cd[_0xcee9('0x22')],_0xcee9('0x39')));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0x11'),_0x3e88cd[_0xcee9('0x22')],'User'));_0xbc83b4['push'](getAssociatedResources(_0xcee9('0x13'),_0x3e88cd[_0xcee9('0x22')],'Trunk'));_0xbc83b4[_0xcee9('0x31')](getAssociatedResources(_0xcee9('0x14'),_0x3e88cd[_0xcee9('0x22')],'Campaign'));_0xbc83b4[_0xcee9('0x31')](db['User'][_0xcee9('0x12')](queryAgents));break;case _0xcee9('0x6'):_0x3fd3a4[_0x39956f](_0xcee9('0x2d'));_0x3fd3a4[_0x39956f]('voice:outbound');_0xbc83b4[_0xcee9('0x31')](_0x3e88cd[_0xcee9('0x3a')]({'attributes':['id',_0xcee9('0x5')]}));_0xbc83b4['push'](_0x3e88cd[_0xcee9('0x3b')]({'attributes':['id','name']}));_0xbc83b4[_0xcee9('0x31')](_0x3e88cd[_0xcee9('0x3c')]({'attributes':['id',_0xcee9('0x5')]}));_0xbc83b4[_0xcee9('0x31')](_0x3e88cd[_0xcee9('0x3d')]({'attributes':['id',_0xcee9('0x5')]}));_0xbc83b4[_0xcee9('0x31')](_0x3e88cd[_0xcee9('0x3e')]({'attributes':['id',_0xcee9('0x5')]}));_0xbc83b4[_0xcee9('0x31')](_0x3e88cd[_0xcee9('0x3f')]({'attributes':['id',_0xcee9('0x5')]}));_0xbc83b4['push'](_0x3e88cd['getWhatsappQueues']({'attributes':['id',_0xcee9('0x5')]}));break;}return BPromise[_0xcee9('0x40')](_0xbc83b4);}})[_0xcee9('0xa')](function(_0x4b4f13){if(_0x4b4f13&&_0x4b4f13['length']){for(var _0x515c6d=0x0;_0x515c6d<_0x4b4f13[_0xcee9('0x1e')];_0x515c6d+=0x1){for(var _0x1e3ff0=0x0;_0x1e3ff0<_0x4b4f13[_0x515c6d][_0xcee9('0x1e')];_0x1e3ff0+=0x1){switch(_0x515c6d){case 0x0:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,_0xcee9('0x41'),_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x1:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,'chat',_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x2:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,_0xcee9('0x42'),_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x3:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,'sms',_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x4:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,_0xcee9('0x43'),_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x5:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,_0xcee9('0x44'),_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x6:joinOrLeaveQueues(_0x3fd3a4,_0x39956f,_0xcee9('0x45'),_0x4b4f13[_0x515c6d][_0x1e3ff0]);break;case 0x7:if(_0x2c219[_0xcee9('0x18')]!=='agent')_0x3fd3a4[_0x39956f](util['format']('telephone:%s',_0x4b4f13[_0x515c6d][_0x1e3ff0]['name']));break;case 0x8:if(_0x2c219['role']!=='agent')_0x3fd3a4[_0x39956f](util[_0xcee9('0x1c')](_0xcee9('0x46'),_0x4b4f13[_0x515c6d][_0x1e3ff0]['name']));break;case 0x9:if(_0x2c219[_0xcee9('0x18')]!==_0xcee9('0x6'))_0x3fd3a4[_0x39956f](util[_0xcee9('0x1c')]('campaign:%s:%s',_0x4b4f13[_0x515c6d][_0x1e3ff0][_0xcee9('0x1b')],_0x4b4f13[_0x515c6d][_0x1e3ff0]['name']));break;case 0xa:_0x3fd3a4[_0x39956f](util[_0xcee9('0x1c')](_0xcee9('0x1f'),_0x4b4f13[_0x515c6d][_0x1e3ff0][_0xcee9('0x5')]));break;}}}}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x49128a=_[_0xcee9('0x16')](_0x2c219[_0xcee9('0x25')],'id');return _0x2c219[_0xcee9('0x48')](_0x49128a)['then'](function(){for(var _0x4c22a2=0x0;_0x4c22a2<_0x49128a[_0xcee9('0x1e')];_0x4c22a2+=0x1){_0x57b548[_0xcee9('0x49')](_0xcee9('0x4a'),{'ChatInteractionId':Number(_0x49128a[_0x4c22a2]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x35e347=_[_0xcee9('0x16')](_0x2c219['MailInteractions'],'id');return _0x2c219[_0xcee9('0x4b')](_0x35e347)[_0xcee9('0xa')](function(){for(var _0x2c7ee8=0x0;_0x2c7ee8<_0x35e347[_0xcee9('0x1e')];_0x2c7ee8+=0x1){_0x57b548['emit'](_0xcee9('0x4c'),{'MailInteractionId':Number(_0x35e347[_0x2c7ee8]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x5e8a03=_[_0xcee9('0x16')](_0x2c219['FaxInteractions'],'id');return _0x2c219['removeFaxInteractions'](_0x5e8a03)[_0xcee9('0xa')](function(){for(var _0x190486=0x0;_0x190486<_0x5e8a03[_0xcee9('0x1e')];_0x190486+=0x1){_0x57b548[_0xcee9('0x49')](_0xcee9('0x4d'),{'FaxInteractionId':Number(_0x5e8a03[_0x190486]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x14ad30=_[_0xcee9('0x16')](_0x2c219[_0xcee9('0x28')],'id');return _0x2c219[_0xcee9('0x4e')](_0x14ad30)['then'](function(){for(var _0xfb9790=0x0;_0xfb9790<_0x14ad30[_0xcee9('0x1e')];_0xfb9790+=0x1){_0x57b548[_0xcee9('0x49')](_0xcee9('0x4f'),{'SmsInteractionId':Number(_0x14ad30[_0xfb9790]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x367de9=_[_0xcee9('0x16')](_0x2c219['OpenchannelInteractions'],'id');return _0x2c219[_0xcee9('0x50')](_0x367de9)[_0xcee9('0xa')](function(){for(var _0x22069d=0x0;_0x22069d<_0x367de9[_0xcee9('0x1e')];_0x22069d+=0x1){_0x57b548['emit'](_0xcee9('0x51'),{'OpenchannelInteractionId':Number(_0x367de9[_0x22069d]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0xa')](function(){if(_0x39956f===_0xcee9('0x47')){var _0x31cf21=_[_0xcee9('0x16')](_0x2c219['WhatsappInteractions'],'id');return _0x2c219[_0xcee9('0x52')](_0x31cf21)[_0xcee9('0xa')](function(){for(var _0x4c613b=0x0;_0x4c613b<_0x31cf21['length'];_0x4c613b+=0x1){_0x57b548[_0xcee9('0x49')](_0xcee9('0x53'),{'WhatsappInteractionId':Number(_0x31cf21[_0x4c613b]),'UserId':Number(_0x2c219['id'])});}});}})[_0xcee9('0x54')](function(_0x33e3d6){_0x3fd3a4[_0xcee9('0x55')](_0x33e3d6);});}}function onDisconnect(_0x36211d,_0xc9b2e1){joinOrLeave(_0x36211d,_0xcee9('0x47'),_0xc9b2e1);}function onConnect(_0x19086e){joinOrLeave(_0x19086e,_0xcee9('0x56'));}exports['default']=function(_0x566af1){_0x566af1['on'](_0xcee9('0x57'),function(_0x28839c){_0x28839c[_0xcee9('0x58')](0x0);_0x28839c['address']=_0x28839c[_0xcee9('0x59')][_0xcee9('0x57')][_0xcee9('0x5a')]+':'+_0x28839c[_0xcee9('0x59')][_0xcee9('0x57')][_0xcee9('0x5b')];_0x28839c['connectedAt']=new Date();_0x28839c[_0xcee9('0x55')]=function(_0x2cd8e9){console[_0xcee9('0x55')](_0xcee9('0x5c')+_0x28839c[_0xcee9('0x5d')]['name']+'['+_0x28839c[_0xcee9('0x5e')]+']',_0x2cd8e9);};_0x28839c['on'](_0xcee9('0x5f'),function(){onDisconnect(_0x28839c,_0x566af1);_0x28839c[_0xcee9('0x55')](_0xcee9('0x60'));});onConnect(_0x28839c);_0x28839c[_0xcee9('0x55')](_0xcee9('0x61'));});}; \ No newline at end of file +var _0x6343=['UserProfileResource','then','map','resourceId','User','where','type','format','Agents','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','ChatQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','catch','join','default','connection','address','request','remotePort','connectedAt','log','SocketIO\x20','CONNECTED','bluebird','../mysqldb','name','role','telephone','agent','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns'];(function(_0x218fb1,_0x2aa008){var _0x57a5c3=function(_0x5babba){while(--_0x5babba){_0x218fb1['push'](_0x218fb1['shift']());}};_0x57a5c3(++_0x2aa008);}(_0x6343,0x168));var _0x3634=function(_0x66a03b,_0x264ec3){_0x66a03b=_0x66a03b-0x0;var _0x896fb8=_0x6343[_0x66a03b];return _0x896fb8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x3634('0x0'));var db=require(_0x3634('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x3634('0x2'),_0x3634('0x3')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3634('0x2')],'where':{'role':_0x3634('0x4')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3634('0x2')],'where':{'role':_0x3634('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x3634('0x6')}};function getAssociatedResources(_0x1bcdb2,_0xfac918,_0x3c813b){return db[_0x3634('0x7')][_0x3634('0x8')]({'where':{'name':_0x1bcdb2,'userProfileId':_0xfac918},'raw':!![]})['then'](function(_0x4b965a){if(_0x4b965a){if(_0x4b965a[_0x3634('0x9')]){switch(_0x1bcdb2){case _0x3634('0xa'):case'ChatQueues':case _0x3634('0xb'):case _0x3634('0xc'):case _0x3634('0xd'):case _0x3634('0xe'):case _0x3634('0xf'):return db[_0x3c813b][_0x3634('0x10')](queryQueues);case _0x3634('0x11'):return db[_0x3c813b][_0x3634('0x10')](queryTelephones);case _0x3634('0x12'):return db[_0x3c813b][_0x3634('0x10')](queryTrunks);case _0x3634('0x13'):return db[_0x3c813b][_0x3634('0x10')](queryCampaigns);}}else{return db[_0x3634('0x14')][_0x3634('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x4b965a['id']},'raw':!![]})[_0x3634('0x15')](function(_0x48787f){if(_0x48787f){var _0x69609d={'where':{'id':_[_0x3634('0x16')](_0x48787f,_0x3634('0x17'))},'raw':!![]};switch(_0x3c813b){case _0x3634('0x18'):_0x69609d[_0x3634('0x19')]['role']=_0x3634('0x4');break;case'Campaign':_0x69609d['where'][_0x3634('0x1a')]='ivr';break;}return db[_0x3c813b][_0x3634('0x10')](_0x69609d);}else{return[];}});}}else{return[];}})[_0x3634('0x15')](function(_0x1e4f1d){return _0x1e4f1d;});}function joinOrLeaveQueues(_0x5603d2,_0x3ab7a5,_0x4366bc,_0x577a6c){_0x5603d2[_0x3ab7a5](util[_0x3634('0x1b')]('%s:queue:%s',_0x4366bc,_0x577a6c[_0x3634('0x2')]));if(_0x577a6c[_0x3634('0x1c')]){for(var _0x5b77a7=0x0;_0x5b77a7<_0x577a6c[_0x3634('0x1c')][_0x3634('0x1d')];_0x5b77a7+=0x1){_0x5603d2[_0x3ab7a5](util[_0x3634('0x1b')]('user:%s',_0x577a6c[_0x3634('0x1c')][_0x5b77a7][_0x3634('0x2')]));}}}function joinOrLeave(_0x52652d,_0x3936ee,_0x596acb){var _0x5e9188;if(_0x52652d[_0x3634('0x1e')][_0x3634('0x1f')]['id']){db['User'][_0x3634('0x20')]({'attributes':['id',_0x3634('0x2'),_0x3634('0x3'),_0x3634('0x21')],'where':{'id':_0x52652d[_0x3634('0x1e')][_0x3634('0x1f')]['id']},'include':[{'model':db[_0x3634('0x22')],'as':_0x3634('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x27')],'as':_0x3634('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x55a77f){if(_0x55a77f){_0x5e9188=_0x55a77f;_0x52652d[_0x3936ee](util[_0x3634('0x1b')]('user:%s',_0x55a77f[_0x3634('0x2')]));var _0x5d273c=[];switch(_0x55a77f[_0x3634('0x3')]){case _0x3634('0x29'):_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));if(queryQueues[_0x3634('0x2c')](_0x3634('0x2d'))){delete queryQueues[_0x3634('0x2d')];}_0x5d273c[_0x3634('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x5d273c['push'](db[_0x3634('0x2f')]['findAll'](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x30')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x31')][_0x3634('0x10')](queryQueues));_0x5d273c['push'](db[_0x3634('0x32')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x33')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x34')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db['User'][_0x3634('0x10')](queryTelephones));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x35')][_0x3634('0x10')](queryTrunks));_0x5d273c['push'](db[_0x3634('0x36')][_0x3634('0x10')](queryCampaigns));_0x5d273c[_0x3634('0x2e')](db['User']['findAll'](queryAgents));break;case'user':_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));_0x5d273c['push'](getAssociatedResources(_0x3634('0xa'),_0x55a77f[_0x3634('0x21')],_0x3634('0x37')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0x38'),_0x55a77f[_0x3634('0x21')],_0x3634('0x2f')));_0x5d273c['push'](getAssociatedResources(_0x3634('0xb'),_0x55a77f['userProfileId'],_0x3634('0x30')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xc'),_0x55a77f[_0x3634('0x21')],_0x3634('0x31')));_0x5d273c['push'](getAssociatedResources(_0x3634('0xd'),_0x55a77f[_0x3634('0x21')],_0x3634('0x32')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xe'),_0x55a77f[_0x3634('0x21')],_0x3634('0x33')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xf'),_0x55a77f['userProfileId'],'WhatsappQueue'));_0x5d273c[_0x3634('0x2e')](getAssociatedResources('Telephones',_0x55a77f['userProfileId'],'User'));_0x5d273c[_0x3634('0x2e')](getAssociatedResources('Trunks',_0x55a77f[_0x3634('0x21')],_0x3634('0x35')));_0x5d273c['push'](getAssociatedResources('IvrCampaigns',_0x55a77f['userProfileId'],_0x3634('0x36')));_0x5d273c[_0x3634('0x2e')](db['User'][_0x3634('0x10')](queryAgents));break;case _0x3634('0x5'):_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));_0x5d273c[_0x3634('0x2e')](_0x55a77f['getVoiceQueues']({'attributes':['id','name']}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x39')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3a')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c['push'](_0x55a77f[_0x3634('0x3b')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f['getMailQueues']({'attributes':['id','name']}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3c')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3d')]({'attributes':['id',_0x3634('0x2')]}));break;}return BPromise[_0x3634('0x3e')](_0x5d273c);}})[_0x3634('0x15')](function(_0x52de40){if(_0x52de40&&_0x52de40[_0x3634('0x1d')]){for(var _0x3401b8=0x0;_0x3401b8<_0x52de40[_0x3634('0x1d')];_0x3401b8+=0x1){for(var _0x23f359=0x0;_0x23f359<_0x52de40[_0x3401b8][_0x3634('0x1d')];_0x23f359+=0x1){switch(_0x3401b8){case 0x0:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x3f'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x1:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x40'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x2:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x41'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x3:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x42'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x4:joinOrLeaveQueues(_0x52652d,_0x3936ee,'mail',_0x52de40[_0x3401b8][_0x23f359]);break;case 0x5:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x43'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x6:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x44'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x7:if(_0x5e9188['role']!==_0x3634('0x5'))_0x52652d[_0x3936ee](util[_0x3634('0x1b')](_0x3634('0x45'),_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0x8:if(_0x5e9188[_0x3634('0x3')]!==_0x3634('0x5'))_0x52652d[_0x3936ee](util['format'](_0x3634('0x46'),_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0x9:if(_0x5e9188[_0x3634('0x3')]!==_0x3634('0x5'))_0x52652d[_0x3936ee](util[_0x3634('0x1b')]('campaign:%s:%s',_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x1a')],_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0xa:_0x52652d[_0x3936ee](util['format']('user:%s',_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;}}}}})['then'](function(){if(_0x3936ee===_0x3634('0x47')){var _0x475b37=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x23')],'id');return _0x5e9188['removeChatInteractions'](_0x475b37)[_0x3634('0x15')](function(){for(var _0x26d8d0=0x0;_0x26d8d0<_0x475b37[_0x3634('0x1d')];_0x26d8d0+=0x1){_0x596acb[_0x3634('0x48')](_0x3634('0x49'),{'ChatInteractionId':Number(_0x475b37[_0x26d8d0]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0xc83a28=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x4a')],'id');return _0x5e9188[_0x3634('0x4b')](_0xc83a28)[_0x3634('0x15')](function(){for(var _0x557438=0x0;_0x557438<_0xc83a28[_0x3634('0x1d')];_0x557438+=0x1){_0x596acb[_0x3634('0x48')](_0x3634('0x4c'),{'MailInteractionId':Number(_0xc83a28[_0x557438]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x15f414=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x4d')],'id');return _0x5e9188[_0x3634('0x4e')](_0x15f414)['then'](function(){for(var _0x2bcb9e=0x0;_0x2bcb9e<_0x15f414[_0x3634('0x1d')];_0x2bcb9e+=0x1){_0x596acb['emit'](_0x3634('0x4f'),{'FaxInteractionId':Number(_0x15f414[_0x2bcb9e]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee==='leave'){var _0x1089c2=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x50')],'id');return _0x5e9188['removeSmsInteractions'](_0x1089c2)[_0x3634('0x15')](function(){for(var _0x53da29=0x0;_0x53da29<_0x1089c2[_0x3634('0x1d')];_0x53da29+=0x1){_0x596acb['emit'](_0x3634('0x51'),{'SmsInteractionId':Number(_0x1089c2[_0x53da29]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x5e3788=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x52')],'id');return _0x5e9188['removeOpenchannelInteractions'](_0x5e3788)[_0x3634('0x15')](function(){for(var _0xbc0017=0x0;_0xbc0017<_0x5e3788[_0x3634('0x1d')];_0xbc0017+=0x1){_0x596acb[_0x3634('0x48')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5e3788[_0xbc0017]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x55fb3d=_['map'](_0x5e9188['WhatsappInteractions'],'id');return _0x5e9188[_0x3634('0x53')](_0x55fb3d)['then'](function(){for(var _0x1a3205=0x0;_0x1a3205<_0x55fb3d[_0x3634('0x1d')];_0x1a3205+=0x1){_0x596acb[_0x3634('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x55fb3d[_0x1a3205]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x54')](function(_0x3f3dc1){_0x52652d['log'](_0x3f3dc1);});}}function onDisconnect(_0x2f1b5d,_0x1c37f4){joinOrLeave(_0x2f1b5d,_0x3634('0x47'),_0x1c37f4);}function onConnect(_0x5a9808){joinOrLeave(_0x5a9808,_0x3634('0x55'));}exports[_0x3634('0x56')]=function(_0x897c0e){_0x897c0e['on'](_0x3634('0x57'),function(_0x218902){_0x218902['setMaxListeners'](0x0);_0x218902[_0x3634('0x58')]=_0x218902[_0x3634('0x59')][_0x3634('0x57')]['remoteAddress']+':'+_0x218902[_0x3634('0x59')]['connection'][_0x3634('0x5a')];_0x218902[_0x3634('0x5b')]=new Date();_0x218902['log']=function(_0x128461){console[_0x3634('0x5c')](_0x3634('0x5d')+_0x218902['nsp'][_0x3634('0x2')]+'['+_0x218902['address']+']',_0x128461);};_0x218902['on']('disconnect',function(){onDisconnect(_0x218902,_0x897c0e);_0x218902[_0x3634('0x5c')]('DISCONNECTED');});onConnect(_0x218902);_0x218902[_0x3634('0x5c')](_0x3634('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6ff7a88..cc1fb68 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 _0x5c18=['event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','interface','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','opened','contact','format','SIP/%s','AfterCreate','closed','substatus','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','afterUpdate','closedinteraction','ChatMessage','afterCreate','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','newmessage','MailInteraction','Mail','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','motionChannel'];(function(_0x1ff59e,_0x57271d){var _0x20f749=function(_0x53e867){while(--_0x53e867){_0x1ff59e['push'](_0x1ff59e['shift']());}};_0x20f749(++_0x57271d);}(_0x5c18,0x10d));var _0x85c1=function(_0x3431ac,_0x5820b6){_0x3431ac=_0x3431ac-0x0;var _0x3e650f=_0x5c18[_0x3431ac];return _0x3e650f;};'use strict';var util=require(_0x85c1('0x0'));var db=require(_0x85c1('0x1'))['db'];var jayson=require(_0x85c1('0x2'));var logger=require(_0x85c1('0x3'))(_0x85c1('0x4'));var client=jayson[_0x85c1('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x85c1('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x85c1('0x6'),'model':'ChatInteraction','event':_0x85c1('0x7'),'condition':_0x85c1('0x8'),'callback':afterUpdate},{'channel':_0x85c1('0x6'),'model':_0x85c1('0x9'),'event':_0x85c1('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x85c1('0x6'),'model':_0x85c1('0xb'),'event':_0x85c1('0xa'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x85c1('0xc'),'model':_0x85c1('0xd'),'event':_0x85c1('0xa'),'condition':_0x85c1('0xe'),'callback':afterCreate},{'channel':_0x85c1('0xc'),'model':'SmsInteraction','event':_0x85c1('0x7'),'condition':_0x85c1('0x8'),'callback':afterUpdate},{'channel':_0x85c1('0xc'),'model':_0x85c1('0xf'),'event':_0x85c1('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x85c1('0x10'),'model':'WhatsappInteraction','event':_0x85c1('0xa'),'condition':_0x85c1('0xe'),'callback':afterCreate},{'channel':_0x85c1('0x10'),'model':_0x85c1('0x11'),'event':_0x85c1('0x7'),'condition':_0x85c1('0x8'),'callback':afterUpdate},{'channel':_0x85c1('0x10'),'model':_0x85c1('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x85c1('0x13'),'event':'afterCreate','condition':_0x85c1('0xe'),'callback':afterCreate},{'channel':_0x85c1('0x14'),'model':'FaxInteraction','event':_0x85c1('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x85c1('0x15'),'event':'afterCreate','condition':_0x85c1('0x16'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x85c1('0x17'),'event':'afterCreate','condition':_0x85c1('0xe'),'callback':afterCreate},{'channel':_0x85c1('0x18'),'model':'MailInteraction','event':_0x85c1('0x7'),'condition':_0x85c1('0x8'),'callback':afterUpdate},{'channel':_0x85c1('0x18'),'model':_0x85c1('0x19'),'event':_0x85c1('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x85c1('0x1a'),'event':_0x85c1('0xa'),'condition':_0x85c1('0xe'),'callback':afterCreate},{'channel':_0x85c1('0x1b'),'model':'OpenchannelInteraction','event':_0x85c1('0x7'),'condition':_0x85c1('0x8'),'callback':afterUpdate},{'channel':_0x85c1('0x1b'),'model':_0x85c1('0x1c'),'event':_0x85c1('0xa'),'condition':_0x85c1('0x16'),'callback':afterCreateMessage}];function request(_0x27114a){return client[_0x85c1('0x1d')](_0x85c1('0x1e'),_0x27114a)[_0x85c1('0x1f')](function(_0x39c7fd){logger[_0x85c1('0x20')](_0x85c1('0x21'),_0x85c1('0x1e'),_0x39c7fd);if(_0x39c7fd[_0x85c1('0x22')]){if(_0x39c7fd[_0x85c1('0x22')][_0x85c1('0x23')]===0x1f4){logger[_0x85c1('0x22')](_0x85c1('0x21'),_0x85c1('0x1e'),_0x39c7fd[_0x85c1('0x22')]);}}})[_0x85c1('0x24')](function(_0x129011){logger[_0x85c1('0x22')](_0x85c1('0x21'),_0x85c1('0x1e'),_0x129011);});}function afterCreateMessage(_0x287435){return function(_0x1487c4){_0x1487c4=_0x1487c4['get']({'plain':!![]});_0x1487c4[_0x85c1('0x25')]=_0x287435;_0x1487c4[_0x85c1('0x26')]=_0x287435;_0x1487c4[_0x85c1('0x27')]=_0x1487c4[_0x85c1('0x28')];Promise[_0x85c1('0x29')]()[_0x85c1('0x1f')](function(){if(typeof _0x1487c4['ContactId']===_0x85c1('0x2a'))return null;var _0x2acf6c=_0x85c1('0x2b')+_0x1487c4[_0x85c1('0x2c')];return db[_0x85c1('0x2d')][_0x85c1('0x2e')](_0x2acf6c,{'type':db[_0x85c1('0x2f')][_0x85c1('0x30')][_0x85c1('0x31')],'raw':!![]});})[_0x85c1('0x1f')](function(_0x3b58e1){if(_0x3b58e1){_0x1487c4['contact']=_0x3b58e1[0x0];}if(typeof _0x1487c4[_0x85c1('0x32')]===_0x85c1('0x2a'))return;return getAgent(_0x1487c4['UserId']);})[_0x85c1('0x1f')](function(_0x2187bf){if(_0x2187bf){_0x1487c4[_0x85c1('0x33')]=util['format']('SIP/%s',_0x2187bf[_0x85c1('0x34')]);_0x1487c4[_0x85c1('0x35')]=_0x2187bf;_0x1487c4[_0x85c1('0x25')]=_0x287435;return request({'event':_0x85c1('0x36'),'message':_0x1487c4});}else{return request({'event':_0x85c1('0x37'),'message':_0x1487c4});}})[_0x85c1('0x24')](function(_0x57aa0b){logger['error']('Trigger,\x20%s',_0x85c1('0x38'),_0x57aa0b);});};}function afterCreateOfflineMessage(_0xc367b3){return function(_0x308c5f){_0x308c5f=_0x308c5f[_0x85c1('0x39')]({'plain':!![]});_0x308c5f[_0x85c1('0x25')]=_0xc367b3;_0x308c5f['motionChannel']=_0xc367b3;_0x308c5f['event']='offlineMessage';return request({'event':_0x308c5f['event'],'message':_0x308c5f});};}function afterCreate(_0x5d4f50,_0x166833){return function(_0x49b148){_0x49b148=_0x49b148[_0x85c1('0x39')]({'plain':!![]});_0x49b148[_0x85c1('0x25')]=_0x5d4f50;_0x49b148[_0x85c1('0x26')]=_0x5d4f50;_0x49b148[_0x85c1('0x27')]=_0x85c1('0x3a');Promise[_0x85c1('0x29')]()[_0x85c1('0x1f')](function(){var _0x4edbdf=_0x85c1('0x2b')+_0x49b148[_0x85c1('0x2c')];return db[_0x85c1('0x2d')][_0x85c1('0x2e')](_0x4edbdf,{'type':db[_0x85c1('0x2f')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x85c1('0x1f')](function(_0x5dfc33){if(_0x5dfc33){_0x49b148[_0x85c1('0x3b')]=_0x5dfc33[0x0];}if(typeof _0x49b148['UserId']==='undefined')return;return getAgent(_0x49b148['UserId']);})['then'](function(_0x2a056a){if(_0x2a056a){_0x49b148['interface']=util[_0x85c1('0x3c')](_0x85c1('0x3d'),_0x2a056a[_0x85c1('0x34')]);_0x49b148['agent']=_0x2a056a;}return request({'event':_0x166833,'message':_0x49b148});})[_0x85c1('0x24')](function(_0x5eab8b){logger[_0x85c1('0x22')](_0x85c1('0x21'),_0x85c1('0x3e'),_0x5eab8b);});};}function afterUpdate(_0x2db740){return function(_0x585298){var _0x40d531=_0x585298['changed'](_0x85c1('0x3f'))&&_0x585298[_0x85c1('0x3f')];var _0x1305ef=_0x585298['changed'](_0x85c1('0x40'));if(_0x40d531||_0x1305ef){var _0x37329f=_0x40d531?'closedinteraction':'substatus';var _0x3a52f3=_0x585298[_0x85c1('0x39')]({'plain':!![]});_0x3a52f3[_0x85c1('0x25')]=_0x2db740;_0x3a52f3['motionChannel']=_0x2db740;_0x3a52f3[_0x85c1('0x27')]=_0x40d531?_0x85c1('0x3f'):'substatus';var _0x49d69c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a52f3[_0x85c1('0x2c')];return db[_0x85c1('0x2d')]['query'](_0x49d69c,{'type':db[_0x85c1('0x2f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x85c1('0x1f')](function(_0x3ab5db){if(_0x3ab5db){_0x3a52f3[_0x85c1('0x3b')]=_0x3ab5db[0x0];}if(typeof _0x3a52f3[_0x85c1('0x32')]===_0x85c1('0x2a'))return;return getAgent(_0x3a52f3['UserId']);})[_0x85c1('0x1f')](function(_0x352bad){if(_0x352bad){_0x3a52f3[_0x85c1('0x33')]=util[_0x85c1('0x3c')](_0x85c1('0x3d'),_0x352bad[_0x85c1('0x34')]);_0x3a52f3['agent']=_0x352bad;}return request({'event':_0x37329f,'message':_0x3a52f3});})[_0x85c1('0x24')](function(_0x37e012){logger[_0x85c1('0x22')]('Trigger,\x20%s','AfterUpdate',_0x37e012);});}};}function getAgent(_0x39c9fb){return db[_0x85c1('0x41')][_0x85c1('0x42')]({'where':{'id':_0x39c9fb},'attributes':['id',_0x85c1('0x34'),_0x85c1('0x43'),_0x85c1('0x44'),_0x85c1('0x45')],'raw':!![]})[_0x85c1('0x1f')](function(_0x44c96f){return _0x44c96f;});}exports[_0x85c1('0x46')]=function(){for(var _0x261be4=0x0;_0x261be4=_0x587eff[_0x8637('0x14')]){throw Error(_0x8637('0x15'));}_0x28dfd0(_0x4a15a1);})[_0x8637('0x16')](function(_0xcadf3){_0x488d76(_0xcadf3);});});}; \ No newline at end of file +var _0xd968=['catch','lodash','bluebird','../mysqldb','./license/util','mail','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','getLicense','role','User','count','agent','then','agents'];(function(_0x54c1f6,_0x33236e){var _0x4b6b4e=function(_0xf82381){while(--_0xf82381){_0x54c1f6['push'](_0x54c1f6['shift']());}};_0x4b6b4e(++_0x33236e);}(_0xd968,0x17b));var _0x8d96=function(_0x39f27e,_0x40c6f3){_0x39f27e=_0x39f27e-0x0;var _0x5c7c9=_0xd968[_0x39f27e];return _0x5c7c9;};'use strict';var _=require(_0x8d96('0x0'));var BPromise=require(_0x8d96('0x1'));var db=require(_0x8d96('0x2'))['db'];var util=require(_0x8d96('0x3'));var channels=['voice',_0x8d96('0x4'),'chat','fax','sms',_0x8d96('0x5'),_0x8d96('0x6')];exports[_0x8d96('0x7')]=function(){return channels;};exports[_0x8d96('0x8')]=function(_0x3c86eb){_0x3c86eb=_0x3c86eb['toLowerCase']();return _[_0x8d96('0x9')](channels,_0x3c86eb);};exports[_0x8d96('0xa')]=function(_0x36c5df,_0x42373d,_0x22226e,_0x51823c){var _0x201f7e={'loginAttempts':_0x42373d,'blocked':_0x22226e};if(!_[_0x8d96('0xb')](_0x51823c)){_0x201f7e[_0x8d96('0xc')]=_0x51823c;}return _0x36c5df['updateAttributes'](_0x201f7e);};exports[_0x8d96('0xd')]=function(_0x3e4467){return new BPromise(function(_0x2675cd,_0xf81f29){var _0xafd5a0=0x0;if(_0x3e4467[_0x8d96('0xe')]!=='agent'){_0x2675cd(_0x3e4467);}db[_0x8d96('0xf')][_0x8d96('0x10')]({'where':{'role':_0x8d96('0x11'),'online':!![],'id':{'$ne':_0x3e4467['id']}}})[_0x8d96('0x12')](function(_0x49757b){_0xafd5a0=_0x49757b;return util['getLicense']();})[_0x8d96('0x12')](function(_0x554a6f){if(_0x554a6f&&_0x554a6f['agents']&&_0xafd5a0>=_0x554a6f[_0x8d96('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2675cd(_0x3e4467);})[_0x8d96('0x14')](function(_0x2a4f0e){_0xf81f29(_0x2a4f0e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e970104..1beb66a 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Entity\x20not\x20found'];(function(_0x2f36dc,_0x2099d4){var _0x4f785d=function(_0x2cfe60){while(--_0x2cfe60){_0x2f36dc['push'](_0x2f36dc['shift']());}};_0x4f785d(++_0x2099d4);}(_0xaa88,0x137));var _0x8aa8=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xaa88[_0xaaf2e2];return _0x28bc36;};'use strict';var util=require(_0x8aa8('0x0'));var logger=require(_0x8aa8('0x1'))(_0x8aa8('0x2'));var APIError=function(_0x51c79b,_0x4aee38){this[_0x8aa8('0x3')]=_0x51c79b||_0x8aa8('0x4');this[_0x8aa8('0x5')]=_0x4aee38||_0x8aa8('0x6');util[_0x8aa8('0x7')](APIError,Error);};var APIBadRequestError=function(_0x350e8b){this['message']=_0x350e8b||'Bad\x20Request';this[_0x8aa8('0x5')]='Bad\x20Request';util[_0x8aa8('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ed84d){this[_0x8aa8('0x3')]=_0x1ed84d||_0x8aa8('0x8');this['name']=_0x8aa8('0x9');util[_0x8aa8('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x224f25){switch(_0x224f25){case'Bad\x20Request':return 0x190;case _0x8aa8('0xa'),_0x8aa8('0xb'):return 0x193;case _0x8aa8('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x33cc5c){return function(_0x583688){logger[_0x8aa8('0xc')](_0x583688[_0x8aa8('0xd')]);var _0x50787d=getStatusCode(_0x583688[_0x8aa8('0x5')]);if(_0x583688[_0x8aa8('0x5')])delete _0x583688[_0x8aa8('0x5')];return _0x33cc5c['status'](_0x50787d)[_0x8aa8('0xe')](_0x583688);};}module[_0x8aa8('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x153f=['inherits','Forbidden','OutOfInterval','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Entity\x20not\x20found','Not\x20Found'];(function(_0x347214,_0x418a02){var _0x1308bd=function(_0x16bd25){while(--_0x16bd25){_0x347214['push'](_0x347214['shift']());}};_0x1308bd(++_0x418a02);}(_0x153f,0x15b));var _0xf153=function(_0x4d5da5,_0x54515d){_0x4d5da5=_0x4d5da5-0x0;var _0x3181b7=_0x153f[_0x4d5da5];return _0x3181b7;};'use strict';var util=require(_0xf153('0x0'));var logger=require(_0xf153('0x1'))(_0xf153('0x2'));var APIError=function(_0x44cea3,_0x2afb9a){this[_0xf153('0x3')]=_0x44cea3||_0xf153('0x4');this['name']=_0x2afb9a||_0xf153('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1f9ead){this[_0xf153('0x3')]=_0x1f9ead||_0xf153('0x6');this[_0xf153('0x7')]=_0xf153('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x17ba96){this[_0xf153('0x3')]=_0x17ba96||_0xf153('0x8');this[_0xf153('0x7')]=_0xf153('0x9');util[_0xf153('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x44845c){switch(_0x44845c){case _0xf153('0x6'):return 0x190;case _0xf153('0xb'),_0xf153('0xc'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2b76eb){return function(_0x1c8de7){logger[_0xf153('0xd')](_0x1c8de7['stack']);var _0x3a8838=getStatusCode(_0x1c8de7[_0xf153('0x7')]);if(_0x1c8de7[_0xf153('0x7')])delete _0x1c8de7[_0xf153('0x7')];return _0x2b76eb[_0xf153('0xe')](_0x3a8838)[_0xf153('0xf')](_0x1c8de7);};}module[_0xf153('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b70e656..f933e31 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5acd=['send','exports','status','json'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x5acd,0x121));var _0xd5ac=function(_0x20c9df,_0x53a311){_0x20c9df=_0x20c9df-0x0;var _0x4d9056=_0x5acd[_0x20c9df];return _0x4d9056;};'use strict';module[_0xd5ac('0x0')][0x194]=function pageNotFound(_0x58f4f2,_0x197b62){var _0x335fea='404';var _0x3dbe59=0x194;var _0x216874={'status':_0x3dbe59};_0x197b62[_0xd5ac('0x1')](_0x216874[_0xd5ac('0x1')]);_0x197b62['render'](_0x335fea,{},function(_0x40544a,_0x4b9528){if(_0x40544a){return _0x197b62[_0xd5ac('0x1')](_0x216874[_0xd5ac('0x1')])[_0xd5ac('0x2')](_0x216874);}_0x197b62[_0xd5ac('0x3')](_0x4b9528);});}; \ No newline at end of file +var _0x7dff=['json','send','exports','404','status'];(function(_0x49dd01,_0x3c7496){var _0x9bfc6e=function(_0x2bd013){while(--_0x2bd013){_0x49dd01['push'](_0x49dd01['shift']());}};_0x9bfc6e(++_0x3c7496);}(_0x7dff,0x75));var _0xf7df=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7dff[_0x9df060];return _0x338dfe;};'use strict';module[_0xf7df('0x0')][0x194]=function pageNotFound(_0x564ea0,_0x107744){var _0x51db9b=_0xf7df('0x1');var _0x1280c4=0x194;var _0x4c7e00={'status':_0x1280c4};_0x107744[_0xf7df('0x2')](_0x4c7e00[_0xf7df('0x2')]);_0x107744['render'](_0x51db9b,{},function(_0x1848e2,_0x32e616){if(_0x1848e2){return _0x107744[_0xf7df('0x2')](_0x4c7e00[_0xf7df('0x2')])[_0xf7df('0x3')](_0x4c7e00);}_0x107744[_0xf7df('0x4')](_0x32e616);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e85609d..f4ee6ee 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa813=['CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../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','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','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','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','userSetting','UserId','hasMany','VoiceRecording','Extensions','CmHopperFinal','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserMailQueue','UserChatQueue','FaxQueues','OpenchannelQueues','ChatWebsite','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMail','Messages','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','Contact','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','FaxAccountId','Interactions','FaxApplication','Exntensions','FaxMessage','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CampaignId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','ItemType','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Descriptions','Field','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Configuration','Dynamics365Field','FreshsalesConfiguration','FromId','ChatInternalMessage','ToId','SessionId','ProjectId','MailQueues','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','campaigns_has_cm_lists','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','FromAccount','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','password','database','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userChatQueue/userChatQueue.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','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany'];(function(_0x1769ea,_0x4cdb04){var _0x37f7f8=function(_0x2d7330){while(--_0x2d7330){_0x1769ea['push'](_0x1769ea['shift']());}};_0x37f7f8(++_0x4cdb04);}(_0xa813,0x190));var _0x3a81=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xa813[_0x16d10f];return _0x50c823;};'use strict';var config=require(_0x3a81('0x0'));var Sequelize=require(_0x3a81('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0x3a81('0x1')]=_[_0x3a81('0x2')](config[_0x3a81('0x1')],{'database':_0x3a81('0x3'),'username':_0x3a81('0x4'),'password':_0x3a81('0x5'),'options':{'host':_0x3a81('0x6'),'port':0xcea,'dialect':_0x3a81('0x7'),'dialectOptions':{'charset':_0x3a81('0x8')},'logging':![],'timezone':timezone[_0x3a81('0x9')](),'define':{'charset':_0x3a81('0xa'),'collate':_0x3a81('0xb')}}});config[_0x3a81('0xc')]=_[_0x3a81('0x2')](config[_0x3a81('0xc')],{'database':'motion2','username':'xcall','password':_0x3a81('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3a81('0x7'),'dialectOptions':{'charset':_0x3a81('0x8')},'logging':![],'timezone':timezone[_0x3a81('0x9')](),'define':{'charset':_0x3a81('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3a81('0x1')]['database'],config[_0x3a81('0x1')]['username'],config[_0x3a81('0x1')][_0x3a81('0xd')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x3a81('0xe')],config[_0x3a81('0xc')]['username'],config[_0x3a81('0xc')][_0x3a81('0xd')],config[_0x3a81('0xc')]['options'])};db[_0x3a81('0xf')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x10'));db[_0x3a81('0x11')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x3a81('0x13')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x14'));db[_0x3a81('0x15')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x16'));db[_0x3a81('0x17')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x18'));db[_0x3a81('0x19')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x1a'));db['VoiceRecording']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x1b'));db[_0x3a81('0x1c')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x1d'));db['VoiceMail']=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/voiceMail/voiceMail.model');db[_0x3a81('0x1e')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x1f'));db[_0x3a81('0x20')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0x3a81('0x21')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/voiceDialReport/voiceDialReport.model');db[_0x3a81('0x22')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x23'));db[_0x3a81('0x24')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x25'));db[_0x3a81('0x26')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x27'));db[_0x3a81('0x28')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x29'));db[_0x3a81('0x2a')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x3a81('0x2b')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x2c'));db['UserVoiceQueue']=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x3a81('0x1')]['import'](_0x3a81('0x2d'));db['UserMailQueue']=db['sequelize']['import']('../api/userMailQueue/userMailQueue.model');db[_0x3a81('0x2e')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x2f'));db[_0x3a81('0x30')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x31'));db[_0x3a81('0x32')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x33'));db[_0x3a81('0x34')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x35'));db[_0x3a81('0x36')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x37'));db[_0x3a81('0x38')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x39'));db[_0x3a81('0x3a')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x3b'));db[_0x3a81('0x3c')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x3d'));db[_0x3a81('0x3e')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3a81('0x3f')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x3a81('0x40')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x41'));db[_0x3a81('0x42')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x43'));db[_0x3a81('0x44')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x45'));db[_0x3a81('0x46')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x47'));db[_0x3a81('0x48')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x49'));db[_0x3a81('0x4a')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x4b'));db['FaxApplication']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x4c'));db[_0x3a81('0x4d')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x4e'));db['FaxMessage']=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/faxMessage/faxMessage.model');db[_0x3a81('0x4f')]=db[_0x3a81('0x1')]['import']('../api/faxQueue/faxQueue.model');db[_0x3a81('0x50')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x51'));db[_0x3a81('0x52')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x3a81('0x1')]['import'](_0x3a81('0x53'));db[_0x3a81('0x54')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x55'));db[_0x3a81('0x56')]=db['sequelize'][_0x3a81('0x12')]('../api/smsMessage/smsMessage.model');db[_0x3a81('0x57')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x58'));db[_0x3a81('0x59')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x5a'));db[_0x3a81('0x5b')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x3a81('0x5c')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x5d'));db['OpenchannelMessage']=db[_0x3a81('0x1')]['import'](_0x3a81('0x5e'));db[_0x3a81('0x5f')]=db[_0x3a81('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x3a81('0x1')]['import'](_0x3a81('0x60'));db[_0x3a81('0x61')]=db[_0x3a81('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x3a81('0x62')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x63'));db[_0x3a81('0x64')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x65'));db[_0x3a81('0x66')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x67'));db[_0x3a81('0x68')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x69'));db[_0x3a81('0x6a')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x6b'));db[_0x3a81('0x6c')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x6d'));db[_0x3a81('0x6e')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/cmCompany/cmCompany.model');db[_0x3a81('0x6f')]=db['sequelize']['import'](_0x3a81('0x70'));db[_0x3a81('0x71')]=db[_0x3a81('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x3a81('0x72')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x73'));db['CmHopperFinal']=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x74'));db[_0x3a81('0x75')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x76'));db[_0x3a81('0x77')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x78'));db[_0x3a81('0x79')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x7a'));db[_0x3a81('0x7b')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x7c'));db[_0x3a81('0x7d')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x7e'));db[_0x3a81('0x7f')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x80'));db[_0x3a81('0x81')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x82'));db[_0x3a81('0x83')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/condition/condition.model');db[_0x3a81('0x84')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x85'));db[_0x3a81('0x86')]=db['sequelize'][_0x3a81('0x12')]('../api/pause/pause.model');db['Cdr']=db[_0x3a81('0x1')]['import'](_0x3a81('0x87'));db[_0x3a81('0x88')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x89'));db[_0x3a81('0x8a')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x8b'));db['Sound']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x8c'));db[_0x3a81('0x8d')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x8e'));db[_0x3a81('0x8f')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x90'));db[_0x3a81('0x91')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x92'));db[_0x3a81('0x93')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x94'));db[_0x3a81('0x95')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/template/template.model');db[_0x3a81('0x96')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0x97'));db['Variable']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x98'));db['Integration']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x99'));db[_0x3a81('0x9a')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x9b'));db[_0x3a81('0x9c')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x9d'));db[_0x3a81('0x9e')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x9f'));db[_0x3a81('0xa0')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xa1'));db[_0x3a81('0xa2')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xa3'));db[_0x3a81('0xa4')]=db['sequelize'][_0x3a81('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x3a81('0xa5')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xa6'));db[_0x3a81('0xa7')]=db['sequelize']['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x3a81('0xa8')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xa9'));db[_0x3a81('0xaa')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xab'));db['SugarcrmConfiguration']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xac'));db[_0x3a81('0xad')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xae'));db[_0x3a81('0xaf')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xb0'));db[_0x3a81('0xb1')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xb2'));db[_0x3a81('0xb3')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db['sequelize'][_0x3a81('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0x3a81('0xb4')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x3a81('0xb5')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xb6'));db[_0x3a81('0xb7')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xb8'));db[_0x3a81('0xb9')]=db[_0x3a81('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3a81('0xba')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xbb'));db[_0x3a81('0xbc')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xbd'));db['FreshdeskConfiguration']=db[_0x3a81('0x1')]['import'](_0x3a81('0xbe'));db[_0x3a81('0xbf')]=db['sequelize'][_0x3a81('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x3a81('0xc0')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xc1'));db['VtigerConfiguration']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xc2'));db[_0x3a81('0xc3')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x3a81('0xc4')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xc5'));db[_0x3a81('0xc6')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xc7'));db[_0x3a81('0xc8')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xc9'));db[_0x3a81('0xca')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xcb'));db['Dynamics365Configuration']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xcc'));db['Dynamics365Field']=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x3a81('0xcd')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xce'));db['FreshsalesConfiguration']=db['sequelize']['import'](_0x3a81('0xcf'));db[_0x3a81('0xd0')]=db['sequelize'][_0x3a81('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x3a81('0x1')]['import'](_0x3a81('0x99'));db[_0x3a81('0xd1')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xd2'));db[_0x3a81('0xd3')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xd4'));db['ChatInternalMessage']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xd5'));db[_0x3a81('0xd6')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xd7'));db[_0x3a81('0xd8')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xd9'));db[_0x3a81('0xda')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xdb'));db[_0x3a81('0xdc')]=db['sequelize']['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x3a81('0xdd')]=db[_0x3a81('0x1')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xde'));db[_0x3a81('0xdf')]=db['sequelize'][_0x3a81('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x3a81('0xe0')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xe1'));db['SquareOdbc']=db['sequelize'][_0x3a81('0x12')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xe2'));db[_0x3a81('0xe3')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xe4'));db[_0x3a81('0xe5')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xe6'));db[_0x3a81('0xe7')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xe8'));db[_0x3a81('0xe9')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xea'));db[_0x3a81('0xeb')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xec'));db[_0x3a81('0xed')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xee'));db['Attachment']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xef'));db[_0x3a81('0xf0')]=db[_0x3a81('0x1')]['import'](_0x3a81('0xf1'));db[_0x3a81('0xf2')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x3a81('0xf3')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x3a81('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x3a81('0xf4')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xf5'));db[_0x3a81('0xf6')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xf7'));db[_0x3a81('0xf8')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xf9'));db[_0x3a81('0xfa')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xfb'));db[_0x3a81('0xfc')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0xfd'));db[_0x3a81('0xfe')]=db['sequelize'][_0x3a81('0x12')](_0x3a81('0xff'));db[_0x3a81('0x100')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x101'));db[_0x3a81('0x102')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x103'));db[_0x3a81('0x104')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x105'));db['WhatsappApplication']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x106'));db[_0x3a81('0x107')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x108'));db['WhatsappMessage']=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x109'));db['WhatsappQueueReport']=db[_0x3a81('0x1')]['import'](_0x3a81('0x10a'));db[_0x3a81('0x10b')]=db['sequelize']['import'](_0x3a81('0x10c'));db[_0x3a81('0x10d')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x10e'));db[_0x3a81('0x10f')]=db['sequelize']['import'](_0x3a81('0x110'));db[_0x3a81('0x111')]=db[_0x3a81('0x1')][_0x3a81('0x12')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x3a81('0x112')]=db[_0x3a81('0x1')][_0x3a81('0x12')](_0x3a81('0x113'));db[_0x3a81('0x114')]=db[_0x3a81('0x1')]['import'](_0x3a81('0x115'));db['UserSetting']=db['sequelize']['import'](_0x3a81('0x116'));db[_0x3a81('0xf')][_0x3a81('0x117')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x3a81('0x118'),'foreignKey':'UserId'});db[_0x3a81('0xf')][_0x3a81('0x117')](db['UserSetting'],{'as':_0x3a81('0x119'),'onDelete':'cascade','foreignKey':_0x3a81('0x11a')});db['User'][_0x3a81('0x11b')](db[_0x3a81('0x11c')],{'as':'Recordings','foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x2b')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User']['hasMany'](db[_0x3a81('0x15')],{'as':_0x3a81('0x11d'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x11e')],{'as':_0x3a81('0x11f'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')]['hasMany'](db[_0x3a81('0x75')],{'as':_0x3a81('0x120'),'foreignKey':'UserId'});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x5c')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db['User'][_0x3a81('0x11b')](db[_0x3a81('0x64')],{'as':_0x3a81('0x121'),'foreignKey':'UserId'});db['User'][_0x3a81('0x11b')](db[_0x3a81('0x54')],{'as':_0x3a81('0x122'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x4d')],{'as':'FaxInteractions','foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')][_0x3a81('0x11b')](db['MailInteraction'],{'as':_0x3a81('0x123'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x107')],{'as':_0x3a81('0x124'),'foreignKey':'UserId'});db[_0x3a81('0xf')][_0x3a81('0x11b')](db[_0x3a81('0x102')],{'as':_0x3a81('0x125'),'foreignKey':_0x3a81('0x126')});db['User'][_0x3a81('0x127')](db[_0x3a81('0xfc')],{'as':_0x3a81('0xfc'),'foreignKey':_0x3a81('0x128')});db['User'][_0x3a81('0x129')](db['ChatGroup'],{'as':_0x3a81('0x12a'),'through':_0x3a81('0x12b')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x12c'),'through':_0x3a81('0x12d')});db[_0x3a81('0xf')][_0x3a81('0x129')](db['CmList'],{'as':'Lists','through':_0x3a81('0x12e')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':_0x3a81('0x12f')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x3f')],{'as':_0x3a81('0x123'),'through':_0x3a81('0x130')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x64')],{'as':_0x3a81('0x121'),'through':_0x3a81('0x131')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x4d')],{'as':_0x3a81('0x132'),'through':_0x3a81('0x133')});db[_0x3a81('0xf')][_0x3a81('0x129')](db['SmsInteraction'],{'as':_0x3a81('0x122'),'through':'user_has_sms_interactions'});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x5c')],{'as':_0x3a81('0x134'),'through':'user_has_openchannel_interactions'});db[_0x3a81('0xf')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x3a81('0x124'),'through':_0x3a81('0x135')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x19')],{'as':_0x3a81('0x136'),'through':_0x3a81('0x137'),'required':![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0xfa')],{'as':_0x3a81('0x138'),'through':_0x3a81('0x114'),'required':![]});db['User'][_0x3a81('0x129')](db[_0x3a81('0x3c')],{'as':'MailQueues','through':_0x3a81('0x139'),'required':![]});db['User']['belongsToMany'](db[_0x3a81('0x68')],{'as':'ChatQueues','through':_0x3a81('0x13a'),'required':![],'hooks':!![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x4f')],{'as':_0x3a81('0x13b'),'through':_0x3a81('0x2e'),'required':![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db['SmsQueue'],{'as':'SmsQueues','through':_0x3a81('0x30'),'required':![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db['OpenchannelQueue'],{'as':_0x3a81('0x13c'),'through':_0x3a81('0x32'),'required':![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x10d')],{'as':'WhatsappQueues','through':_0x3a81('0x34'),'required':![]});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0xf8')],{'through':_0x3a81('0x12e')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x13d')],{'as':_0x3a81('0x13e'),'through':'user_has_chat_websites'});db['User'][_0x3a81('0x129')](db[_0x3a81('0x4a')],{'as':_0x3a81('0x13f'),'through':_0x3a81('0x140')});db[_0x3a81('0xf')]['belongsToMany'](db[_0x3a81('0x3a')],{'as':_0x3a81('0x141'),'through':_0x3a81('0x142')});db[_0x3a81('0xf')][_0x3a81('0x129')](db[_0x3a81('0x59')],{'as':_0x3a81('0x143'),'through':_0x3a81('0x144')});db['User'][_0x3a81('0x129')](db[_0x3a81('0x52')],{'as':'SmsAccounts','through':_0x3a81('0x145')});db['User'][_0x3a81('0x129')](db[_0x3a81('0x104')],{'as':_0x3a81('0x146'),'through':_0x3a81('0x147')});db[_0x3a81('0xf')]['belongsToMany'](db[_0x3a81('0x148')],{'as':_0x3a81('0x149'),'through':_0x3a81('0x14a')});db[_0x3a81('0x11')][_0x3a81('0x11b')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x3a81('0x14b')});db[_0x3a81('0x13')][_0x3a81('0x11b')](db[_0x3a81('0x15')],{'onDelete':_0x3a81('0x118')});db[_0x3a81('0x15')]['hasMany'](db[_0x3a81('0x15')],{'as':_0x3a81('0x14c'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x17')][_0x3a81('0x129')](db['Sound'],{'as':'Sounds','through':_0x3a81('0x14d')});db['VoiceQueue']['hasMany'](db[_0x3a81('0x2b')],{'as':_0x3a81('0x14e'),'foreignKey':_0x3a81('0x14f')});db['VoiceQueue'][_0x3a81('0x11b')](db[_0x3a81('0x71')],{'as':_0x3a81('0x150'),'foreignKey':_0x3a81('0x14f')});db[_0x3a81('0x19')][_0x3a81('0x11b')](db[_0x3a81('0x11e')],{'as':_0x3a81('0x11f'),'foreignKey':_0x3a81('0x14f')});db[_0x3a81('0x19')][_0x3a81('0x11b')](db['CmHopperHistory'],{'as':_0x3a81('0x151'),'foreignKey':'VoiceQueueId'});db[_0x3a81('0x19')]['hasMany'](db['ReportAgentPreview'],{'as':_0x3a81('0x77'),'foreignKey':_0x3a81('0x14f')});db[_0x3a81('0x19')][_0x3a81('0x11b')](db[_0x3a81('0x72')],{'as':_0x3a81('0x152'),'foreignKey':'VoiceQueueId'});db[_0x3a81('0x19')][_0x3a81('0x11b')](db[_0x3a81('0xda')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x3a81('0x19')][_0x3a81('0x127')](db[_0x3a81('0x28')],{'as':_0x3a81('0x28'),'foreignKey':_0x3a81('0x153')});db[_0x3a81('0x19')][_0x3a81('0x127')](db[_0x3a81('0x28')],{'as':_0x3a81('0x154'),'foreignKey':_0x3a81('0x155')});db[_0x3a81('0x19')][_0x3a81('0x127')](db[_0x3a81('0x84')],{'as':_0x3a81('0x84'),'foreignKey':'IntervalId'});db[_0x3a81('0x19')][_0x3a81('0x127')](db[_0x3a81('0x86')],{'as':_0x3a81('0x156'),'foreignKey':_0x3a81('0x157')});db[_0x3a81('0x19')][_0x3a81('0x129')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x158'),'through':'voice_queues_has_cm_lists'});db[_0x3a81('0x19')]['belongsToMany'](db['User'],{'as':_0x3a81('0x159'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'as':_0x3a81('0x15a'),'through':_0x3a81('0x111')});db[_0x3a81('0x19')]['belongsToMany'](db[_0x3a81('0xf8')],{'as':_0x3a81('0x15b'),'through':_0x3a81('0x15c')});db[_0x3a81('0x11c')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0xf'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x1c')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0xf'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x15d')]['hasMany'](db['VoiceMailMessage'],{'as':_0x3a81('0x15e'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x3a81('0x15f')});db[_0x3a81('0x1e')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x3a81('0x160'),'targetKey':_0x3a81('0x15f')});db[_0x3a81('0x20')][_0x3a81('0x11b')](db['VoiceQueueReport'],{'as':_0x3a81('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0x3a81('0x20')][_0x3a81('0x11b')](db[_0x3a81('0x22')],{'as':_0x3a81('0x162'),'foreignKey':_0x3a81('0x163'),'constraints':![]});db[_0x3a81('0x20')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0xf'),'foreignKey':'UserId'});db[_0x3a81('0x20')]['belongsTo'](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':'ContactId'});db[_0x3a81('0x36')][_0x3a81('0x127')](db[_0x3a81('0x3a')],{'as':_0x3a81('0x3a'),'foreignKey':_0x3a81('0x165')});db[_0x3a81('0x36')][_0x3a81('0x127')](db['CloudProvider'],{'as':_0x3a81('0x10f'),'foreignKey':_0x3a81('0x166'),'onDelete':_0x3a81('0x167')});db['MailServerOut'][_0x3a81('0x127')](db[_0x3a81('0x3a')],{'as':_0x3a81('0x3a'),'foreignKey':'MailAccountId'});db[_0x3a81('0x38')][_0x3a81('0x127')](db['CloudProvider'],{'as':_0x3a81('0x10f'),'foreignKey':_0x3a81('0x166'),'onDelete':_0x3a81('0x167')});db[_0x3a81('0x3a')][_0x3a81('0x117')](db[_0x3a81('0x36')],{'as':_0x3a81('0x168'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x3a')][_0x3a81('0x117')](db['MailServerOut'],{'as':_0x3a81('0x169'),'onDelete':_0x3a81('0x118')});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0x3a81('0x16a'),'foreignKey':_0x3a81('0x165'),'onDelete':'cascade'});db[_0x3a81('0x3a')][_0x3a81('0x11b')](db[_0x3a81('0x7f')],{'as':_0x3a81('0x16b'),'foreignKey':_0x3a81('0x165')});db[_0x3a81('0x3a')]['hasMany'](db[_0x3a81('0x40')],{'as':_0x3a81('0x15e'),'foreignKey':_0x3a81('0x165')});db[_0x3a81('0x3a')][_0x3a81('0x11b')](db[_0x3a81('0x3f')],{'as':'Interactions'});db[_0x3a81('0x3a')][_0x3a81('0x11b')](db['MailApplication'],{'as':_0x3a81('0x14c')});db['MailAccount'][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x3a')][_0x3a81('0x127')](db['Template'],{'as':_0x3a81('0x95'),'foreignKey':_0x3a81('0x16e')});db[_0x3a81('0x3a')][_0x3a81('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x3a81('0x157')});db[_0x3a81('0x3a')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':'Agents','through':_0x3a81('0x142')});db[_0x3a81('0x3c')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x139')});db[_0x3a81('0x3c')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':_0x3a81('0x16f'),'as':'Teams'});db[_0x3a81('0x3f')][_0x3a81('0x11b')](db[_0x3a81('0x40')],{'as':_0x3a81('0x15e'),'onDelete':'cascade','foreignKey':_0x3a81('0x170')});db['MailInteraction'][_0x3a81('0x127')](db['MailAccount'],{'as':_0x3a81('0x171'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x3a81('0x127')](db['CmContact'],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x3f')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x173'),'foreignKey':'UserId'});db[_0x3a81('0x3f')][_0x3a81('0x129')](db['Tag'],{'through':_0x3a81('0x174'),'as':_0x3a81('0x175')});db['MailInteraction'][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':'mail_interaction_has_tags','as':_0x3a81('0x176')});db[_0x3a81('0x3f')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x3a81('0x40')][_0x3a81('0x11b')](db[_0x3a81('0x178')],{'as':'Attachments','onDelete':_0x3a81('0x118')});db['MailMessage']['belongsTo'](db[_0x3a81('0xf')],{'as':_0x3a81('0xf')});db[_0x3a81('0x40')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x164')});db[_0x3a81('0x40')][_0x3a81('0x127')](db[_0x3a81('0x3f')],{'as':_0x3a81('0x179'),'foreignKey':_0x3a81('0x170')});db[_0x3a81('0x40')][_0x3a81('0x127')](db[_0x3a81('0x3a')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x165')});db[_0x3a81('0x40')]['belongsTo'](db['ChatWebsite'],{'as':_0x3a81('0x13d'),'foreignKey':_0x3a81('0x17a')});db[_0x3a81('0x40')][_0x3a81('0x127')](db[_0x3a81('0x17b')],{'as':'ChatOfflineMessage','foreignKey':_0x3a81('0x17c')});db[_0x3a81('0x42')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x42')][_0x3a81('0x127')](db['MailQueue'],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x42')][_0x3a81('0x127')](db['MailAccount'],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x42')]['belongsTo'](db[_0x3a81('0x84')],{'onDelete':'restrict','foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x42')][_0x3a81('0x127')](db['Tag'],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x44')][_0x3a81('0x127')](db[_0x3a81('0x3a')],{});db[_0x3a81('0x44')][_0x3a81('0x127')](db['CmList'],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x44')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x44')][_0x3a81('0x127')](db[_0x3a81('0x3f')],{});db[_0x3a81('0x44')][_0x3a81('0x127')](db[_0x3a81('0x40')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0x3a81('0x44')][_0x3a81('0x127')](db[_0x3a81('0x3c')],{});db[_0x3a81('0x46')][_0x3a81('0x11b')](db[_0x3a81('0x48')],{'as':'Items','onDelete':_0x3a81('0x118')});db[_0x3a81('0x4a')]['hasMany'](db['Disposition'],{'as':_0x3a81('0x16a'),'foreignKey':_0x3a81('0x17f'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x4a')][_0x3a81('0x11b')](db[_0x3a81('0x7f')],{'as':_0x3a81('0x16b'),'foreignKey':_0x3a81('0x17f')});db[_0x3a81('0x4a')][_0x3a81('0x11b')](db[_0x3a81('0x4d')],{'as':_0x3a81('0x180')});db[_0x3a81('0x4a')][_0x3a81('0x11b')](db[_0x3a81('0x181')],{'as':_0x3a81('0x14c')});db['FaxAccount'][_0x3a81('0x11b')](db[_0x3a81('0x15')],{'as':_0x3a81('0x182'),'onDelete':_0x3a81('0x118')});db['FaxAccount']['hasMany'](db[_0x3a81('0x183')],{'as':_0x3a81('0x15e')});db['FaxAccount']['belongsTo'](db[_0x3a81('0x28')],{'as':_0x3a81('0x28')});db[_0x3a81('0x4a')][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':'List','foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x4a')]['belongsTo'](db['Pause'],{'as':_0x3a81('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3a81('0x4a')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x140')});db['FaxApplication']['belongsTo'](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x167')});db['FaxApplication'][_0x3a81('0x127')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0x3a81('0x127')](db[_0x3a81('0x4a')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x181')][_0x3a81('0x127')](db[_0x3a81('0x8d')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x4d')][_0x3a81('0x11b')](db['FaxMessage'],{'as':_0x3a81('0x15e'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x3a81('0x127')](db[_0x3a81('0x4a')],{'as':_0x3a81('0x171'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x4d')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':'Owner','foreignKey':_0x3a81('0x11a')});db['FaxInteraction'][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x3a81('0x4d')]['belongsToMany'](db[_0x3a81('0x8d')],{'through':_0x3a81('0x184'),'as':'ThroughTags'});db[_0x3a81('0x4d')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':'user_has_fax_interactions','foreignKey':_0x3a81('0x185')});db[_0x3a81('0x183')]['belongsTo'](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0xf')});db[_0x3a81('0x183')][_0x3a81('0x127')](db['FaxInteraction'],{'as':_0x3a81('0x179'),'foreignKey':_0x3a81('0x185')});db[_0x3a81('0x183')]['belongsTo'](db['CmContact'],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x164')});db[_0x3a81('0x183')]['belongsTo'](db[_0x3a81('0x178')],{'as':_0x3a81('0x178'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x3a81('0x127')](db['FaxAccount'],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x17f')});db[_0x3a81('0x4f')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x2e')});db[_0x3a81('0x4f')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':_0x3a81('0x186'),'as':_0x3a81('0x15a')});db[_0x3a81('0x50')]['belongsTo'](db[_0x3a81('0x4a')],{});db['FaxQueueReport'][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x50')][_0x3a81('0x127')](db['CmContact'],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x50')]['belongsTo'](db['FaxInteraction'],{});db[_0x3a81('0x50')][_0x3a81('0x127')](db['FaxMessage'],{});db[_0x3a81('0x50')][_0x3a81('0x127')](db['User'],{});db[_0x3a81('0x50')][_0x3a81('0x127')](db['FaxQueue'],{});db[_0x3a81('0x52')][_0x3a81('0x11b')](db[_0x3a81('0x81')],{'as':_0x3a81('0x16a'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x3a81('0x52')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x3a81('0x187')});db['SmsAccount'][_0x3a81('0x11b')](db[_0x3a81('0x56')],{'as':_0x3a81('0x15e'),'foreignKey':_0x3a81('0x187')});db[_0x3a81('0x52')][_0x3a81('0x11b')](db[_0x3a81('0x54')],{'as':'Interactions'});db[_0x3a81('0x52')]['hasMany'](db[_0x3a81('0x188')],{'as':'Applications'});db['SmsAccount'][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':'ListId'});db[_0x3a81('0x52')][_0x3a81('0x127')](db['Pause'],{'as':_0x3a81('0x156'),'foreignKey':_0x3a81('0x157')});db[_0x3a81('0x52')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x145')});db[_0x3a81('0x188')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':'restrict'});db[_0x3a81('0x188')]['belongsTo'](db[_0x3a81('0x57')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x188')][_0x3a81('0x127')](db[_0x3a81('0x52')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x188')][_0x3a81('0x127')](db[_0x3a81('0x84')],{'onDelete':'restrict','foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x188')][_0x3a81('0x127')](db[_0x3a81('0x8d')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x54')]['hasMany'](db[_0x3a81('0x56')],{'as':_0x3a81('0x15e'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x189')});db[_0x3a81('0x54')][_0x3a81('0x127')](db[_0x3a81('0x52')],{'as':'Account','foreignKey':_0x3a81('0x187')});db[_0x3a81('0x54')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x54')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x173'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x54')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x18a'),'as':_0x3a81('0x175')});db[_0x3a81('0x54')][_0x3a81('0x129')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x3a81('0x54')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':_0x3a81('0x18b'),'foreignKey':'SmsInteractionId'});db[_0x3a81('0x56')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':'User'});db['SmsMessage'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'onDelete':'cascade','as':_0x3a81('0x164')});db[_0x3a81('0x56')][_0x3a81('0x127')](db['SmsInteraction'],{'onDelete':_0x3a81('0x118'),'as':'Interaction','foreignKey':_0x3a81('0x189')});db['SmsMessage']['belongsTo'](db[_0x3a81('0x52')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x187')});db[_0x3a81('0x57')]['belongsToMany'](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x3a81('0x57')]['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0x3a81('0x15a')});db[_0x3a81('0x59')][_0x3a81('0x11b')](db[_0x3a81('0x81')],{'as':_0x3a81('0x16a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x3a81('0x118')});db[_0x3a81('0x59')]['hasMany'](db[_0x3a81('0x7f')],{'as':_0x3a81('0x16b'),'foreignKey':_0x3a81('0x18c')});db['OpenchannelAccount'][_0x3a81('0x11b')](db[_0x3a81('0x5c')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x3a81('0x59')][_0x3a81('0x11b')](db[_0x3a81('0x18d')],{'as':_0x3a81('0x15e'),'foreignKey':_0x3a81('0x18c')});db[_0x3a81('0x59')][_0x3a81('0x11b')](db[_0x3a81('0x5b')],{'as':_0x3a81('0x14c'),'foreignKey':'OpenchannelAccountId'});db[_0x3a81('0x59')]['belongsTo'](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db['OpenchannelAccount']['belongsTo'](db[_0x3a81('0x86')],{'as':_0x3a81('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x144')});db['OpenchannelApplication'][_0x3a81('0x127')](db['User'],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x5b')][_0x3a81('0x127')](db[_0x3a81('0x5f')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x18e')});db['OpenchannelApplication']['belongsTo'](db[_0x3a81('0x59')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x18c')});db[_0x3a81('0x5b')]['belongsTo'](db[_0x3a81('0x84')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17d')});db['OpenchannelApplication'][_0x3a81('0x127')](db['Tag'],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x5c')][_0x3a81('0x11b')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x18f')});db[_0x3a81('0x5c')][_0x3a81('0x127')](db[_0x3a81('0x59')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x18c')});db[_0x3a81('0x5c')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x173'),'foreignKey':_0x3a81('0x11a')});db['OpenchannelInteraction'][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x190'),'as':'Tags'});db[_0x3a81('0x5c')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x190'),'as':_0x3a81('0x176')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0x3a81('0x177'),'through':_0x3a81('0x191'),'foreignKey':_0x3a81('0x18f')});db['OpenchannelMessage'][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0xf')});db['OpenchannelMessage'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x164')});db[_0x3a81('0x18d')][_0x3a81('0x127')](db[_0x3a81('0x5c')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x179'),'foreignKey':_0x3a81('0x18f')});db[_0x3a81('0x18d')]['belongsTo'](db['Attachment'],{'as':_0x3a81('0x178'),'foreignKey':_0x3a81('0x192')});db[_0x3a81('0x18d')]['belongsTo'](db[_0x3a81('0x59')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x18c')});db[_0x3a81('0x5f')]['belongsToMany'](db['User'],{'as':_0x3a81('0x159'),'through':_0x3a81('0x32'),'foreignKey':_0x3a81('0x18e')});db[_0x3a81('0x5f')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':'team_has_openchannel_queues','as':_0x3a81('0x15a')});db[_0x3a81('0x13d')][_0x3a81('0x11b')](db[_0x3a81('0x81')],{'as':_0x3a81('0x16a'),'foreignKey':_0x3a81('0x17a'),'onDelete':'cascade'});db[_0x3a81('0x13d')][_0x3a81('0x11b')](db['CannedAnswer'],{'as':_0x3a81('0x16b'),'foreignKey':_0x3a81('0x17a')});db[_0x3a81('0x13d')]['hasMany'](db[_0x3a81('0x6c')],{'as':_0x3a81('0x193')});db['ChatWebsite'][_0x3a81('0x11b')](db['ChatInteraction'],{'as':_0x3a81('0x180')});db[_0x3a81('0x13d')]['hasMany'](db[_0x3a81('0x62')],{'as':_0x3a81('0x14c')});db[_0x3a81('0x13d')][_0x3a81('0x11b')](db[_0x3a81('0x66')],{'as':_0x3a81('0x15e')});db[_0x3a81('0x13d')][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x13d')][_0x3a81('0x127')](db[_0x3a81('0x84')],{'as':_0x3a81('0x84'),'foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x13d')][_0x3a81('0x127')](db[_0x3a81('0x3a')],{'as':_0x3a81('0x3a'),'foreignKey':'MailAccountId'});db[_0x3a81('0x13d')][_0x3a81('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x3a81('0x157')});db[_0x3a81('0x13d')][_0x3a81('0x129')](db['User'],{'as':_0x3a81('0x159'),'through':_0x3a81('0x194')});db[_0x3a81('0x61')]['belongsTo'](db[_0x3a81('0x59')],{});db[_0x3a81('0x61')][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0x61')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':'ContactId'});db[_0x3a81('0x61')]['belongsTo'](db[_0x3a81('0x5c')],{});db['OpenchannelQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x18d')],{});db[_0x3a81('0x61')][_0x3a81('0x127')](db['User'],{});db[_0x3a81('0x61')][_0x3a81('0x127')](db['OpenchannelQueue'],{});db[_0x3a81('0x62')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x195'),'foreignKey':'UserId','onDelete':_0x3a81('0x167')});db[_0x3a81('0x62')]['belongsTo'](db[_0x3a81('0x68')],{'as':_0x3a81('0x196'),'foreignKey':_0x3a81('0x197'),'onDelete':_0x3a81('0x167')});db[_0x3a81('0x62')][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'as':_0x3a81('0x198'),'foreignKey':_0x3a81('0x17a'),'onDelete':_0x3a81('0x167')});db[_0x3a81('0x62')][_0x3a81('0x127')](db[_0x3a81('0x8d')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x64')][_0x3a81('0x11b')](db[_0x3a81('0x66')],{'as':_0x3a81('0x15e'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x199')});db[_0x3a81('0x64')][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x17a')});db[_0x3a81('0x64')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x64')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x173'),'foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x64')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x19a'),'as':_0x3a81('0x175')});db[_0x3a81('0x64')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x19a'),'as':_0x3a81('0x176')});db[_0x3a81('0x64')]['belongsToMany'](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':_0x3a81('0x131'),'foreignKey':_0x3a81('0x199')});db['ChatMessage'][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0xf')});db[_0x3a81('0x66')]['belongsTo'](db[_0x3a81('0x6f')],{'onDelete':'cascade','as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x66')][_0x3a81('0x127')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x3a81('0x179'),'foreignKey':'ChatInteractionId'});db[_0x3a81('0x66')][_0x3a81('0x127')](db['Attachment'],{'as':_0x3a81('0x178'),'foreignKey':_0x3a81('0x192')});db[_0x3a81('0x66')][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'as':'Account','foreignKey':_0x3a81('0x17a')});db[_0x3a81('0x17b')][_0x3a81('0x11b')](db[_0x3a81('0x178')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x17b')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x164'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x17a')});db[_0x3a81('0x68')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x3a81('0x13a'),'hooks':!![]});db[_0x3a81('0x68')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':_0x3a81('0x19b'),'as':_0x3a81('0x15a')});db['ChatGroup'][_0x3a81('0x11b')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x3a81('0x19c'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x6a')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x14e'),'through':_0x3a81('0x12b')});db[_0x3a81('0x6c')][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'as':'Website','foreignKey':_0x3a81('0x17a')});db['CmCompany'][_0x3a81('0x11b')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x12c'),'foreignKey':_0x3a81('0x19d')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0x91')],{'as':'Phones','foreignKey':_0x3a81('0x19e')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0x71')],{'as':'Hoppers','foreignKey':_0x3a81('0x172')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db['CmHopperFinal'],{'as':_0x3a81('0x11f'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db['CmHopperHistory'],{'as':_0x3a81('0x151'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0x77')],{'as':_0x3a81('0x77'),'foreignKey':'ContactId'});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0xda')],{'as':'JscriptySessions','foreignKey':_0x3a81('0x172')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db['OpenchannelInteraction'],{'as':_0x3a81('0x134'),'foreignKey':_0x3a81('0x172'),'onDelete':'restrict'});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0x64')],{'as':_0x3a81('0x121'),'foreignKey':_0x3a81('0x172'),'onDelete':'restrict'});db[_0x3a81('0x6f')]['hasMany'](db['SmsInteraction'],{'as':_0x3a81('0x122'),'foreignKey':'ContactId','onDelete':_0x3a81('0x167')});db[_0x3a81('0x6f')][_0x3a81('0x11b')](db[_0x3a81('0x4d')],{'as':_0x3a81('0x132'),'foreignKey':'ContactId','onDelete':_0x3a81('0x167')});db['CmContact'][_0x3a81('0x11b')](db[_0x3a81('0x3f')],{'as':_0x3a81('0x123'),'foreignKey':_0x3a81('0x172'),'onDelete':_0x3a81('0x167')});db[_0x3a81('0x6f')][_0x3a81('0x127')](db[_0x3a81('0x6e')],{'as':_0x3a81('0x19f'),'foreignKey':'CompanyId'});db[_0x3a81('0x6f')]['belongsTo'](db[_0x3a81('0xf8')],{'as':'List','foreignKey':_0x3a81('0x16d'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x6f')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':_0x3a81('0x12d')});db[_0x3a81('0x6f')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'as':_0x3a81('0x175'),'through':_0x3a81('0x1a0')});db[_0x3a81('0x6f')]['belongsToMany'](db[_0x3a81('0x8d')],{'through':_0x3a81('0x1a0'),'as':_0x3a81('0x176')});db[_0x3a81('0x71')]['hasMany'](db[_0x3a81('0x93')],{'as':_0x3a81('0x1a1'),'foreignKey':'CmHopperId'});db[_0x3a81('0x71')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x71')][_0x3a81('0x127')](db['CmList'],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d'),'onDelete':_0x3a81('0x118')});db['CmHopper'][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':'Agent','foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x71')][_0x3a81('0x127')](db[_0x3a81('0x19')],{'as':_0x3a81('0x196'),'foreignKey':_0x3a81('0x14f'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x71')][_0x3a81('0x127')](db[_0x3a81('0xeb')],{'as':_0x3a81('0xeb'),'foreignKey':_0x3a81('0x1a2'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x71')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'as':_0x3a81('0x173'),'foreignKey':'OwnerId'});db[_0x3a81('0x72')]['belongsTo'](db['CmContact'],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x72')]['belongsTo'](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0x72')]['belongsTo'](db[_0x3a81('0x19')],{'as':_0x3a81('0x196'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x3a81('0x72')][_0x3a81('0x127')](db[_0x3a81('0xeb')],{'as':_0x3a81('0xeb'),'foreignKey':_0x3a81('0x1a2'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x3a81('0x83')],{'as':{'plural':_0x3a81('0x1a3'),'singular':_0x3a81('0x1a4')},'foreignKey':_0x3a81('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x3a81('0x7d')]['hasMany'](db[_0x3a81('0x83')],{'as':{'plural':_0x3a81('0x1a6'),'singular':'OneAny'},'foreignKey':_0x3a81('0x1a7'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x7d')]['hasMany'](db[_0x3a81('0x7b')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x81')][_0x3a81('0x11b')](db[_0x3a81('0x81')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x3a81('0x118')});db[_0x3a81('0x84')][_0x3a81('0x11b')](db[_0x3a81('0x84')],{'as':_0x3a81('0x1a8'),'foreignKey':_0x3a81('0x17d'),'onDelete':_0x3a81('0x118'),'hooks':!![],'required':![]});db['Interval'][_0x3a81('0x11b')](db[_0x3a81('0x15')],{'as':_0x3a81('0x11d'),'foreignKey':_0x3a81('0x17d'),'onDelete':_0x3a81('0x167')});db['Interval']['hasMany'](db[_0x3a81('0x42')],{'as':_0x3a81('0x1a9'),'foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x84')][_0x3a81('0x11b')](db['ChatApplication'],{'as':_0x3a81('0x1aa'),'foreignKey':'IntervalId'});db['Interval'][_0x3a81('0x11b')](db['FaxApplication'],{'as':_0x3a81('0x1ab'),'foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x84')][_0x3a81('0x11b')](db[_0x3a81('0x188')],{'as':_0x3a81('0x1ac'),'foreignKey':_0x3a81('0x17d')});db['Schedule'][_0x3a81('0x127')](db[_0x3a81('0x3a')],{});db[_0x3a81('0x8a')]['belongsTo'](db[_0x3a81('0x9e')],{'foreignKey':_0x3a81('0x1ad')});db['Schedule'][_0x3a81('0x127')](db[_0x3a81('0x9c')],{'foreignKey':_0x3a81('0x1ae')});db[_0x3a81('0x1af')][_0x3a81('0x129')](db['VoiceMusicOnHold'],{'as':_0x3a81('0x1b0'),'through':_0x3a81('0x14d'),'onDelete':_0x3a81('0x167')});db['Tag'][_0x3a81('0x129')](db['CmContact'],{'through':_0x3a81('0x1a0')});db[_0x3a81('0x8d')][_0x3a81('0x129')](db[_0x3a81('0x64')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x3a81('0x3f')],{'through':_0x3a81('0x174')});db[_0x3a81('0x8d')][_0x3a81('0x129')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x3a81('0x8d')]['belongsToMany'](db[_0x3a81('0x4d')],{'through':_0x3a81('0x184')});db[_0x3a81('0x8d')][_0x3a81('0x129')](db[_0x3a81('0x5c')],{'through':_0x3a81('0x190')});db[_0x3a81('0x8d')][_0x3a81('0x129')](db[_0x3a81('0x107')],{'through':_0x3a81('0x1b1')});db[_0x3a81('0x91')][_0x3a81('0x127')](db[_0x3a81('0x8f')],{'as':_0x3a81('0x1b2'),'foreignKey':'ItemTypeId'});db[_0x3a81('0x93')][_0x3a81('0x127')](db[_0x3a81('0x71')],{'as':_0x3a81('0x1b3'),'foreignKey':_0x3a81('0x1b4')});db['CmContactHasItem'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x19e')});db[_0x3a81('0x96')][_0x3a81('0x11b')](db[_0x3a81('0x83')],{'as':{'plural':_0x3a81('0x1b5'),'singular':_0x3a81('0x1b6')},'foreignKey':_0x3a81('0x1b7'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db['Trigger'][_0x3a81('0x11b')](db[_0x3a81('0x83')],{'as':{'plural':'AnyConditions','singular':_0x3a81('0x1b8')},'foreignKey':_0x3a81('0x1b9'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x96')][_0x3a81('0x11b')](db[_0x3a81('0x7b')],{'as':'Actions','foreignKey':_0x3a81('0x1ba'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x9c')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x3a81('0x1bb'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1ae'),'hooks':!![]});db[_0x3a81('0x9e')][_0x3a81('0x11b')](db[_0x3a81('0xa4')],{'as':_0x3a81('0x1bb'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1ad')});db[_0x3a81('0xa2')]['hasMany'](db[_0x3a81('0xa4')],{'as':_0x3a81('0x1bb'),'onDelete':'cascade','foreignKey':_0x3a81('0x1bc')});db[_0x3a81('0xa4')][_0x3a81('0x127')](db[_0x3a81('0xa2')],{'foreignKey':'MetricId'});db[_0x3a81('0xa7')][_0x3a81('0x11b')](db[_0x3a81('0xa8')],{'as':_0x3a81('0x1bd'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xa8')][_0x3a81('0x11b')](db[_0x3a81('0xaa')],{'as':_0x3a81('0x1bf'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xa8')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xa8')][_0x3a81('0x11b')](db[_0x3a81('0xaa')],{'as':_0x3a81('0x1bb'),'onDelete':'cascade','foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xa8')][_0x3a81('0x127')](db[_0x3a81('0xa7')],{'as':'Account','foreignKey':'AccountId'});db[_0x3a81('0xaa')][_0x3a81('0x11b')](db[_0x3a81('0xaa')],{'as':_0x3a81('0x1c3'),'foreignKey':'SubjectId'});db[_0x3a81('0xaa')][_0x3a81('0x11b')](db[_0x3a81('0xaa')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xaa')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0x3a81('0x1c2')});db['SalesforceField']['belongsTo'](db[_0x3a81('0x1c5')],{'as':_0x3a81('0x1c5'),'foreignKey':_0x3a81('0x1c6')});db[_0x3a81('0x1c7')][_0x3a81('0x11b')](db[_0x3a81('0x1c8')],{'as':_0x3a81('0x1bd'),'onDelete':_0x3a81('0x118'),'foreignKey':'AccountId'});db[_0x3a81('0x1c8')][_0x3a81('0x11b')](db['SugarcrmField'],{'as':_0x3a81('0x1bf'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0x1c8')][_0x3a81('0x11b')](db[_0x3a81('0xad')],{'as':_0x3a81('0x1c9'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0x1c8')][_0x3a81('0x11b')](db[_0x3a81('0xad')],{'as':_0x3a81('0x1bb'),'onDelete':'cascade','foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0x1c8')][_0x3a81('0x127')](db[_0x3a81('0x1c7')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xad')]['hasMany'](db[_0x3a81('0xad')],{'as':_0x3a81('0x1c3'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x3a81('0x11b')](db[_0x3a81('0xad')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3a81('0xad')][_0x3a81('0x11b')](db[_0x3a81('0xad')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xad')][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':_0x3a81('0x1c5'),'foreignKey':_0x3a81('0x1c6')});db[_0x3a81('0xaf')]['hasMany'](db['DeskConfiguration'],{'as':_0x3a81('0x1bd'),'onDelete':'cascade','foreignKey':_0x3a81('0x1be')});db['DeskConfiguration'][_0x3a81('0x11b')](db[_0x3a81('0xb3')],{'as':_0x3a81('0x1bf'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xb1')][_0x3a81('0x11b')](db[_0x3a81('0xb3')],{'as':_0x3a81('0x1c9'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xb1')][_0x3a81('0x11b')](db['DeskField'],{'as':_0x3a81('0x1bb'),'onDelete':_0x3a81('0x118'),'foreignKey':'FieldId'});db[_0x3a81('0xb1')][_0x3a81('0x127')](db[_0x3a81('0xaf')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xb1')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x1cb')});db['DeskField'][_0x3a81('0x11b')](db[_0x3a81('0xb3')],{'as':_0x3a81('0x1c3'),'foreignKey':'SubjectId'});db[_0x3a81('0xb3')]['hasMany'](db[_0x3a81('0xb3')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xb3')][_0x3a81('0x11b')](db[_0x3a81('0xb3')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xb3')][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':_0x3a81('0x1c5'),'foreignKey':'VariableId'});db[_0x3a81('0x1cc')][_0x3a81('0x11b')](db['ZohoConfiguration'],{'as':_0x3a81('0x1bd'),'onDelete':'cascade','foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xb4')][_0x3a81('0x11b')](db[_0x3a81('0xb5')],{'as':'Subjects','onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xb4')][_0x3a81('0x11b')](db['ZohoField'],{'as':_0x3a81('0x1c9'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x3a81('0xb4')]['hasMany'](db[_0x3a81('0xb5')],{'as':_0x3a81('0x1bb'),'onDelete':_0x3a81('0x118'),'foreignKey':'FieldId'});db[_0x3a81('0xb4')][_0x3a81('0x127')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xb5')][_0x3a81('0x11b')](db[_0x3a81('0xb5')],{'as':_0x3a81('0x1c3'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xb5')][_0x3a81('0x11b')](db[_0x3a81('0xb5')],{'as':'Description','foreignKey':_0x3a81('0x1c1')});db['ZohoField'][_0x3a81('0x11b')](db[_0x3a81('0xb5')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xb5')][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':'Variable','foreignKey':_0x3a81('0x1c6')});db['ZendeskAccount'][_0x3a81('0x11b')](db[_0x3a81('0xb9')],{'as':_0x3a81('0x1bd'),'onDelete':_0x3a81('0x118'),'foreignKey':'AccountId'});db[_0x3a81('0xb9')]['hasMany'](db[_0x3a81('0xba')],{'as':_0x3a81('0x1bf'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x3a81('0x1c9'),'foreignKey':'DescriptionId'});db[_0x3a81('0xb9')][_0x3a81('0x11b')](db[_0x3a81('0xba')],{'as':_0x3a81('0x1bb'),'foreignKey':'FieldId'});db[_0x3a81('0xb9')][_0x3a81('0x127')](db[_0x3a81('0xb7')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db['ZendeskConfiguration'][_0x3a81('0x129')](db['Tag'],{'through':_0x3a81('0x1cd')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0x3a81('0x1c0')});db['ZendeskField']['hasMany'](db[_0x3a81('0xba')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db['ZendeskField'][_0x3a81('0x11b')](db[_0x3a81('0xba')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xba')]['belongsTo'](db[_0x3a81('0x1c5')],{'as':'Variable','foreignKey':_0x3a81('0x1c6')});db[_0x3a81('0xbc')]['hasMany'](db[_0x3a81('0x1ce')],{'as':'Configurations','onDelete':_0x3a81('0x118'),'foreignKey':'AccountId'});db[_0x3a81('0x1ce')][_0x3a81('0x11b')](db[_0x3a81('0xbf')],{'as':_0x3a81('0x1bf'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1c0')});db['FreshdeskConfiguration'][_0x3a81('0x11b')](db[_0x3a81('0xbf')],{'as':_0x3a81('0x1c9'),'onDelete':_0x3a81('0x118'),'foreignKey':'DescriptionId'});db[_0x3a81('0x1ce')][_0x3a81('0x11b')](db[_0x3a81('0xbf')],{'as':_0x3a81('0x1bb'),'onDelete':_0x3a81('0x118'),'foreignKey':'FieldId'});db[_0x3a81('0x1ce')][_0x3a81('0x127')](db[_0x3a81('0xbc')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0x1ce')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':_0x3a81('0x1cf')});db[_0x3a81('0xbf')][_0x3a81('0x11b')](db[_0x3a81('0xbf')],{'as':'Subject','foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xbf')]['hasMany'](db[_0x3a81('0xbf')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xbf')][_0x3a81('0x11b')](db[_0x3a81('0xbf')],{'as':'Field','foreignKey':_0x3a81('0x1c2')});db['FreshdeskField'][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':_0x3a81('0x1c5'),'foreignKey':'VariableId'});db[_0x3a81('0xc0')][_0x3a81('0x11b')](db[_0x3a81('0x1d0')],{'as':_0x3a81('0x1bd'),'onDelete':_0x3a81('0x118'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0x3a81('0x11b')](db[_0x3a81('0xc3')],{'as':_0x3a81('0x1bf'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0x1d0')][_0x3a81('0x11b')](db[_0x3a81('0xc3')],{'as':'Descriptions','foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0x1d0')][_0x3a81('0x11b')](db[_0x3a81('0xc3')],{'as':_0x3a81('0x1bb'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0x1d0')][_0x3a81('0x127')](db[_0x3a81('0xc0')],{'as':'Account','foreignKey':'AccountId'});db[_0x3a81('0xc3')][_0x3a81('0x11b')](db['VtigerField'],{'as':_0x3a81('0x1c3'),'foreignKey':_0x3a81('0x1c0')});db['VtigerField']['hasMany'](db[_0x3a81('0xc3')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xc3')][_0x3a81('0x11b')](db[_0x3a81('0xc3')],{'as':'Field','foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xc3')][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':_0x3a81('0x1c5'),'foreignKey':_0x3a81('0x1c6')});db[_0x3a81('0xc4')][_0x3a81('0x11b')](db[_0x3a81('0xc6')],{'as':_0x3a81('0x1bd'),'onDelete':'cascade','foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xc6')][_0x3a81('0x11b')](db[_0x3a81('0xc8')],{'as':_0x3a81('0x1bf'),'foreignKey':'SubjectId'});db[_0x3a81('0xc6')][_0x3a81('0x11b')](db['ServicenowField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x3a81('0x11b')](db[_0x3a81('0xc8')],{'as':'Fields','foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xc6')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x3a81('0xc8')][_0x3a81('0x11b')](db[_0x3a81('0xc8')],{'as':_0x3a81('0x1c3'),'foreignKey':_0x3a81('0x1c0')});db['ServicenowField'][_0x3a81('0x11b')](db[_0x3a81('0xc8')],{'as':_0x3a81('0x1c4'),'foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0xc8')][_0x3a81('0x11b')](db[_0x3a81('0xc8')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0xc8')][_0x3a81('0x127')](db['Variable'],{'as':_0x3a81('0x1c5'),'foreignKey':_0x3a81('0x1c6')});db[_0x3a81('0xca')][_0x3a81('0x11b')](db[_0x3a81('0x1d1')],{'as':_0x3a81('0x1bd'),'onDelete':'cascade','foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xca')][_0x3a81('0x127')](db['CloudProvider'],{'as':_0x3a81('0x10f'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration']['hasMany'](db[_0x3a81('0x1d2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0x1d1')][_0x3a81('0x11b')](db[_0x3a81('0x1d2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x3a81('0x11b')](db[_0x3a81('0x1d2')],{'as':_0x3a81('0x1bb'),'onDelete':'cascade','foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0x1d1')]['belongsTo'](db[_0x3a81('0xca')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0x1d2')][_0x3a81('0x11b')](db[_0x3a81('0x1d2')],{'as':_0x3a81('0x1c3'),'foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0x1d2')][_0x3a81('0x11b')](db[_0x3a81('0x1d2')],{'as':'Description','foreignKey':_0x3a81('0x1c1')});db[_0x3a81('0x1d2')][_0x3a81('0x11b')](db[_0x3a81('0x1d2')],{'as':_0x3a81('0x1ca'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x3a81('0x127')](db[_0x3a81('0x1c5')],{'as':'Variable','foreignKey':_0x3a81('0x1c6')});db['FreshsalesAccount'][_0x3a81('0x11b')](db[_0x3a81('0x1d3')],{'as':_0x3a81('0x1bd'),'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0x1d3')][_0x3a81('0x11b')](db[_0x3a81('0xd0')],{'as':_0x3a81('0x1bf'),'foreignKey':'SubjectId'});db[_0x3a81('0x1d3')][_0x3a81('0x11b')](db[_0x3a81('0xd0')],{'as':_0x3a81('0x1c9'),'foreignKey':_0x3a81('0x1c1')});db['FreshsalesConfiguration'][_0x3a81('0x11b')](db['FreshsalesField'],{'as':_0x3a81('0x1bb'),'foreignKey':_0x3a81('0x1c2')});db[_0x3a81('0x1d3')]['belongsTo'](db[_0x3a81('0xcd')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1be')});db[_0x3a81('0xd0')][_0x3a81('0x11b')](db[_0x3a81('0xd0')],{'as':'Subject','foreignKey':_0x3a81('0x1c0')});db[_0x3a81('0xd0')][_0x3a81('0x11b')](db['FreshsalesField'],{'as':_0x3a81('0x1c4'),'foreignKey':'DescriptionId'});db[_0x3a81('0xd0')]['hasMany'](db[_0x3a81('0xd0')],{'as':_0x3a81('0x1ca'),'foreignKey':_0x3a81('0x1c2')});db['FreshsalesField']['belongsTo'](db[_0x3a81('0x1c5')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3a81('0xd3')]['belongsTo'](db[_0x3a81('0x13d')],{});db[_0x3a81('0xd3')][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db['ChatQueueReport']['belongsTo'](db[_0x3a81('0x6f')],{'as':'Contact','foreignKey':_0x3a81('0x172')});db[_0x3a81('0xd3')][_0x3a81('0x127')](db[_0x3a81('0x64')],{});db[_0x3a81('0xd3')][_0x3a81('0x127')](db[_0x3a81('0x66')],{});db[_0x3a81('0xd3')][_0x3a81('0x127')](db[_0x3a81('0xf')],{});db['ChatQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x68')],{});db['ChatInternalMessage']['belongsTo'](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x118'),'foreignKey':_0x3a81('0x1d4')});db[_0x3a81('0x1d5')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':'cascade','foreignKey':_0x3a81('0x1d6')});db['JscriptySessionReport'][_0x3a81('0x11b')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x3a81('0x118')});db['JscriptySessionReport'][_0x3a81('0x11b')](db['JscriptyAnswerReport'],{'foreignKey':_0x3a81('0x1d7'),'onDelete':'cascade'});db['SmsQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x52')],{});db['SmsQueueReport'][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db[_0x3a81('0xdc')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':'Contact','foreignKey':_0x3a81('0x172')});db[_0x3a81('0xdc')][_0x3a81('0x127')](db[_0x3a81('0x54')],{});db[_0x3a81('0xdc')]['belongsTo'](db['SmsMessage'],{});db[_0x3a81('0xdc')]['belongsTo'](db[_0x3a81('0xf')],{});db[_0x3a81('0xdc')][_0x3a81('0x127')](db['SmsQueue'],{});db['JscriptyProject'][_0x3a81('0x11b')](db[_0x3a81('0xda')],{'foreignKey':_0x3a81('0x1d8')});db[_0x3a81('0xdf')][_0x3a81('0x11b')](db[_0x3a81('0xd8')],{'foreignKey':_0x3a81('0x1d8')});db[_0x3a81('0xdf')][_0x3a81('0x11b')](db[_0x3a81('0xd6')],{'foreignKey':_0x3a81('0x1d8')});db['SquareProject']['belongsToMany'](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':_0x3a81('0x14a')});db['Team'][_0x3a81('0x129')](db['User'],{'as':_0x3a81('0x159'),'through':_0x3a81('0x12f')});db['Team'][_0x3a81('0x129')](db['VoiceQueue'],{'through':_0x3a81('0x111'),'as':_0x3a81('0x136')});db[_0x3a81('0xe7')][_0x3a81('0x129')](db[_0x3a81('0x3c')],{'through':_0x3a81('0x16f'),'as':_0x3a81('0x1d9')});db[_0x3a81('0xe7')][_0x3a81('0x129')](db[_0x3a81('0x68')],{'through':'team_has_chat_queues','as':_0x3a81('0x1da')});db[_0x3a81('0xe7')][_0x3a81('0x129')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x3a81('0xe7')][_0x3a81('0x129')](db[_0x3a81('0x57')],{'through':_0x3a81('0x1db'),'as':_0x3a81('0x1dc')});db[_0x3a81('0xe7')][_0x3a81('0x129')](db[_0x3a81('0x5f')],{'through':'team_has_openchannel_queues','as':_0x3a81('0x13c')});db[_0x3a81('0xe7')][_0x3a81('0x129')](db[_0x3a81('0x10d')],{'through':_0x3a81('0x1dd'),'as':_0x3a81('0x1de')});db['Team'][_0x3a81('0x129')](db[_0x3a81('0xfa')],{'through':_0x3a81('0x112'),'as':_0x3a81('0x138')});db['Campaign'][_0x3a81('0x11b')](db[_0x3a81('0x71')],{'as':_0x3a81('0x150'),'foreignKey':_0x3a81('0x1a2')});db[_0x3a81('0xeb')][_0x3a81('0x11b')](db['CmHopperFinal'],{'as':_0x3a81('0x11f'),'foreignKey':_0x3a81('0x1a2')});db[_0x3a81('0xeb')][_0x3a81('0x11b')](db[_0x3a81('0x75')],{'as':_0x3a81('0x151'),'foreignKey':_0x3a81('0x1a2')});db[_0x3a81('0xeb')]['hasMany'](db[_0x3a81('0x72')],{'as':_0x3a81('0x152'),'foreignKey':_0x3a81('0x1a2')});db[_0x3a81('0xeb')]['belongsTo'](db[_0x3a81('0x28')],{'as':_0x3a81('0x28'),'foreignKey':_0x3a81('0x153')});db[_0x3a81('0xeb')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x3a81('0x155')});db[_0x3a81('0xeb')][_0x3a81('0x127')](db[_0x3a81('0x84')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x3a81('0xeb')][_0x3a81('0x127')](db[_0x3a81('0x148')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x3a81('0xeb')][_0x3a81('0x129')](db[_0x3a81('0xf8')],{'as':'Lists','through':_0x3a81('0x1df')});db[_0x3a81('0xeb')][_0x3a81('0x129')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x15b'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x3a81('0x127')](db[_0x3a81('0x17b')],{'as':_0x3a81('0x17b'),'foreignKey':_0x3a81('0x17c')});db['MailTransferReport'][_0x3a81('0x127')](db[_0x3a81('0x40')],{});db[_0x3a81('0xf2')][_0x3a81('0x127')](db[_0x3a81('0x3f')],{});db[_0x3a81('0xf2')][_0x3a81('0x127')](db[_0x3a81('0x3a')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x3a81('0xf2')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e0'),'as':'FromAgent'});db[_0x3a81('0xf2')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db[_0x3a81('0xf2')][_0x3a81('0x127')](db[_0x3a81('0x3c')],{'foreignKey':_0x3a81('0x1e3'),'as':_0x3a81('0x1e4')});db[_0x3a81('0xf2')]['belongsTo'](db[_0x3a81('0x3a')],{'foreignKey':_0x3a81('0x1e5'),'as':_0x3a81('0x1e6')});db[_0x3a81('0xf3')]['belongsTo'](db[_0x3a81('0x66')],{});db['ChatTransferReport']['belongsTo'](db[_0x3a81('0x64')],{});db[_0x3a81('0xf3')][_0x3a81('0x127')](db[_0x3a81('0x13d')],{'foreignKey':_0x3a81('0x1e7'),'as':'FromAccount'});db[_0x3a81('0xf3')]['belongsTo'](db[_0x3a81('0xf')],{'foreignKey':'FromUserId','as':_0x3a81('0x1e8')});db[_0x3a81('0xf3')][_0x3a81('0x127')](db['User'],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db[_0x3a81('0xf3')][_0x3a81('0x127')](db[_0x3a81('0x68')],{'foreignKey':_0x3a81('0x1e9'),'as':_0x3a81('0x1e4')});db['ChatTransferReport']['belongsTo'](db[_0x3a81('0x13d')],{'foreignKey':_0x3a81('0x1ea'),'as':_0x3a81('0x1e6')});db[_0x3a81('0x1eb')]['belongsTo'](db[_0x3a81('0x183')],{});db['FaxTransferReport'][_0x3a81('0x127')](db[_0x3a81('0x4d')],{});db[_0x3a81('0x1eb')][_0x3a81('0x127')](db[_0x3a81('0x4a')],{'foreignKey':_0x3a81('0x1ec'),'as':'FromAccount'});db[_0x3a81('0x1eb')]['belongsTo'](db[_0x3a81('0xf')],{'foreignKey':'FromUserId','as':_0x3a81('0x1e8')});db[_0x3a81('0x1eb')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db['FaxTransferReport'][_0x3a81('0x127')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x3a81('0x1e4')});db[_0x3a81('0x1eb')][_0x3a81('0x127')](db['FaxAccount'],{'foreignKey':_0x3a81('0x1ed'),'as':_0x3a81('0x1e6')});db[_0x3a81('0xf4')][_0x3a81('0x127')](db[_0x3a81('0x18d')],{});db['OpenchannelTransferReport'][_0x3a81('0x127')](db[_0x3a81('0x5c')],{});db[_0x3a81('0xf4')][_0x3a81('0x127')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e0'),'as':'FromAgent'});db[_0x3a81('0xf4')][_0x3a81('0x127')](db['User'],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db[_0x3a81('0xf4')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x3a81('0x1ee'),'as':_0x3a81('0x1e4')});db[_0x3a81('0xf4')][_0x3a81('0x127')](db[_0x3a81('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':_0x3a81('0x1e6')});db['SmsTransferReport'][_0x3a81('0x127')](db['SmsMessage'],{});db[_0x3a81('0xf6')][_0x3a81('0x127')](db[_0x3a81('0x54')],{});db[_0x3a81('0xf6')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x3a81('0x1ef')});db['SmsTransferReport']['belongsTo'](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e0'),'as':_0x3a81('0x1e8')});db[_0x3a81('0xf6')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db[_0x3a81('0xf6')][_0x3a81('0x127')](db[_0x3a81('0x57')],{'foreignKey':'ToSmsQueueId','as':_0x3a81('0x1e4')});db['SmsTransferReport'][_0x3a81('0x127')](db[_0x3a81('0x52')],{'foreignKey':_0x3a81('0x1f0'),'as':_0x3a81('0x1e6')});db[_0x3a81('0xf8')][_0x3a81('0x11b')](db[_0x3a81('0x81')],{'as':_0x3a81('0x16a'),'foreignKey':_0x3a81('0x16d'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0xf8')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0x3a81('0xf8')][_0x3a81('0x11b')](db['CmContact'],{'as':_0x3a81('0x12c'),'onDelete':'cascade','foreignKey':_0x3a81('0x16d')});db[_0x3a81('0xf8')][_0x3a81('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x3a81('0x16d')});db['CmList'][_0x3a81('0x11b')](db[_0x3a81('0x75')],{'as':_0x3a81('0x120'),'foreignKey':'ListId'});db[_0x3a81('0xf8')][_0x3a81('0x11b')](db[_0x3a81('0x77')],{'as':_0x3a81('0x77'),'foreignKey':_0x3a81('0x16d')});db['CmList']['belongsToMany'](db[_0x3a81('0x19')],{'as':_0x3a81('0x1f1'),'through':_0x3a81('0x1f2')});db[_0x3a81('0xf8')][_0x3a81('0x129')](db['User'],{'as':_0x3a81('0x159'),'through':'cm_user_has_lists'});db[_0x3a81('0xfa')][_0x3a81('0x11b')](db[_0x3a81('0x15')],{'as':_0x3a81('0x11d'),'onDelete':'cascade'});db[_0x3a81('0xfa')]['belongsToMany'](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':_0x3a81('0x114')});db[_0x3a81('0xfa')][_0x3a81('0x129')](db['Team'],{'through':'TeamVoicePrefix','as':_0x3a81('0x15a')});db[_0x3a81('0xfc')][_0x3a81('0x11b')](db[_0x3a81('0xf')],{'as':'Users','foreignKey':_0x3a81('0x128')});db['UserProfile']['hasMany'](db[_0x3a81('0xfe')],{'as':_0x3a81('0x1f3'),'foreignKey':_0x3a81('0x128'),'onDelete':_0x3a81('0x118')});db[_0x3a81('0xfe')][_0x3a81('0x11b')](db[_0x3a81('0x100')],{'as':_0x3a81('0x1f4'),'foreignKey':_0x3a81('0x1f5'),'onDelete':'cascade'});db[_0x3a81('0x104')]['hasMany'](db[_0x3a81('0x81')],{'as':_0x3a81('0x16a'),'foreignKey':_0x3a81('0x1f6'),'onDelete':'cascade'});db[_0x3a81('0x104')][_0x3a81('0x11b')](db['CannedAnswer'],{'as':_0x3a81('0x16b'),'foreignKey':_0x3a81('0x1f6')});db[_0x3a81('0x104')]['hasMany'](db[_0x3a81('0x1f7')],{'as':_0x3a81('0x15e'),'foreignKey':_0x3a81('0x1f6')});db[_0x3a81('0x104')][_0x3a81('0x11b')](db[_0x3a81('0x107')],{'as':_0x3a81('0x180')});db[_0x3a81('0x104')]['hasMany'](db[_0x3a81('0x1f8')],{'as':_0x3a81('0x14c')});db[_0x3a81('0x104')][_0x3a81('0x127')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x3a81('0x104')]['belongsTo'](db[_0x3a81('0x86')],{'as':_0x3a81('0x156'),'foreignKey':_0x3a81('0x157')});db['WhatsappAccount']['belongsToMany'](db[_0x3a81('0xf')],{'as':_0x3a81('0x159'),'through':'user_has_whatsapp_accounts'});db[_0x3a81('0x1f8')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x1f8')]['belongsTo'](db[_0x3a81('0x10d')],{'onDelete':'restrict'});db[_0x3a81('0x1f8')]['belongsTo'](db[_0x3a81('0x104')],{'onDelete':_0x3a81('0x167')});db[_0x3a81('0x1f8')][_0x3a81('0x127')](db[_0x3a81('0x84')],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17d')});db[_0x3a81('0x1f8')]['belongsTo'](db['Tag'],{'onDelete':_0x3a81('0x167'),'foreignKey':_0x3a81('0x17e')});db[_0x3a81('0x107')][_0x3a81('0x11b')](db[_0x3a81('0x1f7')],{'as':_0x3a81('0x15e'),'onDelete':_0x3a81('0x118'),'foreignKey':'WhatsappInteractionId'});db[_0x3a81('0x107')]['belongsTo'](db[_0x3a81('0x104')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1f6')});db[_0x3a81('0x107')][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db[_0x3a81('0x107')][_0x3a81('0x127')](db['User'],{'as':'Owner','foreignKey':_0x3a81('0x11a')});db[_0x3a81('0x107')][_0x3a81('0x129')](db[_0x3a81('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x3a81('0x175')});db[_0x3a81('0x107')]['belongsToMany'](db[_0x3a81('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x3a81('0x176')});db[_0x3a81('0x107')][_0x3a81('0x129')](db[_0x3a81('0xf')],{'as':_0x3a81('0x177'),'through':_0x3a81('0x135'),'foreignKey':'WhatsappInteractionId'});db[_0x3a81('0x1f7')][_0x3a81('0x127')](db['User'],{'as':_0x3a81('0xf')});db['WhatsappMessage'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'onDelete':'cascade','as':_0x3a81('0x164')});db[_0x3a81('0x1f7')][_0x3a81('0x127')](db[_0x3a81('0x107')],{'onDelete':_0x3a81('0x118'),'as':_0x3a81('0x179'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0x3a81('0x104')],{'as':_0x3a81('0x171'),'foreignKey':_0x3a81('0x1f6')});db['WhatsappQueueReport'][_0x3a81('0x127')](db['WhatsappAccount'],{});db[_0x3a81('0x1f9')][_0x3a81('0x127')](db[_0x3a81('0xf8')],{'as':_0x3a81('0x16c'),'foreignKey':_0x3a81('0x16d')});db['WhatsappQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x6f')],{'as':_0x3a81('0x164'),'foreignKey':_0x3a81('0x172')});db['WhatsappQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x107')],{});db['WhatsappQueueReport'][_0x3a81('0x127')](db[_0x3a81('0x10d')],{});db[_0x3a81('0x1f9')]['belongsTo'](db[_0x3a81('0x1f7')],{});db['WhatsappQueueReport'][_0x3a81('0x127')](db[_0x3a81('0xf')],{});db[_0x3a81('0x10b')][_0x3a81('0x127')](db[_0x3a81('0x1f7')],{});db[_0x3a81('0x10b')][_0x3a81('0x127')](db['WhatsappInteraction'],{});db[_0x3a81('0x10b')][_0x3a81('0x127')](db['WhatsappAccount'],{'foreignKey':_0x3a81('0x1fa'),'as':_0x3a81('0x1ef')});db[_0x3a81('0x10b')][_0x3a81('0x127')](db[_0x3a81('0x104')],{'foreignKey':_0x3a81('0x1fb'),'as':_0x3a81('0x1e6')});db[_0x3a81('0x10b')]['belongsTo'](db[_0x3a81('0x10d')],{'foreignKey':_0x3a81('0x1fc'),'as':_0x3a81('0x1e4')});db[_0x3a81('0x10b')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e0'),'as':_0x3a81('0x1e8')});db[_0x3a81('0x10b')][_0x3a81('0x127')](db[_0x3a81('0xf')],{'foreignKey':_0x3a81('0x1e1'),'as':_0x3a81('0x1e2')});db[_0x3a81('0x10d')]['belongsToMany'](db[_0x3a81('0xf')],{'as':'Agents','through':_0x3a81('0x34'),'foreignKey':'WhatsappQueueId'});db[_0x3a81('0x10d')][_0x3a81('0x129')](db[_0x3a81('0xe7')],{'through':'team_has_whatsapp_queues','as':_0x3a81('0x15a')});db['UserSetting']['belongsTo'](db[_0x3a81('0xf')],{'as':_0x3a81('0x1fd'),'foreignKey':_0x3a81('0x11a'),'onDelete':_0x3a81('0x118'),'hooks':!![]});db[_0x3a81('0x10f')][_0x3a81('0x117')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x3a81('0x167')});db[_0x3a81('0x10f')][_0x3a81('0x117')](db[_0x3a81('0x36')],{'as':_0x3a81('0x168'),'onDelete':_0x3a81('0x167')});db[_0x3a81('0x10f')]['hasOne'](db[_0x3a81('0x38')],{'as':_0x3a81('0x169'),'onDelete':'restrict'});module[_0x3a81('0x1fe')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x204f=['UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../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/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','VoiceMail','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','SmsInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Sound','Members','VoiceQueueId','Hoppers','HopperFinals','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','MailServerOut','restrict','Smtp','Disposition','Dispositions','Answers','Messages','MailApplication','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','Items','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','Owner','sms_interaction_has_tags','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','ChatQueue','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Website','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','FaxApplications','SmsApplications','CustomReportId','Mohs','moh_has_sounds','ItemType','CmHopperId','CmContactId','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','AccountId','Descriptions','DescriptionId','Subject','SubjectId','Field','FieldId','Variable','VariableId','SugarcrmField','Description','Subjects','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','team_has_chat_queues','VoicePrefix','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToUserId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','Queues','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappAccount','WhatsappApplication','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','password','options','User','import','../api/user/user.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue'];(function(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0x204f,0x1cb));var _0xf204=function(_0x1848ba,_0x2f4f33){_0x1848ba=_0x1848ba-0x0;var _0x2af2b9=_0x204f[_0x1848ba];return _0x2af2b9;};'use strict';var config=require(_0xf204('0x0'));var Sequelize=require(_0xf204('0x1'));var _=require(_0xf204('0x2'));var jstz=require(_0xf204('0x3'));var timezone=jstz[_0xf204('0x4')]();config['sequelize']=_[_0xf204('0x5')](config[_0xf204('0x1')],{'database':_0xf204('0x6'),'username':'xcall','password':_0xf204('0x7'),'options':{'host':_0xf204('0x8'),'port':0xcea,'dialect':_0xf204('0x9'),'dialectOptions':{'charset':_0xf204('0xa')},'logging':![],'timezone':timezone[_0xf204('0xb')](),'define':{'charset':_0xf204('0xc'),'collate':_0xf204('0xd')}}});config[_0xf204('0xe')]=_[_0xf204('0x5')](config[_0xf204('0xe')],{'database':_0xf204('0x6'),'username':_0xf204('0xf'),'password':_0xf204('0x7'),'options':{'host':_0xf204('0x8'),'port':0xcea,'dialect':_0xf204('0x9'),'dialectOptions':{'charset':_0xf204('0xa')},'logging':![],'timezone':timezone[_0xf204('0xb')](),'define':{'charset':'utf8','collate':_0xf204('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf204('0x1')][_0xf204('0x10')],config[_0xf204('0x1')][_0xf204('0x11')],config[_0xf204('0x1')][_0xf204('0x12')],config[_0xf204('0x1')][_0xf204('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xf204('0xe')][_0xf204('0x11')],config['sequelizeHistory']['password'],config[_0xf204('0xe')][_0xf204('0x13')])};db[_0xf204('0x14')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x16'));db['VoiceChanSpy']=db[_0xf204('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize']['import'](_0xf204('0x17'));db[_0xf204('0x18')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0xf204('0x19')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1a'));db[_0xf204('0x1b')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1c'));db['VoiceRecording']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1d'));db[_0xf204('0x1e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1f'));db['VoiceMail']=db['sequelize'][_0xf204('0x15')](_0xf204('0x20'));db[_0xf204('0x21')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x22'));db[_0xf204('0x23')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x24'));db[_0xf204('0x25')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x26'));db[_0xf204('0x27')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x28'));db[_0xf204('0x29')]=db[_0xf204('0x1')]['import'](_0xf204('0x2a'));db['MemberReport']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/trunk/trunk.model');db[_0xf204('0x2b')]=db['sequelize']['import'](_0xf204('0x2c'));db[_0xf204('0x2d')]=db['sequelize'][_0xf204('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xf204('0x2e')]=db[_0xf204('0x1')]['import'](_0xf204('0x2f'));db['UserChatQueue']=db['sequelize'][_0xf204('0x15')](_0xf204('0x30'));db[_0xf204('0x31')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xf204('0x32')]=db[_0xf204('0x1')]['import'](_0xf204('0x33'));db['UserSmsQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x34'));db[_0xf204('0x35')]=db[_0xf204('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xf204('0x36')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xf204('0x37')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x38'));db['MailServerOut']=db[_0xf204('0x1')]['import'](_0xf204('0x39'));db['MailAccount']=db['sequelize']['import'](_0xf204('0x3a'));db[_0xf204('0x3b')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3c'));db['MailSubstatus']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3d'));db[_0xf204('0x3e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3f'));db[_0xf204('0x40')]=db[_0xf204('0x1')]['import'](_0xf204('0x41'));db['MailApplication']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x42'));db[_0xf204('0x43')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x44'));db[_0xf204('0x45')]=db[_0xf204('0x1')]['import'](_0xf204('0x46'));db[_0xf204('0x47')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x48'));db['FaxAccount']=db['sequelize'][_0xf204('0x15')](_0xf204('0x49'));db[_0xf204('0x4a')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x4b'));db[_0xf204('0x4c')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x4d'));db['FaxMessage']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x4e'));db['FaxQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x4f'));db[_0xf204('0x50')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xf204('0x51')]=db[_0xf204('0x1')]['import'](_0xf204('0x52'));db[_0xf204('0x53')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x54'));db[_0xf204('0x55')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xf204('0x56')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x57'));db[_0xf204('0x58')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x59'));db[_0xf204('0x5a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x5b'));db[_0xf204('0x5c')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x5d'));db[_0xf204('0x5e')]=db[_0xf204('0x1')]['import'](_0xf204('0x5f'));db[_0xf204('0x60')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x61'));db[_0xf204('0x62')]=db[_0xf204('0x1')]['import'](_0xf204('0x63'));db[_0xf204('0x64')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x65'));db[_0xf204('0x66')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x67'));db['ChatApplication']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/chatApplication/chatApplication.model');db[_0xf204('0x68')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x69'));db[_0xf204('0x6a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x6b'));db['ChatOfflineMessage']=db['sequelize'][_0xf204('0x15')](_0xf204('0x6c'));db['ChatQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x6d'));db[_0xf204('0x6e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x6f'));db[_0xf204('0x70')]=db[_0xf204('0x1')]['import'](_0xf204('0x71'));db[_0xf204('0x72')]=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0xf204('0x73')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cmContact/cmContact.model');db[_0xf204('0x74')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x75'));db['CmHopperBlack']=db[_0xf204('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf204('0x76')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x77'));db['CmHopperHistory']=db[_0xf204('0x1')]['import'](_0xf204('0x78'));db[_0xf204('0x79')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x7a'));db['CmCustomField']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xf204('0x7b')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/action/action.model');db[_0xf204('0x7c')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/automation/automation.model');db[_0xf204('0x7d')]=db[_0xf204('0x1')]['import'](_0xf204('0x7e'));db['Disposition']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/disposition/disposition.model');db[_0xf204('0x7f')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x80'));db[_0xf204('0x81')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x82'));db[_0xf204('0x83')]=db[_0xf204('0x1')]['import']('../api/pause/pause.model');db[_0xf204('0x84')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cdr/cdr.model');db[_0xf204('0x85')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x86'));db[_0xf204('0x87')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x88'));db['Sound']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x89'));db[_0xf204('0x8a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x8b'));db[_0xf204('0x8c')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x8d'));db[_0xf204('0x8e')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x8f'));db[_0xf204('0x90')]=db[_0xf204('0x1')]['import'](_0xf204('0x91'));db[_0xf204('0x92')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x93'));db[_0xf204('0x94')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x95'));db['Variable']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x96'));db[_0xf204('0x97')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x98'));db[_0xf204('0x99')]=db['sequelize'][_0xf204('0x15')]('../api/integrationReport/integrationReport.model');db[_0xf204('0x9a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x9b'));db[_0xf204('0x9c')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf204('0x9d')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x9e'));db[_0xf204('0x9f')]=db[_0xf204('0x1')]['import'](_0xf204('0xa0'));db['AnalyticFieldReport']=db[_0xf204('0x1')]['import'](_0xf204('0xa1'));db[_0xf204('0xa2')]=db['sequelize'][_0xf204('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xf204('0xa3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xa4'));db[_0xf204('0xa5')]=db[_0xf204('0x1')]['import'](_0xf204('0xa6'));db[_0xf204('0xa7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xa8'));db[_0xf204('0xa9')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xaa'));db[_0xf204('0xab')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xac'));db['SugarcrmField']=db['sequelize'][_0xf204('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xf204('0xad')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xae'));db[_0xf204('0xaf')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xb0'));db[_0xf204('0xb1')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb2'));db[_0xf204('0xb3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb4'));db[_0xf204('0xb5')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb6'));db['ZohoField']=db['sequelize'][_0xf204('0x15')](_0xf204('0xb7'));db[_0xf204('0xb8')]=db[_0xf204('0x1')]['import'](_0xf204('0xb9'));db[_0xf204('0xba')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xbb'));db[_0xf204('0xbc')]=db[_0xf204('0x1')]['import'](_0xf204('0xbd'));db[_0xf204('0xbe')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xbf'));db[_0xf204('0xc0')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc1'));db['FreshdeskField']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc2'));db['VtigerAccount']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xf204('0xc3')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xc4'));db[_0xf204('0xc5')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xc6'));db[_0xf204('0xc7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc8'));db[_0xf204('0xc9')]=db[_0xf204('0x1')]['import'](_0xf204('0xca'));db[_0xf204('0xcb')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0xf204('0xcc')]=db[_0xf204('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xcd'));db['Dynamics365Field']=db['sequelize'][_0xf204('0x15')](_0xf204('0xce'));db['FreshsalesAccount']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf204('0xcf')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd0'));db[_0xf204('0xd1')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd2'));db[_0xf204('0x97')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x98'));db['Network']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/network/network.model');db[_0xf204('0xd3')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0xf204('0xd4')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xd5'));db[_0xf204('0xd6')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd7'));db['JscriptyQuestionReport']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xd8'));db[_0xf204('0xd9')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xf204('0xda')]=db['sequelize']['import'](_0xf204('0xdb'));db[_0xf204('0xdc')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xdd'));db[_0xf204('0xde')]=db['sequelize'][_0xf204('0x15')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xdf'));db[_0xf204('0xe0')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/setting/setting.model');db[_0xf204('0xe1')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe2'));db[_0xf204('0xe3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe4'));db[_0xf204('0xe5')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xe6'));db[_0xf204('0xe7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe8'));db[_0xf204('0xe9')]=db[_0xf204('0x1')]['import'](_0xf204('0xea'));db[_0xf204('0xeb')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xec'));db[_0xf204('0xed')]=db[_0xf204('0x1')]['import'](_0xf204('0xee'));db['Migration']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xef'));db['Attachment']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf0'));db[_0xf204('0xf1')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xf2'));db[_0xf204('0xf3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf4'));db[_0xf204('0xf5')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf6'));db[_0xf204('0xf7')]=db[_0xf204('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xf204('0xf8')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xf204('0xf9')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xfa'));db[_0xf204('0xfb')]=db['sequelize'][_0xf204('0x15')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xfc'));db[_0xf204('0xfd')]=db[_0xf204('0x1')]['import'](_0xf204('0xfe'));db['UserProfileSection']=db[_0xf204('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0xf204('0xff')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xf204('0x100')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x101'));db['WhatsappAccount']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x102'));db['WhatsappApplication']=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0xf204('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xf204('0x103')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x104'));db[_0xf204('0x105')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x106'));db['WhatsappTransferReport']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x107'));db[_0xf204('0x108')]=db[_0xf204('0x1')]['import'](_0xf204('0x109'));db['CloudProvider']=db['sequelize'][_0xf204('0x15')](_0xf204('0x10a'));db[_0xf204('0x10b')]=db['sequelize']['import'](_0xf204('0x10c'));db[_0xf204('0x10d')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x10e'));db[_0xf204('0x10f')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xf204('0x110')]=db['sequelize'][_0xf204('0x15')]('../api/user-setting/user-setting.model');db[_0xf204('0x14')][_0xf204('0x111')](db[_0xf204('0x112')],{'as':'VoiceMail','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x111')](db[_0xf204('0x110')],{'as':_0xf204('0x115'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')]['hasMany'](db['VoiceRecording'],{'as':_0xf204('0x116'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x2d')],{'as':_0xf204('0x118'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db['VoiceExtension'],{'as':_0xf204('0x119'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':'HopperFinals','foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':_0xf204('0x11b'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'ChatInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x55')],{'as':_0xf204('0x11c'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x4c')],{'as':_0xf204('0x11d'),'foreignKey':'UserId'});db[_0xf204('0x14')]['hasMany'](db[_0xf204('0x3e')],{'as':'MailInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x11e')],{'as':_0xf204('0x11f'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x100')],{'as':_0xf204('0x120'),'foreignKey':'SenderId'});db[_0xf204('0x14')][_0xf204('0x121')](db['UserProfile'],{'as':_0xf204('0xfd'),'foreignKey':_0xf204('0x122')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x6e')],{'as':_0xf204('0x124'),'through':_0xf204('0x125')});db[_0xf204('0x14')][_0xf204('0x123')](db['CmContact'],{'as':_0xf204('0x126'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xf204('0xfb')],{'as':'Lists','through':_0xf204('0x127')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x128')});db['User'][_0xf204('0x123')](db[_0xf204('0x3e')],{'as':_0xf204('0x129'),'through':_0xf204('0x12a')});db['User']['belongsToMany'](db[_0xf204('0x68')],{'as':_0xf204('0x12b'),'through':_0xf204('0x12c')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x4c')],{'as':'FaxInteractions','through':_0xf204('0x12d')});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x55')],{'as':'SmsInteractions','through':_0xf204('0x12e')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x5e')],{'as':_0xf204('0x12f'),'through':'user_has_openchannel_interactions'});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x11e')],{'as':_0xf204('0x11f'),'through':'user_has_whatsapp_interactions'});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x1b')],{'as':'VoiceQueues','through':_0xf204('0x2e'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db['VoicePrefix'],{'as':_0xf204('0x130'),'through':_0xf204('0x10f'),'required':![]});db[_0xf204('0x14')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xf204('0x14')]['belongsToMany'](db['ChatQueue'],{'as':_0xf204('0x131'),'through':_0xf204('0x132'),'required':![],'hooks':!![]});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x133')],{'as':_0xf204('0x134'),'through':_0xf204('0x32'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x58')],{'as':_0xf204('0x135'),'through':'UserSmsQueue','required':![]});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x62')],{'as':_0xf204('0x136'),'through':_0xf204('0x35'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x108')],{'as':_0xf204('0x137'),'through':_0xf204('0x36'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0xfb')],{'through':'cm_user_has_lists'});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x64')],{'as':_0xf204('0x138'),'through':'user_has_chat_websites'});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x139')],{'as':_0xf204('0x13a'),'through':_0xf204('0x13b')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x13c')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User'][_0xf204('0x123')](db[_0xf204('0x5a')],{'as':_0xf204('0x13d'),'through':_0xf204('0x13e')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x51')],{'as':_0xf204('0x13f'),'through':_0xf204('0x140')});db[_0xf204('0x14')][_0xf204('0x123')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xf204('0x141')});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0xe3')],{'as':_0xf204('0x142'),'through':_0xf204('0x143')});db[_0xf204('0x144')]['hasMany'](db['VoiceExtension'],{'as':_0xf204('0x145'),'onDelete':'cascade','foreignKey':_0xf204('0x146')});db[_0xf204('0x147')]['hasMany'](db[_0xf204('0x18')],{'onDelete':_0xf204('0x113')});db[_0xf204('0x18')]['hasMany'](db[_0xf204('0x18')],{'as':'Applications','onDelete':_0xf204('0x113')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xf204('0x148')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x2d')],{'as':_0xf204('0x149'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x74')],{'as':_0xf204('0x14b'),'foreignKey':_0xf204('0x14a')});db['VoiceQueue'][_0xf204('0x117')](db['CmHopperFinal'],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':'HopperHistories','foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')]['hasMany'](db[_0xf204('0x14d')],{'as':_0xf204('0x14e'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')]['hasMany'](db[_0xf204('0xd9')],{'as':_0xf204('0x14f'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x121')](db[_0xf204('0x150')],{'as':_0xf204('0x150'),'foreignKey':_0xf204('0x151')});db[_0xf204('0x1b')]['belongsTo'](db[_0xf204('0x150')],{'as':_0xf204('0x152'),'foreignKey':_0xf204('0x153')});db[_0xf204('0x1b')]['belongsTo'](db['Interval'],{'as':_0xf204('0x81'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x1b')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf204('0x1b')]['belongsToMany'](db[_0xf204('0xfb')],{'as':_0xf204('0x156'),'through':_0xf204('0x157')});db[_0xf204('0x1b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0xf204('0x123')](db[_0xf204('0xe9')],{'as':_0xf204('0x159'),'through':_0xf204('0x10b')});db[_0xf204('0x1b')]['belongsToMany'](db[_0xf204('0xfb')],{'as':_0xf204('0x15a'),'through':_0xf204('0x15b')});db[_0xf204('0x15c')]['belongsTo'](db[_0xf204('0x14')],{'as':_0xf204('0x14'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x1e')]['belongsTo'](db[_0xf204('0x14')],{'as':'User','foreignKey':_0xf204('0x114')});db[_0xf204('0x112')]['hasMany'](db[_0xf204('0x21')],{'as':'Messages','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x15d'),'sourceKey':_0xf204('0x15e')});db[_0xf204('0x21')][_0xf204('0x121')](db[_0xf204('0x112')],{'foreignKey':_0xf204('0x15d'),'targetKey':_0xf204('0x15e')});db[_0xf204('0x23')][_0xf204('0x117')](db[_0xf204('0x29')],{'as':_0xf204('0x15f'),'foreignKey':_0xf204('0x160'),'constraints':![]});db[_0xf204('0x23')][_0xf204('0x117')](db[_0xf204('0x27')],{'as':_0xf204('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0xf204('0x23')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xf204('0x23')]['belongsTo'](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x37')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x37')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':'CloudProvider','foreignKey':_0xf204('0x166'),'onDelete':'restrict'});db[_0xf204('0x167')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':'MailAccountId'});db[_0xf204('0x167')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':'CloudProvider','foreignKey':_0xf204('0x166'),'onDelete':_0xf204('0x168')});db[_0xf204('0x13c')][_0xf204('0x111')](db[_0xf204('0x37')],{'as':'Imap','onDelete':'cascade'});db[_0xf204('0x13c')][_0xf204('0x111')](db[_0xf204('0x167')],{'as':_0xf204('0x169'),'onDelete':_0xf204('0x113')});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x164'),'onDelete':'cascade'});db[_0xf204('0x13c')][_0xf204('0x117')](db['CannedAnswer'],{'as':_0xf204('0x16c'),'foreignKey':'MailAccountId'});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x40')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x3e')],{'as':'Interactions'});db['MailAccount'][_0xf204('0x117')](db[_0xf204('0x16e')],{'as':_0xf204('0x16f')});db['MailAccount'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x13c')][_0xf204('0x121')](db[_0xf204('0x92')],{'as':_0xf204('0x92'),'foreignKey':_0xf204('0x172')});db['MailAccount'][_0xf204('0x121')](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x13c')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x174')});db[_0xf204('0x3b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':'UserMailQueue'});db[_0xf204('0x3b')][_0xf204('0x123')](db['Team'],{'through':'team_has_mail_queues','as':_0xf204('0x159')});db[_0xf204('0x3e')][_0xf204('0x117')](db[_0xf204('0x40')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x175')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x3e')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0xf204('0x3e')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x114')});db[_0xf204('0x3e')][_0xf204('0x123')](db['Tag'],{'through':_0xf204('0x177'),'as':_0xf204('0x178')});db[_0xf204('0x3e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':'mail_interaction_has_tags','as':_0xf204('0x179')});db[_0xf204('0x3e')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x12a'),'foreignKey':_0xf204('0x175')});db['MailMessage']['hasMany'](db[_0xf204('0x17b')],{'as':_0xf204('0x17c'),'onDelete':_0xf204('0x113')});db['MailMessage'][_0xf204('0x121')](db['User'],{'as':_0xf204('0x14')});db[_0xf204('0x40')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xf204('0x162')});db['MailMessage'][_0xf204('0x121')](db['MailInteraction'],{'as':_0xf204('0x17d'),'foreignKey':'MailInteractionId'});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':'Account','foreignKey':_0xf204('0x164')});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x64'),'foreignKey':_0xf204('0x17e')});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0xf204('0x180')});db[_0xf204('0x16e')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x16e')][_0xf204('0x121')](db[_0xf204('0x3b')],{'onDelete':'restrict'});db[_0xf204('0x16e')][_0xf204('0x121')](db[_0xf204('0x13c')],{'onDelete':'restrict'});db[_0xf204('0x16e')][_0xf204('0x121')](db['Interval'],{'onDelete':_0xf204('0x168'),'foreignKey':'IntervalId'});db['MailApplication'][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db['MailQueueReport'][_0xf204('0x121')](db['MailAccount'],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x3e')],{});db['MailQueueReport']['belongsTo'](db[_0xf204('0x40')],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x3b')],{});db[_0xf204('0x45')][_0xf204('0x117')](db[_0xf204('0x47')],{'as':_0xf204('0x182'),'onDelete':'cascade'});db['FaxAccount'][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':'FaxAccountId','onDelete':_0xf204('0x113')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':_0xf204('0x183')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x4c')],{'as':_0xf204('0x184')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x4a')],{'as':'Applications'});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x185'),'onDelete':'cascade'});db['FaxAccount'][_0xf204('0x117')](db[_0xf204('0x186')],{'as':_0xf204('0x16d')});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0x150')],{'as':'Trunk'});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x139')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x13b')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x133')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x139')],{'onDelete':_0xf204('0x168')});db['FaxApplication'][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x181')});db[_0xf204('0x4c')]['hasMany'](db[_0xf204('0x186')],{'as':_0xf204('0x16d'),'onDelete':'cascade','foreignKey':_0xf204('0x187')});db[_0xf204('0x4c')]['belongsTo'](db[_0xf204('0x139')],{'as':_0xf204('0x176'),'foreignKey':'FaxAccountId'});db[_0xf204('0x4c')][_0xf204('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0x4c')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x114')});db[_0xf204('0x4c')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x188'),'as':_0xf204('0x178')});db[_0xf204('0x4c')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x188'),'as':_0xf204('0x179')});db[_0xf204('0x4c')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x12d'),'foreignKey':_0xf204('0x187')});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x14')});db[_0xf204('0x186')][_0xf204('0x121')](db[_0xf204('0x4c')],{'as':_0xf204('0x17d'),'foreignKey':_0xf204('0x187')});db[_0xf204('0x186')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':'Contact'});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x17b')],{'as':_0xf204('0x17b'),'foreignKey':_0xf204('0x189')});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x139')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x32')});db[_0xf204('0x133')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_fax_queues','as':_0xf204('0x159')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x139')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x4c')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x186')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x133')],{});db[_0xf204('0x51')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':'Dispositions','foreignKey':_0xf204('0x18a'),'onDelete':'cascade'});db[_0xf204('0x51')]['hasMany'](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':_0xf204('0x18a')});db['SmsAccount'][_0xf204('0x117')](db[_0xf204('0x56')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x18a')});db['SmsAccount'][_0xf204('0x117')](db[_0xf204('0x55')],{'as':_0xf204('0x184')});db[_0xf204('0x51')]['hasMany'](db['SmsApplication'],{'as':_0xf204('0x16f')});db['SmsAccount']['belongsTo'](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x51')][_0xf204('0x121')](db[_0xf204('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xf204('0x173')});db['SmsAccount'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x140')});db[_0xf204('0x53')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'restrict'});db[_0xf204('0x53')][_0xf204('0x121')](db[_0xf204('0x58')],{'onDelete':'restrict'});db['SmsApplication'][_0xf204('0x121')](db[_0xf204('0x51')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x53')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':'restrict','foreignKey':_0xf204('0x154')});db[_0xf204('0x53')][_0xf204('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db[_0xf204('0x55')][_0xf204('0x117')](db[_0xf204('0x56')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':'SmsInteractionId'});db[_0xf204('0x55')][_0xf204('0x121')](db[_0xf204('0x51')],{'as':_0xf204('0x176'),'foreignKey':'SmsAccountId'});db[_0xf204('0x55')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':'ContactId'});db[_0xf204('0x55')][_0xf204('0x121')](db['User'],{'as':_0xf204('0x18b'),'foreignKey':'UserId'});db[_0xf204('0x55')][_0xf204('0x123')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xf204('0x178')});db[_0xf204('0x55')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x18c'),'as':_0xf204('0x179')});db[_0xf204('0x55')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x12e'),'foreignKey':_0xf204('0x18d')});db['SmsMessage'][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x14')});db[_0xf204('0x56')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162')});db[_0xf204('0x56')][_0xf204('0x121')](db[_0xf204('0x55')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x17d'),'foreignKey':_0xf204('0x18d')});db[_0xf204('0x56')][_0xf204('0x121')](db['SmsAccount'],{'as':_0xf204('0x176'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0xf204('0x14')],{'as':'Agents','through':_0xf204('0x18e'),'foreignKey':_0xf204('0x18f')});db[_0xf204('0x58')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x190'),'as':_0xf204('0x159')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x191'),'onDelete':_0xf204('0x113')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':_0xf204('0x16c'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x5e')],{'as':_0xf204('0x184'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x60')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xf204('0x121')](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':'ListId'});db[_0xf204('0x5a')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x5a')]['belongsToMany'](db['User'],{'as':_0xf204('0x158'),'through':_0xf204('0x13e')});db[_0xf204('0x5c')][_0xf204('0x121')](db['User'],{'onDelete':_0xf204('0x168')});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x62')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xf204('0x121')](db[_0xf204('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':'restrict','foreignKey':_0xf204('0x154')});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0xf204('0x117')](db[_0xf204('0x60')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x192')});db[_0xf204('0x5e')][_0xf204('0x121')](db[_0xf204('0x5a')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5e')]['belongsTo'](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db['OpenchannelInteraction']['belongsTo'](db['User'],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x5e')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x193'),'as':_0xf204('0x178')});db[_0xf204('0x5e')][_0xf204('0x123')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xf204('0x179')});db['OpenchannelInteraction'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x194'),'foreignKey':_0xf204('0x192')});db[_0xf204('0x60')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x14')});db[_0xf204('0x60')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162')});db[_0xf204('0x60')][_0xf204('0x121')](db['OpenchannelInteraction'],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x192')});db[_0xf204('0x60')]['belongsTo'](db[_0xf204('0x17b')],{'as':_0xf204('0x17b'),'foreignKey':'AttachmentId'});db[_0xf204('0x60')][_0xf204('0x121')](db['OpenchannelAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x62')]['belongsToMany'](db['User'],{'as':_0xf204('0x158'),'through':_0xf204('0x35'),'foreignKey':_0xf204('0x195')});db[_0xf204('0x62')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x196'),'as':_0xf204('0x159')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x17e'),'onDelete':_0xf204('0x113')});db[_0xf204('0x64')][_0xf204('0x117')](db['CannedAnswer'],{'as':_0xf204('0x16c'),'foreignKey':_0xf204('0x17e')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x70')],{'as':_0xf204('0x197')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'Interactions'});db['ChatWebsite'][_0xf204('0x117')](db[_0xf204('0x198')],{'as':'Applications'});db['ChatWebsite'][_0xf204('0x117')](db['ChatMessage'],{'as':_0xf204('0x16d')});db[_0xf204('0x64')][_0xf204('0x121')](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db['ChatWebsite'][_0xf204('0x121')](db[_0xf204('0x81')],{'as':_0xf204('0x81'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x64')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x64')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x64')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xf204('0x199')});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0x5a')],{});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':'ListId'});db[_0xf204('0x66')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x66')][_0xf204('0x121')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x66')][_0xf204('0x121')](db[_0xf204('0x62')],{});db['ChatApplication'][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x19a'),'foreignKey':_0xf204('0x114'),'onDelete':_0xf204('0x168')});db['ChatApplication'][_0xf204('0x121')](db[_0xf204('0x19b')],{'as':_0xf204('0x19c'),'foreignKey':_0xf204('0x19d'),'onDelete':'restrict'});db[_0xf204('0x198')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':'Website','foreignKey':_0xf204('0x17e'),'onDelete':_0xf204('0x168')});db[_0xf204('0x198')][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db['ChatInteraction'][_0xf204('0x117')](db['ChatMessage'],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x19e')});db['ChatInteraction'][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x176'),'foreignKey':'ChatWebsiteId'});db[_0xf204('0x68')][_0xf204('0x121')](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x68')][_0xf204('0x121')](db['User'],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x68')][_0xf204('0x123')](db['Tag'],{'through':_0xf204('0x19f'),'as':_0xf204('0x178')});db[_0xf204('0x68')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x19f'),'as':_0xf204('0x179')});db[_0xf204('0x68')]['belongsToMany'](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x12c'),'foreignKey':_0xf204('0x19e')});db[_0xf204('0x6a')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'cascade','as':_0xf204('0x14')});db['ChatMessage'][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162'),'foreignKey':'ContactId'});db['ChatMessage'][_0xf204('0x121')](db[_0xf204('0x68')],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x19e')});db[_0xf204('0x6a')][_0xf204('0x121')](db[_0xf204('0x17b')],{'as':'Attachment','foreignKey':_0xf204('0x189')});db[_0xf204('0x6a')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x17e')});db['ChatOfflineMessage'][_0xf204('0x117')](db[_0xf204('0x17b')],{'as':'Attachments','foreignKey':_0xf204('0x180'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x17f')][_0xf204('0x121')](db['CmContact'],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x17f')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':'Account','foreignKey':_0xf204('0x17e')});db[_0xf204('0x19b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x132'),'hooks':!![]});db['ChatQueue'][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_chat_queues','as':_0xf204('0x159')});db[_0xf204('0x6e')]['hasMany'](db[_0xf204('0xd4')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x1a0'),'onDelete':_0xf204('0x113')});db[_0xf204('0x6e')]['belongsToMany'](db[_0xf204('0x14')],{'as':_0xf204('0x149'),'through':_0xf204('0x125')});db[_0xf204('0x70')]['belongsTo'](db[_0xf204('0x64')],{'as':_0xf204('0x1a1'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xf204('0x117')](db['CmContact'],{'as':_0xf204('0x126'),'foreignKey':_0xf204('0x1a2')});db[_0xf204('0x73')][_0xf204('0x117')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0xf204('0x14b'),'foreignKey':'ContactId'});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':'HopperHistories','foreignKey':_0xf204('0x163')});db['CmContact'][_0xf204('0x117')](db[_0xf204('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xf204('0x163')});db[_0xf204('0x73')]['hasMany'](db['JscriptySessionReport'],{'as':_0xf204('0x14f'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x73')]['hasMany'](db[_0xf204('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0xf204('0x163'),'onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db['SmsInteraction'],{'as':_0xf204('0x11c'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db['FaxInteraction'],{'as':_0xf204('0x11d'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')]['hasMany'](db[_0xf204('0x3e')],{'as':_0xf204('0x129'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db['CmContact'][_0xf204('0x121')](db[_0xf204('0x72')],{'as':'Company','foreignKey':_0xf204('0x1a2')});db['CmContact'][_0xf204('0x121')](db['CmList'],{'as':'List','foreignKey':_0xf204('0x171'),'onDelete':'cascade'});db[_0xf204('0x73')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':'cm_user_has_contacts'});db[_0xf204('0x73')][_0xf204('0x123')](db[_0xf204('0x8a')],{'as':_0xf204('0x178'),'through':_0xf204('0x1a3')});db[_0xf204('0x73')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x1a3'),'as':'ThroughTags'});db[_0xf204('0x74')][_0xf204('0x117')](db[_0xf204('0x90')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xf204('0x74')][_0xf204('0x121')](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0x74')]['belongsTo'](db[_0xf204('0x14')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0xf204('0x121')](db[_0xf204('0x1b')],{'as':_0xf204('0x19c'),'foreignKey':_0xf204('0x14a'),'onDelete':_0xf204('0x113')});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0xed')],{'as':_0xf204('0xed'),'foreignKey':_0xf204('0x1a4'),'onDelete':'cascade'});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x1a5')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':'ContactId','onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db['CmList'],{'as':'List','foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0x1b')],{'as':'Queue','foreignKey':_0xf204('0x14a'),'onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0xed')],{'as':_0xf204('0xed'),'foreignKey':_0xf204('0x1a4'),'onDelete':_0xf204('0x113')});db[_0xf204('0x7c')][_0xf204('0x117')](db[_0xf204('0x7f')],{'as':{'plural':_0xf204('0x1a6'),'singular':_0xf204('0x1a7')},'foreignKey':_0xf204('0x1a8'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x7c')][_0xf204('0x117')](db[_0xf204('0x7f')],{'as':{'plural':_0xf204('0x1a9'),'singular':_0xf204('0x1aa')},'foreignKey':_0xf204('0x1ab'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x7c')]['hasMany'](db[_0xf204('0x7b')],{'as':_0xf204('0x1ac'),'foreignKey':'AutomationId','onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x16a')][_0xf204('0x117')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf204('0x1ad'),'onDelete':'cascade'});db['Interval'][_0xf204('0x117')](db[_0xf204('0x81')],{'as':_0xf204('0x1ae'),'foreignKey':_0xf204('0x154'),'onDelete':_0xf204('0x113'),'hooks':!![],'required':![]});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x119'),'foreignKey':_0xf204('0x154'),'onDelete':'restrict'});db[_0xf204('0x81')]['hasMany'](db[_0xf204('0x16e')],{'as':'MailApplications','foreignKey':_0xf204('0x154')});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x198')],{'as':'ChatApplications','foreignKey':_0xf204('0x154')});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x4a')],{'as':_0xf204('0x1af'),'foreignKey':'IntervalId'});db[_0xf204('0x81')]['hasMany'](db[_0xf204('0x53')],{'as':_0xf204('0x1b0'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x87')][_0xf204('0x121')](db[_0xf204('0x13c')],{});db[_0xf204('0x87')][_0xf204('0x121')](db[_0xf204('0x9c')],{'foreignKey':'DefaultReportId'});db[_0xf204('0x87')][_0xf204('0x121')](db['AnalyticCustomReport'],{'foreignKey':_0xf204('0x1b1')});db['Sound'][_0xf204('0x123')](db[_0xf204('0x19')],{'as':_0xf204('0x1b2'),'through':_0xf204('0x1b3'),'onDelete':_0xf204('0x168')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x73')],{'through':_0xf204('0x1a3')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x68')],{'through':_0xf204('0x19f')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x3e')],{'through':_0xf204('0x177')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x55')],{'through':'sms_interaction_has_tags'});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x4c')],{'through':_0xf204('0x188')});db[_0xf204('0x8a')]['belongsToMany'](db[_0xf204('0x5e')],{'through':_0xf204('0x193')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x11e')],{'through':'whatsapp_interaction_has_tags'});db[_0xf204('0x8e')]['belongsTo'](db[_0xf204('0x8c')],{'as':_0xf204('0x1b4'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xf204('0x121')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xf204('0x1b5')});db[_0xf204('0x8e')]['belongsTo'](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x1b6')});db[_0xf204('0x94')][_0xf204('0x117')](db['Condition'],{'as':{'plural':_0xf204('0x1b7'),'singular':_0xf204('0x1b8')},'foreignKey':_0xf204('0x1b9'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x94')][_0xf204('0x117')](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xf204('0x1ba'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x94')][_0xf204('0x117')](db['Action'],{'as':_0xf204('0x1ac'),'foreignKey':_0xf204('0x1bb'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x9a')][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1b1'),'hooks':!![]});db['AnalyticDefaultReport'][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1be')});db['AnalyticMetric'][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':'Fields','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1bf')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xf204('0x1bf')});db['SalesforceAccount']['hasMany'](db[_0xf204('0xa5')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xa5')][_0xf204('0x117')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xf204('0x113'),'foreignKey':'SubjectId'});db[_0xf204('0xa5')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1c2'),'onDelete':'cascade','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xa5')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':'FieldId'});db[_0xf204('0xa5')][_0xf204('0x121')](db['SalesforceAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xa7')][_0xf204('0x117')](db['SalesforceField'],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xa7')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf204('0xa7')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0xa7')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['SugarcrmAccount'][_0xf204('0x117')](db[_0xf204('0xab')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xab')][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':'Subjects','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xab')][_0xf204('0x117')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1bd'),'onDelete':'cascade','foreignKey':_0xf204('0x1c7')});db[_0xf204('0xab')][_0xf204('0x121')](db[_0xf204('0xa9')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1ca')][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1ca')][_0xf204('0x117')](db['SugarcrmField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db['SugarcrmField'][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1ca')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xad')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xaf')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db['DeskConfiguration'][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xaf')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0xf204('0x121')](db[_0xf204('0xad')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xaf')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':'int_desk_configuration_has_tags'});db[_0xf204('0xb1')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':'Subject','foreignKey':_0xf204('0x1c5')});db['DeskField'][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xb1')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0xb1')][_0xf204('0x121')](db['Variable'],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['ZohoAccount'][_0xf204('0x117')](db[_0xf204('0xb5')],{'as':_0xf204('0x1c0'),'onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xb5')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db['ZohoConfiguration'][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db[_0xf204('0xb5')][_0xf204('0x117')](db['ZohoField'],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db['ZohoConfiguration'][_0xf204('0x121')](db[_0xf204('0xb3')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1cd')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0x1cd')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db['ZohoField']['hasMany'](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ZohoField'][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xb8')][_0xf204('0x117')](db[_0xf204('0xba')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1c2'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1bd'),'foreignKey':_0xf204('0x1c7')});db['ZendeskConfiguration'][_0xf204('0x121')](db['ZendeskAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xba')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1ce')});db['ZendeskField']['hasMany'](db[_0xf204('0xbc')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xbc')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf204('0xbc')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ZendeskField']['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':'VariableId'});db[_0xf204('0xbe')][_0xf204('0x117')](db['FreshdeskConfiguration'],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':'AccountId'});db[_0xf204('0xc0')]['hasMany'](db[_0xf204('0x1cf')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':'SubjectId'});db[_0xf204('0xc0')]['hasMany'](db[_0xf204('0x1cf')],{'as':_0xf204('0x1c2'),'onDelete':'cascade','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db['FreshdeskConfiguration']['belongsTo'](db[_0xf204('0xbe')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc0')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x1d0')});db[_0xf204('0x1cf')][_0xf204('0x117')](db[_0xf204('0x1cf')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1cf')][_0xf204('0x117')](db[_0xf204('0x1cf')],{'as':'Description','foreignKey':_0xf204('0x1c3')});db['FreshdeskField']['hasMany'](db[_0xf204('0x1cf')],{'as':'Field','foreignKey':'FieldId'});db[_0xf204('0x1cf')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['VtigerAccount'][_0xf204('0x117')](db[_0xf204('0xc3')],{'as':_0xf204('0x1c0'),'onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc3')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':_0xf204('0x1cc'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Descriptions','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc3')]['hasMany'](db[_0xf204('0xc5')],{'as':_0xf204('0x1bd'),'foreignKey':'FieldId'});db[_0xf204('0xc3')][_0xf204('0x121')](db[_0xf204('0x1d1')],{'as':_0xf204('0x176'),'foreignKey':'AccountId'});db[_0xf204('0xc5')][_0xf204('0x117')](db['VtigerField'],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xc5')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Description','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc5')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Field','foreignKey':_0xf204('0x1c7')});db[_0xf204('0xc5')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xc7')][_0xf204('0x117')](db[_0xf204('0xc9')],{'as':'Configurations','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc9')][_0xf204('0x117')](db['ServicenowField'],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db['ServicenowConfiguration'][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':'Descriptions','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc9')][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf204('0xc9')][_0xf204('0x121')](db[_0xf204('0xc7')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db['ServicenowField'][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0xcb')][_0xf204('0x117')](db['ServicenowField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xcb')][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ServicenowField'][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xcc')][_0xf204('0x117')](db[_0xf204('0x1d2')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xcc')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':_0xf204('0x165'),'foreignKey':_0xf204('0x166')});db['Dynamics365Configuration'][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1cc'),'onDelete':'cascade','foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1d2')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db[_0xf204('0x1d2')]['hasMany'](db[_0xf204('0x1d3')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1d2')][_0xf204('0x121')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1d3')]['hasMany'](db['Dynamics365Field'],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0x1d3')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0x1d3')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1d3')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['FreshsalesAccount'][_0xf204('0x117')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xcf')][_0xf204('0x117')](db[_0xf204('0xd1')],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xcf')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c2'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xcf')][_0xf204('0x117')](db[_0xf204('0xd1')],{'as':_0xf204('0x1bd'),'foreignKey':_0xf204('0x1c7')});db['FreshsalesConfiguration'][_0xf204('0x121')](db[_0xf204('0x1d4')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xd1')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xd1')][_0xf204('0x117')](db['FreshsalesField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xd1')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c6'),'foreignKey':'FieldId'});db[_0xf204('0xd1')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':'Variable','foreignKey':_0xf204('0x1c9')});db[_0xf204('0xd3')][_0xf204('0x121')](db['ChatWebsite'],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':'List','foreignKey':_0xf204('0x171')});db[_0xf204('0xd3')][_0xf204('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0xd3')]['belongsTo'](db[_0xf204('0x68')],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0x6a')],{});db[_0xf204('0xd3')][_0xf204('0x121')](db['User'],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0x19b')],{});db[_0xf204('0xd4')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1d5')});db[_0xf204('0xd4')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1d6')});db[_0xf204('0xd9')][_0xf204('0x117')](db[_0xf204('0x1d7')],{'foreignKey':_0xf204('0x1d8'),'onDelete':_0xf204('0x113')});db[_0xf204('0xd9')][_0xf204('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xf204('0x1d8'),'onDelete':_0xf204('0x113')});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x51')],{});db[_0xf204('0xda')]['belongsTo'](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0xda')][_0xf204('0x121')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xf204('0x121')](db[_0xf204('0x56')],{});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x14')],{});db['SmsQueueReport']['belongsTo'](db[_0xf204('0x58')],{});db[_0xf204('0x1d9')][_0xf204('0x117')](db[_0xf204('0xd9')],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0x1d9')][_0xf204('0x117')](db[_0xf204('0x1d7')],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0x1d9')][_0xf204('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0xe3')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x143')});db[_0xf204('0xe9')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x128')});db['Team'][_0xf204('0x123')](db[_0xf204('0x1b')],{'through':_0xf204('0x10b'),'as':_0xf204('0x1db')});db['Team'][_0xf204('0x123')](db[_0xf204('0x3b')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xf204('0xe9')][_0xf204('0x123')](db[_0xf204('0x19b')],{'through':_0xf204('0x1dc'),'as':_0xf204('0x131')});db[_0xf204('0xe9')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xf204('0x134')});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x58')],{'through':_0xf204('0x190'),'as':'SmsQueues'});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x62')],{'through':'team_has_openchannel_queues','as':_0xf204('0x136')});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x108')],{'through':'team_has_whatsapp_queues','as':_0xf204('0x137')});db['Team'][_0xf204('0x123')](db[_0xf204('0x1dd')],{'through':'TeamVoicePrefix','as':_0xf204('0x130')});db['Campaign'][_0xf204('0x117')](db[_0xf204('0x74')],{'as':'Hoppers','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')]['hasMany'](db[_0xf204('0x76')],{'as':'HopperFinals','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')][_0xf204('0x117')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')][_0xf204('0x117')](db[_0xf204('0x14d')],{'as':_0xf204('0x14e'),'foreignKey':_0xf204('0x1a4')});db['Campaign']['belongsTo'](db[_0xf204('0x150')],{'as':'Trunk','foreignKey':_0xf204('0x151')});db[_0xf204('0xed')][_0xf204('0x121')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xf204('0x153')});db[_0xf204('0xed')][_0xf204('0x121')](db[_0xf204('0x81')],{'as':'Interval','foreignKey':_0xf204('0x154')});db[_0xf204('0xed')][_0xf204('0x121')](db[_0xf204('0xe3')],{'as':_0xf204('0xe3'),'foreignKey':_0xf204('0x1de')});db[_0xf204('0xed')][_0xf204('0x123')](db['CmList'],{'as':_0xf204('0x156'),'through':'campaigns_has_cm_lists'});db[_0xf204('0xed')][_0xf204('0x123')](db[_0xf204('0xfb')],{'as':_0xf204('0x15a'),'through':'campaigns_has_cm_blacklists'});db[_0xf204('0x17b')]['belongsTo'](db[_0xf204('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0xf204('0x180')});db[_0xf204('0xf3')]['belongsTo'](db[_0xf204('0x40')],{});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x3e')],{});db[_0xf204('0xf3')]['belongsTo'](db[_0xf204('0x13c')],{'foreignKey':_0xf204('0x1df'),'as':_0xf204('0x1e0')});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db['MailTransferReport'][_0xf204('0x121')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x3b')],{'foreignKey':_0xf204('0x1e3'),'as':_0xf204('0x1e4')});db[_0xf204('0xf3')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xf204('0x1e5'),'as':_0xf204('0x1e6')});db[_0xf204('0xf5')][_0xf204('0x121')](db['ChatMessage'],{});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x68')],{});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0xf204('0x1e0')});db['ChatTransferReport'][_0xf204('0x121')](db['User'],{'foreignKey':_0xf204('0x1e1'),'as':'FromAgent'});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':'ToUserId','as':_0xf204('0x1e7')});db[_0xf204('0xf5')]['belongsTo'](db[_0xf204('0x19b')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xf204('0xf5')]['belongsTo'](db[_0xf204('0x64')],{'foreignKey':_0xf204('0x1e8'),'as':_0xf204('0x1e6')});db['FaxTransferReport'][_0xf204('0x121')](db[_0xf204('0x186')],{});db['FaxTransferReport']['belongsTo'](db[_0xf204('0x4c')],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0xf204('0x1e9'),'as':_0xf204('0x1e0')});db[_0xf204('0xf7')][_0xf204('0x121')](db['User'],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0xf7')]['belongsTo'](db[_0xf204('0x14')],{'foreignKey':'ToUserId','as':_0xf204('0x1e7')});db['FaxTransferReport']['belongsTo'](db[_0xf204('0x133')],{'foreignKey':_0xf204('0x1ea'),'as':'ToQueue'});db['FaxTransferReport'][_0xf204('0x121')](db[_0xf204('0x139')],{'foreignKey':_0xf204('0x1eb'),'as':_0xf204('0x1e6')});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelMessage'],{});db[_0xf204('0xf8')]['belongsTo'](db[_0xf204('0x5e')],{});db['OpenchannelTransferReport'][_0xf204('0x121')](db[_0xf204('0x5a')],{'foreignKey':_0xf204('0x1ec'),'as':'FromAccount'});db[_0xf204('0xf8')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':'FromAgent'});db[_0xf204('0xf8')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':'ToAgent'});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelQueue'],{'foreignKey':_0xf204('0x1ee'),'as':'ToQueue'});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x56')],{});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x55')],{});db['SmsTransferReport'][_0xf204('0x121')](db['SmsAccount'],{'foreignKey':_0xf204('0x1ef'),'as':_0xf204('0x1e0')});db['SmsTransferReport']['belongsTo'](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':_0xf204('0x1e7')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x58')],{'foreignKey':'ToSmsQueueId','as':_0xf204('0x1e4')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x51')],{'foreignKey':_0xf204('0x1f0'),'as':'ToAccount'});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0xfb')][_0xf204('0x117')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xf204('0xfb')]['hasMany'](db[_0xf204('0x73')],{'as':'Contacts','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':_0xf204('0x11b'),'foreignKey':_0xf204('0x171')});db['CmList']['hasMany'](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':'ListId'});db[_0xf204('0xfb')][_0xf204('0x123')](db[_0xf204('0x1b')],{'as':_0xf204('0x1f1'),'through':'voice_queues_has_cm_lists'});db[_0xf204('0xfb')]['belongsToMany'](db[_0xf204('0x14')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xf204('0x1dd')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x119'),'onDelete':_0xf204('0x113')});db[_0xf204('0x1dd')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Agents','through':_0xf204('0x10f')});db['VoicePrefix'][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x10d'),'as':'Teams'});db[_0xf204('0xfd')][_0xf204('0x117')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'foreignKey':_0xf204('0x122')});db[_0xf204('0xfd')][_0xf204('0x117')](db[_0xf204('0x1f2')],{'as':_0xf204('0x1f3'),'foreignKey':_0xf204('0x122'),'onDelete':'cascade'});db[_0xf204('0x1f2')][_0xf204('0x117')](db[_0xf204('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xf204('0x113')});db['WhatsappAccount'][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x1f4'),'onDelete':_0xf204('0x113')});db[_0xf204('0x1f5')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xf204('0x1f5')][_0xf204('0x117')](db[_0xf204('0x103')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x1f4')});db[_0xf204('0x1f5')]['hasMany'](db['WhatsappInteraction'],{'as':_0xf204('0x184')});db[_0xf204('0x1f5')]['hasMany'](db['WhatsappApplication'],{'as':_0xf204('0x16f')});db['WhatsappAccount'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db['WhatsappAccount']['belongsTo'](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x1f5')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x141')});db[_0xf204('0x1f6')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'restrict'});db[_0xf204('0x1f6')][_0xf204('0x121')](db[_0xf204('0x108')],{'onDelete':_0xf204('0x168')});db['WhatsappApplication'][_0xf204('0x121')](db[_0xf204('0x1f5')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x1f6')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x1f6')]['belongsTo'](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x181')});db['WhatsappInteraction'][_0xf204('0x117')](db[_0xf204('0x103')],{'as':_0xf204('0x16d'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xf204('0x121')](db[_0xf204('0x1f5')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1f4')});db[_0xf204('0x11e')]['belongsTo'](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':'ContactId'});db[_0xf204('0x11e')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x11e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1f7'),'as':_0xf204('0x178')});db[_0xf204('0x11e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1f7'),'as':_0xf204('0x179')});db['WhatsappInteraction'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':'user_has_whatsapp_interactions','foreignKey':_0xf204('0x1f8')});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x14')});db[_0xf204('0x103')][_0xf204('0x121')](db['CmContact'],{'onDelete':_0xf204('0x113'),'as':'Contact'});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x11e')],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x1f8')});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'as':'Account','foreignKey':_0xf204('0x1f4')});db[_0xf204('0x105')]['belongsTo'](db['WhatsappAccount'],{});db[_0xf204('0x105')]['belongsTo'](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x105')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappInteraction'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappQueue'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappMessage'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['User'],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x103')],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x11e')],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'foreignKey':_0xf204('0x1fa'),'as':'FromAccount'});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'foreignKey':_0xf204('0x1fb'),'as':_0xf204('0x1e6')});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x108')],{'foreignKey':_0xf204('0x1fc'),'as':_0xf204('0x1e4')});db['WhatsappTransferReport']['belongsTo'](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':_0xf204('0x1e7')});db[_0xf204('0x108')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x36'),'foreignKey':_0xf204('0x1fd')});db[_0xf204('0x108')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0xf204('0x110')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x1fe'),'foreignKey':_0xf204('0x114'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x165')][_0xf204('0x111')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xf204('0x165')]['hasOne'](db['MailServerIn'],{'as':_0xf204('0x1ff'),'onDelete':_0xf204('0x168')});db[_0xf204('0x165')][_0xf204('0x111')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0xf204('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 7990d59..991f77d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb764=['/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','/www','join','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','./api/user','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/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/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration'];(function(_0x3057a6,_0x31d830){var _0x1c995a=function(_0x23dbdc){while(--_0x23dbdc){_0x3057a6['push'](_0x3057a6['shift']());}};_0x1c995a(++_0x31d830);}(_0xb764,0x152));var _0x4b76=function(_0x135072,_0x39b6db){_0x135072=_0x135072-0x0;var _0x7ca355=_0xb764[_0x135072];return _0x7ca355;};'use strict';var path=require(_0x4b76('0x0'));var express=require(_0x4b76('0x1'));var errors=require(_0x4b76('0x2'));var config=require(_0x4b76('0x3'));var setupLoggers=require(_0x4b76('0x4'))[_0x4b76('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0x4b76('0x6')]=function(_0x44e589){return setupLoggers(_0x44e589)[_0x4b76('0x7')](function(){_0x44e589[_0x4b76('0x8')]('/api/users',require(_0x4b76('0x9')));_0x44e589[_0x4b76('0x8')]('/api/voice/chanspy',require(_0x4b76('0xa')));_0x44e589[_0x4b76('0x8')]('/api/voice/contexts',require(_0x4b76('0xb')));_0x44e589['use'](_0x4b76('0xc'),require('./api/voiceExtension'));_0x44e589[_0x4b76('0x8')]('/api/voice/mohs',require(_0x4b76('0xd')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xe'),require(_0x4b76('0xf')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x10'),require('./api/voiceRecording'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x11'),require(_0x4b76('0x12')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x13'),require('./api/voiceMail'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x14'),require(_0x4b76('0x15')));_0x44e589['use'](_0x4b76('0x16'),require(_0x4b76('0x17')));_0x44e589['use'](_0x4b76('0x18'),require(_0x4b76('0x19')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x1a'),require(_0x4b76('0x1b')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x1c'),require(_0x4b76('0x1d')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x1e'),require(_0x4b76('0x1f')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x20'),require(_0x4b76('0x21')));_0x44e589[_0x4b76('0x8')]('/api/voice/transfers/reports',require(_0x4b76('0x22')));_0x44e589['use'](_0x4b76('0x23'),require(_0x4b76('0x24')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x25'),require(_0x4b76('0x26')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x27'),require(_0x4b76('0x28')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x29'),require(_0x4b76('0x2a')));_0x44e589['use']('/api/mail/interactions',require(_0x4b76('0x2b')));_0x44e589['use'](_0x4b76('0x2c'),require('./api/mailMessage'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x2d'),require(_0x4b76('0x2e')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x2f'),require(_0x4b76('0x30')));_0x44e589['use'](_0x4b76('0x31'),require('./api/dashboard'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x32'),require('./api/dashboardItem'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x33'),require(_0x4b76('0x34')));_0x44e589[_0x4b76('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x35'),require(_0x4b76('0x36')));_0x44e589[_0x4b76('0x8')]('/api/fax/messages',require(_0x4b76('0x37')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x38'),require(_0x4b76('0x39')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x3a'),require(_0x4b76('0x3b')));_0x44e589['use'](_0x4b76('0x3c'),require(_0x4b76('0x3d')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x3e'),require(_0x4b76('0x3f')));_0x44e589[_0x4b76('0x8')]('/api/sms/interactions',require(_0x4b76('0x40')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x41'),require(_0x4b76('0x42')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x43'),require(_0x4b76('0x44')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x45'),require(_0x4b76('0x46')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x47'),require(_0x4b76('0x48')));_0x44e589[_0x4b76('0x8')]('/api/openchannel/interactions',require(_0x4b76('0x49')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x4a'),require(_0x4b76('0x4b')));_0x44e589[_0x4b76('0x8')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x44e589['use'](_0x4b76('0x4c'),require(_0x4b76('0x4d')));_0x44e589['use'](_0x4b76('0x4e'),require(_0x4b76('0x4f')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x50'),require(_0x4b76('0x51')));_0x44e589[_0x4b76('0x8')]('/api/chat/interactions',require(_0x4b76('0x52')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x53'),require('./api/chatMessage'));_0x44e589[_0x4b76('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x54'),require(_0x4b76('0x55')));_0x44e589['use'](_0x4b76('0x56'),require(_0x4b76('0x57')));_0x44e589['use'](_0x4b76('0x58'),require(_0x4b76('0x59')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x5a'),require(_0x4b76('0x5b')));_0x44e589[_0x4b76('0x8')]('/api/cm/contacts',require(_0x4b76('0x5c')));_0x44e589['use']('/api/cm/hopper',require(_0x4b76('0x5d')));_0x44e589['use'](_0x4b76('0x5e'),require('./api/cmHopperBlack'));_0x44e589['use'](_0x4b76('0x5f'),require(_0x4b76('0x60')));_0x44e589['use']('/api/cm/hopper_history',require(_0x4b76('0x61')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x62'),require(_0x4b76('0x63')));_0x44e589['use'](_0x4b76('0x64'),require(_0x4b76('0x65')));_0x44e589[_0x4b76('0x8')]('/api/automations',require(_0x4b76('0x66')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x67'),require(_0x4b76('0x68')));_0x44e589['use'](_0x4b76('0x69'),require('./api/disposition'));_0x44e589['use'](_0x4b76('0x6a'),require('./api/condition'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x6b'),require(_0x4b76('0x6c')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x6d'),require(_0x4b76('0x6e')));_0x44e589['use'](_0x4b76('0x6f'),require(_0x4b76('0x70')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x71'),require(_0x4b76('0x72')));_0x44e589['use'](_0x4b76('0x73'),require(_0x4b76('0x74')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x75'),require(_0x4b76('0x76')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x77'),require(_0x4b76('0x78')));_0x44e589['use'](_0x4b76('0x79'),require(_0x4b76('0x7a')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x7b'),require(_0x4b76('0x7c')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x7d'),require(_0x4b76('0x7e')));_0x44e589['use'](_0x4b76('0x7f'),require(_0x4b76('0x80')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x81'),require(_0x4b76('0x82')));_0x44e589['use']('/api/variables',require('./api/variable'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x83'),require('./api/integration'));_0x44e589['use'](_0x4b76('0x84'),require(_0x4b76('0x85')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x86'),require('./api/analyticCustomReport'));_0x44e589['use'](_0x4b76('0x87'),require(_0x4b76('0x88')));_0x44e589['use'](_0x4b76('0x89'),require(_0x4b76('0x8a')));_0x44e589[_0x4b76('0x8')]('/api/analytics/metrics',require(_0x4b76('0x8b')));_0x44e589[_0x4b76('0x8')]('/api/analytics/field_reports',require(_0x4b76('0x8c')));_0x44e589['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x8d'),require(_0x4b76('0x8e')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x8f'),require(_0x4b76('0x90')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x91'),require(_0x4b76('0x92')));_0x44e589[_0x4b76('0x8')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x93'),require(_0x4b76('0x94')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x95'),require(_0x4b76('0x96')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x97'),require('./api/intDeskAccount'));_0x44e589[_0x4b76('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x98'),require('./api/intDeskField'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x99'),require('./api/intZohoAccount'));_0x44e589['use']('/api/integrations/zoho/configurations',require(_0x4b76('0x9a')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x9b'),require('./api/intZohoField'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x9c'),require(_0x4b76('0x9d')));_0x44e589[_0x4b76('0x8')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x44e589['use'](_0x4b76('0x9e'),require(_0x4b76('0x9f')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xa0'),require(_0x4b76('0xa1')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xa2'),require(_0x4b76('0xa3')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xa4'),require('./api/intFreshdeskField'));_0x44e589[_0x4b76('0x8')]('/api/integrations/vtiger/accounts',require(_0x4b76('0xa5')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xa6'),require(_0x4b76('0xa7')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xa8'),require('./api/intVtigerField'));_0x44e589['use'](_0x4b76('0xa9'),require(_0x4b76('0xaa')));_0x44e589[_0x4b76('0x8')]('/api/integrations/servicenow/configurations',require(_0x4b76('0xab')));_0x44e589['use']('/api/integrations/servicenow/fields',require(_0x4b76('0xac')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xad'),require(_0x4b76('0xae')));_0x44e589['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x44e589[_0x4b76('0x8')](_0x4b76('0xaf'),require(_0x4b76('0xb0')));_0x44e589['use'](_0x4b76('0xb1'),require('./api/intFreshsalesAccount'));_0x44e589['use']('/api/integrations/freshsales/configurations',require(_0x4b76('0xb2')));_0x44e589['use'](_0x4b76('0xb3'),require(_0x4b76('0xb4')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xb5'),require(_0x4b76('0xb6')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xb7'),require(_0x4b76('0xb8')));_0x44e589['use']('/api/chat/internal/messages',require(_0x4b76('0xb9')));_0x44e589['use'](_0x4b76('0xba'),require(_0x4b76('0xbb')));_0x44e589[_0x4b76('0x8')]('/api/jscripty/questions/reports',require(_0x4b76('0xbc')));_0x44e589['use'](_0x4b76('0xbd'),require(_0x4b76('0xbe')));_0x44e589['use'](_0x4b76('0xbf'),require('./api/smsQueueReport'));_0x44e589[_0x4b76('0x8')]('/api/square/reports',require(_0x4b76('0xc0')));_0x44e589['use'](_0x4b76('0xc1'),require(_0x4b76('0xc2')));_0x44e589['use'](_0x4b76('0xc3'),require(_0x4b76('0xc4')));_0x44e589[_0x4b76('0x8')]('/api/settings',require(_0x4b76('0xc5')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xc6'),require('./api/squareOdbc'));_0x44e589[_0x4b76('0x8')](_0x4b76('0xc7'),require(_0x4b76('0xc8')));_0x44e589[_0x4b76('0x8')]('/api/square/recordings',require('./api/squareRecording'));_0x44e589[_0x4b76('0x8')]('/api/square/messages',require(_0x4b76('0xc9')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xca'),require(_0x4b76('0xcb')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xcc'),require(_0x4b76('0xcd')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xce'),require(_0x4b76('0xcf')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xd0'),require(_0x4b76('0xd1')));_0x44e589['use'](_0x4b76('0xd2'),require(_0x4b76('0xd3')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xd4'),require(_0x4b76('0xd5')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xd6'),require(_0x4b76('0xd7')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xd8'),require(_0x4b76('0xd9')));_0x44e589[_0x4b76('0x8')]('/api/fax/reports/transfer',require(_0x4b76('0xda')));_0x44e589[_0x4b76('0x8')]('/api/openchannel/reports/transfer',require(_0x4b76('0xdb')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xdc'),require(_0x4b76('0xdd')));_0x44e589[_0x4b76('0x8')]('/api/cm/lists',require(_0x4b76('0xde')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xdf'),require(_0x4b76('0xe0')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xe1'),require(_0x4b76('0xe2')));_0x44e589[_0x4b76('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x44e589['use'](_0x4b76('0xe3'),require(_0x4b76('0xe4')));_0x44e589['use'](_0x4b76('0xe5'),require(_0x4b76('0xe6')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xe7'),require('./api/whatsappAccount'));_0x44e589[_0x4b76('0x8')](_0x4b76('0xe8'),require(_0x4b76('0xe9')));_0x44e589[_0x4b76('0x8')]('/api/whatsapp/interactions',require(_0x4b76('0xea')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xeb'),require(_0x4b76('0xec')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xed'),require(_0x4b76('0xee')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xef'),require(_0x4b76('0xf0')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xf1'),require(_0x4b76('0xf2')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xf3'),require('./api/cloudProvider'));_0x44e589['use'](_0x4b76('0xf4'),require(_0x4b76('0xf5')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xf6'),require(_0x4b76('0xf7')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xf8'),require('./api/authLocal'));_0x44e589[_0x4b76('0x8')](_0x4b76('0xf9'),require(_0x4b76('0xfa')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xfb'),require('./api/authActiveDirectory'));_0x44e589[_0x4b76('0x8')]('/api/jira',require(_0x4b76('0xfc')));_0x44e589[_0x4b76('0x8')](_0x4b76('0xfd'),require('./api/rpc'));_0x44e589[_0x4b76('0x8')](_0x4b76('0xfe'),require(_0x4b76('0xff')));_0x44e589[_0x4b76('0x8')](_0x4b76('0x100'),require('./api/system'));_0x44e589[_0x4b76('0x8')](_0x4b76('0x101'),require(_0x4b76('0x102')));_0x44e589[_0x4b76('0x8')]('/api/webbar',require(_0x4b76('0x103')));_0x44e589[_0x4b76('0x8')]('/api/logs',clientSideLogs);_0x44e589[_0x4b76('0x8')](_0x4b76('0x104'),express[_0x4b76('0x105')](path['join'](config['root'],_0x4b76('0x104'))));_0x44e589[_0x4b76('0x8')](_0x4b76('0x106'),express[_0x4b76('0x105')](path[_0x4b76('0x107')](config[_0x4b76('0x108')],'/www')));_0x44e589['use'](_0x4b76('0x109'),express['static'](path[_0x4b76('0x107')](config['root'],_0x4b76('0x109'))));_0x44e589[_0x4b76('0x8')](_0x4b76('0x10a'),express[_0x4b76('0x105')](path['join'](config[_0x4b76('0x108')],'snippet',_0x4b76('0x10b'))));_0x44e589['use'](_0x4b76('0x10c'),express[_0x4b76('0x105')](path[_0x4b76('0x107')](config[_0x4b76('0x108')],_0x4b76('0x10d'))));_0x44e589['route'](_0x4b76('0x10e'))['get'](errors[0x194]);_0x44e589['route']('/*')[_0x4b76('0x10f')](function(_0x1f4af1,_0x5eeb83){_0x5eeb83[_0x4b76('0x110')](path['resolve'](_0x44e589[_0x4b76('0x10f')](_0x4b76('0x111'))+'/index.html'));});return _0x44e589;});}; \ No newline at end of file +var _0x38fd=['root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','./api/interval','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/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/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0x38fd,0x117));var _0xd38f=function(_0x1db504,_0x475eff){_0x1db504=_0x1db504-0x0;var _0x5c6754=_0x38fd[_0x1db504];return _0x5c6754;};'use strict';var path=require(_0xd38f('0x0'));var express=require(_0xd38f('0x1'));var errors=require(_0xd38f('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xd38f('0x3'))[_0xd38f('0x4')];var clientSideLogs=require(_0xd38f('0x5'));exports[_0xd38f('0x6')]=function(_0x4f7185){return setupLoggers(_0x4f7185)['then'](function(){_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8'),require('./api/user'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9'),require('./api/voiceChanSpy'));_0x4f7185[_0xd38f('0x7')]('/api/voice/contexts',require(_0xd38f('0xa')));_0x4f7185[_0xd38f('0x7')]('/api/voice/extensions',require(_0xd38f('0xb')));_0x4f7185[_0xd38f('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc'),require(_0xd38f('0xd')));_0x4f7185['use'](_0xd38f('0xe'),require(_0xd38f('0xf')));_0x4f7185['use'](_0xd38f('0x10'),require(_0xd38f('0x11')));_0x4f7185['use'](_0xd38f('0x12'),require(_0xd38f('0x13')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x14'),require(_0xd38f('0x15')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x16'),require('./api/voiceCallReport'));_0x4f7185[_0xd38f('0x7')]('/api/voice/dials/reports',require(_0xd38f('0x17')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x18'),require(_0xd38f('0x19')));_0x4f7185['use'](_0xd38f('0x1a'),require('./api/voiceQueueReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1b'),require(_0xd38f('0x1c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1d'),require(_0xd38f('0x1e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1f'),require(_0xd38f('0x20')));_0x4f7185[_0xd38f('0x7')]('/api/mail/out_servers',require(_0xd38f('0x21')));_0x4f7185[_0xd38f('0x7')]('/api/mail/accounts',require(_0xd38f('0x22')));_0x4f7185[_0xd38f('0x7')]('/api/mail/queues',require(_0xd38f('0x23')));_0x4f7185['use'](_0xd38f('0x24'),require(_0xd38f('0x25')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x26'),require(_0xd38f('0x27')));_0x4f7185[_0xd38f('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x28'),require('./api/mailApplication'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x29'),require(_0xd38f('0x2a')));_0x4f7185['use'](_0xd38f('0x2b'),require('./api/dashboard'));_0x4f7185['use'](_0xd38f('0x2c'),require(_0xd38f('0x2d')));_0x4f7185['use']('/api/fax/accounts',require(_0xd38f('0x2e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x2f'),require('./api/faxApplication'));_0x4f7185['use'](_0xd38f('0x30'),require(_0xd38f('0x31')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x32'),require(_0xd38f('0x33')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x34'),require(_0xd38f('0x35')));_0x4f7185[_0xd38f('0x7')]('/api/fax/reports/queue',require(_0xd38f('0x36')));_0x4f7185[_0xd38f('0x7')]('/api/sms/accounts',require(_0xd38f('0x37')));_0x4f7185[_0xd38f('0x7')]('/api/sms/applications',require(_0xd38f('0x38')));_0x4f7185['use'](_0xd38f('0x39'),require('./api/smsInteraction'));_0x4f7185['use'](_0xd38f('0x3a'),require(_0xd38f('0x3b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x3c'),require(_0xd38f('0x3d')));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/applications',require(_0xd38f('0x3e')));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/interactions',require(_0xd38f('0x3f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x40'),require('./api/openchannelMessage'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x41'),require(_0xd38f('0x42')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x43'),require(_0xd38f('0x44')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x45'),require(_0xd38f('0x46')));_0x4f7185[_0xd38f('0x7')]('/api/chat/applications',require(_0xd38f('0x47')));_0x4f7185['use']('/api/chat/interactions',require(_0xd38f('0x48')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x49'),require(_0xd38f('0x4a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4b'),require('./api/chatOfflineMessage'));_0x4f7185[_0xd38f('0x7')]('/api/chat/queues',require(_0xd38f('0x4c')));_0x4f7185['use'](_0xd38f('0x4d'),require('./api/chatGroup'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4e'),require('./api/chatProactiveAction'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4f'),require(_0xd38f('0x50')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x51'),require(_0xd38f('0x52')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x53'),require(_0xd38f('0x54')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x55'),require(_0xd38f('0x56')));_0x4f7185['use']('/api/cm/hopper_final',require(_0xd38f('0x57')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x58'),require(_0xd38f('0x59')));_0x4f7185['use'](_0xd38f('0x5a'),require(_0xd38f('0x5b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x5c'),require(_0xd38f('0x5d')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x5e'),require(_0xd38f('0x5f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x60'),require(_0xd38f('0x61')));_0x4f7185[_0xd38f('0x7')]('/api/dispositions',require(_0xd38f('0x62')));_0x4f7185[_0xd38f('0x7')]('/api/conditions',require(_0xd38f('0x63')));_0x4f7185[_0xd38f('0x7')]('/api/intervals',require(_0xd38f('0x64')));_0x4f7185[_0xd38f('0x7')]('/api/pauses',require('./api/pause'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x65'),require(_0xd38f('0x66')));_0x4f7185[_0xd38f('0x7')]('/api/voiceQueuesLog',require(_0xd38f('0x67')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x68'),require(_0xd38f('0x69')));_0x4f7185[_0xd38f('0x7')]('/api/sounds',require(_0xd38f('0x6a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6b'),require('./api/tag'));_0x4f7185[_0xd38f('0x7')]('/api/contact_item_types',require(_0xd38f('0x6c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6d'),require(_0xd38f('0x6e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6f'),require(_0xd38f('0x70')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x71'),require(_0xd38f('0x72')));_0x4f7185['use'](_0xd38f('0x73'),require('./api/trigger'));_0x4f7185[_0xd38f('0x7')]('/api/variables',require(_0xd38f('0x74')));_0x4f7185[_0xd38f('0x7')]('/api/integrations',require('./api/integration'));_0x4f7185['use'](_0xd38f('0x75'),require(_0xd38f('0x76')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x77'),require(_0xd38f('0x78')));_0x4f7185[_0xd38f('0x7')]('/api/analytics/default_reports',require(_0xd38f('0x79')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x7a'),require(_0xd38f('0x7b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x7c'),require('./api/analyticMetric'));_0x4f7185['use'](_0xd38f('0x7d'),require(_0xd38f('0x7e')));_0x4f7185['use'](_0xd38f('0x7f'),require(_0xd38f('0x80')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/salesforce/accounts',require(_0xd38f('0x81')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x82'),require(_0xd38f('0x83')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x84'),require(_0xd38f('0x85')));_0x4f7185['use'](_0xd38f('0x86'),require(_0xd38f('0x87')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x88'),require(_0xd38f('0x89')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8a'),require(_0xd38f('0x8b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8c'),require(_0xd38f('0x8d')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8e'),require(_0xd38f('0x8f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x90'),require(_0xd38f('0x91')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x92'),require(_0xd38f('0x93')));_0x4f7185['use'](_0xd38f('0x94'),require(_0xd38f('0x95')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x96'),require(_0xd38f('0x97')));_0x4f7185['use'](_0xd38f('0x98'),require('./api/intZendeskAccount'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x99'),require(_0xd38f('0x9a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9b'),require(_0xd38f('0x9c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9d'),require(_0xd38f('0x9e')));_0x4f7185['use'](_0xd38f('0x9f'),require('./api/intFreshdeskConfiguration'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa0'),require('./api/intFreshdeskField'));_0x4f7185['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x4f7185[_0xd38f('0x7')]('/api/integrations/vtiger/configurations',require(_0xd38f('0xa1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa2'),require('./api/intVtigerField'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa3'),require('./api/intServicenowAccount'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa4'),require(_0xd38f('0xa5')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x4f7185['use'](_0xd38f('0xa6'),require(_0xd38f('0xa7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa8'),require(_0xd38f('0xa9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xaa'),require(_0xd38f('0xab')));_0x4f7185['use']('/api/integrations/freshsales/accounts',require(_0xd38f('0xac')));_0x4f7185['use']('/api/integrations/freshsales/configurations',require(_0xd38f('0xad')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x4f7185[_0xd38f('0x7')]('/api/networks',require(_0xd38f('0xae')));_0x4f7185['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x4f7185['use']('/api/chat/internal/messages',require(_0xd38f('0xaf')));_0x4f7185['use'](_0xd38f('0xb0'),require(_0xd38f('0xb1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb2'),require(_0xd38f('0xb3')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb4'),require(_0xd38f('0xb5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb6'),require(_0xd38f('0xb7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb8'),require(_0xd38f('0xb9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xba'),require('./api/squareReportDetail'));_0x4f7185[_0xd38f('0x7')]('/api/jscripty/projects',require(_0xd38f('0xbb')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xbc'),require('./api/setting'));_0x4f7185['use'](_0xd38f('0xbd'),require(_0xd38f('0xbe')));_0x4f7185['use']('/api/square/projects',require('./api/squareProject'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xbf'),require(_0xd38f('0xc0')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc1'),require(_0xd38f('0xc2')));_0x4f7185[_0xd38f('0x7')]('/api/teams',require(_0xd38f('0xc3')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc4'),require(_0xd38f('0xc5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc6'),require('./api/campaign'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc7'),require(_0xd38f('0xc8')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc9'),require(_0xd38f('0xca')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcb'),require(_0xd38f('0xcc')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcd'),require(_0xd38f('0xce')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcf'),require('./api/chatTransferReport'));_0x4f7185['use'](_0xd38f('0xd0'),require(_0xd38f('0xd1')));_0x4f7185['use'](_0xd38f('0xd2'),require('./api/openchannelTransferReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd3'),require('./api/smsTransferReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd4'),require(_0xd38f('0xd5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd6'),require(_0xd38f('0xd7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd8'),require('./api/userProfile'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd9'),require(_0xd38f('0xda')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xdb'),require(_0xd38f('0xdc')));_0x4f7185['use'](_0xd38f('0xdd'),require(_0xd38f('0xde')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xdf'),require(_0xd38f('0xe0')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe1'),require('./api/whatsappApplication'));_0x4f7185[_0xd38f('0x7')]('/api/whatsapp/interactions',require(_0xd38f('0xe2')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe3'),require(_0xd38f('0xe4')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe5'),require('./api/whatsappQueueReport'));_0x4f7185['use'](_0xd38f('0xe6'),require(_0xd38f('0xe7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe8'),require(_0xd38f('0xe9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xea'),require('./api/cloudProvider'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xeb'),require(_0xd38f('0xec')));_0x4f7185['use']('/api/user-settings',require(_0xd38f('0xed')));_0x4f7185[_0xd38f('0x7')]('/api/auth/local',require('./api/authLocal'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xee'),require(_0xd38f('0xef')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf0'),require('./api/authActiveDirectory'));_0x4f7185[_0xd38f('0x7')]('/api/jira',require(_0xd38f('0xf1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf2'),require(_0xd38f('0xf3')));_0x4f7185[_0xd38f('0x7')]('/api/version',require(_0xd38f('0xf4')));_0x4f7185[_0xd38f('0x7')]('/api/system',require('./api/system'));_0x4f7185['use'](_0xd38f('0xf5'),require(_0xd38f('0xf6')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf7'),require(_0xd38f('0xf8')));_0x4f7185['use'](_0xd38f('0xf9'),clientSideLogs);_0x4f7185[_0xd38f('0x7')](_0xd38f('0xfa'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0xfa'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xfe'),express[_0xd38f('0xfb')](path['join'](config[_0xd38f('0xfd')],_0xd38f('0xfe'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xff'),express[_0xd38f('0xfb')](path['join'](config[_0xd38f('0xfd')],_0xd38f('0xff'))));_0x4f7185['use'](_0xd38f('0x100'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0x101'),_0xd38f('0x102'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x103'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0x104'))));_0x4f7185[_0xd38f('0x105')](_0xd38f('0x106'))['get'](errors[0x194]);_0x4f7185[_0xd38f('0x105')]('/*')[_0xd38f('0x107')](function(_0x36302d,_0x531c2a){_0x531c2a[_0xd38f('0x108')](path['resolve'](_0x4f7185['get'](_0xd38f('0x109'))+'/index.html'));});return _0x4f7185;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 70ae8b7..3a8caa8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf6d=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','../config/triggers','jayson/promise','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0xbb8965,_0x1b5cc3){var _0x6af502=function(_0xc43606){while(--_0xc43606){_0xbb8965['push'](_0xbb8965['shift']());}};_0x6af502(++_0x1b5cc3);}(_0xcf6d,0x16a));var _0xdcf6=function(_0x5c8920,_0x289195){_0x5c8920=_0x5c8920-0x0;var _0x26bff4=_0xcf6d[_0x5c8920];return _0x26bff4;};'use strict';var jayson=require(_0xdcf6('0x0'));var _=require('lodash');var config=require(_0xdcf6('0x1'));exports[_0xdcf6('0x2')]=function(){return new Promise(function(_0x59d7b9,_0x2e3944){var _0x4fcd5f={};_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/user/user.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x4')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/voiceQueue/voiceQueue.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/voiceRecording/voiceRecording.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x5')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x6')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x7')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x8')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x9')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0xa')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0xb')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0xc')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0xd')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/mailQueue/mailQueue.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0xe')));_0x4fcd5f=_['merge'](_0x4fcd5f,require('../api/mailMessage/mailMessage.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0xf')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x10')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x11')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/faxApplication/faxApplication.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x12')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/faxMessage/faxMessage.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x13')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x14')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/smsAccount/smsAccount.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x15')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x16')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x17')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x18')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x19')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1a')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1b')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1c')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1d')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/chatQueue/chatQueue.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/cmContact/cmContact.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1e')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x1f')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x20')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x21')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x22')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x23')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/pause/pause.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x24')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x25')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x26')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/trigger/trigger.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x27')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x28')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x29')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x2a')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x2b')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x2c')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x2d')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x2e')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x2f')));_0x4fcd5f=_['merge'](_0x4fcd5f,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x30')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x31')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x32')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x33')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x34')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x35')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/squareRecording/squareRecording.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x36')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x37')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x38')));_0x4fcd5f=_['merge'](_0x4fcd5f,require('../api/plugin/plugin.rpc'));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x39')));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4fcd5f=_[_0xdcf6('0x3')](_0x4fcd5f,require(_0xdcf6('0x3a')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x3b')));_0x4fcd5f=_['merge'](_0x4fcd5f,require(_0xdcf6('0x3c')));var _0x2190bf=jayson[_0xdcf6('0x3d')](_0x4fcd5f)['http']();var _0x2abe5b=config[_0xdcf6('0x3e')]['port']||config[_0xdcf6('0x3f')]+0x1;var _0x244517=config[_0xdcf6('0x3e')]['ip']||_0xdcf6('0x40');_0x2190bf['on'](_0xdcf6('0x41'),function(_0x2a7f2a){return _0x2e3944(_0x2a7f2a);});_0x2190bf['listen'](_0x2abe5b,_0x244517,function(){console[_0xdcf6('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x244517,_0x2abe5b);require(_0xdcf6('0x43'))['default']();return _0x59d7b9('RPC\x20listening\x20on\x20'+_0x244517+':'+_0x2abe5b);});});}; \ No newline at end of file +var _0xe6af=['../api/openchannelInteraction/openchannelInteraction.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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.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','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe6af,0x106));var _0xfe6a=function(_0x27d9b5,_0x5f0b3c){_0x27d9b5=_0x27d9b5-0x0;var _0x5b4039=_0xe6af[_0x27d9b5];return _0x5b4039;};'use strict';var jayson=require('jayson/promise');var _=require(_0xfe6a('0x0'));var config=require(_0xfe6a('0x1'));exports[_0xfe6a('0x2')]=function(){return new Promise(function(_0x5fd6ac,_0x568606){var _0x5f15e3={};_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x3')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/voiceExtension/voiceExtension.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x5')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x6')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x7')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x8')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x9')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xa')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xb')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/trunk/trunk.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0xc')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xd')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xe')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xf')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x10')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x11')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x12')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x13')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x14')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x15')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/faxApplication/faxApplication.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x16')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x17')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x18')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x19')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/smsInteraction/smsInteraction.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1b')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x1c')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1e')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1f')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x20')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x21')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x22')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x23')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x24')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x25')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x26')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x27')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x28')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/pause/pause.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x29')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2b')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/trigger/trigger.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2c')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2e')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2f')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x30')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x31')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x32')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x33')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x34')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x35')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x36')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x37')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/setting/setting.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x38')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x39')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/squareMessage/squareMessage.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/campaign/campaign.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/attachment/attachment.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/plugin/plugin.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3b')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3c')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x3d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3e')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3f')));var _0x109ec8=jayson[_0xfe6a('0x40')](_0x5f15e3)[_0xfe6a('0x41')]();var _0x39896d=config[_0xfe6a('0x42')][_0xfe6a('0x43')]||config['port']+0x1;var _0x55b0a2=config['rpc']['ip']||_0xfe6a('0x44');_0x109ec8['on']('error',function(_0x44244c){return _0x568606(_0x44244c);});_0x109ec8[_0xfe6a('0x2')](_0x39896d,_0x55b0a2,function(){console[_0xfe6a('0x45')](_0xfe6a('0x46'),_0x55b0a2,_0x39896d);require(_0xfe6a('0x47'))[_0xfe6a('0x48')]();return _0x5fd6ac('RPC\x20listening\x20on\x20'+_0x55b0a2+':'+_0x39896d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f55bec3..f811046 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 _0xfeef=['answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','hangup','HANGUP','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','toLowerCase','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','prototype','sendRequest'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfeef,0x10b));var _0xffee=function(_0x3339b2,_0x35b63b){_0x3339b2=_0x3339b2-0x0;var _0x1fd144=_0xfeef[_0x3339b2];return _0x1fd144;};'use strict';var util=require(_0xffee('0x0'));var _=require('lodash');var EventEmitter=require(_0xffee('0x1'))[_0xffee('0x2')];var AGIReply=require(_0xffee('0x3'));var AGIError=require(_0xffee('0x4'));function AGIChannel(_0x2c8db1){var _0x35cf46=this,_0x1ad432=new AGIReply(),_0x19e939=![],_0x2c399a={};EventEmitter[_0xffee('0x5')](_0x35cf46);_0x2c8db1[_0xffee('0x6')]('utf8');_0x2c8db1[_0xffee('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ad432[_0xffee('0x6')](_0xffee('0x8'));_0x1ad432['on'](_0xffee('0x9'),function(_0x4dbf39){for(var _0x35a665 in _0x4dbf39){_0x35cf46[_0x35a665]=_0x4dbf39[_0x35a665];}_0x35cf46[_0xffee('0xa')](_0xffee('0xb'));});_0x1ad432['on']('line',function(_0x5ba871){if(_0x5ba871[_0xffee('0xc')]()=='hangup'){_0x35cf46['emit']('hangup');return;}if(_0x5ba871[_0xffee('0xd')](0x0,0xb)==_0xffee('0xe')){_0x19e939=!![];}if(_0x19e939){_0x2c399a['rx']+=_0x5ba871+'\x0a';if(_0x5ba871['search'](_0xffee('0xf'))!=-0x1){_0x19e939=![];}}else{_0x2c399a['rx']=_0x5ba871;}if(_0x19e939){return;}if(typeof _0x2c399a['cb']==_0xffee('0x10')){var _0x1693f1=_0x2c399a['rx'][_0xffee('0xd')](0x0,0x3),_0x9f0d6f=null,_0x2c7579=null;_0x1693f1=parseInt(_0x1693f1);if(isNaN(_0x1693f1)){_0x2c399a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xffee('0x11')});return;}if(_0x1693f1!=0xc8){_0x2c399a['cb'](null,{'code':_0x1693f1,'result':-0x1,'extra':'KO'});return;}_0x9f0d6f=_0x2c399a['rx']['substring'](0x4)[_0xffee('0x12')](_0xffee('0x13'),'');if(_0x9f0d6f['indexOf']('\x20')!=-0x1){_0x9f0d6f=_0x9f0d6f[_0xffee('0x14')](0x0,_0x9f0d6f[_0xffee('0x15')]('\x20'));}if(_[_0xffee('0x16')](_0x9f0d6f,'-1')){_0x9f0d6f=parseInt(_0x9f0d6f);}_0x2c7579=_0x2c399a['rx'][_0xffee('0x17')]('\x20');if(_0x2c7579[_0xffee('0x18')]==0x3){_0x2c7579=_0x2c7579[0x2]['substring'](0x1,_0x2c7579[0x2][_0xffee('0x18')]-0x1);}else if(_0x2c7579['length']>0x3){var _0x117f3a=/\((.+)\)/;var _0x46f2b8=_0x2c399a['rx']['match'](_0x117f3a);if(_0x46f2b8){_0x2c7579=_0x46f2b8[0x1];}else{_0x2c7579=null;}}else{_0x2c7579=null;}_0x2c399a['cb'](null,{'code':_0x1693f1,'result':_0x9f0d6f,'extra':_0x2c7579});}});_0x2c8db1['on'](_0xffee('0x19'),function(_0x55fbd4){_0x35cf46[_0xffee('0xa')](_0xffee('0x19'),new AGIError(_0xffee('0x1a'),_0x55fbd4[_0xffee('0x1b')]));});_0x2c8db1['on'](_0xffee('0x1c'),function(){_0x35cf46[_0xffee('0xa')](_0xffee('0x1c'),new AGIError(_0xffee('0x1d')));});_0x2c8db1['on'](_0xffee('0x1e'),function(){_0x35cf46[_0xffee('0xa')](_0xffee('0x1e'),new AGIError(_0xffee('0x1f')));_0x2c8db1[_0xffee('0x20')]();});_0x2c8db1[_0xffee('0x21')](_0x1ad432);this[_0xffee('0x22')]=function(_0x1ed05f,_0xa83505){var _0x1ed05f=_0x1ed05f||'',_0xa83505=typeof _0xa83505==_0xffee('0x10')?_0xa83505:new Function();_0x2c399a={'tx':_0x1ed05f,'rx':'','cb':_0xa83505};_0x2c8db1['write'](_0x1ed05f+'\x0a');},this[_0xffee('0x1c')]=function(){_0x2c8db1['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xffee('0x23')][_0xffee('0x24')]=function(_0x48a663){return this[_0xffee('0x22')]['sync'](this,_0x48a663);};AGIChannel[_0xffee('0x23')][_0xffee('0x25')]=function(){return this['sendRequest'](_0xffee('0x26'));};AGIChannel[_0xffee('0x23')][_0xffee('0x27')]=function(_0x21859a,_0x5cad6b,_0x505e42){_0x21859a=_0x21859a===undefined?_0xffee('0x28'):_0x21859a;_0x5cad6b=_0x5cad6b===undefined?'5':_0x5cad6b;_0x505e42=_0x505e42===undefined?'1':_0x505e42;return this[_0xffee('0x24')](util['format'](_0xffee('0x29'),_0x21859a,_0x5cad6b*0x3e8,_0x505e42));};AGIChannel[_0xffee('0x23')][_0xffee('0x2a')]=function(_0x2c0c23){_0x2c0c23=_0x2c0c23||_0xffee('0x2b');return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x2d'),_0x2c0c23));};AGIChannel[_0xffee('0x23')][_0xffee('0x2e')]=function(_0x2f7a31,_0x524d04){if(_[_0xffee('0x2f')](_0x524d04)){return this['sendRequest'](util[_0xffee('0x2c')](_0xffee('0x30'),_0x2f7a31,_0x524d04['join'](',')));}return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x30'),_0x2f7a31,_0x524d04));};AGIChannel['prototype'][_0xffee('0x31')]=function(_0x4fbdf8){return this[_0xffee('0x24')](util['format'](_0xffee('0x32'),_0x4fbdf8));};AGIChannel[_0xffee('0x23')][_0xffee('0x33')]=function(_0x46f5b9){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x34'),_0x46f5b9));};AGIChannel[_0xffee('0x23')][_0xffee('0x35')]=function(_0x6455c1){return this[_0xffee('0x24')](util['format']('SET\x20PRIORITY\x20%s',_0x6455c1));};AGIChannel[_0xffee('0x23')][_0xffee('0x36')]=function(){return this['sendRequest'](_0xffee('0x37'));};AGIChannel[_0xffee('0x23')][_0xffee('0x38')]=function(_0x49dacb,_0x247d41){var _0x2693ce=_[_0xffee('0x39')](_0x247d41)||_['isNumber'](_0x247d41)?_0x247d41[_0xffee('0x3a')]():_0x247d41;return this[_0xffee('0x24')](util[_0xffee('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x49dacb,_0x2693ce?_0x2693ce[_0xffee('0x3a')]()[_0xffee('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xffee('0x23')][_0xffee('0x3b')]=function(_0x39f63b,_0xf5c727){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3c'),_0x39f63b,_0xf5c727));};AGIChannel[_0xffee('0x23')]['sayDigits']=function(_0x2fd982,_0x195339){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3d'),_0x2fd982,_0x195339));};AGIChannel[_0xffee('0x23')][_0xffee('0x3e')]=function(_0x587d4f,_0x268111){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3f'),_0x587d4f,_0x268111));};AGIChannel['prototype'][_0xffee('0x40')]=function(_0x2d423d,_0x2c49e4,_0x1321eb){_0x2c49e4=_0x2c49e4||this[_0xffee('0x41')];_0x1321eb=_0x1321eb||0x1;this[_0xffee('0x31')](_0x2d423d);this[_0xffee('0x33')](_0x2c49e4);this['setPriority'](_0x1321eb);return this['noop'](util[_0xffee('0x2c')](_0xffee('0x42'),_0x2d423d,_0x2c49e4,_0x1321eb));};AGIChannel[_0xffee('0x23')]['getVariable']=function(_0x2159d5){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x43'),_0x2159d5));};AGIChannel['prototype'][_0xffee('0x44')]=function(_0x592d98,_0x61980a,_0x1d1d5b,_0x9aee4b,_0x1f5e1e,_0x267b79){_0x61980a=_0x61980a||'wav';_0x1d1d5b=_0x1d1d5b||'';_0x9aee4b=_0x9aee4b===undefined?-0x1:_0x9aee4b==='-1'?-0x1:_0x9aee4b*0x3e8;_0x1f5e1e=_0x1f5e1e===undefined?'':'s='+_0x1f5e1e;_0x267b79=_0x267b79?_0xffee('0x45'):'';return this['sendRequest'](util[_0xffee('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x592d98,_0x61980a,_0x1d1d5b,_0x9aee4b,_0x267b79,_0x1f5e1e));};AGIChannel['prototype'][_0xffee('0x46')]=function(_0x4acdd6,_0xf5e12b){_0xf5e12b=_0xf5e12b||'';return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x47'),_0x4acdd6,_0xf5e12b));};AGIChannel[_0xffee('0x23')]['agi']=function(_0x215380){return this[_0xffee('0x2e')]('AGI',_0x215380);};AGIChannel[_0xffee('0x23')][_0xffee('0x48')]=function(_0x2e9332){return this['exec']('WAIT',_0x2e9332);};AGIChannel[_0xffee('0x23')]['error']=function(_0x3375ec,_0xf46326){this['noop'](util[_0xffee('0x2c')](_0xffee('0x49'),_0x3375ec['id'],_0x3375ec[_0xffee('0x4a')],_0xf46326));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xffee('0x4b')]=AGIChannel; \ No newline at end of file +var _0xdaa1=['isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','wait','WAIT','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sync','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable'];(function(_0x5ade35,_0x35cec6){var _0x21d317=function(_0x4369b1){while(--_0x4369b1){_0x5ade35['push'](_0x5ade35['shift']());}};_0x21d317(++_0x35cec6);}(_0xdaa1,0x17d));var _0x1daa=function(_0x1f80c2,_0x35eea6){_0x1f80c2=_0x1f80c2-0x0;var _0x665fc9=_0xdaa1[_0x1f80c2];return _0x665fc9;};'use strict';var util=require(_0x1daa('0x0'));var _=require(_0x1daa('0x1'));var EventEmitter=require(_0x1daa('0x2'))[_0x1daa('0x3')];var AGIReply=require(_0x1daa('0x4'));var AGIError=require(_0x1daa('0x5'));function AGIChannel(_0x6b2157){var _0x5b2c11=this,_0x2dcaf7=new AGIReply(),_0x2c4a89=![],_0x5e6cf5={};EventEmitter[_0x1daa('0x6')](_0x5b2c11);_0x6b2157[_0x1daa('0x7')]('utf8');_0x6b2157[_0x1daa('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2dcaf7[_0x1daa('0x7')](_0x1daa('0x9'));_0x2dcaf7['on'](_0x1daa('0xa'),function(_0x4b5a7d){for(var _0x38e9bd in _0x4b5a7d){_0x5b2c11[_0x38e9bd]=_0x4b5a7d[_0x38e9bd];}_0x5b2c11[_0x1daa('0xb')](_0x1daa('0xc'));});_0x2dcaf7['on'](_0x1daa('0xd'),function(_0x492815){if(_0x492815[_0x1daa('0xe')]()=='hangup'){_0x5b2c11[_0x1daa('0xb')](_0x1daa('0xf'));return;}if(_0x492815[_0x1daa('0x10')](0x0,0xb)==_0x1daa('0x11')){_0x2c4a89=!![];}if(_0x2c4a89){_0x5e6cf5['rx']+=_0x492815+'\x0a';if(_0x492815[_0x1daa('0x12')](_0x1daa('0x13'))!=-0x1){_0x2c4a89=![];}}else{_0x5e6cf5['rx']=_0x492815;}if(_0x2c4a89){return;}if(typeof _0x5e6cf5['cb']==_0x1daa('0x14')){var _0x582fab=_0x5e6cf5['rx'][_0x1daa('0x10')](0x0,0x3),_0xe56336=null,_0x169e81=null;_0x582fab=parseInt(_0x582fab);if(isNaN(_0x582fab)){_0x5e6cf5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x582fab!=0xc8){_0x5e6cf5['cb'](null,{'code':_0x582fab,'result':-0x1,'extra':'KO'});return;}_0xe56336=_0x5e6cf5['rx']['substring'](0x4)[_0x1daa('0x15')]('result=','');if(_0xe56336[_0x1daa('0x16')]('\x20')!=-0x1){_0xe56336=_0xe56336[_0x1daa('0x17')](0x0,_0xe56336['indexOf']('\x20'));}if(_['startsWith'](_0xe56336,'-1')){_0xe56336=parseInt(_0xe56336);}_0x169e81=_0x5e6cf5['rx'][_0x1daa('0x18')]('\x20');if(_0x169e81['length']==0x3){_0x169e81=_0x169e81[0x2][_0x1daa('0x10')](0x1,_0x169e81[0x2][_0x1daa('0x19')]-0x1);}else if(_0x169e81[_0x1daa('0x19')]>0x3){var _0x38278d=/\((.+)\)/;var _0x8a0791=_0x5e6cf5['rx'][_0x1daa('0x1a')](_0x38278d);if(_0x8a0791){_0x169e81=_0x8a0791[0x1];}else{_0x169e81=null;}}else{_0x169e81=null;}_0x5e6cf5['cb'](null,{'code':_0x582fab,'result':_0xe56336,'extra':_0x169e81});}});_0x6b2157['on'](_0x1daa('0x1b'),function(_0x4bee0e){_0x5b2c11[_0x1daa('0xb')]('error',new AGIError(_0x1daa('0x1c'),_0x4bee0e[_0x1daa('0x1d')]));});_0x6b2157['on'](_0x1daa('0x1e'),function(){_0x5b2c11['emit'](_0x1daa('0x1e'),new AGIError(_0x1daa('0x1f')));});_0x6b2157['on'](_0x1daa('0x20'),function(){_0x5b2c11[_0x1daa('0xb')](_0x1daa('0x20'),new AGIError(_0x1daa('0x21')));_0x6b2157[_0x1daa('0x22')]();});_0x6b2157[_0x1daa('0x23')](_0x2dcaf7);this[_0x1daa('0x24')]=function(_0x332870,_0x2bbff8){var _0x332870=_0x332870||'',_0x2bbff8=typeof _0x2bbff8==_0x1daa('0x14')?_0x2bbff8:new Function();_0x5e6cf5={'tx':_0x332870,'rx':'','cb':_0x2bbff8};_0x6b2157[_0x1daa('0x25')](_0x332870+'\x0a');},this[_0x1daa('0x1e')]=function(){_0x6b2157['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1daa('0x26')]['sendRequest']=function(_0x33b91f){return this['command'][_0x1daa('0x27')](this,_0x33b91f);};AGIChannel[_0x1daa('0x26')]['answer']=function(){return this[_0x1daa('0x28')]('ANSWER');};AGIChannel[_0x1daa('0x26')][_0x1daa('0x29')]=function(_0xd36108,_0xdb2080,_0x42818d){_0xd36108=_0xd36108===undefined?_0x1daa('0x2a'):_0xd36108;_0xdb2080=_0xdb2080===undefined?'5':_0xdb2080;_0x42818d=_0x42818d===undefined?'1':_0x42818d;return this['sendRequest'](util[_0x1daa('0x2b')](_0x1daa('0x2c'),_0xd36108,_0xdb2080*0x3e8,_0x42818d));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x2d')]=function(_0x4a724c){_0x4a724c=_0x4a724c||_0x1daa('0x2e');return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x2f'),_0x4a724c));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x30')]=function(_0x7406fb,_0x5df61f){if(_[_0x1daa('0x31')](_0x5df61f)){return this[_0x1daa('0x28')](util['format'](_0x1daa('0x32'),_0x7406fb,_0x5df61f['join'](',')));}return this[_0x1daa('0x28')](util['format'](_0x1daa('0x32'),_0x7406fb,_0x5df61f));};AGIChannel['prototype']['setContext']=function(_0x17e73a){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('SET\x20CONTEXT\x20%s',_0x17e73a));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x33')]=function(_0x5b48a2){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x34'),_0x5b48a2));};AGIChannel['prototype'][_0x1daa('0x35')]=function(_0x12c785){return this['sendRequest'](util[_0x1daa('0x2b')](_0x1daa('0x36'),_0x12c785));};AGIChannel[_0x1daa('0x26')][_0x1daa('0xf')]=function(){return this[_0x1daa('0x28')](_0x1daa('0x37'));};AGIChannel['prototype'][_0x1daa('0x38')]=function(_0x59660c,_0x4a5eb3){var _0x4ab107=_['isBoolean'](_0x4a5eb3)||_[_0x1daa('0x39')](_0x4a5eb3)?_0x4a5eb3[_0x1daa('0x3a')]():_0x4a5eb3;return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x59660c,_0x4ab107?_0x4ab107['toString']()[_0x1daa('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x1cb3ec,_0x118b3f){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x3b'),_0x1cb3ec,_0x118b3f));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x3c')]=function(_0x2836e6,_0x5ad1ae){return this['sendRequest'](util[_0x1daa('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x2836e6,_0x5ad1ae));};AGIChannel[_0x1daa('0x26')]['sayPhonetic']=function(_0xe4f2c0,_0x3c639f){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x3d'),_0xe4f2c0,_0x3c639f));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x3e')]=function(_0x4c0f34,_0x3da783,_0x14c4dc){_0x3da783=_0x3da783||this[_0x1daa('0x3f')];_0x14c4dc=_0x14c4dc||0x1;this[_0x1daa('0x40')](_0x4c0f34);this['setExtension'](_0x3da783);this[_0x1daa('0x35')](_0x14c4dc);return this[_0x1daa('0x2d')](util[_0x1daa('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x4c0f34,_0x3da783,_0x14c4dc));};AGIChannel['prototype'][_0x1daa('0x41')]=function(_0x3433d4){return this[_0x1daa('0x28')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x3433d4));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x42')]=function(_0x35ea18,_0x3facc2,_0x53781a,_0x92948,_0xd3f858,_0x3799e8){_0x3facc2=_0x3facc2||_0x1daa('0x43');_0x53781a=_0x53781a||'';_0x92948=_0x92948===undefined?-0x1:_0x92948==='-1'?-0x1:_0x92948*0x3e8;_0xd3f858=_0xd3f858===undefined?'':'s='+_0xd3f858;_0x3799e8=_0x3799e8?_0x1daa('0x44'):'';return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x45'),_0x35ea18,_0x3facc2,_0x53781a,_0x92948,_0x3799e8,_0xd3f858));};AGIChannel[_0x1daa('0x26')]['streamFile']=function(_0x465abb,_0x3eae53){_0x3eae53=_0x3eae53||'';return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x465abb,_0x3eae53));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x46')]=function(_0x289183){return this[_0x1daa('0x30')]('AGI',_0x289183);};AGIChannel[_0x1daa('0x26')][_0x1daa('0x47')]=function(_0x1538fc){return this[_0x1daa('0x30')](_0x1daa('0x48'),_0x1538fc);};AGIChannel[_0x1daa('0x26')][_0x1daa('0x1b')]=function(_0x5d8dea,_0x4a537c){this['noop'](util[_0x1daa('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5d8dea['id'],_0x5d8dea['label'],_0x4a537c));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c06f1b3..b8cddbb 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 _0x7f67=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x5a2121,_0x550856){var _0x193faa=function(_0x446bba){while(--_0x446bba){_0x5a2121['push'](_0x5a2121['shift']());}};_0x193faa(++_0x550856);}(_0x7f67,0xdd));var _0x77f6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7f67[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x77f6('0x0'),'E_AGI_ARGUMENT_PORT':_0x77f6('0x1'),'E_AGI_SERVER_ERROR':_0x77f6('0x2'),'E_AGI_SERVER_CLOSE':_0x77f6('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x77f6('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x77f6('0x5'),'E_AGI_SOCKET_CLOSE':_0x77f6('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x77f6('0x7'),'E_AGI_COMMAND_EMPTY':_0x77f6('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x77f6('0x9'),'E_AGI_IVR_ENTRY':_0x77f6('0xa')};function AGIError(_0x5b662a){var _0x5b662a=_0x5b662a||null,_0x28cb2c=_0x28cb2c||[],_0x1300ff=0x1,_0x5a18ef='';if(!error[_0x5b662a]){_0x5b662a=_0x77f6('0xb');}_0x28cb2c['push'](error[_0x5b662a]);while(arguments[_0x1300ff]){_0x28cb2c['push'](arguments[_0x1300ff]);_0x1300ff++;}_0x5a18ef=util['format'][_0x77f6('0xc')](util,_0x28cb2c);this[_0x77f6('0xd')]=_0x5a18ef;this[_0x77f6('0xe')]=_0x5b662a;}module[_0x77f6('0xf')]=AGIError; \ No newline at end of file +var _0x8b74=['Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x75fad7,_0x244ad6){var _0x256d88=function(_0x75b171){while(--_0x75b171){_0x75fad7['push'](_0x75fad7['shift']());}};_0x256d88(++_0x244ad6);}(_0x8b74,0xa2));var _0x48b7=function(_0x2cb0f2,_0xc29bc0){_0x2cb0f2=_0x2cb0f2-0x0;var _0x582577=_0x8b74[_0x2cb0f2];return _0x582577;};'use strict';var util=require(_0x48b7('0x0'));var error={'E_AGI_UNDEFINED':_0x48b7('0x1'),'E_AGI_ARGUMENT_PORT':_0x48b7('0x2'),'E_AGI_SERVER_ERROR':_0x48b7('0x3'),'E_AGI_SERVER_CLOSE':_0x48b7('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x48b7('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x48b7('0x6'),'E_AGI_SOCKET_ERROR':_0x48b7('0x7'),'E_AGI_SOCKET_CLOSE':_0x48b7('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x48b7('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x48b7('0xa'),'E_AGI_IVR_ENTRY':_0x48b7('0xb')};function AGIError(_0x409613){var _0x409613=_0x409613||null,_0x3b792e=_0x3b792e||[],_0x37faed=0x1,_0xcf0cf0='';if(!error[_0x409613]){_0x409613='E_AGI_UNDEFINED';}_0x3b792e[_0x48b7('0xc')](error[_0x409613]);while(arguments[_0x37faed]){_0x3b792e[_0x48b7('0xc')](arguments[_0x37faed]);_0x37faed++;}_0xcf0cf0=util[_0x48b7('0xd')][_0x48b7('0xe')](util,_0x3b792e);this[_0x48b7('0xf')]=_0xcf0cf0;this['name']=_0x409613;}module[_0x48b7('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 73aa5be..d321d1e 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8b7=['lodash','events','ioredis','./error','redis','defaults','agi','error','E_AGI_SERVER_ERROR','emit','projectUpdate','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc8b7,0xc0));var _0x7c8b=function(_0x30bb99,_0x257399){_0x30bb99=_0x30bb99-0x0;var _0x289ea8=_0xc8b7[_0x30bb99];return _0x289ea8;};'use strict';var _=require(_0x7c8b('0x0'));var EventEmitter=require(_0x7c8b('0x1'))['EventEmitter'];var Redis=require(_0x7c8b('0x2'));var AGIError=require(_0x7c8b('0x3'));var config=require('../../config/environment');config[_0x7c8b('0x4')]=_[_0x7c8b('0x5')](config[_0x7c8b('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7c8b('0x4')]);sub['subscribe'](_0x7c8b('0x6'),function(_0x42951a){if(_0x42951a)return eventEmitter['emit'](_0x7c8b('0x7'),new AGIError(_0x7c8b('0x8'),_0x42951a));});sub['on']('message',function(_0x27d967,_0x1d8ae3){if(_0x27d967!=='agi')return;try{var _0x5c15c4=JSON['parse'](_0x1d8ae3);eventEmitter[_0x7c8b('0x9')](_0x7c8b('0xa'),_0x5c15c4);}catch(_0x2137b2){eventEmitter[_0x7c8b('0x9')](_0x7c8b('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x2137b2));}});module[_0x7c8b('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x0aa3=['E_AGI_SERVER_ERROR','message','agi','parse','lodash','EventEmitter','ioredis','./error','redis','defaults','localhost','emit'];(function(_0x40aae2,_0x3da216){var _0x2187e6=function(_0x468399){while(--_0x468399){_0x40aae2['push'](_0x40aae2['shift']());}};_0x2187e6(++_0x3da216);}(_0x0aa3,0x1c0));var _0x30aa=function(_0x4a7401,_0x4f6059){_0x4a7401=_0x4a7401-0x0;var _0x2d73fa=_0x0aa3[_0x4a7401];return _0x2d73fa;};'use strict';var _=require(_0x30aa('0x0'));var EventEmitter=require('events')[_0x30aa('0x1')];var Redis=require(_0x30aa('0x2'));var AGIError=require(_0x30aa('0x3'));var config=require('../../config/environment');config[_0x30aa('0x4')]=_[_0x30aa('0x5')](config['redis'],{'host':_0x30aa('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x30aa('0x4')]);sub['subscribe']('agi',function(_0x326d8e){if(_0x326d8e)return eventEmitter[_0x30aa('0x7')]('error',new AGIError(_0x30aa('0x8'),_0x326d8e));});sub['on'](_0x30aa('0x9'),function(_0x1dd9af,_0xd47690){if(_0x1dd9af!==_0x30aa('0xa'))return;try{var _0xaefe9b=JSON[_0x30aa('0xb')](_0xd47690);eventEmitter[_0x30aa('0x7')]('projectUpdate',_0xaefe9b);}catch(_0x547d03){eventEmitter[_0x30aa('0x7')]('error',new AGIError(_0x30aa('0x8'),_0x547d03));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8ae821f..c6684b0 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 _0x6377=['info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','target','default','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','numberOfEdges','size','getVertex','traverseBFS'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x6377,0xf6));var _0x7637=function(_0x2e4f53,_0x65d4eb){_0x2e4f53=_0x2e4f53-0x0;var _0x2ae972=_0x6377[_0x2e4f53];return _0x2ae972;};'use strict';var _=require(_0x7637('0x0'));var logger=require(_0x7637('0x1'))(_0x7637('0x2'));var verticesWithRetry=[_0x7637('0x3'),_0x7637('0x4'),_0x7637('0x5')];var Graph=function(){this[_0x7637('0x6')]={};this[_0x7637('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0x7637('0x8')][_0x7637('0x9')]=function(_0x4a3b9e){this['vertices'][_0x4a3b9e['id']]=_0x4a3b9e;this['edges'][_0x4a3b9e['id']]=[];};Graph[_0x7637('0x8')][_0x7637('0xa')]=function(_0x1dd432,_0x51dd97,_0x546521){this[_0x7637('0x7')][_0x1dd432]['push']({'target':_0x51dd97,'condition':_0x546521});this[_0x7637('0xb')]+=0x1;};Graph[_0x7637('0x8')][_0x7637('0xc')]=function(){return _[_0x7637('0xc')](this[_0x7637('0x6')]);};Graph[_0x7637('0x8')]['relations']=function(){return this[_0x7637('0xb')];};Graph[_0x7637('0x8')][_0x7637('0xd')]=function(_0x10fb19){return this[_0x7637('0x6')][_0x10fb19];};Graph[_0x7637('0x8')][_0x7637('0xe')]=function(_0x2dc8a2,_0x547f11){if(!this['vertices'][_0x2dc8a2]){return logger[_0x7637('0xf')](_0x7637('0x10'));}var _0x12ea43=_0x547f11(this['vertices'][_0x2dc8a2]);if(!_0x12ea43){return logger['info'](_0x7637('0x11'));}if(this[_0x7637('0x7')][_0x2dc8a2]['length']===0x0){return logger[_0x7637('0xf')](_0x7637('0x12'));}for(var _0x3b20be=0x0,_0x31a52e=[],_0x586d9b=![];_0x3b20be\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','catch','indexOf','agi_','substring','timeout','evtHangup','hangup','find','handleUnpublished','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x188341,_0x54ba0f){var _0x2e86cf=function(_0x2bc51a){while(--_0x2bc51a){_0x188341['push'](_0x188341['shift']());}};_0x2e86cf(++_0x54ba0f);}(_0xb009,0x1e3));var _0x9b00=function(_0x34c403,_0x341b70){_0x34c403=_0x34c403-0x0;var _0x5bf2b9=_0xb009[_0x34c403];return _0x5bf2b9;};'use strict';var _=require('lodash');var syncho=require(_0x9b00('0x0'));var util=require(_0x9b00('0x1'));var config=require('../../config/environment');var logger=require(_0x9b00('0x2'))(_0x9b00('0x3'));var utilLicense=require(_0x9b00('0x4'));var rpc=require(_0x9b00('0x5'));var Project=require(_0x9b00('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x9b00('0x3')]=_[_0x9b00('0x7')](config[_0x9b00('0x3')],{'ip':_0x9b00('0x8'),'port':0x11dd});AGIEmitter['on'](_0x9b00('0x9'),projectUpdateHandler);function connectionHandler(_0xc19075){process[_0x9b00('0xa')](function(){syncho(function(){try{setChannelVariables(_0xc19075);agiHandler(_0xc19075);}catch(_0x4bdaa8){logger[_0x9b00('0xb')](_0x4bdaa8[_0x9b00('0xc')]);}});});}function projectUpdateHandler(_0x30c091){try{var _0x53a0ba=_[_0x9b00('0xd')](projects,['id',_0x30c091['id']]);if(_0x53a0ba>-0x1){if(_0x30c091['deleted']===!![]){projects[_0x9b00('0xe')](_0x53a0ba,0x1);}else{projects[_0x53a0ba]=_0x30c091;}}else{projects[_0x9b00('0xf')](_0x30c091);}}catch(_0x4c5f66){logger[_0x9b00('0xb')](_0x4c5f66['stack']);}}function listeningHandler(){console[_0x9b00('0x10')](_0x9b00('0x11'),config['agi'][_0x9b00('0x12')]);logger['info'](util[_0x9b00('0x13')](_0x9b00('0x14'),config['agi']['ip'],config[_0x9b00('0x3')][_0x9b00('0x12')]));}function errorHandler(_0x559cfa){if(_0x559cfa&&_0x559cfa[_0x9b00('0x15')]&&_0x559cfa[_0x9b00('0x16')]){logger[_0x9b00('0xb')](util[_0x9b00('0x13')](_0x9b00('0x17'),_0x559cfa[_0x9b00('0x15')],_0x559cfa['message']));}else{logger[_0x9b00('0xb')](util['format'](_0x9b00('0x18'),_0x559cfa[_0x9b00('0xc')]));}}function closeHandler(){logger['info'](util[_0x9b00('0x13')](_0x9b00('0x19'),this[_0x9b00('0x1a')],this[_0x9b00('0x1b')],this[_0x9b00('0x1c')],this[_0x9b00('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4a042a){logger[_0x9b00('0xb')](_0x4a042a[_0x9b00('0xc')]);}}function timeoutHandler(){logger[_0x9b00('0x1e')](util[_0x9b00('0x13')](_0x9b00('0x1f'),this['arg_1'],this[_0x9b00('0x1b')],this['callerid'],this[_0x9b00('0x1d')],this[_0x9b00('0x20')]));}function hangupHandler(){logger[_0x9b00('0x1e')](util['format'](_0x9b00('0x21'),this[_0x9b00('0x1a')],this[_0x9b00('0x1b')],this[_0x9b00('0x1c')],this[_0x9b00('0x1d')],this[_0x9b00('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0xaf8576,_0x234e99){rpc['createSquareReport'](_0xaf8576)['then'](function(_0x42b928){if(_0x234e99){_0x234e99(null,_0x42b928);}})[_0x9b00('0x22')](function(_0x2ed769){if(_0x234e99){_0x234e99(null,_0x2ed769);}});}function setChannelVariables(_0x27870b){for(var _0x5b1fbc in _0x27870b){if(_0x27870b['hasOwnProperty'](_0x5b1fbc)){if(_0x5b1fbc[_0x9b00('0x23')](_0x9b00('0x24'))===0x0){_0x27870b[_0x5b1fbc[_0x9b00('0x25')](0x4)]=_0x27870b[_0x5b1fbc];delete _0x27870b[_0x5b1fbc];}}}}function agiHandler(_0x4564f7){logger['debug']('variables',JSON['stringify'](_0x4564f7,null,0x2));logger['info'](util[_0x9b00('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4564f7[_0x9b00('0x1a')],_0x4564f7[_0x9b00('0x1b')],_0x4564f7[_0x9b00('0x1c')],_0x4564f7[_0x9b00('0x1d')],_0x4564f7[_0x9b00('0x20')]));_0x4564f7['on'](_0x9b00('0xb'),errorHandler);_0x4564f7['on']('close',closeHandler);_0x4564f7['on'](_0x9b00('0x26'),timeoutHandler);_0x4564f7[_0x9b00('0x27')]=![];_0x4564f7['on'](_0x9b00('0x28'),hangupHandler);var _0x52e54e=_[_0x9b00('0x29')](projects,['name',_0x4564f7[_0x9b00('0x1a')]]);if(!_0x52e54e)return Project['handleNotFound'](_0x4564f7);if(!_0x52e54e['production'])return Project[_0x9b00('0x2a')](_0x4564f7);return Project['initialize'](_0x52e54e,_0x4564f7);}function main(){var _0x1b7a64;return utilLicense[_0x9b00('0x2b')]()[_0x9b00('0x2c')](function(_0x4fb299){if(!_0x4fb299)return;if(_0x4fb299[_0x9b00('0x2d')]){if(_0x4fb299[_0x9b00('0x2e')]&&_0x4fb299[_0x9b00('0x2e')]>0x0){logger['info'](util[_0x9b00('0x13')](_0x9b00('0x2f'),_0x4fb299[_0x9b00('0x2e')]));_0x1b7a64=_0x4fb299['callysquare'];}else{logger['info'](_0x9b00('0x30'));}}else{logger[_0x9b00('0x1e')](_0x9b00('0x31'));_0x1b7a64=-0x1;}})[_0x9b00('0x2c')](function(){return Project[_0x9b00('0x32')]();})[_0x9b00('0x2c')](function(_0x259eb3){projects=_0x259eb3;return;})[_0x9b00('0x22')](function(_0xa92e51){logger[_0x9b00('0xb')](_0x9b00('0x33'),_0xa92e51['stack']);})[_0x9b00('0x34')](function(){var _0x470038=require(_0x9b00('0x35'))(config['agi']['port'],config[_0x9b00('0x3')]['ip'],_0x1b7a64);_0x470038['on']('error',errorHandler);_0x470038['on'](_0x9b00('0x36'),listeningHandler);_0x470038['on'](_0x9b00('0x37'),connectionHandler);_0x470038['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x1665=['createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','./server','port','listening','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','name','message','[ERROR]\x20%s','stack','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1665,0xf6));var _0x5166=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0x1665[_0x3c7a73];return _0xd0e2b6;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x5166('0x0'));var config=require(_0x5166('0x1'));var logger=require(_0x5166('0x2'))(_0x5166('0x3'));var utilLicense=require(_0x5166('0x4'));var rpc=require('./rpc');var Project=require(_0x5166('0x5'));var AGIEmitter=require('./events')[_0x5166('0x6')];var projects=[];config[_0x5166('0x3')]=_[_0x5166('0x7')](config[_0x5166('0x3')],{'ip':_0x5166('0x8'),'port':0x11dd});AGIEmitter['on'](_0x5166('0x9'),projectUpdateHandler);function connectionHandler(_0x5e5c3f){process[_0x5166('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5e5c3f);agiHandler(_0x5e5c3f);}catch(_0x174a7f){logger[_0x5166('0xb')](_0x174a7f['stack']);}});});}function projectUpdateHandler(_0x47abe6){try{var _0x3fd25f=_[_0x5166('0xc')](projects,['id',_0x47abe6['id']]);if(_0x3fd25f>-0x1){if(_0x47abe6[_0x5166('0xd')]===!![]){projects['splice'](_0x3fd25f,0x1);}else{projects[_0x3fd25f]=_0x47abe6;}}else{projects['push'](_0x47abe6);}}catch(_0x232e62){logger[_0x5166('0xb')](_0x232e62['stack']);}}function listeningHandler(){console[_0x5166('0xe')](_0x5166('0xf'),config[_0x5166('0x3')]['port']);logger[_0x5166('0x10')](util[_0x5166('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x5166('0x3')]['port']));}function errorHandler(_0x289f37){if(_0x289f37&&_0x289f37[_0x5166('0x12')]&&_0x289f37[_0x5166('0x13')]){logger[_0x5166('0xb')](util['format']('[%s]\x20%s',_0x289f37[_0x5166('0x12')],_0x289f37[_0x5166('0x13')]));}else{logger[_0x5166('0xb')](util[_0x5166('0x11')](_0x5166('0x14'),_0x289f37[_0x5166('0x15')]));}}function closeHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this['dnid'],this[_0x5166('0x19')]));try{createSquareReport(this);}catch(_0x144beb){logger['error'](_0x144beb[_0x5166('0x15')]);}}function timeoutHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')](_0x5166('0x1a'),this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this[_0x5166('0x1b')],this[_0x5166('0x19')]));}function hangupHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this[_0x5166('0x1b')],this['uniqueid']));this[_0x5166('0x1c')]=!![];}function createSquareReport(_0x30a05c,_0x6138c0){rpc[_0x5166('0x1d')](_0x30a05c)[_0x5166('0x1e')](function(_0x190d9a){if(_0x6138c0){_0x6138c0(null,_0x190d9a);}})[_0x5166('0x1f')](function(_0x5569cf){if(_0x6138c0){_0x6138c0(null,_0x5569cf);}});}function setChannelVariables(_0x4b1f53){for(var _0x1b8a39 in _0x4b1f53){if(_0x4b1f53[_0x5166('0x20')](_0x1b8a39)){if(_0x1b8a39[_0x5166('0x21')]('agi_')===0x0){_0x4b1f53[_0x1b8a39[_0x5166('0x22')](0x4)]=_0x4b1f53[_0x1b8a39];delete _0x4b1f53[_0x1b8a39];}}}}function agiHandler(_0x42a462){logger[_0x5166('0x23')](_0x5166('0x24'),JSON[_0x5166('0x25')](_0x42a462,null,0x2));logger[_0x5166('0x10')](util[_0x5166('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42a462['arg_1'],_0x42a462[_0x5166('0x17')],_0x42a462[_0x5166('0x18')],_0x42a462[_0x5166('0x1b')],_0x42a462[_0x5166('0x19')]));_0x42a462['on'](_0x5166('0xb'),errorHandler);_0x42a462['on'](_0x5166('0x26'),closeHandler);_0x42a462['on'](_0x5166('0x27'),timeoutHandler);_0x42a462['evtHangup']=![];_0x42a462['on'](_0x5166('0x28'),hangupHandler);var _0x2e7a79=_[_0x5166('0x29')](projects,[_0x5166('0x12'),_0x42a462[_0x5166('0x16')]]);if(!_0x2e7a79)return Project[_0x5166('0x2a')](_0x42a462);if(!_0x2e7a79[_0x5166('0x2b')])return Project[_0x5166('0x2c')](_0x42a462);return Project['initialize'](_0x2e7a79,_0x42a462);}function main(){var _0x5e814b;return utilLicense[_0x5166('0x2d')]()['then'](function(_0x4bf84d){if(!_0x4bf84d)return;if(_0x4bf84d[_0x5166('0x2e')]){if(_0x4bf84d[_0x5166('0x2f')]&&_0x4bf84d['callysquare']>0x0){logger['info'](util[_0x5166('0x11')](_0x5166('0x30'),_0x4bf84d[_0x5166('0x2f')]));_0x5e814b=_0x4bf84d[_0x5166('0x2f')];}else{logger[_0x5166('0x10')](_0x5166('0x31'));}}else{logger[_0x5166('0x10')](_0x5166('0x32'));_0x5e814b=-0x1;}})[_0x5166('0x1e')](function(){return Project['getAll']();})[_0x5166('0x1e')](function(_0x508a10){projects=_0x508a10;return;})[_0x5166('0x1f')](function(_0x42a43c){logger[_0x5166('0xb')]('[LICENSE]',_0x42a43c[_0x5166('0x15')]);})[_0x5166('0x33')](function(){var _0x36dfe9=require(_0x5166('0x34'))(config['agi'][_0x5166('0x35')],config[_0x5166('0x3')]['ip'],_0x5e814b);_0x36dfe9['on'](_0x5166('0xb'),errorHandler);_0x36dfe9['on'](_0x5166('0x36'),listeningHandler);_0x36dfe9['on']('connection',connectionHandler);_0x36dfe9['on']('close',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 2086416..0182112 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 _0x032c=['error','message','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x354b5f,_0x56edc0){var _0x1a748c=function(_0x4df39a){while(--_0x4df39a){_0x354b5f['push'](_0x354b5f['shift']());}};_0x1a748c(++_0x56edc0);}(_0x032c,0x147));var _0xc032=function(_0x1b321c,_0x543c48){_0x1b321c=_0x1b321c-0x0;var _0xd4fca3=_0x032c[_0x1b321c];return _0xd4fca3;};'use strict';var BPromise=require(_0xc032('0x0'));var jayson=require(_0xc032('0x1'));var client=jayson[_0xc032('0x2')][_0xc032('0x3')]({'port':0x232b});function request(_0x22acb5,_0x262933){return new BPromise(function(_0x3af015,_0x48a099){return client[_0xc032('0x4')](_0x22acb5,_0x262933)[_0xc032('0x5')](function(_0x77b28a){if(_0x77b28a[_0xc032('0x6')]){return _0x48a099(_0x77b28a[_0xc032('0x6')][_0xc032('0x7')]);}else{return _0x3af015(_0x77b28a['result']);}})['catch'](function(_0x456b03){return _0x48a099(_0x456b03);});});}exports['sendMailMessage']=function(_0x4327ec,_0x1dc701){return request(_0xc032('0x8'),{'account':_0x4327ec,'message':_0x1dc701});}; \ No newline at end of file +var _0x9f02=['then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x3ccd6e,_0x5baac5){var _0x5cde6b=function(_0x207573){while(--_0x207573){_0x3ccd6e['push'](_0x3ccd6e['shift']());}};_0x5cde6b(++_0x5baac5);}(_0x9f02,0x15b));var _0x29f0=function(_0xa0b41,_0x46df50){_0xa0b41=_0xa0b41-0x0;var _0x53da72=_0x9f02[_0xa0b41];return _0x53da72;};'use strict';var BPromise=require(_0x29f0('0x0'));var jayson=require(_0x29f0('0x1'));var client=jayson[_0x29f0('0x2')][_0x29f0('0x3')]({'port':0x232b});function request(_0x35a83a,_0x596729){return new BPromise(function(_0x108af6,_0x1627bd){return client[_0x29f0('0x4')](_0x35a83a,_0x596729)[_0x29f0('0x5')](function(_0x1fb67b){if(_0x1fb67b[_0x29f0('0x6')]){return _0x1627bd(_0x1fb67b[_0x29f0('0x6')][_0x29f0('0x7')]);}else{return _0x108af6(_0x1fb67b[_0x29f0('0x8')]);}})['catch'](function(_0x3727eb){return _0x1627bd(_0x3727eb);});});}exports[_0x29f0('0x9')]=function(_0x5732b8,_0x4a225e){return request(_0x29f0('0xa'),{'account':_0x5732b8,'message':_0x4a225e});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 699ad23..99a7b93 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb87e=['./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[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\x20found','Project\x20%s\x20not\x20published','exports','lodash','util','agi','./rpc','./mailRpc'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb87e,0x127));var _0xeb87=function(_0x2e50c7,_0x1bebf0){_0x2e50c7=_0x2e50c7-0x0;var _0x5debbf=_0xb87e[_0x2e50c7];return _0x5debbf;};'use strict';var _=require(_0xeb87('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0xeb87('0x1'));var logger=require('../../config/logger')(_0xeb87('0x2'));var rpc=require(_0xeb87('0x3'));var mailRpc=require(_0xeb87('0x4'));var Graph=require('./graph');var Vertices=require(_0xeb87('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xeb87('0x6')]()[_0xeb87('0x7')](function(_0x12dca9){logger[_0xeb87('0x8')](_0xeb87('0x9'),_0x12dca9[_0xeb87('0xa')]);return[];});}function addVertex(_0x278a19,_0x5c4364,_0x9bc19b){_0x5c4364[_0xeb87('0xb')]=_0x9bc19b;if(_0x5c4364[_0xeb87('0xc')]('retry')){_0x5c4364[_0xeb87('0xd')]=parseInt(_0x5c4364['retry'],0xa);}_0x278a19[_0xeb87('0xe')](_[_0xeb87('0xf')](_0x5c4364,_0xeb87('0x10')));}function initGraph(_0x5bbcba,_0x565420){var _0x17c257=new Graph();for(var _0x81a397 in _0x5bbcba){if(_0x5bbcba[_0xeb87('0xc')](_0x81a397)){if(_['isArray'](_0x5bbcba[_0x81a397])){for(var _0x4d3232=0x0;_0x4d3232<_0x5bbcba[_0x81a397]['length'];_0x4d3232+=0x1){addVertex(_0x17c257,_0x5bbcba[_0x81a397][_0x4d3232],_0x81a397);}}else{addVertex(_0x17c257,_0x5bbcba[_0x81a397],_0x81a397);}}}for(var _0x495fdb=0x0;_0x495fdb<_0x565420[_0xeb87('0x11')];_0x495fdb+=0x1){if(_0x565420[_0x495fdb][_0xeb87('0x12')]&&_0x565420[_0x495fdb][_0xeb87('0x13')]){_0x17c257[_0xeb87('0x14')](_0x565420[_0x495fdb][_0xeb87('0x12')],_0x565420[_0x495fdb][_0xeb87('0x13')],_0x565420[_0x495fdb]['value']);}}return _0x17c257;}function getRoot(_0x4a3ac7){return parser[_0xeb87('0x15')](_0x4a3ac7,{'object':!![]})[_0xeb87('0x16')][_0xeb87('0x17')];}function inspect(_0x3ecad3){return util[_0xeb87('0x18')](_0x3ecad3,{'showHidden':![],'depth':null});}function initialize(_0x35fbab,_0x1d5686){var _0x550c69=getRoot(_0x35fbab[_0xeb87('0x19')]);if(!_0x550c69||!_0x550c69['start'])return;var _0x275ea9,_0x27cd05,_0x2d0cec;logger[_0xeb87('0x1a')]('root',JSON[_0xeb87('0x1b')](_0x550c69,null,0x2));_0x1d5686[_0xeb87('0x1c')]=moment()[_0xeb87('0x1d')](_0xeb87('0x1e'));_0x275ea9=initGraph(_[_0xeb87('0xf')](_0x550c69,_0xeb87('0x10')),_0x550c69['mxCell']);_0x27cd05=new Vertices(_0x1d5686,rpc,mailRpc);logger[_0xeb87('0x1f')](util[_0xeb87('0x1d')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d5686['arg_1'],_0x1d5686['calleridname'],_0x1d5686['callerid'],_0x1d5686['dnid'],_0x1d5686['uniqueid']));_0x275ea9[_0xeb87('0x20')](_0x550c69['start']['id'],function(_0x4b1a71){try{_0x4b1a71=_0x27cd05[_0xeb87('0x21')](_0x4b1a71);logger['debug'](_0xeb87('0x22'),JSON[_0xeb87('0x1b')](_0x4b1a71,null,0x2));if(_0x4b1a71['agicommand']===_0xeb87('0x23')){logger[_0xeb87('0x1f')](_0xeb87('0x24'));_0x1d5686['context']=_0x4b1a71[_0xeb87('0x25')]||_0x1d5686[_0xeb87('0x25')];_0x1d5686[_0xeb87('0x26')]=_0x4b1a71[_0xeb87('0x26')];_0x1d5686['priority']=_0x4b1a71['priority']?_0x4b1a71[_0xeb87('0x27')]-0x1:0x1;return null;}else if(_0x4b1a71&&_0x27cd05[_0x4b1a71[_0xeb87('0xb')]]){_0x2d0cec=_0x27cd05[_0x4b1a71[_0xeb87('0xb')]](_0x4b1a71);logger[_0xeb87('0x1f')](_0xeb87('0x28'),JSON['stringify'](_0x2d0cec,null,0x2));if(_0x2d0cec&&_0x2d0cec[_0xeb87('0x29')]===AGI_CODE_SUCCESS&&_0x2d0cec[_0xeb87('0x2a')]!==AGI_RESULT_ERROR&&!_0x1d5686['evtHangup']){logger[_0xeb87('0x1a')]('response',inspect(_0x2d0cec));return _[_0xeb87('0x2b')](_0x2d0cec['result'])?null:_0x2d0cec[_0xeb87('0x2a')][_0xeb87('0x2c')]();}else{logger[_0xeb87('0x8')](_0xeb87('0x28'),inspect(_0x2d0cec));return null;}}else{logger[_0xeb87('0x8')](_0xeb87('0x2d'));return null;}}catch(_0x8016ea){logger[_0xeb87('0x8')](_0x8016ea[_0xeb87('0xa')]);return null;}});if(_0x550c69[_0xeb87('0x2e')]){logger[_0xeb87('0x1f')](util['format'](_0xeb87('0x2f'),_0x1d5686[_0xeb87('0x30')],_0x1d5686[_0xeb87('0x31')],_0x1d5686[_0xeb87('0x32')],_0x1d5686[_0xeb87('0x33')],_0x1d5686[_0xeb87('0x34')]));_0x275ea9['traverseBFS'](_0x550c69[_0xeb87('0x2e')]['id'],function(_0x4f8a10){try{_0x4f8a10=_0x27cd05[_0xeb87('0x21')](_0x4f8a10);logger[_0xeb87('0x1a')]('vertex',JSON['stringify'](_0x4f8a10,null,0x2));if(_0x4f8a10&&_0x27cd05[_0x4f8a10[_0xeb87('0xb')]]){_0x2d0cec=_0x27cd05[_0x4f8a10[_0xeb87('0xb')]](_0x4f8a10);if(_0x2d0cec){logger[_0xeb87('0x1a')](_0xeb87('0x28'),inspect(_0x2d0cec));return _[_0xeb87('0x2b')](_0x2d0cec[_0xeb87('0x2a')])?null:_0x2d0cec[_0xeb87('0x2a')][_0xeb87('0x2c')]();}else{logger[_0xeb87('0x8')](_0xeb87('0x28'),inspect(_0x2d0cec));return null;}}else{logger[_0xeb87('0x8')](_0xeb87('0x2d'));return null;}}catch(_0x3fef1f){logger[_0xeb87('0x8')](_0x3fef1f[_0xeb87('0xa')]);return null;}});}logger[_0xeb87('0x1f')](util[_0xeb87('0x1d')](_0xeb87('0x35'),_0x1d5686['arg_1'],_0x1d5686['calleridname'],_0x1d5686[_0xeb87('0x32')],_0x1d5686['dnid'],_0x1d5686['uniqueid']));logger['info'](util['format'](_0xeb87('0x36'),_0x1d5686['context'],_0x1d5686[_0xeb87('0x26')],parseInt(_0x1d5686[_0xeb87('0x27')],0xa)+0x1));_0x1d5686[_0xeb87('0x37')](_0x1d5686[_0xeb87('0x25')],_0x1d5686[_0xeb87('0x26')],parseInt(_0x1d5686[_0xeb87('0x27')],0xa)+0x1);_0x1d5686[_0xeb87('0x38')]();}function handleNotFound(_0xa3f3e6){logger['error'](util[_0xeb87('0x1d')](_0xeb87('0x39'),_0xa3f3e6[_0xeb87('0x30')]));_0xa3f3e6[_0xeb87('0x37')](_0xa3f3e6[_0xeb87('0x25')],_0xa3f3e6[_0xeb87('0x26')],parseInt(_0xa3f3e6[_0xeb87('0x27')],0xa)+0x1);_0xa3f3e6[_0xeb87('0x38')]();}function handleUnpublished(_0x1668d9){logger['error'](util[_0xeb87('0x1d')](_0xeb87('0x3a'),_0x1668d9['arg_1']));_0x1668d9[_0xeb87('0x37')](_0x1668d9['context'],_0x1668d9['extension'],parseInt(_0x1668d9[_0xeb87('0x27')],0xa)+0x1);_0x1668d9[_0xeb87('0x38')]();}module[_0xeb87('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6eac=['[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\x20found','Project\x20%s\x20not\x20published','exports','moment','util','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','toJson','mxGraphModel','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x6eac,0xfb));var _0xc6ea=function(_0x316ac7,_0x2f533f){_0x316ac7=_0x316ac7-0x0;var _0x153004=_0x6eac[_0x316ac7];return _0x153004;};'use strict';var _=require('lodash');var moment=require(_0xc6ea('0x0'));var parser=require('xml2json');var util=require(_0xc6ea('0x1'));var logger=require(_0xc6ea('0x2'))(_0xc6ea('0x3'));var rpc=require(_0xc6ea('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0xc6ea('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc6ea('0x6')]()[_0xc6ea('0x7')](function(_0x19cdfb){logger[_0xc6ea('0x8')](_0xc6ea('0x9'),_0x19cdfb[_0xc6ea('0xa')]);return[];});}function addVertex(_0x21e38c,_0xf73d3a,_0x3e850c){_0xf73d3a['agicommand']=_0x3e850c;if(_0xf73d3a[_0xc6ea('0xb')](_0xc6ea('0xc'))){_0xf73d3a[_0xc6ea('0xd')]=parseInt(_0xf73d3a['retry'],0xa);}_0x21e38c[_0xc6ea('0xe')](_['omit'](_0xf73d3a,_0xc6ea('0xf')));}function initGraph(_0x37ca77,_0xf35357){var _0x48411d=new Graph();for(var _0xc11d73 in _0x37ca77){if(_0x37ca77[_0xc6ea('0xb')](_0xc11d73)){if(_[_0xc6ea('0x10')](_0x37ca77[_0xc11d73])){for(var _0x5bf166=0x0;_0x5bf166<_0x37ca77[_0xc11d73][_0xc6ea('0x11')];_0x5bf166+=0x1){addVertex(_0x48411d,_0x37ca77[_0xc11d73][_0x5bf166],_0xc11d73);}}else{addVertex(_0x48411d,_0x37ca77[_0xc11d73],_0xc11d73);}}}for(var _0x341517=0x0;_0x341517<_0xf35357[_0xc6ea('0x11')];_0x341517+=0x1){if(_0xf35357[_0x341517][_0xc6ea('0x12')]&&_0xf35357[_0x341517][_0xc6ea('0x13')]){_0x48411d[_0xc6ea('0x14')](_0xf35357[_0x341517][_0xc6ea('0x12')],_0xf35357[_0x341517][_0xc6ea('0x13')],_0xf35357[_0x341517]['value']);}}return _0x48411d;}function getRoot(_0xd80d29){return parser[_0xc6ea('0x15')](_0xd80d29,{'object':!![]})[_0xc6ea('0x16')]['root'];}function inspect(_0x2119d3){return util['inspect'](_0x2119d3,{'showHidden':![],'depth':null});}function initialize(_0x582c55,_0x403ecc){var _0x248db=getRoot(_0x582c55[_0xc6ea('0x17')]);if(!_0x248db||!_0x248db['start'])return;var _0x5bc818,_0x554ade,_0x1fbb3b;logger[_0xc6ea('0x18')]('root',JSON[_0xc6ea('0x19')](_0x248db,null,0x2));_0x403ecc[_0xc6ea('0x1a')]=moment()[_0xc6ea('0x1b')](_0xc6ea('0x1c'));_0x5bc818=initGraph(_[_0xc6ea('0x1d')](_0x248db,_0xc6ea('0xf')),_0x248db[_0xc6ea('0xf')]);_0x554ade=new Vertices(_0x403ecc,rpc,mailRpc);logger[_0xc6ea('0x1e')](util[_0xc6ea('0x1b')](_0xc6ea('0x1f'),_0x403ecc[_0xc6ea('0x20')],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc[_0xc6ea('0x23')],_0x403ecc[_0xc6ea('0x24')]));_0x5bc818[_0xc6ea('0x25')](_0x248db[_0xc6ea('0x26')]['id'],function(_0x5dca6e){try{_0x5dca6e=_0x554ade[_0xc6ea('0x27')](_0x5dca6e);logger[_0xc6ea('0x18')](_0xc6ea('0x28'),JSON[_0xc6ea('0x19')](_0x5dca6e,null,0x2));if(_0x5dca6e[_0xc6ea('0x29')]===_0xc6ea('0x2a')){logger[_0xc6ea('0x1e')](_0xc6ea('0x2b'));_0x403ecc['context']=_0x5dca6e[_0xc6ea('0x2c')]||_0x403ecc['context'];_0x403ecc[_0xc6ea('0x2d')]=_0x5dca6e['extension'];_0x403ecc[_0xc6ea('0x2e')]=_0x5dca6e[_0xc6ea('0x2e')]?_0x5dca6e['priority']-0x1:0x1;return null;}else if(_0x5dca6e&&_0x554ade[_0x5dca6e[_0xc6ea('0x29')]]){_0x1fbb3b=_0x554ade[_0x5dca6e[_0xc6ea('0x29')]](_0x5dca6e);logger[_0xc6ea('0x1e')](_0xc6ea('0x2f'),JSON[_0xc6ea('0x19')](_0x1fbb3b,null,0x2));if(_0x1fbb3b&&_0x1fbb3b[_0xc6ea('0x30')]===AGI_CODE_SUCCESS&&_0x1fbb3b[_0xc6ea('0x31')]!==AGI_RESULT_ERROR&&!_0x403ecc[_0xc6ea('0x32')]){logger[_0xc6ea('0x18')]('response',inspect(_0x1fbb3b));return _['isUndefined'](_0x1fbb3b[_0xc6ea('0x31')])?null:_0x1fbb3b['result'][_0xc6ea('0x33')]();}else{logger[_0xc6ea('0x8')]('response',inspect(_0x1fbb3b));return null;}}else{logger[_0xc6ea('0x8')](_0xc6ea('0x34'));return null;}}catch(_0x176c71){logger[_0xc6ea('0x8')](_0x176c71['stack']);return null;}});if(_0x248db['finally']){logger['info'](util[_0xc6ea('0x1b')](_0xc6ea('0x35'),_0x403ecc[_0xc6ea('0x20')],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc['dnid'],_0x403ecc[_0xc6ea('0x24')]));_0x5bc818['traverseBFS'](_0x248db['finally']['id'],function(_0x5d95f4){try{_0x5d95f4=_0x554ade[_0xc6ea('0x27')](_0x5d95f4);logger[_0xc6ea('0x18')](_0xc6ea('0x28'),JSON[_0xc6ea('0x19')](_0x5d95f4,null,0x2));if(_0x5d95f4&&_0x554ade[_0x5d95f4[_0xc6ea('0x29')]]){_0x1fbb3b=_0x554ade[_0x5d95f4[_0xc6ea('0x29')]](_0x5d95f4);if(_0x1fbb3b){logger[_0xc6ea('0x18')](_0xc6ea('0x2f'),inspect(_0x1fbb3b));return _['isUndefined'](_0x1fbb3b[_0xc6ea('0x31')])?null:_0x1fbb3b[_0xc6ea('0x31')][_0xc6ea('0x33')]();}else{logger[_0xc6ea('0x8')](_0xc6ea('0x2f'),inspect(_0x1fbb3b));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x213ef8){logger[_0xc6ea('0x8')](_0x213ef8[_0xc6ea('0xa')]);return null;}});}logger['info'](util[_0xc6ea('0x1b')](_0xc6ea('0x36'),_0x403ecc['arg_1'],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc['dnid'],_0x403ecc[_0xc6ea('0x24')]));logger[_0xc6ea('0x1e')](util[_0xc6ea('0x1b')](_0xc6ea('0x37'),_0x403ecc[_0xc6ea('0x2c')],_0x403ecc[_0xc6ea('0x2d')],parseInt(_0x403ecc[_0xc6ea('0x2e')],0xa)+0x1));_0x403ecc[_0xc6ea('0x38')](_0x403ecc['context'],_0x403ecc[_0xc6ea('0x2d')],parseInt(_0x403ecc['priority'],0xa)+0x1);_0x403ecc[_0xc6ea('0x39')]();}function handleNotFound(_0x56febd){logger[_0xc6ea('0x8')](util[_0xc6ea('0x1b')](_0xc6ea('0x3a'),_0x56febd['arg_1']));_0x56febd[_0xc6ea('0x38')](_0x56febd[_0xc6ea('0x2c')],_0x56febd['extension'],parseInt(_0x56febd[_0xc6ea('0x2e')],0xa)+0x1);_0x56febd[_0xc6ea('0x39')]();}function handleUnpublished(_0xd0835){logger[_0xc6ea('0x8')](util[_0xc6ea('0x1b')](_0xc6ea('0x3b'),_0xd0835['arg_1']));_0xd0835[_0xc6ea('0x38')](_0xd0835[_0xc6ea('0x2c')],_0xd0835['extension'],parseInt(_0xd0835['priority'],0xa)+0x1);_0xd0835[_0xc6ea('0x39')]();}module[_0xc6ea('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2032fb3..4f809db 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 _0xed7a=['slice','trim','emit','headers','line','length','exports','util','stream','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split'];(function(_0x194b73,_0x214929){var _0x455052=function(_0x59cf45){while(--_0x59cf45){_0x194b73['push'](_0x194b73['shift']());}};_0x455052(++_0x214929);}(_0xed7a,0x9f));var _0xaed7=function(_0x59f1cb,_0x49e9a4){_0x59f1cb=_0x59f1cb-0x0;var _0x256c56=_0xed7a[_0x59f1cb];return _0x256c56;};'use strict';var util=require(_0xaed7('0x0'));var Transform=require(_0xaed7('0x1'))['Transform'];function AGIReply(_0x2e794f){Transform[_0xaed7('0x2')](this,_0x2e794f);this[_0xaed7('0x3')]='';this[_0xaed7('0x4')]=![];}util[_0xaed7('0x5')](AGIReply,Transform);AGIReply['prototype'][_0xaed7('0x6')]=function(_0x31b535,_0x2b2051,_0x5ed883){var _0x26a82b='\x0a',_0x44b9da=['\x0a\x0a',_0xaed7('0x7')],_0x5715ff=-0x1,_0x2a21b4=-0x1,_0x5250e9='',_0x5a4b19=0x0,_0x257794='',_0x12edbd='';this[_0xaed7('0x3')]+=_0x31b535[_0xaed7('0x8')]();_0x257794=this[_0xaed7('0x3')];if(!this['_inBody']){_0x5a4b19=0x0;while(_0x44b9da[_0x5a4b19]){while((_0x2a21b4=_0x257794[_0xaed7('0x9')](_0x44b9da[_0x5a4b19]))!=-0x1){_0x5250e9=_0x44b9da[_0x5a4b19];_0x12edbd=_0x257794[_0xaed7('0xa')](0x0,_0x2a21b4);_0x257794=_0x257794[_0xaed7('0xa')](_0x2a21b4+_0x5250e9['length']);var _0xdc215=_0x12edbd[_0xaed7('0xb')](_0x26a82b),_0x4fabef=0x0,_0x49dd03={},_0x1f4f5b='',_0x4f32b2='',_0x596829=-0x1;while(_0xdc215[_0x4fabef]){_0x596829=_0xdc215[_0x4fabef][_0xaed7('0x9')](':');if(_0x596829!=-0x1){_0x1f4f5b=_0xdc215[_0x4fabef][_0xaed7('0xc')](0x0,_0x596829)[_0xaed7('0xd')]();_0x4f32b2=_0xdc215[_0x4fabef][_0xaed7('0xc')](_0x596829+0x1)[_0xaed7('0xd')]();if(_0x1f4f5b['length']>0x0){_0x49dd03[_0x1f4f5b]=_0x4f32b2;}}else{}_0x4fabef++;}this[_0xaed7('0xe')](_0xaed7('0xf'),_0x49dd03);this[_0xaed7('0x4')]=!![];}_0x5a4b19++;}this['_localBuffer']=_0x257794;}else{while((_0x5715ff=_0x257794[_0xaed7('0x9')](_0x26a82b))!=-0x1){_0x12edbd=_0x257794[_0xaed7('0xa')](0x0,_0x5715ff);this[_0xaed7('0xe')](_0xaed7('0x10'),_0x12edbd);_0x257794=_0x257794[_0xaed7('0xa')](_0x5715ff+_0x26a82b[_0xaed7('0x11')]);}this['_localBuffer']=_0x257794;}_0x5ed883();};module[_0xaed7('0x12')]=AGIReply; \ No newline at end of file +var _0x6c56=['stream','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','emit','util'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x6c56,0x1af));var _0x66c5=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x6c56[_0x3a7db0];return _0x17cbba;};'use strict';var util=require(_0x66c5('0x0'));var Transform=require(_0x66c5('0x1'))[_0x66c5('0x2')];function AGIReply(_0xa2089){Transform[_0x66c5('0x3')](this,_0xa2089);this[_0x66c5('0x4')]='';this[_0x66c5('0x5')]=![];}util[_0x66c5('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x66c5('0x7')]=function(_0x10bb09,_0x1afeca,_0x4e56b7){var _0x405e1b='\x0a',_0x5dc4e3=['\x0a\x0a',_0x66c5('0x8')],_0x1a0808=-0x1,_0x23debe=-0x1,_0x157683='',_0x48b564=0x0,_0x1df373='',_0x39332a='';this[_0x66c5('0x4')]+=_0x10bb09[_0x66c5('0x9')]();_0x1df373=this[_0x66c5('0x4')];if(!this[_0x66c5('0x5')]){_0x48b564=0x0;while(_0x5dc4e3[_0x48b564]){while((_0x23debe=_0x1df373[_0x66c5('0xa')](_0x5dc4e3[_0x48b564]))!=-0x1){_0x157683=_0x5dc4e3[_0x48b564];_0x39332a=_0x1df373[_0x66c5('0xb')](0x0,_0x23debe);_0x1df373=_0x1df373[_0x66c5('0xb')](_0x23debe+_0x157683[_0x66c5('0xc')]);var _0x49897d=_0x39332a[_0x66c5('0xd')](_0x405e1b),_0x2fc05c=0x0,_0x38735d={},_0x35f4d8='',_0x2c03bd='',_0x418e3e=-0x1;while(_0x49897d[_0x2fc05c]){_0x418e3e=_0x49897d[_0x2fc05c][_0x66c5('0xa')](':');if(_0x418e3e!=-0x1){_0x35f4d8=_0x49897d[_0x2fc05c][_0x66c5('0xe')](0x0,_0x418e3e)[_0x66c5('0xf')]();_0x2c03bd=_0x49897d[_0x2fc05c][_0x66c5('0xe')](_0x418e3e+0x1)[_0x66c5('0xf')]();if(_0x35f4d8[_0x66c5('0xc')]>0x0){_0x38735d[_0x35f4d8]=_0x2c03bd;}}else{}_0x2fc05c++;}this['emit'](_0x66c5('0x10'),_0x38735d);this[_0x66c5('0x5')]=!![];}_0x48b564++;}this[_0x66c5('0x4')]=_0x1df373;}else{while((_0x1a0808=_0x1df373[_0x66c5('0xa')](_0x405e1b))!=-0x1){_0x39332a=_0x1df373['substring'](0x0,_0x1a0808);this[_0x66c5('0x11')]('line',_0x39332a);_0x1df373=_0x1df373[_0x66c5('0xb')](_0x1a0808+_0x405e1b['length']);}this['_localBuffer']=_0x1df373;}_0x4e56b7();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3d30e0f..7aa28b8 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 _0x99c9=['agentLogout','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','UnpauseUser'];(function(_0x30a2af,_0x528290){var _0x4ac83d=function(_0x2b7cbe){while(--_0x2b7cbe){_0x30a2af['push'](_0x30a2af['shift']());}};_0x4ac83d(++_0x528290);}(_0x99c9,0x13c));var _0x999c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x99c9[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x999c('0x0'));var moment=require(_0x999c('0x1'));var jayson=require(_0x999c('0x2'));var client=jayson[_0x999c('0x3')][_0x999c('0x4')]({'port':0x2329});function request(_0x16a7a3,_0x31e9b1){return new Promise(function(_0x52dc75,_0x2a4e06){return client[_0x999c('0x5')](_0x16a7a3,_0x31e9b1)[_0x999c('0x6')](function(_0x347ee0){if(_0x347ee0[_0x999c('0x7')]){return _0x2a4e06(_0x347ee0[_0x999c('0x7')][_0x999c('0x8')]);}else{return _0x52dc75(_0x347ee0[_0x999c('0x9')]);}})[_0x999c('0xa')](function(_0xb88ec1){return _0x2a4e06(_0xb88ec1);});});}exports[_0x999c('0xb')]=function(){return request(_0x999c('0xc'),{'options':{'raw':![],'attributes':['id',_0x999c('0xd'),_0x999c('0xe')]}});};exports['getSquareProject']=function(_0x1f3f8f){return request(_0x999c('0xf'),{'options':{'raw':![],'where':{'name':_0x1f3f8f},'attributes':['production']}});};exports[_0x999c('0x10')]=function(_0x140c4b){return request(_0x999c('0x11'),{'options':{'raw':![],'where':{'id':_0x140c4b},'include':[{'model':_0x999c('0x12'),'as':_0x999c('0x13'),'include':[{'model':_0x999c('0x14'),'as':_0x999c('0x14')}]}],'attributes':['id',_0x999c('0xd'),_0x999c('0x15')],'smtp':!![]}});};exports[_0x999c('0x16')]=function(_0x5b11ff){return request(_0x999c('0xf'),{'options':{'where':{'id':_0x5b11ff},'attributes':['name']}});};exports[_0x999c('0x17')]=function(_0xd14862){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xd14862},'attributes':['name']}});};exports['getVariableById']=function(_0x161434){return request(_0x999c('0x18'),{'options':{'where':{'id':_0x161434},'attributes':[_0x999c('0xd')]}});};exports[_0x999c('0x19')]=function(_0x2a6667){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2a6667},'attributes':[_0x999c('0x1a')]}});};exports[_0x999c('0x1b')]=function(_0x2b6126){return request(_0x999c('0x1c'),{'options':{'where':{'id':_0x2b6126},'attributes':[_0x999c('0xd')]}});};exports['getContactByPhone']=function(_0x1b327f){return request(_0x999c('0x1d'),{'options':{'where':{'phone':_0x1b327f[_0x999c('0x1e')]},'attributes':['id']}});};exports[_0x999c('0x1f')]=function(_0x32c66c){return request('ShowTrunk',{'options':{'where':{'id':_0x32c66c},'attributes':[_0x999c('0xd')]}});};exports[_0x999c('0x20')]=function(_0x26abbb){return request(_0x999c('0x21'),{'options':{'where':{'id':_0x26abbb},'attributes':[_0x999c('0x22')]}});};exports[_0x999c('0x23')]=function(_0x4a2865){return request(_0x999c('0x24'),{'options':{'raw':![],'where':{'id':_0x4a2865},'include':[{'model':_0x999c('0x25'),'as':_0x999c('0x26')}]}});};exports[_0x999c('0x27')]=function(_0x1c6e55){return request(_0x999c('0x28'),{'options':{'where':{'id':_0x1c6e55},'attributes':['id',_0x999c('0xd')]}});};exports[_0x999c('0x29')]=function(_0x4002d2){return request(_0x999c('0x2a'),{'body':_0x4002d2});};exports[_0x999c('0x2b')]=function(_0x53a319){return request(_0x999c('0x2c'),{'body':_0x53a319});};exports[_0x999c('0x2d')]=function(_0x336309){return request(_0x999c('0x2e'),{'body':_[_0x999c('0x2f')](_0x336309,{'project_name':_0x336309[_0x999c('0x30')],'prev_project_name':_0x336309['arg_2']||'','is_subproject':_0x336309[_0x999c('0x31')]?!![]:![],'leaveAt':moment()[_0x999c('0x32')](_0x999c('0x33'))})});};exports['createSquareRecording']=function(_0x1abac6){return request(_0x999c('0x34'),{'body':_0x1abac6});};exports['createSquareMessage']=function(_0x6e5e54){return request('CreateSquareMessage',{'body':_0x6e5e54});};exports['createCmContact']=function(_0xedf57d){return request(_0x999c('0x35'),{'options':{'raw':![],'where':{'phone':_0xedf57d[_0x999c('0x1e')],'ListId':_0xedf57d[_0x999c('0x36')]}}})[_0x999c('0x6')](function(_0x42c2e8){if(_0x42c2e8){return _0x42c2e8;}return request(_0x999c('0x37'),{'body':_0xedf57d});});};exports[_0x999c('0x38')]=function(_0x352c25){return request(_0x999c('0x39'),{'options':{'where':{'id':_0x352c25},'attributes':['name']}});};exports[_0x999c('0x3a')]=function(_0x192976,_0x3f66ae){return request(_0x999c('0x3b'),{'body':{'interface':_0x3f66ae},'options':{'where':_0x192976}});};exports[_0x999c('0x3c')]=function(_0x1d0ba6,_0x4427b4,_0x362735){return request('PauseUser',{'body':{'type':_0x4427b4,'uniqueid':_0x362735},'options':{'where':_0x1d0ba6}});};exports['agentUnpause']=function(_0x2fa094){return request(_0x999c('0x3d'),{'body':{},'options':{'where':_0x2fa094}});};exports[_0x999c('0x3e')]=function(_0x3872b7){return request('LogoutUser',{'body':{},'options':{'where':_0x3872b7}});}; \ No newline at end of file +var _0x0d4e=['getVariableById','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0d4e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xe0d4('0x0'));var moment=require(_0xe0d4('0x1'));var jayson=require(_0xe0d4('0x2'));var client=jayson[_0xe0d4('0x3')][_0xe0d4('0x4')]({'port':0x2329});function request(_0xe383c4,_0xbfd24e){return new Promise(function(_0x154d6d,_0x251804){return client['request'](_0xe383c4,_0xbfd24e)[_0xe0d4('0x5')](function(_0x118831){if(_0x118831[_0xe0d4('0x6')]){return _0x251804(_0x118831[_0xe0d4('0x6')]['message']);}else{return _0x154d6d(_0x118831['result']);}})[_0xe0d4('0x7')](function(_0x1ba14d){return _0x251804(_0x1ba14d);});});}exports[_0xe0d4('0x8')]=function(){return request(_0xe0d4('0x9'),{'options':{'raw':![],'attributes':['id',_0xe0d4('0xa'),_0xe0d4('0xb')]}});};exports[_0xe0d4('0xc')]=function(_0xb36d72){return request(_0xe0d4('0xd'),{'options':{'raw':![],'where':{'name':_0xb36d72},'attributes':[_0xe0d4('0xb')]}});};exports[_0xe0d4('0xe')]=function(_0x418ef9){return request(_0xe0d4('0xf'),{'options':{'raw':![],'where':{'id':_0x418ef9},'include':[{'model':'MailServerOut','as':_0xe0d4('0x10'),'include':[{'model':_0xe0d4('0x11'),'as':_0xe0d4('0x11')}]}],'attributes':['id',_0xe0d4('0xa'),_0xe0d4('0x12')],'smtp':!![]}});};exports[_0xe0d4('0x13')]=function(_0x423e1c){return request(_0xe0d4('0xd'),{'options':{'where':{'id':_0x423e1c},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x14')]=function(_0x3bbfd3){return request(_0xe0d4('0x15'),{'options':{'where':{'id':_0x3bbfd3},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x16')]=function(_0x3a2a41){return request('ShowVariable',{'options':{'where':{'id':_0x3a2a41},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x17')]=function(_0xe0d15b){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xe0d15b},'attributes':['dsn']}});};exports[_0xe0d4('0x18')]=function(_0x252b69){return request(_0xe0d4('0x19'),{'options':{'where':{'id':_0x252b69},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x1a')]=function(_0x58bd0a){return request(_0xe0d4('0x1b'),{'options':{'where':{'phone':_0x58bd0a[_0xe0d4('0x1c')]},'attributes':['id']}});};exports[_0xe0d4('0x1d')]=function(_0x20795b){return request(_0xe0d4('0x1e'),{'options':{'where':{'id':_0x20795b},'attributes':['name']}});};exports[_0xe0d4('0x1f')]=function(_0x4fe73c){return request('ShowSound',{'options':{'where':{'id':_0x4fe73c},'attributes':[_0xe0d4('0x20')]}});};exports[_0xe0d4('0x21')]=function(_0x20c2c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x20c2c8},'include':[{'model':_0xe0d4('0x22'),'as':_0xe0d4('0x23')}]}});};exports[_0xe0d4('0x24')]=function(_0xb97419){return request(_0xe0d4('0x25'),{'options':{'where':{'id':_0xb97419},'attributes':['id',_0xe0d4('0xa')]}});};exports[_0xe0d4('0x26')]=function(_0x18613d){return request(_0xe0d4('0x27'),{'body':_0x18613d});};exports['createSquareDetailsReport']=function(_0x29fb66){return request(_0xe0d4('0x28'),{'body':_0x29fb66});};exports['createSquareReport']=function(_0x2c149b){return request('CreateSquareReport',{'body':_[_0xe0d4('0x29')](_0x2c149b,{'project_name':_0x2c149b[_0xe0d4('0x2a')],'prev_project_name':_0x2c149b[_0xe0d4('0x2b')]||'','is_subproject':_0x2c149b['arg_2']?!![]:![],'leaveAt':moment()[_0xe0d4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x33be37){return request(_0xe0d4('0x2d'),{'body':_0x33be37});};exports[_0xe0d4('0x2e')]=function(_0x245ca3){return request(_0xe0d4('0x2f'),{'body':_0x245ca3});};exports[_0xe0d4('0x30')]=function(_0xcae18f){return request(_0xe0d4('0x31'),{'options':{'raw':![],'where':{'phone':_0xcae18f[_0xe0d4('0x1c')],'ListId':_0xcae18f[_0xe0d4('0x32')]}}})[_0xe0d4('0x5')](function(_0x3f6b3c){if(_0x3f6b3c){return _0x3f6b3c;}return request(_0xe0d4('0x33'),{'body':_0xcae18f});});};exports[_0xe0d4('0x34')]=function(_0x52348b){return request(_0xe0d4('0x35'),{'options':{'where':{'id':_0x52348b},'attributes':['name']}});};exports[_0xe0d4('0x36')]=function(_0x2b6a86,_0x45ca4b){return request(_0xe0d4('0x37'),{'body':{'interface':_0x45ca4b},'options':{'where':_0x2b6a86}});};exports[_0xe0d4('0x38')]=function(_0x180915,_0x3d979b,_0x17eded){return request(_0xe0d4('0x39'),{'body':{'type':_0x3d979b,'uniqueid':_0x17eded},'options':{'where':_0x180915}});};exports[_0xe0d4('0x3a')]=function(_0x2f4c67){return request(_0xe0d4('0x3b'),{'body':{},'options':{'where':_0x2f4c67}});};exports['agentLogout']=function(_0x3dbbb8){return request('LogoutUser',{'body':{},'options':{'where':_0x3dbbb8}});}; \ 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 2c4b9d3..2ec3d9a 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 _0x8585=['exports','./polly','./lex'];(function(_0x2d72be,_0x202d4a){var _0x3e0394=function(_0x3788dd){while(--_0x3788dd){_0x2d72be['push'](_0x2d72be['shift']());}};_0x3e0394(++_0x202d4a);}(_0x8585,0x64));var _0x5858=function(_0x599e2b,_0x4610f0){_0x599e2b=_0x599e2b-0x0;var _0x18cf7b=_0x8585[_0x599e2b];return _0x18cf7b;};var polly=require(_0x5858('0x0'));var lex=require(_0x5858('0x1'));module[_0x5858('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb4c7=['exports','./polly','./lex'];(function(_0x23ab27,_0x33b148){var _0x212bc7=function(_0xe0d563){while(--_0xe0d563){_0x23ab27['push'](_0x23ab27['shift']());}};_0x212bc7(++_0x33b148);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4b9128,_0x176a8e){_0x4b9128=_0x4b9128-0x0;var _0x25b36d=_0xb4c7[_0x4b9128];return _0x25b36d;};var polly=require(_0x7b4c('0x0'));var lex=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'polly':polly,'lex':lex}; \ 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 5f30525..994559a 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(_0x3a6c91,_0x30e3bf){var _0xee8404=function(_0x47fe21){while(--_0x47fe21){_0x3a6c91['push'](_0x3a6c91['shift']());}};_0xee8404(++_0x30e3bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x9cd965,_0x1a42e7){var _0x1ba4e6=function(_0x526a54){while(--_0x526a54){_0x9cd965['push'](_0x9cd965['shift']());}};_0x1ba4e6(++_0x1a42e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 41afb04..ddc413a 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 _0x7d1a=['exports','./lib/api'];(function(_0xbc8880,_0x166c0c){var _0x3277e3=function(_0x1a5ee6){while(--_0x1a5ee6){_0xbc8880['push'](_0xbc8880['shift']());}};_0x3277e3(++_0x166c0c);}(_0x7d1a,0x129));var _0xa7d1=function(_0x488d68,_0x234dd4){_0x488d68=_0x488d68-0x0;var _0x1862d8=_0x7d1a[_0x488d68];return _0x1862d8;};'use strict';var polly=require(_0xa7d1('0x0'));module[_0xa7d1('0x1')]=function(_0x5aac91,_0x3c7112,_0x2952c8,_0x49e2db,_0x4f5021,_0x168b1b,_0x18f4fa){return polly(_0x5aac91,_0x3c7112,_0x2952c8,_0x49e2db,_0x4f5021,_0x168b1b,_0x18f4fa);}; \ No newline at end of file +var _0x6655=['exports','./lib/api'];(function(_0x3d6a72,_0x55e5c9){var _0x39cd5d=function(_0xc05977){while(--_0xc05977){_0x3d6a72['push'](_0x3d6a72['shift']());}};_0x39cd5d(++_0x55e5c9);}(_0x6655,0x141));var _0x5665=function(_0x35d32c,_0x5bba8b){_0x35d32c=_0x35d32c-0x0;var _0x5ac55d=_0x6655[_0x35d32c];return _0x5ac55d;};'use strict';var polly=require(_0x5665('0x0'));module[_0x5665('0x1')]=function(_0x1d31b6,_0x5cd670,_0x5c51dc,_0x376112,_0x2a620f,_0xecfc8c,_0x12e41d){return polly(_0x1d31b6,_0x5cd670,_0x5c51dc,_0x376112,_0x2a620f,_0xecfc8c,_0x12e41d);}; \ 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 1a68ab3..9345c9e 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 _0x284c=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2016a2,_0x545951){var _0x203456=function(_0xaad80e){while(--_0xaad80e){_0x2016a2['push'](_0x2016a2['shift']());}};_0x203456(++_0x545951);}(_0x284c,0x7a));var _0xc284=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x284c[_0x3b380d];return _0x54502b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xc284('0x0'));var AWS=require(_0xc284('0x1'));function pollyResult(_0x12f2e2,_0x1ebb06,_0x4cb8ac){return new BPromise(function(_0x22e8f3,_0xf1466d){_0x12f2e2['synthesizeSpeech'](_0x1ebb06,function(_0xaa9f2e,_0x4aa3f7){if(_0xaa9f2e){_0xf1466d(_0xaa9f2e);}else if(_0x4aa3f7){if(_0x4aa3f7[_0xc284('0x2')]instanceof Buffer){fs['writeFile'](_0x4cb8ac,_0x4aa3f7[_0xc284('0x2')],function(_0x372f2e){if(_0x372f2e){_0xf1466d(_0x372f2e);}else{_0x22e8f3();}});}else{_0xf1466d(new Error(_0xc284('0x3')));}}else{_0xf1466d(new Error(_0xc284('0x4')));}});});}module['exports']=function(_0x8e6106,_0x36d9aa,_0x305f50,_0x4310a5,_0x1cc5da,_0x229d1f,_0x2f512c){var _0x43957c=new AWS[(_0xc284('0x5'))]({'accessKeyId':_0x8e6106,'secretAccessKey':_0x36d9aa,'region':_0x305f50});var _0xc15398={'Text':_0x1cc5da,'TextType':_0x229d1f||_0xc284('0x6'),'OutputFormat':'mp3','VoiceId':_0x4310a5};return pollyResult(_0x43957c,_0xc15398,_0x2f512c);}; \ No newline at end of file +var _0xe257=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x5b6e58,_0x45efd9){var _0x56c7df=function(_0x114e56){while(--_0x114e56){_0x5b6e58['push'](_0x5b6e58['shift']());}};_0x56c7df(++_0x45efd9);}(_0xe257,0xf8));var _0x7e25=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xe257[_0x35007a];return _0x574f68;};'use strict';var fs=require('fs');var path=require(_0x7e25('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x7e25('0x1'));function pollyResult(_0x637616,_0x15c4f9,_0x70da88){return new BPromise(function(_0x1d56ab,_0x4c82ba){_0x637616[_0x7e25('0x2')](_0x15c4f9,function(_0xfc225e,_0x381e65){if(_0xfc225e){_0x4c82ba(_0xfc225e);}else if(_0x381e65){if(_0x381e65[_0x7e25('0x3')]instanceof Buffer){fs[_0x7e25('0x4')](_0x70da88,_0x381e65[_0x7e25('0x3')],function(_0x4486de){if(_0x4486de){_0x4c82ba(_0x4486de);}else{_0x1d56ab();}});}else{_0x4c82ba(new Error(_0x7e25('0x5')));}}else{_0x4c82ba(new Error(_0x7e25('0x6')));}});});}module[_0x7e25('0x7')]=function(_0x30c6c5,_0x569eda,_0x12dbb1,_0x4480a3,_0x45d9c9,_0x450037,_0x4b25b9){var _0x4599e8=new AWS['Polly']({'accessKeyId':_0x30c6c5,'secretAccessKey':_0x569eda,'region':_0x12dbb1});var _0x4d7aa0={'Text':_0x45d9c9,'TextType':_0x450037||'text','OutputFormat':_0x7e25('0x8'),'VoiceId':_0x4480a3};return pollyResult(_0x4599e8,_0x4d7aa0,_0x4b25b9);}; \ 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 c644f91..b8f1266 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 _0xf515=['./lib/api','exports'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xf515,0x19a));var _0x5f51=function(_0x39e2cf,_0xdc3ab){_0x39e2cf=_0x39e2cf-0x0;var _0x41b9f3=_0xf515[_0x39e2cf];return _0x41b9f3;};'use strict';var asr=require(_0x5f51('0x0'));module[_0x5f51('0x1')]=function(_0x596971,_0x311d97,_0x3ad60c,_0x418836){return asr(_0x596971,_0x311d97,_0x3ad60c);}; \ No newline at end of file +var _0x9d1d=['./lib/api'];(function(_0x4b10b3,_0x482a85){var _0x51a75c=function(_0x2e4bf9){while(--_0x2e4bf9){_0x4b10b3['push'](_0x4b10b3['shift']());}};_0x51a75c(++_0x482a85);}(_0x9d1d,0x112));var _0xd9d1=function(_0x39e478,_0x523d36){_0x39e478=_0x39e478-0x0;var _0x1ed14a=_0x9d1d[_0x39e478];return _0x1ed14a;};'use strict';var asr=require(_0xd9d1('0x0'));module['exports']=function(_0x54be93,_0x1d6f9a,_0x3ee217,_0x49a6e9){return asr(_0x54be93,_0x1d6f9a,_0x3ee217);}; \ 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 2675e6d..1e90e31 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 _0xb201=['LINEAR16','url','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST'];(function(_0x1a0a6e,_0x2a3938){var _0x5e186d=function(_0x58c8a4){while(--_0x58c8a4){_0x1a0a6e['push'](_0x1a0a6e['shift']());}};_0x5e186d(++_0x2a3938);}(_0xb201,0x1b1));var _0x1b20=function(_0x12667c,_0x13301d){_0x12667c=_0x12667c-0x0;var _0x3c9694=_0xb201[_0x12667c];return _0x3c9694;};'use strict';var url=require(_0x1b20('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x1b20('0x1');module[_0x1b20('0x2')]=function(_0x3c9ef4,_0x30b3a4,_0x43521c){return new BPromise(function(_0x1fc27a,_0x48d5c9){var _0x3aae83;if(typeof _0x3c9ef4!==_0x1b20('0x3')||_0x3c9ef4[_0x1b20('0x4')]===0x0){return _0x48d5c9('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x30b3a4!==_0x1b20('0x3')||_0x30b3a4['length']===0x0){return _0x48d5c9(_0x1b20('0x5'));}if(typeof _0x43521c!==_0x1b20('0x6')&&(typeof _0x43521c!==_0x1b20('0x3')||_0x43521c[_0x1b20('0x4')]===0x0)){return _0x48d5c9('lang\x20should\x20be\x20a\x20string');}try{_0x3aae83=fs[_0x1b20('0x7')](_0x3c9ef4)[_0x1b20('0x8')](_0x1b20('0x9'));}catch(_0x490a84){return _0x48d5c9(_0x490a84);}return _0x1fc27a({'method':_0x1b20('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x30b3a4,'body':{'config':{'encoding':_0x1b20('0xb'),'sampleRateHertz':'8000','languageCode':_0x43521c},'audio':{'content':_0x3aae83}},'json':!![]});});}; \ No newline at end of file +var _0x6658=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x4cf059,_0x175880){var _0x5d9646=function(_0x346670){while(--_0x346670){_0x4cf059['push'](_0x4cf059['shift']());}};_0x5d9646(++_0x175880);}(_0x6658,0x198));var _0x8665=function(_0x4050f8,_0x1f8899){_0x4050f8=_0x4050f8-0x0;var _0xcb36d0=_0x6658[_0x4050f8];return _0xcb36d0;};'use strict';var url=require(_0x8665('0x0'));var BPromise=require(_0x8665('0x1'));var fs=require('fs');var host=_0x8665('0x2');module[_0x8665('0x3')]=function(_0x45eb4a,_0x454e7c,_0x252590){return new BPromise(function(_0x49b4d3,_0x4f1343){var _0xf643d8;if(typeof _0x45eb4a!==_0x8665('0x4')||_0x45eb4a['length']===0x0){return _0x4f1343('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x454e7c!==_0x8665('0x4')||_0x454e7c[_0x8665('0x5')]===0x0){return _0x4f1343(_0x8665('0x6'));}if(typeof _0x252590!==_0x8665('0x7')&&(typeof _0x252590!==_0x8665('0x4')||_0x252590[_0x8665('0x5')]===0x0)){return _0x4f1343(_0x8665('0x8'));}try{_0xf643d8=fs[_0x8665('0x9')](_0x45eb4a)['toString'](_0x8665('0xa'));}catch(_0x20da7d){return _0x4f1343(_0x20da7d);}return _0x49b4d3({'method':_0x8665('0xb'),'uri':host+_0x8665('0xc')+_0x454e7c,'body':{'config':{'encoding':_0x8665('0xd'),'sampleRateHertz':_0x8665('0xe'),'languageCode':_0x252590},'audio':{'content':_0xf643d8}},'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 006323b..8922882 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 _0x4051=['exports'];(function(_0x43e440,_0x1a6a78){var _0x1f9dd6=function(_0xf0f70b){while(--_0xf0f70b){_0x43e440['push'](_0x43e440['shift']());}};_0x1f9dd6(++_0x1a6a78);}(_0x4051,0x133));var _0x1405=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x4051[_0xaa1b3e];return _0x454d7d;};var asr=require('./asr');module[_0x1405('0x0')]={'asr':asr}; \ No newline at end of file +var _0x2ac6=['./asr','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ac6,0x74));var _0x62ac=function(_0x513c52,_0xeeea01){_0x513c52=_0x513c52-0x0;var _0x51b5f=_0x2ac6[_0x513c52];return _0x51b5f;};var asr=require(_0x62ac('0x0'));module[_0x62ac('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 04a5ebb..16f594b 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 _0x3833=['generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','data','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','action','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','https','md5','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','error','download\x20error','pipe','end','protocol','request\x20to\x20','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null'];(function(_0x208002,_0x282a1c){var _0x77a48a=function(_0x1cd45f){while(--_0x1cd45f){_0x208002['push'](_0x208002['shift']());}};_0x77a48a(++_0x282a1c);}(_0x3833,0x1eb));var _0x3383=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x3833[_0x4b2863];return _0x567d67;};'use strict';var apiai=require(_0x3383('0x0'));var BPromise=require(_0x3383('0x1'));var dialogflow=require(_0x3383('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x3383('0x3'));var md5=require(_0x3383('0x4'));var path=require('path');var querystring=require('querystring');var rp=require(_0x3383('0x5'));var rs=require(_0x3383('0x6'));var sox=require(_0x3383('0x7'));var tts=require(_0x3383('0x8'));var urlParse=require(_0x3383('0x9'))['parse'];var util=require(_0x3383('0xa'));var aws=require(_0x3383('0xb'));var google=require(_0x3383('0xc'));var sestek=require(_0x3383('0xd'));var tilde=require(_0x3383('0xe'));var logger=require(_0x3383('0xf'))(_0x3383('0x10'));var ISPEECH_API=_0x3383('0x11');function downloadFile(_0x2b51d2,_0x47eb41){return new BPromise(function(_0x56ae74,_0x562b8e){var _0x4b2c53=urlParse(_0x2b51d2);var _0x20f380=_0x4b2c53['protocol']===_0x3383('0x12')?https:http;var _0x4145dc={'host':_0x4b2c53[_0x3383('0x13')],'path':_0x4b2c53[_0x3383('0x14')],'headers':{'user-agent':_0x3383('0x15')}};_0x20f380[_0x3383('0x16')](_0x4145dc,function(_0x560ced){if(_0x560ced[_0x3383('0x17')]!==0xc8){logger['error']('request\x20to\x20'+_0x2b51d2+_0x3383('0x18')+_0x560ced[_0x3383('0x17')]+'\x20('+_0x560ced['statusMessage']+')');_0x562b8e(new Error('request\x20to\x20'+_0x2b51d2+_0x3383('0x18')+_0x560ced['statusCode']+'\x20('+_0x560ced[_0x3383('0x19')]+')'));return;}var _0x360357=fs[_0x3383('0x1a')](_0x47eb41);_0x360357['on'](_0x3383('0x1b'),function(){logger[_0x3383('0x1c')](_0x3383('0x1d'));_0x360357[_0x3383('0x1e')](_0x56ae74);});_0x360357['on']('error',function(_0x42ecf){fs[_0x3383('0x1f')](_0x47eb41);logger[_0x3383('0x20')](_0x3383('0x21'),_0x42ecf);_0x562b8e(_0x42ecf);});_0x560ced[_0x3383('0x22')](_0x360357);})['on'](_0x3383('0x20'),function(_0x3c4dc1){logger['error'](_0x3c4dc1);_0x562b8e(_0x3c4dc1);})[_0x3383('0x23')]();});}function uploadFile(_0xde86e7){return new BPromise(function(_0xef383b,_0x5c21f3){var _0x423bb6=urlParse(_0xde86e7);var _0x3740ec=_0x423bb6[_0x3383('0x24')]==='https:'?https:http;var _0x38251d={'host':_0x423bb6[_0x3383('0x13')],'path':_0x423bb6[_0x3383('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x3740ec[_0x3383('0x16')](_0x38251d,function(_0x3ec9fd){if(_0x3ec9fd['statusCode']!==0xc8){_0x5c21f3(new Error(_0x3383('0x25')+_0xde86e7+_0x3383('0x18')+_0x3ec9fd[_0x3383('0x17')]+'\x20('+_0x3ec9fd[_0x3383('0x19')]+')'));return;}var _0x260eef='';_0x3ec9fd['on']('data',function(_0x454ab6){_0x260eef+=_0x454ab6;});_0x3ec9fd['on'](_0x3383('0x23'),function(){_0xef383b(_0x260eef);});})['on'](_0x3383('0x20'),function(_0x31a17f){_0x5c21f3(_0x31a17f);})[_0x3383('0x23')]();});}function convertFile(_0x479dd9,_0x569414){return new BPromise(function(_0x1ab731,_0xa1f0b9){var _0x24f69d=sox[_0x3383('0x26')](_0x479dd9,_0x569414,{'sampleRate':0x1f40,'format':_0x3383('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x24f69d['on'](_0x3383('0x20'),function(_0x5e4ee7){logger[_0x3383('0x20')](_0x3383('0x28'),_0x5e4ee7);_0xa1f0b9(_0x5e4ee7);});_0x24f69d['on'](_0x3383('0x23'),function(){logger[_0x3383('0x1c')](_0x3383('0x29'));_0x1ab731();});_0x24f69d['start']();});}function base64Decode(_0xbd06e8,_0x4ec176){var _0x2bfb6e=path[_0x3383('0x2a')](__dirname,_0x3383('0x2b'),rs['generate'](0x4)+_0x3383('0x2c'));fs[_0x3383('0x2d')](_0x2bfb6e,_0xbd06e8,_0x3383('0x2e'));return convertFile(_0x2bfb6e,_0x4ec176)[_0x3383('0x2f')](function(){try{fs[_0x3383('0x1f')](_0x2bfb6e);fs[_0x3383('0x30')](_0x4ec176,_0x3383('0x31'));}catch(_0x29a02c){logger[_0x3383('0x20')](_0x29a02c);}return _0x4ec176[_0x3383('0x32')]('.')[0x0];});}function base64Encode(_0xd6af0c){var _0x9b9e1c=fs[_0x3383('0x33')](_0xd6af0c);return new Buffer(_0x9b9e1c)[_0x3383('0x34')](_0x3383('0x2e'));}exports['googleCloudTTS']=function(_0x4b442f,_0x4a5a34,_0x259e3c,_0x496ca9,_0x5ba694,_0x2f9a60){var _0x5a75b3,_0x2714bf;var _0x5d7d04=_0x3383('0x35');var _0x70dbbc=_0x3383('0x36')+_0x4b442f;var _0x208c83={};if(_0x4a5a34===_0x3383('0x37')){_0x208c83[_0x3383('0x38')]={'ssml':_0x259e3c};}else{_0x208c83[_0x3383('0x38')]={'text':_0x259e3c};};_0x208c83[_0x3383('0x39')]={'languageCode':_0x496ca9,'ssmlGender':_0x5ba694};_0x208c83[_0x3383('0x3a')]={'audioEncoding':_0x3383('0x3b'),'sampleRateHertz':0x1f40};var _0x3bc995={'url':_0x5d7d04+'text:synthesize'+_0x70dbbc,'method':_0x3383('0x3c'),'json':!![],'body':_0x208c83};return rp(_0x3bc995)['then'](function(_0x21f0b3){return new BPromise(function(_0x2ed55c,_0x15a779){_0x5a75b3=path[_0x3383('0x2a')](__dirname,_0x3383('0x2b'),rs[_0x3383('0x3d')](0x4)+_0x3383('0x3e'));var _0x18831d=Buffer['from'](_0x21f0b3['audioContent'],'base64');return fs[_0x3383('0x3f')](_0x5a75b3,_0x18831d,function(_0x58bb08){_0x15a779(_0x58bb08);},function(_0x330870){fs['chmodSync'](_0x5a75b3,_0x3383('0x31'));_0x2ed55c(_0x330870);});});})[_0x3383('0x2f')](function(_0x590019){_0x2714bf=path['resolve'](__dirname,_0x3383('0x2b'),rs[_0x3383('0x3d')](0x4)+_0x3383('0x2c'));return convertFile(_0x5a75b3,_0x2714bf);})['then'](function(){try{fs['unlink'](_0x5a75b3);fs[_0x3383('0x30')](_0x2714bf,_0x3383('0x31'));}catch(_0x5085cd){logger['error'](_0x5085cd);}logger[_0x3383('0x1c')](_0x3383('0x40'),_0x2714bf[_0x3383('0x32')]('.')[0x0]);return _0x2714bf[_0x3383('0x32')]('.')[0x0];});};exports[_0x3383('0x41')]=function(_0x25e7a9,_0x56f1a7){var _0x3307ef=_0x3383('0x42');var _0x566cbc,_0x333d21;var _0x46d0bb;var _0x32b51a={'encoding':_0x3383('0x43'),'method':_0x3383('0x3c'),'timeout':0x2710,'url':_0x3307ef,'headers':{'Content-Type':_0x3383('0x44')},'body':_0x3383('0x45')+encodeURIComponent(JSON[_0x3383('0x46')]([[[_0x3383('0x47'),JSON[_0x3383('0x46')]([_0x25e7a9,_0x56f1a7||'en',![],_0x3383('0x48')]),null,_0x3383('0x49')]]]))};return rp(_0x32b51a)[_0x3383('0x2f')](function(_0x41baaa){try{_0x46d0bb=eval(_0x41baaa[_0x3383('0x4a')](0x5))[0x0][0x2];}catch(_0x407f8a){throw new Error(_0x3383('0x4b')+_0x41baaa['data']);}if(!_0x46d0bb){if(_0x25e7a9[_0x3383('0x4c')]>0xc8){throw new Error(_0x3383('0x4d'));}else{throw new Error('lang\x20\x22'+_0x56f1a7+'\x22\x20might\x20not\x20exist');}}try{_0x46d0bb=eval(_0x46d0bb)[0x0];}catch(_0x22db25){throw new Error(_0x3383('0x4b')+res[_0x3383('0x4e')]);}const _0x4e54dc=_0x46d0bb;_0x566cbc=path['resolve'](__dirname,_0x3383('0x2b'),rs['generate'](0x4)+_0x3383('0x3e'));fs[_0x3383('0x2d')](_0x566cbc,_0x46d0bb,{'encoding':'base64'});_0x333d21=path[_0x3383('0x2a')](__dirname,'tmp',rs[_0x3383('0x3d')](0x4)+_0x3383('0x2c'));return convertFile(_0x566cbc,_0x333d21);})[_0x3383('0x2f')](function(){try{fs[_0x3383('0x1f')](_0x566cbc);fs[_0x3383('0x30')](_0x333d21,_0x3383('0x31'));}catch(_0x5f7312){logger[_0x3383('0x20')](_0x5f7312);}logger[_0x3383('0x1c')](_0x3383('0x4f'),_0x333d21[_0x3383('0x32')]('.')[0x0]);return _0x333d21[_0x3383('0x32')]('.')[0x0];});};exports[_0x3383('0x50')]=function(_0x363a9e,_0x71daf,_0x51178e){return google[_0x3383('0x51')](_0x363a9e,_0x71daf,_0x51178e)[_0x3383('0x2f')](function(_0x30b429){logger[_0x3383('0x1c')](_0x30b429[_0x3383('0x52')]);return rp(_0x30b429);})[_0x3383('0x2f')](function(_0x1873db){var _0x4365c7='';var _0x3ba4b1=0x0;try{fs[_0x3383('0x1f')](_0x363a9e);}catch(_0x43b861){logger[_0x3383('0x20')](_0x43b861);}if(_0x1873db&&_0x1873db[_0x3383('0x53')]){_0x4365c7=_0x1873db['results'][_0x3383('0x54')](function(_0x34ab5b){return _0x34ab5b&&_0x34ab5b[_0x3383('0x55')][0x0]&&_0x34ab5b['alternatives'][0x0][_0x3383('0x56')]?_0x34ab5b[_0x3383('0x55')][0x0]['transcript']:'';})[_0x3383('0x57')]('\x0a');_0x3ba4b1=_0x1873db['results'][_0x3383('0x54')](function(_0x310937){return _0x310937&&_0x310937[_0x3383('0x55')][0x0]&&_0x310937[_0x3383('0x55')][0x0][_0x3383('0x58')]?_0x310937[_0x3383('0x55')][0x0][_0x3383('0x58')]:0x0;})[_0x3383('0x57')]('\x0a');}logger[_0x3383('0x1c')](_0x3383('0x59'),_0x4365c7);logger[_0x3383('0x1c')](_0x3383('0x5a'),_0x3ba4b1);return{'transcript':_0x4365c7,'confidence':_0x3ba4b1};})[_0x3383('0x5b')](function(_0x102bf5){logger[_0x3383('0x20')](_0x3383('0x5c'),_0x102bf5[_0x3383('0x17')],_0x102bf5[_0x3383('0x5d')],_0x102bf5[_0x3383('0x5e')]);});};exports[_0x3383('0x5f')]=function(_0x446e1b,_0x5ec375,_0x31e89a,_0x312615){var _0x39a935=apiai(_0x5ec375,{'language':_0x312615||'en'});return _0x39a935['textRequest'](_0x31e89a,{'sessionId':md5(_0x446e1b)})[_0x3383('0x2f')](function(_0x322d82){logger['info'](JSON['stringify'](_0x322d82));return{'source':_0x322d82['result'][_0x3383('0x60')],'resolvedQuery':_0x322d82[_0x3383('0x61')]['resolvedQuery'],'action':_0x322d82[_0x3383('0x61')][_0x3383('0x62')],'actionIncomplete':_0x322d82[_0x3383('0x61')]['actionIncomplete'],'speech':_0x322d82[_0x3383('0x61')]['fulfillment'][_0x3383('0x63')],'score':_0x322d82[_0x3383('0x61')][_0x3383('0x64')],'statusCode':_0x322d82[_0x3383('0x65')][_0x3383('0x66')],'endConversation':_0x322d82[_0x3383('0x61')][_0x3383('0x67')]['endConversation']||![],'isFallbackIntent':_0x322d82[_0x3383('0x61')]['metadata'][_0x3383('0x68')]};});};exports[_0x3383('0x69')]=function(_0x198b47,_0x47e5c1,_0x2ff52d,_0x43c3c2,_0x12927e,_0x3a2acb){var _0x4d8b19=_0x43c3c2['replace'](/\\n/g,'\x0a');var _0xeb2e9e={'credentials':{'private_key':_0x4d8b19,'client_email':_0x2ff52d}};var _0x23415f=new dialogflow[(_0x3383('0x6a'))](_0xeb2e9e);var _0x74085a=_0x23415f[_0x3383('0x6b')](_0x47e5c1,md5(_0x198b47));var _0x5cf334={'session':_0x74085a,'queryInput':{'text':{'text':_0x12927e,'languageCode':_0x3a2acb}}};return _0x23415f['detectIntent'](_0x5cf334)[_0x3383('0x2f')](function(_0x3b7c16){if(_0x3b7c16&&_0x3b7c16[_0x3383('0x4c')]){logger['info'](_0x3383('0x6c'),JSON[_0x3383('0x46')](_0x3b7c16));var _0x13d99e=_0x3b7c16[0x0];if(_0x13d99e){var _0x273379={'action':_0x13d99e[_0x3383('0x6d')][_0x3383('0x62')],'allRequiredParamsPresent':_0x13d99e[_0x3383('0x6d')][_0x3383('0x6e')],'endConversation':_0x13d99e[_0x3383('0x6d')]['diagnosticInfo']&&_0x13d99e['queryResult'][_0x3383('0x6f')][_0x3383('0x70')]?_0x13d99e[_0x3383('0x6d')][_0x3383('0x6f')][_0x3383('0x70')]['end_conversation'][_0x3383('0x71')]:![],'fulfillmentText':_0x13d99e[_0x3383('0x6d')][_0x3383('0x72')],'intentName':_0x13d99e[_0x3383('0x6d')][_0x3383('0x73')][_0x3383('0x5d')],'intentDisplayName':_0x13d99e['queryResult']['intent'][_0x3383('0x74')],'isFallbackIntent':_0x13d99e[_0x3383('0x6d')]['intent'][_0x3383('0x75')],'languageCode':_0x13d99e[_0x3383('0x6d')][_0x3383('0x76')],'queryText':_0x13d99e[_0x3383('0x6d')][_0x3383('0x77')],'responseId':_0x13d99e[_0x3383('0x78')],'score':_0x13d99e[_0x3383('0x6d')]['intentDetectionConfidence'],'speech':_0x13d99e['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x3383('0x46')](_0x3b7c16)};return _0x273379;}}});};exports[_0x3383('0x79')]=function(_0x121125,_0x3d28a0,_0x9719c9,_0x48088a){return tilde[_0x3383('0x51')](_0x121125,_0x3d28a0,_0x9719c9,_0x48088a)[_0x3383('0x2f')](function(_0x3257a8){try{fs[_0x3383('0x1f')](_0x121125);}catch(_0x32984e){logger[_0x3383('0x20')](_0x32984e);}logger[_0x3383('0x1c')](_0x3383('0x7a'),_0x3257a8[_0x3383('0x56')]);logger[_0x3383('0x1c')](_0x3383('0x7b'),_0x3257a8['confidence']);return _0x3257a8;});};exports[_0x3383('0x7c')]=function(_0x386003,_0x5c70bf,_0x26f9a3,_0xb4eaea,_0x36ef4b,_0x4182b6){var _0x31ed31=path['resolve'](__dirname,'tmp',rs[_0x3383('0x3d')](0x4)+'.mp3');var _0x24746d;return aws[_0x3383('0x7d')](_0x386003,_0x5c70bf,_0x26f9a3,_0xb4eaea,_0x36ef4b,_0x4182b6,_0x31ed31)[_0x3383('0x2f')](function(){_0x24746d=path[_0x3383('0x2a')](__dirname,_0x3383('0x2b'),rs[_0x3383('0x3d')](0x4)+'.wav');return convertFile(_0x31ed31,_0x24746d);})[_0x3383('0x2f')](function(){try{fs[_0x3383('0x1f')](_0x31ed31);fs[_0x3383('0x30')](_0x24746d,_0x3383('0x31'));}catch(_0x3e7075){logger[_0x3383('0x20')](_0x3e7075);}return _0x24746d[_0x3383('0x32')]('.')[0x0];});};exports[_0x3383('0x7e')]=function(_0x5c6e7a,_0x517f2f,_0x200881,_0x3fd903,_0x68ed5a,_0x5e98f5){return aws['lex'](_0x5c6e7a,_0x517f2f,_0x200881,_0x3fd903,_0x68ed5a,_0x5e98f5)['then'](function(_0x1f3ae4){logger['info'](JSON[_0x3383('0x46')](_0x1f3ae4));return _0x1f3ae4;});};exports[_0x3383('0x7f')]=function(_0x3c23b0,_0x52a981,_0x78a39e,_0xd9b844){var _0x59a846=util[_0x3383('0x80')](_0x3383('0x81'),ISPEECH_API,_0x3c23b0,encodeURIComponent(_0x52a981),_0x78a39e,_0xd9b844);var _0x262f11=path[_0x3383('0x2a')](__dirname,_0x3383('0x2b'),rs[_0x3383('0x3d')](0x4)+_0x3383('0x3e'));var _0x5004bc;return downloadFile(_0x59a846,_0x262f11)[_0x3383('0x2f')](function(){_0x5004bc=path['resolve'](__dirname,'tmp',rs[_0x3383('0x3d')](0x4)+_0x3383('0x2c'));return convertFile(_0x262f11,_0x5004bc);})[_0x3383('0x2f')](function(){try{fs[_0x3383('0x1f')](_0x262f11);fs['chmodSync'](_0x5004bc,_0x3383('0x31'));}catch(_0x25e4d4){logger['error'](_0x25e4d4);}return _0x5004bc[_0x3383('0x32')]('.')[0x0];});};exports['ispeechASR']=function(_0x31f102,_0x4e315b,_0x127953,_0x310234){var _0x256511=util[_0x3383('0x80')](_0x3383('0x82'),ISPEECH_API,_0x4e315b,_0x127953,base64Encode(_0x31f102),_0x310234?util[_0x3383('0x80')](_0x3383('0x83'),encodeURIComponent(_0x310234)):'freeform=3');return uploadFile(_0x256511)['then'](function(_0x15af6f){return querystring[_0x3383('0x84')](_0x15af6f);});};exports[_0x3383('0x85')]=function(_0x13ff28,_0x316ce5){return sestek[_0x3383('0x86')](_0x13ff28,_0x316ce5)[_0x3383('0x2f')](function(_0x50d37a){logger[_0x3383('0x1c')](JSON['stringify'](_0x50d37a));var _0x1a3baf={'speech':_0x50d37a[_0x3383('0x87')],'action':_0x50d37a[_0x3383('0x88')]?_0x50d37a[_0x3383('0x88')]['CustomAction']:undefined,'actiondata':_0x50d37a[_0x3383('0x88')]?_0x50d37a[_0x3383('0x88')][_0x3383('0x89')]:undefined};if(_0x50d37a[_0x3383('0x88')]&&_0x50d37a[_0x3383('0x88')][_0x3383('0x8a')]){return base64Decode(_0x50d37a[_0x3383('0x88')][_0x3383('0x8a')][_0x3383('0x8b')],path[_0x3383('0x2a')](__dirname,_0x3383('0x2b'),rs['generate'](0x4)+_0x3383('0x2c')))[_0x3383('0x2f')](function(_0xdb7ff2){_0x1a3baf['audiofile']=_0xdb7ff2;return _0x1a3baf;});}return _0x1a3baf;});};exports[_0x3383('0x8c')]=function(){return __dirname;}; \ No newline at end of file +var _0x113c=['fields','end_conversation','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','url','parse','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','uri','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','action','result','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x113c,0x124));var _0xc113=function(_0x1ae2e1,_0x11b301){_0x1ae2e1=_0x1ae2e1-0x0;var _0xa25618=_0x113c[_0x1ae2e1];return _0xa25618;};'use strict';var apiai=require(_0xc113('0x0'));var BPromise=require(_0xc113('0x1'));var dialogflow=require(_0xc113('0x2'));var fs=require('fs');var http=require(_0xc113('0x3'));var https=require(_0xc113('0x4'));var md5=require(_0xc113('0x5'));var path=require(_0xc113('0x6'));var querystring=require(_0xc113('0x7'));var rp=require('request-promise');var rs=require(_0xc113('0x8'));var sox=require(_0xc113('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xc113('0xa'))[_0xc113('0xb')];var util=require(_0xc113('0xc'));var aws=require(_0xc113('0xd'));var google=require('./google');var sestek=require(_0xc113('0xe'));var tilde=require('./tilde');var logger=require(_0xc113('0xf'))(_0xc113('0x10'));var ISPEECH_API=_0xc113('0x11');function downloadFile(_0x13f96d,_0x2ecf2b){return new BPromise(function(_0xdf0063,_0x365604){var _0x8824e9=urlParse(_0x13f96d);var _0x1a7c1e=_0x8824e9[_0xc113('0x12')]===_0xc113('0x13')?https:http;var _0x1b674a={'host':_0x8824e9[_0xc113('0x14')],'path':_0x8824e9[_0xc113('0x6')],'headers':{'user-agent':_0xc113('0x15')}};_0x1a7c1e[_0xc113('0x16')](_0x1b674a,function(_0xda1682){if(_0xda1682[_0xc113('0x17')]!==0xc8){logger[_0xc113('0x18')](_0xc113('0x19')+_0x13f96d+_0xc113('0x1a')+_0xda1682['statusCode']+'\x20('+_0xda1682[_0xc113('0x1b')]+')');_0x365604(new Error('request\x20to\x20'+_0x13f96d+_0xc113('0x1a')+_0xda1682[_0xc113('0x17')]+'\x20('+_0xda1682['statusMessage']+')'));return;}var _0x152116=fs[_0xc113('0x1c')](_0x2ecf2b);_0x152116['on'](_0xc113('0x1d'),function(){logger[_0xc113('0x1e')](_0xc113('0x1f'));_0x152116[_0xc113('0x20')](_0xdf0063);});_0x152116['on']('error',function(_0x40ef1f){fs[_0xc113('0x21')](_0x2ecf2b);logger[_0xc113('0x18')]('download\x20error',_0x40ef1f);_0x365604(_0x40ef1f);});_0xda1682[_0xc113('0x22')](_0x152116);})['on']('error',function(_0x3daa9b){logger['error'](_0x3daa9b);_0x365604(_0x3daa9b);})[_0xc113('0x23')]();});}function uploadFile(_0x24afa2){return new BPromise(function(_0x300a34,_0xad01c6){var _0x2729c2=urlParse(_0x24afa2);var _0x49d5c3=_0x2729c2[_0xc113('0x12')]===_0xc113('0x13')?https:http;var _0x1eca77={'host':_0x2729c2[_0xc113('0x14')],'path':_0x2729c2[_0xc113('0x6')],'headers':{'user-agent':_0xc113('0x15')}};_0x49d5c3[_0xc113('0x16')](_0x1eca77,function(_0x333974){if(_0x333974['statusCode']!==0xc8){_0xad01c6(new Error('request\x20to\x20'+_0x24afa2+_0xc113('0x1a')+_0x333974[_0xc113('0x17')]+'\x20('+_0x333974['statusMessage']+')'));return;}var _0x1c14ba='';_0x333974['on'](_0xc113('0x24'),function(_0x2f0041){_0x1c14ba+=_0x2f0041;});_0x333974['on'](_0xc113('0x23'),function(){_0x300a34(_0x1c14ba);});})['on']('error',function(_0x3c6e19){_0xad01c6(_0x3c6e19);})[_0xc113('0x23')]();});}function convertFile(_0x5edf94,_0x48a2e8){return new BPromise(function(_0x27672e,_0x203e48){var _0x3a1b0b=sox[_0xc113('0x25')](_0x5edf94,_0x48a2e8,{'sampleRate':0x1f40,'format':_0xc113('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3a1b0b['on'](_0xc113('0x18'),function(_0x469136){logger[_0xc113('0x18')](_0xc113('0x27'),_0x469136);_0x203e48(_0x469136);});_0x3a1b0b['on'](_0xc113('0x23'),function(){logger[_0xc113('0x1e')](_0xc113('0x28'));_0x27672e();});_0x3a1b0b[_0xc113('0x29')]();});}function base64Decode(_0x512bb8,_0x2b3d0b){var _0x53d1f1=path['resolve'](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));fs[_0xc113('0x2d')](_0x53d1f1,_0x512bb8,_0xc113('0x2e'));return convertFile(_0x53d1f1,_0x2b3d0b)[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x53d1f1);fs[_0xc113('0x30')](_0x2b3d0b,_0xc113('0x31'));}catch(_0x578d57){logger[_0xc113('0x18')](_0x578d57);}return _0x2b3d0b[_0xc113('0x32')]('.')[0x0];});}function base64Encode(_0x422c0d){var _0x83a452=fs[_0xc113('0x33')](_0x422c0d);return new Buffer(_0x83a452)[_0xc113('0x34')]('base64');}exports[_0xc113('0x35')]=function(_0x57b4f4,_0x135cf3,_0x43340d,_0x204328,_0x547035,_0x3676f2){var _0x500a0a,_0x168148;var _0x476254=_0xc113('0x36');var _0x2580cd='?key='+_0x57b4f4;var _0x4698f8={};if(_0x135cf3===_0xc113('0x37')){_0x4698f8[_0xc113('0x38')]={'ssml':_0x43340d};}else{_0x4698f8[_0xc113('0x38')]={'text':_0x43340d};};_0x4698f8[_0xc113('0x39')]={'languageCode':_0x204328,'ssmlGender':_0x547035};_0x4698f8['audioConfig']={'audioEncoding':_0xc113('0x3a'),'sampleRateHertz':0x1f40};var _0x297b91={'url':_0x476254+'text:synthesize'+_0x2580cd,'method':'POST','json':!![],'body':_0x4698f8};return rp(_0x297b91)[_0xc113('0x2f')](function(_0x52f706){return new BPromise(function(_0x607604,_0x153394){_0x500a0a=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x4037e9=Buffer[_0xc113('0x3d')](_0x52f706[_0xc113('0x3e')],_0xc113('0x2e'));return fs[_0xc113('0x3f')](_0x500a0a,_0x4037e9,function(_0x5e0f16){_0x153394(_0x5e0f16);},function(_0x4488a2){fs[_0xc113('0x30')](_0x500a0a,'777');_0x607604(_0x4488a2);});});})[_0xc113('0x2f')](function(_0xe371cf){_0x168148=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+'.wav');return convertFile(_0x500a0a,_0x168148);})[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x500a0a);fs[_0xc113('0x30')](_0x168148,'777');}catch(_0x2fbd05){logger[_0xc113('0x18')](_0x2fbd05);}logger[_0xc113('0x1e')](_0xc113('0x40'),_0x168148['split']('.')[0x0]);return _0x168148[_0xc113('0x32')]('.')[0x0];});};exports[_0xc113('0x41')]=function(_0xfff78c,_0x19755e){var _0x11122c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4e1673,_0x113682;var _0x13fad5;var _0x458d6d={'encoding':_0xc113('0x42'),'method':_0xc113('0x43'),'timeout':0x2710,'url':_0x11122c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc113('0x44')+encodeURIComponent(JSON[_0xc113('0x45')]([[[_0xc113('0x46'),JSON[_0xc113('0x45')]([_0xfff78c,_0x19755e||'en',![],_0xc113('0x47')]),null,_0xc113('0x48')]]]))};return rp(_0x458d6d)[_0xc113('0x2f')](function(_0x1cc96a){try{_0x13fad5=eval(_0x1cc96a[_0xc113('0x49')](0x5))[0x0][0x2];}catch(_0xa5c65e){throw new Error('parse\x20response\x20failed:\x0a'+_0x1cc96a[_0xc113('0x24')]);}if(!_0x13fad5){if(_0xfff78c[_0xc113('0x4a')]>0xc8){throw new Error(_0xc113('0x4b'));}else{throw new Error(_0xc113('0x4c')+_0x19755e+'\x22\x20might\x20not\x20exist');}}try{_0x13fad5=eval(_0x13fad5)[0x0];}catch(_0x53f524){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc113('0x24')]);}const _0x19639f=_0x13fad5;_0x4e1673=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs['generate'](0x4)+_0xc113('0x3c'));fs[_0xc113('0x2d')](_0x4e1673,_0x13fad5,{'encoding':_0xc113('0x2e')});_0x113682=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+'.wav');return convertFile(_0x4e1673,_0x113682);})[_0xc113('0x2f')](function(){try{fs['unlink'](_0x4e1673);fs[_0xc113('0x30')](_0x113682,_0xc113('0x31'));}catch(_0x3e6485){logger[_0xc113('0x18')](_0x3e6485);}logger['info']('goggleTTS\x20path',_0x113682[_0xc113('0x32')]('.')[0x0]);return _0x113682[_0xc113('0x32')]('.')[0x0];});};exports['googleASR']=function(_0x319a55,_0xae4847,_0x1f5c4c){return google['asr'](_0x319a55,_0xae4847,_0x1f5c4c)['then'](function(_0x3458e8){logger['info'](_0x3458e8[_0xc113('0x4d')]);return rp(_0x3458e8);})[_0xc113('0x2f')](function(_0x174ccf){var _0x283ea1='';var _0x672637=0x0;try{fs[_0xc113('0x21')](_0x319a55);}catch(_0x14b18f){logger['error'](_0x14b18f);}if(_0x174ccf&&_0x174ccf[_0xc113('0x4e')]){_0x283ea1=_0x174ccf[_0xc113('0x4e')][_0xc113('0x4f')](function(_0x4c19a5){return _0x4c19a5&&_0x4c19a5[_0xc113('0x50')][0x0]&&_0x4c19a5['alternatives'][0x0][_0xc113('0x51')]?_0x4c19a5[_0xc113('0x50')][0x0][_0xc113('0x51')]:'';})[_0xc113('0x52')]('\x0a');_0x672637=_0x174ccf[_0xc113('0x4e')][_0xc113('0x4f')](function(_0x6075f1){return _0x6075f1&&_0x6075f1[_0xc113('0x50')][0x0]&&_0x6075f1[_0xc113('0x50')][0x0][_0xc113('0x53')]?_0x6075f1['alternatives'][0x0][_0xc113('0x53')]:0x0;})['join']('\x0a');}logger[_0xc113('0x1e')]('googleASR\x20transcription',_0x283ea1);logger['info']('googleASR\x20confidence',_0x672637);return{'transcript':_0x283ea1,'confidence':_0x672637};})[_0xc113('0x54')](function(_0x274e48){logger[_0xc113('0x18')](_0xc113('0x55'),_0x274e48[_0xc113('0x17')],_0x274e48[_0xc113('0x56')],_0x274e48[_0xc113('0x57')]);});};exports[_0xc113('0x58')]=function(_0x4bd808,_0x3ef962,_0x292792,_0x458aad){var _0x3ec8b5=apiai(_0x3ef962,{'language':_0x458aad||'en'});return _0x3ec8b5['textRequest'](_0x292792,{'sessionId':md5(_0x4bd808)})['then'](function(_0x505b9b){logger[_0xc113('0x1e')](JSON[_0xc113('0x45')](_0x505b9b));return{'source':_0x505b9b['result'][_0xc113('0x59')],'resolvedQuery':_0x505b9b['result']['resolvedQuery'],'action':_0x505b9b['result'][_0xc113('0x5a')],'actionIncomplete':_0x505b9b[_0xc113('0x5b')][_0xc113('0x5c')],'speech':_0x505b9b['result'][_0xc113('0x5d')][_0xc113('0x5e')],'score':_0x505b9b['result'][_0xc113('0x5f')],'statusCode':_0x505b9b[_0xc113('0x60')]['code'],'endConversation':_0x505b9b[_0xc113('0x5b')][_0xc113('0x61')][_0xc113('0x62')]||![],'isFallbackIntent':_0x505b9b['result']['metadata'][_0xc113('0x63')]};});};exports['googleDialogflowV2']=function(_0x3c8f0c,_0x3392f9,_0x46f127,_0x575006,_0x2bae8f,_0x1212eb){var _0x3094b0=_0x575006[_0xc113('0x64')](/\\n/g,'\x0a');var _0x3562f7={'credentials':{'private_key':_0x3094b0,'client_email':_0x46f127}};var _0x4f3676=new dialogflow[(_0xc113('0x65'))](_0x3562f7);var _0x1fb92f=_0x4f3676[_0xc113('0x66')](_0x3392f9,md5(_0x3c8f0c));var _0x416ceb={'session':_0x1fb92f,'queryInput':{'text':{'text':_0x2bae8f,'languageCode':_0x1212eb}}};return _0x4f3676[_0xc113('0x67')](_0x416ceb)[_0xc113('0x2f')](function(_0x5ad0f2){if(_0x5ad0f2&&_0x5ad0f2['length']){logger['info'](_0xc113('0x68'),JSON[_0xc113('0x45')](_0x5ad0f2));var _0x116ed9=_0x5ad0f2[0x0];if(_0x116ed9){var _0x3b9918={'action':_0x116ed9[_0xc113('0x69')][_0xc113('0x5a')],'allRequiredParamsPresent':_0x116ed9[_0xc113('0x69')]['allRequiredParamsPresent'],'endConversation':_0x116ed9[_0xc113('0x69')][_0xc113('0x6a')]&&_0x116ed9[_0xc113('0x69')][_0xc113('0x6a')][_0xc113('0x6b')]?_0x116ed9[_0xc113('0x69')]['diagnosticInfo']['fields'][_0xc113('0x6c')]['boolValue']:![],'fulfillmentText':_0x116ed9[_0xc113('0x69')][_0xc113('0x6d')],'intentName':_0x116ed9['queryResult']['intent'][_0xc113('0x56')],'intentDisplayName':_0x116ed9[_0xc113('0x69')][_0xc113('0x6e')][_0xc113('0x6f')],'isFallbackIntent':_0x116ed9['queryResult'][_0xc113('0x6e')][_0xc113('0x70')],'languageCode':_0x116ed9[_0xc113('0x69')]['languageCode'],'queryText':_0x116ed9[_0xc113('0x69')]['queryText'],'responseId':_0x116ed9[_0xc113('0x71')],'score':_0x116ed9[_0xc113('0x69')][_0xc113('0x72')],'speech':_0x116ed9['queryResult'][_0xc113('0x6d')],'providerResponse':JSON[_0xc113('0x45')](_0x5ad0f2)};return _0x3b9918;}}});};exports[_0xc113('0x73')]=function(_0x432e93,_0xb909c8,_0xb6e03d,_0x4b98b1){return tilde[_0xc113('0x74')](_0x432e93,_0xb909c8,_0xb6e03d,_0x4b98b1)[_0xc113('0x2f')](function(_0x36cf42){try{fs[_0xc113('0x21')](_0x432e93);}catch(_0x43f03c){logger[_0xc113('0x18')](_0x43f03c);}logger[_0xc113('0x1e')](_0xc113('0x75'),_0x36cf42[_0xc113('0x51')]);logger[_0xc113('0x1e')]('Tilde\x20ASR\x20confidence',_0x36cf42['confidence']);return _0x36cf42;});};exports['awsPolly']=function(_0x3f3cc2,_0x388ad7,_0x54b310,_0x1d5743,_0x20d54f,_0x470fd7){var _0x28c088=path['resolve'](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x44703e;return aws[_0xc113('0x76')](_0x3f3cc2,_0x388ad7,_0x54b310,_0x1d5743,_0x20d54f,_0x470fd7,_0x28c088)[_0xc113('0x2f')](function(){_0x44703e=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));return convertFile(_0x28c088,_0x44703e);})[_0xc113('0x2f')](function(){try{fs['unlink'](_0x28c088);fs[_0xc113('0x30')](_0x44703e,'777');}catch(_0x2ecdef){logger['error'](_0x2ecdef);}return _0x44703e[_0xc113('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x1581b9,_0x33aa8f,_0x4bc998,_0x2ddab5,_0x4c5f31,_0x1f0575){return aws[_0xc113('0x77')](_0x1581b9,_0x33aa8f,_0x4bc998,_0x2ddab5,_0x4c5f31,_0x1f0575)[_0xc113('0x2f')](function(_0x1d2a2d){logger['info'](JSON[_0xc113('0x45')](_0x1d2a2d));return _0x1d2a2d;});};exports[_0xc113('0x78')]=function(_0x3e6af0,_0x21c462,_0x52d57f,_0x288e41){var _0x105e01=util[_0xc113('0x79')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3e6af0,encodeURIComponent(_0x21c462),_0x52d57f,_0x288e41);var _0x33bc48=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x23f4b7;return downloadFile(_0x105e01,_0x33bc48)[_0xc113('0x2f')](function(){_0x23f4b7=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));return convertFile(_0x33bc48,_0x23f4b7);})[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x33bc48);fs[_0xc113('0x30')](_0x23f4b7,_0xc113('0x31'));}catch(_0x54524e){logger[_0xc113('0x18')](_0x54524e);}return _0x23f4b7[_0xc113('0x32')]('.')[0x0];});};exports[_0xc113('0x7a')]=function(_0xb7d080,_0x1dbae4,_0x3450ba,_0x459400){var _0x38820a=util[_0xc113('0x79')](_0xc113('0x7b'),ISPEECH_API,_0x1dbae4,_0x3450ba,base64Encode(_0xb7d080),_0x459400?util['format']('model=%s',encodeURIComponent(_0x459400)):'freeform=3');return uploadFile(_0x38820a)[_0xc113('0x2f')](function(_0x31a62f){return querystring['parse'](_0x31a62f);});};exports[_0xc113('0x7c')]=function(_0x380e18,_0x19bf9f){return sestek[_0xc113('0x7d')](_0x380e18,_0x19bf9f)[_0xc113('0x2f')](function(_0x48063c){logger[_0xc113('0x1e')](JSON[_0xc113('0x45')](_0x48063c));var _0x145b42={'speech':_0x48063c['text'],'action':_0x48063c[_0xc113('0x7e')]?_0x48063c[_0xc113('0x7e')][_0xc113('0x7f')]:undefined,'actiondata':_0x48063c[_0xc113('0x7e')]?_0x48063c[_0xc113('0x7e')][_0xc113('0x80')]:undefined};if(_0x48063c[_0xc113('0x7e')]&&_0x48063c['channelData']['AudioFromTts']){return base64Decode(_0x48063c[_0xc113('0x7e')][_0xc113('0x81')][_0xc113('0x82')],path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c')))[_0xc113('0x2f')](function(_0x156e08){_0x145b42[_0xc113('0x83')]=_0x156e08;return _0x145b42;});}return _0x145b42;});};exports[_0xc113('0x84')]=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 c93e494..7ca88c4 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 _0x082f=['exports','./nda'];(function(_0x2a96ef,_0x12fe57){var _0x1279a4=function(_0x3a9927){while(--_0x3a9927){_0x2a96ef['push'](_0x2a96ef['shift']());}};_0x1279a4(++_0x12fe57);}(_0x082f,0x1a3));var _0xf082=function(_0x4f8b6a,_0x2ead69){_0x4f8b6a=_0x4f8b6a-0x0;var _0x192d31=_0x082f[_0x4f8b6a];return _0x192d31;};var nda=require(_0xf082('0x0'));module[_0xf082('0x1')]={'nda':nda}; \ No newline at end of file +var _0xebec=['exports','./nda'];(function(_0x3f2cd6,_0x46df10){var _0x5db507=function(_0x1f4217){while(--_0x1f4217){_0x3f2cd6['push'](_0x3f2cd6['shift']());}};_0x5db507(++_0x46df10);}(_0xebec,0x1b7));var _0xcebe=function(_0x34b1a5,_0x29c522){_0x34b1a5=_0x34b1a5-0x0;var _0x366c16=_0xebec[_0x34b1a5];return _0x366c16;};var nda=require(_0xcebe('0x0'));module[_0xcebe('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 4e24743..5b0a97e 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 _0xcecc=['request-promise','../../../../../config/logger','POST','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','CustomAction','custom_action','custom_action_data','CustomActionData'];(function(_0xb819a6,_0x294720){var _0x142c68=function(_0x21c49d){while(--_0x21c49d){_0xb819a6['push'](_0xb819a6['shift']());}};_0x142c68(++_0x294720);}(_0xcecc,0x186));var _0xccec=function(_0x1360f4,_0x1cf495){_0x1360f4=_0x1360f4-0x0;var _0x4fd22d=_0xcecc[_0x1360f4];return _0x4fd22d;};'use strict';var rp=require(_0xccec('0x0'));var url=require('url');var logger=require(_0xccec('0x1'))('agi');module['exports']=function(_0xf0bdcc,_0x38cf71){var _0x338b16={'method':_0xccec('0x2'),'uri':url['resolve'](_0x38cf71['ndauth_url'],_0xccec('0x3')),'form':{'grant_type':'password','username':_0x38cf71[_0xccec('0x4')],'password':_0x38cf71[_0xccec('0x5')]},'json':!![]};return rp(_0x338b16)[_0xccec('0x6')](function(_0x5788aa){var _0x372ea6={'method':_0xccec('0x2'),'uri':url['resolve'](_0x38cf71[_0xccec('0x7')],_0xccec('0x8')),'body':{'type':_0x38cf71[_0xccec('0x9')]||_0xccec('0xa'),'channelId':'Nda','conversation':{'id':_0xf0bdcc[_0xccec('0xb')]},'from':{'id':_0xf0bdcc['callerid'],'name':_0xf0bdcc[_0xccec('0xc')]},'recipient':{'id':_0xf0bdcc[_0xccec('0xd')],'name':_0xf0bdcc['extension']},'text':_0x38cf71[_0xccec('0xe')],'channelData':{}},'headers':{'Authorization':_0xccec('0xf')+_0x5788aa[_0xccec('0x10')]},'json':!![]};if(_0x38cf71['project']){_0x372ea6[_0xccec('0x11')][_0xccec('0x12')][_0xccec('0x13')]=_0x38cf71[_0xccec('0x14')];}if(_0x38cf71[_0xccec('0x15')]=='1'){_0x372ea6['body'][_0xccec('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x38cf71['custom_action']){_0x372ea6[_0xccec('0x11')][_0xccec('0x12')][_0xccec('0x16')]=_0x38cf71[_0xccec('0x17')];if(_0x38cf71[_0xccec('0x18')]){_0x372ea6[_0xccec('0x11')][_0xccec('0x12')][_0xccec('0x19')]=_0x38cf71[_0xccec('0x18')];}}logger['info'](JSON['stringify'](_0x372ea6));return rp(_0x372ea6);});}; \ No newline at end of file +var _0x85b5=['callerid','calleridname','extension','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST','ndauth_url','/token','password','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid'];(function(_0x5005f3,_0x3fc6f1){var _0x631810=function(_0x4907bc){while(--_0x4907bc){_0x5005f3['push'](_0x5005f3['shift']());}};_0x631810(++_0x3fc6f1);}(_0x85b5,0x7f));var _0x585b=function(_0x59ec8f,_0x5861bb){_0x59ec8f=_0x59ec8f-0x0;var _0x2f9569=_0x85b5[_0x59ec8f];return _0x2f9569;};'use strict';var rp=require(_0x585b('0x0'));var url=require(_0x585b('0x1'));var logger=require('../../../../../config/logger')(_0x585b('0x2'));module['exports']=function(_0x18ab39,_0x5a7ff0){var _0x4d5064={'method':_0x585b('0x3'),'uri':url['resolve'](_0x5a7ff0[_0x585b('0x4')],_0x585b('0x5')),'form':{'grant_type':_0x585b('0x6'),'username':_0x5a7ff0['username'],'password':_0x5a7ff0[_0x585b('0x6')]},'json':!![]};return rp(_0x4d5064)['then'](function(_0x432e2d){var _0x2f8895={'method':_0x585b('0x3'),'uri':url[_0x585b('0x7')](_0x5a7ff0['ndassistant_url'],_0x585b('0x8')),'body':{'type':_0x5a7ff0[_0x585b('0x9')]||_0x585b('0xa'),'channelId':_0x585b('0xb'),'conversation':{'id':_0x18ab39[_0x585b('0xc')]},'from':{'id':_0x18ab39[_0x585b('0xd')],'name':_0x18ab39[_0x585b('0xe')]},'recipient':{'id':_0x18ab39['dnid'],'name':_0x18ab39[_0x585b('0xf')]},'text':_0x5a7ff0['text'],'channelData':{}},'headers':{'Authorization':_0x585b('0x10')+_0x432e2d['access_token']},'json':!![]};if(_0x5a7ff0[_0x585b('0x11')]){_0x2f8895[_0x585b('0x12')][_0x585b('0x13')]['ProjectName']=_0x5a7ff0[_0x585b('0x11')];}if(_0x5a7ff0[_0x585b('0x14')]=='1'){_0x2f8895[_0x585b('0x12')][_0x585b('0x13')][_0x585b('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x585b('0x16')};}if(_0x5a7ff0[_0x585b('0x17')]){_0x2f8895['body'][_0x585b('0x13')][_0x585b('0x18')]=_0x5a7ff0['custom_action'];if(_0x5a7ff0['custom_action_data']){_0x2f8895[_0x585b('0x12')]['channelData']['CustomActionData']=_0x5a7ff0[_0x585b('0x19')];}}logger[_0x585b('0x1a')](JSON[_0x585b('0x1b')](_0x2f8895));return rp(_0x2f8895);});}; \ 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 8a6d6b1..47c8230 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x49b133,_0x2b7739,_0x32d875,_0x473c2f){return asr(_0x49b133,_0x2b7739,_0x32d875,_0x473c2f);}; \ No newline at end of file +var _0xdccd=['./lib/api','exports'];(function(_0x539bd8,_0x1a7eee){var _0x47d302=function(_0x1a29f4){while(--_0x1a29f4){_0x539bd8['push'](_0x539bd8['shift']());}};_0x47d302(++_0x1a7eee);}(_0xdccd,0x102));var _0xddcc=function(_0x36cf51,_0x227f71){_0x36cf51=_0x36cf51-0x0;var _0x3aa5f7=_0xdccd[_0x36cf51];return _0x3aa5f7;};'use strict';var asr=require(_0xddcc('0x0'));module[_0xddcc('0x1')]=function(_0x2f0eaa,_0x1678c3,_0x2578c7,_0x5cd689){return asr(_0x2f0eaa,_0x1678c3,_0x2578c7,_0x5cd689);}; \ 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 cff1d3d..60fddca 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 _0xf1e9=['EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','Success.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','send','close'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf1e9,0x115));var _0x9f1e=function(_0x1b0718,_0x3a29d0){_0x1b0718=_0x1b0718-0x0;var _0x46467=_0xf1e9[_0x1b0718];return _0x46467;};'use strict';var BPromise=require('bluebird');var _=require(_0x9f1e('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9f1e('0x1'));var crypto=require(_0x9f1e('0x2'));var logger=require(_0x9f1e('0x3'))('agi');module['exports']=function(_0xa9af58,_0xbd12f8,_0x3cfdfd,_0x4ff1b8){return new BPromise(function(_0x523a14,_0x2d8612){logger[_0x9f1e('0x4')](_0x9f1e('0x5'),_0x4ff1b8||_0x9f1e('0x6'));var _0x1c4578=new WebSocket(_0x4ff1b8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1b1ab9='';var _0x7eb232='0';var _0x426134='1';var _0x5edeb2=_0x9f1e('0x7');function _0x1dc52b(_0x360f1e){var _0x36c113=crypto[_0x9f1e('0x8')](_0x9f1e('0x9'));_0x36c113[_0x9f1e('0xa')](_0x360f1e);return _0x36c113[_0x9f1e('0xb')](_0x9f1e('0xc'));}function _0x262c20(){try{logger[_0x9f1e('0x4')](_0x9f1e('0xd'));var _0x33e9a5=moment()[_0x9f1e('0xe')]();var _0x32a58c=_0x1dc52b(_0x33e9a5+_0xbd12f8+_0x3cfdfd);_0x1c4578['send'](JSON[_0x9f1e('0xf')]({'appID':_0xbd12f8,'timestamp':_0x33e9a5,'appKey':_0x32a58c}));var _0xc80c73=fs[_0x9f1e('0x10')](_0xa9af58);_0xc80c73['on']('data',function(_0x322308){_0x1c4578[_0x9f1e('0x11')](_0x322308);});_0xc80c73['on'](_0x9f1e('0x12'),function(){_0x1c4578[_0x9f1e('0x11')](_0x9f1e('0x13'));});}catch(_0x1a1898){logger[_0x9f1e('0x14')](_0x9f1e('0x15'),JSON[_0x9f1e('0xf')](_0x1a1898));_0x1c4578[_0x9f1e('0x16')]();}}function _0x18dcd6(_0x190524){try{if(_0x190524){var _0x2e15c1=JSON['parse'](_0x190524);switch(_0x2e15c1[_0x9f1e('0x17')]){case 0x0:if(_0x2e15c1['result']){if(_0x2e15c1['result'][_0x9f1e('0x18')]){logger[_0x9f1e('0x4')](_0x9f1e('0x19'),JSON[_0x9f1e('0xf')](_0x2e15c1[_0x9f1e('0x1a')][_0x9f1e('0x1b')]));_0x1b1ab9=_0x2e15c1['result'][_0x9f1e('0x1b')][0x0][_0x9f1e('0x1c')];_0x7eb232=_0x2e15c1[_0x9f1e('0x1a')][_0x9f1e('0x1b')][0x0]['likelihood'];_0x426134='0';_0x5edeb2=_0x9f1e('0x1d');_0x1c4578[_0x9f1e('0x16')]();}}break;case 0x1:logger[_0x9f1e('0x4')](_0x9f1e('0x7'));_0x426134='1';_0x5edeb2=_0x9f1e('0x7');break;case 0x2:logger[_0x9f1e('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x426134='2';_0x5edeb2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x9f1e('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x426134='9';_0x5edeb2='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x9f1e('0x1e'));_0x426134='10';_0x5edeb2=_0x9f1e('0x1e');break;case 0xb:logger['info'](_0x9f1e('0x1f'));_0x426134='11';_0x5edeb2='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2965ca){logger[_0x9f1e('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9f1e('0xf')](_0x2965ca));_0x1c4578[_0x9f1e('0x16')]();}}function _0x143e93(){logger[_0x9f1e('0x4')](_0x9f1e('0x20'));_0x523a14({'transcript':_0x1b1ab9,'confidence':_0x7eb232,'status':_0x426134,'status_message':_0x5edeb2});}function _0x51a73f(_0x2364ed){logger[_0x9f1e('0x14')](_0x9f1e('0x21'));if(!_[_0x9f1e('0x22')](_0x2364ed)){logger['error'](_[_0x9f1e('0x23')](_0x2364ed)?JSON[_0x9f1e('0xf')](_0x2364ed):_0x2364ed);}}_0x1c4578['on'](_0x9f1e('0x24'),_0x262c20);_0x1c4578['on']('message',_0x18dcd6);_0x1c4578['on'](_0x9f1e('0x12'),_0x143e93);_0x1c4578['on'](_0x9f1e('0x14'),_0x51a73f);});}; \ No newline at end of file +var _0x4fef=['digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x4fef,0x1b3));var _0xf4fe=function(_0x2cba17,_0x1ae99e){_0x2cba17=_0x2cba17-0x0;var _0x106ac1=_0x4fef[_0x2cba17];return _0x106ac1;};'use strict';var BPromise=require(_0xf4fe('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf4fe('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xf4fe('0x2'));module[_0xf4fe('0x3')]=function(_0x253f29,_0x4e5a67,_0x1a92f5,_0x132347){return new BPromise(function(_0x517d1a,_0x1e8a15){logger[_0xf4fe('0x4')](_0xf4fe('0x5'),_0x132347||_0xf4fe('0x6'));var _0x1de690=new WebSocket(_0x132347||_0xf4fe('0x6'),{'perMessageDeflate':![]});var _0x3ed7e1='';var _0x27603b='0';var _0xc3f06a='1';var _0x1cabe8=_0xf4fe('0x7');function _0x111c83(_0x21f8ff){var _0x49ae59=crypto[_0xf4fe('0x8')]('sha1');_0x49ae59['update'](_0x21f8ff);return _0x49ae59[_0xf4fe('0x9')](_0xf4fe('0xa'));}function _0x2fc9ad(){try{logger[_0xf4fe('0x4')](_0xf4fe('0xb'));var _0x54749a=moment()[_0xf4fe('0xc')]();var _0x12859e=_0x111c83(_0x54749a+_0x4e5a67+_0x1a92f5);_0x1de690[_0xf4fe('0xd')](JSON[_0xf4fe('0xe')]({'appID':_0x4e5a67,'timestamp':_0x54749a,'appKey':_0x12859e}));var _0x2b0709=fs['createReadStream'](_0x253f29);_0x2b0709['on'](_0xf4fe('0xf'),function(_0x44ba05){_0x1de690['send'](_0x44ba05);});_0x2b0709['on']('close',function(){_0x1de690[_0xf4fe('0xd')](_0xf4fe('0x10'));});}catch(_0x44eaa0){logger['error'](_0xf4fe('0x11'),JSON[_0xf4fe('0xe')](_0x44eaa0));_0x1de690['terminate']();}}function _0x3b3036(_0x548f6f){try{if(_0x548f6f){var _0x1dd3d3=JSON[_0xf4fe('0x12')](_0x548f6f);switch(_0x1dd3d3[_0xf4fe('0x13')]){case 0x0:if(_0x1dd3d3[_0xf4fe('0x14')]){if(_0x1dd3d3[_0xf4fe('0x14')][_0xf4fe('0x15')]){logger[_0xf4fe('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xf4fe('0xe')](_0x1dd3d3[_0xf4fe('0x14')][_0xf4fe('0x16')]));_0x3ed7e1=_0x1dd3d3['result'][_0xf4fe('0x16')][0x0]['transcript'];_0x27603b=_0x1dd3d3[_0xf4fe('0x14')]['hypotheses'][0x0][_0xf4fe('0x17')];_0xc3f06a='0';_0x1cabe8=_0xf4fe('0x18');_0x1de690[_0xf4fe('0x19')]();}}break;case 0x1:logger[_0xf4fe('0x4')](_0xf4fe('0x7'));_0xc3f06a='1';_0x1cabe8=_0xf4fe('0x7');break;case 0x2:logger[_0xf4fe('0x4')](_0xf4fe('0x1a'));_0xc3f06a='2';_0x1cabe8=_0xf4fe('0x1a');break;case 0x9:logger['info'](_0xf4fe('0x1b'));_0xc3f06a='9';_0x1cabe8=_0xf4fe('0x1b');break;case 0xa:logger[_0xf4fe('0x4')]('Authentication\x20failed.');_0xc3f06a='10';_0x1cabe8=_0xf4fe('0x1c');break;case 0xb:logger[_0xf4fe('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xc3f06a='11';_0x1cabe8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2f7d0d){logger[_0xf4fe('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf4fe('0xe')](_0x2f7d0d));_0x1de690['terminate']();}}function _0xbde667(){logger[_0xf4fe('0x4')](_0xf4fe('0x1e'));_0x517d1a({'transcript':_0x3ed7e1,'confidence':_0x27603b,'status':_0xc3f06a,'status_message':_0x1cabe8});}function _0xd76aab(_0x4d5d1e){logger[_0xf4fe('0x1d')](_0xf4fe('0x1f'));if(!_[_0xf4fe('0x20')](_0x4d5d1e)){logger[_0xf4fe('0x1d')](_[_0xf4fe('0x21')](_0x4d5d1e)?JSON[_0xf4fe('0xe')](_0x4d5d1e):_0x4d5d1e);}}_0x1de690['on'](_0xf4fe('0x22'),_0x2fc9ad);_0x1de690['on'](_0xf4fe('0x23'),_0x3b3036);_0x1de690['on'](_0xf4fe('0x24'),_0xbde667);_0x1de690['on'](_0xf4fe('0x1d'),_0xd76aab);});}; \ 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 ff8517e..2d19f5c 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 _0x0464=['exports','./asr'];(function(_0x2ba38d,_0x1d604f){var _0x599057=function(_0x50179a){while(--_0x50179a){_0x2ba38d['push'](_0x2ba38d['shift']());}};_0x599057(++_0x1d604f);}(_0x0464,0x147));var _0x4046=function(_0xc8dad7,_0x2d94d7){_0xc8dad7=_0xc8dad7-0x0;var _0x13c87b=_0x0464[_0xc8dad7];return _0x13c87b;};var asr=require(_0x4046('0x0'));module[_0x4046('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7466=['exports'];(function(_0x44dd74,_0x5b4ee7){var _0x184833=function(_0x1e4123){while(--_0x1e4123){_0x44dd74['push'](_0x44dd74['shift']());}};_0x184833(++_0x5b4ee7);}(_0x7466,0x12f));var _0x6746=function(_0x51cf1d,_0xc42abf){_0x51cf1d=_0x51cf1d-0x0;var _0xac3047=_0x7466[_0x51cf1d];return _0xac3047;};var asr=require('./asr');module[_0x6746('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 832e218..2cda396 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x13cbb5,_0x344699){var _0x226191=function(_0x338542){while(--_0x338542){_0x13cbb5['push'](_0x13cbb5['shift']());}};_0x226191(++_0x344699);}(_0x34e8,0x12c));var _0x834e=function(_0xaef573,_0x287d1f){_0xaef573=_0xaef573-0x0;var _0x14af51=_0x34e8[_0xaef573];return _0x14af51;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 13b1fe7..aab6368 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 _0xf81a=['googleCloudTTS','apiKey','languageCode','en-US','ssmlGender','MALE','audioEncoding','text','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','computedVariables','sync','uri','render','headers','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','result','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','add','callback_priority','custom_app','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20query\x20configured','replace','no\x20variable\x20found','forEach','keys','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','no\x20file\x20audio\x20found','variable_id','response','maxdigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[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','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','math\x20%s','variable\x20%s[key]\x20set','file_id','no\x20file\x20audio\x20selected','getData','digit','no\x20variable\x20selected\x20for\x20the\x20result','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','gosub','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','escape_digits','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim'];(function(_0x2051c0,_0xcdeee5){var _0x278c2b=function(_0x427501){while(--_0x427501){_0x2051c0['push'](_0x2051c0['shift']());}};_0x278c2b(++_0xcdeee5);}(_0xf81a,0x16b));var _0xaf81=function(_0x1df110,_0x5ecc57){_0x1df110=_0x1df110-0x0;var _0x3c51dc=_0xf81a[_0x1df110];return _0x3c51dc;};'use strict';var fs=require('fs');var util=require(_0xaf81('0x0'));var _=require(_0xaf81('0x1'));var sh=require(_0xaf81('0x2'));var odbc=require('odbc')();var rs=require(_0xaf81('0x3'));var moment=require(_0xaf81('0x4'));var Mustache=require(_0xaf81('0x5'));var rp=require('request-promise');var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require('../../config/environment');var shared=require(_0xaf81('0x8'));var scripts=require(_0xaf81('0x9'));var FILES_PATH=_0xaf81('0xa');var recursiveMapAttributes=['rawHeaders',_0xaf81('0xb')];var verticesWithRetry=[_0xaf81('0xc'),'getdigits',_0xaf81('0xd')];var AGIVertices=function(_0x34cc6a,_0x413337,_0x3efaaf){this['channel']=_0x34cc6a;this[_0xaf81('0xe')]=_0x413337;this[_0xaf81('0xf')]=_0x3efaaf;};AGIVertices[_0xaf81('0x10')][_0xaf81('0x11')]=function(_0x25b90e,_0x678209){this['rpc']['getVariableById'](_0x25b90e)[_0xaf81('0x12')](function(_0x56497d){_0x678209(null,_0x56497d?_0x56497d[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0x2b62dd){_0x678209(_0x2b62dd);});};AGIVertices[_0xaf81('0x10')]['getVoiceQueue']=function(_0x2547ae,_0x10974a){this[_0xaf81('0xe')][_0xaf81('0x15')](_0x2547ae)[_0xaf81('0x12')](function(_0x569747){_0x10974a(null,_0x569747?_0x569747[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0x53ed79){_0x10974a(_0x53ed79);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x16')]=function(_0x23e8ad,_0x508df4){this[_0xaf81('0xe')][_0xaf81('0x17')](_0x23e8ad)[_0xaf81('0x12')](function(_0xd1430d){_0x508df4(null,_0xd1430d?_0xd1430d[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0xdcc2b4){_0x508df4(_0xdcc2b4);});};AGIVertices[_0xaf81('0x10')]['getSquareOdbc']=function(_0x1416c9,_0x5c9e27){this[_0xaf81('0xe')][_0xaf81('0x18')](_0x1416c9)[_0xaf81('0x12')](function(_0x1f004d){_0x5c9e27(null,_0x1f004d?_0x1f004d[_0xaf81('0x19')]:![]);})['catch'](function(_0x5e353e){_0x5c9e27(_0x5e353e);});};AGIVertices['prototype'][_0xaf81('0x1a')]=function(_0x45d102,_0x219ac2){this[_0xaf81('0xe')][_0xaf81('0x1b')](_0x45d102)[_0xaf81('0x12')](function(_0x1f8977){_0x219ac2(null,_0x1f8977?_0x1f8977[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0x59f2fe){_0x219ac2(_0x59f2fe);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1c')]=function(_0x4d7f7a,_0x544b24){this['rpc'][_0xaf81('0x1d')](_0x4d7f7a)[_0xaf81('0x12')](function(_0x22099d){_0x544b24(null,_0x22099d?_0x22099d[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0x28f593){_0x544b24(_0x28f593);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1e')]=function(_0x1826f4,_0x563de0){var _0x3fb37a=this;this[_0xaf81('0xe')][_0xaf81('0x1f')](_0x1826f4)['then'](function(_0x467ce1){_0x563de0(null,_0x467ce1?_0x3fb37a[_0xaf81('0x20')](_0x467ce1[_0xaf81('0x21')]):![]);})[_0xaf81('0x14')](function(_0x148570){_0x563de0(_0x148570);});};AGIVertices['prototype'][_0xaf81('0x22')]=function(_0x22e86b,_0x26c1a8){this[_0xaf81('0xe')][_0xaf81('0x23')](_0x22e86b)[_0xaf81('0x12')](function(_0x2748e0){_0x26c1a8(null,_0x2748e0?_0x2748e0:![]);})[_0xaf81('0x14')](function(_0x2ec77e){_0x26c1a8(_0x2ec77e);});};AGIVertices[_0xaf81('0x10')]['sendMailMessage']=function(_0x42170b,_0x55fdcc,_0x10bea6){this['mailRpc']['sendMailMessage'](_0x42170b,_0x55fdcc)[_0xaf81('0x12')](function(){_0x10bea6(null);})['catch'](function(_0x14b332){_0x10bea6(_0x14b332);});};AGIVertices['prototype'][_0xaf81('0x24')]=function(_0x4f773a,_0x2e266f){this[_0xaf81('0xe')][_0xaf81('0x25')](_0x4f773a)[_0xaf81('0x12')](function(_0x2c8dda){if(_0x2c8dda){if(_0x2c8dda[_0xaf81('0x26')]){_0x2e266f(null,[_0x2c8dda[_0xaf81('0x27')]]);}else{_0x2e266f(null,_[_0xaf81('0x28')](_0x2c8dda[_0xaf81('0x29')],'interval'));}}else{_0x2e266f(null,![]);}})[_0xaf81('0x14')](function(_0x7a5bf1){_0x2e266f(_0x7a5bf1);});};AGIVertices[_0xaf81('0x10')]['getSoundPath']=function(_0x5331b6){return util[_0xaf81('0x2a')](_0xaf81('0x2b'),FILES_PATH,_0x5331b6);};AGIVertices[_0xaf81('0x10')]['getQueryOdbc']=function(_0x4ce9c8,_0x32b19b,_0x222030){odbc[_0xaf81('0x2c')](_0x4ce9c8,function(_0x5ebdc6){if(_0x5ebdc6){logger[_0xaf81('0x2d')](_0xaf81('0x2e'),_0x5ebdc6);_0x222030(_0x5ebdc6);}else{logger[_0xaf81('0x2f')](_0xaf81('0x30'));odbc[_0xaf81('0x31')](_0x32b19b,function(_0x3fef45,_0x3d0798){if(_0x3fef45){logger[_0xaf81('0x2f')](_0xaf81('0x32'),_0x32b19b);_0x222030(_0x3fef45);}else{logger[_0xaf81('0x2f')](_0xaf81('0x33'),_0x32b19b);odbc[_0xaf81('0x34')](function(_0x317077){if(_0x317077){logger[_0xaf81('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x317077);}_0x222030(null,_0x3d0798);});}});}});};AGIVertices['prototype'][_0xaf81('0x35')]=function(_0x25b956,_0x811bdb){this['rpc']['getSmsAccountById'](_0x25b956)[_0xaf81('0x12')](function(_0x4a3f2e){_0x811bdb(null,_0x4a3f2e?_0x4a3f2e:![]);})[_0xaf81('0x14')](function(_0x574fdc){_0x811bdb(_0x574fdc);});};AGIVertices['prototype']['createSmsMessage']=function(_0x4e92dc,_0x26a4b1){this[_0xaf81('0xe')][_0xaf81('0x36')](_0x4e92dc)[_0xaf81('0x12')](function(_0x425dd1){_0x26a4b1(null,_0x425dd1);})[_0xaf81('0x14')](function(_0x49f3ba){_0x26a4b1(_0x49f3ba);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x37')]=function(_0x491572,_0x4979dd,_0x107bd0){this[_0xaf81('0xe')][_0xaf81('0x37')]({'uniqueid':this[_0xaf81('0x38')][_0xaf81('0x39')],'node':_0x491572[_0xaf81('0x3a')],'application':_0x491572[_0xaf81('0x3b')],'data':_0x4979dd||null,'project_name':this[_0xaf81('0x38')][_0xaf81('0x3c')],'callerid':this[_0xaf81('0x38')]['callerid']})['then'](function(_0x5de4a2){if(_0x107bd0){_0x107bd0(null,_0x5de4a2);}})[_0xaf81('0x14')](function(_0x15417e){if(_0x107bd0){_0x107bd0(_0x15417e);}});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x3d')]=function(_0x5bb3d3,_0xdd4642,_0x38b676,_0x571d12){this[_0xaf81('0xe')][_0xaf81('0x3d')]({'uniqueid':this[_0xaf81('0x38')]['uniqueid'],'callerid':this['channel'][_0xaf81('0x3e')],'calleridname':this[_0xaf81('0x38')][_0xaf81('0x3f')],'context':this[_0xaf81('0x38')][_0xaf81('0x40')],'extension':this[_0xaf81('0x38')][_0xaf81('0x41')],'priority':this[_0xaf81('0x38')][_0xaf81('0x42')],'accountcode':this[_0xaf81('0x38')][_0xaf81('0x43')],'dnid':this[_0xaf81('0x38')][_0xaf81('0x44')],'projectName':this['channel']['arg_1'],'saveName':_0xdd4642,'filename':_0x5bb3d3[_0xaf81('0x45')]||_0xdd4642,'savePath':_0x38b676})[_0xaf81('0x12')](function(_0x5facac){_0x571d12(null,_0x5facac);})[_0xaf81('0x14')](function(_0x179460){_0x571d12(_0x179460);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x46')]=function(_0x1a1a0d,_0x11834b,_0x3a6f94,_0x104440,_0x25acaf){this['rpc'][_0xaf81('0x46')]({'uniqueid':this[_0xaf81('0x38')]['uniqueid'],'body':_0x1a1a0d,'direction':_0x11834b,'providerName':_0x3a6f94,'providerResponse':_0x104440})[_0xaf81('0x12')](function(_0x37f854){if(_0x25acaf){_0x25acaf(null,_0x37f854);}})[_0xaf81('0x14')](function(_0x3c17b2){if(_0x25acaf){_0x25acaf(_0x3c17b2);}});};AGIVertices['prototype'][_0xaf81('0x47')]=function(_0x131237,_0x5b1c5b){this[_0xaf81('0xe')][_0xaf81('0x47')]({'firstName':_[_0xaf81('0x48')](_0x131237['name'])||_[_0xaf81('0x49')](_0x131237[_0xaf81('0x13')])?_0xaf81('0x4a')+Math[_0xaf81('0x4b')]():_0x131237[_0xaf81('0x13')],'lastName':_[_0xaf81('0x48')](_0x131237['lastName'])||_[_0xaf81('0x49')](_0x131237[_0xaf81('0x4c')])?null:_0x131237[_0xaf81('0x4c')],'phone':_0x131237[_0xaf81('0x4d')],'ListId':_0x131237[_0xaf81('0x4e')],'scheduledat':_0x131237[_0xaf81('0x4f')],'callbackUniqueid':this[_0xaf81('0x38')][_0xaf81('0x39')],'tags':'callback','description':_0xaf81('0x50')+_0x131237['scheduledAt'][_0xaf81('0x51')](),'priority':_0x131237['callback_priority']})[_0xaf81('0x12')](function(_0x1422a7){_0x5b1c5b(null,_0x1422a7);})['catch'](function(_0x99ea7a){_0x5b1c5b(_0x99ea7a);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x52')]=function(_0x1082ff,_0xdc1f80){this[_0xaf81('0xe')][_0xaf81('0x53')](_0x1082ff)[_0xaf81('0x12')](function(_0x3a7dda){_0xdc1f80(null,_0x3a7dda?_0x3a7dda[_0xaf81('0x13')]:![]);})[_0xaf81('0x14')](function(_0x5c95fc){_0xdc1f80(_0x5c95fc);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x54')]=function(_0x39a104,_0x118a7f,_0x2727ab){var _0x2d42f8={'role':'agent'};_0x2d42f8[_0x39a104]=this['channel'][_0xaf81('0x3e')];this['rpc'][_0xaf81('0x54')](_0x2d42f8,_0x118a7f,this[_0xaf81('0x38')][_0xaf81('0x39')])[_0xaf81('0x12')](function(_0x3e8eb6){_0x2727ab(null,_[_0xaf81('0x49')](_0x3e8eb6)?![]:!![]);})[_0xaf81('0x14')](function(_0x404ad2){logger[_0xaf81('0x2d')](_0x404ad2);_0x2727ab(null,![]);});};AGIVertices['prototype'][_0xaf81('0x55')]=function(_0x5a9f23,_0x3b76b1){var _0x45ebc1={'role':_0xaf81('0x56')};_0x45ebc1[_0x5a9f23]=this[_0xaf81('0x38')][_0xaf81('0x3e')];this[_0xaf81('0xe')]['agentUnpause'](_0x45ebc1)[_0xaf81('0x12')](function(_0x21483c){_0x3b76b1(null,_[_0xaf81('0x49')](_0x21483c)?![]:!![]);})[_0xaf81('0x14')](function(_0x522ade){logger[_0xaf81('0x2d')](_0x522ade);_0x3b76b1(null,![]);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x57')]=function(_0x3466ba,_0x1e7a48){var _0xfd3d0c={'role':_0xaf81('0x56')};_0xfd3d0c[_0x3466ba]=this[_0xaf81('0x38')][_0xaf81('0x3e')];this[_0xaf81('0xe')][_0xaf81('0x57')](_0xfd3d0c)[_0xaf81('0x12')](function(_0x32f65b){_0x1e7a48(null,_[_0xaf81('0x49')](_0x32f65b)?![]:!![]);})['catch'](function(_0x56b2f5){logger[_0xaf81('0x2d')](_0x56b2f5);_0x1e7a48(null,![]);});};AGIVertices[_0xaf81('0x10')]['agentLogin']=function(_0x2b64ef,_0x221585){var _0x28e796={'role':_0xaf81('0x56')};_0x28e796[_0x2b64ef]=this[_0xaf81('0x38')]['callerid'];var _0x35bd2d=_0x2b64ef!='internal'?util['format'](_0xaf81('0x58'),'LOCAL',this[_0xaf81('0x38')]['callerid']):undefined;this[_0xaf81('0xe')][_0xaf81('0x59')](_0x28e796,_0x35bd2d)[_0xaf81('0x12')](function(_0x2aaeee){_0x221585(null,_[_0xaf81('0x49')](_0x2aaeee)?![]:!![]);})[_0xaf81('0x14')](function(_0x19587b){logger[_0xaf81('0x2d')](_0x19587b);_0x221585(null,![]);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x5a')]=function(_0x9dede3,_0x20b57e){sh[_0xaf81('0x5b')](_[_0xaf81('0x5c')](_0x9dede3),function(_0x42ee35,_0x240af2){var _0x13b345=_0x240af2['replace'](/(\r\n|\n|\r)/gm,'');_0x20b57e(null,_0x13b345);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x5d')]=function(_0x441bc2,_0x33ae9a){scripts[_0xaf81('0x5d')](_0x441bc2[_0xaf81('0x5e')],_0x441bc2['google_cloud_tts_text_type']||'text',_0x441bc2['text'],_0x441bc2[_0xaf81('0x5f')]||_0xaf81('0x60'),_0x441bc2[_0xaf81('0x61')]||_0xaf81('0x62'),_0x441bc2[_0xaf81('0x63')]||'MP3')['then'](function(_0x4321cb){_0x33ae9a(null,_0x4321cb);})[_0xaf81('0x14')](function(_0x3a0b19){_0x33ae9a(_0x3a0b19);});};AGIVertices[_0xaf81('0x10')]['googleTTS']=function(_0x35b877,_0x28ebbe){scripts['googleTTS'](_0x35b877[_0xaf81('0x64')],_0x35b877[_0xaf81('0x65')]||'en',0x1)['then'](function(_0x4abba9){_0x28ebbe(null,_0x4abba9);})[_0xaf81('0x14')](function(_0x1634c6){_0x28ebbe(_0x1634c6);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x66')]=function(_0x4529f8,_0x27fb70){var _0x32293a={'uri':_0x4529f8[_0xaf81('0x67')],'method':_0x4529f8[_0xaf81('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4529f8[_0xaf81('0x69')])===_0xaf81('0x6a')&&parseInt(_0x4529f8[_0xaf81('0x69')])>=0x1?parseInt(_0x4529f8[_0xaf81('0x69')])*0x3e8:0x5*0x3e8};if(_[_0xaf81('0x6b')]([_0xaf81('0x6c'),_0xaf81('0x6d')],_0x32293a[_0xaf81('0x68')][_0xaf81('0x6e')]())){try{_0x32293a['body']=_0x4529f8[_0xaf81('0xb')]?JSON[_0xaf81('0x6f')](_0x4529f8[_0xaf81('0xb')]):{};}catch(_0x301e84){logger[_0xaf81('0x2d')](_0xaf81('0x70'),_0x301e84);}}try{_0x32293a['headers']=_0x4529f8[_0xaf81('0x71')]?JSON[_0xaf81('0x6f')](_0x4529f8[_0xaf81('0x71')]):{};}catch(_0x1a8da6){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1a8da6);}if(_0x4529f8[_0xaf81('0x72')]){try{var _0x2369e1=require(_0x4529f8[_0xaf81('0x72')])[_0xaf81('0x73')](this,_0x32293a);_0x32293a[_0xaf81('0x74')]=Mustache[_0xaf81('0x75')](_0x4529f8['url'],_0x2369e1,{},['$$','$$']);if(_0x32293a[_0xaf81('0x76')]){_0x32293a['headers']=JSON[_0xaf81('0x6f')](Mustache[_0xaf81('0x75')](JSON['stringify'](_0x32293a[_0xaf81('0x76')]),_0x2369e1,{},['$$','$$']));}if(_0x32293a[_0xaf81('0x77')]){_0x32293a['body']=JSON[_0xaf81('0x6f')](Mustache[_0xaf81('0x75')](JSON[_0xaf81('0x78')](_0x32293a[_0xaf81('0x77')]),_0x2369e1,{},['$$','$$']));}}catch(_0x5c6f00){logger[_0xaf81('0x2d')](_0xaf81('0x79'),_0x5c6f00);}}rp(_0x32293a)[_0xaf81('0x12')](function(_0x1a4362){var _0x41bebd={'statusCode':_0x1a4362[_0xaf81('0x7a')]||0xc8,'statusMessage':_0x1a4362[_0xaf81('0x7b')]||'OK','headers':_0x1a4362[_0xaf81('0x76')]||{},'body':_0x1a4362[_0xaf81('0x77')]||{}};_0x27fb70(null,_0x41bebd);})[_0xaf81('0x14')](function(_0x26a9d6){var _0x4e1e91={'statusCode':_0x26a9d6[_0xaf81('0x7a')]||0x1f4,'statusMessage':_0x26a9d6['message']||_0xaf81('0x7c'),'headers':_0x26a9d6[_0xaf81('0x7d')][_0xaf81('0x76')]||{},'body':_0x26a9d6[_0xaf81('0x7d')]['body']||{}};_0x27fb70(null,_0x4e1e91);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x7e')]=function(_0x235f8d,_0x76582c){scripts[_0xaf81('0x7e')](this[_0xaf81('0x38')][_0xaf81('0x39')],_0x235f8d[_0xaf81('0x7f')],_0x235f8d[_0xaf81('0x64')],_0x235f8d[_0xaf81('0x80')]||'en')[_0xaf81('0x12')](function(_0x5a182c){_0x76582c(null,_0x5a182c);})[_0xaf81('0x14')](function(_0x5c1e9c){_0x76582c(_0x5c1e9c);});};AGIVertices['prototype'][_0xaf81('0x81')]=function(_0x1f9502,_0x18fe51){scripts[_0xaf81('0x81')](this[_0xaf81('0x38')][_0xaf81('0x39')],_0x1f9502[_0xaf81('0x82')],_0x1f9502[_0xaf81('0x83')],_0x1f9502[_0xaf81('0x84')],_0x1f9502[_0xaf81('0x64')],_0x1f9502['dialogflowV2_language']||'en')[_0xaf81('0x12')](function(_0x37b9fd){_0x18fe51(null,_0x37b9fd);})[_0xaf81('0x14')](function(_0x5a9c05){_0x18fe51(_0x5a9c05);});};AGIVertices[_0xaf81('0x10')]['sestekNDA']=function(_0x55dfeb,_0x2ca31c){scripts[_0xaf81('0x85')](this[_0xaf81('0x38')],_0x55dfeb)[_0xaf81('0x12')](function(_0x3b670f){_0x2ca31c(null,_0x3b670f);})['catch'](function(_0x1c8480){_0x2ca31c(_0x1c8480);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x86')]=function(_0x1eecf8,_0x3c27d7){scripts['ispeechTTS'](_0x1eecf8[_0xaf81('0x7f')],_0x1eecf8[_0xaf81('0x64')],_0x1eecf8[_0xaf81('0x87')]||'en-US',_0x1eecf8[_0xaf81('0x88')])[_0xaf81('0x12')](function(_0x2b0bae){_0x3c27d7(null,_0x2b0bae);})[_0xaf81('0x14')](function(_0x5f4ef5){_0x3c27d7(_0x5f4ef5);});};AGIVertices[_0xaf81('0x10')]['ispeechASR']=function(_0x3397da,_0x1a16e1,_0x116d6d){scripts[_0xaf81('0x89')](_0x1a16e1,_0x3397da['key'],_0x3397da[_0xaf81('0x8a')]||'en-US',this[_0xaf81('0x8b')](_0x3397da[_0xaf81('0x8c')])?_0x3397da[_0xaf81('0x8c')]:undefined)['then'](function(_0x16f9a4){_0x116d6d(null,_0x16f9a4);})[_0xaf81('0x14')](function(_0x4122e2){_0x116d6d(_0x4122e2);});};AGIVertices[_0xaf81('0x10')]['awsPolly']=function(_0x41d737,_0x1285b8){scripts[_0xaf81('0x8d')](_0x41d737[_0xaf81('0x8e')],_0x41d737['aws_secret_access_key'],_0x41d737[_0xaf81('0x8f')],_0x41d737[_0xaf81('0x90')]||_0xaf81('0x91'),_0x41d737[_0xaf81('0x64')],_0x41d737[_0xaf81('0x92')]||_0xaf81('0x64'))['then'](function(_0x16dfff){_0x1285b8(null,_0x16dfff);})[_0xaf81('0x14')](function(_0x403aec){_0x1285b8(_0x403aec);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x93')]=function(_0x275ae6,_0x541512){scripts[_0xaf81('0x93')](this[_0xaf81('0x38')][_0xaf81('0x39')],_0x275ae6[_0xaf81('0x8e')],_0x275ae6[_0xaf81('0x94')],_0x275ae6[_0xaf81('0x95')],_0x275ae6[_0xaf81('0x64')],_0x275ae6[_0xaf81('0x96')])['then'](function(_0x1b3aaf){_0x541512(null,_0x1b3aaf);})['catch'](function(_0x5d878a){_0x541512(_0x5d878a);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x97')]=function(_0x5c767e,_0x22500e,_0x60bb7d){scripts[_0xaf81('0x97')](_0x22500e,_0x5c767e[_0xaf81('0x7f')],_0x5c767e['google_asr_language']||'en-US')['then'](function(_0x2c8607){_0x60bb7d(null,_0x2c8607);})[_0xaf81('0x14')](function(_0x34ab2f){_0x60bb7d(_0x34ab2f);});};AGIVertices[_0xaf81('0x10')][_0xaf81('0x98')]=function(_0x3803ef,_0x451d2d,_0x4ace1a){scripts['tildeASR'](_0x451d2d,_0x3803ef['appid'],_0x3803ef[_0xaf81('0x99')],_0x3803ef[_0xaf81('0x74')])[_0xaf81('0x12')](function(_0x905389){_0x4ace1a(null,_0x905389);})[_0xaf81('0x14')](function(_0x10adcd){_0x4ace1a(_0x10adcd);});};AGIVertices['prototype']['clear']=function(_0x140c98){var _0x3e230c=_['includes'](verticesWithRetry,_0x140c98[_0xaf81('0x3b')])?_0x140c98:_[_0xaf81('0x9a')](_0x140c98);for(var _0x3e557b in _0x3e230c){if(_0x3e230c[_0xaf81('0x9b')](_0x3e557b)){if(_0x3e230c[_0x3e557b]&&_[_0xaf81('0x9c')](_0x3e230c[_0x3e557b])){if(_[_0xaf81('0x6b')](recursiveMapAttributes,_0x3e557b)){_0x3e230c[_0x3e557b]=this[_0xaf81('0x9d')](_0x3e230c[_0x3e557b]);}else{_0x3e230c[_0x3e557b]=this['replaceAllVariables'](_0x3e230c[_0x3e557b]);}}}}return _0x3e230c;};AGIVertices[_0xaf81('0x10')][_0xaf81('0x9e')]=function(_0x5d1a10){for(var _0x304db3 in _0x5d1a10){if(_0x5d1a10['hasOwnProperty'](_0x304db3)){if(_[_0xaf81('0x9f')](_0x5d1a10[_0x304db3])){this[_0xaf81('0x9e')](_0x5d1a10[_0x304db3]);}else if(_[_0xaf81('0xa0')](_0x5d1a10[_0x304db3])){for(var _0x2d9929=0x0;_0x2d9929<_0x5d1a10[_0x304db3][_0xaf81('0xa1')];_0x2d9929++){this[_0xaf81('0x9e')](_0x5d1a10[_0x304db3][_0x2d9929]);}}else if(_[_0xaf81('0x9c')](_0x5d1a10[_0x304db3])){_0x5d1a10[_0x304db3]=this[_0xaf81('0xa2')](_0x5d1a10[_0x304db3]);}}}};AGIVertices[_0xaf81('0x10')][_0xaf81('0xa3')]=function(_0x856352,_0x5b59cd){for(var _0x3c304b in _0x856352){if(_0x856352['hasOwnProperty'](_0x3c304b)){if(_[_0xaf81('0x9f')](_0x856352[_0x3c304b])){if(!_['isEmpty'](_0x856352[_0x3c304b])){this[_0xaf81('0xa3')](_0x856352[_0x3c304b],util[_0xaf81('0x2a')](_0xaf81('0xa4'),_0x5b59cd,_0x3c304b));}}else if(_['isArray'](_0x856352[_0x3c304b])){for(var _0x27bd8e=0x0;_0x27bd8e<_0x856352[_0x3c304b][_0xaf81('0xa1')];_0x27bd8e++){this[_0xaf81('0xa3')](_0x856352[_0x3c304b][_0x27bd8e],util['format'](_0xaf81('0xa4'),_0x5b59cd,_0x3c304b+'['+_0x27bd8e+']'));}}else{if(!_[_0xaf81('0x49')](_0x856352[_0x3c304b])){this['channel'][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0xa4'),_0x5b59cd,_0x3c304b),_0x856352[_0x3c304b]);}}}}};AGIVertices[_0xaf81('0x10')][_0xaf81('0x9d')]=function(_0x4c8d90){try{var _0x3f8da4=JSON['parse'](_0x4c8d90);this[_0xaf81('0x9e')](_0x3f8da4);return JSON[_0xaf81('0x78')](_0x3f8da4);}catch(_0x39e198){return this[_0xaf81('0xa2')](_0x4c8d90);}};AGIVertices[_0xaf81('0x10')][_0xaf81('0xa2')]=function(_0x4df0e6){var _0xc2a066=_0x4df0e6[_0xaf81('0xa6')]('{');for(var _0x12e293=0x1;_0x12e293<_0xc2a066[_0xaf81('0xa1')];_0x12e293+=0x1){var _0x5c7bf0=_0xc2a066[_0x12e293][_0xaf81('0xa6')]('}');if(_0x5c7bf0[_0xaf81('0xa1')]>0x1){_0x4df0e6=_0x4df0e6['replaceAll']('{'+_0x5c7bf0[0x0]+'}',this['channel']['getVariable'](_0x5c7bf0[0x0])[_0xaf81('0xa7')]||_0x5c7bf0[0x0]);}}if(_0xc2a066[_0xaf81('0xa1')]===0x1){return _0x4df0e6[_0xaf81('0x51')]();}return this[_0xaf81('0xa2')](_0x4df0e6);};AGIVertices[_0xaf81('0x10')][_0xaf81('0xa8')]=function(_0x31fd36,_0x15cf0e){var _0x219a99=this['channel']['getVariable'](_0x31fd36);if(_0x219a99[_0xaf81('0xa9')]===-0x1){return _0x219a99;}logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x15cf0e,_0x219a99[_0xaf81('0xa7')]));return this[_0xaf81('0x38')]['setVariable'](_0x15cf0e,_0x219a99[_0xaf81('0xa7')]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x8b')]=function(_0x1725a5){return _0x1725a5&&_0x1725a5!=='0'&&_0x1725a5!=='-1'&&_0x1725a5!=='';};AGIVertices[_0xaf81('0x10')]['maxRetry']=function(_0x8f398a){this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x8f398a,'-');_0x8f398a[_0xaf81('0xaa')]=_0x8f398a[_0xaf81('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaf81('0x10')]['mrcpsynth']=function(_0x22d93e){logger['info'](util['format'](_0xaf81('0xac'),_0x22d93e[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x22d93e[_0xaf81('0x64')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xae'));}var _0x1a41e8='\x22'+_0x22d93e['text']+'\x22';if(this[_0xaf81('0x8b')](_0x22d93e['options'])){_0x1a41e8+=','+_0x22d93e[_0xaf81('0x7d')];}var _0x377dd9=this[_0xaf81('0x38')]['exec'](_0xaf81('0xaf'),_0x1a41e8);if(_0x377dd9[_0xaf81('0xa9')]===-0x1){return _0x377dd9;}return this[_0xaf81('0x38')]['noop'](util['format'](_0xaf81('0xb0'),_0x1a41e8));};AGIVertices['prototype'][_0xaf81('0xb1')]=function(_0x52f58e){logger['info'](util[_0xaf81('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x52f58e['label']));if(!this[_0xaf81('0x8b')](_0x52f58e[_0xaf81('0xb2')])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20grammar\x20configured');}var _0x61dc38=_0x52f58e[_0xaf81('0xb2')];if(this[_0xaf81('0x8b')](_0x52f58e['options'])){_0x61dc38+=','+_0x52f58e[_0xaf81('0x7d')];}var _0x58d00e=this[_0xaf81('0x38')][_0xaf81('0x5b')]('MRCPRecog',_0x61dc38);if(_0x58d00e[_0xaf81('0xa9')]===-0x1){return _0x58d00e;}var _0x6baff9=this[_0xaf81('0xa8')]('RECOG_CONFIDENCE()',_0xaf81('0xb3'));if(_0x6baff9[_0xaf81('0xa9')]===-0x1){return _0x6baff9;}var _0x2ed798=this[_0xaf81('0xa8')](_0xaf81('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x2ed798[_0xaf81('0xa9')]===-0x1){return _0x2ed798;}var _0x333815=this[_0xaf81('0xa8')](_0xaf81('0xb5'),_0xaf81('0xb6'));if(_0x333815[_0xaf81('0xa9')]===-0x1){return _0x333815;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xb7'),_0x61dc38));};AGIVertices['prototype'][_0xaf81('0x7')]=function(_0x1b9918){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0xb8'),_0x1b9918['label']));return this[_0xaf81('0x38')]['agi']([_0x1b9918['command'],_0x1b9918[_0xaf81('0xb9')]]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0xba')]=function(_0x15a92b){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0xbb'),_0x15a92b['label']));if(this[_0xaf81('0x8b')](_0x15a92b[_0xaf81('0x69')])){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0xbc'),_0x15a92b[_0xaf81('0x69')]));var _0x31c289=this['channel'][_0xaf81('0xbd')](_0x15a92b[_0xaf81('0x69')]);if(_0x31c289[_0xaf81('0xa9')]===-0x1){return _0x31c289;}}return this[_0xaf81('0x38')][_0xaf81('0xba')]();};AGIVertices['prototype'][_0xaf81('0xbe')]=function(_0x3699fb){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3699fb[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x3699fb['list_id'])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x3699fb,_0xaf81('0xbf'));}_0x3699fb['scheduledAt']=moment();if(this[_0xaf81('0x8b')](_0x3699fb[_0xaf81('0xc0')])){_0x3699fb['scheduledAt']=moment()[_0xaf81('0xc1')](_0x3699fb['delay'],'minutes');}if(!this[_0xaf81('0x8b')](_0x3699fb[_0xaf81('0xc2')])){_0x3699fb[_0xaf81('0xc2')]=0x2;}this[_0xaf81('0x47')][_0xaf81('0x73')](this,_0x3699fb);return this['channel'][_0xaf81('0xad')](util[_0xaf81('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3699fb[_0xaf81('0x4d')],_0x3699fb[_0xaf81('0x4e')],_0x3699fb[_0xaf81('0x4f')]));};AGIVertices['prototype'][_0xaf81('0xc3')]=function(_0x438a5d){logger['info'](util[_0xaf81('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x438a5d[_0xaf81('0x3a')]));var _0x516ea3=this[_0xaf81('0x38')]['exec'](_0x438a5d[_0xaf81('0xc4')],_0x438a5d[_0xaf81('0x7d')]);if(_0x516ea3[_0xaf81('0xa9')]===-0x1){return _0x516ea3;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')]('Executed\x20command\x20%s\x20%s',_0x438a5d['application'],_0x438a5d[_0xaf81('0x7d')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x5ea3bd){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0xc5'),_0x5ea3bd[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x5ea3bd[_0xaf81('0x64')])){return this['channel']['noop'](_0xaf81('0xae'));}var _0x52c845='\x22'+_0x5ea3bd['text']+'\x22';if(this[_0xaf81('0x8b')](_0x5ea3bd[_0xaf81('0x7d')])){_0x52c845+=','+_0x5ea3bd[_0xaf81('0x7d')];}var _0x86ba26=this['channel'][_0xaf81('0x5b')](_0xaf81('0xaf'),_0x52c845);if(_0x86ba26['result']===-0x1){return _0x86ba26;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0xb0'),_0x52c845));};AGIVertices[_0xaf81('0x10')][_0xaf81('0xc6')]=function(_0x1825eb){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0xc7'),_0x1825eb[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x1825eb['text'])){return this[_0xaf81('0x38')]['noop'](_0xaf81('0xae'));}var _0x488581='\x22'+_0x1825eb[_0xaf81('0x64')]+'\x22';if(this[_0xaf81('0x8b')](_0x1825eb[_0xaf81('0x7d')])){_0x488581+=','+_0x1825eb[_0xaf81('0x7d')];}var _0x353614=this[_0xaf81('0x38')]['exec'](_0xaf81('0xaf'),_0x488581);if(_0x353614[_0xaf81('0xa9')]===-0x1){return _0x353614;}return this['channel'][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xb0'),_0x488581));};AGIVertices['prototype']['lumenvoxasr']=function(_0x51d122){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0xc8'),_0x51d122[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x51d122[_0xaf81('0xb2')])){return this[_0xaf81('0x38')]['noop']('no\x20grammar\x20configured');}var _0x516a57=_0x51d122[_0xaf81('0xb2')];if(this[_0xaf81('0x8b')](_0x51d122[_0xaf81('0x7d')])){_0x516a57+=','+_0x51d122[_0xaf81('0x7d')];}var _0x138b8e=this['channel'][_0xaf81('0x5b')]('MRCPRecog',_0x516a57);if(_0x138b8e[_0xaf81('0xa9')]===-0x1){return _0x138b8e;}var _0x1d050b=this[_0xaf81('0xa8')](_0xaf81('0xc9'),_0xaf81('0xca'));if(_0x1d050b[_0xaf81('0xa9')]===-0x1){return _0x1d050b;}var _0x521f17=this[_0xaf81('0xa8')]('RECOG_INPUT()',_0xaf81('0xcb'));if(_0x521f17[_0xaf81('0xa9')]===-0x1){return _0x521f17;}var _0x345f14=this[_0xaf81('0xa8')]('RECOG_INSTANCE()',_0xaf81('0xcc'));if(_0x345f14['result']===-0x1){return _0x345f14;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xb7'),_0x516a57));};AGIVertices[_0xaf81('0x10')][_0xaf81('0xcd')]=function(_0x36ef53){logger[_0xaf81('0x2f')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x36ef53[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x36ef53['grammar'])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20grammar\x20configured');}var _0x514693=_0x36ef53['grammar'];if(this['isConfigured'](_0x36ef53[_0xaf81('0x7d')])){_0x514693+=','+_0x36ef53[_0xaf81('0x7d')];}var _0x3f36b2=this['channel'][_0xaf81('0x5b')](_0xaf81('0xce'),_0x514693);if(_0x3f36b2[_0xaf81('0xa9')]===-0x1){return _0x3f36b2;}var _0x3be66c=this[_0xaf81('0xa8')](_0xaf81('0xc9'),_0xaf81('0xcf'));if(_0x3be66c[_0xaf81('0xa9')]===-0x1){return _0x3be66c;}var _0x37df8b=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x37df8b[_0xaf81('0xa9')]===-0x1){return _0x37df8b;}var _0x81f2aa=this[_0xaf81('0xa8')](_0xaf81('0xb5'),_0xaf81('0xd0'));if(_0x81f2aa[_0xaf81('0xa9')]===-0x1){return _0x81f2aa;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xb7'),_0x514693));};AGIVertices[_0xaf81('0x10')][_0xaf81('0xd1')]=function(_0x3fc523){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0xd2'),_0x3fc523[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x3fc523['odbc_id'])){return this['channel']['error'](_0x3fc523,_0xaf81('0xd3'));}var _0x48d488=this[_0xaf81('0xd4')]['sync'](this,_0x3fc523[_0xaf81('0xd5')]);if(!_0x48d488){return this['channel'][_0xaf81('0x2d')](_0x3fc523,'no\x20odbc\x20database\x20found');}if(!this[_0xaf81('0x8b')](_0x3fc523[_0xaf81('0x31')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x3fc523,_0xaf81('0xd6'));}var _0x3c8d12=_0x3fc523[_0xaf81('0x31')][_0xaf81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('query:\x20%s',_0x3c8d12));var _0x53a1ac=this['getQueryOdbc'][_0xaf81('0x73')](this,_0x48d488,_0x3c8d12);this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x3fc523,_0x3c8d12);if(!this[_0xaf81('0x8b')](_0x3fc523['variable_id'])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x54821b=this[_0xaf81('0x11')]['sync'](this,_0x3fc523['variable_id']);if(!_0x54821b){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x3fc523,_0xaf81('0xd8'));}var _0x16ae56=this;_0x53a1ac[_0xaf81('0xd9')](function(_0x2bf46e,_0x447f3f){Object[_0xaf81('0xda')](_0x2bf46e)[_0xaf81('0xd9')](function(_0x132b8c){_0x16ae56[_0xaf81('0x38')][_0xaf81('0xa5')](util['format']('%s[%s][%s]',_0x54821b,_0x447f3f,_0x132b8c),_0x2bf46e[_0x132b8c]);});});this['channel'][_0xaf81('0xa5')](util[_0xaf81('0x2a')]('%s_ROWS_COUNT',_0x54821b),_0x53a1ac[_0xaf81('0xa1')]);return this['channel'][_0xaf81('0xad')](util['format']('variable\x20%s\x20set',_0x54821b));};AGIVertices[_0xaf81('0x10')][_0xaf81('0xdb')]=function(_0x1a1d95){logger[_0xaf81('0xdc')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1a1d95[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x1a1d95[_0xaf81('0xdd')])){return this[_0xaf81('0x38')]['error'](_0x1a1d95,_0xaf81('0xde'));}var _0xd9119b=this[_0xaf81('0x1a')]['sync'](this,_0x1a1d95[_0xaf81('0xdd')]);if(!_0xd9119b){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x1a1d95,_0xaf81('0xdf'));}var _0x4df0cd=this[_0xaf81('0x38')][_0xaf81('0x5b')](_0xaf81('0xe0'),[util[_0xaf81('0x2a')](_0xaf81('0xe1'),_0xd9119b),_0x1a1d95[_0xaf81('0x69')],_0x1a1d95['opts'],_0x1a1d95[_0xaf81('0x67')]]);if(_0x4df0cd['result']===-0x1){return _0x4df0cd;}return this['channel']['noop'](util[_0xaf81('0x2a')](_0xaf81('0xe2'),_0xaf81('0xe0')));};AGIVertices[_0xaf81('0x10')][_0xaf81('0xe3')]=function(_0x16f723){logger[_0xaf81('0x2f')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x16f723['label']));if(!this[_0xaf81('0x8b')](_0x16f723[_0xaf81('0x7f')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xe4'));}if(!this['isConfigured'](_0x16f723[_0xaf81('0x64')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xae'));}this[_0xaf81('0x38')][_0xaf81('0xe5')]=!![];this[_0xaf81('0x37')](_0x16f723);this['createSquareMessage'](_0x16f723['text'],'in','','');this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x16f723['text']));var _0x1a247c=this[_0xaf81('0x7e')]['sync'](this,_0x16f723);if(_0x1a247c){for(var _0x709807 in _0x1a247c){if(_0x1a247c[_0xaf81('0x9b')](_0x709807)){this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')]('DIALOGFLOW_%s',_0x709807[_0xaf81('0x6e')]()),_0x1a247c[_0x709807]);}}this[_0xaf81('0x46')](_0x1a247c[_0xaf81('0xe6')],_0xaf81('0xe7'),_0xaf81('0xe3'),'');return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xe8'),_0x1a247c[_0xaf81('0xe6')]));}return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x16f723,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xaf81('0x10')][_0xaf81('0xe9')]=function(_0x4df920){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0xea'),_0x4df920[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x4df920['dialogflowV2_project_id'])){return this['channel'][_0xaf81('0xad')](_0xaf81('0xeb'));}if(!this[_0xaf81('0x8b')](_0x4df920[_0xaf81('0x83')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0xec'));}if(!this[_0xaf81('0x8b')](_0x4df920['private_key'])){return this['channel']['noop'](_0xaf81('0xed'));}if(!this[_0xaf81('0x8b')](_0x4df920[_0xaf81('0xee')])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20anguage\x20configured');}if(!this[_0xaf81('0x8b')](_0x4df920[_0xaf81('0x64')])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20text\x20configured');}this[_0xaf81('0x38')][_0xaf81('0xe5')]=!![];this[_0xaf81('0x37')](_0x4df920);this[_0xaf81('0x46')](_0x4df920['text'],'in','','');this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0xef'),_0x4df920[_0xaf81('0x64')]));var _0x1f5fc6=this[_0xaf81('0x81')][_0xaf81('0x73')](this,_0x4df920);if(_0x1f5fc6){for(var _0x545f3f in _0x1f5fc6){if(_0x1f5fc6[_0xaf81('0x9b')](_0x545f3f)){if(_0x545f3f!==_0xaf81('0xf0')){this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0xf1'),_0x545f3f['toUpperCase']()),_0x1f5fc6[_0x545f3f]);}}}this[_0xaf81('0x46')](_0x1f5fc6[_0xaf81('0xe6')],_0xaf81('0xe7'),_0xaf81('0xe9'),_0x1f5fc6[_0xaf81('0xf0')]);return this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0xf2'),_0x1f5fc6[_0xaf81('0xe6')]));}return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x4df920,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0xaf81('0xf3')]=function(_0x305e60){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0xf4'),_0x305e60['label']));if(!this['isConfigured'](_0x305e60['ndauth_url'])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xf5'));}if(!this['isConfigured'](_0x305e60[_0xaf81('0xf6')])){return this[_0xaf81('0x38')]['noop']('no\x20username\x20configured');}if(!this[_0xaf81('0x8b')](_0x305e60[_0xaf81('0xf7')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0xf8'));}if(!this[_0xaf81('0x8b')](_0x305e60[_0xaf81('0xf9')])){return this[_0xaf81('0x38')]['noop'](_0xaf81('0xae'));}this['channel']['bot']=!![];this[_0xaf81('0x37')](_0x305e60);this[_0xaf81('0x46')](_0x305e60[_0xaf81('0x64')],'in','','');this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0xfa'),_0x305e60[_0xaf81('0x64')]));var _0x1e5db7=this[_0xaf81('0x85')]['sync'](this,_0x305e60);if(_0x1e5db7){for(var _0x298b0f in _0x1e5db7){if(_0x1e5db7['hasOwnProperty'](_0x298b0f)){this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0xfb'),_0x298b0f[_0xaf81('0x6e')]()),_0x1e5db7[_0x298b0f]);}}this['createSquareMessage'](_0x1e5db7[_0xaf81('0xe6')],'out','sesteknda','');if(_0x1e5db7[_0xaf81('0xfc')]){this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0xfd'),_0x1e5db7[_0xaf81('0xfc')]));var _0x578f99=this['channel'][_0xaf81('0xfe')](_0x1e5db7[_0xaf81('0xfc')]);try{fs[_0xaf81('0xff')](_0x1e5db7[_0xaf81('0xfc')]+_0xaf81('0x100'));}catch(_0x534c2e){logger[_0xaf81('0x2d')](_0x534c2e);}return _0x578f99;}else{return this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('SestekNDA\x20Result\x20%s',_0x1e5db7[_0xaf81('0xe6')]));}}return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x305e60,_0xaf81('0x101'));};AGIVertices['prototype']['end']=function(_0x377dd5){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x102'),_0x377dd5['label']));return this[_0xaf81('0x38')]['noop'](_0xaf81('0x103'));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x104')]=function(_0x170040){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x105'),_0x170040[_0xaf81('0x3a')]));var _0x2d50b1='';if(_0x170040[_0xaf81('0x106')]){if(!this[_0xaf81('0x8b')](_0x170040[_0xaf81('0x106')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x170040,'no\x20trunk\x20selected');}else{var _0x3a82b4=parseInt(_0x170040[_0xaf81('0x106')],0xa);if(isNaN(_0x3a82b4)){_0x2d50b1=_0x170040[_0xaf81('0x106')];}else{_0x2d50b1=this[_0xaf81('0x1c')][_0xaf81('0x73')](this,_0x170040[_0xaf81('0x106')]);if(!_0x2d50b1){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x170040,_0xaf81('0x107'));}}}}else if(_0x170040[_0xaf81('0x108')]){_0x2d50b1=_0x170040[_0xaf81('0x108')];}else{return this[_0xaf81('0x38')]['error'](_0x170040,_0xaf81('0x109'));}var _0x4c7a6b=this[_0xaf81('0x38')][_0xaf81('0x5b')](_0xaf81('0xe0'),[util['format'](_0xaf81('0x10a'),_0x2d50b1,_0x170040[_0xaf81('0x4d')]),_0x170040[_0xaf81('0x69')],_0x170040[_0xaf81('0x10b')],_0x170040['url']]);if(_0x4c7a6b['result']===-0x1){return _0x4c7a6b;}return this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0xe2'),_0xaf81('0xe0')));};AGIVertices['prototype']['finally']=function(_0x118ce8){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x10c'),_0x118ce8[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x10d'));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x10e')]=function(_0x960a42){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x960a42[_0xaf81('0x3a')]));if(_0x960a42['retry']===0x0){return this[_0xaf81('0xab')](_0x960a42);}_0x960a42[_0xaf81('0xaa')]-=0x1;if(!this[_0xaf81('0x8b')](_0x960a42['file_id'])){return this[_0xaf81('0x38')]['error'](_0x960a42,'no\x20file\x20audio\x20selected');}var _0x4b75a6=this[_0xaf81('0x1e')]['sync'](this,_0x960a42['file_id']);if(!_0x4b75a6){return this['channel'][_0xaf81('0x2d')](_0x960a42,_0xaf81('0x10f'));}if(!this[_0xaf81('0x8b')](_0x960a42[_0xaf81('0x110')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1dcb27=this[_0xaf81('0x38')]['getData'](_0x4b75a6,_0x960a42[_0xaf81('0x111')],_0x960a42[_0xaf81('0x112')]);var _0x12cac6=_0x1dcb27[_0xaf81('0xa9')]?_0x1dcb27[_0xaf81('0xa9')]['toString']():'';logger[_0xaf81('0x2f')]('test',JSON[_0xaf81('0x78')](_0x1dcb27));if(_0x1dcb27[_0xaf81('0xa9')]===-0x1){this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x960a42,_0x12cac6);return _0x1dcb27;}else if(_0x1dcb27[_0xaf81('0xa7')]==='timeout'){_0x1dcb27[_0xaf81('0xa9')]=_0x12cac6[_0xaf81('0xa1')]>=parseInt(_0x960a42['mindigit'])?'x':'i';}else{_0x1dcb27[_0xaf81('0xa9')]=_0x12cac6['length']>=parseInt(_0x960a42['mindigit'])&&_0x12cac6[_0xaf81('0xa1')]<=parseInt(_0x960a42['maxdigit'])?'x':'i';}var _0x34ff0d=this['getVariable'][_0xaf81('0x73')](this,_0x960a42[_0xaf81('0x110')]);if(!_0x34ff0d){return this[_0xaf81('0x38')]['error'](_0x960a42,_0xaf81('0xd8'));}this[_0xaf81('0x38')][_0xaf81('0xa5')](_0x34ff0d,_0x12cac6);if(this[_0xaf81('0x8b')](_0x960a42['hiddendigitsnum'])){var _0x3ba180=parseInt(_0x960a42[_0xaf81('0x113')],0xa);var _0x1be95c=rs[_0xaf81('0x114')]({'charset':'*','length':_0x3ba180});var _0x5dd144=_0x12cac6[_0xaf81('0xa1')];if(_0x5dd144>0x0){if(_0x5dd144>_0x3ba180){this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x960a42,_0x960a42['hiddendigitspos']==='first'?_0x1be95c+_0x12cac6[_0xaf81('0x115')](_0x3ba180):_0x12cac6[_0xaf81('0x115')](0x0,_0x5dd144-_0x3ba180)+_0x1be95c);}else{this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x960a42,rs['generate']({'charset':'*','length':_0x5dd144}));}}else{this[_0xaf81('0x37')]['sync'](this,_0x960a42,'');}}else{this['createSquareDetailsReport'][_0xaf81('0x73')](this,_0x960a42,_0x12cac6);}return _0x1dcb27;};AGIVertices[_0xaf81('0x10')]['getsecretdigits']=function(_0x5345ab){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x116'),_0x5345ab[_0xaf81('0x3a')]));return this['getdigits'](_0x5345ab);};AGIVertices['prototype']['goal']=function(_0x32f1cf){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x117'),_0x32f1cf[_0xaf81('0x3a')]));this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x32f1cf,_0x32f1cf[_0xaf81('0x118')]);return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x119'),_0x32f1cf[_0xaf81('0x118')]));};AGIVertices[_0xaf81('0x10')]['awspolly']=function(_0x1c7e76){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x11a'),_0x1c7e76['label']));if(!this[_0xaf81('0x8b')](_0x1c7e76['aws_access_key_id'])||!this[_0xaf81('0x8b')](_0x1c7e76[_0xaf81('0x94')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x11b'));}if(!this['isConfigured'](_0x1c7e76[_0xaf81('0x64')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xae'));}this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x11c'),_0x1c7e76[_0xaf81('0x64')]));var _0x3ad0eb=this[_0xaf81('0x8d')]['sync'](this,_0x1c7e76);if(_0x3ad0eb){this[_0xaf81('0x38')]['noop'](util['format'](_0xaf81('0x11d'),_0x3ad0eb));var _0x4af8ef=this['channel'][_0xaf81('0xfe')](_0x3ad0eb);try{fs['unlink'](_0x3ad0eb+'.wav');}catch(_0x5a0144){logger[_0xaf81('0x2d')](_0x5a0144);}return _0x4af8ef;}return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x1c7e76,_0xaf81('0x11e'));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x11f')]=function(_0x1b5d8d){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x120'),_0x1b5d8d['label']));if(!this[_0xaf81('0x8b')](_0x1b5d8d['aws_access_key_id'])||!this[_0xaf81('0x8b')](_0x1b5d8d[_0xaf81('0x94')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x11b'));}if(!this[_0xaf81('0x8b')](_0x1b5d8d[_0xaf81('0x96')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x121'));}if(!this[_0xaf81('0x8b')](_0x1b5d8d['text'])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xae'));}this[_0xaf81('0x38')][_0xaf81('0xe5')]=!![];this['createSquareDetailsReport'](_0x1b5d8d);this[_0xaf81('0x46')](_0x1b5d8d[_0xaf81('0x64')],'in','','');this['channel'][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x122'),_0x1b5d8d[_0xaf81('0x64')]));var _0x42d244=this[_0xaf81('0x93')][_0xaf81('0x73')](this,_0x1b5d8d);if(_0x42d244){for(var _0x1a1df3 in _0x42d244){if(_0x42d244[_0xaf81('0x9b')](_0x1a1df3)&&_[_0xaf81('0x9c')](_0x42d244[_0x1a1df3])){this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0x123'),_0x1a1df3[_0xaf81('0x6e')]()),_0x42d244[_0x1a1df3]);}}if(_[_0xaf81('0x49')](_0x42d244[_0xaf81('0x124')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0x125'));}else{this[_0xaf81('0x46')](_0x42d244[_0xaf81('0x124')],_0xaf81('0xe7'),_0xaf81('0x126'),'');return this['channel']['noop'](util[_0xaf81('0x2a')](_0xaf81('0x127'),_0x42d244['message']));}}return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x1b5d8d,_0xaf81('0x128'));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x129')]=function(_0x2739a7){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2739a7['label'],_0x2739a7[_0xaf81('0x69')]));if(!this[_0xaf81('0x8b')](_0x2739a7['key'])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20key\x20configured');}var _0x33be87=_0xaf81('0x12a');var _0xd91503=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x363721=util[_0xaf81('0x2a')]('%s.%s',_0xd91503,_0x33be87);var _0x4acc1a=!![];if(_0x2739a7[_0xaf81('0x12b')]===_0xaf81('0x12c')){_0x4acc1a=![];}var _0x1a6721=this[_0xaf81('0x38')]['recordFile'](_0xd91503,_0x33be87,_0x2739a7[_0xaf81('0x12d')],_0x2739a7[_0xaf81('0x69')],undefined,_0x4acc1a);if(_0x1a6721[_0xaf81('0xa9')]!==-0x1){this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0x12e'),_0x363721));var _0x400863=this[_0xaf81('0x97')][_0xaf81('0x73')](this,_0x2739a7,_0x363721);if(_0x400863){for(var _0x533740 in _0x400863){if(_0x400863[_0xaf81('0x9b')](_0x533740)){this[_0xaf81('0x38')][_0xaf81('0xa5')](util['format'](_0xaf81('0x12f'),_0x533740['toUpperCase']()),_0x400863[_0x533740]);}}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x130'),JSON[_0xaf81('0x78')](_0x400863)));}}return _0x1a6721;};AGIVertices[_0xaf81('0x10')]['tildeasr']=function(_0x4ff63f){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4ff63f[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x4ff63f[_0xaf81('0x131')])){return this[_0xaf81('0x38')]['noop'](_0xaf81('0x132'));}if(!this['isConfigured'](_0x4ff63f[_0xaf81('0x99')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0x133'));}var _0x3e13c3=_0xaf81('0x12a');var _0x5083e8=util[_0xaf81('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x352fcb=util[_0xaf81('0x2a')](_0xaf81('0xa4'),_0x5083e8,_0x3e13c3);var _0x12b79d=!![];if(_0x4ff63f['beep']===_0xaf81('0x12c')){_0x12b79d=![];}var _0x14595c=this[_0xaf81('0x38')][_0xaf81('0x134')](_0x5083e8,_0x3e13c3,_0x4ff63f[_0xaf81('0x12d')],_0x4ff63f[_0xaf81('0x69')],undefined,_0x12b79d);if(_0x14595c[_0xaf81('0xa9')]!==-0x1){this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')]('tilde\x20%s\x20file\x20created',_0x352fcb));var _0x31c54b=this['tildeASR'][_0xaf81('0x73')](this,_0x4ff63f,_0x352fcb);if(_0x31c54b){for(var _0x3904ed in _0x31c54b){if(_0x31c54b[_0xaf81('0x9b')](_0x3904ed)){this['channel'][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0x135'),_0x3904ed[_0xaf81('0x6e')]()),_0x31c54b[_0x3904ed]);}}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x136'),JSON[_0xaf81('0x78')](_0x31c54b)));}}return _0x14595c;};AGIVertices[_0xaf81('0x10')][_0xaf81('0x137')]=function(_0x86fd13){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x138'),_0x86fd13[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0x139')](_0x86fd13[_0xaf81('0x40')],_0x86fd13[_0xaf81('0x41')],_0x86fd13['priority']);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x13a')]=function(_0x79dfd){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x13b'),_0x79dfd['label']));if(!this['isConfigured'](_0x79dfd[_0xaf81('0x13c')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x79dfd,_0xaf81('0x13d'));}try{var _0x4819e4=eval(_0x79dfd['condition'])?'true':_0xaf81('0x13e');this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x13f'),_0x79dfd[_0xaf81('0x13c')],_0x4819e4));return{'code':0xc8,'result':_0x4819e4};}catch(_0x4e1189){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xaf81('0x10')]['gotoiftime']=function(_0x4e3d27){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4e3d27['label']));if(!this[_0xaf81('0x8b')](_0x4e3d27[_0xaf81('0x140')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x4e3d27,_0xaf81('0x141'));}var _0x438158=this[_0xaf81('0x24')][_0xaf81('0x73')](this,_0x4e3d27['interval_id']);if(!_0x438158){return this['channel'][_0xaf81('0x2d')](_0x4e3d27,_0xaf81('0x142'));}for(var _0x2add5=0x0;_0x2add5<_0x438158[_0xaf81('0xa1')];_0x2add5+=0x1){var _0x384fd7=this[_0xaf81('0x38')][_0xaf81('0x11')](util['format'](_0xaf81('0x143'),_0x438158[_0x2add5]));if(_0x384fd7[_0xaf81('0xa9')]===-0x1){return _0x384fd7;}logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x144'),_0x438158[_0x2add5],_0x384fd7[_0xaf81('0xa7')]));if(_0x384fd7[_0xaf81('0xa7')]===_0xaf81('0x145')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x438158[_0x2add5],_0xaf81('0x145')));this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('IFTIME\x20%s\x20%s',_0x438158[_0x2add5],_0xaf81('0x145')));return{'code':0xc8,'result':_0xaf81('0x145')};}else{logger['info'](util[_0xaf81('0x2a')]('IFTIME\x20%s\x20%s',_0x438158[_0x2add5],_0xaf81('0x13e')));this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0x144'),_0x438158[_0x2add5],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xaf81('0x10')]['hangup']=function(_0x5343de){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x146'),_0x5343de[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0x147')]();};AGIVertices[_0xaf81('0x10')][_0xaf81('0x148')]=function(_0x494b4d){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x149'),_0x494b4d['label']));if(!this['isConfigured'](_0x494b4d['key'])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xe4'));}var _0x274757=_0xaf81('0x12a');var _0x53ef45=util[_0xaf81('0x2a')](_0xaf81('0x14a'),FILES_PATH,rs['generate'](0x4));var _0x48a938=util[_0xaf81('0x2a')](_0xaf81('0xa4'),_0x53ef45,_0x274757);var _0x4a8a10=!![];if(_0x494b4d[_0xaf81('0x12b')]===_0xaf81('0x12c')){_0x4a8a10=![];}var _0x1eea61=this['channel']['recordFile'](_0x53ef45,_0x274757,_0x494b4d[_0xaf81('0x12d')],_0x494b4d[_0xaf81('0x69')],undefined,_0x4a8a10);if(_0x1eea61['result']!==-0x1){this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x14b'),_0x48a938));var _0x5aa011=this['ispeechASR'][_0xaf81('0x73')](this,_0x494b4d,_0x48a938);if(_0x5aa011){for(var _0x2550ce in _0x5aa011){if(_0x5aa011[_0xaf81('0x9b')](_0x2550ce)){this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')](_0xaf81('0x14c'),_0x2550ce[_0xaf81('0x6e')]()),_0x5aa011[_0x2550ce]);}}return this['channel']['noop'](util[_0xaf81('0x2a')](_0xaf81('0x14d'),JSON[_0xaf81('0x78')](_0x5aa011)));}}return _0x1eea61;};AGIVertices[_0xaf81('0x10')][_0xaf81('0x14e')]=function(_0x4828b8){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x14f'),_0x4828b8['label']));if(!this[_0xaf81('0x8b')](_0x4828b8['key'])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xe4'));}if(!this[_0xaf81('0x8b')](_0x4828b8['text'])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0xae'));}this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x150'),_0x4828b8[_0xaf81('0x64')]));var _0x226d80=this[_0xaf81('0x86')]['sync'](this,_0x4828b8);if(_0x226d80){this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x14b'),_0x226d80));var _0x3fd0a9=this[_0xaf81('0x38')][_0xaf81('0xfe')](_0x226d80,_0x4828b8[_0xaf81('0x12d')]);try{fs[_0xaf81('0xff')](_0x226d80+'.wav');}catch(_0x490c60){logger[_0xaf81('0x2d')](_0x490c60);}return _0x3fd0a9;}return this['channel']['error'](_0x4828b8,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xaf81('0x10')][_0xaf81('0x151')]=function(_0x1b4454){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x152'),_0x1b4454['label']));if(!this[_0xaf81('0x8b')](_0x1b4454['findBy'])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x1b4454,_0xaf81('0x153'));}logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x154'),this[_0xaf81('0x38')]['callerid'],_0x1b4454[_0xaf81('0x155')]));var _0x27d4f8=this[_0xaf81('0x59')][_0xaf81('0x73')](this,_0x1b4454['findBy']);if(_0x27d4f8){logger['info'](util['format'](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x1b4454[_0xaf81('0x155')]));this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x1b4454[_0xaf81('0x155')]));return{'code':0xc8,'result':_0xaf81('0x157')};}else{logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x158'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x1b4454[_0xaf81('0x155')]));this[_0xaf81('0x38')][_0xaf81('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x1b4454[_0xaf81('0x155')]));return{'code':0xc8,'result':_0xaf81('0x159')};}};AGIVertices['prototype'][_0xaf81('0x15a')]=function(_0x534696){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x15b'),_0x534696[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x534696[_0xaf81('0x155')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x534696,_0xaf81('0x153'));}logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x154'),this['channel'][_0xaf81('0x3e')],_0x534696[_0xaf81('0x155')]));var _0x1beff5=this['agentLogout'][_0xaf81('0x73')](this,_0x534696[_0xaf81('0x155')]);if(_0x1beff5){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x534696[_0xaf81('0x155')]));this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x534696['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x158'),this[_0xaf81('0x38')]['callerid'],_0x534696[_0xaf81('0x155')]));this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x534696[_0xaf81('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaf81('0x10')][_0xaf81('0x15c')]=function(_0x381ea1){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x381ea1[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x381ea1[_0xaf81('0x15d')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x381ea1,'no\x20operation\x20configured');}this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x15e'),_0x381ea1[_0xaf81('0x15d')]));var _0xe947a9=eval(_0x381ea1[_0xaf81('0x15d')]);if(!this[_0xaf81('0x8b')](_0x381ea1[_0xaf81('0x110')])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x49b82f=this[_0xaf81('0x11')][_0xaf81('0x73')](this,_0x381ea1[_0xaf81('0x110')]);if(!_0x49b82f){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x381ea1,_0xaf81('0xd8'));}if(_['isArray'](_0xe947a9)){var _0x22b2ea=this;_0xe947a9['forEach'](function(_0x5f3f99,_0x45d5bf){_0x22b2ea['channel']['setVariable'](util[_0xaf81('0x2a')]('%s[%s]',_0x49b82f,_0x45d5bf),_0x5f3f99);});return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x15f'),_0x49b82f));}else{return this[_0xaf81('0x38')]['setVariable'](_0x49b82f,_0xe947a9);}};AGIVertices[_0xaf81('0x10')]['menu']=function(_0x401a49){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x401a49[_0xaf81('0x3a')]));if(_0x401a49[_0xaf81('0xaa')]===0x0){return this[_0xaf81('0xab')](_0x401a49);}_0x401a49[_0xaf81('0xaa')]-=0x1;if(!this[_0xaf81('0x8b')](_0x401a49[_0xaf81('0x160')])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x401a49,_0xaf81('0x161'));}var _0x5a0d50=this[_0xaf81('0x1e')]['sync'](this,_0x401a49[_0xaf81('0x160')]);if(!_0x5a0d50){return this[_0xaf81('0x38')]['error'](_0x401a49,_0xaf81('0x10f'));}var _0x13998e=this[_0xaf81('0x38')][_0xaf81('0x162')](_0x5a0d50,_0x401a49['response'],_0x401a49[_0xaf81('0x163')]);var _0x2c2db0=_0x13998e[_0xaf81('0xa9')];if(_0x13998e['result']===-0x1){this[_0xaf81('0x37')]['sync'](this,_0x401a49,'-1');return _0x13998e;}else if(_0x13998e[_0xaf81('0xa7')]===_0xaf81('0x69')){_0x13998e[_0xaf81('0xa9')]=_0x13998e['result'][_0xaf81('0xa1')]>0x0?_0x13998e['result']:'t';}else if(_[_0xaf81('0x48')](_0x13998e[_0xaf81('0xa9')])){_0x13998e[_0xaf81('0xa9')]='#';_0x2c2db0='#';}if(!this[_0xaf81('0x8b')](_0x401a49[_0xaf81('0x110')])){this['channel'][_0xaf81('0xad')](_0xaf81('0x164'));}else{var _0x54b1a5=this['getVariable'][_0xaf81('0x73')](this,_0x401a49[_0xaf81('0x110')]);if(!_0x54b1a5){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x401a49,_0xaf81('0xd8'));}this[_0xaf81('0x38')]['setVariable'](_0x54b1a5,_0x2c2db0);}this['createSquareDetailsReport'][_0xaf81('0x73')](this,_0x401a49,_0x2c2db0);return _0x13998e;};AGIVertices[_0xaf81('0x10')][_0xaf81('0xad')]=function(_0x131841){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x165'),_0x131841[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0xad')](_0x131841[_0xaf81('0x166')]||_0x131841[_0xaf81('0x3a')]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x167')]=function(_0x20a7d8){logger['info'](util['format'](_0xaf81('0x168'),_0x20a7d8['label']));if(!this[_0xaf81('0x8b')](_0x20a7d8[_0xaf81('0x155')])){return this['channel'][_0xaf81('0x2d')](_0x20a7d8,_0xaf81('0x153'));}logger['info'](util[_0xaf81('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x20a7d8[_0xaf81('0x155')]));var _0x1d6dd8=this[_0xaf81('0x52')][_0xaf81('0x73')](this,_0x20a7d8[_0xaf81('0x169')]);var _0x2a90ae=this[_0xaf81('0x54')][_0xaf81('0x73')](this,_0x20a7d8['findBy'],_0x1d6dd8);if(_0x2a90ae){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x20a7d8['findBy']));this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x20a7d8['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x158'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x20a7d8[_0xaf81('0x155')]));this['channel'][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x156'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x20a7d8['findBy']));return{'code':0xc8,'result':_0xaf81('0x159')};}};AGIVertices[_0xaf81('0x10')]['playback']=function(_0xa0c0f0){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x16a'),_0xa0c0f0[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0xa0c0f0[_0xaf81('0x160')])){return this['channel'][_0xaf81('0x2d')](_0xa0c0f0,'no\x20file\x20audio\x20selected');}var _0x3330a9=this[_0xaf81('0x1e')]['sync'](this,_0xa0c0f0[_0xaf81('0x160')]);if(!_0x3330a9){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0xa0c0f0,_0xaf81('0x10f'));}var _0x354f67=this['channel'][_0xaf81('0x5b')](_0xaf81('0x16b'),[_0x3330a9,_0xa0c0f0[_0xaf81('0x10b')]]);if(_0x354f67[_0xaf81('0xa9')]===-0x1){return _0x354f67;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0x16c'),_0xaf81('0x16b'),_0x3330a9));};AGIVertices['prototype'][_0xaf81('0x16d')]=function(_0x106165){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x16e'),_0x106165['label']));if(!this[_0xaf81('0x8b')](_0x106165[_0xaf81('0x16f')])){return this['channel']['error'](_0x106165,_0xaf81('0x170'));}var _0x2e232c='';var _0x152e21=parseInt(_0x106165[_0xaf81('0x16f')],0xa);if(isNaN(_0x152e21)){_0x2e232c=_0x106165[_0xaf81('0x16f')];}else{_0x2e232c=this[_0xaf81('0x171')]['sync'](this,_0x106165[_0xaf81('0x16f')]);if(!_0x2e232c){return this[_0xaf81('0x38')]['error'](_0x106165,_0xaf81('0x172'));}}var _0x2be5b8='';if(this[_0xaf81('0x8b')](_0x106165[_0xaf81('0x160')])){var _0x4dccf9=this[_0xaf81('0x1e')]['sync'](this,_0x106165[_0xaf81('0x160')]);if(_0x4dccf9){_0x2be5b8=_0x4dccf9;}}this[_0xaf81('0x37')]['sync'](this,_0x106165,_0x2e232c);if(_0x106165[_0xaf81('0x10b')]['indexOf']('x')<0x0){_0x106165[_0xaf81('0x10b')]+='x';}if(_0x106165[_0xaf81('0x10b')]['indexOf']('X')<0x0){_0x106165[_0xaf81('0x10b')]+='X';}this[_0xaf81('0x38')]['setVariable'](_0xaf81('0x173'),_0x2e232c?_0x2e232c[_0xaf81('0x174')]():'');var _0x1477b2=this[_0xaf81('0x38')][_0xaf81('0x5b')](_0xaf81('0x175'),[_0x2e232c,_0x106165['opts'],_0x106165[_0xaf81('0x67')],_0x2be5b8,_0x106165['timeout'],_0x106165['agi'],_0x106165['macro'],_0x106165[_0xaf81('0x176')],'',_0x106165['position']]);if(_0x1477b2[_0xaf81('0xa9')]===-0x1){return _0x1477b2;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x16c'),'QUEUE',_0x2e232c));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x177')]=function(_0x5022bc){logger['info'](util[_0xaf81('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x5022bc[_0xaf81('0x3a')]));var _0x546ce6=_0x5022bc['recordingFormat']||_0xaf81('0x12a');var _0x34c67b=util[_0xaf81('0x2a')](_0xaf81('0x178'),this[_0xaf81('0x38')][_0xaf81('0x39')],rs['generate'](0x5));var _0x929d26=util[_0xaf81('0x2a')](_0xaf81('0x179'),FILES_PATH,_0x34c67b,_0x546ce6);var _0x155e49=util[_0xaf81('0x2a')]('%s/recordings/%s',FILES_PATH,_0x34c67b);this[_0xaf81('0x3d')][_0xaf81('0x73')](this,_0x5022bc,_0x34c67b,_0x929d26);this[_0xaf81('0x38')][_0xaf81('0xa5')](_0xaf81('0x17a'),_0x34c67b);logger[_0xaf81('0x2f')](_0xaf81('0x17b'),_0x155e49,_0x546ce6,_0x5022bc['escape_digits'],_0x5022bc[_0xaf81('0x69')]);return this[_0xaf81('0x38')][_0xaf81('0x134')](_0x155e49,_0x546ce6,_0x5022bc['escape_digits'],_0x5022bc[_0xaf81('0x69')],undefined,!![]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x17c')]=function(_0x2f6c73){logger['info'](util['format'](_0xaf81('0x17d'),_0x2f6c73[_0xaf81('0x3a')]));if(!this['isConfigured'](_0x2f6c73[_0xaf81('0x67')])){return this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x17e'));}var _0x402ae7=this['restAPI'][_0xaf81('0x73')](this,_0x2f6c73);logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x17f'),util['inspect'](_0x402ae7,{'showHidden':![],'depth':null})));if(!this[_0xaf81('0x8b')](_0x2f6c73[_0xaf81('0x110')])){return this[_0xaf81('0x38')]['noop'](_0xaf81('0x180'));}var _0x2a9ec0=this['getVariable']['sync'](this,_0x2f6c73[_0xaf81('0x110')]);if(!_0x2a9ec0){return this[_0xaf81('0x38')]['error'](_0x2f6c73,_0xaf81('0xd8'));}this[_0xaf81('0x38')][_0xaf81('0xa5')](util[_0xaf81('0x2a')]('%s_STATUS_CODE',_0x2a9ec0),_0x402ae7[_0xaf81('0x7a')]?_0x402ae7[_0xaf81('0x7a')]:_0xaf81('0x181'));this[_0xaf81('0x38')]['setVariable'](util['format'](_0xaf81('0x182'),_0x2a9ec0),_0x402ae7['statusMessage']?_0x402ae7[_0xaf81('0x7b')]:'OK');if(_0x402ae7[_0xaf81('0x77')]){try{this[_0xaf81('0xa3')](_0x402ae7[_0xaf81('0x77')],_0x2a9ec0);}catch(_0x2c4aac){logger[_0xaf81('0x2d')](util[_0xaf81('0x2a')](_0xaf81('0x183'),_0x2a9ec0));}}return this[_0xaf81('0x38')]['noop'](util['format'](_0xaf81('0x184'),_0x2a9ec0));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x185')]=function(_0x4ac831){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4ac831[_0xaf81('0x3a')]));return this[_0xaf81('0x38')]['sayDigits'](_0x4ac831[_0xaf81('0x186')][_0xaf81('0xd7')](/\s+/g,''),_0x4ac831['escape_digits']);};AGIVertices['prototype'][_0xaf81('0x187')]=function(_0x342489){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x188'),_0x342489[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0x189')](_0x342489[_0xaf81('0x6a')][_0xaf81('0xd7')](/\s+/g,''),_0x342489[_0xaf81('0x18a')]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x18b')]=function(_0x1695e5){logger[_0xaf81('0x2f')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1695e5[_0xaf81('0x3a')]));return this[_0xaf81('0x38')][_0xaf81('0x18c')](_0x1695e5[_0xaf81('0x64')],_0x1695e5[_0xaf81('0x18a')]);};AGIVertices[_0xaf81('0x10')][_0xaf81('0x18d')]=function(_0x5daffb){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x18e'),_0x5daffb[_0xaf81('0x3a')]));if(!this['isConfigured'](_0x5daffb['account_id'])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20mail\x20account\x20configured');}var _0x363483=this[_0xaf81('0x22')][_0xaf81('0x73')](this,_0x5daffb[_0xaf81('0x18f')]);if(!_0x363483||!_0x363483[_0xaf81('0x190')]){return this['channel']['error'](_0x5daffb,'no\x20mail\x20account\x20found');}var _0xcaf991={'from':util[_0xaf81('0x2a')](_0xaf81('0x191'),_0x363483['name'],_0x363483[_0xaf81('0x192')]||_0x363483[_0xaf81('0x190')][_0xaf81('0x193')]),'to':_0x5daffb['to']||'','cc':_0x5daffb['cc']||'','bcc':_0x5daffb['bcc']||'','subject':_0x5daffb[_0xaf81('0x194')],'html':_0x5daffb[_0xaf81('0x64')],'text':_0x5daffb[_0xaf81('0x64')]};if(this[_0xaf81('0x8b')](_0x5daffb[_0xaf81('0x195')])){}logger[_0xaf81('0xdc')](_0xaf81('0x196'),JSON[_0xaf81('0x78')](_0xcaf991));this['createSquareDetailsReport'][_0xaf81('0x73')](this,_0x5daffb,_0x5daffb['account_id']);this[_0xaf81('0x38')][_0xaf81('0xad')](util['format'](_0xaf81('0x197'),_0x363483[_0xaf81('0x13')]));this[_0xaf81('0x198')][_0xaf81('0x73')](this,_0x363483[_0xaf81('0x199')],_0xcaf991);return this['channel'][_0xaf81('0xad')](_0xaf81('0x19a'));};AGIVertices[_0xaf81('0x10')]['sendFax']=function(_0x23ec01){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x23ec01[_0xaf81('0x3a')]));return this['channel'][_0xaf81('0xad')](_0xaf81('0x19b'));};AGIVertices['prototype'][_0xaf81('0x19c')]=function(_0x41ac89){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x19d'),_0x41ac89[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x41ac89[_0xaf81('0x19e')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0x19f'));}var _0x3620d7=this[_0xaf81('0x35')]['sync'](this,_0x41ac89[_0xaf81('0x19e')]);if(!_0x3620d7){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x41ac89,_0xaf81('0x1a0'));}var _0x2715e1={'body':_0x41ac89['sms_text'],'phone':_0x41ac89['to']||'','SmsAccountId':_0x3620d7['id']};logger[_0xaf81('0xdc')](_0xaf81('0x1a1'),JSON[_0xaf81('0x78')](_0x2715e1));this[_0xaf81('0x37')]['sync'](this,_0x41ac89,_0x41ac89['sms_account_id']);this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3620d7[_0xaf81('0x13')]));this['createSmsMessage'][_0xaf81('0x73')](this,_0x2715e1);return this[_0xaf81('0x38')][_0xaf81('0xad')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1a2')]=function(_0x32472b){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x32472b[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0x32472b['variable_id'])){return this[_0xaf81('0x38')]['error'](_0x32472b,_0xaf81('0x1a3'));}var _0x23afc7=this[_0xaf81('0x11')]['sync'](this,_0x32472b['variable_id']);if(!_0x23afc7){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x32472b,_0xaf81('0xd8'));}return this[_0xaf81('0x38')][_0xaf81('0xa5')](_0x23afc7,_0x32472b['variable_value']);};AGIVertices['prototype'][_0xaf81('0x1a4')]=function(_0x3d5015){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x1a5'),_0x3d5015['label']));this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x1a6'));if(_0x3d5015[_0xaf81('0xba')]==='yes'){this[_0xaf81('0x38')][_0xaf81('0xad')](_0xaf81('0x1a7'));return this[_0xaf81('0x38')]['answer']();}return this[_0xaf81('0x38')]['noop'](_0xaf81('0x1a8'));};AGIVertices['prototype']['subproject']=function(_0x599382){logger[_0xaf81('0x2f')](util['format'](_0xaf81('0x1a9'),_0x599382['label']));if(!this['isConfigured'](_0x599382[_0xaf81('0x1aa')])){return this['channel'][_0xaf81('0x2d')](_0x599382,_0xaf81('0x1ab'));}var _0x49dcea=this[_0xaf81('0x16')][_0xaf81('0x73')](this,_0x599382[_0xaf81('0x1aa')]);if(!this[_0xaf81('0x8b')](_0x49dcea)){return this[_0xaf81('0x38')]['error'](_0x599382,util[_0xaf81('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x599382['project_id']));}if(_0x49dcea===this[_0xaf81('0x38')][_0xaf81('0x3c')]){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x599382,_0xaf81('0x1ac'));}this[_0xaf81('0x37')]['sync'](this,_0x599382,_0x49dcea);var _0x57e619=this[_0xaf81('0x38')]['exec']('AGI',util[_0xaf81('0x2a')](_0xaf81('0x1ad'),config[_0xaf81('0x7')][_0xaf81('0x1ae')]||_0xaf81('0x1af'),_0x49dcea,this[_0xaf81('0x38')][_0xaf81('0x3c')]));if(_0x57e619[_0xaf81('0xa9')]===-0x1){return _0x57e619;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x16c'),_0xaf81('0x1b0'),_0x49dcea));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1b1')]=function(_0x5d5f16){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x1b2'),_0x5d5f16[_0xaf81('0x3a')]));var _0xf91966=this[_0xaf81('0x5a')][_0xaf81('0x73')](this,_0x5d5f16[_0xaf81('0x1b3')]);this[_0xaf81('0x37')][_0xaf81('0x73')](this,_0x5d5f16,_0x5d5f16['command']);if(this[_0xaf81('0x8b')](_0x5d5f16['variable_id'])){var _0x5992f7=this[_0xaf81('0x11')][_0xaf81('0x73')](this,_0x5d5f16[_0xaf81('0x110')]);if(_0x5992f7){this['channel'][_0xaf81('0xa5')](_0x5992f7,_0xf91966);return this['channel'][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x1b4'),_0x5d5f16[_0xaf81('0x1b3')],_0x5992f7));}}return this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x1b5'),_0x5d5f16[_0xaf81('0x1b3')]));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1b6')]=function(_0x15886b){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x1b7'),_0x15886b[_0xaf81('0x3a')]));_0x15886b[_0xaf81('0x64')]=_0x15886b['text'][_0xaf81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf81('0x8b')](_0x15886b[_0xaf81('0x5e')])){return this[_0xaf81('0x38')][_0xaf81('0xad')]('no\x20apiKey\x20configured');}if(!this[_0xaf81('0x8b')](_0x15886b['text'])){return this[_0xaf81('0x38')]['noop'](_0xaf81('0xae'));}this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x15886b[_0xaf81('0x64')]));var _0x14ac1f=this[_0xaf81('0x5d')][_0xaf81('0x73')](this,_0x15886b);if(_0x14ac1f){this['channel']['noop'](util[_0xaf81('0x2a')](_0xaf81('0x1b8'),_0x14ac1f));var _0x41d7d4=this[_0xaf81('0x38')][_0xaf81('0xfe')](_0x14ac1f);try{fs['unlink'](_0x14ac1f+'.wav');}catch(_0x38777d){logger[_0xaf81('0x2d')](_0x38777d);}return _0x41d7d4;}return this[_0xaf81('0x38')]['error'](_0x15886b,_0xaf81('0x1b9'));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1ba')]=function(_0x3c3422){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x1bb'),_0x3c3422[_0xaf81('0x3a')]));_0x3c3422[_0xaf81('0x64')]=_0x3c3422[_0xaf81('0x64')][_0xaf81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf81('0x8b')](_0x3c3422[_0xaf81('0x64')])){return this['channel'][_0xaf81('0xad')](_0xaf81('0xae'));}this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x1bc'),_0x3c3422[_0xaf81('0x64')]));var _0x282605=this['googleTTS'][_0xaf81('0x73')](this,_0x3c3422);if(_0x282605){this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x282605));var _0x9b33a7=this['channel']['streamFile'](_0x282605);try{fs[_0xaf81('0xff')](_0x282605+'.wav');}catch(_0x5d636a){logger[_0xaf81('0x2d')](_0x5d636a);}return _0x9b33a7;}return this[_0xaf81('0x38')]['error'](_0x3c3422,_0xaf81('0x1bd'));};AGIVertices['prototype'][_0xaf81('0x1be')]=function(_0x3db4fe){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x1bf'),_0x3db4fe[_0xaf81('0x3a')]));if(!this['isConfigured'](_0x3db4fe['findBy'])){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0x3db4fe,_0xaf81('0x153'));}logger[_0xaf81('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x3db4fe['findBy']));var _0x3d1455=this[_0xaf81('0x55')]['sync'](this,_0x3db4fe[_0xaf81('0x155')]);if(_0x3d1455){logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x156'),this['channel']['callerid'],_0x3db4fe[_0xaf81('0x155')]));this[_0xaf81('0x38')]['noop'](util[_0xaf81('0x2a')](_0xaf81('0x156'),this['channel']['callerid'],_0x3db4fe[_0xaf81('0x155')]));return{'code':0xc8,'result':_0xaf81('0x157')};}else{logger['info'](util[_0xaf81('0x2a')](_0xaf81('0x158'),this[_0xaf81('0x38')][_0xaf81('0x3e')],_0x3db4fe[_0xaf81('0x155')]));this[_0xaf81('0x38')][_0xaf81('0xad')](util[_0xaf81('0x2a')](_0xaf81('0x158'),this['channel'][_0xaf81('0x3e')],_0x3db4fe[_0xaf81('0x155')]));return{'code':0xc8,'result':_0xaf81('0x159')};}};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1c0')]=function(_0x12dca4){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x12dca4[_0xaf81('0x3a')]));var _0x5efeba=this['channel'][_0xaf81('0x5b')](_0xaf81('0x1c1'),[_0x12dca4[_0xaf81('0x1c2')],_0x12dca4[_0xaf81('0x7d')]]);if(_0x5efeba['result']===-0x1){return _0x5efeba;}return this[_0xaf81('0x38')][_0xaf81('0xad')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x12dca4['mailbox']));};AGIVertices[_0xaf81('0x10')][_0xaf81('0x1c3')]=function(_0xef5a07){logger[_0xaf81('0x2f')](util[_0xaf81('0x2a')](_0xaf81('0x1c4'),_0xef5a07[_0xaf81('0x3a')]));if(!this[_0xaf81('0x8b')](_0xef5a07['variable_id'])){return this['channel'][_0xaf81('0x2d')](_0xef5a07,_0xaf81('0x1a3'));}var _0xc5c64=this[_0xaf81('0x11')][_0xaf81('0x73')](this,_0xef5a07[_0xaf81('0x110')]);if(!_0xc5c64){return this[_0xaf81('0x38')][_0xaf81('0x2d')](_0xef5a07,_0xaf81('0xd8'));}var _0xa78620=this[_0xaf81('0x38')][_0xaf81('0x11')](_0xc5c64);return{'code':0xc8,'result':_0xa78620[_0xaf81('0xa7')]?_0xa78620[_0xaf81('0xa7')]:'-'};};String['prototype'][_0xaf81('0x1c5')]=function(_0x1be203,_0x40dfe8){return this['split'](_0x1be203)[_0xaf81('0x1c6')](_0x40dfe8);};module[_0xaf81('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x58a7=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','forEach','keys','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','response','no\x20variable\x20selected\x20for\x20the\x20result','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','success','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','user','template_id','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','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','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','createSquareRecording','uniqueid','callerid','calleridname','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','hasOwnProperty','%s.%s','isArray','length','saveRestApiResult','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','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','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block'];(function(_0x6893c7,_0x3abe93){var _0x5f39b7=function(_0x1b00b9){while(--_0x1b00b9){_0x6893c7['push'](_0x6893c7['shift']());}};_0x5f39b7(++_0x3abe93);}(_0x58a7,0xf7));var _0x758a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x58a7[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var util=require(_0x758a('0x0'));var _=require(_0x758a('0x1'));var sh=require(_0x758a('0x2'));var odbc=require(_0x758a('0x3'))();var rs=require(_0x758a('0x4'));var moment=require(_0x758a('0x5'));var Mustache=require(_0x758a('0x6'));var rp=require(_0x758a('0x7'));var logger=require('../../config/logger')(_0x758a('0x8'));var config=require(_0x758a('0x9'));var shared=require(_0x758a('0xa'));var scripts=require(_0x758a('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x758a('0xc')];var verticesWithRetry=['menu',_0x758a('0xd'),_0x758a('0xe')];var AGIVertices=function(_0x189085,_0x12a46b,_0x1e5665){this[_0x758a('0xf')]=_0x189085;this[_0x758a('0x10')]=_0x12a46b;this[_0x758a('0x11')]=_0x1e5665;};AGIVertices[_0x758a('0x12')][_0x758a('0x13')]=function(_0x3224b4,_0x4bde5d){this['rpc'][_0x758a('0x14')](_0x3224b4)[_0x758a('0x15')](function(_0x1785d1){_0x4bde5d(null,_0x1785d1?_0x1785d1['name']:![]);})[_0x758a('0x16')](function(_0x2cc841){_0x4bde5d(_0x2cc841);});};AGIVertices[_0x758a('0x12')][_0x758a('0x17')]=function(_0x223861,_0x541d85){this['rpc'][_0x758a('0x18')](_0x223861)[_0x758a('0x15')](function(_0x1653f1){_0x541d85(null,_0x1653f1?_0x1653f1['name']:![]);})['catch'](function(_0x5a9512){_0x541d85(_0x5a9512);});};AGIVertices['prototype'][_0x758a('0x19')]=function(_0x65523a,_0x520883){this[_0x758a('0x10')][_0x758a('0x1a')](_0x65523a)[_0x758a('0x15')](function(_0x12dc48){_0x520883(null,_0x12dc48?_0x12dc48[_0x758a('0x1b')]:![]);})[_0x758a('0x16')](function(_0x452bbb){_0x520883(_0x452bbb);});};AGIVertices[_0x758a('0x12')][_0x758a('0x1c')]=function(_0x15653b,_0x317427){this[_0x758a('0x10')][_0x758a('0x1d')](_0x15653b)[_0x758a('0x15')](function(_0x1f7a34){_0x317427(null,_0x1f7a34?_0x1f7a34[_0x758a('0x1e')]:![]);})['catch'](function(_0xc3f455){_0x317427(_0xc3f455);});};AGIVertices[_0x758a('0x12')][_0x758a('0x1f')]=function(_0x3ba95e,_0x239fd9){this[_0x758a('0x10')][_0x758a('0x20')](_0x3ba95e)['then'](function(_0x1bc4e2){_0x239fd9(null,_0x1bc4e2?_0x1bc4e2[_0x758a('0x1b')]:![]);})['catch'](function(_0x4b1e08){_0x239fd9(_0x4b1e08);});};AGIVertices[_0x758a('0x12')][_0x758a('0x21')]=function(_0x1a73d5,_0x32d0d5){this[_0x758a('0x10')]['getTrunkById'](_0x1a73d5)[_0x758a('0x15')](function(_0x5d0499){_0x32d0d5(null,_0x5d0499?_0x5d0499['name']:![]);})[_0x758a('0x16')](function(_0x3e01f4){_0x32d0d5(_0x3e01f4);});};AGIVertices[_0x758a('0x12')]['getSound']=function(_0x14600a,_0x327082){var _0x68b65d=this;this[_0x758a('0x10')][_0x758a('0x22')](_0x14600a)[_0x758a('0x15')](function(_0xe21322){_0x327082(null,_0xe21322?_0x68b65d[_0x758a('0x23')](_0xe21322[_0x758a('0x24')]):![]);})[_0x758a('0x16')](function(_0x1808c8){_0x327082(_0x1808c8);});};AGIVertices['prototype']['getMailAccount']=function(_0x10850b,_0x1cd222){this[_0x758a('0x10')][_0x758a('0x25')](_0x10850b)[_0x758a('0x15')](function(_0x301508){_0x1cd222(null,_0x301508?_0x301508:![]);})[_0x758a('0x16')](function(_0x17732e){_0x1cd222(_0x17732e);});};AGIVertices[_0x758a('0x12')][_0x758a('0x26')]=function(_0x20d8fb,_0x43a799,_0x3ba6cf){this['mailRpc'][_0x758a('0x26')](_0x20d8fb,_0x43a799)[_0x758a('0x15')](function(){_0x3ba6cf(null);})['catch'](function(_0x4284fb){_0x3ba6cf(_0x4284fb);});};AGIVertices[_0x758a('0x12')][_0x758a('0x27')]=function(_0x10385c,_0x592287){this['rpc'][_0x758a('0x28')](_0x10385c)[_0x758a('0x15')](function(_0x4f239a){if(_0x4f239a){if(_0x4f239a['IntervalId']){_0x592287(null,[_0x4f239a[_0x758a('0x29')]]);}else{_0x592287(null,_[_0x758a('0x2a')](_0x4f239a[_0x758a('0x2b')],_0x758a('0x29')));}}else{_0x592287(null,![]);}})[_0x758a('0x16')](function(_0x571296){_0x592287(_0x571296);});};AGIVertices[_0x758a('0x12')]['getSoundPath']=function(_0x516b94){return util[_0x758a('0x2c')](_0x758a('0x2d'),FILES_PATH,_0x516b94);};AGIVertices[_0x758a('0x12')][_0x758a('0x2e')]=function(_0x3e39db,_0x4810f9,_0xc6d97f){odbc[_0x758a('0x2f')](_0x3e39db,function(_0x2929fb){if(_0x2929fb){logger[_0x758a('0x30')](_0x758a('0x31'),_0x2929fb);_0xc6d97f(_0x2929fb);}else{logger[_0x758a('0x32')](_0x758a('0x33'));odbc['query'](_0x4810f9,function(_0x2c5f6a,_0x38ed79){if(_0x2c5f6a){logger[_0x758a('0x32')](_0x758a('0x34'),_0x4810f9);_0xc6d97f(_0x2c5f6a);}else{logger[_0x758a('0x32')]('Query\x20executed\x20correctly\x20%s',_0x4810f9);odbc[_0x758a('0x35')](function(_0x1d40f3){if(_0x1d40f3){logger[_0x758a('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1d40f3);}_0xc6d97f(null,_0x38ed79);});}});}});};AGIVertices[_0x758a('0x12')]['getSmsAccount']=function(_0x219d47,_0x16eed5){this['rpc'][_0x758a('0x36')](_0x219d47)[_0x758a('0x15')](function(_0x24755f){_0x16eed5(null,_0x24755f?_0x24755f:![]);})[_0x758a('0x16')](function(_0x1fb698){_0x16eed5(_0x1fb698);});};AGIVertices[_0x758a('0x12')][_0x758a('0x37')]=function(_0x456429,_0x27b83d){this[_0x758a('0x10')][_0x758a('0x37')](_0x456429)[_0x758a('0x15')](function(_0x3dbc2f){_0x27b83d(null,_0x3dbc2f);})[_0x758a('0x16')](function(_0x28b34c){_0x27b83d(_0x28b34c);});};AGIVertices[_0x758a('0x12')][_0x758a('0x38')]=function(_0x3a7bca,_0x114fcb,_0x554f39){this[_0x758a('0x10')][_0x758a('0x38')]({'uniqueid':this['channel']['uniqueid'],'node':_0x3a7bca[_0x758a('0x39')],'application':_0x3a7bca['agicommand'],'data':_0x114fcb||null,'project_name':this['channel'][_0x758a('0x3a')],'callerid':this[_0x758a('0xf')]['callerid']})[_0x758a('0x15')](function(_0x4039e3){if(_0x554f39){_0x554f39(null,_0x4039e3);}})[_0x758a('0x16')](function(_0x21579f){if(_0x554f39){_0x554f39(_0x21579f);}});};AGIVertices[_0x758a('0x12')][_0x758a('0x3b')]=function(_0x210b5f,_0x2b5e53,_0x550002,_0x48fd7b){this[_0x758a('0x10')][_0x758a('0x3b')]({'uniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'callerid':this[_0x758a('0xf')][_0x758a('0x3d')],'calleridname':this[_0x758a('0xf')][_0x758a('0x3e')],'context':this[_0x758a('0xf')]['context'],'extension':this[_0x758a('0xf')]['extension'],'priority':this['channel'][_0x758a('0x3f')],'accountcode':this[_0x758a('0xf')]['accountcode'],'dnid':this[_0x758a('0xf')][_0x758a('0x40')],'projectName':this[_0x758a('0xf')][_0x758a('0x3a')],'saveName':_0x2b5e53,'filename':_0x210b5f[_0x758a('0x41')]||_0x2b5e53,'savePath':_0x550002})['then'](function(_0x3d867c){_0x48fd7b(null,_0x3d867c);})[_0x758a('0x16')](function(_0x1d7ff7){_0x48fd7b(_0x1d7ff7);});};AGIVertices[_0x758a('0x12')][_0x758a('0x42')]=function(_0x5df989,_0x312893,_0x502476,_0x27dd9e,_0x1d0c59){this[_0x758a('0x10')][_0x758a('0x42')]({'uniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'body':_0x5df989,'direction':_0x312893,'providerName':_0x502476,'providerResponse':_0x27dd9e})[_0x758a('0x15')](function(_0x3e8a6c){if(_0x1d0c59){_0x1d0c59(null,_0x3e8a6c);}})[_0x758a('0x16')](function(_0x4f52b9){if(_0x1d0c59){_0x1d0c59(_0x4f52b9);}});};AGIVertices[_0x758a('0x12')][_0x758a('0x43')]=function(_0x2e50a2,_0x181d03){this['rpc'][_0x758a('0x43')]({'firstName':_[_0x758a('0x44')](_0x2e50a2[_0x758a('0x1b')])||_[_0x758a('0x45')](_0x2e50a2[_0x758a('0x1b')])?'callback_'+Math['random']():_0x2e50a2['name'],'lastName':_[_0x758a('0x44')](_0x2e50a2[_0x758a('0x46')])||_[_0x758a('0x45')](_0x2e50a2['lastName'])?null:_0x2e50a2['lastName'],'phone':_0x2e50a2['phone'],'ListId':_0x2e50a2['list_id'],'scheduledat':_0x2e50a2[_0x758a('0x47')],'callbackUniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'tags':_0x758a('0x48'),'description':_0x758a('0x49')+_0x2e50a2[_0x758a('0x47')][_0x758a('0x4a')](),'priority':_0x2e50a2[_0x758a('0x4b')]})[_0x758a('0x15')](function(_0x12cd48){_0x181d03(null,_0x12cd48);})[_0x758a('0x16')](function(_0x1637c4){_0x181d03(_0x1637c4);});};AGIVertices['prototype']['getPause']=function(_0x20b8ba,_0x2e69b7){this[_0x758a('0x10')][_0x758a('0x4c')](_0x20b8ba)['then'](function(_0x152db5){_0x2e69b7(null,_0x152db5?_0x152db5[_0x758a('0x1b')]:![]);})[_0x758a('0x16')](function(_0x19101b){_0x2e69b7(_0x19101b);});};AGIVertices[_0x758a('0x12')][_0x758a('0x4d')]=function(_0x1275fb,_0x5009b8,_0x2f9e2){var _0xfb063={'role':_0x758a('0x4e')};_0xfb063[_0x1275fb]=this['channel'][_0x758a('0x3d')];this[_0x758a('0x10')][_0x758a('0x4d')](_0xfb063,_0x5009b8,this[_0x758a('0xf')][_0x758a('0x3c')])[_0x758a('0x15')](function(_0x11dae2){_0x2f9e2(null,_[_0x758a('0x45')](_0x11dae2)?![]:!![]);})[_0x758a('0x16')](function(_0x103507){logger['error'](_0x103507);_0x2f9e2(null,![]);});};AGIVertices[_0x758a('0x12')]['agentUnpause']=function(_0x319335,_0x5a41b1){var _0x39af7a={'role':_0x758a('0x4e')};_0x39af7a[_0x319335]=this['channel'][_0x758a('0x3d')];this[_0x758a('0x10')][_0x758a('0x4f')](_0x39af7a)[_0x758a('0x15')](function(_0x1e6059){_0x5a41b1(null,_[_0x758a('0x45')](_0x1e6059)?![]:!![]);})[_0x758a('0x16')](function(_0x112624){logger[_0x758a('0x30')](_0x112624);_0x5a41b1(null,![]);});};AGIVertices[_0x758a('0x12')][_0x758a('0x50')]=function(_0x5cc829,_0x11ca3b){var _0x846881={'role':_0x758a('0x4e')};_0x846881[_0x5cc829]=this[_0x758a('0xf')][_0x758a('0x3d')];this[_0x758a('0x10')]['agentLogout'](_0x846881)[_0x758a('0x15')](function(_0x22a9b3){_0x11ca3b(null,_['isNil'](_0x22a9b3)?![]:!![]);})[_0x758a('0x16')](function(_0xe9c69e){logger[_0x758a('0x30')](_0xe9c69e);_0x11ca3b(null,![]);});};AGIVertices['prototype'][_0x758a('0x51')]=function(_0x1f455f,_0x539cb5){var _0x559f70={'role':_0x758a('0x4e')};_0x559f70[_0x1f455f]=this[_0x758a('0xf')]['callerid'];var _0x2a8ea5=_0x1f455f!='internal'?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x758a('0xf')]['callerid']):undefined;this['rpc'][_0x758a('0x51')](_0x559f70,_0x2a8ea5)[_0x758a('0x15')](function(_0x383be2){_0x539cb5(null,_['isNil'](_0x383be2)?![]:!![]);})[_0x758a('0x16')](function(_0x4cc342){logger[_0x758a('0x30')](_0x4cc342);_0x539cb5(null,![]);});};AGIVertices['prototype'][_0x758a('0x52')]=function(_0x52a120,_0x54cd6a){sh[_0x758a('0x53')](_[_0x758a('0x54')](_0x52a120),function(_0x4eee62,_0x8460df){var _0x54b5a7=_0x8460df['replace'](/(\r\n|\n|\r)/gm,'');_0x54cd6a(null,_0x54b5a7);});};AGIVertices[_0x758a('0x12')][_0x758a('0x55')]=function(_0x27ebdf,_0x57bc7d){scripts[_0x758a('0x55')](_0x27ebdf[_0x758a('0x56')],_0x27ebdf[_0x758a('0x57')]||_0x758a('0x58'),_0x27ebdf[_0x758a('0x58')],_0x27ebdf['languageCode']||'en-US',_0x27ebdf[_0x758a('0x59')]||_0x758a('0x5a'),_0x27ebdf['audioEncoding']||'MP3')[_0x758a('0x15')](function(_0x844cee){_0x57bc7d(null,_0x844cee);})[_0x758a('0x16')](function(_0x2a1531){_0x57bc7d(_0x2a1531);});};AGIVertices['prototype'][_0x758a('0x5b')]=function(_0x2ec75a,_0xd2f9b1){scripts['googleTTS'](_0x2ec75a[_0x758a('0x58')],_0x2ec75a[_0x758a('0x5c')]||'en',0x1)[_0x758a('0x15')](function(_0x40ca6b){_0xd2f9b1(null,_0x40ca6b);})[_0x758a('0x16')](function(_0x47c7f8){_0xd2f9b1(_0x47c7f8);});};AGIVertices['prototype'][_0x758a('0x5d')]=function(_0x2a64b8,_0x426037){var _0x4a8c7f={'uri':_0x2a64b8[_0x758a('0x5e')],'method':_0x2a64b8[_0x758a('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2a64b8[_0x758a('0x60')])==='number'&&parseInt(_0x2a64b8[_0x758a('0x60')])>=0x1?parseInt(_0x2a64b8[_0x758a('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x758a('0x61')]([_0x758a('0x62'),_0x758a('0x63')],_0x4a8c7f['method'][_0x758a('0x64')]())){try{_0x4a8c7f[_0x758a('0x65')]=_0x2a64b8['rawBody']?JSON[_0x758a('0x66')](_0x2a64b8[_0x758a('0xc')]):{};}catch(_0x47d105){logger[_0x758a('0x30')](_0x758a('0x67'),_0x47d105);}}try{_0x4a8c7f['headers']=_0x2a64b8[_0x758a('0x68')]?JSON[_0x758a('0x66')](_0x2a64b8['rawHeaders']):{};}catch(_0x2f6336){logger['error'](_0x758a('0x69'),_0x2f6336);}if(_0x2a64b8[_0x758a('0x6a')]){try{var _0x363c24=require(_0x2a64b8[_0x758a('0x6a')])[_0x758a('0x6b')](this,_0x4a8c7f);_0x4a8c7f[_0x758a('0x6c')]=Mustache['render'](_0x2a64b8[_0x758a('0x5e')],_0x363c24,{},['$$','$$']);if(_0x4a8c7f[_0x758a('0x6d')]){_0x4a8c7f[_0x758a('0x6d')]=JSON[_0x758a('0x66')](Mustache[_0x758a('0x6e')](JSON[_0x758a('0x6f')](_0x4a8c7f[_0x758a('0x6d')]),_0x363c24,{},['$$','$$']));}if(_0x4a8c7f[_0x758a('0x65')]){_0x4a8c7f['body']=JSON[_0x758a('0x66')](Mustache['render'](JSON['stringify'](_0x4a8c7f['body']),_0x363c24,{},['$$','$$']));}}catch(_0x48f33e){logger[_0x758a('0x30')](_0x758a('0x70'),_0x48f33e);}}rp(_0x4a8c7f)[_0x758a('0x15')](function(_0x4812aa){var _0x28caba={'statusCode':_0x4812aa['statusCode']||0xc8,'statusMessage':_0x4812aa[_0x758a('0x71')]||'OK','headers':_0x4812aa[_0x758a('0x6d')]||{},'body':_0x4812aa[_0x758a('0x65')]||{}};_0x426037(null,_0x28caba);})[_0x758a('0x16')](function(_0xb7c2f4){var _0x3d2da5={'statusCode':_0xb7c2f4[_0x758a('0x72')]||0x1f4,'statusMessage':_0xb7c2f4['message']||_0x758a('0x73'),'headers':_0xb7c2f4[_0x758a('0x74')]['headers']||{},'body':_0xb7c2f4[_0x758a('0x74')][_0x758a('0x65')]||{}};_0x426037(null,_0x3d2da5);});};AGIVertices[_0x758a('0x12')][_0x758a('0x75')]=function(_0xc6a643,_0xa78b0b){scripts[_0x758a('0x75')](this[_0x758a('0xf')]['uniqueid'],_0xc6a643[_0x758a('0x76')],_0xc6a643[_0x758a('0x58')],_0xc6a643[_0x758a('0x77')]||'en')[_0x758a('0x15')](function(_0x2db9aa){_0xa78b0b(null,_0x2db9aa);})[_0x758a('0x16')](function(_0x1fd030){_0xa78b0b(_0x1fd030);});};AGIVertices['prototype'][_0x758a('0x78')]=function(_0x2dfb94,_0x2a231d){scripts[_0x758a('0x78')](this['channel'][_0x758a('0x3c')],_0x2dfb94[_0x758a('0x79')],_0x2dfb94[_0x758a('0x7a')],_0x2dfb94[_0x758a('0x7b')],_0x2dfb94['text'],_0x2dfb94[_0x758a('0x7c')]||'en')[_0x758a('0x15')](function(_0x13caea){_0x2a231d(null,_0x13caea);})[_0x758a('0x16')](function(_0x4f0fbb){_0x2a231d(_0x4f0fbb);});};AGIVertices['prototype'][_0x758a('0x7d')]=function(_0x2e3855,_0x540276){scripts[_0x758a('0x7d')](this[_0x758a('0xf')],_0x2e3855)[_0x758a('0x15')](function(_0x3115c6){_0x540276(null,_0x3115c6);})[_0x758a('0x16')](function(_0x3f328b){_0x540276(_0x3f328b);});};AGIVertices[_0x758a('0x12')][_0x758a('0x7e')]=function(_0x31d166,_0x476807){scripts[_0x758a('0x7e')](_0x31d166['key'],_0x31d166[_0x758a('0x58')],_0x31d166[_0x758a('0x7f')]||_0x758a('0x80'),_0x31d166[_0x758a('0x81')])[_0x758a('0x15')](function(_0x475c75){_0x476807(null,_0x475c75);})[_0x758a('0x16')](function(_0x5e3642){_0x476807(_0x5e3642);});};AGIVertices[_0x758a('0x12')][_0x758a('0x82')]=function(_0x4f9c67,_0x25958f,_0x3ee78b){scripts[_0x758a('0x82')](_0x25958f,_0x4f9c67[_0x758a('0x76')],_0x4f9c67[_0x758a('0x83')]||'en-US',this[_0x758a('0x84')](_0x4f9c67[_0x758a('0x85')])?_0x4f9c67[_0x758a('0x85')]:undefined)[_0x758a('0x15')](function(_0x5588bf){_0x3ee78b(null,_0x5588bf);})[_0x758a('0x16')](function(_0x4c90dc){_0x3ee78b(_0x4c90dc);});};AGIVertices['prototype']['awsPolly']=function(_0x2ad855,_0x3c9dcf){scripts[_0x758a('0x86')](_0x2ad855[_0x758a('0x87')],_0x2ad855[_0x758a('0x88')],_0x2ad855[_0x758a('0x89')],_0x2ad855[_0x758a('0x8a')]||_0x758a('0x8b'),_0x2ad855[_0x758a('0x58')],_0x2ad855[_0x758a('0x8c')]||'text')['then'](function(_0x52fcac){_0x3c9dcf(null,_0x52fcac);})[_0x758a('0x16')](function(_0x2c9cf6){_0x3c9dcf(_0x2c9cf6);});};AGIVertices['prototype'][_0x758a('0x8d')]=function(_0x119c3b,_0xccc19e){scripts['awsLex'](this[_0x758a('0xf')][_0x758a('0x3c')],_0x119c3b[_0x758a('0x87')],_0x119c3b[_0x758a('0x88')],_0x119c3b[_0x758a('0x8e')],_0x119c3b[_0x758a('0x58')],_0x119c3b[_0x758a('0x8f')])['then'](function(_0x463d3e){_0xccc19e(null,_0x463d3e);})['catch'](function(_0x41221f){_0xccc19e(_0x41221f);});};AGIVertices[_0x758a('0x12')][_0x758a('0x90')]=function(_0x1da3fe,_0x4b4b41,_0x29be79){scripts[_0x758a('0x90')](_0x4b4b41,_0x1da3fe[_0x758a('0x76')],_0x1da3fe[_0x758a('0x91')]||_0x758a('0x80'))[_0x758a('0x15')](function(_0x39a40d){_0x29be79(null,_0x39a40d);})[_0x758a('0x16')](function(_0x1385a3){_0x29be79(_0x1385a3);});};AGIVertices[_0x758a('0x12')][_0x758a('0x92')]=function(_0x261d2d,_0x5ba616,_0x1a15e3){scripts['tildeASR'](_0x5ba616,_0x261d2d[_0x758a('0x93')],_0x261d2d['appsecret'],_0x261d2d[_0x758a('0x6c')])[_0x758a('0x15')](function(_0x3a1bb0){_0x1a15e3(null,_0x3a1bb0);})[_0x758a('0x16')](function(_0x3412b8){_0x1a15e3(_0x3412b8);});};AGIVertices[_0x758a('0x12')][_0x758a('0x94')]=function(_0x530db7){var _0x584eaa=_['includes'](verticesWithRetry,_0x530db7['agicommand'])?_0x530db7:_[_0x758a('0x95')](_0x530db7);for(var _0x37e4e2 in _0x584eaa){if(_0x584eaa['hasOwnProperty'](_0x37e4e2)){if(_0x584eaa[_0x37e4e2]&&_[_0x758a('0x96')](_0x584eaa[_0x37e4e2])){if(_[_0x758a('0x61')](recursiveMapAttributes,_0x37e4e2)){_0x584eaa[_0x37e4e2]=this[_0x758a('0x97')](_0x584eaa[_0x37e4e2]);}else{_0x584eaa[_0x37e4e2]=this[_0x758a('0x98')](_0x584eaa[_0x37e4e2]);}}}}return _0x584eaa;};AGIVertices[_0x758a('0x12')][_0x758a('0x99')]=function(_0x560e54){for(var _0xeff6fc in _0x560e54){if(_0x560e54['hasOwnProperty'](_0xeff6fc)){if(_[_0x758a('0x9a')](_0x560e54[_0xeff6fc])){this[_0x758a('0x99')](_0x560e54[_0xeff6fc]);}else if(_['isArray'](_0x560e54[_0xeff6fc])){for(var _0x25a8af=0x0;_0x25a8af<_0x560e54[_0xeff6fc]['length'];_0x25a8af++){this[_0x758a('0x99')](_0x560e54[_0xeff6fc][_0x25a8af]);}}else if(_[_0x758a('0x96')](_0x560e54[_0xeff6fc])){_0x560e54[_0xeff6fc]=this['replaceAllVariables'](_0x560e54[_0xeff6fc]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x74c1e4,_0x10fbf3){for(var _0x2dd69c in _0x74c1e4){if(_0x74c1e4[_0x758a('0x9b')](_0x2dd69c)){if(_[_0x758a('0x9a')](_0x74c1e4[_0x2dd69c])){if(!_[_0x758a('0x44')](_0x74c1e4[_0x2dd69c])){this['saveRestApiResult'](_0x74c1e4[_0x2dd69c],util[_0x758a('0x2c')](_0x758a('0x9c'),_0x10fbf3,_0x2dd69c));}}else if(_[_0x758a('0x9d')](_0x74c1e4[_0x2dd69c])){for(var _0x5591c9=0x0;_0x5591c9<_0x74c1e4[_0x2dd69c][_0x758a('0x9e')];_0x5591c9++){this[_0x758a('0x9f')](_0x74c1e4[_0x2dd69c][_0x5591c9],util[_0x758a('0x2c')]('%s.%s',_0x10fbf3,_0x2dd69c+'['+_0x5591c9+']'));}}else{if(!_[_0x758a('0x45')](_0x74c1e4[_0x2dd69c])){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x9c'),_0x10fbf3,_0x2dd69c),_0x74c1e4[_0x2dd69c]);}}}}};AGIVertices[_0x758a('0x12')][_0x758a('0x97')]=function(_0xa6b13a){try{var _0x6cb717=JSON[_0x758a('0x66')](_0xa6b13a);this[_0x758a('0x99')](_0x6cb717);return JSON[_0x758a('0x6f')](_0x6cb717);}catch(_0x1face4){return this[_0x758a('0x98')](_0xa6b13a);}};AGIVertices[_0x758a('0x12')][_0x758a('0x98')]=function(_0x59f56b){var _0x5908a6=_0x59f56b[_0x758a('0xa1')]('{');for(var _0x2cafc3=0x1;_0x2cafc3<_0x5908a6[_0x758a('0x9e')];_0x2cafc3+=0x1){var _0x1c5ba0=_0x5908a6[_0x2cafc3][_0x758a('0xa1')]('}');if(_0x1c5ba0[_0x758a('0x9e')]>0x1){_0x59f56b=_0x59f56b[_0x758a('0xa2')]('{'+_0x1c5ba0[0x0]+'}',this[_0x758a('0xf')][_0x758a('0x13')](_0x1c5ba0[0x0])['extra']||_0x1c5ba0[0x0]);}}if(_0x5908a6[_0x758a('0x9e')]===0x1){return _0x59f56b[_0x758a('0x4a')]();}return this[_0x758a('0x98')](_0x59f56b);};AGIVertices[_0x758a('0x12')][_0x758a('0xa3')]=function(_0x250e28,_0x18d8dd){var _0x524ee4=this[_0x758a('0xf')]['getVariable'](_0x250e28);if(_0x524ee4[_0x758a('0xa4')]===-0x1){return _0x524ee4;}logger['info'](util[_0x758a('0x2c')](_0x758a('0xa5'),_0x18d8dd,_0x524ee4[_0x758a('0xa6')]));return this[_0x758a('0xf')][_0x758a('0xa0')](_0x18d8dd,_0x524ee4[_0x758a('0xa6')]);};AGIVertices[_0x758a('0x12')]['isConfigured']=function(_0x542f10){return _0x542f10&&_0x542f10!=='0'&&_0x542f10!=='-1'&&_0x542f10!=='';};AGIVertices[_0x758a('0x12')][_0x758a('0xa7')]=function(_0x5e3ce1){this['createSquareDetailsReport']['sync'](this,_0x5e3ce1,'-');_0x5e3ce1[_0x758a('0xa8')]=_0x5e3ce1['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x758a('0x12')]['mrcpsynth']=function(_0x4479c4){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4479c4[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4479c4[_0x758a('0x58')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xa9'));}var _0x179d32='\x22'+_0x4479c4[_0x758a('0x58')]+'\x22';if(this['isConfigured'](_0x4479c4[_0x758a('0x74')])){_0x179d32+=','+_0x4479c4[_0x758a('0x74')];}var _0x49109e=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaa'),_0x179d32);if(_0x49109e[_0x758a('0xa4')]===-0x1){return _0x49109e;}return this['channel']['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x179d32));};AGIVertices[_0x758a('0x12')][_0x758a('0xab')]=function(_0x5ccc56){logger['info'](util[_0x758a('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5ccc56[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x5ccc56[_0x758a('0xac')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xae'));}var _0x340360=_0x5ccc56[_0x758a('0xac')];if(this['isConfigured'](_0x5ccc56['options'])){_0x340360+=','+_0x5ccc56['options'];}var _0x3faf98=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x340360);if(_0x3faf98[_0x758a('0xa4')]===-0x1){return _0x3faf98;}var _0x3cfd8f=this[_0x758a('0xa3')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x3cfd8f['result']===-0x1){return _0x3cfd8f;}var _0x2661f5=this['getAndSetVariable'](_0x758a('0xb0'),_0x758a('0xb1'));if(_0x2661f5[_0x758a('0xa4')]===-0x1){return _0x2661f5;}var _0x1a209c=this['getAndSetVariable'](_0x758a('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x1a209c['result']===-0x1){return _0x1a209c;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xb3'),_0x340360));};AGIVertices[_0x758a('0x12')]['agi']=function(_0x39e634){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb4'),_0x39e634[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x8')]([_0x39e634[_0x758a('0xb5')],_0x39e634['args']]);};AGIVertices[_0x758a('0x12')][_0x758a('0xb6')]=function(_0x291525){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb7'),_0x291525[_0x758a('0x39')]));if(this['isConfigured'](_0x291525[_0x758a('0x60')])){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb8'),_0x291525[_0x758a('0x60')]));var _0x18ed75=this[_0x758a('0xf')][_0x758a('0xb9')](_0x291525['timeout']);if(_0x18ed75[_0x758a('0xa4')]===-0x1){return _0x18ed75;}}return this[_0x758a('0xf')]['answer']();};AGIVertices[_0x758a('0x12')][_0x758a('0x48')]=function(_0x56496e){logger[_0x758a('0x32')](util['format'](_0x758a('0xba'),_0x56496e[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x56496e[_0x758a('0xbb')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x56496e,'no\x20list\x20selected');}_0x56496e['scheduledAt']=moment();if(this[_0x758a('0x84')](_0x56496e[_0x758a('0xbc')])){_0x56496e['scheduledAt']=moment()[_0x758a('0xbd')](_0x56496e[_0x758a('0xbc')],_0x758a('0xbe'));}if(!this[_0x758a('0x84')](_0x56496e['callback_priority'])){_0x56496e[_0x758a('0x4b')]=0x2;}this[_0x758a('0x43')]['sync'](this,_0x56496e);return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xbf'),_0x56496e['phone'],_0x56496e[_0x758a('0xbb')],_0x56496e[_0x758a('0x47')]));};AGIVertices[_0x758a('0x12')][_0x758a('0xc0')]=function(_0x463176){logger[_0x758a('0x32')](util['format'](_0x758a('0xc1'),_0x463176['label']));var _0x453ac7=this[_0x758a('0xf')][_0x758a('0x53')](_0x463176['application'],_0x463176[_0x758a('0x74')]);if(_0x453ac7[_0x758a('0xa4')]===-0x1){return _0x453ac7;}return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0xc2'),_0x463176[_0x758a('0xc3')],_0x463176[_0x758a('0x74')]));};AGIVertices['prototype'][_0x758a('0xc4')]=function(_0x368b5d){logger['info'](util[_0x758a('0x2c')](_0x758a('0xc5'),_0x368b5d[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x368b5d[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}var _0x241bd5='\x22'+_0x368b5d[_0x758a('0x58')]+'\x22';if(this[_0x758a('0x84')](_0x368b5d['options'])){_0x241bd5+=','+_0x368b5d[_0x758a('0x74')];}var _0x4dfac5=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaa'),_0x241bd5);if(_0x4dfac5[_0x758a('0xa4')]===-0x1){return _0x4dfac5;}return this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x241bd5));};AGIVertices[_0x758a('0x12')]['sestektts']=function(_0x327f62){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xc6'),_0x327f62[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x327f62[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20text\x20configured');}var _0x194fd0='\x22'+_0x327f62[_0x758a('0x58')]+'\x22';if(this[_0x758a('0x84')](_0x327f62[_0x758a('0x74')])){_0x194fd0+=','+_0x327f62[_0x758a('0x74')];}var _0x56ea16=this['channel']['exec'](_0x758a('0xaa'),_0x194fd0);if(_0x56ea16[_0x758a('0xa4')]===-0x1){return _0x56ea16;}return this['channel'][_0x758a('0xad')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x194fd0));};AGIVertices[_0x758a('0x12')]['lumenvoxasr']=function(_0x3e0d84){logger[_0x758a('0x32')](util['format'](_0x758a('0xc7'),_0x3e0d84[_0x758a('0x39')]));if(!this['isConfigured'](_0x3e0d84['grammar'])){return this[_0x758a('0xf')]['noop']('no\x20grammar\x20configured');}var _0x4844d1=_0x3e0d84[_0x758a('0xac')];if(this['isConfigured'](_0x3e0d84[_0x758a('0x74')])){_0x4844d1+=','+_0x3e0d84['options'];}var _0x192096=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x4844d1);if(_0x192096['result']===-0x1){return _0x192096;}var _0x4f6f84=this[_0x758a('0xa3')](_0x758a('0xc8'),_0x758a('0xc9'));if(_0x4f6f84['result']===-0x1){return _0x4f6f84;}var _0x22db2a=this[_0x758a('0xa3')](_0x758a('0xb0'),_0x758a('0xca'));if(_0x22db2a[_0x758a('0xa4')]===-0x1){return _0x22db2a;}var _0x1d5ed0=this['getAndSetVariable'](_0x758a('0xb2'),_0x758a('0xcb'));if(_0x1d5ed0[_0x758a('0xa4')]===-0x1){return _0x1d5ed0;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xb3'),_0x4844d1));};AGIVertices[_0x758a('0x12')]['sestekasr']=function(_0x22af83){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xcc'),_0x22af83[_0x758a('0x39')]));if(!this['isConfigured'](_0x22af83['grammar'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xae'));}var _0x3451f3=_0x22af83[_0x758a('0xac')];if(this[_0x758a('0x84')](_0x22af83[_0x758a('0x74')])){_0x3451f3+=','+_0x22af83[_0x758a('0x74')];}var _0x36a18d=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x3451f3);if(_0x36a18d[_0x758a('0xa4')]===-0x1){return _0x36a18d;}var _0x18e521=this[_0x758a('0xa3')]('RECOG_CONFIDENCE()',_0x758a('0xcd'));if(_0x18e521[_0x758a('0xa4')]===-0x1){return _0x18e521;}var _0xaa7a3d=this['getAndSetVariable'](_0x758a('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0xaa7a3d[_0x758a('0xa4')]===-0x1){return _0xaa7a3d;}var _0x14cb83=this[_0x758a('0xa3')](_0x758a('0xb2'),_0x758a('0xce'));if(_0x14cb83[_0x758a('0xa4')]===-0x1){return _0x14cb83;}return this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3451f3));};AGIVertices['prototype'][_0x758a('0xcf')]=function(_0x4f9d3d){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xd0'),_0x4f9d3d['label']));if(!this['isConfigured'](_0x4f9d3d['odbc_id'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,_0x758a('0xd1'));}var _0x4d3348=this[_0x758a('0x1c')][_0x758a('0x6b')](this,_0x4f9d3d[_0x758a('0xd2')]);if(!_0x4d3348){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,_0x758a('0xd3'));}if(!this['isConfigured'](_0x4f9d3d['query'])){return this[_0x758a('0xf')]['error'](_0x4f9d3d,_0x758a('0xd4'));}var _0x24bce6=_0x4f9d3d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd5'),_0x24bce6));var _0x3256d8=this['getQueryOdbc'][_0x758a('0x6b')](this,_0x4d3348,_0x24bce6);this[_0x758a('0x38')]['sync'](this,_0x4f9d3d,_0x24bce6);if(!this[_0x758a('0x84')](_0x4f9d3d[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x41a595=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x4f9d3d['variable_id']);if(!_0x41a595){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,'no\x20variable\x20found');}var _0x55c54=this;_0x3256d8[_0x758a('0xd7')](function(_0x289200,_0x874bce){Object[_0x758a('0xd8')](_0x289200)[_0x758a('0xd7')](function(_0x1dfadb){_0x55c54['channel']['setVariable'](util[_0x758a('0x2c')]('%s[%s][%s]',_0x41a595,_0x874bce,_0x1dfadb),_0x289200[_0x1dfadb]);});});this['channel'][_0x758a('0xa0')](util['format']('%s_ROWS_COUNT',_0x41a595),_0x3256d8[_0x758a('0x9e')]);return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd9'),_0x41a595));};AGIVertices['prototype'][_0x758a('0xda')]=function(_0x50c11d){logger[_0x758a('0xdb')](util[_0x758a('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x50c11d[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x50c11d[_0x758a('0xdc')])){return this[_0x758a('0xf')]['error'](_0x50c11d,'no\x20user\x20selected');}var _0x25018f=this[_0x758a('0x1f')]['sync'](this,_0x50c11d[_0x758a('0xdc')]);if(!_0x25018f){return this[_0x758a('0xf')][_0x758a('0x30')](_0x50c11d,_0x758a('0xdd'));}var _0x68bbf=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xde'),[util['format'](_0x758a('0xdf'),_0x25018f),_0x50c11d[_0x758a('0x60')],_0x50c11d[_0x758a('0xe0')],_0x50c11d[_0x758a('0x5e')]]);if(_0x68bbf['result']===-0x1){return _0x68bbf;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Executed\x20command\x20%s',_0x758a('0xde')));};AGIVertices[_0x758a('0x12')][_0x758a('0xe1')]=function(_0x4989ed){logger[_0x758a('0x32')](util['format'](_0x758a('0xe2'),_0x4989ed[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4989ed[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}if(!this[_0x758a('0x84')](_0x4989ed[_0x758a('0x58')])){return this['channel'][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xe4')]=!![];this[_0x758a('0x38')](_0x4989ed);this[_0x758a('0x42')](_0x4989ed[_0x758a('0x58')],'in','','');this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0xe5'),_0x4989ed[_0x758a('0x58')]));var _0x3cc36d=this[_0x758a('0x75')][_0x758a('0x6b')](this,_0x4989ed);if(_0x3cc36d){for(var _0x1912a1 in _0x3cc36d){if(_0x3cc36d[_0x758a('0x9b')](_0x1912a1)){this[_0x758a('0xf')]['setVariable'](util[_0x758a('0x2c')]('DIALOGFLOW_%s',_0x1912a1[_0x758a('0x64')]()),_0x3cc36d[_0x1912a1]);}}this[_0x758a('0x42')](_0x3cc36d[_0x758a('0xe6')],_0x758a('0xe7'),_0x758a('0xe1'),'');return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0xe8'),_0x3cc36d['speech']));}return this[_0x758a('0xf')]['error'](_0x4989ed,_0x758a('0xe9'));};AGIVertices['prototype'][_0x758a('0xea')]=function(_0x3cc974){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3cc974[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x3cc974['dialogflowV2_project_id'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xeb'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7a')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xec'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7b')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xed'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7c')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x3cc974[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this['channel']['bot']=!![];this[_0x758a('0x38')](_0x3cc974);this[_0x758a('0x42')](_0x3cc974[_0x758a('0x58')],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x3cc974['text']));var _0x5a8313=this[_0x758a('0x78')][_0x758a('0x6b')](this,_0x3cc974);if(_0x5a8313){for(var _0x278477 in _0x5a8313){if(_0x5a8313[_0x758a('0x9b')](_0x278477)){if(_0x278477!==_0x758a('0xee')){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0xef'),_0x278477[_0x758a('0x64')]()),_0x5a8313[_0x278477]);}}}this['createSquareMessage'](_0x5a8313[_0x758a('0xe6')],_0x758a('0xe7'),'dialogflowV2',_0x5a8313[_0x758a('0xee')]);return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xf0'),_0x5a8313[_0x758a('0xe6')]));}return this[_0x758a('0xf')][_0x758a('0x30')](_0x3cc974,_0x758a('0xf1'));};AGIVertices[_0x758a('0x12')][_0x758a('0xf2')]=function(_0x51cbd4){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xf3'),_0x51cbd4[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x51cbd4['ndauth_url'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xf4'));}if(!this[_0x758a('0x84')](_0x51cbd4[_0x758a('0xf5')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xf6'));}if(!this['isConfigured'](_0x51cbd4[_0x758a('0xf7')])){return this[_0x758a('0xf')]['noop']('no\x20password\x20configured');}if(!this[_0x758a('0x84')](_0x51cbd4[_0x758a('0xf8')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xa9'));}this['channel'][_0x758a('0xe4')]=!![];this['createSquareDetailsReport'](_0x51cbd4);this[_0x758a('0x42')](_0x51cbd4['text'],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0xf9'),_0x51cbd4['text']));var _0x5b3db2=this['sestekNDA'][_0x758a('0x6b')](this,_0x51cbd4);if(_0x5b3db2){for(var _0x4c30e1 in _0x5b3db2){if(_0x5b3db2[_0x758a('0x9b')](_0x4c30e1)){this['channel'][_0x758a('0xa0')](util[_0x758a('0x2c')]('SESTEK_NDA_%s',_0x4c30e1[_0x758a('0x64')]()),_0x5b3db2[_0x4c30e1]);}}this[_0x758a('0x42')](_0x5b3db2[_0x758a('0xe6')],_0x758a('0xe7'),'sesteknda','');if(_0x5b3db2['audiofile']){this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xfa'),_0x5b3db2['audiofile']));var _0x905fa9=this[_0x758a('0xf')]['streamFile'](_0x5b3db2[_0x758a('0xfb')]);try{fs[_0x758a('0xfc')](_0x5b3db2[_0x758a('0xfb')]+_0x758a('0xfd'));}catch(_0x121128){logger['error'](_0x121128);}return _0x905fa9;}else{return this['channel']['noop'](util['format'](_0x758a('0xfe'),_0x5b3db2[_0x758a('0xe6')]));}}return this[_0x758a('0xf')][_0x758a('0x30')](_0x51cbd4,_0x758a('0xff'));};AGIVertices[_0x758a('0x12')][_0x758a('0x100')]=function(_0x411db7){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x101'),_0x411db7['label']));return this[_0x758a('0xf')]['noop'](_0x758a('0x100'));};AGIVertices[_0x758a('0x12')][_0x758a('0x102')]=function(_0x41495f){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x103'),_0x41495f['label']));var _0x8eb625='';if(_0x41495f[_0x758a('0x104')]){if(!this[_0x758a('0x84')](_0x41495f[_0x758a('0x104')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x41495f,_0x758a('0x105'));}else{var _0xc6940b=parseInt(_0x41495f[_0x758a('0x104')],0xa);if(isNaN(_0xc6940b)){_0x8eb625=_0x41495f[_0x758a('0x104')];}else{_0x8eb625=this[_0x758a('0x21')][_0x758a('0x6b')](this,_0x41495f[_0x758a('0x104')]);if(!_0x8eb625){return this[_0x758a('0xf')][_0x758a('0x30')](_0x41495f,_0x758a('0x106'));}}}}else if(_0x41495f[_0x758a('0x107')]){_0x8eb625=_0x41495f[_0x758a('0x107')];}else{return this['channel'][_0x758a('0x30')](_0x41495f,_0x758a('0x105'));}var _0x39a8dd=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xde'),[util[_0x758a('0x2c')](_0x758a('0x108'),_0x8eb625,_0x41495f[_0x758a('0x109')]),_0x41495f['timeout'],_0x41495f[_0x758a('0xe0')],_0x41495f[_0x758a('0x5e')]]);if(_0x39a8dd[_0x758a('0xa4')]===-0x1){return _0x39a8dd;}return this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0x10a'),_0x758a('0xde')));};AGIVertices[_0x758a('0x12')][_0x758a('0x10b')]=function(_0x43945e){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x10c'),_0x43945e[_0x758a('0x39')]));return this['channel'][_0x758a('0xad')](_0x758a('0x10b'));};AGIVertices[_0x758a('0x12')][_0x758a('0xd')]=function(_0xde5f76){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x10d'),_0xde5f76[_0x758a('0x39')]));if(_0xde5f76['retry']===0x0){return this['maxRetry'](_0xde5f76);}_0xde5f76[_0x758a('0xa8')]-=0x1;if(!this[_0x758a('0x84')](_0xde5f76[_0x758a('0x10e')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0xde5f76,_0x758a('0x10f'));}var _0x2fdad7=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0xde5f76['file_id']);if(!_0x2fdad7){return this[_0x758a('0xf')][_0x758a('0x30')](_0xde5f76,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0xde5f76['variable_id'])){return this[_0x758a('0xf')][_0x758a('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x203fbb=this[_0x758a('0xf')]['getData'](_0x2fdad7,_0xde5f76['response'],_0xde5f76[_0x758a('0x111')]);var _0x4158b4=_0x203fbb['result']?_0x203fbb['result'][_0x758a('0x4a')]():'';logger[_0x758a('0x32')](_0x758a('0x112'),JSON[_0x758a('0x6f')](_0x203fbb));if(_0x203fbb[_0x758a('0xa4')]===-0x1){this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0x4158b4);return _0x203fbb;}else if(_0x203fbb[_0x758a('0xa6')]==='timeout'){_0x203fbb['result']=_0x4158b4[_0x758a('0x9e')]>=parseInt(_0xde5f76[_0x758a('0x113')])?'x':'i';}else{_0x203fbb[_0x758a('0xa4')]=_0x4158b4[_0x758a('0x9e')]>=parseInt(_0xde5f76[_0x758a('0x113')])&&_0x4158b4[_0x758a('0x9e')]<=parseInt(_0xde5f76['maxdigit'])?'x':'i';}var _0x33b97c=this['getVariable'][_0x758a('0x6b')](this,_0xde5f76[_0x758a('0xd6')]);if(!_0x33b97c){return this['channel'][_0x758a('0x30')](_0xde5f76,_0x758a('0x114'));}this[_0x758a('0xf')]['setVariable'](_0x33b97c,_0x4158b4);if(this[_0x758a('0x84')](_0xde5f76['hiddendigitsnum'])){var _0x3a6550=parseInt(_0xde5f76[_0x758a('0x115')],0xa);var _0x379f91=rs[_0x758a('0x116')]({'charset':'*','length':_0x3a6550});var _0xc28470=_0x4158b4[_0x758a('0x9e')];if(_0xc28470>0x0){if(_0xc28470>_0x3a6550){this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0xde5f76['hiddendigitspos']===_0x758a('0x117')?_0x379f91+_0x4158b4[_0x758a('0x118')](_0x3a6550):_0x4158b4[_0x758a('0x118')](0x0,_0xc28470-_0x3a6550)+_0x379f91);}else{this[_0x758a('0x38')]['sync'](this,_0xde5f76,rs[_0x758a('0x116')]({'charset':'*','length':_0xc28470}));}}else{this['createSquareDetailsReport'][_0x758a('0x6b')](this,_0xde5f76,'');}}else{this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0x4158b4);}return _0x203fbb;};AGIVertices[_0x758a('0x12')][_0x758a('0xe')]=function(_0x20bd16){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x119'),_0x20bd16[_0x758a('0x39')]));return this[_0x758a('0xd')](_0x20bd16);};AGIVertices[_0x758a('0x12')][_0x758a('0x11a')]=function(_0x43e7b2){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x11b'),_0x43e7b2[_0x758a('0x39')]));this[_0x758a('0x38')]['sync'](this,_0x43e7b2,_0x43e7b2['goalname']);return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x11c'),_0x43e7b2[_0x758a('0x11d')]));};AGIVertices[_0x758a('0x12')]['awspolly']=function(_0x50cae8){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x50cae8[_0x758a('0x39')]));if(!this['isConfigured'](_0x50cae8[_0x758a('0x87')])||!this[_0x758a('0x84')](_0x50cae8[_0x758a('0x88')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x11e'));}if(!this['isConfigured'](_0x50cae8[_0x758a('0x58')])){return this['channel'][_0x758a('0xad')](_0x758a('0xa9'));}this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x11f'),_0x50cae8[_0x758a('0x58')]));var _0x4d9275=this[_0x758a('0x86')][_0x758a('0x6b')](this,_0x50cae8);if(_0x4d9275){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x4d9275));var _0x20f8a7=this[_0x758a('0xf')]['streamFile'](_0x4d9275);try{fs[_0x758a('0xfc')](_0x4d9275+_0x758a('0xfd'));}catch(_0x1e6716){logger[_0x758a('0x30')](_0x1e6716);}return _0x20f8a7;}return this[_0x758a('0xf')][_0x758a('0x30')](_0x50cae8,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x758a('0x12')][_0x758a('0x120')]=function(_0x4b87d3){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4b87d3[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4b87d3['aws_access_key_id'])||!this['isConfigured'](_0x4b87d3[_0x758a('0x88')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x11e'));}if(!this[_0x758a('0x84')](_0x4b87d3[_0x758a('0x8f')])){return this['channel'][_0x758a('0xad')](_0x758a('0x121'));}if(!this[_0x758a('0x84')](_0x4b87d3[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this['channel']['bot']=!![];this[_0x758a('0x38')](_0x4b87d3);this[_0x758a('0x42')](_0x4b87d3[_0x758a('0x58')],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x122'),_0x4b87d3['text']));var _0x1c0f0a=this[_0x758a('0x8d')][_0x758a('0x6b')](this,_0x4b87d3);if(_0x1c0f0a){for(var _0x3eb781 in _0x1c0f0a){if(_0x1c0f0a[_0x758a('0x9b')](_0x3eb781)&&_['isString'](_0x1c0f0a[_0x3eb781])){this['channel']['setVariable'](util['format'](_0x758a('0x123'),_0x3eb781[_0x758a('0x64')]()),_0x1c0f0a[_0x3eb781]);}}if(_[_0x758a('0x45')](_0x1c0f0a[_0x758a('0x124')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x125'));}else{this[_0x758a('0x42')](_0x1c0f0a[_0x758a('0x124')],_0x758a('0xe7'),_0x758a('0x126'),'');return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Amazon\x20Lex\x20Result\x20%s',_0x1c0f0a['message']));}}return this[_0x758a('0xf')]['error'](_0x4b87d3,_0x758a('0x127'));};AGIVertices['prototype'][_0x758a('0x128')]=function(_0x4ac9e5){logger[_0x758a('0x32')](util['format'](_0x758a('0x129'),_0x4ac9e5['label'],_0x4ac9e5[_0x758a('0x60')]));if(!this['isConfigured'](_0x4ac9e5[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}var _0x1e1913=_0x758a('0x12a');var _0x55f402=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x758a('0x116')](0x4));var _0x264b42=util[_0x758a('0x2c')](_0x758a('0x9c'),_0x55f402,_0x1e1913);var _0x526d4a=!![];if(_0x4ac9e5['beep']===_0x758a('0x12b')){_0x526d4a=![];}var _0x1efd7c=this[_0x758a('0xf')][_0x758a('0x12c')](_0x55f402,_0x1e1913,_0x4ac9e5['intKey'],_0x4ac9e5[_0x758a('0x60')],undefined,_0x526d4a);if(_0x1efd7c[_0x758a('0xa4')]!==-0x1){this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x12d'),_0x264b42));var _0x37ccc1=this[_0x758a('0x90')][_0x758a('0x6b')](this,_0x4ac9e5,_0x264b42);if(_0x37ccc1){for(var _0x54b5ad in _0x37ccc1){if(_0x37ccc1[_0x758a('0x9b')](_0x54b5ad)){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x12e'),_0x54b5ad['toUpperCase']()),_0x37ccc1[_0x54b5ad]);}}return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x12f'),JSON[_0x758a('0x6f')](_0x37ccc1)));}}return _0x1efd7c;};AGIVertices[_0x758a('0x12')]['tildeasr']=function(_0x5f2a1e){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x130'),_0x5f2a1e['label']));if(!this[_0x758a('0x84')](_0x5f2a1e['appid'])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20appid\x20configured');}if(!this[_0x758a('0x84')](_0x5f2a1e['appsecret'])){return this[_0x758a('0xf')]['noop']('no\x20appsecret\x20configured');}var _0x1d376d=_0x758a('0x12a');var _0x3b1df5=util[_0x758a('0x2c')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2c8db1=util['format']('%s.%s',_0x3b1df5,_0x1d376d);var _0x900c45=!![];if(_0x5f2a1e['beep']==='NOBEEP'){_0x900c45=![];}var _0x3195e9=this['channel'][_0x758a('0x12c')](_0x3b1df5,_0x1d376d,_0x5f2a1e[_0x758a('0x131')],_0x5f2a1e[_0x758a('0x60')],undefined,_0x900c45);if(_0x3195e9['result']!==-0x1){this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x132'),_0x2c8db1));var _0x395b39=this[_0x758a('0x92')][_0x758a('0x6b')](this,_0x5f2a1e,_0x2c8db1);if(_0x395b39){for(var _0x58ce20 in _0x395b39){if(_0x395b39[_0x758a('0x9b')](_0x58ce20)){this[_0x758a('0xf')]['setVariable'](util[_0x758a('0x2c')](_0x758a('0x133'),_0x58ce20[_0x758a('0x64')]()),_0x395b39[_0x58ce20]);}}return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x134'),JSON[_0x758a('0x6f')](_0x395b39)));}}return _0x3195e9;};AGIVertices[_0x758a('0x12')]['gotoc']=function(_0xf1e6dd){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x135'),_0xf1e6dd[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x136')](_0xf1e6dd['context'],_0xf1e6dd[_0x758a('0x137')],_0xf1e6dd[_0x758a('0x3f')]);};AGIVertices[_0x758a('0x12')]['gotoif']=function(_0xb92cd4){logger['info'](util[_0x758a('0x2c')](_0x758a('0x138'),_0xb92cd4['label']));if(!this[_0x758a('0x84')](_0xb92cd4[_0x758a('0x139')])){return this['channel'][_0x758a('0x30')](_0xb92cd4,'no\x20condition\x20configured');}try{var _0x2267d3=eval(_0xb92cd4[_0x758a('0x139')])?_0x758a('0x13a'):_0x758a('0x13b');this[_0x758a('0xf')][_0x758a('0xad')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0xb92cd4['condition'],_0x2267d3));return{'code':0xc8,'result':_0x2267d3};}catch(_0x2104c8){return{'code':0xc8,'result':_0x758a('0x13b')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x13c')]=function(_0x557026){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x557026['label']));if(!this[_0x758a('0x84')](_0x557026['interval_id'])){return this['channel'][_0x758a('0x30')](_0x557026,_0x758a('0x13d'));}var _0x198dc7=this['getIntervals']['sync'](this,_0x557026[_0x758a('0x13e')]);if(!_0x198dc7){return this[_0x758a('0xf')]['error'](_0x557026,'no\x20intervals\x20found');}for(var _0x10b09a=0x0;_0x10b09a<_0x198dc7[_0x758a('0x9e')];_0x10b09a+=0x1){var _0x46737c=this[_0x758a('0xf')][_0x758a('0x13')](util[_0x758a('0x2c')](_0x758a('0x13f'),_0x198dc7[_0x10b09a]));if(_0x46737c['result']===-0x1){return _0x46737c;}logger[_0x758a('0x32')](util['format'](_0x758a('0x140'),_0x198dc7[_0x10b09a],_0x46737c[_0x758a('0xa6')]));if(_0x46737c[_0x758a('0xa6')]===_0x758a('0x13a')){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],_0x758a('0x13a')));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],'true'));return{'code':0xc8,'result':_0x758a('0x13a')};}else{logger['info'](util['format'](_0x758a('0x140'),_0x198dc7[_0x10b09a],'false'));this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype']['hangup']=function(_0x517aa1){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x141'),_0x517aa1[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x142')]();};AGIVertices[_0x758a('0x12')]['ispeechasr']=function(_0x115920){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x143'),_0x115920['label']));if(!this[_0x758a('0x84')](_0x115920[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20key\x20configured');}var _0x424c72=_0x758a('0x12a');var _0x21dfd7=util[_0x758a('0x2c')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x19d47f=util[_0x758a('0x2c')](_0x758a('0x9c'),_0x21dfd7,_0x424c72);var _0xee8f98=!![];if(_0x115920[_0x758a('0x144')]===_0x758a('0x12b')){_0xee8f98=![];}var _0x417a55=this[_0x758a('0xf')]['recordFile'](_0x21dfd7,_0x424c72,_0x115920[_0x758a('0x131')],_0x115920[_0x758a('0x60')],undefined,_0xee8f98);if(_0x417a55[_0x758a('0xa4')]!==-0x1){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x145'),_0x19d47f));var _0x344bef=this['ispeechASR'][_0x758a('0x6b')](this,_0x115920,_0x19d47f);if(_0x344bef){for(var _0xab254c in _0x344bef){if(_0x344bef['hasOwnProperty'](_0xab254c)){this[_0x758a('0xf')][_0x758a('0xa0')](util['format'](_0x758a('0x146'),_0xab254c[_0x758a('0x64')]()),_0x344bef[_0xab254c]);}}return this[_0x758a('0xf')]['noop'](util['format'](_0x758a('0x147'),JSON['stringify'](_0x344bef)));}}return _0x417a55;};AGIVertices[_0x758a('0x12')]['ispeechtts']=function(_0x476436){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x476436[_0x758a('0x39')]));if(!this['isConfigured'](_0x476436['key'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}if(!this['isConfigured'](_0x476436[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20text\x20configured');}this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x148'),_0x476436[_0x758a('0x58')]));var _0x15efe4=this[_0x758a('0x7e')][_0x758a('0x6b')](this,_0x476436);if(_0x15efe4){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x145'),_0x15efe4));var _0x2ad81a=this[_0x758a('0xf')][_0x758a('0x149')](_0x15efe4,_0x476436[_0x758a('0x131')]);try{fs[_0x758a('0xfc')](_0x15efe4+_0x758a('0xfd'));}catch(_0x1220e3){logger[_0x758a('0x30')](_0x1220e3);}return _0x2ad81a;}return this['channel']['error'](_0x476436,_0x758a('0x14a'));};AGIVertices[_0x758a('0x12')]['login']=function(_0x1d212c){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14b'),_0x1d212c[_0x758a('0x39')]));if(!this['isConfigured'](_0x1d212c[_0x758a('0x14c')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x1d212c,'no\x20find\x20by\x20configured');}logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x1d212c[_0x758a('0x14c')]));var _0x351ed0=this[_0x758a('0x51')][_0x758a('0x6b')](this,_0x1d212c[_0x758a('0x14c')]);if(_0x351ed0){logger[_0x758a('0x32')](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')]['callerid'],_0x1d212c[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14e'),this['channel']['callerid'],_0x1d212c[_0x758a('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x1d212c[_0x758a('0x14c')]));this['channel'][_0x758a('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x1d212c[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x151')]=function(_0x576749){logger['info'](util[_0x758a('0x2c')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x576749['label']));if(!this[_0x758a('0x84')](_0x576749[_0x758a('0x14c')])){return this[_0x758a('0xf')]['error'](_0x576749,_0x758a('0x152'));}logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x576749[_0x758a('0x14c')]));var _0x2777aa=this[_0x758a('0x50')][_0x758a('0x6b')](this,_0x576749['findBy']);if(_0x2777aa){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x758a('0xf')]['callerid'],_0x576749[_0x758a('0x14c')]));this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));this[_0x758a('0xf')]['noop'](util['format'](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x758a('0x12')]['math']=function(_0x316c76){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x153'),_0x316c76[_0x758a('0x39')]));if(!this['isConfigured'](_0x316c76['operation'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x316c76,_0x758a('0x154'));}this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x155'),_0x316c76[_0x758a('0x156')]));var _0x1d4b7e=eval(_0x316c76[_0x758a('0x156')]);if(!this[_0x758a('0x84')](_0x316c76[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4497d7=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x316c76[_0x758a('0xd6')]);if(!_0x4497d7){return this[_0x758a('0xf')][_0x758a('0x30')](_0x316c76,'no\x20variable\x20found');}if(_[_0x758a('0x9d')](_0x1d4b7e)){var _0x5ec9bd=this;_0x1d4b7e['forEach'](function(_0x2e61d1,_0x485cf9){_0x5ec9bd[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x157'),_0x4497d7,_0x485cf9),_0x2e61d1);});return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x158'),_0x4497d7));}else{return this[_0x758a('0xf')][_0x758a('0xa0')](_0x4497d7,_0x1d4b7e);}};AGIVertices[_0x758a('0x12')]['menu']=function(_0x2196b7){logger['info'](util[_0x758a('0x2c')](_0x758a('0x159'),_0x2196b7[_0x758a('0x39')]));if(_0x2196b7['retry']===0x0){return this[_0x758a('0xa7')](_0x2196b7);}_0x2196b7[_0x758a('0xa8')]-=0x1;if(!this[_0x758a('0x84')](_0x2196b7[_0x758a('0x10e')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,_0x758a('0x10f'));}var _0x2f80c5=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0x2196b7['file_id']);if(!_0x2f80c5){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,'no\x20file\x20audio\x20found');}var _0x3701e2=this[_0x758a('0xf')][_0x758a('0x15a')](_0x2f80c5,_0x2196b7[_0x758a('0x15b')],_0x2196b7['digit']);var _0x3062c4=_0x3701e2[_0x758a('0xa4')];if(_0x3701e2[_0x758a('0xa4')]===-0x1){this[_0x758a('0x38')]['sync'](this,_0x2196b7,'-1');return _0x3701e2;}else if(_0x3701e2['extra']==='timeout'){_0x3701e2['result']=_0x3701e2[_0x758a('0xa4')][_0x758a('0x9e')]>0x0?_0x3701e2[_0x758a('0xa4')]:'t';}else if(_[_0x758a('0x44')](_0x3701e2[_0x758a('0xa4')])){_0x3701e2[_0x758a('0xa4')]='#';_0x3062c4='#';}if(!this['isConfigured'](_0x2196b7['variable_id'])){this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x15c'));}else{var _0x489e62=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x2196b7[_0x758a('0xd6')]);if(!_0x489e62){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,_0x758a('0x114'));}this[_0x758a('0xf')]['setVariable'](_0x489e62,_0x3062c4);}this[_0x758a('0x38')]['sync'](this,_0x2196b7,_0x3062c4);return _0x3701e2;};AGIVertices[_0x758a('0x12')][_0x758a('0xad')]=function(_0x674de5){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x674de5[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0xad')](_0x674de5[_0x758a('0x15d')]||_0x674de5['label']);};AGIVertices[_0x758a('0x12')][_0x758a('0x15e')]=function(_0x37fa49){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x15f'),_0x37fa49['label']));if(!this['isConfigured'](_0x37fa49[_0x758a('0x14c')])){return this['channel'][_0x758a('0x30')](_0x37fa49,_0x758a('0x152'));}logger['info'](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x37fa49[_0x758a('0x14c')]));var _0x1c7704=this[_0x758a('0x160')]['sync'](this,_0x37fa49[_0x758a('0x161')]);var _0xb35ff2=this[_0x758a('0x4d')][_0x758a('0x6b')](this,_0x37fa49[_0x758a('0x14c')],_0x1c7704);if(_0xb35ff2){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')]['callerid'],_0x37fa49[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x162')};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this['channel'][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));this['channel']['noop'](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')]['playback']=function(_0x5c3d90){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x163'),_0x5c3d90['label']));if(!this['isConfigured'](_0x5c3d90['file_id'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x5c3d90,_0x758a('0x10f'));}var _0x433d4b=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0x5c3d90['file_id']);if(!_0x433d4b){return this[_0x758a('0xf')][_0x758a('0x30')](_0x5c3d90,_0x758a('0x164'));}var _0xc5d6cf=this['channel'][_0x758a('0x53')]('PLAYBACK',[_0x433d4b,_0x5c3d90['opts']]);if(_0xc5d6cf['result']===-0x1){return _0xc5d6cf;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x165'),_0x433d4b));};AGIVertices[_0x758a('0x12')][_0x758a('0x166')]=function(_0x4949d8){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x167'),_0x4949d8['label']));if(!this[_0x758a('0x84')](_0x4949d8[_0x758a('0x168')])){return this[_0x758a('0xf')]['error'](_0x4949d8,_0x758a('0x169'));}var _0x403537='';var _0x3029cc=parseInt(_0x4949d8[_0x758a('0x168')],0xa);if(isNaN(_0x3029cc)){_0x403537=_0x4949d8[_0x758a('0x168')];}else{_0x403537=this[_0x758a('0x17')][_0x758a('0x6b')](this,_0x4949d8[_0x758a('0x168')]);if(!_0x403537){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4949d8,'no\x20queue\x20found');}}var _0x46d300='';if(this[_0x758a('0x84')](_0x4949d8['file_id'])){var _0x202417=this['getSound'][_0x758a('0x6b')](this,_0x4949d8[_0x758a('0x10e')]);if(_0x202417){_0x46d300=_0x202417;}}this[_0x758a('0x38')][_0x758a('0x6b')](this,_0x4949d8,_0x403537);if(_0x4949d8[_0x758a('0xe0')][_0x758a('0x16a')]('x')<0x0){_0x4949d8['opts']+='x';}if(_0x4949d8[_0x758a('0xe0')][_0x758a('0x16a')]('X')<0x0){_0x4949d8[_0x758a('0xe0')]+='X';}this[_0x758a('0xf')]['setVariable'](_0x758a('0x16b'),_0x403537?_0x403537[_0x758a('0x16c')]():'');var _0x27a794=this[_0x758a('0xf')]['exec'](_0x758a('0x16d'),[_0x403537,_0x4949d8[_0x758a('0xe0')],_0x4949d8[_0x758a('0x5e')],_0x46d300,_0x4949d8['timeout'],_0x4949d8[_0x758a('0x8')],_0x4949d8[_0x758a('0x16e')],_0x4949d8[_0x758a('0x16f')],'',_0x4949d8['position']]);if(_0x27a794['result']===-0x1){return _0x27a794;}return this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x16d'),_0x403537));};AGIVertices[_0x758a('0x12')][_0x758a('0x170')]=function(_0xe22f94){logger[_0x758a('0x32')](util['format'](_0x758a('0x171'),_0xe22f94[_0x758a('0x39')]));var _0x13528e=_0xe22f94[_0x758a('0x172')]||_0x758a('0x12a');var _0x856c85=util[_0x758a('0x2c')]('%s_%s',this[_0x758a('0xf')][_0x758a('0x3c')],rs['generate'](0x5));var _0x238779=util[_0x758a('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x856c85,_0x13528e);var _0x5cb2d4=util[_0x758a('0x2c')](_0x758a('0x173'),FILES_PATH,_0x856c85);this[_0x758a('0x3b')][_0x758a('0x6b')](this,_0xe22f94,_0x856c85,_0x238779);this[_0x758a('0xf')][_0x758a('0xa0')](_0x758a('0x174'),_0x856c85);logger[_0x758a('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5cb2d4,_0x13528e,_0xe22f94[_0x758a('0x175')],_0xe22f94[_0x758a('0x60')]);return this[_0x758a('0xf')][_0x758a('0x12c')](_0x5cb2d4,_0x13528e,_0xe22f94['escape_digits'],_0xe22f94[_0x758a('0x60')],undefined,!![]);};AGIVertices[_0x758a('0x12')][_0x758a('0x176')]=function(_0xb22dcc){logger[_0x758a('0x32')](util['format'](_0x758a('0x177'),_0xb22dcc['label']));if(!this[_0x758a('0x84')](_0xb22dcc['url'])){return this[_0x758a('0xf')]['noop']('no\x20url\x20configured');}var _0x36ccca=this['restAPI'][_0x758a('0x6b')](this,_0xb22dcc);logger[_0x758a('0x32')](util['format'](_0x758a('0x178'),util[_0x758a('0x179')](_0x36ccca,{'showHidden':![],'depth':null})));if(!this[_0x758a('0x84')](_0xb22dcc[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x17a'));}var _0x1bb809=this['getVariable'][_0x758a('0x6b')](this,_0xb22dcc[_0x758a('0xd6')]);if(!_0x1bb809){return this['channel'][_0x758a('0x30')](_0xb22dcc,_0x758a('0x114'));}this['channel'][_0x758a('0xa0')](util['format'](_0x758a('0x17b'),_0x1bb809),_0x36ccca[_0x758a('0x72')]?_0x36ccca[_0x758a('0x72')]:_0x758a('0x17c'));this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x17d'),_0x1bb809),_0x36ccca['statusMessage']?_0x36ccca[_0x758a('0x71')]:'OK');if(_0x36ccca[_0x758a('0x65')]){try{this[_0x758a('0x9f')](_0x36ccca[_0x758a('0x65')],_0x1bb809);}catch(_0x569299){logger[_0x758a('0x30')](util[_0x758a('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1bb809));}}return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd9'),_0x1bb809));};AGIVertices[_0x758a('0x12')][_0x758a('0x17e')]=function(_0x1b32f3){logger['info'](util[_0x758a('0x2c')](_0x758a('0x17f'),_0x1b32f3[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x180')](_0x1b32f3[_0x758a('0x181')][_0x758a('0x182')](/\s+/g,''),_0x1b32f3[_0x758a('0x175')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x183')]=function(_0x10e409){logger[_0x758a('0x32')](util['format'](_0x758a('0x184'),_0x10e409[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x185')](_0x10e409[_0x758a('0x186')][_0x758a('0x182')](/\s+/g,''),_0x10e409[_0x758a('0x175')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x187')]=function(_0x1c7e59){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x188'),_0x1c7e59[_0x758a('0x39')]));return this[_0x758a('0xf')]['sayPhonetic'](_0x1c7e59[_0x758a('0x58')],_0x1c7e59['escape_digits']);};AGIVertices[_0x758a('0x12')][_0x758a('0x189')]=function(_0xfce017){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xfce017['label']));if(!this[_0x758a('0x84')](_0xfce017[_0x758a('0x18a')])){return this[_0x758a('0xf')]['noop'](_0x758a('0x18b'));}var _0x439774=this[_0x758a('0x18c')][_0x758a('0x6b')](this,_0xfce017[_0x758a('0x18a')]);if(!_0x439774||!_0x439774['Smtp']){return this['channel'][_0x758a('0x30')](_0xfce017,_0x758a('0x18d'));}var _0x383318={'from':util['format']('\x22%s\x22\x20<%s>',_0x439774['name'],_0x439774[_0x758a('0x18e')]||_0x439774[_0x758a('0x18f')][_0x758a('0x190')]),'to':_0xfce017['to']||'','cc':_0xfce017['cc']||'','bcc':_0xfce017['bcc']||'','subject':_0xfce017['subject'],'html':_0xfce017['text'],'text':_0xfce017['text']};if(this[_0x758a('0x84')](_0xfce017[_0x758a('0x191')])){}logger[_0x758a('0xdb')]('sendMail\x20message',JSON[_0x758a('0x6f')](_0x383318));this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xfce017,_0xfce017['account_id']);this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x439774['name']));this[_0x758a('0x26')][_0x758a('0x6b')](this,_0x439774[_0x758a('0x192')],_0x383318);return this[_0x758a('0xf')][_0x758a('0xad')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x758a('0x12')][_0x758a('0x193')]=function(_0x38b261){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x194'),_0x38b261[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x195'));};AGIVertices[_0x758a('0x12')]['sendSMS']=function(_0xdd7c67){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xdd7c67[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0xdd7c67['sms_account_id'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x196'));}var _0x53ab5a=this['getSmsAccount'][_0x758a('0x6b')](this,_0xdd7c67[_0x758a('0x197')]);if(!_0x53ab5a){return this[_0x758a('0xf')]['error'](_0xdd7c67,_0x758a('0x198'));}var _0x928496={'body':_0xdd7c67[_0x758a('0x199')],'phone':_0xdd7c67['to']||'','SmsAccountId':_0x53ab5a['id']};logger['debug'](_0x758a('0x19a'),JSON[_0x758a('0x6f')](_0x928496));this['createSquareDetailsReport'][_0x758a('0x6b')](this,_0xdd7c67,_0xdd7c67[_0x758a('0x197')]);this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x19b'),_0x53ab5a['name']));this[_0x758a('0x37')]['sync'](this,_0x928496);return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x19c'));};AGIVertices[_0x758a('0x12')][_0x758a('0x19d')]=function(_0xaefc43){logger[_0x758a('0x32')](util['format'](_0x758a('0x19e'),_0xaefc43[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0xaefc43[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0xaefc43,'no\x20variable\x20selected');}var _0xfa5a5e=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0xaefc43['variable_id']);if(!_0xfa5a5e){return this[_0x758a('0xf')]['error'](_0xaefc43,_0x758a('0x114'));}return this[_0x758a('0xf')][_0x758a('0xa0')](_0xfa5a5e,_0xaefc43[_0x758a('0x19f')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x1a0')]=function(_0x13e106){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x13e106['label']));this[_0x758a('0xf')][_0x758a('0xad')]('START\x20CALLY\x20SQUARE');if(_0x13e106[_0x758a('0xb6')]===_0x758a('0x1a1')){this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x1a2'));return this[_0x758a('0xf')]['answer']();}return this[_0x758a('0xf')]['noop'](_0x758a('0x1a3'));};AGIVertices[_0x758a('0x12')][_0x758a('0x1a4')]=function(_0x302c63){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1a5'),_0x302c63[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x302c63[_0x758a('0x1a6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x302c63,_0x758a('0x1a7'));}var _0x14338e=this[_0x758a('0x19')][_0x758a('0x6b')](this,_0x302c63['project_id']);if(!this[_0x758a('0x84')](_0x14338e)){return this[_0x758a('0xf')][_0x758a('0x30')](_0x302c63,util[_0x758a('0x2c')](_0x758a('0x1a8'),_0x302c63[_0x758a('0x1a6')]));}if(_0x14338e===this[_0x758a('0xf')][_0x758a('0x3a')]){return this[_0x758a('0xf')]['error'](_0x302c63,_0x758a('0x1a9'));}this[_0x758a('0x38')]['sync'](this,_0x302c63,_0x14338e);var _0x129c96=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0x1aa'),util['format'](_0x758a('0x1ab'),config['agi'][_0x758a('0x1ac')]||_0x758a('0x1ad'),_0x14338e,this['channel'][_0x758a('0x3a')]));if(_0x129c96[_0x758a('0xa4')]===-0x1){return _0x129c96;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Executed\x20command\x20%s\x20%s','AGI',_0x14338e));};AGIVertices['prototype'][_0x758a('0x1ae')]=function(_0x1a29b9){logger['info'](util[_0x758a('0x2c')](_0x758a('0x1af'),_0x1a29b9[_0x758a('0x39')]));var _0x569e14=this[_0x758a('0x52')][_0x758a('0x6b')](this,_0x1a29b9['command']);this[_0x758a('0x38')]['sync'](this,_0x1a29b9,_0x1a29b9[_0x758a('0xb5')]);if(this[_0x758a('0x84')](_0x1a29b9[_0x758a('0xd6')])){var _0xce98b1=this['getVariable'][_0x758a('0x6b')](this,_0x1a29b9[_0x758a('0xd6')]);if(_0xce98b1){this[_0x758a('0xf')][_0x758a('0xa0')](_0xce98b1,_0x569e14);return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x1b0'),_0x1a29b9['command'],_0xce98b1));}}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b1'),_0x1a29b9[_0x758a('0xb5')]));};AGIVertices['prototype'][_0x758a('0x1b2')]=function(_0x129de2){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x129de2['label']));_0x129de2[_0x758a('0x58')]=_0x129de2[_0x758a('0x58')][_0x758a('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x758a('0x84')](_0x129de2[_0x758a('0x56')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x1b3'));}if(!this[_0x758a('0x84')](_0x129de2[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xad')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x129de2['text']));var _0x1e4333=this[_0x758a('0x55')][_0x758a('0x6b')](this,_0x129de2);if(_0x1e4333){this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b4'),_0x1e4333));var _0x1b9999=this[_0x758a('0xf')]['streamFile'](_0x1e4333);try{fs[_0x758a('0xfc')](_0x1e4333+_0x758a('0xfd'));}catch(_0x29ff70){logger[_0x758a('0x30')](_0x29ff70);}return _0x1b9999;}return this[_0x758a('0xf')]['error'](_0x129de2,_0x758a('0x1b5'));};AGIVertices[_0x758a('0x12')]['tts']=function(_0x39aaa4){logger[_0x758a('0x32')](util['format'](_0x758a('0x1b6'),_0x39aaa4['label']));_0x39aaa4[_0x758a('0x58')]=_0x39aaa4[_0x758a('0x58')][_0x758a('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x758a('0x84')](_0x39aaa4[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b7'),_0x39aaa4[_0x758a('0x58')]));var _0x5f1608=this[_0x758a('0x5b')][_0x758a('0x6b')](this,_0x39aaa4);if(_0x5f1608){this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x1b8'),_0x5f1608));var _0x32fbed=this['channel']['streamFile'](_0x5f1608);try{fs[_0x758a('0xfc')](_0x5f1608+_0x758a('0xfd'));}catch(_0x451025){logger[_0x758a('0x30')](_0x451025);}return _0x32fbed;}return this['channel'][_0x758a('0x30')](_0x39aaa4,_0x758a('0x1b9'));};AGIVertices[_0x758a('0x12')][_0x758a('0x1ba')]=function(_0x57ea5f){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x57ea5f[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x57ea5f[_0x758a('0x14c')])){return this[_0x758a('0xf')]['error'](_0x57ea5f,_0x758a('0x152'));}logger[_0x758a('0x32')](util[_0x758a('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x758a('0xf')]['callerid'],_0x57ea5f[_0x758a('0x14c')]));var _0x12bdf8=this['agentUnpause'][_0x758a('0x6b')](this,_0x57ea5f['findBy']);if(_0x12bdf8){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x162')};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f['findBy']));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x1bb')]=function(_0x1c77c7){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1bc'),_0x1c77c7['label']));var _0x268049=this[_0x758a('0xf')][_0x758a('0x53')]('VOICEMAIL',[_0x1c77c7['mailbox'],_0x1c77c7['options']]);if(_0x268049['result']===-0x1){return _0x268049;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x1bd'),_0x1c77c7[_0x758a('0x1be')]));};AGIVertices[_0x758a('0x12')][_0x758a('0x1bf')]=function(_0x3d797c){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1c0'),_0x3d797c[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x3d797c[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x3d797c,_0x758a('0x1c1'));}var _0x223950=this[_0x758a('0x13')]['sync'](this,_0x3d797c[_0x758a('0xd6')]);if(!_0x223950){return this[_0x758a('0xf')][_0x758a('0x30')](_0x3d797c,'no\x20variable\x20found');}var _0x3fc352=this[_0x758a('0xf')][_0x758a('0x13')](_0x223950);return{'code':0xc8,'result':_0x3fc352['extra']?_0x3fc352[_0x758a('0xa6')]:'-'};};String[_0x758a('0x12')][_0x758a('0xa2')]=function(_0x4c50b6,_0x12b327){return this[_0x758a('0xa1')](_0x4c50b6)[_0x758a('0x1c2')](_0x12b327);};module[_0x758a('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 28d51c3..4692b9e 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 _0xa83b=['syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','error','[%s][UPDATE][ERRORS:%s]','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','[ACW][syncHangupRequest]\x20%s','[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','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa83b,0x188));var _0xba83=function(_0x4118ac,_0x1cebaf){_0x4118ac=_0x4118ac-0x0;var _0x1b62e7=_0xa83b[_0x4118ac];return _0x1b62e7;};'use strict';var util=require(_0xba83('0x0'));var _=require(_0xba83('0x1'));var moment=require(_0xba83('0x2'));var ami=require(_0xba83('0x3'));var logger=require(_0xba83('0x4'))(_0xba83('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4a5355){this[_0xba83('0x6')]=_0x4a5355[_0xba83('0x6')];this[_0xba83('0x7')]=_0x4a5355[_0xba83('0x7')];this[_0xba83('0x8')]=_0x4a5355[_0xba83('0x8')];this[_0xba83('0x9')]={};ami['on']('agentconnect',this[_0xba83('0xa')][_0xba83('0xb')](this));ami['on'](_0xba83('0xc'),this[_0xba83('0xd')][_0xba83('0xb')](this));ami['on'](_0xba83('0xe'),this[_0xba83('0xf')][_0xba83('0xb')](this));ami['on'](_0xba83('0x10'),this[_0xba83('0x11')][_0xba83('0xb')](this));ami['on']('attendedtransfer',this[_0xba83('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0xba83('0x13')][_0xba83('0xb')](this));ami['on'](_0xba83('0x14'),this[_0xba83('0x15')][_0xba83('0xb')](this));}function getDiff(_0x58b4f1){var _0x1659db=moment()[_0xba83('0x16')](0x0);var _0xd85914=moment(_0x58b4f1)[_0xba83('0x16')](0x0);return _0x1659db['diff'](_0xd85914,_0xba83('0x17'));}Acw[_0xba83('0x18')][_0xba83('0x19')]=function(_0x450bfb){try{var _0x14af97=this;var _0x107a9e=this[_0xba83('0x9')][_0x450bfb][_0xba83('0x1a')];var _0x397b0e=this[_0xba83('0x9')][_0x450bfb][_0xba83('0x1b')];var _0x4b53c4=this['voiceQueues'][_0x397b0e];var _0x4e6ddd=![];var _0x5905f8=_0xba83('0x1c');if(_0x4b53c4[_0xba83('0x1d')]){if(_0x4b53c4[_0xba83('0x1e')]['name']){_0x4e6ddd=!![];_0x5905f8=_0x4b53c4[_0xba83('0x1e')][_0xba83('0x1f')];}}ami[_0xba83('0x20')]({'action':'QueuePause','interface':_0x107a9e,'paused':!![],'reason':_0x5905f8})[_0xba83('0x21')](function(_0x2179c5){if(_0x14af97[_0xba83('0x7')][_0x107a9e]){return RpcUser['getAgent'](_0x14af97[_0xba83('0x7')][_0x107a9e]['id'])[_0xba83('0x21')](function(_0x4d83c0){if(_0x4d83c0&&!_0x4d83c0[_0xba83('0x22')]){logger['info'](_0xba83('0x23'),_0x450bfb,_0x107a9e,_0x397b0e);var _0x3b6fa9=_0x14af97[_0xba83('0x9')][_0x450bfb][_0xba83('0x24')]&&_0x14af97[_0xba83('0x9')][_0x450bfb][_0xba83('0x25')]?_0x14af97[_0xba83('0x9')][_0x450bfb][_0xba83('0x25')]:_0x450bfb;return RpcUser[_0xba83('0x26')](_0x14af97[_0xba83('0x7')][_0x107a9e],_0x5905f8,_0x3b6fa9)[_0xba83('0x21')](function(_0x3525a8){if(!_0x4e6ddd){_0x14af97[_0xba83('0x8')][_0x107a9e]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x450bfb,_0x14af97[_0xba83('0x6')][_0x397b0e][_0xba83('0x27')],_0x107a9e,_0x397b0e);_0x14af97[_0xba83('0x8')][_0x107a9e][_0xba83('0x28')]=setTimeout(_0x14af97['stopAcw'][_0xba83('0xb')](_0x14af97,_0x107a9e),_0x14af97[_0xba83('0x6')][_0x397b0e][_0xba83('0x27')]*0x3e8);_0x14af97[_0xba83('0x8')][_0x107a9e][_0xba83('0x29')]=moment()[_0xba83('0x2a')](_0xba83('0x2b'));_0x14af97[_0xba83('0x8')][_0x107a9e][_0xba83('0x2c')]=_0x450bfb;_0x14af97[_0xba83('0x8')][_0x107a9e][_0xba83('0x1b')]=_0x397b0e;_0x14af97['timers'][_0x107a9e][_0xba83('0x2d')]=function(){var _0x2d63f9=getDiff(_0x14af97[_0xba83('0x8')][_0x107a9e][_0xba83('0x29')]);clearTimeout(_0x14af97['timers'][_0x107a9e][_0xba83('0x28')]);_0x14af97['timers'][_0x107a9e][_0xba83('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2d63f9},_0x14af97[_0xba83('0x8')][_0x107a9e]['uniqueid'],_0x107a9e)['then'](function(_0xb90bb7){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x450bfb,_0x2d63f9,_0xb90bb7);})['catch'](function(_0x2ec036){logger[_0xba83('0x2e')](_0xba83('0x2f'),_0x450bfb,_0x2ec036);});delete _0x14af97[_0xba83('0x8')][_0x107a9e];};}});}else{logger[_0xba83('0x30')](_0xba83('0x31'),_0x450bfb,_0x107a9e,_0x397b0e);}});}})[_0xba83('0x32')](function(_0x3e1536){logger[_0xba83('0x2e')](_0xba83('0x33'),_0x450bfb,_0x14af97['voiceQueues'][_0x397b0e][_0xba83('0x27')],_0x107a9e,_0x397b0e);})[_0xba83('0x34')](function(){delete _0x14af97[_0xba83('0x9')][_0x450bfb];});}catch(_0x144348){logger[_0xba83('0x2e')]('[ACW][START]\x20%s',_0x144348[_0xba83('0x35')]);}};Acw['prototype'][_0xba83('0x36')]=function(_0x2d5221){try{var _0x58b9e4=this;if(_0x58b9e4[_0xba83('0x8')][_0x2d5221]){_0x58b9e4[_0xba83('0x8')][_0x2d5221][_0xba83('0x28')]=![];var _0x2a4fcd=_0x58b9e4[_0xba83('0x8')][_0x2d5221][_0xba83('0x2c')];var _0x5227cf=_0x58b9e4['timers'][_0x2d5221][_0xba83('0x1b')];var _0x1ca4b3=_0x58b9e4[_0xba83('0x6')][_0x5227cf][_0xba83('0x27')];logger['info'](_0xba83('0x37'),_0x2a4fcd,_0x2d5221);RpcUser[_0xba83('0x38')](this[_0xba83('0x7')][_0x2d5221]);RpcVoiceAgentReport[_0xba83('0x39')]({'acwtime':_0x1ca4b3,'agentacw':!![]},_0x2a4fcd,_0x2d5221)[_0xba83('0x21')](function(_0x132e53){logger[_0xba83('0x30')](_0xba83('0x3a'),_0x2a4fcd,_0x1ca4b3,_0x132e53);})[_0xba83('0x32')](function(_0x3de937){logger[_0xba83('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x2a4fcd,_0x3de937);});}else{logger['error'](_0xba83('0x3b'),_0x2d5221);if(_0x58b9e4[_0xba83('0x8')]){logger[_0xba83('0x30')](_0xba83('0x3c'),JSON['stringify'](_0x58b9e4[_0xba83('0x8')]));}}}catch(_0x20f661){logger[_0xba83('0x2e')](_0xba83('0x3d'),_0x20f661['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x20bef2){try{if(this[_0xba83('0x6')][_0x20bef2[_0xba83('0x1b')]]&&(this['voiceQueues'][_0x20bef2[_0xba83('0x1b')]][_0xba83('0x5')]||this[_0xba83('0x6')][_0x20bef2[_0xba83('0x1b')]]['mandatoryDisposition'])){if(this['agents'][_0x20bef2[_0xba83('0x1a')]]){this[_0xba83('0x9')][_0x20bef2[_0xba83('0x2c')]]={'queue':_0x20bef2[_0xba83('0x1b')],'interface':_0x20bef2['interface'],'destlinkedid':_0x20bef2[_0xba83('0x25')]};}}}catch(_0x37de9b){logger[_0xba83('0x2e')](_0xba83('0x3e'),_0x37de9b['message']);}};Acw[_0xba83('0x18')][_0xba83('0x15')]=function(_0x1dc6ab){try{if(this[_0xba83('0x6')][_0x1dc6ab[_0xba83('0x1b')]]&&(this[_0xba83('0x6')][_0x1dc6ab[_0xba83('0x1b')]][_0xba83('0x5')]||this[_0xba83('0x6')][_0x1dc6ab[_0xba83('0x1b')]][_0xba83('0x1d')])){if(this[_0xba83('0x7')][_0x1dc6ab[_0xba83('0x1a')]]){this[_0xba83('0x9')][_0x1dc6ab[_0xba83('0x2c')]]={'queue':_0x1dc6ab[_0xba83('0x1b')],'interface':_0x1dc6ab['interface']};}}}catch(_0x279622){logger['error'](_0xba83('0x3f'),_0x279622[_0xba83('0x35')]);}};Acw[_0xba83('0x18')][_0xba83('0xd')]=function(_0x3a6283){try{if(this['channels'][_0x3a6283[_0xba83('0x2c')]]&&_['isUndefined'](this[_0xba83('0x9')][_0x3a6283[_0xba83('0x2c')]]['attended'])){logger[_0xba83('0x30')]('[%s][HANGUP:UNIQUEID]',_0x3a6283[_0xba83('0x2c')]);this[_0xba83('0x19')](_0x3a6283['uniqueid']);}else if(this['channels'][_0x3a6283['linkedid']]&&_['isUndefined'](this['channels'][_0x3a6283[_0xba83('0x40')]][_0xba83('0x24')])){logger[_0xba83('0x30')]('[%s][HANGUP:LINKEDID]',_0x3a6283['linkedid']);this[_0xba83('0x19')](_0x3a6283[_0xba83('0x40')]);}}catch(_0x19b101){logger[_0xba83('0x2e')](_0xba83('0x41'),_0x19b101[_0xba83('0x35')]);}};Acw[_0xba83('0x18')][_0xba83('0xf')]=function(_0x586e1d){try{if(this[_0xba83('0x9')][_0x586e1d['uniqueid']]&&this['channels'][_0x586e1d['uniqueid']][_0xba83('0x24')]){logger[_0xba83('0x30')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x586e1d[_0xba83('0x2c')]);this['startAcw'](_0x586e1d[_0xba83('0x2c')]);}else if(this[_0xba83('0x9')][_0x586e1d[_0xba83('0x40')]]&&this[_0xba83('0x9')][_0x586e1d['linkedid']]['attended']){logger[_0xba83('0x30')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x586e1d['linkedid']);this['startAcw'](_0x586e1d[_0xba83('0x40')]);}}catch(_0x35fb5f){logger['error'](_0xba83('0x42'),_0x35fb5f[_0xba83('0x35')]);}};Acw[_0xba83('0x18')][_0xba83('0x12')]=function(_0x370933){try{if(!_[_0xba83('0x43')](this[_0xba83('0x9')][_0x370933[_0xba83('0x44')]])){this[_0xba83('0x19')](_0x370933['transfereeuniqueid']);if(this[_0xba83('0x9')][_0x370933['secondtransfereruniqueid']]){this[_0xba83('0x9')][_0x370933[_0xba83('0x45')]][_0xba83('0x24')]=!![];this[_0xba83('0x9')][_0x370933[_0xba83('0x46')]]=this[_0xba83('0x9')][_0x370933[_0xba83('0x45')]];delete this[_0xba83('0x9')][_0x370933[_0xba83('0x45')]];}}else if(!_[_0xba83('0x43')](this[_0xba83('0x9')][_0x370933[_0xba83('0x46')]])){this['startAcw'](_0x370933[_0xba83('0x46')]);if(this[_0xba83('0x9')][_0x370933['origtransfereruniqueid']]){this['channels'][_0x370933['origtransfereruniqueid']][_0xba83('0x24')]=!![];this[_0xba83('0x9')][_0x370933[_0xba83('0x44')]]=this[_0xba83('0x9')][_0x370933[_0xba83('0x47')]];delete this['channels'][_0x370933['origtransfereruniqueid']];}}}catch(_0x45f63f){logger[_0xba83('0x2e')](_0xba83('0x48'),_0x45f63f['message']);}};Acw[_0xba83('0x18')][_0xba83('0x13')]=function(_0x51eb26){try{if(this['channels'][_0x51eb26[_0xba83('0x49')]]){logger[_0xba83('0x30')](_0xba83('0x4a'),JSON['stringify'](_0x51eb26[_0xba83('0x49')]));this[_0xba83('0x19')](_0x51eb26[_0xba83('0x49')]);}else if(this[_0xba83('0x9')][_0x51eb26[_0xba83('0x4b')]]){logger[_0xba83('0x30')](_0xba83('0x4c'),JSON['stringify'](_0x51eb26[_0xba83('0x4b')]));this[_0xba83('0x19')](_0x51eb26['transfererlinkedid']);}}catch(_0x19dacb){logger['error'](_0xba83('0x4d'),_0x19dacb[_0xba83('0x35')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x54bd46){try{if(this['voiceQueues'][_0x54bd46['queue']]&&this[_0xba83('0x6')][_0x54bd46[_0xba83('0x1b')]][_0xba83('0x4e')]==='all'){if(this[_0xba83('0x7')][_0x54bd46['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x54bd46['uniqueid'],_0x54bd46[_0xba83('0x1a')],_0x54bd46[_0xba83('0x1b')]);return RpcUser['savePause'](this[_0xba83('0x7')][_0x54bd46['interface']],_0xba83('0x4f'),_0x54bd46[_0xba83('0x2c')]);}}}catch(_0x3a1c55){logger['error'](_0xba83('0x50'),_0x3a1c55[_0xba83('0x35')]);}};module[_0xba83('0x51')]=Acw; \ No newline at end of file +var _0xb340=['voiceQueues','agents','channels','syncAgentConnect','bind','hanguprequest','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','timers','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','interface','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/voiceAgentReport'];(function(_0x254e07,_0x328606){var _0x1687bb=function(_0x26a0d6){while(--_0x26a0d6){_0x254e07['push'](_0x254e07['shift']());}};_0x1687bb(++_0x328606);}(_0xb340,0x185));var _0x0b34=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xb340[_0x134c2e];return _0x2825db;};'use strict';var util=require(_0x0b34('0x0'));var _=require(_0x0b34('0x1'));var moment=require(_0x0b34('0x2'));var ami=require(_0x0b34('0x3'));var logger=require('../../../config/logger')(_0x0b34('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x0b34('0x5'));function Acw(_0x1df291){this['voiceQueues']=_0x1df291[_0x0b34('0x6')];this[_0x0b34('0x7')]=_0x1df291['agents'];this['timers']=_0x1df291['timers'];this[_0x0b34('0x8')]={};ami['on']('agentconnect',this[_0x0b34('0x9')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0xb'),this['syncHangupRequest']['bind'](this));ami['on'](_0x0b34('0xc'),this['syncHangup'][_0x0b34('0xa')](this));ami['on']('agentringnoanswer',this[_0x0b34('0xd')][_0x0b34('0xa')](this));ami['on']('attendedtransfer',this[_0x0b34('0xe')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0xf'),this[_0x0b34('0x10')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0x11'),this[_0x0b34('0x12')][_0x0b34('0xa')](this));}function getDiff(_0x1ae6bd){var _0x59b880=moment()[_0x0b34('0x13')](0x0);var _0x5c983c=moment(_0x1ae6bd)[_0x0b34('0x13')](0x0);return _0x59b880[_0x0b34('0x14')](_0x5c983c,_0x0b34('0x15'));}Acw[_0x0b34('0x16')][_0x0b34('0x17')]=function(_0x26f4e2){try{var _0x3ad3e2=this;var _0x5e4a48=this[_0x0b34('0x8')][_0x26f4e2]['interface'];var _0x308b2c=this[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x18')];var _0x3cb06c=this['voiceQueues'][_0x308b2c];var _0x22274d=![];var _0xda3d30=_0x0b34('0x19');if(_0x3cb06c[_0x0b34('0x1a')]){if(_0x3cb06c[_0x0b34('0x1b')][_0x0b34('0x1c')]){_0x22274d=!![];_0xda3d30=_0x3cb06c['mandatoryDispositionPause']['name'];}}ami['Action']({'action':'QueuePause','interface':_0x5e4a48,'paused':!![],'reason':_0xda3d30})[_0x0b34('0x1d')](function(_0x51273b){if(_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48]){return RpcUser['getAgent'](_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48]['id'])[_0x0b34('0x1d')](function(_0x34fde1){if(_0x34fde1&&!_0x34fde1['voicePause']){logger['info'](_0x0b34('0x1e'),_0x26f4e2,_0x5e4a48,_0x308b2c);var _0x5e63db=_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2]['attended']&&_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x1f')]?_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x1f')]:_0x26f4e2;return RpcUser[_0x0b34('0x20')](_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48],_0xda3d30,_0x5e63db)[_0x0b34('0x1d')](function(_0x57663a){if(!_0x22274d){_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]={};logger[_0x0b34('0x22')](_0x0b34('0x23'),_0x26f4e2,_0x3ad3e2[_0x0b34('0x6')][_0x308b2c][_0x0b34('0x24')],_0x5e4a48,_0x308b2c);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x25')]=setTimeout(_0x3ad3e2[_0x0b34('0x26')][_0x0b34('0xa')](_0x3ad3e2,_0x5e4a48),_0x3ad3e2['voiceQueues'][_0x308b2c][_0x0b34('0x24')]*0x3e8);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x27')]=moment()[_0x0b34('0x28')](_0x0b34('0x29'));_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['uniqueid']=_0x26f4e2;_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['queue']=_0x308b2c;_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x2a')]=function(){var _0x322a93=getDiff(_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['lastPauseAt']);clearTimeout(_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['timer']);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x25')]=![];RpcVoiceAgentReport[_0x0b34('0x2b')]({'acwtime':_0x322a93},_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x2c')],_0x5e4a48)['then'](function(_0x73285d){logger[_0x0b34('0x22')](_0x0b34('0x2d'),_0x26f4e2,_0x322a93,_0x73285d);})['catch'](function(_0x1c2932){logger[_0x0b34('0x2e')](_0x0b34('0x2f'),_0x26f4e2,_0x1c2932);});delete _0x3ad3e2[_0x0b34('0x21')][_0x5e4a48];};}});}else{logger[_0x0b34('0x22')](_0x0b34('0x30'),_0x26f4e2,_0x5e4a48,_0x308b2c);}});}})['catch'](function(_0x2e063b){logger[_0x0b34('0x2e')](_0x0b34('0x23'),_0x26f4e2,_0x3ad3e2[_0x0b34('0x6')][_0x308b2c][_0x0b34('0x24')],_0x5e4a48,_0x308b2c);})[_0x0b34('0x31')](function(){delete _0x3ad3e2[_0x0b34('0x8')][_0x26f4e2];});}catch(_0x5a4dbc){logger[_0x0b34('0x2e')](_0x0b34('0x32'),_0x5a4dbc['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x26')]=function(_0x35816d){try{var _0x367724=this;if(_0x367724[_0x0b34('0x21')][_0x35816d]){_0x367724[_0x0b34('0x21')][_0x35816d][_0x0b34('0x25')]=![];var _0x39f1e8=_0x367724[_0x0b34('0x21')][_0x35816d][_0x0b34('0x2c')];var _0x5e1f19=_0x367724['timers'][_0x35816d][_0x0b34('0x18')];var _0x3ea385=_0x367724[_0x0b34('0x6')][_0x5e1f19][_0x0b34('0x24')];logger[_0x0b34('0x22')](_0x0b34('0x33'),_0x39f1e8,_0x35816d);RpcUser['saveUnpause'](this[_0x0b34('0x7')][_0x35816d]);RpcVoiceAgentReport[_0x0b34('0x2b')]({'acwtime':_0x3ea385,'agentacw':!![]},_0x39f1e8,_0x35816d)[_0x0b34('0x1d')](function(_0x32c049){logger[_0x0b34('0x22')](_0x0b34('0x2d'),_0x39f1e8,_0x3ea385,_0x32c049);})[_0x0b34('0x34')](function(_0x370ab8){logger[_0x0b34('0x2e')](_0x0b34('0x2f'),_0x39f1e8,_0x370ab8);});}else{logger[_0x0b34('0x2e')](_0x0b34('0x35'),_0x35816d);if(_0x367724['timers']){logger[_0x0b34('0x22')]('[ACW][TIMERS]',JSON['stringify'](_0x367724['timers']));}}}catch(_0x271246){logger[_0x0b34('0x2e')]('[ACW][STOP]\x20%s',_0x271246['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x9')]=function(_0x179bdb){try{if(this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]]&&(this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]][_0x0b34('0x4')]||this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]][_0x0b34('0x1a')])){if(this[_0x0b34('0x7')][_0x179bdb[_0x0b34('0x36')]]){this[_0x0b34('0x8')][_0x179bdb[_0x0b34('0x2c')]]={'queue':_0x179bdb[_0x0b34('0x18')],'interface':_0x179bdb[_0x0b34('0x36')],'destlinkedid':_0x179bdb[_0x0b34('0x1f')]};}}}catch(_0x2507b3){logger[_0x0b34('0x2e')](_0x0b34('0x37'),_0x2507b3[_0x0b34('0x38')]);}};Acw['prototype'][_0x0b34('0x12')]=function(_0x1c1a6d){try{if(this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]]&&(this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]][_0x0b34('0x4')]||this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]][_0x0b34('0x1a')])){if(this[_0x0b34('0x7')][_0x1c1a6d[_0x0b34('0x36')]]){this[_0x0b34('0x8')][_0x1c1a6d[_0x0b34('0x2c')]]={'queue':_0x1c1a6d[_0x0b34('0x18')],'interface':_0x1c1a6d[_0x0b34('0x36')]};}}}catch(_0x392d24){logger[_0x0b34('0x2e')](_0x0b34('0x39'),_0x392d24['message']);}};Acw['prototype'][_0x0b34('0x3a')]=function(_0x10862c){try{if(this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x2c')]]&&_['isUndefined'](this[_0x0b34('0x8')][_0x10862c['uniqueid']][_0x0b34('0x3b')])){logger[_0x0b34('0x22')](_0x0b34('0x3c'),_0x10862c[_0x0b34('0x2c')]);this[_0x0b34('0x17')](_0x10862c[_0x0b34('0x2c')]);}else if(this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x3d')]]&&_[_0x0b34('0x3e')](this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x3d')]][_0x0b34('0x3b')])){logger[_0x0b34('0x22')](_0x0b34('0x3f'),_0x10862c[_0x0b34('0x3d')]);this[_0x0b34('0x17')](_0x10862c[_0x0b34('0x3d')]);}}catch(_0x286a0e){logger[_0x0b34('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x286a0e[_0x0b34('0x38')]);}};Acw['prototype'][_0x0b34('0x40')]=function(_0xfa62e6){try{if(this[_0x0b34('0x8')][_0xfa62e6['uniqueid']]&&this[_0x0b34('0x8')][_0xfa62e6['uniqueid']][_0x0b34('0x3b')]){logger[_0x0b34('0x22')](_0x0b34('0x41'),_0xfa62e6[_0x0b34('0x2c')]);this[_0x0b34('0x17')](_0xfa62e6[_0x0b34('0x2c')]);}else if(this[_0x0b34('0x8')][_0xfa62e6[_0x0b34('0x3d')]]&&this[_0x0b34('0x8')][_0xfa62e6['linkedid']][_0x0b34('0x3b')]){logger[_0x0b34('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xfa62e6[_0x0b34('0x3d')]);this[_0x0b34('0x17')](_0xfa62e6['linkedid']);}}catch(_0x5a8cb0){logger[_0x0b34('0x2e')](_0x0b34('0x42'),_0x5a8cb0[_0x0b34('0x38')]);}};Acw[_0x0b34('0x16')][_0x0b34('0xe')]=function(_0x59e685){try{if(!_[_0x0b34('0x43')](this[_0x0b34('0x8')][_0x59e685['transfereeuniqueid']])){this[_0x0b34('0x17')](_0x59e685[_0x0b34('0x44')]);if(this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x45')]]){this['channels'][_0x59e685[_0x0b34('0x45')]][_0x0b34('0x3b')]=!![];this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x46')]]=this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x45')]];delete this[_0x0b34('0x8')][_0x59e685['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x46')]])){this[_0x0b34('0x17')](_0x59e685[_0x0b34('0x46')]);if(this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]]){this[_0x0b34('0x8')][_0x59e685['origtransfereruniqueid']][_0x0b34('0x3b')]=!![];this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x44')]]=this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]];delete this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]];}}}catch(_0x361782){logger[_0x0b34('0x2e')]('[ACW][syncAttendedTransfer]\x20%s',_0x361782['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x10')]=function(_0x3392c9){try{if(this[_0x0b34('0x8')][_0x3392c9[_0x0b34('0x48')]]){logger[_0x0b34('0x22')](_0x0b34('0x49'),JSON[_0x0b34('0x4a')](_0x3392c9[_0x0b34('0x48')]));this['startAcw'](_0x3392c9['transfereruniqueid']);}else if(this[_0x0b34('0x8')][_0x3392c9[_0x0b34('0x4b')]]){logger[_0x0b34('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x0b34('0x4a')](_0x3392c9[_0x0b34('0x4b')]));this[_0x0b34('0x17')](_0x3392c9[_0x0b34('0x4b')]);}}catch(_0x4376a2){logger[_0x0b34('0x2e')](_0x0b34('0x4c'),_0x4376a2[_0x0b34('0x38')]);}};Acw[_0x0b34('0x16')]['syncAgentRingNoAnswer']=function(_0x27f552){try{if(this[_0x0b34('0x6')][_0x27f552['queue']]&&this['voiceQueues'][_0x27f552[_0x0b34('0x18')]]['autopause']==='all'){if(this['agents'][_0x27f552[_0x0b34('0x36')]]){logger[_0x0b34('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x27f552[_0x0b34('0x2c')],_0x27f552[_0x0b34('0x36')],_0x27f552[_0x0b34('0x18')]);return RpcUser[_0x0b34('0x20')](this[_0x0b34('0x7')][_0x27f552[_0x0b34('0x36')]],_0x0b34('0x4d'),_0x27f552[_0x0b34('0x2c')]);}}}catch(_0x25f50f){logger[_0x0b34('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x25f50f['message']);}};module[_0x0b34('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9b880c9..0696f26 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x398a5b,_0x29c604){_0x398a5b=_0x398a5b-0x0;var _0xb2442f=_0x2032[_0x398a5b];return _0xb2442f;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x30d929,_0x2fd4f1){var _0x2e8b21=function(_0x2b2b71){while(--_0x2b2b71){_0x30d929['push'](_0x30d929['shift']());}};_0x2e8b21(++_0x2fd4f1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index aec53bb..08a2efe 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x17f145,_0x3422bb){var _0x2d5420=function(_0x3eb38b){while(--_0x3eb38b){_0x17f145['push'](_0x17f145['shift']());}};_0x2d5420(++_0x3422bb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1c6373,_0x728679){_0x1c6373=_0x1c6373-0x0;var _0x5a4a66=_0x9bde[_0x1c6373];return _0x5a4a66;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x323c7e,_0x3d16ec){var _0x2b0f72=function(_0x5a2310){while(--_0x5a2310){_0x323c7e['push'](_0x323c7e['shift']());}};_0x2b0f72(++_0x3d16ec);}(_0xac4a,0x13f));var _0xaac4=function(_0x3f330d,_0x28c2bd){_0x3f330d=_0x3f330d-0x0;var _0xc85453=_0xac4a[_0x3f330d];return _0xc85453;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a21e1cb..d86555f 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 _0x84df=['moment','string','voiceQueue','phone','firstName','Contact','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util'];(function(_0x50306f,_0x59e402){var _0x15a001=function(_0x26d556){while(--_0x26d556){_0x50306f['push'](_0x50306f['shift']());}};_0x15a001(++_0x59e402);}(_0x84df,0x107));var _0xf84d=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x84df[_0x5e9d35];return _0x3beb2e;};'use strict';var util=require(_0xf84d('0x0'));var _=require('lodash');var moment=require(_0xf84d('0x1'));function checkNameSurname(_0x1e758c,_0x49ab65,_0x37f7d3){var _0x3d16ba='';if(!_['isNil'](_0x49ab65)&&_0xf84d('0x2')===typeof _0x49ab65){_0x3d16ba+=_0x49ab65;}if(!_['isNil'](_0x37f7d3)&&_0xf84d('0x2')===typeof _0x37f7d3){_0x3d16ba+='\x20'+_0x37f7d3;}if(_0x3d16ba!==''){return _0x3d16ba;}return _0x1e758c;}function Action(_0x27d0b2,_0x212dfd,_0x4c0150){this[_0xf84d('0x3')]=_0x27d0b2;this['uniqueid']=_0x4c0150||undefined;this['name']=checkNameSurname(_0x212dfd['Contact'][_0xf84d('0x4')],_0x212dfd['Contact'][_0xf84d('0x5')],_0x212dfd[_0xf84d('0x6')][_0xf84d('0x7')]);this[_0xf84d('0x8')]=_0x212dfd['phone'];this['queue']=_0x27d0b2[_0xf84d('0x9')];this[_0xf84d('0xa')]=_0x212dfd['active']||![];this['type']=_0x27d0b2[_0xf84d('0xb')];this[_0xf84d('0xc')]=_0x27d0b2[_0xf84d('0xc')]||0x3;this[_0xf84d('0xd')]=_0x212dfd[_0xf84d('0xd')];this['countbusyretry']=_0x212dfd['countbusyretry'];this[_0xf84d('0xe')]=_0x212dfd['countcongestionretry'];this[_0xf84d('0xf')]=_0x212dfd[_0xf84d('0xf')];this[_0xf84d('0x10')]=_0x212dfd[_0xf84d('0x10')];this[_0xf84d('0x11')]=_0x212dfd['countdropretry'];this[_0xf84d('0x12')]=_0x212dfd['countabandonedretry'];this[_0xf84d('0x13')]=_0x212dfd[_0xf84d('0x13')];this[_0xf84d('0x14')]=_0x212dfd['countagentrejectretry'];this[_0xf84d('0x15')]=_0x212dfd['ContactId'];this['ListId']=_0x212dfd[_0xf84d('0x16')];this['UserId']=_0x212dfd[_0xf84d('0x17')];this[_0xf84d('0x18')]=_0x212dfd[_0xf84d('0x18')];this[_0xf84d('0x19')]=_0x212dfd[_0xf84d('0x19')];this[_0xf84d('0x1a')]=_0x212dfd['id'];this[_0xf84d('0x1b')]=_0x212dfd[_0xf84d('0x6')][_0xf84d('0x5')]||'';this['starttime']=moment()['format'](_0xf84d('0x1c'));this['callback']=_0x212dfd[_0xf84d('0x1d')];this['callbackuniqueid']=_0x212dfd[_0xf84d('0x1e')];this[_0xf84d('0x1f')]=_0x212dfd[_0xf84d('0x1f')];this[_0xf84d('0x20')]=_0x212dfd[_0xf84d('0x20')];this[_0xf84d('0x21')]='';this[_0xf84d('0x22')]='';}Action[_0xf84d('0x23')][_0xf84d('0x24')]=function(){return util[_0xf84d('0x25')](_0xf84d('0x26'),this[_0xf84d('0x9')],this['voiceQueue'][_0xf84d('0x27')]>0x0?this[_0xf84d('0x8')][_0xf84d('0x28')](this[_0xf84d('0x3')]['dialCutDigit']):this['number']);};Action[_0xf84d('0x23')][_0xf84d('0x29')]=function(){return this[_0xf84d('0x2a')];};module[_0xf84d('0x2b')]=Action; \ No newline at end of file +var _0x5e7d=['\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x5e7d,0x15c));var _0xd5e7=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x5e7d[_0x1aeda2];return _0x32dc6d;};'use strict';var util=require(_0xd5e7('0x0'));var _=require(_0xd5e7('0x1'));var moment=require(_0xd5e7('0x2'));function checkNameSurname(_0x62e30b,_0x43006f,_0x31735e){var _0x28c8fb='';if(!_['isNil'](_0x43006f)&&_0xd5e7('0x3')===typeof _0x43006f){_0x28c8fb+=_0x43006f;}if(!_[_0xd5e7('0x4')](_0x31735e)&&_0xd5e7('0x3')===typeof _0x31735e){_0x28c8fb+='\x20'+_0x31735e;}if(_0x28c8fb!==''){return _0x28c8fb;}return _0x62e30b;}function Action(_0x34118f,_0x527935,_0x4242ba){this[_0xd5e7('0x5')]=_0x34118f;this[_0xd5e7('0x6')]=_0x4242ba||undefined;this[_0xd5e7('0x7')]=checkNameSurname(_0x527935[_0xd5e7('0x8')]['phone'],_0x527935[_0xd5e7('0x8')][_0xd5e7('0x9')],_0x527935[_0xd5e7('0x8')][_0xd5e7('0xa')]);this[_0xd5e7('0xb')]=_0x527935[_0xd5e7('0xc')];this[_0xd5e7('0xd')]=_0x34118f[_0xd5e7('0x7')];this[_0xd5e7('0xe')]=_0x527935[_0xd5e7('0xe')]||![];this['type']=_0x34118f[_0xd5e7('0xf')];this[_0xd5e7('0x10')]=_0x34118f['dialQueueTimeout']||0x3;this['scheduledat']=_0x527935['scheduledat'];this[_0xd5e7('0x11')]=_0x527935[_0xd5e7('0x11')];this[_0xd5e7('0x12')]=_0x527935[_0xd5e7('0x12')];this[_0xd5e7('0x13')]=_0x527935[_0xd5e7('0x13')];this[_0xd5e7('0x14')]=_0x527935[_0xd5e7('0x14')];this['countdropretry']=_0x527935[_0xd5e7('0x15')];this[_0xd5e7('0x16')]=_0x527935[_0xd5e7('0x16')];this[_0xd5e7('0x17')]=_0x527935[_0xd5e7('0x17')];this[_0xd5e7('0x18')]=_0x527935[_0xd5e7('0x18')];this[_0xd5e7('0x19')]=_0x527935[_0xd5e7('0x19')];this[_0xd5e7('0x1a')]=_0x527935[_0xd5e7('0x1a')];this[_0xd5e7('0x1b')]=_0x527935[_0xd5e7('0x1b')];this[_0xd5e7('0x1c')]=_0x527935[_0xd5e7('0x1c')];this[_0xd5e7('0x1d')]=_0x527935[_0xd5e7('0x1d')];this[_0xd5e7('0x1e')]=_0x527935['id'];this[_0xd5e7('0x1f')]=_0x527935[_0xd5e7('0x8')]['firstName']||'';this[_0xd5e7('0x20')]=moment()[_0xd5e7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x527935['callback'];this[_0xd5e7('0x22')]=_0x527935[_0xd5e7('0x22')];this[_0xd5e7('0x23')]=_0x527935[_0xd5e7('0x23')];this[_0xd5e7('0x24')]=_0x527935[_0xd5e7('0x24')];this[_0xd5e7('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0xd5e7('0x26')]=function(){return util[_0xd5e7('0x21')](_0xd5e7('0x27'),this[_0xd5e7('0x7')],this['voiceQueue'][_0xd5e7('0x28')]>0x0?this[_0xd5e7('0xb')][_0xd5e7('0x29')](this[_0xd5e7('0x5')][_0xd5e7('0x28')]):this['number']);};Action[_0xd5e7('0x2a')]['getQueue']=function(){return this[_0xd5e7('0xd')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index df95f9f..b19410b 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 _0xf55b=['starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','number'];(function(_0x1e466c,_0x59354e){var _0x5424b5=function(_0x5eeb3e){while(--_0x5eeb3e){_0x1e466c['push'](_0x1e466c['shift']());}};_0x5424b5(++_0x59354e);}(_0xf55b,0x1c4));var _0xbf55=function(_0x9acba8,_0x115e86){_0x9acba8=_0x9acba8-0x0;var _0x52f845=_0xf55b[_0x9acba8];return _0x52f845;};'use strict';var util=require(_0xbf55('0x0'));var _=require(_0xbf55('0x1'));var moment=require('moment');function getSeconds(_0x164b45,_0x3ca65f){var _0x54b45b=moment(_0x164b45)[_0xbf55('0x2')](0x0);var _0x5a299d=moment(_0x3ca65f)[_0xbf55('0x2')](0x0);return _0x54b45b[_0xbf55('0x3')](_0x5a299d,'seconds');}function AgentComplete(_0x156ba5,_0x916785){this[_0xbf55('0x4')]=0x4;this[_0xbf55('0x5')]=_0xbf55('0x6');this[_0xbf55('0x7')]=_0x156ba5[_0xbf55('0x7')];this[_0xbf55('0x8')]=_0x156ba5['type'];this['campaigntype']=_0x156ba5['type']===_0xbf55('0x9')?'queue':_0x156ba5[_0xbf55('0x8')];this[_0xbf55('0xa')]=_0x156ba5[_0xbf55('0xa')];this['countcongestionretry']=_0x156ba5[_0xbf55('0xb')];this[_0xbf55('0xc')]=_0x156ba5[_0xbf55('0xc')];this[_0xbf55('0xd')]=_0x156ba5[_0xbf55('0xa')]+_0x156ba5[_0xbf55('0xb')]+_0x156ba5['countnoanswerretry']+_0x156ba5[_0xbf55('0xe')]+_0x156ba5['countdropretry']+_0x156ba5[_0xbf55('0xf')]+_0x156ba5[_0xbf55('0x10')]+_0x156ba5[_0xbf55('0x11')];this[_0xbf55('0xe')]=_0x156ba5[_0xbf55('0xe')];this['countdropretry']=_0x156ba5[_0xbf55('0x12')];this[_0xbf55('0xf')]=_0x156ba5[_0xbf55('0xf')];this[_0xbf55('0x10')]=_0x156ba5['countmachineretry'];this[_0xbf55('0x11')]=_0x156ba5[_0xbf55('0x11')];this[_0xbf55('0x13')]=_0x916785['uniqueid'];this['calleridname']=_0x156ba5['name'];this['calleridnum']=_0x156ba5[_0xbf55('0x14')];this[_0xbf55('0x15')]=_0x156ba5[_0xbf55('0x15')];this['responsetime']=_0x156ba5['responsetime'];this[_0xbf55('0x16')]=_0x156ba5[_0xbf55('0x16')];this['endtime']=moment()[_0xbf55('0x17')](_0xbf55('0x18'));this[_0xbf55('0x19')]=getSeconds(_0x156ba5[_0xbf55('0x1a')],_0x156ba5[_0xbf55('0x15')]);this[_0xbf55('0x1b')]=getSeconds(_0x156ba5[_0xbf55('0x16')],_0x156ba5[_0xbf55('0x1a')]);this[_0xbf55('0x1c')]=getSeconds(this[_0xbf55('0x1d')],_0x156ba5[_0xbf55('0x16')]);this[_0xbf55('0x1e')]=_0x916785[_0xbf55('0x1e')];this['membername']=_0x916785[_0xbf55('0x1f')];this[_0xbf55('0x20')]=_0x916785[_0xbf55('0x20')];this[_0xbf55('0x21')]=_0x156ba5['callback'];this['callbackuniqueid']=_0x156ba5['callbackuniqueid'];this[_0xbf55('0x22')]=_0x156ba5[_0xbf55('0x22')];this[_0xbf55('0x23')]=_0x156ba5[_0xbf55('0x23')];this[_0xbf55('0x24')]=_0x156ba5['ContactId'];this['ListId']=_0x156ba5['ListId'];this[_0xbf55('0x25')]=_0x156ba5[_0xbf55('0x25')];this[_0xbf55('0x26')]=_0x156ba5[_0xbf55('0x26')];this[_0xbf55('0x27')]=_0x156ba5['CampaignId'];this[_0xbf55('0x28')]=_0x156ba5[_0xbf55('0x28')]||'';this[_0xbf55('0x29')]=_0x156ba5[_0xbf55('0x29')]||'';}module[_0xbf55('0x2a')]=AgentComplete; \ No newline at end of file +var _0x8559=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x469014,_0x23f83b){var _0x24d9dd=function(_0x422065){while(--_0x422065){_0x469014['push'](_0x469014['shift']());}};_0x24d9dd(++_0x23f83b);}(_0x8559,0x6c));var _0x9855=function(_0x510247,_0x1bd049){_0x510247=_0x510247-0x0;var _0x180200=_0x8559[_0x510247];return _0x180200;};'use strict';var util=require(_0x9855('0x0'));var _=require(_0x9855('0x1'));var moment=require(_0x9855('0x2'));function getSeconds(_0x20f503,_0x3839d2){var _0x9b59d5=moment(_0x20f503)['milliseconds'](0x0);var _0x4c8de7=moment(_0x3839d2)['milliseconds'](0x0);return _0x9b59d5['diff'](_0x4c8de7,_0x9855('0x3'));}function AgentComplete(_0x280c08,_0x3dc6fa){this[_0x9855('0x4')]=0x4;this[_0x9855('0x5')]=_0x9855('0x6');this['scheduledat']=_0x280c08[_0x9855('0x7')];this[_0x9855('0x8')]=_0x280c08[_0x9855('0x8')];this['campaigntype']=_0x280c08[_0x9855('0x8')]===_0x9855('0x9')?_0x9855('0xa'):_0x280c08[_0x9855('0x8')];this[_0x9855('0xb')]=_0x280c08['countbusyretry'];this[_0x9855('0xc')]=_0x280c08[_0x9855('0xc')];this[_0x9855('0xd')]=_0x280c08['countnoanswerretry'];this[_0x9855('0xe')]=_0x280c08[_0x9855('0xb')]+_0x280c08['countcongestionretry']+_0x280c08[_0x9855('0xd')]+_0x280c08[_0x9855('0xf')]+_0x280c08[_0x9855('0x10')]+_0x280c08[_0x9855('0x11')]+_0x280c08[_0x9855('0x12')]+_0x280c08[_0x9855('0x13')];this['countnosuchnumberretry']=_0x280c08[_0x9855('0xf')];this['countdropretry']=_0x280c08[_0x9855('0x10')];this['countabandonedretry']=_0x280c08[_0x9855('0x11')];this[_0x9855('0x12')]=_0x280c08[_0x9855('0x12')];this[_0x9855('0x13')]=_0x280c08[_0x9855('0x13')];this['uniqueid']=_0x3dc6fa[_0x9855('0x14')];this[_0x9855('0x15')]=_0x280c08[_0x9855('0x16')];this['calleridnum']=_0x280c08[_0x9855('0x17')];this[_0x9855('0x18')]=_0x280c08[_0x9855('0x18')];this[_0x9855('0x19')]=_0x280c08[_0x9855('0x19')];this['answertime']=_0x280c08[_0x9855('0x1a')];this[_0x9855('0x1b')]=moment()[_0x9855('0x1c')](_0x9855('0x1d'));this[_0x9855('0x1e')]=getSeconds(_0x280c08[_0x9855('0x19')],_0x280c08['starttime']);this['holdtime']=getSeconds(_0x280c08[_0x9855('0x1a')],_0x280c08[_0x9855('0x19')]);this['talktime']=getSeconds(this[_0x9855('0x1b')],_0x280c08[_0x9855('0x1a')]);this[_0x9855('0xa')]=_0x3dc6fa[_0x9855('0xa')];this[_0x9855('0x1f')]=_0x3dc6fa[_0x9855('0x1f')];this[_0x9855('0x20')]=_0x3dc6fa[_0x9855('0x20')];this[_0x9855('0x21')]=_0x280c08['callback'];this[_0x9855('0x22')]=_0x280c08[_0x9855('0x22')];this[_0x9855('0x23')]=_0x280c08[_0x9855('0x23')];this[_0x9855('0x24')]=_0x280c08[_0x9855('0x24')];this[_0x9855('0x25')]=_0x280c08[_0x9855('0x25')];this['ListId']=_0x280c08[_0x9855('0x26')];this[_0x9855('0x27')]=_0x280c08[_0x9855('0x27')];this['VoiceQueueId']=_0x280c08[_0x9855('0x28')];this[_0x9855('0x29')]=_0x280c08[_0x9855('0x29')];this[_0x9855('0x2a')]=_0x280c08[_0x9855('0x2a')]||'';this['originatecalleridname']=_0x280c08['originatecalleridname']||'';}module[_0x9855('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index a165a86..2ed114f 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 _0x9649=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9649,0x19f));var _0x9964=function(_0x5897ca,_0x4f46e8){_0x5897ca=_0x5897ca-0x0;var _0x2666c3=_0x9649[_0x5897ca];return _0x2666c3;};'use strict';var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var moment=require(_0x9964('0x2'));function getSeconds(_0x222303,_0x5e1430){var _0x457627=moment(_0x222303)[_0x9964('0x3')](0x0);var _0x48790a=moment(_0x5e1430)[_0x9964('0x3')](0x0);return _0x457627['diff'](_0x48790a,_0x9964('0x4'));}function Final(_0x32aeb4){this[_0x9964('0x5')]=_0x32aeb4[_0x9964('0x5')];this[_0x9964('0x6')]=_0x32aeb4[_0x9964('0x6')];this[_0x9964('0x7')]=_0x32aeb4['type'];this[_0x9964('0x8')]=_0x32aeb4[_0x9964('0x7')]==='outbound'?_0x9964('0x9'):_0x32aeb4[_0x9964('0x7')];this['countbusyretry']=_0x32aeb4['countbusyretry'];this[_0x9964('0xa')]=_0x32aeb4[_0x9964('0xa')];this[_0x9964('0xb')]=_0x32aeb4[_0x9964('0xb')];this[_0x9964('0xc')]=_0x32aeb4['countbusyretry']+_0x32aeb4[_0x9964('0xa')]+_0x32aeb4['countnoanswerretry']+_0x32aeb4[_0x9964('0xd')]+_0x32aeb4[_0x9964('0xe')]+_0x32aeb4['countabandonedretry']+_0x32aeb4[_0x9964('0xf')]+_0x32aeb4[_0x9964('0x10')];this['countnosuchnumberretry']=_0x32aeb4[_0x9964('0xd')];this[_0x9964('0xe')]=_0x32aeb4[_0x9964('0xe')];this[_0x9964('0x11')]=_0x32aeb4[_0x9964('0x11')];this['countmachineretry']=_0x32aeb4[_0x9964('0xf')];this[_0x9964('0x10')]=_0x32aeb4['countagentrejectretry'];this[_0x9964('0x9')]=_0x32aeb4[_0x9964('0x9')];this['calleridname']=_0x32aeb4[_0x9964('0x12')];this[_0x9964('0x13')]=_0x32aeb4[_0x9964('0x13')];this[_0x9964('0x14')]=_0x32aeb4['starttime'];this[_0x9964('0x15')]=_0x32aeb4[_0x9964('0x15')];this['endtime']=_0x32aeb4[_0x9964('0x15')];this[_0x9964('0x16')]=_0x32aeb4[_0x9964('0x16')]||0x0;this[_0x9964('0x17')]=_0x32aeb4[_0x9964('0x17')]||0x0;this[_0x9964('0x18')]=_0x32aeb4[_0x9964('0x18')]||0x0;this[_0x9964('0x19')]=_0x32aeb4[_0x9964('0x19')];this[_0x9964('0x1a')]=_0x32aeb4['callbackuniqueid'];this[_0x9964('0x1b')]=_0x32aeb4[_0x9964('0x1b')];this['recallme']=_0x32aeb4[_0x9964('0x1c')];this['ContactId']=_0x32aeb4[_0x9964('0x1d')];this[_0x9964('0x1e')]=_0x32aeb4[_0x9964('0x1e')];this[_0x9964('0x1f')]=_0x32aeb4[_0x9964('0x1f')];this[_0x9964('0x20')]=_0x32aeb4['VoiceQueueId'];this[_0x9964('0x21')]=_0x32aeb4[_0x9964('0x21')];this['originatecalleridnum']=_0x32aeb4[_0x9964('0x22')]||'';this[_0x9964('0x23')]=_0x32aeb4[_0x9964('0x23')]||'';}module[_0x9964('0x24')]=Final; \ No newline at end of file +var _0x9649=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x4cf765,_0xc7a6bf){var _0x473760=function(_0x2d501d){while(--_0x2d501d){_0x4cf765['push'](_0x4cf765['shift']());}};_0x473760(++_0xc7a6bf);}(_0x9649,0x19f));var _0x9964=function(_0x356e3e,_0x44d117){_0x356e3e=_0x356e3e-0x0;var _0x3ff610=_0x9649[_0x356e3e];return _0x3ff610;};'use strict';var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var moment=require(_0x9964('0x2'));function getSeconds(_0x222303,_0x5e1430){var _0x457627=moment(_0x222303)[_0x9964('0x3')](0x0);var _0x48790a=moment(_0x5e1430)[_0x9964('0x3')](0x0);return _0x457627['diff'](_0x48790a,_0x9964('0x4'));}function Final(_0x32aeb4){this[_0x9964('0x5')]=_0x32aeb4[_0x9964('0x5')];this[_0x9964('0x6')]=_0x32aeb4[_0x9964('0x6')];this[_0x9964('0x7')]=_0x32aeb4['type'];this[_0x9964('0x8')]=_0x32aeb4[_0x9964('0x7')]==='outbound'?_0x9964('0x9'):_0x32aeb4[_0x9964('0x7')];this['countbusyretry']=_0x32aeb4['countbusyretry'];this[_0x9964('0xa')]=_0x32aeb4[_0x9964('0xa')];this[_0x9964('0xb')]=_0x32aeb4[_0x9964('0xb')];this[_0x9964('0xc')]=_0x32aeb4['countbusyretry']+_0x32aeb4[_0x9964('0xa')]+_0x32aeb4['countnoanswerretry']+_0x32aeb4[_0x9964('0xd')]+_0x32aeb4[_0x9964('0xe')]+_0x32aeb4['countabandonedretry']+_0x32aeb4[_0x9964('0xf')]+_0x32aeb4[_0x9964('0x10')];this['countnosuchnumberretry']=_0x32aeb4[_0x9964('0xd')];this[_0x9964('0xe')]=_0x32aeb4[_0x9964('0xe')];this[_0x9964('0x11')]=_0x32aeb4[_0x9964('0x11')];this['countmachineretry']=_0x32aeb4[_0x9964('0xf')];this[_0x9964('0x10')]=_0x32aeb4['countagentrejectretry'];this[_0x9964('0x9')]=_0x32aeb4[_0x9964('0x9')];this['calleridname']=_0x32aeb4[_0x9964('0x12')];this[_0x9964('0x13')]=_0x32aeb4[_0x9964('0x13')];this[_0x9964('0x14')]=_0x32aeb4['starttime'];this[_0x9964('0x15')]=_0x32aeb4[_0x9964('0x15')];this['endtime']=_0x32aeb4[_0x9964('0x15')];this[_0x9964('0x16')]=_0x32aeb4[_0x9964('0x16')]||0x0;this[_0x9964('0x17')]=_0x32aeb4[_0x9964('0x17')]||0x0;this[_0x9964('0x18')]=_0x32aeb4[_0x9964('0x18')]||0x0;this[_0x9964('0x19')]=_0x32aeb4[_0x9964('0x19')];this[_0x9964('0x1a')]=_0x32aeb4['callbackuniqueid'];this[_0x9964('0x1b')]=_0x32aeb4[_0x9964('0x1b')];this['recallme']=_0x32aeb4[_0x9964('0x1c')];this['ContactId']=_0x32aeb4[_0x9964('0x1d')];this[_0x9964('0x1e')]=_0x32aeb4[_0x9964('0x1e')];this[_0x9964('0x1f')]=_0x32aeb4[_0x9964('0x1f')];this[_0x9964('0x20')]=_0x32aeb4['VoiceQueueId'];this[_0x9964('0x21')]=_0x32aeb4[_0x9964('0x21')];this['originatecalleridnum']=_0x32aeb4[_0x9964('0x22')]||'';this[_0x9964('0x23')]=_0x32aeb4[_0x9964('0x23')]||'';}module[_0x9964('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 35fdcd9..9e1356a 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 _0xc710=['countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','membername','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x3f0590,_0x4edb79){var _0x552b9b=function(_0x2c8597){while(--_0x2c8597){_0x3f0590['push'](_0x3f0590['shift']());}};_0x552b9b(++_0x4edb79);}(_0xc710,0x90));var _0x0c71=function(_0x1aba9f,_0x7d8686){_0x1aba9f=_0x1aba9f-0x0;var _0xfd2a63=_0xc710[_0x1aba9f];return _0xfd2a63;};'use strict';var util=require(_0x0c71('0x0'));var _=require(_0x0c71('0x1'));var moment=require(_0x0c71('0x2'));function getSeconds(_0x5a79bf,_0xdb5bea){var _0x47fbdd=moment(_0x5a79bf)['milliseconds'](0x0);var _0x905ad0=moment(_0xdb5bea)[_0x0c71('0x3')](0x0);return _0x47fbdd[_0x0c71('0x4')](_0x905ad0,_0x0c71('0x5'));}function Hangup(_0x14baed,_0x8cafdd){this['state']=0x4;this[_0x0c71('0x6')]=_0x0c71('0x7');this[_0x0c71('0x8')]=_0x14baed[_0x0c71('0x8')];this[_0x0c71('0x9')]=_0x14baed[_0x0c71('0x9')];this[_0x0c71('0xa')]=_0x14baed[_0x0c71('0x9')]===_0x0c71('0xb')?_0x0c71('0xc'):_0x14baed[_0x0c71('0x9')];this[_0x0c71('0xd')]=_0x14baed[_0x0c71('0xd')];this['countcongestionretry']=_0x14baed[_0x0c71('0xe')];this['countnoanswerretry']=_0x14baed[_0x0c71('0xf')];this['countglobal']=_0x14baed['countbusyretry']+_0x14baed[_0x0c71('0xe')]+_0x14baed[_0x0c71('0xf')]+_0x14baed[_0x0c71('0x10')]+_0x14baed[_0x0c71('0x11')]+_0x14baed[_0x0c71('0x12')]+_0x14baed['countmachineretry']+_0x14baed[_0x0c71('0x13')];this['countnosuchnumberretry']=_0x14baed[_0x0c71('0x10')];this[_0x0c71('0x11')]=_0x14baed['countdropretry'];this[_0x0c71('0x12')]=_0x14baed['countabandonedretry'];this[_0x0c71('0x14')]=_0x14baed[_0x0c71('0x14')];this['countagentrejectretry']=_0x14baed['countagentrejectretry'];this['uniqueid']=_0x8cafdd[_0x0c71('0x15')];this['calleridname']=_0x14baed[_0x0c71('0x16')];this[_0x0c71('0x17')]=_0x14baed['number'];this[_0x0c71('0x18')]=_0x14baed[_0x0c71('0x18')];this[_0x0c71('0x19')]=_0x14baed[_0x0c71('0x19')];this[_0x0c71('0x1a')]=moment()[_0x0c71('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0c71('0x1c')]=getSeconds(_0x14baed[_0x0c71('0x19')],_0x14baed['starttime']);this[_0x0c71('0x1d')]=0x0;this['talktime']=getSeconds(this[_0x0c71('0x1a')],_0x14baed[_0x0c71('0x19')]);this[_0x0c71('0xc')]=_0x14baed[_0x0c71('0xc')];this[_0x0c71('0x1e')]='IVR';this[_0x0c71('0x1f')]=_0x8cafdd[_0x0c71('0x20')];this[_0x0c71('0x21')]=_0x14baed[_0x0c71('0x21')];this[_0x0c71('0x22')]=_0x14baed['callbackuniqueid'];this['callbackat']=_0x14baed['callbackat'];this[_0x0c71('0x23')]=_0x14baed[_0x0c71('0x23')];this[_0x0c71('0x24')]=_0x14baed[_0x0c71('0x24')];this[_0x0c71('0x25')]=_0x14baed[_0x0c71('0x25')];this[_0x0c71('0x26')]=_0x14baed[_0x0c71('0x26')];this[_0x0c71('0x27')]=_0x14baed[_0x0c71('0x27')];this[_0x0c71('0x28')]=_0x14baed[_0x0c71('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0xf610=['countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf610,0x9f));var _0x0f61=function(_0x19c2cb,_0x150866){_0x19c2cb=_0x19c2cb-0x0;var _0x385c2f=_0xf610[_0x19c2cb];return _0x385c2f;};'use strict';var util=require(_0x0f61('0x0'));var _=require(_0x0f61('0x1'));var moment=require(_0x0f61('0x2'));function getSeconds(_0x15aca4,_0xf8537f){var _0x2ec9f3=moment(_0x15aca4)['milliseconds'](0x0);var _0x553a21=moment(_0xf8537f)[_0x0f61('0x3')](0x0);return _0x2ec9f3[_0x0f61('0x4')](_0x553a21,_0x0f61('0x5'));}function Hangup(_0x5eb814,_0x21546d){this['state']=0x4;this['statedesc']=_0x0f61('0x6');this[_0x0f61('0x7')]=_0x5eb814['scheduledat'];this['type']=_0x5eb814[_0x0f61('0x8')];this[_0x0f61('0x9')]=_0x5eb814[_0x0f61('0x8')]===_0x0f61('0xa')?'queue':_0x5eb814[_0x0f61('0x8')];this[_0x0f61('0xb')]=_0x5eb814[_0x0f61('0xb')];this[_0x0f61('0xc')]=_0x5eb814[_0x0f61('0xc')];this[_0x0f61('0xd')]=_0x5eb814[_0x0f61('0xd')];this[_0x0f61('0xe')]=_0x5eb814[_0x0f61('0xb')]+_0x5eb814['countcongestionretry']+_0x5eb814[_0x0f61('0xd')]+_0x5eb814['countnosuchnumberretry']+_0x5eb814[_0x0f61('0xf')]+_0x5eb814['countabandonedretry']+_0x5eb814['countmachineretry']+_0x5eb814[_0x0f61('0x10')];this['countnosuchnumberretry']=_0x5eb814[_0x0f61('0x11')];this[_0x0f61('0xf')]=_0x5eb814[_0x0f61('0xf')];this['countabandonedretry']=_0x5eb814[_0x0f61('0x12')];this[_0x0f61('0x13')]=_0x5eb814['countmachineretry'];this[_0x0f61('0x10')]=_0x5eb814[_0x0f61('0x10')];this[_0x0f61('0x14')]=_0x21546d['uniqueid'];this['calleridname']=_0x5eb814['name'];this[_0x0f61('0x15')]=_0x5eb814[_0x0f61('0x16')];this[_0x0f61('0x17')]=_0x5eb814[_0x0f61('0x17')];this[_0x0f61('0x18')]=_0x5eb814[_0x0f61('0x18')];this[_0x0f61('0x19')]=moment()['format'](_0x0f61('0x1a'));this[_0x0f61('0x1b')]=getSeconds(_0x5eb814[_0x0f61('0x18')],_0x5eb814['starttime']);this[_0x0f61('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x0f61('0x19')],_0x5eb814[_0x0f61('0x18')]);this[_0x0f61('0x1d')]=_0x5eb814[_0x0f61('0x1d')];this[_0x0f61('0x1e')]=_0x0f61('0x1f');this[_0x0f61('0x20')]=_0x21546d[_0x0f61('0x21')];this[_0x0f61('0x22')]=_0x5eb814[_0x0f61('0x22')];this[_0x0f61('0x23')]=_0x5eb814[_0x0f61('0x23')];this[_0x0f61('0x24')]=_0x5eb814[_0x0f61('0x24')];this[_0x0f61('0x25')]=_0x5eb814[_0x0f61('0x25')];this[_0x0f61('0x26')]=_0x5eb814[_0x0f61('0x26')];this[_0x0f61('0x27')]=_0x5eb814['ListId'];this[_0x0f61('0x28')]=_0x5eb814[_0x0f61('0x28')];this[_0x0f61('0x29')]=_0x5eb814[_0x0f61('0x29')];this[_0x0f61('0x2a')]=_0x5eb814[_0x0f61('0x2a')];}module[_0x0f61('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4f7d27e..10cab23 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 _0xd19f=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x164a21,_0x363c5b){var _0x57401b=function(_0x28b468){while(--_0x28b468){_0x164a21['push'](_0x164a21['shift']());}};_0x57401b(++_0x363c5b);}(_0xd19f,0x16e));var _0xfd19=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xd19f[_0x22e47a];return _0x15a12a;};'use strict';var util=require(_0xfd19('0x0'));var _=require(_0xfd19('0x1'));var moment=require(_0xfd19('0x2'));function getSeconds(_0x45fee8,_0x21bc56){var _0x267d64=moment(_0x45fee8)[_0xfd19('0x3')](0x0);var _0x2406cf=moment(_0x21bc56)[_0xfd19('0x3')](0x0);return _0x267d64[_0xfd19('0x4')](_0x2406cf,_0xfd19('0x5'));}function History(_0xf0015){this['uniqueid']=_0xf0015[_0xfd19('0x6')];this[_0xfd19('0x7')]=_0xf0015[_0xfd19('0x7')]||undefined;this[_0xfd19('0x8')]=_0xf0015[_0xfd19('0x8')];this[_0xfd19('0x9')]=_0xf0015[_0xfd19('0x8')]==='outbound'?_0xfd19('0xa'):_0xf0015['type'];this[_0xfd19('0xb')]=_0xf0015[_0xfd19('0xb')];this[_0xfd19('0xc')]=_0xf0015['countcongestionretry'];this[_0xfd19('0xd')]=_0xf0015[_0xfd19('0xd')];this[_0xfd19('0xe')]=_0xf0015[_0xfd19('0xb')]+_0xf0015[_0xfd19('0xc')]+_0xf0015[_0xfd19('0xd')]+_0xf0015[_0xfd19('0xf')]+_0xf0015[_0xfd19('0x10')]+_0xf0015[_0xfd19('0x11')]+_0xf0015[_0xfd19('0x12')]+_0xf0015[_0xfd19('0x13')];this[_0xfd19('0xf')]=_0xf0015[_0xfd19('0xf')];this[_0xfd19('0x10')]=_0xf0015[_0xfd19('0x10')];this[_0xfd19('0x11')]=_0xf0015[_0xfd19('0x11')];this['countmachineretry']=_0xf0015['countmachineretry'];this[_0xfd19('0x13')]=_0xf0015[_0xfd19('0x13')];this[_0xfd19('0xa')]=_0xf0015[_0xfd19('0xa')];this['calleridname']=_0xf0015['name'];this['calleridnum']=_0xf0015[_0xfd19('0x14')];this[_0xfd19('0x15')]=_0xf0015[_0xfd19('0x15')];this[_0xfd19('0x16')]=_0xf0015[_0xfd19('0x16')];this[_0xfd19('0x17')]=_0xf0015[_0xfd19('0x16')];this['ringtime']=getSeconds(_0xf0015[_0xfd19('0x16')],_0xf0015[_0xfd19('0x15')]);this[_0xfd19('0x18')]=0x0;this[_0xfd19('0x19')]=0x0;this[_0xfd19('0x1a')]=_0xf0015[_0xfd19('0x1a')];this[_0xfd19('0x1b')]=_0xf0015[_0xfd19('0x1b')];this['callbackat']=_0xf0015[_0xfd19('0x1c')];this[_0xfd19('0x1d')]=_0xf0015[_0xfd19('0x1d')];this[_0xfd19('0x1e')]=_0xf0015[_0xfd19('0x1e')];this[_0xfd19('0x1f')]=_0xf0015['ListId'];this[_0xfd19('0x20')]=_0xf0015[_0xfd19('0x20')];this[_0xfd19('0x21')]=_0xf0015[_0xfd19('0x21')];this[_0xfd19('0x22')]=_0xf0015[_0xfd19('0x22')];this[_0xfd19('0x23')]=_0xf0015['originatecalleridnum']||'';this[_0xfd19('0x24')]=_0xf0015[_0xfd19('0x24')]||'';}module[_0xfd19('0x25')]=History; \ No newline at end of file +var _0x085e=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x2af589,_0x4c2792){var _0x4f91f6=function(_0x247a51){while(--_0x247a51){_0x2af589['push'](_0x2af589['shift']());}};_0x4f91f6(++_0x4c2792);}(_0x085e,0x105));var _0xe085=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x085e[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0xe085('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x13016e,_0x2d09ed){var _0x802898=moment(_0x13016e)[_0xe085('0x1')](0x0);var _0x4729b8=moment(_0x2d09ed)[_0xe085('0x1')](0x0);return _0x802898[_0xe085('0x2')](_0x4729b8,_0xe085('0x3'));}function History(_0x14f8c7){this['uniqueid']=_0x14f8c7[_0xe085('0x4')];this['scheduledat']=_0x14f8c7[_0xe085('0x5')]||undefined;this[_0xe085('0x6')]=_0x14f8c7[_0xe085('0x6')];this[_0xe085('0x7')]=_0x14f8c7[_0xe085('0x6')]==='outbound'?_0xe085('0x8'):_0x14f8c7[_0xe085('0x6')];this[_0xe085('0x9')]=_0x14f8c7[_0xe085('0x9')];this[_0xe085('0xa')]=_0x14f8c7[_0xe085('0xa')];this['countnoanswerretry']=_0x14f8c7[_0xe085('0xb')];this[_0xe085('0xc')]=_0x14f8c7['countbusyretry']+_0x14f8c7['countcongestionretry']+_0x14f8c7[_0xe085('0xb')]+_0x14f8c7[_0xe085('0xd')]+_0x14f8c7['countdropretry']+_0x14f8c7['countabandonedretry']+_0x14f8c7['countmachineretry']+_0x14f8c7[_0xe085('0xe')];this[_0xe085('0xd')]=_0x14f8c7['countnosuchnumberretry'];this[_0xe085('0xf')]=_0x14f8c7[_0xe085('0xf')];this[_0xe085('0x10')]=_0x14f8c7[_0xe085('0x10')];this[_0xe085('0x11')]=_0x14f8c7[_0xe085('0x11')];this['countagentrejectretry']=_0x14f8c7['countagentrejectretry'];this[_0xe085('0x8')]=_0x14f8c7[_0xe085('0x8')];this['calleridname']=_0x14f8c7[_0xe085('0x12')];this[_0xe085('0x13')]=_0x14f8c7[_0xe085('0x14')];this[_0xe085('0x15')]=_0x14f8c7[_0xe085('0x15')];this['responsetime']=_0x14f8c7[_0xe085('0x16')];this['endtime']=_0x14f8c7['responsetime'];this['ringtime']=getSeconds(_0x14f8c7[_0xe085('0x16')],_0x14f8c7[_0xe085('0x15')]);this[_0xe085('0x17')]=0x0;this[_0xe085('0x18')]=0x0;this[_0xe085('0x19')]=_0x14f8c7[_0xe085('0x19')];this[_0xe085('0x1a')]=_0x14f8c7[_0xe085('0x1a')];this['callbackat']=_0x14f8c7[_0xe085('0x1b')];this[_0xe085('0x1c')]=_0x14f8c7['recallme'];this[_0xe085('0x1d')]=_0x14f8c7[_0xe085('0x1d')];this[_0xe085('0x1e')]=_0x14f8c7[_0xe085('0x1e')];this[_0xe085('0x1f')]=_0x14f8c7[_0xe085('0x1f')];this[_0xe085('0x20')]=_0x14f8c7['VoiceQueueId'];this[_0xe085('0x21')]=_0x14f8c7[_0xe085('0x21')];this['originatecalleridnum']=_0x14f8c7[_0xe085('0x22')]||'';this[_0xe085('0x23')]=_0x14f8c7[_0xe085('0x23')]||'';}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 4a83f2b..db04d46 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 _0xf151=['contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialer','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','checkRetriveMax','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','predictive','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','Interval','Intervals','message','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','seconds','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','debug','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','clearZombieChannels','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','type','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','UserId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','[syncHangupInAMD]','MACHINE','state','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','rescheduleContact','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','CampaignId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countabandonedretry','dialGlobalMaxRetry','createStateFinal','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','Abandoned','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','launchHandleIvr','pow','match','actionOriginate','object','originate','phone'];(function(_0x4ecef8,_0x1156d9){var _0x1f8ba8=function(_0x5af300){while(--_0x5af300){_0x4ecef8['push'](_0x4ecef8['shift']());}};_0x1f8ba8(++_0x1156d9);}(_0xf151,0xab));var _0x1f15=function(_0x10b82d,_0x2183e6){_0x10b82d=_0x10b82d-0x0;var _0x509c4c=_0xf151[_0x10b82d];return _0x509c4c;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x1f15('0x0'));var uuid=require(_0x1f15('0x1'));var moment=require(_0x1f15('0x2'));var rr=require('rr');var md5=require(_0x1f15('0x3'));var Redis=require(_0x1f15('0x4'));var ut=require(_0x1f15('0x5'));var config=require(_0x1f15('0x6'));var logger=require(_0x1f15('0x7'))('dialer');var loggerBooked=require(_0x1f15('0x7'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x1f15('0x7'))(_0x1f15('0x8'));var loggerSyncQueueSummary=require(_0x1f15('0x7'))('syncQueueSummary');var ami=require(_0x1f15('0x9'));config[_0x1f15('0xa')]=_['defaults'](config['redis'],{'host':_0x1f15('0xb'),'port':0x18eb});var io=require(_0x1f15('0xc'))(new Redis(config[_0x1f15('0xa')]));var cmHopper=require(_0x1f15('0xd'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0x1f15('0xe'));var cmHopperAdditionalPhone=require(_0x1f15('0xf'));var cmHopperBlack=require(_0x1f15('0x10'));var voiceQueueRt=require(_0x1f15('0x11'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0x1f15('0x12'));var Final=require(_0x1f15('0x13'));var AgentComplete=require(_0x1f15('0x14'));var QueueCallerAbandon=require(_0x1f15('0x15'));var Hangup=require(_0x1f15('0x16'));var ipAgi=process[_0x1f15('0x17')]['XCALLY_IP_AGI']||_0x1f15('0x18');var strategy={'rrmemory':_0x1f15('0x19'),'roundrobin':_0x1f15('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1f15('0x1b')]['enqueue']=function(_0x428133){this['tail']=this[_0x1f15('0x1c')]?this[_0x1f15('0x1c')][_0x1f15('0x1d')](_0x428133):_0x428133();};function Dialer(_0x4ae66f,_0x586a7d){this[_0x1f15('0x1e')]=new Sequence();this[_0x1f15('0x1f')]=_0x586a7d;this[_0x1f15('0x20')]=_0x4ae66f['voiceQueues'];this[_0x1f15('0x21')]=_0x4ae66f['campaigns'];this[_0x1f15('0x22')]=_0x4ae66f[_0x1f15('0x22')];this['trunks']=_0x4ae66f['trunks'];this[_0x1f15('0x23')]=config['maxNumberOriginate']||0x2;this[_0x1f15('0x24')]={};this[_0x1f15('0x25')]={};this[_0x1f15('0x26')]={};this[_0x1f15('0x27')]={};this[_0x1f15('0x28')]={};this[_0x1f15('0x29')]={};this[_0x1f15('0x2a')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x1f15('0x2b')]={};ami['on'](_0x1f15('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0x1f15('0x2d'),this[_0x1f15('0x2e')][_0x1f15('0x2f')](this));ami['on']('originateresponse',this[_0x1f15('0x30')][_0x1f15('0x2f')](this));ami['on'](_0x1f15('0x31'),this[_0x1f15('0x32')][_0x1f15('0x2f')](this));ami['on'](_0x1f15('0x33'),this[_0x1f15('0x34')][_0x1f15('0x2f')](this));ami['on'](_0x1f15('0x35'),this['syncQueueSummaryComplete'][_0x1f15('0x2f')](this));ami['on']('hangup',this[_0x1f15('0x36')][_0x1f15('0x2f')](this));ami['on']('newexten',this[_0x1f15('0x37')][_0x1f15('0x2f')](this));ami['on'](_0x1f15('0x38'),this['syncVarSet'][_0x1f15('0x2f')](this));ami['on'](_0x1f15('0x39'),this[_0x1f15('0x3a')]['bind'](this));ami['on'](_0x1f15('0x3b'),this['syncQueueStatusComplete'][_0x1f15('0x2f')](this));this['loopCampaigns']();this[_0x1f15('0x3c')]();RpcSetting[_0x1f15('0x3d')]()[_0x1f15('0x3e')](function(_0x241d12){previewRecallmeReminderInterval=_0x241d12[_0x1f15('0x3f')];});}function isNotNull(_0x152644){return _0x152644!==null&&!_[_0x1f15('0x40')](_0x152644);}function checkIsLoggedIn(_0x4343e7,_0x5666e4){return function(){if(_0x5666e4<=0x0){_0x4343e7['message']=_0x1f15('0x41');throw _0x4343e7[_0x1f15('0x42')]+_0x1f15('0x43');}};}function isActive(_0x25838e){return _0x25838e;}function checkIsActive(_0xd25545,_0x43a02d){return function(){if(!isActive(_0x43a02d)){_0xd25545['message']=_0x1f15('0x44');throw _0xd25545[_0x1f15('0x42')]+_0x1f15('0x45');}};}function checkInterval(_0x14046a){return function(){if(!isNotNull(_0x14046a['Interval'])){_0x14046a['message']='INTERVAL_IS_NULL';throw _0x14046a['name']+_0x1f15('0x46');}if(!isNotNull(_0x14046a[_0x1f15('0x47')][_0x1f15('0x48')])){_0x14046a[_0x1f15('0x49')]='INTERVAL_IS_NULL';throw _0x14046a[_0x1f15('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x1f15('0x4a')](_0x14046a[_0x1f15('0x47')][_0x1f15('0x48')]))){_0x14046a[_0x1f15('0x49')]=_0x1f15('0x4b');throw _0x14046a[_0x1f15('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x1d2256,_0x24ea8f,_0x5a61a7){return{'action':_0x1d2256,'response':_0x24ea8f,'message':_0x5a61a7,'stack':_0x5a61a7};}function myreject(_0x140326){return function(_0x14dfed){return _0x140326(msgResponse(_0x1f15('0x4c'),'Error',JSON[_0x1f15('0x4d')](_0x14dfed)));};}function getSeconds(_0x24cc03,_0x542a90){var _0x57fb26=moment(_0x24cc03)[_0x1f15('0x4e')](0x0);var _0x42d9ca=moment(_0x542a90)['milliseconds'](0x0);return _0x57fb26[_0x1f15('0x4f')](_0x42d9ca,_0x1f15('0x50'));}function emit(_0x54d39d,_0x440768,_0x3e1c3b){io['to'](_0x54d39d)['emit'](_0x440768,_0x3e1c3b);}function emitVoiceQueueSummary(_0x112b38){if(_0x112b38['type']==='outbound'){var _0x5156fb={'id':_0x112b38['id'],'name':_0x112b38['name'],'strategy':_0x112b38[_0x1f15('0x51')],'answered':_0x112b38[_0x1f15('0x52')],'available':_0x112b38[_0x1f15('0x53')],'loggedIn':_0x112b38[_0x1f15('0x54')],'pTalking':_0x112b38[_0x1f15('0x55')],'sumBillable':_0x112b38['sumBillable'],'sumDuration':_0x112b38['sumDuration'],'sumHoldTime':_0x112b38[_0x1f15('0x56')]||0x0,'talking':_0x112b38['talking'],'total':_0x112b38[_0x1f15('0x57')],'type':_0x112b38['type'],'unmanaged':_0x112b38[_0x1f15('0x58')],'abandoned':_0x112b38[_0x1f15('0x59')],'waiting':_0x112b38[_0x1f15('0x5a')],'loggedInDb':_0x112b38[_0x1f15('0x5b')],'dialActive':_0x112b38['dialActive'],'dialMethod':_0x112b38[_0x1f15('0x5c')],'dialOriginateCallerIdName':_0x112b38[_0x1f15('0x5d')],'dialOriginateCallerIdNumber':_0x112b38[_0x1f15('0x5e')],'dialOriginateTimeout':_0x112b38[_0x1f15('0x5f')],'dialPrefix':_0x112b38['dialPrefix'],'outboundAnswerAgiCallsDay':_0x112b38[_0x1f15('0x60')],'outboundAnswerCallsDay':_0x112b38[_0x1f15('0x61')],'outboundBlacklistCallsDay':_0x112b38['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x112b38[_0x1f15('0x62')],'outboundCongestionCallsDay':_0x112b38['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x112b38[_0x1f15('0x63')],'outboundDropCallsDayCallersExit':_0x112b38[_0x1f15('0x64')],'outboundDropCallsDayTimeout':_0x112b38[_0x1f15('0x65')],'outboundNoAnswerCallsDay':_0x112b38[_0x1f15('0x66')],'outboundNoSuchCallsDay':_0x112b38[_0x1f15('0x67')],'outboundOriginateFailureCallsDay':_0x112b38[_0x1f15('0x68')],'outboundReCallsDay':_0x112b38[_0x1f15('0x69')],'outboundRejectCallsDay':_0x112b38[_0x1f15('0x6a')],'outboundUnknownCallsDay':_0x112b38[_0x1f15('0x6b')],'predictiveIntervalAnsweredCalls':_0x112b38['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x112b38[_0x1f15('0x6c')],'predictiveIntervalAvgTalktime':_0x112b38[_0x1f15('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x112b38['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x112b38[_0x1f15('0x6e')],'predictiveIntervalErlangCalls':_0x112b38[_0x1f15('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x112b38[_0x1f15('0x70')],'predictiveIntervalHitRate':_0x112b38['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x112b38[_0x1f15('0x71')],'predictiveIntervalPauses':_0x112b38[_0x1f15('0x72')],'predictiveIntervalAvailable':_0x112b38['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x112b38[_0x1f15('0x73')],'message':_0x112b38['message'],'originated':_0x112b38[_0x1f15('0x74')],'erlangCalls':_0x112b38[_0x1f15('0x75')],'erlangCallToSecond':_0x112b38[_0x1f15('0x76')],'erlangAbandonmentRate':_0x112b38[_0x1f15('0x77')],'erlangBusyFactor':_0x112b38['erlangBusyFactor'],'startPredictive':_0x112b38[_0x1f15('0x29')],'startProgressive':_0x112b38[_0x1f15('0x2a')]};if(_0x112b38[_0x1f15('0x78')]){_0x5156fb[_0x1f15('0x78')]={'id':_0x112b38[_0x1f15('0x78')]['id'],'name':_0x112b38[_0x1f15('0x78')][_0x1f15('0x42')],'active':_0x112b38[_0x1f15('0x78')][_0x1f15('0x79')],'callerid':_0x112b38['Trunk'][_0x1f15('0x7a')]};}if(_0x112b38[_0x1f15('0x47')]){_0x5156fb['Interval']={'id':_0x112b38[_0x1f15('0x47')]['id'],'name':_0x112b38[_0x1f15('0x47')][_0x1f15('0x42')]};}var _0x48e5d7=md5(JSON[_0x1f15('0x4d')](_0x5156fb));if(_0x112b38['md5']!==_0x48e5d7){_0x112b38[_0x1f15('0x3')]=_0x48e5d7;emit(util[_0x1f15('0x7b')](_0x1f15('0x7c'),_0x5156fb[_0x1f15('0x42')]),_0x1f15('0x7d'),_0x5156fb);}}}function emitCampaignSummary(_0x260e48){if(_0x260e48['type']===_0x1f15('0x7e')){emit(util[_0x1f15('0x7b')](_0x1f15('0x7f'),_0x260e48[_0x1f15('0x42')]),_0x1f15('0x80'),_0x260e48);}}function checkGetDataPredictive(_0xfc9a74){if(isNotNull(_0xfc9a74)&&!_[_0x1f15('0x4a')](_0xfc9a74)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x1f15('0x81')](_0x1f15('0x82'),_0xfc9a74[_0x1f15('0x73')]);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x83'),_0xfc9a74[_0x1f15('0x84')]);loggerPredictive['info'](_0x1f15('0x85'),_0xfc9a74[_0x1f15('0x6e')]);loggerPredictive[_0x1f15('0x81')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfc9a74['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x86'),_0xfc9a74['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x1f15('0x81')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfc9a74['predictiveIntervalAvgTalktime']);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x87'));if(_0xfc9a74[_0x1f15('0x73')]>0x0){if(!_[_0x1f15('0x40')](_0xfc9a74['predictiveIntervalAvgTalktime'])&&_0xfc9a74[_0x1f15('0x6d')]>0x0){return!![];}loggerPredictive[_0x1f15('0x81')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x1f15('0x40')](_0xfc9a74[_0x1f15('0x6c')])&&_0xfc9a74[_0x1f15('0x6c')]>0x0){return!![];}loggerPredictive[_0x1f15('0x81')](_0x1f15('0x88'));}else{loggerPredictive[_0x1f15('0x81')](_0x1f15('0x89'));}}else{loggerPredictive[_0x1f15('0x81')](_0x1f15('0x8a'));}return![];}function mergeDataErlangB(_0x2e0a1b){return function(_0x334db1){loggerPredictive[_0x1f15('0x81')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x1f15('0x8b'),_0x334db1[_0x1f15('0x75')]);loggerPredictive['info'](_0x1f15('0x8c'),_0x334db1[_0x1f15('0x76')]);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x8d'),_0x334db1['erlangAbandonmentRate']);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x8e'),_0x334db1['erlangBusyFactor']);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x8d'),_0x334db1['erlangAbandonmentRate']);loggerPredictive[_0x1f15('0x81')]('---------------------------');_[_0x1f15('0x8f')](_0x2e0a1b,_0x334db1);};}function getDiff(_0x18be0d){var _0xecd6a9=moment()[_0x1f15('0x4e')](0x0);var _0x3a5bd2=moment(_0x18be0d)['milliseconds'](0x0);return _0xecd6a9[_0x1f15('0x4f')](_0x3a5bd2,'seconds');}function ifInterval(_0x4feb6e,_0x39c5df){if(_[_0x1f15('0x40')](_0x39c5df)){return![];}return getDiff(_0x39c5df)<_0x4feb6e*0x3c;}function freeVariablesPredictive(_0x487f62){if(isNotNull(_0x487f62)){if(!_[_0x1f15('0x40')](_0x487f62[_0x1f15('0x2a')])){_0x487f62[_0x1f15('0x2a')]=undefined;loggerPredictive[_0x1f15('0x81')](_0x487f62['name'],_0x1f15('0x90'));}if(!_[_0x1f15('0x40')](_0x487f62[_0x1f15('0x29')])){_0x487f62['startPredictive']=undefined;loggerPredictive[_0x1f15('0x81')](_0x487f62[_0x1f15('0x42')],_0x1f15('0x91'));}if(!_[_0x1f15('0x40')](_0x487f62[_0x1f15('0x92')])){clearInterval(_0x487f62[_0x1f15('0x92')]);_0x487f62[_0x1f15('0x92')]=undefined;loggerPredictive[_0x1f15('0x81')](_0x487f62[_0x1f15('0x42')],_0x1f15('0x93'));}}}function erlangb(_0x1cec38,_0xfd38a6){if(_0xfd38a6===0x0){return 0x0;}var _0x2160db=0x1;for(var _0x5e6497=0x1;_0x5e6497<=_0xfd38a6;_0x5e6497+=0x1){_0x2160db=0x1+_0x2160db*_0x5e6497/_0x1cec38;}return 0x1/_0x2160db;}function isVoiceQueueOutbound(_0x1b81a6){return _0x1b81a6===_0x1f15('0x94');}function isNotPreview(_0x47c179){return _0x47c179!=='preview';}function isCampaignIvr(_0x3243b4){return _0x3243b4===_0x1f15('0x7e');}function getCallerId(_0x1da00a,_0x5a9bc3,_0x243b7d){if(!_[_0x1f15('0x40')](_0x243b7d)&&typeof _0x243b7d==='string'&&!_[_0x1f15('0x4a')](_0x243b7d)){if(!_[_0x1f15('0x40')](_0x5a9bc3)&&typeof _0x5a9bc3===_0x1f15('0x95')&&!_[_0x1f15('0x4a')](_0x5a9bc3)){return util['format']('\x22%s\x22\x20<%s>',_0x5a9bc3,_0x243b7d);}return util[_0x1f15('0x7b')](_0x1f15('0x96'),_0x243b7d,_0x243b7d);}if(!_[_0x1f15('0x40')](_0x1da00a)&&typeof _0x1da00a==='string'&&!_[_0x1f15('0x4a')](_0x1da00a)){return _0x1da00a;}return _0x1f15('0x97');}function loggerCatchQueueSummary(_0x25210a,_0x118398){return function(_0x2ee656){freeVariablesPredictive(_0x118398);emitVoiceQueueSummary(_0x118398);emitCampaignSummary(_0x118398);loggerSyncQueueSummary['debug'](_0x25210a,util['inspect'](_0x2ee656,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5e313f,_0x1b61fb){return function(_0x57e2c4){loggerPredictive[_0x1f15('0x98')](_0x1b61fb[_0x1f15('0x42')],_0x5e313f);loggerPredictive['error'](_0x57e2c4[_0x1f15('0x99')]);freeVariablesPredictive(_0x1b61fb);};}function loggerCatch(_0xab2bc){return function(_0x42db9b){logger[_0x1f15('0x98')](_0xab2bc,util[_0x1f15('0x9a')](_0x42db9b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2eae49){return _0x2eae49&&!_['isUndefined'](_0x2eae49)&&_0x2eae49[_0x1f15('0x9b')]>0x0;}function decremetOriginate(_0x2f407b){if(!_[_0x1f15('0x40')](_0x2f407b)&&_0x2f407b!==null){if(typeof _0x2f407b['originated']!==_0x1f15('0x9c')){if(_0x2f407b[_0x1f15('0x74')]>0x0){_0x2f407b['originated']-=0x1;}else{logger[_0x1f15('0x98')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x1f15('0x9d'));}}function checkContactLowerLimitOriginate(_0x152ea5,_0x4d1000,_0x420a2d){if(_0x4d1000>_0x420a2d){for(var _0x3d2f6e=0x0;_0x3d2f6e<_0x4d1000-_0x420a2d;_0x3d2f6e+=0x1){decremetOriginate(_0x152ea5);}}}function loggerGetContactDialer(_0x96b7e,_0x3e38aa,_0x13bccb){return function(_0x697e01){checkContactLowerLimitOriginate(_0x3e38aa,_0x13bccb,0x0);logger['error'](_0x96b7e,util[_0x1f15('0x9a')](_0x697e01,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2c538d){return function(_0x31eaa7){if(isNotNull(_0x31eaa7)&&isNotNull(_0x31eaa7[0x0])){if(_0x31eaa7[0x0][_0x1f15('0x9e')]>0x0){_0x2c538d['message']='RESCHEDULED_CONTACTS';logger[_0x1f15('0x81')](_0x1f15('0x9f')+_0x2c538d['name'],_0x31eaa7[0x0][_0x1f15('0x9e')],_0x1f15('0xa0'));}else{_0x2c538d[_0x1f15('0x49')]=_0x1f15('0xa1');logger[_0x1f15('0x81')](_0x1f15('0xa2')+_0x2c538d['name']);}}};}function notSendMessagesQueue(_0x4a2b32){if(_0x4a2b32[_0x1f15('0xa3')]){freeVariablesPredictive(_0x4a2b32);if(_0x4a2b32[_0x1f15('0x74')]===0x0&&_0x4a2b32[_0x1f15('0xa4')]===0x0&&_0x4a2b32[_0x1f15('0x5a')]===0x0&&(_0x4a2b32[_0x1f15('0x55')]||0x0)===0x0){_0x4a2b32[_0x1f15('0xa3')]=![];_0x4a2b32[_0x1f15('0x53')]=0x0;_0x4a2b32[_0x1f15('0x49')]=_0x1f15('0x44');loggerSyncQueueSummary['debug'](_0x1f15('0xa5'),_0x4a2b32[_0x1f15('0x42')],_0x1f15('0xa6'));}else{_0x4a2b32[_0x1f15('0x49')]=_0x1f15('0xa7');loggerSyncQueueSummary[_0x1f15('0xa8')](_0x1f15('0xa5'),_0x4a2b32['name'],_0x1f15('0xa9'));}emitVoiceQueueSummary(_0x4a2b32);}}function notSendMessagesCampaign(_0x5efa1c){if(_0x5efa1c[_0x1f15('0xa3')]){if(_0x5efa1c[_0x1f15('0x74')]===0x0){_0x5efa1c[_0x1f15('0xa3')]=![];_0x5efa1c['message']=_0x1f15('0x44');loggerSyncQueueSummary[_0x1f15('0xa8')](_0x1f15('0xaa'),_0x5efa1c[_0x1f15('0x42')],_0x1f15('0xa6'));}else{_0x5efa1c[_0x1f15('0x49')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1f15('0xa8')](_0x1f15('0xaa'),_0x5efa1c[_0x1f15('0x42')],_0x1f15('0xa9'));}emitCampaignSummary(_0x5efa1c);}}function createObjHistory(_0x5e0134,_0x23ddab,_0x4bf091,_0x32df87,_0x1fb321){_0x5e0134[_0x1f15('0x49')]=_0x4bf091;var _0x32fe24=new Action(_0x5e0134,_0x23ddab);var _0x44b38e=new History(_0x32fe24);_0x44b38e['state']=_0x32df87;_0x44b38e['statedesc']=_0x1fb321;_0x44b38e[_0x1f15('0xab')]=_0x32fe24[_0x1f15('0xac')];return _0x44b38e;}Dialer['prototype'][_0x1f15('0x3c')]=function(){var _0x5520ca=this;setInterval(function(){_0x5520ca[_0x1f15('0xad')](_0x5520ca[_0x1f15('0x27')],'[uniqueid]');_0x5520ca['clearZombieChannels'](_0x5520ca[_0x1f15('0x25')],'[actions]');},0x32c8);};Dialer[_0x1f15('0x1b')][_0x1f15('0xad')]=function(_0x560346,_0x50d4b3){var _0x36d545=this;for(var _0x1e0d74 in _0x560346){if(typeof _0x560346[_0x1e0d74]!==_0x1f15('0x9c')){this[_0x1f15('0x1e')][_0x1f15('0xae')](function(){if(!_[_0x1f15('0xaf')](_0x560346[_0x1e0d74])){return ami[_0x1f15('0xb0')]({'action':_0x1f15('0xb1'),'channel':_0x560346[_0x1e0d74][_0x1f15('0xb2')]})[_0x1f15('0xb3')](function(_0x5cfefc){if(_0x5cfefc[_0x1f15('0x49')]===_0x1f15('0xb4')){setTimeout(function(){if(_0x560346[_0x1e0d74]&&_0x560346[_0x1e0d74][_0x1f15('0xb5')]!=='ivr'){_0x36d545['updateOriginated'](_0x36d545['voiceQueues'][_0x560346[_0x1e0d74][_0x1f15('0xb6')]]);logger[_0x1f15('0x98')]('[Dialer][checkChannel]',_0x50d4b3,_0x1e0d74,_0x560346[_0x1e0d74][_0x1f15('0xb6')]);delete _0x560346[_0x1e0d74];}if(_0x560346[_0x1e0d74]&&_0x560346[_0x1e0d74][_0x1f15('0xb5')]==='ivr'){_0x36d545[_0x1f15('0xb7')](_0x36d545['campaigns'][_0x560346[_0x1e0d74][_0x1f15('0xb6')]]);logger[_0x1f15('0x98')](_0x1f15('0xb8'),_0x50d4b3,_0x1e0d74,_0x560346[_0x1e0d74][_0x1f15('0xb6')]);delete _0x560346[_0x1e0d74];}},0x2328);}});}});}}};Dialer['prototype'][_0x1f15('0xb9')]=function(_0x1d4f5a){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopper[_0x1f15('0xb9')](_0x1d4f5a))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xba')));};Dialer['prototype']['checkIsBlackList']=function(_0x3db310){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopperBlack['checkIsBlackList'](_0x3db310))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xbc')));};Dialer[_0x1f15('0x1b')][_0x1f15('0xbd')]=function(_0x132e6b,_0x53345c,_0x568a61){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopperAdditionalPhone[_0x1f15('0xbd')](_0x132e6b,_0x53345c,_0x568a61))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xbe')));};Dialer['prototype']['swapAdditionalPhones']=function(_0x5b9928,_0x345e7c,_0x1c7e24){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5b9928,_0x345e7c,_0x1c7e24))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xbf')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x1c10ed){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopperBlack[_0x1f15('0xc0')](_0x1c10ed))['catch'](loggerCatch(_0x1f15('0xc1')));};Dialer[_0x1f15('0x1b')][_0x1f15('0xc2')]=function(_0x25ad45){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopperHistory[_0x1f15('0xc3')](_0x25ad45))['catch'](loggerCatch(_0x1f15('0xc4')));};Dialer['prototype']['rescheduleContact']=function(_0x1c9020){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopper['rescheduleContact'](_0x1c9020))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xc5')));};Dialer[_0x1f15('0x1b')]['unlockContact']=function(_0x5ba400,_0x4bf971,_0x4e0315){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopper[_0x1f15('0xc6')](_0x5ba400,_0x4bf971,_0x4e0315))[_0x1f15('0xb3')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x1f15('0x1b')]['getContactDialer']=function(_0x31ef3d,_0x4e6ff4,_0xbfb5cf,_0x20c3fa,_0x40ddd9){return BPromise[_0x1f15('0xbb')]()['then'](cmHopper['getContactDialer'](_0x31ef3d,_0x4e6ff4,_0xbfb5cf,_0x20c3fa))[_0x1f15('0xb3')](function(_0x40009d){_0x40ddd9[_0x1f15('0xc7')]-=_0xbfb5cf;_0x40ddd9[_0x1f15('0xc7')]=_0x40ddd9[_0x1f15('0xc7')]>0x0?_0x40ddd9[_0x1f15('0xc7')]:0x0;loggerCatch(_0x1f15('0xc8'))(_0x40009d);});};Dialer['prototype'][_0x1f15('0xc9')]=function(_0x40ace7,_0x16cfc8,_0x585224,_0x2df4e9){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopper[_0x1f15('0xc9')](_0x40ace7,_0x16cfc8,_0x585224))[_0x1f15('0xb3')](function(_0x7d15e9){_0x2df4e9[_0x1f15('0xc7')]-=_0x16cfc8;_0x2df4e9['temp']=_0x2df4e9[_0x1f15('0xc7')]>0x0?_0x2df4e9[_0x1f15('0xc7')]:0x0;loggerCatch(_0x1f15('0xca'))(_0x7d15e9);});};Dialer['prototype'][_0x1f15('0xcb')]=function(_0x5770b1){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5770b1))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xcc')));};Dialer[_0x1f15('0x1b')][_0x1f15('0xcd')]=function(_0x109812){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopper['moveContactManagedDialer'](_0x109812))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xce')));};Dialer[_0x1f15('0x1b')][_0x1f15('0xcf')]=function(_0x36acdf){return BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](cmHopperHistory[_0x1f15('0xcf')](_0x36acdf))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xd0')));};Dialer[_0x1f15('0x1b')]['updateOriginated']=function(_0xf419d2){if(!_[_0x1f15('0x40')](_0xf419d2)&&_0xf419d2!==null){if(typeof _0xf419d2[_0x1f15('0x74')]!=='undefined'){if(_0xf419d2[_0x1f15('0x74')]>0x0){_0xf419d2[_0x1f15('0x74')]-=0x1;}else{logger[_0x1f15('0x98')](_0x1f15('0xd1'));}}}else{logger[_0x1f15('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x57cec5,_0x125e78){var _0x132c7a=this;return function(_0xfba6bf){_0x132c7a[_0x1f15('0xb7')](_0x125e78);logger['error'](_0x57cec5,util[_0x1f15('0x9a')](_0xfba6bf,{'showHidden':![],'depth':null}));};};Dialer[_0x1f15('0x1b')][_0x1f15('0xd2')]=function(_0x259a2f,_0x27f226,_0x54deb0){var _0x453b03={'state':0x19,'statedesc':_0x1f15('0xd3')};this[_0x1f15('0xb7')](_0x27f226);this[_0x1f15('0xd4')](_['merge'](_0x453b03,_[_0x1f15('0xd5')](_0x54deb0,['ContactId','ListId',_0x1f15('0xd6'),'VoiceQueueId','CampaignId'])),_0x1f15('0xd7'),_0x1f15('0xd8'));logger[_0x1f15('0x98')](_0x259a2f);};Dialer[_0x1f15('0x1b')][_0x1f15('0xd9')]=function(_0x198a60){return _0x198a60===_0x1f15('0xda');};Dialer[_0x1f15('0x1b')][_0x1f15('0xdb')]=function(_0x14c427){return!_[_0x1f15('0x40')](_0x14c427)&&_0x14c427&&!_['isUndefined'](_0x14c427[_0x1f15('0x42')])&&!_[_0x1f15('0x40')](_0x14c427['active'])&&_0x14c427[_0x1f15('0x79')]&&(this[_0x1f15('0xdc')][util[_0x1f15('0x7b')](_0x1f15('0xdd'),_0x14c427[_0x1f15('0x42')])]['status']===_0x1f15('0xde')||this[_0x1f15('0xdc')][util['format'](_0x1f15('0xdd'),_0x14c427[_0x1f15('0x42')])]['status']===_0x1f15('0xdf'));};Dialer['prototype'][_0x1f15('0xd4')]=function(_0x309503,_0x2e0185,_0x4b6f41){this[_0x1f15('0xcf')](_0x309503)[_0x1f15('0xb3')](loggerCatch(_0x2e0185));this[_0x1f15('0xcd')](_0x309503)[_0x1f15('0xb3')](loggerCatch(_0x4b6f41));};Dialer[_0x1f15('0x1b')][_0x1f15('0xe0')]=function(_0x289c85){var _0xcb1421=this[_0x1f15('0x27')][_0x289c85[_0x1f15('0xe1')]];var _0x5e143a;if(!_['isNil'](_0x289c85)&&!_[_0x1f15('0xaf')](_0x289c85['variable'])&&!_[_0x1f15('0xaf')](_0x289c85[_0x1f15('0xe2')][_0x1f15('0xe3')])&&_0x289c85[_0x1f15('0xe4')]==='xcally-motion-dialer'&&_0xcb1421){if(_0xcb1421['type']!=='ivr'&&this[_0x1f15('0x20')][_0xcb1421['queue']][_0x1f15('0xe5')]&&_0x289c85[_0x1f15('0xe6')]===_0x1f15('0xe7')){delete this['uniqueId'][_0x289c85[_0x1f15('0xe1')]];this['updateOriginated'](this[_0x1f15('0x20')][_0xcb1421[_0x1f15('0xb6')]]);this[_0x1f15('0x20')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0x61')]+=0x1;this[_0x1f15('0x20')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0x60')]+=0x1;_0x5e143a=new Hangup(_0xcb1421,_0x289c85);_0x5e143a['state']=0x12;_0x5e143a[_0x1f15('0xe8')]=_0x1f15('0xe9');_0x5e143a[_0x1f15('0xea')]=_0x1f15('0xeb');ami[_0x1f15('0xec')](_0x1f15('0xed'),ut[_0x1f15('0xee')](_0x5e143a,'amd'));this['saveInDb'](_0x5e143a,'[syncHangupInAMD][createHistory]',_0x1f15('0xef'));}if(_0xcb1421['type']!=='ivr'&&this[_0x1f15('0x20')][_0xcb1421['queue']]['dialAMDActive']&&_0x289c85['value']===_0x1f15('0xf0')){var _0x345692=this;return new BPromise(function(_0x1644f7,_0x227285){delete _0x345692[_0x1f15('0x27')][_0x289c85[_0x1f15('0xe1')]];_0x345692['updateOriginated'](_0x345692[_0x1f15('0x20')][_0xcb1421['queue']]);_0x345692[_0x1f15('0x20')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0x61')]+=0x1;_0x345692[_0x1f15('0x20')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0x60')]+=0x1;var _0x1a9096=_0x345692['voiceQueues'][_0xcb1421[_0x1f15('0xb6')]];var _0x36f6c8=new Hangup(_0xcb1421,_0x289c85);_0x36f6c8[_0x1f15('0xf1')]=0x13;_0x36f6c8[_0x1f15('0xe8')]=_0x1f15('0xf2');_0x36f6c8['membername']='AMD';_0x36f6c8[_0x1f15('0xf3')]+=0x1;_0x36f6c8[_0x1f15('0xf4')]+=0x1;_0x36f6c8[_0x1f15('0xf5')]=!![];ami['emit'](_0x1f15('0xed'),ut['buildObj'](_0x36f6c8,_0x1f15('0xf5')));_0x345692['createHistory'](_0x36f6c8)[_0x1f15('0xb3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x36f6c8[_0x1f15('0xf6')]+_0x36f6c8[_0x1f15('0xf7')]+_0x36f6c8[_0x1f15('0xf8')]+_0x36f6c8[_0x1f15('0xf9')]+_0x36f6c8[_0x1f15('0xfa')]+_0x36f6c8['countabandonedretry']+_0x36f6c8[_0x1f15('0xf3')]+_0x36f6c8[_0x1f15('0xfb')]>=_0x1a9096['dialGlobalMaxRetry']){_0x345692[_0x1f15('0xfc')](_0x36f6c8,_0x1644f7,_0x227285,_0x1f15('0xfd'));}else{if(_0x36f6c8[_0x1f15('0xf3')]>=_0x1a9096[_0x1f15('0xfe')]){_0x345692['createStateFinal'](_0x36f6c8,_0x1644f7,_0x227285,_0x1f15('0xff'));}else{_0x345692[_0x1f15('0x100')]({'active':![],'countmachineretry':_0x36f6c8[_0x1f15('0xf3')],'scheduledat':moment()[_0x1f15('0x101')](_0x1a9096[_0x1f15('0x102')],_0x1f15('0x103'))['format'](_0x1f15('0x104')),'ContactId':_0x36f6c8['ContactId'],'ListId':_0x36f6c8[_0x1f15('0x105')],'VoiceQueueId':_0x36f6c8[_0x1f15('0x106')]||undefined,'CampaignId':_0x36f6c8[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch('[rescheduleContact][Machine]'));_0x1644f7({'reschedule':0x1});}}});}if(_0xcb1421[_0x1f15('0xb5')]==='ivr'&&this[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0xe5')]&&_0x289c85['value']===_0x1f15('0xe7')){delete this[_0x1f15('0x27')][_0x289c85[_0x1f15('0xe1')]];this['updateOriginated'](this[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]]);_0x5e143a=new Hangup(_0xcb1421,_0x289c85);_0x5e143a[_0x1f15('0xf1')]=0x12;_0x5e143a[_0x1f15('0xe8')]=_0x1f15('0xe9');_0x5e143a[_0x1f15('0xea')]=_0x1f15('0xeb');ami[_0x1f15('0xec')](_0x1f15('0xed'),ut['buildObj'](_0x5e143a,_0x1f15('0xf5')));this[_0x1f15('0xd4')](_0x5e143a,_0x1f15('0x108'),_0x1f15('0x109'));}if(_0xcb1421[_0x1f15('0xb5')]==='ivr'&&this[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0xe5')]&&_0x289c85[_0x1f15('0xe6')]===_0x1f15('0xf0')){var _0x345692=this;return new BPromise(function(_0x5e564c,_0x25f41a){delete _0x345692[_0x1f15('0x27')][_0x289c85['uniqueid']];_0x345692[_0x1f15('0xb7')](_0x345692[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]]);_0x345692['campaigns'][_0xcb1421[_0x1f15('0xb6')]][_0x1f15('0x61')]+=0x1;_0x345692[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4c11b9=_0x345692[_0x1f15('0x21')][_0xcb1421[_0x1f15('0xb6')]];var _0x51f9c1=new Hangup(_0xcb1421,_0x289c85);_0x51f9c1[_0x1f15('0xf1')]=0x13;_0x51f9c1['statedesc']=_0x1f15('0xf2');_0x51f9c1['membername']=_0x1f15('0xeb');_0x51f9c1['countmachineretry']+=0x1;_0x51f9c1['countglobal']+=0x1;_0x51f9c1['amd']=!![];ami[_0x1f15('0xec')](_0x1f15('0xed'),ut[_0x1f15('0xee')](_0x51f9c1,_0x1f15('0xf5')));_0x345692[_0x1f15('0xcf')](_0x51f9c1)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x10a')));if(_0x51f9c1[_0x1f15('0xf6')]+_0x51f9c1['countcongestionretry']+_0x51f9c1[_0x1f15('0xf8')]+_0x51f9c1[_0x1f15('0xf9')]+_0x51f9c1['countdropretry']+_0x51f9c1[_0x1f15('0x10b')]+_0x51f9c1[_0x1f15('0xf3')]+_0x51f9c1[_0x1f15('0xfb')]>=_0x4c11b9[_0x1f15('0x10c')]){_0x345692['stateGlobal'](_0x51f9c1,_0x5e564c,_0x25f41a,_0x1f15('0xfd'));}else{if(_0x51f9c1[_0x1f15('0xf3')]>=_0x4c11b9[_0x1f15('0xfe')]){_0x345692[_0x1f15('0x10d')](_0x51f9c1,_0x5e564c,_0x25f41a,'reason\x2019\x20machine....');}else{_0x345692[_0x1f15('0x100')]({'active':![],'countmachineretry':_0x51f9c1['countmachineretry'],'scheduledat':moment()['add'](_0x4c11b9[_0x1f15('0x102')],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x51f9c1[_0x1f15('0x10e')],'ListId':_0x51f9c1['ListId'],'VoiceQueueId':_0x51f9c1[_0x1f15('0x106')]||undefined,'CampaignId':_0x51f9c1[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch('[rescheduleContact][Machine]'));_0x5e564c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1f15('0x36')]=function(_0x2802e1){var _0x5e6bfb=this[_0x1f15('0x27')][_0x2802e1[_0x1f15('0xe1')]];var _0x154bb1=this;var _0x447c49;if(_0x5e6bfb&&_0x5e6bfb[_0x1f15('0xb5')]===_0x1f15('0x7e')){delete this['uniqueId'][_0x2802e1['uniqueid']];this['updateOriginated'](this['campaigns'][_0x5e6bfb[_0x1f15('0xb6')]]);this[_0x1f15('0x21')][_0x5e6bfb[_0x1f15('0xb6')]][_0x1f15('0x10f')]+=0x1;_0x447c49=new Hangup(_0x5e6bfb,_0x2802e1);this[_0x1f15('0xcf')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x110')));this[_0x1f15('0xcd')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x111')));}if(_0x5e6bfb&&_0x5e6bfb[_0x1f15('0xb5')]!=='ivr'&&isNotNull(this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]][_0x1f15('0x112')])){delete this['uniqueId'][_0x2802e1['uniqueid']];this[_0x1f15('0xb7')](this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]]);this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]]['outboundAnswerCallsDay']+=0x1;this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]][_0x1f15('0x60')]+=0x1;_0x447c49=new Hangup(_0x5e6bfb,_0x2802e1);_0x447c49[_0x1f15('0xf1')]=0x10;_0x447c49[_0x1f15('0xe8')]=_0x1f15('0x113');_0x447c49['membername']=_0x1f15('0x114');this[_0x1f15('0xcf')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x110')));this[_0x1f15('0xcd')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x111')));}if(_0x5e6bfb&&_0x5e6bfb[_0x1f15('0xb5')]!=='ivr'&&!isNotNull(this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]][_0x1f15('0x112')])){delete this['uniqueId'][_0x2802e1['uniqueid']];this[_0x1f15('0xb7')](this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]]);this[_0x1f15('0x20')][_0x5e6bfb[_0x1f15('0xb6')]]['outboundUnknownCallsDay']+=0x1;_0x447c49=new Hangup(_0x5e6bfb,_0x2802e1);_0x447c49[_0x1f15('0xf1')]=0xc;_0x447c49[_0x1f15('0xe8')]=_0x2802e1['cause-txt'];_0x447c49[_0x1f15('0xea')]=_0x1f15('0x115');this[_0x1f15('0xcf')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x110')));this[_0x1f15('0xcd')](_0x447c49)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x111')));}};Dialer[_0x1f15('0x1b')][_0x1f15('0x32')]=function(_0x1b9846){var _0x1e4c2b=this[_0x1f15('0x27')][_0x1b9846[_0x1f15('0xe1')]];var _0x407840=this;if(this[_0x1f15('0x20')][_0x1b9846[_0x1f15('0xb6')]]){if(_0x1e4c2b&&_0x1e4c2b[_0x1f15('0xb5')]!=='ivr'){delete this['uniqueId'][_0x1b9846[_0x1f15('0xe1')]];this[_0x1f15('0x20')][_0x1b9846[_0x1f15('0xb6')]][_0x1f15('0x61')]+=0x1;var _0x3f57da=new AgentComplete(_0x1e4c2b,_0x1b9846);if(_0x1b9846[_0x1f15('0x116')]==='agent'){_0x3f57da[_0x1f15('0x117')]=this[_0x1f15('0x20')][_0x1b9846['queue']][_0x1f15('0x118')]&&this[_0x1f15('0x20')][_0x1b9846[_0x1f15('0xb6')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x1f15('0x104')):undefined;}this[_0x1f15('0xcf')](_0x3f57da)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x119')));this['moveContactManagedDialer'](_0x3f57da)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x11a')));}}};Dialer['prototype'][_0x1f15('0x11b')]=function(_0x4db2d1){if(this[_0x1f15('0x20')][_0x4db2d1[_0x1f15('0xb6')]]){if(this[_0x1f15('0x27')][_0x4db2d1[_0x1f15('0xe1')]]&&this[_0x1f15('0x27')][_0x4db2d1[_0x1f15('0xe1')]][_0x1f15('0xb5')]!==_0x1f15('0x7e')){this['updateOriginated'](this[_0x1f15('0x20')][_0x4db2d1[_0x1f15('0xb6')]]);this[_0x1f15('0x27')][_0x4db2d1[_0x1f15('0xe1')]][_0x1f15('0x11c')]=moment()[_0x1f15('0x7b')](_0x1f15('0x104'));}}};Dialer['prototype'][_0x1f15('0x11d')]=function(_0x39156e,_0x4b8c95){this[_0x1f15('0xcf')](_0x39156e)[_0x1f15('0xb3')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x4b8c95==0x0){this[_0x1f15('0xcd')](_0x39156e)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x11e')));}};Dialer[_0x1f15('0x1b')][_0x1f15('0x2e')]=function(_0x361e7c){var _0x2d2b9e=this[_0x1f15('0x27')][_0x361e7c[_0x1f15('0xe1')]];var _0x1e2165=this;var _0x1b89ca=![];var _0x27cb40;var _0x5d2e31;if(this['voiceQueues'][_0x361e7c[_0x1f15('0xb6')]]){if(_0x2d2b9e&&_0x2d2b9e[_0x1f15('0xb5')]!=='ivr'){delete this[_0x1f15('0x27')][_0x361e7c[_0x1f15('0xe1')]];this[_0x1f15('0xb7')](this['voiceQueues'][_0x361e7c['queue']]);_0x2d2b9e[_0x1f15('0x11f')]=moment()[_0x1f15('0x7b')](_0x1f15('0x104'));var _0x5cf3e1=new QueueCallerAbandon(_0x2d2b9e,_0x361e7c);if(getSeconds(_0x2d2b9e[_0x1f15('0x11f')],_0x2d2b9e[_0x1f15('0x120')])>=_0x2d2b9e[_0x1f15('0x121')]){this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x361e7c['queue']][_0x1f15('0x65')]+=0x1;this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5cf3e1[_0x1f15('0xf1')]=0xa;_0x5cf3e1['statedesc']=_0x1f15('0x122');_0x5cf3e1[_0x1f15('0x123')]=_0x1f15('0x124');_0x5cf3e1['agiafterat']=this[_0x1f15('0x20')][_0x361e7c['queue']]['dialQueueProject2']?moment()[_0x1f15('0x7b')](_0x1f15('0x104')):undefined;_0x5cf3e1[_0x1f15('0xfa')]+=0x1;_0x5cf3e1[_0x1f15('0xf4')]+=0x1;_0x27cb40=this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]][_0x1f15('0x125')];_0x5d2e31=this[_0x1f15('0x20')][_0x361e7c['queue']][_0x1f15('0x126')];_0x1e2165['verifyAdditionalPhones'](_0x5cf3e1,_0x5cf3e1[_0x1f15('0xf1')],_0x2d2b9e[_0x1f15('0x127')])[_0x1f15('0x3e')](function(_0x3892fe){_0x1b89ca=_0x3892fe[_0x1f15('0x128')]==0x1;if(_0x5cf3e1[_0x1f15('0xfa')]>=_0x1e2165[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]][_0x1f15('0x129')]){_0x1e2165[_0x1f15('0x11d')](_0x5cf3e1,_0x3892fe[_0x1f15('0x128')]);}else{_0x1e2165[_0x1f15('0x100')]({'active':![],'countdropretry':_0x5cf3e1[_0x1f15('0xfa')],'scheduledat':moment()['add'](_0x1e2165[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]]['dialDropRetryFrequency'],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x2d2b9e[_0x1f15('0x10e')],'ListId':_0x2d2b9e['ListId'],'VoiceQueueId':_0x2d2b9e['VoiceQueueId']||undefined,'CampaignId':_0x2d2b9e[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x12a')));var _0x20f515=new History(_0x5cf3e1);_0x20f515[_0x1f15('0xf1')]=0xa;_0x20f515[_0x1f15('0xe8')]='Drop';_0x20f515[_0x1f15('0xac')]=moment()[_0x1f15('0x7b')](_0x1f15('0x104'));_0x20f515[_0x1f15('0xab')]=_0x20f515[_0x1f15('0xac')];_0x20f515[_0x1f15('0x12b')]=_0x5cf3e1['calleridname'];_0x20f515['calleridnum']=_0x5cf3e1[_0x1f15('0x12c')];_0x1e2165[_0x1f15('0xcf')](_0x20f515)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x12d')));}})[_0x1f15('0x3e')](function(_0x212022){if(_0x1b89ca)_0x1e2165[_0x1f15('0x12e')](_0x5cf3e1,_0x27cb40,_0x5d2e31)['then'](function(_0x15574d){return 0x1;});});}else{this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]][_0x1f15('0x12f')]+=0x1;this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5cf3e1['state']=0xb;_0x5cf3e1[_0x1f15('0xe8')]=_0x1f15('0x130');_0x5cf3e1['dropreason']='CALLEREXIT';_0x5cf3e1[_0x1f15('0x10b')]+=0x1;_0x5cf3e1[_0x1f15('0xf4')]+=0x1;_0x27cb40=this[_0x1f15('0x20')][_0x361e7c['queue']][_0x1f15('0x131')];_0x5d2e31=this[_0x1f15('0x20')][_0x361e7c[_0x1f15('0xb6')]][_0x1f15('0x126')];_0x1e2165['verifyAdditionalPhones'](_0x5cf3e1,_0x5cf3e1['state'],_0x2d2b9e[_0x1f15('0x127')])[_0x1f15('0x3e')](function(_0x2e4859){if(_0x5cf3e1[_0x1f15('0x10b')]>=_0x1e2165['voiceQueues'][_0x361e7c[_0x1f15('0xb6')]][_0x1f15('0x132')]){_0x1e2165[_0x1f15('0x11d')](_0x5cf3e1,_0x2e4859[_0x1f15('0x128')]);}else{_0x1e2165[_0x1f15('0x100')]({'active':![],'countabandonedretry':_0x5cf3e1[_0x1f15('0x10b')],'scheduledat':moment()['add'](_0x1e2165['voiceQueues'][_0x361e7c[_0x1f15('0xb6')]]['dialAbandonedRetryFrequency'],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x2d2b9e[_0x1f15('0x10e')],'ListId':_0x2d2b9e[_0x1f15('0x105')],'VoiceQueueId':_0x2d2b9e[_0x1f15('0x106')]||undefined,'CampaignId':_0x2d2b9e[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x133')));var _0x7453df=new History(_0x5cf3e1);_0x7453df[_0x1f15('0xf1')]=0xb;_0x7453df[_0x1f15('0xe8')]=_0x1f15('0x130');_0x7453df[_0x1f15('0xac')]=moment()[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x7453df[_0x1f15('0xab')]=_0x7453df[_0x1f15('0xac')];_0x7453df['calleridname']=_0x5cf3e1[_0x1f15('0x12b')];_0x7453df[_0x1f15('0x12c')]=_0x5cf3e1[_0x1f15('0x12c')];_0x1e2165[_0x1f15('0xcf')](_0x7453df)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x134')));}})[_0x1f15('0x3e')](function(_0x5709cf){if(_0x1b89ca)_0x1e2165[_0x1f15('0x12e')](_0x5cf3e1,_0x27cb40,_0x5d2e31)[_0x1f15('0x3e')](function(_0x386c27){return 0x1;});});}}}};Dialer[_0x1f15('0x1b')][_0x1f15('0x37')]=function(_0x2ceebb){if(this[_0x1f15('0x25')][_0x2ceebb[_0x1f15('0xe1')]]){this['actions'][_0x2ceebb[_0x1f15('0xe1')]]['channel']=_0x2ceebb[_0x1f15('0xb2')];}if(this[_0x1f15('0x27')][_0x2ceebb['uniqueid']]){this[_0x1f15('0x27')][_0x2ceebb[_0x1f15('0xe1')]][_0x1f15('0xb2')]=_0x2ceebb['channel'];}};Dialer[_0x1f15('0x1b')][_0x1f15('0x3a')]=function(_0x389b61){if(strategy[this[_0x1f15('0x20')][this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]]['queue']]['strategy']]===_0x1f15('0x1a')){if(this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]]&&_[_0x1f15('0xaf')](this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]][_0x1f15('0x136')])&&_0x389b61[_0x1f15('0xb1')]==='1'&&_0x389b61[_0x1f15('0x137')]==='0'){if(this[_0x1f15('0x22')][_0x389b61[_0x1f15('0x138')]]){if(!this[_0x1f15('0x22')][_0x389b61[_0x1f15('0x138')]][_0x1f15('0x136')]){this[_0x1f15('0x22')][_0x389b61[_0x1f15('0x138')]][_0x1f15('0x136')]=!![];this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]]['locked']=!![];this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]][_0x1f15('0x138')]=_0x389b61[_0x1f15('0x138')];}}}}else if((strategy[this[_0x1f15('0x20')][this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]][_0x1f15('0xb6')]][_0x1f15('0x51')]]||_0x1f15('0x19'))===_0x1f15('0x19')){if(this['actions'][_0x389b61[_0x1f15('0x135')]]){if(this[_0x1f15('0x22')][_0x389b61[_0x1f15('0x138')]]){this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]][_0x1f15('0x138')]=_0x389b61[_0x1f15('0x138')];if(_[_0x1f15('0xaf')](this[_0x1f15('0x139')][this['actions'][_0x389b61[_0x1f15('0x135')]]['queue']])){this['queueBooked'][this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]][_0x1f15('0xb6')]]=[];}this['queueBooked'][this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]]['queue']][_0x1f15('0x13a')](_['merge'](_[_0x1f15('0xd5')](this[_0x1f15('0x25')][_0x389b61[_0x1f15('0x135')]],[_0x1f15('0x13b'),_0x1f15('0x138')]),{'status':_0x389b61[_0x1f15('0xb1')],'paused':_0x389b61[_0x1f15('0x137')]}));}}}};function unlockQueueStatus(_0x3f2d75,_0x3bbe63){setTimeout(function(){if(_[_0x1f15('0x40')](_0x3f2d75[_0x1f15('0x13c')])){loggerBooked[_0x1f15('0x98')](_0x1f15('0x13d'),_0x3bbe63);}_0x3f2d75[_0x1f15('0x13c')]=!![];loggerBooked[_0x1f15('0x81')](_0x1f15('0x13e'),_0x3bbe63,JSON[_0x1f15('0x4d')](_[_0x1f15('0xd5')](_0x3f2d75,[_0x1f15('0x42'),_0x1f15('0x13c')])));},0x1f3);}Dialer['prototype'][_0x1f15('0x13f')]=function(_0xf39f20){var _0x2e3949=this;var _0x43b97f=_0x2e3949['voiceQueues'][_0x2e3949[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]]['queue']];if(strategy[this[_0x1f15('0x20')][this[_0x1f15('0x25')][_0xf39f20['actionid']]['queue']][_0x1f15('0x51')]]===_0x1f15('0x1a')){if(this[_0x1f15('0x25')][_0xf39f20['actionid']]&&this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0x138')]){this['preview'][_0x1f15('0x140')](this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0x13b')],this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0x138')])[_0x1f15('0xb3')](function(_0x50337c){logger[_0x1f15('0x98')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x1f15('0x9a')](_0x50337c,{'showHidden':![],'depth':null}));})[_0x1f15('0x1d')](function(){_0x2e3949['updateOriginated'](_0x2e3949[_0x1f15('0x20')][_0x2e3949[_0x1f15('0x25')][_0xf39f20['actionid']][_0x1f15('0xb6')]]);_0x2e3949[_0x1f15('0x22')][_0x2e3949[_0x1f15('0x25')][_0xf39f20['actionid']][_0x1f15('0x138')]]['locked']=![];delete _0x2e3949[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]];unlockQueueStatus(_0x43b97f);});}else{this['updateOriginated'](this[_0x1f15('0x20')][this['actions'][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0xb6')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x1f15('0x25')][_0xf39f20['actionid']]['ContactId'],'ListId':this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0x105')],'VoiceQueueId':this[_0x1f15('0x25')][_0xf39f20['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x141')));delete this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]];unlockQueueStatus(_0x43b97f);}}else if((strategy[this[_0x1f15('0x20')][this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0xb6')]][_0x1f15('0x51')]]||_0x1f15('0x19'))==='rrmemory'){var _0x20c296;if(this['actions'][_0xf39f20[_0x1f15('0x135')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0xb6')]])){if(this[_0x1f15('0x2b')][_0x2e3949['actions'][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0xb6')]]){this[_0x1f15('0x2b')][_0x2e3949[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]]['queue']]=this[_0x1f15('0x2b')][this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]]['queue']]?this[_0x1f15('0x2b')][this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]]['queue']]:this['queueBooked'][this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]]['queue']]?this['queueBooked'][this['actions'][_0xf39f20['actionid']][_0x1f15('0xb6')]][_0x1f15('0x142')]||0x0:0x0;}this[_0x1f15('0x139')][this[_0x1f15('0x25')][_0xf39f20[_0x1f15('0x135')]][_0x1f15('0xb6')]][_0x1f15('0x142')]=this['queueBookedRR'][this[_0x1f15('0x25')][_0xf39f20['actionid']]['queue']];for(var _0x49128b=0x0;_0x49128b=0x0;})[_0x1f15('0xb3')](myreject(_0x5ccb5b)));}}else{_0xeff69[_0x1f15('0x13a')](ami[_0x1f15('0xb0')]({'action':'command','command':util[_0x1f15('0x7b')](_0x1f15('0x160'),_0x38d934,!_[_0x1f15('0x40')](config[_0x1f15('0x15b')][_0x5db3cf])?_0x5db3cf:'')})[_0x1f15('0x3e')](function(_0x4e48c5){return _0x4e48c5[_0x1f15('0x161')][_0x1f15('0x162')]('true')>=0x0;})[_0x1f15('0xb3')](myreject(_0x5ccb5b)));}BPromise[_0x1f15('0x164')](_0xeff69)[_0x1f15('0x3e')](function(_0x172d1b){var _0x41cf99=_[_0x1f15('0x165')](_0x172d1b);if(_0x41cf99){return _0x326c22(_0x41cf99);}else{_0x5d05b2[_0x1f15('0x49')]=_0x42906c?_0x1f15('0x166'):_0x1f15('0x167');return _0x5ccb5b(msgResponse(_0x1f15('0x168'),'Failure','Global:\x20'+_0x42906c+'\x20'+_0x18c1f8+'\x20Interval\x20is\x20overtime:\x20'+util[_0x1f15('0x9a')](_0x38d934,{'showHidden':![],'depth':null})+_0x1f15('0x169')+_0x5db3cf));}})[_0x1f15('0xb3')](function(_0x1fda04){return _0x5ccb5b(msgResponse(_0x1f15('0x155'),_0x1f15('0x159'),JSON[_0x1f15('0x4d')](_0x1fda04)));});});};Dialer[_0x1f15('0x1b')][_0x1f15('0x16a')]=function(_0x4ea398){var _0x3d1b00=this;return function(){switch(_0x4ea398[_0x1f15('0x5c')]){case _0x1f15('0x16b'):freeVariablesPredictive(_0x4ea398);_0x3d1b00[_0x1f15('0x16c')](_0x4ea398,0x1);break;case _0x1f15('0x16d'):freeVariablesPredictive(_0x4ea398);_0x3d1b00[_0x1f15('0x16c')](_0x4ea398,_0x4ea398['dialPowerLevel']);break;case'predictive':_0x3d1b00['predictive'](_0x4ea398);break;case _0x1f15('0x16e'):freeVariablesPredictive(_0x4ea398);_0x3d1b00[_0x1f15('0x16c')](_0x4ea398,0x1);break;default:freeVariablesPredictive(_0x4ea398);logger['error'](_0x1f15('0x16f'),_0x4ea398[_0x1f15('0x42')],_0x1f15('0x170'));}};};Dialer[_0x1f15('0x1b')]['launchHandleIvr']=function(_0xcb4049){var _0x2c502f=this;return function(){_0x2c502f[_0x1f15('0x171')](_0xcb4049);};};Dialer['prototype'][_0x1f15('0x34')]=function(_0x29b979){var _0x1e4375=this;if(isNotPreview(_0x29b979[_0x1f15('0x5c')])){if(isVoiceQueueOutbound(_0x29b979[_0x1f15('0xb5')])&&isActive(_0x29b979['dialActive'])){_0x29b979[_0x1f15('0xa3')]=!![];BPromise[_0x1f15('0xbb')]()[_0x1f15('0x3e')](checkIsLoggedIn(_0x29b979,_0x29b979[_0x1f15('0x54')]))[_0x1f15('0x3e')](checkIsActive(_0x29b979,_0x29b979[_0x1f15('0x172')]))[_0x1f15('0x3e')](checkInterval(_0x29b979))[_0x1f15('0x3e')](_0x1e4375[_0x1f15('0x150')](_0x29b979))['then'](_0x1e4375[_0x1f15('0x154')](_0x29b979[_0x1f15('0x173')],_0x29b979[_0x1f15('0x174')],_0x29b979[_0x1f15('0x42')],_0x29b979))['then'](_0x1e4375[_0x1f15('0x156')](_0x29b979[_0x1f15('0x47')],_0x29b979[_0x1f15('0x174')],_0x29b979[_0x1f15('0x42')],_0x29b979))['then'](_0x1e4375[_0x1f15('0x16a')](_0x29b979))['catch'](loggerCatchQueueSummary(_0x1f15('0x175'),_0x29b979));}else{notSendMessagesQueue(_0x29b979);}}else{freeVariablesPredictive(_0x29b979);}};Dialer[_0x1f15('0x1b')][_0x1f15('0x176')]=_[_0x1f15('0x177')](function(){var _0x47bb97=_[_0x1f15('0x178')](this[_0x1f15('0x20')],function(_0x54c386){return _0x54c386[_0x1f15('0x179')];});var _0x9cd405=_[_0x1f15('0x178')](this[_0x1f15('0x22')],function(_0x4dcbb8){return _0x4dcbb8[_0x1f15('0x17a')]&&_0x4dcbb8[_0x1f15('0xb1')]===_0x1f15('0xde');});if(_0x47bb97[_0x1f15('0x9b')]>0x0&&_0x9cd405[_0x1f15('0x9b')]>0x0){return BPromise['resolve']()[_0x1f15('0x3e')](cmHopper[_0x1f15('0x17b')](_[_0x1f15('0x17c')](_0x47bb97,'id'),previewRecallmeReminderInterval,_[_0x1f15('0x17c')](_0x9cd405,'id')))[_0x1f15('0x3e')](function(_0xa60c1d){for(var _0x1fb991=0x0;_0x1fb991<_0xa60c1d[_0x1f15('0x9b')];_0x1fb991++){var _0x2efe53=_0xa60c1d[_0x1fb991][_0x1f15('0x17d')][_0x1f15('0x42')];if(_0x2efe53)io['to'](util[_0x1f15('0x7b')](_0x1f15('0x17e'),_0x2efe53))[_0x1f15('0xec')](_0x1f15('0x17f'),{'hopper':_0xa60c1d[_0x1fb991]});}})[_0x1f15('0xb3')](function(_0x25d244){logger[_0x1f15('0x98')](_0x1f15('0x180'),_0x25d244);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1f15('0x1b')]['syncCampaigns']=function(){var _0x48646e=this;var _0x22ab07;for(var _0x5d724 in this[_0x1f15('0x21')]){if(typeof this['campaigns'][_0x5d724]!=='undefined'){_0x22ab07=this['campaigns'][_0x5d724];if(isCampaignIvr(_0x22ab07[_0x1f15('0xb5')])&&isActive(_0x22ab07['active'])){_0x22ab07[_0x1f15('0xa3')]=!![];BPromise['resolve']()[_0x1f15('0x3e')](checkIsActive(_0x22ab07,_0x22ab07[_0x1f15('0x79')]))['then'](checkInterval(_0x22ab07))[_0x1f15('0x3e')](_0x48646e[_0x1f15('0x150')](_0x22ab07))[_0x1f15('0x3e')](_0x48646e['checkIfTime'](_0x22ab07['dialGlobalInterval'],_0x22ab07[_0x1f15('0x174')],_0x22ab07['name'],_0x22ab07))[_0x1f15('0x3e')](_0x48646e['checkIfTimeIntervals'](_0x22ab07[_0x1f15('0x47')],_0x22ab07[_0x1f15('0x174')],_0x22ab07['name'],_0x22ab07))['then'](_0x48646e[_0x1f15('0x181')](_0x22ab07))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x22ab07));}else{notSendMessagesCampaign(_0x22ab07);}}}};function getCallerIdRandom(_0x4e1383,_0x56624a){var _0x38148a;var _0x13e1ff;var _0xa69205;if(_0x56624a<=0x0){_0x56624a=0x1;}_0x38148a=new RegExp('\x5cw{0,'+_0x56624a+'}$');_0x13e1ff=Math[_0x1f15('0x182')](0xa,_0x56624a-0x1);_0xa69205=Math['pow'](0xa,_0x56624a)-0x1;return util[_0x1f15('0x7b')]('%s',_['replace'](_0x4e1383,_0x38148a,_['random'](_0x13e1ff,_0xa69205)));}function extractCalleridName(_0x8f207c){var _0xd42fb=_0x8f207c['match'](/"(.*?)"/);return _0xd42fb?_0xd42fb[0x1]:_0x8f207c;}function extractCalleridNumber(_0x2b3e7e){var _0x35ccc5=_0x2b3e7e[_0x1f15('0x183')](/<(.*?)>/);return _0x35ccc5?_0x35ccc5[0x1]:_0x2b3e7e;}Dialer[_0x1f15('0x1b')][_0x1f15('0x184')]=function(_0x2bb3da,_0x4aa479){var _0x1be450=this;var _0x1efc9c=uuid['v4']();this[_0x1f15('0x25')][_0x1efc9c]=new Action(_0x2bb3da,_0x4aa479,_0x1efc9c);return new BPromise(function(_0x55f420,_0x197b7c){if(_['isUndefined'](_0x2bb3da)&&typeof _0x2bb3da!==_0x1f15('0x185')){return _0x197b7c(msgResponse(_0x1f15('0x186'),_0x1f15('0x159'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1f15('0x40')](_0x4aa479[_0x1f15('0x187')])||_0x4aa479[_0x1f15('0x187')]===null){return _0x197b7c(msgResponse('originate',_0x1f15('0x159'),_0x1f15('0x188')));}var _0x376444={'XMD-CALLERID':_0x1be450['actions'][_0x1efc9c][_0x1f15('0x189')](),'XMD-AGI':_0x2bb3da['dialQueueProject']?util[_0x1f15('0x7b')](_0x1f15('0x18a'),ipAgi,_0x2bb3da[_0x1f15('0x112')]):_0x1f15('0x18b'),'XMD-AGIAFTER':_0x2bb3da[_0x1f15('0x118')]?util[_0x1f15('0x7b')](_0x1f15('0x18a'),ipAgi,_0x2bb3da['dialQueueProject2']):'NONE','XMD-QUEUE':_0x2bb3da['type']===_0x1f15('0x94')?util['format'](_0x1f15('0x18c'),_0x2bb3da['name'],_0x2bb3da['dialQueueOptions']||'',_0x2bb3da[_0x1f15('0x18d')]?'c':'',_0x2bb3da['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x4aa479[_0x1f15('0x10e')],'XMD-CDRTYPE':_0x1f15('0x18e'),'CALLERID(all)':_0x1be450[_0x1f15('0x25')][_0x1efc9c][_0x1f15('0x189')](),'XMD-AMD':_0x2bb3da[_0x1f15('0xe5')]?_0x1f15('0x18f'):_0x1f15('0x18b'),'XMD-DESTINATION':_0x1f15('0x190')};if(_0x2bb3da['dialAMDActive']){_0x376444[_0x1f15('0x191')]=_0x2bb3da['dialAMDInitialSilence']||0x9c4;_0x376444[_0x1f15('0x192')]=_0x2bb3da[_0x1f15('0x193')]||0x5dc;_0x376444[_0x1f15('0x194')]=_0x2bb3da['dialAMDAfterGreetingSilence']||0x320;_0x376444[_0x1f15('0x195')]=_0x2bb3da[_0x1f15('0x196')]||0x1388;_0x376444[_0x1f15('0x197')]=_0x2bb3da[_0x1f15('0x198')]||0x64;_0x376444[_0x1f15('0x199')]=_0x2bb3da[_0x1f15('0x19a')]||0x32;_0x376444['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2bb3da['dialAMDMaximumNumberOfWords']||0x3;_0x376444[_0x1f15('0x19b')]=_0x2bb3da[_0x1f15('0x19c')]||0x100;_0x376444[_0x1f15('0x19d')]=_0x2bb3da['dialAMDMaximumWordLength']||0x1388;}if(_0x2bb3da['type']==='outbound'){_0x376444[_0x1f15('0x19e')]=_0x4aa479['VoiceQueueId'];}else{_0x376444[_0x1f15('0x19f')]=_0x4aa479['CampaignId'];}for(var _0x446ee8 in _0x4aa479[_0x1f15('0x1a0')]){if(typeof _0x4aa479[_0x1f15('0x1a0')][_0x446ee8]!==_0x1f15('0x9c')){if(isNotNull(_0x4aa479['Contact'][_0x446ee8])&&_0x446ee8!=='id'&&_0x446ee8!=='tags'&&_0x446ee8!=='createdAt'&&_0x446ee8!==_0x1f15('0x1a1')){_0x376444[util['format']('%s%s',_0x1f15('0x1a2'),_[_0x1f15('0x1a3')](_0x446ee8))]=_0x4aa479[_0x1f15('0x1a0')][_0x446ee8];}}}var _0x4cd811=_0x1be450[_0x1f15('0xdb')](_0x2bb3da['Trunk'])?getCallerId(_0x2bb3da[_0x1f15('0x78')][_0x1f15('0x7a')],_0x2bb3da[_0x1f15('0x5d')],_0x2bb3da['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2bb3da[_0x1f15('0x5e')],_0x2bb3da[_0x1f15('0x1a4')]):_0x2bb3da[_0x1f15('0x5e')]):getCallerId(_[_0x1f15('0xaf')](_0x2bb3da[_0x1f15('0x151')])?_0x2bb3da[_0x1f15('0x78')][_0x1f15('0x7a')]:_0x2bb3da[_0x1f15('0x151')][_0x1f15('0x7a')],_0x2bb3da['dialOriginateCallerIdName'],_0x2bb3da['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2bb3da['dialOriginateCallerIdNumber'],_0x2bb3da[_0x1f15('0x1a4')]):_0x2bb3da['dialOriginateCallerIdNumber']);if(_0x4cd811){_0x376444[_0x1f15('0x1a5')]=_0x1be450['actions'][_0x1efc9c]['originatecalleridname']=extractCalleridName(_0x4cd811);_0x376444[_0x1f15('0x1a6')]=_0x4aa479['phone'];}return ami['Action']({'actionid':_0x1efc9c,'action':_0x1f15('0x186'),'channel':_0x1be450[_0x1f15('0xdb')](_0x2bb3da[_0x1f15('0x78')])?util[_0x1f15('0x7b')](_0x1f15('0x1a7'),_0x2bb3da[_0x1f15('0x78')][_0x1f15('0x42')],isNotNull(_0x2bb3da[_0x1f15('0x1a8')])?_0x2bb3da[_0x1f15('0x1a8')][_0x1f15('0x1a9')]()||'':'',_0x2bb3da[_0x1f15('0x1aa')]>0x0?_0x4aa479[_0x1f15('0x187')][_0x1f15('0x1ab')](_0x2bb3da['dialCutDigit']):_0x4aa479[_0x1f15('0x187')]):util[_0x1f15('0x7b')]('SIP/%s/%s%s',_[_0x1f15('0xaf')](_0x2bb3da[_0x1f15('0x151')])?_0x2bb3da[_0x1f15('0x78')][_0x1f15('0x42')]:_0x2bb3da['TrunkBackup'][_0x1f15('0x42')],isNotNull(_0x2bb3da['dialPrefix'])?_0x2bb3da[_0x1f15('0x1a8')][_0x1f15('0x1a9')]()||'':'',_0x2bb3da['dialCutDigit']>0x0?_0x4aa479[_0x1f15('0x187')]['substring'](_0x2bb3da[_0x1f15('0x1aa')]):_0x4aa479[_0x1f15('0x187')]),'callerid':_0x4cd811,'Exten':_0x1f15('0x190'),'Context':'from-sip','Priority':'1','variable':_0x376444,'timeout':(_0x2bb3da[_0x1f15('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1efc9c})[_0x1f15('0x3e')](function(_0x5cd71a){return _0x55f420(_0x5cd71a);})[_0x1f15('0xb3')](function(_0x88dd48){_0x2bb3da[_0x1f15('0x68')]+=0x1;var _0x316aaa=new History(_0x1be450[_0x1f15('0x25')][_0x1efc9c]);logger[_0x1f15('0x98')](util['format'](_0x1f15('0x1ac'),JSON[_0x1f15('0x4d')](_0x88dd48)));_0x316aaa[_0x1f15('0xf1')]=0xe;_0x316aaa[_0x1f15('0xe8')]=_0x1f15('0x1ad');_0x316aaa[_0x1f15('0xac')]=moment()[_0x1f15('0x7b')](_0x1f15('0x104'));_0x316aaa[_0x1f15('0xab')]=_0x316aaa[_0x1f15('0xac')];_0x1be450[_0x1f15('0xcf')](_0x316aaa)['catch'](loggerCatch(_0x1f15('0x1ae')));_0x1be450['moveContactManagedDialer'](_0x316aaa)[_0x1f15('0xb3')](loggerCatch('[originate][error]'))[_0x1f15('0x1d')](function(){delete _0x1be450[_0x1f15('0x25')][_0x1efc9c];return _0x197b7c(msgResponse('originate',_0x1f15('0x1af'),_0x1f15('0x1b0')));});});});};Dialer[_0x1f15('0x1b')][_0x1f15('0x30')]=function(_0x43aa4e){var _0x3aaf72=this[_0x1f15('0x25')][_0x43aa4e[_0x1f15('0x135')]];if(_0x3aaf72){delete this['actions'][_0x43aa4e[_0x1f15('0x135')]];_0x3aaf72[_0x1f15('0x120')]=moment()[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');var _0x361eb1=_0x3aaf72[_0x1f15('0xb5')]===_0x1f15('0x7e')?this[_0x1f15('0x21')][_0x3aaf72[_0x1f15('0xb6')]]:this[_0x1f15('0x20')][_0x3aaf72[_0x1f15('0x1b1')]()];if(!this[_0x1f15('0xd9')](_0x43aa4e[_0x1f15('0x1b2')])){this[_0x1f15('0xb7')](_0x361eb1);return this[_0x1f15('0x1b3')](_0x3aaf72,_0x361eb1,_0x43aa4e)[_0x1f15('0xb3')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x43aa4e['uniqueid']]=_0x3aaf72;}};Dialer[_0x1f15('0x1b')]['checkRetriveMax']=function(_0x424408,_0x23b4c0,_0x2fb336){var _0x17f029=new History(_0x23b4c0);if(_0x17f029['countbusyretry']+_0x17f029['countcongestionretry']+_0x17f029[_0x1f15('0xf8')]+_0x17f029[_0x1f15('0xf9')]+_0x17f029[_0x1f15('0xfa')]+_0x17f029['countabandonedretry']+_0x17f029['countmachineretry']+_0x17f029[_0x1f15('0xfb')]>=_0x2fb336[_0x1f15('0x10c')]-0x1){return!![];}switch(_0x424408){case 0x3:if(_0x17f029[_0x1f15('0xf8')]>=_0x2fb336[_0x1f15('0x1b4')]-0x1){return!![];}this[_0x1f15('0x100')]({'active':![],'countnoanswerretry':_0x17f029[_0x1f15('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x2fb336[_0x1f15('0x1b5')],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x17f029[_0x1f15('0x10e')],'ListId':_0x17f029['ListId'],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})['catch'](loggerCatch(_0x1f15('0x1b6')));break;case 0x5:if(_0x17f029[_0x1f15('0xf6')]>=_0x2fb336['dialBusyMaxRetry']-0x1){return!![];}this[_0x1f15('0x100')]({'active':![],'countbusyretry':_0x17f029[_0x1f15('0xf6')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336[_0x1f15('0x1b7')],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x17f029['ContactId'],'ListId':_0x17f029[_0x1f15('0x105')],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x1b8')));break;case 0x8:if(_0x17f029[_0x1f15('0xf7')]>=_0x2fb336['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x17f029[_0x1f15('0xf7')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336[_0x1f15('0x1b9')],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x17f029[_0x1f15('0x10e')],'ListId':_0x17f029[_0x1f15('0x105')],'VoiceQueueId':_0x17f029['VoiceQueueId']||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x17f029[_0x1f15('0xf9')]>=_0x2fb336[_0x1f15('0x1ba')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x17f029[_0x1f15('0xf9')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336[_0x1f15('0x1bb')],'minutes')[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17f029[_0x1f15('0x10e')],'ListId':_0x17f029[_0x1f15('0x105')],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})['catch'](loggerCatch(_0x1f15('0x1bc')));}break;case 0xa:if(_0x17f029[_0x1f15('0xfa')]>=_0x2fb336[_0x1f15('0x129')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x17f029[_0x1f15('0xfa')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336['dialDropRetryFrequency'],_0x1f15('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17f029['ContactId'],'ListId':_0x17f029[_0x1f15('0x105')],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x12a')));break;case 0xb:if(_0x17f029[_0x1f15('0x10b')]>=_0x2fb336[_0x1f15('0x132')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x17f029['countabandonedretry']+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336['dialAbandonedRetryFrequency'],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x17f029[_0x1f15('0x10e')],'ListId':_0x17f029[_0x1f15('0x105')],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x17f029[_0x1f15('0xf3')]>=_0x2fb336[_0x1f15('0xfe')]-0x1){return!![];}this[_0x1f15('0x100')]({'active':![],'countmachineretry':_0x17f029[_0x1f15('0xf3')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336[_0x1f15('0x102')],_0x1f15('0x103'))[_0x1f15('0x7b')](_0x1f15('0x104')),'ContactId':_0x17f029[_0x1f15('0x10e')],'ListId':_0x17f029['ListId'],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x1bd')));break;case 0x14:if(_0x17f029[_0x1f15('0xfb')]>=_0x2fb336[_0x1f15('0x1be')]-0x1){return!![];}this[_0x1f15('0x100')]({'active':![],'countagentrejectretry':_0x17f029[_0x1f15('0xfb')]+=0x1,'scheduledat':moment()[_0x1f15('0x101')](_0x2fb336[_0x1f15('0x1bf')],_0x1f15('0x103'))[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17f029['ContactId'],'ListId':_0x17f029['ListId'],'VoiceQueueId':_0x17f029[_0x1f15('0x106')]||undefined,'CampaignId':_0x17f029[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x1f15('0x1b')][_0x1f15('0x1b3')]=function(_0x4d8331,_0x2c4a3e,_0x515ea7){var _0x442471=this;var _0x5d70fb=new History(_0x4d8331);var _0x499b71=![];var _0x651465;var _0x3d9bc2;return new BPromise(function(_0xc1f4dc,_0x5c071d){if(_[_0x1f15('0x40')](_0x2c4a3e)&&typeof _0x2c4a3e!=='object'){return _0x5c071d(msgResponse(_0x1f15('0x1c0'),_0x1f15('0x159'),_0x1f15('0x1c1')));}if(_[_0x1f15('0x40')](_0x515ea7)&&typeof _0x515ea7!==_0x1f15('0x185')){return _0x5c071d(msgResponse(_0x1f15('0x1c0'),_0x1f15('0x159'),_0x1f15('0x1c2')));}_0x442471['verifyAdditionalPhones'](_0x5d70fb,_0x515ea7[_0x1f15('0x116')],_0x2c4a3e)[_0x1f15('0x3e')](function(_0x4a6db3){if(_0x4a6db3[_0x1f15('0x128')]==0x1)_0x499b71=!![];switch(_0x515ea7[_0x1f15('0x116')]){case'0':_0x2c4a3e['outboundNoSuchCallsDay']+=0x1;_0x5d70fb[_0x1f15('0xf1')]=0x0;_0x5d70fb['statedesc']=_0x1f15('0x1c3');_0x5d70fb[_0x1f15('0xf9')]+=0x1;_0x5d70fb[_0x1f15('0xf4')]+=0x1;ami[_0x1f15('0xec')]('custom:agentnosuchnumber',ut[_0x1f15('0xee')](_0x4d8331,'nosuchnumber'));_0x651465=_0x2c4a3e['dialNoSuchNumberRetryFrequency'];_0x3d9bc2=_0x2c4a3e['callAdditionalPhoneAfterMin'];_0x442471[_0x1f15('0xcf')](_0x5d70fb)[_0x1f15('0xb3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x442471[_0x1f15('0x1c4')](0x0,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xf9')]>=_0x2c4a3e[_0x1f15('0x1ba')]){_0x442471[_0x1f15('0x10d')](_0x5d70fb,_0xc1f4dc,_0x5c071d,'reason\x200\x20no\x20such\x20number....');}else{_0x442471['stateGlobal'](_0x5d70fb,_0xc1f4dc,_0x5c071d,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2c4a3e[_0x1f15('0x66')]+=0x1;_0x5d70fb['state']=0x3;_0x5d70fb[_0x1f15('0xe8')]=_0x1f15('0x1c5');_0x5d70fb['countnoanswerretry']+=0x1;_0x5d70fb[_0x1f15('0xf4')]+=0x1;ami[_0x1f15('0xec')](_0x1f15('0x1c6'),ut[_0x1f15('0xee')](_0x4d8331,_0x1f15('0x1c7')));_0x651465=_0x2c4a3e[_0x1f15('0x1b5')];_0x3d9bc2=_0x2c4a3e[_0x1f15('0x126')];_0x442471[_0x1f15('0xcf')](_0x5d70fb)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x1c8')));if(_0x442471[_0x1f15('0x1c4')](0x3,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xf8')]>=_0x2c4a3e[_0x1f15('0x1b4')]){_0x442471[_0x1f15('0x10d')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1c9'));}else{_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2c4a3e[_0x1f15('0x62')]+=0x1;_0x5d70fb[_0x1f15('0xf1')]=0x5;_0x5d70fb[_0x1f15('0xe8')]='Busy';_0x5d70fb['countbusyretry']+=0x1;_0x5d70fb['countglobal']+=0x1;ami['emit'](_0x1f15('0x1ca'),ut[_0x1f15('0xee')](_0x4d8331,'busy'));_0x651465=_0x2c4a3e[_0x1f15('0x1b7')];_0x3d9bc2=_0x2c4a3e[_0x1f15('0x126')];_0x442471[_0x1f15('0xcf')](_0x5d70fb)[_0x1f15('0xb3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x442471[_0x1f15('0x1c4')](0x5,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xf6')]>=_0x2c4a3e['dialBusyMaxRetry']){_0x442471['createStateFinal'](_0x5d70fb,_0xc1f4dc,_0x5c071d,'reason\x205\x20busy');}else{_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1cb'));}}break;case'8':_0x2c4a3e['outboundCongestionCallsDay']+=0x1;_0x5d70fb[_0x1f15('0xf1')]=0x8;_0x5d70fb[_0x1f15('0xe8')]='Congestion';_0x5d70fb['countcongestionretry']+=0x1;_0x5d70fb['countglobal']+=0x1;_0x651465=_0x2c4a3e[_0x1f15('0x1b9')];_0x3d9bc2=_0x2c4a3e[_0x1f15('0x126')];ami[_0x1f15('0xec')](_0x1f15('0x1cc'),ut[_0x1f15('0xee')](_0x4d8331,_0x1f15('0x1cd')));_0x442471['createHistory'](_0x5d70fb)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x1ce')));if(_0x442471['checkRetriveMax'](0x8,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xf7')]>=_0x2c4a3e[_0x1f15('0x1cf')]){_0x442471[_0x1f15('0x10d')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d0'));}else{_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d0'));}}break;case'11':_0x2c4a3e[_0x1f15('0x1d1')]+=0x1;_0x5d70fb['state']=0xb;_0x5d70fb[_0x1f15('0xe8')]=_0x1f15('0x130');_0x5d70fb['countabandonedretry']+=0x1;_0x5d70fb[_0x1f15('0xf4')]+=0x1;_0x651465=_0x2c4a3e[_0x1f15('0x131')];_0x3d9bc2=_0x2c4a3e['callAdditionalPhoneAfterMin'];_0x442471['createHistory'](_0x5d70fb)['catch'](loggerCatch(_0x1f15('0x134')));if(_0x442471[_0x1f15('0x1c4')](0xb,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0x10b')]>=_0x2c4a3e[_0x1f15('0x132')]){_0x442471['createStateFinal'](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d2'));}else{_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d2'));}}break;case'20':_0x2c4a3e[_0x1f15('0x6a')]+=0x1;_0x5d70fb['state']=0x14;_0x5d70fb[_0x1f15('0xe8')]='AgentReject';_0x5d70fb['countagentrejectretry']+=0x1;_0x5d70fb[_0x1f15('0xf4')]+=0x1;_0x651465=_0x2c4a3e[_0x1f15('0x1bf')];_0x3d9bc2=_0x2c4a3e['callAdditionalPhoneAfterMin'];ami[_0x1f15('0xec')](_0x1f15('0x1d3'),ut['buildObj'](_0x4d8331,'agentreject'));_0x442471[_0x1f15('0xcf')](_0x5d70fb)['catch'](loggerCatch(_0x1f15('0x1d4')));if(_0x442471[_0x1f15('0x1c4')](0x14,_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xfb')]>=_0x2c4a3e['dialAgentRejectMaxRetry']){_0x442471[_0x1f15('0x10d')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d5'));}else{_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x1f15('0x1d5'));}}break;default:_0x2c4a3e[_0x1f15('0x6b')]+=0x1;_0x5d70fb[_0x1f15('0xf1')]=0xc;_0x5d70fb[_0x1f15('0xe8')]=_0x515ea7[_0x1f15('0x116')];_0x651465=_0x2c4a3e[_0x1f15('0x1bf')];_0x3d9bc2=_0x2c4a3e['callAdditionalPhoneAfterMin'];_0x442471[_0x1f15('0xcf')](_0x5d70fb)[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x1d6')));if(_0x442471[_0x1f15('0x1c4')](_0x515ea7['reason'],_0x4d8331,_0x2c4a3e)&&!_0x499b71){if(_0x5d70fb[_0x1f15('0xf6')]+_0x5d70fb['countcongestionretry']+_0x5d70fb[_0x1f15('0xf8')]+_0x5d70fb['countnosuchnumberretry']+_0x5d70fb[_0x1f15('0xfa')]+_0x5d70fb[_0x1f15('0x10b')]+_0x5d70fb[_0x1f15('0xf3')]+_0x5d70fb[_0x1f15('0xfb')]>=_0x2c4a3e[_0x1f15('0x10c')]){_0x442471[_0x1f15('0xfc')](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x515ea7[_0x1f15('0x116')]);}else{_0x442471['createStateFinal'](_0x5d70fb,_0xc1f4dc,_0x5c071d,_0x515ea7[_0x1f15('0x116')]);}}}})[_0x1f15('0x3e')](function(_0x3a5ee9){if(_0x499b71){_0x442471[_0x1f15('0x12e')](_0x5d70fb,_0x651465,_0x3d9bc2)[_0x1f15('0x3e')](function(_0x7e3f2){return _0xc1f4dc(0x1);});}});});};Dialer[_0x1f15('0x1b')][_0x1f15('0xfc')]=function(_0x5ebd7b,_0x38baec,_0x2b3c7c,_0x13a759){var _0x351ecd=new Final(_0x5ebd7b);_0x351ecd[_0x1f15('0xf1')]=0xf;_0x351ecd[_0x1f15('0xe8')]='Global';this[_0x1f15('0x10d')](_0x351ecd,_0x38baec,_0x2b3c7c,_0x13a759);};Dialer[_0x1f15('0x1b')][_0x1f15('0x10d')]=function(_0x4c15d1,_0x2caef0,_0x39b6ee,_0x3ffc79){this[_0x1f15('0xcd')](_0x4c15d1)[_0x1f15('0x3e')](function(){return _0x2caef0(msgResponse(_0x1f15('0x1c0'),'Success',_0x3ffc79));})[_0x1f15('0xb3')](function(){return _0x39b6ee(msgResponse('[moveContactManagedDialer][0]',_0x1f15('0x159'),_0x1f15('0x1d7')));});};Dialer[_0x1f15('0x1b')][_0x1f15('0x1d8')]=function(_0x2c59e8){var _0x5728de=_0x2c59e8['dialPredictiveOptimizationPercentage']/0x64;var _0x124beb=_0x2c59e8[_0x1f15('0x65')]/(_0x2c59e8[_0x1f15('0x65')]+_0x2c59e8[_0x1f15('0x61')]);var _0x50fe2c=Math['round'](_0x2c59e8[_0x1f15('0x1d9')]*(_0x2c59e8[_0x1f15('0x1da')]/0x64));var _0x4ed373=Math['round'](_0x2c59e8[_0x1f15('0x1d9')]*(_0x2c59e8[_0x1f15('0x1db')]/0x64));var _0x27a4a7=_0x2c59e8[_0x1f15('0x53')]+_0x2c59e8[_0x1f15('0xa4')];var _0x196822=Math[_0x1f15('0x1dc')](_0x2c59e8['erlangCalls']*_0x2c59e8[_0x1f15('0x77')]*_0x2c59e8[_0x1f15('0x1dd')]*_0x2c59e8[_0x1f15('0x71')]);if(_[_0x1f15('0x40')](_0x2c59e8[_0x1f15('0x2a')])){if(!_[_0x1f15('0x40')](_0x2c59e8[_0x1f15('0x29')])){_0x2c59e8['startPredictive']=undefined;loggerPredictive['error'](_0x1f15('0x1de'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x2c59e8['handlePredictive'])){loggerPredictive[_0x1f15('0x98')]('[startMethodPredictive][StartProgressive]',_0x1f15('0x1df'));clearInterval(_0x2c59e8[_0x1f15('0x92')]);_0x2c59e8[_0x1f15('0x92')]=undefined;}_0x2c59e8[_0x1f15('0x2a')]=moment()[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x1f15('0x81')](_0x2c59e8[_0x1f15('0x42')],_0x1f15('0x1e0'),_0x2c59e8[_0x1f15('0x2a')]);this['handlePower'](_0x2c59e8,0x1);}else if(ifInterval(_0x2c59e8[_0x1f15('0x1e1')],_0x2c59e8[_0x1f15('0x2a')])){this[_0x1f15('0x16c')](_0x2c59e8,0x1);loggerPredictiveCalls[_0x1f15('0x81')](_0x1f15('0x1e2'),_0x2c59e8[_0x1f15('0x2a')],_0x2c59e8['name']);_0x2c59e8['erlangCalls']=0x0;_0x2c59e8[_0x1f15('0x70')]=0x0;}else if(_0x5728de<_0x124beb&&_0x2c59e8[_0x1f15('0x1e3')]==='dropRate'){freeVariablesPredictive(_0x2c59e8);loggerPredictive['info'](_0x1f15('0x1e4'),_0x1f15('0x1e5'),_0x124beb,_0x1f15('0x2a'),_0x2c59e8[_0x1f15('0x42')]);}else if(_0x196822<_0x2c59e8[_0x1f15('0x70')]&&_0x2c59e8[_0x1f15('0x1e3')]===_0x1f15('0x1e6')){freeVariablesPredictive(_0x2c59e8);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x1e7'),_0x1f15('0x1e8'),_0x196822,_0x1f15('0x1e9'),_0x2c59e8[_0x1f15('0x70')],_0x1f15('0x2a'),_0x2c59e8[_0x1f15('0x42')]);}else if(!ifInterval(_0x2c59e8['dialPredictiveInterval'],_0x2c59e8[_0x1f15('0x2a')])&&_[_0x1f15('0x40')](_0x2c59e8[_0x1f15('0x29')])&&!_['isUndefined'](_0x2c59e8[_0x1f15('0x2a')])){_0x2c59e8['startPredictive']=moment()[_0x1f15('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x1f15('0x81')](_0x2c59e8['name'],'started\x20in\x20predictive\x20at',_0x2c59e8[_0x1f15('0x29')]);this[_0x1f15('0xc2')](_0x2c59e8[_0x1f15('0x1e1')])[_0x1f15('0x3e')](this[_0x1f15('0x1ea')](_0x2c59e8))[_0x1f15('0x3e')](mergeDataErlangB(_0x2c59e8))[_0x1f15('0x3e')](this[_0x1f15('0x1eb')](_0x2c59e8))[_0x1f15('0xb3')](loggerCatchPredictive(_0x1f15('0x1ec'),_0x2c59e8));}else if(!ifInterval(_0x2c59e8['dialPredictiveInterval'],_0x2c59e8[_0x1f15('0x29')])){_0x2c59e8[_0x1f15('0x70')]=0x0;_0x2c59e8['startPredictive']=moment()['format'](_0x1f15('0x104'));loggerPredictive[_0x1f15('0x81')](_0x2c59e8[_0x1f15('0x42')],_0x1f15('0x1ed'),_0x2c59e8[_0x1f15('0x29')]);clearInterval(_0x2c59e8[_0x1f15('0x92')]);_0x2c59e8[_0x1f15('0x92')]=undefined;this[_0x1f15('0xc2')](_0x2c59e8[_0x1f15('0x1e1')])[_0x1f15('0x3e')](this[_0x1f15('0x1ea')](_0x2c59e8))[_0x1f15('0x3e')](mergeDataErlangB(_0x2c59e8))[_0x1f15('0x3e')](this[_0x1f15('0x1eb')](_0x2c59e8))[_0x1f15('0xb3')](loggerCatchPredictive(_0x1f15('0x1ee'),_0x2c59e8));}else if(_0x2c59e8[_0x1f15('0x1d9')]&&_0x27a4a7<_0x2c59e8[_0x1f15('0x1d9')]-_0x4ed373){freeVariablesPredictive(_0x2c59e8);loggerPredictive[_0x1f15('0x81')](_0x2c59e8[_0x1f15('0x42')],_0x1f15('0x1ef'),_0x27a4a7,')\x20are\x20less\x20than\x20threshold\x20(',_0x2c59e8['predictiveIntervalAvailable'],'-',_0x4ed373,'=',_0x2c59e8[_0x1f15('0x1d9')]-_0x4ed373,')');}else if(_0x2c59e8['predictiveIntervalAvailable']&&_0x27a4a7>_0x2c59e8[_0x1f15('0x1d9')]+_0x50fe2c){freeVariablesPredictive(_0x2c59e8);loggerPredictive['info'](_0x2c59e8[_0x1f15('0x42')],_0x1f15('0x1ef'),_0x27a4a7,_0x1f15('0x1f0'),_0x2c59e8['predictiveIntervalAvailable'],'+',_0x50fe2c,'=',_0x2c59e8['predictiveIntervalAvailable']+_0x50fe2c,')');}};Dialer[_0x1f15('0x1b')][_0x1f15('0x1ea')]=function(_0x33845f){var _0xb4e864=this;return function(_0x269b43){return new BPromise(function(_0x53300b,_0x172a26){_[_0x1f15('0x8f')](_0x33845f,_0x269b43[0x0]);if(checkGetDataPredictive(_0x269b43[0x0])){var _0x2cfddd=_0x33845f[_0x1f15('0x1d9')]=_0x33845f['talking']+_0x33845f[_0x1f15('0x53')];var _0x31d030=_0x33845f[_0x1f15('0x1e1')]*0x3c;var _0x4d8477=_0x269b43[0x0][_0x1f15('0x6d')]+_0x269b43[0x0]['predictiveIntervalAvgHoldtime'];var _0x55ac22=(_0x269b43[0x0]['predictiveIntervalAnsweredCalls']+_0x269b43[0x0][_0x1f15('0x6e')]+_0x269b43[0x0][_0x1f15('0x12f')])/_0x269b43[0x0][_0x1f15('0x73')];_0x33845f['predictiveIntervalHitRate']=_0x55ac22>0x0?_0x55ac22:0x1;switch(_0x33845f[_0x1f15('0x1e3')]){case _0x1f15('0x1e6'):var _0x228599=_0x33845f[_0x1f15('0x1f1')]/0x64;return _0xb4e864[_0x1f15('0x1f2')](_0x2cfddd,_0x31d030,_0x4d8477,_0x55ac22,_0x228599)[_0x1f15('0x3e')](function(_0x43b7cd){return _0x53300b(_0x43b7cd);});case _0x1f15('0x1f3'):var _0x3f7cc6=_0x33845f[_0x1f15('0x1f1')]/0x64;return _0xb4e864[_0x1f15('0x1f4')](_0x2cfddd,_0x31d030,_0x4d8477,_0x55ac22,_0x3f7cc6)[_0x1f15('0x3e')](function(_0x281992){return _0x53300b(_0x281992);});default:return _0x172a26(msgResponse('[getDataPredictive]','Failure',_0x1f15('0x1f5')));}}else{return _0x172a26(msgResponse(_0x1f15('0x1f6'),_0x1f15('0x159'),'check\x20failure'));}});};};Dialer[_0x1f15('0x1b')][_0x1f15('0x1f7')]=function(_0x5243e4){var _0x553675=this;return function(_0x4336b1){return new BPromise(function(_0x308bf9,_0x3d9e09){_[_0x1f15('0x8f')](_0x5243e4,_0x4336b1[0x0]);if(checkGetDataPredictive(_0x4336b1[0x0])){loggerPredictive[_0x1f15('0x81')](JSON[_0x1f15('0x4d')](_0x4336b1[0x0]));if(_0x5243e4[_0x1f15('0x1e3')]===_0x1f15('0x1e6')){return _0x553675[_0x1f15('0xcb')](_0x5243e4['id'])[_0x1f15('0x3e')](function(_0x4dc682){var _0xa6581=_0x5243e4[_0x1f15('0x54')]-_0x4dc682[0x0][_0x1f15('0x1f8')];var _0x2dbdf5=_0x5243e4[_0x1f15('0x1e1')]*0x3c;var _0x532fc7=_0x4336b1[0x0]['predictiveIntervalAvgTalktime']+_0x4336b1[0x0][_0x1f15('0x6c')];var _0x5cf9e1=(_0x4336b1[0x0]['predictiveIntervalAnsweredCalls']+_0x4336b1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4336b1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4336b1[0x0][_0x1f15('0x73')];var _0x20d308=_0x5243e4[_0x1f15('0x1f1')]/0x64;_0x5243e4[_0x1f15('0x72')]=_0x4dc682[0x0][_0x1f15('0x1f8')]||0x0;_0x5243e4[_0x1f15('0x1dd')]=_0x5cf9e1>0x0?_0x5cf9e1:0x1;return _0x553675[_0x1f15('0x1f2')](_0xa6581,_0x2dbdf5,_0x532fc7,_0x5cf9e1,_0x20d308);})[_0x1f15('0x3e')](function(_0x1c9d52){return _0x308bf9(_0x1c9d52);})[_0x1f15('0xb3')](function(_0x2e96e0){return _0x3d9e09(msgResponse(_0x1f15('0x1f9'),_0x1f15('0x159'),JSON[_0x1f15('0x4d')](_0x2e96e0)));});}if(_0x5243e4[_0x1f15('0x1e3')]===_0x1f15('0x1f3')){return _0x553675[_0x1f15('0xcb')](_0x5243e4['id'])[_0x1f15('0x3e')](function(_0x4a4887){var _0xe2ce45=_0x5243e4['loggedIn']-_0x4a4887[0x0][_0x1f15('0x1f8')];var _0x30eb2d=_0x5243e4[_0x1f15('0x1e1')]*0x3c;var _0x5c4d70=_0x4336b1[0x0][_0x1f15('0x6d')]+_0x4336b1[0x0][_0x1f15('0x6c')];var _0x1ba033=(_0x4336b1[0x0][_0x1f15('0x84')]+_0x4336b1[0x0][_0x1f15('0x6e')]+_0x4336b1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4336b1[0x0]['predictiveIntervalTotalCalls'];var _0xdb7175=_0x5243e4['dialPredictiveOptimizationPercentage']/0x64;_0x5243e4[_0x1f15('0x72')]=_0x4a4887[0x0][_0x1f15('0x1f8')]||0x0;_0x5243e4['predictiveIntervalHitRate']=_0x1ba033>0x0?_0x1ba033:0x1;return _0x553675[_0x1f15('0x1f4')](_0xe2ce45,_0x30eb2d,_0x5c4d70,_0x1ba033,_0xdb7175);})[_0x1f15('0x3e')](function(_0x1328ca){return _0x308bf9(_0x1328ca);})[_0x1f15('0xb3')](function(_0x50a9c0){return _0x3d9e09(msgResponse(_0x1f15('0x1f9'),_0x1f15('0x159'),JSON[_0x1f15('0x4d')](_0x50a9c0)));});}}else{return _0x3d9e09(msgResponse(_0x1f15('0x1f6'),_0x1f15('0x159'),_0x1f15('0x1fa')));}});};};Dialer[_0x1f15('0x1b')]['startMethodPredictive']=function(_0x55ddf3){var _0x26e6fa=this;return function(){var _0x19acf6=0x0;var _0x468dd3=Math[_0x1f15('0x1dc')](_0x55ddf3[_0x1f15('0x76')]*0x3e8);if(_0x468dd3>0x0){_0x468dd3=_0x468dd3<0x64?0x64:_0x468dd3;loggerPredictive['info'](_0x55ddf3[_0x1f15('0x42')],'one\x20call\x20every:',_0x468dd3,_0x1f15('0x4e'));_0x55ddf3['handlePredictive']=setInterval(function(){_0x26e6fa[_0x1f15('0x92')](_0x55ddf3);loggerPredictiveCalls[_0x1f15('0x81')](_0x1f15('0x1fb'),_0x19acf6+=0x1);},_0x468dd3);}else{loggerPredictive[_0x1f15('0x81')](_0x55ddf3['name'],_0x1f15('0x1fc'));}};};Dialer[_0x1f15('0x1b')][_0x1f15('0x1fd')]=function(_0x64cce9,_0x3bb0a2){var _0x488d38=this;return function(_0x4c50fa){if(_[_0x1f15('0x4a')](_0x4c50fa)){if(_[_0x1f15('0xaf')](_0x3bb0a2['UserId'])||!_0x3bb0a2[_0x1f15('0x1fe')]){if(_0x64cce9[_0x1f15('0x5c')]===_0x1f15('0x16e')){_0x64cce9['queueStatusComplete']=_[_0x1f15('0x40')](_0x64cce9[_0x1f15('0x13c')])?!![]:_0x64cce9[_0x1f15('0x13c')];var _0x3fd1c8=uuid['v4']();_0x488d38[_0x1f15('0x25')][_0x3fd1c8]=new Action(_0x64cce9,_0x3bb0a2,_0x3fd1c8);loggerBooked['info'](_0x1f15('0x1ff'),_0x3fd1c8,_0x1f15('0x200'),JSON[_0x1f15('0x4d')](_0x64cce9[_0x1f15('0x13c')]),_0x1f15('0x201'),_0x64cce9[_0x1f15('0x42')]);if(_0x64cce9[_0x1f15('0x13c')]){_0x64cce9[_0x1f15('0x13c')]=![];_0x488d38[_0x1f15('0x139')][_0x488d38[_0x1f15('0x25')][_0x3fd1c8]['queue']]=[];ami['Action']({'actionid':_0x3fd1c8,'action':_0x1f15('0x202'),'queue':_0x64cce9['name']})[_0x1f15('0xb3')](function(){_0x488d38[_0x1f15('0xb7')](_0x64cce9);_0x488d38['rescheduleContact']({'active':![],'ContactId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8][_0x1f15('0x10e')],'ListId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8]['ListId'],'VoiceQueueId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8][_0x1f15('0x106')]||undefined,'CampaignId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8][_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x203')));delete _0x488d38[_0x1f15('0x25')][_0x3fd1c8];});}else{loggerBooked[_0x1f15('0x81')](_0x1f15('0x204'),JSON[_0x1f15('0x4d')](_0x64cce9[_0x1f15('0x13c')]),_0x1f15('0x201'),_0x64cce9[_0x1f15('0x42')]);_0x488d38['updateOriginated'](_0x64cce9);_0x488d38['rescheduleContact']({'active':![],'ContactId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8][_0x1f15('0x10e')],'ListId':_0x488d38[_0x1f15('0x25')][_0x3fd1c8]['ListId'],'VoiceQueueId':_0x488d38['actions'][_0x3fd1c8][_0x1f15('0x106')]||undefined,'CampaignId':_0x488d38['actions'][_0x3fd1c8][_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x203')));delete _0x488d38[_0x1f15('0x25')][_0x3fd1c8];}}else{return _0x488d38['actionOriginate'](_0x64cce9,_0x3bb0a2);}}else{if(getDiff(_0x3bb0a2[_0x1f15('0x205')])<_0x64cce9[_0x1f15('0x206')]*0x3c){if(_0x3bb0a2['Agent']&&!_0x3bb0a2[_0x1f15('0x17d')][_0x1f15('0x207')]){_0x488d38[_0x1f15('0x1f')][_0x1f15('0x140')](_0x3bb0a2['id'])['finally'](function(){_0x488d38[_0x1f15('0xb7')](_0x64cce9);});}else{_0x488d38[_0x1f15('0xc6')]({'active':![]},_0x3bb0a2['id'],0x1)['finally'](function(){_0x488d38[_0x1f15('0xb7')](_0x64cce9);});}}else{_0x64cce9['outboundReCallsDay']+=0x1;_0x488d38['updateOriginated'](_0x64cce9);if(_0x64cce9[_0x1f15('0x208')]){_0x488d38[_0x1f15('0x100')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3bb0a2[_0x1f15('0x10e')],'ListId':_0x3bb0a2['ListId'],'VoiceQueueId':_0x3bb0a2[_0x1f15('0x106')]||undefined,'CampaignId':_0x3bb0a2[_0x1f15('0x107')]||undefined})[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x209')));_0x488d38['createHistory'](createObjHistory(_0x64cce9,_0x3bb0a2,'RECALLINQUEUE',0x17,_0x1f15('0x20a')))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0x20b')));}else{_0x488d38[_0x1f15('0xd4')](createObjHistory(_0x64cce9,_0x3bb0a2,_0x1f15('0x20c'),0x16,_0x1f15('0x20d')),_0x1f15('0x20e'),_0x1f15('0x20f'));}}}}else{_0x64cce9[_0x1f15('0x210')]+=0x1;_0x488d38[_0x1f15('0xd4')](createObjHistory(_0x64cce9,_0x3bb0a2,_0x1f15('0x211'),0xd,'Blacklist'),_0x1f15('0x212'),_0x1f15('0x213'));throw _0x1f15('0x214');}};};Dialer[_0x1f15('0x1b')]['handleIvr']=function(_0x542153){var _0x1e7ec8=this;var _0x24c6ba=_0x542153[_0x1f15('0x215')]-_0x542153['originated']-_0x542153[_0x1f15('0xc7')];emitCampaignSummary(_0x542153);if(_0x24c6ba>0x0){if(_0x24c6ba>this[_0x1f15('0x23')]){_0x24c6ba=this[_0x1f15('0x23')];}_0x542153[_0x1f15('0xc7')]+=_0x24c6ba;this[_0x1f15('0xc9')](_0x542153['id'],_0x24c6ba,_0x542153[_0x1f15('0x216')],_0x542153)[_0x1f15('0x3e')](function(_0x673b23){_0x542153['temp']-=_0x24c6ba;_0x542153[_0x1f15('0xc7')]=_0x542153[_0x1f15('0xc7')]>0x0?_0x542153[_0x1f15('0xc7')]:0x0;if(!checkContactEmpty(_0x673b23)){_0x542153[_0x1f15('0x49')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x1f15('0x81')](_0x1f15('0x217')+_0x542153[_0x1f15('0x42')]);}else{_0x542153[_0x1f15('0x74')]+=_0x673b23[_0x1f15('0x9b')];_0x542153[_0x1f15('0x49')]=_0x1f15('0x218');for(var _0x83e6ac=0x0;_0x83e6ac<_0x673b23[_0x1f15('0x9b')];_0x83e6ac+=0x1){_0x542153[_0x1f15('0x219')]+=0x1;if(_[_0x1f15('0xaf')](_0x673b23[_0x83e6ac])||_['isNil'](_0x673b23[_0x83e6ac]['Contact'])||_[_0x1f15('0xaf')](_0x673b23[_0x83e6ac][_0x1f15('0x187')])){_0x1e7ec8[_0x1f15('0xd2')](_0x1f15('0x21a'),_0x542153,_0x673b23[_0x83e6ac]);}else{_0x1e7ec8[_0x1f15('0xc0')](_[_0x1f15('0xd5')](_0x673b23[_0x83e6ac],['CampaignId',_0x1f15('0x21b')]))[_0x1f15('0x3e')](_0x1e7ec8['checkContactBlack'](_0x542153,_0x673b23[_0x83e6ac]))[_0x1f15('0xb3')](_0x1e7ec8[_0x1f15('0x21c')](_0x1f15('0x21d'),_0x542153));}}}})[_0x1f15('0xb3')](loggerGetContactDialer('[getContactCampaign2]',_0x542153,_0x24c6ba));}};Dialer[_0x1f15('0x1b')][_0x1f15('0x16c')]=function(_0x20d52e,_0xea0a43){var _0x1e9461=this;var _0x37e45a=[];var _0x29ba69=_0xea0a43>=0x1?_0xea0a43:0x1;if(_0x20d52e['dialMethod']===_0x1f15('0x16e')){_0x29ba69=0x1;}var _0x32cbcd=Math[_0x1f15('0x1dc')](_0x20d52e[_0x1f15('0x53')]*_0x29ba69)-_0x20d52e[_0x1f15('0x74')]-_0x20d52e['temp'];emitVoiceQueueSummary(_0x20d52e);if(_0x20d52e[_0x1f15('0x21e')]>0x0){var _0x3ec032=_0x20d52e[_0x1f15('0x21e')]-_0x20d52e['originated']-_0x20d52e['talking']-_0x20d52e[_0x1f15('0xc7')]-_0x20d52e[_0x1f15('0x55')];if(_0x32cbcd>_0x3ec032){_0x32cbcd=_0x3ec032;}}if(_0x32cbcd>0x0){if(_0x20d52e[_0x1f15('0x5c')]==='booked'){_0x32cbcd=0x1;}if(_0x32cbcd>this[_0x1f15('0x23')]){_0x32cbcd=this['maxNumberOriginate'];}_0x20d52e[_0x1f15('0xc7')]+=_0x32cbcd;for(var _0x10a82a in this[_0x1f15('0x22')]){if(typeof this['agents'][_0x10a82a]!=='undefined'){if(this[_0x1f15('0x22')][_0x10a82a][_0x1f15('0xf1')]===_0x1f15('0x21f')&&this[_0x1f15('0x22')][_0x10a82a][_0x1f15('0xb1')]===_0x1f15('0xde')){_0x37e45a['push'](this[_0x1f15('0x22')][_0x10a82a]['id']);}}}this['getContactDialer'](_0x20d52e['id'],_0x37e45a,_0x32cbcd,_0x20d52e['dialOrderByScheduledAt'],_0x20d52e)['then'](function(_0x14813f){_0x20d52e[_0x1f15('0xc7')]-=_0x32cbcd;_0x20d52e[_0x1f15('0xc7')]=_0x20d52e['temp']>0x0?_0x20d52e[_0x1f15('0xc7')]:0x0;if(!checkContactEmpty(_0x14813f)){_0x1e9461[_0x1f15('0xb9')](_0x20d52e)[_0x1f15('0x3e')](sendMessageReschedule(_0x20d52e))['catch'](loggerCatch(_0x1f15('0xba')));}else{_0x20d52e[_0x1f15('0x74')]+=_0x14813f[_0x1f15('0x9b')];_0x20d52e[_0x1f15('0x49')]=_0x20d52e[_0x1f15('0x5c')]===_0x1f15('0x16e')?_0x1f15('0x18f'):_0x1f15('0x218');for(var _0x537e23=0x0;_0x537e23<_0x14813f[_0x1f15('0x9b')];_0x537e23+=0x1){if(_[_0x1f15('0xaf')](_0x14813f[_0x537e23])||_['isNil'](_0x14813f[_0x537e23][_0x1f15('0x1a0')])||_['isNil'](_0x14813f[_0x537e23][_0x1f15('0x187')])){_0x1e9461[_0x1f15('0xd2')](_0x1f15('0x21a'),_0x20d52e,_0x14813f[_0x537e23]);}else{_0x1e9461[_0x1f15('0x220')](_[_0x1f15('0xd5')](_0x14813f[_0x537e23],[_0x1f15('0x106'),_0x1f15('0x21b')]))[_0x1f15('0x3e')](_0x1e9461['checkContactBlack'](_0x20d52e,_0x14813f[_0x537e23]))[_0x1f15('0xb3')](_0x1e9461[_0x1f15('0x21c')](_0x1f15('0x21a'),_0x20d52e));}}}})[_0x1f15('0xb3')](loggerGetContactDialer(_0x1f15('0x221'),_0x20d52e,_0x32cbcd));}};Dialer['prototype'][_0x1f15('0x92')]=function(_0x508171){if(_0x508171['dialLimitQueue']>0x0){var _0x46c897=_0x508171[_0x1f15('0x21e')]-_0x508171[_0x1f15('0x74')]-_0x508171[_0x1f15('0xa4')];if(_0x46c897>0x0){this[_0x1f15('0x222')](_0x508171);}else{loggerPredictiveCalls[_0x1f15('0x81')](_0x1f15('0x223'));}}else{this[_0x1f15('0x222')](_0x508171);}};Dialer[_0x1f15('0x1b')][_0x1f15('0x222')]=function(_0x15c5ef){var _0x52b648=this;var _0x3d2901=[];_0x15c5ef[_0x1f15('0x74')]+=0x1;for(var _0x3f2ccd in this['agents']){if(typeof this[_0x1f15('0x22')][_0x3f2ccd]!==_0x1f15('0x9c')){if(this[_0x1f15('0x22')][_0x3f2ccd][_0x1f15('0xf1')]===_0x1f15('0x21f')&&this[_0x1f15('0x22')][_0x3f2ccd][_0x1f15('0xb1')]==='reachable'){_0x3d2901[_0x1f15('0x13a')](this[_0x1f15('0x22')][_0x3f2ccd]['id']);}}}this[_0x1f15('0x224')](_0x15c5ef['id'],_0x3d2901,0x1,_0x15c5ef[_0x1f15('0x216')],_0x15c5ef)[_0x1f15('0x3e')](function(_0x443ed2){if(!checkContactEmpty(_0x443ed2)){checkContactLowerLimitOriginate(_0x15c5ef,0x1,0x0);_0x52b648[_0x1f15('0xb9')](_0x15c5ef)[_0x1f15('0x3e')](sendMessageReschedule(_0x15c5ef))[_0x1f15('0xb3')](loggerCatch(_0x1f15('0xba')));}else{_0x15c5ef['message']=_0x1f15('0x218');if(_[_0x1f15('0xaf')](_0x443ed2[0x0])||_[_0x1f15('0xaf')](_0x443ed2[0x0]['Contact'])||_[_0x1f15('0xaf')](_0x443ed2[0x0]['phone'])){_0x52b648[_0x1f15('0xd2')](_0x1f15('0x21a'),_0x15c5ef,_0x443ed2[0x0]);}else{_0x52b648[_0x1f15('0x220')](_['pick'](_0x443ed2[0x0],[_0x1f15('0x106'),_0x1f15('0x21b')]))[_0x1f15('0x3e')](_0x52b648['checkContactBlack'](_0x15c5ef,_0x443ed2[0x0]))[_0x1f15('0xb3')](_0x52b648[_0x1f15('0x21c')]('[actionOriginatePredictive]\x20',_0x15c5ef));}}})[_0x1f15('0xb3')](loggerGetContactDialer('[getContactDialerPredictive]',_0x15c5ef,0x1));emitVoiceQueueSummary(_0x15c5ef);};Dialer[_0x1f15('0x1b')][_0x1f15('0x1f2')]=function(_0x4f32d4,_0x3d1fa2,_0x3137b7,_0x54a435,_0x5b339f,_0x185d7d){loggerPredictive['info'](_0x1f15('0x225'));loggerPredictive['info'](_0x1f15('0x226'),_0x4f32d4);loggerPredictive['info'](_0x1f15('0x227'),_0x3d1fa2);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x228'),_0x3137b7);loggerPredictive['info'](_0x1f15('0x229'),_0x54a435);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b339f);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x450c08,_0x4ff630){if(_0x4f32d4<=0x0||isNaN(_0x4f32d4)){return _0x4ff630(msgResponse(_0x1f15('0x22a'),_0x1f15('0x1af'),_0x1f15('0x22b')+_0x4f32d4));}if(_0x3137b7<=0x0||isNaN(_0x3137b7)){return _0x4ff630(msgResponse('[abandonmentRate]','Error',_0x1f15('0x22c')+_0x3137b7));}if(_0x54a435<=0x0||isNaN(_0x54a435)){return _0x4ff630(msgResponse('[abandonmentRate]',_0x1f15('0x1af'),'p\x20=\x20'+_0x54a435));}if(_0x3d1fa2<=0x0||isNaN(_0x3d1fa2)){return _0x4ff630(msgResponse(_0x1f15('0x22a'),_0x1f15('0x1af'),_0x1f15('0x22d')+_0x3d1fa2));}if(_0x5b339f<=0x0||isNaN(_0x5b339f)){return _0x4ff630(msgResponse(_0x1f15('0x22a'),'Error',_0x1f15('0x22e')+_0x5b339f));}_0x185d7d=_0x185d7d||0x0;var _0xe80478=0x1/_0x3137b7;var _0x5db3b3=0x0;var _0x400359=0x0;var _0x1918fd=0x0;var _0x504f9b=0x0;for(var _0x292199=0x0;_0x1918fd<_0x5b339f;_0x292199+=0x1){_0x400359=_0x292199/_0x3d1fa2;_0x5db3b3=(_0x54a435*_0x400359+_0x185d7d)/_0xe80478;_0x1918fd=erlangb(_0x5db3b3,_0x4f32d4);_0x504f9b=_0x5db3b3/_0x4f32d4*(0x1-erlangb(_0x5db3b3,_0x4f32d4));}return _0x450c08({'erlangCalls':_0x292199,'erlangCallToSecond':_0x3d1fa2/_0x292199,'erlangAbandonmentRate':_0x1918fd,'erlangBusyFactor':_0x504f9b});});};Dialer[_0x1f15('0x1b')][_0x1f15('0x1f4')]=function(_0x161a4a,_0x30c190,_0x3df80e,_0x4c6d05,_0x358d2e,_0x4f3c24){loggerPredictive[_0x1f15('0x81')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1f15('0x81')](_0x1f15('0x226'),_0x161a4a);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x227'),_0x30c190);loggerPredictive[_0x1f15('0x81')]('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',_0x3df80e);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x229'),_0x4c6d05);loggerPredictive[_0x1f15('0x81')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x358d2e);loggerPredictive[_0x1f15('0x81')](_0x1f15('0x87'));return new BPromise(function(_0xd2d9f0,_0x4a4ef5){if(_0x161a4a<=0x0||isNaN(_0x161a4a)){return _0x4a4ef5(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x161a4a));}if(_0x3df80e<=0x0||isNaN(_0x3df80e)){return _0x4a4ef5(msgResponse('[busyFactor]',_0x1f15('0x1af'),_0x1f15('0x22c')+_0x3df80e));}if(_0x4c6d05<=0x0||isNaN(_0x4c6d05)){return _0x4a4ef5(msgResponse(_0x1f15('0x22f'),'Error',_0x1f15('0x230')+_0x4c6d05));}if(_0x30c190<=0x0||isNaN(_0x30c190)){return _0x4a4ef5(msgResponse(_0x1f15('0x22f'),'Error',_0x1f15('0x22d')+_0x30c190));}if(_0x358d2e<=0x0||isNaN(_0x358d2e)){return _0x4a4ef5(msgResponse(_0x1f15('0x22f'),_0x1f15('0x1af'),_0x1f15('0x231')+_0x358d2e));}_0x4f3c24=_0x4f3c24||0x0;var _0x211730=0x1/_0x3df80e;var _0x512070=0x0;var _0x32874b=0x0;var _0x473e2a=0x0;var _0x386ff6=0x0;for(var _0x2c5811=0x0;_0x386ff6<_0x358d2e;_0x2c5811+=0x1){_0x32874b=_0x2c5811/_0x30c190;_0x512070=(_0x4c6d05*_0x32874b+_0x4f3c24)/_0x211730;_0x473e2a=erlangb(_0x512070,_0x161a4a);_0x386ff6=_0x512070/_0x161a4a*(0x1-erlangb(_0x512070,_0x161a4a));}return _0xd2d9f0({'erlangCalls':_0x2c5811,'erlangCallToSecond':_0x30c190/_0x2c5811,'erlangAbandonmentRate':_0x473e2a,'erlangBusyFactor':_0x386ff6});});};module[_0x1f15('0x232')]=Dialer; \ No newline at end of file +var _0x0490=['UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','HangupInAMD','membername','buildObj','amd','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','rescheduleContact','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countglobal','countabandonedretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','content','true','push','iftime\x20%s,%s','indexOf','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','map','Agent','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','run','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','lodash','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','format','campaign:ivr:%s','campaign:save','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','AVG\x20Hold\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','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22\x22\x20<>','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','endtime','starttime','[uniqueid]','[actions]','clearZombieChannels','undefined','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','resolve','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ListId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0490,0x147));var _0x0049=function(_0x141bb7,_0x70b2ad){_0x141bb7=_0x141bb7-0x0;var _0x377848=_0x0490[_0x141bb7];return _0x377848;};'use strict';var util=require('util');var _=require(_0x0049('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0049('0x1'));var ut=require(_0x0049('0x2'));var config=require(_0x0049('0x3'));var logger=require(_0x0049('0x4'))(_0x0049('0x5'));var loggerBooked=require(_0x0049('0x4'))(_0x0049('0x6'));var loggerPredictive=require(_0x0049('0x4'))(_0x0049('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0049('0x8'));var loggerSyncQueueSummary=require(_0x0049('0x4'))(_0x0049('0x9'));var ami=require('../ami');config[_0x0049('0xa')]=_[_0x0049('0xb')](config[_0x0049('0xa')],{'host':_0x0049('0xc'),'port':0x18eb});var io=require(_0x0049('0xd'))(new Redis(config[_0x0049('0xa')]));var cmHopper=require(_0x0049('0xe'));var cmHopperHistory=require(_0x0049('0xf'));var cmHopperFinal=require(_0x0049('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0049('0x11'));var voiceQueueRt=require(_0x0049('0x12'));var RpcSetting=require(_0x0049('0x13'));var Action=require('./action');var History=require('./history');var Final=require(_0x0049('0x14'));var AgentComplete=require(_0x0049('0x15'));var QueueCallerAbandon=require(_0x0049('0x16'));var Hangup=require(_0x0049('0x17'));var ipAgi=process[_0x0049('0x18')]['XCALLY_IP_AGI']||_0x0049('0x19');var strategy={'rrmemory':_0x0049('0x1a'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0049('0x1b')][_0x0049('0x1c')]=function(_0x2d6b06){this[_0x0049('0x1d')]=this['tail']?this['tail'][_0x0049('0x1e')](_0x2d6b06):_0x2d6b06();};function Dialer(_0x2cdade,_0x291a94){this[_0x0049('0x1f')]=new Sequence();this[_0x0049('0x20')]=_0x291a94;this[_0x0049('0x21')]=_0x2cdade[_0x0049('0x21')];this[_0x0049('0x22')]=_0x2cdade[_0x0049('0x22')];this[_0x0049('0x23')]=_0x2cdade['agents'];this[_0x0049('0x24')]=_0x2cdade[_0x0049('0x24')];this['maxNumberOriginate']=config[_0x0049('0x25')]||0x2;this[_0x0049('0x26')]={};this[_0x0049('0x27')]={};this[_0x0049('0x28')]={};this[_0x0049('0x29')]={};this['optionPredictive']={};this[_0x0049('0x2a')]={};this[_0x0049('0x2b')]={};this['ivrOriginated']={};this[_0x0049('0x2c')]={};this[_0x0049('0x2d')]={};ami['on'](_0x0049('0x2e'),this[_0x0049('0x2f')][_0x0049('0x30')](this));ami['on'](_0x0049('0x31'),this[_0x0049('0x32')][_0x0049('0x30')](this));ami['on'](_0x0049('0x33'),this[_0x0049('0x34')][_0x0049('0x30')](this));ami['on'](_0x0049('0x35'),this['syncAgentComplete'][_0x0049('0x30')](this));ami['on'](_0x0049('0x36'),this[_0x0049('0x9')][_0x0049('0x30')](this));ami['on'](_0x0049('0x37'),this['syncQueueSummaryComplete'][_0x0049('0x30')](this));ami['on']('hangup',this[_0x0049('0x38')][_0x0049('0x30')](this));ami['on'](_0x0049('0x39'),this[_0x0049('0x3a')]['bind'](this));ami['on'](_0x0049('0x3b'),this[_0x0049('0x3c')][_0x0049('0x30')](this));ami['on'](_0x0049('0x3d'),this[_0x0049('0x3e')]['bind'](this));ami['on'](_0x0049('0x3f'),this[_0x0049('0x40')][_0x0049('0x30')](this));this['loopCampaigns']();this[_0x0049('0x41')]();RpcSetting[_0x0049('0x42')]()[_0x0049('0x43')](function(_0x25876e){previewRecallmeReminderInterval=_0x25876e['previewRecallmeReminderInterval'];});}function isNotNull(_0x30f400){return _0x30f400!==null&&!_[_0x0049('0x44')](_0x30f400);}function checkIsLoggedIn(_0x5c2d27,_0x1170b8){return function(){if(_0x1170b8<=0x0){_0x5c2d27[_0x0049('0x45')]='AGENTS_NOT_LOGGED';throw _0x5c2d27[_0x0049('0x46')]+_0x0049('0x47');}};}function isActive(_0x3d47d8){return _0x3d47d8;}function checkIsActive(_0x14b1d1,_0x178827){return function(){if(!isActive(_0x178827)){_0x14b1d1['message']=_0x0049('0x48');throw _0x14b1d1[_0x0049('0x46')]+_0x0049('0x49');}};}function checkInterval(_0x236e7a){return function(){if(!isNotNull(_0x236e7a[_0x0049('0x4a')])){_0x236e7a['message']=_0x0049('0x4b');throw _0x236e7a['name']+_0x0049('0x4c');}if(!isNotNull(_0x236e7a[_0x0049('0x4a')][_0x0049('0x4d')])){_0x236e7a['message']=_0x0049('0x4b');throw _0x236e7a['name']+_0x0049('0x4c');}if(!isNotNull(_[_0x0049('0x4e')](_0x236e7a[_0x0049('0x4a')]['Intervals']))){_0x236e7a[_0x0049('0x45')]=_0x0049('0x4b');throw _0x236e7a[_0x0049('0x46')]+_0x0049('0x4c');}};}function msgResponse(_0x1719ef,_0x207e43,_0x56c591){return{'action':_0x1719ef,'response':_0x207e43,'message':_0x56c591,'stack':_0x56c591};}function myreject(_0x40bef9){return function(_0x3902f5){return _0x40bef9(msgResponse('[ifTime][Action]','Error',JSON[_0x0049('0x4f')](_0x3902f5)));};}function getSeconds(_0xd254de,_0xc19c60){var _0x10b31b=moment(_0xd254de)[_0x0049('0x50')](0x0);var _0x5a21ed=moment(_0xc19c60)[_0x0049('0x50')](0x0);return _0x10b31b[_0x0049('0x51')](_0x5a21ed,'seconds');}function emit(_0x3bed47,_0x3332f1,_0x46c6b5){io['to'](_0x3bed47)[_0x0049('0x52')](_0x3332f1,_0x46c6b5);}function emitVoiceQueueSummary(_0xe8a86f){if(_0xe8a86f[_0x0049('0x53')]===_0x0049('0x54')){var _0x3fa25e={'id':_0xe8a86f['id'],'name':_0xe8a86f['name'],'strategy':_0xe8a86f[_0x0049('0x55')],'answered':_0xe8a86f[_0x0049('0x56')],'available':_0xe8a86f[_0x0049('0x57')],'loggedIn':_0xe8a86f[_0x0049('0x58')],'pTalking':_0xe8a86f[_0x0049('0x59')],'sumBillable':_0xe8a86f[_0x0049('0x5a')],'sumDuration':_0xe8a86f[_0x0049('0x5b')],'sumHoldTime':_0xe8a86f[_0x0049('0x5c')]||0x0,'talking':_0xe8a86f[_0x0049('0x5d')],'total':_0xe8a86f[_0x0049('0x5e')],'type':_0xe8a86f[_0x0049('0x53')],'unmanaged':_0xe8a86f[_0x0049('0x5f')],'abandoned':_0xe8a86f[_0x0049('0x60')],'waiting':_0xe8a86f['waiting'],'loggedInDb':_0xe8a86f[_0x0049('0x61')],'dialActive':_0xe8a86f[_0x0049('0x62')],'dialMethod':_0xe8a86f[_0x0049('0x63')],'dialOriginateCallerIdName':_0xe8a86f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xe8a86f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xe8a86f[_0x0049('0x64')],'dialPrefix':_0xe8a86f['dialPrefix'],'outboundAnswerAgiCallsDay':_0xe8a86f[_0x0049('0x65')],'outboundAnswerCallsDay':_0xe8a86f[_0x0049('0x66')],'outboundBlacklistCallsDay':_0xe8a86f[_0x0049('0x67')],'outboundBusyCallsDay':_0xe8a86f[_0x0049('0x68')],'outboundCongestionCallsDay':_0xe8a86f[_0x0049('0x69')],'outboundDropCallsDayACS':_0xe8a86f[_0x0049('0x6a')],'outboundDropCallsDayCallersExit':_0xe8a86f[_0x0049('0x6b')],'outboundDropCallsDayTimeout':_0xe8a86f[_0x0049('0x6c')],'outboundNoAnswerCallsDay':_0xe8a86f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xe8a86f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xe8a86f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xe8a86f[_0x0049('0x6d')],'outboundRejectCallsDay':_0xe8a86f[_0x0049('0x6e')],'outboundUnknownCallsDay':_0xe8a86f[_0x0049('0x6f')],'predictiveIntervalAnsweredCalls':_0xe8a86f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xe8a86f[_0x0049('0x70')],'predictiveIntervalAvgTalktime':_0xe8a86f[_0x0049('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0xe8a86f[_0x0049('0x72')],'predictiveIntervalDroppedCallsTimeout':_0xe8a86f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xe8a86f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xe8a86f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xe8a86f[_0x0049('0x73')],'predictiveIntervalMultiplicativeFactor':_0xe8a86f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xe8a86f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xe8a86f[_0x0049('0x74')],'predictiveIntervalTotalCalls':_0xe8a86f[_0x0049('0x75')],'message':_0xe8a86f[_0x0049('0x45')],'originated':_0xe8a86f[_0x0049('0x76')],'erlangCalls':_0xe8a86f[_0x0049('0x77')],'erlangCallToSecond':_0xe8a86f['erlangCallToSecond'],'erlangAbandonmentRate':_0xe8a86f[_0x0049('0x78')],'erlangBusyFactor':_0xe8a86f[_0x0049('0x79')],'startPredictive':_0xe8a86f[_0x0049('0x2a')],'startProgressive':_0xe8a86f[_0x0049('0x2b')]};if(_0xe8a86f[_0x0049('0x7a')]){_0x3fa25e[_0x0049('0x7a')]={'id':_0xe8a86f['Trunk']['id'],'name':_0xe8a86f[_0x0049('0x7a')]['name'],'active':_0xe8a86f[_0x0049('0x7a')]['active'],'callerid':_0xe8a86f[_0x0049('0x7a')][_0x0049('0x7b')]};}if(_0xe8a86f[_0x0049('0x4a')]){_0x3fa25e[_0x0049('0x4a')]={'id':_0xe8a86f[_0x0049('0x4a')]['id'],'name':_0xe8a86f['Interval'][_0x0049('0x46')]};}var _0x22af22=md5(JSON[_0x0049('0x4f')](_0x3fa25e));if(_0xe8a86f[_0x0049('0x7c')]!==_0x22af22){_0xe8a86f[_0x0049('0x7c')]=_0x22af22;emit(util[_0x0049('0x7d')]('voice:queue:%s',_0x3fa25e[_0x0049('0x46')]),'voice_queue:save',_0x3fa25e);}}}function emitCampaignSummary(_0x770e2a){if(_0x770e2a[_0x0049('0x53')]==='ivr'){emit(util[_0x0049('0x7d')](_0x0049('0x7e'),_0x770e2a[_0x0049('0x46')]),_0x0049('0x7f'),_0x770e2a);}}function checkGetDataPredictive(_0x31bce1){if(isNotNull(_0x31bce1)&&!_[_0x0049('0x4e')](_0x31bce1)){loggerPredictive[_0x0049('0x80')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x0049('0x81'),_0x31bce1[_0x0049('0x75')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x82'),_0x31bce1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0049('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1[_0x0049('0x72')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x83'),_0x31bce1[_0x0049('0x70')]);loggerPredictive[_0x0049('0x80')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0049('0x80')](_0x0049('0x84'));if(_0x31bce1[_0x0049('0x75')]>0x0){if(!_[_0x0049('0x44')](_0x31bce1['predictiveIntervalAvgTalktime'])&&_0x31bce1[_0x0049('0x71')]>0x0){return!![];}loggerPredictive[_0x0049('0x80')](_0x0049('0x85'));if(!_[_0x0049('0x44')](_0x31bce1[_0x0049('0x70')])&&_0x31bce1[_0x0049('0x70')]>0x0){return!![];}loggerPredictive['info'](_0x0049('0x86'));}else{loggerPredictive[_0x0049('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0049('0x80')](_0x0049('0x87'));}return![];}function mergeDataErlangB(_0x58668d){return function(_0x4cb4fd){loggerPredictive[_0x0049('0x80')](_0x0049('0x88'));loggerPredictive[_0x0049('0x80')](_0x0049('0x89'),_0x4cb4fd['erlangCalls']);loggerPredictive['info'](_0x0049('0x8a'),_0x4cb4fd[_0x0049('0x8b')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x8c'),_0x4cb4fd[_0x0049('0x78')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x8d'),_0x4cb4fd[_0x0049('0x79')]);loggerPredictive[_0x0049('0x80')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cb4fd[_0x0049('0x78')]);loggerPredictive['info']('---------------------------');_[_0x0049('0x8e')](_0x58668d,_0x4cb4fd);};}function getDiff(_0xd3bfdd){var _0x21e261=moment()[_0x0049('0x50')](0x0);var _0x5a6550=moment(_0xd3bfdd)[_0x0049('0x50')](0x0);return _0x21e261[_0x0049('0x51')](_0x5a6550,_0x0049('0x8f'));}function ifInterval(_0x327383,_0x4d793a){if(_[_0x0049('0x44')](_0x4d793a)){return![];}return getDiff(_0x4d793a)<_0x327383*0x3c;}function freeVariablesPredictive(_0x137c28){if(isNotNull(_0x137c28)){if(!_['isUndefined'](_0x137c28[_0x0049('0x2b')])){_0x137c28[_0x0049('0x2b')]=undefined;loggerPredictive[_0x0049('0x80')](_0x137c28[_0x0049('0x46')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0049('0x44')](_0x137c28['startPredictive'])){_0x137c28[_0x0049('0x2a')]=undefined;loggerPredictive['info'](_0x137c28['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0049('0x44')](_0x137c28[_0x0049('0x90')])){clearInterval(_0x137c28[_0x0049('0x90')]);_0x137c28[_0x0049('0x90')]=undefined;loggerPredictive[_0x0049('0x80')](_0x137c28[_0x0049('0x46')],_0x0049('0x91'));}}}function erlangb(_0x23588d,_0x2dbdf4){if(_0x2dbdf4===0x0){return 0x0;}var _0x7d642a=0x1;for(var _0x2a2bf0=0x1;_0x2a2bf0<=_0x2dbdf4;_0x2a2bf0+=0x1){_0x7d642a=0x1+_0x7d642a*_0x2a2bf0/_0x23588d;}return 0x1/_0x7d642a;}function isVoiceQueueOutbound(_0x24f836){return _0x24f836===_0x0049('0x54');}function isNotPreview(_0x3d88c6){return _0x3d88c6!==_0x0049('0x20');}function isCampaignIvr(_0x4701a9){return _0x4701a9===_0x0049('0x92');}function getCallerId(_0x1744d3,_0x4bd24b,_0x1460ae){if(!_[_0x0049('0x44')](_0x1460ae)&&typeof _0x1460ae==='string'&&!_[_0x0049('0x4e')](_0x1460ae)){if(!_[_0x0049('0x44')](_0x4bd24b)&&typeof _0x4bd24b==='string'&&!_[_0x0049('0x4e')](_0x4bd24b)){return util[_0x0049('0x7d')]('\x22%s\x22\x20<%s>',_0x4bd24b,_0x1460ae);}return util['format']('\x22%s\x22\x20<%s>',_0x1460ae,_0x1460ae);}if(!_[_0x0049('0x44')](_0x1744d3)&&typeof _0x1744d3==='string'&&!_[_0x0049('0x4e')](_0x1744d3)){return _0x1744d3;}return _0x0049('0x93');}function loggerCatchQueueSummary(_0x1e8554,_0x130086){return function(_0x4cfe61){freeVariablesPredictive(_0x130086);emitVoiceQueueSummary(_0x130086);emitCampaignSummary(_0x130086);loggerSyncQueueSummary['debug'](_0x1e8554,util[_0x0049('0x94')](_0x4cfe61,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3e45c6,_0x41304d){return function(_0x5035dd){loggerPredictive[_0x0049('0x95')](_0x41304d['name'],_0x3e45c6);loggerPredictive[_0x0049('0x95')](_0x5035dd[_0x0049('0x96')]);freeVariablesPredictive(_0x41304d);};}function loggerCatch(_0x489d8c){return function(_0x5dd385){logger[_0x0049('0x95')](_0x489d8c,util[_0x0049('0x94')](_0x5dd385,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d87e6){return _0x3d87e6&&!_[_0x0049('0x44')](_0x3d87e6)&&_0x3d87e6[_0x0049('0x97')]>0x0;}function decremetOriginate(_0x534340){if(!_['isUndefined'](_0x534340)&&_0x534340!==null){if(typeof _0x534340['originated']!=='undefined'){if(_0x534340['originated']>0x0){_0x534340[_0x0049('0x76')]-=0x1;}else{logger[_0x0049('0x95')](_0x0049('0x98'));}}}else{logger[_0x0049('0x95')](_0x0049('0x99'));}}function checkContactLowerLimitOriginate(_0x298e08,_0x35ec4b,_0x207165){if(_0x35ec4b>_0x207165){for(var _0x3ca0c5=0x0;_0x3ca0c5<_0x35ec4b-_0x207165;_0x3ca0c5+=0x1){decremetOriginate(_0x298e08);}}}function loggerGetContactDialer(_0x17c754,_0x1b018b,_0xa82195){return function(_0x442e71){checkContactLowerLimitOriginate(_0x1b018b,_0xa82195,0x0);logger['error'](_0x17c754,util[_0x0049('0x94')](_0x442e71,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x9144ae){return function(_0x5a6e55){if(isNotNull(_0x5a6e55)&&isNotNull(_0x5a6e55[0x0])){if(_0x5a6e55[0x0]['contactsRescheduled']>0x0){_0x9144ae['message']=_0x0049('0x9a');logger['info'](_0x0049('0x9b')+_0x9144ae[_0x0049('0x46')],_0x5a6e55[0x0]['contactsRescheduled'],_0x0049('0x9c'));}else{_0x9144ae[_0x0049('0x45')]=_0x0049('0x9d');logger[_0x0049('0x80')](_0x0049('0x9e')+_0x9144ae[_0x0049('0x46')]);}}};}function notSendMessagesQueue(_0x952a73){if(_0x952a73[_0x0049('0x9f')]){freeVariablesPredictive(_0x952a73);if(_0x952a73['originated']===0x0&&_0x952a73['talking']===0x0&&_0x952a73[_0x0049('0xa0')]===0x0&&(_0x952a73[_0x0049('0x59')]||0x0)===0x0){_0x952a73[_0x0049('0x9f')]=![];_0x952a73[_0x0049('0x57')]=0x0;_0x952a73[_0x0049('0x45')]=_0x0049('0x48');loggerSyncQueueSummary[_0x0049('0xa1')](_0x0049('0xa2'),_0x952a73[_0x0049('0x46')],_0x0049('0xa3'));}else{_0x952a73['message']='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0x0049('0xa2'),_0x952a73[_0x0049('0x46')],_0x0049('0xa4'));}emitVoiceQueueSummary(_0x952a73);}}function notSendMessagesCampaign(_0x183dc9){if(_0x183dc9['sendMessageOneNotActive']){if(_0x183dc9[_0x0049('0x76')]===0x0){_0x183dc9[_0x0049('0x9f')]=![];_0x183dc9[_0x0049('0x45')]=_0x0049('0x48');loggerSyncQueueSummary[_0x0049('0xa1')](_0x0049('0xa5'),_0x183dc9[_0x0049('0x46')],_0x0049('0xa3'));}else{_0x183dc9[_0x0049('0x45')]=_0x0049('0xa6');loggerSyncQueueSummary[_0x0049('0xa1')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x183dc9['name'],_0x0049('0xa4'));}emitCampaignSummary(_0x183dc9);}}function createObjHistory(_0xe01a96,_0x580941,_0x43217c,_0x375a5e,_0x421128){_0xe01a96[_0x0049('0x45')]=_0x43217c;var _0x2a4ca7=new Action(_0xe01a96,_0x580941);var _0x4ff9f0=new History(_0x2a4ca7);_0x4ff9f0['state']=_0x375a5e;_0x4ff9f0[_0x0049('0xa7')]=_0x421128;_0x4ff9f0[_0x0049('0xa8')]=_0x2a4ca7[_0x0049('0xa9')];return _0x4ff9f0;}Dialer[_0x0049('0x1b')]['loopClearZombieChannels']=function(){var _0x46d876=this;setInterval(function(){_0x46d876['clearZombieChannels'](_0x46d876[_0x0049('0x29')],_0x0049('0xaa'));_0x46d876['clearZombieChannels'](_0x46d876[_0x0049('0x27')],_0x0049('0xab'));},0x32c8);};Dialer[_0x0049('0x1b')][_0x0049('0xac')]=function(_0x8eb517,_0x4319d6){var _0x2264b6=this;for(var _0x543667 in _0x8eb517){if(typeof _0x8eb517[_0x543667]!==_0x0049('0xad')){this['sequence']['enqueue'](function(){if(!_[_0x0049('0xae')](_0x8eb517[_0x543667])){return ami[_0x0049('0xaf')]({'action':_0x0049('0xb0'),'channel':_0x8eb517[_0x543667]['channel']})[_0x0049('0xb1')](function(_0x58068b){if(_0x58068b['message']===_0x0049('0xb2')){setTimeout(function(){if(_0x8eb517[_0x543667]&&_0x8eb517[_0x543667][_0x0049('0x53')]!=='ivr'){_0x2264b6[_0x0049('0xb3')](_0x2264b6[_0x0049('0x21')][_0x8eb517[_0x543667][_0x0049('0xb4')]]);logger[_0x0049('0x95')](_0x0049('0xb5'),_0x4319d6,_0x543667,_0x8eb517[_0x543667][_0x0049('0xb4')]);delete _0x8eb517[_0x543667];}if(_0x8eb517[_0x543667]&&_0x8eb517[_0x543667][_0x0049('0x53')]===_0x0049('0x92')){_0x2264b6[_0x0049('0xb3')](_0x2264b6[_0x0049('0x22')][_0x8eb517[_0x543667]['queue']]);logger[_0x0049('0x95')](_0x0049('0xb6'),_0x4319d6,_0x543667,_0x8eb517[_0x543667][_0x0049('0xb4')]);delete _0x8eb517[_0x543667];}},0x2328);}});}});}}};Dialer[_0x0049('0x1b')][_0x0049('0xb7')]=function(_0x216f6f){return BPromise['resolve']()[_0x0049('0x43')](cmHopper['countReScheduled'](_0x216f6f))[_0x0049('0xb1')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0049('0x1b')][_0x0049('0xb8')]=function(_0x3d518f){return BPromise['resolve']()[_0x0049('0x43')](cmHopperBlack[_0x0049('0xb8')](_0x3d518f))[_0x0049('0xb1')](loggerCatch(_0x0049('0xb9')));};Dialer[_0x0049('0x1b')][_0x0049('0xba')]=function(_0x47c4ca,_0x121095,_0x391816){return BPromise[_0x0049('0xbb')]()['then'](cmHopperAdditionalPhone[_0x0049('0xba')](_0x47c4ca,_0x121095,_0x391816))[_0x0049('0xb1')](loggerCatch(_0x0049('0xbc')));};Dialer[_0x0049('0x1b')][_0x0049('0xbd')]=function(_0x4cc193,_0x1a8b83,_0x1a9707){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopperAdditionalPhone[_0x0049('0xbd')](_0x4cc193,_0x1a8b83,_0x1a9707))[_0x0049('0xb1')](loggerCatch(_0x0049('0xbe')));};Dialer[_0x0049('0x1b')][_0x0049('0xbf')]=function(_0x4e5b0f){return BPromise['resolve']()[_0x0049('0x43')](cmHopperBlack[_0x0049('0xbf')](_0x4e5b0f))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0049('0x1b')][_0x0049('0xc0')]=function(_0x369220){return BPromise[_0x0049('0xbb')]()['then'](cmHopperHistory[_0x0049('0xc1')](_0x369220))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc2')));};Dialer[_0x0049('0x1b')]['rescheduleContact']=function(_0x2f9903){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['rescheduleContact'](_0x2f9903))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc3')));};Dialer[_0x0049('0x1b')][_0x0049('0xc4')]=function(_0xa036ec,_0x404660,_0x5e2385){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper[_0x0049('0xc4')](_0xa036ec,_0x404660,_0x5e2385))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc5')));};Dialer[_0x0049('0x1b')]['getContactDialer']=function(_0x1604b8,_0x4afab2,_0x459027,_0x3ef9a9,_0x40efe8){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper[_0x0049('0xc6')](_0x1604b8,_0x4afab2,_0x459027,_0x3ef9a9))['catch'](function(_0x520bed){_0x40efe8[_0x0049('0xc7')]-=_0x459027;_0x40efe8['temp']=_0x40efe8[_0x0049('0xc7')]>0x0?_0x40efe8[_0x0049('0xc7')]:0x0;loggerCatch(_0x0049('0xc8'))(_0x520bed);});};Dialer[_0x0049('0x1b')][_0x0049('0xc9')]=function(_0x3faf71,_0x2fcb98,_0x5c1923,_0x30bf95){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['getContactDialerIvr'](_0x3faf71,_0x2fcb98,_0x5c1923))[_0x0049('0xb1')](function(_0x545284){_0x30bf95['temp']-=_0x2fcb98;_0x30bf95['temp']=_0x30bf95[_0x0049('0xc7')]>0x0?_0x30bf95['temp']:0x0;loggerCatch(_0x0049('0xca'))(_0x545284);});};Dialer[_0x0049('0x1b')]['getVoiceQueueRtPauses']=function(_0x3c0d20){return BPromise['resolve']()['then'](voiceQueueRt[_0x0049('0xcb')](_0x3c0d20))[_0x0049('0xb1')](loggerCatch(_0x0049('0xcc')));};Dialer[_0x0049('0x1b')][_0x0049('0xcd')]=function(_0x4b134){return BPromise['resolve']()[_0x0049('0x43')](cmHopper['moveContactManagedDialer'](_0x4b134))[_0x0049('0xb1')](loggerCatch(_0x0049('0xce')));};Dialer[_0x0049('0x1b')][_0x0049('0xcf')]=function(_0x5816e3){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopperHistory['createHistory'](_0x5816e3))['catch'](loggerCatch(_0x0049('0xd0')));};Dialer[_0x0049('0x1b')]['updateOriginated']=function(_0x36a2fb){if(!_[_0x0049('0x44')](_0x36a2fb)&&_0x36a2fb!==null){if(typeof _0x36a2fb[_0x0049('0x76')]!==_0x0049('0xad')){if(_0x36a2fb[_0x0049('0x76')]>0x0){_0x36a2fb[_0x0049('0x76')]-=0x1;}else{logger[_0x0049('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0049('0xd1'));}};Dialer[_0x0049('0x1b')]['loggerHandler']=function(_0x22d89c,_0x5ec5bf){var _0x3b8c60=this;return function(_0x40953f){_0x3b8c60['updateOriginated'](_0x5ec5bf);logger[_0x0049('0x95')](_0x22d89c,util['inspect'](_0x40953f,{'showHidden':![],'depth':null}));};};Dialer[_0x0049('0x1b')][_0x0049('0xd2')]=function(_0x599dbc,_0x5cb6bd,_0x32648b){var _0x3de464={'state':0x19,'statedesc':_0x0049('0xd3')};this[_0x0049('0xb3')](_0x5cb6bd);this[_0x0049('0xd4')](_['merge'](_0x3de464,_[_0x0049('0xd5')](_0x32648b,['ContactId',_0x0049('0xd6'),_0x0049('0xd7'),_0x0049('0xd8'),_0x0049('0xd9')])),_0x0049('0xda'),_0x0049('0xdb'));logger['error'](_0x599dbc);};Dialer[_0x0049('0x1b')][_0x0049('0xdc')]=function(_0xa0009a){return _0xa0009a===_0x0049('0xdd');};Dialer[_0x0049('0x1b')][_0x0049('0xde')]=function(_0x498c18){return!_[_0x0049('0x44')](_0x498c18)&&_0x498c18&&!_[_0x0049('0x44')](_0x498c18['name'])&&!_[_0x0049('0x44')](_0x498c18[_0x0049('0xdf')])&&_0x498c18['active']&&(this['trunks'][util[_0x0049('0x7d')]('SIP/%s',_0x498c18['name'])]['status']===_0x0049('0xe0')||this[_0x0049('0x24')][util['format'](_0x0049('0xe1'),_0x498c18[_0x0049('0x46')])][_0x0049('0xb0')]==='unmonitored');};Dialer['prototype'][_0x0049('0xd4')]=function(_0x57fd54,_0x356ca1,_0x5b35dc){this['createHistory'](_0x57fd54)[_0x0049('0xb1')](loggerCatch(_0x356ca1));this['moveContactManagedDialer'](_0x57fd54)[_0x0049('0xb1')](loggerCatch(_0x5b35dc));};Dialer[_0x0049('0x1b')][_0x0049('0x3c')]=function(_0x2cbd43){var _0x3d4c62=this[_0x0049('0x29')][_0x2cbd43[_0x0049('0xe2')]];var _0x77a4f6;if(!_['isNil'](_0x2cbd43)&&!_[_0x0049('0xae')](_0x2cbd43['variable'])&&!_[_0x0049('0xae')](_0x2cbd43[_0x0049('0xe3')][_0x0049('0xe4')])&&_0x2cbd43[_0x0049('0xe5')]===_0x0049('0xe6')&&_0x3d4c62){if(_0x3d4c62[_0x0049('0x53')]!==_0x0049('0x92')&&this[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0xe9')){delete this[_0x0049('0x29')][_0x2cbd43[_0x0049('0xe2')]];this[_0x0049('0xb3')](this['voiceQueues'][_0x3d4c62[_0x0049('0xb4')]]);this['voiceQueues'][_0x3d4c62[_0x0049('0xb4')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x3d4c62['queue']][_0x0049('0x65')]+=0x1;_0x77a4f6=new Hangup(_0x3d4c62,_0x2cbd43);_0x77a4f6[_0x0049('0xea')]=0x12;_0x77a4f6['statedesc']=_0x0049('0xeb');_0x77a4f6[_0x0049('0xec')]='AMD';ami['emit']('custom:amd',ut[_0x0049('0xed')](_0x77a4f6,_0x0049('0xee')));this[_0x0049('0xd4')](_0x77a4f6,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x3d4c62[_0x0049('0x53')]!=='ivr'&&this[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]==='MACHINE'){var _0x172505=this;return new BPromise(function(_0x5b2252,_0x2dedd6){delete _0x172505['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];_0x172505['updateOriginated'](_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]]);_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;_0x172505[_0x0049('0x21')][_0x3d4c62['queue']][_0x0049('0x65')]+=0x1;var _0x2239bf=_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]];var _0x41ecb1=new Hangup(_0x3d4c62,_0x2cbd43);_0x41ecb1[_0x0049('0xea')]=0x13;_0x41ecb1[_0x0049('0xa7')]='Machine';_0x41ecb1[_0x0049('0xec')]=_0x0049('0xef');_0x41ecb1[_0x0049('0xf0')]+=0x1;_0x41ecb1['countglobal']+=0x1;_0x41ecb1[_0x0049('0xee')]=!![];ami[_0x0049('0x52')](_0x0049('0xf1'),ut[_0x0049('0xed')](_0x41ecb1,_0x0049('0xee')));_0x172505[_0x0049('0xcf')](_0x41ecb1)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x41ecb1[_0x0049('0xf3')]+_0x41ecb1[_0x0049('0xf4')]+_0x41ecb1[_0x0049('0xf5')]+_0x41ecb1[_0x0049('0xf6')]+_0x41ecb1[_0x0049('0xf7')]+_0x41ecb1['countabandonedretry']+_0x41ecb1[_0x0049('0xf0')]+_0x41ecb1[_0x0049('0xf8')]>=_0x2239bf[_0x0049('0xf9')]){_0x172505[_0x0049('0xfa')](_0x41ecb1,_0x5b2252,_0x2dedd6,_0x0049('0xfb'));}else{if(_0x41ecb1[_0x0049('0xf0')]>=_0x2239bf['dialMachineMaxRetry']){_0x172505['createStateFinal'](_0x41ecb1,_0x5b2252,_0x2dedd6,'reason\x2019\x20machine....');}else{_0x172505[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x41ecb1[_0x0049('0xf0')],'scheduledat':moment()[_0x0049('0xfd')](_0x2239bf[_0x0049('0xfe')],'minutes')[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x41ecb1[_0x0049('0x100')],'ListId':_0x41ecb1[_0x0049('0xd6')],'VoiceQueueId':_0x41ecb1['VoiceQueueId']||undefined,'CampaignId':_0x41ecb1['CampaignId']||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));_0x5b2252({'reschedule':0x1});}}});}if(_0x3d4c62[_0x0049('0x53')]===_0x0049('0x92')&&this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0xe9')){delete this['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];this[_0x0049('0xb3')](this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]]);_0x77a4f6=new Hangup(_0x3d4c62,_0x2cbd43);_0x77a4f6[_0x0049('0xea')]=0x12;_0x77a4f6[_0x0049('0xa7')]=_0x0049('0xeb');_0x77a4f6[_0x0049('0xec')]=_0x0049('0xef');ami[_0x0049('0x52')](_0x0049('0xf1'),ut['buildObj'](_0x77a4f6,'amd'));this[_0x0049('0xd4')](_0x77a4f6,_0x0049('0x102'),'[syncHangupInAMDIvr]');}if(_0x3d4c62['type']===_0x0049('0x92')&&this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0x103')){var _0x172505=this;return new BPromise(function(_0x1481dd,_0x8e166c){delete _0x172505['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];_0x172505['updateOriginated'](_0x172505[_0x0049('0x22')][_0x3d4c62['queue']]);_0x172505[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;_0x172505[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x28c35d=_0x172505['campaigns'][_0x3d4c62['queue']];var _0x196eb9=new Hangup(_0x3d4c62,_0x2cbd43);_0x196eb9[_0x0049('0xea')]=0x13;_0x196eb9['statedesc']='Machine';_0x196eb9[_0x0049('0xec')]=_0x0049('0xef');_0x196eb9[_0x0049('0xf0')]+=0x1;_0x196eb9[_0x0049('0x104')]+=0x1;_0x196eb9[_0x0049('0xee')]=!![];ami[_0x0049('0x52')](_0x0049('0xf1'),ut[_0x0049('0xed')](_0x196eb9,_0x0049('0xee')));_0x172505[_0x0049('0xcf')](_0x196eb9)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x196eb9[_0x0049('0xf3')]+_0x196eb9[_0x0049('0xf4')]+_0x196eb9[_0x0049('0xf5')]+_0x196eb9[_0x0049('0xf6')]+_0x196eb9[_0x0049('0xf7')]+_0x196eb9[_0x0049('0x105')]+_0x196eb9[_0x0049('0xf0')]+_0x196eb9[_0x0049('0xf8')]>=_0x28c35d[_0x0049('0xf9')]){_0x172505['stateGlobal'](_0x196eb9,_0x1481dd,_0x8e166c,_0x0049('0xfb'));}else{if(_0x196eb9[_0x0049('0xf0')]>=_0x28c35d['dialMachineMaxRetry']){_0x172505['createStateFinal'](_0x196eb9,_0x1481dd,_0x8e166c,_0x0049('0x106'));}else{_0x172505[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x196eb9['countmachineretry'],'scheduledat':moment()[_0x0049('0xfd')](_0x28c35d[_0x0049('0xfe')],'minutes')[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x196eb9[_0x0049('0x100')],'ListId':_0x196eb9[_0x0049('0xd6')],'VoiceQueueId':_0x196eb9[_0x0049('0xd8')]||undefined,'CampaignId':_0x196eb9[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));_0x1481dd({'reschedule':0x1});}}});}}};Dialer[_0x0049('0x1b')][_0x0049('0x38')]=function(_0x384480){var _0x43d704=this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];var _0x54fd65=this;var _0x32c53a;if(_0x43d704&&_0x43d704[_0x0049('0x53')]==='ivr'){delete this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];this[_0x0049('0xb3')](this[_0x0049('0x22')][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x22')][_0x43d704['queue']][_0x0049('0x107')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x108')));this[_0x0049('0xcd')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x109')));}if(_0x43d704&&_0x43d704[_0x0049('0x53')]!==_0x0049('0x92')&&isNotNull(this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x10a')])){delete this['uniqueId'][_0x384480['uniqueid']];this[_0x0049('0xb3')](this['voiceQueues'][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;this['voiceQueues'][_0x43d704['queue']][_0x0049('0x65')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);_0x32c53a[_0x0049('0xea')]=0x10;_0x32c53a[_0x0049('0xa7')]=_0x0049('0x10b');_0x32c53a['membername']=_0x0049('0x10c');this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0049('0xcd')](_0x32c53a)['catch'](loggerCatch(_0x0049('0x109')));}if(_0x43d704&&_0x43d704[_0x0049('0x53')]!==_0x0049('0x92')&&!isNotNull(this[_0x0049('0x21')][_0x43d704['queue']][_0x0049('0x10a')])){delete this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];this[_0x0049('0xb3')](this['voiceQueues'][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x6f')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);_0x32c53a[_0x0049('0xea')]=0xc;_0x32c53a[_0x0049('0xa7')]=_0x384480['cause-txt'];_0x32c53a[_0x0049('0xec')]='Unknow';this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x108')));this[_0x0049('0xcd')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x109')));}};Dialer[_0x0049('0x1b')][_0x0049('0x10d')]=function(_0x4a84ce){var _0x3a6770=this[_0x0049('0x29')][_0x4a84ce[_0x0049('0xe2')]];var _0x27521a=this;if(this['voiceQueues'][_0x4a84ce[_0x0049('0xb4')]]){if(_0x3a6770&&_0x3a6770['type']!==_0x0049('0x92')){delete this[_0x0049('0x29')][_0x4a84ce[_0x0049('0xe2')]];this['voiceQueues'][_0x4a84ce['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5378ba=new AgentComplete(_0x3a6770,_0x4a84ce);if(_0x4a84ce[_0x0049('0x10e')]==='agent'){_0x5378ba[_0x0049('0x10f')]=this[_0x0049('0x21')][_0x4a84ce['queue']][_0x0049('0x110')]&&this[_0x0049('0x21')][_0x4a84ce[_0x0049('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0x0049('0x7d')](_0x0049('0xff')):undefined;}this[_0x0049('0xcf')](_0x5378ba)[_0x0049('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0049('0xcd')](_0x5378ba)[_0x0049('0xb1')](loggerCatch(_0x0049('0x111')));}}};Dialer[_0x0049('0x1b')][_0x0049('0x2f')]=function(_0x433d0e){if(this[_0x0049('0x21')][_0x433d0e[_0x0049('0xb4')]]){if(this[_0x0049('0x29')][_0x433d0e[_0x0049('0xe2')]]&&this[_0x0049('0x29')][_0x433d0e[_0x0049('0xe2')]][_0x0049('0x53')]!==_0x0049('0x92')){this['updateOriginated'](this[_0x0049('0x21')][_0x433d0e[_0x0049('0xb4')]]);this[_0x0049('0x29')][_0x433d0e['uniqueid']][_0x0049('0x112')]=moment()[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0049('0x1b')][_0x0049('0x113')]=function(_0x30200d,_0x4b4a7d){this['createHistory'](_0x30200d)[_0x0049('0xb1')](loggerCatch(_0x0049('0x114')));if(_0x4b4a7d==0x0){this['moveContactManagedDialer'](_0x30200d)[_0x0049('0xb1')](loggerCatch(_0x0049('0x115')));}};Dialer['prototype'][_0x0049('0x32')]=function(_0x13f6ac){var _0x29fd92=this[_0x0049('0x29')][_0x13f6ac[_0x0049('0xe2')]];var _0x4bfc32=this;var _0x45c2d4=![];var _0x5bec28;var _0xa7bd3f;if(this[_0x0049('0x21')][_0x13f6ac['queue']]){if(_0x29fd92&&_0x29fd92['type']!==_0x0049('0x92')){delete this[_0x0049('0x29')][_0x13f6ac[_0x0049('0xe2')]];this['updateOriginated'](this['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]]);_0x29fd92[_0x0049('0x116')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));var _0x2945bf=new QueueCallerAbandon(_0x29fd92,_0x13f6ac);if(getSeconds(_0x29fd92['droptime'],_0x29fd92[_0x0049('0x117')])>=_0x29fd92[_0x0049('0x118')]){this[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x119')]+=0x1;this['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x6c')]+=0x1;this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11a')]+=0x1;_0x2945bf[_0x0049('0xea')]=0xa;_0x2945bf[_0x0049('0xa7')]=_0x0049('0x11b');_0x2945bf[_0x0049('0x11c')]=_0x0049('0x11d');_0x2945bf['agiafterat']=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x110')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2945bf[_0x0049('0xf7')]+=0x1;_0x2945bf[_0x0049('0x104')]+=0x1;_0x5bec28=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11e')];_0xa7bd3f=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11f')];_0x4bfc32[_0x0049('0xba')](_0x2945bf,_0x2945bf[_0x0049('0xea')],_0x29fd92[_0x0049('0x120')])[_0x0049('0x43')](function(_0x1bfdfa){_0x45c2d4=_0x1bfdfa[_0x0049('0x121')]==0x1;if(_0x2945bf[_0x0049('0xf7')]>=_0x4bfc32['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x122')]){_0x4bfc32[_0x0049('0x113')](_0x2945bf,_0x1bfdfa[_0x0049('0x121')]);}else{_0x4bfc32[_0x0049('0xfc')]({'active':![],'countdropretry':_0x2945bf[_0x0049('0xf7')],'scheduledat':moment()[_0x0049('0xfd')](_0x4bfc32[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x11e')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x29fd92[_0x0049('0x100')],'ListId':_0x29fd92['ListId'],'VoiceQueueId':_0x29fd92[_0x0049('0xd8')]||undefined,'CampaignId':_0x29fd92[_0x0049('0xd9')]||undefined})['catch'](loggerCatch(_0x0049('0x124')));var _0x328300=new History(_0x2945bf);_0x328300['state']=0xa;_0x328300[_0x0049('0xa7')]=_0x0049('0x11b');_0x328300['starttime']=moment()[_0x0049('0x7d')](_0x0049('0xff'));_0x328300['endtime']=_0x328300[_0x0049('0xa9')];_0x328300[_0x0049('0x125')]=_0x2945bf[_0x0049('0x125')];_0x328300['calleridnum']=_0x2945bf[_0x0049('0x126')];_0x4bfc32['createHistory'](_0x328300)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x0049('0x43')](function(_0x126b8d){if(_0x45c2d4)_0x4bfc32['swapAdditionalPhones'](_0x2945bf,_0x5bec28,_0xa7bd3f)[_0x0049('0x43')](function(_0x314fb1){return 0x1;});});}else{this[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x72')]+=0x1;this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x6b')]+=0x1;_0x2945bf[_0x0049('0xea')]=0xb;_0x2945bf['statedesc']=_0x0049('0x127');_0x2945bf[_0x0049('0x11c')]=_0x0049('0x128');_0x2945bf[_0x0049('0x105')]+=0x1;_0x2945bf[_0x0049('0x104')]+=0x1;_0x5bec28=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]]['dialAbandonedRetryFrequency'];_0xa7bd3f=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11f')];_0x4bfc32['verifyAdditionalPhones'](_0x2945bf,_0x2945bf[_0x0049('0xea')],_0x29fd92['voiceQueue'])[_0x0049('0x43')](function(_0x2cbffb){if(_0x2945bf[_0x0049('0x105')]>=_0x4bfc32[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x129')]){_0x4bfc32['queueCallerAbandonCreateState'](_0x2945bf,_0x2cbffb[_0x0049('0x121')]);}else{_0x4bfc32[_0x0049('0xfc')]({'active':![],'countabandonedretry':_0x2945bf[_0x0049('0x105')],'scheduledat':moment()['add'](_0x4bfc32[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x12a')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x29fd92[_0x0049('0x100')],'ListId':_0x29fd92[_0x0049('0xd6')],'VoiceQueueId':_0x29fd92[_0x0049('0xd8')]||undefined,'CampaignId':_0x29fd92[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x12b')));var _0x350aeb=new History(_0x2945bf);_0x350aeb['state']=0xb;_0x350aeb[_0x0049('0xa7')]=_0x0049('0x127');_0x350aeb[_0x0049('0xa9')]=moment()[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x350aeb[_0x0049('0xa8')]=_0x350aeb[_0x0049('0xa9')];_0x350aeb[_0x0049('0x125')]=_0x2945bf[_0x0049('0x125')];_0x350aeb[_0x0049('0x126')]=_0x2945bf[_0x0049('0x126')];_0x4bfc32[_0x0049('0xcf')](_0x350aeb)[_0x0049('0xb1')](loggerCatch(_0x0049('0x12c')));}})[_0x0049('0x43')](function(_0x1ff80f){if(_0x45c2d4)_0x4bfc32[_0x0049('0xbd')](_0x2945bf,_0x5bec28,_0xa7bd3f)[_0x0049('0x43')](function(_0x4a84da){return 0x1;});});}}}};Dialer[_0x0049('0x1b')][_0x0049('0x3a')]=function(_0x4c3649){if(this[_0x0049('0x27')][_0x4c3649[_0x0049('0xe2')]]){this['actions'][_0x4c3649[_0x0049('0xe2')]][_0x0049('0x12d')]=_0x4c3649['channel'];}if(this[_0x0049('0x29')][_0x4c3649[_0x0049('0xe2')]]){this['uniqueId'][_0x4c3649['uniqueid']]['channel']=_0x4c3649[_0x0049('0x12d')];}};Dialer['prototype'][_0x0049('0x3e')]=function(_0xa68c28){if(strategy[this[_0x0049('0x21')][this['actions'][_0xa68c28[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x55')]]===_0x0049('0x12f')){if(this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]&&_[_0x0049('0xae')](this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]][_0x0049('0x130')])&&_0xa68c28[_0x0049('0xb0')]==='1'&&_0xa68c28['paused']==='0'){if(this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]]){if(!this['agents'][_0xa68c28[_0x0049('0x131')]]['locked']){this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]][_0x0049('0x130')]=!![];this['actions'][_0xa68c28['actionid']][_0x0049('0x130')]=!![];this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]][_0x0049('0x131')]=_0xa68c28['stateinterface'];}}}}else if((strategy[this[_0x0049('0x21')][this['actions'][_0xa68c28['actionid']]['queue']][_0x0049('0x55')]]||_0x0049('0x1a'))===_0x0049('0x1a')){if(this[_0x0049('0x27')][_0xa68c28['actionid']]){if(this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]]){this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]['stateinterface']=_0xa68c28[_0x0049('0x131')];if(_[_0x0049('0xae')](this['queueBooked'][this[_0x0049('0x27')][_0xa68c28['actionid']][_0x0049('0xb4')]])){this['queueBooked'][this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]['queue']]=[];}this['queueBooked'][this['actions'][_0xa68c28[_0x0049('0x12e')]]['queue']]['push'](_[_0x0049('0x8e')](_[_0x0049('0xd5')](this[_0x0049('0x27')][_0xa68c28['actionid']],[_0x0049('0x132'),'stateinterface']),{'status':_0xa68c28[_0x0049('0xb0')],'paused':_0xa68c28[_0x0049('0x133')]}));}}}};function unlockQueueStatus(_0x3d1c31,_0x4e7b4b){setTimeout(function(){if(_[_0x0049('0x44')](_0x3d1c31[_0x0049('0x134')])){loggerBooked[_0x0049('0x95')](_0x0049('0x135'),_0x4e7b4b);}_0x3d1c31[_0x0049('0x134')]=!![];loggerBooked[_0x0049('0x80')](_0x0049('0x136'),_0x4e7b4b,JSON[_0x0049('0x4f')](_[_0x0049('0xd5')](_0x3d1c31,[_0x0049('0x46'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x0049('0x1b')][_0x0049('0x40')]=function(_0x15cbec){var _0x5290bc=this;var _0x1d06e0=_0x5290bc[_0x0049('0x21')][_0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']]['queue']];if(strategy[this['voiceQueues'][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]['queue']][_0x0049('0x55')]]===_0x0049('0x12f')){if(this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]&&this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')]){this[_0x0049('0x20')]['run'](this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x132')],this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')])[_0x0049('0xb1')](function(_0xcdfdd6){logger[_0x0049('0x95')](_0x0049('0x137'),util[_0x0049('0x94')](_0xcdfdd6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5290bc[_0x0049('0xb3')](_0x5290bc['voiceQueues'][_0x5290bc[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]);_0x5290bc[_0x0049('0x23')][_0x5290bc['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')]]['locked']=![];delete _0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']];unlockQueueStatus(_0x1d06e0);});}else{this[_0x0049('0xb3')](this[_0x0049('0x21')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]);this[_0x0049('0xfc')]({'active':![],'ContactId':this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x100')],'ListId':this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xd6')],'VoiceQueueId':this[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xd8')]||undefined,'CampaignId':this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x15cbec[_0x0049('0x12e')]];unlockQueueStatus(_0x1d06e0);}}else if((strategy[this[_0x0049('0x21')][this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x55')]]||_0x0049('0x1a'))===_0x0049('0x1a')){var _0x747fd2;if(this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]&&!_[_0x0049('0x4e')](this['queueBooked'][this['actions'][_0x15cbec['actionid']][_0x0049('0xb4')]])){if(this[_0x0049('0x2d')][_0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xb4')]]){this['queueBookedRR'][_0x5290bc[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]=this[_0x0049('0x2d')][this['actions'][_0x15cbec['actionid']][_0x0049('0xb4')]]?this[_0x0049('0x2d')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]:this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]?this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x138')]||0x0:0x0;}this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xb4')]]['_rr']=this[_0x0049('0x2d')][this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]];for(var _0x38949d=0x0;_0x38949d=0x0;})[_0x0049('0xb1')](myreject(_0x107ded)));}}else{_0x2f14c5[_0x0049('0x151')](ami[_0x0049('0xaf')]({'action':_0x0049('0x14e'),'command':util['format'](_0x0049('0x152'),_0x58ef1d,!_[_0x0049('0x44')](config[_0x0049('0x14b')][_0x1a5b9e])?_0x1a5b9e:'')})[_0x0049('0x43')](function(_0x1caa01){return _0x1caa01[_0x0049('0x14f')][_0x0049('0x153')](_0x0049('0x150'))>=0x0;})['catch'](myreject(_0x107ded)));}BPromise['all'](_0x2f14c5)[_0x0049('0x43')](function(_0x382738){var _0x587090=_['some'](_0x382738);if(_0x587090){return _0x1015f4(_0x587090);}else{_0x1817b5[_0x0049('0x45')]=_0x477071?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0049('0x154');return _0x107ded(msgResponse(_0x0049('0x155'),_0x0049('0x148'),_0x0049('0x156')+_0x477071+'\x20'+_0xe5ffbb+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0049('0x94')](_0x58ef1d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1a5b9e));}})['catch'](function(_0x18f06d){return _0x107ded(msgResponse(_0x0049('0x146'),_0x0049('0x148'),JSON[_0x0049('0x4f')](_0x18f06d)));});});};Dialer['prototype'][_0x0049('0x157')]=function(_0x45a7a4){var _0x2d0194=this;return function(){switch(_0x45a7a4['dialMethod']){case _0x0049('0x158'):freeVariablesPredictive(_0x45a7a4);_0x2d0194['handlePower'](_0x45a7a4,0x1);break;case _0x0049('0x159'):freeVariablesPredictive(_0x45a7a4);_0x2d0194[_0x0049('0x15a')](_0x45a7a4,_0x45a7a4[_0x0049('0x15b')]);break;case _0x0049('0x7'):_0x2d0194[_0x0049('0x7')](_0x45a7a4);break;case _0x0049('0x6'):freeVariablesPredictive(_0x45a7a4);_0x2d0194[_0x0049('0x15a')](_0x45a7a4,0x1);break;default:freeVariablesPredictive(_0x45a7a4);logger['error'](_0x0049('0x15c'),_0x45a7a4[_0x0049('0x46')],_0x0049('0x15d'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x46f442){var _0x6c881a=this;return function(){_0x6c881a[_0x0049('0x15e')](_0x46f442);};};Dialer[_0x0049('0x1b')][_0x0049('0x9')]=function(_0x3f6b5a){var _0x4abb50=this;if(isNotPreview(_0x3f6b5a[_0x0049('0x63')])){if(isVoiceQueueOutbound(_0x3f6b5a['type'])&&isActive(_0x3f6b5a[_0x0049('0x62')])){_0x3f6b5a[_0x0049('0x9f')]=!![];BPromise[_0x0049('0xbb')]()['then'](checkIsLoggedIn(_0x3f6b5a,_0x3f6b5a['loggedIn']))[_0x0049('0x43')](checkIsActive(_0x3f6b5a,_0x3f6b5a['dialActive']))[_0x0049('0x43')](checkInterval(_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x142')](_0x3f6b5a))['then'](_0x4abb50[_0x0049('0x145')](_0x3f6b5a[_0x0049('0x15f')],_0x3f6b5a[_0x0049('0x160')],_0x3f6b5a[_0x0049('0x46')],_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x147')](_0x3f6b5a[_0x0049('0x4a')],_0x3f6b5a[_0x0049('0x160')],_0x3f6b5a[_0x0049('0x46')],_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x157')](_0x3f6b5a))['catch'](loggerCatchQueueSummary(_0x0049('0x161'),_0x3f6b5a));}else{notSendMessagesQueue(_0x3f6b5a);}}else{freeVariablesPredictive(_0x3f6b5a);}};Dialer[_0x0049('0x1b')][_0x0049('0x162')]=_['throttle'](function(){var _0x5226a6=_[_0x0049('0x163')](this[_0x0049('0x21')],function(_0x3d399f){return _0x3d399f[_0x0049('0x164')];});var _0x4daeed=_[_0x0049('0x163')](this[_0x0049('0x23')],function(_0x4fcb49){return _0x4fcb49[_0x0049('0x165')]&&_0x4fcb49[_0x0049('0xb0')]==='reachable';});if(_0x5226a6[_0x0049('0x97')]>0x0&&_0x4daeed[_0x0049('0x97')]>0x0){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x5226a6,'id'),previewRecallmeReminderInterval,_[_0x0049('0x166')](_0x4daeed,'id')))[_0x0049('0x43')](function(_0x19050a){for(var _0x1bb9d6=0x0;_0x1bb9d6<_0x19050a[_0x0049('0x97')];_0x1bb9d6++){var _0x522aa2=_0x19050a[_0x1bb9d6][_0x0049('0x167')][_0x0049('0x46')];if(_0x522aa2)io['to'](util[_0x0049('0x7d')]('user:%s',_0x522aa2))[_0x0049('0x52')]('user:dialPreviewRecallReminder',{'hopper':_0x19050a[_0x1bb9d6]});}})[_0x0049('0xb1')](function(_0x3c7774){logger[_0x0049('0x95')]('checkPreviewRecallReminder',_0x3c7774);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0049('0x141')]=function(){var _0x42d4ac=this;var _0x15ded0;for(var _0xe94d54 in this[_0x0049('0x22')]){if(typeof this['campaigns'][_0xe94d54]!==_0x0049('0xad')){_0x15ded0=this[_0x0049('0x22')][_0xe94d54];if(isCampaignIvr(_0x15ded0[_0x0049('0x53')])&&isActive(_0x15ded0[_0x0049('0xdf')])){_0x15ded0['sendMessageOneNotActive']=!![];BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](checkIsActive(_0x15ded0,_0x15ded0[_0x0049('0xdf')]))[_0x0049('0x43')](checkInterval(_0x15ded0))[_0x0049('0x43')](_0x42d4ac[_0x0049('0x142')](_0x15ded0))[_0x0049('0x43')](_0x42d4ac['checkIfTime'](_0x15ded0[_0x0049('0x15f')],_0x15ded0[_0x0049('0x160')],_0x15ded0[_0x0049('0x46')],_0x15ded0))[_0x0049('0x43')](_0x42d4ac['checkIfTimeIntervals'](_0x15ded0[_0x0049('0x4a')],_0x15ded0[_0x0049('0x160')],_0x15ded0[_0x0049('0x46')],_0x15ded0))[_0x0049('0x43')](_0x42d4ac[_0x0049('0x168')](_0x15ded0))['catch'](loggerCatchQueueSummary(_0x0049('0x169'),_0x15ded0));}else{notSendMessagesCampaign(_0x15ded0);}}}};function getCallerIdRandom(_0x27477b,_0x7fd5f0){var _0x7d2f85;var _0x5e0010;var _0x1bbba7;if(_0x7fd5f0<=0x0){_0x7fd5f0=0x1;}_0x7d2f85=new RegExp(_0x0049('0x16a')+_0x7fd5f0+'}$');_0x5e0010=Math[_0x0049('0x16b')](0xa,_0x7fd5f0-0x1);_0x1bbba7=Math['pow'](0xa,_0x7fd5f0)-0x1;return util[_0x0049('0x7d')]('%s',_['replace'](_0x27477b,_0x7d2f85,_[_0x0049('0x16c')](_0x5e0010,_0x1bbba7)));}function extractCalleridName(_0xd6ccae){var _0x430083=_0xd6ccae[_0x0049('0x16d')](/"(.*?)"/);return _0x430083?_0x430083[0x1]:_0xd6ccae;}function extractCalleridNumber(_0x50ba91){var _0x985ea0=_0x50ba91[_0x0049('0x16d')](/<(.*?)>/);return _0x985ea0?_0x985ea0[0x1]:_0x50ba91;}Dialer[_0x0049('0x1b')][_0x0049('0x16e')]=function(_0x3dec60,_0x3425a6){var _0x3eaa4c=this;var _0x136bd7=uuid['v4']();this[_0x0049('0x27')][_0x136bd7]=new Action(_0x3dec60,_0x3425a6,_0x136bd7);return new BPromise(function(_0x4d2613,_0x2d2cb0){if(_[_0x0049('0x44')](_0x3dec60)&&typeof _0x3dec60!==_0x0049('0x16f')){return _0x2d2cb0(msgResponse('originate',_0x0049('0x148'),'voiceQueue\x20is\x20undefine'));}if(_[_0x0049('0x44')](_0x3425a6[_0x0049('0x170')])||_0x3425a6[_0x0049('0x170')]===null){return _0x2d2cb0(msgResponse(_0x0049('0x171'),'Failure',_0x0049('0x172')));}var _0x1f5d06={'XMD-CALLERID':_0x3eaa4c[_0x0049('0x27')][_0x136bd7][_0x0049('0x173')](),'XMD-AGI':_0x3dec60['dialQueueProject']?util[_0x0049('0x7d')](_0x0049('0x174'),ipAgi,_0x3dec60['dialQueueProject']):_0x0049('0x175'),'XMD-AGIAFTER':_0x3dec60[_0x0049('0x110')]?util['format'](_0x0049('0x174'),ipAgi,_0x3dec60['dialQueueProject2']):_0x0049('0x175'),'XMD-QUEUE':_0x3dec60[_0x0049('0x53')]===_0x0049('0x54')?util[_0x0049('0x7d')](_0x0049('0x176'),_0x3dec60[_0x0049('0x46')],_0x3dec60['dialQueueOptions']||'',_0x3dec60[_0x0049('0x177')]?'c':'',_0x3dec60[_0x0049('0x118')]||0x3):_0x0049('0x175'),'XMD-CONTACTID':_0x3425a6[_0x0049('0x100')],'XMD-CDRTYPE':_0x0049('0x5'),'CALLERID(all)':_0x3eaa4c['actions'][_0x136bd7][_0x0049('0x173')](),'XMD-AMD':_0x3dec60[_0x0049('0xe7')]?_0x0049('0x178'):_0x0049('0x175'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3dec60[_0x0049('0xe7')]){_0x1f5d06[_0x0049('0x179')]=_0x3dec60[_0x0049('0x17a')]||0x9c4;_0x1f5d06[_0x0049('0x17b')]=_0x3dec60['dialAMDGreeting']||0x5dc;_0x1f5d06[_0x0049('0x17c')]=_0x3dec60[_0x0049('0x17d')]||0x320;_0x1f5d06[_0x0049('0x17e')]=_0x3dec60[_0x0049('0x17f')]||0x1388;_0x1f5d06[_0x0049('0x180')]=_0x3dec60[_0x0049('0x181')]||0x64;_0x1f5d06['XMD-AMDBETWEENWORDSSILENCE']=_0x3dec60[_0x0049('0x182')]||0x32;_0x1f5d06[_0x0049('0x183')]=_0x3dec60[_0x0049('0x184')]||0x3;_0x1f5d06[_0x0049('0x185')]=_0x3dec60['dialAMDSilenceThreshold']||0x100;_0x1f5d06[_0x0049('0x186')]=_0x3dec60[_0x0049('0x187')]||0x1388;}if(_0x3dec60['type']==='outbound'){_0x1f5d06[_0x0049('0x188')]=_0x3425a6[_0x0049('0xd8')];}else{_0x1f5d06[_0x0049('0x189')]=_0x3425a6[_0x0049('0xd9')];}for(var _0x4328c3 in _0x3425a6['Contact']){if(typeof _0x3425a6[_0x0049('0x18a')][_0x4328c3]!==_0x0049('0xad')){if(isNotNull(_0x3425a6[_0x0049('0x18a')][_0x4328c3])&&_0x4328c3!=='id'&&_0x4328c3!==_0x0049('0x18b')&&_0x4328c3!==_0x0049('0x18c')&&_0x4328c3!==_0x0049('0x18d')){_0x1f5d06[util[_0x0049('0x7d')]('%s%s',_0x0049('0x18e'),_[_0x0049('0x18f')](_0x4328c3))]=_0x3425a6[_0x0049('0x18a')][_0x4328c3];}}}var _0x5c1807=_0x3eaa4c[_0x0049('0xde')](_0x3dec60[_0x0049('0x7a')])?getCallerId(_0x3dec60[_0x0049('0x7a')][_0x0049('0x7b')],_0x3dec60[_0x0049('0x190')],_0x3dec60[_0x0049('0x191')]>0x0?getCallerIdRandom(_0x3dec60[_0x0049('0x192')],_0x3dec60[_0x0049('0x191')]):_0x3dec60[_0x0049('0x192')]):getCallerId(_[_0x0049('0xae')](_0x3dec60[_0x0049('0x143')])?_0x3dec60['Trunk'][_0x0049('0x7b')]:_0x3dec60['TrunkBackup'][_0x0049('0x7b')],_0x3dec60['dialOriginateCallerIdName'],_0x3dec60['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3dec60[_0x0049('0x192')],_0x3dec60['dialRandomLastDigitCallerIdNumber']):_0x3dec60[_0x0049('0x192')]);if(_0x5c1807){_0x1f5d06[_0x0049('0x193')]=_0x3eaa4c[_0x0049('0x27')][_0x136bd7][_0x0049('0x194')]=extractCalleridName(_0x5c1807);_0x1f5d06[_0x0049('0x195')]=_0x3425a6[_0x0049('0x170')];}return ami[_0x0049('0xaf')]({'actionid':_0x136bd7,'action':_0x0049('0x171'),'channel':_0x3eaa4c['isTrunkReachable'](_0x3dec60[_0x0049('0x7a')])?util[_0x0049('0x7d')](_0x0049('0x196'),_0x3dec60[_0x0049('0x7a')][_0x0049('0x46')],isNotNull(_0x3dec60[_0x0049('0x197')])?_0x3dec60[_0x0049('0x197')][_0x0049('0x198')]()||'':'',_0x3dec60[_0x0049('0x199')]>0x0?_0x3425a6[_0x0049('0x170')][_0x0049('0x19a')](_0x3dec60[_0x0049('0x199')]):_0x3425a6[_0x0049('0x170')]):util[_0x0049('0x7d')](_0x0049('0x196'),_[_0x0049('0xae')](_0x3dec60[_0x0049('0x143')])?_0x3dec60[_0x0049('0x7a')][_0x0049('0x46')]:_0x3dec60[_0x0049('0x143')]['name'],isNotNull(_0x3dec60['dialPrefix'])?_0x3dec60['dialPrefix'][_0x0049('0x198')]()||'':'',_0x3dec60[_0x0049('0x199')]>0x0?_0x3425a6[_0x0049('0x170')][_0x0049('0x19a')](_0x3dec60[_0x0049('0x199')]):_0x3425a6['phone']),'callerid':_0x5c1807,'Exten':_0x0049('0xe6'),'Context':_0x0049('0x19b'),'Priority':'1','variable':_0x1f5d06,'timeout':(_0x3dec60[_0x0049('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x136bd7})['then'](function(_0x23b67e){return _0x4d2613(_0x23b67e);})['catch'](function(_0x2ebad4){_0x3dec60[_0x0049('0x19c')]+=0x1;var _0x192514=new History(_0x3eaa4c[_0x0049('0x27')][_0x136bd7]);logger[_0x0049('0x95')](util['format']('[originateError]:\x20%s',JSON[_0x0049('0x4f')](_0x2ebad4)));_0x192514['state']=0xe;_0x192514['statedesc']=_0x0049('0x19d');_0x192514[_0x0049('0xa9')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));_0x192514[_0x0049('0xa8')]=_0x192514[_0x0049('0xa9')];_0x3eaa4c[_0x0049('0xcf')](_0x192514)[_0x0049('0xb1')](loggerCatch('[originate][error]'));_0x3eaa4c['moveContactManagedDialer'](_0x192514)[_0x0049('0xb1')](loggerCatch(_0x0049('0x19e')))[_0x0049('0x1e')](function(){delete _0x3eaa4c[_0x0049('0x27')][_0x136bd7];return _0x2d2cb0(msgResponse(_0x0049('0x171'),_0x0049('0x19f'),_0x0049('0x1a0')));});});});};Dialer['prototype'][_0x0049('0x34')]=function(_0x42cecc){var _0x40655c=this['actions'][_0x42cecc[_0x0049('0x12e')]];if(_0x40655c){delete this['actions'][_0x42cecc[_0x0049('0x12e')]];_0x40655c[_0x0049('0x117')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));var _0x190c32=_0x40655c[_0x0049('0x53')]===_0x0049('0x92')?this['campaigns'][_0x40655c[_0x0049('0xb4')]]:this[_0x0049('0x21')][_0x40655c[_0x0049('0x1a1')]()];if(!this[_0x0049('0xdc')](_0x42cecc[_0x0049('0x1a2')])){this['updateOriginated'](_0x190c32);return this[_0x0049('0x1a3')](_0x40655c,_0x190c32,_0x42cecc)[_0x0049('0xb1')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x0049('0x29')][_0x42cecc[_0x0049('0xe2')]]=_0x40655c;}};Dialer[_0x0049('0x1b')][_0x0049('0x1a4')]=function(_0x4289be,_0x1c5164,_0x2803ec){var _0x19fae5=new History(_0x1c5164);if(_0x19fae5[_0x0049('0xf3')]+_0x19fae5[_0x0049('0xf4')]+_0x19fae5[_0x0049('0xf5')]+_0x19fae5[_0x0049('0xf6')]+_0x19fae5[_0x0049('0xf7')]+_0x19fae5[_0x0049('0x105')]+_0x19fae5['countmachineretry']+_0x19fae5[_0x0049('0xf8')]>=_0x2803ec[_0x0049('0xf9')]-0x1){return!![];}switch(_0x4289be){case 0x3:if(_0x19fae5[_0x0049('0xf5')]>=_0x2803ec[_0x0049('0x1a5')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countnoanswerretry':_0x19fae5[_0x0049('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1a6')],'minutes')['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5['VoiceQueueId']||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x19fae5[_0x0049('0xf3')]>=_0x2803ec[_0x0049('0x1a7')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countbusyretry':_0x19fae5['countbusyretry']+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x1a8')],'minutes')['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1a9')));break;case 0x8:if(_0x19fae5[_0x0049('0xf4')]>=_0x2803ec[_0x0049('0x1aa')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x19fae5[_0x0049('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1ab')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1ac')));break;case 0x0:if(_0x19fae5['countnosuchnumberretry']>=_0x2803ec['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x0049('0xfc')]({'active':![],'countnosuchnumberretry':_0x19fae5[_0x0049('0xf6')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x1ad')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})['catch'](loggerCatch(_0x0049('0x1ae')));}break;case 0xa:if(_0x19fae5['countdropretry']>=_0x2803ec[_0x0049('0x122')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countdropretry':_0x19fae5[_0x0049('0xf7')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x11e')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x124')));break;case 0xb:if(_0x19fae5[_0x0049('0x105')]>=_0x2803ec['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countabandonedretry':_0x19fae5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x12a')],_0x0049('0x123'))[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x12b')));break;case 0x13:if(_0x19fae5['countmachineretry']>=_0x2803ec[_0x0049('0x1af')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x19fae5[_0x0049('0xf0')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec['dialMachineRetryFrequency'],_0x0049('0x123'))[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fae5['ContactId'],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5['VoiceQueueId']||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));break;case 0x14:if(_0x19fae5[_0x0049('0xf8')]>=_0x2803ec['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countagentrejectretry':_0x19fae5[_0x0049('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1b0')],_0x0049('0x123'))['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5['ListId'],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x0049('0x1b')]['callProgressDetecting']=function(_0xb15b6d,_0x1cfb68,_0x14e8bd){var _0x2b3629=this;var _0x1e0de6=new History(_0xb15b6d);var _0x5d2129=![];var _0x2e1342;var _0x5306ff;return new BPromise(function(_0x104904,_0x1a221b){if(_[_0x0049('0x44')](_0x1cfb68)&&typeof _0x1cfb68!==_0x0049('0x16f')){return _0x1a221b(msgResponse(_0x0049('0x1b1'),_0x0049('0x148'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x14e8bd)&&typeof _0x14e8bd!==_0x0049('0x16f')){return _0x1a221b(msgResponse('[callProgressDetecting]','Failure',_0x0049('0x1b2')));}_0x2b3629[_0x0049('0xba')](_0x1e0de6,_0x14e8bd[_0x0049('0x10e')],_0x1cfb68)[_0x0049('0x43')](function(_0x590480){if(_0x590480['additional']==0x1)_0x5d2129=!![];switch(_0x14e8bd[_0x0049('0x10e')]){case'0':_0x1cfb68[_0x0049('0x1b3')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x0;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1b4');_0x1e0de6[_0x0049('0xf6')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;ami[_0x0049('0x52')](_0x0049('0x1b5'),ut['buildObj'](_0xb15b6d,_0x0049('0x1b6')));_0x2e1342=_0x1cfb68[_0x0049('0x1ad')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629[_0x0049('0xcf')](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x2b3629[_0x0049('0x1a4')](0x0,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf6')]>=_0x1cfb68[_0x0049('0x1b7')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,'reason\x200\x20no\x20such\x20number....');}else{_0x2b3629['stateGlobal'](_0x1e0de6,_0x104904,_0x1a221b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1cfb68[_0x0049('0x1b9')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x3;_0x1e0de6[_0x0049('0xa7')]='NoAnswer';_0x1e0de6[_0x0049('0xf5')]+=0x1;_0x1e0de6['countglobal']+=0x1;ami[_0x0049('0x52')](_0x0049('0x1ba'),ut['buildObj'](_0xb15b6d,_0x0049('0x1bb')));_0x2e1342=_0x1cfb68[_0x0049('0x1a6')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1bc')));if(_0x2b3629[_0x0049('0x1a4')](0x3,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf5')]>=_0x1cfb68[_0x0049('0x1a5')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1bd'));}}break;case'5':_0x1cfb68[_0x0049('0x68')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x5;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1be');_0x1e0de6['countbusyretry']+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;ami[_0x0049('0x52')](_0x0049('0x1bf'),ut[_0x0049('0xed')](_0xb15b6d,_0x0049('0x1c0')));_0x2e1342=_0x1cfb68[_0x0049('0x1a8')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2b3629['checkRetriveMax'](0x5,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countbusyretry']>=_0x1cfb68['dialBusyMaxRetry']){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c1'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c1'));}}break;case'8':_0x1cfb68[_0x0049('0x69')]+=0x1;_0x1e0de6['state']=0x8;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1c2');_0x1e0de6[_0x0049('0xf4')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68['dialCongestionRetryFrequency'];_0x5306ff=_0x1cfb68['callAdditionalPhoneAfterMin'];ami[_0x0049('0x52')]('custom:agentcongestion',ut[_0x0049('0xed')](_0xb15b6d,_0x0049('0x1c3')));_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1c4')));if(_0x2b3629[_0x0049('0x1a4')](0x8,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf4')]>=_0x1cfb68[_0x0049('0x1aa')]){_0x2b3629['createStateFinal'](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c5'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c5'));}}break;case'11':_0x1cfb68[_0x0049('0x1c6')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0xb;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x127');_0x1e0de6[_0x0049('0x105')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68[_0x0049('0x12a')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x12c')));if(_0x2b3629[_0x0049('0x1a4')](0xb,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countabandonedretry']>=_0x1cfb68[_0x0049('0x129')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c7'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c7'));}}break;case'20':_0x1cfb68[_0x0049('0x6e')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x14;_0x1e0de6[_0x0049('0xa7')]='AgentReject';_0x1e0de6[_0x0049('0xf8')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68[_0x0049('0x1b0')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];ami[_0x0049('0x52')](_0x0049('0x1c8'),ut['buildObj'](_0xb15b6d,_0x0049('0x1c9')));_0x2b3629['createHistory'](_0x1e0de6)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2b3629[_0x0049('0x1a4')](0x14,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countagentrejectretry']>=_0x1cfb68['dialAgentRejectMaxRetry']){_0x2b3629['createStateFinal'](_0x1e0de6,_0x104904,_0x1a221b,'reason\x2020\x20agentreject');}else{_0x2b3629['stateGlobal'](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1ca'));}}break;default:_0x1cfb68[_0x0049('0x6f')]+=0x1;_0x1e0de6['state']=0xc;_0x1e0de6[_0x0049('0xa7')]=_0x14e8bd[_0x0049('0x10e')];_0x2e1342=_0x1cfb68[_0x0049('0x1b0')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629[_0x0049('0xcf')](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1cb')));if(_0x2b3629[_0x0049('0x1a4')](_0x14e8bd['reason'],_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf3')]+_0x1e0de6[_0x0049('0xf4')]+_0x1e0de6[_0x0049('0xf5')]+_0x1e0de6[_0x0049('0xf6')]+_0x1e0de6['countdropretry']+_0x1e0de6['countabandonedretry']+_0x1e0de6[_0x0049('0xf0')]+_0x1e0de6[_0x0049('0xf8')]>=_0x1cfb68['dialGlobalMaxRetry']){_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x14e8bd[_0x0049('0x10e')]);}else{_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x14e8bd[_0x0049('0x10e')]);}}}})[_0x0049('0x43')](function(_0x5228c5){if(_0x5d2129){_0x2b3629[_0x0049('0xbd')](_0x1e0de6,_0x2e1342,_0x5306ff)[_0x0049('0x43')](function(_0x16bbf3){return _0x104904(0x1);});}});});};Dialer[_0x0049('0x1b')][_0x0049('0xfa')]=function(_0x47a26a,_0x34fa4f,_0x37070a,_0x386b2e){var _0x5012ef=new Final(_0x47a26a);_0x5012ef[_0x0049('0xea')]=0xf;_0x5012ef[_0x0049('0xa7')]='Global';this[_0x0049('0x1b8')](_0x5012ef,_0x34fa4f,_0x37070a,_0x386b2e);};Dialer[_0x0049('0x1b')][_0x0049('0x1b8')]=function(_0x3956fa,_0x44a806,_0x2010b8,_0x1b93f9){this[_0x0049('0xcd')](_0x3956fa)[_0x0049('0x43')](function(){return _0x44a806(msgResponse(_0x0049('0x1b1'),'Success',_0x1b93f9));})[_0x0049('0xb1')](function(){return _0x2010b8(msgResponse(_0x0049('0x1cc'),_0x0049('0x148'),_0x0049('0x1cd')));});};Dialer[_0x0049('0x1b')][_0x0049('0x7')]=function(_0x7e7126){var _0x1485a9=_0x7e7126['dialPredictiveOptimizationPercentage']/0x64;var _0x19603c=_0x7e7126[_0x0049('0x6c')]/(_0x7e7126[_0x0049('0x6c')]+_0x7e7126['outboundAnswerCallsDay']);var _0x213021=Math['round'](_0x7e7126['predictiveIntervalAvailable']*(_0x7e7126['predictiveIntervalMaxThreshold']/0x64));var _0x764c71=Math[_0x0049('0x1ce')](_0x7e7126[_0x0049('0x74')]*(_0x7e7126[_0x0049('0x1cf')]/0x64));var _0x537fd6=_0x7e7126[_0x0049('0x57')]+_0x7e7126[_0x0049('0x5d')];var _0x134354=Math[_0x0049('0x1d0')](_0x7e7126['erlangCalls']*_0x7e7126[_0x0049('0x78')]*_0x7e7126[_0x0049('0x73')]*_0x7e7126[_0x0049('0x1d1')]);if(_['isUndefined'](_0x7e7126['startProgressive'])){if(!_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2a')])){_0x7e7126['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x7e7126[_0x0049('0x90')])){loggerPredictive[_0x0049('0x95')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x7e7126[_0x0049('0x90')]);_0x7e7126['handlePredictive']=undefined;}_0x7e7126[_0x0049('0x2b')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x7e7126[_0x0049('0x2b')]);this[_0x0049('0x15a')](_0x7e7126,0x1);}else if(ifInterval(_0x7e7126[_0x0049('0x1d2')],_0x7e7126['startProgressive'])){this[_0x0049('0x15a')](_0x7e7126,0x1);loggerPredictiveCalls['info'](_0x0049('0x1d3'),_0x7e7126[_0x0049('0x2b')],_0x7e7126[_0x0049('0x46')]);_0x7e7126[_0x0049('0x77')]=0x0;_0x7e7126[_0x0049('0x11a')]=0x0;}else if(_0x1485a9<_0x19603c&&_0x7e7126[_0x0049('0x1d4')]===_0x0049('0x1d5')){freeVariablesPredictive(_0x7e7126);loggerPredictive['info'](_0x0049('0x1d6'),_0x0049('0x1d7'),_0x19603c,'startProgressive',_0x7e7126[_0x0049('0x46')]);}else if(_0x134354<_0x7e7126['predictiveIntervalErlangCallsDroppedCalls']&&_0x7e7126[_0x0049('0x1d4')]===_0x0049('0x1d5')){freeVariablesPredictive(_0x7e7126);loggerPredictive[_0x0049('0x80')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x0049('0x1d8'),_0x134354,_0x0049('0x1d9'),_0x7e7126[_0x0049('0x11a')],'startProgressive',_0x7e7126[_0x0049('0x46')]);}else if(!ifInterval(_0x7e7126['dialPredictiveInterval'],_0x7e7126[_0x0049('0x2b')])&&_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2a')])&&!_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2b')])){_0x7e7126[_0x0049('0x2a')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126['name'],_0x0049('0x1da'),_0x7e7126['startPredictive']);this['averageHandleTime'](_0x7e7126['dialPredictiveInterval'])[_0x0049('0x43')](this['getDataPredictive'](_0x7e7126))[_0x0049('0x43')](mergeDataErlangB(_0x7e7126))[_0x0049('0x43')](this[_0x0049('0x1db')](_0x7e7126))['catch'](loggerCatchPredictive(_0x0049('0x1dc'),_0x7e7126));}else if(!ifInterval(_0x7e7126[_0x0049('0x1d2')],_0x7e7126['startPredictive'])){_0x7e7126[_0x0049('0x11a')]=0x0;_0x7e7126[_0x0049('0x2a')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],'recalculate\x20predictive\x20at',_0x7e7126[_0x0049('0x2a')]);clearInterval(_0x7e7126['handlePredictive']);_0x7e7126[_0x0049('0x90')]=undefined;this[_0x0049('0xc0')](_0x7e7126['dialPredictiveInterval'])[_0x0049('0x43')](this[_0x0049('0x1dd')](_0x7e7126))[_0x0049('0x43')](mergeDataErlangB(_0x7e7126))[_0x0049('0x43')](this[_0x0049('0x1db')](_0x7e7126))['catch'](loggerCatchPredictive(_0x0049('0x1de'),_0x7e7126));}else if(_0x7e7126[_0x0049('0x74')]&&_0x537fd6<_0x7e7126[_0x0049('0x74')]-_0x764c71){freeVariablesPredictive(_0x7e7126);loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],_0x0049('0x1df'),_0x537fd6,')\x20are\x20less\x20than\x20threshold\x20(',_0x7e7126['predictiveIntervalAvailable'],'-',_0x764c71,'=',_0x7e7126[_0x0049('0x74')]-_0x764c71,')');}else if(_0x7e7126['predictiveIntervalAvailable']&&_0x537fd6>_0x7e7126['predictiveIntervalAvailable']+_0x213021){freeVariablesPredictive(_0x7e7126);loggerPredictive['info'](_0x7e7126[_0x0049('0x46')],_0x0049('0x1df'),_0x537fd6,_0x0049('0x1e0'),_0x7e7126[_0x0049('0x74')],'+',_0x213021,'=',_0x7e7126[_0x0049('0x74')]+_0x213021,')');}};Dialer[_0x0049('0x1b')][_0x0049('0x1dd')]=function(_0x26a82a){var _0x1d6532=this;return function(_0x26c64d){return new BPromise(function(_0x4a064a,_0x2aad8e){_['merge'](_0x26a82a,_0x26c64d[0x0]);if(checkGetDataPredictive(_0x26c64d[0x0])){var _0x220410=_0x26a82a[_0x0049('0x74')]=_0x26a82a[_0x0049('0x5d')]+_0x26a82a[_0x0049('0x57')];var _0x315297=_0x26a82a[_0x0049('0x1d2')]*0x3c;var _0xa8126a=_0x26c64d[0x0]['predictiveIntervalAvgTalktime']+_0x26c64d[0x0][_0x0049('0x70')];var _0xcc1f9b=(_0x26c64d[0x0][_0x0049('0x1e1')]+_0x26c64d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x26c64d[0x0][_0x0049('0x72')])/_0x26c64d[0x0][_0x0049('0x75')];_0x26a82a[_0x0049('0x73')]=_0xcc1f9b>0x0?_0xcc1f9b:0x1;switch(_0x26a82a[_0x0049('0x1d4')]){case _0x0049('0x1d5'):var _0x14ea45=_0x26a82a['dialPredictiveOptimizationPercentage']/0x64;return _0x1d6532['abandonmentRate'](_0x220410,_0x315297,_0xa8126a,_0xcc1f9b,_0x14ea45)[_0x0049('0x43')](function(_0x27d838){return _0x4a064a(_0x27d838);});case _0x0049('0x1e2'):var _0xaa7bf2=_0x26a82a[_0x0049('0x1e3')]/0x64;return _0x1d6532[_0x0049('0x1e4')](_0x220410,_0x315297,_0xa8126a,_0xcc1f9b,_0xaa7bf2)[_0x0049('0x43')](function(_0x410660){return _0x4a064a(_0x410660);});default:return _0x2aad8e(msgResponse(_0x0049('0x1e5'),'Failure',_0x0049('0x1e6')));}}else{return _0x2aad8e(msgResponse(_0x0049('0x1e5'),_0x0049('0x148'),_0x0049('0x1e7')));}});};};Dialer[_0x0049('0x1b')][_0x0049('0x1e8')]=function(_0x4fa6b0){var _0x2f87e5=this;return function(_0x419fe4){return new BPromise(function(_0x3c42db,_0x5eb9bc){_['merge'](_0x4fa6b0,_0x419fe4[0x0]);if(checkGetDataPredictive(_0x419fe4[0x0])){loggerPredictive[_0x0049('0x80')](JSON[_0x0049('0x4f')](_0x419fe4[0x0]));if(_0x4fa6b0[_0x0049('0x1d4')]==='dropRate'){return _0x2f87e5['getVoiceQueueRtPauses'](_0x4fa6b0['id'])['then'](function(_0x526f2c){var _0x403212=_0x4fa6b0[_0x0049('0x58')]-_0x526f2c[0x0]['outboundQueuePauses'];var _0x4bf495=_0x4fa6b0['dialPredictiveInterval']*0x3c;var _0x81852e=_0x419fe4[0x0]['predictiveIntervalAvgTalktime']+_0x419fe4[0x0][_0x0049('0x70')];var _0xd57275=(_0x419fe4[0x0][_0x0049('0x1e1')]+_0x419fe4[0x0][_0x0049('0x119')]+_0x419fe4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x419fe4[0x0][_0x0049('0x75')];var _0x58a689=_0x4fa6b0[_0x0049('0x1e3')]/0x64;_0x4fa6b0[_0x0049('0x1e9')]=_0x526f2c[0x0][_0x0049('0x1ea')]||0x0;_0x4fa6b0[_0x0049('0x73')]=_0xd57275>0x0?_0xd57275:0x1;return _0x2f87e5[_0x0049('0x1eb')](_0x403212,_0x4bf495,_0x81852e,_0xd57275,_0x58a689);})[_0x0049('0x43')](function(_0x337783){return _0x3c42db(_0x337783);})[_0x0049('0xb1')](function(_0x486cd4){return _0x5eb9bc(msgResponse('[CatchErlangB]',_0x0049('0x148'),JSON['stringify'](_0x486cd4)));});}if(_0x4fa6b0[_0x0049('0x1d4')]===_0x0049('0x1e2')){return _0x2f87e5[_0x0049('0xcb')](_0x4fa6b0['id'])['then'](function(_0x127552){var _0x3bce22=_0x4fa6b0[_0x0049('0x58')]-_0x127552[0x0][_0x0049('0x1ea')];var _0x395df6=_0x4fa6b0[_0x0049('0x1d2')]*0x3c;var _0x175e7c=_0x419fe4[0x0][_0x0049('0x71')]+_0x419fe4[0x0][_0x0049('0x70')];var _0x44dc57=(_0x419fe4[0x0]['predictiveIntervalAnsweredCalls']+_0x419fe4[0x0][_0x0049('0x119')]+_0x419fe4[0x0][_0x0049('0x72')])/_0x419fe4[0x0][_0x0049('0x75')];var _0xc2e98e=_0x4fa6b0[_0x0049('0x1e3')]/0x64;_0x4fa6b0[_0x0049('0x1e9')]=_0x127552[0x0][_0x0049('0x1ea')]||0x0;_0x4fa6b0[_0x0049('0x73')]=_0x44dc57>0x0?_0x44dc57:0x1;return _0x2f87e5[_0x0049('0x1e4')](_0x3bce22,_0x395df6,_0x175e7c,_0x44dc57,_0xc2e98e);})[_0x0049('0x43')](function(_0x12dcd8){return _0x3c42db(_0x12dcd8);})['catch'](function(_0x51e18c){return _0x5eb9bc(msgResponse(_0x0049('0x1ec'),'Failure',JSON['stringify'](_0x51e18c)));});}}else{return _0x5eb9bc(msgResponse('[getDataPredictive]',_0x0049('0x148'),_0x0049('0x1e7')));}});};};Dialer[_0x0049('0x1b')][_0x0049('0x1db')]=function(_0x217584){var _0x59dfba=this;return function(){var _0x1d33c0=0x0;var _0x38b587=Math['floor'](_0x217584[_0x0049('0x8b')]*0x3e8);if(_0x38b587>0x0){_0x38b587=_0x38b587<0x64?0x64:_0x38b587;loggerPredictive[_0x0049('0x80')](_0x217584[_0x0049('0x46')],_0x0049('0x1ed'),_0x38b587,'milliseconds');_0x217584[_0x0049('0x90')]=setInterval(function(){_0x59dfba['handlePredictive'](_0x217584);loggerPredictiveCalls[_0x0049('0x80')](_0x0049('0x1ee'),_0x1d33c0+=0x1);},_0x38b587);}else{loggerPredictive[_0x0049('0x80')](_0x217584[_0x0049('0x46')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0049('0x1b')][_0x0049('0x1ef')]=function(_0x2b647a,_0x125e06){var _0x13d0b3=this;return function(_0x319c8f){if(_[_0x0049('0x4e')](_0x319c8f)){if(_[_0x0049('0xae')](_0x125e06[_0x0049('0xd7')])||!_0x125e06['recallme']){if(_0x2b647a[_0x0049('0x63')]==='booked'){_0x2b647a[_0x0049('0x134')]=_[_0x0049('0x44')](_0x2b647a[_0x0049('0x134')])?!![]:_0x2b647a[_0x0049('0x134')];var _0x5f1278=uuid['v4']();_0x13d0b3[_0x0049('0x27')][_0x5f1278]=new Action(_0x2b647a,_0x125e06,_0x5f1278);loggerBooked[_0x0049('0x80')]('[booked][checkContactBlack]',_0x5f1278,_0x0049('0x1f0'),JSON[_0x0049('0x4f')](_0x2b647a[_0x0049('0x134')]),_0x0049('0x1f1'),_0x2b647a[_0x0049('0x46')]);if(_0x2b647a[_0x0049('0x134')]){_0x2b647a[_0x0049('0x134')]=![];_0x13d0b3[_0x0049('0x2c')][_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xb4')]]=[];ami[_0x0049('0xaf')]({'actionid':_0x5f1278,'action':_0x0049('0x1f2'),'queue':_0x2b647a[_0x0049('0x46')]})['catch'](function(){_0x13d0b3['updateOriginated'](_0x2b647a);_0x13d0b3['rescheduleContact']({'active':![],'ContactId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0x100')],'ListId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd6')],'VoiceQueueId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd8')]||undefined,'CampaignId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1f3')));delete _0x13d0b3['actions'][_0x5f1278];});}else{loggerBooked[_0x0049('0x80')]('[booked][checkContactBlack][else]',JSON[_0x0049('0x4f')](_0x2b647a[_0x0049('0x134')]),'Queue:\x20',_0x2b647a['name']);_0x13d0b3[_0x0049('0xb3')](_0x2b647a);_0x13d0b3[_0x0049('0xfc')]({'active':![],'ContactId':_0x13d0b3['actions'][_0x5f1278]['ContactId'],'ListId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd6')],'VoiceQueueId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd8')]||undefined,'CampaignId':_0x13d0b3['actions'][_0x5f1278]['CampaignId']||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1f3')));delete _0x13d0b3[_0x0049('0x27')][_0x5f1278];}}else{return _0x13d0b3[_0x0049('0x16e')](_0x2b647a,_0x125e06);}}else{if(getDiff(_0x125e06[_0x0049('0x1f4')])<_0x2b647a['dialRecallMeTimeout']*0x3c){if(_0x125e06['Agent']&&!_0x125e06[_0x0049('0x167')]['voicePause']){_0x13d0b3['preview'][_0x0049('0x1f5')](_0x125e06['id'])['finally'](function(){_0x13d0b3[_0x0049('0xb3')](_0x2b647a);});}else{_0x13d0b3[_0x0049('0xc4')]({'active':![]},_0x125e06['id'],0x1)[_0x0049('0x1e')](function(){_0x13d0b3[_0x0049('0xb3')](_0x2b647a);});}}else{_0x2b647a[_0x0049('0x6d')]+=0x1;_0x13d0b3['updateOriginated'](_0x2b647a);if(_0x2b647a[_0x0049('0x1f6')]){_0x13d0b3[_0x0049('0xfc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x125e06[_0x0049('0x100')],'ListId':_0x125e06['ListId'],'VoiceQueueId':_0x125e06[_0x0049('0xd8')]||undefined,'CampaignId':_0x125e06[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x13d0b3['createHistory'](createObjHistory(_0x2b647a,_0x125e06,_0x0049('0x1f7'),0x17,_0x0049('0x1f8')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x13d0b3[_0x0049('0xd4')](createObjHistory(_0x2b647a,_0x125e06,'RECALLFAILEDTIMEOUT',0x16,_0x0049('0x1f9')),_0x0049('0x1fa'),_0x0049('0x1fb'));}}}}else{_0x2b647a[_0x0049('0x67')]+=0x1;_0x13d0b3[_0x0049('0xd4')](createObjHistory(_0x2b647a,_0x125e06,_0x0049('0x1fc'),0xd,_0x0049('0x1fd')),_0x0049('0x1fe'),_0x0049('0x1ff'));throw _0x0049('0x200');}};};Dialer[_0x0049('0x1b')][_0x0049('0x15e')]=function(_0xc3637b){var _0xa3652c=this;var _0x3541a4=_0xc3637b[_0x0049('0x201')]-_0xc3637b[_0x0049('0x76')]-_0xc3637b['temp'];emitCampaignSummary(_0xc3637b);if(_0x3541a4>0x0){if(_0x3541a4>this[_0x0049('0x25')]){_0x3541a4=this['maxNumberOriginate'];}_0xc3637b[_0x0049('0xc7')]+=_0x3541a4;this['getContactDialerIvr'](_0xc3637b['id'],_0x3541a4,_0xc3637b['dialOrderByScheduledAt'],_0xc3637b)[_0x0049('0x43')](function(_0xf3fee){_0xc3637b[_0x0049('0xc7')]-=_0x3541a4;_0xc3637b['temp']=_0xc3637b[_0x0049('0xc7')]>0x0?_0xc3637b[_0x0049('0xc7')]:0x0;if(!checkContactEmpty(_0xf3fee)){_0xc3637b[_0x0049('0x45')]=_0x0049('0x9d');logger[_0x0049('0x80')]('[getContactCampaign2][Empty]'+_0xc3637b[_0x0049('0x46')]);}else{_0xc3637b[_0x0049('0x76')]+=_0xf3fee[_0x0049('0x97')];_0xc3637b[_0x0049('0x45')]=_0x0049('0x202');for(var _0x2187fe=0x0;_0x2187fe<_0xf3fee[_0x0049('0x97')];_0x2187fe+=0x1){_0xc3637b[_0x0049('0x203')]+=0x1;if(_[_0x0049('0xae')](_0xf3fee[_0x2187fe])||_[_0x0049('0xae')](_0xf3fee[_0x2187fe]['Contact'])||_[_0x0049('0xae')](_0xf3fee[_0x2187fe][_0x0049('0x170')])){_0xa3652c['emptyContact']('[actionOriginate]\x20',_0xc3637b,_0xf3fee[_0x2187fe]);}else{_0xa3652c['checkIsBlackListIvr'](_[_0x0049('0xd5')](_0xf3fee[_0x2187fe],['CampaignId',_0x0049('0x204')]))[_0x0049('0x43')](_0xa3652c[_0x0049('0x1ef')](_0xc3637b,_0xf3fee[_0x2187fe]))[_0x0049('0xb1')](_0xa3652c[_0x0049('0x205')](_0x0049('0x206'),_0xc3637b));}}}})[_0x0049('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0xc3637b,_0x3541a4));}};Dialer[_0x0049('0x1b')][_0x0049('0x15a')]=function(_0x1a8e7a,_0x210363){var _0x5e4d8f=this;var _0x2b2d0a=[];var _0x2a6d69=_0x210363>=0x1?_0x210363:0x1;if(_0x1a8e7a['dialMethod']===_0x0049('0x6')){_0x2a6d69=0x1;}var _0x252735=Math[_0x0049('0x1d0')](_0x1a8e7a[_0x0049('0x57')]*_0x2a6d69)-_0x1a8e7a[_0x0049('0x76')]-_0x1a8e7a['temp'];emitVoiceQueueSummary(_0x1a8e7a);if(_0x1a8e7a[_0x0049('0x207')]>0x0){var _0x473ec3=_0x1a8e7a['dialLimitQueue']-_0x1a8e7a[_0x0049('0x76')]-_0x1a8e7a[_0x0049('0x5d')]-_0x1a8e7a['temp']-_0x1a8e7a[_0x0049('0x59')];if(_0x252735>_0x473ec3){_0x252735=_0x473ec3;}}if(_0x252735>0x0){if(_0x1a8e7a['dialMethod']===_0x0049('0x6')){_0x252735=0x1;}if(_0x252735>this[_0x0049('0x25')]){_0x252735=this[_0x0049('0x25')];}_0x1a8e7a[_0x0049('0xc7')]+=_0x252735;for(var _0x44de85 in this[_0x0049('0x23')]){if(typeof this[_0x0049('0x23')][_0x44de85]!==_0x0049('0xad')){if(this['agents'][_0x44de85][_0x0049('0xea')]===_0x0049('0x208')&&this[_0x0049('0x23')][_0x44de85][_0x0049('0xb0')]===_0x0049('0xe0')){_0x2b2d0a[_0x0049('0x151')](this[_0x0049('0x23')][_0x44de85]['id']);}}}this[_0x0049('0xc6')](_0x1a8e7a['id'],_0x2b2d0a,_0x252735,_0x1a8e7a[_0x0049('0x209')],_0x1a8e7a)[_0x0049('0x43')](function(_0x5dbdc4){_0x1a8e7a[_0x0049('0xc7')]-=_0x252735;_0x1a8e7a[_0x0049('0xc7')]=_0x1a8e7a[_0x0049('0xc7')]>0x0?_0x1a8e7a['temp']:0x0;if(!checkContactEmpty(_0x5dbdc4)){_0x5e4d8f[_0x0049('0xb7')](_0x1a8e7a)[_0x0049('0x43')](sendMessageReschedule(_0x1a8e7a))[_0x0049('0xb1')](loggerCatch(_0x0049('0x20a')));}else{_0x1a8e7a[_0x0049('0x76')]+=_0x5dbdc4[_0x0049('0x97')];_0x1a8e7a['message']=_0x1a8e7a['dialMethod']===_0x0049('0x6')?_0x0049('0x178'):_0x0049('0x202');for(var _0x347a7c=0x0;_0x347a7c<_0x5dbdc4[_0x0049('0x97')];_0x347a7c+=0x1){if(_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c])||_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c][_0x0049('0x18a')])||_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c]['phone'])){_0x5e4d8f['emptyContact'](_0x0049('0x20b'),_0x1a8e7a,_0x5dbdc4[_0x347a7c]);}else{_0x5e4d8f[_0x0049('0xb8')](_[_0x0049('0xd5')](_0x5dbdc4[_0x347a7c],[_0x0049('0xd8'),_0x0049('0x204')]))['then'](_0x5e4d8f['checkContactBlack'](_0x1a8e7a,_0x5dbdc4[_0x347a7c]))[_0x0049('0xb1')](_0x5e4d8f[_0x0049('0x205')]('[actionOriginate]\x20',_0x1a8e7a));}}}})['catch'](loggerGetContactDialer(_0x0049('0x20c'),_0x1a8e7a,_0x252735));}};Dialer[_0x0049('0x1b')][_0x0049('0x90')]=function(_0x1f75b2){if(_0x1f75b2['dialLimitQueue']>0x0){var _0x47b3c1=_0x1f75b2['dialLimitQueue']-_0x1f75b2[_0x0049('0x76')]-_0x1f75b2[_0x0049('0x5d')];if(_0x47b3c1>0x0){this[_0x0049('0x20d')](_0x1f75b2);}else{loggerPredictiveCalls['info'](_0x0049('0x20e'));}}else{this[_0x0049('0x20d')](_0x1f75b2);}};Dialer[_0x0049('0x1b')]['tryOriginatePredictive']=function(_0x487112){var _0x2212de=this;var _0x554685=[];_0x487112[_0x0049('0x76')]+=0x1;for(var _0x4db25b in this['agents']){if(typeof this[_0x0049('0x23')][_0x4db25b]!==_0x0049('0xad')){if(this['agents'][_0x4db25b]['state']==='not_inuse'&&this[_0x0049('0x23')][_0x4db25b][_0x0049('0xb0')]===_0x0049('0xe0')){_0x554685['push'](this['agents'][_0x4db25b]['id']);}}}this['getContactDialer'](_0x487112['id'],_0x554685,0x1,_0x487112[_0x0049('0x209')],_0x487112)[_0x0049('0x43')](function(_0x2626b5){if(!checkContactEmpty(_0x2626b5)){checkContactLowerLimitOriginate(_0x487112,0x1,0x0);_0x2212de[_0x0049('0xb7')](_0x487112)[_0x0049('0x43')](sendMessageReschedule(_0x487112))[_0x0049('0xb1')](loggerCatch(_0x0049('0x20a')));}else{_0x487112[_0x0049('0x45')]=_0x0049('0x202');if(_['isNil'](_0x2626b5[0x0])||_[_0x0049('0xae')](_0x2626b5[0x0][_0x0049('0x18a')])||_[_0x0049('0xae')](_0x2626b5[0x0][_0x0049('0x170')])){_0x2212de[_0x0049('0xd2')]('[actionOriginate]\x20',_0x487112,_0x2626b5[0x0]);}else{_0x2212de[_0x0049('0xb8')](_[_0x0049('0xd5')](_0x2626b5[0x0],[_0x0049('0xd8'),_0x0049('0x204')]))[_0x0049('0x43')](_0x2212de[_0x0049('0x1ef')](_0x487112,_0x2626b5[0x0]))[_0x0049('0xb1')](_0x2212de[_0x0049('0x205')]('[actionOriginatePredictive]\x20',_0x487112));}}})[_0x0049('0xb1')](loggerGetContactDialer(_0x0049('0x20f'),_0x487112,0x1));emitVoiceQueueSummary(_0x487112);};Dialer['prototype'][_0x0049('0x1eb')]=function(_0x4530ff,_0x980d87,_0x5bda78,_0x129751,_0x1a9c9c,_0x5644aa){loggerPredictive[_0x0049('0x80')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0049('0x80')](_0x0049('0x210'),_0x4530ff);loggerPredictive[_0x0049('0x80')](_0x0049('0x211'),_0x980d87);loggerPredictive[_0x0049('0x80')](_0x0049('0x212'),_0x5bda78);loggerPredictive[_0x0049('0x80')](_0x0049('0x213'),_0x129751);loggerPredictive[_0x0049('0x80')](_0x0049('0x214'),_0x1a9c9c);loggerPredictive['info'](_0x0049('0x84'));return new BPromise(function(_0x3cdfd2,_0x5e9f85){if(_0x4530ff<=0x0||isNaN(_0x4530ff)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),'m\x20=\x20'+_0x4530ff));}if(_0x5bda78<=0x0||isNaN(_0x5bda78)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),_0x0049('0x216')+_0x5bda78));}if(_0x129751<=0x0||isNaN(_0x129751)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),'p\x20=\x20'+_0x129751));}if(_0x980d87<=0x0||isNaN(_0x980d87)){return _0x5e9f85(msgResponse(_0x0049('0x215'),'Error',_0x0049('0x217')+_0x980d87));}if(_0x1a9c9c<=0x0||isNaN(_0x1a9c9c)){return _0x5e9f85(msgResponse('[abandonmentRate]','Error',_0x0049('0x218')+_0x1a9c9c));}_0x5644aa=_0x5644aa||0x0;var _0x44346d=0x1/_0x5bda78;var _0x409b6d=0x0;var _0x1ae471=0x0;var _0x426fbc=0x0;var _0x4fcf11=0x0;for(var _0x236e3b=0x0;_0x426fbc<_0x1a9c9c;_0x236e3b+=0x1){_0x1ae471=_0x236e3b/_0x980d87;_0x409b6d=(_0x129751*_0x1ae471+_0x5644aa)/_0x44346d;_0x426fbc=erlangb(_0x409b6d,_0x4530ff);_0x4fcf11=_0x409b6d/_0x4530ff*(0x1-erlangb(_0x409b6d,_0x4530ff));}return _0x3cdfd2({'erlangCalls':_0x236e3b,'erlangCallToSecond':_0x980d87/_0x236e3b,'erlangAbandonmentRate':_0x426fbc,'erlangBusyFactor':_0x4fcf11});});};Dialer['prototype']['busyFactor']=function(_0x49b2d2,_0x124a9,_0x2041eb,_0x644554,_0x1976a6,_0xf1fdcb){loggerPredictive['info'](_0x0049('0x219'));loggerPredictive[_0x0049('0x80')](_0x0049('0x210'),_0x49b2d2);loggerPredictive[_0x0049('0x80')](_0x0049('0x211'),_0x124a9);loggerPredictive[_0x0049('0x80')](_0x0049('0x212'),_0x2041eb);loggerPredictive[_0x0049('0x80')](_0x0049('0x213'),_0x644554);loggerPredictive[_0x0049('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1976a6);loggerPredictive[_0x0049('0x80')](_0x0049('0x84'));return new BPromise(function(_0x58a157,_0x6eb694){if(_0x49b2d2<=0x0||isNaN(_0x49b2d2)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x21b')+_0x49b2d2));}if(_0x2041eb<=0x0||isNaN(_0x2041eb)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x216')+_0x2041eb));}if(_0x644554<=0x0||isNaN(_0x644554)){return _0x6eb694(msgResponse('[busyFactor]',_0x0049('0x19f'),'p\x20=\x20'+_0x644554));}if(_0x124a9<=0x0||isNaN(_0x124a9)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x217')+_0x124a9));}if(_0x1976a6<=0x0||isNaN(_0x1976a6)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x21c')+_0x1976a6));}_0xf1fdcb=_0xf1fdcb||0x0;var _0x371a43=0x1/_0x2041eb;var _0x2f1f85=0x0;var _0xbf6b92=0x0;var _0x3a1a49=0x0;var _0x426c4b=0x0;for(var _0x57b520=0x0;_0x426c4b<_0x1976a6;_0x57b520+=0x1){_0xbf6b92=_0x57b520/_0x124a9;_0x2f1f85=(_0x644554*_0xbf6b92+_0xf1fdcb)/_0x371a43;_0x3a1a49=erlangb(_0x2f1f85,_0x49b2d2);_0x426c4b=_0x2f1f85/_0x49b2d2*(0x1-erlangb(_0x2f1f85,_0x49b2d2));}return _0x58a157({'erlangCalls':_0x57b520,'erlangCallToSecond':_0x124a9/_0x57b520,'erlangAbandonmentRate':_0x3a1a49,'erlangBusyFactor':_0x426c4b});});};module[_0x0049('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index dcf6321..88fe70a 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 _0xf311=['ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','starttime','responsetime','droptime'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xf311,0x106));var _0x1f31=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf311[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0x1f31('0x0'));var _=require(_0x1f31('0x1'));var moment=require(_0x1f31('0x2'));function getSeconds(_0x19e4e5,_0x1b63b8){var _0x1c824e=moment(_0x19e4e5)[_0x1f31('0x3')](0x0);var _0x2e59d8=moment(_0x1b63b8)[_0x1f31('0x3')](0x0);return _0x1c824e[_0x1f31('0x4')](_0x2e59d8,_0x1f31('0x5'));}function QueueCallerAbandon(_0x1cde82,_0x5e91cc){this[_0x1f31('0x6')]=_0x1cde82[_0x1f31('0x6')];this[_0x1f31('0x7')]=_0x1cde82[_0x1f31('0x7')];this[_0x1f31('0x8')]=_0x1cde82[_0x1f31('0x7')]==='outbound'?_0x1f31('0x9'):_0x1cde82[_0x1f31('0x7')];this[_0x1f31('0xa')]=_0x1cde82[_0x1f31('0xa')];this[_0x1f31('0xb')]=_0x1cde82[_0x1f31('0xb')];this['countnoanswerretry']=_0x1cde82[_0x1f31('0xc')];this[_0x1f31('0xd')]=_0x1cde82[_0x1f31('0xa')]+_0x1cde82['countcongestionretry']+_0x1cde82['countnoanswerretry']+_0x1cde82[_0x1f31('0xe')]+_0x1cde82['countdropretry']+_0x1cde82[_0x1f31('0xf')]+_0x1cde82[_0x1f31('0x10')]+_0x1cde82[_0x1f31('0x11')];this[_0x1f31('0xe')]=_0x1cde82[_0x1f31('0xe')];this[_0x1f31('0x12')]=_0x1cde82[_0x1f31('0x12')];this[_0x1f31('0xf')]=_0x1cde82[_0x1f31('0xf')];this[_0x1f31('0x10')]=_0x1cde82[_0x1f31('0x10')];this['countagentrejectretry']=_0x1cde82[_0x1f31('0x11')];this[_0x1f31('0x13')]=_0x5e91cc['uniqueid'];this['calleridname']=_0x1cde82[_0x1f31('0x14')];this[_0x1f31('0x15')]=_0x1cde82['number'];this[_0x1f31('0x16')]=_0x1cde82['starttime'];this['responsetime']=_0x1cde82[_0x1f31('0x17')];this[_0x1f31('0x18')]=_0x1cde82[_0x1f31('0x18')];this['endtime']=this[_0x1f31('0x18')];this[_0x1f31('0x19')]=getSeconds(_0x1cde82[_0x1f31('0x17')],_0x1cde82['starttime']);this[_0x1f31('0x1a')]=getSeconds(this[_0x1f31('0x18')],_0x1cde82['responsetime']);this[_0x1f31('0x1b')]=0x0;this[_0x1f31('0x9')]=_0x5e91cc[_0x1f31('0x9')];this[_0x1f31('0x1c')]=_0x5e91cc[_0x1f31('0x1d')];this[_0x1f31('0x1e')]=_0x5e91cc[_0x1f31('0x1e')];this[_0x1f31('0x1f')]=_0x1cde82[_0x1f31('0x1f')];this[_0x1f31('0x20')]=_0x1cde82[_0x1f31('0x20')];this[_0x1f31('0x21')]=_0x1cde82[_0x1f31('0x21')];this['recallme']=_0x1cde82[_0x1f31('0x22')];this[_0x1f31('0x23')]=_0x1cde82[_0x1f31('0x23')];this['ListId']=_0x1cde82[_0x1f31('0x24')];this[_0x1f31('0x25')]=_0x1cde82[_0x1f31('0x25')];this[_0x1f31('0x26')]=_0x1cde82['VoiceQueueId'];this['CampaignId']=_0x1cde82['CampaignId'];this[_0x1f31('0x27')]=_0x1cde82['originatecalleridnum']||'';this['originatecalleridname']=_0x1cde82[_0x1f31('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x84cd=['endtime','ringtime','holdtime','responsetime','talktime','membername','connectedlinename','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','number','starttime','droptime'];(function(_0x1616cd,_0x2037f2){var _0x5b9241=function(_0x405f5d){while(--_0x405f5d){_0x1616cd['push'](_0x1616cd['shift']());}};_0x5b9241(++_0x2037f2);}(_0x84cd,0xb2));var _0xd84c=function(_0x1bd9f7,_0x29b962){_0x1bd9f7=_0x1bd9f7-0x0;var _0x48a409=_0x84cd[_0x1bd9f7];return _0x48a409;};'use strict';var util=require(_0xd84c('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x46d9be,_0x3546ee){var _0x24f102=moment(_0x46d9be)[_0xd84c('0x1')](0x0);var _0x8c7448=moment(_0x3546ee)[_0xd84c('0x1')](0x0);return _0x24f102[_0xd84c('0x2')](_0x8c7448,_0xd84c('0x3'));}function QueueCallerAbandon(_0x2b0591,_0x50d923){this[_0xd84c('0x4')]=_0x2b0591[_0xd84c('0x4')];this[_0xd84c('0x5')]=_0x2b0591[_0xd84c('0x5')];this[_0xd84c('0x6')]=_0x2b0591['type']===_0xd84c('0x7')?_0xd84c('0x8'):_0x2b0591['type'];this['countbusyretry']=_0x2b0591[_0xd84c('0x9')];this[_0xd84c('0xa')]=_0x2b0591[_0xd84c('0xa')];this[_0xd84c('0xb')]=_0x2b0591[_0xd84c('0xb')];this[_0xd84c('0xc')]=_0x2b0591[_0xd84c('0x9')]+_0x2b0591['countcongestionretry']+_0x2b0591['countnoanswerretry']+_0x2b0591[_0xd84c('0xd')]+_0x2b0591[_0xd84c('0xe')]+_0x2b0591['countabandonedretry']+_0x2b0591[_0xd84c('0xf')]+_0x2b0591['countagentrejectretry'];this[_0xd84c('0xd')]=_0x2b0591[_0xd84c('0xd')];this[_0xd84c('0xe')]=_0x2b0591['countdropretry'];this[_0xd84c('0x10')]=_0x2b0591[_0xd84c('0x10')];this[_0xd84c('0xf')]=_0x2b0591[_0xd84c('0xf')];this[_0xd84c('0x11')]=_0x2b0591['countagentrejectretry'];this[_0xd84c('0x12')]=_0x50d923[_0xd84c('0x12')];this['calleridname']=_0x2b0591['name'];this['calleridnum']=_0x2b0591[_0xd84c('0x13')];this['starttime']=_0x2b0591[_0xd84c('0x14')];this['responsetime']=_0x2b0591['responsetime'];this[_0xd84c('0x15')]=_0x2b0591['droptime'];this[_0xd84c('0x16')]=this[_0xd84c('0x15')];this[_0xd84c('0x17')]=getSeconds(_0x2b0591['responsetime'],_0x2b0591['starttime']);this[_0xd84c('0x18')]=getSeconds(this[_0xd84c('0x15')],_0x2b0591[_0xd84c('0x19')]);this[_0xd84c('0x1a')]=0x0;this[_0xd84c('0x8')]=_0x50d923[_0xd84c('0x8')];this[_0xd84c('0x1b')]=_0x50d923[_0xd84c('0x1c')];this['reason']=_0x50d923['reason'];this['callback']=_0x2b0591[_0xd84c('0x1d')];this['callbackuniqueid']=_0x2b0591[_0xd84c('0x1e')];this['callbackat']=_0x2b0591['callbackat'];this[_0xd84c('0x1f')]=_0x2b0591[_0xd84c('0x1f')];this[_0xd84c('0x20')]=_0x2b0591[_0xd84c('0x20')];this[_0xd84c('0x21')]=_0x2b0591['ListId'];this[_0xd84c('0x22')]=_0x2b0591[_0xd84c('0x22')];this['VoiceQueueId']=_0x2b0591[_0xd84c('0x23')];this[_0xd84c('0x24')]=_0x2b0591[_0xd84c('0x24')];this[_0xd84c('0x25')]=_0x2b0591[_0xd84c('0x25')]||'';this[_0xd84c('0x26')]=_0x2b0591[_0xd84c('0x26')]||'';}module[_0xd84c('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 27c3e0a..f29ae08 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(_0x5c4c4e,_0x92a548){var _0x11cfdf=function(_0x37973f){while(--_0x37973f){_0x5c4c4e['push'](_0x5c4c4e['shift']());}};_0x11cfdf(++_0x92a548);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x5b7d8f,_0x268879){var _0x54d7f1=function(_0x543eaf){while(--_0x543eaf){_0x5b7d8f['push'](_0x5b7d8f['shift']());}};_0x54d7f1(++_0x268879);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 63cbd74..2a8c951 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 _0x96c8=['application/pdf','then','notify','catch','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf'];(function(_0x3d905,_0x7b688d){var _0x3a990b=function(_0x5b79a6){while(--_0x5b79a6){_0x3d905['push'](_0x3d905['shift']());}};_0x3a990b(++_0x7b688d);}(_0x96c8,0x19e));var _0x896c=function(_0x5d1b85,_0x337686){_0x5d1b85=_0x5d1b85-0x0;var _0x356af7=_0x96c8[_0x5d1b85];return _0x356af7;};'use strict';var util=require(_0x896c('0x0'));var _=require(_0x896c('0x1'));var BPromise=require(_0x896c('0x2'));var uuid=require(_0x896c('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x896c('0x4'));var gs=require('./util/gs');var logger=require(_0x896c('0x5'))('fax');var ami=require(_0x896c('0x6'));var rpcDb=require(_0x896c('0x7'));var Channel=require(_0x896c('0x8'));var ut=require(_0x896c('0x9'));var Action=require('./action');var faxAccount=require(_0x896c('0xa'));var attachment=require(_0x896c('0xb'));var faxMessage=require(_0x896c('0xc'));function Fax(_0x43ee32){this[_0x896c('0xd')]={};this[_0x896c('0xe')]=_0x43ee32[_0x896c('0xe')];this[_0x896c('0xf')]=_0x43ee32['trunks'];this[_0x896c('0x10')]={};ami['on'](_0x896c('0x11'),this[_0x896c('0x12')][_0x896c('0x13')](this));ami['on']('varset',this['syncVarSet'][_0x896c('0x13')](this));ami['on'](_0x896c('0x14'),this[_0x896c('0x15')][_0x896c('0x13')](this));ami['on']('newexten',this[_0x896c('0x16')][_0x896c('0x13')](this));ami['on'](_0x896c('0x17'),this[_0x896c('0x18')][_0x896c('0x13')](this));ami['on'](_0x896c('0x19'),this[_0x896c('0x1a')][_0x896c('0x13')](this));ami['on']('hangup',this[_0x896c('0x1b')][_0x896c('0x13')](this));ami['on'](_0x896c('0x1c'),this['syncOriginateResponse'][_0x896c('0x13')](this));}Fax[_0x896c('0x1d')][_0x896c('0x12')]=function(_0x5dc8dc){if(_0x5dc8dc[_0x896c('0x1e')]===_0x896c('0x1f')){for(var _0x25793c in this[_0x896c('0xe')]){if(this[_0x896c('0xe')][_0x896c('0x20')](_0x25793c)){if(_0x5dc8dc[_0x896c('0x21')]===this[_0x896c('0xe')][_0x25793c]['localstationid']){this['channels'][_0x5dc8dc[_0x896c('0x22')]]={};this[_0x896c('0xd')][_0x5dc8dc[_0x896c('0x22')]][_0x896c('0x23')]=_0x5dc8dc[_0x896c('0x23')];this[_0x896c('0xd')][_0x5dc8dc[_0x896c('0x22')]]['id']=this[_0x896c('0xe')][_0x25793c]['id'];this[_0x896c('0xd')][_0x5dc8dc[_0x896c('0x22')]][_0x896c('0x24')]=this[_0x896c('0xe')][_0x25793c]['name'];logger[_0x896c('0x25')](_0x5dc8dc['uniqueid'],_0x896c('0x26'));}}}}if(this[_0x896c('0x10')][_0x5dc8dc[_0x896c('0x22')]]){this[_0x896c('0xd')][_0x5dc8dc[_0x896c('0x22')]]={};this[_0x896c('0xd')][_0x5dc8dc[_0x896c('0x22')]][_0x896c('0x23')]=_0x5dc8dc[_0x896c('0x23')];logger[_0x896c('0x25')](_0x5dc8dc[_0x896c('0x22')],_0x896c('0x26'));}};Fax[_0x896c('0x1d')][_0x896c('0x27')]=function(_0x3c0761){if(this['channels'][_0x3c0761['uniqueid']]){for(var _0x107d2d in _0x3c0761[_0x896c('0x28')]){if(_0x3c0761['variable'][_0x896c('0x20')](_0x107d2d)){this[_0x896c('0xd')][_0x3c0761[_0x896c('0x22')]][_0x107d2d]=_0x3c0761['value'];}}}};Fax[_0x896c('0x1d')]['syncNewState']=function(_0x2931a2){if(this['channels'][_0x2931a2[_0x896c('0x22')]]){this[_0x896c('0xd')][_0x2931a2['uniqueid']]['channelstate']=_0x2931a2[_0x896c('0x29')];this['channels'][_0x2931a2[_0x896c('0x22')]][_0x896c('0x2a')]=_0x2931a2[_0x896c('0x2a')];}};Fax[_0x896c('0x1d')][_0x896c('0x16')]=function(_0x2b3e73){if(this[_0x896c('0xd')][_0x2b3e73[_0x896c('0x22')]]){for(var _0x199d4e in _0x2b3e73['variable']){if(_0x2b3e73['variable'][_0x896c('0x20')](_0x199d4e)){this[_0x896c('0xd')][_0x2b3e73[_0x896c('0x22')]][_0x199d4e]=_0x2b3e73[_0x896c('0x2b')];}}}};Fax[_0x896c('0x1d')][_0x896c('0x18')]=function(_0x21625e){if(this[_0x896c('0xd')][_0x21625e[_0x896c('0x22')]]){this[_0x896c('0xd')][_0x21625e[_0x896c('0x22')]][_0x896c('0x2c')]=_0x21625e['operation'];this[_0x896c('0xd')][_0x21625e[_0x896c('0x22')]]['status']=_0x21625e[_0x896c('0x2d')];this['channels'][_0x21625e[_0x896c('0x22')]][_0x896c('0x2e')]=_0x21625e[_0x896c('0x2e')];this[_0x896c('0xd')][_0x21625e['uniqueid']][_0x896c('0x2f')]=_0x21625e[_0x896c('0x2f')];logger['info'](_0x21625e['uniqueid'],_0x896c('0x30'));}};Fax[_0x896c('0x1d')]['syncReceiveFax']=function(_0x855e8f){var _0x5bd02d=this;if(this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]]){var _0x58eabe=this[_0x896c('0xd')][_0x855e8f['uniqueid']]['id'];this[_0x896c('0xd')][_0x855e8f['uniqueid']]['remotestationid']=_0x855e8f[_0x896c('0x31')];this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]][_0x896c('0x32')]=_0x855e8f['pagestransferred'];this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]][_0x896c('0x2e')]=_0x855e8f[_0x896c('0x2e')];this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]]['resolution']=_0x855e8f[_0x896c('0x33')];this['channels'][_0x855e8f[_0x896c('0x22')]]['transferrate']=_0x855e8f[_0x896c('0x34')];this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]]['filename']=_0x855e8f[_0x896c('0x2f')];this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]][_0x896c('0x35')]=_0x855e8f[_0x896c('0x35')];if(this[_0x896c('0xd')][_0x855e8f[_0x896c('0x22')]][_0x896c('0x32')]>0x0){tiff2pdf(_0x855e8f[_0x896c('0x2f')],_0x896c('0x36'),function(_0x3c7c87){logger[_0x896c('0x25')](_0x855e8f[_0x896c('0x22')],'\x20result\x20conversion\x20file\x20',_0x3c7c87['message']);attachment[_0x896c('0x37')]({'name':path[_0x896c('0x38')](_0x855e8f[_0x896c('0x2f')])[_0x896c('0x24')],'basename':path[_0x896c('0x38')](_0x855e8f[_0x896c('0x2f')])[_0x896c('0x24')]+_0x896c('0x39'),'type':_0x896c('0x3a')})[_0x896c('0x3b')](function(_0x6558a3){faxAccount[_0x896c('0x3c')](_0x58eabe,{'from':_0x855e8f['calleridnum'],'mapKey':'fax','body':path[_0x896c('0x38')](_0x855e8f[_0x896c('0x2f')])[_0x896c('0x24')]+_0x896c('0x39'),'AttachmentId':_0x6558a3['id']})[_0x896c('0x3d')](function(_0x4a96f7){logger['error'](_0x855e8f['uniqueid'],'\x20notify\x20',JSON[_0x896c('0x3e')](_0x4a96f7));});})[_0x896c('0x3d')](function(_0x14fc9f){logger[_0x896c('0x3f')](_0x855e8f[_0x896c('0x22')],_0x896c('0x40'),JSON[_0x896c('0x3e')](_0x14fc9f));});});}logger[_0x896c('0x25')](_0x855e8f[_0x896c('0x22')],'\x20receiveFax\x20');}};Fax['prototype'][_0x896c('0x41')]=function(_0x43a75f){if(this[_0x896c('0x10')][_0x43a75f[_0x896c('0x22')]]){_[_0x896c('0x42')](this[_0x896c('0xd')][_0x43a75f['uniqueid']],_[_0x896c('0x43')](_0x43a75f,[_0x896c('0x44'),'reason']));}};function updateStatus(_0x2b885d){if(_0x2b885d[_0x896c('0x45')]){faxMessage['update'](_0x2b885d[_0x896c('0x45')],{'failMessage':_0x896c('0x46')})[_0x896c('0x3b')](function(_0x3cd314){ut[_0x896c('0x47')]('[Fax][Message][Error][Updated]',_0x3cd314);})[_0x896c('0x3d')](function(_0x444c60){ut[_0x896c('0x47')](_0x896c('0x48'),_0x444c60);});}else{ut[_0x896c('0x47')](_0x896c('0x49'));}}Fax[_0x896c('0x1d')][_0x896c('0x4a')]=function(_0x494f95,_0x577625,_0x473ae6){var _0x1eb419=this;var _0x71ee66={};if(_0x577625){_0x71ee66={'read':_0x577625};}else{_0x71ee66={'failMessage':_0x473ae6};}if(this[_0x896c('0x10')][_0x494f95][_0x896c('0x45')]){faxMessage[_0x896c('0x4b')](this[_0x896c('0x10')][_0x494f95][_0x896c('0x45')],_0x71ee66)['then'](function(_0x4b73a4){ut[_0x896c('0x47')](_0x896c('0x4c'),_0x4b73a4);})['catch'](function(_0x593ec7){ut[_0x896c('0x47')](_0x896c('0x4d'),_0x593ec7);})[_0x896c('0x4e')](function(){delete _0x1eb419['channels'][_0x494f95];delete _0x1eb419[_0x896c('0x10')][_0x494f95];});}else{ut[_0x896c('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x896c('0xd')][_0x494f95];delete this['actions'][_0x494f95];}};Fax[_0x896c('0x1d')][_0x896c('0x1b')]=function(_0x28dfba){var _0x3eed22=this;if(this[_0x896c('0xd')][_0x28dfba['uniqueid']]){if(this[_0x896c('0x10')][_0x28dfba['uniqueid']]){this['channels'][_0x28dfba[_0x896c('0x22')]]['id']=this[_0x896c('0x10')][_0x28dfba[_0x896c('0x22')]]['id'];this[_0x896c('0xd')][_0x28dfba['uniqueid']][_0x896c('0x24')]=this[_0x896c('0x10')][_0x28dfba['uniqueid']]['name'];}logger[_0x896c('0x25')](_0x28dfba[_0x896c('0x22')],this[_0x896c('0x10')][_0x28dfba[_0x896c('0x22')]]?_0x896c('0x4f'):_0x896c('0x50'),JSON[_0x896c('0x3e')](this['channels'][_0x28dfba[_0x896c('0x22')]]));if(this[_0x896c('0x10')][_0x28dfba[_0x896c('0x22')]]){if(this[_0x896c('0xd')][_0x28dfba[_0x896c('0x22')]][_0x896c('0x51')]>0x0&&this[_0x896c('0xd')][_0x28dfba['uniqueid']][_0x896c('0x17')]==='SUCCESS'){this[_0x896c('0x4a')](_0x28dfba[_0x896c('0x22')],!![]);}else{this[_0x896c('0x4a')](_0x28dfba['uniqueid'],![],this[_0x896c('0xd')][_0x28dfba[_0x896c('0x22')]][_0x896c('0x52')]?_0x896c('0x53')+this['channels'][_0x28dfba['uniqueid']][_0x896c('0x52')]:_0x896c('0x54'));}}}};Fax[_0x896c('0x1d')]['send']=function(_0x42e550){var _0x51790c=this;return new BPromise(function(_0x18e619,_0x32c37e){_0x51790c[_0x896c('0x55')](_0x42e550,_0x51790c[_0x896c('0xe')][_0x42e550[_0x896c('0x56')]])[_0x896c('0x3b')](function(_0xe7e159){ut[_0x896c('0x47')](_0x896c('0x57'),_0xe7e159);_0x18e619(ut[_0x896c('0x58')](_0x896c('0x59')));})['catch'](function(_0x206fa7){ut[_0x896c('0x47')](_0x896c('0x5a'),_0x206fa7);updateStatus(_0x42e550);_0x32c37e(ut[_0x896c('0x58')]('Fax\x20failed'));});});};Fax[_0x896c('0x1d')]['checkAfterSend']=function(_0xe625a6){var _0x149e9c=this;return new BPromise(function(_0x5e8f29,_0x2bc20c){var _0x4b9f21=_0x149e9c['checkTrunk'](_0x149e9c[_0x896c('0xe')][_0xe625a6[_0x896c('0x56')]]['Trunk'],_0xe625a6);if(_0x4b9f21[_0x896c('0x5b')]){_0x5e8f29(ut[_0x896c('0x58')]('Trunk\x20Reachable'));}else{_0x2bc20c(ut[_0x896c('0x58')](_0x4b9f21[_0x896c('0x58')]));}});};function originate(_0x5cb171,_0xfa5136,_0x87eaed){return new BPromise(function(_0x306928,_0xf9735){if(_0x87eaed){var _0x4659c2=util[_0x896c('0x5c')](_0x896c('0x5d'),path[_0x896c('0x38')](_0x5cb171[_0x896c('0x5e')])['name'],_0x5cb171[_0x896c('0x5e')]);gs[_0x896c('0x5f')](_0x4659c2)[_0x896c('0x3b')](function(){_0x5cb171[_0x896c('0x5e')]=util[_0x896c('0x5c')](_0x896c('0x60'),path['parse'](_0x5cb171['path'])[_0x896c('0x61')],path[_0x896c('0x38')](_0x5cb171['path'])[_0x896c('0x24')]);_0xfa5136[_0x896c('0x62')]=_0x5cb171['path'];ut[_0x896c('0x47')](_0x896c('0x63'),'');ami[_0x896c('0x64')](ut[_0x896c('0x65')](_0x5cb171,_0xfa5136))['then'](function(_0x38ac44){_0x306928(_0x38ac44);})['catch'](function(_0x509e5b){_0xf9735(_0x509e5b);});})[_0x896c('0x3d')](function(_0x429c14){_0xf9735(_0x429c14);});}else{ami[_0x896c('0x64')](ut['variablesAction'](_0x5cb171,_0xfa5136))[_0x896c('0x3b')](function(_0x39514e){_0x306928(_0x39514e);})['catch'](function(_0x317207){_0xf9735(_0x317207);});}});}Fax[_0x896c('0x1d')]['execOriginate']=function(_0x92d36b,_0x133b23){var _0x3a5785=this;return new BPromise(function(_0x31c893,_0xe3c3f2){var _0x1ea4a3=uuid['v4']();var _0x49559b=ut[_0x896c('0x66')](_0x92d36b,_0x133b23);_0x3a5785['actions'][_0x1ea4a3]=new Action(_0x1ea4a3,_0x133b23,_0x92d36b);var _0x29c6e7=_0x3a5785[_0x896c('0x10')][_0x1ea4a3];if(path[_0x896c('0x38')](_0x92d36b[_0x896c('0x5e')])['ext']==='.pdf'){originate(_0x29c6e7,_0x49559b,!![])['then'](function(_0xb20f5c){_0x31c893(_0xb20f5c);})['catch'](function(_0x4fb3b9){_0xe3c3f2(_0x4fb3b9);});}else{originate(_0x29c6e7,_0x49559b,![])[_0x896c('0x3b')](function(_0x50e17e){_0x31c893(_0x50e17e);})['catch'](function(_0x57ade9){_0xe3c3f2(_0x57ade9);});}});};Fax[_0x896c('0x1d')][_0x896c('0x67')]=function(_0x44eadf){return!_[_0x896c('0x68')](_0x44eadf)&&!_['isNil'](_0x44eadf[_0x896c('0x24')])&&!_['isNil'](_0x44eadf['active'])&&_0x44eadf['active']&&!_[_0x896c('0x68')](this[_0x896c('0xf')][util[_0x896c('0x5c')]('SIP/%s',_0x44eadf[_0x896c('0x24')])])&&!_['isNil'](this['trunks'][util[_0x896c('0x5c')](_0x896c('0x69'),_0x44eadf[_0x896c('0x24')])][_0x896c('0x2d')])&&(this[_0x896c('0xf')][util[_0x896c('0x5c')]('SIP/%s',_0x44eadf[_0x896c('0x24')])][_0x896c('0x2d')]===_0x896c('0x6a')||this[_0x896c('0xf')][util[_0x896c('0x5c')](_0x896c('0x69'),_0x44eadf[_0x896c('0x24')])]['status']===_0x896c('0x6b'));};Fax[_0x896c('0x1d')][_0x896c('0x6c')]=function(_0x39c70e,_0x36d18d){if(!this[_0x896c('0x67')](_0x39c70e)){ut[_0x896c('0x47')](_0x896c('0x6d'),_[_0x896c('0x68')](_0x39c70e)?'':_0x39c70e[_0x896c('0x24')]+_0x896c('0x6e'));return{'isValid':![],'message':_0x896c('0x6f')};}if(_[_0x896c('0x68')](_0x36d18d[_0x896c('0x70')])){ut[_0x896c('0x47')](_0x896c('0x71'),JSON[_0x896c('0x3e')](_0x36d18d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x896c('0x68')](_0x36d18d[_0x896c('0x5e')])){ut[_0x896c('0x47')](_0x896c('0x72'),JSON[_0x896c('0x3e')](_0x36d18d));return{'isValid':![],'message':_0x896c('0x73')};}return{'isValid':!![],'message':_0x896c('0x74')};};module[_0x896c('0x75')]=Fax; \ No newline at end of file +var _0xabdc=['actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','fax','catch','error','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks'];(function(_0xa50d60,_0x97a526){var _0x4280cb=function(_0x122d1d){while(--_0x122d1d){_0xa50d60['push'](_0xa50d60['shift']());}};_0x4280cb(++_0x97a526);}(_0xabdc,0x15a));var _0xcabd=function(_0x2e9224,_0x52e025){_0x2e9224=_0x2e9224-0x0;var _0x1b632e=_0xabdc[_0x2e9224];return _0x1b632e;};'use strict';var util=require(_0xcabd('0x0'));var _=require(_0xcabd('0x1'));var BPromise=require('bluebird');var uuid=require(_0xcabd('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xcabd('0x3'));var gs=require(_0xcabd('0x4'));var logger=require(_0xcabd('0x5'))('fax');var ami=require(_0xcabd('0x6'));var rpcDb=require(_0xcabd('0x7'));var Channel=require(_0xcabd('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xcabd('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xcabd('0xa'));function Fax(_0x1ba1eb){this[_0xcabd('0xb')]={};this[_0xcabd('0xc')]=_0x1ba1eb['faxAccounts'];this[_0xcabd('0xd')]=_0x1ba1eb['trunks'];this[_0xcabd('0xe')]={};ami['on'](_0xcabd('0xf'),this[_0xcabd('0x10')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x12'),this[_0xcabd('0x13')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x14'),this[_0xcabd('0x15')]['bind'](this));ami['on'](_0xcabd('0x16'),this[_0xcabd('0x17')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x18'),this[_0xcabd('0x19')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x1a'),this[_0xcabd('0x1b')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x1c'),this[_0xcabd('0x1d')]['bind'](this));ami['on'](_0xcabd('0x1e'),this[_0xcabd('0x1f')][_0xcabd('0x11')](this));}Fax[_0xcabd('0x20')][_0xcabd('0x10')]=function(_0x11458c){if(_0x11458c['context']==='from-voip-provider'){for(var _0x164f6f in this['faxAccounts']){if(this[_0xcabd('0xc')][_0xcabd('0x21')](_0x164f6f)){if(_0x11458c[_0xcabd('0x22')]===this[_0xcabd('0xc')][_0x164f6f][_0xcabd('0x23')]){this['channels'][_0x11458c[_0xcabd('0x24')]]={};this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['channel']=_0x11458c['channel'];this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['id']=this[_0xcabd('0xc')][_0x164f6f]['id'];this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]][_0xcabd('0x25')]=this[_0xcabd('0xc')][_0x164f6f][_0xcabd('0x25')];logger[_0xcabd('0x26')](_0x11458c['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x11458c[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]={};this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['channel']=_0x11458c[_0xcabd('0x27')];logger[_0xcabd('0x26')](_0x11458c[_0xcabd('0x24')],_0xcabd('0x28'));}};Fax['prototype'][_0xcabd('0x13')]=function(_0x1da289){if(this['channels'][_0x1da289[_0xcabd('0x24')]]){for(var _0x346c8d in _0x1da289['variable']){if(_0x1da289[_0xcabd('0x29')][_0xcabd('0x21')](_0x346c8d)){this[_0xcabd('0xb')][_0x1da289[_0xcabd('0x24')]][_0x346c8d]=_0x1da289[_0xcabd('0x2a')];}}}};Fax[_0xcabd('0x20')][_0xcabd('0x15')]=function(_0x6a0d1f){if(this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]][_0xcabd('0x2b')]=_0x6a0d1f[_0xcabd('0x2b')];this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]][_0xcabd('0x2c')]=_0x6a0d1f[_0xcabd('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x3c3c7e){if(this['channels'][_0x3c3c7e['uniqueid']]){for(var _0x452f14 in _0x3c3c7e[_0xcabd('0x29')]){if(_0x3c3c7e['variable']['hasOwnProperty'](_0x452f14)){this[_0xcabd('0xb')][_0x3c3c7e[_0xcabd('0x24')]][_0x452f14]=_0x3c3c7e[_0xcabd('0x2a')];}}}};Fax[_0xcabd('0x20')][_0xcabd('0x19')]=function(_0x1a7bb){if(this['channels'][_0x1a7bb[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]][_0xcabd('0x2d')]=_0x1a7bb[_0xcabd('0x2d')];this['channels'][_0x1a7bb[_0xcabd('0x24')]]['status']=_0x1a7bb[_0xcabd('0x2e')];this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]]['localstationid']=_0x1a7bb[_0xcabd('0x23')];this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]]['filename']=_0x1a7bb['filename'];logger[_0xcabd('0x26')](_0x1a7bb[_0xcabd('0x24')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x57661b){var _0x2a9428=this;if(this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]]){var _0x2daab9=this['channels'][_0x57661b['uniqueid']]['id'];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x2f')]=_0x57661b[_0xcabd('0x2f')];this[_0xcabd('0xb')][_0x57661b['uniqueid']][_0xcabd('0x30')]=_0x57661b[_0xcabd('0x30')];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x23')]=_0x57661b[_0xcabd('0x23')];this['channels'][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x31')]=_0x57661b[_0xcabd('0x31')];this[_0xcabd('0xb')][_0x57661b['uniqueid']][_0xcabd('0x32')]=_0x57661b[_0xcabd('0x32')];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x33')]=_0x57661b[_0xcabd('0x33')];this['channels'][_0x57661b[_0xcabd('0x24')]]['calleridnum']=_0x57661b[_0xcabd('0x34')];if(this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x30')]>0x0){tiff2pdf(_0x57661b['filename'],_0xcabd('0x35'),function(_0x213923){logger['info'](_0x57661b['uniqueid'],_0xcabd('0x36'),_0x213923[_0xcabd('0x37')]);attachment['create']({'name':path['parse'](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')],'basename':path[_0xcabd('0x38')](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')]+_0xcabd('0x39'),'type':_0xcabd('0x3a')})[_0xcabd('0x3b')](function(_0x282312){faxAccount[_0xcabd('0x3c')](_0x2daab9,{'from':_0x57661b['calleridnum'],'mapKey':_0xcabd('0x3d'),'body':path[_0xcabd('0x38')](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')]+'.pdf','AttachmentId':_0x282312['id']})[_0xcabd('0x3e')](function(_0x2005f8){logger[_0xcabd('0x3f')](_0x57661b[_0xcabd('0x24')],'\x20notify\x20',JSON[_0xcabd('0x40')](_0x2005f8));});})[_0xcabd('0x3e')](function(_0x3efb4e){logger[_0xcabd('0x3f')](_0x57661b[_0xcabd('0x24')],'\x20receiveFax\x20',JSON[_0xcabd('0x40')](_0x3efb4e));});});}logger['info'](_0x57661b[_0xcabd('0x24')],'\x20receiveFax\x20');}};Fax[_0xcabd('0x20')][_0xcabd('0x1f')]=function(_0x124776){if(this[_0xcabd('0xe')][_0x124776[_0xcabd('0x24')]]){_[_0xcabd('0x41')](this[_0xcabd('0xb')][_0x124776['uniqueid']],_[_0xcabd('0x42')](_0x124776,[_0xcabd('0x43'),_0xcabd('0x44')]));}};function updateStatus(_0x322b0f){if(_0x322b0f[_0xcabd('0x45')]){faxMessage[_0xcabd('0x46')](_0x322b0f[_0xcabd('0x45')],{'failMessage':_0xcabd('0x47')})[_0xcabd('0x3b')](function(_0x2526d0){ut[_0xcabd('0x48')](_0xcabd('0x49'),_0x2526d0);})[_0xcabd('0x3e')](function(_0x101adc){ut[_0xcabd('0x48')](_0xcabd('0x4a'),_0x101adc);});}else{ut[_0xcabd('0x48')](_0xcabd('0x4b'));}}Fax[_0xcabd('0x20')][_0xcabd('0x4c')]=function(_0x292e60,_0x530779,_0x48360d){var _0x492823=this;var _0x11a594={};if(_0x530779){_0x11a594={'read':_0x530779};}else{_0x11a594={'failMessage':_0x48360d};}if(this['actions'][_0x292e60][_0xcabd('0x45')]){faxMessage[_0xcabd('0x46')](this[_0xcabd('0xe')][_0x292e60][_0xcabd('0x45')],_0x11a594)[_0xcabd('0x3b')](function(_0x510b9a){ut['logger'](_0xcabd('0x4d'),_0x510b9a);})[_0xcabd('0x3e')](function(_0x87e36b){ut['logger'](_0xcabd('0x4e'),_0x87e36b);})['finally'](function(){delete _0x492823[_0xcabd('0xb')][_0x292e60];delete _0x492823[_0xcabd('0xe')][_0x292e60];});}else{ut['logger'](_0xcabd('0x4f'));delete this[_0xcabd('0xb')][_0x292e60];delete this[_0xcabd('0xe')][_0x292e60];}};Fax[_0xcabd('0x20')]['syncHangup']=function(_0x180870){var _0x49d6b4=this;if(this['channels'][_0x180870['uniqueid']]){if(this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]]){this['channels'][_0x180870[_0xcabd('0x24')]]['id']=this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]]['id'];this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]]['name']=this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x25')];}logger[_0xcabd('0x26')](_0x180870[_0xcabd('0x24')],this[_0xcabd('0xe')][_0x180870['uniqueid']]?_0xcabd('0x50'):_0xcabd('0x51'),JSON[_0xcabd('0x40')](this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]]));if(this[_0xcabd('0xe')][_0x180870['uniqueid']]){if(this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x52')]>0x0&&this['channels'][_0x180870['uniqueid']]['faxstatus']===_0xcabd('0x53')){this[_0xcabd('0x4c')](_0x180870[_0xcabd('0x24')],!![]);}else{this[_0xcabd('0x4c')](_0x180870[_0xcabd('0x24')],![],this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x54')]?_0xcabd('0x55')+this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x54')]:_0xcabd('0x56'));}}}};Fax['prototype']['send']=function(_0x4cff2b){var _0x26c419=this;return new BPromise(function(_0x54adab,_0x27c6dd){_0x26c419[_0xcabd('0x57')](_0x4cff2b,_0x26c419['faxAccounts'][_0x4cff2b[_0xcabd('0x58')]])[_0xcabd('0x3b')](function(_0x25b272){ut[_0xcabd('0x48')](_0xcabd('0x59'),_0x25b272);_0x54adab(ut[_0xcabd('0x37')](_0xcabd('0x5a')));})[_0xcabd('0x3e')](function(_0x27aaa7){ut[_0xcabd('0x48')](_0xcabd('0x5b'),_0x27aaa7);updateStatus(_0x4cff2b);_0x27c6dd(ut[_0xcabd('0x37')](_0xcabd('0x5c')));});});};Fax['prototype'][_0xcabd('0x5d')]=function(_0x3d2eae){var _0x58ee28=this;return new BPromise(function(_0x402b7d,_0x2d6aae){var _0x1ee872=_0x58ee28[_0xcabd('0x5e')](_0x58ee28[_0xcabd('0xc')][_0x3d2eae['FaxAccountId']][_0xcabd('0x5f')],_0x3d2eae);if(_0x1ee872['isValid']){_0x402b7d(ut[_0xcabd('0x37')](_0xcabd('0x60')));}else{_0x2d6aae(ut[_0xcabd('0x37')](_0x1ee872[_0xcabd('0x37')]));}});};function originate(_0xdecf7a,_0x374e06,_0x1067d6){return new BPromise(function(_0x37bb6a,_0x4cf2e1){if(_0x1067d6){var _0x43c857=util['format'](_0xcabd('0x61'),path[_0xcabd('0x38')](_0xdecf7a[_0xcabd('0x62')])[_0xcabd('0x25')],_0xdecf7a[_0xcabd('0x62')]);gs[_0xcabd('0x63')](_0x43c857)['then'](function(){_0xdecf7a[_0xcabd('0x62')]=util['format'](_0xcabd('0x64'),path[_0xcabd('0x38')](_0xdecf7a[_0xcabd('0x62')])[_0xcabd('0x65')],path[_0xcabd('0x38')](_0xdecf7a['path'])[_0xcabd('0x25')]);_0x374e06[_0xcabd('0x66')]=_0xdecf7a[_0xcabd('0x62')];ut[_0xcabd('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0xcabd('0x67')](ut[_0xcabd('0x68')](_0xdecf7a,_0x374e06))['then'](function(_0x187733){_0x37bb6a(_0x187733);})[_0xcabd('0x3e')](function(_0x49a0a0){_0x4cf2e1(_0x49a0a0);});})[_0xcabd('0x3e')](function(_0x3f5612){_0x4cf2e1(_0x3f5612);});}else{ami[_0xcabd('0x67')](ut[_0xcabd('0x68')](_0xdecf7a,_0x374e06))[_0xcabd('0x3b')](function(_0x2cb6f1){_0x37bb6a(_0x2cb6f1);})[_0xcabd('0x3e')](function(_0x14b9aa){_0x4cf2e1(_0x14b9aa);});}});}Fax[_0xcabd('0x20')][_0xcabd('0x57')]=function(_0x28a6cb,_0x84fae1){var _0x527384=this;return new BPromise(function(_0x10406b,_0x22327f){var _0x16a90f=uuid['v4']();var _0x2ba1be=ut[_0xcabd('0x69')](_0x28a6cb,_0x84fae1);_0x527384[_0xcabd('0xe')][_0x16a90f]=new Action(_0x16a90f,_0x84fae1,_0x28a6cb);var _0x3f7d84=_0x527384[_0xcabd('0xe')][_0x16a90f];if(path[_0xcabd('0x38')](_0x28a6cb['path'])['ext']==='.pdf'){originate(_0x3f7d84,_0x2ba1be,!![])['then'](function(_0x1f1465){_0x10406b(_0x1f1465);})[_0xcabd('0x3e')](function(_0x34dfc7){_0x22327f(_0x34dfc7);});}else{originate(_0x3f7d84,_0x2ba1be,![])[_0xcabd('0x3b')](function(_0x15202f){_0x10406b(_0x15202f);})['catch'](function(_0x47da39){_0x22327f(_0x47da39);});}});};Fax[_0xcabd('0x20')][_0xcabd('0x6a')]=function(_0x4b4dd7){return!_[_0xcabd('0x6b')](_0x4b4dd7)&&!_['isNil'](_0x4b4dd7[_0xcabd('0x25')])&&!_['isNil'](_0x4b4dd7[_0xcabd('0x6c')])&&_0x4b4dd7[_0xcabd('0x6c')]&&!_[_0xcabd('0x6b')](this['trunks'][util[_0xcabd('0x6d')](_0xcabd('0x6e'),_0x4b4dd7['name'])])&&!_[_0xcabd('0x6b')](this[_0xcabd('0xd')][util[_0xcabd('0x6d')](_0xcabd('0x6e'),_0x4b4dd7['name'])][_0xcabd('0x2e')])&&(this['trunks'][util[_0xcabd('0x6d')]('SIP/%s',_0x4b4dd7[_0xcabd('0x25')])][_0xcabd('0x2e')]===_0xcabd('0x6f')||this[_0xcabd('0xd')][util['format'](_0xcabd('0x6e'),_0x4b4dd7[_0xcabd('0x25')])]['status']===_0xcabd('0x70'));};Fax['prototype'][_0xcabd('0x5e')]=function(_0x1edfe1,_0x2e525e){if(!this[_0xcabd('0x6a')](_0x1edfe1)){ut[_0xcabd('0x48')](_0xcabd('0x71'),_['isNil'](_0x1edfe1)?'':_0x1edfe1[_0xcabd('0x25')]+_0xcabd('0x72'));return{'isValid':![],'message':_0xcabd('0x73')};}if(_[_0xcabd('0x6b')](_0x2e525e[_0xcabd('0x3d')])){ut[_0xcabd('0x48')](_0xcabd('0x74'),JSON[_0xcabd('0x40')](_0x2e525e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xcabd('0x6b')](_0x2e525e[_0xcabd('0x62')])){ut[_0xcabd('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xcabd('0x40')](_0x2e525e));return{'isValid':![],'message':_0xcabd('0x75')};}return{'isValid':!![],'message':_0xcabd('0x76')};};module[_0xcabd('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 88256e7..2dac162 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 _0x18bb=['[Notify]\x20','util','bluebird','preview','error','notify','resolve','then'];(function(_0x728c58,_0x348522){var _0x20083f=function(_0x4ad0bd){while(--_0x4ad0bd){_0x728c58['push'](_0x728c58['shift']());}};_0x20083f(++_0x348522);}(_0x18bb,0xb1));var _0xb18b=function(_0x3eec42,_0x192ed2){_0x3eec42=_0x3eec42-0x0;var _0x110bf0=_0x18bb[_0x3eec42];return _0x110bf0;};'use strict';var util=require(_0xb18b('0x0'));var BPromise=require(_0xb18b('0x1'));var logger=require('../../../config/logger')(_0xb18b('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x20f5d2){return function(_0x3528fb){logger[_0xb18b('0x3')](_0x20f5d2,util['inspect'](_0x3528fb,{'showHidden':![],'depth':null}));};}exports[_0xb18b('0x4')]=function(_0x4baf52,_0x5f5074){return BPromise[_0xb18b('0x5')]()[_0xb18b('0x6')](faxAccount[_0xb18b('0x4')](_0x4baf52,_0x5f5074))['catch'](loggerCatch(_0xb18b('0x7')));}; \ No newline at end of file +var _0xc9a2=['[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','then','notify','catch'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xc9a2,0x65));var _0x2c9a=function(_0x30fe9f,_0x6a082d){_0x30fe9f=_0x30fe9f-0x0;var _0x41a82d=_0xc9a2[_0x30fe9f];return _0x41a82d;};'use strict';var util=require(_0x2c9a('0x0'));var BPromise=require(_0x2c9a('0x1'));var logger=require(_0x2c9a('0x2'))(_0x2c9a('0x3'));var _=require('lodash');var faxAccount=require(_0x2c9a('0x4'));function loggerCatch(_0xfd41c5){return function(_0x5d6c5b){logger['error'](_0xfd41c5,util[_0x2c9a('0x5')](_0x5d6c5b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x26ba9c,_0x48c7d7){return BPromise['resolve']()[_0x2c9a('0x6')](faxAccount[_0x2c9a('0x7')](_0x26ba9c,_0x48c7d7))[_0x2c9a('0x8')](loggerCatch(_0x2c9a('0x9')));}; \ 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 994bb50..d55e9aa 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 _0xef5e=['child_process','exec','info','Exec\x20gs','\x20Error\x20:','util','bluebird'];(function(_0x4e361d,_0x55f5af){var _0x1f90a1=function(_0x4e9a77){while(--_0x4e9a77){_0x4e361d['push'](_0x4e361d['shift']());}};_0x1f90a1(++_0x55f5af);}(_0xef5e,0xa6));var _0xeef5=function(_0x2895dd,_0x252534){_0x2895dd=_0x2895dd-0x0;var _0x2edc71=_0xef5e[_0x2895dd];return _0x2edc71;};'use strict';var util=require(_0xeef5('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xeef5('0x1'));var exec=require(_0xeef5('0x2'))[_0xeef5('0x3')];exports['execute']=function(_0x4a9696){return new BPromise(function(_0x5344e7,_0x4e307e){exec(_0x4a9696,function(_0x502481,_0x503779,_0x926ff){logger[_0xeef5('0x4')]('Exec\x20gs',_0x503779);if(_0x502481){logger['info'](_0xeef5('0x5'),_0xeef5('0x6'),util['inspect'](_0x502481,{'showHidden':![],'depth':null}),_0x503779,_0x926ff);_0x4e307e(_0x502481);}_0x5344e7(_0x503779);});});}; \ No newline at end of file +var _0xabcd=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xabcd,0x94));var _0xdabc=function(_0x859fb6,_0x59d4d4){_0x859fb6=_0x859fb6-0x0;var _0x2a0b82=_0xabcd[_0x859fb6];return _0x2a0b82;};'use strict';var util=require(_0xdabc('0x0'));var logger=require(_0xdabc('0x1'))('fax');var BPromise=require(_0xdabc('0x2'));var exec=require(_0xdabc('0x3'))[_0xdabc('0x4')];exports[_0xdabc('0x5')]=function(_0x4d1e9d){return new BPromise(function(_0x498349,_0x295754){exec(_0x4d1e9d,function(_0x4493af,_0x508d6e,_0x40654f){logger[_0xdabc('0x6')](_0xdabc('0x7'),_0x508d6e);if(_0x4493af){logger['info']('Exec\x20gs',_0xdabc('0x8'),util[_0xdabc('0x9')](_0x4493af,{'showHidden':![],'depth':null}),_0x508d6e,_0x40654f);_0x295754(_0x4493af);}_0x498349(_0x508d6e);});});}; \ 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 ef2a551..5ccd3ab 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 _0x8ae4=['message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ae4,0x14d));var _0x48ae=function(_0xd80b42,_0x36e020){_0xd80b42=_0xd80b42-0x0;var _0x599414=_0x8ae4[_0xd80b42];return _0x599414;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x48ae('0x0'));var logger=require(_0x48ae('0x1'))(_0x48ae('0x2'));exports[_0x48ae('0x3')]=function(_0x56ec4c){return{'message':_0x56ec4c};};exports[_0x48ae('0x4')]=function(_0x210c8b,_0x480b6b){logger[_0x48ae('0x5')](_0x210c8b,util[_0x48ae('0x6')](_0x480b6b,{'showHidden':![],'depth':null}));};exports[_0x48ae('0x7')]=function(_0x40b25a,_0x2ab1b6){var _0x31d1ba={'XMF-ECM':_0x2ab1b6[_0x48ae('0x8')],'XMF-HEADERINFO':_0x2ab1b6[_0x48ae('0x9')],'XMF-MINRATE':_0x2ab1b6[_0x48ae('0xa')],'XMF-MAXRATE':_0x2ab1b6['maxrate'],'XMF-MODEM':util[_0x48ae('0xb')](_0x48ae('0xc'),_0x2ab1b6[_0x48ae('0xd')]),'XMF-GATEWAY':_0x2ab1b6['gateway'],'XMF-FAXDETECT':_0x2ab1b6['faxdetect'],'XMF-T38TIMEOUT':_0x2ab1b6['t38timeout'],'XMF-LOCALSTATIONID':_0x2ab1b6[_0x48ae('0xe')],'XMF-PATH':_0x40b25a['path']};return _0x31d1ba;};exports[_0x48ae('0xf')]=function(_0x2cb325,_0x51da20){return{'actionid':_0x2cb325[_0x48ae('0x10')],'action':_0x48ae('0x11'),'channel':_0x2cb325[_0x48ae('0x12')],'Exten':_0x48ae('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x48ae('0xb')](_0x48ae('0x14'),_0x2cb325[_0x48ae('0x9')]?_0x2cb325[_0x48ae('0x9')]:'',_0x2cb325[_0x48ae('0xe')]),'variable':_0x51da20,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2cb325['uniqueid']};}; \ No newline at end of file +var _0x1f63=['ecm','headerinfo','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','addVariables'];(function(_0x175273,_0x9deeca){var _0x285273=function(_0x3e142d){while(--_0x3e142d){_0x175273['push'](_0x175273['shift']());}};_0x285273(++_0x9deeca);}(_0x1f63,0x1b2));var _0x31f6=function(_0x8d0f22,_0x303f48){_0x8d0f22=_0x8d0f22-0x0;var _0x312879=_0x1f63[_0x8d0f22];return _0x312879;};'use strict';var util=require(_0x31f6('0x0'));var _=require(_0x31f6('0x1'));var moment=require(_0x31f6('0x2'));var logger=require(_0x31f6('0x3'))(_0x31f6('0x4'));exports[_0x31f6('0x5')]=function(_0x410885){return{'message':_0x410885};};exports['logger']=function(_0x44145a,_0x3bd6be){logger['info'](_0x44145a,util['inspect'](_0x3bd6be,{'showHidden':![],'depth':null}));};exports[_0x31f6('0x6')]=function(_0x687318,_0x234542){var _0x559c9d={'XMF-ECM':_0x234542[_0x31f6('0x7')],'XMF-HEADERINFO':_0x234542[_0x31f6('0x8')],'XMF-MINRATE':_0x234542['minrate'],'XMF-MAXRATE':_0x234542[_0x31f6('0x9')],'XMF-MODEM':util['format'](_0x31f6('0xa'),_0x234542[_0x31f6('0xb')]),'XMF-GATEWAY':_0x234542['gateway'],'XMF-FAXDETECT':_0x234542[_0x31f6('0xc')],'XMF-T38TIMEOUT':_0x234542[_0x31f6('0xd')],'XMF-LOCALSTATIONID':_0x234542[_0x31f6('0xe')],'XMF-PATH':_0x687318['path']};return _0x559c9d;};exports[_0x31f6('0xf')]=function(_0x366eb2,_0x195beb){return{'actionid':_0x366eb2[_0x31f6('0x10')],'action':'originate','channel':_0x366eb2[_0x31f6('0x11')],'Exten':_0x31f6('0x12'),'Context':_0x31f6('0x13'),'Priority':'1','callerid':util['format'](_0x31f6('0x14'),_0x366eb2[_0x31f6('0x8')]?_0x366eb2[_0x31f6('0x8')]:'',_0x366eb2[_0x31f6('0xe')]),'variable':_0x195beb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x366eb2['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index be0e66a..7a9cafa 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 _0x0499=['initVoiceCallReports','catch','sync','error','inspect','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports'];(function(_0x9659ac,_0x993395){var _0x3a6adf=function(_0x42cefd){while(--_0x42cefd){_0x9659ac['push'](_0x9659ac['shift']());}};_0x3a6adf(++_0x993395);}(_0x0499,0x91));var _0x9049=function(_0x47653b,_0xb66c9a){_0x47653b=_0x47653b-0x0;var _0x443752=_0x0499[_0x47653b];return _0x443752;};'use strict';var BPromise=require(_0x9049('0x0'));var util=require('util');var moment=require(_0x9049('0x1'));var server=require(_0x9049('0x2'));var Realtime=require(_0x9049('0x3'));var Report=require(_0x9049('0x4'));var Acw=require(_0x9049('0x5'));var Trigger=require(_0x9049('0x6'));var Dialer=require(_0x9049('0x7'));var Preview=require(_0x9049('0x8'));var Fax=require(_0x9049('0x9'));var user=require(_0x9049('0xa'));var voiceQueue=require(_0x9049('0xb'));var voiceQueueReport=require(_0x9049('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x9049('0xd'));var template=require(_0x9049('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x9049('0xf'));var voiceExtension=require(_0x9049('0x10'));var faxAccount=require(_0x9049('0x11'));var zendesk=require(_0x9049('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9049('0x13'));var desk=require(_0x9049('0x14'));var zoho=require(_0x9049('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x9049('0x16'));var servicenow=require(_0x9049('0x17'));var dynamics365=require(_0x9049('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9049('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9049('0x1a')](_0x9049('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x9049('0x1b')]())['then'](realtime[_0x9049('0x1c')]())[_0x9049('0x1d')](user[_0x9049('0x1e')]())['then'](realtime[_0x9049('0x1f')]())[_0x9049('0x1d')](trunk[_0x9049('0x20')]())[_0x9049('0x1d')](realtime['initTrunks']())[_0x9049('0x1d')](voiceQueue[_0x9049('0x21')]())['then'](realtime[_0x9049('0x22')]())[_0x9049('0x1d')](trigger[_0x9049('0x23')]())['then'](realtime['initTriggers']())['then'](template[_0x9049('0x24')]())[_0x9049('0x1d')](realtime[_0x9049('0x25')]())[_0x9049('0x1d')](zendesk[_0x9049('0x26')]())['then'](realtime[_0x9049('0x27')]())[_0x9049('0x1d')](salesforce[_0x9049('0x28')]())['then'](realtime['initSalesforceAccounts']())[_0x9049('0x1d')](sugarcrm[_0x9049('0x29')]())[_0x9049('0x1d')](realtime[_0x9049('0x2a')]())['then'](freshdesk[_0x9049('0x2b')]())['then'](realtime[_0x9049('0x2c')]())['then'](desk[_0x9049('0x2d')]())[_0x9049('0x1d')](realtime[_0x9049('0x2e')]())[_0x9049('0x1d')](zoho[_0x9049('0x2f')]())[_0x9049('0x1d')](realtime[_0x9049('0x30')]())['then'](vtiger['getVtigerAccounts']())[_0x9049('0x1d')](realtime[_0x9049('0x31')]())[_0x9049('0x1d')](freshsales[_0x9049('0x32')]())[_0x9049('0x1d')](realtime[_0x9049('0x33')]())[_0x9049('0x1d')](servicenow['getServicenowAccounts']())[_0x9049('0x1d')](realtime[_0x9049('0x34')]())[_0x9049('0x1d')](dynamics365[_0x9049('0x35')]())[_0x9049('0x1d')](realtime[_0x9049('0x36')]())['then'](campaign[_0x9049('0x37')]())[_0x9049('0x1d')](realtime[_0x9049('0x38')]())[_0x9049('0x1d')](voiceExtension[_0x9049('0x39')]())['then'](realtime['initVoiceExtensions']())[_0x9049('0x1d')](faxAccount['getFaxAccounts']())[_0x9049('0x1d')](realtime[_0x9049('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x9049('0x1d')](voiceQueueReport[_0x9049('0x3b')]())['then'](realtime[_0x9049('0x3c')]())[_0x9049('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9049('0x1d')](realtime[_0x9049('0x3d')]())['then'](cmHopperHistory[_0x9049('0x3e')]())[_0x9049('0x1d')](realtime[_0x9049('0x3f')]())[_0x9049('0x1d')](voiceCallReport[_0x9049('0x40')]())[_0x9049('0x1d')](realtime[_0x9049('0x41')]())[_0x9049('0x42')](function(_0x129751){logger['error']('[index.js][initParams]',util['inspect'](_0x129751,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x9049('0x1d')](function(_0x59de73){return initRealtime();})[_0x9049('0x1d')](function(){return initParams();})[_0x9049('0x1d')](function(){report[_0x9049('0x43')]();setInterval(initRealtime,0x1388);})[_0x9049('0x42')](function(_0x5e6dd1){logger[_0x9049('0x44')]('[index.js][main]',util[_0x9049('0x45')](_0x5e6dd1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0f2a=['resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0f2a,0x12e));var _0xa0f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f2a[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xa0f2('0x0'));var util=require(_0xa0f2('0x1'));var moment=require(_0xa0f2('0x2'));var server=require(_0xa0f2('0x3'));var Realtime=require(_0xa0f2('0x4'));var Report=require(_0xa0f2('0x5'));var Acw=require(_0xa0f2('0x6'));var Trigger=require('./trigger');var Dialer=require(_0xa0f2('0x7'));var Preview=require(_0xa0f2('0x8'));var Fax=require(_0xa0f2('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xa0f2('0xa'));var voiceQueueReport=require(_0xa0f2('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xa0f2('0xc'));var template=require(_0xa0f2('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xa0f2('0xe'));var voiceExtension=require(_0xa0f2('0xf'));var faxAccount=require(_0xa0f2('0x10'));var zendesk=require(_0xa0f2('0x11'));var salesforce=require(_0xa0f2('0x12'));var sugarcrm=require(_0xa0f2('0x13'));var freshdesk=require(_0xa0f2('0x14'));var desk=require(_0xa0f2('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa0f2('0x16'));var freshsales=require(_0xa0f2('0x17'));var servicenow=require(_0xa0f2('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xa0f2('0x19'))(_0xa0f2('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa0f2('0x1b')](_0xa0f2('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa0f2('0x1b')](_0xa0f2('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xa0f2('0x1d')](user[_0xa0f2('0x1e')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x1f')]())['then'](user[_0xa0f2('0x20')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x21')]())[_0xa0f2('0x1d')](trunk['getTrunks']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x22')]())['then'](voiceQueue[_0xa0f2('0x23')]())[_0xa0f2('0x1d')](realtime['initVoiceQueues']())[_0xa0f2('0x1d')](trigger[_0xa0f2('0x24')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x25')]())[_0xa0f2('0x1d')](template[_0xa0f2('0x26')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x27')]())[_0xa0f2('0x1d')](zendesk['getZendeskAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x28')]())[_0xa0f2('0x1d')](salesforce['getSalesforceAccounts']())[_0xa0f2('0x1d')](realtime['initSalesforceAccounts']())[_0xa0f2('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x29')]())[_0xa0f2('0x1d')](freshdesk[_0xa0f2('0x2a')]())[_0xa0f2('0x1d')](realtime['initFreshdeskAccounts']())[_0xa0f2('0x1d')](desk[_0xa0f2('0x2b')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2c')]())[_0xa0f2('0x1d')](zoho[_0xa0f2('0x2d')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2e')]())[_0xa0f2('0x1d')](vtiger['getVtigerAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2f')]())[_0xa0f2('0x1d')](freshsales[_0xa0f2('0x30')]())['then'](realtime[_0xa0f2('0x31')]())['then'](servicenow[_0xa0f2('0x32')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x33')]())['then'](dynamics365['getDynamics365Accounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x34')]())[_0xa0f2('0x1d')](campaign[_0xa0f2('0x35')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x36')]())[_0xa0f2('0x1d')](voiceExtension[_0xa0f2('0x37')]())['then'](realtime['initVoiceExtensions']())[_0xa0f2('0x1d')](faxAccount[_0xa0f2('0x38')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa0f2('0x3a')]()[_0xa0f2('0x1d')](voiceQueueReport[_0xa0f2('0x3b')]())['then'](realtime[_0xa0f2('0x3c')]())['then'](cmHopperHistory[_0xa0f2('0x3d')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x3e')]())[_0xa0f2('0x1d')](cmHopperHistory[_0xa0f2('0x3f')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x40')]())[_0xa0f2('0x1d')](voiceCallReport[_0xa0f2('0x41')]())[_0xa0f2('0x1d')](realtime['initVoiceCallReports']())[_0xa0f2('0x42')](function(_0x290991){logger[_0xa0f2('0x43')](_0xa0f2('0x44'),util[_0xa0f2('0x45')](_0x290991,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa0f2('0x46')](realtime,preview,fax)[_0xa0f2('0x1d')](function(_0x24f1ce){return initRealtime();})['then'](function(){return initParams();})[_0xa0f2('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xa0f2('0x42')](function(_0xf74d22){logger[_0xa0f2('0x43')](_0xa0f2('0x47'),util[_0xa0f2('0x45')](_0xf74d22,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b7e07c4..91c8fbb 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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x3ee9fa,_0x106ab5){var _0x58d998=function(_0x522926){while(--_0x522926){_0x3ee9fa['push'](_0x3ee9fa['shift']());}};_0x58d998(++_0x106ab5);}(_0x34e8,0x12c));var _0x834e=function(_0x1b3d97,_0x9bcc61){_0x1b3d97=_0x1b3d97-0x0;var _0x271727=_0x34e8[_0x1b3d97];return _0x271727;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file +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(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xedd9,0xfc));var _0x9edd=function(_0x21ee3b,_0x4a016f){_0x21ee3b=_0x21ee3b-0x0;var _0x15a46d=_0xedd9[_0x21ee3b];return _0x15a46d;};'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 diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 03f7e1f..5d4265e 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 _0xe2a0=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xe2a0,0x18c));var _0x0e2a=function(_0x497641,_0x5d4f64){_0x497641=_0x497641-0x0;var _0x3c355e=_0xe2a0[_0x497641];return _0x3c355e;};'use strict';function Campaign(_0x369043){this['id']=_0x369043['id']||0x0;this[_0x0e2a('0x0')]=_0x369043['name']||'';this['type']=_0x369043[_0x0e2a('0x1')]||_0x0e2a('0x2');this[_0x0e2a('0x3')]=0x0;this[_0x0e2a('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x0e2a('0x5')]=0x0;this[_0x0e2a('0x6')]='';this[_0x0e2a('0x7')]=!![];this['active']=_0x369043[_0x0e2a('0x8')];this[_0x0e2a('0x9')]=_0x369043[_0x0e2a('0x9')];this[_0x0e2a('0xa')]=_0x369043[_0x0e2a('0xa')]||null;this['dialGlobalInterval']=_0x369043['dialGlobalInterval']?_0x369043[_0x0e2a('0xb')]:null;this['dialOriginateCallerIdName']=_0x369043[_0x0e2a('0xc')];this[_0x0e2a('0xd')]=_0x369043['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x369043[_0x0e2a('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x369043['dialCongestionMaxRetry'];this[_0x0e2a('0xf')]=_0x369043[_0x0e2a('0xf')];this['dialBusyMaxRetry']=_0x369043[_0x0e2a('0x10')];this[_0x0e2a('0x11')]=_0x369043['dialBusyRetryFrequency'];this[_0x0e2a('0x12')]=_0x369043[_0x0e2a('0x12')];this[_0x0e2a('0x13')]=_0x369043[_0x0e2a('0x13')];this[_0x0e2a('0x14')]=_0x369043[_0x0e2a('0x14')];this[_0x0e2a('0x15')]=_0x369043[_0x0e2a('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x369043['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0e2a('0x16')]=_0x369043['dialDropMaxRetry']||0x3;this[_0x0e2a('0x17')]=_0x369043['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x369043[_0x0e2a('0x18')]||0x3;this[_0x0e2a('0x19')]=_0x369043['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x369043['dialMachineMaxRetry']||0x3;this[_0x0e2a('0x1a')]=_0x369043[_0x0e2a('0x1a')]||0x96;this[_0x0e2a('0x1b')]=_0x369043[_0x0e2a('0x1b')]||0x3;this[_0x0e2a('0x1c')]=_0x369043['dialAgentRejectRetryFrequency']||0x96;this[_0x0e2a('0x1d')]=_0x369043[_0x0e2a('0x1d')]||_0x0e2a('0x1e');this[_0x0e2a('0x1f')]=_0x369043[_0x0e2a('0x1f')]||undefined;this[_0x0e2a('0x20')]=_0x369043[_0x0e2a('0x20')]||undefined;this[_0x0e2a('0x21')]=_0x369043[_0x0e2a('0x21')]||undefined;this['TrunkBackup']=_0x369043['TrunkBackup']?_0x369043[_0x0e2a('0x22')]:undefined;this[_0x0e2a('0x23')]=_0x369043[_0x0e2a('0x23')]?_0x369043[_0x0e2a('0x23')]:undefined;this[_0x0e2a('0x24')]=_0x369043[_0x0e2a('0x24')]?_0x369043[_0x0e2a('0x24')]:undefined;this[_0x0e2a('0x25')]=_0x369043[_0x0e2a('0x25')]?_0x369043[_0x0e2a('0x25')]:undefined;this[_0x0e2a('0x26')]=_0x369043[_0x0e2a('0x25')]?_0x369043[_0x0e2a('0x25')]['name']:undefined;this[_0x0e2a('0x27')]=_0x369043[_0x0e2a('0x27')]||![];this['dialAMDInitialSilence']=_0x369043['dialAMDInitialSilence'];this[_0x0e2a('0x28')]=_0x369043[_0x0e2a('0x28')];this['dialAMDAfterGreetingSilence']=_0x369043[_0x0e2a('0x29')];this[_0x0e2a('0x2a')]=_0x369043[_0x0e2a('0x2a')];this[_0x0e2a('0x2b')]=_0x369043[_0x0e2a('0x2b')];this[_0x0e2a('0x2c')]=_0x369043[_0x0e2a('0x2c')];this[_0x0e2a('0x2d')]=_0x369043[_0x0e2a('0x2d')];this[_0x0e2a('0x2e')]=_0x369043[_0x0e2a('0x2e')];this[_0x0e2a('0x2f')]=_0x369043[_0x0e2a('0x2f')];}module[_0x0e2a('0x30')]=Campaign; \ No newline at end of file +var _0x10a6=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup'];(function(_0x41be5e,_0x179575){var _0x32cdee=function(_0x181214){while(--_0x181214){_0x41be5e['push'](_0x41be5e['shift']());}};_0x32cdee(++_0x179575);}(_0x10a6,0x16d));var _0x610a=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x10a6[_0x17406e];return _0x2bfc5a;};'use strict';function Campaign(_0x372c13){this['id']=_0x372c13['id']||0x0;this[_0x610a('0x0')]=_0x372c13[_0x610a('0x0')]||'';this[_0x610a('0x1')]=_0x372c13['type']||_0x610a('0x2');this[_0x610a('0x3')]=0x0;this[_0x610a('0x4')]=0x0;this[_0x610a('0x5')]=0x0;this[_0x610a('0x6')]=0x0;this[_0x610a('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x372c13['active'];this[_0x610a('0x8')]=_0x372c13[_0x610a('0x8')];this[_0x610a('0x9')]=_0x372c13[_0x610a('0x9')]||null;this[_0x610a('0xa')]=_0x372c13[_0x610a('0xa')]?_0x372c13[_0x610a('0xa')]:null;this[_0x610a('0xb')]=_0x372c13[_0x610a('0xb')];this[_0x610a('0xc')]=_0x372c13[_0x610a('0xc')];this[_0x610a('0xd')]=_0x372c13[_0x610a('0xd')]||0x1e;this[_0x610a('0xe')]=_0x372c13['dialCongestionMaxRetry'];this[_0x610a('0xf')]=_0x372c13[_0x610a('0xf')];this['dialBusyMaxRetry']=_0x372c13[_0x610a('0x10')];this[_0x610a('0x11')]=_0x372c13[_0x610a('0x11')];this[_0x610a('0x12')]=_0x372c13['dialNoAnswerMaxRetry'];this[_0x610a('0x13')]=_0x372c13['dialNoAnswerRetryFrequency'];this[_0x610a('0x14')]=_0x372c13[_0x610a('0x14')];this['dialNoSuchNumberMaxRetry']=_0x372c13['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x372c13[_0x610a('0x15')]||0x96;this[_0x610a('0x16')]=_0x372c13[_0x610a('0x16')]||0x3;this[_0x610a('0x17')]=_0x372c13['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x372c13[_0x610a('0x18')]||0x3;this[_0x610a('0x19')]=_0x372c13['dialAbandonedRetryFrequency']||0x96;this[_0x610a('0x1a')]=_0x372c13[_0x610a('0x1a')]||0x3;this[_0x610a('0x1b')]=_0x372c13[_0x610a('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x372c13[_0x610a('0x1c')]||0x3;this[_0x610a('0x1d')]=_0x372c13[_0x610a('0x1d')]||0x96;this[_0x610a('0x1e')]=_0x372c13[_0x610a('0x1e')]||_0x610a('0x1f');this[_0x610a('0x20')]=_0x372c13[_0x610a('0x20')]||undefined;this[_0x610a('0x21')]=_0x372c13[_0x610a('0x21')]||undefined;this['dialCutDigit']=_0x372c13['dialCutDigit']||undefined;this['TrunkBackup']=_0x372c13[_0x610a('0x22')]?_0x372c13[_0x610a('0x22')]:undefined;this[_0x610a('0x23')]=_0x372c13[_0x610a('0x23')]?_0x372c13['Trunk']:undefined;this['Interval']=_0x372c13[_0x610a('0x24')]?_0x372c13[_0x610a('0x24')]:undefined;this[_0x610a('0x25')]=_0x372c13[_0x610a('0x25')]?_0x372c13['SquareProject']:undefined;this[_0x610a('0x26')]=_0x372c13[_0x610a('0x25')]?_0x372c13['SquareProject']['name']:undefined;this['dialAMDActive']=_0x372c13[_0x610a('0x27')]||![];this['dialAMDInitialSilence']=_0x372c13[_0x610a('0x28')];this[_0x610a('0x29')]=_0x372c13['dialAMDGreeting'];this[_0x610a('0x2a')]=_0x372c13[_0x610a('0x2a')];this['dialAMDTotalAnalysisTime']=_0x372c13[_0x610a('0x2b')];this[_0x610a('0x2c')]=_0x372c13[_0x610a('0x2c')];this[_0x610a('0x2d')]=_0x372c13[_0x610a('0x2d')];this[_0x610a('0x2e')]=_0x372c13[_0x610a('0x2e')];this[_0x610a('0x2f')]=_0x372c13[_0x610a('0x2f')];this[_0x610a('0x30')]=_0x372c13[_0x610a('0x30')];}module[_0x610a('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 9406975..e8a1d6a 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 _0xf194=['lastapplication','lastdata','billableseconds','tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned'];(function(_0x575da9,_0x17f518){var _0x266beb=function(_0x271232){while(--_0x271232){_0x575da9['push'](_0x575da9['shift']());}};_0x266beb(++_0x17f518);}(_0xf194,0x19b));var _0x4f19=function(_0x1ddac5,_0x324061){_0x1ddac5=_0x1ddac5-0x0;var _0x191eff=_0xf194[_0x1ddac5];return _0x191eff;};'use strict';function Channel(){this['starttime']=null;this[_0x4f19('0x0')]='';this[_0x4f19('0x1')]='';this[_0x4f19('0x2')]=0x0;this[_0x4f19('0x3')]='';this[_0x4f19('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x4f19('0x5')]=0x0;this[_0x4f19('0x6')]='';this['uniqueid']=0x0;this[_0x4f19('0x7')]=0x0;this[_0x4f19('0x8')]=0x0;this[_0x4f19('0x9')]=![];this[_0x4f19('0xa')]=null;this[_0x4f19('0xb')]=null;this[_0x4f19('0xc')]=![];this[_0x4f19('0xd')]=![];this[_0x4f19('0xe')]='';this[_0x4f19('0xf')]='';this['duration']=0x0;this[_0x4f19('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0x4f19('0x11')]=null;this[_0x4f19('0x12')]=null;this[_0x4f19('0x13')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x4f19('0x14')]=[];this[_0x4f19('0x15')]=undefined;this[_0x4f19('0x16')]=undefined;this['transferType']=undefined;this[_0x4f19('0x17')]=0x0;}module[_0x4f19('0x18')]=Channel; \ No newline at end of file +var _0x3f48=['abandoned','lastapplication','lastdata','duration','holdtime','type','tag','queue','monitors','transfercalleridnum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','linkedid','answered','answertime','endtime','unmanaged'];(function(_0x332065,_0x1e6002){var _0x5ee81a=function(_0x6519d3){while(--_0x6519d3){_0x332065['push'](_0x332065['shift']());}};_0x5ee81a(++_0x1e6002);}(_0x3f48,0x17c));var _0x83f4=function(_0x2f296e,_0x117ffc){_0x2f296e=_0x2f296e-0x0;var _0x2c7a92=_0x3f48[_0x2f296e];return _0x2c7a92;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x83f4('0x0')]='';this[_0x83f4('0x1')]=0x0;this[_0x83f4('0x2')]='';this[_0x83f4('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x83f4('0x4')]=0x0;this[_0x83f4('0x5')]='';this['uniqueid']=0x0;this[_0x83f4('0x6')]=0x0;this['exten']=0x0;this[_0x83f4('0x7')]=![];this[_0x83f4('0x8')]=null;this[_0x83f4('0x9')]=null;this[_0x83f4('0xa')]=![];this[_0x83f4('0xb')]=![];this[_0x83f4('0xc')]='';this[_0x83f4('0xd')]='';this[_0x83f4('0xe')]=0x0;this['billableseconds']=0x0;this[_0x83f4('0xf')]=0x0;this[_0x83f4('0x10')]=null;this[_0x83f4('0x11')]=null;this['disposition']=null;this['monitor']=![];this['monitorFilename']=null;this[_0x83f4('0x12')]=null;this[_0x83f4('0x13')]=[];this[_0x83f4('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x83f4('0x15')]=undefined;this[_0x83f4('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 13be097..f44c588 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 _0x8336=['consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8336,0xc6));var _0x6833=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x8336[_0x28aea5];return _0x6a55f9;};'use strict';function DeskAccount(_0x80c41d){this['id']=_0x80c41d['id']||0x0;this[_0x6833('0x0')]=_0x80c41d['name']||'';this[_0x6833('0x1')]=_0x80c41d['username']||'';this[_0x6833('0x2')]=_0x80c41d[_0x6833('0x2')]||'';this[_0x6833('0x3')]=_0x80c41d[_0x6833('0x3')]||'';this[_0x6833('0x4')]=_0x80c41d[_0x6833('0x4')]||'';this[_0x6833('0x5')]=_0x80c41d['consumerKey']||'';this[_0x6833('0x6')]=_0x80c41d[_0x6833('0x6')]||'';this[_0x6833('0x7')]=_0x80c41d[_0x6833('0x7')]||'';this[_0x6833('0x8')]=_0x80c41d[_0x6833('0x8')]||'';this['type']=_0x80c41d['type']||'';this[_0x6833('0x9')]=_0x80c41d[_0x6833('0x9')]||'';this[_0x6833('0xa')]=_0x80c41d[_0x6833('0xa')]||{};}module[_0x6833('0xb')]=DeskAccount; \ No newline at end of file +var _0xca45=['Configurations','exports','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2d0b4c,_0x10499f){var _0x1649af=function(_0x1256b3){while(--_0x1256b3){_0x2d0b4c['push'](_0x2d0b4c['shift']());}};_0x1649af(++_0x10499f);}(_0xca45,0x106));var _0x5ca4=function(_0x2384bb,_0x39682f){_0x2384bb=_0x2384bb-0x0;var _0x299201=_0xca45[_0x2384bb];return _0x299201;};'use strict';function DeskAccount(_0xebf9e5){this['id']=_0xebf9e5['id']||0x0;this['name']=_0xebf9e5['name']||'';this['username']=_0xebf9e5['username']||'';this[_0x5ca4('0x0')]=_0xebf9e5[_0x5ca4('0x0')]||'';this[_0x5ca4('0x1')]=_0xebf9e5[_0x5ca4('0x1')]||'';this[_0x5ca4('0x2')]=_0xebf9e5['password']||'';this['consumerKey']=_0xebf9e5['consumerKey']||'';this[_0x5ca4('0x3')]=_0xebf9e5[_0x5ca4('0x3')]||'';this[_0x5ca4('0x4')]=_0xebf9e5['token']||'';this[_0x5ca4('0x5')]=_0xebf9e5[_0x5ca4('0x5')]||'';this[_0x5ca4('0x6')]=_0xebf9e5[_0x5ca4('0x6')]||'';this[_0x5ca4('0x7')]=_0xebf9e5[_0x5ca4('0x7')]||'';this[_0x5ca4('0x8')]=_0xebf9e5[_0x5ca4('0x8')]||{};}module[_0x5ca4('0x9')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 53d2c2f..65537fe 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 _0x739e=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x739e,0xf1));var _0xe739=function(_0x27b069,_0x334c15){_0x27b069=_0x27b069-0x0;var _0x4262a5=_0x739e[_0x27b069];return _0x4262a5;};'use strict';function Dynamics365Account(_0x577fbb){this['id']=_0x577fbb['id']||0x0;this[_0xe739('0x0')]=_0x577fbb[_0xe739('0x0')]||'';this[_0xe739('0x1')]=_0x577fbb[_0xe739('0x1')]||'';this[_0xe739('0x2')]=_0x577fbb[_0xe739('0x2')]||'';this[_0xe739('0x3')]=_0x577fbb[_0xe739('0x3')]||'';this[_0xe739('0x4')]=_0x577fbb[_0xe739('0x4')]||'';this[_0xe739('0x5')]=_0x577fbb[_0xe739('0x5')]||'';this[_0xe739('0x6')]=_0x577fbb['clientSecret']||{};this['serverUrl']=_0x577fbb[_0xe739('0x7')]||'';this[_0xe739('0x8')]=_0x577fbb[_0xe739('0x8')]||![];this[_0xe739('0x9')]=_0x577fbb[_0xe739('0x9')]||{};this['CloudProvider']=_0x577fbb[_0xe739('0xa')]||{};}module[_0xe739('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x9ae0=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations'];(function(_0x394fa5,_0x2195ab){var _0x260050=function(_0x12b112){while(--_0x12b112){_0x394fa5['push'](_0x394fa5['shift']());}};_0x260050(++_0x2195ab);}(_0x9ae0,0x18e));var _0x09ae=function(_0x29b186,_0x315a92){_0x29b186=_0x29b186-0x0;var _0x48fbc7=_0x9ae0[_0x29b186];return _0x48fbc7;};'use strict';function Dynamics365Account(_0x5d023c){this['id']=_0x5d023c['id']||0x0;this[_0x09ae('0x0')]=_0x5d023c[_0x09ae('0x0')]||'';this['username']=_0x5d023c[_0x09ae('0x1')]||'';this[_0x09ae('0x2')]=_0x5d023c[_0x09ae('0x2')]||'';this[_0x09ae('0x3')]=_0x5d023c[_0x09ae('0x3')]||'';this[_0x09ae('0x4')]=_0x5d023c['tenantId']||'';this[_0x09ae('0x5')]=_0x5d023c[_0x09ae('0x5')]||'';this['clientSecret']=_0x5d023c[_0x09ae('0x6')]||{};this['serverUrl']=_0x5d023c['serverUrl']||'';this[_0x09ae('0x7')]=_0x5d023c[_0x09ae('0x7')]||![];this[_0x09ae('0x8')]=_0x5d023c['Configurations']||{};this['CloudProvider']=_0x5d023c[_0x09ae('0x9')]||{};}module[_0x09ae('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 97ad19f..faa1c20 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 _0x0681=['SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0681,0x8b));var _0x1068=function(_0x35b7c3,_0x243e1b){_0x35b7c3=_0x35b7c3-0x0;var _0x3681d9=_0x0681[_0x35b7c3];return _0x3681d9;};'use strict';function FaxAccount(_0x8fb381){this['id']=_0x8fb381['id']||0x0;this['name']=_0x8fb381[_0x1068('0x0')]||'';this[_0x1068('0x1')]=_0x8fb381[_0x1068('0x1')];this[_0x1068('0x2')]=_0x8fb381['ecm'];this['headerinfo']=_0x8fb381[_0x1068('0x3')];this[_0x1068('0x4')]=_0x8fb381[_0x1068('0x4')];this['minrate']=_0x8fb381['minrate']||0x960;this[_0x1068('0x5')]=_0x8fb381['maxrate']||0x3840;this[_0x1068('0x6')]=_0x8fb381[_0x1068('0x6')]||'v17,v27,v29';this[_0x1068('0x7')]=_0x8fb381[_0x1068('0x7')]||'no';this['faxdetect']=_0x8fb381[_0x1068('0x8')]||'no';this[_0x1068('0x9')]=_0x8fb381['t38timeout']||0x1388;this['tech']=_0x8fb381[_0x1068('0xa')]||_0x1068('0xb');this[_0x1068('0xc')]=_0x8fb381[_0x1068('0xc')]?_0x8fb381[_0x1068('0xc')]:undefined;this[_0x1068('0xd')]=_0x8fb381[_0x1068('0xd')];this[_0x1068('0xe')]=_0x8fb381[_0x1068('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x6a65=['description','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x6a65,0x1a3));var _0x56a6=function(_0x1954b9,_0x1842aa){_0x1954b9=_0x1954b9-0x0;var _0x461e41=_0x6a65[_0x1954b9];return _0x461e41;};'use strict';function FaxAccount(_0x30c9fa){this['id']=_0x30c9fa['id']||0x0;this[_0x56a6('0x0')]=_0x30c9fa[_0x56a6('0x0')]||'';this[_0x56a6('0x1')]=_0x30c9fa[_0x56a6('0x1')];this['ecm']=_0x30c9fa['ecm'];this[_0x56a6('0x2')]=_0x30c9fa['headerinfo'];this[_0x56a6('0x3')]=_0x30c9fa['localstationid'];this[_0x56a6('0x4')]=_0x30c9fa[_0x56a6('0x4')]||0x960;this[_0x56a6('0x5')]=_0x30c9fa['maxrate']||0x3840;this['modem']=_0x30c9fa['modem']||'v17,v27,v29';this[_0x56a6('0x6')]=_0x30c9fa[_0x56a6('0x6')]||'no';this[_0x56a6('0x7')]=_0x30c9fa['faxdetect']||'no';this[_0x56a6('0x8')]=_0x30c9fa[_0x56a6('0x8')]||0x1388;this['tech']=_0x30c9fa[_0x56a6('0x9')]||_0x56a6('0xa');this['Trunk']=_0x30c9fa[_0x56a6('0xb')]?_0x30c9fa[_0x56a6('0xb')]:undefined;this['ListId']=_0x30c9fa[_0x56a6('0xc')];this[_0x56a6('0xd')]=_0x30c9fa['key'];}module[_0x56a6('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4ccb23f..2d3b189 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 _0xcbb4=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4f4fa8,_0x455a27){var _0x563b7a=function(_0x32b71b){while(--_0x32b71b){_0x4f4fa8['push'](_0x4f4fa8['shift']());}};_0x563b7a(++_0x455a27);}(_0xcbb4,0x17c));var _0x4cbb=function(_0x3c68ac,_0x38b406){_0x3c68ac=_0x3c68ac-0x0;var _0x35d849=_0xcbb4[_0x3c68ac];return _0x35d849;};'use strict';function FreshdeskAccount(_0x574f81){this['id']=_0x574f81['id']||0x0;this['name']=_0x574f81[_0x4cbb('0x0')]||'';this[_0x4cbb('0x1')]=_0x574f81[_0x4cbb('0x1')]||'';this[_0x4cbb('0x2')]=_0x574f81[_0x4cbb('0x3')]||'';this[_0x4cbb('0x4')]=_0x574f81[_0x4cbb('0x4')]||'';this[_0x4cbb('0x5')]=_0x574f81['serverUrl']||'';this[_0x4cbb('0x6')]=_0x574f81[_0x4cbb('0x6')]||{};}module[_0x4cbb('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x468c=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x4ca0bf,_0x27eb4d){var _0x2b26b6=function(_0x109643){while(--_0x109643){_0x4ca0bf['push'](_0x4ca0bf['shift']());}};_0x2b26b6(++_0x27eb4d);}(_0x468c,0x112));var _0xc468=function(_0xd47916,_0x4be2a2){_0xd47916=_0xd47916-0x0;var _0x30759c=_0x468c[_0xd47916];return _0x30759c;};'use strict';function FreshdeskAccount(_0x56b37b){this['id']=_0x56b37b['id']||0x0;this[_0xc468('0x0')]=_0x56b37b[_0xc468('0x0')]||'';this[_0xc468('0x1')]=_0x56b37b['username']||'';this[_0xc468('0x2')]=_0x56b37b['token']||'';this[_0xc468('0x3')]=_0x56b37b[_0xc468('0x3')]||'';this[_0xc468('0x4')]=_0x56b37b[_0xc468('0x4')]||'';this[_0xc468('0x5')]=_0x56b37b[_0xc468('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a6d479d..8d3a435 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 _0xf006=['serverUrl','Configurations','name','username','apiKey','remoteUri'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf006,0x146));var _0x6f00=function(_0x1e94bf,_0x334bfc){_0x1e94bf=_0x1e94bf-0x0;var _0xa9b4a2=_0xf006[_0x1e94bf];return _0xa9b4a2;};'use strict';function FreshsalesAccount(_0x280b7f){this['id']=_0x280b7f['id']||0x0;this['name']=_0x280b7f[_0x6f00('0x0')]||'';this[_0x6f00('0x1')]=_0x280b7f['username']||'';this[_0x6f00('0x2')]=_0x280b7f['token']||'';this[_0x6f00('0x3')]=_0x280b7f['remoteUri']||'';this['serverUrl']=_0x280b7f[_0x6f00('0x4')]||'';this[_0x6f00('0x5')]=_0x280b7f[_0x6f00('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x5301=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3aa98c,_0x574cb6){var _0x49e505=function(_0x4de8dd){while(--_0x4de8dd){_0x3aa98c['push'](_0x3aa98c['shift']());}};_0x49e505(++_0x574cb6);}(_0x5301,0x157));var _0x1530=function(_0x571b72,_0x5168e2){_0x571b72=_0x571b72-0x0;var _0x33a2ab=_0x5301[_0x571b72];return _0x33a2ab;};'use strict';function FreshsalesAccount(_0x3b2e8f){this['id']=_0x3b2e8f['id']||0x0;this[_0x1530('0x0')]=_0x3b2e8f[_0x1530('0x0')]||'';this[_0x1530('0x1')]=_0x3b2e8f[_0x1530('0x1')]||'';this[_0x1530('0x2')]=_0x3b2e8f['token']||'';this[_0x1530('0x3')]=_0x3b2e8f[_0x1530('0x3')]||'';this[_0x1530('0x4')]=_0x3b2e8f[_0x1530('0x4')]||'';this['Configurations']=_0x3b2e8f[_0x1530('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fc0044e..b0b7a29 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 _0x27d5=['assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','priority','holdtime'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x27d5,0x1aa));var _0x527d=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x27d5[_0x20fb02];return _0x24a33e;};'use strict';function QueueReport(){this[_0x527d('0x0')]=_0x527d('0x1');this[_0x527d('0x2')]='';this[_0x527d('0x3')]='';this[_0x527d('0x4')]='';this[_0x527d('0x5')]='';this[_0x527d('0x6')]=null;this[_0x527d('0x7')]=null;this['position']=0x1;this[_0x527d('0x8')]=0x1;this[_0x527d('0x9')]=![];this[_0x527d('0xa')]=null;this[_0x527d('0xb')]=![];this[_0x527d('0xc')]=null;this[_0x527d('0xd')]=![];this[_0x527d('0xe')]=null;this[_0x527d('0xf')]=0x1;this[_0x527d('0x10')]='';this[_0x527d('0x11')]='';this[_0x527d('0x12')]='';this['accountcode']='';this[_0x527d('0x13')]='';this['exten']='';this[_0x527d('0x14')]='';this[_0x527d('0x15')]=0x0;this[_0x527d('0x16')]=![];this[_0x527d('0x17')]='';this[_0x527d('0x18')]=_0x527d('0x19');this[_0x527d('0x1a')]=0x0;this[_0x527d('0x1b')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x49be=['motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','holdtime','assigned','lastAssignedTo'];(function(_0x290fb9,_0xbc4966){var _0x289d53=function(_0x47eb0a){while(--_0x47eb0a){_0x290fb9['push'](_0x290fb9['shift']());}};_0x289d53(++_0xbc4966);}(_0x49be,0xe6));var _0xe49b=function(_0x4880fd,_0x2cc70d){_0x4880fd=_0x4880fd-0x0;var _0x4a4b50=_0x49be[_0x4880fd];return _0x4a4b50;};'use strict';function QueueReport(){this[_0xe49b('0x0')]='inbound';this[_0xe49b('0x1')]='';this[_0xe49b('0x2')]='';this[_0xe49b('0x3')]='';this[_0xe49b('0x4')]='';this[_0xe49b('0x5')]=null;this[_0xe49b('0x6')]=null;this['position']=0x1;this[_0xe49b('0x7')]=0x1;this[_0xe49b('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xe49b('0x9')]=![];this[_0xe49b('0xa')]=null;this[_0xe49b('0xb')]=![];this[_0xe49b('0xc')]=null;this['originalposition']=0x1;this[_0xe49b('0xd')]='';this[_0xe49b('0xe')]='';this[_0xe49b('0xf')]='';this[_0xe49b('0x10')]='';this['context']='';this['exten']='';this['priority']='';this[_0xe49b('0x11')]=0x0;this[_0xe49b('0x12')]=![];this[_0xe49b('0x13')]='';this[_0xe49b('0x14')]=_0xe49b('0x15');this[_0xe49b('0x16')]=0x0;this[_0xe49b('0x17')]={};}module[_0xe49b('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b5025b4..96d8b7e 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 _0xed4a=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xed4a,0xd2));var _0xaed4=function(_0x51505b,_0x359905){_0x51505b=_0x51505b-0x0;var _0x11d6c6=_0xed4a[_0x51505b];return _0x11d6c6;};'use strict';function SalesforceAccount(_0x3121c0){this['id']=_0x3121c0['id']||0x0;this[_0xaed4('0x0')]=_0x3121c0['name']||'';this['username']=_0x3121c0[_0xaed4('0x1')]||'';this[_0xaed4('0x2')]=_0x3121c0[_0xaed4('0x2')]||'';this['password']=_0x3121c0[_0xaed4('0x3')]||'';this[_0xaed4('0x4')]=_0x3121c0['clientId']||'';this[_0xaed4('0x5')]=_0x3121c0[_0xaed4('0x5')]||'';this[_0xaed4('0x6')]=_0x3121c0[_0xaed4('0x6')]||'';this[_0xaed4('0x7')]=_0x3121c0[_0xaed4('0x7')]||_0xaed4('0x8');this['serverUrl']=_0x3121c0[_0xaed4('0x9')]||'';this[_0xaed4('0xa')]=_0x3121c0[_0xaed4('0xa')]||{};}module[_0xaed4('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x3f15=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','remoteUri','password'];(function(_0x17fd72,_0x2b8254){var _0xa8d8c6=function(_0x12bb6d){while(--_0x12bb6d){_0x17fd72['push'](_0x17fd72['shift']());}};_0xa8d8c6(++_0x2b8254);}(_0x3f15,0xb1));var _0x53f1=function(_0x2b79b3,_0xe85375){_0x2b79b3=_0x2b79b3-0x0;var _0x286535=_0x3f15[_0x2b79b3];return _0x286535;};'use strict';function SalesforceAccount(_0x4e0e33){this['id']=_0x4e0e33['id']||0x0;this[_0x53f1('0x0')]=_0x4e0e33[_0x53f1('0x0')]||'';this['username']=_0x4e0e33['username']||'';this[_0x53f1('0x1')]=_0x4e0e33[_0x53f1('0x1')]||'';this[_0x53f1('0x2')]=_0x4e0e33['password']||'';this['clientId']=_0x4e0e33[_0x53f1('0x3')]||'';this[_0x53f1('0x4')]=_0x4e0e33[_0x53f1('0x4')]||'';this[_0x53f1('0x5')]=_0x4e0e33['securityToken']||'';this[_0x53f1('0x6')]=_0x4e0e33[_0x53f1('0x6')]||_0x53f1('0x7');this[_0x53f1('0x8')]=_0x4e0e33[_0x53f1('0x8')]||'';this[_0x53f1('0x9')]=_0x4e0e33['Configurations']||{};}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 e4bf380..c8141eb 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 _0xdcc1=['serverUrl','exports','name','username','password','remoteUri'];(function(_0x47b33e,_0x1a3fb2){var _0x458adc=function(_0x554366){while(--_0x554366){_0x47b33e['push'](_0x47b33e['shift']());}};_0x458adc(++_0x1a3fb2);}(_0xdcc1,0x170));var _0x1dcc=function(_0x371525,_0x42fc5f){_0x371525=_0x371525-0x0;var _0x39dbe1=_0xdcc1[_0x371525];return _0x39dbe1;};'use strict';function ServicenowAccount(_0x4bd739){this['id']=_0x4bd739['id']||0x0;this[_0x1dcc('0x0')]=_0x4bd739[_0x1dcc('0x0')]||'';this[_0x1dcc('0x1')]=_0x4bd739['username']||'';this[_0x1dcc('0x2')]=_0x4bd739[_0x1dcc('0x2')]||'';this[_0x1dcc('0x3')]=_0x4bd739[_0x1dcc('0x3')]||'';this['serverUrl']=_0x4bd739[_0x1dcc('0x4')]||'';this['Configurations']=_0x4bd739['Configurations']||{};}module[_0x1dcc('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xb620=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x246bc7,_0x207252){var _0x5afeb3=function(_0x34d4e5){while(--_0x34d4e5){_0x246bc7['push'](_0x246bc7['shift']());}};_0x5afeb3(++_0x207252);}(_0xb620,0x1c4));var _0x0b62=function(_0xfe9d7b,_0x51a835){_0xfe9d7b=_0xfe9d7b-0x0;var _0x3ded09=_0xb620[_0xfe9d7b];return _0x3ded09;};'use strict';function ServicenowAccount(_0x2db809){this['id']=_0x2db809['id']||0x0;this[_0x0b62('0x0')]=_0x2db809[_0x0b62('0x0')]||'';this[_0x0b62('0x1')]=_0x2db809[_0x0b62('0x1')]||'';this[_0x0b62('0x2')]=_0x2db809[_0x0b62('0x2')]||'';this[_0x0b62('0x3')]=_0x2db809['remoteUri']||'';this[_0x0b62('0x4')]=_0x2db809[_0x0b62('0x4')]||'';this['Configurations']=_0x2db809[_0x0b62('0x5')]||{};}module[_0x0b62('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index ca42b38..d624832 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 _0xa158=['username','password','remoteUri','serverUrl','name'];(function(_0x243e89,_0x134abe){var _0x501b54=function(_0x5de25f){while(--_0x5de25f){_0x243e89['push'](_0x243e89['shift']());}};_0x501b54(++_0x134abe);}(_0xa158,0x1ee));var _0x8a15=function(_0x45f111,_0x55bb2f){_0x45f111=_0x45f111-0x0;var _0x35f7ea=_0xa158[_0x45f111];return _0x35f7ea;};'use strict';function SugarcrmAccount(_0x326042){this['id']=_0x326042['id']||0x0;this[_0x8a15('0x0')]=_0x326042[_0x8a15('0x0')]||'';this[_0x8a15('0x1')]=_0x326042[_0x8a15('0x1')]||'';this[_0x8a15('0x2')]=_0x326042[_0x8a15('0x2')]||'';this[_0x8a15('0x3')]=_0x326042[_0x8a15('0x3')]||'';this[_0x8a15('0x4')]=_0x326042[_0x8a15('0x4')]||'';this['Configurations']=_0x326042['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x58fb=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x58fb,0xda));var _0xb58f=function(_0x7740cc,_0x390585){_0x7740cc=_0x7740cc-0x0;var _0x429b91=_0x58fb[_0x7740cc];return _0x429b91;};'use strict';function SugarcrmAccount(_0x3a99f8){this['id']=_0x3a99f8['id']||0x0;this[_0xb58f('0x0')]=_0x3a99f8[_0xb58f('0x0')]||'';this[_0xb58f('0x1')]=_0x3a99f8[_0xb58f('0x1')]||'';this[_0xb58f('0x2')]=_0x3a99f8[_0xb58f('0x2')]||'';this[_0xb58f('0x3')]=_0x3a99f8[_0xb58f('0x3')]||'';this[_0xb58f('0x4')]=_0x3a99f8['serverUrl']||'';this[_0xb58f('0x5')]=_0x3a99f8[_0xb58f('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9581512..ca663e2 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 _0xb9e7=['accountcode','state','unknown','status','exports','name'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xb9e7[_0x2f2360];return _0x1cc8d3;};'use strict';function Telephone(_0x4d23ea){this['id']=_0x4d23ea['id']||0x0;this[_0x7b9e('0x0')]=_0x4d23ea[_0x7b9e('0x0')]||'';this[_0x7b9e('0x1')]=_0x4d23ea[_0x7b9e('0x1')]||'';this[_0x7b9e('0x2')]=_0x7b9e('0x3');this['stateTime']=0x0;this[_0x7b9e('0x4')]=_0x7b9e('0x3');this['address']='';}module[_0x7b9e('0x5')]=Telephone; \ No newline at end of file +var _0x3870=['address','exports','name','accountcode','unknown','stateTime'];(function(_0x2e7306,_0x40163e){var _0x227f9e=function(_0x3ddd56){while(--_0x3ddd56){_0x2e7306['push'](_0x2e7306['shift']());}};_0x227f9e(++_0x40163e);}(_0x3870,0x146));var _0x0387=function(_0x1cf4a9,_0x3645c2){_0x1cf4a9=_0x1cf4a9-0x0;var _0x5d81de=_0x3870[_0x1cf4a9];return _0x5d81de;};'use strict';function Telephone(_0x251145){this['id']=_0x251145['id']||0x0;this[_0x0387('0x0')]=_0x251145[_0x0387('0x0')]||'';this['accountcode']=_0x251145[_0x0387('0x1')]||'';this['state']=_0x0387('0x2');this[_0x0387('0x3')]=0x0;this['status']=_0x0387('0x2');this[_0x0387('0x4')]='';}module[_0x0387('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8422e58..b3c0e23 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(_0x4dec31,_0x407261){var _0x18c82e=function(_0x3a859e){while(--_0x3a859e){_0x4dec31['push'](_0x4dec31['shift']());}};_0x18c82e(++_0x407261);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x553582,_0x3f18ad){var _0x11f472=function(_0x58e383){while(--_0x58e383){_0x553582['push'](_0x553582['shift']());}};_0x11f472(++_0x3f18ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 55b0885..216b93f 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x2a9948,_0x235a3a){var _0x708470=function(_0x4cafef){while(--_0x4cafef){_0x2a9948['push'](_0x2a9948['shift']());}};_0x708470(++_0x235a3a);}(_0x8603,0x190));var _0x3860=function(_0x6923ea,_0x4b5785){_0x6923ea=_0x6923ea-0x0;var _0x37b5d1=_0x8603[_0x6923ea];return _0x37b5d1;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x5eb8[_0x5d6b41];return _0x1c2dd6;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 1b7a9b0..dc8d752 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 _0x775e=['active','name','unknown','status','registry','indexOf','split','host','port','domain','domainport','registrationtime','address','defaultuser','exports'];(function(_0x288a23,_0x2e0343){var _0x5668cf=function(_0x59e18b){while(--_0x59e18b){_0x288a23['push'](_0x288a23['shift']());}};_0x5668cf(++_0x2e0343);}(_0x775e,0xb4));var _0xe775=function(_0x77995f,_0x117e4f){_0x77995f=_0x77995f-0x0;var _0x5eee61=_0x775e[_0x77995f];return _0x5eee61;};'use strict';function Trunk(_0x355826){this['id']=_0x355826['id']||0x0;this[_0xe775('0x0')]=_0x355826[_0xe775('0x0')]||![];this[_0xe775('0x1')]=_0x355826[_0xe775('0x1')]||'';this['state']=_0xe775('0x2');this['stateTime']=0x0;this[_0xe775('0x3')]=_0xe775('0x2');this[_0xe775('0x4')]=_0x355826['registry']&&_0x355826['registry'][_0xe775('0x5')](':')?_0x355826[_0xe775('0x4')][_0xe775('0x6')](':')[0x0]:'';this[_0xe775('0x7')]='';this[_0xe775('0x8')]='';this[_0xe775('0x9')]='';this[_0xe775('0xa')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xe775('0xb')]='';this[_0xe775('0xc')]='';this[_0xe775('0xd')]=_0x355826[_0xe775('0xd')]||'';}module[_0xe775('0xe')]=Trunk; \ No newline at end of file +var _0x3c20=['registrationtime','address','defaultuser','exports','name','state','stateTime','unknown','registry','indexOf','split','host','port','domain','stateRegistry'];(function(_0x32ddd2,_0xe0f618){var _0x48de30=function(_0x13fad6){while(--_0x13fad6){_0x32ddd2['push'](_0x32ddd2['shift']());}};_0x48de30(++_0xe0f618);}(_0x3c20,0xa9));var _0x03c2=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x3c20[_0x47e7cb];return _0x2a8874;};'use strict';function Trunk(_0x298cb7){this['id']=_0x298cb7['id']||0x0;this['active']=_0x298cb7['active']||![];this['name']=_0x298cb7[_0x03c2('0x0')]||'';this[_0x03c2('0x1')]='unknown';this[_0x03c2('0x2')]=0x0;this['status']=_0x03c2('0x3');this[_0x03c2('0x4')]=_0x298cb7['registry']&&_0x298cb7[_0x03c2('0x4')][_0x03c2('0x5')](':')?_0x298cb7[_0x03c2('0x4')][_0x03c2('0x6')](':')[0x0]:'';this[_0x03c2('0x7')]='';this[_0x03c2('0x8')]='';this[_0x03c2('0x9')]='';this['domainport']='';this['refresh']='';this[_0x03c2('0xa')]='unknown';this[_0x03c2('0xb')]='';this[_0x03c2('0xc')]='';this[_0x03c2('0xd')]=_0x298cb7['defaultuser']||'';}module[_0x03c2('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9d069d0..6c1dda0 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 _0xe5b4=['none','exten','recordingFormat'];(function(_0x5d386b,_0x352e3f){var _0xdfc622=function(_0xad5ee7){while(--_0xad5ee7){_0x5d386b['push'](_0x5d386b['shift']());}};_0xdfc622(++_0x352e3f);}(_0xe5b4,0x15a));var _0x4e5b=function(_0x3e61e1,_0x2b0943){_0x3e61e1=_0x3e61e1-0x0;var _0x31d5be=_0xe5b4[_0x3e61e1];return _0x31d5be;};'use strict';function voiceExtension(_0x15faaf){this['id']=_0x15faaf['id']||0x0;this[_0x4e5b('0x0')]=_0x15faaf[_0x4e5b('0x0')]||'';this[_0x4e5b('0x1')]=_0x15faaf[_0x4e5b('0x1')]||_0x4e5b('0x2');this['mandatoryDisposition']=_0x15faaf['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xa21f=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x2ba4ed,_0x3fd1ed){var _0x5b27fc=function(_0xa2b1c){while(--_0xa2b1c){_0x2ba4ed['push'](_0x2ba4ed['shift']());}};_0x5b27fc(++_0x3fd1ed);}(_0xa21f,0x6c));var _0xfa21=function(_0x28c1a2,_0x44f94e){_0x28c1a2=_0x28c1a2-0x0;var _0x5cc707=_0xa21f[_0x28c1a2];return _0x5cc707;};'use strict';function voiceExtension(_0x2d5b2c){this['id']=_0x2d5b2c['id']||0x0;this['exten']=_0x2d5b2c[_0xfa21('0x0')]||'';this[_0xfa21('0x1')]=_0x2d5b2c[_0xfa21('0x1')]||_0xfa21('0x2');this[_0xfa21('0x3')]=_0x2d5b2c[_0xfa21('0x3')]||![];}module[_0xfa21('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 7b34bff..c52bee4 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 _0x75e0=['outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay'];(function(_0x373d20,_0x77310c){var _0x1ed535=function(_0x20254c){while(--_0x20254c){_0x373d20['push'](_0x373d20['shift']());}};_0x1ed535(++_0x77310c);}(_0x75e0,0x194));var _0x075e=function(_0x583757,_0x8cf1b5){_0x583757=_0x583757-0x0;var _0x51d49c=_0x75e0[_0x583757];return _0x51d49c;};'use strict';var statusDesc=[_0x075e('0x0'),_0x075e('0x1'),_0x075e('0x2'),_0x075e('0x3'),_0x075e('0x4'),_0x075e('0x5'),_0x075e('0x6'),'ringinuse',_0x075e('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x075e('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x075e('0x9')};function VoiceQueue(_0x37c132){this['id']=_0x37c132['id']||0x0;this[_0x075e('0xa')]=_0x37c132['name']||'';this['monitor_format']=_0x37c132[_0x075e('0xb')]||'';this['type']=_0x37c132[_0x075e('0xc')]||_0x075e('0xd');this['waiting']=0x0;this[_0x075e('0xe')]=0x0;this[_0x075e('0xf')]=0x0;this['answered']=0x0;this[_0x075e('0x10')]=0x0;this[_0x075e('0x11')]=0x0;this[_0x075e('0x12')]=0x0;this[_0x075e('0x13')]=0x0;this[_0x075e('0x14')]=0x0;this['loggedIn']=0x0;this[_0x075e('0x15')]=0x0;this[_0x075e('0x16')]=_0x37c132[_0x075e('0x16')]||![];this['acwTimeout']=_0x37c132[_0x075e('0x17')]||0xa;this[_0x075e('0x18')]=_0x37c132[_0x075e('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x075e('0x19')]='';this[_0x075e('0x1a')]=0x0;this[_0x075e('0x1b')]=0x0;this[_0x075e('0x1c')]=_0x37c132[_0x075e('0x1c')]||null;this[_0x075e('0x1d')]=_0x37c132[_0x075e('0x1d')]?_0x37c132[_0x075e('0x1d')]:null;this[_0x075e('0x1e')]=_0x37c132[_0x075e('0x1e')];this['dialMethod']=_0x37c132['dialMethod']||_0x075e('0x1f');this[_0x075e('0x20')]=_0x37c132[_0x075e('0x20')]||0x0;this[_0x075e('0x21')]=_0x37c132['dialLimitQueue']||0x0;this[_0x075e('0x22')]=_0x37c132['dialPowerLevel']||0x1;this[_0x075e('0x23')]=_0x37c132[_0x075e('0x23')]||_0x075e('0x24');this[_0x075e('0x25')]=_0x37c132[_0x075e('0x25')]||0.03;this[_0x075e('0x26')]=_0x37c132[_0x075e('0x26')]||0x258;this[_0x075e('0x27')]=_0x37c132[_0x075e('0x27')]||_0x075e('0x28');this[_0x075e('0x29')]=_0x37c132['dialOriginateCallerIdNumber']||_0x075e('0x28');this['dialOriginateTimeout']=_0x37c132['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x37c132['dialQueueOptions']||_0x075e('0x2a');this[_0x075e('0x2b')]=_0x37c132['dialQueueTimeout']||0x3;this[_0x075e('0x2c')]=_0x37c132[_0x075e('0x2c')]||undefined;this[_0x075e('0x2d')]=_0x37c132['dialCongestionMaxRetry']||0x3;this[_0x075e('0x2e')]=_0x37c132[_0x075e('0x2e')]||0x96;this[_0x075e('0x2f')]=_0x37c132['dialBusyMaxRetry']||0x3;this[_0x075e('0x30')]=_0x37c132[_0x075e('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x37c132['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x37c132[_0x075e('0x31')]||0x96;this[_0x075e('0x32')]=_0x37c132['dialNoSuchNumberMaxRetry']||0x3;this[_0x075e('0x33')]=_0x37c132[_0x075e('0x33')]||0x96;this[_0x075e('0x34')]=_0x37c132[_0x075e('0x34')]||0x3;this[_0x075e('0x35')]=_0x37c132[_0x075e('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0x37c132[_0x075e('0x36')]||0x3;this[_0x075e('0x37')]=_0x37c132[_0x075e('0x37')]||0x96;this[_0x075e('0x38')]=_0x37c132['dialMachineMaxRetry']||0x3;this[_0x075e('0x39')]=_0x37c132[_0x075e('0x39')]||0x96;this[_0x075e('0x3a')]=_0x37c132[_0x075e('0x3a')]||0x3;this[_0x075e('0x3b')]=_0x37c132[_0x075e('0x3b')]||0x96;this['callAdditionalPhoneAfterMin']=_0x37c132[_0x075e('0x3c')]||0x3;this[_0x075e('0x3d')]=_0x37c132[_0x075e('0x3d')]||0x4;this[_0x075e('0x3e')]=_0x37c132[_0x075e('0x3e')]?_0x37c132[_0x075e('0x3e')]:undefined;this['TrunkBackup']=_0x37c132['TrunkBackup']?_0x37c132[_0x075e('0x3f')]:undefined;this[_0x075e('0x40')]=_0x37c132['dialPrefix']||undefined;this[_0x075e('0x41')]=_0x37c132[_0x075e('0x41')]?_0x37c132[_0x075e('0x41')]:undefined;this[_0x075e('0x42')]=_0x37c132[_0x075e('0x42')]||_0x075e('0x43');this[_0x075e('0x44')]=_0x37c132[_0x075e('0x44')]||undefined;this['dialCutDigit']=_0x37c132[_0x075e('0x45')]||undefined;this[_0x075e('0x46')]=strategy[_0x37c132[_0x075e('0x46')]]||_0x075e('0x47');this[_0x075e('0x48')]=!![];this[_0x075e('0x49')]=_0x37c132[_0x075e('0x49')]||![];this[_0x075e('0x4a')]=_0x37c132[_0x075e('0x4a')];this[_0x075e('0x4b')]=_0x37c132[_0x075e('0x4b')];this[_0x075e('0x4c')]=_0x37c132[_0x075e('0x4c')];this[_0x075e('0x4d')]=_0x37c132['dialAMDTotalAnalysisTime'];this[_0x075e('0x4e')]=_0x37c132[_0x075e('0x4e')];this[_0x075e('0x4f')]=_0x37c132[_0x075e('0x4f')];this[_0x075e('0x50')]=_0x37c132['dialAMDMaximumNumberOfWords'];this[_0x075e('0x51')]=_0x37c132['dialAMDSilenceThreshold'];this[_0x075e('0x52')]=_0x37c132[_0x075e('0x52')];this[_0x075e('0x53')]=0x0;this[_0x075e('0x54')]=0x0;this[_0x075e('0x55')]=_0x37c132[_0x075e('0x55')];this[_0x075e('0x56')]=0x0;this[_0x075e('0x57')]=0x0;this[_0x075e('0x58')]=0x0;this[_0x075e('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x075e('0x5a')]=0x0;this[_0x075e('0x5b')]=0x0;this[_0x075e('0x5c')]=0x0;this[_0x075e('0x5d')]=0x0;this[_0x075e('0x5e')]=0x0;this[_0x075e('0x5f')]=0x0;this[_0x075e('0x60')]=0x0;this[_0x075e('0x61')]=0x0;this[_0x075e('0x62')]=0x0;this[_0x075e('0x63')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x075e('0x64')]=1.05;this[_0x075e('0x65')]=0x0;this[_0x075e('0x66')]=0x0;this[_0x075e('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x075e('0x68')]=0x0;this[_0x075e('0x69')]=0x0;this[_0x075e('0x6a')]=0x0;this[_0x075e('0x6b')]=_0x37c132['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x37c132[_0x075e('0x6c')]||0xa;this[_0x075e('0x6d')]=0x0;this[_0x075e('0x6e')]=0x0;this[_0x075e('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x075e('0x70')]=0x0;this[_0x075e('0x71')]=0x0;this[_0x075e('0x72')]=0x0;this[_0x075e('0x73')]=_0x37c132['dialRecallMeTimeout']||0x1e;this[_0x075e('0x74')]=_0x37c132[_0x075e('0x74')]||![];this[_0x075e('0x75')]=!!_0x37c132[_0x075e('0x75')]||![];this['dialPreviewRecallmeReminder']=!!_0x37c132['dialPreviewRecallmeReminder']||![];this[_0x075e('0x76')]=_0x37c132[_0x075e('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x37c132[_0x075e('0x77')]||![];this[_0x075e('0x78')]=_0x37c132[_0x075e('0x78')]||![];this[_0x075e('0xb')]=monitorFormat[_0x37c132[_0x075e('0xb')]]?monitorFormat[_0x37c132[_0x075e('0xb')]]:undefined;this[_0x075e('0x79')]=_0x37c132[_0x075e('0x79')]||![];this[_0x075e('0x7a')]=_0x37c132[_0x075e('0x7a')]?_0x37c132[_0x075e('0x7a')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xdae8=['busy','unavailable','ringing','ringinuse','onhold','wav','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','acw','autopause','sendMessageOneNotActive','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse'];(function(_0x30a1af,_0x3d5c28){var _0x16c800=function(_0x8604a8){while(--_0x8604a8){_0x30a1af['push'](_0x30a1af['shift']());}};_0x16c800(++_0x3d5c28);}(_0xdae8,0xe9));var _0x8dae=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xdae8[_0x359377];return _0x8be18a;};'use strict';var statusDesc=[_0x8dae('0x0'),_0x8dae('0x1'),_0x8dae('0x2'),_0x8dae('0x3'),'invalid',_0x8dae('0x4'),_0x8dae('0x5'),_0x8dae('0x6'),_0x8dae('0x7')];var monitorFormat={'wav':_0x8dae('0x8'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x8dae('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1b5f1d){this['id']=_0x1b5f1d['id']||0x0;this[_0x8dae('0xa')]=_0x1b5f1d[_0x8dae('0xa')]||'';this['monitor_format']=_0x1b5f1d[_0x8dae('0xb')]||'';this[_0x8dae('0xc')]=_0x1b5f1d['type']||_0x8dae('0xd');this[_0x8dae('0xe')]=0x0;this[_0x8dae('0xf')]=0x0;this[_0x8dae('0x10')]=0x0;this[_0x8dae('0x11')]=0x0;this[_0x8dae('0x12')]=0x0;this[_0x8dae('0x13')]=0x0;this[_0x8dae('0x14')]=0x0;this[_0x8dae('0x15')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0x8dae('0x16')]=0x0;this[_0x8dae('0x17')]=_0x1b5f1d[_0x8dae('0x17')]||![];this['acwTimeout']=_0x1b5f1d['acwTimeout']||0xa;this[_0x8dae('0x18')]=_0x1b5f1d['autopause']||'no';this[_0x8dae('0x19')]=!![];this['message']='';this[_0x8dae('0x1a')]=0x0;this[_0x8dae('0x1b')]=0x0;this['dialTimezone']=_0x1b5f1d['dialTimezone']||null;this['dialGlobalInterval']=_0x1b5f1d[_0x8dae('0x1c')]?_0x1b5f1d[_0x8dae('0x1c')]:null;this[_0x8dae('0x1d')]=_0x1b5f1d[_0x8dae('0x1d')];this[_0x8dae('0x1e')]=_0x1b5f1d[_0x8dae('0x1e')]||_0x8dae('0x1f');this[_0x8dae('0x20')]=_0x1b5f1d[_0x8dae('0x20')]||0x0;this[_0x8dae('0x21')]=_0x1b5f1d[_0x8dae('0x21')]||0x0;this[_0x8dae('0x22')]=_0x1b5f1d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x1b5f1d[_0x8dae('0x23')]||_0x8dae('0x24');this['dialPredictiveOptimizationPercentage']=_0x1b5f1d[_0x8dae('0x25')]||0.03;this[_0x8dae('0x26')]=_0x1b5f1d[_0x8dae('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x1b5f1d[_0x8dae('0x27')]||'anonymous';this[_0x8dae('0x28')]=_0x1b5f1d[_0x8dae('0x28')]||_0x8dae('0x29');this[_0x8dae('0x2a')]=_0x1b5f1d[_0x8dae('0x2a')]||0x1e;this[_0x8dae('0x2b')]=_0x1b5f1d[_0x8dae('0x2b')]||_0x8dae('0x2c');this[_0x8dae('0x2d')]=_0x1b5f1d[_0x8dae('0x2d')]||0x3;this['dialQueueProject']=_0x1b5f1d[_0x8dae('0x2e')]||undefined;this[_0x8dae('0x2f')]=_0x1b5f1d['dialCongestionMaxRetry']||0x3;this[_0x8dae('0x30')]=_0x1b5f1d[_0x8dae('0x30')]||0x96;this[_0x8dae('0x31')]=_0x1b5f1d['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x1b5f1d[_0x8dae('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x1b5f1d[_0x8dae('0x33')]||0x3;this[_0x8dae('0x34')]=_0x1b5f1d[_0x8dae('0x34')]||0x96;this[_0x8dae('0x35')]=_0x1b5f1d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1b5f1d['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8dae('0x36')]=_0x1b5f1d[_0x8dae('0x36')]||0x3;this[_0x8dae('0x37')]=_0x1b5f1d[_0x8dae('0x37')]||0x96;this[_0x8dae('0x38')]=_0x1b5f1d[_0x8dae('0x38')]||0x3;this[_0x8dae('0x39')]=_0x1b5f1d[_0x8dae('0x39')]||0x96;this['dialMachineMaxRetry']=_0x1b5f1d[_0x8dae('0x3a')]||0x3;this[_0x8dae('0x3b')]=_0x1b5f1d[_0x8dae('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x1b5f1d[_0x8dae('0x3c')]||0x3;this[_0x8dae('0x3d')]=_0x1b5f1d[_0x8dae('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1b5f1d[_0x8dae('0x3e')]||0x3;this[_0x8dae('0x3f')]=_0x1b5f1d[_0x8dae('0x3f')]||0x4;this['Trunk']=_0x1b5f1d['Trunk']?_0x1b5f1d[_0x8dae('0x40')]:undefined;this['TrunkBackup']=_0x1b5f1d[_0x8dae('0x41')]?_0x1b5f1d[_0x8dae('0x41')]:undefined;this[_0x8dae('0x42')]=_0x1b5f1d[_0x8dae('0x42')]||undefined;this['Interval']=_0x1b5f1d[_0x8dae('0x43')]?_0x1b5f1d[_0x8dae('0x43')]:undefined;this[_0x8dae('0x44')]=_0x1b5f1d['dialOrderByScheduledAt']||_0x8dae('0x45');this[_0x8dae('0x46')]=_0x1b5f1d[_0x8dae('0x46')]||undefined;this[_0x8dae('0x47')]=_0x1b5f1d[_0x8dae('0x47')]||undefined;this['strategy']=strategy[_0x1b5f1d['strategy']]||_0x8dae('0x9');this[_0x8dae('0x48')]=!![];this[_0x8dae('0x49')]=_0x1b5f1d[_0x8dae('0x49')]||![];this[_0x8dae('0x4a')]=_0x1b5f1d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1b5f1d['dialAMDGreeting'];this[_0x8dae('0x4b')]=_0x1b5f1d[_0x8dae('0x4b')];this[_0x8dae('0x4c')]=_0x1b5f1d[_0x8dae('0x4c')];this['dialAMDMinWordLength']=_0x1b5f1d[_0x8dae('0x4d')];this['dialAMDBetweenWordsSilence']=_0x1b5f1d[_0x8dae('0x4e')];this[_0x8dae('0x4f')]=_0x1b5f1d[_0x8dae('0x4f')];this[_0x8dae('0x50')]=_0x1b5f1d[_0x8dae('0x50')];this[_0x8dae('0x51')]=_0x1b5f1d['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x8dae('0x52')]=0x0;this[_0x8dae('0x53')]=_0x1b5f1d[_0x8dae('0x53')];this[_0x8dae('0x54')]=0x0;this[_0x8dae('0x55')]=0x0;this[_0x8dae('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x8dae('0x57')]=0x0;this[_0x8dae('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x8dae('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x8dae('0x5a')]=0x0;this[_0x8dae('0x5b')]=0x0;this[_0x8dae('0x5c')]=0x0;this[_0x8dae('0x5d')]=0x0;this[_0x8dae('0x5e')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x8dae('0x5f')]=undefined;this[_0x8dae('0x60')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8dae('0x61')]=0x0;this[_0x8dae('0x62')]=0x0;this[_0x8dae('0x63')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x8dae('0x64')]=_0x1b5f1d[_0x8dae('0x65')]||0x14;this[_0x8dae('0x66')]=_0x1b5f1d[_0x8dae('0x65')]||0xa;this[_0x8dae('0x67')]=0x0;this[_0x8dae('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8dae('0x69')]=0x0;this[_0x8dae('0x6a')]=0x0;this[_0x8dae('0x6b')]=0x0;this[_0x8dae('0x6c')]=0x0;this[_0x8dae('0x6d')]=_0x1b5f1d['dialRecallMeTimeout']||0x1e;this[_0x8dae('0x6e')]=_0x1b5f1d[_0x8dae('0x6e')]||![];this[_0x8dae('0x6f')]=!!_0x1b5f1d[_0x8dae('0x6f')]||![];this[_0x8dae('0x70')]=!!_0x1b5f1d['dialPreviewRecallmeReminder']||![];this[_0x8dae('0x71')]=_0x1b5f1d[_0x8dae('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x1b5f1d['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x1b5f1d[_0x8dae('0x72')]||![];this[_0x8dae('0xb')]=monitorFormat[_0x1b5f1d[_0x8dae('0xb')]]?monitorFormat[_0x1b5f1d[_0x8dae('0xb')]]:undefined;this[_0x8dae('0x73')]=_0x1b5f1d[_0x8dae('0x73')]||![];this[_0x8dae('0x74')]=_0x1b5f1d[_0x8dae('0x74')]?_0x1b5f1d[_0x8dae('0x74')]:undefined;}module[_0x8dae('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6a422d0..36db836 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 _0x6a0b=['username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x3514c7,_0x11ffa6){_0x3514c7=_0x3514c7-0x0;var _0x38d45f=_0x6a0b[_0x3514c7];return _0x38d45f;};'use strict';function VtigerAccount(_0x2ea587){this['id']=_0x2ea587['id']||0x0;this['name']=_0x2ea587['name']||'';this[_0xb6a0('0x0')]=_0x2ea587[_0xb6a0('0x0')]||'';this['accessKey']=_0x2ea587[_0xb6a0('0x1')]||'';this[_0xb6a0('0x2')]=_0x2ea587[_0xb6a0('0x2')]||'';this[_0xb6a0('0x3')]=_0x2ea587[_0xb6a0('0x3')]||'';this['Configurations']=_0x2ea587[_0xb6a0('0x4')]||{};}module[_0xb6a0('0x5')]=VtigerAccount; \ No newline at end of file +var _0x986d=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x190161,_0x58587d){var _0x115438=function(_0x17a7ee){while(--_0x17a7ee){_0x190161['push'](_0x190161['shift']());}};_0x115438(++_0x58587d);}(_0x986d,0xa9));var _0xd986=function(_0x1bc1ee,_0xb8488f){_0x1bc1ee=_0x1bc1ee-0x0;var _0x49617a=_0x986d[_0x1bc1ee];return _0x49617a;};'use strict';function VtigerAccount(_0x1d5726){this['id']=_0x1d5726['id']||0x0;this['name']=_0x1d5726[_0xd986('0x0')]||'';this[_0xd986('0x1')]=_0x1d5726['username']||'';this[_0xd986('0x2')]=_0x1d5726[_0xd986('0x2')]||'';this[_0xd986('0x3')]=_0x1d5726[_0xd986('0x3')]||'';this[_0xd986('0x4')]=_0x1d5726[_0xd986('0x4')]||'';this[_0xd986('0x5')]=_0x1d5726['Configurations']||{};}module[_0xd986('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 ac6e6ae..f07c9bc 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 _0x6693=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6693,0xe6));var _0x3669=function(_0x3905fd,_0x43bab9){_0x3905fd=_0x3905fd-0x0;var _0x2f11ea=_0x6693[_0x3905fd];return _0x2f11ea;};'use strict';function ZendeskAccount(_0x2c9b7c){this['id']=_0x2c9b7c['id']||0x0;this['name']=_0x2c9b7c[_0x3669('0x0')]||'';this[_0x3669('0x1')]=_0x2c9b7c[_0x3669('0x1')]||'';this[_0x3669('0x2')]=_0x2c9b7c['password']||'';this[_0x3669('0x3')]=_0x2c9b7c[_0x3669('0x3')]||'';this[_0x3669('0x4')]=_0x2c9b7c[_0x3669('0x4')]||'';this[_0x3669('0x5')]=_0x2c9b7c[_0x3669('0x5')]||'';this[_0x3669('0x6')]=_0x2c9b7c['type']||_0x3669('0x7');this[_0x3669('0x8')]=_0x2c9b7c[_0x3669('0x8')]||'';this[_0x3669('0x9')]=_0x2c9b7c[_0x3669('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xd43d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x6fda4c,_0x10ab5f){var _0x284923=function(_0x178cdd){while(--_0x178cdd){_0x6fda4c['push'](_0x6fda4c['shift']());}};_0x284923(++_0x10ab5f);}(_0xd43d,0x1d1));var _0xdd43=function(_0x7c7c7d,_0x358ce2){_0x7c7c7d=_0x7c7c7d-0x0;var _0x10bbff=_0xd43d[_0x7c7c7d];return _0x10bbff;};'use strict';function ZendeskAccount(_0x3eca12){this['id']=_0x3eca12['id']||0x0;this['name']=_0x3eca12[_0xdd43('0x0')]||'';this['username']=_0x3eca12[_0xdd43('0x1')]||'';this[_0xdd43('0x2')]=_0x3eca12[_0xdd43('0x2')]||'';this[_0xdd43('0x3')]=_0x3eca12[_0xdd43('0x3')]||'';this[_0xdd43('0x4')]=_0x3eca12[_0xdd43('0x4')]||'';this[_0xdd43('0x5')]=_0x3eca12[_0xdd43('0x5')]||'';this[_0xdd43('0x6')]=_0x3eca12['type']||_0xdd43('0x7');this[_0xdd43('0x8')]=_0x3eca12['serverUrl']||'';this[_0xdd43('0x9')]=_0x3eca12[_0xdd43('0x9')]||{};}module[_0xdd43('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 08d6453..13c0285 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 _0x89e7=['Configurations','exports','name','description','host','zone','clientId','serverUrl','code','refreshToken'];(function(_0xd8dbac,_0x4f70ba){var _0x3ebf92=function(_0x29b73b){while(--_0x29b73b){_0xd8dbac['push'](_0xd8dbac['shift']());}};_0x3ebf92(++_0x4f70ba);}(_0x89e7,0x11a));var _0x789e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x89e7[_0x8c43de];return _0xa6591b;};'use strict';function ZohoAccount(_0x33fdd4){this['id']=_0x33fdd4['id']||0x0;this[_0x789e('0x0')]=_0x33fdd4[_0x789e('0x0')]||'';this['description']=_0x33fdd4[_0x789e('0x1')]||'';this[_0x789e('0x2')]=_0x33fdd4['host']||'';this[_0x789e('0x3')]=_0x33fdd4[_0x789e('0x3')]||'';this[_0x789e('0x4')]=_0x33fdd4[_0x789e('0x4')]||'';this['clientSecret']=_0x33fdd4['clientSecret']||'';this[_0x789e('0x5')]=_0x33fdd4[_0x789e('0x5')]||'';this[_0x789e('0x6')]=_0x33fdd4[_0x789e('0x6')]||'';this[_0x789e('0x7')]=_0x33fdd4['refreshToken']||'';this[_0x789e('0x8')]=_0x33fdd4['Configurations']||{};}module[_0x789e('0x9')]=ZohoAccount; \ No newline at end of file +var _0x8a38=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a38,0x1ed));var _0x88a3=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x8a38[_0x4573bd];return _0xc07bb9;};'use strict';function ZohoAccount(_0x27bbf7){this['id']=_0x27bbf7['id']||0x0;this[_0x88a3('0x0')]=_0x27bbf7[_0x88a3('0x0')]||'';this[_0x88a3('0x1')]=_0x27bbf7['description']||'';this[_0x88a3('0x2')]=_0x27bbf7[_0x88a3('0x2')]||'';this[_0x88a3('0x3')]=_0x27bbf7[_0x88a3('0x3')]||'';this[_0x88a3('0x4')]=_0x27bbf7[_0x88a3('0x4')]||'';this[_0x88a3('0x5')]=_0x27bbf7[_0x88a3('0x5')]||'';this['serverUrl']=_0x27bbf7[_0x88a3('0x6')]||'';this[_0x88a3('0x7')]=_0x27bbf7['code']||'';this['refreshToken']=_0x27bbf7[_0x88a3('0x8')]||'';this['Configurations']=_0x27bbf7[_0x88a3('0x9')]||{};}module[_0x88a3('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 4d66d57..d5f42c6 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 _0x0b0e=['prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x483937,_0x6387f6){var _0x3de11b=function(_0x2af4aa){while(--_0x2af4aa){_0x483937['push'](_0x483937['shift']());}};_0x3de11b(++_0x6387f6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d6785,_0x492ea3){_0x3d6785=_0x3d6785-0x0;var _0x39a624=_0x0b0e[_0x3d6785];return _0x39a624;};'use strict';var util=require(_0xe0b0('0x0'));var _=require('lodash');var moment=require(_0xe0b0('0x1'));function checkNameSurname(_0x536e9b,_0x7e5a8a,_0xdf715e){var _0x3b5e2b='';if(!_[_0xe0b0('0x2')](_0x7e5a8a)&&_0xe0b0('0x3')===typeof _0x7e5a8a){_0x3b5e2b+=_0x7e5a8a;}if(!_[_0xe0b0('0x2')](_0xdf715e)&&_0xe0b0('0x3')===typeof _0xdf715e){_0x3b5e2b+='\x20'+_0xdf715e;}if(_0x3b5e2b!==''){return _0x3b5e2b;}return _0x536e9b;}function Action(_0x185efa,_0x30e20d,_0x28e40f,_0x219b1c,_0x5cf9cc){this['uniqueid']=_0x28e40f||undefined;this[_0xe0b0('0x4')]=_0x185efa['id'];this[_0xe0b0('0x5')]=_0x30e20d[_0xe0b0('0x6')];this[_0xe0b0('0x7')]=_0x30e20d['type'];this[_0xe0b0('0x8')]=_0xe0b0('0x5');this['dialAnswer']=![];this[_0xe0b0('0x9')]=_[_0xe0b0('0x2')](_0x185efa['Agent'])?undefined:_0x185efa[_0xe0b0('0xa')][_0xe0b0('0x6')];this[_0xe0b0('0xb')]=this['membername']?util[_0xe0b0('0xc')](_0xe0b0('0xd'),this[_0xe0b0('0x9')]):_0x219b1c||undefined;this[_0xe0b0('0xe')]=checkNameSurname(_0x185efa[_0xe0b0('0xf')]['phone'],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x10')],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x11')]);this[_0xe0b0('0x12')]=_0x185efa['active']||![];this[_0xe0b0('0x13')]=_0x185efa['phone'];this[_0xe0b0('0x14')]=_0x185efa[_0xe0b0('0x14')];this['countbusyretry']=_0x185efa[_0xe0b0('0x15')]||0x0;this['countcongestionretry']=_0x185efa[_0xe0b0('0x16')]||0x0;this[_0xe0b0('0x17')]=_0x185efa['countnoanswerretry']||0x0;this['countglobal']=(_0x185efa[_0xe0b0('0x15')]||0x0)+(_0x185efa['countcongestionretry']||0x0)+(_0x185efa['countnoanswerretry']||0x0)+(_0x185efa['countnosuchnumberretry']||0x0)+(_0x185efa[_0xe0b0('0x18')]||0x0)+(_0x185efa['countabandonedretry']||0x0)+(_0x185efa['countmachineretry']||0x0)+(_0x185efa[_0xe0b0('0x19')]||0x0);this['countnosuchnumberretry']=_0x185efa[_0xe0b0('0x1a')]||0x0;this['countdropretry']=_0x185efa[_0xe0b0('0x18')]||0x0;this[_0xe0b0('0x1b')]=_0x185efa[_0xe0b0('0x1b')]||0x0;this[_0xe0b0('0x1c')]=_0x185efa[_0xe0b0('0x1c')]||0x0;this['countagentrejectretry']=_0x185efa['countagentrejectretry']||0x0;this[_0xe0b0('0x1d')]=_0x185efa['callback'];this[_0xe0b0('0x1e')]=_0x185efa[_0xe0b0('0x1e')];this['callbackat']=_0x185efa[_0xe0b0('0x1f')];this['recallme']=_0x185efa[_0xe0b0('0x20')];this['ContactId']=_0x185efa[_0xe0b0('0x21')];this['ListId']=_0x185efa[_0xe0b0('0x22')];this['UserId']=_[_0xe0b0('0x2')](_0x185efa['Agent'])?_0x185efa[_0xe0b0('0x23')]:_0x185efa['Agent']['id'];this[_0xe0b0('0x24')]=_0x185efa[_0xe0b0('0x24')];this[_0xe0b0('0x25')]='';this[_0xe0b0('0x26')]='';}Action[_0xe0b0('0x27')][_0xe0b0('0x28')]=function(){return util['format'](_0xe0b0('0x29'),this[_0xe0b0('0xe')],this['number']);};module[_0xe0b0('0x2a')]=Action; \ No newline at end of file +var _0x3266=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x3266,0x6a));var _0x6326=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x3266[_0x44a64f];return _0x52024b;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));function checkNameSurname(_0x2bed83,_0x545df7,_0x6b67c0){var _0x29aef3='';if(!_[_0x6326('0x3')](_0x545df7)&&_0x6326('0x4')===typeof _0x545df7){_0x29aef3+=_0x545df7;}if(!_['isNil'](_0x6b67c0)&&_0x6326('0x4')===typeof _0x6b67c0){_0x29aef3+='\x20'+_0x6b67c0;}if(_0x29aef3!==''){return _0x29aef3;}return _0x2bed83;}function Action(_0x5f38a3,_0x25ecd8,_0x44460c,_0x14208e,_0x5402e5){this[_0x6326('0x5')]=_0x44460c||undefined;this['idContact']=_0x5f38a3['id'];this[_0x6326('0x6')]=_0x25ecd8[_0x6326('0x7')];this[_0x6326('0x8')]=_0x25ecd8[_0x6326('0x8')];this[_0x6326('0x9')]='queue';this[_0x6326('0xa')]=![];this[_0x6326('0xb')]=_[_0x6326('0x3')](_0x5f38a3[_0x6326('0xc')])?undefined:_0x5f38a3[_0x6326('0xc')][_0x6326('0x7')];this[_0x6326('0xd')]=this[_0x6326('0xb')]?util[_0x6326('0xe')](_0x6326('0xf'),this['membername']):_0x14208e||undefined;this['calleridname']=checkNameSurname(_0x5f38a3[_0x6326('0x10')][_0x6326('0x11')],_0x5f38a3['Contact'][_0x6326('0x12')],_0x5f38a3['Contact'][_0x6326('0x13')]);this[_0x6326('0x14')]=_0x5f38a3[_0x6326('0x14')]||![];this[_0x6326('0x15')]=_0x5f38a3[_0x6326('0x11')];this[_0x6326('0x16')]=_0x5f38a3['scheduledat'];this[_0x6326('0x17')]=_0x5f38a3['countbusyretry']||0x0;this['countcongestionretry']=_0x5f38a3['countcongestionretry']||0x0;this['countnoanswerretry']=_0x5f38a3['countnoanswerretry']||0x0;this['countglobal']=(_0x5f38a3[_0x6326('0x17')]||0x0)+(_0x5f38a3[_0x6326('0x18')]||0x0)+(_0x5f38a3[_0x6326('0x19')]||0x0)+(_0x5f38a3['countnosuchnumberretry']||0x0)+(_0x5f38a3['countdropretry']||0x0)+(_0x5f38a3[_0x6326('0x1a')]||0x0)+(_0x5f38a3[_0x6326('0x1b')]||0x0)+(_0x5f38a3[_0x6326('0x1c')]||0x0);this[_0x6326('0x1d')]=_0x5f38a3[_0x6326('0x1d')]||0x0;this[_0x6326('0x1e')]=_0x5f38a3[_0x6326('0x1e')]||0x0;this['countabandonedretry']=_0x5f38a3[_0x6326('0x1a')]||0x0;this['countmachineretry']=_0x5f38a3[_0x6326('0x1b')]||0x0;this[_0x6326('0x1c')]=_0x5f38a3[_0x6326('0x1c')]||0x0;this[_0x6326('0x1f')]=_0x5f38a3[_0x6326('0x1f')];this[_0x6326('0x20')]=_0x5f38a3[_0x6326('0x20')];this[_0x6326('0x21')]=_0x5f38a3[_0x6326('0x21')];this[_0x6326('0x22')]=_0x5f38a3[_0x6326('0x22')];this['ContactId']=_0x5f38a3[_0x6326('0x23')];this[_0x6326('0x24')]=_0x5f38a3['ListId'];this['UserId']=_['isNil'](_0x5f38a3[_0x6326('0xc')])?_0x5f38a3['UserId']:_0x5f38a3[_0x6326('0xc')]['id'];this[_0x6326('0x25')]=_0x5f38a3['VoiceQueueId'];this[_0x6326('0x26')]='';this[_0x6326('0x27')]='';}Action[_0x6326('0x28')][_0x6326('0x29')]=function(){return util[_0x6326('0xe')](_0x6326('0x2a'),this[_0x6326('0x2b')],this[_0x6326('0x2c')]);};module[_0x6326('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1df1357..22730c5 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 _0xe0ae=['responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','createAgentHistory','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','addVariables','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncHangupRequest','variables','syncVarSet','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','bluebird','uuid','md5','../../../config/environment','../../../config/logger','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','socket.io-emitter','redis','prototype','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','preview','booked','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','agents','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xe0ae[_0x1f0724];return _0x253ffb;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xee0a('0x0'));var uuid=require(_0xee0a('0x1'));var moment=require('moment');var md5=require(_0xee0a('0x2'));var Redis=require('ioredis');var config=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('preview');var loggerAction=require(_0xee0a('0x4'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xee0a('0x5'));var cmHopperAdditionalPhone=require(_0xee0a('0x6'));var Action=require(_0xee0a('0x7'));var ut=require(_0xee0a('0x8'));config['redis']=_[_0xee0a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xee0a('0xa'))(new Redis(config[_0xee0a('0xb')]));var Sequence=function(){};Sequence[_0xee0a('0xc')]['enqueue']=function(_0x3bc0cf){this[_0xee0a('0xd')]=this['tail']?this[_0xee0a('0xd')]['finally'](_0x3bc0cf):_0x3bc0cf();};function Preview(_0xdae0c1){this[_0xee0a('0xe')]=new Sequence();this['campaignsPreview']=_0xdae0c1[_0xee0a('0xf')];this['trunks']=_0xdae0c1[_0xee0a('0x10')];this[_0xee0a('0x11')]={};this['agents']=_0xdae0c1['agents'];this[_0xee0a('0x12')]=0x0;ami['on'](_0xee0a('0x13'),this[_0xee0a('0x14')][_0xee0a('0x15')](this));ami['on'](_0xee0a('0x16'),this['syncHangup'][_0xee0a('0x15')](this));ami['on'](_0xee0a('0x17'),this['syncHangupRequest'][_0xee0a('0x15')](this));ami['on'](_0xee0a('0x18'),this[_0xee0a('0x19')][_0xee0a('0x15')](this));ami['on']('newexten',this[_0xee0a('0x1a')][_0xee0a('0x15')](this));ami['on'](_0xee0a('0x1b'),this['syncVarSet'][_0xee0a('0x15')](this));ami['on'](_0xee0a('0x1c'),this[_0xee0a('0x1d')][_0xee0a('0x15')](this));ami['on']('blindtransfer',this[_0xee0a('0x1e')][_0xee0a('0x15')](this));this[_0xee0a('0x1f')](this[_0xee0a('0x20')]);}function emit(_0x5c981e,_0x2abfbd,_0xff2f14){io['to'](_0x5c981e)[_0xee0a('0x21')](_0x2abfbd,_0xff2f14);}function emitCampaignPreview(_0x21197f){if(_0x21197f[_0xee0a('0x22')]===_0xee0a('0x23')){var _0x2c543c={'id':_0x21197f['id'],'name':_0x21197f['name'],'strategy':_0x21197f[_0xee0a('0x24')],'answered':_0x21197f[_0xee0a('0x25')],'available':_0x21197f[_0xee0a('0x26')],'loggedIn':_0x21197f[_0xee0a('0x27')],'pTalking':_0x21197f['pTalking'],'sumBillable':_0x21197f[_0xee0a('0x28')],'sumDuration':_0x21197f[_0xee0a('0x29')],'sumHoldTime':_0x21197f[_0xee0a('0x2a')]||0x0,'talking':_0x21197f[_0xee0a('0x2b')],'total':_0x21197f['total'],'type':_0x21197f['type'],'unmanaged':_0x21197f['unmanaged'],'abandoned':_0x21197f[_0xee0a('0x2c')],'waiting':_0x21197f['waiting'],'loggedInDb':_0x21197f['loggedInDb'],'dialActive':_0x21197f[_0xee0a('0x2d')],'dialMethod':_0x21197f[_0xee0a('0x2e')],'dialOriginateCallerIdName':_0x21197f[_0xee0a('0x2f')],'dialOriginateCallerIdNumber':_0x21197f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x21197f[_0xee0a('0x30')],'dialPrefix':_0x21197f[_0xee0a('0x31')],'outboundAnswerAgiCallsDay':_0x21197f[_0xee0a('0x32')],'outboundAnswerCallsDay':_0x21197f[_0xee0a('0x33')],'outboundBlacklistCallsDay':_0x21197f[_0xee0a('0x34')],'outboundBusyCallsDay':_0x21197f[_0xee0a('0x35')],'outboundCongestionCallsDay':_0x21197f[_0xee0a('0x36')],'outboundDropCallsDayACS':_0x21197f[_0xee0a('0x37')],'outboundDropCallsDayCallersExit':_0x21197f[_0xee0a('0x38')],'outboundDropCallsDayTimeout':_0x21197f[_0xee0a('0x39')],'outboundNoAnswerCallsDay':_0x21197f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x21197f[_0xee0a('0x3a')],'outboundOriginateFailureCallsDay':_0x21197f[_0xee0a('0x3b')],'outboundReCallsDay':_0x21197f[_0xee0a('0x3c')],'outboundRejectCallsDay':_0x21197f[_0xee0a('0x3d')],'outboundUnknownCallsDay':_0x21197f[_0xee0a('0x3e')],'outboundAbandonedCallsDay':_0x21197f[_0xee0a('0x3f')],'predictiveIntervalAnsweredCalls':_0x21197f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x21197f[_0xee0a('0x40')],'predictiveIntervalAvgTalktime':_0x21197f[_0xee0a('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x21197f[_0xee0a('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x21197f[_0xee0a('0x43')],'predictiveIntervalErlangCalls':_0x21197f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x21197f[_0xee0a('0x44')],'predictiveIntervalHitRate':_0x21197f['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x21197f[_0xee0a('0x45')],'predictiveIntervalPauses':_0x21197f[_0xee0a('0x46')],'predictiveIntervalAvailable':_0x21197f[_0xee0a('0x47')],'predictiveIntervalTotalCalls':_0x21197f[_0xee0a('0x48')],'message':_0x21197f[_0xee0a('0x49')],'originated':_0x21197f[_0xee0a('0x4a')],'erlangCalls':_0x21197f[_0xee0a('0x4b')],'erlangCallToSecond':_0x21197f[_0xee0a('0x4c')],'erlangAbandonmentRate':_0x21197f['erlangAbandonmentRate'],'erlangBusyFactor':_0x21197f[_0xee0a('0x4d')],'startPredictive':_0x21197f[_0xee0a('0x4e')],'startProgressive':_0x21197f['startProgressive']};if(_0x21197f[_0xee0a('0x4f')]){_0x2c543c[_0xee0a('0x4f')]={'id':_0x21197f[_0xee0a('0x4f')]['id'],'name':_0x21197f['Trunk'][_0xee0a('0x50')],'active':_0x21197f[_0xee0a('0x4f')][_0xee0a('0x51')],'callerid':_0x21197f['Trunk'][_0xee0a('0x52')]};}if(_0x21197f[_0xee0a('0x53')]){_0x2c543c[_0xee0a('0x53')]={'id':_0x21197f['Interval']['id'],'name':_0x21197f['Interval'][_0xee0a('0x50')]};}var _0x10e8a5=md5(JSON[_0xee0a('0x54')](_0x2c543c));if(_0x21197f[_0xee0a('0x2')]!==_0x10e8a5){_0x21197f[_0xee0a('0x2')]=_0x10e8a5;emit(util[_0xee0a('0x55')](_0xee0a('0x56'),_0x2c543c[_0xee0a('0x50')]),_0xee0a('0x57'),_0x2c543c);}}}function emitVoiceQueueChannelRemove(_0x5325ab){logger[_0xee0a('0x58')](_0xee0a('0x59'),JSON['stringify'](_0x5325ab));emit(util[_0xee0a('0x55')](_0xee0a('0x56'),_0x5325ab['name']),_0xee0a('0x5a'),_0x5325ab);io[_0xee0a('0x21')](_0xee0a('0x5b'),_0x5325ab);}function notSendMessagesQueue(_0x4393d9){if(_0x4393d9[_0xee0a('0x5c')]){if(_0x4393d9[_0xee0a('0x4a')]===0x0&&_0x4393d9[_0xee0a('0x5d')]===0x0){_0x4393d9[_0xee0a('0x5c')]=![];_0x4393d9[_0xee0a('0x26')]=0x0;_0x4393d9['paused']=0x0;_0x4393d9[_0xee0a('0x49')]=_0xee0a('0x5e');ut[_0xee0a('0x5f')](_0xee0a('0x60'),_0x4393d9['name']+'\x20is\x20not\x20active');}else{_0x4393d9[_0xee0a('0x49')]=_0xee0a('0x61');ut[_0xee0a('0x5f')](_0xee0a('0x60'),_0x4393d9[_0xee0a('0x50')]+_0xee0a('0x62'));}emitCampaignPreview(_0x4393d9);}}Preview[_0xee0a('0xc')]['loopCampaigns']=function(){var _0x581490=this;setInterval(function(){_0x581490[_0xee0a('0x63')]();},0x7cf);};Preview[_0xee0a('0xc')]['syncCampaigns']=function(){var _0x3293b5=this[_0xee0a('0x20')];this['clockClearZombieChannels']+=0x1;for(var _0x140783 in _0x3293b5){if(_0x3293b5[_0xee0a('0x64')](_0x140783)&&(_0x3293b5[_0x140783][_0xee0a('0x2e')]===_0xee0a('0x65')||_0x3293b5[_0x140783][_0xee0a('0x2e')]===_0xee0a('0x66'))&&_0x3293b5[_0x140783][_0xee0a('0x22')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xee0a('0x12')]=0x0;this['clearZombieChannels']();}}if(_0x3293b5['hasOwnProperty'](_0x140783)&&_0x3293b5[_0x140783]['dialMethod']===_0xee0a('0x65')&&_0x3293b5[_0x140783][_0xee0a('0x22')]==='outbound'){if(_0x3293b5[_0x140783]['dialActive']){this['setMessage'](_0x3293b5[_0x140783]);if(_0x3293b5[_0x140783]['dialPreviewAutoRecallMe'])this[_0xee0a('0x67')](_0x3293b5[_0x140783]);}else{notSendMessagesQueue(_0x3293b5[_0x140783]);}}}};Preview[_0xee0a('0xc')][_0xee0a('0x68')]=function(_0x384986){var _0x3e8a36=this;this[_0xee0a('0xe')]['enqueue'](function(){if(!_[_0xee0a('0x69')](_0x3e8a36['actions'][_0x384986])){loggerAction[_0xee0a('0x58')](_0xee0a('0x6a'),_0x384986,_0xee0a('0x6b'),_0x3e8a36[_0xee0a('0x11')][_0x384986]['queue'],_0xee0a('0x6c'),JSON[_0xee0a('0x54')](_0x3e8a36[_0xee0a('0x20')][_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6d')]][_0xee0a('0x4a')]),_0xee0a('0x6e'),JSON['stringify'](_0x3e8a36['campaignsPreview'][_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6d')]][_0xee0a('0x5d')]),JSON[_0xee0a('0x54')](_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6f')]),JSON[_0xee0a('0x54')](_[_0xee0a('0x70')](_0x3e8a36[_0xee0a('0x11')][_0x384986],[_0xee0a('0x71'),_0xee0a('0x72'),_0xee0a('0x73'),'ListId'])));return ami[_0xee0a('0x74')]({'action':_0xee0a('0x75'),'channel':_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x76')]})[_0xee0a('0x77')](function(_0x4ff823){if(_0x4ff823[_0xee0a('0x49')]===_0xee0a('0x78')){setTimeout(function(){if(_0x3e8a36[_0xee0a('0x11')][_0x384986]){ut[_0xee0a('0x79')](_0x3e8a36[_0xee0a('0x20')][_0x3e8a36['actions'][_0x384986][_0xee0a('0x6d')]],_0xee0a('0x7a'));if(_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6f')]===!![]){ut[_0xee0a('0x7b')](_0x3e8a36['campaignsPreview'][_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6d')]],_0xee0a('0x7a'));ut[_0xee0a('0x7c')](_0xee0a('0x7d')+_0x384986,_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6d')]);}ut[_0xee0a('0x7c')](_0xee0a('0x7e')+_0x384986,_0x3e8a36[_0xee0a('0x11')][_0x384986][_0xee0a('0x6d')]);delete _0x3e8a36[_0xee0a('0x11')][_0x384986];}},0x2328);}});}});};Preview[_0xee0a('0xc')][_0xee0a('0x7f')]=function(){var _0x40093b=this;loggerAction[_0xee0a('0x58')](_0xee0a('0x80'),_[_0xee0a('0x81')](this[_0xee0a('0x11')]));for(var _0x3bc4b7 in this[_0xee0a('0x11')]){if(_0x40093b[_0xee0a('0x11')]['hasOwnProperty'](_0x3bc4b7)){_0x40093b['clearZombieChannel'](_0x3bc4b7);}}};Preview['prototype'][_0xee0a('0x67')]=function(_0x557690){var _0x198c4d=this;rpcDb[_0xee0a('0x82')](_0x557690['id'],ut[_0xee0a('0x83')](this[_0xee0a('0x84')]))['then'](function(_0x7f069a){if(!_[_0xee0a('0x69')](_0x7f069a)){for(var _0x1e6601=0x0;_0x1e6601<_0x7f069a[_0xee0a('0x85')];_0x1e6601+=0x1){if(ut[_0xee0a('0x86')](_0x7f069a[_0x1e6601][_0xee0a('0x87')])<_0x557690[_0xee0a('0x88')]*0x3c){if(_0x7f069a[_0x1e6601][_0xee0a('0x89')]&&!_0x7f069a[_0x1e6601][_0xee0a('0x89')][_0xee0a('0x8a')]){_0x198c4d[_0xee0a('0x8b')](_0x7f069a[_0x1e6601]['id'])[_0xee0a('0x8c')](ut[_0xee0a('0x8d')](_0xee0a('0x8e')))['catch'](ut[_0xee0a('0x8d')]('[RecallMe]'));}else{rpcDb[_0xee0a('0x8f')](_0x7f069a[_0x1e6601]['id']);}}else{var _0x156801=new Action(_0x7f069a[_0x1e6601],_0x557690);_0x156801['starttime']=moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x557690[_0xee0a('0x3c')]+=0x1;ut['logCustomer'](_0x156801,0x17,'RecallInQueue');if(_0x557690['dialRecallInQueue']){rpcDb[_0xee0a('0x90')](ut[_0xee0a('0x91')](_0x7f069a[_0x1e6601]));rpcDb[_0xee0a('0x92')](_0x156801,_0xee0a('0x93'));}else{ut[_0xee0a('0x94')](_0x156801,0x16,_0xee0a('0x95'));rpcDb[_0xee0a('0x92')](_0x156801,_0xee0a('0x96'));rpcDb['createCustomerFinal'](_0x156801,_0xee0a('0x96'));}}}}})['catch'](ut['logger2'](_0xee0a('0x97')));};Preview[_0xee0a('0xc')][_0xee0a('0x98')]=function(_0x20f149){_0x20f149[_0xee0a('0x5c')]=!![];if(ut[_0xee0a('0x99')](_0x20f149[_0xee0a('0x27')])){_0x20f149[_0xee0a('0x49')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xee0a('0x9a')](_0x20f149['dialActive'])){_0x20f149[_0xee0a('0x49')]=_0xee0a('0x5e');}else if(!this[_0xee0a('0x9b')](_0x20f149[_0xee0a('0x4f')])){if(!this[_0xee0a('0x9b')](_0x20f149[_0xee0a('0x9c')])){_0x20f149['message']=_0xee0a('0x9d');}else{_0x20f149[_0xee0a('0x49')]=_0xee0a('0x9e');}}else{_0x20f149['message']=_0xee0a('0x9e');}emitCampaignPreview(_0x20f149);};Preview[_0xee0a('0xc')]['callProgressDetectingCustomer']=function(_0x46e0b1,_0x4b76b9,_0x491ea3){var _0x4d6583=this;var _0x4fc849=this[_0xee0a('0x11')][_0x4b76b9];var _0x551622=this[_0xee0a('0x20')][_0x4fc849['queue']];var _0x318c5a;var _0x1ec16a=![];var _0x298b7e=0x2;var _0x32e0b7=0x3;if(_0x551622){switch(_0x491ea3){case'1':_0x551622['outboundNoSuchCallsDay']+=0x1;_0x4fc849[_0xee0a('0x9f')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut[_0xee0a('0xa1')](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x0,_0xee0a('0xa2'));ami['emit'](_0xee0a('0xa3'),ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xa5')));rpcDb['createCustomerHistory'](_0x4fc849,_0xee0a('0xa6'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'0',_0x551622)['then'](function(_0x122c18){_0x1ec16a=_0x122c18[_0xee0a('0xa8')]==0x1;_0x298b7e=_0x551622[_0xee0a('0xa9')];_0x32e0b7=_0x551622[_0xee0a('0xaa')];if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb['createCustomerFinal'](_0x318c5a,_0xee0a('0xae'));}else{if(_0x4fc849[_0xee0a('0x9f')]>=_0x551622[_0xee0a('0xaf')]){rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xae'));}else{rpcDb[_0xee0a('0xb1')](ut[_0xee0a('0xb2')](_0x4fc849,'countnosuchnumberretry',_0x551622[_0xee0a('0xa9')]),_0x4fc849[_0xee0a('0xb3')],_0x4fc849[_0xee0a('0xb4')]);}}delete this[_0xee0a('0x11')][_0x46e0b1['linkedid']];}else{_0x4fc849[_0xee0a('0x9f')]++;logger[_0xee0a('0x58')](_0xee0a('0xb5'),_0x4fc849[_0xee0a('0x9f')]);logger[_0xee0a('0x58')]('id',_0x4fc849['idContact']);_0x4d6583['incrementPreviewCounters']({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnosuchnumberretry':_0x4fc849[_0xee0a('0x9f')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});break;case _0xee0a('0xb7'):var _0x447072=moment()[_0xee0a('0x55')](_0xee0a('0xb8'));_0x4fc849[_0xee0a('0xb9')]=_0x447072;_0x4fc849[_0xee0a('0xba')]=_0x447072;_0x4fc849[_0xee0a('0x6f')]=!![];_0x551622['pTalking']+=0x1;logger[_0xee0a('0x58')](_0xee0a('0xbb'),_0x4fc849[_0xee0a('0xbc')],_0xee0a('0xbd'),_0x551622[_0xee0a('0x50')],'pTalking:\x20',_0x551622[_0xee0a('0x5d')]);ami[_0xee0a('0x21')](_0xee0a('0xbe'),ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xbf'),this['campaignsPreview'][_0x4fc849['queue']]));if(_0x551622['acw']){ami['emit'](_0xee0a('0xc0'),ut['buildAcw'](_0x4fc849));}break;case'16':ami[_0xee0a('0x21')](_0xee0a('0xc1'),ut['buildObj'](_0x4fc849,_0xee0a('0xc2'),this['campaignsPreview'][_0x4fc849[_0xee0a('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xc2')));_0x551622[_0xee0a('0x33')]+=0x1;_0x551622['total']+=0x1;_0x551622[_0xee0a('0x25')]+=0x1;ut[_0xee0a('0x7b')](_0x551622,_0xee0a('0xc3'));_0x4fc849[_0xee0a('0xa0')]=ut['totalGlobal'](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x4,_0xee0a('0xc4'));rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xc5'));rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xc6'));rpcDb['crateCustomerReportQueue'](_0x4fc849);_0x551622[_0xee0a('0x29')]+=_0x4fc849[_0xee0a('0xc7')];_0x551622[_0xee0a('0x28')]+=_0x4fc849[_0xee0a('0xc7')];logger[_0xee0a('0x58')](_0xee0a('0xc8'),_0x4fc849['uniqueid'],_0xee0a('0xbd'),_0x551622[_0xee0a('0x50')],_0xee0a('0x6e'),_0x551622[_0xee0a('0x5d')]);delete this[_0xee0a('0x11')][_0x46e0b1[_0xee0a('0xc9')]];break;case'BUSY':_0x551622[_0xee0a('0x35')]+=0x1;_0x4fc849[_0xee0a('0xca')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut[_0xee0a('0xa1')](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x5,_0xee0a('0xcb'));_0x298b7e=_0x551622[_0xee0a('0xcc')];_0x32e0b7=_0x551622[_0xee0a('0xaa')];ami[_0xee0a('0x21')](_0xee0a('0xcd'),ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xce')));rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xcf'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'5',_0x551622)['then'](function(_0x21a9bb){_0x1ec16a=_0x21a9bb[_0xee0a('0xa8')]==0x1;if(!_0x1ec16a){if(ut['totalGlobal'](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,'Global');rpcDb['createCustomerFinal'](_0x318c5a,_0xee0a('0xd0'));}else{if(_0x4fc849['countbusyretry']>=_0x551622[_0xee0a('0xd1')]){rpcDb[_0xee0a('0xb0')](_0x4fc849,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xee0a('0xb1')](ut[_0xee0a('0xb2')](_0x4fc849,_0xee0a('0xca'),_0x551622[_0xee0a('0xcc')]),_0x4fc849[_0xee0a('0xb3')],_0x4fc849['activeContact']);}}}else{_0x4fc849[_0xee0a('0xca')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countbusyretry':_0x4fc849[_0xee0a('0xca')]}})[_0xee0a('0x8c')](function(){_0x4d6583[_0xee0a('0xd3')](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});break;case _0xee0a('0xd4'):_0x551622[_0xee0a('0xd5')]+=0x1;_0x4fc849[_0xee0a('0xd6')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut[_0xee0a('0xa1')](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x3,'NoAnswer');_0x298b7e=_0x551622[_0xee0a('0xd7')];_0x32e0b7=_0x551622['callAdditionalPhoneAfterMin'];ami[_0xee0a('0x21')](_0xee0a('0xd8'),ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xd9')));rpcDb['createCustomerHistory'](_0x4fc849,_0xee0a('0xda'));_0x4d6583['verifyAdditionalPhones'](_0x4fc849,'3',_0x551622)[_0xee0a('0x8c')](function(_0x398b7c){_0x1ec16a=_0x398b7c['additional']==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb[_0xee0a('0xb0')](_0x318c5a,_0xee0a('0xdb'));}else{if(_0x4fc849[_0xee0a('0xd6')]>=_0x551622[_0xee0a('0xdc')]){rpcDb['createCustomerFinal'](_0x4fc849,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xee0a('0xb1')](ut[_0xee0a('0xb2')](_0x4fc849,_0xee0a('0xd6'),_0x551622[_0xee0a('0xd7')]),_0x4fc849['unlockAgent'],_0x4fc849[_0xee0a('0xb4')]);}}}else{_0x4fc849[_0xee0a('0xd6')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnoanswerretry':_0x4fc849[_0xee0a('0xd6')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)['then'](function(){});});}});break;case _0xee0a('0xdd'):_0x551622[_0xee0a('0x36')]+=0x1;_0x4fc849[_0xee0a('0xde')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut[_0xee0a('0xa1')](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x8,_0xee0a('0xdf'));_0x298b7e=_0x551622[_0xee0a('0xe0')];_0x32e0b7=_0x551622['callAdditionalPhoneAfterMin'];ami[_0xee0a('0x21')](_0xee0a('0xe1'),ut['buildObj'](_0x4fc849,'congestion'));rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xe2'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'8',_0x551622)[_0xee0a('0x8c')](function(_0x1c7897){_0x1ec16a=_0x1c7897['additional']==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut['cloneAction'](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb['createCustomerFinal'](_0x318c5a,_0xee0a('0xe3'));}else{if(_0x4fc849[_0xee0a('0xde')]>=_0x551622[_0xee0a('0xe4')]){rpcDb['createCustomerFinal'](_0x4fc849,_0xee0a('0xe2'));}else{rpcDb[_0xee0a('0xb1')](ut[_0xee0a('0xb2')](_0x4fc849,_0xee0a('0xde'),_0x551622['dialBusyRetryFrequency']),_0x4fc849['unlockAgent'],_0x4fc849['activeContact']);}}}else{_0x4fc849[_0xee0a('0xde')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countcongestionretry':_0x4fc849['countcongestionretry']}})['then'](function(){_0x4d6583[_0xee0a('0xd3')](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});break;case _0xee0a('0xe5'):_0x551622['outboundRejectCallsDay']+=0x1;_0x4fc849['countagentrejectretry']+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut['totalGlobal'](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x14,_0xee0a('0xe6'));_0x298b7e=_0x551622[_0xee0a('0xe7')];_0x32e0b7=_0x551622[_0xee0a('0xaa')];ami['emit'](_0xee0a('0xe8'),ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xe9')));rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xea'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'20',_0x551622)[_0xee0a('0x8c')](function(_0x1a3084){_0x1ec16a=_0x1a3084[_0xee0a('0xa8')]==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0x14,'AgentReject');rpcDb[_0xee0a('0xb0')](_0x318c5a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4fc849[_0xee0a('0xeb')]>=_0x551622[_0xee0a('0xec')]){rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xed'));}else{rpcDb[_0xee0a('0xb1')](ut['scheduledAt'](_0x4fc849,_0xee0a('0xeb'),_0x551622[_0xee0a('0xe7')]),_0x4fc849['unlockAgent'],_0x4fc849[_0xee0a('0xb4')]);}}}else{_0x4fc849[_0xee0a('0xd6')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnoanswerretry':_0x4fc849[_0xee0a('0xd6')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});break;case _0xee0a('0xee'):_0x551622[_0xee0a('0x3f')]+=0x1;_0x4fc849[_0xee0a('0xef')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut['totalGlobal'](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0xb,_0xee0a('0xf0'));rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xf1'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'11',_0x551622)[_0xee0a('0x8c')](function(_0x53ab62){_0x1ec16a=_0x53ab62['additional']==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622['dialGlobalMaxRetry']){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb[_0xee0a('0xb0')](_0x318c5a,_0xee0a('0xf1'));}else{if(_0x4fc849[_0xee0a('0xf2')]>=_0x551622['dialAbandonedMaxRety']){rpcDb[_0xee0a('0xb0')](_0x4fc849,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xee0a('0xb1')](ut[_0xee0a('0xb2')](_0x4fc849,'countabandonedretry',_0x551622[_0xee0a('0xf3')]),_0x4fc849[_0xee0a('0xb3')],_0x4fc849[_0xee0a('0xb4')]);}}}else{_0x4fc849['countnoanswerretry']++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnoanswerretry':_0x4fc849[_0xee0a('0xd6')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});break;case'18':_0x551622[_0xee0a('0x3e')]+=0x1;_0x4fc849['countmachineretry']+=0x1;_0x4fc849['countglobal']=ut[_0xee0a('0xa1')](_0x4fc849);ut['logCustomer'](_0x4fc849,0x12,_0x46e0b1[_0xee0a('0xf4')]||_0x46e0b1[_0xee0a('0xf5')]);ami[_0xee0a('0x21')]('custom:amd',ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xf6')));rpcDb[_0xee0a('0x92')](_0x4fc849,'[callProgressDetectingCustomer][hangupInAMD]');_0x4d6583['verifyAdditionalPhones'](_0x4fc849,'18',_0x551622)[_0xee0a('0x8c')](function(_0x1b160f){_0x1ec16a=_0x1b160f['additional']==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0x12,_0xee0a('0xad'));rpcDb['createCustomerFinal'](_0x318c5a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xf7'));}}else{_0x4fc849[_0xee0a('0xd6')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnoanswerretry':_0x4fc849[_0xee0a('0xd6')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});delete this['actions'][_0x46e0b1[_0xee0a('0xc9')]];break;case'19':_0x551622[_0xee0a('0x3e')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut['totalGlobal'](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0x13,_0x46e0b1[_0xee0a('0xf4')]||_0x46e0b1[_0xee0a('0xf5')]);ami[_0xee0a('0x21')]('custom:amd',ut[_0xee0a('0xa4')](_0x4fc849,_0xee0a('0xf6')));rpcDb['createCustomerHistory'](_0x4fc849,_0xee0a('0xf8'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'18',_0x551622)[_0xee0a('0x8c')](function(_0x5afce7){_0x1ec16a=_0x5afce7[_0xee0a('0xa8')]==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb[_0xee0a('0xb0')](_0x318c5a,_0xee0a('0xf8'));}else{rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xf8'));}}else{_0x4fc849[_0xee0a('0xd6')]++;_0x4d6583[_0xee0a('0xd2')]({'id':_0x4fc849[_0xee0a('0xb6')],'field':{'countnoanswerretry':_0x4fc849[_0xee0a('0xd6')]}})[_0xee0a('0x8c')](function(){_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)[_0xee0a('0x8c')](function(){});});}});delete this[_0xee0a('0x11')][_0x46e0b1['linkedid']];break;default:if(_0x4fc849[_0xee0a('0x6f')]){ut[_0xee0a('0x7b')](_0x551622,_0xee0a('0xf9'));ut['loggerError'](_0xee0a('0xfa')+_0x551622[_0xee0a('0x50')],_0x46e0b1);}_0x551622[_0xee0a('0x3e')]+=0x1;_0x4fc849[_0xee0a('0xa0')]=ut['totalGlobal'](_0x4fc849);ut[_0xee0a('0x94')](_0x4fc849,0xc,_0x46e0b1[_0xee0a('0xf4')]||_0x46e0b1[_0xee0a('0xf5')]);_0x298b7e=_0x551622['dialAgentRejectRetryFrequency'];_0x32e0b7=_0x551622['callAdditionalPhoneAfterMin'];rpcDb[_0xee0a('0x92')](_0x4fc849,_0xee0a('0xfb'));_0x4d6583[_0xee0a('0xa7')](_0x4fc849,'20',_0x551622)[_0xee0a('0x8c')](function(_0x3f9ee2){_0x1ec16a=_0x3f9ee2[_0xee0a('0xa8')]==0x1;if(!_0x1ec16a){if(ut[_0xee0a('0xa1')](_0x4fc849)>=_0x551622[_0xee0a('0xab')]){_0x318c5a=ut[_0xee0a('0xac')](_0x4fc849,0xf,_0xee0a('0xad'));rpcDb[_0xee0a('0xb0')](_0x318c5a,_0xee0a('0xfc'));}else{rpcDb[_0xee0a('0xb0')](_0x4fc849,_0xee0a('0xfc'));}delete this[_0xee0a('0x11')][_0x46e0b1['linkedid']];}else{_0x4d6583['swapAdditionalPhones'](_0x4fc849,_0x298b7e,_0x32e0b7)['then'](function(_0xc684b3){});}});}if(!(_0x4fc849[_0xee0a('0x6f')]&&_0x491ea3==='16')){ut[_0xee0a('0x79')](_0x551622,_0xee0a('0xfd'));logger[_0xee0a('0x58')]('[originated][decrement][callProgressDetectingCustomer]',_0x4fc849['uniqueid'],_0xee0a('0xbd'),_0x551622['name'],_0xee0a('0x6c'),_0x551622['originated']);}if(_0x491ea3!==_0xee0a('0xb7')){delete this['actions'][_0x46e0b1[_0xee0a('0xc9')]];delete this[_0xee0a('0x11')][_0x46e0b1[_0xee0a('0xfe')]];}}};Preview[_0xee0a('0xc')][_0xee0a('0xff')]=function(_0x2ffb89,_0xeb1a60,_0x50124b){if(_[_0xee0a('0x100')](_0xeb1a60)&&_0xee0a('0x101')!==typeof _0xeb1a60){return;}if(_[_0xee0a('0x100')](_0x50124b)&&_0xee0a('0x101')!==typeof _0x50124b){return;}switch(_0x50124b[_0xee0a('0x102')]){case'0':ut['logAgent'](_0x2ffb89,0x0,_0xee0a('0xa2'));rpcDb['createAgentHistory'](_0x2ffb89,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xee0a('0x103')](_0x2ffb89,0x3,_0xee0a('0x104'));rpcDb['createAgentHistory'](_0x2ffb89,_0xee0a('0x105'));break;case'5':ut[_0xee0a('0x103')](_0x2ffb89,0x5,_0xee0a('0xcb'));rpcDb['createAgentHistory'](_0x2ffb89,_0xee0a('0x106'));break;case'8':ut[_0xee0a('0x103')](_0x2ffb89,0x8,_0xee0a('0xdf'));rpcDb['createAgentHistory'](_0x2ffb89,_0xee0a('0x107'));break;case'22':ut[_0xee0a('0x103')](_0x2ffb89,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x2ffb89,_0xee0a('0x108'));break;default:ut['logAgent'](_0x2ffb89,0xc,_0x50124b[_0xee0a('0x102')]);rpcDb[_0xee0a('0x109')](_0x2ffb89,_0xee0a('0x107'));}ut[_0xee0a('0x79')](_0xeb1a60,_0xee0a('0x10a'));logger[_0xee0a('0x58')](_0xee0a('0x10b'),_0x2ffb89[_0xee0a('0xbc')],_0xee0a('0xbd'),_0xeb1a60[_0xee0a('0x50')],_0xee0a('0x6c'),_0xeb1a60[_0xee0a('0x4a')]);delete this['actions'][_0x2ffb89[_0xee0a('0xbc')]];};Preview[_0xee0a('0xc')][_0xee0a('0xa7')]=function(_0x41d333,_0x5ed20b,_0x2b330e){return BPromise[_0xee0a('0x10c')]()[_0xee0a('0x8c')](cmHopperAdditionalPhone[_0xee0a('0xa7')](_0x41d333,_0x5ed20b,_0x2b330e))[_0xee0a('0x77')](logger[_0xee0a('0x58')]('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0xee0a('0xd3')]=function(_0x5990b0,_0x33a3e1,_0x324cd3){return BPromise[_0xee0a('0x10c')]()[_0xee0a('0x8c')](cmHopperAdditionalPhone[_0xee0a('0xd3')](_0x5990b0,_0x33a3e1,_0x324cd3))[_0xee0a('0x77')](logger[_0xee0a('0x58')]('[swapAdditionalPhone]\x20'));};Preview[_0xee0a('0xc')][_0xee0a('0xd2')]=function(_0x2a1075){return BPromise[_0xee0a('0x10c')]()[_0xee0a('0x8c')](cmHopperAdditionalPhone[_0xee0a('0xd2')](_0x2a1075))['catch'](logger[_0xee0a('0x58')]('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0xee0a('0x10d')]=function(_0x5894f9,_0x397922,_0x309c2f,_0x454ca9,_0x5275cd){var _0x45ae99=this;return new BPromise(function(_0x44b3eb,_0x1ca8e5){if(_[_0xee0a('0x69')](_0x397922)||_[_0xee0a('0x69')](_0x397922['Contact'])||_[_0xee0a('0x69')](_0x397922[_0xee0a('0x10e')])||_[_0xee0a('0x69')](_0x397922['VoiceQueueId'])){_0x1ca8e5(ut['message'](_0xee0a('0x10f'),_0x454ca9,_0x5275cd));return;}var _0xeec7fe=uuid['v4']();var _0x284aed=_0x45ae99[_0xee0a('0x20')][_0x397922[_0xee0a('0x6b')][_0xee0a('0x50')]];var _0x47c4a7=_0x309c2f?_0x45ae99[_0xee0a('0x84')][_0x309c2f]['id']:undefined;_0x45ae99[_0xee0a('0x11')][_0xeec7fe]=new Action(_0x397922,_0x284aed,_0xeec7fe,_0x309c2f,_0x47c4a7);var _0x3f94a9=_0x45ae99['actions'][_0xeec7fe];_0x3f94a9[_0xee0a('0xb3')]=_0x454ca9;_0x3f94a9[_0xee0a('0xb4')]=_0x5275cd;_0x3f94a9[_0xee0a('0x110')]=_0x309c2f;if(_['isEmpty'](_0x5894f9)){_0x45ae99[_0xee0a('0x111')](_0x3f94a9,_0x284aed,_0x397922,_0x309c2f)[_0xee0a('0x8c')](function(_0x515dd5){logger[_0xee0a('0x58')](_0xee0a('0x112'),'Queue:\x20'+_0x3f94a9[_0xee0a('0x6d')]+_0xee0a('0x113')+_0x3f94a9[_0xee0a('0xb6')],JSON[_0xee0a('0x54')](_0x515dd5));ami['emit'](_0xee0a('0x114'),ut['buildObj'](_0x3f94a9,_0xee0a('0x115'),_0x45ae99[_0xee0a('0x20')][_0x3f94a9['queue']]));_0x44b3eb(ut[_0xee0a('0x49')](_0xee0a('0x116')));})[_0xee0a('0x77')](function(_0x45b7be){ut[_0xee0a('0x5f')](_0xee0a('0x117'),_0x45b7be);_0x1ca8e5(ut[_0xee0a('0x49')](_0xee0a('0x118'),_0x454ca9,_0x5275cd));});}else{_0x284aed[_0xee0a('0x34')]+=0x1;ut[_0xee0a('0x119')](_0x3f94a9);rpcDb[_0xee0a('0x11a')](_0x3f94a9,'[Blacklist][error]');delete _0x45ae99[_0xee0a('0x11')][_0xeec7fe];_0x1ca8e5(ut[_0xee0a('0x49')]('Contact\x20in\x20black\x20List',_0x454ca9,_0x5275cd));}});};Preview[_0xee0a('0xc')]['isTrunkReachable']=function(_0xb7969d){return!_[_0xee0a('0x69')](_0xb7969d)&&!_['isNil'](_0xb7969d[_0xee0a('0x50')])&&!_[_0xee0a('0x69')](_0xb7969d[_0xee0a('0x51')])&&_0xb7969d[_0xee0a('0x51')]&&!_[_0xee0a('0x69')](this[_0xee0a('0x10')][util[_0xee0a('0x55')](_0xee0a('0x11b'),_0xb7969d[_0xee0a('0x50')])])&&!_[_0xee0a('0x69')](this[_0xee0a('0x10')][util['format'](_0xee0a('0x11b'),_0xb7969d[_0xee0a('0x50')])][_0xee0a('0x75')])&&(this[_0xee0a('0x10')][util['format'](_0xee0a('0x11b'),_0xb7969d[_0xee0a('0x50')])]['status']===_0xee0a('0x11c')||this[_0xee0a('0x10')][util[_0xee0a('0x55')](_0xee0a('0x11b'),_0xb7969d['name'])][_0xee0a('0x75')]===_0xee0a('0x11d'));};Preview[_0xee0a('0xc')]['run']=function(_0x24bc8f,_0x4706bb){var _0x2ffe57=this;return new BPromise(function(_0x5b860c,_0x125c67){_0x2ffe57['execRun'](_0x24bc8f,_0x4706bb)[_0xee0a('0x8c')](function(_0x2138fc){_0x5b860c(_[_0xee0a('0x70')](_0x2138fc,[_0xee0a('0x49')]));})[_0xee0a('0x77')](function(_0x17c532){if(_0x17c532['unlock']){rpcDb['unlockContact'](_0x24bc8f);}if(_0x17c532['active']){rpcDb[_0xee0a('0x8f')](_0x24bc8f);}_0x125c67(_[_0xee0a('0x70')](_0x17c532,['message']));});});};Preview[_0xee0a('0xc')][_0xee0a('0x11e')]=function(_0x5a4a76,_0x1913ff){var _0x1593e=this;return new BPromise(function(_0x2bcfd3,_0x11e26e){var _0x50f158,_0x3ec0bc;rpcDb[_0xee0a('0x11f')](_0x5a4a76)[_0xee0a('0x8c')](function(_0x930dd9){if(!_[_0xee0a('0x69')](_0x930dd9[0x0])){_0x3ec0bc=_0x930dd9[0x0][_0xee0a('0x120')]?![]:!![];_0x50f158=_0x930dd9[0x0]['recallme']?!![]:![];_0x50f158=_0x1913ff?!![]:_0x50f158;}var _0x598c5c=_0x1593e[_0xee0a('0x121')](_0x930dd9);if(_0x598c5c[_0xee0a('0x122')]){rpcDb['checkIsBlackList'](_[_0xee0a('0x70')](_0x930dd9[0x0],[_0xee0a('0x73'),_0xee0a('0x10e')]))[_0xee0a('0x8c')](function(_0x497f4a){_0x1593e['checkInBlack'](_0x497f4a,_0x930dd9[0x0],_0x1913ff,_0x3ec0bc,_0x50f158)[_0xee0a('0x8c')](function(_0x8b3c77){_0x2bcfd3(_0x8b3c77);})[_0xee0a('0x77')](function(_0x544655){_0x11e26e(_0x544655);});})[_0xee0a('0x77')](function(_0x5326b6){ut[_0xee0a('0x5f')](_0xee0a('0x123'),_0x5326b6);_0x11e26e(ut[_0xee0a('0x49')](_0xee0a('0x124'),_0x3ec0bc,_0x50f158));});}else{_0x11e26e(ut[_0xee0a('0x49')](_0x598c5c[_0xee0a('0x49')],_0x3ec0bc,_0x50f158));}})[_0xee0a('0x77')](function(_0x1f6f1f){ut[_0xee0a('0x5f')](_0xee0a('0x125'),_0x1f6f1f);_0x11e26e(ut['message'](_0xee0a('0x124'),![],!![]));});});};Preview[_0xee0a('0xc')]['validateContact']=function(_0x38f287){if(_[_0xee0a('0x69')](_0x38f287)||_[_0xee0a('0x126')](_0x38f287)||!_[_0xee0a('0x69')](_0x38f287[0x0][_0xee0a('0x89')])&&_[_0xee0a('0x69')](_0x38f287[0x0][_0xee0a('0x89')]['name'])){ut[_0xee0a('0x5f')](_0xee0a('0x127'),_0x38f287);return{'isValid':![],'message':_0xee0a('0x128')};}var _0x4a60b7=this['campaignsPreview'][_0x38f287[0x0][_0xee0a('0x6b')][_0xee0a('0x50')]];_0x4a60b7[_0xee0a('0x49')]=_0xee0a('0x9e');if(_['isNil'](_0x4a60b7)){ut[_0xee0a('0x5f')](_0xee0a('0x129'),_0x4a60b7);return{'isValid':![],'message':_0xee0a('0x12a')};}if(!this[_0xee0a('0x9b')](_0x4a60b7['Trunk'])){ut[_0xee0a('0x5f')](_0xee0a('0x12b'),_0xee0a('0x12c')+_0x4a60b7[_0xee0a('0x50')]+_0xee0a('0x12d'));if(!this[_0xee0a('0x9b')](_0x4a60b7[_0xee0a('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4a60b7[_0xee0a('0x50')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x4a60b7[_0xee0a('0x2d')])){ut[_0xee0a('0x5f')]('[Preview][validateContact][Campaign\x20Active]',_0x4a60b7[_0xee0a('0x50')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4a60b7['name']+_0xee0a('0x12e')};}return{'isValid':!![],'message':_0xee0a('0x12f')};};Preview[_0xee0a('0xc')][_0xee0a('0x111')]=function(_0x3547e4,_0x3bfb6f,_0x4948e7,_0x32edee){var _0xd3fc1b=this;return new BPromise(function(_0x2668c3,_0x508c20){var _0x2f8aba=_0x3547e4[_0xee0a('0xbc')];var _0x760f2a=_0xd3fc1b['isTrunkReachable'](_0x3bfb6f[_0xee0a('0x4f')])?util['format'](_0xee0a('0x130'),_0x3bfb6f['Trunk'][_0xee0a('0x50')],_[_0xee0a('0x69')](_0x3bfb6f['dialPrefix'])?'':_0x3bfb6f[_0xee0a('0x31')][_0xee0a('0x131')]()||'',_0x3bfb6f[_0xee0a('0x132')]>0x0?_0x4948e7[_0xee0a('0x10e')]['substring'](_0x3bfb6f[_0xee0a('0x132')]):_0x4948e7[_0xee0a('0x10e')]):util['format'](_0xee0a('0x130'),_[_0xee0a('0x69')](_0x3bfb6f[_0xee0a('0x9c')])?_0x3bfb6f[_0xee0a('0x4f')][_0xee0a('0x50')]:_0x3bfb6f['TrunkBackup']['name'],_[_0xee0a('0x69')](_0x3bfb6f[_0xee0a('0x31')])?'':_0x3bfb6f[_0xee0a('0x31')][_0xee0a('0x131')]()||'',_0x3bfb6f[_0xee0a('0x132')]>0x0?_0x4948e7[_0xee0a('0x10e')]['substring'](_0x3bfb6f[_0xee0a('0x132')]):_0x4948e7[_0xee0a('0x10e')]);var _0x3e4b27=_0xd3fc1b['isTrunkReachable'](_0x3bfb6f[_0xee0a('0x4f')])?ut[_0xee0a('0x133')](_0x3bfb6f[_0xee0a('0x4f')][_0xee0a('0x52')],_0x3bfb6f['dialOriginateCallerIdName'],_0x3bfb6f[_0xee0a('0x134')]>0x0?ut[_0xee0a('0x135')](_0x3bfb6f['dialOriginateCallerIdNumber'],_0x3bfb6f[_0xee0a('0x134')]):_0x3bfb6f['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0xee0a('0x69')](_0x3bfb6f['TrunkBackup'])?_0x3bfb6f['Trunk'][_0xee0a('0x52')]:_0x3bfb6f['TrunkBackup'][_0xee0a('0x52')],_0x3bfb6f[_0xee0a('0x2f')],_0x3bfb6f[_0xee0a('0x134')]>0x0?ut[_0xee0a('0x135')](_0x3bfb6f[_0xee0a('0x136')],_0x3bfb6f[_0xee0a('0x134')]):_0x3bfb6f[_0xee0a('0x136')]);if(_0x3e4b27){_0x3547e4[_0xee0a('0x137')]=ut['extractCalleridName'](_0x3e4b27);_0x3547e4['originatecalleridnum']=ut['extractCalleridNumber'](_0x3e4b27);}var _0x1c5e0a=ut[_0xee0a('0x138')](_0x3bfb6f,_0x4948e7,_0x760f2a,_0x3e4b27,_0x2f8aba,_0x3547e4);_[_0xee0a('0x139')](_0x3547e4,ut[_0xee0a('0x13a')](_0x1c5e0a));_0x3547e4[_0xee0a('0x13b')]=moment()[_0xee0a('0x55')](_0xee0a('0xb8'));ami[_0xee0a('0x74')](ut[_0xee0a('0x13c')](_0x3547e4,_0x3bfb6f,_0x1c5e0a,_0x3547e4[_0xee0a('0xb4')],_0x32edee))[_0xee0a('0x8c')](function(_0x49f2cf){_0x3bfb6f['originated']+=0x1;logger[_0xee0a('0x58')](_0xee0a('0x13d'),_0x2f8aba,_0xee0a('0xbd'),_0x3bfb6f[_0xee0a('0x50')],_0xee0a('0x6c'),_0x3bfb6f['originated']);_0x2668c3(_0x49f2cf);})['catch'](function(_0x40d2d1){ut['logAgent'](_0x3547e4,0xe,_0xee0a('0x13e'));rpcDb[_0xee0a('0x109')](_0x3547e4,_0xee0a('0x13f'));_0x508c20(_0x40d2d1);});});};Preview[_0xee0a('0xc')]['syncNewExten']=function(_0x2ed2b4){if(this['actions'][_0x2ed2b4[_0xee0a('0xc9')]]){this[_0xee0a('0x11')][_0x2ed2b4[_0xee0a('0xc9')]][_0xee0a('0x76')]=_0x2ed2b4[_0xee0a('0x76')];}};Preview[_0xee0a('0xc')]['syncOriginateResponse']=function(_0x284a3d){var _0x3b6914=this;var _0x2f92b4=this['actions'][_0x284a3d[_0xee0a('0x140')]];if(_0x2f92b4){if(_0x2f92b4['lookAgent']&&this[_0xee0a('0x84')][_0x2f92b4[_0xee0a('0x110')]]){ut[_0xee0a('0x141')](_0x2f92b4,this['agents'][_0x2f92b4[_0xee0a('0x110')]][_0xee0a('0x50')],this[_0xee0a('0x84')][_0x2f92b4[_0xee0a('0x110')]]['id']);}var _0x1ab16a=_[_0xee0a('0x142')](_0x2f92b4);_0x1ab16a[_0xee0a('0xb9')]=moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss');var _0xcd80be=_0x3b6914['campaignsPreview'][_0x2f92b4[_0xee0a('0x6d')]];if(ut['isFailure'](_0x284a3d['response'])){if(_0x2f92b4[_0xee0a('0xb3')]){rpcDb['unlockContact'](_0x2f92b4[_0xee0a('0xb6')]);}if(_0x2f92b4[_0xee0a('0xb4')]){rpcDb[_0xee0a('0x8f')](_0x2f92b4[_0xee0a('0xb6')]);}ami[_0xee0a('0x21')](_0xee0a('0x143'),ut[_0xee0a('0xa4')](_0x2f92b4,_0xee0a('0x144'),this[_0xee0a('0x20')][_0x2f92b4[_0xee0a('0x6d')]]));this['callProgressDetectingAgent'](_0x1ab16a,_0xcd80be,_0x284a3d);}else{_0x2f92b4['starttime']=moment()[_0xee0a('0x55')](_0xee0a('0xb8'));ut[_0xee0a('0x103')](_0x1ab16a,0x4,_0xee0a('0xc4'));rpcDb[_0xee0a('0x109')](_0x1ab16a,_0xee0a('0x145'));}}};Preview[_0xee0a('0xc')]['syncHangup']=function(_0x34f860){var _0x5bac48=this;var _0x560016=this[_0xee0a('0x11')][_0x34f860[_0xee0a('0xc9')]];var _0x370d9f;if(_0x560016){_0x370d9f=this[_0xee0a('0x20')][_0x560016[_0xee0a('0x6d')]];logger[_0xee0a('0x58')]('[syncHangup][talking]',_0x34f860[_0xee0a('0xc9')],'\x20Queue',_0x370d9f[_0xee0a('0x50')],_0xee0a('0x6e'),_0x370d9f[_0xee0a('0x5d')]);}if(this[_0xee0a('0x11')][_0x34f860[_0xee0a('0xc9')]]&&_0x34f860[_0xee0a('0xc9')]!==_0x34f860[_0xee0a('0xbc')]){if(_0x34f860['cause']==='16'&&this[_0xee0a('0x11')][_0x34f860['linkedid']][_0xee0a('0x6f')]){this[_0xee0a('0x146')](_0x34f860,_0x34f860[_0xee0a('0xc9')],_0x34f860[_0xee0a('0x147')]);}else if(this[_0xee0a('0x11')][_0x34f860['linkedid']][_0xee0a('0x6f')]){logger['info'](_0xee0a('0x148'),_0x34f860[_0xee0a('0xc9')],_0x34f860[_0xee0a('0x147')],'\x20Queue',_0x370d9f['name'],'pTalking:\x20',_0x370d9f[_0xee0a('0x5d')]);this[_0xee0a('0x146')](_0x34f860,_0x34f860['linkedid'],_0x34f860['cause']);}}else if(_0x560016&&_[_0xee0a('0x69')](_0x560016[_0xee0a('0x149')])&&_0x370d9f[_0xee0a('0x14a')]&&_0x34f860[_0xee0a('0xc9')]===_0x34f860[_0xee0a('0xbc')]&&_[_0xee0a('0x69')](_0x34f860['reason'])&&_0x34f860[_0xee0a('0x147')]==='16'&&_0x34f860['channelstate']==='6'&&_[_0xee0a('0x100')](_0x560016[_0xee0a('0x14b')])){if(_0x560016[_0xee0a('0xb3')]){rpcDb['unlockContact'](_0x560016[_0xee0a('0xb6')]);}if(_0x560016[_0xee0a('0xb4')]){rpcDb[_0xee0a('0x8f')](_0x560016[_0xee0a('0xb6')]);}_0x34f860[_0xee0a('0x102')]='22';this['callProgressDetectingAgent'](_0x560016,_0x370d9f,_0x34f860);}else if(_0x560016&&_0x560016['transfer']){if(_0x34f860[_0xee0a('0x147')]==='16'&&this[_0xee0a('0x11')][_0x34f860[_0xee0a('0xc9')]]['dialAnswer']){logger['info'](_0xee0a('0x14c'),_0x34f860['linkedid'],_0x34f860[_0xee0a('0x147')],_0xee0a('0xbd'),_0x370d9f[_0xee0a('0x50')],'pTalking:\x20',_0x370d9f[_0xee0a('0x5d')]);this[_0xee0a('0x146')](_0x34f860,_0x34f860[_0xee0a('0xc9')],_0x34f860['cause']);}else if(this[_0xee0a('0x11')][_0x34f860[_0xee0a('0xc9')]][_0xee0a('0x6f')]){logger['info']('[syncHangup][talking][cause]',_0x34f860[_0xee0a('0xc9')],_0x34f860['cause'],_0xee0a('0xbd'),_0x370d9f['name'],_0xee0a('0x6e'),_0x370d9f[_0xee0a('0x5d')]);this[_0xee0a('0x146')](_0x34f860,_0x34f860[_0xee0a('0xc9')],_0x34f860[_0xee0a('0x147')]);}}};Preview['prototype'][_0xee0a('0x19')]=function(_0x884ee7){if(this[_0xee0a('0x11')][_0x884ee7[_0xee0a('0xfe')]]&&_0x884ee7['destlinkedid']!==_0x884ee7['destuniqueid']){this['callProgressDetectingCustomer'](_0x884ee7,_0x884ee7['destlinkedid'],_0x884ee7[_0xee0a('0xf5')]);}};Preview[_0xee0a('0xc')][_0xee0a('0x14d')]=function(_0x9b7fa0){if(this[_0xee0a('0x11')][_0x9b7fa0[_0xee0a('0xc9')]]&&_0x9b7fa0[_0xee0a('0xc9')]!==_0x9b7fa0[_0xee0a('0xbc')]&&!this['actions'][_0x9b7fa0[_0xee0a('0xc9')]][_0xee0a('0x6f')]){if(_0x9b7fa0[_0xee0a('0x147')]==='1'){this[_0xee0a('0x146')](_0x9b7fa0,_0x9b7fa0[_0xee0a('0xc9')],_0x9b7fa0[_0xee0a('0x147')]);}}};Preview[_0xee0a('0xc')]['addVariable']=function(_0x517f3d,_0x442fbb,_0x1742c9){if(this[_0xee0a('0x11')][_0x517f3d]){if(_[_0xee0a('0x69')](this[_0xee0a('0x11')][_0x517f3d]['variables'])){this['actions'][_0x517f3d]['variables']={};}this[_0xee0a('0x11')][_0x517f3d][_0xee0a('0x14e')][_0x442fbb]=_0x1742c9;}};Preview['prototype'][_0xee0a('0x14f')]=function(_0x3a050a){try{if(!_[_0xee0a('0x69')](_0x3a050a)){if(ut[_0xee0a('0x150')](_[_0xee0a('0x151')](_0x3a050a[_0xee0a('0x152')])[0x0])){this[_0xee0a('0x153')](_0x3a050a['uniqueid'],_[_0xee0a('0x151')](_0x3a050a[_0xee0a('0x152')])[0x0],_0x3a050a[_0xee0a('0x154')]);}}}catch(_0x294ef4){logger[_0xee0a('0x155')](_0xee0a('0x156'),util[_0xee0a('0x157')](_0x294ef4,{'showHidden':![],'depth':null}));}};Preview[_0xee0a('0xc')][_0xee0a('0x1d')]=function(_0x47bd3b){if(_0x47bd3b){if(this[_0xee0a('0x11')][_0x47bd3b[_0xee0a('0x158')]]){this[_0xee0a('0x11')][_0x47bd3b['transfertargetlinkedid']][_0xee0a('0x14b')]=!![];}}};Preview[_0xee0a('0xc')][_0xee0a('0x1e')]=function(_0x375a4e){if(_0x375a4e){if(this[_0xee0a('0x11')][_0x375a4e[_0xee0a('0x159')]]){this['actions'][_0x375a4e['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x038b=['outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','preview','outbound','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','countbusyretry','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','md5','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0xb24ceb,_0x11d821){var _0x523526=function(_0x207652){while(--_0x207652){_0xb24ceb['push'](_0xb24ceb['shift']());}};_0x523526(++_0x11d821);}(_0x038b,0x114));var _0xb038=function(_0x5f11ab,_0x45d532){_0x5f11ab=_0x5f11ab-0x0;var _0x7ae297=_0x038b[_0x5f11ab];return _0x7ae297;};'use strict';var util=require('util');var _=require(_0xb038('0x0'));var BPromise=require(_0xb038('0x1'));var uuid=require(_0xb038('0x2'));var moment=require('moment');var md5=require(_0xb038('0x3'));var Redis=require('ioredis');var config=require(_0xb038('0x4'));var logger=require(_0xb038('0x5'))('preview');var loggerAction=require(_0xb038('0x5'))(_0xb038('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xb038('0x7'));var Action=require(_0xb038('0x8'));var ut=require(_0xb038('0x9'));config['redis']=_['defaults'](config[_0xb038('0xa')],{'host':_0xb038('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb038('0xc')][_0xb038('0xd')]=function(_0x5c96b5){this[_0xb038('0xe')]=this[_0xb038('0xe')]?this[_0xb038('0xe')][_0xb038('0xf')](_0x5c96b5):_0x5c96b5();};function Preview(_0x3a09a3){this[_0xb038('0x10')]=new Sequence();this[_0xb038('0x11')]=_0x3a09a3[_0xb038('0x12')];this[_0xb038('0x13')]=_0x3a09a3[_0xb038('0x13')];this[_0xb038('0x14')]={};this[_0xb038('0x15')]=_0x3a09a3[_0xb038('0x15')];this[_0xb038('0x16')]=0x0;ami['on'](_0xb038('0x17'),this[_0xb038('0x18')][_0xb038('0x19')](this));ami['on']('hangup',this[_0xb038('0x1a')][_0xb038('0x19')](this));ami['on'](_0xb038('0x1b'),this[_0xb038('0x1c')][_0xb038('0x19')](this));ami['on'](_0xb038('0x1d'),this['syncDialEnd'][_0xb038('0x19')](this));ami['on'](_0xb038('0x1e'),this[_0xb038('0x1f')][_0xb038('0x19')](this));ami['on']('varset',this['syncVarSet'][_0xb038('0x19')](this));ami['on'](_0xb038('0x20'),this[_0xb038('0x21')][_0xb038('0x19')](this));ami['on']('blindtransfer',this[_0xb038('0x22')][_0xb038('0x19')](this));this[_0xb038('0x23')](this[_0xb038('0x11')]);}function emit(_0xc6cd61,_0x55be53,_0x2e0369){io['to'](_0xc6cd61)[_0xb038('0x24')](_0x55be53,_0x2e0369);}function emitCampaignPreview(_0x2481e2){if(_0x2481e2[_0xb038('0x25')]==='outbound'){var _0x2812c9={'id':_0x2481e2['id'],'name':_0x2481e2[_0xb038('0x26')],'strategy':_0x2481e2['strategy'],'answered':_0x2481e2[_0xb038('0x27')],'available':_0x2481e2[_0xb038('0x28')],'loggedIn':_0x2481e2['loggedIn'],'pTalking':_0x2481e2[_0xb038('0x29')],'sumBillable':_0x2481e2['sumBillable'],'sumDuration':_0x2481e2[_0xb038('0x2a')],'sumHoldTime':_0x2481e2[_0xb038('0x2b')]||0x0,'talking':_0x2481e2[_0xb038('0x2c')],'total':_0x2481e2[_0xb038('0x2d')],'type':_0x2481e2[_0xb038('0x25')],'unmanaged':_0x2481e2[_0xb038('0x2e')],'abandoned':_0x2481e2[_0xb038('0x2f')],'waiting':_0x2481e2['waiting'],'loggedInDb':_0x2481e2[_0xb038('0x30')],'dialActive':_0x2481e2[_0xb038('0x31')],'dialMethod':_0x2481e2[_0xb038('0x32')],'dialOriginateCallerIdName':_0x2481e2['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2481e2[_0xb038('0x33')],'dialOriginateTimeout':_0x2481e2[_0xb038('0x34')],'dialPrefix':_0x2481e2[_0xb038('0x35')],'outboundAnswerAgiCallsDay':_0x2481e2['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2481e2[_0xb038('0x36')],'outboundBlacklistCallsDay':_0x2481e2[_0xb038('0x37')],'outboundBusyCallsDay':_0x2481e2[_0xb038('0x38')],'outboundCongestionCallsDay':_0x2481e2[_0xb038('0x39')],'outboundDropCallsDayACS':_0x2481e2[_0xb038('0x3a')],'outboundDropCallsDayCallersExit':_0x2481e2['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2481e2[_0xb038('0x3b')],'outboundNoAnswerCallsDay':_0x2481e2[_0xb038('0x3c')],'outboundNoSuchCallsDay':_0x2481e2[_0xb038('0x3d')],'outboundOriginateFailureCallsDay':_0x2481e2[_0xb038('0x3e')],'outboundReCallsDay':_0x2481e2[_0xb038('0x3f')],'outboundRejectCallsDay':_0x2481e2[_0xb038('0x40')],'outboundUnknownCallsDay':_0x2481e2[_0xb038('0x41')],'outboundAbandonedCallsDay':_0x2481e2[_0xb038('0x42')],'predictiveIntervalAnsweredCalls':_0x2481e2[_0xb038('0x43')],'predictiveIntervalAvgHoldtime':_0x2481e2[_0xb038('0x44')],'predictiveIntervalAvgTalktime':_0x2481e2[_0xb038('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x2481e2[_0xb038('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x2481e2[_0xb038('0x47')],'predictiveIntervalErlangCalls':_0x2481e2['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2481e2[_0xb038('0x48')],'predictiveIntervalHitRate':_0x2481e2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2481e2[_0xb038('0x49')],'predictiveIntervalPauses':_0x2481e2[_0xb038('0x4a')],'predictiveIntervalAvailable':_0x2481e2[_0xb038('0x4b')],'predictiveIntervalTotalCalls':_0x2481e2[_0xb038('0x4c')],'message':_0x2481e2[_0xb038('0x4d')],'originated':_0x2481e2[_0xb038('0x4e')],'erlangCalls':_0x2481e2[_0xb038('0x4f')],'erlangCallToSecond':_0x2481e2[_0xb038('0x50')],'erlangAbandonmentRate':_0x2481e2[_0xb038('0x51')],'erlangBusyFactor':_0x2481e2[_0xb038('0x52')],'startPredictive':_0x2481e2['startPredictive'],'startProgressive':_0x2481e2[_0xb038('0x53')]};if(_0x2481e2[_0xb038('0x54')]){_0x2812c9[_0xb038('0x54')]={'id':_0x2481e2['Trunk']['id'],'name':_0x2481e2['Trunk']['name'],'active':_0x2481e2[_0xb038('0x54')][_0xb038('0x55')],'callerid':_0x2481e2[_0xb038('0x54')][_0xb038('0x56')]};}if(_0x2481e2[_0xb038('0x57')]){_0x2812c9[_0xb038('0x57')]={'id':_0x2481e2['Interval']['id'],'name':_0x2481e2[_0xb038('0x57')][_0xb038('0x26')]};}var _0x1b6f1e=md5(JSON[_0xb038('0x58')](_0x2812c9));if(_0x2481e2['md5']!==_0x1b6f1e){_0x2481e2[_0xb038('0x3')]=_0x1b6f1e;emit(util[_0xb038('0x59')]('voice:queue:%s',_0x2812c9['name']),_0xb038('0x5a'),_0x2812c9);}}}function emitVoiceQueueChannelRemove(_0xa3d1b){logger[_0xb038('0x5b')](_0xb038('0x5c'),JSON[_0xb038('0x58')](_0xa3d1b));emit(util['format'](_0xb038('0x5d'),_0xa3d1b[_0xb038('0x26')]),_0xb038('0x5e'),_0xa3d1b);io[_0xb038('0x24')]('voice_queue_presence:remove',_0xa3d1b);}function notSendMessagesQueue(_0x793da9){if(_0x793da9[_0xb038('0x5f')]){if(_0x793da9[_0xb038('0x4e')]===0x0&&_0x793da9['pTalking']===0x0){_0x793da9[_0xb038('0x5f')]=![];_0x793da9['available']=0x0;_0x793da9[_0xb038('0x60')]=0x0;_0x793da9[_0xb038('0x4d')]=_0xb038('0x61');ut['logger'](_0xb038('0x62'),_0x793da9[_0xb038('0x26')]+_0xb038('0x63'));}else{_0x793da9['message']=_0xb038('0x64');ut[_0xb038('0x65')](_0xb038('0x62'),_0x793da9[_0xb038('0x26')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x793da9);}}Preview[_0xb038('0xc')][_0xb038('0x23')]=function(){var _0x18d8eb=this;setInterval(function(){_0x18d8eb[_0xb038('0x66')]();},0x7cf);};Preview['prototype'][_0xb038('0x66')]=function(){var _0x269c7d=this['campaignsPreview'];this[_0xb038('0x16')]+=0x1;for(var _0x2848bd in _0x269c7d){if(_0x269c7d[_0xb038('0x67')](_0x2848bd)&&(_0x269c7d[_0x2848bd]['dialMethod']===_0xb038('0x68')||_0x269c7d[_0x2848bd][_0xb038('0x32')]==='booked')&&_0x269c7d[_0x2848bd]['type']===_0xb038('0x69')){if(this[_0xb038('0x16')]>0x7){this[_0xb038('0x16')]=0x0;this[_0xb038('0x6a')]();}}if(_0x269c7d[_0xb038('0x67')](_0x2848bd)&&_0x269c7d[_0x2848bd][_0xb038('0x32')]===_0xb038('0x68')&&_0x269c7d[_0x2848bd][_0xb038('0x25')]==='outbound'){if(_0x269c7d[_0x2848bd]['dialActive']){this['setMessage'](_0x269c7d[_0x2848bd]);if(_0x269c7d[_0x2848bd][_0xb038('0x6b')])this[_0xb038('0x6c')](_0x269c7d[_0x2848bd]);}else{notSendMessagesQueue(_0x269c7d[_0x2848bd]);}}}};Preview['prototype'][_0xb038('0x6d')]=function(_0x20b6af){var _0x10ed9e=this;this['sequence'][_0xb038('0xd')](function(){if(!_['isNil'](_0x10ed9e['actions'][_0x20b6af])){loggerAction[_0xb038('0x5b')](_0xb038('0x6e'),_0x20b6af,_0xb038('0x6f'),_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')],_0xb038('0x71'),JSON[_0xb038('0x58')](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]]['originated']),_0xb038('0x72'),JSON[_0xb038('0x58')](_0x10ed9e['campaignsPreview'][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]]['pTalking']),JSON[_0xb038('0x58')](_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x73')]),JSON[_0xb038('0x58')](_[_0xb038('0x74')](_0x10ed9e[_0xb038('0x14')][_0x20b6af],[_0xb038('0x75'),_0xb038('0x76'),_0xb038('0x77'),'ListId'])));return ami[_0xb038('0x78')]({'action':_0xb038('0x79'),'channel':_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x7a')]})[_0xb038('0x7b')](function(_0x2e1875){if(_0x2e1875['message']===_0xb038('0x7c')){setTimeout(function(){if(_0x10ed9e[_0xb038('0x14')][_0x20b6af]){ut[_0xb038('0x7d')](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]],_0xb038('0x7e'));if(_0x10ed9e['actions'][_0x20b6af][_0xb038('0x73')]===!![]){ut['decrementTalkink'](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]],_0xb038('0x7e'));ut[_0xb038('0x7f')]('[Dialer][checkChannel][pTalking][Preview]'+_0x20b6af,_0x10ed9e['actions'][_0x20b6af]['queue']);}ut[_0xb038('0x7f')](_0xb038('0x80')+_0x20b6af,_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]);delete _0x10ed9e[_0xb038('0x14')][_0x20b6af];}},0x2328);}});}});};Preview[_0xb038('0xc')]['clearZombieChannels']=function(){var _0x27758c=this;loggerAction[_0xb038('0x5b')]('[action]',_['size'](this[_0xb038('0x14')]));for(var _0x4b7557 in this[_0xb038('0x14')]){if(_0x27758c['actions'][_0xb038('0x67')](_0x4b7557)){_0x27758c[_0xb038('0x6d')](_0x4b7557);}}};Preview[_0xb038('0xc')][_0xb038('0x6c')]=function(_0x4ee38b){var _0x32aea0=this;rpcDb[_0xb038('0x81')](_0x4ee38b['id'],ut[_0xb038('0x82')](this[_0xb038('0x15')]))[_0xb038('0x83')](function(_0x1246c8){if(!_[_0xb038('0x84')](_0x1246c8)){for(var _0x401f4c=0x0;_0x401f4c<_0x1246c8[_0xb038('0x85')];_0x401f4c+=0x1){if(ut[_0xb038('0x86')](_0x1246c8[_0x401f4c][_0xb038('0x87')])<_0x4ee38b[_0xb038('0x88')]*0x3c){if(_0x1246c8[_0x401f4c]['Agent']&&!_0x1246c8[_0x401f4c][_0xb038('0x89')][_0xb038('0x8a')]){_0x32aea0[_0xb038('0x8b')](_0x1246c8[_0x401f4c]['id'])[_0xb038('0x83')](ut[_0xb038('0x8c')]('[RecallMe]'))[_0xb038('0x7b')](ut['logger2'](_0xb038('0x8d')));}else{rpcDb[_0xb038('0x8e')](_0x1246c8[_0x401f4c]['id']);}}else{var _0x47e809=new Action(_0x1246c8[_0x401f4c],_0x4ee38b);_0x47e809[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));_0x4ee38b[_0xb038('0x3f')]+=0x1;ut[_0xb038('0x91')](_0x47e809,0x17,_0xb038('0x92'));if(_0x4ee38b[_0xb038('0x93')]){rpcDb[_0xb038('0x94')](ut[_0xb038('0x95')](_0x1246c8[_0x401f4c]));rpcDb[_0xb038('0x96')](_0x47e809,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb038('0x91')](_0x47e809,0x16,'RecallFailedTimeout');rpcDb[_0xb038('0x96')](_0x47e809,_0xb038('0x97'));rpcDb[_0xb038('0x98')](_0x47e809,_0xb038('0x97'));}}}}})[_0xb038('0x7b')](ut[_0xb038('0x8c')](_0xb038('0x99')));};Preview['prototype']['setMessage']=function(_0x24ea03){_0x24ea03[_0xb038('0x5f')]=!![];if(ut[_0xb038('0x9a')](_0x24ea03['loggedIn'])){_0x24ea03['message']=_0xb038('0x9b');}else if(!ut['isActive'](_0x24ea03[_0xb038('0x31')])){_0x24ea03['message']=_0xb038('0x61');}else if(!this['isTrunkReachable'](_0x24ea03[_0xb038('0x54')])){if(!this[_0xb038('0x9c')](_0x24ea03[_0xb038('0x9d')])){_0x24ea03[_0xb038('0x4d')]=_0xb038('0x9e');}else{_0x24ea03[_0xb038('0x4d')]='ACTIVE';}}else{_0x24ea03['message']=_0xb038('0x9f');}emitCampaignPreview(_0x24ea03);};Preview['prototype'][_0xb038('0xa0')]=function(_0x42f5dc,_0x2f4650,_0x538690){var _0x3071c8=this;var _0x5ea148=this[_0xb038('0x14')][_0x2f4650];var _0x218394=this[_0xb038('0x11')][_0x5ea148[_0xb038('0x70')]];var _0x40abb7;var _0x41b1d1=![];var _0x3e2b92=0x2;var _0x137d26=0x3;if(_0x218394){switch(_0x538690){case'1':_0x218394[_0xb038('0x3d')]+=0x1;_0x5ea148['countnosuchnumberretry']+=0x1;_0x5ea148['countglobal']=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x0,'NoSuchNumber');ami[_0xb038('0x24')]('custom:agentnosuchnumber',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xa2')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xa3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'0',_0x218394)[_0xb038('0x83')](function(_0x9440bc){_0x41b1d1=_0x9440bc[_0xb038('0xa5')]==0x1;_0x3e2b92=_0x218394[_0xb038('0xa6')];_0x137d26=_0x218394[_0xb038('0xa7')];if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xac'));}else{if(_0x5ea148[_0xb038('0xad')]>=_0x218394[_0xb038('0xae')]){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xad'),_0x218394[_0xb038('0xa6')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];}else{_0x5ea148[_0xb038('0xad')]++;logger[_0xb038('0x5b')](_0xb038('0xb3'),_0x5ea148[_0xb038('0xad')]);logger[_0xb038('0x5b')]('id',_0x5ea148[_0xb038('0xb4')]);_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148['idContact'],'field':{'countnosuchnumberretry':_0x5ea148['countnosuchnumberretry']}})[_0xb038('0x83')](function(){_0x3071c8['swapAdditionalPhones'](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case'ANSWER':var _0x5da505=moment()['format'](_0xb038('0x90'));_0x5ea148[_0xb038('0xb6')]=_0x5da505;_0x5ea148['answertime']=_0x5da505;_0x5ea148[_0xb038('0x73')]=!![];_0x218394[_0xb038('0x29')]+=0x1;logger[_0xb038('0x5b')](_0xb038('0xb7'),_0x5ea148[_0xb038('0xb8')],_0xb038('0xb9'),_0x218394[_0xb038('0x26')],_0xb038('0x72'),_0x218394[_0xb038('0x29')]);ami[_0xb038('0x24')]('custom:agentconnect',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xba'),this[_0xb038('0x11')][_0x5ea148[_0xb038('0x70')]]));if(_0x218394[_0xb038('0xbb')]){ami[_0xb038('0x24')](_0xb038('0xbc'),ut['buildAcw'](_0x5ea148));}break;case'16':ami[_0xb038('0x24')](_0xb038('0xbd'),ut[_0xb038('0xa1')](_0x5ea148,'complete',this['campaignsPreview'][_0x5ea148[_0xb038('0x70')]]));emitVoiceQueueChannelRemove(ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xbe')));_0x218394['outboundAnswerCallsDay']+=0x1;_0x218394[_0xb038('0x2d')]+=0x1;_0x218394[_0xb038('0x27')]+=0x1;ut['decrementTalkink'](_0x218394,_0xb038('0xbf'));_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x4,_0xb038('0xc1'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xc2'));rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xc3'));rpcDb[_0xb038('0xc4')](_0x5ea148);_0x218394[_0xb038('0x2a')]+=_0x5ea148[_0xb038('0xc5')];_0x218394[_0xb038('0xc6')]+=_0x5ea148[_0xb038('0xc5')];logger['info'](_0xb038('0xc7'),_0x5ea148[_0xb038('0xb8')],_0xb038('0xb9'),_0x218394[_0xb038('0x26')],_0xb038('0x72'),_0x218394[_0xb038('0x29')]);delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];break;case'BUSY':_0x218394[_0xb038('0x38')]+=0x1;_0x5ea148[_0xb038('0xc8')]+=0x1;_0x5ea148['countglobal']=ut[_0xb038('0xa8')](_0x5ea148);ut['logCustomer'](_0x5ea148,0x5,'Busy');_0x3e2b92=_0x218394[_0xb038('0xc9')];_0x137d26=_0x218394['callAdditionalPhoneAfterMin'];ami[_0xb038('0x24')]('custom:agentbusy',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xca')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xcb'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'5',_0x218394)[_0xb038('0x83')](function(_0x11b8db){_0x41b1d1=_0x11b8db[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xcc'));}else{if(_0x5ea148['countbusyretry']>=_0x218394[_0xb038('0xcd')]){rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xcb'));}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xc8'),_0x218394[_0xb038('0xc9')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148[_0xb038('0xce')]);}}}else{_0x5ea148[_0xb038('0xc8')]++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148['idContact'],'field':{'countbusyretry':_0x5ea148[_0xb038('0xc8')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xd0'):_0x218394[_0xb038('0x3c')]+=0x1;_0x5ea148[_0xb038('0xd1')]+=0x1;_0x5ea148['countglobal']=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x3,_0xb038('0xd2'));_0x3e2b92=_0x218394[_0xb038('0xd3')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')]('custom:agentnoanswer',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xd4')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xd5'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'3',_0x218394)[_0xb038('0x83')](function(_0x2532ed){_0x41b1d1=_0x2532ed[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xd6'));}else{if(_0x5ea148[_0xb038('0xd1')]>=_0x218394[_0xb038('0xd7')]){rpcDb['createCustomerFinal'](_0x5ea148,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xd1'),_0x218394['dialNoAnswerRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148[_0xb038('0xce')]);}}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148['idContact'],'field':{'countnoanswerretry':_0x5ea148['countnoanswerretry']}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(){});});}});break;case _0xb038('0xd8'):_0x218394[_0xb038('0x39')]+=0x1;_0x5ea148[_0xb038('0xd9')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x8,_0xb038('0xda'));_0x3e2b92=_0x218394[_0xb038('0xdb')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')](_0xb038('0xdc'),ut[_0xb038('0xa1')](_0x5ea148,'congestion'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xdd'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'8',_0x218394)['then'](function(_0x28e17e){_0x41b1d1=_0x28e17e['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5ea148['countcongestionretry']>=_0x218394['dialCongestionMaxRetry']){rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xdd'));}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,_0xb038('0xd9'),_0x218394['dialBusyRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148['countcongestionretry']++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countcongestionretry':_0x5ea148[_0xb038('0xd9')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xde'):_0x218394['outboundRejectCallsDay']+=0x1;_0x5ea148[_0xb038('0xdf')]+=0x1;_0x5ea148['countglobal']=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x14,_0xb038('0xe0'));_0x3e2b92=_0x218394[_0xb038('0xe1')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')](_0xb038('0xe2'),ut[_0xb038('0xa1')](_0x5ea148,'agentreject'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xe3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'20',_0x218394)[_0xb038('0x83')](function(_0xaa45fd){_0x41b1d1=_0xaa45fd['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0x14,_0xb038('0xe0'));rpcDb['createCustomerFinal'](_0x40abb7,_0xb038('0xe4'));}else{if(_0x5ea148[_0xb038('0xdf')]>=_0x218394['dialAgentRejectMaxRetry']){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,'countagentrejectretry',_0x218394['dialAgentRejectRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xe5'):_0x218394['outboundAbandonedCallsDay']+=0x1;_0x5ea148[_0xb038('0xe6')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut['totalGlobal'](_0x5ea148);ut['logCustomer'](_0x5ea148,0xb,'Abandoned');rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xe7'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'11',_0x218394)['then'](function(_0x9687eb){_0x41b1d1=_0x9687eb[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut['cloneAction'](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xe7'));}else{if(_0x5ea148['countabandonedetry']>=_0x218394[_0xb038('0xe8')]){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,'countabandonedretry',_0x218394[_0xb038('0xe9')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148['countnoanswerretry']++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case'18':_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xea')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x12,_0x42f5dc[_0xb038('0xeb')]||_0x42f5dc[_0xb038('0xec')]);ami[_0xb038('0x24')](_0xb038('0xed'),ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xee')));rpcDb[_0xb038('0x96')](_0x5ea148,'[callProgressDetectingCustomer][hangupInAMD]');_0x3071c8[_0xb038('0xa4')](_0x5ea148,'18',_0x218394)['then'](function(_0x567ae0){_0x41b1d1=_0x567ae0['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0x12,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xef'));}else{rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xef'));}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(){});});}});delete this[_0xb038('0x14')][_0x42f5dc['linkedid']];break;case'19':_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x13,_0x42f5dc['cause-txt']||_0x42f5dc[_0xb038('0xec')]);ami[_0xb038('0x24')](_0xb038('0xed'),ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xee')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xf0'));_0x3071c8['verifyAdditionalPhones'](_0x5ea148,'18',_0x218394)['then'](function(_0x3927c9){_0x41b1d1=_0x3927c9[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,'Global');rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xf0'));}else{rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xf0'));}}else{_0x5ea148['countnoanswerretry']++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8['swapAdditionalPhones'](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});delete this[_0xb038('0x14')][_0x42f5dc['linkedid']];break;default:if(_0x5ea148[_0xb038('0x73')]){ut['decrementTalkink'](_0x218394,_0xb038('0xf1'));ut[_0xb038('0x7f')](_0xb038('0xf2')+_0x218394[_0xb038('0x26')],_0x42f5dc);}_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0xc,_0x42f5dc[_0xb038('0xeb')]||_0x42f5dc[_0xb038('0xec')]);_0x3e2b92=_0x218394['dialAgentRejectRetryFrequency'];_0x137d26=_0x218394[_0xb038('0xa7')];rpcDb['createCustomerHistory'](_0x5ea148,_0xb038('0xf3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'20',_0x218394)[_0xb038('0x83')](function(_0x3a6168){_0x41b1d1=_0x3a6168['additional']==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xf4'));}else{rpcDb['createCustomerFinal'](_0x5ea148,_0xb038('0xf4'));}delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];}else{_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(_0x2efb3b){});}});}if(!(_0x5ea148['dialAnswer']&&_0x538690==='16')){ut[_0xb038('0x7d')](_0x218394,_0xb038('0xf5'));logger[_0xb038('0x5b')](_0xb038('0xf6'),_0x5ea148[_0xb038('0xb8')],'\x20Queue',_0x218394['name'],_0xb038('0x71'),_0x218394[_0xb038('0x4e')]);}if(_0x538690!=='ANSWER'){delete this['actions'][_0x42f5dc[_0xb038('0xb2')]];delete this['actions'][_0x42f5dc[_0xb038('0xf7')]];}}};Preview[_0xb038('0xc')]['callProgressDetectingAgent']=function(_0x2d3a9b,_0x43a956,_0x4db96a){if(_[_0xb038('0xf8')](_0x43a956)&&_0xb038('0xf9')!==typeof _0x43a956){return;}if(_[_0xb038('0xf8')](_0x4db96a)&&_0xb038('0xf9')!==typeof _0x4db96a){return;}switch(_0x4db96a[_0xb038('0xfa')]){case'0':ut[_0xb038('0xfb')](_0x2d3a9b,0x0,_0xb038('0xfc'));rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0xfe'));break;case'3':ut[_0xb038('0xfb')](_0x2d3a9b,0x3,'NoAnswer');rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0xff'));break;case'5':ut['logAgent'](_0x2d3a9b,0x5,'Busy');rpcDb['createAgentHistory'](_0x2d3a9b,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xb038('0xfb')](_0x2d3a9b,0x8,_0xb038('0xda'));rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0x100'));break;case'22':ut[_0xb038('0xfb')](_0x2d3a9b,0x16,_0xb038('0x101'));rpcDb['createAgentHistory'](_0x2d3a9b,_0xb038('0x102'));break;default:ut['logAgent'](_0x2d3a9b,0xc,_0x4db96a['reason']);rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0x100'));}ut[_0xb038('0x7d')](_0x43a956,_0xb038('0x103'));logger['info'](_0xb038('0x104'),_0x2d3a9b[_0xb038('0xb8')],_0xb038('0xb9'),_0x43a956['name'],_0xb038('0x71'),_0x43a956[_0xb038('0x4e')]);delete this['actions'][_0x2d3a9b['uniqueid']];};Preview[_0xb038('0xc')][_0xb038('0xa4')]=function(_0x4677ef,_0xf6c495,_0x212139){return BPromise[_0xb038('0x105')]()[_0xb038('0x83')](cmHopperAdditionalPhone[_0xb038('0xa4')](_0x4677ef,_0xf6c495,_0x212139))[_0xb038('0x7b')](logger[_0xb038('0x5b')]('[verifyAdditionalPhone]\x20'));};Preview[_0xb038('0xc')]['swapAdditionalPhones']=function(_0x2b7f91,_0xaab577,_0x4b32cc){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0xb038('0xcf')](_0x2b7f91,_0xaab577,_0x4b32cc))[_0xb038('0x7b')](logger[_0xb038('0x5b')]('[swapAdditionalPhone]\x20'));};Preview[_0xb038('0xc')][_0xb038('0xb5')]=function(_0x317881){return BPromise[_0xb038('0x105')]()[_0xb038('0x83')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x317881))['catch'](logger[_0xb038('0x5b')]('[incrementPreviewCounters]\x20'));};Preview[_0xb038('0xc')][_0xb038('0x106')]=function(_0x3838c5,_0x564492,_0x1f11de,_0x71799e,_0x564acf){var _0x1f8535=this;return new BPromise(function(_0x43343f,_0x1e221f){if(_[_0xb038('0x84')](_0x564492)||_[_0xb038('0x84')](_0x564492[_0xb038('0x107')])||_[_0xb038('0x84')](_0x564492[_0xb038('0x108')])||_['isNil'](_0x564492['VoiceQueueId'])){_0x1e221f(ut[_0xb038('0x4d')](_0xb038('0x109'),_0x71799e,_0x564acf));return;}var _0x417a64=uuid['v4']();var _0x3d24a3=_0x1f8535[_0xb038('0x11')][_0x564492[_0xb038('0x6f')][_0xb038('0x26')]];var _0x3dfdd9=_0x1f11de?_0x1f8535['agents'][_0x1f11de]['id']:undefined;_0x1f8535[_0xb038('0x14')][_0x417a64]=new Action(_0x564492,_0x3d24a3,_0x417a64,_0x1f11de,_0x3dfdd9);var _0x2623d5=_0x1f8535['actions'][_0x417a64];_0x2623d5[_0xb038('0xb1')]=_0x71799e;_0x2623d5[_0xb038('0xce')]=_0x564acf;_0x2623d5[_0xb038('0x10a')]=_0x1f11de;if(_[_0xb038('0x10b')](_0x3838c5)){_0x1f8535[_0xb038('0x10c')](_0x2623d5,_0x3d24a3,_0x564492,_0x1f11de)[_0xb038('0x83')](function(_0x30477c){logger[_0xb038('0x5b')](_0xb038('0x10d'),'Queue:\x20'+_0x2623d5[_0xb038('0x70')]+_0xb038('0x10e')+_0x2623d5[_0xb038('0xb4')],JSON[_0xb038('0x58')](_0x30477c));ami[_0xb038('0x24')](_0xb038('0x10f'),ut[_0xb038('0xa1')](_0x2623d5,_0xb038('0x110'),_0x1f8535[_0xb038('0x11')][_0x2623d5[_0xb038('0x70')]]));_0x43343f(ut[_0xb038('0x4d')]('Calling'));})['catch'](function(_0x76e7d6){ut[_0xb038('0x65')]('[Preview][execCall][failure]',_0x76e7d6);_0x1e221f(ut[_0xb038('0x4d')](_0xb038('0x111'),_0x71799e,_0x564acf));});}else{_0x3d24a3[_0xb038('0x37')]+=0x1;ut['logBlacklist'](_0x2623d5);rpcDb['createHistory'](_0x2623d5,_0xb038('0x112'));delete _0x1f8535[_0xb038('0x14')][_0x417a64];_0x1e221f(ut['message']('Contact\x20in\x20black\x20List',_0x71799e,_0x564acf));}});};Preview[_0xb038('0xc')][_0xb038('0x9c')]=function(_0x146ee9){return!_[_0xb038('0x84')](_0x146ee9)&&!_[_0xb038('0x84')](_0x146ee9['name'])&&!_[_0xb038('0x84')](_0x146ee9[_0xb038('0x55')])&&_0x146ee9[_0xb038('0x55')]&&!_['isNil'](this[_0xb038('0x13')][util[_0xb038('0x59')]('SIP/%s',_0x146ee9[_0xb038('0x26')])])&&!_[_0xb038('0x84')](this[_0xb038('0x13')][util[_0xb038('0x59')]('SIP/%s',_0x146ee9['name'])]['status'])&&(this[_0xb038('0x13')][util['format'](_0xb038('0x113'),_0x146ee9[_0xb038('0x26')])][_0xb038('0x79')]===_0xb038('0x114')||this[_0xb038('0x13')][util[_0xb038('0x59')](_0xb038('0x113'),_0x146ee9[_0xb038('0x26')])]['status']===_0xb038('0x115'));};Preview[_0xb038('0xc')][_0xb038('0x8b')]=function(_0x4af33a,_0x4bbc45){var _0x87d5c7=this;return new BPromise(function(_0x1e4c7f,_0x2b241f){_0x87d5c7[_0xb038('0x116')](_0x4af33a,_0x4bbc45)['then'](function(_0x2c74d6){_0x1e4c7f(_[_0xb038('0x74')](_0x2c74d6,[_0xb038('0x4d')]));})['catch'](function(_0x4a7bc4){if(_0x4a7bc4[_0xb038('0x117')]){rpcDb[_0xb038('0x118')](_0x4af33a);}if(_0x4a7bc4[_0xb038('0x55')]){rpcDb[_0xb038('0x8e')](_0x4af33a);}_0x2b241f(_[_0xb038('0x74')](_0x4a7bc4,['message']));});});};Preview[_0xb038('0xc')]['execRun']=function(_0xfa8336,_0x4a4570){var _0x489ee6=this;return new BPromise(function(_0x7c841a,_0x12eec4){var _0xcc4f24,_0x4f1755;rpcDb[_0xb038('0x119')](_0xfa8336)['then'](function(_0x5590df){if(!_['isNil'](_0x5590df[0x0])){_0x4f1755=_0x5590df[0x0][_0xb038('0x11a')]?![]:!![];_0xcc4f24=_0x5590df[0x0]['recallme']?!![]:![];_0xcc4f24=_0x4a4570?!![]:_0xcc4f24;}var _0x1da10e=_0x489ee6[_0xb038('0x11b')](_0x5590df);if(_0x1da10e[_0xb038('0x11c')]){rpcDb[_0xb038('0x11d')](_['pick'](_0x5590df[0x0],[_0xb038('0x77'),'phone']))[_0xb038('0x83')](function(_0x7a693d){_0x489ee6[_0xb038('0x106')](_0x7a693d,_0x5590df[0x0],_0x4a4570,_0x4f1755,_0xcc4f24)[_0xb038('0x83')](function(_0x120845){_0x7c841a(_0x120845);})[_0xb038('0x7b')](function(_0x54f188){_0x12eec4(_0x54f188);});})[_0xb038('0x7b')](function(_0x7049d2){ut[_0xb038('0x65')](_0xb038('0x11e'),_0x7049d2);_0x12eec4(ut[_0xb038('0x4d')]('Call\x20unsuccessful',_0x4f1755,_0xcc4f24));});}else{_0x12eec4(ut[_0xb038('0x4d')](_0x1da10e[_0xb038('0x4d')],_0x4f1755,_0xcc4f24));}})[_0xb038('0x7b')](function(_0x1b1750){ut['logger'](_0xb038('0x11f'),_0x1b1750);_0x12eec4(ut[_0xb038('0x4d')](_0xb038('0x120'),![],!![]));});});};Preview[_0xb038('0xc')][_0xb038('0x11b')]=function(_0x1f19f8){if(_[_0xb038('0x84')](_0x1f19f8)||_[_0xb038('0x10b')](_0x1f19f8)||!_['isNil'](_0x1f19f8[0x0][_0xb038('0x89')])&&_[_0xb038('0x84')](_0x1f19f8[0x0]['Agent']['name'])){ut[_0xb038('0x65')](_0xb038('0x121'),_0x1f19f8);return{'isValid':![],'message':_0xb038('0x122')};}var _0x2584d6=this[_0xb038('0x11')][_0x1f19f8[0x0]['Queue'][_0xb038('0x26')]];_0x2584d6[_0xb038('0x4d')]=_0xb038('0x9f');if(_[_0xb038('0x84')](_0x2584d6)){ut[_0xb038('0x65')](_0xb038('0x123'),_0x2584d6);return{'isValid':![],'message':_0xb038('0x124')};}if(!this[_0xb038('0x9c')](_0x2584d6[_0xb038('0x54')])){ut[_0xb038('0x65')](_0xb038('0x125'),_0xb038('0x126')+_0x2584d6['name']+_0xb038('0x127'));if(!this['isTrunkReachable'](_0x2584d6[_0xb038('0x9d')])){ut['logger'](_0xb038('0x125'),_0x2584d6[_0xb038('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xb038('0x128')};}}if(!ut['isActive'](_0x2584d6[_0xb038('0x31')])){ut['logger'](_0xb038('0x129'),_0x2584d6[_0xb038('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xb038('0x126')+_0x2584d6[_0xb038('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xb038('0x10c')]=function(_0x5b4c49,_0x48cf7a,_0x3c486c,_0x53c8ec){var _0x4be442=this;return new BPromise(function(_0x5371b9,_0x3db5c4){var _0x2f64bc=_0x5b4c49[_0xb038('0xb8')];var _0x29403e=_0x4be442[_0xb038('0x9c')](_0x48cf7a[_0xb038('0x54')])?util[_0xb038('0x59')](_0xb038('0x12a'),_0x48cf7a['Trunk'][_0xb038('0x26')],_[_0xb038('0x84')](_0x48cf7a[_0xb038('0x35')])?'':_0x48cf7a['dialPrefix'][_0xb038('0x12b')]()||'',_0x48cf7a[_0xb038('0x12c')]>0x0?_0x3c486c[_0xb038('0x108')][_0xb038('0x12d')](_0x48cf7a['dialCutDigit']):_0x3c486c['phone']):util[_0xb038('0x59')](_0xb038('0x12a'),_['isNil'](_0x48cf7a['TrunkBackup'])?_0x48cf7a[_0xb038('0x54')]['name']:_0x48cf7a[_0xb038('0x9d')][_0xb038('0x26')],_[_0xb038('0x84')](_0x48cf7a['dialPrefix'])?'':_0x48cf7a[_0xb038('0x35')][_0xb038('0x12b')]()||'',_0x48cf7a['dialCutDigit']>0x0?_0x3c486c[_0xb038('0x108')][_0xb038('0x12d')](_0x48cf7a[_0xb038('0x12c')]):_0x3c486c[_0xb038('0x108')]);var _0x253215=_0x4be442[_0xb038('0x9c')](_0x48cf7a[_0xb038('0x54')])?ut[_0xb038('0x12e')](_0x48cf7a['Trunk'][_0xb038('0x56')],_0x48cf7a[_0xb038('0x12f')],_0x48cf7a[_0xb038('0x130')]>0x0?ut[_0xb038('0x131')](_0x48cf7a[_0xb038('0x33')],_0x48cf7a[_0xb038('0x130')]):_0x48cf7a[_0xb038('0x33')]):ut[_0xb038('0x12e')](_[_0xb038('0x84')](_0x48cf7a['TrunkBackup'])?_0x48cf7a[_0xb038('0x54')][_0xb038('0x56')]:_0x48cf7a[_0xb038('0x9d')][_0xb038('0x56')],_0x48cf7a[_0xb038('0x12f')],_0x48cf7a[_0xb038('0x130')]>0x0?ut['getCallerIdRandom'](_0x48cf7a['dialOriginateCallerIdNumber'],_0x48cf7a[_0xb038('0x130')]):_0x48cf7a['dialOriginateCallerIdNumber']);if(_0x253215){_0x5b4c49[_0xb038('0x132')]=ut[_0xb038('0x133')](_0x253215);_0x5b4c49[_0xb038('0x134')]=ut[_0xb038('0x135')](_0x253215);}var _0x59801f=ut['addVariables'](_0x48cf7a,_0x3c486c,_0x29403e,_0x253215,_0x2f64bc,_0x5b4c49);_['merge'](_0x5b4c49,ut[_0xb038('0x136')](_0x59801f));_0x5b4c49[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));ami[_0xb038('0x78')](ut[_0xb038('0x137')](_0x5b4c49,_0x48cf7a,_0x59801f,_0x5b4c49['activeContact'],_0x53c8ec))[_0xb038('0x83')](function(_0x48e14f){_0x48cf7a[_0xb038('0x4e')]+=0x1;logger['info'](_0xb038('0x138'),_0x2f64bc,_0xb038('0xb9'),_0x48cf7a['name'],_0xb038('0x71'),_0x48cf7a[_0xb038('0x4e')]);_0x5371b9(_0x48e14f);})[_0xb038('0x7b')](function(_0x37a25d){ut[_0xb038('0xfb')](_0x5b4c49,0xe,_0xb038('0x139'));rpcDb[_0xb038('0xfd')](_0x5b4c49,_0xb038('0x13a'));_0x3db5c4(_0x37a25d);});});};Preview['prototype']['syncNewExten']=function(_0x4dfe77){if(this['actions'][_0x4dfe77[_0xb038('0xb2')]]){this['actions'][_0x4dfe77[_0xb038('0xb2')]]['channel']=_0x4dfe77[_0xb038('0x7a')];}};Preview[_0xb038('0xc')][_0xb038('0x18')]=function(_0xed23a9){var _0x1cf562=this;var _0x48863a=this['actions'][_0xed23a9[_0xb038('0x13b')]];if(_0x48863a){if(_0x48863a[_0xb038('0x10a')]&&this[_0xb038('0x15')][_0x48863a['lookAgent']]){ut[_0xb038('0x13c')](_0x48863a,this[_0xb038('0x15')][_0x48863a['lookAgent']][_0xb038('0x26')],this[_0xb038('0x15')][_0x48863a['lookAgent']]['id']);}var _0x1f0896=_[_0xb038('0x13d')](_0x48863a);_0x1f0896[_0xb038('0xb6')]=moment()[_0xb038('0x59')](_0xb038('0x90'));var _0x4eb901=_0x1cf562[_0xb038('0x11')][_0x48863a[_0xb038('0x70')]];if(ut['isFailure'](_0xed23a9[_0xb038('0x13e')])){if(_0x48863a['unlockAgent']){rpcDb['unlockContact'](_0x48863a[_0xb038('0xb4')]);}if(_0x48863a[_0xb038('0xce')]){rpcDb[_0xb038('0x8e')](_0x48863a[_0xb038('0xb4')]);}ami[_0xb038('0x24')](_0xb038('0x13f'),ut[_0xb038('0xa1')](_0x48863a,_0xb038('0x140'),this[_0xb038('0x11')][_0x48863a[_0xb038('0x70')]]));this[_0xb038('0x141')](_0x1f0896,_0x4eb901,_0xed23a9);}else{_0x48863a[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));ut[_0xb038('0xfb')](_0x1f0896,0x4,'Answer');rpcDb['createAgentHistory'](_0x1f0896,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xb038('0xc')][_0xb038('0x1a')]=function(_0x263aee){var _0x42faf6=this;var _0x444219=this[_0xb038('0x14')][_0x263aee[_0xb038('0xb2')]];var _0x43c55f;if(_0x444219){_0x43c55f=this[_0xb038('0x11')][_0x444219[_0xb038('0x70')]];logger['info'](_0xb038('0x142'),_0x263aee[_0xb038('0xb2')],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],'pTalking:\x20',_0x43c55f[_0xb038('0x29')]);}if(this[_0xb038('0x14')][_0x263aee['linkedid']]&&_0x263aee[_0xb038('0xb2')]!==_0x263aee[_0xb038('0xb8')]){if(_0x263aee[_0xb038('0x143')]==='16'&&this['actions'][_0x263aee['linkedid']]['dialAnswer']){this[_0xb038('0xa0')](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}else if(this[_0xb038('0x14')][_0x263aee[_0xb038('0xb2')]][_0xb038('0x73')]){logger['info'](_0xb038('0x144'),_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')],'\x20Queue',_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this[_0xb038('0xa0')](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}}else if(_0x444219&&_[_0xb038('0x84')](_0x444219[_0xb038('0x145')])&&_0x43c55f[_0xb038('0x146')]&&_0x263aee[_0xb038('0xb2')]===_0x263aee['uniqueid']&&_[_0xb038('0x84')](_0x263aee[_0xb038('0xfa')])&&_0x263aee[_0xb038('0x143')]==='16'&&_0x263aee['channelstate']==='6'&&_[_0xb038('0xf8')](_0x444219['transfer'])){if(_0x444219[_0xb038('0xb1')]){rpcDb[_0xb038('0x118')](_0x444219[_0xb038('0xb4')]);}if(_0x444219[_0xb038('0xce')]){rpcDb['disableContact'](_0x444219[_0xb038('0xb4')]);}_0x263aee['reason']='22';this[_0xb038('0x141')](_0x444219,_0x43c55f,_0x263aee);}else if(_0x444219&&_0x444219[_0xb038('0x147')]){if(_0x263aee[_0xb038('0x143')]==='16'&&this[_0xb038('0x14')][_0x263aee['linkedid']]['dialAnswer']){logger[_0xb038('0x5b')](_0xb038('0x148'),_0x263aee[_0xb038('0xb2')],_0x263aee['cause'],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this['callProgressDetectingCustomer'](_0x263aee,_0x263aee['linkedid'],_0x263aee[_0xb038('0x143')]);}else if(this['actions'][_0x263aee[_0xb038('0xb2')]][_0xb038('0x73')]){logger[_0xb038('0x5b')](_0xb038('0x144'),_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this['callProgressDetectingCustomer'](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}}};Preview['prototype']['syncDialEnd']=function(_0x161579){if(this[_0xb038('0x14')][_0x161579[_0xb038('0xf7')]]&&_0x161579[_0xb038('0xf7')]!==_0x161579[_0xb038('0x149')]){this['callProgressDetectingCustomer'](_0x161579,_0x161579['destlinkedid'],_0x161579[_0xb038('0xec')]);}};Preview[_0xb038('0xc')][_0xb038('0x1c')]=function(_0x586d75){if(this[_0xb038('0x14')][_0x586d75['linkedid']]&&_0x586d75[_0xb038('0xb2')]!==_0x586d75[_0xb038('0xb8')]&&!this[_0xb038('0x14')][_0x586d75['linkedid']]['dialAnswer']){if(_0x586d75[_0xb038('0x143')]==='1'){this['callProgressDetectingCustomer'](_0x586d75,_0x586d75[_0xb038('0xb2')],_0x586d75[_0xb038('0x143')]);}}};Preview[_0xb038('0xc')][_0xb038('0x14a')]=function(_0x2fdecb,_0x20f0a6,_0x31e08c){if(this[_0xb038('0x14')][_0x2fdecb]){if(_[_0xb038('0x84')](this['actions'][_0x2fdecb]['variables'])){this[_0xb038('0x14')][_0x2fdecb][_0xb038('0x14b')]={};}this[_0xb038('0x14')][_0x2fdecb][_0xb038('0x14b')][_0x20f0a6]=_0x31e08c;}};Preview[_0xb038('0xc')][_0xb038('0x14c')]=function(_0x1174b8){try{if(!_[_0xb038('0x84')](_0x1174b8)){if(ut[_0xb038('0x14d')](_['keys'](_0x1174b8[_0xb038('0x14e')])[0x0])){this[_0xb038('0x14a')](_0x1174b8[_0xb038('0xb8')],_[_0xb038('0x14f')](_0x1174b8['variable'])[0x0],_0x1174b8[_0xb038('0x150')]);}}}catch(_0x192d55){logger[_0xb038('0x151')]('[syncVarSet][Preview]',util[_0xb038('0x152')](_0x192d55,{'showHidden':![],'depth':null}));}};Preview[_0xb038('0xc')][_0xb038('0x21')]=function(_0x1f61a5){if(_0x1f61a5){if(this['actions'][_0x1f61a5[_0xb038('0x153')]]){this['actions'][_0x1f61a5[_0xb038('0x153')]][_0xb038('0x147')]=!![];}}};Preview['prototype'][_0xb038('0x22')]=function(_0xe47dc1){if(_0xe47dc1){if(this[_0xb038('0x14')][_0xe47dc1[_0xb038('0x154')]]){this['actions'][_0xe47dc1[_0xb038('0x154')]][_0xb038('0x147')]=!![];}}};module[_0xb038('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 013be7e..cd3387f 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 _0x53bd=['xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip'];(function(_0x2a2c58,_0x413b1a){var _0x5a4ac0=function(_0x445b80){while(--_0x445b80){_0x2a2c58['push'](_0x2a2c58['shift']());}};_0x5a4ac0(++_0x413b1a);}(_0x53bd,0x1ca));var _0xd53b=function(_0x41b358,_0x563481){_0x41b358=_0x41b358-0x0;var _0x153ba6=_0x53bd[_0x41b358];return _0x153ba6;};'use strict';var util=require('util');var BPromise=require(_0xd53b('0x0'));var logger=require(_0xd53b('0x1'))(_0xd53b('0x2'));var _=require(_0xd53b('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xd53b('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd53b('0x5'));var agentReportPreview=require(_0xd53b('0x6'));var voiceQueueReport=require(_0xd53b('0x7'));function loggerCatch(_0x28c30b){return function(_0x299553){logger['error'](_0x28c30b,util[_0xd53b('0x8')](_0x299553,{'showHidden':![],'depth':null}));};}function create(_0x214cfc){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopperHistory[_0xd53b('0xb')](_0x214cfc))[_0xd53b('0xc')](loggerCatch(_0xd53b('0xd')));}function createAgent(_0x2a9af){return BPromise[_0xd53b('0x9')]()['then'](agentReportPreview[_0xd53b('0xb')](_0x2a9af))[_0xd53b('0xc')](loggerCatch(_0xd53b('0xd')));}function moveContact(_0x159c12){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper[_0xd53b('0xe')](_0x159c12,!![]))[_0xd53b('0xc')](loggerCatch(_0xd53b('0xf')));}exports[_0xd53b('0x10')]=function(_0x2de655){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopperBlack[_0xd53b('0x10')](_0x2de655))[_0xd53b('0xc')](loggerCatch(_0xd53b('0x11')));};exports['getContactPreview']=function(_0x1659cb){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper['getContactPreview'](_0x1659cb))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xd53b('0xb')]=function(_0x543ce8,_0x2474c8){create(_0x543ce8)['catch'](loggerCatch(_0x2474c8));moveContact(_0x543ce8)['catch'](loggerCatch(_0x2474c8));};exports[_0xd53b('0x12')]=function(_0x519d2f,_0x458766){createAgent(_0x519d2f)[_0xd53b('0xc')](loggerCatch(_0x458766));};exports[_0xd53b('0x13')]=function(_0x5208c7,_0x12909c){create(_0x5208c7)['catch'](loggerCatch(_0x12909c));};exports['createCustomerFinal']=function(_0x1ccbcf,_0x1cd48){moveContact(_0x1ccbcf)['catch'](loggerCatch(_0x1cd48));};exports[_0xd53b('0x14')]=function(_0x3e8dd2,_0x2b3467,_0x55cb20){if(_0x2b3467){_0x3e8dd2[_0xd53b('0x15')]=null;}if(_0x55cb20){_0x3e8dd2[_0xd53b('0x16')]=![];}return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper[_0xd53b('0x14')](_0x3e8dd2))['catch'](loggerCatch(_0xd53b('0x17')));};exports['countReScheduled']=function(_0x1a1f5d){return BPromise['resolve']()['then'](cmHopper[_0xd53b('0x18')](_0x1a1f5d))['catch'](loggerCatch(_0xd53b('0x19')));};exports[_0xd53b('0x1a')]=function(_0x433075){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper[_0xd53b('0x1a')]({'UserId':null},_0x433075,0x1))[_0xd53b('0xc')](loggerCatch(_0xd53b('0x1b')));};exports['disableContact']=function(_0x5339c4){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper[_0xd53b('0x1a')]({'active':![]},_0x5339c4,0x1))[_0xd53b('0xc')](loggerCatch(_0xd53b('0x1c')));};exports[_0xd53b('0x1d')]=function(_0x147e0b){var _0x5ca82c={};_0x5ca82c[_0xd53b('0x1e')]=_0x147e0b[_0xd53b('0x1e')];_0x5ca82c['uniqueid']=_0x147e0b['uniqueid'];_0x5ca82c[_0xd53b('0x1f')]=_0x147e0b[_0xd53b('0x1f')];_0x5ca82c[_0xd53b('0x20')]=_0x147e0b['calleridname'];_0x5ca82c['queue']=_0x147e0b[_0xd53b('0x21')];_0x5ca82c['queuecallerjoinAt']=_0x147e0b[_0xd53b('0x22')];_0x5ca82c['queuecallerleaveAt']=_0x147e0b[_0xd53b('0x22')];_0x5ca82c[_0xd53b('0x23')]=0x1;_0x5ca82c[_0xd53b('0x24')]=_0x147e0b[_0xd53b('0x25')];_0x5ca82c[_0xd53b('0x26')]=_0x147e0b[_0xd53b('0x27')];_0x5ca82c[_0xd53b('0x28')]=_0xd53b('0x29');_0x5ca82c['exten']=_0xd53b('0x2a');_0x5ca82c[_0xd53b('0x2b')]=0x0;_0x5ca82c['assigned']=0x1;_0x5ca82c['lastAssignedTo']=_0x147e0b[_0xd53b('0x27')];_0x5ca82c[_0xd53b('0x2c')]=_0xd53b('0x2d');return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](voiceQueueReport['create'](_0x5ca82c))[_0xd53b('0xc')](loggerCatch(_0xd53b('0x2e')));};exports[_0xd53b('0x2f')]=function(_0x1c66be,_0x1b1a23){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper['getContactRecallMe'](_0x1c66be,_0x1b1a23))[_0xd53b('0xc')](loggerCatch(_0xd53b('0x30')));};exports[_0xd53b('0x31')]=function(_0xf8a0c7){return BPromise[_0xd53b('0x9')]()[_0xd53b('0xa')](cmHopper[_0xd53b('0x14')](_0xf8a0c7,!![],!![]))[_0xd53b('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x8074=['lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x2d7eca,_0x18f317){var _0xa9299d=function(_0x352ccd){while(--_0x352ccd){_0x2d7eca['push'](_0x2d7eca['shift']());}};_0xa9299d(++_0x18f317);}(_0x8074,0x134));var _0x4807=function(_0x5cfd0d,_0x542eee){_0x5cfd0d=_0x5cfd0d-0x0;var _0x28b9af=_0x8074[_0x5cfd0d];return _0x28b9af;};'use strict';var util=require(_0x4807('0x0'));var BPromise=require(_0x4807('0x1'));var logger=require(_0x4807('0x2'))(_0x4807('0x3'));var _=require(_0x4807('0x4'));var cmHopper=require(_0x4807('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4807('0x6'));var voiceQueueRt=require(_0x4807('0x7'));var agentReportPreview=require(_0x4807('0x8'));var voiceQueueReport=require(_0x4807('0x9'));function loggerCatch(_0x236df2){return function(_0x83c7e5){logger[_0x4807('0xa')](_0x236df2,util['inspect'](_0x83c7e5,{'showHidden':![],'depth':null}));};}function create(_0x27e8e0){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopperHistory['createHistory'](_0x27e8e0))[_0x4807('0xd')](loggerCatch(_0x4807('0xe')));}function createAgent(_0xcf6519){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](agentReportPreview[_0x4807('0xf')](_0xcf6519))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x42daa8){return BPromise['resolve']()[_0x4807('0xc')](cmHopper[_0x4807('0x10')](_0x42daa8,!![]))[_0x4807('0xd')](loggerCatch(_0x4807('0x11')));}exports[_0x4807('0x12')]=function(_0x3a399e){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopperBlack[_0x4807('0x12')](_0x3a399e))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x4807('0x13')]=function(_0x26138b){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x13')](_0x26138b))[_0x4807('0xd')](loggerCatch(_0x4807('0x14')));};exports[_0x4807('0xf')]=function(_0x5ea473,_0x4e5647){create(_0x5ea473)[_0x4807('0xd')](loggerCatch(_0x4e5647));moveContact(_0x5ea473)[_0x4807('0xd')](loggerCatch(_0x4e5647));};exports[_0x4807('0x15')]=function(_0x391214,_0x2de021){createAgent(_0x391214)[_0x4807('0xd')](loggerCatch(_0x2de021));};exports[_0x4807('0x16')]=function(_0x478777,_0x1ada09){create(_0x478777)[_0x4807('0xd')](loggerCatch(_0x1ada09));};exports['createCustomerFinal']=function(_0x389c1c,_0x3c5ae7){moveContact(_0x389c1c)[_0x4807('0xd')](loggerCatch(_0x3c5ae7));};exports['rescheduleContact']=function(_0x444aab,_0x22f898,_0x31cef4){if(_0x22f898){_0x444aab['UserId']=null;}if(_0x31cef4){_0x444aab[_0x4807('0x17')]=![];}return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper['rescheduleContact'](_0x444aab))[_0x4807('0xd')](loggerCatch(_0x4807('0x18')));};exports['countReScheduled']=function(_0x426004){return BPromise[_0x4807('0xb')]()['then'](cmHopper['countReScheduled'](_0x426004))[_0x4807('0xd')](loggerCatch(_0x4807('0x19')));};exports['unlockContact']=function(_0x46eaa6){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x1a')]({'UserId':null},_0x46eaa6,0x1))[_0x4807('0xd')](loggerCatch(_0x4807('0x1b')));};exports['disableContact']=function(_0x66b1d){return BPromise['resolve']()[_0x4807('0xc')](cmHopper['unlockContact']({'active':![]},_0x66b1d,0x1))['catch'](loggerCatch(_0x4807('0x1c')));};exports[_0x4807('0x1d')]=function(_0x446497){var _0xbbda3d={};_0xbbda3d[_0x4807('0x1e')]=_0x446497[_0x4807('0x1e')];_0xbbda3d['uniqueid']=_0x446497['uniqueid'];_0xbbda3d[_0x4807('0x1f')]=_0x446497[_0x4807('0x1f')];_0xbbda3d[_0x4807('0x20')]=_0x446497[_0x4807('0x20')];_0xbbda3d[_0x4807('0x21')]=_0x446497[_0x4807('0x21')];_0xbbda3d[_0x4807('0x22')]=_0x446497[_0x4807('0x23')];_0xbbda3d[_0x4807('0x24')]=_0x446497[_0x4807('0x23')];_0xbbda3d['queuecallercomplete']=0x1;_0xbbda3d[_0x4807('0x25')]=_0x446497['endtime'];_0xbbda3d[_0x4807('0x26')]=_0x446497['membername'];_0xbbda3d[_0x4807('0x27')]='from-sip';_0xbbda3d[_0x4807('0x28')]='xcally-motion-preview';_0xbbda3d[_0x4807('0x29')]=0x0;_0xbbda3d[_0x4807('0x2a')]=0x1;_0xbbda3d[_0x4807('0x2b')]=_0x446497[_0x4807('0x2c')];_0xbbda3d[_0x4807('0x2d')]=_0x4807('0x2e');return BPromise['resolve']()[_0x4807('0xc')](voiceQueueReport[_0x4807('0x2f')](_0xbbda3d))[_0x4807('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x4807('0x30')]=function(_0x5bd077,_0x45eb24){return BPromise['resolve']()[_0x4807('0xc')](cmHopper[_0x4807('0x30')](_0x5bd077,_0x45eb24))['catch'](loggerCatch(_0x4807('0x31')));};exports['rescheduleContactInQueue']=function(_0x3a9400){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x32')](_0x3a9400,!![],!![]))[_0x4807('0xd')](loggerCatch(_0x4807('0x33')));}; \ 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 db68e95..f0cdf4b 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 _0x90ad=['xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','XMD-','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','logAgent','ringtime','starttime','membername','UserId','state','endtime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter'];(function(_0x45e5d4,_0x6e6e3c){var _0x4a8fc2=function(_0x58c6f7){while(--_0x58c6f7){_0x45e5d4['push'](_0x45e5d4['shift']());}};_0x4a8fc2(++_0x6e6e3c);}(_0x90ad,0x9c));var _0xd90a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x90ad[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0xd90a('0x0'));var _=require(_0xd90a('0x1'));var moment=require('moment');var logger=require(_0xd90a('0x2'))(_0xd90a('0x3'));var ipAgi=process[_0xd90a('0x4')]['XCALLY_IP_AGI']||_0xd90a('0x5');function getSeconds(_0x318499,_0x58967d){var _0xb618ac=moment(_0x318499)['milliseconds'](0x0);var _0x18c0cd=moment(_0x58967d)[_0xd90a('0x6')](0x0);return _0xb618ac[_0xd90a('0x7')](_0x18c0cd,_0xd90a('0x8'));}exports[_0xd90a('0x9')]=function(_0x1090fe){return function(_0x5ccb29){logger[_0xd90a('0xa')](_0x1090fe,util['inspect'](_0x5ccb29,{'showHidden':![],'depth':null}));};};exports[_0xd90a('0xb')]=function(_0x39c2ae,_0x82e722){logger[_0xd90a('0xc')](_0x39c2ae,util[_0xd90a('0xd')](_0x82e722,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4f193a,_0x1c8321){logger[_0xd90a('0xa')](_0x4f193a,util[_0xd90a('0xd')](_0x1c8321,{'showHidden':![],'depth':null}));};exports[_0xd90a('0xe')]=function(_0x4b4835){return function(_0x515db6){logger[_0xd90a('0xc')](_0x4b4835,util[_0xd90a('0xd')](_0x515db6,{'showHidden':![],'depth':null}));};};exports[_0xd90a('0xf')]=function(_0x2a3576,_0x242ebb,_0x1898c2){return{'message':_0x2a3576,'unlock':_0x242ebb,'active':_0x1898c2};};exports[_0xd90a('0x10')]=function(_0x248f4d,_0x3d912d,_0x1d741d){if(!_['isUndefined'](_0x1d741d)&&_0xd90a('0x11')===typeof _0x1d741d&&!_[_0xd90a('0x12')](_0x1d741d)){if(!_[_0xd90a('0x13')](_0x3d912d)&&_0xd90a('0x11')===typeof _0x3d912d&&!_[_0xd90a('0x12')](_0x3d912d)){return util[_0xd90a('0x14')](_0xd90a('0x15'),_0x3d912d,_0x1d741d);}return util['format'](_0xd90a('0x15'),_0x1d741d,_0x1d741d);}if(!_[_0xd90a('0x13')](_0x248f4d)&&_0xd90a('0x11')===typeof _0x248f4d&&!_[_0xd90a('0x12')](_0x248f4d)){return _0x248f4d;}return _0xd90a('0x16');};exports['isActive']=function(_0x187215){if(_[_0xd90a('0x17')](_0x187215)){return![];}return _0x187215;};exports[_0xd90a('0x18')]=function(_0x5c817f,_0x2d37a5,_0x19e350,_0x411e30,_0x56dc06,_0x49735e){var _0x3cefce={'XMD-QUEUE':_0x2d37a5[_0xd90a('0x19')]?_0x2d37a5['Queue']['name']:'','XMD-CALLERID':_0x411e30,'XMD-CALLERID-PREVIEW':_0x49735e?util[_0xd90a('0x14')](_0xd90a('0x15'),_0x49735e['calleridname'],_0x49735e['calleridnum']):_0x411e30,'XMD-DIALID':_0x56dc06,'XMD-CONTACTID':_0x2d37a5[_0xd90a('0x1a')],'XMD-CDRTYPE':_0xd90a('0x1b'),'CALLERID(all)':_0x411e30,'XMD-VOICEQUEUEID':_0x2d37a5[_0xd90a('0x1c')],'XMD-DIALCHANNEL':_0x19e350,'XMD-DIALTIMEOUT':_0x5c817f[_0xd90a('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xd90a('0x14')](_0xd90a('0x1e'),_0x5c817f[_0xd90a('0x1f')]?'g':'',_[_0xd90a('0x12')](_0x5c817f[_0xd90a('0x20')])?'':_0xd90a('0x21')),'XMD-DIALURL':_0x5c817f['dialPreviewUrl']||'','XMD-AGI':_0x5c817f['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5c817f[_0xd90a('0x22')]):_0xd90a('0x23'),'XMD-AGIAFTER':_0x5c817f[_0xd90a('0x1f')]?util['format'](_0xd90a('0x24'),ipAgi,_0x5c817f[_0xd90a('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x49735e?_0x49735e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x49735e?_0x49735e['originatecalleridname']:'','XMD-DESTINATION':_0xd90a('0x25'),'SIPADDHEADER':_0xd90a('0x26')};if(!_[_0xd90a('0x12')](_0x5c817f[_0xd90a('0x20')])){_0x3cefce[util[_0xd90a('0x14')]('%s',_0xd90a('0x27'))]=_0x5c817f[_0xd90a('0x20')];_0x3cefce[util['format']('%s',_0xd90a('0x28'))]=_0x56dc06;}if(_0x2d37a5&&_0x2d37a5[_0xd90a('0x29')]){for(var _0x1a88a7 in _0x2d37a5[_0xd90a('0x29')]){if(_0x2d37a5[_0xd90a('0x29')][_0xd90a('0x2a')](_0x1a88a7)){if(!_[_0xd90a('0x17')](_0x2d37a5[_0xd90a('0x29')][_0x1a88a7])&&_0x1a88a7!=='id'&&_0x1a88a7!==_0xd90a('0x2b')&&_0x1a88a7!=='createdAt'&&_0x1a88a7!==_0xd90a('0x2c')){_0x3cefce[util[_0xd90a('0x14')]('%s%s',_0xd90a('0x2d'),_['toUpper'](_0x1a88a7))]=_0x2d37a5[_0xd90a('0x29')][_0x1a88a7];}}}}return _0x3cefce;};exports['toLowerVariables']=function(_0x471e1a){var _0x37f98a={};for(var _0x463356 in _0x471e1a){if(_0x471e1a[_0xd90a('0x2a')](_0x463356)){_0x37f98a[util[_0xd90a('0x14')]('%s',_[_0xd90a('0x2e')](_0x463356))]=_0x471e1a[_0x463356];}}return{'variables':_0x37f98a};};exports[_0xd90a('0x2f')]=function(_0x483c2b,_0x9ca11c){if(!_['isNil'](_0x483c2b)){if(_0x483c2b[_0xd90a('0x2a')]('originated')){if(_0x483c2b[_0xd90a('0x30')]>0x0){_0x483c2b[_0xd90a('0x30')]-=0x1;}else{logger[_0xd90a('0xa')](_0xd90a('0x31'),_0x9ca11c);}}}else{logger[_0xd90a('0xa')](_0xd90a('0x32'),_0x9ca11c);}};exports[_0xd90a('0x33')]=function(_0x842f0e){var _0x4e6984=moment()[_0xd90a('0x14')](_0xd90a('0x34'));_0x842f0e['state']=0xd;_0x842f0e[_0xd90a('0x35')]=_0xd90a('0x36');_0x842f0e['starttime']=_0x4e6984;_0x842f0e[_0xd90a('0x37')]=_0x4e6984;_0x842f0e['endtime']=_0x4e6984;};exports[_0xd90a('0x38')]=function(_0x16123c,_0x22e7cb,_0x1b72e8){var _0x13ea4e=moment()['format'](_0xd90a('0x34'));_0x16123c['state']=_0x22e7cb;_0x16123c[_0xd90a('0x35')]=_0x1b72e8;_0x16123c[_0xd90a('0x37')]=_0x13ea4e;_0x16123c[_0xd90a('0x39')]=getSeconds(_0x16123c[_0xd90a('0x37')],_0x16123c[_0xd90a('0x3a')]);};exports['logLookAgent']=function(_0x43c6ce,_0x101f93,_0x534ff5){_0x43c6ce[_0xd90a('0x3b')]=_0x101f93;_0x43c6ce[_0xd90a('0x3c')]=_0x534ff5;};exports['logCustomer']=function(_0x4f45f8,_0x34cb4f,_0x524dae){var _0xb957f6=moment()[_0xd90a('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f45f8[_0xd90a('0x3d')]=_0x34cb4f;_0x4f45f8[_0xd90a('0x35')]=_0x524dae;_0x4f45f8[_0xd90a('0x37')]=_0x4f45f8[_0xd90a('0x37')]?_0x4f45f8['responsetime']:_0xb957f6;_0x4f45f8[_0xd90a('0x3e')]=_0x4f45f8['endtime']?_0x4f45f8['endtime']:_0xb957f6;_0x4f45f8[_0xd90a('0x39')]=getSeconds(_0x4f45f8[_0xd90a('0x37')]||0x0,_0x4f45f8[_0xd90a('0x3a')]||0x0);_0x4f45f8['talktime']=_0x4f45f8[_0xd90a('0x3f')]?getSeconds(_0x4f45f8[_0xd90a('0x3e')],_0x4f45f8[_0xd90a('0x3f')]):0x0;};exports[_0xd90a('0x40')]=function(_0x4de9eb){return _0x4de9eb==='Failure';};exports[_0xd90a('0x41')]=function(_0x3c7010,_0x4f9551,_0x338291,_0x1964f8,_0x1873e9){var _0x25f49c=_0x1964f8?_0xd90a('0x42'):_0x3c7010[_0xd90a('0x43')];_0x25f49c=_0x1873e9?_0xd90a('0x44'):_0x25f49c;return{'actionid':_0x3c7010[_0xd90a('0x45')],'action':_0xd90a('0x46'),'channel':_0x3c7010[_0xd90a('0x47')],'callerid':util[_0xd90a('0x14')]('\x22%s\x22\x20<%s>',_0x25f49c,_0x3c7010[_0xd90a('0x48')]),'Exten':_0xd90a('0x25'),'Context':_0xd90a('0x49'),'Priority':'1','variable':_0x338291,'timeout':(_0x4f9551[_0xd90a('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c7010['uniqueid']};};exports[_0xd90a('0x4b')]=function(_0x268c7a){return _0x268c7a[_0xd90a('0x4c')]+_0x268c7a[_0xd90a('0x4d')]+_0x268c7a['countnoanswerretry']+_0x268c7a[_0xd90a('0x4e')]+_0x268c7a[_0xd90a('0x4f')];};exports[_0xd90a('0x50')]=function(_0x29e5bf){var _0x441ac6=_[_0xd90a('0x51')](_0x29e5bf);_0x441ac6['state']=0xf;_0x441ac6[_0xd90a('0x35')]=_0xd90a('0x52');return _0x441ac6;};exports['scheduledAt']=function(_0x18e1f5,_0x324cef,_0x475f48){var _0x6ab568={};_0x6ab568[_0x324cef]=_0x18e1f5[_0x324cef];_0x6ab568[_0xd90a('0x53')]=![];_0x6ab568[_0xd90a('0x54')]=moment()[_0xd90a('0x55')](_0x475f48,_0xd90a('0x56'))[_0xd90a('0x14')](_0xd90a('0x34'));_0x6ab568['ContactId']=_0x18e1f5['ContactId'];_0x6ab568['ListId']=_0x18e1f5[_0xd90a('0x57')];_0x6ab568[_0xd90a('0x1c')]=_0x18e1f5[_0xd90a('0x1c')]||undefined;return _0x6ab568;};exports[_0xd90a('0x58')]=function(_0x224c60,_0x647dc0){if(!_[_0xd90a('0x17')](_0x224c60)){if(_0x224c60[_0xd90a('0x59')]>0x0){_0x224c60[_0xd90a('0x59')]-=0x1;}else{logger['error'](_0x647dc0,_0xd90a('0x5a'));}}else{logger[_0xd90a('0xa')](_0x647dc0,_0xd90a('0x5b'));}};exports['IsNotLoggedIn']=function(_0x180092){if(_0x180092<=0x0){return!![];}return![];};exports['buildObj']=function(_0x522de5,_0x2fbc2e,_0x2926cb){_0x522de5[_0xd90a('0x5c')]=_0x2fbc2e;_0x522de5[_0xd90a('0x5d')]=_0x522de5[_0xd90a('0x5e')];_0x522de5[_0xd90a('0x5f')]=_0x522de5[_0xd90a('0x47')];_0x522de5[_0xd90a('0x60')]=_0xd90a('0x61');if(_0x2926cb){_0x522de5[_0xd90a('0x62')]=_0x2926cb[_0xd90a('0x62')];}return _0x522de5;};exports[_0xd90a('0x63')]=function(_0x57cb8a){var _0x2191e0={};_0x2191e0[_0xd90a('0x5e')]=_0x57cb8a[_0xd90a('0x5e')];_0x2191e0[_0xd90a('0x5f')]=_0x57cb8a[_0xd90a('0x47')];_0x2191e0[_0xd90a('0x45')]=_0x57cb8a[_0xd90a('0x45')];return _0x2191e0;};exports[_0xd90a('0x64')]=function(_0x58d413){var _0x55c92f=[];for(var _0x2daa63 in _0x58d413){if(_0x58d413[_0xd90a('0x2a')](_0x2daa63)){if(!_[_0xd90a('0x17')](_0x58d413[_0x2daa63])&&_0x58d413[_0x2daa63][_0xd90a('0x3d')]===_0xd90a('0x65')&&_0x58d413[_0x2daa63][_0xd90a('0x66')]==='reachable'){_0x55c92f[_0xd90a('0x67')](_0x58d413[_0x2daa63]['id']);}}}return _0x55c92f;};exports[_0xd90a('0x68')]=function(_0x4996d6){var _0x300158=moment()[_0xd90a('0x6')](0x0);var _0x385e81=moment(_0x4996d6)[_0xd90a('0x6')](0x0);return _0x300158[_0xd90a('0x7')](_0x385e81,_0xd90a('0x8'));};exports[_0xd90a('0x69')]=function(_0x486cab){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x486cab['ContactId'],'ListId':_0x486cab['ListId'],'VoiceQueueId':_0x486cab[_0xd90a('0x1c')]||undefined,'CampaignId':_0x486cab[_0xd90a('0x6a')]||undefined};};exports[_0xd90a('0x6b')]=function(_0x409943){if(_0x409943===_0xd90a('0x45')||_0x409943==='idContact'||_0x409943===_0xd90a('0x5e')||_0x409943===_0xd90a('0x6c')||_0x409943===_0xd90a('0x6d')||_0x409943===_0xd90a('0x6e')||_0x409943===_0xd90a('0x3b')||_0x409943===_0xd90a('0x47')||_0x409943==='calleridname'||_0x409943==='active'||_0x409943==='calleridnum'||_0x409943===_0xd90a('0x54')||_0x409943===_0xd90a('0x4c')||_0x409943==='countcongestionretry'||_0x409943==='countnoanswerretry'||_0x409943===_0xd90a('0x6f')||_0x409943===_0xd90a('0x70')||_0x409943===_0xd90a('0x71')||_0x409943===_0xd90a('0x72')||_0x409943===_0xd90a('0x73')||_0x409943===_0xd90a('0x1a')||_0x409943===_0xd90a('0x57')||_0x409943===_0xd90a('0x3c')||_0x409943===_0xd90a('0x1c')||_0x409943==='sipcallid'||_0x409943===_0xd90a('0x74')||_0x409943===_0xd90a('0x75')||_0x409943===_0xd90a('0x76')||_0x409943==='xmd-listid'||_0x409943==='xmd-dialurl'||_0x409943===_0xd90a('0x77')||_0x409943===_0xd90a('0x78')||_0x409943===_0xd90a('0x79')||_0x409943===_0xd90a('0x7a')||_0x409943===_0xd90a('0x7b')||_0x409943==='xmd-cdrtype'||_0x409943===_0xd90a('0x7c')||_0x409943===_0xd90a('0x7d')||_0x409943===_0xd90a('0x7e')||_0x409943===_0xd90a('0x7f')||_0x409943===_0xd90a('0x80')||_0x409943===_0xd90a('0x81')||_0x409943==='rtpaudioqosjitterbridged'||_0x409943===_0xd90a('0x82')||_0x409943===_0xd90a('0x83')||_0x409943===_0xd90a('0x84')||_0x409943===_0xd90a('0x85')||_0x409943===_0xd90a('0x7f')||_0x409943==='rtpaudioqosbridged'||_0x409943==='rtpaudioqosjitter'||_0x409943==='rtpaudioqosjitterbridged'||_0x409943===_0xd90a('0x82')||_0x409943===_0xd90a('0x83')||_0x409943===_0xd90a('0x84')||_0x409943==='rtpaudioqosrttbridged'||_0x409943==='bridgepeer'||_0x409943===_0xd90a('0x86')||_0x409943===_0xd90a('0x3d')||_0x409943===_0xd90a('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x30a5c9,_0xa07c7b){var _0x58548e,_0x3650ed,_0x134742;if(_0xa07c7b<=0x0){_0xa07c7b=0x1;}_0x58548e=new RegExp(_0xd90a('0x87')+_0xa07c7b+'}$');_0x3650ed=Math['pow'](0xa,_0xa07c7b-0x1);_0x134742=Math[_0xd90a('0x88')](0xa,_0xa07c7b)-0x1;return util[_0xd90a('0x14')]('%s',_[_0xd90a('0x89')](_0x30a5c9,_0x58548e,_[_0xd90a('0x8a')](_0x3650ed,_0x134742)));};exports['extractCalleridName']=function(_0x182cd3){var _0xb75222=_0x182cd3['match'](/"(.*?)"/);return _0xb75222?_0xb75222[0x1]:_0x182cd3;};exports[_0xd90a('0x8b')]=function(_0x304a16){var _0x2de41c=_0x304a16[_0xd90a('0x8c')](/<(.*?)>/);return _0x2de41c?_0x2de41c[0x1]:_0x304a16;}; \ No newline at end of file +var _0x1c6f=['isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','logCustomer','talktime','answertime','isFailure','RECALL','originate','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','channelAgent','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countbusyretry','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','lodash','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x1c6f,0x7e));var _0xf1c6=function(_0xf9e7d6,_0x466010){_0xf9e7d6=_0xf9e7d6-0x0;var _0x20ed5c=_0x1c6f[_0xf9e7d6];return _0x20ed5c;};'use strict';var util=require(_0xf1c6('0x0'));var _=require(_0xf1c6('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xf1c6('0x2')][_0xf1c6('0x3')]||_0xf1c6('0x4');function getSeconds(_0x16f438,_0x36f91c){var _0x192fae=moment(_0x16f438)[_0xf1c6('0x5')](0x0);var _0x5ec014=moment(_0x36f91c)[_0xf1c6('0x5')](0x0);return _0x192fae[_0xf1c6('0x6')](_0x5ec014,_0xf1c6('0x7'));}exports[_0xf1c6('0x8')]=function(_0x143515){return function(_0x59e8a4){logger[_0xf1c6('0x9')](_0x143515,util['inspect'](_0x59e8a4,{'showHidden':![],'depth':null}));};};exports[_0xf1c6('0xa')]=function(_0x5a38ac,_0x4e1834){logger[_0xf1c6('0xb')](_0x5a38ac,util[_0xf1c6('0xc')](_0x4e1834,{'showHidden':![],'depth':null}));};exports[_0xf1c6('0xd')]=function(_0xd0a7f3,_0x1bda81){logger['error'](_0xd0a7f3,util[_0xf1c6('0xc')](_0x1bda81,{'showHidden':![],'depth':null}));};exports[_0xf1c6('0xe')]=function(_0x20d345){return function(_0x5c60ee){logger['info'](_0x20d345,util['inspect'](_0x5c60ee,{'showHidden':![],'depth':null}));};};exports[_0xf1c6('0xf')]=function(_0x219002,_0x36e021,_0x4eb99e){return{'message':_0x219002,'unlock':_0x36e021,'active':_0x4eb99e};};exports['getCallerId']=function(_0x465419,_0x259bf2,_0x3ca60b){if(!_[_0xf1c6('0x10')](_0x3ca60b)&&_0xf1c6('0x11')===typeof _0x3ca60b&&!_[_0xf1c6('0x12')](_0x3ca60b)){if(!_[_0xf1c6('0x10')](_0x259bf2)&&_0xf1c6('0x11')===typeof _0x259bf2&&!_[_0xf1c6('0x12')](_0x259bf2)){return util[_0xf1c6('0x13')](_0xf1c6('0x14'),_0x259bf2,_0x3ca60b);}return util[_0xf1c6('0x13')]('\x22%s\x22\x20<%s>',_0x3ca60b,_0x3ca60b);}if(!_[_0xf1c6('0x10')](_0x465419)&&_0xf1c6('0x11')===typeof _0x465419&&!_[_0xf1c6('0x12')](_0x465419)){return _0x465419;}return _0xf1c6('0x15');};exports['isActive']=function(_0x4bb74e){if(_['isNil'](_0x4bb74e)){return![];}return _0x4bb74e;};exports[_0xf1c6('0x16')]=function(_0x27fc75,_0xd072a3,_0x37ab4d,_0xe235d0,_0x19b266,_0x1509a6){var _0x35cd3c={'XMD-QUEUE':_0xd072a3['Queue']?_0xd072a3[_0xf1c6('0x17')][_0xf1c6('0x18')]:'','XMD-CALLERID':_0xe235d0,'XMD-CALLERID-PREVIEW':_0x1509a6?util[_0xf1c6('0x13')](_0xf1c6('0x14'),_0x1509a6[_0xf1c6('0x19')],_0x1509a6[_0xf1c6('0x1a')]):_0xe235d0,'XMD-DIALID':_0x19b266,'XMD-CONTACTID':_0xd072a3[_0xf1c6('0x1b')],'XMD-CDRTYPE':_0xf1c6('0x1c'),'CALLERID(all)':_0xe235d0,'XMD-VOICEQUEUEID':_0xd072a3[_0xf1c6('0x1d')],'XMD-DIALCHANNEL':_0x37ab4d,'XMD-DIALTIMEOUT':_0x27fc75[_0xf1c6('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xf1c6('0x13')](_0xf1c6('0x1f'),_0x27fc75[_0xf1c6('0x20')]?'g':'',_[_0xf1c6('0x12')](_0x27fc75[_0xf1c6('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x27fc75[_0xf1c6('0x22')]||'','XMD-AGI':_0x27fc75[_0xf1c6('0x23')]?util[_0xf1c6('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27fc75[_0xf1c6('0x23')]):_0xf1c6('0x24'),'XMD-AGIAFTER':_0x27fc75['dialQueueProject2']?util[_0xf1c6('0x13')](_0xf1c6('0x25'),ipAgi,_0x27fc75[_0xf1c6('0x20')]):_0xf1c6('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x1509a6?_0x1509a6[_0xf1c6('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1509a6?_0x1509a6[_0xf1c6('0x27')]:'','XMD-DESTINATION':_0xf1c6('0x28'),'SIPADDHEADER':_0xf1c6('0x29')};if(!_['isEmpty'](_0x27fc75[_0xf1c6('0x21')])){_0x35cd3c[util[_0xf1c6('0x13')]('%s',_0xf1c6('0x2a'))]=_0x27fc75[_0xf1c6('0x21')];_0x35cd3c[util[_0xf1c6('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x19b266;}if(_0xd072a3&&_0xd072a3[_0xf1c6('0x2b')]){for(var _0x157948 in _0xd072a3['Contact']){if(_0xd072a3[_0xf1c6('0x2b')][_0xf1c6('0x2c')](_0x157948)){if(!_[_0xf1c6('0x2d')](_0xd072a3[_0xf1c6('0x2b')][_0x157948])&&_0x157948!=='id'&&_0x157948!==_0xf1c6('0x2e')&&_0x157948!=='createdAt'&&_0x157948!==_0xf1c6('0x2f')){_0x35cd3c[util[_0xf1c6('0x13')]('%s%s',_0xf1c6('0x30'),_[_0xf1c6('0x31')](_0x157948))]=_0xd072a3[_0xf1c6('0x2b')][_0x157948];}}}}return _0x35cd3c;};exports[_0xf1c6('0x32')]=function(_0x25e56b){var _0x5ef358={};for(var _0x389c37 in _0x25e56b){if(_0x25e56b[_0xf1c6('0x2c')](_0x389c37)){_0x5ef358[util[_0xf1c6('0x13')]('%s',_[_0xf1c6('0x33')](_0x389c37))]=_0x25e56b[_0x389c37];}}return{'variables':_0x5ef358};};exports[_0xf1c6('0x34')]=function(_0x3af91c,_0x2993e3){if(!_[_0xf1c6('0x2d')](_0x3af91c)){if(_0x3af91c[_0xf1c6('0x2c')](_0xf1c6('0x35'))){if(_0x3af91c[_0xf1c6('0x35')]>0x0){_0x3af91c[_0xf1c6('0x35')]-=0x1;}else{logger[_0xf1c6('0x9')](_0xf1c6('0x36'),_0x2993e3);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2993e3);}};exports[_0xf1c6('0x37')]=function(_0x2b5081){var _0x29e4a4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b5081[_0xf1c6('0x38')]=0xd;_0x2b5081[_0xf1c6('0x39')]=_0xf1c6('0x3a');_0x2b5081[_0xf1c6('0x3b')]=_0x29e4a4;_0x2b5081[_0xf1c6('0x3c')]=_0x29e4a4;_0x2b5081[_0xf1c6('0x3d')]=_0x29e4a4;};exports[_0xf1c6('0x3e')]=function(_0x1120ae,_0x426c01,_0x348f4c){var _0x4d7a42=moment()[_0xf1c6('0x13')](_0xf1c6('0x3f'));_0x1120ae[_0xf1c6('0x38')]=_0x426c01;_0x1120ae[_0xf1c6('0x39')]=_0x348f4c;_0x1120ae[_0xf1c6('0x3c')]=_0x4d7a42;_0x1120ae['ringtime']=getSeconds(_0x1120ae[_0xf1c6('0x3c')],_0x1120ae['starttime']);};exports[_0xf1c6('0x40')]=function(_0x4ccf80,_0x2fe44e,_0x234821){_0x4ccf80['membername']=_0x2fe44e;_0x4ccf80['UserId']=_0x234821;};exports[_0xf1c6('0x41')]=function(_0x1c3bdb,_0x549ee3,_0x17c011){var _0x5e7560=moment()[_0xf1c6('0x13')](_0xf1c6('0x3f'));_0x1c3bdb['state']=_0x549ee3;_0x1c3bdb['statedesc']=_0x17c011;_0x1c3bdb[_0xf1c6('0x3c')]=_0x1c3bdb['responsetime']?_0x1c3bdb[_0xf1c6('0x3c')]:_0x5e7560;_0x1c3bdb[_0xf1c6('0x3d')]=_0x1c3bdb[_0xf1c6('0x3d')]?_0x1c3bdb[_0xf1c6('0x3d')]:_0x5e7560;_0x1c3bdb['ringtime']=getSeconds(_0x1c3bdb[_0xf1c6('0x3c')]||0x0,_0x1c3bdb[_0xf1c6('0x3b')]||0x0);_0x1c3bdb[_0xf1c6('0x42')]=_0x1c3bdb[_0xf1c6('0x43')]?getSeconds(_0x1c3bdb['endtime'],_0x1c3bdb['answertime']):0x0;};exports[_0xf1c6('0x44')]=function(_0x1429c4){return _0x1429c4==='Failure';};exports['variablesAction']=function(_0x2ed2b8,_0x111da8,_0x24d026,_0x5e9494,_0x245fdc){var _0x511641=_0x5e9494?_0xf1c6('0x45'):_0x2ed2b8[_0xf1c6('0x19')];_0x511641=_0x245fdc?'BOOKED':_0x511641;return{'actionid':_0x2ed2b8['uniqueid'],'action':_0xf1c6('0x46'),'channel':_0x2ed2b8['channelAgent'],'callerid':util[_0xf1c6('0x13')]('\x22%s\x22\x20<%s>',_0x511641,_0x2ed2b8[_0xf1c6('0x1a')]),'Exten':'xcally-motion-preview','Context':_0xf1c6('0x47'),'Priority':'1','variable':_0x24d026,'timeout':(_0x111da8[_0xf1c6('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ed2b8[_0xf1c6('0x49')]};};exports[_0xf1c6('0x4a')]=function(_0x5205c2){return _0x5205c2['countbusyretry']+_0x5205c2[_0xf1c6('0x4b')]+_0x5205c2[_0xf1c6('0x4c')]+_0x5205c2['countagentrejectretry']+_0x5205c2['countnosuchnumberretry'];};exports[_0xf1c6('0x4d')]=function(_0xaf0bc7){var _0x31dfa8=_['clone'](_0xaf0bc7);_0x31dfa8['state']=0xf;_0x31dfa8[_0xf1c6('0x39')]=_0xf1c6('0x4e');return _0x31dfa8;};exports['scheduledAt']=function(_0x5252d4,_0x25c619,_0x4f9d05){var _0xff1efc={};_0xff1efc[_0x25c619]=_0x5252d4[_0x25c619];_0xff1efc[_0xf1c6('0x4f')]=![];_0xff1efc[_0xf1c6('0x50')]=moment()[_0xf1c6('0x51')](_0x4f9d05,_0xf1c6('0x52'))['format'](_0xf1c6('0x3f'));_0xff1efc[_0xf1c6('0x1b')]=_0x5252d4[_0xf1c6('0x1b')];_0xff1efc[_0xf1c6('0x53')]=_0x5252d4['ListId'];_0xff1efc[_0xf1c6('0x1d')]=_0x5252d4[_0xf1c6('0x1d')]||undefined;return _0xff1efc;};exports[_0xf1c6('0x54')]=function(_0x51d233,_0x58d89f){if(!_[_0xf1c6('0x2d')](_0x51d233)){if(_0x51d233['pTalking']>0x0){_0x51d233[_0xf1c6('0x55')]-=0x1;}else{logger['error'](_0x58d89f,_0xf1c6('0x56'));}}else{logger[_0xf1c6('0x9')](_0x58d89f,_0xf1c6('0x57'));}};exports[_0xf1c6('0x58')]=function(_0x32dda4){if(_0x32dda4<=0x0){return!![];}return![];};exports[_0xf1c6('0x59')]=function(_0x51e3f4,_0xd6f14f,_0x364b19){_0x51e3f4[_0xf1c6('0x5a')]=_0xd6f14f;_0x51e3f4[_0xf1c6('0x18')]=_0x51e3f4[_0xf1c6('0x5b')];_0x51e3f4[_0xf1c6('0x5c')]=_0x51e3f4['channelAgent'];_0x51e3f4['motionChannel']=_0xf1c6('0x5d');if(_0x364b19){_0x51e3f4[_0xf1c6('0x5e')]=_0x364b19['mandatoryDisposition'];}return _0x51e3f4;};exports[_0xf1c6('0x5f')]=function(_0xcc9022){var _0x4c6f3a={};_0x4c6f3a[_0xf1c6('0x5b')]=_0xcc9022['queue'];_0x4c6f3a[_0xf1c6('0x5c')]=_0xcc9022[_0xf1c6('0x60')];_0x4c6f3a[_0xf1c6('0x49')]=_0xcc9022[_0xf1c6('0x49')];return _0x4c6f3a;};exports[_0xf1c6('0x61')]=function(_0x43a72a){var _0x2e8a7c=[];for(var _0xf1590a in _0x43a72a){if(_0x43a72a[_0xf1c6('0x2c')](_0xf1590a)){if(!_[_0xf1c6('0x2d')](_0x43a72a[_0xf1590a])&&_0x43a72a[_0xf1590a]['state']===_0xf1c6('0x62')&&_0x43a72a[_0xf1590a][_0xf1c6('0x63')]==='reachable'){_0x2e8a7c[_0xf1c6('0x64')](_0x43a72a[_0xf1590a]['id']);}}}return _0x2e8a7c;};exports[_0xf1c6('0x65')]=function(_0x37d3f3){var _0x544eb4=moment()[_0xf1c6('0x5')](0x0);var _0x4ccd37=moment(_0x37d3f3)[_0xf1c6('0x5')](0x0);return _0x544eb4['diff'](_0x4ccd37,_0xf1c6('0x7'));};exports[_0xf1c6('0x66')]=function(_0xa4e8f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa4e8f[_0xf1c6('0x1b')],'ListId':_0xa4e8f[_0xf1c6('0x53')],'VoiceQueueId':_0xa4e8f[_0xf1c6('0x1d')]||undefined,'CampaignId':_0xa4e8f[_0xf1c6('0x67')]||undefined};};exports[_0xf1c6('0x68')]=function(_0x1ffbcd){if(_0x1ffbcd===_0xf1c6('0x49')||_0x1ffbcd===_0xf1c6('0x69')||_0x1ffbcd===_0xf1c6('0x5b')||_0x1ffbcd==='type'||_0x1ffbcd===_0xf1c6('0x6a')||_0x1ffbcd===_0xf1c6('0x6b')||_0x1ffbcd===_0xf1c6('0x6c')||_0x1ffbcd===_0xf1c6('0x60')||_0x1ffbcd===_0xf1c6('0x19')||_0x1ffbcd===_0xf1c6('0x4f')||_0x1ffbcd===_0xf1c6('0x1a')||_0x1ffbcd==='scheduledat'||_0x1ffbcd===_0xf1c6('0x6d')||_0x1ffbcd===_0xf1c6('0x4b')||_0x1ffbcd===_0xf1c6('0x4c')||_0x1ffbcd===_0xf1c6('0x6e')||_0x1ffbcd===_0xf1c6('0x6f')||_0x1ffbcd===_0xf1c6('0x70')||_0x1ffbcd==='callbackat'||_0x1ffbcd===_0xf1c6('0x71')||_0x1ffbcd===_0xf1c6('0x1b')||_0x1ffbcd===_0xf1c6('0x53')||_0x1ffbcd==='UserId'||_0x1ffbcd===_0xf1c6('0x1d')||_0x1ffbcd==='sipcallid'||_0x1ffbcd===_0xf1c6('0x72')||_0x1ffbcd===_0xf1c6('0x73')||_0x1ffbcd===_0xf1c6('0x74')||_0x1ffbcd===_0xf1c6('0x75')||_0x1ffbcd===_0xf1c6('0x76')||_0x1ffbcd===_0xf1c6('0x77')||_0x1ffbcd===_0xf1c6('0x78')||_0x1ffbcd===_0xf1c6('0x79')||_0x1ffbcd===_0xf1c6('0x7a')||_0x1ffbcd==='xmd-contactid'||_0x1ffbcd===_0xf1c6('0x7b')||_0x1ffbcd===_0xf1c6('0x7c')||_0x1ffbcd===_0xf1c6('0x7d')||_0x1ffbcd==='xmd-agi'||_0x1ffbcd===_0xf1c6('0x7e')||_0x1ffbcd==='rtpaudioqosbridged'||_0x1ffbcd===_0xf1c6('0x7f')||_0x1ffbcd===_0xf1c6('0x80')||_0x1ffbcd===_0xf1c6('0x81')||_0x1ffbcd===_0xf1c6('0x82')||_0x1ffbcd===_0xf1c6('0x83')||_0x1ffbcd===_0xf1c6('0x84')||_0x1ffbcd===_0xf1c6('0x7e')||_0x1ffbcd===_0xf1c6('0x85')||_0x1ffbcd==='rtpaudioqosjitter'||_0x1ffbcd==='rtpaudioqosjitterbridged'||_0x1ffbcd===_0xf1c6('0x81')||_0x1ffbcd===_0xf1c6('0x82')||_0x1ffbcd===_0xf1c6('0x83')||_0x1ffbcd===_0xf1c6('0x84')||_0x1ffbcd===_0xf1c6('0x86')||_0x1ffbcd===_0xf1c6('0x87')||_0x1ffbcd==='state'||_0x1ffbcd==='statedesc'){return![];}return!![];};exports[_0xf1c6('0x88')]=function(_0x22fdf7,_0x1d4f23){var _0x28754f,_0x3262ac,_0x13b241;if(_0x1d4f23<=0x0){_0x1d4f23=0x1;}_0x28754f=new RegExp('\x5cw{0,'+_0x1d4f23+'}$');_0x3262ac=Math[_0xf1c6('0x89')](0xa,_0x1d4f23-0x1);_0x13b241=Math[_0xf1c6('0x89')](0xa,_0x1d4f23)-0x1;return util[_0xf1c6('0x13')]('%s',_[_0xf1c6('0x8a')](_0x22fdf7,_0x28754f,_[_0xf1c6('0x8b')](_0x3262ac,_0x13b241)));};exports['extractCalleridName']=function(_0x332e7d){var _0x13b0c1=_0x332e7d[_0xf1c6('0x8c')](/"(.*?)"/);return _0x13b0c1?_0x13b0c1[0x1]:_0x332e7d;};exports[_0xf1c6('0x8d')]=function(_0x30c130){var _0x2313c1=_0x30c130[_0xf1c6('0x8c')](/<(.*?)>/);return _0x2313c1?_0x2313c1[0x1]:_0x30c130;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8731d32..bdc2e69 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 _0xe832=['voicequeuechannelredirect','queueadd','string','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0xe832,0xb5));var _0x2e83=function(_0x2451bd,_0xf7f322){_0x2451bd=_0x2451bd-0x0;var _0x4b0b20=_0xe832[_0x2451bd];return _0x4b0b20;};'use strict';exports[_0x2e83('0x0')]={'queue':{'type':_0x2e83('0x1'),'required':!![]},'interface':{'type':_0x2e83('0x1'),'required':!![]},'membername':{'type':_0x2e83('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x2e83('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x2e83('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x2e83('0x2')},'reason':{'type':_0x2e83('0x1'),'required':![]}};exports[_0x2e83('0x4')]={'module':{'type':_0x2e83('0x1'),'required':![]}};exports[_0x2e83('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2e83('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x2e83('0x1')},'mixmonitorid':{'type':_0x2e83('0x1')}};exports[_0x2e83('0x7')]={'uniqueid':{'type':_0x2e83('0x1'),'required':!![]}};exports[_0x2e83('0x8')]={'uniqueid':{'type':_0x2e83('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5825=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean'];(function(_0xfa1272,_0xf55d62){var _0x384905=function(_0x369669){while(--_0x369669){_0xfa1272['push'](_0xfa1272['shift']());}};_0x384905(++_0xf55d62);}(_0x5825,0x68));var _0x5582=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5825[_0x122ef9];return _0x42fba0;};'use strict';exports[_0x5582('0x0')]={'queue':{'type':_0x5582('0x1'),'required':!![]},'interface':{'type':_0x5582('0x1'),'required':!![]},'membername':{'type':_0x5582('0x1'),'required':!![]},'penalty':{'type':_0x5582('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x5582('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0x4')]={'interface':{'type':_0x5582('0x1'),'required':!![]},'paused':{'type':_0x5582('0x5')},'reason':{'type':_0x5582('0x1'),'required':![]}};exports[_0x5582('0x6')]={'module':{'type':_0x5582('0x1'),'required':![]}};exports[_0x5582('0x7')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0x8')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x5582('0x9')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x5582('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6f0ae7e..2a0ea6b 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 _0x3ffd=['isNil','interface','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','agents','isUndefined','mergeFromDatabase','initTelephones','length','initTrunks','initTriggers','initTemplates','templates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','merge','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ffd,0xb2));var _0xd3ff=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x3ffd[_0x59ee41];return _0x3ecd3e;};'use strict';var BPromise=require('bluebird');var util=require(_0xd3ff('0x0'));var _=require(_0xd3ff('0x1'));var moment=require(_0xd3ff('0x2'));var Agent=require(_0xd3ff('0x3'));var Telephone=require(_0xd3ff('0x4'));var Trunk=require(_0xd3ff('0x5'));var VoiceQueue=require(_0xd3ff('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xd3ff('0x7'));var Campaign=require(_0xd3ff('0x8'));var VoiceExtension=require(_0xd3ff('0x9'));var ZendeskAccount=require(_0xd3ff('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xd3ff('0xb'));var DeskAccount=require(_0xd3ff('0xc'));var VtigerAccount=require(_0xd3ff('0xd'));var ServicenowAccount=require(_0xd3ff('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xd3ff('0xf'));var FaxAccount=require(_0xd3ff('0x10'));var Realtime=function(){this['agents']={};this[_0xd3ff('0x11')]={};this[_0xd3ff('0x12')]={};this[_0xd3ff('0x13')]={};this[_0xd3ff('0x14')]={};this[_0xd3ff('0x15')]={};this['templates']={};this[_0xd3ff('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xd3ff('0x17')]={};this[_0xd3ff('0x18')]={};this[_0xd3ff('0x19')]={};this[_0xd3ff('0x1a')]={};this[_0xd3ff('0x1b')]={};this[_0xd3ff('0x1c')]={};this['salesforceAccounts']={};this[_0xd3ff('0x1d')]={};this[_0xd3ff('0x1e')]={};this[_0xd3ff('0x1f')]={};this[_0xd3ff('0x20')]={};this[_0xd3ff('0x21')]={};this[_0xd3ff('0x22')]={};this['dynamics365Accounts']={};this[_0xd3ff('0x23')]={};this[_0xd3ff('0x24')]={};};function freeIsNotKey(_0x1dd183,_0x5c7481,_0x5ef02f){var _0x4360bb=_['mapKeys'](_0x1dd183,function(_0x5488ae,_0x37f15e){return _0x5488ae[_0x5ef02f];});for(var _0x5879c9 in _0x5c7481){if(_0x5c7481[_0xd3ff('0x25')](_0x5879c9)){if(!_0x4360bb[_0x5879c9]){delete _0x5c7481[_0x5879c9];}}}}function freeIsNotKeySip(_0x2db4fb,_0x91af67){var _0x25c2a8=_[_0xd3ff('0x26')](_0x2db4fb,function(_0x403817,_0x3fa40c){return util[_0xd3ff('0x27')](_0xd3ff('0x28'),_0x403817[_0xd3ff('0x29')]);});for(var _0xfa34bf in _0x91af67){if(_0x91af67[_0xd3ff('0x25')](_0xfa34bf)){if(!_0x25c2a8[_0xfa34bf]){delete _0x91af67[_0xfa34bf];}}}}function freeIsNotKeyAgent(_0x46f67b,_0x5777fc){var _0xbbe03f=_[_0xd3ff('0x26')](_0x46f67b,function(_0x1d9af8,_0x3ac289){var _0x341f32=_[_0xd3ff('0x2a')](_0x1d9af8['interface'])?util[_0xd3ff('0x27')]('SIP/%s',_0x1d9af8[_0xd3ff('0x29')]):_0x1d9af8[_0xd3ff('0x2b')];return _0x341f32;});for(var _0x4e65ad in _0x5777fc){if(_0x5777fc[_0xd3ff('0x25')](_0x4e65ad)){if(!_0xbbe03f[_0x4e65ad]){delete _0x5777fc[_0x4e65ad];}}}}function clearVoiceCallReports(_0x4e183c){_0x4e183c[_0xd3ff('0x2c')]=0x0;_0x4e183c[_0xd3ff('0x2d')]=0x0;_0x4e183c['sumHoldTime']=0x0;_0x4e183c['sumDuration']=0x0;_0x4e183c[_0xd3ff('0x2e')]=0x0;}function clearCampaigns(_0x349c08){if(!_['isEmpty'](_0x349c08)){for(var _0x3b6141 in _0x349c08){if(_0x349c08[_0xd3ff('0x25')](_0x3b6141)){_0x349c08[_0x3b6141][_0xd3ff('0x2f')]=0x0;_0x349c08[_0x3b6141][_0xd3ff('0x30')]=0x0;}}}}function clearVoiceQueues(_0x6aa003){if(!_['isEmpty'](_0x6aa003)){for(var _0x1f0ffb in _0x6aa003){if(_0x6aa003[_0xd3ff('0x25')](_0x1f0ffb)){_0x6aa003[_0x1f0ffb][_0xd3ff('0x2c')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x2d')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x31')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x32')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x33')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x34')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x2e')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x35')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x36')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x37')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x38')]=0x0;_0x6aa003[_0x1f0ffb]['outboundNoSuchCallsDay']=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x39')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3a')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3b')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3c')]=0x0;_0x6aa003[_0x1f0ffb]['outboundOriginateFailureCallsDay']=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3d')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3e')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x35')]=0x0;_0x6aa003[_0x1f0ffb][_0xd3ff('0x3f')]=0x0;_0x6aa003[_0x1f0ffb]['queueStatusComplete']=!![];}}}}Realtime[_0xd3ff('0x40')]['mergeFromDatabase']=function(_0x44a4f2,_0x390890){for(var _0x252ac5 in _0x390890){if(_0x44a4f2['hasOwnProperty'](_0x252ac5)){_0x44a4f2[_0x252ac5]=_0x390890[_0x252ac5];}}};Realtime[_0xd3ff('0x40')][_0xd3ff('0x41')]=function(){var _0x4fc74a=this;return function(_0x4c4ab2){if(_0x4c4ab2){freeIsNotKeyAgent(_0x4c4ab2,_0x4fc74a[_0xd3ff('0x42')]);for(var _0x2b9642=0x0,_0x2edbad={},_0x227a23={};_0x2b9642<_0x4c4ab2['length'];_0x2b9642+=0x1){_0x2edbad=_0x4c4ab2[_0x2b9642];var _0x8af245=_['isNil'](_0x2edbad['interface'])?util[_0xd3ff('0x27')]('SIP/%s',_0x2edbad['name']):_0x2edbad['interface'];if(_[_0xd3ff('0x43')](_0x4fc74a[_0xd3ff('0x42')][_0x8af245])){_0x4fc74a[_0xd3ff('0x42')][_0x8af245]=new Agent(_0x2edbad);}else{_0x4fc74a[_0xd3ff('0x44')](_0x4fc74a[_0xd3ff('0x42')][_0x8af245],_0x2edbad);}}}return _0x4fc74a[_0xd3ff('0x42')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x45')]=function(){var _0x1b1be3=this;return function(_0x480d47){if(_0x480d47){freeIsNotKeySip(_0x480d47,_0x1b1be3['telephones']);for(var _0x5a1a25=0x0,_0x53497e={},_0x21a71a={};_0x5a1a25<_0x480d47[_0xd3ff('0x46')];_0x5a1a25+=0x1){_0x53497e=_0x480d47[_0x5a1a25];if(_[_0xd3ff('0x43')](_0x1b1be3[_0xd3ff('0x11')][util[_0xd3ff('0x27')]('SIP/%s',_0x53497e[_0xd3ff('0x29')])])){_0x1b1be3[_0xd3ff('0x11')][util[_0xd3ff('0x27')](_0xd3ff('0x28'),_0x53497e[_0xd3ff('0x29')])]=new Telephone(_0x53497e);}else{_0x1b1be3[_0xd3ff('0x44')](_0x1b1be3[_0xd3ff('0x11')][util[_0xd3ff('0x27')](_0xd3ff('0x28'),_0x53497e[_0xd3ff('0x29')])],_0x53497e);}}}return _0x1b1be3[_0xd3ff('0x11')];};};Realtime['prototype'][_0xd3ff('0x47')]=function(){var _0x2ca67f=this;return function(_0x5a2332){if(_0x5a2332){freeIsNotKeySip(_0x5a2332,_0x2ca67f['trunks']);for(var _0x1730a9=0x0,_0x1ab9de={},_0x3607e3={};_0x1730a9<_0x5a2332[_0xd3ff('0x46')];_0x1730a9+=0x1){_0x1ab9de=_0x5a2332[_0x1730a9];if(_['isUndefined'](_0x2ca67f['trunks'][util[_0xd3ff('0x27')](_0xd3ff('0x28'),_0x1ab9de[_0xd3ff('0x29')])])){_0x2ca67f[_0xd3ff('0x12')][util['format'](_0xd3ff('0x28'),_0x1ab9de[_0xd3ff('0x29')])]=new Trunk(_0x1ab9de);}else{_0x2ca67f[_0xd3ff('0x44')](_0x2ca67f[_0xd3ff('0x12')][util[_0xd3ff('0x27')]('SIP/%s',_0x1ab9de['name'])],_0x1ab9de);}}}return _0x2ca67f[_0xd3ff('0x12')];};};Realtime[_0xd3ff('0x40')]['initVoiceQueues']=function(){var _0x3232cd=this;return function(_0x57acc2){if(_0x57acc2){freeIsNotKey(_0x57acc2,_0x3232cd[_0xd3ff('0x13')],'name');for(var _0xe4e441=0x0,_0x5c48db={},_0xb2712d={};_0xe4e441<_0x57acc2['length'];_0xe4e441+=0x1){_0x5c48db=_0x57acc2[_0xe4e441];if(_[_0xd3ff('0x43')](_0x3232cd[_0xd3ff('0x13')][_0x5c48db[_0xd3ff('0x29')]])){_0x3232cd['voiceQueues'][_0x5c48db[_0xd3ff('0x29')]]=new VoiceQueue(_0x5c48db);}else{_0x3232cd[_0xd3ff('0x44')](_0x3232cd[_0xd3ff('0x13')][_0x5c48db[_0xd3ff('0x29')]],_0x5c48db);}}}return _0x3232cd[_0xd3ff('0x13')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x48')]=function(){var _0xeea581=this;return function(_0x18b99f){if(_0x18b99f){freeIsNotKey(_0x18b99f,_0xeea581[_0xd3ff('0x14')],'id');for(var _0xff861d=0x0,_0x1dbcc3={},_0x2a1974={};_0xff861d<_0x18b99f[_0xd3ff('0x46')];_0xff861d+=0x1){_0x1dbcc3=_0x18b99f[_0xff861d];if(_[_0xd3ff('0x43')](_0xeea581[_0xd3ff('0x14')][_0x1dbcc3['id']])){_0xeea581[_0xd3ff('0x14')][_0x1dbcc3['id']]=new Trigger(_0x1dbcc3);}else{_0xeea581['mergeFromDatabase'](_0xeea581[_0xd3ff('0x14')][_0x1dbcc3['id']],_0x1dbcc3);}}}return _0xeea581['triggers'];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x49')]=function(){var _0x429d04=this;return function(_0x300617){if(_0x300617){freeIsNotKey(_0x300617,_0x429d04[_0xd3ff('0x4a')],'id');for(var _0x50200b=0x0,_0x205976={},_0x216760={};_0x50200b<_0x300617[_0xd3ff('0x46')];_0x50200b+=0x1){_0x205976=_0x300617[_0x50200b];if(_['isUndefined'](_0x429d04[_0xd3ff('0x4a')][_0x205976['id']])){_0x429d04[_0xd3ff('0x4a')][_0x205976['id']]=new Template(_0x205976);}else{_0x429d04[_0xd3ff('0x44')](_0x429d04[_0xd3ff('0x4a')][_0x205976['id']],_0x205976);}}}return _0x429d04[_0xd3ff('0x4a')];};};Realtime[_0xd3ff('0x40')]['initZendeskAccounts']=function(){var _0x41e11b=this;return function(_0x58acdc){if(_0x58acdc){freeIsNotKey(_0x58acdc,_0x41e11b[_0xd3ff('0x1c')],'id');for(var _0x1b43e4=0x0,_0x43da2a={},_0xecf4ee={};_0x1b43e4<_0x58acdc[_0xd3ff('0x46')];_0x1b43e4+=0x1){_0x43da2a=_0x58acdc[_0x1b43e4];if(_[_0xd3ff('0x43')](_0x41e11b['zendeskAccounts'][_0x43da2a['id']])){_0x41e11b[_0xd3ff('0x1c')][_0x43da2a['id']]=new ZendeskAccount(_0x43da2a);}else{_0x41e11b['mergeFromDatabase'](_0x41e11b[_0xd3ff('0x1c')][_0x43da2a['id']],_0x43da2a);}}}return _0x41e11b[_0xd3ff('0x1c')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x4b')]=function(){var _0x32b2fa=this;return function(_0x27b01c){if(_0x27b01c){freeIsNotKey(_0x27b01c,_0x32b2fa[_0xd3ff('0x4c')],'id');for(var _0x43d364=0x0,_0x1c624d={},_0x40b649={};_0x43d364<_0x27b01c[_0xd3ff('0x46')];_0x43d364+=0x1){_0x1c624d=_0x27b01c[_0x43d364];if(_[_0xd3ff('0x43')](_0x32b2fa['salesforceAccounts'][_0x1c624d['id']])){_0x32b2fa[_0xd3ff('0x4c')][_0x1c624d['id']]=new SalesforceAccount(_0x1c624d);}else{_0x32b2fa[_0xd3ff('0x44')](_0x32b2fa[_0xd3ff('0x4c')][_0x1c624d['id']],_0x1c624d);}}}return _0x32b2fa[_0xd3ff('0x4c')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x4d')]=function(){var _0x5dda03=this;return function(_0xa910b6){if(_0xa910b6){freeIsNotKey(_0xa910b6,_0x5dda03[_0xd3ff('0x1e')],'id');for(var _0x4e0aee=0x0,_0x34b828={},_0x488423={};_0x4e0aee<_0xa910b6[_0xd3ff('0x46')];_0x4e0aee+=0x1){_0x34b828=_0xa910b6[_0x4e0aee];if(_[_0xd3ff('0x43')](_0x5dda03[_0xd3ff('0x1e')][_0x34b828['id']])){_0x5dda03[_0xd3ff('0x1e')][_0x34b828['id']]=new FreshdeskAccount(_0x34b828);}else{_0x5dda03[_0xd3ff('0x44')](_0x5dda03['freshdeskAccounts'][_0x34b828['id']],_0x34b828);}}}return _0x5dda03[_0xd3ff('0x1e')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x4e')]=function(){var _0x1149bb=this;return function(_0x2e03b8){if(_0x2e03b8){freeIsNotKey(_0x2e03b8,_0x1149bb[_0xd3ff('0x1f')],'id');for(var _0x3e5ed5=0x0,_0x46856e={},_0x2fb832={};_0x3e5ed5<_0x2e03b8['length'];_0x3e5ed5+=0x1){_0x46856e=_0x2e03b8[_0x3e5ed5];if(_[_0xd3ff('0x43')](_0x1149bb[_0xd3ff('0x1f')][_0x46856e['id']])){_0x1149bb[_0xd3ff('0x1f')][_0x46856e['id']]=new ZohoAccount(_0x46856e);}else{_0x1149bb[_0xd3ff('0x44')](_0x1149bb['zohoAccounts'][_0x46856e['id']],_0x46856e);}}}return _0x1149bb[_0xd3ff('0x1f')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x4f')]=function(){var _0x497e9b=this;return function(_0x28212c){if(_0x28212c){freeIsNotKey(_0x28212c,_0x497e9b['deskAccounts'],'id');for(var _0x14c899=0x0,_0x34d327={},_0x1cda90={};_0x14c899<_0x28212c[_0xd3ff('0x46')];_0x14c899+=0x1){_0x34d327=_0x28212c[_0x14c899];if(_[_0xd3ff('0x43')](_0x497e9b[_0xd3ff('0x20')][_0x34d327['id']])){_0x497e9b[_0xd3ff('0x20')][_0x34d327['id']]=new DeskAccount(_0x34d327);}else{_0x497e9b[_0xd3ff('0x44')](_0x497e9b[_0xd3ff('0x20')][_0x34d327['id']],_0x34d327);}}}return _0x497e9b['deskAccounts'];};};Realtime['prototype'][_0xd3ff('0x50')]=function(){var _0x25dd78=this;return function(_0x268c77){if(_0x268c77){freeIsNotKey(_0x268c77,_0x25dd78['sugarcrmAccounts'],'id');for(var _0x482a4c=0x0,_0x15393f={},_0x9c86c0={};_0x482a4c<_0x268c77['length'];_0x482a4c+=0x1){_0x15393f=_0x268c77[_0x482a4c];if(_[_0xd3ff('0x43')](_0x25dd78[_0xd3ff('0x1d')][_0x15393f['id']])){_0x25dd78[_0xd3ff('0x1d')][_0x15393f['id']]=new SugarcrmAccount(_0x15393f);}else{_0x25dd78[_0xd3ff('0x44')](_0x25dd78[_0xd3ff('0x1d')][_0x15393f['id']],_0x15393f);}}}return _0x25dd78['sugarcrmAccounts'];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x520368=this;return function(_0x29273b){if(_0x29273b){freeIsNotKey(_0x29273b,_0x520368[_0xd3ff('0x21')],'id');for(var _0x3493f6=0x0,_0x2804d4={},_0xa6159b={};_0x3493f6<_0x29273b[_0xd3ff('0x46')];_0x3493f6+=0x1){_0x2804d4=_0x29273b[_0x3493f6];if(_['isUndefined'](_0x520368[_0xd3ff('0x21')][_0x2804d4['id']])){_0x520368['vtigerAccounts'][_0x2804d4['id']]=new VtigerAccount(_0x2804d4);}else{_0x520368[_0xd3ff('0x44')](_0x520368['vtigerAccounts'][_0x2804d4['id']],_0x2804d4);}}}return _0x520368[_0xd3ff('0x21')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x51')]=function(){var _0x580ac4=this;return function(_0x36747c){if(_0x36747c){freeIsNotKey(_0x36747c,_0x580ac4[_0xd3ff('0x22')],'id');for(var _0x4552d0=0x0,_0x437287={},_0x3361d1={};_0x4552d0<_0x36747c[_0xd3ff('0x46')];_0x4552d0+=0x1){_0x437287=_0x36747c[_0x4552d0];if(_[_0xd3ff('0x43')](_0x580ac4[_0xd3ff('0x22')][_0x437287['id']])){_0x580ac4[_0xd3ff('0x22')][_0x437287['id']]=new ServicenowAccount(_0x437287);}else{_0x580ac4[_0xd3ff('0x44')](_0x580ac4[_0xd3ff('0x22')][_0x437287['id']],_0x437287);}}}return _0x580ac4[_0xd3ff('0x22')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x52')]=function(){var _0x1c37e6=this;return function(_0x4f0a80){if(_0x4f0a80){freeIsNotKey(_0x4f0a80,_0x1c37e6[_0xd3ff('0x53')],'id');for(var _0x195816=0x0,_0x596f9c={},_0x166d54={};_0x195816<_0x4f0a80[_0xd3ff('0x46')];_0x195816+=0x1){_0x596f9c=_0x4f0a80[_0x195816];if(_[_0xd3ff('0x43')](_0x1c37e6[_0xd3ff('0x53')][_0x596f9c['id']])){_0x1c37e6[_0xd3ff('0x53')][_0x596f9c['id']]=new Dynamics365Account(_0x596f9c);}else{_0x1c37e6[_0xd3ff('0x44')](_0x1c37e6[_0xd3ff('0x53')][_0x596f9c['id']],_0x596f9c);}}}return _0x1c37e6[_0xd3ff('0x53')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x54')]=function(){var _0x513d3a=this;return function(_0x4f3742){if(_0x4f3742){freeIsNotKey(_0x4f3742,_0x513d3a[_0xd3ff('0x23')],'id');for(var _0x5c3493=0x0,_0x393598={},_0x27554b={};_0x5c3493<_0x4f3742[_0xd3ff('0x46')];_0x5c3493+=0x1){_0x393598=_0x4f3742[_0x5c3493];if(_['isUndefined'](_0x513d3a[_0xd3ff('0x23')][_0x393598['id']])){_0x513d3a[_0xd3ff('0x23')][_0x393598['id']]=new FreshsalesAccount(_0x393598);}else{_0x513d3a['mergeFromDatabase'](_0x513d3a[_0xd3ff('0x23')][_0x393598['id']],_0x393598);}}}return _0x513d3a[_0xd3ff('0x23')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x55')]=function(){var _0x246027=this;return function(_0x3191d0){for(var _0x29f93e=0x0;_0x29f93e<_0x3191d0['length'];_0x29f93e+=0x1){_['merge'](_0x246027[_0xd3ff('0x13')][_0x3191d0[_0x29f93e][_0xd3ff('0x29')]],_0x3191d0[_0x29f93e]);}return _0x246027[_0xd3ff('0x13')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x56')]=function(){var _0xc2b040=this;return function(_0x45d7ac){clearVoiceQueues(_0xc2b040[_0xd3ff('0x13')]);if(_0x45d7ac){_0x45d7ac=_[_0xd3ff('0x57')](_0x45d7ac,_0xd3ff('0x58'));for(var _0x49a193 in _0x45d7ac){if(_0x45d7ac['hasOwnProperty'](_0x49a193)){var _0x5a2ea0={};for(var _0x18b7ff=0x0;_0x18b7ff<_0x45d7ac[_0x49a193][_0xd3ff('0x46')];_0x18b7ff+=0x1){var _0x41e864=_0x45d7ac[_0x49a193][_0x18b7ff]['queue'];if(_0xc2b040[_0xd3ff('0x13')][_0x41e864]){if(_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x59')]){_0xc2b040['voiceQueues'][_0x41e864][_0xd3ff('0x31')]+=0x1;}if(_0x45d7ac[_0x49a193][_0x18b7ff]['queuecallerabandon']){_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x32')]+=0x1;}_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x33')]+=moment(_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5a')])[_0xd3ff('0x5b')](moment(_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5c')]),'seconds')||0x0;if(_0x18b7ff===_0x45d7ac[_0x49a193][_0xd3ff('0x46')]-0x1){_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x34')]+=moment(_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5d')]||_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5e')]||_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5f')])[_0xd3ff('0x5b')](moment(_0x45d7ac[_0x49a193][_0x18b7ff]['queuecallerjoinAt']),_0xd3ff('0x60'))||0x0;_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x2c')]+=0x1;if(_0x45d7ac[_0x49a193][_0x18b7ff]['queuecallercomplete']){_0xc2b040[_0xd3ff('0x13')][_0x41e864]['answered']+=0x1;_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x2e')]+=moment(_0x45d7ac[_0x49a193][_0x18b7ff][_0xd3ff('0x5d')])[_0xd3ff('0x5b')](moment(_0x45d7ac[_0x49a193][_0x18b7ff]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0xc2b040[_0xd3ff('0x13')][_0x41e864]['sumDuration']+=_0xc2b040[_0xd3ff('0x13')][_0x41e864][_0xd3ff('0x33')]||0x0;}}}}}}return _0xc2b040[_0xd3ff('0x13')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x61')]=function(){var _0x588065=this;return function(_0x410497){clearVoiceCallReports(_0x588065['outbound']);if(_0x410497){for(var _0x3f1ff6=0x0;_0x3f1ff6<_0x410497[_0xd3ff('0x46')];_0x3f1ff6+=0x1){_0x588065[_0xd3ff('0x16')][_0xd3ff('0x2c')]+=0x1;_0x588065[_0xd3ff('0x16')][_0xd3ff('0x34')]+=_0x410497[_0x3f1ff6][_0xd3ff('0x62')];if(_0x410497[_0x3f1ff6][_0xd3ff('0x63')]===_0xd3ff('0x64')){_0x588065[_0xd3ff('0x16')]['answered']+=0x1;_0x588065[_0xd3ff('0x16')][_0xd3ff('0x33')]+=_0x410497[_0x3f1ff6][_0xd3ff('0x62')]-_0x410497[_0x3f1ff6][_0xd3ff('0x65')]||0x0;_0x588065[_0xd3ff('0x16')][_0xd3ff('0x2e')]+=_0x410497[_0x3f1ff6][_0xd3ff('0x65')];}}}return _0x588065[_0xd3ff('0x16')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x66')]=function(){var _0x5e26a5=this;return function(_0x49a16c){if(_0x49a16c){freeIsNotKey(_0x49a16c,_0x5e26a5[_0xd3ff('0x15')],_0xd3ff('0x29'));for(var _0xe113f3=0x0,_0x56e298={};_0xe113f3<_0x49a16c[_0xd3ff('0x46')];_0xe113f3+=0x1){_0x56e298=_0x49a16c[_0xe113f3];if(_[_0xd3ff('0x43')](_0x5e26a5[_0xd3ff('0x15')][_0x56e298[_0xd3ff('0x29')]])){_0x5e26a5[_0xd3ff('0x15')][_0x56e298['name']]=new Campaign(_0x56e298);}else{_0x5e26a5['mergeFromDatabase'](_0x5e26a5[_0xd3ff('0x15')][_0x56e298[_0xd3ff('0x29')]],_0x56e298);_0x5e26a5['campaigns'][_0x56e298[_0xd3ff('0x29')]][_0xd3ff('0x67')]=_0x56e298[_0xd3ff('0x68')]?_0x56e298[_0xd3ff('0x68')][_0xd3ff('0x29')]:undefined;}}}return _0x5e26a5[_0xd3ff('0x15')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x69')]=function(){var _0x49703b=this;return function(_0x3966fb){if(_0x3966fb){freeIsNotKey(_0x3966fb,_0x49703b[_0xd3ff('0x6a')],'id');for(var _0x22dee7=0x0,_0x24de25={};_0x22dee7<_0x3966fb[_0xd3ff('0x46')];_0x22dee7+=0x1){_0x24de25=_0x3966fb[_0x22dee7];if(_[_0xd3ff('0x43')](_0x49703b[_0xd3ff('0x6a')][_0x24de25['id']])){_0x49703b[_0xd3ff('0x6a')][_0x24de25['id']]=new VoiceExtension(_0x24de25);}else{_0x49703b[_0xd3ff('0x44')](_0x49703b[_0xd3ff('0x6a')][_0x24de25['id']],_0x24de25);}}}return _0x49703b[_0xd3ff('0x6a')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x4a2abf=this;return function(_0x4a59c1){clearCampaigns(_0x4a2abf[_0xd3ff('0x15')]);for(var _0x23f73d=0x0;_0x23f73d<_0x4a59c1['length'];_0x23f73d+=0x1){_[_0xd3ff('0x6b')](_0x4a2abf[_0xd3ff('0x15')][_0x4a59c1[_0x23f73d]['name']],_0x4a59c1[_0x23f73d]);}return _0x4a2abf[_0xd3ff('0x15')];};};Realtime[_0xd3ff('0x40')][_0xd3ff('0x6c')]=function(){var _0x24380a=this;return function(_0x57cfff){if(_0x57cfff){freeIsNotKey(_0x57cfff,_0x24380a[_0xd3ff('0x24')],'id');for(var _0x5ba32a=0x0,_0x2edfd9={},_0x2ce2b5={};_0x5ba32a<_0x57cfff[_0xd3ff('0x46')];_0x5ba32a+=0x1){_0x2edfd9=_0x57cfff[_0x5ba32a];if(_[_0xd3ff('0x43')](_0x24380a[_0xd3ff('0x24')][_0x2edfd9['id']])){_0x24380a['faxAccounts'][_0x2edfd9['id']]=new FaxAccount(_0x2edfd9);}else{_0x24380a[_0xd3ff('0x44')](_0x24380a[_0xd3ff('0x24')][_0x2edfd9['id']],_0x2edfd9);}}}return _0x24380a[_0xd3ff('0x24')];};};module[_0xd3ff('0x6d')]=Realtime; \ No newline at end of file +var _0xe1e7=['duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','unmanaged','outboundNoAnswerCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','length','trunks','voiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerleaveAt','initVoiceCallReports'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xe1e7,0xda));var _0x7e1e=function(_0x1c1eeb,_0x5271c1){_0x1c1eeb=_0x1c1eeb-0x0;var _0x2214ee=_0xe1e7[_0x1c1eeb];return _0x2214ee;};'use strict';var BPromise=require('bluebird');var util=require(_0x7e1e('0x0'));var _=require(_0x7e1e('0x1'));var moment=require(_0x7e1e('0x2'));var Agent=require(_0x7e1e('0x3'));var Telephone=require(_0x7e1e('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x7e1e('0x5'));var Trigger=require(_0x7e1e('0x6'));var Template=require(_0x7e1e('0x7'));var Campaign=require(_0x7e1e('0x8'));var VoiceExtension=require(_0x7e1e('0x9'));var ZendeskAccount=require(_0x7e1e('0xa'));var SalesforceAccount=require(_0x7e1e('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x7e1e('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x7e1e('0xd'));var VtigerAccount=require(_0x7e1e('0xe'));var ServicenowAccount=require(_0x7e1e('0xf'));var Dynamics365Account=require(_0x7e1e('0x10'));var FreshsalesAccount=require(_0x7e1e('0x11'));var FaxAccount=require(_0x7e1e('0x12'));var Realtime=function(){this[_0x7e1e('0x13')]={};this[_0x7e1e('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0x7e1e('0x15')]={};this[_0x7e1e('0x16')]={};this[_0x7e1e('0x17')]={};this[_0x7e1e('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7e1e('0x19')]={};this[_0x7e1e('0x1a')]={};this[_0x7e1e('0x1b')]={};this[_0x7e1e('0x1c')]={};this['timers']={};this[_0x7e1e('0x1d')]={};this[_0x7e1e('0x1e')]={};this[_0x7e1e('0x1f')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x7e1e('0x20')]={};this[_0x7e1e('0x21')]={};this[_0x7e1e('0x22')]={};this['servicenowAccounts']={};this[_0x7e1e('0x23')]={};this[_0x7e1e('0x24')]={};this[_0x7e1e('0x25')]={};};function freeIsNotKey(_0x44c18c,_0x2577bf,_0x74c847){var _0xcababd=_[_0x7e1e('0x26')](_0x44c18c,function(_0xee98c4,_0x4cddef){return _0xee98c4[_0x74c847];});for(var _0x45e61d in _0x2577bf){if(_0x2577bf[_0x7e1e('0x27')](_0x45e61d)){if(!_0xcababd[_0x45e61d]){delete _0x2577bf[_0x45e61d];}}}}function freeIsNotKeySip(_0x29f40c,_0x5029b6){var _0x1ed134=_['mapKeys'](_0x29f40c,function(_0x207a18,_0x2d68dc){return util['format'](_0x7e1e('0x28'),_0x207a18[_0x7e1e('0x29')]);});for(var _0x550838 in _0x5029b6){if(_0x5029b6[_0x7e1e('0x27')](_0x550838)){if(!_0x1ed134[_0x550838]){delete _0x5029b6[_0x550838];}}}}function freeIsNotKeyAgent(_0x257f54,_0x2ea02d){var _0x570a30=_[_0x7e1e('0x26')](_0x257f54,function(_0x362dc2,_0x3ae67f){var _0x1b3366=_[_0x7e1e('0x2a')](_0x362dc2[_0x7e1e('0x2b')])?util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0x362dc2[_0x7e1e('0x29')]):_0x362dc2[_0x7e1e('0x2b')];return _0x1b3366;});for(var _0x28477b in _0x2ea02d){if(_0x2ea02d[_0x7e1e('0x27')](_0x28477b)){if(!_0x570a30[_0x28477b]){delete _0x2ea02d[_0x28477b];}}}}function clearVoiceCallReports(_0x4aeaef){_0x4aeaef[_0x7e1e('0x2d')]=0x0;_0x4aeaef[_0x7e1e('0x2e')]=0x0;_0x4aeaef[_0x7e1e('0x2f')]=0x0;_0x4aeaef[_0x7e1e('0x30')]=0x0;_0x4aeaef[_0x7e1e('0x31')]=0x0;}function clearCampaigns(_0x27b6bf){if(!_[_0x7e1e('0x32')](_0x27b6bf)){for(var _0xa73e81 in _0x27b6bf){if(_0x27b6bf[_0x7e1e('0x27')](_0xa73e81)){_0x27b6bf[_0xa73e81]['ivrTotalCallsDays']=0x0;_0x27b6bf[_0xa73e81]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3a6617){if(!_[_0x7e1e('0x32')](_0x3a6617)){for(var _0x2cb522 in _0x3a6617){if(_0x3a6617['hasOwnProperty'](_0x2cb522)){_0x3a6617[_0x2cb522]['total']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x2e')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x33')]=0x0;_0x3a6617[_0x2cb522]['abandoned']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x2f')]=0x0;_0x3a6617[_0x2cb522]['sumDuration']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x31')]=0x0;_0x3a6617[_0x2cb522]['outboundAnswerAgiCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x34')]=0x0;_0x3a6617[_0x2cb522]['outboundBusyCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundCongestionCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundNoSuchCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundUnknownCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x35')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x36')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x37')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x38')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x39')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3a')]=0x0;_0x3a6617[_0x2cb522]['outboundAnswerAgiCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3b')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3c')]=!![];}}}}Realtime[_0x7e1e('0x3d')][_0x7e1e('0x3e')]=function(_0x4475e0,_0x3916b0){for(var _0xa6a923 in _0x3916b0){if(_0x4475e0[_0x7e1e('0x27')](_0xa6a923)){_0x4475e0[_0xa6a923]=_0x3916b0[_0xa6a923];}}};Realtime[_0x7e1e('0x3d')]['initAgents']=function(){var _0x234d42=this;return function(_0x12a2ac){if(_0x12a2ac){freeIsNotKeyAgent(_0x12a2ac,_0x234d42[_0x7e1e('0x13')]);for(var _0x1fbfaf=0x0,_0x187b46={},_0x3a35a4={};_0x1fbfaf<_0x12a2ac['length'];_0x1fbfaf+=0x1){_0x187b46=_0x12a2ac[_0x1fbfaf];var _0x17cee4=_[_0x7e1e('0x2a')](_0x187b46[_0x7e1e('0x2b')])?util[_0x7e1e('0x2c')]('SIP/%s',_0x187b46[_0x7e1e('0x29')]):_0x187b46['interface'];if(_[_0x7e1e('0x3f')](_0x234d42[_0x7e1e('0x13')][_0x17cee4])){_0x234d42['agents'][_0x17cee4]=new Agent(_0x187b46);}else{_0x234d42[_0x7e1e('0x3e')](_0x234d42['agents'][_0x17cee4],_0x187b46);}}}return _0x234d42[_0x7e1e('0x13')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x40')]=function(){var _0x2e121c=this;return function(_0x4ad93c){if(_0x4ad93c){freeIsNotKeySip(_0x4ad93c,_0x2e121c[_0x7e1e('0x14')]);for(var _0x5383f0=0x0,_0x836ad0={},_0x448d01={};_0x5383f0<_0x4ad93c[_0x7e1e('0x41')];_0x5383f0+=0x1){_0x836ad0=_0x4ad93c[_0x5383f0];if(_[_0x7e1e('0x3f')](_0x2e121c[_0x7e1e('0x14')][util['format'](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])])){_0x2e121c[_0x7e1e('0x14')][util['format'](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])]=new Telephone(_0x836ad0);}else{_0x2e121c['mergeFromDatabase'](_0x2e121c['telephones'][util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])],_0x836ad0);}}}return _0x2e121c[_0x7e1e('0x14')];};};Realtime[_0x7e1e('0x3d')]['initTrunks']=function(){var _0x1d0dc3=this;return function(_0x3ec3de){if(_0x3ec3de){freeIsNotKeySip(_0x3ec3de,_0x1d0dc3[_0x7e1e('0x42')]);for(var _0x5665be=0x0,_0xe062da={},_0x3b9741={};_0x5665be<_0x3ec3de[_0x7e1e('0x41')];_0x5665be+=0x1){_0xe062da=_0x3ec3de[_0x5665be];if(_[_0x7e1e('0x3f')](_0x1d0dc3[_0x7e1e('0x42')][util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0xe062da['name'])])){_0x1d0dc3['trunks'][util[_0x7e1e('0x2c')]('SIP/%s',_0xe062da[_0x7e1e('0x29')])]=new Trunk(_0xe062da);}else{_0x1d0dc3['mergeFromDatabase'](_0x1d0dc3[_0x7e1e('0x42')][util['format'](_0x7e1e('0x28'),_0xe062da[_0x7e1e('0x29')])],_0xe062da);}}}return _0x1d0dc3[_0x7e1e('0x42')];};};Realtime[_0x7e1e('0x3d')]['initVoiceQueues']=function(){var _0x4881bd=this;return function(_0x2639ba){if(_0x2639ba){freeIsNotKey(_0x2639ba,_0x4881bd[_0x7e1e('0x43')],_0x7e1e('0x29'));for(var _0x3f741e=0x0,_0x1351bb={},_0xfc4cb8={};_0x3f741e<_0x2639ba[_0x7e1e('0x41')];_0x3f741e+=0x1){_0x1351bb=_0x2639ba[_0x3f741e];if(_[_0x7e1e('0x3f')](_0x4881bd[_0x7e1e('0x43')][_0x1351bb[_0x7e1e('0x29')]])){_0x4881bd[_0x7e1e('0x43')][_0x1351bb['name']]=new VoiceQueue(_0x1351bb);}else{_0x4881bd[_0x7e1e('0x3e')](_0x4881bd[_0x7e1e('0x43')][_0x1351bb[_0x7e1e('0x29')]],_0x1351bb);}}}return _0x4881bd[_0x7e1e('0x43')];};};Realtime['prototype'][_0x7e1e('0x44')]=function(){var _0x4d0343=this;return function(_0x4c5d3f){if(_0x4c5d3f){freeIsNotKey(_0x4c5d3f,_0x4d0343[_0x7e1e('0x15')],'id');for(var _0x156ba8=0x0,_0x57bc3e={},_0x425430={};_0x156ba8<_0x4c5d3f[_0x7e1e('0x41')];_0x156ba8+=0x1){_0x57bc3e=_0x4c5d3f[_0x156ba8];if(_[_0x7e1e('0x3f')](_0x4d0343['triggers'][_0x57bc3e['id']])){_0x4d0343[_0x7e1e('0x15')][_0x57bc3e['id']]=new Trigger(_0x57bc3e);}else{_0x4d0343[_0x7e1e('0x3e')](_0x4d0343[_0x7e1e('0x15')][_0x57bc3e['id']],_0x57bc3e);}}}return _0x4d0343[_0x7e1e('0x15')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x45')]=function(){var _0x1112f7=this;return function(_0x14fb45){if(_0x14fb45){freeIsNotKey(_0x14fb45,_0x1112f7[_0x7e1e('0x17')],'id');for(var _0x1f2ece=0x0,_0x2d530a={},_0x1317b9={};_0x1f2ece<_0x14fb45['length'];_0x1f2ece+=0x1){_0x2d530a=_0x14fb45[_0x1f2ece];if(_[_0x7e1e('0x3f')](_0x1112f7[_0x7e1e('0x17')][_0x2d530a['id']])){_0x1112f7['templates'][_0x2d530a['id']]=new Template(_0x2d530a);}else{_0x1112f7[_0x7e1e('0x3e')](_0x1112f7['templates'][_0x2d530a['id']],_0x2d530a);}}}return _0x1112f7[_0x7e1e('0x17')];};};Realtime[_0x7e1e('0x3d')]['initZendeskAccounts']=function(){var _0x107f8c=this;return function(_0x32d1d9){if(_0x32d1d9){freeIsNotKey(_0x32d1d9,_0x107f8c[_0x7e1e('0x1e')],'id');for(var _0x4f794c=0x0,_0x4f14df={},_0x439b1e={};_0x4f794c<_0x32d1d9['length'];_0x4f794c+=0x1){_0x4f14df=_0x32d1d9[_0x4f794c];if(_[_0x7e1e('0x3f')](_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']])){_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']]=new ZendeskAccount(_0x4f14df);}else{_0x107f8c[_0x7e1e('0x3e')](_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']],_0x4f14df);}}}return _0x107f8c[_0x7e1e('0x1e')];};};Realtime['prototype'][_0x7e1e('0x46')]=function(){var _0x456dfc=this;return function(_0x30f080){if(_0x30f080){freeIsNotKey(_0x30f080,_0x456dfc[_0x7e1e('0x1f')],'id');for(var _0x4d3ce6=0x0,_0x5f1d3e={},_0x436a49={};_0x4d3ce6<_0x30f080[_0x7e1e('0x41')];_0x4d3ce6+=0x1){_0x5f1d3e=_0x30f080[_0x4d3ce6];if(_[_0x7e1e('0x3f')](_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']])){_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']]=new SalesforceAccount(_0x5f1d3e);}else{_0x456dfc[_0x7e1e('0x3e')](_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']],_0x5f1d3e);}}}return _0x456dfc[_0x7e1e('0x1f')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x47')]=function(){var _0xa444cf=this;return function(_0x25b26d){if(_0x25b26d){freeIsNotKey(_0x25b26d,_0xa444cf[_0x7e1e('0x48')],'id');for(var _0x2842c0=0x0,_0x4f4cb4={},_0x29234d={};_0x2842c0<_0x25b26d[_0x7e1e('0x41')];_0x2842c0+=0x1){_0x4f4cb4=_0x25b26d[_0x2842c0];if(_['isUndefined'](_0xa444cf[_0x7e1e('0x48')][_0x4f4cb4['id']])){_0xa444cf[_0x7e1e('0x48')][_0x4f4cb4['id']]=new FreshdeskAccount(_0x4f4cb4);}else{_0xa444cf[_0x7e1e('0x3e')](_0xa444cf['freshdeskAccounts'][_0x4f4cb4['id']],_0x4f4cb4);}}}return _0xa444cf[_0x7e1e('0x48')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x49')]=function(){var _0x4ae7e0=this;return function(_0x1f392e){if(_0x1f392e){freeIsNotKey(_0x1f392e,_0x4ae7e0['zohoAccounts'],'id');for(var _0x56c0c8=0x0,_0x4681ac={},_0x1a5e39={};_0x56c0c8<_0x1f392e[_0x7e1e('0x41')];_0x56c0c8+=0x1){_0x4681ac=_0x1f392e[_0x56c0c8];if(_[_0x7e1e('0x3f')](_0x4ae7e0[_0x7e1e('0x20')][_0x4681ac['id']])){_0x4ae7e0[_0x7e1e('0x20')][_0x4681ac['id']]=new ZohoAccount(_0x4681ac);}else{_0x4ae7e0['mergeFromDatabase'](_0x4ae7e0['zohoAccounts'][_0x4681ac['id']],_0x4681ac);}}}return _0x4ae7e0[_0x7e1e('0x20')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4a')]=function(){var _0x1f46ce=this;return function(_0x1f009b){if(_0x1f009b){freeIsNotKey(_0x1f009b,_0x1f46ce[_0x7e1e('0x21')],'id');for(var _0x1fdb60=0x0,_0x790924={},_0x23ad1f={};_0x1fdb60<_0x1f009b[_0x7e1e('0x41')];_0x1fdb60+=0x1){_0x790924=_0x1f009b[_0x1fdb60];if(_[_0x7e1e('0x3f')](_0x1f46ce['deskAccounts'][_0x790924['id']])){_0x1f46ce[_0x7e1e('0x21')][_0x790924['id']]=new DeskAccount(_0x790924);}else{_0x1f46ce['mergeFromDatabase'](_0x1f46ce['deskAccounts'][_0x790924['id']],_0x790924);}}}return _0x1f46ce[_0x7e1e('0x21')];};};Realtime['prototype'][_0x7e1e('0x4b')]=function(){var _0x123687=this;return function(_0x35b7a8){if(_0x35b7a8){freeIsNotKey(_0x35b7a8,_0x123687['sugarcrmAccounts'],'id');for(var _0x5b4767=0x0,_0x2bed42={},_0x3a43db={};_0x5b4767<_0x35b7a8[_0x7e1e('0x41')];_0x5b4767+=0x1){_0x2bed42=_0x35b7a8[_0x5b4767];if(_[_0x7e1e('0x3f')](_0x123687[_0x7e1e('0x4c')][_0x2bed42['id']])){_0x123687[_0x7e1e('0x4c')][_0x2bed42['id']]=new SugarcrmAccount(_0x2bed42);}else{_0x123687[_0x7e1e('0x3e')](_0x123687['sugarcrmAccounts'][_0x2bed42['id']],_0x2bed42);}}}return _0x123687[_0x7e1e('0x4c')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4d')]=function(){var _0x183071=this;return function(_0x52b68d){if(_0x52b68d){freeIsNotKey(_0x52b68d,_0x183071['vtigerAccounts'],'id');for(var _0xae8f6f=0x0,_0x2af4a4={},_0x473272={};_0xae8f6f<_0x52b68d[_0x7e1e('0x41')];_0xae8f6f+=0x1){_0x2af4a4=_0x52b68d[_0xae8f6f];if(_[_0x7e1e('0x3f')](_0x183071[_0x7e1e('0x22')][_0x2af4a4['id']])){_0x183071[_0x7e1e('0x22')][_0x2af4a4['id']]=new VtigerAccount(_0x2af4a4);}else{_0x183071[_0x7e1e('0x3e')](_0x183071['vtigerAccounts'][_0x2af4a4['id']],_0x2af4a4);}}}return _0x183071[_0x7e1e('0x22')];};};Realtime[_0x7e1e('0x3d')]['initServicenowAccounts']=function(){var _0x444e69=this;return function(_0x28f1f8){if(_0x28f1f8){freeIsNotKey(_0x28f1f8,_0x444e69[_0x7e1e('0x4e')],'id');for(var _0x41e2a0=0x0,_0x200dd5={},_0x181de8={};_0x41e2a0<_0x28f1f8[_0x7e1e('0x41')];_0x41e2a0+=0x1){_0x200dd5=_0x28f1f8[_0x41e2a0];if(_[_0x7e1e('0x3f')](_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']])){_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']]=new ServicenowAccount(_0x200dd5);}else{_0x444e69[_0x7e1e('0x3e')](_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']],_0x200dd5);}}}return _0x444e69['servicenowAccounts'];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4f')]=function(){var _0x3ebb1b=this;return function(_0x3c0bc8){if(_0x3c0bc8){freeIsNotKey(_0x3c0bc8,_0x3ebb1b[_0x7e1e('0x23')],'id');for(var _0x5cdafe=0x0,_0x147b8f={},_0x58683b={};_0x5cdafe<_0x3c0bc8['length'];_0x5cdafe+=0x1){_0x147b8f=_0x3c0bc8[_0x5cdafe];if(_['isUndefined'](_0x3ebb1b[_0x7e1e('0x23')][_0x147b8f['id']])){_0x3ebb1b[_0x7e1e('0x23')][_0x147b8f['id']]=new Dynamics365Account(_0x147b8f);}else{_0x3ebb1b[_0x7e1e('0x3e')](_0x3ebb1b['dynamics365Accounts'][_0x147b8f['id']],_0x147b8f);}}}return _0x3ebb1b[_0x7e1e('0x23')];};};Realtime[_0x7e1e('0x3d')]['initFreshsalesAccounts']=function(){var _0x3e0e2c=this;return function(_0x40b71f){if(_0x40b71f){freeIsNotKey(_0x40b71f,_0x3e0e2c['freshsalesAccounts'],'id');for(var _0x4baa0d=0x0,_0x5afb50={},_0x1d8515={};_0x4baa0d<_0x40b71f['length'];_0x4baa0d+=0x1){_0x5afb50=_0x40b71f[_0x4baa0d];if(_[_0x7e1e('0x3f')](_0x3e0e2c[_0x7e1e('0x24')][_0x5afb50['id']])){_0x3e0e2c[_0x7e1e('0x24')][_0x5afb50['id']]=new FreshsalesAccount(_0x5afb50);}else{_0x3e0e2c[_0x7e1e('0x3e')](_0x3e0e2c['freshsalesAccounts'][_0x5afb50['id']],_0x5afb50);}}}return _0x3e0e2c[_0x7e1e('0x24')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x50')]=function(){var _0x4f67d0=this;return function(_0x5d06f9){for(var _0x5a2af1=0x0;_0x5a2af1<_0x5d06f9['length'];_0x5a2af1+=0x1){_[_0x7e1e('0x51')](_0x4f67d0['voiceQueues'][_0x5d06f9[_0x5a2af1][_0x7e1e('0x29')]],_0x5d06f9[_0x5a2af1]);}return _0x4f67d0['voiceQueues'];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x52')]=function(){var _0x4e9015=this;return function(_0x3ae9ea){clearVoiceQueues(_0x4e9015[_0x7e1e('0x43')]);if(_0x3ae9ea){_0x3ae9ea=_[_0x7e1e('0x53')](_0x3ae9ea,_0x7e1e('0x54'));for(var _0x3ad8ca in _0x3ae9ea){if(_0x3ae9ea[_0x7e1e('0x27')](_0x3ad8ca)){var _0x1c4b86={};for(var _0xce5e21=0x0;_0xce5e21<_0x3ae9ea[_0x3ad8ca][_0x7e1e('0x41')];_0xce5e21+=0x1){var _0x5b3ce6=_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x55')];if(_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6]){if(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x56')]){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x33')]+=0x1;}if(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerabandon']){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x57')]+=0x1;}_0x4e9015['voiceQueues'][_0x5b3ce6][_0x7e1e('0x2f')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerleaveAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x59')]),_0x7e1e('0x5a'))||0x0;if(_0xce5e21===_0x3ae9ea[_0x3ad8ca][_0x7e1e('0x41')]-0x1){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x30')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercompleteAt']||_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x5b')]||_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerexitAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x59')]),_0x7e1e('0x5a'))||0x0;_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x2d')]+=0x1;if(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercomplete']){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x2e')]+=0x1;_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x31')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercompleteAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x5c')]),_0x7e1e('0x5a'))||0x0;}}else{_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x30')]+=_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6]['sumHoldTime']||0x0;}}}}}}return _0x4e9015['voiceQueues'];};};Realtime['prototype'][_0x7e1e('0x5d')]=function(){var _0x290512=this;return function(_0x42a222){clearVoiceCallReports(_0x290512[_0x7e1e('0x18')]);if(_0x42a222){for(var _0x17317e=0x0;_0x17317e<_0x42a222[_0x7e1e('0x41')];_0x17317e+=0x1){_0x290512[_0x7e1e('0x18')]['total']+=0x1;_0x290512[_0x7e1e('0x18')]['sumDuration']+=_0x42a222[_0x17317e][_0x7e1e('0x5e')];if(_0x42a222[_0x17317e][_0x7e1e('0x5f')]===_0x7e1e('0x60')){_0x290512['outbound'][_0x7e1e('0x2e')]+=0x1;_0x290512[_0x7e1e('0x18')][_0x7e1e('0x2f')]+=_0x42a222[_0x17317e][_0x7e1e('0x5e')]-_0x42a222[_0x17317e]['billableseconds']||0x0;_0x290512[_0x7e1e('0x18')][_0x7e1e('0x31')]+=_0x42a222[_0x17317e][_0x7e1e('0x61')];}}}return _0x290512[_0x7e1e('0x18')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x62')]=function(){var _0x3fe957=this;return function(_0x205e81){if(_0x205e81){freeIsNotKey(_0x205e81,_0x3fe957[_0x7e1e('0x16')],'name');for(var _0x2298ac=0x0,_0x2977d0={};_0x2298ac<_0x205e81['length'];_0x2298ac+=0x1){_0x2977d0=_0x205e81[_0x2298ac];if(_[_0x7e1e('0x3f')](_0x3fe957[_0x7e1e('0x16')][_0x2977d0['name']])){_0x3fe957['campaigns'][_0x2977d0[_0x7e1e('0x29')]]=new Campaign(_0x2977d0);}else{_0x3fe957['mergeFromDatabase'](_0x3fe957[_0x7e1e('0x16')][_0x2977d0[_0x7e1e('0x29')]],_0x2977d0);_0x3fe957[_0x7e1e('0x16')][_0x2977d0['name']][_0x7e1e('0x63')]=_0x2977d0[_0x7e1e('0x64')]?_0x2977d0[_0x7e1e('0x64')][_0x7e1e('0x29')]:undefined;}}}return _0x3fe957[_0x7e1e('0x16')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x65')]=function(){var _0x1478e0=this;return function(_0x3b83b1){if(_0x3b83b1){freeIsNotKey(_0x3b83b1,_0x1478e0['voiceExtensions'],'id');for(var _0x4139fe=0x0,_0x319d52={};_0x4139fe<_0x3b83b1['length'];_0x4139fe+=0x1){_0x319d52=_0x3b83b1[_0x4139fe];if(_['isUndefined'](_0x1478e0[_0x7e1e('0x19')][_0x319d52['id']])){_0x1478e0['voiceExtensions'][_0x319d52['id']]=new VoiceExtension(_0x319d52);}else{_0x1478e0[_0x7e1e('0x3e')](_0x1478e0['voiceExtensions'][_0x319d52['id']],_0x319d52);}}}return _0x1478e0[_0x7e1e('0x19')];};};Realtime['prototype'][_0x7e1e('0x66')]=function(){var _0x5c3f9f=this;return function(_0x1b53c5){clearCampaigns(_0x5c3f9f[_0x7e1e('0x16')]);for(var _0x535c7a=0x0;_0x535c7a<_0x1b53c5['length'];_0x535c7a+=0x1){_[_0x7e1e('0x51')](_0x5c3f9f[_0x7e1e('0x16')][_0x1b53c5[_0x535c7a][_0x7e1e('0x29')]],_0x1b53c5[_0x535c7a]);}return _0x5c3f9f[_0x7e1e('0x16')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x67')]=function(){var _0x529470=this;return function(_0x569672){if(_0x569672){freeIsNotKey(_0x569672,_0x529470[_0x7e1e('0x25')],'id');for(var _0x24428b=0x0,_0x2e3dbd={},_0x247eb7={};_0x24428b<_0x569672[_0x7e1e('0x41')];_0x24428b+=0x1){_0x2e3dbd=_0x569672[_0x24428b];if(_[_0x7e1e('0x3f')](_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']])){_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']]=new FaxAccount(_0x2e3dbd);}else{_0x529470[_0x7e1e('0x3e')](_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']],_0x2e3dbd);}}}return _0x529470[_0x7e1e('0x25')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9bf6bb9..55d0c90 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 _0x99ea=['../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','format','SIP/%s','prototype','length','findAgent','connectedlinenum','assigned','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','internal','destination','exten','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','isNil','type','UserId','membername','create','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','util'];(function(_0x108bf5,_0x211fd6){var _0x2d846d=function(_0xec9c28){while(--_0xec9c28){_0x108bf5['push'](_0x108bf5['shift']());}};_0x2d846d(++_0x211fd6);}(_0x99ea,0xba));var _0xa99e=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x99ea[_0x5cb97e];return _0x1714b4;};'use strict';var _=require(_0xa99e('0x0'));var moment=require('moment');var util=require(_0xa99e('0x1'));var config=require(_0xa99e('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa99e('0x3'));var RpcVoiceCallReport=require(_0xa99e('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xa99e('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xa99e('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xa99e('0x7'));var VoiceCallReport=require(_0xa99e('0x8'));var VoiceAgentReport=require(_0xa99e('0x9'));var VoiceDialReport=require(_0xa99e('0xa'));var UserReport=require(_0xa99e('0xb'));function Report(_0x451d5c){this[_0xa99e('0xc')]=_0x451d5c;this[_0xa99e('0xd')]=_0x451d5c['agents'];this['telephones']=_0x451d5c[_0xa99e('0xe')];}Report['prototype'][_0xa99e('0xf')]=function(_0x923262){var _0x740248=new VoiceQueueReport(this[_0xa99e('0xc')]);var _0x1b9c01=new VoiceAgentReport(this[_0xa99e('0xc')]);var _0x596ba2=new VoiceDialReport(this[_0xa99e('0xc')]);var _0x59275d=new VoiceCallReport(this[_0xa99e('0xc')]);var _0x865155=new UserReport(this[_0xa99e('0xc')]);if(config[_0xa99e('0x10')]&&config[_0xa99e('0x10')]['disabled']){ami['on'](_0xa99e('0x11'),this[_0xa99e('0x12')][_0xa99e('0x13')](this));ami['on'](_0xa99e('0x14'),this[_0xa99e('0x15')]['bind'](this));ami['on'](_0xa99e('0x16'),this[_0xa99e('0x17')][_0xa99e('0x13')](this));ami['on'](_0xa99e('0x18'),this[_0xa99e('0x19')][_0xa99e('0x13')](this));ami['on'](_0xa99e('0x1a'),this['blindTransfer'][_0xa99e('0x13')](this));ami['on'](_0xa99e('0x1b'),this[_0xa99e('0x1c')][_0xa99e('0x13')](this));}};Report['prototype']['findAgent']=function(_0x7e5f5a){var _0x30dc66;_0x30dc66=_[_0xa99e('0x1d')](this[_0xa99e('0xd')],function(_0x136329){return _0x136329[_0xa99e('0x1e')]==_0x7e5f5a||_0x136329[_0xa99e('0x1f')]==_0x7e5f5a;});if(_['isNil'](_0x30dc66)){var _0x5de5e8=_[_0xa99e('0x1d')](this[_0xa99e('0xe')],function(_0x33446f){return _0x33446f['accountcode']==_0x7e5f5a||_0x33446f[_0xa99e('0x1f')]==_0x7e5f5a;});if(_0x5de5e8){_0x30dc66=_['find'](this[_0xa99e('0xd')],function(_0x520983){return _0x520983[_0xa99e('0x20')]==util[_0xa99e('0x21')](_0xa99e('0x22'),_0x5de5e8[_0xa99e('0x1f')]);});}}return _0x30dc66;};Report[_0xa99e('0x23')]['voiceQueueReport']=function(_0x3b23dc){for(var _0x374990=0x0;_0x374990<_0x3b23dc[_0xa99e('0x24')];_0x374990+=0x1){var _0x122cc7=this[_0xa99e('0x25')](_0x3b23dc[_0x374990][_0xa99e('0x26')]);if(_0x122cc7){_0x3b23dc[_0x374990][_0xa99e('0x1e')]=_0x122cc7[_0xa99e('0x1e')];_0x3b23dc[_0x374990][_0xa99e('0x27')]=!![];_0x3b23dc[_0x374990]['lastAssignedTo']=_0x122cc7[_0xa99e('0x1f')];_0x3b23dc[_0x374990]['interface']=_['isNil'](_0x122cc7[_0xa99e('0x20')])?util[_0xa99e('0x21')](_0xa99e('0x22'),_0x122cc7['name']):_0x122cc7[_0xa99e('0x20')];if(_0x3b23dc[_0x374990]['queuecallercomplete']){_0x3b23dc[_0x374990][_0xa99e('0x28')]=moment()['format'](_0xa99e('0x29'));}if(_0x3b23dc[_0x374990][_0xa99e('0x2a')]){_0x3b23dc[_0x374990][_0xa99e('0x2b')]=moment()[_0xa99e('0x21')](_0xa99e('0x29'));}RpcMemberReport[_0xa99e('0x12')](_0x3b23dc[_0x374990]);}RpcVoiceQueueReport['create'](_0x3b23dc[_0x374990]);}};function extractCalleridNumber(_0x19f762){var _0x4b9f9a=_0x19f762[_0xa99e('0x2c')](/<(.*?)>/);return _0x4b9f9a?_0x4b9f9a[0x1]:_0x19f762;}Report[_0xa99e('0x23')][_0xa99e('0x2d')]=function(_0x550e0d){for(var _0xaa16c=0x0;_0xaa16c/);return _0x1c1a10?_0x1c1a10[0x1]:_0x2dde33;}Report[_0xc4e8('0x11')][_0xc4e8('0x31')]=function(_0x2ee878){for(var _0x5027e7=0x0;_0x5027e7',_0x3f406c['calleridname'],_0x3f406c[_0xc4e8('0x35')]);}if(RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x3f406c[_0xc4e8('0x4b')]]){var _0x347a93=RpcVoiceTransferReport['transfers'][_0x3f406c[_0xc4e8('0x4b')]];_0x347a93['transfereelinkedid']=_0x3f406c[_0xc4e8('0x4c')];RpcVoiceTransferReport[_0xc4e8('0x4d')](_0x347a93);delete RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x3f406c[_0xc4e8('0x4b')]];}if(_['isNil'](_0x3f406c[_0xc4e8('0x3b')])){_0x3f406c[_0xc4e8('0x3b')]=this[_0xc4e8('0x33')](_0x3f406c);}if(_[_0xc4e8('0x24')](_0x3f406c[_0xc4e8('0x4e')])){var _0x4c06b3=_0x3f406c[_0xc4e8('0x34')][_0xc4e8('0x4f')]('-')[0x0];var _0x5bc31a=this['agents'][_0x4c06b3];if(!_0x5bc31a)_0x5bc31a=this[_0xc4e8('0x31')](_0x3f406c[_0xc4e8('0x25')]);if(_0x5bc31a){_0x3f406c[_0xc4e8('0x4e')]=_0x5bc31a['id'];_0x3f406c[_0xc4e8('0x50')]=_0x5bc31a['name'];}}RpcVoiceCallReport[_0xc4e8('0x2f')](_0x3f406c);if(_0x3f406c['monitor']){for(var _0x323515=0x0;_0x323515<_0x3f406c['monitors'][_0xc4e8('0x26')];_0x323515+=0x1){_0x3f406c[_0xc4e8('0x51')]=_0x3f406c[_0xc4e8('0x52')][_0x323515]['filename'];_0x3f406c[_0xc4e8('0x53')]=_0x3f406c[_0xc4e8('0x52')][_0x323515]['createdAt'];if(_0x3f406c[_0xc4e8('0x3a')]=='xcally-motion-preview'){_0x3f406c[_0xc4e8('0x35')]=_0x3f406c[_0xc4e8('0x49')];_0x3f406c[_0xc4e8('0x54')]=_0x3f406c[_0xc4e8('0x55')];_0x3f406c['connectedlinenum']=_0x3f406c[_0xc4e8('0x25')];_0x3f406c[_0xc4e8('0x55')]=_0x3f406c[_0xc4e8('0x50')];_0x3f406c[_0xc4e8('0x3a')]=_0x3f406c[_0xc4e8('0x45')];}else if(_0x3f406c[_0xc4e8('0x3a')]==_0xc4e8('0x56')){_0x3f406c[_0xc4e8('0x35')]=_0x3f406c[_0xc4e8('0x39')];_0x3f406c[_0xc4e8('0x3a')]=_0x3f406c['originatecalleridnum'];}RpcVoiceRecording['create'](_0x3f406c);}}};Report['prototype'][_0xc4e8('0x1b')]=function(_0x5038a4){if(_[_0xc4e8('0x57')](_0x5038a4)){_0x5038a4[_0xc4e8('0x58')](function(_0x58b109){RpcVoiceAgentReport[_0xc4e8('0x2f')](_0x58b109);});}else{RpcVoiceAgentReport[_0xc4e8('0x2f')](_0x5038a4);}};Report[_0xc4e8('0x11')][_0xc4e8('0x1d')]=function(_0x1a151d){RpcVoiceDialReport[_0xc4e8('0x2f')](_0x1a151d);var _0x47b16d;var _0xc845bc;var _0x5499b7=_0x1a151d[_0xc4e8('0x34')];if(_[_0xc4e8('0x59')](_0x5499b7,'Local')){_0xc845bc=_0x5499b7[_0xc4e8('0x5a')](_0x5499b7[_0xc4e8('0x5b')]('/')+0x1,_0x5499b7[_0xc4e8('0x5b')]('@'));_0x47b16d=_[_0xc4e8('0x22')](this[_0xc4e8('0xf')],function(_0x45cd9f){return _0x45cd9f[_0xc4e8('0x5c')]==_0xc845bc||_0x45cd9f[_0xc4e8('0x5d')]==_0xc845bc||_0x45cd9f[_0xc4e8('0x25')]==_0xc845bc;});}else{_0xc845bc=_0x5499b7[_0xc4e8('0x5a')](_0x5499b7[_0xc4e8('0x5b')]('/')+0x1,_0x5499b7[_0xc4e8('0x5e')]('-'));_0x47b16d=this[_0xc4e8('0x21')](_0xc845bc);}if(_0x47b16d){_0x1a151d[_0xc4e8('0x28')]=_[_0xc4e8('0x24')](_0x47b16d[_0xc4e8('0x28')])?util[_0xc4e8('0x2c')]('SIP/%s',_0x47b16d['name']):_0x47b16d[_0xc4e8('0x28')];_0x1a151d[_0xc4e8('0x50')]=_0x47b16d[_0xc4e8('0x23')];_0x1a151d['accountcode']=_0x47b16d[_0xc4e8('0x25')];RpcMemberReport['voiceDialReport'](_0x1a151d);}};Report[_0xc4e8('0x11')]['blindTransfer']=function(_0x164a4f){RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x164a4f[_0xc4e8('0x5f')]]=_0x164a4f;};Report[_0xc4e8('0x11')]['attendedTransfer']=function(_0x41e4d0){RpcVoiceTransferReport['attendedTransfer'](_0x41e4d0);};module[_0xc4e8('0x60')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9482e2d..92498db 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 _0xbccd=['../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','[userReport][devicestatelist]','inspect','catch','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','toNumber','format','updateStatusRealtime','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami'];(function(_0x51d304,_0x44180d){var _0x1650dc=function(_0x1c82e8){while(--_0x1c82e8){_0x51d304['push'](_0x51d304['shift']());}};_0x1650dc(++_0x44180d);}(_0xbccd,0x174));var _0xdbcc=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xbccd[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xdbcc('0x0'));var moment=require(_0xdbcc('0x1'));var util=require(_0xdbcc('0x2'));var Redis=require(_0xdbcc('0x3'));var BPromise=require(_0xdbcc('0x4'));var config=require(_0xdbcc('0x5'));var logger=require(_0xdbcc('0x6'))(_0xdbcc('0x7'));var ami=require(_0xdbcc('0x8'));config[_0xdbcc('0x9')]=_[_0xdbcc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdbcc('0xb'))(new Redis(config['redis']));function UserReport(_0x18be65){this['trunks']=_0x18be65[_0xdbcc('0xc')];this[_0xdbcc('0xd')]=_0x18be65['agents'];this[_0xdbcc('0xe')]=_0x18be65[_0xdbcc('0xe')];ami['on'](_0xdbcc('0xf'),this[_0xdbcc('0x10')][_0xdbcc('0x11')](this));ami['on'](_0xdbcc('0x12'),this[_0xdbcc('0x10')][_0xdbcc('0x11')](this));ami['on'](_0xdbcc('0x13'),this[_0xdbcc('0x14')][_0xdbcc('0x11')](this));ami['on'](_0xdbcc('0x15'),this['syncPeerStatus'][_0xdbcc('0x11')](this));return this[_0xdbcc('0x16')]();}function showSipRegistrations(){Promise[_0xdbcc('0x17')]()[_0xdbcc('0x18')](ami[_0xdbcc('0x19')]())['catch'](function(_0x5601a8){logger[_0xdbcc('0x1a')](_0xdbcc('0x1b'),util['inspect'](_0x5601a8,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xdbcc('0x17')]()[_0xdbcc('0x18')](ami['actionDeviceStateList']())['catch'](function(_0x7f043a){logger[_0xdbcc('0x1a')](_0xdbcc('0x1c'),util[_0xdbcc('0x1d')](_0x7f043a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdbcc('0x17')]()[_0xdbcc('0x18')](ami['actionSipPeerStatus']())[_0xdbcc('0x1e')](function(_0x43cc47){logger[_0xdbcc('0x1a')](_0xdbcc('0x1f'),util[_0xdbcc('0x1d')](_0x43cc47,{'showHidden':![],'depth':null}));});}UserReport[_0xdbcc('0x20')][_0xdbcc('0x16')]=function(){setInterval(function(){BPromise[_0xdbcc('0x17')]()[_0xdbcc('0x18')](showSipRegistrations())[_0xdbcc('0x18')](listDeviceStates())[_0xdbcc('0x18')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x3e6347){return _0x3e6347!==null&&!_[_0xdbcc('0x21')](_0x3e6347);};UserReport[_0xdbcc('0x20')][_0xdbcc('0x22')]=function(_0x213e77,_0x323cfe,_0x1f97ab){io['to'](_0x213e77)['emit'](_0x323cfe,_0x1f97ab);};UserReport[_0xdbcc('0x20')][_0xdbcc('0x10')]=function(_0x16907b){try{if(this[_0xdbcc('0x23')](_0x16907b)){logger['info'](_0xdbcc('0x24'),_0x16907b['username'],_0x16907b[_0xdbcc('0x25')]);logger[_0xdbcc('0x26')](_0xdbcc('0x27'),util[_0xdbcc('0x1d')](_0x16907b,{'showHidden':![],'depth':null}));var _0x3a33a9=_[_0xdbcc('0x28')](this['trunks'],{'defaultuser':_0x16907b[_0xdbcc('0x29')]});if(_0x3a33a9){_0x16907b['stateRegistry']=_0x16907b['state'];_[_0xdbcc('0x2a')](_0x3a33a9,_[_0xdbcc('0x2b')](_0x16907b,[_0xdbcc('0x2c'),_0xdbcc('0x2d'),_0xdbcc('0x29'),'state']));logger['debug'](_0xdbcc('0x2e'),util['inspect'](_0x3a33a9,{'showHidden':![],'depth':null}));this[_0xdbcc('0x22')](util['format']('trunk:%s',_0x3a33a9[_0xdbcc('0x2f')]),_0xdbcc('0x30'),_0x3a33a9);}}}catch(_0x50543c){logger[_0xdbcc('0x1a')](_0xdbcc('0x27'),util[_0xdbcc('0x1d')](_0x50543c,{'showHidden':![],'depth':null}));}};UserReport[_0xdbcc('0x20')]['syncDeviceState']=function(_0xdabeb2){try{if(this[_0xdbcc('0x23')](_0xdabeb2)){logger[_0xdbcc('0x31')](_0xdbcc('0x32'),_0xdabeb2[_0xdbcc('0x33')],_0xdabeb2[_0xdbcc('0x25')]);logger[_0xdbcc('0x26')](_0xdbcc('0x34'),util[_0xdbcc('0x1d')](_0xdabeb2,{'showHidden':![],'depth':null}));if(this[_0xdbcc('0xd')][_0xdabeb2[_0xdbcc('0x33')]]){if(!this['agents'][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x35')]||_0xdabeb2['state']['toLowerCase']()=='inuse'){this[_0xdbcc('0xd')][_0xdabeb2['device']][_0xdbcc('0x35')]=![];if(this[_0xdbcc('0xd')][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x25')]!==_0xdabeb2[_0xdbcc('0x25')][_0xdbcc('0x36')]()){this[_0xdbcc('0xd')][_0xdabeb2['device']]['stateTime']=_[_0xdbcc('0x37')](moment()[_0xdbcc('0x38')]('x'));}this[_0xdbcc('0xd')][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x25')]=_0xdabeb2[_0xdbcc('0x25')][_0xdbcc('0x36')]();this[_0xdbcc('0xd')][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x39')](_0xdabeb2);}}else if(this['telephones'][_0xdabeb2['device']]){if(this['telephones'][_0xdabeb2[_0xdbcc('0x33')]]['state']!==_0xdabeb2[_0xdbcc('0x25')]['toLowerCase']()){this[_0xdbcc('0xe')][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x3a')]=_[_0xdbcc('0x37')](moment()[_0xdbcc('0x38')]('x'));}this[_0xdbcc('0xe')][_0xdabeb2['device']]['state']=_0xdabeb2[_0xdbcc('0x25')]['toLowerCase']();logger[_0xdbcc('0x26')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xdbcc('0x1d')](this[_0xdbcc('0xe')][_0xdabeb2['device']],{'showHidden':![],'depth':null}));this[_0xdbcc('0x22')](util[_0xdbcc('0x38')](_0xdbcc('0x3b'),this[_0xdbcc('0xe')][_0xdabeb2[_0xdbcc('0x33')]]['name']),_0xdbcc('0x3c'),this[_0xdbcc('0xe')][_0xdabeb2[_0xdbcc('0x33')]]);}else if(this[_0xdbcc('0xc')][_0xdabeb2[_0xdbcc('0x33')]]){if(this[_0xdbcc('0xc')][_0xdabeb2['device']]['state']!==_0xdabeb2[_0xdbcc('0x25')]['toLowerCase']()){this[_0xdbcc('0xc')][_0xdabeb2[_0xdbcc('0x33')]][_0xdbcc('0x3a')]=_[_0xdbcc('0x37')](moment()[_0xdbcc('0x38')]('x'));}this[_0xdbcc('0xc')][_0xdabeb2['device']][_0xdbcc('0x25')]=_0xdabeb2[_0xdbcc('0x25')][_0xdbcc('0x36')]();logger['debug'](_0xdbcc('0x3d'),util[_0xdbcc('0x1d')](this[_0xdbcc('0xc')][_0xdabeb2[_0xdbcc('0x33')]],{'showHidden':![],'depth':null}));this[_0xdbcc('0x22')](util[_0xdbcc('0x38')]('trunk:%s',this['trunks'][_0xdabeb2[_0xdbcc('0x33')]]['name']),_0xdbcc('0x30'),this[_0xdbcc('0xc')][_0xdabeb2['device']]);}else if(_[_0xdbcc('0x3e')](_0xdabeb2[_0xdbcc('0x33')],'Local')){var _0x3c4427=_0xdabeb2['device'];var _0x58d954=_0x3c4427[_0xdbcc('0x3f')](_0x3c4427[_0xdbcc('0x40')]('/')+0x1,_0x3c4427[_0xdbcc('0x40')]('@'));var _0x139ae2=_[_0xdbcc('0x28')](this['agents'],function(_0x20750a){return _0x20750a[_0xdbcc('0x41')]==_0x58d954||_0x20750a[_0xdbcc('0x42')]==_0x58d954||_0x20750a['accountcode']==_0x58d954;});if(_0x139ae2){if(_0x139ae2[_0xdbcc('0x25')]!==_0xdabeb2[_0xdbcc('0x25')][_0xdbcc('0x36')]()){_0x139ae2[_0xdbcc('0x3a')]=_['toNumber'](moment()[_0xdbcc('0x38')]('x'));}_0x139ae2[_0xdbcc('0x25')]=_0xdabeb2[_0xdbcc('0x25')][_0xdbcc('0x36')]();_0x139ae2[_0xdbcc('0x35')]=!![];_0x139ae2[_0xdbcc('0x39')](_0xdabeb2);}}}}catch(_0x4a1de3){logger[_0xdbcc('0x1a')](_0xdbcc('0x34'),util[_0xdbcc('0x1d')](_0x4a1de3,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x4e410a){try{if(this['isNotNull'](_0x4e410a)&&this[_0xdbcc('0x23')](_0x4e410a[_0xdbcc('0x15')])){logger[_0xdbcc('0x31')](_0xdbcc('0x43'),_0x4e410a[_0xdbcc('0x44')],_0x4e410a['address'],_0x4e410a[_0xdbcc('0x15')]);logger[_0xdbcc('0x26')](_0xdbcc('0x45'),util[_0xdbcc('0x1d')](_0x4e410a,{'showHidden':![],'depth':null}));if(this[_0xdbcc('0xd')][_0x4e410a['peer']]){if(!this[_0xdbcc('0xd')][_0x4e410a[_0xdbcc('0x44')]]['local']||_0x4e410a['peerstatus']['toLowerCase']()==_0xdbcc('0x46')){this[_0xdbcc('0xd')][_0x4e410a[_0xdbcc('0x44')]]['local']=![];this[_0xdbcc('0xd')][_0x4e410a['peer']][_0xdbcc('0x47')]=_0x4e410a[_0xdbcc('0x15')][_0xdbcc('0x36')]();this[_0xdbcc('0xd')][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x48')]=_0x4e410a['address'];this[_0xdbcc('0xd')][_0x4e410a[_0xdbcc('0x44')]]['updateStatusRealtime'](_0x4e410a);}}else if(this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]]){this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x47')]=_0x4e410a[_0xdbcc('0x15')][_0xdbcc('0x36')]();this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]]['address']=_0x4e410a['address'];logger[_0xdbcc('0x26')](_0xdbcc('0x49'),util[_0xdbcc('0x1d')](this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xdbcc('0x38')](_0xdbcc('0x3b'),this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x2f')]),'telephone:save',this[_0xdbcc('0xe')][_0x4e410a[_0xdbcc('0x44')]]);}else if(this[_0xdbcc('0xc')][_0x4e410a['peer']]){this['trunks'][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x47')]=_0x4e410a[_0xdbcc('0x15')][_0xdbcc('0x36')]();this['trunks'][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x48')]=_0x4e410a[_0xdbcc('0x48')];logger[_0xdbcc('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xdbcc('0x1d')](this[_0xdbcc('0xc')][_0x4e410a['peer']],{'showHidden':![],'depth':null}));this[_0xdbcc('0x22')](util['format'](_0xdbcc('0x4a'),this[_0xdbcc('0xc')][_0x4e410a[_0xdbcc('0x44')]][_0xdbcc('0x2f')]),_0xdbcc('0x30'),this[_0xdbcc('0xc')][_0x4e410a[_0xdbcc('0x44')]]);}}}catch(_0x509f36){logger[_0xdbcc('0x1a')]('[userReport][peerstatus]',util[_0xdbcc('0x1d')](_0x509f36,{'showHidden':![],'depth':null}));}};module[_0xdbcc('0x4b')]=UserReport; \ No newline at end of file +var _0x28c3=['util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','toLowerCase','inuse','local','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment'];(function(_0x3c6940,_0x3907ac){var _0x428a77=function(_0x4e184f){while(--_0x4e184f){_0x3c6940['push'](_0x3c6940['shift']());}};_0x428a77(++_0x3907ac);}(_0x28c3,0x189));var _0x328c=function(_0x5ef318,_0x4e4a43){_0x5ef318=_0x5ef318-0x0;var _0x5f1f71=_0x28c3[_0x5ef318];return _0x5f1f71;};'use strict';var _=require(_0x328c('0x0'));var moment=require(_0x328c('0x1'));var util=require(_0x328c('0x2'));var Redis=require(_0x328c('0x3'));var BPromise=require(_0x328c('0x4'));var config=require('../../../config/environment');var logger=require(_0x328c('0x5'))(_0x328c('0x6'));var ami=require(_0x328c('0x7'));config[_0x328c('0x8')]=_[_0x328c('0x9')](config[_0x328c('0x8')],{'host':_0x328c('0xa'),'port':0x18eb});var io=require(_0x328c('0xb'))(new Redis(config[_0x328c('0x8')]));function UserReport(_0x3bd1c3){this[_0x328c('0xc')]=_0x3bd1c3['trunks'];this['agents']=_0x3bd1c3['agents'];this[_0x328c('0xd')]=_0x3bd1c3[_0x328c('0xd')];ami['on'](_0x328c('0xe'),this[_0x328c('0xf')][_0x328c('0x10')](this));ami['on'](_0x328c('0x11'),this[_0x328c('0xf')][_0x328c('0x10')](this));ami['on']('devicestatechange',this[_0x328c('0x12')]['bind'](this));ami['on'](_0x328c('0x13'),this[_0x328c('0x14')][_0x328c('0x10')](this));return this[_0x328c('0x15')]();}function showSipRegistrations(){Promise[_0x328c('0x16')]()['then'](ami[_0x328c('0x17')]())[_0x328c('0x18')](function(_0x35bc56){logger[_0x328c('0x19')]('[userReport][sipshowregistry]',util[_0x328c('0x1a')](_0x35bc56,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x328c('0x16')]()[_0x328c('0x1b')](ami[_0x328c('0x1c')]())[_0x328c('0x18')](function(_0x1c29de){logger[_0x328c('0x19')](_0x328c('0x1d'),util[_0x328c('0x1a')](_0x1c29de,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x328c('0x16')]()[_0x328c('0x1b')](ami[_0x328c('0x1e')]())['catch'](function(_0x21ebf7){logger[_0x328c('0x19')](_0x328c('0x1f'),util[_0x328c('0x1a')](_0x21ebf7,{'showHidden':![],'depth':null}));});}UserReport[_0x328c('0x20')][_0x328c('0x15')]=function(){setInterval(function(){BPromise[_0x328c('0x16')]()[_0x328c('0x1b')](showSipRegistrations())[_0x328c('0x1b')](listDeviceStates())[_0x328c('0x1b')](showPeersStatus());},0x32c8);};UserReport[_0x328c('0x20')][_0x328c('0x21')]=function(_0x2b1fcc){return _0x2b1fcc!==null&&!_[_0x328c('0x22')](_0x2b1fcc);};UserReport['prototype'][_0x328c('0x23')]=function(_0x32fa1f,_0x182880,_0x311b69){io['to'](_0x32fa1f)[_0x328c('0x23')](_0x182880,_0x311b69);};UserReport[_0x328c('0x20')]['syncRegistry']=function(_0x2a7348){try{if(this['isNotNull'](_0x2a7348)){logger[_0x328c('0x24')](_0x328c('0x25'),_0x2a7348['username'],_0x2a7348[_0x328c('0x26')]);logger[_0x328c('0x27')](_0x328c('0x28'),util['inspect'](_0x2a7348,{'showHidden':![],'depth':null}));var _0x136b43=_[_0x328c('0x29')](this['trunks'],{'defaultuser':_0x2a7348[_0x328c('0x2a')]});if(_0x136b43){_0x2a7348[_0x328c('0x2b')]=_0x2a7348[_0x328c('0x26')];_['merge'](_0x136b43,_['omit'](_0x2a7348,[_0x328c('0x2c'),_0x328c('0x2d'),_0x328c('0x2a'),'state']));logger[_0x328c('0x27')](_0x328c('0x2e'),util[_0x328c('0x1a')](_0x136b43,{'showHidden':![],'depth':null}));this['emit'](util[_0x328c('0x2f')]('trunk:%s',_0x136b43[_0x328c('0x30')]),'trunk:save',_0x136b43);}}}catch(_0x586f56){logger[_0x328c('0x19')](_0x328c('0x28'),util['inspect'](_0x586f56,{'showHidden':![],'depth':null}));}};UserReport[_0x328c('0x20')][_0x328c('0x12')]=function(_0x3ddbc9){try{if(this[_0x328c('0x21')](_0x3ddbc9)){logger[_0x328c('0x24')](_0x328c('0x31'),_0x3ddbc9[_0x328c('0x32')],_0x3ddbc9[_0x328c('0x26')]);logger['debug'](_0x328c('0x33'),util['inspect'](_0x3ddbc9,{'showHidden':![],'depth':null}));if(this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]]){if(!this['agents'][_0x3ddbc9[_0x328c('0x32')]]['local']||_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]()==_0x328c('0x36')){this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x37')]=![];if(this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]]['stateTime']=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}this[_0x328c('0x34')][_0x3ddbc9['device']]['state']=_0x3ddbc9[_0x328c('0x26')]['toLowerCase']();this[_0x328c('0x34')][_0x3ddbc9['device']][_0x328c('0x39')](_0x3ddbc9);}}else if(this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]]){if(this[_0x328c('0xd')][_0x3ddbc9['device']][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]()){this['telephones'][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x3a')]=_['toNumber'](moment()['format']('x'));}this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]=_0x3ddbc9['state'][_0x328c('0x35')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x328c('0x1a')](this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]],{'showHidden':![],'depth':null}));this[_0x328c('0x23')](util['format'](_0x328c('0x3b'),this['telephones'][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x30')]),_0x328c('0x3c'),this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]]);}else if(this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]]){if(this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x3a')]=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}this[_0x328c('0xc')][_0x3ddbc9['device']]['state']=_0x3ddbc9[_0x328c('0x26')]['toLowerCase']();logger['debug'](_0x328c('0x3d'),util[_0x328c('0x1a')](this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x328c('0x2f')](_0x328c('0x3e'),this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x30')]),_0x328c('0x3f'),this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]]);}else if(_[_0x328c('0x40')](_0x3ddbc9[_0x328c('0x32')],_0x328c('0x41'))){var _0x48450f=_0x3ddbc9[_0x328c('0x32')];var _0x3c9617=_0x48450f[_0x328c('0x42')](_0x48450f[_0x328c('0x43')]('/')+0x1,_0x48450f[_0x328c('0x43')]('@'));var _0xdf4f7d=_['find'](this[_0x328c('0x34')],function(_0x14b30d){return _0x14b30d[_0x328c('0x44')]==_0x3c9617||_0x14b30d['phone']==_0x3c9617||_0x14b30d[_0x328c('0x45')]==_0x3c9617;});if(_0xdf4f7d){if(_0xdf4f7d[_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){_0xdf4f7d[_0x328c('0x3a')]=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}_0xdf4f7d[_0x328c('0x26')]=_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]();_0xdf4f7d[_0x328c('0x37')]=!![];_0xdf4f7d[_0x328c('0x39')](_0x3ddbc9);}}}}catch(_0x375a1a){logger['error']('[userReport][devicestatechange]',util['inspect'](_0x375a1a,{'showHidden':![],'depth':null}));}};UserReport[_0x328c('0x20')][_0x328c('0x14')]=function(_0x46915c){try{if(this[_0x328c('0x21')](_0x46915c)&&this[_0x328c('0x21')](_0x46915c['peerstatus'])){logger['info'](_0x328c('0x46'),_0x46915c['peer'],_0x46915c[_0x328c('0x47')],_0x46915c[_0x328c('0x13')]);logger[_0x328c('0x27')](_0x328c('0x48'),util['inspect'](_0x46915c,{'showHidden':![],'depth':null}));if(this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]]){if(!this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x37')]||_0x46915c[_0x328c('0x13')][_0x328c('0x35')]()==_0x328c('0x4a')){this[_0x328c('0x34')][_0x46915c['peer']][_0x328c('0x37')]=![];this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c[_0x328c('0x13')][_0x328c('0x35')]();this[_0x328c('0x34')][_0x46915c['peer']][_0x328c('0x47')]=_0x46915c['address'];this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x39')](_0x46915c);}}else if(this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]]){this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c['peerstatus']['toLowerCase']();this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x47')]=_0x46915c[_0x328c('0x47')];logger['debug'](_0x328c('0x4c'),util['inspect'](this['telephones'][_0x46915c['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x328c('0x3b'),this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x30')]),_0x328c('0x3c'),this[_0x328c('0xd')][_0x46915c['peer']]);}else if(this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]]){this['trunks'][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c['peerstatus']['toLowerCase']();this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]]['address']=_0x46915c['address'];logger[_0x328c('0x27')](_0x328c('0x4d'),util[_0x328c('0x1a')](this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]],{'showHidden':![],'depth':null}));this[_0x328c('0x23')](util[_0x328c('0x2f')](_0x328c('0x3e'),this[_0x328c('0xc')][_0x46915c['peer']][_0x328c('0x30')]),_0x328c('0x3f'),this['trunks'][_0x46915c[_0x328c('0x49')]]);}}}catch(_0x30d67e){logger[_0x328c('0x19')](_0x328c('0x48'),util['inspect'](_0x30d67e,{'showHidden':![],'depth':null}));}};module[_0x328c('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7029cf4..2320f75 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 _0x13fa=['user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','substring','[%s][voiceAgentReport][musiconholdstop]','exports','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','agentringnoanswer','bind','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','emit','prototype','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','variables','voice','merge','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','interface','calleridnum','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','holdtime','connect','routealias','pick','[%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','agentringnoanswerAt','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','omit','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x13fa,0xc3));var _0xa13f=function(_0x155413,_0x1c89b4){_0x155413=_0x155413-0x0;var _0x434c71=_0x13fa[_0x155413];return _0x434c71;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xa13f('0x0'));var config=require(_0xa13f('0x1'));var logger=require(_0xa13f('0x2'))(_0xa13f('0x3'));var ami=require('../ami');config[_0xa13f('0x4')]=_[_0xa13f('0x5')](config[_0xa13f('0x4')],{'host':_0xa13f('0x6'),'port':0x18eb});var io=require(_0xa13f('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x521d74){this[_0xa13f('0x8')]={};this[_0xa13f('0x9')]=_0x521d74[_0xa13f('0x8')];this[_0xa13f('0xa')]=_0x521d74['voiceQueues'];this[_0xa13f('0xb')]=_0x521d74[_0xa13f('0xb')];this['variables']={};ami['on'](_0xa13f('0xc'),this[_0xa13f('0xd')]['bind'](this));ami['on'](_0xa13f('0xe'),this['syncAgentConnect']['bind'](this));ami['on'](_0xa13f('0xf'),this['syncAgentRingNoAnswer'][_0xa13f('0x10')](this));ami['on']('queuecallerabandon',this[_0xa13f('0x11')][_0xa13f('0x10')](this));ami['on'](_0xa13f('0x12'),this[_0xa13f('0x13')][_0xa13f('0x10')](this));ami['on'](_0xa13f('0x14'),this[_0xa13f('0x15')][_0xa13f('0x10')](this));ami['on']('hangup',this[_0xa13f('0x16')][_0xa13f('0x10')](this));ami['on'](_0xa13f('0x17'),this[_0xa13f('0x18')]['bind'](this));ami['on'](_0xa13f('0x19'),this[_0xa13f('0x1a')]['bind'](this));ami['on'](_0xa13f('0x1b'),this['syncAttendedTransfer'][_0xa13f('0x10')](this));ami['on'](_0xa13f('0x1c'),this['syncBlindTransfer'][_0xa13f('0x10')](this));}VoiceAgentReport['prototype']['emit']=function(_0x1dbcab,_0x335fdf,_0x45e50c){io['to'](_0x1dbcab)[_0xa13f('0x1d')](_0x335fdf,_0x45e50c);};VoiceAgentReport[_0xa13f('0x1e')]['isNotNull']=function(_0x371e05){return _0x371e05!==null&&!_[_0xa13f('0x1f')](_0x371e05);};VoiceAgentReport[_0xa13f('0x1e')]['syncAgentCalled']=function(_0x6872eb){try{if(this[_0xa13f('0x20')](_0x6872eb)){logger[_0xa13f('0x21')](_0xa13f('0x22'),_0x6872eb[_0xa13f('0x23')],_0x6872eb[_0xa13f('0x24')],_0x6872eb[_0xa13f('0x25')]);logger[_0xa13f('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x6872eb[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x6872eb,{'showHidden':![],'depth':null}));if(_[_0xa13f('0x1f')](this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]])){this['channels'][_0x6872eb[_0xa13f('0x23')]]={};}if(_[_0xa13f('0x1f')](this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb[_0xa13f('0x25')]])){this[_0xa13f('0x8')][_0x6872eb['uniqueid']][_0x6872eb['destuniqueid']]={'agentcalledAt':moment()[_0xa13f('0x28')](_0xa13f('0x29')),'lastevent':_0xa13f('0x2a'),'mandatoryDisposition':this[_0xa13f('0xa')][_0x6872eb[_0xa13f('0x2b')]]?this[_0xa13f('0xa')][_0x6872eb[_0xa13f('0x2b')]][_0xa13f('0x2c')]||![]:![],'type':this[_0xa13f('0xa')][_0x6872eb['queue']]?this[_0xa13f('0xa')][_0x6872eb['queue']]['type']||_0xa13f('0x2d'):'inbound','variables':this[_0xa13f('0x2e')][_0x6872eb[_0xa13f('0x23')]],'motionChannel':_0xa13f('0x2f')};}_[_0xa13f('0x30')](this['channels'][_0x6872eb[_0xa13f('0x23')]][_0x6872eb[_0xa13f('0x25')]],_['omit'](_0x6872eb,[_0xa13f('0x31'),'privilege']));logger['debug'](_0xa13f('0x32'),_0x6872eb[_0xa13f('0x23')],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')]('custom:agentcalled',this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb['destuniqueid']]);var _0x469577={'id':this[_0xa13f('0xb')][_0x6872eb[_0xa13f('0x33')]]['id'],'calleridnum':this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb[_0xa13f('0x25')]][_0xa13f('0x34')],'queue':this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb[_0xa13f('0x25')]][_0xa13f('0x2b')],'variables':this[_0xa13f('0x8')][_0x6872eb[_0xa13f('0x23')]][_0x6872eb[_0xa13f('0x25')]][_0xa13f('0x2e')]};logger[_0xa13f('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x6872eb['uniqueid'],util[_0xa13f('0x27')](_0x469577,{'showHidden':![],'depth':null}));this[_0xa13f('0x1d')](util['format'](_0xa13f('0x35'),_0x6872eb[_0xa13f('0x24')]),_0xa13f('0x36'),_0x469577);}}catch(_0x2341c1){logger['error'](_0xa13f('0x37'),_0x6872eb[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x2341c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x38')]=function(_0x55c665){try{if(this[_0xa13f('0x20')](_0x55c665)){if(this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]]){logger[_0xa13f('0x26')](_0xa13f('0x39'),_0x55c665[_0xa13f('0x23')],util['inspect'](_0x55c665,{'showHidden':![],'depth':null}));for(var _0x368c76 in this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]]){if(this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0xa13f('0x3a')](_0x368c76)){if(_0x55c665['destuniqueid']===_0x368c76){logger[_0xa13f('0x21')](_0xa13f('0x3b'),_0x55c665[_0xa13f('0x23')],_0x55c665[_0xa13f('0x24')],_0x55c665[_0xa13f('0x25')]);this['channels'][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x3c')]=moment()[_0xa13f('0x28')](_0xa13f('0x29'));this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x3d')]=_0x55c665[_0xa13f('0x3d')];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76]['connectedlinenum']=_0x55c665[_0xa13f('0x3e')];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x3f')]=_0x55c665[_0xa13f('0x3f')];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76]['destchannelstatedesc']=_0x55c665['destchannelstatedesc'];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x40')]=_0x55c665[_0xa13f('0x40')];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76]['lastevent']=_0xa13f('0x41');if(this[_0xa13f('0x9')][this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x23')]]){var _0x5d2cf4=this[_0xa13f('0x9')][this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x368c76]['uniqueid']][_0xa13f('0x42')];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x42')]=_0x5d2cf4;_0x55c665[_0xa13f('0x42')]=_0x5d2cf4;}_['merge'](this[_0xa13f('0xb')][_0x55c665[_0xa13f('0x33')]],_[_0xa13f('0x43')](_0x55c665,[_0xa13f('0x2b'),'destconnectedlinenum',_0xa13f('0x42')]));logger['debug'](_0xa13f('0x44'),_0x55c665[_0xa13f('0x23')],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x55c665[_0xa13f('0x25')]],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')](_0xa13f('0x45'),this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x55c665[_0xa13f('0x25')]]);logger[_0xa13f('0x26')](_0xa13f('0x46'),_0x55c665[_0xa13f('0x23')],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x55c665[_0xa13f('0x25')]],{'showHidden':![],'depth':null}));this[_0xa13f('0x1d')](util[_0xa13f('0x28')]('user:%s',_0x55c665['membername']),_0xa13f('0x47'),this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x55c665[_0xa13f('0x25')]]);}else if(!this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x368c76][_0xa13f('0xf')]&&!this['channels'][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x12')]){logger['info'](_0xa13f('0x48'),_0x55c665[_0xa13f('0x23')],this['channels'][_0x55c665['uniqueid']][_0x368c76][_0xa13f('0x24')],_0x368c76);this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x368c76]['agentringnoanswer']=!![];this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76][_0xa13f('0x49')]=moment()[_0xa13f('0x28')](_0xa13f('0x29'));this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x368c76]['answeredelsewheredestinationuniqueid']=_0x55c665[_0xa13f('0x25')];this['channels'][_0x55c665['uniqueid']][_0x368c76]['answeredelsewheremembername']=_0x55c665[_0xa13f('0x24')];this[_0xa13f('0x8')][_0x55c665['uniqueid']][_0x368c76][_0xa13f('0x4a')]=_0xa13f('0x4b');this['channels'][_0x55c665['uniqueid']][_0x368c76][_0xa13f('0x4c')]=_0xa13f('0x4b');logger[_0xa13f('0x26')](_0xa13f('0x4d'),_0x55c665[_0xa13f('0x23')],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')]('custom:agentansweredelsewhere',this[_0xa13f('0x8')][_0x55c665[_0xa13f('0x23')]][_0x368c76]);}}}}}}catch(_0x2e7911){logger[_0xa13f('0x4e')](_0xa13f('0x4f'),_0x55c665[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x2e7911,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x50')]=function(_0x827f2c){try{if(this[_0xa13f('0x20')](_0x827f2c)){logger['debug'](_0xa13f('0x51'),_0x827f2c[_0xa13f('0x23')],util['inspect'](_0x827f2c,{'showHidden':![],'depth':null}));if(this['channels'][_0x827f2c[_0xa13f('0x23')]]&&this['channels'][_0x827f2c['uniqueid']][_0x827f2c['destuniqueid']]){logger[_0xa13f('0x21')](_0xa13f('0x52'),_0x827f2c[_0xa13f('0x23')],_0x827f2c['membername'],_0x827f2c['destuniqueid']);this[_0xa13f('0x8')][_0x827f2c['uniqueid']][_0x827f2c[_0xa13f('0x25')]][_0xa13f('0xf')]=!![];this[_0xa13f('0x8')][_0x827f2c[_0xa13f('0x23')]][_0x827f2c[_0xa13f('0x25')]][_0xa13f('0x49')]=moment()['format'](_0xa13f('0x29'));this['channels'][_0x827f2c['uniqueid']][_0x827f2c[_0xa13f('0x25')]][_0xa13f('0x4a')]=_0xa13f('0x53');this[_0xa13f('0x8')][_0x827f2c[_0xa13f('0x23')]][_0x827f2c[_0xa13f('0x25')]][_0xa13f('0x4c')]=_0xa13f('0x53');logger[_0xa13f('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x827f2c[_0xa13f('0x23')],util['inspect'](this[_0xa13f('0x8')][_0x827f2c['uniqueid']][_0x827f2c[_0xa13f('0x25')]],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')](_0xa13f('0x54'),this[_0xa13f('0x8')][_0x827f2c[_0xa13f('0x23')]][_0x827f2c[_0xa13f('0x25')]]);}}}catch(_0x5806be){logger[_0xa13f('0x4e')]('[%s][voiceAgentReport][agentringnoanswer]',_0x827f2c[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x5806be,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')]['syncQueueCallerAbandon']=function(_0x2c1072){try{if(this[_0xa13f('0x20')](_0x2c1072)){logger[_0xa13f('0x26')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x2c1072[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x2c1072,{'showHidden':![],'depth':null}));if(this[_0xa13f('0x8')][_0x2c1072['uniqueid']]){for(var _0x403955 in this['channels'][_0x2c1072[_0xa13f('0x23')]]){if(this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]]['hasOwnProperty'](_0x403955)&&!this[_0xa13f('0x8')][_0x2c1072['uniqueid']][_0x403955][_0xa13f('0xf')]&&!this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955][_0xa13f('0x12')]){logger[_0xa13f('0x21')](_0xa13f('0x55'),_0x2c1072['uniqueid'],this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955][_0xa13f('0x24')],_0x403955);this['channels'][_0x2c1072[_0xa13f('0x23')]][_0x403955][_0xa13f('0xf')]=!![];this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955]['agentringnoanswerAt']=moment()[_0xa13f('0x28')](_0xa13f('0x29'));this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955][_0xa13f('0x4a')]=_0xa13f('0x56');this['channels'][_0x2c1072[_0xa13f('0x23')]][_0x403955][_0xa13f('0x4c')]=_0xa13f('0x56');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2c1072['uniqueid'],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')](_0xa13f('0x57'),this[_0xa13f('0x8')][_0x2c1072[_0xa13f('0x23')]][_0x403955]);}}}}}catch(_0x12973d){logger[_0xa13f('0x4e')](_0xa13f('0x58'),_0x2c1072[_0xa13f('0x23')],util['inspect'](_0x12973d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa13f('0x13')]=function(_0x30b3ac){try{if(this['isNotNull'](_0x30b3ac)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x30b3ac[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x30b3ac,{'showHidden':![],'depth':null}));if(this['channels'][_0x30b3ac[_0xa13f('0x23')]]){for(var _0x5d3057 in this['channels'][_0x30b3ac['uniqueid']]){if(this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]]['hasOwnProperty'](_0x5d3057)){if(this['channels'][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x3c')]&&!this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x12')]){logger[_0xa13f('0x21')](_0xa13f('0x59'),_0x30b3ac[_0xa13f('0x23')],this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x24')],_0x5d3057);this['channels'][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x12')]=!![];this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x5a')]=moment()['format'](_0xa13f('0x29'));this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x4a')]=_0xa13f('0x5b');this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057][_0xa13f('0x4c')]=_0x30b3ac['reason']==_0xa13f('0x5c')?'agent':_0x30b3ac[_0xa13f('0x4c')];this[_0xa13f('0x8')][_0x30b3ac['uniqueid']][_0x5d3057]['talktime']=_0x30b3ac[_0xa13f('0x5d')];if(this[_0xa13f('0xa')][_0x30b3ac[_0xa13f('0x2b')]]&&this[_0xa13f('0xa')][_0x30b3ac[_0xa13f('0x2b')]][_0xa13f('0x5e')]){this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057]['acwtime']=this[_0xa13f('0xa')][_0x30b3ac['queue']][_0xa13f('0x5f')];this['channels'][_0x30b3ac['uniqueid']][_0x5d3057]['agentacw']=!![];}this['agents'][_0x30b3ac['interface']]=_[_0xa13f('0x60')](this[_0xa13f('0xb')][_0x30b3ac['interface']],['queue',_0xa13f('0x61')]);logger[_0xa13f('0x26')](_0xa13f('0x62'),_0x30b3ac[_0xa13f('0x23')],util[_0xa13f('0x27')](this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057],{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')](_0xa13f('0x63'),this[_0xa13f('0x8')][_0x30b3ac[_0xa13f('0x23')]][_0x5d3057]);logger[_0xa13f('0x26')](_0xa13f('0x64'),_0x30b3ac[_0xa13f('0x23')],util[_0xa13f('0x27')]({'id':this['agents'][_0x30b3ac[_0xa13f('0x33')]]['id'],'destaccountcode':_0x30b3ac['destaccountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0xa13f('0x28')](_0xa13f('0x35'),_0x30b3ac['membername']),_0xa13f('0x65'),{'id':this[_0xa13f('0xb')][_0x30b3ac[_0xa13f('0x33')]]['id'],'destaccountcode':_0x30b3ac[_0xa13f('0x66')]});}}}}}}catch(_0x46dcf0){logger[_0xa13f('0x4e')](_0xa13f('0x67'),_0x30b3ac[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x46dcf0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x15')]=function(_0xb467d9){try{if(this[_0xa13f('0x20')](_0xb467d9)){logger[_0xa13f('0x26')]('[%s][voiceAgentReport][varset]\x20event:',_0xb467d9[_0xa13f('0x23')],util[_0xa13f('0x27')](_0xb467d9,{'showHidden':![],'depth':null}));this[_0xa13f('0x68')](_0xb467d9[_0xa13f('0x23')],_[_0xa13f('0x69')](_0xb467d9[_0xa13f('0x6a')])[0x0],_0xb467d9[_0xa13f('0x6b')]);if(this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]]){for(var _0x3aa8dc in this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]]){if(this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]][_0xa13f('0x3a')](_0x3aa8dc)){logger['info'](_0xa13f('0x6c'),_0xb467d9[_0xa13f('0x23')],_0x3aa8dc,_[_0xa13f('0x69')](_0xb467d9['variable'])[0x0],_0xb467d9[_0xa13f('0x6b')]);if(_[_0xa13f('0x1f')](this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]][_0x3aa8dc][_0xa13f('0x2e')])){this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]][_0x3aa8dc][_0xa13f('0x2e')]={};}this[_0xa13f('0x8')][_0xb467d9[_0xa13f('0x23')]][_0x3aa8dc][_0xa13f('0x2e')]=this[_0xa13f('0x2e')][_0xb467d9[_0xa13f('0x23')]];}}}}}catch(_0x3c8ba5){logger[_0xa13f('0x4e')](_0xa13f('0x6d'),_0xb467d9[_0xa13f('0x23')],util['inspect'](_0x3c8ba5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x68')]=function(_0x2f1c21,_0x1a0675,_0x5d0f1b){var _0x1b48f3=['rtpaudioqos',_0xa13f('0x6e'),_0xa13f('0x6f'),_0xa13f('0x70'),_0xa13f('0x71'),_0xa13f('0x72'),_0xa13f('0x73'),_0xa13f('0x74'),'sipcallid','sipuri',_0xa13f('0x75'),_0xa13f('0x76'),_0xa13f('0x77'),_0xa13f('0x78'),'memberinterface',_0xa13f('0x79'),_0xa13f('0x24'),_0xa13f('0x7a'),_0xa13f('0x7b')];if(!_[_0xa13f('0x7c')](_0x1a0675)&&!_['includes'](_0x1b48f3,_0x1a0675)){if(_['isUndefined'](this[_0xa13f('0x2e')][_0x2f1c21])){this['variables'][_0x2f1c21]={};}this[_0xa13f('0x2e')][_0x2f1c21][_0x1a0675]=_0x5d0f1b;}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x16')]=function(_0xdddc6c){try{if(this[_0xa13f('0x20')](_0xdddc6c)){logger[_0xa13f('0x26')](_0xa13f('0x7d'),_0xdddc6c['uniqueid'],util[_0xa13f('0x27')](_0xdddc6c,{'showHidden':![],'depth':null}));if(this[_0xa13f('0x8')][_0xdddc6c[_0xa13f('0x23')]]){for(var _0xfb12ce in this[_0xa13f('0x8')][_0xdddc6c['uniqueid']]){if(this[_0xa13f('0x8')][_0xdddc6c[_0xa13f('0x23')]][_0xa13f('0x3a')](_0xfb12ce)){if(this[_0xa13f('0x8')][_0xdddc6c[_0xa13f('0x23')]][_0xfb12ce][_0xa13f('0x4c')]==_0xa13f('0x5c')&&this[_0xa13f('0x8')][_0xdddc6c['uniqueid']][_0xfb12ce][_0xa13f('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0xdddc6c[_0xa13f('0x23')],_0xfb12ce);this['channels'][_0xdddc6c[_0xa13f('0x23')]][_0xfb12ce][_0xa13f('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xa13f('0x26')](_0xa13f('0x7e'),_0xdddc6c[_0xa13f('0x23')],util[_0xa13f('0x27')](_[_0xa13f('0x7f')](this[_0xa13f('0x8')][_0xdddc6c[_0xa13f('0x23')]]),{'showHidden':![],'depth':null}));ami[_0xa13f('0x1d')](_0xa13f('0x80'),_['values'](this[_0xa13f('0x8')][_0xdddc6c[_0xa13f('0x23')]]));delete this['channels'][_0xdddc6c[_0xa13f('0x23')]];}if(this['variables'][_0xdddc6c[_0xa13f('0x23')]]){delete this['variables'][_0xdddc6c[_0xa13f('0x23')]];}}}catch(_0x593b09){logger[_0xa13f('0x4e')]('[%s][voiceAgentReport][hangup]',_0xdddc6c['uniqueid'],util[_0xa13f('0x27')](_0x593b09,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')]['syncAttendedTransfer']=function(_0x2cf005){try{if(this[_0xa13f('0x20')](_0x2cf005)){logger[_0xa13f('0x26')](_0xa13f('0x81'),_0x2cf005['uniqueid'],util[_0xa13f('0x27')](_0x2cf005,{'showHidden':![],'depth':null}));if(this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]]){for(var _0x18c860 in this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]]){if(this['channels'][_0x2cf005[_0xa13f('0x82')]][_0xa13f('0x3a')](_0x18c860)){if(_0x2cf005['origtransfereruniqueid']===_0x18c860){logger[_0xa13f('0x21')](_0xa13f('0x83'),_0x2cf005[_0xa13f('0x23')],this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x24')],_0x18c860);var _0x1b4741=moment();this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x12')]=!![];this[_0xa13f('0x8')][_0x2cf005['transfereeuniqueid']][_0x18c860][_0xa13f('0x5a')]=moment()[_0xa13f('0x28')](_0xa13f('0x29'));this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x4a')]=_0xa13f('0x5b');this['channels'][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x4c')]=_0xa13f('0x5c');this['channels'][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x5d')]=_0x1b4741[_0xa13f('0x84')](this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]][_0x18c860][_0xa13f('0x3c')],_0xa13f('0x85'));}}}}if(this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x86')]]){var _0x2700c8=this[_0xa13f('0x8')][_0x2cf005['secondtransfereruniqueid']];this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x86')]]=this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]];this[_0xa13f('0x8')][_0x2cf005[_0xa13f('0x82')]]=_0x2700c8;}}}catch(_0x2db9c9){logger['error'](_0xa13f('0x87'),_0x2cf005[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x2db9c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa13f('0x88')]=function(_0x3f74ef){try{if(this['isNotNull'](_0x3f74ef)){logger['debug'](_0xa13f('0x89'),_0x3f74ef['uniqueid'],util[_0xa13f('0x27')](_0x3f74ef,{'showHidden':![],'depth':null}));if(this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]]){for(var _0x52ebf2 in this[_0xa13f('0x8')][_0x3f74ef['transfereeuniqueid']]){if(this['channels'][_0x3f74ef[_0xa13f('0x82')]]['hasOwnProperty'](_0x52ebf2)){if(_0x3f74ef[_0xa13f('0x8a')]===_0x52ebf2){logger['info'](_0xa13f('0x8b'),_0x3f74ef['uniqueid'],this['channels'][_0x3f74ef['transfereeuniqueid']][_0x52ebf2][_0xa13f('0x24')],_0x52ebf2);var _0x54267f=moment();this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2][_0xa13f('0x12')]=!![];this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2][_0xa13f('0x5a')]=_0x54267f;this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2][_0xa13f('0x4a')]=_0xa13f('0x5b');this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2]['reason']=_0xa13f('0x5c');this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2][_0xa13f('0x5d')]=_0x54267f[_0xa13f('0x84')](this[_0xa13f('0x8')][_0x3f74ef[_0xa13f('0x82')]][_0x52ebf2][_0xa13f('0x3c')],'seconds');}}}}}}catch(_0x4e621f){logger[_0xa13f('0x4e')]('[%s][voiceAgentReport][blindtransfer]',_0x3f74ef[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x4e621f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')][_0xa13f('0x18')]=function(_0x40293d){var _0x2d52e2='';try{if(this[_0xa13f('0x20')](_0x40293d)){logger[_0xa13f('0x26')](_0xa13f('0x8c'),_0x40293d[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x40293d,{'showHidden':![],'depth':null}));if(_0x40293d[_0xa13f('0x8d')]){_0x2d52e2=_0x40293d[_0xa13f('0x8d')]['substring'](0x0,_0x40293d[_0xa13f('0x8d')][_0xa13f('0x8e')]('-'));if(this['agents'][_0x2d52e2]){logger[_0xa13f('0x21')](_0xa13f('0x8f'),_0x40293d['uniqueid'],_0x2d52e2);this['agents'][_0x2d52e2]['onhold']=!![];}}}}catch(_0x143cac){logger[_0xa13f('0x4e')](_0xa13f('0x90'),_0x40293d[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x143cac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa13f('0x1e')]['syncMusicOnHoldStop']=function(_0x5a6f79){var _0x3c5b94='';try{if(this[_0xa13f('0x20')](_0x5a6f79)){logger[_0xa13f('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5a6f79[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x5a6f79,{'showHidden':![],'depth':null}));if(_0x5a6f79[_0xa13f('0x8d')]){_0x3c5b94=_0x5a6f79[_0xa13f('0x8d')][_0xa13f('0x91')](0x0,_0x5a6f79['channel'][_0xa13f('0x8e')]('-'));if(this[_0xa13f('0xb')][_0x3c5b94]){logger[_0xa13f('0x21')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x5a6f79[_0xa13f('0x23')],_0x3c5b94);this[_0xa13f('0xb')][_0x3c5b94]['onhold']=![];}}}}catch(_0x25292b){logger[_0xa13f('0x4e')](_0xa13f('0x92'),_0x5a6f79[_0xa13f('0x23')],util[_0xa13f('0x27')](_0x25292b,{'showHidden':![],'depth':null}));}};module[_0xa13f('0x93')]=VoiceAgentReport; \ No newline at end of file +var _0x5a89=['inbound','variables','voice','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type'];(function(_0x33e94d,_0x3b8527){var _0x4b4373=function(_0x3c472b){while(--_0x3c472b){_0x33e94d['push'](_0x33e94d['shift']());}};_0x4b4373(++_0x3b8527);}(_0x5a89,0x6d));var _0x95a8=function(_0x23c466,_0x3243f3){_0x23c466=_0x23c466-0x0;var _0x146a6a=_0x5a89[_0x23c466];return _0x146a6a;};'use strict';var _=require(_0x95a8('0x0'));var moment=require(_0x95a8('0x1'));var util=require(_0x95a8('0x2'));var Redis=require(_0x95a8('0x3'));var config=require(_0x95a8('0x4'));var logger=require(_0x95a8('0x5'))(_0x95a8('0x6'));var ami=require(_0x95a8('0x7'));config[_0x95a8('0x8')]=_[_0x95a8('0x9')](config[_0x95a8('0x8')],{'host':_0x95a8('0xa'),'port':0x18eb});var io=require(_0x95a8('0xb'))(new Redis(config[_0x95a8('0x8')]));function VoiceAgentReport(_0x5aa5f5){this[_0x95a8('0xc')]={};this[_0x95a8('0xd')]=_0x5aa5f5[_0x95a8('0xc')];this[_0x95a8('0xe')]=_0x5aa5f5[_0x95a8('0xe')];this['agents']=_0x5aa5f5[_0x95a8('0xf')];this['variables']={};ami['on'](_0x95a8('0x10'),this[_0x95a8('0x11')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x13'),this[_0x95a8('0x14')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x15'),this[_0x95a8('0x16')][_0x95a8('0x12')](this));ami['on']('queuecallerabandon',this[_0x95a8('0x17')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x18'),this[_0x95a8('0x19')][_0x95a8('0x12')](this));ami['on']('varset',this[_0x95a8('0x1a')][_0x95a8('0x12')](this));ami['on']('hangup',this[_0x95a8('0x1b')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1c'),this['syncMusicOnHoldStart'][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1d'),this['syncMusicOnHoldStop'][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1e'),this[_0x95a8('0x1f')][_0x95a8('0x12')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0x95a8('0x20')]=function(_0x3af717,_0x2371f5,_0x786d9){io['to'](_0x3af717)[_0x95a8('0x20')](_0x2371f5,_0x786d9);};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x22')]=function(_0x17f0af){return _0x17f0af!==null&&!_[_0x95a8('0x23')](_0x17f0af);};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x11')]=function(_0x408c98){try{if(this[_0x95a8('0x22')](_0x408c98)){logger[_0x95a8('0x24')](_0x95a8('0x25'),_0x408c98[_0x95a8('0x26')],_0x408c98['membername'],_0x408c98[_0x95a8('0x27')]);logger['debug'](_0x95a8('0x28'),_0x408c98['uniqueid'],util[_0x95a8('0x29')](_0x408c98,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x408c98[_0x95a8('0x26')]])){this['channels'][_0x408c98[_0x95a8('0x26')]]={};}if(_[_0x95a8('0x23')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]])){this['channels'][_0x408c98['uniqueid']][_0x408c98[_0x95a8('0x27')]]={'agentcalledAt':moment()[_0x95a8('0x2a')](_0x95a8('0x2b')),'lastevent':_0x95a8('0x2c'),'mandatoryDisposition':this[_0x95a8('0xe')][_0x408c98[_0x95a8('0x2d')]]?this[_0x95a8('0xe')][_0x408c98['queue']][_0x95a8('0x2e')]||![]:![],'type':this[_0x95a8('0xe')][_0x408c98['queue']]?this['voiceQueues'][_0x408c98[_0x95a8('0x2d')]][_0x95a8('0x2f')]||'inbound':_0x95a8('0x30'),'variables':this[_0x95a8('0x31')][_0x408c98[_0x95a8('0x26')]],'motionChannel':_0x95a8('0x32')};}_[_0x95a8('0x33')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98['destuniqueid']],_[_0x95a8('0x34')](_0x408c98,[_0x95a8('0x35'),_0x95a8('0x36')]));logger[_0x95a8('0x37')](_0x95a8('0x38'),_0x408c98['uniqueid'],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x39'),this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]]);var _0x3e8112={'id':this[_0x95a8('0xf')][_0x408c98['interface']]['id'],'calleridnum':this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]][_0x95a8('0x3a')],'queue':this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]]['queue'],'variables':this[_0x95a8('0xc')][_0x408c98['uniqueid']][_0x408c98[_0x95a8('0x27')]][_0x95a8('0x31')]};logger[_0x95a8('0x37')](_0x95a8('0x3b'),_0x408c98[_0x95a8('0x26')],util['inspect'](_0x3e8112,{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util['format'](_0x95a8('0x3c'),_0x408c98[_0x95a8('0x3d')]),_0x95a8('0x3e'),_0x3e8112);}}catch(_0x34b821){logger[_0x95a8('0x3f')](_0x95a8('0x40'),_0x408c98[_0x95a8('0x26')],util['inspect'](_0x34b821,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')]['syncAgentConnect']=function(_0xdee35b){try{if(this[_0x95a8('0x22')](_0xdee35b)){if(this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]]){logger[_0x95a8('0x37')](_0x95a8('0x41'),_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](_0xdee35b,{'showHidden':![],'depth':null}));for(var _0x191131 in this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]]){if(this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x95a8('0x42')](_0x191131)){if(_0xdee35b[_0x95a8('0x27')]===_0x191131){logger[_0x95a8('0x24')](_0x95a8('0x43'),_0xdee35b[_0x95a8('0x26')],_0xdee35b[_0x95a8('0x3d')],_0xdee35b[_0x95a8('0x27')]);this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x44')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131][_0x95a8('0x45')]=_0xdee35b['connectedlinename'];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131]['connectedlinenum']=_0xdee35b[_0x95a8('0x46')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x47')]=_0xdee35b['destchannelstate'];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x48')]=_0xdee35b[_0x95a8('0x48')];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x49')]=_0xdee35b[_0x95a8('0x49')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x4a')]=_0x95a8('0x4b');if(this['voiceChannels'][this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x26')]]){var _0x5cf682=this[_0x95a8('0xd')][this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x26')]][_0x95a8('0x4c')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x4c')]=_0x5cf682;_0xdee35b[_0x95a8('0x4c')]=_0x5cf682;}_[_0x95a8('0x33')](this[_0x95a8('0xf')][_0xdee35b[_0x95a8('0x4d')]],_['pick'](_0xdee35b,[_0x95a8('0x2d'),_0x95a8('0x4e'),_0x95a8('0x4c')]));logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0xdee35b[_0x95a8('0x26')],util['inspect'](this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x4f'),this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]]);logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](this['channels'][_0xdee35b[_0x95a8('0x26')]][_0xdee35b['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util[_0x95a8('0x2a')](_0x95a8('0x3c'),_0xdee35b['membername']),_0x95a8('0x50'),this['channels'][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]]);}else if(!this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x15')]&&!this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x51'),_0xdee35b[_0x95a8('0x26')],this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x3d')],_0x191131);this['channels'][_0xdee35b['uniqueid']][_0x191131][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['agentringnoanswerAt']=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['answeredelsewheredestinationuniqueid']=_0xdee35b['destuniqueid'];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131]['answeredelsewheremembername']=_0xdee35b['membername'];this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['lastevent']=_0x95a8('0x52');this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x53')]=_0x95a8('0x52');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x54'),this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131]);}}}}}}catch(_0x43a185){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][agentconnect]',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x43a185,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')]['syncAgentRingNoAnswer']=function(_0x27ad26){try{if(this['isNotNull'](_0x27ad26)){logger[_0x95a8('0x37')](_0x95a8('0x55'),_0x27ad26[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x27ad26,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x27ad26['uniqueid']]&&this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26['destuniqueid']]){logger[_0x95a8('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x27ad26[_0x95a8('0x26')],_0x27ad26[_0x95a8('0x3d')],_0x27ad26['destuniqueid']);this['channels'][_0x27ad26[_0x95a8('0x26')]][_0x27ad26['destuniqueid']][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x56')]=moment()[_0x95a8('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x27ad26['uniqueid']][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x4a')]=_0x95a8('0x57');this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x53')]=_0x95a8('0x57');logger[_0x95a8('0x37')](_0x95a8('0x58'),_0x27ad26['uniqueid'],util[_0x95a8('0x29')](this['channels'][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x59'),this[_0x95a8('0xc')][_0x27ad26['uniqueid']][_0x27ad26['destuniqueid']]);}}}catch(_0x4da94e){logger[_0x95a8('0x3f')](_0x95a8('0x5a'),_0x27ad26['uniqueid'],util['inspect'](_0x4da94e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x17')]=function(_0x45dd25){try{if(this[_0x95a8('0x22')](_0x45dd25)){logger[_0x95a8('0x37')](_0x95a8('0x5b'),_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x45dd25,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x45dd25['uniqueid']]){for(var _0x20dc90 in this[_0x95a8('0xc')][_0x45dd25['uniqueid']]){if(this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x95a8('0x42')](_0x20dc90)&&!this[_0x95a8('0xc')][_0x45dd25['uniqueid']][_0x20dc90][_0x95a8('0x15')]&&!this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x18')]){logger['info'](_0x95a8('0x5c'),_0x45dd25[_0x95a8('0x26')],this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x3d')],_0x20dc90);this['channels'][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90]['agentringnoanswerAt']=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x4a')]=_0x95a8('0x5d');this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x53')]=_0x95a8('0x5d');logger[_0x95a8('0x37')](_0x95a8('0x5e'),_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90],{'showHidden':![],'depth':null}));ami['emit'](_0x95a8('0x5f'),this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90]);}}}}}catch(_0x5eeeea){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][queuecallerabandon]',_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x5eeeea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x19')]=function(_0x595a81){try{if(this['isNotNull'](_0x595a81)){logger[_0x95a8('0x37')](_0x95a8('0x60'),_0x595a81[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x595a81,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]]){for(var _0x245bc9 in this[_0x95a8('0xc')][_0x595a81['uniqueid']]){if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]]['hasOwnProperty'](_0x245bc9)){if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x44')]&&!this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x61'),_0x595a81['uniqueid'],this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x3d')],_0x245bc9);this[_0x95a8('0xc')][_0x595a81['uniqueid']][_0x245bc9][_0x95a8('0x18')]=!![];this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x4a')]=_0x95a8('0x63');this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9]['reason']=_0x595a81['reason']==_0x95a8('0x64')?_0x95a8('0x65'):_0x595a81[_0x95a8('0x53')];this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x66')]=_0x595a81['talktime'];if(this['voiceQueues'][_0x595a81[_0x95a8('0x2d')]]&&this[_0x95a8('0xe')][_0x595a81[_0x95a8('0x2d')]][_0x95a8('0x67')]){this[_0x95a8('0xc')][_0x595a81['uniqueid']][_0x245bc9]['acwtime']=this['voiceQueues'][_0x595a81[_0x95a8('0x2d')]]['acwTimeout'];this['channels'][_0x595a81['uniqueid']][_0x245bc9]['agentacw']=!![];}this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]=_['omit'](this[_0x95a8('0xf')][_0x595a81['interface']],[_0x95a8('0x2d'),_0x95a8('0x4e')]);logger['debug'](_0x95a8('0x68'),_0x595a81['uniqueid'],util['inspect'](this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x69'),this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9]);logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x595a81[_0x95a8('0x26')],util[_0x95a8('0x29')]({'id':this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]['id'],'destaccountcode':_0x595a81[_0x95a8('0x6a')]},{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util['format'](_0x95a8('0x3c'),_0x595a81['membername']),_0x95a8('0x6b'),{'id':this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]['id'],'destaccountcode':_0x595a81[_0x95a8('0x6a')]});}}}}}}catch(_0x4ba618){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][agentcomplete]',_0x595a81[_0x95a8('0x26')],util['inspect'](_0x4ba618,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1a')]=function(_0x3ded54){try{if(this[_0x95a8('0x22')](_0x3ded54)){logger[_0x95a8('0x37')]('[%s][voiceAgentReport][varset]\x20event:',_0x3ded54['uniqueid'],util[_0x95a8('0x29')](_0x3ded54,{'showHidden':![],'depth':null}));this['addVariable'](_0x3ded54[_0x95a8('0x26')],_[_0x95a8('0x6c')](_0x3ded54[_0x95a8('0x6d')])[0x0],_0x3ded54[_0x95a8('0x6e')]);if(this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]]){for(var _0x46599f in this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]]){if(this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x95a8('0x42')](_0x46599f)){logger[_0x95a8('0x24')](_0x95a8('0x6f'),_0x3ded54['uniqueid'],_0x46599f,_['keys'](_0x3ded54[_0x95a8('0x6d')])[0x0],_0x3ded54[_0x95a8('0x6e')]);if(_['isUndefined'](this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x46599f][_0x95a8('0x31')])){this[_0x95a8('0xc')][_0x3ded54['uniqueid']][_0x46599f][_0x95a8('0x31')]={};}this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x46599f][_0x95a8('0x31')]=this['variables'][_0x3ded54[_0x95a8('0x26')]];}}}}}catch(_0x4c20f9){logger['error'](_0x95a8('0x70'),_0x3ded54['uniqueid'],util[_0x95a8('0x29')](_0x4c20f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x71')]=function(_0x702c7f,_0x52654c,_0x48004c){var _0x27e6a8=['rtpaudioqos',_0x95a8('0x72'),_0x95a8('0x73'),'rtpaudioqosjitterbridged',_0x95a8('0x74'),_0x95a8('0x75'),_0x95a8('0x76'),'rtpaudioqosrttbridged','sipcallid',_0x95a8('0x77'),_0x95a8('0x78'),_0x95a8('0x79'),_0x95a8('0x7a'),_0x95a8('0x7b'),_0x95a8('0x7c'),_0x95a8('0x7d'),_0x95a8('0x3d'),_0x95a8('0x7e'),_0x95a8('0x7f')];if(!_['isNil'](_0x52654c)&&!_[_0x95a8('0x80')](_0x27e6a8,_0x52654c)){if(_[_0x95a8('0x23')](this[_0x95a8('0x31')][_0x702c7f])){this[_0x95a8('0x31')][_0x702c7f]={};}this[_0x95a8('0x31')][_0x702c7f][_0x52654c]=_0x48004c;}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1b')]=function(_0x289798){try{if(this[_0x95a8('0x22')](_0x289798)){logger[_0x95a8('0x37')]('[%s][voiceAgentReport][hangup]\x20event:',_0x289798[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x289798,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]){for(var _0x727dd9 in this[_0x95a8('0xc')][_0x289798['uniqueid']]){if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]['hasOwnProperty'](_0x727dd9)){if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x53')]=='transfer'&&this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x81'),_0x289798[_0x95a8('0x26')],_0x727dd9);this['channels'][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));}}}logger['debug'](_0x95a8('0x82'),_0x289798['uniqueid'],util['inspect'](_[_0x95a8('0x83')](this['channels'][_0x289798[_0x95a8('0x26')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_['values'](this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]));delete this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]];}if(this['variables'][_0x289798[_0x95a8('0x26')]]){delete this[_0x95a8('0x31')][_0x289798[_0x95a8('0x26')]];}}}catch(_0x322355){logger['error'](_0x95a8('0x84'),_0x289798[_0x95a8('0x26')],util['inspect'](_0x322355,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1f')]=function(_0x437453){try{if(this[_0x95a8('0x22')](_0x437453)){logger[_0x95a8('0x37')](_0x95a8('0x85'),_0x437453[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x437453,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]){for(var _0x3385ed in this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]){if(this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x95a8('0x42')](_0x3385ed)){if(_0x437453['origtransfereruniqueid']===_0x3385ed){logger[_0x95a8('0x24')](_0x95a8('0x87'),_0x437453[_0x95a8('0x26')],this['channels'][_0x437453['transfereeuniqueid']][_0x3385ed][_0x95a8('0x3d')],_0x3385ed);var _0x4a9f38=moment();this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x18')]=!![];this['channels'][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this['channels'][_0x437453[_0x95a8('0x86')]][_0x3385ed]['lastevent']=_0x95a8('0x63');this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x53')]='transfer';this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x66')]=_0x4a9f38[_0x95a8('0x88')](this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x44')],_0x95a8('0x89'));}}}}if(this[_0x95a8('0xc')][_0x437453['secondtransfereruniqueid']]){var _0x178c57=this['channels'][_0x437453[_0x95a8('0x8a')]];this['channels'][_0x437453[_0x95a8('0x8a')]]=this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]];this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]=_0x178c57;}}}catch(_0x4bdc6c){logger[_0x95a8('0x3f')](_0x95a8('0x8b'),_0x437453[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x4bdc6c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x8c')]=function(_0x21b20c){try{if(this['isNotNull'](_0x21b20c)){logger['debug'](_0x95a8('0x8d'),_0x21b20c[_0x95a8('0x26')],util['inspect'](_0x21b20c,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]]){for(var _0x2e05cb in this['channels'][_0x21b20c['transfereeuniqueid']]){if(this['channels'][_0x21b20c['transfereeuniqueid']][_0x95a8('0x42')](_0x2e05cb)){if(_0x21b20c[_0x95a8('0x8e')]===_0x2e05cb){logger[_0x95a8('0x24')](_0x95a8('0x8f'),_0x21b20c[_0x95a8('0x26')],this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['membername'],_0x2e05cb);var _0xb73db1=moment();this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb][_0x95a8('0x18')]=!![];this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['agentcompleteAt']=_0xb73db1;this[_0x95a8('0xc')][_0x21b20c['transfereeuniqueid']][_0x2e05cb][_0x95a8('0x4a')]=_0x95a8('0x63');this['channels'][_0x21b20c['transfereeuniqueid']][_0x2e05cb]['reason']=_0x95a8('0x64');this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['talktime']=_0xb73db1[_0x95a8('0x88')](this[_0x95a8('0xc')][_0x21b20c['transfereeuniqueid']][_0x2e05cb][_0x95a8('0x44')],_0x95a8('0x89'));}}}}}}catch(_0x58ea0c){logger[_0x95a8('0x3f')](_0x95a8('0x90'),_0x21b20c[_0x95a8('0x26')],util['inspect'](_0x58ea0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x91')]=function(_0x47ac61){var _0x3a86c7='';try{if(this['isNotNull'](_0x47ac61)){logger[_0x95a8('0x37')](_0x95a8('0x92'),_0x47ac61[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x47ac61,{'showHidden':![],'depth':null}));if(_0x47ac61[_0x95a8('0x93')]){_0x3a86c7=_0x47ac61[_0x95a8('0x93')][_0x95a8('0x94')](0x0,_0x47ac61[_0x95a8('0x93')][_0x95a8('0x95')]('-'));if(this[_0x95a8('0xf')][_0x3a86c7]){logger[_0x95a8('0x24')](_0x95a8('0x96'),_0x47ac61[_0x95a8('0x26')],_0x3a86c7);this[_0x95a8('0xf')][_0x3a86c7]['onhold']=!![];}}}}catch(_0x5c063f){logger[_0x95a8('0x3f')](_0x95a8('0x97'),_0x47ac61[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x5c063f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x98')]=function(_0x3537ee){var _0x103818='';try{if(this['isNotNull'](_0x3537ee)){logger['debug'](_0x95a8('0x99'),_0x3537ee[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x3537ee,{'showHidden':![],'depth':null}));if(_0x3537ee[_0x95a8('0x93')]){_0x103818=_0x3537ee[_0x95a8('0x93')][_0x95a8('0x94')](0x0,_0x3537ee[_0x95a8('0x93')]['lastIndexOf']('-'));if(this[_0x95a8('0xf')][_0x103818]){logger['info'](_0x95a8('0x9a'),_0x3537ee[_0x95a8('0x26')],_0x103818);this[_0x95a8('0xf')][_0x103818]['onhold']=![];}}}}catch(_0x356e92){logger[_0x95a8('0x3f')](_0x95a8('0x9b'),_0x3537ee[_0x95a8('0x26')],util['inspect'](_0x356e92,{'showHidden':![],'depth':null}));}};module[_0x95a8('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a9e6eb2..1e48f8f 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 _0x8ce3=['mohstarttime','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isUndefined','emit','isNotNull','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','keys','context','from-sip','channel','xcally-motion-preview','split','destconnectedlinenum','format','user:%s','name','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','merge','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','appdata','applicationdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','lastapplication','set','toLowerCase','cdr(','type','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','connectedlinename','destinationchannel','UserId','membername','seconds','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','user:agentcomplete','length','resolve','then','transferType','undefined','isEmpty','Action','StopMixMonitor','catch','finally','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','origtransferercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfereruniqueid','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2a94cf,_0x2b970d){_0x2a94cf=_0x2a94cf-0x0;var _0x22147f=_0x8ce3[_0x2a94cf];return _0x22147f;};'use strict';var _=require(_0x38ce('0x0'));var moment=require(_0x38ce('0x1'));var util=require('util');var path=require(_0x38ce('0x2'));var Redis=require(_0x38ce('0x3'));var config=require(_0x38ce('0x4'));var logger=require(_0x38ce('0x5'))(_0x38ce('0x6'));var ami=require(_0x38ce('0x7'));var Channel=require(_0x38ce('0x8'));var RpcSetting=require(_0x38ce('0x9'));var applications=['set',_0x38ce('0xa'),_0x38ce('0xb'),'dial',_0x38ce('0xc'),_0x38ce('0xd')];var dispositions=[_0x38ce('0xe'),'FAILED',_0x38ce('0xf'),'NO\x20ANSWER',_0x38ce('0xe'),'NO\x20ANSWER',_0x38ce('0x10'),_0x38ce('0x11'),_0x38ce('0xf'),_0x38ce('0xf'),_0x38ce('0xf')];config[_0x38ce('0x12')]=_[_0x38ce('0x13')](config[_0x38ce('0x12')],{'host':_0x38ce('0x14'),'port':0x18eb});var io=require(_0x38ce('0x15'))(new Redis(config[_0x38ce('0x12')]));function VoiceCallReport(_0x3ef662){this[_0x38ce('0x16')]=_0x3ef662[_0x38ce('0x16')];this[_0x38ce('0x17')]=_0x3ef662[_0x38ce('0x17')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0x38ce('0x18')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x1a'),this['syncNewExten'][_0x38ce('0x19')](this));ami['on']('newchannel',this[_0x38ce('0x1b')][_0x38ce('0x19')](this));ami['on']('newstate',this[_0x38ce('0x1c')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x1d'),this['syncVarSet'][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x1e'),this[_0x38ce('0x1f')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x20'),this[_0x38ce('0x21')][_0x38ce('0x19')](this));ami['on']('attendedtransfer',this[_0x38ce('0x22')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x23'),this[_0x38ce('0x24')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x25'),this[_0x38ce('0x26')][_0x38ce('0x19')](this));ami['on'](_0x38ce('0x27'),this[_0x38ce('0x28')][_0x38ce('0x19')](this));try{logger['info'](_0x38ce('0x29'));ami[_0x38ce('0x2a')]();}catch(_0xe40e9c){logger[_0x38ce('0x2b')]('[voiceCallReport][coreshowchannels]',util[_0x38ce('0x2c')](_0xe40e9c,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x38ce('0x2d')]['isNotNull']=function(_0xe0af00){return _0xe0af00!==null&&!_[_0x38ce('0x2e')](_0xe0af00);};VoiceCallReport[_0x38ce('0x2d')]['emit']=function(_0x4a7e8e,_0x3f3516,_0x28ab4c){io['to'](_0x4a7e8e)[_0x38ce('0x2f')](_0x3f3516,_0x28ab4c);};VoiceCallReport[_0x38ce('0x2d')][_0x38ce('0x21')]=function(_0x2a59fe){try{if(this[_0x38ce('0x30')](_0x2a59fe)){logger[_0x38ce('0x31')](_0x38ce('0x32'),_0x2a59fe[_0x38ce('0x33')],_0x2a59fe[_0x38ce('0x34')],_0x2a59fe[_0x38ce('0x35')]);logger['debug'](_0x38ce('0x36'),_0x2a59fe[_0x38ce('0x33')],util['inspect'](_0x2a59fe,{'showHidden':![],'depth':null}));if(_0x2a59fe[_0x38ce('0x33')]===_0x2a59fe[_0x38ce('0x37')]){if(!_['isUndefined'](this[_0x38ce('0x16')][_0x2a59fe[_0x38ce('0x33')]])){_['merge'](this[_0x38ce('0x16')][_0x2a59fe['uniqueid']],_[_0x38ce('0x38')](_0x2a59fe,_[_0x38ce('0x39')](this[_0x38ce('0x16')][_0x2a59fe[_0x38ce('0x33')]])));}}if(_0x2a59fe[_0x38ce('0x3a')]===_0x38ce('0x3b')){if(this[_0x38ce('0x17')][_0x2a59fe[_0x38ce('0x3c')]['split']('-')[0x0]]){if(_0x2a59fe['exten']==_0x38ce('0x3d')){this[_0x38ce('0x17')][_0x2a59fe[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x3f')]=_0x2a59fe['connectedlinenum'];this[_0x38ce('0x2f')](util[_0x38ce('0x40')](_0x38ce('0x41'),this[_0x38ce('0x17')][_0x2a59fe[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x42')]),'user:agentconnect',{'destaccountcode':this[_0x38ce('0x17')][_0x2a59fe[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x43')],'destconnectedlinenum':_0x2a59fe[_0x38ce('0x44')]});}}}}}catch(_0x40c4ae){logger[_0x38ce('0x2b')](_0x38ce('0x45'),_0x2a59fe[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x40c4ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')]['syncNewChannel']=function(_0x3d2c8c){try{if(this[_0x38ce('0x30')](_0x3d2c8c)){logger[_0x38ce('0x46')](_0x38ce('0x47'),_0x3d2c8c['uniqueid'],util[_0x38ce('0x2c')](_0x3d2c8c,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d2c8c[_0x38ce('0x33')]])return;if(_0x3d2c8c[_0x38ce('0x3c')]===_0x38ce('0x48'))return;if(_0x3d2c8c[_0x38ce('0x33')]!==_0x3d2c8c[_0x38ce('0x37')]&&!this[_0x38ce('0x49')][_0x3d2c8c['linkedid']])return;logger[_0x38ce('0x31')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3d2c8c[_0x38ce('0x33')],_0x3d2c8c[_0x38ce('0x3a')],_0x3d2c8c[_0x38ce('0x4a')]);this[_0x38ce('0x16')][_0x3d2c8c[_0x38ce('0x33')]]=new Channel();this[_0x38ce('0x16')][_0x3d2c8c['uniqueid']][_0x38ce('0x4b')]=moment()[_0x38ce('0x40')](_0x38ce('0x4c'));this[_0x38ce('0x16')][_0x3d2c8c[_0x38ce('0x33')]][_0x38ce('0x4d')]=dispositions[_['toNumber'](_0x3d2c8c['channelstate'])];_[_0x38ce('0x4e')](this[_0x38ce('0x16')][_0x3d2c8c[_0x38ce('0x33')]],_[_0x38ce('0x38')](_0x3d2c8c,_[_0x38ce('0x39')](this[_0x38ce('0x16')][_0x3d2c8c[_0x38ce('0x33')]])));if(_0x3d2c8c['context']===_0x38ce('0x3b')){if(this[_0x38ce('0x17')][_0x3d2c8c['channel'][_0x38ce('0x3e')]('-')[0x0]]){if(_[_0x38ce('0x2e')](this[_0x38ce('0x17')][_0x3d2c8c['channel'][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x3f')])){this[_0x38ce('0x17')][_0x3d2c8c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x3f')]=_0x3d2c8c['exten'];logger[_0x38ce('0x46')](_0x38ce('0x4f'),_0x3d2c8c[_0x38ce('0x33')],util[_0x38ce('0x2c')]({'id':this[_0x38ce('0x17')][_0x3d2c8c[_0x38ce('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x38ce('0x17')][_0x3d2c8c[_0x38ce('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3d2c8c['exten']},{'showHidden':![],'depth':null}));this[_0x38ce('0x2f')](util[_0x38ce('0x40')]('user:%s',this['agents'][_0x3d2c8c[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x42')]),'user:agentconnect',{'id':this[_0x38ce('0x17')][_0x3d2c8c[_0x38ce('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x38ce('0x17')][_0x3d2c8c[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x43')],'destconnectedlinenum':_0x3d2c8c[_0x38ce('0x4a')]});}}}}}catch(_0x4c34b9){logger[_0x38ce('0x2b')](_0x38ce('0x50'),_0x3d2c8c[_0x38ce('0x33')],util['inspect'](_0x4c34b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')][_0x38ce('0x18')]=function(_0x53bbc3){try{if(this[_0x38ce('0x30')](_0x53bbc3)){logger[_0x38ce('0x46')](_0x38ce('0x51'),_0x53bbc3[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x53bbc3,{'showHidden':![],'depth':null}));if(_0x53bbc3[_0x38ce('0x3c')]===_0x38ce('0x48')||_0x53bbc3['exten']==='h')return;if(_0x53bbc3[_0x38ce('0x33')]===_0x53bbc3[_0x38ce('0x37')]||this[_0x38ce('0x49')][_0x53bbc3[_0x38ce('0x37')]]){_0x53bbc3[_0x38ce('0x52')]=_0x53bbc3[_0x38ce('0x52')]['toLowerCase']();_0x53bbc3['applicationdata']=_0x53bbc3[_0x38ce('0x53')]||_0x53bbc3[_0x38ce('0x54')];if(_0x53bbc3[_0x38ce('0x53')]&&!_0x53bbc3[_0x38ce('0x53')][_0x38ce('0x55')](_0x38ce('0x56'))&&_0x53bbc3['application']!=='queue'){_0x53bbc3[_0x38ce('0x54')]=_0x53bbc3['applicationdata']['toLowerCase']();}logger[_0x38ce('0x31')](_0x38ce('0x57'),_0x53bbc3[_0x38ce('0x33')],_0x53bbc3[_0x38ce('0x52')],_0x53bbc3[_0x38ce('0x54')]);if(_['isUndefined'](this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]])){this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]]=new Channel();this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]][_0x38ce('0x4b')]=_0x53bbc3[_0x38ce('0x58')]?moment()[_0x38ce('0x59')](moment[_0x38ce('0x58')](_0x53bbc3[_0x38ce('0x58')])['seconds'](),'seconds')[_0x38ce('0x40')](_0x38ce('0x4c')):moment()[_0x38ce('0x40')](_0x38ce('0x4c'));this['channels'][_0x53bbc3[_0x38ce('0x33')]][_0x38ce('0x4d')]=_0x38ce('0xe');}_[_0x38ce('0x4e')](this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]],_[_0x38ce('0x38')](_0x53bbc3,_['keys'](this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]])));if(_['includes'](applications,_0x53bbc3['application'])){this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]][_0x38ce('0x5a')]=_0x53bbc3['application'];this['channels'][_0x53bbc3[_0x38ce('0x33')]]['lastdata']=_0x53bbc3[_0x38ce('0x54')];if(_0x53bbc3[_0x38ce('0x52')]===_0x38ce('0x5b')&&_[_0x38ce('0x55')](_0x53bbc3['applicationdata'][_0x38ce('0x5c')](),_0x38ce('0x5d'))){var _0x255a85=_0x53bbc3['applicationdata'][_0x38ce('0x3e')]('=');var _0x22bf6d=_0x255a85[0x0][_0x38ce('0x5c')]()['match'](/cdr\((.*)\)/);if(_0x22bf6d){if(_0x22bf6d[0x1]===_0x38ce('0x5e')&&!_['isNil'](this[_0x38ce('0x16')][_0x53bbc3['uniqueid']][_0x22bf6d[0x1]]))return;this[_0x38ce('0x16')][_0x53bbc3[_0x38ce('0x33')]][_0x22bf6d[0x1]]=_0x255a85[0x1];}}else if(_0x53bbc3[_0x38ce('0x52')]===_0x38ce('0xa')){this['channels'][_0x53bbc3[_0x38ce('0x33')]][_0x38ce('0xa')]=_0x53bbc3[_0x38ce('0x54')][_0x38ce('0x3e')](',')[0x0];}}}}}catch(_0x3776d5){logger[_0x38ce('0x2b')]('[%s][voiceCallReport][newexten]',_0x53bbc3[_0x38ce('0x33')],util['inspect'](_0x3776d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')][_0x38ce('0x1c')]=function(_0x1687cd){try{if(this[_0x38ce('0x30')](_0x1687cd)){logger[_0x38ce('0x31')](_0x38ce('0x5f'),_0x1687cd[_0x38ce('0x33')],_0x1687cd[_0x38ce('0x37')],_0x1687cd['calleridname'],_0x1687cd[_0x38ce('0x35')]);logger[_0x38ce('0x46')](_0x38ce('0x60'),_0x1687cd[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x1687cd,{'showHidden':![],'depth':null}));if(_0x1687cd[_0x38ce('0x61')]!=='6')return;if(_0x1687cd[_0x38ce('0x33')]!==_0x1687cd[_0x38ce('0x37')]){var _0xf94230=moment();if(this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]]){if(!this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x62')]){this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x62')]=!![];this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x63')]=_0xf94230['format'](_0x38ce('0x4c'));if(this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]]['starttime']){this['channels'][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x64')]=_0xf94230['diff'](this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]]['starttime'],'seconds');}}this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]]['linkedid']=_0x1687cd[_0x38ce('0x33')];if(_0x1687cd[_0x38ce('0x35')]!==_0x38ce('0x3d')){this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x44')]=_0x1687cd[_0x38ce('0x35')];}this[_0x38ce('0x16')][_0x1687cd['linkedid']][_0x38ce('0x65')]=_0x1687cd[_0x38ce('0x34')];this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x66')]=_0x1687cd[_0x38ce('0x3c')];this[_0x38ce('0x16')][_0x1687cd['linkedid']]['disposition']=dispositions[_['toNumber'](_0x1687cd[_0x38ce('0x61')])];if(this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]){this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x67')]=this['agents'][_0x1687cd[_0x38ce('0x3c')]['split']('-')[0x0]]['id'];this['channels'][_0x1687cd['linkedid']][_0x38ce('0x68')]=this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x42')];}}if(this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]]){if(!this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]]['answered']){this[_0x38ce('0x16')][_0x1687cd['uniqueid']][_0x38ce('0x62')]=!![];this[_0x38ce('0x16')][_0x1687cd['uniqueid']][_0x38ce('0x63')]=_0xf94230[_0x38ce('0x40')](_0x38ce('0x4c'));if(this[_0x38ce('0x16')][_0x1687cd['uniqueid']]['starttime']){this['channels'][_0x1687cd['uniqueid']]['holdtime']=_0xf94230['diff'](this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x4b')],_0x38ce('0x69'));}}if(_0x1687cd['calleridnum']!==_0x38ce('0x3d')){this[_0x38ce('0x16')][_0x1687cd['uniqueid']][_0x38ce('0x44')]=_0x1687cd[_0x38ce('0x35')];}this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x65')]=_0x1687cd[_0x38ce('0x34')];this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x66')]=_0x1687cd['channel'];this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x4d')]=dispositions[_['toNumber'](_0x1687cd['channelstate'])];}}else{if(this['channels'][_0x1687cd[_0x38ce('0x33')]]){if(this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]){this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x67')]=this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['id'];this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x68')]=this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x42')];}}}if(_0x1687cd[_0x38ce('0x3a')]===_0x38ce('0x3b')){if(this[_0x38ce('0x17')][_0x1687cd['channel'][_0x38ce('0x3e')]('-')[0x0]]){this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x3f')]=_0x1687cd[_0x38ce('0x4a')];var _0x4343fd,_0x1771d2;if(this['channels'][_0x1687cd[_0x38ce('0x33')]]){_0x4343fd=this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0x6a')];_0x1771d2=this['channels'][_0x1687cd[_0x38ce('0x33')]][_0x38ce('0xa')];}else if(this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]]){_0x4343fd=this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0x6a')];_0x1771d2=this[_0x38ce('0x16')][_0x1687cd[_0x38ce('0x37')]][_0x38ce('0xa')];}logger[_0x38ce('0x46')](_0x38ce('0x6b'),_0x1687cd['uniqueid'],util[_0x38ce('0x2c')]({'id':this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x38ce('0x17')][_0x1687cd['channel']['split']('-')[0x0]][_0x38ce('0x43')],'destconnectedlinenum':_0x1687cd['exten'],'routealias':_0x4343fd,'queue':_0x1771d2||undefined},{'showHidden':![],'depth':null}));this[_0x38ce('0x2f')](util[_0x38ce('0x40')]('user:%s',this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')]['split']('-')[0x0]][_0x38ce('0x42')]),_0x38ce('0x6c'),{'id':this[_0x38ce('0x17')][_0x1687cd[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x38ce('0x17')][_0x1687cd['channel'][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x43')],'destconnectedlinenum':_0x1687cd['exten'],'routealias':_0x4343fd,'queue':_0x1771d2||undefined});}}}}catch(_0x4e8d40){logger[_0x38ce('0x2b')]('[%s][voiceCallReport][newstate]',_0x1687cd[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x4e8d40,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')][_0x38ce('0x6d')]=function(_0x1eab01,_0x20e6a4){try{if(this[_0x38ce('0x16')][_0x1eab01]){logger['info'](_0x38ce('0x6e'),_0x1eab01,_0x20e6a4);this[_0x38ce('0x16')][_0x1eab01][_0x38ce('0x6f')]=!![];if(_['endsWith'](_0x20e6a4,_0x38ce('0x70'))){_0x20e6a4=_0x20e6a4['replace'](_0x38ce('0x70'),_0x38ce('0x71'));}this['channels'][_0x1eab01]['monitorFilename']=_0x20e6a4;var _0x780b13=_['find'](this[_0x38ce('0x16')][_0x1eab01][_0x38ce('0x72')],{'filename':_0x20e6a4});if(_[_0x38ce('0x73')](_0x780b13)){this[_0x38ce('0x16')][_0x1eab01][_0x38ce('0x72')]['push']({'filename':_0x20e6a4,'createdAt':moment()[_0x38ce('0x40')](_0x38ce('0x4c')),'mixmonitorid':'','status':_0x38ce('0x74')});}}}catch(_0x5a70ce){logger['error'](_0x38ce('0x75'),_0x1eab01,util[_0x38ce('0x2c')](_0x5a70ce,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')][_0x38ce('0x76')]=function(_0x5685b0){try{if(this[_0x38ce('0x30')](_0x5685b0)){logger[_0x38ce('0x46')](_0x38ce('0x77'),_0x5685b0[_0x38ce('0x33')],util['inspect'](_0x5685b0,{'showHidden':![],'depth':null}));if(this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]]&&_0x5685b0['channel']!=_0x38ce('0x48')){if(this['isNotNull'](_0x5685b0[_0x38ce('0x78')])){if(this['isNotNull'](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x79')])){logger['info'](_0x38ce('0x7a'),_0x5685b0['uniqueid'],_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x6d')](_0x5685b0['uniqueid'],_0x5685b0[_0x38ce('0x7b')]);}else if(this[_0x38ce('0x30')](_0x5685b0['variable']['xmd-phone'])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5685b0['uniqueid'],_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]]['calleridnum']=_0x5685b0[_0x38ce('0x7b')];}else if(this['isNotNull'](_0x5685b0['variable']['xmd-callerid'])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5685b0[_0x38ce('0x33')],_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]]['callerid']=_0x5685b0[_0x38ce('0x7b')];}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x7c')])){logger[_0x38ce('0x31')](_0x38ce('0x7d'),_0x5685b0['uniqueid'],_0x5685b0[_0x38ce('0x7b')]);this['channels'][_0x5685b0[_0x38ce('0x33')]][_0x38ce('0x5e')]=_0x5685b0[_0x38ce('0x7b')];}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x7e')])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5685b0[_0x38ce('0x33')],_0x5685b0[_0x38ce('0x7b')]['split'](',')[0x0]);this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]]['queue']=_0x5685b0[_0x38ce('0x7b')][_0x38ce('0x3e')](',')[0x0];}else if(this[_0x38ce('0x30')](_0x5685b0['variable'][_0x38ce('0x7f')])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5685b0[_0x38ce('0x33')],_0x5685b0['value']);this[_0x38ce('0x16')][_0x5685b0['uniqueid']][_0x38ce('0x80')]=_0x5685b0[_0x38ce('0x7b')];}else if(this['isNotNull'](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x81')])){logger[_0x38ce('0x31')](_0x38ce('0x82'),_0x5685b0['uniqueid'],_0x5685b0[_0x38ce('0x7b')]);this['channels'][_0x5685b0[_0x38ce('0x33')]][_0x38ce('0x83')]=_0x5685b0[_0x38ce('0x7b')];}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x84')])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5685b0[_0x38ce('0x33')],_0x5685b0['value']);this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]][_0x38ce('0x85')]=_0x5685b0['value'];}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x86')])){logger[_0x38ce('0x31')](_0x38ce('0x87'),_0x5685b0[_0x38ce('0x33')],_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x16')][_0x5685b0[_0x38ce('0x33')]]['queue']=_0x5685b0[_0x38ce('0x7b')];}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x88')])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5685b0[_0x38ce('0x33')],_0x5685b0['value']);this[_0x38ce('0x16')][_0x5685b0['uniqueid']][_0x38ce('0x89')]=_0x5685b0[_0x38ce('0x7b')];}}}else if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x79')])){if(_0x5685b0[_0x38ce('0x7b')]){var _0x504909=path[_0x38ce('0x8a')](_0x5685b0[_0x38ce('0x7b')])[_0x38ce('0x42')];logger['info'](_0x38ce('0x7a'),_0x504909,_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x6d')](_0x504909,_0x5685b0[_0x38ce('0x7b')]);}}else if(this['channels'][_0x5685b0[_0x38ce('0x37')]]){if(this['isNotNull'](_0x5685b0[_0x38ce('0x78')])){if(this[_0x38ce('0x30')](_0x5685b0[_0x38ce('0x78')][_0x38ce('0x88')])){logger[_0x38ce('0x31')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5685b0[_0x38ce('0x37')],_0x5685b0[_0x38ce('0x7b')]);this[_0x38ce('0x16')][_0x5685b0['linkedid']][_0x38ce('0x8b')]=_0x5685b0[_0x38ce('0x7b')];}}}}}catch(_0x50c0e8){logger['error'](_0x38ce('0x8c'),_0x5685b0[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x50c0e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x38ce('0x2d')]['syncHangup']=function(_0x225c9c){try{if(this['isNotNull'](_0x225c9c)){logger['debug'](_0x38ce('0x8d'),_0x225c9c[_0x38ce('0x33')],util[_0x38ce('0x2c')](_0x225c9c,{'showHidden':![],'depth':null}));if(this[_0x38ce('0x49')][_0x225c9c['linkedid']]){if(this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]]){this[_0x38ce('0x16')][this['blindTransfers'][_0x225c9c['linkedid']][_0x38ce('0x37')]][_0x38ce('0x33')]=_0x225c9c[_0x38ce('0x33')];this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]][_0x38ce('0x62')]=this['channels'][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x62')];this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]][_0x38ce('0x63')]=this['channels'][_0x225c9c['uniqueid']]['answertime'];this[_0x38ce('0x16')][this['blindTransfers'][_0x225c9c['linkedid']][_0x38ce('0x37')]][_0x38ce('0x66')]=this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]][_0x38ce('0x3c')];this[_0x38ce('0x16')][this['blindTransfers'][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]][_0x38ce('0x4d')]=this[_0x38ce('0x16')][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x4d')];this['channels'][_0x225c9c[_0x38ce('0x33')]]=this[_0x38ce('0x16')][this['blindTransfers'][_0x225c9c[_0x38ce('0x37')]]['linkedid']];delete this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x37')]];}else if(this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]]){this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]][_0x38ce('0x33')]=[this[_0x38ce('0x16')][this['blindTransfers'][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]][_0x38ce('0x37')],this['channels'][this[_0x38ce('0x49')][_0x225c9c['linkedid']]['uniqueid']][_0x38ce('0x37')]=this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]][_0x38ce('0x33')]][0x0];this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]]['answered']=this[_0x38ce('0x16')][_0x225c9c['uniqueid']]['answered'];this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]][_0x38ce('0x63')]=this[_0x38ce('0x16')][_0x225c9c['uniqueid']][_0x38ce('0x63')];this['channels'][this['blindTransfers'][_0x225c9c['linkedid']][_0x38ce('0x33')]][_0x38ce('0x66')]=this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]][_0x38ce('0x33')]][_0x38ce('0x3c')];this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c['linkedid']]['uniqueid']][_0x38ce('0x4d')]=this[_0x38ce('0x16')][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x4d')];this['channels'][_0x225c9c[_0x38ce('0x33')]]=this[_0x38ce('0x16')][this[_0x38ce('0x49')][_0x225c9c['linkedid']][_0x38ce('0x33')]];delete this['channels'][this[_0x38ce('0x49')][_0x225c9c[_0x38ce('0x37')]]['uniqueid']];}}if(this['channels'][_0x225c9c[_0x38ce('0x33')]]){logger[_0x38ce('0x31')](_0x38ce('0x8e'),_0x225c9c[_0x38ce('0x33')],_0x225c9c[_0x38ce('0x8f')]);var _0x308832=moment();this[_0x38ce('0x16')][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x90')]=_0x308832[_0x38ce('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x58')]=_0x308832[_0x38ce('0x91')](this[_0x38ce('0x16')][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x4b')],_0x38ce('0x69'));if(this[_0x38ce('0x16')][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x62')]){this['channels'][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x92')]=_0x308832[_0x38ce('0x91')](this['channels'][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x63')],_0x38ce('0x69'));this[_0x38ce('0x16')][_0x225c9c['uniqueid']]['holdtime']=this['channels'][_0x225c9c[_0x38ce('0x33')]][_0x38ce('0x58')]-this[_0x38ce('0x16')][_0x225c9c['uniqueid']][_0x38ce('0x92')];}if(_0x225c9c['context']===_0x38ce('0x3b')){if(this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]){this[_0x38ce('0x17')][_0x225c9c['channel'][_0x38ce('0x3e')]('-')[0x0]]=_['omit'](this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]],['destconnectedlinenum']);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x225c9c[_0x38ce('0x33')],util[_0x38ce('0x2c')]({'id':this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x38ce('0x2f')](util[_0x38ce('0x40')](_0x38ce('0x41'),this['agents'][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x42')]),_0x38ce('0x93'),{'id':this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0x38ce('0x17')][_0x225c9c[_0x38ce('0x3c')][_0x38ce('0x3e')]('-')[0x0]][_0x38ce('0x43')]});for(var _0x5acea8=0x0;_0x5acea80x0?_0x1ee36b:0x0;this['voiceQueues'][_0x2bd131[_0x5180('0x68')]][_0x5180('0x5b')]=this['voiceQueues'][_0x2bd131[_0x5180('0x68')]]['talking']>_[_0x5180('0x6c')](_0x2bd131[_0x5180('0x6d')])?_[_0x5180('0x6c')](_0x2bd131[_0x5180('0x6d')]):this[_0x5180('0x10')][_0x2bd131[_0x5180('0x68')]][_0x5180('0x5b')];this[_0x5180('0x54')](this[_0x5180('0x10')][_0x2bd131[_0x5180('0x68')]],_0x5180('0x66'));}logger[_0x5180('0x47')](_0x5180('0x6e'),util[_0x5180('0x41')](this[_0x5180('0x10')][_0x2bd131[_0x5180('0x68')]],{'showHidden':![],'depth':null}));ami[_0x5180('0x46')]('custom:queuesummary',this[_0x5180('0x10')][_0x2bd131['queue']]);}}}catch(_0x20a3a5){logger[_0x5180('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x5180('0x41')](_0x20a3a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0x16')]=function(_0x19bc20){logger['debug'](_0x5180('0x6f'),util[_0x5180('0x41')](_0x19bc20,{'showHidden':![],'depth':null}));ami[_0x5180('0x46')]('custom:queuesummarycomplete',{});this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x5180('0x18')]=function(_0x4dde79){try{if(this[_0x5180('0x67')](_0x4dde79)){logger[_0x5180('0x47')](_0x5180('0x70'),_0x4dde79[_0x5180('0x49')],util[_0x5180('0x41')](_0x4dde79,{'showHidden':![],'depth':null}));if(_[_0x5180('0x71')](this[_0x5180('0xd')][_0x4dde79['uniqueid']]))this[_0x5180('0xd')][_0x4dde79[_0x5180('0x49')]]=[];if(_[_0x5180('0x71')](this[_0x5180('0x35')][_0x4dde79['uniqueid']]))this[_0x5180('0x35')][_0x4dde79['uniqueid']]={};var _0x454c13=new QueueReport();_0x454c13[_0x5180('0x4b')]=_0x4dde79[_0x5180('0x68')];_0x454c13[_0x5180('0x55')]=this[_0x5180('0x10')][_0x454c13[_0x5180('0x4b')]]&&this[_0x5180('0x10')][_0x454c13[_0x5180('0x4b')]][_0x5180('0x55')]?this[_0x5180('0x10')][_0x454c13['name']][_0x5180('0x55')]||_0x5180('0x72'):_0x5180('0x72');_0x454c13[_0x5180('0x68')]=_0x4dde79['queue'];_0x454c13[_0x5180('0x73')]=moment()[_0x5180('0x51')](_0x5180('0x74'));_0x454c13[_0x5180('0x75')]=_0x4dde79[_0x5180('0x75')];_0x454c13[_0x5180('0x76')]=_0x4dde79[_0x5180('0x76')];_0x454c13[_0x5180('0x49')]=_0x4dde79[_0x5180('0x49')];_0x454c13[_0x5180('0x77')]=this[_0x5180('0x35')][_0x4dde79[_0x5180('0x49')]][_0x5180('0x77')];logger[_0x5180('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x454c13[_0x5180('0x4b')],_0x454c13[_0x5180('0x55')]);_[_0x5180('0x78')](_0x454c13,_['pick'](_0x4dde79,_[_0x5180('0x79')](_0x454c13)));this[_0x5180('0xd')][_0x4dde79[_0x5180('0x49')]][_0x5180('0x7a')](_0x454c13);this['channels'][_0x4dde79[_0x5180('0x49')]]=_0x454c13;this[_0x5180('0x7b')](_0x454c13,_0x5180('0x17'));}}catch(_0x4af5a7){logger['error'](_0x5180('0x70'),_0x4dde79[_0x5180('0x49')],util[_0x5180('0x41')](_0x4af5a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5180('0x1a')]=function(_0x2c1dc3){try{if(this[_0x5180('0x67')](_0x2c1dc3)){logger[_0x5180('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2c1dc3[_0x5180('0x49')],util[_0x5180('0x41')](_0x2c1dc3,{'showHidden':![],'depth':null}));if(this[_0x5180('0xd')][_0x2c1dc3[_0x5180('0x49')]]){var _0x115963=_[_0x5180('0x7c')](this[_0x5180('0xd')][_0x2c1dc3['uniqueid']]);_0x115963[_0x5180('0x7d')]=![];_0x115963[_0x5180('0x7e')]=null;_0x115963[_0x5180('0x7f')]=_0x2c1dc3['holdtime'];_0x115963['originalposition']=_0x2c1dc3['originalposition'];_0x115963[_0x5180('0x19')]=!![];_0x115963[_0x5180('0x80')]=moment()['format'](_0x5180('0x74'));_0x115963[_0x5180('0x4f')]=_0x5180('0x81');_0x115963[_0x5180('0x82')]=null;logger[_0x5180('0x6a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x115963[_0x5180('0x4b')],_0x115963['type']);this[_0x5180('0x35')][_0x2c1dc3[_0x5180('0x49')]]=_0x115963;this[_0x5180('0x83')](_0x115963,_0x5180('0x19'));}}}catch(_0x29da42){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x2c1dc3[_0x5180('0x49')],util[_0x5180('0x41')](_0x29da42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0x1c')]=function(_0x5d97a0){try{if(this[_0x5180('0x67')](_0x5d97a0)){logger['debug'](_0x5180('0x84'),_0x5d97a0[_0x5180('0x49')],util['inspect'](_0x5d97a0,{'showHidden':![],'depth':null}));if(this[_0x5180('0xd')][_0x5d97a0[_0x5180('0x49')]]){var _0x40450c=_[_0x5180('0x7c')](this[_0x5180('0xd')][_0x5d97a0[_0x5180('0x49')]]);_0x40450c[_0x5180('0x85')]=moment()[_0x5180('0x51')](_0x5180('0x74'));_0x40450c[_0x5180('0x86')]=_0x5d97a0[_0x5180('0x86')];_0x40450c[_0x5180('0x87')]=_0x5d97a0[_0x5180('0x87')];logger['info'](_0x5180('0x88'),_0x40450c['name'],_0x40450c[_0x5180('0x55')],_0x5d97a0[_0x5180('0x86')],_0x5d97a0[_0x5180('0x87')]);this[_0x5180('0x35')][_0x5d97a0['uniqueid']]=_0x40450c;this['emitVoiceQueueChannelSave'](_0x40450c,_0x5180('0x1b'));}}}catch(_0x1ce2db){logger[_0x5180('0x3f')](_0x5180('0x84'),_0x5d97a0[_0x5180('0x49')],util[_0x5180('0x41')](_0x1ce2db,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0x89')]=function(_0x2b6727){try{if(this['isNotNull'](_0x2b6727)){logger[_0x5180('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x2b6727['uniqueid'],util[_0x5180('0x41')](_0x2b6727,{'showHidden':![],'depth':null}));if(this[_0x5180('0xd')][_0x2b6727[_0x5180('0x49')]]){var _0x8b922d=_[_0x5180('0x7c')](this[_0x5180('0xd')][_0x2b6727[_0x5180('0x49')]]);_0x8b922d['queuecallercomplete']=!![];_0x8b922d[_0x5180('0x4f')]=_0x5180('0x8a');logger[_0x5180('0x6a')](_0x5180('0x8b'),_0x8b922d[_0x5180('0x4b')],_0x8b922d['type']);}}}catch(_0x278a77){logger[_0x5180('0x3f')](_0x5180('0x8c'),_0x2b6727[_0x5180('0x49')],util[_0x5180('0x41')](_0x278a77,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')]['syncAgentComplete']=function(_0x2296ec){try{if(this['isNotNull'](_0x2296ec)){logger[_0x5180('0x47')](_0x5180('0x8d'),_0x2296ec[_0x5180('0x49')],util[_0x5180('0x41')](_0x2296ec,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2296ec[_0x5180('0x49')]]){var _0x62e16a=_[_0x5180('0x7c')](this['queueReports'][_0x2296ec[_0x5180('0x49')]]);_0x62e16a['queuecallerabandon']=![];_0x62e16a[_0x5180('0x80')]=null;_0x62e16a[_0x5180('0x8e')]=!![];_0x62e16a[_0x5180('0x82')]=_0x2296ec[_0x5180('0x8f')];_0x62e16a[_0x5180('0x7f')]=_0x2296ec[_0x5180('0x7f')];_0x62e16a[_0x5180('0x7d')]=!![];_0x62e16a[_0x5180('0x90')]=![];_0x62e16a[_0x5180('0x91')]=null;if(!_0x62e16a['transfer']){if(_0x2296ec[_0x5180('0x92')]==_0x5180('0x93')){_0x62e16a[_0x5180('0x4f')]=_0x5180('0x94');logger['info'](_0x5180('0x95'),_0x62e16a[_0x5180('0x4b')],_0x62e16a[_0x5180('0x55')]);}else{if(_[_0x5180('0x96')](_0x2296ec['channel'][_0x5180('0x97')](),_0x5180('0x98'))){if(this[_0x5180('0xd')][_0x2296ec[_0x5180('0x99')]]){var _0x110cd2=_['last'](this[_0x5180('0xd')][_0x2296ec[_0x5180('0x99')]]);_0x110cd2[_0x5180('0x7d')]=![];_0x110cd2[_0x5180('0x90')]=!![];_0x110cd2[_0x5180('0x91')]=moment(_0x62e16a['queuecallerjoinAt'])[_0x5180('0x9a')](_0x2296ec['holdtime'],_0x5180('0x9b'))[_0x5180('0x51')](_0x5180('0x74'));_0x110cd2[_0x5180('0x4f')]=_0x5180('0x9c');_0x110cd2[_0x5180('0x93')]=!![];_0x110cd2[_0x5180('0x9d')]=_0x5180('0x9e');_0x110cd2[_0x5180('0x9f')]=_0x2296ec[_0x5180('0xa0')];_0x110cd2[_0x5180('0xa1')]=_0x2296ec['uniqueid'];logger[_0x5180('0x6a')](_0x5180('0xa2'),_0x110cd2[_0x5180('0x4b')],_0x110cd2[_0x5180('0x55')]);var _0x5cc966=this[_0x5180('0xd')][_0x2296ec[_0x5180('0x99')]];this['queueReports'][_0x2296ec[_0x5180('0x99')]]=this[_0x5180('0xd')][_0x2296ec['uniqueid']];this[_0x5180('0xd')][_0x2296ec[_0x5180('0x49')]]=_0x5cc966;}}else{_0x62e16a[_0x5180('0x4f')]=_0x5180('0xa3')+_0x2296ec[_0x5180('0x92')][_0x5180('0xa4')]();logger['info'](_0x5180('0xa5'),_0x62e16a[_0x5180('0x4b')],_0x62e16a[_0x5180('0x55')],_0x62e16a[_0x5180('0x4f')]);}}}this[_0x5180('0x35')][_0x2296ec[_0x5180('0x49')]]=_0x62e16a;this[_0x5180('0x83')](_0x62e16a,_0x5180('0x1d'));}}}catch(_0x2fe673){logger['error'](_0x5180('0x8d'),_0x2296ec[_0x5180('0x49')],util[_0x5180('0x41')](_0x2fe673,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0x21')]=function(_0x17eb53){try{if(this['isNotNull'](_0x17eb53)){logger['debug'](_0x5180('0xa6'),_0x17eb53['uniqueid'],util['inspect'](_0x17eb53,{'showHidden':![],'depth':null}));this[_0x5180('0xa7')](_0x17eb53[_0x5180('0x49')],_[_0x5180('0x79')](_0x17eb53[_0x5180('0xa8')])[0x0],_0x17eb53['value']);if(this[_0x5180('0xd')][_0x17eb53[_0x5180('0x49')]]){var _0x12eeae=_[_0x5180('0x7c')](this['queueReports'][_0x17eb53[_0x5180('0x49')]]);if(_0x12eeae){if(this[_0x5180('0x67')](_0x17eb53[_0x5180('0xa8')])&&this[_0x5180('0x67')](_0x17eb53[_0x5180('0xa8')][_0x5180('0xa9')])){switch(_0x17eb53['value']){case _0x5180('0xaa'):_0x12eeae[_0x5180('0x90')]=![];_0x12eeae[_0x5180('0x91')]=null;break;case _0x5180('0xab'):_0x12eeae[_0x5180('0xac')]='timeout';_0x12eeae['queuecallerexit']=!![];_0x12eeae[_0x5180('0x91')]=moment()['format'](_0x5180('0x74'));_0x12eeae[_0x5180('0x85')]=moment()[_0x5180('0x51')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5180('0x47')](_0x5180('0xad'),_0x17eb53[_0x5180('0x49')],util['inspect'](_0x12eeae,{'showHidden':![],'depth':null}));ami[_0x5180('0x46')](_0x5180('0xae'),_0x12eeae);break;default:_0x12eeae[_0x5180('0x90')]=!![];_0x12eeae['queuecallerexitAt']=moment()[_0x5180('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x12eeae[_0x5180('0x85')]=moment()[_0x5180('0x51')](_0x5180('0x74'));}_0x12eeae['queuecallerabandon']=![];_0x12eeae[_0x5180('0x80')]=null;_0x12eeae[_0x5180('0x4f')]=_0x17eb53[_0x5180('0xaf')];this[_0x5180('0x35')][_0x17eb53[_0x5180('0x49')]]=_0x12eeae;this['emitVoiceQueueChannelRemove'](_0x12eeae,_0x5180('0x20'));}else if(this[_0x5180('0x67')](_0x17eb53[_0x5180('0xa8')])&&this['isNotNull'](_0x17eb53[_0x5180('0xa8')][_0x5180('0xb0')])){if(!_0x12eeae[_0x5180('0x19')]){_0x12eeae[_0x5180('0x90')]=!![];_0x12eeae[_0x5180('0x91')]=moment()['format'](_0x5180('0x74'));_0x12eeae[_0x5180('0x4f')]=_0x5180('0xb1');_0x12eeae['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17eb53['uniqueid']]=_0x12eeae;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x17eb53[_0x5180('0x49')],_0x12eeae[_0x5180('0x4b')],_0x12eeae[_0x5180('0x55')],_['keys'](_0x17eb53['variable'])[0x0],_0x17eb53['value']);_0x12eeae[_0x5180('0x13')]=this[_0x5180('0x13')][_0x17eb53[_0x5180('0x49')]];}}}}catch(_0xe14d82){logger[_0x5180('0x3f')](_0x5180('0xa6'),_0x17eb53[_0x5180('0x49')],util[_0x5180('0x41')](_0xe14d82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0xa7')]=function(_0x51e23c,_0x2a6850,_0x1cf177){var _0x25e3ef=[_0x5180('0xb2'),_0x5180('0xb3'),_0x5180('0xb4'),'rtpaudioqosjitterbridged',_0x5180('0xb5'),_0x5180('0xb6'),_0x5180('0xb7'),_0x5180('0xb8'),_0x5180('0xb9'),'sipuri',_0x5180('0xba'),_0x5180('0xbb'),_0x5180('0xbc'),_0x5180('0xbd'),_0x5180('0xbe'),_0x5180('0xbf'),_0x5180('0x8f'),'memberpenalty',_0x5180('0xc0')];if(!_['isNil'](_0x2a6850)&&!_['includes'](_0x25e3ef,_0x2a6850)){if(_[_0x5180('0x71')](this['variables'][_0x51e23c])){this['variables'][_0x51e23c]={};}this[_0x5180('0x13')][_0x51e23c][_0x2a6850]=_0x1cf177;}};VoiceQueueReport[_0x5180('0xa')][_0x5180('0xc1')]=function(_0xd11f3c,_0x3a4bdb,_0x55fecc){var _0x3e5f1f={};for(var _0x205d5d=0x0;_0x205d5d0x0?_0x30b199:0x0;this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]][_0x4495('0x32')]=this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]][_0x4495('0x32')]>_[_0x4495('0x6f')](_0x4f5796[_0x4495('0x70')])?_['toNumber'](_0x4f5796['loggedin']):this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]]['talking'];this[_0x4495('0x71')](this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]],'queuesummary');}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x4495('0x41')](this['voiceQueues'][_0x4f5796[_0x4495('0x6a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4495('0x72'),this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]]);}}}catch(_0x5a09ca){logger['error'](_0x4495('0x68'),util[_0x4495('0x41')](_0x5a09ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1a')]=function(_0x56884a){logger[_0x4495('0x61')](_0x4495('0x73'),util[_0x4495('0x41')](_0x56884a,{'showHidden':![],'depth':null}));ami[_0x4495('0x47')]('custom:queuesummarycomplete',{});this[_0x4495('0x13')]=!![];};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1b')]=function(_0x58e739){try{if(this[_0x4495('0x69')](_0x58e739)){logger[_0x4495('0x61')]('[%s][voiceQueueReport][queuecallerjoin]',_0x58e739[_0x4495('0x4a')],util[_0x4495('0x41')](_0x58e739,{'showHidden':![],'depth':null}));if(_[_0x4495('0x63')](this[_0x4495('0xe')][_0x58e739[_0x4495('0x4a')]]))this['queueReports'][_0x58e739['uniqueid']]=[];if(_[_0x4495('0x63')](this['channels'][_0x58e739['uniqueid']]))this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]={};var _0x4e3b9c=new QueueReport();_0x4e3b9c[_0x4495('0x4d')]=_0x58e739[_0x4495('0x6a')];_0x4e3b9c[_0x4495('0x5b')]=this[_0x4495('0x12')][_0x4e3b9c[_0x4495('0x4d')]]&&this[_0x4495('0x12')][_0x4e3b9c['name']][_0x4495('0x5b')]?this['voiceQueues'][_0x4e3b9c[_0x4495('0x4d')]][_0x4495('0x5b')]||_0x4495('0x74'):_0x4495('0x74');_0x4e3b9c[_0x4495('0x6a')]=_0x58e739[_0x4495('0x6a')];_0x4e3b9c[_0x4495('0x75')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x4e3b9c[_0x4495('0x77')]=_0x58e739[_0x4495('0x77')];_0x4e3b9c[_0x4495('0x78')]=_0x58e739['count'];_0x4e3b9c[_0x4495('0x4a')]=_0x58e739['uniqueid'];_0x4e3b9c[_0x4495('0x79')]=this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]['routealias'];logger[_0x4495('0x6c')](_0x4495('0x7a'),_0x4e3b9c[_0x4495('0x4d')],_0x4e3b9c[_0x4495('0x5b')]);_[_0x4495('0x7b')](_0x4e3b9c,_[_0x4495('0x7c')](_0x58e739,_[_0x4495('0x7d')](_0x4e3b9c)));this[_0x4495('0xe')][_0x58e739[_0x4495('0x4a')]]['push'](_0x4e3b9c);this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]=_0x4e3b9c;this['emitVoiceQueueChannelSave'](_0x4e3b9c,_0x4495('0x7e'));}}catch(_0x3cda72){logger[_0x4495('0x3f')](_0x4495('0x7f'),_0x58e739['uniqueid'],util[_0x4495('0x41')](_0x3cda72,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4495('0x1d')]=function(_0x2f5c7d){try{if(this[_0x4495('0x69')](_0x2f5c7d)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x2f5c7d[_0x4495('0x4a')],util[_0x4495('0x41')](_0x2f5c7d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f5c7d['uniqueid']]){var _0x225e9e=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x2f5c7d['uniqueid']]);_0x225e9e['queuecallercomplete']=![];_0x225e9e[_0x4495('0x81')]=null;_0x225e9e[_0x4495('0x82')]=_0x2f5c7d[_0x4495('0x82')];_0x225e9e[_0x4495('0x83')]=_0x2f5c7d[_0x4495('0x83')];_0x225e9e[_0x4495('0x1c')]=!![];_0x225e9e[_0x4495('0x84')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x225e9e[_0x4495('0x85')]=_0x4495('0x86');_0x225e9e[_0x4495('0x87')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x225e9e[_0x4495('0x4d')],_0x225e9e[_0x4495('0x5b')]);this[_0x4495('0x10')][_0x2f5c7d['uniqueid']]=_0x225e9e;this[_0x4495('0x45')](_0x225e9e,'queuecallerabandon');}}}catch(_0x535878){logger[_0x4495('0x3f')](_0x4495('0x88'),_0x2f5c7d['uniqueid'],util[_0x4495('0x41')](_0x535878,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1f')]=function(_0x57fa7c){try{if(this[_0x4495('0x69')](_0x57fa7c)){logger[_0x4495('0x61')]('[%s][voiceQueueReport][queuecallerleave]',_0x57fa7c[_0x4495('0x4a')],util['inspect'](_0x57fa7c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57fa7c[_0x4495('0x4a')]]){var _0x3516b0=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x57fa7c['uniqueid']]);_0x3516b0[_0x4495('0x89')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x3516b0[_0x4495('0x8a')]=_0x57fa7c[_0x4495('0x8a')];_0x3516b0[_0x4495('0x8b')]=_0x57fa7c[_0x4495('0x8b')];logger[_0x4495('0x6c')](_0x4495('0x8c'),_0x3516b0[_0x4495('0x4d')],_0x3516b0[_0x4495('0x5b')],_0x57fa7c[_0x4495('0x8a')],_0x57fa7c[_0x4495('0x8b')]);this[_0x4495('0x10')][_0x57fa7c['uniqueid']]=_0x3516b0;this[_0x4495('0x48')](_0x3516b0,_0x4495('0x1e'));}}}catch(_0x47d584){logger[_0x4495('0x3f')](_0x4495('0x8d'),_0x57fa7c[_0x4495('0x4a')],util[_0x4495('0x41')](_0x47d584,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x23')]=function(_0x225468){try{if(this[_0x4495('0x69')](_0x225468)){logger['debug'](_0x4495('0x8e'),_0x225468['uniqueid'],util['inspect'](_0x225468,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x225468[_0x4495('0x4a')]]){var _0x3cbec1=_[_0x4495('0x80')](this['queueReports'][_0x225468[_0x4495('0x4a')]]);_0x3cbec1[_0x4495('0x8f')]=!![];_0x3cbec1[_0x4495('0x85')]=_0x4495('0x90');logger[_0x4495('0x6c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3cbec1[_0x4495('0x4d')],_0x3cbec1[_0x4495('0x5b')]);}}}catch(_0x325cd5){logger[_0x4495('0x3f')](_0x4495('0x8e'),_0x225468[_0x4495('0x4a')],util[_0x4495('0x41')](_0x325cd5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')]['syncAgentComplete']=function(_0x1e5574){try{if(this[_0x4495('0x69')](_0x1e5574)){logger['debug'](_0x4495('0x91'),_0x1e5574[_0x4495('0x4a')],util[_0x4495('0x41')](_0x1e5574,{'showHidden':![],'depth':null}));if(this[_0x4495('0xe')][_0x1e5574[_0x4495('0x4a')]]){var _0xe78fdb=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x1e5574['uniqueid']]);_0xe78fdb[_0x4495('0x1c')]=![];_0xe78fdb['queuecallerabandonAt']=null;_0xe78fdb[_0x4495('0x92')]=!![];_0xe78fdb[_0x4495('0x87')]=_0x1e5574[_0x4495('0x93')];_0xe78fdb[_0x4495('0x82')]=_0x1e5574[_0x4495('0x82')];_0xe78fdb[_0x4495('0x8f')]=!![];_0xe78fdb['queuecallerexit']=![];_0xe78fdb[_0x4495('0x94')]=null;if(!_0xe78fdb[_0x4495('0x95')]){if(_0x1e5574[_0x4495('0x96')]=='transfer'){_0xe78fdb[_0x4495('0x85')]=_0x4495('0x97');logger[_0x4495('0x6c')](_0x4495('0x98'),_0xe78fdb[_0x4495('0x4d')],_0xe78fdb[_0x4495('0x5b')]);}else{if(_[_0x4495('0x99')](_0x1e5574[_0x4495('0x3c')][_0x4495('0x9a')](),_0x4495('0x9b'))){if(this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]){var _0x2391e4=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]);_0x2391e4[_0x4495('0x8f')]=![];_0x2391e4['queuecallerexit']=!![];_0x2391e4[_0x4495('0x94')]=moment(_0xe78fdb[_0x4495('0x75')])[_0x4495('0x9d')](_0x1e5574[_0x4495('0x82')],_0x4495('0x9e'))[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2391e4[_0x4495('0x85')]=_0x4495('0x9f');_0x2391e4['transfer']=!![];_0x2391e4[_0x4495('0xa0')]=_0x4495('0xa1');_0x2391e4[_0x4495('0xa2')]=_0x1e5574['destexten'];_0x2391e4['transferuniqueid']=_0x1e5574[_0x4495('0x4a')];logger['info'](_0x4495('0xa3'),_0x2391e4[_0x4495('0x4d')],_0x2391e4[_0x4495('0x5b')]);var _0x1a1121=this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]];this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]=this[_0x4495('0xe')][_0x1e5574[_0x4495('0x4a')]];this['queueReports'][_0x1e5574[_0x4495('0x4a')]]=_0x1a1121;}}else{_0xe78fdb[_0x4495('0x85')]=_0x4495('0xa4')+_0x1e5574[_0x4495('0x96')]['toUpperCase']();logger[_0x4495('0x6c')](_0x4495('0xa5'),_0xe78fdb[_0x4495('0x4d')],_0xe78fdb[_0x4495('0x5b')],_0xe78fdb[_0x4495('0x85')]);}}}this[_0x4495('0x10')][_0x1e5574[_0x4495('0x4a')]]=_0xe78fdb;this[_0x4495('0x45')](_0xe78fdb,_0x4495('0x20'));}}}catch(_0x54a6c8){logger['error'](_0x4495('0x91'),_0x1e5574[_0x4495('0x4a')],util[_0x4495('0x41')](_0x54a6c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x25')]=function(_0x13a397){try{if(this[_0x4495('0x69')](_0x13a397)){logger[_0x4495('0x61')](_0x4495('0xa6'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x13a397,{'showHidden':![],'depth':null}));this[_0x4495('0xa7')](_0x13a397[_0x4495('0x4a')],_[_0x4495('0x7d')](_0x13a397[_0x4495('0xa8')])[0x0],_0x13a397['value']);if(this[_0x4495('0xe')][_0x13a397[_0x4495('0x4a')]]){var _0x1ab80b=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x13a397[_0x4495('0x4a')]]);if(_0x1ab80b){if(this['isNotNull'](_0x13a397[_0x4495('0xa8')])&&this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')][_0x4495('0xa9')])){switch(_0x13a397['value']){case _0x4495('0xaa'):_0x1ab80b[_0x4495('0xab')]=![];_0x1ab80b['queuecallerexitAt']=null;break;case _0x4495('0xac'):_0x1ab80b['lastevent']='timeout';_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b[_0x4495('0x94')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ab80b[_0x4495('0x89')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));logger['debug'](_0x4495('0xad'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x1ab80b,{'showHidden':![],'depth':null}));ami[_0x4495('0x47')](_0x4495('0xae'),_0x1ab80b);break;default:_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b['queuecallerexitAt']=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x1ab80b['queuecallerleaveAt']=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ab80b[_0x4495('0x1c')]=![];_0x1ab80b['queuecallerabandonAt']=null;_0x1ab80b[_0x4495('0x85')]=_0x13a397[_0x4495('0xaf')];this[_0x4495('0x10')][_0x13a397[_0x4495('0x4a')]]=_0x1ab80b;this[_0x4495('0x45')](_0x1ab80b,_0x4495('0x24'));}else if(this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')])&&this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')][_0x4495('0xb0')])){if(!_0x1ab80b[_0x4495('0x1c')]){_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b[_0x4495('0x94')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ab80b[_0x4495('0x85')]=_0x4495('0xb1');_0x1ab80b[_0x4495('0x89')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4495('0x10')][_0x13a397[_0x4495('0x4a')]]=_0x1ab80b;}}logger[_0x4495('0x6c')](_0x4495('0xb2'),_0x13a397['uniqueid'],_0x1ab80b[_0x4495('0x4d')],_0x1ab80b[_0x4495('0x5b')],_[_0x4495('0x7d')](_0x13a397[_0x4495('0xa8')])[0x0],_0x13a397['value']);_0x1ab80b[_0x4495('0x15')]=this[_0x4495('0x15')][_0x13a397[_0x4495('0x4a')]];}}}}catch(_0x245015){logger[_0x4495('0x3f')](_0x4495('0xa6'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x245015,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0xa7')]=function(_0x1e1ea9,_0x37f299,_0x18d360){var _0x16aa3d=[_0x4495('0xb3'),_0x4495('0xb4'),_0x4495('0xb5'),_0x4495('0xb6'),'rtpaudioqosloss',_0x4495('0xb7'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x4495('0xb8'),_0x4495('0xb9'),_0x4495('0xba'),_0x4495('0xbb'),_0x4495('0xbc'),_0x4495('0xbd'),_0x4495('0xbe'),_0x4495('0xbf'),_0x4495('0x93'),_0x4495('0xc0'),_0x4495('0xc1')];if(!_[_0x4495('0xc2')](_0x37f299)&&!_[_0x4495('0xc3')](_0x16aa3d,_0x37f299)){if(_[_0x4495('0x63')](this[_0x4495('0x15')][_0x1e1ea9])){this[_0x4495('0x15')][_0x1e1ea9]={};}this[_0x4495('0x15')][_0x1e1ea9][_0x37f299]=_0x18d360;}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0xc4')]=function(_0x1b660f,_0x9c5b53,_0x1ec652){var _0x12ea81={};for(var _0x5b573e=0x0;_0x5b573e=0x0?moment(_0x215f21['endtime'])[_0xf736('0xe')](_0x215f21['starttime'],_0xf736('0xf')):null,'data1':_0xf736('0x18'),'data2':_0x215f21[_0xf736('0x13')],'data3':_0x215f21[_0xf736('0x11')],'data4':_0x215f21[_0xf736('0x19')]||null,'role':_0xf736('0x1a'),'internal':_0x215f21[_0xf736('0x13')]?_[_0xf736('0x1b')](_0x215f21[_0xf736('0x13')]):undefined,'uniqueid':_0x215f21[_0xf736('0x14')]},'log':_0xf736('0x7')});}; \ No newline at end of file +var _0x4dff=['interface','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','agent','accountcode','voiceDialReport','voice','starttime','endtime','dialstring','toNumber','uniqueid','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','isNil'];(function(_0x1e55e0,_0x22cd30){var _0x5a045d=function(_0x307ea2){while(--_0x307ea2){_0x1e55e0['push'](_0x1e55e0['shift']());}};_0x5a045d(++_0x22cd30);}(_0x4dff,0x157));var _0xf4df=function(_0x4dc0a5,_0x55b07e){_0x4dc0a5=_0x4dc0a5-0x0;var _0x4261e8=_0x4dff[_0x4dc0a5];return _0x4261e8;};'use strict';var moment=require('moment');var _=require(_0xf4df('0x0'));var util=require(_0xf4df('0x1'));var client=require('../client');exports[_0xf4df('0x2')]=function(_0x41f198){var _0x2bf843=_0x41f198[_0xf4df('0x3')]||_0x41f198[_0xf4df('0x4')];return client[_0xf4df('0x5')](_0xf4df('0x6'),{'body':{'channel':'voice','membername':_0x41f198['lastAssignedTo'],'interface':_[_0xf4df('0x7')](_0x41f198[_0xf4df('0x8')])?util['format'](_0xf4df('0x9'),_0x41f198[_0xf4df('0xa')]):_0x41f198[_0xf4df('0x8')],'type':_0xf4df('0xb'),'enterAt':_0x41f198[_0xf4df('0xc')],'exitAt':_0x2bf843,'duration':moment(_0x2bf843)[_0xf4df('0xd')](_0x41f198[_0xf4df('0xc')],_0xf4df('0xe')),'data1':_0xf4df('0xf'),'data2':_0x41f198['calleridnum'],'data3':_0x41f198[_0xf4df('0x10')],'data4':null,'data5':_0x41f198[_0xf4df('0x11')],'role':_0xf4df('0x12'),'internal':_0x41f198[_0xf4df('0x13')]?_['toNumber'](_0x41f198[_0xf4df('0x13')]):undefined,'uniqueid':_0x41f198['uniqueid']},'log':_0xf4df('0x6')});};exports[_0xf4df('0x14')]=function(_0x4a3096){return client[_0xf4df('0x5')](_0xf4df('0x6'),{'body':{'channel':_0xf4df('0x15'),'membername':_0x4a3096['membername'],'interface':_0x4a3096[_0xf4df('0x8')],'type':'TALKING','enterAt':_0x4a3096[_0xf4df('0x16')],'exitAt':_0x4a3096[_0xf4df('0x17')],'duration':moment(_0x4a3096['endtime'])[_0xf4df('0xd')](_0x4a3096[_0xf4df('0x16')],_0xf4df('0xe'))>=0x0?moment(_0x4a3096['endtime'])[_0xf4df('0xd')](_0x4a3096[_0xf4df('0x16')],_0xf4df('0xe')):null,'data1':'outbound','data2':_0x4a3096[_0xf4df('0x13')],'data3':_0x4a3096[_0xf4df('0x10')],'data4':_0x4a3096[_0xf4df('0x18')]||null,'role':_0xf4df('0x12'),'internal':_0x4a3096[_0xf4df('0x13')]?_[_0xf4df('0x19')](_0x4a3096[_0xf4df('0x13')]):undefined,'uniqueid':_0x4a3096[_0xf4df('0x1a')]},'log':_0xf4df('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4acc34b..f874d38 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 _0x6a5f=['stopRecordingOnTransfer','GetSettings','../client','getSettings','ShowSetting'];(function(_0x3c1473,_0x385ef5){var _0x1156e8=function(_0x3510ce){while(--_0x3510ce){_0x3c1473['push'](_0x3c1473['shift']());}};_0x1156e8(++_0x385ef5);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x57fa0b,_0x5df1ce){_0x57fa0b=_0x57fa0b-0x0;var _0x18669f=_0x6a5f[_0x57fa0b];return _0x18669f;};'use strict';var client=require(_0xf6a5('0x0'));exports[_0xf6a5('0x1')]=function(){return client['Request'](_0xf6a5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf6a5('0x3'),'previewRecallmeReminderInterval']},'log':_0xf6a5('0x4')});}; \ No newline at end of file +var _0x00ea=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','Request'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x00ea,0x19d));var _0xa00e=function(_0x397580,_0x281408){_0x397580=_0x397580-0x0;var _0x4d5b6e=_0x00ea[_0x397580];return _0x4d5b6e;};'use strict';var client=require('../client');exports[_0xa00e('0x0')]=function(){return client[_0xa00e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa00e('0x2'),_0xa00e('0x3')]},'log':_0xa00e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index dca1da5..09c5244 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 _0x0e1c=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e1c,0x101));var _0xc0e1=function(_0x570e15,_0x3ff7ba){_0x570e15=_0x570e15-0x0;var _0x238516=_0x0e1c[_0x570e15];return _0x238516;};'use strict';var client=require(_0xc0e1('0x0'));exports[_0xc0e1('0x1')]=function(_0x245d40){return function(_0x24183b){return client[_0xc0e1('0x2')](_0xc0e1('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc0e1('0x4'),_0xc0e1('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xd523=['getTemplates','GetTemplate','name','html','../client'];(function(_0xfc5fd4,_0x43c5dc){var _0x34fa22=function(_0x1f5770){while(--_0x1f5770){_0xfc5fd4['push'](_0xfc5fd4['shift']());}};_0x34fa22(++_0x43c5dc);}(_0xd523,0x153));var _0x3d52=function(_0x2e0176,_0xdb556b){_0x2e0176=_0x2e0176-0x0;var _0x534e95=_0xd523[_0x2e0176];return _0x534e95;};'use strict';var client=require(_0x3d52('0x0'));exports[_0x3d52('0x1')]=function(_0x3d35b0){return function(_0x3fcfcb){return client['Request'](_0x3d52('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3d52('0x3'),_0x3d52('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5a7e845..f1056f0 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 _0x4f9d=['data5','data6','GetTrigger','getTriggers','Request','name','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data3'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4f9d,0xfa));var _0xd4f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4f9d[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xd4f9('0x0')]=function(_0xb9e378){return function(_0x3cf1a3){return client[_0xd4f9('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xd4f9('0x2'),'channel',_0xd4f9('0x3')],'include':[{'model':'Condition','as':_0xd4f9('0x4'),'attributes':['id',_0xd4f9('0x5'),_0xd4f9('0x6'),_0xd4f9('0x7')]},{'model':_0xd4f9('0x8'),'as':_0xd4f9('0x9'),'attributes':['id',_0xd4f9('0x5'),'operator','value']},{'model':_0xd4f9('0xa'),'as':_0xd4f9('0xb'),'attributes':['id',_0xd4f9('0xc'),_0xd4f9('0xd'),_0xd4f9('0xe'),_0xd4f9('0xf'),'data4',_0xd4f9('0x10'),_0xd4f9('0x11'),'data7']}]},'log':_0xd4f9('0x12')});};}; \ No newline at end of file +var _0x9092=['data4','data5','data6','data7','Request','GetTrigger','Condition','AllConditions','field','value','Actions','action','data1','data2','data3'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_0x9092,0x8b));var _0x2909=function(_0xc3753b,_0x4fb1ec){_0xc3753b=_0xc3753b-0x0;var _0x19c9ab=_0x9092[_0xc3753b];return _0x19c9ab;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x24569c){return function(_0x108113){return client[_0x2909('0x0')](_0x2909('0x1'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x2909('0x2'),'as':_0x2909('0x3'),'attributes':['id',_0x2909('0x4'),'operator',_0x2909('0x5')]},{'model':_0x2909('0x2'),'as':'AnyConditions','attributes':['id',_0x2909('0x4'),'operator',_0x2909('0x5')]},{'model':'Action','as':_0x2909('0x6'),'attributes':['id',_0x2909('0x7'),_0x2909('0x8'),_0x2909('0x9'),_0x2909('0xa'),_0x2909('0xb'),_0x2909('0xc'),_0x2909('0xd'),_0x2909('0xe')]}]},'log':_0x2909('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 21d6cc5..cabc81e 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 _0xf864=['registry','defaultuser','GetTrunk','../client'];(function(_0x370daf,_0x5ade2d){var _0x444425=function(_0x27a439){while(--_0x27a439){_0x370daf['push'](_0x370daf['shift']());}};_0x444425(++_0x5ade2d);}(_0xf864,0x11f));var _0x4f86=function(_0x4ee73b,_0x32ffff){_0x4ee73b=_0x4ee73b-0x0;var _0x276c6d=_0xf864[_0x4ee73b];return _0x276c6d;};'use strict';var client=require(_0x4f86('0x0'));exports['getTrunks']=function(_0x39223b){return function(_0x1a932f){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4f86('0x1'),_0x4f86('0x2')]},'log':_0x4f86('0x3')});};}; \ No newline at end of file +var _0xe647=['../client','getTrunks','Request','GetTrunk','defaultuser'];(function(_0x4b5396,_0x4f7d02){var _0x4798e4=function(_0x2c79a3){while(--_0x2c79a3){_0x4b5396['push'](_0x4b5396['shift']());}};_0x4798e4(++_0x4f7d02);}(_0xe647,0x16d));var _0x7e64=function(_0x545d0c,_0x52dbc1){_0x545d0c=_0x545d0c-0x0;var _0x1a22e6=_0xe647[_0x545d0c];return _0x1a22e6;};'use strict';var client=require(_0x7e64('0x0'));exports[_0x7e64('0x1')]=function(_0x54aaab){return function(_0x41d99f){return client[_0x7e64('0x2')](_0x7e64('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x7e64('0x4')]},'log':_0x7e64('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9c2ba0d..f1b252c 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe706,0xa3));var _0x6e70=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0xe706[_0x414ff1];return _0x29c53f;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index afa52b4..a66369e 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 _0x4aad=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x18950b,_0x12330a){var _0x4e9616=function(_0x281350){while(--_0x281350){_0x18950b['push'](_0x18950b['shift']());}};_0x4e9616(++_0x12330a);}(_0x4aad,0xa9));var _0xd4aa=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4aad[_0x3ff085];return _0x2b68c3;};'use strict';var client=require(_0xd4aa('0x0'));exports[_0xd4aa('0x1')]=function(_0x253ba9){return client['Request'](_0xd4aa('0x2'),{'body':_0x253ba9,'log':_0xd4aa('0x2')});};exports[_0xd4aa('0x3')]=function(_0x436bb1,_0x4fbd3b,_0x1bb20b){return client[_0xd4aa('0x4')](_0xd4aa('0x5'),{'body':_0x436bb1,'options':{'where':{'uniqueid':_0x4fbd3b,'interface':_0x1bb20b,'agentcomplete':!![]}},'log':_0xd4aa('0x5')});}; \ No newline at end of file +var _0x9792=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x9792,0x76));var _0x2979=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9792[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports[_0x2979('0x0')]=function(_0x5e8ede){return client[_0x2979('0x1')]('CreateVoiceAgentReport',{'body':_0x5e8ede,'log':_0x2979('0x2')});};exports[_0x2979('0x3')]=function(_0x356674,_0xc31584,_0x3d72cf){return client[_0x2979('0x1')](_0x2979('0x4'),{'body':_0x356674,'options':{'where':{'uniqueid':_0xc31584,'interface':_0x3d72cf,'agentcomplete':!![]}},'log':_0x2979('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index dcd5ee6..a86f385 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 _0x3305=['startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x2ad147,_0x1a2a07){var _0x54a51b=function(_0x100fe6){while(--_0x100fe6){_0x2ad147['push'](_0x2ad147['shift']());}};_0x54a51b(++_0x1a2a07);}(_0x3305,0xb0));var _0x5330=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3305[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x5330('0x0'));var util=require(_0x5330('0x1'));var _=require('lodash');var client=require(_0x5330('0x2'));exports[_0x5330('0x3')]=function(_0x246342){return client[_0x5330('0x4')](_0x5330('0x5'),{'body':_[_0x5330('0x6')](_0x246342,{'source':_0x246342[_0x5330('0x7')],'destinationcontext':_0x246342[_0x5330('0x8')],'callerid':_0x246342['callerid'],'amaflags':_0x5330('0x9')}),'log':_0x5330('0x5')});};exports[_0x5330('0xa')]=function(){return function(){return client[_0x5330('0x4')](_0x5330('0xb'),{'options':{'where':{'type':[_0x5330('0xc')],'createdAt':{'$between':[moment()[_0x5330('0xd')]('day')[_0x5330('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5330('0xf')](_0x5330('0x10'))[_0x5330('0xe')](_0x5330('0x11'))]}},'attributes':['type',_0x5330('0x12'),_0x5330('0x13'),_0x5330('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x5104=['billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration'];(function(_0x1c9c29,_0x732fa6){var _0x56e56d=function(_0x556988){while(--_0x556988){_0x1c9c29['push'](_0x1c9c29['shift']());}};_0x56e56d(++_0x732fa6);}(_0x5104,0x1a6));var _0x4510=function(_0x54d816,_0x23294a){_0x54d816=_0x54d816-0x0;var _0xe47268=_0x5104[_0x54d816];return _0xe47268;};'use strict';var moment=require(_0x4510('0x0'));var util=require('util');var _=require(_0x4510('0x1'));var client=require(_0x4510('0x2'));exports[_0x4510('0x3')]=function(_0xf35e9a){return client[_0x4510('0x4')](_0x4510('0x5'),{'body':_['merge'](_0xf35e9a,{'source':_0xf35e9a[_0x4510('0x6')],'destinationcontext':_0xf35e9a['context'],'callerid':_0xf35e9a['callerid'],'amaflags':_0x4510('0x7')}),'log':_0x4510('0x5')});};exports[_0x4510('0x8')]=function(){return function(){return client['Request'](_0x4510('0x9'),{'options':{'where':{'type':[_0x4510('0xa')],'createdAt':{'$between':[moment()[_0x4510('0xb')](_0x4510('0xc'))[_0x4510('0xd')](_0x4510('0xe')),moment()[_0x4510('0xf')](_0x4510('0xc'))[_0x4510('0xd')](_0x4510('0xe'))]}},'attributes':[_0x4510('0x10'),'disposition',_0x4510('0x11'),_0x4510('0x12')]},'log':_0x4510('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d5a979b..874d50e 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 _0x618a=['CreateVoiceDialReport','../client','Request'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0x618a,0x151));var _0xa618=function(_0x4ef7bc,_0x1e8207){_0x4ef7bc=_0x4ef7bc-0x0;var _0x30a74f=_0x618a[_0x4ef7bc];return _0x30a74f;};'use strict';var client=require(_0xa618('0x0'));exports['create']=function(_0x494c75){return client[_0xa618('0x1')](_0xa618('0x2'),{'body':_0x494c75,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x214d=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x214d,0x182));var _0xd214=function(_0x3883bc,_0x98856d){_0x3883bc=_0x3883bc-0x0;var _0x3c57c3=_0x214d[_0x3883bc];return _0x3c57c3;};'use strict';var client=require(_0xd214('0x0'));exports[_0xd214('0x1')]=function(_0x380b2e){return client[_0xd214('0x2')](_0xd214('0x3'),{'body':_0x380b2e,'log':_0xd214('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bcc4460..ddcde36 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 _0x3299=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x3299,0x1bc));var _0x9329=function(_0x27ec27,_0x19c681){_0x27ec27=_0x27ec27-0x0;var _0x527a57=_0x3299[_0x27ec27];return _0x527a57;};'use strict';var client=require('../client');exports[_0x9329('0x0')]=function(){return function(){return client[_0x9329('0x1')](_0x9329('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9329('0x3'),_0x9329('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9329('0x0')});};}; \ No newline at end of file +var _0x0834=['Request','GetVoiceExtension'];(function(_0x20fa14,_0x2f0234){var _0x161aa0=function(_0x1dca88){while(--_0x1dca88){_0x20fa14['push'](_0x20fa14['shift']());}};_0x161aa0(++_0x2f0234);}(_0x0834,0x18e));var _0x4083=function(_0x533958,_0x17c694){_0x533958=_0x533958-0x0;var _0x43520e=_0x0834[_0x533958];return _0x43520e;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x4083('0x0')](_0x4083('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 248bda1..aa0caf1 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 _0x6614=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency'];(function(_0x197221,_0x4ea5ea){var _0x5b42c3=function(_0x17a66e){while(--_0x17a66e){_0x197221['push'](_0x197221['shift']());}};_0x5b42c3(++_0x4ea5ea);}(_0x6614,0x179));var _0x4661=function(_0x4310e8,_0x3ba783){_0x4310e8=_0x4310e8-0x0;var _0x301445=_0x6614[_0x4310e8];return _0x301445;};'use strict';var client=require(_0x4661('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x4661('0x1')](_0x4661('0x2'),{'options':{'raw':![],'attributes':['id',_0x4661('0x3'),'acw','acwTimeout',_0x4661('0x4'),_0x4661('0x5'),_0x4661('0x6'),_0x4661('0x7'),_0x4661('0x8'),_0x4661('0x9'),_0x4661('0xa'),_0x4661('0xb'),_0x4661('0xc'),_0x4661('0xd'),_0x4661('0xe'),_0x4661('0xf'),_0x4661('0x10'),'dialOriginateTimeout',_0x4661('0x11'),'dialQueueTimeout',_0x4661('0x12'),_0x4661('0x13'),'dialCongestionRetryFrequency',_0x4661('0x14'),_0x4661('0x15'),_0x4661('0x16'),_0x4661('0x17'),_0x4661('0x18'),'dialTimezone',_0x4661('0x19'),_0x4661('0x1a'),_0x4661('0x1b'),_0x4661('0x1c'),'dialAMDInitialSilence',_0x4661('0x1d'),'dialAMDAfterGreetingSilence',_0x4661('0x1e'),'dialAMDMinWordLength',_0x4661('0x1f'),_0x4661('0x20'),'dialAMDSilenceThreshold',_0x4661('0x21'),_0x4661('0x22'),'dialRecallMeTimeout',_0x4661('0x23'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x4661('0x24'),_0x4661('0x25'),_0x4661('0x5'),'strategy',_0x4661('0x26'),_0x4661('0x27'),_0x4661('0x28'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x4661('0x29'),'dialAbandonedMaxRetry',_0x4661('0x2a'),_0x4661('0x2b'),_0x4661('0x2c'),'dialAgentRejectMaxRetry',_0x4661('0x2d'),_0x4661('0x2e'),_0x4661('0x2f'),_0x4661('0x30'),_0x4661('0x31'),_0x4661('0x32'),_0x4661('0x33')],'include':[{'model':_0x4661('0x34'),'as':_0x4661('0x34'),'attributes':['id','name','callerid',_0x4661('0x35')]},{'model':_0x4661('0x36'),'as':_0x4661('0x37'),'attributes':['id',_0x4661('0x3')]},{'model':_0x4661('0x34'),'as':'TrunkBackup','attributes':['id','name','callerid',_0x4661('0x35')]},{'model':'Interval','as':_0x4661('0x38'),'attributes':['id','name'],'include':[{'model':_0x4661('0x38'),'as':_0x4661('0x39'),'attributes':['id',_0x4661('0x3'),_0x4661('0x3a')]}]}]},'log':_0x4661('0x3b')});};}; \ No newline at end of file +var _0x820f=['interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','mandatoryDispositionPause','name','TrunkBackup','callerid','Interval','Intervals'];(function(_0x10801a,_0x59ec47){var _0x5d2cb9=function(_0x17ea03){while(--_0x17ea03){_0x10801a['push'](_0x10801a['shift']());}};_0x5d2cb9(++_0x59ec47);}(_0x820f,0x163));var _0xf820=function(_0x46ff82,_0x59d48c){_0x46ff82=_0x46ff82-0x0;var _0x262d95=_0x820f[_0x46ff82];return _0x262d95;};'use strict';var client=require(_0xf820('0x0'));exports[_0xf820('0x1')]=function(){return function(){return client[_0xf820('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf820('0x3'),_0xf820('0x4'),_0xf820('0x5'),'monitor_format',_0xf820('0x6'),_0xf820('0x7'),_0xf820('0x8'),_0xf820('0x9'),_0xf820('0xa'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0xf820('0xb'),_0xf820('0xc'),_0xf820('0xd'),_0xf820('0xe'),_0xf820('0xf'),'dialCongestionMaxRetry',_0xf820('0x10'),'dialBusyMaxRetry',_0xf820('0x11'),_0xf820('0x12'),_0xf820('0x13'),_0xf820('0x14'),'dialTimezone',_0xf820('0x15'),_0xf820('0x16'),'dialCheckDuplicateType',_0xf820('0x17'),_0xf820('0x18'),'dialAMDGreeting',_0xf820('0x19'),_0xf820('0x1a'),_0xf820('0x1b'),_0xf820('0x1c'),_0xf820('0x1d'),_0xf820('0x1e'),_0xf820('0x1f'),'timeout','dialRecallMeTimeout','dialRecallInQueue',_0xf820('0x20'),_0xf820('0x21'),_0xf820('0x22'),'dialQueueProject2',_0xf820('0x23'),'strategy',_0xf820('0x24'),_0xf820('0x25'),_0xf820('0x26'),'dialNoSuchNumberRetryFrequency',_0xf820('0x27'),_0xf820('0x28'),_0xf820('0x29'),'dialAbandonedRetryFrequency',_0xf820('0x2a'),_0xf820('0x2b'),_0xf820('0x2c'),_0xf820('0x2d'),'mandatoryDisposition',_0xf820('0x2e'),_0xf820('0x2f'),_0xf820('0x30'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':_0xf820('0x31'),'as':'Trunk','attributes':['id','name','callerid',_0xf820('0x32')]},{'model':_0xf820('0x33'),'as':_0xf820('0x34'),'attributes':['id',_0xf820('0x35')]},{'model':_0xf820('0x31'),'as':_0xf820('0x36'),'attributes':['id',_0xf820('0x35'),_0xf820('0x37'),_0xf820('0x32')]},{'model':_0xf820('0x38'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xf820('0x38'),'as':_0xf820('0x39'),'attributes':['id','name',_0xf820('0x3a')]}]}]},'log':_0xf820('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0c806e5..5c46e1c 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(_0x366929,_0x3ae864){var _0x441a86=function(_0x3ffe7a){while(--_0x3ffe7a){_0x366929['push'](_0x366929['shift']());}};_0x441a86(++_0x3ae864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x44ac38,_0x34ca5a){var _0x54c8b5=function(_0x4c4e8d){while(--_0x4c4e8d){_0x44ac38['push'](_0x44ac38['shift']());}};_0x54c8b5(++_0x34ca5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 40f9197..2a6a8f2 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 _0x8caf=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x58b506,_0x3718c0){var _0x2b3a4a=function(_0x4b489d){while(--_0x4b489d){_0x58b506['push'](_0x58b506['shift']());}};_0x2b3a4a(++_0x3718c0);}(_0x8caf,0x154));var _0xf8ca=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x8caf[_0x32665e];return _0x10be45;};'use strict';var client=require(_0xf8ca('0x0'));exports[_0xf8ca('0x1')]=function(_0x22a883){return function(){return client[_0xf8ca('0x2')](_0xf8ca('0x3'),{'options':{'where':{'VoiceQueueId':_0x22a883,'paused':!![]},'raw':!![]},'log':_0xf8ca('0x1')});};}; \ No newline at end of file +var _0x6f83=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3e99d7,_0x73e3f0){var _0x5b0dbe=function(_0x48ca92){while(--_0x48ca92){_0x3e99d7['push'](_0x3e99d7['shift']());}};_0x5b0dbe(++_0x73e3f0);}(_0x6f83,0xcb));var _0x36f8=function(_0x4e2ae0,_0x3250ee){_0x4e2ae0=_0x4e2ae0-0x0;var _0x238a36=_0x6f83[_0x4e2ae0];return _0x238a36;};'use strict';var client=require(_0x36f8('0x0'));exports[_0x36f8('0x1')]=function(_0x395b3d){return function(){return client[_0x36f8('0x2')](_0x36f8('0x3'),{'options':{'where':{'VoiceQueueId':_0x395b3d,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 76bb0f2..bb44dbb 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x163306,_0x16acf7){var _0x42700b=function(_0x5e06fc){while(--_0x5e06fc){_0x163306['push'](_0x163306['shift']());}};_0x42700b(++_0x16acf7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4fd770,_0xd12ca8){var _0x35a347=function(_0x53f807){while(--_0x53f807){_0x4fd770['push'](_0x4fd770['shift']());}};_0x35a347(++_0xd12ca8);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 2988507..534e7f6 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 _0x907e=['origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeaccountcode','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x907e,0x1a7));var _0xe907=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x907e[_0x2ee790];return _0x5a54a5;};'use strict';var client=require(_0xe907('0x0'));exports[_0xe907('0x1')]={};exports[_0xe907('0x2')]=function(_0x587034){return client[_0xe907('0x3')](_0xe907('0x4'),{'body':{'result':_0x587034[_0xe907('0x5')],'transfererchannel':_0x587034[_0xe907('0x6')],'transferercalleridnum':_0x587034['transferercalleridnum'],'transferercalleridname':_0x587034['transferercalleridname'],'transfererconnectedlinenum':_0x587034[_0xe907('0x7')],'transfererconnectedlinename':_0x587034[_0xe907('0x8')],'transfereraccountcode':_0x587034[_0xe907('0x9')],'transferercontext':_0x587034[_0xe907('0xa')],'transfererexten':_0x587034['transfererexten'],'transfererlinkedid':_0x587034[_0xe907('0xb')],'transfereechannel':_0x587034[_0xe907('0xc')],'transfereecalleridnum':_0x587034['transfereecalleridnum'],'transfereecalleridname':_0x587034['transfereecalleridname'],'transfereeconnectedlinenum':_0x587034[_0xe907('0xd')],'transfereeconnectedlinename':_0x587034['transfereeconnectedlinename'],'transfereeaccountcode':_0x587034[_0xe907('0xe')],'transfereecontext':_0x587034['transfereecontext'],'transfereeexten':_0x587034['transfereeexten'],'transfereelinkedid':_0x587034['transfereelinkedid'],'isexternal':_0x587034[_0xe907('0xf')],'context':_0x587034['context'],'extension':_0x587034['extension'],'type':_0xe907('0x10')},'log':_0xe907('0x4')});};exports[_0xe907('0x11')]=function(_0x630ab3){return client[_0xe907('0x3')](_0xe907('0x4'),{'body':{'result':_0x630ab3[_0xe907('0x5')],'transfererchannel':_0x630ab3[_0xe907('0x12')],'transferercalleridnum':_0x630ab3[_0xe907('0x13')],'transferercalleridname':_0x630ab3['origtransferercalleridname'],'transfererconnectedlinenum':_0x630ab3[_0xe907('0x14')],'transfererconnectedlinename':_0x630ab3[_0xe907('0x15')],'transfereraccountcode':_0x630ab3[_0xe907('0x16')],'transferercontext':_0x630ab3[_0xe907('0x17')],'transfererexten':_0x630ab3[_0xe907('0x18')],'transfererlinkedid':_0x630ab3[_0xe907('0x19')],'transfereechannel':_0x630ab3[_0xe907('0x1a')],'transfereecalleridnum':_0x630ab3['transfertargetcalleridnum'],'transfereecalleridname':_0x630ab3[_0xe907('0x1b')],'transfereeconnectedlinenum':_0x630ab3[_0xe907('0x1c')],'transfereeconnectedlinename':_0x630ab3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x630ab3[_0xe907('0x1d')],'transfereecontext':_0x630ab3[_0xe907('0x1e')],'transfereeexten':_0x630ab3['transfertargetexten'],'transfereelinkedid':_0x630ab3[_0xe907('0x1f')],'isexternal':_0x630ab3['isexternal'],'context':_0x630ab3[_0xe907('0x20')],'extension':_0x630ab3[_0xe907('0x21')],'type':_0xe907('0x22')},'log':_0xe907('0x4')});}; \ No newline at end of file +var _0x670c=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','result','origtransferercalleridnum'];(function(_0x2d7075,_0x3312b9){var _0x447f37=function(_0x1ea38a){while(--_0x1ea38a){_0x2d7075['push'](_0x2d7075['shift']());}};_0x447f37(++_0x3312b9);}(_0x670c,0xd4));var _0xc670=function(_0x2a782b,_0x460212){_0x2a782b=_0x2a782b-0x0;var _0x2a82c9=_0x670c[_0x2a782b];return _0x2a82c9;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x5dd35f){return client[_0xc670('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x5dd35f['result'],'transfererchannel':_0x5dd35f['transfererchannel'],'transferercalleridnum':_0x5dd35f[_0xc670('0x1')],'transferercalleridname':_0x5dd35f[_0xc670('0x2')],'transfererconnectedlinenum':_0x5dd35f[_0xc670('0x3')],'transfererconnectedlinename':_0x5dd35f[_0xc670('0x4')],'transfereraccountcode':_0x5dd35f[_0xc670('0x5')],'transferercontext':_0x5dd35f[_0xc670('0x6')],'transfererexten':_0x5dd35f[_0xc670('0x7')],'transfererlinkedid':_0x5dd35f[_0xc670('0x8')],'transfereechannel':_0x5dd35f[_0xc670('0x9')],'transfereecalleridnum':_0x5dd35f[_0xc670('0xa')],'transfereecalleridname':_0x5dd35f[_0xc670('0xb')],'transfereeconnectedlinenum':_0x5dd35f[_0xc670('0xc')],'transfereeconnectedlinename':_0x5dd35f[_0xc670('0xd')],'transfereeaccountcode':_0x5dd35f[_0xc670('0xe')],'transfereecontext':_0x5dd35f['transfereecontext'],'transfereeexten':_0x5dd35f['transfereeexten'],'transfereelinkedid':_0x5dd35f[_0xc670('0xf')],'isexternal':_0x5dd35f['isexternal'],'context':_0x5dd35f[_0xc670('0x10')],'extension':_0x5dd35f[_0xc670('0x11')],'type':_0xc670('0x12')},'log':_0xc670('0x13')});};exports['attendedTransfer']=function(_0x326d1c){return client['Request'](_0xc670('0x13'),{'body':{'result':_0x326d1c[_0xc670('0x14')],'transfererchannel':_0x326d1c['origtransfererchannel'],'transferercalleridnum':_0x326d1c[_0xc670('0x15')],'transferercalleridname':_0x326d1c[_0xc670('0x16')],'transfererconnectedlinenum':_0x326d1c[_0xc670('0x17')],'transfererconnectedlinename':_0x326d1c[_0xc670('0x18')],'transfereraccountcode':_0x326d1c['origtransfereraccountcode'],'transferercontext':_0x326d1c[_0xc670('0x19')],'transfererexten':_0x326d1c[_0xc670('0x1a')],'transfererlinkedid':_0x326d1c[_0xc670('0x1b')],'transfereechannel':_0x326d1c[_0xc670('0x1c')],'transfereecalleridnum':_0x326d1c[_0xc670('0x1d')],'transfereecalleridname':_0x326d1c[_0xc670('0x1e')],'transfereeconnectedlinenum':_0x326d1c[_0xc670('0x1f')],'transfereeconnectedlinename':_0x326d1c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x326d1c[_0xc670('0x20')],'transfereecontext':_0x326d1c[_0xc670('0x21')],'transfereeexten':_0x326d1c[_0xc670('0x22')],'transfereelinkedid':_0x326d1c[_0xc670('0x23')],'isexternal':_0x326d1c[_0xc670('0x24')],'context':_0x326d1c[_0xc670('0x25')],'extension':_0x326d1c[_0xc670('0x26')],'type':'attended'},'log':_0xc670('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cb7191b..3c98b6e 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 _0xa0a1=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','omit','values','channels','length','voicechannel','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','MixMonitor\x20Success','map','find','resolve','StopMixMonitor','destinationchannel','status','stop','monitors','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','outboundChannels','campaigns','run','event','emit','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','bluebird','../properties','../ami','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','action','Action','message','catch','ami\x20disconnected','command','Command','then','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x219729,_0x19f07d){var _0x35c464=function(_0x3c412c){while(--_0x3c412c){_0x219729['push'](_0x219729['shift']());}};_0x35c464(++_0x19f07d);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xa0a1[_0x1b5a05];return _0x347931;};'use strict';var _=require(_0x1a0a('0x0'));var util=require('util');var jayson=require(_0x1a0a('0x1'));var schema=require(_0x1a0a('0x2'));var BPromise=require(_0x1a0a('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x1a0a('0x4'));var ami=require(_0x1a0a('0x5'));exports['listen']=function(_0x27077a,_0x31e85b,_0x4b5573){return new BPromise(function(_0x2d4b04,_0xe59f97){var _0x3fe29f={'QueuePause':function(_0x245f3d){return new Promise(function(_0x9da67c,_0x48d604){var _0x2e5bec=util[_0x1a0a('0x6')](_0x1a0a('0x7'),'SIP',_0x245f3d['name']);if(_0x27077a['timers']&&_0x27077a[_0x1a0a('0x8')][_0x2e5bec]&&_0x27077a[_0x1a0a('0x8')][_0x2e5bec][_0x1a0a('0x9')]){_0x27077a['timers'][_0x2e5bec][_0x1a0a('0xa')]();}if(_0x27077a['agents'][_0x2e5bec]){_0x27077a[_0x1a0a('0xb')][_0x2e5bec][_0x1a0a('0xc')]({'statePause':_0x245f3d[_0x1a0a('0xd')]?!![]:![]});}_0x9da67c({'code':0xc8,'message':_0x1a0a('0xe')});});},'Reload':function(_0x289046){var _0x2dee74=this;return new Promise(function(_0x3f34d2,_0x4f2b35){if(ami[_0x1a0a('0xf')]()==![]){return _0x4f2b35(_0x2dee74[_0x1a0a('0x10')](0x1f4,[config[_0x1a0a('0x11')]['ip'],config[_0x1a0a('0x11')][_0x1a0a('0x12')],'ami\x20disconnected'][_0x1a0a('0x13')]('\x20')));}_0x289046=_[_0x1a0a('0x14')](_0x289046,_[_0x1a0a('0x15')](properties['module']));_0x289046[_0x1a0a('0x16')]='Reload';return ami[_0x1a0a('0x17')](_0x289046)['then'](function(_0x54bfbe){_0x3f34d2({'code':0xc8,'message':_0x54bfbe[_0x1a0a('0x18')]});})[_0x1a0a('0x19')](function(_0x307fdc){_0x4f2b35(_0x2dee74[_0x1a0a('0x10')](0x1f5,_0x307fdc['message']));});});},'Command':function(_0x56b8a5){var _0x239065=this;return new Promise(function(_0x40903a,_0xfa74ce){if(ami['isConnected']()==![]){return _0xfa74ce(_0x239065[_0x1a0a('0x10')](0x1f4,[config[_0x1a0a('0x11')]['ip'],config['asterisk'][_0x1a0a('0x12')],_0x1a0a('0x1a')][_0x1a0a('0x13')]('\x20')));}_0x56b8a5=_['pick'](_0x56b8a5,_0x1a0a('0x1b'));_0x56b8a5[_0x1a0a('0x16')]=_0x1a0a('0x1c');return ami['Action'](_0x56b8a5)[_0x1a0a('0x1d')](function(_0x47ef88){_0x40903a({'code':0xc8,'message':_0x47ef88[_0x1a0a('0x1e')]});})[_0x1a0a('0x19')](function(_0x2d7967){_0xfa74ce(_0x239065[_0x1a0a('0x10')](0x1f5,_0x2d7967[_0x1a0a('0x18')]));});});},'VoiceQueues':function(_0x578995){return new Promise(function(_0x1e2b28,_0x8e4151){var _0x561407=[];for(var _0x4cf939 in _0x27077a[_0x1a0a('0x1f')]){if(_0x27077a[_0x1a0a('0x1f')][_0x1a0a('0x20')](_0x4cf939)){var _0x365ab5=_0x27077a[_0x1a0a('0x1f')][_0x4cf939];var _0x244bbf={'id':_0x365ab5['id'],'name':_0x365ab5[_0x1a0a('0x21')],'strategy':_0x365ab5[_0x1a0a('0x22')],'answered':_0x365ab5[_0x1a0a('0x23')],'available':_0x365ab5[_0x1a0a('0x24')],'loggedIn':_0x365ab5[_0x1a0a('0x25')],'pTalking':_0x365ab5[_0x1a0a('0x26')],'sumBillable':_0x365ab5[_0x1a0a('0x27')],'sumDuration':_0x365ab5[_0x1a0a('0x28')],'sumHoldTime':_0x365ab5[_0x1a0a('0x29')]||0x0,'talking':_0x365ab5[_0x1a0a('0x2a')],'total':_0x365ab5[_0x1a0a('0x2b')],'type':_0x365ab5['type'],'unmanaged':_0x365ab5[_0x1a0a('0x2c')],'abandoned':_0x365ab5[_0x1a0a('0x2d')],'waiting':_0x365ab5[_0x1a0a('0x2e')],'loggedInDb':_0x365ab5[_0x1a0a('0x2f')]};if(_0x365ab5[_0x1a0a('0x30')]===_0x1a0a('0x31')){_0x244bbf[_0x1a0a('0x32')]=_0x365ab5[_0x1a0a('0x32')];_0x244bbf[_0x1a0a('0x33')]=_0x365ab5[_0x1a0a('0x33')];_0x244bbf['dialOriginateCallerIdName']=_0x365ab5[_0x1a0a('0x34')];_0x244bbf[_0x1a0a('0x35')]=_0x365ab5['dialOriginateCallerIdNumber'];_0x244bbf[_0x1a0a('0x36')]=_0x365ab5['dialOriginateTimeout'];_0x244bbf['dialPrefix']=_0x365ab5[_0x1a0a('0x37')];_0x244bbf[_0x1a0a('0x38')]=_0x365ab5['temp'];_0x244bbf[_0x1a0a('0x39')]=_0x365ab5[_0x1a0a('0x39')];_0x244bbf[_0x1a0a('0x3a')]=_0x365ab5['outboundAnswerCallsDay'];_0x244bbf[_0x1a0a('0x3b')]=_0x365ab5[_0x1a0a('0x3b')];_0x244bbf['outboundBusyCallsDay']=_0x365ab5[_0x1a0a('0x3c')];_0x244bbf[_0x1a0a('0x3d')]=_0x365ab5['outboundCongestionCallsDay'];_0x244bbf[_0x1a0a('0x3e')]=_0x365ab5[_0x1a0a('0x3e')];_0x244bbf[_0x1a0a('0x3f')]=_0x365ab5[_0x1a0a('0x3f')];_0x244bbf['outboundDropCallsDayTimeout']=_0x365ab5[_0x1a0a('0x40')];_0x244bbf[_0x1a0a('0x41')]=_0x365ab5[_0x1a0a('0x41')];_0x244bbf[_0x1a0a('0x42')]=_0x365ab5[_0x1a0a('0x42')];_0x244bbf[_0x1a0a('0x43')]=_0x365ab5[_0x1a0a('0x43')];_0x244bbf[_0x1a0a('0x44')]=_0x365ab5[_0x1a0a('0x44')];_0x244bbf['outboundRejectCallsDay']=_0x365ab5['outboundRejectCallsDay'];_0x244bbf['outboundUnknownCallsDay']=_0x365ab5['outboundUnknownCallsDay'];_0x244bbf[_0x1a0a('0x45')]=_0x365ab5['predictiveIntervalAnsweredCalls'];_0x244bbf[_0x1a0a('0x46')]=_0x365ab5[_0x1a0a('0x46')];_0x244bbf['predictiveIntervalAvgTalktime']=_0x365ab5['predictiveIntervalAvgTalktime'];_0x244bbf[_0x1a0a('0x47')]=_0x365ab5[_0x1a0a('0x47')];_0x244bbf[_0x1a0a('0x48')]=_0x365ab5[_0x1a0a('0x48')];_0x244bbf['predictiveIntervalErlangCalls']=_0x365ab5[_0x1a0a('0x49')];_0x244bbf['predictiveIntervalErlangCallsDroppedCalls']=_0x365ab5['predictiveIntervalErlangCallsDroppedCalls'];_0x244bbf['predictiveIntervalHitRate']=_0x365ab5[_0x1a0a('0x4a')];_0x244bbf[_0x1a0a('0x4b')]=_0x365ab5['predictiveIntervalMultiplicativeFactor'];_0x244bbf[_0x1a0a('0x4c')]=_0x365ab5[_0x1a0a('0x4c')];_0x244bbf['predictiveIntervalAvailable']=_0x365ab5['predictiveIntervalAvailable'];_0x244bbf[_0x1a0a('0x4d')]=_0x365ab5[_0x1a0a('0x4d')];_0x244bbf['message']=_0x365ab5[_0x1a0a('0x18')];_0x244bbf[_0x1a0a('0x4e')]=_0x365ab5['originated'];_0x244bbf[_0x1a0a('0x4f')]=_0x365ab5['erlangCalls'];_0x244bbf[_0x1a0a('0x50')]=_0x365ab5['erlangCallToSecond'];_0x244bbf[_0x1a0a('0x51')]=_0x365ab5[_0x1a0a('0x51')];_0x244bbf[_0x1a0a('0x52')]=_0x365ab5[_0x1a0a('0x52')];_0x244bbf['startPredictive']=_0x365ab5[_0x1a0a('0x53')];_0x244bbf[_0x1a0a('0x54')]=_0x365ab5[_0x1a0a('0x54')];}if(_0x365ab5[_0x1a0a('0x55')]){_0x244bbf['Trunk']={'id':_0x365ab5[_0x1a0a('0x55')]['id'],'name':_0x365ab5[_0x1a0a('0x55')]['name'],'active':_0x365ab5[_0x1a0a('0x55')][_0x1a0a('0x56')],'callerid':_0x365ab5[_0x1a0a('0x55')][_0x1a0a('0x57')]};}if(_0x365ab5[_0x1a0a('0x58')]){_0x244bbf[_0x1a0a('0x58')]={'id':_0x365ab5[_0x1a0a('0x58')]['id'],'name':_0x365ab5[_0x1a0a('0x58')][_0x1a0a('0x21')]};}_0x561407[_0x1a0a('0x59')](_0x244bbf);}}_0x1e2b28({'count':_0x561407['length'],'rows':_0x561407});});},'UpdateVoiceQueue':function(_0x35c133){return new Promise(function(_0x2a5a04,_0x4ba9ca){var _0x493083=_['find'](_0x27077a['voiceQueues'],{'id':parseInt(_0x35c133['id'])});var _0x455f57=_[_0x1a0a('0x5a')](_0x35c133,['id']);if(_0x493083){for(var _0x48711d in _0x455f57){if(typeof _0x455f57[_0x48711d]!=='undefined'&&typeof _0x493083[_0x48711d]!=='undefined'){_0x493083[_0x48711d]=_0x455f57[_0x48711d];}}_0x2a5a04(_0x493083);}else{_0x4ba9ca();}});},'VoiceChannels':function(_0x423f52){return new Promise(function(_0x1185e9,_0x144360){var _0x2c58a9=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0x5c')]);_0x1185e9({'count':_0x2c58a9[_0x1a0a('0x5d')],'rows':_0x2c58a9});});},'VoiceChannelMixMonitor':function(_0x683bdc){var _0x9a2756=this;return new Promise(function(_0xf729c7,_0x1ed012){if(ami[_0x1a0a('0xf')]()==![]){return _0x1ed012(_0x9a2756[_0x1a0a('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x1a0a('0x11')][_0x1a0a('0x12')],_0x1a0a('0x1a')]['join']('\x20')));}var _0x14b07a=schema(properties[_0x1a0a('0x5e')])['validate'](_0x683bdc);if(_0x14b07a[_0x1a0a('0x5d')]>0x0){return _0x1ed012(_0x9a2756[_0x1a0a('0x10')](0x1f4,_['map'](_0x14b07a,'message')[_0x1a0a('0x13')](',\x20')));}var _0x498118=_['find'](_0x27077a[_0x1a0a('0x5c')],{'uniqueid':_0x683bdc['uniqueid']});if(_0x498118&&_0x498118[_0x1a0a('0x5f')]){var _0x217073=util[_0x1a0a('0x6')](_0x1a0a('0x60'),_0x683bdc[_0x1a0a('0x61')]||_0x683bdc[_0x1a0a('0x62')],_0x683bdc[_0x1a0a('0x6')]||_0x1a0a('0x63'));return ami[_0x1a0a('0x17')]({'action':_0x1a0a('0x64'),'channel':_0x498118['channel'],'file':_0x217073,'options':_0x1a0a('0x65')})['then'](function(_0x9e897f){var _0x1e97d2=_['find'](_0x498118['monitors'],{'filename':_0x1a0a('0x66')+_0x217073[_0x1a0a('0x67')]()});if(_['isNil'](_0x1e97d2)){_0x498118['monitors'][_0x1a0a('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x217073[_0x1a0a('0x67')](),'createdAt':moment()[_0x1a0a('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x9e897f[_0x1a0a('0x68')],'status':'rec'});}else{_0x1e97d2[_0x1a0a('0x68')]=_0x9e897f[_0x1a0a('0x68')];_0x1e97d2['status']=_0x1a0a('0x69');}_0xf729c7({'code':0xc8,'message':[_0x683bdc[_0x1a0a('0x62')],_0x1a0a('0x6a'),_0x9e897f['mixmonitorid']][_0x1a0a('0x13')]('\x20'),'mixmonitorid':_0x9e897f[_0x1a0a('0x68')]});})['catch'](function(_0x5dac09){_0x1ed012(_0x9a2756[_0x1a0a('0x10')](0x1f5,[_0x683bdc[_0x1a0a('0x62')],_0x5dac09[_0x1a0a('0x18')][_0x1a0a('0x67')]()]['join']('\x20')));});}else{return _0x1ed012(_0x9a2756['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2fef04){var _0x5e1eaa=this;return new Promise(function(_0x10fd71,_0x2953c1){if(ami[_0x1a0a('0xf')]()==![]){return _0x2953c1(_0x5e1eaa[_0x1a0a('0x10')](0x1f4,[config[_0x1a0a('0x11')]['ip'],config[_0x1a0a('0x11')][_0x1a0a('0x12')],_0x1a0a('0x1a')][_0x1a0a('0x13')]('\x20')));}var _0x34dd54=schema(properties[_0x1a0a('0x5e')])[_0x1a0a('0x2')](_0x2fef04);if(_0x34dd54[_0x1a0a('0x5d')]>0x0){return _0x2953c1(_0x5e1eaa[_0x1a0a('0x10')](0x1f4,_[_0x1a0a('0x6b')](_0x34dd54,'message')[_0x1a0a('0x13')](',\x20')));}var _0x26cb74=_[_0x1a0a('0x6c')](_0x27077a[_0x1a0a('0x5c')],{'uniqueid':_0x2fef04['uniqueid']});if(_0x26cb74){return BPromise[_0x1a0a('0x6d')]()[_0x1a0a('0x1d')](function(){if(_0x26cb74[_0x1a0a('0x5f')]){return ami[_0x1a0a('0x17')]({'action':_0x1a0a('0x6e'),'channel':_0x26cb74[_0x1a0a('0x5f')],'mixmonitorid':_0x2fef04[_0x1a0a('0x68')]})[_0x1a0a('0x19')](function(_0x224eac){});}})[_0x1a0a('0x1d')](function(){if(_0x26cb74[_0x1a0a('0x6f')]){return ami['Action']({'action':_0x1a0a('0x6e'),'channel':_0x26cb74['destinationchannel'],'mixmonitorid':_0x2fef04[_0x1a0a('0x68')]})['catch'](function(_0x1c2b41){});}})[_0x1a0a('0x1d')](function(_0x3ccce6){var _0x1aadbd=_[_0x1a0a('0x6c')](_0x26cb74['monitors'],{'mixmonitorid':_0x2fef04[_0x1a0a('0x68')]});if(_0x1aadbd){_0x1aadbd[_0x1a0a('0x70')]=_0x1a0a('0x71');}})[_0x1a0a('0x1d')](function(){var _0x36c617=util[_0x1a0a('0x6')](_0x1a0a('0x60'),_0x2fef04['filename']||_0x2fef04[_0x1a0a('0x62')],_0x2fef04[_0x1a0a('0x6')]||_0x1a0a('0x63'));var _0x5e2d94=_['find'](_0x26cb74[_0x1a0a('0x72')],{'filename':_0x1a0a('0x66')+_0x36c617[_0x1a0a('0x67')]()});if(_0x5e2d94){_0x5e2d94[_0x1a0a('0x70')]=_0x1a0a('0x71');}})['then'](function(){_0x10fd71({'code':0xc8,'message':[_0x2fef04[_0x1a0a('0x62')],_0x1a0a('0x73')][_0x1a0a('0x13')]('\x20')});})['catch'](function(_0x4629b7){_0x2953c1(_0x5e1eaa[_0x1a0a('0x10')](0x1f5,[_0x2fef04[_0x1a0a('0x62')],_0x4629b7[_0x1a0a('0x18')][_0x1a0a('0x67')]()][_0x1a0a('0x13')]('\x20')));});}else{return _0x2953c1(_0x5e1eaa[_0x1a0a('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x33a0eb){return new Promise(function(_0x239262,_0x1a903c){var _0x569ecb=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0x74')]);_0x239262({'count':_0x569ecb[_0x1a0a('0x5d')],'rows':_0x569ecb});});},'VoiceQueuesChannel':function(_0x2c757f){var _0xec020d=this;return new Promise(function(_0x471c4e,_0x3ef0cc){var _0x488f43=schema(properties[_0x1a0a('0x75')])[_0x1a0a('0x2')](_0x2c757f);if(_0x488f43[_0x1a0a('0x5d')]>0x0){return _0x3ef0cc(_0xec020d[_0x1a0a('0x10')](0x1f4,_[_0x1a0a('0x6b')](_0x488f43,_0x1a0a('0x18'))[_0x1a0a('0x13')](',\x20')));}var _0x56756e=_[_0x1a0a('0x6c')](_0x27077a['queueChannels'],{'uniqueid':_0x2c757f[_0x1a0a('0x62')]});if(_0x56756e){_0x471c4e(_0x56756e);}else{return _0x3ef0cc(_0xec020d[_0x1a0a('0x10')](0x1f5,_0x1a0a('0x76')));}});},'VoiceQueuesChannelHangup':function(_0x221201){var _0x24cca3=this;return new Promise(function(_0x55ce61,_0x21baea){if(ami[_0x1a0a('0xf')]()==![]){return _0x21baea(_0x24cca3[_0x1a0a('0x10')](0x1f4,[config[_0x1a0a('0x11')]['ip'],config[_0x1a0a('0x11')][_0x1a0a('0x12')],'ami\x20disconnected']['join']('\x20')));}var _0x4f5e24=schema(properties[_0x1a0a('0x77')])[_0x1a0a('0x2')](_0x221201);if(_0x4f5e24[_0x1a0a('0x5d')]>0x0){return _0x21baea(_0x24cca3['error'](0x1f4,_[_0x1a0a('0x6b')](_0x4f5e24,_0x1a0a('0x18'))[_0x1a0a('0x13')](',\x20')));}var _0x4ef8e7=_[_0x1a0a('0x6c')](_0x27077a[_0x1a0a('0x74')],{'uniqueid':_0x221201['uniqueid']});if(_0x4ef8e7&&_0x4ef8e7[_0x1a0a('0x5f')]){return ami['Action']({'action':'Hangup','channel':_0x4ef8e7[_0x1a0a('0x5f')]})[_0x1a0a('0x1d')](function(_0xeb1468){_0x55ce61({'code':0xc8,'message':[_0x221201[_0x1a0a('0x62')],_0xeb1468[_0x1a0a('0x18')][_0x1a0a('0x67')]()][_0x1a0a('0x13')]('\x20')});})[_0x1a0a('0x19')](function(_0x51d91f){_0x21baea(_0x24cca3[_0x1a0a('0x10')](0x1f5,[_0x221201[_0x1a0a('0x62')],_0x51d91f[_0x1a0a('0x18')]['toLowerCase']()][_0x1a0a('0x13')]('\x20')));});}else{return _0x21baea(_0x24cca3[_0x1a0a('0x10')](0x1f5,_0x1a0a('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x3e5323){var _0x59e463=this;return new Promise(function(_0x348d33,_0x5b35a8){if(ami[_0x1a0a('0xf')]()==![]){return _0x5b35a8(_0x59e463['error'](0x1f4,[config['asterisk']['ip'],config[_0x1a0a('0x11')][_0x1a0a('0x12')],_0x1a0a('0x1a')]['join']('\x20')));}var _0x190000=schema(properties[_0x1a0a('0x78')])[_0x1a0a('0x2')](_0x3e5323);if(_0x190000[_0x1a0a('0x5d')]>0x0){return _0x5b35a8(_0x59e463['error'](0x1f4,_[_0x1a0a('0x6b')](_0x190000,_0x1a0a('0x18'))[_0x1a0a('0x13')](',\x20')));}var _0x5c73ad=_[_0x1a0a('0x6c')](_0x27077a[_0x1a0a('0x74')],{'uniqueid':_0x3e5323[_0x1a0a('0x62')]});if(_0x5c73ad&&_0x5c73ad[_0x1a0a('0x5f')]){return ami[_0x1a0a('0x17')]({'action':_0x1a0a('0x79'),'channel':_0x5c73ad[_0x1a0a('0x5f')],'exten':_0x3e5323['exten'],'context':_0x3e5323[_0x1a0a('0x7a')]||_0x5c73ad['context'],'priority':0x1})[_0x1a0a('0x1d')](function(_0x367830){_0x348d33({'code':0xc8,'message':[_0x3e5323['uniqueid'],_0x367830['message']['toLowerCase']()][_0x1a0a('0x13')]('\x20')});})['catch'](function(_0x21146e){_0x5b35a8(_0x59e463[_0x1a0a('0x10')](0x1f5,[_0x3e5323[_0x1a0a('0x62')],_0x21146e['message']['toLowerCase']()][_0x1a0a('0x13')]('\x20')));});}else{return _0x5b35a8(_0x59e463[_0x1a0a('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x47fb42){return new Promise(function(_0x32fbc5,_0x32bab1){var _0xe85959=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0xb')]);_0x32fbc5({'count':_0xe85959[_0x1a0a('0x5d')],'rows':_0xe85959});});},'Telephones':function(_0x577e25){return new Promise(function(_0x116934,_0xf2bdec){var _0x50f111=_[_0x1a0a('0x5b')](_0x27077a['telephones']);_0x116934({'count':_0x50f111[_0x1a0a('0x5d')],'rows':_0x50f111});});},'Trunks':function(_0x48c39f){return new Promise(function(_0x5187b7,_0x534aeb){var _0x3767ef=_['values'](_0x27077a['trunks']);_0x5187b7({'count':_0x3767ef[_0x1a0a('0x5d')],'rows':_0x3767ef});});},'OutboundChannels':function(_0x45d13a){return new Promise(function(_0x5f3fe6,_0x1a8641){var _0x2400a6=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0x7b')]);_0x5f3fe6({'count':_0x2400a6['length'],'rows':_0x2400a6});});},'Outbound':function(_0x2d1482){return new Promise(function(_0x552617,_0x2b6e84){_0x552617(_0x27077a[_0x1a0a('0x31')]);});},'Campaigns':function(_0x420de6){return new Promise(function(_0x4ca92c,_0x5b87dd){var _0x18e50a=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0x7c')]);_0x4ca92c({'count':_0x18e50a[_0x1a0a('0x5d')],'rows':_0x18e50a});});},'VoiceQueuesPreview':function(_0x3f0ec9){var _0x260122=this;return new Promise(function(_0x106b45,_0x92a816){_0x31e85b[_0x1a0a('0x7d')](_0x3f0ec9['id'])[_0x1a0a('0x1d')](function(_0x1431af){_0x106b45({'code':0xc8,'message':_0x1431af[_0x1a0a('0x18')]});})[_0x1a0a('0x19')](function(_0x20cebc){_0x92a816(_0x260122[_0x1a0a('0x10')](0x1f4,_0x20cebc[_0x1a0a('0x18')]));});});},'EventManager':function(_0x3b8bb7){var _0x575bd=this;return new Promise(function(_0x2bf3a,_0x22ad6d){if(!_0x3b8bb7[_0x1a0a('0x7e')]){return _0x22ad6d(_0x575bd[_0x1a0a('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x1a0a('0x7f')]('custom:'+_0x3b8bb7[_0x1a0a('0x7e')],_0x3b8bb7['message']);_0x2bf3a({'code':0xc8,'message':_0x3b8bb7});});},'FaxAccounts':function(_0x2c632f){return new Promise(function(_0x36eb72,_0x4cdbf1){var _0x59c6fb=_[_0x1a0a('0x5b')](_0x27077a[_0x1a0a('0x80')]);_0x36eb72({'count':_0x59c6fb[_0x1a0a('0x5d')],'rows':_0x59c6fb});});},'SendFax':function(_0x5d46b3){var _0x4a18dc=this;return new Promise(function(_0x94f975,_0x1c5f0c){_0x4b5573[_0x1a0a('0x81')](_0x5d46b3)[_0x1a0a('0x1d')](function(_0x59eafe){_0x94f975({'code':0xc8,'message':_0x59eafe[_0x1a0a('0x18')]});})[_0x1a0a('0x19')](function(_0x12e46f){_0x1c5f0c(_0x4a18dc[_0x1a0a('0x10')](0x1f4,_0x12e46f[_0x1a0a('0x18')]));});});},'CheckAfterSend':function(_0x159137){var _0x20d586=this;return new Promise(function(_0xe3e686,_0x2c8065){_0x4b5573[_0x1a0a('0x82')](_0x159137)[_0x1a0a('0x1d')](function(_0x269a94){_0xe3e686({'code':0xc8,'message':_0x269a94[_0x1a0a('0x18')]});})[_0x1a0a('0x19')](function(_0x3754a7){_0x2c8065(_0x20d586[_0x1a0a('0x10')](0x1f4,_0x3754a7['message']));});});}};var _0x57ef20=jayson[_0x1a0a('0x83')](_0x3fe29f)[_0x1a0a('0x84')]();_0x57ef20['on']('error',function(_0x1ac840){return _0xe59f97(_0x1ac840);});_0x57ef20[_0x1a0a('0x85')](0x232a,_0x1a0a('0x86'),function(){console[_0x1a0a('0x87')](_0x1a0a('0x88'),0x232a);return _0x2d4b04('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x1623=['stop','%s.%s','filename','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','map','isConnected','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','validate','bluebird','moment','../../../config/environment','../properties','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','asterisk','username','join','pick','keys','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','name','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','type','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','omit','undefined','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel'];(function(_0xb6afe,_0x38671f){var _0x335218=function(_0x325284){while(--_0x325284){_0xb6afe['push'](_0xb6afe['shift']());}};_0x335218(++_0x38671f);}(_0x1623,0xab));var _0x3162=function(_0x2372ef,_0x5951d0){_0x2372ef=_0x2372ef-0x0;var _0x26140c=_0x1623[_0x2372ef];return _0x26140c;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x3162('0x1'));var BPromise=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var config=require(_0x3162('0x4'));var properties=require(_0x3162('0x5'));var ami=require('../ami');exports['listen']=function(_0x7a4559,_0x4b77c4,_0x1b55f2){return new BPromise(function(_0x428de6,_0x53260d){var _0xffe9b6={'QueuePause':function(_0x2dc07e){return new Promise(function(_0x26ee32,_0x36609e){var _0x10d684=util[_0x3162('0x6')](_0x3162('0x7'),_0x3162('0x8'),_0x2dc07e['name']);if(_0x7a4559['timers']&&_0x7a4559[_0x3162('0x9')][_0x10d684]&&_0x7a4559[_0x3162('0x9')][_0x10d684][_0x3162('0xa')]){_0x7a4559[_0x3162('0x9')][_0x10d684][_0x3162('0xb')]();}if(_0x7a4559[_0x3162('0xc')][_0x10d684]){_0x7a4559[_0x3162('0xc')][_0x10d684][_0x3162('0xd')]({'statePause':_0x2dc07e[_0x3162('0xe')]?!![]:![]});}_0x26ee32({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x2d11c5){var _0x535f47=this;return new Promise(function(_0x3b9faf,_0x143c5a){if(ami['isConnected']()==![]){return _0x143c5a(_0x535f47['error'](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}_0x2d11c5=_[_0x3162('0x12')](_0x2d11c5,_[_0x3162('0x13')](properties['module']));_0x2d11c5[_0x3162('0x14')]=_0x3162('0x15');return ami[_0x3162('0x16')](_0x2d11c5)[_0x3162('0x17')](function(_0x930415){_0x3b9faf({'code':0xc8,'message':_0x930415[_0x3162('0x18')]});})[_0x3162('0x19')](function(_0x4b2bf3){_0x143c5a(_0x535f47[_0x3162('0x1a')](0x1f5,_0x4b2bf3[_0x3162('0x18')]));});});},'Command':function(_0x460b7b){var _0x36ca97=this;return new Promise(function(_0x491144,_0x1dfd5c){if(ami['isConnected']()==![]){return _0x1dfd5c(_0x36ca97['error'](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x460b7b=_[_0x3162('0x12')](_0x460b7b,_0x3162('0x1b'));_0x460b7b[_0x3162('0x14')]=_0x3162('0x1c');return ami[_0x3162('0x16')](_0x460b7b)[_0x3162('0x17')](function(_0x52ae25){_0x491144({'code':0xc8,'message':_0x52ae25[_0x3162('0x1d')]});})['catch'](function(_0xd283d6){_0x1dfd5c(_0x36ca97[_0x3162('0x1a')](0x1f5,_0xd283d6[_0x3162('0x18')]));});});},'VoiceQueues':function(_0x1fd76f){return new Promise(function(_0x1c9992,_0x3c543e){var _0x30552f=[];for(var _0x5f8f7 in _0x7a4559[_0x3162('0x1e')]){if(_0x7a4559[_0x3162('0x1e')][_0x3162('0x1f')](_0x5f8f7)){var _0x2f62d7=_0x7a4559[_0x3162('0x1e')][_0x5f8f7];var _0x48de45={'id':_0x2f62d7['id'],'name':_0x2f62d7[_0x3162('0x20')],'strategy':_0x2f62d7['strategy'],'answered':_0x2f62d7[_0x3162('0x21')],'available':_0x2f62d7[_0x3162('0x22')],'loggedIn':_0x2f62d7[_0x3162('0x23')],'pTalking':_0x2f62d7['pTalking'],'sumBillable':_0x2f62d7['sumBillable'],'sumDuration':_0x2f62d7[_0x3162('0x24')],'sumHoldTime':_0x2f62d7[_0x3162('0x25')]||0x0,'talking':_0x2f62d7[_0x3162('0x26')],'total':_0x2f62d7[_0x3162('0x27')],'type':_0x2f62d7[_0x3162('0x28')],'unmanaged':_0x2f62d7['unmanaged'],'abandoned':_0x2f62d7[_0x3162('0x29')],'waiting':_0x2f62d7['waiting'],'loggedInDb':_0x2f62d7[_0x3162('0x2a')]};if(_0x2f62d7[_0x3162('0x28')]===_0x3162('0x2b')){_0x48de45[_0x3162('0x2c')]=_0x2f62d7[_0x3162('0x2c')];_0x48de45[_0x3162('0x2d')]=_0x2f62d7[_0x3162('0x2d')];_0x48de45[_0x3162('0x2e')]=_0x2f62d7['dialOriginateCallerIdName'];_0x48de45[_0x3162('0x2f')]=_0x2f62d7[_0x3162('0x2f')];_0x48de45['dialOriginateTimeout']=_0x2f62d7[_0x3162('0x30')];_0x48de45[_0x3162('0x31')]=_0x2f62d7['dialPrefix'];_0x48de45['temp']=_0x2f62d7[_0x3162('0x32')];_0x48de45['outboundAnswerAgiCallsDay']=_0x2f62d7[_0x3162('0x33')];_0x48de45[_0x3162('0x34')]=_0x2f62d7[_0x3162('0x34')];_0x48de45['outboundBlacklistCallsDay']=_0x2f62d7['outboundBlacklistCallsDay'];_0x48de45[_0x3162('0x35')]=_0x2f62d7[_0x3162('0x35')];_0x48de45['outboundCongestionCallsDay']=_0x2f62d7[_0x3162('0x36')];_0x48de45['outboundDropCallsDayACS']=_0x2f62d7[_0x3162('0x37')];_0x48de45[_0x3162('0x38')]=_0x2f62d7[_0x3162('0x38')];_0x48de45[_0x3162('0x39')]=_0x2f62d7[_0x3162('0x39')];_0x48de45[_0x3162('0x3a')]=_0x2f62d7[_0x3162('0x3a')];_0x48de45[_0x3162('0x3b')]=_0x2f62d7[_0x3162('0x3b')];_0x48de45[_0x3162('0x3c')]=_0x2f62d7[_0x3162('0x3c')];_0x48de45['outboundReCallsDay']=_0x2f62d7[_0x3162('0x3d')];_0x48de45[_0x3162('0x3e')]=_0x2f62d7[_0x3162('0x3e')];_0x48de45['outboundUnknownCallsDay']=_0x2f62d7['outboundUnknownCallsDay'];_0x48de45[_0x3162('0x3f')]=_0x2f62d7[_0x3162('0x3f')];_0x48de45[_0x3162('0x40')]=_0x2f62d7[_0x3162('0x40')];_0x48de45['predictiveIntervalAvgTalktime']=_0x2f62d7[_0x3162('0x41')];_0x48de45['predictiveIntervalDroppedCallsCallersExit']=_0x2f62d7['predictiveIntervalDroppedCallsCallersExit'];_0x48de45['predictiveIntervalDroppedCallsTimeout']=_0x2f62d7[_0x3162('0x42')];_0x48de45[_0x3162('0x43')]=_0x2f62d7[_0x3162('0x43')];_0x48de45['predictiveIntervalErlangCallsDroppedCalls']=_0x2f62d7[_0x3162('0x44')];_0x48de45[_0x3162('0x45')]=_0x2f62d7[_0x3162('0x45')];_0x48de45[_0x3162('0x46')]=_0x2f62d7[_0x3162('0x46')];_0x48de45['predictiveIntervalPauses']=_0x2f62d7['predictiveIntervalPauses'];_0x48de45[_0x3162('0x47')]=_0x2f62d7[_0x3162('0x47')];_0x48de45['predictiveIntervalTotalCalls']=_0x2f62d7['predictiveIntervalTotalCalls'];_0x48de45[_0x3162('0x18')]=_0x2f62d7[_0x3162('0x18')];_0x48de45[_0x3162('0x48')]=_0x2f62d7['originated'];_0x48de45[_0x3162('0x49')]=_0x2f62d7[_0x3162('0x49')];_0x48de45[_0x3162('0x4a')]=_0x2f62d7[_0x3162('0x4a')];_0x48de45['erlangAbandonmentRate']=_0x2f62d7[_0x3162('0x4b')];_0x48de45[_0x3162('0x4c')]=_0x2f62d7['erlangBusyFactor'];_0x48de45[_0x3162('0x4d')]=_0x2f62d7[_0x3162('0x4d')];_0x48de45['startProgressive']=_0x2f62d7[_0x3162('0x4e')];}if(_0x2f62d7[_0x3162('0x4f')]){_0x48de45['Trunk']={'id':_0x2f62d7[_0x3162('0x4f')]['id'],'name':_0x2f62d7['Trunk'][_0x3162('0x20')],'active':_0x2f62d7[_0x3162('0x4f')][_0x3162('0x50')],'callerid':_0x2f62d7[_0x3162('0x4f')][_0x3162('0x51')]};}if(_0x2f62d7[_0x3162('0x52')]){_0x48de45['Interval']={'id':_0x2f62d7[_0x3162('0x52')]['id'],'name':_0x2f62d7[_0x3162('0x52')][_0x3162('0x20')]};}_0x30552f['push'](_0x48de45);}}_0x1c9992({'count':_0x30552f[_0x3162('0x53')],'rows':_0x30552f});});},'UpdateVoiceQueue':function(_0xeef972){return new Promise(function(_0x4a9cc9,_0x1f99d6){var _0x4d2180=_['find'](_0x7a4559['voiceQueues'],{'id':parseInt(_0xeef972['id'])});var _0x1a4bcf=_[_0x3162('0x54')](_0xeef972,['id']);if(_0x4d2180){for(var _0x2f68a0 in _0x1a4bcf){if(typeof _0x1a4bcf[_0x2f68a0]!==_0x3162('0x55')&&typeof _0x4d2180[_0x2f68a0]!==_0x3162('0x55')){_0x4d2180[_0x2f68a0]=_0x1a4bcf[_0x2f68a0];}}_0x4a9cc9(_0x4d2180);}else{_0x1f99d6();}});},'VoiceChannels':function(_0x41a8e0){return new Promise(function(_0x6d6b87,_0x1b363f){var _0x3d2958=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x57')]);_0x6d6b87({'count':_0x3d2958[_0x3162('0x53')],'rows':_0x3d2958});});},'VoiceChannelMixMonitor':function(_0x209383){var _0x56f9bf=this;return new Promise(function(_0x3ac940,_0x48cb8f){if(ami['isConnected']()==![]){return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}var _0x54941b=schema(properties[_0x3162('0x58')])[_0x3162('0x1')](_0x209383);if(_0x54941b['length']>0x0){return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f4,_['map'](_0x54941b,'message')[_0x3162('0x11')](',\x20')));}var _0x22c0a2=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x57')],{'uniqueid':_0x209383[_0x3162('0x5a')]});if(_0x22c0a2&&_0x22c0a2[_0x3162('0x5b')]){var _0x871a24=util[_0x3162('0x6')]('%s.%s',_0x209383['filename']||_0x209383['uniqueid'],_0x209383[_0x3162('0x6')]||_0x3162('0x5c'));return ami[_0x3162('0x16')]({'action':_0x3162('0x5d'),'channel':_0x22c0a2[_0x3162('0x5b')],'file':_0x871a24,'options':_0x3162('0x5e')})[_0x3162('0x17')](function(_0x4f46f3){var _0x1f35ae=_['find'](_0x22c0a2[_0x3162('0x5f')],{'filename':'/var/spool/asterisk/monitor/'+_0x871a24[_0x3162('0x60')]()});if(_['isNil'](_0x1f35ae)){_0x22c0a2[_0x3162('0x5f')][_0x3162('0x61')]({'filename':'/var/spool/asterisk/monitor/'+_0x871a24['toLowerCase'](),'createdAt':moment()[_0x3162('0x6')](_0x3162('0x62')),'mixmonitorid':_0x4f46f3['mixmonitorid'],'status':_0x3162('0x63')});}else{_0x1f35ae[_0x3162('0x64')]=_0x4f46f3[_0x3162('0x64')];_0x1f35ae[_0x3162('0x65')]=_0x3162('0x63');}_0x3ac940({'code':0xc8,'message':[_0x209383['uniqueid'],_0x3162('0x66'),_0x4f46f3[_0x3162('0x64')]]['join']('\x20'),'mixmonitorid':_0x4f46f3['mixmonitorid']});})[_0x3162('0x19')](function(_0x6ed643){_0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f5,[_0x209383['uniqueid'],_0x6ed643[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x434cb2){var _0x286aad=this;return new Promise(function(_0x5262b6,_0x3179a){if(ami['isConnected']()==![]){return _0x3179a(_0x286aad[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')]['username'],_0x3162('0x67')][_0x3162('0x11')]('\x20')));}var _0x3f039a=schema(properties[_0x3162('0x58')])[_0x3162('0x1')](_0x434cb2);if(_0x3f039a[_0x3162('0x53')]>0x0){return _0x3179a(_0x286aad['error'](0x1f4,_['map'](_0x3f039a,'message')[_0x3162('0x11')](',\x20')));}var _0x5b2de9=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x57')],{'uniqueid':_0x434cb2[_0x3162('0x5a')]});if(_0x5b2de9){return BPromise[_0x3162('0x68')]()[_0x3162('0x17')](function(){if(_0x5b2de9['channel']){return ami['Action']({'action':_0x3162('0x69'),'channel':_0x5b2de9[_0x3162('0x5b')],'mixmonitorid':_0x434cb2['mixmonitorid']})[_0x3162('0x19')](function(_0x2bd1ba){});}})[_0x3162('0x17')](function(){if(_0x5b2de9[_0x3162('0x6a')]){return ami[_0x3162('0x16')]({'action':'StopMixMonitor','channel':_0x5b2de9[_0x3162('0x6a')],'mixmonitorid':_0x434cb2[_0x3162('0x64')]})[_0x3162('0x19')](function(_0x28f891){});}})[_0x3162('0x17')](function(_0x5c8cef){var _0x35fcf5=_[_0x3162('0x59')](_0x5b2de9[_0x3162('0x5f')],{'mixmonitorid':_0x434cb2[_0x3162('0x64')]});if(_0x35fcf5){_0x35fcf5['status']=_0x3162('0x6b');}})[_0x3162('0x17')](function(){var _0x36f4c1=util[_0x3162('0x6')](_0x3162('0x6c'),_0x434cb2[_0x3162('0x6d')]||_0x434cb2[_0x3162('0x5a')],_0x434cb2[_0x3162('0x6')]||_0x3162('0x5c'));var _0x262266=_['find'](_0x5b2de9[_0x3162('0x5f')],{'filename':_0x3162('0x6e')+_0x36f4c1['toLowerCase']()});if(_0x262266){_0x262266[_0x3162('0x65')]='stop';}})[_0x3162('0x17')](function(){_0x5262b6({'code':0xc8,'message':[_0x434cb2[_0x3162('0x5a')],_0x3162('0x6f')][_0x3162('0x11')]('\x20')});})[_0x3162('0x19')](function(_0x3b6d3d){_0x3179a(_0x286aad['error'](0x1f5,[_0x434cb2[_0x3162('0x5a')],_0x3b6d3d[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x3179a(_0x286aad[_0x3162('0x1a')](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannels':function(_0x509c99){return new Promise(function(_0x2a3e33,_0x111952){var _0x282a44=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x71')]);_0x2a3e33({'count':_0x282a44[_0x3162('0x53')],'rows':_0x282a44});});},'VoiceQueuesChannel':function(_0xb3d824){var _0x502120=this;return new Promise(function(_0x57200f,_0x505885){var _0x39e748=schema(properties[_0x3162('0x72')])['validate'](_0xb3d824);if(_0x39e748[_0x3162('0x53')]>0x0){return _0x505885(_0x502120[_0x3162('0x1a')](0x1f4,_[_0x3162('0x73')](_0x39e748,_0x3162('0x18'))['join'](',\x20')));}var _0x1e5d8a=_[_0x3162('0x59')](_0x7a4559['queueChannels'],{'uniqueid':_0xb3d824[_0x3162('0x5a')]});if(_0x1e5d8a){_0x57200f(_0x1e5d8a);}else{return _0x505885(_0x502120['error'](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x47fec8){var _0x302aa2=this;return new Promise(function(_0x58e47e,_0x1dc930){if(ami[_0x3162('0x74')]()==![]){return _0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}var _0x63f6c2=schema(properties[_0x3162('0x75')])['validate'](_0x47fec8);if(_0x63f6c2[_0x3162('0x53')]>0x0){return _0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f4,_[_0x3162('0x73')](_0x63f6c2,_0x3162('0x18'))[_0x3162('0x11')](',\x20')));}var _0x5c1489=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x71')],{'uniqueid':_0x47fec8['uniqueid']});if(_0x5c1489&&_0x5c1489['channel']){return ami[_0x3162('0x16')]({'action':_0x3162('0x76'),'channel':_0x5c1489['channel']})[_0x3162('0x17')](function(_0xede1c1){_0x58e47e({'code':0xc8,'message':[_0x47fec8[_0x3162('0x5a')],_0xede1c1[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')});})[_0x3162('0x19')](function(_0x3da74a){_0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f5,[_0x47fec8['uniqueid'],_0x3da74a['message'][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x1dc930(_0x302aa2['error'](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x528d35){var _0x58a12c=this;return new Promise(function(_0x4bc14c,_0x31981a){if(ami['isConnected']()==![]){return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],_0x3162('0x67')][_0x3162('0x11')]('\x20')));}var _0x36b427=schema(properties[_0x3162('0x77')])[_0x3162('0x1')](_0x528d35);if(_0x36b427[_0x3162('0x53')]>0x0){return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f4,_['map'](_0x36b427,_0x3162('0x18'))[_0x3162('0x11')](',\x20')));}var _0x42c195=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x71')],{'uniqueid':_0x528d35[_0x3162('0x5a')]});if(_0x42c195&&_0x42c195[_0x3162('0x5b')]){return ami[_0x3162('0x16')]({'action':_0x3162('0x78'),'channel':_0x42c195[_0x3162('0x5b')],'exten':_0x528d35[_0x3162('0x79')],'context':_0x528d35[_0x3162('0x7a')]||_0x42c195['context'],'priority':0x1})[_0x3162('0x17')](function(_0x9d58e6){_0x4bc14c({'code':0xc8,'message':[_0x528d35[_0x3162('0x5a')],_0x9d58e6['message'][_0x3162('0x60')]()]['join']('\x20')});})[_0x3162('0x19')](function(_0x1caf1d){_0x31981a(_0x58a12c['error'](0x1f5,[_0x528d35['uniqueid'],_0x1caf1d[_0x3162('0x18')][_0x3162('0x60')]()]['join']('\x20')));});}else{return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xb48c1e){return new Promise(function(_0x3421a3,_0x287908){var _0x393765=_[_0x3162('0x56')](_0x7a4559[_0x3162('0xc')]);_0x3421a3({'count':_0x393765[_0x3162('0x53')],'rows':_0x393765});});},'Telephones':function(_0x3b58cc){return new Promise(function(_0xfafef4,_0x56fd04){var _0x42e4ef=_['values'](_0x7a4559[_0x3162('0x7b')]);_0xfafef4({'count':_0x42e4ef[_0x3162('0x53')],'rows':_0x42e4ef});});},'Trunks':function(_0x4e5420){return new Promise(function(_0x2d3fbe,_0x3ef7db){var _0x98de01=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x7c')]);_0x2d3fbe({'count':_0x98de01[_0x3162('0x53')],'rows':_0x98de01});});},'OutboundChannels':function(_0x1a9236){return new Promise(function(_0x59a84b,_0x40859e){var _0x23e10b=_[_0x3162('0x56')](_0x7a4559['outboundChannels']);_0x59a84b({'count':_0x23e10b[_0x3162('0x53')],'rows':_0x23e10b});});},'Outbound':function(_0x366891){return new Promise(function(_0x39529f,_0x2b8e21){_0x39529f(_0x7a4559[_0x3162('0x2b')]);});},'Campaigns':function(_0x398ffe){return new Promise(function(_0x4d144f,_0x1f2fd8){var _0x32147e=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x7d')]);_0x4d144f({'count':_0x32147e[_0x3162('0x53')],'rows':_0x32147e});});},'VoiceQueuesPreview':function(_0x585482){var _0xf70787=this;return new Promise(function(_0x516805,_0x15f447){_0x4b77c4[_0x3162('0x7e')](_0x585482['id'])['then'](function(_0x2cf06c){_0x516805({'code':0xc8,'message':_0x2cf06c[_0x3162('0x18')]});})[_0x3162('0x19')](function(_0x53ac8e){_0x15f447(_0xf70787[_0x3162('0x1a')](0x1f4,_0x53ac8e['message']));});});},'EventManager':function(_0x5369a0){var _0x3096ec=this;return new Promise(function(_0x4cfdee,_0x26f424){if(!_0x5369a0[_0x3162('0x7f')]){return _0x26f424(_0x3096ec[_0x3162('0x1a')](0x1f4,_0x3162('0x80')));}ami[_0x3162('0x81')]('custom:'+_0x5369a0['event'],_0x5369a0['message']);_0x4cfdee({'code':0xc8,'message':_0x5369a0});});},'FaxAccounts':function(_0x22182c){return new Promise(function(_0x10cc38,_0x50c0ed){var _0x5c6a78=_[_0x3162('0x56')](_0x7a4559['faxAccounts']);_0x10cc38({'count':_0x5c6a78[_0x3162('0x53')],'rows':_0x5c6a78});});},'SendFax':function(_0x35d9f0){var _0x4408db=this;return new Promise(function(_0x377edb,_0x563197){_0x1b55f2[_0x3162('0x82')](_0x35d9f0)[_0x3162('0x17')](function(_0x2800f9){_0x377edb({'code':0xc8,'message':_0x2800f9['message']});})[_0x3162('0x19')](function(_0x5c952c){_0x563197(_0x4408db[_0x3162('0x1a')](0x1f4,_0x5c952c['message']));});});},'CheckAfterSend':function(_0x4468d3){var _0x3d414f=this;return new Promise(function(_0x3da909,_0x591bb7){_0x1b55f2[_0x3162('0x83')](_0x4468d3)[_0x3162('0x17')](function(_0x1d5775){_0x3da909({'code':0xc8,'message':_0x1d5775[_0x3162('0x18')]});})['catch'](function(_0x17b9d9){_0x591bb7(_0x3d414f[_0x3162('0x1a')](0x1f4,_0x17b9d9['message']));});});}};var _0x3f0d75=jayson[_0x3162('0x84')](_0xffe9b6)[_0x3162('0x85')]();_0x3f0d75['on'](_0x3162('0x1a'),function(_0xdccc1a){return _0x53260d(_0xdccc1a);});_0x3f0d75[_0x3162('0x86')](0x232a,_0x3162('0x87'),function(){console[_0x3162('0x88')](_0x3162('0x89'),0x232a);return _0x428de6(_0x3162('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 9ba1f93..077aa70 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 _0x7f7e=['isNil','data5','xmd-contactid','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','ListId','createdAt','scheduledAt','updatedAt','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2'];(function(_0x526680,_0x305487){var _0x16ecaf=function(_0x2f3c14){while(--_0x2f3c14){_0x526680['push'](_0x526680['shift']());}};_0x16ecaf(++_0x305487);}(_0x7f7e,0x146));var _0xe7f7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f7e[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xe7f7('0x0'));var BPromise=require(_0xe7f7('0x1'));var Redis=require(_0xe7f7('0x2'));var util=require('util');var config=require(_0xe7f7('0x3'));var logger=require('../../../../config/logger')(_0xe7f7('0x4'));var cmContactRpc=require(_0xe7f7('0x5'));config[_0xe7f7('0x6')]=_[_0xe7f7('0x7')](config[_0xe7f7('0x6')],{'host':_0xe7f7('0x8'),'port':0x18eb});var io=require(_0xe7f7('0x9'))(new Redis(config['redis']));function emit(_0x5792de,_0x2b6aa4,_0xd19cfe,_0x1a4992,_0x35d274){logger[_0xe7f7('0xa')](_0xe7f7('0xb'),_0x5792de,_0x2b6aa4['id'],_0xd19cfe,_0x1a4992,JSON[_0xe7f7('0xc')](_0x35d274));io['to'](_0xd19cfe)[_0xe7f7('0xd')](_0x1a4992,_0x35d274);}exports[_0xe7f7('0xe')]=function(_0x52d1a0,_0x2c2a57,_0x2b4c89,_0x29f58d){var _0x4b4f87,_0x41695a;var _0x9692f6={};var _0x4dfdff;var _0x1690b1=Number(_0x2b4c89['data1']);var _0x55777b=_0x2b4c89['data2']?Boolean(Number(_0x2b4c89[_0xe7f7('0xf')])):![];var _0x57b1fe;var _0x5d15bf=![];if(!_[_0xe7f7('0x10')](_0x2b4c89[_0xe7f7('0x11')])){if(_0x2b4c89[_0xe7f7('0x11')]=='1')_0x5d15bf=!![];}if(!_0x5d15bf){if(_0x29f58d[_0xe7f7('0x12')]){_0x9692f6['id']=_0x29f58d[_0xe7f7('0x12')];}}if(!_0x9692f6['id']){_0x9692f6['ListId']=_0x1690b1;_0x57b1fe=_0x2b4c89[_0xe7f7('0x13')]&&_0x2b4c89['data3']!=='0'?_0x2b4c89[_0xe7f7('0x13')][_0xe7f7('0x14')](','):[_0xe7f7('0x15')];_0x9692f6[_0xe7f7('0x16')]=_['map'](_0x57b1fe,function(_0x565494){var _0x5564cc={};_0x5564cc[_0x565494]=_0x29f58d['routeId']?_0x29f58d[_0xe7f7('0x17')]:_0x29f58d[_0xe7f7('0x18')];return _0x5564cc;});_0x4dfdff=_0x29f58d[_0xe7f7('0x19')]?_0x29f58d['destcalleridnum']:_0x29f58d['calleridnum'];}var _0x46e6aa=['id',_0xe7f7('0x1a'),_0xe7f7('0x1b'),_0xe7f7('0x15'),_0xe7f7('0x1c'),'fax',_0xe7f7('0x1d'),_0xe7f7('0x1e'),_0xe7f7('0x1f'),_0xe7f7('0x20')];var _0x5c78b9=_['union'](_0x46e6aa,_0x57b1fe);BPromise['resolve']()[_0xe7f7('0x21')](cmContactRpc[_0xe7f7('0x22')]({'attributes':_0x5c78b9,'where':_0x9692f6,'phone':_0x4dfdff}))[_0xe7f7('0x21')](function(_0x36b090){_0x41695a=_0x36b090;if(!_[_0xe7f7('0x23')](_0x41695a)){if(_0x41695a[_0xe7f7('0x24')]===0x1){_0x4b4f87=_0x41695a[0x0];logger['info'](_0xe7f7('0x25'),_0x29f58d[_0xe7f7('0x26')],_0x2c2a57['id'],_0x4b4f87['id']);}else{logger[_0xe7f7('0xa')](_0xe7f7('0x27'),_0x29f58d[_0xe7f7('0x26')],_0x2c2a57['id'],_[_0xe7f7('0x28')](_0x41695a,'id')['join'](','));}return;}else{logger[_0xe7f7('0xa')](_0xe7f7('0x29'),_0x29f58d[_0xe7f7('0x26')],_0x2c2a57['id']);var _0x1c9e50={'ListId':_0x1690b1};var _0x5a82d8=_0x2b4c89[_0xe7f7('0x2a')]&&_0x2b4c89['data4']!=='0'?_0x2b4c89[_0xe7f7('0x2a')]:_0xe7f7('0x15');if(_0x55777b){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x29f58d['uniqueid'],_0x2c2a57['id']);_0x1c9e50[_0x5a82d8]=_[_0xe7f7('0x10')](_0x29f58d['routeId'])?_0x29f58d[_0xe7f7('0x18')]:_0x29f58d['destcalleridnum'];if(_[_0xe7f7('0x10')](_0x29f58d[_0xe7f7('0x19')])){_0x1c9e50[_0xe7f7('0x1a')]=_0x29f58d[_0xe7f7('0x2b')]&&_0x29f58d['calleridname']!==_0xe7f7('0x2c')?_0x29f58d['calleridname']:_0xe7f7('0x2d');}else{_0x1c9e50['firstName']=_0x29f58d['destcalleridname']&&_0x29f58d[_0xe7f7('0x2e')]!==_0xe7f7('0x2c')?_0x29f58d[_0xe7f7('0x2e')]:_0xe7f7('0x2d');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x1c9e50))[_0xe7f7('0x21')](function(_0x39cbf9){_0x4b4f87=_0x39cbf9;_0x41695a[_0xe7f7('0x2f')](_0x39cbf9);if(_0x4b4f87){logger[_0xe7f7('0xa')](_0xe7f7('0x30'),_0x29f58d[_0xe7f7('0x26')],_0x2c2a57['id'],_0x4b4f87['id']);}return;});}else{logger[_0xe7f7('0xa')](_0xe7f7('0x31'),_0x29f58d[_0xe7f7('0x26')],_0x2c2a57['id']);_0x1c9e50[_0x5a82d8]=_[_0xe7f7('0x10')](_0x29f58d[_0xe7f7('0x19')])?_0x29f58d[_0xe7f7('0x18')]:_0x29f58d['destcalleridnum'];if(_['isNil'](_0x29f58d[_0xe7f7('0x19')])){_0x1c9e50[_0xe7f7('0x1a')]=_0x29f58d[_0xe7f7('0x2b')]&&_0x29f58d[_0xe7f7('0x2b')]!==''?_0x29f58d[_0xe7f7('0x2b')]:_0xe7f7('0x2d');}else{_0x1c9e50[_0xe7f7('0x1a')]=_0x29f58d[_0xe7f7('0x2e')]&&_0x29f58d[_0xe7f7('0x2e')]!==_0xe7f7('0x2c')?_0x29f58d['destcalleridname']:_0xe7f7('0x2d');}_0x4b4f87=_0x1c9e50;_0x41695a[_0xe7f7('0x2f')](_0x1c9e50);return;}}})[_0xe7f7('0x21')](function(){if(_0x52d1a0){emit(_0x29f58d[_0xe7f7('0x26')],_0x2c2a57,util[_0xe7f7('0x32')](_0xe7f7('0x33'),_0x52d1a0[_0xe7f7('0x34')]),util['format'](_0xe7f7('0x35'),_0x2b4c89[_0xe7f7('0x36')][_0xe7f7('0x37')]()),{'evt':_[_0xe7f7('0x38')](_0x29f58d,{'autoCreate':_0x55777b}),'contact':_0x4b4f87===undefined?{}:_0x4b4f87,'contacts':_0x41695a[_0xe7f7('0x24')]===0x0?undefined:_0x41695a});}});}; \ No newline at end of file +var _0xb077=['ioredis','util','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','mobile','createdAt','scheduledAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','','calleridname','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xb077,0x1c6));var _0x7b07=function(_0x25f30e,_0x2cc50c){_0x25f30e=_0x25f30e-0x0;var _0x22241d=_0xb077[_0x25f30e];return _0x22241d;};'use strict';var _=require(_0x7b07('0x0'));var BPromise=require(_0x7b07('0x1'));var Redis=require(_0x7b07('0x2'));var util=require(_0x7b07('0x3'));var config=require(_0x7b07('0x4'));var logger=require(_0x7b07('0x5'))(_0x7b07('0x6'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x7b07('0x7')](config[_0x7b07('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7b07('0x9'))(new Redis(config[_0x7b07('0x8')]));function emit(_0x6959ff,_0x68e367,_0x26c5e2,_0x57bf92,_0x4c82c5){logger[_0x7b07('0xa')](_0x7b07('0xb'),_0x6959ff,_0x68e367['id'],_0x26c5e2,_0x57bf92,JSON['stringify'](_0x4c82c5));io['to'](_0x26c5e2)[_0x7b07('0xc')](_0x57bf92,_0x4c82c5);}exports[_0x7b07('0xd')]=function(_0x503980,_0x5aeac9,_0x238490,_0x2c22a1){var _0x1a1f8c,_0x4c4333;var _0x33aadd={};var _0x3896ed;var _0x336663=Number(_0x238490[_0x7b07('0xe')]);var _0x3d20b2=_0x238490['data2']?Boolean(Number(_0x238490['data2'])):![];var _0x5a12b7;var _0x1dd25d=![];if(!_[_0x7b07('0xf')](_0x238490[_0x7b07('0x10')])){if(_0x238490['data5']=='1')_0x1dd25d=!![];}if(!_0x1dd25d){if(_0x2c22a1[_0x7b07('0x11')]){_0x33aadd['id']=_0x2c22a1[_0x7b07('0x11')];}}if(!_0x33aadd['id']){_0x33aadd[_0x7b07('0x12')]=_0x336663;_0x5a12b7=_0x238490['data3']&&_0x238490[_0x7b07('0x13')]!=='0'?_0x238490[_0x7b07('0x13')][_0x7b07('0x14')](','):['phone'];_0x33aadd[_0x7b07('0x15')]=_[_0x7b07('0x16')](_0x5a12b7,function(_0xbdc10c){var _0x28e01d={};_0x28e01d[_0xbdc10c]=_0x2c22a1[_0x7b07('0x17')]?_0x2c22a1['destcalleridnum']:_0x2c22a1[_0x7b07('0x18')];return _0x28e01d;});_0x3896ed=_0x2c22a1[_0x7b07('0x17')]?_0x2c22a1[_0x7b07('0x19')]:_0x2c22a1['calleridnum'];}var _0x5bf98b=['id',_0x7b07('0x1a'),_0x7b07('0x1b'),_0x7b07('0x1c'),_0x7b07('0x1d'),'fax','ListId',_0x7b07('0x1e'),_0x7b07('0x1f'),'updatedAt'];var _0x166cdc=_[_0x7b07('0x20')](_0x5bf98b,_0x5a12b7);BPromise['resolve']()[_0x7b07('0x21')](cmContactRpc['getContacts']({'attributes':_0x166cdc,'where':_0x33aadd,'phone':_0x3896ed}))[_0x7b07('0x21')](function(_0x51433e){_0x4c4333=_0x51433e;if(!_[_0x7b07('0x22')](_0x4c4333)){if(_0x4c4333[_0x7b07('0x23')]===0x1){_0x1a1f8c=_0x4c4333[0x0];logger[_0x7b07('0xa')](_0x7b07('0x24'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id'],_0x1a1f8c['id']);}else{logger[_0x7b07('0xa')](_0x7b07('0x26'),_0x2c22a1['uniqueid'],_0x5aeac9['id'],_[_0x7b07('0x16')](_0x4c4333,'id')['join'](','));}return;}else{logger[_0x7b07('0xa')](_0x7b07('0x27'),_0x2c22a1['uniqueid'],_0x5aeac9['id']);var _0x5f2fc0={'ListId':_0x336663};var _0xa0bd4c=_0x238490[_0x7b07('0x28')]&&_0x238490['data4']!=='0'?_0x238490[_0x7b07('0x28')]:_0x7b07('0x1c');if(_0x3d20b2){logger[_0x7b07('0xa')](_0x7b07('0x29'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id']);_0x5f2fc0[_0xa0bd4c]=_[_0x7b07('0xf')](_0x2c22a1[_0x7b07('0x17')])?_0x2c22a1[_0x7b07('0x18')]:_0x2c22a1[_0x7b07('0x19')];if(_['isNil'](_0x2c22a1[_0x7b07('0x17')])){_0x5f2fc0[_0x7b07('0x1a')]=_0x2c22a1['calleridname']&&_0x2c22a1['calleridname']!==_0x7b07('0x2a')?_0x2c22a1[_0x7b07('0x2b')]:_0x7b07('0x2c');}else{_0x5f2fc0['firstName']=_0x2c22a1[_0x7b07('0x2d')]&&_0x2c22a1[_0x7b07('0x2d')]!==''?_0x2c22a1[_0x7b07('0x2d')]:'Unknown';}return BPromise[_0x7b07('0x2e')]()[_0x7b07('0x21')](cmContactRpc[_0x7b07('0x2f')](_0x5f2fc0))[_0x7b07('0x21')](function(_0x536df7){_0x1a1f8c=_0x536df7;_0x4c4333[_0x7b07('0x30')](_0x536df7);if(_0x1a1f8c){logger[_0x7b07('0xa')](_0x7b07('0x31'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id'],_0x1a1f8c['id']);}return;});}else{logger[_0x7b07('0xa')](_0x7b07('0x32'),_0x2c22a1['uniqueid'],_0x5aeac9['id']);_0x5f2fc0[_0xa0bd4c]=_[_0x7b07('0xf')](_0x2c22a1['routeId'])?_0x2c22a1['calleridnum']:_0x2c22a1[_0x7b07('0x19')];if(_[_0x7b07('0xf')](_0x2c22a1[_0x7b07('0x17')])){_0x5f2fc0['firstName']=_0x2c22a1[_0x7b07('0x2b')]&&_0x2c22a1['calleridname']!==''?_0x2c22a1[_0x7b07('0x2b')]:_0x7b07('0x2c');}else{_0x5f2fc0[_0x7b07('0x1a')]=_0x2c22a1[_0x7b07('0x2d')]&&_0x2c22a1[_0x7b07('0x2d')]!==_0x7b07('0x2a')?_0x2c22a1[_0x7b07('0x2d')]:_0x7b07('0x2c');}_0x1a1f8c=_0x5f2fc0;_0x4c4333[_0x7b07('0x30')](_0x5f2fc0);return;}}})[_0x7b07('0x21')](function(){if(_0x503980){emit(_0x2c22a1[_0x7b07('0x25')],_0x5aeac9,util['format']('user:%s',_0x503980[_0x7b07('0x33')]),util[_0x7b07('0x34')](_0x7b07('0x35'),_0x238490[_0x7b07('0x36')][_0x7b07('0x37')]()),{'evt':_[_0x7b07('0x38')](_0x2c22a1,{'autoCreate':_0x3d20b2}),'contact':_0x1a1f8c===undefined?{}:_0x1a1f8c,'contacts':_0x4c4333['length']===0x0?undefined:_0x4c4333});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7680991..7bbeaf6 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 _0x042a=['custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','clone','motionChannel','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data4','uriLocation','windowWidth','800','windowHeight','data6','winApplication','winArguments','data3','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','integration','exec','queue','routeId','urlforward','script','parse','query','search','channel','AllConditions','every','AnyConditions','some','checkConditions','field','account','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','membername','lastevent','substatus','undefined','created','exports','util','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x042a,0x1d9));var _0xa042=function(_0x2ad476,_0x1a8c45){_0x2ad476=_0x2ad476-0x0;var _0x28e698=_0x042a[_0x2ad476];return _0x28e698;};'use strict';var util=require(_0xa042('0x0'));var _=require('lodash');var url=require(_0xa042('0x1'));var Mustache=require(_0xa042('0x2'));var Redis=require(_0xa042('0x3'));var urlforward=require('./urlforward');var integration=require(_0xa042('0x4'));var cmContact=require(_0xa042('0x5'));var script=require(_0xa042('0x6'));var config=require(_0xa042('0x7'));var logger=require(_0xa042('0x8'))(_0xa042('0x9'));var ami=require(_0xa042('0xa'));config[_0xa042('0xb')]=_['defaults'](config[_0xa042('0xb')],{'host':_0xa042('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa042('0xb')]));var operators={'equals':function(_0x533f67,_0x44da66){return _0x533f67==_0x44da66;},'not_equals':function(_0xd80124,_0x15426e){return _0xd80124!=_0x15426e;}};var barAndWebActions=[_0xa042('0xd'),_0xa042('0x1'),_0xa042('0xe')];function Trigger(_0x550ee2){this[_0xa042('0xf')]=_0x550ee2['triggers'];this[_0xa042('0x10')]=_0x550ee2['agents'];this[_0xa042('0x11')]=_0x550ee2[_0xa042('0x11')];this[_0xa042('0x12')]=_0x550ee2['templates'];this[_0xa042('0x13')]=_0x550ee2[_0xa042('0x13')];this[_0xa042('0x14')]=_0x550ee2['zendeskAccounts'];this[_0xa042('0x15')]=_0x550ee2[_0xa042('0x15')];this[_0xa042('0x16')]=_0x550ee2[_0xa042('0x16')];this['sugarcrmAccounts']=_0x550ee2[_0xa042('0x17')];this[_0xa042('0x18')]=_0x550ee2[_0xa042('0x18')];this[_0xa042('0x19')]=_0x550ee2[_0xa042('0x19')];this[_0xa042('0x1a')]=_0x550ee2['vtigerAccounts'];this['servicenowAccounts']=_0x550ee2[_0xa042('0x1b')];this[_0xa042('0x1c')]=_0x550ee2[_0xa042('0x1c')];this[_0xa042('0x1d')]=_0x550ee2[_0xa042('0x1d')];this[_0xa042('0x1e')]={'zendesk':this[_0xa042('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0xa042('0x1a')],'dynamics365':this[_0xa042('0x1c')],'freshsales':this[_0xa042('0x1d')],'servicenow':this[_0xa042('0x1b')]};ami['on'](_0xa042('0x1f'),this[_0xa042('0x20')]['bind'](this));ami['on'](_0xa042('0x21'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x23'),this['syncCustomEvent'][_0xa042('0x22')](this));ami['on'](_0xa042('0x24'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x25'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x26'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x27'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x28'),this['syncCustomEvent'][_0xa042('0x22')](this));ami['on'](_0xa042('0x29'),this['syncCustomEvent'][_0xa042('0x22')](this));ami['on'](_0xa042('0x2a'),this['syncCustomEvent'][_0xa042('0x22')](this));ami['on'](_0xa042('0x2b'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x2c'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x2d'),this[_0xa042('0x2e')][_0xa042('0x22')](this));ami['on'](_0xa042('0x2f'),this['syncAgentDial']['bind'](this));ami['on'](_0xa042('0x30'),this[_0xa042('0x2e')][_0xa042('0x22')](this));ami['on'](_0xa042('0x31'),this['syncCustomEvent'][_0xa042('0x22')](this));ami['on']('custom:closedinteraction',this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on']('custom:substatus',this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0xa042('0x20')]['bind'](this));ami['on'](_0xa042('0x32'),this[_0xa042('0x20')]['bind'](this));ami['on'](_0xa042('0x33'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa042('0x34'),this[_0xa042('0x20')][_0xa042('0x22')](this));ami['on'](_0xa042('0x35'),this[_0xa042('0x20')][_0xa042('0x22')](this));}Trigger[_0xa042('0x36')][_0xa042('0x37')]=function(_0x5bc8b8,_0x304a19,_0x15b5ce){logger['info'](_0x5bc8b8,_0x304a19,JSON['stringify'](_0x15b5ce));io['to'](_0x5bc8b8)['emit'](_0x304a19,_0x15b5ce);};Trigger[_0xa042('0x36')]['syncCustomEvent']=function(_0x3ba6e6){var _0x270566=_[_0xa042('0x38')](_0x3ba6e6);if(typeof _0x270566[_0xa042('0x39')]==='undefined'){_0x270566[_0xa042('0x39')]='voice';}this['checkTriggers'](_0x270566);};Trigger[_0xa042('0x36')]['syncAgentDial']=function(_0x46c2da){if(this[_0xa042('0x10')][_0x46c2da[_0xa042('0x3a')]]){this[_0xa042('0x20')](_0x46c2da);}};Trigger[_0xa042('0x36')]['checkTriggers']=function(_0x38fb95){var _0x19f0fc;for(var _0x10d663 in this[_0xa042('0xf')]){if(this[_0xa042('0xf')][_0xa042('0x3b')](_0x10d663)){if(this[_0xa042('0xf')][_0x10d663][_0xa042('0x3c')]){_0x19f0fc=this[_0xa042('0x3d')](this[_0xa042('0xf')][_0x10d663],_0x38fb95);if(_0x19f0fc){_[_0xa042('0x3e')](_0x38fb95,_0x38fb95[_0xa042('0x3f')]);for(var _0x46406f=0x0,_0x31d2c3,_0x542d5b,_0x2c6fb6;_0x46406f0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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(_0x2adc39,_0x4b8b06){var _0x1f1b27=function(_0x46f4f9){while(--_0x46f4f9){_0x2adc39['push'](_0x2adc39['shift']());}};_0x1f1b27(++_0x4b8b06);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 fc92273..940e421 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 _0xf19e=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','type','customField','indexOf','substring','content','ticketType','assign','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','util','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','remoteUri','CloudProvider','data7','data2','clientId','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','systemuserid','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','body','lastIndexOf','catch','destcalleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId'];(function(_0x1e756c,_0x40b137){var _0x3527c4=function(_0x395dfb){while(--_0x395dfb){_0x1e756c['push'](_0x1e756c['shift']());}};_0x3527c4(++_0x40b137);}(_0xf19e,0x97));var _0xef19=function(_0x1f5ba5,_0x228374){_0x1f5ba5=_0x1f5ba5-0x0;var _0x5a0bc5=_0xf19e[_0x1f5ba5];return _0x5a0bc5;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require(_0xef19('0x0'));var intUtil=require(_0xef19('0x1'));var md5=require(_0xef19('0x2'));var Redis=require('ioredis');var logger=require(_0xef19('0x3'))('dynamics365');var config=require(_0xef19('0x4'));config[_0xef19('0x5')]=_[_0xef19('0x6')](config[_0xef19('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xef19('0x7'))(new Redis(config['redis']));function getAuthToken(_0x538e25,_0x994156,_0x8b424f){if(_0x538e25['modernAuthentication']){_0x538e25[_0xef19('0x8')]=_0x538e25[_0xef19('0x9')][_0xef19('0xa')];_0x538e25['tenantId']=_0x538e25[_0xef19('0x9')][_0xef19('0xb')];return Promise['resolve'](_0x538e25[_0xef19('0x9')]['data5']);}var _0x162f3d={'method':'POST','uri':_0x994156,'form':{'client_id':_0x538e25[_0xef19('0xc')],'resource':_0x538e25[_0xef19('0x8')],'username':_0x538e25['username'],'password':_0x538e25[_0xef19('0xd')],'grant_type':_0xef19('0xd'),'client_secret':_0x538e25[_0xef19('0xe')]},'json':!![]};return rp(_0x162f3d)[_0xef19('0xf')](function(_0x3d1937){return _0x3d1937[_0xef19('0x10')];})['catch'](function(_0x3981c8){logger[_0xef19('0x11')]('['+[_0x8b424f[_0xef19('0x12')]()]+']\x20Wrong\x20credentials!');return _0x3981c8[_0xef19('0x13')];});}function getUser(_0x5f18df,_0x4ee824,_0x3ef6c8,_0x2a3a13,_0x3a2e45,_0x51ad42){return new Promise(function(_0x47ba43,_0x271256){return getAuthToken(_0x4ee824,_0x2a3a13,_0x51ad42)[_0xef19('0xf')](function(_0x32dea0){var _0x5b7412={'method':_0xef19('0x14'),'uri':_0x3a2e45+_0xef19('0x15'),'headers':{'Authorization':_0xef19('0x16')+_0x32dea0,'OData-Version':_0xef19('0x17')},'json':!![]};return rp(_0x5b7412);})[_0xef19('0xf')](function(_0x14e72f){var _0x440d36=_0x14e72f[_0xef19('0x18')];var _0x3dd082=![];var _0x26725d=null;if(!_[_0xef19('0x19')](_0x3ef6c8)){if(intUtil[_0xef19('0x1a')](_0x3ef6c8['email'])){_0x5f18df[_0xef19('0x1b')]=_0x3ef6c8[_0xef19('0x1c')];for(_0x26725d=0x0;_0x26725d<_0x440d36[_0xef19('0x1d')];_0x26725d++){if(_0x440d36[_0x26725d][_0xef19('0x1e')]===_0x3ef6c8['email']&&!_0x440d36[_0x26725d][_0xef19('0x1f')]){_0x3dd082=!![];logger[_0xef19('0x20')]('['+[_0x51ad42[_0xef19('0x12')]()]+']\x20Agent\x20found\x20'+_0x440d36[_0x26725d]['systemuserid']+'!');_0x5f18df[_0xef19('0x21')]=_0x440d36[_0x26725d]['systemuserid'];}}}}if(!_0x3dd082){logger[_0xef19('0x20')]('['+[_0x51ad42['toUpperCase']()]+_0xef19('0x22'));_0x5f18df[_0xef19('0x1b')]=_0x4ee824[_0xef19('0x23')];for(_0x26725d=0x0;_0x26725d<_0x440d36[_0xef19('0x1d')];_0x26725d++){if(_0x440d36[_0x26725d][_0xef19('0x1e')]===_0x4ee824[_0xef19('0x23')]){_0x5f18df[_0xef19('0x21')]=_0x440d36[_0x26725d][_0xef19('0x24')];}}}_0x47ba43(_0x5f18df);})['catch'](function(_0x21a906){_0x271256(_0x21a906[_0xef19('0x13')]);});});}function createEndUser(_0x195a69,_0x447592,_0x499769,_0x132f78,_0x3c6852,_0x2e9719,_0x528e1d){return new Promise(function(_0x2da69c,_0x38128c){return getAuthToken(_0x447592,_0x499769,_0x2e9719)[_0xef19('0xf')](function(_0x3f4a57){var _0x24aea0=_0x2e9719[_0xef19('0x25')]()===_0xef19('0x26')?_0x3c6852['destcalleridnum']:_0x3c6852[_0xef19('0x27')];var _0x5123b8={'method':_0xef19('0x28'),'uri':_0x132f78+_0xef19('0x29'),'body':{'fullname':_0x24aea0,'firstname':_0x24aea0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xef19('0x2a')+_0x195a69[_0xef19('0x21')]+')'},'headers':{'Authorization':_0xef19('0x16')+_0x3f4a57,'OData-Version':_0xef19('0x17')},'json':!![],'resolveWithFullResponse':!![]};_0x5123b8[_0xef19('0x2b')][_0x528e1d]=_0x24aea0;return rp(_0x5123b8);})[_0xef19('0xf')](function(_0x4564a2){var _0x353dc3=_0x4564a2['headers']['odata-entityid'];var _0x3cc16d=_0x353dc3['substring'](_0x353dc3[_0xef19('0x2c')]('(')+0x1,_0x353dc3[_0xef19('0x2c')](')'));_0x195a69['enduserId']=_0x3cc16d;_0x2da69c(_0x195a69);})[_0xef19('0x2d')](function(_0x4dded7){_0x38128c(_0x4dded7[_0xef19('0x13')]);});});}function getEndUser(_0x45c81a,_0x3872d2,_0x48f50f,_0x1650f7,_0x328a05,_0x51f945,_0x47578c,_0x3d08e3){var _0x51e82b=_0x51f945[_0xef19('0x25')]()===_0xef19('0x26')?_0x328a05[_0xef19('0x2e')]:_0x328a05[_0xef19('0x27')];return getAuthToken(_0x3872d2,_0x48f50f,_0x51f945)[_0xef19('0xf')](function(_0x2baf99){_0x3d08e3=_0x3d08e3?_0x3d08e3:_0xef19('0x2f');var _0x4bd04d={'method':_0xef19('0x14'),'uri':_0x1650f7+'contacts?$select='+_0x3d08e3+_0xef19('0x30')+_0x3d08e3+_0xef19('0x31')+_0x51e82b[_0xef19('0x32')]('+',_0xef19('0x33'))+'\x27','headers':{'Authorization':_0xef19('0x16')+_0x2baf99,'If-None-Match':null,'OData-Version':_0xef19('0x17')},'json':!![]};return rp(_0x4bd04d);})[_0xef19('0xf')](function(_0x5e50c4){var _0x8254c3=![];if(!_0x5e50c4)return _0x8254c3;var _0x1d9e17=_0x5e50c4['value'];for(var _0x27c2e8=0x0;_0x27c2e8<_0x1d9e17[_0xef19('0x1d')];_0x27c2e8++){if(_0x1d9e17[_0x27c2e8][_0x3d08e3]===_0x51e82b){_0x8254c3=!![];_0x45c81a[_0xef19('0x34')]=_0x1d9e17[_0x27c2e8]['contactid'];}}return _0x8254c3;})['then'](function(_0xac6f8f){if(_0xac6f8f)return _0x45c81a;if(_0x47578c===_0xef19('0x35')){logger[_0xef19('0x20')]('['+[_0x51f945[_0xef19('0x12')]()]+_0xef19('0x36'));return _0x45c81a;}return createEndUser(_0x45c81a,_0x3872d2,_0x48f50f,_0x1650f7,_0x328a05,_0x51f945,_0x3d08e3)['then'](function(_0x24c709){logger[_0xef19('0x20')]('['+[_0x51f945[_0xef19('0x12')]()]+_0xef19('0x37'),_0x24c709[_0xef19('0x34')]);return _0x24c709;});});}function getCustomFields(_0x2fb0d4,_0x283ec4,_0x1838e9){var _0x185abf={};if(_0x2fb0d4['length']>0x0){_['forEach'](_0x2fb0d4,function(_0x24f425){if(_['includes']([_0xef19('0x38'),_0xef19('0x39')],_0x24f425[_0xef19('0x3a')])&&_0x24f425['nameField']&&!_0x24f425[_0xef19('0x3b')]){var _0x516af0=_0x24f425['idField']['toLowerCase']();var _0x28577f=_0x516af0['substring'](0x0,_0x516af0[_0xef19('0x3c')]('_'));var _0x22c7a6=_0x516af0[_0xef19('0x3d')](_0x516af0[_0xef19('0x3c')]('_')+0x1);if(_0x28577f===_0x1838e9){_0x185abf[_0x22c7a6]=_0x24f425[_0xef19('0x3e')];}}});}return _0x185abf;}function getTicket(_0x43dcd8,_0x1a48fa,_0x440956,_0x34bce3,_0x294c45,_0x14b833,_0x257f99){return new Promise(function(_0x334227,_0x2c94cb){var _0x4cd6a6;return getAuthToken(_0x1a48fa,_0x440956,_0x257f99)[_0xef19('0xf')](function(_0x5e299d){if(_0x14b833[_0xef19('0x3f')]==='incident'){_0x4cd6a6={'method':'POST','uri':_0x34bce3+'incidents','body':Object[_0xef19('0x40')]({},{'title':intUtil[_0xef19('0x41')](_0x14b833[_0xef19('0x42')],_0x294c45,'\x20'),'description':intUtil[_0xef19('0x41')](_0x14b833['Descriptions'],_0x294c45,'\x0a'),'customerid_contact@odata.bind':_0x43dcd8[_0xef19('0x34')]?_0xef19('0x43')+_0x43dcd8[_0xef19('0x34')]+')':undefined,'ownerid@odata.bind':_0xef19('0x2a')+_0x43dcd8['userId']+')','caseorigincode':'1'},getCustomFields(_0x14b833[_0xef19('0x44')],_0x294c45,_0x14b833['ticketType'])),'headers':{'Authorization':_0xef19('0x16')+_0x5e299d,'OData-Version':_0xef19('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x14b833[_0xef19('0x3f')]===_0xef19('0x45')){var _0x5b1351=_0x43dcd8[_0xef19('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x43dcd8[_0xef19('0x21')]+')','participationtypemask':_0x43dcd8[_0xef19('0x46')]===_0xef19('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xef19('0x43')+_0x43dcd8[_0xef19('0x34')]+')','participationtypemask':_0x43dcd8[_0xef19('0x46')]===_0xef19('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x43dcd8[_0xef19('0x21')]+')','participationtypemask':_0x43dcd8[_0xef19('0x46')]===_0xef19('0x47')?0x2:0x1}];_0x4cd6a6={'method':_0xef19('0x28'),'uri':_0x34bce3+_0xef19('0x48'),'body':Object[_0xef19('0x40')]({},{'subject':intUtil[_0xef19('0x41')](_0x14b833[_0xef19('0x42')],_0x294c45,'\x20'),'phonenumber':String(_0x294c45['calleridnum']),'description':intUtil[_0xef19('0x41')](_0x14b833['Descriptions'],_0x294c45,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43dcd8['enduserId']?'/contacts('+_0x43dcd8[_0xef19('0x34')]+')':undefined,'ownerid@odata.bind':_0xef19('0x2a')+_0x43dcd8[_0xef19('0x21')]+')','directioncode':_0x43dcd8[_0xef19('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5b1351},getCustomFields(_0x14b833[_0xef19('0x44')],_0x294c45,_0x14b833[_0xef19('0x3f')])),'headers':{'Authorization':_0xef19('0x16')+_0x5e299d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4cd6a6);})[_0xef19('0xf')](function(_0x12bd7b){var _0x496b3a=_0x12bd7b[_0xef19('0x49')][_0xef19('0x4a')];var _0x1ef68d=_0x496b3a[_0xef19('0x3d')](_0x496b3a[_0xef19('0x2c')]('(')+0x1,_0x496b3a[_0xef19('0x2c')](')'));_0x43dcd8[_0xef19('0x4b')]=_0x1ef68d;_0x334227(_0x43dcd8);})['catch'](function(_0x42441d){_0x2c94cb(_0x42441d['message']);});});}function emit(_0x42ecc6,_0x56f5d8,_0x3183ec,_0x4f2ad4){var _0x598dbd={'uri':util[_0xef19('0x4c')](_0xef19('0x4d'),_0x42ecc6,_0x3183ec,_0x4f2ad4)};io['to'](util[_0xef19('0x4c')](_0xef19('0x4e'),_0x56f5d8))['emit']('trigger:browser:url',_0x598dbd);}exports['cs']=function(_0x3d1776,_0x2dfaea,_0x2d4e40,_0x3a33f3,_0x2d1311,_0x5bd19d,_0x164402,_0x32b87c){var _0x8ff19e={};_0x5bd19d[_0xef19('0x8')]=_0x5bd19d[_0xef19('0x4f')]?intUtil[_0xef19('0x50')](_0x5bd19d[_0xef19('0x9')]['data7']):intUtil[_0xef19('0x50')](_0x5bd19d['remoteUri']);_0x5bd19d[_0xef19('0x51')]=intUtil[_0xef19('0x50')](_0x5bd19d[_0xef19('0x51')]);_0x8ff19e[_0xef19('0x46')]=_0x32b87c===_0xef19('0x47')||_0x32b87c==='unmanaged'?_0xef19('0x47'):_0xef19('0x26');var _0x48c692=_0x5bd19d[_0xef19('0x4f')]?util['format'](_0xef19('0x52'),_0x5bd19d[_0xef19('0x9')]['data7']):util[_0xef19('0x4c')](_0xef19('0x52'),_0x5bd19d[_0xef19('0x8')]);var _0xb47980=util[_0xef19('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5bd19d[_0xef19('0x53')]);var _0x219957=util['format'](_0xef19('0x54'),_0x5bd19d[_0xef19('0x51')],_0x2dfaea[_0xef19('0x55')],md5(_0x2dfaea['uniqueid']));if(_0x2d1311&&_0x2d1311['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2dfaea[_0xef19('0x56')]=_0x219957;}else if(_0x164402&&_0x164402[_0xef19('0x57')]&&_0x164402[_0xef19('0x57')]!==_0xef19('0x58')){logger[_0xef19('0x20')]('[OUTBOUND]',_0xef19('0x59'));_0x2dfaea[_0xef19('0x56')]=_0x219957;}else{_0x2dfaea[_0xef19('0x56')]='';}return getUser(_0x8ff19e,_0x5bd19d,_0x3a33f3,_0xb47980,_0x48c692,_0x32b87c)[_0xef19('0xf')](function(_0x19b9b3){logger[_0xef19('0x20')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x5a'),_0x19b9b3[_0xef19('0x21')]);logger[_0xef19('0x20')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x5b'),_0x19b9b3[_0xef19('0x1b')]);return getEndUser(_0x19b9b3,_0x5bd19d,_0xb47980,_0x48c692,_0x2dfaea,_0x32b87c,_0x2d4e40[_0xef19('0x5c')],_0x2d4e40[_0xef19('0x5d')]);})['then'](function(_0x32c326){logger[_0xef19('0x20')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x5e'),_0x32c326[_0xef19('0x34')]);logger[_0xef19('0x20')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x5f'),_0x2dfaea[_0xef19('0x27')]);return getTicket(_0x32c326,_0x5bd19d,_0xb47980,_0x48c692,_0x2dfaea,_0x2d4e40,_0x32b87c);})[_0xef19('0xf')](function(_0x300788){logger[_0xef19('0x20')](util['format']('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x60'),_0x2d4e40[_0xef19('0x3f')],_0x300788[_0xef19('0x4b')]));logger['info'](util[_0xef19('0x4c')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x61'),_0x32b87c));if(_0x32b87c!==_0xef19('0x62')&&_0x2d4e40['openNewTab']){logger[_0xef19('0x20')]('['+_0x32b87c[_0xef19('0x12')]()+']',_0xef19('0x63'));emit(_0x5bd19d['remoteUri'],_0x3a33f3[_0xef19('0x64')],_0x2d4e40[_0xef19('0x3f')],_0x300788[_0xef19('0x4b')]);}})[_0xef19('0x2d')](function(_0x3729bd){logger[_0xef19('0x11')]('['+_0x32b87c[_0xef19('0x12')]()+_0xef19('0x65'),_0x3729bd[_0xef19('0x13')]);console[_0xef19('0x11')]('Error\x20running\x20Dynamics365\x20integration',_0x3729bd);});}; \ No newline at end of file +var _0x7ee5=['forEach','includes','picklist','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','/contacts(','Fields','callDirection','queue','phonecalls','Descriptions','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','POST','clientId','password','clientSecret','then','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!'];(function(_0x42c7bf,_0x5ed895){var _0x32cafc=function(_0x19d617){while(--_0x19d617){_0x42c7bf['push'](_0x42c7bf['shift']());}};_0x32cafc(++_0x5ed895);}(_0x7ee5,0xa4));var _0x57ee=function(_0x57560d,_0x215718){_0x57560d=_0x57560d-0x0;var _0x50b44a=_0x7ee5[_0x57560d];return _0x50b44a;};'use strict';var _=require(_0x57ee('0x0'));var rp=require('request-promise');var util=require(_0x57ee('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x57ee('0x2'));var logger=require('../../../../config/logger')(_0x57ee('0x3'));var config=require(_0x57ee('0x4'));config[_0x57ee('0x5')]=_[_0x57ee('0x6')](config['redis'],{'host':_0x57ee('0x7'),'port':0x18eb});var io=require(_0x57ee('0x8'))(new Redis(config[_0x57ee('0x5')]));function getAuthToken(_0x5ad128,_0xea57d2,_0x5116ce){if(_0x5ad128[_0x57ee('0x9')]){_0x5ad128[_0x57ee('0xa')]=_0x5ad128[_0x57ee('0xb')][_0x57ee('0xc')];_0x5ad128['tenantId']=_0x5ad128['CloudProvider'][_0x57ee('0xd')];return Promise[_0x57ee('0xe')](_0x5ad128[_0x57ee('0xb')]['data5']);}var _0x5eb6ca={'method':_0x57ee('0xf'),'uri':_0xea57d2,'form':{'client_id':_0x5ad128[_0x57ee('0x10')],'resource':_0x5ad128[_0x57ee('0xa')],'username':_0x5ad128['username'],'password':_0x5ad128[_0x57ee('0x11')],'grant_type':_0x57ee('0x11'),'client_secret':_0x5ad128[_0x57ee('0x12')]},'json':!![]};return rp(_0x5eb6ca)[_0x57ee('0x13')](function(_0x47a8b1){return _0x47a8b1['access_token'];})[_0x57ee('0x14')](function(_0x488e8c){logger[_0x57ee('0x15')]('['+[_0x5116ce[_0x57ee('0x16')]()]+']\x20Wrong\x20credentials!');return _0x488e8c[_0x57ee('0x17')];});}function getUser(_0x762d4a,_0xbb6819,_0x4d5118,_0x3eb32d,_0x25c201,_0x1beb25){return new Promise(function(_0x106fd0,_0x3e7471){return getAuthToken(_0xbb6819,_0x3eb32d,_0x1beb25)[_0x57ee('0x13')](function(_0x2e2736){var _0x4ca6ac={'method':_0x57ee('0x18'),'uri':_0x25c201+_0x57ee('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x2e2736,'OData-Version':_0x57ee('0x1a')},'json':!![]};return rp(_0x4ca6ac);})['then'](function(_0x231e14){var _0x1261f9=_0x231e14[_0x57ee('0x1b')];var _0x377995=![];var _0x28a14e=null;if(!_[_0x57ee('0x1c')](_0x4d5118)){if(intUtil[_0x57ee('0x1d')](_0x4d5118['email'])){_0x762d4a['userEmail']=_0x4d5118[_0x57ee('0x1e')];for(_0x28a14e=0x0;_0x28a14e<_0x1261f9[_0x57ee('0x1f')];_0x28a14e++){if(_0x1261f9[_0x28a14e]['internalemailaddress']===_0x4d5118[_0x57ee('0x1e')]&&!_0x1261f9[_0x28a14e][_0x57ee('0x20')]){_0x377995=!![];logger['info']('['+[_0x1beb25[_0x57ee('0x16')]()]+_0x57ee('0x21')+_0x1261f9[_0x28a14e]['systemuserid']+'!');_0x762d4a[_0x57ee('0x22')]=_0x1261f9[_0x28a14e][_0x57ee('0x23')];}}}}if(!_0x377995){logger[_0x57ee('0x24')]('['+[_0x1beb25['toUpperCase']()]+_0x57ee('0x25'));_0x762d4a['userEmail']=_0xbb6819['username'];for(_0x28a14e=0x0;_0x28a14e<_0x1261f9[_0x57ee('0x1f')];_0x28a14e++){if(_0x1261f9[_0x28a14e][_0x57ee('0x26')]===_0xbb6819[_0x57ee('0x27')]){_0x762d4a[_0x57ee('0x22')]=_0x1261f9[_0x28a14e][_0x57ee('0x23')];}}}_0x106fd0(_0x762d4a);})[_0x57ee('0x14')](function(_0x1aefbb){_0x3e7471(_0x1aefbb[_0x57ee('0x17')]);});});}function createEndUser(_0x22f1e2,_0x1badac,_0x2aaeda,_0x3c56d2,_0x1dfc8c,_0x3428b5,_0x2efea6){return new Promise(function(_0x154aa3,_0x1175df){return getAuthToken(_0x1badac,_0x2aaeda,_0x3428b5)[_0x57ee('0x13')](function(_0x2f20b6){var _0x2acfa7=_0x3428b5[_0x57ee('0x28')]()===_0x57ee('0x29')?_0x1dfc8c[_0x57ee('0x2a')]:_0x1dfc8c[_0x57ee('0x2b')];var _0x27d711={'method':'POST','uri':_0x3c56d2+_0x57ee('0x2c'),'body':{'fullname':_0x2acfa7,'firstname':_0x2acfa7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x57ee('0x2d')+_0x22f1e2[_0x57ee('0x22')]+')'},'headers':{'Authorization':_0x57ee('0x2e')+_0x2f20b6,'OData-Version':_0x57ee('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x27d711[_0x57ee('0x2f')][_0x2efea6]=_0x2acfa7;return rp(_0x27d711);})[_0x57ee('0x13')](function(_0x1f465e){var _0x385464=_0x1f465e[_0x57ee('0x30')][_0x57ee('0x31')];var _0x51d46e=_0x385464['substring'](_0x385464['lastIndexOf']('(')+0x1,_0x385464[_0x57ee('0x32')](')'));_0x22f1e2[_0x57ee('0x33')]=_0x51d46e;_0x154aa3(_0x22f1e2);})[_0x57ee('0x14')](function(_0x4c701b){_0x1175df(_0x4c701b[_0x57ee('0x17')]);});});}function getEndUser(_0x1a94c6,_0x40f98c,_0x270645,_0x342bb8,_0x4fe882,_0x14dd28,_0x4aefba,_0x377ef8){var _0x420438=_0x14dd28[_0x57ee('0x28')]()===_0x57ee('0x29')?_0x4fe882[_0x57ee('0x2a')]:_0x4fe882[_0x57ee('0x2b')];return getAuthToken(_0x40f98c,_0x270645,_0x14dd28)['then'](function(_0x5d84b8){_0x377ef8=_0x377ef8?_0x377ef8:_0x57ee('0x34');var _0x444813={'method':_0x57ee('0x18'),'uri':_0x342bb8+_0x57ee('0x35')+_0x377ef8+'&$filter='+_0x377ef8+_0x57ee('0x36')+_0x420438[_0x57ee('0x37')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5d84b8,'If-None-Match':null,'OData-Version':_0x57ee('0x1a')},'json':!![]};return rp(_0x444813);})[_0x57ee('0x13')](function(_0x3bf568){var _0x47c5e9=![];if(!_0x3bf568)return _0x47c5e9;var _0x31cab3=_0x3bf568[_0x57ee('0x1b')];for(var _0x475e80=0x0;_0x475e80<_0x31cab3[_0x57ee('0x1f')];_0x475e80++){if(_0x31cab3[_0x475e80][_0x377ef8]===_0x420438){_0x47c5e9=!![];_0x1a94c6[_0x57ee('0x33')]=_0x31cab3[_0x475e80][_0x57ee('0x38')];}}return _0x47c5e9;})[_0x57ee('0x13')](function(_0x5ec56d){if(_0x5ec56d)return _0x1a94c6;if(_0x4aefba===_0x57ee('0x39')){logger[_0x57ee('0x24')]('['+[_0x14dd28[_0x57ee('0x16')]()]+_0x57ee('0x3a'));return _0x1a94c6;}return createEndUser(_0x1a94c6,_0x40f98c,_0x270645,_0x342bb8,_0x4fe882,_0x14dd28,_0x377ef8)[_0x57ee('0x13')](function(_0x220ca4){logger['info']('['+[_0x14dd28[_0x57ee('0x16')]()]+_0x57ee('0x3b'),_0x220ca4[_0x57ee('0x33')]);return _0x220ca4;});});}function getCustomFields(_0x15943f,_0x5ece13,_0x15f0fc){var _0x3cc967={};if(_0x15943f[_0x57ee('0x1f')]>0x0){_[_0x57ee('0x3c')](_0x15943f,function(_0xcb3ff8){if(_[_0x57ee('0x3d')](['string',_0x57ee('0x3e')],_0xcb3ff8['type'])&&_0xcb3ff8[_0x57ee('0x3f')]&&!_0xcb3ff8[_0x57ee('0x40')]){var _0x5197c5=_0xcb3ff8[_0x57ee('0x41')][_0x57ee('0x28')]();var _0xbe2f01=_0x5197c5[_0x57ee('0x42')](0x0,_0x5197c5[_0x57ee('0x43')]('_'));var _0x3f6dba=_0x5197c5[_0x57ee('0x42')](_0x5197c5['indexOf']('_')+0x1);if(_0xbe2f01===_0x15f0fc){_0x3cc967[_0x3f6dba]=_0xcb3ff8[_0x57ee('0x44')];}}});}return _0x3cc967;}function getTicket(_0x34befb,_0x175477,_0x5044f7,_0x5ca8bb,_0x1bcda0,_0xf40a9f,_0x25f322){return new Promise(function(_0x53dbb2,_0x317df4){var _0x29556d;return getAuthToken(_0x175477,_0x5044f7,_0x25f322)['then'](function(_0x594e98){if(_0xf40a9f[_0x57ee('0x45')]===_0x57ee('0x46')){_0x29556d={'method':_0x57ee('0xf'),'uri':_0x5ca8bb+_0x57ee('0x47'),'body':Object[_0x57ee('0x48')]({},{'title':intUtil['getString'](_0xf40a9f[_0x57ee('0x49')],_0x1bcda0,'\x20'),'description':intUtil[_0x57ee('0x4a')](_0xf40a9f['Descriptions'],_0x1bcda0,'\x0a'),'customerid_contact@odata.bind':_0x34befb[_0x57ee('0x33')]?_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')':undefined,'ownerid@odata.bind':_0x57ee('0x2d')+_0x34befb['userId']+')','caseorigincode':'1'},getCustomFields(_0xf40a9f[_0x57ee('0x4c')],_0x1bcda0,_0xf40a9f[_0x57ee('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x594e98,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xf40a9f['ticketType']==='phonecall'){var _0x1b5f60=_0x34befb[_0x57ee('0x33')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x34befb['userId']+')','participationtypemask':_0x34befb['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')','participationtypemask':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x57ee('0x2d')+_0x34befb[_0x57ee('0x22')]+')','participationtypemask':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?0x2:0x1}];_0x29556d={'method':'POST','uri':_0x5ca8bb+_0x57ee('0x4f'),'body':Object[_0x57ee('0x48')]({},{'subject':intUtil[_0x57ee('0x4a')](_0xf40a9f[_0x57ee('0x49')],_0x1bcda0,'\x20'),'phonenumber':String(_0x1bcda0[_0x57ee('0x2b')]),'description':intUtil[_0x57ee('0x4a')](_0xf40a9f[_0x57ee('0x50')],_0x1bcda0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x34befb[_0x57ee('0x33')]?_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x34befb['userId']+')','directioncode':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?![]:!![],'phonecall_activity_parties':_0x1b5f60},getCustomFields(_0xf40a9f['Fields'],_0x1bcda0,_0xf40a9f[_0x57ee('0x45')])),'headers':{'Authorization':_0x57ee('0x2e')+_0x594e98,'OData-Version':_0x57ee('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x29556d);})[_0x57ee('0x13')](function(_0x53b49f){var _0x19aebb=_0x53b49f[_0x57ee('0x30')][_0x57ee('0x31')];var _0xe9daac=_0x19aebb[_0x57ee('0x42')](_0x19aebb[_0x57ee('0x32')]('(')+0x1,_0x19aebb[_0x57ee('0x32')](')'));_0x34befb['ticketId']=_0xe9daac;_0x53dbb2(_0x34befb);})[_0x57ee('0x14')](function(_0x1f5d66){_0x317df4(_0x1f5d66[_0x57ee('0x17')]);});});}function emit(_0x2fc357,_0x5a5877,_0xd93bbf,_0x4f109a){var _0x22f785={'uri':util['format'](_0x57ee('0x51'),_0x2fc357,_0xd93bbf,_0x4f109a)};io['to'](util[_0x57ee('0x52')]('user:%s',_0x5a5877))[_0x57ee('0x53')](_0x57ee('0x54'),_0x22f785);}exports['cs']=function(_0x6357de,_0x39b96b,_0x520f0b,_0x1d005c,_0x8eb0e,_0x40bdd3,_0x459e79,_0x52d261){var _0x28c182={};_0x40bdd3[_0x57ee('0xa')]=_0x40bdd3[_0x57ee('0x9')]?intUtil[_0x57ee('0x55')](_0x40bdd3['CloudProvider'][_0x57ee('0xc')]):intUtil[_0x57ee('0x55')](_0x40bdd3[_0x57ee('0xa')]);_0x40bdd3[_0x57ee('0x56')]=intUtil[_0x57ee('0x55')](_0x40bdd3[_0x57ee('0x56')]);_0x28c182[_0x57ee('0x4d')]=_0x52d261==='queue'||_0x52d261===_0x57ee('0x57')?_0x57ee('0x4e'):_0x57ee('0x29');var _0x1e5042=_0x40bdd3[_0x57ee('0x9')]?util[_0x57ee('0x52')](_0x57ee('0x58'),_0x40bdd3[_0x57ee('0xb')]['data7']):util[_0x57ee('0x52')](_0x57ee('0x58'),_0x40bdd3[_0x57ee('0xa')]);var _0x69b21b=util['format'](_0x57ee('0x59'),_0x40bdd3[_0x57ee('0x5a')]);var _0x30306c=util['format'](_0x57ee('0x5b'),_0x40bdd3['serverUrl'],_0x39b96b[_0x57ee('0x5c')],md5(_0x39b96b['uniqueid']));if(_0x8eb0e&&_0x8eb0e[_0x57ee('0x5d')]){logger[_0x57ee('0x24')](_0x57ee('0x5e'),_0x57ee('0x5f'));_0x39b96b['recordingURL']=_0x30306c;}else if(_0x459e79&&_0x459e79[_0x57ee('0x60')]&&_0x459e79[_0x57ee('0x60')]!==_0x57ee('0x61')){logger[_0x57ee('0x24')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x39b96b[_0x57ee('0x62')]=_0x30306c;}else{_0x39b96b[_0x57ee('0x62')]='';}return getUser(_0x28c182,_0x40bdd3,_0x1d005c,_0x69b21b,_0x1e5042,_0x52d261)[_0x57ee('0x13')](function(_0x23cb8f){logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x63'),_0x23cb8f['userId']);logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x64'),_0x23cb8f[_0x57ee('0x65')]);return getEndUser(_0x23cb8f,_0x40bdd3,_0x69b21b,_0x1e5042,_0x39b96b,_0x52d261,_0x520f0b[_0x57ee('0x66')],_0x520f0b[_0x57ee('0x67')]);})['then'](function(_0x541297){logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x68'),_0x541297[_0x57ee('0x33')]);logger['info']('['+_0x52d261['toUpperCase']()+_0x57ee('0x69'),_0x39b96b[_0x57ee('0x2b')]);return getTicket(_0x541297,_0x40bdd3,_0x69b21b,_0x1e5042,_0x39b96b,_0x520f0b,_0x52d261);})[_0x57ee('0x13')](function(_0x5cf3bc){logger[_0x57ee('0x24')](util[_0x57ee('0x52')]('['+_0x52d261[_0x57ee('0x16')]()+_0x57ee('0x6a'),_0x520f0b[_0x57ee('0x45')],_0x5cf3bc[_0x57ee('0x6b')]));logger[_0x57ee('0x24')](util[_0x57ee('0x52')]('['+_0x52d261[_0x57ee('0x16')]()+_0x57ee('0x6c'),_0x52d261));if(_0x52d261!==_0x57ee('0x57')&&_0x520f0b[_0x57ee('0x6d')]){logger[_0x57ee('0x24')]('['+_0x52d261[_0x57ee('0x16')]()+']',_0x57ee('0x6e'));emit(_0x40bdd3['remoteUri'],_0x1d005c[_0x57ee('0x6f')],_0x520f0b[_0x57ee('0x45')],_0x5cf3bc[_0x57ee('0x6b')]);}})['catch'](function(_0x5312ae){logger[_0x57ee('0x15')]('['+_0x52d261[_0x57ee('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x5312ae[_0x57ee('0x17')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x5312ae);});}; \ 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 bae95bc..811a8f5 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 _0x78a5=['getString','Subjects','Descriptions','
','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','catch','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x78a5,0xa1));var _0x578a=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x78a5[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0x578a('0x0'));var rp=require(_0x578a('0x1'));var md5=require(_0x578a('0x2'));var util=require('util');var Redis=require(_0x578a('0x3'));var intUtil=require('./util');var config=require(_0x578a('0x4'));var logger=require(_0x578a('0x5'))(_0x578a('0x6'));config[_0x578a('0x7')]=_[_0x578a('0x8')](config[_0x578a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x578a('0x9'))(new Redis(config[_0x578a('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x578a('0xa')};function emit(_0x362a60,_0x2f6ead,_0x46f6e0){io['to'](_0x362a60)[_0x578a('0xb')](_0x2f6ead,_0x46f6e0);}function getTicket(_0x48056d,_0x2a2abd,_0x4b4087,_0x9f0b43,_0x5e02d5){logger['info'](_0x578a('0xc'));var _0x3bc74e=_['merge']({'responder_id':_0x2a2abd['id'],'requester_id':_0x4b4087['id'],'name':util[_0x578a('0xd')](_0x578a('0xe'),_0x5e02d5[_0x578a('0xf')]),'phone':_0x5e02d5[_0x578a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x578a('0x11')](_0x9f0b43[_0x578a('0x12')],_0x5e02d5,'\x20'),'description':intUtil['getString'](_0x9f0b43[_0x578a('0x13')],_0x5e02d5,_0x578a('0x14')),'tags':getTags(_0x9f0b43['Tags'],'name')},getCustomFields(_0x9f0b43['Fields'],_0x5e02d5));_0x3bc74e[_0x578a('0x15')]=_[_0x578a('0x16')](_['keyBy'](_0x3bc74e[_0x578a('0x15')],'id'),_0x578a('0x17'));return request({'uri':util[_0x578a('0xd')](_0x578a('0x18'),_0x48056d[_0x578a('0x19')]),'method':_0x578a('0x1a'),'body':_0x3bc74e})[_0x578a('0x1b')](function(_0x3b2daa){logger[_0x578a('0x1c')]('Ticket\x20created!');return _0x3b2daa;});}function getUser(_0x4b4e99,_0x21d856){if(intUtil['validateEmail'](_0x21d856)){return request({'uri':util[_0x578a('0xd')](_0x578a('0x1d'),_0x4b4e99['remoteUri']),'qs':{'email':_0x21d856}})['then'](function(_0x80d671){if(_0x80d671[_0x578a('0x1e')]){logger['info']('Agent\x20found!');return _[_0x578a('0x1f')](_0x80d671,function(_0x3388ba){return _0x3388ba[_0x578a('0x20')][_0x578a('0x21')]===_0x21d856;});}else{logger[_0x578a('0x1c')](_0x578a('0x22'));return request({'uri':util[_0x578a('0xd')](_0x578a('0x23'),_0x4b4e99[_0x578a('0x19')])})[_0x578a('0x1b')](function(_0x13dcd5){logger['info']('Admin\x20account\x20selected.');return _0x13dcd5;});}});}else{logger[_0x578a('0x1c')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x578a('0xd')]('%s/api/v2/agents/me',_0x4b4e99[_0x578a('0x19')])})[_0x578a('0x1b')](function(_0x1b83d1){logger[_0x578a('0x1c')]('Admin\x20account\x20selected.');return _0x1b83d1;});}}function getEndUser(_0x464dc8,_0x2fb3ba,_0x38fe1b){logger[_0x578a('0x1c')](_0x578a('0x24'),_0x38fe1b);return request({'uri':util[_0x578a('0xd')](_0x578a('0x25'),_0x464dc8[_0x578a('0x19')]),'qs':{'phone':_0x38fe1b}})['then'](function(_0x475139){if(_0x475139[_0x578a('0x1e')]){logger[_0x578a('0x1c')](_0x578a('0x26'));return _[_0x578a('0x1f')](_0x475139,{'phone':_0x38fe1b});}else{logger[_0x578a('0x1c')](_0x578a('0x27'));return request({'uri':util[_0x578a('0xd')](_0x578a('0x25'),_0x464dc8[_0x578a('0x19')]),'method':_0x578a('0x1a'),'body':{'name':_0x2fb3ba,'phone':_0x38fe1b}})[_0x578a('0x1b')](function(_0x44b4de){logger[_0x578a('0x1c')]('Enduser\x20created.');return _0x44b4de;});}});}function getAuth(_0x30ee67){return util['format'](_0x578a('0x28'),new Buffer(_0x30ee67[_0x578a('0x29')]+':X')[_0x578a('0x2a')](_0x578a('0x2b')));}function request(_0x5d8e9e){logger[_0x578a('0x2c')](_0x578a('0x2d'),JSON[_0x578a('0x2e')](_0x5d8e9e));return rp(_[_0x578a('0x8')](_0x5d8e9e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e9336,_0x171ca6){var _0x2f3cca=[];if(_0x4e9336&&_0x4e9336[_0x578a('0x1e')]>0x0){_0x2f3cca=_[_0x578a('0x2f')](_0x4e9336,_0x171ca6);}return _0x2f3cca;}function getCustomFields(_0x2df7f4,_0x2546fb){var _0x44c166=[];var _0x5251ee={'custom_fields':[]};if(_0x2df7f4['length']>0x0){_[_0x578a('0x30')](_0x2df7f4,function(_0x169db2){if(_[_0x578a('0x31')]([_0x578a('0x32'),_0x578a('0x33')],_0x169db2[_0x578a('0x34')])&&_0x169db2[_0x578a('0x35')]&&!_0x169db2[_0x578a('0x36')]){_0x5251ee[_0x169db2[_0x578a('0x35')][_0x578a('0x37')]()]=_0x169db2[_0x578a('0x38')][_0x578a('0x2a')]();}else if(_[_0x578a('0x31')]([_0x578a('0x32'),_0x578a('0x33')],_0x169db2['type'])&&_0x169db2[_0x578a('0x39')]&&_0x169db2[_0x578a('0x36')]){_0x5251ee['custom_fields'][_0x578a('0x3a')]({'id':_0x169db2[_0x578a('0x39')],'value':_0x169db2[_0x578a('0x38')][_0x578a('0x2a')]()});}else if(_0x169db2[_0x578a('0x34')]===_0x578a('0x3b')&&_0x169db2[_0x578a('0x3c')]&&_0x169db2[_0x578a('0x39')]&&_0x169db2[_0x578a('0x36')]){_0x2546fb[_0x169db2[_0x578a('0x3c')]]&&_0x5251ee[_0x578a('0x15')]['push']({'id':_0x169db2[_0x578a('0x39')],'value':_0x2546fb[_0x169db2['variableName']][_0x578a('0x2a')]()});}else if(_0x169db2['type']===_0x578a('0x3d')&&_0x169db2['Variable']&&_0x169db2[_0x578a('0x3e')][_0x578a('0x3f')]&&_0x169db2[_0x578a('0x39')]&&_0x169db2[_0x578a('0x36')]){_0x2546fb[_0x169db2['Variable'][_0x578a('0x3f')][_0x578a('0x37')]()]&&_0x5251ee['custom_fields'][_0x578a('0x3a')]({'id':_0x169db2[_0x578a('0x39')],'value':_0x2546fb[_0x169db2[_0x578a('0x3e')]['name']['toLowerCase']()]['toString']()});}});}return _0x5251ee;}exports[_0x578a('0x40')]=function(_0x37ba1d,_0x4bd36d,_0x15957f,_0x1eb367,_0x2fa836,_0x75dbc4){var _0x3ccbe1,_0x5520ec;_0x75dbc4[_0x578a('0x19')]=intUtil[_0x578a('0x41')](_0x75dbc4['remoteUri']);_0x75dbc4[_0x578a('0x42')]=intUtil[_0x578a('0x41')](_0x75dbc4[_0x578a('0x42')]);if(_0x2fa836&&_0x2fa836['monitor_format']){logger['info'](_0x578a('0x43'),_0x578a('0x44'));_0x4bd36d[_0x578a('0x45')]=util[_0x578a('0xd')](_0x578a('0x46'),_0x75dbc4[_0x578a('0x42')],_0x4bd36d[_0x578a('0x47')],md5(_0x4bd36d[_0x578a('0x47')]));}else{_0x4bd36d[_0x578a('0x45')]='';}headers[_0x578a('0x48')]=getAuth(_0x75dbc4);return getUser(_0x75dbc4,_0x1eb367['email'])[_0x578a('0x1b')](function(_0x217124){_0x3ccbe1=_0x217124;logger['info'](_0x578a('0x49'),_0x3ccbe1['id']);return getEndUser(_0x75dbc4,_0x4bd36d[_0x578a('0xf')],_0x4bd36d[_0x578a('0x10')]);})[_0x578a('0x1b')](function(_0x949568){_0x5520ec=_0x949568;logger[_0x578a('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x5520ec['id']);return getTicket(_0x75dbc4,_0x3ccbe1,_0x5520ec,_0x15957f,_0x4bd36d);})['then'](function(_0x4793d8){if(_0x4793d8&&_0x4793d8['id']){logger[_0x578a('0x1c')](_0x578a('0x4a'));logger[_0x578a('0x1c')](_0x578a('0x4b'),_0x4793d8['id']);logger[_0x578a('0x1c')]('[QUEUE]',_0x578a('0x4c'));emit(util['format']('user:%s',_0x1eb367[_0x578a('0x3f')]),_0x578a('0x4d'),{'uri':util[_0x578a('0xd')](_0x578a('0x4e'),_0x75dbc4[_0x578a('0x19')],_0x4793d8['id'])});}})['catch'](function(_0x4d2e8e){logger['error']('[QUEUE]',JSON[_0x578a('0x2e')](_0x4d2e8e));});};exports['outbound']=function(_0x3395e6,_0x5c55d9,_0x481b21,_0x2008e7,_0x467720,_0x117897,_0x1e6d24){var _0x1381c7,_0x130342;_0x117897[_0x578a('0x19')]=intUtil['stripTrailingSlash'](_0x117897[_0x578a('0x19')]);_0x117897['serverUrl']=intUtil['stripTrailingSlash'](_0x117897[_0x578a('0x42')]);if(_0x1e6d24&&_0x1e6d24[_0x578a('0x4f')]&&_0x1e6d24[_0x578a('0x4f')]!=='none'){logger[_0x578a('0x1c')](_0x578a('0x50'),'Recording\x20is\x20enabled!');_0x5c55d9[_0x578a('0x45')]=util[_0x578a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x117897['serverUrl'],_0x5c55d9[_0x578a('0x47')],md5(_0x5c55d9[_0x578a('0x47')]));}headers['Authorization']=getAuth(_0x117897);return getUser(_0x117897,_0x2008e7[_0x578a('0x21')])[_0x578a('0x1b')](function(_0x369a35){_0x1381c7=_0x369a35;logger[_0x578a('0x1c')](_0x578a('0x49'),_0x1381c7['id']);return getEndUser(_0x117897,_0x5c55d9[_0x578a('0x51')],_0x5c55d9[_0x578a('0x52')]);})[_0x578a('0x1b')](function(_0x24135a){_0x130342=_0x24135a;logger['info'](_0x578a('0x53'),_0x130342['id']);return getTicket(_0x117897,_0x1381c7,_0x130342,_0x481b21,_0x5c55d9);})[_0x578a('0x1b')](function(_0x429544){if(_0x429544&&_0x429544['id']){logger[_0x578a('0x1c')](_0x578a('0x4a'));logger[_0x578a('0x1c')](_0x578a('0x4b'),_0x429544['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x578a('0xd')]('user:%s',_0x2008e7['name']),_0x578a('0x4d'),{'uri':util[_0x578a('0xd')](_0x578a('0x4e'),_0x117897[_0x578a('0x19')],_0x429544['id'])});}})[_0x578a('0x54')](function(_0x14250c){logger[_0x578a('0x55')](_0x578a('0x50'),JSON[_0x578a('0x2e')](_0x14250c));});};exports[_0x578a('0x56')]=function(_0x23c337,_0x620157,_0x1cc9ff,_0xc876bb,_0x74be68,_0xa868ed){var _0x389536,_0x2e9795;_0xa868ed[_0x578a('0x19')]=intUtil[_0x578a('0x41')](_0xa868ed[_0x578a('0x19')]);_0xa868ed[_0x578a('0x42')]=intUtil[_0x578a('0x41')](_0xa868ed['serverUrl']);if(_0x74be68&&_0x74be68['monitor_format']){logger[_0x578a('0x1c')]('['+_0x620157[_0x578a('0x57')]['toUpperCase']()+']',_0x578a('0x44'));_0x620157[_0x578a('0x45')]=util[_0x578a('0xd')](_0x578a('0x46'),_0xa868ed[_0x578a('0x42')],_0x620157['uniqueid'],md5(_0x620157[_0x578a('0x47')]));}else{_0x620157[_0x578a('0x45')]='';}headers[_0x578a('0x48')]=getAuth(_0xa868ed);return getUser(_0xa868ed,'')[_0x578a('0x1b')](function(_0x16cec9){_0x389536=_0x16cec9;logger['info'](_0x578a('0x49'),_0x389536['id']);return getEndUser(_0xa868ed,_0x620157['calleridname'],_0x620157['calleridnum']);})['then'](function(_0x527a59){_0x2e9795=_0x527a59;logger['info'](_0x578a('0x53'),_0x2e9795['id']);return getTicket(_0xa868ed,_0x389536,_0x2e9795,_0x1cc9ff,_0x620157);})['then'](function(_0x321664){if(_0x321664){logger['info'](_0x578a('0x4a'));logger[_0x578a('0x1c')](_0x578a('0x4b'),_0x321664['id']);}})[_0x578a('0x54')](function(_0x475661){logger[_0x578a('0x55')]('['+_0x620157[_0x578a('0x57')][_0x578a('0x58')]()+']',JSON['stringify'](_0x475661));});}; \ No newline at end of file +var _0x6024=['Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','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\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','nameField','customField','type','push','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x4d3f27,_0x30546a){var _0x6fd21f=function(_0x3d6647){while(--_0x3d6647){_0x4d3f27['push'](_0x4d3f27['shift']());}};_0x6fd21f(++_0x30546a);}(_0x6024,0x1ec));var _0x4602=function(_0x16234e,_0x3643d6){_0x16234e=_0x16234e-0x0;var _0x1abfc0=_0x6024[_0x16234e];return _0x1abfc0;};'use strict';var _=require('lodash');var rp=require(_0x4602('0x0'));var md5=require(_0x4602('0x1'));var util=require('util');var Redis=require(_0x4602('0x2'));var intUtil=require(_0x4602('0x3'));var config=require(_0x4602('0x4'));var logger=require('../../../../config/logger')(_0x4602('0x5'));config[_0x4602('0x6')]=_[_0x4602('0x7')](config['redis'],{'host':_0x4602('0x8'),'port':0x18eb});var io=require(_0x4602('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x4602('0xa'),'Accept':'application/json'};function emit(_0x654361,_0x5468e4,_0x12ef72){io['to'](_0x654361)['emit'](_0x5468e4,_0x12ef72);}function getTicket(_0x109c19,_0x12637a,_0x3e8e23,_0x42f3cc,_0x1f8786){logger['info'](_0x4602('0xb'));var _0x4eb04e=_[_0x4602('0xc')]({'responder_id':_0x12637a['id'],'requester_id':_0x3e8e23['id'],'name':util[_0x4602('0xd')]('Caller\x20-\x20%s',_0x1f8786[_0x4602('0xe')]),'phone':_0x1f8786[_0x4602('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4602('0x10')](_0x42f3cc[_0x4602('0x11')],_0x1f8786,'\x20'),'description':intUtil[_0x4602('0x10')](_0x42f3cc[_0x4602('0x12')],_0x1f8786,_0x4602('0x13')),'tags':getTags(_0x42f3cc[_0x4602('0x14')],'name')},getCustomFields(_0x42f3cc[_0x4602('0x15')],_0x1f8786));_0x4eb04e[_0x4602('0x16')]=_[_0x4602('0x17')](_['keyBy'](_0x4eb04e['custom_fields'],'id'),_0x4602('0x18'));return request({'uri':util[_0x4602('0xd')]('%s/api/v2/tickets',_0x109c19[_0x4602('0x19')]),'method':_0x4602('0x1a'),'body':_0x4eb04e})[_0x4602('0x1b')](function(_0x4b613b){logger[_0x4602('0x1c')](_0x4602('0x1d'));return _0x4b613b;});}function getUser(_0x5d1e2b,_0x19d2fc){if(intUtil[_0x4602('0x1e')](_0x19d2fc)){return request({'uri':util['format'](_0x4602('0x1f'),_0x5d1e2b[_0x4602('0x19')]),'qs':{'email':_0x19d2fc}})['then'](function(_0x194459){if(_0x194459['length']){logger['info']('Agent\x20found!');return _[_0x4602('0x20')](_0x194459,function(_0x4462e3){return _0x4462e3['contact']['email']===_0x19d2fc;});}else{logger[_0x4602('0x1c')](_0x4602('0x21'));return request({'uri':util[_0x4602('0xd')](_0x4602('0x22'),_0x5d1e2b[_0x4602('0x19')])})[_0x4602('0x1b')](function(_0x483863){logger[_0x4602('0x1c')](_0x4602('0x23'));return _0x483863;});}});}else{logger['info'](_0x4602('0x24'));return request({'uri':util[_0x4602('0xd')](_0x4602('0x22'),_0x5d1e2b['remoteUri'])})[_0x4602('0x1b')](function(_0x1c3970){logger[_0x4602('0x1c')](_0x4602('0x23'));return _0x1c3970;});}}function getEndUser(_0x44547a,_0x23de17,_0x13ace9){logger[_0x4602('0x1c')](_0x4602('0x25'),_0x13ace9);return request({'uri':util['format'](_0x4602('0x26'),_0x44547a[_0x4602('0x19')]),'qs':{'phone':_0x13ace9}})['then'](function(_0xfd5275){if(_0xfd5275[_0x4602('0x27')]){logger['info'](_0x4602('0x28'));return _[_0x4602('0x20')](_0xfd5275,{'phone':_0x13ace9});}else{logger[_0x4602('0x1c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x4602('0x26'),_0x44547a[_0x4602('0x19')]),'method':_0x4602('0x1a'),'body':{'name':_0x23de17,'phone':_0x13ace9}})[_0x4602('0x1b')](function(_0x16f4b6){logger[_0x4602('0x1c')](_0x4602('0x29'));return _0x16f4b6;});}});}function getAuth(_0x2c1121){return util['format'](_0x4602('0x2a'),new Buffer(_0x2c1121[_0x4602('0x2b')]+':X')[_0x4602('0x2c')](_0x4602('0x2d')));}function request(_0x56faea){logger[_0x4602('0x2e')](_0x4602('0x2f'),JSON['stringify'](_0x56faea));return rp(_['defaults'](_0x56faea,{'method':_0x4602('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x44e5b1,_0x1c9064){var _0x159b0d=[];if(_0x44e5b1&&_0x44e5b1[_0x4602('0x27')]>0x0){_0x159b0d=_[_0x4602('0x31')](_0x44e5b1,_0x1c9064);}return _0x159b0d;}function getCustomFields(_0x58d34d,_0x14241d){var _0x54a740=[];var _0x2cbdb2={'custom_fields':[]};if(_0x58d34d['length']>0x0){_['forEach'](_0x58d34d,function(_0x1fb2de){if(_[_0x4602('0x32')]([_0x4602('0x33'),_0x4602('0x34')],_0x1fb2de['type'])&&_0x1fb2de[_0x4602('0x35')]&&!_0x1fb2de[_0x4602('0x36')]){_0x2cbdb2[_0x1fb2de[_0x4602('0x35')]['toLowerCase']()]=_0x1fb2de['content'][_0x4602('0x2c')]();}else if(_[_0x4602('0x32')](['string',_0x4602('0x34')],_0x1fb2de[_0x4602('0x37')])&&_0x1fb2de['idField']&&_0x1fb2de['customField']){_0x2cbdb2[_0x4602('0x16')][_0x4602('0x38')]({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x1fb2de[_0x4602('0x3a')][_0x4602('0x2c')]()});}else if(_0x1fb2de[_0x4602('0x37')]===_0x4602('0x3b')&&_0x1fb2de['variableName']&&_0x1fb2de['idField']&&_0x1fb2de[_0x4602('0x36')]){_0x14241d[_0x1fb2de[_0x4602('0x3c')]]&&_0x2cbdb2[_0x4602('0x16')]['push']({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x14241d[_0x1fb2de[_0x4602('0x3c')]][_0x4602('0x2c')]()});}else if(_0x1fb2de[_0x4602('0x37')]===_0x4602('0x3d')&&_0x1fb2de[_0x4602('0x3e')]&&_0x1fb2de[_0x4602('0x3e')][_0x4602('0x3f')]&&_0x1fb2de['idField']&&_0x1fb2de[_0x4602('0x36')]){_0x14241d[_0x1fb2de[_0x4602('0x3e')]['name'][_0x4602('0x40')]()]&&_0x2cbdb2['custom_fields'][_0x4602('0x38')]({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x14241d[_0x1fb2de[_0x4602('0x3e')][_0x4602('0x3f')][_0x4602('0x40')]()]['toString']()});}});}return _0x2cbdb2;}exports['queue']=function(_0x5eb459,_0x399f6e,_0x15e795,_0x22be3e,_0x13f985,_0x1b4190){var _0x1e71d0,_0x16283c;_0x1b4190[_0x4602('0x19')]=intUtil[_0x4602('0x41')](_0x1b4190[_0x4602('0x19')]);_0x1b4190[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x1b4190[_0x4602('0x42')]);if(_0x13f985&&_0x13f985[_0x4602('0x43')]){logger[_0x4602('0x1c')](_0x4602('0x44'),_0x4602('0x45'));_0x399f6e[_0x4602('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b4190[_0x4602('0x42')],_0x399f6e[_0x4602('0x47')],md5(_0x399f6e[_0x4602('0x47')]));}else{_0x399f6e[_0x4602('0x46')]='';}headers[_0x4602('0x48')]=getAuth(_0x1b4190);return getUser(_0x1b4190,_0x22be3e[_0x4602('0x49')])[_0x4602('0x1b')](function(_0x5d6af5){_0x1e71d0=_0x5d6af5;logger[_0x4602('0x1c')](_0x4602('0x4a'),_0x1e71d0['id']);return getEndUser(_0x1b4190,_0x399f6e[_0x4602('0xe')],_0x399f6e[_0x4602('0xf')]);})[_0x4602('0x1b')](function(_0x26406a){_0x16283c=_0x26406a;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x16283c['id']);return getTicket(_0x1b4190,_0x1e71d0,_0x16283c,_0x15e795,_0x399f6e);})[_0x4602('0x1b')](function(_0x58f443){if(_0x58f443&&_0x58f443['id']){logger[_0x4602('0x1c')](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x58f443['id']);logger['info']('[QUEUE]',_0x4602('0x4d'));emit(util[_0x4602('0xd')]('user:%s',_0x22be3e[_0x4602('0x3f')]),_0x4602('0x4e'),{'uri':util['format'](_0x4602('0x4f'),_0x1b4190[_0x4602('0x19')],_0x58f443['id'])});}})[_0x4602('0x50')](function(_0x54db5b){logger[_0x4602('0x51')](_0x4602('0x44'),JSON[_0x4602('0x52')](_0x54db5b));});};exports[_0x4602('0x53')]=function(_0x27b24b,_0x5f42c4,_0x445568,_0x162f93,_0x1aca45,_0x2dfef5,_0x27d65c){var _0x56cfe5,_0x28fd6b;_0x2dfef5['remoteUri']=intUtil[_0x4602('0x41')](_0x2dfef5['remoteUri']);_0x2dfef5[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x2dfef5[_0x4602('0x42')]);if(_0x27d65c&&_0x27d65c[_0x4602('0x54')]&&_0x27d65c[_0x4602('0x54')]!==_0x4602('0x55')){logger['info']('[OUTBOUND]',_0x4602('0x45'));_0x5f42c4[_0x4602('0x46')]=util[_0x4602('0xd')](_0x4602('0x56'),_0x2dfef5[_0x4602('0x42')],_0x5f42c4['uniqueid'],md5(_0x5f42c4[_0x4602('0x47')]));}headers[_0x4602('0x48')]=getAuth(_0x2dfef5);return getUser(_0x2dfef5,_0x162f93[_0x4602('0x49')])[_0x4602('0x1b')](function(_0x10284e){_0x56cfe5=_0x10284e;logger['info'](_0x4602('0x4a'),_0x56cfe5['id']);return getEndUser(_0x2dfef5,_0x5f42c4[_0x4602('0x57')],_0x5f42c4[_0x4602('0x58')]);})[_0x4602('0x1b')](function(_0x305750){_0x28fd6b=_0x305750;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x28fd6b['id']);return getTicket(_0x2dfef5,_0x56cfe5,_0x28fd6b,_0x445568,_0x5f42c4);})[_0x4602('0x1b')](function(_0x35f199){if(_0x35f199&&_0x35f199['id']){logger[_0x4602('0x1c')](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x35f199['id']);logger['info'](_0x4602('0x59'),_0x4602('0x4d'));emit(util['format'](_0x4602('0x5a'),_0x162f93[_0x4602('0x3f')]),_0x4602('0x4e'),{'uri':util[_0x4602('0xd')]('%s/helpdesk/tickets/%d',_0x2dfef5['remoteUri'],_0x35f199['id'])});}})['catch'](function(_0x506fe3){logger[_0x4602('0x51')](_0x4602('0x59'),JSON[_0x4602('0x52')](_0x506fe3));});};exports[_0x4602('0x5b')]=function(_0x285dd3,_0x16fb75,_0x1711af,_0x1e49dd,_0x4f18ca,_0x324157){var _0x492ce4,_0x1cebd6;_0x324157[_0x4602('0x19')]=intUtil[_0x4602('0x41')](_0x324157[_0x4602('0x19')]);_0x324157[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x324157[_0x4602('0x42')]);if(_0x4f18ca&&_0x4f18ca[_0x4602('0x43')]){logger[_0x4602('0x1c')]('['+_0x16fb75[_0x4602('0x5c')][_0x4602('0x5d')]()+']',_0x4602('0x45'));_0x16fb75['recordingURL']=util[_0x4602('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x324157['serverUrl'],_0x16fb75[_0x4602('0x47')],md5(_0x16fb75['uniqueid']));}else{_0x16fb75[_0x4602('0x46')]='';}headers[_0x4602('0x48')]=getAuth(_0x324157);return getUser(_0x324157,'')[_0x4602('0x1b')](function(_0x367c74){_0x492ce4=_0x367c74;logger['info'](_0x4602('0x4a'),_0x492ce4['id']);return getEndUser(_0x324157,_0x16fb75['calleridname'],_0x16fb75[_0x4602('0xf')]);})['then'](function(_0x1a18d9){_0x1cebd6=_0x1a18d9;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x1cebd6['id']);return getTicket(_0x324157,_0x492ce4,_0x1cebd6,_0x1711af,_0x16fb75);})[_0x4602('0x1b')](function(_0x45cbe4){if(_0x45cbe4){logger['info'](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x45cbe4['id']);}})[_0x4602('0x50')](function(_0x2ca1db){logger[_0x4602('0x51')]('['+_0x16fb75[_0x4602('0x5c')]['toUpperCase']()+']',JSON[_0x4602('0x52')](_0x2ca1db));});}; \ 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 4668101..f0c42d0 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 _0x33d4=['Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','POST','/api/tasks','getString','Descriptions','Contact','ticketId','task','/contacts/','user:%s','emit','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','queue','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','GET','info','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','catch','message','/api/lookup?q=','&f=','then','find','format'];(function(_0x50aa92,_0x3a696d){var _0x1804c4=function(_0x23aa5e){while(--_0x23aa5e){_0x50aa92['push'](_0x50aa92['shift']());}};_0x1804c4(++_0x3a696d);}(_0x33d4,0xc9));var _0x433d=function(_0x18e038,_0x177179){_0x18e038=_0x18e038-0x0;var _0x53fc45=_0x33d4[_0x18e038];return _0x53fc45;};'use strict';var _=require(_0x433d('0x0'));var rp=require(_0x433d('0x1'));var md5=require('md5');var util=require(_0x433d('0x2'));var moment=require(_0x433d('0x3'));var Promise=require(_0x433d('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x433d('0x5'));var logger=require(_0x433d('0x6'))(_0x433d('0x7'));config[_0x433d('0x8')]=_[_0x433d('0x9')](config['redis'],{'host':_0x433d('0xa'),'port':0x18eb});var io=require(_0x433d('0xb'))(new Redis(config['redis']));function getAdminId(_0x19d7f2,_0x24c0fe,_0x4d980f,_0x3988a6){return new Promise(function(_0x43bbd8,_0x5203e3){var _0x4f90e6=![];var _0x5e8701={'method':'GET','uri':_0x3988a6+_0x433d('0xc'),'json':!![]};_0x5e8701[_0x433d('0xd')]=_0x4d980f;logger['info'](_0x433d('0xe'));return rp(_0x5e8701)['then'](function(_0x218e82){if(_0x218e82){var _0xc0bacc=_0x218e82[_0x433d('0xf')];var _0x3e7ee8=null;for(_0x3e7ee8=0x0;_0x3e7ee8<_0xc0bacc[_0x433d('0x10')];_0x3e7ee8++){if(_0xc0bacc[_0x3e7ee8][_0x433d('0x11')]===_0x19d7f2['adminEmail']){_0x19d7f2['adminId']=_0xc0bacc[_0x3e7ee8]['id'];_0x4f90e6=!![];}}if(_0x4f90e6){logger['info'](_0x433d('0x12'),_0x19d7f2[_0x433d('0x13')]);_0x43bbd8(_0x19d7f2);}else{_0x5203e3({'statusCode':0x194,'message':_0x433d('0x14')});}}else{_0x5203e3({'statusCode':0x194,'message':_0x433d('0x14')});}})['catch'](function(_0x4b418d){logger[_0x433d('0x15')]('['+[_0x24c0fe['toUpperCase']()]+']',_0x4b418d['message']);_0x5203e3(_0x4b418d);});});}function getUser(_0x511e95,_0x604f3f,_0x459996){return function(_0x504d07){return new Promise(function(_0x102b8c,_0x3af5b9){var _0x49a6c0={'method':_0x433d('0x16'),'uri':_0x459996+'/api/selector/owners','json':!![]};_0x49a6c0[_0x433d('0xd')]=_0x604f3f;logger[_0x433d('0x17')](_0x433d('0x18'));return rp(_0x49a6c0)['then'](function(_0xd75dec){if(_0xd75dec){var _0x4b5449=_0xd75dec[_0x433d('0xf')];var _0x3b8bc3=![];var _0x1ef9f4=null;if(_0x504d07['agentEmail']!==null){logger[_0x433d('0x17')](_0x433d('0x19'),_0x504d07[_0x433d('0x1a')]);_0x504d07[_0x433d('0x1b')]=_0x504d07['agentEmail'];for(_0x1ef9f4=0x0;_0x1ef9f4<_0x4b5449[_0x433d('0x10')];_0x1ef9f4++){if(_0x4b5449[_0x1ef9f4][_0x433d('0x11')]===_0x504d07[_0x433d('0x1a')]){_0x3b8bc3=!![];_0x504d07[_0x433d('0x1c')]=_0x4b5449[_0x1ef9f4]['id'];logger[_0x433d('0x17')](_0x433d('0x1d'),_0x504d07['userId']);}}}if(!_0x3b8bc3){logger['info'](_0x433d('0x1e'));_0x504d07[_0x433d('0x1b')]=_0x504d07[_0x433d('0x1f')];_0x504d07['userId']=_0x504d07[_0x433d('0x13')];_0x3b8bc3=!![];}if(_0x3b8bc3){_0x102b8c(_0x504d07);}else{_0x3af5b9({'statusCode':0x194,'message':_0x433d('0x14')});}}else{_0x3af5b9({'statusCode':0x194,'message':_0x433d('0x14')});}})[_0x433d('0x20')](function(_0x3ec6ea){logger[_0x433d('0x15')]('['+[_0x511e95['toUpperCase']()]+']',_0x3ec6ea[_0x433d('0x21')]);_0x3af5b9(_0x3ec6ea);});});};}function searchContact(_0x216638,_0x33c71d,_0x42cf48,_0x37b06c){return new Promise(function(_0x47fe96,_0x260c58){var _0xb19415={'method':'GET','headers':_0x33c71d,'uri':_0x216638+_0x433d('0x22')+_0x37b06c+_0x433d('0x23')+_0x42cf48+'&entities=contact','json':!![]};rp(_0xb19415)[_0x433d('0x24')](function(_0x2afb52){var _0x5b47bb=_[_0x433d('0x25')](_0x2afb52['contacts']['contacts'],[_0x42cf48,_0x37b06c]);_0x47fe96(_0x5b47bb);})[_0x433d('0x20')](function(_0x31969e){_0x260c58(_0x31969e);});});}function getEndUser(_0x592360,_0x353c6f,_0x5d738c){return function(_0x1a110c){return new Promise(function(_0x324f35,_0x4ef60b){logger[_0x433d('0x17')](util[_0x433d('0x26')](_0x433d('0x27'),_0x1a110c['contactNumber']));searchContact(_0x5d738c,_0x353c6f,_0x433d('0x28'),_0x1a110c['contactNumber'])[_0x433d('0x24')](function(_0x4f4832){if(_0x4f4832){_0x1a110c[_0x433d('0x29')]=_0x4f4832['id'];logger[_0x433d('0x17')](_0x433d('0x2a'),_0x1a110c[_0x433d('0x29')]);return _0x324f35(_0x1a110c);}searchContact(_0x5d738c,_0x353c6f,_0x433d('0x2b'),_0x1a110c['contactNumber'])['then'](function(_0x510769){if(_0x510769){_0x1a110c[_0x433d('0x29')]=_0x510769['id'];logger['info'](_0x433d('0x2c'),_0x1a110c[_0x433d('0x29')]);return _0x324f35(_0x1a110c);}createEndUser(_0x1a110c,_0x592360,_0x353c6f,_0x5d738c)[_0x433d('0x24')](function(_0x1e2d03){logger[_0x433d('0x17')](_0x433d('0x2d'),_0x1e2d03[_0x433d('0x29')]);return _0x324f35(_0x1e2d03);});});})[_0x433d('0x20')](function(_0x42036f){_0x4ef60b(_0x42036f);});});};}function createEndUser(_0x971953,_0x1092fe,_0x579791,_0x5f2e13){return new Promise(function(_0x5429e1,_0x2efaa6){var _0x169cd2=moment();var _0x34f07b={'method':'POST','uri':_0x5f2e13+_0x433d('0x2e'),'body':{'contact':{'last_name':_0x971953['contactNumber'],'work_number':_0x971953['contactNumber'],'mobile_number':_0x971953[_0x433d('0x2f')],'owner_id':_0x971953[_0x433d('0x1c')],'created_at':_0x169cd2[_0x433d('0x26')](_0x433d('0x30'))}},'json':!![]};_0x34f07b['headers']=_0x579791;logger[_0x433d('0x17')](_0x433d('0x31'));return rp(_0x34f07b)[_0x433d('0x24')](function(_0x4ec99c){_0x971953[_0x433d('0x29')]=_0x4ec99c['contact']['id'];_0x5429e1(_0x971953);})[_0x433d('0x20')](function(_0x507aca){logger['error']('['+[_0x1092fe[_0x433d('0x32')]()]+']',_0x507aca[_0x433d('0x21')]);_0x2efaa6(_0x507aca[_0x433d('0x21')]);});});}function getTicket(_0x230a02,_0x45a9aa,_0x90680a,_0x4dda56,_0x42e1af){return function(_0x26e070){logger[_0x433d('0x17')]('Creating\x20new\x20task');return new Promise(function(_0x98cdee,_0xaceafc){var _0xf4ce4e=moment();var _0x4d6485={'method':_0x433d('0x33'),'uri':_0x90680a+_0x433d('0x34'),'body':{'title':intUtil[_0x433d('0x35')](_0x4dda56['Subjects'],_0x42e1af,'\x20'),'description':intUtil[_0x433d('0x35')](_0x4dda56[_0x433d('0x36')],_0x42e1af,'\x0a'),'owner_id':_0x26e070[_0x433d('0x1c')],'creater_id':_0x26e070['adminId'],'targetable_id':_0x26e070['endUserId'],'targetable_type':_0x433d('0x37'),'created_at':_0xf4ce4e[_0x433d('0x26')](_0x433d('0x30')),'due_date':_0xf4ce4e['add'](0x1e,'m')[_0x433d('0x26')](_0x433d('0x30'))},'json':!![]};_0x4d6485[_0x433d('0xd')]=_0x45a9aa;return rp(_0x4d6485)[_0x433d('0x24')](function(_0x481089){_0x26e070[_0x433d('0x38')]=_0x481089[_0x433d('0x39')]['id'];logger[_0x433d('0x17')]('Task\x20created:',_0x26e070[_0x433d('0x38')]);_0x98cdee(_0x26e070);})['catch'](function(_0x43deda){logger[_0x433d('0x15')]('['+[_0x230a02['toUpperCase']()]+']',_0x43deda[_0x433d('0x21')]);_0xaceafc(_0x43deda[_0x433d('0x21')]);});});};}function emit(_0x299443,_0x2a2d2a,_0x45fe91){var _0x512737={'uri':_0x299443+_0x433d('0x3a')+_0x45fe91};io['to'](util[_0x433d('0x26')](_0x433d('0x3b'),_0x2a2d2a))[_0x433d('0x3c')]('trigger:browser:url',_0x512737);}exports['cs']=function(_0x43e822,_0x9b5c54,_0x3664ec,_0x3fec55,_0x947aad,_0x34df0a,_0x14360b,_0x327dd5){var _0xd33d81={};var _0x4229c1={'Authorization':'Token\x20token='+_0x34df0a[_0x433d('0x3d')]};_0x34df0a['remoteUri']=intUtil[_0x433d('0x3e')](_0x34df0a[_0x433d('0x3f')]);_0x34df0a[_0x433d('0x40')]=intUtil[_0x433d('0x3e')](_0x34df0a[_0x433d('0x40')]);var _0x128bba=_0x34df0a['remoteUri'];_0xd33d81[_0x433d('0x1f')]=_0x34df0a[_0x433d('0x41')];_0xd33d81['contactNumber']=_0x327dd5['toLowerCase']()===_0x433d('0x42')?_0x9b5c54[_0x433d('0x43')]:_0x9b5c54[_0x433d('0x44')];_0xd33d81['callDirection']=_0x327dd5===_0x433d('0x45')||_0x327dd5==='unmanaged'?'queue':_0x433d('0x42');if(_0x3fec55){_0xd33d81[_0x433d('0x1a')]=_0x3fec55[_0x433d('0x11')];}var _0x12e25d=util[_0x433d('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34df0a[_0x433d('0x40')],_0x9b5c54[_0x433d('0x46')],md5(_0x9b5c54['uniqueid']));if(_0x947aad&&_0x947aad['monitor_format']){logger['info'](_0x433d('0x47'),'Recording\x20is\x20enabled!');_0x9b5c54[_0x433d('0x48')]=_0x12e25d;}else if(_0x14360b&&_0x14360b['recordingFormat']&&_0x14360b[_0x433d('0x49')]!=='none'){logger[_0x433d('0x17')](_0x433d('0x4a'),'Recording\x20is\x20enabled!');_0x9b5c54[_0x433d('0x48')]=_0x12e25d;}else{_0x9b5c54[_0x433d('0x48')]='';}return getAdminId(_0xd33d81,_0x327dd5,_0x4229c1,_0x128bba)[_0x433d('0x24')](getUser(_0x327dd5,_0x4229c1,_0x128bba))[_0x433d('0x24')](getEndUser(_0x327dd5,_0x4229c1,_0x128bba))['then'](getTicket(_0x327dd5,_0x4229c1,_0x128bba,_0x3664ec,_0x9b5c54))[_0x433d('0x24')](function(_0x424dbb){logger[_0x433d('0x17')](util['format'](_0x433d('0x4b'),_0x424dbb[_0x433d('0x38')]));if(_0x327dd5!=='unmanaged'){logger['info']('['+[_0x327dd5[_0x433d('0x32')]()]+']',_0x433d('0x4c'));emit(_0x128bba,_0x3fec55[_0x433d('0x4d')],_0x424dbb[_0x433d('0x29')]);}})[_0x433d('0x20')](function(_0x3a14d3){logger[_0x433d('0x15')]('['+[_0x327dd5[_0x433d('0x32')]()]+_0x433d('0x4e'),util[_0x433d('0x4f')](_0x3a14d3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x72fc=['socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','none','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x72fc,0x1f4));var _0xc72f=function(_0x4c9b52,_0x36a55a){_0x4c9b52=_0x4c9b52-0x0;var _0x1f7179=_0x72fc[_0x4c9b52];return _0x1f7179;};'use strict';var _=require(_0xc72f('0x0'));var rp=require(_0xc72f('0x1'));var md5=require('md5');var util=require(_0xc72f('0x2'));var moment=require(_0xc72f('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xc72f('0x4'));var config=require(_0xc72f('0x5'));var logger=require(_0xc72f('0x6'))('freshsales');config['redis']=_[_0xc72f('0x7')](config[_0xc72f('0x8')],{'host':_0xc72f('0x9'),'port':0x18eb});var io=require(_0xc72f('0xa'))(new Redis(config[_0xc72f('0x8')]));function getAdminId(_0x48fafc,_0x1b2184,_0x23e4d3,_0x24fc3b){return new Promise(function(_0x59384d,_0x4d7227){var _0x4088e5=![];var _0x556dc4={'method':_0xc72f('0xb'),'uri':_0x24fc3b+_0xc72f('0xc'),'json':!![]};_0x556dc4['headers']=_0x23e4d3;logger[_0xc72f('0xd')](_0xc72f('0xe'));return rp(_0x556dc4)[_0xc72f('0xf')](function(_0x560690){if(_0x560690){var _0x49ae65=_0x560690[_0xc72f('0x10')];var _0x251a42=null;for(_0x251a42=0x0;_0x251a42<_0x49ae65[_0xc72f('0x11')];_0x251a42++){if(_0x49ae65[_0x251a42][_0xc72f('0x12')]===_0x48fafc[_0xc72f('0x13')]){_0x48fafc[_0xc72f('0x14')]=_0x49ae65[_0x251a42]['id'];_0x4088e5=!![];}}if(_0x4088e5){logger[_0xc72f('0xd')](_0xc72f('0x15'),_0x48fafc[_0xc72f('0x14')]);_0x59384d(_0x48fafc);}else{_0x4d7227({'statusCode':0x194,'message':_0xc72f('0x16')});}}else{_0x4d7227({'statusCode':0x194,'message':_0xc72f('0x16')});}})[_0xc72f('0x17')](function(_0x7f99c4){logger[_0xc72f('0x18')]('['+[_0x1b2184[_0xc72f('0x19')]()]+']',_0x7f99c4[_0xc72f('0x1a')]);_0x4d7227(_0x7f99c4);});});}function getUser(_0x12f868,_0x2c249b,_0x5e6638){return function(_0x5eb6f0){return new Promise(function(_0x3a105e,_0x24a2e7){var _0x16c625={'method':_0xc72f('0xb'),'uri':_0x5e6638+_0xc72f('0xc'),'json':!![]};_0x16c625['headers']=_0x2c249b;logger[_0xc72f('0xd')](_0xc72f('0x1b'));return rp(_0x16c625)[_0xc72f('0xf')](function(_0x3ad086){if(_0x3ad086){var _0x2c58d3=_0x3ad086[_0xc72f('0x10')];var _0x4d70c9=![];var _0x18d274=null;if(_0x5eb6f0[_0xc72f('0x1c')]!==null){logger[_0xc72f('0xd')]('Getting\x20user\x20with\x20email',_0x5eb6f0[_0xc72f('0x1c')]);_0x5eb6f0[_0xc72f('0x1d')]=_0x5eb6f0[_0xc72f('0x1c')];for(_0x18d274=0x0;_0x18d274<_0x2c58d3['length'];_0x18d274++){if(_0x2c58d3[_0x18d274][_0xc72f('0x12')]===_0x5eb6f0[_0xc72f('0x1c')]){_0x4d70c9=!![];_0x5eb6f0['userId']=_0x2c58d3[_0x18d274]['id'];logger[_0xc72f('0xd')](_0xc72f('0x1e'),_0x5eb6f0[_0xc72f('0x1f')]);}}}if(!_0x4d70c9){logger[_0xc72f('0xd')](_0xc72f('0x20'));_0x5eb6f0[_0xc72f('0x1d')]=_0x5eb6f0[_0xc72f('0x13')];_0x5eb6f0[_0xc72f('0x1f')]=_0x5eb6f0[_0xc72f('0x14')];_0x4d70c9=!![];}if(_0x4d70c9){_0x3a105e(_0x5eb6f0);}else{_0x24a2e7({'statusCode':0x194,'message':_0xc72f('0x16')});}}else{_0x24a2e7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc72f('0x17')](function(_0x10ce84){logger['error']('['+[_0x12f868[_0xc72f('0x19')]()]+']',_0x10ce84['message']);_0x24a2e7(_0x10ce84);});});};}function searchContact(_0x2369ea,_0x5d2d10,_0x54f0db,_0x448385){return new Promise(function(_0x5d5f7f,_0x23ae1e){var _0x57ce1b={'method':_0xc72f('0xb'),'headers':_0x5d2d10,'uri':_0x2369ea+_0xc72f('0x21')+_0x448385+_0xc72f('0x22')+_0x54f0db+_0xc72f('0x23'),'json':!![]};rp(_0x57ce1b)[_0xc72f('0xf')](function(_0x3472bf){var _0x19a67e=_[_0xc72f('0x24')](_0x3472bf[_0xc72f('0x25')][_0xc72f('0x25')],[_0x54f0db,_0x448385]);_0x5d5f7f(_0x19a67e);})[_0xc72f('0x17')](function(_0x433ed0){_0x23ae1e(_0x433ed0);});});}function getEndUser(_0xd87fef,_0xcbae1b,_0xcbf8cf){return function(_0x411cff){return new Promise(function(_0x5144bd,_0x1ea70d){logger['info'](util[_0xc72f('0x26')](_0xc72f('0x27'),_0x411cff[_0xc72f('0x28')]));searchContact(_0xcbf8cf,_0xcbae1b,_0xc72f('0x29'),_0x411cff[_0xc72f('0x28')])[_0xc72f('0xf')](function(_0x207691){if(_0x207691){_0x411cff[_0xc72f('0x2a')]=_0x207691['id'];logger[_0xc72f('0xd')](_0xc72f('0x2b'),_0x411cff[_0xc72f('0x2a')]);return _0x5144bd(_0x411cff);}searchContact(_0xcbf8cf,_0xcbae1b,'work_number',_0x411cff[_0xc72f('0x28')])[_0xc72f('0xf')](function(_0x1787a7){if(_0x1787a7){_0x411cff['endUserId']=_0x1787a7['id'];logger[_0xc72f('0xd')](_0xc72f('0x2c'),_0x411cff[_0xc72f('0x2a')]);return _0x5144bd(_0x411cff);}createEndUser(_0x411cff,_0xd87fef,_0xcbae1b,_0xcbf8cf)[_0xc72f('0xf')](function(_0x19a434){logger[_0xc72f('0xd')](_0xc72f('0x2d'),_0x19a434[_0xc72f('0x2a')]);return _0x5144bd(_0x19a434);});});})[_0xc72f('0x17')](function(_0x5a5ba5){_0x1ea70d(_0x5a5ba5);});});};}function createEndUser(_0x1a5a6b,_0x4aa2b8,_0x3ece4e,_0x939004){return new Promise(function(_0xacf170,_0x4ecc75){var _0x2ae8bd=moment();var _0x17eecb={'method':_0xc72f('0x2e'),'uri':_0x939004+_0xc72f('0x2f'),'body':{'contact':{'last_name':_0x1a5a6b[_0xc72f('0x28')],'work_number':_0x1a5a6b[_0xc72f('0x28')],'mobile_number':_0x1a5a6b[_0xc72f('0x28')],'owner_id':_0x1a5a6b[_0xc72f('0x1f')],'created_at':_0x2ae8bd[_0xc72f('0x26')](_0xc72f('0x30'))}},'json':!![]};_0x17eecb[_0xc72f('0x31')]=_0x3ece4e;logger[_0xc72f('0xd')](_0xc72f('0x32'));return rp(_0x17eecb)[_0xc72f('0xf')](function(_0x141114){_0x1a5a6b[_0xc72f('0x2a')]=_0x141114['contact']['id'];_0xacf170(_0x1a5a6b);})[_0xc72f('0x17')](function(_0x252343){logger['error']('['+[_0x4aa2b8[_0xc72f('0x19')]()]+']',_0x252343[_0xc72f('0x1a')]);_0x4ecc75(_0x252343[_0xc72f('0x1a')]);});});}function getTicket(_0x404f5c,_0x4f40f9,_0x2215ca,_0x26438e,_0x34fc2f){return function(_0x59e21){logger[_0xc72f('0xd')](_0xc72f('0x33'));return new Promise(function(_0x2479bc,_0x5593ef){var _0x517146=moment();var _0x3e18c5={'method':_0xc72f('0x2e'),'uri':_0x2215ca+_0xc72f('0x34'),'body':{'title':intUtil[_0xc72f('0x35')](_0x26438e[_0xc72f('0x36')],_0x34fc2f,'\x20'),'description':intUtil[_0xc72f('0x35')](_0x26438e[_0xc72f('0x37')],_0x34fc2f,'\x0a'),'owner_id':_0x59e21['userId'],'creater_id':_0x59e21[_0xc72f('0x14')],'targetable_id':_0x59e21[_0xc72f('0x2a')],'targetable_type':_0xc72f('0x38'),'created_at':_0x517146[_0xc72f('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x517146[_0xc72f('0x39')](0x1e,'m')['format'](_0xc72f('0x30'))},'json':!![]};_0x3e18c5['headers']=_0x4f40f9;return rp(_0x3e18c5)[_0xc72f('0xf')](function(_0x493ce0){_0x59e21['ticketId']=_0x493ce0[_0xc72f('0x3a')]['id'];logger['info'](_0xc72f('0x3b'),_0x59e21[_0xc72f('0x3c')]);_0x2479bc(_0x59e21);})[_0xc72f('0x17')](function(_0xee3cf1){logger[_0xc72f('0x18')]('['+[_0x404f5c['toUpperCase']()]+']',_0xee3cf1[_0xc72f('0x1a')]);_0x5593ef(_0xee3cf1[_0xc72f('0x1a')]);});});};}function emit(_0x331384,_0x5c1b8e,_0x5058e8){var _0x421d54={'uri':_0x331384+_0xc72f('0x3d')+_0x5058e8};io['to'](util[_0xc72f('0x26')](_0xc72f('0x3e'),_0x5c1b8e))[_0xc72f('0x3f')](_0xc72f('0x40'),_0x421d54);}exports['cs']=function(_0x3045d1,_0x255d62,_0x950df4,_0x554bb7,_0x41197b,_0x534999,_0x4a04d9,_0x567c2d){var _0x22d6cf={};var _0x41e931={'Authorization':_0xc72f('0x41')+_0x534999[_0xc72f('0x42')]};_0x534999[_0xc72f('0x43')]=intUtil[_0xc72f('0x44')](_0x534999[_0xc72f('0x43')]);_0x534999[_0xc72f('0x45')]=intUtil[_0xc72f('0x44')](_0x534999['serverUrl']);var _0x2e20aa=_0x534999[_0xc72f('0x43')];_0x22d6cf[_0xc72f('0x13')]=_0x534999['username'];_0x22d6cf[_0xc72f('0x28')]=_0x567c2d[_0xc72f('0x46')]()===_0xc72f('0x47')?_0x255d62[_0xc72f('0x48')]:_0x255d62[_0xc72f('0x49')];_0x22d6cf[_0xc72f('0x4a')]=_0x567c2d==='queue'||_0x567c2d===_0xc72f('0x4b')?'queue':'outbound';if(_0x554bb7){_0x22d6cf[_0xc72f('0x1c')]=_0x554bb7[_0xc72f('0x12')];}var _0x4f39d7=util[_0xc72f('0x26')](_0xc72f('0x4c'),_0x534999[_0xc72f('0x45')],_0x255d62[_0xc72f('0x4d')],md5(_0x255d62[_0xc72f('0x4d')]));if(_0x41197b&&_0x41197b['monitor_format']){logger[_0xc72f('0xd')](_0xc72f('0x4e'),_0xc72f('0x4f'));_0x255d62['recordingURL']=_0x4f39d7;}else if(_0x4a04d9&&_0x4a04d9['recordingFormat']&&_0x4a04d9['recordingFormat']!==_0xc72f('0x50')){logger[_0xc72f('0xd')]('[OUTBOUND]',_0xc72f('0x4f'));_0x255d62[_0xc72f('0x51')]=_0x4f39d7;}else{_0x255d62['recordingURL']='';}return getAdminId(_0x22d6cf,_0x567c2d,_0x41e931,_0x2e20aa)['then'](getUser(_0x567c2d,_0x41e931,_0x2e20aa))[_0xc72f('0xf')](getEndUser(_0x567c2d,_0x41e931,_0x2e20aa))[_0xc72f('0xf')](getTicket(_0x567c2d,_0x41e931,_0x2e20aa,_0x950df4,_0x255d62))[_0xc72f('0xf')](function(_0xdae498){logger['info'](util[_0xc72f('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0xdae498['ticketId']));if(_0x567c2d!==_0xc72f('0x4b')){logger[_0xc72f('0xd')]('['+[_0x567c2d[_0xc72f('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2e20aa,_0x554bb7[_0xc72f('0x52')],_0xdae498[_0xc72f('0x2a')]);}})['catch'](function(_0x2cf0b9){logger[_0xc72f('0x18')]('['+[_0x567c2d[_0xc72f('0x19')]()]+_0xc72f('0x53'),util[_0xc72f('0x54')](_0x2cf0b9,{'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 9440e68..080973d 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 _0xaab2=['data2','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','freshsales','servicenow','toLowerCase','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./desk','./vtiger','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','dynamics365','exec','includes','data1'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaab2,0x1a0));var _0x2aab=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xaab2[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x2aab('0x0'));var util=require(_0x2aab('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x2aab('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x2aab('0x3'));var desk=require(_0x2aab('0x4'));var vtiger=require(_0x2aab('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x2aab('0x6'));var freshsales=require(_0x2aab('0x7'));var integrations=['zendesk','salesforce',_0x2aab('0x8'),_0x2aab('0x9'),_0x2aab('0xa'),'desk',_0x2aab('0xb'),_0x2aab('0xc'),'freshsales','servicenow'];exports[_0x2aab('0xd')]=function(_0x1376e6,_0x5925ba,_0x14a1c6,_0x558018,_0x33cd1b,_0x15f738){if(_0x14a1c6){if(_[_0x2aab('0xe')](integrations,_0x1376e6[_0x2aab('0xf')]['toLowerCase']())){try{var _0x3471f9=null;var _0x386df2='';var _0x2bcac6=_0x14a1c6[_0x1376e6['data1']['toLowerCase']()];if(_0x2bcac6){var _0x2b28b1=_0x2bcac6[_0x1376e6[_0x2aab('0x10')]];if(_0x2b28b1){var _0x52fead=_[_0x2aab('0x11')](_0x2b28b1[_0x2aab('0x12')],{'id':parseInt(_0x1376e6['data3'],0xa)});if(_0x52fead){if(_0x558018){if(_0x33cd1b&&_0x5925ba[_0x2aab('0x13')]){_0x386df2='queue';}else if(_0x5925ba['routeId']){_0x386df2=_0x2aab('0x14');}else{console[_0x2aab('0x15')](_0x2aab('0x16'),_0x5925ba);}}else{_0x386df2=_0x2aab('0x17');}switch(_0x1376e6[_0x2aab('0xf')]['toLowerCase']()){case _0x2aab('0x18'):zendesk[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case'salesforce':salesforce[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case _0x2aab('0x8'):sugarcrm[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case _0x2aab('0x9'):freshdesk[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case _0x2aab('0xa'):zoho[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case _0x2aab('0x19'):desk[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case'vtiger':vtiger[_0x386df2](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738);break;case _0x2aab('0x1a'):freshsales['cs'](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738,_0x386df2);break;case _0x2aab('0x1b'):servicenow['cs'](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738,_0x386df2);break;case'dynamics365':dynamics365['cs'](_0x1376e6,_0x5925ba,_0x52fead,_0x558018,_0x33cd1b,_0x2b28b1,_0x15f738,_0x386df2);break;default:console[_0x2aab('0x15')]('unknown\x20integration');}}else{_0x3471f9=require('../../../../config/logger')(_0x1376e6[_0x2aab('0xf')][_0x2aab('0x1c')]());_0x3471f9[_0x2aab('0x1d')](_0x2aab('0x1e'),util[_0x2aab('0x1f')](_0x2aab('0x20'),_0x1376e6['data1'][_0x2aab('0x1c')](),_0x1376e6[_0x2aab('0x21')]));}}else{_0x3471f9=require(_0x2aab('0x22'))(_0x1376e6[_0x2aab('0xf')][_0x2aab('0x1c')]());_0x3471f9[_0x2aab('0x1d')](_0x2aab('0x1e'),util['format'](_0x2aab('0x23'),_0x1376e6[_0x2aab('0xf')][_0x2aab('0x1c')](),_0x1376e6['data2']));}}else{}}catch(_0x5812e7){console['error'](_0x5812e7);}}}}; \ No newline at end of file +var _0xcbb1=['desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','servicenow','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x52577c,_0x3c2ff0){_0x52577c=_0x52577c-0x0;var _0xc2d3ec=_0xcbb1[_0x52577c];return _0xc2d3ec;};'use strict';var _=require('lodash');var util=require(_0x1cbb('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x1cbb('0x1'));var freshdesk=require(_0x1cbb('0x2'));var zoho=require(_0x1cbb('0x3'));var desk=require(_0x1cbb('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x1cbb('0x5'));var dynamics365=require(_0x1cbb('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x1cbb('0x7'),_0x1cbb('0x8'),_0x1cbb('0x9'),'zoho',_0x1cbb('0xa'),_0x1cbb('0xb'),_0x1cbb('0xc'),_0x1cbb('0xd'),'servicenow'];exports[_0x1cbb('0xe')]=function(_0x3d37dc,_0x4c902c,_0x5709c0,_0x4ad043,_0x2a2e74,_0x10a347){if(_0x5709c0){if(_[_0x1cbb('0xf')](integrations,_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]())){try{var _0x24f950=null;var _0x559ba3='';var _0x4b63a9=_0x5709c0[_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]()];if(_0x4b63a9){var _0x3591d0=_0x4b63a9[_0x3d37dc[_0x1cbb('0x12')]];if(_0x3591d0){var _0x5ceb02=_['find'](_0x3591d0[_0x1cbb('0x13')],{'id':parseInt(_0x3d37dc[_0x1cbb('0x14')],0xa)});if(_0x5ceb02){if(_0x4ad043){if(_0x2a2e74&&_0x4c902c['queue']){_0x559ba3=_0x1cbb('0x15');}else if(_0x4c902c['routeId']){_0x559ba3=_0x1cbb('0x16');}else{console[_0x1cbb('0x17')](_0x1cbb('0x18'),_0x4c902c);}}else{_0x559ba3=_0x1cbb('0x19');}switch(_0x3d37dc['data1'][_0x1cbb('0x11')]()){case'zendesk':zendesk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x7'):salesforce[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'sugarcrm':sugarcrm[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x9'):freshdesk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x1a'):zoho[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0xa'):desk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'vtiger':vtiger[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'freshsales':freshsales['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;case _0x1cbb('0x1b'):servicenow['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;case _0x1cbb('0xc'):dynamics365['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;default:console[_0x1cbb('0x17')]('unknown\x20integration');}}else{_0x24f950=require(_0x1cbb('0x1c'))(_0x3d37dc['data1'][_0x1cbb('0x11')]());_0x24f950[_0x1cbb('0x1d')](_0x1cbb('0x1e'),util[_0x1cbb('0x1f')](_0x1cbb('0x20'),_0x3d37dc[_0x1cbb('0x10')]['toLowerCase'](),_0x3d37dc[_0x1cbb('0x14')]));}}else{_0x24f950=require(_0x1cbb('0x1c'))(_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]());_0x24f950[_0x1cbb('0x1d')](_0x1cbb('0x1e'),util[_0x1cbb('0x1f')](_0x1cbb('0x21'),_0x3d37dc['data1'][_0x1cbb('0x11')](),_0x3d37dc[_0x1cbb('0x12')]));}}else{}}catch(_0x1e9cf6){console[_0x1cbb('0x1d')](_0x1e9cf6);}}}}; \ 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 2982ce8..db138d4 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 _0x5a2c=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','lead','account','WhatId','Case','endUserType','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','resolve','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','additionalSearchLead','additionalSearchAccount','Account','Lead','Name','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','','format','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5a2c,0x179));var _0xc5a2=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x5a2c[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xc5a2('0x0'));var rp=require('request-promise');var moment=require(_0xc5a2('0x1'));var BPromise=require(_0xc5a2('0x2'));var md5=require('md5');var jsforce=require(_0xc5a2('0x3'));var util=require(_0xc5a2('0x4'));var Redis=require('ioredis');var intUtil=require(_0xc5a2('0x5'));var config=require(_0xc5a2('0x6'));var logger=require(_0xc5a2('0x7'))(_0xc5a2('0x8'));config['redis']=_[_0xc5a2('0x9')](config[_0xc5a2('0xa')],{'host':_0xc5a2('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x19b247,_0x3ea5db,_0x274f56){io['to'](_0x19b247)[_0xc5a2('0xc')](_0x3ea5db,_0x274f56);}function getTicket(_0x56daf6,_0x512ccb,_0x3741e3,_0x590231,_0x3c7afd,_0x3ed5f8,_0x1e3151,_0xd64270){var _0x45e34d=Object['assign']({},{'OwnerId':_0x512ccb['id'],'Subject':intUtil[_0xc5a2('0xd')](_0x590231[_0xc5a2('0xe')],_0x3c7afd,'\x20'),'Description':intUtil[_0xc5a2('0xd')](_0x590231[_0xc5a2('0xf')],_0x3c7afd,'\x0a')},getCustomFields(_0x3ed5f8,_0x3c7afd));if(_0x3741e3){if(_0x590231[_0xc5a2('0x10')]===_0xc5a2('0x11')){_0x45e34d[_0xc5a2('0x12')]=moment['utc']();_0x45e34d[_0xc5a2('0x13')]=![];_0x45e34d[_0xc5a2('0x14')]=![];if(_0x3741e3['endUserType']==='contact'||_0x3741e3['endUserType']===_0xc5a2('0x15')){_0x45e34d['WhoId']=_0x3741e3['id'];}else if(_0x3741e3['endUserType']===_0xc5a2('0x16')){_0x45e34d[_0xc5a2('0x17')]=_0x3741e3['id'];}}else if(_0x590231[_0xc5a2('0x10')]===_0xc5a2('0x18')){if(_0x3741e3[_0xc5a2('0x19')]===_0xc5a2('0x1a')){_0x45e34d['ContactId']=_0x3741e3['id'];}else if(_0x3741e3['endUserType']===_0xc5a2('0x16')){_0x45e34d[_0xc5a2('0x1b')]=_0x3741e3['id'];}else if(_0x3741e3['endUserType']===_0xc5a2('0x15')&&_0x590231[_0xc5a2('0x1c')]){_0x45e34d[_0x590231[_0xc5a2('0x1c')]]=_0x3741e3['id'];}else{logger[_0xc5a2('0x1d')](_0xc5a2('0x1e'));}}}return _0x1e3151[_0xc5a2('0x1f')](_0x590231[_0xc5a2('0x10')])[_0xc5a2('0x20')](_0x45e34d);}function getUser(_0x346c56,_0x3fec47,_0x4c6692){if(!_[_0xc5a2('0x21')](_0x3fec47)&&intUtil['validateEmail'](_0x3fec47)){var _0x34ed50={'Email':_0x3fec47};var _0x17738b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4c6692[_0xc5a2('0x1f')](_0xc5a2('0x22'))[_0xc5a2('0x23')](_0x34ed50,_0x17738b)[_0xc5a2('0x24')]()[_0xc5a2('0x25')](function(_0x126a28){if(_0x126a28[_0xc5a2('0x26')]){var _0x35b775=_['find'](_0x126a28,function(_0x31d6f1){return _0x31d6f1['Email']===_0x3fec47;});if(_0x35b775){logger[_0xc5a2('0x1d')]('Agent\x20%s\x20found.',_0x3fec47);return BPromise[_0xc5a2('0x27')]({'id':_0x35b775['Id'],'name':_0x35b775['Name']});}}else{logger[_0xc5a2('0x1d')](_0xc5a2('0x28'),_0x3fec47);return _0x4c6692[_0xc5a2('0x29')]()['then'](function(_0x227e27){return BPromise[_0xc5a2('0x27')]({'id':_0x227e27['user_id'],'name':_0x227e27[_0xc5a2('0x2a')]});});}});}else{logger['info'](_0xc5a2('0x28'),_0x3fec47);return _0x4c6692[_0xc5a2('0x29')]()['then'](function(_0x1f3485){return BPromise[_0xc5a2('0x27')]({'id':_0x1f3485[_0xc5a2('0x2b')],'name':_0x1f3485[_0xc5a2('0x2a')]});});}}function getEndUser(_0x2d2e2d,_0x5c9a67,_0x892153,_0x541f3d,_0xa4f79b){var _0x3c2c97={'$or':{'Phone':_0x541f3d}};var _0x6b34d8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc5a2('0x25')](function(){logger[_0xc5a2('0x1d')](_0xc5a2('0x2c'),_0x541f3d,_0x5c9a67[_0xc5a2('0x2d')]);switch(_0x5c9a67[_0xc5a2('0x2d')]){case _0xc5a2('0x2e'):var _0x211394=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67[_0xc5a2('0x30')]){var _0x58f874={};_0x58f874[_0x5c9a67[_0xc5a2('0x30')]]=_0x541f3d;_[_0xc5a2('0x31')](_0x211394[_0xc5a2('0x32')],_0x58f874);}return _0xa4f79b[_0xc5a2('0x1f')](_0xc5a2('0x33'))[_0xc5a2('0x23')](_0x211394,_0x6b34d8)['execute']()['then'](function(_0x5c75c1){if(_0x5c75c1&&_0x5c75c1[_0xc5a2('0x26')]){return _0x5c75c1;}else{var _0x4bc931=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67[_0xc5a2('0x34')]){var _0xf10387={};_0xf10387[_0x5c9a67['additionalSearchLead']]=_0x541f3d;_[_0xc5a2('0x31')](_0x4bc931[_0xc5a2('0x32')],_0xf10387);}return _0xa4f79b[_0xc5a2('0x1f')]('Lead')[_0xc5a2('0x23')](_0x4bc931,_0x6b34d8);}});case'account_contact_lead':var _0x443577=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67['additionalSearchAccount']){var _0x58f874={};_0x58f874[_0x5c9a67[_0xc5a2('0x35')]]=_0x541f3d;_[_0xc5a2('0x31')](_0x443577[_0xc5a2('0x32')],_0x58f874);}return _0xa4f79b[_0xc5a2('0x1f')](_0xc5a2('0x36'))[_0xc5a2('0x23')](_0x443577,_0x6b34d8)['execute']()[_0xc5a2('0x25')](function(_0x5747da){if(_0x5747da&&_0x5747da['length']){return _0x5747da;}else{var _0x59fe66=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67[_0xc5a2('0x30')]){var _0x3e2d1d={};_0x3e2d1d[_0x5c9a67[_0xc5a2('0x30')]]=_0x541f3d;_[_0xc5a2('0x31')](_0x59fe66[_0xc5a2('0x32')],_0x3e2d1d);}return _0xa4f79b['sobject']('Contact')['find'](_0x59fe66,_0x6b34d8)[_0xc5a2('0x25')](function(_0x124213){if(_0x124213&&_0x124213['length']){return _0x124213;}else{var _0x26c56c=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67['additionalSearchLead']){var _0xbd4044={};_0xbd4044[_0x5c9a67['additionalSearchLead']]=_0x541f3d;_[_0xc5a2('0x31')](_0x26c56c['$or'],_0xbd4044);}return _0xa4f79b[_0xc5a2('0x1f')]('Lead')[_0xc5a2('0x23')](_0x26c56c,_0x6b34d8);}});}});case _0xc5a2('0x1a'):var _0x211394=_['cloneDeep'](_0x3c2c97);if(_0x5c9a67[_0xc5a2('0x30')]){var _0x58f874={};_0x58f874[_0x5c9a67['additionalSearchContact']]=_0x541f3d;_[_0xc5a2('0x31')](_0x211394[_0xc5a2('0x32')],_0x58f874);}return _0xa4f79b['sobject'](_0xc5a2('0x33'))[_0xc5a2('0x23')](_0x211394,_0x6b34d8)['execute']();case _0xc5a2('0x15'):var _0x53ace5=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67['additionalSearchLead']){var _0x58f874={};_0x58f874[_0x5c9a67[_0xc5a2('0x34')]]=_0x541f3d;_[_0xc5a2('0x31')](_0x53ace5['$or'],_0x58f874);}return _0xa4f79b[_0xc5a2('0x1f')](_0xc5a2('0x37'))[_0xc5a2('0x23')](_0x53ace5,_0x6b34d8);case _0xc5a2('0x16'):var _0x443577=_[_0xc5a2('0x2f')](_0x3c2c97);if(_0x5c9a67[_0xc5a2('0x35')]){var _0x58f874={};_0x58f874[_0x5c9a67[_0xc5a2('0x35')]]=_0x541f3d;_[_0xc5a2('0x31')](_0x443577[_0xc5a2('0x32')],_0x58f874);}return _0xa4f79b[_0xc5a2('0x1f')](_0xc5a2('0x36'))[_0xc5a2('0x23')](_0x443577,_0x6b34d8);default:return null;}})[_0xc5a2('0x25')](function(_0x2ee782){if(_0x2ee782&&_0x2ee782[_0xc5a2('0x26')]){var _0x5413bf=_['first'](_0x2ee782);if(_0x5413bf){return BPromise[_0xc5a2('0x27')]({'id':_0x5413bf['Id'],'name':_0x5413bf[_0xc5a2('0x38')],'phone':_0x5413bf['Phone'],'endUserType':_0x5413bf['attributes'][_0xc5a2('0x39')][_0xc5a2('0x3a')]()});}}})[_0xc5a2('0x25')](function(_0xc3ed38){if(_0xc3ed38){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xc3ed38[_0xc5a2('0x19')],_0x541f3d);return BPromise[_0xc5a2('0x27')](_0xc3ed38);}else{logger[_0xc5a2('0x1d')](_0xc5a2('0x3b'),_0x541f3d);var _0x48247e={'Phone':_0x541f3d};if(_0x5c9a67[_0xc5a2('0x3c')]){if(_0x5c9a67[_0xc5a2('0x3c')]===_0xc5a2('0x1a')){logger['info'](_0xc5a2('0x3d'),_0x541f3d,_0x5c9a67[_0xc5a2('0x3c')]);_0x48247e[_0xc5a2('0x3e')]=_0x892153!==''?_0x892153:util['format'](_0xc5a2('0x3f'),_0x541f3d);}else if(_0x5c9a67[_0xc5a2('0x3c')]===_0xc5a2('0x15')){logger[_0xc5a2('0x1d')](_0xc5a2('0x3d'),_0x541f3d,_0x5c9a67[_0xc5a2('0x3c')]);_0x48247e[_0xc5a2('0x3e')]=_0x892153!==_0xc5a2('0x40')?_0x892153:util[_0xc5a2('0x41')](_0xc5a2('0x3f'),_0x541f3d);_0x48247e[_0xc5a2('0x42')]=_0xc5a2('0x43');}else if(_0x5c9a67[_0xc5a2('0x3c')]===_0xc5a2('0x16')){logger[_0xc5a2('0x1d')](_0xc5a2('0x3d'),_0x541f3d,_0x5c9a67[_0xc5a2('0x3c')]);_0x48247e[_0xc5a2('0x38')]=_0x892153!==_0xc5a2('0x40')?_0x892153:util[_0xc5a2('0x41')](_0xc5a2('0x3f'),_0x541f3d);}else{return null;}}return _0xa4f79b[_0xc5a2('0x1f')](_[_0xc5a2('0x44')](_0x5c9a67[_0xc5a2('0x3c')]))[_0xc5a2('0x20')](_0x48247e)[_0xc5a2('0x25')](function(_0x58fa02){return BPromise[_0xc5a2('0x27')]({'id':_0x58fa02['id'],'endUserType':_0x5c9a67[_0xc5a2('0x3c')]});});}});}function getCustomFields(_0x576181,_0x517a25){var _0xe6b428={};if(_0x576181['length']>0x0){_[_0xc5a2('0x45')](_0x576181,function(_0x470325){if(_[_0xc5a2('0x46')]([_0xc5a2('0x47'),_0xc5a2('0x48')],_0x470325[_0xc5a2('0x39')])&&_0x470325[_0xc5a2('0x49')]){_0xe6b428[_0x470325[_0xc5a2('0x49')]]=_0x470325['content'][_0xc5a2('0x4a')]();}else if(_0x470325['type']===_0xc5a2('0x4b')&&_0x470325[_0xc5a2('0x4c')]&&_0x470325[_0xc5a2('0x49')]){_0x517a25[_0x470325[_0xc5a2('0x4c')]]&&(_0xe6b428[_0x470325['idField']]=_0x517a25[_0x470325['variableName']][_0xc5a2('0x4a')]());}else if(_0x470325['type']===_0xc5a2('0x4d')&&_0x470325[_0xc5a2('0x4e')]&&_0x470325['Variable'][_0xc5a2('0x4f')]&&_0x470325[_0xc5a2('0x49')]){_0x517a25[_0x470325[_0xc5a2('0x4e')][_0xc5a2('0x4f')][_0xc5a2('0x3a')]()]&&(_0xe6b428[_0x470325[_0xc5a2('0x49')]]=_0x517a25[_0x470325['Variable'][_0xc5a2('0x4f')][_0xc5a2('0x3a')]()]['toString']());}});}return _0xe6b428;}function getConnection(_0x126ea5){var _0x1e9785=_0x126ea5[_0xc5a2('0x50')][_0xc5a2('0x51')](_0x126ea5[_0xc5a2('0x52')]);var _0x27f3ad=new jsforce[(_0xc5a2('0x53'))]({'oauth2':{'loginUrl':_0x126ea5[_0xc5a2('0x54')]||_0xc5a2('0x55'),'clientId':_0x126ea5[_0xc5a2('0x56')],'clientSecret':_0x126ea5['clientSecret']}});return _0x27f3ad['login'](_0x126ea5[_0xc5a2('0x57')],_0x1e9785)[_0xc5a2('0x25')](function(){logger[_0xc5a2('0x1d')](_0xc5a2('0x58'));return _0x27f3ad;});}exports[_0xc5a2('0x59')]=function(_0x4a1372,_0x3333aa,_0x40c4a8,_0x30b95b,_0x3f1222,_0x2d61a4){var _0x304452,_0x2be7af,_0x44c2d5,_0x5d0442;_0x2d61a4['serverUrl']=intUtil[_0xc5a2('0x5a')](_0x2d61a4[_0xc5a2('0x5b')]);_0x2d61a4[_0xc5a2('0x54')]=intUtil[_0xc5a2('0x5a')](_0x2d61a4[_0xc5a2('0x54')]);if(_0x3f1222&&_0x3f1222['monitor_format']){logger[_0xc5a2('0x1d')](_0xc5a2('0x5c'),_0xc5a2('0x5d'));_0x3333aa[_0xc5a2('0x5e')]=util[_0xc5a2('0x41')](_0xc5a2('0x5f'),_0x2d61a4['serverUrl'],_0x3333aa[_0xc5a2('0x60')],md5(_0x3333aa[_0xc5a2('0x60')]));}else{_0x3333aa[_0xc5a2('0x5e')]='';}return getConnection(_0x2d61a4)[_0xc5a2('0x25')](function(_0x33869c){_0x5d0442=_0x33869c;return getUser(_0x2d61a4,_0x30b95b[_0xc5a2('0x61')],_0x5d0442);})[_0xc5a2('0x25')](function(_0x28eb26){_0x304452=_0x28eb26;return getEndUser(_0x2d61a4,_0x40c4a8,_0x3333aa[_0xc5a2('0x62')],_0x3333aa['calleridnum'],_0x5d0442);})[_0xc5a2('0x25')](function(_0xb9282c){_0x2be7af=_0xb9282c;return getTicket(_0x2d61a4,_0x304452,_0x2be7af,_0x40c4a8,_0x3333aa,_0x40c4a8[_0xc5a2('0x63')],_0x5d0442,_0xc5a2('0x59'));})[_0xc5a2('0x25')](function(_0x3862b4){_0x44c2d5=_0x3862b4;logger[_0xc5a2('0x1d')](_0xc5a2('0x64'),_0x44c2d5['id']);logger[_0xc5a2('0x1d')](_0xc5a2('0x65'),_0x44c2d5['id'],_0x30b95b[_0xc5a2('0x4f')],_0x2d61a4[_0xc5a2('0x39')]);switch(_0x2d61a4[_0xc5a2('0x39')]){case'integrationTab':emit(util[_0xc5a2('0x41')](_0xc5a2('0x66'),_0x30b95b[_0xc5a2('0x4f')]),_0xc5a2('0x67'),{'recordId':_0x44c2d5['id']});break;case _0xc5a2('0x68'):emit(util['format'](_0xc5a2('0x66'),_0x30b95b[_0xc5a2('0x4f')]),_0xc5a2('0x69'),{'uri':util[_0xc5a2('0x41')](_0xc5a2('0x6a'),_0x5d0442[_0xc5a2('0x6b')],_0x44c2d5['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc5a2('0x6c')](function(_0x524d7e){logger[_0xc5a2('0x6d')]('[QUEUE]',_0x524d7e);});};exports[_0xc5a2('0x6e')]=function(_0x472978,_0x5de472,_0x5b9cf6,_0x20c5e7,_0x59f342,_0x4f6325,_0x3ea8f3){var _0x4e1872,_0xaaa50a,_0x3e5d54,_0x731bfd;_0x4f6325[_0xc5a2('0x5b')]=intUtil[_0xc5a2('0x5a')](_0x4f6325[_0xc5a2('0x5b')]);_0x4f6325[_0xc5a2('0x54')]=intUtil[_0xc5a2('0x5a')](_0x4f6325[_0xc5a2('0x54')]);if(_0x3ea8f3&&_0x3ea8f3['recordingFormat']&&_0x3ea8f3[_0xc5a2('0x6f')]!==_0xc5a2('0x70')){logger[_0xc5a2('0x1d')]('[OUTBOUND]',_0xc5a2('0x5d'));_0x5de472[_0xc5a2('0x5e')]=util['format'](_0xc5a2('0x5f'),_0x4f6325[_0xc5a2('0x5b')],_0x5de472[_0xc5a2('0x60')],md5(_0x5de472[_0xc5a2('0x60')]));}return getConnection(_0x4f6325)[_0xc5a2('0x25')](function(_0x4e3867){_0x731bfd=_0x4e3867;return getUser(_0x4f6325,_0x20c5e7[_0xc5a2('0x61')],_0x731bfd);})[_0xc5a2('0x25')](function(_0x1bee53){_0x4e1872=_0x1bee53;return getEndUser(_0x4f6325,_0x5b9cf6,_0x5de472[_0xc5a2('0x71')],_0x5de472[_0xc5a2('0x72')],_0x731bfd);})[_0xc5a2('0x25')](function(_0x1b73d4){_0xaaa50a=_0x1b73d4;return getTicket(_0x4f6325,_0x4e1872,_0xaaa50a,_0x5b9cf6,_0x5de472,_0x5b9cf6['Fields'],_0x731bfd,_0xc5a2('0x6e'));})[_0xc5a2('0x25')](function(_0x3ce96f){_0x3e5d54=_0x3ce96f;logger[_0xc5a2('0x1d')](_0xc5a2('0x73'),_0x3e5d54['id']);logger[_0xc5a2('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3e5d54['id'],_0x20c5e7['name'],_0x4f6325[_0xc5a2('0x39')]);switch(_0x4f6325[_0xc5a2('0x39')]){case'integrationTab':emit(util[_0xc5a2('0x41')](_0xc5a2('0x66'),_0x20c5e7[_0xc5a2('0x4f')]),_0xc5a2('0x67'),{'recordId':_0x3e5d54['id']});break;case _0xc5a2('0x68'):emit(util['format'](_0xc5a2('0x66'),_0x20c5e7[_0xc5a2('0x4f')]),_0xc5a2('0x69'),{'uri':util['format'](_0xc5a2('0x6a'),_0x731bfd['instanceUrl'],_0x3e5d54['id'])});break;default:logger[_0xc5a2('0x6d')](_0xc5a2('0x74'),_0xc5a2('0x75'));}})[_0xc5a2('0x6c')](function(_0x57589a){logger[_0xc5a2('0x6d')](_0xc5a2('0x74'),_0x57589a);});};exports[_0xc5a2('0x76')]=function(_0x2ae892,_0x38cee3,_0x52a575,_0x389494,_0x1b6927,_0x12f41c){var _0x5495cb,_0x2a60ff,_0x42803a,_0x31d341;_0x12f41c['serverUrl']=intUtil[_0xc5a2('0x5a')](_0x12f41c[_0xc5a2('0x5b')]);_0x12f41c['remoteUri']=intUtil[_0xc5a2('0x5a')](_0x12f41c[_0xc5a2('0x54')]);if(_0x1b6927&&_0x1b6927['monitor_format']){logger[_0xc5a2('0x1d')]('['+_0x38cee3[_0xc5a2('0x77')][_0xc5a2('0x78')]()+']',_0xc5a2('0x5d'));_0x38cee3[_0xc5a2('0x5e')]=util[_0xc5a2('0x41')](_0xc5a2('0x5f'),_0x12f41c['serverUrl'],_0x38cee3[_0xc5a2('0x60')],md5(_0x38cee3[_0xc5a2('0x60')]));}else{_0x38cee3['recordingURL']='';}return getConnection(_0x12f41c)[_0xc5a2('0x25')](function(_0x158384){_0x31d341=_0x158384;if(!_['isNil'](_0x389494)){return getUser(_0x12f41c,_0x389494[_0xc5a2('0x4f')],_0x31d341);}else{return getUser(_0x12f41c,null,_0x31d341);}})[_0xc5a2('0x25')](function(_0x1614ff){_0x5495cb=_0x1614ff;return getEndUser(_0x12f41c,_0x52a575,_0x38cee3[_0xc5a2('0x62')],_0x38cee3['calleridnum'],_0x31d341);})['then'](function(_0x541db1){_0x2a60ff=_0x541db1;return getTicket(_0x12f41c,_0x5495cb,_0x2a60ff,_0x52a575,_0x38cee3,_0x52a575[_0xc5a2('0x63')],_0x31d341);})[_0xc5a2('0x25')](function(_0x1a62a3){_0x42803a=_0x1a62a3;logger[_0xc5a2('0x1d')]('['+_0x38cee3[_0xc5a2('0x77')][_0xc5a2('0x78')]()+_0xc5a2('0x79'),_0x42803a['id']);logger[_0xc5a2('0x1d')]('['+_0x38cee3[_0xc5a2('0x77')][_0xc5a2('0x78')]()+_0xc5a2('0x7a'),_0x12f41c[_0xc5a2('0x39')]);})[_0xc5a2('0x6c')](function(_0x32fb2c){logger[_0xc5a2('0x6d')]('['+_0x38cee3[_0xc5a2('0x77')][_0xc5a2('0x78')]()+']',_0x32fb2c);});}; \ No newline at end of file +var _0xb7b3=['format','upperFirst','forEach','includes','picklist','idField','content','variable','variableName','toString','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','%s/%s/e','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','newTab','instanceUrl','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','WhatId','Case','contact','ContactId','account','leadId','sobject','create','isNil','validateEmail','User','find','execute','length','Email','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','lead','Company','No\x20Company'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xb7b3,0x1aa));var _0x3b7b=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xb7b3[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x3b7b('0x0'));var rp=require(_0x3b7b('0x1'));var moment=require(_0x3b7b('0x2'));var BPromise=require(_0x3b7b('0x3'));var md5=require('md5');var jsforce=require(_0x3b7b('0x4'));var util=require('util');var Redis=require(_0x3b7b('0x5'));var intUtil=require(_0x3b7b('0x6'));var config=require(_0x3b7b('0x7'));var logger=require(_0x3b7b('0x8'))(_0x3b7b('0x9'));config[_0x3b7b('0xa')]=_['defaults'](config[_0x3b7b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3b7b('0xb'))(new Redis(config['redis']));function emit(_0x58431e,_0x38c31b,_0x3a1d10){io['to'](_0x58431e)['emit'](_0x38c31b,_0x3a1d10);}function getTicket(_0x48abb8,_0xcd0986,_0x34298e,_0x37de30,_0x34b0cb,_0x973b4d,_0x259b24,_0x41e5b5){var _0x3967da=Object[_0x3b7b('0xc')]({},{'OwnerId':_0xcd0986['id'],'Subject':intUtil[_0x3b7b('0xd')](_0x37de30[_0x3b7b('0xe')],_0x34b0cb,'\x20'),'Description':intUtil['getString'](_0x37de30[_0x3b7b('0xf')],_0x34b0cb,'\x0a')},getCustomFields(_0x973b4d,_0x34b0cb));if(_0x34298e){if(_0x37de30[_0x3b7b('0x10')]===_0x3b7b('0x11')){_0x3967da[_0x3b7b('0x12')]=moment[_0x3b7b('0x13')]();_0x3967da[_0x3b7b('0x14')]=![];_0x3967da[_0x3b7b('0x15')]=![];if(_0x34298e[_0x3b7b('0x16')]==='contact'||_0x34298e[_0x3b7b('0x16')]==='lead'){_0x3967da[_0x3b7b('0x17')]=_0x34298e['id'];}else if(_0x34298e['endUserType']==='account'){_0x3967da[_0x3b7b('0x18')]=_0x34298e['id'];}}else if(_0x37de30[_0x3b7b('0x10')]===_0x3b7b('0x19')){if(_0x34298e[_0x3b7b('0x16')]===_0x3b7b('0x1a')){_0x3967da[_0x3b7b('0x1b')]=_0x34298e['id'];}else if(_0x34298e[_0x3b7b('0x16')]===_0x3b7b('0x1c')){_0x3967da['AccountId']=_0x34298e['id'];}else if(_0x34298e[_0x3b7b('0x16')]==='lead'&&_0x37de30[_0x3b7b('0x1d')]){_0x3967da[_0x37de30['leadId']]=_0x34298e['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x259b24[_0x3b7b('0x1e')](_0x37de30[_0x3b7b('0x10')])[_0x3b7b('0x1f')](_0x3967da);}function getUser(_0x35981b,_0x307666,_0x324d18){if(!_[_0x3b7b('0x20')](_0x307666)&&intUtil[_0x3b7b('0x21')](_0x307666)){var _0xf7ffc={'Email':_0x307666};var _0x410b73={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x324d18[_0x3b7b('0x1e')](_0x3b7b('0x22'))[_0x3b7b('0x23')](_0xf7ffc,_0x410b73)[_0x3b7b('0x24')]()['then'](function(_0x42f948){if(_0x42f948[_0x3b7b('0x25')]){var _0x419977=_[_0x3b7b('0x23')](_0x42f948,function(_0x293056){return _0x293056[_0x3b7b('0x26')]===_0x307666;});if(_0x419977){logger[_0x3b7b('0x27')](_0x3b7b('0x28'),_0x307666);return BPromise[_0x3b7b('0x29')]({'id':_0x419977['Id'],'name':_0x419977['Name']});}}else{logger[_0x3b7b('0x27')](_0x3b7b('0x2a'),_0x307666);return _0x324d18[_0x3b7b('0x2b')]()[_0x3b7b('0x2c')](function(_0xa307a7){return BPromise[_0x3b7b('0x29')]({'id':_0xa307a7[_0x3b7b('0x2d')],'name':_0xa307a7[_0x3b7b('0x2e')]});});}});}else{logger[_0x3b7b('0x27')](_0x3b7b('0x2a'),_0x307666);return _0x324d18[_0x3b7b('0x2b')]()[_0x3b7b('0x2c')](function(_0xb518b3){return BPromise[_0x3b7b('0x29')]({'id':_0xb518b3['user_id'],'name':_0xb518b3[_0x3b7b('0x2e')]});});}}function getEndUser(_0x32247c,_0x47458a,_0x3a9181,_0x397b8b,_0x15edaf){var _0x2bc750={'$or':{'Phone':_0x397b8b}};var _0x6e0eac={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3b7b('0x29')]()[_0x3b7b('0x2c')](function(){logger[_0x3b7b('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x397b8b,_0x47458a[_0x3b7b('0x2f')]);switch(_0x47458a['moduleSearch']){case'contact_lead':var _0x3dd58c=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x65d892={};_0x65d892[_0x47458a['additionalSearchContact']]=_0x397b8b;_[_0x3b7b('0x32')](_0x3dd58c['$or'],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x3dd58c,_0x6e0eac)[_0x3b7b('0x24')]()[_0x3b7b('0x2c')](function(_0x383942){if(_0x383942&&_0x383942[_0x3b7b('0x25')]){return _0x383942;}else{var _0x573a4b=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x53b816={};_0x53b816[_0x47458a['additionalSearchLead']]=_0x397b8b;_[_0x3b7b('0x32')](_0x573a4b['$or'],_0x53b816);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x35'))[_0x3b7b('0x23')](_0x573a4b,_0x6e0eac);}});case _0x3b7b('0x36'):var _0x44bc2e=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x37')]){var _0x65d892={};_0x65d892[_0x47458a['additionalSearchAccount']]=_0x397b8b;_[_0x3b7b('0x32')](_0x44bc2e[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x39'))[_0x3b7b('0x23')](_0x44bc2e,_0x6e0eac)[_0x3b7b('0x24')]()[_0x3b7b('0x2c')](function(_0x2efbdd){if(_0x2efbdd&&_0x2efbdd['length']){return _0x2efbdd;}else{var _0x71a011=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x1680a0={};_0x1680a0[_0x47458a[_0x3b7b('0x31')]]=_0x397b8b;_['merge'](_0x71a011[_0x3b7b('0x38')],_0x1680a0);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x71a011,_0x6e0eac)[_0x3b7b('0x2c')](function(_0x35cee3){if(_0x35cee3&&_0x35cee3[_0x3b7b('0x25')]){return _0x35cee3;}else{var _0x45932f=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x514abd={};_0x514abd[_0x47458a[_0x3b7b('0x34')]]=_0x397b8b;_[_0x3b7b('0x32')](_0x45932f[_0x3b7b('0x38')],_0x514abd);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x35'))[_0x3b7b('0x23')](_0x45932f,_0x6e0eac);}});}});case _0x3b7b('0x1a'):var _0x3dd58c=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x31')]]=_0x397b8b;_['merge'](_0x3dd58c[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x3dd58c,_0x6e0eac)[_0x3b7b('0x24')]();case'lead':var _0xc8e864=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x34')]]=_0x397b8b;_['merge'](_0xc8e864[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf['sobject']('Lead')[_0x3b7b('0x23')](_0xc8e864,_0x6e0eac);case _0x3b7b('0x1c'):var _0x44bc2e=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x37')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x37')]]=_0x397b8b;_['merge'](_0x44bc2e[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf['sobject'](_0x3b7b('0x39'))['find'](_0x44bc2e,_0x6e0eac);default:return null;}})['then'](function(_0x4a41cf){if(_0x4a41cf&&_0x4a41cf[_0x3b7b('0x25')]){var _0x3e58f3=_['first'](_0x4a41cf);if(_0x3e58f3){return BPromise[_0x3b7b('0x29')]({'id':_0x3e58f3['Id'],'name':_0x3e58f3[_0x3b7b('0x3a')],'phone':_0x3e58f3[_0x3b7b('0x3b')],'endUserType':_0x3e58f3['attributes'][_0x3b7b('0x3c')]['toLowerCase']()});}}})[_0x3b7b('0x2c')](function(_0x2271fe){if(_0x2271fe){logger[_0x3b7b('0x27')](_0x3b7b('0x3d'),_0x2271fe[_0x3b7b('0x16')],_0x397b8b);return BPromise['resolve'](_0x2271fe);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x397b8b);var _0x4dc1de={'Phone':_0x397b8b};if(_0x47458a['moduleCreate']){if(_0x47458a[_0x3b7b('0x3e')]===_0x3b7b('0x1a')){logger[_0x3b7b('0x27')](_0x3b7b('0x3f'),_0x397b8b,_0x47458a[_0x3b7b('0x3e')]);_0x4dc1de[_0x3b7b('0x40')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util['format'](_0x3b7b('0x42'),_0x397b8b);}else if(_0x47458a['moduleCreate']===_0x3b7b('0x43')){logger[_0x3b7b('0x27')](_0x3b7b('0x3f'),_0x397b8b,_0x47458a['moduleCreate']);_0x4dc1de[_0x3b7b('0x40')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util['format'](_0x3b7b('0x42'),_0x397b8b);_0x4dc1de[_0x3b7b('0x44')]=_0x3b7b('0x45');}else if(_0x47458a[_0x3b7b('0x3e')]===_0x3b7b('0x1c')){logger[_0x3b7b('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x397b8b,_0x47458a[_0x3b7b('0x3e')]);_0x4dc1de[_0x3b7b('0x3a')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util[_0x3b7b('0x46')](_0x3b7b('0x42'),_0x397b8b);}else{return null;}}return _0x15edaf[_0x3b7b('0x1e')](_[_0x3b7b('0x47')](_0x47458a['moduleCreate']))[_0x3b7b('0x1f')](_0x4dc1de)[_0x3b7b('0x2c')](function(_0x34ee8){return BPromise[_0x3b7b('0x29')]({'id':_0x34ee8['id'],'endUserType':_0x47458a[_0x3b7b('0x3e')]});});}});}function getCustomFields(_0x4b4c7e,_0x5b5d69){var _0x3f59e1={};if(_0x4b4c7e[_0x3b7b('0x25')]>0x0){_[_0x3b7b('0x48')](_0x4b4c7e,function(_0xa8fce){if(_[_0x3b7b('0x49')](['string',_0x3b7b('0x4a')],_0xa8fce[_0x3b7b('0x3c')])&&_0xa8fce[_0x3b7b('0x4b')]){_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0xa8fce[_0x3b7b('0x4c')]['toString']();}else if(_0xa8fce['type']===_0x3b7b('0x4d')&&_0xa8fce['variableName']&&_0xa8fce['idField']){_0x5b5d69[_0xa8fce[_0x3b7b('0x4e')]]&&(_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0x5b5d69[_0xa8fce[_0x3b7b('0x4e')]][_0x3b7b('0x4f')]());}else if(_0xa8fce['type']==='customVariable'&&_0xa8fce[_0x3b7b('0x50')]&&_0xa8fce['Variable'][_0x3b7b('0x51')]&&_0xa8fce[_0x3b7b('0x4b')]){_0x5b5d69[_0xa8fce[_0x3b7b('0x50')][_0x3b7b('0x51')][_0x3b7b('0x52')]()]&&(_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0x5b5d69[_0xa8fce['Variable']['name']['toLowerCase']()][_0x3b7b('0x4f')]());}});}return _0x3f59e1;}function getConnection(_0x26e10d){var _0x40c0a6=_0x26e10d[_0x3b7b('0x53')]['concat'](_0x26e10d[_0x3b7b('0x54')]);var _0x63b336=new jsforce[(_0x3b7b('0x55'))]({'oauth2':{'loginUrl':_0x26e10d[_0x3b7b('0x56')]||_0x3b7b('0x57'),'clientId':_0x26e10d[_0x3b7b('0x58')],'clientSecret':_0x26e10d[_0x3b7b('0x59')]}});return _0x63b336['login'](_0x26e10d[_0x3b7b('0x5a')],_0x40c0a6)[_0x3b7b('0x2c')](function(){logger[_0x3b7b('0x27')](_0x3b7b('0x5b'));return _0x63b336;});}exports['queue']=function(_0x504a8a,_0x5c7124,_0x309ceb,_0x30ebed,_0xcd1523,_0x79cbc4){var _0x209a38,_0xe2937c,_0x574585,_0x2dfae1;_0x79cbc4[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0x79cbc4['serverUrl']);_0x79cbc4[_0x3b7b('0x56')]=intUtil['stripTrailingSlash'](_0x79cbc4[_0x3b7b('0x56')]);if(_0xcd1523&&_0xcd1523[_0x3b7b('0x5e')]){logger[_0x3b7b('0x27')](_0x3b7b('0x5f'),_0x3b7b('0x60'));_0x5c7124[_0x3b7b('0x61')]=util[_0x3b7b('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x79cbc4[_0x3b7b('0x5c')],_0x5c7124['uniqueid'],md5(_0x5c7124[_0x3b7b('0x62')]));}else{_0x5c7124[_0x3b7b('0x61')]='';}return getConnection(_0x79cbc4)[_0x3b7b('0x2c')](function(_0x49d7b2){_0x2dfae1=_0x49d7b2;return getUser(_0x79cbc4,_0x30ebed['email'],_0x2dfae1);})['then'](function(_0x1c9a5f){_0x209a38=_0x1c9a5f;return getEndUser(_0x79cbc4,_0x309ceb,_0x5c7124[_0x3b7b('0x63')],_0x5c7124[_0x3b7b('0x64')],_0x2dfae1);})[_0x3b7b('0x2c')](function(_0x358d24){_0xe2937c=_0x358d24;return getTicket(_0x79cbc4,_0x209a38,_0xe2937c,_0x309ceb,_0x5c7124,_0x309ceb[_0x3b7b('0x65')],_0x2dfae1,_0x3b7b('0x66'));})[_0x3b7b('0x2c')](function(_0x4a9124){_0x574585=_0x4a9124;logger[_0x3b7b('0x27')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x574585['id']);logger[_0x3b7b('0x27')](_0x3b7b('0x67'),_0x574585['id'],_0x30ebed[_0x3b7b('0x51')],_0x79cbc4[_0x3b7b('0x3c')]);switch(_0x79cbc4[_0x3b7b('0x3c')]){case'integrationTab':emit(util[_0x3b7b('0x46')](_0x3b7b('0x68'),_0x30ebed[_0x3b7b('0x51')]),_0x3b7b('0x69'),{'recordId':_0x574585['id']});break;case'newTab':emit(util[_0x3b7b('0x46')](_0x3b7b('0x68'),_0x30ebed[_0x3b7b('0x51')]),'trigger:browser:url',{'uri':util[_0x3b7b('0x46')](_0x3b7b('0x6a'),_0x2dfae1['instanceUrl'],_0x574585['id'])});break;default:logger[_0x3b7b('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2d703e){logger[_0x3b7b('0x6b')](_0x3b7b('0x5f'),_0x2d703e);});};exports[_0x3b7b('0x6c')]=function(_0x4da458,_0xb72f96,_0xc3e2f5,_0x2b0154,_0x40e2c6,_0xc6f882,_0x464ad5){var _0x1dced3,_0x118e4d,_0x3803d3,_0x1879cf;_0xc6f882[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0xc6f882[_0x3b7b('0x5c')]);_0xc6f882[_0x3b7b('0x56')]=intUtil[_0x3b7b('0x5d')](_0xc6f882[_0x3b7b('0x56')]);if(_0x464ad5&&_0x464ad5[_0x3b7b('0x6d')]&&_0x464ad5[_0x3b7b('0x6d')]!==_0x3b7b('0x6e')){logger[_0x3b7b('0x27')](_0x3b7b('0x6f'),_0x3b7b('0x60'));_0xb72f96[_0x3b7b('0x61')]=util[_0x3b7b('0x46')](_0x3b7b('0x70'),_0xc6f882[_0x3b7b('0x5c')],_0xb72f96[_0x3b7b('0x62')],md5(_0xb72f96['uniqueid']));}return getConnection(_0xc6f882)[_0x3b7b('0x2c')](function(_0x4217df){_0x1879cf=_0x4217df;return getUser(_0xc6f882,_0x2b0154[_0x3b7b('0x71')],_0x1879cf);})[_0x3b7b('0x2c')](function(_0x837abd){_0x1dced3=_0x837abd;return getEndUser(_0xc6f882,_0xc3e2f5,_0xb72f96['destcalleridname'],_0xb72f96['destcalleridnum'],_0x1879cf);})['then'](function(_0x9e7b8){_0x118e4d=_0x9e7b8;return getTicket(_0xc6f882,_0x1dced3,_0x118e4d,_0xc3e2f5,_0xb72f96,_0xc3e2f5['Fields'],_0x1879cf,_0x3b7b('0x6c'));})['then'](function(_0x45ae26){_0x3803d3=_0x45ae26;logger[_0x3b7b('0x27')](_0x3b7b('0x72'),_0x3803d3['id']);logger[_0x3b7b('0x27')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3803d3['id'],_0x2b0154[_0x3b7b('0x51')],_0xc6f882[_0x3b7b('0x3c')]);switch(_0xc6f882[_0x3b7b('0x3c')]){case _0x3b7b('0x73'):emit(util['format']('user:%s',_0x2b0154[_0x3b7b('0x51')]),_0x3b7b('0x69'),{'recordId':_0x3803d3['id']});break;case _0x3b7b('0x74'):emit(util[_0x3b7b('0x46')]('user:%s',_0x2b0154[_0x3b7b('0x51')]),'trigger:browser:url',{'uri':util[_0x3b7b('0x46')](_0x3b7b('0x6a'),_0x1879cf[_0x3b7b('0x75')],_0x3803d3['id'])});break;default:logger[_0x3b7b('0x6b')](_0x3b7b('0x6f'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x527a5d){logger['error'](_0x3b7b('0x6f'),_0x527a5d);});};exports[_0x3b7b('0x76')]=function(_0x1dabc4,_0x5472c7,_0x576ebd,_0x5596a7,_0x42bf20,_0x5d5791){var _0x47fcc9,_0x1a4a33,_0x35271f,_0x1a3bcb;_0x5d5791[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0x5d5791[_0x3b7b('0x5c')]);_0x5d5791[_0x3b7b('0x56')]=intUtil[_0x3b7b('0x5d')](_0x5d5791[_0x3b7b('0x56')]);if(_0x42bf20&&_0x42bf20[_0x3b7b('0x5e')]){logger[_0x3b7b('0x27')]('['+_0x5472c7[_0x3b7b('0x77')]['toUpperCase']()+']',_0x3b7b('0x60'));_0x5472c7[_0x3b7b('0x61')]=util['format'](_0x3b7b('0x70'),_0x5d5791[_0x3b7b('0x5c')],_0x5472c7[_0x3b7b('0x62')],md5(_0x5472c7['uniqueid']));}else{_0x5472c7[_0x3b7b('0x61')]='';}return getConnection(_0x5d5791)[_0x3b7b('0x2c')](function(_0x2c9f2b){_0x1a3bcb=_0x2c9f2b;if(!_['isNil'](_0x5596a7)){return getUser(_0x5d5791,_0x5596a7[_0x3b7b('0x51')],_0x1a3bcb);}else{return getUser(_0x5d5791,null,_0x1a3bcb);}})[_0x3b7b('0x2c')](function(_0x52a88e){_0x47fcc9=_0x52a88e;return getEndUser(_0x5d5791,_0x576ebd,_0x5472c7[_0x3b7b('0x63')],_0x5472c7['calleridnum'],_0x1a3bcb);})[_0x3b7b('0x2c')](function(_0xf1626a){_0x1a4a33=_0xf1626a;return getTicket(_0x5d5791,_0x47fcc9,_0x1a4a33,_0x576ebd,_0x5472c7,_0x576ebd[_0x3b7b('0x65')],_0x1a3bcb);})[_0x3b7b('0x2c')](function(_0x44a293){_0x35271f=_0x44a293;logger[_0x3b7b('0x27')]('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+_0x3b7b('0x79'),_0x35271f['id']);logger['info']('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+_0x3b7b('0x7a'),_0x5d5791[_0x3b7b('0x3c')]);})[_0x3b7b('0x7b')](function(_0x48060e){logger[_0x3b7b('0x6b')]('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+']',_0x48060e);});}; \ 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 14f7c63..283d13a 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 _0x6363=['trigger:browser:url','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','util','md5','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','content','toString','includes','string','idField','variable','variableName','toLowerCase','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0x6363,0x8c));var _0x3636=function(_0x20c27b,_0x36889b){_0x20c27b=_0x20c27b-0x0;var _0x29befa=_0x6363[_0x20c27b];return _0x29befa;};'use strict';var _=require('lodash');var Promise=require(_0x3636('0x0'));var rp=require('request-promise');var util=require(_0x3636('0x1'));var md5=require(_0x3636('0x2'));var Redis=require(_0x3636('0x3'));var intUtil=require('./util');var config=require(_0x3636('0x4'));var logger=require('../../../../config/logger')(_0x3636('0x5'));config[_0x3636('0x6')]=_[_0x3636('0x7')](config[_0x3636('0x6')],{'host':_0x3636('0x8'),'port':0x18eb});var io=require(_0x3636('0x9'))(new Redis(config[_0x3636('0x6')]));function getAdminUser(_0x547731,_0x41d61a,_0x197384,_0x5c872,_0xea517c,_0x34b4b0){return new Promise(function(_0x198385,_0x46fbcf){var _0x857f0c={'method':_0x3636('0xa'),'uri':_0x5c872+_0x3636('0xb')+'&'+_0xea517c+'&'+_0x34b4b0,'auth':_0x41d61a,'json':!![]};return rp(_0x857f0c)[_0x3636('0xc')](function(_0x7b8ac0){if(_0x7b8ac0['result'][_0x3636('0xd')]>0x0){_0x197384[_0x3636('0xe')]=_0x7b8ac0[_0x3636('0xf')][0x0][_0x3636('0x10')];}logger[_0x3636('0x11')]('['+[_0x547731['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x197384);_0x198385(_0x197384);})[_0x3636('0x12')](function(_0x4df81f){logger[_0x3636('0x13')]('['+[_0x547731[_0x3636('0x14')]()]+']',_0x4df81f[_0x3636('0x15')]);_0x46fbcf(_0x4df81f[_0x3636('0x15')]);});});}function getUser(_0x8d3585,_0x53a9b9,_0x833c81,_0x50c137,_0x26f68e){return function(_0x4ed240){logger[_0x3636('0x11')]('['+[_0x8d3585[_0x3636('0x14')]()]+_0x3636('0x16'),_0x4ed240);return new Promise(function(_0x30c091,_0x522ae8){if(intUtil[_0x3636('0x17')](_0x4ed240[_0x3636('0x18')])){var _0x233f6d={'method':_0x3636('0xa'),'uri':_0x833c81+'sys_user?sysparm_query=email%3D'+_0x4ed240[_0x3636('0x18')]+'&'+_0x50c137+'&'+_0x26f68e,'auth':_0x53a9b9,'json':!![]};logger['info']('['+[_0x8d3585[_0x3636('0x14')]()]+_0x3636('0x19'),_0x233f6d);return rp(_0x233f6d)[_0x3636('0xc')](function(_0x4576f8){logger[_0x3636('0x11')]('['+[_0x8d3585[_0x3636('0x14')]()]+'],\x20getUser\x20entity',_0x4576f8);if(_0x4576f8[_0x3636('0xf')][_0x3636('0xd')]>0x0&&String(_0x4576f8[_0x3636('0xf')][0x0][_0x3636('0x1a')])===_0x3636('0x1b')){_0x4ed240['userId']=_0x4576f8[_0x3636('0xf')][0x0][_0x3636('0x10')];}else{_0x4ed240['userId']=_0x4ed240['adminId'];_0x4ed240[_0x3636('0x18')]=_0x4ed240['adminEmail'];}logger[_0x3636('0x11')]('['+[_0x8d3585[_0x3636('0x14')]()]+_0x3636('0x1c'),_0x4ed240);_0x30c091(_0x4ed240);})[_0x3636('0x12')](function(_0x38a9fd){logger[_0x3636('0x13')]('['+[_0x8d3585['toUpperCase']()]+']',_0x38a9fd['message']);_0x522ae8(_0x38a9fd['message']);});}else{logger[_0x3636('0x11')]('['+[_0x8d3585[_0x3636('0x14')]()]+_0x3636('0x1d'));_0x4ed240[_0x3636('0x1e')]=_0x4ed240['adminId'];_0x4ed240[_0x3636('0x18')]=_0x4ed240[_0x3636('0x1f')];_0x30c091(_0x4ed240);}});};}function createEndUser(_0x1dcd02,_0x291bba,_0x3951ad,_0x290a16,_0xd588ec){logger['info']('['+[_0x1dcd02[_0x3636('0x14')]()]+_0x3636('0x20'),_0x3951ad);return new Promise(function(_0x1f551c,_0x378322){var _0x31d059={'method':_0x3636('0x21'),'uri':_0x290a16+_0x3636('0x22')+_0xd588ec,'body':{'user_name':_0x3951ad[_0x3636('0x23')],'roles':_0x3636('0x24'),'first_name':_0x3951ad[_0x3636('0x23')],'active':_0x3636('0x1b'),'date_format':_0x3636('0x25'),'phone':_0x3951ad[_0x3636('0x23')]},'auth':_0x291bba,'json':!![]};return rp(_0x31d059)[_0x3636('0xc')](function(_0x5c2333){logger[_0x3636('0x11')]('['+[_0x1dcd02[_0x3636('0x14')]()]+_0x3636('0x26'),_0x5c2333[_0x3636('0xf')]);_0x3951ad[_0x3636('0x27')]=_0x5c2333[_0x3636('0xf')]['sys_id'];_0x1f551c(_0x3951ad);})[_0x3636('0x12')](function(_0x8f679e){logger['error']('['+[_0x1dcd02[_0x3636('0x14')]()]+']',_0x8f679e['message']);_0x378322(_0x8f679e[_0x3636('0x15')]);});});}function getEndUser(_0x3b0423,_0x35450b,_0x33806b,_0x2ae5a6,_0x2c23a0){return function(_0x3bbc73){logger['info']('['+[_0x3b0423[_0x3636('0x14')]()]+_0x3636('0x28'),_0x3bbc73);return new Promise(function(_0x2fdec8,_0x2637b3){var _0x5cdaea={'method':_0x3636('0xa'),'uri':_0x33806b+_0x3636('0x29')+_0x3bbc73[_0x3636('0x23')]+'&'+_0x2ae5a6+'&'+_0x2c23a0,'auth':_0x35450b,'json':!![]};return rp(_0x5cdaea)[_0x3636('0xc')](function(_0x22da2a){if(_0x22da2a['result'][_0x3636('0xd')]>0x0){_0x3bbc73[_0x3636('0x27')]=_0x22da2a[_0x3636('0xf')][0x0][_0x3636('0x10')];logger[_0x3636('0x11')]('['+[_0x3b0423[_0x3636('0x14')]()]+_0x3636('0x2a'),_0x3bbc73);_0x2fdec8(_0x3bbc73);}else{return createEndUser(_0x3b0423,_0x35450b,_0x3bbc73,_0x33806b,_0x2ae5a6)[_0x3636('0xc')](function(_0x301c5a){logger[_0x3636('0x11')]('['+[_0x3b0423[_0x3636('0x14')]()]+_0x3636('0x2b'),_0x301c5a);_0x2fdec8(_0x301c5a);});}})[_0x3636('0x12')](function(_0x3520f6){logger[_0x3636('0x13')]('['+[_0x3b0423[_0x3636('0x14')]()]+']',_0x3520f6[_0x3636('0x15')]);_0x2637b3(_0x3520f6['message']);});});};}function getCustomFields(_0x28ef16,_0x11dc58){var _0xe50dfc={};if(_0x28ef16[_0x3636('0xd')]>0x0){_[_0x3636('0x2c')](_0x28ef16,function(_0x462f9d){if(_['includes'](['string',_0x3636('0x2d')],_0x462f9d[_0x3636('0x2e')])&&_0x462f9d[_0x3636('0x2f')]&&!_0x462f9d[_0x3636('0x30')]){_0xe50dfc[_0x462f9d['nameField']['toLowerCase']()]=_0x462f9d[_0x3636('0x31')][_0x3636('0x32')]();}else if(_[_0x3636('0x33')]([_0x3636('0x34'),'picklist'],_0x462f9d['type'])&&_0x462f9d[_0x3636('0x35')]&&_0x462f9d[_0x3636('0x30')]){_0xe50dfc[_0x462f9d[_0x3636('0x35')]['toLowerCase']()]=_0x462f9d[_0x3636('0x31')][_0x3636('0x32')]();}else if(_0x462f9d[_0x3636('0x2e')]===_0x3636('0x36')&&_0x462f9d[_0x3636('0x37')]&&_0x462f9d[_0x3636('0x35')]&&_0x462f9d[_0x3636('0x30')]){_0xe50dfc[_0x462f9d['idField'][_0x3636('0x38')]()]=_0x11dc58[_0x462f9d[_0x3636('0x37')]]['toString']();}else if(_0x462f9d[_0x3636('0x2e')]===_0x3636('0x39')&&_0x462f9d['Variable']&&_0x462f9d['Variable']['name']&&_0x462f9d[_0x3636('0x35')]&&_0x462f9d[_0x3636('0x30')]){_0xe50dfc[_0x462f9d['idField'][_0x3636('0x38')]()]=_0x11dc58[_0x462f9d[_0x3636('0x3a')][_0x3636('0x3b')][_0x3636('0x38')]()][_0x3636('0x32')]();}});}return _0xe50dfc;}function getTicket(_0x582f29,_0xcb106a,_0x2fb2a3,_0x4bad48,_0x49cc4a,_0x4ab532){return function(_0x3b4097){logger[_0x3636('0x11')]('['+[_0x582f29[_0x3636('0x14')]()]+_0x3636('0x3c'),_0x3b4097);return new Promise(function(_0x453523,_0x43ea16){var _0x3f9fb3=_0x582f29['toLowerCase']()===_0x3636('0x3d')?_0x3b4097[_0x3636('0x1e')]:_0x3b4097['endUserId'];var _0x2fbd11={'method':_0x3636('0x21'),'uri':_0x2fb2a3+_0x3636('0x3e')+'?'+_0x4ab532,'body':Object[_0x3636('0x3f')]({},{'active':_0x3636('0x1b'),'caller_id':_0x3f9fb3,'assigned_to':_0x3b4097[_0x3636('0x1e')],'short_description':intUtil[_0x3636('0x40')](_0x4bad48[_0x3636('0x41')],_0x49cc4a,'\x20'),'description':intUtil['getString'](_0x4bad48['Descriptions'],_0x49cc4a,'\x0a')},getCustomFields(_0x4bad48[_0x3636('0x42')],_0x49cc4a)),'auth':_0xcb106a,'json':!![]};return rp(_0x2fbd11)['then'](function(_0x405b22){logger['info']('['+[_0x582f29['toUpperCase']()]+_0x3636('0x43'),_0x405b22[_0x3636('0xf')]);_0x3b4097[_0x3636('0x44')]=_0x405b22[_0x3636('0xf')][_0x3636('0x10')];_0x3b4097['ticketNumber']=_0x405b22[_0x3636('0xf')][_0x3636('0x45')];logger['info']('['+[_0x582f29[_0x3636('0x14')]()]+_0x3636('0x46'),_0x3b4097);_0x453523(_0x3b4097);})['catch'](function(_0x4458bc){logger['error']('['+[_0x582f29['toUpperCase']()]+']',_0x4458bc[_0x3636('0x15')]);_0x43ea16(_0x4458bc[_0x3636('0x15')]);});});};}function createRemoteTag(_0x38b7e,_0xe6f0e,_0x2c79d3,_0x2cd1b7){return new Promise(function(_0x5bc9c3,_0x13940f){var _0x307b2b={'method':_0x3636('0x21'),'uri':_0x2c79d3+_0x3636('0x47')+'?'+_0x2cd1b7,'body':{'short_description':_0x38b7e,'global':!![],'active':!![],'name':_0x38b7e},'auth':_0xe6f0e,'json':!![]};return rp(_0x307b2b)[_0x3636('0xc')](function(_0x2bb475){var _0x4cc7cb=_0x2bb475['result'][_0x3636('0x10')];_0x5bc9c3(_0x4cc7cb);});});}function getRemoteTag(_0x243b7c,_0x4053cd,_0x46329b,_0x4bdef9,_0x21480a){return new Promise(function(_0xe548bb,_0x3ad595){var _0xe1552f={'method':_0x3636('0xa'),'uri':_0x46329b+_0x3636('0x47')+_0x3636('0x48')+_0x243b7c+'&'+_0x4bdef9,'auth':_0x4053cd,'json':!![]};return rp(_0xe1552f)[_0x3636('0xc')](function(_0x3d91ca){if(_0x3d91ca['result']['length']>0x0){var _0x2d5600=_0x3d91ca[_0x3636('0xf')][0x0][_0x3636('0x10')];_0xe548bb(_0x2d5600);}else{return createRemoteTag(_0x243b7c,_0x4053cd,_0x46329b,_0x4bdef9)[_0x3636('0xc')](function(_0xeefaad){_0xe548bb(_0xeefaad);});}});});}function assignTagToIncident(_0xf2ce02,_0x7bc73d,_0x4dd303,_0x59ed73,_0x26946e){return new Promise(function(_0x1bde88,_0x2027a8){var _0x13efa4={'method':'POST','uri':_0x4dd303+_0x3636('0x49')+'?'+_0x26946e,'body':{'label':_0xf2ce02,'table':'incident','id_type':_0x3636('0x4a'),'table_key':_0x59ed73[_0x3636('0x44')],'title':_0x3636('0x4b')+_0x59ed73[_0x3636('0x4c')],'id_display':_0x59ed73[_0x3636('0x4c')]},'auth':_0x7bc73d,'json':!![]};return rp(_0x13efa4)[_0x3636('0xc')](function(_0x3a3c19){_0x1bde88();})[_0x3636('0x12')](function(){_0x1bde88();});});}function manageTags(_0x414b4a,_0x58dd5c,_0x1c26f9,_0x29046f,_0x39b9e7,_0xf27217,_0x41a8e8){return new Promise(function(_0x1ef8b0,_0x66f352){var _0x52f6e0=[];_0x58dd5c[_0x3636('0x2c')](function(_0x5bb904){_0x52f6e0['push'](getRemoteTag(_0x5bb904,_0x1c26f9,_0x29046f,_0xf27217,_0x41a8e8));});return Promise[_0x3636('0x4d')](_0x52f6e0)[_0x3636('0xc')](function(_0x5b2474){if(_0x5b2474[_0x3636('0xd')]){logger[_0x3636('0x11')]('['+[_0x414b4a[_0x3636('0x14')]()]+_0x3636('0x4e'),_0x5b2474);var _0x12b593=[];_0x5b2474[_0x3636('0x2c')](function(_0x49a075){_0x12b593[_0x3636('0x4f')](assignTagToIncident(_0x49a075,_0x1c26f9,_0x29046f,_0x39b9e7,_0xf27217));});return Promise[_0x3636('0x4d')](_0x12b593)[_0x3636('0xc')](function(){_0x1ef8b0();})[_0x3636('0x12')](function(){_0x1ef8b0();});}else{_0x1ef8b0();}});});}function getTags(_0x1acdfd,_0x1c14cc,_0x58516,_0x505d52,_0x268144,_0x162e3d){return function(_0x4f8c05){return new Promise(function(_0x49f187,_0x46dd3b){var _0x77a319=[];var _0x19ca7b=_0x505d52[_0x3636('0x50')];if(_0x19ca7b&&_0x19ca7b[_0x3636('0xd')]>0x0){_0x77a319=_[_0x3636('0x51')](_0x19ca7b,_0x3636('0x3b'));}if(_0x77a319[_0x3636('0xd')]>0x0){return manageTags(_0x1acdfd,_0x77a319,_0x1c14cc,_0x58516,_0x4f8c05,_0x268144,_0x162e3d)[_0x3636('0xc')](function(){_0x49f187(_0x4f8c05);});}else{_0x49f187(_0x4f8c05);}});};}function emit(_0x442f75,_0x379366,_0x427fd9){var _0x129772=_0x3636('0x52')+_0x3636('0x53')+_0x3636('0x54')+_0x3636('0x55');var _0x5f47ce={'uri':_0x442f75+_0x3636('0x56')+_0x427fd9+_0x129772};io['to'](util[_0x3636('0x57')](_0x3636('0x58'),_0x379366))[_0x3636('0x59')](_0x3636('0x5a'),_0x5f47ce);}exports['cs']=function(_0x28b8be,_0x5dddf3,_0x2e1ab2,_0x561c87,_0x247e1e,_0xd5b67a,_0x20c8db,_0x28d823){var _0x34a625={};var _0x3bb093={'user':_0xd5b67a['username'],'pass':_0xd5b67a[_0x3636('0x5b')]};var _0x47e1b7='sysparm_limit=1';var _0x2271f7='sysparm_display_value=true';_0xd5b67a[_0x3636('0x5c')]=intUtil[_0x3636('0x5d')](_0xd5b67a['remoteUri']);_0xd5b67a[_0x3636('0x5e')]=intUtil[_0x3636('0x5d')](_0xd5b67a[_0x3636('0x5e')]);var _0x2a231d=util[_0x3636('0x57')](_0x3636('0x5f'),_0xd5b67a['remoteUri']);_0x34a625[_0x3636('0x18')]=!_[_0x3636('0x60')](_0x561c87)?_0x561c87['email']:null;_0x34a625[_0x3636('0x1f')]=_0xd5b67a[_0x3636('0x61')];_0x34a625[_0x3636('0x23')]=_0x28d823['toLowerCase']()==='outbound'?_0x5dddf3[_0x3636('0x62')]:_0x5dddf3[_0x3636('0x63')];_0x34a625[_0x3636('0x64')]=_0x28d823===_0x3636('0x65')||_0x28d823===_0x3636('0x66')?_0x3636('0x65'):'outbound';var _0x35a606=util[_0x3636('0x57')](_0x3636('0x67'),_0xd5b67a[_0x3636('0x5e')],_0x5dddf3['uniqueid'],md5(_0x5dddf3[_0x3636('0x68')]));if(_0x247e1e&&_0x247e1e[_0x3636('0x69')]){logger['info'](_0x3636('0x6a'),_0x3636('0x6b'));_0x5dddf3[_0x3636('0x6c')]=_0x35a606;}else if(_0x20c8db&&_0x20c8db[_0x3636('0x6d')]&&_0x20c8db[_0x3636('0x6d')]!==_0x3636('0x6e')){logger[_0x3636('0x11')](_0x3636('0x6f'),_0x3636('0x6b'));_0x5dddf3[_0x3636('0x6c')]=_0x35a606;}else{_0x5dddf3['recordingURL']='';}return getAdminUser(_0x28d823,_0x3bb093,_0x34a625,_0x2a231d,_0x2271f7,_0x47e1b7)[_0x3636('0xc')](getUser(_0x28d823,_0x3bb093,_0x2a231d,_0x2271f7,_0x47e1b7))[_0x3636('0xc')](getEndUser(_0x28d823,_0x3bb093,_0x2a231d,_0x2271f7,_0x47e1b7))[_0x3636('0xc')](getTicket(_0x28d823,_0x3bb093,_0x2a231d,_0x2e1ab2,_0x5dddf3,_0x2271f7))[_0x3636('0xc')](function(_0xfb9082){logger['info'](util[_0x3636('0x57')](_0x3636('0x70'),_0xfb9082[_0x3636('0x44')]));logger[_0x3636('0x11')](util[_0x3636('0x57')](_0x3636('0x71'),_0x28d823));if(_0x28d823!=='unmanaged'){logger['info']('['+[_0x28d823[_0x3636('0x14')]()]+']',_0x3636('0x72'));emit(_0xd5b67a[_0x3636('0x5c')],_0x561c87[_0x3636('0x3b')],_0xfb9082[_0x3636('0x44')]);}})[_0x3636('0x12')](function(_0x230eb1){logger[_0x3636('0x13')]('['+[_0x28d823[_0x3636('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x230eb1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x691e=['toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','toString','includes','idField','content','customVariable','Variable','name','incident','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','info'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x691e,0xc9));var _0xe691=function(_0x57bb51,_0x5b2d77){_0x57bb51=_0x57bb51-0x0;var _0x3f854a=_0x691e[_0x57bb51];return _0x3f854a;};'use strict';var _=require(_0xe691('0x0'));var Promise=require(_0xe691('0x1'));var rp=require('request-promise');var util=require(_0xe691('0x2'));var md5=require(_0xe691('0x3'));var Redis=require(_0xe691('0x4'));var intUtil=require('./util');var config=require(_0xe691('0x5'));var logger=require('../../../../config/logger')(_0xe691('0x6'));config[_0xe691('0x7')]=_[_0xe691('0x8')](config[_0xe691('0x7')],{'host':_0xe691('0x9'),'port':0x18eb});var io=require(_0xe691('0xa'))(new Redis(config[_0xe691('0x7')]));function getAdminUser(_0x289c8c,_0xde5e99,_0x1a4b16,_0x2007b4,_0x339f29,_0x5a8dd8){return new Promise(function(_0x53abed,_0x5e348d){var _0x21ee97={'method':_0xe691('0xb'),'uri':_0x2007b4+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x339f29+'&'+_0x5a8dd8,'auth':_0xde5e99,'json':!![]};return rp(_0x21ee97)[_0xe691('0xc')](function(_0x513291){if(_0x513291[_0xe691('0xd')][_0xe691('0xe')]>0x0){_0x1a4b16[_0xe691('0xf')]=_0x513291['result'][0x0]['sys_id'];}logger[_0xe691('0x10')]('['+[_0x289c8c[_0xe691('0x11')]()]+_0xe691('0x12'),_0x1a4b16);_0x53abed(_0x1a4b16);})[_0xe691('0x13')](function(_0x560376){logger[_0xe691('0x14')]('['+[_0x289c8c[_0xe691('0x11')]()]+']',_0x560376['message']);_0x5e348d(_0x560376[_0xe691('0x15')]);});});}function getUser(_0x5ea90f,_0x2cd88a,_0x2e1d62,_0x49abe9,_0x5639d2){return function(_0x50eaae){logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x16'),_0x50eaae);return new Promise(function(_0x23baaa,_0xef0280){if(intUtil['validateEmail'](_0x50eaae[_0xe691('0x17')])){var _0x128356={'method':_0xe691('0xb'),'uri':_0x2e1d62+'sys_user?sysparm_query=email%3D'+_0x50eaae[_0xe691('0x17')]+'&'+_0x49abe9+'&'+_0x5639d2,'auth':_0x2cd88a,'json':!![]};logger['info']('['+[_0x5ea90f['toUpperCase']()]+_0xe691('0x18'),_0x128356);return rp(_0x128356)[_0xe691('0xc')](function(_0x462182){logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x19'),_0x462182);if(_0x462182[_0xe691('0xd')]['length']>0x0&&String(_0x462182['result'][0x0]['active'])===_0xe691('0x1a')){_0x50eaae['userId']=_0x462182[_0xe691('0xd')][0x0][_0xe691('0x1b')];}else{_0x50eaae[_0xe691('0x1c')]=_0x50eaae[_0xe691('0xf')];_0x50eaae[_0xe691('0x17')]=_0x50eaae[_0xe691('0x1d')];}logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x1e'),_0x50eaae);_0x23baaa(_0x50eaae);})[_0xe691('0x13')](function(_0x1c5d75){logger[_0xe691('0x14')]('['+[_0x5ea90f[_0xe691('0x11')]()]+']',_0x1c5d75['message']);_0xef0280(_0x1c5d75[_0xe691('0x15')]);});}else{logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x1f'));_0x50eaae[_0xe691('0x1c')]=_0x50eaae[_0xe691('0xf')];_0x50eaae[_0xe691('0x17')]=_0x50eaae[_0xe691('0x1d')];_0x23baaa(_0x50eaae);}});};}function createEndUser(_0x2f4b7c,_0x59395d,_0x276be7,_0x3a0429,_0x4db704){logger[_0xe691('0x10')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+_0xe691('0x20'),_0x276be7);return new Promise(function(_0x35ecbf,_0xd6f647){var _0x5de330={'method':_0xe691('0x21'),'uri':_0x3a0429+_0xe691('0x22')+_0x4db704,'body':{'user_name':_0x276be7[_0xe691('0x23')],'roles':_0xe691('0x24'),'first_name':_0x276be7[_0xe691('0x23')],'active':_0xe691('0x1a'),'date_format':_0xe691('0x25'),'phone':_0x276be7[_0xe691('0x23')]},'auth':_0x59395d,'json':!![]};return rp(_0x5de330)['then'](function(_0x22aabf){logger[_0xe691('0x10')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+'],\x20EndUser\x20schema',_0x22aabf[_0xe691('0xd')]);_0x276be7[_0xe691('0x26')]=_0x22aabf[_0xe691('0xd')][_0xe691('0x1b')];_0x35ecbf(_0x276be7);})[_0xe691('0x13')](function(_0x1d15ff){logger[_0xe691('0x14')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+']',_0x1d15ff[_0xe691('0x15')]);_0xd6f647(_0x1d15ff['message']);});});}function getEndUser(_0x34f4dd,_0x3a1e20,_0x3062eb,_0x30a70d,_0x55622e){return function(_0x1ddfa3){logger[_0xe691('0x10')]('['+[_0x34f4dd['toUpperCase']()]+_0xe691('0x27'),_0x1ddfa3);return new Promise(function(_0x15ec58,_0x124b83){var _0x3c76a3={'method':_0xe691('0xb'),'uri':_0x3062eb+_0xe691('0x28')+_0x1ddfa3[_0xe691('0x23')]+'&'+_0x30a70d+'&'+_0x55622e,'auth':_0x3a1e20,'json':!![]};return rp(_0x3c76a3)['then'](function(_0x535a3b){if(_0x535a3b['result'][_0xe691('0xe')]>0x0){_0x1ddfa3[_0xe691('0x26')]=_0x535a3b[_0xe691('0xd')][0x0][_0xe691('0x1b')];logger[_0xe691('0x10')]('['+[_0x34f4dd[_0xe691('0x11')]()]+_0xe691('0x29'),_0x1ddfa3);_0x15ec58(_0x1ddfa3);}else{return createEndUser(_0x34f4dd,_0x3a1e20,_0x1ddfa3,_0x3062eb,_0x30a70d)[_0xe691('0xc')](function(_0x5157a0){logger['info']('['+[_0x34f4dd[_0xe691('0x11')]()]+_0xe691('0x2a'),_0x5157a0);_0x15ec58(_0x5157a0);});}})[_0xe691('0x13')](function(_0x5cf486){logger[_0xe691('0x14')]('['+[_0x34f4dd[_0xe691('0x11')]()]+']',_0x5cf486['message']);_0x124b83(_0x5cf486[_0xe691('0x15')]);});});};}function getCustomFields(_0x3ba5e8,_0xc1fda9){var _0x50fb24={};if(_0x3ba5e8[_0xe691('0xe')]>0x0){_['forEach'](_0x3ba5e8,function(_0x24d139){if(_['includes']([_0xe691('0x2b'),_0xe691('0x2c')],_0x24d139[_0xe691('0x2d')])&&_0x24d139[_0xe691('0x2e')]&&!_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x2e')][_0xe691('0x30')]()]=_0x24d139['content'][_0xe691('0x31')]();}else if(_[_0xe691('0x32')]([_0xe691('0x2b'),_0xe691('0x2c')],_0x24d139['type'])&&_0x24d139[_0xe691('0x33')]&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0x24d139[_0xe691('0x34')][_0xe691('0x31')]();}else if(_0x24d139['type']==='variable'&&_0x24d139['variableName']&&_0x24d139[_0xe691('0x33')]&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0xc1fda9[_0x24d139['variableName']][_0xe691('0x31')]();}else if(_0x24d139[_0xe691('0x2d')]===_0xe691('0x35')&&_0x24d139[_0xe691('0x36')]&&_0x24d139[_0xe691('0x36')]['name']&&_0x24d139['idField']&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0xc1fda9[_0x24d139[_0xe691('0x36')][_0xe691('0x37')][_0xe691('0x30')]()][_0xe691('0x31')]();}});}return _0x50fb24;}function getTicket(_0x35c375,_0x5afb3f,_0x2b8a6f,_0x1af9b7,_0xe8bb35,_0x35b2de){return function(_0x56f117){logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x56f117);return new Promise(function(_0x13d11f,_0x5b863a){var _0x5c100b=_0x35c375[_0xe691('0x30')]()==='outbound'?_0x56f117[_0xe691('0x1c')]:_0x56f117[_0xe691('0x26')];var _0x32496c={'method':_0xe691('0x21'),'uri':_0x2b8a6f+_0xe691('0x38')+'?'+_0x35b2de,'body':Object['assign']({},{'active':_0xe691('0x1a'),'caller_id':_0x5c100b,'assigned_to':_0x56f117[_0xe691('0x1c')],'short_description':intUtil['getString'](_0x1af9b7[_0xe691('0x39')],_0xe8bb35,'\x20'),'description':intUtil['getString'](_0x1af9b7[_0xe691('0x3a')],_0xe8bb35,'\x0a')},getCustomFields(_0x1af9b7[_0xe691('0x3b')],_0xe8bb35)),'auth':_0x5afb3f,'json':!![]};return rp(_0x32496c)[_0xe691('0xc')](function(_0x40037f){logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+_0xe691('0x3c'),_0x40037f['result']);_0x56f117['ticketId']=_0x40037f['result'][_0xe691('0x1b')];_0x56f117['ticketNumber']=_0x40037f[_0xe691('0xd')][_0xe691('0x3d')];logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+_0xe691('0x3e'),_0x56f117);_0x13d11f(_0x56f117);})[_0xe691('0x13')](function(_0x9b118d){logger['error']('['+[_0x35c375[_0xe691('0x11')]()]+']',_0x9b118d[_0xe691('0x15')]);_0x5b863a(_0x9b118d[_0xe691('0x15')]);});});};}function createRemoteTag(_0x4b95aa,_0xf05c9b,_0x4fd57e,_0x18d375){return new Promise(function(_0x1a849b,_0x2d5df4){var _0x101efa={'method':_0xe691('0x21'),'uri':_0x4fd57e+_0xe691('0x3f')+'?'+_0x18d375,'body':{'short_description':_0x4b95aa,'global':!![],'active':!![],'name':_0x4b95aa},'auth':_0xf05c9b,'json':!![]};return rp(_0x101efa)[_0xe691('0xc')](function(_0x2ea3d5){var _0x2805da=_0x2ea3d5[_0xe691('0xd')][_0xe691('0x1b')];_0x1a849b(_0x2805da);});});}function getRemoteTag(_0x3f7e27,_0x570cd6,_0x11a7e3,_0x28a3d,_0x3a0b62){return new Promise(function(_0x269286,_0x2ff898){var _0x1c5af9={'method':'GET','uri':_0x11a7e3+_0xe691('0x3f')+_0xe691('0x40')+_0x3f7e27+'&'+_0x28a3d,'auth':_0x570cd6,'json':!![]};return rp(_0x1c5af9)[_0xe691('0xc')](function(_0x28cf43){if(_0x28cf43['result']['length']>0x0){var _0xae4589=_0x28cf43[_0xe691('0xd')][0x0][_0xe691('0x1b')];_0x269286(_0xae4589);}else{return createRemoteTag(_0x3f7e27,_0x570cd6,_0x11a7e3,_0x28a3d)['then'](function(_0x4da146){_0x269286(_0x4da146);});}});});}function assignTagToIncident(_0x4b636c,_0x374298,_0xb84c6a,_0x4bf8fc,_0x2aad43){return new Promise(function(_0x4b8686,_0xd0259a){var _0x3950af={'method':_0xe691('0x21'),'uri':_0xb84c6a+'label_entry'+'?'+_0x2aad43,'body':{'label':_0x4b636c,'table':_0xe691('0x38'),'id_type':_0xe691('0x41'),'table_key':_0x4bf8fc['ticketId'],'title':_0xe691('0x42')+_0x4bf8fc[_0xe691('0x43')],'id_display':_0x4bf8fc[_0xe691('0x43')]},'auth':_0x374298,'json':!![]};return rp(_0x3950af)[_0xe691('0xc')](function(_0x1c1148){_0x4b8686();})[_0xe691('0x13')](function(){_0x4b8686();});});}function manageTags(_0x1c1966,_0x1f7345,_0x4b6899,_0x2baada,_0xe2dd63,_0x294fb3,_0x271faf){return new Promise(function(_0x246e5e,_0x4c4758){var _0x16f08f=[];_0x1f7345[_0xe691('0x44')](function(_0xf58d5a){_0x16f08f[_0xe691('0x45')](getRemoteTag(_0xf58d5a,_0x4b6899,_0x2baada,_0x294fb3,_0x271faf));});return Promise[_0xe691('0x46')](_0x16f08f)['then'](function(_0x947de6){if(_0x947de6[_0xe691('0xe')]){logger[_0xe691('0x10')]('['+[_0x1c1966[_0xe691('0x11')]()]+_0xe691('0x47'),_0x947de6);var _0x2f4973=[];_0x947de6['forEach'](function(_0x50431e){_0x2f4973[_0xe691('0x45')](assignTagToIncident(_0x50431e,_0x4b6899,_0x2baada,_0xe2dd63,_0x294fb3));});return Promise['all'](_0x2f4973)['then'](function(){_0x246e5e();})[_0xe691('0x13')](function(){_0x246e5e();});}else{_0x246e5e();}});});}function getTags(_0x226169,_0x486952,_0x4ca4f1,_0x4f5e72,_0x2ce758,_0x2fd9fc){return function(_0x1655b2){return new Promise(function(_0x27d726,_0x18854d){var _0x57ca1a=[];var _0x37bf85=_0x4f5e72[_0xe691('0x48')];if(_0x37bf85&&_0x37bf85[_0xe691('0xe')]>0x0){_0x57ca1a=_[_0xe691('0x49')](_0x37bf85,_0xe691('0x37'));}if(_0x57ca1a[_0xe691('0xe')]>0x0){return manageTags(_0x226169,_0x57ca1a,_0x486952,_0x4ca4f1,_0x1655b2,_0x2ce758,_0x2fd9fc)[_0xe691('0xc')](function(){_0x27d726(_0x1655b2);});}else{_0x27d726(_0x1655b2);}});};}function emit(_0xe89284,_0x3edda1,_0x32ea7a){var _0x74e41f='%26sysparm_record_target%3Dincident'+_0xe691('0x4a')+_0xe691('0x4b')+_0xe691('0x4c');var _0x38fd02={'uri':_0xe89284+_0xe691('0x4d')+_0x32ea7a+_0x74e41f};io['to'](util[_0xe691('0x4e')](_0xe691('0x4f'),_0x3edda1))[_0xe691('0x50')](_0xe691('0x51'),_0x38fd02);}exports['cs']=function(_0x2465ae,_0x39ded0,_0x563c69,_0x2b4c6f,_0x1fc47a,_0x588a82,_0x3fbd38,_0x4afc5c){var _0x420901={};var _0x4b0d60={'user':_0x588a82['username'],'pass':_0x588a82['password']};var _0x1f08db='sysparm_limit=1';var _0x4d9af2=_0xe691('0x52');_0x588a82[_0xe691('0x53')]=intUtil[_0xe691('0x54')](_0x588a82[_0xe691('0x53')]);_0x588a82[_0xe691('0x55')]=intUtil[_0xe691('0x54')](_0x588a82[_0xe691('0x55')]);var _0xd60390=util[_0xe691('0x4e')](_0xe691('0x56'),_0x588a82[_0xe691('0x53')]);_0x420901['userEmail']=!_[_0xe691('0x57')](_0x2b4c6f)?_0x2b4c6f[_0xe691('0x58')]:null;_0x420901[_0xe691('0x1d')]=_0x588a82[_0xe691('0x58')];_0x420901['endUserNumber']=_0x4afc5c[_0xe691('0x30')]()===_0xe691('0x59')?_0x39ded0[_0xe691('0x5a')]:_0x39ded0[_0xe691('0x5b')];_0x420901[_0xe691('0x5c')]=_0x4afc5c==='queue'||_0x4afc5c===_0xe691('0x5d')?_0xe691('0x5e'):_0xe691('0x59');var _0x22f18b=util[_0xe691('0x4e')](_0xe691('0x5f'),_0x588a82['serverUrl'],_0x39ded0['uniqueid'],md5(_0x39ded0[_0xe691('0x60')]));if(_0x1fc47a&&_0x1fc47a[_0xe691('0x61')]){logger[_0xe691('0x10')](_0xe691('0x62'),_0xe691('0x63'));_0x39ded0[_0xe691('0x64')]=_0x22f18b;}else if(_0x3fbd38&&_0x3fbd38[_0xe691('0x65')]&&_0x3fbd38[_0xe691('0x65')]!==_0xe691('0x66')){logger[_0xe691('0x10')](_0xe691('0x67'),'Recording\x20is\x20enabled!');_0x39ded0[_0xe691('0x64')]=_0x22f18b;}else{_0x39ded0[_0xe691('0x64')]='';}return getAdminUser(_0x4afc5c,_0x4b0d60,_0x420901,_0xd60390,_0x4d9af2,_0x1f08db)[_0xe691('0xc')](getUser(_0x4afc5c,_0x4b0d60,_0xd60390,_0x4d9af2,_0x1f08db))[_0xe691('0xc')](getEndUser(_0x4afc5c,_0x4b0d60,_0xd60390,_0x4d9af2,_0x1f08db))['then'](getTicket(_0x4afc5c,_0x4b0d60,_0xd60390,_0x563c69,_0x39ded0,_0x4d9af2))[_0xe691('0xc')](function(_0x4cde33){logger['info'](util[_0xe691('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4cde33['ticketId']));logger['info'](util[_0xe691('0x4e')](_0xe691('0x68'),_0x4afc5c));if(_0x4afc5c!==_0xe691('0x5d')){logger[_0xe691('0x10')]('['+[_0x4afc5c[_0xe691('0x11')]()]+']',_0xe691('0x69'));emit(_0x588a82[_0xe691('0x53')],_0x2b4c6f[_0xe691('0x37')],_0x4cde33[_0xe691('0x6a')]);}})[_0xe691('0x13')](function(_0x43c39a){logger[_0xe691('0x14')]('['+[_0x4afc5c[_0xe691('0x11')]()]+_0xe691('0x6b'),util[_0xe691('0x6c')](_0x43c39a,{'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 7134599..dc27205 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 _0x2cf9=['customField','toLowerCase','custom_fields','content','variable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','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:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','users','lodash','request-promise','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','stringify','isNil','info','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField'];(function(_0x48be2d,_0x53c7a2){var _0x427905=function(_0x5d32cc){while(--_0x5d32cc){_0x48be2d['push'](_0x48be2d['shift']());}};_0x427905(++_0x53c7a2);}(_0x2cf9,0x1a3));var _0x92cf=function(_0x4babf1,_0x2ba28f){_0x4babf1=_0x4babf1-0x0;var _0x4922e9=_0x2cf9[_0x4babf1];return _0x4922e9;};'use strict';var _=require(_0x92cf('0x0'));var rp=require(_0x92cf('0x1'));var BPromise=require(_0x92cf('0x2'));var md5=require(_0x92cf('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x92cf('0x4'));var config=require(_0x92cf('0x5'));var logger=require(_0x92cf('0x6'))('sugarcrm');config[_0x92cf('0x7')]=_['defaults'](config[_0x92cf('0x7')],{'host':_0x92cf('0x8'),'port':0x18eb});var io=require(_0x92cf('0x9'))(new Redis(config[_0x92cf('0x7')]));var def={'method':_0x92cf('0xa'),'json':!![]};function emit(_0x559825,_0x413f45,_0x214b02){io['to'](_0x559825)[_0x92cf('0xb')](_0x413f45,_0x214b02);}function getTicket(_0x2a1157,_0x5ecea6,_0x3f9c0a,_0x51a81d,_0x119756,_0x22adae,_0x24d8f8,_0x2c6018){logger['info'](_0x92cf('0xc'));var _0x19ccc9=new Date();var _0x587097=[{'name':_0x92cf('0xd'),'value':intUtil[_0x92cf('0xe')](_0x51a81d[_0x92cf('0xf')],_0x119756,'\x20')},{'name':_0x92cf('0x10'),'value':_0x5ecea6['id']},{'name':'created_by','value':_0x5ecea6['id']},{'name':_0x92cf('0x11'),'value':intUtil[_0x92cf('0xe')](_0x51a81d[_0x92cf('0x12')],_0x119756,'\x0a')},{'name':_0x92cf('0x13'),'value':_0x19ccc9[_0x92cf('0x14')]()[_0x92cf('0x15')](0x0,0x13)[_0x92cf('0x16')]('T','\x20')},{'name':_0x92cf('0x17'),'value':'0'},{'name':_0x92cf('0x18'),'value':'15'},{'name':'parent_id','value':_0x3f9c0a['id']},{'name':_0x92cf('0x19'),'value':_0x92cf('0x1a')},{'name':_0x92cf('0x1b'),'value':_0x3f9c0a[_0x92cf('0xd')]},{'name':_0x92cf('0x1c'),'value':_0x2c6018}];if(_0x22adae[_0x92cf('0x1d')]){_[_0x92cf('0x1e')](_0x22adae,function(_0x47d95a){if(_0x119756[_0x47d95a[_0x92cf('0x1f')]]){_0x587097[_0x92cf('0x20')]({'name':_0x47d95a[_0x92cf('0x21')],'value':_0x119756[_0x47d95a[_0x92cf('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x24d8f8['id'],'module_name':_0x92cf('0x22'),'name_value_list':_0x587097})}});}function getAuth(_0x325d9f){return util['format'](_0x92cf('0x23'),new Buffer(_0x325d9f[_0x92cf('0x24')]+':X')[_0x92cf('0x25')](_0x92cf('0x26')));}function getServerInfo(_0x8f951f){return request({'form':{'method':_0x92cf('0x27'),'input_type':_0x92cf('0x28'),'response_type':_0x92cf('0x28'),'rest_data':JSON[_0x92cf('0x29')]({'session':_0x8f951f['id']})}});}function getUser(_0x34377f,_0x84453a,_0x15ed0e){if(!_[_0x92cf('0x2a')](_0x84453a)){logger[_0x92cf('0x2b')]('Getting\x20agent\x20with\x20name',_0x84453a);return request({'form':{'method':'get_entry_list','input_type':_0x92cf('0x28'),'response_type':'JSON','rest_data':JSON[_0x92cf('0x29')]({'session':_0x15ed0e['id'],'module_name':'Employees','query':util[_0x92cf('0x2c')](_0x92cf('0x2d'),_0x84453a),'order_by':'','offset':'0','select_fields':['id',_0x92cf('0xd'),_0x92cf('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2bdfe9){if(_0x2bdfe9[_0x92cf('0x2f')][_0x92cf('0x1d')]){var _0x5be29c=_[_0x92cf('0x30')](_0x2bdfe9['entry_list'],function(_0x478494){return _0x478494[_0x92cf('0x31')][_0x92cf('0x2e')][_0x92cf('0x32')]===_0x84453a;});if(_0x5be29c){logger[_0x92cf('0x2b')](_0x92cf('0x33'));return BPromise[_0x92cf('0x34')]({'id':_0x5be29c['name_value_list']['id'][_0x92cf('0x32')],'name':_0x5be29c[_0x92cf('0x31')][_0x92cf('0xd')][_0x92cf('0x32')]});}}logger[_0x92cf('0x2b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x92cf('0x34')]({'id':_0x15ed0e['name_value_list'][_0x92cf('0x35')]['value'],'name':_0x15ed0e[_0x92cf('0x31')][_0x92cf('0x2e')]['value']});});}else{logger[_0x92cf('0x2b')](_0x92cf('0x36'));return BPromise[_0x92cf('0x34')]({'id':_0x15ed0e[_0x92cf('0x31')][_0x92cf('0x35')][_0x92cf('0x32')],'name':_0x15ed0e['name_value_list']['user_name'][_0x92cf('0x32')]});}}function getEndUser(_0x1bf785,_0x9c1bfb,_0x18eeab,_0x1fe546){logger['info'](_0x92cf('0x37'),_0x18eeab);return request({'form':{'method':_0x92cf('0x38'),'input_type':_0x92cf('0x28'),'response_type':_0x92cf('0x28'),'rest_data':JSON[_0x92cf('0x29')]({'session':_0x1fe546['id'],'module_name':_0x92cf('0x1a'),'query':util['format'](_0x92cf('0x39'),_0x18eeab),'order_by':'','offset':'0','select_fields':['id','name',_0x92cf('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f0265){if(_0x2f0265['entry_list'][_0x92cf('0x1d')]){var _0x1a8c15=_[_0x92cf('0x30')](_0x2f0265[_0x92cf('0x2f')],function(_0xbd1720){return _0xbd1720[_0x92cf('0x31')]['phone_home'][_0x92cf('0x32')]===_0x18eeab;});if(_0x1a8c15){logger[_0x92cf('0x2b')](_0x92cf('0x3b'));return BPromise[_0x92cf('0x34')]({'id':_0x1a8c15[_0x92cf('0x31')]['id'][_0x92cf('0x32')],'name':_0x1a8c15[_0x92cf('0x31')][_0x92cf('0xd')][_0x92cf('0x32')],'phone':_0x1a8c15[_0x92cf('0x31')][_0x92cf('0x3a')][_0x92cf('0x32')]});}}else{logger['info'](_0x92cf('0x3c'));return request({'form':{'method':_0x92cf('0x3d'),'input_type':_0x92cf('0x28'),'response_type':'JSON','rest_data':JSON[_0x92cf('0x29')]({'session':_0x1fe546['id'],'module_name':_0x92cf('0x1a'),'name_value_list':[{'name':_0x92cf('0x3e'),'value':_0x9c1bfb!==_0x92cf('0x3f')?_0x9c1bfb:util[_0x92cf('0x2c')](_0x92cf('0x40'),_0x18eeab)},{'name':_0x92cf('0x3a'),'value':_0x18eeab}]})}})[_0x92cf('0x41')](function(_0x5bba4a){logger['info'](_0x92cf('0x42'));return BPromise[_0x92cf('0x34')]({'id':_0x5bba4a['id'],'name':_0x5bba4a[_0x92cf('0x2f')]['first_name'][_0x92cf('0x32')],'phone':_0x5bba4a[_0x92cf('0x2f')][_0x92cf('0x3a')][_0x92cf('0x32')]});});}});}function request(_0x201312){logger[_0x92cf('0x43')](_0x92cf('0x44'),JSON[_0x92cf('0x29')](_0x201312));return rp(_['merge'](def,_0x201312));}function getTags(_0x4f92ef,_0xf1ddce){var _0x538bfe=[];if(_0x4f92ef&&_0x4f92ef[_0x92cf('0x1d')]>0x0){_0x538bfe=_[_0x92cf('0x45')](_0x4f92ef,_0xf1ddce);}return _0x538bfe;}function getCustomFields(_0x372d3c,_0x7f811){var _0x2a7bb6=[];var _0x452eeb={'custom_fields':[]};if(_0x372d3c['length']>0x0){_['forEach'](_0x372d3c,function(_0x4c3135){if(_0x4c3135[_0x92cf('0x46')]===_0x92cf('0x47')&&_0x4c3135[_0x92cf('0x48')]&&!_0x4c3135[_0x92cf('0x49')]){_0x452eeb[_0x4c3135[_0x92cf('0x48')][_0x92cf('0x4a')]()]=_0x4c3135['content']['toString']();}else if(_0x4c3135[_0x92cf('0x46')]===_0x92cf('0x47')&&_0x4c3135['idField']&&_0x4c3135['customField']){_0x452eeb[_0x92cf('0x4b')][_0x92cf('0x20')]({'id':_0x4c3135[_0x92cf('0x21')],'value':_0x4c3135[_0x92cf('0x4c')]['toString']()});}else if(_0x4c3135[_0x92cf('0x46')]===_0x92cf('0x4d')&&_0x4c3135[_0x92cf('0x1f')]&&_0x4c3135['idField']&&_0x4c3135[_0x92cf('0x49')]){_0x7f811[_0x4c3135[_0x92cf('0x1f')]]&&_0x452eeb[_0x92cf('0x4b')][_0x92cf('0x20')]({'id':_0x4c3135[_0x92cf('0x21')],'value':_0x7f811[_0x4c3135[_0x92cf('0x1f')]][_0x92cf('0x25')]()});}else if(_0x4c3135[_0x92cf('0x46')]==='customVariable'&&_0x4c3135[_0x92cf('0x4e')]&&_0x4c3135['Variable'][_0x92cf('0xd')]&&_0x4c3135[_0x92cf('0x21')]&&_0x4c3135[_0x92cf('0x49')]){_0x7f811[_0x4c3135[_0x92cf('0x4e')][_0x92cf('0xd')][_0x92cf('0x4a')]()]&&_0x452eeb[_0x92cf('0x4b')][_0x92cf('0x20')]({'id':_0x4c3135[_0x92cf('0x21')],'value':_0x7f811[_0x4c3135[_0x92cf('0x4e')][_0x92cf('0xd')][_0x92cf('0x4a')]()]['toString']()});}});}return _0x452eeb;}function getConnection(_0x5cce0b){return request({'method':_0x92cf('0xa'),'form':{'method':'login','input_type':_0x92cf('0x28'),'response_type':'JSON','rest_data':JSON[_0x92cf('0x29')]({'user_auth':{'user_name':_0x5cce0b[_0x92cf('0x4f')],'password':_0x5cce0b[_0x92cf('0x50')],'encryption':_0x92cf('0x51')},'application':_0x92cf('0x52')})}})['then'](function(_0x11ce6c){var _0x2ca378=_0x11ce6c;if(_0x2ca378['id']){def['sessionID']=_0x2ca378['id'];return BPromise[_0x92cf('0x34')](_0x2ca378);}else{throw new Error(util[_0x92cf('0x2c')](_0x92cf('0x53'),_0x5cce0b['id']));}});}function setRelationship(_0x2defff,_0xca5f33,_0x5430bd,_0x3a7b22){return request({'form':{'method':_0x92cf('0x54'),'input_type':_0x92cf('0x28'),'response_type':_0x92cf('0x28'),'rest_data':JSON['stringify']({'session':_0x2defff['id'],'module_name':_0x92cf('0x22'),'module_id':_0x5430bd['id'],'link_field_name':_0x3a7b22,'related_ids':[_0xca5f33['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x70b42c,_0x4eefc5,_0x25602b,_0xcfcb8e,_0x321c2a,_0x1da483){var _0x2d62c1,_0x397f42,_0xe12060,_0x2c6df7;_0x1da483[_0x92cf('0x55')]=intUtil['stripTrailingSlash'](_0x1da483['remoteUri']);_0x1da483['serverUrl']=intUtil[_0x92cf('0x56')](_0x1da483[_0x92cf('0x57')]);def[_0x92cf('0x58')]=util[_0x92cf('0x2c')](_0x92cf('0x59'),_0x1da483[_0x92cf('0x55')]);if(_0x321c2a&&_0x321c2a[_0x92cf('0x5a')]){logger[_0x92cf('0x2b')](_0x92cf('0x5b'),_0x92cf('0x5c'));_0x4eefc5[_0x92cf('0x5d')]=util['format'](_0x92cf('0x5e'),_0x1da483[_0x92cf('0x57')],_0x4eefc5[_0x92cf('0x5f')],md5(_0x4eefc5[_0x92cf('0x5f')]));}else{_0x4eefc5[_0x92cf('0x5d')]='';}return getConnection(_0x1da483)['then'](function(_0x1d4df8){_0x2c6df7=_0x1d4df8;return getUser(_0x1da483,_0xcfcb8e[_0x92cf('0xd')],_0x2c6df7);})['then'](function(_0x3f8ff7){_0x2d62c1=_0x3f8ff7;logger[_0x92cf('0x2b')](_0x92cf('0x60'),_0x2d62c1['id']);return getEndUser(_0x1da483,_0x4eefc5[_0x92cf('0x61')],_0x4eefc5[_0x92cf('0x62')],_0x2c6df7);})['then'](function(_0x3b33e6){_0x397f42=_0x3b33e6;logger[_0x92cf('0x2b')](_0x92cf('0x63'),_0x397f42['id']);return getTicket(_0x1da483,_0x2d62c1,_0x397f42,_0x25602b,_0x4eefc5,_0x25602b[_0x92cf('0x64')],_0x2c6df7,_0x92cf('0x65'));})[_0x92cf('0x41')](function(_0x597cac){_0xe12060=_0x597cac;logger[_0x92cf('0x2b')](_0x92cf('0x66'));logger['info'](_0x92cf('0x67'),_0xe12060['id']);return setRelationship(_0x2c6df7,_0x2d62c1,_0xe12060,'users');})[_0x92cf('0x41')](function(){return setRelationship(_0x2c6df7,_0x397f42,_0xe12060,'contacts');})['then'](function(){return getServerInfo(_0x2c6df7);})[_0x92cf('0x41')](function(_0x2b9bb4){var _0x1f5dd1=parseInt(_0x2b9bb4[_0x92cf('0x68')][_0x92cf('0x69')](0x0));var _0x4b70fa=util[_0x92cf('0x2c')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1da483[_0x92cf('0x55')],_0xe12060['id']);if(_0x1f5dd1>0x6){_0x4b70fa=util[_0x92cf('0x2c')](_0x92cf('0x6a'),_0x1da483[_0x92cf('0x55')],_0xe12060['id']);}logger[_0x92cf('0x2b')](_0x92cf('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x92cf('0x2c')](_0x92cf('0x6b'),_0xcfcb8e[_0x92cf('0xd')]),'trigger:browser:url',{'uri':_0x4b70fa});})['catch'](function(_0x5265a5){logger[_0x92cf('0x6c')](_0x92cf('0x5b'),JSON[_0x92cf('0x29')](_0x5265a5));});};exports[_0x92cf('0x6d')]=function(_0x2ac9ba,_0x2d91bf,_0x2b50b4,_0x51a49e,_0x15707b,_0x493aeb,_0x49f324){var _0x5d0af0,_0x3fb6c5,_0x4af76a,_0x1d5b09;_0x493aeb[_0x92cf('0x55')]=intUtil[_0x92cf('0x56')](_0x493aeb[_0x92cf('0x55')]);_0x493aeb[_0x92cf('0x57')]=intUtil[_0x92cf('0x56')](_0x493aeb['serverUrl']);def[_0x92cf('0x58')]=util[_0x92cf('0x2c')](_0x92cf('0x59'),_0x493aeb[_0x92cf('0x55')]);if(_0x49f324&&_0x49f324[_0x92cf('0x6e')]&&_0x49f324[_0x92cf('0x6e')]!==_0x92cf('0x6f')){logger[_0x92cf('0x2b')](_0x92cf('0x70'),_0x92cf('0x5c'));_0x2d91bf['recordingURL']=util[_0x92cf('0x2c')](_0x92cf('0x5e'),_0x493aeb['serverUrl'],_0x2d91bf[_0x92cf('0x5f')],md5(_0x2d91bf[_0x92cf('0x5f')]));}return getConnection(_0x493aeb)['then'](function(_0xa2e50d){_0x1d5b09=_0xa2e50d;return getUser(_0x493aeb,_0x51a49e[_0x92cf('0xd')],_0x1d5b09);})[_0x92cf('0x41')](function(_0x47f095){_0x5d0af0=_0x47f095;logger[_0x92cf('0x2b')](_0x92cf('0x60'),_0x5d0af0['id']);return getEndUser(_0x493aeb,_0x2d91bf[_0x92cf('0x71')],_0x2d91bf['destcalleridnum'],_0x1d5b09);})['then'](function(_0x3eb4bc){_0x3fb6c5=_0x3eb4bc;logger[_0x92cf('0x2b')]('The\x20Enduser\x20ID\x20is:',_0x3fb6c5['id']);return getTicket(_0x493aeb,_0x5d0af0,_0x3fb6c5,_0x2b50b4,_0x2d91bf,_0x2b50b4['Fields'],_0x1d5b09,_0x92cf('0x72'));})[_0x92cf('0x41')](function(_0x193ae5){_0x4af76a=_0x193ae5;logger['info'](_0x92cf('0x66'));logger[_0x92cf('0x2b')]('The\x20Ticket\x20ID\x20is:',_0x4af76a['id']);return setRelationship(_0x1d5b09,_0x5d0af0,_0x4af76a,'users');})[_0x92cf('0x41')](function(){return setRelationship(_0x1d5b09,_0x3fb6c5,_0x4af76a,_0x92cf('0x73'));})[_0x92cf('0x41')](function(){return getServerInfo(_0x1d5b09);})[_0x92cf('0x41')](function(_0x2ddebf){var _0x356ad1=parseInt(_0x2ddebf['version'][_0x92cf('0x69')](0x0));var _0x5f07fb=util[_0x92cf('0x2c')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x493aeb[_0x92cf('0x55')],_0x4af76a['id']);if(_0x356ad1>0x6){_0x5f07fb=util[_0x92cf('0x2c')](_0x92cf('0x6a'),_0x493aeb[_0x92cf('0x55')],_0x4af76a['id']);}logger[_0x92cf('0x2b')]('[OUTBOUND]',_0x92cf('0x74'));emit(util['format'](_0x92cf('0x6b'),_0x51a49e['name']),_0x92cf('0x75'),{'uri':_0x5f07fb});})[_0x92cf('0x76')](function(_0x1bb567){logger[_0x92cf('0x6c')](_0x92cf('0x70'),JSON[_0x92cf('0x29')](_0x1bb567));});};exports[_0x92cf('0x77')]=function(_0x4137c9,_0x4b8bd8,_0x322b71,_0x2545fe,_0x14aa71,_0x2979e2){var _0x4f283b,_0xe01eaf,_0x39e830,_0x561d4e;_0x2979e2['remoteUri']=intUtil[_0x92cf('0x56')](_0x2979e2[_0x92cf('0x55')]);_0x2979e2[_0x92cf('0x57')]=intUtil[_0x92cf('0x56')](_0x2979e2[_0x92cf('0x57')]);def[_0x92cf('0x58')]=util[_0x92cf('0x2c')]('%s/service/v4_1/rest.php',_0x2979e2['remoteUri']);if(_0x14aa71&&_0x14aa71[_0x92cf('0x5a')]){logger[_0x92cf('0x2b')]('['+_0x4b8bd8[_0x92cf('0x78')][_0x92cf('0x79')]()+']',_0x92cf('0x5c'));_0x4b8bd8[_0x92cf('0x5d')]=util[_0x92cf('0x2c')](_0x92cf('0x5e'),_0x2979e2[_0x92cf('0x57')],_0x4b8bd8[_0x92cf('0x5f')],md5(_0x4b8bd8[_0x92cf('0x5f')]));}else{_0x4b8bd8[_0x92cf('0x5d')]='';}return getConnection(_0x2979e2)['then'](function(_0x3003c9){_0x561d4e=_0x3003c9;if(!_['isNil'](_0x2545fe)){return getUser(_0x2979e2,_0x2545fe[_0x92cf('0xd')],_0x561d4e);}else{return getUser(_0x2979e2,null,_0x561d4e);}})['then'](function(_0x24ac6c){_0x4f283b=_0x24ac6c;logger[_0x92cf('0x2b')](_0x92cf('0x60'),_0x4f283b['id']);return getEndUser(_0x2979e2,_0x4b8bd8[_0x92cf('0x61')],_0x4b8bd8[_0x92cf('0x62')],_0x561d4e);})[_0x92cf('0x41')](function(_0x109ba5){_0xe01eaf=_0x109ba5;logger[_0x92cf('0x2b')]('The\x20Enduser\x20ID\x20is:',_0xe01eaf['id']);return getTicket(_0x2979e2,_0x4f283b,_0xe01eaf,_0x322b71,_0x4b8bd8,_0x322b71['Fields'],_0x561d4e,_0x92cf('0x65'));})[_0x92cf('0x41')](function(_0x57ed76){_0x39e830=_0x57ed76;logger[_0x92cf('0x2b')]('Ticket\x20created!');logger[_0x92cf('0x2b')](_0x92cf('0x67'),_0x39e830['id']);return setRelationship(_0x561d4e,_0x4f283b,_0x39e830,_0x92cf('0x7a'));})[_0x92cf('0x41')](function(){return setRelationship(_0x561d4e,_0xe01eaf,_0x39e830,_0x92cf('0x73'));})['then'](function(){return getServerInfo(_0x561d4e);})[_0x92cf('0x76')](function(_0x157a12){logger[_0x92cf('0x6c')]('['+_0x4b8bd8[_0x92cf('0x78')][_0x92cf('0x79')]()+']',JSON[_0x92cf('0x29')](_0x157a12));});}; \ No newline at end of file +var _0x3bb3=['recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','error','unmanaged','lastevent','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','assigned_user_id','description','getString','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch'];(function(_0x1e5755,_0x5e0d48){var _0x38975b=function(_0x1ec4a2){while(--_0x1ec4a2){_0x1e5755['push'](_0x1e5755['shift']());}};_0x38975b(++_0x5e0d48);}(_0x3bb3,0x106));var _0x33bb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3bb3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x33bb('0x0'));var rp=require(_0x33bb('0x1'));var BPromise=require(_0x33bb('0x2'));var md5=require(_0x33bb('0x3'));var util=require(_0x33bb('0x4'));var Redis=require(_0x33bb('0x5'));var intUtil=require(_0x33bb('0x6'));var config=require(_0x33bb('0x7'));var logger=require(_0x33bb('0x8'))(_0x33bb('0x9'));config[_0x33bb('0xa')]=_[_0x33bb('0xb')](config[_0x33bb('0xa')],{'host':_0x33bb('0xc'),'port':0x18eb});var io=require(_0x33bb('0xd'))(new Redis(config[_0x33bb('0xa')]));var def={'method':_0x33bb('0xe'),'json':!![]};function emit(_0x59c3da,_0x4eabc6,_0x3536a7){io['to'](_0x59c3da)[_0x33bb('0xf')](_0x4eabc6,_0x3536a7);}function getTicket(_0x4986c4,_0x5838e4,_0x47726a,_0x3988ed,_0x19fea7,_0x1d66a3,_0x1b490b,_0x4894f4){logger[_0x33bb('0x10')]('Creating\x20new\x20ticket...');var _0x253847=new Date();var _0x5d0bf4=[{'name':_0x33bb('0x11'),'value':intUtil['getString'](_0x3988ed['Subjects'],_0x19fea7,'\x20')},{'name':_0x33bb('0x12'),'value':_0x5838e4['id']},{'name':'created_by','value':_0x5838e4['id']},{'name':_0x33bb('0x13'),'value':intUtil[_0x33bb('0x14')](_0x3988ed[_0x33bb('0x15')],_0x19fea7,'\x0a')},{'name':_0x33bb('0x16'),'value':_0x253847[_0x33bb('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x33bb('0x18'),'value':'0'},{'name':_0x33bb('0x19'),'value':'15'},{'name':_0x33bb('0x1a'),'value':_0x47726a['id']},{'name':_0x33bb('0x1b'),'value':_0x33bb('0x1c')},{'name':_0x33bb('0x1d'),'value':_0x47726a[_0x33bb('0x11')]},{'name':_0x33bb('0x1e'),'value':_0x4894f4}];if(_0x1d66a3[_0x33bb('0x1f')]){_[_0x33bb('0x20')](_0x1d66a3,function(_0xc51b88){if(_0x19fea7[_0xc51b88['variableName']]){_0x5d0bf4[_0x33bb('0x21')]({'name':_0xc51b88[_0x33bb('0x22')],'value':_0x19fea7[_0xc51b88[_0x33bb('0x23')]]});}});}return request({'form':{'method':_0x33bb('0x24'),'input_type':'JSON','response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x1b490b['id'],'module_name':_0x33bb('0x27'),'name_value_list':_0x5d0bf4})}});}function getAuth(_0xbbdc1e){return util['format'](_0x33bb('0x28'),new Buffer(_0xbbdc1e[_0x33bb('0x29')]+':X')[_0x33bb('0x2a')](_0x33bb('0x2b')));}function getServerInfo(_0x104751){return request({'form':{'method':_0x33bb('0x2c'),'input_type':'JSON','response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x104751['id']})}});}function getUser(_0x29f989,_0x96ad7c,_0x133941){if(!_[_0x33bb('0x2d')](_0x96ad7c)){logger[_0x33bb('0x10')](_0x33bb('0x2e'),_0x96ad7c);return request({'form':{'method':_0x33bb('0x2f'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x133941['id'],'module_name':'Employees','query':util[_0x33bb('0x30')](_0x33bb('0x31'),_0x96ad7c),'order_by':'','offset':'0','select_fields':['id','name',_0x33bb('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x33bb('0x33')](function(_0x4a96e9){if(_0x4a96e9[_0x33bb('0x34')][_0x33bb('0x1f')]){var _0x4888aa=_[_0x33bb('0x35')](_0x4a96e9[_0x33bb('0x34')],function(_0x1ee59a){return _0x1ee59a['name_value_list'][_0x33bb('0x32')][_0x33bb('0x36')]===_0x96ad7c;});if(_0x4888aa){logger[_0x33bb('0x10')](_0x33bb('0x37'));return BPromise[_0x33bb('0x38')]({'id':_0x4888aa['name_value_list']['id'][_0x33bb('0x36')],'name':_0x4888aa[_0x33bb('0x39')][_0x33bb('0x11')]['value']});}}logger[_0x33bb('0x10')](_0x33bb('0x3a'));return BPromise[_0x33bb('0x38')]({'id':_0x133941['name_value_list'][_0x33bb('0x3b')][_0x33bb('0x36')],'name':_0x133941[_0x33bb('0x39')][_0x33bb('0x32')][_0x33bb('0x36')]});});}else{logger[_0x33bb('0x10')](_0x33bb('0x3c'));return BPromise['resolve']({'id':_0x133941[_0x33bb('0x39')]['user_id'][_0x33bb('0x36')],'name':_0x133941[_0x33bb('0x39')][_0x33bb('0x32')][_0x33bb('0x36')]});}}function getEndUser(_0x2f8890,_0x1beb4c,_0x419870,_0x40981b){logger[_0x33bb('0x10')](_0x33bb('0x3d'),_0x419870);return request({'form':{'method':_0x33bb('0x2f'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x40981b['id'],'module_name':'Contacts','query':util[_0x33bb('0x30')](_0x33bb('0x3e'),_0x419870),'order_by':'','offset':'0','select_fields':['id',_0x33bb('0x11'),_0x33bb('0x3f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x33bb('0x33')](function(_0x3c1316){if(_0x3c1316[_0x33bb('0x34')]['length']){var _0x4131c0=_[_0x33bb('0x35')](_0x3c1316[_0x33bb('0x34')],function(_0x2b2670){return _0x2b2670[_0x33bb('0x39')]['phone_home'][_0x33bb('0x36')]===_0x419870;});if(_0x4131c0){logger['info'](_0x33bb('0x40'));return BPromise[_0x33bb('0x38')]({'id':_0x4131c0[_0x33bb('0x39')]['id'][_0x33bb('0x36')],'name':_0x4131c0[_0x33bb('0x39')][_0x33bb('0x11')]['value'],'phone':_0x4131c0[_0x33bb('0x39')]['phone_home']['value']});}}else{logger['info'](_0x33bb('0x41'));return request({'form':{'method':_0x33bb('0x24'),'input_type':_0x33bb('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x40981b['id'],'module_name':_0x33bb('0x1c'),'name_value_list':[{'name':'first_name','value':_0x1beb4c!==''?_0x1beb4c:util['format'](_0x33bb('0x42'),_0x419870)},{'name':'phone_home','value':_0x419870}]})}})[_0x33bb('0x33')](function(_0x117a78){logger[_0x33bb('0x10')]('Enduser\x20created.');return BPromise[_0x33bb('0x38')]({'id':_0x117a78['id'],'name':_0x117a78[_0x33bb('0x34')][_0x33bb('0x43')]['value'],'phone':_0x117a78[_0x33bb('0x34')][_0x33bb('0x3f')][_0x33bb('0x36')]});});}});}function request(_0xbafeeb){logger[_0x33bb('0x44')](_0x33bb('0x45'),JSON[_0x33bb('0x26')](_0xbafeeb));return rp(_[_0x33bb('0x46')](def,_0xbafeeb));}function getTags(_0x29fbfd,_0x1f65fb){var _0x2a2bd8=[];if(_0x29fbfd&&_0x29fbfd['length']>0x0){_0x2a2bd8=_['map'](_0x29fbfd,_0x1f65fb);}return _0x2a2bd8;}function getCustomFields(_0x168a8a,_0x424629){var _0x5e3b95=[];var _0x30dfee={'custom_fields':[]};if(_0x168a8a[_0x33bb('0x1f')]>0x0){_[_0x33bb('0x20')](_0x168a8a,function(_0x20c97){if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x48')&&_0x20c97[_0x33bb('0x49')]&&!_0x20c97[_0x33bb('0x4a')]){_0x30dfee[_0x20c97['nameField'][_0x33bb('0x4b')]()]=_0x20c97[_0x33bb('0x4c')][_0x33bb('0x2a')]();}else if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x48')&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97[_0x33bb('0x22')],'value':_0x20c97[_0x33bb('0x4c')][_0x33bb('0x2a')]()});}else if(_0x20c97[_0x33bb('0x47')]==='variable'&&_0x20c97[_0x33bb('0x23')]&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x424629[_0x20c97[_0x33bb('0x23')]]&&_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97['idField'],'value':_0x424629[_0x20c97[_0x33bb('0x23')]]['toString']()});}else if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x4e')&&_0x20c97['Variable']&&_0x20c97['Variable']['name']&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x424629[_0x20c97[_0x33bb('0x4f')][_0x33bb('0x11')][_0x33bb('0x4b')]()]&&_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97[_0x33bb('0x22')],'value':_0x424629[_0x20c97['Variable']['name'][_0x33bb('0x4b')]()]['toString']()});}});}return _0x30dfee;}function getConnection(_0xcd917f){return request({'method':'POST','form':{'method':_0x33bb('0x50'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'user_auth':{'user_name':_0xcd917f[_0x33bb('0x51')],'password':_0xcd917f['password'],'encryption':_0x33bb('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x33bb('0x33')](function(_0x27bcb5){var _0x100d90=_0x27bcb5;if(_0x100d90['id']){def[_0x33bb('0x53')]=_0x100d90['id'];return BPromise[_0x33bb('0x38')](_0x100d90);}else{throw new Error(util[_0x33bb('0x30')](_0x33bb('0x54'),_0xcd917f['id']));}});}function setRelationship(_0x1eaada,_0x474700,_0xc6017e,_0x414af1){return request({'form':{'method':_0x33bb('0x55'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x1eaada['id'],'module_name':'Calls','module_id':_0xc6017e['id'],'link_field_name':_0x414af1,'related_ids':[_0x474700['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x33bb('0x56')]=function(_0x17006d,_0x2dded5,_0x573e49,_0x44ce9a,_0x5c217e,_0x46608c){var _0x38c5f1,_0x4a8df6,_0x568ce8,_0x247b24;_0x46608c['remoteUri']=intUtil[_0x33bb('0x57')](_0x46608c['remoteUri']);_0x46608c[_0x33bb('0x58')]=intUtil[_0x33bb('0x57')](_0x46608c[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util['format'](_0x33bb('0x5a'),_0x46608c[_0x33bb('0x5b')]);if(_0x5c217e&&_0x5c217e[_0x33bb('0x5c')]){logger[_0x33bb('0x10')]('[QUEUE]',_0x33bb('0x5d'));_0x2dded5[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x46608c[_0x33bb('0x58')],_0x2dded5[_0x33bb('0x60')],md5(_0x2dded5['uniqueid']));}else{_0x2dded5[_0x33bb('0x5e')]='';}return getConnection(_0x46608c)[_0x33bb('0x33')](function(_0x9e07b8){_0x247b24=_0x9e07b8;return getUser(_0x46608c,_0x44ce9a[_0x33bb('0x11')],_0x247b24);})[_0x33bb('0x33')](function(_0x5aa9fd){_0x38c5f1=_0x5aa9fd;logger[_0x33bb('0x10')](_0x33bb('0x61'),_0x38c5f1['id']);return getEndUser(_0x46608c,_0x2dded5[_0x33bb('0x62')],_0x2dded5[_0x33bb('0x63')],_0x247b24);})[_0x33bb('0x33')](function(_0x1a033b){_0x4a8df6=_0x1a033b;logger[_0x33bb('0x10')](_0x33bb('0x64'),_0x4a8df6['id']);return getTicket(_0x46608c,_0x38c5f1,_0x4a8df6,_0x573e49,_0x2dded5,_0x573e49[_0x33bb('0x65')],_0x247b24,'Inbound');})['then'](function(_0x5115b8){_0x568ce8=_0x5115b8;logger['info'](_0x33bb('0x66'));logger[_0x33bb('0x10')](_0x33bb('0x67'),_0x568ce8['id']);return setRelationship(_0x247b24,_0x38c5f1,_0x568ce8,'users');})[_0x33bb('0x33')](function(){return setRelationship(_0x247b24,_0x4a8df6,_0x568ce8,_0x33bb('0x68'));})[_0x33bb('0x33')](function(){return getServerInfo(_0x247b24);})[_0x33bb('0x33')](function(_0x4b5f9a){var _0x5c3927=parseInt(_0x4b5f9a[_0x33bb('0x69')][_0x33bb('0x6a')](0x0));var _0x2b4b38=util[_0x33bb('0x30')](_0x33bb('0x6b'),_0x46608c[_0x33bb('0x5b')],_0x568ce8['id']);if(_0x5c3927>0x6){_0x2b4b38=util[_0x33bb('0x30')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x46608c['remoteUri'],_0x568ce8['id']);}logger[_0x33bb('0x10')](_0x33bb('0x6c'),_0x33bb('0x6d'));emit(util['format'](_0x33bb('0x6e'),_0x44ce9a[_0x33bb('0x11')]),_0x33bb('0x6f'),{'uri':_0x2b4b38});})[_0x33bb('0x70')](function(_0x20f907){logger['error']('[QUEUE]',JSON[_0x33bb('0x26')](_0x20f907));});};exports['outbound']=function(_0x551f87,_0x34b1d6,_0x2d3df5,_0x1bcd2f,_0x2f18e4,_0x174211,_0x347dc6){var _0x4bc558,_0x57b755,_0xc7dbe3,_0x2f5aa4;_0x174211[_0x33bb('0x5b')]=intUtil['stripTrailingSlash'](_0x174211[_0x33bb('0x5b')]);_0x174211[_0x33bb('0x58')]=intUtil[_0x33bb('0x57')](_0x174211[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util[_0x33bb('0x30')](_0x33bb('0x5a'),_0x174211[_0x33bb('0x5b')]);if(_0x347dc6&&_0x347dc6[_0x33bb('0x71')]&&_0x347dc6[_0x33bb('0x71')]!=='none'){logger['info'](_0x33bb('0x72'),_0x33bb('0x5d'));_0x34b1d6[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x174211[_0x33bb('0x58')],_0x34b1d6[_0x33bb('0x60')],md5(_0x34b1d6[_0x33bb('0x60')]));}return getConnection(_0x174211)[_0x33bb('0x33')](function(_0x3e7ade){_0x2f5aa4=_0x3e7ade;return getUser(_0x174211,_0x1bcd2f[_0x33bb('0x11')],_0x2f5aa4);})[_0x33bb('0x33')](function(_0x272a80){_0x4bc558=_0x272a80;logger[_0x33bb('0x10')]('The\x20User\x20ID\x20is:',_0x4bc558['id']);return getEndUser(_0x174211,_0x34b1d6[_0x33bb('0x73')],_0x34b1d6[_0x33bb('0x74')],_0x2f5aa4);})[_0x33bb('0x33')](function(_0x5e569a){_0x57b755=_0x5e569a;logger[_0x33bb('0x10')]('The\x20Enduser\x20ID\x20is:',_0x57b755['id']);return getTicket(_0x174211,_0x4bc558,_0x57b755,_0x2d3df5,_0x34b1d6,_0x2d3df5[_0x33bb('0x65')],_0x2f5aa4,_0x33bb('0x75'));})['then'](function(_0x556fed){_0xc7dbe3=_0x556fed;logger[_0x33bb('0x10')]('Ticket\x20created!');logger[_0x33bb('0x10')](_0x33bb('0x67'),_0xc7dbe3['id']);return setRelationship(_0x2f5aa4,_0x4bc558,_0xc7dbe3,_0x33bb('0x76'));})[_0x33bb('0x33')](function(){return setRelationship(_0x2f5aa4,_0x57b755,_0xc7dbe3,_0x33bb('0x68'));})[_0x33bb('0x33')](function(){return getServerInfo(_0x2f5aa4);})[_0x33bb('0x33')](function(_0x2edc6f){var _0x18725a=parseInt(_0x2edc6f[_0x33bb('0x69')][_0x33bb('0x6a')](0x0));var _0x4c4a18=util['format'](_0x33bb('0x6b'),_0x174211[_0x33bb('0x5b')],_0xc7dbe3['id']);if(_0x18725a>0x6){_0x4c4a18=util[_0x33bb('0x30')](_0x33bb('0x77'),_0x174211[_0x33bb('0x5b')],_0xc7dbe3['id']);}logger[_0x33bb('0x10')](_0x33bb('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x33bb('0x30')](_0x33bb('0x6e'),_0x1bcd2f[_0x33bb('0x11')]),_0x33bb('0x6f'),{'uri':_0x4c4a18});})[_0x33bb('0x70')](function(_0x2a8307){logger[_0x33bb('0x78')](_0x33bb('0x72'),JSON[_0x33bb('0x26')](_0x2a8307));});};exports[_0x33bb('0x79')]=function(_0x4fb05a,_0x12d996,_0x2ce144,_0xa4ffd7,_0x29b255,_0x5bec07){var _0x4c86f6,_0x3bdcca,_0x38a013,_0x405ac7;_0x5bec07[_0x33bb('0x5b')]=intUtil[_0x33bb('0x57')](_0x5bec07[_0x33bb('0x5b')]);_0x5bec07['serverUrl']=intUtil['stripTrailingSlash'](_0x5bec07[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util['format'](_0x33bb('0x5a'),_0x5bec07[_0x33bb('0x5b')]);if(_0x29b255&&_0x29b255['monitor_format']){logger[_0x33bb('0x10')]('['+_0x12d996[_0x33bb('0x7a')]['toUpperCase']()+']',_0x33bb('0x5d'));_0x12d996[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x5bec07[_0x33bb('0x58')],_0x12d996[_0x33bb('0x60')],md5(_0x12d996[_0x33bb('0x60')]));}else{_0x12d996[_0x33bb('0x5e')]='';}return getConnection(_0x5bec07)[_0x33bb('0x33')](function(_0x5b7d88){_0x405ac7=_0x5b7d88;if(!_[_0x33bb('0x2d')](_0xa4ffd7)){return getUser(_0x5bec07,_0xa4ffd7[_0x33bb('0x11')],_0x405ac7);}else{return getUser(_0x5bec07,null,_0x405ac7);}})[_0x33bb('0x33')](function(_0x2e03a6){_0x4c86f6=_0x2e03a6;logger['info'](_0x33bb('0x61'),_0x4c86f6['id']);return getEndUser(_0x5bec07,_0x12d996[_0x33bb('0x62')],_0x12d996[_0x33bb('0x63')],_0x405ac7);})[_0x33bb('0x33')](function(_0x439b94){_0x3bdcca=_0x439b94;logger[_0x33bb('0x10')](_0x33bb('0x64'),_0x3bdcca['id']);return getTicket(_0x5bec07,_0x4c86f6,_0x3bdcca,_0x2ce144,_0x12d996,_0x2ce144['Fields'],_0x405ac7,_0x33bb('0x7b'));})[_0x33bb('0x33')](function(_0x5ac598){_0x38a013=_0x5ac598;logger[_0x33bb('0x10')](_0x33bb('0x66'));logger[_0x33bb('0x10')](_0x33bb('0x67'),_0x38a013['id']);return setRelationship(_0x405ac7,_0x4c86f6,_0x38a013,_0x33bb('0x76'));})[_0x33bb('0x33')](function(){return setRelationship(_0x405ac7,_0x3bdcca,_0x38a013,'contacts');})['then'](function(){return getServerInfo(_0x405ac7);})[_0x33bb('0x70')](function(_0x1d29d9){logger[_0x33bb('0x78')]('['+_0x12d996[_0x33bb('0x7a')][_0x33bb('0x7c')]()+']',JSON['stringify'](_0x1d29d9));});}; \ 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 00bc2ed..0830b3d 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 _0x2b91=['length','type','string','content','variable','variableName','toString','customVariable','Variable','name','push','keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','sortBy'];(function(_0x53fc29,_0x2c06e9){var _0x5cd0bd=function(_0x3619ca){while(--_0x3619ca){_0x53fc29['push'](_0x53fc29['shift']());}};_0x5cd0bd(++_0x2c06e9);}(_0x2b91,0xd5));var _0x12b9=function(_0x2e0fd1,_0x38f8e1){_0x2e0fd1=_0x2e0fd1-0x0;var _0x30be4a=_0x2b91[_0x2e0fd1];return _0x30be4a;};'use strict';var _=require(_0x12b9('0x0'));var util=require(_0x12b9('0x1'));exports['getString']=function(_0x2fde9d,_0x5013d5,_0x474dd3){var _0x4aac83=[];if(_0x2fde9d['length']>0x0){var _0x4856e5=_[_0x12b9('0x2')](_0x2fde9d,['id']);for(var _0x53eb19=0x0;_0x53eb19<_0x4856e5[_0x12b9('0x3')];_0x53eb19++){var _0x581c21=_0x4856e5[_0x53eb19];if(_0x581c21[_0x12b9('0x4')]===_0x12b9('0x5')){_0x4aac83['push'](_0x581c21[_0x12b9('0x6')]);}else if(_0x581c21[_0x12b9('0x4')]===_0x12b9('0x7')&&_0x581c21[_0x12b9('0x8')]){_0x5013d5[_0x581c21[_0x12b9('0x8')]]&&_0x4aac83['push'](_0x5013d5[_0x581c21[_0x12b9('0x8')]][_0x12b9('0x9')]());}else if(_0x581c21['type']===_0x12b9('0xa')&&_0x581c21[_0x12b9('0xb')]&&_0x581c21[_0x12b9('0xb')][_0x12b9('0xc')]){_0x5013d5[_0x581c21[_0x12b9('0xb')]['name']['toLowerCase']()]&&_0x4aac83[_0x12b9('0xd')](_0x5013d5[_0x581c21[_0x12b9('0xb')]['name']['toLowerCase']()][_0x12b9('0x9')]());}else if(_0x581c21[_0x12b9('0x4')]===_0x12b9('0xe')){if(_0x581c21[_0x12b9('0xf')]===_0x12b9('0x5')&&_0x581c21[_0x12b9('0x10')]){_0x4aac83[_0x12b9('0xd')](util[_0x12b9('0x11')](_0x12b9('0x12'),_0x581c21[_0x12b9('0x10')],_0x581c21[_0x12b9('0x13')]));}else if(_0x581c21[_0x12b9('0xf')]===_0x12b9('0x7')&&_0x581c21[_0x12b9('0x8')]&&_0x581c21[_0x12b9('0x10')]){_0x5013d5[_0x581c21[_0x12b9('0x8')]]&&_0x4aac83[_0x12b9('0xd')](util[_0x12b9('0x11')](_0x12b9('0x12'),_0x581c21[_0x12b9('0x10')],_0x5013d5[_0x581c21[_0x12b9('0x8')]]));}else if(_0x581c21[_0x12b9('0xf')]===_0x12b9('0xa')&&_0x581c21[_0x12b9('0xb')]&&_0x581c21[_0x12b9('0xb')][_0x12b9('0xc')]&&_0x581c21[_0x12b9('0x10')]){_0x5013d5[_0x581c21[_0x12b9('0xb')][_0x12b9('0xc')][_0x12b9('0x14')]()]&&_0x4aac83[_0x12b9('0xd')](util[_0x12b9('0x11')]('%s:\x20%s',_0x581c21[_0x12b9('0x10')],_0x5013d5[_0x581c21[_0x12b9('0xb')]['name']['toLowerCase']()]));}}}}return _0x4aac83[_0x12b9('0x15')](_0x474dd3);};exports[_0x12b9('0x16')]=function(_0x2dfbd3){var _0x816cc3=_0x2dfbd3[_0x12b9('0x17')](-0x1);if(_0x816cc3==='/'){_0x2dfbd3=_0x2dfbd3['substring'](0x0,_0x2dfbd3[_0x12b9('0x18')](_0x816cc3));}return _0x2dfbd3;};exports['validateEmail']=function(_0x1826b4){if(!_[_0x12b9('0x19')](_0x1826b4)&&_0x1826b4!==''){var _0x42fbfb=/^(([^<>()\[\]\\.,;:\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 _0x42fbfb[_0x12b9('0x1a')](String(_0x1826b4)[_0x12b9('0x14')]());}else{return![];}}; \ No newline at end of file +var _0xddf3=['slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash'];(function(_0x5a49f7,_0x1c2d52){var _0x47c894=function(_0xe1cb31){while(--_0xe1cb31){_0x5a49f7['push'](_0x5a49f7['shift']());}};_0x47c894(++_0x1c2d52);}(_0xddf3,0x10b));var _0x3ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3ddf('0x0'));exports[_0x3ddf('0x1')]=function(_0x585bbf,_0x5d8bd8,_0x1f0da2){var _0x10d281=[];if(_0x585bbf[_0x3ddf('0x2')]>0x0){var _0x631eb9=_[_0x3ddf('0x3')](_0x585bbf,['id']);for(var _0x78e6b7=0x0;_0x78e6b7<_0x631eb9[_0x3ddf('0x2')];_0x78e6b7++){var _0x3b0d87=_0x631eb9[_0x78e6b7];if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0x5')){_0x10d281[_0x3ddf('0x6')](_0x3b0d87[_0x3ddf('0x7')]);}else if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0x8')&&_0x3b0d87[_0x3ddf('0x9')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]&&_0x10d281[_0x3ddf('0x6')](_0x5d8bd8[_0x3b0d87['variableName']][_0x3ddf('0xa')]());}else if(_0x3b0d87[_0x3ddf('0x4')]==='customVariable'&&_0x3b0d87['Variable']&&_0x3b0d87['Variable'][_0x3ddf('0xb')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]&&_0x10d281[_0x3ddf('0x6')](_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()][_0x3ddf('0xa')]());}else if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0xe')){if(_0x3b0d87[_0x3ddf('0xf')]==='string'&&_0x3b0d87[_0x3ddf('0x10')]){_0x10d281[_0x3ddf('0x6')](util[_0x3ddf('0x11')](_0x3ddf('0x12'),_0x3b0d87['key'],_0x3b0d87[_0x3ddf('0x13')]));}else if(_0x3b0d87[_0x3ddf('0xf')]===_0x3ddf('0x8')&&_0x3b0d87[_0x3ddf('0x9')]&&_0x3b0d87['key']){_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]&&_0x10d281['push'](util[_0x3ddf('0x11')]('%s:\x20%s',_0x3b0d87[_0x3ddf('0x10')],_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]));}else if(_0x3b0d87[_0x3ddf('0xf')]===_0x3ddf('0x14')&&_0x3b0d87[_0x3ddf('0xc')]&&_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')]&&_0x3b0d87[_0x3ddf('0x10')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]&&_0x10d281[_0x3ddf('0x6')](util[_0x3ddf('0x11')](_0x3ddf('0x12'),_0x3b0d87['key'],_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]));}}}}return _0x10d281[_0x3ddf('0x15')](_0x1f0da2);};exports[_0x3ddf('0x16')]=function(_0x43cb3f){var _0x3c5fbd=_0x43cb3f[_0x3ddf('0x17')](-0x1);if(_0x3c5fbd==='/'){_0x43cb3f=_0x43cb3f[_0x3ddf('0x18')](0x0,_0x43cb3f[_0x3ddf('0x19')](_0x3c5fbd));}return _0x43cb3f;};exports[_0x3ddf('0x1a')]=function(_0x5511d1){if(!_[_0x3ddf('0x1b')](_0x5511d1)&&_0x5511d1!==''){var _0x7db6da=/^(([^<>()\[\]\\.,;:\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 _0x7db6da[_0x3ddf('0x1c')](String(_0x5511d1)[_0x3ddf('0xd')]());}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 54f0dac..f967a92 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x3180d6,_0x24fbc4){var _0x27d338=function(_0x5c3319){while(--_0x5c3319){_0x3180d6['push'](_0x3180d6['shift']());}};_0x27d338(++_0x24fbc4);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x5c2b85,_0x5a92c0){var _0x4462e8=function(_0x123ece){while(--_0x123ece){_0x5c2b85['push'](_0x5c2b85['shift']());}};_0x4462e8(++_0x5a92c0);}(_0x34e8,0x12c));var _0x834e=function(_0x543c8f,_0x24e161){_0x543c8f=_0x543c8f-0x0;var _0x5119c3=_0x34e8[_0x543c8f];return _0x5119c3;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index efa0a9b..df90071 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 _0x14d4=['validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','GET','map','includes','picklist','type','nameField','customField','content','string','idField','custom_fields','push','variable','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','%s/agent/tickets/%s','catch','unmanaged','toUpperCase','recordingURL','lastevent','lodash','request-promise','md5','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','format','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','Descriptions','getString','Fields','Ticket\x20created!','ticket'];(function(_0x1194ad,_0x435140){var _0x5f374d=function(_0x522ce7){while(--_0x522ce7){_0x1194ad['push'](_0x1194ad['shift']());}};_0x5f374d(++_0x435140);}(_0x14d4,0x199));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x414d('0x0'));var rp=require(_0x414d('0x1'));var md5=require(_0x414d('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x414d('0x3'))(_0x414d('0x4'));config[_0x414d('0x5')]=_[_0x414d('0x6')](config[_0x414d('0x5')],{'host':_0x414d('0x7'),'port':0x18eb});var io=require(_0x414d('0x8'))(new Redis(config[_0x414d('0x5')]));function emit(_0xb2d040,_0x2237db,_0x291c03){io['to'](_0xb2d040)[_0x414d('0x9')](_0x2237db,_0x291c03);}var headers={'Content-Type':_0x414d('0xa'),'Accept':_0x414d('0xa')};function getTicket(_0x520b23,_0xde2af1,_0x583e60,_0x1afef1,_0x258cc7){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x414d('0xb')](_0x414d('0xc'),_0x520b23[_0x414d('0xd')]),'method':_0x414d('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x583e60['id'],'submitter_id':_0xde2af1?_0xde2af1['id']:undefined,'assignee_id':_0xde2af1?_0xde2af1['id']:undefined,'tags':getTags(_0x1afef1[_0x414d('0xf')],_0x414d('0x10')),'subject':intUtil['getString'](_0x1afef1[_0x414d('0x11')],_0x258cc7,'\x20'),'description':intUtil['getString'](_0x1afef1[_0x414d('0x12')],_0x258cc7,'\x0a'),'comment':{'public':![],'body':intUtil[_0x414d('0x13')](_0x1afef1[_0x414d('0x12')],_0x258cc7,'\x0a')}},getCustomFields(_0x1afef1[_0x414d('0x14')],_0x258cc7))}})['then'](function(_0xa52436){logger['info'](_0x414d('0x15'));return _0xa52436[_0x414d('0x16')];});}function getUser(_0x38e8eb,_0x365e53){if(intUtil[_0x414d('0x17')](_0x365e53)){logger[_0x414d('0x18')](_0x414d('0x19'),_0x365e53);return request({'uri':util['format'](_0x414d('0x1a'),_0x38e8eb[_0x414d('0xd')]),'qs':{'query':util[_0x414d('0xb')](_0x414d('0x1b'),_0x365e53)}})[_0x414d('0x1c')](function(_0x3553d5){if(_0x3553d5[_0x414d('0x1d')]){logger['info'](_0x414d('0x1e'));return _[_0x414d('0x1f')](_0x3553d5['results'],{'email':_0x365e53,'role':_0x414d('0x20')});}else{logger[_0x414d('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x414d('0xb')](_0x414d('0x21'),_0x38e8eb[_0x414d('0xd')])})[_0x414d('0x1c')](function(_0x1f869b){logger['info'](_0x414d('0x22'));return _0x1f869b['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x414d('0x21'),_0x38e8eb[_0x414d('0xd')])})['then'](function(_0x6f0c72){logger[_0x414d('0x18')](_0x414d('0x22'));return _0x6f0c72[_0x414d('0x23')];});}}function getEndUser(_0x23ef9e,_0x22f7bf,_0x542890){logger[_0x414d('0x18')](_0x414d('0x24'),_0x542890);return request({'uri':util[_0x414d('0xb')](_0x414d('0x1a'),_0x23ef9e[_0x414d('0xd')]),'qs':{'query':util[_0x414d('0xb')](_0x414d('0x25'),_0x542890)}})[_0x414d('0x1c')](function(_0x3f3648){var _0x4b25e7;if(_0x3f3648[_0x414d('0x26')][_0x414d('0x27')]){_0x3f3648[_0x414d('0x26')]=_[_0x414d('0x28')](_0x3f3648[_0x414d('0x26')],{'suspended':![],'role':_0x414d('0x29')});if(_0x3f3648['results'][_0x414d('0x27')]){_0x4b25e7=_['first'](_0x3f3648[_0x414d('0x26')]);}}if(_0x4b25e7){logger[_0x414d('0x18')](_0x414d('0x2a'));return _0x4b25e7;}else{logger[_0x414d('0x18')](_0x414d('0x2b'));return request({'uri':util['format']('%s/users.json',_0x23ef9e[_0x414d('0xd')]),'method':_0x414d('0xe'),'body':{'user':{'role':_0x414d('0x29'),'name':util[_0x414d('0xb')](_0x414d('0x2c'),_0x22f7bf||_0x542890),'phone':_0x542890}}})[_0x414d('0x1c')](function(_0x5c3fe3){logger[_0x414d('0x18')]('Enduser\x20created.');return _0x5c3fe3['user'];});}});}function getAuth(_0x1331d0){var _0x312a5a;if(_0x1331d0[_0x414d('0x2d')]===_0x414d('0x2e')){_0x312a5a=util[_0x414d('0xb')](_0x414d('0x2f'),_0x1331d0[_0x414d('0x30')],_0x1331d0[_0x414d('0x2e')]);}else if(_0x1331d0[_0x414d('0x2d')]===_0x414d('0x31')){_0x312a5a=util[_0x414d('0xb')](_0x414d('0x32'),_0x1331d0[_0x414d('0x30')],_0x1331d0[_0x414d('0x31')]);}return util[_0x414d('0xb')]('Basic\x20%s',new Buffer(_0x312a5a)[_0x414d('0x33')]('base64'));}function request(_0x404988){logger[_0x414d('0x34')](_0x414d('0x35'),JSON['stringify'](_0x404988));return rp(_[_0x414d('0x6')](_0x404988,{'method':_0x414d('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x520775,_0xf6d3d5){var _0x302862=[];if(_0x520775&&_0x520775[_0x414d('0x27')]>0x0){_0x302862=_[_0x414d('0x37')](_0x520775,_0xf6d3d5);}return _0x302862;}function getCustomFields(_0x1a27d6,_0x160053){var _0x579b34=[];var _0x5c9844={'custom_fields':[]};if(_0x1a27d6[_0x414d('0x27')]>0x0){_['forEach'](_0x1a27d6,function(_0x5db323){if(_[_0x414d('0x38')](['string',_0x414d('0x39')],_0x5db323[_0x414d('0x3a')])&&_0x5db323[_0x414d('0x3b')]&&!_0x5db323[_0x414d('0x3c')]){_0x5c9844[_0x5db323[_0x414d('0x3b')]['toLowerCase']()]=_0x5db323[_0x414d('0x3d')]['toString']();}else if(_[_0x414d('0x38')]([_0x414d('0x3e'),_0x414d('0x39')],_0x5db323['type'])&&_0x5db323[_0x414d('0x3f')]&&_0x5db323[_0x414d('0x3c')]){_0x5c9844[_0x414d('0x40')][_0x414d('0x41')]({'id':_0x5db323[_0x414d('0x3f')],'value':_0x5db323['content'][_0x414d('0x33')]()});}else if(_0x5db323['type']===_0x414d('0x42')&&_0x5db323[_0x414d('0x43')]&&_0x5db323['idField']&&_0x5db323[_0x414d('0x3c')]){_0x160053[_0x5db323[_0x414d('0x43')]]&&_0x5c9844[_0x414d('0x40')]['push']({'id':_0x5db323[_0x414d('0x3f')],'value':_0x160053[_0x5db323[_0x414d('0x43')]][_0x414d('0x33')]()});}else if(_0x5db323[_0x414d('0x3a')]==='customVariable'&&_0x5db323[_0x414d('0x44')]&&_0x5db323[_0x414d('0x44')][_0x414d('0x10')]&&_0x5db323[_0x414d('0x3f')]&&_0x5db323[_0x414d('0x3c')]){_0x160053[_0x5db323[_0x414d('0x44')][_0x414d('0x10')]['toLowerCase']()]&&_0x5c9844['custom_fields'][_0x414d('0x41')]({'id':_0x5db323[_0x414d('0x3f')],'value':_0x160053[_0x5db323[_0x414d('0x44')][_0x414d('0x10')][_0x414d('0x45')]()]['toString']()});}});}return _0x5c9844;}exports['queue']=function(_0x129340,_0x23f043,_0x2dcaf1,_0x1f4e3d,_0xe71e22,_0x2eaa9b){var _0x29b22e,_0x3848cb;_0x2eaa9b[_0x414d('0xd')]=intUtil['stripTrailingSlash'](_0x2eaa9b[_0x414d('0xd')]);_0x2eaa9b['serverUrl']=intUtil[_0x414d('0x46')](_0x2eaa9b[_0x414d('0x47')]);if(_0xe71e22&&_0xe71e22[_0x414d('0x48')]){logger['info'](_0x414d('0x49'),_0x414d('0x4a'));_0x23f043['recordingURL']=util[_0x414d('0xb')](_0x414d('0x4b'),_0x2eaa9b[_0x414d('0x47')],_0x23f043[_0x414d('0x4c')],md5(_0x23f043[_0x414d('0x4c')]));}else{_0x23f043['recordingURL']='';}headers['Authorization']=getAuth(_0x2eaa9b);return getUser(_0x2eaa9b,_0x1f4e3d[_0x414d('0x4d')])[_0x414d('0x1c')](function(_0x317a3a){_0x29b22e=_0x317a3a;logger[_0x414d('0x18')](_0x414d('0x4e'),_0x29b22e['id']);return getEndUser(_0x2eaa9b,_0x23f043[_0x414d('0x4f')],_0x23f043[_0x414d('0x50')]);})['then'](function(_0x23570e){_0x3848cb=_0x23570e;logger['info'](_0x414d('0x51'),_0x3848cb['id']);return getTicket(_0x2eaa9b,_0x29b22e,_0x3848cb,_0x2dcaf1,_0x23f043);})[_0x414d('0x1c')](function(_0x776e86){if(_0x776e86){logger[_0x414d('0x18')](_0x414d('0x52'),_0x776e86['id']);switch(_0x2eaa9b[_0x414d('0x3a')]){case _0x414d('0x53'):logger['info'](_0x414d('0x49'),_0x414d('0x54'));return request({'uri':util[_0x414d('0xb')](_0x414d('0x55'),_0x2eaa9b[_0x414d('0xd')],_0x29b22e['id'],_0x776e86['id']),'method':_0x414d('0xe')});case _0x414d('0x56'):logger[_0x414d('0x18')]('[QUEUE]',_0x414d('0x57'));emit(util[_0x414d('0xb')](_0x414d('0x58'),_0x1f4e3d[_0x414d('0x10')]),_0x414d('0x59'),{'uri':util['format']('%s/agent/tickets/%s',_0x2eaa9b[_0x414d('0xd')][_0x414d('0x5a')](_0x414d('0x5b'),''),_0x776e86['id'])});break;default:logger['error'](_0x414d('0x49'),_0x414d('0x5c'));}}})['catch'](function(_0x2d2098){logger[_0x414d('0x5d')](_0x414d('0x5e'),util[_0x414d('0x5f')](_0x2d2098,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x21f675,_0x58ac60,_0x4b2b8e,_0x282cd6,_0x23c59b,_0x23c91b,_0x43af67){var _0x19b5fb,_0x5a0723;_0x23c91b['remoteUri']=intUtil[_0x414d('0x46')](_0x23c91b[_0x414d('0xd')]);_0x23c91b[_0x414d('0x47')]=intUtil[_0x414d('0x46')](_0x23c91b[_0x414d('0x47')]);if(_0x43af67&&_0x43af67[_0x414d('0x60')]&&_0x43af67['recordingFormat']!==_0x414d('0x61')){logger[_0x414d('0x18')](_0x414d('0x62'),_0x414d('0x4a'));_0x58ac60['recordingURL']=util[_0x414d('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23c91b[_0x414d('0x47')],_0x58ac60[_0x414d('0x4c')],md5(_0x58ac60[_0x414d('0x4c')]));}headers[_0x414d('0x63')]=getAuth(_0x23c91b);return getUser(_0x23c91b,_0x282cd6[_0x414d('0x4d')])[_0x414d('0x1c')](function(_0x29aa17){_0x19b5fb=_0x29aa17;logger[_0x414d('0x18')]('The\x20User\x20ID\x20is:',_0x19b5fb['id']);return getEndUser(_0x23c91b,_0x58ac60[_0x414d('0x64')],_0x58ac60[_0x414d('0x65')]);})[_0x414d('0x1c')](function(_0x5bf50b){_0x5a0723=_0x5bf50b;logger['info'](_0x414d('0x51'),_0x5a0723['id']);return getTicket(_0x23c91b,_0x19b5fb,_0x5a0723,_0x4b2b8e,_0x58ac60);})[_0x414d('0x1c')](function(_0x15c17d){if(_0x15c17d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x15c17d['id']);switch(_0x23c91b[_0x414d('0x3a')]){case'integrationTab':logger[_0x414d('0x18')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x414d('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x23c91b[_0x414d('0xd')],_0x19b5fb['id'],_0x15c17d['id']),'method':_0x414d('0xe')});case'newTab':logger[_0x414d('0x18')](_0x414d('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x414d('0xb')](_0x414d('0x58'),_0x282cd6[_0x414d('0x10')]),_0x414d('0x59'),{'uri':util[_0x414d('0xb')](_0x414d('0x66'),_0x23c91b[_0x414d('0xd')]['replace'](_0x414d('0x5b'),''),_0x15c17d['id'])});break;default:logger[_0x414d('0x5d')](_0x414d('0x62'),_0x414d('0x5c'));}}})[_0x414d('0x67')](function(_0x50e9da){logger[_0x414d('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x50e9da,{'showHidden':!![],'depth':null}));});};exports[_0x414d('0x68')]=function(_0x51e660,_0x45f0b1,_0x352616,_0x4198f9,_0x1e4c32,_0x5f1cf8){var _0x2d2f2a,_0x49810f;_0x5f1cf8['remoteUri']=intUtil[_0x414d('0x46')](_0x5f1cf8['remoteUri']);_0x5f1cf8[_0x414d('0x47')]=intUtil['stripTrailingSlash'](_0x5f1cf8[_0x414d('0x47')]);if(_0x1e4c32&&_0x1e4c32[_0x414d('0x48')]){logger[_0x414d('0x18')]('['+_0x45f0b1['lastevent'][_0x414d('0x69')]()+']',_0x414d('0x4a'));_0x45f0b1[_0x414d('0x6a')]=util[_0x414d('0xb')](_0x414d('0x4b'),_0x5f1cf8['serverUrl'],_0x45f0b1[_0x414d('0x4c')],md5(_0x45f0b1['uniqueid']));}else{_0x45f0b1[_0x414d('0x6a')]='';}headers[_0x414d('0x63')]=getAuth(_0x5f1cf8);return getUser(_0x5f1cf8)['then'](function(_0x4940bf){_0x2d2f2a=_0x4940bf;logger[_0x414d('0x18')]('The\x20User\x20ID\x20is:',_0x2d2f2a['id']);return getEndUser(_0x5f1cf8,_0x45f0b1[_0x414d('0x4f')],_0x45f0b1[_0x414d('0x50')]);})['then'](function(_0x461d85){_0x49810f=_0x461d85;logger[_0x414d('0x18')]('The\x20Enduser\x20ID\x20is:',_0x49810f['id']);return getTicket(_0x5f1cf8,_0x2d2f2a,_0x49810f,_0x352616,_0x45f0b1);})[_0x414d('0x1c')](function(_0x4eff94){if(_0x4eff94){logger[_0x414d('0x18')]('The\x20Ticket\x20ID\x20is:',_0x4eff94['id']);}})['catch'](function(_0x241636){logger['error']('['+_0x45f0b1[_0x414d('0x6b')][_0x414d('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x414d('0x5f')](_0x241636,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfb9b=['uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','end-user','first','%s/users.json','POST','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','picklist','type','content','string','customField','custom_fields','push','variable','variableName','idField','Variable','toLowerCase','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','serverUrl'];(function(_0x480a6,_0x2638c){var _0x521404=function(_0x2f373c){while(--_0x2f373c){_0x480a6['push'](_0x480a6['shift']());}};_0x521404(++_0x2638c);}(_0xfb9b,0x168));var _0xbfb9=function(_0x42cc2c,_0x5b0ab0){_0x42cc2c=_0x42cc2c-0x0;var _0x4a0275=_0xfb9b[_0x42cc2c];return _0x4a0275;};'use strict';var _=require('lodash');var rp=require(_0xbfb9('0x0'));var md5=require(_0xbfb9('0x1'));var util=require(_0xbfb9('0x2'));var Redis=require(_0xbfb9('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xbfb9('0x4'))(_0xbfb9('0x5'));config[_0xbfb9('0x6')]=_[_0xbfb9('0x7')](config[_0xbfb9('0x6')],{'host':_0xbfb9('0x8'),'port':0x18eb});var io=require(_0xbfb9('0x9'))(new Redis(config[_0xbfb9('0x6')]));function emit(_0x9ffcd2,_0x5e6d85,_0x56880f){io['to'](_0x9ffcd2)[_0xbfb9('0xa')](_0x5e6d85,_0x56880f);}var headers={'Content-Type':'application/json','Accept':_0xbfb9('0xb')};function getTicket(_0x499867,_0x1413c3,_0x53e75c,_0x5465dc,_0x4f23ca){logger['info'](_0xbfb9('0xc'));return request({'uri':util['format'](_0xbfb9('0xd'),_0x499867[_0xbfb9('0xe')]),'method':'POST','body':{'ticket':_[_0xbfb9('0xf')]({'requester_id':_0x53e75c['id'],'submitter_id':_0x1413c3?_0x1413c3['id']:undefined,'assignee_id':_0x1413c3?_0x1413c3['id']:undefined,'tags':getTags(_0x5465dc[_0xbfb9('0x10')],_0xbfb9('0x11')),'subject':intUtil[_0xbfb9('0x12')](_0x5465dc[_0xbfb9('0x13')],_0x4f23ca,'\x20'),'description':intUtil['getString'](_0x5465dc[_0xbfb9('0x14')],_0x4f23ca,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5465dc['Descriptions'],_0x4f23ca,'\x0a')}},getCustomFields(_0x5465dc['Fields'],_0x4f23ca))}})[_0xbfb9('0x15')](function(_0x1e09d0){logger[_0xbfb9('0x16')]('Ticket\x20created!');return _0x1e09d0[_0xbfb9('0x17')];});}function getUser(_0x1deea8,_0x248b61){if(intUtil[_0xbfb9('0x18')](_0x248b61)){logger['info'](_0xbfb9('0x19'),_0x248b61);return request({'uri':util['format'](_0xbfb9('0x1a'),_0x1deea8['remoteUri']),'qs':{'query':util[_0xbfb9('0x1b')](_0xbfb9('0x1c'),_0x248b61)}})[_0xbfb9('0x15')](function(_0x184983){if(_0x184983[_0xbfb9('0x1d')]){logger[_0xbfb9('0x16')](_0xbfb9('0x1e'));return _[_0xbfb9('0x1f')](_0x184983[_0xbfb9('0x20')],{'email':_0x248b61,'role':_0xbfb9('0x21')});}else{logger[_0xbfb9('0x16')](_0xbfb9('0x22'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x23'),_0x1deea8[_0xbfb9('0xe')])})[_0xbfb9('0x15')](function(_0x26b7e9){logger[_0xbfb9('0x16')]('Admin\x20account\x20selected.');return _0x26b7e9[_0xbfb9('0x24')];});}});}else{logger[_0xbfb9('0x16')](_0xbfb9('0x22'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x23'),_0x1deea8[_0xbfb9('0xe')])})[_0xbfb9('0x15')](function(_0x426d82){logger[_0xbfb9('0x16')](_0xbfb9('0x25'));return _0x426d82['user'];});}}function getEndUser(_0x236119,_0x1a3560,_0x1697ef){logger[_0xbfb9('0x16')](_0xbfb9('0x26'),_0x1697ef);return request({'uri':util['format'](_0xbfb9('0x1a'),_0x236119['remoteUri']),'qs':{'query':util[_0xbfb9('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x1697ef)}})['then'](function(_0x3e8729){var _0x36de5f;if(_0x3e8729[_0xbfb9('0x20')][_0xbfb9('0x27')]){_0x3e8729['results']=_['filter'](_0x3e8729[_0xbfb9('0x20')],{'suspended':![],'role':_0xbfb9('0x28')});if(_0x3e8729[_0xbfb9('0x20')][_0xbfb9('0x27')]){_0x36de5f=_[_0xbfb9('0x29')](_0x3e8729[_0xbfb9('0x20')]);}}if(_0x36de5f){logger['info']('Enduser\x20found!');return _0x36de5f;}else{logger[_0xbfb9('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x2a'),_0x236119['remoteUri']),'method':_0xbfb9('0x2b'),'body':{'user':{'role':_0xbfb9('0x28'),'name':util['format'](_0xbfb9('0x2c'),_0x1a3560||_0x1697ef),'phone':_0x1697ef}}})['then'](function(_0x1b6978){logger[_0xbfb9('0x16')]('Enduser\x20created.');return _0x1b6978[_0xbfb9('0x24')];});}});}function getAuth(_0x356913){var _0x2cf03d;if(_0x356913[_0xbfb9('0x2d')]===_0xbfb9('0x2e')){_0x2cf03d=util['format'](_0xbfb9('0x2f'),_0x356913[_0xbfb9('0x30')],_0x356913['password']);}else if(_0x356913['authType']===_0xbfb9('0x31')){_0x2cf03d=util[_0xbfb9('0x1b')](_0xbfb9('0x32'),_0x356913[_0xbfb9('0x30')],_0x356913[_0xbfb9('0x31')]);}return util[_0xbfb9('0x1b')](_0xbfb9('0x33'),new Buffer(_0x2cf03d)[_0xbfb9('0x34')](_0xbfb9('0x35')));}function request(_0x463f92){logger[_0xbfb9('0x36')](_0xbfb9('0x37'),JSON[_0xbfb9('0x38')](_0x463f92));return rp(_['defaults'](_0x463f92,{'method':_0xbfb9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x32b54e,_0x341db2){var _0x421620=[];if(_0x32b54e&&_0x32b54e[_0xbfb9('0x27')]>0x0){_0x421620=_['map'](_0x32b54e,_0x341db2);}return _0x421620;}function getCustomFields(_0x2161e8,_0x247865){var _0x5bb41a=[];var _0x9152fa={'custom_fields':[]};if(_0x2161e8['length']>0x0){_[_0xbfb9('0x3a')](_0x2161e8,function(_0x6e0bb8){if(_['includes'](['string',_0xbfb9('0x3b')],_0x6e0bb8[_0xbfb9('0x3c')])&&_0x6e0bb8['nameField']&&!_0x6e0bb8['customField']){_0x9152fa[_0x6e0bb8['nameField']['toLowerCase']()]=_0x6e0bb8[_0xbfb9('0x3d')]['toString']();}else if(_['includes']([_0xbfb9('0x3e'),'picklist'],_0x6e0bb8[_0xbfb9('0x3c')])&&_0x6e0bb8['idField']&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8['idField'],'value':_0x6e0bb8['content'][_0xbfb9('0x34')]()});}else if(_0x6e0bb8[_0xbfb9('0x3c')]===_0xbfb9('0x42')&&_0x6e0bb8[_0xbfb9('0x43')]&&_0x6e0bb8[_0xbfb9('0x44')]&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x247865[_0x6e0bb8[_0xbfb9('0x43')]]&&_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8['idField'],'value':_0x247865[_0x6e0bb8[_0xbfb9('0x43')]][_0xbfb9('0x34')]()});}else if(_0x6e0bb8['type']==='customVariable'&&_0x6e0bb8[_0xbfb9('0x45')]&&_0x6e0bb8['Variable'][_0xbfb9('0x11')]&&_0x6e0bb8['idField']&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x247865[_0x6e0bb8[_0xbfb9('0x45')]['name'][_0xbfb9('0x46')]()]&&_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8[_0xbfb9('0x44')],'value':_0x247865[_0x6e0bb8['Variable'][_0xbfb9('0x11')]['toLowerCase']()][_0xbfb9('0x34')]()});}});}return _0x9152fa;}exports['queue']=function(_0x4c59a4,_0x16b096,_0xcdc5a9,_0x52bb12,_0x282b8f,_0x2416ea){var _0x2ec05a,_0x1397f0;_0x2416ea[_0xbfb9('0xe')]=intUtil['stripTrailingSlash'](_0x2416ea[_0xbfb9('0xe')]);_0x2416ea['serverUrl']=intUtil[_0xbfb9('0x47')](_0x2416ea['serverUrl']);if(_0x282b8f&&_0x282b8f[_0xbfb9('0x48')]){logger[_0xbfb9('0x16')](_0xbfb9('0x49'),_0xbfb9('0x4a'));_0x16b096['recordingURL']=util[_0xbfb9('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2416ea[_0xbfb9('0x4b')],_0x16b096[_0xbfb9('0x4c')],md5(_0x16b096['uniqueid']));}else{_0x16b096['recordingURL']='';}headers['Authorization']=getAuth(_0x2416ea);return getUser(_0x2416ea,_0x52bb12['email'])[_0xbfb9('0x15')](function(_0x2d55de){_0x2ec05a=_0x2d55de;logger['info'](_0xbfb9('0x4d'),_0x2ec05a['id']);return getEndUser(_0x2416ea,_0x16b096['calleridname'],_0x16b096[_0xbfb9('0x4e')]);})['then'](function(_0x188365){_0x1397f0=_0x188365;logger[_0xbfb9('0x16')](_0xbfb9('0x4f'),_0x1397f0['id']);return getTicket(_0x2416ea,_0x2ec05a,_0x1397f0,_0xcdc5a9,_0x16b096);})[_0xbfb9('0x15')](function(_0x103215){if(_0x103215){logger[_0xbfb9('0x16')]('The\x20Ticket\x20ID\x20is:',_0x103215['id']);switch(_0x2416ea[_0xbfb9('0x3c')]){case _0xbfb9('0x50'):logger[_0xbfb9('0x16')](_0xbfb9('0x49'),_0xbfb9('0x51'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x52'),_0x2416ea[_0xbfb9('0xe')],_0x2ec05a['id'],_0x103215['id']),'method':_0xbfb9('0x2b')});case _0xbfb9('0x53'):logger[_0xbfb9('0x16')](_0xbfb9('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbfb9('0x54'),_0x52bb12[_0xbfb9('0x11')]),_0xbfb9('0x55'),{'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x56'),_0x2416ea[_0xbfb9('0xe')][_0xbfb9('0x57')](_0xbfb9('0x58'),''),_0x103215['id'])});break;default:logger[_0xbfb9('0x59')](_0xbfb9('0x49'),_0xbfb9('0x5a'));}}})['catch'](function(_0x549836){logger[_0xbfb9('0x59')](_0xbfb9('0x5b'),util[_0xbfb9('0x5c')](_0x549836,{'showHidden':!![],'depth':null}));});};exports[_0xbfb9('0x5d')]=function(_0x5a9efb,_0xa4f8b9,_0x11f6cd,_0x319340,_0xffa5fd,_0x200bae,_0x163185){var _0x829f3c,_0x3ddb71;_0x200bae[_0xbfb9('0xe')]=intUtil[_0xbfb9('0x47')](_0x200bae['remoteUri']);_0x200bae[_0xbfb9('0x4b')]=intUtil[_0xbfb9('0x47')](_0x200bae[_0xbfb9('0x4b')]);if(_0x163185&&_0x163185[_0xbfb9('0x5e')]&&_0x163185[_0xbfb9('0x5e')]!=='none'){logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x4a'));_0xa4f8b9[_0xbfb9('0x60')]=util[_0xbfb9('0x1b')](_0xbfb9('0x61'),_0x200bae[_0xbfb9('0x4b')],_0xa4f8b9[_0xbfb9('0x4c')],md5(_0xa4f8b9[_0xbfb9('0x4c')]));}headers[_0xbfb9('0x62')]=getAuth(_0x200bae);return getUser(_0x200bae,_0x319340[_0xbfb9('0x63')])[_0xbfb9('0x15')](function(_0x519a8a){_0x829f3c=_0x519a8a;logger[_0xbfb9('0x16')](_0xbfb9('0x4d'),_0x829f3c['id']);return getEndUser(_0x200bae,_0xa4f8b9[_0xbfb9('0x64')],_0xa4f8b9[_0xbfb9('0x65')]);})[_0xbfb9('0x15')](function(_0x593ac8){_0x3ddb71=_0x593ac8;logger['info'](_0xbfb9('0x4f'),_0x3ddb71['id']);return getTicket(_0x200bae,_0x829f3c,_0x3ddb71,_0x11f6cd,_0xa4f8b9);})[_0xbfb9('0x15')](function(_0x8caaf0){if(_0x8caaf0){logger[_0xbfb9('0x16')](_0xbfb9('0x66'),_0x8caaf0['id']);switch(_0x200bae['type']){case _0xbfb9('0x50'):logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x51'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x52'),_0x200bae[_0xbfb9('0xe')],_0x829f3c['id'],_0x8caaf0['id']),'method':_0xbfb9('0x2b')});case _0xbfb9('0x53'):logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x67'));emit(util[_0xbfb9('0x1b')](_0xbfb9('0x54'),_0x319340['name']),_0xbfb9('0x55'),{'uri':util[_0xbfb9('0x1b')]('%s/agent/tickets/%s',_0x200bae[_0xbfb9('0xe')]['replace'](_0xbfb9('0x58'),''),_0x8caaf0['id'])});break;default:logger[_0xbfb9('0x59')]('[OUTBOUND]',_0xbfb9('0x5a'));}}})[_0xbfb9('0x68')](function(_0x447867){logger['error'](_0xbfb9('0x69'),util[_0xbfb9('0x5c')](_0x447867,{'showHidden':!![],'depth':null}));});};exports[_0xbfb9('0x6a')]=function(_0x3aed67,_0x23d82d,_0x4271e1,_0x4892a0,_0x3bcaa4,_0x102d3b){var _0xc7d054,_0x5a7729;_0x102d3b[_0xbfb9('0xe')]=intUtil[_0xbfb9('0x47')](_0x102d3b['remoteUri']);_0x102d3b[_0xbfb9('0x4b')]=intUtil['stripTrailingSlash'](_0x102d3b[_0xbfb9('0x4b')]);if(_0x3bcaa4&&_0x3bcaa4['monitor_format']){logger[_0xbfb9('0x16')]('['+_0x23d82d[_0xbfb9('0x6b')]['toUpperCase']()+']',_0xbfb9('0x4a'));_0x23d82d['recordingURL']=util[_0xbfb9('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x102d3b[_0xbfb9('0x4b')],_0x23d82d[_0xbfb9('0x4c')],md5(_0x23d82d['uniqueid']));}else{_0x23d82d['recordingURL']='';}headers[_0xbfb9('0x62')]=getAuth(_0x102d3b);return getUser(_0x102d3b)[_0xbfb9('0x15')](function(_0xbadf65){_0xc7d054=_0xbadf65;logger[_0xbfb9('0x16')](_0xbfb9('0x4d'),_0xc7d054['id']);return getEndUser(_0x102d3b,_0x23d82d['calleridname'],_0x23d82d[_0xbfb9('0x4e')]);})['then'](function(_0x2c59ae){_0x5a7729=_0x2c59ae;logger[_0xbfb9('0x16')](_0xbfb9('0x4f'),_0x5a7729['id']);return getTicket(_0x102d3b,_0xc7d054,_0x5a7729,_0x4271e1,_0x23d82d);})[_0xbfb9('0x15')](function(_0x3f1e3c){if(_0x3f1e3c){logger['info'](_0xbfb9('0x66'),_0x3f1e3c['id']);}})[_0xbfb9('0x68')](function(_0x226d5d){logger['error']('['+_0x23d82d[_0xbfb9('0x6b')][_0xbfb9('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xbfb9('0x5c')](_0x226d5d,{'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 e24064e..8ee0f81 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 _0x7f31=['./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','emit','debug','length','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','lead','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','called','Called','complete','connect','Answered','rejected','Rejected','abandoned','Call_Result','Abandoned','timeout','Timeout','outbound','starttime','agentcalledAt','Inbound','merge','POST','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','unmanaged','monitor_format','toUpperCase','lodash','md5','util'];(function(_0x20fe65,_0x238ea1){var _0x4be5a4=function(_0x3979ac){while(--_0x3979ac){_0x20fe65['push'](_0x20fe65['shift']());}};_0x4be5a4(++_0x238ea1);}(_0x7f31,0x137));var _0x17f3=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x7f31[_0x1857c6];return _0x51011c;};'use strict';var _=require(_0x17f3('0x0'));var rp=require('request-promise');var md5=require(_0x17f3('0x1'));var util=require(_0x17f3('0x2'));var intUtil=require(_0x17f3('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x17f3('0x4'));var config=require(_0x17f3('0x5'));var logger=require(_0x17f3('0x6'))(_0x17f3('0x7'));config['redis']=_[_0x17f3('0x8')](config[_0x17f3('0x9')],{'host':_0x17f3('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x17f3('0x9')]));function emit(_0xbf32b8,_0x4dd750,_0x14ca2d){io['to'](_0xbf32b8)[_0x17f3('0xb')](_0x4dd750,_0x14ca2d);}function request(_0x5a8388){logger[_0x17f3('0xc')]('[HTTP]',JSON['stringify'](_0x5a8388));return rp(_0x5a8388);}function getCustomFields(_0x5cb43c,_0x4abe62){var _0xb75e92={};if(_0x5cb43c[_0x17f3('0xd')]>0x0){_['forEach'](_0x5cb43c,function(_0x98a5f){if(_[_0x17f3('0xe')]([_0x17f3('0xf'),'picklist'],_0x98a5f[_0x17f3('0x10')])&&_0x98a5f[_0x17f3('0x11')]){_0xb75e92[_0x98a5f['idField']]=_0x98a5f[_0x17f3('0x12')][_0x17f3('0x13')]();}else if(_0x98a5f[_0x17f3('0x10')]===_0x17f3('0x14')&&_0x98a5f[_0x17f3('0x15')]&&_0x98a5f[_0x17f3('0x11')]&&_0x4abe62[_0x98a5f[_0x17f3('0x15')]]){_0xb75e92[_0x98a5f['idField']]=_0x4abe62[_0x98a5f[_0x17f3('0x15')]][_0x17f3('0x13')]();}else if(_0x98a5f[_0x17f3('0x10')]==='customVariable'&&_0x98a5f[_0x17f3('0x16')]&&_0x98a5f['Variable'][_0x17f3('0x17')]&&_0x98a5f[_0x17f3('0x11')]&&_0x4abe62[_0x98a5f['Variable']['name'][_0x17f3('0x18')]()]){_0xb75e92[_0x98a5f['idField']]=_0x4abe62[_0x98a5f[_0x17f3('0x16')]['name'][_0x17f3('0x18')]()]['toString']();}});}return _0xb75e92;}function getName(_0x4c888e){if(_0x4c888e[_0x17f3('0x19')]('\x20')>0x0){var _0x3f3ba4=_0x4c888e[_0x17f3('0x1a')](/ (.+)/);if(_0x3f3ba4[0x1]){return _0x3f3ba4;}}return[_0x4c888e,_0x4c888e];}var accountsTokens={};function getAccessToken(_0x416add){return new Promise(function(_0x482e9d,_0x3ca3ae){if(!_[_0x17f3('0x1b')](accountsTokens[_0x416add['id']])&&!_[_0x17f3('0x1b')](accountsTokens[_0x416add['id']][_0x17f3('0x1c')])){if(moment()[_0x17f3('0x1d')](accountsTokens[_0x416add['id']]['expires_in'])){_0x482e9d(accountsTokens[_0x416add['id']][_0x17f3('0x1c')]);}}var _0x284beb;switch(_0x416add[_0x17f3('0x1e')]){case'US':_0x284beb=_0x17f3('0x1f');break;case'AU':_0x284beb=_0x17f3('0x20');break;case'EU':_0x284beb='https://accounts.zoho.eu';break;case'IN':_0x284beb=_0x17f3('0x21');break;case'CN':_0x284beb='https://accounts.zoho.com.cn';break;default:_0x284beb=_0x17f3('0x22');break;}var _0x119683={'method':'POST','uri':_0x284beb+_0x17f3('0x23'),'qs':{'refresh_token':_0x416add[_0x17f3('0x24')],'client_id':_0x416add[_0x17f3('0x25')],'client_secret':_0x416add[_0x17f3('0x26')],'grant_type':_0x17f3('0x27')},'json':!![]};return rp(_0x119683)[_0x17f3('0x28')](function(_0x404332){accountsTokens[_0x416add['id']]={'access_token':_0x404332['access_token'],'expires_in':moment()[_0x17f3('0x29')](_0x404332[_0x17f3('0x2a')],_0x17f3('0x2b'))};_0x482e9d(_0x404332[_0x17f3('0x1c')]);})['catch'](function(_0x2d1f8d){logger[_0x17f3('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x2d1f8d[_0x17f3('0x2d')]);_0x3ca3ae(_0x2d1f8d);});});}function getUser(_0x13dbd0,_0x2b8763,_0x4ff5c3,_0x1274d1){logger[_0x17f3('0x2e')](_0x17f3('0x2f'));return request({'method':_0x17f3('0x30'),'uri':util[_0x17f3('0x31')](_0x17f3('0x32'),_0x2b8763),'qs':{'type':_0x17f3('0x33')},'headers':{'Authorization':_0x17f3('0x34')+_0x13dbd0},'json':!![]})[_0x17f3('0x28')](function(_0x262807){if(_0x262807[_0x17f3('0x35')]){var _0x33f9ac=-0x1;if(_[_0x17f3('0x36')](_0x262807[_0x17f3('0x35')])){if(!_[_0x17f3('0x1b')](_0x1274d1)){_0x33f9ac=_[_0x17f3('0x37')](_0x262807[_0x17f3('0x35')],function(_0x4144ce){return _0x4144ce[_0x17f3('0x38')]===_0x1274d1;});}if(_0x33f9ac>=0x0){logger[_0x17f3('0x2e')](_0x17f3('0x39'));}else{logger[_0x17f3('0x2e')](_0x17f3('0x3a'));_0x33f9ac=_[_0x17f3('0x37')](_0x262807[_0x17f3('0x35')],function(_0x3c9dad){return _0x3c9dad[_0x17f3('0x3b')][_0x17f3('0x17')]===_0x17f3('0x3c');});}return _0x262807['users'][_0x33f9ac];}else{if(_0x262807[_0x17f3('0x3d')][_0x17f3('0x3b')][_0x17f3('0x17')]===_0x17f3('0x3c')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x262807['user'];return user;}else{logger['error'](_0x17f3('0x3e'),JSON[_0x17f3('0x3f')](_0x262807));throw new Error(_0x17f3('0x40')+JSON['stringify'](_0x262807));}}}else{logger[_0x17f3('0x2c')](_0x17f3('0x3e'),JSON[_0x17f3('0x3f')](_0x262807));throw new Error(_0x17f3('0x40')+JSON['stringify'](_0x262807));}})[_0x17f3('0x41')](function(_0x3d6c18){console[_0x17f3('0x2c')](_0x3d6c18);});}function getZohoUser(_0x30824e,_0x5f5c2c){return new BPromise(function(_0x22e3a9,_0x4dbff4){request(_0x30824e)[_0x17f3('0x28')](function(_0x1f8955){var _0x3e35be=null;if(_0x1f8955){_0x3e35be=_0x1f8955[_0x17f3('0x42')][0x0];_0x3e35be[_0x17f3('0x43')]=_0x5f5c2c;}_0x22e3a9(_0x3e35be);})['catch'](function(_0x260016){_0x4dbff4(_0x260016);});});}function createEndUser(_0x24a0da,_0x116cef,_0x512c22,_0x4ea871,_0x20eae9,_0x5b6715){var _0x512c22=getName(_0x512c22);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x116cef+_0x17f3('0x44')+_[_0x17f3('0x45')](_0x5b6715[_0x17f3('0x46')])+'s','body':{'data':[{'Last_Name':_0x512c22[0x1],'First_Name':_0x512c22[0x0],'Phone':_0x4ea871,'Owner':{'name':!_[_0x17f3('0x1b')](_0x20eae9[_0x17f3('0x47')][_0x17f3('0x17')])?_0x20eae9[_0x17f3('0x47')]['name']:!_[_0x17f3('0x1b')](_0x20eae9['first_name'])?_0x20eae9[_0x17f3('0x48')]+'\x20'+_0x20eae9[_0x17f3('0x49')]:_0x20eae9[_0x17f3('0x49')],'id':_0x20eae9['id']}}]},'headers':{'Authorization':_0x17f3('0x34')+_0x24a0da},'json':!![]})[_0x17f3('0x28')](function(_0x1f7f1a){if(_0x1f7f1a&&_0x1f7f1a[_0x17f3('0x42')][0x0][_0x17f3('0x4a')]===_0x17f3('0x4b')){var _0x399e01=_0x1f7f1a[_0x17f3('0x42')][0x0][_0x17f3('0x4c')];_0x399e01[_0x17f3('0x43')]=_[_0x17f3('0x45')](_0x5b6715[_0x17f3('0x46')])+'s';return _0x399e01;}logger[_0x17f3('0x2c')](_0x17f3('0x3e'),JSON['stringify'](data));throw new Error(_0x17f3('0x4d')+JSON[_0x17f3('0x3f')](data));})[_0x17f3('0x41')](function(_0x46f148){console[_0x17f3('0x4e')](_0x17f3('0x4f'),_0x46f148);});}function getEndUser(_0x1b0460,_0x2e90d5,_0x3d9637,_0x171785,_0x58addf,_0x48b3a6,_0x155211){var _0x3d400c={'method':_0x17f3('0x30'),'uri':'','headers':{'Authorization':_0x17f3('0x34')+_0x1b0460},'json':!![]};switch(_0x155211[_0x17f3('0x50')]){case _0x17f3('0x51'):_0x3d400c[_0x17f3('0x52')]=_0x17f3('0x53')+_0x2e90d5+_0x17f3('0x54')+_0x58addf+'))';return getZohoUser(_0x3d400c,_0x17f3('0x55'))['then'](function(_0x58617c){if(_0x58617c)return _0x58617c;_0x3d400c['uri']='https://www.zohoapis.'+_0x2e90d5+_0x17f3('0x56')+_0x58addf+'))';return getZohoUser(_0x3d400c,_0x17f3('0x57'))[_0x17f3('0x28')](function(_0x40c6b0){if(_0x40c6b0)return _0x40c6b0;if(_0x155211['moduleCreate']!='nothing'){return createEndUser(_0x1b0460,_0x2e90d5,_0x171785,_0x58addf,_0x48b3a6,_0x155211);}else{return{};}});});break;case _0x17f3('0x58'):_0x3d400c[_0x17f3('0x52')]=_0x17f3('0x53')+_0x2e90d5+_0x17f3('0x54')+_0x58addf+'))';return getZohoUser(_0x3d400c,_0x17f3('0x55'))[_0x17f3('0x28')](function(_0x417418){if(_0x417418)return _0x417418;if(_0x155211[_0x17f3('0x46')]!='nothing'){return createEndUser(_0x1b0460,_0x2e90d5,_0x171785,_0x58addf,_0x48b3a6,_0x155211);}else{return{};}});break;case _0x17f3('0x59'):_0x3d400c[_0x17f3('0x52')]='https://www.zohoapis.'+_0x2e90d5+_0x17f3('0x56')+_0x58addf+'))';return getZohoUser(_0x3d400c,_0x17f3('0x57'))[_0x17f3('0x28')](function(_0x4f64c8){if(_0x4f64c8)return _0x4f64c8;if(_0x155211['moduleCreate']!=_0x17f3('0x5a')){return createEndUser(_0x1b0460,_0x2e90d5,_0x171785,_0x58addf,_0x48b3a6,_0x155211);}else{return{};}});break;}}function getCall(_0x53cb35,_0x1b20d0,_0x292a07,_0xcb43b7,_0x4d0854,_0x824d23,_0x3fd4f0,_0x474eba){logger[_0x17f3('0x2e')](_0x17f3('0x5b'));var _0x194401={};_0x194401[_0x17f3('0x5c')]={'name':!_['isNil'](_0xcb43b7[_0x17f3('0x47')]['name'])&&!_[_0x17f3('0x1b')](_0xcb43b7['profile'][_0x17f3('0x17')])&&_0xcb43b7['profile'][_0x17f3('0x17')]===_0x17f3('0x5d')?_0xcb43b7['role'][_0x17f3('0x17')]:!_[_0x17f3('0x1b')](_0xcb43b7[_0x17f3('0x48')])?_0xcb43b7[_0x17f3('0x48')]+'\x20'+_0xcb43b7['last_name']:_0xcb43b7[_0x17f3('0x49')],'id':_0xcb43b7['id']};_0x194401[_0x17f3('0x5e')]=intUtil[_0x17f3('0x5f')](_0x824d23['Subjects'],_0x3fd4f0,'\x20');_0x194401['Description']=intUtil['getString'](_0x824d23[_0x17f3('0x60')],_0x3fd4f0,'\x0a');if(_0x4d0854[_0x17f3('0x43')]===_0x17f3('0x55')){_0x194401[_0x17f3('0x61')]={'name':!_['isNil'](_0x4d0854[_0x17f3('0x62')])?_0x4d0854[_0x17f3('0x62')]:!_[_0x17f3('0x1b')](_0x4d0854[_0x17f3('0x63')])?_0x4d0854[_0x17f3('0x63')]+'\x20'+_0x4d0854['Last_Name']:_0x4d0854[_0x17f3('0x64')],'id':_0x4d0854['id']};}if(_0x4d0854[_0x17f3('0x43')]===_0x17f3('0x57')){_0x194401['What_Id']={'name':!_[_0x17f3('0x1b')](_0x4d0854[_0x17f3('0x62')])?_0x4d0854[_0x17f3('0x62')]:!_['isNil'](_0x4d0854[_0x17f3('0x63')])?_0x4d0854[_0x17f3('0x63')]+'\x20'+_0x4d0854[_0x17f3('0x64')]:_0x4d0854['Last_Name'],'id':_0x4d0854['id']};_0x194401[_0x17f3('0x65')]=_[_0x17f3('0x45')](_0x4d0854[_0x17f3('0x43')]);}if(_0x3fd4f0[_0x17f3('0x66')]){_0x194401['Call_Duration']=moment[_0x17f3('0x67')](parseInt(_0x3fd4f0['talktime'])*0x3e8)[_0x17f3('0x31')](_0x17f3('0x68'));}else if(_0x3fd4f0[_0x17f3('0x69')]&&_0x3fd4f0[_0x17f3('0x6a')]){_0x194401[_0x17f3('0x6b')]=moment[_0x17f3('0x67')](moment(_0x3fd4f0[_0x17f3('0x6a')],_0x17f3('0x6c'))[_0x17f3('0x6d')](moment(_0x3fd4f0['starttime'],_0x17f3('0x6c'))))[_0x17f3('0x31')](_0x17f3('0x68'));}switch(_0x3fd4f0['lastevent']){case _0x17f3('0x6e'):_0x194401['Call_Result']=_0x17f3('0x6f');break;case _0x17f3('0x70'):case _0x17f3('0x71'):_0x194401['Call_Result']=_0x17f3('0x72');break;case _0x17f3('0x73'):_0x194401['Call_Result']=_0x17f3('0x74');break;case _0x17f3('0x75'):_0x194401[_0x17f3('0x76')]=_0x17f3('0x77');break;case _0x17f3('0x78'):_0x194401[_0x17f3('0x76')]=_0x17f3('0x79');default:}_0x194401['Call_Start_Time']=(_0x474eba===_0x17f3('0x7a')?moment(_0x3fd4f0[_0x17f3('0x7b')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x3fd4f0[_0x17f3('0x7c')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x17f3('0x31')](_0x17f3('0x6c'));_0x194401['Call_Type']=_0x474eba||_0x17f3('0x7d');_0x194401=_[_0x17f3('0x7e')](_0x194401,getCustomFields(_0x824d23['Fields'],_0x3fd4f0));return request({'method':_0x17f3('0x7f'),'uri':_0x17f3('0x53')+_0x1b20d0+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53cb35},'body':{'data':[_0x194401]},'json':!![]})[_0x17f3('0x28')](function(_0x2e6148){if(_0x2e6148&&_0x2e6148[_0x17f3('0x42')][0x0][_0x17f3('0x4a')]===_0x17f3('0x4b')){logger[_0x17f3('0x2e')]('Call\x20created!');return{'id':_0x2e6148[_0x17f3('0x42')][0x0][_0x17f3('0x4c')]['id']};}})[_0x17f3('0x41')](function(_0x4799ef){logger[_0x17f3('0x2e')](_0x17f3('0x80'),_0x4799ef[_0x17f3('0x2d')]);console[_0x17f3('0x4e')]('err',_0x4799ef);});}exports['queue']=function(_0x255d9d,_0x3609ce,_0x33ccfc,_0x3d68d5,_0x2914a4,_0xd96528){var _0x5bf482,_0x3898e7,_0x568325;_0xd96528[_0x17f3('0x81')]=intUtil[_0x17f3('0x82')](_0xd96528[_0x17f3('0x81')]);_0xd96528[_0x17f3('0x83')]=intUtil[_0x17f3('0x82')](_0xd96528[_0x17f3('0x83')]);if(_0x2914a4&&_0x2914a4['monitor_format']){logger[_0x17f3('0x2e')](_0x17f3('0x84'),_0x17f3('0x85'));_0x3609ce[_0x17f3('0x86')]=_0xd96528['serverUrl']+_0x17f3('0x87')+_0x3609ce[_0x17f3('0x88')]+_0x17f3('0x89')+md5(_0x3609ce[_0x17f3('0x88')]);}else{_0x3609ce['recordingURL']='';}var _0xab69cb=_0xd96528[_0x17f3('0x81')]===_0x17f3('0x8a')?'eu':_0x17f3('0x8b');return getAccessToken(_0xd96528)[_0x17f3('0x28')](function(_0x4c45f9){_0x568325=_0x4c45f9;return getUser(_0x568325,_0xab69cb,_0xd96528,_0x3d68d5[_0x17f3('0x38')]);})[_0x17f3('0x28')](function(_0x22113e){_0x5bf482=_0x22113e;logger[_0x17f3('0x2e')](_0x17f3('0x8c'),_0x5bf482['id']);return getEndUser(_0x568325,_0xab69cb,_0xd96528,_0x3609ce[_0x17f3('0x8d')],_0x3609ce[_0x17f3('0x8e')],_0x5bf482,_0x33ccfc);})[_0x17f3('0x28')](function(_0x109851){_0x3898e7=_0x109851;return getCall(_0x568325,_0xab69cb,_0xd96528,_0x5bf482,_0x3898e7,_0x33ccfc,_0x3609ce,_0x17f3('0x7d'));})['then'](function(_0x20c5ac){if(_0x20c5ac){logger['info'](_0x17f3('0x8f'),_0x20c5ac['id']);logger[_0x17f3('0x2e')](_0x17f3('0x84'),_0x17f3('0x90'));emit(util['format'](_0x17f3('0x91'),_0x3d68d5[_0x17f3('0x17')]),'trigger:browser:url',{'uri':_0x17f3('0x92')+_0xd96528[_0x17f3('0x81')]+_0x17f3('0x93')+_0x20c5ac['id']});}})[_0x17f3('0x41')](function(_0x45c738){logger['error'](_0x17f3('0x84'),JSON[_0x17f3('0x3f')](_0x45c738));});};exports['outbound']=function(_0x40f4fb,_0xd87c66,_0x569aa8,_0x5ed8f1,_0xf57dd,_0x3a30e5,_0x2df2e8){var _0x3e3c76,_0x1932f4,_0x296814;_0x3a30e5['host']=intUtil[_0x17f3('0x82')](_0x3a30e5[_0x17f3('0x81')]);_0x3a30e5['serverUrl']=intUtil['stripTrailingSlash'](_0x3a30e5['serverUrl']);if(_0x2df2e8&&_0x2df2e8[_0x17f3('0x94')]&&_0x2df2e8['recordingFormat']!==_0x17f3('0x95')){logger[_0x17f3('0x2e')]('[OUTBOUND]',_0x17f3('0x85'));_0xd87c66[_0x17f3('0x86')]=_0x3a30e5['serverUrl']+_0x17f3('0x87')+_0xd87c66[_0x17f3('0x88')]+_0x17f3('0x89')+md5(_0xd87c66[_0x17f3('0x88')]);}var _0x3dce55=_0x3a30e5[_0x17f3('0x81')]==='zoho.eu'?'eu':_0x17f3('0x8b');return getAccessToken(_0x3a30e5)[_0x17f3('0x28')](function(_0x127d0d){_0x296814=_0x127d0d;return getUser(_0x296814,_0x3dce55,_0x3a30e5,_0x5ed8f1[_0x17f3('0x38')]);})[_0x17f3('0x28')](function(_0x5d6346){_0x3e3c76=_0x5d6346;logger[_0x17f3('0x2e')](_0x17f3('0x8c'),_0x3e3c76['id']);return getEndUser(_0x296814,_0x3dce55,_0x3a30e5,_0xd87c66['destcalleridname'],_0xd87c66[_0x17f3('0x96')],_0x3e3c76,_0x569aa8);})[_0x17f3('0x28')](function(_0x410dc5){_0x1932f4=_0x410dc5;return getCall(_0x296814,_0x3dce55,_0x3a30e5,_0x3e3c76,_0x1932f4,_0x569aa8,_0xd87c66,_0x17f3('0x97'));})[_0x17f3('0x28')](function(_0xc3a467){if(_0xc3a467){logger[_0x17f3('0x2e')](_0x17f3('0x8f'),_0xc3a467['id']);logger['info'](_0x17f3('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x17f3('0x91'),_0x5ed8f1['name']),_0x17f3('0x99'),{'uri':_0x17f3('0x92')+_0x3a30e5[_0x17f3('0x81')]+_0x17f3('0x93')+_0xc3a467['id']});}})['catch'](function(_0x5015e0){logger['error']('[OUTBOUND]',JSON[_0x17f3('0x3f')](_0x5015e0));});};exports[_0x17f3('0x9a')]=function(_0x440278,_0x21e618,_0x2a846b,_0xd5517,_0x1b695f,_0xb7f0a1){var _0x30e437,_0x48415a,_0x348adf;_0xb7f0a1['host']=intUtil[_0x17f3('0x82')](_0xb7f0a1[_0x17f3('0x81')]);_0xb7f0a1[_0x17f3('0x83')]=intUtil['stripTrailingSlash'](_0xb7f0a1[_0x17f3('0x83')]);if(_0x1b695f&&_0x1b695f[_0x17f3('0x9b')]){logger[_0x17f3('0x2e')]('['+_0x21e618['lastevent'][_0x17f3('0x9c')]()+']',_0x17f3('0x85'));_0x21e618['recordingURL']=_0xb7f0a1[_0x17f3('0x83')]+_0x17f3('0x87')+_0x21e618[_0x17f3('0x88')]+_0x17f3('0x89')+md5(_0x21e618['uniqueid']);}else{_0x21e618[_0x17f3('0x86')]='';}var _0x3f4798=_0xb7f0a1[_0x17f3('0x81')]===_0x17f3('0x8a')?'eu':_0x17f3('0x8b');return getAccessToken(_0xb7f0a1)[_0x17f3('0x28')](function(_0x2f40af){_0x348adf=_0x2f40af;return getUser(_0x348adf,_0x3f4798,_0xb7f0a1);})[_0x17f3('0x28')](function(_0x57fa48){_0x30e437=_0x57fa48;logger[_0x17f3('0x2e')]('The\x20User\x20ID\x20is:',_0x30e437['id']);return getEndUser(_0x348adf,_0x3f4798,_0xb7f0a1,_0x21e618['calleridname'],_0x21e618['calleridnum'],_0x30e437,_0x2a846b);})[_0x17f3('0x28')](function(_0x12309b){_0x48415a=_0x12309b;return getCall(_0x348adf,_0x3f4798,_0xb7f0a1,_0x30e437,_0x48415a,_0x2a846b,_0x21e618,_0x17f3('0x7d'));})[_0x17f3('0x28')](function(_0x54eada){if(_0x54eada){logger[_0x17f3('0x2e')]('The\x20Call\x20ID\x20is:',_0x54eada['id']);}})[_0x17f3('0x41')](function(_0x2e673a){logger['error']('['+_0x21e618['lastevent'][_0x17f3('0x9c')]()+']',JSON[_0x17f3('0x3f')](_0x2e673a));});}; \ No newline at end of file +var _0xfa20=['Outbound','trigger:browser:url','unmanaged','stripTrailingSlash','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','variableName','toString','type','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','seconds','catch','Failing\x20creating\x20the\x20access_token','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','code','startCase','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','format','called','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','details','stack','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridname'];(function(_0x1ae8db,_0x12f29c){var _0x12eca8=function(_0x3d8d53){while(--_0x3d8d53){_0x1ae8db['push'](_0x1ae8db['shift']());}};_0x12eca8(++_0x12f29c);}(_0xfa20,0x141));var _0x0fa2=function(_0x5309f0,_0x381caf){_0x5309f0=_0x5309f0-0x0;var _0x3c5ff0=_0xfa20[_0x5309f0];return _0x3c5ff0;};'use strict';var _=require(_0x0fa2('0x0'));var rp=require(_0x0fa2('0x1'));var md5=require(_0x0fa2('0x2'));var util=require(_0x0fa2('0x3'));var intUtil=require(_0x0fa2('0x4'));var moment=require(_0x0fa2('0x5'));var Redis=require(_0x0fa2('0x6'));var BPromise=require(_0x0fa2('0x7'));var config=require(_0x0fa2('0x8'));var logger=require(_0x0fa2('0x9'))(_0x0fa2('0xa'));config['redis']=_[_0x0fa2('0xb')](config[_0x0fa2('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x0fa2('0xd'))(new Redis(config[_0x0fa2('0xc')]));function emit(_0x1f3223,_0x11979c,_0x28cc4d){io['to'](_0x1f3223)[_0x0fa2('0xe')](_0x11979c,_0x28cc4d);}function request(_0x3ec7f3){logger[_0x0fa2('0xf')](_0x0fa2('0x10'),JSON[_0x0fa2('0x11')](_0x3ec7f3));return rp(_0x3ec7f3);}function getCustomFields(_0x5c59dc,_0xd34dd5){var _0x30fd6d={};if(_0x5c59dc[_0x0fa2('0x12')]>0x0){_[_0x0fa2('0x13')](_0x5c59dc,function(_0x46c980){if(_[_0x0fa2('0x14')]([_0x0fa2('0x15'),_0x0fa2('0x16')],_0x46c980['type'])&&_0x46c980[_0x0fa2('0x17')]){_0x30fd6d[_0x46c980['idField']]=_0x46c980[_0x0fa2('0x18')]['toString']();}else if(_0x46c980['type']==='variable'&&_0x46c980[_0x0fa2('0x19')]&&_0x46c980[_0x0fa2('0x17')]&&_0xd34dd5[_0x46c980[_0x0fa2('0x19')]]){_0x30fd6d[_0x46c980[_0x0fa2('0x17')]]=_0xd34dd5[_0x46c980[_0x0fa2('0x19')]][_0x0fa2('0x1a')]();}else if(_0x46c980[_0x0fa2('0x1b')]===_0x0fa2('0x1c')&&_0x46c980['Variable']&&_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')]&&_0x46c980[_0x0fa2('0x17')]&&_0xd34dd5[_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')][_0x0fa2('0x1f')]()]){_0x30fd6d[_0x46c980[_0x0fa2('0x17')]]=_0xd34dd5[_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')][_0x0fa2('0x1f')]()]['toString']();}});}return _0x30fd6d;}function getName(_0x495870){if(_0x495870[_0x0fa2('0x20')]('\x20')>0x0){var _0x22cca6=_0x495870['split'](/ (.+)/);if(_0x22cca6[0x1]){return _0x22cca6;}}return[_0x495870,_0x495870];}var accountsTokens={};function getAccessToken(_0x383ebd){return new Promise(function(_0x29b93c,_0x13c103){if(!_['isNil'](accountsTokens[_0x383ebd['id']])&&!_[_0x0fa2('0x21')](accountsTokens[_0x383ebd['id']][_0x0fa2('0x22')])){if(moment()['isBefore'](accountsTokens[_0x383ebd['id']][_0x0fa2('0x23')])){_0x29b93c(accountsTokens[_0x383ebd['id']]['access_token']);}}var _0x357e7a;switch(_0x383ebd[_0x0fa2('0x24')]){case'US':_0x357e7a=_0x0fa2('0x25');break;case'AU':_0x357e7a=_0x0fa2('0x26');break;case'EU':_0x357e7a=_0x0fa2('0x27');break;case'IN':_0x357e7a='https://accounts.zoho.in';break;case'CN':_0x357e7a=_0x0fa2('0x28');break;default:_0x357e7a=_0x0fa2('0x27');break;}var _0x111028={'method':_0x0fa2('0x29'),'uri':_0x357e7a+_0x0fa2('0x2a'),'qs':{'refresh_token':_0x383ebd[_0x0fa2('0x2b')],'client_id':_0x383ebd[_0x0fa2('0x2c')],'client_secret':_0x383ebd['clientSecret'],'grant_type':_0x0fa2('0x2d')},'json':!![]};return rp(_0x111028)['then'](function(_0x3611ca){accountsTokens[_0x383ebd['id']]={'access_token':_0x3611ca['access_token'],'expires_in':moment()[_0x0fa2('0x2e')](_0x3611ca[_0x0fa2('0x23')],_0x0fa2('0x2f'))};_0x29b93c(_0x3611ca[_0x0fa2('0x22')]);})[_0x0fa2('0x30')](function(_0x338e9b){logger['error'](_0x0fa2('0x31'),_0x338e9b['stack']);_0x13c103(_0x338e9b);});});}function getUser(_0x5060bf,_0x12b59a,_0x100742,_0x1f6a4c){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x12b59a),'qs':{'type':_0x0fa2('0x32')},'headers':{'Authorization':_0x0fa2('0x33')+_0x5060bf},'json':!![]})[_0x0fa2('0x34')](function(_0x3f546f){if(_0x3f546f['users']){var _0x5e2578=-0x1;if(_['isArrayLikeObject'](_0x3f546f[_0x0fa2('0x35')])){if(!_['isNil'](_0x1f6a4c)){_0x5e2578=_[_0x0fa2('0x36')](_0x3f546f[_0x0fa2('0x35')],function(_0x37f4a8){return _0x37f4a8['email']===_0x1f6a4c;});}if(_0x5e2578>=0x0){logger['info'](_0x0fa2('0x37'));}else{logger[_0x0fa2('0x38')](_0x0fa2('0x39'));_0x5e2578=_[_0x0fa2('0x36')](_0x3f546f[_0x0fa2('0x35')],function(_0xf76d7){return _0xf76d7[_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x3b');});}return _0x3f546f[_0x0fa2('0x35')][_0x5e2578];}else{if(_0x3f546f[_0x0fa2('0x3c')][_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x3b')){logger[_0x0fa2('0x38')](_0x0fa2('0x39'));user=_0x3f546f[_0x0fa2('0x3c')];return user;}else{logger[_0x0fa2('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3f546f));throw new Error(_0x0fa2('0x3e')+JSON[_0x0fa2('0x11')](_0x3f546f));}}}else{logger[_0x0fa2('0x3d')](_0x0fa2('0x3f'),JSON[_0x0fa2('0x11')](_0x3f546f));throw new Error(_0x0fa2('0x3e')+JSON['stringify'](_0x3f546f));}})[_0x0fa2('0x30')](function(_0xe4fe1e){console[_0x0fa2('0x3d')](_0xe4fe1e);});}function getZohoUser(_0x1ca79c,_0x255c5c){return new BPromise(function(_0x52afb4,_0x139ab8){request(_0x1ca79c)[_0x0fa2('0x34')](function(_0x571546){var _0x15e04f=null;if(_0x571546){_0x15e04f=_0x571546[_0x0fa2('0x40')][0x0];_0x15e04f[_0x0fa2('0x41')]=_0x255c5c;}_0x52afb4(_0x15e04f);})['catch'](function(_0x594586){_0x139ab8(_0x594586);});});}function createEndUser(_0x4821c0,_0x52a6d0,_0x123155,_0x25b5cb,_0x43dc89,_0x481e1e){var _0x123155=getName(_0x123155);return request({'method':_0x0fa2('0x29'),'uri':_0x0fa2('0x42')+_0x52a6d0+_0x0fa2('0x43')+_['startCase'](_0x481e1e[_0x0fa2('0x44')])+'s','body':{'data':[{'Last_Name':_0x123155[0x1],'First_Name':_0x123155[0x0],'Phone':_0x25b5cb,'Owner':{'name':!_[_0x0fa2('0x21')](_0x43dc89[_0x0fa2('0x45')]['name'])?_0x43dc89[_0x0fa2('0x45')]['name']:!_[_0x0fa2('0x21')](_0x43dc89['first_name'])?_0x43dc89['first_name']+'\x20'+_0x43dc89[_0x0fa2('0x46')]:_0x43dc89[_0x0fa2('0x46')],'id':_0x43dc89['id']}}]},'headers':{'Authorization':_0x0fa2('0x33')+_0x4821c0},'json':!![]})[_0x0fa2('0x34')](function(_0x5bebf3){if(_0x5bebf3&&_0x5bebf3['data'][0x0][_0x0fa2('0x47')]==='SUCCESS'){var _0x17c36c=_0x5bebf3[_0x0fa2('0x40')][0x0]['details'];_0x17c36c[_0x0fa2('0x41')]=_[_0x0fa2('0x48')](_0x481e1e[_0x0fa2('0x44')])+'s';return _0x17c36c;}logger[_0x0fa2('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x0fa2('0x49')+JSON['stringify'](data));})[_0x0fa2('0x30')](function(_0x26bb7c){console[_0x0fa2('0x4a')]('CREATE\x20ERROR',_0x26bb7c);});}function getEndUser(_0x17f916,_0x1d3997,_0x45837a,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c){var _0xd8e181={'method':_0x0fa2('0x4b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x17f916},'json':!![]};switch(_0x2bd59c[_0x0fa2('0x4c')]){case _0x0fa2('0x4d'):_0xd8e181[_0x0fa2('0x4e')]='https://www.zohoapis.'+_0x1d3997+_0x0fa2('0x4f')+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x50'))['then'](function(_0xc0ff7b){if(_0xc0ff7b)return _0xc0ff7b;_0xd8e181['uri']=_0x0fa2('0x42')+_0x1d3997+_0x0fa2('0x51')+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x52'))[_0x0fa2('0x34')](function(_0x15c623){if(_0x15c623)return _0x15c623;if(_0x2bd59c[_0x0fa2('0x44')]!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});});break;case _0x0fa2('0x54'):_0xd8e181[_0x0fa2('0x4e')]='https://www.zohoapis.'+_0x1d3997+_0x0fa2('0x4f')+_0x317e9c+'))';return getZohoUser(_0xd8e181,'Contacts')[_0x0fa2('0x34')](function(_0x567d79){if(_0x567d79)return _0x567d79;if(_0x2bd59c[_0x0fa2('0x44')]!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});break;case _0x0fa2('0x55'):_0xd8e181['uri']='https://www.zohoapis.'+_0x1d3997+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x52'))[_0x0fa2('0x34')](function(_0x479d48){if(_0x479d48)return _0x479d48;if(_0x2bd59c['moduleCreate']!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});break;}}function getCall(_0x4ae8ac,_0x8d5b85,_0x14fdfa,_0x52065c,_0x156316,_0x454cca,_0x2dc2a5,_0x151c57){logger[_0x0fa2('0x38')](_0x0fa2('0x56'));var _0x1858c3={};_0x1858c3[_0x0fa2('0x57')]={'name':!_[_0x0fa2('0x21')](_0x52065c[_0x0fa2('0x45')]['name'])&&!_[_0x0fa2('0x21')](_0x52065c[_0x0fa2('0x3a')][_0x0fa2('0x1e')])&&_0x52065c[_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x58')?_0x52065c[_0x0fa2('0x45')][_0x0fa2('0x1e')]:!_['isNil'](_0x52065c[_0x0fa2('0x59')])?_0x52065c['first_name']+'\x20'+_0x52065c[_0x0fa2('0x46')]:_0x52065c[_0x0fa2('0x46')],'id':_0x52065c['id']};_0x1858c3[_0x0fa2('0x5a')]=intUtil[_0x0fa2('0x5b')](_0x454cca[_0x0fa2('0x5c')],_0x2dc2a5,'\x20');_0x1858c3['Description']=intUtil[_0x0fa2('0x5b')](_0x454cca['Descriptions'],_0x2dc2a5,'\x0a');if(_0x156316[_0x0fa2('0x41')]===_0x0fa2('0x50')){_0x1858c3[_0x0fa2('0x5d')]={'name':!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5e')])?_0x156316['Full_Name']:!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5f')])?_0x156316[_0x0fa2('0x5f')]+'\x20'+_0x156316[_0x0fa2('0x60')]:_0x156316[_0x0fa2('0x60')],'id':_0x156316['id']};}if(_0x156316[_0x0fa2('0x41')]==='Leads'){_0x1858c3[_0x0fa2('0x61')]={'name':!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5e')])?_0x156316[_0x0fa2('0x5e')]:!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5f')])?_0x156316[_0x0fa2('0x5f')]+'\x20'+_0x156316[_0x0fa2('0x60')]:_0x156316[_0x0fa2('0x60')],'id':_0x156316['id']};_0x1858c3[_0x0fa2('0x62')]=_[_0x0fa2('0x48')](_0x156316['enduserType']);}if(_0x2dc2a5['talktime']){_0x1858c3[_0x0fa2('0x63')]=moment[_0x0fa2('0x64')](parseInt(_0x2dc2a5[_0x0fa2('0x65')])*0x3e8)['format'](_0x0fa2('0x66'));}else if(_0x2dc2a5[_0x0fa2('0x67')]&&_0x2dc2a5[_0x0fa2('0x68')]){_0x1858c3['Call_Duration']=moment[_0x0fa2('0x64')](moment(_0x2dc2a5['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x2dc2a5[_0x0fa2('0x69')],_0x0fa2('0x6a'))))[_0x0fa2('0x6b')](_0x0fa2('0x66'));}switch(_0x2dc2a5['lastevent']){case _0x0fa2('0x6c'):_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x6e');break;case _0x0fa2('0x6f'):case'connect':_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x70');break;case _0x0fa2('0x71'):_0x1858c3[_0x0fa2('0x6d')]='Rejected';break;case _0x0fa2('0x72'):_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x73');break;case'timeout':_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x74');default:}_0x1858c3[_0x0fa2('0x75')]=(_0x151c57===_0x0fa2('0x76')?moment(_0x2dc2a5[_0x0fa2('0x69')])[_0x0fa2('0x6b')](_0x0fa2('0x6a')):moment(_0x2dc2a5[_0x0fa2('0x77')])[_0x0fa2('0x6b')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x0fa2('0x6a'));_0x1858c3[_0x0fa2('0x78')]=_0x151c57||'Inbound';_0x1858c3=_[_0x0fa2('0x79')](_0x1858c3,getCustomFields(_0x454cca[_0x0fa2('0x7a')],_0x2dc2a5));return request({'method':_0x0fa2('0x29'),'uri':'https://www.zohoapis.'+_0x8d5b85+_0x0fa2('0x7b'),'headers':{'Authorization':_0x0fa2('0x33')+_0x4ae8ac},'body':{'data':[_0x1858c3]},'json':!![]})[_0x0fa2('0x34')](function(_0x552681){if(_0x552681&&_0x552681['data'][0x0]['code']==='SUCCESS'){logger[_0x0fa2('0x38')]('Call\x20created!');return{'id':_0x552681[_0x0fa2('0x40')][0x0][_0x0fa2('0x7c')]['id']};}})[_0x0fa2('0x30')](function(_0x2eeb2d){logger[_0x0fa2('0x38')]('err',_0x2eeb2d[_0x0fa2('0x7d')]);console[_0x0fa2('0x4a')]('err',_0x2eeb2d);});}exports['queue']=function(_0x1be0bb,_0x5216a0,_0x354d73,_0x2587db,_0xc029dd,_0x59aa28){var _0x2d0c01,_0x346f1c,_0x1c1306;_0x59aa28[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x59aa28[_0x0fa2('0x7e')]);_0x59aa28['serverUrl']=intUtil['stripTrailingSlash'](_0x59aa28[_0x0fa2('0x7f')]);if(_0xc029dd&&_0xc029dd['monitor_format']){logger[_0x0fa2('0x38')](_0x0fa2('0x80'),_0x0fa2('0x81'));_0x5216a0['recordingURL']=_0x59aa28[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x5216a0[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x5216a0[_0x0fa2('0x83')]);}else{_0x5216a0[_0x0fa2('0x85')]='';}var _0x1bfe9e=_0x59aa28[_0x0fa2('0x7e')]==='zoho.eu'?'eu':_0x0fa2('0x86');return getAccessToken(_0x59aa28)[_0x0fa2('0x34')](function(_0x514100){_0x1c1306=_0x514100;return getUser(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x2587db['email']);})[_0x0fa2('0x34')](function(_0x3a1db9){_0x2d0c01=_0x3a1db9;logger[_0x0fa2('0x38')](_0x0fa2('0x87'),_0x2d0c01['id']);return getEndUser(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x5216a0[_0x0fa2('0x88')],_0x5216a0[_0x0fa2('0x89')],_0x2d0c01,_0x354d73);})[_0x0fa2('0x34')](function(_0x1f2692){_0x346f1c=_0x1f2692;return getCall(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x2d0c01,_0x346f1c,_0x354d73,_0x5216a0,_0x0fa2('0x8a'));})[_0x0fa2('0x34')](function(_0xd2140){if(_0xd2140){logger[_0x0fa2('0x38')](_0x0fa2('0x8b'),_0xd2140['id']);logger[_0x0fa2('0x38')](_0x0fa2('0x80'),_0x0fa2('0x8c'));emit(util['format'](_0x0fa2('0x8d'),_0x2587db[_0x0fa2('0x1e')]),'trigger:browser:url',{'uri':_0x0fa2('0x8e')+_0x59aa28[_0x0fa2('0x7e')]+_0x0fa2('0x8f')+_0xd2140['id']});}})[_0x0fa2('0x30')](function(_0x12327b){logger[_0x0fa2('0x3d')](_0x0fa2('0x80'),JSON[_0x0fa2('0x11')](_0x12327b));});};exports[_0x0fa2('0x76')]=function(_0x57d828,_0x1deea3,_0x561fc6,_0x5b82bd,_0x33b263,_0x58787e,_0x15d8a0){var _0x2088ca,_0x3dfc6f,_0x16e4dd;_0x58787e[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x58787e[_0x0fa2('0x7e')]);_0x58787e[_0x0fa2('0x7f')]=intUtil['stripTrailingSlash'](_0x58787e[_0x0fa2('0x7f')]);if(_0x15d8a0&&_0x15d8a0[_0x0fa2('0x90')]&&_0x15d8a0[_0x0fa2('0x90')]!==_0x0fa2('0x91')){logger['info'](_0x0fa2('0x92'),_0x0fa2('0x81'));_0x1deea3[_0x0fa2('0x85')]=_0x58787e[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x1deea3[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x1deea3[_0x0fa2('0x83')]);}var _0x5c19df=_0x58787e[_0x0fa2('0x7e')]===_0x0fa2('0x93')?'eu':_0x0fa2('0x86');return getAccessToken(_0x58787e)[_0x0fa2('0x34')](function(_0x44ddda){_0x16e4dd=_0x44ddda;return getUser(_0x16e4dd,_0x5c19df,_0x58787e,_0x5b82bd[_0x0fa2('0x94')]);})['then'](function(_0x110e02){_0x2088ca=_0x110e02;logger[_0x0fa2('0x38')]('The\x20User\x20ID\x20is:',_0x2088ca['id']);return getEndUser(_0x16e4dd,_0x5c19df,_0x58787e,_0x1deea3[_0x0fa2('0x95')],_0x1deea3['destcalleridnum'],_0x2088ca,_0x561fc6);})[_0x0fa2('0x34')](function(_0x444a48){_0x3dfc6f=_0x444a48;return getCall(_0x16e4dd,_0x5c19df,_0x58787e,_0x2088ca,_0x3dfc6f,_0x561fc6,_0x1deea3,_0x0fa2('0x96'));})[_0x0fa2('0x34')](function(_0x365081){if(_0x365081){logger['info'](_0x0fa2('0x8b'),_0x365081['id']);logger[_0x0fa2('0x38')](_0x0fa2('0x92'),_0x0fa2('0x8c'));emit(util[_0x0fa2('0x6b')]('user:%s',_0x5b82bd[_0x0fa2('0x1e')]),_0x0fa2('0x97'),{'uri':_0x0fa2('0x8e')+_0x58787e['host']+_0x0fa2('0x8f')+_0x365081['id']});}})[_0x0fa2('0x30')](function(_0x1f1e2d){logger[_0x0fa2('0x3d')](_0x0fa2('0x92'),JSON['stringify'](_0x1f1e2d));});};exports[_0x0fa2('0x98')]=function(_0x25e9a6,_0x381ecf,_0x1b6863,_0x515f3b,_0x56fcd6,_0x1b52d9){var _0x3afdaa,_0xef6995,_0x1f9d6c;_0x1b52d9[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x1b52d9[_0x0fa2('0x7e')]);_0x1b52d9['serverUrl']=intUtil[_0x0fa2('0x99')](_0x1b52d9[_0x0fa2('0x7f')]);if(_0x56fcd6&&_0x56fcd6[_0x0fa2('0x9a')]){logger['info']('['+_0x381ecf['lastevent'][_0x0fa2('0x9b')]()+']',_0x0fa2('0x81'));_0x381ecf[_0x0fa2('0x85')]=_0x1b52d9[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x381ecf[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x381ecf[_0x0fa2('0x83')]);}else{_0x381ecf[_0x0fa2('0x85')]='';}var _0xf8acbb=_0x1b52d9[_0x0fa2('0x7e')]===_0x0fa2('0x93')?'eu':_0x0fa2('0x86');return getAccessToken(_0x1b52d9)[_0x0fa2('0x34')](function(_0x5a4879){_0x1f9d6c=_0x5a4879;return getUser(_0x1f9d6c,_0xf8acbb,_0x1b52d9);})[_0x0fa2('0x34')](function(_0x39ab2c){_0x3afdaa=_0x39ab2c;logger[_0x0fa2('0x38')](_0x0fa2('0x87'),_0x3afdaa['id']);return getEndUser(_0x1f9d6c,_0xf8acbb,_0x1b52d9,_0x381ecf['calleridname'],_0x381ecf[_0x0fa2('0x89')],_0x3afdaa,_0x1b6863);})[_0x0fa2('0x34')](function(_0x29d984){_0xef6995=_0x29d984;return getCall(_0x1f9d6c,_0xf8acbb,_0x1b52d9,_0x3afdaa,_0xef6995,_0x1b6863,_0x381ecf,_0x0fa2('0x8a'));})[_0x0fa2('0x34')](function(_0x581aa0){if(_0x581aa0){logger['info']('The\x20Call\x20ID\x20is:',_0x581aa0['id']);}})[_0x0fa2('0x30')](function(_0x312cbb){logger[_0x0fa2('0x3d')]('['+_0x381ecf[_0x0fa2('0x9c')][_0x0fa2('0x9b')]()+']',JSON[_0x0fa2('0x11')](_0x312cbb));});}; \ 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 a9a6a2a..522cfc4 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 _0xc35a=['data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec'];(function(_0x119aed,_0x531f02){var _0x407602=function(_0x8a5e56){while(--_0x8a5e56){_0x119aed['push'](_0x119aed['shift']());}};_0x407602(++_0x531f02);}(_0xc35a,0xaf));var _0xac35=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc35a[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0xac35('0x0'));var sh=require(_0xac35('0x1'));var Mustache=require(_0xac35('0x2'));var logger=require('../../../../config/logger')(_0xac35('0x3'));exports[_0xac35('0x4')]=function(_0x255252,_0x25d016){var _0x7ae0cd=_0x255252['data2']?_0x255252[_0xac35('0x5')]:_0xac35('0x6');var _0x23d97c=_0x255252[_0xac35('0x7')]?Mustache['render'](_0x255252[_0xac35('0x7')],_0x25d016):_0x25d016;sh[_0xac35('0x4')](_0x23d97c,function(_0x1a7f79,_0x314aab,_0x2604c3){if(_0x1a7f79!==0x0){logger['error'](util['format'](_0xac35('0x8'),_0x7ae0cd,_0x23d97c,_0x1a7f79,_0x2604c3));}else{logger[_0xac35('0x9')](util[_0xac35('0xa')](_0xac35('0xb'),_0x7ae0cd,_0x23d97c,_0x314aab));}});}; \ No newline at end of file +var _0x72d9=['util','shelljs','mustache','../../../../config/logger','exec','data2','Script','render','data3','error','format','info'];(function(_0xa0b573,_0x10cf71){var _0x511bb8=function(_0x181672){while(--_0x181672){_0xa0b573['push'](_0xa0b573['shift']());}};_0x511bb8(++_0x10cf71);}(_0x72d9,0x144));var _0x972d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x72d9[_0x4c12ec];return _0x3ae42c;};'use strict';var util=require(_0x972d('0x0'));var sh=require(_0x972d('0x1'));var Mustache=require(_0x972d('0x2'));var logger=require(_0x972d('0x3'))('trigger');exports[_0x972d('0x4')]=function(_0x493d95,_0x28911f){var _0x536daa=_0x493d95[_0x972d('0x5')]?_0x493d95['data2']:_0x972d('0x6');var _0x348e71=_0x493d95['data3']?Mustache[_0x972d('0x7')](_0x493d95[_0x972d('0x8')],_0x28911f):_0x28911f;sh['exec'](_0x348e71,function(_0x32341f,_0x554561,_0x21f3cf){if(_0x32341f!==0x0){logger[_0x972d('0x9')](util[_0x972d('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x536daa,_0x348e71,_0x32341f,_0x21f3cf));}else{logger[_0x972d('0xb')](util[_0x972d('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x536daa,_0x348e71,_0x554561));}});}; \ 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 83bd674..c24ff08 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 _0x7d40=['data1','render','data2','number','data5','headers','parse','data6','error','stack','toUpperCase','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','stringify','%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','request-promise','lodash','mustache','trigger','exec'];(function(_0x10962f,_0xfcbcec){var _0x5c63d4=function(_0x536be9){while(--_0x536be9){_0x10962f['push'](_0x10962f['shift']());}};_0x5c63d4(++_0xfcbcec);}(_0x7d40,0x13b));var _0x07d4=function(_0x4bdb2e,_0x53ae98){_0x4bdb2e=_0x4bdb2e-0x0;var _0x372646=_0x7d40[_0x4bdb2e];return _0x372646;};'use strict';var rp=require(_0x07d4('0x0'));var util=require('util');var _=require(_0x07d4('0x1'));var Mustache=require(_0x07d4('0x2'));var logger=require('../../../../config/logger')(_0x07d4('0x3'));exports[_0x07d4('0x4')]=function(_0x565c65,_0x2fbcd7){var _0x2a6990,_0x6744f2;var _0x462097={'method':_0x565c65[_0x07d4('0x5')]['toUpperCase'](),'uri':Mustache[_0x07d4('0x6')](_0x565c65[_0x07d4('0x7')],_0x2fbcd7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x565c65['data5'])===_0x07d4('0x8')&&parseInt(_0x565c65[_0x07d4('0x9')])>=0x1&&parseInt(_0x565c65[_0x07d4('0x9')])<=0xa?parseInt(_0x565c65['data5'])*0x3e8:0x5*0x3e8};try{_0x462097[_0x07d4('0xa')]=_0x565c65['data6']?JSON[_0x07d4('0xb')](Mustache[_0x07d4('0x6')](_0x565c65[_0x07d4('0xc')],_0x2fbcd7)):{};}catch(_0x1a5a3c){logger[_0x07d4('0xd')](_0x1a5a3c[_0x07d4('0xe')]);}switch(_0x565c65['data1'][_0x07d4('0xf')]()){case _0x07d4('0x10'):case _0x07d4('0x11'):_0x2a6990=null;_0x462097['qs']=_0x2fbcd7;break;case'POST':case _0x07d4('0x12'):if(_0x565c65['data7']){try{_0x2a6990=JSON[_0x07d4('0xb')](Mustache[_0x07d4('0x6')](_0x565c65[_0x07d4('0x13')],_0x2fbcd7));_0x462097[_0x07d4('0x14')]=_0x2a6990;}catch(_0x53718a){logger[_0x07d4('0xd')](_0x53718a['stack']);logger['error'](_0x07d4('0x15'));}}else{_0x2a6990=_0x2fbcd7;_0x462097[_0x07d4('0x14')]=_0x2a6990;}break;}logger['info'](util[_0x07d4('0x16')](_0x07d4('0x17'),_0x565c65[_0x07d4('0x5')],_0x565c65['data2'],JSON['stringify'](_0x462097)));rp(_0x462097)[_0x07d4('0x18')](function(_0x4ff08b){_0x2a6990=!_[_0x07d4('0x19')](_0x2a6990)?',\x20request\x20body:\x20'+_0x2a6990:'';_0x6744f2=typeof _0x4ff08b[_0x07d4('0x14')]==='object'?JSON[_0x07d4('0x1a')](_0x4ff08b[_0x07d4('0x14')]):_0x4ff08b[_0x07d4('0x14')];logger['info'](util[_0x07d4('0x16')](_0x07d4('0x1b'),_0x565c65['data1'],_0x565c65[_0x07d4('0x7')],_0x4ff08b['statusCode'],_0x6744f2));})[_0x07d4('0x1c')](function(_0x1cc1e9){logger['error'](util[_0x07d4('0x16')](_0x07d4('0x1d'),_0x565c65[_0x07d4('0x5')],_0x565c65[_0x07d4('0x7')],_0x1cc1e9[_0x07d4('0x1e')],_0x1cc1e9[_0x07d4('0x1f')],_0x1cc1e9['message']));});}; \ No newline at end of file +var _0x8902=['request-promise','util','trigger','exec','data1','toUpperCase','data5','headers','data6','parse','stack','GET','POST','PUT','data7','render','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8902,0xd9));var _0x2890=function(_0x323a7b,_0x4c1f83){_0x323a7b=_0x323a7b-0x0;var _0x442d03=_0x8902[_0x323a7b];return _0x442d03;};'use strict';var rp=require(_0x2890('0x0'));var util=require(_0x2890('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x2890('0x2'));exports[_0x2890('0x3')]=function(_0x322091,_0x2b1375){var _0x23e36b,_0x44f5c8;var _0x13c3e4={'method':_0x322091[_0x2890('0x4')][_0x2890('0x5')](),'uri':Mustache['render'](_0x322091['data2'],_0x2b1375),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x322091[_0x2890('0x6')])==='number'&&parseInt(_0x322091[_0x2890('0x6')])>=0x1&&parseInt(_0x322091[_0x2890('0x6')])<=0xa?parseInt(_0x322091[_0x2890('0x6')])*0x3e8:0x5*0x3e8};try{_0x13c3e4[_0x2890('0x7')]=_0x322091[_0x2890('0x8')]?JSON[_0x2890('0x9')](Mustache['render'](_0x322091[_0x2890('0x8')],_0x2b1375)):{};}catch(_0x143449){logger['error'](_0x143449[_0x2890('0xa')]);}switch(_0x322091[_0x2890('0x4')][_0x2890('0x5')]()){case _0x2890('0xb'):case'DELETE':_0x23e36b=null;_0x13c3e4['qs']=_0x2b1375;break;case _0x2890('0xc'):case _0x2890('0xd'):if(_0x322091[_0x2890('0xe')]){try{_0x23e36b=JSON[_0x2890('0x9')](Mustache[_0x2890('0xf')](_0x322091[_0x2890('0xe')],_0x2b1375));_0x13c3e4[_0x2890('0x10')]=_0x23e36b;}catch(_0x3ef3d8){logger['error'](_0x3ef3d8[_0x2890('0xa')]);logger[_0x2890('0x11')](_0x2890('0x12'));}}else{_0x23e36b=_0x2b1375;_0x13c3e4[_0x2890('0x10')]=_0x23e36b;}break;}logger['info'](util[_0x2890('0x13')](_0x2890('0x14'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],JSON['stringify'](_0x13c3e4)));rp(_0x13c3e4)['then'](function(_0x1f3e0f){_0x23e36b=!_[_0x2890('0x16')](_0x23e36b)?_0x2890('0x17')+_0x23e36b:'';_0x44f5c8=typeof _0x1f3e0f[_0x2890('0x10')]===_0x2890('0x18')?JSON[_0x2890('0x19')](_0x1f3e0f[_0x2890('0x10')]):_0x1f3e0f[_0x2890('0x10')];logger[_0x2890('0x1a')](util[_0x2890('0x13')](_0x2890('0x1b'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],_0x1f3e0f['statusCode'],_0x44f5c8));})['catch'](function(_0x228be8){logger['error'](util[_0x2890('0x13')](_0x2890('0x1c'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],_0x228be8[_0x2890('0x1d')],_0x228be8['name'],_0x228be8[_0x2890('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6ba729e..8b77ce0 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 _0xb757=['rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','http','request','debug','error'];(function(_0x18a386,_0x2982b6){var _0x4d4d3e=function(_0x40f911){while(--_0x40f911){_0x18a386['push'](_0x18a386['shift']());}};_0x4d4d3e(++_0x2982b6);}(_0xb757,0x148));var _0x7b75=function(_0x1b39cc,_0x1ca2f8){_0x1b39cc=_0x1b39cc-0x0;var _0x4df502=_0xb757[_0x1b39cc];return _0x4df502;};'use strict';var jayson=require(_0x7b75('0x0'));var BPromise=require(_0x7b75('0x1'));var logger=require(_0x7b75('0x2'))(_0x7b75('0x3'));var client=jayson['client'][_0x7b75('0x4')]({'port':0x2329});client['Request']=function(_0x4d0265,_0x395334){return new BPromise(function(_0x2ea5ce,_0x5c7e9c){return client[_0x7b75('0x5')](_0x4d0265,_0x395334)['then'](function(_0x36e942){logger[_0x7b75('0x6')]('rpc',_0x7b75('0x3'),_0x4d0265,_0x395334,_0x36e942);if(_0x36e942['error']){logger[_0x7b75('0x7')](_0x7b75('0x8'),_0x7b75('0x3'),_0x4d0265,_0x36e942['error']['message'],_0x395334);return _0x5c7e9c(_0x36e942[_0x7b75('0x7')][_0x7b75('0x9')]);}else{return _0x2ea5ce(_0x36e942[_0x7b75('0xa')]);}})[_0x7b75('0xb')](function(_0x5a3770){logger[_0x7b75('0x7')](_0x7b75('0x8'),_0x7b75('0x3'),_0x4d0265,_0x5a3770,_0x395334);return _0x5c7e9c(_0x5a3770);});});};module['exports']=client; \ No newline at end of file +var _0x96cc=['message','result','catch','exports','jayson/promise','../../config/logger','client','Request','request','then','debug','routing','error','rpc'];(function(_0x2511cd,_0x540090){var _0x31ba26=function(_0x1f9896){while(--_0x1f9896){_0x2511cd['push'](_0x2511cd['shift']());}};_0x31ba26(++_0x540090);}(_0x96cc,0x1e0));var _0xc96c=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0x96cc[_0x4d578c];return _0xf41cac;};'use strict';var jayson=require(_0xc96c('0x0'));var BPromise=require('bluebird');var logger=require(_0xc96c('0x1'))('routing');var client=jayson[_0xc96c('0x2')]['http']({'port':0x2329});client[_0xc96c('0x3')]=function(_0x2e0f57,_0x44f7d7){return new BPromise(function(_0x223913,_0x310dda){return client[_0xc96c('0x4')](_0x2e0f57,_0x44f7d7)[_0xc96c('0x5')](function(_0x2bf955){logger[_0xc96c('0x6')]('rpc',_0xc96c('0x7'),_0x2e0f57,_0x44f7d7,_0x2bf955);if(_0x2bf955[_0xc96c('0x8')]){logger[_0xc96c('0x8')](_0xc96c('0x9'),'routing',_0x2e0f57,_0x2bf955['error'][_0xc96c('0xa')],_0x44f7d7);return _0x310dda(_0x2bf955[_0xc96c('0x8')]['message']);}else{return _0x223913(_0x2bf955[_0xc96c('0xb')]);}})[_0xc96c('0xc')](function(_0x147cc8){logger['error']('rpc',_0xc96c('0x7'),_0x2e0f57,_0x147cc8,_0x44f7d7);return _0x310dda(_0x147cc8);});});};module[_0xc96c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 20b98db..09fffad 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 _0xb45d=['./rpc/setting','../../config/logger','email','resolve','then','refresh','mailAccounts','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb45d,0xfa));var _0xdb45=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0xb45d[_0x348652];return _0x18a9ea;};'use strict';var server=require(_0xdb45('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xdb45('0x1'));var setting=require(_0xdb45('0x2'));var logger=require(_0xdb45('0x3'))(_0xdb45('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xdb45('0x5')]()[_0xdb45('0x6')](mailAccount['getMailAccounts']())[_0xdb45('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xdb45('0x7')](realtime[_0xdb45('0x8')]);return realtime;});}function main(){return server[_0xdb45('0x9')](realtime,email)[_0xdb45('0x6')](function(){return initRealtime();})[_0xdb45('0x6')](function(){return setting[_0xdb45('0xa')]();})[_0xdb45('0x6')](function(_0x70f2f3){return setInterval(initRealtime,_0x70f2f3['loginMailFrequency']*0x3e8);})[_0xdb45('0xb')](function(_0x33d2e5){logger[_0xdb45('0xc')](_0xdb45('0xd'),_0x33d2e5);});}main(); \ No newline at end of file +var _0x4a59=['initMailAccounts','refresh','listen','loginMailFrequency','catch','error','./server','./realtime','./lib/email','../../config/logger','email','resolve','then'];(function(_0x3162fc,_0x4036f8){var _0x343423=function(_0x500d9b){while(--_0x500d9b){_0x3162fc['push'](_0x3162fc['shift']());}};_0x343423(++_0x4036f8);}(_0x4a59,0x14b));var _0x94a5=function(_0x4eab4b,_0x152d5b){_0x4eab4b=_0x4eab4b-0x0;var _0x576b6d=_0x4a59[_0x4eab4b];return _0x576b6d;};'use strict';var server=require(_0x94a5('0x0'));var Realtime=require(_0x94a5('0x1'));var EmailChannel=require(_0x94a5('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x94a5('0x3'))(_0x94a5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x94a5('0x5')]()[_0x94a5('0x6')](mailAccount['getMailAccounts']())[_0x94a5('0x6')](realtime[_0x94a5('0x7')]())[_0x94a5('0x6')](function(){email[_0x94a5('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x94a5('0x9')](realtime,email)[_0x94a5('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x94a5('0x6')](function(_0x4342ca){return setInterval(initRealtime,_0x4342ca[_0x94a5('0xa')]*0x3e8);})[_0x94a5('0xb')](function(_0x2f9e43){logger[_0x94a5('0xc')]('Email\x20service\x20initialization',_0x2f9e43);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a3a2605..c151ac8 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 _0xb04c=['email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0x321954,_0x521d0d){var _0x298847=function(_0x6107dd){while(--_0x6107dd){_0x321954['push'](_0x321954['shift']());}};_0x298847(++_0x521d0d);}(_0xb04c,0x189));var _0xcb04=function(_0x15d88e,_0x484afd){_0x15d88e=_0x15d88e-0x0;var _0x3d0f2e=_0xb04c[_0x15d88e];return _0x3d0f2e;};'use strict';var _=require('lodash');var moment=require(_0xcb04('0x0'));var BPromise=require(_0xcb04('0x1'));var md5=require(_0xcb04('0x2'));var Redis=require(_0xcb04('0x3'));var config=require(_0xcb04('0x4'));var logger=require(_0xcb04('0x5'))(_0xcb04('0x6'));config[_0xcb04('0x7')]=_[_0xcb04('0x8')](config[_0xcb04('0x7')],{'host':_0xcb04('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xcb04('0xa'));var EmailSmtp=require(_0xcb04('0xb'));var mailAccount=require(_0xcb04('0xc'));var md5Accounts={};function EmailChannel(_0x17a7d1){logger['info']('start\x20email\x20channel');this[_0xcb04('0xd')]=_0x17a7d1[_0xcb04('0xd')];this['imapAccounts']={};this[_0xcb04('0xe')]=new EmailSmtp();}EmailChannel[_0xcb04('0xf')][_0xcb04('0x10')]=function(_0x54f0f0){var _0x2ef817=this[_0xcb04('0xd')][_0x54f0f0];var _0x53fc21={'id':_0x2ef817['id'],'name':_0x2ef817[_0xcb04('0x11')],'key':_0x2ef817[_0xcb04('0x12')],'active':_0x2ef817[_0xcb04('0x13')],'Imap':{'status':_0x2ef817[_0xcb04('0x14')][_0xcb04('0x15')],'messageStatus':_0x2ef817[_0xcb04('0x14')][_0xcb04('0x16')],'total':_0x2ef817[_0xcb04('0x14')][_0xcb04('0x17')]}};if(_[_0xcb04('0x18')](md5Accounts[_0x54f0f0])){md5Accounts[_0x54f0f0]={};}var _0x4d02f1=md5(JSON[_0xcb04('0x19')](_0x53fc21));if(md5Accounts[_0x54f0f0][_0xcb04('0x2')]!==_0x4d02f1){md5Accounts[_0x54f0f0][_0xcb04('0x2')]=_0x4d02f1;io['emit'](_0xcb04('0x1a'),_0x53fc21);}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x1b')]=function(_0x3034c8){for(var _0x2dcc7d in _0x3034c8){if(_0x3034c8[_0xcb04('0x1c')](_0x2dcc7d)){if(_0x3034c8[_0x2dcc7d][_0xcb04('0x14')]&&_0x3034c8[_0x2dcc7d][_0xcb04('0x13')]){var _0x393a58=_0x3034c8[_0x2dcc7d][_0xcb04('0x14')];if(!_0x393a58['service']&&_0x3034c8[_0x2dcc7d][_0xcb04('0x1d')]!==_0xcb04('0x1e'))_0x393a58[_0xcb04('0x1f')]=_0x3034c8[_0x2dcc7d]['provider'];if(!this[_0xcb04('0x20')][_0xcb04('0x1c')](_0x393a58['id'])){this[_0xcb04('0x20')][_0x393a58['id']]=new EmailImap(_0x393a58,_0x3034c8[_0x2dcc7d][_0xcb04('0x6')]);this[_0xcb04('0x20')][_0x393a58['id']]['on'](_0xcb04('0x21'),this[_0xcb04('0x22')][_0xcb04('0x23')](this,_0x2dcc7d));this[_0xcb04('0x20')][_0x393a58['id']]['on'](_0xcb04('0x6'),this['handleImapEmail']['bind'](this,_0x2dcc7d));this[_0xcb04('0x20')][_0x393a58['id']]['on'](_0xcb04('0x24'),this[_0xcb04('0x25')]['bind'](this,_0x2dcc7d));this[_0xcb04('0x20')][_0x393a58['id']]['on'](_0xcb04('0x26'),this[_0xcb04('0x27')][_0xcb04('0x23')](this,_0x2dcc7d));}}else{if(_[_0xcb04('0x18')](this[_0xcb04('0xd')][_0x2dcc7d][_0xcb04('0x14')])){this[_0xcb04('0xd')][_0x2dcc7d][_0xcb04('0x14')]={};}this['mailAccounts'][_0x2dcc7d][_0xcb04('0x14')]['status']=_0xcb04('0x28');this[_0xcb04('0xd')][_0x2dcc7d][_0xcb04('0x14')][_0xcb04('0x16')]='';this[_0xcb04('0x10')](_0x2dcc7d);}}}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x22')]=function(_0x1f7994,_0x34520a){if(this[_0xcb04('0xd')][_0x1f7994]){this['mailAccounts'][_0x1f7994][_0xcb04('0x14')][_0xcb04('0x15')]=_0xcb04('0x29');this[_0xcb04('0xd')][_0x1f7994]['Imap'][_0xcb04('0x16')]=_0x34520a[_0xcb04('0x11')];if(_0x34520a[_0xcb04('0x2a')]){this['mailAccounts'][_0x1f7994]['Imap'][_0xcb04('0x17')]=_0x34520a[_0xcb04('0x2a')]['total'];}return this['emit'](_0x1f7994);}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x2b')]=function(_0x520287,_0x1d7cbf){logger['info'](_0xcb04('0x2c'),_0x1d7cbf['firstName'],_0x1d7cbf['lastName'],_0x1d7cbf[_0xcb04('0x2d')],_0x520287);if(this[_0xcb04('0xd')][_0x520287]){return mailAccount['notify'](_0x520287,_0x1d7cbf)[_0xcb04('0x2e')](function(_0xcbd877){if(_0xcbd877){logger['info'](_0xcb04('0x2f'));}})[_0xcb04('0x30')](function(_0x34acf1){logger[_0xcb04('0x26')](_0xcb04('0x31'),JSON[_0xcb04('0x19')](_0x34acf1));});}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x25')]=function(_0x31b3b0){if(this[_0xcb04('0xd')][_0x31b3b0]&&this['mailAccounts'][_0x31b3b0][_0xcb04('0x14')]){if(this[_0xcb04('0x20')][this[_0xcb04('0xd')][_0x31b3b0]['Imap']['id']]){delete this[_0xcb04('0x20')][this[_0xcb04('0xd')][_0x31b3b0][_0xcb04('0x14')]['id']];}this[_0xcb04('0xd')][_0x31b3b0][_0xcb04('0x14')][_0xcb04('0x32')]=moment();this[_0xcb04('0x10')](_0x31b3b0);}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x27')]=function(_0x473a5a,_0x428bd3){if(this[_0xcb04('0xd')][_0x473a5a]){this[_0xcb04('0xd')][_0x473a5a][_0xcb04('0x14')][_0xcb04('0x15')]=_0xcb04('0x26');this[_0xcb04('0xd')][_0x473a5a][_0xcb04('0x14')][_0xcb04('0x16')]=_0x428bd3;return this[_0xcb04('0x10')](_0x473a5a);}};EmailChannel[_0xcb04('0xf')][_0xcb04('0x33')]=function(_0x30bf29,_0x5ba300){return this[_0xcb04('0xe')][_0xcb04('0x34')](_0x30bf29,_0x5ba300);};EmailChannel['prototype'][_0xcb04('0x35')]=function(_0x5348d6){var _0x2645c8=this;if(this[_0xcb04('0xd')][_0x5348d6['id']]){if(_[_0xcb04('0x18')](this[_0xcb04('0xd')][_0x5348d6['id']]['Smtp'])){this[_0xcb04('0xd')][_0x5348d6['id']]['Smtp']={};}this[_0xcb04('0xd')][_0x5348d6['id']][_0xcb04('0x36')]['lastSync']=moment();return new BPromise(function(_0x7522f5,_0x121456){return _0x2645c8[_0xcb04('0xe')]['verify'](_0x5348d6)[_0xcb04('0x2e')](function(_0x56062a){_0x2645c8[_0xcb04('0xd')][_0x5348d6['id']][_0xcb04('0x36')][_0xcb04('0x15')]='verified';_0x2645c8['mailAccounts'][_0x5348d6['id']][_0xcb04('0x36')][_0xcb04('0x16')]='';_0x2645c8['emit'](_0x5348d6['id']);_0x7522f5(_0x56062a);})[_0xcb04('0x30')](function(_0x46c544){_0x2645c8[_0xcb04('0xd')][_0x5348d6['id']]['Smtp'][_0xcb04('0x15')]='error';_0x2645c8[_0xcb04('0xd')][_0x5348d6['id']][_0xcb04('0x36')][_0xcb04('0x16')]=_0x46c544;_0x2645c8[_0xcb04('0x10')](_0x5348d6['id']);_0x121456(_0x46c544);});});}return this['smtp'][_0xcb04('0x37')](_0x5348d6);};module[_0xcb04('0x38')]=EmailChannel; \ No newline at end of file +var _0xdb74=['Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','connected','messages','firstName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send'];(function(_0x2d03b1,_0x4ab3bc){var _0x2841bc=function(_0x52a193){while(--_0x52a193){_0x2d03b1['push'](_0x2d03b1['shift']());}};_0x2841bc(++_0x4ab3bc);}(_0xdb74,0x193));var _0x4db7=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xdb74[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4db7('0x0'));var moment=require(_0x4db7('0x1'));var BPromise=require('bluebird');var md5=require(_0x4db7('0x2'));var Redis=require(_0x4db7('0x3'));var config=require(_0x4db7('0x4'));var logger=require(_0x4db7('0x5'))(_0x4db7('0x6'));config[_0x4db7('0x7')]=_[_0x4db7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4db7('0x9'))(new Redis(config[_0x4db7('0x7')]));var EmailImap=require(_0x4db7('0xa'));var EmailSmtp=require(_0x4db7('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x26132b){logger['info']('start\x20email\x20channel');this[_0x4db7('0xc')]=_0x26132b[_0x4db7('0xc')];this[_0x4db7('0xd')]={};this[_0x4db7('0xe')]=new EmailSmtp();}EmailChannel[_0x4db7('0xf')][_0x4db7('0x10')]=function(_0x5e4383){var _0x295d6f=this[_0x4db7('0xc')][_0x5e4383];var _0xcea444={'id':_0x295d6f['id'],'name':_0x295d6f[_0x4db7('0x11')],'key':_0x295d6f[_0x4db7('0x12')],'active':_0x295d6f['active'],'Imap':{'status':_0x295d6f[_0x4db7('0x13')][_0x4db7('0x14')],'messageStatus':_0x295d6f[_0x4db7('0x13')][_0x4db7('0x15')],'total':_0x295d6f['Imap'][_0x4db7('0x16')]}};if(_[_0x4db7('0x17')](md5Accounts[_0x5e4383])){md5Accounts[_0x5e4383]={};}var _0x18c061=md5(JSON[_0x4db7('0x18')](_0xcea444));if(md5Accounts[_0x5e4383]['md5']!==_0x18c061){md5Accounts[_0x5e4383][_0x4db7('0x2')]=_0x18c061;io[_0x4db7('0x10')](_0x4db7('0x19'),_0xcea444);}};EmailChannel[_0x4db7('0xf')][_0x4db7('0x1a')]=function(_0x5698e8){for(var _0x163fa5 in _0x5698e8){if(_0x5698e8[_0x4db7('0x1b')](_0x163fa5)){if(_0x5698e8[_0x163fa5][_0x4db7('0x13')]&&_0x5698e8[_0x163fa5][_0x4db7('0x1c')]){var _0x48c036=_0x5698e8[_0x163fa5]['Imap'];if(!_0x48c036[_0x4db7('0x1d')]&&_0x5698e8[_0x163fa5][_0x4db7('0x1e')]!==_0x4db7('0x1f'))_0x48c036[_0x4db7('0x1d')]=_0x5698e8[_0x163fa5]['provider'];if(!this[_0x4db7('0xd')][_0x4db7('0x1b')](_0x48c036['id'])){this[_0x4db7('0xd')][_0x48c036['id']]=new EmailImap(_0x48c036,_0x5698e8[_0x163fa5][_0x4db7('0x6')]);this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x20'),this[_0x4db7('0x21')][_0x4db7('0x22')](this,_0x163fa5));this['imapAccounts'][_0x48c036['id']]['on'](_0x4db7('0x6'),this[_0x4db7('0x23')]['bind'](this,_0x163fa5));this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x24'),this['handleImapEnd'][_0x4db7('0x22')](this,_0x163fa5));this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x25'),this[_0x4db7('0x26')][_0x4db7('0x22')](this,_0x163fa5));}}else{if(_[_0x4db7('0x17')](this[_0x4db7('0xc')][_0x163fa5][_0x4db7('0x13')])){this['mailAccounts'][_0x163fa5]['Imap']={};}this['mailAccounts'][_0x163fa5][_0x4db7('0x13')][_0x4db7('0x14')]='disabled';this[_0x4db7('0xc')][_0x163fa5][_0x4db7('0x13')]['messageStatus']='';this[_0x4db7('0x10')](_0x163fa5);}}}};EmailChannel[_0x4db7('0xf')]['handleImapBox']=function(_0x4e3f99,_0x8e8464){if(this['mailAccounts'][_0x4e3f99]){this['mailAccounts'][_0x4e3f99][_0x4db7('0x13')][_0x4db7('0x14')]=_0x4db7('0x27');this[_0x4db7('0xc')][_0x4e3f99]['Imap'][_0x4db7('0x15')]=_0x8e8464[_0x4db7('0x11')];if(_0x8e8464[_0x4db7('0x28')]){this[_0x4db7('0xc')][_0x4e3f99]['Imap'][_0x4db7('0x16')]=_0x8e8464[_0x4db7('0x28')][_0x4db7('0x16')];}return this[_0x4db7('0x10')](_0x4e3f99);}};EmailChannel[_0x4db7('0xf')][_0x4db7('0x23')]=function(_0x51f384,_0x3955f9){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3955f9[_0x4db7('0x29')],_0x3955f9['lastName'],_0x3955f9[_0x4db7('0x2a')],_0x51f384);if(this['mailAccounts'][_0x51f384]){return mailAccount[_0x4db7('0x2b')](_0x51f384,_0x3955f9)[_0x4db7('0x2c')](function(_0x44202c){if(_0x44202c){logger[_0x4db7('0x2d')](_0x4db7('0x2e'));}})[_0x4db7('0x2f')](function(_0x2e78b4){logger[_0x4db7('0x25')](_0x4db7('0x30'),JSON[_0x4db7('0x18')](_0x2e78b4));});}};EmailChannel['prototype'][_0x4db7('0x31')]=function(_0x361af0){if(this['mailAccounts'][_0x361af0]&&this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')]){if(this[_0x4db7('0xd')][this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')]['id']]){delete this[_0x4db7('0xd')][this['mailAccounts'][_0x361af0][_0x4db7('0x13')]['id']];}this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')][_0x4db7('0x32')]=moment();this[_0x4db7('0x10')](_0x361af0);}};EmailChannel['prototype'][_0x4db7('0x26')]=function(_0x1f0ce6,_0x47d734){if(this[_0x4db7('0xc')][_0x1f0ce6]){this['mailAccounts'][_0x1f0ce6][_0x4db7('0x13')][_0x4db7('0x14')]=_0x4db7('0x25');this[_0x4db7('0xc')][_0x1f0ce6][_0x4db7('0x13')][_0x4db7('0x15')]=_0x47d734;return this['emit'](_0x1f0ce6);}};EmailChannel['prototype'][_0x4db7('0x33')]=function(_0x533242,_0xb439cd){return this[_0x4db7('0xe')][_0x4db7('0x34')](_0x533242,_0xb439cd);};EmailChannel[_0x4db7('0xf')]['verifySmtp']=function(_0x4f3ed3){var _0x5bd4ed=this;if(this[_0x4db7('0xc')][_0x4f3ed3['id']]){if(_[_0x4db7('0x17')](this[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')])){this[_0x4db7('0xc')][_0x4f3ed3['id']]['Smtp']={};}this[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x32')]=moment();return new BPromise(function(_0x325a19,_0x412ec1){return _0x5bd4ed['smtp'][_0x4db7('0x36')](_0x4f3ed3)[_0x4db7('0x2c')](function(_0x1c7c8e){_0x5bd4ed[_0x4db7('0xc')][_0x4f3ed3['id']]['Smtp'][_0x4db7('0x14')]=_0x4db7('0x37');_0x5bd4ed['mailAccounts'][_0x4f3ed3['id']]['Smtp'][_0x4db7('0x15')]='';_0x5bd4ed[_0x4db7('0x10')](_0x4f3ed3['id']);_0x325a19(_0x1c7c8e);})[_0x4db7('0x2f')](function(_0xe38463){_0x5bd4ed['mailAccounts'][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x14')]='error';_0x5bd4ed[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x15')]=_0xe38463;_0x5bd4ed[_0x4db7('0x10')](_0x4f3ed3['id']);_0x412ec1(_0xe38463);});});}return this[_0x4db7('0xe')][_0x4db7('0x36')](_0x4f3ed3);};module[_0x4db7('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index bf33919..d6f1d46 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 _0x57ca=['handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleEnd','stringify','textCode','upperFirst','exports','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','error','handleError','connect','prototype','connTimeout','authTimeout','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','length','message'];(function(_0x2eed15,_0x2500ef){var _0x338b88=function(_0x24cc4f){while(--_0x24cc4f){_0x2eed15['push'](_0x2eed15['shift']());}};_0x338b88(++_0x2500ef);}(_0x57ca,0x108));var _0xa57c=function(_0x44b3e2,_0x4df17f){_0x44b3e2=_0x44b3e2-0x0;var _0x32b21e=_0x57ca[_0x44b3e2];return _0x32b21e;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var Imap=require(_0xa57c('0x1'));var simpleParser=require('mailparser')[_0xa57c('0x2')];var Iconv=require(_0xa57c('0x3'))[_0xa57c('0x4')];var EventEmitter=require(_0xa57c('0x5'))[_0xa57c('0x6')];var utils=require('./utils');var logger=require(_0xa57c('0x7'))(_0xa57c('0x8'));function EmailImap(_0x113dcf,_0x19473f){this[_0xa57c('0x9')]=_0xa57c('0xa');this[_0xa57c('0xb')]=this[_0xa57c('0xc')](_0x113dcf,_0x19473f);this['imap']=new Imap(this[_0xa57c('0xb')]);this['imap'][_0xa57c('0xd')](_0xa57c('0xe'),this['handleReady'][_0xa57c('0xf')](this));this['imap'][_0xa57c('0xd')](_0xa57c('0x10'),this['handleEnd'][_0xa57c('0xf')](this));this['imap']['on'](_0xa57c('0x11'),this[_0xa57c('0x12')][_0xa57c('0xf')](this));this[_0xa57c('0x1')][_0xa57c('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xa57c('0x14')]['getAccount']=function(_0x30d23d,_0x3d5995){var _0x30940d={'connTimeout':_0x30d23d[_0xa57c('0x15')]?_0x30d23d[_0xa57c('0x15')]*0x3e8:0x2710,'authTimeout':_0x30d23d[_0xa57c('0x16')]?_0x30d23d[_0xa57c('0x16')]*0x3e8:0x1388};if(_0x30d23d['service']){_0x30940d[_0xa57c('0x17')]=_0x30d23d[_0xa57c('0x17')];_0x30940d[_0xa57c('0x8')]=_0x3d5995||_0x30d23d['user']||_0xa57c('0x18');if(_0x30d23d['modernAuthentication']){_0x30940d[_0xa57c('0x19')]=utils[_0xa57c('0x1a')](_0x30d23d[_0xa57c('0x1b')][_0xa57c('0x1c')],_0x30d23d[_0xa57c('0x17')]);}else{_0x30940d[_0xa57c('0x1d')]=_0x30d23d[_0xa57c('0x1d')];}}else{if(_0x30d23d[_0xa57c('0x1e')]){_0x30940d['user']=_0x30d23d[_0xa57c('0x17')];_0x30940d['password']=_0x30d23d['password'];}}_0x30940d[_0xa57c('0x1f')]=_0x30d23d[_0xa57c('0x1f')];_0x30940d[_0xa57c('0x20')]=_0x30d23d[_0xa57c('0x20')]||0x3e1;if(_0x30d23d['tls']){_0x30940d[_0xa57c('0x21')]=!![];}else{_0x30940d[_0xa57c('0x21')]=![];_0x30940d[_0xa57c('0x22')]=_0xa57c('0x23');}return _0x30940d;};EmailImap[_0xa57c('0x14')][_0xa57c('0x24')]=function(){this[_0xa57c('0x1')][_0xa57c('0x25')](this[_0xa57c('0x9')],![],this[_0xa57c('0x26')][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x26')]=function(_0x10a33d,_0x431bec){if(_0x10a33d){this['handleError'](_0x10a33d,!![]);}else{this[_0xa57c('0x27')](_0xa57c('0x28'),_0x431bec);this[_0xa57c('0x29')]();}};EmailImap[_0xa57c('0x14')][_0xa57c('0x2a')]=function(_0x1e8e45){if(_0x1e8e45){this[_0xa57c('0x12')](_0x1e8e45,!![]);}else{this[_0xa57c('0x1')][_0xa57c('0x10')]();}};EmailImap[_0xa57c('0x14')]['readUnseen']=function(){this[_0xa57c('0x1')]['search'](['UNSEEN'],this[_0xa57c('0x2b')][_0xa57c('0xf')](this));};EmailImap['prototype'][_0xa57c('0x2b')]=function(_0x1ef331,_0x3eb9e9){if(_0x1ef331){this['handleError'](_0x1ef331,!![]);}else{if(_0x3eb9e9[_0xa57c('0x2c')]){try{var _0x58d46f=this[_0xa57c('0x1')]['fetch'](_0x3eb9e9,{'bodies':'','markSeen':!![]});_0x58d46f['on'](_0xa57c('0x2d'),this['handleFetchMessage'][_0xa57c('0xf')](this));_0x58d46f['once'](_0xa57c('0x11'),this[_0xa57c('0x2e')][_0xa57c('0xf')](this));_0x58d46f[_0xa57c('0xd')](_0xa57c('0x10'),this[_0xa57c('0x2f')][_0xa57c('0xf')](this));}catch(_0x5aa91e){logger[_0xa57c('0x11')](_0x5aa91e);}}else{this['imap'][_0xa57c('0x30')](!![],this[_0xa57c('0x2a')][_0xa57c('0xf')](this));}}};EmailImap['prototype'][_0xa57c('0x31')]=function(_0x4901a8){_0x4901a8['on'](_0xa57c('0x32'),this['handleMessageBody'][_0xa57c('0xf')](this));_0x4901a8['once'](_0xa57c('0x33'),this[_0xa57c('0x34')]['bind'](this));_0x4901a8[_0xa57c('0xd')]('end',this[_0xa57c('0x35')]['bind'](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x36')]=function(_0x205ee5){simpleParser(_0x205ee5,{'Iconv':Iconv},this[_0xa57c('0x37')][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0xa57c('0x35')]=function(){};EmailImap[_0xa57c('0x14')][_0xa57c('0x37')]=function(_0x570f6c,_0x12b644){if(_0x570f6c){logger['error'](_0x570f6c);}else{var _0x203228=this;utils[_0xa57c('0x38')](this['account'],_0x12b644,function(_0x558cf7){_0x203228['emit'](_0xa57c('0x8'),_0x558cf7);});}};EmailImap[_0xa57c('0x14')][_0xa57c('0x2f')]=function(){this[_0xa57c('0x1')][_0xa57c('0x30')](!![],this[_0xa57c('0x2a')]['bind'](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x2e')]=function(_0x5a5490){this['handleError'](_0x5a5490);this[_0xa57c('0x1')][_0xa57c('0x30')](!![],this['handleCloseBox'][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x39')]=function(){this[_0xa57c('0x27')](_0xa57c('0x10'));};EmailImap[_0xa57c('0x14')]['handleError']=function(_0xa7b441,_0x527c0f){logger['error']('handleError',this['account']['email'],JSON[_0xa57c('0x3a')](_0xa7b441));var _0x32ed25='';if(_0xa7b441){if(_0xa7b441[_0xa57c('0x3b')]){_0x32ed25=_0xa7b441['textCode'];}else{for(var _0x4cd045 in _0xa7b441){if(_0xa7b441['hasOwnProperty'](_0x4cd045)){_0x32ed25+=_[_0xa57c('0x3c')](_0x4cd045)+':\x20'+_0xa7b441[_0x4cd045]+'\x0a';}}}}if(_0x527c0f){this[_0xa57c('0x1')][_0xa57c('0x10')]();}else{this[_0xa57c('0x27')](_0xa57c('0x11'),_0x32ed25);this[_0xa57c('0x27')]('end');}};module[_0xa57c('0x3d')]=EmailImap; \ No newline at end of file +var _0x47c5=['service','user','anonymous@xcally.com','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','parser','emit','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout'];(function(_0x554622,_0x431310){var _0x1e8aca=function(_0xe7cfcd){while(--_0xe7cfcd){_0x554622['push'](_0x554622['shift']());}};_0x1e8aca(++_0x431310);}(_0x47c5,0x165));var _0x547c=function(_0x14f8f0,_0x5e2d51){_0x14f8f0=_0x14f8f0-0x0;var _0x5a1286=_0x47c5[_0x14f8f0];return _0x5a1286;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var Imap=require(_0x547c('0x2'));var simpleParser=require(_0x547c('0x3'))[_0x547c('0x4')];var Iconv=require(_0x547c('0x5'))['Iconv'];var EventEmitter=require(_0x547c('0x6'))[_0x547c('0x7')];var utils=require('./utils');var logger=require(_0x547c('0x8'))(_0x547c('0x9'));function EmailImap(_0x51ab7f,_0x2e5b57){this[_0x547c('0xa')]=_0x547c('0xb');this[_0x547c('0xc')]=this[_0x547c('0xd')](_0x51ab7f,_0x2e5b57);this[_0x547c('0x2')]=new Imap(this[_0x547c('0xc')]);this[_0x547c('0x2')][_0x547c('0xe')](_0x547c('0xf'),this[_0x547c('0x10')][_0x547c('0x11')](this));this[_0x547c('0x2')][_0x547c('0xe')](_0x547c('0x12'),this[_0x547c('0x13')][_0x547c('0x11')](this));this['imap']['on'](_0x547c('0x14'),this[_0x547c('0x15')]['bind'](this));this[_0x547c('0x2')][_0x547c('0x16')]();}util[_0x547c('0x17')](EmailImap,EventEmitter);EmailImap[_0x547c('0x18')][_0x547c('0xd')]=function(_0x150317,_0x2bc289){var _0xa3c7b0={'connTimeout':_0x150317[_0x547c('0x19')]?_0x150317[_0x547c('0x19')]*0x3e8:0x2710,'authTimeout':_0x150317[_0x547c('0x1a')]?_0x150317[_0x547c('0x1a')]*0x3e8:0x1388};if(_0x150317[_0x547c('0x1b')]){_0xa3c7b0[_0x547c('0x1c')]=_0x150317[_0x547c('0x1c')];_0xa3c7b0[_0x547c('0x9')]=_0x2bc289||_0x150317[_0x547c('0x1c')]||_0x547c('0x1d');if(_0x150317['modernAuthentication']){_0xa3c7b0['xoauth2']=utils[_0x547c('0x1e')](_0x150317[_0x547c('0x1f')][_0x547c('0x20')],_0x150317['user']);}else{_0xa3c7b0[_0x547c('0x21')]=_0x150317[_0x547c('0x21')];}}else{if(_0x150317[_0x547c('0x22')]){_0xa3c7b0['user']=_0x150317[_0x547c('0x1c')];_0xa3c7b0[_0x547c('0x21')]=_0x150317['password'];}}_0xa3c7b0['host']=_0x150317[_0x547c('0x23')];_0xa3c7b0[_0x547c('0x24')]=_0x150317['port']||0x3e1;if(_0x150317[_0x547c('0x25')]){_0xa3c7b0[_0x547c('0x25')]=!![];}else{_0xa3c7b0['tls']=![];_0xa3c7b0[_0x547c('0x26')]=_0x547c('0x27');}return _0xa3c7b0;};EmailImap[_0x547c('0x18')]['handleReady']=function(){this[_0x547c('0x2')][_0x547c('0x28')](this[_0x547c('0xa')],![],this[_0x547c('0x29')][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')][_0x547c('0x29')]=function(_0x17fa33,_0x507895){if(_0x17fa33){this[_0x547c('0x15')](_0x17fa33,!![]);}else{this['emit']('box',_0x507895);this['readUnseen']();}};EmailImap['prototype'][_0x547c('0x2a')]=function(_0x4c5256){if(_0x4c5256){this[_0x547c('0x15')](_0x4c5256,!![]);}else{this['imap'][_0x547c('0x12')]();}};EmailImap['prototype'][_0x547c('0x2b')]=function(){this[_0x547c('0x2')][_0x547c('0x2c')]([_0x547c('0x2d')],this[_0x547c('0x2e')]['bind'](this));};EmailImap['prototype'][_0x547c('0x2e')]=function(_0x54de6f,_0x303b57){if(_0x54de6f){this[_0x547c('0x15')](_0x54de6f,!![]);}else{if(_0x303b57[_0x547c('0x2f')]){try{var _0x1695be=this[_0x547c('0x2')][_0x547c('0x30')](_0x303b57,{'bodies':'','markSeen':!![]});_0x1695be['on'](_0x547c('0x31'),this['handleFetchMessage']['bind'](this));_0x1695be[_0x547c('0xe')](_0x547c('0x14'),this[_0x547c('0x32')][_0x547c('0x11')](this));_0x1695be[_0x547c('0xe')](_0x547c('0x12'),this[_0x547c('0x33')][_0x547c('0x11')](this));}catch(_0x378bac){logger[_0x547c('0x14')](_0x378bac);}}else{this[_0x547c('0x2')][_0x547c('0x34')](!![],this[_0x547c('0x2a')][_0x547c('0x11')](this));}}};EmailImap['prototype'][_0x547c('0x35')]=function(_0x553dcf){_0x553dcf['on']('body',this['handleMessageBody'][_0x547c('0x11')](this));_0x553dcf[_0x547c('0xe')](_0x547c('0x36'),this[_0x547c('0x37')][_0x547c('0x11')](this));_0x553dcf[_0x547c('0xe')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x547c('0x18')][_0x547c('0x38')]=function(_0x3bb9cc){simpleParser(_0x3bb9cc,{'Iconv':Iconv},this[_0x547c('0x39')][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0x547c('0x18')]['handleMessageEnd']=function(){};EmailImap[_0x547c('0x18')][_0x547c('0x39')]=function(_0x5b80f4,_0x380705){if(_0x5b80f4){logger['error'](_0x5b80f4);}else{var _0x511103=this;utils[_0x547c('0x3a')](this[_0x547c('0xc')],_0x380705,function(_0x36bffe){_0x511103[_0x547c('0x3b')]('email',_0x36bffe);});}};EmailImap['prototype'][_0x547c('0x33')]=function(){this[_0x547c('0x2')][_0x547c('0x34')](!![],this['handleCloseBox'][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')][_0x547c('0x32')]=function(_0x5d4476){this[_0x547c('0x15')](_0x5d4476);this[_0x547c('0x2')][_0x547c('0x34')](!![],this['handleCloseBox'][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')]['handleEnd']=function(){this[_0x547c('0x3b')](_0x547c('0x12'));};EmailImap[_0x547c('0x18')]['handleError']=function(_0x62eb2,_0x4f2859){logger[_0x547c('0x14')]('handleError',this[_0x547c('0xc')][_0x547c('0x9')],JSON[_0x547c('0x3c')](_0x62eb2));var _0x3797d3='';if(_0x62eb2){if(_0x62eb2[_0x547c('0x3d')]){_0x3797d3=_0x62eb2[_0x547c('0x3d')];}else{for(var _0x5a271a in _0x62eb2){if(_0x62eb2['hasOwnProperty'](_0x5a271a)){_0x3797d3+=_[_0x547c('0x3e')](_0x5a271a)+':\x20'+_0x62eb2[_0x5a271a]+'\x0a';}}}}if(_0x4f2859){this[_0x547c('0x2')][_0x547c('0x12')]();}else{this['emit'](_0x547c('0x14'),_0x3797d3);this[_0x547c('0x3b')](_0x547c('0x12'));}};module[_0x547c('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0ecf846..2ed9620 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 _0x4424=['send','createTransport','use','compile','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x18786c,_0x349f20){var _0x4d334e=function(_0xe6d38a){while(--_0xe6d38a){_0x18786c['push'](_0x18786c['shift']());}};_0x4d334e(++_0x349f20);}(_0x4424,0x16f));var _0x4442=function(_0x541546,_0x39dbe5){_0x541546=_0x541546-0x0;var _0x3ed70e=_0x4424[_0x541546];return _0x3ed70e;};'use strict';var nodemailer=require(_0x4442('0x0'));var inlineBase64=require(_0x4442('0x1'));function EmailSmtp(){}EmailSmtp[_0x4442('0x2')][_0x4442('0x3')]=function(_0x16ac3a,_0x1f61b4){return new Promise(function(_0x18e897,_0x37fd95){var _0x133341=nodemailer[_0x4442('0x4')](_0x16ac3a);_0x133341[_0x4442('0x5')](_0x4442('0x6'),inlineBase64());_0x133341['sendMail'](_0x1f61b4,function(_0x18145c,_0x1ab2bd){if(_0x18145c){_0x37fd95(_0x18145c[_0x4442('0x7')]());}else{_0x18e897(_0x1ab2bd);}});});};EmailSmtp['prototype'][_0x4442('0x8')]=function(_0x564026){return new Promise(function(_0x1afefc,_0x50a7c1){var _0x2dcae8=nodemailer[_0x4442('0x4')](_0x564026);_0x2dcae8[_0x4442('0x8')](function(_0x3ed152,_0x1c9065){if(_0x3ed152){_0x50a7c1(_0x3ed152['toString']());}else{if(_0x1c9065){_0x1afefc(_0x1c9065);}else{_0x50a7c1('Not\x20verifired');}}});});};module[_0x4442('0x9')]=EmailSmtp; \ No newline at end of file +var _0x1bd9=['compile','sendMail','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x1ab015,_0x2b39c1){var _0x4cff2c=function(_0x461ee5){while(--_0x461ee5){_0x1ab015['push'](_0x1ab015['shift']());}};_0x4cff2c(++_0x2b39c1);}(_0x1bd9,0x118));var _0x91bd=function(_0x1e6b2b,_0x2bddcb){_0x1e6b2b=_0x1e6b2b-0x0;var _0x2add75=_0x1bd9[_0x1e6b2b];return _0x2add75;};'use strict';var nodemailer=require(_0x91bd('0x0'));var inlineBase64=require(_0x91bd('0x1'));function EmailSmtp(){}EmailSmtp[_0x91bd('0x2')][_0x91bd('0x3')]=function(_0x31b504,_0x5ed380){return new Promise(function(_0x46350b,_0x54fd4a){var _0x3dc0b7=nodemailer[_0x91bd('0x4')](_0x31b504);_0x3dc0b7[_0x91bd('0x5')](_0x91bd('0x6'),inlineBase64());_0x3dc0b7[_0x91bd('0x7')](_0x5ed380,function(_0x58cd59,_0x43fb82){if(_0x58cd59){_0x54fd4a(_0x58cd59[_0x91bd('0x8')]());}else{_0x46350b(_0x43fb82);}});});};EmailSmtp[_0x91bd('0x2')][_0x91bd('0x9')]=function(_0x2d2d80){return new Promise(function(_0x2254e7,_0x431bc8){var _0x2f15ac=nodemailer[_0x91bd('0x4')](_0x2d2d80);_0x2f15ac[_0x91bd('0x9')](function(_0x1abe6b,_0x1bfeee){if(_0x1abe6b){_0x431bc8(_0x1abe6b['toString']());}else{if(_0x1bfeee){_0x2254e7(_0x1bfeee);}else{_0x431bc8(_0x91bd('0xa'));}}});});};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 da62bc8..a12c40c 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 _0x9afc=['\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','toString','base64','moment','randomstring','path','util','../../../config/environment','head','value','address','generate','@xcally.com','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20'];(function(_0x3dc587,_0x2ebc6c){var _0x29f93a=function(_0x5ab3d4){while(--_0x5ab3d4){_0x3dc587['push'](_0x3dc587['shift']());}};_0x29f93a(++_0x2ebc6c);}(_0x9afc,0x73));var _0xc9af=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0x9afc[_0x4aa2c9];return _0x212e33;};'use strict';var _=require('lodash');var moment=require(_0xc9af('0x0'));var random=require(_0xc9af('0x1'));var fs=require('fs');var path=require(_0xc9af('0x2'));var util=require(_0xc9af('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0xc9af('0x4'));function getAddress(_0x6714ca){var _0x230a09=_[_0xc9af('0x5')](_0x6714ca[_0xc9af('0x6')]);return _0x230a09&&_0x230a09[_0xc9af('0x7')]?_0x230a09[_0xc9af('0x7')]:'anonymous'+random[_0xc9af('0x8')](0x6)+_0xc9af('0x9');}function getFirstName(_0x412d57){var _0x404973=_['head'](_0x412d57['value']);if(_0x404973&&_0x404973[_0xc9af('0xa')]){if(_0x404973[_0xc9af('0xa')]==_0x404973[_0xc9af('0x7')]){return _0x404973['name']['substring'](0x0,_0x404973[_0xc9af('0xa')][_0xc9af('0xb')]('@'));}var _0x632dcf=_0x404973['name'][_0xc9af('0xc')](/\s+/);return _0x632dcf[_0xc9af('0xd')]>0x1?_0x632dcf[_0xc9af('0xe')](0x0,-0x1)[_0xc9af('0xf')]('\x20'):_0x404973[_0xc9af('0xa')];}return _0xc9af('0x10');}function getLastName(_0x342bfd){var _0x1a1f9e=_[_0xc9af('0x5')](_0x342bfd['value']);if(_0x1a1f9e&&_0x1a1f9e['name']){var _0x7e2718=_0x1a1f9e[_0xc9af('0xa')][_0xc9af('0xc')](/\s+/);return _0x7e2718[_0xc9af('0xd')]>0x1?_0x7e2718[_0xc9af('0x11')]():'';}return'';}function getMails(_0x3d7e70,_0x4ed329){var _0x133f2a='';for(var _0xc25134=0x0;_0xc25134<_0x4ed329['value']['length'];_0xc25134+=0x1){if(_0x4ed329[_0xc9af('0x6')][_0xc25134]['address']!==_0x3d7e70){if(!_[_0xc9af('0x12')](_0x133f2a)){_0x133f2a+=',';}_0x133f2a+=_0x4ed329[_0xc9af('0x6')][_0xc25134][_0xc9af('0xa')]||_0x4ed329[_0xc9af('0x6')][_0xc25134]['address']||'';_0x133f2a+='\x20<';_0x133f2a+=_0x4ed329[_0xc9af('0x6')][_0xc25134][_0xc9af('0x7')]?_0x4ed329['value'][_0xc25134][_0xc9af('0x7')]:_0xc9af('0x13')+random[_0xc9af('0x8')](0x6)+_0xc9af('0x9');_0x133f2a+='>';}}return _0x133f2a;}function parseEmail(_0x4bd570,_0x231408,_0x3d47ff){if(_0x231408[_0xc9af('0x14')]){var _0x2fd877=/)<[^<]*)*<\/script>/gi;while(_0x2fd877[_0xc9af('0x15')](_0x231408['html'])){_0x231408['html']=_0x231408[_0xc9af('0x14')][_0xc9af('0x16')](_0x2fd877,'');}if(_0x231408[_0xc9af('0x14')][_0xc9af('0x17')](_0xc9af('0x18'))){var _0xce58ca=[];_0x231408['attachments'][_0xc9af('0x19')](_0x54a229=>{_0xce58ca[_0xc9af('0x1a')](_0x54a229[_0xc9af('0x1b')]);});var _0x3c6a3b=/]+>/g;var _0x2abffd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x18ede2=_0x231408[_0xc9af('0x14')][_0xc9af('0x16')](_0x2abffd,_0xc9af('0x1c'));var _0x5761dd=_0x18ede2[_0xc9af('0x16')](_0x3c6a3b,_0xc9af('0x1d'));for(let _0x19cc3c=0x0;_0x19cc3c<_0xce58ca[_0xc9af('0xd')];_0x19cc3c++){var _0x25d156=_0x5761dd[_0xc9af('0x16')]('_IMG',_0xc9af('0x1e')+_0xce58ca[_0x19cc3c]+_0xc9af('0x1f'));_0x5761dd=_0x25d156;}_0x231408['html']=_0x5761dd;}_0x3d47ff[_0xc9af('0x20')]=_0x231408['html'];}else{_0x3d47ff[_0xc9af('0x20')]=_0x231408[_0xc9af('0x21')];}if(_0x3d47ff[_0xc9af('0x20')]){_0x3d47ff[_0xc9af('0x20')]=_0x3d47ff[_0xc9af('0x20')]['replace'](/0x0){var _0x4fe6f5=['Auto-Submitted:\x20auto-replied',_0xc9af('0x31'),_0xc9af('0x32')];for(var _0x49b9c5=0x0;_0x49b9c5<_0x231408[_0xc9af('0x30')][_0xc9af('0xd')];_0x49b9c5++){var _0x3ffd48=_[_0xc9af('0xb')](_0x4fe6f5,_0x231408['headerLines'][_0x49b9c5][_0xc9af('0x33')]);if(_0x3ffd48>=0x0){_0x3d47ff[_0xc9af('0x34')]=!![];}}}return _0x3d47ff;}exports['parser']=function(_0x37a3bd,_0x3477d8,_0x4f0fa8){var _0x2d2d52={'from':getAddress(_0x3477d8[_0xc9af('0x35')]),'firstName':getFirstName(_0x3477d8[_0xc9af('0x35')]),'lastName':getLastName(_0x3477d8['from']),'mapKey':_0xc9af('0x26'),'message':{'from':getMails(_0x37a3bd[_0xc9af('0x26')],_0x3477d8['from']),'to':_0x37a3bd[_0xc9af('0x26')],'cc':'','subject':_0x3477d8[_0xc9af('0x36')]||'','messageId':_0x3477d8[_0xc9af('0x37')],'inReplyTo':_0x3477d8[_0xc9af('0x38')],'sentAt':moment(_0x3477d8[_0xc9af('0x39')])[_0xc9af('0x3a')](_0xc9af('0x3b')),'attach':![],'attachments':[]}};if(!_0x3477d8[_0xc9af('0x14')]&&!_0x3477d8[_0xc9af('0x21')]){var _0x2a1b2c=_[_0xc9af('0x3c')](_0x3477d8[_0xc9af('0x28')],{'contentType':_0xc9af('0x3d')});if(_0x2a1b2c[_0xc9af('0xd')]){logger[_0xc9af('0x3e')](util['format'](_0xc9af('0x3f'),_0x3477d8[_0xc9af('0x37')]));tnef['parseBuffer'](_[_0xc9af('0x40')](_0x2a1b2c)['content'],function(_0x1970f7,_0x4f374c){if(_0x4f374c){_0x3477d8[_0xc9af('0x14')]=_0x4f374c[_0xc9af('0x41')]||_0xc9af('0x42');if(_0x4f374c[_0xc9af('0x43')]){for(var _0x4fb438=0x0;_0x4fb438<_0x4f374c[_0xc9af('0x43')][_0xc9af('0xd')];_0x4fb438++){var _0x163f29=_0x4f374c[_0xc9af('0x43')][_0x4fb438];_0x2d2d52['message'][_0xc9af('0x28')][_0xc9af('0x1a')]({'filename':_0x163f29[_0xc9af('0x44')],'content':Buffer[_0xc9af('0x35')](_0x163f29['Data'])});}}}_0x4f0fa8(parseEmail(_0x37a3bd,_0x3477d8,_0x2d2d52));});}else{_0x3477d8[_0xc9af('0x14')]=_0xc9af('0x42');_0x4f0fa8(parseEmail(_0x37a3bd,_0x3477d8,_0x2d2d52));}}else{_0x4f0fa8(parseEmail(_0x37a3bd,_0x3477d8,_0x2d2d52));}};exports[_0xc9af('0x45')]=function(_0x534233,_0x4f49ad){var _0x2b70d6=[_0xc9af('0x46')+(_0x4f49ad||''),'auth=Bearer\x20'+_0x534233,'',''];return Buffer[_0xc9af('0x35')](_0x2b70d6[_0xc9af('0xf')](''),'utf-8')[_0xc9af('0x47')](_0xc9af('0x48'));}; \ No newline at end of file +var _0xcb48=['contentType','headerLines','Auto-Submitted:\x20auto-replied','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','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','BodyHTML','Attachments','Title','

Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','generate','name','substring','split','length','join','Anonymous','pop','anonymous','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x1d9eb0['slice'](0x0,-0x1)[_0x8cb4('0xf')]('\x20'):_0x28dc1d[_0x8cb4('0xb')];}return _0x8cb4('0x10');}function getLastName(_0x18f3e5){var _0x53b512=_[_0x8cb4('0x7')](_0x18f3e5[_0x8cb4('0x8')]);if(_0x53b512&&_0x53b512[_0x8cb4('0xb')]){var _0xa1aded=_0x53b512[_0x8cb4('0xb')][_0x8cb4('0xd')](/\s+/);return _0xa1aded[_0x8cb4('0xe')]>0x1?_0xa1aded[_0x8cb4('0x11')]():'';}return'';}function getMails(_0x23e16f,_0x219233){var _0x2a567e='';for(var _0x189159=0x0;_0x189159<_0x219233['value']['length'];_0x189159+=0x1){if(_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]!==_0x23e16f){if(!_['isEmpty'](_0x2a567e)){_0x2a567e+=',';}_0x2a567e+=_0x219233['value'][_0x189159][_0x8cb4('0xb')]||_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]||'';_0x2a567e+='\x20<';_0x2a567e+=_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]?_0x219233[_0x8cb4('0x8')][_0x189159]['address']:_0x8cb4('0x12')+random[_0x8cb4('0xa')](0x6)+'@xcally.com';_0x2a567e+='>';}}return _0x2a567e;}function parseEmail(_0x4269c6,_0x1b11a9,_0xfed31b){if(_0x1b11a9['html']){var _0x40c3e2=/)<[^<]*)*<\/script>/gi;while(_0x40c3e2[_0x8cb4('0x13')](_0x1b11a9[_0x8cb4('0x14')])){_0x1b11a9[_0x8cb4('0x14')]=_0x1b11a9['html'][_0x8cb4('0x15')](_0x40c3e2,'');}if(_0x1b11a9['html'][_0x8cb4('0x16')](_0x8cb4('0x17'))){var _0x2e9dbb=[];_0x1b11a9[_0x8cb4('0x18')]['forEach'](_0xdd7699=>{_0x2e9dbb[_0x8cb4('0x19')](_0xdd7699[_0x8cb4('0x1a')]);});var _0x3563af=/]+>/g;var _0x325923=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x12e06e=_0x1b11a9[_0x8cb4('0x14')][_0x8cb4('0x15')](_0x325923,'_SRC');var _0x59b231=_0x12e06e['replace'](_0x3563af,_0x8cb4('0x1b'));for(let _0x4b13cd=0x0;_0x4b13cd<_0x2e9dbb[_0x8cb4('0xe')];_0x4b13cd++){var _0x155faf=_0x59b231[_0x8cb4('0x15')]('_IMG',_0x8cb4('0x1c')+_0x2e9dbb[_0x4b13cd]+_0x8cb4('0x1d'));_0x59b231=_0x155faf;}_0x1b11a9[_0x8cb4('0x14')]=_0x59b231;}_0xfed31b[_0x8cb4('0x1e')]=_0x1b11a9['html'];}else{_0xfed31b['body']=_0x1b11a9['textAsHtml'];}if(_0xfed31b['body']){_0xfed31b[_0x8cb4('0x1e')]=_0xfed31b[_0x8cb4('0x1e')][_0x8cb4('0x15')](/0x0){var _0x7d750a=[_0x8cb4('0x2e'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x194ae0=0x0;_0x194ae0<_0x1b11a9['headerLines'][_0x8cb4('0xe')];_0x194ae0++){var _0x4b50d7=_[_0x8cb4('0x2f')](_0x7d750a,_0x1b11a9[_0x8cb4('0x2d')][_0x194ae0][_0x8cb4('0x30')]);if(_0x4b50d7>=0x0){_0xfed31b[_0x8cb4('0x31')]=!![];}}}return _0xfed31b;}exports[_0x8cb4('0x32')]=function(_0x4b43ce,_0x582830,_0x2ae372){var _0xbe1c2a={'from':getAddress(_0x582830[_0x8cb4('0x33')]),'firstName':getFirstName(_0x582830[_0x8cb4('0x33')]),'lastName':getLastName(_0x582830[_0x8cb4('0x33')]),'mapKey':_0x8cb4('0x5'),'message':{'from':getMails(_0x4b43ce['email'],_0x582830['from']),'to':_0x4b43ce['email'],'cc':'','subject':_0x582830[_0x8cb4('0x34')]||'','messageId':_0x582830[_0x8cb4('0x35')],'inReplyTo':_0x582830[_0x8cb4('0x36')],'sentAt':moment(_0x582830[_0x8cb4('0x37')])[_0x8cb4('0x25')](_0x8cb4('0x38')),'attach':![],'attachments':[]}};if(!_0x582830[_0x8cb4('0x14')]&&!_0x582830['textAsHtml']){var _0x58caff=_[_0x8cb4('0x39')](_0x582830[_0x8cb4('0x18')],{'contentType':_0x8cb4('0x3a')});if(_0x58caff[_0x8cb4('0xe')]){logger[_0x8cb4('0x3b')](util[_0x8cb4('0x25')](_0x8cb4('0x3c'),_0x582830[_0x8cb4('0x35')]));tnef[_0x8cb4('0x3d')](_['first'](_0x58caff)[_0x8cb4('0x2b')],function(_0x1b34e3,_0x308759){if(_0x308759){_0x582830[_0x8cb4('0x14')]=_0x308759[_0x8cb4('0x3e')]||'

Empty\x20message

';if(_0x308759[_0x8cb4('0x3f')]){for(var _0x4011cb=0x0;_0x4011cb<_0x308759[_0x8cb4('0x3f')][_0x8cb4('0xe')];_0x4011cb++){var _0x45b6f4=_0x308759[_0x8cb4('0x3f')][_0x4011cb];_0xbe1c2a[_0x8cb4('0x22')][_0x8cb4('0x18')]['push']({'filename':_0x45b6f4[_0x8cb4('0x40')],'content':Buffer[_0x8cb4('0x33')](_0x45b6f4['Data'])});}}}_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));});}else{_0x582830[_0x8cb4('0x14')]=_0x8cb4('0x41');_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));}}else{_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));}};exports[_0x8cb4('0x42')]=function(_0x19df33,_0x37d29e){var _0x4a720a=[_0x8cb4('0x43')+(_0x37d29e||''),'auth=Bearer\x20'+_0x19df33,'',''];return Buffer[_0x8cb4('0x33')](_0x4a720a[_0x8cb4('0xf')](''),_0x8cb4('0x44'))[_0x8cb4('0x45')](_0x8cb4('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f002d73..5270470 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 _0x52bc=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x52bc,0x74));var _0xc52b=function(_0x5c5aa1,_0x47e071){_0x5c5aa1=_0x5c5aa1-0x0;var _0x5502fb=_0x52bc[_0x5c5aa1];return _0x5502fb;};'use strict';var _=require(_0xc52b('0x0'));function MailAccount(_0x29c6bf){this['id']=_0x29c6bf['id']||0x0;this['name']=_0x29c6bf[_0xc52b('0x1')]||_0xc52b('0x2');this['key']=_0x29c6bf[_0xc52b('0x3')]||_0xc52b('0x4');this[_0xc52b('0x5')]=_0x29c6bf[_0xc52b('0x5')]||![];this['Imap']=_0x29c6bf[_0xc52b('0x6')]||[];this[_0xc52b('0x7')]=_0x29c6bf['Smtp']||[];}module[_0xc52b('0x8')]=MailAccount; \ No newline at end of file +var _0xad74=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xad74,0xee));var _0x4ad7=function(_0x3460e3,_0x23d874){_0x3460e3=_0x3460e3-0x0;var _0x22a450=_0xad74[_0x3460e3];return _0x22a450;};'use strict';var _=require(_0x4ad7('0x0'));function MailAccount(_0x19d949){this['id']=_0x19d949['id']||0x0;this[_0x4ad7('0x1')]=_0x19d949[_0x4ad7('0x1')]||_0x4ad7('0x2');this[_0x4ad7('0x3')]=_0x19d949['key']||_0x4ad7('0x4');this[_0x4ad7('0x5')]=_0x19d949[_0x4ad7('0x5')]||![];this[_0x4ad7('0x6')]=_0x19d949[_0x4ad7('0x6')]||[];this['Smtp']=_0x19d949[_0x4ad7('0x7')]||[];}module[_0x4ad7('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 b96f25e..3756c77 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 _0xf576=['merge','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined'];(function(_0x2df83a,_0x4e8c35){var _0x38d637=function(_0x56198b){while(--_0x56198b){_0x2df83a['push'](_0x2df83a['shift']());}};_0x38d637(++_0x4e8c35);}(_0xf576,0x91));var _0x6f57=function(_0x278101,_0x3f5b69){_0x278101=_0x278101-0x0;var _0x23aa5f=_0xf576[_0x278101];return _0x23aa5f;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x6f57('0x0')]={};};function freeIsNotKey(_0x45c0af,_0x3b6234,_0xe8381){var _0x23e0a3=_[_0x6f57('0x1')](_0x45c0af,function(_0xb0778,_0x38dff0){return _0xb0778[_0xe8381];});for(var _0x2fc599 in _0x3b6234){if(_0x3b6234[_0x6f57('0x2')](_0x2fc599)){if(!_0x23e0a3[_0x2fc599]){delete _0x3b6234[_0x2fc599];}}}}Realtime[_0x6f57('0x3')]['mergeFromDatabase']=function(_0x5ed35a,_0x573ba1){for(var _0x4faf04 in _0x573ba1){if(_0x5ed35a[_0x6f57('0x2')](_0x4faf04)){_0x5ed35a[_0x4faf04]=_0x573ba1[_0x4faf04];}}};Realtime[_0x6f57('0x3')][_0x6f57('0x4')]=function(){var _0xdbdae1=this;return function(_0x125dba){if(_0x125dba){freeIsNotKey(_0x125dba,_0xdbdae1[_0x6f57('0x0')],'id');for(var _0xad9d5=0x0,_0x79d68a={},_0xf339b4={};_0xad9d5<_0x125dba[_0x6f57('0x5')];_0xad9d5+=0x1){_0x79d68a=_0x125dba[_0xad9d5];if(_[_0x6f57('0x6')](_0xdbdae1[_0x6f57('0x0')][_0x79d68a['id']])){_0xdbdae1['mailAccounts'][_0x79d68a['id']]=new MailAccount(_0x79d68a);}else{_[_0x6f57('0x7')](_0xdbdae1[_0x6f57('0x0')][_0x79d68a['id']],_0x79d68a);}}}return _0xdbdae1[_0x6f57('0x0')];};};module['exports']=Realtime; \ No newline at end of file +var _0xa38d=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','lodash','mailAccounts'];(function(_0x20f66f,_0x1be5fc){var _0x3d7d0d=function(_0x4f258f){while(--_0x4f258f){_0x20f66f['push'](_0x20f66f['shift']());}};_0x3d7d0d(++_0x1be5fc);}(_0xa38d,0xc9));var _0xda38=function(_0x5c66e7,_0x17edfd){_0x5c66e7=_0x5c66e7-0x0;var _0x43203e=_0xa38d[_0x5c66e7];return _0x43203e;};'use strict';var _=require(_0xda38('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xda38('0x1')]={};};function freeIsNotKey(_0x565370,_0x172910,_0x43d2f9){var _0x544694=_[_0xda38('0x2')](_0x565370,function(_0x48072f,_0x1d1a86){return _0x48072f[_0x43d2f9];});for(var _0x54d426 in _0x172910){if(_0x172910[_0xda38('0x3')](_0x54d426)){if(!_0x544694[_0x54d426]){delete _0x172910[_0x54d426];}}}}Realtime[_0xda38('0x4')]['mergeFromDatabase']=function(_0x5befd8,_0x56e4bf){for(var _0x1f2ab4 in _0x56e4bf){if(_0x5befd8[_0xda38('0x3')](_0x1f2ab4)){_0x5befd8[_0x1f2ab4]=_0x56e4bf[_0x1f2ab4];}}};Realtime[_0xda38('0x4')][_0xda38('0x5')]=function(){var _0x5aa068=this;return function(_0x1748a0){if(_0x1748a0){freeIsNotKey(_0x1748a0,_0x5aa068['mailAccounts'],'id');for(var _0x497560=0x0,_0x44d1ed={},_0x4d4694={};_0x497560<_0x1748a0[_0xda38('0x6')];_0x497560+=0x1){_0x44d1ed=_0x1748a0[_0x497560];if(_['isUndefined'](_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']])){_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']]=new MailAccount(_0x44d1ed);}else{_['merge'](_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']],_0x44d1ed);}}}return _0x5aa068[_0xda38('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8ed3249..35ede00 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 _0x4f96=['MailServerOut','Smtp','type','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','ListId','MailServerIn','Imap','CloudProvider','service','data5'];(function(_0x166ae9,_0x2092be){var _0xba2aa9=function(_0x574d06){while(--_0x574d06){_0x166ae9['push'](_0x166ae9['shift']());}};_0xba2aa9(++_0x2092be);}(_0x4f96,0xb9));var _0x64f9=function(_0x3bdd8b,_0x5f0e13){_0x3bdd8b=_0x3bdd8b-0x0;var _0x16b7de=_0x4f96[_0x3bdd8b];return _0x16b7de;};'use strict';var client=require(_0x64f9('0x0'));exports[_0x64f9('0x1')]=function(){return function(){return client[_0x64f9('0x2')](_0x64f9('0x3'),{'options':{'attributes':['id',_0x64f9('0x4'),_0x64f9('0x5'),'service',_0x64f9('0x6'),'active','key',_0x64f9('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x64f9('0x8'),'as':_0x64f9('0x9'),'include':[{'model':_0x64f9('0xa'),'attributes':['id',_0x64f9('0x4'),_0x64f9('0xb'),'type',_0x64f9('0xc')],'as':'CloudProvider'}]},{'model':_0x64f9('0xd'),'as':_0x64f9('0xe'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x64f9('0xb'),_0x64f9('0xf'),_0x64f9('0xc')],'as':_0x64f9('0xa')}]}]},'log':_0x64f9('0x10')});};};exports['notify']=function(_0x195242,_0x4ba675){return client[_0x64f9('0x2')](_0x64f9('0x11'),{'account':{'id':_0x195242},'body':_0x4ba675,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xe585=['NotifyMailAccount','../client','Request','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','type','notify'];(function(_0x1e1783,_0x1be1b9){var _0xbf8e4e=function(_0x40e252){while(--_0x40e252){_0x1e1783['push'](_0x1e1783['shift']());}};_0xbf8e4e(++_0x1be1b9);}(_0xe585,0x9a));var _0x5e58=function(_0x39b054,_0x423dfa){_0x39b054=_0x39b054-0x0;var _0x2c81c7=_0xe585[_0x39b054];return _0x2c81c7;};'use strict';var client=require(_0x5e58('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x5e58('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x5e58('0x2'),_0x5e58('0x3'),_0x5e58('0x4'),_0x5e58('0x5'),_0x5e58('0x6'),_0x5e58('0x7'),_0x5e58('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x5e58('0x9'),'as':_0x5e58('0xa'),'include':[{'model':_0x5e58('0xb'),'attributes':['id',_0x5e58('0x2'),_0x5e58('0x4'),'type',_0x5e58('0xc')],'as':_0x5e58('0xb')}]},{'model':_0x5e58('0xd'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x5e58('0x2'),_0x5e58('0x4'),_0x5e58('0xe'),_0x5e58('0xc')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x5e58('0xf')]=function(_0x5d9bbf,_0xf8665c){return client[_0x5e58('0x1')](_0x5e58('0x10'),{'account':{'id':_0x5d9bbf},'body':_0xf8665c,'log':_0x5e58('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1139010..6b353c0 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 _0x2fde=['getSettings','ShowSetting','GetSettings','../client'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x2fde,0x123));var _0xe2fd=function(_0x3faaad,_0x5bc75b){_0x3faaad=_0x3faaad-0x0;var _0x23d9fb=_0x2fde[_0x3faaad];return _0x23d9fb;};'use strict';var client=require(_0xe2fd('0x0'));exports[_0xe2fd('0x1')]=function(){return client['Request'](_0xe2fd('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe2fd('0x3')});}; \ No newline at end of file +var _0xfde0=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x45aa1e,_0x4679f2){var _0x1812a0=function(_0x5f3795){while(--_0x5f3795){_0x45aa1e['push'](_0x45aa1e['shift']());}};_0x1812a0(++_0x4679f2);}(_0xfde0,0x1b7));var _0x0fde=function(_0x4eb02b,_0x25a4a8){_0x4eb02b=_0x4eb02b-0x0;var _0x38db96=_0xfde0[_0x4eb02b];return _0x38db96;};'use strict';var client=require(_0x0fde('0x0'));exports[_0x0fde('0x1')]=function(){return client[_0x0fde('0x2')](_0x0fde('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0fde('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 41d64eb..21b7b8a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 7882cf7..933e6fe 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 _0x22da=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis'];(function(_0x38816e,_0x29bedb){var _0x54f546=function(_0x3986d9){while(--_0x3986d9){_0x38816e['push'](_0x38816e['shift']());}};_0x54f546(++_0x29bedb);}(_0x22da,0xc4));var _0xa22d=function(_0xf98b23,_0x3410e3){_0xf98b23=_0xf98b23-0x0;var _0x25a2c1=_0x22da[_0xf98b23];return _0x25a2c1;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xa22d('0x0'));var sticky=require(_0xa22d('0x1'));var Redis=require(_0xa22d('0x2'));var config=require(_0xa22d('0x3'));var app=express();var server=http[_0xa22d('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xa22d('0x5')](server,config[_0xa22d('0x6')])){var socketio=require(_0xa22d('0x7'))(server,{'transports':[_0xa22d('0x8'),_0xa22d('0x9')]});config[_0xa22d('0xa')]=_[_0xa22d('0xb')](config['redis'],{'host':_0xa22d('0xc'),'port':0x18eb});socketio[_0xa22d('0xd')](require(_0xa22d('0xe'))({'pubClient':new Redis(config[_0xa22d('0xa')]),'subClient':new Redis(config['redis'])}));require(_0xa22d('0xf'))['default']();require(_0xa22d('0x10'))[_0xa22d('0x11')](socketio);require(_0xa22d('0x12'))[_0xa22d('0x11')](app);require('../../routes')[_0xa22d('0x11')](app);}else{server[_0xa22d('0x13')](_0xa22d('0x14'),function(){console[_0xa22d('0x15')](_0xa22d('0x16'),config[_0xa22d('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x87f7=['../../routes','listening','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default'];(function(_0x50f30b,_0x55e888){var _0x179bc2=function(_0x1c6486){while(--_0x1c6486){_0x50f30b['push'](_0x50f30b['shift']());}};_0x179bc2(++_0x55e888);}(_0x87f7,0x10c));var _0x787f=function(_0x41b369,_0x26bc76){_0x41b369=_0x41b369-0x0;var _0x16fae1=_0x87f7[_0x41b369];return _0x16fae1;};'use strict';var _=require(_0x787f('0x0'));var http=require(_0x787f('0x1'));var express=require(_0x787f('0x2'));var sticky=require(_0x787f('0x3'));var Redis=require(_0x787f('0x4'));var config=require(_0x787f('0x5'));var app=express();var server=http[_0x787f('0x6')](app);server[_0x787f('0x7')]=0xdbba0;if(sticky[_0x787f('0x8')](server,config['port'])){var socketio=require(_0x787f('0x9'))(server,{'transports':[_0x787f('0xa'),_0x787f('0xb')]});config[_0x787f('0xc')]=_['defaults'](config['redis'],{'host':_0x787f('0xd'),'port':0x18eb});socketio[_0x787f('0xe')](require(_0x787f('0xf'))({'pubClient':new Redis(config[_0x787f('0xc')]),'subClient':new Redis(config[_0x787f('0xc')])}));require(_0x787f('0x10'))['default']();require(_0x787f('0x11'))['default'](socketio);require(_0x787f('0x12'))[_0x787f('0x13')](app);require(_0x787f('0x14'))[_0x787f('0x13')](app);}else{server['once'](_0x787f('0x15'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x787f('0x16')]);});}exports=module[_0x787f('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index fbad7da..5e19255 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 _0x5d6e=['request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','client','http','Request'];(function(_0x237896,_0x35d3e7){var _0x264aaa=function(_0x4f3f83){while(--_0x4f3f83){_0x237896['push'](_0x237896['shift']());}};_0x264aaa(++_0x35d3e7);}(_0x5d6e,0x19f));var _0xe5d6=function(_0x208c54,_0x120a70){_0x208c54=_0x208c54-0x0;var _0x4b0116=_0x5d6e[_0x208c54];return _0x4b0116;};'use strict';var jayson=require(_0xe5d6('0x0'));var BPromise=require(_0xe5d6('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xe5d6('0x2')][_0xe5d6('0x3')]({'port':0x2329});client[_0xe5d6('0x4')]=function(_0x571d9e,_0x2d109d){return new BPromise(function(_0x5d15b6,_0x657435){return client[_0xe5d6('0x5')](_0x571d9e,_0x2d109d)[_0xe5d6('0x6')](function(_0x535ab3){logger[_0xe5d6('0x7')](_0xe5d6('0x8'),_0xe5d6('0x9'),_0x571d9e,_0x2d109d,_0x535ab3);if(_0x535ab3[_0xe5d6('0xa')]){logger[_0xe5d6('0xa')](_0xe5d6('0x8'),_0xe5d6('0x9'),_0x571d9e,_0x535ab3['error'][_0xe5d6('0xb')],_0x2d109d);return _0x657435(_0x535ab3[_0xe5d6('0xa')][_0xe5d6('0xb')]);}else{return _0x5d15b6(_0x535ab3[_0xe5d6('0xc')]);}})[_0xe5d6('0xd')](function(_0x44395c){logger['error'](_0xe5d6('0x8'),_0xe5d6('0x9'),_0x571d9e,_0x44395c,_0x2d109d);return _0x657435(_0x44395c);});});};module[_0xe5d6('0xe')]=client; \ No newline at end of file +var _0x9267=['jayson/promise','bluebird','../../config/logger','routing','Request','request','then','rpc','error','result','catch','exports'];(function(_0x2e7430,_0xbbb287){var _0x33d63d=function(_0x43dda3){while(--_0x43dda3){_0x2e7430['push'](_0x2e7430['shift']());}};_0x33d63d(++_0xbbb287);}(_0x9267,0x1e0));var _0x7926=function(_0x2473bb,_0x5ec86f){_0x2473bb=_0x2473bb-0x0;var _0x16a632=_0x9267[_0x2473bb];return _0x16a632;};'use strict';var jayson=require(_0x7926('0x0'));var BPromise=require(_0x7926('0x1'));var logger=require(_0x7926('0x2'))(_0x7926('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x7926('0x4')]=function(_0x88e649,_0x46847d){return new BPromise(function(_0x5d3882,_0x5b4e8e){return client[_0x7926('0x5')](_0x88e649,_0x46847d)[_0x7926('0x6')](function(_0x4f6c90){logger['debug'](_0x7926('0x7'),'routing',_0x88e649,_0x46847d,_0x4f6c90);if(_0x4f6c90[_0x7926('0x8')]){logger['error'](_0x7926('0x7'),_0x7926('0x3'),_0x88e649,_0x4f6c90[_0x7926('0x8')]['message'],_0x46847d);return _0x5b4e8e(_0x4f6c90[_0x7926('0x8')]['message']);}else{return _0x5d3882(_0x4f6c90[_0x7926('0x9')]);}})[_0x7926('0xa')](function(_0x7d0d6f){logger['error']('rpc',_0x7926('0x3'),_0x88e649,_0x7d0d6f,_0x46847d);return _0x5b4e8e(_0x7d0d6f);});});};module[_0x7926('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index aef34d1..015f966 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 _0x4d26=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird'];(function(_0x133708,_0x3c116c){var _0x267ec2=function(_0x20b37f){while(--_0x20b37f){_0x133708['push'](_0x133708['shift']());}};_0x267ec2(++_0x3c116c);}(_0x4d26,0x151));var _0x64d2=function(_0x3cb456,_0xabc345){_0x3cb456=_0x3cb456-0x0;var _0x24540e=_0x4d26[_0x3cb456];return _0x24540e;};'use strict';var BPromise=require(_0x64d2('0x0'));var server=require(_0x64d2('0x1'));var Realtime=require(_0x64d2('0x2'));var user=require(_0x64d2('0x3'));var interval=require(_0x64d2('0x4'));var openchannelQueue=require(_0x64d2('0x5'));var chatQueue=require(_0x64d2('0x6'));var smsQueue=require(_0x64d2('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x64d2('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x64d2('0x9')]()[_0x64d2('0xa')](user[_0x64d2('0xb')]())['then'](realtime[_0x64d2('0xc')]())[_0x64d2('0xa')](interval['getIntervals']())[_0x64d2('0xa')](realtime[_0x64d2('0xd')]())[_0x64d2('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x64d2('0xa')](realtime['initOpenchannelQueues']())[_0x64d2('0xa')](chatQueue[_0x64d2('0xe')]())[_0x64d2('0xa')](realtime[_0x64d2('0xf')]())[_0x64d2('0xa')](smsQueue[_0x64d2('0x10')]())[_0x64d2('0xa')](realtime[_0x64d2('0x11')]())['then'](mailQueue[_0x64d2('0x12')]())[_0x64d2('0xa')](realtime[_0x64d2('0x13')]())[_0x64d2('0xa')](faxQueue[_0x64d2('0x14')]())['then'](realtime[_0x64d2('0x15')]())[_0x64d2('0xa')](whatsappQueue[_0x64d2('0x16')]())[_0x64d2('0xa')](realtime['initWhatsappQueues']())[_0x64d2('0xa')](function(){return realtime;});}function main(){return server[_0x64d2('0x17')](realtime)['then'](function(_0x5db560){return initRealtime();})[_0x64d2('0xa')](function(_0x4a4ea2){return setInterval(initRealtime,0x1388);})[_0x64d2('0x18')](function(_0x1de468){console[_0x64d2('0x19')](_0x1de468);});}main(); \ No newline at end of file +var _0xfa1b=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfa1b,0x14a));var _0xbfa1=function(_0x4af727,_0x42ef49){_0x4af727=_0x4af727-0x0;var _0xc5b2d0=_0xfa1b[_0x4af727];return _0xc5b2d0;};'use strict';var BPromise=require(_0xbfa1('0x0'));var server=require(_0xbfa1('0x1'));var Realtime=require(_0xbfa1('0x2'));var user=require('./rpc/user');var interval=require(_0xbfa1('0x3'));var openchannelQueue=require(_0xbfa1('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbfa1('0x5'));var mailQueue=require(_0xbfa1('0x6'));var faxQueue=require(_0xbfa1('0x7'));var whatsappQueue=require(_0xbfa1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbfa1('0x9')]()[_0xbfa1('0xa')](user[_0xbfa1('0xb')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0xc')]())[_0xbfa1('0xa')](interval['getIntervals']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xd')]())[_0xbfa1('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xe')]())['then'](chatQueue['getChatQueues']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xf')]())[_0xbfa1('0xa')](smsQueue[_0xbfa1('0x10')]())['then'](realtime[_0xbfa1('0x11')]())[_0xbfa1('0xa')](mailQueue[_0xbfa1('0x12')]())['then'](realtime[_0xbfa1('0x13')]())[_0xbfa1('0xa')](faxQueue[_0xbfa1('0x14')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0x15')]())[_0xbfa1('0xa')](whatsappQueue[_0xbfa1('0x16')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0x17')]())[_0xbfa1('0xa')](function(){return realtime;});}function main(){return server[_0xbfa1('0x18')](realtime)[_0xbfa1('0xa')](function(_0x2f5741){return initRealtime();})[_0xbfa1('0xa')](function(_0x5a900d){return setInterval(initRealtime,0x1388);})[_0xbfa1('0x19')](function(_0x23e70a){console[_0xbfa1('0x1a')](_0x23e70a);});}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 6c4c86c..0efe5cd 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x4c22f2,_0x5d6447){var _0x1915cd=function(_0x4d5cf2){while(--_0x4d5cf2){_0x4c22f2['push'](_0x4c22f2['shift']());}};_0x1915cd(++_0x5d6447);}(_0x814b,0x1a2));var _0xb814=function(_0x32e758,_0x13c271){_0x32e758=_0x32e758-0x0;var _0x349316=_0x814b[_0x32e758];return _0x349316;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x326f,0xd1));var _0xf326=function(_0x219514,_0x585ad0){_0x219514=_0x219514-0x0;var _0x174362=_0x326f[_0x219514];return _0x174362;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index dc8505b..16f4060 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 _0xbde3=['SendMail','jayson/promise','client','http','request','error','message','result','catch'];(function(_0x1ff313,_0x1ea7e9){var _0x56e358=function(_0x15e490){while(--_0x15e490){_0x1ff313['push'](_0x1ff313['shift']());}};_0x56e358(++_0x1ea7e9);}(_0xbde3,0x169));var _0x3bde=function(_0x1644f2,_0x2884e8){_0x1644f2=_0x1644f2-0x0;var _0x1fcb31=_0xbde3[_0x1644f2];return _0x1fcb31;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3bde('0x0'));var client=jayson[_0x3bde('0x1')][_0x3bde('0x2')]({'port':0x232b});function request(_0x143dcd,_0x5549aa){return new BPromise(function(_0x12295b,_0x3e9a60){return client[_0x3bde('0x3')](_0x143dcd,_0x5549aa)['then'](function(_0xf2cce5){if(_0xf2cce5[_0x3bde('0x4')]){return _0x3e9a60(_0xf2cce5[_0x3bde('0x4')][_0x3bde('0x5')]);}else{return _0x12295b(_0xf2cce5[_0x3bde('0x6')]);}})[_0x3bde('0x7')](function(_0x307850){return _0x3e9a60(_0x307850);});});}exports['sendMailMessage']=function(_0x1d2db2,_0x4e9207){return request(_0x3bde('0x8'),{'account':_0x1d2db2,'message':_0x4e9207});}; \ No newline at end of file +var _0x1088=['bluebird','client','http','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0x1088,0xdc));var _0x8108=function(_0x3529e7,_0x50bf14){_0x3529e7=_0x3529e7-0x0;var _0xc25ae7=_0x1088[_0x3529e7];return _0xc25ae7;};'use strict';var BPromise=require(_0x8108('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8108('0x1')][_0x8108('0x2')]({'port':0x232b});function request(_0x3d2244,_0x55d659){return new BPromise(function(_0x374100,_0x171059){return client[_0x8108('0x3')](_0x3d2244,_0x55d659)[_0x8108('0x4')](function(_0x50a91e){if(_0x50a91e[_0x8108('0x5')]){return _0x171059(_0x50a91e[_0x8108('0x5')][_0x8108('0x6')]);}else{return _0x374100(_0x50a91e['result']);}})[_0x8108('0x7')](function(_0x38fdcb){return _0x171059(_0x38fdcb);});});}exports[_0x8108('0x8')]=function(_0x30ab59,_0x415c6f){return request(_0x8108('0x9'),{'account':_0x30ab59,'message':_0x415c6f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 28523cf..2f59eb3 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 _0xc674=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','chat','openchannel','fax','sms','length','Status','toNumber','format','whatsappStatus','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause'];(function(_0x56b794,_0x50003f){var _0x80c80=function(_0x54dc03){while(--_0x54dc03){_0x56b794['push'](_0x56b794['shift']());}};_0x80c80(++_0x50003f);}(_0xc674,0xe8));var _0x4c67=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xc674[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x4c67('0x0'));var moment=require(_0x4c67('0x1'));var md5=require(_0x4c67('0x2'));var Redis=require(_0x4c67('0x3'));var config=require(_0x4c67('0x4'));config[_0x4c67('0x5')]=_[_0x4c67('0x6')](config['redis'],{'host':_0x4c67('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c67('0x5')]));function Agent(_0x179fcd){this['id']=_0x179fcd['id']||0x0;this[_0x4c67('0x8')]=_0x179fcd['name']||'';this['online']=_0x179fcd[_0x4c67('0x9')]||!![];this[_0x4c67('0xa')]=_0x179fcd['voicePause']||![];this['chatPause']=_0x179fcd[_0x4c67('0xb')]||![];this[_0x4c67('0xc')]=_0x179fcd['mailPause']||![];this[_0x4c67('0xd')]=_0x179fcd['faxPause']||![];this[_0x4c67('0xe')]=_0x179fcd['smsPause']||![];this[_0x4c67('0xf')]=_0x179fcd[_0x4c67('0xf')]||![];this[_0x4c67('0x10')]=_0x4c67('0x11');this[_0x4c67('0x12')]=0x0;this[_0x4c67('0x13')]=_0x179fcd['chatCapacity']||0x0;this[_0x4c67('0x14')]=0x0;this[_0x4c67('0x15')]=_0x4c67('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x179fcd[_0x4c67('0x16')]||0x0;this[_0x4c67('0x17')]=0x0;this['faxStatus']='unknown';this[_0x4c67('0x18')]=0x0;this[_0x4c67('0x19')]=_0x179fcd[_0x4c67('0x19')]||0x0;this[_0x4c67('0x1a')]=0x0;this[_0x4c67('0x1b')]=_0x4c67('0x11');this[_0x4c67('0x1c')]=0x0;this[_0x4c67('0x1d')]=_0x179fcd[_0x4c67('0x1d')]||0x0;this[_0x4c67('0x1e')]=0x0;this['whatsappStatus']='unknown';this[_0x4c67('0x1f')]=0x0;this[_0x4c67('0x20')]=_0x179fcd['whatsappCapacity']||0x0;this[_0x4c67('0x21')]=0x0;this[_0x4c67('0x22')]=_0x4c67('0x11');this[_0x4c67('0x23')]=0x0;this[_0x4c67('0x24')]=_0x179fcd[_0x4c67('0x24')]||0x0;this[_0x4c67('0x25')]=0x0;this[_0x4c67('0x26')]=![];this['busyQueue']=undefined;this[_0x4c67('0x2')]='';this[_0x4c67('0x27')]();}Agent[_0x4c67('0x28')][_0x4c67('0x29')]=function(_0x56f78c){if(this[_0x56f78c+'CurrentCapacity']>0x0){if(this[_0x56f78c+_0x4c67('0x2a')]>0x0&&this[_0x56f78c+_0x4c67('0x2b')]>=this[_0x56f78c+_0x4c67('0x2a')]){return _0x4c67('0x2c');}else{return'working';}}else{return _0x4c67('0x2d');}};Agent[_0x4c67('0x28')]['updateRealtime']=function(){var _0x43b290=[_0x4c67('0x2e'),_0x4c67('0x2f'),_0x4c67('0x30'),_0x4c67('0x31'),_0x4c67('0x32'),'whatsapp'];for(var _0x43b09d=0x0;_0x43b09d<_0x43b290[_0x4c67('0x33')];_0x43b09d+=0x1){var _0x131610=this[_0x4c67('0x29')](_0x43b290[_0x43b09d]);if(this[_0x43b290[_0x43b09d]+_0x4c67('0x34')]!==_0x131610){this[_0x43b290[_0x43b09d]+'StatusTime']=_[_0x4c67('0x35')](moment()[_0x4c67('0x36')]('x'));}this[_0x43b290[_0x43b09d]+'Status']=_0x131610;}var _0x34dd2f={'id':this['id'],'name':this[_0x4c67('0x8')],'online':this['online'],'voicePause':this[_0x4c67('0xa')],'chatPause':this[_0x4c67('0xb')],'mailPause':this[_0x4c67('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x4c67('0xd')],'openchannelPause':this[_0x4c67('0xf')],'chatStatus':this[_0x4c67('0x10')],'chatStatusTime':this[_0x4c67('0x12')],'chatCapacity':this[_0x4c67('0x13')],'chatCurrentCapacity':this[_0x4c67('0x14')],'mailStatus':this[_0x4c67('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x4c67('0x16')],'mailCurrentCapacity':this[_0x4c67('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4c67('0x18')],'faxCapacity':this[_0x4c67('0x19')],'faxCurrentCapacity':this[_0x4c67('0x1a')],'smsStatus':this[_0x4c67('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4c67('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4c67('0x37')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4c67('0x20')],'whatsappCurrentCapacity':this[_0x4c67('0x21')],'openchannelStatus':this[_0x4c67('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x4c67('0x24')],'openchannelCurrentCapacity':this[_0x4c67('0x25')],'busy':this[_0x4c67('0x26')],'busyQueue':this[_0x4c67('0x38')]};var _0x378225=md5(JSON[_0x4c67('0x39')](_0x34dd2f));if(this['md5']!==_0x378225){this[_0x4c67('0x2')]=_0x378225;io[_0x4c67('0x3a')](_0x4c67('0x3b'),_0x34dd2f);}};module[_0x4c67('0x3c')]=Agent; \ No newline at end of file +var _0x80e4=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','whatsapp','Status','toNumber','mailStatus','smsStatus','whatsappStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity'];(function(_0x297856,_0xd3d540){var _0x413d73=function(_0x545c8a){while(--_0x545c8a){_0x297856['push'](_0x297856['shift']());}};_0x413d73(++_0xd3d540);}(_0x80e4,0x103));var _0x480e=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x80e4[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x480e('0x0'));var moment=require(_0x480e('0x1'));var md5=require(_0x480e('0x2'));var Redis=require('ioredis');var config=require(_0x480e('0x3'));config[_0x480e('0x4')]=_[_0x480e('0x5')](config[_0x480e('0x4')],{'host':_0x480e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x480e('0x4')]));function Agent(_0x621c93){this['id']=_0x621c93['id']||0x0;this[_0x480e('0x7')]=_0x621c93[_0x480e('0x7')]||'';this[_0x480e('0x8')]=_0x621c93[_0x480e('0x8')]||!![];this[_0x480e('0x9')]=_0x621c93[_0x480e('0x9')]||![];this[_0x480e('0xa')]=_0x621c93[_0x480e('0xa')]||![];this[_0x480e('0xb')]=_0x621c93[_0x480e('0xb')]||![];this['faxPause']=_0x621c93[_0x480e('0xc')]||![];this[_0x480e('0xd')]=_0x621c93[_0x480e('0xd')]||![];this[_0x480e('0xe')]=_0x621c93[_0x480e('0xe')]||![];this[_0x480e('0xf')]='unknown';this[_0x480e('0x10')]=0x0;this[_0x480e('0x11')]=_0x621c93[_0x480e('0x11')]||0x0;this[_0x480e('0x12')]=0x0;this['mailStatus']=_0x480e('0x13');this[_0x480e('0x14')]=0x0;this[_0x480e('0x15')]=_0x621c93[_0x480e('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x480e('0x16')]='unknown';this[_0x480e('0x17')]=0x0;this[_0x480e('0x18')]=_0x621c93[_0x480e('0x18')]||0x0;this[_0x480e('0x19')]=0x0;this['smsStatus']=_0x480e('0x13');this[_0x480e('0x1a')]=0x0;this[_0x480e('0x1b')]=_0x621c93[_0x480e('0x1b')]||0x0;this[_0x480e('0x1c')]=0x0;this[_0x480e('0x1d')]=_0x480e('0x13');this['whatsappStatusTime']=0x0;this[_0x480e('0x1e')]=_0x621c93['whatsappCapacity']||0x0;this[_0x480e('0x1f')]=0x0;this[_0x480e('0x20')]=_0x480e('0x13');this[_0x480e('0x21')]=0x0;this[_0x480e('0x22')]=_0x621c93[_0x480e('0x22')]||0x0;this[_0x480e('0x23')]=0x0;this[_0x480e('0x24')]=![];this[_0x480e('0x25')]=undefined;this[_0x480e('0x2')]='';this['updateRealtime']();}Agent[_0x480e('0x26')][_0x480e('0x27')]=function(_0x3534f9){if(this[_0x3534f9+_0x480e('0x28')]>0x0){if(this[_0x3534f9+'Capacity']>0x0&&this[_0x3534f9+_0x480e('0x28')]>=this[_0x3534f9+_0x480e('0x29')]){return _0x480e('0x2a');}else{return _0x480e('0x2b');}}else{return _0x480e('0x2c');}};Agent[_0x480e('0x26')][_0x480e('0x2d')]=function(){var _0x53fb1b=['mail',_0x480e('0x2e'),_0x480e('0x2f'),'fax','sms',_0x480e('0x30')];for(var _0x1f095d=0x0;_0x1f095d<_0x53fb1b['length'];_0x1f095d+=0x1){var _0x712e65=this['getChannelStatus'](_0x53fb1b[_0x1f095d]);if(this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]!==_0x712e65){this[_0x53fb1b[_0x1f095d]+'StatusTime']=_[_0x480e('0x32')](moment()['format']('x'));}this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]=_0x712e65;}var _0x3bc0b0={'id':this['id'],'name':this['name'],'online':this[_0x480e('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x480e('0xa')],'mailPause':this[_0x480e('0xb')],'smsPause':this[_0x480e('0xd')],'faxPause':this[_0x480e('0xc')],'openchannelPause':this[_0x480e('0xe')],'chatStatus':this[_0x480e('0xf')],'chatStatusTime':this[_0x480e('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x480e('0x33')],'mailStatusTime':this[_0x480e('0x14')],'mailCapacity':this[_0x480e('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x480e('0x16')],'faxStatusTime':this[_0x480e('0x17')],'faxCapacity':this[_0x480e('0x18')],'faxCurrentCapacity':this[_0x480e('0x19')],'smsStatus':this[_0x480e('0x34')],'smsStatusTime':this[_0x480e('0x1a')],'smsCapacity':this[_0x480e('0x1b')],'smsCurrentCapacity':this[_0x480e('0x1c')],'whatsappStatus':this[_0x480e('0x1d')],'whatsappStatusTime':this[_0x480e('0x35')],'whatsappCapacity':this[_0x480e('0x1e')],'whatsappCurrentCapacity':this[_0x480e('0x1f')],'openchannelStatus':this[_0x480e('0x20')],'openchannelStatusTime':this[_0x480e('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x480e('0x23')],'busy':this[_0x480e('0x24')],'busyQueue':this['busyQueue']};var _0x8152bc=md5(JSON[_0x480e('0x36')](_0x3bc0b0));if(this[_0x480e('0x2')]!==_0x8152bc){this['md5']=_0x8152bc;io[_0x480e('0x37')](_0x480e('0x38'),_0x3bc0b0);}};module[_0x480e('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ea807de..94b23b0 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 _0xd805=['prototype','_rr','updateRealtime','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','emit','exports','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1cdc88,_0x11d888){var _0x224061=function(_0x22b7ab){while(--_0x22b7ab){_0x1cdc88['push'](_0x1cdc88['shift']());}};_0x224061(++_0x11d888);}(_0xd805,0x8f));var _0x5d80=function(_0x517724,_0x51e5c0){_0x517724=_0x517724-0x0;var _0x4c73a5=_0xd805[_0x517724];return _0x4c73a5;};'use strict';var _=require('lodash');var md5=require(_0x5d80('0x0'));var util=require(_0x5d80('0x1'));var Redis=require(_0x5d80('0x2'));var config=require('../../../config/environment');config[_0x5d80('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5d80('0x4'))(new Redis(config[_0x5d80('0x3')]));function ChatQueue(_0x402899){this['id']=_0x402899['id']||0x0;this[_0x5d80('0x5')]=_0x402899[_0x5d80('0x5')]||'';this['timeout']=_0x402899[_0x5d80('0x6')]||0xa;this[_0x5d80('0x7')]=_0x402899[_0x5d80('0x7')]||_0x5d80('0x8');this['Agents']=_0x402899[_0x5d80('0x9')];this[_0x5d80('0xa')]={};this[_0x5d80('0xb')]=0x0;this[_0x5d80('0x0')]='';this[_0x5d80('0xc')]();this['updateRealtime']();}ChatQueue[_0x5d80('0xd')][_0x5d80('0xc')]=function(){var _0x24484c=this[_0x5d80('0xa')][_0x5d80('0xe')];this['mapAgentsId']=_['map'](this[_0x5d80('0x9')],'id');this[_0x5d80('0xa')][_0x5d80('0xe')]=_0x24484c;};ChatQueue[_0x5d80('0xd')][_0x5d80('0xf')]=function(){this[_0x5d80('0x10')]=0x0;this[_0x5d80('0x11')]=0x0;for(var _0x2c5591=0x0;_0x2c5591=0x0?this[_0x5d80('0x15')]:0x0;var _0x1120c8={'id':this['id'],'available':this[_0x5d80('0x15')],'loggedIn':this[_0x5d80('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5d80('0xb')]};var _0x4b4970=md5(JSON[_0x5d80('0x16')](_0x1120c8));if(this['md5']!==_0x4b4970){this[_0x5d80('0x0')]=_0x4b4970;io['to'](util['format'](_0x5d80('0x17'),_0x1120c8[_0x5d80('0x5')]))[_0x5d80('0x18')]('chat_queue:save',_0x1120c8);}};module[_0x5d80('0x19')]=ChatQueue; \ No newline at end of file +var _0x97a6=['prototype','updateRouting','map','_rr','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime'];(function(_0x435163,_0x1627b6){var _0x227697=function(_0x20dccc){while(--_0x20dccc){_0x435163['push'](_0x435163['shift']());}};_0x227697(++_0x1627b6);}(_0x97a6,0x158));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x697a('0x0'));var util=require(_0x697a('0x1'));var Redis=require(_0x697a('0x2'));var config=require(_0x697a('0x3'));config[_0x697a('0x4')]=_[_0x697a('0x5')](config['redis'],{'host':_0x697a('0x6'),'port':0x18eb});var io=require(_0x697a('0x7'))(new Redis(config[_0x697a('0x4')]));function ChatQueue(_0x564fbc){this['id']=_0x564fbc['id']||0x0;this[_0x697a('0x8')]=_0x564fbc['name']||'';this['timeout']=_0x564fbc[_0x697a('0x9')]||0xa;this[_0x697a('0xa')]=_0x564fbc[_0x697a('0xa')]||_0x697a('0xb');this[_0x697a('0xc')]=_0x564fbc[_0x697a('0xc')];this[_0x697a('0xd')]={};this[_0x697a('0xe')]=0x0;this[_0x697a('0x0')]='';this['updateRouting']();this[_0x697a('0xf')]();}ChatQueue[_0x697a('0x10')][_0x697a('0x11')]=function(){var _0x975a36=this[_0x697a('0xd')]['_rr'];this[_0x697a('0xd')]=_[_0x697a('0x12')](this[_0x697a('0xc')],'id');this[_0x697a('0xd')][_0x697a('0x13')]=_0x975a36;};ChatQueue[_0x697a('0x10')][_0x697a('0xf')]=function(){this[_0x697a('0x14')]=0x0;this[_0x697a('0x15')]=0x0;for(var _0x16fe66=0x0;_0x16fe66=0x0?this[_0x697a('0x19')]:0x0;var _0x3e851e={'id':this['id'],'available':this[_0x697a('0x19')],'loggedIn':this[_0x697a('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x697a('0xe')]};var _0x2005bd=md5(JSON['stringify'](_0x3e851e));if(this[_0x697a('0x0')]!==_0x2005bd){this[_0x697a('0x0')]=_0x2005bd;io['to'](util[_0x697a('0x1a')](_0x697a('0x1b'),_0x3e851e[_0x697a('0x8')]))[_0x697a('0x1c')]('chat_queue:save',_0x3e851e);}};module[_0x697a('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 33e4efe..4149448 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 _0x60ed=['loggedIn','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','_rr','paused','length','online'];(function(_0x445a6a,_0xf0863f){var _0xc6f6b9=function(_0x2665b1){while(--_0x2665b1){_0x445a6a['push'](_0x445a6a['shift']());}};_0xc6f6b9(++_0xf0863f);}(_0x60ed,0x164));var _0xd60e=function(_0x417dcc,_0x35f7ab){_0x417dcc=_0x417dcc-0x0;var _0x32719c=_0x60ed[_0x417dcc];return _0x32719c;};'use strict';var _=require(_0xd60e('0x0'));var md5=require(_0xd60e('0x1'));var util=require(_0xd60e('0x2'));var Redis=require(_0xd60e('0x3'));var config=require(_0xd60e('0x4'));config['redis']=_['defaults'](config[_0xd60e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd60e('0x6'))(new Redis(config[_0xd60e('0x5')]));function FaxQueue(_0x83e7c7){this['id']=_0x83e7c7['id']||0x0;this['name']=_0x83e7c7[_0xd60e('0x7')]||'';this[_0xd60e('0x8')]=_0x83e7c7['timeout']||0xa;this[_0xd60e('0x9')]=_0x83e7c7['strategy']||_0xd60e('0xa');this[_0xd60e('0xb')]=_0x83e7c7[_0xd60e('0xb')];this[_0xd60e('0xc')]={};this[_0xd60e('0xd')]=0x0;this[_0xd60e('0x1')]='';this['updateRouting']();this[_0xd60e('0xe')]();}FaxQueue[_0xd60e('0xf')]['updateRouting']=function(){var _0x37dd46=this['mapAgentsId']['_rr'];this[_0xd60e('0xc')]=_[_0xd60e('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xd60e('0x11')]=_0x37dd46;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xd60e('0x12')]=0x0;for(var _0x3715b4=0x0;_0x3715b4=0x0?this[_0xd60e('0x17')]:0x0;var _0x18f66f={'id':this['id'],'available':this[_0xd60e('0x17')],'loggedIn':this[_0xd60e('0x15')],'name':this[_0xd60e('0x7')],'paused':this[_0xd60e('0x12')],'waiting':this[_0xd60e('0xd')]};var _0x4790dd=md5(JSON[_0xd60e('0x18')](_0x18f66f));if(this[_0xd60e('0x1')]!==_0x4790dd){this[_0xd60e('0x1')]=_0x4790dd;io['to'](util[_0xd60e('0x19')](_0xd60e('0x1a'),_0x18f66f['name']))['emit'](_0xd60e('0x1b'),_0x18f66f);}};module[_0xd60e('0x1c')]=FaxQueue; \ No newline at end of file +var _0xa5e0=['emit','fax_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','updateRealtime','loggedIn','paused','length','faxPause','available','format','fax:queue:%s'];(function(_0x20d33b,_0x1066f5){var _0x26450c=function(_0x316e34){while(--_0x316e34){_0x20d33b['push'](_0x20d33b['shift']());}};_0x26450c(++_0x1066f5);}(_0xa5e0,0x9e));var _0x0a5e=function(_0x409853,_0x28b80d){_0x409853=_0x409853-0x0;var _0x3127b8=_0xa5e0[_0x409853];return _0x3127b8;};'use strict';var _=require('lodash');var md5=require(_0x0a5e('0x0'));var util=require('util');var Redis=require(_0x0a5e('0x1'));var config=require(_0x0a5e('0x2'));config[_0x0a5e('0x3')]=_[_0x0a5e('0x4')](config[_0x0a5e('0x3')],{'host':_0x0a5e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a5e('0x3')]));function FaxQueue(_0x4abfbc){this['id']=_0x4abfbc['id']||0x0;this[_0x0a5e('0x6')]=_0x4abfbc['name']||'';this['timeout']=_0x4abfbc[_0x0a5e('0x7')]||0xa;this['strategy']=_0x4abfbc[_0x0a5e('0x8')]||'beepall';this[_0x0a5e('0x9')]=_0x4abfbc['Agents'];this[_0x0a5e('0xa')]={};this[_0x0a5e('0xb')]=0x0;this['md5']='';this[_0x0a5e('0xc')]();this['updateRealtime']();}FaxQueue['prototype'][_0x0a5e('0xc')]=function(){var _0x49a8f7=this[_0x0a5e('0xa')]['_rr'];this['mapAgentsId']=_[_0x0a5e('0xd')](this['Agents'],'id');this[_0x0a5e('0xa')][_0x0a5e('0xe')]=_0x49a8f7;};FaxQueue[_0x0a5e('0xf')][_0x0a5e('0x10')]=function(){this[_0x0a5e('0x11')]=0x0;this[_0x0a5e('0x12')]=0x0;for(var _0x20f77d=0x0;_0x20f77d=0x0?this[_0x0a5e('0x15')]:0x0;var _0x26ccb3={'id':this['id'],'available':this[_0x0a5e('0x15')],'loggedIn':this[_0x0a5e('0x11')],'name':this['name'],'paused':this[_0x0a5e('0x12')],'waiting':this['waiting']};var _0x4eb297=md5(JSON['stringify'](_0x26ccb3));if(this[_0x0a5e('0x0')]!==_0x4eb297){this[_0x0a5e('0x0')]=_0x4eb297;io['to'](util[_0x0a5e('0x16')](_0x0a5e('0x17'),_0x26ccb3[_0x0a5e('0x6')]))[_0x0a5e('0x18')](_0x0a5e('0x19'),_0x26ccb3);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3108a34..16588cb 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 _0xcd10=['Intervals','name'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcd10,0x1a3));var _0x0cd1=function(_0x317095,_0x41699c){_0x317095=_0x317095-0x0;var _0x107b1d=_0xcd10[_0x317095];return _0x107b1d;};'use strict';function Interval(_0x3cf589){this['id']=_0x3cf589['id']||0x0;this[_0x0cd1('0x0')]=_0x3cf589[_0x0cd1('0x0')]||'';this[_0x0cd1('0x1')]=_0x3cf589[_0x0cd1('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xd143=['name','Intervals'];(function(_0x4992be,_0x555abf){var _0x39e44e=function(_0x286e9f){while(--_0x286e9f){_0x4992be['push'](_0x4992be['shift']());}};_0x39e44e(++_0x555abf);}(_0xd143,0x1ae));var _0x3d14=function(_0x421a02,_0x28f532){_0x421a02=_0x421a02-0x0;var _0x387292=_0xd143[_0x421a02];return _0x387292;};'use strict';function Interval(_0xc7467b){this['id']=_0xc7467b['id']||0x0;this['name']=_0xc7467b[_0x3d14('0x0')]||'';this['Intervals']=_0xc7467b[_0x3d14('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 37de4e3..b1ff99d 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 _0x6790=['updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1c1b8c,_0x4c253d){var _0x1ee4c4=function(_0xb9bff5){while(--_0xb9bff5){_0x1c1b8c['push'](_0x1c1b8c['shift']());}};_0x1ee4c4(++_0x4c253d);}(_0x6790,0x186));var _0x0679=function(_0x5206dd,_0x100a63){_0x5206dd=_0x5206dd-0x0;var _0x3269bd=_0x6790[_0x5206dd];return _0x3269bd;};'use strict';var _=require(_0x0679('0x0'));var md5=require(_0x0679('0x1'));var util=require(_0x0679('0x2'));var Redis=require(_0x0679('0x3'));var config=require(_0x0679('0x4'));config[_0x0679('0x5')]=_[_0x0679('0x6')](config['redis'],{'host':_0x0679('0x7'),'port':0x18eb});var io=require(_0x0679('0x8'))(new Redis(config['redis']));function MailQueue(_0x20dce8){this['id']=_0x20dce8['id']||0x0;this[_0x0679('0x9')]=_0x20dce8[_0x0679('0x9')]||'';this[_0x0679('0xa')]=_0x20dce8[_0x0679('0xa')]||0xa;this['strategy']=_0x20dce8['strategy']||_0x0679('0xb');this['Agents']=_0x20dce8[_0x0679('0xc')];this[_0x0679('0xd')]={};this[_0x0679('0xe')]=0x0;this['md5']='';this[_0x0679('0xf')]();this[_0x0679('0x10')]();}MailQueue[_0x0679('0x11')][_0x0679('0xf')]=function(){var _0x5dc9bf=this[_0x0679('0xd')][_0x0679('0x12')];this[_0x0679('0xd')]=_[_0x0679('0x13')](this[_0x0679('0xc')],'id');this['mapAgentsId'][_0x0679('0x12')]=_0x5dc9bf;};MailQueue[_0x0679('0x11')][_0x0679('0x10')]=function(){this[_0x0679('0x14')]=0x0;this[_0x0679('0x15')]=0x0;for(var _0x59a389=0x0;_0x59a389=0x0?this['available']:0x0;var _0x5c1c29={'id':this['id'],'available':this[_0x0679('0x19')],'loggedIn':this[_0x0679('0x14')],'name':this['name'],'paused':this[_0x0679('0x15')],'waiting':this['waiting']};var _0x2929cb=md5(JSON[_0x0679('0x1a')](_0x5c1c29));if(this[_0x0679('0x1')]!==_0x2929cb){this[_0x0679('0x1')]=_0x2929cb;io['to'](util[_0x0679('0x1b')]('mail:queue:%s',_0x5c1c29[_0x0679('0x9')]))['emit'](_0x0679('0x1c'),_0x5c1c29);}};module['exports']=MailQueue; \ No newline at end of file +var _0xe5e1=['_rr','map','loggedIn','paused','length','mailPause','available','format','mail:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0x1c5c40,_0x352417){var _0x5be7f8=function(_0x4251ed){while(--_0x4251ed){_0x1c5c40['push'](_0x1c5c40['shift']());}};_0x5be7f8(++_0x352417);}(_0xe5e1,0x92));var _0x1e5e=function(_0x5397f2,_0x1b5a17){_0x5397f2=_0x5397f2-0x0;var _0x4bae87=_0xe5e1[_0x5397f2];return _0x4bae87;};'use strict';var _=require(_0x1e5e('0x0'));var md5=require(_0x1e5e('0x1'));var util=require('util');var Redis=require(_0x1e5e('0x2'));var config=require(_0x1e5e('0x3'));config[_0x1e5e('0x4')]=_[_0x1e5e('0x5')](config[_0x1e5e('0x4')],{'host':_0x1e5e('0x6'),'port':0x18eb});var io=require(_0x1e5e('0x7'))(new Redis(config[_0x1e5e('0x4')]));function MailQueue(_0x2973ee){this['id']=_0x2973ee['id']||0x0;this[_0x1e5e('0x8')]=_0x2973ee[_0x1e5e('0x8')]||'';this[_0x1e5e('0x9')]=_0x2973ee[_0x1e5e('0x9')]||0xa;this[_0x1e5e('0xa')]=_0x2973ee['strategy']||'beepall';this[_0x1e5e('0xb')]=_0x2973ee[_0x1e5e('0xb')];this[_0x1e5e('0xc')]={};this['waiting']=0x0;this[_0x1e5e('0x1')]='';this[_0x1e5e('0xd')]();this[_0x1e5e('0xe')]();}MailQueue[_0x1e5e('0xf')][_0x1e5e('0xd')]=function(){var _0x4b6093=this['mapAgentsId'][_0x1e5e('0x10')];this[_0x1e5e('0xc')]=_[_0x1e5e('0x11')](this[_0x1e5e('0xb')],'id');this[_0x1e5e('0xc')][_0x1e5e('0x10')]=_0x4b6093;};MailQueue[_0x1e5e('0xf')]['updateRealtime']=function(){this[_0x1e5e('0x12')]=0x0;this[_0x1e5e('0x13')]=0x0;for(var _0xfa3886=0x0;_0xfa3886=0x0?this[_0x1e5e('0x16')]:0x0;var _0x4c4c1f={'id':this['id'],'available':this[_0x1e5e('0x16')],'loggedIn':this[_0x1e5e('0x12')],'name':this[_0x1e5e('0x8')],'paused':this[_0x1e5e('0x13')],'waiting':this['waiting']};var _0x597d8a=md5(JSON['stringify'](_0x4c4c1f));if(this['md5']!==_0x597d8a){this[_0x1e5e('0x1')]=_0x597d8a;io['to'](util[_0x1e5e('0x17')](_0x1e5e('0x18'),_0x4c4c1f['name']))[_0x1e5e('0x19')]('mail_queue:save',_0x4c4c1f);}};module[_0x1e5e('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 2675448..eb1a3fb 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x44a315,_0x468ae5){var _0x49f1eb=function(_0x2f513b){while(--_0x2f513b){_0x44a315['push'](_0x44a315['shift']());}};_0x49f1eb(++_0x468ae5);}(_0x814b,0x1a2));var _0xb814=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x814b[_0x4e55a9];return _0x4a9b67;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1261,0x144));var _0x1126=function(_0x2d6d88,_0x2ea070){_0x2d6d88=_0x2d6d88-0x0;var _0x1991b0=_0x1261[_0x2d6d88];return _0x1991b0;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index df28523..ab33ded 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 _0x2821=['waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x1a01d4,_0x286c1a){var _0x2b361c=function(_0x15f843){while(--_0x15f843){_0x1a01d4['push'](_0x1a01d4['shift']());}};_0x2b361c(++_0x286c1a);}(_0x2821,0x87));var _0x1282=function(_0x22cdb1,_0x4f568a){_0x22cdb1=_0x22cdb1-0x0;var _0x50b893=_0x2821[_0x22cdb1];return _0x50b893;};'use strict';var _=require(_0x1282('0x0'));var md5=require(_0x1282('0x1'));var util=require(_0x1282('0x2'));var Redis=require(_0x1282('0x3'));var config=require(_0x1282('0x4'));config[_0x1282('0x5')]=_[_0x1282('0x6')](config[_0x1282('0x5')],{'host':_0x1282('0x7'),'port':0x18eb});var io=require(_0x1282('0x8'))(new Redis(config[_0x1282('0x5')]));function SmsQueue(_0x5c15c0){this['id']=_0x5c15c0['id']||0x0;this[_0x1282('0x9')]=_0x5c15c0[_0x1282('0x9')]||'';this[_0x1282('0xa')]=_0x5c15c0[_0x1282('0xa')]||0xa;this[_0x1282('0xb')]=_0x5c15c0[_0x1282('0xb')]||_0x1282('0xc');this[_0x1282('0xd')]=_0x5c15c0['Agents'];this[_0x1282('0xe')]={};this[_0x1282('0xf')]=0x0;this[_0x1282('0x1')]='';this[_0x1282('0x10')]();this[_0x1282('0x11')]();}SmsQueue['prototype'][_0x1282('0x10')]=function(){var _0x3452aa=this['mapAgentsId'][_0x1282('0x12')];this[_0x1282('0xe')]=_['map'](this[_0x1282('0xd')],'id');this['mapAgentsId']['_rr']=_0x3452aa;};SmsQueue[_0x1282('0x13')][_0x1282('0x11')]=function(){this[_0x1282('0x14')]=0x0;this[_0x1282('0x15')]=0x0;for(var _0x4dfd14=0x0;_0x4dfd14=0x0?this['available']:0x0;var _0x48c857={'id':this['id'],'available':this[_0x1282('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1282('0x9')],'paused':this[_0x1282('0x15')],'waiting':this['waiting']};var _0x5ea75d=md5(JSON['stringify'](_0x48c857));if(this['md5']!==_0x5ea75d){this[_0x1282('0x1')]=_0x5ea75d;io['to'](util[_0x1282('0x19')](_0x1282('0x1a'),_0x48c857[_0x1282('0x9')]))[_0x1282('0x1b')](_0x1282('0x1c'),_0x48c857);}};module[_0x1282('0x1d')]=SmsQueue; \ No newline at end of file +var _0xb2b3=['waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x237cb1,_0x59915a){var _0x1b6419=function(_0x2fe611){while(--_0x2fe611){_0x237cb1['push'](_0x237cb1['shift']());}};_0x1b6419(++_0x59915a);}(_0xb2b3,0x71));var _0x3b2b=function(_0x3ffefd,_0x195e55){_0x3ffefd=_0x3ffefd-0x0;var _0x3478e8=_0xb2b3[_0x3ffefd];return _0x3478e8;};'use strict';var _=require(_0x3b2b('0x0'));var md5=require(_0x3b2b('0x1'));var util=require(_0x3b2b('0x2'));var Redis=require(_0x3b2b('0x3'));var config=require(_0x3b2b('0x4'));config[_0x3b2b('0x5')]=_[_0x3b2b('0x6')](config['redis'],{'host':_0x3b2b('0x7'),'port':0x18eb});var io=require(_0x3b2b('0x8'))(new Redis(config[_0x3b2b('0x5')]));function SmsQueue(_0x45e179){this['id']=_0x45e179['id']||0x0;this[_0x3b2b('0x9')]=_0x45e179[_0x3b2b('0x9')]||'';this[_0x3b2b('0xa')]=_0x45e179[_0x3b2b('0xa')]||0xa;this[_0x3b2b('0xb')]=_0x45e179[_0x3b2b('0xb')]||_0x3b2b('0xc');this[_0x3b2b('0xd')]=_0x45e179['Agents'];this[_0x3b2b('0xe')]={};this[_0x3b2b('0xf')]=0x0;this[_0x3b2b('0x1')]='';this[_0x3b2b('0x10')]();this[_0x3b2b('0x11')]();}SmsQueue[_0x3b2b('0x12')]['updateRouting']=function(){var _0x492f5f=this[_0x3b2b('0xe')][_0x3b2b('0x13')];this[_0x3b2b('0xe')]=_[_0x3b2b('0x14')](this['Agents'],'id');this[_0x3b2b('0xe')][_0x3b2b('0x13')]=_0x492f5f;};SmsQueue[_0x3b2b('0x12')][_0x3b2b('0x11')]=function(){this[_0x3b2b('0x15')]=0x0;this[_0x3b2b('0x16')]=0x0;for(var _0x52b63f=0x0;_0x52b63f=0x0?this[_0x3b2b('0x19')]:0x0;var _0x52bba5={'id':this['id'],'available':this[_0x3b2b('0x19')],'loggedIn':this[_0x3b2b('0x15')],'name':this['name'],'paused':this[_0x3b2b('0x16')],'waiting':this['waiting']};var _0x26f83=md5(JSON[_0x3b2b('0x1a')](_0x52bba5));if(this['md5']!==_0x26f83){this['md5']=_0x26f83;io['to'](util[_0x3b2b('0x1b')](_0x3b2b('0x1c'),_0x52bba5[_0x3b2b('0x9')]))[_0x3b2b('0x1d')](_0x3b2b('0x1e'),_0x52bba5);}};module[_0x3b2b('0x1f')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c82d3d9..22a07a4 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 _0x3568=['whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','name','emit'];(function(_0xb6afe,_0x38671f){var _0x335218=function(_0x325284){while(--_0x325284){_0xb6afe['push'](_0xb6afe['shift']());}};_0x335218(++_0x38671f);}(_0x3568,0x182));var _0x8356=function(_0x104504,_0x443c9b){_0x104504=_0x104504-0x0;var _0x2f3e8f=_0x3568[_0x104504];return _0x2f3e8f;};'use strict';var _=require(_0x8356('0x0'));var md5=require(_0x8356('0x1'));var util=require(_0x8356('0x2'));var Redis=require('ioredis');var config=require(_0x8356('0x3'));config[_0x8356('0x4')]=_[_0x8356('0x5')](config[_0x8356('0x4')],{'host':_0x8356('0x6'),'port':0x18eb});var io=require(_0x8356('0x7'))(new Redis(config[_0x8356('0x4')]));function WhatsappQueue(_0x47e1d2){this['id']=_0x47e1d2['id']||0x0;this['name']=_0x47e1d2['name']||'';this[_0x8356('0x8')]=_0x47e1d2[_0x8356('0x8')]||0xa;this[_0x8356('0x9')]=_0x47e1d2['strategy']||_0x8356('0xa');this[_0x8356('0xb')]=_0x47e1d2['Agents'];this[_0x8356('0xc')]={};this[_0x8356('0xd')]=0x0;this[_0x8356('0x1')]='';this[_0x8356('0xe')]();this[_0x8356('0xf')]();}WhatsappQueue['prototype'][_0x8356('0xe')]=function(){var _0x5fd223=this[_0x8356('0xc')][_0x8356('0x10')];this[_0x8356('0xc')]=_[_0x8356('0x11')](this[_0x8356('0xb')],'id');this['mapAgentsId'][_0x8356('0x10')]=_0x5fd223;};WhatsappQueue[_0x8356('0x12')][_0x8356('0xf')]=function(){this[_0x8356('0x13')]=0x0;this[_0x8356('0x14')]=0x0;for(var _0x932389=0x0;_0x932389=0x0?this[_0x8356('0x18')]:0x0;var _0x1e1ba0={'id':this['id'],'available':this[_0x8356('0x18')],'loggedIn':this[_0x8356('0x13')],'name':this['name'],'paused':this[_0x8356('0x14')],'waiting':this['waiting']};var _0x157490=md5(JSON[_0x8356('0x19')](_0x1e1ba0));if(this[_0x8356('0x1')]!==_0x157490){this[_0x8356('0x1')]=_0x157490;io['to'](util[_0x8356('0x1a')](_0x8356('0x1b'),_0x1e1ba0[_0x8356('0x1c')]))[_0x8356('0x1d')](_0x8356('0x1e'),_0x1e1ba0);}};module[_0x8356('0x1f')]=WhatsappQueue; \ No newline at end of file +var _0xe78b=['paused','length','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe78b,0x160));var _0xbe78=function(_0x118e49,_0x576c16){_0x118e49=_0x118e49-0x0;var _0x528dfd=_0xe78b[_0x118e49];return _0x528dfd;};'use strict';var _=require(_0xbe78('0x0'));var md5=require(_0xbe78('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xbe78('0x2'));config['redis']=_[_0xbe78('0x3')](config[_0xbe78('0x4')],{'host':_0xbe78('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe78('0x4')]));function WhatsappQueue(_0x56e3c1){this['id']=_0x56e3c1['id']||0x0;this['name']=_0x56e3c1[_0xbe78('0x6')]||'';this[_0xbe78('0x7')]=_0x56e3c1[_0xbe78('0x7')]||0xa;this[_0xbe78('0x8')]=_0x56e3c1[_0xbe78('0x8')]||'beepall';this[_0xbe78('0x9')]=_0x56e3c1[_0xbe78('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbe78('0x1')]='';this['updateRouting']();this[_0xbe78('0xa')]();}WhatsappQueue[_0xbe78('0xb')]['updateRouting']=function(){var _0x153bb8=this[_0xbe78('0xc')][_0xbe78('0xd')];this[_0xbe78('0xc')]=_[_0xbe78('0xe')](this[_0xbe78('0x9')],'id');this[_0xbe78('0xc')][_0xbe78('0xd')]=_0x153bb8;};WhatsappQueue[_0xbe78('0xb')][_0xbe78('0xa')]=function(){this[_0xbe78('0xf')]=0x0;this[_0xbe78('0x10')]=0x0;for(var _0x138acd=0x0;_0x138acd=0x0?this[_0xbe78('0x12')]:0x0;var _0x4c1460={'id':this['id'],'available':this[_0xbe78('0x12')],'loggedIn':this[_0xbe78('0xf')],'name':this[_0xbe78('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4bc5ad=md5(JSON[_0xbe78('0x13')](_0x4c1460));if(this[_0xbe78('0x1')]!==_0x4bc5ad){this['md5']=_0x4bc5ad;io['to'](util['format']('whatsapp:queue:%s',_0x4c1460['name']))[_0xbe78('0x14')](_0xbe78('0x15'),_0x4c1460);}};module[_0xbe78('0x16')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0174a5a..8bd1758 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 a013c3e..b27fc29 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 _0xe5e8=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x5bb53d,_0x1a6dfc){var _0x3fa503=function(_0xf33229){while(--_0xf33229){_0x5bb53d['push'](_0x5bb53d['shift']());}};_0x3fa503(++_0x1a6dfc);}(_0xe5e8,0xef));var _0x8e5e=function(_0x2f8b96,_0x52517a){_0x2f8b96=_0x2f8b96-0x0;var _0x209ffd=_0xe5e8[_0x2f8b96];return _0x209ffd;};'use strict';var client=require(_0x8e5e('0x0'));exports['update']=function(_0x1a695f,_0x14f30b){return client[_0x8e5e('0x1')](_0x8e5e('0x2'),{'body':_0x14f30b,'options':{'where':{'id':_0x1a695f}},'log':'updateChatInteraction'});};exports[_0x8e5e('0x3')]=function(_0x161690,_0x44c861){return client[_0x8e5e('0x1')](_0x8e5e('0x4'),{'body':_0x44c861,'options':{'where':{'id':_0x161690}},'log':_0x8e5e('0x5')});}; \ No newline at end of file +var _0x4c0d=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x3e17ec,_0x977d20){var _0x578ec7=function(_0x2b9340){while(--_0x2b9340){_0x3e17ec['push'](_0x3e17ec['shift']());}};_0x578ec7(++_0x977d20);}(_0x4c0d,0x170));var _0xd4c0=function(_0x26f484,_0x5dce63){_0x26f484=_0x26f484-0x0;var _0x39353a=_0x4c0d[_0x26f484];return _0x39353a;};'use strict';var client=require(_0xd4c0('0x0'));exports[_0xd4c0('0x1')]=function(_0x400dc9,_0x9f094b){return client[_0xd4c0('0x2')](_0xd4c0('0x3'),{'body':_0x9f094b,'options':{'where':{'id':_0x400dc9}},'log':_0xd4c0('0x4')});};exports[_0xd4c0('0x5')]=function(_0x620025,_0x35eae2){return client[_0xd4c0('0x2')](_0xd4c0('0x6'),{'body':_0x35eae2,'options':{'where':{'id':_0x620025}},'log':_0xd4c0('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2f9a294..35b18c4 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 _0x2b4d=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x5488da,_0xc78520){var _0x11ea48=function(_0x4369d5){while(--_0x4369d5){_0x5488da['push'](_0x5488da['shift']());}};_0x11ea48(++_0xc78520);}(_0x2b4d,0xd5));var _0xd2b4=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x2b4d[_0xdd2bfa];return _0x55397e;};'use strict';var client=require('../client');exports[_0xd2b4('0x0')]=function(_0x340b53){return client[_0xd2b4('0x1')](_0xd2b4('0x2'),{'body':_0x340b53,'log':_0xd2b4('0x3')});}; \ No newline at end of file +var _0xd329=['createChatMessage','../client','CreateChatMessage'];(function(_0x2c7407,_0x27095f){var _0x4412b1=function(_0x12c697){while(--_0x12c697){_0x2c7407['push'](_0x2c7407['shift']());}};_0x4412b1(++_0x27095f);}(_0xd329,0xcd));var _0x9d32=function(_0x3240fd,_0x429d2d){_0x3240fd=_0x3240fd-0x0;var _0x128a0c=_0xd329[_0x3240fd];return _0x128a0c;};'use strict';var client=require(_0x9d32('0x0'));exports['create']=function(_0x29f2d3){return client['Request'](_0x9d32('0x1'),{'body':_0x29f2d3,'log':_0x9d32('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a8b42d1..85bd29f 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 _0x295f=['getChatQueues','Request','GetChatQueue','timeout','strategy','name','online','chatPause'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0x295f,0x168));var _0xf295=function(_0x4459ab,_0x3f4715){_0x4459ab=_0x4459ab-0x0;var _0x3dc1c1=_0x295f[_0x4459ab];return _0x3dc1c1;};'use strict';var client=require('../client');exports[_0xf295('0x0')]=function(){return function(){return client[_0xf295('0x1')](_0xf295('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf295('0x3'),_0xf295('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf295('0x5'),_0xf295('0x6'),_0xf295('0x7')]}]},'log':_0xf295('0x0')});};}; \ No newline at end of file +var _0x9fc5=['online','chatPause','getChatQueues','Request','name','timeout','strategy','User','Agents'];(function(_0xf1f11f,_0x522adc){var _0x4cfd63=function(_0x5860d5){while(--_0x5860d5){_0xf1f11f['push'](_0xf1f11f['shift']());}};_0x4cfd63(++_0x522adc);}(_0x9fc5,0xb6));var _0x59fc=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x9fc5[_0x35181c];return _0xe14bf9;};'use strict';var client=require('../client');exports[_0x59fc('0x0')]=function(){return function(){return client[_0x59fc('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x59fc('0x2'),_0x59fc('0x3'),_0x59fc('0x4')],'include':[{'model':_0x59fc('0x5'),'as':_0x59fc('0x6'),'attributes':['id',_0x59fc('0x2'),_0x59fc('0x7'),_0x59fc('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d30fc52..c7f09f8 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 _0x4156=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x417c46,_0x6ba464){var _0x1809b5=function(_0x36898f){while(--_0x36898f){_0x417c46['push'](_0x417c46['shift']());}};_0x1809b5(++_0x6ba464);}(_0x4156,0xf1));var _0x6415=function(_0x34b602,_0x3c7410){_0x34b602=_0x34b602-0x0;var _0x457bd7=_0x4156[_0x34b602];return _0x457bd7;};'use strict';var client=require(_0x6415('0x0'));exports[_0x6415('0x1')]=function(_0x283016){return client[_0x6415('0x2')](_0x6415('0x3'),{'body':_0x283016,'log':'CreateChatQueueReport'});};exports[_0x6415('0x4')]=function(_0x4d8c74,_0xfd06c2){return client[_0x6415('0x2')](_0x6415('0x5'),{'body':_0xfd06c2,'options':{'where':{'uniqueid':_0x4d8c74},'order':[['id',_0x6415('0x6')]],'limit':0x1},'log':_0x6415('0x5')});}; \ No newline at end of file +var _0x25ad=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x25ad,0x1b1));var _0xd25a=function(_0x545795,_0x176bcf){_0x545795=_0x545795-0x0;var _0x4ad27f=_0x25ad[_0x545795];return _0x4ad27f;};'use strict';var client=require(_0xd25a('0x0'));exports['create']=function(_0xa9ddeb){return client[_0xd25a('0x1')](_0xd25a('0x2'),{'body':_0xa9ddeb,'log':'CreateChatQueueReport'});};exports[_0xd25a('0x3')]=function(_0x3a67e3,_0x1532c5){return client[_0xd25a('0x1')](_0xd25a('0x4'),{'body':_0x1532c5,'options':{'where':{'uniqueid':_0x3a67e3},'order':[['id',_0xd25a('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 026d7ea..023a31e 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(_0xca01b4,_0xb3130d){var _0x23582e=function(_0x51e9b5){while(--_0x51e9b5){_0xca01b4['push'](_0xca01b4['shift']());}};_0x23582e(++_0xb3130d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2915a7,_0x451590){var _0xbaaeeb=function(_0x1f396f){while(--_0x1f396f){_0x2915a7['push'](_0x2915a7['shift']());}};_0xbaaeeb(++_0x451590);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c99d719..ca8ba68 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 _0x0a74=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x449e67,_0x441362){var _0x58d7f3=function(_0x21f371){while(--_0x21f371){_0x449e67['push'](_0x449e67['shift']());}};_0x58d7f3(++_0x441362);}(_0x0a74,0x1c5));var _0x40a7=function(_0x45ae7b,_0xa7577d){_0x45ae7b=_0x45ae7b-0x0;var _0x2298fc=_0x0a74[_0x45ae7b];return _0x2298fc;};'use strict';var client=require(_0x40a7('0x0'));exports[_0x40a7('0x1')]=function(_0x163fcd){return client['Request'](_0x40a7('0x2'),{'body':_0x163fcd,'log':_0x40a7('0x3')});}; \ No newline at end of file +var _0xbf7d=['createFaxMessage','../client','create','Request'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xbf7d,0xc1));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdbf7('0x0'));exports[_0xdbf7('0x1')]=function(_0x4aebcf){return client[_0xdbf7('0x2')]('CreateFaxMessage',{'body':_0x4aebcf,'log':_0xdbf7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 763630d..d48cda6 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 _0xc5b6=['GetFaxQueue','name','timeout','strategy','User','faxPause','getFaxQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5b6,0x1ae));var _0x6c5b=function(_0x331d1c,_0x30fedd){_0x331d1c=_0x331d1c-0x0;var _0x3bc997=_0xc5b6[_0x331d1c];return _0x3bc997;};'use strict';var client=require('../client');exports[_0x6c5b('0x0')]=function(){return function(){return client[_0x6c5b('0x1')](_0x6c5b('0x2'),{'options':{'raw':![],'attributes':['id',_0x6c5b('0x3'),_0x6c5b('0x4'),_0x6c5b('0x5')],'include':[{'model':_0x6c5b('0x6'),'as':'Agents','attributes':['id',_0x6c5b('0x3'),'online',_0x6c5b('0x7')]}]},'log':_0x6c5b('0x0')});};}; \ No newline at end of file +var _0xb833=['timeout','User','Agents','name','online','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0xb833,0xe8));var _0x3b83=function(_0x12e0f4,_0x50e357){_0x12e0f4=_0x12e0f4-0x0;var _0x5713ad=_0xb833[_0x12e0f4];return _0x5713ad;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x3b83('0x0')](_0x3b83('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x3b83('0x2'),'strategy'],'include':[{'model':_0x3b83('0x3'),'as':_0x3b83('0x4'),'attributes':['id',_0x3b83('0x5'),_0x3b83('0x6'),_0x3b83('0x7')]}]},'log':_0x3b83('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 20d13d5..d5c8f15 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 _0x23e5=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x2cfef8,_0x230aa3){var _0x12167a=function(_0x2744db){while(--_0x2744db){_0x2cfef8['push'](_0x2cfef8['shift']());}};_0x12167a(++_0x230aa3);}(_0x23e5,0x17c));var _0x523e=function(_0x3eed4,_0x59c191){_0x3eed4=_0x3eed4-0x0;var _0x45449c=_0x23e5[_0x3eed4];return _0x45449c;};'use strict';var client=require('../client');exports[_0x523e('0x0')]=function(_0x33b2a5){return client[_0x523e('0x1')]('CreateFaxQueueReport',{'body':_0x33b2a5,'log':_0x523e('0x2')});};exports[_0x523e('0x3')]=function(_0x4ab563,_0x59be76){return client[_0x523e('0x1')]('UpdateFaxQueueReport',{'body':_0x59be76,'options':{'where':{'uniqueid':_0x4ab563},'order':[['id',_0x523e('0x4')]],'limit':0x1},'log':_0x523e('0x5')});}; \ No newline at end of file +var _0x3e38=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x1e1125,_0x5a9ad3){var _0x449502=function(_0x2963f9){while(--_0x2963f9){_0x1e1125['push'](_0x1e1125['shift']());}};_0x449502(++_0x5a9ad3);}(_0x3e38,0x68));var _0x83e3=function(_0x57de2a,_0x48323b){_0x57de2a=_0x57de2a-0x0;var _0x1c9964=_0x3e38[_0x57de2a];return _0x1c9964;};'use strict';var client=require(_0x83e3('0x0'));exports[_0x83e3('0x1')]=function(_0x494f68){return client[_0x83e3('0x2')](_0x83e3('0x3'),{'body':_0x494f68,'log':_0x83e3('0x3')});};exports['update']=function(_0x11775e,_0x4cd376){return client[_0x83e3('0x2')](_0x83e3('0x4'),{'body':_0x4cd376,'options':{'where':{'uniqueid':_0x11775e},'order':[['id',_0x83e3('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 77dc1f1..79526fc 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 _0x17db=['interval','getIntervals','Request','Interval'];(function(_0x1c3f84,_0x97d3be){var _0x9cb33e=function(_0x1021f2){while(--_0x1021f2){_0x1c3f84['push'](_0x1c3f84['shift']());}};_0x9cb33e(++_0x97d3be);}(_0x17db,0x13d));var _0xb17d=function(_0x13109d,_0x6582a4){_0x13109d=_0x13109d-0x0;var _0x214e38=_0x17db[_0x13109d];return _0x214e38;};'use strict';var client=require('../client');exports[_0xb17d('0x0')]=function(){return function(){return client[_0xb17d('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xb17d('0x2'),'as':'Intervals','attributes':['id','name',_0xb17d('0x3')]}]},'log':_0xb17d('0x0')});};}; \ No newline at end of file +var _0x1ac9=['Request','Intervals','name','interval','../client'];(function(_0x36a403,_0x3956e6){var _0x172d03=function(_0x277d78){while(--_0x277d78){_0x36a403['push'](_0x36a403['shift']());}};_0x172d03(++_0x3956e6);}(_0x1ac9,0xae));var _0x91ac=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x1ac9[_0x1f4fe3];return _0xe8dd52;};'use strict';var client=require(_0x91ac('0x0'));exports['getIntervals']=function(){return function(){return client[_0x91ac('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x91ac('0x2'),'attributes':['id',_0x91ac('0x3'),_0x91ac('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5afeb61..f0c8112 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 _0x2032=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x43f855,_0x8a23a8){_0x43f855=_0x43f855-0x0;var _0x2b8cda=_0x2032[_0x43f855];return _0x2b8cda;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(_0x1e103d,_0xcd892f){return client['Request'](_0x2203('0x1'),{'body':_0xcd892f,'options':{'where':{'id':_0x1e103d}},'log':_0x2203('0x2')});};exports['addTags']=function(_0x46c49a,_0x880dcd){return client[_0x2203('0x3')](_0x2203('0x4'),{'body':_0x880dcd,'options':{'where':{'id':_0x46c49a}},'log':_0x2203('0x5')});}; \ No newline at end of file +var _0x065e=['UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x065e,0x1a7));var _0xe065=function(_0x38b76a,_0x53d4a9){_0x38b76a=_0x38b76a-0x0;var _0x452681=_0x065e[_0x38b76a];return _0x452681;};'use strict';var client=require(_0xe065('0x0'));exports['update']=function(_0x549f09,_0x59293c){return client[_0xe065('0x1')](_0xe065('0x2'),{'body':_0x59293c,'options':{'where':{'id':_0x549f09}},'log':_0xe065('0x3')});};exports['addTags']=function(_0x4964fa,_0x4610a3){return client[_0xe065('0x1')]('AddTagsToMailInteraction',{'body':_0x4610a3,'options':{'where':{'id':_0x4964fa}},'log':_0xe065('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9a373cf..cc4ed3c 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 _0x6abc=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6abc,0x140));var _0xc6ab=function(_0x57fbe1,_0x3effd6){_0x57fbe1=_0x57fbe1-0x0;var _0x33bdd6=_0x6abc[_0x57fbe1];return _0x33bdd6;};'use strict';var client=require(_0xc6ab('0x0'));exports[_0xc6ab('0x1')]=function(_0x157983){return client[_0xc6ab('0x2')](_0xc6ab('0x3'),{'body':_0x157983,'log':_0xc6ab('0x4')});}; \ No newline at end of file +var _0xab9b=['../client','create','Request','CreateMailMessage'];(function(_0x48df6c,_0x228879){var _0x58757f=function(_0x43bbd7){while(--_0x43bbd7){_0x48df6c['push'](_0x48df6c['shift']());}};_0x58757f(++_0x228879);}(_0xab9b,0x158));var _0xbab9=function(_0x360e5c,_0x1d60de){_0x360e5c=_0x360e5c-0x0;var _0x3629ea=_0xab9b[_0x360e5c];return _0x3629ea;};'use strict';var client=require(_0xbab9('0x0'));exports[_0xbab9('0x1')]=function(_0x433e79){return client[_0xbab9('0x2')](_0xbab9('0x3'),{'body':_0x433e79,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 776bc9f..b99b429 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 _0x94f1=['online','mailPause','getMailQueues','Request','GetMailQueue','name'];(function(_0x12b1bb,_0x8bf78c){var _0x42573a=function(_0x39ac19){while(--_0x39ac19){_0x12b1bb['push'](_0x12b1bb['shift']());}};_0x42573a(++_0x8bf78c);}(_0x94f1,0x158));var _0x194f=function(_0x2e8ee9,_0x2c2059){_0x2e8ee9=_0x2e8ee9-0x0;var _0x34d93c=_0x94f1[_0x2e8ee9];return _0x34d93c;};'use strict';var client=require('../client');exports[_0x194f('0x0')]=function(){return function(){return client[_0x194f('0x1')](_0x194f('0x2'),{'options':{'raw':![],'attributes':['id',_0x194f('0x3'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x194f('0x3'),_0x194f('0x4'),_0x194f('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x220c=['Agents','name','mailPause','getMailQueues','Request','timeout','strategy'];(function(_0x83b2a9,_0x4d61a0){var _0x5edf72=function(_0x12bfc7){while(--_0x12bfc7){_0x83b2a9['push'](_0x83b2a9['shift']());}};_0x5edf72(++_0x4d61a0);}(_0x220c,0xf8));var _0xc220=function(_0x67d1cf,_0xc04ce3){_0x67d1cf=_0x67d1cf-0x0;var _0x49c66e=_0x220c[_0x67d1cf];return _0x49c66e;};'use strict';var client=require('../client');exports[_0xc220('0x0')]=function(){return function(){return client[_0xc220('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc220('0x2'),_0xc220('0x3')],'include':[{'model':'User','as':_0xc220('0x4'),'attributes':['id',_0xc220('0x5'),'online',_0xc220('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b69163c..52939bd 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 _0x9cd1=['DESC','../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x4b2e95,_0x1c7446){var _0x12b65c=function(_0x9d4ac4){while(--_0x9d4ac4){_0x4b2e95['push'](_0x4b2e95['shift']());}};_0x12b65c(++_0x1c7446);}(_0x9cd1,0x19f));var _0x19cd=function(_0x365c11,_0x57a8e2){_0x365c11=_0x365c11-0x0;var _0x88401=_0x9cd1[_0x365c11];return _0x88401;};'use strict';var client=require(_0x19cd('0x0'));exports[_0x19cd('0x1')]=function(_0x439cba){return client[_0x19cd('0x2')](_0x19cd('0x3'),{'body':_0x439cba,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1177cf,_0x86bf5a){return client[_0x19cd('0x2')](_0x19cd('0x4'),{'body':_0x86bf5a,'options':{'where':{'uniqueid':_0x1177cf},'order':[['id',_0x19cd('0x5')]],'limit':0x1},'log':_0x19cd('0x4')});}; \ No newline at end of file +var _0xb483=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','DESC'];(function(_0x9333a9,_0xbe002d){var _0x24158c=function(_0x25f159){while(--_0x25f159){_0x9333a9['push'](_0x9333a9['shift']());}};_0x24158c(++_0xbe002d);}(_0xb483,0x6d));var _0x3b48=function(_0x106950,_0x2d2c1e){_0x106950=_0x106950-0x0;var _0xb8a467=_0xb483[_0x106950];return _0xb8a467;};'use strict';var client=require(_0x3b48('0x0'));exports[_0x3b48('0x1')]=function(_0x1802a0){return client[_0x3b48('0x2')](_0x3b48('0x3'),{'body':_0x1802a0,'log':_0x3b48('0x3')});};exports['update']=function(_0x127856,_0x28f093){return client[_0x3b48('0x2')]('UpdateMailQueueReport',{'body':_0x28f093,'options':{'where':{'uniqueid':_0x127856},'order':[['id',_0x3b48('0x4')]],'limit':0x1},'log':_0x3b48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 59027c4..e4e1c8d 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 _0x50a9=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x50a9,0x19c));var _0x950a=function(_0x506d40,_0xe29fef){_0x506d40=_0x506d40-0x0;var _0x1b4020=_0x50a9[_0x506d40];return _0x1b4020;};'use strict';var client=require(_0x950a('0x0'));exports[_0x950a('0x1')]=function(_0xfa9296,_0x4bb1b7){return client[_0x950a('0x2')](_0x950a('0x3'),{'body':_0x4bb1b7,'options':{'where':{'id':_0xfa9296}},'log':_0x950a('0x4')});};exports[_0x950a('0x5')]=function(_0x15b684,_0x205bed){return client[_0x950a('0x2')](_0x950a('0x6'),{'body':_0x205bed,'options':{'where':{'id':_0x15b684}},'log':_0x950a('0x7')});}; \ No newline at end of file +var _0x5ad6=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x4ab441,_0x52f2d3){var _0x380e11=function(_0x5a5ed1){while(--_0x5a5ed1){_0x4ab441['push'](_0x4ab441['shift']());}};_0x380e11(++_0x52f2d3);}(_0x5ad6,0x1c6));var _0x65ad=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0x5ad6[_0x5a3ee9];return _0x45032c;};'use strict';var client=require('../client');exports[_0x65ad('0x0')]=function(_0x6ba6c3,_0x3348d5){return client[_0x65ad('0x1')](_0x65ad('0x2'),{'body':_0x3348d5,'options':{'where':{'id':_0x6ba6c3}},'log':_0x65ad('0x3')});};exports['addTags']=function(_0x8bed7a,_0x3b281b){return client['Request'](_0x65ad('0x4'),{'body':_0x3b281b,'options':{'where':{'id':_0x8bed7a}},'log':_0x65ad('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c5ed4e2..61ab5fc 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 _0xa026=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x27dac2,_0x82c3eb){var _0x436264=function(_0x30b0b7){while(--_0x30b0b7){_0x27dac2['push'](_0x27dac2['shift']());}};_0x436264(++_0x82c3eb);}(_0xa026,0x1a9));var _0x6a02=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xa026[_0x5a7d41];return _0x98d8fa;};'use strict';var client=require(_0x6a02('0x0'));exports[_0x6a02('0x1')]=function(_0x503858){return client[_0x6a02('0x2')](_0x6a02('0x3'),{'body':_0x503858,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x5984=['../client','create','Request','createOpenchannelMessage'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x5984,0xd8));var _0x4598=function(_0x5b3936,_0x532c5f){_0x5b3936=_0x5b3936-0x0;var _0x2de8da=_0x5984[_0x5b3936];return _0x2de8da;};'use strict';var client=require(_0x4598('0x0'));exports[_0x4598('0x1')]=function(_0x2c1c6a){return client[_0x4598('0x2')]('CreateOpenchannelMessage',{'body':_0x2c1c6a,'log':_0x4598('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7c92bc6..e4e3f73 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 _0xaae2=['openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','online'];(function(_0x19f3db,_0x45c381){var _0x4eb6f3=function(_0x5335e1){while(--_0x5335e1){_0x19f3db['push'](_0x19f3db['shift']());}};_0x4eb6f3(++_0x45c381);}(_0xaae2,0x1a8));var _0x2aae=function(_0xbfce33,_0x1f94a0){_0xbfce33=_0xbfce33-0x0;var _0x14696e=_0xaae2[_0xbfce33];return _0x14696e;};'use strict';var client=require(_0x2aae('0x0'));exports[_0x2aae('0x1')]=function(){return function(){return client[_0x2aae('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2aae('0x3'),_0x2aae('0x4'),_0x2aae('0x5')],'include':[{'model':_0x2aae('0x6'),'as':'Agents','attributes':['id',_0x2aae('0x3'),_0x2aae('0x7'),_0x2aae('0x8')]}]},'log':_0x2aae('0x1')});};}; \ No newline at end of file +var _0xc85c=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x1b22a2,_0x27eb42){var _0xa45a4d=function(_0x3563af){while(--_0x3563af){_0x1b22a2['push'](_0x1b22a2['shift']());}};_0xa45a4d(++_0x27eb42);}(_0xc85c,0xb9));var _0xcc85=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xc85c[_0x403c8d];return _0x4ca60d;};'use strict';var client=require(_0xcc85('0x0'));exports[_0xcc85('0x1')]=function(){return function(){return client[_0xcc85('0x2')](_0xcc85('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc85('0x4'),_0xcc85('0x5'),_0xcc85('0x6')],'include':[{'model':_0xcc85('0x7'),'as':_0xcc85('0x8'),'attributes':['id',_0xcc85('0x4'),_0xcc85('0x9'),_0xcc85('0xa')]}]},'log':_0xcc85('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2ae743f..c2434ea 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 _0x08f1=['create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x08f1,0xd8));var _0x108f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x08f1[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x108f('0x0')]=function(_0x1f0944){return client['Request'](_0x108f('0x1'),{'body':_0x1f0944,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x1f8e08,_0x5d3c09){return client[_0x108f('0x2')](_0x108f('0x3'),{'body':_0x5d3c09,'options':{'where':{'uniqueid':_0x1f8e08},'order':[['id','DESC']],'limit':0x1},'log':_0x108f('0x3')});}; \ No newline at end of file +var _0xf948=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf948,0x79));var _0x8f94=function(_0x53ac5b,_0x9cef1e){_0x53ac5b=_0x53ac5b-0x0;var _0x5738ca=_0xf948[_0x53ac5b];return _0x5738ca;};'use strict';var client=require(_0x8f94('0x0'));exports[_0x8f94('0x1')]=function(_0x9ed8d0){return client[_0x8f94('0x2')]('CreateOpenchannelQueueReport',{'body':_0x9ed8d0,'log':_0x8f94('0x3')});};exports[_0x8f94('0x4')]=function(_0x268708,_0x2d3cbf){return client['Request'](_0x8f94('0x5'),{'body':_0x2d3cbf,'options':{'where':{'uniqueid':_0x268708},'order':[['id',_0x8f94('0x6')]],'limit':0x1},'log':_0x8f94('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 04fc720..d47c52d 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 _0xe2cc=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x2e0d05,_0x268558){var _0x5480f8=function(_0x3517b6){while(--_0x3517b6){_0x2e0d05['push'](_0x2e0d05['shift']());}};_0x5480f8(++_0x268558);}(_0xe2cc,0x69));var _0xce2c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe2cc[_0x432682];return _0x463d05;};'use strict';var client=require(_0xce2c('0x0'));exports[_0xce2c('0x1')]=function(_0x59c9fc,_0x4a4c87){return client[_0xce2c('0x2')](_0xce2c('0x3'),{'body':_0x4a4c87,'options':{'where':{'id':_0x59c9fc}},'log':_0xce2c('0x4')});};exports[_0xce2c('0x5')]=function(_0x25e41a,_0x1a7c4e){return client[_0xce2c('0x2')](_0xce2c('0x6'),{'body':_0x1a7c4e,'options':{'where':{'id':_0x25e41a}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x72a2=['addTags','update','Request','UpdateSmsInteraction'];(function(_0x13f2af,_0x39cb71){var _0xd864c0=function(_0x4afc23){while(--_0x4afc23){_0x13f2af['push'](_0x13f2af['shift']());}};_0xd864c0(++_0x39cb71);}(_0x72a2,0x161));var _0x272a=function(_0x27356b,_0x56ad7c){_0x27356b=_0x27356b-0x0;var _0x3230b8=_0x72a2[_0x27356b];return _0x3230b8;};'use strict';var client=require('../client');exports[_0x272a('0x0')]=function(_0xd12811,_0x1927cc){return client[_0x272a('0x1')](_0x272a('0x2'),{'body':_0x1927cc,'options':{'where':{'id':_0xd12811}},'log':'updateSmsInteraction'});};exports[_0x272a('0x3')]=function(_0x52287e,_0x1d154d){return client['Request']('AddTagsToSmsInteraction',{'body':_0x1d154d,'options':{'where':{'id':_0x52287e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index dd787c2..130909b 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 _0x63c6=['createSmsMessage','../client','create','Request'];(function(_0x13938e,_0x21b17f){var _0x1aebfe=function(_0x5d7ae0){while(--_0x5d7ae0){_0x13938e['push'](_0x13938e['shift']());}};_0x1aebfe(++_0x21b17f);}(_0x63c6,0x171));var _0x663c=function(_0x1ff960,_0x1e3ce5){_0x1ff960=_0x1ff960-0x0;var _0x2a7e10=_0x63c6[_0x1ff960];return _0x2a7e10;};'use strict';var client=require(_0x663c('0x0'));exports[_0x663c('0x1')]=function(_0x55d2ad){return client[_0x663c('0x2')]('CreateSmsMessage',{'body':_0x55d2ad,'log':_0x663c('0x3')});}; \ No newline at end of file +var _0x58dd=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x4445ee,_0x45aabd){var _0x1fbcb3=function(_0x20ace4){while(--_0x20ace4){_0x4445ee['push'](_0x4445ee['shift']());}};_0x1fbcb3(++_0x45aabd);}(_0x58dd,0x112));var _0xd58d=function(_0x58c2fd,_0x28c0d0){_0x58c2fd=_0x58c2fd-0x0;var _0x2c60e2=_0x58dd[_0x58c2fd];return _0x2c60e2;};'use strict';var client=require(_0xd58d('0x0'));exports[_0xd58d('0x1')]=function(_0x3d5593){return client[_0xd58d('0x2')](_0xd58d('0x3'),{'body':_0x3d5593,'log':_0xd58d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b768c62..4211d87 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x1c710e,_0x3bf3da){var _0x59a0af=function(_0x5d0452){while(--_0x5d0452){_0x1c710e['push'](_0x1c710e['shift']());}};_0x59a0af(++_0x3bf3da);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1c9a1b,_0x2909ea){var _0x5d5fc9=function(_0x326b3d){while(--_0x326b3d){_0x1c9a1b['push'](_0x1c9a1b['shift']());}};_0x5d5fc9(++_0x2909ea);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'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 99c1013..429fccc 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ea49a,_0x3f94b3){_0x3ea49a=_0x3ea49a-0x0;var _0x1b60e4=_0xedd9[_0x3ea49a];return _0x1b60e4;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x191746,_0x3c8646){var _0x2352ac=function(_0x2c859d){while(--_0x2c859d){_0x191746['push'](_0x191746['shift']());}};_0x2352ac(++_0x3c8646);}(_0x55ca,0x126));var _0xa55c=function(_0x311c35,_0x54a2b0){_0x311c35=_0x311c35-0x0;var _0x31ff65=_0x55ca[_0x311c35];return _0x31ff65;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 53ee6da..779c6d3 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(_0x5e9aab,_0xfede3c){var _0x10dc9a=function(_0x36d9ae){while(--_0x36d9ae){_0x5e9aab['push'](_0x5e9aab['shift']());}};_0x10dc9a(++_0xfede3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x5a622c,_0x5b9f65){var _0x1c6a21=function(_0x27cd08){while(--_0x27cd08){_0x5a622c['push'](_0x5a622c['shift']());}};_0x1c6a21(++_0x5b9f65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 370dbfd..ad46da0 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 _0x4873=['update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x542335,_0x1504bc){var _0x3800f4=function(_0x4f408e){while(--_0x4f408e){_0x542335['push'](_0x542335['shift']());}};_0x3800f4(++_0x1504bc);}(_0x4873,0x1df));var _0x3487=function(_0x47afa9,_0x4cdef0){_0x47afa9=_0x47afa9-0x0;var _0x4be085=_0x4873[_0x47afa9];return _0x4be085;};'use strict';var client=require(_0x3487('0x0'));exports[_0x3487('0x1')]=function(_0x332e18,_0x4ca7ad){return client[_0x3487('0x2')]('UpdateWhatsappInteraction',{'body':_0x4ca7ad,'options':{'where':{'id':_0x332e18}},'log':'updateWhatsappInteraction'});};exports[_0x3487('0x3')]=function(_0xbc64e7,_0x54ff70){return client[_0x3487('0x2')](_0x3487('0x4'),{'body':_0x54ff70,'options':{'where':{'id':_0xbc64e7}},'log':_0x3487('0x5')});}; \ No newline at end of file +var _0x0e4b=['../client','update','Request','addTagsToWhatsappInteraction'];(function(_0x723767,_0x47dc73){var _0x5a7ca2=function(_0x2b38fa){while(--_0x2b38fa){_0x723767['push'](_0x723767['shift']());}};_0x5a7ca2(++_0x47dc73);}(_0x0e4b,0xdc));var _0xb0e4=function(_0xa8f012,_0x23780d){_0xa8f012=_0xa8f012-0x0;var _0x49c3b2=_0x0e4b[_0xa8f012];return _0x49c3b2;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(_0x65d4d1,_0x4dceb8){return client[_0xb0e4('0x2')]('UpdateWhatsappInteraction',{'body':_0x4dceb8,'options':{'where':{'id':_0x65d4d1}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x538147,_0x79717e){return client[_0xb0e4('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x79717e,'options':{'where':{'id':_0x538147}},'log':_0xb0e4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d45a18b..3f64b09 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 _0x2cc7=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x1cd7f1,_0x44236f){var _0x5adfde=function(_0x409537){while(--_0x409537){_0x1cd7f1['push'](_0x1cd7f1['shift']());}};_0x5adfde(++_0x44236f);}(_0x2cc7,0xa8));var _0x72cc=function(_0x1946cd,_0xe56e21){_0x1946cd=_0x1946cd-0x0;var _0x3af4b9=_0x2cc7[_0x1946cd];return _0x3af4b9;};'use strict';var client=require(_0x72cc('0x0'));exports['create']=function(_0x4a250f){return client[_0x72cc('0x1')](_0x72cc('0x2'),{'body':_0x4a250f,'log':_0x72cc('0x3')});}; \ No newline at end of file +var _0x5a33=['create','../client'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x5a33,0xbb));var _0x35a3=function(_0x2bb15a,_0x4fcfbd){_0x2bb15a=_0x2bb15a-0x0;var _0x30f3cb=_0x5a33[_0x2bb15a];return _0x30f3cb;};'use strict';var client=require(_0x35a3('0x0'));exports[_0x35a3('0x1')]=function(_0x137f34){return client['Request']('CreateWhatsappMessage',{'body':_0x137f34,'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 1054439..bbbf9f6 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 _0x358f=['whatsappPause','../client','GetWhatsappQueue','name','timeout','strategy','Agents','online'];(function(_0x57ad89,_0x5da615){var _0x1bb497=function(_0x36b9f2){while(--_0x36b9f2){_0x57ad89['push'](_0x57ad89['shift']());}};_0x1bb497(++_0x5da615);}(_0x358f,0x69));var _0xf358=function(_0x42a0f6,_0x4ee755){_0x42a0f6=_0x42a0f6-0x0;var _0x259bdb=_0x358f[_0x42a0f6];return _0x259bdb;};'use strict';var client=require(_0xf358('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xf358('0x1'),{'options':{'raw':![],'attributes':['id',_0xf358('0x2'),_0xf358('0x3'),_0xf358('0x4')],'include':[{'model':'User','as':_0xf358('0x5'),'attributes':['id',_0xf358('0x2'),_0xf358('0x6'),_0xf358('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xdab4=['strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xdab4,0x72));var _0x4dab=function(_0x5ab779,_0xb205b4){_0x5ab779=_0x5ab779-0x0;var _0x56c6a3=_0xdab4[_0x5ab779];return _0x56c6a3;};'use strict';var client=require(_0x4dab('0x0'));exports[_0x4dab('0x1')]=function(){return function(){return client[_0x4dab('0x2')](_0x4dab('0x3'),{'options':{'raw':![],'attributes':['id',_0x4dab('0x4'),_0x4dab('0x5'),_0x4dab('0x6')],'include':[{'model':_0x4dab('0x7'),'as':_0x4dab('0x8'),'attributes':['id',_0x4dab('0x4'),_0x4dab('0x9'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e9fd21d..06b7818 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 _0x10ab=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x4e3370,_0x5b813f){var _0x3d169b=function(_0x31b444){while(--_0x31b444){_0x4e3370['push'](_0x4e3370['shift']());}};_0x3d169b(++_0x5b813f);}(_0x10ab,0xa5));var _0xb10a=function(_0x293a24,_0x2406e6){_0x293a24=_0x293a24-0x0;var _0x23d1cf=_0x10ab[_0x293a24];return _0x23d1cf;};'use strict';var client=require(_0xb10a('0x0'));exports[_0xb10a('0x1')]=function(_0x2f0e84){return client[_0xb10a('0x2')](_0xb10a('0x3'),{'body':_0x2f0e84,'log':_0xb10a('0x3')});};exports[_0xb10a('0x4')]=function(_0x195b9d,_0x2d007d){return client['Request'](_0xb10a('0x5'),{'body':_0x2d007d,'options':{'where':{'uniqueid':_0x195b9d},'order':[['id',_0xb10a('0x6')]],'limit':0x1},'log':_0xb10a('0x5')});}; \ No newline at end of file +var _0x170a=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x170a,0x93));var _0xa170=function(_0x392b2c,_0x43fd76){_0x392b2c=_0x392b2c-0x0;var _0x5e77ae=_0x170a[_0x392b2c];return _0x5e77ae;};'use strict';var client=require(_0xa170('0x0'));exports[_0xa170('0x1')]=function(_0x326936){return client[_0xa170('0x2')]('CreateWhatsappQueueReport',{'body':_0x326936,'log':'CreateWhatsappQueueReport'});};exports[_0xa170('0x3')]=function(_0x50aead,_0x6f5c70){return client[_0xa170('0x2')]('UpdateWhatsappQueueReport',{'body':_0x6f5c70,'options':{'where':{'uniqueid':_0x50aead},'order':[['id',_0xa170('0x4')]],'limit':0x1},'log':_0xa170('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c63a8a5..53173e1 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 _0xa4e6=['../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','stop','find','name','timeout','createQueue','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa4e6,0x6c));var _0x6a4e=function(_0x454fd1,_0x27401d){_0x454fd1=_0x454fd1-0x0;var _0x217d49=_0xa4e6[_0x454fd1];return _0x217d49;};'use strict';var schema=require('validate');var _=require(_0x6a4e('0x0'));var util=require(_0x6a4e('0x1'));var seqqueue=require(_0x6a4e('0x2'));var logger=require(_0x6a4e('0x3'))(_0x6a4e('0x4'));var strategy=require(_0x6a4e('0x5'));var queue=schema({'name':{'type':_0x6a4e('0x6'),'required':!![],'message':_0x6a4e('0x7')},'timeout':{'type':_0x6a4e('0x8'),'message':_0x6a4e('0x9')}});function writeLog(_0x42f58c,_0x17ddfe,_0x3ca1ed){return logger['info'](util[_0x6a4e('0xa')](_0x6a4e('0xb'),_0x42f58c,_0x17ddfe['name'],_0x3ca1ed));}function handleFindAgent(_0x4938e0){return function(_0x8de614){return _0x8de614['name'][_0x6a4e('0xc')]()===_0x4938e0[_0x6a4e('0xc')]();};}exports[_0x6a4e('0xd')]=function(_0x356fb3,_0x140dc1,_0x56b276,_0xeb3603){return function(_0x553e81){try{var _0x4dfee6={'name':_0x140dc1[0x0],'timeout':_0x140dc1[0x1]};var _0x3ab04e=queue[_0x6a4e('0xe')](_0x4dfee6,{'typecast':!![]});if(_0x3ab04e[_0x6a4e('0xf')]){logger[_0x6a4e('0x10')](_0x6a4e('0x11'),_0x356fb3,_['map'](_0x3ab04e,_0x6a4e('0x12'))[_0x6a4e('0x13')](',\x20'));_0x553e81[_0x6a4e('0x14')]();}else{var _0x47f4aa=_[_0x6a4e('0x15')](_0x56b276['agents'],handleFindAgent(_0x4dfee6[_0x6a4e('0x16')]));if(_0x47f4aa){var _0x3418ac=(_0x4dfee6[_0x6a4e('0x17')]||0xa)*0x3e8;var _0x1b6b41,_0x1eef78;var _0x419c3c=seqqueue[_0x6a4e('0x18')](_0x3418ac);_0x419c3c['id']=_0x356fb3;_0x419c3c['atimeout']=_0x3418ac;_0x419c3c['channel']=_0xeb3603[_0x6a4e('0x19')];writeLog(_0x356fb3,_0x47f4aa,util[_0x6a4e('0xa')]('START:%s',_0x3418ac));_0x56b276[_0x6a4e('0x1a')][_0x356fb3]['on'](_0x6a4e('0x1b'),function(){logger[_0x6a4e('0x1c')](_0x6a4e('0x1d'),_0x356fb3);clearTimeout(_0x1eef78);_0x1eef78=undefined;_0x419c3c[_0x6a4e('0x1e')]();if(_0x56b276[_0x6a4e('0x1a')][_0x356fb3]){delete _0x56b276['rules'][_0x356fb3];}_0x553e81[_0x6a4e('0x14')]();});_0x56b276[_0x6a4e('0x1a')][_0x356fb3]['on'](_0x6a4e('0x1f'),function(){if(_0x56b276['rules'][_0x356fb3]){delete _0x56b276['rules'][_0x356fb3];}});_0x1eef78=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x356fb3);clearTimeout(_0x1eef78);_0x419c3c[_0x6a4e('0x1e')]();_0x553e81[_0x6a4e('0x20')]();},_0x3418ac);strategy[_0x6a4e('0x21')](_0x419c3c,_0x47f4aa,_0x56b276,_0xeb3603);}else{logger[_0x6a4e('0x10')](_0x6a4e('0x22'),_0x356fb3,_0x4dfee6[_0x6a4e('0x16')]);_0x553e81[_0x6a4e('0x14')]();}}}catch(_0x1d8caf){console[_0x6a4e('0x23')](_0x1d8caf);logger[_0x6a4e('0x10')]('[%s][QUEUE]\x20%s',_0x356fb3,_0x1d8caf[_0x6a4e('0x24')]);_0x553e81[_0x6a4e('0x14')]();}};}; \ No newline at end of file +var _0xe18a=['length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x145ac8,_0x387ddb){var _0x3af403=function(_0x12c37c){while(--_0x12c37c){_0x145ac8['push'](_0x145ac8['shift']());}};_0x3af403(++_0x387ddb);}(_0xe18a,0x12d));var _0xae18=function(_0x3b632c,_0x13dbf8){_0x3b632c=_0x3b632c-0x0;var _0x3d5e8d=_0xe18a[_0x3b632c];return _0x3d5e8d;};'use strict';var schema=require(_0xae18('0x0'));var _=require(_0xae18('0x1'));var util=require(_0xae18('0x2'));var seqqueue=require(_0xae18('0x3'));var logger=require('../../../../config/logger')(_0xae18('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xae18('0x5')},'timeout':{'type':_0xae18('0x6'),'message':_0xae18('0x7')}});function writeLog(_0x4c208e,_0x42f3f8,_0x1dd15f){return logger[_0xae18('0x8')](util[_0xae18('0x9')](_0xae18('0xa'),_0x4c208e,_0x42f3f8[_0xae18('0xb')],_0x1dd15f));}function handleFindAgent(_0x1f3503){return function(_0x39e2e7){return _0x39e2e7['name'][_0xae18('0xc')]()===_0x1f3503['toLowerCase']();};}exports[_0xae18('0xd')]=function(_0x2c480f,_0x46a960,_0x5cd053,_0x3b6af3){return function(_0x544d1e){try{var _0x3fe6b8={'name':_0x46a960[0x0],'timeout':_0x46a960[0x1]};var _0x370c58=queue['validate'](_0x3fe6b8,{'typecast':!![]});if(_0x370c58[_0xae18('0xe')]){logger[_0xae18('0xf')](_0xae18('0x10'),_0x2c480f,_[_0xae18('0x11')](_0x370c58,_0xae18('0x12'))[_0xae18('0x13')](',\x20'));_0x544d1e[_0xae18('0x14')]();}else{var _0x3dfcc8=_[_0xae18('0x15')](_0x5cd053['agents'],handleFindAgent(_0x3fe6b8[_0xae18('0xb')]));if(_0x3dfcc8){var _0x160450=(_0x3fe6b8[_0xae18('0x16')]||0xa)*0x3e8;var _0x12bb8a,_0x6cacca;var _0x22d263=seqqueue[_0xae18('0x17')](_0x160450);_0x22d263['id']=_0x2c480f;_0x22d263['atimeout']=_0x160450;_0x22d263[_0xae18('0x18')]=_0x3b6af3['channel'];writeLog(_0x2c480f,_0x3dfcc8,util[_0xae18('0x9')](_0xae18('0x19'),_0x160450));_0x5cd053[_0xae18('0x1a')][_0x2c480f]['on']('end',function(){logger[_0xae18('0x8')](_0xae18('0x1b'),_0x2c480f);clearTimeout(_0x6cacca);_0x6cacca=undefined;_0x22d263[_0xae18('0x1c')]();if(_0x5cd053['rules'][_0x2c480f]){delete _0x5cd053[_0xae18('0x1a')][_0x2c480f];}_0x544d1e[_0xae18('0x14')]();});_0x5cd053[_0xae18('0x1a')][_0x2c480f]['on'](_0xae18('0x1d'),function(){if(_0x5cd053[_0xae18('0x1a')][_0x2c480f]){delete _0x5cd053[_0xae18('0x1a')][_0x2c480f];}});_0x6cacca=setTimeout(function(){logger[_0xae18('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x2c480f);clearTimeout(_0x6cacca);_0x22d263[_0xae18('0x1c')]();_0x544d1e[_0xae18('0x1e')]();},_0x160450);strategy[_0xae18('0x1f')](_0x22d263,_0x3dfcc8,_0x5cd053,_0x3b6af3);}else{logger[_0xae18('0xf')](_0xae18('0x20'),_0x2c480f,_0x3fe6b8[_0xae18('0xb')]);_0x544d1e[_0xae18('0x14')]();}}}catch(_0x219f62){console[_0xae18('0x21')](_0x219f62);logger['error'](_0xae18('0x22'),_0x2c480f,_0x219f62['stack']);_0x544d1e[_0xae18('0x14')]();}};}; \ 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 4334a07..a65fadc 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 _0xaf2c=['$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','upperFirst','account','InteractionId','isEmpty','body','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf2c,0x152));var _0xcaf2=function(_0x39be51,_0x5586f1){_0x39be51=_0x39be51-0x0;var _0x57afca=_0xaf2c[_0x39be51];return _0x57afca;};'use strict';var _=require(_0xcaf2('0x0'));var moment=require(_0xcaf2('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xcaf2('0x2')),'openchannelMessage':require(_0xcaf2('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcaf2('0x4')),'faxMessage':require(_0xcaf2('0x5')),'whatsappMessage':require(_0xcaf2('0x6'))};exports[_0xcaf2('0x7')]=function(_0x2d39f1,_0x57923c){return function(_0x50e767){try{if(!_[_0xcaf2('0x8')](this[_0xcaf2('0x9')][_0xcaf2('0xa')])){logger[_0xcaf2('0xb')](_0xcaf2('0xc'),_0x2d39f1,_0xcaf2('0xd'));return _0x50e767[_0xcaf2('0xe')]();}var _0x1bb48b={'ContactId':this[_0xcaf2('0xf')]['id'],'sentAt':moment()[_0xcaf2('0x10')](_0xcaf2('0x11')),'direction':_0xcaf2('0x12')};if(this[_0xcaf2('0x13')]==='sms'||this[_0xcaf2('0x13')]===_0xcaf2('0x14')){_0x1bb48b[_0xcaf2('0x15')]=this[_0xcaf2('0x9')][_0xcaf2('0x15')];}var _0xeb7c18=this['channel'];if(_0xeb7c18===_0xcaf2('0x16')){_0x1bb48b['ChatWebsiteId']=this['account']['id'];}else{_0x1bb48b[_[_0xcaf2('0x17')](_0xeb7c18)+'AccountId']=this[_0xcaf2('0x18')]['id'];}_0x1bb48b[_[_0xcaf2('0x17')](_0xeb7c18)+_0xcaf2('0x19')]=this[_0xcaf2('0x9')]['id'];if(this['interaction']['created']){var _0x31166f=_0x57923c[0x4];if(!_[_0xcaf2('0x1a')](_0x31166f)){_0x1bb48b[_0xcaf2('0x1b')]=utils['getMustacheRender'](_0x31166f,this);return rpc[_0xeb7c18+_0xcaf2('0x1c')][_0xcaf2('0x1d')](_0x1bb48b)[_0xcaf2('0x1e')](function(_0x53566f){logger['info'](_0xcaf2('0xc'),_0x2d39f1,_0x1bb48b[_0xcaf2('0x1b')]);})[_0xcaf2('0x1f')](function(_0x2a3d3c){logger[_0xcaf2('0x20')](_0xcaf2('0xc'),_0x2d39f1,JSON[_0xcaf2('0x21')](_0x2a3d3c));})[_0xcaf2('0x22')](function(){logger['info'](_0xcaf2('0x23'),_0x2d39f1);_0x50e767[_0xcaf2('0x24')]();});}else{logger[_0xcaf2('0xb')](_0xcaf2('0x25'),_0x2d39f1);_0x50e767[_0xcaf2('0x24')]();}}else{var _0x3ec961=this;var _0x5d9d87=new AWS['LexRuntime']({'accessKeyId':_0x57923c[0x0],'secretAccessKey':_0x57923c[0x1],'region':_0x57923c[0x2]});var _0x4aa01d={'botAlias':_0xcaf2('0x26'),'botName':_0x57923c[0x3],'inputText':this[_0xcaf2('0x27')]['body'],'userId':this[_0xcaf2('0x13')]+':'+this[_0xcaf2('0x9')]['id'][_0xcaf2('0x28')]()};_0x5d9d87[_0xcaf2('0x29')](_0x4aa01d,function(_0x41f188,_0x2e4b36){if(_0x41f188){logger['error'](_0xcaf2('0xc'),_0x2d39f1,_0x41f188[_0xcaf2('0x27')]);_0x50e767[_0xcaf2('0xe')]();}else if(_0x2e4b36&&_0x2e4b36['message']){_0x3ec961['body'][_0xcaf2('0x2a')]=_0x2e4b36;_0x1bb48b['body']=_0x2e4b36[_0xcaf2('0x27')];_0x1bb48b[_0xcaf2('0x2b')]=_0xcaf2('0x2a');_0x1bb48b[_0xcaf2('0x2c')]=JSON['stringify'](_0x2e4b36);return rpc[_0xeb7c18+'Message']['create'](_0x1bb48b)[_0xcaf2('0x1e')](function(_0x42fd5f){logger['info'](_0xcaf2('0xc'),_0x2d39f1,_0x1bb48b[_0xcaf2('0x1b')]);if(_0x2e4b36[_0xcaf2('0x2d')]==_0xcaf2('0x2e')){_0x50e767[_0xcaf2('0xe')]();}else{_0x50e767[_0xcaf2('0x24')]();}})['catch'](function(_0x2b8bb9){logger[_0xcaf2('0x20')](_0xcaf2('0xc'),_0x2d39f1,JSON[_0xcaf2('0x21')](_0x2b8bb9));_0x50e767[_0xcaf2('0xe')]();});}else{_0x50e767[_0xcaf2('0xe')]();}});}}catch(_0x24b749){logger['error'](_0xcaf2('0xc'),_0x2d39f1,JSON[_0xcaf2('0x21')](_0x24b749));_0x50e767[_0xcaf2('0x24')]();}};}; \ No newline at end of file +var _0x4898=['dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse'];(function(_0xbcfcda,_0x5bacf7){var _0x38250a=function(_0x3eb527){while(--_0x3eb527){_0xbcfcda['push'](_0xbcfcda['shift']());}};_0x38250a(++_0x5bacf7);}(_0x4898,0x10a));var _0x8489=function(_0x50840f,_0x4f02ca){_0x50840f=_0x50840f-0x0;var _0x53640c=_0x4898[_0x50840f];return _0x53640c;};'use strict';var _=require(_0x8489('0x0'));var moment=require(_0x8489('0x1'));var AWS=require(_0x8489('0x2'));var utils=require(_0x8489('0x3'));var logger=require(_0x8489('0x4'))(_0x8489('0x5'));var rpc={'chatMessage':require(_0x8489('0x6')),'openchannelMessage':require(_0x8489('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8489('0x8')),'whatsappMessage':require(_0x8489('0x9'))};exports[_0x8489('0xa')]=function(_0x58ca5c,_0x1cc3a9){return function(_0x241f37){try{if(!_[_0x8489('0xb')](this['interaction'][_0x8489('0xc')])){logger[_0x8489('0xd')](_0x8489('0xe'),_0x58ca5c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x241f37[_0x8489('0xf')]();}var _0x217722={'ContactId':this[_0x8489('0x10')]['id'],'sentAt':moment()[_0x8489('0x11')](_0x8489('0x12')),'direction':_0x8489('0x13')};if(this[_0x8489('0x14')]===_0x8489('0x15')||this[_0x8489('0x14')]===_0x8489('0x16')){_0x217722[_0x8489('0x17')]=this[_0x8489('0x18')][_0x8489('0x17')];}var _0x4f2c6d=this[_0x8489('0x14')];if(_0x4f2c6d===_0x8489('0x19')){_0x217722[_0x8489('0x1a')]=this['account']['id'];}else{_0x217722[_['upperFirst'](_0x4f2c6d)+_0x8489('0x1b')]=this[_0x8489('0x1c')]['id'];}_0x217722[_[_0x8489('0x1d')](_0x4f2c6d)+_0x8489('0x1e')]=this[_0x8489('0x18')]['id'];if(this[_0x8489('0x18')][_0x8489('0x1f')]){var _0x195309=_0x1cc3a9[0x4];if(!_[_0x8489('0x20')](_0x195309)){_0x217722[_0x8489('0x21')]=utils[_0x8489('0x22')](_0x195309,this);return rpc[_0x4f2c6d+_0x8489('0x23')][_0x8489('0x24')](_0x217722)[_0x8489('0x25')](function(_0x30cb2c){logger[_0x8489('0xd')](_0x8489('0xe'),_0x58ca5c,_0x217722['body']);})[_0x8489('0x26')](function(_0x2925d5){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON[_0x8489('0x28')](_0x2925d5));})[_0x8489('0x29')](function(){logger[_0x8489('0xd')](_0x8489('0x2a'),_0x58ca5c);_0x241f37['stop']();});}else{logger['info'](_0x8489('0x2b'),_0x58ca5c);_0x241f37[_0x8489('0x2c')]();}}else{var _0x9f20af=this;var _0x162568=new AWS[(_0x8489('0x2d'))]({'accessKeyId':_0x1cc3a9[0x0],'secretAccessKey':_0x1cc3a9[0x1],'region':_0x1cc3a9[0x2]});var _0x57d269={'botAlias':'$LATEST','botName':_0x1cc3a9[0x3],'inputText':this[_0x8489('0x2e')][_0x8489('0x21')],'userId':this[_0x8489('0x14')]+':'+this[_0x8489('0x18')]['id'][_0x8489('0x2f')]()};_0x162568[_0x8489('0x30')](_0x57d269,function(_0x2d6fac,_0x18740c){if(_0x2d6fac){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,_0x2d6fac[_0x8489('0x2e')]);_0x241f37[_0x8489('0xf')]();}else if(_0x18740c&&_0x18740c['message']){_0x9f20af[_0x8489('0x21')][_0x8489('0x31')]=_0x18740c;_0x217722['body']=_0x18740c[_0x8489('0x2e')];_0x217722[_0x8489('0x32')]=_0x8489('0x31');_0x217722[_0x8489('0x33')]=JSON['stringify'](_0x18740c);return rpc[_0x4f2c6d+_0x8489('0x23')]['create'](_0x217722)[_0x8489('0x25')](function(_0x4b9a11){logger['info'](_0x8489('0xe'),_0x58ca5c,_0x217722[_0x8489('0x21')]);if(_0x18740c[_0x8489('0x34')]=='Failed'){_0x241f37['next']();}else{_0x241f37['stop']();}})[_0x8489('0x26')](function(_0x231514){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON['stringify'](_0x231514));_0x241f37['next']();});}else{_0x241f37[_0x8489('0xf')]();}});}}catch(_0x27e15c){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON[_0x8489('0x28')](_0x27e15c));_0x241f37[_0x8489('0x2c')]();}};}; \ 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 9a18ad3..77dcf1d 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 _0x601d=['startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','replace','','headers','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','finally','update','stop','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','from','message','phone','read','subject'];(function(_0x3526a5,_0x56825d){var _0x44f869=function(_0x5dd195){while(--_0x5dd195){_0x3526a5['push'](_0x3526a5['shift']());}};_0x44f869(++_0x56825d);}(_0x601d,0x1a5));var _0xd601=function(_0x4438af,_0xd5a29b){_0x4438af=_0x4438af-0x0;var _0x57821d=_0x601d[_0x4438af];return _0x57821d;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require(_0xd601('0x0'))('routing');var rpc={'chatMessage':require(_0xd601('0x1')),'openchannelMessage':require(_0xd601('0x2')),'mailMessage':require(_0xd601('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd601('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xd601('0x5')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xd601('0x6')),'smsInteraction':require(_0xd601('0x7')),'faxInteraction':require(_0xd601('0x8')),'whatsappInteraction':require(_0xd601('0x9'))};var mailRpc=require(_0xd601('0xa'));exports[_0xd601('0xb')]=function(_0x16db35,_0x1ff14a,_0x18c664,_0x31c6e1){return function(_0x550f9b){try{var _0x4d169e=this[_0xd601('0xc')];if(_0x4d169e===_0xd601('0xd')&&_0x31c6e1[_0xd601('0xe')][_0xd601('0xf')]){logger[_0xd601('0x10')]('[%s][AUTOREPLY]\x20%s',_0x16db35,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x550f9b[_0xd601('0x11')]();}if(_0x1ff14a[0x0]==='1'&&(_[_0xd601('0x12')](this[_0xd601('0x13')]['created'])||!this[_0xd601('0x13')][_0xd601('0x14')])){logger[_0xd601('0x10')](_0xd601('0x15'),_0x16db35,_0xd601('0x16'));return _0x550f9b[_0xd601('0x11')]();}if(_0x1ff14a[0x0]==='2'&&this[_0xd601('0x13')][_0xd601('0x17')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x16db35,_0xd601('0x18'));return _0x550f9b[_0xd601('0x11')]();}var _0x4475cd={'ContactId':this[_0xd601('0x19')]['id'],'sentAt':moment()[_0xd601('0x1a')](_0xd601('0x1b')),'direction':'out'};if(this[_0xd601('0xc')]==='mail'){_0x4475cd['body']=utils[_0xd601('0x1c')](_0x1ff14a[0x2],this);}else{_0x4475cd[_0xd601('0xe')]=utils[_0xd601('0x1c')](_0x1ff14a[0x1],this);}if(this['message']){_0x4475cd['to']=this['message'][_0xd601('0x1d')]||'';if(this[_0xd601('0xc')]===_0xd601('0xd')&&_0x1ff14a[0x1]==='1'){_0x4475cd['cc']=this[_0xd601('0x1e')]['cc']||'';}_0x4475cd[_0xd601('0x1d')]=this[_0xd601('0x1e')]['to']||'';_0x4475cd[_0xd601('0x1f')]=this[_0xd601('0x1e')]['phone']||'';_0x4475cd[_0xd601('0x20')]=!![];if(this[_0xd601('0x1e')][_0xd601('0x21')]){_0x4475cd['subject']='';_0x4475cd[_0xd601('0x21')]+=_[_0xd601('0x22')](this[_0xd601('0x1e')][_0xd601('0x21')],_0xd601('0x23'))?'':'Re:\x20';_0x4475cd[_0xd601('0x21')]+=this['message']['subject'];}}if(this['channel']==='chat'){_0x4475cd[_0xd601('0x24')]=this[_0xd601('0x25')]['id'];}else{_0x4475cd[_[_0xd601('0x26')](this['channel'])+_0xd601('0x27')]=this['account']['id'];}_0x4475cd[_[_0xd601('0x26')](this[_0xd601('0xc')])+_0xd601('0x28')]=this[_0xd601('0x13')]['id'];var _0x18bc81=this[_0xd601('0x13')];if(rpc[this[_0xd601('0xc')]+_0xd601('0x29')]){if(this[_0xd601('0xc')]===_0xd601('0xd')){_0x4475cd[_0xd601('0x2a')]=this['message']['messageId'];_0x4475cd[_0xd601('0x2b')]=_0xd601('0x2c')+_[_0xd601('0x2d')](_0x4475cd[_0xd601('0xe')],_0xd601('0x2e'),'','replace','','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x946e1b,_0x4f9f57){var _0x4db99b=function(_0x16f0e9){while(--_0x16f0e9){_0x946e1b['push'](_0x946e1b['shift']());}};_0x4db99b(++_0x4f9f57);}(_0x7a92,0xd9));var _0x27a9=function(_0x29dfe3,_0x48d751){_0x29dfe3=_0x29dfe3-0x0;var _0x221122=_0x7a92[_0x29dfe3];return _0x221122;};'use strict';var _=require(_0x27a9('0x0'));var moment=require(_0x27a9('0x1'));var utils=require(_0x27a9('0x2'));var logger=require(_0x27a9('0x3'))(_0x27a9('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x27a9('0x5')),'mailMessage':require(_0x27a9('0x6')),'smsMessage':require(_0x27a9('0x7')),'faxMessage':require(_0x27a9('0x8')),'whatsappMessage':require(_0x27a9('0x9')),'chatInteraction':require(_0x27a9('0xa')),'openchannelInteraction':require(_0x27a9('0xb')),'mailInteraction':require(_0x27a9('0xc')),'smsInteraction':require(_0x27a9('0xd')),'faxInteraction':require(_0x27a9('0xe')),'whatsappInteraction':require(_0x27a9('0xf'))};var mailRpc=require(_0x27a9('0x10'));exports[_0x27a9('0x11')]=function(_0x19b3f2,_0x4f352e,_0x264ca0,_0x49f904){return function(_0x57757d){try{var _0xfc3a72=this['channel'];if(_0xfc3a72===_0x27a9('0x12')&&_0x49f904[_0x27a9('0x13')]['isAutoreply']){logger[_0x27a9('0x14')]('[%s][AUTOREPLY]\x20%s',_0x19b3f2,_0x27a9('0x15'));return _0x57757d[_0x27a9('0x16')]();}if(_0x4f352e[0x0]==='1'&&(_[_0x27a9('0x17')](this[_0x27a9('0x18')]['created'])||!this['interaction'][_0x27a9('0x19')])){logger['info'](_0x27a9('0x1a'),_0x19b3f2,_0x27a9('0x1b'));return _0x57757d[_0x27a9('0x16')]();}if(_0x4f352e[0x0]==='2'&&this[_0x27a9('0x18')][_0x27a9('0x1c')]){logger[_0x27a9('0x14')](_0x27a9('0x1d'),_0x19b3f2,'One\x20Time\x20already\x20sent');return _0x57757d[_0x27a9('0x16')]();}var _0x3106ff={'ContactId':this[_0x27a9('0x1e')]['id'],'sentAt':moment()[_0x27a9('0x1f')](_0x27a9('0x20')),'direction':_0x27a9('0x21')};if(this[_0x27a9('0x22')]===_0x27a9('0x12')){_0x3106ff[_0x27a9('0x13')]=utils[_0x27a9('0x23')](_0x4f352e[0x2],this);}else{_0x3106ff[_0x27a9('0x13')]=utils['getMustacheRender'](_0x4f352e[0x1],this);}if(this[_0x27a9('0x24')]){_0x3106ff['to']=this[_0x27a9('0x24')][_0x27a9('0x25')]||'';if(this['channel']==='mail'&&_0x4f352e[0x1]==='1'){_0x3106ff['cc']=this[_0x27a9('0x24')]['cc']||'';}_0x3106ff[_0x27a9('0x25')]=this[_0x27a9('0x24')]['to']||'';_0x3106ff[_0x27a9('0x26')]=this[_0x27a9('0x24')]['phone']||'';_0x3106ff[_0x27a9('0x27')]=!![];if(this[_0x27a9('0x24')][_0x27a9('0x28')]){_0x3106ff[_0x27a9('0x28')]='';_0x3106ff[_0x27a9('0x28')]+=_[_0x27a9('0x29')](this[_0x27a9('0x24')][_0x27a9('0x28')],_0x27a9('0x2a'))?'':_0x27a9('0x2b');_0x3106ff[_0x27a9('0x28')]+=this[_0x27a9('0x24')][_0x27a9('0x28')];}}if(this[_0x27a9('0x22')]===_0x27a9('0x2c')){_0x3106ff['ChatWebsiteId']=this[_0x27a9('0x2d')]['id'];}else{_0x3106ff[_[_0x27a9('0x2e')](this['channel'])+_0x27a9('0x2f')]=this['account']['id'];}_0x3106ff[_[_0x27a9('0x2e')](this[_0x27a9('0x22')])+_0x27a9('0x30')]=this['interaction']['id'];var _0x4def1d=this[_0x27a9('0x18')];if(rpc[this[_0x27a9('0x22')]+'Message']){if(this['channel']==='mail'){_0x3106ff[_0x27a9('0x31')]=this[_0x27a9('0x24')][_0x27a9('0x32')];_0x3106ff['html']=_0x27a9('0x33')+_[_0x27a9('0x34')](_0x3106ff['body'],_0x27a9('0x35'),_0x27a9('0x36'))+_0x27a9('0x37');_0x3106ff['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x27a9('0x38'),'Precedence':_0x27a9('0x39')};return mailRpc[_0x27a9('0x3a')](this[_0x27a9('0x2d')][_0x27a9('0x3b')],_0x3106ff)[_0x27a9('0x3c')](function(_0x3d17bd){logger[_0x27a9('0x14')](_0x27a9('0x3d'),_0x19b3f2);_0x3106ff[_0x27a9('0x32')]=_0x3d17bd[_0x27a9('0x24')]['messageId'];return rpc[_0xfc3a72+_0x27a9('0x3e')][_0x27a9('0x3f')](_0x3106ff);})[_0x27a9('0x3c')](function(_0x1eab54){logger['info'](_0x27a9('0x1a'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x1eab54));})['catch'](function(_0x4604d4){logger['error'](_0x27a9('0x41'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x4604d4));})['finally'](function(){Promise[_0x27a9('0x42')]()[_0x27a9('0x3c')](function(){if(_0x4f352e[0x0]!=='2'||_0x4def1d[_0x27a9('0x1c')])return;return rpc[_0xfc3a72+'Interaction'][_0x27a9('0x43')](_0x4def1d['id'],{'autoreplyExecuted':!![]})[_0x27a9('0x3c')](function(_0x4cf363){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x19b3f2,JSON[_0x27a9('0x40')](_0x4cf363));})[_0x27a9('0x44')](function(_0x46c476){logger[_0x27a9('0x45')](_0x27a9('0x46'),_0x19b3f2,JSON['stringify'](_0x46c476));});})[_0x27a9('0x3c')](function(){_0x57757d[_0x27a9('0x16')]();});});}else{return rpc[this[_0x27a9('0x22')]+'Message'][_0x27a9('0x3f')](_0x3106ff)[_0x27a9('0x3c')](function(){logger[_0x27a9('0x14')](_0x27a9('0x1a'),_0x19b3f2,_0x3106ff['body']);})[_0x27a9('0x44')](function(_0x423a9a){logger[_0x27a9('0x45')](_0x27a9('0x1a'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x423a9a));})['finally'](function(){Promise[_0x27a9('0x42')]()[_0x27a9('0x3c')](function(){if(_0x4f352e[0x0]!=='2'||_0x4def1d[_0x27a9('0x1c')])return;return rpc[_0xfc3a72+'Interaction'][_0x27a9('0x43')](_0x4def1d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x415514){logger['info'](_0x27a9('0x1d'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x415514));})['catch'](function(_0x5cf1ae){logger[_0x27a9('0x45')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x19b3f2,JSON[_0x27a9('0x40')](_0x5cf1ae));});})[_0x27a9('0x3c')](function(){_0x57757d['next']();});});}}}catch(_0x26babd){logger['error']('[%s][AUTOREPLY]\x20%s',_0x19b3f2,JSON['stringify'](_0x26babd));_0x57757d[_0x27a9('0x47')]();}};}; \ 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 c9a2aa9..f5afb2e 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 _0x9d13=['consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9d13,0x18b));var _0x39d1=function(_0x4d9164,_0x4e190c){_0x4d9164=_0x4d9164-0x0;var _0x8f704f=_0x9d13[_0x4d9164];return _0x8f704f;};'use strict';var moment=require('moment');var logger=require(_0x39d1('0x0'))(_0x39d1('0x1'));var rpc={'chatInteraction':require(_0x39d1('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x39d1('0x3')),'mailInteraction':require(_0x39d1('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x39d1('0x5')]=function(_0x3dc701,_0x25b380,_0x136d79,_0x155685){return function(_0x2b59ec){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x3dc701,_0x25b380[0x0]);var _0xbd9db2={'closed':0x1,'closedAt':moment()['format'](_0x39d1('0x6')),'closeReason':_0x39d1('0x7'),'disposition':_0x25b380[0x0]};if(rpc[_0x155685[_0x39d1('0x8')]+_0x39d1('0x9')]){rpc[_0x155685[_0x39d1('0x8')]+_0x39d1('0x9')][_0x39d1('0xa')](_0x155685[_0x39d1('0xb')]['id'],_0xbd9db2)[_0x39d1('0xc')](function(_0x336a8a){logger[_0x39d1('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3dc701,_0x155685['interaction']['id']);})[_0x39d1('0xe')](function(_0x323eb6){logger['error'](_0x39d1('0xf'),_0x3dc701,JSON[_0x39d1('0x10')](_0x323eb6));})[_0x39d1('0x11')](function(){_0x2b59ec[_0x39d1('0x12')]();});}}catch(_0x1be585){logger[_0x39d1('0x13')](_0x39d1('0xf'),_0x3dc701,JSON['stringify'](_0x1be585));_0x2b59ec[_0x39d1('0x12')]();}};}; \ No newline at end of file +var _0x6a33=['channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','moment','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6a33,0xee));var _0x36a3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x6a33[_0x24259d];return _0x5a701;};'use strict';var moment=require(_0x36a3('0x0'));var logger=require('../../../../config/logger')(_0x36a3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x36a3('0x2')),'mailInteraction':require(_0x36a3('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x36a3('0x4')]=function(_0xabf40d,_0x41c858,_0x49d9da,_0x18784d){return function(_0x3d4a43){try{logger[_0x36a3('0x5')](_0x36a3('0x6'),_0xabf40d,_0x41c858[0x0]);var _0x3ea45c={'closed':0x1,'closedAt':moment()[_0x36a3('0x7')](_0x36a3('0x8')),'closeReason':'system','disposition':_0x41c858[0x0]};if(rpc[_0x18784d[_0x36a3('0x9')]+_0x36a3('0xa')]){rpc[_0x18784d['channel']+_0x36a3('0xa')][_0x36a3('0xb')](_0x18784d[_0x36a3('0xc')]['id'],_0x3ea45c)[_0x36a3('0xd')](function(_0x2e2a81){logger[_0x36a3('0x5')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xabf40d,_0x18784d['interaction']['id']);})[_0x36a3('0xe')](function(_0x273860){logger[_0x36a3('0xf')](_0x36a3('0x10'),_0xabf40d,JSON[_0x36a3('0x11')](_0x273860));})[_0x36a3('0x12')](function(){_0x3d4a43['stop']();});}}catch(_0x483bf9){logger[_0x36a3('0xf')]('[%s][CLOSE]\x20%s',_0xabf40d,JSON[_0x36a3('0x11')](_0x483bf9));_0x3d4a43['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 a2ac1fd..8fbd032 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 _0x2f4a=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','next','contact','format','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','info','[%s][DIALOGFLOW]\x20%s','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','speech','providerName','providerResponse','Message','create','metadata','endConversation','error','message','lodash','moment','apiai-promise','md5'];(function(_0x428dd2,_0x37a876){var _0x2a7c4e=function(_0x16bb79){while(--_0x16bb79){_0x428dd2['push'](_0x428dd2['shift']());}};_0x2a7c4e(++_0x37a876);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x2f4a[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xa2f4('0x0'));var moment=require(_0xa2f4('0x1'));var apiai=require(_0xa2f4('0x2'));var md5=require(_0xa2f4('0x3'));var utils=require(_0xa2f4('0x4'));var logger=require(_0xa2f4('0x5'))(_0xa2f4('0x6'));var rpc={'chatMessage':require(_0xa2f4('0x7')),'openchannelMessage':require(_0xa2f4('0x8')),'mailMessage':require(_0xa2f4('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa2f4('0xa')),'whatsappMessage':require(_0xa2f4('0xb'))};exports[_0xa2f4('0xc')]=function(_0x151045,_0x2cd086){return function(_0x194ee8){try{if(!_['isNil'](this[_0xa2f4('0xd')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x151045,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x194ee8[_0xa2f4('0xe')]();}var _0x1a8c24={'ContactId':this[_0xa2f4('0xf')]['id'],'sentAt':moment()[_0xa2f4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa2f4('0x11')};if(this['channel']===_0xa2f4('0x12')||this[_0xa2f4('0x13')]==='whatsapp'){_0x1a8c24[_0xa2f4('0x14')]=this['interaction'][_0xa2f4('0x14')];}var _0x485447=this[_0xa2f4('0x13')];if(_0x485447==='chat'){_0x1a8c24[_0xa2f4('0x15')]=this[_0xa2f4('0x16')]['id'];}else{_0x1a8c24[_[_0xa2f4('0x17')](_0x485447)+_0xa2f4('0x18')]=this[_0xa2f4('0x16')]['id'];}_0x1a8c24[_[_0xa2f4('0x17')](_0x485447)+'InteractionId']=this[_0xa2f4('0xd')]['id'];if(this[_0xa2f4('0xd')]['created']){var _0x4ae792=_0x2cd086[0x2];if(!_[_0xa2f4('0x19')](_0x4ae792)){_0x1a8c24[_0xa2f4('0x1a')]=utils[_0xa2f4('0x1b')](_0x4ae792,this);return rpc[_0x485447+'Message']['create'](_0x1a8c24)['then'](function(_0x5a0aa3){logger[_0xa2f4('0x1c')](_0xa2f4('0x1d'),_0x151045,_0x1a8c24['body']);})[_0xa2f4('0x1e')](function(_0x426013){logger['error'](_0xa2f4('0x1d'),_0x151045,JSON[_0xa2f4('0x1f')](_0x426013));})[_0xa2f4('0x20')](function(){logger[_0xa2f4('0x1c')](_0xa2f4('0x21'),_0x151045);_0x194ee8[_0xa2f4('0x22')]();});}else{logger[_0xa2f4('0x1c')](_0xa2f4('0x23'),_0x151045);_0x194ee8[_0xa2f4('0x22')]();}}else{var _0x21dce2=this;var _0x47c203=apiai(_0x2cd086[0x0],{'language':_0x2cd086[0x1]||'en'});return _0x47c203[_0xa2f4('0x24')](this['message'][_0xa2f4('0x1a')],{'sessionId':md5(this['interaction']['id'])})[_0xa2f4('0x25')](function(_0x235cae){_0x21dce2[_0xa2f4('0x1a')][_0xa2f4('0x26')]=_0x235cae;_0x1a8c24['body']=_0x235cae[_0xa2f4('0x27')]['fulfillment'][_0xa2f4('0x28')];_0x1a8c24[_0xa2f4('0x29')]='dialogflow';_0x1a8c24[_0xa2f4('0x2a')]=JSON[_0xa2f4('0x1f')](_0x235cae);return rpc[_0x485447+_0xa2f4('0x2b')][_0xa2f4('0x2c')](_0x1a8c24)[_0xa2f4('0x25')](function(_0x49824c){logger[_0xa2f4('0x1c')](_0xa2f4('0x1d'),_0x151045,_0x1a8c24[_0xa2f4('0x1a')]);if(_0x235cae[_0xa2f4('0x27')][_0xa2f4('0x2d')][_0xa2f4('0x2e')]){_0x194ee8[_0xa2f4('0xe')]();}else{_0x194ee8[_0xa2f4('0x22')]();}})[_0xa2f4('0x1e')](function(_0x3650fc){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,JSON[_0xa2f4('0x1f')](_0x3650fc));_0x194ee8['next']();});})[_0xa2f4('0x1e')](function(_0x4bfd92){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,_0x4bfd92[_0xa2f4('0x30')]);_0x194ee8[_0xa2f4('0xe')]();});}}catch(_0x383f9d){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,JSON['stringify'](_0x383f9d));_0x194ee8[_0xa2f4('0x22')]();}};}; \ No newline at end of file +var _0x94ff=['created','Message','catch','error','finally','stop','textRequest','message','body','then','dialogflow','fulfillment','speech','create','result','metadata','endConversation','next','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0x94ff,0xc3));var _0xf94f=function(_0x1b54e8,_0x53b5f5){_0x1b54e8=_0x1b54e8-0x0;var _0x4b1513=_0x94ff[_0x1b54e8];return _0x4b1513;};'use strict';var _=require(_0xf94f('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xf94f('0x1'));var logger=require(_0xf94f('0x2'))(_0xf94f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf94f('0x4')),'mailMessage':require(_0xf94f('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf94f('0x6')),'whatsappMessage':require(_0xf94f('0x7'))};exports['consequence']=function(_0x18919a,_0x5e3f9c){return function(_0x192f2c){try{if(!_[_0xf94f('0x8')](this['interaction'][_0xf94f('0x9')])){logger[_0xf94f('0xa')](_0xf94f('0xb'),_0x18919a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x192f2c['next']();}var _0x510972={'ContactId':this[_0xf94f('0xc')]['id'],'sentAt':moment()[_0xf94f('0xd')](_0xf94f('0xe')),'direction':_0xf94f('0xf')};if(this[_0xf94f('0x10')]===_0xf94f('0x11')||this[_0xf94f('0x10')]===_0xf94f('0x12')){_0x510972['phone']=this[_0xf94f('0x13')][_0xf94f('0x14')];}var _0xb83e27=this[_0xf94f('0x10')];if(_0xb83e27==='chat'){_0x510972[_0xf94f('0x15')]=this[_0xf94f('0x16')]['id'];}else{_0x510972[_[_0xf94f('0x17')](_0xb83e27)+_0xf94f('0x18')]=this[_0xf94f('0x16')]['id'];}_0x510972[_[_0xf94f('0x17')](_0xb83e27)+'InteractionId']=this[_0xf94f('0x13')]['id'];if(this['interaction'][_0xf94f('0x19')]){var _0x346c76=_0x5e3f9c[0x2];if(!_['isEmpty'](_0x346c76)){_0x510972['body']=utils['getMustacheRender'](_0x346c76,this);return rpc[_0xb83e27+_0xf94f('0x1a')]['create'](_0x510972)['then'](function(_0x3ccfb4){logger['info'](_0xf94f('0xb'),_0x18919a,_0x510972['body']);})[_0xf94f('0x1b')](function(_0x5e68da){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON['stringify'](_0x5e68da));})[_0xf94f('0x1d')](function(){logger[_0xf94f('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x18919a);_0x192f2c[_0xf94f('0x1e')]();});}else{logger[_0xf94f('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18919a);_0x192f2c[_0xf94f('0x1e')]();}}else{var _0x3aa34b=this;var _0x5beb9c=apiai(_0x5e3f9c[0x0],{'language':_0x5e3f9c[0x1]||'en'});return _0x5beb9c[_0xf94f('0x1f')](this[_0xf94f('0x20')][_0xf94f('0x21')],{'sessionId':md5(this[_0xf94f('0x13')]['id'])})[_0xf94f('0x22')](function(_0x4c9ec5){_0x3aa34b[_0xf94f('0x21')][_0xf94f('0x23')]=_0x4c9ec5;_0x510972[_0xf94f('0x21')]=_0x4c9ec5['result'][_0xf94f('0x24')][_0xf94f('0x25')];_0x510972['providerName']=_0xf94f('0x23');_0x510972['providerResponse']=JSON['stringify'](_0x4c9ec5);return rpc[_0xb83e27+_0xf94f('0x1a')][_0xf94f('0x26')](_0x510972)['then'](function(_0x55e414){logger[_0xf94f('0xa')](_0xf94f('0xb'),_0x18919a,_0x510972['body']);if(_0x4c9ec5[_0xf94f('0x27')][_0xf94f('0x28')][_0xf94f('0x29')]){_0x192f2c['next']();}else{_0x192f2c[_0xf94f('0x1e')]();}})['catch'](function(_0x2f3471){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON['stringify'](_0x2f3471));_0x192f2c[_0xf94f('0x2a')]();});})[_0xf94f('0x1b')](function(_0x432e12){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,_0x432e12[_0xf94f('0x20')]);_0x192f2c[_0xf94f('0x2a')]();});}}catch(_0x57716c){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON[_0xf94f('0x2b')](_0x57716c));_0x192f2c[_0xf94f('0x1e')]();}};}; \ 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 3de427b..483bcf7 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 _0xc59c=['next','format','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','chat','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','lodash','dialogflow','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0xa0c1d0,_0x287e82){var _0x2e41d9=function(_0x58986f){while(--_0x58986f){_0xa0c1d0['push'](_0xa0c1d0['shift']());}};_0x2e41d9(++_0x287e82);}(_0xc59c,0x72));var _0xcc59=function(_0x1b48cd,_0x4e1a55){_0x1b48cd=_0x1b48cd-0x0;var _0x11a3c8=_0xc59c[_0x1b48cd];return _0x11a3c8;};'use strict';var _=require(_0xcc59('0x0'));var dialogflow=require(_0xcc59('0x1'));var md5=require(_0xcc59('0x2'));var moment=require(_0xcc59('0x3'));var Promise=require(_0xcc59('0x4'));var logger=require('../../../../config/logger')(_0xcc59('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xcc59('0x6')),'openchannelMessage':require(_0xcc59('0x7')),'mailMessage':require(_0xcc59('0x8')),'smsMessage':require(_0xcc59('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcc59('0xa'))};function createMessage(_0x36c307,_0x4ae322,_0x2de0cd,_0x590b64){return new Promise(function(_0x2216a6,_0x2a5731){var _0x561cc7=_[_0xcc59('0xb')](_0x2de0cd);_0x561cc7[_0xcc59('0xc')]=_0x590b64;return rpc[_0x4ae322+'Message'][_0xcc59('0xd')](_0x561cc7)[_0xcc59('0xe')](function(){logger[_0xcc59('0xf')](_0xcc59('0x10'),_0x36c307,_0x561cc7['body']);_0x2216a6();})[_0xcc59('0x11')](function(_0x4db0cc){logger[_0xcc59('0x12')](_0xcc59('0x10'),_0x36c307,JSON[_0xcc59('0x13')](_0x4db0cc));_0x2a5731(_0x4db0cc);});});}exports[_0xcc59('0x14')]=function(_0x50b509,_0x429ab){return function(_0x239848){try{if(!_['isNil'](this[_0xcc59('0x15')][_0xcc59('0x16')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,_0xcc59('0x17'));return _0x239848[_0xcc59('0x18')]();}var _0x37b387={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcc59('0x19')](_0xcc59('0x1a')),'direction':'out'};if(this['channel']===_0xcc59('0x1b')||this['channel']===_0xcc59('0x1c')){_0x37b387[_0xcc59('0x1d')]=this['interaction'][_0xcc59('0x1d')];}var _0xeee1c7=this['channel'];if(_0xeee1c7===_0xcc59('0x1e')){_0x37b387['ChatWebsiteId']=this['account']['id'];}else{_0x37b387[_['upperFirst'](_0xeee1c7)+_0xcc59('0x1f')]=this[_0xcc59('0x20')]['id'];}_0x37b387[_['upperFirst'](_0xeee1c7)+_0xcc59('0x21')]=this['interaction']['id'];if(this[_0xcc59('0x15')][_0xcc59('0x22')]){var _0xbc2953=_0x429ab[0x4];if(!_[_0xcc59('0x23')](_0xbc2953)){_0x37b387[_0xcc59('0xc')]=utils[_0xcc59('0x24')](_0xbc2953,this);return rpc[_0xeee1c7+_0xcc59('0x25')][_0xcc59('0xd')](_0x37b387)[_0xcc59('0xe')](function(_0xf06a38){logger[_0xcc59('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,_0x37b387[_0xcc59('0xc')]);})['catch'](function(_0x1624c7){logger[_0xcc59('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,JSON[_0xcc59('0x13')](_0x1624c7));})[_0xcc59('0x26')](function(){logger['info'](_0xcc59('0x27'),_0x50b509);_0x239848[_0xcc59('0x28')]();});}else{logger['info'](_0xcc59('0x29'),_0x50b509);_0x239848[_0xcc59('0x28')]();}}else{var _0x3031b3=this;var _0x1b5919=_0x429ab[0x2][_0xcc59('0x2a')](/\\n/g,'\x0a');var _0xce5f95={'credentials':{'private_key':_0x1b5919,'client_email':_0x429ab[0x1]}};var _0x51a14b=new dialogflow[(_0xcc59('0x2b'))](_0xce5f95);var _0x216f2e=_0x51a14b[_0xcc59('0x2c')](_0x429ab[0x0],md5(_0x3031b3[_0xcc59('0x15')]['id']));var _0xe1fef9={'session':_0x216f2e,'queryInput':{'text':{'text':_0x3031b3[_0xcc59('0x2d')][_0xcc59('0xc')],'languageCode':_0x429ab[0x3]||'en'}}};return _0x51a14b['detectIntent'](_0xe1fef9)[_0xcc59('0xe')](function(_0x1db99f){if(_0x1db99f&&_0x1db99f[_0xcc59('0x2e')]){_0x3031b3[_0xcc59('0xc')][_0xcc59('0x2f')]=_0x1db99f;var _0x416740=_0x1db99f[0x0];var _0x5042f8=_0x416740[_0xcc59('0x30')][_0xcc59('0x31')]&&_0x416740[_0xcc59('0x30')][_0xcc59('0x31')][_0xcc59('0x32')]?_0x416740[_0xcc59('0x30')][_0xcc59('0x31')][_0xcc59('0x32')][_0xcc59('0x33')][_0xcc59('0x34')]:![];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x35')]=_0x416740[_0xcc59('0x30')][_0xcc59('0x36')];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x37')]=_0x416740['queryResult']['allRequiredParamsPresent'];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x38')]=_0x416740[_0xcc59('0x30')]['diagnosticInfo']&&_0x416740[_0xcc59('0x30')][_0xcc59('0x31')][_0xcc59('0x32')]?_0x416740[_0xcc59('0x30')][_0xcc59('0x31')]['fields'][_0xcc59('0x33')][_0xcc59('0x34')]:![];_0x3031b3[_0xcc59('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x416740[_0xcc59('0x30')][_0xcc59('0x39')][_0xcc59('0x3a')];_0x3031b3['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x416740[_0xcc59('0x30')][_0xcc59('0x39')][_0xcc59('0x3b')];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x3c')]=_0x416740[_0xcc59('0x30')][_0xcc59('0x39')]['isFallback'];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x3d')]=_0x416740['queryResult'][_0xcc59('0x3e')];_0x3031b3[_0xcc59('0xc')][_0xcc59('0x3f')]=_0x416740[_0xcc59('0x30')][_0xcc59('0x40')];_0x3031b3['body']['DIALOGFLOWV2_SCORE']=_0x416740[_0xcc59('0x30')][_0xcc59('0x41')];_0x37b387['providerName']='dialogflowV2';_0x37b387[_0xcc59('0x42')]=JSON[_0xcc59('0x13')](_0x1db99f);var _0x2e0da4=[];for(var _0x2fc801=0x0;_0x2fc801<_0x1db99f[_0xcc59('0x2e')];_0x2fc801++){var _0x82ce7a=_0x1db99f[_0x2fc801];if(_0x82ce7a&&_0x82ce7a[_0xcc59('0x30')]&&_0x82ce7a[_0xcc59('0x30')][_0xcc59('0x43')]){_0x2e0da4[_0xcc59('0x44')](createMessage(_0x50b509,_0xeee1c7,_0x37b387,_0x82ce7a[_0xcc59('0x30')][_0xcc59('0x43')]));}}return Promise['all'](_0x2e0da4)[_0xcc59('0xe')](function(){if(_0x5042f8){_0x239848[_0xcc59('0x18')]();}else{_0x239848['stop']();}})[_0xcc59('0x11')](function(_0x51468e){logger[_0xcc59('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,JSON[_0xcc59('0x13')](_0x51468e));_0x239848[_0xcc59('0x18')]();});}})[_0xcc59('0x11')](function(_0x3a0334){logger[_0xcc59('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,_0x3a0334['message']);_0x239848[_0xcc59('0x18')]();});}}catch(_0x279caa){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x50b509,JSON[_0xcc59('0x13')](_0x279caa));_0x239848[_0xcc59('0x28')]();}};}; \ No newline at end of file +var _0xed04=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','next','catch','lodash','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','create','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x525370,_0x5abe18){var _0x4a1ae9=function(_0x257f97){while(--_0x257f97){_0x525370['push'](_0x525370['shift']());}};_0x4a1ae9(++_0x5abe18);}(_0xed04,0xa4));var _0x4ed0=function(_0xb8d164,_0x2e61bf){_0xb8d164=_0xb8d164-0x0;var _0x5da372=_0xed04[_0xb8d164];return _0x5da372;};'use strict';var _=require(_0x4ed0('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x4ed0('0x1'));var utils=require(_0x4ed0('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4ed0('0x3')),'mailMessage':require(_0x4ed0('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4ed0('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2838a9,_0x3d4e34,_0x57cddd,_0x54c3d6){return new Promise(function(_0x6a4bec,_0x512f2b){var _0x17a038=_[_0x4ed0('0x6')](_0x57cddd);_0x17a038[_0x4ed0('0x7')]=_0x54c3d6;return rpc[_0x3d4e34+_0x4ed0('0x8')]['create'](_0x17a038)['then'](function(){logger[_0x4ed0('0x9')](_0x4ed0('0xa'),_0x2838a9,_0x17a038[_0x4ed0('0x7')]);_0x6a4bec();})['catch'](function(_0x40744b){logger[_0x4ed0('0xb')](_0x4ed0('0xa'),_0x2838a9,JSON[_0x4ed0('0xc')](_0x40744b));_0x512f2b(_0x40744b);});});}exports['consequence']=function(_0xdbaeb6,_0x21c662){return function(_0x18c0b2){try{if(!_['isNil'](this['interaction'][_0x4ed0('0xd')])){logger[_0x4ed0('0x9')](_0x4ed0('0xa'),_0xdbaeb6,_0x4ed0('0xe'));return _0x18c0b2['next']();}var _0x3564e7={'ContactId':this[_0x4ed0('0xf')]['id'],'sentAt':moment()[_0x4ed0('0x10')](_0x4ed0('0x11')),'direction':_0x4ed0('0x12')};if(this[_0x4ed0('0x13')]===_0x4ed0('0x14')||this[_0x4ed0('0x13')]==='whatsapp'){_0x3564e7['phone']=this[_0x4ed0('0x15')][_0x4ed0('0x16')];}var _0x555cb7=this['channel'];if(_0x555cb7===_0x4ed0('0x17')){_0x3564e7['ChatWebsiteId']=this[_0x4ed0('0x18')]['id'];}else{_0x3564e7[_[_0x4ed0('0x19')](_0x555cb7)+_0x4ed0('0x1a')]=this[_0x4ed0('0x18')]['id'];}_0x3564e7[_['upperFirst'](_0x555cb7)+_0x4ed0('0x1b')]=this[_0x4ed0('0x15')]['id'];if(this[_0x4ed0('0x15')]['created']){var _0x567411=_0x21c662[0x4];if(!_[_0x4ed0('0x1c')](_0x567411)){_0x3564e7[_0x4ed0('0x7')]=utils[_0x4ed0('0x1d')](_0x567411,this);return rpc[_0x555cb7+'Message'][_0x4ed0('0x1e')](_0x3564e7)[_0x4ed0('0x1f')](function(_0x111d25){logger['info'](_0x4ed0('0xa'),_0xdbaeb6,_0x3564e7[_0x4ed0('0x7')]);})['catch'](function(_0x426e4a){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,JSON[_0x4ed0('0xc')](_0x426e4a));})[_0x4ed0('0x20')](function(){logger[_0x4ed0('0x9')](_0x4ed0('0x21'),_0xdbaeb6);_0x18c0b2['stop']();});}else{logger[_0x4ed0('0x9')](_0x4ed0('0x22'),_0xdbaeb6);_0x18c0b2[_0x4ed0('0x23')]();}}else{var _0x1e80a2=this;var _0x8f25e1=_0x21c662[0x2][_0x4ed0('0x24')](/\\n/g,'\x0a');var _0x48a49a={'credentials':{'private_key':_0x8f25e1,'client_email':_0x21c662[0x1]}};var _0x43d6a1=new dialogflow['SessionsClient'](_0x48a49a);var _0x26fbfa=_0x43d6a1['sessionPath'](_0x21c662[0x0],md5(_0x1e80a2[_0x4ed0('0x15')]['id']));var _0x56d2e2={'session':_0x26fbfa,'queryInput':{'text':{'text':_0x1e80a2[_0x4ed0('0x25')]['body'],'languageCode':_0x21c662[0x3]||'en'}}};return _0x43d6a1[_0x4ed0('0x26')](_0x56d2e2)[_0x4ed0('0x1f')](function(_0x177066){if(_0x177066&&_0x177066[_0x4ed0('0x27')]){_0x1e80a2['body'][_0x4ed0('0x28')]=_0x177066;var _0x52b195=_0x177066[0x0];var _0x44a8a5=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]&&_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]['fields']?_0x52b195['queryResult'][_0x4ed0('0x2a')][_0x4ed0('0x2b')][_0x4ed0('0x2c')][_0x4ed0('0x2d')]:![];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x2e')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2f')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x30')]=_0x52b195['queryResult']['allRequiredParamsPresent'];_0x1e80a2['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]&&_0x52b195['queryResult'][_0x4ed0('0x2a')][_0x4ed0('0x2b')]?_0x52b195['queryResult'][_0x4ed0('0x2a')]['fields'][_0x4ed0('0x2c')]['boolValue']:![];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x31')]=_0x52b195[_0x4ed0('0x29')]['intent'][_0x4ed0('0x32')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x33')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x34')][_0x4ed0('0x35')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x36')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x34')]['isFallback'];_0x1e80a2['body'][_0x4ed0('0x37')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x38')];_0x1e80a2[_0x4ed0('0x7')]['DIALOGFLOWV2_QUERYTEXT']=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x39')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x3a')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x3b')];_0x3564e7['providerName']=_0x4ed0('0x28');_0x3564e7[_0x4ed0('0x3c')]=JSON[_0x4ed0('0xc')](_0x177066);var _0x595363=[];for(var _0x4a0c8d=0x0;_0x4a0c8d<_0x177066[_0x4ed0('0x27')];_0x4a0c8d++){var _0x7c15c0=_0x177066[_0x4a0c8d];if(_0x7c15c0&&_0x7c15c0[_0x4ed0('0x29')]&&_0x7c15c0[_0x4ed0('0x29')][_0x4ed0('0x3d')]){_0x595363[_0x4ed0('0x3e')](createMessage(_0xdbaeb6,_0x555cb7,_0x3564e7,_0x7c15c0[_0x4ed0('0x29')][_0x4ed0('0x3d')]));}}return Promise[_0x4ed0('0x3f')](_0x595363)[_0x4ed0('0x1f')](function(){if(_0x44a8a5){_0x18c0b2[_0x4ed0('0x40')]();}else{_0x18c0b2['stop']();}})[_0x4ed0('0x41')](function(_0x3ded9e){logger[_0x4ed0('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0xdbaeb6,JSON[_0x4ed0('0xc')](_0x3ded9e));_0x18c0b2['next']();});}})[_0x4ed0('0x41')](function(_0xa68b1){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,_0xa68b1[_0x4ed0('0x25')]);_0x18c0b2[_0x4ed0('0x40')]();});}}catch(_0x35c74c){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,JSON['stringify'](_0x35c74c));_0x18c0b2[_0x4ed0('0x23')]();}};}; \ 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 71266fa..4f52790 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 _0x7821=['next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','./utils','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2014b9,_0x513a92){var _0x407f62=function(_0x1418ce){while(--_0x1418ce){_0x2014b9['push'](_0x2014b9['shift']());}};_0x407f62(++_0x513a92);}(_0x7821,0x91));var _0x1782=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x7821[_0x38223f];return _0x3e3fab;};'use strict';var schema=require(_0x1782('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x1782('0x1'));var logger=require(_0x1782('0x2'))(_0x1782('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1782('0x4'),'message':_0x1782('0x5')},'priorityFalse':{'type':'number','message':_0x1782('0x6')}});exports['consequence']=function(_0x3a982a,_0x22abe7){return function(_0x44302f){try{var _0x344a73={'condition':htmlToText[_0x1782('0x7')](utils[_0x1782('0x8')](_0x22abe7[0x0],this),{'wordwrap':![]})[_0x1782('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x22abe7[0x1],'priorityFalse':_0x22abe7[0x2]};var _0x4f312c=gotoif['validate'](_0x344a73,{'typecast':!![]});if(_0x4f312c[_0x1782('0xa')]){logger['error'](_0x1782('0xb'),_0x3a982a,_[_0x1782('0xc')](_0x4f312c,_0x1782('0xd'))[_0x1782('0xe')](',\x20'));_0x44302f[_0x1782('0xf')]();}else{try{var _0x4171aa=eval('('+_0x344a73[_0x1782('0x10')]+')');var _0x5dcb8c=_0x4171aa?_0x344a73['priorityTrue']:_0x344a73[_0x1782('0x11')];logger[_0x1782('0x12')](_0x1782('0x13'),_0x3a982a,_0x344a73['condition'],_0x4171aa,_0x5dcb8c||'next');if(_0x5dcb8c){var _0x108fd1=_[_0x1782('0x14')](_0x44302f[_0x1782('0x15')](),{'p':_0x5dcb8c});if(_0x108fd1>=0x0){logger['info'](_0x1782('0x16'),_0x3a982a,_0x5dcb8c||_0x1782('0x17'),_0x108fd1);_0x44302f['next'](_0x108fd1);}else{logger[_0x1782('0x12')](_0x1782('0x18'),_0x3a982a,_0x5dcb8c||_0x1782('0x17'));_0x44302f['stop']();}}else{_0x44302f['next']();}}catch(_0x2af8bf){logger[_0x1782('0x19')](_0x1782('0x1a'),_0x3a982a,_0x2af8bf['message']);_0x44302f[_0x1782('0xf')]();}}}catch(_0x4c6703){logger[_0x1782('0x19')]('[%s][GOTOIF]\x20%s',_0x3a982a,JSON[_0x1782('0x1b')](_0x4c6703));_0x44302f[_0x1782('0xf')]();}};}; \ No newline at end of file +var _0xd660=['consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number'];(function(_0x1b9721,_0x14bca5){var _0x288bb1=function(_0x1fa311){while(--_0x1fa311){_0x1b9721['push'](_0x1b9721['shift']());}};_0x288bb1(++_0x14bca5);}(_0xd660,0xe7));var _0x0d66=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0xd660[_0x28678d];return _0x1643e9;};'use strict';var schema=require(_0x0d66('0x0'));var _=require(_0x0d66('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x0d66('0x2'));var logger=require(_0x0d66('0x3'))(_0x0d66('0x4'));var gotoif=schema({'condition':{'type':_0x0d66('0x5'),'required':!![],'message':_0x0d66('0x6')},'priorityTrue':{'type':_0x0d66('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0d66('0x7'),'message':_0x0d66('0x8')}});exports[_0x0d66('0x9')]=function(_0x27db13,_0x3135fe){return function(_0x10b9f9){try{var _0x35a35c={'condition':htmlToText[_0x0d66('0xa')](utils[_0x0d66('0xb')](_0x3135fe[0x0],this),{'wordwrap':![]})[_0x0d66('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3135fe[0x1],'priorityFalse':_0x3135fe[0x2]};var _0x51c945=gotoif['validate'](_0x35a35c,{'typecast':!![]});if(_0x51c945[_0x0d66('0xd')]){logger['error'](_0x0d66('0xe'),_0x27db13,_[_0x0d66('0xf')](_0x51c945,_0x0d66('0x10'))[_0x0d66('0x11')](',\x20'));_0x10b9f9[_0x0d66('0x12')]();}else{try{var _0x2a25a0=eval('('+_0x35a35c[_0x0d66('0x13')]+')');var _0x3a5f76=_0x2a25a0?_0x35a35c[_0x0d66('0x14')]:_0x35a35c[_0x0d66('0x15')];logger[_0x0d66('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x27db13,_0x35a35c[_0x0d66('0x13')],_0x2a25a0,_0x3a5f76||_0x0d66('0x17'));if(_0x3a5f76){var _0x10f724=_['findIndex'](_0x10b9f9[_0x0d66('0x18')](),{'p':_0x3a5f76});if(_0x10f724>=0x0){logger[_0x0d66('0x16')](_0x0d66('0x19'),_0x27db13,_0x3a5f76||'next',_0x10f724);_0x10b9f9[_0x0d66('0x17')](_0x10f724);}else{logger[_0x0d66('0x16')](_0x0d66('0x1a'),_0x27db13,_0x3a5f76||_0x0d66('0x17'));_0x10b9f9[_0x0d66('0x12')]();}}else{_0x10b9f9[_0x0d66('0x17')]();}}catch(_0x47d77a){logger[_0x0d66('0x1b')](_0x0d66('0x1c'),_0x27db13,_0x47d77a[_0x0d66('0x10')]);_0x10b9f9[_0x0d66('0x12')]();}}}catch(_0x3ec0a7){logger['error'](_0x0d66('0xe'),_0x27db13,JSON[_0x0d66('0x1d')](_0x3ec0a7));_0x10b9f9['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 fc32138..ef26922 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 _0x300b=['priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','../../../../config/logger','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','[%s][GOTOP]\x20priority\x20%s','findIndex','rules'];(function(_0x5d872b,_0x1ef39e){var _0x55a444=function(_0x5c95a6){while(--_0x5c95a6){_0x5d872b['push'](_0x5d872b['shift']());}};_0x55a444(++_0x1ef39e);}(_0x300b,0xd8));var _0xb300=function(_0x3ec8f4,_0x3e11c9){_0x3ec8f4=_0x3ec8f4-0x0;var _0x49e8ad=_0x300b[_0x3ec8f4];return _0x49e8ad;};'use strict';var schema=require(_0xb300('0x0'));var _=require('lodash');var logger=require(_0xb300('0x1'))('routing');var gotop=schema({'priority':{'type':_0xb300('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xb300('0x3')]=function(_0x222d81,_0x11b129){return function(_0x52b2d9){try{var _0x38b07f={'priority':_0x11b129[0x0]};var _0x391577=gotop[_0xb300('0x0')](_0x38b07f,{'typecast':!![]});if(_0x391577[_0xb300('0x4')]){logger[_0xb300('0x5')](_0xb300('0x6'),_0x222d81,_[_0xb300('0x7')](_0x391577,_0xb300('0x8'))['join'](',\x20'));_0x52b2d9['stop']();}else{logger['info'](_0xb300('0x9'),_0x222d81,_0x38b07f['priority']);if(_0x38b07f['priority']){var _0x1ad459=_[_0xb300('0xa')](_0x52b2d9[_0xb300('0xb')](),{'p':_0x38b07f[_0xb300('0xc')]});if(_0x1ad459>=0x0){logger[_0xb300('0xd')](_0xb300('0xe'),_0x222d81,_0x38b07f[_0xb300('0xc')]||'next',_0x1ad459);_0x52b2d9[_0xb300('0xf')](_0x1ad459);}else{logger[_0xb300('0xd')](_0xb300('0x10'),_0x222d81,_0x38b07f['priority']||_0xb300('0xf'));_0x52b2d9[_0xb300('0x11')]();}}else{_0x52b2d9[_0xb300('0xf')]();}}}catch(_0x28916d){logger['error'](_0xb300('0x6'),_0x222d81,JSON[_0xb300('0x12')](_0x28916d));_0x52b2d9[_0xb300('0x11')]();}};}; \ No newline at end of file +var _0x39ae=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','length','error','[%s][GOTOP]\x20%s','map','join','stop'];(function(_0x4ec4a1,_0x304ef9){var _0x55de6c=function(_0x5b38cc){while(--_0x5b38cc){_0x4ec4a1['push'](_0x4ec4a1['shift']());}};_0x55de6c(++_0x304ef9);}(_0x39ae,0x100));var _0xe39a=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x39ae[_0x25e7cb];return _0x375d92;};'use strict';var schema=require(_0xe39a('0x0'));var _=require('lodash');var logger=require(_0xe39a('0x1'))(_0xe39a('0x2'));var gotop=schema({'priority':{'type':_0xe39a('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4e5e67,_0x51e422){return function(_0x5d60c8){try{var _0x3f7080={'priority':_0x51e422[0x0]};var _0x4c4e65=gotop[_0xe39a('0x0')](_0x3f7080,{'typecast':!![]});if(_0x4c4e65[_0xe39a('0x4')]){logger[_0xe39a('0x5')](_0xe39a('0x6'),_0x4e5e67,_[_0xe39a('0x7')](_0x4c4e65,'message')[_0xe39a('0x8')](',\x20'));_0x5d60c8[_0xe39a('0x9')]();}else{logger[_0xe39a('0xa')](_0xe39a('0xb'),_0x4e5e67,_0x3f7080['priority']);if(_0x3f7080[_0xe39a('0xc')]){var _0x8357d8=_[_0xe39a('0xd')](_0x5d60c8[_0xe39a('0xe')](),{'p':_0x3f7080['priority']});if(_0x8357d8>=0x0){logger['info'](_0xe39a('0xf'),_0x4e5e67,_0x3f7080[_0xe39a('0xc')]||_0xe39a('0x10'),_0x8357d8);_0x5d60c8[_0xe39a('0x10')](_0x8357d8);}else{logger[_0xe39a('0xa')](_0xe39a('0x11'),_0x4e5e67,_0x3f7080[_0xe39a('0xc')]||'next');_0x5d60c8['stop']();}}else{_0x5d60c8['next']();}}}catch(_0x1ba220){logger['error'](_0xe39a('0x6'),_0x4e5e67,JSON[_0xe39a('0x12')](_0x1ba220));_0x5d60c8['stop']();}};}; \ 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 a1c3431..0bcf46c 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 _0x7e22=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','stringify','stop','error','lodash','../../../../config/logger','routing'];(function(_0x1e9727,_0x1110c6){var _0xf2e511=function(_0x29009f){while(--_0x29009f){_0x1e9727['push'](_0x1e9727['shift']());}};_0xf2e511(++_0x1110c6);}(_0x7e22,0x1d8));var _0x27e2=function(_0x182e99,_0x2e929e){_0x182e99=_0x182e99-0x0;var _0x2391f0=_0x7e22[_0x182e99];return _0x2391f0;};'use strict';var _=require(_0x27e2('0x0'));var utils=require('./utils');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var rpc={'chatMessage':require(_0x27e2('0x3')),'openchannelMessage':require(_0x27e2('0x4')),'mailMessage':require(_0x27e2('0x5')),'smsMessage':require(_0x27e2('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x27e2('0x7'))};exports['consequence']=function(_0x3b7d1e,_0x350996){return function(_0x3eb3cd){try{var _0x8ec259={'body':utils['getMustacheRender'](_0x350996[0x0],this),'ContactId':this[_0x27e2('0x8')]['id']};if(this[_0x27e2('0x9')]===_0x27e2('0xa')){_0x8ec259[_0x27e2('0xb')]=this[_0x27e2('0xc')]['id'];}else{_0x8ec259[_[_0x27e2('0xd')](this[_0x27e2('0x9')])+_0x27e2('0xe')]=this['account']['id'];}_0x8ec259[_[_0x27e2('0xd')](this[_0x27e2('0x9')])+'InteractionId']=this[_0x27e2('0xf')]['id'];if(rpc[this[_0x27e2('0x9')]+_0x27e2('0x10')]){return rpc[this[_0x27e2('0x9')]+'Message'][_0x27e2('0x11')](_0x8ec259)['then'](function(_0x39d327){logger[_0x27e2('0x12')](_0x27e2('0x13'),_0x3b7d1e,_0x8ec259[_0x27e2('0x14')]);_0x3eb3cd[_0x27e2('0x15')]();})['catch'](function(_0x24a023){logger['error'](_0x27e2('0x13'),_0x3b7d1e,JSON[_0x27e2('0x16')](_0x24a023));_0x3eb3cd[_0x27e2('0x17')]();});}}catch(_0x36aa5b){logger[_0x27e2('0x18')](_0x27e2('0x13'),_0x3b7d1e,JSON[_0x27e2('0x16')](_0x36aa5b));_0x3eb3cd[_0x27e2('0x17')]();}};}; \ No newline at end of file +var _0xbe9d=['create','info','[%s][MESSAGE]\x20%s','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','AccountId','upperFirst','channel','interaction','Message'];(function(_0x26fa5d,_0x37c7fd){var _0x5c4543=function(_0x13560){while(--_0x13560){_0x26fa5d['push'](_0x26fa5d['shift']());}};_0x5c4543(++_0x37c7fd);}(_0xbe9d,0x99));var _0xdbe9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xbe9d[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xdbe9('0x0'));var utils=require(_0xdbe9('0x1'));var logger=require(_0xdbe9('0x2'))(_0xdbe9('0x3'));var rpc={'chatMessage':require(_0xdbe9('0x4')),'openchannelMessage':require(_0xdbe9('0x5')),'mailMessage':require(_0xdbe9('0x6')),'smsMessage':require(_0xdbe9('0x7')),'faxMessage':require(_0xdbe9('0x8')),'whatsappMessage':require(_0xdbe9('0x9'))};exports[_0xdbe9('0xa')]=function(_0x2602b1,_0x163517){return function(_0x52405e){try{var _0x56e9be={'body':utils[_0xdbe9('0xb')](_0x163517[0x0],this),'ContactId':this[_0xdbe9('0xc')]['id']};if(this['channel']===_0xdbe9('0xd')){_0x56e9be[_0xdbe9('0xe')]=this[_0xdbe9('0xf')]['id'];}else{_0x56e9be[_['upperFirst'](this['channel'])+_0xdbe9('0x10')]=this[_0xdbe9('0xf')]['id'];}_0x56e9be[_[_0xdbe9('0x11')](this[_0xdbe9('0x12')])+'InteractionId']=this[_0xdbe9('0x13')]['id'];if(rpc[this[_0xdbe9('0x12')]+_0xdbe9('0x14')]){return rpc[this[_0xdbe9('0x12')]+'Message'][_0xdbe9('0x15')](_0x56e9be)['then'](function(_0x31233b){logger[_0xdbe9('0x16')](_0xdbe9('0x17'),_0x2602b1,_0x56e9be['body']);_0x52405e[_0xdbe9('0x18')]();})[_0xdbe9('0x19')](function(_0x2429fb){logger['error'](_0xdbe9('0x17'),_0x2602b1,JSON['stringify'](_0x2429fb));_0x52405e[_0xdbe9('0x1a')]();});}}catch(_0x36b5c9){logger[_0xdbe9('0x1b')]('[%s][MESSAGE]\x20%s',_0x2602b1,JSON[_0xdbe9('0x1c')](_0x36b5c9));_0x52405e[_0xdbe9('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index eab3395..571a7c4 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 _0xb6b3=['stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x51e551,_0x50b1ee){var _0x533e11=function(_0x5ba16d){while(--_0x5ba16d){_0x51e551['push'](_0x51e551['shift']());}};_0x533e11(++_0x50b1ee);}(_0xb6b3,0x12e));var _0x3b6b=function(_0x9cc98,_0x125662){_0x9cc98=_0x9cc98-0x0;var _0x36f57c=_0xb6b3[_0x9cc98];return _0x36f57c;};'use strict';var utils=require(_0x3b6b('0x0'));var logger=require('../../../../config/logger')(_0x3b6b('0x1'));exports[_0x3b6b('0x2')]=function(_0x44a1d4,_0x36c22b){return function(_0x5eb8c0){try{logger[_0x3b6b('0x3')](_0x3b6b('0x4'),_0x44a1d4,utils[_0x3b6b('0x5')](_0x36c22b[0x0],this));_0x5eb8c0[_0x3b6b('0x6')]();}catch(_0x5b9722){logger[_0x3b6b('0x7')](_0x3b6b('0x4'),_0x44a1d4,JSON[_0x3b6b('0x8')](_0x5b9722));_0x5eb8c0[_0x3b6b('0x9')]();}};}; \ No newline at end of file +var _0x54e7=['next','error','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x54e7,0x18f));var _0x754e=function(_0x49e990,_0x5935fc){_0x49e990=_0x49e990-0x0;var _0x5a5c83=_0x54e7[_0x49e990];return _0x5a5c83;};'use strict';var utils=require(_0x754e('0x0'));var logger=require(_0x754e('0x1'))('routing');exports[_0x754e('0x2')]=function(_0x1dd9d2,_0x2eff25){return function(_0x3918b5){try{logger[_0x754e('0x3')](_0x754e('0x4'),_0x1dd9d2,utils[_0x754e('0x5')](_0x2eff25[0x0],this));_0x3918b5[_0x754e('0x6')]();}catch(_0x1b5151){logger[_0x754e('0x7')](_0x754e('0x4'),_0x1dd9d2,JSON['stringify'](_0x1b5151));_0x3918b5[_0x754e('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index db117dc..8ac492b 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 _0x913e=['name','message','QueueReport','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','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','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0x913e,0x1b2));var _0xe913=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x913e[_0x10004e];return _0x5af990;};'use strict';var schema=require('validate');var _=require(_0xe913('0x0'));var util=require('util');var seqqueue=require(_0xe913('0x1'));var moment=require(_0xe913('0x2'));var Redis=require(_0xe913('0x3'));var config=require(_0xe913('0x4'));var logger=require(_0xe913('0x5'))(_0xe913('0x6'));var strategy=require('./strategy');config['redis']=_[_0xe913('0x7')](config['redis'],{'host':_0xe913('0x8'),'port':0x18eb});var io=require(_0xe913('0x9'))(new Redis(config[_0xe913('0xa')]));var attributes=['id',_0xe913('0xb'),_0xe913('0xc'),_0xe913('0xd'),_0xe913('0xe'),'joinAt'];function emit(_0x3ab8c0,_0x48d209,_0x1078e7){io['to'](_0x3ab8c0)[_0xe913('0xf')](_0x48d209,_0x1078e7);}function emitChannelQueueInteraction(_0x1974bc,_0x459ebe,_0x2873f9,_0x5d4d53,_0x48a04a,_0x30d2ad,_0x3b310b,_0x4941a1){var _0x14670c=_[_0xe913('0x10')](_0x2873f9);_0x14670c[_0xe913('0xb')]=_0x4941a1;_0x14670c[_0xe913('0xd')]=_0x459ebe;_0x14670c[_0xe913('0xc')]=_0x5d4d53;_0x14670c['id']=_0x48a04a;if(_0x30d2ad){_0x3b310b[util[_0xe913('0x11')](_0xe913('0x12'),_0x1974bc)][_0x48a04a]=_[_0xe913('0x13')](_0x14670c,attributes);}else{delete _0x3b310b[util['format']('%sQueuesWaitingInteractions',_0x1974bc)][_0x48a04a];}emit(util[_0xe913('0x11')](_0xe913('0x14'),_0x1974bc,_0x459ebe),util['format'](_0xe913('0x15'),_0x1974bc,_0x30d2ad?'save':_0xe913('0x16')),_[_0xe913('0x13')](_0x14670c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe913('0x17')),'chatQueueReport':require(_0xe913('0x18')),'smsQueueReport':require(_0xe913('0x19')),'faxQueueReport':require(_0xe913('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xe913('0x1b'),'required':!![],'message':_0xe913('0x1c')},'timeout':{'type':_0xe913('0x1d'),'message':_0xe913('0x1e')}});function startRouting(_0x294e70,_0x79dac4,_0x36db0e,_0x301f51){if(_0x294e70&&_0x79dac4&&_0x36db0e){_0x79dac4[_0xe913('0x1f')]+=0x1;var _0x16a146={'uniqueid':_0x294e70,'from':_0x36db0e[_0xe913('0x20')]?_0x36db0e[_0xe913('0x20')][_0xe913('0xe')]:'','joinAt':moment()[_0xe913('0x11')](_0xe913('0x21')),'ContactId':_0x36db0e[_0xe913('0x22')]?_0x36db0e[_0xe913('0x22')]['id']:null,'ListId':_0x36db0e['list']?_0x36db0e[_0xe913('0x23')]['id']:null};_0x16a146[_[_0xe913('0x24')](_0x36db0e['channel'])+_0xe913('0x25')]=_0x79dac4['id']||null;_0x16a146[_['upperFirst'](_0x36db0e['channel'])+_0xe913('0x26')]=_0x36db0e[_0xe913('0x27')]?_0x36db0e['interaction']['id']:null;_0x16a146[_['upperFirst'](_0x36db0e[_0xe913('0x28')])+_0xe913('0x29')]=_0x36db0e['message']?_0x36db0e['message']['id']:null;_0x16a146[_[_0xe913('0x24')](_0x36db0e[_0xe913('0x28')])+(_0x36db0e[_0xe913('0x28')]!==_0xe913('0x2a')?_0xe913('0x2b'):'WebsiteId')]=_0x36db0e[_0xe913('0xc')]?_0x36db0e[_0xe913('0xc')]['id']:null;logger[_0xe913('0x2c')](util['format'](_0xe913('0x2d'),_0x294e70,_0x79dac4[_0xe913('0x2e')]));emitChannelQueueInteraction(_0x36db0e[_0xe913('0x28')],_0x79dac4[_0xe913('0x2e')],_0x16a146,_0x36db0e[_0xe913('0xc')]['name'],_0x36db0e[_0xe913('0x2f')]['id'],!![],_0x301f51,_0x79dac4['id']);if(rpc[_0x36db0e[_0xe913('0x28')]+_0xe913('0x30')]){return rpc[_0x36db0e['channel']+_0xe913('0x30')]['create'](_0x16a146)[_0xe913('0x31')](function(_0x315db0){logger[_0xe913('0x32')](_0xe913('0x33'));});}}}function stopRouting(_0x108acd,_0x1e1251,_0x2dcf03,_0x1db818){if(_0x108acd&&_0x1e1251){_0x1e1251['waiting']-=0x1;var _0x51e57a={'leaveAt':moment()[_0xe913('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xe913('0x21')),'reason':_0xe913('0x34')};logger[_0xe913('0x2c')](util[_0xe913('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x108acd,_0x1e1251['name']));emitChannelQueueInteraction(_0x2dcf03[_0xe913('0x28')],_0x1e1251[_0xe913('0x2e')],_0x2dcf03[_0xe913('0x20')],_0x2dcf03['account'][_0xe913('0x2e')],_0x2dcf03[_0xe913('0x2f')]['id'],![],_0x1db818,_0x1e1251['id']);if(rpc[_0x2dcf03[_0xe913('0x28')]+'QueueReport']){return rpc[_0x2dcf03[_0xe913('0x28')]+_0xe913('0x30')][_0xe913('0x35')](_0x108acd,_0x51e57a)[_0xe913('0x31')](function(_0x35d2b9){logger[_0xe913('0x32')](_0xe913('0x36'));});}}}function endRouting(_0x65c35e,_0x554187,_0x1c2df4,_0x48506c){if(_0x65c35e&&_0x554187){_0x554187[_0xe913('0x1f')]-=0x1;var _0x35b71f={'leaveAt':moment()[_0xe913('0x11')](_0xe913('0x21')),'exitAt':moment()[_0xe913('0x11')](_0xe913('0x21')),'reason':_0xe913('0x37')};logger[_0xe913('0x2c')](util[_0xe913('0x11')](_0xe913('0x38'),_0x65c35e,_0x554187[_0xe913('0x2e')]));emitChannelQueueInteraction(_0x1c2df4['channel'],_0x554187[_0xe913('0x2e')],_0x1c2df4[_0xe913('0x20')],_0x1c2df4[_0xe913('0xc')][_0xe913('0x2e')],_0x1c2df4[_0xe913('0x2f')]['id'],![],_0x48506c);if(rpc[_0x1c2df4[_0xe913('0x28')]+_0xe913('0x30')]){return rpc[_0x1c2df4[_0xe913('0x28')]+_0xe913('0x30')][_0xe913('0x35')](_0x65c35e,_0x35b71f)[_0xe913('0x31')](function(_0x17f76d){logger['error'](_0xe913('0x36'));});}}}function handleFindQueue(_0xbf4488){return function(_0x32de8b){return _0x32de8b[_0xe913('0x2e')]['toLowerCase']()===_0xbf4488[_0xe913('0x39')]();};}exports[_0xe913('0x3a')]=function(_0x1863ba,_0x22ada0,_0x8c1620,_0x25b49a){return function(_0x18e5a2){try{var _0x1451e2={'name':_0x22ada0[0x0],'timeout':_0x22ada0[0x1]};var _0x41cec3=queue['validate'](_0x1451e2,{'typecast':!![]});if(_0x41cec3[_0xe913('0x3b')]){logger[_0xe913('0x32')](_0xe913('0x3c'),_0x1863ba,_[_0xe913('0x3d')](_0x41cec3,_0xe913('0x2f'))[_0xe913('0x3e')](',\x20'));_0x18e5a2[_0xe913('0x3f')]();}else{var _0x2abd49=_['find'](_0x8c1620[_0x25b49a['channel']+'Queues'],handleFindQueue(_0x1451e2[_0xe913('0x2e')]));if(_0x2abd49){startRouting(_0x1863ba,_0x2abd49,_0x25b49a,_0x8c1620);var _0x2669ba=(_0x2abd49[_0xe913('0x37')]||0xa)*0x3e8;var _0x5bf5db=(_0x1451e2[_0xe913('0x37')]||0x14)*0x3e8;var _0x665ce4,_0x539fd2;if(_0x2669ba>_0x5bf5db){_0x5bf5db=_0x2669ba;}var _0x1421b5=seqqueue[_0xe913('0x40')](_0x2669ba);_0x1421b5['id']=_0x1863ba;_0x1421b5[_0xe913('0x41')]=_0x2669ba;_0x1421b5[_0xe913('0x42')]=_0x5bf5db;_0x1421b5[_0xe913('0x28')]=_0x25b49a[_0xe913('0x28')];_0x8c1620[_0xe913('0x43')][_0x1863ba]['on'](_0xe913('0x44'),function(){logger['info'](_0xe913('0x45'),_0x1863ba);stopRouting(_0x1863ba,_0x2abd49,_0x25b49a,_0x8c1620);clearTimeout(_0x665ce4);_0x665ce4=undefined;_0x1421b5[_0xe913('0x46')](!![]);if(_0x8c1620[_0xe913('0x43')][_0x1863ba]){delete _0x8c1620[_0xe913('0x43')][_0x1863ba];}_0x18e5a2['stop']();});_0x8c1620['rules'][_0x1863ba]['on'](_0xe913('0x47'),function(){if(_0x8c1620[_0xe913('0x43')][_0x1863ba]){delete _0x8c1620[_0xe913('0x43')][_0x1863ba];}});_0x665ce4=setTimeout(function(){logger['info'](_0xe913('0x48'),_0x1863ba);endRouting(_0x1863ba,_0x2abd49,_0x25b49a,_0x8c1620);clearTimeout(_0x665ce4);_0x1421b5[_0xe913('0x46')](!![]);_0x18e5a2[_0xe913('0x49')]();},_0x5bf5db);switch(_0x2abd49[_0xe913('0x4a')]){case _0xe913('0x4b'):strategy[_0xe913('0x4b')](_0x1421b5,_0x2abd49,_0x8c1620,_0x25b49a);break;default:strategy[_0xe913('0x4c')](_0x1421b5,_0x2abd49,_0x8c1620,_0x25b49a);}}else{logger[_0xe913('0x32')](_0xe913('0x4d'),_0x1863ba,_0x1451e2['name']);_0x18e5a2[_0xe913('0x3f')]();}}}catch(_0x108417){console[_0xe913('0x4e')](_0x108417);logger[_0xe913('0x32')]('[%s][QUEUE]\x20%s',_0x1863ba,_0x108417[_0xe913('0x4f')]);_0x18e5a2[_0xe913('0x3f')]();}};}; \ No newline at end of file +var _0x7b50=['rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','join','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x17f12b,_0x2cdef8){var _0x54aec9=function(_0x4a1a66){while(--_0x4a1a66){_0x17f12b['push'](_0x17f12b['shift']());}};_0x54aec9(++_0x2cdef8);}(_0x7b50,0x1df));var _0x07b5=function(_0x52951a,_0x4e0b83){_0x52951a=_0x52951a-0x0;var _0x151f09=_0x7b50[_0x52951a];return _0x151f09;};'use strict';var schema=require(_0x07b5('0x0'));var _=require('lodash');var util=require(_0x07b5('0x1'));var seqqueue=require(_0x07b5('0x2'));var moment=require(_0x07b5('0x3'));var Redis=require(_0x07b5('0x4'));var config=require('../../../../config/environment');var logger=require(_0x07b5('0x5'))('routing');var strategy=require(_0x07b5('0x6'));config['redis']=_[_0x07b5('0x7')](config[_0x07b5('0x8')],{'host':_0x07b5('0x9'),'port':0x18eb});var io=require(_0x07b5('0xa'))(new Redis(config['redis']));var attributes=['id',_0x07b5('0xb'),_0x07b5('0xc'),_0x07b5('0xd'),_0x07b5('0xe'),_0x07b5('0xf')];function emit(_0x362621,_0x41134c,_0xd789a2){io['to'](_0x362621)[_0x07b5('0x10')](_0x41134c,_0xd789a2);}function emitChannelQueueInteraction(_0x5385fe,_0x1d8db7,_0x34509b,_0x318e52,_0x25092f,_0x24e4a7,_0x5b66bf,_0x59ce3f){var _0x56e9df=_[_0x07b5('0x11')](_0x34509b);_0x56e9df[_0x07b5('0xb')]=_0x59ce3f;_0x56e9df[_0x07b5('0xd')]=_0x1d8db7;_0x56e9df[_0x07b5('0xc')]=_0x318e52;_0x56e9df['id']=_0x25092f;if(_0x24e4a7){_0x5b66bf[util[_0x07b5('0x12')]('%sQueuesWaitingInteractions',_0x5385fe)][_0x25092f]=_[_0x07b5('0x13')](_0x56e9df,attributes);}else{delete _0x5b66bf[util[_0x07b5('0x12')](_0x07b5('0x14'),_0x5385fe)][_0x25092f];}emit(util[_0x07b5('0x12')]('%s:queue:%s',_0x5385fe,_0x1d8db7),util[_0x07b5('0x12')](_0x07b5('0x15'),_0x5385fe,_0x24e4a7?'save':_0x07b5('0x16')),_[_0x07b5('0x13')](_0x56e9df,attributes));}var rpc={'openchannelQueueReport':require(_0x07b5('0x17')),'mailQueueReport':require(_0x07b5('0x18')),'chatQueueReport':require(_0x07b5('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x07b5('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x07b5('0x1b'),'required':!![],'message':_0x07b5('0x1c')},'timeout':{'type':_0x07b5('0x1d'),'message':_0x07b5('0x1e')}});function startRouting(_0x291592,_0x4db60d,_0x146970,_0xdd5df8){if(_0x291592&&_0x4db60d&&_0x146970){_0x4db60d['waiting']+=0x1;var _0x1472c1={'uniqueid':_0x291592,'from':_0x146970[_0x07b5('0x1f')]?_0x146970[_0x07b5('0x1f')][_0x07b5('0xe')]:'','joinAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'ContactId':_0x146970[_0x07b5('0x21')]?_0x146970[_0x07b5('0x21')]['id']:null,'ListId':_0x146970[_0x07b5('0x22')]?_0x146970[_0x07b5('0x22')]['id']:null};_0x1472c1[_[_0x07b5('0x23')](_0x146970[_0x07b5('0x24')])+'QueueId']=_0x4db60d['id']||null;_0x1472c1[_['upperFirst'](_0x146970[_0x07b5('0x24')])+'InteractionId']=_0x146970[_0x07b5('0x25')]?_0x146970[_0x07b5('0x25')]['id']:null;_0x1472c1[_[_0x07b5('0x23')](_0x146970['channel'])+_0x07b5('0x26')]=_0x146970[_0x07b5('0x27')]?_0x146970[_0x07b5('0x27')]['id']:null;_0x1472c1[_[_0x07b5('0x23')](_0x146970['channel'])+(_0x146970[_0x07b5('0x24')]!==_0x07b5('0x28')?'AccountId':'WebsiteId')]=_0x146970['account']?_0x146970[_0x07b5('0xc')]['id']:null;logger[_0x07b5('0x29')](util['format'](_0x07b5('0x2a'),_0x291592,_0x4db60d['name']));emitChannelQueueInteraction(_0x146970[_0x07b5('0x24')],_0x4db60d['name'],_0x1472c1,_0x146970[_0x07b5('0xc')][_0x07b5('0x2b')],_0x146970[_0x07b5('0x27')]['id'],!![],_0xdd5df8,_0x4db60d['id']);if(rpc[_0x146970['channel']+_0x07b5('0x2c')]){return rpc[_0x146970['channel']+_0x07b5('0x2c')][_0x07b5('0x2d')](_0x1472c1)[_0x07b5('0x2e')](function(_0x378b85){logger[_0x07b5('0x2f')](_0x07b5('0x30'));});}}}function stopRouting(_0x4a1b7d,_0x3e7053,_0x2e6272,_0x9e3b03){if(_0x4a1b7d&&_0x3e7053){_0x3e7053[_0x07b5('0x31')]-=0x1;var _0x283560={'leaveAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'acceptAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'reason':_0x07b5('0x32')};logger[_0x07b5('0x29')](util[_0x07b5('0x12')](_0x07b5('0x33'),_0x4a1b7d,_0x3e7053['name']));emitChannelQueueInteraction(_0x2e6272[_0x07b5('0x24')],_0x3e7053[_0x07b5('0x2b')],_0x2e6272[_0x07b5('0x1f')],_0x2e6272[_0x07b5('0xc')][_0x07b5('0x2b')],_0x2e6272[_0x07b5('0x27')]['id'],![],_0x9e3b03,_0x3e7053['id']);if(rpc[_0x2e6272[_0x07b5('0x24')]+'QueueReport']){return rpc[_0x2e6272['channel']+_0x07b5('0x2c')][_0x07b5('0x34')](_0x4a1b7d,_0x283560)[_0x07b5('0x2e')](function(_0x2d7e58){logger['error'](_0x07b5('0x35'));});}}}function endRouting(_0x8b03ef,_0x784afd,_0x42f71a,_0x357fe6){if(_0x8b03ef&&_0x784afd){_0x784afd['waiting']-=0x1;var _0x3006ad={'leaveAt':moment()[_0x07b5('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'reason':_0x07b5('0x36')};logger[_0x07b5('0x29')](util['format'](_0x07b5('0x37'),_0x8b03ef,_0x784afd[_0x07b5('0x2b')]));emitChannelQueueInteraction(_0x42f71a[_0x07b5('0x24')],_0x784afd[_0x07b5('0x2b')],_0x42f71a[_0x07b5('0x1f')],_0x42f71a[_0x07b5('0xc')][_0x07b5('0x2b')],_0x42f71a[_0x07b5('0x27')]['id'],![],_0x357fe6);if(rpc[_0x42f71a[_0x07b5('0x24')]+'QueueReport']){return rpc[_0x42f71a[_0x07b5('0x24')]+'QueueReport'][_0x07b5('0x34')](_0x8b03ef,_0x3006ad)[_0x07b5('0x2e')](function(_0x511e80){logger[_0x07b5('0x2f')](_0x07b5('0x35'));});}}}function handleFindQueue(_0x39d18e){return function(_0x5d1cf2){return _0x5d1cf2[_0x07b5('0x2b')][_0x07b5('0x38')]()===_0x39d18e[_0x07b5('0x38')]();};}exports[_0x07b5('0x39')]=function(_0x24da56,_0x163cb9,_0x1c1186,_0x47e8aa){return function(_0x58f9cd){try{var _0x4815e1={'name':_0x163cb9[0x0],'timeout':_0x163cb9[0x1]};var _0x4eabc2=queue['validate'](_0x4815e1,{'typecast':!![]});if(_0x4eabc2[_0x07b5('0x3a')]){logger[_0x07b5('0x2f')]('[%s][QUEUE]\x20%s',_0x24da56,_['map'](_0x4eabc2,_0x07b5('0x27'))[_0x07b5('0x3b')](',\x20'));_0x58f9cd[_0x07b5('0x3c')]();}else{var _0x40b1b6=_[_0x07b5('0x3d')](_0x1c1186[_0x47e8aa[_0x07b5('0x24')]+_0x07b5('0x3e')],handleFindQueue(_0x4815e1[_0x07b5('0x2b')]));if(_0x40b1b6){startRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);var _0x504e37=(_0x40b1b6[_0x07b5('0x36')]||0xa)*0x3e8;var _0x14dd90=(_0x4815e1[_0x07b5('0x36')]||0x14)*0x3e8;var _0xedc0bd,_0x1b06bf;if(_0x504e37>_0x14dd90){_0x14dd90=_0x504e37;}var _0x4a9e58=seqqueue[_0x07b5('0x3f')](_0x504e37);_0x4a9e58['id']=_0x24da56;_0x4a9e58[_0x07b5('0x40')]=_0x504e37;_0x4a9e58['qtimeout']=_0x14dd90;_0x4a9e58[_0x07b5('0x24')]=_0x47e8aa['channel'];_0x1c1186['rules'][_0x24da56]['on'](_0x07b5('0x41'),function(){logger[_0x07b5('0x29')](_0x07b5('0x42'),_0x24da56);stopRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);clearTimeout(_0xedc0bd);_0xedc0bd=undefined;_0x4a9e58['close'](!![]);if(_0x1c1186['rules'][_0x24da56]){delete _0x1c1186[_0x07b5('0x43')][_0x24da56];}_0x58f9cd[_0x07b5('0x3c')]();});_0x1c1186[_0x07b5('0x43')][_0x24da56]['on']('complete',function(){if(_0x1c1186[_0x07b5('0x43')][_0x24da56]){delete _0x1c1186[_0x07b5('0x43')][_0x24da56];}});_0xedc0bd=setTimeout(function(){logger[_0x07b5('0x29')](_0x07b5('0x44'),_0x24da56);endRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);clearTimeout(_0xedc0bd);_0x4a9e58[_0x07b5('0x45')](!![]);_0x58f9cd[_0x07b5('0x46')]();},_0x14dd90);switch(_0x40b1b6[_0x07b5('0x47')]){case'rrmemory':strategy[_0x07b5('0x48')](_0x4a9e58,_0x40b1b6,_0x1c1186,_0x47e8aa);break;default:strategy[_0x07b5('0x49')](_0x4a9e58,_0x40b1b6,_0x1c1186,_0x47e8aa);}}else{logger[_0x07b5('0x2f')](_0x07b5('0x4a'),_0x24da56,_0x4815e1[_0x07b5('0x2b')]);_0x58f9cd['stop']();}}}catch(_0x3f0b17){console[_0x07b5('0x4b')](_0x3f0b17);logger['error'](_0x07b5('0x4c'),_0x24da56,_0x3f0b17[_0x07b5('0x4d')]);_0x58f9cd['stop']();}};}; \ 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 a02afb0..0cf3437 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 _0xb74d=['handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','TIMEOUT','lodash','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xb74d,0x1c5));var _0xdb74=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xb74d[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0xdb74('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xdb74('0x1'))(_0xdb74('0x2'));var Agent=function(_0x1b945c,_0x411cc7,_0x31ad38,_0x478c38){this[_0xdb74('0x3')]=uuid['v4']();this[_0xdb74('0x4')]=_0x1b945c;this[_0xdb74('0x5')]=_0x411cc7;this[_0xdb74('0x6')]=_0x31ad38;this[_0xdb74('0x2')]=_0x478c38;this[_0xdb74('0x4')][_0xdb74('0x7')](this[_0xdb74('0x8')]['bind'](this),this[_0xdb74('0x9')][_0xdb74('0xa')](this));this['squeue']['on'](_0xdb74('0xb'),this[_0xdb74('0x9')][_0xdb74('0xa')](this));this['squeue']['on']('drained',this[_0xdb74('0xc')][_0xdb74('0xa')](this));};Agent[_0xdb74('0xd')][_0xdb74('0x7')]=function(){this['squeue']['push'](this[_0xdb74('0x8')][_0xdb74('0xa')](this),this[_0xdb74('0x9')][_0xdb74('0xa')](this));};Agent[_0xdb74('0xd')][_0xdb74('0xc')]=function(){this[_0xdb74('0x9')](!![]);};Agent['prototype'][_0xdb74('0x8')]=function(){logger[_0xdb74('0xe')](_0xdb74('0xf'),this[_0xdb74('0x4')]['id'],this[_0xdb74('0x5')]['id']);if(_[_0xdb74('0x10')](this[_0xdb74('0x6')][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']])){logger[_0xdb74('0xe')](_0xdb74('0x12'),this['squeue']['id'],this[_0xdb74('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xdb74('0x2')][_0xdb74('0x13')]||util[_0xdb74('0x14')](this[_0xdb74('0x4')]['id'],this[_0xdb74('0x6')][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']],this[_0xdb74('0x4')][_0xdb74('0x15')],![])){this[_0xdb74('0x6')]['agents'][this['agent']['id']][_0xdb74('0x16')]=!![];this[_0xdb74('0x6')][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this['realtime'][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']],null,this[_0xdb74('0x2')]);util[_0xdb74('0x17')](this[_0xdb74('0x4')]['id'],this['realtime'][_0xdb74('0x11')][this['agent']['id']],_0xdb74('0x18')+(this['routing'][_0xdb74('0x13')]?':FORCED':''));}else{logger[_0xdb74('0xe')](_0xdb74('0x19'),this[_0xdb74('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdb74('0xa')](this),0x3e8);}}};Agent[_0xdb74('0xd')][_0xdb74('0x9')]=function(_0x4b8069){if(_[_0xdb74('0x10')](this[_0xdb74('0x6')][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']])){return logger[_0xdb74('0xe')](_0xdb74('0x12'),this['squeue']['id'],this[_0xdb74('0x5')]['id']);}else{logger[_0xdb74('0xe')](_0xdb74('0x1a'),this[_0xdb74('0x4')]['id'],this[_0xdb74('0x5')]['id']);util[_0xdb74('0x1b')](this['notificationId'],this[_0xdb74('0x4')]['id'],this[_0xdb74('0x6')][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']],null,this['routing']);this['realtime'][_0xdb74('0x11')][this[_0xdb74('0x5')]['id']][_0xdb74('0x16')]=![];this['realtime'][_0xdb74('0x11')][this['agent']['id']][_0xdb74('0x1c')]=undefined;util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xdb74('0x5')]['id']],_0x4b8069?_0xdb74('0x1d'):_0xdb74('0x1e'));}if(!_0x4b8069){setTimeout(this[_0xdb74('0x7')][_0xdb74('0xa')](this),0x3e8);}};function agent(_0x5e56c6,_0x15f408,_0x1cdec2,_0x3b3df1){return new Agent(_0x5e56c6,_0x15f408,_0x1cdec2,_0x3b3df1);}module['exports']=agent; \ No newline at end of file +var _0x4393=['handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','debug','[%s][AGENT]\x20timeout\x20with\x20%s','busy','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleTimeout','bind','timeout','drained'];(function(_0x19bf84,_0x577081){var _0x39a51a=function(_0x4116ff){while(--_0x4116ff){_0x19bf84['push'](_0x19bf84['shift']());}};_0x39a51a(++_0x577081);}(_0x4393,0x133));var _0x3439=function(_0x4d4f00,_0x26cd13){_0x4d4f00=_0x4d4f00-0x0;var _0x170bd5=_0x4393[_0x4d4f00];return _0x170bd5;};'use strict';var _=require(_0x3439('0x0'));var uuid=require(_0x3439('0x1'));var util=require('./util');var logger=require(_0x3439('0x2'))(_0x3439('0x3'));var Agent=function(_0x4afdaa,_0x43338c,_0x51772b,_0x4bac5f){this[_0x3439('0x4')]=uuid['v4']();this[_0x3439('0x5')]=_0x4afdaa;this[_0x3439('0x6')]=_0x43338c;this[_0x3439('0x7')]=_0x51772b;this[_0x3439('0x3')]=_0x4bac5f;this[_0x3439('0x5')][_0x3439('0x8')](this['handleRun']['bind'](this),this[_0x3439('0x9')][_0x3439('0xa')](this));this[_0x3439('0x5')]['on'](_0x3439('0xb'),this[_0x3439('0x9')][_0x3439('0xa')](this));this[_0x3439('0x5')]['on'](_0x3439('0xc'),this[_0x3439('0xd')][_0x3439('0xa')](this));};Agent[_0x3439('0xe')][_0x3439('0x8')]=function(){this[_0x3439('0x5')]['push'](this['handleRun'][_0x3439('0xa')](this),this['handleTimeout'][_0x3439('0xa')](this));};Agent[_0x3439('0xe')][_0x3439('0xd')]=function(){this[_0x3439('0x9')](!![]);};Agent[_0x3439('0xe')][_0x3439('0xf')]=function(){logger['debug'](_0x3439('0x10'),this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);if(_[_0x3439('0x11')](this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']])){logger['debug'](_0x3439('0x13'),this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);setTimeout(this[_0x3439('0x8')][_0x3439('0xa')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0x3439('0x7')]['agents'][this['agent']['id']],this[_0x3439('0x5')]['channel'],![])){this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']]['busy']=!![];this[_0x3439('0x7')]['agents'][this[_0x3439('0x6')]['id']][_0x3439('0x14')]=undefined;util[_0x3439('0x15')](this[_0x3439('0x4')],this['squeue']['id'],this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']],null,this[_0x3439('0x3')]);util[_0x3439('0x16')](this[_0x3439('0x5')]['id'],this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']],_0x3439('0x17')+(this[_0x3439('0x3')][_0x3439('0x18')]?_0x3439('0x19'):''));}else{logger['debug'](_0x3439('0x1a'),this[_0x3439('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0x3439('0xa')](this),0x3e8);}}};Agent[_0x3439('0xe')][_0x3439('0x9')]=function(_0x290243){if(_[_0x3439('0x11')](this['realtime'][_0x3439('0x12')][this[_0x3439('0x6')]['id']])){return logger[_0x3439('0x1b')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);}else{logger[_0x3439('0x1b')](_0x3439('0x1c'),this['squeue']['id'],this[_0x3439('0x6')]['id']);util['hideNotification'](this[_0x3439('0x4')],this[_0x3439('0x5')]['id'],this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']],null,this['routing']);this['realtime'][_0x3439('0x12')][this['agent']['id']][_0x3439('0x1d')]=![];this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']],_0x290243?'STOP':_0x3439('0x1e'));}if(!_0x290243){setTimeout(this[_0x3439('0x8')][_0x3439('0xa')](this),0x3e8);}};function agent(_0x2422bf,_0x13b757,_0x27fd2b,_0x3967b3){return new Agent(_0x2422bf,_0x13b757,_0x27fd2b,_0x3967b3);}module[_0x3439('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 472e548..4dcf862 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 _0x7217=['name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','./util','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','agents','debug','isAgentAvailable','writeLog','RINGING','busy','busyQueue'];(function(_0x1ca426,_0x3117b1){var _0x3dd6ff=function(_0x4005b1){while(--_0x4005b1){_0x1ca426['push'](_0x1ca426['shift']());}};_0x3dd6ff(++_0x3117b1);}(_0x7217,0xa9));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x7721('0x0'));var logger=require('../../../../../config/logger')(_0x7721('0x1'));var Beepall=function(_0xec5d3f,_0x308464,_0x18353b,_0x363be8){this[_0x7721('0x2')]=uuid['v4']();this[_0x7721('0x3')]=_0xec5d3f;this[_0x7721('0x4')]=_0x308464;this[_0x7721('0x5')]=_0x18353b;this[_0x7721('0x1')]=_0x363be8;this['squeue'][_0x7721('0x6')](this[_0x7721('0x7')][_0x7721('0x8')](this),this[_0x7721('0x9')]['bind'](this));this[_0x7721('0x3')]['on'](_0x7721('0xa'),this['handleTimeout'][_0x7721('0x8')](this));this[_0x7721('0x3')]['on'](_0x7721('0xb'),this['handleDrained'][_0x7721('0x8')](this));};Beepall[_0x7721('0xc')][_0x7721('0x6')]=function(){this['squeue'][_0x7721('0x6')](this[_0x7721('0x7')]['bind'](this),this[_0x7721('0x9')][_0x7721('0x8')](this));};Beepall['prototype'][_0x7721('0xd')]=function(){this[_0x7721('0x9')](!![]);};Beepall[_0x7721('0xc')][_0x7721('0x7')]=function(){var _0x22a78b=!![];if(!_['isNil'](this[_0x7721('0x4')])&&!_[_0x7721('0xe')](this[_0x7721('0x4')][_0x7721('0xf')])&&this['queue'][_0x7721('0xf')]['length']>0x0){for(var _0x1073dd=0x0,_0x5576bc;_0x1073dd0x0){for(var _0x528d99=0x0,_0x10a8f1;_0x528d990x0&&_0xe60f42[_0x56d845+_0xbe14('0x22')]>=_0xe60f42[_0x56d845+_0xbe14('0x21')]){writeLog(_0x51dc0b,_0xe60f42,_0x56d845[_0xbe14('0x23')]()+_0xbe14('0x24'));return![];}}return!![];};exports[_0xbe14('0x25')]=function(_0x55d001,_0x1822e0,_0x1ba46a,_0x391556,_0x169369){return sendNotification(!![],_0x55d001,_0x1822e0,_0x1ba46a,_0x391556,_0x169369);};exports['hideNotification']=function(_0x16f884,_0x29fc64,_0x59bf34,_0x3c3613,_0x3b3e84){return sendNotification(![],_0x16f884,_0x29fc64,_0x59bf34,_0x3c3613,_0x3b3e84);};exports[_0xbe14('0x26')]=writeLog; \ No newline at end of file +var _0x2d17=['getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','save','remove','debug','format','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','ioredis','../../../../../config/environment','routing','redis','socket.io-emitter','user:%s','name','emit','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg'];(function(_0x1ae418,_0x1f708f){var _0x2f2eea=function(_0x1c7cf4){while(--_0x1c7cf4){_0x1ae418['push'](_0x1ae418['shift']());}};_0x2f2eea(++_0x1f708f);}(_0x2d17,0x17e));var _0x72d1=function(_0x4fdd63,_0xd7d90d){_0x4fdd63=_0x4fdd63-0x0;var _0x3d297b=_0x2d17[_0x4fdd63];return _0x3d297b;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var utils=require('../utils');var Redis=require(_0x72d1('0x2'));var config=require(_0x72d1('0x3'));var logger=require('../../../../../config/logger')(_0x72d1('0x4'));config[_0x72d1('0x5')]=_['defaults'](config[_0x72d1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x72d1('0x6'))(new Redis(config['redis']));function sendNotification(_0x139ba0,_0x239d1f,_0x5b40a9,_0x477264,_0x422f5a,_0x19e248){io['to'](util['format'](_0x72d1('0x7'),_0x477264[_0x72d1('0x8')]))[_0x72d1('0x9')]('user:save',_0x477264);var _0x1d7520=_0x19e248||{};var _0x3a35c6=_0x5b40a9[_0x72d1('0xa')]('.');var _0x14a41e={'uniqueid':_0x239d1f,'channel':_0x3a35c6[0x0],'id':_0x3a35c6[0x1],'title':_0x3a35c6[0x0]+_0x72d1('0xb'),'interactionId':_0x3a35c6[0x2],'queue':_0x422f5a?_0x422f5a[_0x72d1('0x8')]:null,'sound':_0x1d7520[_0x72d1('0xc')][_0x72d1('0xd')],'shake':_0x1d7520[_0x72d1('0xc')][_0x72d1('0xe')]};try{if(!_0x1d7520['body']){_0x1d7520[_0x72d1('0xf')]={};}if(_0x422f5a){_0x1d7520[_0x72d1('0xf')][_0x72d1('0x10')]=_0x422f5a;}else if(_0x1d7520[_0x72d1('0xf')][_0x72d1('0x10')]){delete _0x1d7520[_0x72d1('0xf')][_0x72d1('0x10')];}_0x14a41e[_0x72d1('0x11')]=utils[_0x72d1('0x12')](_0x1d7520[_0x72d1('0xc')][_0x72d1('0x13')],_0x1d7520);}catch(_0x23a238){_0x14a41e[_0x72d1('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x72d1('0x14')](util['format'](_0x72d1('0x15'),_0x239d1f,_0x23a238[_0x72d1('0x16')]));}io['to'](util['format'](_0x72d1('0x7'),_0x477264[_0x72d1('0x8')]))[_0x72d1('0x9')](util['format']('notification:%s',_0x139ba0?_0x72d1('0x17'):_0x72d1('0x18')),_0x14a41e);}function writeLog(_0x2233cb,_0x1865c1,_0x8d6890){return logger[_0x72d1('0x19')](util[_0x72d1('0x1a')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2233cb,_0x1865c1[_0x72d1('0x8')],_0x8d6890));}exports['isAgentAvailable']=function(_0x506062,_0x5b85cc,_0x585243,_0x445985){if(_0x5b85cc[_0x72d1('0x1b')]){writeLog(_0x506062,_0x5b85cc,'BUSY');return![];}if(!_0x5b85cc[_0x72d1('0x1c')]){writeLog(_0x506062,_0x5b85cc,_0x72d1('0x1d'));return![];}if(_0x5b85cc[_0x585243+_0x72d1('0x1e')]){writeLog(_0x506062,_0x5b85cc,_0x72d1('0x1f'));return![];}if(_0x445985&&_0x5b85cc[_0x72d1('0x20')](_0x585243+'Capacity')&&_0x5b85cc['hasOwnProperty'](_0x585243+_0x72d1('0x21'))){if(_0x5b85cc[_0x585243+_0x72d1('0x22')]>0x0&&_0x5b85cc[_0x585243+_0x72d1('0x21')]>=_0x5b85cc[_0x585243+_0x72d1('0x22')]){writeLog(_0x506062,_0x5b85cc,_0x585243[_0x72d1('0x23')]()+_0x72d1('0x24'));return![];}}return!![];};exports[_0x72d1('0x25')]=function(_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85){return sendNotification(!![],_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85);};exports[_0x72d1('0x26')]=function(_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0){return sendNotification(![],_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0);};exports[_0x72d1('0x27')]=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 f3400ba..6d5b805 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 _0x9e88=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','next','getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x9e88,0x7e));var _0x89e8=function(_0x19c2d4,_0x49922a){_0x19c2d4=_0x19c2d4-0x0;var _0x1d7f59=_0x9e88[_0x19c2d4];return _0x1d7f59;};'use strict';var schema=require(_0x89e8('0x0'));var sh=require(_0x89e8('0x1'));var _=require(_0x89e8('0x2'));var utils=require('./utils');var logger=require(_0x89e8('0x3'))(_0x89e8('0x4'));var system=schema({'command':{'type':_0x89e8('0x5'),'required':!![],'message':_0x89e8('0x6')}});exports[_0x89e8('0x7')]=function(_0x35951f,_0x2b0d30){return function(_0x1eba43){try{var _0xb51636={'command':_0x2b0d30[0x0]};var _0x32fa6e=system[_0x89e8('0x0')](_0xb51636,{'typecast':!![]});if(_0x32fa6e[_0x89e8('0x8')]){logger[_0x89e8('0x9')](_0x89e8('0xa'),_0x35951f,_['map'](_0x32fa6e,_0x89e8('0xb'))[_0x89e8('0xc')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x35951f);_0x1eba43[_0x89e8('0xd')]();}else{var _0x1c4df5=this;var _0x3e403a=utils[_0x89e8('0xe')](_0x2b0d30[0x0],this);logger[_0x89e8('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x35951f,_0x3e403a);sh[_0x89e8('0x10')](_[_0x89e8('0x11')](_0x3e403a),function(_0x2b3c62,_0x2a65bc){logger[_0x89e8('0xf')](_0x89e8('0x12'),_0x35951f,_0x2b3c62);if(_0x2b3c62==0x0){var _0x3706b8=_0x2a65bc[_0x89e8('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2b0d30[0x1])||_['isEmpty'](_0x2b0d30[0x1])){logger[_0x89e8('0xf')](_0x89e8('0x14'),_0x35951f);_0x1c4df5['body'][_0x2b0d30[0x1]]=_0x3706b8;}else{logger['info'](_0x89e8('0x15'),_0x35951f,_0x2b0d30[0x1],_0x3706b8);_0x1c4df5[_0x89e8('0x16')][_0x2b0d30[0x1]]=_0x3706b8;}}_0x1eba43[_0x89e8('0xd')]();});}}catch(_0x368e91){logger['error'](_0x89e8('0xa'),_0x35951f,_[_0x89e8('0x17')](_0x368e91)?JSON[_0x89e8('0x18')](_0x368e91):_0x368e91);logger[_0x89e8('0xf')](_0x89e8('0x19'),_0x35951f);_0x1eba43['next']();}};}; \ No newline at end of file +var _0xc5b5=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x4ada86,_0x1f6515){var _0x118399=function(_0x21b040){while(--_0x21b040){_0x4ada86['push'](_0x4ada86['shift']());}};_0x118399(++_0x1f6515);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x48a928,_0x430727){_0x48a928=_0x48a928-0x0;var _0x11c1e9=_0xc5b5[_0x48a928];return _0x11c1e9;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x5c5b('0x0'));var utils=require(_0x5c5b('0x1'));var logger=require('../../../../config/logger')(_0x5c5b('0x2'));var system=schema({'command':{'type':_0x5c5b('0x3'),'required':!![],'message':_0x5c5b('0x4')}});exports[_0x5c5b('0x5')]=function(_0x5365a3,_0x80df0d){return function(_0x36f240){try{var _0x27509d={'command':_0x80df0d[0x0]};var _0x6cb181=system[_0x5c5b('0x6')](_0x27509d,{'typecast':!![]});if(_0x6cb181[_0x5c5b('0x7')]){logger['error'](_0x5c5b('0x8'),_0x5365a3,_[_0x5c5b('0x9')](_0x6cb181,'message')[_0x5c5b('0xa')](',\x20'));logger['info'](_0x5c5b('0xb'),_0x5365a3);_0x36f240[_0x5c5b('0xc')]();}else{var _0x178913=this;var _0x484f47=utils['getMustacheRender'](_0x80df0d[0x0],this);logger[_0x5c5b('0xd')](_0x5c5b('0xe'),_0x5365a3,_0x484f47);sh[_0x5c5b('0xf')](_['trim'](_0x484f47),function(_0x4c6724,_0x565650){logger[_0x5c5b('0xd')](_0x5c5b('0x10'),_0x5365a3,_0x4c6724);if(_0x4c6724==0x0){var _0xae277f=_0x565650[_0x5c5b('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x5c5b('0x12')](_0x80df0d[0x1])||_['isEmpty'](_0x80df0d[0x1])){logger[_0x5c5b('0xd')](_0x5c5b('0x13'),_0x5365a3);_0x178913[_0x5c5b('0x14')][_0x80df0d[0x1]]=_0xae277f;}else{logger[_0x5c5b('0xd')](_0x5c5b('0x15'),_0x5365a3,_0x80df0d[0x1],_0xae277f);_0x178913[_0x5c5b('0x14')][_0x80df0d[0x1]]=_0xae277f;}}_0x36f240[_0x5c5b('0xc')]();});}}catch(_0x101880){logger[_0x5c5b('0x16')]('[%s][SYSTEM]\x20%s',_0x5365a3,_[_0x5c5b('0x17')](_0x101880)?JSON[_0x5c5b('0x18')](_0x101880):_0x101880);logger[_0x5c5b('0xd')](_0x5c5b('0xb'),_0x5365a3);_0x36f240[_0x5c5b('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 cd0fd47..de8a38a 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 _0xb8f7=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','error','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xb8f7,0x1b3));var _0x7b8f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb8f7[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require('validate');var _=require(_0x7b8f('0x0'));var rpc={'chatInteraction':require(_0x7b8f('0x1')),'openchannelInteraction':require(_0x7b8f('0x2')),'smsInteraction':require(_0x7b8f('0x3')),'mailInteraction':require(_0x7b8f('0x4')),'faxInteraction':require(_0x7b8f('0x5')),'whatsappInteraction':require(_0x7b8f('0x6'))};var logger=require(_0x7b8f('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7b8f('0x8')}});exports[_0x7b8f('0x9')]=function(_0x37fa34,_0x48bfe4,_0x4c9404,_0x508bee){return function(_0x4aa712){try{var _0x194b49={'tag':_0x48bfe4[0x0]};var _0x1d395b=tag['validate'](_0x194b49,{'typecast':!![]});if(_0x1d395b[_0x7b8f('0xa')]){logger['error'](_0x7b8f('0xb'),_0x37fa34,_[_0x7b8f('0xc')](_0x1d395b,_0x7b8f('0xd'))['join'](',\x20'));logger[_0x7b8f('0xe')](_0x7b8f('0xf'),_0x37fa34);_0x4aa712[_0x7b8f('0x10')]();}else{var _0x4f34e2={'ids':[_0x48bfe4[0x0]]};if(rpc[_0x508bee['channel']+'Interaction']){rpc[_0x508bee[_0x7b8f('0x11')]+'Interaction'][_0x7b8f('0x12')](_0x508bee['interaction']['id'],_0x4f34e2)[_0x7b8f('0x13')](function(_0x39a3c9){logger[_0x7b8f('0xe')](_0x7b8f('0x14'),_0x37fa34,_0x48bfe4[0x1],_0x508bee[_0x7b8f('0x11')],_0x508bee['interaction']['id']);})[_0x7b8f('0x15')](function(_0x4f3a18){logger['error'](_0x7b8f('0xb'),_0x37fa34,JSON[_0x7b8f('0x16')](_0x4f3a18));logger[_0x7b8f('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x37fa34);})[_0x7b8f('0x17')](function(){_0x4aa712[_0x7b8f('0x10')]();});}}}catch(_0x362546){logger[_0x7b8f('0x18')](_0x7b8f('0xb'),_0x37fa34,_['isObject'](_0x362546)?JSON['stringify'](_0x362546):_0x362546);logger[_0x7b8f('0xe')](_0x7b8f('0xf'),_0x37fa34);_0x4aa712[_0x7b8f('0x10')]();}};}; \ No newline at end of file +var _0x7f4f=['Interaction','then','catch','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0xc8636e,_0x5f49d2){var _0x1d7040=function(_0x98cd1f){while(--_0x98cd1f){_0xc8636e['push'](_0xc8636e['shift']());}};_0x1d7040(++_0x5f49d2);}(_0x7f4f,0x1b5));var _0xf7f4=function(_0x1b864a,_0x5ee497){_0x1b864a=_0x1b864a-0x0;var _0x3e8b04=_0x7f4f[_0x1b864a];return _0x3e8b04;};'use strict';var schema=require('validate');var _=require(_0xf7f4('0x0'));var rpc={'chatInteraction':require(_0xf7f4('0x1')),'openchannelInteraction':require(_0xf7f4('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf7f4('0x3')),'faxInteraction':require(_0xf7f4('0x4')),'whatsappInteraction':require(_0xf7f4('0x5'))};var logger=require(_0xf7f4('0x6'))(_0xf7f4('0x7'));var tag=schema({'tag':{'type':_0xf7f4('0x8'),'required':!![],'message':_0xf7f4('0x9')}});exports['consequence']=function(_0x3804ee,_0x30301f,_0x3bed82,_0x2eebce){return function(_0x25fa81){try{var _0x3fd887={'tag':_0x30301f[0x0]};var _0x3876e2=tag[_0xf7f4('0xa')](_0x3fd887,{'typecast':!![]});if(_0x3876e2[_0xf7f4('0xb')]){logger[_0xf7f4('0xc')](_0xf7f4('0xd'),_0x3804ee,_['map'](_0x3876e2,'message')[_0xf7f4('0xe')](',\x20'));logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);_0x25fa81[_0xf7f4('0x11')]();}else{var _0x34668b={'ids':[_0x30301f[0x0]]};if(rpc[_0x2eebce[_0xf7f4('0x12')]+_0xf7f4('0x13')]){rpc[_0x2eebce[_0xf7f4('0x12')]+'Interaction']['addTags'](_0x2eebce['interaction']['id'],_0x34668b)[_0xf7f4('0x14')](function(_0x24a6ef){logger[_0xf7f4('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3804ee,_0x30301f[0x1],_0x2eebce[_0xf7f4('0x12')],_0x2eebce['interaction']['id']);})[_0xf7f4('0x15')](function(_0x483abc){logger['error']('[%s][TAG]\x20%s',_0x3804ee,JSON[_0xf7f4('0x16')](_0x483abc));logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);})['finally'](function(){_0x25fa81[_0xf7f4('0x11')]();});}}}catch(_0x493ce3){logger[_0xf7f4('0xc')](_0xf7f4('0xd'),_0x3804ee,_[_0xf7f4('0x17')](_0x493ce3)?JSON['stringify'](_0x493ce3):_0x493ce3);logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);_0x25fa81['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 5784a37..6f309f4 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff8f=['title','jsonrpc','method','push','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','channelId=','&sessionId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','stop','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xff8f,0x136));var _0xfff8=function(_0x5968fa,_0x3dfd5c){_0x5968fa=_0x5968fa-0x0;var _0x35a5ac=_0xff8f[_0x5968fa];return _0x35a5ac;};'use strict';var rp=require('request-promise');var logger=require(_0xfff8('0x0'))(_0xfff8('0x1'));var _=require(_0xfff8('0x2'));var arr=[];exports['consequence']=function(_0x2d4017,_0x454b7d){return function(_0x2bb909){var _0x3bf804=_0x454b7d[0xa];var _0xb98822=_0x454b7d[0xb];var _0x9e7ec2=_0x454b7d[0xc];var _0xd73980=_0x454b7d[0xd];var _0x64a748=_0x454b7d[0xe];var _0x1693d6=_0x454b7d[0xf][_0xfff8('0x3')](/\n/g,_0xfff8('0x4'));var _0x58efed=_0x454b7d[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xfff8('0x5')](_0xb98822)){arr['push'](_0xb98822);var _0x4069ed=_0x454b7d[0x3];var _0xf093fb=_0x454b7d[0x4];var _0x5a79eb=_0x454b7d[0x1];var _0x109759=_0x454b7d[0x0];var _0x2c438d={};_0x2c438d[_0xfff8('0x6')]=_0x454b7d[0x8]+_0xfff8('0x7')+_0x9e7ec2+'|'+_0x3bf804+'|'+_0xd73980+'|'+_0xb98822+'|'+_0x64a748;_0x2c438d[_0xfff8('0x8')]=_0x454b7d[0x7]+_0xfff8('0x7')+_0x9e7ec2+'|'+_0x3bf804+'|'+_0xd73980+'|'+_0xb98822+'|'+_0x64a748+'|'+_0x1693d6+'|'+_0x58efed;_0x2c438d[_0xfff8('0x9')]=_0x454b7d[0x9];var _0x28312c={};_0x28312c[_0xfff8('0xa')]='2.0';_0x28312c[_0xfff8('0xb')]='login';var _0x59e735=[];_0x59e735[_0xfff8('0xc')](_0x454b7d[0x2]);_0x59e735[_0xfff8('0xc')](_0x454b7d[0x5]);_0x59e735[_0xfff8('0xc')](_0x454b7d[0x6]);_0x28312c[_0xfff8('0xd')]=_0x59e735;_0x28312c['id']=0x1;var _0x491159=JSON[_0xfff8('0xe')](_0x28312c);var _0x48fd72={'encoding':_0xfff8('0xf'),'method':_0xfff8('0x10'),'timeout':0x2710,'url':_0x4069ed,'headers':{'Content-Type':_0xfff8('0x11')},'body':_0x491159};return rp(_0x48fd72)[_0xfff8('0x12')](function(_0x540fa4){const _0x32bf72=JSON[_0xfff8('0x13')](_0x540fa4);if(!_0x32bf72['result'][_0xfff8('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x357e01=_0xb98822;var _0x18c516=_0xfff8('0x15')+_0x5a79eb+'&serviceId='+_0x109759+_0xfff8('0x16')+_0x357e01+'&data='+JSON['stringify'](_0x2c438d);var _0x481b93=_0xf093fb+'?'+_0x18c516;return rp(_0x481b93);})[_0xfff8('0x12')](function(_0x36be73){logger['info'](_0xfff8('0x17'),_0x2d4017,_0x36be73);_0x2bb909['stop']();})[_0xfff8('0x18')](function(_0xba2c0c){logger['error']('[%s][TVOX]\x20%s',_0x2d4017,_['isObject'](_0xba2c0c)?JSON[_0xfff8('0xe')](_0xba2c0c):_0xba2c0c);_0x2bb909[_0xfff8('0x19')]();});}else{logger[_0xfff8('0x1a')](_0xfff8('0x1b'),_0x2d4017);_0x2bb909[_0xfff8('0x1c')]();}};}; \ No newline at end of file +var _0x7834=['isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','info','catch','[%s][TVOX]\x20%s'];(function(_0x671a29,_0x505772){var _0x13c512=function(_0x3612d1){while(--_0x3612d1){_0x671a29['push'](_0x671a29['shift']());}};_0x13c512(++_0x505772);}(_0x7834,0x1d3));var _0x4783=function(_0x40a792,_0x146830){_0x40a792=_0x40a792-0x0;var _0x5e53d4=_0x7834[_0x40a792];return _0x5e53d4;};'use strict';var rp=require('request-promise');var logger=require(_0x4783('0x0'))(_0x4783('0x1'));var _=require(_0x4783('0x2'));var arr=[];exports[_0x4783('0x3')]=function(_0x341b6a,_0x20f8e7){return function(_0x171019){var _0x15df86=_0x20f8e7[0xa];var _0x192a98=_0x20f8e7[0xb];var _0x4c898f=_0x20f8e7[0xc];var _0x406f09=_0x20f8e7[0xd];var _0x245690=_0x20f8e7[0xe];var _0xbb2e90=_0x20f8e7[0xf][_0x4783('0x4')](/\n/g,_0x4783('0x5'));var _0x4f19fc=_0x20f8e7[0x10][_0x4783('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x192a98)){arr[_0x4783('0x6')](_0x192a98);var _0x2ef4ee=_0x20f8e7[0x3];var _0x3eaf2b=_0x20f8e7[0x4];var _0x21b7c9=_0x20f8e7[0x1];var _0x2be256=_0x20f8e7[0x0];var _0x2a018f={};_0x2a018f[_0x4783('0x7')]=_0x20f8e7[0x8]+_0x4783('0x8')+_0x4c898f+'|'+_0x15df86+'|'+_0x406f09+'|'+_0x192a98+'|'+_0x245690;_0x2a018f[_0x4783('0x9')]=_0x20f8e7[0x7]+_0x4783('0x8')+_0x4c898f+'|'+_0x15df86+'|'+_0x406f09+'|'+_0x192a98+'|'+_0x245690+'|'+_0xbb2e90+'|'+_0x4f19fc;_0x2a018f['title']=_0x20f8e7[0x9];var _0x495b92={};_0x495b92[_0x4783('0xa')]=_0x4783('0xb');_0x495b92['method']=_0x4783('0xc');var _0x16febd=[];_0x16febd['push'](_0x20f8e7[0x2]);_0x16febd[_0x4783('0x6')](_0x20f8e7[0x5]);_0x16febd[_0x4783('0x6')](_0x20f8e7[0x6]);_0x495b92[_0x4783('0xd')]=_0x16febd;_0x495b92['id']=0x1;var _0x163024=JSON[_0x4783('0xe')](_0x495b92);var _0x317c16={'encoding':'utf8','method':_0x4783('0xf'),'timeout':0x2710,'url':_0x2ef4ee,'headers':{'Content-Type':_0x4783('0x10')},'body':_0x163024};return rp(_0x317c16)[_0x4783('0x11')](function(_0x57680b){const _0x24a3b3=JSON[_0x4783('0x12')](_0x57680b);if(!_0x24a3b3[_0x4783('0x13')][_0x4783('0x14')]){throw new Error(_0x4783('0x15'));}var _0xa161b9=_0x192a98;var _0x2cea29='channelId='+_0x21b7c9+_0x4783('0x16')+_0x2be256+'&sessionId='+_0xa161b9+'&data='+JSON[_0x4783('0xe')](_0x2a018f);var _0x177705=_0x3eaf2b+'?'+_0x2cea29;return rp(_0x177705);})[_0x4783('0x11')](function(_0x1f382e){logger[_0x4783('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x341b6a,_0x1f382e);_0x171019['stop']();})[_0x4783('0x18')](function(_0x23cb3d){logger['error'](_0x4783('0x19'),_0x341b6a,_[_0x4783('0x1a')](_0x23cb3d)?JSON[_0x4783('0xe')](_0x23cb3d):_0x23cb3d);_0x171019[_0x4783('0x1b')]();});}else{logger[_0x4783('0x17')](_0x4783('0x1c'),_0x341b6a);_0x171019['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index eb493c1..0f2bf72 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x5422d0,_0x2c6c68){var _0x5aca39=function(_0x1388a2){while(--_0x1388a2){_0x5422d0['push'](_0x5422d0['shift']());}};_0x5aca39(++_0x2c6c68);}(_0xe706,0xa3));var _0x6e70=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xe706[_0x524021];return _0x269c3e;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4b3a87,_0x2f56f6){var _0x4e5ba9=function(_0x12e4ae){while(--_0x12e4ae){_0x4b3a87['push'](_0x4b3a87['shift']());}};_0x4e5ba9(++_0x2f56f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8143ff2..94535c4 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 _0x9234=['emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','join','.js','app','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ContactId','body','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath'];(function(_0x5a331d,_0x16bf29){var _0x215087=function(_0x1b93ae){while(--_0x1b93ae){_0x5a331d['push'](_0x5a331d['shift']());}};_0x215087(++_0x16bf29);}(_0x9234,0x1bd));var _0x4923=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9234[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x4923('0x0'));var util=require('util');var path=require(_0x4923('0x1'));var fs=require('fs');var jayson=require(_0x4923('0x2'));var BPromise=require(_0x4923('0x3'));var uuid=require(_0x4923('0x4'));var utils=require('./applications/utils');var config=require(_0x4923('0x5'));var logger=require(_0x4923('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x4923('0x7')),'mailQueueReport':require(_0x4923('0x8')),'chatQueueReport':require(_0x4923('0x9')),'smsQueueReport':require(_0x4923('0xa')),'faxQueueReport':require(_0x4923('0xb')),'whatsappQueueReport':require(_0x4923('0xc'))};var RuleEngine=require(_0x4923('0xd'));function getId(_0x548676,_0x1fffc2,_0x590bb6){return util[_0x4923('0xe')](_0x4923('0xf'),_0x548676,_0x1fffc2||0x0,_0x590bb6||0x0);}function getIntervals(_0x5acc16,_0x57a571){var _0x1ca912=[];if(!_[_0x4923('0x10')](_0x57a571[_0x4923('0x11')])&&!_[_0x4923('0x10')](_0x5acc16[_0x57a571[_0x4923('0x11')]])&&!_[_0x4923('0x10')](_0x5acc16[_0x57a571[_0x4923('0x11')]][_0x4923('0x12')])){_0x1ca912=_[_0x4923('0x13')](_0x5acc16[_0x57a571[_0x4923('0x11')]]['Intervals'],'interval');}else if(!_[_0x4923('0x10')](_0x57a571[_0x4923('0x14')])){_0x1ca912=[_0x57a571[_0x4923('0x14')]];}return _0x1ca912;}exports['listen']=function(_0x31a469){_0x31a469[_0x4923('0x15')]={};return new BPromise(function(_0x191257,_0x1716aa){var _0x27dbb2={'Start':function(_0x29a354){var _0x1f8375=this;return new Promise(function(_0x2897da,_0x2e9944){if(_0x29a354){try{var _0x3fedc7=[];var _0x559e4a=getId(_0x29a354[_0x4923('0x16')],_0x29a354[_0x4923('0x17')]?_0x29a354[_0x4923('0x17')]['id']:0x0,_0x29a354[_0x4923('0x18')]?_0x29a354['interaction']['id']:0x0);if(_0x29a354['applications']&&_[_0x4923('0x19')](_0x29a354['applications'])&&_0x29a354[_0x4923('0x1a')][_0x4923('0x1b')]){for(var _0x5dbddb=0x0;_0x5dbddb<_0x29a354[_0x4923('0x1a')][_0x4923('0x1b')];_0x5dbddb+=0x1){var _0xf2b888=_0x29a354[_0x4923('0x1a')][_0x5dbddb];if(fs['existsSync'](path[_0x4923('0x1c')](__dirname,_0x4923('0x1a'),_0xf2b888['app']+_0x4923('0x1d')))){var _0x522753=[];switch(_0xf2b888[_0x4923('0x1e')][_0x4923('0x1f')]()){case'autoreply':var _0x184f6a=_0xf2b888[_0x4923('0x20')][_0x4923('0x21')](',');if(_0x29a354[_0x4923('0x16')]===_0x4923('0x22')){_0x522753[_0x4923('0x23')](_0x184f6a[0x0]);_0x522753[_0x4923('0x23')](_0x184f6a[0x1]);_0x522753['push'](_0x184f6a['slice'](0x2,_0x184f6a[_0x4923('0x1b')])[_0x4923('0x1c')](','));}else{_0x522753[_0x4923('0x23')](_0x184f6a[0x0]);_0x522753[_0x4923('0x23')](_0x184f6a[_0x4923('0x24')](0x1,_0x184f6a[_0x4923('0x1b')])[_0x4923('0x1c')](','));}break;case _0x4923('0x25'):var _0x9982e8=_0xf2b888[_0x4923('0x20')][_0x4923('0x21')](',');_0x522753['push'](_0x9982e8[0x0]);_0x522753[_0x4923('0x23')](_0x9982e8[0x1]);_0x522753[_0x4923('0x23')](_0x9982e8[_0x4923('0x24')](0x2,_0x9982e8[_0x4923('0x1b')])[_0x4923('0x1c')](','));break;case _0x4923('0x26'):var _0x158a30=_0xf2b888[_0x4923('0x20')][_0x4923('0x21')](',');_0x522753[_0x4923('0x23')](_0x158a30[0x0]);_0x522753[_0x4923('0x23')](_0x158a30[0x1]);_0x522753[_0x4923('0x23')](_0x158a30[0x2]);_0x522753[_0x4923('0x23')](_0x158a30[0x3]);_0x522753[_0x4923('0x23')](_0x158a30['slice'](0x4,_0x158a30[_0x4923('0x1b')])[_0x4923('0x1c')](','));break;case _0x4923('0x27'):var _0x3c92bd=_0xf2b888[_0x4923('0x20')][_0x4923('0x21')](',');_0x522753[_0x4923('0x23')](_0x3c92bd[0x0]);_0x522753[_0x4923('0x23')](_0x3c92bd[0x1]);_0x522753['push'](_0x3c92bd[0x2]);_0x522753['push'](_0x3c92bd[0x3]);_0x522753[_0x4923('0x23')](_0x3c92bd['slice'](0x4,_0x3c92bd['length'])['join'](','));break;case _0x4923('0x17'):_0x522753[_0x4923('0x23')](_0xf2b888[_0x4923('0x20')]);break;case _0x4923('0x28'):_0x522753['push'](_0xf2b888[_0x4923('0x29')]);_0x522753['push'](_0xf2b888[_0x4923('0x20')]);break;case _0x4923('0x2a'):var _0x368d50=utils[_0x4923('0x2b')](_0x29a354[_0x4923('0x2c')]['notificationTemplate'],_0x29a354);var _0x43ed8e=_0xf2b888['appdata']['split'](',');_0x522753[_0x4923('0x23')](_0x43ed8e[0x0]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x1]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x2]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x3]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x4]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x5]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x6]);_0x522753['push'](_0x43ed8e[0x7]);_0x522753[_0x4923('0x23')](_0x43ed8e[0x8]);_0x522753['push'](_0x43ed8e[0x9]);_0x522753['push'](_0x43ed8e[0xa]);_0x522753[_0x4923('0x23')](_0x29a354[_0x4923('0x18')]['id']);_0x522753['push'](_0x29a354[_0x4923('0x17')]['id']);_0x522753[_0x4923('0x23')](_0xf2b888['ChatWebsiteId']);_0x522753['push'](_0x29a354[_0x4923('0x18')][_0x4923('0x2d')]);_0x522753['push'](_0x29a354['body'][_0x4923('0x2e')]);_0x522753[_0x4923('0x23')](_0x368d50);break;default:_0x522753=_[_0x4923('0x10')](_0xf2b888[_0x4923('0x20')])?[]:_0xf2b888[_0x4923('0x20')]['split'](',');}var _0x2a02e0={'id':util[_0x4923('0xe')]('%s:%s:%s',_0x559e4a,_0xf2b888['id'],_0xf2b888[_0x4923('0x1e')]),'condition':require('./interval')[_0x4923('0x2f')](_0x559e4a,getIntervals(_0x31a469[_0x4923('0x30')],_0xf2b888),_0x31a469),'consequence':require('./applications/'+_0xf2b888[_0x4923('0x1e')])[_0x4923('0x31')](_0x559e4a,_0x522753,_0x31a469,_0x29a354),'p':_0xf2b888[_0x4923('0x32')]||0x0};logger[_0x4923('0x33')](_0x4923('0x34'),_0x2a02e0['id'],_0x4923('0x35'),getIntervals(_0x31a469['intervals'],_0xf2b888)[_0x4923('0x1c')](_0x4923('0x36')));_0x3fedc7['push'](_0x2a02e0);}else{logger[_0x4923('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x4923('0x1c')](__dirname,_0x4923('0x1a'),_0xf2b888[_0x4923('0x1e')]+_0x4923('0x1d')));}}_0x31a469[_0x4923('0x15')][_0x559e4a]=new RuleEngine(_0x3fedc7);_0x31a469[_0x4923('0x15')][_0x559e4a][_0x4923('0x38')](_0x29a354,function(_0x1de781){logger['info'](_0x4923('0x39'),JSON[_0x4923('0x3a')](_0x1de781[_0x4923('0x3b')]));if(_0x31a469[_0x4923('0x15')][_0x559e4a]){_0x31a469[_0x4923('0x15')][_0x559e4a][_0x4923('0x3c')](_0x4923('0x3d'));}});return _0x2897da({'code':0xc8,'message':_0x29a354});}else{logger[_0x4923('0x33')](_0x4923('0x3e'));return _0x2897da({'code':0xc8,'message':_0x29a354});}}catch(_0x567145){logger[_0x4923('0x37')](_0x567145[_0x4923('0x3f')]);return _0x2e9944(_0x1f8375['error'](0x1f4,_0x567145));}}return _0x2e9944(_0x4923('0x40'));});},'AcceptMessage':function(_0x234698){var _0x456fd7=this;return new Promise(function(_0xf092a1,_0x168eb2){if(_0x234698[_0x4923('0x41')]&&_0x234698[_0x4923('0x41')]['id']){if(_0x31a469[_0x4923('0x42')][_0x234698[_0x4923('0x41')]['id']]){_0x31a469['agents'][_0x234698['agent']['id']]['busy']=![];_0x31a469[_0x4923('0x42')][_0x234698['agent']['id']][_0x4923('0x43')]=undefined;}}if(_0x234698['message']&&_0x234698[_0x4923('0x17')]['id']){try{var _0x2be636=getId(_0x234698[_0x4923('0x16')],_0x234698[_0x4923('0x17')]?_0x234698[_0x4923('0x17')]['id']:0x0,_0x234698[_0x4923('0x18')]?_0x234698[_0x4923('0x18')]['id']:0x0);if(_0x31a469[_0x4923('0x15')][_0x2be636]){_0x31a469['rules'][_0x2be636][_0x4923('0x3c')](_0x4923('0x44'));if(rpc[_0x234698[_0x4923('0x16')]+_0x4923('0x45')]){rpc[_0x234698[_0x4923('0x16')]+_0x4923('0x45')][_0x4923('0x46')](_0x2be636,{'UserId':_0x234698[_0x4923('0x17')]['UserId']})[_0x4923('0x47')](function(_0x282201){logger[_0x4923('0x37')](_0x4923('0x48'));});}}return _0xf092a1({'code':0xc8,'message':_0x234698});}catch(_0x5a092d){logger[_0x4923('0x37')](_0x5a092d[_0x4923('0x3f')]);return _0x168eb2(_0x456fd7[_0x4923('0x37')](0x1f4,_0x5a092d));}}logger[_0x4923('0x37')](_0x4923('0x49'));return _0x168eb2(_0x456fd7[_0x4923('0x37')](0x1f4,_0x4923('0x49')));});},'RejectMessage':function(_0x562e38){var _0x4527da=this;return new Promise(function(_0x48c2d4,_0x4b73a6){if(_0x562e38[_0x4923('0x41')]&&_0x562e38[_0x4923('0x41')]['id']){try{if(_0x31a469[_0x4923('0x42')][_0x562e38['agent']['id']]){_0x31a469[_0x4923('0x42')][_0x562e38['agent']['id']][_0x4923('0x4a')]=![];_0x31a469['agents'][_0x562e38[_0x4923('0x41')]['id']][_0x4923('0x43')]=undefined;}return _0x48c2d4({'code':0xc8,'message':_0x562e38});}catch(_0x453663){logger[_0x4923('0x37')](_0x453663[_0x4923('0x3f')]);return _0x4b73a6(_0x4527da['error'](0x1f4,_0x453663));}}logger[_0x4923('0x37')](_0x4923('0x49'));return _0x4b73a6(_0x4527da[_0x4923('0x37')](0x1f4,_0x4923('0x49')));});},'AbandonInteraction':function(_0x31546b){var _0xff2e1d=this;return new Promise(function(_0x53eaa9,_0x392bb2){if(_0x31546b[_0x4923('0x16')]&&_0x31546b[_0x4923('0x18')]&&_0x31546b[_0x4923('0x18')]['id']){try{var _0x125421=getId(_0x31546b[_0x4923('0x16')],_0x31546b[_0x4923('0x17')]?_0x31546b['message']['id']:0x0,_0x31546b[_0x4923('0x18')]?_0x31546b[_0x4923('0x18')]['id']:0x0);if(_0x31a469[_0x4923('0x15')][_0x125421]){_0x31a469[_0x4923('0x15')][_0x125421][_0x4923('0x3c')](_0x4923('0x44'));}return _0x53eaa9({'code':0xc8,'message':_0x31546b});}catch(_0x338613){logger['error'](_0x338613[_0x4923('0x3f')]);return _0x392bb2(_0xff2e1d[_0x4923('0x37')](0x1f4,_0x338613));}}logger[_0x4923('0x37')]('message\x20is\x20empty');return _0x392bb2(_0xff2e1d[_0x4923('0x37')](0x1f4,_0x4923('0x49')));});},'AgentCapacity':function(_0x4a34aa){var _0x50efb9=this;return new Promise(function(_0x219de2,_0x3d9df9){if(_0x31a469[_0x4923('0x42')][_0x4923('0x4b')](_0x4a34aa['id'])){for(var _0x3bdf88 in _0x4a34aa[_0x4923('0x4c')]){if(_0x4a34aa[_0x4923('0x4c')][_0x4923('0x4b')](_0x3bdf88)){if(_0x31a469['agents'][_0x4a34aa['id']][_0x4923('0x4b')](_0x3bdf88+_0x4923('0x4d'))){_0x31a469[_0x4923('0x42')][_0x4a34aa['id']][_0x3bdf88+_0x4923('0x4d')]=parseInt(_0x4a34aa[_0x4923('0x4c')][_0x3bdf88],0xa);}}}_0x31a469['agents'][_0x4a34aa['id']][_0x4923('0x4e')]();return _0x219de2({'code':0xc8,'message':_0x31a469[_0x4923('0x42')][_0x4a34aa['id']]});}else{return _0x3d9df9(_0x50efb9[_0x4923('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5e348e){return new Promise(function(_0x36b0a2,_0x8b70ca){var _0x5be67b=_['values'](_0x31a469[_0x4923('0x42')]);_0x36b0a2({'count':_0x5be67b[_0x4923('0x1b')],'rows':_0x5be67b});});},'ChatQueues':function(_0x2a988f){return new Promise(function(_0x478fc3,_0x2ed5cb){var _0x2c5f79=[];for(var _0x52e228 in _0x31a469['chatQueues']){if(_0x31a469['chatQueues'][_0x4923('0x4b')](_0x52e228)){var _0x520df2=_0x31a469[_0x4923('0x4f')][_0x52e228];var _0xbfea42={'id':_0x520df2['id'],'available':_0x520df2[_0x4923('0x50')],'loggedIn':_0x520df2[_0x4923('0x51')],'name':_0x520df2[_0x4923('0x52')],'paused':_0x520df2[_0x4923('0x53')],'waiting':_0x520df2[_0x4923('0x54')]};_0x2c5f79['push'](_0xbfea42);}}_0x478fc3({'count':_0x2c5f79[_0x4923('0x1b')],'rows':_0x2c5f79});});},'MailQueues':function(_0x3fd57a){return new Promise(function(_0xc535d2,_0x497e63){var _0x2cd38f=[];for(var _0x31f23c in _0x31a469['mailQueues']){if(_0x31a469[_0x4923('0x55')][_0x4923('0x4b')](_0x31f23c)){var _0x4acbe6=_0x31a469[_0x4923('0x55')][_0x31f23c];var _0x535742={'id':_0x4acbe6['id'],'available':_0x4acbe6[_0x4923('0x50')],'loggedIn':_0x4acbe6['loggedIn'],'name':_0x4acbe6[_0x4923('0x52')],'paused':_0x4acbe6[_0x4923('0x53')],'waiting':_0x4acbe6['waiting']};_0x2cd38f[_0x4923('0x23')](_0x535742);}}_0xc535d2({'count':_0x2cd38f['length'],'rows':_0x2cd38f});});},'OpenchannelQueues':function(_0x324c7d){return new Promise(function(_0x352d13,_0x476679){var _0x536bb8=[];for(var _0x49e04a in _0x31a469[_0x4923('0x56')]){if(_0x31a469['openchannelQueues']['hasOwnProperty'](_0x49e04a)){var _0x4fd53d=_0x31a469[_0x4923('0x56')][_0x49e04a];var _0x172279={'id':_0x4fd53d['id'],'available':_0x4fd53d[_0x4923('0x50')],'loggedIn':_0x4fd53d[_0x4923('0x51')],'name':_0x4fd53d['name'],'paused':_0x4fd53d['paused'],'waiting':_0x4fd53d['waiting']};_0x536bb8['push'](_0x172279);}}_0x352d13({'count':_0x536bb8[_0x4923('0x1b')],'rows':_0x536bb8});});},'SmsQueues':function(_0x4b075f){return new Promise(function(_0x573024,_0x6ef528){var _0x5f5c1e=[];for(var _0x50b700 in _0x31a469[_0x4923('0x57')]){if(_0x31a469[_0x4923('0x57')][_0x4923('0x4b')](_0x50b700)){var _0x2f2215=_0x31a469[_0x4923('0x57')][_0x50b700];var _0x291033={'id':_0x2f2215['id'],'available':_0x2f2215[_0x4923('0x50')],'loggedIn':_0x2f2215[_0x4923('0x51')],'name':_0x2f2215[_0x4923('0x52')],'paused':_0x2f2215[_0x4923('0x53')],'waiting':_0x2f2215[_0x4923('0x54')]};_0x5f5c1e[_0x4923('0x23')](_0x291033);}}_0x573024({'count':_0x5f5c1e[_0x4923('0x1b')],'rows':_0x5f5c1e});});},'FaxQueues':function(_0x145ffd){return new Promise(function(_0x270907,_0x437b8a){var _0x108f28=[];for(var _0x48a205 in _0x31a469['faxQueues']){if(_0x31a469[_0x4923('0x58')][_0x4923('0x4b')](_0x48a205)){var _0x10e65c=_0x31a469[_0x4923('0x58')][_0x48a205];var _0x13e0f9={'id':_0x10e65c['id'],'available':_0x10e65c[_0x4923('0x50')],'loggedIn':_0x10e65c[_0x4923('0x51')],'name':_0x10e65c[_0x4923('0x52')],'paused':_0x10e65c['paused'],'waiting':_0x10e65c[_0x4923('0x54')]};_0x108f28[_0x4923('0x23')](_0x13e0f9);}}_0x270907({'count':_0x108f28[_0x4923('0x1b')],'rows':_0x108f28});});},'WhatsappQueues':function(_0x1ab966){return new Promise(function(_0x39cfda,_0x554e8d){var _0x4d111f=[];for(var _0x36daf5 in _0x31a469[_0x4923('0x59')]){if(_0x31a469[_0x4923('0x59')][_0x4923('0x4b')](_0x36daf5)){var _0x46c296=_0x31a469['whatsappQueues'][_0x36daf5];var _0x373fa3={'id':_0x46c296['id'],'available':_0x46c296[_0x4923('0x50')],'loggedIn':_0x46c296[_0x4923('0x51')],'name':_0x46c296[_0x4923('0x52')],'paused':_0x46c296[_0x4923('0x53')],'waiting':_0x46c296[_0x4923('0x54')]};_0x4d111f[_0x4923('0x23')](_0x373fa3);}}_0x39cfda({'count':_0x4d111f[_0x4923('0x1b')],'rows':_0x4d111f});});},'ChatQueuesWaitingInteractions':function(_0xf734f5){return new Promise(function(_0x2a48bf,_0x12901d){var _0x2656b4=_[_0x4923('0x5a')](_0x31a469[_0x4923('0x5b')]);_0x2a48bf({'count':_0x2656b4[_0x4923('0x1b')],'rows':_0x2656b4});});},'MailQueuesWaitingInteractions':function(_0x26a845){return new Promise(function(_0x3f5764,_0x3bef9c){var _0x41c526=_[_0x4923('0x5a')](_0x31a469[_0x4923('0x5c')]);_0x3f5764({'count':_0x41c526['length'],'rows':_0x41c526});});},'OpenchannelQueuesWaitingInteractions':function(_0x34a642){return new Promise(function(_0x1fe7fc,_0x1a0692){var _0x2a6dab=_[_0x4923('0x5a')](_0x31a469[_0x4923('0x5d')]);_0x1fe7fc({'count':_0x2a6dab['length'],'rows':_0x2a6dab});});},'SmsQueuesWaitingInteractions':function(_0x4b4f4f){return new Promise(function(_0x497dcc,_0x2b4eb3){var _0x2deee8=_[_0x4923('0x5a')](_0x31a469['smsQueuesWaitingInteractions']);_0x497dcc({'count':_0x2deee8['length'],'rows':_0x2deee8});});},'FaxQueuesWaitingInteractions':function(_0x36f439){return new Promise(function(_0xff026,_0xe5012b){var _0x145a7d=_[_0x4923('0x5a')](_0x31a469[_0x4923('0x5e')]);_0xff026({'count':_0x145a7d[_0x4923('0x1b')],'rows':_0x145a7d});});},'WhatsappQueuesWaitingInteractions':function(_0xeb33){return new Promise(function(_0x485d71,_0x21265c){var _0x3db2bf=_['values'](_0x31a469[_0x4923('0x5f')]);_0x485d71({'count':_0x3db2bf['length'],'rows':_0x3db2bf});});}};var _0x4fc39a=jayson['server'](_0x27dbb2)[_0x4923('0x60')]();_0x4fc39a['on'](_0x4923('0x37'),function(_0x160c90){logger['error'](JSON['stringify'](_0x160c90));return _0x1716aa(_0x160c90);});_0x4fc39a[_0x4923('0x61')](0x232c,'127.0.0.1',function(){console[_0x4923('0x62')](_0x4923('0x63'),0x232c);return _0x191257(_0x4923('0x64')+0x232c);});});}; \ No newline at end of file +var _0xb9a7=['split','channel','mail','push','slice','join','dialogflowv2','appdata','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','isNil','format','%s:%s:%s','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','error','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','.js','app','autoreply'];(function(_0x4c69c7,_0x2f4850){var _0x20d218=function(_0x113ff0){while(--_0x113ff0){_0x4c69c7['push'](_0x4c69c7['shift']());}};_0x20d218(++_0x2f4850);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb9a7[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x7b9a('0x1'));var utils=require('./applications/utils');var config=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var rpc={'openchannelQueueReport':require(_0x7b9a('0x5')),'mailQueueReport':require(_0x7b9a('0x6')),'chatQueueReport':require(_0x7b9a('0x7')),'smsQueueReport':require(_0x7b9a('0x8')),'faxQueueReport':require(_0x7b9a('0x9')),'whatsappQueueReport':require(_0x7b9a('0xa'))};var RuleEngine=require(_0x7b9a('0xb'));function getId(_0x4d3f20,_0x43d8e2,_0x3e84f1){return util['format']('%s.%s.%s',_0x4d3f20,_0x43d8e2||0x0,_0x3e84f1||0x0);}function getIntervals(_0x47e220,_0x15bc5b){var _0x31f3b7=[];if(!_['isNil'](_0x15bc5b[_0x7b9a('0xc')])&&!_['isNil'](_0x47e220[_0x15bc5b[_0x7b9a('0xc')]])&&!_['isNil'](_0x47e220[_0x15bc5b[_0x7b9a('0xc')]][_0x7b9a('0xd')])){_0x31f3b7=_[_0x7b9a('0xe')](_0x47e220[_0x15bc5b['IntervalId']][_0x7b9a('0xd')],_0x7b9a('0xf'));}else if(!_['isNil'](_0x15bc5b[_0x7b9a('0xf')])){_0x31f3b7=[_0x15bc5b[_0x7b9a('0xf')]];}return _0x31f3b7;}exports['listen']=function(_0xb157e5){_0xb157e5[_0x7b9a('0x10')]={};return new BPromise(function(_0x6fa16a,_0x2853f2){var _0x344fa7={'Start':function(_0x346daa){var _0x22a7e4=this;return new Promise(function(_0x35e602,_0x2f1899){if(_0x346daa){try{var _0x4996f1=[];var _0x34a82d=getId(_0x346daa['channel'],_0x346daa[_0x7b9a('0x11')]?_0x346daa[_0x7b9a('0x11')]['id']:0x0,_0x346daa[_0x7b9a('0x12')]?_0x346daa[_0x7b9a('0x12')]['id']:0x0);if(_0x346daa[_0x7b9a('0x13')]&&_[_0x7b9a('0x14')](_0x346daa[_0x7b9a('0x13')])&&_0x346daa[_0x7b9a('0x13')][_0x7b9a('0x15')]){for(var _0x588c48=0x0;_0x588c48<_0x346daa[_0x7b9a('0x13')][_0x7b9a('0x15')];_0x588c48+=0x1){var _0x3e65fa=_0x346daa['applications'][_0x588c48];if(fs[_0x7b9a('0x16')](path['join'](__dirname,_0x7b9a('0x13'),_0x3e65fa['app']+_0x7b9a('0x17')))){var _0x331ae6=[];switch(_0x3e65fa[_0x7b9a('0x18')]['toLowerCase']()){case _0x7b9a('0x19'):var _0x7f8972=_0x3e65fa['appdata'][_0x7b9a('0x1a')](',');if(_0x346daa[_0x7b9a('0x1b')]===_0x7b9a('0x1c')){_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x0]);_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x1]);_0x331ae6['push'](_0x7f8972[_0x7b9a('0x1e')](0x2,_0x7f8972[_0x7b9a('0x15')])['join'](','));}else{_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x0]);_0x331ae6['push'](_0x7f8972[_0x7b9a('0x1e')](0x1,_0x7f8972[_0x7b9a('0x15')])['join'](','));}break;case'dialogflow':var _0x24d886=_0x3e65fa['appdata']['split'](',');_0x331ae6[_0x7b9a('0x1d')](_0x24d886[0x0]);_0x331ae6['push'](_0x24d886[0x1]);_0x331ae6['push'](_0x24d886[_0x7b9a('0x1e')](0x2,_0x24d886['length'])[_0x7b9a('0x1f')](','));break;case _0x7b9a('0x20'):var _0x4fee38=_0x3e65fa[_0x7b9a('0x21')][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x0]);_0x331ae6['push'](_0x4fee38[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x3]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[_0x7b9a('0x1e')](0x4,_0x4fee38[_0x7b9a('0x15')])[_0x7b9a('0x1f')](','));break;case'amazonlex':var _0x4aa495=_0x3e65fa[_0x7b9a('0x21')][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x0]);_0x331ae6['push'](_0x4aa495[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x3]);_0x331ae6['push'](_0x4aa495['slice'](0x4,_0x4aa495[_0x7b9a('0x15')])[_0x7b9a('0x1f')](','));break;case'message':_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x21')]);break;case _0x7b9a('0x22'):_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x23')]);_0x331ae6['push'](_0x3e65fa[_0x7b9a('0x21')]);break;case _0x7b9a('0x24'):var _0x14c227=utils[_0x7b9a('0x25')](_0x346daa[_0x7b9a('0x26')][_0x7b9a('0x27')],_0x346daa);var _0x5f1da4=_0x3e65fa['appdata'][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x0]);_0x331ae6['push'](_0x5f1da4[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x3]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x4]);_0x331ae6['push'](_0x5f1da4[0x5]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x6]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x7]);_0x331ae6['push'](_0x5f1da4[0x8]);_0x331ae6['push'](_0x5f1da4[0x9]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0xa]);_0x331ae6[_0x7b9a('0x1d')](_0x346daa[_0x7b9a('0x12')]['id']);_0x331ae6[_0x7b9a('0x1d')](_0x346daa[_0x7b9a('0x11')]['id']);_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x28')]);_0x331ae6[_0x7b9a('0x1d')](_0x346daa['interaction'][_0x7b9a('0x29')]);_0x331ae6['push'](_0x346daa[_0x7b9a('0x2a')][_0x7b9a('0x2a')]);_0x331ae6[_0x7b9a('0x1d')](_0x14c227);break;default:_0x331ae6=_[_0x7b9a('0x2b')](_0x3e65fa[_0x7b9a('0x21')])?[]:_0x3e65fa[_0x7b9a('0x21')]['split'](',');}var _0x34eebe={'id':util[_0x7b9a('0x2c')](_0x7b9a('0x2d'),_0x34a82d,_0x3e65fa['id'],_0x3e65fa[_0x7b9a('0x18')]),'condition':require('./interval')[_0x7b9a('0x2e')](_0x34a82d,getIntervals(_0xb157e5[_0x7b9a('0x2f')],_0x3e65fa),_0xb157e5),'consequence':require(_0x7b9a('0x30')+_0x3e65fa[_0x7b9a('0x18')])['consequence'](_0x34a82d,_0x331ae6,_0xb157e5,_0x346daa),'p':_0x3e65fa[_0x7b9a('0x31')]||0x0};logger['info'](_0x7b9a('0x32'),_0x34eebe['id'],_0x7b9a('0x33'),getIntervals(_0xb157e5[_0x7b9a('0x2f')],_0x3e65fa)[_0x7b9a('0x1f')](_0x7b9a('0x34')));_0x4996f1[_0x7b9a('0x1d')](_0x34eebe);}else{logger['error'](_0x7b9a('0x35'),path[_0x7b9a('0x1f')](__dirname,_0x7b9a('0x13'),_0x3e65fa['app']+'.js'));}}_0xb157e5[_0x7b9a('0x10')][_0x34a82d]=new RuleEngine(_0x4996f1);_0xb157e5[_0x7b9a('0x10')][_0x34a82d][_0x7b9a('0x36')](_0x346daa,function(_0x5cd3dd){logger[_0x7b9a('0x37')](_0x7b9a('0x38'),JSON['stringify'](_0x5cd3dd['matchPath']));if(_0xb157e5['rules'][_0x34a82d]){_0xb157e5[_0x7b9a('0x10')][_0x34a82d][_0x7b9a('0x39')]('complete');}});return _0x35e602({'code':0xc8,'message':_0x346daa});}else{logger[_0x7b9a('0x37')](_0x7b9a('0x3a'));return _0x35e602({'code':0xc8,'message':_0x346daa});}}catch(_0x3e6549){logger['error'](_0x3e6549[_0x7b9a('0x3b')]);return _0x2f1899(_0x22a7e4['error'](0x1f4,_0x3e6549));}}return _0x2f1899(_0x7b9a('0x3c'));});},'AcceptMessage':function(_0x102d0c){var _0x365643=this;return new Promise(function(_0xeaa48c,_0x349bb8){if(_0x102d0c['agent']&&_0x102d0c[_0x7b9a('0x3d')]['id']){if(_0xb157e5['agents'][_0x102d0c[_0x7b9a('0x3d')]['id']]){_0xb157e5['agents'][_0x102d0c['agent']['id']][_0x7b9a('0x3e')]=![];_0xb157e5[_0x7b9a('0x3f')][_0x102d0c[_0x7b9a('0x3d')]['id']][_0x7b9a('0x40')]=undefined;}}if(_0x102d0c[_0x7b9a('0x11')]&&_0x102d0c[_0x7b9a('0x11')]['id']){try{var _0xd38628=getId(_0x102d0c[_0x7b9a('0x1b')],_0x102d0c[_0x7b9a('0x11')]?_0x102d0c['message']['id']:0x0,_0x102d0c[_0x7b9a('0x12')]?_0x102d0c[_0x7b9a('0x12')]['id']:0x0);if(_0xb157e5['rules'][_0xd38628]){_0xb157e5['rules'][_0xd38628]['emit'](_0x7b9a('0x41'));if(rpc[_0x102d0c[_0x7b9a('0x1b')]+_0x7b9a('0x42')]){rpc[_0x102d0c[_0x7b9a('0x1b')]+'QueueReport'][_0x7b9a('0x43')](_0xd38628,{'UserId':_0x102d0c[_0x7b9a('0x11')][_0x7b9a('0x44')]})[_0x7b9a('0x45')](function(_0x2d083b){logger['error'](_0x7b9a('0x46'));});}}return _0xeaa48c({'code':0xc8,'message':_0x102d0c});}catch(_0x54eb5f){logger[_0x7b9a('0x47')](_0x54eb5f[_0x7b9a('0x3b')]);return _0x349bb8(_0x365643[_0x7b9a('0x47')](0x1f4,_0x54eb5f));}}logger[_0x7b9a('0x47')]('message\x20is\x20empty');return _0x349bb8(_0x365643[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'RejectMessage':function(_0x354a87){var _0x28855a=this;return new Promise(function(_0x2b0db5,_0x3e2f1b){if(_0x354a87[_0x7b9a('0x3d')]&&_0x354a87['agent']['id']){try{if(_0xb157e5['agents'][_0x354a87['agent']['id']]){_0xb157e5[_0x7b9a('0x3f')][_0x354a87[_0x7b9a('0x3d')]['id']]['busy']=![];_0xb157e5['agents'][_0x354a87['agent']['id']]['busyQueue']=undefined;}return _0x2b0db5({'code':0xc8,'message':_0x354a87});}catch(_0x7c800f){logger[_0x7b9a('0x47')](_0x7c800f[_0x7b9a('0x3b')]);return _0x3e2f1b(_0x28855a[_0x7b9a('0x47')](0x1f4,_0x7c800f));}}logger[_0x7b9a('0x47')](_0x7b9a('0x48'));return _0x3e2f1b(_0x28855a[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'AbandonInteraction':function(_0x5dc17e){var _0x1f99f5=this;return new Promise(function(_0x5d499f,_0x23a0cb){if(_0x5dc17e[_0x7b9a('0x1b')]&&_0x5dc17e[_0x7b9a('0x12')]&&_0x5dc17e[_0x7b9a('0x12')]['id']){try{var _0x19e6e9=getId(_0x5dc17e['channel'],_0x5dc17e[_0x7b9a('0x11')]?_0x5dc17e['message']['id']:0x0,_0x5dc17e[_0x7b9a('0x12')]?_0x5dc17e[_0x7b9a('0x12')]['id']:0x0);if(_0xb157e5[_0x7b9a('0x10')][_0x19e6e9]){_0xb157e5['rules'][_0x19e6e9]['emit']('end');}return _0x5d499f({'code':0xc8,'message':_0x5dc17e});}catch(_0x4f6843){logger[_0x7b9a('0x47')](_0x4f6843[_0x7b9a('0x3b')]);return _0x23a0cb(_0x1f99f5[_0x7b9a('0x47')](0x1f4,_0x4f6843));}}logger['error'](_0x7b9a('0x48'));return _0x23a0cb(_0x1f99f5[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'AgentCapacity':function(_0x3c70bf){var _0xea7b37=this;return new Promise(function(_0x4c3939,_0x8bd047){if(_0xb157e5[_0x7b9a('0x3f')][_0x7b9a('0x49')](_0x3c70bf['id'])){for(var _0x4fe869 in _0x3c70bf['capacity']){if(_0x3c70bf['capacity'][_0x7b9a('0x49')](_0x4fe869)){if(_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']][_0x7b9a('0x49')](_0x4fe869+'CurrentCapacity')){_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']][_0x4fe869+_0x7b9a('0x4a')]=parseInt(_0x3c70bf['capacity'][_0x4fe869],0xa);}}}_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']]['updateRealtime']();return _0x4c3939({'code':0xc8,'message':_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']]});}else{return _0x8bd047(_0xea7b37['error'](0x1f4,_0x7b9a('0x4b')));}});},'Agents':function(_0xfa4a89){return new Promise(function(_0x302f71,_0x4121d5){var _0x5d45ae=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x3f')]);_0x302f71({'count':_0x5d45ae[_0x7b9a('0x15')],'rows':_0x5d45ae});});},'ChatQueues':function(_0x273134){return new Promise(function(_0x567328,_0x239b62){var _0x551362=[];for(var _0x3ab2cb in _0xb157e5['chatQueues']){if(_0xb157e5[_0x7b9a('0x4d')]['hasOwnProperty'](_0x3ab2cb)){var _0x58fbd2=_0xb157e5['chatQueues'][_0x3ab2cb];var _0x48442a={'id':_0x58fbd2['id'],'available':_0x58fbd2[_0x7b9a('0x4e')],'loggedIn':_0x58fbd2[_0x7b9a('0x4f')],'name':_0x58fbd2[_0x7b9a('0x50')],'paused':_0x58fbd2[_0x7b9a('0x51')],'waiting':_0x58fbd2['waiting']};_0x551362[_0x7b9a('0x1d')](_0x48442a);}}_0x567328({'count':_0x551362['length'],'rows':_0x551362});});},'MailQueues':function(_0x50b6f1){return new Promise(function(_0x15679c,_0x564e51){var _0x54066a=[];for(var _0x7ad607 in _0xb157e5[_0x7b9a('0x52')]){if(_0xb157e5['mailQueues'][_0x7b9a('0x49')](_0x7ad607)){var _0x4a441c=_0xb157e5[_0x7b9a('0x52')][_0x7ad607];var _0x23ffd0={'id':_0x4a441c['id'],'available':_0x4a441c[_0x7b9a('0x4e')],'loggedIn':_0x4a441c['loggedIn'],'name':_0x4a441c['name'],'paused':_0x4a441c['paused'],'waiting':_0x4a441c['waiting']};_0x54066a[_0x7b9a('0x1d')](_0x23ffd0);}}_0x15679c({'count':_0x54066a[_0x7b9a('0x15')],'rows':_0x54066a});});},'OpenchannelQueues':function(_0x3fd697){return new Promise(function(_0x2092b6,_0x261a43){var _0x147d23=[];for(var _0x45014b in _0xb157e5['openchannelQueues']){if(_0xb157e5[_0x7b9a('0x53')][_0x7b9a('0x49')](_0x45014b)){var _0x4f312a=_0xb157e5[_0x7b9a('0x53')][_0x45014b];var _0x3f01dc={'id':_0x4f312a['id'],'available':_0x4f312a[_0x7b9a('0x4e')],'loggedIn':_0x4f312a['loggedIn'],'name':_0x4f312a['name'],'paused':_0x4f312a[_0x7b9a('0x51')],'waiting':_0x4f312a[_0x7b9a('0x54')]};_0x147d23['push'](_0x3f01dc);}}_0x2092b6({'count':_0x147d23[_0x7b9a('0x15')],'rows':_0x147d23});});},'SmsQueues':function(_0x5ab25f){return new Promise(function(_0x46aa05,_0xbbb057){var _0x3a46e9=[];for(var _0x59d4fa in _0xb157e5[_0x7b9a('0x55')]){if(_0xb157e5[_0x7b9a('0x55')][_0x7b9a('0x49')](_0x59d4fa)){var _0xe229ed=_0xb157e5[_0x7b9a('0x55')][_0x59d4fa];var _0x575c9e={'id':_0xe229ed['id'],'available':_0xe229ed['available'],'loggedIn':_0xe229ed[_0x7b9a('0x4f')],'name':_0xe229ed[_0x7b9a('0x50')],'paused':_0xe229ed['paused'],'waiting':_0xe229ed[_0x7b9a('0x54')]};_0x3a46e9[_0x7b9a('0x1d')](_0x575c9e);}}_0x46aa05({'count':_0x3a46e9[_0x7b9a('0x15')],'rows':_0x3a46e9});});},'FaxQueues':function(_0x5b02a6){return new Promise(function(_0x4af252,_0x17a29){var _0x13cea6=[];for(var _0x38b0da in _0xb157e5[_0x7b9a('0x56')]){if(_0xb157e5['faxQueues'][_0x7b9a('0x49')](_0x38b0da)){var _0x276da1=_0xb157e5[_0x7b9a('0x56')][_0x38b0da];var _0x4fdc1a={'id':_0x276da1['id'],'available':_0x276da1['available'],'loggedIn':_0x276da1[_0x7b9a('0x4f')],'name':_0x276da1[_0x7b9a('0x50')],'paused':_0x276da1[_0x7b9a('0x51')],'waiting':_0x276da1[_0x7b9a('0x54')]};_0x13cea6['push'](_0x4fdc1a);}}_0x4af252({'count':_0x13cea6[_0x7b9a('0x15')],'rows':_0x13cea6});});},'WhatsappQueues':function(_0x300a44){return new Promise(function(_0x52cc35,_0x26ea95){var _0x1ae9c5=[];for(var _0x471b37 in _0xb157e5[_0x7b9a('0x57')]){if(_0xb157e5[_0x7b9a('0x57')][_0x7b9a('0x49')](_0x471b37)){var _0xc408dd=_0xb157e5[_0x7b9a('0x57')][_0x471b37];var _0x449c2e={'id':_0xc408dd['id'],'available':_0xc408dd[_0x7b9a('0x4e')],'loggedIn':_0xc408dd[_0x7b9a('0x4f')],'name':_0xc408dd['name'],'paused':_0xc408dd['paused'],'waiting':_0xc408dd[_0x7b9a('0x54')]};_0x1ae9c5[_0x7b9a('0x1d')](_0x449c2e);}}_0x52cc35({'count':_0x1ae9c5['length'],'rows':_0x1ae9c5});});},'ChatQueuesWaitingInteractions':function(_0x2c0819){return new Promise(function(_0xa76006,_0x52f55c){var _0xff5477=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x58')]);_0xa76006({'count':_0xff5477[_0x7b9a('0x15')],'rows':_0xff5477});});},'MailQueuesWaitingInteractions':function(_0x449836){return new Promise(function(_0x327a74,_0x432405){var _0x237399=_[_0x7b9a('0x4c')](_0xb157e5['mailQueuesWaitingInteractions']);_0x327a74({'count':_0x237399[_0x7b9a('0x15')],'rows':_0x237399});});},'OpenchannelQueuesWaitingInteractions':function(_0x141340){return new Promise(function(_0x6d2d50,_0x3321b6){var _0x3d928e=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x59')]);_0x6d2d50({'count':_0x3d928e[_0x7b9a('0x15')],'rows':_0x3d928e});});},'SmsQueuesWaitingInteractions':function(_0x5d522b){return new Promise(function(_0x6937b9,_0x217ae5){var _0x3022e0=_['values'](_0xb157e5[_0x7b9a('0x5a')]);_0x6937b9({'count':_0x3022e0[_0x7b9a('0x15')],'rows':_0x3022e0});});},'FaxQueuesWaitingInteractions':function(_0x1c077d){return new Promise(function(_0x43e57d,_0x6e01d1){var _0x14f27e=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x5b')]);_0x43e57d({'count':_0x14f27e['length'],'rows':_0x14f27e});});},'WhatsappQueuesWaitingInteractions':function(_0x5260ca){return new Promise(function(_0x178ebc,_0x220146){var _0x16e506=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x5c')]);_0x178ebc({'count':_0x16e506[_0x7b9a('0x15')],'rows':_0x16e506});});}};var _0x18c96f=jayson[_0x7b9a('0x5d')](_0x344fa7)[_0x7b9a('0x5e')]();_0x18c96f['on'](_0x7b9a('0x47'),function(_0x5b0ab3){logger[_0x7b9a('0x47')](JSON[_0x7b9a('0x5f')](_0x5b0ab3));return _0x2853f2(_0x5b0ab3);});_0x18c96f[_0x7b9a('0x60')](0x232c,'127.0.0.1',function(){console[_0x7b9a('0x61')](_0x7b9a('0x62'),0x232c);return _0x6fa16a(_0x7b9a('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 465a2b9..869dade 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 _0x35c8=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','Command','format','indexOf','true','catch','some','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20','stack','stop','util','bluebird','../../../config/logger','routing','client','http','request','then','error','message','condition'];(function(_0x45e319,_0x5ed433){var _0x2df073=function(_0x26a626){while(--_0x26a626){_0x45e319['push'](_0x45e319['shift']());}};_0x2df073(++_0x5ed433);}(_0x35c8,0xd5));var _0x835c=function(_0x1f1392,_0x2204b8){_0x1f1392=_0x1f1392-0x0;var _0x4f99f1=_0x35c8[_0x1f1392];return _0x4f99f1;};'use strict';var util=require(_0x835c('0x0'));var BPromise=require(_0x835c('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x835c('0x2'))(_0x835c('0x3'));var client=jayson[_0x835c('0x4')][_0x835c('0x5')]({'port':0x232a});function request(_0xdbd7ae,_0x2c9cfb){return new BPromise(function(_0x4de23b,_0x343655){return client[_0x835c('0x6')](_0xdbd7ae,_0x2c9cfb)[_0x835c('0x7')](function(_0x58b09f){if(_0x58b09f[_0x835c('0x8')]){return _0x343655(_0x58b09f[_0x835c('0x8')][_0x835c('0x9')]);}else{return _0x4de23b(_0x58b09f['result']);}})['catch'](function(_0x4a8165){return _0x343655(_0x4a8165);});});}exports[_0x835c('0xa')]=function(_0x543805,_0x407aa5,_0x82b489){return function(_0x4bfb64){if(_0x82b489[_0x835c('0xb')]&&!_0x82b489[_0x835c('0xb')][_0x543805]){logger[_0x835c('0xc')](_0x835c('0xd'),_0x543805);return _0x4bfb64['stop']();}var _0x3158a0=[];for(var _0x4788e6=0x0;_0x4788e6<_0x407aa5[_0x835c('0xe')];_0x4788e6+=0x1){_0x3158a0['push'](request(_0x835c('0xf'),{'command':util[_0x835c('0x10')]('iftime\x20%s',_0x407aa5[_0x4788e6])})['then'](function(_0x1d7811){return _0x1d7811&&_0x1d7811['message']&&_0x1d7811[_0x835c('0x9')][_0x835c('0x11')](_0x835c('0x12'))>=0x0?!![]:![];})[_0x835c('0x13')](function(_0x26054f){logger[_0x835c('0x8')]('[%s][INTERVAL]\x20%s',_0x543805,_0x407aa5[_0x4788e6]);}));}BPromise['all'](_0x3158a0)[_0x835c('0x7')](function(_0x54737d){var _0x30bc71=_[_0x835c('0x14')](_0x54737d);logger[_0x835c('0xc')](_0x835c('0x15'),_0x543805,_0x407aa5['join']('\x20|\x20'),_0x30bc71);_0x4bfb64[_0x835c('0x16')](_0x30bc71);})[_0x835c('0x13')](function(_0x32db27){console[_0x835c('0x17')](_0x32db27);logger['error'](_0x835c('0x15'),_0x543805,_0x407aa5[_0x835c('0x18')](_0x835c('0x19')),_0x32db27[_0x835c('0x1a')]);_0x4bfb64[_0x835c('0x1b')]();});};}; \ No newline at end of file +var _0x9666=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','routing','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','iftime\x20%s'];(function(_0x32f951,_0x6479d0){var _0x3fc9bc=function(_0x517e62){while(--_0x517e62){_0x32f951['push'](_0x32f951['shift']());}};_0x3fc9bc(++_0x6479d0);}(_0x9666,0x1ca));var _0x6966=function(_0x4a05ee,_0x471f25){_0x4a05ee=_0x4a05ee-0x0;var _0x5abd8b=_0x9666[_0x4a05ee];return _0x5abd8b;};'use strict';var util=require(_0x6966('0x0'));var BPromise=require(_0x6966('0x1'));var jayson=require(_0x6966('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x6966('0x3'));var client=jayson['client'][_0x6966('0x4')]({'port':0x232a});function request(_0x4bd6c8,_0x495279){return new BPromise(function(_0x298763,_0xe2b08){return client[_0x6966('0x5')](_0x4bd6c8,_0x495279)[_0x6966('0x6')](function(_0x46aeea){if(_0x46aeea[_0x6966('0x7')]){return _0xe2b08(_0x46aeea['error'][_0x6966('0x8')]);}else{return _0x298763(_0x46aeea[_0x6966('0x9')]);}})[_0x6966('0xa')](function(_0x1161cd){return _0xe2b08(_0x1161cd);});});}exports[_0x6966('0xb')]=function(_0x4915a2,_0x52bffb,_0x3f1461){return function(_0x1eecd8){if(_0x3f1461[_0x6966('0xc')]&&!_0x3f1461['rules'][_0x4915a2]){logger[_0x6966('0xd')](_0x6966('0xe'),_0x4915a2);return _0x1eecd8[_0x6966('0xf')]();}var _0x11e33d=[];for(var _0x66cbb8=0x0;_0x66cbb8<_0x52bffb[_0x6966('0x10')];_0x66cbb8+=0x1){_0x11e33d['push'](request('Command',{'command':util['format'](_0x6966('0x11'),_0x52bffb[_0x66cbb8])})[_0x6966('0x6')](function(_0x56467c){return _0x56467c&&_0x56467c[_0x6966('0x8')]&&_0x56467c[_0x6966('0x8')]['indexOf'](_0x6966('0x12'))>=0x0?!![]:![];})[_0x6966('0xa')](function(_0x297d5c){logger[_0x6966('0x7')](_0x6966('0x13'),_0x4915a2,_0x52bffb[_0x66cbb8]);}));}BPromise[_0x6966('0x14')](_0x11e33d)[_0x6966('0x6')](function(_0x13236f){var _0x51c1ed=_[_0x6966('0x15')](_0x13236f);logger['info'](_0x6966('0x16'),_0x4915a2,_0x52bffb['join'](_0x6966('0x17')),_0x51c1ed);_0x1eecd8[_0x6966('0x18')](_0x51c1ed);})[_0x6966('0xa')](function(_0x2e8615){console[_0x6966('0x19')](_0x2e8615);logger['error'](_0x6966('0x16'),_0x4915a2,_0x52bffb[_0x6966('0x1a')]('\x20|\x20'),_0x2e8615[_0x6966('0x1b')]);_0x1eecd8[_0x6966('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index ac7b50e..b08dbed 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 _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x84a0,0x66));var _0x084a=function(_0x5a3e48,_0xc6374){_0x5a3e48=_0x5a3e48-0x0;var _0x36bb87=_0x84a0[_0x5a3e48];return _0x36bb87;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file +var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent: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','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x310279,_0x23ea0a){var _0x1115cf=function(_0x153078){while(--_0x153078){_0x310279['push'](_0x310279['shift']());}};_0x1115cf(++_0x23ea0a);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 17a2fc5..fdb2533 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 _0x4317=['appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','gotoif','[%s][calls][newexten]','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','context','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x1f2655,_0x1ade0c){var _0x161d7d=function(_0x1aa34a){while(--_0x1aa34a){_0x1f2655['push'](_0x1f2655['shift']());}};_0x161d7d(++_0x1ade0c);}(_0x4317,0x7c));var _0x7431=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4317[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var utils=require(_0x7431('0x1'));var transfers=require(_0x7431('0x2'));var dispositions=['NO\x20ANSWER',_0x7431('0x3'),_0x7431('0x3'),_0x7431('0x4'),_0x7431('0x4'),_0x7431('0x4'),_0x7431('0x5'),'BUSY','FAILED',_0x7431('0x3'),_0x7431('0x3')];var channels={};function writeDB(_0x31fd44){var _0x328945;if(transfers[_0x7431('0x6')][_0x31fd44[_0x7431('0x7')]]){_0x328945=_0x31fd44[_0x7431('0x7')];_0x31fd44[_0x7431('0x7')]=transfers[_0x7431('0x6')][_0x31fd44[_0x7431('0x7')]][_0x7431('0x8')];}utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0xb'),_0x31fd44[_0x7431('0x7')],_0x31fd44[_0x7431('0xc')],_0x31fd44[_0x7431('0xd')],_0x31fd44[_0x7431('0xe')],_0x31fd44[_0x7431('0xf')],_0x31fd44[_0x7431('0x10')],_0x31fd44[_0x7431('0x11')],_0x31fd44[_0x7431('0x12')]));if(_0x31fd44[_0x7431('0x13')]){utils[_0x7431('0x14')](_0x31fd44['accountcode'])[_0x7431('0x15')](function(_0x1b13cc){if(_0x1b13cc){_0x31fd44[_0x7431('0x16')]=_0x1b13cc['id'];}utils['request'](_0x7431('0x17'),_0x31fd44);});}else{utils[_0x7431('0x18')](_0x7431('0x17'),_0x31fd44);}if(channels[_0x31fd44['uniqueid']]){delete channels[_0x31fd44[_0x7431('0x7')]];}else if(_0x328945&&channels[_0x328945]){if(!transfers['blinds'][_0x328945]['recording'])delete transfers['blinds'][_0x328945];delete channels[_0x328945];}}exports[_0x7431('0x19')]=function(_0x1f5096){try{utils[_0x7431('0x1a')](util[_0x7431('0xa')]('[%s][calls][newchannel]',_0x1f5096['uniqueid']),_0x1f5096);if(_0x1f5096[_0x7431('0x7')]==_0x1f5096[_0x7431('0x1b')]&&_0x1f5096[_0x7431('0xc')]!=_0x7431('0x1c')){utils[_0x7431('0x9')](util[_0x7431('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1f5096['uniqueid'],_0x1f5096['context'],_0x1f5096[_0x7431('0x1d')]));channels[_0x1f5096[_0x7431('0x7')]]={'uniqueid':_0x1f5096['uniqueid'],'accountcode':_0x1f5096[_0x7431('0x13')],'source':_0x1f5096[_0x7431('0x10')],'destination':_0x1f5096[_0x7431('0x1d')],'destinationcontext':_0x1f5096['context'],'channel':_0x1f5096[_0x7431('0xc')],'starttime':utils[_0x7431('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7431('0x4'),'amaflags':_0x7431('0x1f')};}}catch(_0x49a64b){utils[_0x7431('0x20')](util[_0x7431('0xa')](_0x7431('0x21'),_0x1f5096[_0x7431('0x7')]),_0x49a64b);}};exports[_0x7431('0x22')]=function(_0x1eb56c){try{utils[_0x7431('0x1a')](util[_0x7431('0xa')](_0x7431('0x23'),_0x1eb56c[_0x7431('0x7')]),_0x1eb56c);if(!_[_0x7431('0x24')](channels[_0x1eb56c[_0x7431('0x7')]])&&_0x1eb56c['channelstate']==0x6){utils[_0x7431('0x9')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1eb56c[_0x7431('0x7')],_0x1eb56c[_0x7431('0x25')],_0x1eb56c['channel']));if(_[_0x7431('0x24')](channels[_0x1eb56c[_0x7431('0x7')]][_0x7431('0x26')])){channels[_0x1eb56c[_0x7431('0x7')]][_0x7431('0x26')]=utils[_0x7431('0x1e')]();}}else if(!_[_0x7431('0x24')](channels[_0x1eb56c[_0x7431('0x1b')]])&&_0x1eb56c[_0x7431('0x27')]==0x6&&_0x1eb56c[_0x7431('0x25')]!=_0x7431('0x28')){utils[_0x7431('0x9')](util['format'](_0x7431('0x29'),_0x1eb56c[_0x7431('0x7')],_0x1eb56c[_0x7431('0x1b')],_0x1eb56c[_0x7431('0x25')],_0x1eb56c['channel']));channels[_0x1eb56c[_0x7431('0x1b')]][_0x7431('0x13')]=_0x1eb56c[_0x7431('0x13')];channels[_0x1eb56c['linkedid']]['destinationchannel']=_0x1eb56c[_0x7431('0xc')];if(_['isNil'](channels[_0x1eb56c['linkedid']][_0x7431('0x2a')])){channels[_0x1eb56c['linkedid']][_0x7431('0x2a')]=utils[_0x7431('0x1e')]();}channels[_0x1eb56c['linkedid']][_0x7431('0x2b')]=dispositions[_[_0x7431('0x2c')](_0x1eb56c['channelstate'])]||_0x7431('0x5');}}catch(_0x173f1a){utils[_0x7431('0x20')](util[_0x7431('0xa')](_0x7431('0x23'),_0x1eb56c['uniqueid']),_0x173f1a);}};exports[_0x7431('0x2d')]=function(_0x4e033f){try{if(!_[_0x7431('0x24')](channels[_0x4e033f[_0x7431('0x7')]])){utils[_0x7431('0x1a')](util[_0x7431('0xa')](_0x7431('0x2e'),_0x4e033f[_0x7431('0x7')]),_0x4e033f);if(_[_0x7431('0x24')](channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x2f')])){channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x2f')]=_0x4e033f[_0x7431('0x30')]+'\x20<'+_0x4e033f[_0x7431('0x10')]+'>';}utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x31'),_0x4e033f[_0x7431('0x7')],channels[_0x4e033f['uniqueid']]['callerid'],_0x4e033f[_0x7431('0x32')]));channels[_0x4e033f[_0x7431('0x7')]]['endtime']=utils['now']();channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x33')]=utils[_0x7431('0x34')](channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x35')],channels[_0x4e033f[_0x7431('0x7')]]['starttime']);channels[_0x4e033f['uniqueid']][_0x7431('0x36')]=channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x2a')]?utils['diffTime'](channels[_0x4e033f['uniqueid']][_0x7431('0x35')],channels[_0x4e033f[_0x7431('0x7')]][_0x7431('0x2a')]):0x0;writeDB(channels[_0x4e033f[_0x7431('0x7')]]);}}catch(_0x545a73){utils[_0x7431('0x20')](util['format'](_0x7431('0x2e'),_0x4e033f[_0x7431('0x7')]),_0x545a73);}};exports['attendedtransfer']=function(_0x2cf13e){try{if(!_[_0x7431('0x24')](channels[_0x2cf13e[_0x7431('0x37')]])){utils['debug'](util[_0x7431('0xa')](_0x7431('0x38'),_0x2cf13e['origtransfereruniqueid']),_0x2cf13e);if(channels[_0x2cf13e[_0x7431('0x37')]][_0x7431('0xc')]==_0x2cf13e[_0x7431('0x39')]){utils[_0x7431('0x9')](util['format'](_0x7431('0x3a'),_0x2cf13e['origtransfereruniqueid'],_0x2cf13e['localtwolinkedid'],_0x2cf13e[_0x7431('0x3b')]));channels[_0x2cf13e[_0x7431('0x37')]][_0x7431('0x3c')]=_0x2cf13e['secondtransfererchannel'];channels[_0x2cf13e['localtwolinkedid']][_0x7431('0x3d')]=_0x7431('0x3e');}else if(channels[_0x2cf13e['localtwolinkedid']][_0x7431('0xc')]=_0x2cf13e[_0x7431('0x3f')]){utils['info'](util['format'](_0x7431('0x3a'),_0x2cf13e['origtransfereruniqueid'],_0x2cf13e[_0x7431('0x37')],_0x2cf13e[_0x7431('0x40')]));channels[_0x2cf13e[_0x7431('0x37')]]['destinationchannel']=_0x2cf13e[_0x7431('0x40')];channels[_0x2cf13e['localtwolinkedid']][_0x7431('0x3d')]=_0x7431('0x3e');}}}catch(_0x97ca13){utils[_0x7431('0x20')](util[_0x7431('0xa')]('[%s][calls][attendedtransfer]',_0x2cf13e['origtransfereruniqueid']),_0x97ca13);}};exports[_0x7431('0x41')]=function(_0x1ee800){try{if(!_[_0x7431('0x24')](channels[_0x1ee800[_0x7431('0x7')]])){utils[_0x7431('0x1a')](util[_0x7431('0xa')](_0x7431('0x42'),_0x1ee800['uniqueid']),_0x1ee800);channels[_0x1ee800[_0x7431('0x7')]][_0x7431('0x43')]=utils[_0x7431('0x1e')]();utils[_0x7431('0x9')](util[_0x7431('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1ee800[_0x7431('0x7')],channels[_0x1ee800['uniqueid']]['musiconholdstartAt']));}}catch(_0x39768e){utils[_0x7431('0x20')](util[_0x7431('0xa')](_0x7431('0x42'),_0x1ee800[_0x7431('0x7')]),_0x39768e);}};exports[_0x7431('0x44')]=function(_0x49f969){try{if(!_[_0x7431('0x24')](channels[_0x49f969[_0x7431('0x7')]])){utils['debug'](util[_0x7431('0xa')](_0x7431('0x45'),_0x49f969[_0x7431('0x7')]),_0x49f969);if(!_[_0x7431('0x24')](channels[_0x49f969['uniqueid']][_0x7431('0x43')])){channels[_0x49f969['uniqueid']]['mohtime']+=utils[_0x7431('0x34')](utils[_0x7431('0x1e')](),channels[_0x49f969[_0x7431('0x7')]][_0x7431('0x43')]);utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x46'),_0x49f969['uniqueid'],channels[_0x49f969[_0x7431('0x7')]][_0x7431('0x47')]));delete channels[_0x49f969['uniqueid']][_0x7431('0x43')];}}}catch(_0x8cfa01){utils['error'](util[_0x7431('0xa')](_0x7431('0x45'),_0x49f969[_0x7431('0x7')]),_0x8cfa01);}};exports['varset']=function(_0x5af827){try{if(!_[_0x7431('0x24')](channels[_0x5af827[_0x7431('0x7')]])){utils[_0x7431('0x1a')](util['format'](_0x7431('0x48'),_0x5af827[_0x7431('0x7')]),_0x5af827);if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x4a')])){utils[_0x7431('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5af827[_0x7431('0x7')],_0x5af827['value']));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x4b')]=_0x5af827['value'];}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')]['xmd-phone'])){utils['info'](util[_0x7431('0xa')](_0x7431('0x4c'),_0x5af827[_0x7431('0x7')],_0x5af827[_0x7431('0x4d')]));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x4e')]=_0x5af827[_0x7431('0x4d')];channels[_0x5af827[_0x7431('0x7')]]['callerid']='\x22'+_0x5af827['value']+'\x22\x20<'+_0x5af827['value']+'>';}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x4f')])||!_['isNil'](_0x5af827[_0x7431('0x49')][_0x7431('0x50')])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x51'),_0x5af827[_0x7431('0x7')],!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')]['xmd-callerid-preview'])?_0x7431('0x4f'):_0x7431('0x50'),_0x5af827['value']));channels[_0x5af827['uniqueid']]['callerid']=_0x5af827[_0x7431('0x4d')];}if(!_[_0x7431('0x24')](_0x5af827['variable'][_0x7431('0x52')])||!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')]['xmcs-queue'])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x51'),_0x5af827[_0x7431('0x7')],!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')]['xmd-queue'])?_0x7431('0x52'):'xmcs-queue',_0x5af827[_0x7431('0x4d')]));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x53')]=_0x7431('0x54');channels[_0x5af827['uniqueid']][_0x7431('0x55')]=_0x5af827[_0x7431('0x4d')];channels[_0x5af827[_0x7431('0x7')]][_0x7431('0xd')]=!![];}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x56')])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x57'),_0x5af827[_0x7431('0x7')],_0x5af827[_0x7431('0x4d')]));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x58')]=_0x5af827[_0x7431('0x4d')];}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x59')])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x5a'),_0x5af827[_0x7431('0x7')],_0x5af827[_0x7431('0x4d')]));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x5b')]=_0x5af827['value'];}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x5c')])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x5d'),_0x5af827[_0x7431('0x7')],_0x5af827[_0x7431('0x4d')]));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x5e')]=_0x5af827['value'];}if(!_[_0x7431('0x24')](_0x5af827[_0x7431('0x49')][_0x7431('0x5f')])){utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x60'),_0x5af827[_0x7431('0x7')],_0x5af827['value']));channels[_0x5af827[_0x7431('0x7')]][_0x7431('0x5f')]=_0x5af827[_0x7431('0x4d')];}}}catch(_0x3fa03e){utils[_0x7431('0x20')](util['format'](_0x7431('0x48'),_0x5af827[_0x7431('0x7')]),_0x3fa03e);}};exports[_0x7431('0x61')]=function(_0xbe0984){try{if(!_['isNil'](channels[_0xbe0984[_0x7431('0x7')]])){utils[_0x7431('0x1a')](util[_0x7431('0xa')]('[%s][calls][newexten]',_0xbe0984[_0x7431('0x7')]),_0xbe0984);utils[_0x7431('0x9')](util[_0x7431('0xa')](_0x7431('0x62'),_0xbe0984[_0x7431('0x7')],_0xbe0984[_0x7431('0x63')],_0xbe0984[_0x7431('0x64')]));if(_0xbe0984['application'][_0x7431('0x65')]()==_0x7431('0x66')&&_[_0x7431('0x67')](_0xbe0984[_0x7431('0x64')]['toLowerCase'](),_0x7431('0x68'))){var _0x395118=_0xbe0984['appdata'][_0x7431('0x69')]('=');var _0x370077=_0x395118[0x0][_0x7431('0x6a')](_0x395118[0x0][_0x7431('0x6b')]('(')+0x1,_0x395118[0x0][_0x7431('0x6b')](')'));var _0x21ee43=_0x395118[0x1];channels[_0xbe0984[_0x7431('0x7')]][_0x370077]=_0x21ee43;}if(!_[_0x7431('0x6c')]([_0x7431('0x2d'),_0x7431('0x6d'),'execif',_0x7431('0x66'),_0x7431('0x6e')],_0xbe0984[_0x7431('0x63')]['toLowerCase']())){channels[_0xbe0984[_0x7431('0x7')]][_0x7431('0x53')]=_0xbe0984[_0x7431('0x63')];channels[_0xbe0984['uniqueid']][_0x7431('0x55')]=_0xbe0984[_0x7431('0x64')];}}}catch(_0x39ce1b){utils[_0x7431('0x20')](util[_0x7431('0xa')](_0x7431('0x6f'),_0xbe0984[_0x7431('0x7')]),_0x39ce1b);}}; \ No newline at end of file +var _0x8c7a=['context','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','callerid','\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','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','accountcode'];(function(_0x50bd8d,_0xa2cb7b){var _0x260560=function(_0x4d5c88){while(--_0x4d5c88){_0x50bd8d['push'](_0x50bd8d['shift']());}};_0x260560(++_0xa2cb7b);}(_0x8c7a,0x197));var _0xa8c7=function(_0x2d949c,_0x491476){_0x2d949c=_0x2d949c-0x0;var _0x9d19e1=_0x8c7a[_0x2d949c];return _0x9d19e1;};'use strict';var _=require(_0xa8c7('0x0'));var util=require(_0xa8c7('0x1'));var utils=require(_0xa8c7('0x2'));var transfers=require(_0xa8c7('0x3'));var dispositions=[_0xa8c7('0x4'),'FAILED','FAILED','NO\x20ANSWER',_0xa8c7('0x4'),_0xa8c7('0x4'),_0xa8c7('0x5'),_0xa8c7('0x6'),'FAILED',_0xa8c7('0x7'),_0xa8c7('0x7')];var channels={};function writeDB(_0x1ecf2d){var _0x13b3dd;if(transfers[_0xa8c7('0x8')][_0x1ecf2d['uniqueid']]){_0x13b3dd=_0x1ecf2d[_0xa8c7('0x9')];_0x1ecf2d[_0xa8c7('0x9')]=transfers[_0xa8c7('0x8')][_0x1ecf2d[_0xa8c7('0x9')]][_0xa8c7('0xa')];}utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0xd'),_0x1ecf2d[_0xa8c7('0x9')],_0x1ecf2d[_0xa8c7('0xe')],_0x1ecf2d[_0xa8c7('0xf')],_0x1ecf2d[_0xa8c7('0x10')],_0x1ecf2d['interface'],_0x1ecf2d[_0xa8c7('0x11')],_0x1ecf2d['connectedlinenum'],_0x1ecf2d[_0xa8c7('0x12')]));if(_0x1ecf2d['accountcode']){utils[_0xa8c7('0x13')](_0x1ecf2d['accountcode'])[_0xa8c7('0x14')](function(_0x552ef6){if(_0x552ef6){_0x1ecf2d['UserId']=_0x552ef6['id'];}utils['request']('CreateVoiceCallReport',_0x1ecf2d);});}else{utils[_0xa8c7('0x15')](_0xa8c7('0x16'),_0x1ecf2d);}if(channels[_0x1ecf2d[_0xa8c7('0x9')]]){delete channels[_0x1ecf2d[_0xa8c7('0x9')]];}else if(_0x13b3dd&&channels[_0x13b3dd]){if(!transfers[_0xa8c7('0x8')][_0x13b3dd]['recording'])delete transfers[_0xa8c7('0x8')][_0x13b3dd];delete channels[_0x13b3dd];}}exports['newchannel']=function(_0x5f30e2){try{utils[_0xa8c7('0x17')](util['format'](_0xa8c7('0x18'),_0x5f30e2['uniqueid']),_0x5f30e2);if(_0x5f30e2[_0xa8c7('0x9')]==_0x5f30e2[_0xa8c7('0x19')]&&_0x5f30e2[_0xa8c7('0xe')]!=_0xa8c7('0x1a')){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x1b'),_0x5f30e2['uniqueid'],_0x5f30e2['context'],_0x5f30e2['exten']));channels[_0x5f30e2[_0xa8c7('0x9')]]={'uniqueid':_0x5f30e2[_0xa8c7('0x9')],'accountcode':_0x5f30e2[_0xa8c7('0x1c')],'source':_0x5f30e2['calleridnum'],'destination':_0x5f30e2['exten'],'destinationcontext':_0x5f30e2[_0xa8c7('0x1d')],'channel':_0x5f30e2['channel'],'starttime':utils[_0xa8c7('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa8c7('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x551ddc){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x18'),_0x5f30e2[_0xa8c7('0x9')]),_0x551ddc);}};exports[_0xa8c7('0x20')]=function(_0x37bf0c){try{utils['debug'](util[_0xa8c7('0xc')](_0xa8c7('0x21'),_0x37bf0c[_0xa8c7('0x9')]),_0x37bf0c);if(!_[_0xa8c7('0x22')](channels[_0x37bf0c[_0xa8c7('0x9')]])&&_0x37bf0c[_0xa8c7('0x23')]==0x6){utils[_0xa8c7('0xb')](util['format'](_0xa8c7('0x24'),_0x37bf0c[_0xa8c7('0x9')],_0x37bf0c[_0xa8c7('0x1d')],_0x37bf0c[_0xa8c7('0xe')]));if(_[_0xa8c7('0x22')](channels[_0x37bf0c['uniqueid']][_0xa8c7('0x25')])){channels[_0x37bf0c['uniqueid']][_0xa8c7('0x25')]=utils[_0xa8c7('0x1e')]();}}else if(!_['isNil'](channels[_0x37bf0c[_0xa8c7('0x19')]])&&_0x37bf0c['channelstate']==0x6&&_0x37bf0c[_0xa8c7('0x1d')]!=_0xa8c7('0x26')){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x27'),_0x37bf0c[_0xa8c7('0x9')],_0x37bf0c['linkedid'],_0x37bf0c[_0xa8c7('0x1d')],_0x37bf0c[_0xa8c7('0xe')]));channels[_0x37bf0c['linkedid']][_0xa8c7('0x1c')]=_0x37bf0c['accountcode'];channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x28')]=_0x37bf0c[_0xa8c7('0xe')];if(_[_0xa8c7('0x22')](channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x29')])){channels[_0x37bf0c[_0xa8c7('0x19')]]['answertime']=utils[_0xa8c7('0x1e')]();}channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x2a')]=dispositions[_[_0xa8c7('0x2b')](_0x37bf0c[_0xa8c7('0x23')])]||_0xa8c7('0x5');}}catch(_0x4cecdf){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')](_0xa8c7('0x21'),_0x37bf0c[_0xa8c7('0x9')]),_0x4cecdf);}};exports[_0xa8c7('0x2c')]=function(_0x472d37){try{if(!_['isNil'](channels[_0x472d37[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')]('[%s][calls][hangup]',_0x472d37['uniqueid']),_0x472d37);if(_[_0xa8c7('0x22')](channels[_0x472d37[_0xa8c7('0x9')]]['callerid'])){channels[_0x472d37[_0xa8c7('0x9')]]['callerid']=_0x472d37[_0xa8c7('0x2d')]+'\x20<'+_0x472d37[_0xa8c7('0x11')]+'>';}utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x2e'),_0x472d37['uniqueid'],channels[_0x472d37[_0xa8c7('0x9')]]['callerid'],_0x472d37[_0xa8c7('0x2f')]));channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x30')]=utils['now']();channels[_0x472d37['uniqueid']][_0xa8c7('0x31')]=utils[_0xa8c7('0x32')](channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x30')],channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x33')]);channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x34')]=channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x29')]?utils['diffTime'](channels[_0x472d37[_0xa8c7('0x9')]]['endtime'],channels[_0x472d37[_0xa8c7('0x9')]]['answertime']):0x0;writeDB(channels[_0x472d37[_0xa8c7('0x9')]]);}}catch(_0x1cb780){utils['error'](util['format']('[%s][calls][hangup]',_0x472d37['uniqueid']),_0x1cb780);}};exports[_0xa8c7('0x35')]=function(_0x2b4a85){try{if(!_[_0xa8c7('0x22')](channels[_0x2b4a85[_0xa8c7('0x36')]])){utils['debug'](util[_0xa8c7('0xc')]('[%s][calls][attendedtransfer]',_0x2b4a85[_0xa8c7('0x37')]),_0x2b4a85);if(channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0xe')]==_0x2b4a85[_0xa8c7('0x38')]){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x39'),_0x2b4a85[_0xa8c7('0x37')],_0x2b4a85[_0xa8c7('0x36')],_0x2b4a85[_0xa8c7('0x3a')]));channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0x28')]=_0x2b4a85[_0xa8c7('0x3a')];channels[_0x2b4a85[_0xa8c7('0x36')]][_0xa8c7('0x3b')]=_0xa8c7('0x3c');}else if(channels[_0x2b4a85[_0xa8c7('0x36')]][_0xa8c7('0xe')]=_0x2b4a85[_0xa8c7('0x3d')]){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x39'),_0x2b4a85[_0xa8c7('0x37')],_0x2b4a85[_0xa8c7('0x36')],_0x2b4a85[_0xa8c7('0x3e')]));channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0x28')]=_0x2b4a85[_0xa8c7('0x3e')];channels[_0x2b4a85[_0xa8c7('0x36')]]['userfield']=_0xa8c7('0x3c');}}}catch(_0x1bbb13){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x3f'),_0x2b4a85[_0xa8c7('0x37')]),_0x1bbb13);}};exports['musiconholdstart']=function(_0xafe5d4){try{if(!_[_0xa8c7('0x22')](channels[_0xafe5d4[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util['format'](_0xa8c7('0x40'),_0xafe5d4[_0xa8c7('0x9')]),_0xafe5d4);channels[_0xafe5d4[_0xa8c7('0x9')]][_0xa8c7('0x41')]=utils[_0xa8c7('0x1e')]();utils['info'](util['format'](_0xa8c7('0x42'),_0xafe5d4[_0xa8c7('0x9')],channels[_0xafe5d4[_0xa8c7('0x9')]]['musiconholdstartAt']));}}catch(_0x432c72){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')]('[%s][calls][musiconholdstart]',_0xafe5d4[_0xa8c7('0x9')]),_0x432c72);}};exports['musiconholdstop']=function(_0x122bce){try{if(!_['isNil'](channels[_0x122bce[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')]('[%s][calls][musiconholdstop]',_0x122bce[_0xa8c7('0x9')]),_0x122bce);if(!_[_0xa8c7('0x22')](channels[_0x122bce[_0xa8c7('0x9')]]['musiconholdstartAt'])){channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x43')]+=utils[_0xa8c7('0x32')](utils[_0xa8c7('0x1e')](),channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x41')]);utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x44'),_0x122bce[_0xa8c7('0x9')],channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x43')]));delete channels[_0x122bce[_0xa8c7('0x9')]]['musiconholdstartAt'];}}}catch(_0x2109cc){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x45'),_0x122bce[_0xa8c7('0x9')]),_0x2109cc);}};exports[_0xa8c7('0x46')]=function(_0x2e252d){try{if(!_[_0xa8c7('0x22')](channels[_0x2e252d[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')](_0xa8c7('0x47'),_0x2e252d[_0xa8c7('0x9')]),_0x2e252d);if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x49')])){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x4a'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d['uniqueid']][_0xa8c7('0x4c')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_['isNil'](_0x2e252d[_0xa8c7('0x48')]['xmd-phone'])){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x4d'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d['uniqueid']][_0xa8c7('0x4e')]=_0x2e252d[_0xa8c7('0x4b')];channels[_0x2e252d['uniqueid']][_0xa8c7('0x4f')]='\x22'+_0x2e252d[_0xa8c7('0x4b')]+_0xa8c7('0x50')+_0x2e252d[_0xa8c7('0x4b')]+'>';}if(!_['isNil'](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x51')])||!_[_0xa8c7('0x22')](_0x2e252d['variable'][_0xa8c7('0x52')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2e252d['uniqueid'],!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x51')])?_0xa8c7('0x51'):_0xa8c7('0x52'),_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]]['callerid']=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')]['xmd-queue'])||!_[_0xa8c7('0x22')](_0x2e252d['variable']['xmcs-queue'])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x53'),_0x2e252d[_0xa8c7('0x9')],!_['isNil'](_0x2e252d[_0xa8c7('0x48')]['xmd-queue'])?_0xa8c7('0x54'):_0xa8c7('0x55'),_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x56')]=_0xa8c7('0x57');channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x58')]=_0x2e252d[_0xa8c7('0x4b')];channels[_0x2e252d['uniqueid']][_0xa8c7('0xf')]=!![];}if(!_['isNil'](_0x2e252d['variable'][_0xa8c7('0x59')])){utils['info'](util['format'](_0xa8c7('0x5a'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x5b')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x5c')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2e252d[_0xa8c7('0x9')],_0x2e252d['value']));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x5d')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x5e')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]]['routeid']=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')]['sipcallid'])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x5f'),_0x2e252d['uniqueid'],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x60')]=_0x2e252d['value'];}}}catch(_0x4cb1e6){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')](_0xa8c7('0x47'),_0x2e252d[_0xa8c7('0x9')]),_0x4cb1e6);}};exports[_0xa8c7('0x61')]=function(_0x284d21){try{if(!_[_0xa8c7('0x22')](channels[_0x284d21[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')](_0xa8c7('0x62'),_0x284d21[_0xa8c7('0x9')]),_0x284d21);utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x284d21[_0xa8c7('0x9')],_0x284d21['application'],_0x284d21['appdata']));if(_0x284d21[_0xa8c7('0x63')][_0xa8c7('0x64')]()==_0xa8c7('0x65')&&_[_0xa8c7('0x66')](_0x284d21[_0xa8c7('0x67')][_0xa8c7('0x64')](),'cdr')){var _0x451573=_0x284d21[_0xa8c7('0x67')]['split']('=');var _0x178a02=_0x451573[0x0]['substring'](_0x451573[0x0][_0xa8c7('0x68')]('(')+0x1,_0x451573[0x0][_0xa8c7('0x68')](')'));var _0x1fbc8c=_0x451573[0x1];channels[_0x284d21[_0xa8c7('0x9')]][_0x178a02]=_0x1fbc8c;}if(!_[_0xa8c7('0x69')]([_0xa8c7('0x2c'),_0xa8c7('0x6a'),_0xa8c7('0x6b'),_0xa8c7('0x65'),_0xa8c7('0x6c')],_0x284d21[_0xa8c7('0x63')][_0xa8c7('0x64')]())){channels[_0x284d21[_0xa8c7('0x9')]][_0xa8c7('0x56')]=_0x284d21[_0xa8c7('0x63')];channels[_0x284d21[_0xa8c7('0x9')]][_0xa8c7('0x58')]=_0x284d21[_0xa8c7('0x67')];}}}catch(_0x3ba523){utils['error'](util['format'](_0xa8c7('0x62'),_0x284d21[_0xa8c7('0x9')]),_0x3ba523);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a96448e..a34f5f9 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 _0x138f=['close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error'];(function(_0x2a8250,_0x584e4b){var _0x208d25=function(_0x181530){while(--_0x181530){_0x2a8250['push'](_0x2a8250['shift']());}};_0x208d25(++_0x584e4b);}(_0x138f,0xf4));var _0xf138=function(_0x20936e,_0x4d5283){_0x20936e=_0x20936e-0x0;var _0x50a212=_0x138f[_0x20936e];return _0x50a212;};'use strict';var utils=require(_0xf138('0x0'));exports[_0xf138('0x1')]=function(){utils[_0xf138('0x2')](_0xf138('0x3'));};exports[_0xf138('0x4')]=function(){utils[_0xf138('0x2')](_0xf138('0x5'));};exports[_0xf138('0x6')]=function(){utils[_0xf138('0x2')]('[core]\x20fullybooted');};exports[_0xf138('0x7')]=function(_0x4349fc){utils[_0xf138('0x7')](_0xf138('0x8'),_0x4349fc);};exports[_0xf138('0x9')]=function(){utils['info'](_0xf138('0xa'));};exports['managerevent']=function(_0x441f00){}; \ No newline at end of file +var _0xf2ec=['[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xf2ec,0x13c));var _0xcf2e=function(_0x1705e2,_0x3892df){_0x1705e2=_0x1705e2-0x0;var _0xf314b3=_0xf2ec[_0x1705e2];return _0xf314b3;};'use strict';var utils=require(_0xcf2e('0x0'));exports['connect']=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x2'));};exports[_0xcf2e('0x3')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x4'));};exports[_0xcf2e('0x5')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x6'));};exports[_0xcf2e('0x7')]=function(_0x5e4c6a){utils[_0xcf2e('0x7')](_0xcf2e('0x8'),_0x5e4c6a);};exports[_0xcf2e('0x9')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0xa'));};exports[_0xcf2e('0xb')]=function(_0x53d413){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 91d9828..c9189d7 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 _0x4059=['./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','billableseconds','lodash'];(function(_0xffccf3,_0x424406){var _0x1be8b8=function(_0x288d3f){while(--_0x288d3f){_0xffccf3['push'](_0xffccf3['shift']());}};_0x1be8b8(++_0x424406);}(_0x4059,0x1ca));var _0x9405=function(_0xa5f0b0,_0x57f3f3){_0xa5f0b0=_0xa5f0b0-0x0;var _0x52f145=_0x4059[_0xa5f0b0];return _0x52f145;};'use strict';var _=require(_0x9405('0x0'));var util=require('util');var utils=require(_0x9405('0x1'));var dials={};function writeDB(_0x41c190){utils[_0x9405('0x2')](util[_0x9405('0x3')](_0x9405('0x4'),_0x41c190['uniqueid'],_0x41c190['channel'],_0x41c190[_0x9405('0x5')],_0x41c190['calleridnum'],_0x41c190[_0x9405('0x6')],_0x41c190[_0x9405('0x7')]));utils['request'](_0x9405('0x8'),_0x41c190);delete dials[_0x41c190[_0x9405('0x9')]];}exports[_0x9405('0xa')]=function(_0x463f55){try{utils[_0x9405('0xb')](util['format'](_0x9405('0xc'),_0x463f55[_0x9405('0x9')]),_0x463f55);utils[_0x9405('0x2')](util[_0x9405('0x3')](_0x9405('0xd'),_0x463f55[_0x9405('0x9')],_0x463f55[_0x9405('0xe')],_0x463f55[_0x9405('0xf')]));if(_0x463f55[_0x9405('0xe')][_0x9405('0x10')]()==_0x9405('0x11')&&_[_0x9405('0x12')](_0x463f55[_0x9405('0xf')][_0x9405('0x10')](),'cdr(routeid)')){var _0xe4dda=_0x463f55['appdata'][_0x9405('0x13')]('=');dials[_0x463f55[_0x9405('0x9')]]={'routeId':_0xe4dda[0x1]};}}catch(_0x59225e){utils[_0x9405('0x14')](util[_0x9405('0x3')]('[%s][dials][newexten]',_0x463f55[_0x9405('0x9')]),_0x59225e);}};exports[_0x9405('0x15')]=function(_0x3a4ff0){try{utils[_0x9405('0xb')](util[_0x9405('0x3')]('[%s][dials][varset]',_0x3a4ff0[_0x9405('0x9')]),_0x3a4ff0);if(!_[_0x9405('0x16')](_0x3a4ff0[_0x9405('0x17')][_0x9405('0x18')])){utils['info'](util[_0x9405('0x3')](_0x9405('0x19'),_0x3a4ff0[_0x9405('0x9')],_0x3a4ff0[_0x9405('0x1a')]));dials[_0x3a4ff0['uniqueid']]={'routeId':_0x3a4ff0[_0x9405('0x1a')]};}}catch(_0x3603eb){utils[_0x9405('0x14')](util[_0x9405('0x3')](_0x9405('0x1b'),_0x3a4ff0[_0x9405('0x9')]),_0x3603eb);}};exports[_0x9405('0x1c')]=function(_0x221ce3){try{if(!_[_0x9405('0x16')](dials[_0x221ce3[_0x9405('0x9')]])){utils[_0x9405('0xb')](util[_0x9405('0x3')](_0x9405('0x1d'),_0x221ce3[_0x9405('0x9')]),_0x221ce3);dials[_0x221ce3['uniqueid']]=_[_0x9405('0x1e')](dials[_0x221ce3[_0x9405('0x9')]],_0x221ce3);dials[_0x221ce3[_0x9405('0x9')]][_0x9405('0x1f')]=utils[_0x9405('0x20')]();dials[_0x221ce3[_0x9405('0x9')]][_0x9405('0x21')]=_0x9405('0x22');utils['info'](util[_0x9405('0x3')](_0x9405('0x23'),_0x221ce3[_0x9405('0x9')],dials[_0x221ce3[_0x9405('0x9')]][_0x9405('0x1f')]));}}catch(_0x2594ee){utils[_0x9405('0x14')](util[_0x9405('0x3')](_0x9405('0x1d'),_0x221ce3[_0x9405('0x9')]),_0x2594ee);}};exports['dialend']=function(_0x429915){try{if(!_[_0x9405('0x16')](dials[_0x429915[_0x9405('0x9')]])){utils[_0x9405('0xb')](util[_0x9405('0x3')](_0x9405('0x24'),_0x429915[_0x9405('0x9')]),_0x429915);dials[_0x429915[_0x9405('0x9')]]['dialstatus']=_0x429915[_0x9405('0x7')];if(_0x429915[_0x9405('0x7')]==_0x9405('0x25')){dials[_0x429915[_0x9405('0x9')]]=_['assign'](dials[_0x429915[_0x9405('0x9')]],_0x429915);dials[_0x429915['uniqueid']]['answertime']=utils[_0x9405('0x20')]();dials[_0x429915[_0x9405('0x9')]][_0x9405('0x21')]='connect';utils[_0x9405('0x2')](util[_0x9405('0x3')](_0x9405('0x26'),_0x429915[_0x9405('0x9')],_0x429915['dialstatus'],dials[_0x429915[_0x9405('0x9')]][_0x9405('0x27')]));}else{utils[_0x9405('0x2')](util['format'](_0x9405('0x28'),_0x429915['uniqueid'],_0x429915[_0x9405('0x7')]));}}}catch(_0xfbe50a){utils[_0x9405('0x14')](util['format'](_0x9405('0x24'),_0x429915[_0x9405('0x9')]),_0xfbe50a);}};exports[_0x9405('0x29')]=function(_0x2f6885){try{if(!_[_0x9405('0x16')](dials[_0x2f6885[_0x9405('0x9')]])){utils[_0x9405('0xb')](util[_0x9405('0x3')](_0x9405('0x2a'),_0x2f6885[_0x9405('0x9')]),_0x2f6885);utils[_0x9405('0x2')](util[_0x9405('0x3')](_0x9405('0x2b'),_0x2f6885[_0x9405('0x9')],_0x2f6885[_0x9405('0x2c')],_0x2f6885[_0x9405('0x2d')],_0x2f6885[_0x9405('0x2e')]));dials[_0x2f6885[_0x9405('0x9')]]=_[_0x9405('0x1e')](dials[_0x2f6885[_0x9405('0x9')]],{'endtime':utils[_0x9405('0x20')](),'lastevent':'complete'});dials[_0x2f6885['uniqueid']][_0x9405('0x2f')]=utils[_0x9405('0x30')](dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x31')],dials[_0x2f6885[_0x9405('0x9')]]['starttime']);dials[_0x2f6885['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x27')]||dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x31')],dials[_0x2f6885['uniqueid']][_0x9405('0x1f')]);dials[_0x2f6885['uniqueid']][_0x9405('0x32')]=dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x27')]?utils[_0x9405('0x30')](dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x31')],dials[_0x2f6885[_0x9405('0x9')]][_0x9405('0x27')]):0x0;writeDB(dials[_0x2f6885[_0x9405('0x9')]]);}}catch(_0xe59e4d){utils['error'](util[_0x9405('0x3')](_0x9405('0x2a'),_0x2f6885[_0x9405('0x9')]),_0xe59e4d);}}; \ No newline at end of file +var _0x3879=['calleridnum','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','answertime','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'];(function(_0x38efc3,_0x338735){var _0x410980=function(_0x1d2e6b){while(--_0x1d2e6b){_0x38efc3['push'](_0x38efc3['shift']());}};_0x410980(++_0x338735);}(_0x3879,0xd9));var _0x9387=function(_0x7c7474,_0x35cb3d){_0x7c7474=_0x7c7474-0x0;var _0x40d0fa=_0x3879[_0x7c7474];return _0x40d0fa;};'use strict';var _=require(_0x9387('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3f417f){utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x3'),_0x3f417f[_0x9387('0x4')],_0x3f417f[_0x9387('0x5')],_0x3f417f[_0x9387('0x6')],_0x3f417f['calleridnum'],_0x3f417f[_0x9387('0x7')],_0x3f417f[_0x9387('0x8')]));utils[_0x9387('0x9')]('CreateVoiceDialReport',_0x3f417f);delete dials[_0x3f417f['uniqueid']];}exports[_0x9387('0xa')]=function(_0x2b90ed){try{utils[_0x9387('0xb')](util[_0x9387('0x2')](_0x9387('0xc'),_0x2b90ed[_0x9387('0x4')]),_0x2b90ed);utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0xd'),_0x2b90ed['uniqueid'],_0x2b90ed[_0x9387('0xe')],_0x2b90ed[_0x9387('0xf')]));if(_0x2b90ed[_0x9387('0xe')][_0x9387('0x10')]()=='set'&&_[_0x9387('0x11')](_0x2b90ed[_0x9387('0xf')][_0x9387('0x10')](),_0x9387('0x12'))){var _0x46ae1a=_0x2b90ed[_0x9387('0xf')]['split']('=');dials[_0x2b90ed['uniqueid']]={'routeId':_0x46ae1a[0x1]};}}catch(_0x281a8d){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0xc'),_0x2b90ed[_0x9387('0x4')]),_0x281a8d);}};exports[_0x9387('0x14')]=function(_0x42b45f){try{utils[_0x9387('0xb')](util[_0x9387('0x2')](_0x9387('0x15'),_0x42b45f[_0x9387('0x4')]),_0x42b45f);if(!_[_0x9387('0x16')](_0x42b45f[_0x9387('0x17')]['outboundrouteid'])){utils[_0x9387('0x1')](util['format'](_0x9387('0x18'),_0x42b45f[_0x9387('0x4')],_0x42b45f[_0x9387('0x19')]));dials[_0x42b45f['uniqueid']]={'routeId':_0x42b45f[_0x9387('0x19')]};}}catch(_0x8a31da){utils[_0x9387('0x13')](util['format']('[%s][dials][varset]',_0x42b45f[_0x9387('0x4')]),_0x8a31da);}};exports[_0x9387('0x1a')]=function(_0x177b9b){try{if(!_[_0x9387('0x16')](dials[_0x177b9b[_0x9387('0x4')]])){utils[_0x9387('0xb')](util['format'](_0x9387('0x1b'),_0x177b9b['uniqueid']),_0x177b9b);dials[_0x177b9b[_0x9387('0x4')]]=_[_0x9387('0x1c')](dials[_0x177b9b[_0x9387('0x4')]],_0x177b9b);dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1d')]=utils[_0x9387('0x1e')]();dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1f')]=_0x9387('0x20');utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x21'),_0x177b9b[_0x9387('0x4')],dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1d')]));}}catch(_0x4bbcd1){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0x1b'),_0x177b9b[_0x9387('0x4')]),_0x4bbcd1);}};exports['dialend']=function(_0x5032af){try{if(!_[_0x9387('0x16')](dials[_0x5032af[_0x9387('0x4')]])){utils['debug'](util[_0x9387('0x2')]('[%s][dials][dialend]',_0x5032af[_0x9387('0x4')]),_0x5032af);dials[_0x5032af['uniqueid']][_0x9387('0x8')]=_0x5032af[_0x9387('0x8')];if(_0x5032af[_0x9387('0x8')]==_0x9387('0x22')){dials[_0x5032af['uniqueid']]=_[_0x9387('0x1c')](dials[_0x5032af[_0x9387('0x4')]],_0x5032af);dials[_0x5032af[_0x9387('0x4')]][_0x9387('0x23')]=utils['now']();dials[_0x5032af[_0x9387('0x4')]][_0x9387('0x1f')]=_0x9387('0x24');utils[_0x9387('0x1')](util['format'](_0x9387('0x25'),_0x5032af[_0x9387('0x4')],_0x5032af['dialstatus'],dials[_0x5032af['uniqueid']][_0x9387('0x23')]));}else{utils['info'](util['format'](_0x9387('0x26'),_0x5032af[_0x9387('0x4')],_0x5032af[_0x9387('0x8')]));}}}catch(_0x45d12a){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0x27'),_0x5032af[_0x9387('0x4')]),_0x45d12a);}};exports[_0x9387('0x28')]=function(_0x5156d7){try{if(!_[_0x9387('0x16')](dials[_0x5156d7[_0x9387('0x4')]])){utils['debug'](util[_0x9387('0x2')](_0x9387('0x29'),_0x5156d7[_0x9387('0x4')]),_0x5156d7);utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x2a'),_0x5156d7['uniqueid'],_0x5156d7[_0x9387('0x2b')],_0x5156d7[_0x9387('0x2c')],_0x5156d7[_0x9387('0x2d')]));dials[_0x5156d7[_0x9387('0x4')]]=_[_0x9387('0x1c')](dials[_0x5156d7[_0x9387('0x4')]],{'endtime':utils[_0x9387('0x1e')](),'lastevent':_0x9387('0x2e')});dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x2f')]=utils['diffTime'](dials[_0x5156d7[_0x9387('0x4')]]['endtime'],dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x1d')]);dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x30')]=utils[_0x9387('0x31')](dials[_0x5156d7['uniqueid']][_0x9387('0x23')]||dials[_0x5156d7['uniqueid']][_0x9387('0x32')],dials[_0x5156d7['uniqueid']][_0x9387('0x1d')]);dials[_0x5156d7['uniqueid']][_0x9387('0x33')]=dials[_0x5156d7['uniqueid']][_0x9387('0x23')]?utils[_0x9387('0x31')](dials[_0x5156d7[_0x9387('0x4')]]['endtime'],dials[_0x5156d7['uniqueid']]['answertime']):0x0;writeDB(dials[_0x5156d7[_0x9387('0x4')]]);}}catch(_0x299e17){utils['error'](util[_0x9387('0x2')](_0x9387('0x29'),_0x5156d7['uniqueid']),_0x299e17);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 53013c7..983869d 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 _0x1396=['[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][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','[%s][index][dialend]','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','XDR\x20DISABLED','info','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop'];(function(_0x3ed8d7,_0x2661da){var _0x408127=function(_0x2b0660){while(--_0x2b0660){_0x3ed8d7['push'](_0x3ed8d7['shift']());}};_0x408127(++_0x2661da);}(_0x1396,0xe9));var _0x6139=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x1396[_0x4df6f9];return _0x4b1a73;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x6139('0x0'));var util=require(_0x6139('0x1'));var isXDREnabled=config['xdr']&&config[_0x6139('0x2')]['disabled']?!config['xdr'][_0x6139('0x3')]:!![];var isProduction=config[_0x6139('0x4')]===_0x6139('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0x6139('0x2')][_0x6139('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x6139('0x7')]['port'],config['asterisk']['ip'],config[_0x6139('0x7')][_0x6139('0x8')],config[_0x6139('0x7')]['password'],!![]);ami[_0x6139('0x9')]();if(!isXDREnabled){utils['info'](_0x6139('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6139('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6139('0xc'));var calls=require('./calls.controller');var queues=require(_0x6139('0xd'));var recordings=require('./recordings.controller');var members=require(_0x6139('0xe'));var dials=require(_0x6139('0xf'));var transfers=require(_0x6139('0x10'));var core=require(_0x6139('0x11'));ami['on'](_0x6139('0x12'),core['connect']);ami['on']('shutdown',core[_0x6139('0x13')]);ami['on'](_0x6139('0x14'),core['fullybooted']);ami['on']('error',core[_0x6139('0x15')]);ami['on'](_0x6139('0x16'),core[_0x6139('0x16')]);ami['on'](_0x6139('0x17'),core[_0x6139('0x17')]);ami['on'](_0x6139('0x18'),function(_0x3874b6){try{utils[_0x6139('0x19')](util['format'](_0x6139('0x1a'),_0x3874b6[_0x6139('0x1b')]),_0x3874b6);members[_0x6139('0x18')](_0x3874b6);}catch(_0x32e1d9){utils[_0x6139('0x15')](util['format'](_0x6139('0x1a'),_0x3874b6['device']),_0x32e1d9);}});ami['on']('agentcalled',function(_0x388f93){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x1d'),_0x388f93['uniqueid']),_0x388f93);agents[_0x6139('0x1e')](_0x388f93);}catch(_0x723d6e){utils['error'](util[_0x6139('0x1c')]('[%s][index][agentcalled]',_0x388f93[_0x6139('0x1f')]),_0x723d6e);}});ami['on'](_0x6139('0x20'),function(_0x576485){try{utils['debug'](util['format']('[%s][index][agentringnoanswer]',_0x576485[_0x6139('0x1f')]),_0x576485);agents[_0x6139('0x20')](_0x576485);}catch(_0x50452a){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x21'),_0x576485[_0x6139('0x1f')]),_0x50452a);}});ami['on'](_0x6139('0x22'),function(_0x25f19a){try{utils[_0x6139('0x19')](util['format'](_0x6139('0x23'),_0x25f19a[_0x6139('0x1f')]),_0x25f19a);agents['agentconnect'](_0x25f19a);queues[_0x6139('0x22')](_0x25f19a);}catch(_0x20c1da){utils['error'](util[_0x6139('0x1c')](_0x6139('0x23'),_0x25f19a[_0x6139('0x1f')]),_0x20c1da);}});ami['on'](_0x6139('0x24'),function(_0x32ea65){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x25'),_0x32ea65[_0x6139('0x1f')]),_0x32ea65);agents[_0x6139('0x24')](_0x32ea65);queues[_0x6139('0x24')](_0x32ea65);members['agentcomplete'](_0x32ea65);}catch(_0x50214a){utils[_0x6139('0x15')](util['format'](_0x6139('0x25'),_0x32ea65[_0x6139('0x1f')]),_0x50214a);}});ami['on'](_0x6139('0x26'),function(_0x4f5347){try{utils[_0x6139('0x19')](util['format']('[%s][index][queuecallerabandon]',_0x4f5347[_0x6139('0x1f')]),_0x4f5347);agents[_0x6139('0x26')](_0x4f5347);queues[_0x6139('0x26')](_0x4f5347);}catch(_0x335c59){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x27'),_0x4f5347['uniqueid']),_0x335c59);}});ami['on'](_0x6139('0x28'),function(_0x4bfca8){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x29'),_0x4bfca8[_0x6139('0x1f')]),_0x4bfca8);queues['queuecallerjoin'](_0x4bfca8);recordings['queuecallerjoin'](_0x4bfca8);}catch(_0x3cd705){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x29'),_0x4bfca8[_0x6139('0x1f')]),_0x3cd705);}});ami['on'](_0x6139('0x2a'),function(_0x50e4e4){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')]('[%s][index][queuecallerleave]',_0x50e4e4['uniqueid']),_0x50e4e4);queues[_0x6139('0x2a')](_0x50e4e4);}catch(_0x2bf6d6){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x2b'),_0x50e4e4[_0x6139('0x1f')]),_0x2bf6d6);}});ami['on'](_0x6139('0x2c'),function(_0x17ba36){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x2d'),_0x17ba36[_0x6139('0x1f')]),_0x17ba36);queues[_0x6139('0x2c')](_0x17ba36);calls['musiconholdstart'](_0x17ba36);}catch(_0x596399){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x2d'),_0x17ba36[_0x6139('0x1f')]),_0x596399);}});ami['on'](_0x6139('0x2e'),function(_0x124c36){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x2f'),_0x124c36[_0x6139('0x1f')]),_0x124c36);queues['musiconholdstop'](_0x124c36);calls['musiconholdstop'](_0x124c36);}catch(_0x396998){utils[_0x6139('0x15')](util['format']('[%s][index][musiconholdstop]',_0x124c36[_0x6139('0x1f')]),_0x396998);}});ami['on'](_0x6139('0x30'),function(_0x19cc0b){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x31'),_0x19cc0b['uniqueid']),_0x19cc0b);calls[_0x6139('0x30')](_0x19cc0b);recordings['newstate'](_0x19cc0b);}catch(_0x15ec06){utils[_0x6139('0x15')](util['format']('[%s][index][newstate]',_0x19cc0b['uniqueid']),_0x15ec06);}});ami['on']('hangup',function(_0x548357){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x32'),_0x548357[_0x6139('0x1f')]),_0x548357);calls[_0x6139('0x33')](_0x548357);recordings[_0x6139('0x33')](_0x548357);dials[_0x6139('0x33')](_0x548357);agents['hangup'](_0x548357);queues[_0x6139('0x33')](_0x548357);}catch(_0x1d4ad9){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x32'),_0x548357[_0x6139('0x1f')]),_0x1d4ad9);}});ami['on'](_0x6139('0x34'),function(_0x429a0b){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x35'),_0x429a0b[_0x6139('0x1f')]),_0x429a0b);members['cdr'](_0x429a0b);}catch(_0x54ccf3){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x35'),_0x429a0b['uniqueid']),_0x54ccf3);}});ami['on'](_0x6139('0x36'),function(_0x3442d2){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x37'),_0x3442d2[_0x6139('0x1f')]),_0x3442d2);queues[_0x6139('0x36')](_0x3442d2);agents[_0x6139('0x36')](_0x3442d2);transfers['blindtransfer'](_0x3442d2);recordings[_0x6139('0x36')](_0x3442d2);}catch(_0x3b4457){utils[_0x6139('0x15')](util['format'](_0x6139('0x37'),_0x3442d2[_0x6139('0x1f')]),_0x3b4457);}});ami['on'](_0x6139('0x38'),function(_0x599277){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x39'),_0x599277[_0x6139('0x3a')]),_0x599277);queues[_0x6139('0x38')](_0x599277);transfers['attendedtransfer'](_0x599277);agents[_0x6139('0x38')](_0x599277);calls[_0x6139('0x38')](_0x599277);}catch(_0x3424e7){utils[_0x6139('0x15')](util['format'](_0x6139('0x39'),_0x599277[_0x6139('0x3a')]),_0x3424e7);}});ami['on'](_0x6139('0x3b'),function(_0x50fc2b){try{utils['debug'](util[_0x6139('0x1c')](_0x6139('0x3c'),_0x50fc2b[_0x6139('0x1f')]),_0x50fc2b);queues[_0x6139('0x3b')](_0x50fc2b);recordings[_0x6139('0x3b')](_0x50fc2b);calls[_0x6139('0x3b')](_0x50fc2b);dials[_0x6139('0x3b')](_0x50fc2b);}catch(_0x6632c5){utils[_0x6139('0x15')](util['format'](_0x6139('0x3c'),_0x50fc2b['uniqueid']),_0x6632c5);}});ami['on'](_0x6139('0x3d'),function(_0x44463d){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x3e'),_0x44463d['uniqueid']),_0x44463d);calls[_0x6139('0x3d')](_0x44463d);recordings[_0x6139('0x3d')](_0x44463d);dials[_0x6139('0x3d')](_0x44463d);}catch(_0x385b67){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x3e'),_0x44463d[_0x6139('0x1f')]),_0x385b67);}});ami['on'](_0x6139('0x3f'),function(_0xe83466){try{utils[_0x6139('0x19')](util[_0x6139('0x1c')](_0x6139('0x40'),_0xe83466[_0x6139('0x1f')]),_0xe83466);calls[_0x6139('0x3f')](_0xe83466);recordings[_0x6139('0x3f')](_0xe83466);}catch(_0x42ee30){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x40'),_0xe83466[_0x6139('0x1f')]),_0x42ee30);}});ami['on'](_0x6139('0x41'),function(_0xcb2eb5){try{utils[_0x6139('0x19')](util['format'](_0x6139('0x42'),_0xcb2eb5[_0x6139('0x1f')]),_0xcb2eb5);dials['dialbegin'](_0xcb2eb5);}catch(_0x1524bb){utils[_0x6139('0x15')](util['format'](_0x6139('0x43'),_0xcb2eb5['uniqueid']),_0x1524bb);}});ami['on'](_0x6139('0x44'),function(_0x4c637b){try{utils[_0x6139('0x19')](util['format'](_0x6139('0x45'),_0x4c637b['uniqueid']),_0x4c637b);dials[_0x6139('0x44')](_0x4c637b);}catch(_0x3037ac){utils[_0x6139('0x15')](util[_0x6139('0x1c')](_0x6139('0x45'),_0x4c637b[_0x6139('0x1f')]),_0x3037ac);}});} \ No newline at end of file +var _0x3b15=['musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','local','asterisk','username','keepConnected','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','format','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]'];(function(_0x1db4f2,_0x4bcd69){var _0x3c2516=function(_0x31ca80){while(--_0x31ca80){_0x1db4f2['push'](_0x1db4f2['shift']());}};_0x3c2516(++_0x4bcd69);}(_0x3b15,0xd4));var _0x53b1=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x3b15[_0x912d27];return _0x31b918;};var AsteriskManager=require(_0x53b1('0x0'));var config=require(_0x53b1('0x1'));var utils=require(_0x53b1('0x2'));var util=require('util');var isXDREnabled=config[_0x53b1('0x3')]&&config[_0x53b1('0x3')]['disabled']?!config['xdr'][_0x53b1('0x4')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x53b1('0x3')]&&config['xdr'][_0x53b1('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x53b1('0x6')]['port'],config[_0x53b1('0x6')]['ip'],config[_0x53b1('0x6')][_0x53b1('0x7')],config[_0x53b1('0x6')]['password'],!![]);ami[_0x53b1('0x8')]();if(!isXDREnabled){utils['info'](_0x53b1('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x53b1('0xa'));var calls=require(_0x53b1('0xb'));var queues=require(_0x53b1('0xc'));var recordings=require(_0x53b1('0xd'));var members=require(_0x53b1('0xe'));var dials=require(_0x53b1('0xf'));var transfers=require('./transfers.controller');var core=require(_0x53b1('0x10'));ami['on'](_0x53b1('0x11'),core['connect']);ami['on'](_0x53b1('0x12'),core['shutdown']);ami['on'](_0x53b1('0x13'),core['fullybooted']);ami['on'](_0x53b1('0x14'),core[_0x53b1('0x14')]);ami['on'](_0x53b1('0x15'),core[_0x53b1('0x15')]);ami['on'](_0x53b1('0x16'),core[_0x53b1('0x16')]);ami['on']('devicestatechange',function(_0x3e44c5){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x18'),_0x3e44c5[_0x53b1('0x19')]),_0x3e44c5);members[_0x53b1('0x1a')](_0x3e44c5);}catch(_0x5933d5){utils[_0x53b1('0x14')](util['format']('[%s][index][devicestatechange]',_0x3e44c5['device']),_0x5933d5);}});ami['on'](_0x53b1('0x1b'),function(_0x4847f5){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][agentcalled]',_0x4847f5[_0x53b1('0x1d')]),_0x4847f5);agents['agentcalled'](_0x4847f5);}catch(_0xd8e667){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x1e'),_0x4847f5[_0x53b1('0x1d')]),_0xd8e667);}});ami['on']('agentringnoanswer',function(_0xc6727e){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x1f'),_0xc6727e[_0x53b1('0x1d')]),_0xc6727e);agents[_0x53b1('0x20')](_0xc6727e);}catch(_0x51732f){utils['error'](util[_0x53b1('0x1c')](_0x53b1('0x1f'),_0xc6727e[_0x53b1('0x1d')]),_0x51732f);}});ami['on']('agentconnect',function(_0x1c14a7){try{utils['debug'](util[_0x53b1('0x1c')](_0x53b1('0x21'),_0x1c14a7[_0x53b1('0x1d')]),_0x1c14a7);agents['agentconnect'](_0x1c14a7);queues[_0x53b1('0x22')](_0x1c14a7);}catch(_0x480c9f){utils['error'](util['format'](_0x53b1('0x21'),_0x1c14a7[_0x53b1('0x1d')]),_0x480c9f);}});ami['on'](_0x53b1('0x23'),function(_0x137f8b){try{utils[_0x53b1('0x17')](util['format']('[%s][index][agentcomplete]',_0x137f8b[_0x53b1('0x1d')]),_0x137f8b);agents[_0x53b1('0x23')](_0x137f8b);queues[_0x53b1('0x23')](_0x137f8b);members[_0x53b1('0x23')](_0x137f8b);}catch(_0x4fd1db){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x24'),_0x137f8b['uniqueid']),_0x4fd1db);}});ami['on']('queuecallerabandon',function(_0x1aa758){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x25'),_0x1aa758[_0x53b1('0x1d')]),_0x1aa758);agents[_0x53b1('0x26')](_0x1aa758);queues[_0x53b1('0x26')](_0x1aa758);}catch(_0x1d8a18){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x25'),_0x1aa758[_0x53b1('0x1d')]),_0x1d8a18);}});ami['on']('queuecallerjoin',function(_0x1fe8a6){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x27'),_0x1fe8a6[_0x53b1('0x1d')]),_0x1fe8a6);queues['queuecallerjoin'](_0x1fe8a6);recordings[_0x53b1('0x28')](_0x1fe8a6);}catch(_0x284799){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x27'),_0x1fe8a6[_0x53b1('0x1d')]),_0x284799);}});ami['on']('queuecallerleave',function(_0x2ac620){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x29'),_0x2ac620[_0x53b1('0x1d')]),_0x2ac620);queues[_0x53b1('0x2a')](_0x2ac620);}catch(_0x2c7079){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x29'),_0x2ac620[_0x53b1('0x1d')]),_0x2c7079);}});ami['on']('musiconholdstart',function(_0x51ad14){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x2b'),_0x51ad14[_0x53b1('0x1d')]),_0x51ad14);queues[_0x53b1('0x2c')](_0x51ad14);calls[_0x53b1('0x2c')](_0x51ad14);}catch(_0x297f65){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x2b'),_0x51ad14['uniqueid']),_0x297f65);}});ami['on']('musiconholdstop',function(_0x3c4aa1){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x2d'),_0x3c4aa1['uniqueid']),_0x3c4aa1);queues[_0x53b1('0x2e')](_0x3c4aa1);calls[_0x53b1('0x2e')](_0x3c4aa1);}catch(_0x5197e8){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x2d'),_0x3c4aa1[_0x53b1('0x1d')]),_0x5197e8);}});ami['on'](_0x53b1('0x2f'),function(_0x2ee3c1){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x30'),_0x2ee3c1[_0x53b1('0x1d')]),_0x2ee3c1);calls[_0x53b1('0x2f')](_0x2ee3c1);recordings[_0x53b1('0x2f')](_0x2ee3c1);}catch(_0x510fab){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x30'),_0x2ee3c1['uniqueid']),_0x510fab);}});ami['on'](_0x53b1('0x31'),function(_0x526093){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x32'),_0x526093[_0x53b1('0x1d')]),_0x526093);calls[_0x53b1('0x31')](_0x526093);recordings[_0x53b1('0x31')](_0x526093);dials['hangup'](_0x526093);agents[_0x53b1('0x31')](_0x526093);queues[_0x53b1('0x31')](_0x526093);}catch(_0x2e9588){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x32'),_0x526093[_0x53b1('0x1d')]),_0x2e9588);}});ami['on']('cdr',function(_0x3fae45){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][cdr]',_0x3fae45['uniqueid']),_0x3fae45);members['cdr'](_0x3fae45);}catch(_0x10b17f){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')]('[%s][index][cdr]',_0x3fae45[_0x53b1('0x1d')]),_0x10b17f);}});ami['on'](_0x53b1('0x33'),function(_0x13881d){try{utils[_0x53b1('0x17')](util['format']('[%s][index][blindtransfer]',_0x13881d[_0x53b1('0x1d')]),_0x13881d);queues['blindtransfer'](_0x13881d);agents[_0x53b1('0x33')](_0x13881d);transfers[_0x53b1('0x33')](_0x13881d);recordings[_0x53b1('0x33')](_0x13881d);}catch(_0x7d6605){utils[_0x53b1('0x14')](util['format']('[%s][index][blindtransfer]',_0x13881d[_0x53b1('0x1d')]),_0x7d6605);}});ami['on'](_0x53b1('0x34'),function(_0x28ecde){try{utils['debug'](util['format'](_0x53b1('0x35'),_0x28ecde['origtransfereruniqueid']),_0x28ecde);queues[_0x53b1('0x34')](_0x28ecde);transfers[_0x53b1('0x34')](_0x28ecde);agents['attendedtransfer'](_0x28ecde);calls['attendedtransfer'](_0x28ecde);}catch(_0x4326c8){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x35'),_0x28ecde[_0x53b1('0x36')]),_0x4326c8);}});ami['on'](_0x53b1('0x37'),function(_0x1fc3a6){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x38'),_0x1fc3a6[_0x53b1('0x1d')]),_0x1fc3a6);queues[_0x53b1('0x37')](_0x1fc3a6);recordings[_0x53b1('0x37')](_0x1fc3a6);calls[_0x53b1('0x37')](_0x1fc3a6);dials[_0x53b1('0x37')](_0x1fc3a6);}catch(_0x17b463){utils['error'](util['format'](_0x53b1('0x38'),_0x1fc3a6[_0x53b1('0x1d')]),_0x17b463);}});ami['on'](_0x53b1('0x39'),function(_0x467c0f){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][newexten]',_0x467c0f[_0x53b1('0x1d')]),_0x467c0f);calls[_0x53b1('0x39')](_0x467c0f);recordings[_0x53b1('0x39')](_0x467c0f);dials[_0x53b1('0x39')](_0x467c0f);}catch(_0x5c3509){utils[_0x53b1('0x14')](util['format'](_0x53b1('0x3a'),_0x467c0f[_0x53b1('0x1d')]),_0x5c3509);}});ami['on'](_0x53b1('0x3b'),function(_0x3cf2ca){try{utils['debug'](util[_0x53b1('0x1c')]('[%s][index][newchannel]',_0x3cf2ca[_0x53b1('0x1d')]),_0x3cf2ca);calls['newchannel'](_0x3cf2ca);recordings[_0x53b1('0x3b')](_0x3cf2ca);}catch(_0x3a0c7d){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')]('[%s][index][newchannel]',_0x3cf2ca[_0x53b1('0x1d')]),_0x3a0c7d);}});ami['on']('dialbegin',function(_0x559879){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x3c'),_0x559879['uniqueid']),_0x559879);dials['dialbegin'](_0x559879);}catch(_0x1f5a9d){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x3d'),_0x559879[_0x53b1('0x1d')]),_0x1f5a9d);}});ami['on'](_0x53b1('0x3e'),function(_0x203921){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][dialend]',_0x203921[_0x53b1('0x1d')]),_0x203921);dials[_0x53b1('0x3e')](_0x203921);}catch(_0x371777){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x3f'),_0x203921[_0x53b1('0x1d')]),_0x371777);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1e2f9d1..62c209b 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 _0xacea=['agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','type','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','error','format','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','isNil','exitAt','duration','diffTime','enterAt'];(function(_0x32c8d3,_0x56d831){var _0x195f57=function(_0x3dd177){while(--_0x3dd177){_0x32c8d3['push'](_0x32c8d3['shift']());}};_0x195f57(++_0x56d831);}(_0xacea,0x138));var _0xaace=function(_0x209b18,_0x57bd31){_0x209b18=_0x209b18-0x0;var _0x460819=_0xacea[_0x209b18];return _0x460819;};'use strict';var _=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var utils=require(_0xaace('0x2'));var members={};var exclude=[_0xaace('0x3'),'Queue:'];function writeDB(_0x1d0aca){utils[_0xaace('0x4')](util['format'](_0xaace('0x5'),_0x1d0aca[_0xaace('0x6')],_0x1d0aca[_0xaace('0x7')],_0x1d0aca[_0xaace('0x8')],_0x1d0aca[_0xaace('0x9')],_0x1d0aca['membername'],_0x1d0aca['type']));if(_0x1d0aca['interface']){utils[_0xaace('0xa')](_0x1d0aca['interface'])[_0xaace('0xb')](function(_0xd25c69){if(_0xd25c69){_0x1d0aca[_0xaace('0xc')]=_0xd25c69[_0xaace('0xd')];_0x1d0aca[_0xaace('0xe')]=_0xd25c69['internal'];utils[_0xaace('0xf')](_0xaace('0x10'),_0x1d0aca);}else{utils[_0xaace('0x11')](_0x1d0aca[_0xaace('0x7')][_0xaace('0x12')]('/')[0x1])[_0xaace('0xb')](function(_0x2d93e6){if(_0x2d93e6){_0x1d0aca[_0xaace('0xc')]=_0x2d93e6[_0xaace('0xd')];_0x1d0aca[_0xaace('0xe')]=_0x2d93e6[_0xaace('0xe')];utils[_0xaace('0xf')]('CreateMemberReport',_0x1d0aca);}});}})['catch'](function(_0x1adcc3){utils[_0xaace('0x13')](util[_0xaace('0x14')]('[%s][members][writeDB]',_0x1d0aca[_0xaace('0x6')]),_0x1adcc3);});}delete members[_0x1d0aca[_0xaace('0x7')]];}function startsWith(_0x5ec584,_0xbb27b3){return _[_0xaace('0x15')](_0x5ec584,function(_0x538a9a){return _[_0xaace('0x16')](_0xbb27b3,_0x538a9a);});}exports[_0xaace('0x17')]=function(_0x142a91){try{utils[_0xaace('0x18')](util[_0xaace('0x14')](_0xaace('0x19'),members[_0x142a91['device']]?members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x6')]:_0x142a91[_0xaace('0x1a')]),_0x142a91);utils[_0xaace('0x4')](util[_0xaace('0x14')](_0xaace('0x1b'),members[_0x142a91[_0xaace('0x1a')]]?members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x6')]:_0x142a91[_0xaace('0x1a')],_0x142a91[_0xaace('0x1c')],_0x142a91[_0xaace('0x1a')]));switch(_0x142a91[_0xaace('0x1c')]){case _0xaace('0x1d'):case'BUSY':if(!startsWith(exclude,_0x142a91[_0xaace('0x1a')])){members[_0x142a91['device']]={'channel':_0xaace('0x1e'),'interface':_0x142a91[_0xaace('0x1a')],'type':_0xaace('0x1f'),'enterAt':utils['now'](),'role':_0xaace('0x20')};}break;case'NOT_INUSE':if(!_[_0xaace('0x21')](members[_0x142a91[_0xaace('0x1a')]])){members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x22')]=utils['now']();members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x23')]=utils[_0xaace('0x24')](members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x22')],members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x25')]);if(members[_0x142a91[_0xaace('0x1a')]]['uniqueid']){writeDB(members[_0x142a91[_0xaace('0x1a')]]);}}break;default:break;}}catch(_0x242598){utils['error'](util['format'](_0xaace('0x19'),members[_0x142a91[_0xaace('0x1a')]]?members[_0x142a91[_0xaace('0x1a')]][_0xaace('0x6')]:_0x142a91[_0xaace('0x1a')]),_0x242598);}};exports[_0xaace('0x26')]=function(_0x31eb8c){try{if(!_[_0xaace('0x21')](members[_0x31eb8c[_0xaace('0x7')]])){utils[_0xaace('0x18')](util[_0xaace('0x14')](_0xaace('0x27'),_0x31eb8c[_0xaace('0x6')]),_0x31eb8c);utils[_0xaace('0x4')](util[_0xaace('0x14')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x31eb8c[_0xaace('0x6')],_0x31eb8c[_0xaace('0x7')],_0x31eb8c[_0xaace('0x28')]));members[_0x31eb8c[_0xaace('0x7')]]=_[_0xaace('0x29')](members[_0x31eb8c[_0xaace('0x7')]],{'data4':_0x31eb8c[_0xaace('0x28')],'uniqueid':_0x31eb8c[_0xaace('0x6')]});}}catch(_0x3f074d){utils[_0xaace('0x13')](util[_0xaace('0x14')](_0xaace('0x27'),_0x31eb8c[_0xaace('0x6')]),_0x3f074d);}};exports[_0xaace('0x2a')]=function(_0x5c9f4b){try{utils[_0xaace('0x18')](util[_0xaace('0x14')](_0xaace('0x2b'),_0x5c9f4b['uniqueid']),_0x5c9f4b);if(_0x5c9f4b[_0xaace('0x8')]){var _0x5cc02d=_0x5c9f4b[_0xaace('0x8')][_0xaace('0x12')]('-')[0x0];if(!_[_0xaace('0x21')](members[_0x5cc02d])){members[_0x5cc02d]=_[_0xaace('0x29')](members[_0x5cc02d],{'data1':members[_0x5cc02d][_0xaace('0x2c')]||_0x5c9f4b[_0xaace('0x2d')],'data2':members[_0x5cc02d]['data2']||_0x5c9f4b[_0xaace('0x2e')],'data3':members[_0x5cc02d][_0xaace('0x2f')]||_0x5c9f4b[_0xaace('0x30')],'uniqueid':members[_0x5cc02d]['uniqueid']||_0x5c9f4b['uniqueid']});utils[_0xaace('0x4')](util[_0xaace('0x14')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5c9f4b[_0xaace('0x6')],members[_0x5cc02d]['data1'],members[_0x5cc02d][_0xaace('0x9')],members[_0x5cc02d]['data3']));if(members[_0x5cc02d]['exitAt']){writeDB(members[_0x5cc02d]);}}}if(_0x5c9f4b[_0xaace('0x31')]){var _0x2f00b8=_0x5c9f4b[_0xaace('0x31')][_0xaace('0x12')]('-')[0x0];if(!_[_0xaace('0x21')](members[_0x2f00b8])){members[_0x2f00b8]=_[_0xaace('0x29')](members[_0x2f00b8],{'data1':members[_0x2f00b8][_0xaace('0x2c')]||_0x5c9f4b[_0xaace('0x2d')],'data2':members[_0x2f00b8][_0xaace('0x9')]||_0x5c9f4b[_0xaace('0x2e')],'data3':members[_0x2f00b8]['data3']||_0x5c9f4b[_0xaace('0x30')],'uniqueid':members[_0x2f00b8][_0xaace('0x6')]||_0x5c9f4b[_0xaace('0x6')]});utils[_0xaace('0x4')](util[_0xaace('0x14')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5c9f4b['uniqueid'],members[_0x2f00b8][_0xaace('0x2c')],members[_0x2f00b8]['data2'],members[_0x2f00b8]['data3']));if(members[_0x2f00b8][_0xaace('0x22')]){writeDB(members[_0x2f00b8]);}}}}catch(_0x16784b){utils[_0xaace('0x13')](util['format'](_0xaace('0x2b'),_0x5c9f4b['uniqueid']),_0x16784b);}}; \ No newline at end of file +var _0x2821=['some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','uniqueid','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','split','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','assign','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','name','CreateMemberReport','error','[%s][members][writeDB]'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x2821,0xc3));var _0x1282=function(_0x403604,_0x26447b){_0x403604=_0x403604-0x0;var _0xed8fc9=_0x2821[_0x403604];return _0xed8fc9;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var utils=require(_0x1282('0x2'));var members={};var exclude=[_0x1282('0x3'),_0x1282('0x4')];function writeDB(_0xabf2ba){utils['info'](util[_0x1282('0x5')](_0x1282('0x6'),_0xabf2ba['uniqueid'],_0xabf2ba[_0x1282('0x7')],_0xabf2ba[_0x1282('0x8')],_0xabf2ba[_0x1282('0x9')],_0xabf2ba[_0x1282('0xa')],_0xabf2ba[_0x1282('0xb')]));if(_0xabf2ba[_0x1282('0x7')]){utils[_0x1282('0xc')](_0xabf2ba['interface'])[_0x1282('0xd')](function(_0x48349c){if(_0x48349c){_0xabf2ba['membername']=_0x48349c['name'];_0xabf2ba[_0x1282('0xe')]=_0x48349c[_0x1282('0xe')];utils[_0x1282('0xf')]('CreateMemberReport',_0xabf2ba);}else{utils[_0x1282('0x10')](_0xabf2ba[_0x1282('0x7')]['split']('/')[0x1])['then'](function(_0x131ae4){if(_0x131ae4){_0xabf2ba[_0x1282('0xa')]=_0x131ae4[_0x1282('0x11')];_0xabf2ba['internal']=_0x131ae4['internal'];utils[_0x1282('0xf')](_0x1282('0x12'),_0xabf2ba);}});}})['catch'](function(_0x1ce472){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x14'),_0xabf2ba['uniqueid']),_0x1ce472);});}delete members[_0xabf2ba[_0x1282('0x7')]];}function startsWith(_0x5a16bf,_0x2af39e){return _[_0x1282('0x15')](_0x5a16bf,function(_0x4fa391){return _[_0x1282('0x16')](_0x2af39e,_0x4fa391);});}exports[_0x1282('0x17')]=function(_0x3bbf61){try{utils['debug'](util[_0x1282('0x5')](_0x1282('0x18'),members[_0x3bbf61[_0x1282('0x19')]]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')]),_0x3bbf61);utils[_0x1282('0x1b')](util[_0x1282('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3bbf61['device']]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')],_0x3bbf61[_0x1282('0x1c')],_0x3bbf61['device']));switch(_0x3bbf61[_0x1282('0x1c')]){case _0x1282('0x1d'):case _0x1282('0x1e'):if(!startsWith(exclude,_0x3bbf61[_0x1282('0x19')])){members[_0x3bbf61[_0x1282('0x19')]]={'channel':_0x1282('0x1f'),'interface':_0x3bbf61[_0x1282('0x19')],'type':_0x1282('0x20'),'enterAt':utils[_0x1282('0x21')](),'role':_0x1282('0x22')};}break;case _0x1282('0x23'):if(!_[_0x1282('0x24')](members[_0x3bbf61['device']])){members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x25')]=utils[_0x1282('0x21')]();members[_0x3bbf61[_0x1282('0x19')]]['duration']=utils[_0x1282('0x26')](members[_0x3bbf61['device']]['exitAt'],members[_0x3bbf61[_0x1282('0x19')]]['enterAt']);if(members[_0x3bbf61['device']][_0x1282('0x1a')]){writeDB(members[_0x3bbf61['device']]);}}break;default:break;}}catch(_0x4f1eac){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x18'),members[_0x3bbf61['device']]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')]),_0x4f1eac);}};exports[_0x1282('0x27')]=function(_0x46a9e0){try{if(!_[_0x1282('0x24')](members[_0x46a9e0[_0x1282('0x7')]])){utils[_0x1282('0x28')](util[_0x1282('0x5')](_0x1282('0x29'),_0x46a9e0[_0x1282('0x1a')]),_0x46a9e0);utils[_0x1282('0x1b')](util[_0x1282('0x5')](_0x1282('0x2a'),_0x46a9e0[_0x1282('0x1a')],_0x46a9e0[_0x1282('0x7')],_0x46a9e0[_0x1282('0x2b')]));members[_0x46a9e0[_0x1282('0x7')]]=_['assign'](members[_0x46a9e0[_0x1282('0x7')]],{'data4':_0x46a9e0[_0x1282('0x2b')],'uniqueid':_0x46a9e0['uniqueid']});}}catch(_0x1c0273){utils[_0x1282('0x13')](util[_0x1282('0x5')]('[%s][members][agentcomplete]',_0x46a9e0['uniqueid']),_0x1c0273);}};exports[_0x1282('0x2c')]=function(_0x1d866b){try{utils[_0x1282('0x28')](util[_0x1282('0x5')]('[%s][members][cdr]',_0x1d866b[_0x1282('0x1a')]),_0x1d866b);if(_0x1d866b[_0x1282('0x8')]){var _0x2f28eb=_0x1d866b['channel'][_0x1282('0x2d')]('-')[0x0];if(!_[_0x1282('0x24')](members[_0x2f28eb])){members[_0x2f28eb]=_['assign'](members[_0x2f28eb],{'data1':members[_0x2f28eb]['data1']||_0x1d866b[_0x1282('0xb')],'data2':members[_0x2f28eb][_0x1282('0x9')]||_0x1d866b[_0x1282('0x2e')],'data3':members[_0x2f28eb]['data3']||_0x1d866b[_0x1282('0x2f')],'uniqueid':members[_0x2f28eb][_0x1282('0x1a')]||_0x1d866b[_0x1282('0x1a')]});utils[_0x1282('0x1b')](util[_0x1282('0x5')](_0x1282('0x30'),_0x1d866b['uniqueid'],members[_0x2f28eb][_0x1282('0x31')],members[_0x2f28eb][_0x1282('0x9')],members[_0x2f28eb][_0x1282('0x32')]));if(members[_0x2f28eb][_0x1282('0x25')]){writeDB(members[_0x2f28eb]);}}}if(_0x1d866b['destinationchannel']){var _0x4b253a=_0x1d866b[_0x1282('0x33')]['split']('-')[0x0];if(!_['isNil'](members[_0x4b253a])){members[_0x4b253a]=_[_0x1282('0x34')](members[_0x4b253a],{'data1':members[_0x4b253a][_0x1282('0x31')]||_0x1d866b[_0x1282('0xb')],'data2':members[_0x4b253a][_0x1282('0x9')]||_0x1d866b[_0x1282('0x2e')],'data3':members[_0x4b253a][_0x1282('0x32')]||_0x1d866b[_0x1282('0x2f')],'uniqueid':members[_0x4b253a][_0x1282('0x1a')]||_0x1d866b[_0x1282('0x1a')]});utils[_0x1282('0x1b')](util['format'](_0x1282('0x30'),_0x1d866b['uniqueid'],members[_0x4b253a][_0x1282('0x31')],members[_0x4b253a][_0x1282('0x9')],members[_0x4b253a][_0x1282('0x32')]));if(members[_0x4b253a]['exitAt']){writeDB(members[_0x4b253a]);}}}}catch(_0x42e601){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x35'),_0x1d866b[_0x1282('0x1a')]),_0x42e601);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index cb36f02..b2367e5 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 _0xf22b=['[%s][queues][varset]','variable','queuestatus','value','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','error','varset'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0xf22b,0x116));var _0xbf22=function(_0x5afae5,_0x438692){_0x5afae5=_0x5afae5-0x0;var _0x4d70fe=_0xf22b[_0x5afae5];return _0x4d70fe;};'use strict';var _=require(_0xbf22('0x0'));var util=require(_0xbf22('0x1'));var utils=require(_0xbf22('0x2'));var queues={};function writeDB(_0x2339f3){utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x5'),_0x2339f3['uniqueid'],_0x2339f3[_0xbf22('0x6')],_0x2339f3[_0xbf22('0x7')],_0x2339f3[_0xbf22('0x8')],_0x2339f3[_0xbf22('0x9')],_0x2339f3['accountcode'],_0x2339f3[_0xbf22('0xa')]));if(_0x2339f3[_0xbf22('0x7')]){utils[_0xbf22('0xb')](_0x2339f3[_0xbf22('0x7')])['then'](function(_0x5187b2){if(_0x5187b2){_0x2339f3[_0xbf22('0xc')]=_0x5187b2[_0xbf22('0xc')];}utils[_0xbf22('0xd')](_0xbf22('0xe'),_0x2339f3);});}else{utils[_0xbf22('0xd')](_0xbf22('0xe'),_0x2339f3);}if(_0x2339f3['transfereduniqueid']){delete queues[_0x2339f3[_0xbf22('0xf')]];}else{delete queues[_0x2339f3[_0xbf22('0x10')]];}}exports['queuecallerjoin']=function(_0x49b90c){try{utils[_0xbf22('0x11')](util[_0xbf22('0x4')](_0xbf22('0x12'),_0x49b90c[_0xbf22('0x10')]),_0x49b90c);utils[_0xbf22('0x3')](util[_0xbf22('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x49b90c[_0xbf22('0x10')],_0x49b90c[_0xbf22('0x7')],_0x49b90c['position']));queues[_0x49b90c[_0xbf22('0x10')]]=_[_0xbf22('0x13')](_0x49b90c,{'originalposition':_0x49b90c['position'],'queuecallerjoinAt':utils[_0xbf22('0x14')](),'mohtime':0x0});}catch(_0x1596af){utils['error'](util[_0xbf22('0x4')]('[%s][queues][queuecallerjoin]',_0x49b90c[_0xbf22('0x10')]),_0x1596af);}};exports[_0xbf22('0x15')]=function(_0x33ae17){try{if(!_[_0xbf22('0x16')](queues[_0x33ae17[_0xbf22('0x10')]])){utils[_0xbf22('0x11')](util[_0xbf22('0x4')](_0xbf22('0x17'),_0x33ae17[_0xbf22('0x10')]),_0x33ae17);if(queues[_0x33ae17['uniqueid']][_0xbf22('0x18')]){if(!queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0x19')]&&!queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0x1a')]){queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0x1b')]=!![];queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0x1c')]=utils['now']();queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0xa')]=_0xbf22('0x1d');}utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x1e'),_0x33ae17[_0xbf22('0x10')],queues[_0x33ae17[_0xbf22('0x10')]]['name'],queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0xa')]));writeDB(queues[_0x33ae17['uniqueid']]);}else if(queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0xf')]){utils[_0xbf22('0x3')](util[_0xbf22('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x33ae17['uniqueid'],queues[_0x33ae17[_0xbf22('0x10')]][_0xbf22('0x1f')],queues[_0x33ae17['uniqueid']][_0xbf22('0xf')]));queues[queues[_0x33ae17['uniqueid']][_0xbf22('0xf')]]=queues[_0x33ae17[_0xbf22('0x10')]];queues[queues[_0x33ae17[_0xbf22('0x10')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x33ae17[_0xbf22('0x10')]];}}}catch(_0x2eb427){utils[_0xbf22('0x20')](util[_0xbf22('0x4')](_0xbf22('0x17'),_0x33ae17[_0xbf22('0x10')]),_0x2eb427);}};exports[_0xbf22('0x21')]=function(_0x47afe6){try{utils[_0xbf22('0x11')](util[_0xbf22('0x4')](_0xbf22('0x22'),_0x47afe6[_0xbf22('0x10')]),_0x47afe6);if(!_['isNil'](_0x47afe6[_0xbf22('0x23')][_0xbf22('0x24')])&&_0x47afe6[_0xbf22('0x25')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xbf22('0x16')](queues[_0x47afe6[_0xbf22('0x10')]])){queues[_0x47afe6['uniqueid']][_0xbf22('0x19')]=![];queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0x26')]=null;queues[_0x47afe6['uniqueid']][_0xbf22('0x1a')]=!![];queues[_0x47afe6['uniqueid']]['queuecallerexitAt']=utils[_0xbf22('0x14')]();queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0xa')]=_0x47afe6[_0xbf22('0x25')]['toUpperCase']();utils['info'](util[_0xbf22('0x4')](_0xbf22('0x27'),_0x47afe6[_0xbf22('0x10')],queues[_0x47afe6['uniqueid']][_0xbf22('0x1f')],_0x47afe6[_0xbf22('0x25')],queues[_0x47afe6[_0xbf22('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x47afe6[_0xbf22('0x10')]]);}}else if(!_[_0xbf22('0x16')](_0x47afe6['variable']['queueposition'])){if(!_[_0xbf22('0x16')](queues[_0x47afe6[_0xbf22('0x10')]])&&!queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0x19')]){queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0x19')]=![];queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0x26')]=null;queues[_0x47afe6['uniqueid']][_0xbf22('0x1a')]=!![];queues[_0x47afe6[_0xbf22('0x10')]]['queuecallerexitAt']=utils[_0xbf22('0x14')]();queues[_0x47afe6['uniqueid']][_0xbf22('0xa')]='EXITWITHKEY';utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x28'),_0x47afe6['uniqueid'],queues[_0x47afe6[_0xbf22('0x10')]]['name'],_0x47afe6[_0xbf22('0x25')],queues[_0x47afe6[_0xbf22('0x10')]][_0xbf22('0xa')]));}}}catch(_0x11f20a){utils[_0xbf22('0x20')](util[_0xbf22('0x4')]('[%s][queues][varset]',_0x47afe6[_0xbf22('0x10')]),_0x11f20a);}};exports[_0xbf22('0x19')]=function(_0x4e8ecf){try{if(!_[_0xbf22('0x16')](queues[_0x4e8ecf[_0xbf22('0x10')]])){utils[_0xbf22('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x4e8ecf[_0xbf22('0x10')]),_0x4e8ecf);queues[_0x4e8ecf[_0xbf22('0x10')]][_0xbf22('0x1a')]=![];queues[_0x4e8ecf[_0xbf22('0x10')]][_0xbf22('0x29')]=null;queues[_0x4e8ecf[_0xbf22('0x10')]][_0xbf22('0x19')]=!![];queues[_0x4e8ecf['uniqueid']][_0xbf22('0x26')]=utils[_0xbf22('0x14')]();queues[_0x4e8ecf[_0xbf22('0x10')]][_0xbf22('0xa')]=_0xbf22('0x2a');utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x2b'),_0x4e8ecf[_0xbf22('0x10')],queues[_0x4e8ecf['uniqueid']][_0xbf22('0x1f')],queues[_0x4e8ecf[_0xbf22('0x10')]]['queuecallerexitreason']));}}catch(_0x3306e8){utils[_0xbf22('0x20')](util['format'](_0xbf22('0x2c'),_0x4e8ecf[_0xbf22('0x10')]),_0x3306e8);}};exports[_0xbf22('0x2d')]=function(_0x3de905){try{if(!_['isNil'](queues[_0x3de905[_0xbf22('0x10')]])){utils[_0xbf22('0x11')](util['format'](_0xbf22('0x2e'),_0x3de905[_0xbf22('0x10')]),_0x3de905);utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x2f'),_0x3de905[_0xbf22('0x10')],queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x1f')],_0x3de905[_0xbf22('0x30')],_0x3de905[_0xbf22('0x31')]));queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x2d')]=!![];queues[_0x3de905['uniqueid']][_0xbf22('0x18')]=utils[_0xbf22('0x14')]();queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x32')]=utils[_0xbf22('0x33')](queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x18')],queues[_0x3de905['uniqueid']]['queuecallerjoinAt']);queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x34')]=_0x3de905['position'];queues[_0x3de905[_0xbf22('0x10')]]['count']=_0x3de905[_0xbf22('0x35')];queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x30')]=_0x3de905['connectedlinenum'];queues[_0x3de905[_0xbf22('0x10')]][_0xbf22('0x31')]=_0x3de905[_0xbf22('0x31')];}}catch(_0x4c1e00){utils[_0xbf22('0x20')](util['format'](_0xbf22('0x2e'),_0x3de905[_0xbf22('0x10')]),_0x4c1e00);}};exports[_0xbf22('0x36')]=function(_0x2ce286){try{if(!_[_0xbf22('0x16')](queues[_0x2ce286[_0xbf22('0x10')]])){utils[_0xbf22('0x11')](util[_0xbf22('0x4')](_0xbf22('0x37'),_0x2ce286[_0xbf22('0x10')]),_0x2ce286);utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x38'),_0x2ce286[_0xbf22('0x10')],queues[_0x2ce286[_0xbf22('0x10')]][_0xbf22('0x1f')],_0x2ce286[_0xbf22('0x39')],_0x2ce286[_0xbf22('0x3a')]));queues[_0x2ce286[_0xbf22('0x10')]][_0xbf22('0x19')]=![];queues[_0x2ce286[_0xbf22('0x10')]][_0xbf22('0x19')]=![];queues[_0x2ce286['uniqueid']][_0xbf22('0x26')]=null;queues[_0x2ce286[_0xbf22('0x10')]]['queuecallerexit']=![];queues[_0x2ce286[_0xbf22('0x10')]]['queuecallerexitreason']=null;queues[_0x2ce286[_0xbf22('0x10')]][_0xbf22('0x29')]=null;queues[_0x2ce286['uniqueid']][_0xbf22('0x3b')]=!![];queues[_0x2ce286['uniqueid']][_0xbf22('0x3c')]=_0x2ce286['destaccountcode'];queues[_0x2ce286[_0xbf22('0x10')]]['lastAssignedTo']=_0x2ce286[_0xbf22('0x39')];}}catch(_0x54e09b){utils[_0xbf22('0x20')](util[_0xbf22('0x4')](_0xbf22('0x37'),_0x2ce286[_0xbf22('0x10')]),_0x54e09b);}};exports[_0xbf22('0x3d')]=function(_0x37c034){try{if(!_[_0xbf22('0x16')](queues[_0x37c034[_0xbf22('0x10')]])){if(queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x18')]){utils['debug'](util['format'](_0xbf22('0x3e'),_0x37c034[_0xbf22('0x10')]),_0x37c034);queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x19')]=![];queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x19')]=![];queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x26')]=null;queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x1a')]=![];queues[_0x37c034['uniqueid']][_0xbf22('0x29')]=null;queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x3b')]=!![];queues[_0x37c034['uniqueid']][_0xbf22('0x8')]=_0x37c034[_0xbf22('0x39')];queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x1b')]=!![];queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x1c')]=utils[_0xbf22('0x14')]();if(_0x37c034['reason']==_0xbf22('0x3f')){if(!queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x3f')]){queues[_0x37c034[_0xbf22('0x10')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0xa')]=_0xbf22('0x40')+_0x37c034[_0xbf22('0x41')][_0xbf22('0x42')]();}utils[_0xbf22('0x3')](util['format'](_0xbf22('0x43'),_0x37c034[_0xbf22('0x10')],queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0x1f')],_0x37c034[_0xbf22('0x39')],queues[_0x37c034[_0xbf22('0x10')]][_0xbf22('0xa')]));writeDB(queues[_0x37c034[_0xbf22('0x10')]]);}}}catch(_0x39d80c){utils[_0xbf22('0x20')](util['format'](_0xbf22('0x3e'),_0x37c034[_0xbf22('0x10')]),_0x39d80c);}};exports[_0xbf22('0x44')]=function(_0xd49d47){try{if(!_[_0xbf22('0x16')](queues[_0xd49d47[_0xbf22('0x45')]])){utils[_0xbf22('0x11')](util[_0xbf22('0x4')]('[%s][queues][blindtransfer]',_0xd49d47[_0xbf22('0x10')]),_0xd49d47);queues[_0xd49d47[_0xbf22('0x45')]][_0xbf22('0x3f')]=!![];queues[_0xd49d47[_0xbf22('0x45')]][_0xbf22('0x46')]=_0xbf22('0x47');queues[_0xd49d47[_0xbf22('0x45')]]['transferexten']=_0xd49d47[_0xbf22('0x48')];queues[_0xd49d47[_0xbf22('0x45')]]['transferuniqueid']=_0xd49d47[_0xbf22('0x45')];queues[_0xd49d47[_0xbf22('0x45')]][_0xbf22('0xa')]='BLINDTRANSFER';utils[_0xbf22('0x3')](util['format'](_0xbf22('0x49'),_0xd49d47['uniqueid'],queues[_0xd49d47[_0xbf22('0x45')]]['name'],_0xd49d47[_0xbf22('0x45')],_0xd49d47[_0xbf22('0x48')]));}}catch(_0x13f0f6){utils[_0xbf22('0x20')](util['format']('[%s][queues][blindtransfer]',_0xd49d47[_0xbf22('0x10')]),_0x13f0f6);}};exports[_0xbf22('0x4a')]=function(_0x1f6b13){try{utils[_0xbf22('0x11')](util[_0xbf22('0x4')](_0xbf22('0x4b'),_0x1f6b13['origtransfereruniqueid']),_0x1f6b13);if(_0x1f6b13[_0xbf22('0x4c')]==_0x1f6b13['origtransfererlinkedid']){if(!_['isNil'](queues[_0x1f6b13[_0xbf22('0x4d')]])){utils[_0xbf22('0x3')](util['format'](_0xbf22('0x4e'),_0x1f6b13['origtransfereruniqueid'],queues[_0x1f6b13[_0xbf22('0x4d')]]['name'],_0x1f6b13[_0xbf22('0x4f')]));queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0x3f')]=!![];queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0x46')]=_0xbf22('0x50');queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0x51')]=_0x1f6b13[_0xbf22('0x4f')];queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0x52')]=_0x1f6b13[_0xbf22('0x4c')];queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0xa')]=_0xbf22('0x53');}if(!_['isNil'](queues[_0x1f6b13[_0xbf22('0x54')]])){if(_0x1f6b13[_0xbf22('0x55')]&&queues[_0x1f6b13['transfereelinkedid']]){queues[_0x1f6b13[_0xbf22('0x55')]][_0xbf22('0x56')]=0x1;queues[_0x1f6b13[_0xbf22('0x45')]]=_[_0xbf22('0x57')](queues[_0x1f6b13['transfereelinkedid']]);queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0xf')]=_0x1f6b13[_0xbf22('0x58')];queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x56')]=0x2;queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x9')]=queues[_0x1f6b13[_0xbf22('0x4d')]]['calleridnum'];queues[_0x1f6b13['transfereeuniqueid']]['calleridname']=queues[_0x1f6b13['secondtransfererlinkedid']][_0xbf22('0x59')];queues[_0x1f6b13['transfereeuniqueid']][_0xbf22('0x5a')]=utils[_0xbf22('0x14')]();queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x18')]=utils[_0xbf22('0x14')]();queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x32')]=0x0;queues[_0x1f6b13[_0xbf22('0x45')]]['mohtime']=0x0;utils[_0xbf22('0x3')](util[_0xbf22('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1f6b13[_0xbf22('0x4c')],queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x1f')],queues[_0x1f6b13[_0xbf22('0x45')]][_0xbf22('0x9')],queues[_0x1f6b13['transfereeuniqueid']][_0xbf22('0x59')]));}else{utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x5b'),_0x1f6b13[_0xbf22('0x4c')],queues[_0x1f6b13[_0xbf22('0x54')]][_0xbf22('0x1f')],_0x1f6b13['secondtransfererlinkedid']));queues[_0x1f6b13[_0xbf22('0x54')]][_0xbf22('0xf')]=_0x1f6b13[_0xbf22('0x4d')];}}}else if(_0x1f6b13[_0xbf22('0x5c')]==_0x1f6b13[_0xbf22('0x4d')]){if(!_['isNil'](queues[_0x1f6b13[_0xbf22('0x54')]])){utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x5d'),_0x1f6b13[_0xbf22('0x4c')],queues[_0x1f6b13[_0xbf22('0x54')]][_0xbf22('0x1f')],_0x1f6b13[_0xbf22('0x5c')],_0x1f6b13[_0xbf22('0x5e')]));queues[_0x1f6b13['origtransfererlinkedid']][_0xbf22('0x3f')]=!![];queues[_0x1f6b13[_0xbf22('0x54')]][_0xbf22('0x46')]=_0xbf22('0x50');queues[_0x1f6b13[_0xbf22('0x54')]]['transferexten']=_0x1f6b13[_0xbf22('0x5e')];queues[_0x1f6b13[_0xbf22('0x54')]]['transferuniqueid']=_0x1f6b13['secondtransfereruniqueid'];queues[_0x1f6b13[_0xbf22('0x54')]][_0xbf22('0xa')]='ATTENDEDTRANSFER';}if(!_[_0xbf22('0x16')](queues[_0x1f6b13[_0xbf22('0x4d')]])){if(_0x1f6b13[_0xbf22('0x5f')]&&queues[_0x1f6b13['transfertargetlinkedid']]){queues[_0x1f6b13[_0xbf22('0x5f')]][_0xbf22('0x56')]=0x1;queues[_0x1f6b13[_0xbf22('0x58')]]=_[_0xbf22('0x57')](queues[_0x1f6b13[_0xbf22('0x5f')]]);queues[_0x1f6b13['transfertargetuniqueid']][_0xbf22('0xf')]=_0x1f6b13[_0xbf22('0x58')];queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x56')]=0x2;queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x9')]=queues[_0x1f6b13[_0xbf22('0x54')]]['calleridnum'];queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x59')]=queues[_0x1f6b13['origtransfererlinkedid']][_0xbf22('0x59')];queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x5a')]=utils[_0xbf22('0x14')]();queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x18')]=utils['now']();queues[_0x1f6b13['transfertargetuniqueid']][_0xbf22('0x32')]=0x0;queues[_0x1f6b13['transfertargetuniqueid']][_0xbf22('0x60')]=0x0;utils['info'](util['format'](_0xbf22('0x61'),_0x1f6b13[_0xbf22('0x4c')],queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x1f')],queues[_0x1f6b13['transfertargetuniqueid']][_0xbf22('0xf')],queues[_0x1f6b13[_0xbf22('0x58')]][_0xbf22('0x9')],queues[_0x1f6b13[_0xbf22('0x58')]]['calleridname']));}else{utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x5b'),_0x1f6b13[_0xbf22('0x4c')],queues[_0x1f6b13[_0xbf22('0x4d')]][_0xbf22('0x1f')],_0x1f6b13['origtransfererlinkedid']));queues[_0x1f6b13['secondtransfererlinkedid']][_0xbf22('0xf')]=_0x1f6b13['origtransfererlinkedid'];}}}}catch(_0x550fec){utils[_0xbf22('0x20')](util[_0xbf22('0x4')]('[%s][queues][attendedtransfer]',_0x1f6b13[_0xbf22('0x4c')]),_0x550fec);}};exports[_0xbf22('0x62')]=function(_0x22d562){try{if(!_[_0xbf22('0x16')](queues[_0x22d562[_0xbf22('0x10')]])){utils[_0xbf22('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x22d562[_0xbf22('0x10')]),_0x22d562);queues[_0x22d562[_0xbf22('0x10')]]['musiconholdstartAt']=utils[_0xbf22('0x14')]();utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x63'),_0x22d562['uniqueid'],queues[_0x22d562[_0xbf22('0x10')]][_0xbf22('0x1f')],queues[_0x22d562[_0xbf22('0x10')]]['musiconholdstartAt']));}}catch(_0x56020f){utils[_0xbf22('0x20')](util[_0xbf22('0x4')](_0xbf22('0x64'),_0x22d562['uniqueid']),_0x56020f);}};exports['musiconholdstop']=function(_0x516581){try{if(!_[_0xbf22('0x16')](queues[_0x516581['uniqueid']])){if(!_['isNil'](queues[_0x516581['uniqueid']][_0xbf22('0x65')])){utils['debug'](util[_0xbf22('0x4')]('[%s][queues][musiconholdstop]',_0x516581['uniqueid']),_0x516581);queues[_0x516581[_0xbf22('0x10')]][_0xbf22('0x60')]+=utils[_0xbf22('0x33')](utils[_0xbf22('0x14')](),queues[_0x516581[_0xbf22('0x10')]][_0xbf22('0x65')]);utils[_0xbf22('0x3')](util[_0xbf22('0x4')](_0xbf22('0x66'),_0x516581[_0xbf22('0x10')],queues[_0x516581[_0xbf22('0x10')]]['name'],queues[_0x516581[_0xbf22('0x10')]][_0xbf22('0x60')]));delete queues[_0x516581['uniqueid']]['musiconholdstartAt'];}}}catch(_0x559de8){utils['error'](util[_0xbf22('0x4')](_0xbf22('0x67'),_0x516581[_0xbf22('0x10')]),_0x559de8);}}; \ No newline at end of file +var _0x812e=['extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','transfertargetlinkedid','[%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]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','uniqueid','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','isNil','queuecallerexitAt','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','membername','assigned','destaccountcode','[%s][queues][agentconnect]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x812e,0x161));var _0xe812=function(_0x16ee22,_0x3c5612){_0x16ee22=_0x16ee22-0x0;var _0x4cc4e6=_0x812e[_0x16ee22];return _0x4cc4e6;};'use strict';var _=require(_0xe812('0x0'));var util=require(_0xe812('0x1'));var utils=require(_0xe812('0x2'));var queues={};function writeDB(_0x52a01e){utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x5'),_0x52a01e['uniqueid'],_0x52a01e[_0xe812('0x6')],_0x52a01e[_0xe812('0x7')],_0x52a01e[_0xe812('0x8')],_0x52a01e[_0xe812('0x9')],_0x52a01e[_0xe812('0xa')],_0x52a01e[_0xe812('0xb')]));if(_0x52a01e[_0xe812('0x7')]){utils[_0xe812('0xc')](_0x52a01e[_0xe812('0x7')])['then'](function(_0x5d847f){if(_0x5d847f){_0x52a01e[_0xe812('0xd')]=_0x5d847f[_0xe812('0xd')];}utils[_0xe812('0xe')](_0xe812('0xf'),_0x52a01e);});}else{utils[_0xe812('0xe')](_0xe812('0xf'),_0x52a01e);}if(_0x52a01e[_0xe812('0x10')]){delete queues[_0x52a01e[_0xe812('0x10')]];}else{delete queues[_0x52a01e['uniqueid']];}}exports[_0xe812('0x11')]=function(_0x99ba55){try{utils['debug'](util[_0xe812('0x4')](_0xe812('0x12'),_0x99ba55['uniqueid']),_0x99ba55);utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x13'),_0x99ba55['uniqueid'],_0x99ba55[_0xe812('0x7')],_0x99ba55['position']));queues[_0x99ba55['uniqueid']]=_[_0xe812('0x14')](_0x99ba55,{'originalposition':_0x99ba55['position'],'queuecallerjoinAt':utils[_0xe812('0x15')](),'mohtime':0x0});}catch(_0x20313e){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x12'),_0x99ba55[_0xe812('0x17')]),_0x20313e);}};exports[_0xe812('0x18')]=function(_0x3c0b26){try{if(!_['isNil'](queues[_0x3c0b26[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x1a'),_0x3c0b26[_0xe812('0x17')]),_0x3c0b26);if(queues[_0x3c0b26['uniqueid']][_0xe812('0x1b')]){if(!queues[_0x3c0b26['uniqueid']][_0xe812('0x1c')]&&!queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x1d')]){queues[_0x3c0b26['uniqueid']][_0xe812('0x1e')]=!![];queues[_0x3c0b26['uniqueid']][_0xe812('0x1f')]=utils[_0xe812('0x15')]();queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x20');}utils[_0xe812('0x3')](util['format'](_0xe812('0x21'),_0x3c0b26[_0xe812('0x17')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0xb')]));writeDB(queues[_0x3c0b26['uniqueid']]);}else if(queues[_0x3c0b26[_0xe812('0x17')]]['transfereduniqueid']){utils['info'](util[_0xe812('0x4')](_0xe812('0x23'),_0x3c0b26[_0xe812('0x17')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x3c0b26['uniqueid']][_0xe812('0x10')]));queues[queues[_0x3c0b26[_0xe812('0x17')]]['transfereduniqueid']]=queues[_0x3c0b26[_0xe812('0x17')]];queues[queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x10')]][_0xe812('0x24')]=0x2;delete queues[_0x3c0b26[_0xe812('0x17')]];}}}catch(_0x360dd6){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x1a'),_0x3c0b26[_0xe812('0x17')]),_0x360dd6);}};exports[_0xe812('0x25')]=function(_0x17e692){try{utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x26'),_0x17e692[_0xe812('0x17')]),_0x17e692);if(!_['isNil'](_0x17e692[_0xe812('0x27')][_0xe812('0x28')])&&_0x17e692[_0xe812('0x29')][_0xe812('0x2a')]()!=='CONTINUE'){if(!_[_0xe812('0x2b')](queues[_0x17e692['uniqueid']])){queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0x17e692[_0xe812('0x17')]]['queuecallerabandonAt']=null;queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1d')]=!![];queues[_0x17e692['uniqueid']][_0xe812('0x2c')]=utils[_0xe812('0x15')]();queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]=_0x17e692['value']['toUpperCase']();utils[_0xe812('0x3')](util[_0xe812('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x17e692[_0xe812('0x17')],queues[_0x17e692['uniqueid']][_0xe812('0x22')],_0x17e692[_0xe812('0x29')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]));writeDB(queues[_0x17e692['uniqueid']]);}}else if(!_[_0xe812('0x2b')](_0x17e692['variable']['queueposition'])){if(!_['isNil'](queues[_0x17e692[_0xe812('0x17')]])&&!queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1c')]){queues[_0x17e692['uniqueid']][_0xe812('0x1c')]=![];queues[_0x17e692['uniqueid']][_0xe812('0x2d')]=null;queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1d')]=!![];queues[_0x17e692['uniqueid']][_0xe812('0x2c')]=utils['now']();queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x2e');utils['info'](util['format'](_0xe812('0x2f'),_0x17e692[_0xe812('0x17')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x22')],_0x17e692[_0xe812('0x29')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]));}}}catch(_0x503231){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x26'),_0x17e692[_0xe812('0x17')]),_0x503231);}};exports['queuecallerabandon']=function(_0x23ed9e){try{if(!_[_0xe812('0x2b')](queues[_0x23ed9e['uniqueid']])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][queuecallerabandon]',_0x23ed9e[_0xe812('0x17')]),_0x23ed9e);queues[_0x23ed9e['uniqueid']][_0xe812('0x1d')]=![];queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0x2c')]=null;queues[_0x23ed9e['uniqueid']]['queuecallerabandon']=!![];queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0x2d')]=utils[_0xe812('0x15')]();queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x30');utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x31'),_0x23ed9e[_0xe812('0x17')],queues[_0x23ed9e[_0xe812('0x17')]]['name'],queues[_0x23ed9e['uniqueid']][_0xe812('0xb')]));}}catch(_0x92ff61){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x32'),_0x23ed9e[_0xe812('0x17')]),_0x92ff61);}};exports['queuecallerleave']=function(_0x40d6fa){try{if(!_[_0xe812('0x2b')](queues[_0x40d6fa[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x33'),_0x40d6fa['uniqueid']),_0x40d6fa);utils[_0xe812('0x3')](util['format'](_0xe812('0x34'),_0x40d6fa[_0xe812('0x17')],queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x22')],_0x40d6fa['connectedlinenum'],_0x40d6fa['connectedlinename']));queues[_0x40d6fa[_0xe812('0x17')]]['queuecallerleave']=!![];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x1b')]=utils[_0xe812('0x15')]();queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x35')]=utils[_0xe812('0x36')](queues[_0x40d6fa[_0xe812('0x17')]]['queuecallerleaveAt'],queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x37')]);queues[_0x40d6fa[_0xe812('0x17')]]['position']=_0x40d6fa[_0xe812('0x38')];queues[_0x40d6fa['uniqueid']][_0xe812('0x39')]=_0x40d6fa[_0xe812('0x39')];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x3a')]=_0x40d6fa[_0xe812('0x3a')];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x3b')]=_0x40d6fa[_0xe812('0x3b')];}}catch(_0x1c714b){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x33'),_0x40d6fa[_0xe812('0x17')]),_0x1c714b);}};exports['agentconnect']=function(_0x20b194){try{if(!_[_0xe812('0x2b')](queues[_0x20b194[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][agentconnect]',_0x20b194[_0xe812('0x17')]),_0x20b194);utils[_0xe812('0x3')](util[_0xe812('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x20b194[_0xe812('0x17')],queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x22')],_0x20b194[_0xe812('0x3c')],_0x20b194['destaccountcode']));queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0x20b194[_0xe812('0x17')]]['queuecallerabandon']=![];queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x2d')]=null;queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x1d')]=![];queues[_0x20b194['uniqueid']][_0xe812('0xb')]=null;queues[_0x20b194['uniqueid']][_0xe812('0x2c')]=null;queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x3d')]=!![];queues[_0x20b194['uniqueid']]['accountcode']=_0x20b194[_0xe812('0x3e')];queues[_0x20b194['uniqueid']][_0xe812('0x8')]=_0x20b194[_0xe812('0x3c')];}}catch(_0x5d5c18){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x3f'),_0x20b194[_0xe812('0x17')]),_0x5d5c18);}};exports['agentcomplete']=function(_0xcf8cee){try{if(!_['isNil'](queues[_0xcf8cee[_0xe812('0x17')]])){if(queues[_0xcf8cee['uniqueid']][_0xe812('0x1b')]){utils[_0xe812('0x19')](util['format']('[%s][queues][agentcomplete]',_0xcf8cee[_0xe812('0x17')]),_0xcf8cee);queues[_0xcf8cee[_0xe812('0x17')]]['queuecallerabandon']=![];queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0xcf8cee['uniqueid']][_0xe812('0x2d')]=null;queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x1d')]=![];queues[_0xcf8cee['uniqueid']][_0xe812('0x2c')]=null;queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x3d')]=!![];queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x8')]=_0xcf8cee['membername'];queues[_0xcf8cee['uniqueid']][_0xe812('0x1e')]=!![];queues[_0xcf8cee['uniqueid']][_0xe812('0x1f')]=utils[_0xe812('0x15')]();if(_0xcf8cee[_0xe812('0x40')]==_0xe812('0x41')){if(!queues[_0xcf8cee['uniqueid']][_0xe812('0x41')]){queues[_0xcf8cee['uniqueid']][_0xe812('0xb')]=_0xe812('0x42');}}else{queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x43')+_0xcf8cee[_0xe812('0x40')]['toUpperCase']();}utils['info'](util[_0xe812('0x4')](_0xe812('0x44'),_0xcf8cee[_0xe812('0x17')],queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x22')],_0xcf8cee[_0xe812('0x3c')],queues[_0xcf8cee[_0xe812('0x17')]]['queuecallerexitreason']));writeDB(queues[_0xcf8cee[_0xe812('0x17')]]);}}}catch(_0x37e504){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x45'),_0xcf8cee[_0xe812('0x17')]),_0x37e504);}};exports[_0xe812('0x46')]=function(_0x212f20){try{if(!_[_0xe812('0x2b')](queues[_0x212f20[_0xe812('0x47')]])){utils[_0xe812('0x19')](util['format'](_0xe812('0x48'),_0x212f20[_0xe812('0x17')]),_0x212f20);queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x41')]=!![];queues[_0x212f20['transfereeuniqueid']][_0xe812('0x49')]=_0xe812('0x4a');queues[_0x212f20[_0xe812('0x47')]]['transferexten']=_0x212f20[_0xe812('0x4b')];queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x4c')]=_0x212f20['transfereeuniqueid'];queues[_0x212f20[_0xe812('0x47')]][_0xe812('0xb')]=_0xe812('0x4d');utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x4e'),_0x212f20[_0xe812('0x17')],queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x22')],_0x212f20[_0xe812('0x47')],_0x212f20[_0xe812('0x4b')]));}}catch(_0x2fe3ae){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x48'),_0x212f20['uniqueid']),_0x2fe3ae);}};exports[_0xe812('0x4f')]=function(_0x320efe){try{utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x50'),_0x320efe[_0xe812('0x51')]),_0x320efe);if(_0x320efe['origtransfereruniqueid']==_0x320efe[_0xe812('0x52')]){if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x53')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x22')],_0x320efe['origtransfererexten']));queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x41')]=!![];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x49')]=_0xe812('0x54');queues[_0x320efe[_0xe812('0x53')]]['transferexten']=_0x320efe[_0xe812('0x55')];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x4c')]=_0x320efe[_0xe812('0x51')];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0xb')]=_0xe812('0x56');}if(!_[_0xe812('0x2b')](queues[_0x320efe['origtransfererlinkedid']])){if(_0x320efe[_0xe812('0x57')]&&queues[_0x320efe[_0xe812('0x57')]]){queues[_0x320efe[_0xe812('0x57')]][_0xe812('0x24')]=0x1;queues[_0x320efe['transfereeuniqueid']]=_[_0xe812('0x58')](queues[_0x320efe[_0xe812('0x57')]]);queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x59')];queues[_0x320efe['transfereeuniqueid']][_0xe812('0x24')]=0x2;queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x9')]=queues[_0x320efe['secondtransfererlinkedid']][_0xe812('0x9')];queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x5a')]=queues[_0x320efe[_0xe812('0x53')]]['calleridname'];queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x37')]=utils[_0xe812('0x15')]();queues[_0x320efe[_0xe812('0x47')]]['queuecallerleaveAt']=utils['now']();queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x35')]=0x0;queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x5b')]=0x0;utils['info'](util[_0xe812('0x4')](_0xe812('0x5c'),_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x22')],queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x9')],queues[_0x320efe['transfereeuniqueid']][_0xe812('0x5a')]));}else{utils['info'](util[_0xe812('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x22')],_0x320efe[_0xe812('0x53')]));queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x10')]=_0x320efe['secondtransfererlinkedid'];}}}else if(_0x320efe[_0xe812('0x5d')]==_0x320efe['secondtransfererlinkedid']){if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x52')]])){utils[_0xe812('0x3')](util['format'](_0xe812('0x5e'),_0x320efe[_0xe812('0x51')],queues[_0x320efe['origtransfererlinkedid']][_0xe812('0x22')],_0x320efe[_0xe812('0x5d')],_0x320efe[_0xe812('0x5f')]));queues[_0x320efe[_0xe812('0x52')]]['transfer']=!![];queues[_0x320efe['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x60')]=_0x320efe[_0xe812('0x5f')];queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x4c')]=_0x320efe[_0xe812('0x5d')];queues[_0x320efe[_0xe812('0x52')]][_0xe812('0xb')]='ATTENDEDTRANSFER';}if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x53')]])){if(_0x320efe[_0xe812('0x61')]&&queues[_0x320efe[_0xe812('0x61')]]){queues[_0x320efe[_0xe812('0x61')]]['queuecallerenterreason']=0x1;queues[_0x320efe[_0xe812('0x59')]]=_[_0xe812('0x58')](queues[_0x320efe[_0xe812('0x61')]]);queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x59')];queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x24')]=0x2;queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x9')]=queues[_0x320efe['origtransfererlinkedid']][_0xe812('0x9')];queues[_0x320efe[_0xe812('0x59')]]['calleridname']=queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x5a')];queues[_0x320efe['transfertargetuniqueid']][_0xe812('0x37')]=utils[_0xe812('0x15')]();queues[_0x320efe['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xe812('0x15')]();queues[_0x320efe[_0xe812('0x59')]]['holdtime']=0x0;queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x5b')]=0x0;utils[_0xe812('0x3')](util['format'](_0xe812('0x62'),_0x320efe[_0xe812('0x51')],queues[_0x320efe['transfertargetuniqueid']]['name'],queues[_0x320efe[_0xe812('0x59')]]['transfereduniqueid'],queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x9')],queues[_0x320efe['transfertargetuniqueid']][_0xe812('0x5a')]));}else{utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x63'),_0x320efe['origtransfereruniqueid'],queues[_0x320efe['secondtransfererlinkedid']][_0xe812('0x22')],_0x320efe['origtransfererlinkedid']));queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x52')];}}}}catch(_0x29ed04){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x320efe[_0xe812('0x51')]),_0x29ed04);}};exports[_0xe812('0x64')]=function(_0x1dafaf){try{if(!_[_0xe812('0x2b')](queues[_0x1dafaf['uniqueid']])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][musiconholdstart]',_0x1dafaf[_0xe812('0x17')]),_0x1dafaf);queues[_0x1dafaf[_0xe812('0x17')]][_0xe812('0x65')]=utils[_0xe812('0x15')]();utils[_0xe812('0x3')](util['format'](_0xe812('0x66'),_0x1dafaf[_0xe812('0x17')],queues[_0x1dafaf['uniqueid']]['name'],queues[_0x1dafaf[_0xe812('0x17')]][_0xe812('0x65')]));}}catch(_0x49edfc){utils[_0xe812('0x16')](util['format'](_0xe812('0x67'),_0x1dafaf[_0xe812('0x17')]),_0x49edfc);}};exports[_0xe812('0x68')]=function(_0x2b5e58){try{if(!_[_0xe812('0x2b')](queues[_0x2b5e58[_0xe812('0x17')]])){if(!_['isNil'](queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x65')])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x69'),_0x2b5e58[_0xe812('0x17')]),_0x2b5e58);queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x5b')]+=utils[_0xe812('0x36')](utils[_0xe812('0x15')](),queues[_0x2b5e58[_0xe812('0x17')]]['musiconholdstartAt']);utils['info'](util[_0xe812('0x4')](_0xe812('0x6a'),_0x2b5e58[_0xe812('0x17')],queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x2b5e58[_0xe812('0x17')]]['mohtime']));delete queues[_0x2b5e58[_0xe812('0x17')]]['musiconholdstartAt'];}}}catch(_0x3e0cfd){utils['error'](util['format'](_0xe812('0x69'),_0x2b5e58[_0xe812('0x17')]),_0x3e0cfd);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 92e43e0..f6c6b97 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 _0xdfda=['uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0xdfda,0x17b));var _0xadfd=function(_0x75b0d9,_0x40dd78){_0x75b0d9=_0x75b0d9-0x0;var _0x324713=_0xdfda[_0x75b0d9];return _0x324713;};'use strict';var _=require('lodash');var util=require(_0xadfd('0x0'));var utils=require(_0xadfd('0x1'));var transfers=require(_0xadfd('0x2'));var recordings={};function writeDB(_0x4b9262){var _0x11a629;utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x5'),_0x4b9262[_0xadfd('0x6')]));if(transfers[_0xadfd('0x7')][_0x4b9262[_0xadfd('0x6')]]){_0x11a629=_0x4b9262[_0xadfd('0x6')];_0x4b9262[_0xadfd('0x6')]=transfers[_0xadfd('0x7')][_0x4b9262['uniqueid']][_0xadfd('0x8')];}if(_0x4b9262[_0xadfd('0x9')]){utils[_0xadfd('0xa')](_0x4b9262[_0xadfd('0x9')])['then'](function(_0x1d8dd1){if(_0x1d8dd1){_0x4b9262[_0xadfd('0xb')]=_0x1d8dd1[_0xadfd('0xc')];_0x4b9262[_0xadfd('0xd')]=_0x1d8dd1['id'];}utils[_0xadfd('0xe')](_0xadfd('0xf'),_0x4b9262);});}else{utils[_0xadfd('0xe')](_0xadfd('0xf'),_0x4b9262);}if(_0x11a629)delete transfers[_0xadfd('0x7')][_0x11a629];}exports[_0xadfd('0x10')]=function(_0x362fe7){try{utils[_0xadfd('0x11')](util[_0xadfd('0x4')](_0xadfd('0x12'),_0x362fe7['uniqueid']),_0x362fe7);if(_0x362fe7[_0xadfd('0x6')]==_0x362fe7['linkedid']){utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x13'),_0x362fe7['uniqueid'],_0x362fe7[_0xadfd('0x14')],_0x362fe7[_0xadfd('0x15')]));recordings[_0x362fe7[_0xadfd('0x6')]]={'uniqueid':_0x362fe7[_0xadfd('0x6')],'accountcode':_0x362fe7[_0xadfd('0x9')],'exten':_0x362fe7['exten'],'context':_0x362fe7[_0xadfd('0x14')],'channel':_0x362fe7[_0xadfd('0x16')],'monitors':[]};}}catch(_0x2080ca){utils[_0xadfd('0x17')](util[_0xadfd('0x4')](_0xadfd('0x12'),_0x362fe7[_0xadfd('0x6')]),_0x2080ca);}};exports[_0xadfd('0x18')]=function(_0x3742da){try{utils['debug'](util[_0xadfd('0x4')](_0xadfd('0x19'),_0x3742da[_0xadfd('0x6')]),_0x3742da);if(!_[_0xadfd('0x1a')](recordings[_0x3742da[_0xadfd('0x6')]])&&_0x3742da[_0xadfd('0x1b')]==0x6){utils[_0xadfd('0x3')](util['format'](_0xadfd('0x1c'),_0x3742da['uniqueid'],_0x3742da['context'],_0x3742da['channel']));}else if(!_[_0xadfd('0x1a')](recordings[_0x3742da[_0xadfd('0x1d')]])&&_0x3742da[_0xadfd('0x1b')]==0x6&&_0x3742da[_0xadfd('0x14')]!='transfer'){utils[_0xadfd('0x3')](util[_0xadfd('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3742da['uniqueid'],_0x3742da[_0xadfd('0x1d')],_0x3742da[_0xadfd('0x14')],_0x3742da[_0xadfd('0x16')]));recordings[_0x3742da['linkedid']][_0xadfd('0x9')]=_0x3742da[_0xadfd('0x9')];}}catch(_0x3f840d){utils[_0xadfd('0x17')](util[_0xadfd('0x4')](_0xadfd('0x19'),_0x3742da['uniqueid']),_0x3f840d);}};exports[_0xadfd('0x1e')]=function(_0x5d21d2){try{if(!_[_0xadfd('0x1a')](_0x5d21d2['variable'])&&!_[_0xadfd('0x1a')](_0x5d21d2[_0xadfd('0x1f')][_0xadfd('0x20')])){utils[_0xadfd('0x11')](util[_0xadfd('0x4')](_0xadfd('0x21'),_0x5d21d2['uniqueid']),_0x5d21d2);utils['info'](util[_0xadfd('0x4')](_0xadfd('0x22'),_0x5d21d2[_0xadfd('0x6')],_0x5d21d2[_0xadfd('0x1f')],_0x5d21d2[_0xadfd('0x23')]));if(_[_0xadfd('0x24')](_0x5d21d2['value'],'.wav49')){_0x5d21d2[_0xadfd('0x23')]=_0x5d21d2[_0xadfd('0x23')][_0xadfd('0x25')](_0xadfd('0x26'),_0xadfd('0x27'));}if(recordings[_0x5d21d2[_0xadfd('0x1d')]]){var _0x4f655f=_[_0xadfd('0x28')](recordings[_0x5d21d2[_0xadfd('0x1d')]][_0xadfd('0x29')],{'value':_0x5d21d2['value']});if(_[_0xadfd('0x1a')](_0x4f655f)){recordings[_0x5d21d2[_0xadfd('0x1d')]][_0xadfd('0x29')][_0xadfd('0x2a')]({'value':_0x5d21d2[_0xadfd('0x23')]});}}}}catch(_0x5335fb){utils[_0xadfd('0x17')](util[_0xadfd('0x4')]('[%s][recordings][varset]',_0x5d21d2[_0xadfd('0x6')]),_0x5335fb);}};exports[_0xadfd('0x2b')]=function(_0x154f68){try{if(!_[_0xadfd('0x1a')](recordings[_0x154f68[_0xadfd('0x6')]])){utils['debug'](util[_0xadfd('0x4')](_0xadfd('0x2c'),_0x154f68[_0xadfd('0x6')]),_0x154f68);utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x2d'),_0x154f68[_0xadfd('0x6')],_0x154f68[_0xadfd('0x2e')],_0x154f68[_0xadfd('0x2f')],_0x154f68[_0xadfd('0x30')]));recordings[_0x154f68['uniqueid']][_0xadfd('0x2e')]=_0x154f68[_0xadfd('0x2e')];recordings[_0x154f68[_0xadfd('0x6')]][_0xadfd('0x2f')]=_0x154f68[_0xadfd('0x2f')];recordings[_0x154f68[_0xadfd('0x6')]][_0xadfd('0x31')]=_0x154f68[_0xadfd('0x31')];recordings[_0x154f68[_0xadfd('0x6')]]['connectedlinename']=_0x154f68[_0xadfd('0x32')];if(recordings[_0x154f68[_0xadfd('0x6')]][_0xadfd('0x33')]==_0xadfd('0x34')&&recordings[_0x154f68[_0xadfd('0x6')]][_0xadfd('0x9')]){recordings[_0x154f68['uniqueid']][_0xadfd('0x31')]=recordings[_0x154f68['uniqueid']][_0xadfd('0x9')];recordings[_0x154f68['uniqueid']][_0xadfd('0x32')]='';}recordings[_0x154f68[_0xadfd('0x6')]][_0xadfd('0x29')][_0xadfd('0x35')](function(_0x335a25){var _0x2d2094=_[_0xadfd('0x36')](recordings[_0x154f68[_0xadfd('0x6')]]);_0x2d2094[_0xadfd('0x23')]=_0x335a25['value'];writeDB(_0x2d2094);});delete recordings[_0x154f68[_0xadfd('0x6')]];}}catch(_0x544fb1){utils['error'](util[_0xadfd('0x4')](_0xadfd('0x2c'),_0x154f68[_0xadfd('0x6')]),_0x544fb1);}};exports[_0xadfd('0x37')]=function(_0x1daa98){try{if(!_[_0xadfd('0x1a')](recordings[_0x1daa98[_0xadfd('0x6')]])){utils[_0xadfd('0x11')](util[_0xadfd('0x4')]('[%s][recordings][newexten]',_0x1daa98[_0xadfd('0x6')]),_0x1daa98);utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x38'),_0x1daa98[_0xadfd('0x6')],_0x1daa98[_0xadfd('0x39')],_0x1daa98[_0xadfd('0x3a')]));if(_0x1daa98[_0xadfd('0x39')][_0xadfd('0x3b')]()=='set'&&_[_0xadfd('0x3c')](_0x1daa98['appdata'][_0xadfd('0x3b')](),'cdr')){var _0x46ea12=_0x1daa98['appdata'][_0xadfd('0x3d')]('=');var _0x27c0b3=_0x46ea12[0x0][_0xadfd('0x3e')](_0x46ea12[0x0][_0xadfd('0x3f')]('(')+0x1,_0x46ea12[0x0]['lastIndexOf'](')'));var _0xc4ae97=_0x46ea12[0x1];recordings[_0x1daa98[_0xadfd('0x6')]][_0x27c0b3]=_0xc4ae97;}}}catch(_0x55601a){utils[_0xadfd('0x17')](util[_0xadfd('0x4')](_0xadfd('0x40'),_0x1daa98[_0xadfd('0x6')]),_0x55601a);}};exports[_0xadfd('0x41')]=function(_0x44e836){try{if(!_[_0xadfd('0x1a')](recordings[_0x44e836[_0xadfd('0x6')]])){utils['debug'](util[_0xadfd('0x4')](_0xadfd('0x42'),_0x44e836[_0xadfd('0x6')]),_0x44e836);utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x43'),_0x44e836[_0xadfd('0x6')],_0x44e836[_0xadfd('0x44')]));recordings[_0x44e836['uniqueid']][_0xadfd('0x44')]=_0x44e836['queue'];}}catch(_0x1b667e){utils[_0xadfd('0x17')](util[_0xadfd('0x4')](_0xadfd('0x42'),_0x44e836[_0xadfd('0x6')]),_0x1b667e);}};exports[_0xadfd('0x45')]=function(_0x37b8bf){try{utils['debug'](util[_0xadfd('0x4')](_0xadfd('0x46'),_0x37b8bf[_0xadfd('0x6')]),_0x37b8bf);utils[_0xadfd('0x3')](util[_0xadfd('0x4')](_0xadfd('0x47'),_0x37b8bf[_0xadfd('0x6')],_0x37b8bf[_0xadfd('0x48')],_0x37b8bf[_0xadfd('0x49')],_0x37b8bf[_0xadfd('0x4a')],_0x37b8bf[_0xadfd('0x4b')]));if(recordings[_0x37b8bf[_0xadfd('0x4c')]]&&transfers[_0xadfd('0x7')][_0x37b8bf[_0xadfd('0x4c')]]){transfers[_0xadfd('0x7')][_0x37b8bf[_0xadfd('0x4c')]]['recording']=!![];}}catch(_0x1af0ff){utils[_0xadfd('0x17')](util['format'](_0xadfd('0x46'),_0x37b8bf[_0xadfd('0x6')]),_0x1af0ff);}}; \ No newline at end of file +var _0xce60=['name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','lodash','info','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0xce60,0xca));var _0x0ce6=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xce60[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x0ce6('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2e2a13){var _0x17df96;utils[_0x0ce6('0x1')](util['format'](_0x0ce6('0x2'),_0x2e2a13[_0x0ce6('0x3')]));if(transfers[_0x0ce6('0x4')][_0x2e2a13['uniqueid']]){_0x17df96=_0x2e2a13[_0x0ce6('0x3')];_0x2e2a13['uniqueid']=transfers[_0x0ce6('0x4')][_0x2e2a13[_0x0ce6('0x3')]]['transfereeuniqueid'];}if(_0x2e2a13[_0x0ce6('0x5')]){utils[_0x0ce6('0x6')](_0x2e2a13['accountcode'])[_0x0ce6('0x7')](function(_0x43a135){if(_0x43a135){_0x2e2a13['membername']=_0x43a135[_0x0ce6('0x8')];_0x2e2a13[_0x0ce6('0x9')]=_0x43a135['id'];}utils[_0x0ce6('0xa')](_0x0ce6('0xb'),_0x2e2a13);});}else{utils[_0x0ce6('0xa')]('CreateVoiceRecording',_0x2e2a13);}if(_0x17df96)delete transfers[_0x0ce6('0x4')][_0x17df96];}exports['newchannel']=function(_0x2782f6){try{utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0xd'),_0x2782f6[_0x0ce6('0x3')]),_0x2782f6);if(_0x2782f6[_0x0ce6('0x3')]==_0x2782f6[_0x0ce6('0xe')]){utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x10'),_0x2782f6[_0x0ce6('0x3')],_0x2782f6[_0x0ce6('0x11')],_0x2782f6[_0x0ce6('0x12')]));recordings[_0x2782f6[_0x0ce6('0x3')]]={'uniqueid':_0x2782f6['uniqueid'],'accountcode':_0x2782f6['accountcode'],'exten':_0x2782f6[_0x0ce6('0x12')],'context':_0x2782f6[_0x0ce6('0x11')],'channel':_0x2782f6[_0x0ce6('0x13')],'monitors':[]};}}catch(_0x119454){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0xd'),_0x2782f6[_0x0ce6('0x3')]),_0x119454);}};exports['newstate']=function(_0x3ccb9c){try{utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0x15'),_0x3ccb9c[_0x0ce6('0x3')]),_0x3ccb9c);if(!_[_0x0ce6('0x16')](recordings[_0x3ccb9c['uniqueid']])&&_0x3ccb9c['channelstate']==0x6){utils['info'](util['format'](_0x0ce6('0x17'),_0x3ccb9c['uniqueid'],_0x3ccb9c[_0x0ce6('0x11')],_0x3ccb9c[_0x0ce6('0x13')]));}else if(!_[_0x0ce6('0x16')](recordings[_0x3ccb9c[_0x0ce6('0xe')]])&&_0x3ccb9c[_0x0ce6('0x18')]==0x6&&_0x3ccb9c[_0x0ce6('0x11')]!=_0x0ce6('0x19')){utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x1a'),_0x3ccb9c[_0x0ce6('0x3')],_0x3ccb9c[_0x0ce6('0xe')],_0x3ccb9c[_0x0ce6('0x11')],_0x3ccb9c[_0x0ce6('0x13')]));recordings[_0x3ccb9c['linkedid']][_0x0ce6('0x5')]=_0x3ccb9c[_0x0ce6('0x5')];}}catch(_0x2555d9){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x15'),_0x3ccb9c[_0x0ce6('0x3')]),_0x2555d9);}};exports[_0x0ce6('0x1b')]=function(_0x3572d6){try{if(!_[_0x0ce6('0x16')](_0x3572d6[_0x0ce6('0x1c')])&&!_[_0x0ce6('0x16')](_0x3572d6[_0x0ce6('0x1c')][_0x0ce6('0x1d')])){utils[_0x0ce6('0xc')](util[_0x0ce6('0xf')]('[%s][recordings][varset]',_0x3572d6[_0x0ce6('0x3')]),_0x3572d6);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x1e'),_0x3572d6['uniqueid'],_0x3572d6[_0x0ce6('0x1c')],_0x3572d6[_0x0ce6('0x1f')]));if(_[_0x0ce6('0x20')](_0x3572d6['value'],_0x0ce6('0x21'))){_0x3572d6[_0x0ce6('0x1f')]=_0x3572d6['value'][_0x0ce6('0x22')]('.wav49',_0x0ce6('0x23'));}if(recordings[_0x3572d6['linkedid']]){var _0x7023a5=_[_0x0ce6('0x24')](recordings[_0x3572d6[_0x0ce6('0xe')]][_0x0ce6('0x25')],{'value':_0x3572d6[_0x0ce6('0x1f')]});if(_[_0x0ce6('0x16')](_0x7023a5)){recordings[_0x3572d6['linkedid']]['monitors'][_0x0ce6('0x26')]({'value':_0x3572d6[_0x0ce6('0x1f')]});}}}}catch(_0x2b9680){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x27'),_0x3572d6[_0x0ce6('0x3')]),_0x2b9680);}};exports['hangup']=function(_0x2d6e3d){try{if(!_['isNil'](recordings[_0x2d6e3d['uniqueid']])){utils[_0x0ce6('0xc')](util[_0x0ce6('0xf')](_0x0ce6('0x28'),_0x2d6e3d[_0x0ce6('0x3')]),_0x2d6e3d);utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x29'),_0x2d6e3d['uniqueid'],_0x2d6e3d[_0x0ce6('0x2a')],_0x2d6e3d[_0x0ce6('0x2b')],_0x2d6e3d[_0x0ce6('0x2c')]));recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x2a')]=_0x2d6e3d[_0x0ce6('0x2a')];recordings[_0x2d6e3d[_0x0ce6('0x3')]]['calleridname']=_0x2d6e3d[_0x0ce6('0x2b')];recordings[_0x2d6e3d['uniqueid']][_0x0ce6('0x2d')]=_0x2d6e3d[_0x0ce6('0x2d')];recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x2e')]=_0x2d6e3d[_0x0ce6('0x2e')];if(recordings[_0x2d6e3d[_0x0ce6('0x3')]]['type']==_0x0ce6('0x2f')&&recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x5')]){recordings[_0x2d6e3d['uniqueid']]['connectedlinenum']=recordings[_0x2d6e3d[_0x0ce6('0x3')]]['accountcode'];recordings[_0x2d6e3d[_0x0ce6('0x3')]]['connectedlinename']='';}recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x25')][_0x0ce6('0x30')](function(_0x585fcd){var _0x119249=_[_0x0ce6('0x31')](recordings[_0x2d6e3d[_0x0ce6('0x3')]]);_0x119249['value']=_0x585fcd[_0x0ce6('0x1f')];writeDB(_0x119249);});delete recordings[_0x2d6e3d[_0x0ce6('0x3')]];}}catch(_0x43a7f4){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x28'),_0x2d6e3d[_0x0ce6('0x3')]),_0x43a7f4);}};exports['newexten']=function(_0x51da40){try{if(!_[_0x0ce6('0x16')](recordings[_0x51da40[_0x0ce6('0x3')]])){utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0x32'),_0x51da40[_0x0ce6('0x3')]),_0x51da40);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x33'),_0x51da40['uniqueid'],_0x51da40[_0x0ce6('0x34')],_0x51da40[_0x0ce6('0x35')]));if(_0x51da40[_0x0ce6('0x34')][_0x0ce6('0x36')]()==_0x0ce6('0x37')&&_[_0x0ce6('0x38')](_0x51da40[_0x0ce6('0x35')][_0x0ce6('0x36')](),_0x0ce6('0x39'))){var _0x1d3969=_0x51da40['appdata'][_0x0ce6('0x3a')]('=');var _0x46c268=_0x1d3969[0x0][_0x0ce6('0x3b')](_0x1d3969[0x0][_0x0ce6('0x3c')]('(')+0x1,_0x1d3969[0x0]['lastIndexOf'](')'));var _0xcd20ed=_0x1d3969[0x1];recordings[_0x51da40[_0x0ce6('0x3')]][_0x46c268]=_0xcd20ed;}}}catch(_0x43540c){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x32'),_0x51da40[_0x0ce6('0x3')]),_0x43540c);}};exports['queuecallerjoin']=function(_0x374af1){try{if(!_[_0x0ce6('0x16')](recordings[_0x374af1['uniqueid']])){utils[_0x0ce6('0xc')](util['format']('[%s][recordings][queuecallerjoin]',_0x374af1[_0x0ce6('0x3')]),_0x374af1);utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x3d'),_0x374af1[_0x0ce6('0x3')],_0x374af1['queue']));recordings[_0x374af1[_0x0ce6('0x3')]][_0x0ce6('0x3e')]=_0x374af1['queue'];}}catch(_0x476bd8){utils[_0x0ce6('0x14')](util['format'](_0x0ce6('0x3f'),_0x374af1[_0x0ce6('0x3')]),_0x476bd8);}};exports[_0x0ce6('0x40')]=function(_0x1a20eb){try{utils['debug'](util[_0x0ce6('0xf')](_0x0ce6('0x41'),_0x1a20eb[_0x0ce6('0x3')]),_0x1a20eb);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x42'),_0x1a20eb[_0x0ce6('0x3')],_0x1a20eb['transferercalleridnum'],_0x1a20eb[_0x0ce6('0x43')],_0x1a20eb['transfereecalleridnum'],_0x1a20eb[_0x0ce6('0x44')]));if(recordings[_0x1a20eb[_0x0ce6('0x45')]]&&transfers[_0x0ce6('0x4')][_0x1a20eb[_0x0ce6('0x45')]]){transfers[_0x0ce6('0x4')][_0x1a20eb['transfereruniqueid']]['recording']=!![];}}catch(_0x273172){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')]('[%s][recordings][blindtransfer]',_0x1a20eb[_0x0ce6('0x3')]),_0x273172);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7025a32..5a1c234 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 _0x4d0d=['lodash','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x1e8eb2,_0x201a1b){var _0x23f715=function(_0x27f97d){while(--_0x27f97d){_0x1e8eb2['push'](_0x1e8eb2['shift']());}};_0x23f715(++_0x201a1b);}(_0x4d0d,0x15e));var _0xd4d0=function(_0x5dc212,_0x31d7a3){_0x5dc212=_0x5dc212-0x0;var _0x3a7355=_0x4d0d[_0x5dc212];return _0x3a7355;};'use strict';var _=require(_0xd4d0('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x3794cf){utils[_0xd4d0('0x1')](util[_0xd4d0('0x2')](_0xd4d0('0x3'),_0x3794cf['type']===_0xd4d0('0x4')?_0x3794cf[_0xd4d0('0x5')]:_0x3794cf[_0xd4d0('0x6')],_0x3794cf[_0xd4d0('0x7')]));utils[_0xd4d0('0x8')]('CreateVoiceTransferReport',_0x3794cf);}exports[_0xd4d0('0x9')]={};exports[_0xd4d0('0xa')]=function(_0x56c9ca){try{utils['debug'](util['format'](_0xd4d0('0xb'),_0x56c9ca[_0xd4d0('0x6')]),_0x56c9ca);utils['info'](util[_0xd4d0('0x2')](_0xd4d0('0xc'),_0x56c9ca[_0xd4d0('0x6')],_0x56c9ca['transferercalleridnum'],_0x56c9ca['transferercalleridname'],_0x56c9ca[_0xd4d0('0xd')],_0x56c9ca[_0xd4d0('0xe')]));_0x56c9ca[_0xd4d0('0x7')]='blind';exports['blinds'][_0x56c9ca[_0xd4d0('0xf')]]=_0x56c9ca;writeDB(_0x56c9ca);}catch(_0x2deba1){utils[_0xd4d0('0x10')](util[_0xd4d0('0x2')](_0xd4d0('0xb'),_0x56c9ca[_0xd4d0('0x6')]),_0x2deba1);}};exports[_0xd4d0('0x11')]=function(_0x219f75){try{utils['debug'](util[_0xd4d0('0x2')](_0xd4d0('0x12'),_0x219f75[_0xd4d0('0x5')]),_0x219f75);utils[_0xd4d0('0x1')](util[_0xd4d0('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x219f75[_0xd4d0('0x5')],_0x219f75[_0xd4d0('0x13')],_0x219f75[_0xd4d0('0x14')],_0x219f75[_0xd4d0('0x15')],_0x219f75['transfertargetcalleridname']));_0x219f75=_[_0xd4d0('0x16')](_0x219f75,{'transfererchannel':_0x219f75[_0xd4d0('0x17')],'transferercalleridnum':_0x219f75['origtransferercalleridnum'],'transferercalleridname':_0x219f75[_0xd4d0('0x14')],'transfererconnectedlinenum':_0x219f75[_0xd4d0('0x18')],'transfererconnectedlinename':_0x219f75['secondtransfererconnectedlinename'],'transfereraccountcode':_0x219f75[_0xd4d0('0x19')],'transferercontext':_0x219f75['secondtransferercontext'],'transfererexten':_0x219f75[_0xd4d0('0x1a')],'transfererlinkedid':_0x219f75[_0xd4d0('0x1b')],'context':_0x219f75[_0xd4d0('0x1c')],'extension':_0x219f75[_0xd4d0('0x1d')],'type':_0xd4d0('0x4')});if(_[_0xd4d0('0x1e')](_0x219f75['transfereechannel'])){_0x219f75=_['assign'](_0x219f75,{'transfereechannel':_0x219f75['transfertargetchannel'],'transfereecalleridnum':_0x219f75[_0xd4d0('0x15')],'transfereecalleridname':_0x219f75['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x219f75[_0xd4d0('0x1f')],'transfereeconnectedlinename':_0x219f75[_0xd4d0('0x20')],'transfereeaccountcode':_0x219f75[_0xd4d0('0x21')],'transfereecontext':_0x219f75[_0xd4d0('0x22')],'transfereeexten':_0x219f75['transfertargetexten'],'transfereelinkedid':_0x219f75['transfertargetlinkedid']});}writeDB(_0x219f75);}catch(_0x1dd61f){utils[_0xd4d0('0x10')](util[_0xd4d0('0x2')]('[%s][transfers][attendedtransfer]',_0x219f75['origtransfereruniqueid']),_0x1dd61f);}}; \ No newline at end of file +var _0x01c8=['[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','format'];(function(_0x46dfa2,_0x1c6f5d){var _0x13a367=function(_0x6e88bf){while(--_0x6e88bf){_0x46dfa2['push'](_0x46dfa2['shift']());}};_0x13a367(++_0x1c6f5d);}(_0x01c8,0x1a0));var _0x801c=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x01c8[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x801c('0x0'));var util=require(_0x801c('0x1'));var utils=require(_0x801c('0x2'));function writeDB(_0x130faa){utils[_0x801c('0x3')](util['format'](_0x801c('0x4'),_0x130faa[_0x801c('0x5')]===_0x801c('0x6')?_0x130faa[_0x801c('0x7')]:_0x130faa[_0x801c('0x8')],_0x130faa[_0x801c('0x5')]));utils[_0x801c('0x9')]('CreateVoiceTransferReport',_0x130faa);}exports[_0x801c('0xa')]={};exports['blindtransfer']=function(_0x490241){try{utils[_0x801c('0xb')](util[_0x801c('0xc')](_0x801c('0xd'),_0x490241[_0x801c('0x8')]),_0x490241);utils['info'](util[_0x801c('0xc')](_0x801c('0xe'),_0x490241[_0x801c('0x8')],_0x490241['transferercalleridnum'],_0x490241[_0x801c('0xf')],_0x490241[_0x801c('0x10')],_0x490241[_0x801c('0x11')]));_0x490241[_0x801c('0x5')]=_0x801c('0x12');exports['blinds'][_0x490241['transfereruniqueid']]=_0x490241;writeDB(_0x490241);}catch(_0x394e7a){utils[_0x801c('0x13')](util[_0x801c('0xc')](_0x801c('0xd'),_0x490241[_0x801c('0x8')]),_0x394e7a);}};exports[_0x801c('0x14')]=function(_0x4f338d){try{utils[_0x801c('0xb')](util[_0x801c('0xc')](_0x801c('0x15'),_0x4f338d[_0x801c('0x7')]),_0x4f338d);utils['info'](util['format'](_0x801c('0x16'),_0x4f338d[_0x801c('0x7')],_0x4f338d['origtransferercalleridnum'],_0x4f338d[_0x801c('0x17')],_0x4f338d['transfertargetcalleridnum'],_0x4f338d['transfertargetcalleridname']));_0x4f338d=_[_0x801c('0x18')](_0x4f338d,{'transfererchannel':_0x4f338d[_0x801c('0x19')],'transferercalleridnum':_0x4f338d[_0x801c('0x1a')],'transferercalleridname':_0x4f338d['origtransferercalleridname'],'transfererconnectedlinenum':_0x4f338d[_0x801c('0x1b')],'transfererconnectedlinename':_0x4f338d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4f338d[_0x801c('0x1c')],'transferercontext':_0x4f338d[_0x801c('0x1d')],'transfererexten':_0x4f338d['secondtransfererexten'],'transfererlinkedid':_0x4f338d['origtransfererlinkedid'],'context':_0x4f338d['origtransferercontext'],'extension':_0x4f338d['origtransfererexten'],'type':_0x801c('0x6')});if(_[_0x801c('0x1e')](_0x4f338d[_0x801c('0x1f')])){_0x4f338d=_[_0x801c('0x18')](_0x4f338d,{'transfereechannel':_0x4f338d['transfertargetchannel'],'transfereecalleridnum':_0x4f338d['transfertargetcalleridnum'],'transfereecalleridname':_0x4f338d[_0x801c('0x20')],'transfereeconnectedlinenum':_0x4f338d[_0x801c('0x21')],'transfereeconnectedlinename':_0x4f338d[_0x801c('0x22')],'transfereeaccountcode':_0x4f338d[_0x801c('0x23')],'transfereecontext':_0x4f338d[_0x801c('0x24')],'transfereeexten':_0x4f338d[_0x801c('0x25')],'transfereelinkedid':_0x4f338d[_0x801c('0x26')]});}writeDB(_0x4f338d);}catch(_0x21054b){utils['error'](util['format'](_0x801c('0x15'),_0x4f338d[_0x801c('0x7')]),_0x21054b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 126f4d7..4a65063 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 _0xd60a=['YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','format','subtractTime'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd60a,0x192));var _0xad60=function(_0x114d59,_0x45fc86){_0x114d59=_0x114d59-0x0;var _0x16e6b8=_0xd60a[_0x114d59];return _0x16e6b8;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xad60('0x0'));var util=require(_0xad60('0x1'));var client=jayson[_0xad60('0x2')][_0xad60('0x3')]({'port':0x2329});var logger=require(_0xad60('0x4'))(_0xad60('0x5'));exports[_0xad60('0x6')]=function(_0x265afc,_0x2d23a4){logger['info'](_0x265afc,_0x2d23a4?util[_0xad60('0x7')](_0x2d23a4,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1eb78d,_0x37ac0e){logger[_0xad60('0x8')](_0x1eb78d,_0x37ac0e?util[_0xad60('0x7')](_0x37ac0e,{'showHidden':![],'depth':null}):'');};exports[_0xad60('0x9')]=function(_0x556868,_0xb17649){logger[_0xad60('0x9')](_0x556868,_0xb17649?util[_0xad60('0x7')](_0xb17649,{'showHidden':![],'depth':null}):'');};exports[_0xad60('0xa')]=function(_0x149d5d,_0x224584){return client['request'](_0x149d5d,{'body':_0x224584})[_0xad60('0xb')](function(_0x10f46b){logger[_0xad60('0x8')]('[utils][request]\x20name:%s',_0x149d5d,_0x10f46b?util[_0xad60('0x7')](_0x10f46b,{'showHidden':![],'depth':null}):'');})[_0xad60('0xc')](function(_0x489e93){logger[_0xad60('0x9')]('[utils][request]\x20name:%s',_0x149d5d,_0x489e93?util[_0xad60('0x7')](_0x489e93,{'showHidden':![],'depth':null}):'');});};function getUser(_0x13f500){return client[_0xad60('0xa')](_0xad60('0xd'),{'options':{'raw':!![],'attributes':['id',_0xad60('0xe'),'name',_0xad60('0xf')],'where':_0x13f500,'limit':0x1}})[_0xad60('0xb')](function(_0x318c3f){logger['debug'](_0xad60('0x10'),JSON[_0xad60('0x11')](_0x13f500),_0x318c3f?util[_0xad60('0x7')](_0x318c3f,{'showHidden':![],'depth':null}):'');return _0x318c3f[_0xad60('0x12')]['length']?_0x318c3f[_0xad60('0x12')][0x0]:null;});}exports[_0xad60('0x13')]=function(_0x346ff9){return new BPromise(function(_0x106b1b,_0x45afa3){if(_0x346ff9){return getUser({'internal':_0x346ff9})['then'](function(_0x47cc54){logger['info'](_0xad60('0x14'),_0x346ff9,_0x47cc54?_0xad60('0x15'):'notfound');return _0x106b1b(_0x47cc54);})[_0xad60('0xc')](function(_0x53944c){logger[_0xad60('0x9')](_0xad60('0x16'),_0x53944c?util[_0xad60('0x7')](_0x53944c,{'showHidden':![],'depth':null}):'');return _0x106b1b(null);});}return _0x106b1b(null);});};exports[_0xad60('0x17')]=function(_0x1e17ae){return new BPromise(function(_0x29fcab,_0x41bf66){if(_0x1e17ae){return getUser({'interface':_0x1e17ae})[_0xad60('0xb')](function(_0x5ce968){logger[_0xad60('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1e17ae,_0x5ce968?_0xad60('0x15'):_0xad60('0x18'));return _0x29fcab(_0x5ce968);})[_0xad60('0xc')](function(_0x323b65){logger['error']('[utils][getUserByInterface]',_0x323b65?util[_0xad60('0x7')](_0x323b65,{'showHidden':![],'depth':null}):'');return _0x29fcab(null);});}return _0x29fcab(null);});};exports[_0xad60('0x19')]=function(_0x1ae87d){return new BPromise(function(_0x33fbc0,_0x412f2b){if(_0x1ae87d){return getUser({'name':_0x1ae87d})[_0xad60('0xb')](function(_0x56b946){logger[_0xad60('0x6')](_0xad60('0x1a'),_0x1ae87d,_0x56b946?_0xad60('0x15'):_0xad60('0x18'));return _0x33fbc0(_0x56b946);})[_0xad60('0xc')](function(_0x4d4e47){logger[_0xad60('0x9')]('[utils][getUserByName]',_0x4d4e47?util[_0xad60('0x7')](_0x4d4e47,{'showHidden':![],'depth':null}):'');return _0x33fbc0(null);});}return _0x33fbc0(null);});};exports[_0xad60('0x1b')]=function(_0x39c586){return new BPromise(function(_0x18cafb,_0xe5a83f){if(_0x39c586){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xad60('0x1c'),_0xad60('0x1d'),_0xad60('0x1e')],'where':{'name':_0x39c586},'limit':0x1}})[_0xad60('0xb')](function(_0x40dcf7){logger[_0xad60('0x8')](_0xad60('0x1f'),_0x39c586,_0x40dcf7?util[_0xad60('0x7')](_0x40dcf7,{'showHidden':![],'depth':null}):'');logger['info'](_0xad60('0x20'),_0x39c586,_0x40dcf7?_0xad60('0x15'):_0xad60('0x18'));return _0x18cafb(_0x40dcf7[_0xad60('0x12')][_0xad60('0x21')]?_0x40dcf7['result'][0x0]:null);})[_0xad60('0xc')](function(_0x24d20e){logger['error'](_0xad60('0x22'),_0x24d20e?util['inspect'](_0x24d20e,{'showHidden':![],'depth':null}):'');return _0x18cafb(null);});}return _0x18cafb(null);});};exports['addTime']=function(_0x4555db,_0x5b132a){return moment(_0x4555db)[_0xad60('0x23')](_0x5b132a,'seconds')[_0xad60('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xad60('0x25')]=function(_0x6f0e1e,_0x5ca413){return moment(_0x6f0e1e)['subtract'](_0x5ca413,'seconds')[_0xad60('0x24')](_0xad60('0x26'));};exports[_0xad60('0x27')]=function(_0x1080b4,_0x34ad55){return moment(_0x1080b4)[_0xad60('0x28')](moment(_0x34ad55),'seconds');};exports['sumTime']=function(_0x584ae6,_0x14f71f){return parseInt(_0x584ae6,0xa)+parseInt(_0x14f71f,0xa);};exports[_0xad60('0x29')]=function(){return moment()[_0xad60('0x24')](_0xad60('0x26'));};exports[_0xad60('0x2a')]=function(_0x2e2e03,_0x456f86){if(_0x456f86){return moment(_0x2e2e03)[_0xad60('0x2a')](_0x456f86);}return!![];};exports[_0xad60('0x2b')]=function(_0x2b00b7,_0xb3467d){if(_0xb3467d){return moment(_0x2b00b7)[_0xad60('0x2b')](_0xb3467d);}else if(_0x2b00b7){return!![];}return![];}; \ No newline at end of file +var _0x58c0=['acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','name','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x1c2fa6,_0x593fb2){var _0x265636=function(_0x7bf181){while(--_0x7bf181){_0x1c2fa6['push'](_0x1c2fa6['shift']());}};_0x265636(++_0x593fb2);}(_0x58c0,0x1de));var _0x058c=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x58c0[_0x25fa5c];return _0x1bade2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x058c('0x0'));var moment=require(_0x058c('0x1'));var util=require(_0x058c('0x2'));var client=jayson[_0x058c('0x3')][_0x058c('0x4')]({'port':0x2329});var logger=require(_0x058c('0x5'))(_0x058c('0x6'));exports['info']=function(_0x2dcec8,_0xccb4f2){logger[_0x058c('0x7')](_0x2dcec8,_0xccb4f2?util[_0x058c('0x8')](_0xccb4f2,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0x9')]=function(_0xbb39fe,_0x584e4a){logger[_0x058c('0x9')](_0xbb39fe,_0x584e4a?util[_0x058c('0x8')](_0x584e4a,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0xa')]=function(_0x4d81c7,_0xeace37){logger[_0x058c('0xa')](_0x4d81c7,_0xeace37?util['inspect'](_0xeace37,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0xb')]=function(_0x1e8212,_0x2ef836){return client[_0x058c('0xb')](_0x1e8212,{'body':_0x2ef836})[_0x058c('0xc')](function(_0x49b485){logger[_0x058c('0x9')](_0x058c('0xd'),_0x1e8212,_0x49b485?util[_0x058c('0x8')](_0x49b485,{'showHidden':![],'depth':null}):'');})[_0x058c('0xe')](function(_0x23831d){logger[_0x058c('0xa')]('[utils][request]\x20name:%s',_0x1e8212,_0x23831d?util['inspect'](_0x23831d,{'showHidden':![],'depth':null}):'');});};function getUser(_0xfcf0c8){return client[_0x058c('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x058c('0xf'),'interface'],'where':_0xfcf0c8,'limit':0x1}})[_0x058c('0xc')](function(_0x177aaa){logger[_0x058c('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x058c('0x10')](_0xfcf0c8),_0x177aaa?util[_0x058c('0x8')](_0x177aaa,{'showHidden':![],'depth':null}):'');return _0x177aaa[_0x058c('0x11')]['length']?_0x177aaa['result'][0x0]:null;});}exports[_0x058c('0x12')]=function(_0x536439){return new BPromise(function(_0x3d04c4,_0x2a57c1){if(_0x536439){return getUser({'internal':_0x536439})[_0x058c('0xc')](function(_0x39ef85){logger[_0x058c('0x7')](_0x058c('0x13'),_0x536439,_0x39ef85?_0x058c('0x14'):'notfound');return _0x3d04c4(_0x39ef85);})['catch'](function(_0x4b50af){logger['error'](_0x058c('0x15'),_0x4b50af?util[_0x058c('0x8')](_0x4b50af,{'showHidden':![],'depth':null}):'');return _0x3d04c4(null);});}return _0x3d04c4(null);});};exports[_0x058c('0x16')]=function(_0x55fa1d){return new BPromise(function(_0x1181b9,_0x42811a){if(_0x55fa1d){return getUser({'interface':_0x55fa1d})[_0x058c('0xc')](function(_0x3f4c13){logger[_0x058c('0x7')](_0x058c('0x17'),_0x55fa1d,_0x3f4c13?_0x058c('0x14'):_0x058c('0x18'));return _0x1181b9(_0x3f4c13);})[_0x058c('0xe')](function(_0x3f5072){logger[_0x058c('0xa')](_0x058c('0x19'),_0x3f5072?util[_0x058c('0x8')](_0x3f5072,{'showHidden':![],'depth':null}):'');return _0x1181b9(null);});}return _0x1181b9(null);});};exports['getUserByName']=function(_0x367eda){return new BPromise(function(_0x1db895,_0x12d726){if(_0x367eda){return getUser({'name':_0x367eda})[_0x058c('0xc')](function(_0x453b50){logger[_0x058c('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x367eda,_0x453b50?_0x058c('0x14'):'notfound');return _0x1db895(_0x453b50);})['catch'](function(_0x187b73){logger['error']('[utils][getUserByName]',_0x187b73?util[_0x058c('0x8')](_0x187b73,{'showHidden':![],'depth':null}):'');return _0x1db895(null);});}return _0x1db895(null);});};exports[_0x058c('0x1a')]=function(_0x2ba90b){return new BPromise(function(_0x3ba9ca,_0x37367a){if(_0x2ba90b){return client['request'](_0x058c('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x058c('0xf'),'type',_0x058c('0x1c'),_0x058c('0x1d')],'where':{'name':_0x2ba90b},'limit':0x1}})[_0x058c('0xc')](function(_0x2e559f){logger[_0x058c('0x9')](_0x058c('0x1e'),_0x2ba90b,_0x2e559f?util[_0x058c('0x8')](_0x2e559f,{'showHidden':![],'depth':null}):'');logger['info'](_0x058c('0x1f'),_0x2ba90b,_0x2e559f?'found':_0x058c('0x18'));return _0x3ba9ca(_0x2e559f['result'][_0x058c('0x20')]?_0x2e559f[_0x058c('0x11')][0x0]:null);})[_0x058c('0xe')](function(_0x554068){logger['error'](_0x058c('0x21'),_0x554068?util[_0x058c('0x8')](_0x554068,{'showHidden':![],'depth':null}):'');return _0x3ba9ca(null);});}return _0x3ba9ca(null);});};exports[_0x058c('0x22')]=function(_0x4d7aee,_0x3de12b){return moment(_0x4d7aee)[_0x058c('0x23')](_0x3de12b,'seconds')['format'](_0x058c('0x24'));};exports[_0x058c('0x25')]=function(_0x38727a,_0x35fec9){return moment(_0x38727a)['subtract'](_0x35fec9,_0x058c('0x26'))[_0x058c('0x27')](_0x058c('0x24'));};exports[_0x058c('0x28')]=function(_0x27bb9d,_0x138ae0){return moment(_0x27bb9d)[_0x058c('0x29')](moment(_0x138ae0),'seconds');};exports[_0x058c('0x2a')]=function(_0x321c99,_0x2420bf){return parseInt(_0x321c99,0xa)+parseInt(_0x2420bf,0xa);};exports[_0x058c('0x2b')]=function(){return moment()['format'](_0x058c('0x24'));};exports[_0x058c('0x2c')]=function(_0x34b6f0,_0x657244){if(_0x657244){return moment(_0x34b6f0)[_0x058c('0x2c')](_0x657244);}return!![];};exports[_0x058c('0x2d')]=function(_0x3e6cda,_0x16deb5){if(_0x16deb5){return moment(_0x3e6cda)[_0x058c('0x2d')](_0x16deb5);}else if(_0x3e6cda){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index dde2cda..301a299 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x200f=['logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','name','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','other','agent_id','agent_name','setupLoggers','fs-extra','lodash','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','client','role','ensureDir','join','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger'];(function(_0x9faff7,_0x59a564){var _0x4f8043=function(_0x5f060d){while(--_0x5f060d){_0x9faff7['push'](_0x9faff7['shift']());}};_0x4f8043(++_0x59a564);}(_0x200f,0xd7));var _0xf200=function(_0x23648b,_0x51a25f){_0x23648b=_0x23648b-0x0;var _0x2b5a63=_0x200f[_0x23648b];return _0x2b5a63;};var fs=require(_0xf200('0x0'));var _=require(_0xf200('0x1'));var ewinston=require('express-winston');var path=require(_0xf200('0x2'));var util=require(_0xf200('0x3'));var fileLogger=require(_0xf200('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0xf200('0x5')];var maskSensitiveData=require(_0xf200('0x6'))[_0xf200('0x7')];function ClientSideLogger(){function _0x213581(_0x3da447){var _0x4e700c=path['join'](_0xf200('0x8'),_0xf200('0x9'),_0xf200('0xa'));var _0x37cc8b=path['join'](_0xf200('0xb'),_0x3da447[_0xf200('0xc')]+'-'+_0x3da447['name']);return fs[_0xf200('0xd')](path[_0xf200('0xe')](_0x4e700c,_0x37cc8b))[_0xf200('0xf')](function(){var _0x27c320=fileLogger(_0xf200('0xb'),path['join'](_0x4e700c,_0x37cc8b));return _0x27c320;})[_0xf200('0x10')](function(_0x21ecd6){throw _0x21ecd6;});}this['log']=function(_0x345e89,_0x14ab4a,_0x10916f,_0x5b52df){return _0x213581(_0x345e89[_0xf200('0x11')])[_0xf200('0xf')](function(_0x162bd5){var _0x56807c=_0x162bd5[_0x14ab4a];return _0x56807c;})[_0xf200('0xf')](function(_0x894164){var _0x2b37c6=_0x345e89['user']?_0x345e89[_0xf200('0x11')]['id']:'no-user';var _0x31c86e=_0x5b52df[_0xf200('0x12')];var _0x2d4365=_0x5b52df[_0xf200('0x13')];var _0x5e1d29=new Date(Number(_0x2d4365));return _0x894164(_0x2b37c6,_0x5e1d29,_0x10916f,_0x31c86e);})[_0xf200('0x10')](function(_0x34787f){fileLogger(_0xf200('0xb'))[_0xf200('0x14')](_0x34787f);});};}function setupLoggers(_0x232004){return new Promise(function(_0x55a971){var _0x2ae68d=new ClientSideLogger();var _0x4d29f8=fileLogger(_0xf200('0x15'));var _0x2c055d=fileLogger(_0xf200('0x16'));_0x232004[_0xf200('0x17')](_0xf200('0x18'),_0x2ae68d);_0x232004['use'](ewinston[_0xf200('0x19')]({'winstonInstance':_0x4d29f8,'meta':![],'statusLevels':!![],'msg':function(_0x570272,_0x46cba0){var _0x337da2=_0xf200('0x1a');if(!_[_0xf200('0x1b')](_0x570272[_0xf200('0x1c')])){_0x337da2+='\x20body=%s';var _0x32bb86=_0x570272[_0xf200('0x1c')];maskSensitiveData(_0x32bb86);}return safeTemplate(util[_0xf200('0x1d')](_0x337da2,_0x570272[_0xf200('0x1e')],_0x570272[_0xf200('0x1f')][_0xf200('0x20')]?_0x570272[_0xf200('0x1f')][_0xf200('0x20')]:_0x570272['connection'][_0xf200('0x21')]||_0x570272['ip'],_0x570272[_0xf200('0x22')],_0x46cba0[_0xf200('0x23')],_0x46cba0[_0xf200('0x24')],_0x570272[_0xf200('0x11')]?_0x570272[_0xf200('0x11')]['id']:null,_0x570272[_0xf200('0x11')]?_0x570272[_0xf200('0x11')][_0xf200('0x25')]:null,_0x570272[_0xf200('0x11')]?_0x570272[_0xf200('0x11')]['role']:null,_0x32bb86?util[_0xf200('0x26')](_0x32bb86,![],null):''));}}));_0x232004[_0xf200('0x27')](ewinston[_0xf200('0x19')]({'winstonInstance':_0x2c055d,'meta':![],'statusLevels':!![],'msg':function(_0x56daeb,_0x26fc6a){var _0xa2685=_0xf200('0x28');if(_0x56daeb[_0xf200('0x1c')]&&_0x56daeb[_0xf200('0x1c')][_0xf200('0x29')]&&_0x56daeb[_0xf200('0x1c')]['agent_id']){_0xa2685=_0xf200('0x2a');}return util[_0xf200('0x1d')](_0xa2685,_0x56daeb[_0xf200('0x1e')],_0x56daeb[_0xf200('0x1f')][_0xf200('0x20')]?_0x56daeb[_0xf200('0x1f')][_0xf200('0x20')]:_0x56daeb[_0xf200('0x2b')][_0xf200('0x21')]||_0x56daeb['ip'],_0x56daeb[_0xf200('0x22')],_0x26fc6a['statusCode'],_0x26fc6a['responseTime'],_0x56daeb[_0xf200('0x11')]?_0x56daeb[_0xf200('0x11')]['id']:null,_0x56daeb[_0xf200('0x11')]?_0x56daeb[_0xf200('0x11')][_0xf200('0x25')]:null,_0x56daeb[_0xf200('0x11')]?_0x56daeb[_0xf200('0x11')][_0xf200('0xc')]:null,_0x56daeb[_0xf200('0x1c')]&&_0x56daeb['body'][_0xf200('0x29')]?_0x56daeb[_0xf200('0x1c')]['device']:_0xf200('0x2c'),_0x56daeb[_0xf200('0x1c')]&&_0x56daeb[_0xf200('0x1c')][_0xf200('0x2d')]?_0x56daeb[_0xf200('0x1c')][_0xf200('0x2d')]:'',_0x56daeb[_0xf200('0x1c')]&&_0x56daeb[_0xf200('0x1c')][_0xf200('0x2e')]?_0x56daeb[_0xf200('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x1af206){var _0x50935d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x50935d['test'](_0x1af206['url']);}}));return _0x55a971();});}exports[_0xf200('0x2f')]=setupLoggers; \ No newline at end of file +var _0xca16=['other','agent_id','agent_name','test','fs-extra','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','catch','then','user','no-user','data','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime'];(function(_0x4e553a,_0x164116){var _0x4171f9=function(_0x49aa1c){while(--_0x49aa1c){_0x4e553a['push'](_0x4e553a['shift']());}};_0x4171f9(++_0x164116);}(_0xca16,0x1a2));var _0x6ca1=function(_0x61fb2c,_0x20541f){_0x61fb2c=_0x61fb2c-0x0;var _0x15db8=_0xca16[_0x61fb2c];return _0x15db8;};var fs=require(_0x6ca1('0x0'));var _=require('lodash');var ewinston=require(_0x6ca1('0x1'));var path=require(_0x6ca1('0x2'));var util=require(_0x6ca1('0x3'));var fileLogger=require(_0x6ca1('0x4'))[_0x6ca1('0x5')];var safeTemplate=require('./safe-template')[_0x6ca1('0x6')];var maskSensitiveData=require(_0x6ca1('0x7'))[_0x6ca1('0x8')];function ClientSideLogger(){function _0x218ba4(_0x3c8953){var _0x11e0c8=path[_0x6ca1('0x9')](_0x6ca1('0xa'),_0x6ca1('0xb'),_0x6ca1('0xc'));var _0x2a081f=path[_0x6ca1('0x9')](_0x6ca1('0xd'),_0x3c8953['role']+'-'+_0x3c8953[_0x6ca1('0xe')]);return fs[_0x6ca1('0xf')](path['join'](_0x11e0c8,_0x2a081f))['then'](function(){var _0x5a0e38=fileLogger(_0x6ca1('0xd'),path[_0x6ca1('0x9')](_0x11e0c8,_0x2a081f));return _0x5a0e38;})[_0x6ca1('0x10')](function(_0x4215a3){throw _0x4215a3;});}this[_0x6ca1('0xb')]=function(_0x40f489,_0x34aac6,_0x4d7788,_0x1a89fc){return _0x218ba4(_0x40f489['user'])[_0x6ca1('0x11')](function(_0x1f4295){var _0x1c52d6=_0x1f4295[_0x34aac6];return _0x1c52d6;})['then'](function(_0x49e348){var _0x41aa39=_0x40f489[_0x6ca1('0x12')]?_0x40f489[_0x6ca1('0x12')]['id']:_0x6ca1('0x13');var _0x2d7f57=_0x1a89fc[_0x6ca1('0x14')];var _0x3ab880=_0x1a89fc['timestamp'];var _0x48cacb=new Date(Number(_0x3ab880));return _0x49e348(_0x41aa39,_0x48cacb,_0x4d7788,_0x2d7f57);})[_0x6ca1('0x10')](function(_0x154ed2){fileLogger('client')['error'](_0x154ed2);});};}function setupLoggers(_0x13108c){return new Promise(function(_0x1d2ba8){var _0x37fbc4=new ClientSideLogger();var _0x1619f3=fileLogger('api');var _0x399200=fileLogger(_0x6ca1('0x15'));_0x13108c['set'](_0x6ca1('0x16'),_0x37fbc4);_0x13108c[_0x6ca1('0x17')](ewinston[_0x6ca1('0x18')]({'winstonInstance':_0x1619f3,'meta':![],'statusLevels':!![],'msg':function(_0x9203be,_0xc61ed8){var _0x3efd78=_0x6ca1('0x19');if(!_[_0x6ca1('0x1a')](_0x9203be[_0x6ca1('0x1b')])){_0x3efd78+=_0x6ca1('0x1c');var _0x3a6ab0=_0x9203be[_0x6ca1('0x1b')];maskSensitiveData(_0x3a6ab0);}return safeTemplate(util[_0x6ca1('0x1d')](_0x3efd78,_0x9203be[_0x6ca1('0x1e')],_0x9203be['headers']['x-forwarded-for']?_0x9203be[_0x6ca1('0x1f')][_0x6ca1('0x20')]:_0x9203be[_0x6ca1('0x21')][_0x6ca1('0x22')]||_0x9203be['ip'],_0x9203be[_0x6ca1('0x23')],_0xc61ed8['statusCode'],_0xc61ed8['responseTime'],_0x9203be[_0x6ca1('0x12')]?_0x9203be[_0x6ca1('0x12')]['id']:null,_0x9203be[_0x6ca1('0x12')]?_0x9203be['user'][_0x6ca1('0xe')]:null,_0x9203be[_0x6ca1('0x12')]?_0x9203be[_0x6ca1('0x12')][_0x6ca1('0x24')]:null,_0x3a6ab0?util[_0x6ca1('0x25')](_0x3a6ab0,![],null):''));}}));_0x13108c[_0x6ca1('0x17')](ewinston['logger']({'winstonInstance':_0x399200,'meta':![],'statusLevels':!![],'msg':function(_0x4fdd48,_0x4f0688){var _0x234872=_0x6ca1('0x26');if(_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x27')]&&_0x4fdd48[_0x6ca1('0x1b')]['agent_id']){_0x234872=_0x6ca1('0x28');}return util[_0x6ca1('0x1d')](_0x234872,_0x4fdd48[_0x6ca1('0x1e')],_0x4fdd48['headers'][_0x6ca1('0x20')]?_0x4fdd48[_0x6ca1('0x1f')][_0x6ca1('0x20')]:_0x4fdd48[_0x6ca1('0x21')][_0x6ca1('0x22')]||_0x4fdd48['ip'],_0x4fdd48[_0x6ca1('0x23')],_0x4f0688['statusCode'],_0x4f0688[_0x6ca1('0x29')],_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48['user']['id']:null,_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48['user'][_0x6ca1('0xe')]:null,_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48[_0x6ca1('0x12')][_0x6ca1('0x24')]:null,_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x27')]?_0x4fdd48['body'][_0x6ca1('0x27')]:_0x6ca1('0x2a'),_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x2b')]?_0x4fdd48[_0x6ca1('0x1b')]['agent_id']:'',_0x4fdd48['body']&&_0x4fdd48[_0x6ca1('0x1b')]['agent_name']?_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x2c')]:'');},'ignoreRoute':function(_0x362652){var _0x20e77c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20e77c[_0x6ca1('0x2d')](_0x362652[_0x6ca1('0x23')]);}}));return _0x1d2ba8();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index fde3b3b..605e355 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd94b=['path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','meta','Logger','transports','warn','File','%s-%s','error','Console'];(function(_0x404bb0,_0x4e24ac){var _0x142147=function(_0x1a5153){while(--_0x1a5153){_0x404bb0['push'](_0x404bb0['shift']());}};_0x142147(++_0x4e24ac);}(_0xd94b,0x90));var _0xbd94=function(_0xb74c89,_0x246040){_0xb74c89=_0xb74c89-0x0;var _0xe4ccef=_0xd94b[_0xb74c89];return _0xe4ccef;};'use strict';var path=require(_0xbd94('0x0'));var util=require('util');var moment=require(_0xbd94('0x1'));var winston=require(_0xbd94('0x2'));var config=require(_0xbd94('0x3'));var debugLevel=config[_0xbd94('0x4')]?config[_0xbd94('0x4')][_0xbd94('0x5')]():_0xbd94('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xbd94('0x7'),'error':_0xbd94('0x8'),'warn':_0xbd94('0x9'),'info':'white','print':_0xbd94('0xa'),'success':_0xbd94('0xb'),'http':_0xbd94('0xc'),'verbose':_0xbd94('0xd'),'debug':_0xbd94('0xe'),'silly':_0xbd94('0xf')};winston[_0xbd94('0x10')](XC_LOG_COLORS);function getLogFileName(_0x302d10,_0x11ee7d,_0x23587b){var _0x53657e=_0x302d10||'/var/log/xcally';return path[_0xbd94('0x11')](_0x53657e,util[_0xbd94('0x12')](_0xbd94('0x13'),_0x11ee7d,_0x23587b));}function formatter(_0x66bc17,_0x3e1fe5){_0x3e1fe5[_0xbd94('0x14')]=_0x3e1fe5['message']['replace'](/@@{/g,'{{{')[_0xbd94('0x15')](/}@@/g,_0xbd94('0x16'))['replace'](/@{/g,'{{')[_0xbd94('0x15')](/}@/g,'}}');return util[_0xbd94('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xbd94('0x17')),_0x3e1fe5[_0xbd94('0x18')][_0xbd94('0x19')](),_0x66bc17,_0x3e1fe5[_0xbd94('0x14')]);}function fileFormat(_0x26899e,_0x4f55d5){_0x4f55d5[_0xbd94('0x14')]=_0x4f55d5['message'][_0xbd94('0x15')](/@@{/g,_0xbd94('0x1a'))[_0xbd94('0x15')](/}@@/g,_0xbd94('0x16'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x3e6286=_0x4f55d5['meta']&&Object[_0xbd94('0x1b')](_0x4f55d5[_0xbd94('0x1c')])['length']?'\x0a\x09'+JSON['stringify'](_0x4f55d5[_0xbd94('0x1c')]):'';return util[_0xbd94('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xbd94('0x12')](_0xbd94('0x17')),_0x4f55d5[_0xbd94('0x18')][_0xbd94('0x19')](),_0x26899e,_0x4f55d5[_0xbd94('0x14')],_0x3e6286);}function consoleLogger(){var _0x306008=new winston[(_0xbd94('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd94('0x1e'))]['Console']({'level':_0xbd94('0x1f'),'json':![],'formatter':function(_0x5236c4){return formatter('',_0x5236c4);}})]});return _0x306008;}function fileLogger(_0x360de5,_0x1ebff9){var _0x23056b=new winston[(_0xbd94('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd94('0x1e'))][(_0xbd94('0x20'))]({'name':util[_0xbd94('0x12')](_0xbd94('0x21'),_0x360de5,_0xbd94('0x22')),'filename':getLogFileName(_0x1ebff9,_0x360de5,_0xbd94('0x22')),'level':_0xbd94('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x379323){return fileFormat(_0x360de5,_0x379323);}}),new winston[(_0xbd94('0x1e'))]['File']({'name':util[_0xbd94('0x12')](_0xbd94('0x21'),_0x360de5,debugLevel),'filename':getLogFileName(_0x1ebff9,_0x360de5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e1d0c){return fileFormat(_0x360de5,_0x1e1d0c);}}),new winston[(_0xbd94('0x1e'))][(_0xbd94('0x23'))]({'level':'warn','json':![],'formatter':function(_0x11a887){return fileFormat(_0x360de5,_0x11a887);}})]});return _0x23056b;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xfefa=['Logger','transports','Console','warn','error','%s-%s','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x52d9f4,_0x32b8b2){var _0x5ce27a=function(_0x3cce76){while(--_0x3cce76){_0x52d9f4['push'](_0x52d9f4['shift']());}};_0x5ce27a(++_0x32b8b2);}(_0xfefa,0x18d));var _0xafef=function(_0x3e90f5,_0x4985c2){_0x3e90f5=_0x3e90f5-0x0;var _0x43eb62=_0xfefa[_0x3e90f5];return _0x43eb62;};'use strict';var path=require(_0xafef('0x0'));var util=require(_0xafef('0x1'));var moment=require(_0xafef('0x2'));var winston=require(_0xafef('0x3'));var config=require(_0xafef('0x4'));var debugLevel=config[_0xafef('0x5')]?config['debugLevel'][_0xafef('0x6')]():_0xafef('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xafef('0x8'),'warn':_0xafef('0x9'),'info':_0xafef('0xa'),'print':'bold\x20white','success':'bold\x20green','http':_0xafef('0xb'),'verbose':_0xafef('0xc'),'debug':_0xafef('0xd'),'silly':_0xafef('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xdfdf7f,_0x3c7d0c,_0x347f01){var _0x431bbd=_0xdfdf7f||_0xafef('0xf');return path[_0xafef('0x10')](_0x431bbd,util['format'](_0xafef('0x11'),_0x3c7d0c,_0x347f01));}function formatter(_0x48f6d8,_0x221fc9){_0x221fc9[_0xafef('0x12')]=_0x221fc9[_0xafef('0x12')]['replace'](/@@{/g,_0xafef('0x13'))[_0xafef('0x14')](/}@@/g,_0xafef('0x15'))[_0xafef('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xafef('0x16'),moment()[_0xafef('0x17')](_0xafef('0x18')),_0x221fc9[_0xafef('0x19')][_0xafef('0x1a')](),_0x48f6d8,_0x221fc9[_0xafef('0x12')]);}function fileFormat(_0x3e1132,_0x55e040){_0x55e040['message']=_0x55e040[_0xafef('0x12')][_0xafef('0x14')](/@@{/g,_0xafef('0x13'))['replace'](/}@@/g,_0xafef('0x15'))[_0xafef('0x14')](/@{/g,'{{')[_0xafef('0x14')](/}@/g,'}}');var _0xa86603=_0x55e040[_0xafef('0x1b')]&&Object[_0xafef('0x1c')](_0x55e040['meta'])[_0xafef('0x1d')]?'\x0a\x09'+JSON[_0xafef('0x1e')](_0x55e040['meta']):'';return util[_0xafef('0x17')](_0xafef('0x1f'),moment()[_0xafef('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),_0x55e040[_0xafef('0x19')]['toUpperCase'](),_0x3e1132,_0x55e040[_0xafef('0x12')],_0xa86603);}function consoleLogger(){var _0x2c0b19=new winston[(_0xafef('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xafef('0x21'))][(_0xafef('0x22'))]({'level':_0xafef('0x23'),'json':![],'formatter':function(_0x2ff1c4){return formatter('',_0x2ff1c4);}})]});return _0x2c0b19;}function fileLogger(_0x3c037d,_0x122d53){var _0x47b3de=new winston[(_0xafef('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xafef('0x17')]('%s-%s',_0x3c037d,'error'),'filename':getLogFileName(_0x122d53,_0x3c037d,_0xafef('0x24')),'level':_0xafef('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x27af2c){return fileFormat(_0x3c037d,_0x27af2c);}}),new winston[(_0xafef('0x21'))]['File']({'name':util[_0xafef('0x17')](_0xafef('0x25'),_0x3c037d,debugLevel),'filename':getLogFileName(_0x122d53,_0x3c037d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18291b){return fileFormat(_0x3c037d,_0x18291b);}}),new winston[(_0xafef('0x21'))][(_0xafef('0x22'))]({'level':'warn','json':![],'formatter':function(_0x37c63e){return fileFormat(_0x3c037d,_0x37c63e);}})]});return _0x47b3de;}exports['consoleLogger']=consoleLogger;exports[_0xafef('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 0597045..2190dac 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x1a85,0x178));var _0x51a8=function(_0xe27810,_0x8b3e76){_0xe27810=_0xe27810-0x0;var _0x53dcec=_0x1a85[_0xe27810];return _0x53dcec;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x3204f2,_0x5d1dd8){var _0x28ea6a=function(_0x3f8f2c){while(--_0x3f8f2c){_0x3204f2['push'](_0x3204f2['shift']());}};_0x28ea6a(++_0x5d1dd8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 74152d1..2ca8473 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file +var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x34bff6,_0x36f01d){var _0x2704ee=function(_0x2fea17){while(--_0x2fea17){_0x34bff6['push'](_0x34bff6['shift']());}};_0x2704ee(++_0x36f01d);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file